From: support Date: Tue, 28 Feb 2023 10:33:57 +0000 (+0000) Subject: Built motion from commit 8c034dcd.|2.6.31 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:;/%22?a=commitdiff_plain;h=07c2caee3531dd9c638c01fdbc5813c41eb44f84;p=motion2.git Built motion from commit 8c034dcd.|2.6.31 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index c20ec34..602bed5 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.6.30", + "version": "2.6.31", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-02-23T15:26:20.737Z", + "time": "2023-02-28T10:24:57.355Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index fbdc98a..e340764 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.6.30", + "version": "2.6.31", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-02-23T15:26:20.737Z", + "time": "2023-02-28T10:24:57.355Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 79d1d28..b5730ae 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.30", + "version": "2.6.31", "dependencies": { "@babel/code-frame": { "version": "7.18.6", diff --git a/package.json b/package.json index 98d3c67..5e87c80 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.30", + "version": "2.6.31", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { diff --git a/server/Release_scripts.md b/server/Release_scripts.md new file mode 100644 index 0000000..19bfca0 --- /dev/null +++ b/server/Release_scripts.md @@ -0,0 +1,17 @@ +# Release scripts + +## Tag master +```bash +git checkout master +git pull origin master +git tag -a 2.6.30 -m "Versione 2.6.30" +git push origin --tags +``` + +## Merge master to develop +```bash +git checkout develop +git pull origin master +git push origin develop +``` + diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 80efc21..86d0220 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 _0xf3b0=['contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL','action','contactManager','integration','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xf3b0,0x15d));var _0x0f3b=function(_0x285800,_0x26765e){_0x285800=_0x285800-0x0;var _0x4b809e=_0xf3b0[_0x285800];return _0x4b809e;};'use strict';var Sequelize=require('sequelize');module[_0x0f3b('0x0')]={'name':{'type':Sequelize[_0x0f3b('0x1')],'get':function(_0xfecf96){return this['getDataValue'](_0x0f3b('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x0f3b('0x3'),_0x0f3b('0x4'),'motionbar',_0x0f3b('0x5'),_0x0f3b('0x6'),_0x0f3b('0x7'),'bot',_0x0f3b('0x8')]],'msg':_0x0f3b('0x9')}},'comment':_0x0f3b('0x9')},'data1':{'type':Sequelize[_0x0f3b('0xa')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x0f3b('0xa')](0x1000),'comment':_0x0f3b('0xb')},'data3':{'type':Sequelize[_0x0f3b('0xa')](0x1000),'comment':_0x0f3b('0xc')},'data4':{'type':Sequelize[_0x0f3b('0xa')](0x1000),'comments':_0x0f3b('0xd')},'data5':{'type':Sequelize[_0x0f3b('0xa')](0x1000),'comments':_0x0f3b('0xe')},'data6':{'type':Sequelize['STRING'],'comments':_0x0f3b('0xf')},'data7':{'type':Sequelize[_0x0f3b('0x10')],'comments':_0x0f3b('0x11')}}; \ No newline at end of file +var _0xb681=['exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','TEXT','urlForward[body]','sequelize'];(function(_0xe534e,_0x4aac7d){var _0xf0827a=function(_0x86039b){while(--_0x86039b){_0xe534e['push'](_0xe534e['shift']());}};_0xf0827a(++_0x4aac7d);}(_0xb681,0x153));var _0x1b68=function(_0x2565d1,_0x31077c){_0x2565d1=_0x2565d1-0x0;var _0x54a1fc=_0xb681[_0x2565d1];return _0x54a1fc;};'use strict';var Sequelize=require(_0x1b68('0x0'));module[_0x1b68('0x1')]={'name':{'type':Sequelize[_0x1b68('0x2')],'get':function(_0x1adca9){return this[_0x1b68('0x3')](_0x1b68('0x4'));}},'action':{'type':Sequelize[_0x1b68('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x1b68('0x6'),_0x1b68('0x7'),_0x1b68('0x8'),'jscripty',_0x1b68('0x9'),'browser',_0x1b68('0xa'),_0x1b68('0xb')]],'msg':_0x1b68('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x1b68('0x5')](0x1000),'comment':_0x1b68('0xd')},'data4':{'type':Sequelize[_0x1b68('0x5')](0x1000),'comments':_0x1b68('0xe')},'data5':{'type':Sequelize[_0x1b68('0x5')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x1b68('0x5')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x1b68('0xf')],'comments':_0x1b68('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 3e03087..2d881fb 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 _0xdcd4=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','error','name','body','Action','find','params','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto'];(function(_0x86c6cb,_0x30bb53){var _0x1b1592=function(_0x19e1c9){while(--_0x19e1c9){_0x86c6cb['push'](_0x86c6cb['shift']());}};_0x1b1592(++_0x30bb53);}(_0xdcd4,0x1b3));var _0x4dcd=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xdcd4[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x4dcd('0x0'));var rimraf=require(_0x4dcd('0x1'));var zipdir=require(_0x4dcd('0x2'));var jsonpatch=require(_0x4dcd('0x3'));var rp=require(_0x4dcd('0x4'));var moment=require('moment');var BPromise=require(_0x4dcd('0x5'));var Mustache=require(_0x4dcd('0x6'));var util=require(_0x4dcd('0x7'));var path=require(_0x4dcd('0x8'));var sox=require(_0x4dcd('0x9'));var csv=require('to-csv');var ejs=require(_0x4dcd('0xa'));var fs=require('fs');var fs_extra=require(_0x4dcd('0xb'));var _=require(_0x4dcd('0xc'));var squel=require(_0x4dcd('0xd'));var crypto=require(_0x4dcd('0xe'));var jsforce=require(_0x4dcd('0xf'));var deskjs=require(_0x4dcd('0x10'));var toCsv=require(_0x4dcd('0x11'));var querystring=require(_0x4dcd('0x12'));var Papa=require(_0x4dcd('0x13'));var Redis=require(_0x4dcd('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x4dcd('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4dcd('0x16'));var logger=require(_0x4dcd('0x17'))(_0x4dcd('0x18'));var utils=require(_0x4dcd('0x19'));var config=require(_0x4dcd('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x4dcd('0x1b'))['db'];function respondWithStatusCode(_0x4b5944,_0x246c2a){_0x246c2a=_0x246c2a||0xcc;return function(_0x3b4c93){if(_0x3b4c93){return _0x4b5944[_0x4dcd('0x1c')](_0x246c2a);}return _0x4b5944[_0x4dcd('0x1d')](_0x246c2a)[_0x4dcd('0x1e')]();};}function respondWithResult(_0x1e2aa9,_0x30a1ec){_0x30a1ec=_0x30a1ec||0xc8;return function(_0xc50e6c){if(_0xc50e6c){return _0x1e2aa9[_0x4dcd('0x1d')](_0x30a1ec)[_0x4dcd('0x1f')](_0xc50e6c);}};}function respondWithFilteredResult(_0x1ef4be,_0x5a7f76){return function(_0x362b68){if(_0x362b68){var _0x5f129f=typeof _0x5a7f76[_0x4dcd('0x20')]==='undefined'&&typeof _0x5a7f76[_0x4dcd('0x21')]===_0x4dcd('0x22');var _0x58cd42=_0x362b68['count'];var _0x4764b9=_0x5f129f?0x0:_0x5a7f76[_0x4dcd('0x20')];var _0x548b2b=_0x5f129f?_0x362b68[_0x4dcd('0x23')]:_0x5a7f76[_0x4dcd('0x20')]+_0x5a7f76[_0x4dcd('0x21')];var _0x1f991b;if(_0x548b2b>=_0x58cd42){_0x548b2b=_0x58cd42;_0x1f991b=0xc8;}else{_0x1f991b=0xce;}_0x1ef4be[_0x4dcd('0x1d')](_0x1f991b);return _0x1ef4be[_0x4dcd('0x24')]('Content-Range',_0x4764b9+'-'+_0x548b2b+'/'+_0x58cd42)['json'](_0x362b68);}return null;};}function patchUpdates(_0x21bd1f){return function(_0x127045){try{jsonpatch[_0x4dcd('0x25')](_0x127045,_0x21bd1f,!![]);}catch(_0x4d0f5b){return BPromise[_0x4dcd('0x26')](_0x4d0f5b);}return _0x127045[_0x4dcd('0x27')]();};}function saveUpdates(_0x31cdbb,_0x3edebf){return function(_0xaafeba){if(_0xaafeba){return _0xaafeba[_0x4dcd('0x28')](_0x31cdbb)[_0x4dcd('0x29')](function(_0x112f68){return _0x112f68;});}return null;};}function removeEntity(_0x421e60,_0x496be7){return function(_0x18fce6){if(_0x18fce6){return _0x18fce6['destroy']()['then'](function(){_0x421e60[_0x4dcd('0x1d')](0xcc)[_0x4dcd('0x1e')]();});}};}function handleEntityNotFound(_0x13c105,_0x13de99){return function(_0x47b3b1){if(!_0x47b3b1){_0x13c105[_0x4dcd('0x1c')](0x194);}return _0x47b3b1;};}function handleError(_0x1c83a1,_0x1d91b3){_0x1d91b3=_0x1d91b3||0x1f4;return function(_0x2cd4e8){logger[_0x4dcd('0x2a')](_0x2cd4e8['stack']);if(_0x2cd4e8[_0x4dcd('0x2b')]){delete _0x2cd4e8[_0x4dcd('0x2b')];}_0x1c83a1[_0x4dcd('0x1d')](_0x1d91b3)['send'](_0x2cd4e8);};}exports[_0x4dcd('0x28')]=function(_0x1b4f5b,_0x33f582){if(_0x1b4f5b[_0x4dcd('0x2c')]['id']){delete _0x1b4f5b[_0x4dcd('0x2c')]['id'];}return db[_0x4dcd('0x2d')][_0x4dcd('0x2e')]({'where':{'id':_0x1b4f5b[_0x4dcd('0x2f')]['id']}})[_0x4dcd('0x29')](handleEntityNotFound(_0x33f582,null))[_0x4dcd('0x29')](saveUpdates(_0x1b4f5b[_0x4dcd('0x2c')],null))[_0x4dcd('0x29')](respondWithResult(_0x33f582,null))[_0x4dcd('0x30')](handleError(_0x33f582,null));};exports[_0x4dcd('0x31')]=function(_0x4dc0ab,_0x27d3f3){return db[_0x4dcd('0x2d')]['find']({'where':{'id':_0x4dc0ab[_0x4dcd('0x2f')]['id']}})[_0x4dcd('0x29')](handleEntityNotFound(_0x27d3f3,null))[_0x4dcd('0x29')](removeEntity(_0x27d3f3,null))[_0x4dcd('0x30')](handleError(_0x27d3f3,null));}; \ No newline at end of file +var _0xb547=['params','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','then','destroy','sendStatus','error','name','send','update','Action','find'];(function(_0x41bdd4,_0x3d5c76){var _0x5c03a6=function(_0x59634a){while(--_0x59634a){_0x41bdd4['push'](_0x41bdd4['shift']());}};_0x5c03a6(++_0x3d5c76);}(_0xb547,0x1a1));var _0x7b54=function(_0x1ea6eb,_0x33d3d4){_0x1ea6eb=_0x1ea6eb-0x0;var _0x127200=_0xb547[_0x1ea6eb];return _0x127200;};'use strict';var emlformat=require(_0x7b54('0x0'));var rimraf=require(_0x7b54('0x1'));var zipdir=require(_0x7b54('0x2'));var jsonpatch=require(_0x7b54('0x3'));var rp=require('request-promise');var moment=require(_0x7b54('0x4'));var BPromise=require(_0x7b54('0x5'));var Mustache=require('mustache');var util=require(_0x7b54('0x6'));var path=require(_0x7b54('0x7'));var sox=require(_0x7b54('0x8'));var csv=require(_0x7b54('0x9'));var ejs=require(_0x7b54('0xa'));var fs=require('fs');var fs_extra=require(_0x7b54('0xb'));var _=require('lodash');var squel=require(_0x7b54('0xc'));var crypto=require('crypto');var jsforce=require(_0x7b54('0xd'));var deskjs=require(_0x7b54('0xe'));var toCsv=require(_0x7b54('0x9'));var querystring=require('querystring');var Papa=require(_0x7b54('0xf'));var Redis=require(_0x7b54('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7b54('0x11'));var as=require(_0x7b54('0x12'));var hardwareService=require(_0x7b54('0x13'));var logger=require(_0x7b54('0x14'))('api');var utils=require(_0x7b54('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7b54('0x16'));var db=require(_0x7b54('0x17'))['db'];function respondWithStatusCode(_0xb42eb8,_0x58165d){_0x58165d=_0x58165d||0xcc;return function(_0x1f3cf6){if(_0x1f3cf6){return _0xb42eb8['sendStatus'](_0x58165d);}return _0xb42eb8[_0x7b54('0x18')](_0x58165d)['end']();};}function respondWithResult(_0x73c549,_0x5db416){_0x5db416=_0x5db416||0xc8;return function(_0xce6a86){if(_0xce6a86){return _0x73c549[_0x7b54('0x18')](_0x5db416)['json'](_0xce6a86);}};}function respondWithFilteredResult(_0x33e068,_0x2c9a57){return function(_0x5b5734){if(_0x5b5734){var _0x1d4f74=typeof _0x2c9a57['offset']==='undefined'&&typeof _0x2c9a57[_0x7b54('0x19')]===_0x7b54('0x1a');var _0x32a042=_0x5b5734[_0x7b54('0x1b')];var _0x34fec7=_0x1d4f74?0x0:_0x2c9a57[_0x7b54('0x1c')];var _0x54c197=_0x1d4f74?_0x5b5734['count']:_0x2c9a57[_0x7b54('0x1c')]+_0x2c9a57[_0x7b54('0x19')];var _0x474444;if(_0x54c197>=_0x32a042){_0x54c197=_0x32a042;_0x474444=0xc8;}else{_0x474444=0xce;}_0x33e068[_0x7b54('0x18')](_0x474444);return _0x33e068[_0x7b54('0x1d')](_0x7b54('0x1e'),_0x34fec7+'-'+_0x54c197+'/'+_0x32a042)[_0x7b54('0x1f')](_0x5b5734);}return null;};}function patchUpdates(_0x2c69f3){return function(_0x170656){try{jsonpatch[_0x7b54('0x20')](_0x170656,_0x2c69f3,!![]);}catch(_0x4eec14){return BPromise[_0x7b54('0x21')](_0x4eec14);}return _0x170656['save']();};}function saveUpdates(_0x2f0297,_0x592f4b){return function(_0x550148){if(_0x550148){return _0x550148['update'](_0x2f0297)[_0x7b54('0x22')](function(_0x2a8068){return _0x2a8068;});}return null;};}function removeEntity(_0x318cf9,_0x1257a7){return function(_0x45f594){if(_0x45f594){return _0x45f594[_0x7b54('0x23')]()['then'](function(){_0x318cf9[_0x7b54('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1516df,_0x2e596a){return function(_0x4e1576){if(!_0x4e1576){_0x1516df[_0x7b54('0x24')](0x194);}return _0x4e1576;};}function handleError(_0x1b0295,_0x3e7ab7){_0x3e7ab7=_0x3e7ab7||0x1f4;return function(_0x17a834){logger[_0x7b54('0x25')](_0x17a834['stack']);if(_0x17a834[_0x7b54('0x26')]){delete _0x17a834[_0x7b54('0x26')];}_0x1b0295[_0x7b54('0x18')](_0x3e7ab7)[_0x7b54('0x27')](_0x17a834);};}exports[_0x7b54('0x28')]=function(_0x1a1da0,_0x3c25bf){if(_0x1a1da0['body']['id']){delete _0x1a1da0['body']['id'];}return db[_0x7b54('0x29')][_0x7b54('0x2a')]({'where':{'id':_0x1a1da0[_0x7b54('0x2b')]['id']}})[_0x7b54('0x22')](handleEntityNotFound(_0x3c25bf,null))[_0x7b54('0x22')](saveUpdates(_0x1a1da0[_0x7b54('0x2c')],null))['then'](respondWithResult(_0x3c25bf,null))[_0x7b54('0x2d')](handleError(_0x3c25bf,null));};exports[_0x7b54('0x23')]=function(_0x86014b,_0x3bbe69){return db[_0x7b54('0x29')][_0x7b54('0x2a')]({'where':{'id':_0x86014b[_0x7b54('0x2b')]['id']}})[_0x7b54('0x22')](handleEntityNotFound(_0x3bbe69,null))[_0x7b54('0x22')](removeEntity(_0x3bbe69,null))[_0x7b54('0x2d')](handleError(_0x3bbe69,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index d0076e2..9489077 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 _0x5f11=['exports','define','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./action.attributes'];(function(_0xc49513,_0x18ed11){var _0x1194bc=function(_0x59b707){while(--_0x59b707){_0xc49513['push'](_0xc49513['shift']());}};_0x1194bc(++_0x18ed11);}(_0x5f11,0x98));var _0x15f1=function(_0x4f7b07,_0x372be0){_0x4f7b07=_0x4f7b07-0x0;var _0x1268c6=_0x5f11[_0x4f7b07];return _0x1268c6;};'use strict';var _=require(_0x15f1('0x0'));var util=require(_0x15f1('0x1'));var logger=require(_0x15f1('0x2'))('api');var moment=require(_0x15f1('0x3'));var BPromise=require(_0x15f1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x15f1('0x5'));var rimraf=require('rimraf');var config=require(_0x15f1('0x6'));var attributes=require(_0x15f1('0x7'));module[_0x15f1('0x8')]=function(_0x3e8819,_0x407626){return _0x3e8819[_0x15f1('0x9')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85be=['rimraf','./action.attributes','exports','define','tools_actions','lodash','util','api','moment','request-promise','path'];(function(_0x143ee7,_0x18e5d3){var _0x31b693=function(_0xbe2612){while(--_0xbe2612){_0x143ee7['push'](_0x143ee7['shift']());}};_0x31b693(++_0x18e5d3);}(_0x85be,0x1c8));var _0xe85b=function(_0x573a8b,_0x26c29f){_0x573a8b=_0x573a8b-0x0;var _0x25a2ff=_0x85be[_0x573a8b];return _0x25a2ff;};'use strict';var _=require(_0xe85b('0x0'));var util=require(_0xe85b('0x1'));var logger=require('../../config/logger')(_0xe85b('0x2'));var moment=require(_0xe85b('0x3'));var BPromise=require('bluebird');var rp=require(_0xe85b('0x4'));var fs=require('fs');var path=require(_0xe85b('0x5'));var rimraf=require(_0xe85b('0x6'));var config=require('../../config/environment');var attributes=require(_0xe85b('0x7'));module[_0xe85b('0x8')]=function(_0x32c3e9,_0x1fa0e1){return _0x32c3e9[_0xe85b('0x9')]('Action',attributes,{'tableName':_0xe85b('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 76d102a..27ed211 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 _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\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(_0x16f5be,_0x4b5f97){var _0xbdda95=function(_0x5bdfdf){while(--_0x5bdfdf){_0x16f5be['push'](_0x16f5be['shift']());}};_0xbdda95(++_0x4b5f97);}(_0x1261,0x144));var _0x1126=function(_0x13321a,_0x273c96){_0x13321a=_0x13321a-0x0;var _0x452c07=_0x1261[_0x13321a];return _0x452c07;};'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')]('Action,\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 +var _0x814b=['info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x814b,0x1a2));var _0xb814=function(_0x39e15b,_0x555185){_0x39e15b=_0x39e15b-0x0;var _0x4e5766=_0x814b[_0x39e15b];return _0x4e5766;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Action,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 322ec64..56f4a11 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 _0xc47d=['isAuthenticated','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id'];(function(_0x53e29e,_0x17c540){var _0x54c118=function(_0x45b1bf){while(--_0x45b1bf){_0x53e29e['push'](_0x53e29e['shift']());}};_0x54c118(++_0x17c540);}(_0xc47d,0x1f2));var _0xdc47=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc47d[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0xdc47('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdc47('0x1'));var router=express[_0xdc47('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xdc47('0x3'));var interaction=require(_0xdc47('0x4'));var config=require(_0xdc47('0x5'));var controller=require(_0xdc47('0x6'));router[_0xdc47('0x7')](_0xdc47('0x8'),auth[_0xdc47('0x9')](),controller['update']);router[_0xdc47('0xa')]('/:id',auth[_0xdc47('0x9')](),controller[_0xdc47('0xb')]);module[_0xdc47('0xc')]=router; \ No newline at end of file +var _0x6c99=['/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','isAuthenticated','update','delete'];(function(_0x1d1963,_0x32cc0e){var _0x3f58bb=function(_0x514823){while(--_0x514823){_0x1d1963['push'](_0x1d1963['shift']());}};_0x3f58bb(++_0x32cc0e);}(_0x6c99,0x113));var _0x96c9=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x6c99[_0x525c7b];return _0x27b33e;};'use strict';var multer=require(_0x96c9('0x0'));var util=require(_0x96c9('0x1'));var path=require('path');var timeout=require(_0x96c9('0x2'));var express=require(_0x96c9('0x3'));var router=express[_0x96c9('0x4')]();var fs_extra=require(_0x96c9('0x5'));var auth=require(_0x96c9('0x6'));var interaction=require(_0x96c9('0x7'));var config=require(_0x96c9('0x8'));var controller=require('./action.controller');router[_0x96c9('0x9')]('/:id',auth[_0x96c9('0xa')](),controller[_0x96c9('0xb')]);router[_0x96c9('0xc')](_0x96c9('0xd'),auth[_0x96c9('0xa')](),controller[_0x96c9('0xe')]);module[_0x96c9('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 0e44a80..69f1bf2 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 _0x6f47=['TEXT','exports','STRING'];(function(_0x3a21d0,_0x52afc5){var _0xe70ae2=function(_0xdd58c5){while(--_0xdd58c5){_0x3a21d0['push'](_0x3a21d0['shift']());}};_0xe70ae2(++_0x52afc5);}(_0x6f47,0xc7));var _0x76f4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6f47[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x76f4('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x76f4('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1cb9=['TEXT','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1b5931,_0xcce6cb){_0x1b5931=_0x1b5931-0x0;var _0x1d85da=_0x1cb9[_0x1b5931];return _0x1d85da;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x91cb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x91cb('0x1')]},'parent':{'type':Sequelize[_0x91cb('0x1')]},'table':{'type':Sequelize[_0x91cb('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x91cb('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 6004421..e5a07a6 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 _0x9feb=['AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','keys','intersection','attributes','fields','query','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','rules','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','function','replace','format','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','left_join','SUM(%s)','MAX(%s)','includes','AnalyticMetric','select','metric','%s.%s\x20=\x20%s.%s','output','fullPath','%s-%s.%s','randomstring','generate','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','Run\x20Query:','child_process','fork','../../components/export/','savename','COUNT(*)','value','groupBy','alias','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','then','get','UserProfileResource','name'];(function(_0xa6e4c8,_0x52e242){var _0x29e0c8=function(_0x2caaf2){while(--_0x2caaf2){_0xa6e4c8['push'](_0xa6e4c8['shift']());}};_0x29e0c8(++_0x52e242);}(_0x9feb,0x1c0));var _0xb9fe=function(_0xf879bb,_0x5aaebf){_0xf879bb=_0xf879bb-0x0;var _0x277abc=_0x9feb[_0xf879bb];return _0x277abc;};'use strict';var emlformat=require(_0xb9fe('0x0'));var rimraf=require(_0xb9fe('0x1'));var zipdir=require(_0xb9fe('0x2'));var jsonpatch=require(_0xb9fe('0x3'));var rp=require(_0xb9fe('0x4'));var moment=require(_0xb9fe('0x5'));var BPromise=require(_0xb9fe('0x6'));var Mustache=require('mustache');var util=require(_0xb9fe('0x7'));var path=require(_0xb9fe('0x8'));var sox=require(_0xb9fe('0x9'));var csv=require(_0xb9fe('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb9fe('0xb'));var _=require(_0xb9fe('0xc'));var squel=require(_0xb9fe('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb9fe('0xe'));var toCsv=require(_0xb9fe('0xa'));var querystring=require('querystring');var Papa=require(_0xb9fe('0xf'));var Redis=require('ioredis');var authService=require(_0xb9fe('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb9fe('0x11'));var hardwareService=require(_0xb9fe('0x12'));var logger=require(_0xb9fe('0x13'))(_0xb9fe('0x14'));var utils=require(_0xb9fe('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb9fe('0x16'))['db'];var dbH=require('../../mysqldb')[_0xb9fe('0x17')];function respondWithStatusCode(_0x231fbf,_0x2aba6a){_0x2aba6a=_0x2aba6a||0xcc;return function(_0x216678){if(_0x216678){return _0x231fbf[_0xb9fe('0x18')](_0x2aba6a);}return _0x231fbf[_0xb9fe('0x19')](_0x2aba6a)[_0xb9fe('0x1a')]();};}function respondWithResult(_0x572bb4,_0x4c4784){_0x4c4784=_0x4c4784||0xc8;return function(_0x206af1){if(_0x206af1){return _0x572bb4[_0xb9fe('0x19')](_0x4c4784)[_0xb9fe('0x1b')](_0x206af1);}};}function respondWithFilteredResult(_0x154b38,_0x3b894c){return function(_0x548376){if(_0x548376){var _0x3416f0=typeof _0x3b894c[_0xb9fe('0x1c')]===_0xb9fe('0x1d')&&typeof _0x3b894c['limit']===_0xb9fe('0x1d');var _0x2fae14=_0x548376['count'];var _0x55aa68=_0x3416f0?0x0:_0x3b894c['offset'];var _0x1fa7d0=_0x3416f0?_0x548376[_0xb9fe('0x1e')]:_0x3b894c[_0xb9fe('0x1c')]+_0x3b894c[_0xb9fe('0x1f')];var _0x13e68a;if(_0x1fa7d0>=_0x2fae14){_0x1fa7d0=_0x2fae14;_0x13e68a=0xc8;}else{_0x13e68a=0xce;}_0x154b38['status'](_0x13e68a);return _0x154b38[_0xb9fe('0x20')](_0xb9fe('0x21'),_0x55aa68+'-'+_0x1fa7d0+'/'+_0x2fae14)[_0xb9fe('0x1b')](_0x548376);}return null;};}function patchUpdates(_0xbcedb6){return function(_0x1b8ccf){try{jsonpatch[_0xb9fe('0x22')](_0x1b8ccf,_0xbcedb6,!![]);}catch(_0x398d5b){return BPromise['reject'](_0x398d5b);}return _0x1b8ccf['save']();};}function saveUpdates(_0x56db76,_0xe1a332){return function(_0x462909){if(_0x462909){return _0x462909[_0xb9fe('0x23')](_0x56db76)['then'](function(_0x4e8e6a){return _0x4e8e6a;});}return null;};}function removeEntity(_0x106bbd,_0x1c3058){return function(_0xc2b2c6){if(_0xc2b2c6){return _0xc2b2c6[_0xb9fe('0x24')]()[_0xb9fe('0x25')](function(){var _0x359f66=_0xc2b2c6[_0xb9fe('0x26')]({'plain':!![]});var _0x20a8f6='CustomReports';return db[_0xb9fe('0x27')][_0xb9fe('0x24')]({'where':{'type':_0x20a8f6,'resourceId':_0x359f66['id']}})[_0xb9fe('0x25')](function(){return _0xc2b2c6;});})['then'](function(){_0x106bbd[_0xb9fe('0x19')](0xcc)[_0xb9fe('0x1a')]();});}};}function handleEntityNotFound(_0x58fa64,_0x5c9cf4){return function(_0x10c2f2){if(!_0x10c2f2){_0x58fa64[_0xb9fe('0x18')](0x194);}return _0x10c2f2;};}function handleError(_0xaff1cd,_0x499d59){_0x499d59=_0x499d59||0x1f4;return function(_0x21981f){logger['error'](_0x21981f['stack']);if(_0x21981f[_0xb9fe('0x28')]){delete _0x21981f[_0xb9fe('0x28')];}_0xaff1cd['status'](_0x499d59)['send'](_0x21981f);};}exports['index']=function(_0x129a8f,_0x1477fa){var _0x4be4fd={},_0x3de764={},_0x216839={'count':0x0,'rows':[]};var _0x1b8bbb=_['map'](db[_0xb9fe('0x29')][_0xb9fe('0x2a')],function(_0x5eb5ed){return{'name':_0x5eb5ed[_0xb9fe('0x2b')],'type':_0x5eb5ed[_0xb9fe('0x2c')][_0xb9fe('0x2d')]};});_0x3de764[_0xb9fe('0x2e')]=_[_0xb9fe('0x2f')](_0x1b8bbb,_0xb9fe('0x28'));_0x3de764['query']=_[_0xb9fe('0x30')](_0x129a8f['query']);_0x3de764['filters']=_[_0xb9fe('0x31')](_0x3de764['model'],_0x3de764['query']);_0x4be4fd[_0xb9fe('0x32')]=_[_0xb9fe('0x31')](_0x3de764[_0xb9fe('0x2e')],qs[_0xb9fe('0x33')](_0x129a8f[_0xb9fe('0x34')][_0xb9fe('0x33')]));_0x4be4fd[_0xb9fe('0x32')]=_0x4be4fd[_0xb9fe('0x32')]['length']?_0x4be4fd[_0xb9fe('0x32')]:_0x3de764['model'];if(!_0x129a8f[_0xb9fe('0x34')][_0xb9fe('0x35')](_0xb9fe('0x36'))){_0x4be4fd[_0xb9fe('0x1f')]=qs['limit'](_0x129a8f[_0xb9fe('0x34')][_0xb9fe('0x1f')]);_0x4be4fd['offset']=qs[_0xb9fe('0x1c')](_0x129a8f[_0xb9fe('0x34')][_0xb9fe('0x1c')]);}_0x4be4fd[_0xb9fe('0x37')]=qs['sort'](_0x129a8f['query'][_0xb9fe('0x38')]);_0x4be4fd[_0xb9fe('0x39')]=qs['filters'](_[_0xb9fe('0x3a')](_0x129a8f[_0xb9fe('0x34')],_0x3de764[_0xb9fe('0x3b')]),_0x1b8bbb);if(_0x129a8f[_0xb9fe('0x34')][_0xb9fe('0x3c')]){_0x4be4fd[_0xb9fe('0x39')]=_['merge'](_0x4be4fd['where'],{'$or':_[_0xb9fe('0x2f')](_0x1b8bbb,function(_0x172419){if(_0x172419['type']!==_0xb9fe('0x3d')){var _0x22b4b1={};_0x22b4b1[_0x172419[_0xb9fe('0x28')]]={'$like':'%'+_0x129a8f[_0xb9fe('0x34')]['filter']+'%'};return _0x22b4b1;}})});}_0x4be4fd=_[_0xb9fe('0x3e')]({},_0x4be4fd,_0x129a8f[_0xb9fe('0x3f')]);var _0x1def98={'where':_0x4be4fd[_0xb9fe('0x39')]};return db[_0xb9fe('0x29')][_0xb9fe('0x1e')](_0x1def98)[_0xb9fe('0x25')](function(_0x5769fb){_0x216839[_0xb9fe('0x1e')]=_0x5769fb;if(_0x129a8f[_0xb9fe('0x34')][_0xb9fe('0x40')]){_0x4be4fd[_0xb9fe('0x41')]=[{'all':!![]}];}return db[_0xb9fe('0x29')][_0xb9fe('0x42')](_0x4be4fd);})[_0xb9fe('0x25')](function(_0xcea1d9){_0x216839[_0xb9fe('0x43')]=_0xcea1d9;return _0x216839;})[_0xb9fe('0x25')](respondWithFilteredResult(_0x1477fa,_0x4be4fd))[_0xb9fe('0x44')](handleError(_0x1477fa,null));};exports[_0xb9fe('0x45')]=function(_0x4d4a0b,_0x236a91){var _0x3b4101={'raw':![],'where':{'id':_0x4d4a0b['params']['id']}},_0x48095f={};_0x48095f[_0xb9fe('0x2e')]=_[_0xb9fe('0x30')](db['AnalyticCustomReport'][_0xb9fe('0x2a')]);_0x48095f[_0xb9fe('0x34')]=_[_0xb9fe('0x30')](_0x4d4a0b[_0xb9fe('0x34')]);_0x48095f[_0xb9fe('0x3b')]=_['intersection'](_0x48095f[_0xb9fe('0x2e')],_0x48095f['query']);_0x3b4101['attributes']=_['intersection'](_0x48095f[_0xb9fe('0x2e')],qs[_0xb9fe('0x33')](_0x4d4a0b[_0xb9fe('0x34')]['fields']));_0x3b4101[_0xb9fe('0x32')]=_0x3b4101[_0xb9fe('0x32')][_0xb9fe('0x46')]?_0x3b4101[_0xb9fe('0x32')]:_0x48095f[_0xb9fe('0x2e')];if(_0x4d4a0b[_0xb9fe('0x34')]['includeAll']){_0x3b4101[_0xb9fe('0x41')]=[{'all':!![]}];}_0x3b4101=_[_0xb9fe('0x3e')]({},_0x3b4101,_0x4d4a0b[_0xb9fe('0x3f')]);return db['AnalyticCustomReport'][_0xb9fe('0x47')](_0x3b4101)[_0xb9fe('0x25')](handleEntityNotFound(_0x236a91,null))['then'](respondWithResult(_0x236a91,null))['catch'](handleError(_0x236a91,null));};exports[_0xb9fe('0x48')]=function(_0x572083,_0x3f6f3c){return db[_0xb9fe('0x29')]['create'](_0x572083[_0xb9fe('0x49')],{})[_0xb9fe('0x25')](function(_0x451e2a){var _0xca115f=_0x572083[_0xb9fe('0x4a')]['get']({'plain':!![]});if(!_0xca115f)throw new Error(_0xb9fe('0x4b'));if(_0xca115f[_0xb9fe('0x4c')]===_0xb9fe('0x4a')){var _0x17c13a=_0x451e2a['get']({'plain':!![]});var _0x23d606=_0xb9fe('0x4d');return db[_0xb9fe('0x4e')][_0xb9fe('0x47')]({'where':{'name':_0x23d606,'userProfileId':_0xca115f[_0xb9fe('0x4f')]},'raw':!![]})[_0xb9fe('0x25')](function(_0x854f87){if(_0x854f87&&_0x854f87[_0xb9fe('0x50')]===0x0){return db[_0xb9fe('0x27')][_0xb9fe('0x48')]({'name':_0x17c13a['name'],'resourceId':_0x17c13a['id'],'type':_0xb9fe('0x51'),'sectionId':_0x854f87['id']},{})[_0xb9fe('0x25')](function(){return _0x451e2a;});}else{return _0x451e2a;}})[_0xb9fe('0x44')](function(_0x15cd91){logger[_0xb9fe('0x52')](_0xb9fe('0x53'),_0x15cd91);throw _0x15cd91;});}return _0x451e2a;})[_0xb9fe('0x25')](respondWithResult(_0x3f6f3c,0xc9))[_0xb9fe('0x44')](handleError(_0x3f6f3c,null));};exports[_0xb9fe('0x23')]=function(_0x288f8e,_0x15f4f3){if(_0x288f8e[_0xb9fe('0x49')]['id']){delete _0x288f8e[_0xb9fe('0x49')]['id'];}return db['AnalyticCustomReport'][_0xb9fe('0x47')]({'where':{'id':_0x288f8e[_0xb9fe('0x54')]['id']}})[_0xb9fe('0x25')](handleEntityNotFound(_0x15f4f3,null))['then'](saveUpdates(_0x288f8e[_0xb9fe('0x49')],null))[_0xb9fe('0x25')](respondWithResult(_0x15f4f3,null))[_0xb9fe('0x44')](handleError(_0x15f4f3,null));};exports[_0xb9fe('0x24')]=function(_0x4bdac3,_0x4c847c){return db[_0xb9fe('0x29')]['find']({'where':{'id':_0x4bdac3[_0xb9fe('0x54')]['id']}})[_0xb9fe('0x25')](handleEntityNotFound(_0x4c847c,null))[_0xb9fe('0x25')](removeEntity(_0x4c847c,null))[_0xb9fe('0x44')](handleError(_0x4c847c,null));};exports[_0xb9fe('0x55')]=function(_0x1e0e25,_0x110804){var _0x524246=0xa;var _0x248154=[_0xb9fe('0x56'),'left_join',_0xb9fe('0x57'),_0xb9fe('0x58')];var _0xb68519={'SUM':'SUM(%s)','COUNT':_0xb9fe('0x59'),'COUNT DISTINCT':_0xb9fe('0x5a'),'MAX':'MAX(%s)','MIN':_0xb9fe('0x5b'),'AVG':_0xb9fe('0x5c'),'GROUP_CONCAT':_0xb9fe('0x5d'),'GROUP_CONCAT ASC':_0xb9fe('0x5e'),'GROUP_CONCAT DESC':_0xb9fe('0x5f')};var _0x38a3a7={'SEC_TO_TIME':_0xb9fe('0x60'),'DATE':_0xb9fe('0x61'),'HOUR':_0xb9fe('0x62'),'ROUND':_0xb9fe('0x63'),'UNIX_TIMESTAMP':_0xb9fe('0x64')};var _0x635d4a=function(_0x1d1457){return!_['includes']([_0xb9fe('0x65'),_0xb9fe('0x66'),_0xb9fe('0x67'),_0xb9fe('0x68')],_0x1d1457);};var _0x32b1d2=function(_0x4c9d34){if(!_0x4c9d34||!_0x4c9d34['rules'][_0xb9fe('0x46')]){return'';}for(var _0x3b6294='(',_0x1db89c=0x0;_0x1db89c<_0x4c9d34['rules'][_0xb9fe('0x46')];_0x1db89c+=0x1){_0x1db89c>0x0&&(_0x3b6294+='\x20'+_0x4c9d34[_0xb9fe('0x69')]+'\x20');_0x3b6294+=_0x4c9d34[_0xb9fe('0x6a')][_0x1db89c][_0xb9fe('0x6b')]?_0x32b1d2(_0x4c9d34['rules'][_0x1db89c]['group']):_0x4c9d34[_0xb9fe('0x6a')][_0x1db89c][_0xb9fe('0x6c')]+'\x20'+_0x4c9d34[_0xb9fe('0x6a')][_0x1db89c][_0xb9fe('0x6d')]+(_0x635d4a(_0x4c9d34[_0xb9fe('0x6a')][_0x1db89c][_0xb9fe('0x6d')])?'\x20'+_0x4c9d34[_0xb9fe('0x6a')][_0x1db89c]['value']:'');}return _0x3b6294+')';};var _0x30366e={'where':{'id':_0x1e0e25['params']['id']}},_0x526343,_0x4d356d,_0x3adcae,_0x2684c6,_0x4970dd;_0x30366e=_[_0xb9fe('0x3e')]({},_0x30366e,_0x1e0e25[_0xb9fe('0x3f')]);return db[_0xb9fe('0x29')][_0xb9fe('0x47')](_0x30366e)[_0xb9fe('0x25')](function(_0x1f62f6){if(_0x1f62f6){_0x526343=_0x1f62f6;return _0x1f62f6[_0xb9fe('0x6e')]();}return null;})[_0xb9fe('0x25')](function(_0x592da4){if(_0x592da4){if(!_0x592da4[_0xb9fe('0x46')]){throw new db[(_0xb9fe('0x6f'))][(_0xb9fe('0x70'))](_0xb9fe('0x71'),0x193);}_0x4d356d=_0x592da4;return db['AnalyticMetric'][_0xb9fe('0x42')]({'raw':!![]});}return null;})[_0xb9fe('0x25')](function(_0x214eee){if(_0x214eee){_0x3adcae=_[_0xb9fe('0x72')](_0x214eee,'id');var _0x41ddba;var _0x13dbb8=squel['select']();_0x13dbb8[_0xb9fe('0x73')](_0x526343[_0xb9fe('0x74')]);for(var _0x3788d8=0x0;_0x3788d8<_0x4d356d[_0xb9fe('0x46')];_0x3788d8+=0x1){_0x41ddba=_0x4d356d[_0x3788d8]['MetricId']?_0x3adcae[_0x4d356d[_0x3788d8][_0xb9fe('0x75')]]['metric']:_0x4d356d[_0x3788d8][_0xb9fe('0x6c')];_0x41ddba=_0x4d356d[_0x3788d8][_0xb9fe('0x76')]?_[_0xb9fe('0x77')](_0xb68519[_0x4d356d[_0x3788d8][_0xb9fe('0x76')]],'%s',_0x41ddba):_0x41ddba;_0x41ddba=_0x4d356d[_0x3788d8][_0xb9fe('0x78')]?_[_0xb9fe('0x77')](_0x38a3a7[_0x4d356d[_0x3788d8][_0xb9fe('0x78')]],'%s',_0x41ddba):_0x41ddba;if(_0x4d356d[_0x3788d8]['groupBy']){_0x13dbb8[_0xb9fe('0x6b')](_0x41ddba);}_0x4d356d[_0x3788d8][_0xb9fe('0x79')]&&_0x13dbb8[_0xb9fe('0x37')](_0x41ddba,_0x4d356d[_0x3788d8][_0xb9fe('0x79')]===_0xb9fe('0x7a')?![]:!![]);_0x13dbb8['field'](_0x41ddba,_0x4d356d[_0x3788d8]['alias']||_0x41ddba);}if(_0x526343[_0xb9fe('0x7b')]){_0x526343[_0xb9fe('0x7b')]=JSON['parse'](_0x526343['joins']);for(var _0x28b324=0x0;_0x28b324<_0x526343[_0xb9fe('0x7b')][_0xb9fe('0x46')];_0x28b324+=0x1){if(_0x526343[_0xb9fe('0x7b')][_0x28b324]['type']&&_['includes'](_0x248154,_0x526343[_0xb9fe('0x7b')][_0x28b324][_0xb9fe('0x2c')])&&_0x526343[_0xb9fe('0x7b')][_0x28b324][_0xb9fe('0x7c')]&&_0x526343[_0xb9fe('0x7b')][_0x28b324][_0xb9fe('0x7d')]&&_0x526343[_0xb9fe('0x7b')][_0x28b324][_0xb9fe('0x7e')]){_0x13dbb8[_0x526343[_0xb9fe('0x7b')][_0x28b324][_0xb9fe('0x2c')]](_0x526343['joins'][_0x28b324][_0xb9fe('0x7d')],null,util[_0xb9fe('0x78')]('%s.%s\x20=\x20%s.%s',_0x526343['table'],_0x526343[_0xb9fe('0x7b')][_0x28b324]['parentKey'],_0x526343[_0xb9fe('0x7b')][_0x28b324]['foreignTable'],_0x526343[_0xb9fe('0x7b')][_0x28b324]['foreignKey']));}}}if(_0x526343[_0xb9fe('0x7f')]){_0x526343['conditions']=JSON[_0xb9fe('0x80')](_0x526343[_0xb9fe('0x7f')]);_0x13dbb8[_0xb9fe('0x39')](_0x32b1d2(_0x526343[_0xb9fe('0x7f')][_0xb9fe('0x6b')]));}_0x4970dd=_0x13dbb8[_0xb9fe('0x81')]();_0x13dbb8[_0xb9fe('0x1f')](_0x524246);_0x13dbb8[_0xb9fe('0x1c')](0x0);logger[_0xb9fe('0x82')](_0xb9fe('0x83'),_0x13dbb8['toString']());return dbH[_0xb9fe('0x84')][_0xb9fe('0x34')](_0x13dbb8[_0xb9fe('0x85')](),{'type':dbH['sequelize'][_0xb9fe('0x86')][_0xb9fe('0x87')]});}})[_0xb9fe('0x25')](respondWithResult(_0x110804,null))['catch'](handleError(_0x110804,null));};function runReport(_0x2ab114,_0x2b7158,_0x1a0e6d){var _0x178747=_0x2b7158[_0xb9fe('0x28')];var _0x10588d=0xa;var _0x23206f=[_0xb9fe('0x56'),_0xb9fe('0x88'),'right_join','cross_join'];var _0x389a32={'SUM':_0xb9fe('0x89'),'COUNT':_0xb9fe('0x59'),'COUNT DISTINCT':_0xb9fe('0x5a'),'MAX':_0xb9fe('0x8a'),'MIN':_0xb9fe('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb9fe('0x5e'),'GROUP_CONCAT DESC':_0xb9fe('0x5f')};var _0xf21778={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb9fe('0x64')};var _0x28e714=function(_0xd7a4dd){return!_[_0xb9fe('0x8b')]([_0xb9fe('0x65'),'IS\x20NOT\x20NULL',_0xb9fe('0x67'),_0xb9fe('0x68')],_0xd7a4dd);};var _0x1128e0=function(_0x27d5c1){if(!_0x27d5c1||!_0x27d5c1['rules']['length']){return'';}for(var _0x3d3011='(',_0x48230c=0x0;_0x48230c<_0x27d5c1[_0xb9fe('0x6a')][_0xb9fe('0x46')];_0x48230c+=0x1){_0x48230c>0x0&&(_0x3d3011+='\x20'+_0x27d5c1[_0xb9fe('0x69')]+'\x20');_0x3d3011+=_0x27d5c1['rules'][_0x48230c][_0xb9fe('0x6b')]?_0x1128e0(_0x27d5c1[_0xb9fe('0x6a')][_0x48230c][_0xb9fe('0x6b')]):_0x27d5c1['rules'][_0x48230c][_0xb9fe('0x6c')]+'\x20'+_0x27d5c1[_0xb9fe('0x6a')][_0x48230c][_0xb9fe('0x6d')]+(_0x28e714(_0x27d5c1[_0xb9fe('0x6a')][_0x48230c][_0xb9fe('0x6d')])?'\x20'+_0x27d5c1[_0xb9fe('0x6a')][_0x48230c]['value']:'');}return _0x3d3011+')';};var _0x289e43={'where':{'id':_0x2ab114['id']}},_0x5e9974,_0xf94bd9,_0x2d16f4,_0x25efa7,_0x37e70e;_0x289e43=_['merge']({},_0x289e43,_0x1a0e6d);return db[_0xb9fe('0x29')]['find'](_0x289e43)[_0xb9fe('0x25')](function(_0x2a25e3){if(_0x2a25e3){_0x5e9974=_0x2a25e3;return _0x2a25e3[_0xb9fe('0x6e')]();}return null;})[_0xb9fe('0x25')](function(_0x34302c){if(_0x34302c){if(!_0x34302c[_0xb9fe('0x46')]){throw new db['Sequelize'][(_0xb9fe('0x70'))](_0xb9fe('0x71'),0x193);}_0xf94bd9=_0x34302c;return db[_0xb9fe('0x8c')][_0xb9fe('0x42')]({'raw':!![]});}return null;})['then'](function(_0x4c40dd){if(_0x4c40dd){_0x2d16f4=_[_0xb9fe('0x72')](_0x4c40dd,'id');var _0xa431d6;var _0x4588ef=squel[_0xb9fe('0x8d')]();_0x4588ef[_0xb9fe('0x73')](_0x5e9974['table']);for(var _0xf8fb62=0x0;_0xf8fb62<_0xf94bd9[_0xb9fe('0x46')];_0xf8fb62+=0x1){_0xa431d6=_0xf94bd9[_0xf8fb62][_0xb9fe('0x75')]?_0x2d16f4[_0xf94bd9[_0xf8fb62]['MetricId']][_0xb9fe('0x8e')]:_0xf94bd9[_0xf8fb62][_0xb9fe('0x6c')];_0xa431d6=_0xf94bd9[_0xf8fb62][_0xb9fe('0x76')]?_[_0xb9fe('0x77')](_0x389a32[_0xf94bd9[_0xf8fb62][_0xb9fe('0x76')]],'%s',_0xa431d6):_0xa431d6;_0xa431d6=_0xf94bd9[_0xf8fb62][_0xb9fe('0x78')]?_[_0xb9fe('0x77')](_0xf21778[_0xf94bd9[_0xf8fb62][_0xb9fe('0x78')]],'%s',_0xa431d6):_0xa431d6;if(_0xf94bd9[_0xf8fb62]['groupBy']){_0x4588ef[_0xb9fe('0x6b')](_0xa431d6);}_0xf94bd9[_0xf8fb62][_0xb9fe('0x79')]&&_0x4588ef[_0xb9fe('0x37')](_0xa431d6,_0xf94bd9[_0xf8fb62]['orderBy']===_0xb9fe('0x7a')?![]:!![]);_0x4588ef[_0xb9fe('0x6c')](_0xa431d6,_0xf94bd9[_0xf8fb62]['alias']||_0xa431d6);}if(_0x5e9974['joins']){_0x5e9974[_0xb9fe('0x7b')]=JSON['parse'](_0x5e9974[_0xb9fe('0x7b')]);for(var _0x1cffb7=0x0;_0x1cffb7<_0x5e9974[_0xb9fe('0x7b')][_0xb9fe('0x46')];_0x1cffb7+=0x1){if(_0x5e9974[_0xb9fe('0x7b')][_0x1cffb7][_0xb9fe('0x2c')]&&_[_0xb9fe('0x8b')](_0x23206f,_0x5e9974[_0xb9fe('0x7b')][_0x1cffb7][_0xb9fe('0x2c')])&&_0x5e9974['joins'][_0x1cffb7][_0xb9fe('0x7c')]&&_0x5e9974[_0xb9fe('0x7b')][_0x1cffb7][_0xb9fe('0x7d')]&&_0x5e9974[_0xb9fe('0x7b')][_0x1cffb7][_0xb9fe('0x7e')]){_0x4588ef[_0x5e9974[_0xb9fe('0x7b')][_0x1cffb7]['type']](_0x5e9974[_0xb9fe('0x7b')][_0x1cffb7][_0xb9fe('0x7d')],null,util['format'](_0xb9fe('0x8f'),_0x5e9974[_0xb9fe('0x74')],_0x5e9974[_0xb9fe('0x7b')][_0x1cffb7][_0xb9fe('0x7c')],_0x5e9974[_0xb9fe('0x7b')][_0x1cffb7][_0xb9fe('0x7d')],_0x5e9974[_0xb9fe('0x7b')][_0x1cffb7][_0xb9fe('0x7e')]));}}}if(_0x5e9974[_0xb9fe('0x7f')]){_0x5e9974[_0xb9fe('0x7f')]=JSON['parse'](_0x5e9974['conditions']);_0x4588ef[_0xb9fe('0x39')](_0x1128e0(_0x5e9974[_0xb9fe('0x7f')][_0xb9fe('0x6b')]));}_0x37e70e=_0x4588ef[_0xb9fe('0x81')]();_0x4588ef[_0xb9fe('0x1f')](_0x10588d);_0x4588ef[_0xb9fe('0x1c')](0x0);return;}})[_0xb9fe('0x25')](function(){if(_0x2b7158[_0xb9fe('0x90')]==='web'){return null;}var _0x421ad2=_[_0xb9fe('0x3e')](_0x2b7158,{'name':_0x2b7158[_0xb9fe('0x91')]||_0x2b7158['name']||_0x5e9974[_0xb9fe('0x28')],'basename':_0x178747,'savename':util[_0xb9fe('0x78')](_0xb9fe('0x92'),_0x2b7158[_0xb9fe('0x28')]||_0x5e9974[_0xb9fe('0x28')],require(_0xb9fe('0x93'))[_0xb9fe('0x94')](0x4),_0x2b7158[_0xb9fe('0x90')]||_0xb9fe('0x95')),'reportId':_0x5e9974['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0xb9fe('0x48')](_0x421ad2,{'raw':!![]});})['then'](function(_0x36e603){if(_0x5e9974[_0xb9fe('0x74')]===_0xb9fe('0x96')){_0x37e70e[_0xb9fe('0x39')](_0x5e9974[_0xb9fe('0x74')]+_0xb9fe('0x97'),_0x2b7158['startDate'],_0x2b7158[_0xb9fe('0x98')]);}else{_0x37e70e[_0xb9fe('0x39')](_0x5e9974['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b7158[_0xb9fe('0x99')],_0x2b7158[_0xb9fe('0x98')]);}if(_0x36e603){logger['info'](_0xb9fe('0x9a'),_0x37e70e[_0xb9fe('0x85')]());require(_0xb9fe('0x9b'))[_0xb9fe('0x9c')](path[_0xb9fe('0x56')](__dirname,_0xb9fe('0x9d'),_0x36e603['output']),[_0x36e603['id'],_0x37e70e[_0xb9fe('0x85')](),path['join'](__dirname,'../../files/reports',_0x36e603[_0xb9fe('0x9e')]),_0x178747]);return _0x36e603;}else{var _0x186d17=squel[_0xb9fe('0x8d')]();_0x186d17[_0xb9fe('0x73')]('('+_0x37e70e[_0xb9fe('0x85')]()+')','countTable');_0x186d17[_0xb9fe('0x6c')](_0xb9fe('0x9f'),_0xb9fe('0x1e'));_0x37e70e[_0xb9fe('0x1f')](_0x2b7158[_0xb9fe('0x1f')]||_0x10588d);_0x37e70e[_0xb9fe('0x1c')](_0x2b7158[_0xb9fe('0x1c')]||0x0);return dbH[_0xb9fe('0x84')][_0xb9fe('0x34')](_0x186d17[_0xb9fe('0x85')](),{'type':dbH[_0xb9fe('0x84')][_0xb9fe('0x86')][_0xb9fe('0x87')]})['then'](function(_0x3fcab5){if(!_0x3fcab5[_0xb9fe('0x46')]){_0x25efa7=0x0;}else{_0x25efa7=_0x3fcab5[0x0][_0xb9fe('0x1e')]||0x0;}return dbH[_0xb9fe('0x84')][_0xb9fe('0x34')](_0x37e70e[_0xb9fe('0x85')](),{'type':dbH['sequelize'][_0xb9fe('0x86')][_0xb9fe('0x87')]});})['then'](function(_0x2cc240){return{'rows':_0x2cc240||[],'count':_0x25efa7};});}});}exports['run']=function(_0x2fe34d,_0x4d0c1d){return runReport(_0x2fe34d[_0xb9fe('0x54')],_0x2fe34d['query'],_0x2fe34d[_0xb9fe('0x3f')])[_0xb9fe('0x25')](respondWithResult(_0x4d0c1d,null))[_0xb9fe('0x44')](handleError(_0x4d0c1d,null));};exports['runReport']=runReport;exports['query']=function(_0x30bf41,_0x359d49){var _0x642ec4=0xa;var _0x1324c7=[_0xb9fe('0x56'),_0xb9fe('0x88'),_0xb9fe('0x57'),'cross_join'];var _0x2d0a78={'SUM':'SUM(%s)','COUNT':_0xb9fe('0x59'),'COUNT DISTINCT':_0xb9fe('0x5a'),'MAX':_0xb9fe('0x8a'),'MIN':_0xb9fe('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb9fe('0x5d'),'GROUP_CONCAT ASC':_0xb9fe('0x5e'),'GROUP_CONCAT DESC':_0xb9fe('0x5f')};var _0x587ae7={'SEC_TO_TIME':_0xb9fe('0x60'),'DATE':_0xb9fe('0x61'),'HOUR':_0xb9fe('0x62'),'ROUND':_0xb9fe('0x63'),'UNIX_TIMESTAMP':_0xb9fe('0x64')};var _0x52819e=function(_0x3bb5a5){return!_[_0xb9fe('0x8b')]([_0xb9fe('0x65'),_0xb9fe('0x66'),'IS\x20EMPTY',_0xb9fe('0x68')],_0x3bb5a5);};var _0x86aafa=function(_0x1aa7e8){if(!_0x1aa7e8||!_0x1aa7e8[_0xb9fe('0x6a')][_0xb9fe('0x46')]){return'';}for(var _0x46df6b='(',_0x1c4829=0x0;_0x1c4829<_0x1aa7e8[_0xb9fe('0x6a')][_0xb9fe('0x46')];_0x1c4829+=0x1){_0x1c4829>0x0&&(_0x46df6b+='\x20'+_0x1aa7e8[_0xb9fe('0x69')]+'\x20');_0x46df6b+=_0x1aa7e8[_0xb9fe('0x6a')][_0x1c4829]['group']?_0x86aafa(_0x1aa7e8[_0xb9fe('0x6a')][_0x1c4829]['group']):_0x1aa7e8[_0xb9fe('0x6a')][_0x1c4829][_0xb9fe('0x6c')]+'\x20'+_0x1aa7e8['rules'][_0x1c4829][_0xb9fe('0x6d')]+(_0x52819e(_0x1aa7e8[_0xb9fe('0x6a')][_0x1c4829][_0xb9fe('0x6d')])?'\x20'+_0x1aa7e8[_0xb9fe('0x6a')][_0x1c4829][_0xb9fe('0xa0')]:'');}return _0x46df6b+')';};var _0x2dbeed={'where':{'id':_0x30bf41[_0xb9fe('0x54')]['id']}},_0x53b8f0,_0x32203d,_0x4a86d7,_0x5d5b0e,_0x22efc8;_0x2dbeed=_[_0xb9fe('0x3e')]({},_0x2dbeed,_0x30bf41[_0xb9fe('0x3f')]);return db[_0xb9fe('0x29')][_0xb9fe('0x47')](_0x2dbeed)['then'](function(_0x51947b){if(_0x51947b){_0x53b8f0=_0x51947b;return _0x51947b[_0xb9fe('0x6e')]();}return null;})[_0xb9fe('0x25')](function(_0x517238){if(_0x517238){if(!_0x517238[_0xb9fe('0x46')]){throw new db[(_0xb9fe('0x6f'))]['ValidationErrorItem'](_0xb9fe('0x71'),0x193);}_0x32203d=_0x517238;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xb9fe('0x25')](function(_0x23a547){if(_0x23a547){_0x4a86d7=_[_0xb9fe('0x72')](_0x23a547,'id');var _0x8538de;var _0xd33570=squel[_0xb9fe('0x8d')]();_0xd33570[_0xb9fe('0x73')](_0x53b8f0[_0xb9fe('0x74')]);for(var _0x45144c=0x0;_0x45144c<_0x32203d[_0xb9fe('0x46')];_0x45144c+=0x1){_0x8538de=_0x32203d[_0x45144c][_0xb9fe('0x75')]?_0x4a86d7[_0x32203d[_0x45144c]['MetricId']][_0xb9fe('0x8e')]:_0x32203d[_0x45144c][_0xb9fe('0x6c')];_0x8538de=_0x32203d[_0x45144c][_0xb9fe('0x76')]?_[_0xb9fe('0x77')](_0x2d0a78[_0x32203d[_0x45144c][_0xb9fe('0x76')]],'%s',_0x8538de):_0x8538de;_0x8538de=_0x32203d[_0x45144c][_0xb9fe('0x78')]?_[_0xb9fe('0x77')](_0x587ae7[_0x32203d[_0x45144c]['format']],'%s',_0x8538de):_0x8538de;if(_0x32203d[_0x45144c][_0xb9fe('0xa1')]){_0xd33570[_0xb9fe('0x6b')](_0x8538de);}_0x32203d[_0x45144c][_0xb9fe('0x79')]&&_0xd33570[_0xb9fe('0x37')](_0x8538de,_0x32203d[_0x45144c]['orderBy']==='DESC'?![]:!![]);_0xd33570['field'](_0x8538de,_0x32203d[_0x45144c][_0xb9fe('0xa2')]||_0x8538de);}if(_0x53b8f0[_0xb9fe('0x7b')]){_0x53b8f0[_0xb9fe('0x7b')]=JSON['parse'](_0x53b8f0[_0xb9fe('0x7b')]);for(var _0x5c30e0=0x0;_0x5c30e0<_0x53b8f0[_0xb9fe('0x7b')]['length'];_0x5c30e0+=0x1){if(_0x53b8f0['joins'][_0x5c30e0][_0xb9fe('0x2c')]&&_[_0xb9fe('0x8b')](_0x1324c7,_0x53b8f0[_0xb9fe('0x7b')][_0x5c30e0]['type'])&&_0x53b8f0['joins'][_0x5c30e0][_0xb9fe('0x7c')]&&_0x53b8f0['joins'][_0x5c30e0][_0xb9fe('0x7d')]&&_0x53b8f0[_0xb9fe('0x7b')][_0x5c30e0][_0xb9fe('0x7e')]){_0xd33570[_0x53b8f0[_0xb9fe('0x7b')][_0x5c30e0][_0xb9fe('0x2c')]](_0x53b8f0['joins'][_0x5c30e0][_0xb9fe('0x7d')],null,util[_0xb9fe('0x78')](_0xb9fe('0x8f'),_0x53b8f0['table'],_0x53b8f0[_0xb9fe('0x7b')][_0x5c30e0]['parentKey'],_0x53b8f0[_0xb9fe('0x7b')][_0x5c30e0]['foreignTable'],_0x53b8f0[_0xb9fe('0x7b')][_0x5c30e0]['foreignKey']));}}}if(_0x53b8f0[_0xb9fe('0x7f')]){_0x53b8f0[_0xb9fe('0x7f')]=JSON[_0xb9fe('0x80')](_0x53b8f0['conditions']);_0xd33570[_0xb9fe('0x39')](_0x86aafa(_0x53b8f0[_0xb9fe('0x7f')][_0xb9fe('0x6b')]));}_0x22efc8=_0xd33570[_0xb9fe('0x81')]();_0xd33570[_0xb9fe('0x1f')](_0x642ec4);_0xd33570[_0xb9fe('0x1c')](0x0);logger[_0xb9fe('0x82')](_0xb9fe('0x83'),_0xd33570[_0xb9fe('0x85')]());return dbH[_0xb9fe('0x84')]['query'](_0xd33570['toString'](),{'type':dbH[_0xb9fe('0x84')]['QueryTypes'][_0xb9fe('0x87')]});}})[_0xb9fe('0x25')](function(){return{'sql':_0x22efc8['toString']()};})[_0xb9fe('0x25')](respondWithResult(_0x359d49,null))[_0xb9fe('0x44')](handleError(_0x359d49,null));}; \ No newline at end of file +var _0x3b59=['foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MIN(%s)','AVG(%s)','HOUR(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','AnalyticMetric','keyBy','metric','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','fork','../../files/reports','savename','countTable','COUNT(*)','run','runReport','debug','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','CustomReports','UserProfileResource','error','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','select','from','table','MetricId','function','format','replace','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x3b59,0xd6));var _0x93b5=function(_0xdb951d,_0x1dc42b){_0xdb951d=_0xdb951d-0x0;var _0x5e789e=_0x3b59[_0xdb951d];return _0x5e789e;};'use strict';var emlformat=require(_0x93b5('0x0'));var rimraf=require(_0x93b5('0x1'));var zipdir=require(_0x93b5('0x2'));var jsonpatch=require(_0x93b5('0x3'));var rp=require(_0x93b5('0x4'));var moment=require(_0x93b5('0x5'));var BPromise=require(_0x93b5('0x6'));var Mustache=require('mustache');var util=require(_0x93b5('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x93b5('0x8'));var ejs=require(_0x93b5('0x9'));var fs=require('fs');var fs_extra=require(_0x93b5('0xa'));var _=require(_0x93b5('0xb'));var squel=require(_0x93b5('0xc'));var crypto=require('crypto');var jsforce=require(_0x93b5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x93b5('0x8'));var querystring=require(_0x93b5('0xe'));var Papa=require(_0x93b5('0xf'));var Redis=require(_0x93b5('0x10'));var authService=require(_0x93b5('0x11'));var qs=require(_0x93b5('0x12'));var as=require(_0x93b5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x93b5('0x14'));var utils=require(_0x93b5('0x15'));var config=require(_0x93b5('0x16'));var licenseUtil=require(_0x93b5('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0x93b5('0x18'))[_0x93b5('0x19')];function respondWithStatusCode(_0x2a7e48,_0x129ec2){_0x129ec2=_0x129ec2||0xcc;return function(_0xe04d09){if(_0xe04d09){return _0x2a7e48[_0x93b5('0x1a')](_0x129ec2);}return _0x2a7e48[_0x93b5('0x1b')](_0x129ec2)[_0x93b5('0x1c')]();};}function respondWithResult(_0x146f1f,_0x1122f8){_0x1122f8=_0x1122f8||0xc8;return function(_0x8893f1){if(_0x8893f1){return _0x146f1f[_0x93b5('0x1b')](_0x1122f8)['json'](_0x8893f1);}};}function respondWithFilteredResult(_0x384e94,_0x39cc42){return function(_0x105cb3){if(_0x105cb3){var _0x432703=typeof _0x39cc42[_0x93b5('0x1d')]===_0x93b5('0x1e')&&typeof _0x39cc42[_0x93b5('0x1f')]==='undefined';var _0x312e2c=_0x105cb3[_0x93b5('0x20')];var _0x1baefb=_0x432703?0x0:_0x39cc42[_0x93b5('0x1d')];var _0x3180fd=_0x432703?_0x105cb3[_0x93b5('0x20')]:_0x39cc42[_0x93b5('0x1d')]+_0x39cc42[_0x93b5('0x1f')];var _0x527356;if(_0x3180fd>=_0x312e2c){_0x3180fd=_0x312e2c;_0x527356=0xc8;}else{_0x527356=0xce;}_0x384e94[_0x93b5('0x1b')](_0x527356);return _0x384e94[_0x93b5('0x21')](_0x93b5('0x22'),_0x1baefb+'-'+_0x3180fd+'/'+_0x312e2c)[_0x93b5('0x23')](_0x105cb3);}return null;};}function patchUpdates(_0xb44586){return function(_0x699465){try{jsonpatch[_0x93b5('0x24')](_0x699465,_0xb44586,!![]);}catch(_0x297eb2){return BPromise[_0x93b5('0x25')](_0x297eb2);}return _0x699465[_0x93b5('0x26')]();};}function saveUpdates(_0x52cf63,_0x83bbb3){return function(_0x25f25a){if(_0x25f25a){return _0x25f25a[_0x93b5('0x27')](_0x52cf63)[_0x93b5('0x28')](function(_0x454314){return _0x454314;});}return null;};}function removeEntity(_0x4487d,_0x1905a3){return function(_0x2d4f57){if(_0x2d4f57){return _0x2d4f57[_0x93b5('0x29')]()[_0x93b5('0x28')](function(){var _0x52dc13=_0x2d4f57['get']({'plain':!![]});var _0x2d12bc=_0x93b5('0x2a');return db[_0x93b5('0x2b')]['destroy']({'where':{'type':_0x2d12bc,'resourceId':_0x52dc13['id']}})[_0x93b5('0x28')](function(){return _0x2d4f57;});})[_0x93b5('0x28')](function(){_0x4487d['status'](0xcc)[_0x93b5('0x1c')]();});}};}function handleEntityNotFound(_0x2a3cdd,_0x4c8c5d){return function(_0x2a5407){if(!_0x2a5407){_0x2a3cdd[_0x93b5('0x1a')](0x194);}return _0x2a5407;};}function handleError(_0x4b4201,_0x5834b1){_0x5834b1=_0x5834b1||0x1f4;return function(_0x3ad6d3){logger[_0x93b5('0x2c')](_0x3ad6d3[_0x93b5('0x2d')]);if(_0x3ad6d3[_0x93b5('0x2e')]){delete _0x3ad6d3[_0x93b5('0x2e')];}_0x4b4201['status'](_0x5834b1)['send'](_0x3ad6d3);};}exports[_0x93b5('0x2f')]=function(_0x4fd120,_0x1c0778){var _0x85e5aa={},_0x327ace={},_0x4bf74e={'count':0x0,'rows':[]};var _0x402c4e=_[_0x93b5('0x30')](db[_0x93b5('0x31')][_0x93b5('0x32')],function(_0x45f9f5){return{'name':_0x45f9f5[_0x93b5('0x33')],'type':_0x45f9f5[_0x93b5('0x34')][_0x93b5('0x35')]};});_0x327ace['model']=_[_0x93b5('0x30')](_0x402c4e,_0x93b5('0x2e'));_0x327ace[_0x93b5('0x36')]=_[_0x93b5('0x37')](_0x4fd120[_0x93b5('0x36')]);_0x327ace[_0x93b5('0x38')]=_[_0x93b5('0x39')](_0x327ace[_0x93b5('0x3a')],_0x327ace[_0x93b5('0x36')]);_0x85e5aa['attributes']=_['intersection'](_0x327ace[_0x93b5('0x3a')],qs[_0x93b5('0x3b')](_0x4fd120['query']['fields']));_0x85e5aa[_0x93b5('0x3c')]=_0x85e5aa['attributes'][_0x93b5('0x3d')]?_0x85e5aa[_0x93b5('0x3c')]:_0x327ace[_0x93b5('0x3a')];if(!_0x4fd120['query'][_0x93b5('0x3e')](_0x93b5('0x3f'))){_0x85e5aa['limit']=qs['limit'](_0x4fd120['query'][_0x93b5('0x1f')]);_0x85e5aa['offset']=qs[_0x93b5('0x1d')](_0x4fd120[_0x93b5('0x36')][_0x93b5('0x1d')]);}_0x85e5aa['order']=qs[_0x93b5('0x40')](_0x4fd120[_0x93b5('0x36')]['sort']);_0x85e5aa['where']=qs[_0x93b5('0x38')](_[_0x93b5('0x41')](_0x4fd120[_0x93b5('0x36')],_0x327ace[_0x93b5('0x38')]),_0x402c4e);if(_0x4fd120['query'][_0x93b5('0x42')]){_0x85e5aa[_0x93b5('0x43')]=_[_0x93b5('0x44')](_0x85e5aa['where'],{'$or':_['map'](_0x402c4e,function(_0x403d5b){if(_0x403d5b['type']!==_0x93b5('0x45')){var _0x1ac2ee={};_0x1ac2ee[_0x403d5b[_0x93b5('0x2e')]]={'$like':'%'+_0x4fd120[_0x93b5('0x36')][_0x93b5('0x42')]+'%'};return _0x1ac2ee;}})});}_0x85e5aa=_[_0x93b5('0x44')]({},_0x85e5aa,_0x4fd120[_0x93b5('0x46')]);var _0xcb1fac={'where':_0x85e5aa[_0x93b5('0x43')]};return db[_0x93b5('0x31')][_0x93b5('0x20')](_0xcb1fac)[_0x93b5('0x28')](function(_0x4ebfa6){_0x4bf74e[_0x93b5('0x20')]=_0x4ebfa6;if(_0x4fd120[_0x93b5('0x36')][_0x93b5('0x47')]){_0x85e5aa[_0x93b5('0x48')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x93b5('0x49')](_0x85e5aa);})['then'](function(_0x3b4b3e){_0x4bf74e[_0x93b5('0x4a')]=_0x3b4b3e;return _0x4bf74e;})[_0x93b5('0x28')](respondWithFilteredResult(_0x1c0778,_0x85e5aa))['catch'](handleError(_0x1c0778,null));};exports[_0x93b5('0x4b')]=function(_0x1a3dbc,_0x4b1a21){var _0x332b16={'raw':![],'where':{'id':_0x1a3dbc[_0x93b5('0x4c')]['id']}},_0x4042e6={};_0x4042e6[_0x93b5('0x3a')]=_[_0x93b5('0x37')](db[_0x93b5('0x31')][_0x93b5('0x32')]);_0x4042e6[_0x93b5('0x36')]=_['keys'](_0x1a3dbc['query']);_0x4042e6[_0x93b5('0x38')]=_[_0x93b5('0x39')](_0x4042e6[_0x93b5('0x3a')],_0x4042e6[_0x93b5('0x36')]);_0x332b16['attributes']=_['intersection'](_0x4042e6[_0x93b5('0x3a')],qs[_0x93b5('0x3b')](_0x1a3dbc[_0x93b5('0x36')][_0x93b5('0x3b')]));_0x332b16[_0x93b5('0x3c')]=_0x332b16['attributes'][_0x93b5('0x3d')]?_0x332b16[_0x93b5('0x3c')]:_0x4042e6[_0x93b5('0x3a')];if(_0x1a3dbc[_0x93b5('0x36')][_0x93b5('0x47')]){_0x332b16['include']=[{'all':!![]}];}_0x332b16=_[_0x93b5('0x44')]({},_0x332b16,_0x1a3dbc['options']);return db[_0x93b5('0x31')][_0x93b5('0x4d')](_0x332b16)[_0x93b5('0x28')](handleEntityNotFound(_0x4b1a21,null))[_0x93b5('0x28')](respondWithResult(_0x4b1a21,null))[_0x93b5('0x4e')](handleError(_0x4b1a21,null));};exports[_0x93b5('0x4f')]=function(_0xf6c6ae,_0x320f5f){return db['AnalyticCustomReport'][_0x93b5('0x4f')](_0xf6c6ae[_0x93b5('0x50')],{})['then'](function(_0x29e53c){var _0x424fb6=_0xf6c6ae[_0x93b5('0x51')][_0x93b5('0x52')]({'plain':!![]});if(!_0x424fb6)throw new Error(_0x93b5('0x53'));if(_0x424fb6[_0x93b5('0x54')]===_0x93b5('0x51')){var _0x516bca=_0x29e53c['get']({'plain':!![]});var _0x49441b=_0x93b5('0x55');return db[_0x93b5('0x56')][_0x93b5('0x4d')]({'where':{'name':_0x49441b,'userProfileId':_0x424fb6[_0x93b5('0x57')]},'raw':!![]})['then'](function(_0x5e9165){if(_0x5e9165&&_0x5e9165[_0x93b5('0x58')]===0x0){return db[_0x93b5('0x2b')][_0x93b5('0x4f')]({'name':_0x516bca[_0x93b5('0x2e')],'resourceId':_0x516bca['id'],'type':'CustomReports','sectionId':_0x5e9165['id']},{})[_0x93b5('0x28')](function(){return _0x29e53c;});}else{return _0x29e53c;}})[_0x93b5('0x4e')](function(_0x4e5545){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e5545);throw _0x4e5545;});}return _0x29e53c;})[_0x93b5('0x28')](respondWithResult(_0x320f5f,0xc9))['catch'](handleError(_0x320f5f,null));};exports[_0x93b5('0x27')]=function(_0xbc7280,_0x19723f){if(_0xbc7280[_0x93b5('0x50')]['id']){delete _0xbc7280[_0x93b5('0x50')]['id'];}return db[_0x93b5('0x31')]['find']({'where':{'id':_0xbc7280['params']['id']}})[_0x93b5('0x28')](handleEntityNotFound(_0x19723f,null))[_0x93b5('0x28')](saveUpdates(_0xbc7280[_0x93b5('0x50')],null))['then'](respondWithResult(_0x19723f,null))[_0x93b5('0x4e')](handleError(_0x19723f,null));};exports[_0x93b5('0x29')]=function(_0x39e95e,_0x59e8e5){return db['AnalyticCustomReport'][_0x93b5('0x4d')]({'where':{'id':_0x39e95e[_0x93b5('0x4c')]['id']}})[_0x93b5('0x28')](handleEntityNotFound(_0x59e8e5,null))['then'](removeEntity(_0x59e8e5,null))[_0x93b5('0x4e')](handleError(_0x59e8e5,null));};exports['preview']=function(_0x1bef0d,_0x54eee9){var _0x4c9bee=0xa;var _0x57a456=[_0x93b5('0x59'),_0x93b5('0x5a'),_0x93b5('0x5b'),_0x93b5('0x5c')];var _0x3e19db={'SUM':_0x93b5('0x5d'),'COUNT':_0x93b5('0x5e'),'COUNT DISTINCT':_0x93b5('0x5f'),'MAX':_0x93b5('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x93b5('0x61'),'GROUP_CONCAT ASC':_0x93b5('0x62'),'GROUP_CONCAT DESC':_0x93b5('0x63')};var _0x4860b9={'SEC_TO_TIME':_0x93b5('0x64'),'DATE':_0x93b5('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x93b5('0x66'),'UNIX_TIMESTAMP':_0x93b5('0x67')};var _0x221eff=function(_0x8cf841){return!_[_0x93b5('0x68')]([_0x93b5('0x69'),'IS\x20NOT\x20NULL',_0x93b5('0x6a'),'IS\x20NOT\x20EMPTY'],_0x8cf841);};var _0x52e18d=function(_0x1a98e2){if(!_0x1a98e2||!_0x1a98e2[_0x93b5('0x6b')][_0x93b5('0x3d')]){return'';}for(var _0x2144ce='(',_0x39c7dc=0x0;_0x39c7dc<_0x1a98e2[_0x93b5('0x6b')][_0x93b5('0x3d')];_0x39c7dc+=0x1){_0x39c7dc>0x0&&(_0x2144ce+='\x20'+_0x1a98e2[_0x93b5('0x6c')]+'\x20');_0x2144ce+=_0x1a98e2[_0x93b5('0x6b')][_0x39c7dc]['group']?_0x52e18d(_0x1a98e2[_0x93b5('0x6b')][_0x39c7dc][_0x93b5('0x6d')]):_0x1a98e2['rules'][_0x39c7dc][_0x93b5('0x6e')]+'\x20'+_0x1a98e2[_0x93b5('0x6b')][_0x39c7dc][_0x93b5('0x6f')]+(_0x221eff(_0x1a98e2[_0x93b5('0x6b')][_0x39c7dc]['condition'])?'\x20'+_0x1a98e2[_0x93b5('0x6b')][_0x39c7dc][_0x93b5('0x70')]:'');}return _0x2144ce+')';};var _0x2edb70={'where':{'id':_0x1bef0d[_0x93b5('0x4c')]['id']}},_0x317765,_0x134ec4,_0x5f17fb,_0x41bee6,_0x511a80;_0x2edb70=_[_0x93b5('0x44')]({},_0x2edb70,_0x1bef0d[_0x93b5('0x46')]);return db[_0x93b5('0x31')][_0x93b5('0x4d')](_0x2edb70)[_0x93b5('0x28')](function(_0x65f5c){if(_0x65f5c){_0x317765=_0x65f5c;return _0x65f5c[_0x93b5('0x71')]();}return null;})['then'](function(_0x31d32e){if(_0x31d32e){if(!_0x31d32e[_0x93b5('0x3d')]){throw new db[(_0x93b5('0x72'))][(_0x93b5('0x73'))](_0x93b5('0x74'),0x193);}_0x134ec4=_0x31d32e;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x93b5('0x28')](function(_0x1e2d6a){if(_0x1e2d6a){_0x5f17fb=_['keyBy'](_0x1e2d6a,'id');var _0x53e343;var _0x19859b=squel[_0x93b5('0x75')]();_0x19859b[_0x93b5('0x76')](_0x317765[_0x93b5('0x77')]);for(var _0x2dff8c=0x0;_0x2dff8c<_0x134ec4['length'];_0x2dff8c+=0x1){_0x53e343=_0x134ec4[_0x2dff8c][_0x93b5('0x78')]?_0x5f17fb[_0x134ec4[_0x2dff8c][_0x93b5('0x78')]]['metric']:_0x134ec4[_0x2dff8c][_0x93b5('0x6e')];_0x53e343=_0x134ec4[_0x2dff8c][_0x93b5('0x79')]?_['replace'](_0x3e19db[_0x134ec4[_0x2dff8c][_0x93b5('0x79')]],'%s',_0x53e343):_0x53e343;_0x53e343=_0x134ec4[_0x2dff8c][_0x93b5('0x7a')]?_[_0x93b5('0x7b')](_0x4860b9[_0x134ec4[_0x2dff8c][_0x93b5('0x7a')]],'%s',_0x53e343):_0x53e343;if(_0x134ec4[_0x2dff8c][_0x93b5('0x7c')]){_0x19859b[_0x93b5('0x6d')](_0x53e343);}_0x134ec4[_0x2dff8c][_0x93b5('0x7d')]&&_0x19859b[_0x93b5('0x7e')](_0x53e343,_0x134ec4[_0x2dff8c][_0x93b5('0x7d')]===_0x93b5('0x7f')?![]:!![]);_0x19859b[_0x93b5('0x6e')](_0x53e343,_0x134ec4[_0x2dff8c][_0x93b5('0x80')]||_0x53e343);}if(_0x317765['joins']){_0x317765[_0x93b5('0x81')]=JSON[_0x93b5('0x82')](_0x317765[_0x93b5('0x81')]);for(var _0x23b987=0x0;_0x23b987<_0x317765[_0x93b5('0x81')][_0x93b5('0x3d')];_0x23b987+=0x1){if(_0x317765[_0x93b5('0x81')][_0x23b987]['type']&&_[_0x93b5('0x68')](_0x57a456,_0x317765[_0x93b5('0x81')][_0x23b987]['type'])&&_0x317765[_0x93b5('0x81')][_0x23b987][_0x93b5('0x83')]&&_0x317765[_0x93b5('0x81')][_0x23b987][_0x93b5('0x84')]&&_0x317765[_0x93b5('0x81')][_0x23b987][_0x93b5('0x85')]){_0x19859b[_0x317765[_0x93b5('0x81')][_0x23b987][_0x93b5('0x34')]](_0x317765[_0x93b5('0x81')][_0x23b987][_0x93b5('0x84')],null,util[_0x93b5('0x7a')](_0x93b5('0x86'),_0x317765[_0x93b5('0x77')],_0x317765[_0x93b5('0x81')][_0x23b987][_0x93b5('0x83')],_0x317765[_0x93b5('0x81')][_0x23b987][_0x93b5('0x84')],_0x317765[_0x93b5('0x81')][_0x23b987][_0x93b5('0x85')]));}}}if(_0x317765['conditions']){_0x317765[_0x93b5('0x87')]=JSON['parse'](_0x317765[_0x93b5('0x87')]);_0x19859b[_0x93b5('0x43')](_0x52e18d(_0x317765['conditions']['group']));}_0x511a80=_0x19859b[_0x93b5('0x88')]();_0x19859b[_0x93b5('0x1f')](_0x4c9bee);_0x19859b[_0x93b5('0x1d')](0x0);logger['debug'](_0x93b5('0x89'),_0x19859b[_0x93b5('0x8a')]());return dbH[_0x93b5('0x8b')][_0x93b5('0x36')](_0x19859b[_0x93b5('0x8a')](),{'type':dbH[_0x93b5('0x8b')][_0x93b5('0x8c')][_0x93b5('0x8d')]});}})[_0x93b5('0x28')](respondWithResult(_0x54eee9,null))['catch'](handleError(_0x54eee9,null));};function runReport(_0x46dff8,_0x301836,_0x150414){var _0x3e88cd=_0x301836[_0x93b5('0x2e')];var _0x172991=0xa;var _0x4b2b68=[_0x93b5('0x59'),_0x93b5('0x5a'),'right_join',_0x93b5('0x5c')];var _0x2656c5={'SUM':_0x93b5('0x5d'),'COUNT':_0x93b5('0x5e'),'COUNT DISTINCT':_0x93b5('0x5f'),'MAX':'MAX(%s)','MIN':_0x93b5('0x8e'),'AVG':_0x93b5('0x8f'),'GROUP_CONCAT':_0x93b5('0x61'),'GROUP_CONCAT ASC':_0x93b5('0x62'),'GROUP_CONCAT DESC':_0x93b5('0x63')};var _0x2a9f92={'SEC_TO_TIME':_0x93b5('0x64'),'DATE':_0x93b5('0x65'),'HOUR':_0x93b5('0x90'),'ROUND':_0x93b5('0x66'),'UNIX_TIMESTAMP':_0x93b5('0x67')};var _0x13db8c=function(_0x55ff62){return!_['includes']([_0x93b5('0x69'),_0x93b5('0x91'),'IS\x20EMPTY',_0x93b5('0x92')],_0x55ff62);};var _0x501c84=function(_0x14e471){if(!_0x14e471||!_0x14e471[_0x93b5('0x6b')][_0x93b5('0x3d')]){return'';}for(var _0x493947='(',_0xe7ded0=0x0;_0xe7ded0<_0x14e471['rules'][_0x93b5('0x3d')];_0xe7ded0+=0x1){_0xe7ded0>0x0&&(_0x493947+='\x20'+_0x14e471[_0x93b5('0x6c')]+'\x20');_0x493947+=_0x14e471[_0x93b5('0x6b')][_0xe7ded0][_0x93b5('0x6d')]?_0x501c84(_0x14e471[_0x93b5('0x6b')][_0xe7ded0][_0x93b5('0x6d')]):_0x14e471[_0x93b5('0x6b')][_0xe7ded0][_0x93b5('0x6e')]+'\x20'+_0x14e471[_0x93b5('0x6b')][_0xe7ded0][_0x93b5('0x6f')]+(_0x13db8c(_0x14e471[_0x93b5('0x6b')][_0xe7ded0]['condition'])?'\x20'+_0x14e471[_0x93b5('0x6b')][_0xe7ded0]['value']:'');}return _0x493947+')';};var _0x2cc5d4={'where':{'id':_0x46dff8['id']}},_0x1c10c3,_0x52e1b2,_0x213046,_0x2a0c9d,_0x337e1a;_0x2cc5d4=_[_0x93b5('0x44')]({},_0x2cc5d4,_0x150414);return db[_0x93b5('0x31')]['find'](_0x2cc5d4)[_0x93b5('0x28')](function(_0x3ff5e3){if(_0x3ff5e3){_0x1c10c3=_0x3ff5e3;return _0x3ff5e3[_0x93b5('0x71')]();}return null;})[_0x93b5('0x28')](function(_0x5464b0){if(_0x5464b0){if(!_0x5464b0['length']){throw new db[(_0x93b5('0x72'))][(_0x93b5('0x73'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x52e1b2=_0x5464b0;return db[_0x93b5('0x93')][_0x93b5('0x49')]({'raw':!![]});}return null;})[_0x93b5('0x28')](function(_0x40ce9e){if(_0x40ce9e){_0x213046=_[_0x93b5('0x94')](_0x40ce9e,'id');var _0x108cf0;var _0x583e1a=squel['select']();_0x583e1a['from'](_0x1c10c3[_0x93b5('0x77')]);for(var _0x3b0add=0x0;_0x3b0add<_0x52e1b2[_0x93b5('0x3d')];_0x3b0add+=0x1){_0x108cf0=_0x52e1b2[_0x3b0add][_0x93b5('0x78')]?_0x213046[_0x52e1b2[_0x3b0add]['MetricId']][_0x93b5('0x95')]:_0x52e1b2[_0x3b0add][_0x93b5('0x6e')];_0x108cf0=_0x52e1b2[_0x3b0add]['function']?_[_0x93b5('0x7b')](_0x2656c5[_0x52e1b2[_0x3b0add][_0x93b5('0x79')]],'%s',_0x108cf0):_0x108cf0;_0x108cf0=_0x52e1b2[_0x3b0add][_0x93b5('0x7a')]?_[_0x93b5('0x7b')](_0x2a9f92[_0x52e1b2[_0x3b0add][_0x93b5('0x7a')]],'%s',_0x108cf0):_0x108cf0;if(_0x52e1b2[_0x3b0add][_0x93b5('0x7c')]){_0x583e1a['group'](_0x108cf0);}_0x52e1b2[_0x3b0add][_0x93b5('0x7d')]&&_0x583e1a[_0x93b5('0x7e')](_0x108cf0,_0x52e1b2[_0x3b0add][_0x93b5('0x7d')]===_0x93b5('0x7f')?![]:!![]);_0x583e1a[_0x93b5('0x6e')](_0x108cf0,_0x52e1b2[_0x3b0add]['alias']||_0x108cf0);}if(_0x1c10c3['joins']){_0x1c10c3[_0x93b5('0x81')]=JSON[_0x93b5('0x82')](_0x1c10c3[_0x93b5('0x81')]);for(var _0xa9b356=0x0;_0xa9b356<_0x1c10c3['joins'][_0x93b5('0x3d')];_0xa9b356+=0x1){if(_0x1c10c3[_0x93b5('0x81')][_0xa9b356][_0x93b5('0x34')]&&_[_0x93b5('0x68')](_0x4b2b68,_0x1c10c3[_0x93b5('0x81')][_0xa9b356][_0x93b5('0x34')])&&_0x1c10c3[_0x93b5('0x81')][_0xa9b356]['parentKey']&&_0x1c10c3[_0x93b5('0x81')][_0xa9b356][_0x93b5('0x84')]&&_0x1c10c3[_0x93b5('0x81')][_0xa9b356]['foreignKey']){_0x583e1a[_0x1c10c3[_0x93b5('0x81')][_0xa9b356]['type']](_0x1c10c3['joins'][_0xa9b356][_0x93b5('0x84')],null,util[_0x93b5('0x7a')](_0x93b5('0x86'),_0x1c10c3['table'],_0x1c10c3['joins'][_0xa9b356][_0x93b5('0x83')],_0x1c10c3[_0x93b5('0x81')][_0xa9b356][_0x93b5('0x84')],_0x1c10c3['joins'][_0xa9b356][_0x93b5('0x85')]));}}}if(_0x1c10c3['conditions']){_0x1c10c3['conditions']=JSON['parse'](_0x1c10c3['conditions']);_0x583e1a[_0x93b5('0x43')](_0x501c84(_0x1c10c3['conditions'][_0x93b5('0x6d')]));}_0x337e1a=_0x583e1a[_0x93b5('0x88')]();_0x583e1a[_0x93b5('0x1f')](_0x172991);_0x583e1a[_0x93b5('0x1d')](0x0);return;}})[_0x93b5('0x28')](function(){if(_0x301836[_0x93b5('0x96')]===_0x93b5('0x97')){return null;}var _0x38bdb2=_['merge'](_0x301836,{'name':_0x301836[_0x93b5('0x98')]||_0x301836['name']||_0x1c10c3[_0x93b5('0x2e')],'basename':_0x3e88cd,'savename':util[_0x93b5('0x7a')](_0x93b5('0x99'),_0x301836[_0x93b5('0x2e')]||_0x1c10c3[_0x93b5('0x2e')],require(_0x93b5('0x9a'))[_0x93b5('0x9b')](0x4),_0x301836[_0x93b5('0x96')]||_0x93b5('0x9c')),'reportId':_0x1c10c3['id'],'reportType':_0x93b5('0x9d')});return db['AnalyticExtractedReport'][_0x93b5('0x4f')](_0x38bdb2,{'raw':!![]});})[_0x93b5('0x28')](function(_0x7a2b31){if(_0x1c10c3[_0x93b5('0x77')]===_0x93b5('0x9e')){_0x337e1a['where'](_0x1c10c3[_0x93b5('0x77')]+_0x93b5('0x9f'),_0x301836['startDate'],_0x301836[_0x93b5('0xa0')]);}else{_0x337e1a[_0x93b5('0x43')](_0x1c10c3[_0x93b5('0x77')]+_0x93b5('0xa1'),_0x301836[_0x93b5('0xa2')],_0x301836['endDate']);}if(_0x7a2b31){logger[_0x93b5('0xa3')](_0x93b5('0xa4'),_0x337e1a[_0x93b5('0x8a')]());require('child_process')[_0x93b5('0xa5')](path['join'](__dirname,'../../components/export/',_0x7a2b31[_0x93b5('0x96')]),[_0x7a2b31['id'],_0x337e1a[_0x93b5('0x8a')](),path[_0x93b5('0x59')](__dirname,_0x93b5('0xa6'),_0x7a2b31[_0x93b5('0xa7')]),_0x3e88cd]);return _0x7a2b31;}else{var _0x3db7bf=squel[_0x93b5('0x75')]();_0x3db7bf[_0x93b5('0x76')]('('+_0x337e1a[_0x93b5('0x8a')]()+')',_0x93b5('0xa8'));_0x3db7bf[_0x93b5('0x6e')](_0x93b5('0xa9'),_0x93b5('0x20'));_0x337e1a[_0x93b5('0x1f')](_0x301836[_0x93b5('0x1f')]||_0x172991);_0x337e1a[_0x93b5('0x1d')](_0x301836['offset']||0x0);return dbH[_0x93b5('0x8b')][_0x93b5('0x36')](_0x3db7bf[_0x93b5('0x8a')](),{'type':dbH[_0x93b5('0x8b')]['QueryTypes'][_0x93b5('0x8d')]})['then'](function(_0x1d1818){if(!_0x1d1818['length']){_0x2a0c9d=0x0;}else{_0x2a0c9d=_0x1d1818[0x0]['count']||0x0;}return dbH[_0x93b5('0x8b')]['query'](_0x337e1a[_0x93b5('0x8a')](),{'type':dbH[_0x93b5('0x8b')]['QueryTypes'][_0x93b5('0x8d')]});})[_0x93b5('0x28')](function(_0x16c3bb){return{'rows':_0x16c3bb||[],'count':_0x2a0c9d};});}});}exports[_0x93b5('0xaa')]=function(_0x244db0,_0x2d78d5){return runReport(_0x244db0[_0x93b5('0x4c')],_0x244db0[_0x93b5('0x36')],_0x244db0[_0x93b5('0x46')])[_0x93b5('0x28')](respondWithResult(_0x2d78d5,null))[_0x93b5('0x4e')](handleError(_0x2d78d5,null));};exports[_0x93b5('0xab')]=runReport;exports[_0x93b5('0x36')]=function(_0x329198,_0x383800){var _0x3daeb1=0xa;var _0x2e86d=[_0x93b5('0x59'),_0x93b5('0x5a'),_0x93b5('0x5b'),_0x93b5('0x5c')];var _0xeee052={'SUM':_0x93b5('0x5d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x93b5('0x5f'),'MAX':_0x93b5('0x60'),'MIN':_0x93b5('0x8e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x93b5('0x61'),'GROUP_CONCAT ASC':_0x93b5('0x62'),'GROUP_CONCAT DESC':_0x93b5('0x63')};var _0x424e3a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x93b5('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x93b5('0x66'),'UNIX_TIMESTAMP':_0x93b5('0x67')};var _0x1c73e0=function(_0x1151b7){return!_[_0x93b5('0x68')](['IS\x20NULL',_0x93b5('0x91'),_0x93b5('0x6a'),_0x93b5('0x92')],_0x1151b7);};var _0x3b5be6=function(_0x207976){if(!_0x207976||!_0x207976[_0x93b5('0x6b')][_0x93b5('0x3d')]){return'';}for(var _0x34e34d='(',_0x17f4b3=0x0;_0x17f4b3<_0x207976[_0x93b5('0x6b')][_0x93b5('0x3d')];_0x17f4b3+=0x1){_0x17f4b3>0x0&&(_0x34e34d+='\x20'+_0x207976[_0x93b5('0x6c')]+'\x20');_0x34e34d+=_0x207976[_0x93b5('0x6b')][_0x17f4b3][_0x93b5('0x6d')]?_0x3b5be6(_0x207976[_0x93b5('0x6b')][_0x17f4b3][_0x93b5('0x6d')]):_0x207976[_0x93b5('0x6b')][_0x17f4b3]['field']+'\x20'+_0x207976[_0x93b5('0x6b')][_0x17f4b3]['condition']+(_0x1c73e0(_0x207976[_0x93b5('0x6b')][_0x17f4b3][_0x93b5('0x6f')])?'\x20'+_0x207976['rules'][_0x17f4b3][_0x93b5('0x70')]:'');}return _0x34e34d+')';};var _0x43a564={'where':{'id':_0x329198[_0x93b5('0x4c')]['id']}},_0x40265e,_0x307ecf,_0x524d19,_0x15dfcf,_0x362d3d;_0x43a564=_[_0x93b5('0x44')]({},_0x43a564,_0x329198[_0x93b5('0x46')]);return db[_0x93b5('0x31')][_0x93b5('0x4d')](_0x43a564)[_0x93b5('0x28')](function(_0x4024b9){if(_0x4024b9){_0x40265e=_0x4024b9;return _0x4024b9[_0x93b5('0x71')]();}return null;})['then'](function(_0x35c350){if(_0x35c350){if(!_0x35c350[_0x93b5('0x3d')]){throw new db[(_0x93b5('0x72'))][(_0x93b5('0x73'))](_0x93b5('0x74'),0x193);}_0x307ecf=_0x35c350;return db[_0x93b5('0x93')][_0x93b5('0x49')]({'raw':!![]});}return null;})[_0x93b5('0x28')](function(_0x14217b){if(_0x14217b){_0x524d19=_[_0x93b5('0x94')](_0x14217b,'id');var _0x2213c7;var _0x6d5b16=squel[_0x93b5('0x75')]();_0x6d5b16['from'](_0x40265e[_0x93b5('0x77')]);for(var _0x1f5cdd=0x0;_0x1f5cdd<_0x307ecf[_0x93b5('0x3d')];_0x1f5cdd+=0x1){_0x2213c7=_0x307ecf[_0x1f5cdd][_0x93b5('0x78')]?_0x524d19[_0x307ecf[_0x1f5cdd][_0x93b5('0x78')]]['metric']:_0x307ecf[_0x1f5cdd][_0x93b5('0x6e')];_0x2213c7=_0x307ecf[_0x1f5cdd][_0x93b5('0x79')]?_[_0x93b5('0x7b')](_0xeee052[_0x307ecf[_0x1f5cdd][_0x93b5('0x79')]],'%s',_0x2213c7):_0x2213c7;_0x2213c7=_0x307ecf[_0x1f5cdd][_0x93b5('0x7a')]?_[_0x93b5('0x7b')](_0x424e3a[_0x307ecf[_0x1f5cdd][_0x93b5('0x7a')]],'%s',_0x2213c7):_0x2213c7;if(_0x307ecf[_0x1f5cdd][_0x93b5('0x7c')]){_0x6d5b16[_0x93b5('0x6d')](_0x2213c7);}_0x307ecf[_0x1f5cdd]['orderBy']&&_0x6d5b16['order'](_0x2213c7,_0x307ecf[_0x1f5cdd][_0x93b5('0x7d')]===_0x93b5('0x7f')?![]:!![]);_0x6d5b16[_0x93b5('0x6e')](_0x2213c7,_0x307ecf[_0x1f5cdd][_0x93b5('0x80')]||_0x2213c7);}if(_0x40265e[_0x93b5('0x81')]){_0x40265e['joins']=JSON['parse'](_0x40265e['joins']);for(var _0x19aa40=0x0;_0x19aa40<_0x40265e['joins'][_0x93b5('0x3d')];_0x19aa40+=0x1){if(_0x40265e['joins'][_0x19aa40][_0x93b5('0x34')]&&_[_0x93b5('0x68')](_0x2e86d,_0x40265e[_0x93b5('0x81')][_0x19aa40][_0x93b5('0x34')])&&_0x40265e['joins'][_0x19aa40][_0x93b5('0x83')]&&_0x40265e[_0x93b5('0x81')][_0x19aa40][_0x93b5('0x84')]&&_0x40265e[_0x93b5('0x81')][_0x19aa40][_0x93b5('0x85')]){_0x6d5b16[_0x40265e[_0x93b5('0x81')][_0x19aa40][_0x93b5('0x34')]](_0x40265e[_0x93b5('0x81')][_0x19aa40]['foreignTable'],null,util[_0x93b5('0x7a')](_0x93b5('0x86'),_0x40265e[_0x93b5('0x77')],_0x40265e[_0x93b5('0x81')][_0x19aa40][_0x93b5('0x83')],_0x40265e[_0x93b5('0x81')][_0x19aa40][_0x93b5('0x84')],_0x40265e[_0x93b5('0x81')][_0x19aa40][_0x93b5('0x85')]));}}}if(_0x40265e[_0x93b5('0x87')]){_0x40265e['conditions']=JSON['parse'](_0x40265e[_0x93b5('0x87')]);_0x6d5b16[_0x93b5('0x43')](_0x3b5be6(_0x40265e[_0x93b5('0x87')][_0x93b5('0x6d')]));}_0x362d3d=_0x6d5b16[_0x93b5('0x88')]();_0x6d5b16[_0x93b5('0x1f')](_0x3daeb1);_0x6d5b16['offset'](0x0);logger[_0x93b5('0xac')](_0x93b5('0x89'),_0x6d5b16[_0x93b5('0x8a')]());return dbH[_0x93b5('0x8b')][_0x93b5('0x36')](_0x6d5b16[_0x93b5('0x8a')](),{'type':dbH[_0x93b5('0x8b')][_0x93b5('0x8c')][_0x93b5('0x8d')]});}})[_0x93b5('0x28')](function(){return{'sql':_0x362d3d[_0x93b5('0x8a')]()};})['then'](respondWithResult(_0x383800,null))['catch'](handleError(_0x383800,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index ea0c98c..7c13900 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 _0xd03c=['path','../../config/environment','lodash','util','api','moment','bluebird','request-promise'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd03c,0x1ba));var _0xcd03=function(_0x1ae842,_0x5b39b8){_0x1ae842=_0x1ae842-0x0;var _0x128131=_0xd03c[_0x1ae842];return _0x128131;};'use strict';var _=require(_0xcd03('0x0'));var util=require(_0xcd03('0x1'));var logger=require('../../config/logger')(_0xcd03('0x2'));var moment=require(_0xcd03('0x3'));var BPromise=require(_0xcd03('0x4'));var rp=require(_0xcd03('0x5'));var fs=require('fs');var path=require(_0xcd03('0x6'));var rimraf=require('rimraf');var config=require(_0xcd03('0x7'));var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x589bad,_0x22510d){return _0x589bad['define']('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61ae=['path','rimraf','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','util','../../config/logger','api','moment'];(function(_0xdfc402,_0x3f1811){var _0x4c6a10=function(_0xbb756){while(--_0xbb756){_0xdfc402['push'](_0xdfc402['shift']());}};_0x4c6a10(++_0x3f1811);}(_0x61ae,0x1d4));var _0xe61a=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0x61ae[_0x413727];return _0x5f46d7;};'use strict';var _=require(_0xe61a('0x0'));var util=require(_0xe61a('0x1'));var logger=require(_0xe61a('0x2'))(_0xe61a('0x3'));var moment=require(_0xe61a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe61a('0x5'));var rimraf=require(_0xe61a('0x6'));var config=require('../../config/environment');var attributes=require(_0xe61a('0x7'));module[_0xe61a('0x8')]=function(_0x46c136,_0x15880e){return _0x46c136[_0xe61a('0x9')]('AnalyticCustomReport',attributes,{'tableName':_0xe61a('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 022a8eb..493c6bc 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 _0xce84=['../../config/logger','jayson/promise','client','request','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticCustomReport,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x15d55c,_0xb356c1){var _0x53157b=function(_0x1b0274){while(--_0x1b0274){_0x15d55c['push'](_0x15d55c['shift']());}};_0x53157b(++_0xb356c1);}(_0xce84,0x14e));var _0x4ce8=function(_0xc2b0e0,_0x223cae){_0xc2b0e0=_0xc2b0e0-0x0;var _0xa6e0f6=_0xce84[_0xc2b0e0];return _0xa6e0f6;};'use strict';var _=require(_0x4ce8('0x0'));var util=require(_0x4ce8('0x1'));var moment=require(_0x4ce8('0x2'));var BPromise=require('bluebird');var rs=require(_0x4ce8('0x3'));var fs=require('fs');var Redis=require(_0x4ce8('0x4'));var db=require(_0x4ce8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ce8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4ce8('0x7'));var client=jayson[_0x4ce8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fcc0d,_0x1b4fc5,_0xc937c4){return new BPromise(function(_0x451690,_0x26be84){return client[_0x4ce8('0x9')](_0x1fcc0d,_0xc937c4)[_0x4ce8('0xa')](function(_0x5043c0){logger[_0x4ce8('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1b4fc5,_0x4ce8('0xc'));logger[_0x4ce8('0xd')](_0x4ce8('0xe'),_0x1b4fc5,'request\x20sent',JSON[_0x4ce8('0xf')](_0x5043c0));if(_0x5043c0['error']){if(_0x5043c0[_0x4ce8('0x10')]['code']===0x1f4){logger[_0x4ce8('0x10')](_0x4ce8('0x11'),_0x1b4fc5,_0x5043c0[_0x4ce8('0x10')][_0x4ce8('0x12')]);return _0x26be84(_0x5043c0[_0x4ce8('0x10')][_0x4ce8('0x12')]);}logger['error'](_0x4ce8('0x11'),_0x1b4fc5,_0x5043c0['error'][_0x4ce8('0x12')]);return _0x451690(_0x5043c0[_0x4ce8('0x10')][_0x4ce8('0x12')]);}else{logger[_0x4ce8('0xb')](_0x4ce8('0x11'),_0x1b4fc5,_0x4ce8('0xc'));_0x451690(_0x5043c0[_0x4ce8('0x13')]['message']);}})['catch'](function(_0x584b11){logger[_0x4ce8('0x10')](_0x4ce8('0x11'),_0x1b4fc5,_0x584b11);_0x26be84(_0x584b11);});});} \ No newline at end of file +var _0x54e6=['message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','info','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x4ff876,_0x293d17){var _0x118ef3=function(_0x327708){while(--_0x327708){_0x4ff876['push'](_0x4ff876['shift']());}};_0x118ef3(++_0x293d17);}(_0x54e6,0x1b3));var _0x654e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x54e6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x654e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x654e('0x1'));var rs=require(_0x654e('0x2'));var fs=require('fs');var Redis=require(_0x654e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x654e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x654e('0x5'));var jayson=require(_0x654e('0x6'));var client=jayson['client'][_0x654e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2d0ba3,_0xc42c4f,_0x238d99){return new BPromise(function(_0x3f4904,_0x401e3d){return client['request'](_0x2d0ba3,_0x238d99)['then'](function(_0x9db266){logger[_0x654e('0x8')]('AnalyticCustomReport,\x20%s,\x20%s',_0xc42c4f,_0x654e('0x9'));logger['debug'](_0x654e('0xa'),_0xc42c4f,_0x654e('0x9'),JSON['stringify'](_0x9db266));if(_0x9db266[_0x654e('0xb')]){if(_0x9db266['error']['code']===0x1f4){logger[_0x654e('0xb')](_0x654e('0xc'),_0xc42c4f,_0x9db266['error'][_0x654e('0xd')]);return _0x401e3d(_0x9db266[_0x654e('0xb')]['message']);}logger[_0x654e('0xb')](_0x654e('0xc'),_0xc42c4f,_0x9db266[_0x654e('0xb')][_0x654e('0xd')]);return _0x3f4904(_0x9db266[_0x654e('0xb')][_0x654e('0xd')]);}else{logger[_0x654e('0x8')](_0x654e('0xc'),_0xc42c4f,_0x654e('0x9'));_0x3f4904(_0x9db266[_0x654e('0xe')][_0x654e('0xd')]);}})[_0x654e('0xf')](function(_0x53efc7){logger[_0x654e('0xb')](_0x654e('0xc'),_0xc42c4f,_0x53efc7);_0x401e3d(_0x53efc7);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 9983be7..cee6bc3 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 _0xa3ff=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','create','put','update','destroy','exports','multer'];(function(_0x1ef4ac,_0x42e47a){var _0x37c6e8=function(_0x7c322c){while(--_0x7c322c){_0x1ef4ac['push'](_0x1ef4ac['shift']());}};_0x37c6e8(++_0x42e47a);}(_0xa3ff,0x15f));var _0xfa3f=function(_0x231cd1,_0x3943d1){_0x231cd1=_0x231cd1-0x0;var _0x10d942=_0xa3ff[_0x231cd1];return _0x10d942;};'use strict';var multer=require(_0xfa3f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfa3f('0x1'));var express=require(_0xfa3f('0x2'));var router=express['Router']();var fs_extra=require(_0xfa3f('0x3'));var auth=require(_0xfa3f('0x4'));var interaction=require(_0xfa3f('0x5'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0xfa3f('0x6')](),controller[_0xfa3f('0x7')]);router[_0xfa3f('0x8')](_0xfa3f('0x9'),auth[_0xfa3f('0x6')](),controller[_0xfa3f('0xa')]);router['get'](_0xfa3f('0xb'),auth[_0xfa3f('0x6')](),controller[_0xfa3f('0xc')]);router[_0xfa3f('0x8')](_0xfa3f('0xd'),auth[_0xfa3f('0x6')](),controller[_0xfa3f('0xe')]);router[_0xfa3f('0x8')](_0xfa3f('0xf'),auth['isAuthenticated'](),controller[_0xfa3f('0x10')]);router['post']('/',auth[_0xfa3f('0x6')](),controller[_0xfa3f('0x11')]);router[_0xfa3f('0x12')](_0xfa3f('0x9'),auth[_0xfa3f('0x6')](),controller[_0xfa3f('0x13')]);router['delete'](_0xfa3f('0x9'),auth[_0xfa3f('0x6')](),controller[_0xfa3f('0x14')]);module[_0xfa3f('0x15')]=router; \ No newline at end of file +var _0xc591=['get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','query','post','create','update','delete','/:id','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller'];(function(_0x30a88a,_0x1c0c9f){var _0x3282e=function(_0x52b2a8){while(--_0x52b2a8){_0x30a88a['push'](_0x30a88a['shift']());}};_0x3282e(++_0x1c0c9f);}(_0xc591,0x1d2));var _0x1c59=function(_0x2cbc82,_0x30d15a){_0x2cbc82=_0x2cbc82-0x0;var _0x222f31=_0xc591[_0x2cbc82];return _0x222f31;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1c59('0x0'));var timeout=require(_0x1c59('0x1'));var express=require(_0x1c59('0x2'));var router=express[_0x1c59('0x3')]();var fs_extra=require(_0x1c59('0x4'));var auth=require(_0x1c59('0x5'));var interaction=require(_0x1c59('0x6'));var config=require(_0x1c59('0x7'));var controller=require(_0x1c59('0x8'));router[_0x1c59('0x9')]('/',auth[_0x1c59('0xa')](),controller[_0x1c59('0xb')]);router[_0x1c59('0x9')]('/:id',auth[_0x1c59('0xa')](),controller[_0x1c59('0xc')]);router['get'](_0x1c59('0xd'),auth[_0x1c59('0xa')](),controller[_0x1c59('0xe')]);router['get'](_0x1c59('0xf'),auth['isAuthenticated'](),controller[_0x1c59('0x10')]);router[_0x1c59('0x9')]('/:id/query',auth[_0x1c59('0xa')](),controller[_0x1c59('0x11')]);router[_0x1c59('0x12')]('/',auth[_0x1c59('0xa')](),controller[_0x1c59('0x13')]);router['put']('/:id',auth[_0x1c59('0xa')](),controller[_0x1c59('0x14')]);router[_0x1c59('0x15')](_0x1c59('0x16'),auth[_0x1c59('0xa')](),controller[_0x1c59('0x17')]);module[_0x1c59('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 75aacb5..a150277 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 _0xeff8=['STRING','TEXT','sequelize','exports'];(function(_0x2574eb,_0x4bf81c){var _0x2511b7=function(_0x49a99d){while(--_0x49a99d){_0x2574eb['push'](_0x2574eb['shift']());}};_0x2511b7(++_0x4bf81c);}(_0xeff8,0x186));var _0x8eff=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xeff8[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eff('0x2')]},'parent':{'type':Sequelize[_0x8eff('0x2')]},'table':{'type':Sequelize[_0x8eff('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8eff('0x3')]}}; \ No newline at end of file +var _0x5075=['exports','STRING','TEXT','sequelize'];(function(_0x35fb56,_0x5dadff){var _0x2fd52c=function(_0x97bd3f){while(--_0x97bd3f){_0x35fb56['push'](_0x35fb56['shift']());}};_0x2fd52c(++_0x5dadff);}(_0x5075,0x73));var _0x5507=function(_0x2ada6a,_0x49cece){_0x2ada6a=_0x2ada6a-0x0;var _0x42b8fa=_0x5075[_0x2ada6a];return _0x42b8fa;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'name':{'type':Sequelize[_0x5507('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5507('0x2')]},'parent':{'type':Sequelize[_0x5507('0x2')]},'table':{'type':Sequelize[_0x5507('0x2')]},'conditions':{'type':Sequelize[_0x5507('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index a8a50a6..ae5ad9f 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 _0x2542=['getFields','ValidationErrorItem','metric','format','DESC','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','sequelize','SELECT','run','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','save','destroy','then','get','end','error','stack','name','send','index','map','AnalyticDefaultReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','field','replace','function','groupBy','orderBy','alias','parse','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','QueryTypes','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','value'];(function(_0x294bd9,_0x1faea8){var _0xdd5b3f=function(_0xb2df4e){while(--_0xb2df4e){_0x294bd9['push'](_0x294bd9['shift']());}};_0xdd5b3f(++_0x1faea8);}(_0x2542,0x169));var _0x2254=function(_0x37f970,_0x82fb47){_0x37f970=_0x37f970-0x0;var _0x6c0d62=_0x2542[_0x37f970];return _0x6c0d62;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];var dbH=require(_0x2254('0x19'))[_0x2254('0x1a')];function respondWithStatusCode(_0x3c326b,_0x381efe){_0x381efe=_0x381efe||0xcc;return function(_0x592a4f){if(_0x592a4f){return _0x3c326b[_0x2254('0x1b')](_0x381efe);}return _0x3c326b[_0x2254('0x1c')](_0x381efe)['end']();};}function respondWithResult(_0x2f4de,_0x1e582d){_0x1e582d=_0x1e582d||0xc8;return function(_0xfb23cb){if(_0xfb23cb){return _0x2f4de[_0x2254('0x1c')](_0x1e582d)[_0x2254('0x1d')](_0xfb23cb);}};}function respondWithFilteredResult(_0xbc5548,_0x50f137){return function(_0x18baf4){if(_0x18baf4){var _0x57247a=typeof _0x50f137[_0x2254('0x1e')]===_0x2254('0x1f')&&typeof _0x50f137[_0x2254('0x20')]===_0x2254('0x1f');var _0x1ae11e=_0x18baf4[_0x2254('0x21')];var _0x497724=_0x57247a?0x0:_0x50f137['offset'];var _0x5ec98d=_0x57247a?_0x18baf4[_0x2254('0x21')]:_0x50f137[_0x2254('0x1e')]+_0x50f137[_0x2254('0x20')];var _0x1f1163;if(_0x5ec98d>=_0x1ae11e){_0x5ec98d=_0x1ae11e;_0x1f1163=0xc8;}else{_0x1f1163=0xce;}_0xbc5548[_0x2254('0x1c')](_0x1f1163);return _0xbc5548[_0x2254('0x22')]('Content-Range',_0x497724+'-'+_0x5ec98d+'/'+_0x1ae11e)[_0x2254('0x1d')](_0x18baf4);}return null;};}function patchUpdates(_0x16148d){return function(_0x906cde){try{jsonpatch['apply'](_0x906cde,_0x16148d,!![]);}catch(_0x52fedc){return BPromise['reject'](_0x52fedc);}return _0x906cde[_0x2254('0x23')]();};}function saveUpdates(_0x559af4,_0xf88b56){return function(_0x56b91e){if(_0x56b91e){return _0x56b91e['update'](_0x559af4)['then'](function(_0x540020){return _0x540020;});}return null;};}function removeEntity(_0x5e5edb,_0x4f797d){return function(_0x1aa71f){if(_0x1aa71f){return _0x1aa71f[_0x2254('0x24')]()[_0x2254('0x25')](function(){var _0x265467=_0x1aa71f[_0x2254('0x26')]({'plain':!![]});var _0x1349c9='DefaultReports';return db['UserProfileResource'][_0x2254('0x24')]({'where':{'type':_0x1349c9,'resourceId':_0x265467['id']}})['then'](function(){return _0x1aa71f;});})[_0x2254('0x25')](function(){_0x5e5edb[_0x2254('0x1c')](0xcc)[_0x2254('0x27')]();});}};}function handleEntityNotFound(_0x3aa0bd,_0x19043b){return function(_0x482688){if(!_0x482688){_0x3aa0bd[_0x2254('0x1b')](0x194);}return _0x482688;};}function handleError(_0x2a789b,_0x21285d){_0x21285d=_0x21285d||0x1f4;return function(_0x37af8b){logger[_0x2254('0x28')](_0x37af8b[_0x2254('0x29')]);if(_0x37af8b[_0x2254('0x2a')]){delete _0x37af8b[_0x2254('0x2a')];}_0x2a789b[_0x2254('0x1c')](_0x21285d)[_0x2254('0x2b')](_0x37af8b);};}exports[_0x2254('0x2c')]=function(_0xad7774,_0x220f2a){var _0x27d30a={},_0x4577f4={},_0x1b16c8={'count':0x0,'rows':[]};var _0x2c929f=_[_0x2254('0x2d')](db[_0x2254('0x2e')]['rawAttributes'],function(_0xe29526){return{'name':_0xe29526[_0x2254('0x2f')],'type':_0xe29526[_0x2254('0x30')][_0x2254('0x31')]};});_0x4577f4[_0x2254('0x32')]=_[_0x2254('0x2d')](_0x2c929f,_0x2254('0x2a'));_0x4577f4[_0x2254('0x33')]=_[_0x2254('0x34')](_0xad7774['query']);_0x4577f4[_0x2254('0x35')]=_[_0x2254('0x36')](_0x4577f4['model'],_0x4577f4[_0x2254('0x33')]);_0x27d30a[_0x2254('0x37')]=_[_0x2254('0x36')](_0x4577f4[_0x2254('0x32')],qs['fields'](_0xad7774['query'][_0x2254('0x38')]));_0x27d30a['attributes']=_0x27d30a[_0x2254('0x37')][_0x2254('0x39')]?_0x27d30a[_0x2254('0x37')]:_0x4577f4[_0x2254('0x32')];if(!_0xad7774[_0x2254('0x33')][_0x2254('0x3a')](_0x2254('0x3b'))){_0x27d30a['limit']=qs[_0x2254('0x20')](_0xad7774[_0x2254('0x33')][_0x2254('0x20')]);_0x27d30a[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0xad7774[_0x2254('0x33')][_0x2254('0x1e')]);}_0x27d30a[_0x2254('0x3c')]=qs[_0x2254('0x3d')](_0xad7774[_0x2254('0x33')]['sort']);_0x27d30a[_0x2254('0x3e')]=qs[_0x2254('0x35')](_[_0x2254('0x3f')](_0xad7774[_0x2254('0x33')],_0x4577f4['filters']),_0x2c929f);if(_0xad7774[_0x2254('0x33')][_0x2254('0x40')]){_0x27d30a[_0x2254('0x3e')]=_[_0x2254('0x41')](_0x27d30a[_0x2254('0x3e')],{'$or':_[_0x2254('0x2d')](_0x2c929f,function(_0x423377){if(_0x423377[_0x2254('0x30')]!=='VIRTUAL'){var _0x362ad1={};_0x362ad1[_0x423377['name']]={'$like':'%'+_0xad7774[_0x2254('0x33')][_0x2254('0x40')]+'%'};return _0x362ad1;}})});}_0x27d30a=_[_0x2254('0x41')]({},_0x27d30a,_0xad7774[_0x2254('0x42')]);var _0x460bb3={'where':_0x27d30a[_0x2254('0x3e')]};return db[_0x2254('0x2e')]['count'](_0x460bb3)[_0x2254('0x25')](function(_0x2f1ff9){_0x1b16c8[_0x2254('0x21')]=_0x2f1ff9;if(_0xad7774[_0x2254('0x33')][_0x2254('0x43')]){_0x27d30a['include']=[{'all':!![]}];}return db[_0x2254('0x2e')][_0x2254('0x44')](_0x27d30a);})[_0x2254('0x25')](function(_0x135ed8){_0x1b16c8[_0x2254('0x45')]=_0x135ed8;return _0x1b16c8;})['then'](respondWithFilteredResult(_0x220f2a,_0x27d30a))[_0x2254('0x46')](handleError(_0x220f2a,null));};exports['show']=function(_0x91e091,_0x1ded9a){var _0xb4d042={'raw':!![],'where':{'id':_0x91e091[_0x2254('0x47')]['id']}},_0x31c31e={};_0x31c31e[_0x2254('0x32')]=_[_0x2254('0x34')](db[_0x2254('0x2e')][_0x2254('0x48')]);_0x31c31e[_0x2254('0x33')]=_[_0x2254('0x34')](_0x91e091[_0x2254('0x33')]);_0x31c31e[_0x2254('0x35')]=_['intersection'](_0x31c31e[_0x2254('0x32')],_0x31c31e[_0x2254('0x33')]);_0xb4d042[_0x2254('0x37')]=_['intersection'](_0x31c31e[_0x2254('0x32')],qs[_0x2254('0x38')](_0x91e091[_0x2254('0x33')][_0x2254('0x38')]));_0xb4d042[_0x2254('0x37')]=_0xb4d042[_0x2254('0x37')][_0x2254('0x39')]?_0xb4d042[_0x2254('0x37')]:_0x31c31e[_0x2254('0x32')];if(_0x91e091['query'][_0x2254('0x43')]){_0xb4d042[_0x2254('0x49')]=[{'all':!![]}];}_0xb4d042=_[_0x2254('0x41')]({},_0xb4d042,_0x91e091[_0x2254('0x42')]);return db[_0x2254('0x2e')][_0x2254('0x4a')](_0xb4d042)[_0x2254('0x25')](handleEntityNotFound(_0x1ded9a,null))[_0x2254('0x25')](respondWithResult(_0x1ded9a,null))[_0x2254('0x46')](handleError(_0x1ded9a,null));};exports[_0x2254('0x4b')]=function(_0x5b14c5,_0x36b977){return db[_0x2254('0x2e')]['create'](_0x5b14c5[_0x2254('0x4c')],{})[_0x2254('0x25')](function(_0x12e2ff){var _0x4331a9=_0x5b14c5['user'][_0x2254('0x26')]({'plain':!![]});if(!_0x4331a9)throw new Error(_0x2254('0x4d'));if(_0x4331a9['role']===_0x2254('0x4e')){var _0x3f0670=_0x12e2ff[_0x2254('0x26')]({'plain':!![]});var _0x43bb88='Reports';return db[_0x2254('0x4f')][_0x2254('0x4a')]({'where':{'name':_0x43bb88,'userProfileId':_0x4331a9[_0x2254('0x50')]},'raw':!![]})['then'](function(_0x4cc18a){if(_0x4cc18a&&_0x4cc18a[_0x2254('0x51')]===0x0){return db[_0x2254('0x52')]['create']({'name':_0x3f0670[_0x2254('0x2a')],'resourceId':_0x3f0670['id'],'type':'DefaultReports','sectionId':_0x4cc18a['id']},{})['then'](function(){return _0x12e2ff;});}else{return _0x12e2ff;}})[_0x2254('0x46')](function(_0x135962){logger[_0x2254('0x28')](_0x2254('0x53'),_0x135962);throw _0x135962;});}return _0x12e2ff;})[_0x2254('0x25')](respondWithResult(_0x36b977,0xc9))['catch'](handleError(_0x36b977,null));};exports['update']=function(_0x1bd988,_0x5e3fbc){if(_0x1bd988[_0x2254('0x4c')]['id']){delete _0x1bd988[_0x2254('0x4c')]['id'];}return db[_0x2254('0x2e')][_0x2254('0x4a')]({'where':{'id':_0x1bd988['params']['id']}})[_0x2254('0x25')](handleEntityNotFound(_0x5e3fbc,null))[_0x2254('0x25')](saveUpdates(_0x1bd988['body'],null))['then'](respondWithResult(_0x5e3fbc,null))[_0x2254('0x46')](handleError(_0x5e3fbc,null));};exports['destroy']=function(_0x2cc59c,_0x305ace){return db[_0x2254('0x2e')][_0x2254('0x4a')]({'where':{'id':_0x2cc59c[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x305ace,null))['then'](removeEntity(_0x305ace,null))[_0x2254('0x46')](handleError(_0x305ace,null));};exports['preview']=function(_0x335c66,_0x510fe0){var _0x4da493=0xa;var _0x5999c8=[_0x2254('0x54'),_0x2254('0x55'),_0x2254('0x56'),_0x2254('0x57')];var _0x13606e={'SUM':_0x2254('0x58'),'COUNT':_0x2254('0x59'),'COUNT DISTINCT':_0x2254('0x5a'),'MAX':_0x2254('0x5b'),'MIN':_0x2254('0x5c'),'AVG':_0x2254('0x5d'),'GROUP_CONCAT':_0x2254('0x5e'),'GROUP_CONCAT ASC':_0x2254('0x5f'),'GROUP_CONCAT DESC':_0x2254('0x60')};var _0x2f391d={'SEC_TO_TIME':_0x2254('0x61'),'DATE':_0x2254('0x62'),'HOUR':_0x2254('0x63'),'ROUND':_0x2254('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x329378=function(_0xae171c){return!_[_0x2254('0x65')]([_0x2254('0x66'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x2254('0x67')],_0xae171c);};var _0x423c17=function(_0x1d73a3){if(!_0x1d73a3||!_0x1d73a3[_0x2254('0x68')][_0x2254('0x39')]){return'';}for(var _0x53b55b='(',_0x45b7bd=0x0;_0x45b7bd<_0x1d73a3[_0x2254('0x68')][_0x2254('0x39')];_0x45b7bd+=0x1){_0x45b7bd>0x0&&(_0x53b55b+='\x20'+_0x1d73a3['operator']+'\x20');_0x53b55b+=_0x1d73a3['rules'][_0x45b7bd][_0x2254('0x69')]?_0x423c17(_0x1d73a3['rules'][_0x45b7bd][_0x2254('0x69')]):_0x1d73a3[_0x2254('0x68')][_0x45b7bd]['field']+'\x20'+_0x1d73a3[_0x2254('0x68')][_0x45b7bd][_0x2254('0x6a')]+(_0x329378(_0x1d73a3['rules'][_0x45b7bd][_0x2254('0x6a')])?'\x20'+_0x1d73a3[_0x2254('0x68')][_0x45b7bd]['value']:'');}return _0x53b55b+')';};var _0x5cc6bd={'where':{'id':_0x335c66['params']['id']}},_0xde4e7,_0xa159a4,_0x486b82,_0x506d95,_0x48406e;_0x5cc6bd=_[_0x2254('0x41')]({},_0x5cc6bd,_0x335c66['options']);return db[_0x2254('0x2e')][_0x2254('0x4a')](_0x5cc6bd)[_0x2254('0x25')](function(_0x1ed6b9){if(_0x1ed6b9){_0xde4e7=_0x1ed6b9;return _0x1ed6b9['getFields']();}return null;})[_0x2254('0x25')](function(_0x5ecf82){if(_0x5ecf82){if(!_0x5ecf82[_0x2254('0x39')]){throw new db[(_0x2254('0x6b'))]['ValidationErrorItem'](_0x2254('0x6c'),0x193);}_0xa159a4=_0x5ecf82;return db[_0x2254('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x2254('0x25')](function(_0x3b3b20){if(_0x3b3b20){_0x486b82=_[_0x2254('0x6e')](_0x3b3b20,'id');var _0x3cefbe;var _0x4f77e5=squel[_0x2254('0x6f')]();_0x4f77e5[_0x2254('0x70')](_0xde4e7['table']);for(var _0x1ac8ff=0x0;_0x1ac8ff<_0xa159a4[_0x2254('0x39')];_0x1ac8ff+=0x1){_0x3cefbe=_0xa159a4[_0x1ac8ff]['MetricId']?_0x486b82[_0xa159a4[_0x1ac8ff][_0x2254('0x71')]]['metric']:_0xa159a4[_0x1ac8ff][_0x2254('0x72')];_0x3cefbe=_0xa159a4[_0x1ac8ff]['function']?_[_0x2254('0x73')](_0x13606e[_0xa159a4[_0x1ac8ff][_0x2254('0x74')]],'%s',_0x3cefbe):_0x3cefbe;_0x3cefbe=_0xa159a4[_0x1ac8ff]['format']?_[_0x2254('0x73')](_0x2f391d[_0xa159a4[_0x1ac8ff]['format']],'%s',_0x3cefbe):_0x3cefbe;if(_0xa159a4[_0x1ac8ff][_0x2254('0x75')]){_0x4f77e5[_0x2254('0x69')](_0x3cefbe);}_0xa159a4[_0x1ac8ff][_0x2254('0x76')]&&_0x4f77e5['order'](_0x3cefbe,_0xa159a4[_0x1ac8ff][_0x2254('0x76')]==='DESC'?![]:!![]);_0x4f77e5[_0x2254('0x72')](_0x3cefbe,_0xa159a4[_0x1ac8ff][_0x2254('0x77')]||_0x3cefbe);}if(_0xde4e7['joins']){_0xde4e7['joins']=JSON[_0x2254('0x78')](_0xde4e7[_0x2254('0x79')]);for(var _0x451520=0x0;_0x451520<_0xde4e7[_0x2254('0x79')]['length'];_0x451520+=0x1){if(_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x30')]&&_[_0x2254('0x65')](_0x5999c8,_0xde4e7[_0x2254('0x79')][_0x451520]['type'])&&_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x7a')]&&_0xde4e7['joins'][_0x451520][_0x2254('0x7b')]&&_0xde4e7['joins'][_0x451520][_0x2254('0x7c')]){_0x4f77e5[_0xde4e7['joins'][_0x451520]['type']](_0xde4e7['joins'][_0x451520][_0x2254('0x7b')],null,util['format'](_0x2254('0x7d'),_0xde4e7[_0x2254('0x7e')],_0xde4e7['joins'][_0x451520][_0x2254('0x7a')],_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x7b')],_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x7c')]));}}}if(_0xde4e7[_0x2254('0x7f')]){_0xde4e7['conditions']=JSON['parse'](_0xde4e7[_0x2254('0x7f')]);_0x4f77e5[_0x2254('0x3e')](_0x423c17(_0xde4e7[_0x2254('0x7f')][_0x2254('0x69')]));}_0x48406e=_0x4f77e5[_0x2254('0x80')]();_0x4f77e5[_0x2254('0x20')](_0x4da493);_0x4f77e5[_0x2254('0x1e')](0x0);logger[_0x2254('0x81')](_0x2254('0x82'),_0x4f77e5[_0x2254('0x83')]());return dbH['sequelize'][_0x2254('0x33')](_0x4f77e5[_0x2254('0x83')](),{'type':dbH['sequelize'][_0x2254('0x84')]['SELECT']});}})[_0x2254('0x25')](respondWithResult(_0x510fe0,null))[_0x2254('0x46')](handleError(_0x510fe0,null));};function runReport(_0x4dfcb4,_0x1c317b,_0x4e699c){var _0x2ad519=_0x1c317b[_0x2254('0x2a')];var _0x30f2c9=0xa;var _0x1f7a48=['join',_0x2254('0x55'),_0x2254('0x56'),_0x2254('0x57')];var _0x3a8d4f={'SUM':'SUM(%s)','COUNT':_0x2254('0x59'),'COUNT DISTINCT':_0x2254('0x5a'),'MAX':'MAX(%s)','MIN':_0x2254('0x5c'),'AVG':_0x2254('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2254('0x60')};var _0x2f3650={'SEC_TO_TIME':_0x2254('0x61'),'DATE':_0x2254('0x62'),'HOUR':_0x2254('0x63'),'ROUND':_0x2254('0x64'),'UNIX_TIMESTAMP':_0x2254('0x85')};var _0x251d70=function(_0x2c7705){return!_['includes']([_0x2254('0x66'),'IS\x20NOT\x20NULL',_0x2254('0x86'),'IS\x20NOT\x20EMPTY'],_0x2c7705);};var _0x36d121=function(_0x207a09){if(!_0x207a09||!_0x207a09[_0x2254('0x68')]['length']){return'';}for(var _0x8a3656='(',_0x1554f1=0x0;_0x1554f1<_0x207a09[_0x2254('0x68')][_0x2254('0x39')];_0x1554f1+=0x1){_0x1554f1>0x0&&(_0x8a3656+='\x20'+_0x207a09[_0x2254('0x87')]+'\x20');_0x8a3656+=_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x69')]?_0x36d121(_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x69')]):_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x72')]+'\x20'+_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x6a')]+(_0x251d70(_0x207a09['rules'][_0x1554f1][_0x2254('0x6a')])?'\x20'+_0x207a09['rules'][_0x1554f1][_0x2254('0x88')]:'');}return _0x8a3656+')';};var _0xb98b40={'where':{'id':_0x4dfcb4['id']}},_0x3b1d5c,_0x2c907a,_0x23b78c,_0x2b5dba,_0x30307a;_0xb98b40=_['merge']({},_0xb98b40,_0x4e699c);return db[_0x2254('0x2e')]['find'](_0xb98b40)[_0x2254('0x25')](function(_0x52712d){if(_0x52712d){_0x3b1d5c=_0x52712d;return _0x52712d[_0x2254('0x89')]();}return null;})[_0x2254('0x25')](function(_0x1d0c8f){if(_0x1d0c8f){if(!_0x1d0c8f['length']){throw new db[(_0x2254('0x6b'))][(_0x2254('0x8a'))](_0x2254('0x6c'),0x193);}_0x2c907a=_0x1d0c8f;return db[_0x2254('0x6d')][_0x2254('0x44')]({'raw':!![]});}return null;})[_0x2254('0x25')](function(_0x34185c){if(_0x34185c){_0x23b78c=_[_0x2254('0x6e')](_0x34185c,'id');var _0x5e94b6;var _0x56239e=squel[_0x2254('0x6f')]();_0x56239e['from'](_0x3b1d5c[_0x2254('0x7e')]);for(var _0x3a1365=0x0;_0x3a1365<_0x2c907a[_0x2254('0x39')];_0x3a1365+=0x1){_0x5e94b6=_0x2c907a[_0x3a1365][_0x2254('0x71')]?_0x23b78c[_0x2c907a[_0x3a1365][_0x2254('0x71')]][_0x2254('0x8b')]:_0x2c907a[_0x3a1365][_0x2254('0x72')];_0x5e94b6=_0x2c907a[_0x3a1365]['function']?_[_0x2254('0x73')](_0x3a8d4f[_0x2c907a[_0x3a1365][_0x2254('0x74')]],'%s',_0x5e94b6):_0x5e94b6;_0x5e94b6=_0x2c907a[_0x3a1365][_0x2254('0x8c')]?_['replace'](_0x2f3650[_0x2c907a[_0x3a1365][_0x2254('0x8c')]],'%s',_0x5e94b6):_0x5e94b6;if(_0x2c907a[_0x3a1365][_0x2254('0x75')]){_0x56239e[_0x2254('0x69')](_0x5e94b6);}_0x2c907a[_0x3a1365][_0x2254('0x76')]&&_0x56239e[_0x2254('0x3c')](_0x5e94b6,_0x2c907a[_0x3a1365][_0x2254('0x76')]===_0x2254('0x8d')?![]:!![]);_0x56239e[_0x2254('0x72')](_0x5e94b6,_0x2c907a[_0x3a1365][_0x2254('0x77')]||_0x5e94b6);}if(_0x3b1d5c['joins']){_0x3b1d5c[_0x2254('0x79')]=JSON[_0x2254('0x78')](_0x3b1d5c['joins']);for(var _0x4cec5b=0x0;_0x4cec5b<_0x3b1d5c[_0x2254('0x79')]['length'];_0x4cec5b+=0x1){if(_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x30')]&&_[_0x2254('0x65')](_0x1f7a48,_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x30')])&&_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7a')]&&_0x3b1d5c[_0x2254('0x79')][_0x4cec5b]['foreignTable']&&_0x3b1d5c['joins'][_0x4cec5b][_0x2254('0x7c')]){_0x56239e[_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x30')]](_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3b1d5c[_0x2254('0x7e')],_0x3b1d5c['joins'][_0x4cec5b][_0x2254('0x7a')],_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7b')],_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7c')]));}}}if(_0x3b1d5c[_0x2254('0x7f')]){_0x3b1d5c[_0x2254('0x7f')]=JSON['parse'](_0x3b1d5c[_0x2254('0x7f')]);_0x56239e[_0x2254('0x3e')](_0x36d121(_0x3b1d5c['conditions'][_0x2254('0x69')]));}_0x30307a=_0x56239e[_0x2254('0x80')]();_0x56239e[_0x2254('0x20')](_0x30f2c9);_0x56239e[_0x2254('0x1e')](0x0);return;}})[_0x2254('0x25')](function(){if(_0x1c317b[_0x2254('0x8e')]===_0x2254('0x8f')){return null;}var _0x38e2df=_[_0x2254('0x41')](_0x1c317b,{'name':_0x1c317b[_0x2254('0x90')]||_0x1c317b[_0x2254('0x2a')]||_0x3b1d5c['name'],'basename':_0x2ad519,'savename':util[_0x2254('0x8c')](_0x2254('0x91'),_0x1c317b[_0x2254('0x2a')]||_0x3b1d5c[_0x2254('0x2a')],require(_0x2254('0x92'))[_0x2254('0x93')](0x4),_0x1c317b[_0x2254('0x8e')]||'csv'),'reportId':_0x3b1d5c['id'],'reportType':_0x2254('0x94')});return db[_0x2254('0x95')][_0x2254('0x4b')](_0x38e2df,{'raw':!![]});})['then'](function(_0x60f5ac){if(_0x3b1d5c[_0x2254('0x7e')]===_0x2254('0x96')){_0x30307a[_0x2254('0x3e')](_0x3b1d5c[_0x2254('0x7e')]+_0x2254('0x97'),_0x1c317b['startDate'],_0x1c317b[_0x2254('0x98')]);}else{_0x30307a[_0x2254('0x3e')](_0x3b1d5c[_0x2254('0x7e')]+_0x2254('0x99'),_0x1c317b[_0x2254('0x9a')],_0x1c317b['endDate']);}if(_0x60f5ac){logger['info'](_0x2254('0x9b'),_0x30307a['toString']());require(_0x2254('0x9c'))[_0x2254('0x9d')](path[_0x2254('0x54')](__dirname,_0x2254('0x9e'),_0x60f5ac[_0x2254('0x8e')]),[_0x60f5ac['id'],_0x30307a[_0x2254('0x83')](),path['join'](__dirname,'../../files/reports',_0x60f5ac[_0x2254('0x9f')]),_0x2ad519]);return _0x60f5ac;}else{var _0x3317d4=squel[_0x2254('0x6f')]();_0x3317d4[_0x2254('0x70')]('('+_0x30307a['toString']()+')',_0x2254('0xa0'));_0x3317d4[_0x2254('0x72')](_0x2254('0xa1'),_0x2254('0x21'));_0x30307a[_0x2254('0x20')](_0x1c317b[_0x2254('0x20')]||_0x30f2c9);_0x30307a[_0x2254('0x1e')](_0x1c317b[_0x2254('0x1e')]||0x0);return dbH[_0x2254('0xa2')]['query'](_0x3317d4[_0x2254('0x83')](),{'type':dbH[_0x2254('0xa2')][_0x2254('0x84')]['SELECT']})[_0x2254('0x25')](function(_0xe38a28){if(!_0xe38a28[_0x2254('0x39')]){_0x2b5dba=0x0;}else{_0x2b5dba=_0xe38a28[0x0]['count']||0x0;}return dbH['sequelize'][_0x2254('0x33')](_0x30307a[_0x2254('0x83')](),{'type':dbH[_0x2254('0xa2')][_0x2254('0x84')][_0x2254('0xa3')]});})[_0x2254('0x25')](function(_0x4011de){return{'rows':_0x4011de||[],'count':_0x2b5dba};});}});}exports[_0x2254('0xa4')]=function(_0x5cb3d1,_0x1d8238){return runReport(_0x5cb3d1[_0x2254('0x47')],_0x5cb3d1[_0x2254('0x33')],_0x5cb3d1[_0x2254('0x42')])[_0x2254('0x25')](respondWithResult(_0x1d8238,null))[_0x2254('0x46')](handleError(_0x1d8238,null));};exports['runReport']=runReport;exports['query']=function(_0x40339d,_0x4b3b96){var _0x59b8af=0xa;var _0x408695=[_0x2254('0x54'),_0x2254('0x55'),_0x2254('0x56'),'cross_join'];var _0x596eae={'SUM':_0x2254('0x58'),'COUNT':_0x2254('0x59'),'COUNT DISTINCT':_0x2254('0x5a'),'MAX':'MAX(%s)','MIN':_0x2254('0x5c'),'AVG':_0x2254('0x5d'),'GROUP_CONCAT':_0x2254('0x5e'),'GROUP_CONCAT ASC':_0x2254('0x5f'),'GROUP_CONCAT DESC':_0x2254('0x60')};var _0x739a29={'SEC_TO_TIME':_0x2254('0x61'),'DATE':'DATE(%s)','HOUR':_0x2254('0x63'),'ROUND':_0x2254('0x64'),'UNIX_TIMESTAMP':_0x2254('0x85')};var _0x243466=function(_0x1b8587){return!_[_0x2254('0x65')]([_0x2254('0x66'),_0x2254('0xa5'),_0x2254('0x86'),'IS\x20NOT\x20EMPTY'],_0x1b8587);};var _0xbec5d0=function(_0x18f841){if(!_0x18f841||!_0x18f841[_0x2254('0x68')][_0x2254('0x39')]){return'';}for(var _0x275b56='(',_0x315add=0x0;_0x315add<_0x18f841['rules']['length'];_0x315add+=0x1){_0x315add>0x0&&(_0x275b56+='\x20'+_0x18f841[_0x2254('0x87')]+'\x20');_0x275b56+=_0x18f841['rules'][_0x315add][_0x2254('0x69')]?_0xbec5d0(_0x18f841[_0x2254('0x68')][_0x315add][_0x2254('0x69')]):_0x18f841[_0x2254('0x68')][_0x315add]['field']+'\x20'+_0x18f841[_0x2254('0x68')][_0x315add][_0x2254('0x6a')]+(_0x243466(_0x18f841[_0x2254('0x68')][_0x315add]['condition'])?'\x20'+_0x18f841['rules'][_0x315add][_0x2254('0x88')]:'');}return _0x275b56+')';};var _0x51b02a={'where':{'id':_0x40339d[_0x2254('0x47')]['id']}},_0x3e7642,_0xe1abb6,_0x1a44d0,_0x4af6a7,_0x539aba;_0x51b02a=_[_0x2254('0x41')]({},_0x51b02a,_0x40339d[_0x2254('0x42')]);return db[_0x2254('0x2e')][_0x2254('0x4a')](_0x51b02a)['then'](function(_0x34e28b){if(_0x34e28b){_0x3e7642=_0x34e28b;return _0x34e28b[_0x2254('0x89')]();}return null;})[_0x2254('0x25')](function(_0x5d373){if(_0x5d373){if(!_0x5d373[_0x2254('0x39')]){throw new db[(_0x2254('0x6b'))]['ValidationErrorItem'](_0x2254('0x6c'),0x193);}_0xe1abb6=_0x5d373;return db[_0x2254('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x2254('0x25')](function(_0x56a7ce){if(_0x56a7ce){_0x1a44d0=_[_0x2254('0x6e')](_0x56a7ce,'id');var _0x34bf19;var _0x4965c7=squel[_0x2254('0x6f')]();_0x4965c7[_0x2254('0x70')](_0x3e7642[_0x2254('0x7e')]);for(var _0x45541b=0x0;_0x45541b<_0xe1abb6[_0x2254('0x39')];_0x45541b+=0x1){_0x34bf19=_0xe1abb6[_0x45541b][_0x2254('0x71')]?_0x1a44d0[_0xe1abb6[_0x45541b][_0x2254('0x71')]][_0x2254('0x8b')]:_0xe1abb6[_0x45541b][_0x2254('0x72')];_0x34bf19=_0xe1abb6[_0x45541b][_0x2254('0x74')]?_[_0x2254('0x73')](_0x596eae[_0xe1abb6[_0x45541b][_0x2254('0x74')]],'%s',_0x34bf19):_0x34bf19;_0x34bf19=_0xe1abb6[_0x45541b][_0x2254('0x8c')]?_[_0x2254('0x73')](_0x739a29[_0xe1abb6[_0x45541b]['format']],'%s',_0x34bf19):_0x34bf19;if(_0xe1abb6[_0x45541b][_0x2254('0x75')]){_0x4965c7[_0x2254('0x69')](_0x34bf19);}_0xe1abb6[_0x45541b]['orderBy']&&_0x4965c7['order'](_0x34bf19,_0xe1abb6[_0x45541b][_0x2254('0x76')]===_0x2254('0x8d')?![]:!![]);_0x4965c7[_0x2254('0x72')](_0x34bf19,_0xe1abb6[_0x45541b][_0x2254('0x77')]||_0x34bf19);}if(_0x3e7642['joins']){_0x3e7642[_0x2254('0x79')]=JSON['parse'](_0x3e7642['joins']);for(var _0x40fec0=0x0;_0x40fec0<_0x3e7642[_0x2254('0x79')][_0x2254('0x39')];_0x40fec0+=0x1){if(_0x3e7642[_0x2254('0x79')][_0x40fec0]['type']&&_[_0x2254('0x65')](_0x408695,_0x3e7642['joins'][_0x40fec0][_0x2254('0x30')])&&_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7a')]&&_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7b')]&&_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7c')]){_0x4965c7[_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x30')]](_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7b')],null,util['format'](_0x2254('0x7d'),_0x3e7642[_0x2254('0x7e')],_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7a')],_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7b')],_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7c')]));}}}if(_0x3e7642['conditions']){_0x3e7642[_0x2254('0x7f')]=JSON[_0x2254('0x78')](_0x3e7642[_0x2254('0x7f')]);_0x4965c7[_0x2254('0x3e')](_0xbec5d0(_0x3e7642[_0x2254('0x7f')]['group']));}_0x539aba=_0x4965c7[_0x2254('0x80')]();_0x4965c7[_0x2254('0x20')](_0x59b8af);_0x4965c7['offset'](0x0);logger[_0x2254('0x81')](_0x2254('0x82'),_0x4965c7[_0x2254('0x83')]());return dbH['sequelize'][_0x2254('0x33')](_0x4965c7[_0x2254('0x83')](),{'type':dbH['sequelize'][_0x2254('0x84')][_0x2254('0xa3')]});}})[_0x2254('0x25')](function(){return{'sql':_0x539aba[_0x2254('0x83')]()};})['then'](respondWithResult(_0x4b3b96,null))[_0x2254('0x46')](handleError(_0x4b3b96,null));}; \ No newline at end of file +var _0x5fc3=['QueryTypes','right_join','HOUR(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','dbH','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','destroy','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','getFields','ValidationErrorItem','fullPath','%s-%s.%s','generate','output','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)'];(function(_0x29c88c,_0x352699){var _0x3b156a=function(_0x2dceed){while(--_0x2dceed){_0x29c88c['push'](_0x29c88c['shift']());}};_0x3b156a(++_0x352699);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0x5fc3[_0x5b7788];return _0x573871;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x35fc('0x17')];function respondWithStatusCode(_0x5d462a,_0x397738){_0x397738=_0x397738||0xcc;return function(_0x22055e){if(_0x22055e){return _0x5d462a[_0x35fc('0x18')](_0x397738);}return _0x5d462a[_0x35fc('0x19')](_0x397738)[_0x35fc('0x1a')]();};}function respondWithResult(_0x5cfe94,_0x59507a){_0x59507a=_0x59507a||0xc8;return function(_0x5eac0f){if(_0x5eac0f){return _0x5cfe94['status'](_0x59507a)[_0x35fc('0x1b')](_0x5eac0f);}};}function respondWithFilteredResult(_0x229d56,_0x53b898){return function(_0x154958){if(_0x154958){var _0x227a49=typeof _0x53b898[_0x35fc('0x1c')]==='undefined'&&typeof _0x53b898[_0x35fc('0x1d')]===_0x35fc('0x1e');var _0x553677=_0x154958[_0x35fc('0x1f')];var _0x363e47=_0x227a49?0x0:_0x53b898[_0x35fc('0x1c')];var _0x5f56c6=_0x227a49?_0x154958[_0x35fc('0x1f')]:_0x53b898[_0x35fc('0x1c')]+_0x53b898[_0x35fc('0x1d')];var _0x488234;if(_0x5f56c6>=_0x553677){_0x5f56c6=_0x553677;_0x488234=0xc8;}else{_0x488234=0xce;}_0x229d56[_0x35fc('0x19')](_0x488234);return _0x229d56[_0x35fc('0x20')](_0x35fc('0x21'),_0x363e47+'-'+_0x5f56c6+'/'+_0x553677)[_0x35fc('0x1b')](_0x154958);}return null;};}function patchUpdates(_0x20ffde){return function(_0x21f1a9){try{jsonpatch[_0x35fc('0x22')](_0x21f1a9,_0x20ffde,!![]);}catch(_0x3b05b0){return BPromise[_0x35fc('0x23')](_0x3b05b0);}return _0x21f1a9[_0x35fc('0x24')]();};}function saveUpdates(_0x5bd2b8,_0x323aee){return function(_0xd5399f){if(_0xd5399f){return _0xd5399f[_0x35fc('0x25')](_0x5bd2b8)[_0x35fc('0x26')](function(_0x3b4743){return _0x3b4743;});}return null;};}function removeEntity(_0x55e9e7,_0x33f5e8){return function(_0x4c587a){if(_0x4c587a){return _0x4c587a['destroy']()[_0x35fc('0x26')](function(){var _0x5a93df=_0x4c587a[_0x35fc('0x27')]({'plain':!![]});var _0x51cfec=_0x35fc('0x28');return db['UserProfileResource'][_0x35fc('0x29')]({'where':{'type':_0x51cfec,'resourceId':_0x5a93df['id']}})[_0x35fc('0x26')](function(){return _0x4c587a;});})['then'](function(){_0x55e9e7['status'](0xcc)[_0x35fc('0x1a')]();});}};}function handleEntityNotFound(_0x58edb6,_0x274208){return function(_0x1a5d92){if(!_0x1a5d92){_0x58edb6['sendStatus'](0x194);}return _0x1a5d92;};}function handleError(_0x26b7cb,_0x645eac){_0x645eac=_0x645eac||0x1f4;return function(_0x383837){logger[_0x35fc('0x2a')](_0x383837[_0x35fc('0x2b')]);if(_0x383837[_0x35fc('0x2c')]){delete _0x383837[_0x35fc('0x2c')];}_0x26b7cb[_0x35fc('0x19')](_0x645eac)['send'](_0x383837);};}exports[_0x35fc('0x2d')]=function(_0x220931,_0x22af18){var _0x52acc5={},_0xe79f52={},_0x16f067={'count':0x0,'rows':[]};var _0x3822a8=_[_0x35fc('0x2e')](db[_0x35fc('0x2f')][_0x35fc('0x30')],function(_0x222ddb){return{'name':_0x222ddb[_0x35fc('0x31')],'type':_0x222ddb[_0x35fc('0x32')][_0x35fc('0x33')]};});_0xe79f52['model']=_['map'](_0x3822a8,_0x35fc('0x2c'));_0xe79f52['query']=_[_0x35fc('0x34')](_0x220931[_0x35fc('0x35')]);_0xe79f52[_0x35fc('0x36')]=_[_0x35fc('0x37')](_0xe79f52[_0x35fc('0x38')],_0xe79f52[_0x35fc('0x35')]);_0x52acc5['attributes']=_[_0x35fc('0x37')](_0xe79f52[_0x35fc('0x38')],qs[_0x35fc('0x39')](_0x220931[_0x35fc('0x35')][_0x35fc('0x39')]));_0x52acc5[_0x35fc('0x3a')]=_0x52acc5['attributes'][_0x35fc('0x3b')]?_0x52acc5[_0x35fc('0x3a')]:_0xe79f52[_0x35fc('0x38')];if(!_0x220931['query'][_0x35fc('0x3c')]('nolimit')){_0x52acc5[_0x35fc('0x1d')]=qs[_0x35fc('0x1d')](_0x220931[_0x35fc('0x35')][_0x35fc('0x1d')]);_0x52acc5['offset']=qs['offset'](_0x220931['query'][_0x35fc('0x1c')]);}_0x52acc5['order']=qs[_0x35fc('0x3d')](_0x220931['query'][_0x35fc('0x3d')]);_0x52acc5[_0x35fc('0x3e')]=qs[_0x35fc('0x36')](_[_0x35fc('0x3f')](_0x220931[_0x35fc('0x35')],_0xe79f52[_0x35fc('0x36')]),_0x3822a8);if(_0x220931[_0x35fc('0x35')]['filter']){_0x52acc5[_0x35fc('0x3e')]=_[_0x35fc('0x40')](_0x52acc5['where'],{'$or':_[_0x35fc('0x2e')](_0x3822a8,function(_0x1ccc41){if(_0x1ccc41[_0x35fc('0x32')]!==_0x35fc('0x41')){var _0x813866={};_0x813866[_0x1ccc41[_0x35fc('0x2c')]]={'$like':'%'+_0x220931['query'][_0x35fc('0x42')]+'%'};return _0x813866;}})});}_0x52acc5=_[_0x35fc('0x40')]({},_0x52acc5,_0x220931[_0x35fc('0x43')]);var _0x52543b={'where':_0x52acc5[_0x35fc('0x3e')]};return db[_0x35fc('0x2f')]['count'](_0x52543b)[_0x35fc('0x26')](function(_0x280af1){_0x16f067[_0x35fc('0x1f')]=_0x280af1;if(_0x220931[_0x35fc('0x35')][_0x35fc('0x44')]){_0x52acc5[_0x35fc('0x45')]=[{'all':!![]}];}return db[_0x35fc('0x2f')][_0x35fc('0x46')](_0x52acc5);})['then'](function(_0x596e83){_0x16f067[_0x35fc('0x47')]=_0x596e83;return _0x16f067;})[_0x35fc('0x26')](respondWithFilteredResult(_0x22af18,_0x52acc5))['catch'](handleError(_0x22af18,null));};exports['show']=function(_0x4ff202,_0x79677d){var _0x10f98b={'raw':!![],'where':{'id':_0x4ff202[_0x35fc('0x48')]['id']}},_0x4e56ed={};_0x4e56ed[_0x35fc('0x38')]=_[_0x35fc('0x34')](db[_0x35fc('0x2f')]['rawAttributes']);_0x4e56ed['query']=_['keys'](_0x4ff202['query']);_0x4e56ed['filters']=_[_0x35fc('0x37')](_0x4e56ed[_0x35fc('0x38')],_0x4e56ed['query']);_0x10f98b[_0x35fc('0x3a')]=_['intersection'](_0x4e56ed[_0x35fc('0x38')],qs[_0x35fc('0x39')](_0x4ff202[_0x35fc('0x35')][_0x35fc('0x39')]));_0x10f98b[_0x35fc('0x3a')]=_0x10f98b['attributes'][_0x35fc('0x3b')]?_0x10f98b[_0x35fc('0x3a')]:_0x4e56ed['model'];if(_0x4ff202[_0x35fc('0x35')][_0x35fc('0x44')]){_0x10f98b[_0x35fc('0x45')]=[{'all':!![]}];}_0x10f98b=_[_0x35fc('0x40')]({},_0x10f98b,_0x4ff202['options']);return db[_0x35fc('0x2f')]['find'](_0x10f98b)['then'](handleEntityNotFound(_0x79677d,null))[_0x35fc('0x26')](respondWithResult(_0x79677d,null))[_0x35fc('0x49')](handleError(_0x79677d,null));};exports[_0x35fc('0x4a')]=function(_0xca8aef,_0xf2ca20){return db[_0x35fc('0x2f')][_0x35fc('0x4a')](_0xca8aef[_0x35fc('0x4b')],{})['then'](function(_0x3e2961){var _0x91d7c0=_0xca8aef[_0x35fc('0x4c')][_0x35fc('0x27')]({'plain':!![]});if(!_0x91d7c0)throw new Error(_0x35fc('0x4d'));if(_0x91d7c0[_0x35fc('0x4e')]===_0x35fc('0x4c')){var _0x347a4a=_0x3e2961[_0x35fc('0x27')]({'plain':!![]});var _0xe6eb6a=_0x35fc('0x4f');return db[_0x35fc('0x50')][_0x35fc('0x51')]({'where':{'name':_0xe6eb6a,'userProfileId':_0x91d7c0[_0x35fc('0x52')]},'raw':!![]})['then'](function(_0x553ed6){if(_0x553ed6&&_0x553ed6[_0x35fc('0x53')]===0x0){return db[_0x35fc('0x54')][_0x35fc('0x4a')]({'name':_0x347a4a[_0x35fc('0x2c')],'resourceId':_0x347a4a['id'],'type':_0x35fc('0x28'),'sectionId':_0x553ed6['id']},{})[_0x35fc('0x26')](function(){return _0x3e2961;});}else{return _0x3e2961;}})['catch'](function(_0x4f024c){logger[_0x35fc('0x2a')](_0x35fc('0x55'),_0x4f024c);throw _0x4f024c;});}return _0x3e2961;})[_0x35fc('0x26')](respondWithResult(_0xf2ca20,0xc9))[_0x35fc('0x49')](handleError(_0xf2ca20,null));};exports['update']=function(_0x467980,_0x13281f){if(_0x467980['body']['id']){delete _0x467980[_0x35fc('0x4b')]['id'];}return db[_0x35fc('0x2f')]['find']({'where':{'id':_0x467980[_0x35fc('0x48')]['id']}})[_0x35fc('0x26')](handleEntityNotFound(_0x13281f,null))[_0x35fc('0x26')](saveUpdates(_0x467980[_0x35fc('0x4b')],null))['then'](respondWithResult(_0x13281f,null))['catch'](handleError(_0x13281f,null));};exports['destroy']=function(_0x240338,_0x2ea8d6){return db['AnalyticDefaultReport'][_0x35fc('0x51')]({'where':{'id':_0x240338[_0x35fc('0x48')]['id']}})[_0x35fc('0x26')](handleEntityNotFound(_0x2ea8d6,null))[_0x35fc('0x26')](removeEntity(_0x2ea8d6,null))[_0x35fc('0x49')](handleError(_0x2ea8d6,null));};exports['preview']=function(_0x2d9d45,_0x757aa6){var _0x39d470=0xa;var _0x509e77=[_0x35fc('0x56'),_0x35fc('0x57'),'right_join',_0x35fc('0x58')];var _0x164c7b={'SUM':_0x35fc('0x59'),'COUNT':_0x35fc('0x5a'),'COUNT DISTINCT':_0x35fc('0x5b'),'MAX':_0x35fc('0x5c'),'MIN':_0x35fc('0x5d'),'AVG':_0x35fc('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':_0x35fc('0x60')};var _0x303927={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x35fc('0x61'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x23b54f=function(_0xb1c68a){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xb1c68a);};var _0x5353ea=function(_0x4faef4){if(!_0x4faef4||!_0x4faef4['rules'][_0x35fc('0x3b')]){return'';}for(var _0x44250b='(',_0xd470e8=0x0;_0xd470e8<_0x4faef4[_0x35fc('0x65')]['length'];_0xd470e8+=0x1){_0xd470e8>0x0&&(_0x44250b+='\x20'+_0x4faef4[_0x35fc('0x66')]+'\x20');_0x44250b+=_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x67')]?_0x5353ea(_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x67')]):_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x68')]+'\x20'+_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x69')]+(_0x23b54f(_0x4faef4['rules'][_0xd470e8][_0x35fc('0x69')])?'\x20'+_0x4faef4['rules'][_0xd470e8][_0x35fc('0x6a')]:'');}return _0x44250b+')';};var _0x9029e3={'where':{'id':_0x2d9d45['params']['id']}},_0x2ac8e1,_0x2bc76c,_0x4bdde7,_0x465c14,_0x4af592;_0x9029e3=_['merge']({},_0x9029e3,_0x2d9d45[_0x35fc('0x43')]);return db['AnalyticDefaultReport'][_0x35fc('0x51')](_0x9029e3)['then'](function(_0x11717){if(_0x11717){_0x2ac8e1=_0x11717;return _0x11717['getFields']();}return null;})[_0x35fc('0x26')](function(_0x455b84){if(_0x455b84){if(!_0x455b84[_0x35fc('0x3b')]){throw new db[(_0x35fc('0x6b'))]['ValidationErrorItem'](_0x35fc('0x6c'),0x193);}_0x2bc76c=_0x455b84;return db[_0x35fc('0x6d')][_0x35fc('0x46')]({'raw':!![]});}return null;})['then'](function(_0x3aa7fa){if(_0x3aa7fa){_0x4bdde7=_[_0x35fc('0x6e')](_0x3aa7fa,'id');var _0x37764b;var _0x3c1b56=squel[_0x35fc('0x6f')]();_0x3c1b56[_0x35fc('0x70')](_0x2ac8e1[_0x35fc('0x71')]);for(var _0x4464d5=0x0;_0x4464d5<_0x2bc76c['length'];_0x4464d5+=0x1){_0x37764b=_0x2bc76c[_0x4464d5][_0x35fc('0x72')]?_0x4bdde7[_0x2bc76c[_0x4464d5][_0x35fc('0x72')]][_0x35fc('0x73')]:_0x2bc76c[_0x4464d5]['field'];_0x37764b=_0x2bc76c[_0x4464d5][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0x164c7b[_0x2bc76c[_0x4464d5]['function']],'%s',_0x37764b):_0x37764b;_0x37764b=_0x2bc76c[_0x4464d5]['format']?_[_0x35fc('0x75')](_0x303927[_0x2bc76c[_0x4464d5]['format']],'%s',_0x37764b):_0x37764b;if(_0x2bc76c[_0x4464d5][_0x35fc('0x76')]){_0x3c1b56[_0x35fc('0x67')](_0x37764b);}_0x2bc76c[_0x4464d5][_0x35fc('0x77')]&&_0x3c1b56[_0x35fc('0x78')](_0x37764b,_0x2bc76c[_0x4464d5][_0x35fc('0x77')]===_0x35fc('0x79')?![]:!![]);_0x3c1b56[_0x35fc('0x68')](_0x37764b,_0x2bc76c[_0x4464d5][_0x35fc('0x7a')]||_0x37764b);}if(_0x2ac8e1[_0x35fc('0x7b')]){_0x2ac8e1[_0x35fc('0x7b')]=JSON[_0x35fc('0x7c')](_0x2ac8e1[_0x35fc('0x7b')]);for(var _0x29f2b9=0x0;_0x29f2b9<_0x2ac8e1[_0x35fc('0x7b')][_0x35fc('0x3b')];_0x29f2b9+=0x1){if(_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')]&&_[_0x35fc('0x62')](_0x509e77,_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')])&&_0x2ac8e1['joins'][_0x29f2b9][_0x35fc('0x7d')]&&_0x2ac8e1['joins'][_0x29f2b9][_0x35fc('0x7e')]&&_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7f')]){_0x3c1b56[_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')]](_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7e')],null,util[_0x35fc('0x80')](_0x35fc('0x81'),_0x2ac8e1[_0x35fc('0x71')],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9]['parentKey'],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7e')],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7f')]));}}}if(_0x2ac8e1[_0x35fc('0x82')]){_0x2ac8e1[_0x35fc('0x82')]=JSON['parse'](_0x2ac8e1[_0x35fc('0x82')]);_0x3c1b56[_0x35fc('0x3e')](_0x5353ea(_0x2ac8e1[_0x35fc('0x82')][_0x35fc('0x67')]));}_0x4af592=_0x3c1b56[_0x35fc('0x83')]();_0x3c1b56[_0x35fc('0x1d')](_0x39d470);_0x3c1b56[_0x35fc('0x1c')](0x0);logger[_0x35fc('0x84')](_0x35fc('0x85'),_0x3c1b56['toString']());return dbH[_0x35fc('0x86')]['query'](_0x3c1b56[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')]['QueryTypes'][_0x35fc('0x88')]});}})[_0x35fc('0x26')](respondWithResult(_0x757aa6,null))[_0x35fc('0x49')](handleError(_0x757aa6,null));};function runReport(_0x4274d6,_0x4026cc,_0x1a765f){var _0x42f87e=_0x4026cc[_0x35fc('0x2c')];var _0x25ee61=0xa;var _0x5806bf=['join','left_join','right_join',_0x35fc('0x58')];var _0x23cf84={'SUM':_0x35fc('0x59'),'COUNT':_0x35fc('0x5a'),'COUNT DISTINCT':_0x35fc('0x5b'),'MAX':'MAX(%s)','MIN':_0x35fc('0x5d'),'AVG':_0x35fc('0x5e'),'GROUP_CONCAT':_0x35fc('0x89'),'GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x15e936={'SEC_TO_TIME':_0x35fc('0x8a'),'DATE':_0x35fc('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x35fc('0x8b'),'UNIX_TIMESTAMP':_0x35fc('0x8c')};var _0x319033=function(_0x9fe765){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x8d'),'IS\x20NOT\x20EMPTY'],_0x9fe765);};var _0x2faff7=function(_0xa2c5f8){if(!_0xa2c5f8||!_0xa2c5f8[_0x35fc('0x65')][_0x35fc('0x3b')]){return'';}for(var _0x221c5b='(',_0x1fcd36=0x0;_0x1fcd36<_0xa2c5f8['rules'][_0x35fc('0x3b')];_0x1fcd36+=0x1){_0x1fcd36>0x0&&(_0x221c5b+='\x20'+_0xa2c5f8['operator']+'\x20');_0x221c5b+=_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x67')]?_0x2faff7(_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x67')]):_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x68')]+'\x20'+_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x69')]+(_0x319033(_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x69')])?'\x20'+_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x6a')]:'');}return _0x221c5b+')';};var _0x5abdf9={'where':{'id':_0x4274d6['id']}},_0x5512f6,_0x487cb5,_0x23b261,_0x4c742c,_0x2fae26;_0x5abdf9=_[_0x35fc('0x40')]({},_0x5abdf9,_0x1a765f);return db[_0x35fc('0x2f')][_0x35fc('0x51')](_0x5abdf9)['then'](function(_0x28e80d){if(_0x28e80d){_0x5512f6=_0x28e80d;return _0x28e80d[_0x35fc('0x8e')]();}return null;})[_0x35fc('0x26')](function(_0x47c507){if(_0x47c507){if(!_0x47c507[_0x35fc('0x3b')]){throw new db[(_0x35fc('0x6b'))][(_0x35fc('0x8f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x487cb5=_0x47c507;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x35fc('0x26')](function(_0x2edb1b){if(_0x2edb1b){_0x23b261=_[_0x35fc('0x6e')](_0x2edb1b,'id');var _0x3858a9;var _0x4859be=squel[_0x35fc('0x6f')]();_0x4859be[_0x35fc('0x70')](_0x5512f6['table']);for(var _0x5849a0=0x0;_0x5849a0<_0x487cb5[_0x35fc('0x3b')];_0x5849a0+=0x1){_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x72')]?_0x23b261[_0x487cb5[_0x5849a0][_0x35fc('0x72')]]['metric']:_0x487cb5[_0x5849a0]['field'];_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0x23cf84[_0x487cb5[_0x5849a0]['function']],'%s',_0x3858a9):_0x3858a9;_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x80')]?_[_0x35fc('0x75')](_0x15e936[_0x487cb5[_0x5849a0][_0x35fc('0x80')]],'%s',_0x3858a9):_0x3858a9;if(_0x487cb5[_0x5849a0]['groupBy']){_0x4859be[_0x35fc('0x67')](_0x3858a9);}_0x487cb5[_0x5849a0][_0x35fc('0x77')]&&_0x4859be[_0x35fc('0x78')](_0x3858a9,_0x487cb5[_0x5849a0][_0x35fc('0x77')]==='DESC'?![]:!![]);_0x4859be[_0x35fc('0x68')](_0x3858a9,_0x487cb5[_0x5849a0][_0x35fc('0x7a')]||_0x3858a9);}if(_0x5512f6[_0x35fc('0x7b')]){_0x5512f6['joins']=JSON[_0x35fc('0x7c')](_0x5512f6[_0x35fc('0x7b')]);for(var _0x425f72=0x0;_0x425f72<_0x5512f6['joins'][_0x35fc('0x3b')];_0x425f72+=0x1){if(_0x5512f6[_0x35fc('0x7b')][_0x425f72]['type']&&_[_0x35fc('0x62')](_0x5806bf,_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x32')])&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7d')]&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')]&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7f')]){_0x4859be[_0x5512f6['joins'][_0x425f72][_0x35fc('0x32')]](_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')],null,util[_0x35fc('0x80')]('%s.%s\x20=\x20%s.%s',_0x5512f6[_0x35fc('0x71')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7d')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7f')]));}}}if(_0x5512f6[_0x35fc('0x82')]){_0x5512f6['conditions']=JSON['parse'](_0x5512f6[_0x35fc('0x82')]);_0x4859be[_0x35fc('0x3e')](_0x2faff7(_0x5512f6[_0x35fc('0x82')]['group']));}_0x2fae26=_0x4859be[_0x35fc('0x83')]();_0x4859be[_0x35fc('0x1d')](_0x25ee61);_0x4859be[_0x35fc('0x1c')](0x0);return;}})[_0x35fc('0x26')](function(){if(_0x4026cc['output']==='web'){return null;}var _0x379650=_['merge'](_0x4026cc,{'name':_0x4026cc[_0x35fc('0x90')]||_0x4026cc[_0x35fc('0x2c')]||_0x5512f6['name'],'basename':_0x42f87e,'savename':util['format'](_0x35fc('0x91'),_0x4026cc[_0x35fc('0x2c')]||_0x5512f6[_0x35fc('0x2c')],require('randomstring')[_0x35fc('0x92')](0x4),_0x4026cc[_0x35fc('0x93')]||_0x35fc('0x94')),'reportId':_0x5512f6['id'],'reportType':'default'});return db[_0x35fc('0x95')][_0x35fc('0x4a')](_0x379650,{'raw':!![]});})[_0x35fc('0x26')](function(_0x328e90){if(_0x5512f6['table']===_0x35fc('0x96')){_0x2fae26[_0x35fc('0x3e')](_0x5512f6[_0x35fc('0x71')]+_0x35fc('0x97'),_0x4026cc[_0x35fc('0x98')],_0x4026cc[_0x35fc('0x99')]);}else{_0x2fae26['where'](_0x5512f6[_0x35fc('0x71')]+_0x35fc('0x9a'),_0x4026cc['startDate'],_0x4026cc[_0x35fc('0x99')]);}if(_0x328e90){logger[_0x35fc('0x9b')]('Run\x20Query:',_0x2fae26[_0x35fc('0x87')]());require(_0x35fc('0x9c'))[_0x35fc('0x9d')](path[_0x35fc('0x56')](__dirname,_0x35fc('0x9e'),_0x328e90['output']),[_0x328e90['id'],_0x2fae26[_0x35fc('0x87')](),path[_0x35fc('0x56')](__dirname,_0x35fc('0x9f'),_0x328e90['savename']),_0x42f87e]);return _0x328e90;}else{var _0x1224cd=squel['select']();_0x1224cd['from']('('+_0x2fae26[_0x35fc('0x87')]()+')',_0x35fc('0xa0'));_0x1224cd[_0x35fc('0x68')](_0x35fc('0xa1'),_0x35fc('0x1f'));_0x2fae26['limit'](_0x4026cc[_0x35fc('0x1d')]||_0x25ee61);_0x2fae26[_0x35fc('0x1c')](_0x4026cc[_0x35fc('0x1c')]||0x0);return dbH['sequelize'][_0x35fc('0x35')](_0x1224cd[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')][_0x35fc('0xa2')][_0x35fc('0x88')]})['then'](function(_0x1a2d73){if(!_0x1a2d73[_0x35fc('0x3b')]){_0x4c742c=0x0;}else{_0x4c742c=_0x1a2d73[0x0]['count']||0x0;}return dbH['sequelize'][_0x35fc('0x35')](_0x2fae26[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')][_0x35fc('0xa2')][_0x35fc('0x88')]});})[_0x35fc('0x26')](function(_0x8c80ca){return{'rows':_0x8c80ca||[],'count':_0x4c742c};});}});}exports['run']=function(_0x5dc286,_0x146ce1){return runReport(_0x5dc286[_0x35fc('0x48')],_0x5dc286[_0x35fc('0x35')],_0x5dc286[_0x35fc('0x43')])[_0x35fc('0x26')](respondWithResult(_0x146ce1,null))['catch'](handleError(_0x146ce1,null));};exports['runReport']=runReport;exports[_0x35fc('0x35')]=function(_0x2451f2,_0x3fff79){var _0x1c6ce9=0xa;var _0x4b2079=['join',_0x35fc('0x57'),_0x35fc('0xa3'),_0x35fc('0x58')];var _0xd46d64={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x35fc('0x5b'),'MAX':_0x35fc('0x5c'),'MIN':'MIN(%s)','AVG':_0x35fc('0x5e'),'GROUP_CONCAT':_0x35fc('0x89'),'GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':_0x35fc('0x60')};var _0x274337={'SEC_TO_TIME':_0x35fc('0x8a'),'DATE':_0x35fc('0x61'),'HOUR':_0x35fc('0xa4'),'ROUND':_0x35fc('0x8b'),'UNIX_TIMESTAMP':_0x35fc('0x8c')};var _0x19ae76=function(_0x366a3b){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x8d'),'IS\x20NOT\x20EMPTY'],_0x366a3b);};var _0x345026=function(_0x553f7d){if(!_0x553f7d||!_0x553f7d[_0x35fc('0x65')]['length']){return'';}for(var _0x5aa072='(',_0x3c96ef=0x0;_0x3c96ef<_0x553f7d[_0x35fc('0x65')][_0x35fc('0x3b')];_0x3c96ef+=0x1){_0x3c96ef>0x0&&(_0x5aa072+='\x20'+_0x553f7d['operator']+'\x20');_0x5aa072+=_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x67')]?_0x345026(_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x67')]):_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x68')]+'\x20'+_0x553f7d['rules'][_0x3c96ef]['condition']+(_0x19ae76(_0x553f7d[_0x35fc('0x65')][_0x3c96ef]['condition'])?'\x20'+_0x553f7d['rules'][_0x3c96ef][_0x35fc('0x6a')]:'');}return _0x5aa072+')';};var _0x48b826={'where':{'id':_0x2451f2[_0x35fc('0x48')]['id']}},_0x556f9a,_0x5ae83f,_0x450769,_0x5d461c,_0x355154;_0x48b826=_[_0x35fc('0x40')]({},_0x48b826,_0x2451f2[_0x35fc('0x43')]);return db[_0x35fc('0x2f')][_0x35fc('0x51')](_0x48b826)['then'](function(_0x522ff2){if(_0x522ff2){_0x556f9a=_0x522ff2;return _0x522ff2[_0x35fc('0x8e')]();}return null;})['then'](function(_0x233c94){if(_0x233c94){if(!_0x233c94[_0x35fc('0x3b')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5ae83f=_0x233c94;return db[_0x35fc('0x6d')][_0x35fc('0x46')]({'raw':!![]});}return null;})[_0x35fc('0x26')](function(_0x135e18){if(_0x135e18){_0x450769=_[_0x35fc('0x6e')](_0x135e18,'id');var _0x28525f;var _0x9116b1=squel[_0x35fc('0x6f')]();_0x9116b1['from'](_0x556f9a['table']);for(var _0x5cefdb=0x0;_0x5cefdb<_0x5ae83f['length'];_0x5cefdb+=0x1){_0x28525f=_0x5ae83f[_0x5cefdb][_0x35fc('0x72')]?_0x450769[_0x5ae83f[_0x5cefdb]['MetricId']][_0x35fc('0x73')]:_0x5ae83f[_0x5cefdb]['field'];_0x28525f=_0x5ae83f[_0x5cefdb][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0xd46d64[_0x5ae83f[_0x5cefdb]['function']],'%s',_0x28525f):_0x28525f;_0x28525f=_0x5ae83f[_0x5cefdb]['format']?_[_0x35fc('0x75')](_0x274337[_0x5ae83f[_0x5cefdb][_0x35fc('0x80')]],'%s',_0x28525f):_0x28525f;if(_0x5ae83f[_0x5cefdb][_0x35fc('0x76')]){_0x9116b1[_0x35fc('0x67')](_0x28525f);}_0x5ae83f[_0x5cefdb][_0x35fc('0x77')]&&_0x9116b1['order'](_0x28525f,_0x5ae83f[_0x5cefdb]['orderBy']===_0x35fc('0x79')?![]:!![]);_0x9116b1['field'](_0x28525f,_0x5ae83f[_0x5cefdb][_0x35fc('0x7a')]||_0x28525f);}if(_0x556f9a['joins']){_0x556f9a[_0x35fc('0x7b')]=JSON[_0x35fc('0x7c')](_0x556f9a[_0x35fc('0x7b')]);for(var _0x10e30e=0x0;_0x10e30e<_0x556f9a['joins'][_0x35fc('0x3b')];_0x10e30e+=0x1){if(_0x556f9a['joins'][_0x10e30e][_0x35fc('0x32')]&&_['includes'](_0x4b2079,_0x556f9a['joins'][_0x10e30e][_0x35fc('0x32')])&&_0x556f9a['joins'][_0x10e30e][_0x35fc('0x7d')]&&_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')]&&_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7f')]){_0x9116b1[_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x32')]](_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')],null,util['format'](_0x35fc('0x81'),_0x556f9a[_0x35fc('0x71')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7d')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7f')]));}}}if(_0x556f9a['conditions']){_0x556f9a['conditions']=JSON['parse'](_0x556f9a['conditions']);_0x9116b1['where'](_0x345026(_0x556f9a[_0x35fc('0x82')][_0x35fc('0x67')]));}_0x355154=_0x9116b1[_0x35fc('0x83')]();_0x9116b1[_0x35fc('0x1d')](_0x1c6ce9);_0x9116b1[_0x35fc('0x1c')](0x0);logger['debug'](_0x35fc('0x85'),_0x9116b1[_0x35fc('0x87')]());return dbH[_0x35fc('0x86')][_0x35fc('0x35')](_0x9116b1[_0x35fc('0x87')](),{'type':dbH['sequelize'][_0x35fc('0xa2')][_0x35fc('0x88')]});}})[_0x35fc('0x26')](function(){return{'sql':_0x355154['toString']()};})[_0x35fc('0x26')](respondWithResult(_0x3fff79,null))[_0x35fc('0x49')](handleError(_0x3fff79,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index f262dd3..21ea3c8 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 _0x7403=['../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2a2818,_0x14f644){var _0x237971=function(_0x90bec3){while(--_0x90bec3){_0x2a2818['push'](_0x2a2818['shift']());}};_0x237971(++_0x14f644);}(_0x7403,0x88));var _0x3740=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7403[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3740('0x0'));var logger=require(_0x3740('0x1'))(_0x3740('0x2'));var moment=require(_0x3740('0x3'));var BPromise=require('bluebird');var rp=require(_0x3740('0x4'));var fs=require('fs');var path=require(_0x3740('0x5'));var rimraf=require(_0x3740('0x6'));var config=require(_0x3740('0x7'));var attributes=require(_0x3740('0x8'));module[_0x3740('0x9')]=function(_0x5d394b,_0x3f6ae7){return _0x5d394b[_0x3740('0xa')](_0x3740('0xb'),attributes,{'tableName':_0x3740('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5348=['../../config/logger','api','moment','path','rimraf','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash'];(function(_0x3ef8f7,_0x35359a){var _0x3b097e=function(_0x189c92){while(--_0x189c92){_0x3ef8f7['push'](_0x3ef8f7['shift']());}};_0x3b097e(++_0x35359a);}(_0x5348,0x13f));var _0x8534=function(_0x2a050e,_0x31d347){_0x2a050e=_0x2a050e-0x0;var _0x160d80=_0x5348[_0x2a050e];return _0x160d80;};'use strict';var _=require(_0x8534('0x0'));var util=require('util');var logger=require(_0x8534('0x1'))(_0x8534('0x2'));var moment=require(_0x8534('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8534('0x4'));var rimraf=require(_0x8534('0x5'));var config=require('../../config/environment');var attributes=require(_0x8534('0x6'));module[_0x8534('0x7')]=function(_0x372f41,_0x38de8f){return _0x372f41[_0x8534('0x8')]('AnalyticDefaultReport',attributes,{'tableName':_0x8534('0x9'),'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 7f46c52..f217c60 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 _0xf265=['request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x2558f3,_0x42ff6b){var _0x323372=function(_0x198ede){while(--_0x198ede){_0x2558f3['push'](_0x2558f3['shift']());}};_0x323372(++_0x42ff6b);}(_0xf265,0x171));var _0x5f26=function(_0x5b2c0b,_0x12fa22){_0x5b2c0b=_0x5b2c0b-0x0;var _0x300219=_0xf265[_0x5b2c0b];return _0x300219;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5f26('0x0'));var BPromise=require(_0x5f26('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f26('0x2'));var db=require(_0x5f26('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f26('0x4'))(_0x5f26('0x5'));var config=require(_0x5f26('0x6'));var jayson=require(_0x5f26('0x7'));var client=jayson['client'][_0x5f26('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13c712,_0xf2621a,_0x56999a){return new BPromise(function(_0x32c123,_0xfce51){return client['request'](_0x13c712,_0x56999a)[_0x5f26('0x9')](function(_0xf0c20b){logger['info'](_0x5f26('0xa'),_0xf2621a,_0x5f26('0xb'));logger[_0x5f26('0xc')](_0x5f26('0xd'),_0xf2621a,_0x5f26('0xb'),JSON['stringify'](_0xf0c20b));if(_0xf0c20b['error']){if(_0xf0c20b['error'][_0x5f26('0xe')]===0x1f4){logger[_0x5f26('0xf')](_0x5f26('0xa'),_0xf2621a,_0xf0c20b[_0x5f26('0xf')][_0x5f26('0x10')]);return _0xfce51(_0xf0c20b[_0x5f26('0xf')]['message']);}logger[_0x5f26('0xf')](_0x5f26('0xa'),_0xf2621a,_0xf0c20b[_0x5f26('0xf')][_0x5f26('0x10')]);return _0x32c123(_0xf0c20b[_0x5f26('0xf')]['message']);}else{logger[_0x5f26('0x11')](_0x5f26('0xa'),_0xf2621a,'request\x20sent');_0x32c123(_0xf0c20b[_0x5f26('0x12')][_0x5f26('0x10')]);}})[_0x5f26('0x13')](function(_0x427964){logger[_0x5f26('0xf')](_0x5f26('0xa'),_0xf2621a,_0x427964);_0xfce51(_0x427964);});});} \ No newline at end of file +var _0x3638=['bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x53212a,_0x3e81bd){var _0xecfd59=function(_0x1ddd64){while(--_0x1ddd64){_0x53212a['push'](_0x53212a['shift']());}};_0xecfd59(++_0x3e81bd);}(_0x3638,0x1b6));var _0x8363=function(_0x990a0d,_0x460bb0){_0x990a0d=_0x990a0d-0x0;var _0x19e4d0=_0x3638[_0x990a0d];return _0x19e4d0;};'use strict';var _=require(_0x8363('0x0'));var util=require('util');var moment=require(_0x8363('0x1'));var BPromise=require(_0x8363('0x2'));var rs=require(_0x8363('0x3'));var fs=require('fs');var Redis=require(_0x8363('0x4'));var db=require(_0x8363('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8363('0x6'));var config=require('../../config/environment');var jayson=require(_0x8363('0x7'));var client=jayson[_0x8363('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25adc6,_0x3a9991,_0x1fbc1f){return new BPromise(function(_0x3f2c2d,_0x33428d){return client[_0x8363('0x9')](_0x25adc6,_0x1fbc1f)['then'](function(_0x256fad){logger[_0x8363('0xa')](_0x8363('0xb'),_0x3a9991,_0x8363('0xc'));logger[_0x8363('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x3a9991,'request\x20sent',JSON[_0x8363('0xe')](_0x256fad));if(_0x256fad[_0x8363('0xf')]){if(_0x256fad[_0x8363('0xf')][_0x8363('0x10')]===0x1f4){logger[_0x8363('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3a9991,_0x256fad[_0x8363('0xf')]['message']);return _0x33428d(_0x256fad['error'][_0x8363('0x11')]);}logger[_0x8363('0xf')](_0x8363('0xb'),_0x3a9991,_0x256fad[_0x8363('0xf')][_0x8363('0x11')]);return _0x3f2c2d(_0x256fad[_0x8363('0xf')][_0x8363('0x11')]);}else{logger[_0x8363('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3a9991,_0x8363('0xc'));_0x3f2c2d(_0x256fad[_0x8363('0x12')][_0x8363('0x11')]);}})[_0x8363('0x13')](function(_0x1be8d0){logger[_0x8363('0xf')](_0x8363('0xb'),_0x3a9991,_0x1be8d0);_0x33428d(_0x1be8d0);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index dfab5e6..fdbe194 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 _0x1b21=['/:id/preview','preview','/:id/run','run','query','post','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x1b21,0x14e));var _0x11b2=function(_0x200f0a,_0x123025){_0x200f0a=_0x200f0a-0x0;var _0x45f574=_0x1b21[_0x200f0a];return _0x45f574;};'use strict';var multer=require(_0x11b2('0x0'));var util=require('util');var path=require(_0x11b2('0x1'));var timeout=require('connect-timeout');var express=require(_0x11b2('0x2'));var router=express[_0x11b2('0x3')]();var fs_extra=require(_0x11b2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x11b2('0x5'));var config=require('../../config/environment');var controller=require(_0x11b2('0x6'));router['get']('/',auth[_0x11b2('0x7')](),controller[_0x11b2('0x8')]);router[_0x11b2('0x9')](_0x11b2('0xa'),auth[_0x11b2('0x7')](),controller['show']);router[_0x11b2('0x9')](_0x11b2('0xb'),auth[_0x11b2('0x7')](),controller[_0x11b2('0xc')]);router['get'](_0x11b2('0xd'),auth[_0x11b2('0x7')](),controller[_0x11b2('0xe')]);router['get']('/:id/query',auth['isAuthenticated'](),controller[_0x11b2('0xf')]);router[_0x11b2('0x10')]('/',auth[_0x11b2('0x7')](),controller[_0x11b2('0x11')]);router[_0x11b2('0x12')](_0x11b2('0xa'),auth[_0x11b2('0x7')](),controller[_0x11b2('0x13')]);router[_0x11b2('0x14')]('/:id',auth[_0x11b2('0x7')](),controller[_0x11b2('0x15')]);module[_0x11b2('0x16')]=router; \ No newline at end of file +var _0x283b=['index','get','show','/:id/preview','isAuthenticated','preview','/:id/run','run','/:id/query','query','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2c4ef1,_0x1efcc9){var _0x55e3a4=function(_0xbf6330){while(--_0xbf6330){_0x2c4ef1['push'](_0x2c4ef1['shift']());}};_0x55e3a4(++_0x1efcc9);}(_0x283b,0x188));var _0xb283=function(_0x15695b,_0x5d307d){_0x15695b=_0x15695b-0x0;var _0x591375=_0x283b[_0x15695b];return _0x591375;};'use strict';var multer=require(_0xb283('0x0'));var util=require(_0xb283('0x1'));var path=require(_0xb283('0x2'));var timeout=require(_0xb283('0x3'));var express=require(_0xb283('0x4'));var router=express[_0xb283('0x5')]();var fs_extra=require(_0xb283('0x6'));var auth=require(_0xb283('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb283('0x8')]);router[_0xb283('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xb283('0xa')]);router[_0xb283('0x9')](_0xb283('0xb'),auth[_0xb283('0xc')](),controller[_0xb283('0xd')]);router[_0xb283('0x9')](_0xb283('0xe'),auth[_0xb283('0xc')](),controller[_0xb283('0xf')]);router[_0xb283('0x9')](_0xb283('0x10'),auth[_0xb283('0xc')](),controller[_0xb283('0x11')]);router[_0xb283('0x12')]('/',auth[_0xb283('0xc')](),controller[_0xb283('0x13')]);router[_0xb283('0x14')](_0xb283('0x15'),auth[_0xb283('0xc')](),controller['update']);router[_0xb283('0x16')]('/:id',auth[_0xb283('0xc')](),controller[_0xb283('0x17')]);module[_0xb283('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 559a087..92f5818 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 _0xee70=['scheduled','INTEGER','UNSIGNED','exports','STRING','ENUM','pdf','csv','DATE','manual'];(function(_0xfacfc5,_0x27dc2d){var _0x4f2f7c=function(_0x9ddeb4){while(--_0x9ddeb4){_0xfacfc5['push'](_0xfacfc5['shift']());}};_0x4f2f7c(++_0x27dc2d);}(_0xee70,0xc1));var _0x0ee7=function(_0x8a5fcd,_0x545f24){_0x8a5fcd=_0x8a5fcd-0x0;var _0x4ffdc8=_0xee70[_0x8a5fcd];return _0x4ffdc8;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x0ee7('0x0')]={'name':{'type':Sequelize[_0x0ee7('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x0ee7('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x0ee7('0x2')]('csv',_0x0ee7('0x3'),'xlsx'),'allowNull':![],'defaultValue':_0x0ee7('0x4')},'savename':{'type':Sequelize[_0x0ee7('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x0ee7('0x5')]},'endDate':{'type':Sequelize[_0x0ee7('0x5')]},'status':{'type':Sequelize[_0x0ee7('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x0ee7('0x6'),_0x0ee7('0x7')),'allowNull':![],'defaultValue':_0x0ee7('0x6')},'reportId':{'type':Sequelize[_0x0ee7('0x8')](0xb)[_0x0ee7('0x9')]},'reportType':{'type':Sequelize[_0x0ee7('0x1')]}}; \ No newline at end of file +var _0xa928=['manual','scheduled','INTEGER','UNSIGNED','sequelize','STRING','ENUM','pdf','xlsx','csv','DATE','Loading'];(function(_0x5b8945,_0x353c7d){var _0x42dbed=function(_0x334163){while(--_0x334163){_0x5b8945['push'](_0x5b8945['shift']());}};_0x42dbed(++_0x353c7d);}(_0xa928,0xf4));var _0x8a92=function(_0x428270,_0x386879){_0x428270=_0x428270-0x0;var _0x5de082=_0xa928[_0x428270];return _0x5de082;};'use strict';var Sequelize=require(_0x8a92('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x8a92('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x8a92('0x2')]('csv',_0x8a92('0x3'),_0x8a92('0x4')),'allowNull':![],'defaultValue':_0x8a92('0x5')},'savename':{'type':Sequelize[_0x8a92('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8a92('0x6')]},'endDate':{'type':Sequelize[_0x8a92('0x6')]},'status':{'type':Sequelize[_0x8a92('0x1')],'defaultValue':_0x8a92('0x7')},'type':{'type':Sequelize[_0x8a92('0x2')](_0x8a92('0x8'),_0x8a92('0x9')),'allowNull':![],'defaultValue':_0x8a92('0x8')},'reportId':{'type':Sequelize[_0x8a92('0xa')](0xb)[_0x8a92('0xb')]},'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 939ec1a..87f0b14 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 _0xce02=['attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','savename','output','existsSync','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','undefined','limit','count','offset','Content-Range','json','reject','update','then','destroy','get','ExtractedReports','UserProfileResource','end','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields'];(function(_0x29a347,_0x592ca6){var _0x20093a=function(_0x8c65cb){while(--_0x8c65cb){_0x29a347['push'](_0x29a347['shift']());}};_0x20093a(++_0x592ca6);}(_0xce02,0x82));var _0x2ce0=function(_0x4551f6,_0x48151b){_0x4551f6=_0x4551f6-0x0;var _0x581dc2=_0xce02[_0x4551f6];return _0x581dc2;};'use strict';var emlformat=require(_0x2ce0('0x0'));var rimraf=require(_0x2ce0('0x1'));var zipdir=require(_0x2ce0('0x2'));var jsonpatch=require(_0x2ce0('0x3'));var rp=require(_0x2ce0('0x4'));var moment=require('moment');var BPromise=require(_0x2ce0('0x5'));var Mustache=require(_0x2ce0('0x6'));var util=require(_0x2ce0('0x7'));var path=require(_0x2ce0('0x8'));var sox=require('sox');var csv=require(_0x2ce0('0x9'));var ejs=require(_0x2ce0('0xa'));var fs=require('fs');var fs_extra=require(_0x2ce0('0xb'));var _=require(_0x2ce0('0xc'));var squel=require('squel');var crypto=require(_0x2ce0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2ce0('0xe'));var toCsv=require(_0x2ce0('0x9'));var querystring=require(_0x2ce0('0xf'));var Papa=require('papaparse');var Redis=require(_0x2ce0('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(_0x2ce0('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x2ce0('0x12'));var licenseUtil=require(_0x2ce0('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a59d8,_0x3c6f17){_0x3c6f17=_0x3c6f17||0xcc;return function(_0x193533){if(_0x193533){return _0x3a59d8[_0x2ce0('0x14')](_0x3c6f17);}return _0x3a59d8[_0x2ce0('0x15')](_0x3c6f17)['end']();};}function respondWithResult(_0x168de1,_0xb1fe8e){_0xb1fe8e=_0xb1fe8e||0xc8;return function(_0x57f213){if(_0x57f213){return _0x168de1[_0x2ce0('0x15')](_0xb1fe8e)['json'](_0x57f213);}};}function respondWithFilteredResult(_0x58985f,_0x1b7be6){return function(_0x3e23f2){if(_0x3e23f2){var _0x5a667=typeof _0x1b7be6['offset']===_0x2ce0('0x16')&&typeof _0x1b7be6[_0x2ce0('0x17')]==='undefined';var _0x25d881=_0x3e23f2[_0x2ce0('0x18')];var _0xe75b4b=_0x5a667?0x0:_0x1b7be6[_0x2ce0('0x19')];var _0x17b62d=_0x5a667?_0x3e23f2['count']:_0x1b7be6[_0x2ce0('0x19')]+_0x1b7be6[_0x2ce0('0x17')];var _0x3102f9;if(_0x17b62d>=_0x25d881){_0x17b62d=_0x25d881;_0x3102f9=0xc8;}else{_0x3102f9=0xce;}_0x58985f[_0x2ce0('0x15')](_0x3102f9);return _0x58985f['set'](_0x2ce0('0x1a'),_0xe75b4b+'-'+_0x17b62d+'/'+_0x25d881)[_0x2ce0('0x1b')](_0x3e23f2);}return null;};}function patchUpdates(_0x54c6ed){return function(_0x23c318){try{jsonpatch['apply'](_0x23c318,_0x54c6ed,!![]);}catch(_0x400e38){return BPromise[_0x2ce0('0x1c')](_0x400e38);}return _0x23c318['save']();};}function saveUpdates(_0x28c5a2,_0x2316ba){return function(_0x3d2910){if(_0x3d2910){return _0x3d2910[_0x2ce0('0x1d')](_0x28c5a2)[_0x2ce0('0x1e')](function(_0x262956){return _0x262956;});}return null;};}function removeEntity(_0xcf663,_0x41a5ed){return function(_0x3febc9){if(_0x3febc9){return _0x3febc9[_0x2ce0('0x1f')]()['then'](function(){var _0x725950=_0x3febc9[_0x2ce0('0x20')]({'plain':!![]});var _0x3cd223=_0x2ce0('0x21');return db[_0x2ce0('0x22')]['destroy']({'where':{'type':_0x3cd223,'resourceId':_0x725950['id']}})['then'](function(){return _0x3febc9;});})[_0x2ce0('0x1e')](function(){_0xcf663[_0x2ce0('0x15')](0xcc)[_0x2ce0('0x23')]();});}};}function handleEntityNotFound(_0x3c126f,_0x3d6fca){return function(_0xaaebd2){if(!_0xaaebd2){_0x3c126f[_0x2ce0('0x14')](0x194);}return _0xaaebd2;};}function handleError(_0x25afe9,_0x3f2919){_0x3f2919=_0x3f2919||0x1f4;return function(_0x15bad0){logger[_0x2ce0('0x24')](_0x15bad0[_0x2ce0('0x25')]);if(_0x15bad0[_0x2ce0('0x26')]){delete _0x15bad0[_0x2ce0('0x26')];}_0x25afe9[_0x2ce0('0x15')](_0x3f2919)[_0x2ce0('0x27')](_0x15bad0);};}exports[_0x2ce0('0x28')]=function(_0x3afd3a,_0x485e7b){var _0x7c6e23={},_0x1712ac={},_0x583580={'count':0x0,'rows':[]};var _0x461c59=_['map'](db[_0x2ce0('0x29')][_0x2ce0('0x2a')],function(_0x3e1ff5){return{'name':_0x3e1ff5[_0x2ce0('0x2b')],'type':_0x3e1ff5[_0x2ce0('0x2c')][_0x2ce0('0x2d')]};});_0x1712ac[_0x2ce0('0x2e')]=_['map'](_0x461c59,_0x2ce0('0x26'));_0x1712ac['query']=_[_0x2ce0('0x2f')](_0x3afd3a[_0x2ce0('0x30')]);_0x1712ac[_0x2ce0('0x31')]=_[_0x2ce0('0x32')](_0x1712ac[_0x2ce0('0x2e')],_0x1712ac[_0x2ce0('0x30')]);_0x7c6e23['attributes']=_[_0x2ce0('0x32')](_0x1712ac[_0x2ce0('0x2e')],qs['fields'](_0x3afd3a[_0x2ce0('0x30')][_0x2ce0('0x33')]));_0x7c6e23[_0x2ce0('0x34')]=_0x7c6e23[_0x2ce0('0x34')][_0x2ce0('0x35')]?_0x7c6e23[_0x2ce0('0x34')]:_0x1712ac[_0x2ce0('0x2e')];if(!_0x3afd3a[_0x2ce0('0x30')][_0x2ce0('0x36')](_0x2ce0('0x37'))){_0x7c6e23['limit']=qs['limit'](_0x3afd3a[_0x2ce0('0x30')][_0x2ce0('0x17')]);_0x7c6e23[_0x2ce0('0x19')]=qs[_0x2ce0('0x19')](_0x3afd3a[_0x2ce0('0x30')][_0x2ce0('0x19')]);}_0x7c6e23[_0x2ce0('0x38')]=qs[_0x2ce0('0x39')](_0x3afd3a['query'][_0x2ce0('0x39')]);_0x7c6e23[_0x2ce0('0x3a')]=qs[_0x2ce0('0x31')](_['pick'](_0x3afd3a['query'],_0x1712ac[_0x2ce0('0x31')]),_0x461c59);if(_0x3afd3a[_0x2ce0('0x30')]['filter']){_0x7c6e23[_0x2ce0('0x3a')]=_['merge'](_0x7c6e23[_0x2ce0('0x3a')],{'$or':_['map'](_0x461c59,function(_0x2d56f3){if(_0x2d56f3[_0x2ce0('0x2c')]!==_0x2ce0('0x3b')){var _0x25385b={};_0x25385b[_0x2d56f3[_0x2ce0('0x26')]]={'$like':'%'+_0x3afd3a[_0x2ce0('0x30')]['filter']+'%'};return _0x25385b;}})});}_0x7c6e23=_[_0x2ce0('0x3c')]({},_0x7c6e23,_0x3afd3a[_0x2ce0('0x3d')]);var _0x26e492={'where':_0x7c6e23[_0x2ce0('0x3a')]};return db[_0x2ce0('0x29')][_0x2ce0('0x18')](_0x26e492)[_0x2ce0('0x1e')](function(_0x4b71be){_0x583580[_0x2ce0('0x18')]=_0x4b71be;if(_0x3afd3a[_0x2ce0('0x30')][_0x2ce0('0x3e')]){_0x7c6e23[_0x2ce0('0x3f')]=[{'all':!![]}];}return db[_0x2ce0('0x29')][_0x2ce0('0x40')](_0x7c6e23);})[_0x2ce0('0x1e')](function(_0x307d40){_0x583580[_0x2ce0('0x41')]=_0x307d40;return _0x583580;})['then'](respondWithFilteredResult(_0x485e7b,_0x7c6e23))[_0x2ce0('0x42')](handleError(_0x485e7b,null));};exports[_0x2ce0('0x43')]=function(_0x333f13,_0x7e7065){var _0x23f9f8={'raw':!![],'where':{'id':_0x333f13[_0x2ce0('0x44')]['id']}},_0x14276d={};_0x14276d['model']=_[_0x2ce0('0x2f')](db[_0x2ce0('0x29')][_0x2ce0('0x2a')]);_0x14276d['query']=_[_0x2ce0('0x2f')](_0x333f13['query']);_0x14276d[_0x2ce0('0x31')]=_['intersection'](_0x14276d[_0x2ce0('0x2e')],_0x14276d[_0x2ce0('0x30')]);_0x23f9f8[_0x2ce0('0x34')]=_['intersection'](_0x14276d[_0x2ce0('0x2e')],qs[_0x2ce0('0x33')](_0x333f13[_0x2ce0('0x30')]['fields']));_0x23f9f8[_0x2ce0('0x34')]=_0x23f9f8[_0x2ce0('0x34')][_0x2ce0('0x35')]?_0x23f9f8[_0x2ce0('0x34')]:_0x14276d[_0x2ce0('0x2e')];if(_0x333f13[_0x2ce0('0x30')][_0x2ce0('0x3e')]){_0x23f9f8[_0x2ce0('0x3f')]=[{'all':!![]}];}_0x23f9f8=_[_0x2ce0('0x3c')]({},_0x23f9f8,_0x333f13[_0x2ce0('0x3d')]);return db[_0x2ce0('0x29')][_0x2ce0('0x45')](_0x23f9f8)[_0x2ce0('0x1e')](handleEntityNotFound(_0x7e7065,null))[_0x2ce0('0x1e')](respondWithResult(_0x7e7065,null))[_0x2ce0('0x42')](handleError(_0x7e7065,null));};exports[_0x2ce0('0x46')]=function(_0x29d913,_0x5eee3d){return db['AnalyticExtractedReport'][_0x2ce0('0x46')](_0x29d913['body'],{})[_0x2ce0('0x1e')](function(_0x5c67bd){var _0x487238=_0x29d913['user']['get']({'plain':!![]});if(!_0x487238)throw new Error(_0x2ce0('0x47'));if(_0x487238[_0x2ce0('0x48')]===_0x2ce0('0x49')){var _0x5c0f70=_0x5c67bd[_0x2ce0('0x20')]({'plain':!![]});var _0x41e46d=_0x2ce0('0x21');return db[_0x2ce0('0x4a')][_0x2ce0('0x45')]({'where':{'name':_0x41e46d,'userProfileId':_0x487238['userProfileId']},'raw':!![]})[_0x2ce0('0x1e')](function(_0x30825f){if(_0x30825f&&_0x30825f[_0x2ce0('0x4b')]===0x0){return db[_0x2ce0('0x22')][_0x2ce0('0x46')]({'name':_0x5c0f70[_0x2ce0('0x26')],'resourceId':_0x5c0f70['id'],'type':_0x30825f['name'],'sectionId':_0x30825f['id']},{})['then'](function(){return _0x5c67bd;});}else{return _0x5c67bd;}})[_0x2ce0('0x42')](function(_0x2fa4d5){logger[_0x2ce0('0x24')](_0x2ce0('0x4c'),_0x2fa4d5);throw _0x2fa4d5;});}return _0x5c67bd;})[_0x2ce0('0x1e')](respondWithResult(_0x5eee3d,0xc9))['catch'](handleError(_0x5eee3d,null));};exports[_0x2ce0('0x1d')]=function(_0x1d089a,_0x11dae2){if(_0x1d089a[_0x2ce0('0x4d')]['id']){delete _0x1d089a['body']['id'];}return db[_0x2ce0('0x29')][_0x2ce0('0x45')]({'where':{'id':_0x1d089a['params']['id']}})[_0x2ce0('0x1e')](handleEntityNotFound(_0x11dae2,null))[_0x2ce0('0x1e')](saveUpdates(_0x1d089a['body'],null))[_0x2ce0('0x1e')](respondWithResult(_0x11dae2,null))[_0x2ce0('0x42')](handleError(_0x11dae2,null));};exports[_0x2ce0('0x1f')]=function(_0x4150a4,_0x4f2d9e){return db['AnalyticExtractedReport'][_0x2ce0('0x45')]({'where':{'id':_0x4150a4['params']['id']}})[_0x2ce0('0x1e')](handleEntityNotFound(_0x4f2d9e,null))[_0x2ce0('0x1e')](removeEntity(_0x4f2d9e,null))['catch'](handleError(_0x4f2d9e,null));};exports[_0x2ce0('0x4e')]=function(_0x25b753,_0x120214,_0x46ccd2){return db[_0x2ce0('0x29')][_0x2ce0('0x45')]({'where':{'id':_0x25b753[_0x2ce0('0x44')]['id']},'attributes':['name','basename',_0x2ce0('0x4f'),_0x2ce0('0x50')],'raw':!![]})[_0x2ce0('0x1e')](handleEntityNotFound(_0x120214,null))['then'](function(_0x434f4f){if(_0x434f4f){if(!fs[_0x2ce0('0x51')](path['join'](config[_0x2ce0('0x52')],_0x2ce0('0x53'),_0x434f4f[_0x2ce0('0x4f')]))){throw new db['Sequelize'][(_0x2ce0('0x54'))](_0x2ce0('0x55'));}if(_0x25b753[_0x2ce0('0x30')][_0x2ce0('0x56')]){return _0x120214[_0x2ce0('0x14')](0xc8);}return _0x120214[_0x2ce0('0x4e')](path[_0x2ce0('0x57')](config[_0x2ce0('0x52')],'server/files/reports',_0x434f4f['savename']),util['format'](_0x2ce0('0x58'),_0x434f4f[_0x2ce0('0x59')]||_0x434f4f[_0x2ce0('0x26')],_0x434f4f['output'][_0x2ce0('0x5a')]()));}})[_0x2ce0('0x42')](handleError(_0x120214,null));}; \ No newline at end of file +var _0x621f=['bluebird','mustache','util','path','to-csv','fs-extra','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','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','update','then','get','ExtractedReports','UserProfileResource','destroy','error','name','send','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','params','download','basename','savename','output','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','join','format','toLowerCase','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x1f0911,_0x313a6e){var _0xb41453=function(_0x3d47f0){while(--_0x3d47f0){_0x1f0911['push'](_0x1f0911['shift']());}};_0xb41453(++_0x313a6e);}(_0x621f,0xb5));var _0xf621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x621f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf621('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf621('0x1'));var jsonpatch=require(_0xf621('0x2'));var rp=require(_0xf621('0x3'));var moment=require(_0xf621('0x4'));var BPromise=require(_0xf621('0x5'));var Mustache=require(_0xf621('0x6'));var util=require(_0xf621('0x7'));var path=require(_0xf621('0x8'));var sox=require('sox');var csv=require(_0xf621('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf621('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf621('0xb'));var jsforce=require(_0xf621('0xc'));var deskjs=require(_0xf621('0xd'));var toCsv=require(_0xf621('0x9'));var querystring=require(_0xf621('0xe'));var Papa=require(_0xf621('0xf'));var Redis=require(_0xf621('0x10'));var authService=require(_0xf621('0x11'));var qs=require(_0xf621('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf621('0x13'));var logger=require(_0xf621('0x14'))(_0xf621('0x15'));var utils=require(_0xf621('0x16'));var config=require(_0xf621('0x17'));var licenseUtil=require(_0xf621('0x18'));var db=require(_0xf621('0x19'))['db'];function respondWithStatusCode(_0x33adbb,_0xe5a030){_0xe5a030=_0xe5a030||0xcc;return function(_0x42d98a){if(_0x42d98a){return _0x33adbb[_0xf621('0x1a')](_0xe5a030);}return _0x33adbb[_0xf621('0x1b')](_0xe5a030)[_0xf621('0x1c')]();};}function respondWithResult(_0x5dc7a3,_0x505080){_0x505080=_0x505080||0xc8;return function(_0x125f71){if(_0x125f71){return _0x5dc7a3[_0xf621('0x1b')](_0x505080)['json'](_0x125f71);}};}function respondWithFilteredResult(_0x3e765e,_0x268f9d){return function(_0x5383b3){if(_0x5383b3){var _0x1cf018=typeof _0x268f9d[_0xf621('0x1d')]==='undefined'&&typeof _0x268f9d[_0xf621('0x1e')]===_0xf621('0x1f');var _0x3658c7=_0x5383b3['count'];var _0x47a134=_0x1cf018?0x0:_0x268f9d[_0xf621('0x1d')];var _0x501c38=_0x1cf018?_0x5383b3[_0xf621('0x20')]:_0x268f9d[_0xf621('0x1d')]+_0x268f9d[_0xf621('0x1e')];var _0x141cbd;if(_0x501c38>=_0x3658c7){_0x501c38=_0x3658c7;_0x141cbd=0xc8;}else{_0x141cbd=0xce;}_0x3e765e[_0xf621('0x1b')](_0x141cbd);return _0x3e765e[_0xf621('0x21')](_0xf621('0x22'),_0x47a134+'-'+_0x501c38+'/'+_0x3658c7)[_0xf621('0x23')](_0x5383b3);}return null;};}function patchUpdates(_0x37dc0a){return function(_0x55987c){try{jsonpatch[_0xf621('0x24')](_0x55987c,_0x37dc0a,!![]);}catch(_0x4d1461){return BPromise['reject'](_0x4d1461);}return _0x55987c['save']();};}function saveUpdates(_0x55de5a,_0x5dcd40){return function(_0xa05b05){if(_0xa05b05){return _0xa05b05[_0xf621('0x25')](_0x55de5a)[_0xf621('0x26')](function(_0x59c3e8){return _0x59c3e8;});}return null;};}function removeEntity(_0x58aa17,_0x40eadf){return function(_0x3a49f3){if(_0x3a49f3){return _0x3a49f3['destroy']()[_0xf621('0x26')](function(){var _0x3e7c9c=_0x3a49f3[_0xf621('0x27')]({'plain':!![]});var _0x2475a2=_0xf621('0x28');return db[_0xf621('0x29')][_0xf621('0x2a')]({'where':{'type':_0x2475a2,'resourceId':_0x3e7c9c['id']}})['then'](function(){return _0x3a49f3;});})[_0xf621('0x26')](function(){_0x58aa17['status'](0xcc)[_0xf621('0x1c')]();});}};}function handleEntityNotFound(_0x557bca,_0x41f33c){return function(_0x52444b){if(!_0x52444b){_0x557bca[_0xf621('0x1a')](0x194);}return _0x52444b;};}function handleError(_0x437eba,_0x323f32){_0x323f32=_0x323f32||0x1f4;return function(_0x5606e3){logger[_0xf621('0x2b')](_0x5606e3['stack']);if(_0x5606e3[_0xf621('0x2c')]){delete _0x5606e3[_0xf621('0x2c')];}_0x437eba[_0xf621('0x1b')](_0x323f32)[_0xf621('0x2d')](_0x5606e3);};}exports['index']=function(_0x47dd65,_0xaa54eb){var _0x35e365={},_0x2cdab2={},_0xfab3e8={'count':0x0,'rows':[]};var _0x3280a2=_['map'](db[_0xf621('0x2e')][_0xf621('0x2f')],function(_0x311314){return{'name':_0x311314[_0xf621('0x30')],'type':_0x311314[_0xf621('0x31')][_0xf621('0x32')]};});_0x2cdab2[_0xf621('0x33')]=_[_0xf621('0x34')](_0x3280a2,'name');_0x2cdab2['query']=_[_0xf621('0x35')](_0x47dd65[_0xf621('0x36')]);_0x2cdab2[_0xf621('0x37')]=_[_0xf621('0x38')](_0x2cdab2[_0xf621('0x33')],_0x2cdab2[_0xf621('0x36')]);_0x35e365[_0xf621('0x39')]=_[_0xf621('0x38')](_0x2cdab2[_0xf621('0x33')],qs[_0xf621('0x3a')](_0x47dd65['query'][_0xf621('0x3a')]));_0x35e365['attributes']=_0x35e365[_0xf621('0x39')][_0xf621('0x3b')]?_0x35e365[_0xf621('0x39')]:_0x2cdab2[_0xf621('0x33')];if(!_0x47dd65[_0xf621('0x36')][_0xf621('0x3c')]('nolimit')){_0x35e365[_0xf621('0x1e')]=qs[_0xf621('0x1e')](_0x47dd65[_0xf621('0x36')]['limit']);_0x35e365['offset']=qs[_0xf621('0x1d')](_0x47dd65[_0xf621('0x36')][_0xf621('0x1d')]);}_0x35e365[_0xf621('0x3d')]=qs['sort'](_0x47dd65[_0xf621('0x36')]['sort']);_0x35e365[_0xf621('0x3e')]=qs[_0xf621('0x37')](_['pick'](_0x47dd65[_0xf621('0x36')],_0x2cdab2[_0xf621('0x37')]),_0x3280a2);if(_0x47dd65[_0xf621('0x36')][_0xf621('0x3f')]){_0x35e365['where']=_['merge'](_0x35e365[_0xf621('0x3e')],{'$or':_[_0xf621('0x34')](_0x3280a2,function(_0x1ce303){if(_0x1ce303[_0xf621('0x31')]!==_0xf621('0x40')){var _0x1b5e5a={};_0x1b5e5a[_0x1ce303['name']]={'$like':'%'+_0x47dd65[_0xf621('0x36')][_0xf621('0x3f')]+'%'};return _0x1b5e5a;}})});}_0x35e365=_['merge']({},_0x35e365,_0x47dd65[_0xf621('0x41')]);var _0x1e1ddf={'where':_0x35e365[_0xf621('0x3e')]};return db[_0xf621('0x2e')]['count'](_0x1e1ddf)[_0xf621('0x26')](function(_0xe08612){_0xfab3e8['count']=_0xe08612;if(_0x47dd65[_0xf621('0x36')][_0xf621('0x42')]){_0x35e365[_0xf621('0x43')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xf621('0x44')](_0x35e365);})[_0xf621('0x26')](function(_0x27203e){_0xfab3e8[_0xf621('0x45')]=_0x27203e;return _0xfab3e8;})[_0xf621('0x26')](respondWithFilteredResult(_0xaa54eb,_0x35e365))[_0xf621('0x46')](handleError(_0xaa54eb,null));};exports[_0xf621('0x47')]=function(_0x210b77,_0xbef852){var _0x5a2c55={'raw':!![],'where':{'id':_0x210b77['params']['id']}},_0x31fe23={};_0x31fe23[_0xf621('0x33')]=_['keys'](db[_0xf621('0x2e')]['rawAttributes']);_0x31fe23[_0xf621('0x36')]=_['keys'](_0x210b77[_0xf621('0x36')]);_0x31fe23[_0xf621('0x37')]=_['intersection'](_0x31fe23[_0xf621('0x33')],_0x31fe23[_0xf621('0x36')]);_0x5a2c55[_0xf621('0x39')]=_['intersection'](_0x31fe23['model'],qs[_0xf621('0x3a')](_0x210b77[_0xf621('0x36')][_0xf621('0x3a')]));_0x5a2c55[_0xf621('0x39')]=_0x5a2c55['attributes'][_0xf621('0x3b')]?_0x5a2c55['attributes']:_0x31fe23[_0xf621('0x33')];if(_0x210b77['query'][_0xf621('0x42')]){_0x5a2c55[_0xf621('0x43')]=[{'all':!![]}];}_0x5a2c55=_[_0xf621('0x48')]({},_0x5a2c55,_0x210b77[_0xf621('0x41')]);return db[_0xf621('0x2e')][_0xf621('0x49')](_0x5a2c55)['then'](handleEntityNotFound(_0xbef852,null))['then'](respondWithResult(_0xbef852,null))[_0xf621('0x46')](handleError(_0xbef852,null));};exports['create']=function(_0x15877c,_0x441b89){return db['AnalyticExtractedReport'][_0xf621('0x4a')](_0x15877c[_0xf621('0x4b')],{})['then'](function(_0x451871){var _0x4a9a08=_0x15877c[_0xf621('0x4c')][_0xf621('0x27')]({'plain':!![]});if(!_0x4a9a08)throw new Error(_0xf621('0x4d'));if(_0x4a9a08['role']==='user'){var _0x36481e=_0x451871[_0xf621('0x27')]({'plain':!![]});var _0x183c32=_0xf621('0x28');return db[_0xf621('0x4e')][_0xf621('0x49')]({'where':{'name':_0x183c32,'userProfileId':_0x4a9a08[_0xf621('0x4f')]},'raw':!![]})[_0xf621('0x26')](function(_0x2481cf){if(_0x2481cf&&_0x2481cf['autoAssociation']===0x0){return db[_0xf621('0x29')][_0xf621('0x4a')]({'name':_0x36481e[_0xf621('0x2c')],'resourceId':_0x36481e['id'],'type':_0x2481cf[_0xf621('0x2c')],'sectionId':_0x2481cf['id']},{})[_0xf621('0x26')](function(){return _0x451871;});}else{return _0x451871;}})[_0xf621('0x46')](function(_0x379dfc){logger[_0xf621('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x379dfc);throw _0x379dfc;});}return _0x451871;})[_0xf621('0x26')](respondWithResult(_0x441b89,0xc9))[_0xf621('0x46')](handleError(_0x441b89,null));};exports['update']=function(_0x1dba60,_0xab23ae){if(_0x1dba60[_0xf621('0x4b')]['id']){delete _0x1dba60[_0xf621('0x4b')]['id'];}return db['AnalyticExtractedReport'][_0xf621('0x49')]({'where':{'id':_0x1dba60['params']['id']}})[_0xf621('0x26')](handleEntityNotFound(_0xab23ae,null))[_0xf621('0x26')](saveUpdates(_0x1dba60[_0xf621('0x4b')],null))['then'](respondWithResult(_0xab23ae,null))[_0xf621('0x46')](handleError(_0xab23ae,null));};exports['destroy']=function(_0x2e6e5b,_0x375338){return db[_0xf621('0x2e')][_0xf621('0x49')]({'where':{'id':_0x2e6e5b[_0xf621('0x50')]['id']}})[_0xf621('0x26')](handleEntityNotFound(_0x375338,null))[_0xf621('0x26')](removeEntity(_0x375338,null))['catch'](handleError(_0x375338,null));};exports[_0xf621('0x51')]=function(_0x25dd7c,_0x4f75de,_0x4f61e3){return db[_0xf621('0x2e')][_0xf621('0x49')]({'where':{'id':_0x25dd7c[_0xf621('0x50')]['id']},'attributes':[_0xf621('0x2c'),_0xf621('0x52'),_0xf621('0x53'),_0xf621('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x4f75de,null))[_0xf621('0x26')](function(_0x31b38a){if(_0x31b38a){if(!fs['existsSync'](path['join'](config[_0xf621('0x55')],_0xf621('0x56'),_0x31b38a[_0xf621('0x53')]))){throw new db[(_0xf621('0x57'))][(_0xf621('0x58'))](_0xf621('0x59'));}if(_0x25dd7c[_0xf621('0x36')]['exists']){return _0x4f75de[_0xf621('0x1a')](0xc8);}return _0x4f75de['download'](path[_0xf621('0x5a')](config['root'],_0xf621('0x56'),_0x31b38a[_0xf621('0x53')]),util[_0xf621('0x5b')]('%s.%s',_0x31b38a[_0xf621('0x52')]||_0x31b38a[_0xf621('0x2c')],_0x31b38a[_0xf621('0x54')][_0xf621('0x5c')]()));}})[_0xf621('0x46')](handleError(_0x4f75de,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 86ec184..6d5552e 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 _0x8172=['request-promise','rimraf','../../config/environment','define','AnalyticExtractedReport','util','api','moment'];(function(_0x4d3c86,_0x519f56){var _0x213120=function(_0x1dcd20){while(--_0x1dcd20){_0x4d3c86['push'](_0x4d3c86['shift']());}};_0x213120(++_0x519f56);}(_0x8172,0x7d));var _0x2817=function(_0x1f7fdb,_0x18a0f8){_0x1f7fdb=_0x1f7fdb-0x0;var _0x32792f=_0x8172[_0x1f7fdb];return _0x32792f;};'use strict';var _=require('lodash');var util=require(_0x2817('0x0'));var logger=require('../../config/logger')(_0x2817('0x1'));var moment=require(_0x2817('0x2'));var BPromise=require('bluebird');var rp=require(_0x2817('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2817('0x4'));var config=require(_0x2817('0x5'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x2fba30,_0x3799c4){return _0x2fba30[_0x2817('0x6')](_0x2817('0x7'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c8a=['./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x64cddd,_0x5f1aa2){var _0x16142f=function(_0x21e74d){while(--_0x21e74d){_0x64cddd['push'](_0x64cddd['shift']());}};_0x16142f(++_0x5f1aa2);}(_0x6c8a,0x1c1));var _0xa6c8=function(_0xbc1f3c,_0x3cb185){_0xbc1f3c=_0xbc1f3c-0x0;var _0x1bbd42=_0x6c8a[_0xbc1f3c];return _0x1bbd42;};'use strict';var _=require('lodash');var util=require(_0xa6c8('0x0'));var logger=require('../../config/logger')(_0xa6c8('0x1'));var moment=require(_0xa6c8('0x2'));var BPromise=require(_0xa6c8('0x3'));var rp=require(_0xa6c8('0x4'));var fs=require('fs');var path=require(_0xa6c8('0x5'));var rimraf=require('rimraf');var config=require(_0xa6c8('0x6'));var attributes=require(_0xa6c8('0x7'));module[_0xa6c8('0x8')]=function(_0x3a35c1,_0x272553){return _0x3a35c1[_0xa6c8('0x9')](_0xa6c8('0xa'),attributes,{'tableName':_0xa6c8('0xb'),'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 d3f430e..995f621 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 _0x4c8d=['stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','info','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x35f616,_0xc97542){var _0x4057dc=function(_0x526fd9){while(--_0x526fd9){_0x35f616['push'](_0x35f616['shift']());}};_0x4057dc(++_0xc97542);}(_0x4c8d,0xf7));var _0xd4c8=function(_0x23522c,_0x62b8eb){_0x23522c=_0x23522c-0x0;var _0x105050=_0x4c8d[_0x23522c];return _0x105050;};'use strict';var _=require('lodash');var util=require(_0xd4c8('0x0'));var moment=require(_0xd4c8('0x1'));var BPromise=require(_0xd4c8('0x2'));var rs=require(_0xd4c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4c8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd4c8('0x5'))('rpc');var config=require(_0xd4c8('0x6'));var jayson=require(_0xd4c8('0x7'));var client=jayson[_0xd4c8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1de0f7,_0x1472b9,_0x1bd383){return new BPromise(function(_0x32693c,_0x2dd027){return client[_0xd4c8('0x9')](_0x1de0f7,_0x1bd383)['then'](function(_0x4edf30){logger[_0xd4c8('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1472b9,'request\x20sent');logger['debug'](_0xd4c8('0xb'),_0x1472b9,_0xd4c8('0xc'),JSON[_0xd4c8('0xd')](_0x4edf30));if(_0x4edf30['error']){if(_0x4edf30[_0xd4c8('0xe')][_0xd4c8('0xf')]===0x1f4){logger[_0xd4c8('0xe')](_0xd4c8('0x10'),_0x1472b9,_0x4edf30[_0xd4c8('0xe')][_0xd4c8('0x11')]);return _0x2dd027(_0x4edf30[_0xd4c8('0xe')][_0xd4c8('0x11')]);}logger[_0xd4c8('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1472b9,_0x4edf30['error'][_0xd4c8('0x11')]);return _0x32693c(_0x4edf30[_0xd4c8('0xe')][_0xd4c8('0x11')]);}else{logger['info'](_0xd4c8('0x10'),_0x1472b9,'request\x20sent');_0x32693c(_0x4edf30[_0xd4c8('0x12')][_0xd4c8('0x11')]);}})[_0xd4c8('0x13')](function(_0x32b483){logger[_0xd4c8('0xe')](_0xd4c8('0x10'),_0x1472b9,_0x32b483);_0x2dd027(_0x32b483);});});} \ No newline at end of file +var _0xe875=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5f0bf6,_0x46cc44){var _0x5e8e1a=function(_0x37e24a){while(--_0x37e24a){_0x5f0bf6['push'](_0x5f0bf6['shift']());}};_0x5e8e1a(++_0x46cc44);}(_0xe875,0x1b8));var _0x5e87=function(_0x2f146a,_0x20f2bd){_0x2f146a=_0x2f146a-0x0;var _0x1bd7d9=_0xe875[_0x2f146a];return _0x1bd7d9;};'use strict';var _=require(_0x5e87('0x0'));var util=require(_0x5e87('0x1'));var moment=require(_0x5e87('0x2'));var BPromise=require(_0x5e87('0x3'));var rs=require(_0x5e87('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5e87('0x5'));var logger=require(_0x5e87('0x6'))(_0x5e87('0x7'));var config=require(_0x5e87('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5e87('0x9')][_0x5e87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x250eef,_0x358587,_0xc3bc1e){return new BPromise(function(_0x13feab,_0x4636ed){return client[_0x5e87('0xb')](_0x250eef,_0xc3bc1e)[_0x5e87('0xc')](function(_0x10f7ca){logger[_0x5e87('0xd')](_0x5e87('0xe'),_0x358587,_0x5e87('0xf'));logger[_0x5e87('0x10')](_0x5e87('0x11'),_0x358587,_0x5e87('0xf'),JSON[_0x5e87('0x12')](_0x10f7ca));if(_0x10f7ca[_0x5e87('0x13')]){if(_0x10f7ca[_0x5e87('0x13')]['code']===0x1f4){logger[_0x5e87('0x13')](_0x5e87('0xe'),_0x358587,_0x10f7ca[_0x5e87('0x13')]['message']);return _0x4636ed(_0x10f7ca[_0x5e87('0x13')][_0x5e87('0x14')]);}logger[_0x5e87('0x13')](_0x5e87('0xe'),_0x358587,_0x10f7ca[_0x5e87('0x13')][_0x5e87('0x14')]);return _0x13feab(_0x10f7ca[_0x5e87('0x13')]['message']);}else{logger[_0x5e87('0xd')](_0x5e87('0xe'),_0x358587,'request\x20sent');_0x13feab(_0x10f7ca[_0x5e87('0x15')][_0x5e87('0x14')]);}})[_0x5e87('0x16')](function(_0x9a5c07){logger[_0x5e87('0x13')](_0x5e87('0xe'),_0x358587,_0x9a5c07);_0x4636ed(_0x9a5c07);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index b3468c5..e4070da 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 _0xdd93=['get','show','/:id/download','download','post','create','put','update','delete','/:id','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index'];(function(_0x241e91,_0x26ebf4){var _0x341357=function(_0x135941){while(--_0x135941){_0x241e91['push'](_0x241e91['shift']());}};_0x341357(++_0x26ebf4);}(_0xdd93,0xf1));var _0x3dd9=function(_0x598e12,_0x3aea87){_0x598e12=_0x598e12-0x0;var _0x4c343d=_0xdd93[_0x598e12];return _0x4c343d;};'use strict';var multer=require(_0x3dd9('0x0'));var util=require(_0x3dd9('0x1'));var path=require(_0x3dd9('0x2'));var timeout=require(_0x3dd9('0x3'));var express=require('express');var router=express[_0x3dd9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3dd9('0x5'));var interaction=require(_0x3dd9('0x6'));var config=require(_0x3dd9('0x7'));var controller=require(_0x3dd9('0x8'));router['get']('/',auth[_0x3dd9('0x9')](),controller[_0x3dd9('0xa')]);router[_0x3dd9('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x3dd9('0xc')]);router['get'](_0x3dd9('0xd'),auth['isAuthenticated'](),controller[_0x3dd9('0xe')]);router[_0x3dd9('0xf')]('/',auth[_0x3dd9('0x9')](),controller[_0x3dd9('0x10')]);router[_0x3dd9('0x11')]('/:id',auth[_0x3dd9('0x9')](),controller[_0x3dd9('0x12')]);router[_0x3dd9('0x13')](_0x3dd9('0x14'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe320=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','show','/:id/download','post','create','/:id','delete','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe320,0x109));var _0x0e32=function(_0x536e5a,_0x512421){_0x536e5a=_0x536e5a-0x0;var _0x17821c=_0xe320[_0x536e5a];return _0x17821c;};'use strict';var multer=require(_0x0e32('0x0'));var util=require(_0x0e32('0x1'));var path=require(_0x0e32('0x2'));var timeout=require(_0x0e32('0x3'));var express=require(_0x0e32('0x4'));var router=express[_0x0e32('0x5')]();var fs_extra=require(_0x0e32('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0e32('0x7'));var controller=require(_0x0e32('0x8'));router[_0x0e32('0x9')]('/',auth[_0x0e32('0xa')](),controller[_0x0e32('0xb')]);router['get']('/:id',auth[_0x0e32('0xa')](),controller[_0x0e32('0xc')]);router[_0x0e32('0x9')](_0x0e32('0xd'),auth[_0x0e32('0xa')](),controller['download']);router[_0x0e32('0xe')]('/',auth[_0x0e32('0xa')](),controller[_0x0e32('0xf')]);router['put'](_0x0e32('0x10'),auth[_0x0e32('0xa')](),controller['update']);router[_0x0e32('0x11')](_0x0e32('0x10'),auth[_0x0e32('0xa')](),controller['destroy']);module[_0x0e32('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index d5cb1f9..6c92ce1 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 _0xc4e1=['sequelize','exports','STRING','BOOLEAN'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xc4e1,0x12c));var _0x1c4e=function(_0x3e4e70,_0x5772a4){_0x3e4e70=_0x3e4e70-0x0;var _0x264dc5=_0xc4e1[_0x3e4e70];return _0x264dc5;};'use strict';var Sequelize=require(_0x1c4e('0x0'));module[_0x1c4e('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x1c4e('0x2')]},'format':{'type':Sequelize[_0x1c4e('0x2')]},'groupBy':{'type':Sequelize[_0x1c4e('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1c4e('0x2')]},'custom':{'type':Sequelize[_0x1c4e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x8186=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x2a1d67,_0x250f1b){var _0x52b432=function(_0x211fcd){while(--_0x211fcd){_0x2a1d67['push'](_0x2a1d67['shift']());}};_0x52b432(++_0x250f1b);}(_0x8186,0x188));var _0x6818=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x8186[_0x2e8418];return _0x548fe6;};'use strict';var Sequelize=require(_0x6818('0x0'));module[_0x6818('0x1')]={'field':{'type':Sequelize[_0x6818('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x6818('0x3')]},'format':{'type':Sequelize[_0x6818('0x3')]},'groupBy':{'type':Sequelize[_0x6818('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 2886a77..457996f 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 _0x08f5=['merge','where','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','keys','find','catch','create','body','bulkCreate','update','destroy','bulkDestroy','ids','AnalyticCustomReport','transaction','CustomReportId','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','map','AnalyticFieldReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x5d0a4c,_0x5b5929){var _0x27ffd9=function(_0x1bbb1e){while(--_0x1bbb1e){_0x5d0a4c['push'](_0x5d0a4c['shift']());}};_0x27ffd9(++_0x5b5929);}(_0x08f5,0x197));var _0x508f=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0x08f5[_0x51e79c];return _0x2467be;};'use strict';var emlformat=require(_0x508f('0x0'));var rimraf=require(_0x508f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x508f('0x2'));var moment=require(_0x508f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x508f('0x4'));var path=require(_0x508f('0x5'));var sox=require(_0x508f('0x6'));var csv=require(_0x508f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x508f('0x8'));var _=require('lodash');var squel=require(_0x508f('0x9'));var crypto=require(_0x508f('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x508f('0x7'));var querystring=require(_0x508f('0xb'));var Papa=require('papaparse');var Redis=require(_0x508f('0xc'));var authService=require(_0x508f('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x508f('0xe'));var logger=require(_0x508f('0xf'))(_0x508f('0x10'));var utils=require('../../config/utils');var config=require(_0x508f('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x508f('0x12'))['db'];function respondWithStatusCode(_0x142f4a,_0x4bff7c){_0x4bff7c=_0x4bff7c||0xcc;return function(_0x1d23c4){if(_0x1d23c4){return _0x142f4a[_0x508f('0x13')](_0x4bff7c);}return _0x142f4a[_0x508f('0x14')](_0x4bff7c)[_0x508f('0x15')]();};}function respondWithResult(_0x480994,_0x3567ce){_0x3567ce=_0x3567ce||0xc8;return function(_0x3cbeea){if(_0x3cbeea){return _0x480994[_0x508f('0x14')](_0x3567ce)['json'](_0x3cbeea);}};}function respondWithFilteredResult(_0x1f8b40,_0x52c2f1){return function(_0x17ea31){if(_0x17ea31){var _0x47f22d=typeof _0x52c2f1[_0x508f('0x16')]==='undefined'&&typeof _0x52c2f1[_0x508f('0x17')]===_0x508f('0x18');var _0x267914=_0x17ea31['count'];var _0x556d59=_0x47f22d?0x0:_0x52c2f1[_0x508f('0x16')];var _0x40c876=_0x47f22d?_0x17ea31[_0x508f('0x19')]:_0x52c2f1[_0x508f('0x16')]+_0x52c2f1[_0x508f('0x17')];var _0x264ad0;if(_0x40c876>=_0x267914){_0x40c876=_0x267914;_0x264ad0=0xc8;}else{_0x264ad0=0xce;}_0x1f8b40[_0x508f('0x14')](_0x264ad0);return _0x1f8b40[_0x508f('0x1a')](_0x508f('0x1b'),_0x556d59+'-'+_0x40c876+'/'+_0x267914)[_0x508f('0x1c')](_0x17ea31);}return null;};}function patchUpdates(_0x306fa1){return function(_0x563609){try{jsonpatch[_0x508f('0x1d')](_0x563609,_0x306fa1,!![]);}catch(_0x4d81dd){return BPromise[_0x508f('0x1e')](_0x4d81dd);}return _0x563609[_0x508f('0x1f')]();};}function saveUpdates(_0x171af7,_0x3927b2){return function(_0x14ebae){if(_0x14ebae){return _0x14ebae['update'](_0x171af7)[_0x508f('0x20')](function(_0xaecad9){return _0xaecad9;});}return null;};}function removeEntity(_0x5aa696,_0x191347){return function(_0x429ede){if(_0x429ede){return _0x429ede['destroy']()['then'](function(){_0x5aa696[_0x508f('0x14')](0xcc)[_0x508f('0x15')]();});}};}function handleEntityNotFound(_0x31d39e,_0x4b778c){return function(_0x380da6){if(!_0x380da6){_0x31d39e[_0x508f('0x13')](0x194);}return _0x380da6;};}function handleError(_0xef2c41,_0x547385){_0x547385=_0x547385||0x1f4;return function(_0x385634){logger[_0x508f('0x21')](_0x385634[_0x508f('0x22')]);if(_0x385634[_0x508f('0x23')]){delete _0x385634[_0x508f('0x23')];}_0xef2c41[_0x508f('0x14')](_0x547385)[_0x508f('0x24')](_0x385634);};}exports['index']=function(_0x46b726,_0x5589ea){var _0x3bf539={},_0x389932={},_0x143bd5={'count':0x0,'rows':[]};var _0x49278a=_[_0x508f('0x25')](db[_0x508f('0x26')]['rawAttributes'],function(_0x3ea9b9){return{'name':_0x3ea9b9[_0x508f('0x27')],'type':_0x3ea9b9[_0x508f('0x28')][_0x508f('0x29')]};});_0x389932[_0x508f('0x2a')]=_[_0x508f('0x25')](_0x49278a,_0x508f('0x23'));_0x389932[_0x508f('0x2b')]=_['keys'](_0x46b726[_0x508f('0x2b')]);_0x389932[_0x508f('0x2c')]=_[_0x508f('0x2d')](_0x389932['model'],_0x389932[_0x508f('0x2b')]);_0x3bf539['attributes']=_[_0x508f('0x2d')](_0x389932[_0x508f('0x2a')],qs[_0x508f('0x2e')](_0x46b726[_0x508f('0x2b')][_0x508f('0x2e')]));_0x3bf539[_0x508f('0x2f')]=_0x3bf539['attributes'][_0x508f('0x30')]?_0x3bf539[_0x508f('0x2f')]:_0x389932[_0x508f('0x2a')];if(!_0x46b726[_0x508f('0x2b')][_0x508f('0x31')](_0x508f('0x32'))){_0x3bf539[_0x508f('0x17')]=qs['limit'](_0x46b726[_0x508f('0x2b')][_0x508f('0x17')]);_0x3bf539[_0x508f('0x16')]=qs[_0x508f('0x16')](_0x46b726[_0x508f('0x2b')]['offset']);}_0x3bf539[_0x508f('0x33')]=qs[_0x508f('0x34')](_0x46b726[_0x508f('0x2b')][_0x508f('0x34')]);_0x3bf539['where']=qs['filters'](_[_0x508f('0x35')](_0x46b726[_0x508f('0x2b')],_0x389932['filters']),_0x49278a);if(_0x46b726[_0x508f('0x2b')][_0x508f('0x36')]){_0x3bf539['where']=_[_0x508f('0x37')](_0x3bf539[_0x508f('0x38')],{'$or':_[_0x508f('0x25')](_0x49278a,function(_0xc99402){if(_0xc99402[_0x508f('0x28')]!==_0x508f('0x39')){var _0x335d80={};_0x335d80[_0xc99402[_0x508f('0x23')]]={'$like':'%'+_0x46b726[_0x508f('0x2b')][_0x508f('0x36')]+'%'};return _0x335d80;}})});}_0x3bf539=_[_0x508f('0x37')]({},_0x3bf539,_0x46b726[_0x508f('0x3a')]);var _0x202346={'where':_0x3bf539[_0x508f('0x38')]};return db['AnalyticFieldReport']['count'](_0x202346)[_0x508f('0x20')](function(_0x15eb63){_0x143bd5['count']=_0x15eb63;if(_0x46b726['query'][_0x508f('0x3b')]){_0x3bf539['include']=[{'all':!![]}];}return db[_0x508f('0x26')][_0x508f('0x3c')](_0x3bf539);})['then'](function(_0x30c34f){_0x143bd5['rows']=_0x30c34f;return _0x143bd5;})['then'](respondWithFilteredResult(_0x5589ea,_0x3bf539))['catch'](handleError(_0x5589ea,null));};exports[_0x508f('0x3d')]=function(_0x6ec73b,_0x310e7c){var _0x2460e4={'raw':![],'where':{'id':_0x6ec73b[_0x508f('0x3e')]['id']}},_0x3ec91f={};_0x3ec91f[_0x508f('0x2a')]=_['keys'](db['AnalyticFieldReport'][_0x508f('0x3f')]);_0x3ec91f[_0x508f('0x2b')]=_[_0x508f('0x40')](_0x6ec73b[_0x508f('0x2b')]);_0x3ec91f[_0x508f('0x2c')]=_[_0x508f('0x2d')](_0x3ec91f[_0x508f('0x2a')],_0x3ec91f[_0x508f('0x2b')]);_0x2460e4[_0x508f('0x2f')]=_[_0x508f('0x2d')](_0x3ec91f[_0x508f('0x2a')],qs[_0x508f('0x2e')](_0x6ec73b[_0x508f('0x2b')]['fields']));_0x2460e4[_0x508f('0x2f')]=_0x2460e4[_0x508f('0x2f')][_0x508f('0x30')]?_0x2460e4['attributes']:_0x3ec91f[_0x508f('0x2a')];if(_0x6ec73b[_0x508f('0x2b')][_0x508f('0x3b')]){_0x2460e4['include']=[{'all':!![]}];}_0x2460e4=_['merge']({},_0x2460e4,_0x6ec73b['options']);return db['AnalyticFieldReport'][_0x508f('0x41')](_0x2460e4)[_0x508f('0x20')](handleEntityNotFound(_0x310e7c,null))[_0x508f('0x20')](respondWithResult(_0x310e7c,null))[_0x508f('0x42')](handleError(_0x310e7c,null));};exports[_0x508f('0x43')]=function(_0x3fe728,_0xbeb9af){return db['AnalyticFieldReport'][_0x508f('0x43')](_0x3fe728[_0x508f('0x44')],{})[_0x508f('0x20')](respondWithResult(_0xbeb9af,0xc9))['catch'](handleError(_0xbeb9af,null));};exports[_0x508f('0x45')]=function(_0x165f1d,_0x197da7){return db['AnalyticFieldReport'][_0x508f('0x45')](_0x165f1d[_0x508f('0x44')],{'raw':![],'individualHooks':!![]})[_0x508f('0x20')](respondWithResult(_0x197da7,0xc9))[_0x508f('0x42')](handleError(_0x197da7,null));};exports[_0x508f('0x46')]=function(_0x10ff20,_0x49e73c){if(_0x10ff20[_0x508f('0x44')]['id']){delete _0x10ff20[_0x508f('0x44')]['id'];}return db[_0x508f('0x26')]['find']({'where':{'id':_0x10ff20['params']['id']}})[_0x508f('0x20')](handleEntityNotFound(_0x49e73c,null))['then'](saveUpdates(_0x10ff20[_0x508f('0x44')],null))['then'](respondWithResult(_0x49e73c,null))[_0x508f('0x42')](handleError(_0x49e73c,null));};exports[_0x508f('0x47')]=function(_0x4f7720,_0x2d0f75){return db['AnalyticFieldReport'][_0x508f('0x41')]({'where':{'id':_0x4f7720[_0x508f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2d0f75,null))[_0x508f('0x20')](removeEntity(_0x2d0f75,null))['catch'](handleError(_0x2d0f75,null));};exports[_0x508f('0x48')]=function(_0x51a783,_0x568198){return db[_0x508f('0x26')]['destroy']({'where':{'id':_0x51a783[_0x508f('0x2b')][_0x508f('0x49')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x568198,0xcc))[_0x508f('0x42')](handleError(_0x568198,null));};exports['addFields']=function(_0x12e4d4,_0x5717f8,_0x3881a4){return db[_0x508f('0x4a')]['findOne']({'where':{'id':_0x12e4d4[_0x508f('0x3e')]['id']}})[_0x508f('0x20')](handleEntityNotFound(_0x5717f8,null))[_0x508f('0x20')](function(_0x1ad709){if(_0x1ad709){return db['sequelize'][_0x508f('0x4b')](function(_0x5e8c90){return db['AnalyticFieldReport'][_0x508f('0x47')]({'where':{'CustomReportId':_0x12e4d4[_0x508f('0x3e')]['id']},'transaction':_0x5e8c90})[_0x508f('0x20')](function(_0x94cb6d){var _0x1aea41=_[_0x508f('0x25')](_0x12e4d4['body'],function(_0x94a9e){delete _0x94a9e['id'];_0x94a9e[_0x508f('0x4c')]=_0x12e4d4['params']['id'];return _0x94a9e;});return db[_0x508f('0x26')][_0x508f('0x45')](_0x1aea41,{'transaction':_0x5e8c90});});})[_0x508f('0x20')](function(){return db[_0x508f('0x26')][_0x508f('0x3c')]({'where':{'CustomReportId':_0x12e4d4['params']['id']}});});}})['then'](respondWithResult(_0x5717f8,null))[_0x508f('0x42')](handleError(_0x5717f8,null));}; \ No newline at end of file +var _0x65b6=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','then','destroy','stack','name','send','index','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','options','AnalyticFieldReport','includeAll','rows','catch','params','rawAttributes','intersection','length','include','bulkCreate','body','find','bulkDestroy','ids','AnalyticCustomReport','findOne','transaction','findAll','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xfb7458,_0x26472d){var _0x5de66d=function(_0x448fdb){while(--_0x448fdb){_0xfb7458['push'](_0xfb7458['shift']());}};_0x5de66d(++_0x26472d);}(_0x65b6,0x1c3));var _0x665b=function(_0x50cf08,_0x5eb8c5){_0x50cf08=_0x50cf08-0x0;var _0x23a9df=_0x65b6[_0x50cf08];return _0x23a9df;};'use strict';var emlformat=require(_0x665b('0x0'));var rimraf=require(_0x665b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x665b('0x2'));var rp=require(_0x665b('0x3'));var moment=require(_0x665b('0x4'));var BPromise=require(_0x665b('0x5'));var Mustache=require(_0x665b('0x6'));var util=require(_0x665b('0x7'));var path=require(_0x665b('0x8'));var sox=require(_0x665b('0x9'));var csv=require('to-csv');var ejs=require(_0x665b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x665b('0xb'));var squel=require(_0x665b('0xc'));var crypto=require(_0x665b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x665b('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x665b('0xf'));var qs=require(_0x665b('0x10'));var as=require(_0x665b('0x11'));var hardwareService=require(_0x665b('0x12'));var logger=require(_0x665b('0x13'))(_0x665b('0x14'));var utils=require(_0x665b('0x15'));var config=require(_0x665b('0x16'));var licenseUtil=require(_0x665b('0x17'));var db=require(_0x665b('0x18'))['db'];function respondWithStatusCode(_0xff7c23,_0x291204){_0x291204=_0x291204||0xcc;return function(_0x894f5b){if(_0x894f5b){return _0xff7c23[_0x665b('0x19')](_0x291204);}return _0xff7c23[_0x665b('0x1a')](_0x291204)[_0x665b('0x1b')]();};}function respondWithResult(_0x33811f,_0x21cb45){_0x21cb45=_0x21cb45||0xc8;return function(_0x4377a0){if(_0x4377a0){return _0x33811f[_0x665b('0x1a')](_0x21cb45)[_0x665b('0x1c')](_0x4377a0);}};}function respondWithFilteredResult(_0x406576,_0x2b2a41){return function(_0x41f654){if(_0x41f654){var _0x3abcbd=typeof _0x2b2a41['offset']===_0x665b('0x1d')&&typeof _0x2b2a41[_0x665b('0x1e')]===_0x665b('0x1d');var _0x206f6a=_0x41f654[_0x665b('0x1f')];var _0x440f48=_0x3abcbd?0x0:_0x2b2a41[_0x665b('0x20')];var _0x18f6d1=_0x3abcbd?_0x41f654['count']:_0x2b2a41[_0x665b('0x20')]+_0x2b2a41[_0x665b('0x1e')];var _0x299483;if(_0x18f6d1>=_0x206f6a){_0x18f6d1=_0x206f6a;_0x299483=0xc8;}else{_0x299483=0xce;}_0x406576['status'](_0x299483);return _0x406576['set'](_0x665b('0x21'),_0x440f48+'-'+_0x18f6d1+'/'+_0x206f6a)['json'](_0x41f654);}return null;};}function patchUpdates(_0x3e8142){return function(_0x5006e0){try{jsonpatch[_0x665b('0x22')](_0x5006e0,_0x3e8142,!![]);}catch(_0x261f65){return BPromise['reject'](_0x261f65);}return _0x5006e0['save']();};}function saveUpdates(_0x41bc99,_0x2ad3cf){return function(_0x3c54a3){if(_0x3c54a3){return _0x3c54a3[_0x665b('0x23')](_0x41bc99)[_0x665b('0x24')](function(_0x2a6bf4){return _0x2a6bf4;});}return null;};}function removeEntity(_0x540042,_0x3d752a){return function(_0x464e56){if(_0x464e56){return _0x464e56[_0x665b('0x25')]()[_0x665b('0x24')](function(){_0x540042[_0x665b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d035e,_0x4c53c8){return function(_0x5917d6){if(!_0x5917d6){_0x4d035e[_0x665b('0x19')](0x194);}return _0x5917d6;};}function handleError(_0x4324b1,_0x2d2ea7){_0x2d2ea7=_0x2d2ea7||0x1f4;return function(_0x3e1687){logger['error'](_0x3e1687[_0x665b('0x26')]);if(_0x3e1687[_0x665b('0x27')]){delete _0x3e1687['name'];}_0x4324b1[_0x665b('0x1a')](_0x2d2ea7)[_0x665b('0x28')](_0x3e1687);};}exports[_0x665b('0x29')]=function(_0xf57a51,_0x3217ca){var _0x4aba7f={},_0x1643fb={},_0x3db01f={'count':0x0,'rows':[]};var _0x328890=_['map'](db['AnalyticFieldReport']['rawAttributes'],function(_0x56c8b0){return{'name':_0x56c8b0['fieldName'],'type':_0x56c8b0[_0x665b('0x2a')][_0x665b('0x2b')]};});_0x1643fb[_0x665b('0x2c')]=_['map'](_0x328890,'name');_0x1643fb[_0x665b('0x2d')]=_[_0x665b('0x2e')](_0xf57a51[_0x665b('0x2d')]);_0x1643fb[_0x665b('0x2f')]=_['intersection'](_0x1643fb[_0x665b('0x2c')],_0x1643fb[_0x665b('0x2d')]);_0x4aba7f['attributes']=_['intersection'](_0x1643fb['model'],qs[_0x665b('0x30')](_0xf57a51[_0x665b('0x2d')][_0x665b('0x30')]));_0x4aba7f[_0x665b('0x31')]=_0x4aba7f[_0x665b('0x31')]['length']?_0x4aba7f['attributes']:_0x1643fb[_0x665b('0x2c')];if(!_0xf57a51['query'][_0x665b('0x32')](_0x665b('0x33'))){_0x4aba7f['limit']=qs[_0x665b('0x1e')](_0xf57a51[_0x665b('0x2d')][_0x665b('0x1e')]);_0x4aba7f[_0x665b('0x20')]=qs[_0x665b('0x20')](_0xf57a51[_0x665b('0x2d')][_0x665b('0x20')]);}_0x4aba7f[_0x665b('0x34')]=qs[_0x665b('0x35')](_0xf57a51[_0x665b('0x2d')]['sort']);_0x4aba7f[_0x665b('0x36')]=qs[_0x665b('0x2f')](_[_0x665b('0x37')](_0xf57a51['query'],_0x1643fb[_0x665b('0x2f')]),_0x328890);if(_0xf57a51[_0x665b('0x2d')]['filter']){_0x4aba7f[_0x665b('0x36')]=_['merge'](_0x4aba7f[_0x665b('0x36')],{'$or':_[_0x665b('0x38')](_0x328890,function(_0x39dfdb){if(_0x39dfdb[_0x665b('0x2a')]!==_0x665b('0x39')){var _0x43b99f={};_0x43b99f[_0x39dfdb[_0x665b('0x27')]]={'$like':'%'+_0xf57a51[_0x665b('0x2d')][_0x665b('0x3a')]+'%'};return _0x43b99f;}})});}_0x4aba7f=_[_0x665b('0x3b')]({},_0x4aba7f,_0xf57a51[_0x665b('0x3c')]);var _0x1ca726={'where':_0x4aba7f[_0x665b('0x36')]};return db[_0x665b('0x3d')]['count'](_0x1ca726)[_0x665b('0x24')](function(_0xcbf16c){_0x3db01f[_0x665b('0x1f')]=_0xcbf16c;if(_0xf57a51[_0x665b('0x2d')][_0x665b('0x3e')]){_0x4aba7f['include']=[{'all':!![]}];}return db[_0x665b('0x3d')]['findAll'](_0x4aba7f);})['then'](function(_0xe9e657){_0x3db01f[_0x665b('0x3f')]=_0xe9e657;return _0x3db01f;})[_0x665b('0x24')](respondWithFilteredResult(_0x3217ca,_0x4aba7f))[_0x665b('0x40')](handleError(_0x3217ca,null));};exports['show']=function(_0x471779,_0x169602){var _0x10430c={'raw':![],'where':{'id':_0x471779[_0x665b('0x41')]['id']}},_0x274d0a={};_0x274d0a[_0x665b('0x2c')]=_[_0x665b('0x2e')](db[_0x665b('0x3d')][_0x665b('0x42')]);_0x274d0a[_0x665b('0x2d')]=_[_0x665b('0x2e')](_0x471779['query']);_0x274d0a['filters']=_[_0x665b('0x43')](_0x274d0a['model'],_0x274d0a['query']);_0x10430c[_0x665b('0x31')]=_[_0x665b('0x43')](_0x274d0a[_0x665b('0x2c')],qs[_0x665b('0x30')](_0x471779[_0x665b('0x2d')][_0x665b('0x30')]));_0x10430c[_0x665b('0x31')]=_0x10430c['attributes'][_0x665b('0x44')]?_0x10430c[_0x665b('0x31')]:_0x274d0a['model'];if(_0x471779[_0x665b('0x2d')][_0x665b('0x3e')]){_0x10430c[_0x665b('0x45')]=[{'all':!![]}];}_0x10430c=_[_0x665b('0x3b')]({},_0x10430c,_0x471779[_0x665b('0x3c')]);return db[_0x665b('0x3d')]['find'](_0x10430c)[_0x665b('0x24')](handleEntityNotFound(_0x169602,null))[_0x665b('0x24')](respondWithResult(_0x169602,null))[_0x665b('0x40')](handleError(_0x169602,null));};exports['create']=function(_0xc65393,_0x59e235){return db[_0x665b('0x3d')]['create'](_0xc65393['body'],{})[_0x665b('0x24')](respondWithResult(_0x59e235,0xc9))[_0x665b('0x40')](handleError(_0x59e235,null));};exports[_0x665b('0x46')]=function(_0x51154a,_0x376139){return db[_0x665b('0x3d')][_0x665b('0x46')](_0x51154a['body'],{'raw':![],'individualHooks':!![]})[_0x665b('0x24')](respondWithResult(_0x376139,0xc9))['catch'](handleError(_0x376139,null));};exports[_0x665b('0x23')]=function(_0x197c9e,_0x31a0f8){if(_0x197c9e[_0x665b('0x47')]['id']){delete _0x197c9e[_0x665b('0x47')]['id'];}return db[_0x665b('0x3d')][_0x665b('0x48')]({'where':{'id':_0x197c9e[_0x665b('0x41')]['id']}})[_0x665b('0x24')](handleEntityNotFound(_0x31a0f8,null))[_0x665b('0x24')](saveUpdates(_0x197c9e[_0x665b('0x47')],null))[_0x665b('0x24')](respondWithResult(_0x31a0f8,null))[_0x665b('0x40')](handleError(_0x31a0f8,null));};exports[_0x665b('0x25')]=function(_0x282dbc,_0x14cdbf){return db['AnalyticFieldReport'][_0x665b('0x48')]({'where':{'id':_0x282dbc[_0x665b('0x41')]['id']}})[_0x665b('0x24')](handleEntityNotFound(_0x14cdbf,null))[_0x665b('0x24')](removeEntity(_0x14cdbf,null))[_0x665b('0x40')](handleError(_0x14cdbf,null));};exports[_0x665b('0x49')]=function(_0x42eaa5,_0x34614a){return db[_0x665b('0x3d')][_0x665b('0x25')]({'where':{'id':_0x42eaa5[_0x665b('0x2d')][_0x665b('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0x665b('0x24')](respondWithResult(_0x34614a,0xcc))[_0x665b('0x40')](handleError(_0x34614a,null));};exports['addFields']=function(_0x28a6f8,_0x38599c,_0x2188cb){return db[_0x665b('0x4b')][_0x665b('0x4c')]({'where':{'id':_0x28a6f8[_0x665b('0x41')]['id']}})[_0x665b('0x24')](handleEntityNotFound(_0x38599c,null))[_0x665b('0x24')](function(_0x11f621){if(_0x11f621){return db['sequelize'][_0x665b('0x4d')](function(_0xe7b108){return db[_0x665b('0x3d')][_0x665b('0x25')]({'where':{'CustomReportId':_0x28a6f8[_0x665b('0x41')]['id']},'transaction':_0xe7b108})['then'](function(_0x5a4373){var _0x3875d1=_[_0x665b('0x38')](_0x28a6f8[_0x665b('0x47')],function(_0x38d1c9){delete _0x38d1c9['id'];_0x38d1c9['CustomReportId']=_0x28a6f8['params']['id'];return _0x38d1c9;});return db['AnalyticFieldReport']['bulkCreate'](_0x3875d1,{'transaction':_0xe7b108});});})[_0x665b('0x24')](function(){return db[_0x665b('0x3d')][_0x665b('0x4e')]({'where':{'CustomReportId':_0x28a6f8[_0x665b('0x41')]['id']}});});}})['then'](respondWithResult(_0x38599c,null))[_0x665b('0x40')](handleError(_0x38599c,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index bb4252b..c3973df 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 _0xc5e8=['lodash','moment','bluebird','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5e8,0xab));var _0x8c5e=function(_0x182dfc,_0x521382){_0x182dfc=_0x182dfc-0x0;var _0x287b78=_0xc5e8[_0x182dfc];return _0x287b78;};'use strict';var _=require(_0x8c5e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8c5e('0x1'));var BPromise=require(_0x8c5e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8c5e('0x3'));var config=require(_0x8c5e('0x4'));var attributes=require(_0x8c5e('0x5'));module[_0x8c5e('0x6')]=function(_0x3c7ea9,_0x2cde4e){return _0x3c7ea9[_0x8c5e('0x7')]('AnalyticFieldReport',attributes,{'tableName':_0x8c5e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4ca=['AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xe4ca,0x1d0));var _0xae4c=function(_0x390aca,_0x25ea70){_0x390aca=_0x390aca-0x0;var _0x48eeba=_0xe4ca[_0x390aca];return _0x48eeba;};'use strict';var _=require(_0xae4c('0x0'));var util=require(_0xae4c('0x1'));var logger=require(_0xae4c('0x2'))(_0xae4c('0x3'));var moment=require(_0xae4c('0x4'));var BPromise=require(_0xae4c('0x5'));var rp=require(_0xae4c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae4c('0x7'));var config=require(_0xae4c('0x8'));var attributes=require(_0xae4c('0x9'));module[_0xae4c('0xa')]=function(_0xa81304,_0x189e31){return _0xa81304[_0xae4c('0xb')](_0xae4c('0xc'),attributes,{'tableName':_0xae4c('0xd'),'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 e020adb..8300c39 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 _0xc252=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x3c1b1a,_0x5114b6){var _0x243e34=function(_0x52b16d){while(--_0x52b16d){_0x3c1b1a['push'](_0x3c1b1a['shift']());}};_0x243e34(++_0x5114b6);}(_0xc252,0x13d));var _0x2c25=function(_0x161869,_0x2d5af0){_0x161869=_0x161869-0x0;var _0x340132=_0xc252[_0x161869];return _0x340132;};'use strict';var _=require(_0x2c25('0x0'));var util=require(_0x2c25('0x1'));var moment=require(_0x2c25('0x2'));var BPromise=require(_0x2c25('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c25('0x4'));var db=require(_0x2c25('0x5'))['db'];var utils=require(_0x2c25('0x6'));var logger=require(_0x2c25('0x7'))(_0x2c25('0x8'));var config=require(_0x2c25('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2c25('0xa')][_0x2c25('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30f8e7,_0x1e58f8,_0x55a9f4){return new BPromise(function(_0x594e70,_0x24f2a6){return client['request'](_0x30f8e7,_0x55a9f4)[_0x2c25('0xc')](function(_0x35ca25){logger[_0x2c25('0xd')](_0x2c25('0xe'),_0x1e58f8,_0x2c25('0xf'));logger[_0x2c25('0x10')](_0x2c25('0x11'),_0x1e58f8,_0x2c25('0xf'),JSON[_0x2c25('0x12')](_0x35ca25));if(_0x35ca25[_0x2c25('0x13')]){if(_0x35ca25[_0x2c25('0x13')]['code']===0x1f4){logger[_0x2c25('0x13')](_0x2c25('0xe'),_0x1e58f8,_0x35ca25['error']['message']);return _0x24f2a6(_0x35ca25[_0x2c25('0x13')][_0x2c25('0x14')]);}logger[_0x2c25('0x13')](_0x2c25('0xe'),_0x1e58f8,_0x35ca25[_0x2c25('0x13')][_0x2c25('0x14')]);return _0x594e70(_0x35ca25['error'][_0x2c25('0x14')]);}else{logger[_0x2c25('0xd')](_0x2c25('0xe'),_0x1e58f8,_0x2c25('0xf'));_0x594e70(_0x35ca25[_0x2c25('0x15')][_0x2c25('0x14')]);}})[_0x2c25('0x16')](function(_0x110adc){logger[_0x2c25('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1e58f8,_0x110adc);_0x24f2a6(_0x110adc);});});} \ No newline at end of file +var _0xdff5=['then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xdff5,0x163));var _0x5dff=function(_0x4200ac,_0x54fa9a){_0x4200ac=_0x4200ac-0x0;var _0x464fa6=_0xdff5[_0x4200ac];return _0x464fa6;};'use strict';var _=require(_0x5dff('0x0'));var util=require(_0x5dff('0x1'));var moment=require(_0x5dff('0x2'));var BPromise=require(_0x5dff('0x3'));var rs=require(_0x5dff('0x4'));var fs=require('fs');var Redis=require(_0x5dff('0x5'));var db=require(_0x5dff('0x6'))['db'];var utils=require(_0x5dff('0x7'));var logger=require(_0x5dff('0x8'))(_0x5dff('0x9'));var config=require(_0x5dff('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5dff('0xb')][_0x5dff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x47f214,_0x28c000,_0x22401d){return new BPromise(function(_0x1362fa,_0x1bffdd){return client['request'](_0x47f214,_0x22401d)[_0x5dff('0xd')](function(_0x557484){logger[_0x5dff('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x28c000,_0x5dff('0xf'));logger[_0x5dff('0x10')](_0x5dff('0x11'),_0x28c000,'request\x20sent',JSON['stringify'](_0x557484));if(_0x557484[_0x5dff('0x12')]){if(_0x557484[_0x5dff('0x12')]['code']===0x1f4){logger[_0x5dff('0x12')](_0x5dff('0x13'),_0x28c000,_0x557484['error'][_0x5dff('0x14')]);return _0x1bffdd(_0x557484['error'][_0x5dff('0x14')]);}logger[_0x5dff('0x12')](_0x5dff('0x13'),_0x28c000,_0x557484[_0x5dff('0x12')]['message']);return _0x1362fa(_0x557484['error'][_0x5dff('0x14')]);}else{logger[_0x5dff('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x28c000,_0x5dff('0xf'));_0x1362fa(_0x557484[_0x5dff('0x15')]['message']);}})[_0x5dff('0x16')](function(_0x28fadf){logger['error'](_0x5dff('0x13'),_0x28c000,_0x28fadf);_0x1bffdd(_0x28fadf);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index c19c1b5..9745f39 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(_0x1471bf,_0x56c476){var _0x3248d0=function(_0x2ca09c){while(--_0x2ca09c){_0x1471bf['push'](_0x1471bf['shift']());}};_0x3248d0(++_0x56c476);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x61691a,_0x1ed4e4){var _0x3d8612=function(_0x519d63){while(--_0x519d63){_0x61691a['push'](_0x61691a['shift']());}};_0x3d8612(++_0x1ed4e4);}(_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['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 d3ea884..b6c966c 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 _0x705f=['TEXT','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x705f,0x75));var _0xf705=function(_0x212348,_0x55415c){_0x212348=_0x212348-0x0;var _0x1696e9=_0x705f[_0x212348];return _0x1696e9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf705('0x0')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xf705('0x0')]},'metric':{'type':Sequelize[_0xf705('0x1')]},'description':{'type':Sequelize[_0xf705('0x0')]}}; \ No newline at end of file +var _0x4ffe=['STRING','TEXT','sequelize','exports'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x4ffe,0x172));var _0xe4ff=function(_0x4fa892,_0x4e66a0){_0x4fa892=_0x4fa892-0x0;var _0x260ef6=_0x4ffe[_0x4fa892];return _0x260ef6;};'use strict';var Sequelize=require(_0xe4ff('0x0'));module[_0xe4ff('0x1')]={'name':{'type':Sequelize[_0xe4ff('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xe4ff('0x2')]},'metric':{'type':Sequelize[_0xe4ff('0x3')]},'description':{'type':Sequelize[_0xe4ff('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index fb8bf77..215998a 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 _0x84ab=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Metrics','UserProfileResource','error','stack','name','map','AnalyticMetric','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','include','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0x84ab,0x12f));var _0xb84a=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x84ab[_0x31e29a];return _0x32d892;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){var _0x1aab7d=_0x3aa06f[_0xb84a('0x24')]({'plain':!![]});var _0x409df0=_0xb84a('0x25');return db[_0xb84a('0x26')][_0xb84a('0x23')]({'where':{'type':_0x409df0,'resourceId':_0x1aab7d['id']}})[_0xb84a('0x22')](function(){return _0x3aa06f;});})[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x1db72c,_0x2fe40d){return function(_0x35d1f7){if(!_0x35d1f7){_0x1db72c[_0xb84a('0x16')](0x194);}return _0x35d1f7;};}function handleError(_0x97d71b,_0x5349ea){_0x5349ea=_0x5349ea||0x1f4;return function(_0x582954){logger[_0xb84a('0x27')](_0x582954[_0xb84a('0x28')]);if(_0x582954['name']){delete _0x582954[_0xb84a('0x29')];}_0x97d71b[_0xb84a('0x17')](_0x5349ea)['send'](_0x582954);};}exports['index']=function(_0x28f2e7,_0x8e9319){var _0x49ba3d={},_0x251778={},_0xba1147={'count':0x0,'rows':[]};var _0x3abc22=_[_0xb84a('0x2a')](db[_0xb84a('0x2b')][_0xb84a('0x2c')],function(_0x34b212){return{'name':_0x34b212[_0xb84a('0x2d')],'type':_0x34b212['type'][_0xb84a('0x2e')]};});_0x251778['model']=_['map'](_0x3abc22,_0xb84a('0x29'));_0x251778[_0xb84a('0x2f')]=_['keys'](_0x28f2e7['query']);_0x251778[_0xb84a('0x30')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],_0x251778[_0xb84a('0x2f')]);_0x49ba3d[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],qs[_0xb84a('0x34')](_0x28f2e7['query'][_0xb84a('0x34')]));_0x49ba3d[_0xb84a('0x33')]=_0x49ba3d[_0xb84a('0x33')][_0xb84a('0x35')]?_0x49ba3d[_0xb84a('0x33')]:_0x251778[_0xb84a('0x32')];if(!_0x28f2e7[_0xb84a('0x2f')]['hasOwnProperty'](_0xb84a('0x36'))){_0x49ba3d['limit']=qs[_0xb84a('0x1c')](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x49ba3d['offset']=qs['offset'](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1a')]);}_0x49ba3d[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_0x28f2e7[_0xb84a('0x2f')]['sort']);_0x49ba3d[_0xb84a('0x39')]=qs[_0xb84a('0x30')](_['pick'](_0x28f2e7[_0xb84a('0x2f')],_0x251778[_0xb84a('0x30')]),_0x3abc22);if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3a')]){_0x49ba3d['where']=_['merge'](_0x49ba3d['where'],{'$or':_[_0xb84a('0x2a')](_0x3abc22,function(_0x11e1ac){if(_0x11e1ac[_0xb84a('0x3b')]!==_0xb84a('0x3c')){var _0x55b0b8={};_0x55b0b8[_0x11e1ac[_0xb84a('0x29')]]={'$like':'%'+_0x28f2e7['query'][_0xb84a('0x3a')]+'%'};return _0x55b0b8;}})});}_0x49ba3d=_['merge']({},_0x49ba3d,_0x28f2e7['options']);var _0x59d7a1={'where':_0x49ba3d[_0xb84a('0x39')]};return db[_0xb84a('0x2b')][_0xb84a('0x1d')](_0x59d7a1)[_0xb84a('0x22')](function(_0x5e547e){_0xba1147[_0xb84a('0x1d')]=_0x5e547e;if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x49ba3d[_0xb84a('0x3e')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x49ba3d);})[_0xb84a('0x22')](function(_0x1f3e04){_0xba1147['rows']=_0x1f3e04;return _0xba1147;})[_0xb84a('0x22')](respondWithFilteredResult(_0x8e9319,_0x49ba3d))[_0xb84a('0x3f')](handleError(_0x8e9319,null));};exports[_0xb84a('0x40')]=function(_0x25280a,_0x3f005b){var _0x241536={'raw':!![],'where':{'id':_0x25280a[_0xb84a('0x41')]['id']}},_0x24d700={};_0x24d700[_0xb84a('0x32')]=_[_0xb84a('0x42')](db[_0xb84a('0x2b')][_0xb84a('0x2c')]);_0x24d700[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x25280a[_0xb84a('0x2f')]);_0x24d700['filters']=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],_0x24d700[_0xb84a('0x2f')]);_0x241536[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],qs['fields'](_0x25280a[_0xb84a('0x2f')]['fields']));_0x241536[_0xb84a('0x33')]=_0x241536[_0xb84a('0x33')][_0xb84a('0x35')]?_0x241536[_0xb84a('0x33')]:_0x24d700['model'];if(_0x25280a[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x241536[_0xb84a('0x3e')]=[{'all':!![]}];}_0x241536=_['merge']({},_0x241536,_0x25280a['options']);return db[_0xb84a('0x2b')][_0xb84a('0x43')](_0x241536)[_0xb84a('0x22')](handleEntityNotFound(_0x3f005b,null))['then'](respondWithResult(_0x3f005b,null))['catch'](handleError(_0x3f005b,null));};exports['create']=function(_0x45630d,_0x384a0d){return db[_0xb84a('0x2b')][_0xb84a('0x44')](_0x45630d[_0xb84a('0x45')],{})['then'](function(_0x4b40fe){var _0x5b853a=_0x45630d['user'][_0xb84a('0x24')]({'plain':!![]});if(!_0x5b853a)throw new Error(_0xb84a('0x46'));if(_0x5b853a['role']===_0xb84a('0x47')){var _0xc8bac2=_0x4b40fe[_0xb84a('0x24')]({'plain':!![]});var _0x2f70f0=_0xb84a('0x25');return db[_0xb84a('0x48')]['find']({'where':{'name':_0x2f70f0,'userProfileId':_0x5b853a['userProfileId']},'raw':!![]})[_0xb84a('0x22')](function(_0x50172a){if(_0x50172a&&_0x50172a[_0xb84a('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0xc8bac2['name'],'resourceId':_0xc8bac2['id'],'type':_0x50172a[_0xb84a('0x29')],'sectionId':_0x50172a['id']},{})[_0xb84a('0x22')](function(){return _0x4b40fe;});}else{return _0x4b40fe;}})[_0xb84a('0x3f')](function(_0x25b6a0){logger[_0xb84a('0x27')](_0xb84a('0x4a'),_0x25b6a0);throw _0x25b6a0;});}return _0x4b40fe;})[_0xb84a('0x22')](respondWithResult(_0x384a0d,0xc9))[_0xb84a('0x3f')](handleError(_0x384a0d,null));};exports['update']=function(_0x5afdd0,_0x4c5bdf){if(_0x5afdd0[_0xb84a('0x45')]['id']){delete _0x5afdd0[_0xb84a('0x45')]['id'];}return db['AnalyticMetric'][_0xb84a('0x43')]({'where':{'id':_0x5afdd0['params']['id']}})['then'](handleEntityNotFound(_0x4c5bdf,null))['then'](saveUpdates(_0x5afdd0[_0xb84a('0x45')],null))[_0xb84a('0x22')](respondWithResult(_0x4c5bdf,null))[_0xb84a('0x3f')](handleError(_0x4c5bdf,null));};exports['destroy']=function(_0x5f757e,_0x2e98bf){return db[_0xb84a('0x2b')]['find']({'where':{'id':_0x5f757e[_0xb84a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e98bf,null))['then'](removeEntity(_0x2e98bf,null))[_0xb84a('0x3f')](handleError(_0x2e98bf,null));}; \ No newline at end of file +var _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x9489e6,_0x4d5d98){var _0x46fdfc=function(_0x524818){while(--_0x524818){_0x9489e6['push'](_0x9489e6['shift']());}};_0x46fdfc(++_0x4d5d98);}(_0xf2ca,0x16a));var _0xaf2c=function(_0xf58718,_0x33541a){_0xf58718=_0xf58718-0x0;var _0x5aea10=_0xf2ca[_0xf58718];return _0x5aea10;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 5949587..e7d1322 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 _0xd101=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd101,0xc1));var _0x1d10=function(_0x28f210,_0x4fff00){_0x28f210=_0x28f210-0x0;var _0x2dbf2c=_0xd101[_0x28f210];return _0x2dbf2c;};'use strict';var _=require(_0x1d10('0x0'));var util=require('util');var logger=require(_0x1d10('0x1'))(_0x1d10('0x2'));var moment=require(_0x1d10('0x3'));var BPromise=require(_0x1d10('0x4'));var rp=require(_0x1d10('0x5'));var fs=require('fs');var path=require(_0x1d10('0x6'));var rimraf=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var attributes=require('./analyticMetric.attributes');module[_0x1d10('0x9')]=function(_0x203072,_0x2a4e2d){return _0x203072[_0x1d10('0xa')](_0x1d10('0xb'),attributes,{'tableName':_0x1d10('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd05=['../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','moment','bluebird','request-promise','path'];(function(_0x4a15ff,_0x44c30d){var _0x26b619=function(_0x1bc3c5){while(--_0x1bc3c5){_0x4a15ff['push'](_0x4a15ff['shift']());}};_0x26b619(++_0x44c30d);}(_0xcd05,0x163));var _0x5cd0=function(_0x754ab4,_0x56daa7){_0x754ab4=_0x754ab4-0x0;var _0x34079a=_0xcd05[_0x754ab4];return _0x34079a;};'use strict';var _=require(_0x5cd0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5cd0('0x1'));var BPromise=require(_0x5cd0('0x2'));var rp=require(_0x5cd0('0x3'));var fs=require('fs');var path=require(_0x5cd0('0x4'));var rimraf=require('rimraf');var config=require(_0x5cd0('0x5'));var attributes=require(_0x5cd0('0x6'));module['exports']=function(_0x47c141,_0x4eea17){return _0x47c141[_0x5cd0('0x7')](_0x5cd0('0x8'),attributes,{'tableName':_0x5cd0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 9137470..fea1fbd 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 _0x0ff9=['info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request'];(function(_0x4c057f,_0x1ed571){var _0x154bbd=function(_0x390c4e){while(--_0x390c4e){_0x4c057f['push'](_0x4c057f['shift']());}};_0x154bbd(++_0x1ed571);}(_0x0ff9,0x1e4));var _0x90ff=function(_0x3dadad,_0x4fc8c5){_0x3dadad=_0x3dadad-0x0;var _0x5d3d44=_0x0ff9[_0x3dadad];return _0x5d3d44;};'use strict';var _=require(_0x90ff('0x0'));var util=require(_0x90ff('0x1'));var moment=require(_0x90ff('0x2'));var BPromise=require(_0x90ff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90ff('0x4'))['db'];var utils=require(_0x90ff('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x90ff('0x6'));var jayson=require(_0x90ff('0x7'));var client=jayson[_0x90ff('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3612b2,_0x4b80c0,_0x5e7e78){return new BPromise(function(_0x481d3e,_0x3b74de){return client[_0x90ff('0x9')](_0x3612b2,_0x5e7e78)['then'](function(_0x22cdb6){logger[_0x90ff('0xa')](_0x90ff('0xb'),_0x4b80c0,'request\x20sent');logger[_0x90ff('0xc')](_0x90ff('0xd'),_0x4b80c0,'request\x20sent',JSON[_0x90ff('0xe')](_0x22cdb6));if(_0x22cdb6[_0x90ff('0xf')]){if(_0x22cdb6[_0x90ff('0xf')][_0x90ff('0x10')]===0x1f4){logger['error'](_0x90ff('0xb'),_0x4b80c0,_0x22cdb6[_0x90ff('0xf')]['message']);return _0x3b74de(_0x22cdb6[_0x90ff('0xf')][_0x90ff('0x11')]);}logger['error'](_0x90ff('0xb'),_0x4b80c0,_0x22cdb6[_0x90ff('0xf')][_0x90ff('0x11')]);return _0x481d3e(_0x22cdb6[_0x90ff('0xf')]['message']);}else{logger['info'](_0x90ff('0xb'),_0x4b80c0,_0x90ff('0x12'));_0x481d3e(_0x22cdb6['result']['message']);}})['catch'](function(_0x1b3862){logger['error'](_0x90ff('0xb'),_0x4b80c0,_0x1b3862);_0x3b74de(_0x1b3862);});});} \ No newline at end of file +var _0x5dc5=['error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1a2921,_0x322c9a){var _0x4dfa0a=function(_0x321865){while(--_0x321865){_0x1a2921['push'](_0x1a2921['shift']());}};_0x4dfa0a(++_0x322c9a);}(_0x5dc5,0x118));var _0x55dc=function(_0x3ffd24,_0xb4fda5){_0x3ffd24=_0x3ffd24-0x0;var _0x1a0867=_0x5dc5[_0x3ffd24];return _0x1a0867;};'use strict';var _=require(_0x55dc('0x0'));var util=require(_0x55dc('0x1'));var moment=require('moment');var BPromise=require(_0x55dc('0x2'));var rs=require(_0x55dc('0x3'));var fs=require('fs');var Redis=require(_0x55dc('0x4'));var db=require(_0x55dc('0x5'))['db'];var utils=require(_0x55dc('0x6'));var logger=require(_0x55dc('0x7'))(_0x55dc('0x8'));var config=require('../../config/environment');var jayson=require(_0x55dc('0x9'));var client=jayson[_0x55dc('0xa')][_0x55dc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4734e0,_0x3bf565,_0x451e5b){return new BPromise(function(_0x2dbc03,_0x7fd8c7){return client['request'](_0x4734e0,_0x451e5b)[_0x55dc('0xc')](function(_0x51f4a4){logger[_0x55dc('0xd')](_0x55dc('0xe'),_0x3bf565,_0x55dc('0xf'));logger[_0x55dc('0x10')](_0x55dc('0x11'),_0x3bf565,_0x55dc('0xf'),JSON[_0x55dc('0x12')](_0x51f4a4));if(_0x51f4a4[_0x55dc('0x13')]){if(_0x51f4a4[_0x55dc('0x13')][_0x55dc('0x14')]===0x1f4){logger[_0x55dc('0x13')](_0x55dc('0xe'),_0x3bf565,_0x51f4a4[_0x55dc('0x13')][_0x55dc('0x15')]);return _0x7fd8c7(_0x51f4a4[_0x55dc('0x13')][_0x55dc('0x15')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3bf565,_0x51f4a4[_0x55dc('0x13')][_0x55dc('0x15')]);return _0x2dbc03(_0x51f4a4[_0x55dc('0x13')][_0x55dc('0x15')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x3bf565,_0x55dc('0xf'));_0x2dbc03(_0x51f4a4[_0x55dc('0x16')][_0x55dc('0x15')]);}})['catch'](function(_0x1a9f11){logger['error'](_0x55dc('0xe'),_0x3bf565,_0x1a9f11);_0x7fd8c7(_0x1a9f11);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index d1a60f0..664151d 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 _0xf961=['fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post','create','delete','destroy','multer','util','path','connect-timeout','Router'];(function(_0x5c1a56,_0x1fa025){var _0xda7488=function(_0x531155){while(--_0x531155){_0x5c1a56['push'](_0x5c1a56['shift']());}};_0xda7488(++_0x1fa025);}(_0xf961,0x1cf));var _0x1f96=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xf961[_0x50aa2e];return _0x5e07f0;};'use strict';var multer=require(_0x1f96('0x0'));var util=require(_0x1f96('0x1'));var path=require(_0x1f96('0x2'));var timeout=require(_0x1f96('0x3'));var express=require('express');var router=express[_0x1f96('0x4')]();var fs_extra=require(_0x1f96('0x5'));var auth=require(_0x1f96('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1f96('0x7'));var controller=require(_0x1f96('0x8'));router[_0x1f96('0x9')]('/',auth['isAuthenticated'](),controller[_0x1f96('0xa')]);router['get'](_0x1f96('0xb'),auth[_0x1f96('0xc')](),controller[_0x1f96('0xd')]);router[_0x1f96('0xe')]('/',auth[_0x1f96('0xc')](),controller[_0x1f96('0xf')]);router['put']('/:id',auth[_0x1f96('0xc')](),controller['update']);router[_0x1f96('0x10')](_0x1f96('0xb'),auth[_0x1f96('0xc')](),controller[_0x1f96('0x11')]);module['exports']=router; \ No newline at end of file +var _0xfafd=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3768f3,_0x4a40f1){var _0x526a13=function(_0x350126){while(--_0x350126){_0x3768f3['push'](_0x3768f3['shift']());}};_0x526a13(++_0x4a40f1);}(_0xfafd,0xcc));var _0xdfaf=function(_0x41fdcd,_0x2fa74b){_0x41fdcd=_0x41fdcd-0x0;var _0x1f3ed5=_0xfafd[_0x41fdcd];return _0x1f3ed5;};'use strict';var multer=require('multer');var util=require(_0xdfaf('0x0'));var path=require(_0xdfaf('0x1'));var timeout=require(_0xdfaf('0x2'));var express=require(_0xdfaf('0x3'));var router=express[_0xdfaf('0x4')]();var fs_extra=require(_0xdfaf('0x5'));var auth=require(_0xdfaf('0x6'));var interaction=require(_0xdfaf('0x7'));var config=require(_0xdfaf('0x8'));var controller=require(_0xdfaf('0x9'));router[_0xdfaf('0xa')]('/',auth[_0xdfaf('0xb')](),controller[_0xdfaf('0xc')]);router[_0xdfaf('0xa')](_0xdfaf('0xd'),auth['isAuthenticated'](),controller[_0xdfaf('0xe')]);router[_0xdfaf('0xf')]('/',auth[_0xdfaf('0xb')](),controller[_0xdfaf('0x10')]);router[_0xdfaf('0x11')](_0xdfaf('0xd'),auth[_0xdfaf('0xb')](),controller[_0xdfaf('0x12')]);router['delete'](_0xdfaf('0xd'),auth[_0xdfaf('0xb')](),controller[_0xdfaf('0x13')]);module[_0xdfaf('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index bbc6bde..111325a 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 _0x3448=['sequelize','exports'];(function(_0x5070c4,_0x30860a){var _0x85df53=function(_0x549ec5){while(--_0x549ec5){_0x5070c4['push'](_0x5070c4['shift']());}};_0x85df53(++_0x30860a);}(_0x3448,0x1ba));var _0x8344=function(_0x5375bd,_0x16783b){_0x5375bd=_0x5375bd-0x0;var _0x15b903=_0x3448[_0x5375bd];return _0x15b903;};'use strict';var Sequelize=require(_0x8344('0x0'));module[_0x8344('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x5a1f=['TEXT','sequelize','exports'];(function(_0xeec67d,_0x1c629a){var _0x17e958=function(_0x3096e4){while(--_0x3096e4){_0xeec67d['push'](_0xeec67d['shift']());}};_0x17e958(++_0x1c629a);}(_0x5a1f,0x19c));var _0xf5a1=function(_0x4ead60,_0x1f3ef7){_0x4ead60=_0x4ead60-0x0;var _0x172fef=_0x5a1f[_0x4ead60];return _0x172fef;};'use strict';var Sequelize=require(_0xf5a1('0x0'));module[_0xf5a1('0x1')]={'tree':{'type':Sequelize[_0xf5a1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 939a15e..5471867 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 _0x6b6b=['AnalyticTreeReport','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','json','offset','limit','count','status','Content-Range','apply','save','update','destroy','end','error','stack','name','send','index','map'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x6b6b,0x65));var _0xb6b6=function(_0xfdbaf0,_0x45f455){_0xfdbaf0=_0xfdbaf0-0x0;var _0x314a46=_0x6b6b[_0xfdbaf0];return _0x314a46;};'use strict';var emlformat=require(_0xb6b6('0x0'));var rimraf=require(_0xb6b6('0x1'));var zipdir=require(_0xb6b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb6b6('0x3'));var Mustache=require(_0xb6b6('0x4'));var util=require('util');var path=require(_0xb6b6('0x5'));var sox=require(_0xb6b6('0x6'));var csv=require(_0xb6b6('0x7'));var ejs=require(_0xb6b6('0x8'));var fs=require('fs');var fs_extra=require(_0xb6b6('0x9'));var _=require('lodash');var squel=require(_0xb6b6('0xa'));var crypto=require(_0xb6b6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb6b6('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb6b6('0xd'));var Papa=require(_0xb6b6('0xe'));var Redis=require(_0xb6b6('0xf'));var authService=require(_0xb6b6('0x10'));var qs=require(_0xb6b6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb6b6('0x12'));var utils=require(_0xb6b6('0x13'));var config=require(_0xb6b6('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d374f,_0x275803){_0x275803=_0x275803||0xcc;return function(_0x1187f4){if(_0x1187f4){return _0x3d374f[_0xb6b6('0x15')](_0x275803);}return _0x3d374f['status'](_0x275803)['end']();};}function respondWithResult(_0x25db48,_0xb59d2f){_0xb59d2f=_0xb59d2f||0xc8;return function(_0x41dce1){if(_0x41dce1){return _0x25db48['status'](_0xb59d2f)[_0xb6b6('0x16')](_0x41dce1);}};}function respondWithFilteredResult(_0x390290,_0x5f36e2){return function(_0x103d88){if(_0x103d88){var _0x4bb820=typeof _0x5f36e2[_0xb6b6('0x17')]==='undefined'&&typeof _0x5f36e2[_0xb6b6('0x18')]==='undefined';var _0xd36604=_0x103d88[_0xb6b6('0x19')];var _0x15ed2d=_0x4bb820?0x0:_0x5f36e2[_0xb6b6('0x17')];var _0x5e0feb=_0x4bb820?_0x103d88[_0xb6b6('0x19')]:_0x5f36e2[_0xb6b6('0x17')]+_0x5f36e2[_0xb6b6('0x18')];var _0x643870;if(_0x5e0feb>=_0xd36604){_0x5e0feb=_0xd36604;_0x643870=0xc8;}else{_0x643870=0xce;}_0x390290[_0xb6b6('0x1a')](_0x643870);return _0x390290['set'](_0xb6b6('0x1b'),_0x15ed2d+'-'+_0x5e0feb+'/'+_0xd36604)['json'](_0x103d88);}return null;};}function patchUpdates(_0x525b79){return function(_0x2df5f0){try{jsonpatch[_0xb6b6('0x1c')](_0x2df5f0,_0x525b79,!![]);}catch(_0x4fb7e8){return BPromise['reject'](_0x4fb7e8);}return _0x2df5f0[_0xb6b6('0x1d')]();};}function saveUpdates(_0x21bf2c,_0x37bb80){return function(_0x5deaf8){if(_0x5deaf8){return _0x5deaf8[_0xb6b6('0x1e')](_0x21bf2c)['then'](function(_0x52345b){return _0x52345b;});}return null;};}function removeEntity(_0x25823b,_0x157ced){return function(_0x3db076){if(_0x3db076){return _0x3db076[_0xb6b6('0x1f')]()['then'](function(){_0x25823b[_0xb6b6('0x1a')](0xcc)[_0xb6b6('0x20')]();});}};}function handleEntityNotFound(_0x23aed6,_0x6ab7e2){return function(_0x314c77){if(!_0x314c77){_0x23aed6[_0xb6b6('0x15')](0x194);}return _0x314c77;};}function handleError(_0x43ff83,_0x55c578){_0x55c578=_0x55c578||0x1f4;return function(_0x429915){logger[_0xb6b6('0x21')](_0x429915[_0xb6b6('0x22')]);if(_0x429915[_0xb6b6('0x23')]){delete _0x429915['name'];}_0x43ff83[_0xb6b6('0x1a')](_0x55c578)[_0xb6b6('0x24')](_0x429915);};}exports[_0xb6b6('0x25')]=function(_0x1864c5,_0x4d4d05){var _0x1a567a={},_0x587cdd={},_0x1cd6bb={'count':0x0,'rows':[]};var _0x2ba2aa=_[_0xb6b6('0x26')](db[_0xb6b6('0x27')][_0xb6b6('0x28')],function(_0x15c0aa){return{'name':_0x15c0aa['fieldName'],'type':_0x15c0aa[_0xb6b6('0x29')]['key']};});_0x587cdd[_0xb6b6('0x2a')]=_[_0xb6b6('0x26')](_0x2ba2aa,_0xb6b6('0x23'));_0x587cdd[_0xb6b6('0x2b')]=_['keys'](_0x1864c5[_0xb6b6('0x2b')]);_0x587cdd['filters']=_[_0xb6b6('0x2c')](_0x587cdd[_0xb6b6('0x2a')],_0x587cdd[_0xb6b6('0x2b')]);_0x1a567a[_0xb6b6('0x2d')]=_['intersection'](_0x587cdd[_0xb6b6('0x2a')],qs[_0xb6b6('0x2e')](_0x1864c5[_0xb6b6('0x2b')]['fields']));_0x1a567a['attributes']=_0x1a567a[_0xb6b6('0x2d')][_0xb6b6('0x2f')]?_0x1a567a['attributes']:_0x587cdd[_0xb6b6('0x2a')];if(!_0x1864c5[_0xb6b6('0x2b')][_0xb6b6('0x30')]('nolimit')){_0x1a567a['limit']=qs[_0xb6b6('0x18')](_0x1864c5[_0xb6b6('0x2b')][_0xb6b6('0x18')]);_0x1a567a[_0xb6b6('0x17')]=qs['offset'](_0x1864c5[_0xb6b6('0x2b')][_0xb6b6('0x17')]);}_0x1a567a[_0xb6b6('0x31')]=qs[_0xb6b6('0x32')](_0x1864c5[_0xb6b6('0x2b')][_0xb6b6('0x32')]);_0x1a567a['where']=qs[_0xb6b6('0x33')](_[_0xb6b6('0x34')](_0x1864c5[_0xb6b6('0x2b')],_0x587cdd[_0xb6b6('0x33')]),_0x2ba2aa);if(_0x1864c5['query'][_0xb6b6('0x35')]){_0x1a567a['where']=_['merge'](_0x1a567a[_0xb6b6('0x36')],{'$or':_['map'](_0x2ba2aa,function(_0x34cb1c){if(_0x34cb1c[_0xb6b6('0x29')]!==_0xb6b6('0x37')){var _0x2fc816={};_0x2fc816[_0x34cb1c['name']]={'$like':'%'+_0x1864c5[_0xb6b6('0x2b')][_0xb6b6('0x35')]+'%'};return _0x2fc816;}})});}_0x1a567a=_[_0xb6b6('0x38')]({},_0x1a567a,_0x1864c5[_0xb6b6('0x39')]);var _0x578f06={'where':_0x1a567a[_0xb6b6('0x36')]};return db[_0xb6b6('0x27')][_0xb6b6('0x19')](_0x578f06)[_0xb6b6('0x3a')](function(_0x47ca4d){_0x1cd6bb['count']=_0x47ca4d;if(_0x1864c5['query'][_0xb6b6('0x3b')]){_0x1a567a[_0xb6b6('0x3c')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xb6b6('0x3d')](_0x1a567a);})[_0xb6b6('0x3a')](function(_0x48fc7d){_0x1cd6bb[_0xb6b6('0x3e')]=_0x48fc7d;return _0x1cd6bb;})[_0xb6b6('0x3a')](respondWithFilteredResult(_0x4d4d05,_0x1a567a))[_0xb6b6('0x3f')](handleError(_0x4d4d05,null));};exports[_0xb6b6('0x40')]=function(_0x2b9b5e,_0xacb628){var _0x1badbf={'raw':!![],'where':{'id':_0x2b9b5e[_0xb6b6('0x41')]['id']}},_0x415821={};_0x415821[_0xb6b6('0x2a')]=_[_0xb6b6('0x42')](db[_0xb6b6('0x27')]['rawAttributes']);_0x415821[_0xb6b6('0x2b')]=_[_0xb6b6('0x42')](_0x2b9b5e[_0xb6b6('0x2b')]);_0x415821[_0xb6b6('0x33')]=_[_0xb6b6('0x2c')](_0x415821[_0xb6b6('0x2a')],_0x415821[_0xb6b6('0x2b')]);_0x1badbf[_0xb6b6('0x2d')]=_[_0xb6b6('0x2c')](_0x415821[_0xb6b6('0x2a')],qs[_0xb6b6('0x2e')](_0x2b9b5e['query']['fields']));_0x1badbf[_0xb6b6('0x2d')]=_0x1badbf['attributes'][_0xb6b6('0x2f')]?_0x1badbf[_0xb6b6('0x2d')]:_0x415821[_0xb6b6('0x2a')];if(_0x2b9b5e['query']['includeAll']){_0x1badbf[_0xb6b6('0x3c')]=[{'all':!![]}];}_0x1badbf=_[_0xb6b6('0x38')]({},_0x1badbf,_0x2b9b5e[_0xb6b6('0x39')]);return db[_0xb6b6('0x27')][_0xb6b6('0x43')](_0x1badbf)['then'](handleEntityNotFound(_0xacb628,null))[_0xb6b6('0x3a')](respondWithResult(_0xacb628,null))[_0xb6b6('0x3f')](handleError(_0xacb628,null));};exports[_0xb6b6('0x44')]=function(_0x2caa34,_0xd4bb26){return db[_0xb6b6('0x27')][_0xb6b6('0x44')](_0x2caa34['body'],{})[_0xb6b6('0x3a')](respondWithResult(_0xd4bb26,0xc9))['catch'](handleError(_0xd4bb26,null));};exports[_0xb6b6('0x1e')]=function(_0x355dcc,_0x39050e){if(_0x355dcc[_0xb6b6('0x45')]['id']){delete _0x355dcc['body']['id'];}return db[_0xb6b6('0x27')][_0xb6b6('0x43')]({'where':{'id':_0x355dcc[_0xb6b6('0x41')]['id']}})[_0xb6b6('0x3a')](handleEntityNotFound(_0x39050e,null))[_0xb6b6('0x3a')](saveUpdates(_0x355dcc[_0xb6b6('0x45')],null))[_0xb6b6('0x3a')](respondWithResult(_0x39050e,null))[_0xb6b6('0x3f')](handleError(_0x39050e,null));};exports[_0xb6b6('0x1f')]=function(_0x58c079,_0x3f2c14){return db['AnalyticTreeReport'][_0xb6b6('0x43')]({'where':{'id':_0x58c079[_0xb6b6('0x41')]['id']}})[_0xb6b6('0x3a')](handleEntityNotFound(_0x3f2c14,null))[_0xb6b6('0x3a')](removeEntity(_0x3f2c14,null))[_0xb6b6('0x3f')](handleError(_0x3f2c14,null));}; \ No newline at end of file +var _0x0fed=['show','params','rawAttributes','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','map','AnalyticTreeReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows'];(function(_0x2418e0,_0x7215b0){var _0x55ffbf=function(_0x4fc0ec){while(--_0x4fc0ec){_0x2418e0['push'](_0x2418e0['shift']());}};_0x55ffbf(++_0x7215b0);}(_0x0fed,0xdb));var _0xd0fe=function(_0x20234e,_0x384a42){_0x20234e=_0x20234e-0x0;var _0x4df7c4=_0x0fed[_0x20234e];return _0x4df7c4;};'use strict';var emlformat=require(_0xd0fe('0x0'));var rimraf=require(_0xd0fe('0x1'));var zipdir=require(_0xd0fe('0x2'));var jsonpatch=require(_0xd0fe('0x3'));var rp=require(_0xd0fe('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd0fe('0x5'));var util=require(_0xd0fe('0x6'));var path=require(_0xd0fe('0x7'));var sox=require('sox');var csv=require(_0xd0fe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0fe('0x9'));var squel=require(_0xd0fe('0xa'));var crypto=require(_0xd0fe('0xb'));var jsforce=require(_0xd0fe('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd0fe('0x8'));var querystring=require(_0xd0fe('0xd'));var Papa=require('papaparse');var Redis=require(_0xd0fe('0xe'));var authService=require(_0xd0fe('0xf'));var qs=require(_0xd0fe('0x10'));var as=require(_0xd0fe('0x11'));var hardwareService=require(_0xd0fe('0x12'));var logger=require(_0xd0fe('0x13'))(_0xd0fe('0x14'));var utils=require(_0xd0fe('0x15'));var config=require(_0xd0fe('0x16'));var licenseUtil=require(_0xd0fe('0x17'));var db=require(_0xd0fe('0x18'))['db'];function respondWithStatusCode(_0x51ca1e,_0x44eb4b){_0x44eb4b=_0x44eb4b||0xcc;return function(_0x2f231d){if(_0x2f231d){return _0x51ca1e['sendStatus'](_0x44eb4b);}return _0x51ca1e[_0xd0fe('0x19')](_0x44eb4b)[_0xd0fe('0x1a')]();};}function respondWithResult(_0x263599,_0x1afc6e){_0x1afc6e=_0x1afc6e||0xc8;return function(_0x3da337){if(_0x3da337){return _0x263599[_0xd0fe('0x19')](_0x1afc6e)[_0xd0fe('0x1b')](_0x3da337);}};}function respondWithFilteredResult(_0x498e87,_0x36f6cb){return function(_0x6109f){if(_0x6109f){var _0x4bcfdb=typeof _0x36f6cb[_0xd0fe('0x1c')]===_0xd0fe('0x1d')&&typeof _0x36f6cb['limit']===_0xd0fe('0x1d');var _0x378ae7=_0x6109f[_0xd0fe('0x1e')];var _0x8283b4=_0x4bcfdb?0x0:_0x36f6cb[_0xd0fe('0x1c')];var _0x129072=_0x4bcfdb?_0x6109f[_0xd0fe('0x1e')]:_0x36f6cb[_0xd0fe('0x1c')]+_0x36f6cb[_0xd0fe('0x1f')];var _0x5a9be4;if(_0x129072>=_0x378ae7){_0x129072=_0x378ae7;_0x5a9be4=0xc8;}else{_0x5a9be4=0xce;}_0x498e87['status'](_0x5a9be4);return _0x498e87[_0xd0fe('0x20')](_0xd0fe('0x21'),_0x8283b4+'-'+_0x129072+'/'+_0x378ae7)[_0xd0fe('0x1b')](_0x6109f);}return null;};}function patchUpdates(_0x5591bb){return function(_0x589403){try{jsonpatch['apply'](_0x589403,_0x5591bb,!![]);}catch(_0x2a6794){return BPromise['reject'](_0x2a6794);}return _0x589403['save']();};}function saveUpdates(_0x190ee7,_0x450a04){return function(_0x34e7d9){if(_0x34e7d9){return _0x34e7d9[_0xd0fe('0x22')](_0x190ee7)[_0xd0fe('0x23')](function(_0x109527){return _0x109527;});}return null;};}function removeEntity(_0x2ef217,_0x7c6127){return function(_0x36827e){if(_0x36827e){return _0x36827e[_0xd0fe('0x24')]()[_0xd0fe('0x23')](function(){_0x2ef217[_0xd0fe('0x19')](0xcc)[_0xd0fe('0x1a')]();});}};}function handleEntityNotFound(_0x12c934,_0x51e2a9){return function(_0x3d1ad0){if(!_0x3d1ad0){_0x12c934[_0xd0fe('0x25')](0x194);}return _0x3d1ad0;};}function handleError(_0x543923,_0x5d12cd){_0x5d12cd=_0x5d12cd||0x1f4;return function(_0x134662){logger[_0xd0fe('0x26')](_0x134662[_0xd0fe('0x27')]);if(_0x134662['name']){delete _0x134662[_0xd0fe('0x28')];}_0x543923[_0xd0fe('0x19')](_0x5d12cd)['send'](_0x134662);};}exports['index']=function(_0x337cb5,_0x237289){var _0x5ac605={},_0xcd8164={},_0x1d470e={'count':0x0,'rows':[]};var _0x5a7dbb=_[_0xd0fe('0x29')](db[_0xd0fe('0x2a')]['rawAttributes'],function(_0x2f781d){return{'name':_0x2f781d[_0xd0fe('0x2b')],'type':_0x2f781d[_0xd0fe('0x2c')][_0xd0fe('0x2d')]};});_0xcd8164[_0xd0fe('0x2e')]=_['map'](_0x5a7dbb,'name');_0xcd8164[_0xd0fe('0x2f')]=_[_0xd0fe('0x30')](_0x337cb5['query']);_0xcd8164[_0xd0fe('0x31')]=_[_0xd0fe('0x32')](_0xcd8164[_0xd0fe('0x2e')],_0xcd8164['query']);_0x5ac605[_0xd0fe('0x33')]=_['intersection'](_0xcd8164[_0xd0fe('0x2e')],qs[_0xd0fe('0x34')](_0x337cb5['query'][_0xd0fe('0x34')]));_0x5ac605[_0xd0fe('0x33')]=_0x5ac605[_0xd0fe('0x33')][_0xd0fe('0x35')]?_0x5ac605[_0xd0fe('0x33')]:_0xcd8164['model'];if(!_0x337cb5['query']['hasOwnProperty'](_0xd0fe('0x36'))){_0x5ac605[_0xd0fe('0x1f')]=qs[_0xd0fe('0x1f')](_0x337cb5[_0xd0fe('0x2f')][_0xd0fe('0x1f')]);_0x5ac605[_0xd0fe('0x1c')]=qs[_0xd0fe('0x1c')](_0x337cb5['query'][_0xd0fe('0x1c')]);}_0x5ac605['order']=qs[_0xd0fe('0x37')](_0x337cb5[_0xd0fe('0x2f')][_0xd0fe('0x37')]);_0x5ac605[_0xd0fe('0x38')]=qs[_0xd0fe('0x31')](_[_0xd0fe('0x39')](_0x337cb5[_0xd0fe('0x2f')],_0xcd8164[_0xd0fe('0x31')]),_0x5a7dbb);if(_0x337cb5['query'][_0xd0fe('0x3a')]){_0x5ac605['where']=_[_0xd0fe('0x3b')](_0x5ac605['where'],{'$or':_[_0xd0fe('0x29')](_0x5a7dbb,function(_0x274e6e){if(_0x274e6e['type']!==_0xd0fe('0x3c')){var _0x34d14f={};_0x34d14f[_0x274e6e[_0xd0fe('0x28')]]={'$like':'%'+_0x337cb5[_0xd0fe('0x2f')][_0xd0fe('0x3a')]+'%'};return _0x34d14f;}})});}_0x5ac605=_['merge']({},_0x5ac605,_0x337cb5[_0xd0fe('0x3d')]);var _0x5d5cb5={'where':_0x5ac605[_0xd0fe('0x38')]};return db[_0xd0fe('0x2a')]['count'](_0x5d5cb5)[_0xd0fe('0x23')](function(_0x451453){_0x1d470e['count']=_0x451453;if(_0x337cb5[_0xd0fe('0x2f')]['includeAll']){_0x5ac605[_0xd0fe('0x3e')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xd0fe('0x3f')](_0x5ac605);})[_0xd0fe('0x23')](function(_0x12050a){_0x1d470e[_0xd0fe('0x40')]=_0x12050a;return _0x1d470e;})[_0xd0fe('0x23')](respondWithFilteredResult(_0x237289,_0x5ac605))['catch'](handleError(_0x237289,null));};exports[_0xd0fe('0x41')]=function(_0x75f0ec,_0x17f87c){var _0x278901={'raw':!![],'where':{'id':_0x75f0ec[_0xd0fe('0x42')]['id']}},_0x4e3960={};_0x4e3960[_0xd0fe('0x2e')]=_[_0xd0fe('0x30')](db[_0xd0fe('0x2a')][_0xd0fe('0x43')]);_0x4e3960[_0xd0fe('0x2f')]=_[_0xd0fe('0x30')](_0x75f0ec[_0xd0fe('0x2f')]);_0x4e3960['filters']=_['intersection'](_0x4e3960['model'],_0x4e3960[_0xd0fe('0x2f')]);_0x278901[_0xd0fe('0x33')]=_[_0xd0fe('0x32')](_0x4e3960[_0xd0fe('0x2e')],qs['fields'](_0x75f0ec[_0xd0fe('0x2f')][_0xd0fe('0x34')]));_0x278901['attributes']=_0x278901[_0xd0fe('0x33')][_0xd0fe('0x35')]?_0x278901['attributes']:_0x4e3960[_0xd0fe('0x2e')];if(_0x75f0ec[_0xd0fe('0x2f')]['includeAll']){_0x278901[_0xd0fe('0x3e')]=[{'all':!![]}];}_0x278901=_['merge']({},_0x278901,_0x75f0ec[_0xd0fe('0x3d')]);return db['AnalyticTreeReport']['find'](_0x278901)['then'](handleEntityNotFound(_0x17f87c,null))[_0xd0fe('0x23')](respondWithResult(_0x17f87c,null))[_0xd0fe('0x44')](handleError(_0x17f87c,null));};exports['create']=function(_0x82ae2,_0x36b03b){return db['AnalyticTreeReport']['create'](_0x82ae2[_0xd0fe('0x45')],{})[_0xd0fe('0x23')](respondWithResult(_0x36b03b,0xc9))[_0xd0fe('0x44')](handleError(_0x36b03b,null));};exports[_0xd0fe('0x22')]=function(_0xf8f21,_0x101830){if(_0xf8f21[_0xd0fe('0x45')]['id']){delete _0xf8f21[_0xd0fe('0x45')]['id'];}return db[_0xd0fe('0x2a')][_0xd0fe('0x46')]({'where':{'id':_0xf8f21[_0xd0fe('0x42')]['id']}})[_0xd0fe('0x23')](handleEntityNotFound(_0x101830,null))[_0xd0fe('0x23')](saveUpdates(_0xf8f21[_0xd0fe('0x45')],null))['then'](respondWithResult(_0x101830,null))[_0xd0fe('0x44')](handleError(_0x101830,null));};exports[_0xd0fe('0x24')]=function(_0x4e7aef,_0x590b55){return db[_0xd0fe('0x2a')][_0xd0fe('0x46')]({'where':{'id':_0x4e7aef[_0xd0fe('0x42')]['id']}})[_0xd0fe('0x23')](handleEntityNotFound(_0x590b55,null))[_0xd0fe('0x23')](removeEntity(_0x590b55,null))[_0xd0fe('0x44')](handleError(_0x590b55,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 6323214..0d5afca 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 _0x9cd3=['request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','bluebird'];(function(_0x466ee9,_0x14111b){var _0x229a84=function(_0x4e9bde){while(--_0x4e9bde){_0x466ee9['push'](_0x466ee9['shift']());}};_0x229a84(++_0x14111b);}(_0x9cd3,0x1c4));var _0x39cd=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x9cd3[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x39cd('0x0'));var util=require(_0x39cd('0x1'));var logger=require(_0x39cd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x39cd('0x3'));var rp=require(_0x39cd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39cd('0x5'));var config=require(_0x39cd('0x6'));var attributes=require(_0x39cd('0x7'));module[_0x39cd('0x8')]=function(_0x4b584a,_0x27280f){return _0x4b584a[_0x39cd('0x9')](_0x39cd('0xa'),attributes,{'tableName':_0x39cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4905=['path','rimraf','../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','request-promise'];(function(_0x301c9f,_0x3da512){var _0x1184ec=function(_0x36cd1a){while(--_0x36cd1a){_0x301c9f['push'](_0x301c9f['shift']());}};_0x1184ec(++_0x3da512);}(_0x4905,0x97));var _0x5490=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x4905[_0x3826ad];return _0x17b900;};'use strict';var _=require(_0x5490('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5490('0x1'));var fs=require('fs');var path=require(_0x5490('0x2'));var rimraf=require(_0x5490('0x3'));var config=require(_0x5490('0x4'));var attributes=require('./analyticTreeReport.attributes');module[_0x5490('0x5')]=function(_0x40354b,_0x1f5641){return _0x40354b[_0x5490('0x6')](_0x5490('0x7'),attributes,{'tableName':_0x5490('0x8'),'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 12de349..fae8218 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x52ad50,_0xb3aacf){var _0x1a8ab3=function(_0x1c3522){while(--_0x1c3522){_0x52ad50['push'](_0x52ad50['shift']());}};_0x1a8ab3(++_0xb3aacf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x21c7bf,_0x58a016){_0x21c7bf=_0x21c7bf-0x0;var _0x5393bf=_0x5f2f[_0x21c7bf];return _0x5393bf;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x59ae59,_0x3351f4){_0x59ae59=_0x59ae59-0x0;var _0x1bd86=_0x7a54[_0x59ae59];return _0x1bd86;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 861e7d6..8435967 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 _0xad0e=['delete','destroy','exports','util','path','connect-timeout','fs-extra','../../config/environment','get','isAuthenticated','/:id','show','post','put'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0xad0e,0x199));var _0xead0=function(_0x46204b,_0x7525fa){_0x46204b=_0x46204b-0x0;var _0x453ddf=_0xad0e[_0x46204b];return _0x453ddf;};'use strict';var multer=require('multer');var util=require(_0xead0('0x0'));var path=require(_0xead0('0x1'));var timeout=require(_0xead0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xead0('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xead0('0x4'));var controller=require('./analyticTreeReport.controller');router[_0xead0('0x5')]('/',auth[_0xead0('0x6')](),controller['index']);router[_0xead0('0x5')](_0xead0('0x7'),auth[_0xead0('0x6')](),controller[_0xead0('0x8')]);router[_0xead0('0x9')]('/',auth[_0xead0('0x6')](),controller['create']);router[_0xead0('0xa')]('/:id',auth[_0xead0('0x6')](),controller['update']);router[_0xead0('0xb')]('/:id',auth[_0xead0('0x6')](),controller[_0xead0('0xc')]);module[_0xead0('0xd')]=router; \ No newline at end of file +var _0x2a9a=['./analyticTreeReport.controller','index','get','/:id','post','isAuthenticated','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2c072e,_0x4b79a2){var _0x354c5d=function(_0x183fcd){while(--_0x183fcd){_0x2c072e['push'](_0x2c072e['shift']());}};_0x354c5d(++_0x4b79a2);}(_0x2a9a,0x8a));var _0xa2a9=function(_0x5215db,_0x4e50bf){_0x5215db=_0x5215db-0x0;var _0x182ef3=_0x2a9a[_0x5215db];return _0x182ef3;};'use strict';var multer=require('multer');var util=require(_0xa2a9('0x0'));var path=require(_0xa2a9('0x1'));var timeout=require(_0xa2a9('0x2'));var express=require(_0xa2a9('0x3'));var router=express[_0xa2a9('0x4')]();var fs_extra=require(_0xa2a9('0x5'));var auth=require(_0xa2a9('0x6'));var interaction=require(_0xa2a9('0x7'));var config=require(_0xa2a9('0x8'));var controller=require(_0xa2a9('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xa2a9('0xa')]);router[_0xa2a9('0xb')](_0xa2a9('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa2a9('0xd')]('/',auth[_0xa2a9('0xe')](),controller[_0xa2a9('0xf')]);router[_0xa2a9('0x10')](_0xa2a9('0xc'),auth[_0xa2a9('0xe')](),controller[_0xa2a9('0x11')]);router[_0xa2a9('0x12')]('/:id',auth[_0xa2a9('0xe')](),controller[_0xa2a9('0x13')]);module[_0xa2a9('0x14')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 4182b04..a9f8d6c 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 _0x1a8f=['STRING','sequelize'];(function(_0xfe7bff,_0x52d136){var _0x43903d=function(_0xe53c7){while(--_0xe53c7){_0xfe7bff['push'](_0xfe7bff['shift']());}};_0x43903d(++_0x52d136);}(_0x1a8f,0x87));var _0xf1a8=function(_0x3f9819,_0x4c2e0b){_0x3f9819=_0x3f9819-0x0;var _0x2700c2=_0x1a8f[_0x3f9819];return _0x2700c2;};'use strict';var Sequelize=require(_0xf1a8('0x0'));module['exports']={'name':{'type':Sequelize[_0xf1a8('0x1')]},'basename':{'type':Sequelize[_0xf1a8('0x1')]},'type':{'type':Sequelize[_0xf1a8('0x1')]}}; \ No newline at end of file +var _0x55a5=['STRING','sequelize'];(function(_0x44a78f,_0x5a23cf){var _0x454def=function(_0x493fcf){while(--_0x493fcf){_0x44a78f['push'](_0x44a78f['shift']());}};_0x454def(++_0x5a23cf);}(_0x55a5,0xf7));var _0x555a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x55a5[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0x555a('0x0'));module['exports']={'name':{'type':Sequelize[_0x555a('0x1')]},'basename':{'type':Sequelize[_0x555a('0x1')]},'type':{'type':Sequelize[_0x555a('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 23144c5..f316e36 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 _0x8796=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','Attachment','findAll','rows','catch','show','params','find','get','omit','createdAt','body','updatedAt','create','file','originalname','basename','filename','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','lodash','squel','to-csv','querystring','ioredis','../../components/parsers/qs'];(function(_0x13e3b6,_0x34af72){var _0x585365=function(_0x1a1cf1){while(--_0x1a1cf1){_0x13e3b6['push'](_0x13e3b6['shift']());}};_0x585365(++_0x34af72);}(_0x8796,0xf9));var _0x6879=function(_0x148e49,_0x1b5a5b){_0x148e49=_0x148e49-0x0;var _0x19223a=_0x8796[_0x148e49];return _0x19223a;};'use strict';var emlformat=require(_0x6879('0x0'));var rimraf=require(_0x6879('0x1'));var zipdir=require(_0x6879('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6879('0x3'));var moment=require('moment');var BPromise=require(_0x6879('0x4'));var Mustache=require('mustache');var util=require(_0x6879('0x5'));var path=require(_0x6879('0x6'));var sox=require(_0x6879('0x7'));var csv=require('to-csv');var ejs=require(_0x6879('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6879('0x9'));var squel=require(_0x6879('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6879('0xb'));var querystring=require(_0x6879('0xc'));var Papa=require('papaparse');var Redis=require(_0x6879('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x6879('0xe'));var as=require(_0x6879('0xf'));var hardwareService=require(_0x6879('0x10'));var logger=require('../../config/logger')(_0x6879('0x11'));var utils=require(_0x6879('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x6879('0x13'));var db=require(_0x6879('0x14'))['db'];function respondWithStatusCode(_0x4ea6af,_0x4695cc){_0x4695cc=_0x4695cc||0xcc;return function(_0xa31883){if(_0xa31883){return _0x4ea6af[_0x6879('0x15')](_0x4695cc);}return _0x4ea6af[_0x6879('0x16')](_0x4695cc)[_0x6879('0x17')]();};}function respondWithResult(_0x3f132b,_0x992b96){_0x992b96=_0x992b96||0xc8;return function(_0x5c748a){if(_0x5c748a){return _0x3f132b[_0x6879('0x16')](_0x992b96)[_0x6879('0x18')](_0x5c748a);}};}function respondWithFilteredResult(_0x2eee1c,_0xa195c4){return function(_0x347193){if(_0x347193){var _0x3c3965=typeof _0xa195c4[_0x6879('0x19')]===_0x6879('0x1a')&&typeof _0xa195c4[_0x6879('0x1b')]===_0x6879('0x1a');var _0x4b8fdc=_0x347193[_0x6879('0x1c')];var _0x2e35a9=_0x3c3965?0x0:_0xa195c4[_0x6879('0x19')];var _0x597e09=_0x3c3965?_0x347193[_0x6879('0x1c')]:_0xa195c4[_0x6879('0x19')]+_0xa195c4[_0x6879('0x1b')];var _0x515def;if(_0x597e09>=_0x4b8fdc){_0x597e09=_0x4b8fdc;_0x515def=0xc8;}else{_0x515def=0xce;}_0x2eee1c[_0x6879('0x16')](_0x515def);return _0x2eee1c[_0x6879('0x1d')]('Content-Range',_0x2e35a9+'-'+_0x597e09+'/'+_0x4b8fdc)[_0x6879('0x18')](_0x347193);}return null;};}function patchUpdates(_0x2ee798){return function(_0x51c562){try{jsonpatch[_0x6879('0x1e')](_0x51c562,_0x2ee798,!![]);}catch(_0x237053){return BPromise[_0x6879('0x1f')](_0x237053);}return _0x51c562['save']();};}function saveUpdates(_0x3831be,_0x3d4313){return function(_0x34a4a6){if(_0x34a4a6){return _0x34a4a6[_0x6879('0x20')](_0x3831be)[_0x6879('0x21')](function(_0x269cd3){return _0x269cd3;});}return null;};}function removeEntity(_0x24592f,_0x69449d){return function(_0x253f14){if(_0x253f14){return _0x253f14[_0x6879('0x22')]()[_0x6879('0x21')](function(){_0x24592f['status'](0xcc)[_0x6879('0x17')]();});}};}function handleEntityNotFound(_0x1fee12,_0x63a464){return function(_0x114e76){if(!_0x114e76){_0x1fee12[_0x6879('0x15')](0x194);}return _0x114e76;};}function handleError(_0x39876c,_0x596e45){_0x596e45=_0x596e45||0x1f4;return function(_0x19e2e6){logger[_0x6879('0x23')](_0x19e2e6[_0x6879('0x24')]);if(_0x19e2e6[_0x6879('0x25')]){delete _0x19e2e6[_0x6879('0x25')];}_0x39876c[_0x6879('0x16')](_0x596e45)[_0x6879('0x26')](_0x19e2e6);};}exports[_0x6879('0x27')]=function(_0x2dc9e2,_0x38f15a){var _0x952e65={},_0x2fb9ea={},_0x143d94={'count':0x0,'rows':[]};var _0x1cc281=_[_0x6879('0x28')](db['Attachment'][_0x6879('0x29')],function(_0x4a8f37){return{'name':_0x4a8f37[_0x6879('0x2a')],'type':_0x4a8f37[_0x6879('0x2b')][_0x6879('0x2c')]};});_0x2fb9ea[_0x6879('0x2d')]=_[_0x6879('0x28')](_0x1cc281,_0x6879('0x25'));_0x2fb9ea[_0x6879('0x2e')]=_[_0x6879('0x2f')](_0x2dc9e2[_0x6879('0x2e')]);_0x2fb9ea[_0x6879('0x30')]=_[_0x6879('0x31')](_0x2fb9ea['model'],_0x2fb9ea['query']);_0x952e65[_0x6879('0x32')]=_['intersection'](_0x2fb9ea[_0x6879('0x2d')],qs[_0x6879('0x33')](_0x2dc9e2[_0x6879('0x2e')]['fields']));_0x952e65[_0x6879('0x32')]=_0x952e65[_0x6879('0x32')][_0x6879('0x34')]?_0x952e65[_0x6879('0x32')]:_0x2fb9ea[_0x6879('0x2d')];if(!_0x2dc9e2[_0x6879('0x2e')][_0x6879('0x35')](_0x6879('0x36'))){_0x952e65[_0x6879('0x1b')]=qs[_0x6879('0x1b')](_0x2dc9e2[_0x6879('0x2e')][_0x6879('0x1b')]);_0x952e65[_0x6879('0x19')]=qs['offset'](_0x2dc9e2[_0x6879('0x2e')][_0x6879('0x19')]);}_0x952e65[_0x6879('0x37')]=qs[_0x6879('0x38')](_0x2dc9e2[_0x6879('0x2e')][_0x6879('0x38')]);_0x952e65[_0x6879('0x39')]=qs['filters'](_[_0x6879('0x3a')](_0x2dc9e2[_0x6879('0x2e')],_0x2fb9ea['filters']),_0x1cc281);if(_0x2dc9e2[_0x6879('0x2e')][_0x6879('0x3b')]){_0x952e65[_0x6879('0x39')]=_[_0x6879('0x3c')](_0x952e65[_0x6879('0x39')],{'$or':_[_0x6879('0x28')](_0x1cc281,function(_0x5d4464){if(_0x5d4464['type']!=='VIRTUAL'){var _0x177153={};_0x177153[_0x5d4464[_0x6879('0x25')]]={'$like':'%'+_0x2dc9e2['query'][_0x6879('0x3b')]+'%'};return _0x177153;}})});}_0x952e65=_[_0x6879('0x3c')]({},_0x952e65,_0x2dc9e2[_0x6879('0x3d')]);var _0x584387={'where':_0x952e65['where']};return db['Attachment'][_0x6879('0x1c')](_0x584387)[_0x6879('0x21')](function(_0x29c483){_0x143d94['count']=_0x29c483;if(_0x2dc9e2['query'][_0x6879('0x3e')]){_0x952e65[_0x6879('0x3f')]=[{'all':!![]}];}return db[_0x6879('0x40')][_0x6879('0x41')](_0x952e65);})[_0x6879('0x21')](function(_0x4fa1ed){_0x143d94[_0x6879('0x42')]=_0x4fa1ed;return _0x143d94;})['then'](respondWithFilteredResult(_0x38f15a,_0x952e65))[_0x6879('0x43')](handleError(_0x38f15a,null));};exports[_0x6879('0x44')]=function(_0x545b9b,_0x2dca71){var _0x96ae2={'raw':!![],'where':{'id':_0x545b9b[_0x6879('0x45')]['id']}},_0x121bce={};_0x121bce[_0x6879('0x2d')]=_[_0x6879('0x2f')](db[_0x6879('0x40')][_0x6879('0x29')]);_0x121bce[_0x6879('0x2e')]=_['keys'](_0x545b9b['query']);_0x121bce[_0x6879('0x30')]=_[_0x6879('0x31')](_0x121bce[_0x6879('0x2d')],_0x121bce[_0x6879('0x2e')]);_0x96ae2['attributes']=_['intersection'](_0x121bce[_0x6879('0x2d')],qs[_0x6879('0x33')](_0x545b9b[_0x6879('0x2e')][_0x6879('0x33')]));_0x96ae2[_0x6879('0x32')]=_0x96ae2[_0x6879('0x32')][_0x6879('0x34')]?_0x96ae2['attributes']:_0x121bce['model'];if(_0x545b9b[_0x6879('0x2e')][_0x6879('0x3e')]){_0x96ae2['include']=[{'all':!![]}];}_0x96ae2=_[_0x6879('0x3c')]({},_0x96ae2,_0x545b9b['options']);return db[_0x6879('0x40')][_0x6879('0x46')](_0x96ae2)['then'](handleEntityNotFound(_0x2dca71,null))['then'](respondWithResult(_0x2dca71,null))['catch'](handleError(_0x2dca71,null));};exports['clone']=function(_0x31fe3d,_0x189476){var _0x1c7927={'where':{'id':_0x31fe3d[_0x6879('0x45')]['id']}},_0x5cd624={};_0x5cd624['model']=_['keys'](db[_0x6879('0x40')][_0x6879('0x29')]);_0x1c7927[_0x6879('0x32')]=_['intersection'](_0x5cd624[_0x6879('0x2d')],qs[_0x6879('0x33')](_0x31fe3d[_0x6879('0x2e')]['fields']));_0x1c7927['attributes']=_0x1c7927[_0x6879('0x32')][_0x6879('0x34')]?_0x1c7927[_0x6879('0x32')]:_0x5cd624[_0x6879('0x2d')];if(_0x31fe3d['query'][_0x6879('0x3e')]){_0x1c7927['include']=[{'all':!![]}];}_0x1c7927=_['merge']({},_0x1c7927,_0x31fe3d['options']);return db[_0x6879('0x40')][_0x6879('0x46')](_0x1c7927)[_0x6879('0x21')](handleEntityNotFound(_0x189476,null))[_0x6879('0x21')](function(_0x2af765){if(_0x2af765){var _0x2175f5=_0x2af765[_0x6879('0x47')]({'plain':!![]});_0x2175f5=qs[_0x6879('0x48')](_0x2175f5,['id',_0x6879('0x49'),'updatedAt']);_0x31fe3d[_0x6879('0x4a')]=_['omit'](_0x31fe3d['body'],['id',_0x6879('0x49'),_0x6879('0x4b')]);return db[_0x6879('0x40')][_0x6879('0x4c')](_[_0x6879('0x3c')](_0x2175f5,_0x31fe3d[_0x6879('0x4a')]),{'include':_0x31fe3d[_0x6879('0x2e')][_0x6879('0x3e')]?[{'all':!![]}]:undefined});}})[_0x6879('0x21')](respondWithResult(_0x189476,0xc9))[_0x6879('0x43')](handleError(_0x189476,null));};exports[_0x6879('0x20')]=function(_0x2fa925,_0x5d8306){if(_0x2fa925[_0x6879('0x4a')]['id']){delete _0x2fa925[_0x6879('0x4a')]['id'];}return db['Attachment'][_0x6879('0x46')]({'where':{'id':_0x2fa925[_0x6879('0x45')]['id']}})['then'](handleEntityNotFound(_0x5d8306,null))['then'](saveUpdates(_0x2fa925[_0x6879('0x4a')],null))[_0x6879('0x21')](respondWithResult(_0x5d8306,null))[_0x6879('0x43')](handleError(_0x5d8306,null));};exports[_0x6879('0x22')]=function(_0x615411,_0x45df7f){return db[_0x6879('0x40')]['find']({'where':{'id':_0x615411[_0x6879('0x45')]['id']}})[_0x6879('0x21')](handleEntityNotFound(_0x45df7f,null))['then'](removeEntity(_0x45df7f,null))['catch'](handleError(_0x45df7f,null));};exports[_0x6879('0x4c')]=function(_0x456098,_0x913929,_0x4b6118){_0x456098['body'][_0x6879('0x25')]=_0x456098[_0x6879('0x4d')][_0x6879('0x4e')];_0x456098[_0x6879('0x4a')][_0x6879('0x4f')]=_0x456098[_0x6879('0x4d')][_0x6879('0x50')];_0x456098['body']['type']=_0x456098[_0x6879('0x4d')]['mimetype'];return db[_0x6879('0x40')][_0x6879('0x4c')](_0x456098[_0x6879('0x4a')])[_0x6879('0x21')](respondWithResult(_0x913929,0xc9))['catch'](handleError(_0x913929,null));};exports[_0x6879('0x51')]=function(_0x33174f,_0x41e403,_0x2b2a99){return db[_0x6879('0x40')][_0x6879('0x52')]({'where':{'id':_0x33174f[_0x6879('0x45')]['id']},'raw':!![]})[_0x6879('0x21')](handleEntityNotFound(_0x41e403,null))[_0x6879('0x21')](function(_0x443025){if(_0x443025){var _0x4f716f=_0x443025[_0x6879('0x53')]!==null;var _0x3b14cf=path[_0x6879('0x54')](config[_0x6879('0x55')],_0x6879('0x56'));if(_0x4f716f){_0x3b14cf=path[_0x6879('0x54')](_0x3b14cf,_0x6879('0x57'));}var _0x560659=path[_0x6879('0x54')](_0x3b14cf,_0x443025[_0x6879('0x4f')]);return _0x41e403['download'](_0x560659);}})[_0x6879('0x43')](handleError(_0x41e403,null));}; \ No newline at end of file +var _0xa324=['../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','options','Attachment','clone','find','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','join','eml-format','zip-dir','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x48e9f2,_0x21fc89){var _0x4bf512=function(_0x23910d){while(--_0x23910d){_0x48e9f2['push'](_0x48e9f2['shift']());}};_0x4bf512(++_0x21fc89);}(_0xa324,0x13d));var _0x4a32=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xa324[_0x2aecb2];return _0x3ebb80;};'use strict';var emlformat=require(_0x4a32('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a32('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4a32('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4a32('0x3'));var sox=require(_0x4a32('0x4'));var csv=require(_0x4a32('0x5'));var ejs=require(_0x4a32('0x6'));var fs=require('fs');var fs_extra=require(_0x4a32('0x7'));var _=require(_0x4a32('0x8'));var squel=require(_0x4a32('0x9'));var crypto=require('crypto');var jsforce=require(_0x4a32('0xa'));var deskjs=require(_0x4a32('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4a32('0xc'));var Redis=require(_0x4a32('0xd'));var authService=require(_0x4a32('0xe'));var qs=require(_0x4a32('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a32('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x4a32('0x11'));var config=require(_0x4a32('0x12'));var licenseUtil=require(_0x4a32('0x13'));var db=require(_0x4a32('0x14'))['db'];function respondWithStatusCode(_0x49841b,_0x51225a){_0x51225a=_0x51225a||0xcc;return function(_0x503c96){if(_0x503c96){return _0x49841b[_0x4a32('0x15')](_0x51225a);}return _0x49841b['status'](_0x51225a)[_0x4a32('0x16')]();};}function respondWithResult(_0x2eee03,_0x2852f6){_0x2852f6=_0x2852f6||0xc8;return function(_0x2592cc){if(_0x2592cc){return _0x2eee03[_0x4a32('0x17')](_0x2852f6)['json'](_0x2592cc);}};}function respondWithFilteredResult(_0xc47424,_0x295c96){return function(_0x4997c8){if(_0x4997c8){var _0x4652e1=typeof _0x295c96[_0x4a32('0x18')]===_0x4a32('0x19')&&typeof _0x295c96['limit']===_0x4a32('0x19');var _0x2896eb=_0x4997c8[_0x4a32('0x1a')];var _0x55f126=_0x4652e1?0x0:_0x295c96[_0x4a32('0x18')];var _0x14323c=_0x4652e1?_0x4997c8[_0x4a32('0x1a')]:_0x295c96[_0x4a32('0x18')]+_0x295c96[_0x4a32('0x1b')];var _0x4057ef;if(_0x14323c>=_0x2896eb){_0x14323c=_0x2896eb;_0x4057ef=0xc8;}else{_0x4057ef=0xce;}_0xc47424[_0x4a32('0x17')](_0x4057ef);return _0xc47424[_0x4a32('0x1c')](_0x4a32('0x1d'),_0x55f126+'-'+_0x14323c+'/'+_0x2896eb)[_0x4a32('0x1e')](_0x4997c8);}return null;};}function patchUpdates(_0x2bcfb2){return function(_0x2688da){try{jsonpatch['apply'](_0x2688da,_0x2bcfb2,!![]);}catch(_0x15fad2){return BPromise[_0x4a32('0x1f')](_0x15fad2);}return _0x2688da[_0x4a32('0x20')]();};}function saveUpdates(_0x364dc5,_0xd763df){return function(_0x174977){if(_0x174977){return _0x174977[_0x4a32('0x21')](_0x364dc5)['then'](function(_0x10a709){return _0x10a709;});}return null;};}function removeEntity(_0x467123,_0x59554c){return function(_0x1c3f85){if(_0x1c3f85){return _0x1c3f85[_0x4a32('0x22')]()[_0x4a32('0x23')](function(){_0x467123['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb400f1,_0x48c3df){return function(_0x49204f){if(!_0x49204f){_0xb400f1[_0x4a32('0x15')](0x194);}return _0x49204f;};}function handleError(_0x313af6,_0x864353){_0x864353=_0x864353||0x1f4;return function(_0x4e8ce4){logger[_0x4a32('0x24')](_0x4e8ce4['stack']);if(_0x4e8ce4[_0x4a32('0x25')]){delete _0x4e8ce4[_0x4a32('0x25')];}_0x313af6['status'](_0x864353)[_0x4a32('0x26')](_0x4e8ce4);};}exports[_0x4a32('0x27')]=function(_0x2b6064,_0x562900){var _0x3ece27={},_0x5f0e7c={},_0x17c7cc={'count':0x0,'rows':[]};var _0x4cf9f9=_[_0x4a32('0x28')](db['Attachment'][_0x4a32('0x29')],function(_0x1cc91b){return{'name':_0x1cc91b[_0x4a32('0x2a')],'type':_0x1cc91b[_0x4a32('0x2b')]['key']};});_0x5f0e7c[_0x4a32('0x2c')]=_['map'](_0x4cf9f9,_0x4a32('0x25'));_0x5f0e7c[_0x4a32('0x2d')]=_[_0x4a32('0x2e')](_0x2b6064['query']);_0x5f0e7c[_0x4a32('0x2f')]=_[_0x4a32('0x30')](_0x5f0e7c[_0x4a32('0x2c')],_0x5f0e7c[_0x4a32('0x2d')]);_0x3ece27[_0x4a32('0x31')]=_[_0x4a32('0x30')](_0x5f0e7c[_0x4a32('0x2c')],qs[_0x4a32('0x32')](_0x2b6064[_0x4a32('0x2d')][_0x4a32('0x32')]));_0x3ece27[_0x4a32('0x31')]=_0x3ece27[_0x4a32('0x31')][_0x4a32('0x33')]?_0x3ece27['attributes']:_0x5f0e7c[_0x4a32('0x2c')];if(!_0x2b6064[_0x4a32('0x2d')][_0x4a32('0x34')]('nolimit')){_0x3ece27[_0x4a32('0x1b')]=qs['limit'](_0x2b6064[_0x4a32('0x2d')][_0x4a32('0x1b')]);_0x3ece27[_0x4a32('0x18')]=qs['offset'](_0x2b6064[_0x4a32('0x2d')][_0x4a32('0x18')]);}_0x3ece27[_0x4a32('0x35')]=qs[_0x4a32('0x36')](_0x2b6064[_0x4a32('0x2d')][_0x4a32('0x36')]);_0x3ece27[_0x4a32('0x37')]=qs[_0x4a32('0x2f')](_['pick'](_0x2b6064['query'],_0x5f0e7c[_0x4a32('0x2f')]),_0x4cf9f9);if(_0x2b6064[_0x4a32('0x2d')]['filter']){_0x3ece27[_0x4a32('0x37')]=_[_0x4a32('0x38')](_0x3ece27[_0x4a32('0x37')],{'$or':_[_0x4a32('0x28')](_0x4cf9f9,function(_0x1929ce){if(_0x1929ce[_0x4a32('0x2b')]!==_0x4a32('0x39')){var _0x4c156c={};_0x4c156c[_0x1929ce[_0x4a32('0x25')]]={'$like':'%'+_0x2b6064[_0x4a32('0x2d')][_0x4a32('0x3a')]+'%'};return _0x4c156c;}})});}_0x3ece27=_[_0x4a32('0x38')]({},_0x3ece27,_0x2b6064['options']);var _0x180f9a={'where':_0x3ece27[_0x4a32('0x37')]};return db['Attachment'][_0x4a32('0x1a')](_0x180f9a)[_0x4a32('0x23')](function(_0x138c31){_0x17c7cc[_0x4a32('0x1a')]=_0x138c31;if(_0x2b6064[_0x4a32('0x2d')][_0x4a32('0x3b')]){_0x3ece27[_0x4a32('0x3c')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x3ece27);})['then'](function(_0x2658fc){_0x17c7cc[_0x4a32('0x3d')]=_0x2658fc;return _0x17c7cc;})[_0x4a32('0x23')](respondWithFilteredResult(_0x562900,_0x3ece27))[_0x4a32('0x3e')](handleError(_0x562900,null));};exports[_0x4a32('0x3f')]=function(_0x4009a0,_0x57c722){var _0x28d1bc={'raw':!![],'where':{'id':_0x4009a0[_0x4a32('0x40')]['id']}},_0x2a5a01={};_0x2a5a01[_0x4a32('0x2c')]=_[_0x4a32('0x2e')](db['Attachment'][_0x4a32('0x29')]);_0x2a5a01[_0x4a32('0x2d')]=_[_0x4a32('0x2e')](_0x4009a0[_0x4a32('0x2d')]);_0x2a5a01[_0x4a32('0x2f')]=_['intersection'](_0x2a5a01['model'],_0x2a5a01[_0x4a32('0x2d')]);_0x28d1bc[_0x4a32('0x31')]=_['intersection'](_0x2a5a01['model'],qs[_0x4a32('0x32')](_0x4009a0['query'][_0x4a32('0x32')]));_0x28d1bc['attributes']=_0x28d1bc[_0x4a32('0x31')][_0x4a32('0x33')]?_0x28d1bc['attributes']:_0x2a5a01['model'];if(_0x4009a0[_0x4a32('0x2d')][_0x4a32('0x3b')]){_0x28d1bc['include']=[{'all':!![]}];}_0x28d1bc=_[_0x4a32('0x38')]({},_0x28d1bc,_0x4009a0[_0x4a32('0x41')]);return db[_0x4a32('0x42')]['find'](_0x28d1bc)[_0x4a32('0x23')](handleEntityNotFound(_0x57c722,null))[_0x4a32('0x23')](respondWithResult(_0x57c722,null))['catch'](handleError(_0x57c722,null));};exports[_0x4a32('0x43')]=function(_0x208e00,_0x4b4eba){var _0x41af4f={'where':{'id':_0x208e00['params']['id']}},_0x5a1def={};_0x5a1def[_0x4a32('0x2c')]=_['keys'](db[_0x4a32('0x42')][_0x4a32('0x29')]);_0x41af4f[_0x4a32('0x31')]=_[_0x4a32('0x30')](_0x5a1def['model'],qs[_0x4a32('0x32')](_0x208e00[_0x4a32('0x2d')][_0x4a32('0x32')]));_0x41af4f[_0x4a32('0x31')]=_0x41af4f[_0x4a32('0x31')]['length']?_0x41af4f[_0x4a32('0x31')]:_0x5a1def[_0x4a32('0x2c')];if(_0x208e00['query']['includeAll']){_0x41af4f[_0x4a32('0x3c')]=[{'all':!![]}];}_0x41af4f=_[_0x4a32('0x38')]({},_0x41af4f,_0x208e00[_0x4a32('0x41')]);return db[_0x4a32('0x42')][_0x4a32('0x44')](_0x41af4f)[_0x4a32('0x23')](handleEntityNotFound(_0x4b4eba,null))[_0x4a32('0x23')](function(_0x2e0ace){if(_0x2e0ace){var _0x2f7913=_0x2e0ace[_0x4a32('0x45')]({'plain':!![]});_0x2f7913=qs[_0x4a32('0x46')](_0x2f7913,['id',_0x4a32('0x47'),_0x4a32('0x48')]);_0x208e00[_0x4a32('0x49')]=_[_0x4a32('0x46')](_0x208e00['body'],['id',_0x4a32('0x47'),_0x4a32('0x48')]);return db[_0x4a32('0x42')][_0x4a32('0x4a')](_['merge'](_0x2f7913,_0x208e00[_0x4a32('0x49')]),{'include':_0x208e00[_0x4a32('0x2d')][_0x4a32('0x3b')]?[{'all':!![]}]:undefined});}})[_0x4a32('0x23')](respondWithResult(_0x4b4eba,0xc9))['catch'](handleError(_0x4b4eba,null));};exports[_0x4a32('0x21')]=function(_0x8a03c3,_0x1b4579){if(_0x8a03c3[_0x4a32('0x49')]['id']){delete _0x8a03c3[_0x4a32('0x49')]['id'];}return db['Attachment']['find']({'where':{'id':_0x8a03c3[_0x4a32('0x40')]['id']}})[_0x4a32('0x23')](handleEntityNotFound(_0x1b4579,null))[_0x4a32('0x23')](saveUpdates(_0x8a03c3[_0x4a32('0x49')],null))[_0x4a32('0x23')](respondWithResult(_0x1b4579,null))['catch'](handleError(_0x1b4579,null));};exports[_0x4a32('0x22')]=function(_0x3d692d,_0x177e8a){return db[_0x4a32('0x42')][_0x4a32('0x44')]({'where':{'id':_0x3d692d[_0x4a32('0x40')]['id']}})['then'](handleEntityNotFound(_0x177e8a,null))[_0x4a32('0x23')](removeEntity(_0x177e8a,null))['catch'](handleError(_0x177e8a,null));};exports['create']=function(_0x47d057,_0x13ef93,_0xc3683e){_0x47d057['body'][_0x4a32('0x25')]=_0x47d057[_0x4a32('0x4b')][_0x4a32('0x4c')];_0x47d057['body'][_0x4a32('0x4d')]=_0x47d057[_0x4a32('0x4b')][_0x4a32('0x4e')];_0x47d057[_0x4a32('0x49')][_0x4a32('0x2b')]=_0x47d057[_0x4a32('0x4b')][_0x4a32('0x4f')];return db[_0x4a32('0x42')]['create'](_0x47d057[_0x4a32('0x49')])[_0x4a32('0x23')](respondWithResult(_0x13ef93,0xc9))[_0x4a32('0x3e')](handleError(_0x13ef93,null));};exports[_0x4a32('0x50')]=function(_0x204e46,_0x174d72,_0xa6c67f){return db[_0x4a32('0x42')][_0x4a32('0x51')]({'where':{'id':_0x204e46[_0x4a32('0x40')]['id']},'raw':!![]})[_0x4a32('0x23')](handleEntityNotFound(_0x174d72,null))[_0x4a32('0x23')](function(_0x1cbbaf){if(_0x1cbbaf){var _0x17b49f=_0x1cbbaf['ChatOfflineMessageId']!==null;var _0x5f4cac=path[_0x4a32('0x52')](config['root'],'server/files/attachments/');if(_0x17b49f){_0x5f4cac=path[_0x4a32('0x52')](_0x5f4cac,'offline-chat/');}var _0x5a396c=path[_0x4a32('0x52')](_0x5f4cac,_0x1cbbaf[_0x4a32('0x4d')]);return _0x174d72['download'](_0x5a396c);}})['catch'](handleError(_0x174d72,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index dc5e8e7..b51fbdc 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 _0x4758=['../../config/environment','./attachment.attributes','Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1d9e60,_0x51ce17){var _0x4d1283=function(_0x3713ab){while(--_0x3713ab){_0x1d9e60['push'](_0x1d9e60['shift']());}};_0x4d1283(++_0x51ce17);}(_0x4758,0x108));var _0x8475=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4758[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8475('0x0'));var util=require(_0x8475('0x1'));var logger=require(_0x8475('0x2'))(_0x8475('0x3'));var moment=require(_0x8475('0x4'));var BPromise=require(_0x8475('0x5'));var rp=require(_0x8475('0x6'));var fs=require('fs');var path=require(_0x8475('0x7'));var rimraf=require(_0x8475('0x8'));var config=require(_0x8475('0x9'));var attributes=require(_0x8475('0xa'));module['exports']=function(_0x45503f,_0x266a9f){return _0x45503f['define'](_0x8475('0xb'),attributes,{'tableName':_0x8475('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ce9=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','./attachment.attributes','exports','Attachment'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x4ce9,0x118));var _0x94ce=function(_0x281a61,_0x4d3807){_0x281a61=_0x281a61-0x0;var _0x4b9d4d=_0x4ce9[_0x281a61];return _0x4b9d4d;};'use strict';var _=require(_0x94ce('0x0'));var util=require('util');var logger=require(_0x94ce('0x1'))(_0x94ce('0x2'));var moment=require(_0x94ce('0x3'));var BPromise=require(_0x94ce('0x4'));var rp=require(_0x94ce('0x5'));var fs=require('fs');var path=require(_0x94ce('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x94ce('0x7'));module[_0x94ce('0x8')]=function(_0x4a5ffe,_0x497c9c){return _0x4a5ffe['define'](_0x94ce('0x9'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 00b079a..d79ce84 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 _0x6a24=['create','body','options','raw','then','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateAttachment','Attachment'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x6a24,0xd1));var _0x46a2=function(_0x482896,_0x5395ee){_0x482896=_0x482896-0x0;var _0x3641cc=_0x6a24[_0x482896];return _0x3641cc;};'use strict';var _=require(_0x46a2('0x0'));var util=require(_0x46a2('0x1'));var moment=require('moment');var BPromise=require(_0x46a2('0x2'));var rs=require(_0x46a2('0x3'));var fs=require('fs');var Redis=require(_0x46a2('0x4'));var db=require(_0x46a2('0x5'))['db'];var utils=require(_0x46a2('0x6'));var logger=require('../../config/logger')(_0x46a2('0x7'));var config=require(_0x46a2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x46a2('0x9')][_0x46a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x506698,_0x49870f,_0x2092f3){return new BPromise(function(_0x321b88,_0x587092){return client[_0x46a2('0xb')](_0x506698,_0x2092f3)['then'](function(_0x395578){logger['info'](_0x46a2('0xc'),_0x49870f,_0x46a2('0xd'));logger[_0x46a2('0xe')](_0x46a2('0xf'),_0x49870f,_0x46a2('0xd'),JSON[_0x46a2('0x10')](_0x395578));if(_0x395578[_0x46a2('0x11')]){if(_0x395578[_0x46a2('0x11')]['code']===0x1f4){logger['error'](_0x46a2('0xc'),_0x49870f,_0x395578[_0x46a2('0x11')]['message']);return _0x587092(_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);}logger[_0x46a2('0x11')](_0x46a2('0xc'),_0x49870f,_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);return _0x321b88(_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x49870f,_0x46a2('0xd'));_0x321b88(_0x395578[_0x46a2('0x13')]['message']);}})[_0x46a2('0x14')](function(_0x2d755b){logger['error'](_0x46a2('0xc'),_0x49870f,_0x2d755b);_0x587092(_0x2d755b);});});}exports[_0x46a2('0x15')]=function(_0x577f18){var _0x27250b=this;return new Promise(function(_0x24f75f,_0x529bb5){return db[_0x46a2('0x16')][_0x46a2('0x17')](_0x577f18[_0x46a2('0x18')],{'raw':_0x577f18[_0x46a2('0x19')]?_0x577f18[_0x46a2('0x19')][_0x46a2('0x1a')]===undefined?!![]:![]:!![]})[_0x46a2('0x1b')](function(_0x202294){logger[_0x46a2('0x1c')](_0x46a2('0x15'),_0x577f18);logger[_0x46a2('0xe')](_0x46a2('0x15'),_0x577f18,JSON[_0x46a2('0x10')](_0x202294));_0x24f75f(_0x202294);})['catch'](function(_0xa37d90){logger['error'](_0x46a2('0x15'),_0xa37d90[_0x46a2('0x12')],_0x577f18);_0x529bb5(_0x27250b['error'](0x1f4,_0xa37d90[_0x46a2('0x12')]));});});}; \ No newline at end of file +var _0x0834=['message','result','catch','create','options','raw','CreateAttachment','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2b90dc,_0x10b832){var _0x4794a6=function(_0x3720ca){while(--_0x3720ca){_0x2b90dc['push'](_0x2b90dc['shift']());}};_0x4794a6(++_0x10b832);}(_0x0834,0x18e));var _0x4083=function(_0xf94f9b,_0x2db140){_0xf94f9b=_0xf94f9b-0x0;var _0x2a8df6=_0x0834[_0xf94f9b];return _0x2a8df6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4083('0x0'));var BPromise=require(_0x4083('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4083('0x2'));var logger=require(_0x4083('0x3'))('rpc');var config=require(_0x4083('0x4'));var jayson=require(_0x4083('0x5'));var client=jayson['client'][_0x4083('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5c5a54,_0x31c7ef,_0x26ed53){return new BPromise(function(_0x2c42bb,_0x1d56dd){return client[_0x4083('0x7')](_0x5c5a54,_0x26ed53)[_0x4083('0x8')](function(_0x3cee37){logger[_0x4083('0x9')](_0x4083('0xa'),_0x31c7ef,_0x4083('0xb'));logger[_0x4083('0xc')](_0x4083('0xd'),_0x31c7ef,_0x4083('0xb'),JSON[_0x4083('0xe')](_0x3cee37));if(_0x3cee37[_0x4083('0xf')]){if(_0x3cee37['error']['code']===0x1f4){logger[_0x4083('0xf')](_0x4083('0xa'),_0x31c7ef,_0x3cee37['error'][_0x4083('0x10')]);return _0x1d56dd(_0x3cee37[_0x4083('0xf')][_0x4083('0x10')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x31c7ef,_0x3cee37[_0x4083('0xf')][_0x4083('0x10')]);return _0x2c42bb(_0x3cee37['error'][_0x4083('0x10')]);}else{logger[_0x4083('0x9')](_0x4083('0xa'),_0x31c7ef,_0x4083('0xb'));_0x2c42bb(_0x3cee37[_0x4083('0x11')]['message']);}})[_0x4083('0x12')](function(_0x10cadd){logger[_0x4083('0xf')](_0x4083('0xa'),_0x31c7ef,_0x10cadd);_0x1d56dd(_0x10cadd);});});}exports['CreateAttachment']=function(_0x4e7d59){var _0x4d6089=this;return new Promise(function(_0xafda0c,_0x53d525){return db['Attachment'][_0x4083('0x13')](_0x4e7d59['body'],{'raw':_0x4e7d59[_0x4083('0x14')]?_0x4e7d59[_0x4083('0x14')][_0x4083('0x15')]===undefined?!![]:![]:!![]})[_0x4083('0x8')](function(_0x4b32e9){logger[_0x4083('0x9')]('CreateAttachment',_0x4e7d59);logger[_0x4083('0xc')](_0x4083('0x16'),_0x4e7d59,JSON[_0x4083('0xe')](_0x4b32e9));_0xafda0c(_0x4b32e9);})[_0x4083('0x12')](function(_0x5d7461){logger[_0x4083('0xf')]('CreateAttachment',_0x5d7461[_0x4083('0x10')],_0x4e7d59);_0x53d525(_0x4d6089[_0x4083('0xf')](0x1f4,_0x5d7461['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 8ffa9f8..99ae391 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5c5f03,_0x16bd73){var _0x124a40=function(_0x3b8092){while(--_0x3b8092){_0x5c5f03['push'](_0x5c5f03['shift']());}};_0x124a40(++_0x16bd73);}(_0x2032,0xd9));var _0x2203=function(_0x1cd140,_0x1ee670){_0x1cd140=_0x1cd140-0x0;var _0x29a32c=_0x2032[_0x1cd140];return _0x29a32c;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file +var _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x27f38d,_0x2c5015){var _0x315ecb=function(_0x3e4c99){while(--_0x3e4c99){_0x27f38d['push'](_0x27f38d['shift']());}};_0x315ecb(++_0x2c5015);}(_0x757a,0xde));var _0xa757=function(_0x160821,_0x3377f7){_0x160821=_0x160821-0x0;var _0xe6abc4=_0x757a[_0x160821];return _0xe6abc4;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 99d62c6..403c1d1 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 _0xb926=['message','login','ad-login','json','online','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','undefined','activedirectory','baseDN','domain','authenticate','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','role','disabled','blockedAt','admin','user','name','blocked','blockDuration','minutes','clearBlockUser','getLicense','catch','status','send'];(function(_0x32d5b4,_0x35a043){var _0x33157e=function(_0x4889cb){while(--_0x4889cb){_0x32d5b4['push'](_0x32d5b4['shift']());}};_0x33157e(++_0x35a043);}(_0xb926,0xce));var _0x6b92=function(_0x255212,_0x106ece){_0x255212=_0x255212-0x0;var _0x5ea982=_0xb926[_0x255212];return _0x5ea982;};'use strict';var passport=require(_0x6b92('0x0'));var LocalStrategy=require(_0x6b92('0x1'))[_0x6b92('0x2')];var moment=require(_0x6b92('0x3'));var ActiveDirectory=require(_0x6b92('0x4'));var BPromise=require(_0x6b92('0x5'));var util=require(_0x6b92('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0x6b92('0x7'));var utils=require(_0x6b92('0x8'));var config=require(_0x6b92('0x9'));var logger=require(_0x6b92('0xa'))(_0x6b92('0xb'));function isActiveDirectoryConfigured(_0x141cca){var _0x1c5ab6=![];if(typeof _0x141cca['activedirectory']!==_0x6b92('0xc')){_0x1c5ab6=_0x141cca[_0x6b92('0xd')][_0x6b92('0xe')]&&_0x141cca[_0x6b92('0xd')]['url']&&_0x141cca['activedirectory'][_0x6b92('0xf')];}return _0x1c5ab6;}function adAuthenticate(_0x4ac28d,_0x564877,_0x3596c6){return new BPromise(function(_0x25e1c2,_0x111779){try{var _0x3aaddd=new ActiveDirectory(_0x4ac28d);_0x3aaddd[_0x6b92('0x10')](_0x564877,_0x3596c6,function(_0x3736a4,_0x4c32f0){if(_0x3736a4){logger['error'](_0x6b92('0x11'),_0x564877,util[_0x6b92('0x12')](_0x3736a4,{'showHidden':![],'depth':null}));_0x111779(_0x6b92('0x13'));}else if(!_0x4c32f0){logger['error'](_0x6b92('0x14'),_0x564877);_0x111779('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x25e1c2(_0x4c32f0);}});}catch(_0x57628f){_0x111779(_0x57628f);}});}function ActiveDirectoryAuthenticate(_0x4981f0,_0x59b365,_0x1b083b,_0x53ca93){var _0x3d4b21,_0xe41b01;if(!isActiveDirectoryConfigured(config)){logger[_0x6b92('0x15')](_0x6b92('0x16'),_0x59b365);return _0x53ca93(null,![],{'message':_0x6b92('0x13')});}return db[_0x6b92('0x17')][_0x6b92('0x18')]({'where':{'id':0x1},'attributes':[_0x6b92('0x19'),'blockDuration'],'raw':!![]})[_0x6b92('0x1a')](function(_0x205481){_0x3d4b21=_0x205481;if(!_0x3d4b21[_0x6b92('0x19')]){logger[_0x6b92('0x15')](_0x6b92('0x1b'),_0x59b365);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x4981f0['findOne']({'attributes':['id','name',_0x6b92('0x1c'),_0x6b92('0x1d'),_0x6b92('0x1e'),_0x6b92('0x1f'),'blocked',_0x6b92('0x20'),'online'],'where':{'name':_0x59b365,'role':{'$or':[_0x6b92('0x21'),_0x6b92('0x22'),'agent']},'adSsoEnabled':!![]}});})[_0x6b92('0x1a')](function(_0x4d84d0){if(!_0x4d84d0||_0x4d84d0&&_0x4d84d0[_0x6b92('0x23')]!==_0x59b365){throw new Error(_0x6b92('0x13'));}_0xe41b01=_0x4d84d0;var _0x1f8477=_0xe41b01[_0x6b92('0x23')]+'@'+config[_0x6b92('0xd')][_0x6b92('0xf')];return adAuthenticate(config[_0x6b92('0xd')],_0x1f8477,_0x1b083b);})[_0x6b92('0x1a')](function(_0x36bc3e){if(_0xe41b01['disabled']){throw new Error(_0x6b92('0x13'));}if(_0x3d4b21['blockDuration']>0x0){if(_0xe41b01[_0x6b92('0x24')]){if(moment(_0xe41b01[_0x6b92('0x20')])['add'](_0x3d4b21[_0x6b92('0x25')],_0x6b92('0x26'))>moment()){throw new Error(_0x6b92('0x13'));}return utils[_0x6b92('0x27')](_0xe41b01,0x0,![],null)['then'](function(){return utils[_0x6b92('0x28')](_0xe41b01);})['then'](function(){return _0x53ca93(null,_0xe41b01);});}else{return utils[_0x6b92('0x28')](_0xe41b01)[_0x6b92('0x1a')](function(){return _0x53ca93(null,_0xe41b01);});}}else{return utils[_0x6b92('0x28')](_0xe41b01)[_0x6b92('0x1a')](function(){return _0x53ca93(null,_0xe41b01);});}})[_0x6b92('0x29')](function(_0x32f2ec){return _0x53ca93(null,![],_0x32f2ec);});}function handleError(_0x109cc1,_0x168e78,_0x1ca36d){return _0x109cc1[_0x6b92('0x2a')](_0x168e78||0x1f4)[_0x6b92('0x2b')]({'message':_0x1ca36d?_0x1ca36d[_0x6b92('0x2c')]||_0x1ca36d:''});}exports[_0x6b92('0x2d')]=function(_0x39c085,_0x4ab414,_0x59caba){passport[_0x6b92('0x10')](_0x6b92('0x2e'),function(_0x486575,_0x55e088,_0xf32247){var _0x46f1d3=_0x486575||_0xf32247;if(_0x46f1d3){return handleError(_0x4ab414,0x191,_0x46f1d3);}if(!_0x55e088){return handleError(_0x4ab414,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3a8bc3={'payload':{'id':_0x55e088['id'],'role':_0x55e088[_0x6b92('0x1e')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x3a8bc3)[_0x6b92('0x1a')](function(_0x3b13fb){_0x4ab414[_0x6b92('0x2f')]({'id':_0x55e088['id'],'token':_0x3b13fb,'statusCall':'','isAlreadyLogged':_0x55e088[_0x6b92('0x30')]});});}})(_0x39c085,_0x4ab414,_0x59caba);};passport['use'](_0x6b92('0x2e'),new LocalStrategy({'usernameField':'name','passwordField':_0x6b92('0x1c')},function(_0x311899,_0x3c574e,_0x1d2dfd){return ActiveDirectoryAuthenticate(db[_0x6b92('0x31')],_0x311899,_0x3c574e,_0x1d2dfd);})); \ No newline at end of file +var _0xc86e=['moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','undefined','activedirectory','baseDN','url','domain','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','role','disabled','blockedAt','online','user','blocked','minutes','clearBlockUser','getLicense','status','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','use','password','passport','passport-local'];(function(_0x5533b0,_0x2c1801){var _0x1b10f7=function(_0x5bc55c){while(--_0x5bc55c){_0x5533b0['push'](_0x5533b0['shift']());}};_0x1b10f7(++_0x2c1801);}(_0xc86e,0xd0));var _0xec86=function(_0x28a510,_0x58b893){_0x28a510=_0x28a510-0x0;var _0x499425=_0xc86e[_0x28a510];return _0x499425;};'use strict';var passport=require(_0xec86('0x0'));var LocalStrategy=require(_0xec86('0x1'))['Strategy'];var moment=require(_0xec86('0x2'));var ActiveDirectory=require(_0xec86('0x3'));var BPromise=require(_0xec86('0x4'));var util=require(_0xec86('0x5'));var db=require(_0xec86('0x6'))['db'];var authService=require(_0xec86('0x7'));var utils=require(_0xec86('0x8'));var config=require('../../config/environment');var logger=require(_0xec86('0x9'))('api');function isActiveDirectoryConfigured(_0x111662){var _0x45b954=![];if(typeof _0x111662['activedirectory']!==_0xec86('0xa')){_0x45b954=_0x111662[_0xec86('0xb')][_0xec86('0xc')]&&_0x111662[_0xec86('0xb')][_0xec86('0xd')]&&_0x111662['activedirectory'][_0xec86('0xe')];}return _0x45b954;}function adAuthenticate(_0x25927c,_0x255c6b,_0x466d6a){return new BPromise(function(_0x2d23e3,_0x504b34){try{var _0x2b97f6=new ActiveDirectory(_0x25927c);_0x2b97f6['authenticate'](_0x255c6b,_0x466d6a,function(_0x529220,_0x4960f1){if(_0x529220){logger['error']('Error\x20authenticate\x20%s:\x20%s',_0x255c6b,util[_0xec86('0xf')](_0x529220,{'showHidden':![],'depth':null}));_0x504b34(_0xec86('0x10'));}else if(!_0x4960f1){logger[_0xec86('0x11')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x255c6b);_0x504b34('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2d23e3(_0x4960f1);}});}catch(_0x2b009){_0x504b34(_0x2b009);}});}function ActiveDirectoryAuthenticate(_0x49230e,_0x366991,_0x179a03,_0x114745){var _0x29d8c2,_0x5e3dd9;if(!isActiveDirectoryConfigured(config)){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x366991);return _0x114745(null,![],{'message':_0xec86('0x10')});}return db[_0xec86('0x12')][_0xec86('0x13')]({'where':{'id':0x1},'attributes':[_0xec86('0x14'),_0xec86('0x15')],'raw':!![]})[_0xec86('0x16')](function(_0x31ca9c){_0x29d8c2=_0x31ca9c;if(!_0x29d8c2[_0xec86('0x14')]){logger['error'](_0xec86('0x17'),_0x366991);throw new Error(_0xec86('0x10'));}return _0x49230e[_0xec86('0x13')]({'attributes':['id',_0xec86('0x18'),'password',_0xec86('0x19'),_0xec86('0x1a'),_0xec86('0x1b'),'blocked',_0xec86('0x1c'),_0xec86('0x1d')],'where':{'name':_0x366991,'role':{'$or':['admin',_0xec86('0x1e'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0x400d80){if(!_0x400d80||_0x400d80&&_0x400d80['name']!==_0x366991){throw new Error(_0xec86('0x10'));}_0x5e3dd9=_0x400d80;var _0x101bcf=_0x5e3dd9[_0xec86('0x18')]+'@'+config[_0xec86('0xb')]['domain'];return adAuthenticate(config['activedirectory'],_0x101bcf,_0x179a03);})[_0xec86('0x16')](function(_0x1c1014){if(_0x5e3dd9[_0xec86('0x1b')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x29d8c2[_0xec86('0x15')]>0x0){if(_0x5e3dd9[_0xec86('0x1f')]){if(moment(_0x5e3dd9[_0xec86('0x1c')])['add'](_0x29d8c2['blockDuration'],_0xec86('0x20'))>moment()){throw new Error(_0xec86('0x10'));}return utils[_0xec86('0x21')](_0x5e3dd9,0x0,![],null)[_0xec86('0x16')](function(){return utils['getLicense'](_0x5e3dd9);})[_0xec86('0x16')](function(){return _0x114745(null,_0x5e3dd9);});}else{return utils[_0xec86('0x22')](_0x5e3dd9)['then'](function(){return _0x114745(null,_0x5e3dd9);});}}else{return utils[_0xec86('0x22')](_0x5e3dd9)[_0xec86('0x16')](function(){return _0x114745(null,_0x5e3dd9);});}})['catch'](function(_0xaf2310){return _0x114745(null,![],_0xaf2310);});}function handleError(_0xa1e20d,_0x2d80ea,_0x35c17a){return _0xa1e20d[_0xec86('0x23')](_0x2d80ea||0x1f4)['send']({'message':_0x35c17a?_0x35c17a['message']||_0x35c17a:''});}exports[_0xec86('0x24')]=function(_0x3455d2,_0x203085,_0x9b6005){passport[_0xec86('0x25')](_0xec86('0x26'),function(_0xc5594b,_0x119208,_0x16acb8){var _0x1c2f51=_0xc5594b||_0x16acb8;if(_0x1c2f51){return handleError(_0x203085,0x191,_0x1c2f51);}if(!_0x119208){return handleError(_0x203085,0x194,{'message':_0xec86('0x27')});}else{var _0x1d2928={'payload':{'id':_0x119208['id'],'role':_0x119208['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1d2928)[_0xec86('0x16')](function(_0x1fb929){_0x203085['json']({'id':_0x119208['id'],'token':_0x1fb929,'statusCall':'','isAlreadyLogged':_0x119208[_0xec86('0x1d')]});});}})(_0x3455d2,_0x203085,_0x9b6005);};passport[_0xec86('0x28')]('ad-login',new LocalStrategy({'usernameField':'name','passwordField':_0xec86('0x29')},function(_0x18f2fe,_0xd77177,_0x21e563){return ActiveDirectoryAuthenticate(db['User'],_0x18f2fe,_0xd77177,_0x21e563);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 566516e..5b81be0 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 _0xc0c1=['exports','express','./authActiveDirectory.controller','post'];(function(_0x5de7a5,_0x23948a){var _0x41e57b=function(_0x4b348e){while(--_0x4b348e){_0x5de7a5['push'](_0x5de7a5['shift']());}};_0x41e57b(++_0x23948a);}(_0xc0c1,0x119));var _0x1c0c=function(_0x51995a,_0x3a0cb1){_0x51995a=_0x51995a-0x0;var _0x3b8a5a=_0xc0c1[_0x51995a];return _0x3b8a5a;};'use strict';var express=require(_0x1c0c('0x0'));var router=express['Router']();var controller=require(_0x1c0c('0x1'));router[_0x1c0c('0x2')]('/',controller['login']);module[_0x1c0c('0x3')]=router; \ No newline at end of file +var _0x45b1=['exports','Router','./authActiveDirectory.controller','post','login'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x45b1,0x1a0));var _0x145b=function(_0x9099d8,_0x1dc380){_0x9099d8=_0x9099d8-0x0;var _0x1988d4=_0x45b1[_0x9099d8];return _0x1988d4;};'use strict';var express=require('express');var router=express[_0x145b('0x0')]();var controller=require(_0x145b('0x1'));router[_0x145b('0x2')]('/',controller[_0x145b('0x3')]);module[_0x145b('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 9ec3d00..79da536 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(_0xa059ea,_0x5cb91e){var _0x156a4c=function(_0x1b4717){while(--_0x1b4717){_0xa059ea['push'](_0xa059ea['shift']());}};_0x156a4c(++_0x5cb91e);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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(_0x28c5d1,_0x2688b9){var _0x19309f=function(_0x393348){while(--_0x393348){_0x28c5d1['push'](_0x28c5d1['shift']());}};_0x19309f(++_0x2688b9);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 e7a741e..bde0273 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 _0xff32=['/callback','callback','isMiddleware','setTokenCookie','exports','passport','Router','./authGoogle.controller','../user/user.controller.js','get','login'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xff32,0x15a));var _0x2ff3=function(_0x5e7fe0,_0x48f825){_0x5e7fe0=_0x5e7fe0-0x0;var _0x4a38d6=_0xff32[_0x5e7fe0];return _0x4a38d6;};'use strict';var express=require('express');var passport=require(_0x2ff3('0x0'));var router=express[_0x2ff3('0x1')]();var controller=require(_0x2ff3('0x2'));var userController=require(_0x2ff3('0x3'));var authService=require('../../components/auth/service');router[_0x2ff3('0x4')]('/',controller[_0x2ff3('0x5')]);router['get'](_0x2ff3('0x6'),controller[_0x2ff3('0x7')],authService[_0x2ff3('0x8')],userController[_0x2ff3('0x5')],authService[_0x2ff3('0x9')]);module[_0x2ff3('0xa')]=router; \ No newline at end of file +var _0x7a57=['isMiddleware','exports','express','Router','./authGoogle.controller','../user/user.controller.js','get','login','callback'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x7a57,0x1d6));var _0x77a5=function(_0x360bb3,_0x3197fd){_0x360bb3=_0x360bb3-0x0;var _0x55e3f2=_0x7a57[_0x360bb3];return _0x55e3f2;};'use strict';var express=require(_0x77a5('0x0'));var passport=require('passport');var router=express[_0x77a5('0x1')]();var controller=require(_0x77a5('0x2'));var userController=require(_0x77a5('0x3'));var authService=require('../../components/auth/service');router[_0x77a5('0x4')]('/',controller[_0x77a5('0x5')]);router[_0x77a5('0x4')]('/callback',controller[_0x77a5('0x6')],authService[_0x77a5('0x7')],userController['login'],authService['setTokenCookie']);module[_0x77a5('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 2b64c83..03a38a1 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 _0xa28b=['The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','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','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','local-login','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','minutes','clearBlockUser','add','getLicense','catch','MailAccount','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','email','SendMail','error','message','stringify','status','send','signToken','online','forgot','Email\x20parameter\x20is\x20missing','generate','toLowerCase','User','find','body','This\x20email\x20is\x20not\x20registered.'];(function(_0x33d244,_0x46f998){var _0x5420ec=function(_0x1e9974){while(--_0x1e9974){_0x33d244['push'](_0x33d244['shift']());}};_0x5420ec(++_0x46f998);}(_0xa28b,0x15b));var _0xba28=function(_0x29b328,_0x8c73ed){_0x29b328=_0x29b328-0x0;var _0x1f59ab=_0xa28b[_0x29b328];return _0x1f59ab;};'use strict';var util=require('util');var passport=require(_0xba28('0x0'));var LocalStrategy=require(_0xba28('0x1'))[_0xba28('0x2')];var jayson=require(_0xba28('0x3'));var _=require(_0xba28('0x4'));var rs=require(_0xba28('0x5'));var moment=require(_0xba28('0x6'));var db=require(_0xba28('0x7'))['db'];var authService=require(_0xba28('0x8'));var utils=require(_0xba28('0x9'));var client=jayson[_0xba28('0xa')]['http']({'port':0x232b});function localAuthenticate(_0x309b4e,_0x5d4de6,_0x51c502,_0xbb9604){var _0x2a35f4,_0x4cb74b;return db[_0xba28('0xb')][_0xba28('0xc')]({'where':{'id':0x1},'attributes':[_0xba28('0xd'),_0xba28('0xe')],'raw':!![]})[_0xba28('0xf')](function(_0x306915){_0x2a35f4=_0x306915;return _0x309b4e[_0xba28('0xc')]({'attributes':['id',_0xba28('0x10'),_0xba28('0x11'),_0xba28('0x12'),_0xba28('0x13'),_0xba28('0x14'),_0xba28('0x15'),_0xba28('0x16'),_0xba28('0x17')],'where':{'name':_0x5d4de6,'role':{'$or':['admin',_0xba28('0x18'),_0xba28('0x19')]}}});})[_0xba28('0xf')](function(_0x566997){if(!_0x566997||_0x566997&&_0x566997[_0xba28('0x10')]!==_0x5d4de6){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x4cb74b=_0x566997;return _0x4cb74b;}})['then'](function(){_0x4cb74b[_0xba28('0x1a')](_0x51c502,function(_0x5d8f64,_0x3c8202){var _0x169b55=_0x4cb74b[_0xba28('0x17')]+0x1;if(_0x5d8f64){return _0xbb9604(_0x5d8f64);}else if(!_0x3c8202){if(_0x4cb74b[_0xba28('0x14')]){return _0xbb9604(null,![],{'message':_0xba28('0x1b')});}else if(_0x2a35f4[_0xba28('0xd')]>0x0){if(_0x4cb74b[_0xba28('0x15')]){if(_0x2a35f4[_0xba28('0xe')]>0x0){if(moment(_0x4cb74b['blockedAt'])['add'](_0x2a35f4[_0xba28('0xe')],_0xba28('0x1c'))>moment()){return _0xbb9604(null,![],{'message':_0xba28('0x1b')});}else{return utils['clearBlockUser'](_0x4cb74b,_0x169b55,![],null)['then'](function(){return _0xbb9604(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0xbb9604(null,![],{'message':_0xba28('0x1b')});}}else{if(_0x169b55>=_0x2a35f4['allowedLoginAttempts']){return utils[_0xba28('0x1d')](_0x4cb74b,0x0,!![],moment())[_0xba28('0xf')](function(){return _0xbb9604(null,![],{'message':_0xba28('0x1b')});});}else{return utils[_0xba28('0x1d')](_0x4cb74b,_0x169b55,![],null)[_0xba28('0xf')](function(){return _0xbb9604(null,![],{'message':_0xba28('0x1b')});});}}}else{return _0xbb9604(null,![],{'message':_0xba28('0x1b')});}}else{if(_0x4cb74b[_0xba28('0x14')]){return _0xbb9604(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2a35f4['allowedLoginAttempts']>0x0){if(_0x4cb74b[_0xba28('0x15')]){if(_0x2a35f4['blockDuration']>0x0){if(moment(_0x4cb74b[_0xba28('0x16')])[_0xba28('0x1e')](_0x2a35f4['blockDuration'],_0xba28('0x1c'))>moment()){return _0xbb9604(null,![],{'message':_0xba28('0x1b')});}else{return utils[_0xba28('0x1d')](_0x4cb74b,0x0,![],null)[_0xba28('0xf')](function(){return utils[_0xba28('0x1f')](_0x4cb74b);})[_0xba28('0xf')](function(){return _0xbb9604(null,_0x4cb74b);});}}else{return _0xbb9604(null,![],{'message':_0xba28('0x1b')});}}else{return utils['clearBlockUser'](_0x4cb74b,0x0,![],null)[_0xba28('0xf')](function(){return utils['getLicense'](_0x4cb74b);})[_0xba28('0xf')](function(){return _0xbb9604(null,_0x4cb74b);})[_0xba28('0x20')](function(_0x35aa30){return _0xbb9604(null,![],_0x35aa30);});}}else{if(_0x4cb74b[_0xba28('0x15')]){return _0xbb9604(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xba28('0x1f')](_0x4cb74b)[_0xba28('0xf')](function(){return _0xbb9604(null,_0x4cb74b);});}}}});})[_0xba28('0x20')](function(_0x160d33){return _0xbb9604(null,![],_0x160d33);});}function sendServiceMail(_0x2c9eb9){return db[_0xba28('0x21')]['find']({'where':{'service':!![]},'attributes':['id',_0xba28('0x10'),'email'],'include':[{'model':db['MailServerOut'],'as':_0xba28('0x22'),'include':[{'model':db[_0xba28('0x23')],'as':_0xba28('0x23')}]}]})[_0xba28('0xf')](function(_0x3e6544){if(!_0x3e6544){throw new Error(_0xba28('0x24'));}var _0x41c152=_0x3e6544[_0xba28('0x25')]();var _0x5ac3b1={'account':_0x41c152,'message':_[_0xba28('0x26')]({'from':util[_0xba28('0x27')](_0xba28('0x28'),_0x3e6544[_0xba28('0x10')],_0x3e6544[_0xba28('0x29')]||_0x3e6544[_0xba28('0x22')]['user'])},_0x2c9eb9)};return client['request'](_0xba28('0x2a'),_0x5ac3b1);})['then'](function(_0x408e5f){if(_0x408e5f['error']){throw new Error(util[_0xba28('0x27')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x408e5f[_0xba28('0x2b')][_0xba28('0x2c')]||JSON[_0xba28('0x2d')](_0x408e5f[_0xba28('0x2b')])));}return!![];});}function handleError(_0x832b5,_0x25b45e,_0x4430cf){return _0x832b5[_0xba28('0x2e')](_0x25b45e||0x1f4)[_0xba28('0x2f')]({'message':_0x4430cf?_0x4430cf[_0xba28('0x2c')]||_0x4430cf:''});}exports['login']=function(_0x442390,_0x2d8bdf,_0x227a3b){passport[_0xba28('0x1a')]('local-login',function(_0xf30f4a,_0xe2db92,_0x40eac8){var _0x456d35=_0xf30f4a||_0x40eac8;if(_0x456d35){return handleError(_0x2d8bdf,0x191,_0x456d35);}if(!_0xe2db92){return handleError(_0x2d8bdf,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x1ff619={'payload':{'id':_0xe2db92['id'],'role':_0xe2db92[_0xba28('0x13')]},'options':{'expiresIn':0x15180}};return authService[_0xba28('0x30')](_0x1ff619)[_0xba28('0xf')](function(_0x5e212e){_0x2d8bdf['json']({'id':_0xe2db92['id'],'token':_0x5e212e,'statusCall':'','isAlreadyLogged':_0xe2db92[_0xba28('0x31')]});});}})(_0x442390,_0x2d8bdf,_0x227a3b);};exports[_0xba28('0x32')]=function(_0x59f78d,_0xa6389a){if(!_0x59f78d['body'][_0xba28('0x29')]){return handleError(_0xa6389a,0x1f4,{'message':_0xba28('0x33')});}var _0x997275=rs[_0xba28('0x34')]();_0x59f78d['body'][_0xba28('0x29')]=_0x59f78d['body']['email']['trim']()[_0xba28('0x35')]();var _0x3656f3;return db[_0xba28('0xb')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x345649){_0x3656f3=_0x345649;return db[_0xba28('0x36')][_0xba28('0x37')]({'where':{'email':_0x59f78d[_0xba28('0x38')]['email']}});})[_0xba28('0xf')](function(_0x5af292){if(!_0x5af292){throw new Error(_0xba28('0x39'));}if(_0x5af292[_0xba28('0x14')]){throw new Error(_0xba28('0x3a'));}if(_0x5af292['blocked']){if(moment(_0x5af292[_0xba28('0x16')])[_0xba28('0x1e')](_0x3656f3[_0xba28('0xe')],'minutes')>moment()){throw new Error(_0xba28('0x3b'));}else{_0x5af292[_0xba28('0x15')]=![];_0x5af292[_0xba28('0x16')]=null;}}_0x5af292[_0xba28('0x3c')]=_0x997275;_0x5af292['resetPasswordExpires']=Date[_0xba28('0x3d')]()+0x36ee80;return _0x5af292['save']();})[_0xba28('0xf')](function(){return sendServiceMail({'to':_0x59f78d[_0xba28('0x38')]['email'],'subject':_0xba28('0x3e'),'text':_0xba28('0x3f')+_0xba28('0x40')+_0xba28('0x41')+_0x59f78d['headers'][_0xba28('0x42')]+_0xba28('0x43')+_0x997275+'\x0a\x0a'+_0xba28('0x44')});})[_0xba28('0xf')](function(){_0xa6389a[_0xba28('0x2e')](0xc8)[_0xba28('0x2f')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x53205b){return handleError(_0xa6389a,0x1f4,_0x53205b);});};exports[_0xba28('0x45')]=function(_0x209020,_0x3f1329){return db[_0xba28('0x36')][_0xba28('0x37')]({'where':{'resetPasswordToken':_0x209020[_0xba28('0x46')]['token'],'resetPasswordExpires':{'$gt':Date[_0xba28('0x3d')]()}}})[_0xba28('0xf')](function(_0xbda51b){if(!_0xbda51b){throw new Error(_0xba28('0x47'));}return db[_0xba28('0xb')][_0xba28('0xc')]({'attributes':['id',_0xba28('0x48'),_0xba28('0x49'),_0xba28('0x4a')]})[_0xba28('0xf')](function(_0x1cd9c3){if(_0x1cd9c3['securePassword'])authService[_0xba28('0x4b')](_0x209020[_0xba28('0x38')][_0xba28('0x11')]);if(!_0x1cd9c3[_0xba28('0x49')]||!_0xbda51b[_0xba28('0x4c')])return _0xbda51b;authService[_0xba28('0x4d')](_0x209020[_0xba28('0x38')]['password'],_0xbda51b['previousPasswords'],_0x1cd9c3[_0xba28('0x4a')]);return _0xbda51b;})[_0xba28('0xf')](function(){_0xbda51b[_0xba28('0x11')]=_0x209020[_0xba28('0x38')]['password'];_0xbda51b['resetPasswordToken']=null;_0xbda51b[_0xba28('0x4e')]=null;return _0xbda51b['save']();});})[_0xba28('0xf')](function(){_0x3f1329[_0xba28('0x2e')](0xc8)[_0xba28('0x2f')]({'message':_0xba28('0x4f')});})[_0xba28('0x20')](function(_0x3e506a){return handleError(_0x3f1329,0x1f4,_0x3e506a);});};passport['use'](_0xba28('0x50'),new LocalStrategy({'usernameField':_0xba28('0x10'),'passwordField':'password'},function(_0xa0c134,_0x3cb379,_0x43de81){return localAuthenticate(db[_0xba28('0x36')],_0xa0c134,_0x3cb379,_0x43de81);})); \ No newline at end of file +var _0x2d92=['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','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','securePassword','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','resetPasswordExpires','save','status','use','util','passport','passport-local','Strategy','moment','../../mysqldb','../../config/utils','client','Setting','findOne','password','salt','disabled','blocked','blockedAt','admin','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','authenticate','loginAttempts','allowedLoginAttempts','blockDuration','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','send','message','login','local-login','role','signToken','json','online','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now'];(function(_0x7a82d9,_0x1b5b4a){var _0x220c0c=function(_0x5c50b6){while(--_0x5c50b6){_0x7a82d9['push'](_0x7a82d9['shift']());}};_0x220c0c(++_0x1b5b4a);}(_0x2d92,0xb9));var _0x22d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2d92[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x22d9('0x0'));var passport=require(_0x22d9('0x1'));var LocalStrategy=require(_0x22d9('0x2'))[_0x22d9('0x3')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require('randomstring');var moment=require(_0x22d9('0x4'));var db=require(_0x22d9('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x22d9('0x6'));var client=jayson[_0x22d9('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x273e13,_0x3fe726,_0x4a90dd,_0x293405){var _0x5985b1,_0x31ffd8;return db[_0x22d9('0x8')][_0x22d9('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x60a7a3){_0x5985b1=_0x60a7a3;return _0x273e13['findOne']({'attributes':['id','name',_0x22d9('0xa'),_0x22d9('0xb'),'role',_0x22d9('0xc'),_0x22d9('0xd'),_0x22d9('0xe'),'loginAttempts'],'where':{'name':_0x3fe726,'role':{'$or':[_0x22d9('0xf'),'user',_0x22d9('0x10')]}}});})['then'](function(_0x533b04){if(!_0x533b04||_0x533b04&&_0x533b04[_0x22d9('0x11')]!==_0x3fe726){throw new Error(_0x22d9('0x12'));}else{_0x31ffd8=_0x533b04;return _0x31ffd8;}})[_0x22d9('0x13')](function(){_0x31ffd8[_0x22d9('0x14')](_0x4a90dd,function(_0x30ffd6,_0x175d40){var _0x2f478e=_0x31ffd8[_0x22d9('0x15')]+0x1;if(_0x30ffd6){return _0x293405(_0x30ffd6);}else if(!_0x175d40){if(_0x31ffd8[_0x22d9('0xc')]){return _0x293405(null,![],{'message':_0x22d9('0x12')});}else if(_0x5985b1[_0x22d9('0x16')]>0x0){if(_0x31ffd8[_0x22d9('0xd')]){if(_0x5985b1[_0x22d9('0x17')]>0x0){if(moment(_0x31ffd8[_0x22d9('0xe')])[_0x22d9('0x18')](_0x5985b1['blockDuration'],_0x22d9('0x19'))>moment()){return _0x293405(null,![],{'message':_0x22d9('0x12')});}else{return utils[_0x22d9('0x1a')](_0x31ffd8,_0x2f478e,![],null)[_0x22d9('0x13')](function(){return _0x293405(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x293405(null,![],{'message':_0x22d9('0x12')});}}else{if(_0x2f478e>=_0x5985b1[_0x22d9('0x16')]){return utils[_0x22d9('0x1a')](_0x31ffd8,0x0,!![],moment())['then'](function(){return _0x293405(null,![],{'message':_0x22d9('0x12')});});}else{return utils[_0x22d9('0x1a')](_0x31ffd8,_0x2f478e,![],null)['then'](function(){return _0x293405(null,![],{'message':_0x22d9('0x12')});});}}}else{return _0x293405(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x31ffd8[_0x22d9('0xc')]){return _0x293405(null,![],{'message':_0x22d9('0x12')});}else if(_0x5985b1[_0x22d9('0x16')]>0x0){if(_0x31ffd8[_0x22d9('0xd')]){if(_0x5985b1[_0x22d9('0x17')]>0x0){if(moment(_0x31ffd8[_0x22d9('0xe')])[_0x22d9('0x18')](_0x5985b1[_0x22d9('0x17')],_0x22d9('0x19'))>moment()){return _0x293405(null,![],{'message':_0x22d9('0x12')});}else{return utils[_0x22d9('0x1a')](_0x31ffd8,0x0,![],null)[_0x22d9('0x13')](function(){return utils['getLicense'](_0x31ffd8);})[_0x22d9('0x13')](function(){return _0x293405(null,_0x31ffd8);});}}else{return _0x293405(null,![],{'message':_0x22d9('0x12')});}}else{return utils['clearBlockUser'](_0x31ffd8,0x0,![],null)[_0x22d9('0x13')](function(){return utils[_0x22d9('0x1b')](_0x31ffd8);})[_0x22d9('0x13')](function(){return _0x293405(null,_0x31ffd8);})[_0x22d9('0x1c')](function(_0x3bd6e3){return _0x293405(null,![],_0x3bd6e3);});}}else{if(_0x31ffd8[_0x22d9('0xd')]){return _0x293405(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x22d9('0x1b')](_0x31ffd8)[_0x22d9('0x13')](function(){return _0x293405(null,_0x31ffd8);});}}}});})[_0x22d9('0x1c')](function(_0x51cb5a){return _0x293405(null,![],_0x51cb5a);});}function sendServiceMail(_0x19b5e0){return db[_0x22d9('0x1d')][_0x22d9('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x22d9('0x11'),_0x22d9('0x1f')],'include':[{'model':db[_0x22d9('0x20')],'as':_0x22d9('0x21'),'include':[{'model':db[_0x22d9('0x22')],'as':_0x22d9('0x22')}]}]})[_0x22d9('0x13')](function(_0x2f31e5){if(!_0x2f31e5){throw new Error(_0x22d9('0x23'));}var _0x497caa=_0x2f31e5[_0x22d9('0x24')]();var _0x427085={'account':_0x497caa,'message':_[_0x22d9('0x25')]({'from':util[_0x22d9('0x26')](_0x22d9('0x27'),_0x2f31e5[_0x22d9('0x11')],_0x2f31e5['email']||_0x2f31e5[_0x22d9('0x21')][_0x22d9('0x28')])},_0x19b5e0)};return client[_0x22d9('0x29')](_0x22d9('0x2a'),_0x427085);})[_0x22d9('0x13')](function(_0x6b96f5){if(_0x6b96f5[_0x22d9('0x2b')]){throw new Error(util[_0x22d9('0x26')](_0x22d9('0x2c'),_0x6b96f5[_0x22d9('0x2b')]['message']||JSON[_0x22d9('0x2d')](_0x6b96f5[_0x22d9('0x2b')])));}return!![];});}function handleError(_0x30176b,_0x59f716,_0xab0278){return _0x30176b['status'](_0x59f716||0x1f4)[_0x22d9('0x2e')]({'message':_0xab0278?_0xab0278[_0x22d9('0x2f')]||_0xab0278:''});}exports[_0x22d9('0x30')]=function(_0x1c011d,_0x4d887c,_0x49cf16){passport['authenticate'](_0x22d9('0x31'),function(_0x20f151,_0x55dee9,_0xf1c2a6){var _0x29bd4d=_0x20f151||_0xf1c2a6;if(_0x29bd4d){return handleError(_0x4d887c,0x191,_0x29bd4d);}if(!_0x55dee9){return handleError(_0x4d887c,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3f129f={'payload':{'id':_0x55dee9['id'],'role':_0x55dee9[_0x22d9('0x32')]},'options':{'expiresIn':0x15180}};return authService[_0x22d9('0x33')](_0x3f129f)['then'](function(_0x247c1c){_0x4d887c[_0x22d9('0x34')]({'id':_0x55dee9['id'],'token':_0x247c1c,'statusCall':'','isAlreadyLogged':_0x55dee9[_0x22d9('0x35')]});});}})(_0x1c011d,_0x4d887c,_0x49cf16);};exports['forgot']=function(_0x4edc29,_0x4c59b9){if(!_0x4edc29['body'][_0x22d9('0x1f')]){return handleError(_0x4c59b9,0x1f4,{'message':_0x22d9('0x36')});}var _0x7127cc=rs[_0x22d9('0x37')]();_0x4edc29['body'][_0x22d9('0x1f')]=_0x4edc29[_0x22d9('0x38')][_0x22d9('0x1f')][_0x22d9('0x39')]()[_0x22d9('0x3a')]();var _0x1f4330;return db[_0x22d9('0x8')][_0x22d9('0x9')]({'where':{'id':0x1},'attributes':[_0x22d9('0x16'),_0x22d9('0x17')],'raw':!![]})[_0x22d9('0x13')](function(_0x469d6d){_0x1f4330=_0x469d6d;return db[_0x22d9('0x3b')][_0x22d9('0x1e')]({'where':{'email':_0x4edc29[_0x22d9('0x38')][_0x22d9('0x1f')]}});})[_0x22d9('0x13')](function(_0x983eb1){if(!_0x983eb1){throw new Error(_0x22d9('0x3c'));}if(_0x983eb1[_0x22d9('0xc')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x983eb1['blocked']){if(moment(_0x983eb1[_0x22d9('0xe')])['add'](_0x1f4330['blockDuration'],_0x22d9('0x19'))>moment()){throw new Error(_0x22d9('0x3d'));}else{_0x983eb1[_0x22d9('0xd')]=![];_0x983eb1[_0x22d9('0xe')]=null;}}_0x983eb1[_0x22d9('0x3e')]=_0x7127cc;_0x983eb1['resetPasswordExpires']=Date[_0x22d9('0x3f')]()+0x36ee80;return _0x983eb1['save']();})['then'](function(){return sendServiceMail({'to':_0x4edc29[_0x22d9('0x38')][_0x22d9('0x1f')],'subject':_0x22d9('0x40'),'text':_0x22d9('0x41')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x4edc29['headers'][_0x22d9('0x42')]+_0x22d9('0x43')+_0x7127cc+'\x0a\x0a'+_0x22d9('0x44')});})['then'](function(){_0x4c59b9['status'](0xc8)[_0x22d9('0x2e')]({'message':_0x22d9('0x45')});})[_0x22d9('0x1c')](function(_0x4fd253){return handleError(_0x4c59b9,0x1f4,_0x4fd253);});};exports[_0x22d9('0x46')]=function(_0x5e0b5b,_0x5392c7){return db['User'][_0x22d9('0x1e')]({'where':{'resetPasswordToken':_0x5e0b5b[_0x22d9('0x47')][_0x22d9('0x48')],'resetPasswordExpires':{'$gt':Date[_0x22d9('0x3f')]()}}})[_0x22d9('0x13')](function(_0x1b52e6){if(!_0x1b52e6){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x22d9('0x8')][_0x22d9('0x9')]({'attributes':['id',_0x22d9('0x49'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x22d9('0x13')](function(_0x10e754){if(_0x10e754[_0x22d9('0x49')])authService[_0x22d9('0x4a')](_0x5e0b5b[_0x22d9('0x38')][_0x22d9('0xa')]);if(!_0x10e754[_0x22d9('0x4b')]||!_0x1b52e6[_0x22d9('0x4c')])return _0x1b52e6;authService[_0x22d9('0x4d')](_0x5e0b5b['body']['password'],_0x1b52e6[_0x22d9('0x4c')],_0x10e754[_0x22d9('0x4e')]);return _0x1b52e6;})['then'](function(){_0x1b52e6['password']=_0x5e0b5b[_0x22d9('0x38')][_0x22d9('0xa')];_0x1b52e6[_0x22d9('0x3e')]=null;_0x1b52e6[_0x22d9('0x4f')]=null;return _0x1b52e6[_0x22d9('0x50')]();});})[_0x22d9('0x13')](function(){_0x5392c7[_0x22d9('0x51')](0xc8)[_0x22d9('0x2e')]({'message':'Password\x20reset!'});})['catch'](function(_0x52b704){return handleError(_0x5392c7,0x1f4,_0x52b704);});};passport[_0x22d9('0x52')](_0x22d9('0x31'),new LocalStrategy({'usernameField':_0x22d9('0x11'),'passwordField':_0x22d9('0xa')},function(_0x33f301,_0x1a5c5b,_0x315786){return localAuthenticate(db[_0x22d9('0x3b')],_0x33f301,_0x1a5c5b,_0x315786);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 2afbb02..ef5eb52 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 _0x7b84=['reset','exports','express','Router','post','login','forgot'];(function(_0x1e9cd0,_0x2b83dc){var _0x3c7d65=function(_0x4dad25){while(--_0x4dad25){_0x1e9cd0['push'](_0x1e9cd0['shift']());}};_0x3c7d65(++_0x2b83dc);}(_0x7b84,0x1c2));var _0x47b8=function(_0x745ba4,_0x42516d){_0x745ba4=_0x745ba4-0x0;var _0x27d00a=_0x7b84[_0x745ba4];return _0x27d00a;};'use strict';var express=require(_0x47b8('0x0'));var router=express[_0x47b8('0x1')]();var controller=require('./authLocal.controller');router[_0x47b8('0x2')]('/',controller[_0x47b8('0x3')]);router[_0x47b8('0x2')]('/forgot',controller[_0x47b8('0x4')]);router['post']('/reset/:token',controller[_0x47b8('0x5')]);module[_0x47b8('0x6')]=router; \ No newline at end of file +var _0x158f=['login','post','/forgot','forgot','/reset/:token','reset','exports','express'];(function(_0x1f3386,_0x49e688){var _0x4d2338=function(_0x48574b){while(--_0x48574b){_0x1f3386['push'](_0x1f3386['shift']());}};_0x4d2338(++_0x49e688);}(_0x158f,0x167));var _0xf158=function(_0x14a83c,_0x394b54){_0x14a83c=_0x14a83c-0x0;var _0x345d56=_0x158f[_0x14a83c];return _0x345d56;};'use strict';var express=require(_0xf158('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router['post']('/',controller[_0xf158('0x1')]);router[_0xf158('0x2')](_0xf158('0x3'),controller[_0xf158('0x4')]);router['post'](_0xf158('0x5'),controller[_0xf158('0x6')]);module[_0xf158('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index d756ee4..ef630ac 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 _0x8876=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0xaaf2e2,_0x19d28a){var _0x28bc36=function(_0x53bdb5){while(--_0x53bdb5){_0xaaf2e2['push'](_0xaaf2e2['shift']());}};_0x28bc36(++_0x19d28a);}(_0x8876,0x152));var _0x6887=function(_0x265abe,_0x2f8efa){_0x265abe=_0x265abe-0x0;var _0x32313a=_0x8876[_0x265abe];return _0x32313a;};'use strict';var Sequelize=require(_0x6887('0x0'));module[_0x6887('0x1')]={'name':{'type':Sequelize[_0x6887('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x6887('0x2')]},'description':{'type':Sequelize[_0x6887('0x2')]},'status':{'type':Sequelize[_0x6887('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x6887('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x1217=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x22896c,_0x12bbf0){var _0x1d3f5b=function(_0xc11db9){while(--_0xc11db9){_0x22896c['push'](_0x22896c['shift']());}};_0x1d3f5b(++_0x12bbf0);}(_0x1217,0x1c1));var _0x7121=function(_0x219e21,_0x210f12){_0x219e21=_0x219e21-0x0;var _0x4acae7=_0x1217[_0x219e21];return _0x4acae7;};'use strict';var Sequelize=require(_0x7121('0x0'));module[_0x7121('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x7121('0x2')]},'description':{'type':Sequelize[_0x7121('0x2')]},'status':{'type':Sequelize[_0x7121('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x7121('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index d7da450..6c57b08 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 _0x3c1a=['then','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','Condition','omit','ids','getConditions','addActions','Action','findOne','getActions','rimraf','zip-dir','fast-json-patch','request-promise','util','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update'];(function(_0x42e98c,_0x1c6bb9){var _0x59803e=function(_0x3a587e){while(--_0x3a587e){_0x42e98c['push'](_0x42e98c['shift']());}};_0x59803e(++_0x1c6bb9);}(_0x3c1a,0x15f));var _0xa3c1=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x3c1a[_0x5a95fa];return _0x1a61b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa3c1('0x0'));var zipdir=require(_0xa3c1('0x1'));var jsonpatch=require(_0xa3c1('0x2'));var rp=require(_0xa3c1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa3c1('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xa3c1('0x5'));var ejs=require(_0xa3c1('0x6'));var fs=require('fs');var fs_extra=require(_0xa3c1('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa3c1('0x8'));var jsforce=require(_0xa3c1('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xa3c1('0x5'));var querystring=require('querystring');var Papa=require(_0xa3c1('0xa'));var Redis=require('ioredis');var authService=require(_0xa3c1('0xb'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa3c1('0xc'));var logger=require('../../config/logger')(_0xa3c1('0xd'));var utils=require(_0xa3c1('0xe'));var config=require('../../config/environment');var licenseUtil=require(_0xa3c1('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b5b3e,_0x2c4b5c){_0x2c4b5c=_0x2c4b5c||0xcc;return function(_0x38c3e8){if(_0x38c3e8){return _0x2b5b3e[_0xa3c1('0x10')](_0x2c4b5c);}return _0x2b5b3e['status'](_0x2c4b5c)[_0xa3c1('0x11')]();};}function respondWithResult(_0x5c84b9,_0x3be631){_0x3be631=_0x3be631||0xc8;return function(_0x4f01ba){if(_0x4f01ba){return _0x5c84b9[_0xa3c1('0x12')](_0x3be631)[_0xa3c1('0x13')](_0x4f01ba);}};}function respondWithFilteredResult(_0x3a5338,_0x376891){return function(_0x5d71e2){if(_0x5d71e2){var _0x39a4fc=typeof _0x376891['offset']===_0xa3c1('0x14')&&typeof _0x376891[_0xa3c1('0x15')]===_0xa3c1('0x14');var _0x19f316=_0x5d71e2[_0xa3c1('0x16')];var _0x107cc1=_0x39a4fc?0x0:_0x376891['offset'];var _0x329851=_0x39a4fc?_0x5d71e2[_0xa3c1('0x16')]:_0x376891[_0xa3c1('0x17')]+_0x376891['limit'];var _0x28a4c0;if(_0x329851>=_0x19f316){_0x329851=_0x19f316;_0x28a4c0=0xc8;}else{_0x28a4c0=0xce;}_0x3a5338[_0xa3c1('0x12')](_0x28a4c0);return _0x3a5338['set'](_0xa3c1('0x18'),_0x107cc1+'-'+_0x329851+'/'+_0x19f316)['json'](_0x5d71e2);}return null;};}function patchUpdates(_0x13c81e){return function(_0x4b981b){try{jsonpatch[_0xa3c1('0x19')](_0x4b981b,_0x13c81e,!![]);}catch(_0x368614){return BPromise[_0xa3c1('0x1a')](_0x368614);}return _0x4b981b[_0xa3c1('0x1b')]();};}function saveUpdates(_0x1ab608,_0x5c7b96){return function(_0x311cf8){if(_0x311cf8){return _0x311cf8[_0xa3c1('0x1c')](_0x1ab608)[_0xa3c1('0x1d')](function(_0x33900d){return _0x33900d;});}return null;};}function removeEntity(_0x2ef9cb,_0x4da87c){return function(_0x2be55e){if(_0x2be55e){return _0x2be55e['destroy']()[_0xa3c1('0x1d')](function(){_0x2ef9cb[_0xa3c1('0x12')](0xcc)[_0xa3c1('0x11')]();});}};}function handleEntityNotFound(_0x25a32c,_0x712cb2){return function(_0x34117b){if(!_0x34117b){_0x25a32c[_0xa3c1('0x10')](0x194);}return _0x34117b;};}function handleError(_0x5d4b71,_0x562b3c){_0x562b3c=_0x562b3c||0x1f4;return function(_0x302ab9){logger[_0xa3c1('0x1e')](_0x302ab9[_0xa3c1('0x1f')]);if(_0x302ab9[_0xa3c1('0x20')]){delete _0x302ab9['name'];}_0x5d4b71[_0xa3c1('0x12')](_0x562b3c)[_0xa3c1('0x21')](_0x302ab9);};}exports[_0xa3c1('0x22')]=function(_0x25096d,_0x3c48cc){var _0x39aa41={},_0x523987={},_0x1f0ef6={'count':0x0,'rows':[]};var _0x1ce5cd=_[_0xa3c1('0x23')](db[_0xa3c1('0x24')][_0xa3c1('0x25')],function(_0x3af580){return{'name':_0x3af580[_0xa3c1('0x26')],'type':_0x3af580['type'][_0xa3c1('0x27')]};});_0x523987[_0xa3c1('0x28')]=_[_0xa3c1('0x23')](_0x1ce5cd,_0xa3c1('0x20'));_0x523987[_0xa3c1('0x29')]=_[_0xa3c1('0x2a')](_0x25096d[_0xa3c1('0x29')]);_0x523987[_0xa3c1('0x2b')]=_[_0xa3c1('0x2c')](_0x523987[_0xa3c1('0x28')],_0x523987[_0xa3c1('0x29')]);_0x39aa41[_0xa3c1('0x2d')]=_['intersection'](_0x523987[_0xa3c1('0x28')],qs[_0xa3c1('0x2e')](_0x25096d['query'][_0xa3c1('0x2e')]));_0x39aa41[_0xa3c1('0x2d')]=_0x39aa41[_0xa3c1('0x2d')][_0xa3c1('0x2f')]?_0x39aa41[_0xa3c1('0x2d')]:_0x523987['model'];if(!_0x25096d[_0xa3c1('0x29')][_0xa3c1('0x30')]('nolimit')){_0x39aa41['limit']=qs[_0xa3c1('0x15')](_0x25096d[_0xa3c1('0x29')][_0xa3c1('0x15')]);_0x39aa41[_0xa3c1('0x17')]=qs['offset'](_0x25096d[_0xa3c1('0x29')][_0xa3c1('0x17')]);}_0x39aa41[_0xa3c1('0x31')]=qs[_0xa3c1('0x32')](_0x25096d[_0xa3c1('0x29')]['sort']);_0x39aa41[_0xa3c1('0x33')]=qs[_0xa3c1('0x2b')](_[_0xa3c1('0x34')](_0x25096d['query'],_0x523987[_0xa3c1('0x2b')]),_0x1ce5cd);if(_0x25096d[_0xa3c1('0x29')]['filter']){_0x39aa41[_0xa3c1('0x33')]=_[_0xa3c1('0x35')](_0x39aa41[_0xa3c1('0x33')],{'$or':_[_0xa3c1('0x23')](_0x1ce5cd,function(_0x79d309){if(_0x79d309[_0xa3c1('0x36')]!=='VIRTUAL'){var _0x31ef66={};_0x31ef66[_0x79d309[_0xa3c1('0x20')]]={'$like':'%'+_0x25096d[_0xa3c1('0x29')][_0xa3c1('0x37')]+'%'};return _0x31ef66;}})});}_0x39aa41=_['merge']({},_0x39aa41,_0x25096d[_0xa3c1('0x38')]);var _0x20210a={'where':_0x39aa41[_0xa3c1('0x33')]};return db[_0xa3c1('0x24')][_0xa3c1('0x16')](_0x20210a)['then'](function(_0x5c5493){_0x1f0ef6[_0xa3c1('0x16')]=_0x5c5493;if(_0x25096d['query'][_0xa3c1('0x39')]){_0x39aa41[_0xa3c1('0x3a')]=[{'all':!![]}];}return db[_0xa3c1('0x24')][_0xa3c1('0x3b')](_0x39aa41);})[_0xa3c1('0x1d')](function(_0x10cba7){_0x1f0ef6[_0xa3c1('0x3c')]=_0x10cba7;return _0x1f0ef6;})[_0xa3c1('0x1d')](respondWithFilteredResult(_0x3c48cc,_0x39aa41))[_0xa3c1('0x3d')](handleError(_0x3c48cc,null));};exports[_0xa3c1('0x3e')]=function(_0x1e8ac4,_0x3142a5){var _0x207fd0={'raw':![],'where':{'id':_0x1e8ac4[_0xa3c1('0x3f')]['id']}},_0x44e0f2={};_0x44e0f2[_0xa3c1('0x28')]=_[_0xa3c1('0x2a')](db[_0xa3c1('0x24')]['rawAttributes']);_0x44e0f2[_0xa3c1('0x29')]=_['keys'](_0x1e8ac4[_0xa3c1('0x29')]);_0x44e0f2['filters']=_[_0xa3c1('0x2c')](_0x44e0f2[_0xa3c1('0x28')],_0x44e0f2[_0xa3c1('0x29')]);_0x207fd0[_0xa3c1('0x2d')]=_['intersection'](_0x44e0f2[_0xa3c1('0x28')],qs[_0xa3c1('0x2e')](_0x1e8ac4[_0xa3c1('0x29')][_0xa3c1('0x2e')]));_0x207fd0[_0xa3c1('0x2d')]=_0x207fd0[_0xa3c1('0x2d')][_0xa3c1('0x2f')]?_0x207fd0[_0xa3c1('0x2d')]:_0x44e0f2[_0xa3c1('0x28')];if(_0x1e8ac4[_0xa3c1('0x29')][_0xa3c1('0x39')]){_0x207fd0[_0xa3c1('0x3a')]=[{'all':!![]}];}_0x207fd0=_[_0xa3c1('0x35')]({},_0x207fd0,_0x1e8ac4[_0xa3c1('0x38')]);return db[_0xa3c1('0x24')][_0xa3c1('0x40')](_0x207fd0)[_0xa3c1('0x1d')](handleEntityNotFound(_0x3142a5,null))[_0xa3c1('0x1d')](respondWithResult(_0x3142a5,null))[_0xa3c1('0x3d')](handleError(_0x3142a5,null));};exports[_0xa3c1('0x41')]=function(_0x1a9e68,_0x5e2de7){return db['Automation'][_0xa3c1('0x41')](_0x1a9e68[_0xa3c1('0x42')],{})[_0xa3c1('0x1d')](respondWithResult(_0x5e2de7,0xc9))[_0xa3c1('0x3d')](handleError(_0x5e2de7,null));};exports['update']=function(_0x5706a3,_0x5c9be0){if(_0x5706a3['body']['id']){delete _0x5706a3[_0xa3c1('0x42')]['id'];}return db['Automation'][_0xa3c1('0x40')]({'where':{'id':_0x5706a3[_0xa3c1('0x3f')]['id']}})[_0xa3c1('0x1d')](handleEntityNotFound(_0x5c9be0,null))[_0xa3c1('0x1d')](saveUpdates(_0x5706a3[_0xa3c1('0x42')],null))['then'](respondWithResult(_0x5c9be0,null))['catch'](handleError(_0x5c9be0,null));};exports[_0xa3c1('0x43')]=function(_0x173f6a,_0x5a3c76){return db[_0xa3c1('0x24')]['find']({'where':{'id':_0x173f6a[_0xa3c1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5a3c76,null))[_0xa3c1('0x1d')](removeEntity(_0x5a3c76,null))[_0xa3c1('0x3d')](handleError(_0x5a3c76,null));};exports['addConditions']=function(_0x260b68,_0x1e7865,_0x5e5648){return db[_0xa3c1('0x44')]['find']({'where':{'id':_0x260b68[_0xa3c1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1e7865,null))[_0xa3c1('0x1d')](function(_0x51743e){if(_0x51743e){return _0x51743e['addConditions'](_0x260b68[_0xa3c1('0x42')]['ids'],_[_0xa3c1('0x45')](_0x260b68[_0xa3c1('0x42')],[_0xa3c1('0x46'),'id'])||{});}})['then'](respondWithResult(_0x1e7865,null))[_0xa3c1('0x3d')](handleError(_0x1e7865,null));};exports[_0xa3c1('0x47')]=function(_0x3e96ba,_0x243a51,_0x49db8b){var _0xef740e={};var _0x43390a={};var _0x1a9e18;var _0xf16397;return db[_0xa3c1('0x24')]['findOne']({'where':{'id':_0x3e96ba['params']['id']}})[_0xa3c1('0x1d')](handleEntityNotFound(_0x243a51,null))[_0xa3c1('0x1d')](function(_0x1efeef){if(_0x1efeef){_0x1a9e18=_0x1efeef;_0x43390a[_0xa3c1('0x28')]=_[_0xa3c1('0x2a')](db['Condition'][_0xa3c1('0x25')]);_0x43390a[_0xa3c1('0x29')]=_[_0xa3c1('0x2a')](_0x3e96ba[_0xa3c1('0x29')]);_0x43390a[_0xa3c1('0x2b')]=_[_0xa3c1('0x2c')](_0x43390a[_0xa3c1('0x28')],_0x43390a[_0xa3c1('0x29')]);_0xef740e['attributes']=_[_0xa3c1('0x2c')](_0x43390a[_0xa3c1('0x28')],qs[_0xa3c1('0x2e')](_0x3e96ba[_0xa3c1('0x29')][_0xa3c1('0x2e')]));_0xef740e[_0xa3c1('0x2d')]=_0xef740e[_0xa3c1('0x2d')][_0xa3c1('0x2f')]?_0xef740e[_0xa3c1('0x2d')]:_0x43390a[_0xa3c1('0x28')];_0xef740e[_0xa3c1('0x31')]=qs[_0xa3c1('0x32')](_0x3e96ba[_0xa3c1('0x29')][_0xa3c1('0x32')]);_0xef740e['where']=qs['filters'](_['pick'](_0x3e96ba['query'],_0x43390a[_0xa3c1('0x2b')]));if(_0x3e96ba[_0xa3c1('0x29')][_0xa3c1('0x37')]){_0xef740e[_0xa3c1('0x33')]=_[_0xa3c1('0x35')](_0xef740e[_0xa3c1('0x33')],{'$or':_[_0xa3c1('0x23')](_0xef740e['attributes'],function(_0x35fc7d){var _0x3da7f1={};_0x3da7f1[_0x35fc7d]={'$like':'%'+_0x3e96ba[_0xa3c1('0x29')][_0xa3c1('0x37')]+'%'};return _0x3da7f1;})});}_0xef740e=_[_0xa3c1('0x35')]({},_0xef740e,_0x3e96ba[_0xa3c1('0x38')]);return _0x1a9e18['getConditions'](_0xef740e);}})[_0xa3c1('0x1d')](function(_0x47ed37){if(_0x47ed37){_0xf16397=_0x47ed37[_0xa3c1('0x2f')];if(!_0x3e96ba[_0xa3c1('0x29')][_0xa3c1('0x30')]('nolimit')){_0xef740e[_0xa3c1('0x15')]=qs[_0xa3c1('0x15')](_0x3e96ba[_0xa3c1('0x29')][_0xa3c1('0x15')]);_0xef740e[_0xa3c1('0x17')]=qs[_0xa3c1('0x17')](_0x3e96ba[_0xa3c1('0x29')]['offset']);}return _0x1a9e18[_0xa3c1('0x47')](_0xef740e);}})[_0xa3c1('0x1d')](function(_0x1428c1){if(_0x1428c1){return _0x1428c1?{'count':_0xf16397,'rows':_0x1428c1}:null;}})['then'](respondWithResult(_0x243a51,null))[_0xa3c1('0x3d')](handleError(_0x243a51,null));};exports[_0xa3c1('0x48')]=function(_0x34649d,_0x1d219a,_0x1908de){return db[_0xa3c1('0x49')][_0xa3c1('0x40')]({'where':{'id':_0x34649d[_0xa3c1('0x3f')]['id']}})[_0xa3c1('0x1d')](handleEntityNotFound(_0x1d219a,null))[_0xa3c1('0x1d')](function(_0x52ec47){if(_0x52ec47){return _0x52ec47[_0xa3c1('0x48')](_0x34649d[_0xa3c1('0x42')][_0xa3c1('0x46')],_['omit'](_0x34649d[_0xa3c1('0x42')],[_0xa3c1('0x46'),'id'])||{});}})[_0xa3c1('0x1d')](respondWithResult(_0x1d219a,null))[_0xa3c1('0x3d')](handleError(_0x1d219a,null));};exports['getActions']=function(_0x52d792,_0x13d93e,_0x570536){var _0x203433={};var _0x1f8060={};var _0x45ffb1;var _0x332f50;return db[_0xa3c1('0x24')][_0xa3c1('0x4a')]({'where':{'id':_0x52d792['params']['id']}})[_0xa3c1('0x1d')](handleEntityNotFound(_0x13d93e,null))[_0xa3c1('0x1d')](function(_0x1d1fa4){if(_0x1d1fa4){_0x45ffb1=_0x1d1fa4;_0x1f8060[_0xa3c1('0x28')]=_[_0xa3c1('0x2a')](db[_0xa3c1('0x49')][_0xa3c1('0x25')]);_0x1f8060[_0xa3c1('0x29')]=_[_0xa3c1('0x2a')](_0x52d792[_0xa3c1('0x29')]);_0x1f8060[_0xa3c1('0x2b')]=_[_0xa3c1('0x2c')](_0x1f8060[_0xa3c1('0x28')],_0x1f8060['query']);_0x203433[_0xa3c1('0x2d')]=_[_0xa3c1('0x2c')](_0x1f8060[_0xa3c1('0x28')],qs[_0xa3c1('0x2e')](_0x52d792[_0xa3c1('0x29')]['fields']));_0x203433[_0xa3c1('0x2d')]=_0x203433['attributes'][_0xa3c1('0x2f')]?_0x203433[_0xa3c1('0x2d')]:_0x1f8060[_0xa3c1('0x28')];_0x203433[_0xa3c1('0x31')]=qs['sort'](_0x52d792['query']['sort']);_0x203433['where']=qs['filters'](_['pick'](_0x52d792[_0xa3c1('0x29')],_0x1f8060['filters']));if(_0x52d792[_0xa3c1('0x29')][_0xa3c1('0x37')]){_0x203433[_0xa3c1('0x33')]=_[_0xa3c1('0x35')](_0x203433[_0xa3c1('0x33')],{'$or':_['map'](_0x203433['attributes'],function(_0x51c49e){var _0x1ac440={};_0x1ac440[_0x51c49e]={'$like':'%'+_0x52d792[_0xa3c1('0x29')][_0xa3c1('0x37')]+'%'};return _0x1ac440;})});}_0x203433=_[_0xa3c1('0x35')]({},_0x203433,_0x52d792[_0xa3c1('0x38')]);return _0x45ffb1[_0xa3c1('0x4b')](_0x203433);}})['then'](function(_0x2d59f2){if(_0x2d59f2){_0x332f50=_0x2d59f2[_0xa3c1('0x2f')];if(!_0x52d792[_0xa3c1('0x29')][_0xa3c1('0x30')]('nolimit')){_0x203433[_0xa3c1('0x15')]=qs[_0xa3c1('0x15')](_0x52d792[_0xa3c1('0x29')][_0xa3c1('0x15')]);_0x203433[_0xa3c1('0x17')]=qs[_0xa3c1('0x17')](_0x52d792['query'][_0xa3c1('0x17')]);}return _0x45ffb1[_0xa3c1('0x4b')](_0x203433);}})[_0xa3c1('0x1d')](function(_0x3f37ff){if(_0x3f37ff){return _0x3f37ff?{'count':_0x332f50,'rows':_0x3f37ff}:null;}})[_0xa3c1('0x1d')](respondWithResult(_0x13d93e,null))[_0xa3c1('0x3d')](handleError(_0x13d93e,null));}; \ No newline at end of file +var _0x2ca9=['then','error','name','send','map','Automation','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','destroy','ids','omit','getConditions','findOne','Condition','nolimit','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','lodash','crypto','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','json','offset','undefined','limit','count','status','set','Content-Range','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2ca9,0x11a));var _0x92ca=function(_0x525bfc,_0x184933){_0x525bfc=_0x525bfc-0x0;var _0x400e1c=_0x2ca9[_0x525bfc];return _0x400e1c;};'use strict';var emlformat=require(_0x92ca('0x0'));var rimraf=require(_0x92ca('0x1'));var zipdir=require(_0x92ca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x92ca('0x3'));var moment=require(_0x92ca('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x92ca('0x5'));var util=require(_0x92ca('0x6'));var path=require(_0x92ca('0x7'));var sox=require('sox');var csv=require(_0x92ca('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x92ca('0x9'));var squel=require('squel');var crypto=require(_0x92ca('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x92ca('0x8'));var querystring=require(_0x92ca('0xb'));var Papa=require(_0x92ca('0xc'));var Redis=require(_0x92ca('0xd'));var authService=require(_0x92ca('0xe'));var qs=require(_0x92ca('0xf'));var as=require(_0x92ca('0x10'));var hardwareService=require(_0x92ca('0x11'));var logger=require(_0x92ca('0x12'))(_0x92ca('0x13'));var utils=require(_0x92ca('0x14'));var config=require(_0x92ca('0x15'));var licenseUtil=require(_0x92ca('0x16'));var db=require(_0x92ca('0x17'))['db'];function respondWithStatusCode(_0x5ed757,_0xac7af0){_0xac7af0=_0xac7af0||0xcc;return function(_0x158c01){if(_0x158c01){return _0x5ed757[_0x92ca('0x18')](_0xac7af0);}return _0x5ed757['status'](_0xac7af0)['end']();};}function respondWithResult(_0x4c3deb,_0x3376e6){_0x3376e6=_0x3376e6||0xc8;return function(_0x10ba55){if(_0x10ba55){return _0x4c3deb['status'](_0x3376e6)[_0x92ca('0x19')](_0x10ba55);}};}function respondWithFilteredResult(_0x4596f3,_0x3e73bc){return function(_0x4ce1f7){if(_0x4ce1f7){var _0x5a4e2a=typeof _0x3e73bc[_0x92ca('0x1a')]===_0x92ca('0x1b')&&typeof _0x3e73bc[_0x92ca('0x1c')]==='undefined';var _0x3764fa=_0x4ce1f7[_0x92ca('0x1d')];var _0x27a93b=_0x5a4e2a?0x0:_0x3e73bc[_0x92ca('0x1a')];var _0x28b9cd=_0x5a4e2a?_0x4ce1f7[_0x92ca('0x1d')]:_0x3e73bc[_0x92ca('0x1a')]+_0x3e73bc[_0x92ca('0x1c')];var _0x36fd01;if(_0x28b9cd>=_0x3764fa){_0x28b9cd=_0x3764fa;_0x36fd01=0xc8;}else{_0x36fd01=0xce;}_0x4596f3[_0x92ca('0x1e')](_0x36fd01);return _0x4596f3[_0x92ca('0x1f')](_0x92ca('0x20'),_0x27a93b+'-'+_0x28b9cd+'/'+_0x3764fa)[_0x92ca('0x19')](_0x4ce1f7);}return null;};}function patchUpdates(_0x55e221){return function(_0x2cc2f5){try{jsonpatch['apply'](_0x2cc2f5,_0x55e221,!![]);}catch(_0x44c393){return BPromise[_0x92ca('0x21')](_0x44c393);}return _0x2cc2f5['save']();};}function saveUpdates(_0x56f372,_0x24b7fd){return function(_0x426a75){if(_0x426a75){return _0x426a75['update'](_0x56f372)[_0x92ca('0x22')](function(_0x6f28be){return _0x6f28be;});}return null;};}function removeEntity(_0x53b210,_0x4d39b6){return function(_0x4b650d){if(_0x4b650d){return _0x4b650d['destroy']()[_0x92ca('0x22')](function(){_0x53b210[_0x92ca('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d2b21,_0xdd2f7d){return function(_0x17d88c){if(!_0x17d88c){_0x3d2b21[_0x92ca('0x18')](0x194);}return _0x17d88c;};}function handleError(_0x1a8b24,_0x2748e2){_0x2748e2=_0x2748e2||0x1f4;return function(_0x3f1cd8){logger[_0x92ca('0x23')](_0x3f1cd8['stack']);if(_0x3f1cd8[_0x92ca('0x24')]){delete _0x3f1cd8['name'];}_0x1a8b24[_0x92ca('0x1e')](_0x2748e2)[_0x92ca('0x25')](_0x3f1cd8);};}exports['index']=function(_0x2c7326,_0x4c1453){var _0x33a6d1={},_0x32a614={},_0x14a83a={'count':0x0,'rows':[]};var _0x16fb6d=_[_0x92ca('0x26')](db[_0x92ca('0x27')][_0x92ca('0x28')],function(_0x1053df){return{'name':_0x1053df['fieldName'],'type':_0x1053df[_0x92ca('0x29')][_0x92ca('0x2a')]};});_0x32a614[_0x92ca('0x2b')]=_['map'](_0x16fb6d,_0x92ca('0x24'));_0x32a614[_0x92ca('0x2c')]=_[_0x92ca('0x2d')](_0x2c7326['query']);_0x32a614[_0x92ca('0x2e')]=_[_0x92ca('0x2f')](_0x32a614[_0x92ca('0x2b')],_0x32a614[_0x92ca('0x2c')]);_0x33a6d1['attributes']=_[_0x92ca('0x2f')](_0x32a614[_0x92ca('0x2b')],qs[_0x92ca('0x30')](_0x2c7326[_0x92ca('0x2c')][_0x92ca('0x30')]));_0x33a6d1[_0x92ca('0x31')]=_0x33a6d1[_0x92ca('0x31')][_0x92ca('0x32')]?_0x33a6d1[_0x92ca('0x31')]:_0x32a614[_0x92ca('0x2b')];if(!_0x2c7326[_0x92ca('0x2c')][_0x92ca('0x33')]('nolimit')){_0x33a6d1['limit']=qs[_0x92ca('0x1c')](_0x2c7326[_0x92ca('0x2c')][_0x92ca('0x1c')]);_0x33a6d1[_0x92ca('0x1a')]=qs[_0x92ca('0x1a')](_0x2c7326['query']['offset']);}_0x33a6d1[_0x92ca('0x34')]=qs[_0x92ca('0x35')](_0x2c7326[_0x92ca('0x2c')][_0x92ca('0x35')]);_0x33a6d1['where']=qs[_0x92ca('0x2e')](_[_0x92ca('0x36')](_0x2c7326[_0x92ca('0x2c')],_0x32a614[_0x92ca('0x2e')]),_0x16fb6d);if(_0x2c7326[_0x92ca('0x2c')][_0x92ca('0x37')]){_0x33a6d1[_0x92ca('0x38')]=_[_0x92ca('0x39')](_0x33a6d1[_0x92ca('0x38')],{'$or':_[_0x92ca('0x26')](_0x16fb6d,function(_0x393070){if(_0x393070[_0x92ca('0x29')]!==_0x92ca('0x3a')){var _0x115080={};_0x115080[_0x393070['name']]={'$like':'%'+_0x2c7326[_0x92ca('0x2c')][_0x92ca('0x37')]+'%'};return _0x115080;}})});}_0x33a6d1=_[_0x92ca('0x39')]({},_0x33a6d1,_0x2c7326[_0x92ca('0x3b')]);var _0x429f9f={'where':_0x33a6d1['where']};return db['Automation'][_0x92ca('0x1d')](_0x429f9f)[_0x92ca('0x22')](function(_0x51b50d){_0x14a83a['count']=_0x51b50d;if(_0x2c7326['query'][_0x92ca('0x3c')]){_0x33a6d1[_0x92ca('0x3d')]=[{'all':!![]}];}return db[_0x92ca('0x27')][_0x92ca('0x3e')](_0x33a6d1);})[_0x92ca('0x22')](function(_0x205c15){_0x14a83a[_0x92ca('0x3f')]=_0x205c15;return _0x14a83a;})[_0x92ca('0x22')](respondWithFilteredResult(_0x4c1453,_0x33a6d1))[_0x92ca('0x40')](handleError(_0x4c1453,null));};exports['show']=function(_0x1a4ec8,_0x1ea359){var _0x49d822={'raw':![],'where':{'id':_0x1a4ec8[_0x92ca('0x41')]['id']}},_0x36c22e={};_0x36c22e[_0x92ca('0x2b')]=_[_0x92ca('0x2d')](db[_0x92ca('0x27')][_0x92ca('0x28')]);_0x36c22e['query']=_['keys'](_0x1a4ec8[_0x92ca('0x2c')]);_0x36c22e[_0x92ca('0x2e')]=_['intersection'](_0x36c22e[_0x92ca('0x2b')],_0x36c22e[_0x92ca('0x2c')]);_0x49d822[_0x92ca('0x31')]=_[_0x92ca('0x2f')](_0x36c22e[_0x92ca('0x2b')],qs[_0x92ca('0x30')](_0x1a4ec8['query'][_0x92ca('0x30')]));_0x49d822['attributes']=_0x49d822[_0x92ca('0x31')][_0x92ca('0x32')]?_0x49d822[_0x92ca('0x31')]:_0x36c22e['model'];if(_0x1a4ec8[_0x92ca('0x2c')]['includeAll']){_0x49d822[_0x92ca('0x3d')]=[{'all':!![]}];}_0x49d822=_[_0x92ca('0x39')]({},_0x49d822,_0x1a4ec8[_0x92ca('0x3b')]);return db[_0x92ca('0x27')][_0x92ca('0x42')](_0x49d822)[_0x92ca('0x22')](handleEntityNotFound(_0x1ea359,null))[_0x92ca('0x22')](respondWithResult(_0x1ea359,null))[_0x92ca('0x40')](handleError(_0x1ea359,null));};exports[_0x92ca('0x43')]=function(_0x2df740,_0x45d2cd){return db[_0x92ca('0x27')][_0x92ca('0x43')](_0x2df740[_0x92ca('0x44')],{})['then'](respondWithResult(_0x45d2cd,0xc9))[_0x92ca('0x40')](handleError(_0x45d2cd,null));};exports[_0x92ca('0x45')]=function(_0x150291,_0x511d72){if(_0x150291[_0x92ca('0x44')]['id']){delete _0x150291[_0x92ca('0x44')]['id'];}return db[_0x92ca('0x27')][_0x92ca('0x42')]({'where':{'id':_0x150291[_0x92ca('0x41')]['id']}})[_0x92ca('0x22')](handleEntityNotFound(_0x511d72,null))[_0x92ca('0x22')](saveUpdates(_0x150291['body'],null))[_0x92ca('0x22')](respondWithResult(_0x511d72,null))[_0x92ca('0x40')](handleError(_0x511d72,null));};exports[_0x92ca('0x46')]=function(_0x78c5d3,_0x398aa8){return db[_0x92ca('0x27')]['find']({'where':{'id':_0x78c5d3[_0x92ca('0x41')]['id']}})[_0x92ca('0x22')](handleEntityNotFound(_0x398aa8,null))[_0x92ca('0x22')](removeEntity(_0x398aa8,null))[_0x92ca('0x40')](handleError(_0x398aa8,null));};exports['addConditions']=function(_0x39ad14,_0x10f9c7,_0x42e9e4){return db['Condition'][_0x92ca('0x42')]({'where':{'id':_0x39ad14[_0x92ca('0x41')]['id']}})[_0x92ca('0x22')](handleEntityNotFound(_0x10f9c7,null))[_0x92ca('0x22')](function(_0x41cd36){if(_0x41cd36){return _0x41cd36['addConditions'](_0x39ad14['body'][_0x92ca('0x47')],_[_0x92ca('0x48')](_0x39ad14[_0x92ca('0x44')],[_0x92ca('0x47'),'id'])||{});}})['then'](respondWithResult(_0x10f9c7,null))[_0x92ca('0x40')](handleError(_0x10f9c7,null));};exports[_0x92ca('0x49')]=function(_0x537b51,_0x35d753,_0x28d7a4){var _0x3676f6={};var _0x2f7741={};var _0x1e49a8;var _0x18d672;return db[_0x92ca('0x27')][_0x92ca('0x4a')]({'where':{'id':_0x537b51[_0x92ca('0x41')]['id']}})['then'](handleEntityNotFound(_0x35d753,null))[_0x92ca('0x22')](function(_0x1c6d1c){if(_0x1c6d1c){_0x1e49a8=_0x1c6d1c;_0x2f7741[_0x92ca('0x2b')]=_[_0x92ca('0x2d')](db[_0x92ca('0x4b')][_0x92ca('0x28')]);_0x2f7741['query']=_['keys'](_0x537b51[_0x92ca('0x2c')]);_0x2f7741['filters']=_[_0x92ca('0x2f')](_0x2f7741[_0x92ca('0x2b')],_0x2f7741[_0x92ca('0x2c')]);_0x3676f6['attributes']=_['intersection'](_0x2f7741[_0x92ca('0x2b')],qs[_0x92ca('0x30')](_0x537b51[_0x92ca('0x2c')]['fields']));_0x3676f6[_0x92ca('0x31')]=_0x3676f6[_0x92ca('0x31')][_0x92ca('0x32')]?_0x3676f6[_0x92ca('0x31')]:_0x2f7741[_0x92ca('0x2b')];_0x3676f6['order']=qs[_0x92ca('0x35')](_0x537b51[_0x92ca('0x2c')]['sort']);_0x3676f6[_0x92ca('0x38')]=qs[_0x92ca('0x2e')](_[_0x92ca('0x36')](_0x537b51[_0x92ca('0x2c')],_0x2f7741['filters']));if(_0x537b51['query'][_0x92ca('0x37')]){_0x3676f6[_0x92ca('0x38')]=_[_0x92ca('0x39')](_0x3676f6[_0x92ca('0x38')],{'$or':_[_0x92ca('0x26')](_0x3676f6[_0x92ca('0x31')],function(_0x536906){var _0x126fd8={};_0x126fd8[_0x536906]={'$like':'%'+_0x537b51[_0x92ca('0x2c')][_0x92ca('0x37')]+'%'};return _0x126fd8;})});}_0x3676f6=_[_0x92ca('0x39')]({},_0x3676f6,_0x537b51[_0x92ca('0x3b')]);return _0x1e49a8['getConditions'](_0x3676f6);}})[_0x92ca('0x22')](function(_0x45d2bd){if(_0x45d2bd){_0x18d672=_0x45d2bd[_0x92ca('0x32')];if(!_0x537b51[_0x92ca('0x2c')][_0x92ca('0x33')](_0x92ca('0x4c'))){_0x3676f6['limit']=qs[_0x92ca('0x1c')](_0x537b51[_0x92ca('0x2c')][_0x92ca('0x1c')]);_0x3676f6[_0x92ca('0x1a')]=qs[_0x92ca('0x1a')](_0x537b51[_0x92ca('0x2c')][_0x92ca('0x1a')]);}return _0x1e49a8[_0x92ca('0x49')](_0x3676f6);}})[_0x92ca('0x22')](function(_0x517992){if(_0x517992){return _0x517992?{'count':_0x18d672,'rows':_0x517992}:null;}})[_0x92ca('0x22')](respondWithResult(_0x35d753,null))[_0x92ca('0x40')](handleError(_0x35d753,null));};exports['addActions']=function(_0x1be7b1,_0x236bac,_0x2c0a80){return db[_0x92ca('0x4d')][_0x92ca('0x42')]({'where':{'id':_0x1be7b1[_0x92ca('0x41')]['id']}})['then'](handleEntityNotFound(_0x236bac,null))['then'](function(_0x5f55de){if(_0x5f55de){return _0x5f55de['addActions'](_0x1be7b1[_0x92ca('0x44')][_0x92ca('0x47')],_[_0x92ca('0x48')](_0x1be7b1[_0x92ca('0x44')],[_0x92ca('0x47'),'id'])||{});}})[_0x92ca('0x22')](respondWithResult(_0x236bac,null))[_0x92ca('0x40')](handleError(_0x236bac,null));};exports[_0x92ca('0x4e')]=function(_0x35761b,_0x47d57a,_0x1855a9){var _0x344609={};var _0x4e76ef={};var _0x10b1e3;var _0x1989f0;return db['Automation'][_0x92ca('0x4a')]({'where':{'id':_0x35761b[_0x92ca('0x41')]['id']}})[_0x92ca('0x22')](handleEntityNotFound(_0x47d57a,null))['then'](function(_0xbca2a){if(_0xbca2a){_0x10b1e3=_0xbca2a;_0x4e76ef[_0x92ca('0x2b')]=_[_0x92ca('0x2d')](db[_0x92ca('0x4d')]['rawAttributes']);_0x4e76ef[_0x92ca('0x2c')]=_[_0x92ca('0x2d')](_0x35761b[_0x92ca('0x2c')]);_0x4e76ef[_0x92ca('0x2e')]=_[_0x92ca('0x2f')](_0x4e76ef['model'],_0x4e76ef[_0x92ca('0x2c')]);_0x344609[_0x92ca('0x31')]=_['intersection'](_0x4e76ef[_0x92ca('0x2b')],qs[_0x92ca('0x30')](_0x35761b[_0x92ca('0x2c')]['fields']));_0x344609[_0x92ca('0x31')]=_0x344609[_0x92ca('0x31')]['length']?_0x344609[_0x92ca('0x31')]:_0x4e76ef['model'];_0x344609[_0x92ca('0x34')]=qs[_0x92ca('0x35')](_0x35761b['query'][_0x92ca('0x35')]);_0x344609[_0x92ca('0x38')]=qs['filters'](_[_0x92ca('0x36')](_0x35761b[_0x92ca('0x2c')],_0x4e76ef[_0x92ca('0x2e')]));if(_0x35761b[_0x92ca('0x2c')][_0x92ca('0x37')]){_0x344609[_0x92ca('0x38')]=_['merge'](_0x344609['where'],{'$or':_[_0x92ca('0x26')](_0x344609[_0x92ca('0x31')],function(_0x548afa){var _0x2d6848={};_0x2d6848[_0x548afa]={'$like':'%'+_0x35761b[_0x92ca('0x2c')][_0x92ca('0x37')]+'%'};return _0x2d6848;})});}_0x344609=_[_0x92ca('0x39')]({},_0x344609,_0x35761b['options']);return _0x10b1e3[_0x92ca('0x4e')](_0x344609);}})['then'](function(_0x1ac073){if(_0x1ac073){_0x1989f0=_0x1ac073['length'];if(!_0x35761b[_0x92ca('0x2c')]['hasOwnProperty'](_0x92ca('0x4c'))){_0x344609[_0x92ca('0x1c')]=qs[_0x92ca('0x1c')](_0x35761b[_0x92ca('0x2c')][_0x92ca('0x1c')]);_0x344609[_0x92ca('0x1a')]=qs[_0x92ca('0x1a')](_0x35761b[_0x92ca('0x2c')][_0x92ca('0x1a')]);}return _0x10b1e3[_0x92ca('0x4e')](_0x344609);}})[_0x92ca('0x22')](function(_0x164365){if(_0x164365){return _0x164365?{'count':_0x1989f0,'rows':_0x164365}:null;}})['then'](respondWithResult(_0x47d57a,null))[_0x92ca('0x40')](handleError(_0x47d57a,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 1f3bf9d..0d971fe 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 _0x923e=['request-promise','path','../../config/environment','exports','Automation','tools_automations','lodash','util','../../config/logger','api','bluebird'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0x923e,0x1df));var _0xe923=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0x923e[_0x10f68e];return _0x4c8372;};'use strict';var _=require(_0xe923('0x0'));var util=require(_0xe923('0x1'));var logger=require(_0xe923('0x2'))(_0xe923('0x3'));var moment=require('moment');var BPromise=require(_0xe923('0x4'));var rp=require(_0xe923('0x5'));var fs=require('fs');var path=require(_0xe923('0x6'));var rimraf=require('rimraf');var config=require(_0xe923('0x7'));var attributes=require('./automation.attributes');module[_0xe923('0x8')]=function(_0x5b99eb,_0x594cbe){return _0x5b99eb['define'](_0xe923('0x9'),attributes,{'tableName':_0xe923('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b0a=['./automation.attributes','define','Automation','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x4423fd,_0x1f72c3){var _0x90f9b0=function(_0x1b6533){while(--_0x1b6533){_0x4423fd['push'](_0x4423fd['shift']());}};_0x90f9b0(++_0x1f72c3);}(_0x6b0a,0x108));var _0xa6b0=function(_0x557935,_0x1f346a){_0x557935=_0x557935-0x0;var _0x59d065=_0x6b0a[_0x557935];return _0x59d065;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa6b0('0x0'))(_0xa6b0('0x1'));var moment=require(_0xa6b0('0x2'));var BPromise=require(_0xa6b0('0x3'));var rp=require(_0xa6b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa6b0('0x5'));var attributes=require(_0xa6b0('0x6'));module['exports']=function(_0x3b1ba4,_0x2db04f){return _0x3b1ba4[_0xa6b0('0x7')](_0xa6b0('0x8'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 322fbbc..ddc7569 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 _0x7275=['util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','then','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0xca410c,_0x4453ea){var _0x29ddce=function(_0x443149){while(--_0x443149){_0xca410c['push'](_0xca410c['shift']());}};_0x29ddce(++_0x4453ea);}(_0x7275,0x143));var _0x5727=function(_0x1eb9d5,_0xb5d9e6){_0x1eb9d5=_0x1eb9d5-0x0;var _0x434ca5=_0x7275[_0x1eb9d5];return _0x434ca5;};'use strict';var _=require(_0x5727('0x0'));var util=require(_0x5727('0x1'));var moment=require(_0x5727('0x2'));var BPromise=require('bluebird');var rs=require(_0x5727('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5727('0x4'))['db'];var utils=require(_0x5727('0x5'));var logger=require('../../config/logger')(_0x5727('0x6'));var config=require(_0x5727('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x336262,_0x49184a,_0x33a6fe){return new BPromise(function(_0x4de37c,_0x129402){return client['request'](_0x336262,_0x33a6fe)[_0x5727('0x8')](function(_0x18e712){logger['info'](_0x5727('0x9'),_0x49184a,_0x5727('0xa'));logger['debug'](_0x5727('0xb'),_0x49184a,_0x5727('0xa'),JSON['stringify'](_0x18e712));if(_0x18e712[_0x5727('0xc')]){if(_0x18e712[_0x5727('0xc')][_0x5727('0xd')]===0x1f4){logger[_0x5727('0xc')](_0x5727('0x9'),_0x49184a,_0x18e712[_0x5727('0xc')]['message']);return _0x129402(_0x18e712[_0x5727('0xc')][_0x5727('0xe')]);}logger[_0x5727('0xc')](_0x5727('0x9'),_0x49184a,_0x18e712[_0x5727('0xc')][_0x5727('0xe')]);return _0x4de37c(_0x18e712[_0x5727('0xc')]['message']);}else{logger[_0x5727('0xf')](_0x5727('0x9'),_0x49184a,_0x5727('0xa'));_0x4de37c(_0x18e712[_0x5727('0x10')][_0x5727('0xe')]);}})[_0x5727('0x11')](function(_0x273dc9){logger['error'](_0x5727('0x9'),_0x49184a,_0x273dc9);_0x129402(_0x273dc9);});});} \ No newline at end of file +var _0x9ccd=['catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x4aa2c9,_0x3c74e5){var _0x212e33=function(_0x20f06a){while(--_0x20f06a){_0x4aa2c9['push'](_0x4aa2c9['shift']());}};_0x212e33(++_0x3c74e5);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ccd[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd9cc('0x0'));var util=require('util');var moment=require(_0xd9cc('0x1'));var BPromise=require(_0xd9cc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9cc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9cc('0x4'))(_0xd9cc('0x5'));var config=require(_0xd9cc('0x6'));var jayson=require(_0xd9cc('0x7'));var client=jayson[_0xd9cc('0x8')][_0xd9cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f7b2b,_0x23b70a,_0x9e1e10){return new BPromise(function(_0x1a1bd1,_0x20282c){return client[_0xd9cc('0xa')](_0x1f7b2b,_0x9e1e10)[_0xd9cc('0xb')](function(_0x1737e5){logger[_0xd9cc('0xc')](_0xd9cc('0xd'),_0x23b70a,'request\x20sent');logger[_0xd9cc('0xe')](_0xd9cc('0xf'),_0x23b70a,_0xd9cc('0x10'),JSON[_0xd9cc('0x11')](_0x1737e5));if(_0x1737e5[_0xd9cc('0x12')]){if(_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x13')]===0x1f4){logger[_0xd9cc('0x12')]('Automation,\x20%s,\x20%s',_0x23b70a,_0x1737e5[_0xd9cc('0x12')]['message']);return _0x20282c(_0x1737e5['error']['message']);}logger['error']('Automation,\x20%s,\x20%s',_0x23b70a,_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x14')]);return _0x1a1bd1(_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x14')]);}else{logger[_0xd9cc('0xc')](_0xd9cc('0xd'),_0x23b70a,_0xd9cc('0x10'));_0x1a1bd1(_0x1737e5['result'][_0xd9cc('0x14')]);}})[_0xd9cc('0x15')](function(_0x513635){logger[_0xd9cc('0x12')](_0xd9cc('0xd'),_0x23b70a,_0x513635);_0x20282c(_0x513635);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 1c28010..f8e54e4 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 _0xf82e=['getActions','create','post','/:id/conditions','addConditions','addActions','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','show','/:id/actions'];(function(_0x2d6392,_0x1516f){var _0x3bff7e=function(_0x328a80){while(--_0x328a80){_0x2d6392['push'](_0x2d6392['shift']());}};_0x3bff7e(++_0x1516f);}(_0xf82e,0x172));var _0xef82=function(_0x54c7d9,_0x110ba1){_0x54c7d9=_0x54c7d9-0x0;var _0x2faa9b=_0xf82e[_0x54c7d9];return _0x2faa9b;};'use strict';var multer=require(_0xef82('0x0'));var util=require(_0xef82('0x1'));var path=require(_0xef82('0x2'));var timeout=require(_0xef82('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xef82('0x4'));var auth=require(_0xef82('0x5'));var interaction=require(_0xef82('0x6'));var config=require(_0xef82('0x7'));var controller=require(_0xef82('0x8'));router[_0xef82('0x9')]('/',auth[_0xef82('0xa')](),controller['index']);router['get'](_0xef82('0xb'),auth[_0xef82('0xa')](),controller[_0xef82('0xc')]);router[_0xef82('0x9')]('/:id/conditions',auth['isAuthenticated'](),controller['getConditions']);router[_0xef82('0x9')](_0xef82('0xd'),auth[_0xef82('0xa')](),controller[_0xef82('0xe')]);router['post']('/',auth[_0xef82('0xa')](),controller[_0xef82('0xf')]);router[_0xef82('0x10')](_0xef82('0x11'),auth['isAuthenticated'](),controller[_0xef82('0x12')]);router[_0xef82('0x10')](_0xef82('0xd'),auth['isAuthenticated'](),controller[_0xef82('0x13')]);router[_0xef82('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xef82('0x15')]);router[_0xef82('0x16')](_0xef82('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xef82('0x17')]=router; \ No newline at end of file +var _0x4e00=['index','/:id','show','/:id/conditions','/:id/actions','post','create','addConditions','put','update','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../config/environment','./automation.controller','get','isAuthenticated'];(function(_0x517624,_0x1777bb){var _0x1c8ece=function(_0x5db23d){while(--_0x5db23d){_0x517624['push'](_0x517624['shift']());}};_0x1c8ece(++_0x1777bb);}(_0x4e00,0xa0));var _0x04e0=function(_0x2b20a3,_0x53b751){_0x2b20a3=_0x2b20a3-0x0;var _0x39657b=_0x4e00[_0x2b20a3];return _0x39657b;};'use strict';var multer=require('multer');var util=require(_0x04e0('0x0'));var path=require('path');var timeout=require(_0x04e0('0x1'));var express=require(_0x04e0('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x04e0('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x04e0('0x4'));var controller=require(_0x04e0('0x5'));router[_0x04e0('0x6')]('/',auth[_0x04e0('0x7')](),controller[_0x04e0('0x8')]);router[_0x04e0('0x6')](_0x04e0('0x9'),auth['isAuthenticated'](),controller[_0x04e0('0xa')]);router[_0x04e0('0x6')](_0x04e0('0xb'),auth[_0x04e0('0x7')](),controller['getConditions']);router[_0x04e0('0x6')](_0x04e0('0xc'),auth['isAuthenticated'](),controller['getActions']);router[_0x04e0('0xd')]('/',auth['isAuthenticated'](),controller[_0x04e0('0xe')]);router[_0x04e0('0xd')](_0x04e0('0xb'),auth[_0x04e0('0x7')](),controller[_0x04e0('0xf')]);router[_0x04e0('0xd')](_0x04e0('0xc'),auth[_0x04e0('0x7')](),controller['addActions']);router[_0x04e0('0x10')]('/:id',auth[_0x04e0('0x7')](),controller[_0x04e0('0x11')]);router[_0x04e0('0x12')]('/:id',auth[_0x04e0('0x7')](),controller[_0x04e0('0x13')]);module[_0x04e0('0x14')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 125c62f..d77df23 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 _0xcad1=['#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','STRING','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0xcad1,0x16c));var _0x1cad=function(_0x75fd4c,_0xd1c91b){_0x75fd4c=_0x75fd4c-0x0;var _0x46afe9=_0xcad1[_0x75fd4c];return _0x46afe9;};'use strict';var Sequelize=require('sequelize');module[_0x1cad('0x0')]={'name':{'type':Sequelize[_0x1cad('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x1cad('0x2')),'allowNull':![],'defaultValue':_0x1cad('0x2')},'description':{'type':Sequelize[_0x1cad('0x1')]},'active':{'type':Sequelize[_0x1cad('0x3')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x1cad('0x4')](0x4)[_0x1cad('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1cad('0x6')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1cad('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x1cad('0x4')](0x3)[_0x1cad('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1cad('0x7')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1cad('0x4')](0x5)[_0x1cad('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1cad('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0x1cad('0x4')](0x3)[_0x1cad('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1cad('0x9')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1cad('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1cad('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1cad('0x4')](0x3)[_0x1cad('0x5')],'defaultValue':0x3,'comment':_0x1cad('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1cad('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1cad('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1cad('0x4')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1cad('0xd')},'dialTimezone':{'type':Sequelize[_0x1cad('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x1cad('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x1cad('0xf')](_0x1cad('0x10'),_0x1cad('0x11'),_0x1cad('0x12')),'defaultValue':_0x1cad('0x10')},'dialAMDActive':{'type':Sequelize[_0x1cad('0x3')],'defaultValue':0x0,'comment':_0x1cad('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x1cad('0x4')](0x9)[_0x1cad('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1cad('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x1cad('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1cad('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1cad('0x4')](0x9)[_0x1cad('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1cad('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1cad('0x4')](0x9)[_0x1cad('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1cad('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x1cad('0x4')](0x9)[_0x1cad('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1cad('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1cad('0x4')](0x9)[_0x1cad('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1cad('0x4')](0x9)[_0x1cad('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1cad('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1cad('0x4')](0x5)[_0x1cad('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1cad('0x4')](0x9)[_0x1cad('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1cad('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1cad('0xf')]('DESC',_0x1cad('0x1b')),'defaultValue':_0x1cad('0x1c')},'dialPrefix':{'type':Sequelize[_0x1cad('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1cad('0x4')](0x3)[_0x1cad('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1cad('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1cad('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1cad('0x4')](0x3)[_0x1cad('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1cad('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1cad('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x1cad('0x4')](0x3)[_0x1cad('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1cad('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x1cad('0x4')](0x5)[_0x1cad('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1cad('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1cad('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1cad('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1cad('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x1cad('0x4')](0x3)[_0x1cad('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1cad('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1cad('0x4')](0x5)[_0x1cad('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1cad('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1cad('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1cad('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1cad('0x4')](0x5)[_0x1cad('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x4813=['#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)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\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','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\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,*,*,*','ENUM','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x4813,0xdc));var _0x3481=function(_0x2e0f65,_0x27af29){_0x2e0f65=_0x2e0f65-0x0;var _0x7fd3d8=_0x4813[_0x2e0f65];return _0x7fd3d8;};'use strict';var Sequelize=require(_0x3481('0x0'));module['exports']={'name':{'type':Sequelize[_0x3481('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x3481('0x2')),'allowNull':![],'defaultValue':_0x3481('0x2')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x3481('0x3')],'defaultValue':0x0,'comment':_0x3481('0x4')},'limitCalls':{'type':Sequelize[_0x3481('0x5')](0x4)[_0x3481('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x3481('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x3481('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3481('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3481('0x8')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3481('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3481('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3481('0x5')](0x5)[_0x3481('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3481('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x3481('0x5')](0x3)[_0x3481('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3481('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3481('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3481('0x5')](0x3)[_0x3481('0x6')],'defaultValue':0x3,'comment':_0x3481('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3481('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3481('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3481('0x5')](0x3)[_0x3481('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3481('0xe')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x3481('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x3481('0x10')]('always',_0x3481('0x11'),_0x3481('0x12')),'defaultValue':_0x3481('0x13')},'dialAMDActive':{'type':Sequelize[_0x3481('0x3')],'defaultValue':0x0,'comment':_0x3481('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x3481('0x5')](0x9)[_0x3481('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x3481('0x5')](0x9)[_0x3481('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3481('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3481('0x5')](0x9)[_0x3481('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3481('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3481('0x5')](0x9)[_0x3481('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x3481('0x5')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3481('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3481('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3481('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3481('0x5')](0x9)[_0x3481('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3481('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x3481('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3481('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3481('0x5')](0x9)[_0x3481('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3481('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x3481('0x1c'),_0x3481('0x1d')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x3481('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3481('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3481('0x1e')},'dialCutDigit':{'type':Sequelize[_0x3481('0x5')](0x3)[_0x3481('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3481('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3481('0x5')](0x3)[_0x3481('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3481('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3481('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3481('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0x3481('0x5')](0x3)[_0x3481('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3481('0x22')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3481('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3481('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3481('0x5')](0x3)[_0x3481('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3481('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3481('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3481('0x25')},'dialMachineMaxRetry':{'type':Sequelize[_0x3481('0x5')](0x3)[_0x3481('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3481('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3481('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3481('0x5')](0x3)[_0x3481('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3481('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3481('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3481('0x28')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 9bb9b1d..607599e 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 _0x8425=['ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','save','update','destroy','then','get','IvrCampaigns','UserProfileResource','error','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','body','createdAt','role','params','findOne','CmHopper','CampaignId','pick','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','omit','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','into','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','CmListId','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id'];(function(_0x138d06,_0x33edf2){var _0x1a01eb=function(_0x387acb){while(--_0x387acb){_0x138d06['push'](_0x138d06['shift']());}};_0x1a01eb(++_0x33edf2);}(_0x8425,0x13b));var _0x5842=function(_0x235d58,_0x38f76b){_0x235d58=_0x235d58-0x0;var _0x3caffe=_0x8425[_0x235d58];return _0x3caffe;};'use strict';var emlformat=require(_0x5842('0x0'));var rimraf=require(_0x5842('0x1'));var zipdir=require(_0x5842('0x2'));var jsonpatch=require(_0x5842('0x3'));var rp=require('request-promise');var moment=require(_0x5842('0x4'));var BPromise=require(_0x5842('0x5'));var Mustache=require(_0x5842('0x6'));var util=require(_0x5842('0x7'));var path=require(_0x5842('0x8'));var sox=require(_0x5842('0x9'));var csv=require(_0x5842('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5842('0xb'));var _=require(_0x5842('0xc'));var squel=require(_0x5842('0xd'));var crypto=require(_0x5842('0xe'));var jsforce=require(_0x5842('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5842('0x10'));var Papa=require('papaparse');var Redis=require(_0x5842('0x11'));var authService=require(_0x5842('0x12'));var qs=require(_0x5842('0x13'));var as=require(_0x5842('0x14'));var hardwareService=require(_0x5842('0x15'));var logger=require(_0x5842('0x16'))(_0x5842('0x17'));var utils=require(_0x5842('0x18'));var config=require(_0x5842('0x19'));var licenseUtil=require(_0x5842('0x1a'));var db=require(_0x5842('0x1b'))['db'];function respondWithStatusCode(_0x27c9dd,_0x4bdc3e){_0x4bdc3e=_0x4bdc3e||0xcc;return function(_0x161205){if(_0x161205){return _0x27c9dd[_0x5842('0x1c')](_0x4bdc3e);}return _0x27c9dd[_0x5842('0x1d')](_0x4bdc3e)[_0x5842('0x1e')]();};}function respondWithResult(_0x7ffc1d,_0xae5ed3){_0xae5ed3=_0xae5ed3||0xc8;return function(_0x34df4e){if(_0x34df4e){return _0x7ffc1d[_0x5842('0x1d')](_0xae5ed3)[_0x5842('0x1f')](_0x34df4e);}};}function respondWithFilteredResult(_0x290d85,_0x1dd6a3){return function(_0x2194b7){if(_0x2194b7){var _0x2e62bc=typeof _0x1dd6a3[_0x5842('0x20')]===_0x5842('0x21')&&typeof _0x1dd6a3['limit']===_0x5842('0x21');var _0x30553a=_0x2194b7[_0x5842('0x22')];var _0x5c95e8=_0x2e62bc?0x0:_0x1dd6a3[_0x5842('0x20')];var _0x2de73e=_0x2e62bc?_0x2194b7[_0x5842('0x22')]:_0x1dd6a3[_0x5842('0x20')]+_0x1dd6a3['limit'];var _0x5a96f6;if(_0x2de73e>=_0x30553a){_0x2de73e=_0x30553a;_0x5a96f6=0xc8;}else{_0x5a96f6=0xce;}_0x290d85['status'](_0x5a96f6);return _0x290d85[_0x5842('0x23')]('Content-Range',_0x5c95e8+'-'+_0x2de73e+'/'+_0x30553a)[_0x5842('0x1f')](_0x2194b7);}return null;};}function patchUpdates(_0x3a3fc9){return function(_0x347220){try{jsonpatch['apply'](_0x347220,_0x3a3fc9,!![]);}catch(_0x5d7ec3){return BPromise['reject'](_0x5d7ec3);}return _0x347220[_0x5842('0x24')]();};}function saveUpdates(_0x2c4f58,_0x465265){return function(_0x242275){if(_0x242275){return _0x242275[_0x5842('0x25')](_0x2c4f58)['then'](function(_0x27bba8){return _0x27bba8;});}return null;};}function removeEntity(_0x26db23,_0xfd6c08){return function(_0x54563b){if(_0x54563b){return _0x54563b[_0x5842('0x26')]()[_0x5842('0x27')](function(){var _0x31a61b=_0x54563b[_0x5842('0x28')]({'plain':!![]});var _0x446c33=_0x5842('0x29');return db[_0x5842('0x2a')]['destroy']({'where':{'type':_0x446c33,'resourceId':_0x31a61b['id']}})['then'](function(){return _0x54563b;});})['then'](function(){_0x26db23[_0x5842('0x1d')](0xcc)[_0x5842('0x1e')]();});}};}function handleEntityNotFound(_0x2be6b8,_0x17079a){return function(_0x2ab1ac){if(!_0x2ab1ac){_0x2be6b8['sendStatus'](0x194);}return _0x2ab1ac;};}function handleError(_0x489b13,_0x1b375b){_0x1b375b=_0x1b375b||0x1f4;return function(_0x37295d){logger[_0x5842('0x2b')](_0x37295d['stack']);if(_0x37295d[_0x5842('0x2c')]){delete _0x37295d[_0x5842('0x2c')];}_0x489b13[_0x5842('0x1d')](_0x1b375b)[_0x5842('0x2d')](_0x37295d);};}exports[_0x5842('0x2e')]=function(_0x1fafd7,_0xf3dcf5){var _0x2f6d6b={},_0x5522c3={},_0x449efc={'count':0x0,'rows':[]};var _0x54646a=_[_0x5842('0x2f')](db[_0x5842('0x30')][_0x5842('0x31')],function(_0x28a1fd){return{'name':_0x28a1fd[_0x5842('0x32')],'type':_0x28a1fd[_0x5842('0x33')][_0x5842('0x34')]};});_0x5522c3[_0x5842('0x35')]=_['map'](_0x54646a,'name');_0x5522c3[_0x5842('0x36')]=_[_0x5842('0x37')](_0x1fafd7[_0x5842('0x36')]);_0x5522c3[_0x5842('0x38')]=_[_0x5842('0x39')](_0x5522c3[_0x5842('0x35')],_0x5522c3[_0x5842('0x36')]);_0x2f6d6b['attributes']=_[_0x5842('0x39')](_0x5522c3[_0x5842('0x35')],qs[_0x5842('0x3a')](_0x1fafd7['query'][_0x5842('0x3a')]));_0x2f6d6b[_0x5842('0x3b')]=_0x2f6d6b[_0x5842('0x3b')]['length']?_0x2f6d6b[_0x5842('0x3b')]:_0x5522c3[_0x5842('0x35')];if(!_0x1fafd7[_0x5842('0x36')][_0x5842('0x3c')](_0x5842('0x3d'))){_0x2f6d6b[_0x5842('0x3e')]=qs[_0x5842('0x3e')](_0x1fafd7['query']['limit']);_0x2f6d6b['offset']=qs[_0x5842('0x20')](_0x1fafd7[_0x5842('0x36')][_0x5842('0x20')]);}_0x2f6d6b[_0x5842('0x3f')]=qs[_0x5842('0x40')](_0x1fafd7[_0x5842('0x36')][_0x5842('0x40')]);_0x2f6d6b[_0x5842('0x41')]=qs[_0x5842('0x38')](_['pick'](_0x1fafd7[_0x5842('0x36')],_0x5522c3[_0x5842('0x38')]),_0x54646a);if(_0x1fafd7['query'][_0x5842('0x42')]){_0x2f6d6b[_0x5842('0x41')]=_[_0x5842('0x43')](_0x2f6d6b['where'],{'$or':_['map'](_0x54646a,function(_0x2f306f){if(_0x2f306f['type']!==_0x5842('0x44')){var _0x341480={};_0x341480[_0x2f306f[_0x5842('0x2c')]]={'$like':'%'+_0x1fafd7['query'][_0x5842('0x42')]+'%'};return _0x341480;}})});}_0x2f6d6b=_['merge']({},_0x2f6d6b,_0x1fafd7['options']);var _0xb7e241={'where':_0x2f6d6b['where']};return db[_0x5842('0x30')]['count'](_0xb7e241)[_0x5842('0x27')](function(_0x3e30fb){_0x449efc[_0x5842('0x22')]=_0x3e30fb;if(_0x1fafd7['query'][_0x5842('0x45')]){_0x2f6d6b[_0x5842('0x46')]=[{'all':!![]}];}return db[_0x5842('0x30')][_0x5842('0x47')](_0x2f6d6b);})['then'](function(_0x2187ee){_0x449efc[_0x5842('0x48')]=_0x2187ee;return _0x449efc;})[_0x5842('0x27')](respondWithFilteredResult(_0xf3dcf5,_0x2f6d6b))[_0x5842('0x49')](handleError(_0xf3dcf5,null));};exports[_0x5842('0x4a')]=function(_0x280320,_0x356c12){var _0x351fd3={'raw':![],'where':{'id':_0x280320['params']['id']}},_0x3c5f1b={};_0x3c5f1b['model']=_[_0x5842('0x37')](db[_0x5842('0x30')]['rawAttributes']);_0x3c5f1b['query']=_[_0x5842('0x37')](_0x280320[_0x5842('0x36')]);_0x3c5f1b[_0x5842('0x38')]=_[_0x5842('0x39')](_0x3c5f1b['model'],_0x3c5f1b[_0x5842('0x36')]);_0x351fd3['attributes']=_[_0x5842('0x39')](_0x3c5f1b[_0x5842('0x35')],qs['fields'](_0x280320['query'][_0x5842('0x3a')]));_0x351fd3[_0x5842('0x3b')]=_0x351fd3[_0x5842('0x3b')][_0x5842('0x4b')]?_0x351fd3['attributes']:_0x3c5f1b[_0x5842('0x35')];if(_0x280320[_0x5842('0x36')]['includeAll']){_0x351fd3[_0x5842('0x46')]=[{'all':!![]}];}_0x351fd3=_[_0x5842('0x43')]({},_0x351fd3,_0x280320[_0x5842('0x4c')]);return db[_0x5842('0x30')][_0x5842('0x4d')](_0x351fd3)[_0x5842('0x27')](handleEntityNotFound(_0x356c12,null))['then'](respondWithResult(_0x356c12,null))[_0x5842('0x49')](handleError(_0x356c12,null));};exports[_0x5842('0x4e')]=function(_0x58c166,_0x1a6b65){return db[_0x5842('0x30')]['create'](_0x58c166['body'],{})[_0x5842('0x27')](function(_0x233b7a){var _0x371668=_0x58c166[_0x5842('0x4f')][_0x5842('0x28')]({'plain':!![]});if(!_0x371668)throw new Error(_0x5842('0x50'));if(_0x371668['role']==='user'){var _0x1e76f1=_0x233b7a[_0x5842('0x28')]({'plain':!![]});var _0x45f4de=_0x5842('0x29');return db[_0x5842('0x51')][_0x5842('0x4d')]({'where':{'name':_0x45f4de,'userProfileId':_0x371668[_0x5842('0x52')]},'raw':!![]})['then'](function(_0x1f006b){if(_0x1f006b&&_0x1f006b[_0x5842('0x53')]===0x0){return db[_0x5842('0x2a')]['create']({'name':_0x1e76f1['name'],'resourceId':_0x1e76f1['id'],'type':_0x1f006b[_0x5842('0x2c')],'sectionId':_0x1f006b['id']},{})['then'](function(){return _0x233b7a;});}else{return _0x233b7a;}})['catch'](function(_0x451ae3){logger[_0x5842('0x2b')](_0x5842('0x54'),_0x451ae3);throw _0x451ae3;});}return _0x233b7a;})[_0x5842('0x27')](respondWithResult(_0x1a6b65,0xc9))['catch'](handleError(_0x1a6b65,null));};exports[_0x5842('0x55')]=function(_0x365362,_0x3adc9c){var _0x4c4dbb={'where':{'id':_0x365362['params']['id']}},_0x24436c={};_0x24436c[_0x5842('0x35')]=_[_0x5842('0x37')](db['Campaign'][_0x5842('0x31')]);_0x4c4dbb['attributes']=_['intersection'](_0x24436c[_0x5842('0x35')],qs[_0x5842('0x3a')](_0x365362[_0x5842('0x36')][_0x5842('0x3a')]));_0x4c4dbb['attributes']=_0x4c4dbb[_0x5842('0x3b')][_0x5842('0x4b')]?_0x4c4dbb[_0x5842('0x3b')]:_0x24436c['model'];if(_0x365362[_0x5842('0x36')][_0x5842('0x45')]){_0x4c4dbb[_0x5842('0x46')]=[{'all':!![]}];}_0x4c4dbb=_[_0x5842('0x43')]({},_0x4c4dbb,_0x365362[_0x5842('0x4c')]);return db[_0x5842('0x30')][_0x5842('0x4d')](_0x4c4dbb)['then'](handleEntityNotFound(_0x3adc9c,null))[_0x5842('0x27')](function(_0x4e7ca8){if(_0x4e7ca8){var _0x51ba03=_0x4e7ca8['get']({'plain':!![]});_0x51ba03=qs['omit'](_0x51ba03,['id','createdAt',_0x5842('0x56')]);_0x365362[_0x5842('0x57')]=_['omit'](_0x365362[_0x5842('0x57')],['id',_0x5842('0x58'),_0x5842('0x56')]);return db['Campaign'][_0x5842('0x4e')](_[_0x5842('0x43')](_0x51ba03,_0x365362[_0x5842('0x57')]),{'include':_0x365362[_0x5842('0x36')][_0x5842('0x45')]?[{'all':!![]}]:undefined})[_0x5842('0x27')](function(_0x526f32){var _0x2de4e9=_0x365362[_0x5842('0x4f')][_0x5842('0x28')]({'plain':!![]});if(!_0x2de4e9)throw new Error(_0x5842('0x50'));if(_0x2de4e9[_0x5842('0x59')]===_0x5842('0x4f')){var _0x141208=_0x526f32[_0x5842('0x28')]({'plain':!![]});var _0x389867=_0x5842('0x29');return db[_0x5842('0x51')][_0x5842('0x4d')]({'where':{'name':_0x389867,'userProfileId':_0x2de4e9['userProfileId']},'raw':!![]})['then'](function(_0xccb58e){if(_0xccb58e&&_0xccb58e[_0x5842('0x53')]===0x0){return db['UserProfileResource'][_0x5842('0x4e')]({'name':_0x141208[_0x5842('0x2c')],'resourceId':_0x141208['id'],'type':_0xccb58e[_0x5842('0x2c')],'sectionId':_0xccb58e['id']},{})['then'](function(){return _0x526f32;});}else{return _0x526f32;}})['catch'](function(_0x21c45f){logger[_0x5842('0x2b')](_0x5842('0x54'),_0x21c45f);throw _0x21c45f;});}return _0x526f32;});}})[_0x5842('0x27')](respondWithResult(_0x3adc9c,0xc9))[_0x5842('0x49')](handleError(_0x3adc9c,null));};exports[_0x5842('0x25')]=function(_0x40a55c,_0x2cf0ef){if(_0x40a55c[_0x5842('0x57')]['id']){delete _0x40a55c[_0x5842('0x57')]['id'];}return db['Campaign'][_0x5842('0x4d')]({'where':{'id':_0x40a55c[_0x5842('0x5a')]['id']}})[_0x5842('0x27')](handleEntityNotFound(_0x2cf0ef,null))[_0x5842('0x27')](saveUpdates(_0x40a55c[_0x5842('0x57')],null))['then'](respondWithResult(_0x2cf0ef,null))[_0x5842('0x49')](handleError(_0x2cf0ef,null));};exports['destroy']=function(_0x4cbe89,_0x22bf70){return db[_0x5842('0x30')][_0x5842('0x4d')]({'where':{'id':_0x4cbe89[_0x5842('0x5a')]['id']}})[_0x5842('0x27')](handleEntityNotFound(_0x22bf70,null))[_0x5842('0x27')](removeEntity(_0x22bf70,null))['catch'](handleError(_0x22bf70,null));};exports['getHoppers']=function(_0x57ab3d,_0xf87265,_0x3dbf9b){var _0x37095b={'raw':!![],'where':{}};var _0x3d37b0={};var _0x489f67={'count':0x0,'rows':[]};return db[_0x5842('0x30')][_0x5842('0x5b')]({'where':{'id':_0x57ab3d['params']['id']}})[_0x5842('0x27')](handleEntityNotFound(_0xf87265,null))['then'](function(_0x217253){if(_0x217253){_0x3d37b0[_0x5842('0x35')]=_[_0x5842('0x37')](db[_0x5842('0x5c')][_0x5842('0x31')]);_0x3d37b0['query']=_[_0x5842('0x37')](_0x57ab3d[_0x5842('0x36')]);_0x3d37b0[_0x5842('0x38')]=_[_0x5842('0x39')](_0x3d37b0[_0x5842('0x35')],_0x3d37b0[_0x5842('0x36')]);_0x37095b['attributes']=_[_0x5842('0x39')](_0x3d37b0[_0x5842('0x35')],qs[_0x5842('0x3a')](_0x57ab3d[_0x5842('0x36')][_0x5842('0x3a')]));_0x37095b['attributes']=_0x37095b[_0x5842('0x3b')]['length']?_0x37095b[_0x5842('0x3b')]:_0x3d37b0['model'];if(!_0x57ab3d[_0x5842('0x36')]['hasOwnProperty'](_0x5842('0x3d'))){_0x37095b[_0x5842('0x3e')]=qs[_0x5842('0x3e')](_0x57ab3d[_0x5842('0x36')]['limit']);_0x37095b[_0x5842('0x20')]=qs['offset'](_0x57ab3d[_0x5842('0x36')][_0x5842('0x20')]);}_0x37095b[_0x5842('0x3f')]=qs[_0x5842('0x40')](_0x57ab3d[_0x5842('0x36')][_0x5842('0x40')]);_0x37095b[_0x5842('0x41')]=qs[_0x5842('0x38')](_['pick'](_0x57ab3d[_0x5842('0x36')],_0x3d37b0[_0x5842('0x38')]));_0x37095b[_0x5842('0x41')][_0x5842('0x5d')]=_0x217253['id'];if(_0x57ab3d[_0x5842('0x36')]['filter']){_0x37095b['where']=_[_0x5842('0x43')](_0x37095b['where'],{'$or':_['map'](_0x37095b[_0x5842('0x3b')],function(_0x360899){var _0x993de9={};_0x993de9[_0x360899]={'$like':'%'+_0x57ab3d[_0x5842('0x36')][_0x5842('0x42')]+'%'};return _0x993de9;})});}_0x37095b=_['merge']({},_0x37095b,_0x57ab3d['options']);return db[_0x5842('0x5c')][_0x5842('0x22')]({'where':_0x37095b['where']})[_0x5842('0x27')](function(_0x6275a){_0x489f67[_0x5842('0x22')]=_0x6275a;if(_0x57ab3d[_0x5842('0x36')][_0x5842('0x45')]){_0x37095b[_0x5842('0x46')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x37095b);})['then'](function(_0x16b90e){_0x489f67[_0x5842('0x48')]=_0x16b90e;return _0x489f67;});}})[_0x5842('0x27')](respondWithFilteredResult(_0xf87265,_0x37095b))[_0x5842('0x49')](handleError(_0xf87265,null));};exports['getHopperHistories']=function(_0x3a9ac4,_0x273751,_0x588371){var _0x4ce511={'raw':!![],'where':{}};var _0x3c5e85={};var _0x35ef38={'count':0x0,'rows':[]};return db[_0x5842('0x30')]['findOne']({'where':{'id':_0x3a9ac4[_0x5842('0x5a')]['id']}})['then'](handleEntityNotFound(_0x273751,null))[_0x5842('0x27')](function(_0x293f0d){if(_0x293f0d){_0x3c5e85[_0x5842('0x35')]=_[_0x5842('0x37')](db['CmHopperHistory'][_0x5842('0x31')]);_0x3c5e85[_0x5842('0x36')]=_[_0x5842('0x37')](_0x3a9ac4[_0x5842('0x36')]);_0x3c5e85[_0x5842('0x38')]=_['intersection'](_0x3c5e85[_0x5842('0x35')],_0x3c5e85[_0x5842('0x36')]);_0x4ce511[_0x5842('0x3b')]=_[_0x5842('0x39')](_0x3c5e85[_0x5842('0x35')],qs[_0x5842('0x3a')](_0x3a9ac4['query'][_0x5842('0x3a')]));_0x4ce511[_0x5842('0x3b')]=_0x4ce511[_0x5842('0x3b')][_0x5842('0x4b')]?_0x4ce511[_0x5842('0x3b')]:_0x3c5e85[_0x5842('0x35')];if(!_0x3a9ac4[_0x5842('0x36')][_0x5842('0x3c')]('nolimit')){_0x4ce511['limit']=qs['limit'](_0x3a9ac4['query'][_0x5842('0x3e')]);_0x4ce511[_0x5842('0x20')]=qs['offset'](_0x3a9ac4[_0x5842('0x36')][_0x5842('0x20')]);}_0x4ce511['order']=qs[_0x5842('0x40')](_0x3a9ac4[_0x5842('0x36')][_0x5842('0x40')]);_0x4ce511[_0x5842('0x41')]=qs[_0x5842('0x38')](_[_0x5842('0x5e')](_0x3a9ac4[_0x5842('0x36')],_0x3c5e85['filters']));_0x4ce511[_0x5842('0x41')][_0x5842('0x5d')]=_0x293f0d['id'];if(_0x3a9ac4[_0x5842('0x36')]['filter']){_0x4ce511['where']=_[_0x5842('0x43')](_0x4ce511['where'],{'$or':_[_0x5842('0x2f')](_0x4ce511[_0x5842('0x3b')],function(_0x40d2d8){var _0x3de2c1={};_0x3de2c1[_0x40d2d8]={'$like':'%'+_0x3a9ac4[_0x5842('0x36')][_0x5842('0x42')]+'%'};return _0x3de2c1;})});}_0x4ce511=_[_0x5842('0x43')]({},_0x4ce511,_0x3a9ac4[_0x5842('0x4c')]);return db['CmHopperHistory'][_0x5842('0x22')]({'where':_0x4ce511[_0x5842('0x41')]})['then'](function(_0xfb53e){_0x35ef38[_0x5842('0x22')]=_0xfb53e;if(_0x3a9ac4[_0x5842('0x36')][_0x5842('0x45')]){_0x4ce511[_0x5842('0x46')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x4ce511);})[_0x5842('0x27')](function(_0x473030){_0x35ef38['rows']=_0x473030;return _0x35ef38;});}})['then'](respondWithFilteredResult(_0x273751,_0x4ce511))[_0x5842('0x49')](handleError(_0x273751,null));};exports[_0x5842('0x5f')]=function(_0x3e4ae1,_0x582536,_0x3a993a){var _0xf8cd20={'raw':!![],'where':{}};var _0x41a6bb={};var _0x5345a6={'count':0x0,'rows':[]};return db[_0x5842('0x30')][_0x5842('0x5b')]({'where':{'id':_0x3e4ae1[_0x5842('0x5a')]['id']}})[_0x5842('0x27')](handleEntityNotFound(_0x582536,null))[_0x5842('0x27')](function(_0xc88a2e){if(_0xc88a2e){_0x41a6bb[_0x5842('0x35')]=_[_0x5842('0x37')](db[_0x5842('0x60')][_0x5842('0x31')]);_0x41a6bb[_0x5842('0x36')]=_[_0x5842('0x37')](_0x3e4ae1[_0x5842('0x36')]);_0x41a6bb[_0x5842('0x38')]=_[_0x5842('0x39')](_0x41a6bb[_0x5842('0x35')],_0x41a6bb[_0x5842('0x36')]);_0xf8cd20['attributes']=_[_0x5842('0x39')](_0x41a6bb[_0x5842('0x35')],qs['fields'](_0x3e4ae1['query'][_0x5842('0x3a')]));_0xf8cd20[_0x5842('0x3b')]=_0xf8cd20[_0x5842('0x3b')][_0x5842('0x4b')]?_0xf8cd20['attributes']:_0x41a6bb['model'];if(!_0x3e4ae1[_0x5842('0x36')][_0x5842('0x3c')](_0x5842('0x3d'))){_0xf8cd20[_0x5842('0x3e')]=qs[_0x5842('0x3e')](_0x3e4ae1[_0x5842('0x36')][_0x5842('0x3e')]);_0xf8cd20['offset']=qs['offset'](_0x3e4ae1[_0x5842('0x36')][_0x5842('0x20')]);}_0xf8cd20['order']=qs['sort'](_0x3e4ae1[_0x5842('0x36')][_0x5842('0x40')]);_0xf8cd20[_0x5842('0x41')]=qs[_0x5842('0x38')](_[_0x5842('0x5e')](_0x3e4ae1[_0x5842('0x36')],_0x41a6bb[_0x5842('0x38')]));_0xf8cd20[_0x5842('0x41')][_0x5842('0x5d')]=_0xc88a2e['id'];if(_0x3e4ae1[_0x5842('0x36')][_0x5842('0x42')]){_0xf8cd20[_0x5842('0x41')]=_[_0x5842('0x43')](_0xf8cd20['where'],{'$or':_[_0x5842('0x2f')](_0xf8cd20['attributes'],function(_0x50990c){var _0x15f462={};_0x15f462[_0x50990c]={'$like':'%'+_0x3e4ae1[_0x5842('0x36')][_0x5842('0x42')]+'%'};return _0x15f462;})});}_0xf8cd20=_['merge']({},_0xf8cd20,_0x3e4ae1[_0x5842('0x4c')]);return db[_0x5842('0x60')][_0x5842('0x22')]({'where':_0xf8cd20[_0x5842('0x41')]})[_0x5842('0x27')](function(_0x1b873b){_0x5345a6[_0x5842('0x22')]=_0x1b873b;if(_0x3e4ae1[_0x5842('0x36')][_0x5842('0x45')]){_0xf8cd20[_0x5842('0x46')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x5842('0x47')](_0xf8cd20);})[_0x5842('0x27')](function(_0x3db4c4){_0x5345a6[_0x5842('0x48')]=_0x3db4c4;return _0x5345a6;});}})['then'](respondWithFilteredResult(_0x582536,_0xf8cd20))[_0x5842('0x49')](handleError(_0x582536,null));};exports[_0x5842('0x61')]=function(_0x2ed56e,_0x37e48e,_0x39c815){var _0x2a7698={'raw':!![],'where':{}};var _0x249f24={};var _0x1df641={'count':0x0,'rows':[]};return db[_0x5842('0x30')]['findOne']({'where':{'id':_0x2ed56e[_0x5842('0x5a')]['id']}})[_0x5842('0x27')](handleEntityNotFound(_0x37e48e,null))[_0x5842('0x27')](function(_0x394296){if(_0x394296){_0x249f24[_0x5842('0x35')]=_['keys'](db[_0x5842('0x62')]['rawAttributes']);_0x249f24[_0x5842('0x36')]=_[_0x5842('0x37')](_0x2ed56e['query']);_0x249f24[_0x5842('0x38')]=_[_0x5842('0x39')](_0x249f24[_0x5842('0x35')],_0x249f24[_0x5842('0x36')]);_0x2a7698[_0x5842('0x3b')]=_[_0x5842('0x39')](_0x249f24['model'],qs['fields'](_0x2ed56e[_0x5842('0x36')][_0x5842('0x3a')]));_0x2a7698[_0x5842('0x3b')]=_0x2a7698[_0x5842('0x3b')]['length']?_0x2a7698['attributes']:_0x249f24['model'];if(!_0x2ed56e[_0x5842('0x36')][_0x5842('0x3c')](_0x5842('0x3d'))){_0x2a7698[_0x5842('0x3e')]=qs[_0x5842('0x3e')](_0x2ed56e[_0x5842('0x36')][_0x5842('0x3e')]);_0x2a7698[_0x5842('0x20')]=qs[_0x5842('0x20')](_0x2ed56e[_0x5842('0x36')][_0x5842('0x20')]);}_0x2a7698[_0x5842('0x3f')]=qs[_0x5842('0x40')](_0x2ed56e['query'][_0x5842('0x40')]);_0x2a7698[_0x5842('0x41')]=qs[_0x5842('0x38')](_[_0x5842('0x5e')](_0x2ed56e[_0x5842('0x36')],_0x249f24['filters']));_0x2a7698['where']['CampaignId']=_0x394296['id'];if(_0x2ed56e[_0x5842('0x36')][_0x5842('0x42')]){_0x2a7698['where']=_[_0x5842('0x43')](_0x2a7698[_0x5842('0x41')],{'$or':_[_0x5842('0x2f')](_0x2a7698['attributes'],function(_0x335978){var _0x4b1495={};_0x4b1495[_0x335978]={'$like':'%'+_0x2ed56e[_0x5842('0x36')][_0x5842('0x42')]+'%'};return _0x4b1495;})});}_0x2a7698=_['merge']({},_0x2a7698,_0x2ed56e[_0x5842('0x4c')]);return db[_0x5842('0x62')][_0x5842('0x22')]({'where':_0x2a7698['where']})[_0x5842('0x27')](function(_0x48024b){_0x1df641['count']=_0x48024b;if(_0x2ed56e[_0x5842('0x36')][_0x5842('0x45')]){_0x2a7698[_0x5842('0x46')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x5842('0x47')](_0x2a7698);})['then'](function(_0x2685cc){_0x1df641[_0x5842('0x48')]=_0x2685cc;return _0x1df641;});}})[_0x5842('0x27')](respondWithFilteredResult(_0x37e48e,_0x2a7698))[_0x5842('0x49')](handleError(_0x37e48e,null));};exports['getLists']=function(_0xd9a00e,_0x45a01b,_0x3b5a03){var _0x59960b={};var _0x87dfc6={};var _0x2b79b4;var _0x439306;return db['Campaign']['findOne']({'where':{'id':_0xd9a00e[_0x5842('0x5a')]['id']}})[_0x5842('0x27')](handleEntityNotFound(_0x45a01b,null))[_0x5842('0x27')](function(_0x4bc828){if(_0x4bc828){_0x2b79b4=_0x4bc828;_0x87dfc6[_0x5842('0x35')]=_[_0x5842('0x37')](db[_0x5842('0x63')][_0x5842('0x31')]);_0x87dfc6['query']=_[_0x5842('0x37')](_0xd9a00e[_0x5842('0x36')]);_0x87dfc6[_0x5842('0x38')]=_[_0x5842('0x39')](_0x87dfc6[_0x5842('0x35')],_0x87dfc6[_0x5842('0x36')]);_0x59960b[_0x5842('0x3b')]=_[_0x5842('0x39')](_0x87dfc6[_0x5842('0x35')],qs[_0x5842('0x3a')](_0xd9a00e[_0x5842('0x36')][_0x5842('0x3a')]));_0x59960b[_0x5842('0x3b')]=_0x59960b[_0x5842('0x3b')]['length']?_0x59960b[_0x5842('0x3b')]:_0x87dfc6['model'];_0x59960b[_0x5842('0x3f')]=qs[_0x5842('0x40')](_0xd9a00e['query']['sort']);_0x59960b[_0x5842('0x41')]=qs[_0x5842('0x38')](_[_0x5842('0x5e')](_0xd9a00e[_0x5842('0x36')],_0x87dfc6[_0x5842('0x38')]));if(_0xd9a00e[_0x5842('0x36')][_0x5842('0x42')]){_0x59960b['where']=_[_0x5842('0x43')](_0x59960b[_0x5842('0x41')],{'$or':_[_0x5842('0x2f')](_0x59960b[_0x5842('0x3b')],function(_0x33be61){var _0x2ade7={};_0x2ade7[_0x33be61]={'$like':'%'+_0xd9a00e[_0x5842('0x36')]['filter']+'%'};return _0x2ade7;})});}_0x59960b=_[_0x5842('0x43')]({},_0x59960b,_0xd9a00e[_0x5842('0x4c')]);return _0x2b79b4[_0x5842('0x64')](_0x59960b);}})['then'](function(_0x20ae66){if(_0x20ae66){_0x439306=_0x20ae66[_0x5842('0x4b')];if(!_0xd9a00e[_0x5842('0x36')][_0x5842('0x3c')](_0x5842('0x3d'))){_0x59960b[_0x5842('0x3e')]=qs[_0x5842('0x3e')](_0xd9a00e[_0x5842('0x36')]['limit']);_0x59960b['offset']=qs[_0x5842('0x20')](_0xd9a00e[_0x5842('0x36')][_0x5842('0x20')]);}return _0x2b79b4[_0x5842('0x64')](_0x59960b);}})[_0x5842('0x27')](function(_0x196ce8){if(_0x196ce8){return _0x196ce8?{'count':_0x439306,'rows':_0x196ce8}:null;}})['then'](respondWithResult(_0x45a01b,null))[_0x5842('0x49')](handleError(_0x45a01b,null));};exports[_0x5842('0x65')]=function(_0x1d5d0d,_0x13eb76,_0x11837d){var _0x350b73,_0x5c8368;var _0xfd544b=[];var _0x247fc0=moment()[_0x5842('0x66')](_0x5842('0x67'));return db[_0x5842('0x30')][_0x5842('0x4d')]({'where':{'id':_0x1d5d0d[_0x5842('0x5a')]['id']}})['then'](handleEntityNotFound(_0x13eb76,null))[_0x5842('0x27')](function(_0x12a966){if(_0x12a966){_0x5c8368=_0x12a966;return _0x12a966[_0x5842('0x65')](_0x1d5d0d['body'][_0x5842('0x68')],_[_0x5842('0x69')](_0x1d5d0d[_0x5842('0x57')],[_0x5842('0x68'),'id'])||{});}return null;})['spread'](function(_0x4fa0d4){var _0x4472ef;var _0x42d1bf;_0x350b73=_0x4fa0d4||[];var _0x1167db=[];if(_0x4fa0d4){for(var _0x528716=0x0;_0x528716<_0x4fa0d4[_0x5842('0x4b')];_0x528716+=0x1){var _0x3bf757=_0x4fa0d4[_0x528716][_0x5842('0x28')]({'plain':!![]});_0x5c8368[_0x5842('0x6a')]=_0x1d5d0d[_0x5842('0x57')][_0x5842('0x6a')]?_0x1d5d0d[_0x5842('0x57')][_0x5842('0x6a')]:_0x5c8368['dialCheckDuplicateType'];switch(_0x5c8368[_0x5842('0x6a')]){case'always':_0x4472ef=squel[_0x5842('0x6b')]()['into'](_0x5842('0x6c'))[_0x5842('0x6d')]([_0x5842('0x6e'),_0x5842('0x6f'),_0x5842('0x70'),_0x5842('0x71'),_0x5842('0x5d'),_0x5842('0x58'),_0x5842('0x56')],squel[_0x5842('0x72')]()[_0x5842('0x73')](_0x5842('0x6e'),_0x5842('0x6e'))[_0x5842('0x73')](_0x5842('0x74'),_0x5842('0x6f'))[_0x5842('0x73')]('id',_0x5842('0x70'))[_0x5842('0x73')](_0x3bf757['CmListId'][_0x5842('0x75')](),_0x5842('0x71'))[_0x5842('0x73')](_0x1d5d0d[_0x5842('0x5a')]['id']['toString'](),_0x5842('0x5d'))[_0x5842('0x73')]('\x27'+_0x247fc0+'\x27',_0x5842('0x58'))[_0x5842('0x73')]('\x27'+_0x247fc0+'\x27',_0x5842('0x56'))[_0x5842('0x76')](_0x5842('0x77'))[_0x5842('0x41')](_0x5842('0x78'))[_0x5842('0x41')]('ListId\x20=\x20?',_0x3bf757['CmListId'][_0x5842('0x75')]())[_0x5842('0x41')](_0x5842('0x79'))[_0x5842('0x41')](_0x5842('0x7a'),squel[_0x5842('0x72')]()[_0x5842('0x73')](_0x5842('0x7b'))[_0x5842('0x76')](_0x5842('0x7c'))[_0x5842('0x41')](_0x5842('0x7d'),_0x1d5d0d[_0x5842('0x5a')]['id']['toString']()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x5842('0x76')](_0x5842('0x6c'))['where']('CampaignId\x20=\x20?',_0x1d5d0d['params']['id'][_0x5842('0x75')]())))[_0x5842('0x75')]();break;case _0x5842('0x7e'):_0x4472ef=squel[_0x5842('0x6b')]()[_0x5842('0x7f')](_0x5842('0x6c'))['fromQuery'](['phone',_0x5842('0x6f'),_0x5842('0x70'),_0x5842('0x71'),_0x5842('0x5d'),_0x5842('0x58'),_0x5842('0x56')],squel[_0x5842('0x72')]()[_0x5842('0x73')](_0x5842('0x6e'),'phone')['field'](_0x5842('0x74'),'scheduledAt')[_0x5842('0x73')]('id','ContactId')[_0x5842('0x73')](_0x3bf757['CmListId'][_0x5842('0x75')](),_0x5842('0x71'))[_0x5842('0x73')](_0x1d5d0d[_0x5842('0x5a')]['id'][_0x5842('0x75')](),_0x5842('0x5d'))[_0x5842('0x73')]('\x27'+_0x247fc0+'\x27',_0x5842('0x58'))[_0x5842('0x73')]('\x27'+_0x247fc0+'\x27',_0x5842('0x56'))[_0x5842('0x76')](_0x5842('0x77'))[_0x5842('0x41')](_0x5842('0x78'))['where'](_0x5842('0x80'),_0x3bf757['CmListId'][_0x5842('0x75')]())[_0x5842('0x41')](_0x5842('0x79'))[_0x5842('0x41')](_0x5842('0x7a'),squel[_0x5842('0x72')]()['field'](_0x5842('0x81'))['from'](_0x5842('0x6c'))['where'](_0x5842('0x7d'),_0x1d5d0d[_0x5842('0x5a')]['id']['toString']())))[_0x5842('0x75')]();break;default:_0x4472ef=squel[_0x5842('0x6b')]()['into'](_0x5842('0x6c'))[_0x5842('0x6d')]([_0x5842('0x6e'),_0x5842('0x6f'),_0x5842('0x70'),_0x5842('0x71'),'CampaignId',_0x5842('0x58'),_0x5842('0x56')],squel[_0x5842('0x72')]()[_0x5842('0x73')](_0x5842('0x6e'),_0x5842('0x6e'))['field'](_0x5842('0x74'),_0x5842('0x6f'))[_0x5842('0x73')]('id',_0x5842('0x70'))[_0x5842('0x73')](_0x3bf757[_0x5842('0x82')][_0x5842('0x75')](),_0x5842('0x71'))[_0x5842('0x73')](_0x1d5d0d[_0x5842('0x5a')]['id'][_0x5842('0x75')](),_0x5842('0x5d'))[_0x5842('0x73')]('\x27'+_0x247fc0+'\x27','createdAt')[_0x5842('0x73')]('\x27'+_0x247fc0+'\x27',_0x5842('0x56'))[_0x5842('0x76')](_0x5842('0x77'))[_0x5842('0x41')](_0x5842('0x78'))['where'](_0x5842('0x80'),_0x3bf757[_0x5842('0x82')]['toString']())[_0x5842('0x41')](_0x5842('0x79')))[_0x5842('0x75')]();}_0x42d1bf=squel[_0x5842('0x6b')]()[_0x5842('0x7f')](_0x5842('0x83'))[_0x5842('0x6d')]([_0x5842('0x84'),'scheduledAt','phone',_0x5842('0x85'),_0x5842('0x58'),'updatedAt'],squel[_0x5842('0x72')]()['field'](_0x5842('0x86'),'id')[_0x5842('0x73')](_0x5842('0x74'),'scheduledAt')[_0x5842('0x73')](_0x5842('0x87'),_0x5842('0x6e'))[_0x5842('0x73')](_0x5842('0x88'),'OrderBy')[_0x5842('0x73')]('\x27'+_0x247fc0+'\x27','createdAt')[_0x5842('0x73')]('\x27'+_0x247fc0+'\x27','updatedAt')['from'](_0x5842('0x89'),'ci')[_0x5842('0x8a')]('cm_hopper','h',_0x5842('0x8b'))[_0x5842('0x41')]('h.ListId\x20=\x20?',_0x3bf757[_0x5842('0x82')][_0x5842('0x75')]())[_0x5842('0x41')](_0x5842('0x8c'),_0x1d5d0d[_0x5842('0x5a')]['id'][_0x5842('0x75')]())[_0x5842('0x41')](_0x5842('0x8d'),_0x247fc0))[_0x5842('0x75')]();_0x1167db[_0x5842('0x8e')](db[_0x5842('0x8f')]['query'](_0x4472ef));_0xfd544b[_0x5842('0x8e')](db[_0x5842('0x8f')][_0x5842('0x36')](_0x42d1bf));}return BPromise[_0x5842('0x90')](_0x1167db);}})['then'](function(){return BPromise[_0x5842('0x90')](_0xfd544b);})[_0x5842('0x27')](function(){return _0x350b73;})[_0x5842('0x27')](respondWithResult(_0x13eb76,null))[_0x5842('0x49')](handleError(_0x13eb76,null));};exports['removeLists']=function(_0xcb30e3,_0x3bf44e,_0x1b6b87){return db[_0x5842('0x30')]['find']({'where':{'id':_0xcb30e3['params']['id']}})[_0x5842('0x27')](handleEntityNotFound(_0x3bf44e,null))['then'](function(_0x132843){if(_0x132843){return _0x132843['removeLists'](_0xcb30e3[_0x5842('0x36')][_0x5842('0x68')]);}})[_0x5842('0x27')](function(_0x333aaf){if(_0x333aaf){return db['CmHopper'][_0x5842('0x26')]({'where':{'ListId':_0xcb30e3[_0x5842('0x36')][_0x5842('0x68')],'CampaignId':_0xcb30e3[_0x5842('0x5a')]['id']}})[_0x5842('0x27')](function(){return _0x333aaf;});}})['then'](respondWithStatusCode(_0x3bf44e,null))[_0x5842('0x49')](handleError(_0x3bf44e,null));};exports[_0x5842('0x91')]=function(_0x43fcd9,_0x15a4b1,_0x4daeca){var _0x3a92a9={};var _0x461b97={};var _0x375470;var _0xea02b;return db['Campaign'][_0x5842('0x5b')]({'where':{'id':_0x43fcd9[_0x5842('0x5a')]['id']}})[_0x5842('0x27')](handleEntityNotFound(_0x15a4b1,null))[_0x5842('0x27')](function(_0x27420f){if(_0x27420f){_0x375470=_0x27420f;_0x461b97[_0x5842('0x35')]=_['keys'](db[_0x5842('0x63')][_0x5842('0x31')]);_0x461b97[_0x5842('0x36')]=_[_0x5842('0x37')](_0x43fcd9[_0x5842('0x36')]);_0x461b97['filters']=_[_0x5842('0x39')](_0x461b97[_0x5842('0x35')],_0x461b97[_0x5842('0x36')]);_0x3a92a9[_0x5842('0x3b')]=_['intersection'](_0x461b97[_0x5842('0x35')],qs[_0x5842('0x3a')](_0x43fcd9[_0x5842('0x36')][_0x5842('0x3a')]));_0x3a92a9[_0x5842('0x3b')]=_0x3a92a9[_0x5842('0x3b')][_0x5842('0x4b')]?_0x3a92a9[_0x5842('0x3b')]:_0x461b97['model'];_0x3a92a9[_0x5842('0x3f')]=qs[_0x5842('0x40')](_0x43fcd9['query'][_0x5842('0x40')]);_0x3a92a9[_0x5842('0x41')]=qs[_0x5842('0x38')](_[_0x5842('0x5e')](_0x43fcd9[_0x5842('0x36')],_0x461b97[_0x5842('0x38')]));if(_0x43fcd9[_0x5842('0x36')][_0x5842('0x42')]){_0x3a92a9[_0x5842('0x41')]=_[_0x5842('0x43')](_0x3a92a9[_0x5842('0x41')],{'$or':_[_0x5842('0x2f')](_0x3a92a9[_0x5842('0x3b')],function(_0x2ee5c9){var _0x41f0ca={};_0x41f0ca[_0x2ee5c9]={'$like':'%'+_0x43fcd9['query']['filter']+'%'};return _0x41f0ca;})});}_0x3a92a9=_[_0x5842('0x43')]({},_0x3a92a9,_0x43fcd9[_0x5842('0x4c')]);return _0x375470[_0x5842('0x91')](_0x3a92a9);}})['then'](function(_0x2b8647){if(_0x2b8647){_0xea02b=_0x2b8647['length'];if(!_0x43fcd9[_0x5842('0x36')][_0x5842('0x3c')](_0x5842('0x3d'))){_0x3a92a9['limit']=qs['limit'](_0x43fcd9[_0x5842('0x36')][_0x5842('0x3e')]);_0x3a92a9[_0x5842('0x20')]=qs[_0x5842('0x20')](_0x43fcd9[_0x5842('0x36')][_0x5842('0x20')]);}return _0x375470[_0x5842('0x91')](_0x3a92a9);}})['then'](function(_0x1da00e){if(_0x1da00e){return _0x1da00e?{'count':_0xea02b,'rows':_0x1da00e}:null;}})[_0x5842('0x27')](respondWithResult(_0x15a4b1,null))[_0x5842('0x49')](handleError(_0x15a4b1,null));};exports[_0x5842('0x92')]=function(_0x55cf69,_0x359516,_0xbd9582){var _0x46ee09,_0x32004a;var _0x1ee6a9=[];var _0x41caae=moment()[_0x5842('0x66')](_0x5842('0x67'));return db[_0x5842('0x30')]['find']({'where':{'id':_0x55cf69[_0x5842('0x5a')]['id']}})[_0x5842('0x27')](handleEntityNotFound(_0x359516,null))[_0x5842('0x27')](function(_0x340561){if(_0x340561){_0x32004a=_0x340561;return _0x340561['addBlackLists'](_0x55cf69[_0x5842('0x57')]['ids'],_[_0x5842('0x69')](_0x55cf69[_0x5842('0x57')],[_0x5842('0x68'),'id'])||{});}return null;})[_0x5842('0x93')](function(_0x405e35){var _0x2a6562;var _0xe7ac8f;_0x46ee09=_0x405e35||[];var _0x15608f=[];if(_0x405e35){for(var _0x3126df=0x0;_0x3126df<_0x405e35[_0x5842('0x4b')];_0x3126df+=0x1){var _0x4a72ab=_0x405e35[_0x3126df]['get']({'plain':!![]});_0x2a6562=squel['insert']()[_0x5842('0x7f')](_0x5842('0x94'))[_0x5842('0x6d')]([_0x5842('0x6e'),_0x5842('0x70'),_0x5842('0x71'),_0x5842('0x5d'),'createdAt',_0x5842('0x56')],squel['select']()[_0x5842('0x73')](_0x5842('0x6e'),'phone')[_0x5842('0x73')]('id','ContactId')[_0x5842('0x73')](_0x4a72ab[_0x5842('0x82')][_0x5842('0x75')](),_0x5842('0x71'))['field'](_0x55cf69[_0x5842('0x5a')]['id'][_0x5842('0x75')](),_0x5842('0x5d'))[_0x5842('0x73')](_0x5842('0x74'),'createdAt')[_0x5842('0x73')](_0x5842('0x74'),_0x5842('0x56'))[_0x5842('0x76')](_0x5842('0x77'))[_0x5842('0x41')](_0x5842('0x78'))[_0x5842('0x41')]('ListId\x20=\x20?',_0x4a72ab[_0x5842('0x82')][_0x5842('0x75')]())[_0x5842('0x41')](_0x5842('0x79')))[_0x5842('0x75')]();_0x15608f[_0x5842('0x8e')](db[_0x5842('0x8f')]['query'](_0x2a6562));}return BPromise['all'](_0x15608f);}})[_0x5842('0x27')](function(){return _0x46ee09;})[_0x5842('0x27')](respondWithResult(_0x359516,null))[_0x5842('0x49')](handleError(_0x359516,null));};exports[_0x5842('0x95')]=function(_0x4b0ffe,_0x3a9465,_0x1c5328){return db[_0x5842('0x30')][_0x5842('0x4d')]({'where':{'id':_0x4b0ffe['params']['id']}})['then'](handleEntityNotFound(_0x3a9465,null))[_0x5842('0x27')](function(_0x115157){if(_0x115157){return _0x115157[_0x5842('0x95')](_0x4b0ffe[_0x5842('0x36')]['ids']);}})[_0x5842('0x27')](function(_0x164934){if(_0x164934){return db[_0x5842('0x62')][_0x5842('0x26')]({'where':{'ListId':_0x4b0ffe[_0x5842('0x36')][_0x5842('0x68')],'CampaignId':_0x4b0ffe[_0x5842('0x5a')]['id']}})[_0x5842('0x27')](function(){return _0x164934;});}})[_0x5842('0x27')](respondWithStatusCode(_0x3a9465,null))[_0x5842('0x49')](handleError(_0x3a9465,null));}; \ No newline at end of file +var _0x486e=['cm_contacts','toString','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','ListId\x20=\x20?','cm_hopper_additional_phones','OrderBy','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','then','destroy','IvrCampaigns','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','merge','options','Campaign','includeAll','findAll','rows','catch','show','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','params','getHoppers','findOne','hasOwnProperty','CampaignId','filter','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','from'];(function(_0x10b629,_0x150565){var _0x2ef4f2=function(_0x2b00a8){while(--_0x2b00a8){_0x10b629['push'](_0x10b629['shift']());}};_0x2ef4f2(++_0x150565);}(_0x486e,0xb2));var _0xe486=function(_0x9db798,_0x3f5685){_0x9db798=_0x9db798-0x0;var _0x417009=_0x486e[_0x9db798];return _0x417009;};'use strict';var emlformat=require(_0xe486('0x0'));var rimraf=require(_0xe486('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe486('0x2'));var rp=require(_0xe486('0x3'));var moment=require(_0xe486('0x4'));var BPromise=require(_0xe486('0x5'));var Mustache=require(_0xe486('0x6'));var util=require(_0xe486('0x7'));var path=require(_0xe486('0x8'));var sox=require(_0xe486('0x9'));var csv=require(_0xe486('0xa'));var ejs=require(_0xe486('0xb'));var fs=require('fs');var fs_extra=require(_0xe486('0xc'));var _=require('lodash');var squel=require(_0xe486('0xd'));var crypto=require(_0xe486('0xe'));var jsforce=require(_0xe486('0xf'));var deskjs=require(_0xe486('0x10'));var toCsv=require(_0xe486('0xa'));var querystring=require(_0xe486('0x11'));var Papa=require(_0xe486('0x12'));var Redis=require(_0xe486('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe486('0x14'));var hardwareService=require(_0xe486('0x15'));var logger=require(_0xe486('0x16'))(_0xe486('0x17'));var utils=require(_0xe486('0x18'));var config=require(_0xe486('0x19'));var licenseUtil=require(_0xe486('0x1a'));var db=require(_0xe486('0x1b'))['db'];function respondWithStatusCode(_0x372057,_0x530344){_0x530344=_0x530344||0xcc;return function(_0x5a1aad){if(_0x5a1aad){return _0x372057[_0xe486('0x1c')](_0x530344);}return _0x372057[_0xe486('0x1d')](_0x530344)[_0xe486('0x1e')]();};}function respondWithResult(_0x564a6f,_0x5ddb65){_0x5ddb65=_0x5ddb65||0xc8;return function(_0x339746){if(_0x339746){return _0x564a6f['status'](_0x5ddb65)[_0xe486('0x1f')](_0x339746);}};}function respondWithFilteredResult(_0x3da621,_0x4a0259){return function(_0x355002){if(_0x355002){var _0x5016f0=typeof _0x4a0259['offset']===_0xe486('0x20')&&typeof _0x4a0259[_0xe486('0x21')]==='undefined';var _0x3d983b=_0x355002['count'];var _0x25e946=_0x5016f0?0x0:_0x4a0259[_0xe486('0x22')];var _0x5d209a=_0x5016f0?_0x355002[_0xe486('0x23')]:_0x4a0259[_0xe486('0x22')]+_0x4a0259['limit'];var _0xf0697f;if(_0x5d209a>=_0x3d983b){_0x5d209a=_0x3d983b;_0xf0697f=0xc8;}else{_0xf0697f=0xce;}_0x3da621[_0xe486('0x1d')](_0xf0697f);return _0x3da621[_0xe486('0x24')]('Content-Range',_0x25e946+'-'+_0x5d209a+'/'+_0x3d983b)[_0xe486('0x1f')](_0x355002);}return null;};}function patchUpdates(_0x301344){return function(_0x2c34e3){try{jsonpatch[_0xe486('0x25')](_0x2c34e3,_0x301344,!![]);}catch(_0x4650bf){return BPromise[_0xe486('0x26')](_0x4650bf);}return _0x2c34e3[_0xe486('0x27')]();};}function saveUpdates(_0xdc43f0,_0x5b61cc){return function(_0x22efff){if(_0x22efff){return _0x22efff['update'](_0xdc43f0)[_0xe486('0x28')](function(_0x50ae4c){return _0x50ae4c;});}return null;};}function removeEntity(_0x3020e7,_0x47a811){return function(_0x39113f){if(_0x39113f){return _0x39113f[_0xe486('0x29')]()[_0xe486('0x28')](function(){var _0x9f77fc=_0x39113f['get']({'plain':!![]});var _0x2e7182=_0xe486('0x2a');return db[_0xe486('0x2b')][_0xe486('0x29')]({'where':{'type':_0x2e7182,'resourceId':_0x9f77fc['id']}})[_0xe486('0x28')](function(){return _0x39113f;});})[_0xe486('0x28')](function(){_0x3020e7['status'](0xcc)[_0xe486('0x1e')]();});}};}function handleEntityNotFound(_0x2b08d0,_0x502b4c){return function(_0x87ece6){if(!_0x87ece6){_0x2b08d0['sendStatus'](0x194);}return _0x87ece6;};}function handleError(_0x48ab9f,_0x4ecdac){_0x4ecdac=_0x4ecdac||0x1f4;return function(_0x361b51){logger[_0xe486('0x2c')](_0x361b51[_0xe486('0x2d')]);if(_0x361b51['name']){delete _0x361b51[_0xe486('0x2e')];}_0x48ab9f['status'](_0x4ecdac)['send'](_0x361b51);};}exports[_0xe486('0x2f')]=function(_0x1c6d22,_0x22a1c9){var _0x2fc3a7={},_0x39f3f9={},_0x70e1bb={'count':0x0,'rows':[]};var _0x39b179=_['map'](db['Campaign'][_0xe486('0x30')],function(_0x5f3b54){return{'name':_0x5f3b54[_0xe486('0x31')],'type':_0x5f3b54[_0xe486('0x32')][_0xe486('0x33')]};});_0x39f3f9[_0xe486('0x34')]=_[_0xe486('0x35')](_0x39b179,'name');_0x39f3f9[_0xe486('0x36')]=_[_0xe486('0x37')](_0x1c6d22[_0xe486('0x36')]);_0x39f3f9[_0xe486('0x38')]=_['intersection'](_0x39f3f9[_0xe486('0x34')],_0x39f3f9[_0xe486('0x36')]);_0x2fc3a7[_0xe486('0x39')]=_['intersection'](_0x39f3f9[_0xe486('0x34')],qs[_0xe486('0x3a')](_0x1c6d22[_0xe486('0x36')][_0xe486('0x3a')]));_0x2fc3a7['attributes']=_0x2fc3a7[_0xe486('0x39')][_0xe486('0x3b')]?_0x2fc3a7[_0xe486('0x39')]:_0x39f3f9[_0xe486('0x34')];if(!_0x1c6d22['query']['hasOwnProperty'](_0xe486('0x3c'))){_0x2fc3a7[_0xe486('0x21')]=qs[_0xe486('0x21')](_0x1c6d22[_0xe486('0x36')]['limit']);_0x2fc3a7[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x1c6d22[_0xe486('0x36')]['offset']);}_0x2fc3a7[_0xe486('0x3d')]=qs[_0xe486('0x3e')](_0x1c6d22[_0xe486('0x36')][_0xe486('0x3e')]);_0x2fc3a7['where']=qs['filters'](_[_0xe486('0x3f')](_0x1c6d22[_0xe486('0x36')],_0x39f3f9[_0xe486('0x38')]),_0x39b179);if(_0x1c6d22[_0xe486('0x36')]['filter']){_0x2fc3a7[_0xe486('0x40')]=_['merge'](_0x2fc3a7[_0xe486('0x40')],{'$or':_[_0xe486('0x35')](_0x39b179,function(_0xecdc73){if(_0xecdc73[_0xe486('0x32')]!==_0xe486('0x41')){var _0x178fcc={};_0x178fcc[_0xecdc73['name']]={'$like':'%'+_0x1c6d22[_0xe486('0x36')]['filter']+'%'};return _0x178fcc;}})});}_0x2fc3a7=_[_0xe486('0x42')]({},_0x2fc3a7,_0x1c6d22[_0xe486('0x43')]);var _0x1ba5e3={'where':_0x2fc3a7['where']};return db[_0xe486('0x44')]['count'](_0x1ba5e3)[_0xe486('0x28')](function(_0x22c5d2){_0x70e1bb[_0xe486('0x23')]=_0x22c5d2;if(_0x1c6d22['query'][_0xe486('0x45')]){_0x2fc3a7['include']=[{'all':!![]}];}return db[_0xe486('0x44')][_0xe486('0x46')](_0x2fc3a7);})['then'](function(_0x312a3a){_0x70e1bb[_0xe486('0x47')]=_0x312a3a;return _0x70e1bb;})[_0xe486('0x28')](respondWithFilteredResult(_0x22a1c9,_0x2fc3a7))[_0xe486('0x48')](handleError(_0x22a1c9,null));};exports[_0xe486('0x49')]=function(_0x9d6953,_0x5c4c9c){var _0x20b6b5={'raw':![],'where':{'id':_0x9d6953['params']['id']}},_0x45c705={};_0x45c705[_0xe486('0x34')]=_['keys'](db[_0xe486('0x44')][_0xe486('0x30')]);_0x45c705['query']=_[_0xe486('0x37')](_0x9d6953[_0xe486('0x36')]);_0x45c705[_0xe486('0x38')]=_['intersection'](_0x45c705[_0xe486('0x34')],_0x45c705[_0xe486('0x36')]);_0x20b6b5[_0xe486('0x39')]=_[_0xe486('0x4a')](_0x45c705['model'],qs[_0xe486('0x3a')](_0x9d6953[_0xe486('0x36')][_0xe486('0x3a')]));_0x20b6b5[_0xe486('0x39')]=_0x20b6b5[_0xe486('0x39')][_0xe486('0x3b')]?_0x20b6b5[_0xe486('0x39')]:_0x45c705['model'];if(_0x9d6953[_0xe486('0x36')][_0xe486('0x45')]){_0x20b6b5['include']=[{'all':!![]}];}_0x20b6b5=_[_0xe486('0x42')]({},_0x20b6b5,_0x9d6953[_0xe486('0x43')]);return db['Campaign'][_0xe486('0x4b')](_0x20b6b5)[_0xe486('0x28')](handleEntityNotFound(_0x5c4c9c,null))[_0xe486('0x28')](respondWithResult(_0x5c4c9c,null))[_0xe486('0x48')](handleError(_0x5c4c9c,null));};exports[_0xe486('0x4c')]=function(_0x10b115,_0x43f2da){return db['Campaign'][_0xe486('0x4c')](_0x10b115[_0xe486('0x4d')],{})['then'](function(_0x3bc7dd){var _0x26e8c5=_0x10b115[_0xe486('0x4e')][_0xe486('0x4f')]({'plain':!![]});if(!_0x26e8c5)throw new Error(_0xe486('0x50'));if(_0x26e8c5[_0xe486('0x51')]==='user'){var _0x1c8ad5=_0x3bc7dd[_0xe486('0x4f')]({'plain':!![]});var _0x4e781c=_0xe486('0x2a');return db[_0xe486('0x52')][_0xe486('0x4b')]({'where':{'name':_0x4e781c,'userProfileId':_0x26e8c5[_0xe486('0x53')]},'raw':!![]})[_0xe486('0x28')](function(_0x319585){if(_0x319585&&_0x319585[_0xe486('0x54')]===0x0){return db[_0xe486('0x2b')][_0xe486('0x4c')]({'name':_0x1c8ad5[_0xe486('0x2e')],'resourceId':_0x1c8ad5['id'],'type':_0x319585['name'],'sectionId':_0x319585['id']},{})[_0xe486('0x28')](function(){return _0x3bc7dd;});}else{return _0x3bc7dd;}})[_0xe486('0x48')](function(_0x3c9cf2){logger[_0xe486('0x2c')](_0xe486('0x55'),_0x3c9cf2);throw _0x3c9cf2;});}return _0x3bc7dd;})[_0xe486('0x28')](respondWithResult(_0x43f2da,0xc9))['catch'](handleError(_0x43f2da,null));};exports[_0xe486('0x56')]=function(_0x1592d5,_0x4df7c6){var _0x31e57a={'where':{'id':_0x1592d5['params']['id']}},_0x4de708={};_0x4de708[_0xe486('0x34')]=_[_0xe486('0x37')](db[_0xe486('0x44')]['rawAttributes']);_0x31e57a[_0xe486('0x39')]=_['intersection'](_0x4de708[_0xe486('0x34')],qs['fields'](_0x1592d5[_0xe486('0x36')]['fields']));_0x31e57a['attributes']=_0x31e57a['attributes'][_0xe486('0x3b')]?_0x31e57a[_0xe486('0x39')]:_0x4de708[_0xe486('0x34')];if(_0x1592d5[_0xe486('0x36')][_0xe486('0x45')]){_0x31e57a[_0xe486('0x57')]=[{'all':!![]}];}_0x31e57a=_['merge']({},_0x31e57a,_0x1592d5['options']);return db[_0xe486('0x44')]['find'](_0x31e57a)[_0xe486('0x28')](handleEntityNotFound(_0x4df7c6,null))[_0xe486('0x28')](function(_0x1b96f1){if(_0x1b96f1){var _0x50732c=_0x1b96f1['get']({'plain':!![]});_0x50732c=qs[_0xe486('0x58')](_0x50732c,['id',_0xe486('0x59'),_0xe486('0x5a')]);_0x1592d5[_0xe486('0x4d')]=_[_0xe486('0x58')](_0x1592d5[_0xe486('0x4d')],['id',_0xe486('0x59'),_0xe486('0x5a')]);return db[_0xe486('0x44')]['create'](_['merge'](_0x50732c,_0x1592d5[_0xe486('0x4d')]),{'include':_0x1592d5[_0xe486('0x36')][_0xe486('0x45')]?[{'all':!![]}]:undefined})[_0xe486('0x28')](function(_0x358bce){var _0x2ec277=_0x1592d5['user']['get']({'plain':!![]});if(!_0x2ec277)throw new Error(_0xe486('0x50'));if(_0x2ec277[_0xe486('0x51')]===_0xe486('0x4e')){var _0x148bad=_0x358bce[_0xe486('0x4f')]({'plain':!![]});var _0x33f2f6='IvrCampaigns';return db[_0xe486('0x52')][_0xe486('0x4b')]({'where':{'name':_0x33f2f6,'userProfileId':_0x2ec277[_0xe486('0x53')]},'raw':!![]})[_0xe486('0x28')](function(_0x512d18){if(_0x512d18&&_0x512d18[_0xe486('0x54')]===0x0){return db[_0xe486('0x2b')]['create']({'name':_0x148bad[_0xe486('0x2e')],'resourceId':_0x148bad['id'],'type':_0x512d18[_0xe486('0x2e')],'sectionId':_0x512d18['id']},{})[_0xe486('0x28')](function(){return _0x358bce;});}else{return _0x358bce;}})[_0xe486('0x48')](function(_0x4feeb5){logger[_0xe486('0x2c')](_0xe486('0x55'),_0x4feeb5);throw _0x4feeb5;});}return _0x358bce;});}})[_0xe486('0x28')](respondWithResult(_0x4df7c6,0xc9))[_0xe486('0x48')](handleError(_0x4df7c6,null));};exports['update']=function(_0x39a093,_0x290dc1){if(_0x39a093[_0xe486('0x4d')]['id']){delete _0x39a093[_0xe486('0x4d')]['id'];}return db[_0xe486('0x44')][_0xe486('0x4b')]({'where':{'id':_0x39a093[_0xe486('0x5b')]['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x290dc1,null))['then'](saveUpdates(_0x39a093[_0xe486('0x4d')],null))[_0xe486('0x28')](respondWithResult(_0x290dc1,null))[_0xe486('0x48')](handleError(_0x290dc1,null));};exports[_0xe486('0x29')]=function(_0x8f0b78,_0x276742){return db['Campaign']['find']({'where':{'id':_0x8f0b78[_0xe486('0x5b')]['id']}})['then'](handleEntityNotFound(_0x276742,null))[_0xe486('0x28')](removeEntity(_0x276742,null))[_0xe486('0x48')](handleError(_0x276742,null));};exports[_0xe486('0x5c')]=function(_0x1dfdc0,_0x2bec02,_0x22b50d){var _0x696632={'raw':!![],'where':{}};var _0x183700={};var _0x12863d={'count':0x0,'rows':[]};return db[_0xe486('0x44')][_0xe486('0x5d')]({'where':{'id':_0x1dfdc0[_0xe486('0x5b')]['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x2bec02,null))[_0xe486('0x28')](function(_0x333a1f){if(_0x333a1f){_0x183700['model']=_['keys'](db['CmHopper'][_0xe486('0x30')]);_0x183700[_0xe486('0x36')]=_['keys'](_0x1dfdc0[_0xe486('0x36')]);_0x183700[_0xe486('0x38')]=_['intersection'](_0x183700['model'],_0x183700[_0xe486('0x36')]);_0x696632[_0xe486('0x39')]=_['intersection'](_0x183700['model'],qs[_0xe486('0x3a')](_0x1dfdc0[_0xe486('0x36')][_0xe486('0x3a')]));_0x696632[_0xe486('0x39')]=_0x696632['attributes'][_0xe486('0x3b')]?_0x696632[_0xe486('0x39')]:_0x183700[_0xe486('0x34')];if(!_0x1dfdc0[_0xe486('0x36')][_0xe486('0x5e')]('nolimit')){_0x696632[_0xe486('0x21')]=qs[_0xe486('0x21')](_0x1dfdc0[_0xe486('0x36')]['limit']);_0x696632[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x1dfdc0['query'][_0xe486('0x22')]);}_0x696632[_0xe486('0x3d')]=qs['sort'](_0x1dfdc0['query'][_0xe486('0x3e')]);_0x696632[_0xe486('0x40')]=qs[_0xe486('0x38')](_[_0xe486('0x3f')](_0x1dfdc0[_0xe486('0x36')],_0x183700[_0xe486('0x38')]));_0x696632[_0xe486('0x40')][_0xe486('0x5f')]=_0x333a1f['id'];if(_0x1dfdc0['query'][_0xe486('0x60')]){_0x696632['where']=_[_0xe486('0x42')](_0x696632['where'],{'$or':_[_0xe486('0x35')](_0x696632[_0xe486('0x39')],function(_0x193204){var _0x403cb1={};_0x403cb1[_0x193204]={'$like':'%'+_0x1dfdc0[_0xe486('0x36')]['filter']+'%'};return _0x403cb1;})});}_0x696632=_[_0xe486('0x42')]({},_0x696632,_0x1dfdc0[_0xe486('0x43')]);return db[_0xe486('0x61')][_0xe486('0x23')]({'where':_0x696632['where']})[_0xe486('0x28')](function(_0x43a082){_0x12863d['count']=_0x43a082;if(_0x1dfdc0['query']['includeAll']){_0x696632[_0xe486('0x57')]=[{'all':!![]}];}return db['CmHopper'][_0xe486('0x46')](_0x696632);})[_0xe486('0x28')](function(_0x17f9c9){_0x12863d['rows']=_0x17f9c9;return _0x12863d;});}})[_0xe486('0x28')](respondWithFilteredResult(_0x2bec02,_0x696632))[_0xe486('0x48')](handleError(_0x2bec02,null));};exports[_0xe486('0x62')]=function(_0x1c092d,_0x4ea43e,_0x341960){var _0x2f28f5={'raw':!![],'where':{}};var _0x351154={};var _0x394eca={'count':0x0,'rows':[]};return db[_0xe486('0x44')][_0xe486('0x5d')]({'where':{'id':_0x1c092d[_0xe486('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4ea43e,null))[_0xe486('0x28')](function(_0x3603d2){if(_0x3603d2){_0x351154[_0xe486('0x34')]=_[_0xe486('0x37')](db[_0xe486('0x63')]['rawAttributes']);_0x351154['query']=_[_0xe486('0x37')](_0x1c092d[_0xe486('0x36')]);_0x351154[_0xe486('0x38')]=_[_0xe486('0x4a')](_0x351154[_0xe486('0x34')],_0x351154[_0xe486('0x36')]);_0x2f28f5[_0xe486('0x39')]=_['intersection'](_0x351154[_0xe486('0x34')],qs[_0xe486('0x3a')](_0x1c092d[_0xe486('0x36')]['fields']));_0x2f28f5[_0xe486('0x39')]=_0x2f28f5[_0xe486('0x39')][_0xe486('0x3b')]?_0x2f28f5[_0xe486('0x39')]:_0x351154[_0xe486('0x34')];if(!_0x1c092d[_0xe486('0x36')][_0xe486('0x5e')](_0xe486('0x3c'))){_0x2f28f5[_0xe486('0x21')]=qs[_0xe486('0x21')](_0x1c092d[_0xe486('0x36')][_0xe486('0x21')]);_0x2f28f5[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x1c092d[_0xe486('0x36')]['offset']);}_0x2f28f5[_0xe486('0x3d')]=qs[_0xe486('0x3e')](_0x1c092d[_0xe486('0x36')][_0xe486('0x3e')]);_0x2f28f5[_0xe486('0x40')]=qs[_0xe486('0x38')](_[_0xe486('0x3f')](_0x1c092d[_0xe486('0x36')],_0x351154[_0xe486('0x38')]));_0x2f28f5[_0xe486('0x40')][_0xe486('0x5f')]=_0x3603d2['id'];if(_0x1c092d[_0xe486('0x36')][_0xe486('0x60')]){_0x2f28f5[_0xe486('0x40')]=_[_0xe486('0x42')](_0x2f28f5[_0xe486('0x40')],{'$or':_[_0xe486('0x35')](_0x2f28f5['attributes'],function(_0x4d0144){var _0x540206={};_0x540206[_0x4d0144]={'$like':'%'+_0x1c092d[_0xe486('0x36')][_0xe486('0x60')]+'%'};return _0x540206;})});}_0x2f28f5=_['merge']({},_0x2f28f5,_0x1c092d[_0xe486('0x43')]);return db[_0xe486('0x63')]['count']({'where':_0x2f28f5[_0xe486('0x40')]})[_0xe486('0x28')](function(_0x2b16ed){_0x394eca[_0xe486('0x23')]=_0x2b16ed;if(_0x1c092d[_0xe486('0x36')][_0xe486('0x45')]){_0x2f28f5[_0xe486('0x57')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xe486('0x46')](_0x2f28f5);})[_0xe486('0x28')](function(_0x10678b){_0x394eca['rows']=_0x10678b;return _0x394eca;});}})[_0xe486('0x28')](respondWithFilteredResult(_0x4ea43e,_0x2f28f5))[_0xe486('0x48')](handleError(_0x4ea43e,null));};exports[_0xe486('0x64')]=function(_0x3e2a12,_0x5b6052,_0x14bd14){var _0x63f070={'raw':!![],'where':{}};var _0xd82fd4={};var _0x13b8ec={'count':0x0,'rows':[]};return db[_0xe486('0x44')][_0xe486('0x5d')]({'where':{'id':_0x3e2a12[_0xe486('0x5b')]['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x5b6052,null))[_0xe486('0x28')](function(_0x3e15e1){if(_0x3e15e1){_0xd82fd4[_0xe486('0x34')]=_[_0xe486('0x37')](db['CmHopperFinal'][_0xe486('0x30')]);_0xd82fd4[_0xe486('0x36')]=_[_0xe486('0x37')](_0x3e2a12['query']);_0xd82fd4[_0xe486('0x38')]=_[_0xe486('0x4a')](_0xd82fd4['model'],_0xd82fd4[_0xe486('0x36')]);_0x63f070[_0xe486('0x39')]=_[_0xe486('0x4a')](_0xd82fd4[_0xe486('0x34')],qs[_0xe486('0x3a')](_0x3e2a12[_0xe486('0x36')]['fields']));_0x63f070[_0xe486('0x39')]=_0x63f070['attributes'][_0xe486('0x3b')]?_0x63f070[_0xe486('0x39')]:_0xd82fd4[_0xe486('0x34')];if(!_0x3e2a12['query'][_0xe486('0x5e')](_0xe486('0x3c'))){_0x63f070[_0xe486('0x21')]=qs[_0xe486('0x21')](_0x3e2a12[_0xe486('0x36')][_0xe486('0x21')]);_0x63f070[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x3e2a12[_0xe486('0x36')][_0xe486('0x22')]);}_0x63f070[_0xe486('0x3d')]=qs[_0xe486('0x3e')](_0x3e2a12[_0xe486('0x36')][_0xe486('0x3e')]);_0x63f070[_0xe486('0x40')]=qs[_0xe486('0x38')](_[_0xe486('0x3f')](_0x3e2a12[_0xe486('0x36')],_0xd82fd4['filters']));_0x63f070[_0xe486('0x40')][_0xe486('0x5f')]=_0x3e15e1['id'];if(_0x3e2a12['query'][_0xe486('0x60')]){_0x63f070[_0xe486('0x40')]=_[_0xe486('0x42')](_0x63f070['where'],{'$or':_[_0xe486('0x35')](_0x63f070['attributes'],function(_0x37c8c8){var _0x4537e3={};_0x4537e3[_0x37c8c8]={'$like':'%'+_0x3e2a12['query'][_0xe486('0x60')]+'%'};return _0x4537e3;})});}_0x63f070=_[_0xe486('0x42')]({},_0x63f070,_0x3e2a12['options']);return db[_0xe486('0x65')][_0xe486('0x23')]({'where':_0x63f070['where']})[_0xe486('0x28')](function(_0x20e28c){_0x13b8ec['count']=_0x20e28c;if(_0x3e2a12[_0xe486('0x36')][_0xe486('0x45')]){_0x63f070[_0xe486('0x57')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xe486('0x46')](_0x63f070);})[_0xe486('0x28')](function(_0x216ea8){_0x13b8ec['rows']=_0x216ea8;return _0x13b8ec;});}})[_0xe486('0x28')](respondWithFilteredResult(_0x5b6052,_0x63f070))[_0xe486('0x48')](handleError(_0x5b6052,null));};exports[_0xe486('0x66')]=function(_0x31f489,_0x1ef654,_0x2c583f){var _0x4ebc75={'raw':!![],'where':{}};var _0x1b0f9d={};var _0x57fe91={'count':0x0,'rows':[]};return db[_0xe486('0x44')]['findOne']({'where':{'id':_0x31f489['params']['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x1ef654,null))['then'](function(_0x44b4af){if(_0x44b4af){_0x1b0f9d[_0xe486('0x34')]=_[_0xe486('0x37')](db[_0xe486('0x67')][_0xe486('0x30')]);_0x1b0f9d[_0xe486('0x36')]=_[_0xe486('0x37')](_0x31f489[_0xe486('0x36')]);_0x1b0f9d[_0xe486('0x38')]=_['intersection'](_0x1b0f9d[_0xe486('0x34')],_0x1b0f9d['query']);_0x4ebc75[_0xe486('0x39')]=_[_0xe486('0x4a')](_0x1b0f9d[_0xe486('0x34')],qs[_0xe486('0x3a')](_0x31f489[_0xe486('0x36')][_0xe486('0x3a')]));_0x4ebc75[_0xe486('0x39')]=_0x4ebc75['attributes'][_0xe486('0x3b')]?_0x4ebc75[_0xe486('0x39')]:_0x1b0f9d[_0xe486('0x34')];if(!_0x31f489[_0xe486('0x36')]['hasOwnProperty'](_0xe486('0x3c'))){_0x4ebc75[_0xe486('0x21')]=qs['limit'](_0x31f489[_0xe486('0x36')][_0xe486('0x21')]);_0x4ebc75[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x31f489['query']['offset']);}_0x4ebc75[_0xe486('0x3d')]=qs[_0xe486('0x3e')](_0x31f489[_0xe486('0x36')]['sort']);_0x4ebc75['where']=qs['filters'](_[_0xe486('0x3f')](_0x31f489['query'],_0x1b0f9d[_0xe486('0x38')]));_0x4ebc75[_0xe486('0x40')][_0xe486('0x5f')]=_0x44b4af['id'];if(_0x31f489[_0xe486('0x36')][_0xe486('0x60')]){_0x4ebc75[_0xe486('0x40')]=_[_0xe486('0x42')](_0x4ebc75[_0xe486('0x40')],{'$or':_[_0xe486('0x35')](_0x4ebc75['attributes'],function(_0x521de9){var _0x15ac77={};_0x15ac77[_0x521de9]={'$like':'%'+_0x31f489[_0xe486('0x36')][_0xe486('0x60')]+'%'};return _0x15ac77;})});}_0x4ebc75=_[_0xe486('0x42')]({},_0x4ebc75,_0x31f489[_0xe486('0x43')]);return db[_0xe486('0x67')][_0xe486('0x23')]({'where':_0x4ebc75[_0xe486('0x40')]})['then'](function(_0x379e25){_0x57fe91[_0xe486('0x23')]=_0x379e25;if(_0x31f489['query'][_0xe486('0x45')]){_0x4ebc75[_0xe486('0x57')]=[{'all':!![]}];}return db[_0xe486('0x67')][_0xe486('0x46')](_0x4ebc75);})['then'](function(_0x512151){_0x57fe91[_0xe486('0x47')]=_0x512151;return _0x57fe91;});}})[_0xe486('0x28')](respondWithFilteredResult(_0x1ef654,_0x4ebc75))[_0xe486('0x48')](handleError(_0x1ef654,null));};exports[_0xe486('0x68')]=function(_0x27dbdd,_0x3775c8,_0x5d1e03){var _0x5dbec8={};var _0x884f99={};var _0x1d0271;var _0x178857;return db[_0xe486('0x44')][_0xe486('0x5d')]({'where':{'id':_0x27dbdd['params']['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x3775c8,null))[_0xe486('0x28')](function(_0x4867f9){if(_0x4867f9){_0x1d0271=_0x4867f9;_0x884f99[_0xe486('0x34')]=_[_0xe486('0x37')](db[_0xe486('0x69')][_0xe486('0x30')]);_0x884f99[_0xe486('0x36')]=_[_0xe486('0x37')](_0x27dbdd[_0xe486('0x36')]);_0x884f99[_0xe486('0x38')]=_[_0xe486('0x4a')](_0x884f99[_0xe486('0x34')],_0x884f99[_0xe486('0x36')]);_0x5dbec8[_0xe486('0x39')]=_[_0xe486('0x4a')](_0x884f99[_0xe486('0x34')],qs[_0xe486('0x3a')](_0x27dbdd[_0xe486('0x36')][_0xe486('0x3a')]));_0x5dbec8['attributes']=_0x5dbec8[_0xe486('0x39')][_0xe486('0x3b')]?_0x5dbec8['attributes']:_0x884f99[_0xe486('0x34')];_0x5dbec8[_0xe486('0x3d')]=qs['sort'](_0x27dbdd[_0xe486('0x36')][_0xe486('0x3e')]);_0x5dbec8['where']=qs['filters'](_[_0xe486('0x3f')](_0x27dbdd[_0xe486('0x36')],_0x884f99[_0xe486('0x38')]));if(_0x27dbdd[_0xe486('0x36')][_0xe486('0x60')]){_0x5dbec8[_0xe486('0x40')]=_['merge'](_0x5dbec8[_0xe486('0x40')],{'$or':_[_0xe486('0x35')](_0x5dbec8[_0xe486('0x39')],function(_0x2d57a7){var _0x46fd1b={};_0x46fd1b[_0x2d57a7]={'$like':'%'+_0x27dbdd['query']['filter']+'%'};return _0x46fd1b;})});}_0x5dbec8=_[_0xe486('0x42')]({},_0x5dbec8,_0x27dbdd[_0xe486('0x43')]);return _0x1d0271['getLists'](_0x5dbec8);}})[_0xe486('0x28')](function(_0xaa4f8){if(_0xaa4f8){_0x178857=_0xaa4f8[_0xe486('0x3b')];if(!_0x27dbdd[_0xe486('0x36')]['hasOwnProperty'](_0xe486('0x3c'))){_0x5dbec8[_0xe486('0x21')]=qs[_0xe486('0x21')](_0x27dbdd[_0xe486('0x36')][_0xe486('0x21')]);_0x5dbec8[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x27dbdd[_0xe486('0x36')][_0xe486('0x22')]);}return _0x1d0271[_0xe486('0x68')](_0x5dbec8);}})[_0xe486('0x28')](function(_0x364af4){if(_0x364af4){return _0x364af4?{'count':_0x178857,'rows':_0x364af4}:null;}})[_0xe486('0x28')](respondWithResult(_0x3775c8,null))[_0xe486('0x48')](handleError(_0x3775c8,null));};exports['addLists']=function(_0x506598,_0x5a2dd0,_0x37fc31){var _0x2f25ed,_0x414e50;var _0x4e2250=[];var _0x491543=moment()[_0xe486('0x6a')](_0xe486('0x6b'));return db[_0xe486('0x44')][_0xe486('0x4b')]({'where':{'id':_0x506598[_0xe486('0x5b')]['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x5a2dd0,null))[_0xe486('0x28')](function(_0xf214d8){if(_0xf214d8){_0x414e50=_0xf214d8;return _0xf214d8['addLists'](_0x506598['body'][_0xe486('0x6c')],_[_0xe486('0x58')](_0x506598[_0xe486('0x4d')],[_0xe486('0x6c'),'id'])||{});}return null;})['spread'](function(_0x1289e5){var _0x439f75;var _0x7bf3ff;_0x2f25ed=_0x1289e5||[];var _0x369b45=[];if(_0x1289e5){for(var _0x14d9ed=0x0;_0x14d9ed<_0x1289e5[_0xe486('0x3b')];_0x14d9ed+=0x1){var _0x1f953d=_0x1289e5[_0x14d9ed][_0xe486('0x4f')]({'plain':!![]});_0x414e50['dialCheckDuplicateType']=_0x506598[_0xe486('0x4d')]['dialCheckDuplicateType']?_0x506598[_0xe486('0x4d')]['dialCheckDuplicateType']:_0x414e50[_0xe486('0x6d')];switch(_0x414e50['dialCheckDuplicateType']){case _0xe486('0x6e'):_0x439f75=squel[_0xe486('0x6f')]()['into'](_0xe486('0x70'))[_0xe486('0x71')]([_0xe486('0x72'),_0xe486('0x73'),_0xe486('0x74'),_0xe486('0x75'),_0xe486('0x5f'),_0xe486('0x59'),'updatedAt'],squel['select']()[_0xe486('0x76')](_0xe486('0x72'),_0xe486('0x72'))[_0xe486('0x76')](_0xe486('0x77'),_0xe486('0x73'))[_0xe486('0x76')]('id',_0xe486('0x74'))['field'](_0x1f953d[_0xe486('0x78')]['toString'](),_0xe486('0x75'))[_0xe486('0x76')](_0x506598[_0xe486('0x5b')]['id']['toString'](),'CampaignId')['field']('\x27'+_0x491543+'\x27',_0xe486('0x59'))[_0xe486('0x76')]('\x27'+_0x491543+'\x27',_0xe486('0x5a'))[_0xe486('0x79')](_0xe486('0x7a'))[_0xe486('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x1f953d[_0xe486('0x78')][_0xe486('0x7b')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe486('0x40')](_0xe486('0x7c'),squel[_0xe486('0x7d')]()[_0xe486('0x76')](_0xe486('0x7e'))[_0xe486('0x79')](_0xe486('0x7f'))[_0xe486('0x40')](_0xe486('0x80'),_0x506598[_0xe486('0x5b')]['id'][_0xe486('0x7b')]()))[_0xe486('0x40')](_0xe486('0x7c'),squel[_0xe486('0x7d')]()[_0xe486('0x76')](_0xe486('0x81'))[_0xe486('0x79')](_0xe486('0x70'))[_0xe486('0x40')](_0xe486('0x80'),_0x506598[_0xe486('0x5b')]['id']['toString']())))[_0xe486('0x7b')]();break;case _0xe486('0x82'):_0x439f75=squel['insert']()[_0xe486('0x83')](_0xe486('0x70'))[_0xe486('0x71')]([_0xe486('0x72'),'scheduledAt','ContactId','ListId','CampaignId',_0xe486('0x59'),_0xe486('0x5a')],squel[_0xe486('0x7d')]()[_0xe486('0x76')](_0xe486('0x72'),_0xe486('0x72'))[_0xe486('0x76')]('NOW()',_0xe486('0x73'))[_0xe486('0x76')]('id',_0xe486('0x74'))[_0xe486('0x76')](_0x1f953d[_0xe486('0x78')]['toString'](),_0xe486('0x75'))['field'](_0x506598['params']['id'][_0xe486('0x7b')](),_0xe486('0x5f'))[_0xe486('0x76')]('\x27'+_0x491543+'\x27',_0xe486('0x59'))[_0xe486('0x76')]('\x27'+_0x491543+'\x27',_0xe486('0x5a'))[_0xe486('0x79')](_0xe486('0x7a'))[_0xe486('0x40')](_0xe486('0x84'))[_0xe486('0x40')]('ListId\x20=\x20?',_0x1f953d[_0xe486('0x78')][_0xe486('0x7b')]())['where'](_0xe486('0x85'))['where'](_0xe486('0x7c'),squel[_0xe486('0x7d')]()[_0xe486('0x76')]('COALESCE(phone,\x27\x27)')[_0xe486('0x79')](_0xe486('0x70'))['where'](_0xe486('0x80'),_0x506598[_0xe486('0x5b')]['id'][_0xe486('0x7b')]())))[_0xe486('0x7b')]();break;default:_0x439f75=squel[_0xe486('0x6f')]()[_0xe486('0x83')]('cm_hopper')[_0xe486('0x71')](['phone',_0xe486('0x73'),_0xe486('0x74'),'ListId',_0xe486('0x5f'),_0xe486('0x59'),_0xe486('0x5a')],squel[_0xe486('0x7d')]()[_0xe486('0x76')](_0xe486('0x72'),'phone')[_0xe486('0x76')](_0xe486('0x77'),_0xe486('0x73'))['field']('id',_0xe486('0x74'))[_0xe486('0x76')](_0x1f953d[_0xe486('0x78')]['toString'](),_0xe486('0x75'))[_0xe486('0x76')](_0x506598[_0xe486('0x5b')]['id'][_0xe486('0x7b')](),_0xe486('0x5f'))[_0xe486('0x76')]('\x27'+_0x491543+'\x27',_0xe486('0x59'))[_0xe486('0x76')]('\x27'+_0x491543+'\x27',_0xe486('0x5a'))[_0xe486('0x79')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xe486('0x40')](_0xe486('0x86'),_0x1f953d[_0xe486('0x78')][_0xe486('0x7b')]())[_0xe486('0x40')](_0xe486('0x85')))[_0xe486('0x7b')]();}_0x7bf3ff=squel[_0xe486('0x6f')]()[_0xe486('0x83')](_0xe486('0x87'))[_0xe486('0x71')](['cmHopperId',_0xe486('0x73'),_0xe486('0x72'),_0xe486('0x88'),_0xe486('0x59'),_0xe486('0x5a')],squel['select']()[_0xe486('0x76')]('h.id','id')[_0xe486('0x76')]('NOW()','scheduledAt')[_0xe486('0x76')]('ci.item',_0xe486('0x72'))[_0xe486('0x76')](_0xe486('0x89'),_0xe486('0x88'))[_0xe486('0x76')]('\x27'+_0x491543+'\x27','createdAt')[_0xe486('0x76')]('\x27'+_0x491543+'\x27','updatedAt')[_0xe486('0x79')]('cm_contact_has_items','ci')[_0xe486('0x8a')]('cm_hopper','h',_0xe486('0x8b'))[_0xe486('0x40')]('h.ListId\x20=\x20?',_0x1f953d[_0xe486('0x78')]['toString']())[_0xe486('0x40')](_0xe486('0x8c'),_0x506598[_0xe486('0x5b')]['id'][_0xe486('0x7b')]())['where'](_0xe486('0x8d'),_0x491543))['toString']();_0x369b45[_0xe486('0x8e')](db[_0xe486('0x8f')][_0xe486('0x36')](_0x439f75));_0x4e2250[_0xe486('0x8e')](db[_0xe486('0x8f')][_0xe486('0x36')](_0x7bf3ff));}return BPromise[_0xe486('0x90')](_0x369b45);}})[_0xe486('0x28')](function(){return BPromise[_0xe486('0x90')](_0x4e2250);})[_0xe486('0x28')](function(){return _0x2f25ed;})[_0xe486('0x28')](respondWithResult(_0x5a2dd0,null))[_0xe486('0x48')](handleError(_0x5a2dd0,null));};exports[_0xe486('0x91')]=function(_0x319924,_0x11fc68,_0x36f91f){return db[_0xe486('0x44')][_0xe486('0x4b')]({'where':{'id':_0x319924['params']['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x11fc68,null))[_0xe486('0x28')](function(_0x382cdd){if(_0x382cdd){return _0x382cdd[_0xe486('0x91')](_0x319924[_0xe486('0x36')][_0xe486('0x6c')]);}})['then'](function(_0x4c032d){if(_0x4c032d){return db[_0xe486('0x61')]['destroy']({'where':{'ListId':_0x319924[_0xe486('0x36')][_0xe486('0x6c')],'CampaignId':_0x319924['params']['id']}})['then'](function(){return _0x4c032d;});}})[_0xe486('0x28')](respondWithStatusCode(_0x11fc68,null))['catch'](handleError(_0x11fc68,null));};exports[_0xe486('0x92')]=function(_0x40e0f3,_0x53b45d,_0x1a804d){var _0x23c08a={};var _0x42379b={};var _0xeb13bf;var _0x4314a8;return db[_0xe486('0x44')][_0xe486('0x5d')]({'where':{'id':_0x40e0f3[_0xe486('0x5b')]['id']}})['then'](handleEntityNotFound(_0x53b45d,null))['then'](function(_0x660778){if(_0x660778){_0xeb13bf=_0x660778;_0x42379b['model']=_[_0xe486('0x37')](db[_0xe486('0x69')]['rawAttributes']);_0x42379b[_0xe486('0x36')]=_[_0xe486('0x37')](_0x40e0f3['query']);_0x42379b[_0xe486('0x38')]=_[_0xe486('0x4a')](_0x42379b[_0xe486('0x34')],_0x42379b[_0xe486('0x36')]);_0x23c08a[_0xe486('0x39')]=_[_0xe486('0x4a')](_0x42379b[_0xe486('0x34')],qs[_0xe486('0x3a')](_0x40e0f3[_0xe486('0x36')][_0xe486('0x3a')]));_0x23c08a[_0xe486('0x39')]=_0x23c08a['attributes']['length']?_0x23c08a[_0xe486('0x39')]:_0x42379b[_0xe486('0x34')];_0x23c08a[_0xe486('0x3d')]=qs[_0xe486('0x3e')](_0x40e0f3[_0xe486('0x36')][_0xe486('0x3e')]);_0x23c08a[_0xe486('0x40')]=qs[_0xe486('0x38')](_['pick'](_0x40e0f3[_0xe486('0x36')],_0x42379b[_0xe486('0x38')]));if(_0x40e0f3[_0xe486('0x36')][_0xe486('0x60')]){_0x23c08a[_0xe486('0x40')]=_[_0xe486('0x42')](_0x23c08a[_0xe486('0x40')],{'$or':_[_0xe486('0x35')](_0x23c08a[_0xe486('0x39')],function(_0x2e8d19){var _0x8bc29c={};_0x8bc29c[_0x2e8d19]={'$like':'%'+_0x40e0f3[_0xe486('0x36')]['filter']+'%'};return _0x8bc29c;})});}_0x23c08a=_[_0xe486('0x42')]({},_0x23c08a,_0x40e0f3['options']);return _0xeb13bf['getBlackLists'](_0x23c08a);}})[_0xe486('0x28')](function(_0x2ca599){if(_0x2ca599){_0x4314a8=_0x2ca599['length'];if(!_0x40e0f3[_0xe486('0x36')][_0xe486('0x5e')](_0xe486('0x3c'))){_0x23c08a[_0xe486('0x21')]=qs['limit'](_0x40e0f3[_0xe486('0x36')]['limit']);_0x23c08a[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x40e0f3[_0xe486('0x36')][_0xe486('0x22')]);}return _0xeb13bf['getBlackLists'](_0x23c08a);}})[_0xe486('0x28')](function(_0x2b863d){if(_0x2b863d){return _0x2b863d?{'count':_0x4314a8,'rows':_0x2b863d}:null;}})[_0xe486('0x28')](respondWithResult(_0x53b45d,null))[_0xe486('0x48')](handleError(_0x53b45d,null));};exports['addBlackLists']=function(_0x501d3f,_0x9c7f9b,_0x1fe136){var _0x248db2,_0xba5703;var _0x250045=[];var _0x4f874d=moment()[_0xe486('0x6a')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xe486('0x44')][_0xe486('0x4b')]({'where':{'id':_0x501d3f[_0xe486('0x5b')]['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x9c7f9b,null))['then'](function(_0x73e5c5){if(_0x73e5c5){_0xba5703=_0x73e5c5;return _0x73e5c5['addBlackLists'](_0x501d3f[_0xe486('0x4d')]['ids'],_[_0xe486('0x58')](_0x501d3f[_0xe486('0x4d')],[_0xe486('0x6c'),'id'])||{});}return null;})[_0xe486('0x93')](function(_0x4dddb2){var _0x2fbc7c;var _0x2bfd7c;_0x248db2=_0x4dddb2||[];var _0x2ec0d7=[];if(_0x4dddb2){for(var _0x10b6b9=0x0;_0x10b6b9<_0x4dddb2[_0xe486('0x3b')];_0x10b6b9+=0x1){var _0x3d2c9c=_0x4dddb2[_0x10b6b9]['get']({'plain':!![]});_0x2fbc7c=squel['insert']()[_0xe486('0x83')](_0xe486('0x94'))[_0xe486('0x71')]([_0xe486('0x72'),_0xe486('0x74'),_0xe486('0x75'),_0xe486('0x5f'),_0xe486('0x59'),_0xe486('0x5a')],squel[_0xe486('0x7d')]()[_0xe486('0x76')](_0xe486('0x72'),_0xe486('0x72'))['field']('id','ContactId')[_0xe486('0x76')](_0x3d2c9c[_0xe486('0x78')][_0xe486('0x7b')](),'ListId')['field'](_0x501d3f['params']['id']['toString'](),_0xe486('0x5f'))['field'](_0xe486('0x77'),'createdAt')[_0xe486('0x76')](_0xe486('0x77'),_0xe486('0x5a'))[_0xe486('0x79')](_0xe486('0x7a'))['where'](_0xe486('0x84'))[_0xe486('0x40')]('ListId\x20=\x20?',_0x3d2c9c[_0xe486('0x78')][_0xe486('0x7b')]())[_0xe486('0x40')](_0xe486('0x85')))[_0xe486('0x7b')]();_0x2ec0d7[_0xe486('0x8e')](db[_0xe486('0x8f')][_0xe486('0x36')](_0x2fbc7c));}return BPromise[_0xe486('0x90')](_0x2ec0d7);}})[_0xe486('0x28')](function(){return _0x248db2;})[_0xe486('0x28')](respondWithResult(_0x9c7f9b,null))['catch'](handleError(_0x9c7f9b,null));};exports[_0xe486('0x95')]=function(_0x5b6077,_0x4e28c6,_0x32d8ba){return db['Campaign']['find']({'where':{'id':_0x5b6077[_0xe486('0x5b')]['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x4e28c6,null))[_0xe486('0x28')](function(_0xc7e200){if(_0xc7e200){return _0xc7e200[_0xe486('0x95')](_0x5b6077[_0xe486('0x36')][_0xe486('0x6c')]);}})[_0xe486('0x28')](function(_0x2a9cb9){if(_0x2a9cb9){return db[_0xe486('0x67')]['destroy']({'where':{'ListId':_0x5b6077[_0xe486('0x36')]['ids'],'CampaignId':_0x5b6077[_0xe486('0x5b')]['id']}})['then'](function(){return _0x2a9cb9;});}})[_0xe486('0x28')](respondWithStatusCode(_0x4e28c6,null))[_0xe486('0x48')](handleError(_0x4e28c6,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 83f905f..c78862d 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(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_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(_0x3fa545,_0x19ff03){var _0x12b6dc=function(_0x112cb8){while(--_0x112cb8){_0x3fa545['push'](_0x3fa545['shift']());}};_0x12b6dc(++_0x19ff03);}(_0x7a54,0x106));var _0x47a5=function(_0x2085ad,_0x4cbb6e){_0x2085ad=_0x2085ad-0x0;var _0x177ddb=_0x7a54[_0x2085ad];return _0x177ddb;};'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 d780edb..1a05a11 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 _0xf257=['map','model','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','where','attributes','limit','include'];(function(_0x123e0d,_0x44229a){var _0x15a212=function(_0x449402){while(--_0x449402){_0x123e0d['push'](_0x123e0d['shift']());}};_0x15a212(++_0x44229a);}(_0xf257,0x82));var _0x7f25=function(_0x5db6cf,_0x321c5d){_0x5db6cf=_0x5db6cf-0x0;var _0x4f3521=_0xf257[_0x5db6cf];return _0x4f3521;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7f25('0x0'));var BPromise=require(_0x7f25('0x1'));var rs=require(_0x7f25('0x2'));var fs=require('fs');var Redis=require(_0x7f25('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f25('0x4'));var logger=require(_0x7f25('0x5'))(_0x7f25('0x6'));var config=require(_0x7f25('0x7'));var jayson=require(_0x7f25('0x8'));var client=jayson[_0x7f25('0x9')][_0x7f25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x242a3e,_0x369a09,_0x16e278){return new BPromise(function(_0x31a5d8,_0x1ae607){return client[_0x7f25('0xb')](_0x242a3e,_0x16e278)[_0x7f25('0xc')](function(_0x57ba17){logger[_0x7f25('0xd')](_0x7f25('0xe'),_0x369a09,'request\x20sent');logger['debug'](_0x7f25('0xf'),_0x369a09,'request\x20sent',JSON[_0x7f25('0x10')](_0x57ba17));if(_0x57ba17[_0x7f25('0x11')]){if(_0x57ba17[_0x7f25('0x11')][_0x7f25('0x12')]===0x1f4){logger[_0x7f25('0x11')](_0x7f25('0xe'),_0x369a09,_0x57ba17[_0x7f25('0x11')]['message']);return _0x1ae607(_0x57ba17['error'][_0x7f25('0x13')]);}logger['error'](_0x7f25('0xe'),_0x369a09,_0x57ba17[_0x7f25('0x11')][_0x7f25('0x13')]);return _0x31a5d8(_0x57ba17[_0x7f25('0x11')][_0x7f25('0x13')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x369a09,'request\x20sent');_0x31a5d8(_0x57ba17[_0x7f25('0x14')][_0x7f25('0x13')]);}})[_0x7f25('0x15')](function(_0x167363){logger[_0x7f25('0x11')](_0x7f25('0xe'),_0x369a09,_0x167363);_0x1ae607(_0x167363);});});}exports[_0x7f25('0x16')]=function(_0x26d4aa){var _0x5e0067=this;return new Promise(function(_0x23f30c,_0x1cd6c1){return db[_0x7f25('0x17')][_0x7f25('0x18')]({'raw':_0x26d4aa[_0x7f25('0x19')]?_0x26d4aa[_0x7f25('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x26d4aa['options']?_0x26d4aa[_0x7f25('0x19')][_0x7f25('0x1a')]||null:null,'attributes':_0x26d4aa[_0x7f25('0x19')]?_0x26d4aa[_0x7f25('0x19')][_0x7f25('0x1b')]||null:null,'limit':_0x26d4aa[_0x7f25('0x19')]?_0x26d4aa[_0x7f25('0x19')][_0x7f25('0x1c')]||null:null,'include':_0x26d4aa[_0x7f25('0x19')]?_0x26d4aa['options'][_0x7f25('0x1d')]?_[_0x7f25('0x1e')](_0x26d4aa[_0x7f25('0x19')][_0x7f25('0x1d')],function(_0x29039a){return{'model':db[_0x29039a['model']],'as':_0x29039a['as'],'attributes':_0x29039a[_0x7f25('0x1b')],'include':_0x29039a[_0x7f25('0x1d')]?_[_0x7f25('0x1e')](_0x29039a['include'],function(_0x17b38c){return{'model':db[_0x17b38c['model']],'as':_0x17b38c['as'],'attributes':_0x17b38c[_0x7f25('0x1b')],'include':_0x17b38c[_0x7f25('0x1d')]?_[_0x7f25('0x1e')](_0x17b38c[_0x7f25('0x1d')],function(_0x382fd4){return{'model':db[_0x382fd4[_0x7f25('0x1f')]],'as':_0x382fd4['as'],'attributes':_0x382fd4[_0x7f25('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7f25('0xc')](function(_0x44116d){logger[_0x7f25('0xd')]('GetCampaign',_0x26d4aa);logger['debug'](_0x7f25('0x16'),_0x26d4aa,JSON[_0x7f25('0x10')](_0x44116d));_0x23f30c(_0x44116d);})['catch'](function(_0xa373ee){logger[_0x7f25('0x11')](_0x7f25('0x16'),_0xa373ee[_0x7f25('0x13')],_0x26d4aa);_0x1cd6c1(_0x5e0067[_0x7f25('0x11')](0x1f4,_0xa373ee[_0x7f25('0x13')]));});});}; \ No newline at end of file +var _0xd382=['options','raw','where','attributes','limit','include','map','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','info','Campaign,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll'];(function(_0x32397a,_0x486c0f){var _0x266af8=function(_0x336075){while(--_0x336075){_0x32397a['push'](_0x32397a['shift']());}};_0x266af8(++_0x486c0f);}(_0xd382,0x1b6));var _0x2d38=function(_0x5b4c12,_0x2fa6f7){_0x5b4c12=_0x5b4c12-0x0;var _0x12c608=_0xd382[_0x5b4c12];return _0x12c608;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var moment=require(_0x2d38('0x2'));var BPromise=require(_0x2d38('0x3'));var rs=require(_0x2d38('0x4'));var fs=require('fs');var Redis=require(_0x2d38('0x5'));var db=require(_0x2d38('0x6'))['db'];var utils=require(_0x2d38('0x7'));var logger=require(_0x2d38('0x8'))(_0x2d38('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2d38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e2919,_0x55ae65,_0x1296cb){return new BPromise(function(_0x3fb88f,_0x39ebfd){return client['request'](_0x1e2919,_0x1296cb)['then'](function(_0x5f20a4){logger[_0x2d38('0xb')](_0x2d38('0xc'),_0x55ae65,'request\x20sent');logger[_0x2d38('0xd')]('Campaign,\x20%s,\x20%s,\x20%s',_0x55ae65,_0x2d38('0xe'),JSON[_0x2d38('0xf')](_0x5f20a4));if(_0x5f20a4[_0x2d38('0x10')]){if(_0x5f20a4[_0x2d38('0x10')][_0x2d38('0x11')]===0x1f4){logger[_0x2d38('0x10')](_0x2d38('0xc'),_0x55ae65,_0x5f20a4['error'][_0x2d38('0x12')]);return _0x39ebfd(_0x5f20a4[_0x2d38('0x10')][_0x2d38('0x12')]);}logger[_0x2d38('0x10')](_0x2d38('0xc'),_0x55ae65,_0x5f20a4['error'][_0x2d38('0x12')]);return _0x3fb88f(_0x5f20a4[_0x2d38('0x10')][_0x2d38('0x12')]);}else{logger[_0x2d38('0xb')](_0x2d38('0xc'),_0x55ae65,_0x2d38('0xe'));_0x3fb88f(_0x5f20a4[_0x2d38('0x13')][_0x2d38('0x12')]);}})[_0x2d38('0x14')](function(_0x6d2a9a){logger[_0x2d38('0x10')](_0x2d38('0xc'),_0x55ae65,_0x6d2a9a);_0x39ebfd(_0x6d2a9a);});});}exports[_0x2d38('0x15')]=function(_0x1e3028){var _0x45c7a8=this;return new Promise(function(_0x9904e0,_0x56016e){return db[_0x2d38('0x16')][_0x2d38('0x17')]({'raw':_0x1e3028['options']?_0x1e3028[_0x2d38('0x18')][_0x2d38('0x19')]===undefined?!![]:![]:!![],'where':_0x1e3028[_0x2d38('0x18')]?_0x1e3028['options'][_0x2d38('0x1a')]||null:null,'attributes':_0x1e3028['options']?_0x1e3028['options'][_0x2d38('0x1b')]||null:null,'limit':_0x1e3028[_0x2d38('0x18')]?_0x1e3028[_0x2d38('0x18')][_0x2d38('0x1c')]||null:null,'include':_0x1e3028[_0x2d38('0x18')]?_0x1e3028[_0x2d38('0x18')][_0x2d38('0x1d')]?_[_0x2d38('0x1e')](_0x1e3028[_0x2d38('0x18')][_0x2d38('0x1d')],function(_0x584e1f){return{'model':db[_0x584e1f[_0x2d38('0x1f')]],'as':_0x584e1f['as'],'attributes':_0x584e1f['attributes'],'include':_0x584e1f[_0x2d38('0x1d')]?_['map'](_0x584e1f[_0x2d38('0x1d')],function(_0xfa9bd){return{'model':db[_0xfa9bd[_0x2d38('0x1f')]],'as':_0xfa9bd['as'],'attributes':_0xfa9bd[_0x2d38('0x1b')],'include':_0xfa9bd[_0x2d38('0x1d')]?_[_0x2d38('0x1e')](_0xfa9bd[_0x2d38('0x1d')],function(_0x529564){return{'model':db[_0x529564[_0x2d38('0x1f')]],'as':_0x529564['as'],'attributes':_0x529564[_0x2d38('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2d38('0x20')](function(_0x3d18cd){logger[_0x2d38('0xb')](_0x2d38('0x15'),_0x1e3028);logger[_0x2d38('0xd')](_0x2d38('0x15'),_0x1e3028,JSON['stringify'](_0x3d18cd));_0x9904e0(_0x3d18cd);})['catch'](function(_0x5570c2){logger[_0x2d38('0x10')](_0x2d38('0x15'),_0x5570c2[_0x2d38('0x12')],_0x1e3028);_0x56016e(_0x45c7a8['error'](0x1f4,_0x5570c2[_0x2d38('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index fadfdaa..909cfba 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 _0x02bc=['/:id/clone','clone','addLists','put','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x02bc,0x1d7));var _0xc02b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x02bc[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xc02b('0x0'));var util=require(_0xc02b('0x1'));var path=require(_0xc02b('0x2'));var timeout=require('connect-timeout');var express=require(_0xc02b('0x3'));var router=express[_0xc02b('0x4')]();var fs_extra=require(_0xc02b('0x5'));var auth=require(_0xc02b('0x6'));var interaction=require(_0xc02b('0x7'));var config=require(_0xc02b('0x8'));var controller=require('./campaign.controller');router[_0xc02b('0x9')]('/',auth[_0xc02b('0xa')](),controller[_0xc02b('0xb')]);router[_0xc02b('0x9')](_0xc02b('0xc'),auth[_0xc02b('0xa')](),controller[_0xc02b('0xd')]);router['get'](_0xc02b('0xe'),auth['isAuthenticated'](),controller[_0xc02b('0xf')]);router['get']('/:id/hopper_histories',auth[_0xc02b('0xa')](),controller['getHopperHistories']);router[_0xc02b('0x9')](_0xc02b('0x10'),auth[_0xc02b('0xa')](),controller['getHopperFinals']);router[_0xc02b('0x9')](_0xc02b('0x11'),auth['isAuthenticated'](),controller[_0xc02b('0x12')]);router[_0xc02b('0x9')](_0xc02b('0x13'),auth[_0xc02b('0xa')](),controller[_0xc02b('0x14')]);router[_0xc02b('0x9')](_0xc02b('0x15'),auth[_0xc02b('0xa')](),controller[_0xc02b('0x16')]);router[_0xc02b('0x17')]('/',auth[_0xc02b('0xa')](),controller['create']);router[_0xc02b('0x17')](_0xc02b('0x18'),auth['isAuthenticated'](),controller[_0xc02b('0x19')]);router[_0xc02b('0x17')]('/:id/lists',auth['isAuthenticated'](),controller[_0xc02b('0x1a')]);router['post'](_0xc02b('0x15'),auth[_0xc02b('0xa')](),controller['addBlackLists']);router[_0xc02b('0x1b')](_0xc02b('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xc02b('0x1c')](_0xc02b('0xc'),auth[_0xc02b('0xa')](),controller[_0xc02b('0x1d')]);router[_0xc02b('0x1c')]('/:id/lists',auth[_0xc02b('0xa')](),controller[_0xc02b('0x1e')]);router[_0xc02b('0x1c')](_0xc02b('0x15'),auth[_0xc02b('0xa')](),controller[_0xc02b('0x1f')]);module[_0xc02b('0x20')]=router; \ No newline at end of file +var _0x3518=['create','post','/:id/clone','clone','addLists','addBlackLists','put','update','delete','/:id/lists','removeLists','removeBlackLists','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists'];(function(_0x2941e7,_0x40f256){var _0x38ff1d=function(_0x5c65ec){while(--_0x5c65ec){_0x2941e7['push'](_0x2941e7['shift']());}};_0x38ff1d(++_0x40f256);}(_0x3518,0xbc));var _0x8351=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x3518[_0x2d34d6];return _0x1d3d12;};'use strict';var multer=require(_0x8351('0x0'));var util=require(_0x8351('0x1'));var path=require('path');var timeout=require(_0x8351('0x2'));var express=require(_0x8351('0x3'));var router=express['Router']();var fs_extra=require(_0x8351('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8351('0x5'));var config=require(_0x8351('0x6'));var controller=require(_0x8351('0x7'));router[_0x8351('0x8')]('/',auth[_0x8351('0x9')](),controller[_0x8351('0xa')]);router[_0x8351('0x8')](_0x8351('0xb'),auth[_0x8351('0x9')](),controller['show']);router[_0x8351('0x8')](_0x8351('0xc'),auth[_0x8351('0x9')](),controller[_0x8351('0xd')]);router[_0x8351('0x8')](_0x8351('0xe'),auth[_0x8351('0x9')](),controller['getHopperHistories']);router['get'](_0x8351('0xf'),auth['isAuthenticated'](),controller[_0x8351('0x10')]);router[_0x8351('0x8')](_0x8351('0x11'),auth[_0x8351('0x9')](),controller[_0x8351('0x12')]);router[_0x8351('0x8')]('/:id/lists',auth[_0x8351('0x9')](),controller[_0x8351('0x13')]);router[_0x8351('0x8')](_0x8351('0x14'),auth[_0x8351('0x9')](),controller[_0x8351('0x15')]);router['post']('/',auth[_0x8351('0x9')](),controller[_0x8351('0x16')]);router[_0x8351('0x17')](_0x8351('0x18'),auth[_0x8351('0x9')](),controller[_0x8351('0x19')]);router[_0x8351('0x17')]('/:id/lists',auth[_0x8351('0x9')](),controller[_0x8351('0x1a')]);router[_0x8351('0x17')](_0x8351('0x14'),auth[_0x8351('0x9')](),controller[_0x8351('0x1b')]);router[_0x8351('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x8351('0x1d')]);router[_0x8351('0x1e')](_0x8351('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x8351('0x1e')](_0x8351('0x1f'),auth[_0x8351('0x9')](),controller[_0x8351('0x20')]);router[_0x8351('0x1e')]('/:id/blacklists',auth[_0x8351('0x9')](),controller[_0x8351('0x21')]);module[_0x8351('0x22')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 1125545..dec9d1f 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 _0xbec1=['getDataValue','key','sequelize','exports','STRING','TEXT','medium','VIRTUAL'];(function(_0x3d56db,_0x8039b7){var _0xb3c326=function(_0x5ea72f){while(--_0x5ea72f){_0x3d56db['push'](_0x3d56db['shift']());}};_0xb3c326(++_0x8039b7);}(_0xbec1,0xda));var _0x1bec=function(_0xb0838e,_0x255ee3){_0xb0838e=_0xb0838e-0x0;var _0x4d6fc1=_0xbec1[_0xb0838e];return _0x4d6fc1;};'use strict';var Sequelize=require(_0x1bec('0x0'));module[_0x1bec('0x1')]={'key':{'type':Sequelize[_0x1bec('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x1bec('0x3')],'length':_0x1bec('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x1bec('0x2')]},'name':{'type':Sequelize[_0x1bec('0x5')],'get':function(){return this[_0x1bec('0x6')](_0x1bec('0x7'));}}}; \ No newline at end of file +var _0x5a3d=['exports','medium','STRING','getDataValue','key'];(function(_0x2140c7,_0x2c3a57){var _0x16abad=function(_0x2a3261){while(--_0x2a3261){_0x2140c7['push'](_0x2140c7['shift']());}};_0x16abad(++_0x2c3a57);}(_0x5a3d,0x19f));var _0xd5a3=function(_0x16717a,_0x204625){_0x16717a=_0x16717a-0x0;var _0x2c3c24=_0x5a3d[_0x16717a];return _0x2c3c24;};'use strict';var Sequelize=require('sequelize');module[_0xd5a3('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0xd5a3('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xd5a3('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xd5a3('0x3')](_0xd5a3('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 5174270..295c59f 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 _0x5594=['set','apply','then','destroy','get','CannedAnswers','sendStatus','error','stack','name','CannedAnswer','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','params','include','update','body','find','catch','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count'];(function(_0x552eba,_0x3a777e){var _0x1f9980=function(_0x5696af){while(--_0x5696af){_0x552eba['push'](_0x552eba['shift']());}};_0x1f9980(++_0x3a777e);}(_0x5594,0x1c6));var _0x4559=function(_0x1b9fb0,_0x2033bb){_0x1b9fb0=_0x1b9fb0-0x0;var _0x5e99c8=_0x5594[_0x1b9fb0];return _0x5e99c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4559('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4559('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4559('0x2'));var util=require(_0x4559('0x3'));var path=require(_0x4559('0x4'));var sox=require(_0x4559('0x5'));var csv=require(_0x4559('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4559('0x7'));var _=require(_0x4559('0x8'));var squel=require('squel');var crypto=require(_0x4559('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x4559('0xa'));var toCsv=require(_0x4559('0x6'));var querystring=require('querystring');var Papa=require(_0x4559('0xb'));var Redis=require(_0x4559('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4559('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4559('0xe'));var logger=require(_0x4559('0xf'))(_0x4559('0x10'));var utils=require(_0x4559('0x11'));var config=require(_0x4559('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x4559('0x13'))['db'];function respondWithStatusCode(_0x353c89,_0x5d36ce){_0x5d36ce=_0x5d36ce||0xcc;return function(_0x447d5d){if(_0x447d5d){return _0x353c89['sendStatus'](_0x5d36ce);}return _0x353c89['status'](_0x5d36ce)['end']();};}function respondWithResult(_0x1f25a0,_0x66da76){_0x66da76=_0x66da76||0xc8;return function(_0x4486a5){if(_0x4486a5){return _0x1f25a0[_0x4559('0x14')](_0x66da76)[_0x4559('0x15')](_0x4486a5);}};}function respondWithFilteredResult(_0x523277,_0x449148){return function(_0x494193){if(_0x494193){var _0x3a5712=typeof _0x449148[_0x4559('0x16')]===_0x4559('0x17')&&typeof _0x449148[_0x4559('0x18')]==='undefined';var _0x254264=_0x494193[_0x4559('0x19')];var _0x5c4d36=_0x3a5712?0x0:_0x449148[_0x4559('0x16')];var _0x4a8732=_0x3a5712?_0x494193[_0x4559('0x19')]:_0x449148['offset']+_0x449148[_0x4559('0x18')];var _0x273233;if(_0x4a8732>=_0x254264){_0x4a8732=_0x254264;_0x273233=0xc8;}else{_0x273233=0xce;}_0x523277[_0x4559('0x14')](_0x273233);return _0x523277[_0x4559('0x1a')]('Content-Range',_0x5c4d36+'-'+_0x4a8732+'/'+_0x254264)[_0x4559('0x15')](_0x494193);}return null;};}function patchUpdates(_0x2b96cc){return function(_0x5dbc26){try{jsonpatch[_0x4559('0x1b')](_0x5dbc26,_0x2b96cc,!![]);}catch(_0x33c205){return BPromise['reject'](_0x33c205);}return _0x5dbc26['save']();};}function saveUpdates(_0x381226,_0x17ec01){return function(_0xb2ed23){if(_0xb2ed23){return _0xb2ed23['update'](_0x381226)[_0x4559('0x1c')](function(_0x17c59d){return _0x17c59d;});}return null;};}function removeEntity(_0x312479,_0x5f094b){return function(_0x3c0f7d){if(_0x3c0f7d){return _0x3c0f7d[_0x4559('0x1d')]()[_0x4559('0x1c')](function(){var _0x4b738e=_0x3c0f7d[_0x4559('0x1e')]({'plain':!![]});var _0x120027=_0x4559('0x1f');return db['UserProfileResource']['destroy']({'where':{'type':_0x120027,'resourceId':_0x4b738e['id']}})[_0x4559('0x1c')](function(){return _0x3c0f7d;});})[_0x4559('0x1c')](function(){_0x312479[_0x4559('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5959ab,_0x5da872){return function(_0x625480){if(!_0x625480){_0x5959ab[_0x4559('0x20')](0x194);}return _0x625480;};}function handleError(_0x4060ce,_0x46c89b){_0x46c89b=_0x46c89b||0x1f4;return function(_0x513f73){logger[_0x4559('0x21')](_0x513f73[_0x4559('0x22')]);if(_0x513f73[_0x4559('0x23')]){delete _0x513f73[_0x4559('0x23')];}_0x4060ce[_0x4559('0x14')](_0x46c89b)['send'](_0x513f73);};}exports['index']=function(_0x211a54,_0x327a52){var _0x53d05a={},_0x1811f8={},_0x3589c7={'count':0x0,'rows':[]};var _0x1fae51=_['map'](db[_0x4559('0x24')][_0x4559('0x25')],function(_0x5975b5){return{'name':_0x5975b5['fieldName'],'type':_0x5975b5['type']['key']};});_0x1811f8[_0x4559('0x26')]=_[_0x4559('0x27')](_0x1fae51,'name');_0x1811f8[_0x4559('0x28')]=_[_0x4559('0x29')](_0x211a54[_0x4559('0x28')]);_0x1811f8[_0x4559('0x2a')]=_[_0x4559('0x2b')](_0x1811f8[_0x4559('0x26')],_0x1811f8[_0x4559('0x28')]);_0x53d05a[_0x4559('0x2c')]=_[_0x4559('0x2b')](_0x1811f8[_0x4559('0x26')],qs['fields'](_0x211a54[_0x4559('0x28')][_0x4559('0x2d')]));_0x53d05a['attributes']=_0x53d05a[_0x4559('0x2c')][_0x4559('0x2e')]?_0x53d05a[_0x4559('0x2c')]:_0x1811f8[_0x4559('0x26')];if(!_0x211a54['query']['hasOwnProperty'](_0x4559('0x2f'))){_0x53d05a['limit']=qs[_0x4559('0x18')](_0x211a54['query'][_0x4559('0x18')]);_0x53d05a[_0x4559('0x16')]=qs[_0x4559('0x16')](_0x211a54[_0x4559('0x28')][_0x4559('0x16')]);}_0x53d05a[_0x4559('0x30')]=qs[_0x4559('0x31')](_0x211a54['query'][_0x4559('0x31')]);_0x53d05a[_0x4559('0x32')]=qs['filters'](_[_0x4559('0x33')](_0x211a54[_0x4559('0x28')],_0x1811f8[_0x4559('0x2a')]),_0x1fae51);if(_0x211a54[_0x4559('0x28')][_0x4559('0x34')]){_0x53d05a[_0x4559('0x32')]=_[_0x4559('0x35')](_0x53d05a['where'],{'$or':[{'key':{'$like':'%'+_0x211a54[_0x4559('0x28')][_0x4559('0x34')]+'%'}},{'value':{'$like':'%'+_0x211a54['query'][_0x4559('0x34')]+'%'}}]});}_0x53d05a=_[_0x4559('0x35')]({},_0x53d05a,_0x211a54[_0x4559('0x36')]);var _0x27571c={'where':_0x53d05a[_0x4559('0x32')]};return db[_0x4559('0x24')]['count'](_0x27571c)['then'](function(_0x386a3d){_0x3589c7[_0x4559('0x19')]=_0x386a3d;if(_0x211a54['query'][_0x4559('0x37')]){_0x53d05a['include']=[{'all':!![]}];}return db[_0x4559('0x24')][_0x4559('0x38')](_0x53d05a);})[_0x4559('0x1c')](function(_0x3de472){_0x3589c7[_0x4559('0x39')]=_0x3de472;return _0x3589c7;})['then'](respondWithFilteredResult(_0x327a52,_0x53d05a))['catch'](handleError(_0x327a52,null));};exports['show']=function(_0x454248,_0x69315b){var _0x47a76c={'raw':!![],'where':{'id':_0x454248[_0x4559('0x3a')]['id']}},_0xd434f7={};_0xd434f7[_0x4559('0x26')]=_[_0x4559('0x29')](db[_0x4559('0x24')][_0x4559('0x25')]);_0xd434f7[_0x4559('0x28')]=_[_0x4559('0x29')](_0x454248[_0x4559('0x28')]);_0xd434f7[_0x4559('0x2a')]=_[_0x4559('0x2b')](_0xd434f7[_0x4559('0x26')],_0xd434f7[_0x4559('0x28')]);_0x47a76c['attributes']=_[_0x4559('0x2b')](_0xd434f7[_0x4559('0x26')],qs[_0x4559('0x2d')](_0x454248[_0x4559('0x28')]['fields']));_0x47a76c[_0x4559('0x2c')]=_0x47a76c[_0x4559('0x2c')][_0x4559('0x2e')]?_0x47a76c[_0x4559('0x2c')]:_0xd434f7[_0x4559('0x26')];if(_0x454248[_0x4559('0x28')][_0x4559('0x37')]){_0x47a76c[_0x4559('0x3b')]=[{'all':!![]}];}_0x47a76c=_[_0x4559('0x35')]({},_0x47a76c,_0x454248[_0x4559('0x36')]);return db['CannedAnswer']['find'](_0x47a76c)[_0x4559('0x1c')](handleEntityNotFound(_0x69315b,null))[_0x4559('0x1c')](respondWithResult(_0x69315b,null))['catch'](handleError(_0x69315b,null));};exports[_0x4559('0x3c')]=function(_0x3b6040,_0x3f3009){if(_0x3b6040[_0x4559('0x3d')]['id']){delete _0x3b6040[_0x4559('0x3d')]['id'];}return db[_0x4559('0x24')][_0x4559('0x3e')]({'where':{'id':_0x3b6040['params']['id']}})[_0x4559('0x1c')](handleEntityNotFound(_0x3f3009,null))[_0x4559('0x1c')](saveUpdates(_0x3b6040['body'],null))[_0x4559('0x1c')](respondWithResult(_0x3f3009,null))[_0x4559('0x3f')](handleError(_0x3f3009,null));};exports['destroy']=function(_0x2e7cd1,_0x4c9614){return db[_0x4559('0x24')][_0x4559('0x3e')]({'where':{'id':_0x2e7cd1[_0x4559('0x3a')]['id']}})[_0x4559('0x1c')](handleEntityNotFound(_0x4c9614,null))[_0x4559('0x1c')](removeEntity(_0x4c9614,null))[_0x4559('0x3f')](handleError(_0x4c9614,null));};exports[_0x4559('0x40')]=function(_0xcc1825,_0x406962){var _0x4c1f2b={'key':_0xcc1825[_0x4559('0x3d')][_0x4559('0x41')]};if(_0xcc1825[_0x4559('0x3d')][_0x4559('0x42')]){_0x4c1f2b[_0x4559('0x42')]=_0xcc1825[_0x4559('0x3d')]['MailAccountId'];}else if(_0xcc1825['body'][_0x4559('0x43')]){_0x4c1f2b['SmsAccountId']=_0xcc1825[_0x4559('0x3d')]['SmsAccountId'];}else if(_0xcc1825[_0x4559('0x3d')][_0x4559('0x44')]){_0x4c1f2b[_0x4559('0x44')]=_0xcc1825[_0x4559('0x3d')]['OpenchannelAccountId'];}else if(_0xcc1825[_0x4559('0x3d')][_0x4559('0x45')]){_0x4c1f2b[_0x4559('0x45')]=_0xcc1825[_0x4559('0x3d')][_0x4559('0x45')];}return db[_0x4559('0x24')][_0x4559('0x3e')]({'where':_0x4c1f2b})['then'](function(_0x362c75){if(_0x362c75){throw new db[(_0x4559('0x46'))][(_0x4559('0x47'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x4559('0x24')]['create'](_0xcc1825[_0x4559('0x3d')]);})[_0x4559('0x1c')](function(_0x31516d){var _0x1613d8=_0xcc1825[_0x4559('0x48')][_0x4559('0x1e')]({'plain':!![]});if(!_0x1613d8)throw new Error(_0x4559('0x49'));if(_0x1613d8[_0x4559('0x4a')]===_0x4559('0x48')){var _0x55e3f2=_0x31516d[_0x4559('0x1e')]({'plain':!![]});return db[_0x4559('0x4b')]['find']({'where':{'name':_0x4559('0x1f'),'userProfileId':_0x1613d8[_0x4559('0x4c')]},'raw':!![]})[_0x4559('0x1c')](function(_0x31d177){if(_0x31d177&&_0x31d177[_0x4559('0x4d')]===0x0){return db[_0x4559('0x4e')]['create']({'name':_0x55e3f2[_0x4559('0x23')],'resourceId':_0x55e3f2['id'],'type':_0x31d177[_0x4559('0x23')],'sectionId':_0x31d177['id']},{})[_0x4559('0x1c')](function(){return _0x31516d;});}else{return _0x31516d;}})[_0x4559('0x3f')](function(_0x151e92){logger['error'](_0x4559('0x4f'),_0x151e92);throw _0x151e92;});}return _0x31516d;})[_0x4559('0x1c')](respondWithResult(_0x406962,0xc9))[_0x4559('0x3f')](handleError(_0x406962,null));}; \ No newline at end of file +var _0x97af=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','find','catch','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CannedAnswers','userProfileId','autoAssociation','error','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','UserProfileResource','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query'];(function(_0x527372,_0x173b25){var _0x4f88b2=function(_0x1d0bb6){while(--_0x1d0bb6){_0x527372['push'](_0x527372['shift']());}};_0x4f88b2(++_0x173b25);}(_0x97af,0xca));var _0xf97a=function(_0x5c2ad0,_0x46752e){_0x5c2ad0=_0x5c2ad0-0x0;var _0x3d0155=_0x97af[_0x5c2ad0];return _0x3d0155;};'use strict';var emlformat=require(_0xf97a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf97a('0x1'));var rp=require(_0xf97a('0x2'));var moment=require(_0xf97a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf97a('0x4'));var util=require(_0xf97a('0x5'));var path=require(_0xf97a('0x6'));var sox=require('sox');var csv=require(_0xf97a('0x7'));var ejs=require(_0xf97a('0x8'));var fs=require('fs');var fs_extra=require(_0xf97a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf97a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf97a('0xb'));var toCsv=require(_0xf97a('0x7'));var querystring=require(_0xf97a('0xc'));var Papa=require('papaparse');var Redis=require(_0xf97a('0xd'));var authService=require(_0xf97a('0xe'));var qs=require(_0xf97a('0xf'));var as=require(_0xf97a('0x10'));var hardwareService=require(_0xf97a('0x11'));var logger=require(_0xf97a('0x12'))(_0xf97a('0x13'));var utils=require(_0xf97a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf97a('0x15'));var db=require(_0xf97a('0x16'))['db'];function respondWithStatusCode(_0x464f48,_0x494671){_0x494671=_0x494671||0xcc;return function(_0xa8b234){if(_0xa8b234){return _0x464f48[_0xf97a('0x17')](_0x494671);}return _0x464f48[_0xf97a('0x18')](_0x494671)[_0xf97a('0x19')]();};}function respondWithResult(_0x416026,_0x15a099){_0x15a099=_0x15a099||0xc8;return function(_0x47e187){if(_0x47e187){return _0x416026[_0xf97a('0x18')](_0x15a099)[_0xf97a('0x1a')](_0x47e187);}};}function respondWithFilteredResult(_0x35701d,_0x5e0616){return function(_0x260755){if(_0x260755){var _0x2aea97=typeof _0x5e0616[_0xf97a('0x1b')]===_0xf97a('0x1c')&&typeof _0x5e0616[_0xf97a('0x1d')]===_0xf97a('0x1c');var _0x22ae09=_0x260755[_0xf97a('0x1e')];var _0x2a2ba5=_0x2aea97?0x0:_0x5e0616[_0xf97a('0x1b')];var _0x33ae74=_0x2aea97?_0x260755[_0xf97a('0x1e')]:_0x5e0616[_0xf97a('0x1b')]+_0x5e0616[_0xf97a('0x1d')];var _0x14e80c;if(_0x33ae74>=_0x22ae09){_0x33ae74=_0x22ae09;_0x14e80c=0xc8;}else{_0x14e80c=0xce;}_0x35701d[_0xf97a('0x18')](_0x14e80c);return _0x35701d[_0xf97a('0x1f')](_0xf97a('0x20'),_0x2a2ba5+'-'+_0x33ae74+'/'+_0x22ae09)[_0xf97a('0x1a')](_0x260755);}return null;};}function patchUpdates(_0x2d32b0){return function(_0x43e959){try{jsonpatch[_0xf97a('0x21')](_0x43e959,_0x2d32b0,!![]);}catch(_0x29298a){return BPromise[_0xf97a('0x22')](_0x29298a);}return _0x43e959['save']();};}function saveUpdates(_0x11f2c2,_0x5c99d1){return function(_0x41b01e){if(_0x41b01e){return _0x41b01e[_0xf97a('0x23')](_0x11f2c2)[_0xf97a('0x24')](function(_0x360c20){return _0x360c20;});}return null;};}function removeEntity(_0x5abb8f,_0x3a87a7){return function(_0x50d076){if(_0x50d076){return _0x50d076['destroy']()['then'](function(){var _0x477fc7=_0x50d076[_0xf97a('0x25')]({'plain':!![]});var _0x20c00c='CannedAnswers';return db[_0xf97a('0x26')]['destroy']({'where':{'type':_0x20c00c,'resourceId':_0x477fc7['id']}})['then'](function(){return _0x50d076;});})[_0xf97a('0x24')](function(){_0x5abb8f[_0xf97a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d1195,_0x502558){return function(_0x574ec7){if(!_0x574ec7){_0x1d1195[_0xf97a('0x17')](0x194);}return _0x574ec7;};}function handleError(_0x40a01c,_0x5257c9){_0x5257c9=_0x5257c9||0x1f4;return function(_0xb7aa58){logger['error'](_0xb7aa58[_0xf97a('0x27')]);if(_0xb7aa58['name']){delete _0xb7aa58[_0xf97a('0x28')];}_0x40a01c[_0xf97a('0x18')](_0x5257c9)[_0xf97a('0x29')](_0xb7aa58);};}exports['index']=function(_0x3fb2b8,_0x59bf2e){var _0x492698={},_0x30ce21={},_0xc8c2fa={'count':0x0,'rows':[]};var _0x2e1bbd=_[_0xf97a('0x2a')](db[_0xf97a('0x2b')][_0xf97a('0x2c')],function(_0x38249e){return{'name':_0x38249e[_0xf97a('0x2d')],'type':_0x38249e[_0xf97a('0x2e')][_0xf97a('0x2f')]};});_0x30ce21[_0xf97a('0x30')]=_['map'](_0x2e1bbd,_0xf97a('0x28'));_0x30ce21[_0xf97a('0x31')]=_[_0xf97a('0x32')](_0x3fb2b8['query']);_0x30ce21[_0xf97a('0x33')]=_['intersection'](_0x30ce21[_0xf97a('0x30')],_0x30ce21[_0xf97a('0x31')]);_0x492698[_0xf97a('0x34')]=_[_0xf97a('0x35')](_0x30ce21[_0xf97a('0x30')],qs['fields'](_0x3fb2b8[_0xf97a('0x31')][_0xf97a('0x36')]));_0x492698[_0xf97a('0x34')]=_0x492698['attributes'][_0xf97a('0x37')]?_0x492698[_0xf97a('0x34')]:_0x30ce21[_0xf97a('0x30')];if(!_0x3fb2b8[_0xf97a('0x31')][_0xf97a('0x38')](_0xf97a('0x39'))){_0x492698[_0xf97a('0x1d')]=qs[_0xf97a('0x1d')](_0x3fb2b8[_0xf97a('0x31')][_0xf97a('0x1d')]);_0x492698[_0xf97a('0x1b')]=qs['offset'](_0x3fb2b8['query'][_0xf97a('0x1b')]);}_0x492698['order']=qs[_0xf97a('0x3a')](_0x3fb2b8[_0xf97a('0x31')][_0xf97a('0x3a')]);_0x492698[_0xf97a('0x3b')]=qs[_0xf97a('0x33')](_[_0xf97a('0x3c')](_0x3fb2b8[_0xf97a('0x31')],_0x30ce21[_0xf97a('0x33')]),_0x2e1bbd);if(_0x3fb2b8[_0xf97a('0x31')][_0xf97a('0x3d')]){_0x492698[_0xf97a('0x3b')]=_[_0xf97a('0x3e')](_0x492698[_0xf97a('0x3b')],{'$or':[{'key':{'$like':'%'+_0x3fb2b8[_0xf97a('0x31')]['filter']+'%'}},{'value':{'$like':'%'+_0x3fb2b8[_0xf97a('0x31')][_0xf97a('0x3d')]+'%'}}]});}_0x492698=_[_0xf97a('0x3e')]({},_0x492698,_0x3fb2b8[_0xf97a('0x3f')]);var _0x509dd8={'where':_0x492698[_0xf97a('0x3b')]};return db['CannedAnswer'][_0xf97a('0x1e')](_0x509dd8)[_0xf97a('0x24')](function(_0x461563){_0xc8c2fa[_0xf97a('0x1e')]=_0x461563;if(_0x3fb2b8[_0xf97a('0x31')][_0xf97a('0x40')]){_0x492698[_0xf97a('0x41')]=[{'all':!![]}];}return db[_0xf97a('0x2b')]['findAll'](_0x492698);})['then'](function(_0x15a881){_0xc8c2fa['rows']=_0x15a881;return _0xc8c2fa;})['then'](respondWithFilteredResult(_0x59bf2e,_0x492698))['catch'](handleError(_0x59bf2e,null));};exports['show']=function(_0xceedc2,_0xf1c45f){var _0x15a114={'raw':!![],'where':{'id':_0xceedc2['params']['id']}},_0xd70b5a={};_0xd70b5a[_0xf97a('0x30')]=_['keys'](db[_0xf97a('0x2b')][_0xf97a('0x2c')]);_0xd70b5a[_0xf97a('0x31')]=_[_0xf97a('0x32')](_0xceedc2[_0xf97a('0x31')]);_0xd70b5a[_0xf97a('0x33')]=_[_0xf97a('0x35')](_0xd70b5a[_0xf97a('0x30')],_0xd70b5a[_0xf97a('0x31')]);_0x15a114[_0xf97a('0x34')]=_[_0xf97a('0x35')](_0xd70b5a[_0xf97a('0x30')],qs[_0xf97a('0x36')](_0xceedc2[_0xf97a('0x31')][_0xf97a('0x36')]));_0x15a114[_0xf97a('0x34')]=_0x15a114[_0xf97a('0x34')]['length']?_0x15a114[_0xf97a('0x34')]:_0xd70b5a[_0xf97a('0x30')];if(_0xceedc2['query']['includeAll']){_0x15a114[_0xf97a('0x41')]=[{'all':!![]}];}_0x15a114=_['merge']({},_0x15a114,_0xceedc2[_0xf97a('0x3f')]);return db[_0xf97a('0x2b')][_0xf97a('0x42')](_0x15a114)[_0xf97a('0x24')](handleEntityNotFound(_0xf1c45f,null))['then'](respondWithResult(_0xf1c45f,null))[_0xf97a('0x43')](handleError(_0xf1c45f,null));};exports[_0xf97a('0x23')]=function(_0x510c73,_0x1c5214){if(_0x510c73['body']['id']){delete _0x510c73[_0xf97a('0x44')]['id'];}return db[_0xf97a('0x2b')][_0xf97a('0x42')]({'where':{'id':_0x510c73['params']['id']}})[_0xf97a('0x24')](handleEntityNotFound(_0x1c5214,null))[_0xf97a('0x24')](saveUpdates(_0x510c73['body'],null))[_0xf97a('0x24')](respondWithResult(_0x1c5214,null))[_0xf97a('0x43')](handleError(_0x1c5214,null));};exports['destroy']=function(_0x18677f,_0x209a8){return db['CannedAnswer']['find']({'where':{'id':_0x18677f[_0xf97a('0x45')]['id']}})[_0xf97a('0x24')](handleEntityNotFound(_0x209a8,null))[_0xf97a('0x24')](removeEntity(_0x209a8,null))['catch'](handleError(_0x209a8,null));};exports[_0xf97a('0x46')]=function(_0x383ce8,_0x3ad038){var _0x2b6ed7={'key':_0x383ce8[_0xf97a('0x44')][_0xf97a('0x2f')]};if(_0x383ce8[_0xf97a('0x44')][_0xf97a('0x47')]){_0x2b6ed7[_0xf97a('0x47')]=_0x383ce8[_0xf97a('0x44')]['MailAccountId'];}else if(_0x383ce8['body'][_0xf97a('0x48')]){_0x2b6ed7[_0xf97a('0x48')]=_0x383ce8[_0xf97a('0x44')][_0xf97a('0x48')];}else if(_0x383ce8[_0xf97a('0x44')][_0xf97a('0x49')]){_0x2b6ed7[_0xf97a('0x49')]=_0x383ce8[_0xf97a('0x44')][_0xf97a('0x49')];}else if(_0x383ce8['body'][_0xf97a('0x4a')]){_0x2b6ed7[_0xf97a('0x4a')]=_0x383ce8[_0xf97a('0x44')][_0xf97a('0x4a')];}return db['CannedAnswer']['find']({'where':_0x2b6ed7})[_0xf97a('0x24')](function(_0x47b9f8){if(_0x47b9f8){throw new db[(_0xf97a('0x4b'))][(_0xf97a('0x4c'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0xf97a('0x46')](_0x383ce8[_0xf97a('0x44')]);})['then'](function(_0x1805db){var _0x3fca4c=_0x383ce8['user']['get']({'plain':!![]});if(!_0x3fca4c)throw new Error(_0xf97a('0x4d'));if(_0x3fca4c[_0xf97a('0x4e')]===_0xf97a('0x4f')){var _0x44b124=_0x1805db[_0xf97a('0x25')]({'plain':!![]});return db['UserProfileSection'][_0xf97a('0x42')]({'where':{'name':_0xf97a('0x50'),'userProfileId':_0x3fca4c[_0xf97a('0x51')]},'raw':!![]})[_0xf97a('0x24')](function(_0x4fda45){if(_0x4fda45&&_0x4fda45[_0xf97a('0x52')]===0x0){return db[_0xf97a('0x26')][_0xf97a('0x46')]({'name':_0x44b124[_0xf97a('0x28')],'resourceId':_0x44b124['id'],'type':_0x4fda45[_0xf97a('0x28')],'sectionId':_0x4fda45['id']},{})[_0xf97a('0x24')](function(){return _0x1805db;});}else{return _0x1805db;}})[_0xf97a('0x43')](function(_0x306091){logger[_0xf97a('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x306091);throw _0x306091;});}return _0x1805db;})[_0xf97a('0x24')](respondWithResult(_0x3ad038,0xc9))[_0xf97a('0x43')](handleError(_0x3ad038,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 3eff1fa..794fe8b 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 _0x5e1e=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x5e1e,0x137));var _0xe5e1=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x5e1e[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xe5e1('0x0'));var util=require(_0xe5e1('0x1'));var logger=require(_0xe5e1('0x2'))('api');var moment=require(_0xe5e1('0x3'));var BPromise=require(_0xe5e1('0x4'));var rp=require(_0xe5e1('0x5'));var fs=require('fs');var path=require(_0xe5e1('0x6'));var rimraf=require(_0xe5e1('0x7'));var config=require(_0xe5e1('0x8'));var attributes=require('./cannedAnswer.attributes');module[_0xe5e1('0x9')]=function(_0x396c75,_0x27b765){return _0x396c75[_0xe5e1('0xa')](_0xe5e1('0xb'),attributes,{'tableName':_0xe5e1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe5e1('0xd'),'collate':_0xe5e1('0xe')});}; \ No newline at end of file +var _0x5447=['./cannedAnswer.attributes','CannedAnswer','utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x2211ed,_0x1bca0b){var _0x4d78cc=function(_0x467b59){while(--_0x467b59){_0x2211ed['push'](_0x2211ed['shift']());}};_0x4d78cc(++_0x1bca0b);}(_0x5447,0x1a7));var _0x7544=function(_0x55e151,_0x106f12){_0x55e151=_0x55e151-0x0;var _0x64c2e0=_0x5447[_0x55e151];return _0x64c2e0;};'use strict';var _=require(_0x7544('0x0'));var util=require(_0x7544('0x1'));var logger=require(_0x7544('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7544('0x3'));var fs=require('fs');var path=require(_0x7544('0x4'));var rimraf=require(_0x7544('0x5'));var config=require(_0x7544('0x6'));var attributes=require(_0x7544('0x7'));module['exports']=function(_0x1efed6,_0x5dbdeb){return _0x1efed6['define'](_0x7544('0x8'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7544('0x9')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 1cc1d4c..3c3881c 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(_0x123756,_0x3b3eaa){var _0xeeaa88=function(_0x25c3be){while(--_0x25c3be){_0x123756['push'](_0x123756['shift']());}};_0xeeaa88(++_0x3b3eaa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0x4bfb66,_0x5eac95){var _0x4a45d6=function(_0x6ef966){while(--_0x6ef966){_0x4bfb66['push'](_0x4bfb66['shift']());}};_0x4a45d6(++_0x5eac95);}(_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 c9205e0..eedbc3d 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 _0x1fdb=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x5bb4b3,_0x30b4d3){var _0x2f018d=function(_0x249afd){while(--_0x249afd){_0x5bb4b3['push'](_0x5bb4b3['shift']());}};_0x2f018d(++_0x30b4d3);}(_0x1fdb,0x138));var _0xb1fd=function(_0x8bffdd,_0x459131){_0x8bffdd=_0x8bffdd-0x0;var _0x17558e=_0x1fdb[_0x8bffdd];return _0x17558e;};'use strict';var multer=require(_0xb1fd('0x0'));var util=require(_0xb1fd('0x1'));var path=require(_0xb1fd('0x2'));var timeout=require(_0xb1fd('0x3'));var express=require(_0xb1fd('0x4'));var router=express[_0xb1fd('0x5')]();var fs_extra=require(_0xb1fd('0x6'));var auth=require(_0xb1fd('0x7'));var interaction=require(_0xb1fd('0x8'));var config=require('../../config/environment');var controller=require(_0xb1fd('0x9'));router[_0xb1fd('0xa')]('/',auth[_0xb1fd('0xb')](),controller[_0xb1fd('0xc')]);router[_0xb1fd('0xa')](_0xb1fd('0xd'),auth[_0xb1fd('0xb')](),controller[_0xb1fd('0xe')]);router[_0xb1fd('0xf')]('/',auth[_0xb1fd('0xb')](),controller[_0xb1fd('0x10')]);router[_0xb1fd('0x11')](_0xb1fd('0xd'),auth['isAuthenticated'](),controller[_0xb1fd('0x12')]);router[_0xb1fd('0x13')](_0xb1fd('0xd'),auth[_0xb1fd('0xb')](),controller[_0xb1fd('0x14')]);module[_0xb1fd('0x15')]=router; \ No newline at end of file +var _0x58bf=['isAuthenticated','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','index','get','/:id'];(function(_0x22806f,_0x105b2a){var _0x1f28ac=function(_0x5cccd8){while(--_0x5cccd8){_0x22806f['push'](_0x22806f['shift']());}};_0x1f28ac(++_0x105b2a);}(_0x58bf,0x104));var _0xf58b=function(_0x34f591,_0x55fb1c){_0x34f591=_0x34f591-0x0;var _0xda3ec2=_0x58bf[_0x34f591];return _0xda3ec2;};'use strict';var multer=require(_0xf58b('0x0'));var util=require('util');var path=require(_0xf58b('0x1'));var timeout=require(_0xf58b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf58b('0x3'));var interaction=require(_0xf58b('0x4'));var config=require(_0xf58b('0x5'));var controller=require(_0xf58b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xf58b('0x7')]);router[_0xf58b('0x8')](_0xf58b('0x9'),auth[_0xf58b('0xa')](),controller[_0xf58b('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf58b('0xc')]);router[_0xf58b('0xd')](_0xf58b('0x9'),auth['isAuthenticated'](),controller[_0xf58b('0xe')]);router[_0xf58b('0xf')](_0xf58b('0x9'),auth[_0xf58b('0xa')](),controller[_0xf58b('0x10')]);module[_0xf58b('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 6020ec6..96150eb 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 _0x8979=['INTEGER','sequelize','exports','DATE','STRING'];(function(_0x4da356,_0x5235e1){var _0x321b07=function(_0x2bc6f4){while(--_0x2bc6f4){_0x4da356['push'](_0x4da356['shift']());}};_0x321b07(++_0x5235e1);}(_0x8979,0x16e));var _0x9897=function(_0x2e8f2c,_0x480886){_0x2e8f2c=_0x2e8f2c-0x0;var _0xdab2c8=_0x8979[_0x2e8f2c];return _0xdab2c8;};'use strict';var Sequelize=require(_0x9897('0x0'));module[_0x9897('0x1')]={'calldate':{'type':Sequelize[_0x9897('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x9897('0x3')]},'src':{'type':Sequelize[_0x9897('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9897('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x9897('0x3')]},'lastdata':{'type':Sequelize[_0x9897('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9897('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9897('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x9897('0x3')]},'userfield':{'type':Sequelize[_0x9897('0x3')]},'uniqueid':{'type':Sequelize[_0x9897('0x3')]},'linkedid':{'type':Sequelize[_0x9897('0x3')]},'sequence':{'type':Sequelize[_0x9897('0x3')]},'peeraccount':{'type':Sequelize[_0x9897('0x3')]},'type':{'type':Sequelize[_0x9897('0x3')]},'tag':{'type':Sequelize[_0x9897('0x3')]}}; \ No newline at end of file +var _0x1ca7=['exports','STRING','INTEGER','sequelize'];(function(_0x4da572,_0x326408){var _0x378393=function(_0x1357e4){while(--_0x1357e4){_0x4da572['push'](_0x4da572['shift']());}};_0x378393(++_0x326408);}(_0x1ca7,0x157));var _0x71ca=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x1ca7[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x71ca('0x0'));module[_0x71ca('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x71ca('0x2')]},'dst':{'type':Sequelize[_0x71ca('0x2')]},'dcontext':{'type':Sequelize[_0x71ca('0x2')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x71ca('0x2')]},'lastapp':{'type':Sequelize[_0x71ca('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x71ca('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x71ca('0x2')]},'amaflags':{'type':Sequelize[_0x71ca('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x71ca('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x71ca('0x2')]},'linkedid':{'type':Sequelize[_0x71ca('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x71ca('0x2')]},'type':{'type':Sequelize[_0x71ca('0x2')]},'tag':{'type':Sequelize[_0x71ca('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 7a0187e..9f201ee 100644 --- a/server/api/cdr/cdr.controller.js +++ b/server/api/cdr/cdr.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e85=['json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','Cdr','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end'];(function(_0xe59e5d,_0x36a1f7){var _0x457efa=function(_0x45a171){while(--_0x45a171){_0xe59e5d['push'](_0xe59e5d['shift']());}};_0x457efa(++_0x36a1f7);}(_0x0e85,0x7c));var _0x50e8=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x0e85[_0x5f309e];return _0x487b5e;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];function respondWithStatusCode(_0x24d381,_0x508377){_0x508377=_0x508377||0xcc;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0x17')](_0x508377);}return _0x24d381[_0x50e8('0x18')](_0x508377)[_0x50e8('0x19')]();};}function respondWithResult(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0xc8;return function(_0x18596f){if(_0x18596f){return _0x473aa7[_0x50e8('0x18')](_0x54efd3)[_0x50e8('0x1a')](_0x18596f);}};}function respondWithFilteredResult(_0x5c3baa,_0x5524a3){return function(_0x30a872){if(_0x30a872){var _0xf02b48=typeof _0x5524a3[_0x50e8('0x1b')]===_0x50e8('0x1c')&&typeof _0x5524a3[_0x50e8('0x1d')]===_0x50e8('0x1c');var _0x5642bf=_0x30a872['count'];var _0x441f25=_0xf02b48?0x0:_0x5524a3[_0x50e8('0x1b')];var _0x40d060=_0xf02b48?_0x30a872[_0x50e8('0x1e')]:_0x5524a3[_0x50e8('0x1b')]+_0x5524a3[_0x50e8('0x1d')];var _0x1a451d;if(_0x40d060>=_0x5642bf){_0x40d060=_0x5642bf;_0x1a451d=0xc8;}else{_0x1a451d=0xce;}_0x5c3baa['status'](_0x1a451d);return _0x5c3baa[_0x50e8('0x1f')]('Content-Range',_0x441f25+'-'+_0x40d060+'/'+_0x5642bf)[_0x50e8('0x1a')](_0x30a872);}return null;};}function patchUpdates(_0xe04a5c){return function(_0xd263d){try{jsonpatch[_0x50e8('0x20')](_0xd263d,_0xe04a5c,!![]);}catch(_0x46af8e){return BPromise['reject'](_0x46af8e);}return _0xd263d[_0x50e8('0x21')]();};}function saveUpdates(_0x1e4e0d,_0x58110d){return function(_0x31d23c){if(_0x31d23c){return _0x31d23c[_0x50e8('0x22')](_0x1e4e0d)['then'](function(_0x1ce7fc){return _0x1ce7fc;});}return null;};}function removeEntity(_0xe7e56c,_0x4f56b7){return function(_0x47a3d8){if(_0x47a3d8){return _0x47a3d8['destroy']()[_0x50e8('0x23')](function(){_0xe7e56c[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();});}};}function handleEntityNotFound(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(!_0x13b6e9){_0x371a1f['sendStatus'](0x194);}return _0x13b6e9;};}function handleError(_0x3a6442,_0x396611){_0x396611=_0x396611||0x1f4;return function(_0x4b3a09){logger[_0x50e8('0x24')](_0x4b3a09[_0x50e8('0x25')]);if(_0x4b3a09[_0x50e8('0x26')]){delete _0x4b3a09[_0x50e8('0x26')];}_0x3a6442['status'](_0x396611)[_0x50e8('0x27')](_0x4b3a09);};}exports['index']=function(_0x30fedf,_0x39c0c6){var _0x42bbef={},_0x4f0b88={},_0x1041b9={'count':0x0,'rows':[]};var _0x126c99=_[_0x50e8('0x28')](db[_0x50e8('0x29')][_0x50e8('0x2a')],function(_0x18aa31){return{'name':_0x18aa31[_0x50e8('0x2b')],'type':_0x18aa31['type'][_0x50e8('0x2c')]};});_0x4f0b88[_0x50e8('0x2d')]=_['map'](_0x126c99,'name');_0x4f0b88[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x30fedf[_0x50e8('0x2e')]);_0x4f0b88['filters']=_['intersection'](_0x4f0b88[_0x50e8('0x2d')],_0x4f0b88[_0x50e8('0x2e')]);_0x42bbef['attributes']=_[_0x50e8('0x30')](_0x4f0b88[_0x50e8('0x2d')],qs[_0x50e8('0x31')](_0x30fedf[_0x50e8('0x2e')]['fields']));_0x42bbef[_0x50e8('0x32')]=_0x42bbef['attributes'][_0x50e8('0x33')]?_0x42bbef[_0x50e8('0x32')]:_0x4f0b88[_0x50e8('0x2d')];if(!_0x30fedf['query'][_0x50e8('0x34')](_0x50e8('0x35'))){_0x42bbef['limit']=qs[_0x50e8('0x1d')](_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x1d')]);_0x42bbef[_0x50e8('0x1b')]=qs['offset'](_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x1b')]);}_0x42bbef[_0x50e8('0x36')]=qs[_0x50e8('0x37')](_0x30fedf['query'][_0x50e8('0x37')]);_0x42bbef[_0x50e8('0x38')]=qs[_0x50e8('0x39')](_['pick'](_0x30fedf['query'],_0x4f0b88['filters']),_0x126c99);if(_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x3a')]){_0x42bbef[_0x50e8('0x38')]=_[_0x50e8('0x3b')](_0x42bbef[_0x50e8('0x38')],{'$or':_[_0x50e8('0x28')](_0x126c99,function(_0xb566c2){if(_0xb566c2[_0x50e8('0x3c')]!==_0x50e8('0x3d')){var _0x3a1b4d={};_0x3a1b4d[_0xb566c2['name']]={'$like':'%'+_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x3a')]+'%'};return _0x3a1b4d;}})});}_0x42bbef=_[_0x50e8('0x3b')]({},_0x42bbef,_0x30fedf[_0x50e8('0x3e')]);var _0x5dbbe1={'where':_0x42bbef[_0x50e8('0x38')]};return db[_0x50e8('0x29')][_0x50e8('0x1e')](_0x5dbbe1)[_0x50e8('0x23')](function(_0x8e8a97){_0x1041b9['count']=_0x8e8a97;if(_0x30fedf['query'][_0x50e8('0x3f')]){_0x42bbef[_0x50e8('0x40')]=[{'all':!![]}];}return db['Cdr'][_0x50e8('0x41')](_0x42bbef);})[_0x50e8('0x23')](function(_0x3db1ab){_0x1041b9[_0x50e8('0x42')]=_0x3db1ab;return _0x1041b9;})[_0x50e8('0x23')](respondWithFilteredResult(_0x39c0c6,_0x42bbef))[_0x50e8('0x43')](handleError(_0x39c0c6,null));};exports[_0x50e8('0x44')]=function(_0x172049,_0x5e9da3){var _0x3d26bd={'raw':!![],'where':{'id':_0x172049[_0x50e8('0x45')]['id']}},_0x44e0ca={};_0x44e0ca[_0x50e8('0x2d')]=_['keys'](db[_0x50e8('0x29')][_0x50e8('0x2a')]);_0x44e0ca[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x172049['query']);_0x44e0ca[_0x50e8('0x39')]=_['intersection'](_0x44e0ca['model'],_0x44e0ca['query']);_0x3d26bd[_0x50e8('0x32')]=_[_0x50e8('0x30')](_0x44e0ca['model'],qs[_0x50e8('0x31')](_0x172049[_0x50e8('0x2e')][_0x50e8('0x31')]));_0x3d26bd[_0x50e8('0x32')]=_0x3d26bd[_0x50e8('0x32')][_0x50e8('0x33')]?_0x3d26bd['attributes']:_0x44e0ca[_0x50e8('0x2d')];if(_0x172049['query'][_0x50e8('0x3f')]){_0x3d26bd[_0x50e8('0x40')]=[{'all':!![]}];}_0x3d26bd=_['merge']({},_0x3d26bd,_0x172049[_0x50e8('0x3e')]);return db['Cdr'][_0x50e8('0x46')](_0x3d26bd)[_0x50e8('0x23')](handleEntityNotFound(_0x5e9da3,null))[_0x50e8('0x23')](respondWithResult(_0x5e9da3,null))[_0x50e8('0x43')](handleError(_0x5e9da3,null));};exports[_0x50e8('0x47')]=function(_0x3f72ea,_0x229d60){return db[_0x50e8('0x29')][_0x50e8('0x47')](_0x3f72ea[_0x50e8('0x48')],{})[_0x50e8('0x23')](respondWithResult(_0x229d60,0xc9))['catch'](handleError(_0x229d60,null));};exports[_0x50e8('0x22')]=function(_0x275a1b,_0x479431){if(_0x275a1b[_0x50e8('0x48')]['id']){delete _0x275a1b['body']['id'];}return db[_0x50e8('0x29')]['find']({'where':{'id':_0x275a1b[_0x50e8('0x45')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x479431,null))[_0x50e8('0x23')](saveUpdates(_0x275a1b[_0x50e8('0x48')],null))[_0x50e8('0x23')](respondWithResult(_0x479431,null))[_0x50e8('0x43')](handleError(_0x479431,null));};exports[_0x50e8('0x49')]=function(_0x5f256a,_0x3410f3){return db[_0x50e8('0x29')][_0x50e8('0x46')]({'where':{'id':_0x5f256a[_0x50e8('0x45')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x3410f3,null))[_0x50e8('0x23')](removeEntity(_0x3410f3,null))['catch'](handleError(_0x3410f3,null));};exports[_0x50e8('0x4a')]=function(_0x250b28,_0xff2e24){return db[_0x50e8('0x29')]['describe']()[_0x50e8('0x23')](respondWithResult(_0xff2e24,null))[_0x50e8('0x43')](handleError(_0xff2e24,null));}; \ No newline at end of file +var _0xf9d5=['lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','then','sendStatus','error','stack','name','index','map','Cdr','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x256823,_0x2392df){var _0x5db66b=function(_0x2bd5d6){while(--_0x2bd5d6){_0x256823['push'](_0x256823['shift']());}};_0x5db66b(++_0x2392df);}(_0xf9d5,0x122));var _0x5f9d=function(_0x2f5b30,_0x1b0a55){_0x2f5b30=_0x2f5b30-0x0;var _0x1d756b=_0xf9d5[_0x2f5b30];return _0x1d756b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f9d('0x0'));var zipdir=require(_0x5f9d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f9d('0x2'));var moment=require(_0x5f9d('0x3'));var BPromise=require(_0x5f9d('0x4'));var Mustache=require(_0x5f9d('0x5'));var util=require(_0x5f9d('0x6'));var path=require(_0x5f9d('0x7'));var sox=require(_0x5f9d('0x8'));var csv=require('to-csv');var ejs=require(_0x5f9d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f9d('0xa'));var squel=require(_0x5f9d('0xb'));var crypto=require('crypto');var jsforce=require(_0x5f9d('0xc'));var deskjs=require(_0x5f9d('0xd'));var toCsv=require(_0x5f9d('0xe'));var querystring=require(_0x5f9d('0xf'));var Papa=require(_0x5f9d('0x10'));var Redis=require(_0x5f9d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5f9d('0x12'));var as=require(_0x5f9d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f9d('0x14'));var utils=require(_0x5f9d('0x15'));var config=require(_0x5f9d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f9d('0x17'))['db'];function respondWithStatusCode(_0x10f5b1,_0x257910){_0x257910=_0x257910||0xcc;return function(_0x23a39f){if(_0x23a39f){return _0x10f5b1['sendStatus'](_0x257910);}return _0x10f5b1[_0x5f9d('0x18')](_0x257910)[_0x5f9d('0x19')]();};}function respondWithResult(_0x234902,_0x5aacdc){_0x5aacdc=_0x5aacdc||0xc8;return function(_0x8e2381){if(_0x8e2381){return _0x234902[_0x5f9d('0x18')](_0x5aacdc)['json'](_0x8e2381);}};}function respondWithFilteredResult(_0x4fd1cb,_0x2f0154){return function(_0x334cea){if(_0x334cea){var _0x3d4a1c=typeof _0x2f0154[_0x5f9d('0x1a')]===_0x5f9d('0x1b')&&typeof _0x2f0154['limit']==='undefined';var _0x54bd00=_0x334cea[_0x5f9d('0x1c')];var _0x4fb9a5=_0x3d4a1c?0x0:_0x2f0154[_0x5f9d('0x1a')];var _0x48448e=_0x3d4a1c?_0x334cea[_0x5f9d('0x1c')]:_0x2f0154[_0x5f9d('0x1a')]+_0x2f0154[_0x5f9d('0x1d')];var _0x55a31c;if(_0x48448e>=_0x54bd00){_0x48448e=_0x54bd00;_0x55a31c=0xc8;}else{_0x55a31c=0xce;}_0x4fd1cb[_0x5f9d('0x18')](_0x55a31c);return _0x4fd1cb[_0x5f9d('0x1e')](_0x5f9d('0x1f'),_0x4fb9a5+'-'+_0x48448e+'/'+_0x54bd00)[_0x5f9d('0x20')](_0x334cea);}return null;};}function patchUpdates(_0x320182){return function(_0xa62826){try{jsonpatch[_0x5f9d('0x21')](_0xa62826,_0x320182,!![]);}catch(_0x2563d5){return BPromise[_0x5f9d('0x22')](_0x2563d5);}return _0xa62826['save']();};}function saveUpdates(_0x4a2eeb,_0x5465b1){return function(_0x1bc76b){if(_0x1bc76b){return _0x1bc76b['update'](_0x4a2eeb)[_0x5f9d('0x23')](function(_0x5a3472){return _0x5a3472;});}return null;};}function removeEntity(_0x9d86ce,_0x564886){return function(_0x4875c5){if(_0x4875c5){return _0x4875c5['destroy']()[_0x5f9d('0x23')](function(){_0x9d86ce[_0x5f9d('0x18')](0xcc)[_0x5f9d('0x19')]();});}};}function handleEntityNotFound(_0x234511,_0x542bbc){return function(_0x379d2d){if(!_0x379d2d){_0x234511[_0x5f9d('0x24')](0x194);}return _0x379d2d;};}function handleError(_0x190402,_0x74f212){_0x74f212=_0x74f212||0x1f4;return function(_0x2d097f){logger[_0x5f9d('0x25')](_0x2d097f[_0x5f9d('0x26')]);if(_0x2d097f[_0x5f9d('0x27')]){delete _0x2d097f[_0x5f9d('0x27')];}_0x190402[_0x5f9d('0x18')](_0x74f212)['send'](_0x2d097f);};}exports[_0x5f9d('0x28')]=function(_0x1b9054,_0x1496c0){var _0x13cc7c={},_0x10e542={},_0x24233e={'count':0x0,'rows':[]};var _0x38b10d=_[_0x5f9d('0x29')](db[_0x5f9d('0x2a')]['rawAttributes'],function(_0x4ed27d){return{'name':_0x4ed27d['fieldName'],'type':_0x4ed27d[_0x5f9d('0x2b')]['key']};});_0x10e542[_0x5f9d('0x2c')]=_['map'](_0x38b10d,_0x5f9d('0x27'));_0x10e542['query']=_[_0x5f9d('0x2d')](_0x1b9054[_0x5f9d('0x2e')]);_0x10e542[_0x5f9d('0x2f')]=_[_0x5f9d('0x30')](_0x10e542[_0x5f9d('0x2c')],_0x10e542['query']);_0x13cc7c[_0x5f9d('0x31')]=_['intersection'](_0x10e542[_0x5f9d('0x2c')],qs['fields'](_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x32')]));_0x13cc7c['attributes']=_0x13cc7c[_0x5f9d('0x31')][_0x5f9d('0x33')]?_0x13cc7c[_0x5f9d('0x31')]:_0x10e542['model'];if(!_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x34')](_0x5f9d('0x35'))){_0x13cc7c[_0x5f9d('0x1d')]=qs[_0x5f9d('0x1d')](_0x1b9054['query'][_0x5f9d('0x1d')]);_0x13cc7c[_0x5f9d('0x1a')]=qs[_0x5f9d('0x1a')](_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x1a')]);}_0x13cc7c[_0x5f9d('0x36')]=qs['sort'](_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x37')]);_0x13cc7c[_0x5f9d('0x38')]=qs['filters'](_['pick'](_0x1b9054[_0x5f9d('0x2e')],_0x10e542[_0x5f9d('0x2f')]),_0x38b10d);if(_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x39')]){_0x13cc7c[_0x5f9d('0x38')]=_['merge'](_0x13cc7c['where'],{'$or':_[_0x5f9d('0x29')](_0x38b10d,function(_0x3c5737){if(_0x3c5737['type']!==_0x5f9d('0x3a')){var _0x4e15be={};_0x4e15be[_0x3c5737[_0x5f9d('0x27')]]={'$like':'%'+_0x1b9054[_0x5f9d('0x2e')]['filter']+'%'};return _0x4e15be;}})});}_0x13cc7c=_[_0x5f9d('0x3b')]({},_0x13cc7c,_0x1b9054[_0x5f9d('0x3c')]);var _0x4d3288={'where':_0x13cc7c['where']};return db[_0x5f9d('0x2a')][_0x5f9d('0x1c')](_0x4d3288)[_0x5f9d('0x23')](function(_0x3c43f6){_0x24233e[_0x5f9d('0x1c')]=_0x3c43f6;if(_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x3d')]){_0x13cc7c[_0x5f9d('0x3e')]=[{'all':!![]}];}return db[_0x5f9d('0x2a')][_0x5f9d('0x3f')](_0x13cc7c);})[_0x5f9d('0x23')](function(_0x227ef6){_0x24233e[_0x5f9d('0x40')]=_0x227ef6;return _0x24233e;})[_0x5f9d('0x23')](respondWithFilteredResult(_0x1496c0,_0x13cc7c))[_0x5f9d('0x41')](handleError(_0x1496c0,null));};exports[_0x5f9d('0x42')]=function(_0x45ba15,_0x1590b5){var _0xf02211={'raw':!![],'where':{'id':_0x45ba15[_0x5f9d('0x43')]['id']}},_0x21b5d1={};_0x21b5d1[_0x5f9d('0x2c')]=_[_0x5f9d('0x2d')](db[_0x5f9d('0x2a')][_0x5f9d('0x44')]);_0x21b5d1[_0x5f9d('0x2e')]=_[_0x5f9d('0x2d')](_0x45ba15[_0x5f9d('0x2e')]);_0x21b5d1[_0x5f9d('0x2f')]=_[_0x5f9d('0x30')](_0x21b5d1['model'],_0x21b5d1[_0x5f9d('0x2e')]);_0xf02211['attributes']=_[_0x5f9d('0x30')](_0x21b5d1[_0x5f9d('0x2c')],qs[_0x5f9d('0x32')](_0x45ba15[_0x5f9d('0x2e')][_0x5f9d('0x32')]));_0xf02211[_0x5f9d('0x31')]=_0xf02211[_0x5f9d('0x31')]['length']?_0xf02211[_0x5f9d('0x31')]:_0x21b5d1[_0x5f9d('0x2c')];if(_0x45ba15[_0x5f9d('0x2e')]['includeAll']){_0xf02211[_0x5f9d('0x3e')]=[{'all':!![]}];}_0xf02211=_['merge']({},_0xf02211,_0x45ba15[_0x5f9d('0x3c')]);return db[_0x5f9d('0x2a')][_0x5f9d('0x45')](_0xf02211)['then'](handleEntityNotFound(_0x1590b5,null))['then'](respondWithResult(_0x1590b5,null))[_0x5f9d('0x41')](handleError(_0x1590b5,null));};exports[_0x5f9d('0x46')]=function(_0x4c9645,_0x2a43a3){return db['Cdr'][_0x5f9d('0x46')](_0x4c9645[_0x5f9d('0x47')],{})[_0x5f9d('0x23')](respondWithResult(_0x2a43a3,0xc9))[_0x5f9d('0x41')](handleError(_0x2a43a3,null));};exports[_0x5f9d('0x48')]=function(_0x16a9fa,_0x3aa63c){if(_0x16a9fa[_0x5f9d('0x47')]['id']){delete _0x16a9fa[_0x5f9d('0x47')]['id'];}return db[_0x5f9d('0x2a')]['find']({'where':{'id':_0x16a9fa[_0x5f9d('0x43')]['id']}})[_0x5f9d('0x23')](handleEntityNotFound(_0x3aa63c,null))['then'](saveUpdates(_0x16a9fa[_0x5f9d('0x47')],null))[_0x5f9d('0x23')](respondWithResult(_0x3aa63c,null))[_0x5f9d('0x41')](handleError(_0x3aa63c,null));};exports[_0x5f9d('0x49')]=function(_0xc9a152,_0x414868){return db[_0x5f9d('0x2a')][_0x5f9d('0x45')]({'where':{'id':_0xc9a152['params']['id']}})['then'](handleEntityNotFound(_0x414868,null))[_0x5f9d('0x23')](removeEntity(_0x414868,null))[_0x5f9d('0x41')](handleError(_0x414868,null));};exports[_0x5f9d('0x4a')]=function(_0x101616,_0x97aac2){return db[_0x5f9d('0x2a')][_0x5f9d('0x4a')]()[_0x5f9d('0x23')](respondWithResult(_0x97aac2,null))[_0x5f9d('0x41')](handleError(_0x97aac2,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index f7d46f0..2c100c3 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(_0x3ae1aa,_0x1bb16a){var _0x51d70a=function(_0x58ba64){while(--_0x58ba64){_0x3ae1aa['push'](_0x3ae1aa['shift']());}};_0x51d70a(++_0x1bb16a);}(_0x7a54,0x106));var _0x47a5=function(_0x49fdd8,_0x18d74e){_0x49fdd8=_0x49fdd8-0x0;var _0xce2281=_0x7a54[_0x49fdd8];return _0xce2281;};'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(_0x559d58,_0x132357){var _0xcc7a44=function(_0x4d584f){while(--_0x4d584f){_0x559d58['push'](_0x559d58['shift']());}};_0xcc7a44(++_0x132357);}(_0x7a54,0x106));var _0x47a5=function(_0x198483,_0x55a8aa){_0x198483=_0x198483-0x0;var _0x420714=_0x7a54[_0x198483];return _0x420714;};'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 b3f8b34..dae4982 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 _0x7aa7=['client','info','Cdr,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3f287f,_0x2fdfab){var _0x2305b7=function(_0x41d729){while(--_0x41d729){_0x3f287f['push'](_0x3f287f['shift']());}};_0x2305b7(++_0x2fdfab);}(_0x7aa7,0x171));var _0x77aa=function(_0x5aa480,_0x4317b3){_0x5aa480=_0x5aa480-0x0;var _0xbde51d=_0x7aa7[_0x5aa480];return _0xbde51d;};'use strict';var _=require(_0x77aa('0x0'));var util=require(_0x77aa('0x1'));var moment=require(_0x77aa('0x2'));var BPromise=require('bluebird');var rs=require(_0x77aa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77aa('0x4'))['db'];var utils=require(_0x77aa('0x5'));var logger=require(_0x77aa('0x6'))(_0x77aa('0x7'));var config=require('../../config/environment');var jayson=require(_0x77aa('0x8'));var client=jayson[_0x77aa('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a40c2,_0x2fbd6c,_0x1429ae){return new BPromise(function(_0xfd90f2,_0x3b2f31){return client['request'](_0x5a40c2,_0x1429ae)['then'](function(_0x56ab8f){logger[_0x77aa('0xa')](_0x77aa('0xb'),_0x2fbd6c,_0x77aa('0xc'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x2fbd6c,_0x77aa('0xc'),JSON[_0x77aa('0xd')](_0x56ab8f));if(_0x56ab8f[_0x77aa('0xe')]){if(_0x56ab8f[_0x77aa('0xe')][_0x77aa('0xf')]===0x1f4){logger[_0x77aa('0xe')](_0x77aa('0xb'),_0x2fbd6c,_0x56ab8f[_0x77aa('0xe')]['message']);return _0x3b2f31(_0x56ab8f[_0x77aa('0xe')][_0x77aa('0x10')]);}logger[_0x77aa('0xe')](_0x77aa('0xb'),_0x2fbd6c,_0x56ab8f[_0x77aa('0xe')]['message']);return _0xfd90f2(_0x56ab8f['error'][_0x77aa('0x10')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x2fbd6c,_0x77aa('0xc'));_0xfd90f2(_0x56ab8f['result']['message']);}})[_0x77aa('0x11')](function(_0x3e991f){logger[_0x77aa('0xe')](_0x77aa('0xb'),_0x2fbd6c,_0x3e991f);_0x3b2f31(_0x3e991f);});});} \ No newline at end of file +var _0xd649=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','Cdr,\x20%s,\x20%s','message','catch','lodash','util','bluebird'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xd649,0x19f));var _0x9d64=function(_0x285233,_0x58e017){_0x285233=_0x285233-0x0;var _0x2e9a77=_0xd649[_0x285233];return _0x2e9a77;};'use strict';var _=require(_0x9d64('0x0'));var util=require(_0x9d64('0x1'));var moment=require('moment');var BPromise=require(_0x9d64('0x2'));var rs=require(_0x9d64('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d64('0x4'))['db'];var utils=require(_0x9d64('0x5'));var logger=require(_0x9d64('0x6'))(_0x9d64('0x7'));var config=require(_0x9d64('0x8'));var jayson=require(_0x9d64('0x9'));var client=jayson[_0x9d64('0xa')][_0x9d64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a7823,_0x101922,_0x7d616e){return new BPromise(function(_0x42fdac,_0xf1b4b){return client[_0x9d64('0xc')](_0x2a7823,_0x7d616e)[_0x9d64('0xd')](function(_0x4b7938){logger[_0x9d64('0xe')]('Cdr,\x20%s,\x20%s',_0x101922,_0x9d64('0xf'));logger[_0x9d64('0x10')]('Cdr,\x20%s,\x20%s,\x20%s',_0x101922,'request\x20sent',JSON['stringify'](_0x4b7938));if(_0x4b7938['error']){if(_0x4b7938[_0x9d64('0x11')][_0x9d64('0x12')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x101922,_0x4b7938[_0x9d64('0x11')]['message']);return _0xf1b4b(_0x4b7938[_0x9d64('0x11')]['message']);}logger[_0x9d64('0x11')](_0x9d64('0x13'),_0x101922,_0x4b7938['error'][_0x9d64('0x14')]);return _0x42fdac(_0x4b7938[_0x9d64('0x11')][_0x9d64('0x14')]);}else{logger[_0x9d64('0xe')]('Cdr,\x20%s,\x20%s',_0x101922,_0x9d64('0xf'));_0x42fdac(_0x4b7938['result'][_0x9d64('0x14')]);}})[_0x9d64('0x15')](function(_0x5e6257){logger[_0x9d64('0x11')]('Cdr,\x20%s,\x20%s',_0x101922,_0x5e6257);_0xf1b4b(_0x5e6257);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index f063298..57469bd 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x34b87f,_0x28aef2){var _0x449805=function(_0x3735b7){while(--_0x3735b7){_0x34b87f['push'](_0x34b87f['shift']());}};_0x449805(++_0x28aef2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 2ed42ef..cfa0d7a 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 _0x4a8d=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x869ff8,_0xf525f6){var _0x20fdc1=function(_0x1a23ab){while(--_0x1a23ab){_0x869ff8['push'](_0x869ff8['shift']());}};_0x20fdc1(++_0xf525f6);}(_0x4a8d,0x11f));var _0xd4a8=function(_0xc1773,_0x393c9c){_0xc1773=_0xc1773-0x0;var _0x1fbcf0=_0x4a8d[_0xc1773];return _0x1fbcf0;};'use strict';var Sequelize=require(_0xd4a8('0x0'));module[_0xd4a8('0x1')]={'priority':{'type':Sequelize[_0xd4a8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd4a8('0x3')],'allowNull':![],'defaultValue':_0xd4a8('0x4')},'appdata':{'type':Sequelize[_0xd4a8('0x5')]()},'description':{'type':Sequelize[_0xd4a8('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd4a8('0x6')}}; \ No newline at end of file +var _0x25a5=['TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x33007f,_0x4b38d2){var _0x10d38c=function(_0x497992){while(--_0x497992){_0x33007f['push'](_0x33007f['shift']());}};_0x10d38c(++_0x4b38d2);}(_0x25a5,0xa2));var _0x525a=function(_0x3c328f,_0x295abd){_0x3c328f=_0x3c328f-0x0;var _0x3fc412=_0x25a5[_0x3c328f];return _0x3fc412;};'use strict';var Sequelize=require(_0x525a('0x0'));module['exports']={'priority':{'type':Sequelize[_0x525a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x525a('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x525a('0x3')]()},'description':{'type':Sequelize[_0x525a('0x2')]},'interval':{'type':Sequelize[_0x525a('0x2')],'defaultValue':_0x525a('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index b5dad77..8a20bec 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 _0xbc9d=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','then','stack','name','send','show','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','options','body','ChatApplication','find','params','catch'];(function(_0x928174,_0x47a9c8){var _0x50a603=function(_0x8fb37e){while(--_0x8fb37e){_0x928174['push'](_0x928174['shift']());}};_0x50a603(++_0x47a9c8);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x4cdb37,_0x2aa998){_0x4cdb37=_0x4cdb37-0x0;var _0x5ef6d6=_0xbc9d[_0x4cdb37];return _0x5ef6d6;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];function respondWithStatusCode(_0x103d54,_0x48bc83){_0x48bc83=_0x48bc83||0xcc;return function(_0x567e71){if(_0x567e71){return _0x103d54[_0xdbc9('0x19')](_0x48bc83);}return _0x103d54[_0xdbc9('0x1a')](_0x48bc83)[_0xdbc9('0x1b')]();};}function respondWithResult(_0x436e50,_0x53495d){_0x53495d=_0x53495d||0xc8;return function(_0x4a9dcb){if(_0x4a9dcb){return _0x436e50[_0xdbc9('0x1a')](_0x53495d)[_0xdbc9('0x1c')](_0x4a9dcb);}};}function respondWithFilteredResult(_0x3a8a7b,_0x4c7b4f){return function(_0x1b4616){if(_0x1b4616){var _0x1abee8=typeof _0x4c7b4f['offset']===_0xdbc9('0x1d')&&typeof _0x4c7b4f[_0xdbc9('0x1e')]===_0xdbc9('0x1d');var _0x14e655=_0x1b4616[_0xdbc9('0x1f')];var _0x33f1bd=_0x1abee8?0x0:_0x4c7b4f[_0xdbc9('0x20')];var _0xc2ddd2=_0x1abee8?_0x1b4616[_0xdbc9('0x1f')]:_0x4c7b4f[_0xdbc9('0x20')]+_0x4c7b4f['limit'];var _0x1ca5fd;if(_0xc2ddd2>=_0x14e655){_0xc2ddd2=_0x14e655;_0x1ca5fd=0xc8;}else{_0x1ca5fd=0xce;}_0x3a8a7b['status'](_0x1ca5fd);return _0x3a8a7b[_0xdbc9('0x21')](_0xdbc9('0x22'),_0x33f1bd+'-'+_0xc2ddd2+'/'+_0x14e655)['json'](_0x1b4616);}return null;};}function patchUpdates(_0x4408e9){return function(_0x5367dc){try{jsonpatch['apply'](_0x5367dc,_0x4408e9,!![]);}catch(_0x4ab00d){return BPromise['reject'](_0x4ab00d);}return _0x5367dc[_0xdbc9('0x23')]();};}function saveUpdates(_0x2011a2,_0x570ad9){return function(_0x16dcf7){if(_0x16dcf7){return _0x16dcf7[_0xdbc9('0x24')](_0x2011a2)['then'](function(_0x1bc073){return _0x1bc073;});}return null;};}function removeEntity(_0x6b788,_0x1b1c0d){return function(_0x119230){if(_0x119230){return _0x119230[_0xdbc9('0x25')]()[_0xdbc9('0x26')](function(){_0x6b788[_0xdbc9('0x1a')](0xcc)[_0xdbc9('0x1b')]();});}};}function handleEntityNotFound(_0x3c8c1d,_0x4a868b){return function(_0x550bef){if(!_0x550bef){_0x3c8c1d[_0xdbc9('0x19')](0x194);}return _0x550bef;};}function handleError(_0x446ab9,_0x1053ca){_0x1053ca=_0x1053ca||0x1f4;return function(_0x24fdec){logger['error'](_0x24fdec[_0xdbc9('0x27')]);if(_0x24fdec[_0xdbc9('0x28')]){delete _0x24fdec['name'];}_0x446ab9['status'](_0x1053ca)[_0xdbc9('0x29')](_0x24fdec);};}exports[_0xdbc9('0x2a')]=function(_0x473430,_0x59bfd2){var _0x13a432={'raw':!![],'where':{'id':_0x473430['params']['id']}},_0x539e57={};_0x539e57[_0xdbc9('0x2b')]=_['keys'](db['ChatApplication'][_0xdbc9('0x2c')]);_0x539e57[_0xdbc9('0x2d')]=_[_0xdbc9('0x2e')](_0x473430['query']);_0x539e57[_0xdbc9('0x2f')]=_[_0xdbc9('0x30')](_0x539e57['model'],_0x539e57['query']);_0x13a432[_0xdbc9('0x31')]=_[_0xdbc9('0x30')](_0x539e57[_0xdbc9('0x2b')],qs[_0xdbc9('0x32')](_0x473430[_0xdbc9('0x2d')][_0xdbc9('0x32')]));_0x13a432[_0xdbc9('0x31')]=_0x13a432['attributes'][_0xdbc9('0x33')]?_0x13a432[_0xdbc9('0x31')]:_0x539e57[_0xdbc9('0x2b')];if(_0x473430[_0xdbc9('0x2d')][_0xdbc9('0x34')]){_0x13a432[_0xdbc9('0x35')]=[{'all':!![]}];}_0x13a432=_['merge']({},_0x13a432,_0x473430[_0xdbc9('0x36')]);return db['ChatApplication']['find'](_0x13a432)['then'](handleEntityNotFound(_0x59bfd2,null))['then'](respondWithResult(_0x59bfd2,null))['catch'](handleError(_0x59bfd2,null));};exports[_0xdbc9('0x24')]=function(_0x186012,_0x205123){if(_0x186012['body']['id']){delete _0x186012[_0xdbc9('0x37')]['id'];}return db[_0xdbc9('0x38')][_0xdbc9('0x39')]({'where':{'id':_0x186012[_0xdbc9('0x3a')]['id']}})[_0xdbc9('0x26')](handleEntityNotFound(_0x205123,null))[_0xdbc9('0x26')](saveUpdates(_0x186012['body'],null))[_0xdbc9('0x26')](respondWithResult(_0x205123,null))[_0xdbc9('0x3b')](handleError(_0x205123,null));};exports[_0xdbc9('0x25')]=function(_0x52f3b5,_0x2f07fe){return db[_0xdbc9('0x38')][_0xdbc9('0x39')]({'where':{'id':_0x52f3b5[_0xdbc9('0x3a')]['id']}})['then'](handleEntityNotFound(_0x2f07fe,null))['then'](removeEntity(_0x2f07fe,null))[_0xdbc9('0x3b')](handleError(_0x2f07fe,null));}; \ No newline at end of file +var _0xb11e=['send','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','options','find','catch','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','count','then','destroy','sendStatus','stack','name'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0xb11e,0x7d));var _0xeb11=function(_0x331b3c,_0xa86628){_0x331b3c=_0x331b3c-0x0;var _0x5bbba3=_0xb11e[_0x331b3c];return _0x5bbba3;};'use strict';var emlformat=require(_0xeb11('0x0'));var rimraf=require(_0xeb11('0x1'));var zipdir=require(_0xeb11('0x2'));var jsonpatch=require(_0xeb11('0x3'));var rp=require(_0xeb11('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeb11('0x5'));var util=require(_0xeb11('0x6'));var path=require(_0xeb11('0x7'));var sox=require(_0xeb11('0x8'));var csv=require('to-csv');var ejs=require(_0xeb11('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeb11('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeb11('0xb'));var toCsv=require(_0xeb11('0xc'));var querystring=require(_0xeb11('0xd'));var Papa=require('papaparse');var Redis=require(_0xeb11('0xe'));var authService=require(_0xeb11('0xf'));var qs=require(_0xeb11('0x10'));var as=require(_0xeb11('0x11'));var hardwareService=require(_0xeb11('0x12'));var logger=require(_0xeb11('0x13'))(_0xeb11('0x14'));var utils=require(_0xeb11('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xeb11('0x16'));var db=require(_0xeb11('0x17'))['db'];function respondWithStatusCode(_0x15b1e4,_0x517962){_0x517962=_0x517962||0xcc;return function(_0x44b192){if(_0x44b192){return _0x15b1e4['sendStatus'](_0x517962);}return _0x15b1e4[_0xeb11('0x18')](_0x517962)['end']();};}function respondWithResult(_0x5d183d,_0x146cfa){_0x146cfa=_0x146cfa||0xc8;return function(_0x2e0d2c){if(_0x2e0d2c){return _0x5d183d[_0xeb11('0x18')](_0x146cfa)[_0xeb11('0x19')](_0x2e0d2c);}};}function respondWithFilteredResult(_0x4c6a67,_0x58d276){return function(_0x200730){if(_0x200730){var _0xd1a9bf=typeof _0x58d276[_0xeb11('0x1a')]==='undefined'&&typeof _0x58d276[_0xeb11('0x1b')]==='undefined';var _0x33a996=_0x200730[_0xeb11('0x1c')];var _0x139ff8=_0xd1a9bf?0x0:_0x58d276['offset'];var _0xf36770=_0xd1a9bf?_0x200730[_0xeb11('0x1c')]:_0x58d276['offset']+_0x58d276['limit'];var _0x1906db;if(_0xf36770>=_0x33a996){_0xf36770=_0x33a996;_0x1906db=0xc8;}else{_0x1906db=0xce;}_0x4c6a67[_0xeb11('0x18')](_0x1906db);return _0x4c6a67['set']('Content-Range',_0x139ff8+'-'+_0xf36770+'/'+_0x33a996)[_0xeb11('0x19')](_0x200730);}return null;};}function patchUpdates(_0xf057c){return function(_0x4dfe03){try{jsonpatch['apply'](_0x4dfe03,_0xf057c,!![]);}catch(_0x17af28){return BPromise['reject'](_0x17af28);}return _0x4dfe03['save']();};}function saveUpdates(_0x5779df,_0xeeb427){return function(_0x1caf4f){if(_0x1caf4f){return _0x1caf4f['update'](_0x5779df)[_0xeb11('0x1d')](function(_0x40a4cb){return _0x40a4cb;});}return null;};}function removeEntity(_0x53e48d,_0x1c526d){return function(_0x3b2e1a){if(_0x3b2e1a){return _0x3b2e1a[_0xeb11('0x1e')]()['then'](function(){_0x53e48d[_0xeb11('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b97b5,_0x8af064){return function(_0x2a4fc6){if(!_0x2a4fc6){_0x5b97b5[_0xeb11('0x1f')](0x194);}return _0x2a4fc6;};}function handleError(_0x59e3fb,_0x4d8cf8){_0x4d8cf8=_0x4d8cf8||0x1f4;return function(_0xca08dd){logger['error'](_0xca08dd[_0xeb11('0x20')]);if(_0xca08dd[_0xeb11('0x21')]){delete _0xca08dd[_0xeb11('0x21')];}_0x59e3fb[_0xeb11('0x18')](_0x4d8cf8)[_0xeb11('0x22')](_0xca08dd);};}exports['show']=function(_0x1d9bf7,_0x387fb7){var _0x4ee70a={'raw':!![],'where':{'id':_0x1d9bf7['params']['id']}},_0x104561={};_0x104561[_0xeb11('0x23')]=_[_0xeb11('0x24')](db[_0xeb11('0x25')][_0xeb11('0x26')]);_0x104561[_0xeb11('0x27')]=_[_0xeb11('0x24')](_0x1d9bf7[_0xeb11('0x27')]);_0x104561[_0xeb11('0x28')]=_[_0xeb11('0x29')](_0x104561['model'],_0x104561[_0xeb11('0x27')]);_0x4ee70a['attributes']=_[_0xeb11('0x29')](_0x104561[_0xeb11('0x23')],qs[_0xeb11('0x2a')](_0x1d9bf7['query']['fields']));_0x4ee70a[_0xeb11('0x2b')]=_0x4ee70a[_0xeb11('0x2b')][_0xeb11('0x2c')]?_0x4ee70a[_0xeb11('0x2b')]:_0x104561['model'];if(_0x1d9bf7[_0xeb11('0x27')][_0xeb11('0x2d')]){_0x4ee70a[_0xeb11('0x2e')]=[{'all':!![]}];}_0x4ee70a=_['merge']({},_0x4ee70a,_0x1d9bf7[_0xeb11('0x2f')]);return db['ChatApplication'][_0xeb11('0x30')](_0x4ee70a)['then'](handleEntityNotFound(_0x387fb7,null))[_0xeb11('0x1d')](respondWithResult(_0x387fb7,null))[_0xeb11('0x31')](handleError(_0x387fb7,null));};exports[_0xeb11('0x32')]=function(_0x3641b3,_0x3147c8){if(_0x3641b3[_0xeb11('0x33')]['id']){delete _0x3641b3[_0xeb11('0x33')]['id'];}return db['ChatApplication'][_0xeb11('0x30')]({'where':{'id':_0x3641b3['params']['id']}})[_0xeb11('0x1d')](handleEntityNotFound(_0x3147c8,null))['then'](saveUpdates(_0x3641b3[_0xeb11('0x33')],null))[_0xeb11('0x1d')](respondWithResult(_0x3147c8,null))[_0xeb11('0x31')](handleError(_0x3147c8,null));};exports[_0xeb11('0x1e')]=function(_0x53a811,_0x149431){return db[_0xeb11('0x25')][_0xeb11('0x30')]({'where':{'id':_0x53a811[_0xeb11('0x34')]['id']}})[_0xeb11('0x1d')](handleEntityNotFound(_0x149431,null))[_0xeb11('0x1d')](removeEntity(_0x149431,null))[_0xeb11('0x31')](handleError(_0x149431,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 912be1b..2c0ebce 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 _0xcc49=['define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x189df9,_0x260093){var _0x3b879d=function(_0x376433){while(--_0x376433){_0x189df9['push'](_0x189df9['shift']());}};_0x3b879d(++_0x260093);}(_0xcc49,0x155));var _0x9cc4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xcc49[_0x432682];return _0x463d05;};'use strict';var _=require(_0x9cc4('0x0'));var util=require(_0x9cc4('0x1'));var logger=require(_0x9cc4('0x2'))(_0x9cc4('0x3'));var moment=require(_0x9cc4('0x4'));var BPromise=require(_0x9cc4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9cc4('0x6'));var rimraf=require(_0x9cc4('0x7'));var config=require(_0x9cc4('0x8'));var attributes=require('./chatApplication.attributes');module[_0x9cc4('0x9')]=function(_0x48faa6,_0x1859c7){return _0x48faa6[_0x9cc4('0xa')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9cc4('0xb'),'collate':_0x9cc4('0xc')});}; \ No newline at end of file +var _0x149c=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4'];(function(_0x5e005e,_0x2b9f1c){var _0x22a48e=function(_0xd00148){while(--_0xd00148){_0x5e005e['push'](_0x5e005e['shift']());}};_0x22a48e(++_0x2b9f1c);}(_0x149c,0x143));var _0xc149=function(_0x4468f6,_0x1886f8){_0x4468f6=_0x4468f6-0x0;var _0x1a9eda=_0x149c[_0x4468f6];return _0x1a9eda;};'use strict';var _=require(_0xc149('0x0'));var util=require('util');var logger=require(_0xc149('0x1'))(_0xc149('0x2'));var moment=require(_0xc149('0x3'));var BPromise=require('bluebird');var rp=require(_0xc149('0x4'));var fs=require('fs');var path=require(_0xc149('0x5'));var rimraf=require(_0xc149('0x6'));var config=require(_0xc149('0x7'));var attributes=require(_0xc149('0x8'));module[_0xc149('0x9')]=function(_0x3b5e34,_0x5e9b5c){return _0x3b5e34['define'](_0xc149('0xa'),attributes,{'tableName':_0xc149('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc149('0xc'),'collate':_0xc149('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 2c8744a..fd55841 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 _0x6d74=['request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x6d74,0x1d3));var _0x46d7=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x6d74[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x46d7('0x0'));var util=require('util');var moment=require(_0x46d7('0x1'));var BPromise=require(_0x46d7('0x2'));var rs=require(_0x46d7('0x3'));var fs=require('fs');var Redis=require(_0x46d7('0x4'));var db=require(_0x46d7('0x5'))['db'];var utils=require(_0x46d7('0x6'));var logger=require(_0x46d7('0x7'))(_0x46d7('0x8'));var config=require(_0x46d7('0x9'));var jayson=require(_0x46d7('0xa'));var client=jayson[_0x46d7('0xb')][_0x46d7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c5823,_0x5f533d,_0x35ef03){return new BPromise(function(_0x4b525b,_0x30535f){return client[_0x46d7('0xd')](_0x4c5823,_0x35ef03)['then'](function(_0x3e388b){logger[_0x46d7('0xe')](_0x46d7('0xf'),_0x5f533d,_0x46d7('0x10'));logger[_0x46d7('0x11')](_0x46d7('0x12'),_0x5f533d,_0x46d7('0x10'),JSON[_0x46d7('0x13')](_0x3e388b));if(_0x3e388b[_0x46d7('0x14')]){if(_0x3e388b['error'][_0x46d7('0x15')]===0x1f4){logger[_0x46d7('0x14')](_0x46d7('0xf'),_0x5f533d,_0x3e388b['error'][_0x46d7('0x16')]);return _0x30535f(_0x3e388b[_0x46d7('0x14')][_0x46d7('0x16')]);}logger[_0x46d7('0x14')](_0x46d7('0xf'),_0x5f533d,_0x3e388b[_0x46d7('0x14')]['message']);return _0x4b525b(_0x3e388b[_0x46d7('0x14')]['message']);}else{logger[_0x46d7('0xe')]('ChatApplication,\x20%s,\x20%s',_0x5f533d,'request\x20sent');_0x4b525b(_0x3e388b['result'][_0x46d7('0x16')]);}})['catch'](function(_0x23b1f5){logger['error'](_0x46d7('0xf'),_0x5f533d,_0x23b1f5);_0x30535f(_0x23b1f5);});});} \ No newline at end of file +var _0x477d=['error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x450027,_0x5ad1e4){var _0x30712f=function(_0xdf85ec){while(--_0xdf85ec){_0x450027['push'](_0x450027['shift']());}};_0x30712f(++_0x5ad1e4);}(_0x477d,0x134));var _0xd477=function(_0x4fa2d0,_0x19f947){_0x4fa2d0=_0x4fa2d0-0x0;var _0x19fc92=_0x477d[_0x4fa2d0];return _0x19fc92;};'use strict';var _=require(_0xd477('0x0'));var util=require(_0xd477('0x1'));var moment=require(_0xd477('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd477('0x3'));var db=require(_0xd477('0x4'))['db'];var utils=require(_0xd477('0x5'));var logger=require(_0xd477('0x6'))(_0xd477('0x7'));var config=require('../../config/environment');var jayson=require(_0xd477('0x8'));var client=jayson['client'][_0xd477('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f3c9a,_0x2b796f,_0x5ed887){return new BPromise(function(_0x24c8e8,_0x1c5a83){return client[_0xd477('0xa')](_0x2f3c9a,_0x5ed887)[_0xd477('0xb')](function(_0x8584bf){logger[_0xd477('0xc')](_0xd477('0xd'),_0x2b796f,'request\x20sent');logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x2b796f,_0xd477('0xe'),JSON['stringify'](_0x8584bf));if(_0x8584bf[_0xd477('0xf')]){if(_0x8584bf[_0xd477('0xf')][_0xd477('0x10')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x2b796f,_0x8584bf[_0xd477('0xf')]['message']);return _0x1c5a83(_0x8584bf[_0xd477('0xf')][_0xd477('0x11')]);}logger['error'](_0xd477('0xd'),_0x2b796f,_0x8584bf[_0xd477('0xf')][_0xd477('0x11')]);return _0x24c8e8(_0x8584bf[_0xd477('0xf')][_0xd477('0x11')]);}else{logger['info'](_0xd477('0xd'),_0x2b796f,_0xd477('0xe'));_0x24c8e8(_0x8584bf['result'][_0xd477('0x11')]);}})[_0xd477('0x12')](function(_0x25c14b){logger[_0xd477('0xf')](_0xd477('0xd'),_0x2b796f,_0x25c14b);_0x1c5a83(_0x25c14b);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index d6dd3f1..b41e137 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 _0xd8d9=['multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','show','put','delete','isAuthenticated','destroy','exports'];(function(_0x2416b9,_0x313d5d){var _0x9eefeb=function(_0x4265bd){while(--_0x4265bd){_0x2416b9['push'](_0x2416b9['shift']());}};_0x9eefeb(++_0x313d5d);}(_0xd8d9,0x130));var _0x9d8d=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xd8d9[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x9d8d('0x0'));var util=require('util');var path=require(_0x9d8d('0x1'));var timeout=require('connect-timeout');var express=require(_0x9d8d('0x2'));var router=express['Router']();var fs_extra=require(_0x9d8d('0x3'));var auth=require(_0x9d8d('0x4'));var interaction=require(_0x9d8d('0x5'));var config=require(_0x9d8d('0x6'));var controller=require(_0x9d8d('0x7'));router[_0x9d8d('0x8')](_0x9d8d('0x9'),auth['isAuthenticated'](),controller[_0x9d8d('0xa')]);router[_0x9d8d('0xb')](_0x9d8d('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x9d8d('0xc')]('/:id',auth[_0x9d8d('0xd')](),controller[_0x9d8d('0xe')]);module[_0x9d8d('0xf')]=router; \ No newline at end of file +var _0x9449=['/:id','isAuthenticated','show','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get'];(function(_0x32a81f,_0x4eee66){var _0x5b67a2=function(_0x35d368){while(--_0x35d368){_0x32a81f['push'](_0x32a81f['shift']());}};_0x5b67a2(++_0x4eee66);}(_0x9449,0xca));var _0x9944=function(_0x2ccd6a,_0x51eb42){_0x2ccd6a=_0x2ccd6a-0x0;var _0x60a6c8=_0x9449[_0x2ccd6a];return _0x60a6c8;};'use strict';var multer=require(_0x9944('0x0'));var util=require(_0x9944('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9944('0x2')]();var fs_extra=require(_0x9944('0x3'));var auth=require(_0x9944('0x4'));var interaction=require(_0x9944('0x5'));var config=require('../../config/environment');var controller=require(_0x9944('0x6'));router[_0x9944('0x7')](_0x9944('0x8'),auth[_0x9944('0x9')](),controller[_0x9944('0xa')]);router['put'](_0x9944('0x8'),auth[_0x9944('0x9')](),controller['update']);router[_0x9944('0xb')](_0x9944('0x8'),auth[_0x9944('0x9')](),controller[_0x9944('0xc')]);module[_0x9944('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 4bf6692..d16609b 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 _0x18af=['BOOLEAN','sequelize','STRING'];(function(_0x120abd,_0x5c9313){var _0x84a06c=function(_0x281bb2){while(--_0x281bb2){_0x120abd['push'](_0x120abd['shift']());}};_0x84a06c(++_0x5c9313);}(_0x18af,0x8b));var _0xf18a=function(_0x2f39ea,_0x54cca1){_0x2f39ea=_0x2f39ea-0x0;var _0x5b7527=_0x18af[_0x2f39ea];return _0x5b7527;};'use strict';var Sequelize=require(_0xf18a('0x0'));module['exports']={'name':{'type':Sequelize[_0xf18a('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xf18a('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x80cf=['sequelize','exports','STRING'];(function(_0x195ad,_0x464052){var _0x28d60c=function(_0x257020){while(--_0x257020){_0x195ad['push'](_0x195ad['shift']());}};_0x28d60c(++_0x464052);}(_0x80cf,0xfc));var _0xf80c=function(_0x4076d1,_0x1d2751){_0x4076d1=_0x4076d1-0x0;var _0x2f2aef=_0x80cf[_0x4076d1];return _0x2f2aef;};'use strict';var Sequelize=require(_0xf80c('0x0'));module[_0xf80c('0x1')]={'name':{'type':Sequelize[_0xf80c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 8a441d1..eda4933 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 _0x2cb0=['filters','where','merge','VIRTUAL','filter','options','findAll','rows','show','params','includeAll','include','catch','create','body','find','getUnread','user','toInteger','addMembers','ids','getMembers','findOne','removeMembers','ChatGroupId','ChatInternalMessage','pick','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMessages','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','status','end','json','undefined','count','set','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','ChatGroup','rawAttributes','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort'];(function(_0x608576,_0x21ed02){var _0x531312=function(_0x1c2971){while(--_0x1c2971){_0x608576['push'](_0x608576['shift']());}};_0x531312(++_0x21ed02);}(_0x2cb0,0x7b));var _0x02cb=function(_0x2d1e52,_0x338038){_0x2d1e52=_0x2d1e52-0x0;var _0x47097d=_0x2cb0[_0x2d1e52];return _0x47097d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x02cb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x02cb('0x1'));var rp=require(_0x02cb('0x2'));var moment=require(_0x02cb('0x3'));var BPromise=require(_0x02cb('0x4'));var Mustache=require('mustache');var util=require(_0x02cb('0x5'));var path=require('path');var sox=require(_0x02cb('0x6'));var csv=require(_0x02cb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x02cb('0x8'));var crypto=require(_0x02cb('0x9'));var jsforce=require(_0x02cb('0xa'));var deskjs=require(_0x02cb('0xb'));var toCsv=require(_0x02cb('0x7'));var querystring=require(_0x02cb('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x02cb('0xd'));var qs=require(_0x02cb('0xe'));var as=require(_0x02cb('0xf'));var hardwareService=require(_0x02cb('0x10'));var logger=require(_0x02cb('0x11'))(_0x02cb('0x12'));var utils=require('../../config/utils');var config=require(_0x02cb('0x13'));var licenseUtil=require(_0x02cb('0x14'));var db=require(_0x02cb('0x15'))['db'];config[_0x02cb('0x16')]=_[_0x02cb('0x17')](config['redis'],{'host':_0x02cb('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x02cb('0x16')]));require('./chatGroup.socket')[_0x02cb('0x19')](socket);function respondWithStatusCode(_0x4cc2a0,_0xd45f42){_0xd45f42=_0xd45f42||0xcc;return function(_0x25d236){if(_0x25d236){return _0x4cc2a0['sendStatus'](_0xd45f42);}return _0x4cc2a0[_0x02cb('0x1a')](_0xd45f42)[_0x02cb('0x1b')]();};}function respondWithResult(_0x6eb3b,_0x46c458){_0x46c458=_0x46c458||0xc8;return function(_0x17fe0d){if(_0x17fe0d){return _0x6eb3b[_0x02cb('0x1a')](_0x46c458)[_0x02cb('0x1c')](_0x17fe0d);}};}function respondWithFilteredResult(_0x517946,_0xeaf3cc){return function(_0x2899d3){if(_0x2899d3){var _0x823a6e=typeof _0xeaf3cc['offset']===_0x02cb('0x1d')&&typeof _0xeaf3cc['limit']==='undefined';var _0x56fdbb=_0x2899d3[_0x02cb('0x1e')];var _0x5bdb3e=_0x823a6e?0x0:_0xeaf3cc['offset'];var _0x67f4bb=_0x823a6e?_0x2899d3[_0x02cb('0x1e')]:_0xeaf3cc['offset']+_0xeaf3cc['limit'];var _0x2b7e00;if(_0x67f4bb>=_0x56fdbb){_0x67f4bb=_0x56fdbb;_0x2b7e00=0xc8;}else{_0x2b7e00=0xce;}_0x517946[_0x02cb('0x1a')](_0x2b7e00);return _0x517946[_0x02cb('0x1f')]('Content-Range',_0x5bdb3e+'-'+_0x67f4bb+'/'+_0x56fdbb)[_0x02cb('0x1c')](_0x2899d3);}return null;};}function patchUpdates(_0x51b3ad){return function(_0x651446){try{jsonpatch[_0x02cb('0x20')](_0x651446,_0x51b3ad,!![]);}catch(_0xfacf5e){return BPromise[_0x02cb('0x21')](_0xfacf5e);}return _0x651446[_0x02cb('0x22')]();};}function saveUpdates(_0x241d2b,_0x3dde4e){return function(_0x993817){if(_0x993817){return _0x993817[_0x02cb('0x23')](_0x241d2b)[_0x02cb('0x24')](function(_0x15b1fe){return _0x15b1fe;});}return null;};}function removeEntity(_0x9342fb,_0x39cd2b){return function(_0x4c2b38){if(_0x4c2b38){return _0x4c2b38[_0x02cb('0x25')]()[_0x02cb('0x24')](function(){_0x9342fb[_0x02cb('0x1a')](0xcc)[_0x02cb('0x1b')]();});}};}function handleEntityNotFound(_0x5b6b2d,_0x3dd60e){return function(_0x215564){if(!_0x215564){_0x5b6b2d[_0x02cb('0x26')](0x194);}return _0x215564;};}function handleError(_0xb7bd31,_0x5bb6bd){_0x5bb6bd=_0x5bb6bd||0x1f4;return function(_0x1dc331){logger[_0x02cb('0x27')](_0x1dc331['stack']);if(_0x1dc331[_0x02cb('0x28')]){delete _0x1dc331[_0x02cb('0x28')];}_0xb7bd31[_0x02cb('0x1a')](_0x5bb6bd)[_0x02cb('0x29')](_0x1dc331);};}exports[_0x02cb('0x2a')]=function(_0xc4c1d0,_0x93afe5){var _0x2e38c0={},_0x5729cb={},_0xaa351a={'count':0x0,'rows':[]};var _0x496b03=_[_0x02cb('0x2b')](db[_0x02cb('0x2c')][_0x02cb('0x2d')],function(_0x1edd7b){return{'name':_0x1edd7b['fieldName'],'type':_0x1edd7b[_0x02cb('0x2e')][_0x02cb('0x2f')]};});_0x5729cb['model']=_[_0x02cb('0x2b')](_0x496b03,_0x02cb('0x28'));_0x5729cb[_0x02cb('0x30')]=_[_0x02cb('0x31')](_0xc4c1d0[_0x02cb('0x30')]);_0x5729cb['filters']=_[_0x02cb('0x32')](_0x5729cb['model'],_0x5729cb[_0x02cb('0x30')]);_0x2e38c0[_0x02cb('0x33')]=_['intersection'](_0x5729cb[_0x02cb('0x34')],qs[_0x02cb('0x35')](_0xc4c1d0[_0x02cb('0x30')][_0x02cb('0x35')]));_0x2e38c0[_0x02cb('0x33')]=_0x2e38c0[_0x02cb('0x33')][_0x02cb('0x36')]?_0x2e38c0[_0x02cb('0x33')]:_0x5729cb['model'];if(!_0xc4c1d0['query'][_0x02cb('0x37')](_0x02cb('0x38'))){_0x2e38c0[_0x02cb('0x39')]=qs['limit'](_0xc4c1d0[_0x02cb('0x30')][_0x02cb('0x39')]);_0x2e38c0[_0x02cb('0x3a')]=qs[_0x02cb('0x3a')](_0xc4c1d0['query']['offset']);}_0x2e38c0[_0x02cb('0x3b')]=qs[_0x02cb('0x3c')](_0xc4c1d0[_0x02cb('0x30')][_0x02cb('0x3c')]);_0x2e38c0['where']=qs[_0x02cb('0x3d')](_['pick'](_0xc4c1d0[_0x02cb('0x30')],_0x5729cb[_0x02cb('0x3d')]),_0x496b03);if(_0xc4c1d0[_0x02cb('0x30')]['filter']){_0x2e38c0[_0x02cb('0x3e')]=_[_0x02cb('0x3f')](_0x2e38c0[_0x02cb('0x3e')],{'$or':_['map'](_0x496b03,function(_0x1006ba){if(_0x1006ba[_0x02cb('0x2e')]!==_0x02cb('0x40')){var _0x6e0adb={};_0x6e0adb[_0x1006ba[_0x02cb('0x28')]]={'$like':'%'+_0xc4c1d0['query'][_0x02cb('0x41')]+'%'};return _0x6e0adb;}})});}_0x2e38c0=_[_0x02cb('0x3f')]({},_0x2e38c0,_0xc4c1d0[_0x02cb('0x42')]);var _0x35ae54={'where':_0x2e38c0[_0x02cb('0x3e')]};return db[_0x02cb('0x2c')][_0x02cb('0x1e')](_0x35ae54)['then'](function(_0x1e4fe2){_0xaa351a[_0x02cb('0x1e')]=_0x1e4fe2;if(_0xc4c1d0[_0x02cb('0x30')]['includeAll']){_0x2e38c0['include']=[{'all':!![]}];}return db[_0x02cb('0x2c')][_0x02cb('0x43')](_0x2e38c0);})[_0x02cb('0x24')](function(_0x347d84){_0xaa351a[_0x02cb('0x44')]=_0x347d84;return _0xaa351a;})[_0x02cb('0x24')](respondWithFilteredResult(_0x93afe5,_0x2e38c0))['catch'](handleError(_0x93afe5,null));};exports[_0x02cb('0x45')]=function(_0x48a9f1,_0x4fea8e){var _0x15d507={'raw':!![],'where':{'id':_0x48a9f1[_0x02cb('0x46')]['id']}},_0x1d7d53={};_0x1d7d53['model']=_['keys'](db[_0x02cb('0x2c')][_0x02cb('0x2d')]);_0x1d7d53[_0x02cb('0x30')]=_[_0x02cb('0x31')](_0x48a9f1[_0x02cb('0x30')]);_0x1d7d53['filters']=_[_0x02cb('0x32')](_0x1d7d53['model'],_0x1d7d53[_0x02cb('0x30')]);_0x15d507[_0x02cb('0x33')]=_[_0x02cb('0x32')](_0x1d7d53[_0x02cb('0x34')],qs['fields'](_0x48a9f1[_0x02cb('0x30')][_0x02cb('0x35')]));_0x15d507[_0x02cb('0x33')]=_0x15d507[_0x02cb('0x33')][_0x02cb('0x36')]?_0x15d507[_0x02cb('0x33')]:_0x1d7d53[_0x02cb('0x34')];if(_0x48a9f1[_0x02cb('0x30')][_0x02cb('0x47')]){_0x15d507[_0x02cb('0x48')]=[{'all':!![]}];}_0x15d507=_['merge']({},_0x15d507,_0x48a9f1[_0x02cb('0x42')]);return db[_0x02cb('0x2c')]['find'](_0x15d507)[_0x02cb('0x24')](handleEntityNotFound(_0x4fea8e,null))[_0x02cb('0x24')](respondWithResult(_0x4fea8e,null))[_0x02cb('0x49')](handleError(_0x4fea8e,null));};exports[_0x02cb('0x4a')]=function(_0x24fdda,_0x46a110){return db[_0x02cb('0x2c')][_0x02cb('0x4a')](_0x24fdda[_0x02cb('0x4b')],{})[_0x02cb('0x24')](respondWithResult(_0x46a110,0xc9))[_0x02cb('0x49')](handleError(_0x46a110,null));};exports[_0x02cb('0x23')]=function(_0x21bbd3,_0x30d30f){if(_0x21bbd3[_0x02cb('0x4b')]['id']){delete _0x21bbd3[_0x02cb('0x4b')]['id'];}return db[_0x02cb('0x2c')][_0x02cb('0x4c')]({'where':{'id':_0x21bbd3['params']['id']}})[_0x02cb('0x24')](handleEntityNotFound(_0x30d30f,null))[_0x02cb('0x24')](saveUpdates(_0x21bbd3[_0x02cb('0x4b')],null))[_0x02cb('0x24')](respondWithResult(_0x30d30f,null))[_0x02cb('0x49')](handleError(_0x30d30f,null));};exports[_0x02cb('0x25')]=function(_0x4e8af5,_0x12ecc7){return db[_0x02cb('0x2c')][_0x02cb('0x4c')]({'where':{'id':_0x4e8af5[_0x02cb('0x46')]['id']}})['then'](handleEntityNotFound(_0x12ecc7,null))['then'](removeEntity(_0x12ecc7,null))[_0x02cb('0x49')](handleError(_0x12ecc7,null));};exports['describe']=function(_0x1f98a2,_0x51bea4){return db[_0x02cb('0x2c')]['describe']()[_0x02cb('0x24')](respondWithResult(_0x51bea4,null))['catch'](handleError(_0x51bea4,null));};exports[_0x02cb('0x4d')]=function(_0x387caa,_0x40645c,_0x25a438){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x387caa[_0x02cb('0x46')]['id'],'ToId':_0x387caa[_0x02cb('0x4e')]['id'],'read':![]}})[_0x02cb('0x24')](function(_0xb76081){return{'id':_[_0x02cb('0x4f')](_0x387caa[_0x02cb('0x46')]['id']),'count':_0xb76081};})[_0x02cb('0x24')](respondWithResult(_0x40645c,null))['catch'](handleError(_0x40645c,null));};exports[_0x02cb('0x50')]=function(_0x34f8a8,_0x560fd3,_0x316530){return db[_0x02cb('0x2c')][_0x02cb('0x4c')]({'where':{'id':_0x34f8a8[_0x02cb('0x46')]['id']}})[_0x02cb('0x24')](handleEntityNotFound(_0x560fd3,null))[_0x02cb('0x24')](function(_0x5b048a){if(_0x5b048a){return _0x5b048a['addMembers'](_0x34f8a8['body'][_0x02cb('0x51')],_['omit'](_0x34f8a8[_0x02cb('0x4b')],['ids','id'])||{});}})[_0x02cb('0x24')](respondWithResult(_0x560fd3,null))[_0x02cb('0x49')](handleError(_0x560fd3,null));};exports[_0x02cb('0x52')]=function(_0x54e3e3,_0x4a3d84,_0x33d229){var _0x1b1833={};var _0x53d03e={};var _0x57e6aa;var _0x35ba4e;return db['ChatGroup'][_0x02cb('0x53')]({'where':{'id':_0x54e3e3['params']['id']}})['then'](handleEntityNotFound(_0x4a3d84,null))[_0x02cb('0x24')](function(_0x57b8d2){if(_0x57b8d2){_0x57e6aa=_0x57b8d2;_0x53d03e[_0x02cb('0x34')]=_[_0x02cb('0x31')](db['User']['rawAttributes']);_0x53d03e[_0x02cb('0x30')]=_[_0x02cb('0x31')](_0x54e3e3[_0x02cb('0x30')]);_0x53d03e[_0x02cb('0x3d')]=_[_0x02cb('0x32')](_0x53d03e['model'],_0x53d03e[_0x02cb('0x30')]);_0x1b1833[_0x02cb('0x33')]=_[_0x02cb('0x32')](_0x53d03e[_0x02cb('0x34')],qs[_0x02cb('0x35')](_0x54e3e3['query'][_0x02cb('0x35')]));_0x1b1833[_0x02cb('0x33')]=_0x1b1833['attributes'][_0x02cb('0x36')]?_0x1b1833[_0x02cb('0x33')]:_0x53d03e[_0x02cb('0x34')];_0x1b1833[_0x02cb('0x3b')]=qs[_0x02cb('0x3c')](_0x54e3e3[_0x02cb('0x30')]['sort']);_0x1b1833[_0x02cb('0x3e')]=qs[_0x02cb('0x3d')](_['pick'](_0x54e3e3[_0x02cb('0x30')],_0x53d03e[_0x02cb('0x3d')]));if(_0x54e3e3[_0x02cb('0x30')][_0x02cb('0x41')]){_0x1b1833[_0x02cb('0x3e')]=_[_0x02cb('0x3f')](_0x1b1833[_0x02cb('0x3e')],{'$or':_[_0x02cb('0x2b')](_0x1b1833[_0x02cb('0x33')],function(_0x3ff61e){var _0x5bea01={};_0x5bea01[_0x3ff61e]={'$like':'%'+_0x54e3e3[_0x02cb('0x30')][_0x02cb('0x41')]+'%'};return _0x5bea01;})});}_0x1b1833=_[_0x02cb('0x3f')]({},_0x1b1833,_0x54e3e3[_0x02cb('0x42')]);return _0x57e6aa[_0x02cb('0x52')](_0x1b1833);}})[_0x02cb('0x24')](function(_0x1f5245){if(_0x1f5245){_0x35ba4e=_0x1f5245[_0x02cb('0x36')];if(!_0x54e3e3['query']['hasOwnProperty'](_0x02cb('0x38'))){_0x1b1833[_0x02cb('0x39')]=qs['limit'](_0x54e3e3['query'][_0x02cb('0x39')]);_0x1b1833[_0x02cb('0x3a')]=qs[_0x02cb('0x3a')](_0x54e3e3[_0x02cb('0x30')][_0x02cb('0x3a')]);}return _0x57e6aa[_0x02cb('0x52')](_0x1b1833);}})[_0x02cb('0x24')](function(_0x2e444c){if(_0x2e444c){return _0x2e444c?{'count':_0x35ba4e,'rows':_0x2e444c}:null;}})[_0x02cb('0x24')](respondWithResult(_0x4a3d84,null))[_0x02cb('0x49')](handleError(_0x4a3d84,null));};exports[_0x02cb('0x54')]=function(_0x5f1291,_0x198a73,_0x43bbd2){return db['ChatGroup'][_0x02cb('0x4c')]({'where':{'id':_0x5f1291[_0x02cb('0x46')]['id']}})[_0x02cb('0x24')](handleEntityNotFound(_0x198a73,null))[_0x02cb('0x24')](function(_0x4a953c){if(_0x4a953c){return _0x4a953c[_0x02cb('0x54')](_0x5f1291[_0x02cb('0x30')]['ids']);}})[_0x02cb('0x24')](respondWithStatusCode(_0x198a73,null))['catch'](handleError(_0x198a73,null));};exports['addMessage']=function(_0x3f840c,_0x27e51c,_0x52470a){if(_0x3f840c['body']['id']){delete _0x3f840c[_0x02cb('0x4b')]['id'];}return db[_0x02cb('0x2c')][_0x02cb('0x4c')]({'where':{'id':_0x3f840c[_0x02cb('0x46')]['id']}})[_0x02cb('0x24')](handleEntityNotFound(_0x27e51c,null))[_0x02cb('0x24')](function(_0x44718b){if(_0x44718b){_0x3f840c[_0x02cb('0x4b')][_0x02cb('0x55')]=_0x44718b['id'];return db[_0x02cb('0x56')]['create'](_0x3f840c[_0x02cb('0x4b')]);}})[_0x02cb('0x24')](respondWithResult(_0x27e51c,null))[_0x02cb('0x49')](handleError(_0x27e51c,null));};exports['getMessages']=function(_0x896939,_0x11b426,_0x17af78){var _0x4e868e={};var _0x31c5c4={};var _0x23355b;var _0x54df15;return db['ChatGroup'][_0x02cb('0x53')]({'where':{'id':_0x896939[_0x02cb('0x46')]['id']}})[_0x02cb('0x24')](handleEntityNotFound(_0x11b426,null))[_0x02cb('0x24')](function(_0x2dbb8b){if(_0x2dbb8b){_0x23355b=_0x2dbb8b;_0x31c5c4[_0x02cb('0x34')]=_[_0x02cb('0x31')](db[_0x02cb('0x56')]['rawAttributes']);_0x31c5c4[_0x02cb('0x30')]=_[_0x02cb('0x31')](_0x896939['query']);_0x31c5c4['filters']=_[_0x02cb('0x32')](_0x31c5c4['model'],_0x31c5c4[_0x02cb('0x30')]);_0x4e868e[_0x02cb('0x33')]=_[_0x02cb('0x32')](_0x31c5c4[_0x02cb('0x34')],qs[_0x02cb('0x35')](_0x896939[_0x02cb('0x30')][_0x02cb('0x35')]));_0x4e868e['attributes']=_0x4e868e[_0x02cb('0x33')][_0x02cb('0x36')]?_0x4e868e['attributes']:_0x31c5c4[_0x02cb('0x34')];_0x4e868e[_0x02cb('0x3b')]=qs[_0x02cb('0x3c')](_0x896939[_0x02cb('0x30')][_0x02cb('0x3c')]);_0x4e868e[_0x02cb('0x3e')]=qs[_0x02cb('0x3d')](_[_0x02cb('0x57')](_0x896939[_0x02cb('0x30')],_0x31c5c4[_0x02cb('0x3d')]));if(_0x896939['query']['filter']){_0x4e868e[_0x02cb('0x3e')]=_[_0x02cb('0x3f')](_0x4e868e['where'],{'$or':_[_0x02cb('0x2b')](_0x4e868e['attributes'],function(_0x4111da){var _0x40e0d0={};_0x40e0d0[_0x4111da]={'$like':'%'+_0x896939['query'][_0x02cb('0x41')]+'%'};return _0x40e0d0;})});}if(_0x896939[_0x02cb('0x30')][_0x02cb('0x58')]){var _0xc3477e=_0x896939[_0x02cb('0x30')][_0x02cb('0x58')][_0x02cb('0x59')](',');var _0x589100={};_0x589100[_0xc3477e[0x0]]={'$gte':moment(_0xc3477e[0x1])['format'](_0x02cb('0x5a'))};_0x4e868e[_0x02cb('0x3e')]=_[_0x02cb('0x3f')](_0x4e868e['where'],_0x589100);}_0x4e868e=_[_0x02cb('0x3f')]({},_0x4e868e,_0x896939['options']);return _0x23355b[_0x02cb('0x5b')](_0x4e868e);}})[_0x02cb('0x24')](function(_0x12bc85){if(_0x12bc85){_0x54df15=_0x12bc85[_0x02cb('0x36')];if(!_0x896939[_0x02cb('0x30')]['hasOwnProperty'](_0x02cb('0x38'))){_0x4e868e[_0x02cb('0x39')]=qs[_0x02cb('0x39')](_0x896939['query']['limit']);_0x4e868e[_0x02cb('0x3a')]=qs['offset'](_0x896939['query'][_0x02cb('0x3a')]);}return _0x23355b[_0x02cb('0x5b')](_0x4e868e);}})[_0x02cb('0x24')](function(_0x45c207){if(_0x45c207){return _0x45c207?{'count':_0x54df15,'rows':_0x45c207}:null;}})[_0x02cb('0x24')](respondWithResult(_0x11b426,null))[_0x02cb('0x49')](handleError(_0x11b426,null));}; \ No newline at end of file +var _0x35d5=['offset','undefined','count','limit','status','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','ChatGroup','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','end','json'];(function(_0x2462ed,_0x5c6425){var _0x5cf82b=function(_0x34b219){while(--_0x34b219){_0x2462ed['push'](_0x2462ed['shift']());}};_0x5cf82b(++_0x5c6425);}(_0x35d5,0x16b));var _0x535d=function(_0x497665,_0x3ea3b2){_0x497665=_0x497665-0x0;var _0x1ff718=_0x35d5[_0x497665];return _0x1ff718;};'use strict';var emlformat=require(_0x535d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x535d('0x1'));var jsonpatch=require(_0x535d('0x2'));var rp=require('request-promise');var moment=require(_0x535d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x535d('0x4'));var util=require(_0x535d('0x5'));var path=require(_0x535d('0x6'));var sox=require(_0x535d('0x7'));var csv=require('to-csv');var ejs=require(_0x535d('0x8'));var fs=require('fs');var fs_extra=require(_0x535d('0x9'));var _=require(_0x535d('0xa'));var squel=require(_0x535d('0xb'));var crypto=require(_0x535d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x535d('0xd'));var toCsv=require(_0x535d('0xe'));var querystring=require(_0x535d('0xf'));var Papa=require(_0x535d('0x10'));var Redis=require(_0x535d('0x11'));var authService=require(_0x535d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x535d('0x13'));var logger=require(_0x535d('0x14'))(_0x535d('0x15'));var utils=require(_0x535d('0x16'));var config=require(_0x535d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x535d('0x18'))['db'];config[_0x535d('0x19')]=_[_0x535d('0x1a')](config[_0x535d('0x19')],{'host':_0x535d('0x1b'),'port':0x18eb});var socket=require(_0x535d('0x1c'))(new Redis(config[_0x535d('0x19')]));require(_0x535d('0x1d'))['register'](socket);function respondWithStatusCode(_0x351ac3,_0x58e7d1){_0x58e7d1=_0x58e7d1||0xcc;return function(_0xd07612){if(_0xd07612){return _0x351ac3[_0x535d('0x1e')](_0x58e7d1);}return _0x351ac3['status'](_0x58e7d1)[_0x535d('0x1f')]();};}function respondWithResult(_0x18462b,_0x4980ce){_0x4980ce=_0x4980ce||0xc8;return function(_0x3e0bb6){if(_0x3e0bb6){return _0x18462b['status'](_0x4980ce)[_0x535d('0x20')](_0x3e0bb6);}};}function respondWithFilteredResult(_0x91f9ba,_0x4b7861){return function(_0x25dca1){if(_0x25dca1){var _0x4a6029=typeof _0x4b7861[_0x535d('0x21')]===_0x535d('0x22')&&typeof _0x4b7861['limit']==='undefined';var _0x3415d0=_0x25dca1[_0x535d('0x23')];var _0x145d75=_0x4a6029?0x0:_0x4b7861[_0x535d('0x21')];var _0x4e9b59=_0x4a6029?_0x25dca1[_0x535d('0x23')]:_0x4b7861['offset']+_0x4b7861[_0x535d('0x24')];var _0x3d2bba;if(_0x4e9b59>=_0x3415d0){_0x4e9b59=_0x3415d0;_0x3d2bba=0xc8;}else{_0x3d2bba=0xce;}_0x91f9ba[_0x535d('0x25')](_0x3d2bba);return _0x91f9ba['set'](_0x535d('0x26'),_0x145d75+'-'+_0x4e9b59+'/'+_0x3415d0)[_0x535d('0x20')](_0x25dca1);}return null;};}function patchUpdates(_0x27fac0){return function(_0x46a875){try{jsonpatch['apply'](_0x46a875,_0x27fac0,!![]);}catch(_0x3a86e6){return BPromise[_0x535d('0x27')](_0x3a86e6);}return _0x46a875[_0x535d('0x28')]();};}function saveUpdates(_0x394461,_0x10e06c){return function(_0xa57c32){if(_0xa57c32){return _0xa57c32[_0x535d('0x29')](_0x394461)[_0x535d('0x2a')](function(_0x393a33){return _0x393a33;});}return null;};}function removeEntity(_0x511d8b,_0x1690b3){return function(_0x4361d8){if(_0x4361d8){return _0x4361d8[_0x535d('0x2b')]()[_0x535d('0x2a')](function(){_0x511d8b[_0x535d('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dafbc,_0x2847b9){return function(_0x21da69){if(!_0x21da69){_0x2dafbc[_0x535d('0x1e')](0x194);}return _0x21da69;};}function handleError(_0x5719cb,_0x39b057){_0x39b057=_0x39b057||0x1f4;return function(_0x4b41e0){logger[_0x535d('0x2c')](_0x4b41e0['stack']);if(_0x4b41e0[_0x535d('0x2d')]){delete _0x4b41e0[_0x535d('0x2d')];}_0x5719cb[_0x535d('0x25')](_0x39b057)[_0x535d('0x2e')](_0x4b41e0);};}exports[_0x535d('0x2f')]=function(_0x1c6de6,_0x95d112){var _0x4ab7e2={},_0x38598c={},_0x2f5a42={'count':0x0,'rows':[]};var _0x27582d=_[_0x535d('0x30')](db[_0x535d('0x31')][_0x535d('0x32')],function(_0x14db67){return{'name':_0x14db67['fieldName'],'type':_0x14db67[_0x535d('0x33')]['key']};});_0x38598c[_0x535d('0x34')]=_[_0x535d('0x30')](_0x27582d,'name');_0x38598c[_0x535d('0x35')]=_[_0x535d('0x36')](_0x1c6de6[_0x535d('0x35')]);_0x38598c[_0x535d('0x37')]=_[_0x535d('0x38')](_0x38598c[_0x535d('0x34')],_0x38598c[_0x535d('0x35')]);_0x4ab7e2['attributes']=_[_0x535d('0x38')](_0x38598c[_0x535d('0x34')],qs['fields'](_0x1c6de6[_0x535d('0x35')][_0x535d('0x39')]));_0x4ab7e2[_0x535d('0x3a')]=_0x4ab7e2[_0x535d('0x3a')][_0x535d('0x3b')]?_0x4ab7e2[_0x535d('0x3a')]:_0x38598c['model'];if(!_0x1c6de6[_0x535d('0x35')][_0x535d('0x3c')](_0x535d('0x3d'))){_0x4ab7e2[_0x535d('0x24')]=qs[_0x535d('0x24')](_0x1c6de6[_0x535d('0x35')][_0x535d('0x24')]);_0x4ab7e2[_0x535d('0x21')]=qs['offset'](_0x1c6de6[_0x535d('0x35')][_0x535d('0x21')]);}_0x4ab7e2[_0x535d('0x3e')]=qs[_0x535d('0x3f')](_0x1c6de6['query'][_0x535d('0x3f')]);_0x4ab7e2['where']=qs[_0x535d('0x37')](_[_0x535d('0x40')](_0x1c6de6[_0x535d('0x35')],_0x38598c[_0x535d('0x37')]),_0x27582d);if(_0x1c6de6['query'][_0x535d('0x41')]){_0x4ab7e2[_0x535d('0x42')]=_[_0x535d('0x43')](_0x4ab7e2[_0x535d('0x42')],{'$or':_[_0x535d('0x30')](_0x27582d,function(_0x484f89){if(_0x484f89[_0x535d('0x33')]!==_0x535d('0x44')){var _0x5d013d={};_0x5d013d[_0x484f89[_0x535d('0x2d')]]={'$like':'%'+_0x1c6de6[_0x535d('0x35')]['filter']+'%'};return _0x5d013d;}})});}_0x4ab7e2=_[_0x535d('0x43')]({},_0x4ab7e2,_0x1c6de6[_0x535d('0x45')]);var _0x380d34={'where':_0x4ab7e2[_0x535d('0x42')]};return db[_0x535d('0x31')][_0x535d('0x23')](_0x380d34)[_0x535d('0x2a')](function(_0x4122a0){_0x2f5a42[_0x535d('0x23')]=_0x4122a0;if(_0x1c6de6[_0x535d('0x35')][_0x535d('0x46')]){_0x4ab7e2[_0x535d('0x47')]=[{'all':!![]}];}return db[_0x535d('0x31')][_0x535d('0x48')](_0x4ab7e2);})[_0x535d('0x2a')](function(_0x5c13ec){_0x2f5a42[_0x535d('0x49')]=_0x5c13ec;return _0x2f5a42;})[_0x535d('0x2a')](respondWithFilteredResult(_0x95d112,_0x4ab7e2))[_0x535d('0x4a')](handleError(_0x95d112,null));};exports[_0x535d('0x4b')]=function(_0x257079,_0x1d8395){var _0x162fe8={'raw':!![],'where':{'id':_0x257079[_0x535d('0x4c')]['id']}},_0x48d91a={};_0x48d91a[_0x535d('0x34')]=_[_0x535d('0x36')](db[_0x535d('0x31')][_0x535d('0x32')]);_0x48d91a[_0x535d('0x35')]=_[_0x535d('0x36')](_0x257079[_0x535d('0x35')]);_0x48d91a[_0x535d('0x37')]=_[_0x535d('0x38')](_0x48d91a[_0x535d('0x34')],_0x48d91a[_0x535d('0x35')]);_0x162fe8[_0x535d('0x3a')]=_[_0x535d('0x38')](_0x48d91a[_0x535d('0x34')],qs['fields'](_0x257079['query'][_0x535d('0x39')]));_0x162fe8[_0x535d('0x3a')]=_0x162fe8[_0x535d('0x3a')][_0x535d('0x3b')]?_0x162fe8[_0x535d('0x3a')]:_0x48d91a[_0x535d('0x34')];if(_0x257079[_0x535d('0x35')]['includeAll']){_0x162fe8['include']=[{'all':!![]}];}_0x162fe8=_[_0x535d('0x43')]({},_0x162fe8,_0x257079[_0x535d('0x45')]);return db[_0x535d('0x31')][_0x535d('0x4d')](_0x162fe8)[_0x535d('0x2a')](handleEntityNotFound(_0x1d8395,null))['then'](respondWithResult(_0x1d8395,null))[_0x535d('0x4a')](handleError(_0x1d8395,null));};exports['create']=function(_0x35c730,_0x537e48){return db[_0x535d('0x31')][_0x535d('0x4e')](_0x35c730['body'],{})[_0x535d('0x2a')](respondWithResult(_0x537e48,0xc9))[_0x535d('0x4a')](handleError(_0x537e48,null));};exports[_0x535d('0x29')]=function(_0x1a82ac,_0x44c5ab){if(_0x1a82ac['body']['id']){delete _0x1a82ac['body']['id'];}return db[_0x535d('0x31')][_0x535d('0x4d')]({'where':{'id':_0x1a82ac[_0x535d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x44c5ab,null))[_0x535d('0x2a')](saveUpdates(_0x1a82ac[_0x535d('0x4f')],null))['then'](respondWithResult(_0x44c5ab,null))[_0x535d('0x4a')](handleError(_0x44c5ab,null));};exports[_0x535d('0x2b')]=function(_0xca192d,_0x3792d4){return db[_0x535d('0x31')][_0x535d('0x4d')]({'where':{'id':_0xca192d[_0x535d('0x4c')]['id']}})[_0x535d('0x2a')](handleEntityNotFound(_0x3792d4,null))[_0x535d('0x2a')](removeEntity(_0x3792d4,null))['catch'](handleError(_0x3792d4,null));};exports[_0x535d('0x50')]=function(_0x1e1d7f,_0xe7ff5c){return db[_0x535d('0x31')][_0x535d('0x50')]()[_0x535d('0x2a')](respondWithResult(_0xe7ff5c,null))['catch'](handleError(_0xe7ff5c,null));};exports[_0x535d('0x51')]=function(_0x3935ab,_0x5e15a2,_0x55cc3a){return db[_0x535d('0x52')]['count']({'where':{'ChatGroupId':_0x3935ab[_0x535d('0x4c')]['id'],'ToId':_0x3935ab[_0x535d('0x53')]['id'],'read':![]}})[_0x535d('0x2a')](function(_0xd79b26){return{'id':_[_0x535d('0x54')](_0x3935ab[_0x535d('0x4c')]['id']),'count':_0xd79b26};})[_0x535d('0x2a')](respondWithResult(_0x5e15a2,null))[_0x535d('0x4a')](handleError(_0x5e15a2,null));};exports[_0x535d('0x55')]=function(_0x4f624f,_0x2660b1,_0x226b62){return db['ChatGroup'][_0x535d('0x4d')]({'where':{'id':_0x4f624f[_0x535d('0x4c')]['id']}})[_0x535d('0x2a')](handleEntityNotFound(_0x2660b1,null))[_0x535d('0x2a')](function(_0x461532){if(_0x461532){return _0x461532[_0x535d('0x55')](_0x4f624f[_0x535d('0x4f')][_0x535d('0x56')],_[_0x535d('0x57')](_0x4f624f['body'],[_0x535d('0x56'),'id'])||{});}})[_0x535d('0x2a')](respondWithResult(_0x2660b1,null))[_0x535d('0x4a')](handleError(_0x2660b1,null));};exports[_0x535d('0x58')]=function(_0x3b0001,_0x5028f2,_0x5542fd){var _0x19679f={};var _0x36b1ad={};var _0x4e425c;var _0x5f09d7;return db[_0x535d('0x31')][_0x535d('0x59')]({'where':{'id':_0x3b0001[_0x535d('0x4c')]['id']}})[_0x535d('0x2a')](handleEntityNotFound(_0x5028f2,null))['then'](function(_0x32365e){if(_0x32365e){_0x4e425c=_0x32365e;_0x36b1ad['model']=_[_0x535d('0x36')](db[_0x535d('0x5a')][_0x535d('0x32')]);_0x36b1ad[_0x535d('0x35')]=_[_0x535d('0x36')](_0x3b0001['query']);_0x36b1ad['filters']=_[_0x535d('0x38')](_0x36b1ad['model'],_0x36b1ad[_0x535d('0x35')]);_0x19679f[_0x535d('0x3a')]=_['intersection'](_0x36b1ad[_0x535d('0x34')],qs[_0x535d('0x39')](_0x3b0001['query'][_0x535d('0x39')]));_0x19679f[_0x535d('0x3a')]=_0x19679f['attributes']['length']?_0x19679f[_0x535d('0x3a')]:_0x36b1ad[_0x535d('0x34')];_0x19679f[_0x535d('0x3e')]=qs[_0x535d('0x3f')](_0x3b0001['query']['sort']);_0x19679f['where']=qs[_0x535d('0x37')](_[_0x535d('0x40')](_0x3b0001['query'],_0x36b1ad[_0x535d('0x37')]));if(_0x3b0001[_0x535d('0x35')]['filter']){_0x19679f['where']=_[_0x535d('0x43')](_0x19679f[_0x535d('0x42')],{'$or':_['map'](_0x19679f[_0x535d('0x3a')],function(_0x2b7829){var _0x2ddcd8={};_0x2ddcd8[_0x2b7829]={'$like':'%'+_0x3b0001[_0x535d('0x35')][_0x535d('0x41')]+'%'};return _0x2ddcd8;})});}_0x19679f=_['merge']({},_0x19679f,_0x3b0001[_0x535d('0x45')]);return _0x4e425c[_0x535d('0x58')](_0x19679f);}})[_0x535d('0x2a')](function(_0x2c58de){if(_0x2c58de){_0x5f09d7=_0x2c58de[_0x535d('0x3b')];if(!_0x3b0001[_0x535d('0x35')][_0x535d('0x3c')](_0x535d('0x3d'))){_0x19679f['limit']=qs[_0x535d('0x24')](_0x3b0001['query'][_0x535d('0x24')]);_0x19679f['offset']=qs[_0x535d('0x21')](_0x3b0001[_0x535d('0x35')][_0x535d('0x21')]);}return _0x4e425c[_0x535d('0x58')](_0x19679f);}})[_0x535d('0x2a')](function(_0xc7bb53){if(_0xc7bb53){return _0xc7bb53?{'count':_0x5f09d7,'rows':_0xc7bb53}:null;}})[_0x535d('0x2a')](respondWithResult(_0x5028f2,null))[_0x535d('0x4a')](handleError(_0x5028f2,null));};exports[_0x535d('0x5b')]=function(_0x22cd76,_0x5c35a5,_0x3f19dd){return db['ChatGroup']['find']({'where':{'id':_0x22cd76[_0x535d('0x4c')]['id']}})[_0x535d('0x2a')](handleEntityNotFound(_0x5c35a5,null))[_0x535d('0x2a')](function(_0x95e724){if(_0x95e724){return _0x95e724[_0x535d('0x5b')](_0x22cd76[_0x535d('0x35')][_0x535d('0x56')]);}})[_0x535d('0x2a')](respondWithStatusCode(_0x5c35a5,null))[_0x535d('0x4a')](handleError(_0x5c35a5,null));};exports[_0x535d('0x5c')]=function(_0x44ca49,_0x2081ea,_0x3f477a){if(_0x44ca49[_0x535d('0x4f')]['id']){delete _0x44ca49[_0x535d('0x4f')]['id'];}return db[_0x535d('0x31')][_0x535d('0x4d')]({'where':{'id':_0x44ca49[_0x535d('0x4c')]['id']}})[_0x535d('0x2a')](handleEntityNotFound(_0x2081ea,null))['then'](function(_0x72c3d3){if(_0x72c3d3){_0x44ca49['body'][_0x535d('0x5d')]=_0x72c3d3['id'];return db[_0x535d('0x52')][_0x535d('0x4e')](_0x44ca49[_0x535d('0x4f')]);}})[_0x535d('0x2a')](respondWithResult(_0x2081ea,null))[_0x535d('0x4a')](handleError(_0x2081ea,null));};exports[_0x535d('0x5e')]=function(_0x39e148,_0x29f6a7,_0x112c1b){var _0x43f9e8={};var _0x120f05={};var _0x5bbc91;var _0x3871da;return db[_0x535d('0x31')][_0x535d('0x59')]({'where':{'id':_0x39e148[_0x535d('0x4c')]['id']}})[_0x535d('0x2a')](handleEntityNotFound(_0x29f6a7,null))[_0x535d('0x2a')](function(_0x1a3f8c){if(_0x1a3f8c){_0x5bbc91=_0x1a3f8c;_0x120f05[_0x535d('0x34')]=_[_0x535d('0x36')](db['ChatInternalMessage'][_0x535d('0x32')]);_0x120f05[_0x535d('0x35')]=_['keys'](_0x39e148[_0x535d('0x35')]);_0x120f05[_0x535d('0x37')]=_[_0x535d('0x38')](_0x120f05['model'],_0x120f05[_0x535d('0x35')]);_0x43f9e8[_0x535d('0x3a')]=_[_0x535d('0x38')](_0x120f05[_0x535d('0x34')],qs[_0x535d('0x39')](_0x39e148[_0x535d('0x35')][_0x535d('0x39')]));_0x43f9e8[_0x535d('0x3a')]=_0x43f9e8[_0x535d('0x3a')][_0x535d('0x3b')]?_0x43f9e8['attributes']:_0x120f05[_0x535d('0x34')];_0x43f9e8['order']=qs['sort'](_0x39e148[_0x535d('0x35')]['sort']);_0x43f9e8[_0x535d('0x42')]=qs[_0x535d('0x37')](_[_0x535d('0x40')](_0x39e148['query'],_0x120f05[_0x535d('0x37')]));if(_0x39e148['query'][_0x535d('0x41')]){_0x43f9e8[_0x535d('0x42')]=_[_0x535d('0x43')](_0x43f9e8['where'],{'$or':_[_0x535d('0x30')](_0x43f9e8['attributes'],function(_0x2a977e){var _0x59f497={};_0x59f497[_0x2a977e]={'$like':'%'+_0x39e148[_0x535d('0x35')][_0x535d('0x41')]+'%'};return _0x59f497;})});}if(_0x39e148[_0x535d('0x35')][_0x535d('0x5f')]){var _0x38bbaa=_0x39e148[_0x535d('0x35')][_0x535d('0x5f')][_0x535d('0x60')](',');var _0x515144={};_0x515144[_0x38bbaa[0x0]]={'$gte':moment(_0x38bbaa[0x1])[_0x535d('0x61')](_0x535d('0x62'))};_0x43f9e8[_0x535d('0x42')]=_['merge'](_0x43f9e8[_0x535d('0x42')],_0x515144);}_0x43f9e8=_['merge']({},_0x43f9e8,_0x39e148[_0x535d('0x45')]);return _0x5bbc91[_0x535d('0x5e')](_0x43f9e8);}})[_0x535d('0x2a')](function(_0x325620){if(_0x325620){_0x3871da=_0x325620[_0x535d('0x3b')];if(!_0x39e148[_0x535d('0x35')]['hasOwnProperty']('nolimit')){_0x43f9e8[_0x535d('0x24')]=qs[_0x535d('0x24')](_0x39e148[_0x535d('0x35')][_0x535d('0x24')]);_0x43f9e8[_0x535d('0x21')]=qs[_0x535d('0x21')](_0x39e148[_0x535d('0x35')][_0x535d('0x21')]);}return _0x5bbc91[_0x535d('0x5e')](_0x43f9e8);}})[_0x535d('0x2a')](function(_0xee1691){if(_0xee1691){return _0xee1691?{'count':_0x3871da,'rows':_0xee1691}:null;}})[_0x535d('0x2a')](respondWithResult(_0x29f6a7,null))[_0x535d('0x4a')](handleError(_0x29f6a7,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index dd21e0f..9f3d678 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 _0xb3f9=['emit','hook','exports','events','../../mysqldb','save','remove'];(function(_0x537cf8,_0x1eb921){var _0x1f7d47=function(_0x5a52aa){while(--_0x5a52aa){_0x537cf8['push'](_0x537cf8['shift']());}};_0x1f7d47(++_0x1eb921);}(_0xb3f9,0x7a));var _0x9b3f=function(_0xb720a2,_0x474f32){_0xb720a2=_0xb720a2-0x0;var _0xd3695f=_0xb3f9[_0xb720a2];return _0xd3695f;};'use strict';var EventEmitter=require(_0x9b3f('0x0'));var ChatGroup=require(_0x9b3f('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9b3f('0x2'),'afterUpdate':'update','afterDestroy':_0x9b3f('0x3')};function emitEvent(_0x361db7){return function(_0x35fd0b,_0xa9df41,_0x227cca){ChatGroupEvents[_0x9b3f('0x4')](_0x361db7+':'+_0x35fd0b['id'],_0x35fd0b);ChatGroupEvents['emit'](_0x361db7,_0x35fd0b);_0x227cca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x9b3f('0x5')](e,emitEvent(event));}}module[_0x9b3f('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0x42bd=['events','ChatGroup','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x4c3b19,_0x31ccfe){var _0x5f0e89=function(_0x4c7778){while(--_0x4c7778){_0x4c3b19['push'](_0x4c3b19['shift']());}};_0x5f0e89(++_0x31ccfe);}(_0x42bd,0x198));var _0xd42b=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x42bd[_0x13d07a];return _0x5ee0ee;};'use strict';var EventEmitter=require(_0xd42b('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xd42b('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd42b('0x2')](0x0);var events={'afterCreate':_0xd42b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4f4911){return function(_0x704f48,_0x43efff,_0x1907b4){ChatGroupEvents[_0xd42b('0x4')](_0x4f4911+':'+_0x704f48['id'],_0x704f48);ChatGroupEvents[_0xd42b('0x4')](_0x4f4911,_0x704f48);_0x1907b4(null);};}for(var e in events){if(events[_0xd42b('0x5')](e)){var event=events[e];ChatGroup[_0xd42b('0x6')](e,emitEvent(event));}}module[_0xd42b('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 01c4c38..0ac009a 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 _0xe80f=['request-promise','path','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','api','moment','bluebird'];(function(_0x5a9d8c,_0x5de60d){var _0x2456f1=function(_0x5b2b15){while(--_0x5b2b15){_0x5a9d8c['push'](_0x5a9d8c['shift']());}};_0x2456f1(++_0x5de60d);}(_0xe80f,0x74));var _0xfe80=function(_0x153249,_0x120e2e){_0x153249=_0x153249-0x0;var _0x22bc34=_0xe80f[_0x153249];return _0x22bc34;};'use strict';var _=require('lodash');var util=require(_0xfe80('0x0'));var logger=require('../../config/logger')(_0xfe80('0x1'));var moment=require(_0xfe80('0x2'));var BPromise=require(_0xfe80('0x3'));var rp=require(_0xfe80('0x4'));var fs=require('fs');var path=require(_0xfe80('0x5'));var rimraf=require('rimraf');var config=require(_0xfe80('0x6'));var attributes=require(_0xfe80('0x7'));module[_0xfe80('0x8')]=function(_0x4364b2,_0x3bef48){return _0x4364b2[_0xfe80('0x9')](_0xfe80('0xa'),attributes,{'tableName':_0xfe80('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e87=['request-promise','../../config/environment','./chatGroup.attributes','exports','define','chat_groups','lodash','../../config/logger','api','moment','bluebird'];(function(_0x555cd0,_0x3b9867){var _0x403c3c=function(_0x128f9a){while(--_0x128f9a){_0x555cd0['push'](_0x555cd0['shift']());}};_0x403c3c(++_0x3b9867);}(_0x3e87,0xa0));var _0x73e8=function(_0x5cfa70,_0x10dd3f){_0x5cfa70=_0x5cfa70-0x0;var _0x4f11db=_0x3e87[_0x5cfa70];return _0x4f11db;};'use strict';var _=require(_0x73e8('0x0'));var util=require('util');var logger=require(_0x73e8('0x1'))(_0x73e8('0x2'));var moment=require(_0x73e8('0x3'));var BPromise=require(_0x73e8('0x4'));var rp=require(_0x73e8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x73e8('0x6'));var attributes=require(_0x73e8('0x7'));module[_0x73e8('0x8')]=function(_0x2a3e19,_0x3796b8){return _0x2a3e19[_0x73e8('0x9')]('ChatGroup',attributes,{'tableName':_0x73e8('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 06c75d0..e97cdd5 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 _0x28aa=['defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x48a51c,_0x3a4e38){var _0x5a2aa4=function(_0x539df8){while(--_0x539df8){_0x48a51c['push'](_0x48a51c['shift']());}};_0x5a2aa4(++_0x3a4e38);}(_0x28aa,0xf8));var _0xa28a=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x28aa[_0x187ee1];return _0x388160;};'use strict';var _=require('lodash');var util=require(_0xa28a('0x0'));var moment=require(_0xa28a('0x1'));var BPromise=require(_0xa28a('0x2'));var rs=require(_0xa28a('0x3'));var fs=require('fs');var Redis=require(_0xa28a('0x4'));var db=require(_0xa28a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa28a('0x6'))(_0xa28a('0x7'));var config=require(_0xa28a('0x8'));var jayson=require(_0xa28a('0x9'));var client=jayson['client'][_0xa28a('0xa')]({'port':0x232a});config[_0xa28a('0xb')]=_[_0xa28a('0xc')](config[_0xa28a('0xb')],{'host':_0xa28a('0xd'),'port':0x18eb});var socket=require(_0xa28a('0xe'))(new Redis(config[_0xa28a('0xb')]));require(_0xa28a('0xf'))[_0xa28a('0x10')](socket);function respondWithRpcPromise(_0x1caf6b,_0x3e8701,_0xc23755){return new BPromise(function(_0x19a508,_0x899bad){return client[_0xa28a('0x11')](_0x1caf6b,_0xc23755)['then'](function(_0x1c223c){logger[_0xa28a('0x12')](_0xa28a('0x13'),_0x3e8701,_0xa28a('0x14'));logger['debug'](_0xa28a('0x15'),_0x3e8701,_0xa28a('0x14'),JSON['stringify'](_0x1c223c));if(_0x1c223c[_0xa28a('0x16')]){if(_0x1c223c[_0xa28a('0x16')][_0xa28a('0x17')]===0x1f4){logger[_0xa28a('0x16')](_0xa28a('0x13'),_0x3e8701,_0x1c223c[_0xa28a('0x16')][_0xa28a('0x18')]);return _0x899bad(_0x1c223c[_0xa28a('0x16')][_0xa28a('0x18')]);}logger[_0xa28a('0x16')]('ChatGroup,\x20%s,\x20%s',_0x3e8701,_0x1c223c[_0xa28a('0x16')][_0xa28a('0x18')]);return _0x19a508(_0x1c223c[_0xa28a('0x16')]['message']);}else{logger[_0xa28a('0x12')](_0xa28a('0x13'),_0x3e8701,_0xa28a('0x14'));_0x19a508(_0x1c223c[_0xa28a('0x19')][_0xa28a('0x18')]);}})['catch'](function(_0x48093b){logger[_0xa28a('0x16')]('ChatGroup,\x20%s,\x20%s',_0x3e8701,_0x48093b);_0x899bad(_0x48093b);});});} \ No newline at end of file +var _0xc978=['request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register'];(function(_0x25b711,_0x41f545){var _0x4d6db8=function(_0x518ce3){while(--_0x518ce3){_0x25b711['push'](_0x25b711['shift']());}};_0x4d6db8(++_0x41f545);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var moment=require(_0x8c97('0x2'));var BPromise=require(_0x8c97('0x3'));var rs=require(_0x8c97('0x4'));var fs=require('fs');var Redis=require(_0x8c97('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c97('0x6'));var logger=require(_0x8c97('0x7'))(_0x8c97('0x8'));var config=require(_0x8c97('0x9'));var jayson=require(_0x8c97('0xa'));var client=jayson[_0x8c97('0xb')][_0x8c97('0xc')]({'port':0x232a});config['redis']=_[_0x8c97('0xd')](config[_0x8c97('0xe')],{'host':_0x8c97('0xf'),'port':0x18eb});var socket=require(_0x8c97('0x10'))(new Redis(config[_0x8c97('0xe')]));require(_0x8c97('0x11'))[_0x8c97('0x12')](socket);function respondWithRpcPromise(_0x4f2d78,_0x179342,_0x1234d4){return new BPromise(function(_0x1befaf,_0x3a34b2){return client[_0x8c97('0x13')](_0x4f2d78,_0x1234d4)[_0x8c97('0x14')](function(_0x1e8182){logger[_0x8c97('0x15')](_0x8c97('0x16'),_0x179342,'request\x20sent');logger[_0x8c97('0x17')](_0x8c97('0x18'),_0x179342,'request\x20sent',JSON[_0x8c97('0x19')](_0x1e8182));if(_0x1e8182[_0x8c97('0x1a')]){if(_0x1e8182['error'][_0x8c97('0x1b')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x179342,_0x1e8182['error'][_0x8c97('0x1c')]);return _0x3a34b2(_0x1e8182[_0x8c97('0x1a')][_0x8c97('0x1c')]);}logger[_0x8c97('0x1a')](_0x8c97('0x16'),_0x179342,_0x1e8182[_0x8c97('0x1a')][_0x8c97('0x1c')]);return _0x1befaf(_0x1e8182[_0x8c97('0x1a')][_0x8c97('0x1c')]);}else{logger['info'](_0x8c97('0x16'),_0x179342,_0x8c97('0x1d'));_0x1befaf(_0x1e8182[_0x8c97('0x1e')][_0x8c97('0x1c')]);}})[_0x8c97('0x1f')](function(_0x1445db){logger[_0x8c97('0x1a')](_0x8c97('0x16'),_0x179342,_0x1445db);_0x3a34b2(_0x1445db);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index d222cdf..ebe78eb 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 _0x99ad=['chatGroup:','./chatGroup.events','save','update','emit','removeListener','length'];(function(_0x19e4f2,_0x31c245){var _0x324d10=function(_0x319ed8){while(--_0x319ed8){_0x19e4f2['push'](_0x19e4f2['shift']());}};_0x324d10(++_0x31c245);}(_0x99ad,0xcc));var _0xd99a=function(_0x473e5b,_0x3bcabd){_0x473e5b=_0x473e5b-0x0;var _0x33d13f=_0x99ad[_0x473e5b];return _0x33d13f;};'use strict';var ChatGroupEvents=require(_0xd99a('0x0'));var events=[_0xd99a('0x1'),'remove',_0xd99a('0x2')];function createListener(_0x512f62,_0x863d51){return function(_0x4e9281){_0x863d51[_0xd99a('0x3')](_0x512f62,_0x4e9281);};}function removeListener(_0x25eee0,_0x424d8d){return function(){ChatGroupEvents[_0xd99a('0x4')](_0x25eee0,_0x424d8d);};}exports['register']=function(_0x1e8a7f){for(var _0x2612ff=0x0,_0x4477c4=events[_0xd99a('0x5')];_0x2612ff<_0x4477c4;_0x2612ff++){var _0x1b983f=events[_0x2612ff];var _0x1807c9=createListener(_0xd99a('0x6')+_0x1b983f,_0x1e8a7f);ChatGroupEvents['on'](_0x1b983f,_0x1807c9);}}; \ No newline at end of file +var _0x2373=['remove','update','removeListener','register','length','chatGroup:','./chatGroup.events','save'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x2373,0x1ae));var _0x3237=function(_0xebec04,_0x4adc2d){_0xebec04=_0xebec04-0x0;var _0x5393d2=_0x2373[_0xebec04];return _0x5393d2;};'use strict';var ChatGroupEvents=require(_0x3237('0x0'));var events=[_0x3237('0x1'),_0x3237('0x2'),_0x3237('0x3')];function createListener(_0x31e7cd,_0x37285f){return function(_0x2aef04){_0x37285f['emit'](_0x31e7cd,_0x2aef04);};}function removeListener(_0x49c77c,_0x25e7df){return function(){ChatGroupEvents[_0x3237('0x4')](_0x49c77c,_0x25e7df);};}exports[_0x3237('0x5')]=function(_0x32cf73){for(var _0x41998f=0x0,_0x4eb347=events[_0x3237('0x6')];_0x41998f<_0x4eb347;_0x41998f++){var _0x28c919=events[_0x41998f];var _0x20c7d6=createListener(_0x3237('0x7')+_0x28c919,_0x32cf73);ChatGroupEvents['on'](_0x28c919,_0x20c7d6);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index bf8f62a..913f6ca 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 _0xaafe=['exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','getMessages','post','create','addMembers','/:id/messages','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaafe,0x187));var _0xeaaf=function(_0x5c4f15,_0x3301d0){_0x5c4f15=_0x5c4f15-0x0;var _0x375517=_0xaafe[_0x5c4f15];return _0x375517;};'use strict';var multer=require('multer');var util=require(_0xeaaf('0x0'));var path=require(_0xeaaf('0x1'));var timeout=require('connect-timeout');var express=require(_0xeaaf('0x2'));var router=express['Router']();var fs_extra=require(_0xeaaf('0x3'));var auth=require(_0xeaaf('0x4'));var interaction=require(_0xeaaf('0x5'));var config=require(_0xeaaf('0x6'));var controller=require(_0xeaaf('0x7'));router[_0xeaaf('0x8')]('/',auth[_0xeaaf('0x9')](),controller['index']);router[_0xeaaf('0x8')]('/describe',auth[_0xeaaf('0x9')](),controller[_0xeaaf('0xa')]);router['get'](_0xeaaf('0xb'),auth[_0xeaaf('0x9')](),controller[_0xeaaf('0xc')]);router[_0xeaaf('0x8')](_0xeaaf('0xd'),auth[_0xeaaf('0x9')](),controller[_0xeaaf('0xe')]);router[_0xeaaf('0x8')](_0xeaaf('0xf'),auth[_0xeaaf('0x9')](),controller[_0xeaaf('0x10')]);router[_0xeaaf('0x8')]('/:id/messages',auth[_0xeaaf('0x9')](),controller[_0xeaaf('0x11')]);router[_0xeaaf('0x12')]('/',auth['isAuthenticated'](),controller[_0xeaaf('0x13')]);router['post'](_0xeaaf('0xf'),auth['isAuthenticated'](),controller[_0xeaaf('0x14')]);router[_0xeaaf('0x12')](_0xeaaf('0x15'),auth[_0xeaaf('0x9')](),controller['addMessage']);router[_0xeaaf('0x16')](_0xeaaf('0xb'),auth[_0xeaaf('0x9')](),controller[_0xeaaf('0x17')]);router[_0xeaaf('0x18')](_0xeaaf('0xb'),auth[_0xeaaf('0x9')](),controller['destroy']);router[_0xeaaf('0x18')]('/:id/members',auth[_0xeaaf('0x9')](),controller['removeMembers']);module[_0xeaaf('0x19')]=router; \ No newline at end of file +var _0xe942=['destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMessage','update','delete'];(function(_0x539579,_0x5e97ee){var _0x2612ae=function(_0x117b2d){while(--_0x117b2d){_0x539579['push'](_0x539579['shift']());}};_0x2612ae(++_0x5e97ee);}(_0xe942,0x6f));var _0x2e94=function(_0x4818c3,_0x3b2737){_0x4818c3=_0x4818c3-0x0;var _0x1f4004=_0xe942[_0x4818c3];return _0x1f4004;};'use strict';var multer=require(_0x2e94('0x0'));var util=require(_0x2e94('0x1'));var path=require(_0x2e94('0x2'));var timeout=require(_0x2e94('0x3'));var express=require(_0x2e94('0x4'));var router=express[_0x2e94('0x5')]();var fs_extra=require(_0x2e94('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2e94('0x7'));var config=require(_0x2e94('0x8'));var controller=require(_0x2e94('0x9'));router[_0x2e94('0xa')]('/',auth[_0x2e94('0xb')](),controller['index']);router[_0x2e94('0xa')]('/describe',auth[_0x2e94('0xb')](),controller['describe']);router[_0x2e94('0xa')](_0x2e94('0xc'),auth[_0x2e94('0xb')](),controller[_0x2e94('0xd')]);router[_0x2e94('0xa')](_0x2e94('0xe'),auth['isAuthenticated'](),controller[_0x2e94('0xf')]);router[_0x2e94('0xa')](_0x2e94('0x10'),auth[_0x2e94('0xb')](),controller[_0x2e94('0x11')]);router[_0x2e94('0xa')](_0x2e94('0x12'),auth[_0x2e94('0xb')](),controller['getMessages']);router[_0x2e94('0x13')]('/',auth[_0x2e94('0xb')](),controller[_0x2e94('0x14')]);router[_0x2e94('0x13')](_0x2e94('0x10'),auth[_0x2e94('0xb')](),controller['addMembers']);router['post'](_0x2e94('0x12'),auth[_0x2e94('0xb')](),controller[_0x2e94('0x15')]);router['put'](_0x2e94('0xc'),auth[_0x2e94('0xb')](),controller[_0x2e94('0x16')]);router[_0x2e94('0x17')](_0x2e94('0xc'),auth['isAuthenticated'](),controller[_0x2e94('0x18')]);router['delete']('/:id/members',auth[_0x2e94('0xb')](),controller[_0x2e94('0x19')]);module[_0x2e94('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 33af433..c0e7404 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 _0xe6a1=['exports','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out','BOOLEAN','sequelize'];(function(_0x5e7c90,_0x3d72b3){var _0x4e4b8d=function(_0x3a5b62){while(--_0x3a5b62){_0x5e7c90['push'](_0x5e7c90['shift']());}};_0x4e4b8d(++_0x3d72b3);}(_0xe6a1,0x143));var _0x1e6a=function(_0xac90da,_0x4e6732){_0xac90da=_0xac90da-0x0;var _0x372562=_0xe6a1[_0xac90da];return _0x372562;};'use strict';var Sequelize=require(_0x1e6a('0x0'));module[_0x1e6a('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1e6a('0x2')]},'ratingType':{'type':Sequelize[_0x1e6a('0x3')](_0x1e6a('0x4'),_0x1e6a('0x5')),'defaultValue':_0x1e6a('0x4')},'ratingMessage':{'type':Sequelize[_0x1e6a('0x6')]},'pathTranscript':{'type':Sequelize[_0x1e6a('0x6')]},'mailTranscript':{'type':Sequelize[_0x1e6a('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1e6a('0x8')]},'disposition':{'type':Sequelize[_0x1e6a('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1e6a('0x7')]},'note':{'type':Sequelize[_0x1e6a('0x7')]},'browserName':{'type':Sequelize[_0x1e6a('0x7')]},'browserVersion':{'type':Sequelize[_0x1e6a('0x7')]},'osName':{'type':Sequelize[_0x1e6a('0x7')]},'osVersion':{'type':Sequelize[_0x1e6a('0x7')]},'deviceModel':{'type':Sequelize[_0x1e6a('0x7')]},'deviceVendor':{'type':Sequelize[_0x1e6a('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x1e6a('0x7')]},'formData':{'type':Sequelize[_0x1e6a('0x6')](_0x1e6a('0x9'))},'read1stAt':{'type':Sequelize[_0x1e6a('0x8')]},'lastMsgAt':{'type':Sequelize[_0x1e6a('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x1e6a('0x3')]('in',_0x1e6a('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1e6a('0x7')]},'customerPort':{'type':Sequelize[_0x1e6a('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x1e6a('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x1e6a('0xb')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x1e6a('0x2')]}}; \ No newline at end of file +var _0x090c=['thumb','TEXT','DATE','STRING','long','out','sequelize','BOOLEAN','INTEGER','ENUM','star'];(function(_0xe8ab4f,_0x119c37){var _0x507748=function(_0x18b4f9){while(--_0x18b4f9){_0xe8ab4f['push'](_0xe8ab4f['shift']());}};_0x507748(++_0x119c37);}(_0x090c,0x19d));var _0xc090=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0x090c[_0x381379];return _0x3e1063;};'use strict';var Sequelize=require(_0xc090('0x0'));module['exports']={'closed':{'type':Sequelize[_0xc090('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc090('0x2')]},'ratingType':{'type':Sequelize[_0xc090('0x3')](_0xc090('0x4'),_0xc090('0x5')),'defaultValue':_0xc090('0x4')},'ratingMessage':{'type':Sequelize[_0xc090('0x6')]},'pathTranscript':{'type':Sequelize[_0xc090('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc090('0x7')]},'disposition':{'type':Sequelize[_0xc090('0x8')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc090('0x8')]},'browserName':{'type':Sequelize[_0xc090('0x8')]},'browserVersion':{'type':Sequelize[_0xc090('0x8')]},'osName':{'type':Sequelize[_0xc090('0x8')]},'osVersion':{'type':Sequelize[_0xc090('0x8')]},'deviceModel':{'type':Sequelize[_0xc090('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xc090('0x8')]},'referer':{'type':Sequelize[_0xc090('0x6')]},'customerIp':{'type':Sequelize[_0xc090('0x8')]},'formData':{'type':Sequelize[_0xc090('0x6')](_0xc090('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc090('0x3')]('in',_0xc090('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xc090('0x8')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index a4817c8..808aca3 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 _0xf007=['contact','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','vidaooMetadata','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','UserId','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','file','originalname','filename','mimetype','Attachment','attachmentDownload','Unauthorized','join','offline-chat/','basename','download','close','root','server/files/chat/upload/','format','transcript-%s.txt','Messages','User','CmContact','ContactId','%s%d','customer','agentIdentifier','website_alias','agentAlias','System','agent_alias','alias','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','hasOwnProperty','nolimit','sort','where','filters','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','rows','getMyMessages','order','secret','includeAgent','push','addTags','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','toString','server','tmp','files','attachments','transcript-%d-%s.zip','firstName','lastName','read','Owner','get','mkdirSync','Chat','Account','N.A.','closedAt','browserName','osName','referer','customerPort','tail','createReadStream','pipe','createWriteStream','value','renderFile','transcript-','err','unlinkSync','rimraf','zip-dir','request-promise','bluebird','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','request','then','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','stack','name','send','render','merge','body','agent','interaction','account','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','user','show','params','model','keys','query','intersection','fields','attributes','length','options','find','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','fullname','email'];(function(_0x62396d,_0x1ad1ba){var _0x49db3e=function(_0x4ef041){while(--_0x4ef041){_0x62396d['push'](_0x62396d['shift']());}};_0x49db3e(++_0x1ad1ba);}(_0xf007,0x153));var _0x7f00=function(_0x2c0557,_0x4314fd){_0x2c0557=_0x2c0557-0x0;var _0x2878cd=_0xf007[_0x2c0557];return _0x2878cd;};'use strict';var rimraf=require(_0x7f00('0x0'));var zipdir=require(_0x7f00('0x1'));var rp=require(_0x7f00('0x2'));var moment=require('moment');var BPromise=require(_0x7f00('0x3'));var Mustache=require('mustache');var util=require(_0x7f00('0x4'));var path=require('path');var ejs=require(_0x7f00('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x7f00('0x6'));var interaction=require(_0x7f00('0x7'));var qs=require(_0x7f00('0x8'));var pdf=require(_0x7f00('0x9'));var logger=require('../../config/logger')(_0x7f00('0xa'));var config=require('../../config/environment');var db=require(_0x7f00('0xb'))['db'];config[_0x7f00('0xc')]=_[_0x7f00('0xd')](config[_0x7f00('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7f00('0xe'))(new Redis(config[_0x7f00('0xc')]));require(_0x7f00('0xf'))['register'](socket);var jayson=require(_0x7f00('0x10'));var client=jayson[_0x7f00('0x11')]['http']({'port':0x232b});var client9004=jayson[_0x7f00('0x11')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1f0f76,_0xbf8b9f,_0x418920,_0x106e98){return new BPromise(function(_0x365ba1,_0x393566){var _0x290f65=_0x106e98||client;return _0x290f65[_0x7f00('0x12')](_0x1f0f76,_0x418920)[_0x7f00('0x13')](function(_0x139253){logger['info']('ChatInteraction,\x20%s,\x20%s',_0xbf8b9f,'request\x20sent');logger[_0x7f00('0x14')](_0x7f00('0x15'),_0xbf8b9f,_0x7f00('0x16'),JSON[_0x7f00('0x17')](_0x139253));if(_0x139253['error']){if(_0x139253[_0x7f00('0x18')]['code']===0x1f4){logger[_0x7f00('0x18')](_0x7f00('0x19'),_0xbf8b9f,_0x139253[_0x7f00('0x18')][_0x7f00('0x1a')]);return _0x393566(_0x139253[_0x7f00('0x18')][_0x7f00('0x1a')]);}logger[_0x7f00('0x18')]('ChatInteraction,\x20%s,\x20%s',_0xbf8b9f,_0x139253[_0x7f00('0x18')][_0x7f00('0x1a')]);return _0x365ba1(_0x139253['error'][_0x7f00('0x1a')]);}else{logger['info'](_0x7f00('0x19'),_0xbf8b9f,_0x7f00('0x16'));_0x365ba1(_0x139253[_0x7f00('0x1b')][_0x7f00('0x1a')]);}})[_0x7f00('0x1c')](function(_0x1f83fb){logger[_0x7f00('0x18')](_0x7f00('0x19'),_0xbf8b9f,_0x1f83fb);_0x393566(_0x1f83fb);});});}function respondWithStatusCode(_0x33fd62,_0x4f0b29){_0x4f0b29=_0x4f0b29||0xcc;return function(_0x28e8b5){if(_0x28e8b5){return _0x33fd62['sendStatus'](_0x4f0b29);}return _0x33fd62[_0x7f00('0x1d')](_0x4f0b29)[_0x7f00('0x1e')]();};}function respondWithResult(_0x381153,_0x301180){_0x301180=_0x301180||0xc8;return function(_0x1f1f9b){if(_0x1f1f9b){return _0x381153['status'](_0x301180)['json'](_0x1f1f9b);}};}function respondWithFilteredResult(_0x37edf1,_0x14a2e0){return function(_0x7c46c1){if(_0x7c46c1){var _0x1f3b21=typeof _0x14a2e0[_0x7f00('0x1f')]===_0x7f00('0x20')&&typeof _0x14a2e0[_0x7f00('0x21')]===_0x7f00('0x20');var _0x37a30f=_0x7c46c1[_0x7f00('0x22')];var _0x3098dd=_0x1f3b21?0x0:_0x14a2e0['offset'];var _0x34df53=_0x1f3b21?_0x7c46c1['count']:_0x14a2e0[_0x7f00('0x1f')]+_0x14a2e0['limit'];var _0x6ac93b;if(_0x34df53>=_0x37a30f){_0x34df53=_0x37a30f;_0x6ac93b=0xc8;}else{_0x6ac93b=0xce;}_0x37edf1['status'](_0x6ac93b);return _0x37edf1[_0x7f00('0x23')](_0x7f00('0x24'),_0x3098dd+'-'+_0x34df53+'/'+_0x37a30f)[_0x7f00('0x25')](_0x7c46c1);}return null;};}function saveUpdates(_0x551fa0){return function(_0x5b300c){if(_0x5b300c){return _0x5b300c[_0x7f00('0x26')](_0x551fa0)['then'](function(_0x1bf67b){return _0x1bf67b;});}return null;};}function removeEntity(_0x5622a5){return function(_0x2e732a){if(_0x2e732a){return _0x2e732a[_0x7f00('0x27')]()[_0x7f00('0x13')](function(){_0x5622a5[_0x7f00('0x1d')](0xcc)[_0x7f00('0x1e')]();});}};}function handleEntityNotFound(_0x4d1d10){return function(_0xd6a9b6){if(!_0xd6a9b6){_0x4d1d10['sendStatus'](0x194);}return _0xd6a9b6;};}function handleError(_0x3d214f,_0x5a0922){_0x5a0922=_0x5a0922||0x1f4;return function(_0x53597c){logger[_0x7f00('0x18')](_0x53597c[_0x7f00('0x28')]);if(_0x53597c['name']){delete _0x53597c[_0x7f00('0x29')];}_0x3d214f[_0x7f00('0x1d')](_0x5a0922)[_0x7f00('0x2a')](_0x53597c);};}function getMustacheRender(_0x139090,_0x4ebd74){return Mustache[_0x7f00('0x2b')](_0x139090,_[_0x7f00('0x2c')](_0x4ebd74[_0x7f00('0x2d')],{'contact':_0x4ebd74['contact'],'message':_0x4ebd74['message'],'agent':_0x4ebd74[_0x7f00('0x2e')],'interaction':_0x4ebd74[_0x7f00('0x2f')],'account':_0x4ebd74[_0x7f00('0x30')]}))||'';}exports['index']=function(_0x587abf,_0x133874){var _0x1efca5={};var _0x26fa3b=_[_0x7f00('0x31')](db[_0x7f00('0x32')][_0x7f00('0x33')],function(_0x123800){return{'name':_0x123800[_0x7f00('0x34')],'type':_0x123800[_0x7f00('0x35')][_0x7f00('0x36')]};});_0x1efca5=qs[_0x7f00('0x37')](_0x26fa3b,_0x587abf);return interaction['findAll']('chat',_0x587abf['query'],_0x587abf[_0x7f00('0x38')],_0x1efca5,_0x26fa3b)['then'](respondWithFilteredResult(_0x133874,_0x1efca5))['catch'](handleError(_0x133874,null));};exports[_0x7f00('0x39')]=function(_0x6c94b1,_0x2cc07b){var _0x500555={'raw':![],'where':{'id':_0x6c94b1[_0x7f00('0x3a')]['id']}},_0x698f23={};_0x698f23[_0x7f00('0x3b')]=_[_0x7f00('0x3c')](db['ChatInteraction']['rawAttributes']);_0x698f23[_0x7f00('0x3d')]=_[_0x7f00('0x3c')](_0x6c94b1[_0x7f00('0x3d')]);_0x698f23['filters']=_[_0x7f00('0x3e')](_0x698f23[_0x7f00('0x3b')],_0x698f23[_0x7f00('0x3d')]);_0x500555['attributes']=_[_0x7f00('0x3e')](_0x698f23[_0x7f00('0x3b')],qs[_0x7f00('0x3f')](_0x6c94b1[_0x7f00('0x3d')][_0x7f00('0x3f')]));_0x500555[_0x7f00('0x40')]=_0x500555[_0x7f00('0x40')][_0x7f00('0x41')]?_0x500555[_0x7f00('0x40')]:_0x698f23[_0x7f00('0x3b')];if(_0x6c94b1[_0x7f00('0x3d')]['includeAll']){_0x500555['include']=[{'all':!![]}];}_0x500555=_[_0x7f00('0x2c')]({},_0x500555,_0x6c94b1[_0x7f00('0x42')]);return db[_0x7f00('0x32')][_0x7f00('0x43')](_0x500555)['then'](handleEntityNotFound(_0x2cc07b,null))[_0x7f00('0x13')](respondWithResult(_0x2cc07b,null))[_0x7f00('0x1c')](handleError(_0x2cc07b,null));};exports[_0x7f00('0x44')]=function(_0x5d497e,_0x15bdde){return db[_0x7f00('0x32')][_0x7f00('0x44')](_0x5d497e['body'],{})[_0x7f00('0x13')](respondWithResult(_0x15bdde,0xc9))['catch'](handleError(_0x15bdde,null));};exports['update']=function(_0x4f1296,_0x41a9e4){if(_0x4f1296[_0x7f00('0x2d')]['id']){delete _0x4f1296[_0x7f00('0x2d')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x4f1296[_0x7f00('0x3a')]['id']}})[_0x7f00('0x13')](handleEntityNotFound(_0x41a9e4,null))[_0x7f00('0x13')](saveUpdates(_0x4f1296['body'],null))[_0x7f00('0x13')](respondWithResult(_0x41a9e4,null))['catch'](handleError(_0x41a9e4,null));};exports[_0x7f00('0x27')]=function(_0x20e95c,_0x72ef6c){return db['ChatInteraction']['find']({'where':{'id':_0x20e95c[_0x7f00('0x3a')]['id']}})[_0x7f00('0x13')](handleEntityNotFound(_0x72ef6c,null))['then'](removeEntity(_0x72ef6c,null))[_0x7f00('0x1c')](handleError(_0x72ef6c,null));};exports[_0x7f00('0x45')]=function(_0x1604a3,_0x23dfac){return db[_0x7f00('0x32')][_0x7f00('0x45')]()[_0x7f00('0x13')](respondWithResult(_0x23dfac,null))['catch'](handleError(_0x23dfac,null));};exports[_0x7f00('0x46')]=function(_0x1dc58b,_0x138535){var _0x2d89c1=_0x1dc58b['params']['id'];var _0x58d67e;var _0x5c2464;var _0x459acf;return db[_0x7f00('0x32')][_0x7f00('0x47')]({'where':{'id':_0x2d89c1}})[_0x7f00('0x13')](function(_0x28e989){_0x58d67e=_0x28e989;return db[_0x7f00('0x48')][_0x7f00('0x47')]({'where':{'id':_0x28e989[_0x7f00('0x49')]},'attributes':['id',_0x7f00('0x4a'),_0x7f00('0x4b'),_0x7f00('0x4c'),'vidaooNote','vidaooMetadata'],'raw':!![]});})[_0x7f00('0x13')](function(_0x57340b){if(_0x57340b&&_0x57340b['vidaooApiKey']&&_0x57340b[_0x7f00('0x4b')]){_0x5c2464=_0x57340b;var _0x350355={'interaction':{'id':_0x2d89c1},'agent':{'id':_0x1dc58b[_0x7f00('0x38')]['id'],'name':_0x1dc58b['user'][_0x7f00('0x29')],'fullname':_0x1dc58b[_0x7f00('0x38')][_0x7f00('0x4d')],'email':_0x1dc58b[_0x7f00('0x38')][_0x7f00('0x4e')]},'contact':_0x1dc58b['body'][_0x7f00('0x4f')],'account':_0x1dc58b[_0x7f00('0x2d')]['account']};var _0x5d2a73={'rejectUnauthorized':![],'method':'POST','url':_0x7f00('0x50'),'headers':{'X-APIKEY':_0x57340b[_0x7f00('0x4a')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1dc58b[_0x7f00('0x38')]['email']],'buttons':null,'topic':_0x5c2464[_0x7f00('0x4c')],'note':_[_0x7f00('0x51')](_0x5c2464[_0x7f00('0x52')])?null:getMustacheRender(_0x5c2464[_0x7f00('0x52')],_0x350355),'metadata':null},'redirect':_0x7f00('0x53'),'json':!![]};try{if(!_['isNull'](_0x5c2464['vidaooMetadata'])){var _0x562d21=getMustacheRender(_0x5c2464[_0x7f00('0x54')],_0x350355);var _0x55ee00=JSON[_0x7f00('0x55')](_0x562d21);_0x5d2a73[_0x7f00('0x2d')][_0x7f00('0x56')]=_0x55ee00;}}catch(_0x4c2ed5){throw new db[(_0x7f00('0x57'))][(_0x7f00('0x58'))](_0x7f00('0x59'));}return rp(_0x5d2a73);}else{throw new db['Sequelize'][(_0x7f00('0x58'))](_0x7f00('0x5a'));}})['then'](function(_0xbd0ed2){_0x459acf=_0xbd0ed2;if(_0x459acf['id']){var _0x2872ea={'body':_0x459acf[_0x7f00('0x5b')],'ChatWebsiteId':_0x5c2464['id'],'ChatInteractionId':_0x58d67e['id'],'direction':_0x7f00('0x5c'),'UserId':_0x1dc58b[_0x7f00('0x38')]['id']};return db[_0x7f00('0x5d')][_0x7f00('0x44')](_0x2872ea,{});}else{throw new db[(_0x7f00('0x57'))]['ValidationError'](_0x7f00('0x5e'));}})[_0x7f00('0x13')](function(){return _0x58d67e[_0x7f00('0x5f')]({'vidaooSessionId':_0x459acf['id']});})[_0x7f00('0x13')](respondWithResult(_0x138535,null))[_0x7f00('0x1c')](handleError(_0x138535,null));};exports[_0x7f00('0x60')]=function(_0x28ca31,_0x19e114){if(_0x28ca31[_0x7f00('0x2d')]['id']){delete _0x28ca31[_0x7f00('0x2d')]['id'];}return db['ChatInteraction'][_0x7f00('0x43')]({'where':{'id':_0x28ca31[_0x7f00('0x3a')]['id']},'include':[{'model':db['CmContact'],'as':_0x7f00('0x61')}]})[_0x7f00('0x13')](handleEntityNotFound(_0x19e114,null))[_0x7f00('0x13')](saveUpdates(_0x28ca31[_0x7f00('0x2d')],null))[_0x7f00('0x13')](respondWithResult(_0x19e114,null))[_0x7f00('0x1c')](handleError(_0x19e114,null));};exports[_0x7f00('0x62')]=function(_0x23cc7c,_0x10ce0f){if(_0x23cc7c[_0x7f00('0x2d')]['id']){delete _0x23cc7c[_0x7f00('0x2d')]['id'];}return db[_0x7f00('0x32')]['find']({'where':{'id':_0x23cc7c[_0x7f00('0x3a')]['id']}})[_0x7f00('0x13')](function(_0x33e862){if(!_0x33e862){logger[_0x7f00('0x18')](_0x7f00('0x63'),_0x7f00('0x62'),0x194,_0x7f00('0x64'));_0x10ce0f[_0x7f00('0x65')](0x194);}else{if(_0x33e862[_0x7f00('0x66')]){throw new db[(_0x7f00('0x57'))]['ValidationError'](_0x7f00('0x67'));}}return _0x33e862;})['then'](function(_0x430d07){if(_0x430d07){return _0x430d07[_0x7f00('0x26')]({'closed':_0x23cc7c['body']['closed'],'disposition':_0x23cc7c[_0x7f00('0x2d')][_0x7f00('0x68')]})['then'](function(_0x28e2f5){return _0x28e2f5;});}})['then'](function(){return respondWithRpcPromise(_0x7f00('0x69'),_0x7f00('0x62'),_0x23cc7c[_0x7f00('0x2d')],client9004);})[_0x7f00('0x13')](respondWithResult(_0x10ce0f,null))[_0x7f00('0x1c')](handleError(_0x10ce0f,null));};exports[_0x7f00('0x6a')]=function(_0x263f14,_0x3d5dbc){_0x263f14['body'][_0x7f00('0x29')]=_0x263f14[_0x7f00('0x6b')][_0x7f00('0x6c')];_0x263f14['body']['basename']=_0x263f14[_0x7f00('0x6b')][_0x7f00('0x6d')];_0x263f14[_0x7f00('0x2d')][_0x7f00('0x35')]=_0x263f14[_0x7f00('0x6b')][_0x7f00('0x6e')];return db[_0x7f00('0x6f')][_0x7f00('0x44')](_0x263f14[_0x7f00('0x2d')])['then'](respondWithResult(_0x3d5dbc,0xc9))['catch'](handleError(_0x3d5dbc,null));};exports[_0x7f00('0x70')]=function(_0x45712e,_0x301963){return db[_0x7f00('0x32')][_0x7f00('0x47')]({'where':{'id':_0x45712e[_0x7f00('0x3a')]['id']},'raw':!![]})[_0x7f00('0x13')](handleEntityNotFound(_0x301963,null))[_0x7f00('0x13')](function(_0x4ffe76){if(_0x4ffe76){if(_0x4ffe76['closed']){return _0x301963[_0x7f00('0x1d')](0x193)[_0x7f00('0x25')]({'status':0x193,'message':_0x7f00('0x71')});}return db[_0x7f00('0x6f')][_0x7f00('0x47')]({'where':{'id':_0x45712e[_0x7f00('0x3d')]['attachId']},'raw':!![]})[_0x7f00('0x13')](handleEntityNotFound(_0x301963,null));}})[_0x7f00('0x13')](function(_0x8e5bab){if(_0x8e5bab){var _0x511325=_0x8e5bab['ChatOfflineMessageId']!==null;var _0x1653d4=path[_0x7f00('0x72')](config['root'],'server/files/attachments/');if(_0x511325){_0x1653d4=path[_0x7f00('0x72')](_0x1653d4,_0x7f00('0x73'));}var _0x111ef0=path[_0x7f00('0x72')](_0x1653d4,_0x8e5bab[_0x7f00('0x74')]);return _0x301963[_0x7f00('0x75')](_0x111ef0);}})[_0x7f00('0x1c')](handleError(_0x301963,null));};exports[_0x7f00('0x76')]=function(_0xa7f31f,_0x4c3259){var _0xcb9bfa=null;var _0x507cfa=null;var _0x5f55a3=null;if(_0xa7f31f['body']['id']){delete _0xa7f31f['body']['id'];}if(_0xa7f31f[_0x7f00('0x2d')]['mailTranscript']){_0x5f55a3=path['join'](config[_0x7f00('0x77')],_0x7f00('0x78'),util[_0x7f00('0x79')](_0x7f00('0x7a'),Date['now']()));_0xa7f31f['body']['pathTranscript']=_0x5f55a3;}return db[_0x7f00('0x32')][_0x7f00('0x43')]({'where':{'id':_0xa7f31f[_0x7f00('0x3a')]['id']},'include':[{'model':db[_0x7f00('0x5d')],'as':_0x7f00('0x7b'),'include':[{'model':db[_0x7f00('0x7c')],'as':_0x7f00('0x7c')}]}]})[_0x7f00('0x13')](handleEntityNotFound(_0x4c3259,null))[_0x7f00('0x13')](saveUpdates(_0xa7f31f[_0x7f00('0x2d')],null))[_0x7f00('0x13')](function(_0x15eb3e){if(_0x15eb3e){_0xcb9bfa=_0x15eb3e;return db['ChatWebsite'][_0x7f00('0x43')]({'where':{'id':_0xcb9bfa[_0x7f00('0x49')]}});}})[_0x7f00('0x13')](function(_0x34e430){if(_0x34e430){_0x507cfa=_0x34e430;return db[_0x7f00('0x7d')][_0x7f00('0x43')]({'where':{'id':_0xcb9bfa[_0x7f00('0x7e')]}});}})['then'](function(_0xe8e440){if(_0xe8e440){if(_0x5f55a3){var _0x214c29=null;for(var _0x1bdb5c=0x1;_0x1bdb5c<_0xcb9bfa[_0x7f00('0x7b')][_0x7f00('0x41')];++_0x1bdb5c){_0x214c29=_0xcb9bfa[_0x7f00('0x7b')][_0x1bdb5c];var _0x33da02=_0x214c29[_0x7f00('0x66')]?util[_0x7f00('0x79')](_0x7f00('0x7f'),_0x507cfa['agentAlias'],_0x214c29['UserId']):'System';var _0x5cc472=_0xa7f31f['body'][_0x7f00('0x80')]||util['format']('%s%d','Visitor',_0x214c29[_0x7f00('0x7e')]);switch(_0x507cfa[_0x7f00('0x81')]){case _0x7f00('0x82'):_0x33da02=_0x214c29[_0x7f00('0x66')]?util[_0x7f00('0x79')](_0x7f00('0x7f'),_0x507cfa[_0x7f00('0x83')],_0x214c29[_0x7f00('0x66')]):_0x7f00('0x84');break;case _0x7f00('0x85'):_0x33da02=_0x214c29[_0x7f00('0x66')]?_0x214c29[_0x7f00('0x7c')][_0x7f00('0x86')]||_0x214c29[_0x7f00('0x7c')]['fullname']:_0x7f00('0x84');break;case _0x7f00('0x87'):_0x33da02=_0x214c29['UserId']?_0x214c29[_0x7f00('0x7c')]['fullname']:_0x7f00('0x84');break;default:_0x33da02=_0x214c29[_0x7f00('0x66')]?util[_0x7f00('0x79')](_0x7f00('0x7f'),_0x507cfa[_0x7f00('0x83')],_0x214c29['UserId']):_0x7f00('0x84');}var _0x5c1864=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x214c29[_0x7f00('0x88')])[_0x7f00('0x79')](_0x7f00('0x89')),_0x214c29[_0x7f00('0x8a')]==='in'?_0x5cc472:_0x33da02,_0x214c29[_0x7f00('0x2d')]);if(!_0x214c29['secret']){fs[_0x7f00('0x8b')](_0x5f55a3,_0x5c1864);}}return db[_0x7f00('0x8c')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x7f00('0x8d')],'as':_0x7f00('0x8e'),'raw':!![],'include':[{'model':db[_0x7f00('0x8f')],'as':_0x7f00('0x8f'),'raw':!![]}]}]});}}})[_0x7f00('0x13')](function(_0x596db2){if(!_0x596db2||!_0x596db2[_0x7f00('0x8e')]||!_0xa7f31f[_0x7f00('0x2d')])return _0xcb9bfa;var _0xe16678=_0x596db2[_0x7f00('0x90')]();return respondWithRpcPromise(_0x7f00('0x91'),_0x7f00('0x92'),{'account':_0xe16678,'message':{'from':util[_0x7f00('0x79')](_0x7f00('0x93'),_0x596db2[_0x7f00('0x29')],_0x596db2['email']||_0x596db2[_0x7f00('0x8e')][_0x7f00('0x38')]),'to':_0xa7f31f[_0x7f00('0x2d')][_0x7f00('0x94')],'subject':'Mail\x20Transcript','text':util[_0x7f00('0x79')](_0x7f00('0x95'),_0xa7f31f[_0x7f00('0x2d')][_0x7f00('0x94')]),'attachments':[{'path':_0x5f55a3}]}})[_0x7f00('0x13')](function(){return _0xcb9bfa;})[_0x7f00('0x1c')](function(_0x481d8c){logger['error'](_0x481d8c);});})[_0x7f00('0x13')](respondWithStatusCode(_0x4c3259,0xc8))[_0x7f00('0x1c')](handleError(_0x4c3259,null));};exports[_0x7f00('0x96')]=function(_0x5a6cc8,_0x43da1e){return db[_0x7f00('0x5d')][_0x7f00('0x43')]({'where':{'id':_0x5a6cc8[_0x7f00('0x3a')]['id']}})[_0x7f00('0x13')](handleEntityNotFound(_0x43da1e,null))[_0x7f00('0x13')](function(_0x26f7b8){if(_0x26f7b8){return _0x26f7b8[_0x7f00('0x96')](_0x5a6cc8['body'][_0x7f00('0x97')],_[_0x7f00('0x98')](_0x5a6cc8[_0x7f00('0x2d')],[_0x7f00('0x97'),'id'])||{});}})['then'](respondWithResult(_0x43da1e,null))['catch'](handleError(_0x43da1e,null));};exports['getMessages']=function(_0xc313c,_0x2abf3c){var _0x467dca={'raw':![],'where':{}};var _0xefd05c={};var _0xc461af={'count':0x0,'rows':[]};return db[_0x7f00('0x32')][_0x7f00('0x47')]({'where':{'id':_0xc313c[_0x7f00('0x3a')]['id']}})[_0x7f00('0x13')](handleEntityNotFound(_0x2abf3c,null))[_0x7f00('0x13')](function(_0x44053c){if(_0x44053c){_0xefd05c[_0x7f00('0x3b')]=_[_0x7f00('0x3c')](db['ChatMessage'][_0x7f00('0x33')]);_0xefd05c['query']=_['keys'](_0xc313c[_0x7f00('0x3d')]);_0xefd05c['filters']=_[_0x7f00('0x3e')](_0xefd05c[_0x7f00('0x3b')],_0xefd05c[_0x7f00('0x3d')]);_0x467dca[_0x7f00('0x40')]=_[_0x7f00('0x3e')](_0xefd05c[_0x7f00('0x3b')],qs[_0x7f00('0x3f')](_0xc313c[_0x7f00('0x3d')][_0x7f00('0x3f')]));_0x467dca[_0x7f00('0x40')]=_0x467dca[_0x7f00('0x40')][_0x7f00('0x41')]?_0x467dca[_0x7f00('0x40')]:_0xefd05c[_0x7f00('0x3b')];if(!_0xc313c[_0x7f00('0x3d')][_0x7f00('0x99')](_0x7f00('0x9a'))){_0x467dca[_0x7f00('0x21')]=qs[_0x7f00('0x21')](_0xc313c[_0x7f00('0x3d')][_0x7f00('0x21')]);_0x467dca[_0x7f00('0x1f')]=qs['offset'](_0xc313c[_0x7f00('0x3d')][_0x7f00('0x1f')]);}_0x467dca['order']=qs[_0x7f00('0x9b')](_0xc313c[_0x7f00('0x3d')]['sort']);_0x467dca[_0x7f00('0x9c')]=qs[_0x7f00('0x9d')](_[_0x7f00('0x9e')](_0xc313c[_0x7f00('0x3d')],_0xefd05c[_0x7f00('0x9d')]));_0x467dca['where'][_0x7f00('0x9f')]=_0x44053c['id'];if(_0xc313c['query']['filter']){_0x467dca['where']=_[_0x7f00('0x2c')](_0x467dca[_0x7f00('0x9c')],{'$or':_['map'](_0x467dca[_0x7f00('0x40')],function(_0xb6c8b2){var _0x3d74a9={};_0x3d74a9[_0xb6c8b2]={'$like':'%'+_0xc313c[_0x7f00('0x3d')][_0x7f00('0xa0')]+'%'};return _0x3d74a9;})});}if(_0xc313c['query'][_0x7f00('0xa1')]){var _0x3af8dc=_0xc313c[_0x7f00('0x3d')][_0x7f00('0xa1')][_0x7f00('0xa2')](',');var _0x55996e={};_0x55996e[_0x3af8dc[0x0]]={'$gte':moment(_0x3af8dc[0x1])['format'](_0x7f00('0xa3'))};_0x467dca[_0x7f00('0x9c')]=_[_0x7f00('0x2c')](_0x467dca['where'],_0x55996e);}_0x467dca=_[_0x7f00('0x2c')]({},_0x467dca,_0xc313c[_0x7f00('0x42')]);return db[_0x7f00('0x5d')]['count']({'where':_0x467dca[_0x7f00('0x9c')]})[_0x7f00('0x13')](function(_0x140bd5){_0xc461af['count']=_0x140bd5;if(_0xc313c['query'][_0x7f00('0xa4')]){_0x467dca[_0x7f00('0xa5')]=[{'all':!![]}];}return db[_0x7f00('0x5d')][_0x7f00('0xa6')](_0x467dca);})[_0x7f00('0x13')](function(_0x269f98){_0xc461af[_0x7f00('0xa7')]=_0x269f98;return _0xc461af;});}})[_0x7f00('0x13')](respondWithFilteredResult(_0x2abf3c,_0x467dca))[_0x7f00('0x1c')](handleError(_0x2abf3c,null));};exports[_0x7f00('0xa8')]=function(_0x2c6fed,_0x39ca20){var _0x260f0f={'where':{}},_0x5cc9ce={},_0xe9afd7={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x7f00('0x47')]({'where':{'id':_0x2c6fed[_0x7f00('0x3a')]['id']}})[_0x7f00('0x13')](handleEntityNotFound(_0x39ca20,null))['then'](function(_0x27e69d){if(_0x27e69d){_0x5cc9ce[_0x7f00('0x3b')]=_[_0x7f00('0x3c')](db[_0x7f00('0x5d')][_0x7f00('0x33')]);_0x5cc9ce[_0x7f00('0x3d')]=_['keys'](_0x2c6fed[_0x7f00('0x3d')]);_0x5cc9ce[_0x7f00('0x9d')]=_[_0x7f00('0x3e')](_0x5cc9ce[_0x7f00('0x3b')],_0x5cc9ce[_0x7f00('0x3d')]);_0x260f0f[_0x7f00('0x40')]=_[_0x7f00('0x3e')](_0x5cc9ce[_0x7f00('0x3b')],qs['fields'](_0x2c6fed[_0x7f00('0x3d')][_0x7f00('0x3f')]));_0x260f0f[_0x7f00('0x40')]=_0x260f0f[_0x7f00('0x40')][_0x7f00('0x41')]?_0x260f0f['attributes']:_0x5cc9ce[_0x7f00('0x3b')];if(!_0x2c6fed[_0x7f00('0x3d')][_0x7f00('0x99')](_0x7f00('0x9a'))){_0x260f0f[_0x7f00('0x21')]=qs[_0x7f00('0x21')](_0x2c6fed[_0x7f00('0x3d')][_0x7f00('0x21')]);_0x260f0f[_0x7f00('0x1f')]=qs['offset'](_0x2c6fed[_0x7f00('0x3d')]['offset']);}_0x260f0f[_0x7f00('0xa9')]=qs[_0x7f00('0x9b')](_0x2c6fed[_0x7f00('0x3d')]['sort']);_0x260f0f[_0x7f00('0x9c')]=qs[_0x7f00('0x9d')](_[_0x7f00('0x9e')](_0x2c6fed[_0x7f00('0x3d')],_0x5cc9ce[_0x7f00('0x9d')]));_0x260f0f[_0x7f00('0x9c')][_0x7f00('0x9f')]=_0x27e69d['id'];if(_0x2c6fed[_0x7f00('0x3d')][_0x7f00('0xa0')]){_0x260f0f[_0x7f00('0x9c')]=_[_0x7f00('0x2c')](_0x260f0f['where'],{'$or':_[_0x7f00('0x31')](_0x260f0f[_0x7f00('0x40')],function(_0x512a56){var _0x5b5512={};_0x5b5512[_0x512a56]={'$like':'%'+_0x2c6fed['query'][_0x7f00('0xa0')]+'%'};return _0x5b5512;})});}_0x260f0f[_0x7f00('0x9c')][_0x7f00('0xaa')]=![];if(_0x2c6fed[_0x7f00('0x3d')]['id']){_0x260f0f[_0x7f00('0x9c')]['id']={'$gt':_0x2c6fed[_0x7f00('0x3d')]['id']};}_0x260f0f=_['merge']({},_0x260f0f,_0x2c6fed[_0x7f00('0x42')]);return db[_0x7f00('0x5d')][_0x7f00('0x22')]({'where':_0x260f0f[_0x7f00('0x9c')]})[_0x7f00('0x13')](function(_0x20f046){_0xe9afd7[_0x7f00('0x22')]=_0x20f046;_0x260f0f[_0x7f00('0xa5')]=[];if(_0x2c6fed[_0x7f00('0x3d')][_0x7f00('0xab')]){_0x260f0f[_0x7f00('0xa5')][_0x7f00('0xac')]({'model':db[_0x7f00('0x7c')],'as':_0x7f00('0x7c'),'attributes':['id','fullname',_0x7f00('0x86')]});}if(_0x2c6fed[_0x7f00('0x3d')][_0x7f00('0xa4')]){_0x260f0f[_0x7f00('0xa5')]=[{'all':!![]}];}return db[_0x7f00('0x5d')][_0x7f00('0xa6')](_0x260f0f);})[_0x7f00('0x13')](function(_0x3ac55b){_0xe9afd7[_0x7f00('0xa7')]=_0x3ac55b;return _0xe9afd7;});}})[_0x7f00('0x13')](respondWithFilteredResult(_0x39ca20,_0x260f0f))['catch'](handleError(_0x39ca20,null));};exports[_0x7f00('0xad')]=function(_0x3480d5,_0x465b8d){return db['ChatInteraction'][_0x7f00('0x43')]({'where':{'id':_0x3480d5[_0x7f00('0x3a')]['id']}})[_0x7f00('0x13')](handleEntityNotFound(_0x465b8d,null))[_0x7f00('0x13')](function(_0x431f16){if(_0x431f16){return _0x431f16['setTags'](_0x3480d5[_0x7f00('0x2d')][_0x7f00('0x97')],_[_0x7f00('0x98')](_0x3480d5['body'],['ids','id'])||{})[_0x7f00('0xae')](function(){return db[_0x7f00('0xaf')][_0x7f00('0xa6')]({'attributes':['id',_0x7f00('0x29'),'color'],'where':{'id':_0x3480d5[_0x7f00('0x2d')][_0x7f00('0x97')]}});})[_0x7f00('0x13')](function(_0x1ce6a1){socket[_0x7f00('0xb0')](_0x7f00('0xb1'),{'id':Number(_0x3480d5[_0x7f00('0x3a')]['id']),'tags':_0x1ce6a1||[]});return{'id':Number(_0x3480d5[_0x7f00('0x3a')]['id']),'tags':_0x1ce6a1||[]};});}})[_0x7f00('0x13')](respondWithResult(_0x465b8d,null))[_0x7f00('0x1c')](handleError(_0x465b8d,null));};exports[_0x7f00('0xb2')]=function(_0x4797e4,_0x389b6e){return db['ChatInteraction'][_0x7f00('0x43')]({'where':{'id':_0x4797e4[_0x7f00('0x3a')]['id']}})['then'](handleEntityNotFound(_0x389b6e,null))[_0x7f00('0x13')](function(_0x42d1a3){if(_0x42d1a3){return _0x42d1a3[_0x7f00('0xb2')](_0x4797e4['query'][_0x7f00('0x97')]);}})['then'](respondWithStatusCode(_0x389b6e,null))[_0x7f00('0x1c')](handleError(_0x389b6e,null));};exports[_0x7f00('0x75')]=function(_0x113bd8,_0x2f3ef8){var _0x4a53c6=moment()[_0x7f00('0xb3')]()[_0x7f00('0xb4')]();var _0x41c592=path[_0x7f00('0x72')](config['root'],_0x7f00('0xb5'),'files',_0x7f00('0xb6'));var _0x4cd4dd=path[_0x7f00('0x72')](config[_0x7f00('0x77')],'server',_0x7f00('0xb7'),_0x7f00('0xb8'));var _0x5d7d93=path[_0x7f00('0x72')](_0x41c592,_0x4a53c6);var _0x2fac5e=util[_0x7f00('0x79')](_0x7f00('0xb9'),_0x113bd8[_0x7f00('0x3a')]['id'],_0x4a53c6);var _0x267ba3=path['join'](_0x41c592,_0x2fac5e);var _0x420f2f=[];_0x420f2f[_0x7f00('0xac')]({'model':db[_0x7f00('0x7c')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x420f2f[_0x7f00('0xac')]({'model':db[_0x7f00('0x7d')],'as':_0x7f00('0x61'),'attributes':['id',_0x7f00('0xba'),_0x7f00('0xbb')],'raw':!![]});if(_0x113bd8[_0x7f00('0x3d')][_0x7f00('0xb8')]){_0x420f2f[_0x7f00('0xac')]({'model':db[_0x7f00('0x6f')],'as':_0x7f00('0x6f'),'raw':!![]});}var _0x55d8ba=[{'model':db[_0x7f00('0x5d')],'as':_0x7f00('0x7b'),'attributes':['id',_0x7f00('0x2d'),'createdAt',_0x7f00('0x8a'),_0x7f00('0xaa'),_0x7f00('0xbc')],'include':_0x420f2f}];_0x55d8ba[_0x7f00('0xac')]({'model':db[_0x7f00('0x48')],'as':'Account','attributes':['id',_0x7f00('0x29')]});_0x55d8ba[_0x7f00('0xac')]({'model':db[_0x7f00('0x7c')],'as':_0x7f00('0xbd'),'attributes':['id',_0x7f00('0x4d')]});return db[_0x7f00('0x32')][_0x7f00('0x43')]({'where':{'id':_0x113bd8['params']['id']},'include':_0x55d8ba})[_0x7f00('0x13')](handleEntityNotFound(_0x2f3ef8,null))[_0x7f00('0x13')](function(_0x1c3ba6){if(_0x1c3ba6){var _0x32d926=_0x1c3ba6[_0x7f00('0xbe')]({'plain':!![]});fs[_0x7f00('0xbf')](_0x5d7d93);var _0x20ef05={'channel':_0x7f00('0xc0'),'account':_0x32d926[_0x7f00('0xc1')][_0x7f00('0x29')],'agent':_0x32d926[_0x7f00('0xbd')]?_0x32d926['Owner'][_0x7f00('0x4d')]:_0x7f00('0xc2'),'createdAt':moment(_0x32d926[_0x7f00('0x88')])[_0x7f00('0x79')](_0x7f00('0xa3'))[_0x7f00('0xb4')](),'closedAt':_0x32d926['closed']?moment(_0x32d926[_0x7f00('0xc3')])[_0x7f00('0x79')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7f00('0xb4')]():'','disposition':_0x32d926[_0x7f00('0x68')],'chatInfo':{'browser':_0x32d926[_0x7f00('0xc4')],'os':_0x32d926[_0x7f00('0xc5')],'referer':_0x32d926[_0x7f00('0xc6')],'customerIp':_0x32d926['customerIp'],'customerPort':_0x32d926[_0x7f00('0xc7')]?_0x32d926[_0x7f00('0xc7')]:'N.A.'},'messages':_(_0x32d926[_0x7f00('0x7b')])[_0x7f00('0xc8')]()[_0x7f00('0xa0')]({'secret':![]})['map'](function(_0x340500){if(_0x340500[_0x7f00('0x6f')]){var _0x194cc9=path[_0x7f00('0x72')](_0x4cd4dd,_0x340500[_0x7f00('0x6f')][_0x7f00('0x74')]);if(fs['existsSync'](_0x194cc9)){fs[_0x7f00('0xc9')](_0x194cc9)[_0x7f00('0xca')](fs[_0x7f00('0xcb')](path[_0x7f00('0x72')](_0x5d7d93,_0x340500['Attachment'][_0x7f00('0x74')])));}}return{'date':moment(_0x340500[_0x7f00('0x88')])[_0x7f00('0x79')](_0x7f00('0xa3'))[_0x7f00('0xb4')](),'sender':_0x340500[_0x7f00('0x8a')]===_0x7f00('0x5c')?_0x340500[_0x7f00('0x7c')]?_0x340500[_0x7f00('0x7c')][_0x7f00('0x4d')]:_0x7f00('0x84'):_0x340500['Contact']['firstName']+(_0x340500['Contact'][_0x7f00('0xbb')]?'\x20'+_0x340500[_0x7f00('0x61')][_0x7f00('0xbb')]:''),'body':_0x340500[_0x7f00('0x6f')]?_0x340500[_0x7f00('0x6f')][_0x7f00('0x74')]:_0x340500[_0x7f00('0x2d')],'direction':_0x340500[_0x7f00('0x8a')]===_0x7f00('0x5c')?'A':'C','secret':_0x340500['secret'],'read':_0x340500['read'],'attachment':_0x340500[_0x7f00('0x6f')]};})[_0x7f00('0xcc')]()};return ejs[_0x7f00('0xcd')](path[_0x7f00('0x72')](config[_0x7f00('0x77')],_0x7f00('0xb5'),'views','downloadInteraction.ejs'),{'interaction':_0x20ef05})[_0x7f00('0x13')](function(_0x2d6752){var _0x53185a=path[_0x7f00('0x72')](_0x5d7d93,_0x7f00('0xce')+_0x32d926['id']+'-'+_0x4a53c6+'.pdf');var _0x57ab39={'path':_0x53185a,'channel':'Chat','interactionId':_0x32d926['id']};return pdf['createPdfFromHTML'](_0x2d6752,_0x57ab39);})[_0x7f00('0x13')](function(){return new Promise(function(_0x196e11,_0x31f998){zipdir(_0x5d7d93,{'saveTo':_0x267ba3},function(_0x2081ad,_0x298a19){if(_0x2081ad)return _0x31f998(_0x2081ad);return _0x196e11(_0x298a19);});})[_0x7f00('0x13')](function(){return new BPromise(function(_0x3e49e6,_0x345120){rimraf(_0x5d7d93,function(_0x2ad039){if(_0x2ad039)_0x345120(_0x2ad039);return _0x3e49e6();});});})[_0x7f00('0x13')](function(){return _0x2f3ef8[_0x7f00('0x75')](_0x267ba3,_0x2fac5e,function(_0x359938){if(_0x359938){logger['error'](_0x7f00('0xcf'),_0x359938);}else{fs[_0x7f00('0xd0')](_0x267ba3);}});});});}else{return _0x2f3ef8['sendStatus'](0xc8);}})[_0x7f00('0x1c')](handleError(_0x2f3ef8,null));}; \ No newline at end of file +var _0x2b5f=['ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','find','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','originalname','basename','file','filename','mimetype','Attachment','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','now','Messages','User','ContactId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','pick','filters','ChatInteractionId','filter','where','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','count','includeAgent','addTags','setTags','omit','spread','Tag','color','emit','removeTags','unix','server','tmp','files','firstName','attachments','direction','read','push','Account','mkdirSync','Owner','N.A.','toString','closedAt','disposition','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','lastName','value','views','transcript-','.pdf','Chat','createPdfFromHTML','err','rimraf','request-promise','moment','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','./chatInteraction.socket','register','client','http','then','info','debug','request\x20sent','error','ChatInteraction,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','undefined','limit','set','Content-Range','update','destroy','name','send','render','merge','body','contact','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','catch','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','user','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','follow','isNull','vidaooMetadata','parse','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2b5f,0x78));var _0xf2b5=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x2b5f[_0x21a9d9];return _0x46adce;};'use strict';var rimraf=require(_0xf2b5('0x0'));var zipdir=require('zip-dir');var rp=require(_0xf2b5('0x1'));var moment=require(_0xf2b5('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf2b5('0x3'));var path=require(_0xf2b5('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf2b5('0x5'));var Redis=require('ioredis');var interaction=require(_0xf2b5('0x6'));var qs=require(_0xf2b5('0x7'));var pdf=require(_0xf2b5('0x8'));var logger=require('../../config/logger')(_0xf2b5('0x9'));var config=require(_0xf2b5('0xa'));var db=require(_0xf2b5('0xb'))['db'];config['redis']=_[_0xf2b5('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf2b5('0xd'))(new Redis(config['redis']));require(_0xf2b5('0xe'))[_0xf2b5('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf2b5('0x10')][_0xf2b5('0x11')]({'port':0x232b});var client9004=jayson[_0xf2b5('0x10')][_0xf2b5('0x11')]({'port':0x232c});function respondWithRpcPromise(_0x5b4ada,_0xef6cdc,_0x1e0146,_0x2f9945){return new BPromise(function(_0xc34d17,_0x2b6c8d){var _0xc40b38=_0x2f9945||client;return _0xc40b38['request'](_0x5b4ada,_0x1e0146)[_0xf2b5('0x12')](function(_0x477809){logger[_0xf2b5('0x13')]('ChatInteraction,\x20%s,\x20%s',_0xef6cdc,'request\x20sent');logger[_0xf2b5('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xef6cdc,_0xf2b5('0x15'),JSON['stringify'](_0x477809));if(_0x477809[_0xf2b5('0x16')]){if(_0x477809['error']['code']===0x1f4){logger[_0xf2b5('0x16')](_0xf2b5('0x17'),_0xef6cdc,_0x477809[_0xf2b5('0x16')][_0xf2b5('0x18')]);return _0x2b6c8d(_0x477809[_0xf2b5('0x16')][_0xf2b5('0x18')]);}logger[_0xf2b5('0x16')](_0xf2b5('0x17'),_0xef6cdc,_0x477809['error']['message']);return _0xc34d17(_0x477809[_0xf2b5('0x16')][_0xf2b5('0x18')]);}else{logger['info'](_0xf2b5('0x17'),_0xef6cdc,'request\x20sent');_0xc34d17(_0x477809[_0xf2b5('0x19')][_0xf2b5('0x18')]);}})['catch'](function(_0x4e896f){logger[_0xf2b5('0x16')](_0xf2b5('0x17'),_0xef6cdc,_0x4e896f);_0x2b6c8d(_0x4e896f);});});}function respondWithStatusCode(_0x2900d8,_0x3a1b76){_0x3a1b76=_0x3a1b76||0xcc;return function(_0x4903ff){if(_0x4903ff){return _0x2900d8[_0xf2b5('0x1a')](_0x3a1b76);}return _0x2900d8[_0xf2b5('0x1b')](_0x3a1b76)['end']();};}function respondWithResult(_0x3e239b,_0x2973c3){_0x2973c3=_0x2973c3||0xc8;return function(_0x2751d4){if(_0x2751d4){return _0x3e239b['status'](_0x2973c3)[_0xf2b5('0x1c')](_0x2751d4);}};}function respondWithFilteredResult(_0x5c8c4f,_0x18dffd){return function(_0x4d6a73){if(_0x4d6a73){var _0x22d3be=typeof _0x18dffd[_0xf2b5('0x1d')]===_0xf2b5('0x1e')&&typeof _0x18dffd[_0xf2b5('0x1f')]==='undefined';var _0x399828=_0x4d6a73['count'];var _0x495710=_0x22d3be?0x0:_0x18dffd[_0xf2b5('0x1d')];var _0x53883f=_0x22d3be?_0x4d6a73['count']:_0x18dffd[_0xf2b5('0x1d')]+_0x18dffd[_0xf2b5('0x1f')];var _0x4dc4e4;if(_0x53883f>=_0x399828){_0x53883f=_0x399828;_0x4dc4e4=0xc8;}else{_0x4dc4e4=0xce;}_0x5c8c4f['status'](_0x4dc4e4);return _0x5c8c4f[_0xf2b5('0x20')](_0xf2b5('0x21'),_0x495710+'-'+_0x53883f+'/'+_0x399828)['json'](_0x4d6a73);}return null;};}function saveUpdates(_0x38c78c){return function(_0x2149b5){if(_0x2149b5){return _0x2149b5[_0xf2b5('0x22')](_0x38c78c)[_0xf2b5('0x12')](function(_0x47275d){return _0x47275d;});}return null;};}function removeEntity(_0x4b289e){return function(_0x192d22){if(_0x192d22){return _0x192d22[_0xf2b5('0x23')]()[_0xf2b5('0x12')](function(){_0x4b289e[_0xf2b5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2399e8){return function(_0x2cb60d){if(!_0x2cb60d){_0x2399e8['sendStatus'](0x194);}return _0x2cb60d;};}function handleError(_0xd67776,_0x5f57e2){_0x5f57e2=_0x5f57e2||0x1f4;return function(_0x140900){logger[_0xf2b5('0x16')](_0x140900['stack']);if(_0x140900[_0xf2b5('0x24')]){delete _0x140900[_0xf2b5('0x24')];}_0xd67776[_0xf2b5('0x1b')](_0x5f57e2)[_0xf2b5('0x25')](_0x140900);};}function getMustacheRender(_0x18687d,_0x18fc6a){return Mustache[_0xf2b5('0x26')](_0x18687d,_[_0xf2b5('0x27')](_0x18fc6a[_0xf2b5('0x28')],{'contact':_0x18fc6a[_0xf2b5('0x29')],'message':_0x18fc6a[_0xf2b5('0x18')],'agent':_0x18fc6a['agent'],'interaction':_0x18fc6a[_0xf2b5('0x2a')],'account':_0x18fc6a[_0xf2b5('0x2b')]}))||'';}exports[_0xf2b5('0x2c')]=function(_0x509a77,_0x19848){var _0x47d982={};var _0x26cd4e=_[_0xf2b5('0x2d')](db[_0xf2b5('0x2e')][_0xf2b5('0x2f')],function(_0x572342){return{'name':_0x572342[_0xf2b5('0x30')],'type':_0x572342[_0xf2b5('0x31')][_0xf2b5('0x32')]};});_0x47d982=qs[_0xf2b5('0x33')](_0x26cd4e,_0x509a77);return interaction[_0xf2b5('0x34')](_0xf2b5('0x35'),_0x509a77['query'],_0x509a77['user'],_0x47d982,_0x26cd4e)[_0xf2b5('0x12')](respondWithFilteredResult(_0x19848,_0x47d982))[_0xf2b5('0x36')](handleError(_0x19848,null));};exports[_0xf2b5('0x37')]=function(_0x5d674,_0x150e2b){var _0x57ff6f={'raw':![],'where':{'id':_0x5d674[_0xf2b5('0x38')]['id']}},_0x48d329={};_0x48d329[_0xf2b5('0x39')]=_[_0xf2b5('0x3a')](db[_0xf2b5('0x2e')][_0xf2b5('0x2f')]);_0x48d329[_0xf2b5('0x3b')]=_[_0xf2b5('0x3a')](_0x5d674[_0xf2b5('0x3b')]);_0x48d329['filters']=_[_0xf2b5('0x3c')](_0x48d329[_0xf2b5('0x39')],_0x48d329[_0xf2b5('0x3b')]);_0x57ff6f[_0xf2b5('0x3d')]=_[_0xf2b5('0x3c')](_0x48d329[_0xf2b5('0x39')],qs[_0xf2b5('0x3e')](_0x5d674[_0xf2b5('0x3b')][_0xf2b5('0x3e')]));_0x57ff6f[_0xf2b5('0x3d')]=_0x57ff6f[_0xf2b5('0x3d')][_0xf2b5('0x3f')]?_0x57ff6f[_0xf2b5('0x3d')]:_0x48d329[_0xf2b5('0x39')];if(_0x5d674[_0xf2b5('0x3b')][_0xf2b5('0x40')]){_0x57ff6f[_0xf2b5('0x41')]=[{'all':!![]}];}_0x57ff6f=_['merge']({},_0x57ff6f,_0x5d674[_0xf2b5('0x42')]);return db[_0xf2b5('0x2e')]['find'](_0x57ff6f)[_0xf2b5('0x12')](handleEntityNotFound(_0x150e2b,null))['then'](respondWithResult(_0x150e2b,null))[_0xf2b5('0x36')](handleError(_0x150e2b,null));};exports[_0xf2b5('0x43')]=function(_0x49631a,_0x28c2ed){return db[_0xf2b5('0x2e')][_0xf2b5('0x43')](_0x49631a[_0xf2b5('0x28')],{})[_0xf2b5('0x12')](respondWithResult(_0x28c2ed,0xc9))['catch'](handleError(_0x28c2ed,null));};exports[_0xf2b5('0x22')]=function(_0x5dcfe1,_0xf73075){if(_0x5dcfe1['body']['id']){delete _0x5dcfe1[_0xf2b5('0x28')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x5dcfe1[_0xf2b5('0x38')]['id']}})['then'](handleEntityNotFound(_0xf73075,null))[_0xf2b5('0x12')](saveUpdates(_0x5dcfe1['body'],null))[_0xf2b5('0x12')](respondWithResult(_0xf73075,null))['catch'](handleError(_0xf73075,null));};exports[_0xf2b5('0x23')]=function(_0x54199f,_0x1d884b){return db[_0xf2b5('0x2e')]['find']({'where':{'id':_0x54199f[_0xf2b5('0x38')]['id']}})['then'](handleEntityNotFound(_0x1d884b,null))[_0xf2b5('0x12')](removeEntity(_0x1d884b,null))['catch'](handleError(_0x1d884b,null));};exports['describe']=function(_0x4ad89b,_0x4735f7){return db[_0xf2b5('0x2e')][_0xf2b5('0x44')]()[_0xf2b5('0x12')](respondWithResult(_0x4735f7,null))[_0xf2b5('0x36')](handleError(_0x4735f7,null));};exports[_0xf2b5('0x45')]=function(_0x1c4728,_0x441e7d){var _0x52b960=_0x1c4728[_0xf2b5('0x38')]['id'];var _0x2ad80f;var _0x543244;var _0x34fafe;return db['ChatInteraction'][_0xf2b5('0x46')]({'where':{'id':_0x52b960}})[_0xf2b5('0x12')](function(_0x2820e2){_0x2ad80f=_0x2820e2;return db[_0xf2b5('0x47')]['findOne']({'where':{'id':_0x2820e2[_0xf2b5('0x48')]},'attributes':['id',_0xf2b5('0x49'),_0xf2b5('0x4a'),'vidaooTopic',_0xf2b5('0x4b'),'vidaooMetadata'],'raw':!![]});})[_0xf2b5('0x12')](function(_0x381220){if(_0x381220&&_0x381220[_0xf2b5('0x49')]&&_0x381220['vidaooEscalation']){_0x543244=_0x381220;var _0x5012d7={'interaction':{'id':_0x52b960},'agent':{'id':_0x1c4728[_0xf2b5('0x4c')]['id'],'name':_0x1c4728[_0xf2b5('0x4c')][_0xf2b5('0x24')],'fullname':_0x1c4728[_0xf2b5('0x4c')]['fullname'],'email':_0x1c4728['user']['email']},'contact':_0x1c4728[_0xf2b5('0x28')]['contact'],'account':_0x1c4728[_0xf2b5('0x28')][_0xf2b5('0x2b')]};var _0x437ff2={'rejectUnauthorized':![],'method':_0xf2b5('0x4d'),'url':_0xf2b5('0x4e'),'headers':{'X-APIKEY':_0x381220[_0xf2b5('0x49')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1c4728['user']['email']],'buttons':null,'topic':_0x543244[_0xf2b5('0x4f')],'note':_['isNull'](_0x543244[_0xf2b5('0x4b')])?null:getMustacheRender(_0x543244[_0xf2b5('0x4b')],_0x5012d7),'metadata':null},'redirect':_0xf2b5('0x50'),'json':!![]};try{if(!_[_0xf2b5('0x51')](_0x543244[_0xf2b5('0x52')])){var _0x2d9d23=getMustacheRender(_0x543244[_0xf2b5('0x52')],_0x5012d7);var _0x337ba0=JSON[_0xf2b5('0x53')](_0x2d9d23);_0x437ff2[_0xf2b5('0x28')]['metadata']=_0x337ba0;}}catch(_0xae8ae0){throw new db[(_0xf2b5('0x54'))][(_0xf2b5('0x55'))](_0xf2b5('0x56'));}return rp(_0x437ff2);}else{throw new db[(_0xf2b5('0x54'))][(_0xf2b5('0x55'))](_0xf2b5('0x57'));}})['then'](function(_0x2dc231){_0x34fafe=_0x2dc231;if(_0x34fafe['id']){var _0x27a390={'body':_0x34fafe['join_url'],'ChatWebsiteId':_0x543244['id'],'ChatInteractionId':_0x2ad80f['id'],'direction':'out','UserId':_0x1c4728[_0xf2b5('0x4c')]['id']};return db[_0xf2b5('0x58')][_0xf2b5('0x43')](_0x27a390,{});}else{throw new db['Sequelize'][(_0xf2b5('0x55'))](_0xf2b5('0x59'));}})[_0xf2b5('0x12')](function(){return _0x2ad80f[_0xf2b5('0x5a')]({'vidaooSessionId':_0x34fafe['id']});})[_0xf2b5('0x12')](respondWithResult(_0x441e7d,null))[_0xf2b5('0x36')](handleError(_0x441e7d,null));};exports[_0xf2b5('0x5b')]=function(_0x34c327,_0x3a6b36){if(_0x34c327[_0xf2b5('0x28')]['id']){delete _0x34c327[_0xf2b5('0x28')]['id'];}return db[_0xf2b5('0x2e')][_0xf2b5('0x5c')]({'where':{'id':_0x34c327[_0xf2b5('0x38')]['id']},'include':[{'model':db[_0xf2b5('0x5d')],'as':_0xf2b5('0x5e')}]})[_0xf2b5('0x12')](handleEntityNotFound(_0x3a6b36,null))['then'](saveUpdates(_0x34c327[_0xf2b5('0x28')],null))[_0xf2b5('0x12')](respondWithResult(_0x3a6b36,null))[_0xf2b5('0x36')](handleError(_0x3a6b36,null));};exports[_0xf2b5('0x5f')]=function(_0x9af9ea,_0x565e73){if(_0x9af9ea[_0xf2b5('0x28')]['id']){delete _0x9af9ea[_0xf2b5('0x28')]['id'];}return db[_0xf2b5('0x2e')][_0xf2b5('0x5c')]({'where':{'id':_0x9af9ea[_0xf2b5('0x38')]['id']}})['then'](function(_0x218051){if(!_0x218051){logger[_0xf2b5('0x16')](_0xf2b5('0x60'),_0xf2b5('0x5f'),0x194,_0xf2b5('0x61'));_0x565e73['sendStatus'](0x194);}else{if(_0x218051[_0xf2b5('0x62')]){throw new db[(_0xf2b5('0x54'))][(_0xf2b5('0x55'))](_0xf2b5('0x63'));}}return _0x218051;})[_0xf2b5('0x12')](function(_0x2999ec){if(_0x2999ec){return _0x2999ec[_0xf2b5('0x22')]({'closed':_0x9af9ea[_0xf2b5('0x28')][_0xf2b5('0x64')],'disposition':_0x9af9ea[_0xf2b5('0x28')]['disposition']})[_0xf2b5('0x12')](function(_0x56be02){return _0x56be02;});}})[_0xf2b5('0x12')](function(){return respondWithRpcPromise('AbandonInteraction',_0xf2b5('0x5f'),_0x9af9ea[_0xf2b5('0x28')],client9004);})['then'](respondWithResult(_0x565e73,null))[_0xf2b5('0x36')](handleError(_0x565e73,null));};exports['attachmentUpload']=function(_0x3d296b,_0x263a44){_0x3d296b[_0xf2b5('0x28')][_0xf2b5('0x24')]=_0x3d296b['file'][_0xf2b5('0x65')];_0x3d296b['body'][_0xf2b5('0x66')]=_0x3d296b[_0xf2b5('0x67')][_0xf2b5('0x68')];_0x3d296b[_0xf2b5('0x28')]['type']=_0x3d296b[_0xf2b5('0x67')][_0xf2b5('0x69')];return db[_0xf2b5('0x6a')][_0xf2b5('0x43')](_0x3d296b[_0xf2b5('0x28')])[_0xf2b5('0x12')](respondWithResult(_0x263a44,0xc9))[_0xf2b5('0x36')](handleError(_0x263a44,null));};exports['attachmentDownload']=function(_0x4b61db,_0x3d1662){return db['ChatInteraction'][_0xf2b5('0x46')]({'where':{'id':_0x4b61db['params']['id']},'raw':!![]})[_0xf2b5('0x12')](handleEntityNotFound(_0x3d1662,null))[_0xf2b5('0x12')](function(_0xa6ae15){if(_0xa6ae15){if(_0xa6ae15[_0xf2b5('0x64')]){return _0x3d1662[_0xf2b5('0x1b')](0x193)[_0xf2b5('0x1c')]({'status':0x193,'message':_0xf2b5('0x6b')});}return db[_0xf2b5('0x6a')][_0xf2b5('0x46')]({'where':{'id':_0x4b61db[_0xf2b5('0x3b')][_0xf2b5('0x6c')]},'raw':!![]})['then'](handleEntityNotFound(_0x3d1662,null));}})[_0xf2b5('0x12')](function(_0x2c9ddc){if(_0x2c9ddc){var _0x42acd7=_0x2c9ddc[_0xf2b5('0x6d')]!==null;var _0x4aae16=path[_0xf2b5('0x6e')](config[_0xf2b5('0x6f')],_0xf2b5('0x70'));if(_0x42acd7){_0x4aae16=path['join'](_0x4aae16,_0xf2b5('0x71'));}var _0x5517c5=path[_0xf2b5('0x6e')](_0x4aae16,_0x2c9ddc[_0xf2b5('0x66')]);return _0x3d1662[_0xf2b5('0x72')](_0x5517c5);}})[_0xf2b5('0x36')](handleError(_0x3d1662,null));};exports[_0xf2b5('0x73')]=function(_0x1d3754,_0x1485d9){var _0x498744=null;var _0xa07a23=null;var _0x9aa106=null;if(_0x1d3754[_0xf2b5('0x28')]['id']){delete _0x1d3754['body']['id'];}if(_0x1d3754[_0xf2b5('0x28')][_0xf2b5('0x74')]){_0x9aa106=path['join'](config[_0xf2b5('0x6f')],_0xf2b5('0x75'),util[_0xf2b5('0x76')]('transcript-%s.txt',Date[_0xf2b5('0x77')]()));_0x1d3754[_0xf2b5('0x28')]['pathTranscript']=_0x9aa106;}return db[_0xf2b5('0x2e')]['find']({'where':{'id':_0x1d3754[_0xf2b5('0x38')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xf2b5('0x78'),'include':[{'model':db[_0xf2b5('0x79')],'as':_0xf2b5('0x79')}]}]})[_0xf2b5('0x12')](handleEntityNotFound(_0x1485d9,null))[_0xf2b5('0x12')](saveUpdates(_0x1d3754[_0xf2b5('0x28')],null))[_0xf2b5('0x12')](function(_0x2d4027){if(_0x2d4027){_0x498744=_0x2d4027;return db['ChatWebsite'][_0xf2b5('0x5c')]({'where':{'id':_0x498744[_0xf2b5('0x48')]}});}})[_0xf2b5('0x12')](function(_0x11d380){if(_0x11d380){_0xa07a23=_0x11d380;return db[_0xf2b5('0x5d')]['find']({'where':{'id':_0x498744[_0xf2b5('0x7a')]}});}})[_0xf2b5('0x12')](function(_0xf4765e){if(_0xf4765e){if(_0x9aa106){var _0x5b6269=null;for(var _0x33dfe6=0x1;_0x33dfe6<_0x498744['Messages']['length'];++_0x33dfe6){_0x5b6269=_0x498744[_0xf2b5('0x78')][_0x33dfe6];var _0x1271bc=_0x5b6269[_0xf2b5('0x62')]?util[_0xf2b5('0x76')](_0xf2b5('0x7b'),_0xa07a23[_0xf2b5('0x7c')],_0x5b6269[_0xf2b5('0x62')]):_0xf2b5('0x7d');var _0x3a4c5e=_0x1d3754[_0xf2b5('0x28')][_0xf2b5('0x7e')]||util['format'](_0xf2b5('0x7b'),_0xf2b5('0x7f'),_0x5b6269[_0xf2b5('0x7a')]);switch(_0xa07a23[_0xf2b5('0x80')]){case _0xf2b5('0x81'):_0x1271bc=_0x5b6269['UserId']?util['format'](_0xf2b5('0x7b'),_0xa07a23[_0xf2b5('0x7c')],_0x5b6269['UserId']):_0xf2b5('0x7d');break;case'agent_alias':_0x1271bc=_0x5b6269['UserId']?_0x5b6269[_0xf2b5('0x79')][_0xf2b5('0x82')]||_0x5b6269['User'][_0xf2b5('0x83')]:_0xf2b5('0x7d');break;case _0xf2b5('0x84'):_0x1271bc=_0x5b6269[_0xf2b5('0x62')]?_0x5b6269[_0xf2b5('0x79')][_0xf2b5('0x83')]:_0xf2b5('0x7d');break;default:_0x1271bc=_0x5b6269[_0xf2b5('0x62')]?util['format'](_0xf2b5('0x7b'),_0xa07a23[_0xf2b5('0x7c')],_0x5b6269[_0xf2b5('0x62')]):_0xf2b5('0x7d');}var _0x38b2a4=util[_0xf2b5('0x76')](_0xf2b5('0x85'),moment(_0x5b6269[_0xf2b5('0x86')])[_0xf2b5('0x76')](_0xf2b5('0x87')),_0x5b6269['direction']==='in'?_0x3a4c5e:_0x1271bc,_0x5b6269[_0xf2b5('0x28')]);if(!_0x5b6269[_0xf2b5('0x88')]){fs[_0xf2b5('0x89')](_0x9aa106,_0x38b2a4);}}return db['MailAccount'][_0xf2b5('0x46')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf2b5('0x8a'),'raw':!![],'include':[{'model':db[_0xf2b5('0x8b')],'as':_0xf2b5('0x8b'),'raw':!![]}]}]});}}})[_0xf2b5('0x12')](function(_0x203d4b){if(!_0x203d4b||!_0x203d4b[_0xf2b5('0x8a')]||!_0x1d3754['body'])return _0x498744;var _0x449dc0=_0x203d4b[_0xf2b5('0x8c')]();return respondWithRpcPromise(_0xf2b5('0x8d'),'sendMail',{'account':_0x449dc0,'message':{'from':util[_0xf2b5('0x76')](_0xf2b5('0x8e'),_0x203d4b['name'],_0x203d4b[_0xf2b5('0x8f')]||_0x203d4b[_0xf2b5('0x8a')][_0xf2b5('0x4c')]),'to':_0x1d3754[_0xf2b5('0x28')]['mailTranscript'],'subject':_0xf2b5('0x90'),'text':util['format'](_0xf2b5('0x91'),_0x1d3754[_0xf2b5('0x28')][_0xf2b5('0x74')]),'attachments':[{'path':_0x9aa106}]}})['then'](function(){return _0x498744;})[_0xf2b5('0x36')](function(_0x194a6c){logger['error'](_0x194a6c);});})[_0xf2b5('0x12')](respondWithStatusCode(_0x1485d9,0xc8))['catch'](handleError(_0x1485d9,null));};exports[_0xf2b5('0x92')]=function(_0x54b58e,_0x174daf){return db[_0xf2b5('0x58')][_0xf2b5('0x5c')]({'where':{'id':_0x54b58e[_0xf2b5('0x38')]['id']}})[_0xf2b5('0x12')](handleEntityNotFound(_0x174daf,null))[_0xf2b5('0x12')](function(_0x3efc25){if(_0x3efc25){return _0x3efc25[_0xf2b5('0x92')](_0x54b58e[_0xf2b5('0x28')][_0xf2b5('0x93')],_['omit'](_0x54b58e[_0xf2b5('0x28')],[_0xf2b5('0x93'),'id'])||{});}})['then'](respondWithResult(_0x174daf,null))[_0xf2b5('0x36')](handleError(_0x174daf,null));};exports[_0xf2b5('0x94')]=function(_0x57366a,_0x2cab17){var _0x4760a6={'raw':![],'where':{}};var _0x49178b={};var _0x5aac14={'count':0x0,'rows':[]};return db[_0xf2b5('0x2e')][_0xf2b5('0x46')]({'where':{'id':_0x57366a[_0xf2b5('0x38')]['id']}})[_0xf2b5('0x12')](handleEntityNotFound(_0x2cab17,null))[_0xf2b5('0x12')](function(_0x2f266f){if(_0x2f266f){_0x49178b[_0xf2b5('0x39')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x49178b[_0xf2b5('0x3b')]=_[_0xf2b5('0x3a')](_0x57366a[_0xf2b5('0x3b')]);_0x49178b['filters']=_[_0xf2b5('0x3c')](_0x49178b['model'],_0x49178b[_0xf2b5('0x3b')]);_0x4760a6['attributes']=_['intersection'](_0x49178b['model'],qs[_0xf2b5('0x3e')](_0x57366a[_0xf2b5('0x3b')][_0xf2b5('0x3e')]));_0x4760a6[_0xf2b5('0x3d')]=_0x4760a6['attributes'][_0xf2b5('0x3f')]?_0x4760a6[_0xf2b5('0x3d')]:_0x49178b[_0xf2b5('0x39')];if(!_0x57366a[_0xf2b5('0x3b')][_0xf2b5('0x95')](_0xf2b5('0x96'))){_0x4760a6[_0xf2b5('0x1f')]=qs['limit'](_0x57366a[_0xf2b5('0x3b')][_0xf2b5('0x1f')]);_0x4760a6[_0xf2b5('0x1d')]=qs[_0xf2b5('0x1d')](_0x57366a[_0xf2b5('0x3b')]['offset']);}_0x4760a6[_0xf2b5('0x97')]=qs['sort'](_0x57366a[_0xf2b5('0x3b')][_0xf2b5('0x98')]);_0x4760a6['where']=qs['filters'](_[_0xf2b5('0x99')](_0x57366a[_0xf2b5('0x3b')],_0x49178b[_0xf2b5('0x9a')]));_0x4760a6['where'][_0xf2b5('0x9b')]=_0x2f266f['id'];if(_0x57366a[_0xf2b5('0x3b')][_0xf2b5('0x9c')]){_0x4760a6[_0xf2b5('0x9d')]=_['merge'](_0x4760a6[_0xf2b5('0x9d')],{'$or':_[_0xf2b5('0x2d')](_0x4760a6[_0xf2b5('0x3d')],function(_0x4056ce){var _0x2b4d62={};_0x2b4d62[_0x4056ce]={'$like':'%'+_0x57366a['query']['filter']+'%'};return _0x2b4d62;})});}if(_0x57366a[_0xf2b5('0x3b')][_0xf2b5('0x9e')]){var _0x2b3a3d=_0x57366a[_0xf2b5('0x3b')][_0xf2b5('0x9e')][_0xf2b5('0x9f')](',');var _0x2982e2={};_0x2982e2[_0x2b3a3d[0x0]]={'$gte':moment(_0x2b3a3d[0x1])['format'](_0xf2b5('0xa0'))};_0x4760a6[_0xf2b5('0x9d')]=_[_0xf2b5('0x27')](_0x4760a6[_0xf2b5('0x9d')],_0x2982e2);}_0x4760a6=_['merge']({},_0x4760a6,_0x57366a['options']);return db['ChatMessage']['count']({'where':_0x4760a6['where']})[_0xf2b5('0x12')](function(_0x4edf05){_0x5aac14['count']=_0x4edf05;if(_0x57366a[_0xf2b5('0x3b')]['includeAll']){_0x4760a6[_0xf2b5('0x41')]=[{'all':!![]}];}return db[_0xf2b5('0x58')][_0xf2b5('0x34')](_0x4760a6);})['then'](function(_0x379299){_0x5aac14[_0xf2b5('0xa1')]=_0x379299;return _0x5aac14;});}})[_0xf2b5('0x12')](respondWithFilteredResult(_0x2cab17,_0x4760a6))['catch'](handleError(_0x2cab17,null));};exports[_0xf2b5('0xa2')]=function(_0x1b1216,_0x2fbcb0){var _0x1aeb44={'where':{}},_0xdf7ded={},_0x57742a={'count':0x0,'rows':[]};return db[_0xf2b5('0x2e')][_0xf2b5('0x46')]({'where':{'id':_0x1b1216[_0xf2b5('0x38')]['id']}})[_0xf2b5('0x12')](handleEntityNotFound(_0x2fbcb0,null))['then'](function(_0x163d82){if(_0x163d82){_0xdf7ded[_0xf2b5('0x39')]=_['keys'](db[_0xf2b5('0x58')][_0xf2b5('0x2f')]);_0xdf7ded['query']=_['keys'](_0x1b1216[_0xf2b5('0x3b')]);_0xdf7ded[_0xf2b5('0x9a')]=_[_0xf2b5('0x3c')](_0xdf7ded[_0xf2b5('0x39')],_0xdf7ded[_0xf2b5('0x3b')]);_0x1aeb44[_0xf2b5('0x3d')]=_[_0xf2b5('0x3c')](_0xdf7ded[_0xf2b5('0x39')],qs['fields'](_0x1b1216['query'][_0xf2b5('0x3e')]));_0x1aeb44[_0xf2b5('0x3d')]=_0x1aeb44[_0xf2b5('0x3d')][_0xf2b5('0x3f')]?_0x1aeb44['attributes']:_0xdf7ded[_0xf2b5('0x39')];if(!_0x1b1216[_0xf2b5('0x3b')][_0xf2b5('0x95')](_0xf2b5('0x96'))){_0x1aeb44['limit']=qs[_0xf2b5('0x1f')](_0x1b1216[_0xf2b5('0x3b')]['limit']);_0x1aeb44[_0xf2b5('0x1d')]=qs[_0xf2b5('0x1d')](_0x1b1216[_0xf2b5('0x3b')][_0xf2b5('0x1d')]);}_0x1aeb44[_0xf2b5('0x97')]=qs[_0xf2b5('0x98')](_0x1b1216['query']['sort']);_0x1aeb44[_0xf2b5('0x9d')]=qs[_0xf2b5('0x9a')](_[_0xf2b5('0x99')](_0x1b1216[_0xf2b5('0x3b')],_0xdf7ded['filters']));_0x1aeb44['where'][_0xf2b5('0x9b')]=_0x163d82['id'];if(_0x1b1216[_0xf2b5('0x3b')][_0xf2b5('0x9c')]){_0x1aeb44[_0xf2b5('0x9d')]=_[_0xf2b5('0x27')](_0x1aeb44[_0xf2b5('0x9d')],{'$or':_[_0xf2b5('0x2d')](_0x1aeb44[_0xf2b5('0x3d')],function(_0x3b932b){var _0x1d570f={};_0x1d570f[_0x3b932b]={'$like':'%'+_0x1b1216['query'][_0xf2b5('0x9c')]+'%'};return _0x1d570f;})});}_0x1aeb44[_0xf2b5('0x9d')][_0xf2b5('0x88')]=![];if(_0x1b1216[_0xf2b5('0x3b')]['id']){_0x1aeb44[_0xf2b5('0x9d')]['id']={'$gt':_0x1b1216[_0xf2b5('0x3b')]['id']};}_0x1aeb44=_[_0xf2b5('0x27')]({},_0x1aeb44,_0x1b1216[_0xf2b5('0x42')]);return db[_0xf2b5('0x58')][_0xf2b5('0xa3')]({'where':_0x1aeb44[_0xf2b5('0x9d')]})['then'](function(_0x1dee9d){_0x57742a[_0xf2b5('0xa3')]=_0x1dee9d;_0x1aeb44[_0xf2b5('0x41')]=[];if(_0x1b1216[_0xf2b5('0x3b')][_0xf2b5('0xa4')]){_0x1aeb44[_0xf2b5('0x41')]['push']({'model':db[_0xf2b5('0x79')],'as':_0xf2b5('0x79'),'attributes':['id',_0xf2b5('0x83'),'alias']});}if(_0x1b1216[_0xf2b5('0x3b')]['includeAll']){_0x1aeb44[_0xf2b5('0x41')]=[{'all':!![]}];}return db[_0xf2b5('0x58')]['findAll'](_0x1aeb44);})[_0xf2b5('0x12')](function(_0x5a1408){_0x57742a[_0xf2b5('0xa1')]=_0x5a1408;return _0x57742a;});}})[_0xf2b5('0x12')](respondWithFilteredResult(_0x2fbcb0,_0x1aeb44))[_0xf2b5('0x36')](handleError(_0x2fbcb0,null));};exports[_0xf2b5('0xa5')]=function(_0x238293,_0x32cacb){return db[_0xf2b5('0x2e')][_0xf2b5('0x5c')]({'where':{'id':_0x238293[_0xf2b5('0x38')]['id']}})[_0xf2b5('0x12')](handleEntityNotFound(_0x32cacb,null))[_0xf2b5('0x12')](function(_0x297663){if(_0x297663){return _0x297663[_0xf2b5('0xa6')](_0x238293[_0xf2b5('0x28')][_0xf2b5('0x93')],_[_0xf2b5('0xa7')](_0x238293[_0xf2b5('0x28')],[_0xf2b5('0x93'),'id'])||{})[_0xf2b5('0xa8')](function(){return db[_0xf2b5('0xa9')][_0xf2b5('0x34')]({'attributes':['id','name',_0xf2b5('0xaa')],'where':{'id':_0x238293[_0xf2b5('0x28')]['ids']}});})[_0xf2b5('0x12')](function(_0x3ef625){socket[_0xf2b5('0xab')]('chatInteractionTags:save',{'id':Number(_0x238293[_0xf2b5('0x38')]['id']),'tags':_0x3ef625||[]});return{'id':Number(_0x238293[_0xf2b5('0x38')]['id']),'tags':_0x3ef625||[]};});}})[_0xf2b5('0x12')](respondWithResult(_0x32cacb,null))[_0xf2b5('0x36')](handleError(_0x32cacb,null));};exports['removeTags']=function(_0x40eefb,_0x2303f8){return db[_0xf2b5('0x2e')]['find']({'where':{'id':_0x40eefb[_0xf2b5('0x38')]['id']}})[_0xf2b5('0x12')](handleEntityNotFound(_0x2303f8,null))[_0xf2b5('0x12')](function(_0x56cc8c){if(_0x56cc8c){return _0x56cc8c[_0xf2b5('0xac')](_0x40eefb[_0xf2b5('0x3b')][_0xf2b5('0x93')]);}})[_0xf2b5('0x12')](respondWithStatusCode(_0x2303f8,null))['catch'](handleError(_0x2303f8,null));};exports[_0xf2b5('0x72')]=function(_0x29e655,_0x55d5c7){var _0x9622d4=moment()[_0xf2b5('0xad')]()['toString']();var _0x5afad7=path[_0xf2b5('0x6e')](config[_0xf2b5('0x6f')],_0xf2b5('0xae'),'files',_0xf2b5('0xaf'));var _0x25b7d2=path['join'](config[_0xf2b5('0x6f')],'server',_0xf2b5('0xb0'),'attachments');var _0x3aed7c=path[_0xf2b5('0x6e')](_0x5afad7,_0x9622d4);var _0x55fbe5=util[_0xf2b5('0x76')]('transcript-%d-%s.zip',_0x29e655[_0xf2b5('0x38')]['id'],_0x9622d4);var _0x1ff790=path[_0xf2b5('0x6e')](_0x5afad7,_0x55fbe5);var _0x1b906c=[];_0x1b906c['push']({'model':db[_0xf2b5('0x79')],'as':_0xf2b5('0x79'),'attributes':['id',_0xf2b5('0x83')],'raw':!![]});_0x1b906c['push']({'model':db[_0xf2b5('0x5d')],'as':_0xf2b5('0x5e'),'attributes':['id',_0xf2b5('0xb1'),'lastName'],'raw':!![]});if(_0x29e655[_0xf2b5('0x3b')][_0xf2b5('0xb2')]){_0x1b906c['push']({'model':db[_0xf2b5('0x6a')],'as':_0xf2b5('0x6a'),'raw':!![]});}var _0x46165b=[{'model':db[_0xf2b5('0x58')],'as':_0xf2b5('0x78'),'attributes':['id','body',_0xf2b5('0x86'),_0xf2b5('0xb3'),_0xf2b5('0x88'),_0xf2b5('0xb4')],'include':_0x1b906c}];_0x46165b[_0xf2b5('0xb5')]({'model':db['ChatWebsite'],'as':_0xf2b5('0xb6'),'attributes':['id','name']});_0x46165b[_0xf2b5('0xb5')]({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db['ChatInteraction'][_0xf2b5('0x5c')]({'where':{'id':_0x29e655[_0xf2b5('0x38')]['id']},'include':_0x46165b})['then'](handleEntityNotFound(_0x55d5c7,null))['then'](function(_0x460e65){if(_0x460e65){var _0x2ca175=_0x460e65['get']({'plain':!![]});fs[_0xf2b5('0xb7')](_0x3aed7c);var _0x38bc5e={'channel':'Chat','account':_0x2ca175['Account']['name'],'agent':_0x2ca175[_0xf2b5('0xb8')]?_0x2ca175['Owner'][_0xf2b5('0x83')]:_0xf2b5('0xb9'),'createdAt':moment(_0x2ca175['createdAt'])[_0xf2b5('0x76')](_0xf2b5('0xa0'))[_0xf2b5('0xba')](),'closedAt':_0x2ca175[_0xf2b5('0x64')]?moment(_0x2ca175[_0xf2b5('0xbb')])[_0xf2b5('0x76')](_0xf2b5('0xa0'))['toString']():'','disposition':_0x2ca175[_0xf2b5('0xbc')],'chatInfo':{'browser':_0x2ca175[_0xf2b5('0xbd')],'os':_0x2ca175[_0xf2b5('0xbe')],'referer':_0x2ca175[_0xf2b5('0xbf')],'customerIp':_0x2ca175[_0xf2b5('0xc0')],'customerPort':_0x2ca175[_0xf2b5('0xc1')]?_0x2ca175[_0xf2b5('0xc1')]:'N.A.'},'messages':_(_0x2ca175[_0xf2b5('0x78')])[_0xf2b5('0xc2')]()['filter']({'secret':![]})[_0xf2b5('0x2d')](function(_0xe38fbe){if(_0xe38fbe[_0xf2b5('0x6a')]){var _0x122bea=path[_0xf2b5('0x6e')](_0x25b7d2,_0xe38fbe[_0xf2b5('0x6a')][_0xf2b5('0x66')]);if(fs[_0xf2b5('0xc3')](_0x122bea)){fs[_0xf2b5('0xc4')](_0x122bea)[_0xf2b5('0xc5')](fs[_0xf2b5('0xc6')](path[_0xf2b5('0x6e')](_0x3aed7c,_0xe38fbe[_0xf2b5('0x6a')][_0xf2b5('0x66')])));}}return{'date':moment(_0xe38fbe[_0xf2b5('0x86')])[_0xf2b5('0x76')](_0xf2b5('0xa0'))[_0xf2b5('0xba')](),'sender':_0xe38fbe[_0xf2b5('0xb3')]===_0xf2b5('0xc7')?_0xe38fbe[_0xf2b5('0x79')]?_0xe38fbe[_0xf2b5('0x79')][_0xf2b5('0x83')]:_0xf2b5('0x7d'):_0xe38fbe[_0xf2b5('0x5e')]['firstName']+(_0xe38fbe[_0xf2b5('0x5e')]['lastName']?'\x20'+_0xe38fbe[_0xf2b5('0x5e')][_0xf2b5('0xc8')]:''),'body':_0xe38fbe[_0xf2b5('0x6a')]?_0xe38fbe['Attachment'][_0xf2b5('0x66')]:_0xe38fbe[_0xf2b5('0x28')],'direction':_0xe38fbe[_0xf2b5('0xb3')]===_0xf2b5('0xc7')?'A':'C','secret':_0xe38fbe[_0xf2b5('0x88')],'read':_0xe38fbe[_0xf2b5('0xb4')],'attachment':_0xe38fbe[_0xf2b5('0x6a')]};})[_0xf2b5('0xc9')]()};return ejs['renderFile'](path[_0xf2b5('0x6e')](config[_0xf2b5('0x6f')],_0xf2b5('0xae'),_0xf2b5('0xca'),'downloadInteraction.ejs'),{'interaction':_0x38bc5e})[_0xf2b5('0x12')](function(_0x261c7d){var _0x361052=path[_0xf2b5('0x6e')](_0x3aed7c,_0xf2b5('0xcb')+_0x2ca175['id']+'-'+_0x9622d4+_0xf2b5('0xcc'));var _0xafc7c7={'path':_0x361052,'channel':_0xf2b5('0xcd'),'interactionId':_0x2ca175['id']};return pdf[_0xf2b5('0xce')](_0x261c7d,_0xafc7c7);})[_0xf2b5('0x12')](function(){return new Promise(function(_0x47bbe1,_0x5620c0){zipdir(_0x3aed7c,{'saveTo':_0x1ff790},function(_0x3e400a,_0x4bfba5){if(_0x3e400a)return _0x5620c0(_0x3e400a);return _0x47bbe1(_0x4bfba5);});})[_0xf2b5('0x12')](function(){return new BPromise(function(_0x2059c2,_0xde1046){rimraf(_0x3aed7c,function(_0x4f8d32){if(_0x4f8d32)_0xde1046(_0x4f8d32);return _0x2059c2();});});})['then'](function(){return _0x55d5c7[_0xf2b5('0x72')](_0x1ff790,_0x55fbe5,function(_0x397524){if(_0x397524){logger[_0xf2b5('0x16')](_0xf2b5('0xcf'),_0x397524);}else{fs['unlinkSync'](_0x1ff790);}});});});}else{return _0x55d5c7['sendStatus'](0xc8);}})[_0xf2b5('0x36')](handleError(_0x55d5c7,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 8b43a83..c3f8fb9 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 _0x8cc0=['save','update','remove','setDataValue','findAll','then','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','setMaxListeners'];(function(_0x1487e4,_0x584812){var _0x1f9354=function(_0x5b6306){while(--_0x5b6306){_0x1487e4['push'](_0x1487e4['shift']());}};_0x1f9354(++_0x584812);}(_0x8cc0,0x7c));var _0x08cc=function(_0x26ba65,_0x4b4d0c){_0x26ba65=_0x26ba65-0x0;var _0x133ae2=_0x8cc0[_0x26ba65];return _0x133ae2;};'use strict';var EventEmitter=require(_0x08cc('0x0'));var ChatInteraction=require(_0x08cc('0x1'))['db'][_0x08cc('0x2')];var ChatMessage=require(_0x08cc('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x08cc('0x3')](0x0);var events={'afterCreate':_0x08cc('0x4'),'afterUpdate':_0x08cc('0x5'),'afterDestroy':_0x08cc('0x6')};function emitEvent(_0x4e3407){return function(_0x1c2f15,_0x10719d,_0x34c55e){_0x1c2f15['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1fe02b){_0x1c2f15[_0x08cc('0x7')]('Users',_0x1fe02b['map'](function(_0x54b019){return{'id':_0x54b019['id']};}));return ChatMessage[_0x08cc('0x8')]({'where':{'ChatInteractionId':_0x1c2f15['id'],'direction':'in','read':![]},'raw':!![]});})[_0x08cc('0x9')](function(_0x462a6a){_0x1c2f15[_0x08cc('0x7')]('unreadMessages',_0x462a6a[_0x08cc('0xa')]);ChatInteractionEvents[_0x08cc('0xb')](_0x4e3407+':'+_0x1c2f15['id'],_0x1c2f15);ChatInteractionEvents[_0x08cc('0xb')](_0x4e3407,_0x1c2f15);_0x34c55e(null);})[_0x08cc('0xc')](_0x34c55e(null));};}for(var e in events){if(events[_0x08cc('0xd')](e)){var event=events[e];ChatInteraction[_0x08cc('0xe')](e,emitEvent(event));}}module[_0x08cc('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x0615=['getUsers','setDataValue','map','findAll','then','unreadMessages','length','catch','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove'];(function(_0x1a3ce8,_0x21bc10){var _0x554169=function(_0x1b5daa){while(--_0x1b5daa){_0x1a3ce8['push'](_0x1a3ce8['shift']());}};_0x554169(++_0x21bc10);}(_0x0615,0x64));var _0x5061=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0615[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x5061('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x5061('0x1')];var ChatMessage=require(_0x5061('0x2'))['db'][_0x5061('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5061('0x4')](0x0);var events={'afterCreate':_0x5061('0x5'),'afterUpdate':_0x5061('0x6'),'afterDestroy':_0x5061('0x7')};function emitEvent(_0x4ff904){return function(_0x37278c,_0x1e699b,_0x26caef){_0x37278c[_0x5061('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x20fb6b){_0x37278c[_0x5061('0x9')]('Users',_0x20fb6b[_0x5061('0xa')](function(_0x3b2c15){return{'id':_0x3b2c15['id']};}));return ChatMessage[_0x5061('0xb')]({'where':{'ChatInteractionId':_0x37278c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5061('0xc')](function(_0x1712dd){_0x37278c[_0x5061('0x9')](_0x5061('0xd'),_0x1712dd[_0x5061('0xe')]);ChatInteractionEvents['emit'](_0x4ff904+':'+_0x37278c['id'],_0x37278c);ChatInteractionEvents['emit'](_0x4ff904,_0x37278c);_0x26caef(null);})[_0x5061('0xf')](_0x26caef(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x5061('0x10')](e,emitEvent(event));}}module[_0x5061('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 6190913..5ea5ff4 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 _0x4655=['bluebird','path','rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x433b5f,_0xe46c0){var _0x315b75=function(_0x1cda78){while(--_0x1cda78){_0x433b5f['push'](_0x433b5f['shift']());}};_0x315b75(++_0xe46c0);}(_0x4655,0x11d));var _0x5465=function(_0x259f79,_0x3dda4a){_0x259f79=_0x259f79-0x0;var _0xfe940=_0x4655[_0x259f79];return _0xfe940;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5465('0x0'))(_0x5465('0x1'));var moment=require(_0x5465('0x2'));var BPromise=require(_0x5465('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5465('0x4'));var rimraf=require(_0x5465('0x5'));var config=require('../../config/environment');var attributes=require(_0x5465('0x6'));module[_0x5465('0x7')]=function(_0x4f0a5a,_0x4ebe4d){return _0x4f0a5a[_0x5465('0x8')](_0x5465('0x9'),attributes,{'tableName':_0x5465('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a5f0e,_0x33668d,_0x52ec90){if(_0x1a5f0e[_0x5465('0xb')](_0x5465('0xc'))){_0x1a5f0e[_0x5465('0xd')]=moment()[_0x5465('0xe')](_0x5465('0xf'));}_0x52ec90(null,_0x1a5f0e);}},'charset':_0x5465('0x10'),'collate':_0x5465('0x11')});}; \ No newline at end of file +var _0xeee1=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','chat_interactions','changed','closed','closedAt'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0xeee1,0x188));var _0x1eee=function(_0x2192eb,_0x5bd6d3){_0x2192eb=_0x2192eb-0x0;var _0x9f6bf8=_0xeee1[_0x2192eb];return _0x9f6bf8;};'use strict';var _=require(_0x1eee('0x0'));var util=require('util');var logger=require(_0x1eee('0x1'))('api');var moment=require(_0x1eee('0x2'));var BPromise=require(_0x1eee('0x3'));var rp=require(_0x1eee('0x4'));var fs=require('fs');var path=require(_0x1eee('0x5'));var rimraf=require(_0x1eee('0x6'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0x1eee('0x7')]=function(_0x4e31aa,_0x1fe905){return _0x4e31aa[_0x1eee('0x8')]('ChatInteraction',attributes,{'tableName':_0x1eee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x521d26,_0x257aa7,_0x5ebe57){if(_0x521d26[_0x1eee('0xa')](_0x1eee('0xb'))){_0x521d26[_0x1eee('0xc')]=moment()[_0x1eee('0xd')](_0x1eee('0xe'));}_0x5ebe57(null,_0x521d26);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index b7e40ec..2e7e5c1 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 _0xb5b5=['omit','spread','AddTags','debug','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes','then','catch','AddTagsToChatInteraction','find','addTags','ids'];(function(_0x568c05,_0x4a3932){var _0xfaf243=function(_0xd0055e){while(--_0xd0055e){_0x568c05['push'](_0x568c05['shift']());}};_0xfaf243(++_0x4a3932);}(_0xb5b5,0x1d2));var _0x5b5b=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0xb5b5[_0x26f1b2];return _0x1624a4;};'use strict';var _=require('lodash');var util=require(_0x5b5b('0x0'));var moment=require(_0x5b5b('0x1'));var BPromise=require('bluebird');var rs=require(_0x5b5b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b5b('0x3'))['db'];var utils=require(_0x5b5b('0x4'));var logger=require(_0x5b5b('0x5'))('rpc');var config=require(_0x5b5b('0x6'));var jayson=require(_0x5b5b('0x7'));var client=jayson[_0x5b5b('0x8')][_0x5b5b('0x9')]({'port':0x232a});config[_0x5b5b('0xa')]=_[_0x5b5b('0xb')](config[_0x5b5b('0xa')],{'host':_0x5b5b('0xc'),'port':0x18eb});var socket=require(_0x5b5b('0xd'))(new Redis(config['redis']));require(_0x5b5b('0xe'))[_0x5b5b('0xf')](socket);function respondWithRpcPromise(_0x2a3737,_0x25f292,_0x5c66c4){return new BPromise(function(_0x5ab64f,_0x480029){return client[_0x5b5b('0x10')](_0x2a3737,_0x5c66c4)['then'](function(_0x3738e6){logger[_0x5b5b('0x11')](_0x5b5b('0x12'),_0x25f292,_0x5b5b('0x13'));logger['debug'](_0x5b5b('0x14'),_0x25f292,_0x5b5b('0x13'),JSON['stringify'](_0x3738e6));if(_0x3738e6[_0x5b5b('0x15')]){if(_0x3738e6[_0x5b5b('0x15')][_0x5b5b('0x16')]===0x1f4){logger[_0x5b5b('0x15')](_0x5b5b('0x12'),_0x25f292,_0x3738e6[_0x5b5b('0x15')]['message']);return _0x480029(_0x3738e6[_0x5b5b('0x15')][_0x5b5b('0x17')]);}logger[_0x5b5b('0x15')](_0x5b5b('0x12'),_0x25f292,_0x3738e6[_0x5b5b('0x15')][_0x5b5b('0x17')]);return _0x5ab64f(_0x3738e6['error']['message']);}else{logger[_0x5b5b('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x25f292,_0x5b5b('0x13'));_0x5ab64f(_0x3738e6[_0x5b5b('0x18')]['message']);}})['catch'](function(_0x210ee9){logger['error'](_0x5b5b('0x12'),_0x25f292,_0x210ee9);_0x480029(_0x210ee9);});});}exports[_0x5b5b('0x19')]=function(_0x30cb58){var _0x6f0d90=this;return new Promise(function(_0x5d3127,_0xcce540){return db[_0x5b5b('0x1a')][_0x5b5b('0x1b')](_0x30cb58[_0x5b5b('0x1c')],{'raw':_0x30cb58[_0x5b5b('0x1d')]?_0x30cb58[_0x5b5b('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30cb58[_0x5b5b('0x1d')]?_0x30cb58[_0x5b5b('0x1d')][_0x5b5b('0x1e')]||null:null,'attributes':_0x30cb58[_0x5b5b('0x1d')]?_0x30cb58['options'][_0x5b5b('0x1f')]||null:null,'limit':_0x30cb58[_0x5b5b('0x1d')]?_0x30cb58[_0x5b5b('0x1d')]['limit']||null:null})[_0x5b5b('0x20')](function(_0x356c15){logger['info']('UpdateChatInteraction',_0x30cb58);logger['debug'](_0x5b5b('0x19'),_0x30cb58,JSON['stringify'](_0x356c15));_0x5d3127(_0x356c15);})[_0x5b5b('0x21')](function(_0x189f5a){logger[_0x5b5b('0x15')](_0x5b5b('0x19'),_0x189f5a[_0x5b5b('0x17')],_0x30cb58);_0xcce540(_0x6f0d90['error'](0x1f4,_0x189f5a[_0x5b5b('0x17')]));});});};exports[_0x5b5b('0x22')]=function(_0x345bc1){return new Promise(function(_0x2b6a2f,_0x1d6c96){return db['ChatInteraction'][_0x5b5b('0x23')]({'where':_0x345bc1[_0x5b5b('0x1d')]?_0x345bc1[_0x5b5b('0x1d')][_0x5b5b('0x1e')]||null:null})['then'](function(_0x48e951){if(_0x48e951){return _0x48e951[_0x5b5b('0x24')](_0x345bc1[_0x5b5b('0x1c')][_0x5b5b('0x25')],_[_0x5b5b('0x26')](_0x345bc1[_0x5b5b('0x1c')],['ids','id'])||{});}})[_0x5b5b('0x27')](function(_0x1493b2){logger[_0x5b5b('0x11')](_0x5b5b('0x28'),_0x345bc1);logger[_0x5b5b('0x29')]('AddTags',_0x345bc1,JSON['stringify'](_0x1493b2));_0x2b6a2f(_0x1493b2);})['catch'](function(_0x1c78b3){logger[_0x5b5b('0x15')](_0x5b5b('0x28'),_0x1c78b3['message'],_0x345bc1);_0x1d6c96(_this['error'](0x1f4,_0x1c78b3[_0x5b5b('0x17')]));});});}; \ No newline at end of file +var _0x42ee=['code','message','info','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','then','find','addTags','ids','omit','AddTags','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','register','request','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x178ce9,_0x150618){var _0x3c2d98=function(_0x28a5b7){while(--_0x28a5b7){_0x178ce9['push'](_0x178ce9['shift']());}};_0x3c2d98(++_0x150618);}(_0x42ee,0xe1));var _0xe42e=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0x42ee[_0x4bd950];return _0x5dc59a;};'use strict';var _=require(_0xe42e('0x0'));var util=require('util');var moment=require(_0xe42e('0x1'));var BPromise=require(_0xe42e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe42e('0x3'));var db=require(_0xe42e('0x4'))['db'];var utils=require(_0xe42e('0x5'));var logger=require(_0xe42e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe42e('0x7')][_0xe42e('0x8')]({'port':0x232a});config[_0xe42e('0x9')]=_[_0xe42e('0xa')](config[_0xe42e('0x9')],{'host':_0xe42e('0xb'),'port':0x18eb});var socket=require(_0xe42e('0xc'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0xe42e('0xd')](socket);function respondWithRpcPromise(_0x24bc2b,_0x1a3d07,_0x88a13a){return new BPromise(function(_0x2eb509,_0x516a35){return client[_0xe42e('0xe')](_0x24bc2b,_0x88a13a)['then'](function(_0x55b2cb){logger['info'](_0xe42e('0xf'),_0x1a3d07,'request\x20sent');logger[_0xe42e('0x10')](_0xe42e('0x11'),_0x1a3d07,_0xe42e('0x12'),JSON[_0xe42e('0x13')](_0x55b2cb));if(_0x55b2cb['error']){if(_0x55b2cb[_0xe42e('0x14')][_0xe42e('0x15')]===0x1f4){logger[_0xe42e('0x14')](_0xe42e('0xf'),_0x1a3d07,_0x55b2cb[_0xe42e('0x14')][_0xe42e('0x16')]);return _0x516a35(_0x55b2cb[_0xe42e('0x14')][_0xe42e('0x16')]);}logger[_0xe42e('0x14')](_0xe42e('0xf'),_0x1a3d07,_0x55b2cb[_0xe42e('0x14')][_0xe42e('0x16')]);return _0x2eb509(_0x55b2cb[_0xe42e('0x14')][_0xe42e('0x16')]);}else{logger[_0xe42e('0x17')](_0xe42e('0xf'),_0x1a3d07,_0xe42e('0x12'));_0x2eb509(_0x55b2cb[_0xe42e('0x18')]['message']);}})['catch'](function(_0x3ecce4){logger[_0xe42e('0x14')](_0xe42e('0xf'),_0x1a3d07,_0x3ecce4);_0x516a35(_0x3ecce4);});});}exports[_0xe42e('0x19')]=function(_0x481dfe){var _0x34707d=this;return new Promise(function(_0x220d68,_0x808c27){return db[_0xe42e('0x1a')][_0xe42e('0x1b')](_0x481dfe[_0xe42e('0x1c')],{'raw':_0x481dfe['options']?_0x481dfe[_0xe42e('0x1d')][_0xe42e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x481dfe[_0xe42e('0x1d')]?_0x481dfe['options'][_0xe42e('0x1f')]||null:null,'attributes':_0x481dfe[_0xe42e('0x1d')]?_0x481dfe['options'][_0xe42e('0x20')]||null:null,'limit':_0x481dfe[_0xe42e('0x1d')]?_0x481dfe[_0xe42e('0x1d')][_0xe42e('0x21')]||null:null})[_0xe42e('0x22')](function(_0x1324a9){logger['info'](_0xe42e('0x19'),_0x481dfe);logger[_0xe42e('0x10')](_0xe42e('0x19'),_0x481dfe,JSON[_0xe42e('0x13')](_0x1324a9));_0x220d68(_0x1324a9);})['catch'](function(_0x11279a){logger['error']('UpdateChatInteraction',_0x11279a[_0xe42e('0x16')],_0x481dfe);_0x808c27(_0x34707d[_0xe42e('0x14')](0x1f4,_0x11279a[_0xe42e('0x16')]));});});};exports['AddTagsToChatInteraction']=function(_0x41e1e1){return new Promise(function(_0x2da0c7,_0x2bdbf5){return db[_0xe42e('0x1a')][_0xe42e('0x23')]({'where':_0x41e1e1[_0xe42e('0x1d')]?_0x41e1e1['options'][_0xe42e('0x1f')]||null:null})[_0xe42e('0x22')](function(_0x3f03e0){if(_0x3f03e0){return _0x3f03e0[_0xe42e('0x24')](_0x41e1e1[_0xe42e('0x1c')][_0xe42e('0x25')],_[_0xe42e('0x26')](_0x41e1e1[_0xe42e('0x1c')],['ids','id'])||{});}})['spread'](function(_0x5df499){logger[_0xe42e('0x17')](_0xe42e('0x27'),_0x41e1e1);logger['debug'](_0xe42e('0x27'),_0x41e1e1,JSON[_0xe42e('0x13')](_0x5df499));_0x2da0c7(_0x5df499);})[_0xe42e('0x28')](function(_0x50032a){logger[_0xe42e('0x14')](_0xe42e('0x27'),_0x50032a[_0xe42e('0x16')],_0x41e1e1);_0x2bdbf5(_this['error'](0x1f4,_0x50032a[_0xe42e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 1de09ec..f5ace82 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 _0x76ff=['./chatInteraction.events','save','emit','removeListener','register','length'];(function(_0x5766f1,_0x1feaa6){var _0x507999=function(_0x632a1a){while(--_0x632a1a){_0x5766f1['push'](_0x5766f1['shift']());}};_0x507999(++_0x1feaa6);}(_0x76ff,0xa8));var _0xf76f=function(_0x4a8963,_0x148027){_0x4a8963=_0x4a8963-0x0;var _0x572fa9=_0x76ff[_0x4a8963];return _0x572fa9;};'use strict';var ChatInteractionEvents=require(_0xf76f('0x0'));var events=[_0xf76f('0x1'),'remove','update'];function createListener(_0x20f55c,_0x546992){return function(_0x1201b7){_0x546992[_0xf76f('0x2')](_0x20f55c,_0x1201b7);};}function removeListener(_0x3e19a2,_0x11b1de){return function(){ChatInteractionEvents[_0xf76f('0x3')](_0x3e19a2,_0x11b1de);};}exports[_0xf76f('0x4')]=function(_0x1aa763){for(var _0x47f244=0x0,_0x1315fa=events[_0xf76f('0x5')];_0x47f244<_0x1315fa;_0x47f244++){var _0x493f22=events[_0x47f244];var _0x2fb5b5=createListener('chatInteraction:'+_0x493f22,_0x1aa763);ChatInteractionEvents['on'](_0x493f22,_0x2fb5b5);}}; \ No newline at end of file +var _0x83cc=['update','removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x2e2f64,_0x5a7677){var _0x398dba=function(_0x627a6){while(--_0x627a6){_0x2e2f64['push'](_0x2e2f64['shift']());}};_0x398dba(++_0x5a7677);}(_0x83cc,0x115));var _0xc83c=function(_0xdb5808,_0x58c067){_0xdb5808=_0xdb5808-0x0;var _0x111072=_0x83cc[_0xdb5808];return _0x111072;};'use strict';var ChatInteractionEvents=require(_0xc83c('0x0'));var events=[_0xc83c('0x1'),_0xc83c('0x2'),_0xc83c('0x3')];function createListener(_0x4ec98b,_0x3b1082){return function(_0x424cc0){_0x3b1082['emit'](_0x4ec98b,_0x424cc0);};}function removeListener(_0x4c0bb7,_0x4f8e30){return function(){ChatInteractionEvents[_0xc83c('0x4')](_0x4c0bb7,_0x4f8e30);};}exports[_0xc83c('0x5')]=function(_0x4d0639){for(var _0x4a0e00=0x0,_0x484002=events[_0xc83c('0x6')];_0x4a0e00<_0x484002;_0x4a0e00++){var _0x541a71=events[_0x4a0e00];var _0x8d1208=createListener(_0xc83c('0x7')+_0x541a71,_0x4d0639);ChatInteractionEvents['on'](_0x541a71,_0x8d1208);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index d0ff9cd..6610520 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 _0xb11d=['chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','delete','destroy','removeTags','util','connect-timeout','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked'];(function(_0x1703d1,_0x34a1db){var _0x1d8ed6=function(_0x1160ee){while(--_0x1160ee){_0x1703d1['push'](_0x1703d1['shift']());}};_0x1d8ed6(++_0x34a1db);}(_0xb11d,0x1d0));var _0xdb11=function(_0x40044c,_0x5b37c7){_0x40044c=_0x40044c-0x0;var _0x5d6177=_0xb11d[_0x40044c];return _0x5d6177;};'use strict';var multer=require('multer');var util=require(_0xdb11('0x0'));var path=require('path');var timeout=require(_0xdb11('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdb11('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xdb11('0x3'));var controller=require('./chatInteraction.controller');router[_0xdb11('0x4')]('/',auth[_0xdb11('0x5')](),controller[_0xdb11('0x6')]);router[_0xdb11('0x4')](_0xdb11('0x7'),auth[_0xdb11('0x5')](),controller[_0xdb11('0x8')]);router[_0xdb11('0x4')](_0xdb11('0x9'),auth[_0xdb11('0xa')](),controller['show']);router[_0xdb11('0x4')](_0xdb11('0xb'),auth['isChatInteractionAuthorized'](),controller[_0xdb11('0xc')]);router[_0xdb11('0x4')](_0xdb11('0xd'),auth[_0xdb11('0x5')](),controller[_0xdb11('0xe')]);router[_0xdb11('0x4')](_0xdb11('0xf'),auth[_0xdb11('0xa')](),controller[_0xdb11('0x10')]);router[_0xdb11('0x4')]('/:id/download',auth[_0xdb11('0x5')](),controller[_0xdb11('0x11')]);router[_0xdb11('0x12')]('/',auth[_0xdb11('0x5')](),controller[_0xdb11('0x13')]);router[_0xdb11('0x12')](_0xdb11('0x14'),auth[_0xdb11('0x5')](),controller[_0xdb11('0x15')]);var upload=multer({'storage':multer[_0xdb11('0x16')]({'destination':function(_0x39acd3,_0x15f38f,_0x40bcfa){_0x40bcfa(null,path[_0xdb11('0x17')](config[_0xdb11('0x18')],_0xdb11('0x19')));},'filename':function(_0x5c1316,_0x10763f,_0x34da73){_0x34da73(null,util[_0xdb11('0x1a')](_0xdb11('0x1b'),Date['now'](),_0x10763f[_0xdb11('0x1c')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xdb11('0x1d'),upload[_0xdb11('0x1e')](_0xdb11('0x1f')),controller[_0xdb11('0x20')]);router[_0xdb11('0x12')]('/:id/messages',auth[_0xdb11('0xa')](),controller[_0xdb11('0x21')]);router[_0xdb11('0x12')](_0xdb11('0x22'),auth[_0xdb11('0x5')](),interaction[_0xdb11('0x23')](_0xdb11('0x24'),_0xdb11('0x25')),controller[_0xdb11('0x26')]);router[_0xdb11('0x27')](_0xdb11('0x9'),auth[_0xdb11('0x5')](),interaction[_0xdb11('0x23')](_0xdb11('0x24'),_0xdb11('0x28')),controller[_0xdb11('0x29')]);router[_0xdb11('0x27')](_0xdb11('0x2a'),controller[_0xdb11('0x2b')]);router[_0xdb11('0x27')](_0xdb11('0x2c'),auth[_0xdb11('0xa')](),controller[_0xdb11('0x2d')]);router['put']('/:id/close',controller[_0xdb11('0x2e')]);router[_0xdb11('0x2f')](_0xdb11('0x9'),auth[_0xdb11('0x5')](),interaction['tracked'](_0xdb11('0x24'),'chatinteraction:destroy'),controller[_0xdb11('0x30')]);router[_0xdb11('0x2f')]('/:id/tags',auth[_0xdb11('0x5')](),controller[_0xdb11('0x31')]);module['exports']=router; \ No newline at end of file +var _0xc013=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','getMessages','getMyMessages','download','post','create','/:id/vidaoo','diskStorage','format','%s-%s','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','customUpdate','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','multer'];(function(_0x54ad34,_0x6659ed){var _0x1060c9=function(_0x34f561){while(--_0x34f561){_0x54ad34['push'](_0x54ad34['shift']());}};_0x1060c9(++_0x6659ed);}(_0xc013,0x14f));var _0x3c01=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0xc013[_0x99868f];return _0x27a71b;};'use strict';var multer=require(_0x3c01('0x0'));var util=require(_0x3c01('0x1'));var path=require(_0x3c01('0x2'));var timeout=require(_0x3c01('0x3'));var express=require(_0x3c01('0x4'));var router=express[_0x3c01('0x5')]();var fs_extra=require(_0x3c01('0x6'));var auth=require(_0x3c01('0x7'));var interaction=require(_0x3c01('0x8'));var config=require('../../config/environment');var controller=require(_0x3c01('0x9'));router[_0x3c01('0xa')]('/',auth[_0x3c01('0xb')](),controller['index']);router[_0x3c01('0xa')](_0x3c01('0xc'),auth[_0x3c01('0xb')](),controller[_0x3c01('0xd')]);router[_0x3c01('0xa')](_0x3c01('0xe'),auth[_0x3c01('0xf')](),controller[_0x3c01('0x10')]);router[_0x3c01('0xa')](_0x3c01('0x11'),auth[_0x3c01('0xf')](),controller['attachmentDownload']);router['get']('/:id/messages',auth[_0x3c01('0xb')](),controller[_0x3c01('0x12')]);router[_0x3c01('0xa')]('/:id/my_messages',auth['isChatInteractionAuthorized'](),controller[_0x3c01('0x13')]);router[_0x3c01('0xa')]('/:id/download',auth[_0x3c01('0xb')](),controller[_0x3c01('0x14')]);router[_0x3c01('0x15')]('/',auth[_0x3c01('0xb')](),controller[_0x3c01('0x16')]);router[_0x3c01('0x15')](_0x3c01('0x17'),auth[_0x3c01('0xb')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x3c01('0x18')]({'destination':function(_0x40c2c0,_0x1e10d3,_0x3d42bd){_0x3d42bd(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x518d2c,_0x2dc23e,_0x8a59ca){_0x8a59ca(null,util[_0x3c01('0x19')](_0x3c01('0x1a'),Date['now'](),_0x2dc23e['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x3c01('0x1b'),upload[_0x3c01('0x1c')](_0x3c01('0x1d')),controller[_0x3c01('0x1e')]);router[_0x3c01('0x15')](_0x3c01('0x1f'),auth[_0x3c01('0xf')](),controller[_0x3c01('0x20')]);router[_0x3c01('0x15')](_0x3c01('0x21'),auth[_0x3c01('0xb')](),interaction[_0x3c01('0x22')](_0x3c01('0x23'),_0x3c01('0x24')),controller[_0x3c01('0x25')]);router[_0x3c01('0x26')](_0x3c01('0xe'),auth[_0x3c01('0xb')](),interaction[_0x3c01('0x22')](_0x3c01('0x23'),_0x3c01('0x27')),controller[_0x3c01('0x28')]);router[_0x3c01('0x26')]('/:id/custom_update',controller[_0x3c01('0x29')]);router[_0x3c01('0x26')]('/:id/abandon',auth[_0x3c01('0xf')](),controller[_0x3c01('0x2a')]);router[_0x3c01('0x26')](_0x3c01('0x2b'),controller['close']);router[_0x3c01('0x2c')](_0x3c01('0xe'),auth['isAuthenticated'](),interaction[_0x3c01('0x22')](_0x3c01('0x23'),_0x3c01('0x2d')),controller[_0x3c01('0x2e')]);router[_0x3c01('0x2c')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3c01('0x2f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 3311cd0..30fb9bb 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 _0xb995=['medium','exports','TEXT'];(function(_0x4d875f,_0x2c7732){var _0x1671e0=function(_0x5f15e8){while(--_0x5f15e8){_0x4d875f['push'](_0x4d875f['shift']());}};_0x1671e0(++_0x2c7732);}(_0xb995,0x94));var _0x5b99=function(_0x5e4d4a,_0x2322e1){_0x5e4d4a=_0x5e4d4a-0x0;var _0x19fbd3=_0xb995[_0x5e4d4a];return _0x19fbd3;};'use strict';var Sequelize=require('sequelize');module[_0x5b99('0x0')]={'body':{'type':Sequelize[_0x5b99('0x1')](_0x5b99('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe3b3=['medium','BOOLEAN','sequelize','TEXT'];(function(_0xd98e38,_0xfae9f4){var _0x28b0cd=function(_0xc6414f){while(--_0xc6414f){_0xd98e38['push'](_0xd98e38['shift']());}};_0x28b0cd(++_0xfae9f4);}(_0xe3b3,0x18e));var _0x3e3b=function(_0x44f3a4,_0x2f889e){_0x44f3a4=_0x44f3a4-0x0;var _0x2294a2=_0xe3b3[_0x44f3a4];return _0x2294a2;};'use strict';var Sequelize=require(_0x3e3b('0x0'));module['exports']={'body':{'type':Sequelize[_0x3e3b('0x1')](_0x3e3b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3e3b('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 639de11..77fc162 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 _0x983e=['User','findAll','agent','admin','user','fullname','role','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','isEmpty','resourceId','push','messages','FromId','ToId','read','body','-createdAt','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','rows','catch','show','includeAll','include','find','create','params','describe','get','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers'];(function(_0x31172e,_0xa59e5){var _0x414ada=function(_0x37ede4){while(--_0x37ede4){_0x31172e['push'](_0x31172e['shift']());}};_0x414ada(++_0xa59e5);}(_0x983e,0x103));var _0xe983=function(_0x1c6e60,_0x1b47c2){_0x1c6e60=_0x1c6e60-0x0;var _0x29e908=_0x983e[_0x1c6e60];return _0x29e908;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe983('0x0'));var zipdir=require(_0xe983('0x1'));var jsonpatch=require(_0xe983('0x2'));var rp=require(_0xe983('0x3'));var moment=require(_0xe983('0x4'));var BPromise=require(_0xe983('0x5'));var Mustache=require(_0xe983('0x6'));var util=require(_0xe983('0x7'));var path=require(_0xe983('0x8'));var sox=require(_0xe983('0x9'));var csv=require('to-csv');var ejs=require(_0xe983('0xa'));var fs=require('fs');var fs_extra=require(_0xe983('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe983('0xc'));var jsforce=require(_0xe983('0xd'));var deskjs=require(_0xe983('0xe'));var toCsv=require(_0xe983('0xf'));var querystring=require(_0xe983('0x10'));var Papa=require(_0xe983('0x11'));var Redis=require(_0xe983('0x12'));var authService=require(_0xe983('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe983('0x14'));var hardwareService=require(_0xe983('0x15'));var logger=require(_0xe983('0x16'))(_0xe983('0x17'));var utils=require(_0xe983('0x18'));var config=require(_0xe983('0x19'));var licenseUtil=require(_0xe983('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xe983('0x1b')](config[_0xe983('0x1c')],{'host':_0xe983('0x1d'),'port':0x18eb});var socket=require(_0xe983('0x1e'))(new Redis(config[_0xe983('0x1c')]));require(_0xe983('0x1f'))[_0xe983('0x20')](socket);function respondWithStatusCode(_0xbf05bd,_0x18d836){_0x18d836=_0x18d836||0xcc;return function(_0x5324e1){if(_0x5324e1){return _0xbf05bd[_0xe983('0x21')](_0x18d836);}return _0xbf05bd[_0xe983('0x22')](_0x18d836)[_0xe983('0x23')]();};}function respondWithResult(_0x2332b2,_0x3b0734){_0x3b0734=_0x3b0734||0xc8;return function(_0xd132f0){if(_0xd132f0){return _0x2332b2[_0xe983('0x22')](_0x3b0734)[_0xe983('0x24')](_0xd132f0);}};}function respondWithFilteredResult(_0x313753,_0x2ab9f3){return function(_0x7a1380){if(_0x7a1380){var _0x3d3490=typeof _0x2ab9f3[_0xe983('0x25')]==='undefined'&&typeof _0x2ab9f3[_0xe983('0x26')]===_0xe983('0x27');var _0x5b3548=_0x7a1380[_0xe983('0x28')];var _0x416385=_0x3d3490?0x0:_0x2ab9f3[_0xe983('0x25')];var _0xec5049=_0x3d3490?_0x7a1380[_0xe983('0x28')]:_0x2ab9f3[_0xe983('0x25')]+_0x2ab9f3[_0xe983('0x26')];var _0x31c70f;if(_0xec5049>=_0x5b3548){_0xec5049=_0x5b3548;_0x31c70f=0xc8;}else{_0x31c70f=0xce;}_0x313753[_0xe983('0x22')](_0x31c70f);return _0x313753['set'](_0xe983('0x29'),_0x416385+'-'+_0xec5049+'/'+_0x5b3548)[_0xe983('0x24')](_0x7a1380);}return null;};}function patchUpdates(_0x228fd5){return function(_0x3b7173){try{jsonpatch[_0xe983('0x2a')](_0x3b7173,_0x228fd5,!![]);}catch(_0x1c2532){return BPromise[_0xe983('0x2b')](_0x1c2532);}return _0x3b7173['save']();};}function saveUpdates(_0x5068f7,_0x5d9a0a){return function(_0x2282e8){if(_0x2282e8){return _0x2282e8[_0xe983('0x2c')](_0x5068f7)[_0xe983('0x2d')](function(_0x4d3e04){return _0x4d3e04;});}return null;};}function removeEntity(_0x457e4d,_0x4c7fb9){return function(_0x57f365){if(_0x57f365){return _0x57f365[_0xe983('0x2e')]()[_0xe983('0x2d')](function(){_0x457e4d[_0xe983('0x22')](0xcc)[_0xe983('0x23')]();});}};}function handleEntityNotFound(_0x2a2096,_0x5c3bc6){return function(_0x3fb72a){if(!_0x3fb72a){_0x2a2096['sendStatus'](0x194);}return _0x3fb72a;};}function handleError(_0x1f1d19,_0x244b50){_0x244b50=_0x244b50||0x1f4;return function(_0x119c71){logger['error'](_0x119c71['stack']);if(_0x119c71[_0xe983('0x2f')]){delete _0x119c71['name'];}_0x1f1d19[_0xe983('0x22')](_0x244b50)[_0xe983('0x30')](_0x119c71);};}exports[_0xe983('0x31')]=function(_0x49b384,_0x500a0a){var _0x15e0b7={},_0x1760b7={},_0x4ee0fe={'count':0x0,'rows':[]};var _0x5ecd48=_[_0xe983('0x32')](db[_0xe983('0x33')][_0xe983('0x34')],function(_0x496d4){return{'name':_0x496d4[_0xe983('0x35')],'type':_0x496d4[_0xe983('0x36')][_0xe983('0x37')]};});_0x1760b7['model']=_[_0xe983('0x32')](_0x5ecd48,'name');_0x1760b7['query']=_[_0xe983('0x38')](_0x49b384[_0xe983('0x39')]);_0x1760b7['filters']=_['intersection'](_0x1760b7[_0xe983('0x3a')],_0x1760b7[_0xe983('0x39')]);_0x15e0b7[_0xe983('0x3b')]=_[_0xe983('0x3c')](_0x1760b7[_0xe983('0x3a')],qs[_0xe983('0x3d')](_0x49b384[_0xe983('0x39')]['fields']));_0x15e0b7[_0xe983('0x3b')]=_0x15e0b7[_0xe983('0x3b')][_0xe983('0x3e')]?_0x15e0b7[_0xe983('0x3b')]:_0x1760b7[_0xe983('0x3a')];if(!_0x49b384[_0xe983('0x39')][_0xe983('0x3f')](_0xe983('0x40'))){_0x15e0b7[_0xe983('0x26')]=qs['limit'](_0x49b384[_0xe983('0x39')]['limit']);_0x15e0b7[_0xe983('0x25')]=qs[_0xe983('0x25')](_0x49b384[_0xe983('0x39')][_0xe983('0x25')]);}_0x15e0b7[_0xe983('0x41')]=qs[_0xe983('0x42')](_0x49b384[_0xe983('0x39')][_0xe983('0x42')]);_0x15e0b7[_0xe983('0x43')]=qs[_0xe983('0x44')](_['pick'](_0x49b384[_0xe983('0x39')],_0x1760b7['filters']),_0x5ecd48);if(_0x49b384[_0xe983('0x39')][_0xe983('0x45')]){_0x15e0b7[_0xe983('0x43')]=_[_0xe983('0x46')](_0x15e0b7['where'],{'$or':_['map'](_0x5ecd48,function(_0x179920){if(_0x179920[_0xe983('0x36')]!==_0xe983('0x47')){var _0x4f487b={};_0x4f487b[_0x179920[_0xe983('0x2f')]]={'$like':'%'+_0x49b384[_0xe983('0x39')][_0xe983('0x45')]+'%'};return _0x4f487b;}})});}_0x15e0b7=_[_0xe983('0x46')]({},_0x15e0b7,_0x49b384[_0xe983('0x48')]);var _0x574adb={'where':_0x15e0b7['where']};return db[_0xe983('0x33')][_0xe983('0x28')](_0x574adb)[_0xe983('0x2d')](function(_0x5e4ef1){_0x4ee0fe[_0xe983('0x28')]=_0x5e4ef1;if(_0x49b384[_0xe983('0x39')]['includeAll']){_0x15e0b7['include']=[{'all':!![]}];}return db[_0xe983('0x33')]['findAll'](_0x15e0b7);})['then'](function(_0x2b8dcd){_0x4ee0fe[_0xe983('0x49')]=_0x2b8dcd;return _0x4ee0fe;})[_0xe983('0x2d')](respondWithFilteredResult(_0x500a0a,_0x15e0b7))[_0xe983('0x4a')](handleError(_0x500a0a,null));};exports[_0xe983('0x4b')]=function(_0x157ee0,_0x314b81){var _0x59f05e={'raw':!![],'where':{'id':_0x157ee0['params']['id']}},_0x210601={};_0x210601['model']=_['keys'](db[_0xe983('0x33')][_0xe983('0x34')]);_0x210601['query']=_[_0xe983('0x38')](_0x157ee0[_0xe983('0x39')]);_0x210601[_0xe983('0x44')]=_[_0xe983('0x3c')](_0x210601[_0xe983('0x3a')],_0x210601[_0xe983('0x39')]);_0x59f05e[_0xe983('0x3b')]=_[_0xe983('0x3c')](_0x210601['model'],qs['fields'](_0x157ee0[_0xe983('0x39')][_0xe983('0x3d')]));_0x59f05e[_0xe983('0x3b')]=_0x59f05e[_0xe983('0x3b')][_0xe983('0x3e')]?_0x59f05e['attributes']:_0x210601[_0xe983('0x3a')];if(_0x157ee0[_0xe983('0x39')][_0xe983('0x4c')]){_0x59f05e[_0xe983('0x4d')]=[{'all':!![]}];}_0x59f05e=_[_0xe983('0x46')]({},_0x59f05e,_0x157ee0[_0xe983('0x48')]);return db[_0xe983('0x33')][_0xe983('0x4e')](_0x59f05e)[_0xe983('0x2d')](handleEntityNotFound(_0x314b81,null))[_0xe983('0x2d')](respondWithResult(_0x314b81,null))[_0xe983('0x4a')](handleError(_0x314b81,null));};exports[_0xe983('0x4f')]=function(_0x5bbe94,_0x4f33f1){return db['ChatInternalMessage']['create'](_0x5bbe94['body'],{})[_0xe983('0x2d')](respondWithResult(_0x4f33f1,0xc9))[_0xe983('0x4a')](handleError(_0x4f33f1,null));};exports[_0xe983('0x2c')]=function(_0x24cb37,_0x3b59fc){if(_0x24cb37['body']['id']){delete _0x24cb37['body']['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x24cb37[_0xe983('0x50')]['id']}})['then'](handleEntityNotFound(_0x3b59fc,null))['then'](saveUpdates(_0x24cb37['body'],null))[_0xe983('0x2d')](respondWithResult(_0x3b59fc,null))[_0xe983('0x4a')](handleError(_0x3b59fc,null));};exports[_0xe983('0x2e')]=function(_0x393271,_0x1123dd){return db[_0xe983('0x33')]['find']({'where':{'id':_0x393271[_0xe983('0x50')]['id']}})[_0xe983('0x2d')](handleEntityNotFound(_0x1123dd,null))[_0xe983('0x2d')](removeEntity(_0x1123dd,null))[_0xe983('0x4a')](handleError(_0x1123dd,null));};exports['describe']=function(_0x6c830f,_0x1b70e6){return db[_0xe983('0x33')][_0xe983('0x51')]()[_0xe983('0x2d')](respondWithResult(_0x1b70e6,null))['catch'](handleError(_0x1b70e6,null));};function wrapUser(_0x4a3e95){return function(_0x2e5f5a){var _0x105e6e=_0x4a3e95[_0xe983('0x52')]({'plain':!![]});_0x105e6e['messages']=[];if(_0x2e5f5a){_0x105e6e['lastMessageAt']=_0x2e5f5a[_0xe983('0x53')];_0x105e6e[_0xe983('0x54')]=_0x2e5f5a;}else{_0x105e6e[_0xe983('0x55')]=moment(0x0)[_0xe983('0x56')](_0xe983('0x57'));_0x105e6e[_0xe983('0x54')]={};}return _0x105e6e;};}exports[_0xe983('0x58')]=function(_0x51b764,_0x3d1c79,_0xdf4dbb){var _0x4c8477=[];return db[_0xe983('0x59')][_0xe983('0x5a')]({'where':{'role':[_0xe983('0x5b'),_0xe983('0x5c'),_0xe983('0x5d')]},'attributes':['id',_0xe983('0x5e'),_0xe983('0x2f'),_0xe983('0x5f'),'userpic','internal',_0xe983('0x60'),_0xe983('0x61'),_0xe983('0x62'),_0xe983('0x63')],'order':qs[_0xe983('0x42')](_0xe983('0x64')),'include':[{'model':db[_0xe983('0x65')],'as':_0xe983('0x66'),'attributes':['id',_0xe983('0x2f'),'type'],'through':{'attributes':[]}}]})['then'](function(_0x515afa){if(_0x515afa){var _0x4e5b94=_0x51b764[_0xe983('0x5d')]['get']({'plain':!![]});if(!_0x4e5b94)throw new Error(_0xe983('0x67'));if(_0x4e5b94['role']===_0xe983('0x5d')){return db['UserProfileSection'][_0xe983('0x4e')]({'where':{'name':_0xe983('0x68'),'userProfileId':_0x4e5b94[_0xe983('0x69')]},'raw':!![]})[_0xe983('0x2d')](function(_0x53d919){if(_0x53d919){if(_0x53d919[_0xe983('0x6a')]===0x0){return db['UserProfileResource'][_0xe983('0x5a')]({'where':{'sectionId':_0x53d919['id']},'raw':!![]})['then'](function(_0x63e655){var _0x5bdcba=[];if(_[_0xe983('0x6b')](_0x63e655)){_0x5bdcba=_[_0xe983('0x45')](_0x515afa,function(_0x1291d9){if(_0x1291d9[_0xe983('0x5f')]!==_0xe983('0x5b')){return _0x1291d9;}});return _0x5bdcba;}else{for(var _0x45670c=0x0;_0x45670c<_0x515afa[_0xe983('0x3e')];_0x45670c++){var _0xedaa46=_0x515afa[_0x45670c];if(_0xedaa46[_0xe983('0x5f')]===_0xe983('0x5b')){var _0x161ffb=_[_0xe983('0x4e')](_0x63e655,function(_0x475c8b){return _0x475c8b[_0xe983('0x6c')]===_0xedaa46['id'];});if(_0x161ffb)_0x5bdcba[_0xe983('0x6d')](_0xedaa46);}else{_0x5bdcba['push'](_0xedaa46);}}return _0x5bdcba;}});}else{return _0x515afa;}}else{var _0x220767=_[_0xe983('0x45')](_0x515afa,function(_0x27cdb8){if(_0x27cdb8[_0xe983('0x5f')]!==_0xe983('0x5b')){return _0x27cdb8;}});return _0x220767;}});}else{return _0x515afa;}}})[_0xe983('0x2d')](function(_0x595804){var _0x508bec=[];if(_0x595804){_0x4c8477=_0x595804;for(var _0x395901=0x0;_0x395901<_0x595804[_0xe983('0x3e')];_0x395901+=0x1){_0x4c8477[_0x395901][_0xe983('0x6e')]=[];_0x508bec['push'](db[_0xe983('0x33')][_0xe983('0x4e')]({'where':{'FromId':[_0x51b764['user']['id'],_0x595804[_0x395901]['id']],'ToId':[_0x51b764[_0xe983('0x5d')]['id'],_0x595804[_0x395901]['id']],'ChatGroupId':null},'attributes':['id',_0xe983('0x53'),_0xe983('0x6f'),_0xe983('0x70'),_0xe983('0x71'),_0xe983('0x72')],'order':qs[_0xe983('0x42')](_0xe983('0x73')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe983('0x2d')](wrapUser(_0x595804[_0x395901])));}return BPromise['all'](_0x508bec);}return[];})[_0xe983('0x2d')](function(_0x448797){return{'rows':_0x448797,'count':_0x448797[_0xe983('0x3e')]};})[_0xe983('0x2d')](respondWithResult(_0x3d1c79,null))[_0xe983('0x4a')](handleError(_0x3d1c79,null));}; \ No newline at end of file +var _0x8896=['status','offset','undefined','limit','count','Content-Range','json','update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','body','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','-createdAt','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','redis','./chatInternalMessage.socket','register','sendStatus'];(function(_0x28e537,_0x1d36fa){var _0x3c47f8=function(_0x4a5b06){while(--_0x4a5b06){_0x28e537['push'](_0x28e537['shift']());}};_0x3c47f8(++_0x1d36fa);}(_0x8896,0xaf));var _0x6889=function(_0x5ad45b,_0x150f13){_0x5ad45b=_0x5ad45b-0x0;var _0x33f225=_0x8896[_0x5ad45b];return _0x33f225;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6889('0x0'));var zipdir=require(_0x6889('0x1'));var jsonpatch=require(_0x6889('0x2'));var rp=require(_0x6889('0x3'));var moment=require('moment');var BPromise=require(_0x6889('0x4'));var Mustache=require(_0x6889('0x5'));var util=require(_0x6889('0x6'));var path=require(_0x6889('0x7'));var sox=require(_0x6889('0x8'));var csv=require(_0x6889('0x9'));var ejs=require(_0x6889('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6889('0xb'));var jsforce=require(_0x6889('0xc'));var deskjs=require(_0x6889('0xd'));var toCsv=require(_0x6889('0x9'));var querystring=require('querystring');var Papa=require(_0x6889('0xe'));var Redis=require(_0x6889('0xf'));var authService=require(_0x6889('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6889('0x11'));var logger=require(_0x6889('0x12'))(_0x6889('0x13'));var utils=require(_0x6889('0x14'));var config=require(_0x6889('0x15'));var licenseUtil=require(_0x6889('0x16'));var db=require(_0x6889('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x6889('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6889('0x19')]));require(_0x6889('0x1a'))[_0x6889('0x1b')](socket);function respondWithStatusCode(_0x84383a,_0xb37e62){_0xb37e62=_0xb37e62||0xcc;return function(_0x2ab0bd){if(_0x2ab0bd){return _0x84383a[_0x6889('0x1c')](_0xb37e62);}return _0x84383a[_0x6889('0x1d')](_0xb37e62)['end']();};}function respondWithResult(_0x1478ac,_0x23cc5b){_0x23cc5b=_0x23cc5b||0xc8;return function(_0x5f5b40){if(_0x5f5b40){return _0x1478ac[_0x6889('0x1d')](_0x23cc5b)['json'](_0x5f5b40);}};}function respondWithFilteredResult(_0x98d3d9,_0x1b7320){return function(_0x55ad40){if(_0x55ad40){var _0x179b2a=typeof _0x1b7320[_0x6889('0x1e')]===_0x6889('0x1f')&&typeof _0x1b7320[_0x6889('0x20')]===_0x6889('0x1f');var _0x3c6868=_0x55ad40[_0x6889('0x21')];var _0x40ed21=_0x179b2a?0x0:_0x1b7320[_0x6889('0x1e')];var _0x1c3184=_0x179b2a?_0x55ad40[_0x6889('0x21')]:_0x1b7320[_0x6889('0x1e')]+_0x1b7320[_0x6889('0x20')];var _0x173817;if(_0x1c3184>=_0x3c6868){_0x1c3184=_0x3c6868;_0x173817=0xc8;}else{_0x173817=0xce;}_0x98d3d9[_0x6889('0x1d')](_0x173817);return _0x98d3d9['set'](_0x6889('0x22'),_0x40ed21+'-'+_0x1c3184+'/'+_0x3c6868)[_0x6889('0x23')](_0x55ad40);}return null;};}function patchUpdates(_0xdef17b){return function(_0x73ec13){try{jsonpatch['apply'](_0x73ec13,_0xdef17b,!![]);}catch(_0x3c8fca){return BPromise['reject'](_0x3c8fca);}return _0x73ec13['save']();};}function saveUpdates(_0x5190d5,_0x2fcf2c){return function(_0x4477a5){if(_0x4477a5){return _0x4477a5[_0x6889('0x24')](_0x5190d5)[_0x6889('0x25')](function(_0x4415a6){return _0x4415a6;});}return null;};}function removeEntity(_0xaf1b6d,_0x4c999b){return function(_0x123646){if(_0x123646){return _0x123646[_0x6889('0x26')]()[_0x6889('0x25')](function(){_0xaf1b6d[_0x6889('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x161e74,_0x3d7295){return function(_0x24be9d){if(!_0x24be9d){_0x161e74[_0x6889('0x1c')](0x194);}return _0x24be9d;};}function handleError(_0x457372,_0x14c02e){_0x14c02e=_0x14c02e||0x1f4;return function(_0x45a8e2){logger[_0x6889('0x27')](_0x45a8e2[_0x6889('0x28')]);if(_0x45a8e2[_0x6889('0x29')]){delete _0x45a8e2[_0x6889('0x29')];}_0x457372[_0x6889('0x1d')](_0x14c02e)[_0x6889('0x2a')](_0x45a8e2);};}exports[_0x6889('0x2b')]=function(_0xbab1a4,_0x5bba56){var _0x4ab65a={},_0x275b21={},_0x34c964={'count':0x0,'rows':[]};var _0x592d4e=_[_0x6889('0x2c')](db[_0x6889('0x2d')]['rawAttributes'],function(_0x20649c){return{'name':_0x20649c['fieldName'],'type':_0x20649c[_0x6889('0x2e')][_0x6889('0x2f')]};});_0x275b21[_0x6889('0x30')]=_[_0x6889('0x2c')](_0x592d4e,_0x6889('0x29'));_0x275b21[_0x6889('0x31')]=_[_0x6889('0x32')](_0xbab1a4[_0x6889('0x31')]);_0x275b21[_0x6889('0x33')]=_[_0x6889('0x34')](_0x275b21['model'],_0x275b21['query']);_0x4ab65a['attributes']=_[_0x6889('0x34')](_0x275b21[_0x6889('0x30')],qs['fields'](_0xbab1a4[_0x6889('0x31')][_0x6889('0x35')]));_0x4ab65a['attributes']=_0x4ab65a[_0x6889('0x36')][_0x6889('0x37')]?_0x4ab65a[_0x6889('0x36')]:_0x275b21[_0x6889('0x30')];if(!_0xbab1a4[_0x6889('0x31')]['hasOwnProperty']('nolimit')){_0x4ab65a[_0x6889('0x20')]=qs[_0x6889('0x20')](_0xbab1a4[_0x6889('0x31')]['limit']);_0x4ab65a[_0x6889('0x1e')]=qs[_0x6889('0x1e')](_0xbab1a4[_0x6889('0x31')]['offset']);}_0x4ab65a[_0x6889('0x38')]=qs[_0x6889('0x39')](_0xbab1a4['query']['sort']);_0x4ab65a['where']=qs['filters'](_[_0x6889('0x3a')](_0xbab1a4[_0x6889('0x31')],_0x275b21['filters']),_0x592d4e);if(_0xbab1a4[_0x6889('0x31')][_0x6889('0x3b')]){_0x4ab65a[_0x6889('0x3c')]=_[_0x6889('0x3d')](_0x4ab65a[_0x6889('0x3c')],{'$or':_[_0x6889('0x2c')](_0x592d4e,function(_0x1a9ebb){if(_0x1a9ebb[_0x6889('0x2e')]!=='VIRTUAL'){var _0x37523a={};_0x37523a[_0x1a9ebb['name']]={'$like':'%'+_0xbab1a4[_0x6889('0x31')][_0x6889('0x3b')]+'%'};return _0x37523a;}})});}_0x4ab65a=_[_0x6889('0x3d')]({},_0x4ab65a,_0xbab1a4[_0x6889('0x3e')]);var _0x1dfdb4={'where':_0x4ab65a['where']};return db[_0x6889('0x2d')][_0x6889('0x21')](_0x1dfdb4)['then'](function(_0xca753a){_0x34c964[_0x6889('0x21')]=_0xca753a;if(_0xbab1a4[_0x6889('0x31')][_0x6889('0x3f')]){_0x4ab65a[_0x6889('0x40')]=[{'all':!![]}];}return db[_0x6889('0x2d')][_0x6889('0x41')](_0x4ab65a);})['then'](function(_0x22587b){_0x34c964[_0x6889('0x42')]=_0x22587b;return _0x34c964;})[_0x6889('0x25')](respondWithFilteredResult(_0x5bba56,_0x4ab65a))[_0x6889('0x43')](handleError(_0x5bba56,null));};exports['show']=function(_0x143caf,_0x59b76c){var _0xfd8dde={'raw':!![],'where':{'id':_0x143caf[_0x6889('0x44')]['id']}},_0x339cb1={};_0x339cb1[_0x6889('0x30')]=_[_0x6889('0x32')](db[_0x6889('0x2d')]['rawAttributes']);_0x339cb1['query']=_[_0x6889('0x32')](_0x143caf[_0x6889('0x31')]);_0x339cb1['filters']=_[_0x6889('0x34')](_0x339cb1['model'],_0x339cb1['query']);_0xfd8dde['attributes']=_['intersection'](_0x339cb1[_0x6889('0x30')],qs[_0x6889('0x35')](_0x143caf[_0x6889('0x31')][_0x6889('0x35')]));_0xfd8dde[_0x6889('0x36')]=_0xfd8dde['attributes'][_0x6889('0x37')]?_0xfd8dde[_0x6889('0x36')]:_0x339cb1[_0x6889('0x30')];if(_0x143caf[_0x6889('0x31')]['includeAll']){_0xfd8dde[_0x6889('0x40')]=[{'all':!![]}];}_0xfd8dde=_[_0x6889('0x3d')]({},_0xfd8dde,_0x143caf[_0x6889('0x3e')]);return db['ChatInternalMessage']['find'](_0xfd8dde)['then'](handleEntityNotFound(_0x59b76c,null))[_0x6889('0x25')](respondWithResult(_0x59b76c,null))['catch'](handleError(_0x59b76c,null));};exports['create']=function(_0x2ab876,_0x58ce32){return db[_0x6889('0x2d')]['create'](_0x2ab876[_0x6889('0x45')],{})[_0x6889('0x25')](respondWithResult(_0x58ce32,0xc9))[_0x6889('0x43')](handleError(_0x58ce32,null));};exports[_0x6889('0x24')]=function(_0x59cf49,_0x50952d){if(_0x59cf49['body']['id']){delete _0x59cf49[_0x6889('0x45')]['id'];}return db[_0x6889('0x2d')][_0x6889('0x46')]({'where':{'id':_0x59cf49[_0x6889('0x44')]['id']}})['then'](handleEntityNotFound(_0x50952d,null))['then'](saveUpdates(_0x59cf49[_0x6889('0x45')],null))[_0x6889('0x25')](respondWithResult(_0x50952d,null))[_0x6889('0x43')](handleError(_0x50952d,null));};exports[_0x6889('0x26')]=function(_0x490d20,_0xb19d01){return db[_0x6889('0x2d')][_0x6889('0x46')]({'where':{'id':_0x490d20[_0x6889('0x44')]['id']}})[_0x6889('0x25')](handleEntityNotFound(_0xb19d01,null))[_0x6889('0x25')](removeEntity(_0xb19d01,null))[_0x6889('0x43')](handleError(_0xb19d01,null));};exports[_0x6889('0x47')]=function(_0x5793fd,_0xa384b4){return db['ChatInternalMessage'][_0x6889('0x47')]()['then'](respondWithResult(_0xa384b4,null))[_0x6889('0x43')](handleError(_0xa384b4,null));};function wrapUser(_0x290be6){return function(_0x291ec1){var _0x536541=_0x290be6[_0x6889('0x48')]({'plain':!![]});_0x536541[_0x6889('0x49')]=[];if(_0x291ec1){_0x536541[_0x6889('0x4a')]=_0x291ec1[_0x6889('0x4b')];_0x536541[_0x6889('0x4c')]=_0x291ec1;}else{_0x536541[_0x6889('0x4a')]=moment(0x0)[_0x6889('0x4d')](_0x6889('0x4e'));_0x536541[_0x6889('0x4c')]={};}return _0x536541;};}exports['getUsers']=function(_0x270a8c,_0x2c093c,_0x32d8df){var _0x212c25=[];return db['User'][_0x6889('0x41')]({'where':{'role':[_0x6889('0x4f'),_0x6889('0x50'),_0x6889('0x51')]},'attributes':['id',_0x6889('0x52'),'name',_0x6889('0x53'),_0x6889('0x54'),_0x6889('0x55'),_0x6889('0x56'),_0x6889('0x57'),_0x6889('0x58'),'showWebBar'],'order':qs[_0x6889('0x39')]('-online'),'include':[{'model':db[_0x6889('0x59')],'as':_0x6889('0x5a'),'attributes':['id',_0x6889('0x29'),'type'],'through':{'attributes':[]}}]})['then'](function(_0x820ac8){if(_0x820ac8){var _0x72a89d=_0x270a8c['user'][_0x6889('0x48')]({'plain':!![]});if(!_0x72a89d)throw new Error(_0x6889('0x5b'));if(_0x72a89d['role']===_0x6889('0x51')){return db['UserProfileSection'][_0x6889('0x46')]({'where':{'name':_0x6889('0x5c'),'userProfileId':_0x72a89d[_0x6889('0x5d')]},'raw':!![]})['then'](function(_0x297368){if(_0x297368){if(_0x297368[_0x6889('0x5e')]===0x0){return db[_0x6889('0x5f')][_0x6889('0x41')]({'where':{'sectionId':_0x297368['id']},'raw':!![]})['then'](function(_0xa49962){var _0x144baa=[];if(_[_0x6889('0x60')](_0xa49962)){_0x144baa=_[_0x6889('0x3b')](_0x820ac8,function(_0x3ef123){if(_0x3ef123[_0x6889('0x53')]!==_0x6889('0x4f')){return _0x3ef123;}});return _0x144baa;}else{for(var _0x104151=0x0;_0x104151<_0x820ac8[_0x6889('0x37')];_0x104151++){var _0x795b5f=_0x820ac8[_0x104151];if(_0x795b5f[_0x6889('0x53')]===_0x6889('0x4f')){var _0x27c8d1=_[_0x6889('0x46')](_0xa49962,function(_0x114246){return _0x114246[_0x6889('0x61')]===_0x795b5f['id'];});if(_0x27c8d1)_0x144baa[_0x6889('0x62')](_0x795b5f);}else{_0x144baa[_0x6889('0x62')](_0x795b5f);}}return _0x144baa;}});}else{return _0x820ac8;}}else{var _0x1972e4=_[_0x6889('0x3b')](_0x820ac8,function(_0x53efc3){if(_0x53efc3[_0x6889('0x53')]!==_0x6889('0x4f')){return _0x53efc3;}});return _0x1972e4;}});}else{return _0x820ac8;}}})[_0x6889('0x25')](function(_0x2cb950){var _0x52937a=[];if(_0x2cb950){_0x212c25=_0x2cb950;for(var _0x4bf8c1=0x0;_0x4bf8c1<_0x2cb950['length'];_0x4bf8c1+=0x1){_0x212c25[_0x4bf8c1]['messages']=[];_0x52937a[_0x6889('0x62')](db[_0x6889('0x2d')][_0x6889('0x46')]({'where':{'FromId':[_0x270a8c[_0x6889('0x51')]['id'],_0x2cb950[_0x4bf8c1]['id']],'ToId':[_0x270a8c[_0x6889('0x51')]['id'],_0x2cb950[_0x4bf8c1]['id']],'ChatGroupId':null},'attributes':['id',_0x6889('0x4b'),_0x6889('0x63'),_0x6889('0x64'),'read',_0x6889('0x45')],'order':qs[_0x6889('0x39')](_0x6889('0x65')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x2cb950[_0x4bf8c1])));}return BPromise['all'](_0x52937a);}return[];})[_0x6889('0x25')](function(_0x329d38){return{'rows':_0x329d38,'count':_0x329d38[_0x6889('0x37')]};})[_0x6889('0x25')](respondWithResult(_0x2c093c,null))['catch'](handleError(_0x2c093c,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index a6b2b2b..1937747 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 _0x0ad9=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x160bb3,_0x358b11){var _0x3b1003=function(_0x28886d){while(--_0x28886d){_0x160bb3['push'](_0x160bb3['shift']());}};_0x3b1003(++_0x358b11);}(_0x0ad9,0x9f));var _0x90ad=function(_0x4cbc97,_0x553a7f){_0x4cbc97=_0x4cbc97-0x0;var _0x1ab60e=_0x0ad9[_0x4cbc97];return _0x1ab60e;};'use strict';var EventEmitter=require(_0x90ad('0x0'));var ChatInternalMessage=require(_0x90ad('0x1'))['db'][_0x90ad('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x90ad('0x3')](0x0);var events={'afterCreate':_0x90ad('0x4'),'afterUpdate':_0x90ad('0x5'),'afterDestroy':_0x90ad('0x6')};function emitEvent(_0x4529aa){return function(_0xb15d53,_0x4353a0,_0x5230f2){ChatInternalMessageEvents[_0x90ad('0x7')](_0x4529aa+':'+_0xb15d53['id'],_0xb15d53);ChatInternalMessageEvents[_0x90ad('0x7')](_0x4529aa,_0xb15d53);_0x5230f2(null);};}for(var e in events){if(events[_0x90ad('0x8')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x90ad('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xe033=['hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x331298,_0x12341a){var _0x3824bc=function(_0x19449f){while(--_0x19449f){_0x331298['push'](_0x331298['shift']());}};_0x3824bc(++_0x12341a);}(_0xe033,0x161));var _0x3e03=function(_0x38ee62,_0x2d38da){_0x38ee62=_0x38ee62-0x0;var _0x3e677f=_0xe033[_0x38ee62];return _0x3e677f;};'use strict';var EventEmitter=require(_0x3e03('0x0'));var ChatInternalMessage=require(_0x3e03('0x1'))['db'][_0x3e03('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3e03('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3e03('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3f3985){return function(_0x4119cb,_0x4d02e1,_0x40b4c4){ChatInternalMessageEvents[_0x3e03('0x5')](_0x3f3985+':'+_0x4119cb['id'],_0x4119cb);ChatInternalMessageEvents[_0x3e03('0x5')](_0x3f3985,_0x4119cb);_0x40b4c4(null);};}for(var e in events){if(events[_0x3e03('0x6')](e)){var event=events[e];ChatInternalMessage[_0x3e03('0x7')](e,emitEvent(event));}}module[_0x3e03('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 f579c2b..54b25d9 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 _0xa2ab=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','define','chat_internal_messages','utf8mb4','util'];(function(_0x5a6b16,_0x4c22ef){var _0x54f033=function(_0x24d8d3){while(--_0x24d8d3){_0x5a6b16['push'](_0x5a6b16['shift']());}};_0x54f033(++_0x4c22ef);}(_0xa2ab,0x18b));var _0xba2a=function(_0x1edea9,_0x4b9a1b){_0x1edea9=_0x1edea9-0x0;var _0xf0ac12=_0xa2ab[_0x1edea9];return _0xf0ac12;};'use strict';var _=require('lodash');var util=require(_0xba2a('0x0'));var logger=require(_0xba2a('0x1'))(_0xba2a('0x2'));var moment=require(_0xba2a('0x3'));var BPromise=require(_0xba2a('0x4'));var rp=require(_0xba2a('0x5'));var fs=require('fs');var path=require(_0xba2a('0x6'));var rimraf=require('rimraf');var config=require(_0xba2a('0x7'));var attributes=require(_0xba2a('0x8'));module['exports']=function(_0x279bfe,_0x46ba15){return _0x279bfe[_0xba2a('0x9')]('ChatInternalMessage',attributes,{'tableName':_0xba2a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xba2a('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x00fc=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define'];(function(_0x99c3b9,_0x1ff031){var _0x5e08da=function(_0x10452c){while(--_0x10452c){_0x99c3b9['push'](_0x99c3b9['shift']());}};_0x5e08da(++_0x1ff031);}(_0x00fc,0x153));var _0xc00f=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0x00fc[_0x28394f];return _0x2618d2;};'use strict';var _=require(_0xc00f('0x0'));var util=require(_0xc00f('0x1'));var logger=require('../../config/logger')(_0xc00f('0x2'));var moment=require('moment');var BPromise=require(_0xc00f('0x3'));var rp=require(_0xc00f('0x4'));var fs=require('fs');var path=require(_0xc00f('0x5'));var rimraf=require(_0xc00f('0x6'));var config=require(_0xc00f('0x7'));var attributes=require(_0xc00f('0x8'));module[_0xc00f('0x9')]=function(_0x5a8ca8,_0x59b20c){return _0x5a8ca8[_0xc00f('0xa')]('ChatInternalMessage',attributes,{'tableName':_0xc00f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc00f('0xc'),'collate':_0xc00f('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index c02880e..962b9b9 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 _0xc6b4=['../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2b8281,_0x251e26){var _0x380e28=function(_0x583006){while(--_0x583006){_0x2b8281['push'](_0x2b8281['shift']());}};_0x380e28(++_0x251e26);}(_0xc6b4,0x1aa));var _0x4c6b=function(_0x48e921,_0x20cf98){_0x48e921=_0x48e921-0x0;var _0x4986fe=_0xc6b4[_0x48e921];return _0x4986fe;};'use strict';var _=require(_0x4c6b('0x0'));var util=require('util');var moment=require(_0x4c6b('0x1'));var BPromise=require('bluebird');var rs=require(_0x4c6b('0x2'));var fs=require('fs');var Redis=require(_0x4c6b('0x3'));var db=require(_0x4c6b('0x4'))['db'];var utils=require(_0x4c6b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4c6b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4c6b('0x7')][_0x4c6b('0x8')]({'port':0x232a});config[_0x4c6b('0x9')]=_[_0x4c6b('0xa')](config['redis'],{'host':_0x4c6b('0xb'),'port':0x18eb});var socket=require(_0x4c6b('0xc'))(new Redis(config[_0x4c6b('0x9')]));require(_0x4c6b('0xd'))[_0x4c6b('0xe')](socket);function respondWithRpcPromise(_0x2a3238,_0xfe06ee,_0xf67a29){return new BPromise(function(_0x587139,_0x4225b1){return client['request'](_0x2a3238,_0xf67a29)[_0x4c6b('0xf')](function(_0x5e9ed2){logger[_0x4c6b('0x10')](_0x4c6b('0x11'),_0xfe06ee,'request\x20sent');logger['debug'](_0x4c6b('0x12'),_0xfe06ee,'request\x20sent',JSON['stringify'](_0x5e9ed2));if(_0x5e9ed2['error']){if(_0x5e9ed2['error']['code']===0x1f4){logger[_0x4c6b('0x13')](_0x4c6b('0x11'),_0xfe06ee,_0x5e9ed2['error'][_0x4c6b('0x14')]);return _0x4225b1(_0x5e9ed2[_0x4c6b('0x13')]['message']);}logger[_0x4c6b('0x13')](_0x4c6b('0x11'),_0xfe06ee,_0x5e9ed2[_0x4c6b('0x13')][_0x4c6b('0x14')]);return _0x587139(_0x5e9ed2[_0x4c6b('0x13')][_0x4c6b('0x14')]);}else{logger[_0x4c6b('0x10')](_0x4c6b('0x11'),_0xfe06ee,_0x4c6b('0x15'));_0x587139(_0x5e9ed2[_0x4c6b('0x16')]['message']);}})[_0x4c6b('0x17')](function(_0x52cca3){logger[_0x4c6b('0x13')](_0x4c6b('0x11'),_0xfe06ee,_0x52cca3);_0x4225b1(_0x52cca3);});});} \ No newline at end of file +var _0x9374=['defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','info','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','http','redis'];(function(_0x1e8d54,_0x334a60){var _0x58c69f=function(_0x52abc){while(--_0x52abc){_0x1e8d54['push'](_0x1e8d54['shift']());}};_0x58c69f(++_0x334a60);}(_0x9374,0x1ac));var _0x4937=function(_0x2ae0bf,_0x41bd97){_0x2ae0bf=_0x2ae0bf-0x0;var _0x41480c=_0x9374[_0x2ae0bf];return _0x41480c;};'use strict';var _=require('lodash');var util=require(_0x4937('0x0'));var moment=require(_0x4937('0x1'));var BPromise=require(_0x4937('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4937('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4937('0x4'));var logger=require(_0x4937('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4937('0x6'));var client=jayson['client'][_0x4937('0x7')]({'port':0x232a});config[_0x4937('0x8')]=_[_0x4937('0x9')](config[_0x4937('0x8')],{'host':_0x4937('0xa'),'port':0x18eb});var socket=require(_0x4937('0xb'))(new Redis(config[_0x4937('0x8')]));require(_0x4937('0xc'))[_0x4937('0xd')](socket);function respondWithRpcPromise(_0x3a0757,_0x4423af,_0x3654bb){return new BPromise(function(_0x1a3877,_0x2dcb13){return client['request'](_0x3a0757,_0x3654bb)[_0x4937('0xe')](function(_0x44e06b){logger['info'](_0x4937('0xf'),_0x4423af,_0x4937('0x10'));logger[_0x4937('0x11')](_0x4937('0x12'),_0x4423af,_0x4937('0x10'),JSON['stringify'](_0x44e06b));if(_0x44e06b[_0x4937('0x13')]){if(_0x44e06b[_0x4937('0x13')]['code']===0x1f4){logger[_0x4937('0x13')](_0x4937('0xf'),_0x4423af,_0x44e06b[_0x4937('0x13')][_0x4937('0x14')]);return _0x2dcb13(_0x44e06b['error'][_0x4937('0x14')]);}logger[_0x4937('0x13')](_0x4937('0xf'),_0x4423af,_0x44e06b['error'][_0x4937('0x14')]);return _0x1a3877(_0x44e06b[_0x4937('0x13')][_0x4937('0x14')]);}else{logger[_0x4937('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x4423af,'request\x20sent');_0x1a3877(_0x44e06b['result'][_0x4937('0x14')]);}})[_0x4937('0x16')](function(_0x2d0f2b){logger[_0x4937('0x13')](_0x4937('0xf'),_0x4423af,_0x2d0f2b);_0x2dcb13(_0x2d0f2b);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 2015fa7..53e79c0 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 _0x18ab=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x52097c,_0x42d6a2){var _0x180642=function(_0xeabc6b){while(--_0xeabc6b){_0x52097c['push'](_0x52097c['shift']());}};_0x180642(++_0x42d6a2);}(_0x18ab,0x178));var _0xb18a=function(_0x4fde02,_0x565a82){_0x4fde02=_0x4fde02-0x0;var _0x4c2581=_0x18ab[_0x4fde02];return _0x4c2581;};'use strict';var ChatInternalMessageEvents=require(_0xb18a('0x0'));var events=[_0xb18a('0x1'),'remove','update'];function createListener(_0x2792de,_0x3eb087){return function(_0x5cf955){_0x3eb087[_0xb18a('0x2')](_0x2792de,_0x5cf955);};}function removeListener(_0x212db2,_0x5c6320){return function(){ChatInternalMessageEvents[_0xb18a('0x3')](_0x212db2,_0x5c6320);};}exports[_0xb18a('0x4')]=function(_0x3720f9){for(var _0x2fd533=0x0,_0x55c826=events[_0xb18a('0x5')];_0x2fd533<_0x55c826;_0x2fd533++){var _0x4c8677=events[_0x2fd533];var _0x4c1b58=createListener(_0xb18a('0x6')+_0x4c8677,_0x3720f9);ChatInternalMessageEvents['on'](_0x4c8677,_0x4c1b58);}}; \ No newline at end of file +var _0x5ef8=['chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5ef8,0xd9));var _0x85ef=function(_0x12f831,_0x28c91f){_0x12f831=_0x12f831-0x0;var _0x635103=_0x5ef8[_0x12f831];return _0x635103;};'use strict';var ChatInternalMessageEvents=require(_0x85ef('0x0'));var events=[_0x85ef('0x1'),_0x85ef('0x2'),_0x85ef('0x3')];function createListener(_0x11d344,_0x2cb43d){return function(_0x483ad2){_0x2cb43d[_0x85ef('0x4')](_0x11d344,_0x483ad2);};}function removeListener(_0x5a1c33,_0x4ef647){return function(){ChatInternalMessageEvents[_0x85ef('0x5')](_0x5a1c33,_0x4ef647);};}exports[_0x85ef('0x6')]=function(_0x3bcbd9){for(var _0x5a2650=0x0,_0x379b66=events[_0x85ef('0x7')];_0x5a2650<_0x379b66;_0x5a2650++){var _0x27da47=events[_0x5a2650];var _0x29eb04=createListener(_0x85ef('0x8')+_0x27da47,_0x3bcbd9);ChatInternalMessageEvents['on'](_0x27da47,_0x29eb04);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index b296640..4679e7a 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 _0xa143=['isAuthenticated','index','get','/describe','describe','/users','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x465a18,_0x5f3867){var _0x43c605=function(_0xa58132){while(--_0xa58132){_0x465a18['push'](_0x465a18['shift']());}};_0x43c605(++_0x5f3867);}(_0xa143,0x69));var _0x3a14=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa143[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x3a14('0x0'));var util=require(_0x3a14('0x1'));var path=require(_0x3a14('0x2'));var timeout=require(_0x3a14('0x3'));var express=require(_0x3a14('0x4'));var router=express[_0x3a14('0x5')]();var fs_extra=require(_0x3a14('0x6'));var auth=require(_0x3a14('0x7'));var interaction=require(_0x3a14('0x8'));var config=require(_0x3a14('0x9'));var controller=require('./chatInternalMessage.controller');router['get']('/',auth[_0x3a14('0xa')](),controller[_0x3a14('0xb')]);router[_0x3a14('0xc')](_0x3a14('0xd'),auth['isAuthenticated'](),controller[_0x3a14('0xe')]);router['get'](_0x3a14('0xf'),auth['isAuthenticated'](),controller['getUsers']);router['get'](_0x3a14('0x10'),auth[_0x3a14('0xa')](),controller[_0x3a14('0x11')]);router[_0x3a14('0x12')]('/',auth[_0x3a14('0xa')](),controller[_0x3a14('0x13')]);router['put']('/:id',controller[_0x3a14('0x14')]);router['delete'](_0x3a14('0x10'),auth[_0x3a14('0xa')](),controller[_0x3a14('0x15')]);module[_0x3a14('0x16')]=router; \ No newline at end of file +var _0x90a1=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x453211,_0x4b8cd9){var _0x526453=function(_0x1ba196){while(--_0x1ba196){_0x453211['push'](_0x453211['shift']());}};_0x526453(++_0x4b8cd9);}(_0x90a1,0xae));var _0x190a=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x90a1[_0x20ef64];return _0x3707d8;};'use strict';var multer=require(_0x190a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x190a('0x1'));var express=require(_0x190a('0x2'));var router=express[_0x190a('0x3')]();var fs_extra=require(_0x190a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x190a('0x5'));var config=require(_0x190a('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x190a('0x7')]('/',auth[_0x190a('0x8')](),controller[_0x190a('0x9')]);router[_0x190a('0x7')](_0x190a('0xa'),auth[_0x190a('0x8')](),controller[_0x190a('0xb')]);router[_0x190a('0x7')]('/users',auth['isAuthenticated'](),controller['getUsers']);router[_0x190a('0x7')](_0x190a('0xc'),auth[_0x190a('0x8')](),controller['show']);router['post']('/',auth[_0x190a('0x8')](),controller[_0x190a('0xd')]);router[_0x190a('0xe')](_0x190a('0xc'),controller[_0x190a('0xf')]);router[_0x190a('0x10')]('/:id',auth[_0x190a('0x8')](),controller['destroy']);module[_0x190a('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index b42de69..421ef04 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 _0x6f59=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x30e41d,_0x3133e2){var _0x372be4=function(_0x33a4db){while(--_0x33a4db){_0x30e41d['push'](_0x30e41d['shift']());}};_0x372be4(++_0x3133e2);}(_0x6f59,0x1be));var _0x96f5=function(_0x39855e,_0x303c7d){_0x39855e=_0x39855e-0x0;var _0x1e25ce=_0x6f59[_0x39855e];return _0x1e25ce;};'use strict';var Sequelize=require(_0x96f5('0x0'));module[_0x96f5('0x1')]={'body':{'type':Sequelize[_0x96f5('0x2')](_0x96f5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x96f5('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x96f5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x96f5('0x5')]('in',_0x96f5('0x6')),'defaultValue':_0x96f5('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x96f5('0x7')]},'providerName':{'type':Sequelize[_0x96f5('0x8')]},'providerResponse':{'type':Sequelize[_0x96f5('0x2')]}}; \ No newline at end of file +var _0x6000=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6000,0x17c));var _0x0600=function(_0x47515d,_0x3aa091){_0x47515d=_0x47515d-0x0;var _0x179f7c=_0x6000[_0x47515d];return _0x179f7c;};'use strict';var Sequelize=require(_0x0600('0x0'));module[_0x0600('0x1')]={'body':{'type':Sequelize[_0x0600('0x2')](_0x0600('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0600('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x0600('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0600('0x5')),'defaultValue':_0x0600('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x0600('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 7a83c19..c7c3b1b 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 _0x3885=['rimraf','zip-dir','moment','bluebird','mustache','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','ChatMessage','then','includeAll','findAll','rows','show','params','length','include','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','info','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','formData','reject','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','event','rejectmessage','eml-format'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x3885,0x19d));var _0x5388=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3885[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x5388('0x0'));var rimraf=require(_0x5388('0x1'));var zipdir=require(_0x5388('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5388('0x3'));var BPromise=require(_0x5388('0x4'));var Mustache=require(_0x5388('0x5'));var util=require('util');var path=require(_0x5388('0x6'));var sox=require(_0x5388('0x7'));var csv=require(_0x5388('0x8'));var ejs=require(_0x5388('0x9'));var fs=require('fs');var fs_extra=require(_0x5388('0xa'));var _=require(_0x5388('0xb'));var squel=require(_0x5388('0xc'));var crypto=require(_0x5388('0xd'));var jsforce=require(_0x5388('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5388('0x8'));var querystring=require(_0x5388('0xf'));var Papa=require(_0x5388('0x10'));var Redis=require(_0x5388('0x11'));var authService=require(_0x5388('0x12'));var qs=require(_0x5388('0x13'));var as=require(_0x5388('0x14'));var hardwareService=require(_0x5388('0x15'));var logger=require(_0x5388('0x16'))(_0x5388('0x17'));var utils=require(_0x5388('0x18'));var config=require(_0x5388('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5388('0x1a'))['db'];config[_0x5388('0x1b')]=_[_0x5388('0x1c')](config[_0x5388('0x1b')],{'host':_0x5388('0x1d'),'port':0x18eb});var socket=require(_0x5388('0x1e'))(new Redis(config[_0x5388('0x1b')]));require(_0x5388('0x1f'))[_0x5388('0x20')](socket);var jayson=require(_0x5388('0x21'));var client=jayson[_0x5388('0x22')][_0x5388('0x23')]({'port':0x232c});var client9002=jayson['client'][_0x5388('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x5802fb,_0x399e9c,_0x516854,_0x251d44){return new BPromise(function(_0x4d1364,_0x3bb675){var _0x1911f3=_0x251d44||client;return _0x1911f3['request'](_0x5802fb,_0x516854)['then'](function(_0x389b2b){logger['info']('ChatMessage,\x20%s,\x20%s',_0x399e9c,_0x5388('0x24'));logger[_0x5388('0x25')](_0x5388('0x26'),_0x399e9c,_0x5388('0x24'),JSON['stringify'](_0x389b2b));if(_0x389b2b['error']){if(_0x389b2b[_0x5388('0x27')]['code']===0x1f4){logger[_0x5388('0x27')](_0x5388('0x28'),_0x399e9c,_0x389b2b[_0x5388('0x27')]['message']);return _0x3bb675(_0x389b2b[_0x5388('0x27')][_0x5388('0x29')]);}logger[_0x5388('0x27')](_0x5388('0x28'),_0x399e9c,_0x389b2b['error'][_0x5388('0x29')]);return _0x4d1364(_0x389b2b[_0x5388('0x27')][_0x5388('0x29')]);}else{logger['info'](_0x5388('0x28'),_0x399e9c,'request\x20sent');_0x4d1364(_0x389b2b[_0x5388('0x2a')][_0x5388('0x29')]);}})[_0x5388('0x2b')](function(_0x255f46){logger[_0x5388('0x27')](_0x5388('0x28'),_0x399e9c,_0x255f46);_0x3bb675(_0x255f46);});});}function respondWithStatusCode(_0x186824,_0x3e8c70){_0x3e8c70=_0x3e8c70||0xcc;return function(_0x4f9445){if(_0x4f9445){return _0x186824[_0x5388('0x2c')](_0x3e8c70);}return _0x186824[_0x5388('0x2d')](_0x3e8c70)[_0x5388('0x2e')]();};}function respondWithResult(_0x564d2f,_0x474f21){_0x474f21=_0x474f21||0xc8;return function(_0x491699){if(_0x491699){return _0x564d2f[_0x5388('0x2d')](_0x474f21)[_0x5388('0x2f')](_0x491699);}};}function respondWithFilteredResult(_0x23a143,_0x54eeab){return function(_0x218bfe){if(_0x218bfe){var _0x208073=typeof _0x54eeab[_0x5388('0x30')]===_0x5388('0x31')&&typeof _0x54eeab[_0x5388('0x32')]===_0x5388('0x31');var _0xb58f6=_0x218bfe['count'];var _0x4f5feb=_0x208073?0x0:_0x54eeab[_0x5388('0x30')];var _0x229a19=_0x208073?_0x218bfe[_0x5388('0x33')]:_0x54eeab[_0x5388('0x30')]+_0x54eeab[_0x5388('0x32')];var _0x1ab068;if(_0x229a19>=_0xb58f6){_0x229a19=_0xb58f6;_0x1ab068=0xc8;}else{_0x1ab068=0xce;}_0x23a143['status'](_0x1ab068);return _0x23a143[_0x5388('0x34')]('Content-Range',_0x4f5feb+'-'+_0x229a19+'/'+_0xb58f6)['json'](_0x218bfe);}return null;};}function patchUpdates(_0x2728dd){return function(_0x59abb9){try{jsonpatch[_0x5388('0x35')](_0x59abb9,_0x2728dd,!![]);}catch(_0x5158eb){return BPromise['reject'](_0x5158eb);}return _0x59abb9[_0x5388('0x36')]();};}function saveUpdates(_0x1333fa,_0x59a983){return function(_0x511726){if(_0x511726){return _0x511726[_0x5388('0x37')](_0x1333fa)['then'](function(_0x12c30f){return _0x12c30f;});}return null;};}function removeEntity(_0x1b860b,_0x2f71d9){return function(_0x5b748e){if(_0x5b748e){return _0x5b748e[_0x5388('0x38')]()['then'](function(){_0x1b860b['status'](0xcc)[_0x5388('0x2e')]();});}};}function handleEntityNotFound(_0x3dcbf3,_0x3ed684){return function(_0x3eb95f){if(!_0x3eb95f){_0x3dcbf3['sendStatus'](0x194);}return _0x3eb95f;};}function handleError(_0x10ba5a,_0x472c82){_0x472c82=_0x472c82||0x1f4;return function(_0x3be834){logger[_0x5388('0x27')](_0x3be834[_0x5388('0x39')]);if(_0x3be834['name']){delete _0x3be834[_0x5388('0x3a')];}_0x10ba5a[_0x5388('0x2d')](_0x472c82)[_0x5388('0x3b')](_0x3be834);};}exports[_0x5388('0x3c')]=function(_0x25a3d4,_0x192c8c){var _0x5265ea={},_0xcef25c={},_0xc8599={'count':0x0,'rows':[]};var _0x1203de=_[_0x5388('0x3d')](db['ChatMessage'][_0x5388('0x3e')],function(_0x108ce5){return{'name':_0x108ce5[_0x5388('0x3f')],'type':_0x108ce5[_0x5388('0x40')]['key']};});_0xcef25c['model']=_[_0x5388('0x3d')](_0x1203de,'name');_0xcef25c[_0x5388('0x41')]=_[_0x5388('0x42')](_0x25a3d4['query']);_0xcef25c[_0x5388('0x43')]=_[_0x5388('0x44')](_0xcef25c[_0x5388('0x45')],_0xcef25c[_0x5388('0x41')]);_0x5265ea[_0x5388('0x46')]=_[_0x5388('0x44')](_0xcef25c[_0x5388('0x45')],qs['fields'](_0x25a3d4[_0x5388('0x41')][_0x5388('0x47')]));_0x5265ea[_0x5388('0x46')]=_0x5265ea[_0x5388('0x46')]['length']?_0x5265ea[_0x5388('0x46')]:_0xcef25c['model'];if(!_0x25a3d4[_0x5388('0x41')][_0x5388('0x48')]('nolimit')){_0x5265ea['limit']=qs['limit'](_0x25a3d4[_0x5388('0x41')]['limit']);_0x5265ea[_0x5388('0x30')]=qs['offset'](_0x25a3d4[_0x5388('0x41')]['offset']);}_0x5265ea[_0x5388('0x49')]=qs['sort'](_0x25a3d4[_0x5388('0x41')][_0x5388('0x4a')]);_0x5265ea['where']=qs[_0x5388('0x43')](_[_0x5388('0x4b')](_0x25a3d4['query'],_0xcef25c[_0x5388('0x43')]),_0x1203de);if(_0x25a3d4[_0x5388('0x41')][_0x5388('0x4c')]){_0x5265ea['where']=_[_0x5388('0x4d')](_0x5265ea[_0x5388('0x4e')],{'$or':_[_0x5388('0x3d')](_0x1203de,function(_0x15a427){if(_0x15a427[_0x5388('0x40')]!==_0x5388('0x4f')){var _0x5c9748={};_0x5c9748[_0x15a427['name']]={'$like':'%'+_0x25a3d4[_0x5388('0x41')][_0x5388('0x4c')]+'%'};return _0x5c9748;}})});}_0x5265ea=_[_0x5388('0x4d')]({},_0x5265ea,_0x25a3d4[_0x5388('0x50')]);var _0x129327={'where':_0x5265ea[_0x5388('0x4e')]};return db[_0x5388('0x51')][_0x5388('0x33')](_0x129327)[_0x5388('0x52')](function(_0x10dea3){_0xc8599[_0x5388('0x33')]=_0x10dea3;if(_0x25a3d4[_0x5388('0x41')][_0x5388('0x53')]){_0x5265ea['include']=[{'all':!![]}];}return db[_0x5388('0x51')][_0x5388('0x54')](_0x5265ea);})[_0x5388('0x52')](function(_0x5c7c13){_0xc8599[_0x5388('0x55')]=_0x5c7c13;return _0xc8599;})[_0x5388('0x52')](respondWithFilteredResult(_0x192c8c,_0x5265ea))[_0x5388('0x2b')](handleError(_0x192c8c,null));};exports[_0x5388('0x56')]=function(_0x3510d7,_0x5ea13f){var _0x57f115={'raw':!![],'where':{'id':_0x3510d7[_0x5388('0x57')]['id']}},_0x43179e={};_0x43179e[_0x5388('0x45')]=_[_0x5388('0x42')](db['ChatMessage'][_0x5388('0x3e')]);_0x43179e[_0x5388('0x41')]=_[_0x5388('0x42')](_0x3510d7[_0x5388('0x41')]);_0x43179e[_0x5388('0x43')]=_[_0x5388('0x44')](_0x43179e['model'],_0x43179e[_0x5388('0x41')]);_0x57f115[_0x5388('0x46')]=_[_0x5388('0x44')](_0x43179e[_0x5388('0x45')],qs['fields'](_0x3510d7['query'][_0x5388('0x47')]));_0x57f115[_0x5388('0x46')]=_0x57f115[_0x5388('0x46')][_0x5388('0x58')]?_0x57f115[_0x5388('0x46')]:_0x43179e['model'];if(_0x3510d7[_0x5388('0x41')][_0x5388('0x53')]){_0x57f115[_0x5388('0x59')]=[{'all':!![]}];}_0x57f115=_['merge']({},_0x57f115,_0x3510d7[_0x5388('0x50')]);return db[_0x5388('0x51')][_0x5388('0x5a')](_0x57f115)[_0x5388('0x52')](handleEntityNotFound(_0x5ea13f,null))['then'](respondWithResult(_0x5ea13f,null))[_0x5388('0x2b')](handleError(_0x5ea13f,null));};exports[_0x5388('0x5b')]=function(_0x14c01a,_0x14e6c4){return db[_0x5388('0x51')][_0x5388('0x5b')](_0x14c01a[_0x5388('0x5c')],{})[_0x5388('0x52')](respondWithResult(_0x14e6c4,0xc9))[_0x5388('0x2b')](handleError(_0x14e6c4,null));};exports[_0x5388('0x37')]=function(_0x272587,_0x1dde6e){if(_0x272587['body']['id']){delete _0x272587['body']['id'];}return db[_0x5388('0x51')][_0x5388('0x5a')]({'where':{'id':_0x272587[_0x5388('0x57')]['id']}})[_0x5388('0x52')](handleEntityNotFound(_0x1dde6e,null))[_0x5388('0x52')](saveUpdates(_0x272587[_0x5388('0x5c')],null))['then'](respondWithResult(_0x1dde6e,null))[_0x5388('0x2b')](handleError(_0x1dde6e,null));};exports[_0x5388('0x38')]=function(_0x4d7b8a,_0x5c4297){return db['ChatMessage'][_0x5388('0x5a')]({'where':{'id':_0x4d7b8a['params']['id']}})[_0x5388('0x52')](handleEntityNotFound(_0x5c4297,null))['then'](removeEntity(_0x5c4297,null))[_0x5388('0x2b')](handleError(_0x5c4297,null));};exports[_0x5388('0x5d')]=function(_0x165211,_0x41fab8){return db[_0x5388('0x51')][_0x5388('0x5d')]()['then'](respondWithResult(_0x41fab8,null))[_0x5388('0x2b')](handleError(_0x41fab8,null));};var interaction_log=require(_0x5388('0x16'))(_0x5388('0x5e'));exports[_0x5388('0x5f')]=function(_0xa96605,_0x4a1521,_0x5a542f){var _0x2a763b={'agent':{},'channel':_0x5388('0x60')};if(_0xa96605[_0x5388('0x5c')]['id']){delete _0xa96605[_0x5388('0x5c')]['id'];}_0xa96605['body'][_0x5388('0x61')]=!![];_0xa96605[_0x5388('0x5c')][_0x5388('0x62')]=moment()[_0x5388('0x63')](_0x5388('0x64'));_0xa96605[_0x5388('0x5c')]['UserId']=_0xa96605[_0x5388('0x5c')][_0x5388('0x65')]||_0xa96605[_0x5388('0x66')]['id'];_0x2a763b[_0x5388('0x67')]['id']=_0xa96605[_0x5388('0x5c')]['UserId'];return db[_0x5388('0x51')]['find']({'where':{'id':_0xa96605[_0x5388('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4a1521,null))[_0x5388('0x52')](saveUpdates(_0xa96605[_0x5388('0x5c')],null))[_0x5388('0x52')](function(_0x470d62){if(_0x470d62){_0x2a763b[_0x5388('0x29')]=_0x470d62[_0x5388('0x68')]({'plain':!![]});return db[_0x5388('0x69')][_0x5388('0x5a')]({'where':{'id':_0x470d62['ChatInteractionId']}});}return null;})[_0x5388('0x52')](handleEntityNotFound(_0x4a1521,null))[_0x5388('0x52')](function(_0x5331e3){if(_0x5331e3){return _0x5331e3[_0x5388('0x37')]({'UserId':_0xa96605[_0x5388('0x5c')][_0x5388('0x65')],'read1stAt':_['isNil'](_0x5331e3['read1stAt'])?moment()[_0x5388('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5388('0x52')](function(_0x4faf35){if(_0x4faf35){_0x2a763b['interaction']=_0x4faf35[_0x5388('0x68')]({'plain':!![]});interaction_log[_0x5388('0x6a')](_0x5388('0x6b'),_0xa96605[_0x5388('0x66')]['id'],_0xa96605[_0x5388('0x66')][_0x5388('0x3a')],_0xa96605[_0x5388('0x66')][_0x5388('0x6c')],_0x2a763b[_0x5388('0x6d')]['id'],_0xa96605[_0x5388('0x5c')]?JSON[_0x5388('0x6e')](_0xa96605[_0x5388('0x5c')]):_0x5388('0x6f'));return respondWithRpcPromise(_0x5388('0x70'),_0x5388('0x71'),_0x2a763b);}return null;})[_0x5388('0x52')](function(_0x374640){var _0x58e485=_0x5388('0x72')+_0x374640[_0x5388('0x29')][_0x5388('0x73')];return db['sequelize']['query'](_0x58e485,{'type':db[_0x5388('0x74')]['QueryTypes'][_0x5388('0x75')],'raw':!![]})[_0x5388('0x52')](function(_0x5ddb5d){return _0x5ddb5d;});})[_0x5388('0x52')](function(_0x44b0bb){if(_0x44b0bb){_0x2a763b[_0x5388('0x29')][_0x5388('0x76')]=_0x44b0bb[0x0];if(!_0xa96605[_0x5388('0x5c')][_0x5388('0x65')])return;return db[_0x5388('0x77')]['find']({'where':{'id':_0xa96605[_0x5388('0x5c')][_0x5388('0x65')],'role':_0x5388('0x67')},'attributes':['id',_0x5388('0x3a'),_0x5388('0x78'),_0x5388('0x79'),_0x5388('0x7a')],'raw':!![]});}return null;})[_0x5388('0x52')](function(_0x57a87b){if(!_0x57a87b)return null;_0x2a763b[_0x5388('0x29')][_0x5388('0x67')]=_0x57a87b;return _0x2a763b;})['then'](function(_0x5761fb){if(_0x5761fb){if(_0xa96605['body']['manual']){_0x2a763b['message'][_0x5388('0x7b')]=util[_0x5388('0x63')](_0x5388('0x7c'),_0xa96605['user'][_0x5388('0x3a')]);_0x2a763b['message'][_0x5388('0x7d')]=_0x2a763b[_0x5388('0x7d')];_0x2a763b[_0x5388('0x29')][_0x5388('0x7e')]=_0x2a763b['channel'];_0x2a763b[_0x5388('0x29')]['event']=_0x5388('0x5f');return respondWithRpcPromise('EventManager',_0x5388('0x7f'),{'event':_0x5388('0x80'),'message':_[_0x5388('0x4d')](_0x2a763b[_0x5388('0x29')],JSON['parse'](_0x2a763b[_0x5388('0x6d')][_0x5388('0x81')]))},client9002)[_0x5388('0x52')](function(){return _0x2a763b;});}return _0x2a763b;}return null;})[_0x5388('0x52')](respondWithResult(_0x4a1521,null))['catch'](handleError(_0x4a1521,null));};var interaction_log=require(_0x5388('0x16'))(_0x5388('0x5e'));exports[_0x5388('0x82')]=function(_0xf1a90,_0x543bff,_0x13f050){var _0x2a34c6={'agent':{},'channel':_0x5388('0x60')};if(_0xf1a90[_0x5388('0x5c')]['id']){delete _0xf1a90[_0x5388('0x5c')]['id'];}_0xf1a90[_0x5388('0x5c')][_0x5388('0x65')]=_0xf1a90[_0x5388('0x5c')]['UserId']||_0xf1a90[_0x5388('0x66')]['id'];_0x2a34c6[_0x5388('0x67')]['id']=_0xf1a90[_0x5388('0x5c')][_0x5388('0x65')];return db[_0x5388('0x51')][_0x5388('0x5a')]({'where':{'id':_0xf1a90['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x543bff,null))[_0x5388('0x52')](function(_0x38e68f){if(_0x38e68f){_0x2a34c6[_0x5388('0x29')]=_0x38e68f[_0x5388('0x68')]({'plain':!![]});return db[_0x5388('0x69')][_0x5388('0x5a')]({'where':{'id':_0x38e68f[_0x5388('0x83')]}});}return null;})[_0x5388('0x52')](handleEntityNotFound(_0x543bff,null))[_0x5388('0x52')](function(_0x5c79e8){if(_0x5c79e8){_0x2a34c6[_0x5388('0x6d')]=_0x5c79e8[_0x5388('0x68')]({'plain':!![]});interaction_log[_0x5388('0x6a')](_0x5388('0x84'),_0xf1a90[_0x5388('0x66')]['id'],_0xf1a90[_0x5388('0x66')][_0x5388('0x3a')],_0xf1a90[_0x5388('0x66')][_0x5388('0x6c')],_0x2a34c6[_0x5388('0x6d')]['id'],_0xf1a90['body']?JSON[_0x5388('0x6e')](_0xf1a90[_0x5388('0x5c')]):_0x5388('0x6f'));return respondWithRpcPromise(_0x5388('0x85'),_0x5388('0x86'),_0x2a34c6);}return null;})[_0x5388('0x52')](function(_0x1279e0){var _0x127036=_0x5388('0x72')+_0x1279e0[_0x5388('0x29')]['ContactId'];return db['sequelize'][_0x5388('0x41')](_0x127036,{'type':db[_0x5388('0x74')][_0x5388('0x87')][_0x5388('0x75')],'raw':!![]})[_0x5388('0x52')](function(_0xa6513a){return _0xa6513a;});})[_0x5388('0x52')](function(_0x1b6ae2){if(_0x1b6ae2){_0x2a34c6[_0x5388('0x29')][_0x5388('0x76')]=_0x1b6ae2[0x0];if(!_0xf1a90[_0x5388('0x5c')][_0x5388('0x65')])return;return db[_0x5388('0x77')][_0x5388('0x5a')]({'where':{'id':_0xf1a90['body'][_0x5388('0x65')],'role':_0x5388('0x67')},'attributes':['id','name',_0x5388('0x78'),'email','internal'],'raw':!![]});}return null;})[_0x5388('0x52')](function(_0x4fd40d){if(!_0x4fd40d)return null;_0x2a34c6[_0x5388('0x29')][_0x5388('0x67')]=_0x4fd40d;return _0x2a34c6;})[_0x5388('0x52')](function(_0x4b535c){if(_0x4b535c){_0x4b535c[_0x5388('0x29')][_0x5388('0x7b')]=util[_0x5388('0x63')]('SIP/%s',_0xf1a90[_0x5388('0x66')][_0x5388('0x3a')]);_0x4b535c[_0x5388('0x29')][_0x5388('0x7d')]=_0x2a34c6[_0x5388('0x7d')];_0x4b535c[_0x5388('0x29')][_0x5388('0x7e')]=_0x2a34c6[_0x5388('0x7d')];_0x4b535c[_0x5388('0x29')][_0x5388('0x88')]=_0x5388('0x82');respondWithRpcPromise('EventManager',_0x5388('0x7f'),{'event':_0x5388('0x89'),'message':_[_0x5388('0x4d')](_0x2a34c6[_0x5388('0x29')],JSON['parse'](_0x2a34c6['interaction'][_0x5388('0x81')]))},client9002);return _0x2a34c6;}return null;})[_0x5388('0x52')](respondWithResult(_0x543bff,null))[_0x5388('0x2b')](handleError(_0x543bff,null));}; \ No newline at end of file +var _0xfb38=['socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','name','send','index','map','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','ChatMessage','rawAttributes','include','find','create','body','describe','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','format','role','interaction','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','User','fullname','email','internal','interface','channel','motionChannel','accept','EventManager','acceptmessage','parse','formData','chat-interactions','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','Sequelize','QueryTypes','contact','SIP/%s','event','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost'];(function(_0x43d106,_0x96a475){var _0x2160bc=function(_0x1219fb){while(--_0x1219fb){_0x43d106['push'](_0x43d106['shift']());}};_0x2160bc(++_0x96a475);}(_0xfb38,0xf0));var _0x8fb3=function(_0x48347d,_0x31ee2a){_0x48347d=_0x48347d-0x0;var _0x110f3d=_0xfb38[_0x48347d];return _0x110f3d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8fb3('0x0'));var zipdir=require(_0x8fb3('0x1'));var jsonpatch=require(_0x8fb3('0x2'));var rp=require(_0x8fb3('0x3'));var moment=require(_0x8fb3('0x4'));var BPromise=require(_0x8fb3('0x5'));var Mustache=require(_0x8fb3('0x6'));var util=require(_0x8fb3('0x7'));var path=require(_0x8fb3('0x8'));var sox=require('sox');var csv=require(_0x8fb3('0x9'));var ejs=require(_0x8fb3('0xa'));var fs=require('fs');var fs_extra=require(_0x8fb3('0xb'));var _=require(_0x8fb3('0xc'));var squel=require('squel');var crypto=require(_0x8fb3('0xd'));var jsforce=require(_0x8fb3('0xe'));var deskjs=require(_0x8fb3('0xf'));var toCsv=require(_0x8fb3('0x9'));var querystring=require(_0x8fb3('0x10'));var Papa=require(_0x8fb3('0x11'));var Redis=require(_0x8fb3('0x12'));var authService=require(_0x8fb3('0x13'));var qs=require(_0x8fb3('0x14'));var as=require(_0x8fb3('0x15'));var hardwareService=require(_0x8fb3('0x16'));var logger=require(_0x8fb3('0x17'))(_0x8fb3('0x18'));var utils=require(_0x8fb3('0x19'));var config=require(_0x8fb3('0x1a'));var licenseUtil=require(_0x8fb3('0x1b'));var db=require(_0x8fb3('0x1c'))['db'];config[_0x8fb3('0x1d')]=_[_0x8fb3('0x1e')](config['redis'],{'host':_0x8fb3('0x1f'),'port':0x18eb});var socket=require(_0x8fb3('0x20'))(new Redis(config['redis']));require('./chatMessage.socket')[_0x8fb3('0x21')](socket);var jayson=require(_0x8fb3('0x22'));var client=jayson[_0x8fb3('0x23')][_0x8fb3('0x24')]({'port':0x232c});var client9002=jayson['client'][_0x8fb3('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x2b93aa,_0x104297,_0x225519,_0x53e5f6){return new BPromise(function(_0x46cf10,_0x41e3d3){var _0x2943ff=_0x53e5f6||client;return _0x2943ff[_0x8fb3('0x25')](_0x2b93aa,_0x225519)[_0x8fb3('0x26')](function(_0x4d8343){logger[_0x8fb3('0x27')]('ChatMessage,\x20%s,\x20%s',_0x104297,_0x8fb3('0x28'));logger[_0x8fb3('0x29')](_0x8fb3('0x2a'),_0x104297,_0x8fb3('0x28'),JSON[_0x8fb3('0x2b')](_0x4d8343));if(_0x4d8343[_0x8fb3('0x2c')]){if(_0x4d8343[_0x8fb3('0x2c')][_0x8fb3('0x2d')]===0x1f4){logger['error'](_0x8fb3('0x2e'),_0x104297,_0x4d8343[_0x8fb3('0x2c')][_0x8fb3('0x2f')]);return _0x41e3d3(_0x4d8343[_0x8fb3('0x2c')][_0x8fb3('0x2f')]);}logger[_0x8fb3('0x2c')](_0x8fb3('0x2e'),_0x104297,_0x4d8343['error']['message']);return _0x46cf10(_0x4d8343[_0x8fb3('0x2c')][_0x8fb3('0x2f')]);}else{logger[_0x8fb3('0x27')](_0x8fb3('0x2e'),_0x104297,_0x8fb3('0x28'));_0x46cf10(_0x4d8343[_0x8fb3('0x30')][_0x8fb3('0x2f')]);}})[_0x8fb3('0x31')](function(_0x33afdc){logger['error'](_0x8fb3('0x2e'),_0x104297,_0x33afdc);_0x41e3d3(_0x33afdc);});});}function respondWithStatusCode(_0x5e328c,_0x1c354e){_0x1c354e=_0x1c354e||0xcc;return function(_0x558dee){if(_0x558dee){return _0x5e328c[_0x8fb3('0x32')](_0x1c354e);}return _0x5e328c[_0x8fb3('0x33')](_0x1c354e)[_0x8fb3('0x34')]();};}function respondWithResult(_0xdc15ca,_0x7dec91){_0x7dec91=_0x7dec91||0xc8;return function(_0x1e55c7){if(_0x1e55c7){return _0xdc15ca['status'](_0x7dec91)[_0x8fb3('0x35')](_0x1e55c7);}};}function respondWithFilteredResult(_0x59c470,_0x39e810){return function(_0x2cf24a){if(_0x2cf24a){var _0x300019=typeof _0x39e810['offset']===_0x8fb3('0x36')&&typeof _0x39e810[_0x8fb3('0x37')]===_0x8fb3('0x36');var _0x139792=_0x2cf24a[_0x8fb3('0x38')];var _0x3dc4a2=_0x300019?0x0:_0x39e810[_0x8fb3('0x39')];var _0x2fd253=_0x300019?_0x2cf24a['count']:_0x39e810[_0x8fb3('0x39')]+_0x39e810[_0x8fb3('0x37')];var _0x56a257;if(_0x2fd253>=_0x139792){_0x2fd253=_0x139792;_0x56a257=0xc8;}else{_0x56a257=0xce;}_0x59c470[_0x8fb3('0x33')](_0x56a257);return _0x59c470[_0x8fb3('0x3a')]('Content-Range',_0x3dc4a2+'-'+_0x2fd253+'/'+_0x139792)[_0x8fb3('0x35')](_0x2cf24a);}return null;};}function patchUpdates(_0x1014bd){return function(_0x20149b){try{jsonpatch[_0x8fb3('0x3b')](_0x20149b,_0x1014bd,!![]);}catch(_0x3e8d5a){return BPromise[_0x8fb3('0x3c')](_0x3e8d5a);}return _0x20149b[_0x8fb3('0x3d')]();};}function saveUpdates(_0x51e3a8,_0xf7a3a6){return function(_0x29468){if(_0x29468){return _0x29468[_0x8fb3('0x3e')](_0x51e3a8)[_0x8fb3('0x26')](function(_0x56097c){return _0x56097c;});}return null;};}function removeEntity(_0x5075fb,_0x276fd0){return function(_0x9ce71f){if(_0x9ce71f){return _0x9ce71f['destroy']()[_0x8fb3('0x26')](function(){_0x5075fb[_0x8fb3('0x33')](0xcc)[_0x8fb3('0x34')]();});}};}function handleEntityNotFound(_0x33196f,_0x2cad5d){return function(_0x5544d5){if(!_0x5544d5){_0x33196f[_0x8fb3('0x32')](0x194);}return _0x5544d5;};}function handleError(_0x2b1758,_0x47378e){_0x47378e=_0x47378e||0x1f4;return function(_0x3f1d8c){logger[_0x8fb3('0x2c')](_0x3f1d8c['stack']);if(_0x3f1d8c['name']){delete _0x3f1d8c[_0x8fb3('0x3f')];}_0x2b1758['status'](_0x47378e)[_0x8fb3('0x40')](_0x3f1d8c);};}exports[_0x8fb3('0x41')]=function(_0x9ff6ad,_0x1ef823){var _0x4aa684={},_0x16fc02={},_0x7f591e={'count':0x0,'rows':[]};var _0x5b0955=_[_0x8fb3('0x42')](db['ChatMessage']['rawAttributes'],function(_0x53bbec){return{'name':_0x53bbec[_0x8fb3('0x43')],'type':_0x53bbec[_0x8fb3('0x44')][_0x8fb3('0x45')]};});_0x16fc02['model']=_[_0x8fb3('0x42')](_0x5b0955,'name');_0x16fc02[_0x8fb3('0x46')]=_[_0x8fb3('0x47')](_0x9ff6ad[_0x8fb3('0x46')]);_0x16fc02['filters']=_[_0x8fb3('0x48')](_0x16fc02[_0x8fb3('0x49')],_0x16fc02[_0x8fb3('0x46')]);_0x4aa684[_0x8fb3('0x4a')]=_[_0x8fb3('0x48')](_0x16fc02[_0x8fb3('0x49')],qs[_0x8fb3('0x4b')](_0x9ff6ad['query'][_0x8fb3('0x4b')]));_0x4aa684[_0x8fb3('0x4a')]=_0x4aa684['attributes'][_0x8fb3('0x4c')]?_0x4aa684[_0x8fb3('0x4a')]:_0x16fc02[_0x8fb3('0x49')];if(!_0x9ff6ad['query']['hasOwnProperty'](_0x8fb3('0x4d'))){_0x4aa684[_0x8fb3('0x37')]=qs['limit'](_0x9ff6ad[_0x8fb3('0x46')]['limit']);_0x4aa684[_0x8fb3('0x39')]=qs[_0x8fb3('0x39')](_0x9ff6ad['query'][_0x8fb3('0x39')]);}_0x4aa684[_0x8fb3('0x4e')]=qs[_0x8fb3('0x4f')](_0x9ff6ad[_0x8fb3('0x46')]['sort']);_0x4aa684[_0x8fb3('0x50')]=qs[_0x8fb3('0x51')](_['pick'](_0x9ff6ad[_0x8fb3('0x46')],_0x16fc02['filters']),_0x5b0955);if(_0x9ff6ad[_0x8fb3('0x46')][_0x8fb3('0x52')]){_0x4aa684['where']=_[_0x8fb3('0x53')](_0x4aa684['where'],{'$or':_[_0x8fb3('0x42')](_0x5b0955,function(_0x99d4b2){if(_0x99d4b2[_0x8fb3('0x44')]!==_0x8fb3('0x54')){var _0x24f9f8={};_0x24f9f8[_0x99d4b2[_0x8fb3('0x3f')]]={'$like':'%'+_0x9ff6ad[_0x8fb3('0x46')]['filter']+'%'};return _0x24f9f8;}})});}_0x4aa684=_[_0x8fb3('0x53')]({},_0x4aa684,_0x9ff6ad[_0x8fb3('0x55')]);var _0x2ae452={'where':_0x4aa684['where']};return db['ChatMessage'][_0x8fb3('0x38')](_0x2ae452)[_0x8fb3('0x26')](function(_0x23b9e5){_0x7f591e['count']=_0x23b9e5;if(_0x9ff6ad[_0x8fb3('0x46')][_0x8fb3('0x56')]){_0x4aa684['include']=[{'all':!![]}];}return db['ChatMessage'][_0x8fb3('0x57')](_0x4aa684);})[_0x8fb3('0x26')](function(_0x537f77){_0x7f591e[_0x8fb3('0x58')]=_0x537f77;return _0x7f591e;})['then'](respondWithFilteredResult(_0x1ef823,_0x4aa684))[_0x8fb3('0x31')](handleError(_0x1ef823,null));};exports[_0x8fb3('0x59')]=function(_0xe31421,_0x275f43){var _0x1164c4={'raw':!![],'where':{'id':_0xe31421[_0x8fb3('0x5a')]['id']}},_0x430cdc={};_0x430cdc[_0x8fb3('0x49')]=_['keys'](db[_0x8fb3('0x5b')][_0x8fb3('0x5c')]);_0x430cdc[_0x8fb3('0x46')]=_[_0x8fb3('0x47')](_0xe31421[_0x8fb3('0x46')]);_0x430cdc['filters']=_['intersection'](_0x430cdc[_0x8fb3('0x49')],_0x430cdc[_0x8fb3('0x46')]);_0x1164c4['attributes']=_[_0x8fb3('0x48')](_0x430cdc[_0x8fb3('0x49')],qs['fields'](_0xe31421[_0x8fb3('0x46')][_0x8fb3('0x4b')]));_0x1164c4[_0x8fb3('0x4a')]=_0x1164c4['attributes'][_0x8fb3('0x4c')]?_0x1164c4['attributes']:_0x430cdc['model'];if(_0xe31421[_0x8fb3('0x46')][_0x8fb3('0x56')]){_0x1164c4[_0x8fb3('0x5d')]=[{'all':!![]}];}_0x1164c4=_[_0x8fb3('0x53')]({},_0x1164c4,_0xe31421[_0x8fb3('0x55')]);return db['ChatMessage'][_0x8fb3('0x5e')](_0x1164c4)[_0x8fb3('0x26')](handleEntityNotFound(_0x275f43,null))[_0x8fb3('0x26')](respondWithResult(_0x275f43,null))['catch'](handleError(_0x275f43,null));};exports[_0x8fb3('0x5f')]=function(_0x456590,_0x46f4c1){return db['ChatMessage'][_0x8fb3('0x5f')](_0x456590[_0x8fb3('0x60')],{})['then'](respondWithResult(_0x46f4c1,0xc9))[_0x8fb3('0x31')](handleError(_0x46f4c1,null));};exports[_0x8fb3('0x3e')]=function(_0x5d1ca3,_0x1f5ef6){if(_0x5d1ca3[_0x8fb3('0x60')]['id']){delete _0x5d1ca3[_0x8fb3('0x60')]['id'];}return db[_0x8fb3('0x5b')][_0x8fb3('0x5e')]({'where':{'id':_0x5d1ca3[_0x8fb3('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1f5ef6,null))[_0x8fb3('0x26')](saveUpdates(_0x5d1ca3[_0x8fb3('0x60')],null))[_0x8fb3('0x26')](respondWithResult(_0x1f5ef6,null))[_0x8fb3('0x31')](handleError(_0x1f5ef6,null));};exports['destroy']=function(_0x12c660,_0x28f6ee){return db[_0x8fb3('0x5b')][_0x8fb3('0x5e')]({'where':{'id':_0x12c660[_0x8fb3('0x5a')]['id']}})['then'](handleEntityNotFound(_0x28f6ee,null))[_0x8fb3('0x26')](removeEntity(_0x28f6ee,null))['catch'](handleError(_0x28f6ee,null));};exports[_0x8fb3('0x61')]=function(_0x525cad,_0x32e5d5){return db['ChatMessage'][_0x8fb3('0x61')]()[_0x8fb3('0x26')](respondWithResult(_0x32e5d5,null))[_0x8fb3('0x31')](handleError(_0x32e5d5,null));};var interaction_log=require(_0x8fb3('0x17'))('chat-interactions');exports['accept']=function(_0x2ed8f3,_0xf54379,_0x42d589){var _0x9c065c={'agent':{},'channel':'chat'};if(_0x2ed8f3['body']['id']){delete _0x2ed8f3[_0x8fb3('0x60')]['id'];}_0x2ed8f3[_0x8fb3('0x60')][_0x8fb3('0x62')]=!![];_0x2ed8f3['body'][_0x8fb3('0x63')]=moment()['format'](_0x8fb3('0x64'));_0x2ed8f3[_0x8fb3('0x60')][_0x8fb3('0x65')]=_0x2ed8f3[_0x8fb3('0x60')]['UserId']||_0x2ed8f3[_0x8fb3('0x66')]['id'];_0x9c065c[_0x8fb3('0x67')]['id']=_0x2ed8f3[_0x8fb3('0x60')]['UserId'];return db['ChatMessage'][_0x8fb3('0x5e')]({'where':{'id':_0x2ed8f3['params']['id'],'UserId':null}})[_0x8fb3('0x26')](handleEntityNotFound(_0xf54379,null))[_0x8fb3('0x26')](saveUpdates(_0x2ed8f3[_0x8fb3('0x60')],null))[_0x8fb3('0x26')](function(_0x15f420){if(_0x15f420){_0x9c065c[_0x8fb3('0x2f')]=_0x15f420[_0x8fb3('0x68')]({'plain':!![]});return db[_0x8fb3('0x69')][_0x8fb3('0x5e')]({'where':{'id':_0x15f420[_0x8fb3('0x6a')]}});}return null;})[_0x8fb3('0x26')](handleEntityNotFound(_0xf54379,null))[_0x8fb3('0x26')](function(_0x30accf){if(_0x30accf){return _0x30accf['update']({'UserId':_0x2ed8f3[_0x8fb3('0x60')]['UserId'],'read1stAt':_[_0x8fb3('0x6b')](_0x30accf['read1stAt'])?moment()[_0x8fb3('0x6c')](_0x8fb3('0x64')):undefined});}return null;})['then'](function(_0x4d9f92){if(_0x4d9f92){_0x9c065c['interaction']=_0x4d9f92[_0x8fb3('0x68')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2ed8f3[_0x8fb3('0x66')]['id'],_0x2ed8f3[_0x8fb3('0x66')][_0x8fb3('0x3f')],_0x2ed8f3[_0x8fb3('0x66')][_0x8fb3('0x6d')],_0x9c065c[_0x8fb3('0x6e')]['id'],_0x2ed8f3[_0x8fb3('0x60')]?JSON['stringify'](_0x2ed8f3[_0x8fb3('0x60')]):_0x8fb3('0x6f'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x9c065c);}return null;})[_0x8fb3('0x26')](function(_0x26fd12){var _0x45d87a=_0x8fb3('0x70')+_0x26fd12['message'][_0x8fb3('0x71')];return db[_0x8fb3('0x72')][_0x8fb3('0x46')](_0x45d87a,{'type':db['Sequelize']['QueryTypes'][_0x8fb3('0x73')],'raw':!![]})[_0x8fb3('0x26')](function(_0x3cd543){return _0x3cd543;});})['then'](function(_0x2f200c){if(_0x2f200c){_0x9c065c[_0x8fb3('0x2f')]['contact']=_0x2f200c[0x0];if(!_0x2ed8f3['body'][_0x8fb3('0x65')])return;return db[_0x8fb3('0x74')][_0x8fb3('0x5e')]({'where':{'id':_0x2ed8f3['body'][_0x8fb3('0x65')],'role':_0x8fb3('0x67')},'attributes':['id',_0x8fb3('0x3f'),_0x8fb3('0x75'),_0x8fb3('0x76'),_0x8fb3('0x77')],'raw':!![]});}return null;})[_0x8fb3('0x26')](function(_0x4ce03f){if(!_0x4ce03f)return null;_0x9c065c['message']['agent']=_0x4ce03f;return _0x9c065c;})[_0x8fb3('0x26')](function(_0x26d5ca){if(_0x26d5ca){if(_0x2ed8f3[_0x8fb3('0x60')]['manual']){_0x9c065c[_0x8fb3('0x2f')][_0x8fb3('0x78')]=util[_0x8fb3('0x6c')]('SIP/%s',_0x2ed8f3['user']['name']);_0x9c065c[_0x8fb3('0x2f')][_0x8fb3('0x79')]=_0x9c065c['channel'];_0x9c065c[_0x8fb3('0x2f')][_0x8fb3('0x7a')]=_0x9c065c['channel'];_0x9c065c[_0x8fb3('0x2f')]['event']=_0x8fb3('0x7b');return respondWithRpcPromise(_0x8fb3('0x7c'),_0x8fb3('0x7c'),{'event':_0x8fb3('0x7d'),'message':_['merge'](_0x9c065c[_0x8fb3('0x2f')],JSON[_0x8fb3('0x7e')](_0x9c065c[_0x8fb3('0x6e')][_0x8fb3('0x7f')]))},client9002)['then'](function(){return _0x9c065c;});}return _0x9c065c;}return null;})[_0x8fb3('0x26')](respondWithResult(_0xf54379,null))[_0x8fb3('0x31')](handleError(_0xf54379,null));};var interaction_log=require(_0x8fb3('0x17'))(_0x8fb3('0x80'));exports[_0x8fb3('0x3c')]=function(_0xd181b4,_0xe203d2,_0x112d2a){var _0x1f94ea={'agent':{},'channel':_0x8fb3('0x81')};if(_0xd181b4[_0x8fb3('0x60')]['id']){delete _0xd181b4[_0x8fb3('0x60')]['id'];}_0xd181b4[_0x8fb3('0x60')][_0x8fb3('0x65')]=_0xd181b4[_0x8fb3('0x60')][_0x8fb3('0x65')]||_0xd181b4[_0x8fb3('0x66')]['id'];_0x1f94ea['agent']['id']=_0xd181b4[_0x8fb3('0x60')]['UserId'];return db['ChatMessage']['find']({'where':{'id':_0xd181b4[_0x8fb3('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xe203d2,null))[_0x8fb3('0x26')](function(_0x11a0c7){if(_0x11a0c7){_0x1f94ea['message']=_0x11a0c7[_0x8fb3('0x68')]({'plain':!![]});return db['ChatInteraction'][_0x8fb3('0x5e')]({'where':{'id':_0x11a0c7[_0x8fb3('0x6a')]}});}return null;})[_0x8fb3('0x26')](handleEntityNotFound(_0xe203d2,null))[_0x8fb3('0x26')](function(_0x5f1a2f){if(_0x5f1a2f){_0x1f94ea['interaction']=_0x5f1a2f[_0x8fb3('0x68')]({'plain':!![]});interaction_log[_0x8fb3('0x27')](_0x8fb3('0x82'),_0xd181b4[_0x8fb3('0x66')]['id'],_0xd181b4[_0x8fb3('0x66')][_0x8fb3('0x3f')],_0xd181b4['user'][_0x8fb3('0x6d')],_0x1f94ea['interaction']['id'],_0xd181b4[_0x8fb3('0x60')]?JSON[_0x8fb3('0x2b')](_0xd181b4['body']):_0x8fb3('0x6f'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x1f94ea);}return null;})[_0x8fb3('0x26')](function(_0x1d41b3){var _0x129181=_0x8fb3('0x70')+_0x1d41b3[_0x8fb3('0x2f')]['ContactId'];return db[_0x8fb3('0x72')]['query'](_0x129181,{'type':db[_0x8fb3('0x83')][_0x8fb3('0x84')][_0x8fb3('0x73')],'raw':!![]})['then'](function(_0x4217aa){return _0x4217aa;});})[_0x8fb3('0x26')](function(_0x5c689a){if(_0x5c689a){_0x1f94ea['message'][_0x8fb3('0x85')]=_0x5c689a[0x0];if(!_0xd181b4[_0x8fb3('0x60')][_0x8fb3('0x65')])return;return db[_0x8fb3('0x74')]['find']({'where':{'id':_0xd181b4[_0x8fb3('0x60')]['UserId'],'role':'agent'},'attributes':['id',_0x8fb3('0x3f'),'fullname',_0x8fb3('0x76'),_0x8fb3('0x77')],'raw':!![]});}return null;})[_0x8fb3('0x26')](function(_0x1ec2ec){if(!_0x1ec2ec)return null;_0x1f94ea[_0x8fb3('0x2f')]['agent']=_0x1ec2ec;return _0x1f94ea;})[_0x8fb3('0x26')](function(_0x15a80f){if(_0x15a80f){_0x15a80f[_0x8fb3('0x2f')]['interface']=util[_0x8fb3('0x6c')](_0x8fb3('0x86'),_0xd181b4[_0x8fb3('0x66')][_0x8fb3('0x3f')]);_0x15a80f[_0x8fb3('0x2f')]['channel']=_0x1f94ea[_0x8fb3('0x79')];_0x15a80f[_0x8fb3('0x2f')][_0x8fb3('0x7a')]=_0x1f94ea[_0x8fb3('0x79')];_0x15a80f['message'][_0x8fb3('0x87')]=_0x8fb3('0x3c');respondWithRpcPromise(_0x8fb3('0x7c'),_0x8fb3('0x7c'),{'event':'rejectmessage','message':_[_0x8fb3('0x53')](_0x1f94ea['message'],JSON['parse'](_0x1f94ea[_0x8fb3('0x6e')][_0x8fb3('0x7f')]))},client9002);return _0x1f94ea;}return null;})[_0x8fb3('0x26')](respondWithResult(_0xe203d2,null))[_0x8fb3('0x31')](handleError(_0xe203d2,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 448cbda..fe97697 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 _0xe2ba=['emit','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','update','remove'];(function(_0x52061c,_0x2af3e7){var _0x4ac570=function(_0xd83173){while(--_0xd83173){_0x52061c['push'](_0x52061c['shift']());}};_0x4ac570(++_0x2af3e7);}(_0xe2ba,0x19b));var _0xae2b=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xe2ba[_0x334841];return _0x5beb4b;};'use strict';var EventEmitter=require(_0xae2b('0x0'));var ChatMessage=require(_0xae2b('0x1'))['db'][_0xae2b('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xae2b('0x3'),'afterDestroy':_0xae2b('0x4')};function emitEvent(_0x49ff3c){return function(_0x26db90,_0x271a9a,_0x4413aa){ChatMessageEvents['emit'](_0x49ff3c+':'+_0x26db90['id'],_0x26db90);ChatMessageEvents[_0xae2b('0x5')](_0x49ff3c,_0x26db90);_0x4413aa(null);};}for(var e in events){if(events[_0xae2b('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xae2b('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x9c2b=['emit','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','remove'];(function(_0x3e6b44,_0x4f542f){var _0x3cdb8d=function(_0x12fa08){while(--_0x12fa08){_0x3e6b44['push'](_0x3e6b44['shift']());}};_0x3cdb8d(++_0x4f542f);}(_0x9c2b,0x1f3));var _0xb9c2=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x9c2b[_0x4b2436];return _0x4f5ab2;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xb9c2('0x0'))['db'][_0xb9c2('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xb9c2('0x2')](0x0);var events={'afterCreate':_0xb9c2('0x3'),'afterUpdate':'update','afterDestroy':_0xb9c2('0x4')};function emitEvent(_0x393b29){return function(_0x297b1b,_0x5d7338,_0x29ff51){ChatMessageEvents['emit'](_0x393b29+':'+_0x297b1b['id'],_0x297b1b);ChatMessageEvents[_0xb9c2('0x5')](_0x393b29,_0x297b1b);_0x29ff51(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xb9c2('0x6')](e,emitEvent(event));}}module[_0xb9c2('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 5ba9550..c194046 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 _0xfd4e=['toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','chat_messages','body','FULLTEXT','models','get','direction'];(function(_0xc9fa65,_0x5d4d49){var _0x4ba605=function(_0x261320){while(--_0x261320){_0xc9fa65['push'](_0xc9fa65['shift']());}};_0x4ba605(++_0x5d4d49);}(_0xfd4e,0x1a0));var _0xefd4=function(_0x415e4d,_0x17ebc2){_0x415e4d=_0x415e4d-0x0;var _0x2a81d6=_0xfd4e[_0x415e4d];return _0x2a81d6;};'use strict';var _=require('lodash');var util=require(_0xefd4('0x0'));var logger=require(_0xefd4('0x1'))(_0xefd4('0x2'));var moment=require(_0xefd4('0x3'));var BPromise=require(_0xefd4('0x4'));var rp=require(_0xefd4('0x5'));var fs=require('fs');var path=require(_0xefd4('0x6'));var rimraf=require(_0xefd4('0x7'));var config=require(_0xefd4('0x8'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0x2d145a,_0x2e7a82){return _0x2d145a[_0xefd4('0x9')]('ChatMessage',attributes,{'tableName':_0xefd4('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xefd4('0xb')],'type':_0xefd4('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x364e4d,_0x4d4773,_0x3c5fbc){var _0x3b4726=_0x2d145a[_0xefd4('0xd')];var _0x322afc=_0x364e4d[_0xefd4('0xe')]({'plain':!![]});if(_0x322afc[_0xefd4('0xf')][_0xefd4('0x10')]()==='in'||_0x322afc['direction'][_0xefd4('0x10')]()===_0xefd4('0x11')&&!_0x322afc[_0xefd4('0x12')]&&!_['isNil'](_0x322afc[_0xefd4('0x13')])){_0x3b4726[_0xefd4('0x14')][_0xefd4('0x15')]({'where':{'id':_0x322afc[_0xefd4('0x16')]}})['then'](function(_0x18d1f6){if(_0x18d1f6){_0x18d1f6[_0xefd4('0x17')]({'lastMsgAt':_0x322afc[_0xefd4('0x18')],'lastMsgDirection':_0x322afc[_0xefd4('0xf')][_0xefd4('0x10')]()});}})['catch'](function(_0x1a568c){console['error'](_0x1a568c);});}_0x3c5fbc();}},'charset':_0xefd4('0x19'),'collate':_0xefd4('0x1a')});}; \ No newline at end of file +var _0x0081=['toLowerCase','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','direction','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','chat_messages','body','FULLTEXT','models'];(function(_0x1ea012,_0x2ba44e){var _0x2ddab2=function(_0x1b7623){while(--_0x1b7623){_0x1ea012['push'](_0x1ea012['shift']());}};_0x2ddab2(++_0x2ba44e);}(_0x0081,0xba));var _0x1008=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x0081[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x1008('0x0'));var util=require(_0x1008('0x1'));var logger=require(_0x1008('0x2'))(_0x1008('0x3'));var moment=require(_0x1008('0x4'));var BPromise=require(_0x1008('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1008('0x6'));var config=require(_0x1008('0x7'));var attributes=require('./chatMessage.attributes');module[_0x1008('0x8')]=function(_0x54ddb5,_0x2dfa9b){return _0x54ddb5[_0x1008('0x9')]('ChatMessage',attributes,{'tableName':_0x1008('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x1008('0xb')],'type':_0x1008('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x43929a,_0x3e0bc7,_0x4114ec){var _0x117176=_0x54ddb5[_0x1008('0xd')];var _0x54bfc8=_0x43929a['get']({'plain':!![]});if(_0x54bfc8['direction']['toLowerCase']()==='in'||_0x54bfc8['direction'][_0x1008('0xe')]()===_0x1008('0xf')&&!_0x54bfc8['secret']&&!_[_0x1008('0x10')](_0x54bfc8[_0x1008('0x11')])){_0x117176[_0x1008('0x12')][_0x1008('0x13')]({'where':{'id':_0x54bfc8[_0x1008('0x14')]}})['then'](function(_0xe2b55c){if(_0xe2b55c){_0xe2b55c[_0x1008('0x15')]({'lastMsgAt':_0x54bfc8[_0x1008('0x16')],'lastMsgDirection':_0x54bfc8[_0x1008('0x17')][_0x1008('0xe')]()});}})['catch'](function(_0x5883a9){console['error'](_0x5883a9);});}_0x4114ec();}},'charset':'utf8mb4','collate':_0x1008('0x18')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 40f27c5..4d078c0 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 _0x66da=['ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request'];(function(_0x347ba9,_0x4e4cd7){var _0x238ac6=function(_0x1948af){while(--_0x1948af){_0x347ba9['push'](_0x347ba9['shift']());}};_0x238ac6(++_0x4e4cd7);}(_0x66da,0x16f));var _0xa66d=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x66da[_0x42bc91];return _0x3f5507;};'use strict';var _=require(_0xa66d('0x0'));var util=require(_0xa66d('0x1'));var moment=require(_0xa66d('0x2'));var BPromise=require(_0xa66d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa66d('0x4'));var logger=require(_0xa66d('0x5'))(_0xa66d('0x6'));var config=require(_0xa66d('0x7'));var jayson=require(_0xa66d('0x8'));var client=jayson['client'][_0xa66d('0x9')]({'port':0x232a});config[_0xa66d('0xa')]=_[_0xa66d('0xb')](config[_0xa66d('0xa')],{'host':_0xa66d('0xc'),'port':0x18eb});var socket=require(_0xa66d('0xd'))(new Redis(config[_0xa66d('0xa')]));require(_0xa66d('0xe'))[_0xa66d('0xf')](socket);function respondWithRpcPromise(_0x9becae,_0x22b38f,_0x1e65b0){return new BPromise(function(_0x4c0dde,_0x92016b){return client[_0xa66d('0x10')](_0x9becae,_0x1e65b0)['then'](function(_0x4906cd){logger['info'](_0xa66d('0x11'),_0x22b38f,'request\x20sent');logger[_0xa66d('0x12')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x22b38f,_0xa66d('0x13'),JSON[_0xa66d('0x14')](_0x4906cd));if(_0x4906cd['error']){if(_0x4906cd[_0xa66d('0x15')][_0xa66d('0x16')]===0x1f4){logger['error'](_0xa66d('0x11'),_0x22b38f,_0x4906cd['error'][_0xa66d('0x17')]);return _0x92016b(_0x4906cd['error'][_0xa66d('0x17')]);}logger[_0xa66d('0x15')]('ChatMessage,\x20%s,\x20%s',_0x22b38f,_0x4906cd[_0xa66d('0x15')][_0xa66d('0x17')]);return _0x4c0dde(_0x4906cd[_0xa66d('0x15')][_0xa66d('0x17')]);}else{logger[_0xa66d('0x18')]('ChatMessage,\x20%s,\x20%s',_0x22b38f,_0xa66d('0x13'));_0x4c0dde(_0x4906cd['result'][_0xa66d('0x17')]);}})[_0xa66d('0x19')](function(_0x55db3b){logger[_0xa66d('0x15')](_0xa66d('0x11'),_0x22b38f,_0x55db3b);_0x92016b(_0x55db3b);});});}exports[_0xa66d('0x1a')]=function(_0x3d0219){var _0x5082de=this;return new Promise(function(_0xee7546,_0x232fe3){return db[_0xa66d('0x1b')][_0xa66d('0x1c')](_0x3d0219[_0xa66d('0x1d')],{'raw':_0x3d0219[_0xa66d('0x1e')]?_0x3d0219['options'][_0xa66d('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0xfde811){logger[_0xa66d('0x18')](_0xa66d('0x1a'),_0x3d0219);logger[_0xa66d('0x12')](_0xa66d('0x1a'),_0x3d0219,JSON[_0xa66d('0x14')](_0xfde811));_0xee7546(_0xfde811);})['catch'](function(_0x42527c){logger['error'](_0xa66d('0x1a'),_0x42527c[_0xa66d('0x17')],_0x3d0219);_0x232fe3(_0x5082de[_0xa66d('0x15')](0x1f4,_0x42527c[_0xa66d('0x17')]));});});}; \ No newline at end of file +var _0x4316=['request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ChatMessage','body','options','raw','CreateChatMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4316,0x1ee));var _0x6431=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4316[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6431('0x0'));var util=require(_0x6431('0x1'));var moment=require(_0x6431('0x2'));var BPromise=require(_0x6431('0x3'));var rs=require(_0x6431('0x4'));var fs=require('fs');var Redis=require(_0x6431('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6431('0x6'));var logger=require(_0x6431('0x7'))(_0x6431('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6431('0x9')][_0x6431('0xa')]({'port':0x232a});config[_0x6431('0xb')]=_[_0x6431('0xc')](config['redis'],{'host':_0x6431('0xd'),'port':0x18eb});var socket=require(_0x6431('0xe'))(new Redis(config[_0x6431('0xb')]));require('./chatMessage.socket')[_0x6431('0xf')](socket);function respondWithRpcPromise(_0x31eefa,_0x16290f,_0x54fe38){return new BPromise(function(_0xfd1c6c,_0x227fe0){return client[_0x6431('0x10')](_0x31eefa,_0x54fe38)[_0x6431('0x11')](function(_0x3417f4){logger[_0x6431('0x12')](_0x6431('0x13'),_0x16290f,_0x6431('0x14'));logger[_0x6431('0x15')](_0x6431('0x16'),_0x16290f,_0x6431('0x14'),JSON['stringify'](_0x3417f4));if(_0x3417f4[_0x6431('0x17')]){if(_0x3417f4[_0x6431('0x17')][_0x6431('0x18')]===0x1f4){logger[_0x6431('0x17')]('ChatMessage,\x20%s,\x20%s',_0x16290f,_0x3417f4[_0x6431('0x17')][_0x6431('0x19')]);return _0x227fe0(_0x3417f4['error'][_0x6431('0x19')]);}logger[_0x6431('0x17')](_0x6431('0x13'),_0x16290f,_0x3417f4[_0x6431('0x17')][_0x6431('0x19')]);return _0xfd1c6c(_0x3417f4[_0x6431('0x17')][_0x6431('0x19')]);}else{logger['info'](_0x6431('0x13'),_0x16290f,_0x6431('0x14'));_0xfd1c6c(_0x3417f4[_0x6431('0x1a')][_0x6431('0x19')]);}})[_0x6431('0x1b')](function(_0x2174e1){logger[_0x6431('0x17')](_0x6431('0x13'),_0x16290f,_0x2174e1);_0x227fe0(_0x2174e1);});});}exports['CreateChatMessage']=function(_0x55c81d){var _0x2afb68=this;return new Promise(function(_0x3690d1,_0x373fcb){return db[_0x6431('0x1c')]['create'](_0x55c81d[_0x6431('0x1d')],{'raw':_0x55c81d[_0x6431('0x1e')]?_0x55c81d[_0x6431('0x1e')][_0x6431('0x1f')]===undefined?!![]:![]:!![]})[_0x6431('0x11')](function(_0xcc28aa){logger[_0x6431('0x12')]('CreateChatMessage',_0x55c81d);logger['debug'](_0x6431('0x20'),_0x55c81d,JSON[_0x6431('0x21')](_0xcc28aa));_0x3690d1(_0xcc28aa);})['catch'](function(_0x5364cb){logger[_0x6431('0x17')](_0x6431('0x20'),_0x5364cb[_0x6431('0x19')],_0x55c81d);_0x373fcb(_0x2afb68[_0x6431('0x17')](0x1f4,_0x5364cb['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index d57f778..21bfc3c 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 _0x0bde=['save','update','emit','removeListener','register','length','chatMessage:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bde,0xe7));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xe0bd('0x0'),'remove',_0xe0bd('0x1')];function createListener(_0x3dc984,_0x1d8922){return function(_0x1e198a){_0x1d8922[_0xe0bd('0x2')](_0x3dc984,_0x1e198a);};}function removeListener(_0x5541b9,_0x34df88){return function(){ChatMessageEvents[_0xe0bd('0x3')](_0x5541b9,_0x34df88);};}exports[_0xe0bd('0x4')]=function(_0x3b712a){for(var _0x22bfd1=0x0,_0x26393f=events[_0xe0bd('0x5')];_0x22bfd1<_0x26393f;_0x22bfd1++){var _0x491dc7=events[_0x22bfd1];var _0x40b36a=createListener(_0xe0bd('0x6')+_0x491dc7,_0x3b712a);ChatMessageEvents['on'](_0x491dc7,_0x40b36a);}}; \ No newline at end of file +var _0x7118=['length','chatMessage:','remove','update','emit','removeListener','register'];(function(_0x819e48,_0x430040){var _0x522d4a=function(_0x1bb24f){while(--_0x1bb24f){_0x819e48['push'](_0x819e48['shift']());}};_0x522d4a(++_0x430040);}(_0x7118,0x159));var _0x8711=function(_0x1fea8c,_0x20ceb5){_0x1fea8c=_0x1fea8c-0x0;var _0x129b9d=_0x7118[_0x1fea8c];return _0x129b9d;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x8711('0x0'),_0x8711('0x1')];function createListener(_0x5c64d4,_0x1758c5){return function(_0x3ea36f){_0x1758c5[_0x8711('0x2')](_0x5c64d4,_0x3ea36f);};}function removeListener(_0x259c36,_0x12496b){return function(){ChatMessageEvents[_0x8711('0x3')](_0x259c36,_0x12496b);};}exports[_0x8711('0x4')]=function(_0x54885e){for(var _0x385033=0x0,_0x2244c2=events[_0x8711('0x5')];_0x385033<_0x2244c2;_0x385033++){var _0x3d82f2=events[_0x385033];var _0x189349=createListener(_0x8711('0x6')+_0x3d82f2,_0x54885e);ChatMessageEvents['on'](_0x3d82f2,_0x189349);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 9bec236..20c7c41 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 _0x467f=['update','accept','/:id/reject','reject','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','index','get','describe','/:id','show','post','isAuthenticated','tracked','put'];(function(_0x3bd8ba,_0x1df4ce){var _0x9c8b58=function(_0x18ebde){while(--_0x18ebde){_0x3bd8ba['push'](_0x3bd8ba['shift']());}};_0x9c8b58(++_0x1df4ce);}(_0x467f,0x10d));var _0xf467=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x467f[_0x39c734];return _0xb2a2f9;};'use strict';var multer=require(_0xf467('0x0'));var util=require(_0xf467('0x1'));var path=require(_0xf467('0x2'));var timeout=require('connect-timeout');var express=require(_0xf467('0x3'));var router=express[_0xf467('0x4')]();var fs_extra=require(_0xf467('0x5'));var auth=require(_0xf467('0x6'));var interaction=require(_0xf467('0x7'));var config=require(_0xf467('0x8'));var controller=require(_0xf467('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf467('0xa')]);router[_0xf467('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xf467('0xc')]);router[_0xf467('0xb')](_0xf467('0xd'),auth['isAuthenticated'](),controller[_0xf467('0xe')]);router[_0xf467('0xf')]('/',auth[_0xf467('0x10')](),interaction[_0xf467('0x11')]('chat','chatmessage:create'),controller['create']);router[_0xf467('0x12')](_0xf467('0xd'),controller[_0xf467('0x13')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0xf467('0x14')]);router['put'](_0xf467('0x15'),auth[_0xf467('0x10')](),controller[_0xf467('0x16')]);router['delete'](_0xf467('0xd'),auth[_0xf467('0x10')](),controller['destroy']);module[_0xf467('0x17')]=router; \ No newline at end of file +var _0x9125=['update','/:id/accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','chat','put'];(function(_0x402731,_0x43c115){var _0x111736=function(_0x5a7044){while(--_0x5a7044){_0x402731['push'](_0x402731['shift']());}};_0x111736(++_0x43c115);}(_0x9125,0x19b));var _0x5912=function(_0xd02bb,_0x26e2d0){_0xd02bb=_0xd02bb-0x0;var _0x1cdf23=_0x9125[_0xd02bb];return _0x1cdf23;};'use strict';var multer=require(_0x5912('0x0'));var util=require(_0x5912('0x1'));var path=require(_0x5912('0x2'));var timeout=require(_0x5912('0x3'));var express=require(_0x5912('0x4'));var router=express[_0x5912('0x5')]();var fs_extra=require(_0x5912('0x6'));var auth=require(_0x5912('0x7'));var interaction=require(_0x5912('0x8'));var config=require('../../config/environment');var controller=require(_0x5912('0x9'));router['get']('/',auth[_0x5912('0xa')](),controller[_0x5912('0xb')]);router[_0x5912('0xc')](_0x5912('0xd'),auth[_0x5912('0xa')](),controller[_0x5912('0xe')]);router['get'](_0x5912('0xf'),auth[_0x5912('0xa')](),controller[_0x5912('0x10')]);router[_0x5912('0x11')]('/',auth[_0x5912('0xa')](),interaction[_0x5912('0x12')](_0x5912('0x13'),'chatmessage:create'),controller['create']);router[_0x5912('0x14')](_0x5912('0xf'),controller[_0x5912('0x15')]);router[_0x5912('0x14')](_0x5912('0x16'),auth[_0x5912('0xa')](),controller['accept']);router[_0x5912('0x14')](_0x5912('0x17'),auth['isAuthenticated'](),controller['reject']);router[_0x5912('0x18')](_0x5912('0xf'),auth['isAuthenticated'](),controller[_0x5912('0x19')]);module[_0x5912('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 567e787..3e77d75 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 _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x606d02,_0x405657){var _0x12011a=function(_0x126e8b){while(--_0x126e8b){_0x606d02['push'](_0x606d02['shift']());}};_0x12011a(++_0x405657);}(_0xdb28,0x106));var _0x8db2=function(_0x579347,_0x3ce9df){_0x579347=_0x579347-0x0;var _0x3776d2=_0xdb28[_0x579347];return _0x3776d2;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x55f16e,_0x3b3c88){var _0x4777ba=function(_0x54fa72){while(--_0x54fa72){_0x55f16e['push'](_0x55f16e['shift']());}};_0x4777ba(++_0x3b3c88);}(_0xdb28,0x106));var _0x8db2=function(_0x5a7b6e,_0x41b082){_0x5a7b6e=_0x5a7b6e-0x0;var _0x39d50b=_0xdb28[_0x5a7b6e];return _0x39d50b;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 23bc05f..7a58a15 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 _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(_0x4cb9d0,_0x4e8e4f){var _0x173a77=function(_0x1e9d48){while(--_0x1e9d48){_0x4cb9d0['push'](_0x4cb9d0['shift']());}};_0x173a77(++_0x4e8e4f);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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 +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(_0x1e32a2,_0x41fdb4){var _0x1146b2=function(_0xf04d33){while(--_0xf04d33){_0x1e32a2['push'](_0x1e32a2['shift']());}};_0x1146b2(++_0x41fdb4);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 65ad049..9b27cf0 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 _0x5709=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','save','update','remove'];(function(_0x2924d3,_0x43216b){var _0x4be4e4=function(_0x57446b){while(--_0x57446b){_0x2924d3['push'](_0x2924d3['shift']());}};_0x4be4e4(++_0x43216b);}(_0x5709,0x158));var _0x9570=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5709[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x9570('0x0'));var ChatOfflineMessage=require(_0x9570('0x1'))['db'][_0x9570('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9570('0x3'),'afterUpdate':_0x9570('0x4'),'afterDestroy':_0x9570('0x5')};function emitEvent(_0x52e787){return function(_0x2c9ed0,_0x59262b,_0x47e2e3){ChatOfflineMessageEvents[_0x9570('0x6')](_0x52e787+':'+_0x2c9ed0['id'],_0x2c9ed0);ChatOfflineMessageEvents[_0x9570('0x6')](_0x52e787,_0x2c9ed0);_0x47e2e3(null);};}for(var e in events){if(events[_0x9570('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x9570('0x8')](e,emitEvent(event));}}module[_0x9570('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x3c96=['events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x160e1b,_0xd246a){var _0x3e8455=function(_0x1354c2){while(--_0x1354c2){_0x160e1b['push'](_0x160e1b['shift']());}};_0x3e8455(++_0xd246a);}(_0x3c96,0xfa));var _0x63c9=function(_0x2f9351,_0x3a115f){_0x2f9351=_0x2f9351-0x0;var _0x256360=_0x3c96[_0x2f9351];return _0x256360;};'use strict';var EventEmitter=require(_0x63c9('0x0'));var ChatOfflineMessage=require(_0x63c9('0x1'))['db'][_0x63c9('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x63c9('0x3')](0x0);var events={'afterCreate':_0x63c9('0x4'),'afterUpdate':_0x63c9('0x5'),'afterDestroy':_0x63c9('0x6')};function emitEvent(_0x40560a){return function(_0x36478b,_0x784db4,_0x1d0bb3){ChatOfflineMessageEvents['emit'](_0x40560a+':'+_0x36478b['id'],_0x36478b);ChatOfflineMessageEvents['emit'](_0x40560a,_0x36478b);_0x1d0bb3(null);};}for(var e in events){if(events[_0x63c9('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x63c9('0x8')](e,emitEvent(event));}}module[_0x63c9('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 1d5f4d4..481fceb 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 _0x70a4=['ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define'];(function(_0x38df49,_0x343e54){var _0x22d1d8=function(_0x15aabe){while(--_0x15aabe){_0x38df49['push'](_0x38df49['shift']());}};_0x22d1d8(++_0x343e54);}(_0x70a4,0x154));var _0x470a=function(_0x16ea87,_0x378d8b){_0x16ea87=_0x16ea87-0x0;var _0x6e7b1c=_0x70a4[_0x16ea87];return _0x6e7b1c;};'use strict';var attributes=require(_0x470a('0x0'));module[_0x470a('0x1')]=function(_0xbc2fe5){return _0xbc2fe5[_0x470a('0x2')](_0x470a('0x3'),attributes,{'tableName':_0x470a('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x470a('0x5'),'collate':_0x470a('0x6')});}; \ No newline at end of file +var _0xb7f8=['exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x3f88bc,_0xe38cf5){var _0x4df1c4=function(_0x111de1){while(--_0x111de1){_0x3f88bc['push'](_0x3f88bc['shift']());}};_0x4df1c4(++_0xe38cf5);}(_0xb7f8,0x141));var _0x8b7f=function(_0x48b690,_0x4f41be){_0x48b690=_0x48b690-0x0;var _0x4139d4=_0xb7f8[_0x48b690];return _0x4139d4;};'use strict';var attributes=require(_0x8b7f('0x0'));module[_0x8b7f('0x1')]=function(_0x35957e){return _0x35957e[_0x8b7f('0x2')](_0x8b7f('0x3'),attributes,{'tableName':_0x8b7f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8b7f('0x5'),'collate':_0x8b7f('0x6')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 2d0c987..fcdcfb1 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 _0xd78e=['rpc','../../config/environment','client','http','then','info','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x45f457,_0x3ea3c6){var _0x7fdfa=function(_0x1e93a4){while(--_0x1e93a4){_0x45f457['push'](_0x45f457['shift']());}};_0x7fdfa(++_0x3ea3c6);}(_0xd78e,0x19b));var _0xed78=function(_0x57da0a,_0x284aed){_0x57da0a=_0x57da0a-0x0;var _0x3145d5=_0xd78e[_0x57da0a];return _0x3145d5;};'use strict';var _=require('lodash');var util=require(_0xed78('0x0'));var moment=require(_0xed78('0x1'));var BPromise=require(_0xed78('0x2'));var rs=require(_0xed78('0x3'));var fs=require('fs');var Redis=require(_0xed78('0x4'));var db=require(_0xed78('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xed78('0x6'))(_0xed78('0x7'));var config=require(_0xed78('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xed78('0x9')][_0xed78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x249039,_0x591dc0,_0x2f5643){return new BPromise(function(_0x45a537,_0x48badf){return client['request'](_0x249039,_0x2f5643)[_0xed78('0xb')](function(_0x3bfc8b){logger[_0xed78('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x591dc0,'request\x20sent');logger[_0xed78('0xd')](_0xed78('0xe'),_0x591dc0,_0xed78('0xf'),JSON[_0xed78('0x10')](_0x3bfc8b));if(_0x3bfc8b['error']){if(_0x3bfc8b['error']['code']===0x1f4){logger[_0xed78('0x11')](_0xed78('0x12'),_0x591dc0,_0x3bfc8b[_0xed78('0x11')]['message']);return _0x48badf(_0x3bfc8b[_0xed78('0x11')]['message']);}logger[_0xed78('0x11')](_0xed78('0x12'),_0x591dc0,_0x3bfc8b[_0xed78('0x11')][_0xed78('0x13')]);return _0x45a537(_0x3bfc8b[_0xed78('0x11')]['message']);}else{logger[_0xed78('0xc')](_0xed78('0x12'),_0x591dc0,_0xed78('0xf'));_0x45a537(_0x3bfc8b[_0xed78('0x14')][_0xed78('0x13')]);}})[_0xed78('0x15')](function(_0x2ce9d8){logger[_0xed78('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x591dc0,_0x2ce9d8);_0x48badf(_0x2ce9d8);});});} \ No newline at end of file +var _0xdf97=['client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x4226e8,_0x5cdd46){var _0x13c031=function(_0x59356b){while(--_0x59356b){_0x4226e8['push'](_0x4226e8['shift']());}};_0x13c031(++_0x5cdd46);}(_0xdf97,0x1c7));var _0x7df9=function(_0x3f43fa,_0x1ccd65){_0x3f43fa=_0x3f43fa-0x0;var _0x3cf4bb=_0xdf97[_0x3f43fa];return _0x3cf4bb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7df9('0x0'));var BPromise=require(_0x7df9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7df9('0x2'));var db=require(_0x7df9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7df9('0x4'))(_0x7df9('0x5'));var config=require('../../config/environment');var jayson=require(_0x7df9('0x6'));var client=jayson[_0x7df9('0x7')][_0x7df9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x200298,_0x41341e,_0x1e5eb7){return new BPromise(function(_0x3c1661,_0x9e6b7e){return client[_0x7df9('0x9')](_0x200298,_0x1e5eb7)[_0x7df9('0xa')](function(_0x11d45c){logger['info'](_0x7df9('0xb'),_0x41341e,'request\x20sent');logger[_0x7df9('0xc')](_0x7df9('0xd'),_0x41341e,_0x7df9('0xe'),JSON[_0x7df9('0xf')](_0x11d45c));if(_0x11d45c['error']){if(_0x11d45c[_0x7df9('0x10')][_0x7df9('0x11')]===0x1f4){logger['error'](_0x7df9('0xb'),_0x41341e,_0x11d45c[_0x7df9('0x10')][_0x7df9('0x12')]);return _0x9e6b7e(_0x11d45c[_0x7df9('0x10')][_0x7df9('0x12')]);}logger[_0x7df9('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x41341e,_0x11d45c[_0x7df9('0x10')][_0x7df9('0x12')]);return _0x3c1661(_0x11d45c[_0x7df9('0x10')][_0x7df9('0x12')]);}else{logger[_0x7df9('0x13')](_0x7df9('0xb'),_0x41341e,_0x7df9('0xe'));_0x3c1661(_0x11d45c[_0x7df9('0x14')][_0x7df9('0x12')]);}})[_0x7df9('0x15')](function(_0x4d2bad){logger[_0x7df9('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x41341e,_0x4d2bad);_0x9e6b7e(_0x4d2bad);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index f0ba2f3..c274e74 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 _0xe608=['fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x190a41,_0x5b0d39){var _0x2a8e65=function(_0x4a770c){while(--_0x4a770c){_0x190a41['push'](_0x190a41['shift']());}};_0x2a8e65(++_0x5b0d39);}(_0xe608,0x19f));var _0x8e60=function(_0x267c52,_0x3c0df3){_0x267c52=_0x267c52-0x0;var _0x46c47b=_0xe608[_0x267c52];return _0x46c47b;};'use strict';var multer=require(_0x8e60('0x0'));var util=require(_0x8e60('0x1'));var path=require('path');var timeout=require(_0x8e60('0x2'));var express=require(_0x8e60('0x3'));var router=express[_0x8e60('0x4')]();var fs_extra=require(_0x8e60('0x5'));var auth=require(_0x8e60('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8e60('0x7'));var controller=require(_0x8e60('0x8'));router[_0x8e60('0x9')]('/',auth[_0x8e60('0xa')](),controller[_0x8e60('0xb')]);router['get'](_0x8e60('0xc'),auth['isAuthenticated'](),controller[_0x8e60('0xd')]);router[_0x8e60('0x9')]('/:id',auth[_0x8e60('0xa')](),controller['show']);router[_0x8e60('0xe')]('/',auth[_0x8e60('0xa')](),controller[_0x8e60('0xf')]);router[_0x8e60('0x10')](_0x8e60('0x11'),auth[_0x8e60('0xa')](),controller[_0x8e60('0x12')]);router['delete'](_0x8e60('0x11'),auth[_0x8e60('0xa')](),controller[_0x8e60('0x13')]);module[_0x8e60('0x14')]=router; \ No newline at end of file +var _0x42cb=['../../components/interaction/service','./chatOfflineMessage.controller','isAuthenticated','index','get','/:id','create','put','update','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x5bfe13,_0x3f0c62){var _0x4f8eae=function(_0x5008ed){while(--_0x5008ed){_0x5bfe13['push'](_0x5bfe13['shift']());}};_0x4f8eae(++_0x3f0c62);}(_0x42cb,0x15a));var _0xb42c=function(_0x16fee4,_0x1856c3){_0x16fee4=_0x16fee4-0x0;var _0x12702d=_0x42cb[_0x16fee4];return _0x12702d;};'use strict';var multer=require(_0xb42c('0x0'));var util=require(_0xb42c('0x1'));var path=require(_0xb42c('0x2'));var timeout=require(_0xb42c('0x3'));var express=require('express');var router=express[_0xb42c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb42c('0x5'));var interaction=require(_0xb42c('0x6'));var config=require('../../config/environment');var controller=require(_0xb42c('0x7'));router['get']('/',auth[_0xb42c('0x8')](),controller[_0xb42c('0x9')]);router[_0xb42c('0xa')]('/describe',auth[_0xb42c('0x8')](),controller['describe']);router['get'](_0xb42c('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xb42c('0x8')](),controller[_0xb42c('0xc')]);router[_0xb42c('0xd')](_0xb42c('0xb'),auth[_0xb42c('0x8')](),controller[_0xb42c('0xe')]);router['delete'](_0xb42c('0xb'),auth[_0xb42c('0x8')](),controller[_0xb42c('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 910f125..8acf829 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 _0x0e91=['sequelize','exports','mouseOver'];(function(_0x1d9dc3,_0x59e248){var _0x4f08bc=function(_0x598fda){while(--_0x598fda){_0x1d9dc3['push'](_0x1d9dc3['shift']());}};_0x4f08bc(++_0x59e248);}(_0x0e91,0xf0));var _0x10e9=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0x0e91[_0x56740a];return _0x257144;};'use strict';var Sequelize=require(_0x10e9('0x0'));module[_0x10e9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x10e9('0x2'),'timeout'),'defaultValue':_0x10e9('0x2')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1f02=['mouseOver','INTEGER','exports','STRING','ENUM'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x1f02,0xde));var _0x21f0=function(_0x2363ea,_0x23d302){_0x2363ea=_0x2363ea-0x0;var _0x293483=_0x1f02[_0x2363ea];return _0x293483;};'use strict';var Sequelize=require('sequelize');module[_0x21f0('0x0')]={'name':{'type':Sequelize[_0x21f0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x21f0('0x2')](_0x21f0('0x3'),'timeout'),'defaultValue':_0x21f0('0x3')},'selector':{'type':Sequelize[_0x21f0('0x1')]},'timeout':{'type':Sequelize[_0x21f0('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 527b6a6..4578ce7 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 _0x6737=['request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','update','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','catch','create','body','rimraf','zip-dir'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x6737,0xe2));var _0x7673=function(_0x53fa19,_0x55cb48){_0x53fa19=_0x53fa19-0x0;var _0x42a55a=_0x6737[_0x53fa19];return _0x42a55a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7673('0x0'));var zipdir=require(_0x7673('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7673('0x2'));var moment=require(_0x7673('0x3'));var BPromise=require(_0x7673('0x4'));var Mustache=require(_0x7673('0x5'));var util=require('util');var path=require(_0x7673('0x6'));var sox=require(_0x7673('0x7'));var csv=require('to-csv');var ejs=require(_0x7673('0x8'));var fs=require('fs');var fs_extra=require(_0x7673('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7673('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7673('0xb'));var Papa=require(_0x7673('0xc'));var Redis=require('ioredis');var authService=require(_0x7673('0xd'));var qs=require(_0x7673('0xe'));var as=require(_0x7673('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7673('0x10'));var utils=require('../../config/utils');var config=require(_0x7673('0x11'));var licenseUtil=require(_0x7673('0x12'));var db=require(_0x7673('0x13'))['db'];function respondWithStatusCode(_0x451c87,_0x41d6bd){_0x41d6bd=_0x41d6bd||0xcc;return function(_0x119e42){if(_0x119e42){return _0x451c87[_0x7673('0x14')](_0x41d6bd);}return _0x451c87[_0x7673('0x15')](_0x41d6bd)[_0x7673('0x16')]();};}function respondWithResult(_0x20a649,_0x5c8626){_0x5c8626=_0x5c8626||0xc8;return function(_0x26f0c4){if(_0x26f0c4){return _0x20a649[_0x7673('0x15')](_0x5c8626)[_0x7673('0x17')](_0x26f0c4);}};}function respondWithFilteredResult(_0x2c83d,_0x224cea){return function(_0x2e83c4){if(_0x2e83c4){var _0x2a2840=typeof _0x224cea['offset']==='undefined'&&typeof _0x224cea[_0x7673('0x18')]===_0x7673('0x19');var _0x50f8d9=_0x2e83c4[_0x7673('0x1a')];var _0x17699a=_0x2a2840?0x0:_0x224cea['offset'];var _0x33ff7d=_0x2a2840?_0x2e83c4[_0x7673('0x1a')]:_0x224cea[_0x7673('0x1b')]+_0x224cea['limit'];var _0x50f22d;if(_0x33ff7d>=_0x50f8d9){_0x33ff7d=_0x50f8d9;_0x50f22d=0xc8;}else{_0x50f22d=0xce;}_0x2c83d[_0x7673('0x15')](_0x50f22d);return _0x2c83d[_0x7673('0x1c')]('Content-Range',_0x17699a+'-'+_0x33ff7d+'/'+_0x50f8d9)[_0x7673('0x17')](_0x2e83c4);}return null;};}function patchUpdates(_0x29bbd9){return function(_0x2e1260){try{jsonpatch[_0x7673('0x1d')](_0x2e1260,_0x29bbd9,!![]);}catch(_0x4245bf){return BPromise[_0x7673('0x1e')](_0x4245bf);}return _0x2e1260['save']();};}function saveUpdates(_0x557161,_0xea9b37){return function(_0x21774f){if(_0x21774f){return _0x21774f[_0x7673('0x1f')](_0x557161)[_0x7673('0x20')](function(_0x16bb16){return _0x16bb16;});}return null;};}function removeEntity(_0x54f38d,_0x2009e1){return function(_0x3b2a75){if(_0x3b2a75){return _0x3b2a75[_0x7673('0x21')]()[_0x7673('0x20')](function(){_0x54f38d[_0x7673('0x15')](0xcc)[_0x7673('0x16')]();});}};}function handleEntityNotFound(_0x538280,_0x14e3ed){return function(_0xaca974){if(!_0xaca974){_0x538280[_0x7673('0x14')](0x194);}return _0xaca974;};}function handleError(_0x191bf4,_0x5a98fe){_0x5a98fe=_0x5a98fe||0x1f4;return function(_0x5e2cd7){logger[_0x7673('0x22')](_0x5e2cd7[_0x7673('0x23')]);if(_0x5e2cd7[_0x7673('0x24')]){delete _0x5e2cd7[_0x7673('0x24')];}_0x191bf4[_0x7673('0x15')](_0x5a98fe)[_0x7673('0x25')](_0x5e2cd7);};}exports[_0x7673('0x26')]=function(_0x5a59f9,_0x4e9e34){var _0x341f9e={'raw':!![],'where':{'id':_0x5a59f9[_0x7673('0x27')]['id']}},_0x2d4c0a={};_0x2d4c0a[_0x7673('0x28')]=_[_0x7673('0x29')](db[_0x7673('0x2a')][_0x7673('0x2b')]);_0x2d4c0a['query']=_['keys'](_0x5a59f9[_0x7673('0x2c')]);_0x2d4c0a[_0x7673('0x2d')]=_[_0x7673('0x2e')](_0x2d4c0a[_0x7673('0x28')],_0x2d4c0a['query']);_0x341f9e[_0x7673('0x2f')]=_['intersection'](_0x2d4c0a[_0x7673('0x28')],qs[_0x7673('0x30')](_0x5a59f9[_0x7673('0x2c')][_0x7673('0x30')]));_0x341f9e[_0x7673('0x2f')]=_0x341f9e[_0x7673('0x2f')][_0x7673('0x31')]?_0x341f9e[_0x7673('0x2f')]:_0x2d4c0a[_0x7673('0x28')];if(_0x5a59f9[_0x7673('0x2c')][_0x7673('0x32')]){_0x341f9e[_0x7673('0x33')]=[{'all':!![]}];}_0x341f9e=_[_0x7673('0x34')]({},_0x341f9e,_0x5a59f9['options']);return db[_0x7673('0x2a')][_0x7673('0x35')](_0x341f9e)[_0x7673('0x20')](handleEntityNotFound(_0x4e9e34,null))[_0x7673('0x20')](respondWithResult(_0x4e9e34,null))[_0x7673('0x36')](handleError(_0x4e9e34,null));};exports[_0x7673('0x37')]=function(_0x2915f0,_0x5736c0){return db['ChatProactiveAction'][_0x7673('0x37')](_0x2915f0[_0x7673('0x38')],{})[_0x7673('0x20')](respondWithResult(_0x5736c0,0xc9))[_0x7673('0x36')](handleError(_0x5736c0,null));};exports[_0x7673('0x1f')]=function(_0x101e03,_0x159afd){if(_0x101e03['body']['id']){delete _0x101e03[_0x7673('0x38')]['id'];}return db[_0x7673('0x2a')]['find']({'where':{'id':_0x101e03[_0x7673('0x27')]['id']}})[_0x7673('0x20')](handleEntityNotFound(_0x159afd,null))[_0x7673('0x20')](saveUpdates(_0x101e03[_0x7673('0x38')],null))['then'](respondWithResult(_0x159afd,null))[_0x7673('0x36')](handleError(_0x159afd,null));};exports[_0x7673('0x21')]=function(_0x4b82e8,_0x2a20ff){return db[_0x7673('0x2a')][_0x7673('0x35')]({'where':{'id':_0x4b82e8['params']['id']}})[_0x7673('0x20')](handleEntityNotFound(_0x2a20ff,null))[_0x7673('0x20')](removeEntity(_0x2a20ff,null))[_0x7673('0x36')](handleError(_0x2a20ff,null));}; \ No newline at end of file +var _0x0d4d=['destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','status','Content-Range','apply','save','update','then','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','find','catch','ChatProactiveAction','create','body'];(function(_0x3c3f94,_0x25b247){var _0x2c7166=function(_0x166ead){while(--_0x166ead){_0x3c3f94['push'](_0x3c3f94['shift']());}};_0x2c7166(++_0x25b247);}(_0x0d4d,0x132));var _0xd0d4=function(_0x4909ce,_0x2094a4){_0x4909ce=_0x4909ce-0x0;var _0x209756=_0x0d4d[_0x4909ce];return _0x209756;};'use strict';var emlformat=require(_0xd0d4('0x0'));var rimraf=require(_0xd0d4('0x1'));var zipdir=require(_0xd0d4('0x2'));var jsonpatch=require(_0xd0d4('0x3'));var rp=require(_0xd0d4('0x4'));var moment=require(_0xd0d4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd0d4('0x6'));var util=require('util');var path=require(_0xd0d4('0x7'));var sox=require(_0xd0d4('0x8'));var csv=require('to-csv');var ejs=require(_0xd0d4('0x9'));var fs=require('fs');var fs_extra=require(_0xd0d4('0xa'));var _=require(_0xd0d4('0xb'));var squel=require('squel');var crypto=require(_0xd0d4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd0d4('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd0d4('0xe'));var Papa=require(_0xd0d4('0xf'));var Redis=require(_0xd0d4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd0d4('0x11'));var as=require(_0xd0d4('0x12'));var hardwareService=require(_0xd0d4('0x13'));var logger=require(_0xd0d4('0x14'))(_0xd0d4('0x15'));var utils=require(_0xd0d4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd0d4('0x17'));var db=require(_0xd0d4('0x18'))['db'];function respondWithStatusCode(_0x29ee49,_0x2ddeca){_0x2ddeca=_0x2ddeca||0xcc;return function(_0x38ca06){if(_0x38ca06){return _0x29ee49[_0xd0d4('0x19')](_0x2ddeca);}return _0x29ee49['status'](_0x2ddeca)[_0xd0d4('0x1a')]();};}function respondWithResult(_0x2131c8,_0x10a175){_0x10a175=_0x10a175||0xc8;return function(_0x5d6dd7){if(_0x5d6dd7){return _0x2131c8['status'](_0x10a175)[_0xd0d4('0x1b')](_0x5d6dd7);}};}function respondWithFilteredResult(_0x186405,_0x553b47){return function(_0x29bda4){if(_0x29bda4){var _0x1e8608=typeof _0x553b47['offset']==='undefined'&&typeof _0x553b47[_0xd0d4('0x1c')]===_0xd0d4('0x1d');var _0x268e1a=_0x29bda4['count'];var _0x5cf4c6=_0x1e8608?0x0:_0x553b47['offset'];var _0x407cda=_0x1e8608?_0x29bda4[_0xd0d4('0x1e')]:_0x553b47[_0xd0d4('0x1f')]+_0x553b47['limit'];var _0x568c75;if(_0x407cda>=_0x268e1a){_0x407cda=_0x268e1a;_0x568c75=0xc8;}else{_0x568c75=0xce;}_0x186405[_0xd0d4('0x20')](_0x568c75);return _0x186405['set'](_0xd0d4('0x21'),_0x5cf4c6+'-'+_0x407cda+'/'+_0x268e1a)[_0xd0d4('0x1b')](_0x29bda4);}return null;};}function patchUpdates(_0x1dcc1b){return function(_0x485cd8){try{jsonpatch[_0xd0d4('0x22')](_0x485cd8,_0x1dcc1b,!![]);}catch(_0x4d9fac){return BPromise['reject'](_0x4d9fac);}return _0x485cd8[_0xd0d4('0x23')]();};}function saveUpdates(_0xda03dd,_0x49b6f0){return function(_0x50f959){if(_0x50f959){return _0x50f959[_0xd0d4('0x24')](_0xda03dd)[_0xd0d4('0x25')](function(_0x398a00){return _0x398a00;});}return null;};}function removeEntity(_0x4c94b1,_0x1d8033){return function(_0x1c0831){if(_0x1c0831){return _0x1c0831['destroy']()[_0xd0d4('0x25')](function(){_0x4c94b1['status'](0xcc)[_0xd0d4('0x1a')]();});}};}function handleEntityNotFound(_0x1b03ef,_0x16808c){return function(_0x5380c3){if(!_0x5380c3){_0x1b03ef['sendStatus'](0x194);}return _0x5380c3;};}function handleError(_0x131de5,_0x4e7cc1){_0x4e7cc1=_0x4e7cc1||0x1f4;return function(_0x50e7f0){logger[_0xd0d4('0x26')](_0x50e7f0[_0xd0d4('0x27')]);if(_0x50e7f0[_0xd0d4('0x28')]){delete _0x50e7f0[_0xd0d4('0x28')];}_0x131de5['status'](_0x4e7cc1)[_0xd0d4('0x29')](_0x50e7f0);};}exports[_0xd0d4('0x2a')]=function(_0x45acf8,_0x22e142){var _0x7eecce={'raw':!![],'where':{'id':_0x45acf8[_0xd0d4('0x2b')]['id']}},_0xefce4f={};_0xefce4f[_0xd0d4('0x2c')]=_[_0xd0d4('0x2d')](db['ChatProactiveAction'][_0xd0d4('0x2e')]);_0xefce4f[_0xd0d4('0x2f')]=_[_0xd0d4('0x2d')](_0x45acf8[_0xd0d4('0x2f')]);_0xefce4f[_0xd0d4('0x30')]=_[_0xd0d4('0x31')](_0xefce4f['model'],_0xefce4f['query']);_0x7eecce[_0xd0d4('0x32')]=_['intersection'](_0xefce4f[_0xd0d4('0x2c')],qs[_0xd0d4('0x33')](_0x45acf8[_0xd0d4('0x2f')][_0xd0d4('0x33')]));_0x7eecce[_0xd0d4('0x32')]=_0x7eecce[_0xd0d4('0x32')][_0xd0d4('0x34')]?_0x7eecce['attributes']:_0xefce4f['model'];if(_0x45acf8[_0xd0d4('0x2f')][_0xd0d4('0x35')]){_0x7eecce['include']=[{'all':!![]}];}_0x7eecce=_[_0xd0d4('0x36')]({},_0x7eecce,_0x45acf8['options']);return db['ChatProactiveAction'][_0xd0d4('0x37')](_0x7eecce)[_0xd0d4('0x25')](handleEntityNotFound(_0x22e142,null))[_0xd0d4('0x25')](respondWithResult(_0x22e142,null))[_0xd0d4('0x38')](handleError(_0x22e142,null));};exports['create']=function(_0x47e4c5,_0x184d3c){return db[_0xd0d4('0x39')][_0xd0d4('0x3a')](_0x47e4c5['body'],{})[_0xd0d4('0x25')](respondWithResult(_0x184d3c,0xc9))[_0xd0d4('0x38')](handleError(_0x184d3c,null));};exports[_0xd0d4('0x24')]=function(_0x45038e,_0x18fd6d){if(_0x45038e[_0xd0d4('0x3b')]['id']){delete _0x45038e[_0xd0d4('0x3b')]['id'];}return db[_0xd0d4('0x39')]['find']({'where':{'id':_0x45038e[_0xd0d4('0x2b')]['id']}})['then'](handleEntityNotFound(_0x18fd6d,null))['then'](saveUpdates(_0x45038e[_0xd0d4('0x3b')],null))['then'](respondWithResult(_0x18fd6d,null))[_0xd0d4('0x38')](handleError(_0x18fd6d,null));};exports[_0xd0d4('0x3c')]=function(_0x1c6d7c,_0x1d6329){return db[_0xd0d4('0x39')][_0xd0d4('0x37')]({'where':{'id':_0x1c6d7c['params']['id']}})[_0xd0d4('0x25')](handleEntityNotFound(_0x1d6329,null))[_0xd0d4('0x25')](removeEntity(_0x1d6329,null))['catch'](handleError(_0x1d6329,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 9d52570..c715201 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 _0x0153=['util','api','moment','bluebird','request-promise','path','rimraf','ChatProactiveAction','chat_proactive_actions'];(function(_0x175081,_0x2968cc){var _0x5b4a6c=function(_0x1c3c21){while(--_0x1c3c21){_0x175081['push'](_0x175081['shift']());}};_0x5b4a6c(++_0x2968cc);}(_0x0153,0x1e6));var _0x3015=function(_0x3af770,_0x1a957a){_0x3af770=_0x3af770-0x0;var _0x42c9a9=_0x0153[_0x3af770];return _0x42c9a9;};'use strict';var _=require('lodash');var util=require(_0x3015('0x0'));var logger=require('../../config/logger')(_0x3015('0x1'));var moment=require(_0x3015('0x2'));var BPromise=require(_0x3015('0x3'));var rp=require(_0x3015('0x4'));var fs=require('fs');var path=require(_0x3015('0x5'));var rimraf=require(_0x3015('0x6'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x45215b,_0x5b08d9){return _0x45215b['define'](_0x3015('0x7'),attributes,{'tableName':_0x3015('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5821=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','../../config/logger'];(function(_0x7b341f,_0x11e481){var _0x46d0a1=function(_0x6f779d){while(--_0x6f779d){_0x7b341f['push'](_0x7b341f['shift']());}};_0x46d0a1(++_0x11e481);}(_0x5821,0xa7));var _0x1582=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5821[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1582('0x0'))('api');var moment=require(_0x1582('0x1'));var BPromise=require(_0x1582('0x2'));var rp=require(_0x1582('0x3'));var fs=require('fs');var path=require(_0x1582('0x4'));var rimraf=require(_0x1582('0x5'));var config=require(_0x1582('0x6'));var attributes=require(_0x1582('0x7'));module[_0x1582('0x8')]=function(_0x47a015,_0xb22447){return _0x47a015[_0x1582('0x9')](_0x1582('0xa'),attributes,{'tableName':_0x1582('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 69896c8..d4e0760 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 _0x780f=['ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info'];(function(_0x3477dd,_0x340ddf){var _0x5b9f71=function(_0x50eda4){while(--_0x50eda4){_0x3477dd['push'](_0x3477dd['shift']());}};_0x5b9f71(++_0x340ddf);}(_0x780f,0x6c));var _0xf780=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0x780f[_0x270adf];return _0x29eda9;};'use strict';var _=require(_0xf780('0x0'));var util=require(_0xf780('0x1'));var moment=require(_0xf780('0x2'));var BPromise=require(_0xf780('0x3'));var rs=require(_0xf780('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf780('0x5'));var logger=require(_0xf780('0x6'))(_0xf780('0x7'));var config=require(_0xf780('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf780('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bd856,_0x93539d,_0x1c3fdc){return new BPromise(function(_0xa12d00,_0x44f14c){return client[_0xf780('0xa')](_0x1bd856,_0x1c3fdc)['then'](function(_0x2c8221){logger[_0xf780('0xb')](_0xf780('0xc'),_0x93539d,_0xf780('0xd'));logger[_0xf780('0xe')](_0xf780('0xf'),_0x93539d,_0xf780('0xd'),JSON['stringify'](_0x2c8221));if(_0x2c8221['error']){if(_0x2c8221[_0xf780('0x10')][_0xf780('0x11')]===0x1f4){logger[_0xf780('0x10')](_0xf780('0xc'),_0x93539d,_0x2c8221['error'][_0xf780('0x12')]);return _0x44f14c(_0x2c8221[_0xf780('0x10')][_0xf780('0x12')]);}logger[_0xf780('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x93539d,_0x2c8221[_0xf780('0x10')]['message']);return _0xa12d00(_0x2c8221[_0xf780('0x10')][_0xf780('0x12')]);}else{logger[_0xf780('0xb')](_0xf780('0xc'),_0x93539d,_0xf780('0xd'));_0xa12d00(_0x2c8221[_0xf780('0x13')][_0xf780('0x12')]);}})['catch'](function(_0x450198){logger[_0xf780('0x10')](_0xf780('0xc'),_0x93539d,_0x450198);_0x44f14c(_0x450198);});});} \ No newline at end of file +var _0x4ee9=['then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x2157c8,_0x42d795){var _0x18e2a3=function(_0x2d5eac){while(--_0x2d5eac){_0x2157c8['push'](_0x2157c8['shift']());}};_0x18e2a3(++_0x42d795);}(_0x4ee9,0x64));var _0x94ee=function(_0x14d643,_0x1c7727){_0x14d643=_0x14d643-0x0;var _0x3a4451=_0x4ee9[_0x14d643];return _0x3a4451;};'use strict';var _=require('lodash');var util=require(_0x94ee('0x0'));var moment=require(_0x94ee('0x1'));var BPromise=require(_0x94ee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94ee('0x3'))['db'];var utils=require(_0x94ee('0x4'));var logger=require('../../config/logger')(_0x94ee('0x5'));var config=require(_0x94ee('0x6'));var jayson=require(_0x94ee('0x7'));var client=jayson['client'][_0x94ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8a5ff0,_0x4c5204,_0x44138b){return new BPromise(function(_0x315fd2,_0x24adec){return client[_0x94ee('0x9')](_0x8a5ff0,_0x44138b)[_0x94ee('0xa')](function(_0x4615b1){logger[_0x94ee('0xb')](_0x94ee('0xc'),_0x4c5204,_0x94ee('0xd'));logger[_0x94ee('0xe')](_0x94ee('0xf'),_0x4c5204,_0x94ee('0xd'),JSON[_0x94ee('0x10')](_0x4615b1));if(_0x4615b1[_0x94ee('0x11')]){if(_0x4615b1[_0x94ee('0x11')][_0x94ee('0x12')]===0x1f4){logger[_0x94ee('0x11')](_0x94ee('0xc'),_0x4c5204,_0x4615b1[_0x94ee('0x11')][_0x94ee('0x13')]);return _0x24adec(_0x4615b1[_0x94ee('0x11')][_0x94ee('0x13')]);}logger[_0x94ee('0x11')](_0x94ee('0xc'),_0x4c5204,_0x4615b1[_0x94ee('0x11')][_0x94ee('0x13')]);return _0x315fd2(_0x4615b1[_0x94ee('0x11')][_0x94ee('0x13')]);}else{logger[_0x94ee('0xb')](_0x94ee('0xc'),_0x4c5204,'request\x20sent');_0x315fd2(_0x4615b1[_0x94ee('0x14')][_0x94ee('0x13')]);}})[_0x94ee('0x15')](function(_0x3f6e3a){logger[_0x94ee('0x11')](_0x94ee('0xc'),_0x4c5204,_0x3f6e3a);_0x24adec(_0x3f6e3a);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index d97783b..10989d6 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 _0x207c=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','show','post','create','put','/:id','update','delete'];(function(_0x2890a8,_0x1ccd49){var _0x1cbd49=function(_0x5a9402){while(--_0x5a9402){_0x2890a8['push'](_0x2890a8['shift']());}};_0x1cbd49(++_0x1ccd49);}(_0x207c,0x1e8));var _0xc207=function(_0xec1289,_0x4fa82b){_0xec1289=_0xec1289-0x0;var _0x3e223c=_0x207c[_0xec1289];return _0x3e223c;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var fs_extra=require(_0xc207('0x5'));var auth=require(_0xc207('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc207('0x7'));var controller=require('./chatProactiveAction.controller');router['get']('/:id',auth[_0xc207('0x8')](),controller[_0xc207('0x9')]);router[_0xc207('0xa')]('/',auth['isAuthenticated'](),controller[_0xc207('0xb')]);router[_0xc207('0xc')](_0xc207('0xd'),auth['isAuthenticated'](),controller[_0xc207('0xe')]);router[_0xc207('0xf')](_0xc207('0xd'),auth[_0xc207('0x8')](),controller[_0xc207('0x10')]);module[_0xc207('0x11')]=router; \ No newline at end of file +var _0xf2ca=['show','create','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x50472c,_0x2f1e04){var _0x2a5db0=function(_0x1fcb15){while(--_0x1fcb15){_0x50472c['push'](_0x50472c['shift']());}};_0x2a5db0(++_0x2f1e04);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x1de43c,_0xaa29de){_0x1de43c=_0x1de43c-0x0;var _0x296d3e=_0xf2ca[_0x1de43c];return _0x296d3e;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var fs_extra=require(_0xaf2c('0x5'));var auth=require(_0xaf2c('0x6'));var interaction=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var controller=require('./chatProactiveAction.controller');router[_0xaf2c('0x9')](_0xaf2c('0xa'),auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xc')]);router['post']('/',auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xd')]);router['put'](_0xaf2c('0xa'),auth['isAuthenticated'](),controller[_0xaf2c('0xe')]);router['delete'](_0xaf2c('0xa'),auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xf')]);module[_0xaf2c('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index d3fdb54..1abedec 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 _0xa9fb=['roundrobin','sequelize','exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0x1df1ae,_0x16dbac){var _0x1c2825=function(_0x30f230){while(--_0x30f230){_0x1df1ae['push'](_0x1df1ae['shift']());}};_0x1c2825(++_0x16dbac);}(_0xa9fb,0x1c9));var _0xba9f=function(_0x44f4ed,_0x23f1e4){_0x44f4ed=_0x44f4ed-0x0;var _0x47ef85=_0xa9fb[_0x44f4ed];return _0x47ef85;};'use strict';var Sequelize=require(_0xba9f('0x0'));module[_0xba9f('0x1')]={'name':{'type':Sequelize[_0xba9f('0x2')],'unique':_0xba9f('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xba9f('0x4')](_0xba9f('0x5'),_0xba9f('0x6'),_0xba9f('0x7'))}}; \ No newline at end of file +var _0xc094=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x2a8ea3,_0x14311b){var _0xd21cbf=function(_0x1015ce){while(--_0x1015ce){_0x2a8ea3['push'](_0x2a8ea3['shift']());}};_0xd21cbf(++_0x14311b);}(_0xc094,0x134));var _0x4c09=function(_0x14478e,_0x529002){_0x14478e=_0x14478e-0x0;var _0x5869d1=_0xc094[_0x14478e];return _0x5869d1;};'use strict';var Sequelize=require(_0x4c09('0x0'));module[_0x4c09('0x1')]={'name':{'type':Sequelize[_0x4c09('0x2')],'unique':_0x4c09('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4c09('0x2')]},'timeout':{'type':Sequelize[_0x4c09('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4c09('0x5')](_0x4c09('0x6'),_0x4c09('0x7'),_0x4c09('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index c94c83a..a2d48be 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 _0xdaec=['options','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','userChatQueue:remove','addAgents','ids','omit','isArray','getAgents','findOne','bluebird','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','status','end','json','undefined','limit','offset','Content-Range','then','destroy','get','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','ChatQueue','count','include','query','findAll','rows','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','UserChatQueue','hasOwnProperty','nolimit','sort','pick','where','ChatQueueId','filter','User','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdaec,0xa0));var _0xcdae=function(_0x3f816c,_0x51ed7c){_0x3f816c=_0x3f816c-0x0;var _0x55f2dd=_0xdaec[_0x3f816c];return _0x55f2dd;};'use strict';var BPromise=require(_0xcdae('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0xcdae('0x1'));var Redis=require(_0xcdae('0x2'));var qs=require(_0xcdae('0x3'));var logger=require(_0xcdae('0x4'))('api');var config=require(_0xcdae('0x5'));var db=require(_0xcdae('0x6'))['db'];config[_0xcdae('0x7')]=_[_0xcdae('0x8')](config['redis'],{'host':_0xcdae('0x9'),'port':0x18eb});var socket=require(_0xcdae('0xa'))(new Redis(config['redis']));require(_0xcdae('0xb'))[_0xcdae('0xc')](socket);function respondWithStatusCode(_0x27a98d,_0x4c25c0){_0x4c25c0=_0x4c25c0||0xcc;return function(_0x1f02b4){if(_0x1f02b4){return _0x27a98d['sendStatus'](_0x4c25c0);}return _0x27a98d[_0xcdae('0xd')](_0x4c25c0)[_0xcdae('0xe')]();};}function respondWithResult(_0x120312,_0x253d32){_0x253d32=_0x253d32||0xc8;return function(_0x3c73be){if(_0x3c73be){return _0x120312[_0xcdae('0xd')](_0x253d32)[_0xcdae('0xf')](_0x3c73be);}};}function respondWithFilteredResult(_0x5e8ae3,_0x4a64d3){return function(_0x3b5017){if(_0x3b5017){var _0x1f9aca=typeof _0x4a64d3['offset']===_0xcdae('0x10')&&typeof _0x4a64d3[_0xcdae('0x11')]==='undefined';var _0x251a67=_0x3b5017['count'];var _0x3e700f=_0x1f9aca?0x0:_0x4a64d3[_0xcdae('0x12')];var _0x46566f=_0x1f9aca?_0x3b5017['count']:_0x4a64d3[_0xcdae('0x12')]+_0x4a64d3[_0xcdae('0x11')];var _0x298900;if(_0x46566f>=_0x251a67){_0x46566f=_0x251a67;_0x298900=0xc8;}else{_0x298900=0xce;}_0x5e8ae3[_0xcdae('0xd')](_0x298900);return _0x5e8ae3['set'](_0xcdae('0x13'),_0x3e700f+'-'+_0x46566f+'/'+_0x251a67)[_0xcdae('0xf')](_0x3b5017);}return null;};}function saveUpdates(_0x59740b){return function(_0x2a25a4){if(_0x2a25a4){return _0x2a25a4['update'](_0x59740b)[_0xcdae('0x14')](function(_0x2ef0e2){return _0x2ef0e2;});}return null;};}function removeEntity(_0x1932a2){return function(_0x14e70a){if(_0x14e70a){return _0x14e70a[_0xcdae('0x15')]()[_0xcdae('0x14')](function(){var _0x3e9692=_0x14e70a[_0xcdae('0x16')]({'plain':!![]});var _0x26e25d='ChatQueues';return db['UserProfileResource'][_0xcdae('0x15')]({'where':{'type':_0x26e25d,'resourceId':_0x3e9692['id']}})[_0xcdae('0x14')](function(){return _0x14e70a;});})[_0xcdae('0x14')](function(){_0x1932a2[_0xcdae('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3febdd){return function(_0x85ba26){if(!_0x85ba26){_0x3febdd['sendStatus'](0x194);}return _0x85ba26;};}function handleError(_0x2dce94,_0x465d9d){_0x465d9d=_0x465d9d||0x1f4;return function(_0x2d8ad5){logger[_0xcdae('0x17')](_0x2d8ad5[_0xcdae('0x18')]);if(_0x2d8ad5['name']){delete _0x2d8ad5[_0xcdae('0x19')];}_0x2dce94[_0xcdae('0xd')](_0x465d9d)[_0xcdae('0x1a')](_0x2d8ad5);};}exports[_0xcdae('0x1b')]=function(_0x556783,_0x119b18){var _0x3dab4a={};var _0x92a31a={'count':0x0,'rows':[]};var _0x342b6b=_[_0xcdae('0x1c')](db['ChatQueue'][_0xcdae('0x1d')],function(_0x4516c1){return{'name':_0x4516c1[_0xcdae('0x1e')],'type':_0x4516c1[_0xcdae('0x1f')][_0xcdae('0x20')]};});_0x3dab4a=qs[_0xcdae('0x21')](_0x342b6b,_0x556783);var _0x80d931={'where':_0x3dab4a['where']};return db[_0xcdae('0x22')][_0xcdae('0x23')](_0x80d931)[_0xcdae('0x14')](function(_0x5b2452){_0x92a31a['count']=_0x5b2452;_0x3dab4a[_0xcdae('0x24')]=qs[_0xcdae('0x24')](_0x556783[_0xcdae('0x25')]);return db[_0xcdae('0x22')][_0xcdae('0x26')](_0x3dab4a);})['then'](function(_0x4a6c69){_0x92a31a[_0xcdae('0x27')]=_0x4a6c69;return _0x92a31a;})[_0xcdae('0x14')](respondWithFilteredResult(_0x119b18,_0x3dab4a))[_0xcdae('0x28')](handleError(_0x119b18,null));};exports[_0xcdae('0x29')]=function(_0x2e1998,_0x2d8d4b){var _0x598d29={'raw':!![],'where':{'id':_0x2e1998['params']['id']}},_0x214b18={};_0x214b18[_0xcdae('0x2a')]=_[_0xcdae('0x2b')](db['ChatQueue']['rawAttributes']);_0x214b18[_0xcdae('0x25')]=_[_0xcdae('0x2b')](_0x2e1998['query']);_0x214b18[_0xcdae('0x2c')]=_[_0xcdae('0x2d')](_0x214b18['model'],_0x214b18['query']);_0x598d29[_0xcdae('0x2e')]=_[_0xcdae('0x2d')](_0x214b18[_0xcdae('0x2a')],qs[_0xcdae('0x2f')](_0x2e1998['query'][_0xcdae('0x2f')]));_0x598d29['attributes']=_0x598d29[_0xcdae('0x2e')][_0xcdae('0x30')]?_0x598d29[_0xcdae('0x2e')]:_0x214b18[_0xcdae('0x2a')];if(_0x2e1998[_0xcdae('0x25')][_0xcdae('0x31')]){_0x598d29[_0xcdae('0x24')]=[{'all':!![]}];}_0x598d29=_[_0xcdae('0x32')]({},_0x598d29,_0x2e1998['options']);return db[_0xcdae('0x22')][_0xcdae('0x33')](_0x598d29)[_0xcdae('0x14')](handleEntityNotFound(_0x2d8d4b,null))['then'](respondWithResult(_0x2d8d4b,null))['catch'](handleError(_0x2d8d4b,null));};exports['create']=function(_0x41fa2c,_0x3118c4){return db[_0xcdae('0x22')]['create'](_0x41fa2c[_0xcdae('0x34')],{})[_0xcdae('0x14')](function(_0x2b7fbf){var _0x5b6312=_0x41fa2c['user']['get']({'plain':!![]});if(!_0x5b6312)throw new Error(_0xcdae('0x35'));if(_0x5b6312[_0xcdae('0x36')]===_0xcdae('0x37')){var _0x2abf28=_0x2b7fbf['get']({'plain':!![]});var _0x1e5886=_0xcdae('0x38');return db[_0xcdae('0x39')][_0xcdae('0x33')]({'where':{'name':_0x1e5886,'userProfileId':_0x5b6312[_0xcdae('0x3a')]},'raw':!![]})[_0xcdae('0x14')](function(_0x5ca7f9){if(_0x5ca7f9&&_0x5ca7f9[_0xcdae('0x3b')]===0x0){return db[_0xcdae('0x3c')][_0xcdae('0x3d')]({'name':_0x2abf28['name'],'resourceId':_0x2abf28['id'],'type':_0x5ca7f9[_0xcdae('0x19')],'sectionId':_0x5ca7f9['id']},{})[_0xcdae('0x14')](function(){return _0x2b7fbf;});}else{return _0x2b7fbf;}})[_0xcdae('0x28')](function(_0x297028){logger[_0xcdae('0x17')](_0xcdae('0x3e'),_0x297028);throw _0x297028;});}return _0x2b7fbf;})[_0xcdae('0x14')](respondWithResult(_0x3118c4,0xc9))['catch'](handleError(_0x3118c4,null));};exports[_0xcdae('0x3f')]=function(_0x80673b,_0x531a3a){if(_0x80673b['body']['id']){delete _0x80673b['body']['id'];}return db[_0xcdae('0x22')]['find']({'where':{'id':_0x80673b[_0xcdae('0x40')]['id']}})['then'](handleEntityNotFound(_0x531a3a,null))[_0xcdae('0x14')](saveUpdates(_0x80673b['body'],null))[_0xcdae('0x14')](respondWithResult(_0x531a3a,null))[_0xcdae('0x28')](handleError(_0x531a3a,null));};exports[_0xcdae('0x15')]=function(_0x4e5d52,_0x2b30ec){return db[_0xcdae('0x22')]['find']({'where':{'id':_0x4e5d52[_0xcdae('0x40')]['id']}})[_0xcdae('0x14')](handleEntityNotFound(_0x2b30ec,null))['then'](removeEntity(_0x2b30ec,null))[_0xcdae('0x28')](handleError(_0x2b30ec,null));};exports[_0xcdae('0x41')]=function(_0x332d9c,_0x675caf){return db[_0xcdae('0x22')][_0xcdae('0x41')]()[_0xcdae('0x14')](respondWithResult(_0x675caf,null))['catch'](handleError(_0x675caf,null));};exports[_0xcdae('0x42')]=function(_0xde0b22,_0xae0978){var _0x59cb22={'raw':!![],'where':{}},_0x66f426={},_0x158663;return db[_0xcdae('0x22')]['findOne']({'where':{'id':_0xde0b22[_0xcdae('0x40')]['id']}})[_0xcdae('0x14')](handleEntityNotFound(_0xae0978,null))[_0xcdae('0x14')](function(_0x32b914){if(_0x32b914){_0x158663=_0x32b914[_0xcdae('0x16')]({'plain':!![]});_0x66f426['model']=_[_0xcdae('0x2b')](db[_0xcdae('0x43')]['rawAttributes']);_0x66f426['query']=_[_0xcdae('0x2b')](_0xde0b22['query']);_0x66f426[_0xcdae('0x2c')]=_[_0xcdae('0x2d')](_0x66f426[_0xcdae('0x2a')],_0x66f426[_0xcdae('0x25')]);_0x59cb22[_0xcdae('0x2e')]=_[_0xcdae('0x2d')](_0x66f426[_0xcdae('0x2a')],qs[_0xcdae('0x2f')](_0xde0b22['query'][_0xcdae('0x2f')]));_0x59cb22[_0xcdae('0x2e')]=_0x59cb22[_0xcdae('0x2e')][_0xcdae('0x30')]?_0x59cb22[_0xcdae('0x2e')]:_0x66f426[_0xcdae('0x2a')];if(!_0xde0b22[_0xcdae('0x25')][_0xcdae('0x44')](_0xcdae('0x45'))){_0x59cb22['limit']=qs[_0xcdae('0x11')](_0xde0b22['query'][_0xcdae('0x11')]);_0x59cb22['offset']=qs[_0xcdae('0x12')](_0xde0b22[_0xcdae('0x25')][_0xcdae('0x12')]);}_0x59cb22['order']=qs[_0xcdae('0x46')](_0xde0b22['query'][_0xcdae('0x46')]);_0x59cb22['where']=qs['filters'](_[_0xcdae('0x47')](_0xde0b22[_0xcdae('0x25')],_0x66f426[_0xcdae('0x2c')]));_0x59cb22[_0xcdae('0x48')][_0xcdae('0x49')]=_0x32b914['id'];if(_0xde0b22[_0xcdae('0x25')][_0xcdae('0x4a')]){_0x59cb22[_0xcdae('0x48')]=_[_0xcdae('0x32')](_0x59cb22[_0xcdae('0x48')],{'$or':_[_0xcdae('0x1c')](_0x59cb22['attributes'],function(_0x9c36c8){var _0xc41b62={};_0xc41b62[_0x9c36c8]={'$like':'%'+_0xde0b22[_0xcdae('0x25')][_0xcdae('0x4a')]+'%'};return _0xc41b62;})});}_0x59cb22=_[_0xcdae('0x32')]({},_0x59cb22,_0xde0b22['options']);return db[_0xcdae('0x43')]['findAll'](_0x59cb22);}})[_0xcdae('0x14')](function(_0x2a3fc8){if(_0x2a3fc8){return db[_0xcdae('0x4b')]['findAndCountAll']({'where':{'id':_[_0xcdae('0x1c')](_0x2a3fc8,_0xcdae('0x4c')),'role':_0xcdae('0x4d')},'attributes':['id',_0xcdae('0x19'),_0xcdae('0x4e'),_0xcdae('0x4f'),_0xcdae('0x50')]});}})['then'](function(_0x34026b){if(_0x34026b){return{'count':_0x34026b[_0xcdae('0x23')],'rows':_[_0xcdae('0x1c')](_0x34026b[_0xcdae('0x27')],function(_0x27cccd){return{'membername':_0x27cccd['name'],'UserId':_0x27cccd['id'],'queue_name':_0x158663[_0xcdae('0x19')],'ChatQueueId':_0x158663['id'],'interface':util['format'](_0xcdae('0x51'),_0xcdae('0x52'),_0x27cccd[_0xcdae('0x19')]),'penalty':0x0,'paused':_0x27cccd['chatPause'],'createdAt':_0x27cccd[_0xcdae('0x50')],'updatedAt':_0x27cccd[_0xcdae('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xae0978,_0x59cb22))[_0xcdae('0x28')](handleError(_0xae0978,null));};exports[_0xcdae('0x53')]=function(_0x1a2cb2,_0x522b8e){var _0x982ef={};var _0xd5f801={};var _0x491133;var _0x6b76ab;return db[_0xcdae('0x22')]['findOne']({'where':{'id':_0x1a2cb2[_0xcdae('0x40')]['id']}})['then'](handleEntityNotFound(_0x522b8e,null))['then'](function(_0x4ab7e9){if(_0x4ab7e9){_0x491133=_0x4ab7e9;_0xd5f801[_0xcdae('0x2a')]=_[_0xcdae('0x2b')](db['Team'][_0xcdae('0x1d')]);_0xd5f801[_0xcdae('0x25')]=_[_0xcdae('0x2b')](_0x1a2cb2['query']);_0xd5f801[_0xcdae('0x2c')]=_[_0xcdae('0x2d')](_0xd5f801[_0xcdae('0x2a')],_0xd5f801[_0xcdae('0x25')]);_0x982ef[_0xcdae('0x2e')]=_['intersection'](_0xd5f801['model'],qs[_0xcdae('0x2f')](_0x1a2cb2[_0xcdae('0x25')][_0xcdae('0x2f')]));_0x982ef[_0xcdae('0x2e')]=_0x982ef[_0xcdae('0x2e')][_0xcdae('0x30')]?_0x982ef[_0xcdae('0x2e')]:_0xd5f801[_0xcdae('0x2a')];_0x982ef['order']=qs[_0xcdae('0x46')](_0x1a2cb2[_0xcdae('0x25')][_0xcdae('0x46')]);_0x982ef[_0xcdae('0x48')]=qs['filters'](_[_0xcdae('0x47')](_0x1a2cb2[_0xcdae('0x25')],_0xd5f801[_0xcdae('0x2c')]));if(_0x1a2cb2[_0xcdae('0x25')][_0xcdae('0x4a')]){_0x982ef['where']=_[_0xcdae('0x32')](_0x982ef[_0xcdae('0x48')],{'$or':_[_0xcdae('0x1c')](_0x982ef[_0xcdae('0x2e')],function(_0x1ef414){var _0x1f7acc={};_0x1f7acc[_0x1ef414]={'$like':'%'+_0x1a2cb2[_0xcdae('0x25')][_0xcdae('0x4a')]+'%'};return _0x1f7acc;})});}_0x982ef=_['merge']({},_0x982ef,_0x1a2cb2[_0xcdae('0x54')]);return _0x491133[_0xcdae('0x53')](_0x982ef);}})['then'](function(_0x33455a){if(_0x33455a){_0x6b76ab=_0x33455a['length'];if(!_0x1a2cb2[_0xcdae('0x25')][_0xcdae('0x44')]('nolimit')){_0x982ef[_0xcdae('0x11')]=qs[_0xcdae('0x11')](_0x1a2cb2[_0xcdae('0x25')][_0xcdae('0x11')]);_0x982ef[_0xcdae('0x12')]=qs[_0xcdae('0x12')](_0x1a2cb2[_0xcdae('0x25')]['offset']);}return _0x491133[_0xcdae('0x53')](_0x982ef);}})[_0xcdae('0x14')](function(_0x31d98a){if(_0x31d98a){return _0x31d98a?{'count':_0x6b76ab,'rows':_0x31d98a}:null;}})[_0xcdae('0x14')](respondWithResult(_0x522b8e,null))[_0xcdae('0x28')](handleError(_0x522b8e,null));};exports[_0xcdae('0x55')]=function(_0x1aa7e1,_0x4f0464){var _0x40dbb6=_0x1aa7e1[_0xcdae('0x34')]['ids'];return db['Team']['findAll']({'where':{'id':_0x40dbb6},'attributes':['id'],'include':[{'model':db[_0xcdae('0x4b')],'as':_0xcdae('0x56'),'attributes':['id','name',_0xcdae('0x57'),_0xcdae('0x58'),'interface'],'raw':!![]}]})['then'](function(_0x475897){if(_0x475897){var _0x475a70=_[_0xcdae('0x59')](_0x475897,function(_0x38fa78){var _0x47309d=_0x38fa78[_0xcdae('0x16')]({'plain':!![]});return _0x47309d[_0xcdae('0x56')];});return db[_0xcdae('0x22')][_0xcdae('0x33')]({'where':{'id':_0x1aa7e1['params']['id']}})['then'](function(_0x4b85ea){return db[_0xcdae('0x5a')][_0xcdae('0x5b')](function(_0x4beda8){return _0x4b85ea['addTeams'](_0x40dbb6,{'transaction':_0x4beda8})[_0xcdae('0x14')](function(){return BPromise['each'](_0x475a70,function(_0x31cecc){return db[_0xcdae('0x43')][_0xcdae('0x5c')]({'where':{'UserId':_0x31cecc['id'],'ChatQueueId':_0x1aa7e1['params']['id']},'transaction':_0x4beda8});});})[_0xcdae('0x14')](function(){_0x475a70[_0xcdae('0x5d')](function(_0x1e9d93){socket[_0xcdae('0x5e')](_0xcdae('0x5f'),{'UserId':_0x1e9d93['id'],'ChatQueueId':_0x4b85ea['id']});});});});});}})[_0xcdae('0x14')](respondWithStatusCode(_0x4f0464,null))[_0xcdae('0x28')](handleError(_0x4f0464,null));};exports[_0xcdae('0x60')]=function(_0x28bbc5,_0xf8093a){return db['Team'][_0xcdae('0x26')]({'where':{'id':_0x28bbc5[_0xcdae('0x25')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xf8093a,null))[_0xcdae('0x14')](function(_0x6711c6){var _0x588852=_[_0xcdae('0x1c')](_0x6711c6,'id');var _0x2f1dba=[];var _0x21e337=[];var _0x46ce70=squel[_0xcdae('0x61')]();_0x46ce70[_0xcdae('0x62')](_0xcdae('0x63'))[_0xcdae('0x64')](_0xcdae('0x65'),'tq')['join'](_0xcdae('0x66'),'ut',_0xcdae('0x67'))[_0xcdae('0x48')](_0xcdae('0x68'),_0x28bbc5[_0xcdae('0x40')]['id']);for(var _0x171a0d=0x0;_0x171a0d<_0x6711c6[_0xcdae('0x30')];_0x171a0d+=0x1){let _0x1ee059=_0x6711c6[_0x171a0d];for(var _0x2e1b03=0x0;_0x2e1b03<_0x1ee059[_0xcdae('0x56')]['length'];_0x2e1b03+=0x1){let _0x1e6640=_0x1ee059[_0xcdae('0x56')][_0x2e1b03];var _0x255be5=_0x46ce70[_0xcdae('0x69')]();_0x255be5['where'](_0xcdae('0x6a'),_0x1e6640['id']);_0x21e337['push'](db[_0xcdae('0x5a')][_0xcdae('0x25')](_0x255be5['toString'](),{'type':db[_0xcdae('0x5a')]['QueryTypes'][_0xcdae('0x6b')]})[_0xcdae('0x14')](function(_0x310295){if(_0x310295[_0xcdae('0x30')]===0x1){return _0x1e6640['id'];}else{var _0x267e72=_[_0xcdae('0x6c')](_[_0xcdae('0x1c')](_0x310295,_0xcdae('0x6d')),function(_0x4c9c94){return _['includes'](_0x588852,_0x4c9c94);});if(_0x267e72){return _0x1e6640['id'];}}}));}}return BPromise[_0xcdae('0x6e')](_0x21e337)[_0xcdae('0x14')](function(_0x50eeeb){_0x2f1dba=_(_0x2f1dba)[_0xcdae('0x6f')](_0x50eeeb)[_0xcdae('0x70')]()['value']();return db[_0xcdae('0x22')][_0xcdae('0x33')]({'where':{'id':_0x28bbc5['params']['id']}})[_0xcdae('0x14')](function(_0xfc5fd2){return db[_0xcdae('0x5a')][_0xcdae('0x5b')](function(_0x2a8af3){return _0xfc5fd2[_0xcdae('0x60')](_0x28bbc5[_0xcdae('0x25')]['ids'],{'transaction':_0x2a8af3})[_0xcdae('0x14')](function(){if(!_[_0xcdae('0x71')](_0x2f1dba)){return _0xfc5fd2[_0xcdae('0x72')](_0x2f1dba,{'transaction':_0x2a8af3});}})['then'](function(){_0x2f1dba['forEach'](function(_0x18dbf9){socket[_0xcdae('0x5e')](_0xcdae('0x73'),{'UserId':_0x18dbf9,'ChatQueueId':_0xfc5fd2['id']});});});});});});})['then'](respondWithStatusCode(_0xf8093a,null))[_0xcdae('0x28')](handleError(_0xf8093a,null));};exports[_0xcdae('0x74')]=function(_0x3d6339,_0x54f924){return db['ChatQueue'][_0xcdae('0x33')]({'where':{'id':_0x3d6339[_0xcdae('0x40')]['id']}})[_0xcdae('0x14')](handleEntityNotFound(_0x54f924,null))['then'](function(_0x4320fa){if(_0x4320fa){return _0x4320fa[_0xcdae('0x74')](_0x3d6339[_0xcdae('0x34')][_0xcdae('0x75')],_[_0xcdae('0x76')](_0x3d6339[_0xcdae('0x34')],[_0xcdae('0x75'),'id'])||{})['spread'](function(_0x5418ce){for(var _0x2fec91=0x0;_0x2fec91<_0x3d6339[_0xcdae('0x34')][_0xcdae('0x75')][_0xcdae('0x30')];_0x2fec91+=0x1){socket['emit'](_0xcdae('0x5f'),{'UserId':Number(_0x3d6339[_0xcdae('0x34')][_0xcdae('0x75')][_0x2fec91]),'ChatQueueId':Number(_0x3d6339['params']['id'])});}return _0x5418ce;});}})[_0xcdae('0x14')](respondWithResult(_0x54f924,null))[_0xcdae('0x28')](handleError(_0x54f924,null));};exports[_0xcdae('0x72')]=function(_0x44822a,_0x2815d7){return db[_0xcdae('0x22')][_0xcdae('0x33')]({'where':{'id':_0x44822a[_0xcdae('0x40')]['id']}})[_0xcdae('0x14')](handleEntityNotFound(_0x2815d7,null))[_0xcdae('0x14')](function(_0x4935ff){if(_0x4935ff){return _0x4935ff[_0xcdae('0x72')](_0x44822a[_0xcdae('0x25')][_0xcdae('0x75')])['then'](function(){if(_[_0xcdae('0x77')](_0x44822a[_0xcdae('0x25')]['ids'])){for(var _0x4c0052=0x0;_0x4c0052<_0x44822a[_0xcdae('0x25')][_0xcdae('0x75')][_0xcdae('0x30')];_0x4c0052+=0x1){socket[_0xcdae('0x5e')](_0xcdae('0x73'),{'UserId':Number(_0x44822a[_0xcdae('0x25')]['ids'][_0x4c0052]),'ChatQueueId':Number(_0x44822a[_0xcdae('0x40')]['id'])});}}else{socket[_0xcdae('0x5e')](_0xcdae('0x73'),{'UserId':Number(_0x44822a[_0xcdae('0x25')][_0xcdae('0x75')]),'ChatQueueId':Number(_0x44822a[_0xcdae('0x40')]['id'])});}});}})[_0xcdae('0x14')](respondWithStatusCode(_0x2815d7,null))[_0xcdae('0x28')](handleError(_0x2815d7,null));};exports[_0xcdae('0x78')]=function(_0x139543,_0x372c99){var _0x1de8e1={};var _0x56d15a={};var _0x1a54e2;var _0xab77cb;return db[_0xcdae('0x22')][_0xcdae('0x79')]({'where':{'id':_0x139543[_0xcdae('0x40')]['id']}})[_0xcdae('0x14')](handleEntityNotFound(_0x372c99,null))['then'](function(_0x558214){if(_0x558214){_0x1a54e2=_0x558214;_0x56d15a[_0xcdae('0x2a')]=_['keys'](db[_0xcdae('0x4b')][_0xcdae('0x1d')]);_0x56d15a[_0xcdae('0x25')]=_[_0xcdae('0x2b')](_0x139543['query']);_0x56d15a[_0xcdae('0x2c')]=_[_0xcdae('0x2d')](_0x56d15a[_0xcdae('0x2a')],_0x56d15a[_0xcdae('0x25')]);_0x1de8e1[_0xcdae('0x2e')]=_['intersection'](_0x56d15a[_0xcdae('0x2a')],qs[_0xcdae('0x2f')](_0x139543[_0xcdae('0x25')]['fields']));_0x1de8e1[_0xcdae('0x2e')]=_0x1de8e1[_0xcdae('0x2e')][_0xcdae('0x30')]?_0x1de8e1['attributes']:_0x56d15a[_0xcdae('0x2a')];_0x1de8e1['order']=qs['sort'](_0x139543['query'][_0xcdae('0x46')]);_0x1de8e1[_0xcdae('0x48')]=qs[_0xcdae('0x2c')](_['pick'](_0x139543['query'],_0x56d15a['filters']));if(_0x139543[_0xcdae('0x25')][_0xcdae('0x4a')]){_0x1de8e1[_0xcdae('0x48')]=_[_0xcdae('0x32')](_0x1de8e1[_0xcdae('0x48')],{'$or':_[_0xcdae('0x1c')](_0x1de8e1['attributes'],function(_0x5915ca){var _0x869c30={};_0x869c30[_0x5915ca]={'$like':'%'+_0x139543[_0xcdae('0x25')][_0xcdae('0x4a')]+'%'};return _0x869c30;})});}_0x1de8e1=_[_0xcdae('0x32')]({},_0x1de8e1,_0x139543[_0xcdae('0x54')]);return _0x1a54e2[_0xcdae('0x78')](_0x1de8e1);}})[_0xcdae('0x14')](function(_0x402541){if(_0x402541){_0xab77cb=_0x402541[_0xcdae('0x30')];if(!_0x139543[_0xcdae('0x25')][_0xcdae('0x44')](_0xcdae('0x45'))){_0x1de8e1[_0xcdae('0x11')]=qs[_0xcdae('0x11')](_0x139543[_0xcdae('0x25')][_0xcdae('0x11')]);_0x1de8e1[_0xcdae('0x12')]=qs[_0xcdae('0x12')](_0x139543[_0xcdae('0x25')][_0xcdae('0x12')]);}return _0x1a54e2[_0xcdae('0x78')](_0x1de8e1);}})['then'](function(_0x194049){if(_0x194049){return _0x194049?{'count':_0xab77cb,'rows':_0x194049}:null;}})['then'](respondWithResult(_0x372c99,null))['catch'](handleError(_0x372c99,null));}; \ No newline at end of file +var _0x7a00=['squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','then','get','UserProfileResource','destroy','error','stack','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','include','catch','params','keys','query','filters','intersection','model','attributes','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','ChatQueues','userProfileId','autoAssociation','update','describe','findOne','UserChatQueue','fields','hasOwnProperty','nolimit','sort','pick','ChatQueueId','merge','findAll','User','UserId','agent','chatPause','updatedAt','createdAt','rows','%s/%s','SIP','Team','order','filter','getTeams','ids','online','voicePause','interface','Agents','transaction','addTeams','forEach','emit','userChatQueue:save','select','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','all','union','compact','value','removeTeams','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','lodash'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x7a00,0x157));var _0x07a0=function(_0x2feda9,_0x400eb6){_0x2feda9=_0x2feda9-0x0;var _0x4a7a95=_0x7a00[_0x2feda9];return _0x4a7a95;};'use strict';var BPromise=require('bluebird');var util=require(_0x07a0('0x0'));var _=require(_0x07a0('0x1'));var squel=require(_0x07a0('0x2'));var Redis=require('ioredis');var qs=require(_0x07a0('0x3'));var logger=require(_0x07a0('0x4'))('api');var config=require(_0x07a0('0x5'));var db=require(_0x07a0('0x6'))['db'];config[_0x07a0('0x7')]=_[_0x07a0('0x8')](config[_0x07a0('0x7')],{'host':_0x07a0('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x07a0('0x7')]));require('./chatQueue.socket')[_0x07a0('0xa')](socket);function respondWithStatusCode(_0x4f91a9,_0x1f6755){_0x1f6755=_0x1f6755||0xcc;return function(_0x5b9818){if(_0x5b9818){return _0x4f91a9[_0x07a0('0xb')](_0x1f6755);}return _0x4f91a9[_0x07a0('0xc')](_0x1f6755)[_0x07a0('0xd')]();};}function respondWithResult(_0x1d38b8,_0x5c5cb6){_0x5c5cb6=_0x5c5cb6||0xc8;return function(_0x4d8c58){if(_0x4d8c58){return _0x1d38b8[_0x07a0('0xc')](_0x5c5cb6)[_0x07a0('0xe')](_0x4d8c58);}};}function respondWithFilteredResult(_0x5ba94f,_0x44953b){return function(_0x370dee){if(_0x370dee){var _0x751812=typeof _0x44953b['offset']==='undefined'&&typeof _0x44953b[_0x07a0('0xf')]===_0x07a0('0x10');var _0x58c855=_0x370dee[_0x07a0('0x11')];var _0x5d1e3a=_0x751812?0x0:_0x44953b[_0x07a0('0x12')];var _0x2b01a7=_0x751812?_0x370dee[_0x07a0('0x11')]:_0x44953b[_0x07a0('0x12')]+_0x44953b[_0x07a0('0xf')];var _0x3b7f1f;if(_0x2b01a7>=_0x58c855){_0x2b01a7=_0x58c855;_0x3b7f1f=0xc8;}else{_0x3b7f1f=0xce;}_0x5ba94f[_0x07a0('0xc')](_0x3b7f1f);return _0x5ba94f['set'](_0x07a0('0x13'),_0x5d1e3a+'-'+_0x2b01a7+'/'+_0x58c855)[_0x07a0('0xe')](_0x370dee);}return null;};}function saveUpdates(_0x2a373c){return function(_0x17ea0e){if(_0x17ea0e){return _0x17ea0e['update'](_0x2a373c)[_0x07a0('0x14')](function(_0x38e0b2){return _0x38e0b2;});}return null;};}function removeEntity(_0x374a54){return function(_0xa4accd){if(_0xa4accd){return _0xa4accd['destroy']()[_0x07a0('0x14')](function(){var _0x48710a=_0xa4accd[_0x07a0('0x15')]({'plain':!![]});var _0x16dc3b='ChatQueues';return db[_0x07a0('0x16')][_0x07a0('0x17')]({'where':{'type':_0x16dc3b,'resourceId':_0x48710a['id']}})[_0x07a0('0x14')](function(){return _0xa4accd;});})[_0x07a0('0x14')](function(){_0x374a54[_0x07a0('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32d251){return function(_0x5d3371){if(!_0x5d3371){_0x32d251[_0x07a0('0xb')](0x194);}return _0x5d3371;};}function handleError(_0x2ed14d,_0x4776f5){_0x4776f5=_0x4776f5||0x1f4;return function(_0x58e464){logger[_0x07a0('0x18')](_0x58e464[_0x07a0('0x19')]);if(_0x58e464[_0x07a0('0x1a')]){delete _0x58e464['name'];}_0x2ed14d['status'](_0x4776f5)['send'](_0x58e464);};}exports[_0x07a0('0x1b')]=function(_0x5e6c3e,_0x36434d){var _0x488833={};var _0x3690af={'count':0x0,'rows':[]};var _0x256da2=_[_0x07a0('0x1c')](db[_0x07a0('0x1d')][_0x07a0('0x1e')],function(_0x4d7262){return{'name':_0x4d7262[_0x07a0('0x1f')],'type':_0x4d7262[_0x07a0('0x20')][_0x07a0('0x21')]};});_0x488833=qs[_0x07a0('0x22')](_0x256da2,_0x5e6c3e);var _0x383cb4={'where':_0x488833[_0x07a0('0x23')]};return db[_0x07a0('0x1d')]['count'](_0x383cb4)[_0x07a0('0x14')](function(_0x4dd03f){_0x3690af[_0x07a0('0x11')]=_0x4dd03f;_0x488833[_0x07a0('0x24')]=qs['include'](_0x5e6c3e['query']);return db['ChatQueue']['findAll'](_0x488833);})['then'](function(_0x4f7cd6){_0x3690af['rows']=_0x4f7cd6;return _0x3690af;})[_0x07a0('0x14')](respondWithFilteredResult(_0x36434d,_0x488833))[_0x07a0('0x25')](handleError(_0x36434d,null));};exports['show']=function(_0x5676c0,_0x34480d){var _0x251217={'raw':!![],'where':{'id':_0x5676c0[_0x07a0('0x26')]['id']}},_0x3dd7d6={};_0x3dd7d6['model']=_[_0x07a0('0x27')](db['ChatQueue'][_0x07a0('0x1e')]);_0x3dd7d6['query']=_[_0x07a0('0x27')](_0x5676c0[_0x07a0('0x28')]);_0x3dd7d6[_0x07a0('0x29')]=_[_0x07a0('0x2a')](_0x3dd7d6[_0x07a0('0x2b')],_0x3dd7d6[_0x07a0('0x28')]);_0x251217[_0x07a0('0x2c')]=_[_0x07a0('0x2a')](_0x3dd7d6[_0x07a0('0x2b')],qs['fields'](_0x5676c0['query']['fields']));_0x251217[_0x07a0('0x2c')]=_0x251217['attributes'][_0x07a0('0x2d')]?_0x251217[_0x07a0('0x2c')]:_0x3dd7d6[_0x07a0('0x2b')];if(_0x5676c0[_0x07a0('0x28')]['includeAll']){_0x251217[_0x07a0('0x24')]=[{'all':!![]}];}_0x251217=_['merge']({},_0x251217,_0x5676c0[_0x07a0('0x2e')]);return db['ChatQueue'][_0x07a0('0x2f')](_0x251217)[_0x07a0('0x14')](handleEntityNotFound(_0x34480d,null))[_0x07a0('0x14')](respondWithResult(_0x34480d,null))[_0x07a0('0x25')](handleError(_0x34480d,null));};exports['create']=function(_0x3bf396,_0x1304d6){return db[_0x07a0('0x1d')][_0x07a0('0x30')](_0x3bf396[_0x07a0('0x31')],{})[_0x07a0('0x14')](function(_0x2dc37f){var _0x5406fe=_0x3bf396['user'][_0x07a0('0x15')]({'plain':!![]});if(!_0x5406fe)throw new Error(_0x07a0('0x32'));if(_0x5406fe['role']===_0x07a0('0x33')){var _0x2145ad=_0x2dc37f[_0x07a0('0x15')]({'plain':!![]});var _0x4dffa7=_0x07a0('0x34');return db['UserProfileSection'][_0x07a0('0x2f')]({'where':{'name':_0x4dffa7,'userProfileId':_0x5406fe[_0x07a0('0x35')]},'raw':!![]})[_0x07a0('0x14')](function(_0x4fa680){if(_0x4fa680&&_0x4fa680[_0x07a0('0x36')]===0x0){return db['UserProfileResource'][_0x07a0('0x30')]({'name':_0x2145ad[_0x07a0('0x1a')],'resourceId':_0x2145ad['id'],'type':_0x4fa680[_0x07a0('0x1a')],'sectionId':_0x4fa680['id']},{})[_0x07a0('0x14')](function(){return _0x2dc37f;});}else{return _0x2dc37f;}})[_0x07a0('0x25')](function(_0x2eeea7){logger[_0x07a0('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2eeea7);throw _0x2eeea7;});}return _0x2dc37f;})['then'](respondWithResult(_0x1304d6,0xc9))[_0x07a0('0x25')](handleError(_0x1304d6,null));};exports[_0x07a0('0x37')]=function(_0x1e53ad,_0x480c3d){if(_0x1e53ad[_0x07a0('0x31')]['id']){delete _0x1e53ad['body']['id'];}return db['ChatQueue'][_0x07a0('0x2f')]({'where':{'id':_0x1e53ad[_0x07a0('0x26')]['id']}})[_0x07a0('0x14')](handleEntityNotFound(_0x480c3d,null))[_0x07a0('0x14')](saveUpdates(_0x1e53ad['body'],null))[_0x07a0('0x14')](respondWithResult(_0x480c3d,null))['catch'](handleError(_0x480c3d,null));};exports[_0x07a0('0x17')]=function(_0x465191,_0x40527c){return db[_0x07a0('0x1d')][_0x07a0('0x2f')]({'where':{'id':_0x465191[_0x07a0('0x26')]['id']}})['then'](handleEntityNotFound(_0x40527c,null))[_0x07a0('0x14')](removeEntity(_0x40527c,null))[_0x07a0('0x25')](handleError(_0x40527c,null));};exports[_0x07a0('0x38')]=function(_0x568d95,_0x3379c9){return db['ChatQueue'][_0x07a0('0x38')]()['then'](respondWithResult(_0x3379c9,null))[_0x07a0('0x25')](handleError(_0x3379c9,null));};exports['getMembers']=function(_0xe54dae,_0x4a3dd6){var _0x39b72d={'raw':!![],'where':{}},_0x2b9bb8={},_0xb6e5e8;return db['ChatQueue'][_0x07a0('0x39')]({'where':{'id':_0xe54dae[_0x07a0('0x26')]['id']}})[_0x07a0('0x14')](handleEntityNotFound(_0x4a3dd6,null))['then'](function(_0x11d7a7){if(_0x11d7a7){_0xb6e5e8=_0x11d7a7[_0x07a0('0x15')]({'plain':!![]});_0x2b9bb8['model']=_[_0x07a0('0x27')](db[_0x07a0('0x3a')]['rawAttributes']);_0x2b9bb8[_0x07a0('0x28')]=_['keys'](_0xe54dae[_0x07a0('0x28')]);_0x2b9bb8[_0x07a0('0x29')]=_['intersection'](_0x2b9bb8[_0x07a0('0x2b')],_0x2b9bb8[_0x07a0('0x28')]);_0x39b72d[_0x07a0('0x2c')]=_[_0x07a0('0x2a')](_0x2b9bb8[_0x07a0('0x2b')],qs[_0x07a0('0x3b')](_0xe54dae['query'][_0x07a0('0x3b')]));_0x39b72d[_0x07a0('0x2c')]=_0x39b72d['attributes'][_0x07a0('0x2d')]?_0x39b72d[_0x07a0('0x2c')]:_0x2b9bb8[_0x07a0('0x2b')];if(!_0xe54dae['query'][_0x07a0('0x3c')](_0x07a0('0x3d'))){_0x39b72d['limit']=qs[_0x07a0('0xf')](_0xe54dae[_0x07a0('0x28')][_0x07a0('0xf')]);_0x39b72d[_0x07a0('0x12')]=qs['offset'](_0xe54dae[_0x07a0('0x28')][_0x07a0('0x12')]);}_0x39b72d['order']=qs['sort'](_0xe54dae['query'][_0x07a0('0x3e')]);_0x39b72d[_0x07a0('0x23')]=qs[_0x07a0('0x29')](_[_0x07a0('0x3f')](_0xe54dae['query'],_0x2b9bb8[_0x07a0('0x29')]));_0x39b72d[_0x07a0('0x23')][_0x07a0('0x40')]=_0x11d7a7['id'];if(_0xe54dae[_0x07a0('0x28')]['filter']){_0x39b72d[_0x07a0('0x23')]=_[_0x07a0('0x41')](_0x39b72d['where'],{'$or':_[_0x07a0('0x1c')](_0x39b72d[_0x07a0('0x2c')],function(_0x2e8088){var _0x1109fa={};_0x1109fa[_0x2e8088]={'$like':'%'+_0xe54dae[_0x07a0('0x28')]['filter']+'%'};return _0x1109fa;})});}_0x39b72d=_[_0x07a0('0x41')]({},_0x39b72d,_0xe54dae[_0x07a0('0x2e')]);return db['UserChatQueue'][_0x07a0('0x42')](_0x39b72d);}})[_0x07a0('0x14')](function(_0x1ff96d){if(_0x1ff96d){return db[_0x07a0('0x43')]['findAndCountAll']({'where':{'id':_[_0x07a0('0x1c')](_0x1ff96d,_0x07a0('0x44')),'role':_0x07a0('0x45')},'attributes':['id',_0x07a0('0x1a'),_0x07a0('0x46'),_0x07a0('0x47'),_0x07a0('0x48')]});}})[_0x07a0('0x14')](function(_0x5e0515){if(_0x5e0515){return{'count':_0x5e0515[_0x07a0('0x11')],'rows':_[_0x07a0('0x1c')](_0x5e0515[_0x07a0('0x49')],function(_0x273a62){return{'membername':_0x273a62[_0x07a0('0x1a')],'UserId':_0x273a62['id'],'queue_name':_0xb6e5e8[_0x07a0('0x1a')],'ChatQueueId':_0xb6e5e8['id'],'interface':util['format'](_0x07a0('0x4a'),_0x07a0('0x4b'),_0x273a62['name']),'penalty':0x0,'paused':_0x273a62[_0x07a0('0x46')],'createdAt':_0x273a62['createdAt'],'updatedAt':_0x273a62[_0x07a0('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x07a0('0x14')](respondWithFilteredResult(_0x4a3dd6,_0x39b72d))[_0x07a0('0x25')](handleError(_0x4a3dd6,null));};exports['getTeams']=function(_0x177e0a,_0x5b963f){var _0x35769d={};var _0x5e92a1={};var _0x323782;var _0x42827b;return db[_0x07a0('0x1d')][_0x07a0('0x39')]({'where':{'id':_0x177e0a[_0x07a0('0x26')]['id']}})[_0x07a0('0x14')](handleEntityNotFound(_0x5b963f,null))[_0x07a0('0x14')](function(_0x4f9d11){if(_0x4f9d11){_0x323782=_0x4f9d11;_0x5e92a1[_0x07a0('0x2b')]=_['keys'](db[_0x07a0('0x4c')][_0x07a0('0x1e')]);_0x5e92a1[_0x07a0('0x28')]=_[_0x07a0('0x27')](_0x177e0a[_0x07a0('0x28')]);_0x5e92a1[_0x07a0('0x29')]=_[_0x07a0('0x2a')](_0x5e92a1[_0x07a0('0x2b')],_0x5e92a1[_0x07a0('0x28')]);_0x35769d[_0x07a0('0x2c')]=_[_0x07a0('0x2a')](_0x5e92a1['model'],qs[_0x07a0('0x3b')](_0x177e0a['query'][_0x07a0('0x3b')]));_0x35769d['attributes']=_0x35769d[_0x07a0('0x2c')][_0x07a0('0x2d')]?_0x35769d['attributes']:_0x5e92a1[_0x07a0('0x2b')];_0x35769d[_0x07a0('0x4d')]=qs[_0x07a0('0x3e')](_0x177e0a[_0x07a0('0x28')][_0x07a0('0x3e')]);_0x35769d[_0x07a0('0x23')]=qs['filters'](_[_0x07a0('0x3f')](_0x177e0a[_0x07a0('0x28')],_0x5e92a1[_0x07a0('0x29')]));if(_0x177e0a[_0x07a0('0x28')][_0x07a0('0x4e')]){_0x35769d[_0x07a0('0x23')]=_[_0x07a0('0x41')](_0x35769d[_0x07a0('0x23')],{'$or':_[_0x07a0('0x1c')](_0x35769d['attributes'],function(_0x39feed){var _0x379e7f={};_0x379e7f[_0x39feed]={'$like':'%'+_0x177e0a[_0x07a0('0x28')]['filter']+'%'};return _0x379e7f;})});}_0x35769d=_[_0x07a0('0x41')]({},_0x35769d,_0x177e0a[_0x07a0('0x2e')]);return _0x323782[_0x07a0('0x4f')](_0x35769d);}})[_0x07a0('0x14')](function(_0x53a10c){if(_0x53a10c){_0x42827b=_0x53a10c[_0x07a0('0x2d')];if(!_0x177e0a[_0x07a0('0x28')][_0x07a0('0x3c')](_0x07a0('0x3d'))){_0x35769d['limit']=qs['limit'](_0x177e0a[_0x07a0('0x28')][_0x07a0('0xf')]);_0x35769d[_0x07a0('0x12')]=qs[_0x07a0('0x12')](_0x177e0a[_0x07a0('0x28')][_0x07a0('0x12')]);}return _0x323782[_0x07a0('0x4f')](_0x35769d);}})[_0x07a0('0x14')](function(_0x128c1c){if(_0x128c1c){return _0x128c1c?{'count':_0x42827b,'rows':_0x128c1c}:null;}})['then'](respondWithResult(_0x5b963f,null))[_0x07a0('0x25')](handleError(_0x5b963f,null));};exports['addTeams']=function(_0x46b925,_0x5d2e88){var _0x29d273=_0x46b925[_0x07a0('0x31')][_0x07a0('0x50')];return db[_0x07a0('0x4c')][_0x07a0('0x42')]({'where':{'id':_0x29d273},'attributes':['id'],'include':[{'model':db[_0x07a0('0x43')],'as':'Agents','attributes':['id',_0x07a0('0x1a'),_0x07a0('0x51'),_0x07a0('0x52'),_0x07a0('0x53')],'raw':!![]}]})[_0x07a0('0x14')](function(_0x14b416){if(_0x14b416){var _0x2747d8=_['flatMap'](_0x14b416,function(_0x4b736e){var _0x491843=_0x4b736e[_0x07a0('0x15')]({'plain':!![]});return _0x491843[_0x07a0('0x54')];});return db[_0x07a0('0x1d')][_0x07a0('0x2f')]({'where':{'id':_0x46b925[_0x07a0('0x26')]['id']}})['then'](function(_0x272b1c){return db['sequelize'][_0x07a0('0x55')](function(_0x3382a0){return _0x272b1c[_0x07a0('0x56')](_0x29d273,{'transaction':_0x3382a0})[_0x07a0('0x14')](function(){return BPromise['each'](_0x2747d8,function(_0x52925c){return db[_0x07a0('0x3a')]['findOrCreate']({'where':{'UserId':_0x52925c['id'],'ChatQueueId':_0x46b925[_0x07a0('0x26')]['id']},'transaction':_0x3382a0});});})['then'](function(){_0x2747d8[_0x07a0('0x57')](function(_0x55910d){socket[_0x07a0('0x58')](_0x07a0('0x59'),{'UserId':_0x55910d['id'],'ChatQueueId':_0x272b1c['id']});});});});});}})[_0x07a0('0x14')](respondWithStatusCode(_0x5d2e88,null))[_0x07a0('0x25')](handleError(_0x5d2e88,null));};exports['removeTeams']=function(_0xe69383,_0x32df3b){return db['Team']['findAll']({'where':{'id':_0xe69383[_0x07a0('0x28')]['ids']},'attributes':['id'],'include':[{'model':db[_0x07a0('0x43')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x07a0('0x14')](handleEntityNotFound(_0x32df3b,null))['then'](function(_0x42ed2e){var _0xdb9b23=_[_0x07a0('0x1c')](_0x42ed2e,'id');var _0x328a94=[];var _0x22ac14=[];var _0x34a58c=squel[_0x07a0('0x5a')]();_0x34a58c[_0x07a0('0x5b')](_0x07a0('0x5c'))[_0x07a0('0x5d')](_0x07a0('0x5e'),'tq')[_0x07a0('0x5f')]('user_has_teams','ut',_0x07a0('0x60'))[_0x07a0('0x23')](_0x07a0('0x61'),_0xe69383[_0x07a0('0x26')]['id']);for(var _0x126225=0x0;_0x126225<_0x42ed2e[_0x07a0('0x2d')];_0x126225+=0x1){let _0x1f8845=_0x42ed2e[_0x126225];for(var _0x3f9ed1=0x0;_0x3f9ed1<_0x1f8845[_0x07a0('0x54')][_0x07a0('0x2d')];_0x3f9ed1+=0x1){let _0x133a55=_0x1f8845[_0x07a0('0x54')][_0x3f9ed1];var _0xa33a6d=_0x34a58c['clone']();_0xa33a6d[_0x07a0('0x23')]('ut.UserId\x20=\x20?',_0x133a55['id']);_0x22ac14[_0x07a0('0x62')](db['sequelize']['query'](_0xa33a6d[_0x07a0('0x63')](),{'type':db[_0x07a0('0x64')][_0x07a0('0x65')][_0x07a0('0x66')]})[_0x07a0('0x14')](function(_0x28f72d){if(_0x28f72d[_0x07a0('0x2d')]===0x1){return _0x133a55['id'];}else{var _0x5e4dc7=_['every'](_[_0x07a0('0x1c')](_0x28f72d,'TeamId'),function(_0x51cd7f){return _['includes'](_0xdb9b23,_0x51cd7f);});if(_0x5e4dc7){return _0x133a55['id'];}}}));}}return BPromise[_0x07a0('0x67')](_0x22ac14)[_0x07a0('0x14')](function(_0x50336d){_0x328a94=_(_0x328a94)[_0x07a0('0x68')](_0x50336d)[_0x07a0('0x69')]()[_0x07a0('0x6a')]();return db[_0x07a0('0x1d')]['find']({'where':{'id':_0xe69383[_0x07a0('0x26')]['id']}})[_0x07a0('0x14')](function(_0x4cb88b){return db[_0x07a0('0x64')][_0x07a0('0x55')](function(_0x22a137){return _0x4cb88b[_0x07a0('0x6b')](_0xe69383[_0x07a0('0x28')]['ids'],{'transaction':_0x22a137})[_0x07a0('0x14')](function(){if(!_['isEmpty'](_0x328a94)){return _0x4cb88b['removeAgents'](_0x328a94,{'transaction':_0x22a137});}})[_0x07a0('0x14')](function(){_0x328a94[_0x07a0('0x57')](function(_0x32fa11){socket[_0x07a0('0x58')](_0x07a0('0x6c'),{'UserId':_0x32fa11,'ChatQueueId':_0x4cb88b['id']});});});});});});})[_0x07a0('0x14')](respondWithStatusCode(_0x32df3b,null))['catch'](handleError(_0x32df3b,null));};exports[_0x07a0('0x6d')]=function(_0x5055b6,_0x7dc327){return db[_0x07a0('0x1d')][_0x07a0('0x2f')]({'where':{'id':_0x5055b6['params']['id']}})[_0x07a0('0x14')](handleEntityNotFound(_0x7dc327,null))[_0x07a0('0x14')](function(_0x345577){if(_0x345577){return _0x345577['addAgents'](_0x5055b6[_0x07a0('0x31')]['ids'],_[_0x07a0('0x6e')](_0x5055b6['body'],[_0x07a0('0x50'),'id'])||{})[_0x07a0('0x6f')](function(_0x5d351e){for(var _0x57d475=0x0;_0x57d475<_0x5055b6[_0x07a0('0x31')]['ids'][_0x07a0('0x2d')];_0x57d475+=0x1){socket[_0x07a0('0x58')](_0x07a0('0x59'),{'UserId':Number(_0x5055b6[_0x07a0('0x31')][_0x07a0('0x50')][_0x57d475]),'ChatQueueId':Number(_0x5055b6[_0x07a0('0x26')]['id'])});}return _0x5d351e;});}})['then'](respondWithResult(_0x7dc327,null))[_0x07a0('0x25')](handleError(_0x7dc327,null));};exports[_0x07a0('0x70')]=function(_0x26b858,_0x192464){return db[_0x07a0('0x1d')][_0x07a0('0x2f')]({'where':{'id':_0x26b858[_0x07a0('0x26')]['id']}})[_0x07a0('0x14')](handleEntityNotFound(_0x192464,null))['then'](function(_0x37f0f9){if(_0x37f0f9){return _0x37f0f9['removeAgents'](_0x26b858['query']['ids'])[_0x07a0('0x14')](function(){if(_[_0x07a0('0x71')](_0x26b858[_0x07a0('0x28')][_0x07a0('0x50')])){for(var _0x557956=0x0;_0x557956<_0x26b858[_0x07a0('0x28')]['ids'][_0x07a0('0x2d')];_0x557956+=0x1){socket[_0x07a0('0x58')]('userChatQueue:remove',{'UserId':Number(_0x26b858[_0x07a0('0x28')]['ids'][_0x557956]),'ChatQueueId':Number(_0x26b858[_0x07a0('0x26')]['id'])});}}else{socket[_0x07a0('0x58')](_0x07a0('0x6c'),{'UserId':Number(_0x26b858['query'][_0x07a0('0x50')]),'ChatQueueId':Number(_0x26b858['params']['id'])});}});}})[_0x07a0('0x14')](respondWithStatusCode(_0x192464,null))['catch'](handleError(_0x192464,null));};exports['getAgents']=function(_0x58b09d,_0x2f31ba){var _0x4ef68e={};var _0x106668={};var _0x3de7fe;var _0x56f7b6;return db[_0x07a0('0x1d')][_0x07a0('0x39')]({'where':{'id':_0x58b09d['params']['id']}})[_0x07a0('0x14')](handleEntityNotFound(_0x2f31ba,null))['then'](function(_0x25b2dd){if(_0x25b2dd){_0x3de7fe=_0x25b2dd;_0x106668['model']=_[_0x07a0('0x27')](db[_0x07a0('0x43')][_0x07a0('0x1e')]);_0x106668[_0x07a0('0x28')]=_['keys'](_0x58b09d[_0x07a0('0x28')]);_0x106668['filters']=_['intersection'](_0x106668[_0x07a0('0x2b')],_0x106668[_0x07a0('0x28')]);_0x4ef68e[_0x07a0('0x2c')]=_[_0x07a0('0x2a')](_0x106668[_0x07a0('0x2b')],qs['fields'](_0x58b09d[_0x07a0('0x28')][_0x07a0('0x3b')]));_0x4ef68e[_0x07a0('0x2c')]=_0x4ef68e[_0x07a0('0x2c')]['length']?_0x4ef68e[_0x07a0('0x2c')]:_0x106668[_0x07a0('0x2b')];_0x4ef68e[_0x07a0('0x4d')]=qs[_0x07a0('0x3e')](_0x58b09d[_0x07a0('0x28')]['sort']);_0x4ef68e['where']=qs[_0x07a0('0x29')](_[_0x07a0('0x3f')](_0x58b09d[_0x07a0('0x28')],_0x106668[_0x07a0('0x29')]));if(_0x58b09d[_0x07a0('0x28')]['filter']){_0x4ef68e[_0x07a0('0x23')]=_[_0x07a0('0x41')](_0x4ef68e[_0x07a0('0x23')],{'$or':_['map'](_0x4ef68e[_0x07a0('0x2c')],function(_0x356b5c){var _0x22b4cf={};_0x22b4cf[_0x356b5c]={'$like':'%'+_0x58b09d[_0x07a0('0x28')][_0x07a0('0x4e')]+'%'};return _0x22b4cf;})});}_0x4ef68e=_[_0x07a0('0x41')]({},_0x4ef68e,_0x58b09d[_0x07a0('0x2e')]);return _0x3de7fe[_0x07a0('0x72')](_0x4ef68e);}})['then'](function(_0x2f63fd){if(_0x2f63fd){_0x56f7b6=_0x2f63fd[_0x07a0('0x2d')];if(!_0x58b09d['query']['hasOwnProperty'](_0x07a0('0x3d'))){_0x4ef68e['limit']=qs[_0x07a0('0xf')](_0x58b09d[_0x07a0('0x28')][_0x07a0('0xf')]);_0x4ef68e[_0x07a0('0x12')]=qs[_0x07a0('0x12')](_0x58b09d[_0x07a0('0x28')][_0x07a0('0x12')]);}return _0x3de7fe[_0x07a0('0x72')](_0x4ef68e);}})[_0x07a0('0x14')](function(_0x284fd4){if(_0x284fd4){return _0x284fd4?{'count':_0x56f7b6,'rows':_0x284fd4}:null;}})['then'](respondWithResult(_0x2f31ba,null))[_0x07a0('0x25')](handleError(_0x2f31ba,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 8594a5b..1108af3 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 _0x7c17=['exports','events','../../mysqldb','ChatQueue','setMaxListeners','remove','hasOwnProperty','hook'];(function(_0xdd31c,_0x484018){var _0x11b6ce=function(_0x178aca){while(--_0x178aca){_0xdd31c['push'](_0xdd31c['shift']());}};_0x11b6ce(++_0x484018);}(_0x7c17,0x149));var _0x77c1=function(_0x266ef6,_0x243c05){_0x266ef6=_0x266ef6-0x0;var _0x3178f6=_0x7c17[_0x266ef6];return _0x3178f6;};'use strict';var EventEmitter=require(_0x77c1('0x0'));var ChatQueue=require(_0x77c1('0x1'))['db'][_0x77c1('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x77c1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x77c1('0x4')};function emitEvent(_0x11c0e5){return function(_0x5d368e,_0x46ef1c,_0x20dd51){ChatQueueEvents['emit'](_0x11c0e5+':'+_0x5d368e['id'],_0x5d368e);ChatQueueEvents['emit'](_0x11c0e5,_0x5d368e);_0x20dd51(null);};}for(var e in events){if(events[_0x77c1('0x5')](e)){var event=events[e];ChatQueue[_0x77c1('0x6')](e,emitEvent(event));}}module[_0x77c1('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x3d5b=['exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x28a5eb,_0x513eac){var _0xb4d010=function(_0x201a4d){while(--_0x201a4d){_0x28a5eb['push'](_0x28a5eb['shift']());}};_0xb4d010(++_0x513eac);}(_0x3d5b,0x85));var _0xb3d5=function(_0x2e8795,_0x9298e6){_0x2e8795=_0x2e8795-0x0;var _0x36f65a=_0x3d5b[_0x2e8795];return _0x36f65a;};'use strict';var EventEmitter=require(_0xb3d5('0x0'));var ChatQueue=require(_0xb3d5('0x1'))['db'][_0xb3d5('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xb3d5('0x3')](0x0);var events={'afterCreate':_0xb3d5('0x4'),'afterUpdate':_0xb3d5('0x5'),'afterDestroy':_0xb3d5('0x6')};function emitEvent(_0x7e0d11){return function(_0xd5a49b,_0x437822,_0x5481a2){ChatQueueEvents[_0xb3d5('0x7')](_0x7e0d11+':'+_0xd5a49b['id'],_0xd5a49b);ChatQueueEvents[_0xb3d5('0x7')](_0x7e0d11,_0xd5a49b);_0x5481a2(null);};}for(var e in events){if(events[_0xb3d5('0x8')](e)){var event=events[e];ChatQueue[_0xb3d5('0x9')](e,emitEvent(event));}}module[_0xb3d5('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 56bc311..495cc27 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 _0x7e87=['ChatQueue','chat_queues','lodash','util','bluebird','request-promise','rimraf','./chatQueue.attributes','define'];(function(_0x19a679,_0x480403){var _0x5106ff=function(_0x177019){while(--_0x177019){_0x19a679['push'](_0x19a679['shift']());}};_0x5106ff(++_0x480403);}(_0x7e87,0x1cd));var _0x77e8=function(_0x37163a,_0xe854c2){_0x37163a=_0x37163a-0x0;var _0x4c7bcc=_0x7e87[_0x37163a];return _0x4c7bcc;};'use strict';var _=require(_0x77e8('0x0'));var util=require(_0x77e8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x77e8('0x2'));var rp=require(_0x77e8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77e8('0x4'));var config=require('../../config/environment');var attributes=require(_0x77e8('0x5'));module['exports']=function(_0x3e827a,_0x4ed6a7){return _0x3e827a[_0x77e8('0x6')](_0x77e8('0x7'),attributes,{'tableName':_0x77e8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f61=['path','rimraf','../../config/environment','./chatQueue.attributes','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3ed4bc,_0x4f445d){var _0x28c4b0=function(_0x4ced39){while(--_0x4ced39){_0x3ed4bc['push'](_0x3ed4bc['shift']());}};_0x28c4b0(++_0x4f445d);}(_0x4f61,0x7e));var _0x14f6=function(_0x1e9d45,_0x1ad469){_0x1e9d45=_0x1e9d45-0x0;var _0x3e0c94=_0x4f61[_0x1e9d45];return _0x3e0c94;};'use strict';var _=require(_0x14f6('0x0'));var util=require(_0x14f6('0x1'));var logger=require(_0x14f6('0x2'))(_0x14f6('0x3'));var moment=require(_0x14f6('0x4'));var BPromise=require('bluebird');var rp=require(_0x14f6('0x5'));var fs=require('fs');var path=require(_0x14f6('0x6'));var rimraf=require(_0x14f6('0x7'));var config=require(_0x14f6('0x8'));var attributes=require(_0x14f6('0x9'));module['exports']=function(_0x592e97,_0x57a6a5){return _0x592e97['define'](_0x14f6('0xa'),attributes,{'tableName':_0x14f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 7b2c898..b566b3c 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 _0x8425=['catch','ChatQueue','raw','options','where','attributes','include','map','model','GetChatQueue','ShowChatQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x26b622,_0x237e9e){var _0x58a028=function(_0xde1652){while(--_0xde1652){_0x26b622['push'](_0x26b622['shift']());}};_0x58a028(++_0x237e9e);}(_0x8425,0x13b));var _0x5842=function(_0x3b5d33,_0x417885){_0x3b5d33=_0x3b5d33-0x0;var _0x6934c8=_0x8425[_0x3b5d33];return _0x6934c8;};'use strict';var _=require(_0x5842('0x0'));var util=require(_0x5842('0x1'));var moment=require(_0x5842('0x2'));var BPromise=require(_0x5842('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5842('0x4'));var db=require(_0x5842('0x5'))['db'];var utils=require(_0x5842('0x6'));var logger=require(_0x5842('0x7'))(_0x5842('0x8'));var config=require(_0x5842('0x9'));var jayson=require(_0x5842('0xa'));var client=jayson['client'][_0x5842('0xb')]({'port':0x232a});config[_0x5842('0xc')]=_[_0x5842('0xd')](config[_0x5842('0xc')],{'host':_0x5842('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5842('0xf'))['register'](socket);function respondWithRpcPromise(_0xc55038,_0x2e6b84,_0x33e5f7){return new BPromise(function(_0x2b6c6d,_0x11cb15){return client[_0x5842('0x10')](_0xc55038,_0x33e5f7)[_0x5842('0x11')](function(_0x1c7cf4){logger[_0x5842('0x12')](_0x5842('0x13'),_0x2e6b84,_0x5842('0x14'));logger[_0x5842('0x15')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2e6b84,_0x5842('0x14'),JSON[_0x5842('0x16')](_0x1c7cf4));if(_0x1c7cf4[_0x5842('0x17')]){if(_0x1c7cf4[_0x5842('0x17')][_0x5842('0x18')]===0x1f4){logger[_0x5842('0x17')](_0x5842('0x13'),_0x2e6b84,_0x1c7cf4[_0x5842('0x17')][_0x5842('0x19')]);return _0x11cb15(_0x1c7cf4[_0x5842('0x17')][_0x5842('0x19')]);}logger[_0x5842('0x17')](_0x5842('0x13'),_0x2e6b84,_0x1c7cf4[_0x5842('0x17')][_0x5842('0x19')]);return _0x2b6c6d(_0x1c7cf4['error'][_0x5842('0x19')]);}else{logger[_0x5842('0x12')](_0x5842('0x13'),_0x2e6b84,'request\x20sent');_0x2b6c6d(_0x1c7cf4[_0x5842('0x1a')][_0x5842('0x19')]);}})[_0x5842('0x1b')](function(_0x25feee){logger['error']('ChatQueue,\x20%s,\x20%s',_0x2e6b84,_0x25feee);_0x11cb15(_0x25feee);});});}exports['GetChatQueue']=function(_0x3702d1){var _0x4d0a72=this;return new Promise(function(_0x354e90,_0x3a3fc9){return db[_0x5842('0x1c')]['findAll']({'raw':_0x3702d1['options']?_0x3702d1['options'][_0x5842('0x1d')]===undefined?!![]:![]:!![],'where':_0x3702d1[_0x5842('0x1e')]?_0x3702d1[_0x5842('0x1e')][_0x5842('0x1f')]||null:null,'attributes':_0x3702d1[_0x5842('0x1e')]?_0x3702d1['options'][_0x5842('0x20')]||null:null,'limit':_0x3702d1[_0x5842('0x1e')]?_0x3702d1[_0x5842('0x1e')]['limit']||null:null,'include':_0x3702d1[_0x5842('0x1e')]?_0x3702d1[_0x5842('0x1e')][_0x5842('0x21')]?_[_0x5842('0x22')](_0x3702d1[_0x5842('0x1e')][_0x5842('0x21')],function(_0x34421b){return{'model':db[_0x34421b['model']],'as':_0x34421b['as'],'attributes':_0x34421b['attributes'],'include':_0x34421b['include']?_[_0x5842('0x22')](_0x34421b[_0x5842('0x21')],function(_0x2be6b8){return{'model':db[_0x2be6b8[_0x5842('0x23')]],'as':_0x2be6b8['as'],'attributes':_0x2be6b8[_0x5842('0x20')],'include':_0x2be6b8['include']?_['map'](_0x2be6b8[_0x5842('0x21')],function(_0x37295d){return{'model':db[_0x37295d[_0x5842('0x23')]],'as':_0x37295d['as'],'attributes':_0x37295d['attributes']};}):[]};}):[]};}):[]:[]})[_0x5842('0x11')](function(_0x336f18){logger[_0x5842('0x12')](_0x5842('0x24'),_0x3702d1);logger[_0x5842('0x15')](_0x5842('0x24'),_0x3702d1,JSON[_0x5842('0x16')](_0x336f18));_0x354e90(_0x336f18);})[_0x5842('0x1b')](function(_0x5522c3){logger[_0x5842('0x17')]('GetChatQueue',_0x5522c3[_0x5842('0x19')],_0x3702d1);_0x3a3fc9(_0x4d0a72[_0x5842('0x17')](0x1f4,_0x5522c3[_0x5842('0x19')]));});});};exports[_0x5842('0x25')]=function(_0x2c0b8b){var _0x325e0e=this;return new Promise(function(_0x199be2,_0x21bad1){return db['ChatQueue']['find']({'raw':_0x2c0b8b[_0x5842('0x1e')]?_0x2c0b8b[_0x5842('0x1e')][_0x5842('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c0b8b[_0x5842('0x1e')]?_0x2c0b8b[_0x5842('0x1e')][_0x5842('0x1f')]||null:null,'attributes':_0x2c0b8b[_0x5842('0x1e')]?_0x2c0b8b['options'][_0x5842('0x20')]||null:null,'include':_0x2c0b8b[_0x5842('0x1e')]?_0x2c0b8b[_0x5842('0x1e')]['include']?_[_0x5842('0x22')](_0x2c0b8b[_0x5842('0x1e')][_0x5842('0x21')],function(_0x5d105c){return{'model':db[_0x5d105c[_0x5842('0x23')]],'as':_0x5d105c['as'],'attributes':_0x5d105c[_0x5842('0x20')],'include':_0x5d105c[_0x5842('0x21')]?_[_0x5842('0x22')](_0x5d105c[_0x5842('0x21')],function(_0x68eff2){return{'model':db[_0x68eff2[_0x5842('0x23')]],'as':_0x68eff2['as'],'attributes':_0x68eff2['attributes'],'include':_0x68eff2['include']?_['map'](_0x68eff2[_0x5842('0x21')],function(_0x4407b4){return{'model':db[_0x4407b4[_0x5842('0x23')]],'as':_0x4407b4['as'],'attributes':_0x4407b4[_0x5842('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5842('0x11')](function(_0xf78bc){logger[_0x5842('0x12')](_0x5842('0x25'),_0x2c0b8b);logger[_0x5842('0x15')]('ShowChatQueue',_0x2c0b8b,JSON[_0x5842('0x16')](_0xf78bc));_0x199be2(_0xf78bc);})[_0x5842('0x1b')](function(_0x4e2c96){logger[_0x5842('0x17')](_0x5842('0x25'),_0x4e2c96[_0x5842('0x19')],_0x2c0b8b);_0x21bad1(_0x325e0e['error'](0x1f4,_0x4e2c96['message']));});});}; \ No newline at end of file +var _0x6bab=['../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','include','map','model','attributes','ShowChatQueue','find','info','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x1dd56c,_0x511e8a){var _0x211d4f=function(_0x1531a9){while(--_0x1531a9){_0x1dd56c['push'](_0x1dd56c['shift']());}};_0x211d4f(++_0x511e8a);}(_0x6bab,0x1c7));var _0xb6ba=function(_0x5e8d3e,_0x18ed2e){_0x5e8d3e=_0x5e8d3e-0x0;var _0x1348c0=_0x6bab[_0x5e8d3e];return _0x1348c0;};'use strict';var _=require(_0xb6ba('0x0'));var util=require(_0xb6ba('0x1'));var moment=require(_0xb6ba('0x2'));var BPromise=require(_0xb6ba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6ba('0x4'));var db=require(_0xb6ba('0x5'))['db'];var utils=require(_0xb6ba('0x6'));var logger=require(_0xb6ba('0x7'))(_0xb6ba('0x8'));var config=require('../../config/environment');var jayson=require(_0xb6ba('0x9'));var client=jayson['client'][_0xb6ba('0xa')]({'port':0x232a});config[_0xb6ba('0xb')]=_[_0xb6ba('0xc')](config[_0xb6ba('0xb')],{'host':_0xb6ba('0xd'),'port':0x18eb});var socket=require(_0xb6ba('0xe'))(new Redis(config[_0xb6ba('0xb')]));require(_0xb6ba('0xf'))[_0xb6ba('0x10')](socket);function respondWithRpcPromise(_0x5ae28b,_0x16cb3a,_0x55a4b0){return new BPromise(function(_0x5c4eac,_0x5c556d){return client[_0xb6ba('0x11')](_0x5ae28b,_0x55a4b0)[_0xb6ba('0x12')](function(_0x1cb42c){logger['info'](_0xb6ba('0x13'),_0x16cb3a,_0xb6ba('0x14'));logger[_0xb6ba('0x15')](_0xb6ba('0x16'),_0x16cb3a,_0xb6ba('0x14'),JSON[_0xb6ba('0x17')](_0x1cb42c));if(_0x1cb42c[_0xb6ba('0x18')]){if(_0x1cb42c[_0xb6ba('0x18')][_0xb6ba('0x19')]===0x1f4){logger[_0xb6ba('0x18')](_0xb6ba('0x13'),_0x16cb3a,_0x1cb42c[_0xb6ba('0x18')][_0xb6ba('0x1a')]);return _0x5c556d(_0x1cb42c[_0xb6ba('0x18')][_0xb6ba('0x1a')]);}logger[_0xb6ba('0x18')](_0xb6ba('0x13'),_0x16cb3a,_0x1cb42c[_0xb6ba('0x18')][_0xb6ba('0x1a')]);return _0x5c4eac(_0x1cb42c['error'][_0xb6ba('0x1a')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x16cb3a,_0xb6ba('0x14'));_0x5c4eac(_0x1cb42c[_0xb6ba('0x1b')]['message']);}})[_0xb6ba('0x1c')](function(_0xf1e2f8){logger['error'](_0xb6ba('0x13'),_0x16cb3a,_0xf1e2f8);_0x5c556d(_0xf1e2f8);});});}exports[_0xb6ba('0x1d')]=function(_0x42ead3){var _0x459f9b=this;return new Promise(function(_0x298207,_0x40b66e){return db[_0xb6ba('0x1e')][_0xb6ba('0x1f')]({'raw':_0x42ead3[_0xb6ba('0x20')]?_0x42ead3[_0xb6ba('0x20')][_0xb6ba('0x21')]===undefined?!![]:![]:!![],'where':_0x42ead3[_0xb6ba('0x20')]?_0x42ead3[_0xb6ba('0x20')][_0xb6ba('0x22')]||null:null,'attributes':_0x42ead3[_0xb6ba('0x20')]?_0x42ead3[_0xb6ba('0x20')]['attributes']||null:null,'limit':_0x42ead3['options']?_0x42ead3[_0xb6ba('0x20')]['limit']||null:null,'include':_0x42ead3[_0xb6ba('0x20')]?_0x42ead3[_0xb6ba('0x20')][_0xb6ba('0x23')]?_[_0xb6ba('0x24')](_0x42ead3[_0xb6ba('0x20')]['include'],function(_0x5ce5d7){return{'model':db[_0x5ce5d7[_0xb6ba('0x25')]],'as':_0x5ce5d7['as'],'attributes':_0x5ce5d7['attributes'],'include':_0x5ce5d7[_0xb6ba('0x23')]?_[_0xb6ba('0x24')](_0x5ce5d7[_0xb6ba('0x23')],function(_0xca634){return{'model':db[_0xca634[_0xb6ba('0x25')]],'as':_0xca634['as'],'attributes':_0xca634[_0xb6ba('0x26')],'include':_0xca634[_0xb6ba('0x23')]?_[_0xb6ba('0x24')](_0xca634['include'],function(_0x2d5038){return{'model':db[_0x2d5038['model']],'as':_0x2d5038['as'],'attributes':_0x2d5038[_0xb6ba('0x26')]};}):[]};}):[]};}):[]:[]})[_0xb6ba('0x12')](function(_0x190ee3){logger['info'](_0xb6ba('0x1d'),_0x42ead3);logger['debug'](_0xb6ba('0x1d'),_0x42ead3,JSON[_0xb6ba('0x17')](_0x190ee3));_0x298207(_0x190ee3);})[_0xb6ba('0x1c')](function(_0x2820fd){logger['error']('GetChatQueue',_0x2820fd[_0xb6ba('0x1a')],_0x42ead3);_0x40b66e(_0x459f9b[_0xb6ba('0x18')](0x1f4,_0x2820fd[_0xb6ba('0x1a')]));});});};exports[_0xb6ba('0x27')]=function(_0x1dce2d){var _0x153209=this;return new Promise(function(_0x3361d3,_0x501141){return db['ChatQueue'][_0xb6ba('0x28')]({'raw':_0x1dce2d[_0xb6ba('0x20')]?_0x1dce2d[_0xb6ba('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x1dce2d[_0xb6ba('0x20')]?_0x1dce2d[_0xb6ba('0x20')][_0xb6ba('0x22')]||null:null,'attributes':_0x1dce2d[_0xb6ba('0x20')]?_0x1dce2d[_0xb6ba('0x20')][_0xb6ba('0x26')]||null:null,'include':_0x1dce2d[_0xb6ba('0x20')]?_0x1dce2d['options'][_0xb6ba('0x23')]?_[_0xb6ba('0x24')](_0x1dce2d[_0xb6ba('0x20')][_0xb6ba('0x23')],function(_0x26d0ed){return{'model':db[_0x26d0ed[_0xb6ba('0x25')]],'as':_0x26d0ed['as'],'attributes':_0x26d0ed[_0xb6ba('0x26')],'include':_0x26d0ed['include']?_[_0xb6ba('0x24')](_0x26d0ed[_0xb6ba('0x23')],function(_0x7418b4){return{'model':db[_0x7418b4[_0xb6ba('0x25')]],'as':_0x7418b4['as'],'attributes':_0x7418b4['attributes'],'include':_0x7418b4[_0xb6ba('0x23')]?_['map'](_0x7418b4['include'],function(_0x170b9c){return{'model':db[_0x170b9c[_0xb6ba('0x25')]],'as':_0x170b9c['as'],'attributes':_0x170b9c[_0xb6ba('0x26')]};}):[]};}):[]};}):[]:[]})[_0xb6ba('0x12')](function(_0x1f61f7){logger[_0xb6ba('0x29')]('ShowChatQueue',_0x1dce2d);logger[_0xb6ba('0x15')]('ShowChatQueue',_0x1dce2d,JSON[_0xb6ba('0x17')](_0x1f61f7));_0x3361d3(_0x1f61f7);})[_0xb6ba('0x1c')](function(_0x27c91a){logger['error'](_0xb6ba('0x27'),_0x27c91a[_0xb6ba('0x1a')],_0x1dce2d);_0x501141(_0x153209[_0xb6ba('0x18')](0x1f4,_0x27c91a[_0xb6ba('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 3853ad3..3b9ecdc 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 _0x8d0e=['save','remove','update','emit','removeListener','length','chatQueue:','./chatQueue.events'];(function(_0x2db291,_0x1e49b7){var _0x3be614=function(_0x20e458){while(--_0x20e458){_0x2db291['push'](_0x2db291['shift']());}};_0x3be614(++_0x1e49b7);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x81eac0,_0x414633){_0x81eac0=_0x81eac0-0x0;var _0x3ff4c5=_0x8d0e[_0x81eac0];return _0x3ff4c5;};'use strict';var ChatQueueEvents=require(_0xe8d0('0x0'));var events=[_0xe8d0('0x1'),_0xe8d0('0x2'),_0xe8d0('0x3')];function createListener(_0x2eae0c,_0x3584ab){return function(_0x15521e){_0x3584ab[_0xe8d0('0x4')](_0x2eae0c,_0x15521e);};}function removeListener(_0x32cee9,_0x579cb9){return function(){ChatQueueEvents[_0xe8d0('0x5')](_0x32cee9,_0x579cb9);};}exports['register']=function(_0x560dab){for(var _0x2e2985=0x0,_0x92483d=events[_0xe8d0('0x6')];_0x2e2985<_0x92483d;_0x2e2985++){var _0xcc03d0=events[_0x2e2985];var _0x2b6dce=createListener(_0xe8d0('0x7')+_0xcc03d0,_0x560dab);ChatQueueEvents['on'](_0xcc03d0,_0x2b6dce);}}; \ No newline at end of file +var _0xe107=['remove','update','removeListener','register','length','./chatQueue.events'];(function(_0x415ea7,_0x3cc1a2){var _0x89a878=function(_0x4ffa95){while(--_0x4ffa95){_0x415ea7['push'](_0x415ea7['shift']());}};_0x89a878(++_0x3cc1a2);}(_0xe107,0xb3));var _0x7e10=function(_0x573dc6,_0x206c5d){_0x573dc6=_0x573dc6-0x0;var _0x36c001=_0xe107[_0x573dc6];return _0x36c001;};'use strict';var ChatQueueEvents=require(_0x7e10('0x0'));var events=['save',_0x7e10('0x1'),_0x7e10('0x2')];function createListener(_0x2871b0,_0x570b2a){return function(_0x31212d){_0x570b2a['emit'](_0x2871b0,_0x31212d);};}function removeListener(_0x4db676,_0x2bdf3c){return function(){ChatQueueEvents[_0x7e10('0x3')](_0x4db676,_0x2bdf3c);};}exports[_0x7e10('0x4')]=function(_0x5be19f){for(var _0x5f1edf=0x0,_0x1dd3de=events[_0x7e10('0x5')];_0x5f1edf<_0x1dd3de;_0x5f1edf++){var _0x156c56=events[_0x5f1edf];var _0x3413f7=createListener('chatQueue:'+_0x156c56,_0x5be19f);ChatQueueEvents['on'](_0x156c56,_0x3413f7);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index cd5c3d6..72ff14f 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 _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x57f01b,_0x581196){var _0xa1ab2=function(_0x19b9ef){while(--_0x19b9ef){_0x57f01b['push'](_0x57f01b['shift']());}};_0xa1ab2(++_0x581196);}(_0x008c,0x188));var _0xc008=function(_0x1de164,_0x1ccf5f){_0x1de164=_0x1de164-0x0;var _0x5613b4=_0x008c[_0x1de164];return _0x5613b4;};'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')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x2dffc8,_0x25f505){var _0x5df762=function(_0x532d52){while(--_0x532d52){_0x2dffc8['push'](_0x2dffc8['shift']());}};_0x5df762(++_0x25f505);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',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/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 5ba8448..699c89d 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 _0x5d89=['moment','sequelize','exports','STRING','DATE'];(function(_0x1622a0,_0x2b55a9){var _0x2a2308=function(_0x38d05b){while(--_0x38d05b){_0x1622a0['push'](_0x1622a0['shift']());}};_0x2a2308(++_0x2b55a9);}(_0x5d89,0xd7));var _0x95d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d89[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x95d8('0x0'));var Sequelize=require(_0x95d8('0x1'));module[_0x95d8('0x2')]={'uniqueid':{'type':Sequelize[_0x95d8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x95d8('0x3')]},'joinAt':{'type':Sequelize[_0x95d8('0x4')]},'leaveAt':{'type':Sequelize[_0x95d8('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7243=['STRING','sequelize','exports','DATE'];(function(_0x25260e,_0x4ea9f9){var _0x5d19c6=function(_0x3bb20a){while(--_0x3bb20a){_0x25260e['push'](_0x25260e['shift']());}};_0x5d19c6(++_0x4ea9f9);}(_0x7243,0x7d));var _0x3724=function(_0x82038a,_0x4489a9){_0x82038a=_0x82038a-0x0;var _0x2b0a9c=_0x7243[_0x82038a];return _0x2b0a9c;};'use strict';var moment=require('moment');var Sequelize=require(_0x3724('0x0'));module[_0x3724('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3724('0x2')]},'leaveAt':{'type':Sequelize[_0x3724('0x2')]},'acceptAt':{'type':Sequelize[_0x3724('0x2')]},'exitAt':{'type':Sequelize[_0x3724('0x2')]},'reason':{'type':Sequelize[_0x3724('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index e194bd2..ed466f3 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 _0xb091=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','ChatQueueReport','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv'];(function(_0x33168e,_0x19b020){var _0x24f4cf=function(_0x219e74){while(--_0x219e74){_0x33168e['push'](_0x33168e['shift']());}};_0x24f4cf(++_0x19b020);}(_0xb091,0x16e));var _0x1b09=function(_0x393e2b,_0x10dd05){_0x393e2b=_0x393e2b-0x0;var _0x24153b=_0xb091[_0x393e2b];return _0x24153b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b09('0x0'));var zipdir=require(_0x1b09('0x1'));var jsonpatch=require(_0x1b09('0x2'));var rp=require(_0x1b09('0x3'));var moment=require('moment');var BPromise=require(_0x1b09('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1b09('0x5'));var sox=require(_0x1b09('0x6'));var csv=require('to-csv');var ejs=require(_0x1b09('0x7'));var fs=require('fs');var fs_extra=require(_0x1b09('0x8'));var _=require(_0x1b09('0x9'));var squel=require('squel');var crypto=require(_0x1b09('0xa'));var jsforce=require(_0x1b09('0xb'));var deskjs=require(_0x1b09('0xc'));var toCsv=require(_0x1b09('0xd'));var querystring=require(_0x1b09('0xe'));var Papa=require(_0x1b09('0xf'));var Redis=require(_0x1b09('0x10'));var authService=require(_0x1b09('0x11'));var qs=require(_0x1b09('0x12'));var as=require(_0x1b09('0x13'));var hardwareService=require(_0x1b09('0x14'));var logger=require('../../config/logger')(_0x1b09('0x15'));var utils=require(_0x1b09('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b09('0x17'))['db'];function respondWithStatusCode(_0x4284ad,_0x3ae4a0){_0x3ae4a0=_0x3ae4a0||0xcc;return function(_0x1046f8){if(_0x1046f8){return _0x4284ad[_0x1b09('0x18')](_0x3ae4a0);}return _0x4284ad[_0x1b09('0x19')](_0x3ae4a0)[_0x1b09('0x1a')]();};}function respondWithResult(_0x58392d,_0x37fdb2){_0x37fdb2=_0x37fdb2||0xc8;return function(_0x515ade){if(_0x515ade){return _0x58392d[_0x1b09('0x19')](_0x37fdb2)[_0x1b09('0x1b')](_0x515ade);}};}function respondWithFilteredResult(_0x11ab46,_0x37673e){return function(_0x10b7eb){if(_0x10b7eb){var _0x1dc96b=typeof _0x37673e[_0x1b09('0x1c')]===_0x1b09('0x1d')&&typeof _0x37673e[_0x1b09('0x1e')]===_0x1b09('0x1d');var _0x311158=_0x10b7eb[_0x1b09('0x1f')];var _0x646575=_0x1dc96b?0x0:_0x37673e['offset'];var _0x214c6b=_0x1dc96b?_0x10b7eb[_0x1b09('0x1f')]:_0x37673e['offset']+_0x37673e['limit'];var _0xe93ac4;if(_0x214c6b>=_0x311158){_0x214c6b=_0x311158;_0xe93ac4=0xc8;}else{_0xe93ac4=0xce;}_0x11ab46['status'](_0xe93ac4);return _0x11ab46[_0x1b09('0x20')]('Content-Range',_0x646575+'-'+_0x214c6b+'/'+_0x311158)[_0x1b09('0x1b')](_0x10b7eb);}return null;};}function patchUpdates(_0x4b2eab){return function(_0x2d6dba){try{jsonpatch[_0x1b09('0x21')](_0x2d6dba,_0x4b2eab,!![]);}catch(_0x29dd70){return BPromise[_0x1b09('0x22')](_0x29dd70);}return _0x2d6dba[_0x1b09('0x23')]();};}function saveUpdates(_0x39e569,_0x48b803){return function(_0x5e2806){if(_0x5e2806){return _0x5e2806[_0x1b09('0x24')](_0x39e569)[_0x1b09('0x25')](function(_0x4ce7dc){return _0x4ce7dc;});}return null;};}function removeEntity(_0x3c0496,_0x11d0d5){return function(_0x6e132c){if(_0x6e132c){return _0x6e132c[_0x1b09('0x26')]()['then'](function(){_0x3c0496[_0x1b09('0x19')](0xcc)[_0x1b09('0x1a')]();});}};}function handleEntityNotFound(_0x4936d0,_0x2d3b86){return function(_0x472d30){if(!_0x472d30){_0x4936d0['sendStatus'](0x194);}return _0x472d30;};}function handleError(_0x13c89c,_0x108d80){_0x108d80=_0x108d80||0x1f4;return function(_0xa71272){logger[_0x1b09('0x27')](_0xa71272['stack']);if(_0xa71272[_0x1b09('0x28')]){delete _0xa71272[_0x1b09('0x28')];}_0x13c89c['status'](_0x108d80)[_0x1b09('0x29')](_0xa71272);};}exports[_0x1b09('0x2a')]=function(_0x26befb,_0x1cbbd5){var _0x11098e={},_0x1aa179={},_0x34620f={'count':0x0,'rows':[]};var _0x5a503d=_[_0x1b09('0x2b')](db[_0x1b09('0x2c')]['rawAttributes'],function(_0x34d912){return{'name':_0x34d912[_0x1b09('0x2d')],'type':_0x34d912[_0x1b09('0x2e')][_0x1b09('0x2f')]};});_0x1aa179[_0x1b09('0x30')]=_['map'](_0x5a503d,_0x1b09('0x28'));_0x1aa179['query']=_[_0x1b09('0x31')](_0x26befb['query']);_0x1aa179[_0x1b09('0x32')]=_[_0x1b09('0x33')](_0x1aa179[_0x1b09('0x30')],_0x1aa179[_0x1b09('0x34')]);_0x11098e[_0x1b09('0x35')]=_[_0x1b09('0x33')](_0x1aa179[_0x1b09('0x30')],qs[_0x1b09('0x36')](_0x26befb[_0x1b09('0x34')][_0x1b09('0x36')]));_0x11098e['attributes']=_0x11098e[_0x1b09('0x35')][_0x1b09('0x37')]?_0x11098e[_0x1b09('0x35')]:_0x1aa179['model'];if(!_0x26befb[_0x1b09('0x34')][_0x1b09('0x38')](_0x1b09('0x39'))){_0x11098e[_0x1b09('0x1e')]=qs[_0x1b09('0x1e')](_0x26befb[_0x1b09('0x34')][_0x1b09('0x1e')]);_0x11098e[_0x1b09('0x1c')]=qs['offset'](_0x26befb[_0x1b09('0x34')]['offset']);}_0x11098e[_0x1b09('0x3a')]=qs['sort'](_0x26befb[_0x1b09('0x34')][_0x1b09('0x3b')]);_0x11098e[_0x1b09('0x3c')]=qs[_0x1b09('0x32')](_[_0x1b09('0x3d')](_0x26befb[_0x1b09('0x34')],_0x1aa179[_0x1b09('0x32')]),_0x5a503d);if(_0x26befb[_0x1b09('0x34')][_0x1b09('0x3e')]){_0x11098e[_0x1b09('0x3c')]=_[_0x1b09('0x3f')](_0x11098e[_0x1b09('0x3c')],{'$or':_[_0x1b09('0x2b')](_0x5a503d,function(_0x4bd6fa){if(_0x4bd6fa['type']!==_0x1b09('0x40')){var _0xb2ef05={};_0xb2ef05[_0x4bd6fa[_0x1b09('0x28')]]={'$like':'%'+_0x26befb[_0x1b09('0x34')][_0x1b09('0x3e')]+'%'};return _0xb2ef05;}})});}_0x11098e=_[_0x1b09('0x3f')]({},_0x11098e,_0x26befb[_0x1b09('0x41')]);var _0x33d697={'where':_0x11098e['where']};return db['ChatQueueReport'][_0x1b09('0x1f')](_0x33d697)['then'](function(_0x966873){_0x34620f[_0x1b09('0x1f')]=_0x966873;if(_0x26befb[_0x1b09('0x34')]['includeAll']){_0x11098e[_0x1b09('0x42')]=[{'all':!![]}];}return db[_0x1b09('0x2c')][_0x1b09('0x43')](_0x11098e);})['then'](function(_0x3edcde){_0x34620f[_0x1b09('0x44')]=_0x3edcde;return _0x34620f;})[_0x1b09('0x25')](respondWithFilteredResult(_0x1cbbd5,_0x11098e))[_0x1b09('0x45')](handleError(_0x1cbbd5,null));};exports['show']=function(_0x36f814,_0x2b2341){var _0x4c0559={'raw':!![],'where':{'id':_0x36f814[_0x1b09('0x46')]['id']}},_0x1c7ec6={};_0x1c7ec6['model']=_['keys'](db['ChatQueueReport']['rawAttributes']);_0x1c7ec6[_0x1b09('0x34')]=_[_0x1b09('0x31')](_0x36f814[_0x1b09('0x34')]);_0x1c7ec6['filters']=_[_0x1b09('0x33')](_0x1c7ec6[_0x1b09('0x30')],_0x1c7ec6['query']);_0x4c0559[_0x1b09('0x35')]=_[_0x1b09('0x33')](_0x1c7ec6[_0x1b09('0x30')],qs[_0x1b09('0x36')](_0x36f814[_0x1b09('0x34')][_0x1b09('0x36')]));_0x4c0559[_0x1b09('0x35')]=_0x4c0559[_0x1b09('0x35')][_0x1b09('0x37')]?_0x4c0559[_0x1b09('0x35')]:_0x1c7ec6['model'];if(_0x36f814[_0x1b09('0x34')][_0x1b09('0x47')]){_0x4c0559[_0x1b09('0x42')]=[{'all':!![]}];}_0x4c0559=_['merge']({},_0x4c0559,_0x36f814[_0x1b09('0x41')]);return db['ChatQueueReport'][_0x1b09('0x48')](_0x4c0559)[_0x1b09('0x25')](handleEntityNotFound(_0x2b2341,null))['then'](respondWithResult(_0x2b2341,null))[_0x1b09('0x45')](handleError(_0x2b2341,null));};exports[_0x1b09('0x49')]=function(_0x3732fb,_0x25443a){return db[_0x1b09('0x2c')][_0x1b09('0x49')](_0x3732fb['body'],{})[_0x1b09('0x25')](respondWithResult(_0x25443a,0xc9))['catch'](handleError(_0x25443a,null));};exports[_0x1b09('0x24')]=function(_0x58a158,_0x50a66c){if(_0x58a158[_0x1b09('0x4a')]['id']){delete _0x58a158[_0x1b09('0x4a')]['id'];}return db[_0x1b09('0x2c')][_0x1b09('0x48')]({'where':{'id':_0x58a158[_0x1b09('0x46')]['id']}})[_0x1b09('0x25')](handleEntityNotFound(_0x50a66c,null))[_0x1b09('0x25')](saveUpdates(_0x58a158[_0x1b09('0x4a')],null))['then'](respondWithResult(_0x50a66c,null))[_0x1b09('0x45')](handleError(_0x50a66c,null));};exports[_0x1b09('0x26')]=function(_0x21b4c2,_0x481147){return db['ChatQueueReport'][_0x1b09('0x48')]({'where':{'id':_0x21b4c2['params']['id']}})[_0x1b09('0x25')](handleEntityNotFound(_0x481147,null))[_0x1b09('0x25')](removeEntity(_0x481147,null))['catch'](handleError(_0x481147,null));};exports[_0x1b09('0x4b')]=function(_0x6f4589,_0x5941df){return db[_0x1b09('0x2c')][_0x1b09('0x4b')]()[_0x1b09('0x25')](respondWithResult(_0x5941df,null))[_0x1b09('0x45')](handleError(_0x5941df,null));}; \ No newline at end of file +var _0x2e88=['moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','end','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3da46a,_0x580acc){var _0x100234=function(_0x989694){while(--_0x989694){_0x3da46a['push'](_0x3da46a['shift']());}};_0x100234(++_0x580acc);}(_0x2e88,0x95));var _0x82e8=function(_0x38841c,_0x1af0bf){_0x38841c=_0x38841c-0x0;var _0x500610=_0x2e88[_0x38841c];return _0x500610;};'use strict';var emlformat=require(_0x82e8('0x0'));var rimraf=require(_0x82e8('0x1'));var zipdir=require(_0x82e8('0x2'));var jsonpatch=require(_0x82e8('0x3'));var rp=require(_0x82e8('0x4'));var moment=require(_0x82e8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x82e8('0x6'));var util=require(_0x82e8('0x7'));var path=require('path');var sox=require(_0x82e8('0x8'));var csv=require(_0x82e8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82e8('0xa'));var _=require(_0x82e8('0xb'));var squel=require(_0x82e8('0xc'));var crypto=require(_0x82e8('0xd'));var jsforce=require(_0x82e8('0xe'));var deskjs=require(_0x82e8('0xf'));var toCsv=require(_0x82e8('0x9'));var querystring=require(_0x82e8('0x10'));var Papa=require(_0x82e8('0x11'));var Redis=require(_0x82e8('0x12'));var authService=require(_0x82e8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x82e8('0x14'));var hardwareService=require(_0x82e8('0x15'));var logger=require(_0x82e8('0x16'))(_0x82e8('0x17'));var utils=require(_0x82e8('0x18'));var config=require(_0x82e8('0x19'));var licenseUtil=require(_0x82e8('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x253a36,_0xdf1b65){_0xdf1b65=_0xdf1b65||0xcc;return function(_0xb6d94a){if(_0xb6d94a){return _0x253a36[_0x82e8('0x1b')](_0xdf1b65);}return _0x253a36[_0x82e8('0x1c')](_0xdf1b65)['end']();};}function respondWithResult(_0x3353e0,_0x2c9569){_0x2c9569=_0x2c9569||0xc8;return function(_0xad6055){if(_0xad6055){return _0x3353e0[_0x82e8('0x1c')](_0x2c9569)['json'](_0xad6055);}};}function respondWithFilteredResult(_0x25b60e,_0x461744){return function(_0x3253d2){if(_0x3253d2){var _0xf53214=typeof _0x461744[_0x82e8('0x1d')]==='undefined'&&typeof _0x461744[_0x82e8('0x1e')]===_0x82e8('0x1f');var _0x574ba2=_0x3253d2[_0x82e8('0x20')];var _0xf287da=_0xf53214?0x0:_0x461744[_0x82e8('0x1d')];var _0x380f44=_0xf53214?_0x3253d2[_0x82e8('0x20')]:_0x461744[_0x82e8('0x1d')]+_0x461744[_0x82e8('0x1e')];var _0x5d7986;if(_0x380f44>=_0x574ba2){_0x380f44=_0x574ba2;_0x5d7986=0xc8;}else{_0x5d7986=0xce;}_0x25b60e[_0x82e8('0x1c')](_0x5d7986);return _0x25b60e[_0x82e8('0x21')](_0x82e8('0x22'),_0xf287da+'-'+_0x380f44+'/'+_0x574ba2)[_0x82e8('0x23')](_0x3253d2);}return null;};}function patchUpdates(_0xbfecf2){return function(_0x5db337){try{jsonpatch[_0x82e8('0x24')](_0x5db337,_0xbfecf2,!![]);}catch(_0x497c48){return BPromise[_0x82e8('0x25')](_0x497c48);}return _0x5db337[_0x82e8('0x26')]();};}function saveUpdates(_0x1475cf,_0x3ab5a2){return function(_0x198c3d){if(_0x198c3d){return _0x198c3d[_0x82e8('0x27')](_0x1475cf)[_0x82e8('0x28')](function(_0x591583){return _0x591583;});}return null;};}function removeEntity(_0x2b82eb,_0x57cc9c){return function(_0x4de0d2){if(_0x4de0d2){return _0x4de0d2['destroy']()[_0x82e8('0x28')](function(){_0x2b82eb['status'](0xcc)[_0x82e8('0x29')]();});}};}function handleEntityNotFound(_0x305710,_0xeff996){return function(_0x488b06){if(!_0x488b06){_0x305710[_0x82e8('0x1b')](0x194);}return _0x488b06;};}function handleError(_0x476602,_0x336015){_0x336015=_0x336015||0x1f4;return function(_0x2400c5){logger[_0x82e8('0x2a')](_0x2400c5['stack']);if(_0x2400c5['name']){delete _0x2400c5[_0x82e8('0x2b')];}_0x476602[_0x82e8('0x1c')](_0x336015)[_0x82e8('0x2c')](_0x2400c5);};}exports[_0x82e8('0x2d')]=function(_0x1c2160,_0x4756ac){var _0x14450e={},_0x1e9eee={},_0x1c2173={'count':0x0,'rows':[]};var _0xf52391=_[_0x82e8('0x2e')](db[_0x82e8('0x2f')][_0x82e8('0x30')],function(_0x4902af){return{'name':_0x4902af[_0x82e8('0x31')],'type':_0x4902af[_0x82e8('0x32')][_0x82e8('0x33')]};});_0x1e9eee[_0x82e8('0x34')]=_[_0x82e8('0x2e')](_0xf52391,_0x82e8('0x2b'));_0x1e9eee[_0x82e8('0x35')]=_[_0x82e8('0x36')](_0x1c2160[_0x82e8('0x35')]);_0x1e9eee[_0x82e8('0x37')]=_[_0x82e8('0x38')](_0x1e9eee['model'],_0x1e9eee[_0x82e8('0x35')]);_0x14450e[_0x82e8('0x39')]=_[_0x82e8('0x38')](_0x1e9eee[_0x82e8('0x34')],qs[_0x82e8('0x3a')](_0x1c2160[_0x82e8('0x35')][_0x82e8('0x3a')]));_0x14450e[_0x82e8('0x39')]=_0x14450e['attributes'][_0x82e8('0x3b')]?_0x14450e['attributes']:_0x1e9eee[_0x82e8('0x34')];if(!_0x1c2160[_0x82e8('0x35')]['hasOwnProperty']('nolimit')){_0x14450e[_0x82e8('0x1e')]=qs['limit'](_0x1c2160[_0x82e8('0x35')][_0x82e8('0x1e')]);_0x14450e[_0x82e8('0x1d')]=qs[_0x82e8('0x1d')](_0x1c2160[_0x82e8('0x35')][_0x82e8('0x1d')]);}_0x14450e[_0x82e8('0x3c')]=qs[_0x82e8('0x3d')](_0x1c2160[_0x82e8('0x35')][_0x82e8('0x3d')]);_0x14450e[_0x82e8('0x3e')]=qs[_0x82e8('0x37')](_['pick'](_0x1c2160[_0x82e8('0x35')],_0x1e9eee[_0x82e8('0x37')]),_0xf52391);if(_0x1c2160[_0x82e8('0x35')]['filter']){_0x14450e[_0x82e8('0x3e')]=_[_0x82e8('0x3f')](_0x14450e[_0x82e8('0x3e')],{'$or':_[_0x82e8('0x2e')](_0xf52391,function(_0x28e1b2){if(_0x28e1b2[_0x82e8('0x32')]!==_0x82e8('0x40')){var _0x1eceef={};_0x1eceef[_0x28e1b2[_0x82e8('0x2b')]]={'$like':'%'+_0x1c2160[_0x82e8('0x35')][_0x82e8('0x41')]+'%'};return _0x1eceef;}})});}_0x14450e=_['merge']({},_0x14450e,_0x1c2160[_0x82e8('0x42')]);var _0x3f379d={'where':_0x14450e[_0x82e8('0x3e')]};return db[_0x82e8('0x2f')][_0x82e8('0x20')](_0x3f379d)[_0x82e8('0x28')](function(_0x26c6ad){_0x1c2173[_0x82e8('0x20')]=_0x26c6ad;if(_0x1c2160[_0x82e8('0x35')][_0x82e8('0x43')]){_0x14450e[_0x82e8('0x44')]=[{'all':!![]}];}return db[_0x82e8('0x2f')][_0x82e8('0x45')](_0x14450e);})[_0x82e8('0x28')](function(_0x3878af){_0x1c2173['rows']=_0x3878af;return _0x1c2173;})[_0x82e8('0x28')](respondWithFilteredResult(_0x4756ac,_0x14450e))['catch'](handleError(_0x4756ac,null));};exports[_0x82e8('0x46')]=function(_0x2da19b,_0x8428e1){var _0xc996f7={'raw':!![],'where':{'id':_0x2da19b[_0x82e8('0x47')]['id']}},_0x3ff396={};_0x3ff396['model']=_[_0x82e8('0x36')](db['ChatQueueReport'][_0x82e8('0x30')]);_0x3ff396[_0x82e8('0x35')]=_[_0x82e8('0x36')](_0x2da19b[_0x82e8('0x35')]);_0x3ff396[_0x82e8('0x37')]=_['intersection'](_0x3ff396['model'],_0x3ff396[_0x82e8('0x35')]);_0xc996f7['attributes']=_[_0x82e8('0x38')](_0x3ff396['model'],qs['fields'](_0x2da19b['query']['fields']));_0xc996f7[_0x82e8('0x39')]=_0xc996f7[_0x82e8('0x39')]['length']?_0xc996f7[_0x82e8('0x39')]:_0x3ff396[_0x82e8('0x34')];if(_0x2da19b['query'][_0x82e8('0x43')]){_0xc996f7['include']=[{'all':!![]}];}_0xc996f7=_[_0x82e8('0x3f')]({},_0xc996f7,_0x2da19b[_0x82e8('0x42')]);return db[_0x82e8('0x2f')][_0x82e8('0x48')](_0xc996f7)[_0x82e8('0x28')](handleEntityNotFound(_0x8428e1,null))[_0x82e8('0x28')](respondWithResult(_0x8428e1,null))['catch'](handleError(_0x8428e1,null));};exports[_0x82e8('0x49')]=function(_0x40fcae,_0x33c605){return db[_0x82e8('0x2f')]['create'](_0x40fcae[_0x82e8('0x4a')],{})['then'](respondWithResult(_0x33c605,0xc9))[_0x82e8('0x4b')](handleError(_0x33c605,null));};exports['update']=function(_0x25c206,_0xd3290c){if(_0x25c206[_0x82e8('0x4a')]['id']){delete _0x25c206['body']['id'];}return db[_0x82e8('0x2f')]['find']({'where':{'id':_0x25c206['params']['id']}})[_0x82e8('0x28')](handleEntityNotFound(_0xd3290c,null))[_0x82e8('0x28')](saveUpdates(_0x25c206[_0x82e8('0x4a')],null))['then'](respondWithResult(_0xd3290c,null))[_0x82e8('0x4b')](handleError(_0xd3290c,null));};exports['destroy']=function(_0x5735a2,_0x51710a){return db['ChatQueueReport'][_0x82e8('0x48')]({'where':{'id':_0x5735a2[_0x82e8('0x47')]['id']}})[_0x82e8('0x28')](handleEntityNotFound(_0x51710a,null))[_0x82e8('0x28')](removeEntity(_0x51710a,null))['catch'](handleError(_0x51710a,null));};exports[_0x82e8('0x4c')]=function(_0x7b1c26,_0x17f348){return db[_0x82e8('0x2f')][_0x82e8('0x4c')]()[_0x82e8('0x28')](respondWithResult(_0x17f348,null))['catch'](handleError(_0x17f348,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 5851d30..91c9972 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x51e355,_0x200d69){var _0x3fca78=function(_0x312d18){while(--_0x312d18){_0x51e355['push'](_0x51e355['shift']());}};_0x3fca78(++_0x200d69);}(_0xb7e7,0x121));var _0x7b7e=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xb7e7[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x71a6e0,_0x19ff83){var _0x264938=function(_0x598f5a){while(--_0x598f5a){_0x71a6e0['push'](_0x71a6e0['shift']());}};_0x264938(++_0x19ff83);}(_0xe706,0xa3));var _0x6e70=function(_0x2159e6,_0x55c285){_0x2159e6=_0x2159e6-0x0;var _0x355dbb=_0xe706[_0x2159e6];return _0x355dbb;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 9b63157..dcf6410 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 _0x6a93=['ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','info','catch','UpdateChatQueueReport','update','where','attributes','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x1f453e,_0x2f2569){var _0x390021=function(_0x5b4923){while(--_0x5b4923){_0x1f453e['push'](_0x1f453e['shift']());}};_0x390021(++_0x2f2569);}(_0x6a93,0x188));var _0x36a9=function(_0x438606,_0xde4e68){_0x438606=_0x438606-0x0;var _0x30b7f4=_0x6a93[_0x438606];return _0x30b7f4;};'use strict';var _=require(_0x36a9('0x0'));var util=require('util');var moment=require(_0x36a9('0x1'));var BPromise=require('bluebird');var rs=require(_0x36a9('0x2'));var fs=require('fs');var Redis=require(_0x36a9('0x3'));var db=require(_0x36a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x36a9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x36a9('0x6'));var client=jayson[_0x36a9('0x7')][_0x36a9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8dc654,_0x138e7f,_0x2fd9fb){return new BPromise(function(_0x44ff0b,_0x3bfc28){return client[_0x36a9('0x9')](_0x8dc654,_0x2fd9fb)[_0x36a9('0xa')](function(_0x4d4afb){logger['info'](_0x36a9('0xb'),_0x138e7f,_0x36a9('0xc'));logger[_0x36a9('0xd')](_0x36a9('0xe'),_0x138e7f,_0x36a9('0xc'),JSON[_0x36a9('0xf')](_0x4d4afb));if(_0x4d4afb['error']){if(_0x4d4afb[_0x36a9('0x10')][_0x36a9('0x11')]===0x1f4){logger[_0x36a9('0x10')](_0x36a9('0xb'),_0x138e7f,_0x4d4afb[_0x36a9('0x10')][_0x36a9('0x12')]);return _0x3bfc28(_0x4d4afb[_0x36a9('0x10')][_0x36a9('0x12')]);}logger[_0x36a9('0x10')](_0x36a9('0xb'),_0x138e7f,_0x4d4afb[_0x36a9('0x10')]['message']);return _0x44ff0b(_0x4d4afb['error'][_0x36a9('0x12')]);}else{logger['info'](_0x36a9('0xb'),_0x138e7f,_0x36a9('0xc'));_0x44ff0b(_0x4d4afb['result'][_0x36a9('0x12')]);}})['catch'](function(_0x126e2a){logger[_0x36a9('0x10')](_0x36a9('0xb'),_0x138e7f,_0x126e2a);_0x3bfc28(_0x126e2a);});});}exports[_0x36a9('0x13')]=function(_0x180f4c){var _0x369052=this;return new Promise(function(_0x5b0cd9,_0xbc0786){return db[_0x36a9('0x14')][_0x36a9('0x15')](_0x180f4c[_0x36a9('0x16')],{'raw':_0x180f4c[_0x36a9('0x17')]?_0x180f4c[_0x36a9('0x17')][_0x36a9('0x18')]===undefined?!![]:![]:!![]})[_0x36a9('0xa')](function(_0x8ddc07){logger[_0x36a9('0x19')](_0x36a9('0x13'),_0x180f4c);logger[_0x36a9('0xd')](_0x36a9('0x13'),_0x180f4c,JSON[_0x36a9('0xf')](_0x8ddc07));_0x5b0cd9(_0x8ddc07);})[_0x36a9('0x1a')](function(_0x28c214){logger[_0x36a9('0x10')](_0x36a9('0x13'),_0x28c214[_0x36a9('0x12')],_0x180f4c);_0xbc0786(_0x369052[_0x36a9('0x10')](0x1f4,_0x28c214['message']));});});};exports[_0x36a9('0x1b')]=function(_0x182312){var _0x3aea19=this;return new Promise(function(_0x14719f,_0x31034e){return db['ChatQueueReport'][_0x36a9('0x1c')](_0x182312[_0x36a9('0x16')],{'raw':_0x182312[_0x36a9('0x17')]?_0x182312['options'][_0x36a9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x182312[_0x36a9('0x17')]?_0x182312[_0x36a9('0x17')][_0x36a9('0x1d')]||null:null,'attributes':_0x182312[_0x36a9('0x17')]?_0x182312[_0x36a9('0x17')][_0x36a9('0x1e')]||null:null,'limit':_0x182312[_0x36a9('0x17')]?_0x182312[_0x36a9('0x17')]['limit']||null:null})[_0x36a9('0xa')](function(_0x484649){logger[_0x36a9('0x19')](_0x36a9('0x1b'),_0x182312);logger[_0x36a9('0xd')](_0x36a9('0x1b'),_0x182312,JSON[_0x36a9('0xf')](_0x484649));_0x14719f(_0x484649);})['catch'](function(_0x5f5dd4){logger[_0x36a9('0x10')](_0x36a9('0x1b'),_0x5f5dd4[_0x36a9('0x12')],_0x182312);_0x31034e(_0x3aea19[_0x36a9('0x10')](0x1f4,_0x5f5dd4[_0x36a9('0x12')]));});});}; \ No newline at end of file +var _0x45de=['UpdateChatQueueReport','update','attributes','limit','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','debug','catch'];(function(_0x11611e,_0x595b41){var _0x1a3024=function(_0x283c07){while(--_0x283c07){_0x11611e['push'](_0x11611e['shift']());}};_0x1a3024(++_0x595b41);}(_0x45de,0xe4));var _0xe45d=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x45de[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe45d('0x0'));var rs=require(_0xe45d('0x1'));var fs=require('fs');var Redis=require(_0xe45d('0x2'));var db=require(_0xe45d('0x3'))['db'];var utils=require(_0xe45d('0x4'));var logger=require(_0xe45d('0x5'))(_0xe45d('0x6'));var config=require(_0xe45d('0x7'));var jayson=require(_0xe45d('0x8'));var client=jayson[_0xe45d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26bff8,_0x2c19c5,_0x44d1f5){return new BPromise(function(_0x2e4d06,_0x464318){return client[_0xe45d('0xa')](_0x26bff8,_0x44d1f5)[_0xe45d('0xb')](function(_0x29455b){logger[_0xe45d('0xc')](_0xe45d('0xd'),_0x2c19c5,_0xe45d('0xe'));logger['debug'](_0xe45d('0xf'),_0x2c19c5,_0xe45d('0xe'),JSON[_0xe45d('0x10')](_0x29455b));if(_0x29455b[_0xe45d('0x11')]){if(_0x29455b[_0xe45d('0x11')][_0xe45d('0x12')]===0x1f4){logger['error'](_0xe45d('0xd'),_0x2c19c5,_0x29455b['error'][_0xe45d('0x13')]);return _0x464318(_0x29455b['error'][_0xe45d('0x13')]);}logger['error'](_0xe45d('0xd'),_0x2c19c5,_0x29455b['error'][_0xe45d('0x13')]);return _0x2e4d06(_0x29455b[_0xe45d('0x11')]['message']);}else{logger[_0xe45d('0xc')](_0xe45d('0xd'),_0x2c19c5,'request\x20sent');_0x2e4d06(_0x29455b[_0xe45d('0x14')][_0xe45d('0x13')]);}})['catch'](function(_0x35c5b6){logger['error'](_0xe45d('0xd'),_0x2c19c5,_0x35c5b6);_0x464318(_0x35c5b6);});});}exports[_0xe45d('0x15')]=function(_0x4daba3){var _0x43682e=this;return new Promise(function(_0x4e6c3b,_0x5aa419){return db[_0xe45d('0x16')][_0xe45d('0x17')](_0x4daba3[_0xe45d('0x18')],{'raw':_0x4daba3[_0xe45d('0x19')]?_0x4daba3['options']['raw']===undefined?!![]:![]:!![]})[_0xe45d('0xb')](function(_0x5cfa6b){logger[_0xe45d('0xc')]('CreateChatQueueReport',_0x4daba3);logger[_0xe45d('0x1a')]('CreateChatQueueReport',_0x4daba3,JSON[_0xe45d('0x10')](_0x5cfa6b));_0x4e6c3b(_0x5cfa6b);})[_0xe45d('0x1b')](function(_0x548011){logger[_0xe45d('0x11')]('CreateChatQueueReport',_0x548011[_0xe45d('0x13')],_0x4daba3);_0x5aa419(_0x43682e['error'](0x1f4,_0x548011[_0xe45d('0x13')]));});});};exports[_0xe45d('0x1c')]=function(_0x301da4){var _0x387de6=this;return new Promise(function(_0x1246b7,_0x375e52){return db[_0xe45d('0x16')][_0xe45d('0x1d')](_0x301da4[_0xe45d('0x18')],{'raw':_0x301da4[_0xe45d('0x19')]?_0x301da4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x301da4[_0xe45d('0x19')]?_0x301da4[_0xe45d('0x19')]['where']||null:null,'attributes':_0x301da4[_0xe45d('0x19')]?_0x301da4['options'][_0xe45d('0x1e')]||null:null,'limit':_0x301da4[_0xe45d('0x19')]?_0x301da4['options'][_0xe45d('0x1f')]||null:null})[_0xe45d('0xb')](function(_0x3daed9){logger['info'](_0xe45d('0x1c'),_0x301da4);logger['debug'](_0xe45d('0x1c'),_0x301da4,JSON[_0xe45d('0x10')](_0x3daed9));_0x1246b7(_0x3daed9);})[_0xe45d('0x1b')](function(_0x25d572){logger[_0xe45d('0x11')]('UpdateChatQueueReport',_0x25d572['message'],_0x301da4);_0x375e52(_0x387de6[_0xe45d('0x11')](0x1f4,_0x25d572[_0xe45d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index eccf242..b831472 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 _0xcfc8=['show','post','create','put','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','isAuthenticated','index','get','/:id'];(function(_0x47cec8,_0x212c8f){var _0x4bacd0=function(_0x56ceb5){while(--_0x56ceb5){_0x47cec8['push'](_0x47cec8['shift']());}};_0x4bacd0(++_0x212c8f);}(_0xcfc8,0xd2));var _0x8cfc=function(_0xcf4efc,_0x4a8dcd){_0xcf4efc=_0xcf4efc-0x0;var _0x572ba0=_0xcfc8[_0xcf4efc];return _0x572ba0;};'use strict';var multer=require('multer');var util=require(_0x8cfc('0x0'));var path=require('path');var timeout=require(_0x8cfc('0x1'));var express=require(_0x8cfc('0x2'));var router=express['Router']();var fs_extra=require(_0x8cfc('0x3'));var auth=require(_0x8cfc('0x4'));var interaction=require(_0x8cfc('0x5'));var config=require('../../config/environment');var controller=require(_0x8cfc('0x6'));router['get']('/',auth[_0x8cfc('0x7')](),controller[_0x8cfc('0x8')]);router[_0x8cfc('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x8cfc('0x9')](_0x8cfc('0xa'),auth[_0x8cfc('0x7')](),controller[_0x8cfc('0xb')]);router[_0x8cfc('0xc')]('/',auth['isAuthenticated'](),controller[_0x8cfc('0xd')]);router[_0x8cfc('0xe')](_0x8cfc('0xa'),auth[_0x8cfc('0x7')](),controller['update']);router[_0x8cfc('0xf')](_0x8cfc('0xa'),auth[_0x8cfc('0x7')](),controller['destroy']);module[_0x8cfc('0x10')]=router; \ No newline at end of file +var _0xb47d=['post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','get','/describe','describe'];(function(_0x36f1af,_0x520b1b){var _0x5a250b=function(_0x3226a0){while(--_0x3226a0){_0x36f1af['push'](_0x36f1af['shift']());}};_0x5a250b(++_0x520b1b);}(_0xb47d,0x1e7));var _0xdb47=function(_0xd2543c,_0x4ae4d5){_0xd2543c=_0xd2543c-0x0;var _0x5e2e4c=_0xb47d[_0xd2543c];return _0x5e2e4c;};'use strict';var multer=require(_0xdb47('0x0'));var util=require(_0xdb47('0x1'));var path=require(_0xdb47('0x2'));var timeout=require(_0xdb47('0x3'));var express=require('express');var router=express[_0xdb47('0x4')]();var fs_extra=require(_0xdb47('0x5'));var auth=require(_0xdb47('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdb47('0x7'));var controller=require(_0xdb47('0x8'));router['get']('/',auth[_0xdb47('0x9')](),controller['index']);router[_0xdb47('0xa')](_0xdb47('0xb'),auth['isAuthenticated'](),controller[_0xdb47('0xc')]);router[_0xdb47('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xdb47('0xd')]('/',auth[_0xdb47('0x9')](),controller[_0xdb47('0xe')]);router[_0xdb47('0xf')](_0xdb47('0x10'),auth['isAuthenticated'](),controller[_0xdb47('0x11')]);router[_0xdb47('0x12')](_0xdb47('0x10'),auth[_0xdb47('0x9')](),controller['destroy']);module[_0xdb47('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 810680c..582f0d7 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3d28a3,_0x50f384){var _0x25a3cf=function(_0x3de552){while(--_0x3de552){_0x3d28a3['push'](_0x3d28a3['shift']());}};_0x25a3cf(++_0x50f384);}(_0xaa88,0x137));var _0x8aa8=function(_0x5e1b91,_0x236f17){_0x5e1b91=_0x5e1b91-0x0;var _0x59b52f=_0xaa88[_0x5e1b91];return _0x59b52f;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x198b39,_0xf4a35d){var _0x5ec5bd=function(_0x5b73db){while(--_0x5b73db){_0x198b39['push'](_0x198b39['shift']());}};_0x5ec5bd(++_0xf4a35d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x685346,_0x3ef2e5){_0x685346=_0x685346-0x0;var _0x52e15b=_0xcb91[_0x685346];return _0x52e15b;};'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 diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 487ba8b..c340aea 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 _0x4774=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','update','body','destroy','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','error','name','send','map','ChatTransferReport','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty'];(function(_0x4e1c8d,_0x2157df){var _0x532bb6=function(_0x4c5f2c){while(--_0x4c5f2c){_0x4e1c8d['push'](_0x4e1c8d['shift']());}};_0x532bb6(++_0x2157df);}(_0x4774,0x1e7));var _0x4477=function(_0x535b83,_0x5c4696){_0x535b83=_0x535b83-0x0;var _0x52a7ff=_0x4774[_0x535b83];return _0x52a7ff;};'use strict';var emlformat=require(_0x4477('0x0'));var rimraf=require(_0x4477('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4477('0x2'));var moment=require('moment');var BPromise=require(_0x4477('0x3'));var Mustache=require(_0x4477('0x4'));var util=require(_0x4477('0x5'));var path=require(_0x4477('0x6'));var sox=require(_0x4477('0x7'));var csv=require('to-csv');var ejs=require(_0x4477('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4477('0x9'));var squel=require(_0x4477('0xa'));var crypto=require(_0x4477('0xb'));var jsforce=require(_0x4477('0xc'));var deskjs=require(_0x4477('0xd'));var toCsv=require(_0x4477('0xe'));var querystring=require(_0x4477('0xf'));var Papa=require(_0x4477('0x10'));var Redis=require(_0x4477('0x11'));var authService=require(_0x4477('0x12'));var qs=require(_0x4477('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4477('0x14'));var logger=require(_0x4477('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4477('0x16'));var licenseUtil=require(_0x4477('0x17'));var db=require(_0x4477('0x18'))['db'];function respondWithStatusCode(_0x1c3118,_0x397ba4){_0x397ba4=_0x397ba4||0xcc;return function(_0x5af841){if(_0x5af841){return _0x1c3118[_0x4477('0x19')](_0x397ba4);}return _0x1c3118['status'](_0x397ba4)['end']();};}function respondWithResult(_0x198712,_0x98cb66){_0x98cb66=_0x98cb66||0xc8;return function(_0x730ec4){if(_0x730ec4){return _0x198712[_0x4477('0x1a')](_0x98cb66)[_0x4477('0x1b')](_0x730ec4);}};}function respondWithFilteredResult(_0x4d37bc,_0x43132b){return function(_0x4d6133){if(_0x4d6133){var _0x25fafc=typeof _0x43132b['offset']===_0x4477('0x1c')&&typeof _0x43132b[_0x4477('0x1d')]===_0x4477('0x1c');var _0x4ade8d=_0x4d6133[_0x4477('0x1e')];var _0x3be50a=_0x25fafc?0x0:_0x43132b[_0x4477('0x1f')];var _0x388e5e=_0x25fafc?_0x4d6133[_0x4477('0x1e')]:_0x43132b[_0x4477('0x1f')]+_0x43132b[_0x4477('0x1d')];var _0x526560;if(_0x388e5e>=_0x4ade8d){_0x388e5e=_0x4ade8d;_0x526560=0xc8;}else{_0x526560=0xce;}_0x4d37bc[_0x4477('0x1a')](_0x526560);return _0x4d37bc[_0x4477('0x20')](_0x4477('0x21'),_0x3be50a+'-'+_0x388e5e+'/'+_0x4ade8d)[_0x4477('0x1b')](_0x4d6133);}return null;};}function patchUpdates(_0x568727){return function(_0x29b64f){try{jsonpatch['apply'](_0x29b64f,_0x568727,!![]);}catch(_0x3ec625){return BPromise[_0x4477('0x22')](_0x3ec625);}return _0x29b64f[_0x4477('0x23')]();};}function saveUpdates(_0x479e73,_0x158b43){return function(_0x497a49){if(_0x497a49){return _0x497a49['update'](_0x479e73)['then'](function(_0x1f889e){return _0x1f889e;});}return null;};}function removeEntity(_0x2b10c8,_0x58ce27){return function(_0x5c40e4){if(_0x5c40e4){return _0x5c40e4['destroy']()[_0x4477('0x24')](function(){_0x2b10c8[_0x4477('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b74ab,_0x1b230c){return function(_0x57b739){if(!_0x57b739){_0x4b74ab[_0x4477('0x19')](0x194);}return _0x57b739;};}function handleError(_0x43ed69,_0x5b4fd7){_0x5b4fd7=_0x5b4fd7||0x1f4;return function(_0x50301d){logger[_0x4477('0x25')](_0x50301d['stack']);if(_0x50301d['name']){delete _0x50301d[_0x4477('0x26')];}_0x43ed69[_0x4477('0x1a')](_0x5b4fd7)[_0x4477('0x27')](_0x50301d);};}exports['index']=function(_0x1795d1,_0x306cd9){var _0x2bd4ce={},_0xcb25a7={},_0x300a2d={'count':0x0,'rows':[]};var _0x3ec427=_[_0x4477('0x28')](db[_0x4477('0x29')]['rawAttributes'],function(_0x156383){return{'name':_0x156383[_0x4477('0x2a')],'type':_0x156383[_0x4477('0x2b')][_0x4477('0x2c')]};});_0xcb25a7['model']=_[_0x4477('0x28')](_0x3ec427,_0x4477('0x26'));_0xcb25a7[_0x4477('0x2d')]=_['keys'](_0x1795d1[_0x4477('0x2d')]);_0xcb25a7[_0x4477('0x2e')]=_[_0x4477('0x2f')](_0xcb25a7[_0x4477('0x30')],_0xcb25a7[_0x4477('0x2d')]);_0x2bd4ce[_0x4477('0x31')]=_['intersection'](_0xcb25a7['model'],qs[_0x4477('0x32')](_0x1795d1[_0x4477('0x2d')][_0x4477('0x32')]));_0x2bd4ce[_0x4477('0x31')]=_0x2bd4ce['attributes']['length']?_0x2bd4ce[_0x4477('0x31')]:_0xcb25a7[_0x4477('0x30')];if(!_0x1795d1[_0x4477('0x2d')][_0x4477('0x33')](_0x4477('0x34'))){_0x2bd4ce[_0x4477('0x1d')]=qs['limit'](_0x1795d1[_0x4477('0x2d')][_0x4477('0x1d')]);_0x2bd4ce['offset']=qs[_0x4477('0x1f')](_0x1795d1['query'][_0x4477('0x1f')]);}_0x2bd4ce[_0x4477('0x35')]=qs[_0x4477('0x36')](_0x1795d1[_0x4477('0x2d')][_0x4477('0x36')]);_0x2bd4ce[_0x4477('0x37')]=qs['filters'](_[_0x4477('0x38')](_0x1795d1[_0x4477('0x2d')],_0xcb25a7['filters']),_0x3ec427);if(_0x1795d1[_0x4477('0x2d')][_0x4477('0x39')]){_0x2bd4ce[_0x4477('0x37')]=_[_0x4477('0x3a')](_0x2bd4ce['where'],{'$or':_['map'](_0x3ec427,function(_0xed7a00){if(_0xed7a00[_0x4477('0x2b')]!==_0x4477('0x3b')){var _0x38576e={};_0x38576e[_0xed7a00['name']]={'$like':'%'+_0x1795d1[_0x4477('0x2d')]['filter']+'%'};return _0x38576e;}})});}_0x2bd4ce=_[_0x4477('0x3a')]({},_0x2bd4ce,_0x1795d1[_0x4477('0x3c')]);var _0x416984={'where':_0x2bd4ce[_0x4477('0x37')]};return db[_0x4477('0x29')][_0x4477('0x1e')](_0x416984)[_0x4477('0x24')](function(_0x7bdd4f){_0x300a2d[_0x4477('0x1e')]=_0x7bdd4f;if(_0x1795d1[_0x4477('0x2d')][_0x4477('0x3d')]){_0x2bd4ce[_0x4477('0x3e')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x4477('0x3f')](_0x2bd4ce);})[_0x4477('0x24')](function(_0x9c3fa4){_0x300a2d[_0x4477('0x40')]=_0x9c3fa4;return _0x300a2d;})[_0x4477('0x24')](respondWithFilteredResult(_0x306cd9,_0x2bd4ce))[_0x4477('0x41')](handleError(_0x306cd9,null));};exports[_0x4477('0x42')]=function(_0x47104d,_0x42bdf6){var _0x3e304f={'raw':!![],'where':{'id':_0x47104d[_0x4477('0x43')]['id']}},_0x393e91={};_0x393e91[_0x4477('0x30')]=_[_0x4477('0x44')](db[_0x4477('0x29')][_0x4477('0x45')]);_0x393e91[_0x4477('0x2d')]=_['keys'](_0x47104d[_0x4477('0x2d')]);_0x393e91[_0x4477('0x2e')]=_['intersection'](_0x393e91[_0x4477('0x30')],_0x393e91[_0x4477('0x2d')]);_0x3e304f[_0x4477('0x31')]=_['intersection'](_0x393e91['model'],qs[_0x4477('0x32')](_0x47104d[_0x4477('0x2d')]['fields']));_0x3e304f[_0x4477('0x31')]=_0x3e304f[_0x4477('0x31')][_0x4477('0x46')]?_0x3e304f[_0x4477('0x31')]:_0x393e91['model'];if(_0x47104d[_0x4477('0x2d')][_0x4477('0x3d')]){_0x3e304f[_0x4477('0x3e')]=[{'all':!![]}];}_0x3e304f=_[_0x4477('0x3a')]({},_0x3e304f,_0x47104d[_0x4477('0x3c')]);return db[_0x4477('0x29')][_0x4477('0x47')](_0x3e304f)['then'](handleEntityNotFound(_0x42bdf6,null))[_0x4477('0x24')](respondWithResult(_0x42bdf6,null))[_0x4477('0x41')](handleError(_0x42bdf6,null));};exports['create']=function(_0x20da93,_0x1e021f){return db[_0x4477('0x29')][_0x4477('0x48')](_0x20da93['body'],{})[_0x4477('0x24')](respondWithResult(_0x1e021f,0xc9))[_0x4477('0x41')](handleError(_0x1e021f,null));};exports[_0x4477('0x49')]=function(_0x39ff6a,_0x48dae9){if(_0x39ff6a['body']['id']){delete _0x39ff6a['body']['id'];}return db[_0x4477('0x29')][_0x4477('0x47')]({'where':{'id':_0x39ff6a[_0x4477('0x43')]['id']}})[_0x4477('0x24')](handleEntityNotFound(_0x48dae9,null))[_0x4477('0x24')](saveUpdates(_0x39ff6a[_0x4477('0x4a')],null))['then'](respondWithResult(_0x48dae9,null))[_0x4477('0x41')](handleError(_0x48dae9,null));};exports[_0x4477('0x4b')]=function(_0x2355a5,_0x6a8cd5){return db['ChatTransferReport']['find']({'where':{'id':_0x2355a5[_0x4477('0x43')]['id']}})[_0x4477('0x24')](handleEntityNotFound(_0x6a8cd5,null))[_0x4477('0x24')](removeEntity(_0x6a8cd5,null))[_0x4477('0x41')](handleError(_0x6a8cd5,null));};exports[_0x4477('0x4c')]=function(_0x1b1355,_0x5c3fef){return db[_0x4477('0x29')][_0x4477('0x4c')]()[_0x4477('0x24')](respondWithResult(_0x5c3fef,null))[_0x4477('0x41')](handleError(_0x5c3fef,null));}; \ No newline at end of file +var _0xedc7=['nolimit','order','sort','where','filter','VIRTUAL','merge','options','ChatTransferReport','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length'];(function(_0x3c4206,_0x4dfd90){var _0x16dbaf=function(_0x268f57){while(--_0x268f57){_0x3c4206['push'](_0x3c4206['shift']());}};_0x16dbaf(++_0x4dfd90);}(_0xedc7,0x1f4));var _0x7edc=function(_0x207113,_0x4f0f96){_0x207113=_0x207113-0x0;var _0x1c5789=_0xedc7[_0x207113];return _0x1c5789;};'use strict';var emlformat=require(_0x7edc('0x0'));var rimraf=require(_0x7edc('0x1'));var zipdir=require(_0x7edc('0x2'));var jsonpatch=require(_0x7edc('0x3'));var rp=require(_0x7edc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7edc('0x5'));var path=require(_0x7edc('0x6'));var sox=require(_0x7edc('0x7'));var csv=require('to-csv');var ejs=require(_0x7edc('0x8'));var fs=require('fs');var fs_extra=require(_0x7edc('0x9'));var _=require(_0x7edc('0xa'));var squel=require(_0x7edc('0xb'));var crypto=require(_0x7edc('0xc'));var jsforce=require(_0x7edc('0xd'));var deskjs=require(_0x7edc('0xe'));var toCsv=require(_0x7edc('0xf'));var querystring=require(_0x7edc('0x10'));var Papa=require(_0x7edc('0x11'));var Redis=require(_0x7edc('0x12'));var authService=require(_0x7edc('0x13'));var qs=require(_0x7edc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7edc('0x15'));var logger=require(_0x7edc('0x16'))(_0x7edc('0x17'));var utils=require(_0x7edc('0x18'));var config=require(_0x7edc('0x19'));var licenseUtil=require(_0x7edc('0x1a'));var db=require(_0x7edc('0x1b'))['db'];function respondWithStatusCode(_0x213aa1,_0x302d99){_0x302d99=_0x302d99||0xcc;return function(_0xe73ad6){if(_0xe73ad6){return _0x213aa1['sendStatus'](_0x302d99);}return _0x213aa1[_0x7edc('0x1c')](_0x302d99)[_0x7edc('0x1d')]();};}function respondWithResult(_0x51019e,_0x4a4a96){_0x4a4a96=_0x4a4a96||0xc8;return function(_0xc170f4){if(_0xc170f4){return _0x51019e[_0x7edc('0x1c')](_0x4a4a96)['json'](_0xc170f4);}};}function respondWithFilteredResult(_0x36e7ac,_0x36401a){return function(_0x4643eb){if(_0x4643eb){var _0x559a8e=typeof _0x36401a['offset']===_0x7edc('0x1e')&&typeof _0x36401a[_0x7edc('0x1f')]===_0x7edc('0x1e');var _0x5617e7=_0x4643eb[_0x7edc('0x20')];var _0x339b01=_0x559a8e?0x0:_0x36401a[_0x7edc('0x21')];var _0x4ea1ac=_0x559a8e?_0x4643eb[_0x7edc('0x20')]:_0x36401a['offset']+_0x36401a['limit'];var _0x5d14a9;if(_0x4ea1ac>=_0x5617e7){_0x4ea1ac=_0x5617e7;_0x5d14a9=0xc8;}else{_0x5d14a9=0xce;}_0x36e7ac['status'](_0x5d14a9);return _0x36e7ac[_0x7edc('0x22')]('Content-Range',_0x339b01+'-'+_0x4ea1ac+'/'+_0x5617e7)[_0x7edc('0x23')](_0x4643eb);}return null;};}function patchUpdates(_0x55aa17){return function(_0x173efa){try{jsonpatch[_0x7edc('0x24')](_0x173efa,_0x55aa17,!![]);}catch(_0x192577){return BPromise[_0x7edc('0x25')](_0x192577);}return _0x173efa[_0x7edc('0x26')]();};}function saveUpdates(_0x222d70,_0x2cbc04){return function(_0x37204f){if(_0x37204f){return _0x37204f[_0x7edc('0x27')](_0x222d70)['then'](function(_0xff9454){return _0xff9454;});}return null;};}function removeEntity(_0x199b1f,_0x5844ac){return function(_0x27a018){if(_0x27a018){return _0x27a018[_0x7edc('0x28')]()[_0x7edc('0x29')](function(){_0x199b1f[_0x7edc('0x1c')](0xcc)[_0x7edc('0x1d')]();});}};}function handleEntityNotFound(_0x3165e0,_0x290772){return function(_0x102496){if(!_0x102496){_0x3165e0[_0x7edc('0x2a')](0x194);}return _0x102496;};}function handleError(_0x3f72c5,_0x159226){_0x159226=_0x159226||0x1f4;return function(_0xbe061b){logger[_0x7edc('0x2b')](_0xbe061b[_0x7edc('0x2c')]);if(_0xbe061b['name']){delete _0xbe061b[_0x7edc('0x2d')];}_0x3f72c5[_0x7edc('0x1c')](_0x159226)[_0x7edc('0x2e')](_0xbe061b);};}exports[_0x7edc('0x2f')]=function(_0x5a914f,_0x332f6f){var _0x565dcc={},_0x662e4e={},_0x26779b={'count':0x0,'rows':[]};var _0x18a399=_[_0x7edc('0x30')](db['ChatTransferReport'][_0x7edc('0x31')],function(_0x33a8c1){return{'name':_0x33a8c1[_0x7edc('0x32')],'type':_0x33a8c1[_0x7edc('0x33')][_0x7edc('0x34')]};});_0x662e4e[_0x7edc('0x35')]=_[_0x7edc('0x30')](_0x18a399,_0x7edc('0x2d'));_0x662e4e[_0x7edc('0x36')]=_['keys'](_0x5a914f['query']);_0x662e4e[_0x7edc('0x37')]=_['intersection'](_0x662e4e['model'],_0x662e4e['query']);_0x565dcc[_0x7edc('0x38')]=_[_0x7edc('0x39')](_0x662e4e['model'],qs[_0x7edc('0x3a')](_0x5a914f[_0x7edc('0x36')]['fields']));_0x565dcc[_0x7edc('0x38')]=_0x565dcc[_0x7edc('0x38')][_0x7edc('0x3b')]?_0x565dcc[_0x7edc('0x38')]:_0x662e4e[_0x7edc('0x35')];if(!_0x5a914f[_0x7edc('0x36')]['hasOwnProperty'](_0x7edc('0x3c'))){_0x565dcc['limit']=qs[_0x7edc('0x1f')](_0x5a914f[_0x7edc('0x36')][_0x7edc('0x1f')]);_0x565dcc['offset']=qs[_0x7edc('0x21')](_0x5a914f['query'][_0x7edc('0x21')]);}_0x565dcc[_0x7edc('0x3d')]=qs[_0x7edc('0x3e')](_0x5a914f[_0x7edc('0x36')][_0x7edc('0x3e')]);_0x565dcc[_0x7edc('0x3f')]=qs[_0x7edc('0x37')](_['pick'](_0x5a914f[_0x7edc('0x36')],_0x662e4e[_0x7edc('0x37')]),_0x18a399);if(_0x5a914f['query'][_0x7edc('0x40')]){_0x565dcc[_0x7edc('0x3f')]=_['merge'](_0x565dcc[_0x7edc('0x3f')],{'$or':_[_0x7edc('0x30')](_0x18a399,function(_0x4db29c){if(_0x4db29c[_0x7edc('0x33')]!==_0x7edc('0x41')){var _0x1d3b30={};_0x1d3b30[_0x4db29c[_0x7edc('0x2d')]]={'$like':'%'+_0x5a914f[_0x7edc('0x36')][_0x7edc('0x40')]+'%'};return _0x1d3b30;}})});}_0x565dcc=_[_0x7edc('0x42')]({},_0x565dcc,_0x5a914f[_0x7edc('0x43')]);var _0x2878e3={'where':_0x565dcc[_0x7edc('0x3f')]};return db[_0x7edc('0x44')][_0x7edc('0x20')](_0x2878e3)[_0x7edc('0x29')](function(_0x1e40e8){_0x26779b['count']=_0x1e40e8;if(_0x5a914f[_0x7edc('0x36')][_0x7edc('0x45')]){_0x565dcc[_0x7edc('0x46')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x565dcc);})[_0x7edc('0x29')](function(_0x3bd7ea){_0x26779b[_0x7edc('0x47')]=_0x3bd7ea;return _0x26779b;})[_0x7edc('0x29')](respondWithFilteredResult(_0x332f6f,_0x565dcc))[_0x7edc('0x48')](handleError(_0x332f6f,null));};exports[_0x7edc('0x49')]=function(_0x52ca89,_0xf0473d){var _0x38586a={'raw':!![],'where':{'id':_0x52ca89[_0x7edc('0x4a')]['id']}},_0x21aa27={};_0x21aa27['model']=_['keys'](db[_0x7edc('0x44')]['rawAttributes']);_0x21aa27[_0x7edc('0x36')]=_[_0x7edc('0x4b')](_0x52ca89['query']);_0x21aa27[_0x7edc('0x37')]=_[_0x7edc('0x39')](_0x21aa27[_0x7edc('0x35')],_0x21aa27['query']);_0x38586a[_0x7edc('0x38')]=_[_0x7edc('0x39')](_0x21aa27['model'],qs['fields'](_0x52ca89[_0x7edc('0x36')][_0x7edc('0x3a')]));_0x38586a[_0x7edc('0x38')]=_0x38586a[_0x7edc('0x38')]['length']?_0x38586a[_0x7edc('0x38')]:_0x21aa27[_0x7edc('0x35')];if(_0x52ca89[_0x7edc('0x36')][_0x7edc('0x45')]){_0x38586a[_0x7edc('0x46')]=[{'all':!![]}];}_0x38586a=_[_0x7edc('0x42')]({},_0x38586a,_0x52ca89[_0x7edc('0x43')]);return db[_0x7edc('0x44')][_0x7edc('0x4c')](_0x38586a)[_0x7edc('0x29')](handleEntityNotFound(_0xf0473d,null))['then'](respondWithResult(_0xf0473d,null))['catch'](handleError(_0xf0473d,null));};exports[_0x7edc('0x4d')]=function(_0xbd05f8,_0x3c284d){return db['ChatTransferReport'][_0x7edc('0x4d')](_0xbd05f8[_0x7edc('0x4e')],{})['then'](respondWithResult(_0x3c284d,0xc9))['catch'](handleError(_0x3c284d,null));};exports[_0x7edc('0x27')]=function(_0x489a20,_0x1f0601){if(_0x489a20[_0x7edc('0x4e')]['id']){delete _0x489a20[_0x7edc('0x4e')]['id'];}return db[_0x7edc('0x44')][_0x7edc('0x4c')]({'where':{'id':_0x489a20[_0x7edc('0x4a')]['id']}})[_0x7edc('0x29')](handleEntityNotFound(_0x1f0601,null))[_0x7edc('0x29')](saveUpdates(_0x489a20[_0x7edc('0x4e')],null))[_0x7edc('0x29')](respondWithResult(_0x1f0601,null))[_0x7edc('0x48')](handleError(_0x1f0601,null));};exports[_0x7edc('0x28')]=function(_0xf4956f,_0x441079){return db[_0x7edc('0x44')][_0x7edc('0x4c')]({'where':{'id':_0xf4956f[_0x7edc('0x4a')]['id']}})[_0x7edc('0x29')](handleEntityNotFound(_0x441079,null))[_0x7edc('0x29')](removeEntity(_0x441079,null))[_0x7edc('0x48')](handleError(_0x441079,null));};exports[_0x7edc('0x4f')]=function(_0x2a0da7,_0x12dfae){return db['ChatTransferReport'][_0x7edc('0x4f')]()[_0x7edc('0x29')](respondWithResult(_0x12dfae,null))[_0x7edc('0x48')](handleError(_0x12dfae,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 73d54ec..bde8792 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 _0x8385=['request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x28d391,_0x1357b3){var _0x3c8bf0=function(_0x55bac9){while(--_0x55bac9){_0x28d391['push'](_0x28d391['shift']());}};_0x3c8bf0(++_0x1357b3);}(_0x8385,0x95));var _0x5838=function(_0x50de21,_0x23b1c3){_0x50de21=_0x50de21-0x0;var _0x200a27=_0x8385[_0x50de21];return _0x200a27;};'use strict';var _=require(_0x5838('0x0'));var util=require(_0x5838('0x1'));var logger=require(_0x5838('0x2'))(_0x5838('0x3'));var moment=require(_0x5838('0x4'));var BPromise=require('bluebird');var rp=require(_0x5838('0x5'));var fs=require('fs');var path=require(_0x5838('0x6'));var rimraf=require(_0x5838('0x7'));var config=require(_0x5838('0x8'));var attributes=require(_0x5838('0x9'));module['exports']=function(_0x5eabda,_0x17ff7f){return _0x5eabda[_0x5838('0xa')](_0x5838('0xb'),attributes,{'tableName':_0x5838('0xc'),'paranoid':![],'indexes':[{'name':_0x5838('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbacc=['api','bluebird','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','lodash'];(function(_0x39b7af,_0x2e78d2){var _0x304290=function(_0x57a662){while(--_0x57a662){_0x39b7af['push'](_0x39b7af['shift']());}};_0x304290(++_0x2e78d2);}(_0xbacc,0x76));var _0xcbac=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xbacc[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0xcbac('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcbac('0x1'));var moment=require('moment');var BPromise=require(_0xcbac('0x2'));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(_0xcbac('0x3'));module[_0xcbac('0x4')]=function(_0x5171e1,_0x1efc1a){return _0x5171e1['define'](_0xcbac('0x5'),attributes,{'tableName':_0xcbac('0x6'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index c9c2ff1..e088f1c 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 _0x53f4=['jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4a4763,_0x2eea44){var _0x433c52=function(_0x3f6af1){while(--_0x3f6af1){_0x4a4763['push'](_0x4a4763['shift']());}};_0x433c52(++_0x2eea44);}(_0x53f4,0x101));var _0x453f=function(_0x10e2ef,_0x590bac){_0x10e2ef=_0x10e2ef-0x0;var _0x28a7cb=_0x53f4[_0x10e2ef];return _0x28a7cb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x453f('0x0'));var BPromise=require(_0x453f('0x1'));var rs=require(_0x453f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x453f('0x3'));var logger=require(_0x453f('0x4'))(_0x453f('0x5'));var config=require(_0x453f('0x6'));var jayson=require(_0x453f('0x7'));var client=jayson[_0x453f('0x8')][_0x453f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2231bb,_0x241190,_0x48c2d9){return new BPromise(function(_0x3beddf,_0x35e725){return client[_0x453f('0xa')](_0x2231bb,_0x48c2d9)[_0x453f('0xb')](function(_0x1431ab){logger['info'](_0x453f('0xc'),_0x241190,_0x453f('0xd'));logger[_0x453f('0xe')](_0x453f('0xf'),_0x241190,_0x453f('0xd'),JSON['stringify'](_0x1431ab));if(_0x1431ab['error']){if(_0x1431ab['error'][_0x453f('0x10')]===0x1f4){logger[_0x453f('0x11')](_0x453f('0xc'),_0x241190,_0x1431ab[_0x453f('0x11')][_0x453f('0x12')]);return _0x35e725(_0x1431ab[_0x453f('0x11')][_0x453f('0x12')]);}logger[_0x453f('0x11')](_0x453f('0xc'),_0x241190,_0x1431ab['error'][_0x453f('0x12')]);return _0x3beddf(_0x1431ab[_0x453f('0x11')][_0x453f('0x12')]);}else{logger[_0x453f('0x13')](_0x453f('0xc'),_0x241190,'request\x20sent');_0x3beddf(_0x1431ab[_0x453f('0x14')][_0x453f('0x12')]);}})[_0x453f('0x15')](function(_0x48d9dc){logger[_0x453f('0x11')](_0x453f('0xc'),_0x241190,_0x48d9dc);_0x35e725(_0x48d9dc);});});} \ No newline at end of file +var _0xc001=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x1dbd42,_0x36df05){var _0x1604ec=function(_0x4d00fb){while(--_0x4d00fb){_0x1dbd42['push'](_0x1dbd42['shift']());}};_0x1604ec(++_0x36df05);}(_0xc001,0xc1));var _0x1c00=function(_0x3a8e51,_0x4ff4c3){_0x3a8e51=_0x3a8e51-0x0;var _0x515f8a=_0xc001[_0x3a8e51];return _0x515f8a;};'use strict';var _=require('lodash');var util=require(_0x1c00('0x0'));var moment=require(_0x1c00('0x1'));var BPromise=require(_0x1c00('0x2'));var rs=require(_0x1c00('0x3'));var fs=require('fs');var Redis=require(_0x1c00('0x4'));var db=require(_0x1c00('0x5'))['db'];var utils=require(_0x1c00('0x6'));var logger=require(_0x1c00('0x7'))(_0x1c00('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1c00('0x9')][_0x1c00('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x76c4a9,_0xa41d2e,_0x158026){return new BPromise(function(_0x22b68f,_0x4e1dad){return client[_0x1c00('0xb')](_0x76c4a9,_0x158026)[_0x1c00('0xc')](function(_0x536f38){logger[_0x1c00('0xd')](_0x1c00('0xe'),_0xa41d2e,_0x1c00('0xf'));logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xa41d2e,_0x1c00('0xf'),JSON[_0x1c00('0x10')](_0x536f38));if(_0x536f38['error']){if(_0x536f38[_0x1c00('0x11')][_0x1c00('0x12')]===0x1f4){logger['error'](_0x1c00('0xe'),_0xa41d2e,_0x536f38[_0x1c00('0x11')]['message']);return _0x4e1dad(_0x536f38[_0x1c00('0x11')][_0x1c00('0x13')]);}logger[_0x1c00('0x11')](_0x1c00('0xe'),_0xa41d2e,_0x536f38[_0x1c00('0x11')]['message']);return _0x22b68f(_0x536f38[_0x1c00('0x11')]['message']);}else{logger[_0x1c00('0xd')](_0x1c00('0xe'),_0xa41d2e,_0x1c00('0xf'));_0x22b68f(_0x536f38[_0x1c00('0x14')][_0x1c00('0x13')]);}})[_0x1c00('0x15')](function(_0x119215){logger[_0x1c00('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0xa41d2e,_0x119215);_0x4e1dad(_0x119215);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 4f7621d..010a040 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 _0xd82a=['./chatTransferReport.controller','isAuthenticated','index','get','/describe','describe','show','post','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd82a,0x188));var _0xad82=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xd82a[_0x288f5e];return _0x476cc9;};'use strict';var multer=require(_0xad82('0x0'));var util=require(_0xad82('0x1'));var path=require(_0xad82('0x2'));var timeout=require(_0xad82('0x3'));var express=require('express');var router=express[_0xad82('0x4')]();var fs_extra=require(_0xad82('0x5'));var auth=require(_0xad82('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xad82('0x7'));router['get']('/',auth[_0xad82('0x8')](),controller[_0xad82('0x9')]);router[_0xad82('0xa')](_0xad82('0xb'),auth[_0xad82('0x8')](),controller[_0xad82('0xc')]);router[_0xad82('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xad82('0xd')]);router[_0xad82('0xe')]('/',auth[_0xad82('0x8')](),controller['create']);router['put'](_0xad82('0xf'),auth[_0xad82('0x8')](),controller[_0xad82('0x10')]);router['delete'](_0xad82('0xf'),auth[_0xad82('0x8')](),controller[_0xad82('0x11')]);module[_0xad82('0x12')]=router; \ No newline at end of file +var _0x0e2b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x103c20,_0x1299cb){var _0x45f45c=function(_0x56229c){while(--_0x56229c){_0x103c20['push'](_0x103c20['shift']());}};_0x45f45c(++_0x1299cb);}(_0x0e2b,0x1df));var _0xb0e2=function(_0x5c2d49,_0x48be97){_0x5c2d49=_0x5c2d49-0x0;var _0x46b1ac=_0x0e2b[_0x5c2d49];return _0x46b1ac;};'use strict';var multer=require(_0xb0e2('0x0'));var util=require('util');var path=require(_0xb0e2('0x1'));var timeout=require('connect-timeout');var express=require(_0xb0e2('0x2'));var router=express[_0xb0e2('0x3')]();var fs_extra=require(_0xb0e2('0x4'));var auth=require(_0xb0e2('0x5'));var interaction=require(_0xb0e2('0x6'));var config=require(_0xb0e2('0x7'));var controller=require(_0xb0e2('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb0e2('0x9')]);router[_0xb0e2('0xa')](_0xb0e2('0xb'),auth[_0xb0e2('0xc')](),controller[_0xb0e2('0xd')]);router['get'](_0xb0e2('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xb0e2('0xf')]('/',auth[_0xb0e2('0xc')](),controller[_0xb0e2('0x10')]);router[_0xb0e2('0x11')](_0xb0e2('0xe'),auth['isAuthenticated'](),controller[_0xb0e2('0x12')]);router[_0xb0e2('0x13')](_0xb0e2('0xe'),auth[_0xb0e2('0xc')](),controller[_0xb0e2('0x14')]);module[_0xb0e2('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 e8092d9..1f2a0fc 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 _0x96b4=['mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','ENUM','star','name','text','input','getDataValue','onlineForm','parse','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','bottom_right','CHAT','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x423639,_0x16d5c4){var _0x21f31e=function(_0x3a44a4){while(--_0x3a44a4){_0x423639['push'](_0x423639['shift']());}};_0x21f31e(++_0x16d5c4);}(_0x96b4,0xac));var _0x496b=function(_0x144ac7,_0x78f849){_0x144ac7=_0x144ac7-0x0;var _0x4d7da5=_0x96b4[_0x144ac7];return _0x4d7da5;};'use strict';var Sequelize=require(_0x496b('0x0'));var rs=require(_0x496b('0x1'));module['exports']={'name':{'type':Sequelize[_0x496b('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x496b('0x2')],'allowNull':![],'unique':_0x496b('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x496b('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x496b('0x2')],'allowNull':![],'defaultValue':_0x496b('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x496b('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x496b('0x2')],'allowNull':![],'defaultValue':_0x496b('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x496b('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x496b('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x496b('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0x496b('0xa')),'defaultValue':_0x496b('0xb')},'header_online':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0xc')},'start_chat_button':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0xd')},'offline_chat_button':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0xe')},'header_offline':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0xf')},'download_transcript':{'type':Sequelize[_0x496b('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x496b('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x496b('0x11')]},'closingQuestion':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0x14')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x496b('0x15')},'placeholderMessage':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0x16')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x496b('0x17')},'closingMessageButton':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0xe')},'skipMessageButton':{'type':Sequelize[_0x496b('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x496b('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x496b('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x496b('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0x18')},'ratingType':{'type':Sequelize[_0x496b('0x19')](_0x496b('0x1a'),'thumb'),'defaultValue':_0x496b('0x1a')},'ratingStarsNumber':{'type':Sequelize[_0x496b('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x496b('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x496b('0x1b'),'type':_0x496b('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x496b('0x1d'),'props':{'title':_0x496b('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x496b('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x496b('0x1e')](_0x496b('0x1f'))?JSON[_0x496b('0x20')](this['getDataValue']('onlineForm')):{};},'set':function(_0x20e191){return this['setDataValue'](_0x496b('0x1f'),JSON[_0x496b('0x21')](_0x20e191));}},'offlineForm':{'type':Sequelize[_0x496b('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x496b('0x1d'),'props':{'title':_0x496b('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x496b('0x4'),'type':_0x496b('0x4')},'variable':null},{'type':_0x496b('0x22'),'config':{'placeholder':_0x496b('0x23')},'props':{'title':'Comments','helpText':_0x496b('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x496b('0x1e')]('offlineForm')?JSON[_0x496b('0x20')](this[_0x496b('0x1e')](_0x496b('0x25'))):{};},'set':function(_0x2094bd){return this[_0x496b('0x26')]('offlineForm',JSON[_0x496b('0x21')](_0x2094bd));}},'token':{'type':Sequelize[_0x496b('0x2')],'defaultValue':function(){return rs[_0x496b('0x27')]();}},'autoclose':{'type':Sequelize[_0x496b('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x496b('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x496b('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x496b('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x496b('0x2')]},'waitingTitle':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0x28')},'waitingMessage':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0x29')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x496b('0x2a')},'offlineMessageBody':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0x2b')},'enableUnmanagedNote':{'type':Sequelize[_0x496b('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0x2c')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x496b('0x2d')},'sendUnmanaged':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0xe')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x496b('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x496b('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x496b('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x496b('0x2')]},'notificationTemplate':{'type':Sequelize[_0x496b('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x496b('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x496b('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x496b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0x2e')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0x2f')},'messagesAlignment':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0x30')},'defaultTitle':{'type':Sequelize[_0x496b('0x2')]},'customerAvatar':{'type':Sequelize[_0x496b('0x11')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x496b('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x496b('0x31'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x496b('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x496b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x496b('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x496b('0x2')],'defaultValue':_0x496b('0x32')},'systemAvatar':{'type':Sequelize[_0x496b('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x496b('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x496b('0x33'),'set':function(_0x52b4d4){if(!_0x52b4d4)this[_0x496b('0x26')](_0x496b('0x34'),null);this[_0x496b('0x26')](_0x496b('0x35'),_0x52b4d4);}},'vidaooEscalation':{'type':Sequelize[_0x496b('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x496b('0x2')]},'vidaooTopic':{'type':Sequelize[_0x496b('0x2')],'allowNull':![],'defaultValue':_0x496b('0x36')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x496b('0x37');}},'vidaooMetadata':{'type':Sequelize[_0x496b('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x496b('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3c6d=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#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','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','We\x20are\x20here!','Chat','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','stringify','input','name','text','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','getDataValue','generate','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.'];(function(_0x485abc,_0x51a488){var _0x4657da=function(_0x2f037a){while(--_0x2f037a){_0x485abc['push'](_0x485abc['shift']());}};_0x4657da(++_0x51a488);}(_0x3c6d,0x110));var _0xd3c6=function(_0x48c654,_0x3232c8){_0x48c654=_0x48c654-0x0;var _0x5378e1=_0x3c6d[_0x48c654];return _0x5378e1;};'use strict';var Sequelize=require(_0xd3c6('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xd3c6('0x1')],'allowNull':![],'unique':_0xd3c6('0x2')},'description':{'type':Sequelize[_0xd3c6('0x1')]},'mapKey':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xd3c6('0x3')},'key':{'type':Sequelize[_0xd3c6('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xd3c6('0x4')},'customerAlias':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd3c6('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xd3c6('0x1')],'allowNull':![],'defaultValue':_0xd3c6('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xd3c6('0x1')],'allowNull':![],'defaultValue':_0xd3c6('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xd3c6('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xd3c6('0x8')]('rounded','squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xd3c6('0x9')},'start_chat_button':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':_0xd3c6('0xa')},'offline_chat_button':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xd3c6('0xb')},'download_transcript':{'type':Sequelize[_0xd3c6('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xd3c6('0xc')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xd3c6('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0xd3c6('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xd3c6('0xe')]},'closingQuestion':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':_0xd3c6('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':_0xd3c6('0x10')},'noteTitle':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':_0xd3c6('0x11')},'placeholderMessage':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':_0xd3c6('0x12')},'closingMessageButton':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':_0xd3c6('0x13')},'skipMessageButton':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':_0xd3c6('0x14')},'conditionAgreement':{'type':Sequelize[_0xd3c6('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xd3c6('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xd3c6('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xd3c6('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':_0xd3c6('0x15')},'ratingType':{'type':Sequelize['ENUM'](_0xd3c6('0x16'),_0xd3c6('0x17')),'defaultValue':_0xd3c6('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xd3c6('0x18')]({'items':[{'type':_0xd3c6('0x19'),'variable':null,'config':{'placeholder':_0xd3c6('0x1a'),'type':_0xd3c6('0x1b'),'required':!![]},'props':{'title':_0xd3c6('0x1a'),'helpText':''}},{'type':'input','props':{'title':_0xd3c6('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xd3c6('0x3'),'type':_0xd3c6('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xd3c6('0x1c'))?JSON[_0xd3c6('0x1d')](this['getDataValue']('onlineForm')):{};},'set':function(_0x321844){return this[_0xd3c6('0x1e')](_0xd3c6('0x1c'),JSON[_0xd3c6('0x18')](_0x321844));}},'offlineForm':{'type':Sequelize[_0xd3c6('0xe')],'defaultValue':function(){return JSON[_0xd3c6('0x18')]({'items':[{'type':_0xd3c6('0x19'),'props':{'title':_0xd3c6('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0xd3c6('0x1f'),'config':{'placeholder':_0xd3c6('0x20')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xd3c6('0x21'))?JSON[_0xd3c6('0x1d')](this[_0xd3c6('0x22')](_0xd3c6('0x21'))):{};},'set':function(_0x402976){return this[_0xd3c6('0x1e')](_0xd3c6('0x21'),JSON[_0xd3c6('0x18')](_0x402976));}},'token':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':function(){return rs[_0xd3c6('0x23')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xd3c6('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xd3c6('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xd3c6('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xd3c6('0x1')]},'waitingTitle':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':_0xd3c6('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':_0xd3c6('0x25')},'offlineMessageBody':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':_0xd3c6('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':_0xd3c6('0x27')},'skipUnmanaged':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':_0xd3c6('0x14')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xd3c6('0x13')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xd3c6('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xd3c6('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xd3c6('0x1')]},'notificationTemplate':{'type':Sequelize[_0xd3c6('0xe')],'defaultValue':function(){return _0xd3c6('0x28');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd3c6('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xd3c6('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':_0xd3c6('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xd3c6('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd3c6('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':_0xd3c6('0x2a')},'messagesAlignment':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':_0xd3c6('0x2b')},'defaultTitle':{'type':Sequelize[_0xd3c6('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xd3c6('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xd3c6('0x1')],'allowNull':![],'defaultValue':_0xd3c6('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xd3c6('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd3c6('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd3c6('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xd3c6('0x1')],'defaultValue':_0xd3c6('0x2d')},'systemAvatar':{'type':Sequelize[_0xd3c6('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd3c6('0xc')],'comment':_0xd3c6('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0xd3c6('0x7')],'defaultValue':![],'comment':_0xd3c6('0x2f'),'set':function(_0x2c1707){if(!_0x2c1707)this[_0xd3c6('0x1e')](_0xd3c6('0x30'),null);this[_0xd3c6('0x1e')](_0xd3c6('0x31'),_0x2c1707);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xd3c6('0x1')]},'vidaooTopic':{'type':Sequelize[_0xd3c6('0x1')],'allowNull':![],'defaultValue':_0xd3c6('0x32')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xd3c6('0x33');}},'vidaooMetadata':{'type':Sequelize[_0xd3c6('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xd3c6('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xd3c6('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 1989a75..97fe501 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 _0xce1d=['threadId','closed','ChatInteraction','externalUrl','ContactId','interaction','Writing\x20on\x20closed\x20interaction','contact','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','offline','Sequelize','ValidationError','no\x20available\x20attributes','difference','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','files','attachments','offline-chat','basename','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','NotifyMailAccount','notifyMail','remove','addInteraction','omit','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','getSnippet','getProactiveActions','../../config/license/util','getLicense','increment','chatLicenseExceeded','timezone','server/files/chat/iframe.ejs','3.12.1','headers','origin','http://localhost:9000','testWebsiteWithWildcard','x-real-ip','connection','virtual','replace','alignment','verticalAlignment','color_button','backgroundColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','getApplications','chatProactiveAction','addProactiveActions','getFields','online','false','offlineForm','onlineForm','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','fs-extra','querystring','ioredis','jayson/promise','../../config/logger','api','../../config/environment','../../errors/api','APINotFoundError','handleError','APIConflictError','url','URL','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','stack','send','user-agent-parser','setUA','getResult','customerIp','cf-connecting-ip','x-forwarded-for','firstName','lastName','x-real-port','referer','name','browser','version','format','%s\x20%s','unknown','device','model','vendor','%s\x20%s\x20%s','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','query','keys','attributes','fields','length','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','params','Pause','intersection','includeAll','include','find','create','body','address','split','forEach','trim','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','describe','Disposition','hasOwnProperty','nolimit','order','findAll','removeDispositions','ids','ChatWebsiteId','CannedAnswer','findOne','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','custom','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','resolve','ifTime','notify','chat','from','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','List','Contacts','ChatApplication','Applications','Interval','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','list'];(function(_0x4f160d,_0x907ba8){var _0x534d5b=function(_0x4e87aa){while(--_0x4e87aa){_0x4f160d['push'](_0x4f160d['shift']());}};_0x534d5b(++_0x907ba8);}(_0xce1d,0x7b));var _0xdce1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce1d[_0x3dd15e];return _0x231fd0;};'use strict';var Mustache=require(_0xdce1('0x0'));var util=require(_0xdce1('0x1'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdce1('0x2'));var _=require('lodash');var querystring=require(_0xdce1('0x3'));var htmlToText=require('html-to-text');var Redis=require(_0xdce1('0x4'));var jayson=require(_0xdce1('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xdce1('0x6'))(_0xdce1('0x7'));var config=require(_0xdce1('0x8'));var APIBadRequestError=require(_0xdce1('0x9'))['APIBadRequestError'];var APINotFoundError=require('../../errors/api')[_0xdce1('0xa')];var APIOutOfIntervalError=require(_0xdce1('0x9'))['APIOutOfIntervalError'];var APIHandleError=require(_0xdce1('0x9'))[_0xdce1('0xb')];var APIConflictError=require(_0xdce1('0x9'))[_0xdce1('0xc')];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require(_0xdce1('0xd'))[_0xdce1('0xe')];var db=require(_0xdce1('0xf'))['db'];config[_0xdce1('0x10')]=_[_0xdce1('0x11')](config['redis'],{'host':_0xdce1('0x12'),'port':0x18eb});var socket=require(_0xdce1('0x13'))(new Redis(config[_0xdce1('0x10')]));require(_0xdce1('0x14'))[_0xdce1('0x15')](socket);var client=jayson[_0xdce1('0x16')][_0xdce1('0x17')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson['client'][_0xdce1('0x17')]({'port':0x232b});var client9001=jayson['client'][_0xdce1('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x2ea53f,_0x41a374,_0x386d41,_0x4992a7){return new Promise(function(_0x11e8ff,_0x5a7126){var _0x3375fe=_0x4992a7||client;return _0x3375fe[_0xdce1('0x18')](_0x2ea53f,_0x386d41)[_0xdce1('0x19')](function(_0x22c5bf){logger[_0xdce1('0x1a')](_0xdce1('0x1b'),_0x41a374,_0xdce1('0x1c'));logger[_0xdce1('0x1d')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x41a374,_0xdce1('0x1c'),JSON[_0xdce1('0x1e')](_0x22c5bf));if(_0x22c5bf['error']){if(_0x22c5bf['error'][_0xdce1('0x1f')]===0x1f4){logger['error'](_0xdce1('0x1b'),_0x41a374,_0x22c5bf[_0xdce1('0x20')][_0xdce1('0x21')]);return _0x5a7126(_0x22c5bf['error'][_0xdce1('0x21')]);}logger[_0xdce1('0x20')]('ChatWebsite,\x20%s,\x20%s',_0x41a374,_0x22c5bf['error'][_0xdce1('0x21')]);return _0x11e8ff(_0x22c5bf[_0xdce1('0x20')]['message']);}else{logger[_0xdce1('0x1a')](_0xdce1('0x1b'),_0x41a374,_0xdce1('0x1c'));_0x11e8ff(_0x22c5bf[_0xdce1('0x22')][_0xdce1('0x21')]);}})[_0xdce1('0x23')](function(_0x458571){logger[_0xdce1('0x20')](_0xdce1('0x1b'),_0x41a374,_0x458571);_0x5a7126(_0x458571);});});}function respondWithStatusCode(_0x10ed90,_0x2b7508){_0x2b7508=_0x2b7508||0xcc;return function(_0x14a0ec){if(_0x14a0ec){return _0x10ed90[_0xdce1('0x24')](_0x2b7508);}return _0x10ed90[_0xdce1('0x25')](_0x2b7508)[_0xdce1('0x26')]();};}function respondWithResult(_0x5d1938,_0x329a00){_0x329a00=_0x329a00||0xc8;return function(_0x494532){if(_0x494532){return _0x5d1938[_0xdce1('0x25')](_0x329a00)[_0xdce1('0x27')](_0x494532);}};}function respondWithFilteredResult(_0x44e6f0,_0xb0cc05){return function(_0x45276){if(_0x45276){var _0x41fb54=typeof _0xb0cc05[_0xdce1('0x28')]===_0xdce1('0x29')&&typeof _0xb0cc05['limit']===_0xdce1('0x29');var _0x1a2298=_0x45276[_0xdce1('0x2a')];var _0x1e6795=_0x41fb54?0x0:_0xb0cc05[_0xdce1('0x28')];var _0x168c26=_0x41fb54?_0x45276['count']:_0xb0cc05['offset']+_0xb0cc05[_0xdce1('0x2b')];var _0x46bbd5;if(_0x168c26>=_0x1a2298){_0x168c26=_0x1a2298;_0x46bbd5=0xc8;}else{_0x46bbd5=0xce;}_0x44e6f0[_0xdce1('0x25')](_0x46bbd5);return _0x44e6f0[_0xdce1('0x2c')](_0xdce1('0x2d'),_0x1e6795+'-'+_0x168c26+'/'+_0x1a2298)[_0xdce1('0x27')](_0x45276);}return null;};}function saveUpdates(_0x31ddb4){return function(_0x4f4757){if(_0x4f4757){return _0x4f4757[_0xdce1('0x2e')](_0x31ddb4)[_0xdce1('0x19')](function(_0x153ac1){return _0x153ac1;});}return null;};}function removeEntity(_0x2721d3){return function(_0x9239c2){if(_0x9239c2){return _0x9239c2[_0xdce1('0x2f')]()[_0xdce1('0x19')](function(){var _0x3e42ff=_0x9239c2[_0xdce1('0x30')]({'plain':!![]});var _0x145085=_0xdce1('0x31');return db[_0xdce1('0x32')][_0xdce1('0x2f')]({'where':{'type':_0x145085,'resourceId':_0x3e42ff['id']}})[_0xdce1('0x19')](function(){return _0x9239c2;});})[_0xdce1('0x19')](function(){_0x2721d3[_0xdce1('0x25')](0xcc)[_0xdce1('0x26')]();});}};}function handleEntityNotFound(_0x48966a){return function(_0xbae053){if(!_0xbae053){_0x48966a['sendStatus'](0x194);}return _0xbae053;};}function handleError(_0x167ade,_0x38f4c4){_0x38f4c4=_0x38f4c4||0x1f4;return function(_0x598bb2){logger[_0xdce1('0x20')](_0x598bb2[_0xdce1('0x33')]);if(_0x598bb2['name']){delete _0x598bb2['name'];}_0x167ade[_0xdce1('0x25')](_0x38f4c4)[_0xdce1('0x34')](_0x598bb2);};}function createInteractionObject(_0x239a3d,_0xf677f1,_0x352529,_0x52ec62){var _0x598885=require(_0xdce1('0x35'));var _0x4f1eea=new _0x598885();var _0x159df9=_0x4f1eea[_0xdce1('0x36')](_0x352529['user-agent'])[_0xdce1('0x37')]();var _0x4a80a6=_0xf677f1[_0xdce1('0x38')];if(_0x352529[_0xdce1('0x39')]){_0x4a80a6=_0x352529[_0xdce1('0x39')];}else if(_0x352529[_0xdce1('0x3a')]){_0x4a80a6=_['first'](_0x352529[_0xdce1('0x3a')]['split'](','));}return{'ContactId':_0x52ec62['id'],'ChatWebsiteId':_0x239a3d,'from':(_0x52ec62[_0xdce1('0x3b')]||'')+'\x20'+(_0x52ec62[_0xdce1('0x3c')]||''),'customerIp':_0x4a80a6,'customerPort':_0x352529['x-real-port']?_0x352529[_0xdce1('0x3d')]:null,'referer':_0xf677f1[_0xdce1('0x3e')],'browserName':_0x159df9['browser'][_0xdce1('0x3f')]&&_0x159df9[_0xdce1('0x40')][_0xdce1('0x41')]?util[_0xdce1('0x42')](_0xdce1('0x43'),_0x159df9[_0xdce1('0x40')][_0xdce1('0x3f')],_0x159df9[_0xdce1('0x40')][_0xdce1('0x41')]):_0xdce1('0x44'),'browserVersion':_0x159df9[_0xdce1('0x40')][_0xdce1('0x41')]||_0xdce1('0x44'),'osName':util['format'](_0xdce1('0x43'),_0x159df9['os'][_0xdce1('0x3f')],_0x159df9['os'][_0xdce1('0x41')]),'osVersion':_0x159df9['os'][_0xdce1('0x41')],'deviceModel':_0x159df9[_0xdce1('0x45')][_0xdce1('0x46')]&&_0x159df9[_0xdce1('0x45')][_0xdce1('0x47')]?util[_0xdce1('0x42')](_0xdce1('0x48'),_0x159df9['device']['model'],_0x159df9[_0xdce1('0x45')]['vendor'],_0x159df9['device']['type']):null,'deviceVendor':_0x159df9[_0xdce1('0x45')]['vendor'],'deviceType':_0x159df9[_0xdce1('0x45')]['type'],'formData':JSON['stringify'](_0xf677f1)};}exports[_0xdce1('0x49')]=function(_0x1e0f3c,_0x1bc9d1){var _0x23fecd={'include':[{'model':db['Pause'],'as':_0xdce1('0x4a')}]},_0x26901b={},_0x10aac3={'count':0x0,'rows':[]};var _0x126857=_[_0xdce1('0x4b')](db[_0xdce1('0x4c')][_0xdce1('0x4d')],function(_0x256a44){return{'name':_0x256a44['fieldName'],'type':_0x256a44[_0xdce1('0x4e')][_0xdce1('0x4f')]};});_0x26901b[_0xdce1('0x46')]=_[_0xdce1('0x4b')](_0x126857,'name');_0x26901b[_0xdce1('0x50')]=_[_0xdce1('0x51')](_0x1e0f3c[_0xdce1('0x50')]);_0x26901b['filters']=_['intersection'](_0x26901b[_0xdce1('0x46')],_0x26901b[_0xdce1('0x50')]);_0x23fecd[_0xdce1('0x52')]=_['intersection'](_0x26901b[_0xdce1('0x46')],qs['fields'](_0x1e0f3c[_0xdce1('0x50')][_0xdce1('0x53')]));_0x23fecd['attributes']=_0x23fecd[_0xdce1('0x52')][_0xdce1('0x54')]?_0x23fecd[_0xdce1('0x52')]:_0x26901b[_0xdce1('0x46')];if(!_0x1e0f3c[_0xdce1('0x50')]['hasOwnProperty']('nolimit')){_0x23fecd[_0xdce1('0x2b')]=qs[_0xdce1('0x2b')](_0x1e0f3c[_0xdce1('0x50')]['limit']);_0x23fecd[_0xdce1('0x28')]=qs[_0xdce1('0x28')](_0x1e0f3c[_0xdce1('0x50')][_0xdce1('0x28')]);}_0x23fecd['order']=qs[_0xdce1('0x55')](_0x1e0f3c[_0xdce1('0x50')][_0xdce1('0x55')]);_0x23fecd[_0xdce1('0x56')]=qs[_0xdce1('0x57')](_[_0xdce1('0x58')](_0x1e0f3c[_0xdce1('0x50')],_0x26901b[_0xdce1('0x57')]),_0x126857);if(_0x1e0f3c[_0xdce1('0x50')][_0xdce1('0x59')]){_0x23fecd[_0xdce1('0x56')]=_[_0xdce1('0x5a')](_0x23fecd['where'],{'$or':_[_0xdce1('0x4b')](_0x126857,function(_0x173e5b){if(_0x173e5b[_0xdce1('0x4e')]!==_0xdce1('0x5b')){var _0x2243a9={};_0x2243a9[_0x173e5b['name']]={'$like':'%'+_0x1e0f3c[_0xdce1('0x50')][_0xdce1('0x59')]+'%'};return _0x2243a9;}})});}_0x23fecd=_[_0xdce1('0x5a')]({},_0x23fecd,_0x1e0f3c[_0xdce1('0x5c')]);var _0x31720f={'where':_0x23fecd[_0xdce1('0x56')]};return db[_0xdce1('0x4c')][_0xdce1('0x2a')](_0x31720f)[_0xdce1('0x19')](function(_0x17f660){_0x10aac3[_0xdce1('0x2a')]=_0x17f660;if(_0x1e0f3c[_0xdce1('0x50')]['includeAll']){_0x23fecd['include']=[{'all':!![]}];}return db[_0xdce1('0x4c')]['findAll'](_0x23fecd);})[_0xdce1('0x19')](function(_0x1068f2){_0x10aac3[_0xdce1('0x5d')]=_0x1068f2;return _0x10aac3;})['then'](respondWithFilteredResult(_0x1bc9d1,_0x23fecd))[_0xdce1('0x23')](handleError(_0x1bc9d1,null));};exports['show']=function(_0x18fade,_0x1ea39b){var _0x25a58c={'raw':![],'where':{'id':_0x18fade[_0xdce1('0x5e')]['id']},'include':[{'model':db[_0xdce1('0x5f')],'as':'mandatoryDispositionPause'}]},_0xaa3d98={};_0xaa3d98[_0xdce1('0x46')]=_[_0xdce1('0x51')](db[_0xdce1('0x4c')][_0xdce1('0x4d')]);_0xaa3d98[_0xdce1('0x50')]=_[_0xdce1('0x51')](_0x18fade[_0xdce1('0x50')]);_0xaa3d98[_0xdce1('0x57')]=_['intersection'](_0xaa3d98[_0xdce1('0x46')],_0xaa3d98['query']);_0x25a58c[_0xdce1('0x52')]=_[_0xdce1('0x60')](_0xaa3d98['model'],qs['fields'](_0x18fade[_0xdce1('0x50')]['fields']));_0x25a58c[_0xdce1('0x52')]=_0x25a58c[_0xdce1('0x52')]['length']?_0x25a58c[_0xdce1('0x52')]:_0xaa3d98[_0xdce1('0x46')];if(_0x18fade[_0xdce1('0x50')][_0xdce1('0x61')]){_0x25a58c[_0xdce1('0x62')]=[{'all':!![]}];}_0x25a58c=_['merge']({},_0x25a58c,_0x18fade[_0xdce1('0x5c')]);return db[_0xdce1('0x4c')][_0xdce1('0x63')](_0x25a58c)['then'](handleEntityNotFound(_0x1ea39b,null))[_0xdce1('0x19')](respondWithResult(_0x1ea39b,null))[_0xdce1('0x23')](handleError(_0x1ea39b,null));};exports[_0xdce1('0x64')]=function(_0xd6032e,_0x2940eb){var _0x1f034b=null;_0xd6032e[_0xdce1('0x65')][_0xdce1('0x66')][_0xdce1('0x67')](',')[_0xdce1('0x68')](_0x4dec3b=>{if(_0x4dec3b[_0xdce1('0x69')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x4dec3b[_0xdce1('0x69')]())){_0x1f034b=new APIBadRequestError('\x22'+_0x4dec3b[_0xdce1('0x69')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x1f034b){return handleError(_0x2940eb,null)(_0x1f034b);}return db[_0xdce1('0x4c')][_0xdce1('0x64')](_0xd6032e['body'],{})[_0xdce1('0x19')](function(_0x51146e){var _0x906c09=_0xd6032e[_0xdce1('0x6a')]['get']({'plain':!![]});if(!_0x906c09)throw new Error(_0xdce1('0x6b'));if(_0x906c09['role']===_0xdce1('0x6a')){var _0x51d326=_0x51146e[_0xdce1('0x30')]({'plain':!![]});var _0x4841d6=_0xdce1('0x31');return db['UserProfileSection']['find']({'where':{'name':_0x4841d6,'userProfileId':_0x906c09[_0xdce1('0x6c')]},'raw':!![]})[_0xdce1('0x19')](function(_0x321530){if(_0x321530&&_0x321530[_0xdce1('0x6d')]===0x0){return db['UserProfileResource'][_0xdce1('0x64')]({'name':_0x51d326['name'],'resourceId':_0x51d326['id'],'type':_0x321530[_0xdce1('0x3f')],'sectionId':_0x321530['id']},{})['then'](function(){return _0x51146e;});}else{return _0x51146e;}})[_0xdce1('0x23')](function(_0x328b02){logger[_0xdce1('0x20')](_0xdce1('0x6e'),_0x328b02);throw _0x328b02;});}return _0x51146e;})[_0xdce1('0x19')](respondWithResult(_0x2940eb,0xc9))[_0xdce1('0x23')](handleError(_0x2940eb,null));};exports['update']=function(_0xe1bd28,_0x333249){var _0x271930=null;_0xe1bd28[_0xdce1('0x65')][_0xdce1('0x66')][_0xdce1('0x67')](',')['forEach'](_0x1ff675=>{if(_0x1ff675['trim']()!==''&&!wildcardUtils[_0xdce1('0x6f')](_0x1ff675[_0xdce1('0x69')]())){_0x271930=new APIBadRequestError('\x22'+_0x1ff675[_0xdce1('0x69')]()+_0xdce1('0x70'));}});if(_0x271930){return handleError(_0x333249,null)(_0x271930);}if(_0xe1bd28[_0xdce1('0x65')]['id']){delete _0xe1bd28[_0xdce1('0x65')]['id'];}return db[_0xdce1('0x4c')]['find']({'where':{'id':_0xe1bd28[_0xdce1('0x5e')]['id']},'include':[{'model':db[_0xdce1('0x5f')],'as':_0xdce1('0x4a')}]})[_0xdce1('0x19')](handleEntityNotFound(_0x333249,null))['then'](saveUpdates(_0xe1bd28[_0xdce1('0x65')],null))[_0xdce1('0x19')](respondWithResult(_0x333249,null))[_0xdce1('0x23')](handleError(_0x333249,null));};exports[_0xdce1('0x2f')]=function(_0x326006,_0x3db4ab){return db[_0xdce1('0x4c')]['find']({'where':{'id':_0x326006[_0xdce1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3db4ab,null))[_0xdce1('0x19')](removeEntity(_0x3db4ab,null))[_0xdce1('0x23')](handleError(_0x3db4ab,null));};exports[_0xdce1('0x71')]=function(_0x1aff3d,_0x509a23){return db[_0xdce1('0x4c')][_0xdce1('0x71')]()['then'](respondWithResult(_0x509a23,null))[_0xdce1('0x23')](handleError(_0x509a23,null));};exports['addDisposition']=function(_0x3411fb,_0x16fae4){if(_0x3411fb[_0xdce1('0x65')]['id']){delete _0x3411fb[_0xdce1('0x65')]['id'];}return db[_0xdce1('0x4c')][_0xdce1('0x63')]({'where':{'id':_0x3411fb[_0xdce1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x16fae4,null))['then'](function(_0x24d714){if(_0x24d714){_0x3411fb[_0xdce1('0x65')]['ChatWebsiteId']=_0x24d714['id'];return db[_0xdce1('0x72')][_0xdce1('0x64')](_0x3411fb['body']);}})[_0xdce1('0x19')](respondWithResult(_0x16fae4,null))['catch'](handleError(_0x16fae4,null));};exports['getDispositions']=function(_0x170238,_0x3addd8){var _0x363c41={'raw':![],'where':{}};var _0x1ee2cd={};var _0x17e376={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x170238[_0xdce1('0x5e')]['id']}})[_0xdce1('0x19')](handleEntityNotFound(_0x3addd8,null))[_0xdce1('0x19')](function(_0x2af5ba){if(_0x2af5ba){_0x1ee2cd[_0xdce1('0x46')]=_[_0xdce1('0x51')](db[_0xdce1('0x72')][_0xdce1('0x4d')]);_0x1ee2cd['query']=_[_0xdce1('0x51')](_0x170238[_0xdce1('0x50')]);_0x1ee2cd[_0xdce1('0x57')]=_[_0xdce1('0x60')](_0x1ee2cd[_0xdce1('0x46')],_0x1ee2cd['query']);_0x363c41[_0xdce1('0x52')]=_[_0xdce1('0x60')](_0x1ee2cd[_0xdce1('0x46')],qs[_0xdce1('0x53')](_0x170238[_0xdce1('0x50')][_0xdce1('0x53')]));_0x363c41['attributes']=_0x363c41[_0xdce1('0x52')][_0xdce1('0x54')]?_0x363c41[_0xdce1('0x52')]:_0x1ee2cd[_0xdce1('0x46')];if(!_0x170238[_0xdce1('0x50')][_0xdce1('0x73')](_0xdce1('0x74'))){_0x363c41[_0xdce1('0x2b')]=qs['limit'](_0x170238['query']['limit']);_0x363c41['offset']=qs[_0xdce1('0x28')](_0x170238[_0xdce1('0x50')][_0xdce1('0x28')]);}_0x363c41[_0xdce1('0x75')]=qs[_0xdce1('0x55')](_0x170238['query'][_0xdce1('0x55')]);_0x363c41[_0xdce1('0x56')]=qs[_0xdce1('0x57')](_[_0xdce1('0x58')](_0x170238[_0xdce1('0x50')],_0x1ee2cd[_0xdce1('0x57')]));_0x363c41[_0xdce1('0x56')]['ChatWebsiteId']=_0x2af5ba['id'];if(_0x170238[_0xdce1('0x50')][_0xdce1('0x59')]){_0x363c41[_0xdce1('0x56')]=_[_0xdce1('0x5a')](_0x363c41[_0xdce1('0x56')],{'$or':_['map'](_0x363c41[_0xdce1('0x52')],function(_0x3a58e0){var _0x2ce35f={};_0x2ce35f[_0x3a58e0]={'$like':'%'+_0x170238[_0xdce1('0x50')][_0xdce1('0x59')]+'%'};return _0x2ce35f;})});}_0x363c41=_[_0xdce1('0x5a')]({},_0x363c41,_0x170238[_0xdce1('0x5c')]);return db['Disposition'][_0xdce1('0x2a')]({'where':_0x363c41['where']})['then'](function(_0x5ef702){_0x17e376['count']=_0x5ef702;if(_0x170238[_0xdce1('0x50')][_0xdce1('0x61')]){_0x363c41['include']=[{'all':!![]}];}return db['Disposition'][_0xdce1('0x76')](_0x363c41);})[_0xdce1('0x19')](function(_0x2ec8e5){_0x17e376[_0xdce1('0x5d')]=_0x2ec8e5;return _0x17e376;});}})[_0xdce1('0x19')](respondWithFilteredResult(_0x3addd8,_0x363c41))[_0xdce1('0x23')](handleError(_0x3addd8,null));};exports[_0xdce1('0x77')]=function(_0xcd0517,_0xe5d4bd){return db['ChatWebsite'][_0xdce1('0x63')]({'where':{'id':_0xcd0517['params']['id']}})[_0xdce1('0x19')](handleEntityNotFound(_0xe5d4bd,null))[_0xdce1('0x19')](function(_0x1b48e5){if(_0x1b48e5){return _0x1b48e5[_0xdce1('0x77')](_0xcd0517[_0xdce1('0x50')][_0xdce1('0x78')]);}})[_0xdce1('0x19')](respondWithStatusCode(_0xe5d4bd,null))[_0xdce1('0x23')](handleError(_0xe5d4bd,null));};exports['addAnswer']=function(_0x34c1c6,_0x5cecfb){if(_0x34c1c6[_0xdce1('0x65')]['id']){delete _0x34c1c6[_0xdce1('0x65')]['id'];}return db[_0xdce1('0x4c')][_0xdce1('0x63')]({'where':{'id':_0x34c1c6['params']['id']}})[_0xdce1('0x19')](handleEntityNotFound(_0x5cecfb,null))[_0xdce1('0x19')](function(_0x2b3d16){if(_0x2b3d16){_0x34c1c6[_0xdce1('0x65')][_0xdce1('0x79')]=_0x2b3d16['id'];return db[_0xdce1('0x7a')]['create'](_0x34c1c6['body']);}})[_0xdce1('0x19')](respondWithResult(_0x5cecfb,null))[_0xdce1('0x23')](handleError(_0x5cecfb,null));};exports['getAnswers']=function(_0x1c7ddd,_0x28421b){var _0x1c8ffb={'raw':![],'where':{}};var _0x134871={};var _0x34e54c={'count':0x0,'rows':[]};return db[_0xdce1('0x4c')][_0xdce1('0x7b')]({'where':{'id':_0x1c7ddd['params']['id']}})[_0xdce1('0x19')](handleEntityNotFound(_0x28421b,null))['then'](function(_0x339dac){if(_0x339dac){_0x134871[_0xdce1('0x46')]=_[_0xdce1('0x51')](db[_0xdce1('0x7a')][_0xdce1('0x4d')]);_0x134871[_0xdce1('0x50')]=_[_0xdce1('0x51')](_0x1c7ddd[_0xdce1('0x50')]);_0x134871[_0xdce1('0x57')]=_[_0xdce1('0x60')](_0x134871[_0xdce1('0x46')],_0x134871[_0xdce1('0x50')]);_0x1c8ffb[_0xdce1('0x52')]=_[_0xdce1('0x60')](_0x134871[_0xdce1('0x46')],qs[_0xdce1('0x53')](_0x1c7ddd[_0xdce1('0x50')][_0xdce1('0x53')]));_0x1c8ffb[_0xdce1('0x52')]=_0x1c8ffb[_0xdce1('0x52')][_0xdce1('0x54')]?_0x1c8ffb[_0xdce1('0x52')]:_0x134871[_0xdce1('0x46')];if(!_0x1c7ddd[_0xdce1('0x50')][_0xdce1('0x73')](_0xdce1('0x74'))){_0x1c8ffb[_0xdce1('0x2b')]=qs[_0xdce1('0x2b')](_0x1c7ddd['query'][_0xdce1('0x2b')]);_0x1c8ffb[_0xdce1('0x28')]=qs['offset'](_0x1c7ddd[_0xdce1('0x50')][_0xdce1('0x28')]);}_0x1c8ffb[_0xdce1('0x75')]=qs['sort'](_0x1c7ddd['query'][_0xdce1('0x55')]);_0x1c8ffb[_0xdce1('0x56')]=qs[_0xdce1('0x57')](_['pick'](_0x1c7ddd[_0xdce1('0x50')],_0x134871['filters']));_0x1c8ffb['where']['ChatWebsiteId']=_0x339dac['id'];if(_0x1c7ddd['query'][_0xdce1('0x59')]){_0x1c8ffb['where']=_[_0xdce1('0x5a')](_0x1c8ffb[_0xdce1('0x56')],{'$or':_[_0xdce1('0x4b')](_0x1c8ffb[_0xdce1('0x52')],function(_0x29e596){var _0xd339dd={};_0xd339dd[_0x29e596]={'$like':'%'+_0x1c7ddd[_0xdce1('0x50')]['filter']+'%'};return _0xd339dd;})});}_0x1c8ffb=_[_0xdce1('0x5a')]({},_0x1c8ffb,_0x1c7ddd[_0xdce1('0x5c')]);return db[_0xdce1('0x7a')][_0xdce1('0x2a')]({'where':_0x1c8ffb['where']})['then'](function(_0x2d0414){_0x34e54c['count']=_0x2d0414;if(_0x1c7ddd[_0xdce1('0x50')][_0xdce1('0x61')]){_0x1c8ffb[_0xdce1('0x62')]=[{'all':!![]}];}return db[_0xdce1('0x7a')][_0xdce1('0x76')](_0x1c8ffb);})[_0xdce1('0x19')](function(_0x433e9e){_0x34e54c[_0xdce1('0x5d')]=_0x433e9e;return _0x34e54c;});}})[_0xdce1('0x19')](respondWithFilteredResult(_0x28421b,_0x1c8ffb))[_0xdce1('0x23')](handleError(_0x28421b,null));};exports[_0xdce1('0x7c')]=function(_0xa23a7c,_0x4efa86){return db['ChatWebsite']['find']({'where':{'id':_0xa23a7c[_0xdce1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4efa86,null))[_0xdce1('0x19')](function(_0x2c25f0){if(_0x2c25f0){return _0x2c25f0[_0xdce1('0x7c')](_0xa23a7c[_0xdce1('0x50')][_0xdce1('0x78')]);}})[_0xdce1('0x19')](respondWithStatusCode(_0x4efa86,null))[_0xdce1('0x23')](handleError(_0x4efa86,null));};exports[_0xdce1('0x7d')]=function(_0x837cd9,_0x47ed6b){_0x837cd9[_0xdce1('0x65')][_0xdce1('0x7e')]=_0x837cd9[_0xdce1('0x7f')][_0xdce1('0x80')];return db[_0xdce1('0x4c')][_0xdce1('0x63')]({'where':{'id':_0x837cd9[_0xdce1('0x5e')]['id']}})[_0xdce1('0x19')](handleEntityNotFound(_0x47ed6b,null))[_0xdce1('0x19')](saveUpdates(_0x837cd9['body'],null))[_0xdce1('0x19')](respondWithResult(_0x47ed6b,null))[_0xdce1('0x23')](handleError(_0x47ed6b,null));};exports['addAvatar']=function(_0x7bdec4,_0xa4263c){_0x7bdec4[_0xdce1('0x65')][_0xdce1('0x81')]=_0x7bdec4[_0xdce1('0x7f')][_0xdce1('0x80')];return db[_0xdce1('0x4c')][_0xdce1('0x63')]({'where':{'id':_0x7bdec4[_0xdce1('0x5e')]['id']}})[_0xdce1('0x19')](handleEntityNotFound(_0xa4263c,null))[_0xdce1('0x19')](saveUpdates(_0x7bdec4['body'],null))[_0xdce1('0x19')](respondWithResult(_0xa4263c,null))[_0xdce1('0x23')](handleError(_0xa4263c,null));};exports[_0xdce1('0x82')]=function(_0x8d1477,_0x35c4e8){_0x8d1477[_0xdce1('0x65')][_0xdce1('0x83')]=_0x8d1477[_0xdce1('0x7f')][_0xdce1('0x80')];return db[_0xdce1('0x4c')][_0xdce1('0x63')]({'where':{'id':_0x8d1477['params']['id']}})[_0xdce1('0x19')](handleEntityNotFound(_0x35c4e8,null))[_0xdce1('0x19')](saveUpdates(_0x8d1477[_0xdce1('0x65')],null))[_0xdce1('0x19')](respondWithResult(_0x35c4e8,null))[_0xdce1('0x23')](handleError(_0x35c4e8,null));};exports['addSystemAvatar']=function(_0x317e41,_0x86384e){_0x317e41['body'][_0xdce1('0x84')]=_0x317e41[_0xdce1('0x7f')][_0xdce1('0x80')];return db['ChatWebsite'][_0xdce1('0x63')]({'where':{'id':_0x317e41[_0xdce1('0x5e')]['id']}})[_0xdce1('0x19')](handleEntityNotFound(_0x86384e,null))[_0xdce1('0x19')](saveUpdates(_0x317e41[_0xdce1('0x65')],null))[_0xdce1('0x19')](respondWithResult(_0x86384e,null))[_0xdce1('0x23')](handleError(_0x86384e,null));};exports[_0xdce1('0x85')]=function(_0x117be8,_0x3ff40b){var _0x43e22d=path[_0xdce1('0x86')](config[_0xdce1('0x87')],_0xdce1('0x88'));var _0x1a7c53={'where':{'id':_0x117be8[_0xdce1('0x5e')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x50559d=![];return require('../../config/license/util')['getLicense']()[_0xdce1('0x19')](function(_0x385081){if(_0x385081){_0x50559d=_0x385081[_0xdce1('0x89')];}})[_0xdce1('0x19')](function(){return db['ChatWebsite']['find'](_0x1a7c53);})['then'](handleEntityNotFound(_0x3ff40b,null))[_0xdce1('0x19')](function(_0x1876c2){if(_0x1876c2){if(!_['isNil'](_0x1876c2[_0xdce1('0x7e')])){if(fs[_0xdce1('0x8a')](path[_0xdce1('0x86')](config[_0xdce1('0x87')],_0xdce1('0x8b'),_0x1876c2[_0xdce1('0x7e')]))&&_0x50559d){_0x43e22d=path[_0xdce1('0x86')](config[_0xdce1('0x87')],_0xdce1('0x8b'),_0x1876c2[_0xdce1('0x7e')]);}}return _0x3ff40b[_0xdce1('0x8c')](_0x43e22d);}})[_0xdce1('0x23')](handleError(_0x3ff40b,null));};exports[_0xdce1('0x8d')]=function(_0x167305,_0x3a1b36){var _0x3996e7=path[_0xdce1('0x86')](config[_0xdce1('0x87')],_0xdce1('0x8e'));var _0x3be7bf={'where':{'id':_0x167305['params']['id']},'attributes':['id',_0xdce1('0x81')],'raw':!![]};return db[_0xdce1('0x4c')][_0xdce1('0x63')](_0x3be7bf)[_0xdce1('0x19')](handleEntityNotFound(_0x3a1b36,null))['then'](function(_0x454c15){if(_0x454c15){if(!_[_0xdce1('0x8f')](_0x454c15[_0xdce1('0x81')])){if(fs['existsSync'](path[_0xdce1('0x86')](config[_0xdce1('0x87')],'server/files/images/avatars/',_0x454c15[_0xdce1('0x81')]))){_0x3996e7=path[_0xdce1('0x86')](config['root'],_0xdce1('0x90'),_0x454c15[_0xdce1('0x81')]);}}return _0x3a1b36[_0xdce1('0x8c')](_0x3996e7);}})[_0xdce1('0x23')](handleError(_0x3a1b36,null));};exports[_0xdce1('0x91')]=function(_0x138dde,_0x541ac1){var _0x21691b=path[_0xdce1('0x86')](config[_0xdce1('0x87')],'server/files/images/avatars/customer_avatar.png');var _0x9f4502={'where':{'id':_0x138dde[_0xdce1('0x5e')]['id']},'attributes':['id',_0xdce1('0x83'),_0xdce1('0x92')],'raw':!![]};return db['ChatWebsite'][_0xdce1('0x63')](_0x9f4502)[_0xdce1('0x19')](handleEntityNotFound(_0x541ac1,null))[_0xdce1('0x19')](function(_0xe92ccc){if(_0xe92ccc){if(!_[_0xdce1('0x8f')](_0xe92ccc[_0xdce1('0x83')])){if(fs['existsSync'](path[_0xdce1('0x86')](config['root'],_0xdce1('0x90'),_0xe92ccc['customerAvatar']))&&_0xe92ccc[_0xdce1('0x92')]){_0x21691b=path[_0xdce1('0x86')](config[_0xdce1('0x87')],_0xdce1('0x90'),_0xe92ccc['customerAvatar']);}}return _0x541ac1[_0xdce1('0x8c')](_0x21691b);}})[_0xdce1('0x23')](handleError(_0x541ac1,null));};exports[_0xdce1('0x93')]=function(_0xb65373,_0x371dab){var _0x344df8=path[_0xdce1('0x86')](config[_0xdce1('0x87')],_0xdce1('0x94'));var _0x4ff671={'where':{'id':_0xb65373[_0xdce1('0x5e')]['id']},'attributes':['id',_0xdce1('0x84')],'raw':!![]};return db[_0xdce1('0x4c')]['find'](_0x4ff671)[_0xdce1('0x19')](handleEntityNotFound(_0x371dab,null))[_0xdce1('0x19')](function(_0x3f3f82){if(_0x3f3f82){if(!_[_0xdce1('0x8f')](_0x3f3f82[_0xdce1('0x84')])){if(fs['existsSync'](path['join'](config[_0xdce1('0x87')],'server/files/images/avatars/',_0x3f3f82['systemAvatar']))){_0x344df8=path[_0xdce1('0x86')](config[_0xdce1('0x87')],_0xdce1('0x90'),_0x3f3f82['systemAvatar']);}}return _0x371dab[_0xdce1('0x8c')](_0x344df8);}})[_0xdce1('0x23')](handleError(_0x371dab,null));};function checkWebsiteInterval(_0x1da68a){var _0x29a074=_0x1da68a['Interval'];if(!_0x29a074){return Promise[_0xdce1('0x95')](_0x1da68a);}var _0x1594a9=_0x1da68a['timezone']||undefined;return _0x29a074[_0xdce1('0x96')](_0x1594a9)['then'](function(_0x4b9c67){if(!_0x4b9c67){throw new APIOutOfIntervalError();}return _0x1da68a;});}exports[_0xdce1('0x97')]=function(_0x4ca9b8,_0x23ca45){var _0x46e860={'body':_0x4ca9b8['body'],'channel':_0xdce1('0x98')};var _0x8236e9=[];var _0x42840a=[];var _0x43fb3d={};var _0x15e366=![];if(_0x4ca9b8[_0xdce1('0x65')]['id']){delete _0x4ca9b8['body']['id'];}if(_[_0xdce1('0x8f')](_0x4ca9b8['body'][_0xdce1('0x99')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_['isNil'](_0x4ca9b8[_0xdce1('0x65')][_0xdce1('0x9a')])){throw new APIBadRequestError(_0xdce1('0x9b'));}if(_[_0xdce1('0x9c')](_0x4ca9b8[_0xdce1('0x65')][_0xdce1('0x65')])){throw new APIBadRequestError(_0xdce1('0x9d'));}var _0xb6437e=_0x4ca9b8['body'][_0xdce1('0x38')]&&_0x4ca9b8[_0xdce1('0x65')][_0xdce1('0x3e')];return db[_0xdce1('0x9e')][_0xdce1('0x71')]()[_0xdce1('0x19')](function(_0xb748e0){if(!_0xb748e0){throw new Error(_0xdce1('0x9f'));}_0x8236e9=Object[_0xdce1('0x51')](_0xb748e0)[_0xdce1('0x59')](function(_0x4b6daf){return![_0xdce1('0xa0'),_0xdce1('0xa1')][_0xdce1('0xa2')](_0x4b6daf);});_0x42840a=Object[_0xdce1('0x51')](_0xb748e0)[_0xdce1('0x59')](function(_0x3b2817){return![_0xdce1('0xa0'),'updatedAt',_0xdce1('0xa3'),_0xdce1('0xa4')]['includes'](_0x3b2817);});if(!_[_0xdce1('0xa2')](_0x42840a,_0x4ca9b8[_0xdce1('0x65')][_0xdce1('0x9a')])){throw new APIBadRequestError(_0xdce1('0xa5')+_0x42840a[_0xdce1('0x86')](',\x20'));}_0x43fb3d[_0x4ca9b8[_0xdce1('0x65')][_0xdce1('0x9a')]]=_0x4ca9b8[_0xdce1('0x65')][_0xdce1('0x99')];})[_0xdce1('0x19')](function(){return db[_0xdce1('0x4c')][_0xdce1('0x63')]({'where':{'id':_0x4ca9b8[_0xdce1('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0xdce1('0xa6'),'include':[{'model':db[_0xdce1('0x9e')],'as':_0xdce1('0xa7'),'where':_0x43fb3d,'limit':0x1,'order':[[_0xdce1('0xa1'),'DESC']]}]},{'model':db[_0xdce1('0xa8')],'as':_0xdce1('0xa9')},{'model':db[_0xdce1('0xaa')],'as':_0xdce1('0xaa'),'include':[{'model':db[_0xdce1('0xaa')],'as':_0xdce1('0xab'),'attributes':['id',_0xdce1('0xac')],'raw':!![]}]}]});})[_0xdce1('0x19')](function(_0x4b120c){if(!_0x4b120c){throw new APINotFoundError(util[_0xdce1('0x42')](_0xdce1('0xad'),_0x4ca9b8[_0xdce1('0x5e')]['id']));}if(_0xb6437e){return checkWebsiteInterval(_0x4b120c);}return _0x4b120c;})['then'](function(_0xebcc5f){_0x46e860[_0xdce1('0xae')]=_0xebcc5f;_0x46e860[_0xdce1('0xaf')]=_[_0xdce1('0xb0')](_0xebcc5f[_0xdce1('0xa9')],[_0xdce1('0xb1')],[_0xdce1('0xb2')]);if(_0x46e860[_0xdce1('0xae')][_0xdce1('0xa9')]){delete _0x46e860[_0xdce1('0xae')][_0xdce1('0xa9')];}_0x46e860[_0xdce1('0xb3')]=_0xebcc5f[_0xdce1('0xa6')]||{'id':_0xebcc5f[_0xdce1('0xa4')]};if(_0x46e860[_0xdce1('0xb3')]&&_0x46e860['list']['Contacts']['length']){return _0x46e860['list'][_0xdce1('0xa7')][0x0];}var _0x1de560=_['defaults'](_0x4ca9b8[_0xdce1('0x65')],{'firstName':_0x4ca9b8[_0xdce1('0x65')][_0xdce1('0x99')],'ListId':_0xebcc5f[_0xdce1('0xa4')]});_0x1de560[_0x4ca9b8[_0xdce1('0x65')][_0xdce1('0x9a')]]=_0x4ca9b8[_0xdce1('0x65')][_0xdce1('0x99')];return db[_0xdce1('0x9e')][_0xdce1('0x64')](_0x1de560,{'fields':_0x8236e9,'raw':!![]});})['then'](function(_0x1d1624){_0x46e860['contact']=_0x1d1624;var _0x20e051=createInteractionObject(_0x4ca9b8[_0xdce1('0x5e')]['id'],_0x4ca9b8[_0xdce1('0x65')],_0x4ca9b8['headers'],_0x1d1624);var _0x51ac1f={'ChatWebsiteId':_0x4ca9b8[_0xdce1('0x5e')]['id']};if(_0x4ca9b8['body'][_0xdce1('0xb4')]){_0x51ac1f[_0xdce1('0xb4')]=_0x4ca9b8[_0xdce1('0x65')][_0xdce1('0xb4')];_0x51ac1f[_0xdce1('0xb5')]=![];return db[_0xdce1('0xb6')][_0xdce1('0x63')]({'where':_0x51ac1f})[_0xdce1('0x19')](function(_0x14c821){var _0x2825df=_0x4ca9b8[_0xdce1('0x65')]['customerIp']&&_0x4ca9b8['body'][_0xdce1('0x3e')];if(_0x14c821){_0x15e366=!![];return _0x14c821;}else if(!_0x2825df&&_0x14c821&&_0x14c821[_0xdce1('0xb5')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x20e051[_0xdce1('0xb4')]=_0x4ca9b8['body'][_0xdce1('0xb4')];_0x20e051[_0xdce1('0xb7')]=_0x4ca9b8['body'][_0xdce1('0xb7')];return db['ChatInteraction'][_0xdce1('0x64')](_0x20e051);});}_0x51ac1f[_0xdce1('0xb8')]=_0x1d1624['id'];if(_0x4ca9b8[_0xdce1('0x65')]['interaction']&&_0x4ca9b8[_0xdce1('0x65')]['interaction']['id']){_0x51ac1f['id']=_0x4ca9b8[_0xdce1('0x65')][_0xdce1('0xb9')]['id'];return db[_0xdce1('0xb6')][_0xdce1('0x63')]({'where':_0x51ac1f})[_0xdce1('0x19')](function(_0x1847be){var _0x4c0ce2=_0x4ca9b8[_0xdce1('0x65')]['customerIp']&&_0x4ca9b8[_0xdce1('0x65')][_0xdce1('0x3e')];if(!_0x4c0ce2&&_0x1847be&&_0x1847be['closed']){throw new APIConflictError(_0xdce1('0xba'));}else if(_0x1847be){_0x15e366=!![];return _0x1847be;}else{return db[_0xdce1('0xb6')]['create'](_0x20e051);}});}return db[_0xdce1('0xb6')][_0xdce1('0x64')](_0x20e051);})[_0xdce1('0x19')](function(_0x17b704){if(!_0x15e366){return _0x17b704;}var _0x578b78={'from':(_0x46e860[_0xdce1('0xbb')][_0xdce1('0x3b')]||'')+'\x20'+(_0x46e860[_0xdce1('0xbb')][_0xdce1('0x3c')]||'')};if(_0x4ca9b8[_0xdce1('0x65')][_0xdce1('0xb4')]&&_0x4ca9b8[_0xdce1('0x65')][_0xdce1('0xbc')]&&_0x4ca9b8[_0xdce1('0x65')]['threadId']!=_0x4ca9b8[_0xdce1('0x65')][_0xdce1('0xbc')]){_0x578b78[_0xdce1('0xb4')]=_0x4ca9b8['body'][_0xdce1('0xbc')];}return _0x17b704['update'](_0x578b78);})[_0xdce1('0x19')](function(_0x354319){_0x46e860[_0xdce1('0xb9')]=_0x354319[_0xdce1('0x30')]({'plain':!![]});_0x46e860[_0xdce1('0xb9')][_0xdce1('0xbd')]=!_0x15e366;if(_0x46e860[_0xdce1('0xb9')][_0xdce1('0xbd')]){if(_0x46e860[_0xdce1('0xae')][_0xdce1('0xbe')]){_0x46e860['applications'][_0xdce1('0xbf')]({'id':0x0,'priority':_0x46e860['applications'][_0xdce1('0x54')]+0x1,'app':'close','appdata':_0xdce1('0xc0'),'interval':_0xdce1('0xc1')});}}return db[_0xdce1('0xc2')]['create']({'body':_0x4ca9b8[_0xdce1('0x65')]['body'],'ChatWebsiteId':_0x4ca9b8['params']['id'],'ChatInteractionId':_0x354319['id'],'direction':'in','ContactId':_0x46e860['contact']['id'],'AttachmentId':_0x4ca9b8[_0xdce1('0x65')][_0xdce1('0xc3')]});})[_0xdce1('0x19')](function(_0x1bdf50){_0x46e860[_0xdce1('0x21')]=_0x1bdf50;if(!_0x46e860[_0xdce1('0xb9')][_0xdce1('0xc4')]){return;}return db[_0xdce1('0xc5')][_0xdce1('0x63')]({'attributes':['id',_0xdce1('0x3f')],'where':{'id':_0x46e860[_0xdce1('0xb9')][_0xdce1('0xc4')]}});})['then'](function(_0x24f641){if(_0x24f641){_0x46e860[_0xdce1('0xaf')][_0xdce1('0xc6')]({'id':0x0,'priority':0x0,'app':_0xdce1('0xc7'),'appdata':_0x24f641[_0xdce1('0x3f')]+','+(_0x46e860[_0xdce1('0xae')]['waitForTheAssignedAgent']||0xa),'interval':_0xdce1('0xc1')});_0x46e860[_0xdce1('0xc8')]=!![];}if(!_0x46e860[_0xdce1('0xb9')][_0xdce1('0xc9')]){return;}return db[_0xdce1('0xca')][_0xdce1('0x63')]({'attributes':['id',_0xdce1('0x3f')],'where':{'id':_0x46e860[_0xdce1('0xb9')][_0xdce1('0xc9')]}});})[_0xdce1('0x19')](function(_0x16e5ed){if(_0x16e5ed){_0x46e860['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xdce1('0xcb'),'appdata':_0x16e5ed[_0xdce1('0x3f')]+','+(_0x46e860[_0xdce1('0xae')][_0xdce1('0xcc')]||0x12c),'interval':_0xdce1('0xc1')});}return respondWithRpcPromise(_0xdce1('0xcd'),_0xdce1('0xce'),_0x46e860);})['then'](function(_0x235171){respondWithRpcPromise('EventManager','EventManager',{'event':_0xdce1('0x97'),'message':_0x235171},client9002);return _0x235171;})[_0xdce1('0x19')](respondWithResult(_0x23ca45,null))['catch'](APIHandleError(_0x23ca45));};exports[_0xdce1('0xcf')]=function(_0x52069e,_0x4dac8c){var _0x1bdcc2,_0x1a5585,_0x4b73ae;var _0x405fb1=[];var _0x48cc02={};var _0x2a707c=_0x52069e['files']||[];var _0x357add=[];var _0x23ea53;return db[_0xdce1('0x9e')][_0xdce1('0x71')]()[_0xdce1('0x19')](function(_0x12d87a){if(!_0x12d87a){throw new db[(_0xdce1('0xd0'))][(_0xdce1('0xd1'))](_0xdce1('0xd2'));}_0x405fb1=_[_0xdce1('0xd3')](_[_0xdce1('0x51')](_0x12d87a),['createdAt',_0xdce1('0xa1'),'CompanyId','ListId']);if(_0x52069e[_0xdce1('0x65')]['id']){delete _0x52069e['body']['id'];}if(_[_0xdce1('0x8f')](_0x52069e[_0xdce1('0x65')][_0xdce1('0x99')])){throw _0x4dac8c['status'](0x1f4)[_0xdce1('0x34')](new db[(_0xdce1('0xd0'))][(_0xdce1('0xd1'))](_0xdce1('0xd4')));}if(_['isNil'](_0x52069e[_0xdce1('0x65')][_0xdce1('0x65')])||_0x52069e['body']['body']===''){throw _0x4dac8c[_0xdce1('0x25')](0x1f4)[_0xdce1('0x34')](new db[(_0xdce1('0xd0'))][(_0xdce1('0xd1'))](_0xdce1('0xd5')));}if(_[_0xdce1('0x8f')](_0x52069e[_0xdce1('0x65')][_0xdce1('0xd6')])){throw _0x4dac8c[_0xdce1('0x25')](0x1f4)[_0xdce1('0x34')](new db[(_0xdce1('0xd0'))]['ValidationError'](_0xdce1('0xd7')+_0x405fb1));}if(!_[_0xdce1('0xa2')](_0x405fb1,_0x52069e[_0xdce1('0x65')]['mapKeyOffline'])){throw _0x4dac8c[_0xdce1('0x25')](0x1f4)[_0xdce1('0x34')](new db[(_0xdce1('0xd0'))][(_0xdce1('0xd1'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x405fb1));}_0x48cc02[_0x52069e[_0xdce1('0x65')][_0xdce1('0xd6')]]=_0x52069e['body'][_0xdce1('0x99')];})[_0xdce1('0x19')](function(){return db[_0xdce1('0x4c')][_0xdce1('0x63')]({'where':{'id':_0x52069e[_0xdce1('0x5e')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0xdce1('0xd8')],'as':_0xdce1('0xd8')}]});})[_0xdce1('0x19')](handleEntityNotFound(_0x4dac8c,null))['then'](function(_0x30bf7b){if(_0x30bf7b&&_0x30bf7b[_0xdce1('0xa6')]){_0x1a5585=_0x30bf7b;var _0x47c373=_[_0xdce1('0x11')](_0x52069e[_0xdce1('0x65')],{'firstName':_0x52069e[_0xdce1('0x65')][_0xdce1('0x99')],'phone':_0x52069e[_0xdce1('0x65')][_0xdce1('0x99')],'ListId':_0x30bf7b[_0xdce1('0xa4')]});_0x47c373[_0x52069e[_0xdce1('0x65')]['mapKeyOffline']]=_0x52069e[_0xdce1('0x65')][_0xdce1('0x99')];return db[_0xdce1('0x9e')]['findOrCreate']({'where':_0x48cc02,'defaults':_0x47c373});}})[_0xdce1('0xd9')](function(_0x26f655){if(_0x26f655){_0x4b73ae=_0x26f655;var _0x35708b=fs[_0xdce1('0xda')](path[_0xdce1('0x86')](config[_0xdce1('0x87')],'server/files/templates/chatOfflineMessage.ejs'),_0xdce1('0xdb'));var _0x2aa2ee=ejs[_0xdce1('0xdc')](_0x35708b,{'body':_[_0xdce1('0xdd')](_0x52069e['body']['body']),'bodyTitle':_0x1a5585[_0xdce1('0xde')]});return db[_0xdce1('0xdf')][_0xdce1('0x64')]({'body':_0x2aa2ee,'plainBody':htmlToText[_0xdce1('0xe0')](_0x2aa2ee),'ContactId':_0x26f655['id'],'ChatWebsiteId':_0x1a5585['id']});}})[_0xdce1('0x19')](function(_0x4770bb){_0x23ea53=_0x4770bb;if(_0x2a707c[_0xdce1('0x54')]){var _0x3a821a=_0x2a707c[_0xdce1('0x4b')](function(_0x10b6ab){return{'name':_0x10b6ab[_0xdce1('0xe1')],'basename':_0x10b6ab[_0xdce1('0x80')],'type':_0x10b6ab['mimetype'],'ChatOfflineMessageId':_0x4770bb['id']};});_0x357add=_0x3a821a[_0xdce1('0x4b')](_0x5b9532=>{var _0x3f0dd0={'filename':_0x5b9532['name'],'path':path[_0xdce1('0x86')](config['root'],_0xdce1('0xe2'),_0xdce1('0xe3'),_0xdce1('0xe4'),_0xdce1('0xe5'),_0x5b9532[_0xdce1('0xe6')])};return _0x3f0dd0;});if(!_0x1a5585['openNewInteraction']){return db[_0xdce1('0xe7')][_0xdce1('0xe8')](function(_0x1512f6){return db[_0xdce1('0xe9')][_0xdce1('0xea')](_0x3a821a,{'transaction':_0x1512f6});});}}})['then'](function(){if(_0x23ea53){_0x1bdcc2=_0x23ea53;return db['MailAccount'][_0xdce1('0x7b')]({'where':{'service':!![]},'include':[{'model':db[_0xdce1('0xeb')],'as':_0xdce1('0xec'),'raw':!![],'include':[{'model':db[_0xdce1('0xed')],'as':_0xdce1('0xed'),'raw':!![]}]}]});}})[_0xdce1('0x19')](function(_0x641ef1){if(_0x641ef1&&_0x641ef1[_0xdce1('0xec')]&&_0x1a5585['forwardOffline']&&_0x1a5585[_0xdce1('0xee')]){var _0x51d132=_0x641ef1['getSmtpOptions']();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x51d132,'message':{'from':util['format'](_0xdce1('0xef'),_0x641ef1[_0xdce1('0x3f')],_0x641ef1[_0xdce1('0xf0')]||_0x641ef1[_0xdce1('0xec')]['user']),'to':_0x1a5585[_0xdce1('0xee')],'subject':_0x1a5585[_0xdce1('0xf1')],'html':_0x1bdcc2[_0xdce1('0x65')],'attachments':_0x357add}},client9003)[_0xdce1('0x19')](function(){return _0x1bdcc2;})[_0xdce1('0x23')](function(_0x614e58){logger[_0xdce1('0x20')](_0x614e58);});}})[_0xdce1('0x19')](function(){if(_0x1a5585&&_0x1a5585['openNewInteraction']&&_0x1a5585[_0xdce1('0xf2')]){var _0x5101e2=[];if(_0x2a707c[_0xdce1('0x54')]){_0x5101e2=_0x2a707c[_0xdce1('0x4b')](function(_0x543ccc){return{'name':_0x543ccc[_0xdce1('0xe1')],'basename':_0x543ccc['filename'],'type':_0x543ccc[_0xdce1('0xf3')],'ChatOfflineMessageId':_0x23ea53['id']};});}var _0x5f534d;if(!_['isNil'](_0x1a5585[_0xdce1('0xf4')])){var _0x5d13ed=_['map'](_0x52069e[_0xdce1('0x65')],function(_0x7a2b1f){return _0x7a2b1f;});var _0x214837=_[_0xdce1('0xf5')](_0x5d13ed)[0x0];var _0x3404a1=_[_0xdce1('0xf6')](_0x214837,function(_0x1be673){return _0x1be673;});_0x5f534d=_0x3404a1[0x1][_0x1a5585[_0xdce1('0xf4')]];}var _0x426a09={'from':_0x4b73ae[_0xdce1('0xf0')],'firstName':_0x4b73ae[_0xdce1('0x3b')],'lastName':_0x4b73ae[_0xdce1('0x3c')],'mapKey':'email','message':{'from':_0x4b73ae['email'],'to':_0x1a5585[_0xdce1('0xd8')][_0xdce1('0xf0')],'cc':'','subject':_[_0xdce1('0x8f')](_0x5f534d)?_0x1a5585[_0xdce1('0xf1')]:_0x5f534d,'messageId':'','sentAt':new Date(),'attach':_0x5101e2[_0xdce1('0x54')],'attachments':_0x5101e2,'originChannel':'Chat','ChatWebsiteId':_0x1a5585['id'],'ChatOfflineMessageId':_0x1bdcc2['id'],'originTo':_0x1a5585[_0xdce1('0xd8')]['email']},'body':_0x1bdcc2['body']};var _0x70856e={'account':{'id':_0x1a5585[_0xdce1('0xf2')]},'body':_0x426a09,'log':_0xdce1('0xf7')};return respondWithRpcPromise(_0xdce1('0xf7'),_0xdce1('0xf8'),_0x70856e,client9001)['then'](function(){return _0x1bdcc2;})['catch'](function(_0x213387){logger[_0xdce1('0x20')](_0x213387);});}return;})[_0xdce1('0x19')](function(){if(_0x1bdcc2){return _0x1bdcc2;}})[_0xdce1('0x19')](respondWithResult(_0x4dac8c,null))[_0xdce1('0x23')](function(){for(var _0x3148c3 of _0x2a707c){var _0x173ba0=path[_0xdce1('0x86')](config[_0xdce1('0x87')],_0xdce1('0xe2'),'files','attachments',_0xdce1('0xe5'),_0x3148c3[_0xdce1('0x80')]);fs_extra[_0xdce1('0xf9')](_0x173ba0)[_0xdce1('0x23')](function(_0x316c64){logger[_0xdce1('0x20')]('Could\x20not\x20remove\x20attachment\x20file',_0x173ba0,_0x316c64);});}});};exports[_0xdce1('0xfa')]=function(_0x1f4381,_0x4dfa8a){return db[_0xdce1('0xb6')]['find']({'where':{'id':_0x1f4381[_0xdce1('0x5e')]['id']}})[_0xdce1('0x19')](handleEntityNotFound(_0x4dfa8a,null))[_0xdce1('0x19')](function(_0x1ec092){if(_0x1ec092){return _0x1ec092[_0xdce1('0xfa')](_0x1f4381[_0xdce1('0x65')]['ids'],_[_0xdce1('0xfb')](_0x1f4381[_0xdce1('0x65')],[_0xdce1('0x78'),'id'])||{});}})[_0xdce1('0x19')](respondWithResult(_0x4dfa8a,null))[_0xdce1('0x23')](handleError(_0x4dfa8a,null));};exports[_0xdce1('0xfc')]=function(_0x21002d,_0x316bfd){var _0x170175={'raw':![],'where':{}};var _0x57d96c={};var _0x4bc975={'count':0x0,'rows':[]};return db[_0xdce1('0x4c')][_0xdce1('0x7b')]({'where':{'id':_0x21002d[_0xdce1('0x5e')]['id']}})[_0xdce1('0x19')](handleEntityNotFound(_0x316bfd,null))[_0xdce1('0x19')](function(_0x47f330){if(_0x47f330){_0x57d96c[_0xdce1('0x46')]=_[_0xdce1('0x51')](db[_0xdce1('0xb6')][_0xdce1('0x4d')]);_0x57d96c['query']=_[_0xdce1('0x51')](_0x21002d['query']);_0x57d96c['filters']=_['intersection'](_0x57d96c[_0xdce1('0x46')],_0x57d96c[_0xdce1('0x50')]);_0x170175[_0xdce1('0x52')]=_[_0xdce1('0x60')](_0x57d96c[_0xdce1('0x46')],qs[_0xdce1('0x53')](_0x21002d[_0xdce1('0x50')]['fields']));_0x170175[_0xdce1('0x52')]=_0x170175[_0xdce1('0x52')][_0xdce1('0x54')]?_0x170175[_0xdce1('0x52')]:_0x57d96c[_0xdce1('0x46')];if(!_0x21002d[_0xdce1('0x50')]['hasOwnProperty'](_0xdce1('0x74'))){_0x170175[_0xdce1('0x2b')]=qs[_0xdce1('0x2b')](_0x21002d[_0xdce1('0x50')][_0xdce1('0x2b')]);_0x170175['offset']=qs['offset'](_0x21002d[_0xdce1('0x50')][_0xdce1('0x28')]);}_0x170175[_0xdce1('0x75')]=qs[_0xdce1('0x55')](_0x21002d[_0xdce1('0x50')][_0xdce1('0x55')]);_0x170175[_0xdce1('0x56')]=qs[_0xdce1('0x57')](_[_0xdce1('0x58')](_0x21002d[_0xdce1('0x50')],_0x57d96c[_0xdce1('0x57')]));_0x170175['where'][_0xdce1('0x79')]=_0x47f330['id'];if(_0x21002d[_0xdce1('0x50')][_0xdce1('0x59')]){_0x170175[_0xdce1('0x56')]=_[_0xdce1('0x5a')](_0x170175[_0xdce1('0x56')],{'$or':_[_0xdce1('0x4b')](_0x170175['attributes'],function(_0x431327){var _0x32eecf={};_0x32eecf[_0x431327]={'$like':'%'+_0x21002d['query'][_0xdce1('0x59')]+'%'};return _0x32eecf;})});}_0x170175=_[_0xdce1('0x5a')]({},_0x170175,_0x21002d[_0xdce1('0x5c')]);return db['ChatInteraction'][_0xdce1('0x2a')]({'where':_0x170175['where']})[_0xdce1('0x19')](function(_0x10738b){_0x4bc975[_0xdce1('0x2a')]=_0x10738b;if(_0x21002d[_0xdce1('0x50')][_0xdce1('0x61')]){_0x170175[_0xdce1('0x62')]=[{'model':db[_0xdce1('0x9e')],'as':_0xdce1('0xfd'),'required':![]},{'model':db[_0xdce1('0xc5')],'as':'Owner','attributes':[_0xdce1('0x3f'),_0xdce1('0xfe'),_0xdce1('0xff')],'required':![]},{'model':db[_0xdce1('0x100')],'as':_0xdce1('0x101'),'attributes':['id',_0xdce1('0x3f'),_0xdce1('0x102')],'where':_0x21002d[_0xdce1('0x50')][_0xdce1('0x103')]?{'id':_0x21002d['query'][_0xdce1('0x103')]}:undefined,'required':_0x21002d['query'][_0xdce1('0x103')]?!![]:![]}];}return db['ChatInteraction'][_0xdce1('0x76')](_0x170175);})[_0xdce1('0x19')](function(_0x195637){_0x4bc975[_0xdce1('0x5d')]=_0x195637;return _0x4bc975;});}})[_0xdce1('0x19')](respondWithFilteredResult(_0x316bfd,_0x170175))[_0xdce1('0x23')](handleError(_0x316bfd,null));};exports[_0xdce1('0x104')]=function(_0x3dc681,_0xcfbe32){var _0x49c44e=0x0;var _0x4e54ba=0x0;var _0x53828a=![];var _0x5a2928;var _0x1186d6;return db[_0xdce1('0x4c')]['find']({'where':{'id':_0x3dc681[_0xdce1('0x5e')]['id']},'include':[{'model':db[_0xdce1('0xaa')],'as':_0xdce1('0xaa'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xdce1('0xac')]}]}]})[_0xdce1('0x19')](handleEntityNotFound(_0xcfbe32,null))[_0xdce1('0x19')](function(_0x1028f6){if(_0x1028f6){_0x5a2928=_0x1028f6;return _0x1028f6[_0xdce1('0x105')]({'raw':!![]});}})[_0xdce1('0x19')](function(_0x1fe22a){if(_0x5a2928){if(_0x1fe22a){_0x1186d6=_0x1fe22a;}}return require(_0xdce1('0x106'))[_0xdce1('0x107')]();})[_0xdce1('0x19')](function(_0x3bf5c0){if(_0x3bf5c0){_0x4e54ba=_0x3bf5c0['virtual'];_0x53828a=_0x3bf5c0[_0xdce1('0x89')];}})[_0xdce1('0x19')](function(){return db[_0xdce1('0xb6')][_0xdce1('0x2a')]({'where':{'closed':![]}});})[_0xdce1('0x19')](function(_0x2dfaf4){_0x49c44e=_0x2dfaf4;if(_0x4e54ba&&_0x2dfaf4>_0x4e54ba){return db['License'][_0xdce1('0x7b')]({'where':{'id':0x1}})['then'](function(_0x5c64c4){if(_0x5c64c4){_0x5c64c4[_0xdce1('0x108')](_0xdce1('0x109'));}});}})[_0xdce1('0x19')](function(){var _0x4e4b57=_0x5a2928[_0xdce1('0xaa')];var _0x5cfa24=_0x5a2928[_0xdce1('0x10a')]||undefined;return _0x4e4b57?_0x4e4b57[_0xdce1('0x96')](_0x5cfa24):!![];})['then'](function(_0x449fb2){var _0x508e76=fs[_0xdce1('0xda')](path[_0xdce1('0x86')](config['root'],_0xdce1('0x10b')),_0xdce1('0xdb'));var _0x3e57bf=_0xdce1('0x10c');var _0x324136=![];var _0x539f40,_0x4b98e3;if(_0x3dc681[_0xdce1('0x10d')][_0xdce1('0x3e')]){_0x539f40=new URL(_0x3dc681[_0xdce1('0x10d')][_0xdce1('0x3e')])[_0xdce1('0x10e')];}else if(_0x3dc681[_0xdce1('0x10d')][_0xdce1('0x10e')]){_0x539f40=new URL(_0x3dc681[_0xdce1('0x10d')][_0xdce1('0x10e')])['origin'];}else{_0x539f40=_0xdce1('0x10f');}_0x4b98e3=typeof _0x5a2928[_0xdce1('0x66')][_0xdce1('0x67')](',')[_0xdce1('0x63')](function(_0x105db8){return wildcardUtils[_0xdce1('0x110')](_0x105db8,_0x539f40);})!=='undefined';var _0x1a455a={'chatVersion':_0x3e57bf,'chatWebsiteAddressOrigin':_0x4b98e3?_0x539f40:_0x5a2928[_0xdce1('0x66')],'remote':_0x5a2928['remote'],'query':querystring[_0xdce1('0x1e')](_[_0xdce1('0x5a')](_0x5a2928[_0xdce1('0x30')]({'plain':!![]}),{'customerIp':_0x3dc681[_0xdce1('0x10d')][_0xdce1('0x3a')]||_0x3dc681['headers'][_0xdce1('0x111')]||_0x3dc681[_0xdce1('0x112')]['remoteAddress']||_0x3dc681['ip'],'referer':_0x3dc681['headers'][_0xdce1('0x3e')],'openedInteractions':_0x49c44e,'maxInteractions':_0x4e54ba,'virtual':_0x53828a[_0xdce1('0x113')],'online':_0x449fb2,'custom':_0x53828a,'address':_0x4b98e3?_0x539f40:null}))[_0xdce1('0x114')](/'/g,'\x5c\x27')};_0xcfbe32['send'](ejs[_0xdce1('0xdc')](Mustache[_0xdce1('0xdc')](_0x508e76,_0x1a455a),{'proactiveActions':_0x1186d6,'alignment':_0x5a2928[_0xdce1('0x115')],'verticalAlignment':_0x5a2928[_0xdce1('0x116')],'div_color':_0x5a2928[_0xdce1('0x102')],'labelText':_0x5a2928['labelText'],'text_color':_0x5a2928['textColor'],'text_button_color':_0x5a2928['textButtonColor'],'button_color':_0x5a2928[_0xdce1('0x117')],'background_color':_0x5a2928[_0xdce1('0x118')],'hideWhenOffline':_0x5a2928[_0xdce1('0x119')],'intervalId':_0x5a2928[_0xdce1('0x11a')],'isDevelopment':_0x324136,'chatVersion':_0x3e57bf}));})['catch'](handleError(_0xcfbe32,null));};exports['addApplications']=function(_0x5a07a2,_0x1c1896){var _0x17b6df=_0x5a07a2[_0xdce1('0x5e')]['id'];var _0x4682bf=_0x5a07a2[_0xdce1('0x65')];var _0x205167=0xc8;var _0x28c6f6=null;return db['sequelize'][_0xdce1('0xe8')]({'isolationLevel':db[_0xdce1('0xe7')][_0xdce1('0x11b')][_0xdce1('0x11c')][_0xdce1('0x11d')]},function(_0x215870){return db[_0xdce1('0x4c')][_0xdce1('0x7b')]({'where':{'id':_0x17b6df},'transaction':_0x215870})['then'](function(_0x2394ff){if(_0x2394ff){return db[_0xdce1('0xa8')][_0xdce1('0x2f')]({'where':{'ChatWebsiteId':_0x17b6df},'transaction':_0x215870})[_0xdce1('0x19')](function(){var _0x5ca20=_[_0xdce1('0x4b')](_0x4682bf,function(_0x1fabbb){_0x1fabbb[_0xdce1('0x79')]=_0x17b6df;return _0x1fabbb;});return db[_0xdce1('0xa8')]['bulkCreate'](_0x5ca20,{'transaction':_0x215870});});}else{_0x205167=0x194;_0x28c6f6=[];}});})[_0xdce1('0x19')](function(){if(_0x205167!==0x194){return db[_0xdce1('0xa8')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x17b6df},'order':_0xdce1('0xb1')})['then'](function(_0x1673ad){_0x28c6f6=_0x1673ad;});}})[_0xdce1('0x23')](function(_0xd421f0){_0x205167=0x1f4;logger[_0xdce1('0x20')](_0xd421f0['stack']);if(_0xd421f0[_0xdce1('0x3f')]){delete _0xd421f0[_0xdce1('0x3f')];}_0x28c6f6=_0xd421f0;})['finally'](function(){if(_0x28c6f6===null){_0x1c1896['sendStatus'](_0x205167);}else{if(_0x205167===0x1f4){_0x1c1896[_0xdce1('0x25')](_0x205167)[_0xdce1('0x34')](_0x28c6f6);}else{_0x1c1896[_0xdce1('0x25')](_0x205167)['json'](_0x28c6f6);}}});};exports[_0xdce1('0x11e')]=function(_0x2734b7,_0x534d7c){var _0xcd1e1a={};var _0x573b8e={};var _0x2a171f;var _0x4d6db8;return db[_0xdce1('0x4c')][_0xdce1('0x7b')]({'where':{'id':_0x2734b7[_0xdce1('0x5e')]['id']}})[_0xdce1('0x19')](handleEntityNotFound(_0x534d7c,null))['then'](function(_0x375886){if(_0x375886){_0x2a171f=_0x375886;_0x573b8e[_0xdce1('0x46')]=_[_0xdce1('0x51')](db[_0xdce1('0xa8')][_0xdce1('0x4d')]);_0x573b8e[_0xdce1('0x50')]=_['keys'](_0x2734b7['query']);_0x573b8e[_0xdce1('0x57')]=_['intersection'](_0x573b8e[_0xdce1('0x46')],_0x573b8e[_0xdce1('0x50')]);_0xcd1e1a[_0xdce1('0x52')]=_[_0xdce1('0x60')](_0x573b8e['model'],qs[_0xdce1('0x53')](_0x2734b7[_0xdce1('0x50')][_0xdce1('0x53')]));_0xcd1e1a[_0xdce1('0x52')]=_0xcd1e1a[_0xdce1('0x52')]['length']?_0xcd1e1a[_0xdce1('0x52')]:_0x573b8e[_0xdce1('0x46')];_0xcd1e1a['order']=qs[_0xdce1('0x55')](_0x2734b7['query'][_0xdce1('0x55')]);_0xcd1e1a[_0xdce1('0x56')]=qs[_0xdce1('0x57')](_[_0xdce1('0x58')](_0x2734b7[_0xdce1('0x50')],_0x573b8e[_0xdce1('0x57')]));if(_0x2734b7[_0xdce1('0x50')][_0xdce1('0x59')]){_0xcd1e1a[_0xdce1('0x56')]=_[_0xdce1('0x5a')](_0xcd1e1a[_0xdce1('0x56')],{'$or':_[_0xdce1('0x4b')](_0xcd1e1a[_0xdce1('0x52')],function(_0x2e9ae1){var _0x29ed4c={};_0x29ed4c[_0x2e9ae1]={'$like':'%'+_0x2734b7[_0xdce1('0x50')][_0xdce1('0x59')]+'%'};return _0x29ed4c;})});}_0xcd1e1a=_['merge']({},_0xcd1e1a,_0x2734b7['options']);return _0x2a171f[_0xdce1('0x11e')](_0xcd1e1a);}})[_0xdce1('0x19')](function(_0x109827){if(_0x109827){_0x4d6db8=_0x109827[_0xdce1('0x54')];if(!_0x2734b7['query'][_0xdce1('0x73')](_0xdce1('0x74'))){_0xcd1e1a[_0xdce1('0x2b')]=qs[_0xdce1('0x2b')](_0x2734b7[_0xdce1('0x50')][_0xdce1('0x2b')]);_0xcd1e1a[_0xdce1('0x28')]=qs[_0xdce1('0x28')](_0x2734b7[_0xdce1('0x50')][_0xdce1('0x28')]);}return _0x2a171f[_0xdce1('0x11e')](_0xcd1e1a);}})['then'](function(_0x4699a8){if(_0x4699a8){return _0x4699a8?{'count':_0x4d6db8,'rows':_0x4699a8}:null;}})[_0xdce1('0x19')](respondWithResult(_0x534d7c,null))[_0xdce1('0x23')](handleError(_0x534d7c,null));};exports['addProactiveActions']=function(_0x44476a,_0x25848a){return db[_0xdce1('0x11f')][_0xdce1('0x63')]({'where':{'id':_0x44476a[_0xdce1('0x5e')]['id']}})[_0xdce1('0x19')](handleEntityNotFound(_0x25848a,null))[_0xdce1('0x19')](function(_0x58fcd9){if(_0x58fcd9){return _0x58fcd9[_0xdce1('0x120')](_0x44476a[_0xdce1('0x65')][_0xdce1('0x78')],_[_0xdce1('0xfb')](_0x44476a[_0xdce1('0x65')],['ids','id'])||{});}})[_0xdce1('0x19')](respondWithResult(_0x25848a,null))[_0xdce1('0x23')](handleError(_0x25848a,null));};exports[_0xdce1('0x105')]=function(_0x570785,_0x2b1192){var _0x422667={};var _0x52b1d6={};var _0x2c57a1;var _0x4ffb79;return db[_0xdce1('0x4c')][_0xdce1('0x7b')]({'where':{'id':_0x570785['params']['id']}})['then'](handleEntityNotFound(_0x2b1192,null))[_0xdce1('0x19')](function(_0x5ae896){if(_0x5ae896){_0x2c57a1=_0x5ae896;_0x52b1d6[_0xdce1('0x46')]=_[_0xdce1('0x51')](db['ChatProactiveAction']['rawAttributes']);_0x52b1d6[_0xdce1('0x50')]=_[_0xdce1('0x51')](_0x570785[_0xdce1('0x50')]);_0x52b1d6[_0xdce1('0x57')]=_[_0xdce1('0x60')](_0x52b1d6[_0xdce1('0x46')],_0x52b1d6['query']);_0x422667['attributes']=_[_0xdce1('0x60')](_0x52b1d6[_0xdce1('0x46')],qs['fields'](_0x570785['query'][_0xdce1('0x53')]));_0x422667['attributes']=_0x422667[_0xdce1('0x52')][_0xdce1('0x54')]?_0x422667['attributes']:_0x52b1d6[_0xdce1('0x46')];_0x422667[_0xdce1('0x75')]=qs[_0xdce1('0x55')](_0x570785['query'][_0xdce1('0x55')]);_0x422667['where']=qs[_0xdce1('0x57')](_[_0xdce1('0x58')](_0x570785[_0xdce1('0x50')],_0x52b1d6[_0xdce1('0x57')]));if(_0x570785[_0xdce1('0x50')][_0xdce1('0x59')]){_0x422667[_0xdce1('0x56')]=_['merge'](_0x422667[_0xdce1('0x56')],{'$or':_['map'](_0x422667[_0xdce1('0x52')],function(_0x1dc268){var _0x48963b={};_0x48963b[_0x1dc268]={'$like':'%'+_0x570785[_0xdce1('0x50')][_0xdce1('0x59')]+'%'};return _0x48963b;})});}_0x422667=_['merge']({},_0x422667,_0x570785[_0xdce1('0x5c')]);return _0x2c57a1[_0xdce1('0x105')](_0x422667);}})[_0xdce1('0x19')](function(_0x1b8764){if(_0x1b8764){_0x4ffb79=_0x1b8764[_0xdce1('0x54')];if(!_0x570785['query']['hasOwnProperty'](_0xdce1('0x74'))){_0x422667[_0xdce1('0x2b')]=qs['limit'](_0x570785['query'][_0xdce1('0x2b')]);_0x422667['offset']=qs[_0xdce1('0x28')](_0x570785['query'][_0xdce1('0x28')]);}return _0x2c57a1[_0xdce1('0x105')](_0x422667);}})[_0xdce1('0x19')](function(_0x320591){if(_0x320591){return _0x320591?{'count':_0x4ffb79,'rows':_0x320591}:null;}})[_0xdce1('0x19')](respondWithResult(_0x2b1192,null))[_0xdce1('0x23')](handleError(_0x2b1192,null));};exports[_0xdce1('0x121')]=function(_0x24753e,_0x34e0c1){var _0x263a51=_0x24753e['query'][_0xdce1('0x122')]===_0xdce1('0x123')?_0xdce1('0x124'):_0xdce1('0x125');return db[_0xdce1('0x4c')][_0xdce1('0x63')]({'attributes':['id',_0x263a51],'where':{'id':_0x24753e[_0xdce1('0x5e')]['id']}})[_0xdce1('0x19')](handleEntityNotFound(_0x34e0c1,null))['then'](function(_0x42e5b7){if(_0x42e5b7){var _0x5ae4f2=_0x42e5b7[_0x263a51];var _0x40c9eb=_0x5ae4f2&&_0x5ae4f2['items']?_0x5ae4f2['items']:[];_0x34e0c1[_0xdce1('0x34')]({'fromKey':_[_0xdce1('0x8f')](_0x5ae4f2[_0xdce1('0x126')])?undefined:_0x5ae4f2[_0xdce1('0x126')],'count':_0x40c9eb['length'],'rows':_0x40c9eb});}})[_0xdce1('0x23')](handleError(_0x34e0c1,null));};exports[_0xdce1('0x127')]=function(_0x4e3be3,_0xced005){var _0x2750cf={'raw':![],'where':{}};var _0x5843f8={};var _0x2c2c81={'count':0x0,'rows':[]};return db[_0xdce1('0x4c')][_0xdce1('0x7b')]({'where':{'id':_0x4e3be3[_0xdce1('0x5e')]['id']}})[_0xdce1('0x19')](handleEntityNotFound(_0xced005,null))[_0xdce1('0x19')](function(_0x2bfcac){if(_0x2bfcac){_0x5843f8[_0xdce1('0x46')]=_[_0xdce1('0x51')](db[_0xdce1('0xdf')]['rawAttributes']);_0x5843f8['query']=_[_0xdce1('0x51')](_0x4e3be3[_0xdce1('0x50')]);_0x5843f8[_0xdce1('0x57')]=_[_0xdce1('0x60')](_0x5843f8[_0xdce1('0x46')],_0x5843f8[_0xdce1('0x50')]);_0x2750cf[_0xdce1('0x52')]=_['intersection'](_0x5843f8['model'],qs[_0xdce1('0x53')](_0x4e3be3[_0xdce1('0x50')][_0xdce1('0x53')]));_0x2750cf[_0xdce1('0x52')]=_0x2750cf[_0xdce1('0x52')][_0xdce1('0x54')]?_0x2750cf['attributes']:_0x5843f8[_0xdce1('0x46')];if(!_0x4e3be3[_0xdce1('0x50')][_0xdce1('0x73')](_0xdce1('0x74'))){_0x2750cf['limit']=qs[_0xdce1('0x2b')](_0x4e3be3[_0xdce1('0x50')][_0xdce1('0x2b')]);_0x2750cf['offset']=qs['offset'](_0x4e3be3[_0xdce1('0x50')][_0xdce1('0x28')]);}_0x2750cf[_0xdce1('0x75')]=qs[_0xdce1('0x55')](_0x4e3be3[_0xdce1('0x50')][_0xdce1('0x55')]);_0x2750cf['where']=qs[_0xdce1('0x57')](_[_0xdce1('0x58')](_0x4e3be3[_0xdce1('0x50')],_0x5843f8[_0xdce1('0x57')]));_0x2750cf['where'][_0xdce1('0x79')]=_0x2bfcac['id'];if(_0x4e3be3[_0xdce1('0x50')]['filter']){_0x2750cf[_0xdce1('0x56')]=_['merge'](_0x2750cf[_0xdce1('0x56')],{'$or':_[_0xdce1('0x4b')](_0x2750cf['attributes'],function(_0x320d3d){var _0x21fdff={};_0x21fdff[_0x320d3d]={'$like':'%'+_0x4e3be3[_0xdce1('0x50')][_0xdce1('0x59')]+'%'};return _0x21fdff;})});}_0x2750cf=_[_0xdce1('0x5a')]({},_0x2750cf,_0x4e3be3[_0xdce1('0x5c')]);return db['ChatOfflineMessage'][_0xdce1('0x2a')]({'where':_0x2750cf[_0xdce1('0x56')]})[_0xdce1('0x19')](function(_0x5abf39){_0x2c2c81[_0xdce1('0x2a')]=_0x5abf39;if(_0x4e3be3['query'][_0xdce1('0x61')]){_0x2750cf['include']=[{'all':!![]}];}else{_0x2750cf[_0xdce1('0x62')]=[{'model':db[_0xdce1('0x9e')],'as':'Contact','required':![]},{'model':db[_0xdce1('0xe9')],'as':'Attachments','required':![]}];}return db[_0xdce1('0xdf')][_0xdce1('0x76')](_0x2750cf);})['then'](function(_0x224adf){_0x2c2c81[_0xdce1('0x5d')]=_0x224adf;return _0x2c2c81;});}})['then'](respondWithFilteredResult(_0xced005,_0x2750cf))[_0xdce1('0x23')](handleError(_0xced005,null));};exports['addAgents']=function(_0x52f0e5,_0x3bc3b4){return db['ChatWebsite']['find']({'where':{'id':_0x52f0e5[_0xdce1('0x5e')]['id']}})[_0xdce1('0x19')](handleEntityNotFound(_0x3bc3b4,null))['then'](function(_0x565917){if(_0x565917){return _0x565917[_0xdce1('0x128')](_0x52f0e5[_0xdce1('0x65')]['ids'],_[_0xdce1('0xfb')](_0x52f0e5[_0xdce1('0x65')],[_0xdce1('0x78'),'id'])||{})[_0xdce1('0xd9')](function(_0x2ddd52){for(var _0x49fe4a=0x0;_0x49fe4a<_0x52f0e5[_0xdce1('0x65')][_0xdce1('0x78')]['length'];_0x49fe4a+=0x1){socket[_0xdce1('0x129')](_0xdce1('0x12a'),{'UserId':Number(_0x52f0e5['body'][_0xdce1('0x78')][_0x49fe4a]),'ChatWebsiteId':Number(_0x52f0e5[_0xdce1('0x5e')]['id'])});}return _0x2ddd52;});}})['then'](respondWithResult(_0x3bc3b4,null))[_0xdce1('0x23')](handleError(_0x3bc3b4,null));};exports[_0xdce1('0x12b')]=function(_0x2dd3b2,_0x2175ce){return db[_0xdce1('0x4c')][_0xdce1('0x63')]({'where':{'id':_0x2dd3b2[_0xdce1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2175ce,null))[_0xdce1('0x19')](function(_0x237b91){if(_0x237b91){return _0x237b91['removeAgents'](_0x2dd3b2[_0xdce1('0x50')][_0xdce1('0x78')])['then'](function(){if(_[_0xdce1('0x12c')](_0x2dd3b2[_0xdce1('0x50')][_0xdce1('0x78')])){for(var _0x5b4f2e=0x0;_0x5b4f2e<_0x2dd3b2[_0xdce1('0x50')][_0xdce1('0x78')][_0xdce1('0x54')];_0x5b4f2e+=0x1){socket[_0xdce1('0x129')](_0xdce1('0x12d'),{'UserId':Number(_0x2dd3b2[_0xdce1('0x50')]['ids'][_0x5b4f2e]),'ChatWebsiteId':Number(_0x2dd3b2['params']['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x2dd3b2[_0xdce1('0x50')][_0xdce1('0x78')]),'ChatWebsiteId':Number(_0x2dd3b2['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2175ce,null))[_0xdce1('0x23')](handleError(_0x2175ce,null));};exports[_0xdce1('0x12e')]=function(_0x2fb279,_0x48c189){var _0x33aa2f={};var _0x43615c={};var _0xc24998;var _0xd985e1;return db[_0xdce1('0x4c')][_0xdce1('0x7b')]({'where':{'id':_0x2fb279[_0xdce1('0x5e')]['id']}})[_0xdce1('0x19')](handleEntityNotFound(_0x48c189,null))[_0xdce1('0x19')](function(_0x302a40){if(_0x302a40){_0xc24998=_0x302a40;_0x43615c[_0xdce1('0x46')]=_['keys'](db[_0xdce1('0xc5')][_0xdce1('0x4d')]);_0x43615c[_0xdce1('0x50')]=_[_0xdce1('0x51')](_0x2fb279[_0xdce1('0x50')]);_0x43615c['filters']=_['intersection'](_0x43615c['model'],_0x43615c[_0xdce1('0x50')]);_0x33aa2f[_0xdce1('0x52')]=_[_0xdce1('0x60')](_0x43615c['model'],qs[_0xdce1('0x53')](_0x2fb279[_0xdce1('0x50')][_0xdce1('0x53')]));_0x33aa2f['attributes']=_0x33aa2f['attributes']['length']?_0x33aa2f[_0xdce1('0x52')]:_0x43615c[_0xdce1('0x46')];_0x33aa2f[_0xdce1('0x75')]=qs[_0xdce1('0x55')](_0x2fb279[_0xdce1('0x50')][_0xdce1('0x55')]);_0x33aa2f[_0xdce1('0x56')]=qs[_0xdce1('0x57')](_['pick'](_0x2fb279[_0xdce1('0x50')],_0x43615c[_0xdce1('0x57')]));if(_0x2fb279[_0xdce1('0x50')][_0xdce1('0x59')]){_0x33aa2f[_0xdce1('0x56')]=_[_0xdce1('0x5a')](_0x33aa2f['where'],{'$or':_[_0xdce1('0x4b')](_0x33aa2f[_0xdce1('0x52')],function(_0x267323){var _0x3ad1ae={};_0x3ad1ae[_0x267323]={'$like':'%'+_0x2fb279[_0xdce1('0x50')][_0xdce1('0x59')]+'%'};return _0x3ad1ae;})});}_0x33aa2f=_[_0xdce1('0x5a')]({},_0x33aa2f,_0x2fb279[_0xdce1('0x5c')]);return _0xc24998['getAgents'](_0x33aa2f);}})[_0xdce1('0x19')](function(_0x4a76b3){if(_0x4a76b3){_0xd985e1=_0x4a76b3[_0xdce1('0x54')];if(!_0x2fb279[_0xdce1('0x50')]['hasOwnProperty']('nolimit')){_0x33aa2f[_0xdce1('0x2b')]=qs[_0xdce1('0x2b')](_0x2fb279[_0xdce1('0x50')]['limit']);_0x33aa2f[_0xdce1('0x28')]=qs[_0xdce1('0x28')](_0x2fb279[_0xdce1('0x50')][_0xdce1('0x28')]);}return _0xc24998['getAgents'](_0x33aa2f);}})[_0xdce1('0x19')](function(_0x1590e7){if(_0x1590e7){return _0x1590e7?{'count':_0xd985e1,'rows':_0x1590e7}:null;}})[_0xdce1('0x19')](respondWithResult(_0x48c189,null))[_0xdce1('0x23')](handleError(_0x48c189,null));}; \ No newline at end of file +var _0x88a2=['ChatMessage','AttachmentId','UserId','User','unshift','agent','*,*,*,*','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','notify','ValidationError','no\x20available\x20attributes','difference','send','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','spread','utf8','render','ChatOfflineMessage','originalname','mimetype','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','server','files','attachments','addInteraction','omit','getInteractions','Contact','Owner','fullname','Tag','Tags','tag','getSnippet','getProactiveActions','virtual','License','increment','chatLicenseExceeded','readFileSync','server/files/chat/iframe.ejs','3.12.1','origin','http://localhost:9000','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','color','labelText','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','path','ejs','lodash','html-to-text','ioredis','jayson/promise','api','../../config/environment','../../errors/api','APINotFoundError','APIOutOfIntervalError','handleError','URL','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','user-agent-parser','getResult','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','model','vendor','%s\x20%s\x20%s','type','stringify','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','address','forEach','testWildcardValidity','trim','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','sitepic','filename','addAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','../../config/license/util','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','Interval','resolve','timezone','ifTime','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','List','Contacts','ChatApplication','Intervals','interval','account','applications','orderBy','Applications','priority','asc','list','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','interaction','referer','messageId','created','autoclose','close','unmanaged'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x88a2,0x73));var _0x288a=function(_0xaa0c20,_0x5bde1a){_0xaa0c20=_0xaa0c20-0x0;var _0x58afec=_0x88a2[_0xaa0c20];return _0x58afec;};'use strict';var Mustache=require(_0x288a('0x0'));var util=require('util');var path=require(_0x288a('0x1'));var ejs=require(_0x288a('0x2'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x288a('0x3'));var querystring=require('querystring');var htmlToText=require(_0x288a('0x4'));var Redis=require(_0x288a('0x5'));var jayson=require(_0x288a('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x288a('0x7'));var config=require(_0x288a('0x8'));var APIBadRequestError=require(_0x288a('0x9'))['APIBadRequestError'];var APINotFoundError=require(_0x288a('0x9'))[_0x288a('0xa')];var APIOutOfIntervalError=require('../../errors/api')[_0x288a('0xb')];var APIHandleError=require(_0x288a('0x9'))[_0x288a('0xc')];var APIConflictError=require(_0x288a('0x9'))['APIConflictError'];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require('url')[_0x288a('0xd')];var db=require(_0x288a('0xe'))['db'];config[_0x288a('0xf')]=_[_0x288a('0x10')](config['redis'],{'host':_0x288a('0x11'),'port':0x18eb});var socket=require(_0x288a('0x12'))(new Redis(config[_0x288a('0xf')]));require('./chatWebsite.socket')[_0x288a('0x13')](socket);var client=jayson[_0x288a('0x14')][_0x288a('0x15')]({'port':0x232c});var client9002=jayson[_0x288a('0x14')][_0x288a('0x15')]({'port':0x232a});var client9003=jayson[_0x288a('0x14')][_0x288a('0x15')]({'port':0x232b});var client9001=jayson['client'][_0x288a('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x1dc05b,_0x3d2c76,_0x5a734e,_0x3d7dc0){return new Promise(function(_0x394241,_0x532d70){var _0x4e2234=_0x3d7dc0||client;return _0x4e2234[_0x288a('0x16')](_0x1dc05b,_0x5a734e)[_0x288a('0x17')](function(_0x37a785){logger['info'](_0x288a('0x18'),_0x3d2c76,_0x288a('0x19'));logger[_0x288a('0x1a')](_0x288a('0x1b'),_0x3d2c76,'request\x20sent',JSON['stringify'](_0x37a785));if(_0x37a785[_0x288a('0x1c')]){if(_0x37a785[_0x288a('0x1c')][_0x288a('0x1d')]===0x1f4){logger[_0x288a('0x1c')](_0x288a('0x18'),_0x3d2c76,_0x37a785[_0x288a('0x1c')][_0x288a('0x1e')]);return _0x532d70(_0x37a785['error'][_0x288a('0x1e')]);}logger[_0x288a('0x1c')](_0x288a('0x18'),_0x3d2c76,_0x37a785[_0x288a('0x1c')]['message']);return _0x394241(_0x37a785[_0x288a('0x1c')][_0x288a('0x1e')]);}else{logger[_0x288a('0x1f')](_0x288a('0x18'),_0x3d2c76,_0x288a('0x19'));_0x394241(_0x37a785[_0x288a('0x20')]['message']);}})[_0x288a('0x21')](function(_0x474c23){logger[_0x288a('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x3d2c76,_0x474c23);_0x532d70(_0x474c23);});});}function respondWithStatusCode(_0x18c10f,_0x407f5b){_0x407f5b=_0x407f5b||0xcc;return function(_0x5df9e0){if(_0x5df9e0){return _0x18c10f['sendStatus'](_0x407f5b);}return _0x18c10f[_0x288a('0x22')](_0x407f5b)[_0x288a('0x23')]();};}function respondWithResult(_0x222ddf,_0x46d38a){_0x46d38a=_0x46d38a||0xc8;return function(_0x51eab4){if(_0x51eab4){return _0x222ddf[_0x288a('0x22')](_0x46d38a)[_0x288a('0x24')](_0x51eab4);}};}function respondWithFilteredResult(_0x5a132f,_0x1bf7f3){return function(_0x4f67b9){if(_0x4f67b9){var _0x5a1133=typeof _0x1bf7f3[_0x288a('0x25')]==='undefined'&&typeof _0x1bf7f3[_0x288a('0x26')]===_0x288a('0x27');var _0x1303b9=_0x4f67b9['count'];var _0xbf0af2=_0x5a1133?0x0:_0x1bf7f3['offset'];var _0x27a2fe=_0x5a1133?_0x4f67b9[_0x288a('0x28')]:_0x1bf7f3[_0x288a('0x25')]+_0x1bf7f3[_0x288a('0x26')];var _0x58e867;if(_0x27a2fe>=_0x1303b9){_0x27a2fe=_0x1303b9;_0x58e867=0xc8;}else{_0x58e867=0xce;}_0x5a132f[_0x288a('0x22')](_0x58e867);return _0x5a132f[_0x288a('0x29')](_0x288a('0x2a'),_0xbf0af2+'-'+_0x27a2fe+'/'+_0x1303b9)['json'](_0x4f67b9);}return null;};}function saveUpdates(_0xa6fd44){return function(_0x4ff301){if(_0x4ff301){return _0x4ff301[_0x288a('0x2b')](_0xa6fd44)[_0x288a('0x17')](function(_0x2dfdbf){return _0x2dfdbf;});}return null;};}function removeEntity(_0x265674){return function(_0xcf9acc){if(_0xcf9acc){return _0xcf9acc[_0x288a('0x2c')]()[_0x288a('0x17')](function(){var _0xf13dcc=_0xcf9acc[_0x288a('0x2d')]({'plain':!![]});var _0x2c3701=_0x288a('0x2e');return db[_0x288a('0x2f')][_0x288a('0x2c')]({'where':{'type':_0x2c3701,'resourceId':_0xf13dcc['id']}})[_0x288a('0x17')](function(){return _0xcf9acc;});})[_0x288a('0x17')](function(){_0x265674[_0x288a('0x22')](0xcc)[_0x288a('0x23')]();});}};}function handleEntityNotFound(_0x4774d7){return function(_0x1724c2){if(!_0x1724c2){_0x4774d7[_0x288a('0x30')](0x194);}return _0x1724c2;};}function handleError(_0x147504,_0x18d475){_0x18d475=_0x18d475||0x1f4;return function(_0x51097a){logger[_0x288a('0x1c')](_0x51097a[_0x288a('0x31')]);if(_0x51097a[_0x288a('0x32')]){delete _0x51097a[_0x288a('0x32')];}_0x147504['status'](_0x18d475)['send'](_0x51097a);};}function createInteractionObject(_0x519e0a,_0x50c8ba,_0x5b89f0,_0x3a8c07){var _0x52e918=require(_0x288a('0x33'));var _0x59aebf=new _0x52e918();var _0x4a553a=_0x59aebf['setUA'](_0x5b89f0['user-agent'])[_0x288a('0x34')]();var _0x2929ca=_0x50c8ba[_0x288a('0x35')];if(_0x5b89f0[_0x288a('0x36')]){_0x2929ca=_0x5b89f0['cf-connecting-ip'];}else if(_0x5b89f0['x-forwarded-for']){_0x2929ca=_[_0x288a('0x37')](_0x5b89f0[_0x288a('0x38')][_0x288a('0x39')](','));}return{'ContactId':_0x3a8c07['id'],'ChatWebsiteId':_0x519e0a,'from':(_0x3a8c07[_0x288a('0x3a')]||'')+'\x20'+(_0x3a8c07[_0x288a('0x3b')]||''),'customerIp':_0x2929ca,'customerPort':_0x5b89f0[_0x288a('0x3c')]?_0x5b89f0[_0x288a('0x3c')]:null,'referer':_0x50c8ba['referer'],'browserName':_0x4a553a[_0x288a('0x3d')][_0x288a('0x32')]&&_0x4a553a[_0x288a('0x3d')][_0x288a('0x3e')]?util[_0x288a('0x3f')](_0x288a('0x40'),_0x4a553a[_0x288a('0x3d')][_0x288a('0x32')],_0x4a553a['browser']['version']):'unknown','browserVersion':_0x4a553a[_0x288a('0x3d')][_0x288a('0x3e')]||_0x288a('0x41'),'osName':util[_0x288a('0x3f')]('%s\x20%s',_0x4a553a['os']['name'],_0x4a553a['os'][_0x288a('0x3e')]),'osVersion':_0x4a553a['os']['version'],'deviceModel':_0x4a553a[_0x288a('0x42')][_0x288a('0x43')]&&_0x4a553a[_0x288a('0x42')][_0x288a('0x44')]?util[_0x288a('0x3f')](_0x288a('0x45'),_0x4a553a['device'][_0x288a('0x43')],_0x4a553a['device'][_0x288a('0x44')],_0x4a553a[_0x288a('0x42')]['type']):null,'deviceVendor':_0x4a553a['device'][_0x288a('0x44')],'deviceType':_0x4a553a[_0x288a('0x42')][_0x288a('0x46')],'formData':JSON[_0x288a('0x47')](_0x50c8ba)};}exports[_0x288a('0x48')]=function(_0x3a14ce,_0xa9ca1){var _0x4bf373={'include':[{'model':db[_0x288a('0x49')],'as':_0x288a('0x4a')}]},_0x420afd={},_0x447bd6={'count':0x0,'rows':[]};var _0x5f5a08=_[_0x288a('0x4b')](db[_0x288a('0x4c')][_0x288a('0x4d')],function(_0x2359a2){return{'name':_0x2359a2[_0x288a('0x4e')],'type':_0x2359a2['type'][_0x288a('0x4f')]};});_0x420afd['model']=_[_0x288a('0x4b')](_0x5f5a08,'name');_0x420afd[_0x288a('0x50')]=_[_0x288a('0x51')](_0x3a14ce[_0x288a('0x50')]);_0x420afd['filters']=_[_0x288a('0x52')](_0x420afd[_0x288a('0x43')],_0x420afd[_0x288a('0x50')]);_0x4bf373[_0x288a('0x53')]=_[_0x288a('0x52')](_0x420afd[_0x288a('0x43')],qs[_0x288a('0x54')](_0x3a14ce[_0x288a('0x50')][_0x288a('0x54')]));_0x4bf373[_0x288a('0x53')]=_0x4bf373['attributes'][_0x288a('0x55')]?_0x4bf373[_0x288a('0x53')]:_0x420afd['model'];if(!_0x3a14ce['query'][_0x288a('0x56')](_0x288a('0x57'))){_0x4bf373[_0x288a('0x26')]=qs[_0x288a('0x26')](_0x3a14ce[_0x288a('0x50')][_0x288a('0x26')]);_0x4bf373[_0x288a('0x25')]=qs[_0x288a('0x25')](_0x3a14ce[_0x288a('0x50')]['offset']);}_0x4bf373[_0x288a('0x58')]=qs[_0x288a('0x59')](_0x3a14ce['query'][_0x288a('0x59')]);_0x4bf373[_0x288a('0x5a')]=qs[_0x288a('0x5b')](_[_0x288a('0x5c')](_0x3a14ce[_0x288a('0x50')],_0x420afd[_0x288a('0x5b')]),_0x5f5a08);if(_0x3a14ce[_0x288a('0x50')]['filter']){_0x4bf373[_0x288a('0x5a')]=_[_0x288a('0x5d')](_0x4bf373['where'],{'$or':_[_0x288a('0x4b')](_0x5f5a08,function(_0xccace0){if(_0xccace0[_0x288a('0x46')]!==_0x288a('0x5e')){var _0x51fb03={};_0x51fb03[_0xccace0[_0x288a('0x32')]]={'$like':'%'+_0x3a14ce['query'][_0x288a('0x5f')]+'%'};return _0x51fb03;}})});}_0x4bf373=_['merge']({},_0x4bf373,_0x3a14ce['options']);var _0x392a16={'where':_0x4bf373[_0x288a('0x5a')]};return db[_0x288a('0x4c')]['count'](_0x392a16)['then'](function(_0x35676d){_0x447bd6[_0x288a('0x28')]=_0x35676d;if(_0x3a14ce[_0x288a('0x50')][_0x288a('0x60')]){_0x4bf373[_0x288a('0x61')]=[{'all':!![]}];}return db[_0x288a('0x4c')][_0x288a('0x62')](_0x4bf373);})[_0x288a('0x17')](function(_0x5a2571){_0x447bd6[_0x288a('0x63')]=_0x5a2571;return _0x447bd6;})[_0x288a('0x17')](respondWithFilteredResult(_0xa9ca1,_0x4bf373))[_0x288a('0x21')](handleError(_0xa9ca1,null));};exports[_0x288a('0x64')]=function(_0x37194c,_0x11c951){var _0x3b8f5c={'raw':![],'where':{'id':_0x37194c[_0x288a('0x65')]['id']},'include':[{'model':db['Pause'],'as':_0x288a('0x4a')}]},_0x3c2a58={};_0x3c2a58['model']=_[_0x288a('0x51')](db[_0x288a('0x4c')][_0x288a('0x4d')]);_0x3c2a58[_0x288a('0x50')]=_[_0x288a('0x51')](_0x37194c['query']);_0x3c2a58['filters']=_[_0x288a('0x52')](_0x3c2a58['model'],_0x3c2a58['query']);_0x3b8f5c[_0x288a('0x53')]=_[_0x288a('0x52')](_0x3c2a58[_0x288a('0x43')],qs['fields'](_0x37194c[_0x288a('0x50')][_0x288a('0x54')]));_0x3b8f5c[_0x288a('0x53')]=_0x3b8f5c[_0x288a('0x53')][_0x288a('0x55')]?_0x3b8f5c[_0x288a('0x53')]:_0x3c2a58[_0x288a('0x43')];if(_0x37194c['query'][_0x288a('0x60')]){_0x3b8f5c[_0x288a('0x61')]=[{'all':!![]}];}_0x3b8f5c=_[_0x288a('0x5d')]({},_0x3b8f5c,_0x37194c[_0x288a('0x66')]);return db[_0x288a('0x4c')][_0x288a('0x67')](_0x3b8f5c)[_0x288a('0x17')](handleEntityNotFound(_0x11c951,null))[_0x288a('0x17')](respondWithResult(_0x11c951,null))[_0x288a('0x21')](handleError(_0x11c951,null));};exports['create']=function(_0x889a50,_0x29aee2){var _0x90fac3=null;_0x889a50['body'][_0x288a('0x68')][_0x288a('0x39')](',')[_0x288a('0x69')](_0x154d5e=>{if(_0x154d5e['trim']()!==''&&!wildcardUtils[_0x288a('0x6a')](_0x154d5e[_0x288a('0x6b')]())){_0x90fac3=new APIBadRequestError('\x22'+_0x154d5e['trim']()+_0x288a('0x6c'));}});if(_0x90fac3){return handleError(_0x29aee2,null)(_0x90fac3);}return db[_0x288a('0x4c')][_0x288a('0x6d')](_0x889a50[_0x288a('0x6e')],{})['then'](function(_0x991be7){var _0x19749a=_0x889a50['user']['get']({'plain':!![]});if(!_0x19749a)throw new Error(_0x288a('0x6f'));if(_0x19749a[_0x288a('0x70')]===_0x288a('0x71')){var _0x1c531a=_0x991be7[_0x288a('0x2d')]({'plain':!![]});var _0x51bc70=_0x288a('0x2e');return db[_0x288a('0x72')][_0x288a('0x67')]({'where':{'name':_0x51bc70,'userProfileId':_0x19749a[_0x288a('0x73')]},'raw':!![]})[_0x288a('0x17')](function(_0x2650db){if(_0x2650db&&_0x2650db[_0x288a('0x74')]===0x0){return db[_0x288a('0x2f')][_0x288a('0x6d')]({'name':_0x1c531a[_0x288a('0x32')],'resourceId':_0x1c531a['id'],'type':_0x2650db[_0x288a('0x32')],'sectionId':_0x2650db['id']},{})[_0x288a('0x17')](function(){return _0x991be7;});}else{return _0x991be7;}})['catch'](function(_0x17ab05){logger[_0x288a('0x1c')](_0x288a('0x75'),_0x17ab05);throw _0x17ab05;});}return _0x991be7;})[_0x288a('0x17')](respondWithResult(_0x29aee2,0xc9))[_0x288a('0x21')](handleError(_0x29aee2,null));};exports[_0x288a('0x2b')]=function(_0x32adac,_0x1c9b1b){var _0x2e36f4=null;_0x32adac['body'][_0x288a('0x68')][_0x288a('0x39')](',')[_0x288a('0x69')](_0x409d2a=>{if(_0x409d2a['trim']()!==''&&!wildcardUtils[_0x288a('0x6a')](_0x409d2a[_0x288a('0x6b')]())){_0x2e36f4=new APIBadRequestError('\x22'+_0x409d2a['trim']()+_0x288a('0x6c'));}});if(_0x2e36f4){return handleError(_0x1c9b1b,null)(_0x2e36f4);}if(_0x32adac['body']['id']){delete _0x32adac[_0x288a('0x6e')]['id'];}return db[_0x288a('0x4c')][_0x288a('0x67')]({'where':{'id':_0x32adac[_0x288a('0x65')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x288a('0x17')](handleEntityNotFound(_0x1c9b1b,null))[_0x288a('0x17')](saveUpdates(_0x32adac[_0x288a('0x6e')],null))['then'](respondWithResult(_0x1c9b1b,null))['catch'](handleError(_0x1c9b1b,null));};exports['destroy']=function(_0x59597d,_0x58adac){return db['ChatWebsite'][_0x288a('0x67')]({'where':{'id':_0x59597d[_0x288a('0x65')]['id']}})[_0x288a('0x17')](handleEntityNotFound(_0x58adac,null))[_0x288a('0x17')](removeEntity(_0x58adac,null))[_0x288a('0x21')](handleError(_0x58adac,null));};exports[_0x288a('0x76')]=function(_0x433157,_0x4b8829){return db['ChatWebsite'][_0x288a('0x76')]()[_0x288a('0x17')](respondWithResult(_0x4b8829,null))['catch'](handleError(_0x4b8829,null));};exports[_0x288a('0x77')]=function(_0x2e6aa6,_0x5c5e00){if(_0x2e6aa6[_0x288a('0x6e')]['id']){delete _0x2e6aa6[_0x288a('0x6e')]['id'];}return db['ChatWebsite'][_0x288a('0x67')]({'where':{'id':_0x2e6aa6['params']['id']}})[_0x288a('0x17')](handleEntityNotFound(_0x5c5e00,null))['then'](function(_0x131134){if(_0x131134){_0x2e6aa6[_0x288a('0x6e')][_0x288a('0x78')]=_0x131134['id'];return db[_0x288a('0x79')]['create'](_0x2e6aa6[_0x288a('0x6e')]);}})['then'](respondWithResult(_0x5c5e00,null))[_0x288a('0x21')](handleError(_0x5c5e00,null));};exports[_0x288a('0x7a')]=function(_0x330631,_0x30dd4b){var _0x44a313={'raw':![],'where':{}};var _0x28b4a2={};var _0x3c05f0={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x288a('0x7b')]({'where':{'id':_0x330631[_0x288a('0x65')]['id']}})['then'](handleEntityNotFound(_0x30dd4b,null))[_0x288a('0x17')](function(_0x59e306){if(_0x59e306){_0x28b4a2[_0x288a('0x43')]=_[_0x288a('0x51')](db[_0x288a('0x79')]['rawAttributes']);_0x28b4a2[_0x288a('0x50')]=_['keys'](_0x330631['query']);_0x28b4a2[_0x288a('0x5b')]=_['intersection'](_0x28b4a2['model'],_0x28b4a2['query']);_0x44a313['attributes']=_['intersection'](_0x28b4a2['model'],qs[_0x288a('0x54')](_0x330631[_0x288a('0x50')][_0x288a('0x54')]));_0x44a313['attributes']=_0x44a313[_0x288a('0x53')]['length']?_0x44a313[_0x288a('0x53')]:_0x28b4a2['model'];if(!_0x330631[_0x288a('0x50')][_0x288a('0x56')](_0x288a('0x57'))){_0x44a313['limit']=qs['limit'](_0x330631['query'][_0x288a('0x26')]);_0x44a313[_0x288a('0x25')]=qs[_0x288a('0x25')](_0x330631[_0x288a('0x50')]['offset']);}_0x44a313['order']=qs['sort'](_0x330631[_0x288a('0x50')][_0x288a('0x59')]);_0x44a313[_0x288a('0x5a')]=qs[_0x288a('0x5b')](_[_0x288a('0x5c')](_0x330631[_0x288a('0x50')],_0x28b4a2['filters']));_0x44a313['where'][_0x288a('0x78')]=_0x59e306['id'];if(_0x330631['query'][_0x288a('0x5f')]){_0x44a313[_0x288a('0x5a')]=_[_0x288a('0x5d')](_0x44a313[_0x288a('0x5a')],{'$or':_['map'](_0x44a313[_0x288a('0x53')],function(_0x39dc04){var _0x2aa547={};_0x2aa547[_0x39dc04]={'$like':'%'+_0x330631[_0x288a('0x50')][_0x288a('0x5f')]+'%'};return _0x2aa547;})});}_0x44a313=_['merge']({},_0x44a313,_0x330631[_0x288a('0x66')]);return db['Disposition'][_0x288a('0x28')]({'where':_0x44a313[_0x288a('0x5a')]})[_0x288a('0x17')](function(_0x178d93){_0x3c05f0[_0x288a('0x28')]=_0x178d93;if(_0x330631['query'][_0x288a('0x60')]){_0x44a313[_0x288a('0x61')]=[{'all':!![]}];}return db[_0x288a('0x79')]['findAll'](_0x44a313);})['then'](function(_0xd08760){_0x3c05f0[_0x288a('0x63')]=_0xd08760;return _0x3c05f0;});}})[_0x288a('0x17')](respondWithFilteredResult(_0x30dd4b,_0x44a313))[_0x288a('0x21')](handleError(_0x30dd4b,null));};exports[_0x288a('0x7c')]=function(_0x514036,_0xbe0016){return db[_0x288a('0x4c')][_0x288a('0x67')]({'where':{'id':_0x514036['params']['id']}})[_0x288a('0x17')](handleEntityNotFound(_0xbe0016,null))[_0x288a('0x17')](function(_0x342006){if(_0x342006){return _0x342006[_0x288a('0x7c')](_0x514036[_0x288a('0x50')]['ids']);}})['then'](respondWithStatusCode(_0xbe0016,null))['catch'](handleError(_0xbe0016,null));};exports[_0x288a('0x7d')]=function(_0xe48476,_0x2c4475){if(_0xe48476[_0x288a('0x6e')]['id']){delete _0xe48476[_0x288a('0x6e')]['id'];}return db[_0x288a('0x4c')][_0x288a('0x67')]({'where':{'id':_0xe48476['params']['id']}})[_0x288a('0x17')](handleEntityNotFound(_0x2c4475,null))['then'](function(_0x3b35a7){if(_0x3b35a7){_0xe48476[_0x288a('0x6e')]['ChatWebsiteId']=_0x3b35a7['id'];return db[_0x288a('0x7e')][_0x288a('0x6d')](_0xe48476['body']);}})[_0x288a('0x17')](respondWithResult(_0x2c4475,null))['catch'](handleError(_0x2c4475,null));};exports[_0x288a('0x7f')]=function(_0x36c897,_0x347506){var _0x25b455={'raw':![],'where':{}};var _0x52d343={};var _0x112839={'count':0x0,'rows':[]};return db[_0x288a('0x4c')][_0x288a('0x7b')]({'where':{'id':_0x36c897[_0x288a('0x65')]['id']}})[_0x288a('0x17')](handleEntityNotFound(_0x347506,null))[_0x288a('0x17')](function(_0x3c8749){if(_0x3c8749){_0x52d343[_0x288a('0x43')]=_[_0x288a('0x51')](db['CannedAnswer'][_0x288a('0x4d')]);_0x52d343[_0x288a('0x50')]=_[_0x288a('0x51')](_0x36c897[_0x288a('0x50')]);_0x52d343['filters']=_['intersection'](_0x52d343[_0x288a('0x43')],_0x52d343[_0x288a('0x50')]);_0x25b455[_0x288a('0x53')]=_[_0x288a('0x52')](_0x52d343[_0x288a('0x43')],qs[_0x288a('0x54')](_0x36c897[_0x288a('0x50')][_0x288a('0x54')]));_0x25b455['attributes']=_0x25b455[_0x288a('0x53')][_0x288a('0x55')]?_0x25b455['attributes']:_0x52d343['model'];if(!_0x36c897[_0x288a('0x50')][_0x288a('0x56')](_0x288a('0x57'))){_0x25b455[_0x288a('0x26')]=qs[_0x288a('0x26')](_0x36c897[_0x288a('0x50')]['limit']);_0x25b455['offset']=qs[_0x288a('0x25')](_0x36c897[_0x288a('0x50')][_0x288a('0x25')]);}_0x25b455[_0x288a('0x58')]=qs['sort'](_0x36c897[_0x288a('0x50')][_0x288a('0x59')]);_0x25b455[_0x288a('0x5a')]=qs[_0x288a('0x5b')](_['pick'](_0x36c897[_0x288a('0x50')],_0x52d343['filters']));_0x25b455[_0x288a('0x5a')]['ChatWebsiteId']=_0x3c8749['id'];if(_0x36c897[_0x288a('0x50')][_0x288a('0x5f')]){_0x25b455[_0x288a('0x5a')]=_[_0x288a('0x5d')](_0x25b455[_0x288a('0x5a')],{'$or':_[_0x288a('0x4b')](_0x25b455[_0x288a('0x53')],function(_0x2eae17){var _0x3c3139={};_0x3c3139[_0x2eae17]={'$like':'%'+_0x36c897['query'][_0x288a('0x5f')]+'%'};return _0x3c3139;})});}_0x25b455=_[_0x288a('0x5d')]({},_0x25b455,_0x36c897[_0x288a('0x66')]);return db[_0x288a('0x7e')][_0x288a('0x28')]({'where':_0x25b455['where']})['then'](function(_0x3db97f){_0x112839[_0x288a('0x28')]=_0x3db97f;if(_0x36c897[_0x288a('0x50')][_0x288a('0x60')]){_0x25b455['include']=[{'all':!![]}];}return db[_0x288a('0x7e')]['findAll'](_0x25b455);})[_0x288a('0x17')](function(_0x1ea96d){_0x112839['rows']=_0x1ea96d;return _0x112839;});}})[_0x288a('0x17')](respondWithFilteredResult(_0x347506,_0x25b455))['catch'](handleError(_0x347506,null));};exports[_0x288a('0x80')]=function(_0x5b9eb7,_0x4d484d){return db[_0x288a('0x4c')][_0x288a('0x67')]({'where':{'id':_0x5b9eb7['params']['id']}})[_0x288a('0x17')](handleEntityNotFound(_0x4d484d,null))[_0x288a('0x17')](function(_0x39521f){if(_0x39521f){return _0x39521f[_0x288a('0x80')](_0x5b9eb7[_0x288a('0x50')][_0x288a('0x81')]);}})[_0x288a('0x17')](respondWithStatusCode(_0x4d484d,null))['catch'](handleError(_0x4d484d,null));};exports[_0x288a('0x82')]=function(_0x1fcdb5,_0x1b6782){_0x1fcdb5[_0x288a('0x6e')][_0x288a('0x83')]=_0x1fcdb5['file'][_0x288a('0x84')];return db['ChatWebsite'][_0x288a('0x67')]({'where':{'id':_0x1fcdb5[_0x288a('0x65')]['id']}})[_0x288a('0x17')](handleEntityNotFound(_0x1b6782,null))[_0x288a('0x17')](saveUpdates(_0x1fcdb5[_0x288a('0x6e')],null))[_0x288a('0x17')](respondWithResult(_0x1b6782,null))[_0x288a('0x21')](handleError(_0x1b6782,null));};exports[_0x288a('0x85')]=function(_0x4362d1,_0x58a0a1){_0x4362d1[_0x288a('0x6e')]['agentAvatar']=_0x4362d1[_0x288a('0x86')][_0x288a('0x84')];return db[_0x288a('0x4c')][_0x288a('0x67')]({'where':{'id':_0x4362d1[_0x288a('0x65')]['id']}})[_0x288a('0x17')](handleEntityNotFound(_0x58a0a1,null))[_0x288a('0x17')](saveUpdates(_0x4362d1[_0x288a('0x6e')],null))[_0x288a('0x17')](respondWithResult(_0x58a0a1,null))[_0x288a('0x21')](handleError(_0x58a0a1,null));};exports[_0x288a('0x87')]=function(_0x41f0d7,_0x555fcb){_0x41f0d7[_0x288a('0x6e')][_0x288a('0x88')]=_0x41f0d7['file'][_0x288a('0x84')];return db['ChatWebsite'][_0x288a('0x67')]({'where':{'id':_0x41f0d7[_0x288a('0x65')]['id']}})[_0x288a('0x17')](handleEntityNotFound(_0x555fcb,null))[_0x288a('0x17')](saveUpdates(_0x41f0d7['body'],null))['then'](respondWithResult(_0x555fcb,null))[_0x288a('0x21')](handleError(_0x555fcb,null));};exports[_0x288a('0x89')]=function(_0x1c1d4a,_0x12296e){_0x1c1d4a['body'][_0x288a('0x8a')]=_0x1c1d4a['file'][_0x288a('0x84')];return db[_0x288a('0x4c')][_0x288a('0x67')]({'where':{'id':_0x1c1d4a[_0x288a('0x65')]['id']}})['then'](handleEntityNotFound(_0x12296e,null))[_0x288a('0x17')](saveUpdates(_0x1c1d4a[_0x288a('0x6e')],null))[_0x288a('0x17')](respondWithResult(_0x12296e,null))['catch'](handleError(_0x12296e,null));};exports[_0x288a('0x8b')]=function(_0x2732c1,_0x35d0e1){var _0x3e733a=path['join'](config[_0x288a('0x8c')],'server/files/images/logos/default_logo.svg');var _0x20b222={'where':{'id':_0x2732c1[_0x288a('0x65')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x3cf2d6=![];return require(_0x288a('0x8d'))[_0x288a('0x8e')]()[_0x288a('0x17')](function(_0x573493){if(_0x573493){_0x3cf2d6=_0x573493[_0x288a('0x8f')];}})[_0x288a('0x17')](function(){return db[_0x288a('0x4c')]['find'](_0x20b222);})['then'](handleEntityNotFound(_0x35d0e1,null))[_0x288a('0x17')](function(_0x5bc22a){if(_0x5bc22a){if(!_[_0x288a('0x90')](_0x5bc22a[_0x288a('0x83')])){if(fs[_0x288a('0x91')](path[_0x288a('0x92')](config['root'],_0x288a('0x93'),_0x5bc22a[_0x288a('0x83')]))&&_0x3cf2d6){_0x3e733a=path[_0x288a('0x92')](config['root'],'server/files/images/logos/',_0x5bc22a[_0x288a('0x83')]);}}return _0x35d0e1[_0x288a('0x94')](_0x3e733a);}})['catch'](handleError(_0x35d0e1,null));};exports[_0x288a('0x95')]=function(_0x107954,_0x4f3630){var _0x47eedc=path[_0x288a('0x92')](config[_0x288a('0x8c')],_0x288a('0x96'));var _0x5f4ef5={'where':{'id':_0x107954[_0x288a('0x65')]['id']},'attributes':['id',_0x288a('0x97')],'raw':!![]};return db['ChatWebsite'][_0x288a('0x67')](_0x5f4ef5)[_0x288a('0x17')](handleEntityNotFound(_0x4f3630,null))['then'](function(_0x51332b){if(_0x51332b){if(!_['isNil'](_0x51332b[_0x288a('0x97')])){if(fs[_0x288a('0x91')](path['join'](config[_0x288a('0x8c')],'server/files/images/avatars/',_0x51332b[_0x288a('0x97')]))){_0x47eedc=path[_0x288a('0x92')](config[_0x288a('0x8c')],_0x288a('0x98'),_0x51332b[_0x288a('0x97')]);}}return _0x4f3630['download'](_0x47eedc);}})[_0x288a('0x21')](handleError(_0x4f3630,null));};exports[_0x288a('0x99')]=function(_0x4eebf8,_0x536e1b){var _0x24823f=path[_0x288a('0x92')](config[_0x288a('0x8c')],'server/files/images/avatars/customer_avatar.png');var _0x547e3d={'where':{'id':_0x4eebf8['params']['id']},'attributes':['id',_0x288a('0x88'),_0x288a('0x9a')],'raw':!![]};return db[_0x288a('0x4c')][_0x288a('0x67')](_0x547e3d)[_0x288a('0x17')](handleEntityNotFound(_0x536e1b,null))[_0x288a('0x17')](function(_0xa7e371){if(_0xa7e371){if(!_[_0x288a('0x90')](_0xa7e371[_0x288a('0x88')])){if(fs['existsSync'](path['join'](config[_0x288a('0x8c')],_0x288a('0x98'),_0xa7e371[_0x288a('0x88')]))&&_0xa7e371[_0x288a('0x9a')]){_0x24823f=path[_0x288a('0x92')](config['root'],_0x288a('0x98'),_0xa7e371[_0x288a('0x88')]);}}return _0x536e1b[_0x288a('0x94')](_0x24823f);}})[_0x288a('0x21')](handleError(_0x536e1b,null));};exports[_0x288a('0x9b')]=function(_0x15ff13,_0x4f04dc){var _0x472955=path['join'](config[_0x288a('0x8c')],'server/files/images/avatars/system_avatar.png');var _0x402fda={'where':{'id':_0x15ff13[_0x288a('0x65')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x288a('0x4c')][_0x288a('0x67')](_0x402fda)[_0x288a('0x17')](handleEntityNotFound(_0x4f04dc,null))[_0x288a('0x17')](function(_0x49818d){if(_0x49818d){if(!_[_0x288a('0x90')](_0x49818d[_0x288a('0x8a')])){if(fs['existsSync'](path[_0x288a('0x92')](config['root'],_0x288a('0x98'),_0x49818d[_0x288a('0x8a')]))){_0x472955=path[_0x288a('0x92')](config['root'],_0x288a('0x98'),_0x49818d[_0x288a('0x8a')]);}}return _0x4f04dc[_0x288a('0x94')](_0x472955);}})['catch'](handleError(_0x4f04dc,null));};function checkWebsiteInterval(_0x4f39e3){var _0x283095=_0x4f39e3[_0x288a('0x9c')];if(!_0x283095){return Promise[_0x288a('0x9d')](_0x4f39e3);}var _0x2ed27c=_0x4f39e3[_0x288a('0x9e')]||undefined;return _0x283095[_0x288a('0x9f')](_0x2ed27c)[_0x288a('0x17')](function(_0x9fd16f){if(!_0x9fd16f){throw new APIOutOfIntervalError();}return _0x4f39e3;});}exports['notify']=function(_0x6414e1,_0x338be9){var _0x1621e9={'body':_0x6414e1[_0x288a('0x6e')],'channel':_0x288a('0xa0')};var _0x24ce47=[];var _0x4c65a9=[];var _0xcdc89a={};var _0x4339f6=![];if(_0x6414e1['body']['id']){delete _0x6414e1[_0x288a('0x6e')]['id'];}if(_['isNil'](_0x6414e1[_0x288a('0x6e')][_0x288a('0xa1')])){throw new APIBadRequestError(_0x288a('0xa2'));}if(_[_0x288a('0x90')](_0x6414e1[_0x288a('0x6e')][_0x288a('0xa3')])){throw new APIBadRequestError(_0x288a('0xa4'));}if(_['isEmpty'](_0x6414e1[_0x288a('0x6e')][_0x288a('0x6e')])){throw new APIBadRequestError(_0x288a('0xa5'));}var _0x115fc0=_0x6414e1[_0x288a('0x6e')][_0x288a('0x35')]&&_0x6414e1[_0x288a('0x6e')]['referer'];return db[_0x288a('0xa6')][_0x288a('0x76')]()[_0x288a('0x17')](function(_0x5049d1){if(!_0x5049d1){throw new Error(_0x288a('0xa7'));}_0x24ce47=Object[_0x288a('0x51')](_0x5049d1)[_0x288a('0x5f')](function(_0x3970c4){return![_0x288a('0xa8'),_0x288a('0xa9')][_0x288a('0xaa')](_0x3970c4);});_0x4c65a9=Object[_0x288a('0x51')](_0x5049d1)[_0x288a('0x5f')](function(_0x46c27a){return![_0x288a('0xa8'),_0x288a('0xa9'),_0x288a('0xab'),_0x288a('0xac')][_0x288a('0xaa')](_0x46c27a);});if(!_[_0x288a('0xaa')](_0x4c65a9,_0x6414e1[_0x288a('0x6e')][_0x288a('0xa3')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x4c65a9[_0x288a('0x92')](',\x20'));}_0xcdc89a[_0x6414e1[_0x288a('0x6e')]['mapKey']]=_0x6414e1[_0x288a('0x6e')]['from'];})[_0x288a('0x17')](function(){return db[_0x288a('0x4c')][_0x288a('0x67')]({'where':{'id':_0x6414e1[_0x288a('0x65')]['id']},'include':[{'model':db['CmList'],'as':_0x288a('0xad'),'include':[{'model':db['CmContact'],'as':_0x288a('0xae'),'where':_0xcdc89a,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x288a('0xaf')],'as':'Applications'},{'model':db[_0x288a('0x9c')],'as':_0x288a('0x9c'),'include':[{'model':db['Interval'],'as':_0x288a('0xb0'),'attributes':['id',_0x288a('0xb1')],'raw':!![]}]}]});})[_0x288a('0x17')](function(_0xb04e30){if(!_0xb04e30){throw new APINotFoundError(util[_0x288a('0x3f')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x6414e1['params']['id']));}if(_0x115fc0){return checkWebsiteInterval(_0xb04e30);}return _0xb04e30;})['then'](function(_0x4bf9e1){_0x1621e9[_0x288a('0xb2')]=_0x4bf9e1;_0x1621e9[_0x288a('0xb3')]=_[_0x288a('0xb4')](_0x4bf9e1[_0x288a('0xb5')],[_0x288a('0xb6')],[_0x288a('0xb7')]);if(_0x1621e9[_0x288a('0xb2')]['Applications']){delete _0x1621e9[_0x288a('0xb2')]['Applications'];}_0x1621e9[_0x288a('0xb8')]=_0x4bf9e1[_0x288a('0xad')]||{'id':_0x4bf9e1[_0x288a('0xac')]};if(_0x1621e9[_0x288a('0xb8')]&&_0x1621e9[_0x288a('0xb8')]['Contacts']['length']){return _0x1621e9['list'][_0x288a('0xae')][0x0];}var _0x41f73d=_[_0x288a('0x10')](_0x6414e1[_0x288a('0x6e')],{'firstName':_0x6414e1[_0x288a('0x6e')][_0x288a('0xa1')],'ListId':_0x4bf9e1[_0x288a('0xac')]});_0x41f73d[_0x6414e1[_0x288a('0x6e')]['mapKey']]=_0x6414e1['body'][_0x288a('0xa1')];return db[_0x288a('0xa6')][_0x288a('0x6d')](_0x41f73d,{'fields':_0x24ce47,'raw':!![]});})[_0x288a('0x17')](function(_0x4f732c){_0x1621e9[_0x288a('0xb9')]=_0x4f732c;var _0x433e8e=createInteractionObject(_0x6414e1[_0x288a('0x65')]['id'],_0x6414e1[_0x288a('0x6e')],_0x6414e1[_0x288a('0xba')],_0x4f732c);var _0x15f8ae={'ChatWebsiteId':_0x6414e1[_0x288a('0x65')]['id']};if(_0x6414e1[_0x288a('0x6e')][_0x288a('0xbb')]){_0x15f8ae[_0x288a('0xbb')]=_0x6414e1[_0x288a('0x6e')][_0x288a('0xbb')];_0x15f8ae[_0x288a('0xbc')]=![];return db[_0x288a('0xbd')][_0x288a('0x67')]({'where':_0x15f8ae})[_0x288a('0x17')](function(_0x344cbf){var _0x38c290=_0x6414e1[_0x288a('0x6e')][_0x288a('0x35')]&&_0x6414e1[_0x288a('0x6e')]['referer'];if(_0x344cbf){_0x4339f6=!![];return _0x344cbf;}else if(!_0x38c290&&_0x344cbf&&_0x344cbf[_0x288a('0xbc')]){throw new APIConflictError(_0x288a('0xbe'));}_0x433e8e['threadId']=_0x6414e1['body'][_0x288a('0xbb')];_0x433e8e[_0x288a('0xbf')]=_0x6414e1['body'][_0x288a('0xbf')];return db['ChatInteraction'][_0x288a('0x6d')](_0x433e8e);});}_0x15f8ae['ContactId']=_0x4f732c['id'];if(_0x6414e1[_0x288a('0x6e')][_0x288a('0xc0')]&&_0x6414e1['body'][_0x288a('0xc0')]['id']){_0x15f8ae['id']=_0x6414e1[_0x288a('0x6e')][_0x288a('0xc0')]['id'];return db[_0x288a('0xbd')][_0x288a('0x67')]({'where':_0x15f8ae})[_0x288a('0x17')](function(_0x57544c){var _0x58f3fb=_0x6414e1['body'][_0x288a('0x35')]&&_0x6414e1[_0x288a('0x6e')][_0x288a('0xc1')];if(!_0x58f3fb&&_0x57544c&&_0x57544c['closed']){throw new APIConflictError(_0x288a('0xbe'));}else if(_0x57544c){_0x4339f6=!![];return _0x57544c;}else{return db[_0x288a('0xbd')][_0x288a('0x6d')](_0x433e8e);}});}return db[_0x288a('0xbd')][_0x288a('0x6d')](_0x433e8e);})[_0x288a('0x17')](function(_0x5e515f){if(!_0x4339f6){return _0x5e515f;}var _0x424421={'from':(_0x1621e9['contact'][_0x288a('0x3a')]||'')+'\x20'+(_0x1621e9[_0x288a('0xb9')]['lastName']||'')};if(_0x6414e1[_0x288a('0x6e')][_0x288a('0xbb')]&&_0x6414e1['body'][_0x288a('0xc2')]&&_0x6414e1[_0x288a('0x6e')][_0x288a('0xbb')]!=_0x6414e1[_0x288a('0x6e')][_0x288a('0xc2')]){_0x424421[_0x288a('0xbb')]=_0x6414e1[_0x288a('0x6e')]['messageId'];}return _0x5e515f[_0x288a('0x2b')](_0x424421);})[_0x288a('0x17')](function(_0x469db9){_0x1621e9[_0x288a('0xc0')]=_0x469db9[_0x288a('0x2d')]({'plain':!![]});_0x1621e9[_0x288a('0xc0')][_0x288a('0xc3')]=!_0x4339f6;if(_0x1621e9[_0x288a('0xc0')]['created']){if(_0x1621e9[_0x288a('0xb2')][_0x288a('0xc4')]){_0x1621e9['applications']['push']({'id':0x0,'priority':_0x1621e9['applications'][_0x288a('0x55')]+0x1,'app':_0x288a('0xc5'),'appdata':_0x288a('0xc6'),'interval':'*,*,*,*'});}}return db[_0x288a('0xc7')][_0x288a('0x6d')]({'body':_0x6414e1[_0x288a('0x6e')][_0x288a('0x6e')],'ChatWebsiteId':_0x6414e1['params']['id'],'ChatInteractionId':_0x469db9['id'],'direction':'in','ContactId':_0x1621e9[_0x288a('0xb9')]['id'],'AttachmentId':_0x6414e1['body'][_0x288a('0xc8')]});})[_0x288a('0x17')](function(_0x4b8ebb){_0x1621e9[_0x288a('0x1e')]=_0x4b8ebb;if(!_0x1621e9[_0x288a('0xc0')][_0x288a('0xc9')]){return;}return db[_0x288a('0xca')][_0x288a('0x67')]({'attributes':['id',_0x288a('0x32')],'where':{'id':_0x1621e9[_0x288a('0xc0')][_0x288a('0xc9')]}});})[_0x288a('0x17')](function(_0x4e984e){if(_0x4e984e){_0x1621e9[_0x288a('0xb3')][_0x288a('0xcb')]({'id':0x0,'priority':0x0,'app':_0x288a('0xcc'),'appdata':_0x4e984e[_0x288a('0x32')]+','+(_0x1621e9['account']['waitForTheAssignedAgent']||0xa),'interval':_0x288a('0xcd')});_0x1621e9[_0x288a('0xce')]=!![];}if(!_0x1621e9['interaction'][_0x288a('0xcf')]){return;}return db[_0x288a('0xd0')][_0x288a('0x67')]({'attributes':['id',_0x288a('0x32')],'where':{'id':_0x1621e9[_0x288a('0xc0')]['queueId']}});})[_0x288a('0x17')](function(_0x5676a5){if(_0x5676a5){_0x1621e9[_0x288a('0xb3')]['unshift']({'id':0x0,'priority':0x1,'app':_0x288a('0xd1'),'appdata':_0x5676a5[_0x288a('0x32')]+','+(_0x1621e9[_0x288a('0xb2')][_0x288a('0xd2')]||0x12c),'interval':_0x288a('0xcd')});}return respondWithRpcPromise(_0x288a('0xd3'),_0x288a('0xd4'),_0x1621e9);})[_0x288a('0x17')](function(_0x3d5968){respondWithRpcPromise('EventManager',_0x288a('0xd5'),{'event':_0x288a('0xd6'),'message':_0x3d5968},client9002);return _0x3d5968;})['then'](respondWithResult(_0x338be9,null))[_0x288a('0x21')](APIHandleError(_0x338be9));};exports['offline']=function(_0xfa5102,_0xfaa365){var _0xbcb3b4,_0xca3cd6,_0x1d21fd;var _0x5dea70=[];var _0x77f8b0={};var _0x1b7172=_0xfa5102['files']||[];var _0x576f69=[];var _0x5df459;return db[_0x288a('0xa6')]['describe']()[_0x288a('0x17')](function(_0x2ad32d){if(!_0x2ad32d){throw new db['Sequelize'][(_0x288a('0xd7'))](_0x288a('0xd8'));}_0x5dea70=_[_0x288a('0xd9')](_[_0x288a('0x51')](_0x2ad32d),[_0x288a('0xa8'),_0x288a('0xa9'),_0x288a('0xab'),_0x288a('0xac')]);if(_0xfa5102[_0x288a('0x6e')]['id']){delete _0xfa5102[_0x288a('0x6e')]['id'];}if(_[_0x288a('0x90')](_0xfa5102['body'][_0x288a('0xa1')])){throw _0xfaa365[_0x288a('0x22')](0x1f4)[_0x288a('0xda')](new db['Sequelize']['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x288a('0x90')](_0xfa5102['body']['body'])||_0xfa5102[_0x288a('0x6e')][_0x288a('0x6e')]===''){throw _0xfaa365[_0x288a('0x22')](0x1f4)[_0x288a('0xda')](new db[(_0x288a('0xdb'))][(_0x288a('0xd7'))](_0x288a('0xdc')));}if(_[_0x288a('0x90')](_0xfa5102[_0x288a('0x6e')][_0x288a('0xdd')])){throw _0xfaa365[_0x288a('0x22')](0x1f4)['send'](new db[(_0x288a('0xdb'))][(_0x288a('0xd7'))](_0x288a('0xde')+_0x5dea70));}if(!_[_0x288a('0xaa')](_0x5dea70,_0xfa5102[_0x288a('0x6e')][_0x288a('0xdd')])){throw _0xfaa365[_0x288a('0x22')](0x1f4)['send'](new db[(_0x288a('0xdb'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5dea70));}_0x77f8b0[_0xfa5102[_0x288a('0x6e')][_0x288a('0xdd')]]=_0xfa5102[_0x288a('0x6e')][_0x288a('0xa1')];})[_0x288a('0x17')](function(){return db[_0x288a('0x4c')][_0x288a('0x67')]({'where':{'id':_0xfa5102['params']['id']},'include':[{'model':db[_0x288a('0xdf')],'as':_0x288a('0xad')},{'model':db[_0x288a('0xe0')],'as':_0x288a('0xe0')}]});})[_0x288a('0x17')](handleEntityNotFound(_0xfaa365,null))[_0x288a('0x17')](function(_0x50b07c){if(_0x50b07c&&_0x50b07c[_0x288a('0xad')]){_0xca3cd6=_0x50b07c;var _0x99a284=_[_0x288a('0x10')](_0xfa5102[_0x288a('0x6e')],{'firstName':_0xfa5102[_0x288a('0x6e')]['from'],'phone':_0xfa5102[_0x288a('0x6e')][_0x288a('0xa1')],'ListId':_0x50b07c[_0x288a('0xac')]});_0x99a284[_0xfa5102[_0x288a('0x6e')][_0x288a('0xdd')]]=_0xfa5102[_0x288a('0x6e')][_0x288a('0xa1')];return db[_0x288a('0xa6')][_0x288a('0xe1')]({'where':_0x77f8b0,'defaults':_0x99a284});}})[_0x288a('0xe2')](function(_0xe85e95){if(_0xe85e95){_0x1d21fd=_0xe85e95;var _0x513e17=fs['readFileSync'](path[_0x288a('0x92')](config[_0x288a('0x8c')],'server/files/templates/chatOfflineMessage.ejs'),_0x288a('0xe3'));var _0x2bd682=ejs[_0x288a('0xe4')](_0x513e17,{'body':_['toPairs'](_0xfa5102['body'][_0x288a('0x6e')]),'bodyTitle':_0xca3cd6['offlineMessageBody']});return db[_0x288a('0xe5')][_0x288a('0x6d')]({'body':_0x2bd682,'plainBody':htmlToText['fromString'](_0x2bd682),'ContactId':_0xe85e95['id'],'ChatWebsiteId':_0xca3cd6['id']});}})[_0x288a('0x17')](function(_0x8f23a8){_0x5df459=_0x8f23a8;if(_0x1b7172[_0x288a('0x55')]){var _0x3bd118=_0x1b7172['map'](function(_0x35d20f){return{'name':_0x35d20f[_0x288a('0xe6')],'basename':_0x35d20f[_0x288a('0x84')],'type':_0x35d20f[_0x288a('0xe7')],'ChatOfflineMessageId':_0x8f23a8['id']};});_0x576f69=_0x3bd118[_0x288a('0x4b')](_0x4c0b00=>{var _0x3da81b={'filename':_0x4c0b00[_0x288a('0x32')],'path':path[_0x288a('0x92')](config[_0x288a('0x8c')],'server','files','attachments',_0x288a('0xe8'),_0x4c0b00[_0x288a('0xe9')])};return _0x3da81b;});if(!_0xca3cd6[_0x288a('0xea')]){return db[_0x288a('0xeb')]['transaction'](function(_0x4bf087){return db[_0x288a('0xec')][_0x288a('0xed')](_0x3bd118,{'transaction':_0x4bf087});});}}})[_0x288a('0x17')](function(){if(_0x5df459){_0xbcb3b4=_0x5df459;return db[_0x288a('0xe0')][_0x288a('0x7b')]({'where':{'service':!![]},'include':[{'model':db[_0x288a('0xee')],'as':_0x288a('0xef'),'raw':!![],'include':[{'model':db[_0x288a('0xf0')],'as':_0x288a('0xf0'),'raw':!![]}]}]});}})[_0x288a('0x17')](function(_0x52c957){if(_0x52c957&&_0x52c957['Smtp']&&_0xca3cd6[_0x288a('0xf1')]&&_0xca3cd6[_0x288a('0xf2')]){var _0x196537=_0x52c957[_0x288a('0xf3')]();return respondWithRpcPromise('SendMail',_0x288a('0xf4'),{'account':_0x196537,'message':{'from':util['format'](_0x288a('0xf5'),_0x52c957[_0x288a('0x32')],_0x52c957[_0x288a('0xf6')]||_0x52c957[_0x288a('0xef')][_0x288a('0x71')]),'to':_0xca3cd6[_0x288a('0xf2')],'subject':_0xca3cd6[_0x288a('0xf7')],'html':_0xbcb3b4[_0x288a('0x6e')],'attachments':_0x576f69}},client9003)[_0x288a('0x17')](function(){return _0xbcb3b4;})[_0x288a('0x21')](function(_0xf572d3){logger[_0x288a('0x1c')](_0xf572d3);});}})['then'](function(){if(_0xca3cd6&&_0xca3cd6[_0x288a('0xea')]&&_0xca3cd6[_0x288a('0xf8')]){var _0x478c3b=[];if(_0x1b7172[_0x288a('0x55')]){_0x478c3b=_0x1b7172[_0x288a('0x4b')](function(_0x156741){return{'name':_0x156741['originalname'],'basename':_0x156741[_0x288a('0x84')],'type':_0x156741[_0x288a('0xe7')],'ChatOfflineMessageId':_0x5df459['id']};});}var _0x24032d;if(!_['isNil'](_0xca3cd6[_0x288a('0xf9')])){var _0x46fa05=_[_0x288a('0x4b')](_0xfa5102[_0x288a('0x6e')],function(_0x2e7919){return _0x2e7919;});var _0x3c1a04=_[_0x288a('0xfa')](_0x46fa05)[0x0];var _0x45d982=_[_0x288a('0xfb')](_0x3c1a04,function(_0x24a6aa){return _0x24a6aa;});_0x24032d=_0x45d982[0x1][_0xca3cd6['subjectOffline']];}var _0x170cfb={'from':_0x1d21fd[_0x288a('0xf6')],'firstName':_0x1d21fd[_0x288a('0x3a')],'lastName':_0x1d21fd['lastName'],'mapKey':'email','message':{'from':_0x1d21fd[_0x288a('0xf6')],'to':_0xca3cd6[_0x288a('0xe0')][_0x288a('0xf6')],'cc':'','subject':_[_0x288a('0x90')](_0x24032d)?_0xca3cd6['offlineMessageSubject']:_0x24032d,'messageId':'','sentAt':new Date(),'attach':_0x478c3b[_0x288a('0x55')],'attachments':_0x478c3b,'originChannel':_0x288a('0xfc'),'ChatWebsiteId':_0xca3cd6['id'],'ChatOfflineMessageId':_0xbcb3b4['id'],'originTo':_0xca3cd6[_0x288a('0xe0')][_0x288a('0xf6')]},'body':_0xbcb3b4[_0x288a('0x6e')]};var _0xd7cafe={'account':{'id':_0xca3cd6[_0x288a('0xf8')]},'body':_0x170cfb,'log':_0x288a('0xfd')};return respondWithRpcPromise(_0x288a('0xfd'),_0x288a('0xfe'),_0xd7cafe,client9001)[_0x288a('0x17')](function(){return _0xbcb3b4;})[_0x288a('0x21')](function(_0x20e5a2){logger[_0x288a('0x1c')](_0x20e5a2);});}return;})['then'](function(){if(_0xbcb3b4){return _0xbcb3b4;}})[_0x288a('0x17')](respondWithResult(_0xfaa365,null))['catch'](function(){for(var _0x280382 of _0x1b7172){var _0x7527bc=path['join'](config[_0x288a('0x8c')],_0x288a('0xff'),_0x288a('0x100'),_0x288a('0x101'),_0x288a('0xe8'),_0x280382[_0x288a('0x84')]);fs_extra['remove'](_0x7527bc)[_0x288a('0x21')](function(_0x1634d2){logger['error']('Could\x20not\x20remove\x20attachment\x20file',_0x7527bc,_0x1634d2);});}});};exports[_0x288a('0x102')]=function(_0x4cb37f,_0x3be95e){return db[_0x288a('0xbd')][_0x288a('0x67')]({'where':{'id':_0x4cb37f[_0x288a('0x65')]['id']}})['then'](handleEntityNotFound(_0x3be95e,null))[_0x288a('0x17')](function(_0x11f0d6){if(_0x11f0d6){return _0x11f0d6['addInteraction'](_0x4cb37f[_0x288a('0x6e')]['ids'],_[_0x288a('0x103')](_0x4cb37f[_0x288a('0x6e')],['ids','id'])||{});}})['then'](respondWithResult(_0x3be95e,null))['catch'](handleError(_0x3be95e,null));};exports[_0x288a('0x104')]=function(_0x271862,_0x4f244d){var _0x4deb02={'raw':![],'where':{}};var _0x50f60b={};var _0x26cfd6={'count':0x0,'rows':[]};return db[_0x288a('0x4c')][_0x288a('0x7b')]({'where':{'id':_0x271862[_0x288a('0x65')]['id']}})[_0x288a('0x17')](handleEntityNotFound(_0x4f244d,null))[_0x288a('0x17')](function(_0x4a7bb3){if(_0x4a7bb3){_0x50f60b['model']=_[_0x288a('0x51')](db[_0x288a('0xbd')][_0x288a('0x4d')]);_0x50f60b[_0x288a('0x50')]=_[_0x288a('0x51')](_0x271862[_0x288a('0x50')]);_0x50f60b['filters']=_['intersection'](_0x50f60b[_0x288a('0x43')],_0x50f60b[_0x288a('0x50')]);_0x4deb02[_0x288a('0x53')]=_['intersection'](_0x50f60b[_0x288a('0x43')],qs['fields'](_0x271862[_0x288a('0x50')][_0x288a('0x54')]));_0x4deb02[_0x288a('0x53')]=_0x4deb02[_0x288a('0x53')][_0x288a('0x55')]?_0x4deb02[_0x288a('0x53')]:_0x50f60b['model'];if(!_0x271862[_0x288a('0x50')][_0x288a('0x56')](_0x288a('0x57'))){_0x4deb02[_0x288a('0x26')]=qs[_0x288a('0x26')](_0x271862[_0x288a('0x50')]['limit']);_0x4deb02['offset']=qs['offset'](_0x271862['query'][_0x288a('0x25')]);}_0x4deb02[_0x288a('0x58')]=qs[_0x288a('0x59')](_0x271862[_0x288a('0x50')][_0x288a('0x59')]);_0x4deb02[_0x288a('0x5a')]=qs['filters'](_[_0x288a('0x5c')](_0x271862[_0x288a('0x50')],_0x50f60b['filters']));_0x4deb02[_0x288a('0x5a')]['ChatWebsiteId']=_0x4a7bb3['id'];if(_0x271862[_0x288a('0x50')]['filter']){_0x4deb02[_0x288a('0x5a')]=_[_0x288a('0x5d')](_0x4deb02[_0x288a('0x5a')],{'$or':_[_0x288a('0x4b')](_0x4deb02[_0x288a('0x53')],function(_0x30f101){var _0x250b1b={};_0x250b1b[_0x30f101]={'$like':'%'+_0x271862['query'][_0x288a('0x5f')]+'%'};return _0x250b1b;})});}_0x4deb02=_[_0x288a('0x5d')]({},_0x4deb02,_0x271862[_0x288a('0x66')]);return db[_0x288a('0xbd')][_0x288a('0x28')]({'where':_0x4deb02[_0x288a('0x5a')]})['then'](function(_0x436ec7){_0x26cfd6[_0x288a('0x28')]=_0x436ec7;if(_0x271862[_0x288a('0x50')][_0x288a('0x60')]){_0x4deb02[_0x288a('0x61')]=[{'model':db[_0x288a('0xa6')],'as':_0x288a('0x105'),'required':![]},{'model':db[_0x288a('0xca')],'as':_0x288a('0x106'),'attributes':[_0x288a('0x32'),_0x288a('0x107'),'internal'],'required':![]},{'model':db[_0x288a('0x108')],'as':_0x288a('0x109'),'attributes':['id',_0x288a('0x32'),'color'],'where':_0x271862[_0x288a('0x50')]['tag']?{'id':_0x271862[_0x288a('0x50')]['tag']}:undefined,'required':_0x271862[_0x288a('0x50')][_0x288a('0x10a')]?!![]:![]}];}return db[_0x288a('0xbd')][_0x288a('0x62')](_0x4deb02);})[_0x288a('0x17')](function(_0x26a2a0){_0x26cfd6[_0x288a('0x63')]=_0x26a2a0;return _0x26cfd6;});}})['then'](respondWithFilteredResult(_0x4f244d,_0x4deb02))[_0x288a('0x21')](handleError(_0x4f244d,null));};exports[_0x288a('0x10b')]=function(_0x47f7b4,_0x1c7869){var _0x315449=0x0;var _0x3bb691=0x0;var _0x48f8de=![];var _0xb8b897;var _0x4af911;return db[_0x288a('0x4c')][_0x288a('0x67')]({'where':{'id':_0x47f7b4[_0x288a('0x65')]['id']},'include':[{'model':db[_0x288a('0x9c')],'as':'Interval','include':[{'model':db[_0x288a('0x9c')],'as':_0x288a('0xb0'),'attributes':['id',_0x288a('0xb1')]}]}]})[_0x288a('0x17')](handleEntityNotFound(_0x1c7869,null))[_0x288a('0x17')](function(_0x28501e){if(_0x28501e){_0xb8b897=_0x28501e;return _0x28501e[_0x288a('0x10c')]({'raw':!![]});}})[_0x288a('0x17')](function(_0x2604a2){if(_0xb8b897){if(_0x2604a2){_0x4af911=_0x2604a2;}}return require(_0x288a('0x8d'))[_0x288a('0x8e')]();})['then'](function(_0x2f9b6b){if(_0x2f9b6b){_0x3bb691=_0x2f9b6b[_0x288a('0x10d')];_0x48f8de=_0x2f9b6b[_0x288a('0x8f')];}})[_0x288a('0x17')](function(){return db[_0x288a('0xbd')][_0x288a('0x28')]({'where':{'closed':![]}});})['then'](function(_0x452f61){_0x315449=_0x452f61;if(_0x3bb691&&_0x452f61>_0x3bb691){return db[_0x288a('0x10e')][_0x288a('0x7b')]({'where':{'id':0x1}})[_0x288a('0x17')](function(_0x5148a9){if(_0x5148a9){_0x5148a9[_0x288a('0x10f')](_0x288a('0x110'));}});}})[_0x288a('0x17')](function(){var _0x2aa793=_0xb8b897['Interval'];var _0x3d74f8=_0xb8b897[_0x288a('0x9e')]||undefined;return _0x2aa793?_0x2aa793[_0x288a('0x9f')](_0x3d74f8):!![];})[_0x288a('0x17')](function(_0x2c2e74){var _0x4fa6d6=fs[_0x288a('0x111')](path[_0x288a('0x92')](config[_0x288a('0x8c')],_0x288a('0x112')),_0x288a('0xe3'));var _0x227020=_0x288a('0x113');var _0x1a8434=![];var _0x45fdd3,_0x450f42;if(_0x47f7b4[_0x288a('0xba')][_0x288a('0xc1')]){_0x45fdd3=new URL(_0x47f7b4[_0x288a('0xba')][_0x288a('0xc1')])[_0x288a('0x114')];}else if(_0x47f7b4[_0x288a('0xba')][_0x288a('0x114')]){_0x45fdd3=new URL(_0x47f7b4[_0x288a('0xba')][_0x288a('0x114')])[_0x288a('0x114')];}else{_0x45fdd3=_0x288a('0x115');}_0x450f42=typeof _0xb8b897[_0x288a('0x68')]['split'](',')[_0x288a('0x67')](function(_0x1376c1){return wildcardUtils[_0x288a('0x116')](_0x1376c1,_0x45fdd3);})!=='undefined';var _0x57ea42={'chatVersion':_0x227020,'chatWebsiteAddressOrigin':_0x450f42?_0x45fdd3:_0xb8b897[_0x288a('0x68')],'remote':_0xb8b897[_0x288a('0x117')],'query':querystring['stringify'](_['merge'](_0xb8b897[_0x288a('0x2d')]({'plain':!![]}),{'customerIp':_0x47f7b4[_0x288a('0xba')]['x-forwarded-for']||_0x47f7b4['headers'][_0x288a('0x118')]||_0x47f7b4[_0x288a('0x119')][_0x288a('0x11a')]||_0x47f7b4['ip'],'referer':_0x47f7b4['headers'][_0x288a('0xc1')],'openedInteractions':_0x315449,'maxInteractions':_0x3bb691,'virtual':_0x48f8de['virtual'],'online':_0x2c2e74,'custom':_0x48f8de,'address':_0x450f42?_0x45fdd3:null}))[_0x288a('0x11b')](/'/g,'\x5c\x27')};_0x1c7869[_0x288a('0xda')](ejs[_0x288a('0xe4')](Mustache[_0x288a('0xe4')](_0x4fa6d6,_0x57ea42),{'proactiveActions':_0x4af911,'alignment':_0xb8b897[_0x288a('0x11c')],'verticalAlignment':_0xb8b897[_0x288a('0x11d')],'div_color':_0xb8b897[_0x288a('0x11e')],'labelText':_0xb8b897[_0x288a('0x11f')],'text_color':_0xb8b897[_0x288a('0x120')],'text_button_color':_0xb8b897[_0x288a('0x121')],'button_color':_0xb8b897[_0x288a('0x122')],'background_color':_0xb8b897['backgroundColor'],'hideWhenOffline':_0xb8b897[_0x288a('0x123')],'intervalId':_0xb8b897[_0x288a('0x124')],'isDevelopment':_0x1a8434,'chatVersion':_0x227020}));})[_0x288a('0x21')](handleError(_0x1c7869,null));};exports[_0x288a('0x125')]=function(_0x1a9e76,_0x48e0b8){var _0x14277f=_0x1a9e76[_0x288a('0x65')]['id'];var _0xfc454e=_0x1a9e76[_0x288a('0x6e')];var _0x2dc94a=0xc8;var _0x20f288=null;return db[_0x288a('0xeb')][_0x288a('0x126')]({'isolationLevel':db[_0x288a('0xeb')][_0x288a('0x127')][_0x288a('0x128')][_0x288a('0x129')]},function(_0x2e9cd2){return db['ChatWebsite'][_0x288a('0x7b')]({'where':{'id':_0x14277f},'transaction':_0x2e9cd2})[_0x288a('0x17')](function(_0x1df510){if(_0x1df510){return db['ChatApplication'][_0x288a('0x2c')]({'where':{'ChatWebsiteId':_0x14277f},'transaction':_0x2e9cd2})[_0x288a('0x17')](function(){var _0x41cc5a=_[_0x288a('0x4b')](_0xfc454e,function(_0x2e415f){_0x2e415f[_0x288a('0x78')]=_0x14277f;return _0x2e415f;});return db[_0x288a('0xaf')]['bulkCreate'](_0x41cc5a,{'transaction':_0x2e9cd2});});}else{_0x2dc94a=0x194;_0x20f288=[];}});})[_0x288a('0x17')](function(){if(_0x2dc94a!==0x194){return db[_0x288a('0xaf')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x14277f},'order':_0x288a('0xb6')})['then'](function(_0x1a95ce){_0x20f288=_0x1a95ce;});}})['catch'](function(_0x37a1b4){_0x2dc94a=0x1f4;logger[_0x288a('0x1c')](_0x37a1b4[_0x288a('0x31')]);if(_0x37a1b4['name']){delete _0x37a1b4['name'];}_0x20f288=_0x37a1b4;})[_0x288a('0x12a')](function(){if(_0x20f288===null){_0x48e0b8[_0x288a('0x30')](_0x2dc94a);}else{if(_0x2dc94a===0x1f4){_0x48e0b8[_0x288a('0x22')](_0x2dc94a)[_0x288a('0xda')](_0x20f288);}else{_0x48e0b8[_0x288a('0x22')](_0x2dc94a)['json'](_0x20f288);}}});};exports['getApplications']=function(_0x1fcfb5,_0x4f49ad){var _0x2d622b={};var _0x520ac4={};var _0x2b41c6;var _0x1946f0;return db[_0x288a('0x4c')]['findOne']({'where':{'id':_0x1fcfb5['params']['id']}})[_0x288a('0x17')](handleEntityNotFound(_0x4f49ad,null))[_0x288a('0x17')](function(_0xaa0cae){if(_0xaa0cae){_0x2b41c6=_0xaa0cae;_0x520ac4[_0x288a('0x43')]=_[_0x288a('0x51')](db[_0x288a('0xaf')][_0x288a('0x4d')]);_0x520ac4[_0x288a('0x50')]=_[_0x288a('0x51')](_0x1fcfb5[_0x288a('0x50')]);_0x520ac4[_0x288a('0x5b')]=_['intersection'](_0x520ac4[_0x288a('0x43')],_0x520ac4['query']);_0x2d622b['attributes']=_[_0x288a('0x52')](_0x520ac4[_0x288a('0x43')],qs['fields'](_0x1fcfb5[_0x288a('0x50')]['fields']));_0x2d622b[_0x288a('0x53')]=_0x2d622b[_0x288a('0x53')][_0x288a('0x55')]?_0x2d622b['attributes']:_0x520ac4[_0x288a('0x43')];_0x2d622b['order']=qs[_0x288a('0x59')](_0x1fcfb5[_0x288a('0x50')][_0x288a('0x59')]);_0x2d622b[_0x288a('0x5a')]=qs[_0x288a('0x5b')](_[_0x288a('0x5c')](_0x1fcfb5[_0x288a('0x50')],_0x520ac4['filters']));if(_0x1fcfb5[_0x288a('0x50')][_0x288a('0x5f')]){_0x2d622b[_0x288a('0x5a')]=_[_0x288a('0x5d')](_0x2d622b[_0x288a('0x5a')],{'$or':_[_0x288a('0x4b')](_0x2d622b['attributes'],function(_0x4a84c0){var _0x5eafee={};_0x5eafee[_0x4a84c0]={'$like':'%'+_0x1fcfb5['query']['filter']+'%'};return _0x5eafee;})});}_0x2d622b=_[_0x288a('0x5d')]({},_0x2d622b,_0x1fcfb5[_0x288a('0x66')]);return _0x2b41c6[_0x288a('0x12b')](_0x2d622b);}})[_0x288a('0x17')](function(_0x4bf33b){if(_0x4bf33b){_0x1946f0=_0x4bf33b[_0x288a('0x55')];if(!_0x1fcfb5[_0x288a('0x50')][_0x288a('0x56')]('nolimit')){_0x2d622b[_0x288a('0x26')]=qs[_0x288a('0x26')](_0x1fcfb5['query']['limit']);_0x2d622b['offset']=qs[_0x288a('0x25')](_0x1fcfb5[_0x288a('0x50')][_0x288a('0x25')]);}return _0x2b41c6[_0x288a('0x12b')](_0x2d622b);}})[_0x288a('0x17')](function(_0x3e7e18){if(_0x3e7e18){return _0x3e7e18?{'count':_0x1946f0,'rows':_0x3e7e18}:null;}})[_0x288a('0x17')](respondWithResult(_0x4f49ad,null))['catch'](handleError(_0x4f49ad,null));};exports[_0x288a('0x12c')]=function(_0x493368,_0x23ffb8){return db['chatProactiveAction'][_0x288a('0x67')]({'where':{'id':_0x493368[_0x288a('0x65')]['id']}})[_0x288a('0x17')](handleEntityNotFound(_0x23ffb8,null))[_0x288a('0x17')](function(_0x32abd7){if(_0x32abd7){return _0x32abd7['addProactiveActions'](_0x493368[_0x288a('0x6e')][_0x288a('0x81')],_[_0x288a('0x103')](_0x493368[_0x288a('0x6e')],['ids','id'])||{});}})[_0x288a('0x17')](respondWithResult(_0x23ffb8,null))['catch'](handleError(_0x23ffb8,null));};exports[_0x288a('0x10c')]=function(_0x506cc6,_0x38e950){var _0x1954df={};var _0x278207={};var _0x151da9;var _0x3f59de;return db[_0x288a('0x4c')][_0x288a('0x7b')]({'where':{'id':_0x506cc6['params']['id']}})[_0x288a('0x17')](handleEntityNotFound(_0x38e950,null))[_0x288a('0x17')](function(_0x41fbec){if(_0x41fbec){_0x151da9=_0x41fbec;_0x278207[_0x288a('0x43')]=_[_0x288a('0x51')](db[_0x288a('0x12d')]['rawAttributes']);_0x278207[_0x288a('0x50')]=_['keys'](_0x506cc6[_0x288a('0x50')]);_0x278207[_0x288a('0x5b')]=_[_0x288a('0x52')](_0x278207[_0x288a('0x43')],_0x278207[_0x288a('0x50')]);_0x1954df[_0x288a('0x53')]=_[_0x288a('0x52')](_0x278207[_0x288a('0x43')],qs[_0x288a('0x54')](_0x506cc6[_0x288a('0x50')][_0x288a('0x54')]));_0x1954df[_0x288a('0x53')]=_0x1954df[_0x288a('0x53')]['length']?_0x1954df[_0x288a('0x53')]:_0x278207[_0x288a('0x43')];_0x1954df[_0x288a('0x58')]=qs[_0x288a('0x59')](_0x506cc6[_0x288a('0x50')][_0x288a('0x59')]);_0x1954df[_0x288a('0x5a')]=qs[_0x288a('0x5b')](_[_0x288a('0x5c')](_0x506cc6[_0x288a('0x50')],_0x278207[_0x288a('0x5b')]));if(_0x506cc6[_0x288a('0x50')][_0x288a('0x5f')]){_0x1954df[_0x288a('0x5a')]=_[_0x288a('0x5d')](_0x1954df[_0x288a('0x5a')],{'$or':_[_0x288a('0x4b')](_0x1954df[_0x288a('0x53')],function(_0x164d65){var _0x3caffa={};_0x3caffa[_0x164d65]={'$like':'%'+_0x506cc6[_0x288a('0x50')][_0x288a('0x5f')]+'%'};return _0x3caffa;})});}_0x1954df=_['merge']({},_0x1954df,_0x506cc6[_0x288a('0x66')]);return _0x151da9[_0x288a('0x10c')](_0x1954df);}})[_0x288a('0x17')](function(_0x407f59){if(_0x407f59){_0x3f59de=_0x407f59[_0x288a('0x55')];if(!_0x506cc6['query'][_0x288a('0x56')](_0x288a('0x57'))){_0x1954df[_0x288a('0x26')]=qs[_0x288a('0x26')](_0x506cc6[_0x288a('0x50')][_0x288a('0x26')]);_0x1954df['offset']=qs[_0x288a('0x25')](_0x506cc6['query'][_0x288a('0x25')]);}return _0x151da9[_0x288a('0x10c')](_0x1954df);}})[_0x288a('0x17')](function(_0xfe933f){if(_0xfe933f){return _0xfe933f?{'count':_0x3f59de,'rows':_0xfe933f}:null;}})[_0x288a('0x17')](respondWithResult(_0x38e950,null))[_0x288a('0x21')](handleError(_0x38e950,null));};exports[_0x288a('0x12e')]=function(_0x33091f,_0x243833){var _0x5e3701=_0x33091f['query']['online']==='false'?_0x288a('0x12f'):_0x288a('0x130');return db[_0x288a('0x4c')]['find']({'attributes':['id',_0x5e3701],'where':{'id':_0x33091f['params']['id']}})[_0x288a('0x17')](handleEntityNotFound(_0x243833,null))[_0x288a('0x17')](function(_0x373f3c){if(_0x373f3c){var _0x5e71c6=_0x373f3c[_0x5e3701];var _0x2dc265=_0x5e71c6&&_0x5e71c6['items']?_0x5e71c6[_0x288a('0x131')]:[];_0x243833[_0x288a('0xda')]({'fromKey':_['isNil'](_0x5e71c6['fromKey'])?undefined:_0x5e71c6[_0x288a('0x132')],'count':_0x2dc265[_0x288a('0x55')],'rows':_0x2dc265});}})[_0x288a('0x21')](handleError(_0x243833,null));};exports[_0x288a('0x133')]=function(_0x56b511,_0x292795){var _0xf879fd={'raw':![],'where':{}};var _0x23103e={};var _0x52cd8e={'count':0x0,'rows':[]};return db[_0x288a('0x4c')][_0x288a('0x7b')]({'where':{'id':_0x56b511[_0x288a('0x65')]['id']}})[_0x288a('0x17')](handleEntityNotFound(_0x292795,null))['then'](function(_0x3dd59c){if(_0x3dd59c){_0x23103e[_0x288a('0x43')]=_[_0x288a('0x51')](db[_0x288a('0xe5')][_0x288a('0x4d')]);_0x23103e[_0x288a('0x50')]=_['keys'](_0x56b511[_0x288a('0x50')]);_0x23103e[_0x288a('0x5b')]=_[_0x288a('0x52')](_0x23103e[_0x288a('0x43')],_0x23103e[_0x288a('0x50')]);_0xf879fd['attributes']=_['intersection'](_0x23103e[_0x288a('0x43')],qs[_0x288a('0x54')](_0x56b511[_0x288a('0x50')][_0x288a('0x54')]));_0xf879fd[_0x288a('0x53')]=_0xf879fd[_0x288a('0x53')][_0x288a('0x55')]?_0xf879fd[_0x288a('0x53')]:_0x23103e[_0x288a('0x43')];if(!_0x56b511[_0x288a('0x50')][_0x288a('0x56')](_0x288a('0x57'))){_0xf879fd['limit']=qs[_0x288a('0x26')](_0x56b511[_0x288a('0x50')][_0x288a('0x26')]);_0xf879fd[_0x288a('0x25')]=qs[_0x288a('0x25')](_0x56b511[_0x288a('0x50')]['offset']);}_0xf879fd[_0x288a('0x58')]=qs['sort'](_0x56b511[_0x288a('0x50')]['sort']);_0xf879fd['where']=qs[_0x288a('0x5b')](_[_0x288a('0x5c')](_0x56b511[_0x288a('0x50')],_0x23103e['filters']));_0xf879fd['where'][_0x288a('0x78')]=_0x3dd59c['id'];if(_0x56b511['query']['filter']){_0xf879fd[_0x288a('0x5a')]=_[_0x288a('0x5d')](_0xf879fd['where'],{'$or':_['map'](_0xf879fd[_0x288a('0x53')],function(_0x4d80c5){var _0x9a3288={};_0x9a3288[_0x4d80c5]={'$like':'%'+_0x56b511['query'][_0x288a('0x5f')]+'%'};return _0x9a3288;})});}_0xf879fd=_[_0x288a('0x5d')]({},_0xf879fd,_0x56b511[_0x288a('0x66')]);return db['ChatOfflineMessage'][_0x288a('0x28')]({'where':_0xf879fd[_0x288a('0x5a')]})[_0x288a('0x17')](function(_0x407a6){_0x52cd8e[_0x288a('0x28')]=_0x407a6;if(_0x56b511['query'][_0x288a('0x60')]){_0xf879fd[_0x288a('0x61')]=[{'all':!![]}];}else{_0xf879fd[_0x288a('0x61')]=[{'model':db[_0x288a('0xa6')],'as':_0x288a('0x105'),'required':![]},{'model':db['Attachment'],'as':_0x288a('0x134'),'required':![]}];}return db[_0x288a('0xe5')]['findAll'](_0xf879fd);})[_0x288a('0x17')](function(_0x140430){_0x52cd8e['rows']=_0x140430;return _0x52cd8e;});}})['then'](respondWithFilteredResult(_0x292795,_0xf879fd))[_0x288a('0x21')](handleError(_0x292795,null));};exports[_0x288a('0x135')]=function(_0x1d0cb8,_0x4551a9){return db[_0x288a('0x4c')][_0x288a('0x67')]({'where':{'id':_0x1d0cb8['params']['id']}})[_0x288a('0x17')](handleEntityNotFound(_0x4551a9,null))['then'](function(_0x5b0530){if(_0x5b0530){return _0x5b0530['addAgents'](_0x1d0cb8[_0x288a('0x6e')][_0x288a('0x81')],_[_0x288a('0x103')](_0x1d0cb8[_0x288a('0x6e')],['ids','id'])||{})['spread'](function(_0x128aa5){for(var _0x1eed5e=0x0;_0x1eed5e<_0x1d0cb8[_0x288a('0x6e')][_0x288a('0x81')][_0x288a('0x55')];_0x1eed5e+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x1d0cb8[_0x288a('0x6e')]['ids'][_0x1eed5e]),'ChatWebsiteId':Number(_0x1d0cb8['params']['id'])});}return _0x128aa5;});}})[_0x288a('0x17')](respondWithResult(_0x4551a9,null))[_0x288a('0x21')](handleError(_0x4551a9,null));};exports[_0x288a('0x136')]=function(_0x4fc010,_0x320a12){return db[_0x288a('0x4c')][_0x288a('0x67')]({'where':{'id':_0x4fc010['params']['id']}})[_0x288a('0x17')](handleEntityNotFound(_0x320a12,null))[_0x288a('0x17')](function(_0x2d3676){if(_0x2d3676){return _0x2d3676[_0x288a('0x136')](_0x4fc010['query'][_0x288a('0x81')])[_0x288a('0x17')](function(){if(_[_0x288a('0x137')](_0x4fc010['query'][_0x288a('0x81')])){for(var _0x323d8d=0x0;_0x323d8d<_0x4fc010[_0x288a('0x50')][_0x288a('0x81')][_0x288a('0x55')];_0x323d8d+=0x1){socket['emit'](_0x288a('0x138'),{'UserId':Number(_0x4fc010['query'][_0x288a('0x81')][_0x323d8d]),'ChatWebsiteId':Number(_0x4fc010[_0x288a('0x65')]['id'])});}}else{socket['emit'](_0x288a('0x138'),{'UserId':Number(_0x4fc010[_0x288a('0x50')][_0x288a('0x81')]),'ChatWebsiteId':Number(_0x4fc010[_0x288a('0x65')]['id'])});}});}})['then'](respondWithStatusCode(_0x320a12,null))['catch'](handleError(_0x320a12,null));};exports[_0x288a('0x139')]=function(_0x52abd7,_0x57b9fb){var _0x277042={};var _0x5b8eb8={};var _0x1b099b;var _0x65354c;return db[_0x288a('0x4c')][_0x288a('0x7b')]({'where':{'id':_0x52abd7[_0x288a('0x65')]['id']}})[_0x288a('0x17')](handleEntityNotFound(_0x57b9fb,null))[_0x288a('0x17')](function(_0x5791df){if(_0x5791df){_0x1b099b=_0x5791df;_0x5b8eb8[_0x288a('0x43')]=_['keys'](db[_0x288a('0xca')]['rawAttributes']);_0x5b8eb8[_0x288a('0x50')]=_[_0x288a('0x51')](_0x52abd7[_0x288a('0x50')]);_0x5b8eb8[_0x288a('0x5b')]=_[_0x288a('0x52')](_0x5b8eb8[_0x288a('0x43')],_0x5b8eb8['query']);_0x277042[_0x288a('0x53')]=_['intersection'](_0x5b8eb8['model'],qs['fields'](_0x52abd7['query']['fields']));_0x277042['attributes']=_0x277042[_0x288a('0x53')][_0x288a('0x55')]?_0x277042['attributes']:_0x5b8eb8[_0x288a('0x43')];_0x277042[_0x288a('0x58')]=qs[_0x288a('0x59')](_0x52abd7['query'][_0x288a('0x59')]);_0x277042['where']=qs['filters'](_[_0x288a('0x5c')](_0x52abd7[_0x288a('0x50')],_0x5b8eb8[_0x288a('0x5b')]));if(_0x52abd7[_0x288a('0x50')][_0x288a('0x5f')]){_0x277042[_0x288a('0x5a')]=_[_0x288a('0x5d')](_0x277042['where'],{'$or':_[_0x288a('0x4b')](_0x277042[_0x288a('0x53')],function(_0x1ad8fc){var _0x199cd9={};_0x199cd9[_0x1ad8fc]={'$like':'%'+_0x52abd7[_0x288a('0x50')][_0x288a('0x5f')]+'%'};return _0x199cd9;})});}_0x277042=_['merge']({},_0x277042,_0x52abd7[_0x288a('0x66')]);return _0x1b099b[_0x288a('0x139')](_0x277042);}})[_0x288a('0x17')](function(_0x220d24){if(_0x220d24){_0x65354c=_0x220d24[_0x288a('0x55')];if(!_0x52abd7[_0x288a('0x50')][_0x288a('0x56')](_0x288a('0x57'))){_0x277042['limit']=qs[_0x288a('0x26')](_0x52abd7[_0x288a('0x50')][_0x288a('0x26')]);_0x277042[_0x288a('0x25')]=qs[_0x288a('0x25')](_0x52abd7[_0x288a('0x50')][_0x288a('0x25')]);}return _0x1b099b[_0x288a('0x139')](_0x277042);}})[_0x288a('0x17')](function(_0x5e004b){if(_0x5e004b){return _0x5e004b?{'count':_0x65354c,'rows':_0x5e004b}:null;}})[_0x288a('0x17')](respondWithResult(_0x57b9fb,null))['catch'](handleError(_0x57b9fb,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 16db670..07f27bb 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 _0xe599=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save'];(function(_0x188b59,_0x31709d){var _0x3a7f03=function(_0x3729f9){while(--_0x3729f9){_0x188b59['push'](_0x188b59['shift']());}};_0x3a7f03(++_0x31709d);}(_0xe599,0x1e5));var _0x9e59=function(_0x528576,_0x445613){_0x528576=_0x528576-0x0;var _0x3a4d89=_0xe599[_0x528576];return _0x3a4d89;};'use strict';var EventEmitter=require(_0x9e59('0x0'));var ChatWebsite=require(_0x9e59('0x1'))['db'][_0x9e59('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9e59('0x3')](0x0);var events={'afterCreate':_0x9e59('0x4'),'afterUpdate':_0x9e59('0x5'),'afterDestroy':_0x9e59('0x6')};function emitEvent(_0x296a98){return function(_0x3b40cc,_0x568c08,_0x156af6){ChatWebsiteEvents[_0x9e59('0x7')](_0x296a98+':'+_0x3b40cc['id'],_0x3b40cc);ChatWebsiteEvents['emit'](_0x296a98,_0x3b40cc);_0x156af6(null);};}for(var e in events){if(events[_0x9e59('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x9e59('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xb2b5=['emit','hasOwnProperty','hook','save','update'];(function(_0x38699b,_0x3872cd){var _0x534902=function(_0x5ed6c5){while(--_0x5ed6c5){_0x38699b['push'](_0x38699b['shift']());}};_0x534902(++_0x3872cd);}(_0xb2b5,0xa3));var _0x5b2b=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xb2b5[_0x45d55e];return _0x29812a;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5b2b('0x0'),'afterUpdate':_0x5b2b('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4eee87){return function(_0x31784d,_0x11fae1,_0x51e747){ChatWebsiteEvents[_0x5b2b('0x2')](_0x4eee87+':'+_0x31784d['id'],_0x31784d);ChatWebsiteEvents['emit'](_0x4eee87,_0x31784d);_0x51e747(null);};}for(var e in events){if(events[_0x5b2b('0x3')](e)){var event=events[e];ChatWebsite[_0x5b2b('0x4')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index faf7481..836022b 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 _0xb681=['rimraf','exports','chat_websites','lodash','util','../../config/logger','moment'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xb681,0xce));var _0x1b68=function(_0xc27c67,_0x9c5393){_0xc27c67=_0xc27c67-0x0;var _0x308291=_0xb681[_0xc27c67];return _0x308291;};'use strict';var _=require(_0x1b68('0x0'));var util=require(_0x1b68('0x1'));var logger=require(_0x1b68('0x2'))('api');var moment=require(_0x1b68('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b68('0x4'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module[_0x1b68('0x5')]=function(_0x34e31b,_0x111ffe){return _0x34e31b['define']('ChatWebsite',attributes,{'tableName':_0x1b68('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb39=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','bluebird'];(function(_0x270b9d,_0x8e1c){var _0x32ac0c=function(_0x497809){while(--_0x497809){_0x270b9d['push'](_0x270b9d['shift']());}};_0x32ac0c(++_0x8e1c);}(_0xcb39,0x18f));var _0x9cb3=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0xcb39[_0x350aeb];return _0x3c5273;};'use strict';var _=require(_0x9cb3('0x0'));var util=require(_0x9cb3('0x1'));var logger=require(_0x9cb3('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9cb3('0x3'));var rp=require(_0x9cb3('0x4'));var fs=require('fs');var path=require(_0x9cb3('0x5'));var rimraf=require(_0x9cb3('0x6'));var config=require(_0x9cb3('0x7'));var attributes=require(_0x9cb3('0x8'));module[_0x9cb3('0x9')]=function(_0x5441b5,_0x28765c){return _0x5441b5[_0x9cb3('0xa')](_0x9cb3('0xb'),attributes,{'tableName':_0x9cb3('0xc'),'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 fe92000..16193b3 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 _0x15fb=['result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0x15fb,0xc9));var _0xb15f=function(_0x933505,_0x59b767){_0x933505=_0x933505-0x0;var _0x44a019=_0x15fb[_0x933505];return _0x44a019;};'use strict';var _=require(_0xb15f('0x0'));var util=require('util');var moment=require(_0xb15f('0x1'));var BPromise=require('bluebird');var rs=require(_0xb15f('0x2'));var fs=require('fs');var Redis=require(_0xb15f('0x3'));var db=require(_0xb15f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb15f('0x5'))('rpc');var config=require(_0xb15f('0x6'));var jayson=require(_0xb15f('0x7'));var client=jayson[_0xb15f('0x8')]['http']({'port':0x232a});config[_0xb15f('0x9')]=_['defaults'](config[_0xb15f('0x9')],{'host':_0xb15f('0xa'),'port':0x18eb});var socket=require(_0xb15f('0xb'))(new Redis(config['redis']));require(_0xb15f('0xc'))[_0xb15f('0xd')](socket);function respondWithRpcPromise(_0x22055d,_0x2af58f,_0x41c1fd){return new BPromise(function(_0x4820be,_0x47a821){return client[_0xb15f('0xe')](_0x22055d,_0x41c1fd)[_0xb15f('0xf')](function(_0x509f81){logger[_0xb15f('0x10')](_0xb15f('0x11'),_0x2af58f,_0xb15f('0x12'));logger[_0xb15f('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x2af58f,_0xb15f('0x12'),JSON[_0xb15f('0x14')](_0x509f81));if(_0x509f81['error']){if(_0x509f81[_0xb15f('0x15')][_0xb15f('0x16')]===0x1f4){logger[_0xb15f('0x15')](_0xb15f('0x11'),_0x2af58f,_0x509f81['error'][_0xb15f('0x17')]);return _0x47a821(_0x509f81[_0xb15f('0x15')]['message']);}logger[_0xb15f('0x15')](_0xb15f('0x11'),_0x2af58f,_0x509f81[_0xb15f('0x15')][_0xb15f('0x17')]);return _0x4820be(_0x509f81[_0xb15f('0x15')]['message']);}else{logger[_0xb15f('0x10')](_0xb15f('0x11'),_0x2af58f,_0xb15f('0x12'));_0x4820be(_0x509f81[_0xb15f('0x18')]['message']);}})['catch'](function(_0x288e64){logger[_0xb15f('0x15')](_0xb15f('0x11'),_0x2af58f,_0x288e64);_0x47a821(_0x288e64);});});} \ No newline at end of file +var _0xf274=['info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0xef4ef0,_0x3c72f9){var _0x39b60b=function(_0x1d824c){while(--_0x1d824c){_0xef4ef0['push'](_0xef4ef0['shift']());}};_0x39b60b(++_0x3c72f9);}(_0xf274,0x1e2));var _0x4f27=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xf274[_0x1a72f3];return _0x57ef47;};'use strict';var _=require(_0x4f27('0x0'));var util=require(_0x4f27('0x1'));var moment=require(_0x4f27('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f27('0x3'));var fs=require('fs');var Redis=require(_0x4f27('0x4'));var db=require(_0x4f27('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f27('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4f27('0x7'));var client=jayson['client'][_0x4f27('0x8')]({'port':0x232a});config[_0x4f27('0x9')]=_[_0x4f27('0xa')](config[_0x4f27('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f27('0xb'))(new Redis(config[_0x4f27('0x9')]));require(_0x4f27('0xc'))[_0x4f27('0xd')](socket);function respondWithRpcPromise(_0x48e4a7,_0x1bad82,_0x381d17){return new BPromise(function(_0x1a4fe8,_0x40ca6e){return client[_0x4f27('0xe')](_0x48e4a7,_0x381d17)[_0x4f27('0xf')](function(_0x552560){logger['info'](_0x4f27('0x10'),_0x1bad82,_0x4f27('0x11'));logger[_0x4f27('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1bad82,'request\x20sent',JSON['stringify'](_0x552560));if(_0x552560[_0x4f27('0x13')]){if(_0x552560['error'][_0x4f27('0x14')]===0x1f4){logger[_0x4f27('0x13')](_0x4f27('0x10'),_0x1bad82,_0x552560[_0x4f27('0x13')]['message']);return _0x40ca6e(_0x552560[_0x4f27('0x13')]['message']);}logger[_0x4f27('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x1bad82,_0x552560['error']['message']);return _0x1a4fe8(_0x552560[_0x4f27('0x13')][_0x4f27('0x15')]);}else{logger[_0x4f27('0x16')](_0x4f27('0x10'),_0x1bad82,'request\x20sent');_0x1a4fe8(_0x552560[_0x4f27('0x17')]['message']);}})['catch'](function(_0x2e47e8){logger[_0x4f27('0x13')](_0x4f27('0x10'),_0x1bad82,_0x2e47e8);_0x40ca6e(_0x2e47e8);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 3398d7b..ea680c1 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 _0x73c4=['save','remove','update','emit','length','chatWebsite:','./chatWebsite.events'];(function(_0x24d632,_0x41030b){var _0x4d9e06=function(_0x18c58c){while(--_0x18c58c){_0x24d632['push'](_0x24d632['shift']());}};_0x4d9e06(++_0x41030b);}(_0x73c4,0x1db));var _0x473c=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x73c4[_0x1c546c];return _0x2cc384;};'use strict';var ChatWebsiteEvents=require(_0x473c('0x0'));var events=[_0x473c('0x1'),_0x473c('0x2'),_0x473c('0x3')];function createListener(_0x3a06e8,_0x525a15){return function(_0xc3a617){_0x525a15[_0x473c('0x4')](_0x3a06e8,_0xc3a617);};}function removeListener(_0x1fbdbd,_0x430e88){return function(){ChatWebsiteEvents['removeListener'](_0x1fbdbd,_0x430e88);};}exports['register']=function(_0xe98fe7){for(var _0x4e6ba1=0x0,_0x4a5db3=events[_0x473c('0x5')];_0x4e6ba1<_0x4a5db3;_0x4e6ba1++){var _0x313400=events[_0x4e6ba1];var _0x246aba=createListener(_0x473c('0x6')+_0x313400,_0xe98fe7);ChatWebsiteEvents['on'](_0x313400,_0x246aba);}}; \ No newline at end of file +var _0x1f43=['save','remove','update','emit','register','length'];(function(_0x4af172,_0x44c861){var _0x4ad3ab=function(_0x4b28eb){while(--_0x4b28eb){_0x4af172['push'](_0x4af172['shift']());}};_0x4ad3ab(++_0x44c861);}(_0x1f43,0x72));var _0x31f4=function(_0x280447,_0x3b2093){_0x280447=_0x280447-0x0;var _0x420280=_0x1f43[_0x280447];return _0x420280;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x31f4('0x0'),_0x31f4('0x1'),_0x31f4('0x2')];function createListener(_0x3b2aef,_0x2882c4){return function(_0xa572f8){_0x2882c4[_0x31f4('0x3')](_0x3b2aef,_0xa572f8);};}function removeListener(_0x217087,_0x23d83c){return function(){ChatWebsiteEvents['removeListener'](_0x217087,_0x23d83c);};}exports[_0x31f4('0x4')]=function(_0x12ed82){for(var _0x5d00fe=0x0,_0x3086ee=events[_0x31f4('0x5')];_0x5d00fe<_0x3086ee;_0x5d00fe++){var _0x597240=events[_0x5d00fe];var _0x4188a6=createListener('chatWebsite:'+_0x597240,_0x12ed82);ChatWebsiteEvents['on'](_0x597240,_0x4188a6);}}; \ 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 268f15e..201c758 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 _0xf417=['url','URL','replace','test','exports','escapeRegExp'];(function(_0x144345,_0x317f74){var _0x6fb2aa=function(_0x4c776e){while(--_0x4c776e){_0x144345['push'](_0x144345['shift']());}};_0x6fb2aa(++_0x317f74);}(_0xf417,0x8f));var _0x7f41=function(_0x274f5d,_0x6874dd){_0x274f5d=_0x274f5d-0x0;var _0x1d21ca=_0xf417[_0x274f5d];return _0x1d21ca;};var escapeRegExp=require('../../../utils/misc')[_0x7f41('0x0')];var URL=require(_0x7f41('0x1'))[_0x7f41('0x2')];function testWildcardValidity(_0x57aab7){var _0x85053=!![];try{new URL(_0x57aab7['replace']('*','localhost'));}catch(_0x2b7d4c){_0x85053=![];}return _0x85053&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x57aab7);}function testWebsiteWithWildcard(_0x51b0cb,_0x5ad014){var _0x5ecdb2;var _0x1775d8=escapeRegExp(_0x51b0cb['trim']()[_0x7f41('0x3')](/\/$/,''))[_0x7f41('0x3')]('\x5c*','([\x5cw]+)');try{new URL(_0x51b0cb[_0x7f41('0x3')]('\x5c*','localhost'));_0x5ecdb2=new RegExp(_0x1775d8)[_0x7f41('0x4')](_0x5ad014);}catch(_0x5f3a44){_0x5ecdb2=![];}return _0x5ecdb2;}module[_0x7f41('0x5')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x2da6=['URL','replace','localhost','trim','([\x5cw]+)','test','exports','../../../utils/misc','escapeRegExp','url'];(function(_0x453603,_0x26991d){var _0x3f28e3=function(_0x2a0784){while(--_0x2a0784){_0x453603['push'](_0x453603['shift']());}};_0x3f28e3(++_0x26991d);}(_0x2da6,0x1dd));var _0x62da=function(_0x5250a6,_0x435e5a){_0x5250a6=_0x5250a6-0x0;var _0x2fc3f4=_0x2da6[_0x5250a6];return _0x2fc3f4;};var escapeRegExp=require(_0x62da('0x0'))[_0x62da('0x1')];var URL=require(_0x62da('0x2'))[_0x62da('0x3')];function testWildcardValidity(_0xd62c5c){var _0x12b8ad=!![];try{new URL(_0xd62c5c[_0x62da('0x4')]('*',_0x62da('0x5')));}catch(_0x4c079d){_0x12b8ad=![];}return _0x12b8ad&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0xd62c5c);}function testWebsiteWithWildcard(_0xe28204,_0x3163df){var _0x3a59f8;var _0x30437f=escapeRegExp(_0xe28204[_0x62da('0x6')]()[_0x62da('0x4')](/\/$/,''))[_0x62da('0x4')]('\x5c*',_0x62da('0x7'));try{new URL(_0xe28204[_0x62da('0x4')]('\x5c*','localhost'));_0x3a59f8=new RegExp(_0x30437f)[_0x62da('0x8')](_0x3163df);}catch(_0x2a3937){_0x3a59f8=![];}return _0x3a59f8;}module[_0x62da('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 9d028a9..3ffb6d3 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 _0xc56f=['express','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','join','root','format','%s-%s','now','single','server/files/images/avatars/','originalname','file','addAvatar','addCustomerAvatar','addSystemAvatar','notify','attachments','offline-chat','replace','extname','/:id/offline','any','offline','addInteraction','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','multer','util','path','connect-timeout'];(function(_0x353847,_0x5c84de){var _0x40d8a6=function(_0x221958){while(--_0x221958){_0x353847['push'](_0x353847['shift']());}};_0x40d8a6(++_0x5c84de);}(_0xc56f,0x118));var _0xfc56=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xc56f[_0x2faddb];return _0x273c05;};'use strict';var multer=require(_0xfc56('0x0'));var util=require(_0xfc56('0x1'));var path=require(_0xfc56('0x2'));var timeout=require(_0xfc56('0x3'));var express=require(_0xfc56('0x4'));var router=express['Router']();var fs_extra=require(_0xfc56('0x5'));var auth=require(_0xfc56('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfc56('0x7'));var controller=require(_0xfc56('0x8'));router[_0xfc56('0x9')]('/',auth[_0xfc56('0xa')](),controller[_0xfc56('0xb')]);router[_0xfc56('0x9')](_0xfc56('0xc'),auth['isAuthenticated'](),controller[_0xfc56('0xd')]);router[_0xfc56('0x9')](_0xfc56('0xe'),auth[_0xfc56('0xa')](),controller[_0xfc56('0xf')]);router[_0xfc56('0x9')](_0xfc56('0x10'),auth[_0xfc56('0xa')](),controller[_0xfc56('0x11')]);router[_0xfc56('0x9')](_0xfc56('0x12'),auth['isAuthenticated'](),controller[_0xfc56('0x13')]);router['get'](_0xfc56('0x14'),controller[_0xfc56('0x15')]);router[_0xfc56('0x9')](_0xfc56('0x16'),controller[_0xfc56('0x17')]);router['get'](_0xfc56('0x18'),controller[_0xfc56('0x19')]);router[_0xfc56('0x9')](_0xfc56('0x1a'),controller['getSystemAvatar']);router[_0xfc56('0x9')](_0xfc56('0x1b'),auth['isAuthenticated'](),controller[_0xfc56('0x1c')]);router[_0xfc56('0x9')]('/:id/snippet',controller[_0xfc56('0x1d')]);router[_0xfc56('0x9')](_0xfc56('0x1e'),auth[_0xfc56('0xa')](),controller[_0xfc56('0x1f')]);router[_0xfc56('0x9')](_0xfc56('0x20'),auth[_0xfc56('0xa')](),controller[_0xfc56('0x21')]);router[_0xfc56('0x9')]('/:id/fields',controller[_0xfc56('0x22')]);router['get'](_0xfc56('0x23'),auth['isAuthenticated'](),controller[_0xfc56('0x24')]);router['get'](_0xfc56('0x25'),auth[_0xfc56('0xa')](),controller['getAgents']);router[_0xfc56('0x26')]('/',auth[_0xfc56('0xa')](),controller[_0xfc56('0x27')]);router[_0xfc56('0x26')](_0xfc56('0x10'),auth[_0xfc56('0xa')](),controller[_0xfc56('0x28')]);router['post']('/:id/canned_answers',auth[_0xfc56('0xa')](),controller[_0xfc56('0x29')]);var upload=multer({'storage':multer[_0xfc56('0x2a')]({'destination':function(_0x56ef64,_0x3e42ec,_0x564025){_0x564025(null,path[_0xfc56('0x2b')](config[_0xfc56('0x2c')],'server/files/images/logos/'));},'filename':function(_0x458d55,_0x4df009,_0x12e3a1){_0x12e3a1(null,util[_0xfc56('0x2d')](_0xfc56('0x2e'),Date[_0xfc56('0x2f')](),_0x4df009['originalname']));}})});router[_0xfc56('0x26')](_0xfc56('0x14'),upload[_0xfc56('0x30')]('file'),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xf22686,_0x1f18fd,_0x28346f){_0x28346f(null,path['join'](config[_0xfc56('0x2c')],_0xfc56('0x31')));},'filename':function(_0x55cbc1,_0x5095c1,_0x171b2c){_0x171b2c(null,util['format'](_0xfc56('0x2e'),Date[_0xfc56('0x2f')](),_0x5095c1[_0xfc56('0x32')]));}})});router['post']('/:id/avatar',upload[_0xfc56('0x30')](_0xfc56('0x33')),controller[_0xfc56('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4b9a9c,_0x30bac4,_0x14cad2){_0x14cad2(null,path[_0xfc56('0x2b')](config[_0xfc56('0x2c')],_0xfc56('0x31')));},'filename':function(_0x19535d,_0x481205,_0x4eb6d8){_0x4eb6d8(null,util[_0xfc56('0x2d')](_0xfc56('0x2e'),Date[_0xfc56('0x2f')](),_0x481205[_0xfc56('0x32')]));}})});router[_0xfc56('0x26')](_0xfc56('0x18'),upload[_0xfc56('0x30')](_0xfc56('0x33')),controller[_0xfc56('0x35')]);var upload=multer({'storage':multer[_0xfc56('0x2a')]({'destination':function(_0x17e395,_0x6c85e1,_0x5597fe){_0x5597fe(null,path[_0xfc56('0x2b')](config[_0xfc56('0x2c')],_0xfc56('0x31')));},'filename':function(_0x2b9785,_0x37699c,_0x273971){_0x273971(null,util[_0xfc56('0x2d')](_0xfc56('0x2e'),Date[_0xfc56('0x2f')](),_0x37699c[_0xfc56('0x32')]));}})});router[_0xfc56('0x26')](_0xfc56('0x1a'),upload['single']('file'),controller[_0xfc56('0x36')]);router[_0xfc56('0x26')]('/:id/notify',controller[_0xfc56('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0xfc56('0x2a')]({'destination':function(_0x1349f0,_0x2091d1,_0x9ba519){const _0x4e9bdd=path[_0xfc56('0x2b')](config[_0xfc56('0x2c')],'server/files',_0xfc56('0x38'),_0xfc56('0x39'));fs_extra['ensureDir'](_0x4e9bdd,function(){_0x9ba519(null,_0x4e9bdd);});},'filename':function(_0x164359,_0x33b060,_0x2933d2){const _0x4f9d9e=_0x33b060[_0xfc56('0x32')][_0xfc56('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5e8bb1=path[_0xfc56('0x3b')](_0x4f9d9e);const _0x75203a=Date[_0xfc56('0x2f')]()+'-'+_0x4f9d9e[_0xfc56('0x3a')](_0x5e8bb1,'')+_0x5e8bb1;_0x2933d2(null,_0x75203a);}})});router['post'](_0xfc56('0x3c'),offlineUploadMulter[_0xfc56('0x3d')](),controller[_0xfc56('0x3e')]);router[_0xfc56('0x26')](_0xfc56('0x1b'),auth['isAuthenticated'](),controller[_0xfc56('0x3f')]);router['post']('/:id/applications',auth[_0xfc56('0xa')](),controller['addApplications']);router[_0xfc56('0x26')](_0xfc56('0x20'),auth[_0xfc56('0xa')](),controller['addProactiveActions']);router['post'](_0xfc56('0x25'),auth[_0xfc56('0xa')](),controller[_0xfc56('0x40')]);router[_0xfc56('0x41')](_0xfc56('0xe'),auth[_0xfc56('0xa')](),controller[_0xfc56('0x42')]);router[_0xfc56('0x43')]('/:id',auth[_0xfc56('0xa')](),controller[_0xfc56('0x44')]);router[_0xfc56('0x43')]('/:id/dispositions',auth[_0xfc56('0xa')](),controller[_0xfc56('0x45')]);router[_0xfc56('0x43')](_0xfc56('0x12'),auth[_0xfc56('0xa')](),controller['removeAnswers']);router[_0xfc56('0x43')](_0xfc56('0x25'),auth['isAuthenticated'](),controller[_0xfc56('0x46')]);module['exports']=router; \ No newline at end of file +var _0xb6af=['root','format','%s-%s','now','/:id/logo','addLogo','diskStorage','server/files/images/avatars/','originalname','single','file','/:id/system_avatar','addSystemAvatar','server/files','attachments','replace','/:id/offline','any','offline','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/users','post','create','addDisposition','join'];(function(_0x443f60,_0x34a688){var _0x22fd0b=function(_0x45bed9){while(--_0x45bed9){_0x443f60['push'](_0x443f60['shift']());}};_0x22fd0b(++_0x34a688);}(_0xb6af,0x1d4));var _0xfb6a=function(_0x513545,_0x158f2e){_0x513545=_0x513545-0x0;var _0x18b7c5=_0xb6af[_0x513545];return _0x18b7c5;};'use strict';var multer=require(_0xfb6a('0x0'));var util=require('util');var path=require(_0xfb6a('0x1'));var timeout=require(_0xfb6a('0x2'));var express=require(_0xfb6a('0x3'));var router=express[_0xfb6a('0x4')]();var fs_extra=require(_0xfb6a('0x5'));var auth=require(_0xfb6a('0x6'));var interaction=require(_0xfb6a('0x7'));var config=require('../../config/environment');var controller=require(_0xfb6a('0x8'));router[_0xfb6a('0x9')]('/',auth[_0xfb6a('0xa')](),controller[_0xfb6a('0xb')]);router[_0xfb6a('0x9')]('/describe',auth[_0xfb6a('0xa')](),controller[_0xfb6a('0xc')]);router[_0xfb6a('0x9')](_0xfb6a('0xd'),auth[_0xfb6a('0xa')](),controller['show']);router['get'](_0xfb6a('0xe'),auth[_0xfb6a('0xa')](),controller[_0xfb6a('0xf')]);router[_0xfb6a('0x9')](_0xfb6a('0x10'),auth['isAuthenticated'](),controller[_0xfb6a('0x11')]);router[_0xfb6a('0x9')]('/:id/logo',controller[_0xfb6a('0x12')]);router[_0xfb6a('0x9')](_0xfb6a('0x13'),controller['getAvatar']);router[_0xfb6a('0x9')](_0xfb6a('0x14'),controller[_0xfb6a('0x15')]);router[_0xfb6a('0x9')]('/:id/system_avatar',controller[_0xfb6a('0x16')]);router['get'](_0xfb6a('0x17'),auth[_0xfb6a('0xa')](),controller[_0xfb6a('0x18')]);router['get'](_0xfb6a('0x19'),controller['getSnippet']);router[_0xfb6a('0x9')](_0xfb6a('0x1a'),auth[_0xfb6a('0xa')](),controller[_0xfb6a('0x1b')]);router['get'](_0xfb6a('0x1c'),auth[_0xfb6a('0xa')](),controller['getProactiveActions']);router[_0xfb6a('0x9')](_0xfb6a('0x1d'),controller[_0xfb6a('0x1e')]);router[_0xfb6a('0x9')]('/:id/offline_messages',auth[_0xfb6a('0xa')](),controller['getOfflineMessages']);router[_0xfb6a('0x9')](_0xfb6a('0x1f'),auth[_0xfb6a('0xa')](),controller['getAgents']);router[_0xfb6a('0x20')]('/',auth[_0xfb6a('0xa')](),controller[_0xfb6a('0x21')]);router[_0xfb6a('0x20')]('/:id/dispositions',auth[_0xfb6a('0xa')](),controller[_0xfb6a('0x22')]);router[_0xfb6a('0x20')]('/:id/canned_answers',auth[_0xfb6a('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4e4b54,_0x3ff44c,_0x27743b){_0x27743b(null,path[_0xfb6a('0x23')](config[_0xfb6a('0x24')],'server/files/images/logos/'));},'filename':function(_0x4be012,_0x377c67,_0x216a39){_0x216a39(null,util[_0xfb6a('0x25')](_0xfb6a('0x26'),Date[_0xfb6a('0x27')](),_0x377c67['originalname']));}})});router['post'](_0xfb6a('0x28'),upload['single']('file'),controller[_0xfb6a('0x29')]);var upload=multer({'storage':multer[_0xfb6a('0x2a')]({'destination':function(_0x42d31f,_0x5d509b,_0x155237){_0x155237(null,path['join'](config[_0xfb6a('0x24')],_0xfb6a('0x2b')));},'filename':function(_0x544e91,_0x3d0512,_0x357347){_0x357347(null,util[_0xfb6a('0x25')](_0xfb6a('0x26'),Date[_0xfb6a('0x27')](),_0x3d0512[_0xfb6a('0x2c')]));}})});router['post']('/:id/avatar',upload[_0xfb6a('0x2d')](_0xfb6a('0x2e')),controller['addAvatar']);var upload=multer({'storage':multer[_0xfb6a('0x2a')]({'destination':function(_0x3bd851,_0x28f557,_0x11bfd2){_0x11bfd2(null,path[_0xfb6a('0x23')](config[_0xfb6a('0x24')],_0xfb6a('0x2b')));},'filename':function(_0x52c21f,_0x1c950c,_0x37b7a0){_0x37b7a0(null,util[_0xfb6a('0x25')](_0xfb6a('0x26'),Date[_0xfb6a('0x27')](),_0x1c950c[_0xfb6a('0x2c')]));}})});router[_0xfb6a('0x20')](_0xfb6a('0x14'),upload[_0xfb6a('0x2d')](_0xfb6a('0x2e')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xfb6a('0x2a')]({'destination':function(_0x150058,_0x39a4de,_0x353a2a){_0x353a2a(null,path[_0xfb6a('0x23')](config[_0xfb6a('0x24')],_0xfb6a('0x2b')));},'filename':function(_0x481ceb,_0x180a7b,_0x27f0f3){_0x27f0f3(null,util[_0xfb6a('0x25')]('%s-%s',Date[_0xfb6a('0x27')](),_0x180a7b[_0xfb6a('0x2c')]));}})});router['post'](_0xfb6a('0x2f'),upload[_0xfb6a('0x2d')](_0xfb6a('0x2e')),controller[_0xfb6a('0x30')]);router[_0xfb6a('0x20')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xfb6a('0x2a')]({'destination':function(_0x4c10db,_0xd04a8d,_0x32ee91){const _0x1bcea9=path['join'](config[_0xfb6a('0x24')],_0xfb6a('0x31'),_0xfb6a('0x32'),'offline-chat');fs_extra['ensureDir'](_0x1bcea9,function(){_0x32ee91(null,_0x1bcea9);});},'filename':function(_0x3eccf8,_0x5c7622,_0x421c57){const _0x5004af=_0x5c7622['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1a4865=path['extname'](_0x5004af);const _0x445e0b=Date[_0xfb6a('0x27')]()+'-'+_0x5004af[_0xfb6a('0x33')](_0x1a4865,'')+_0x1a4865;_0x421c57(null,_0x445e0b);}})});router[_0xfb6a('0x20')](_0xfb6a('0x34'),offlineUploadMulter[_0xfb6a('0x35')](),controller[_0xfb6a('0x36')]);router[_0xfb6a('0x20')](_0xfb6a('0x17'),auth[_0xfb6a('0xa')](),controller['addInteraction']);router[_0xfb6a('0x20')](_0xfb6a('0x1a'),auth['isAuthenticated'](),controller['addApplications']);router[_0xfb6a('0x20')](_0xfb6a('0x1c'),auth[_0xfb6a('0xa')](),controller['addProactiveActions']);router[_0xfb6a('0x20')](_0xfb6a('0x1f'),auth[_0xfb6a('0xa')](),controller[_0xfb6a('0x37')]);router[_0xfb6a('0x38')]('/:id',auth[_0xfb6a('0xa')](),controller[_0xfb6a('0x39')]);router[_0xfb6a('0x3a')](_0xfb6a('0xd'),auth[_0xfb6a('0xa')](),controller['destroy']);router['delete'](_0xfb6a('0xe'),auth[_0xfb6a('0xa')](),controller[_0xfb6a('0x3b')]);router['delete'](_0xfb6a('0x10'),auth[_0xfb6a('0xa')](),controller[_0xfb6a('0x3c')]);router[_0xfb6a('0x3a')]('/:id/users',auth['isAuthenticated'](),controller[_0xfb6a('0x3d')]);module[_0xfb6a('0x3e')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 9df658e..e4d835f 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 _0x0310=['exports','beaver-logger/server','express','../components/auth/service','../config/environment','env','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated'];(function(_0x34dae3,_0x5d0e71){var _0x974467=function(_0x2cba49){while(--_0x2cba49){_0x34dae3['push'](_0x34dae3['shift']());}};_0x974467(++_0x5d0e71);}(_0x0310,0xe1));var _0x0031=function(_0xc0536c,_0x117641){_0xc0536c=_0xc0536c-0x0;var _0x41a5ca=_0x0310[_0xc0536c];return _0x41a5ca;};var beaverLogger=require(_0x0031('0x0'));var express=require(_0x0031('0x1'));var auth=require(_0x0031('0x2'));var config=require(_0x0031('0x3'));var router=express['Router']();var isProduction=config[_0x0031('0x4')]==='production'||![];function clientSideLogs(_0x134576,_0x3e009e,_0x37e1b2){var _0x5e998b=_0x134576[_0x0031('0x5')][_0x0031('0x6')](_0x0031('0x7'));if(!_0x5e998b){throw new Error(_0x0031('0x8'));}return beaverLogger[_0x0031('0x9')]({'uri':_0x0031('0xa'),'logger':_0x5e998b,'enableCors':!isProduction})(_0x134576,_0x3e009e,_0x37e1b2);}router[_0x0031('0xb')](auth[_0x0031('0xc')](),clientSideLogs);module[_0x0031('0xd')]=router; \ No newline at end of file +var _0x82b8=['env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs','use','isAuthenticated','beaver-logger/server','express','../components/auth/service','../config/environment','Router'];(function(_0x558098,_0x8d2b){var _0x3756e2=function(_0x297e4a){while(--_0x297e4a){_0x558098['push'](_0x558098['shift']());}};_0x3756e2(++_0x8d2b);}(_0x82b8,0x183));var _0x882b=function(_0xed6046,_0x13ef2e){_0xed6046=_0xed6046-0x0;var _0x54b3f6=_0x82b8[_0xed6046];return _0x54b3f6;};var beaverLogger=require(_0x882b('0x0'));var express=require(_0x882b('0x1'));var auth=require(_0x882b('0x2'));var config=require(_0x882b('0x3'));var router=express[_0x882b('0x4')]();var isProduction=config[_0x882b('0x5')]===_0x882b('0x6')||![];function clientSideLogs(_0x48598f,_0x2a03c6,_0x51a562){var _0x17ad41=_0x48598f[_0x882b('0x7')][_0x882b('0x8')](_0x882b('0x9'));if(!_0x17ad41){throw new Error(_0x882b('0xa'));}return beaverLogger['expressEndpoint']({'uri':_0x882b('0xb'),'logger':_0x17ad41,'enableCors':!isProduction})(_0x48598f,_0x2a03c6,_0x51a562);}router[_0x882b('0xc')](auth[_0x882b('0xd')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 3eb682e..84f21b6 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 _0xb77a=['Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','exports','STRING','ENUM','MicrosoftAzure','Outlook365'];(function(_0x617e1e,_0x30890e){var _0x44b8ae=function(_0x199df4){while(--_0x199df4){_0x617e1e['push'](_0x617e1e['shift']());}};_0x44b8ae(++_0x30890e);}(_0xb77a,0x103));var _0xab77=function(_0x50a651,_0x276aaf){_0x50a651=_0x50a651-0x0;var _0x429c51=_0xb77a[_0x50a651];return _0x429c51;};'use strict';var Sequelize=require('sequelize');module[_0xab77('0x0')]={'name':{'type':Sequelize[_0xab77('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xab77('0x2')]('AmazonAWS','Google',_0xab77('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xab77('0x4'),_0xab77('0x5'))},'data1':{'type':Sequelize['STRING'],'comment':_0xab77('0x6')},'data2':{'type':Sequelize[_0xab77('0x1')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0xab77('0x1')],'comment':_0xab77('0x7')},'data4':{'type':Sequelize['STRING'],'comment':_0xab77('0x8')},'data5':{'type':Sequelize['TEXT'],'comment':_0xab77('0x9')},'data6':{'type':Sequelize[_0xab77('0xa')],'comment':_0xab77('0xb')},'data7':{'type':Sequelize[_0xab77('0xa')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x2ee7=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x1831ca,_0xd8e5ab){var _0x104c9c=function(_0xe5576d){while(--_0xe5576d){_0x1831ca['push'](_0x1831ca['shift']());}};_0x104c9c(++_0xd8e5ab);}(_0x2ee7,0x146));var _0x72ee=function(_0x398f9a,_0x38c1d1){_0x398f9a=_0x398f9a-0x0;var _0x3a12da=_0x2ee7[_0x398f9a];return _0x3a12da;};'use strict';var Sequelize=require(_0x72ee('0x0'));module[_0x72ee('0x1')]={'name':{'type':Sequelize[_0x72ee('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x72ee('0x3')](_0x72ee('0x4'),'Google','MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x72ee('0x3')]('Outlook365',_0x72ee('0x5'))},'data1':{'type':Sequelize[_0x72ee('0x2')],'comment':_0x72ee('0x6')},'data2':{'type':Sequelize[_0x72ee('0x2')],'comment':_0x72ee('0x7')},'data3':{'type':Sequelize['STRING'],'comment':_0x72ee('0x8')},'data4':{'type':Sequelize[_0x72ee('0x2')],'comment':_0x72ee('0x9')},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x72ee('0xa')],'comment':_0x72ee('0xb')},'data7':{'type':Sequelize[_0x72ee('0xa')],'comment':_0x72ee('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index c3f6dc0..69605ce 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 _0x1b6c=['CloudProvider','include','findAll','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','update','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','del','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','then','destroy','error','stack','name','send','padEnd','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1b6c,0x8c));var _0xc1b6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1b6c[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var Redis=require(_0xc1b6('0x0'));var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require(_0xc1b6('0x1'));var logger=require('../../config/logger')(_0xc1b6('0x2'));var db=require(_0xc1b6('0x3'))['db'];var oauth=require(_0xc1b6('0x4'));config[_0xc1b6('0x5')]=_[_0xc1b6('0x6')](config[_0xc1b6('0x5')],{'host':_0xc1b6('0x7'),'port':0x18eb});var socket=require(_0xc1b6('0x8'))(new Redis(config['redis']));var redis=new Redis(config[_0xc1b6('0x5')]);function respondWithStatusCode(_0xaa53cc,_0x2b3897){_0x2b3897=_0x2b3897||0xcc;return function(_0x4afbd3){if(_0x4afbd3){return _0xaa53cc[_0xc1b6('0x9')](_0x2b3897);}return _0xaa53cc['status'](_0x2b3897)[_0xc1b6('0xa')]();};}function respondWithResult(_0x5744b2,_0xb6f7f7){_0xb6f7f7=_0xb6f7f7||0xc8;return function(_0x3740ad){if(_0x3740ad){return _0x5744b2[_0xc1b6('0xb')](_0xb6f7f7)[_0xc1b6('0xc')](_0x3740ad);}};}function respondWithFilteredResult(_0x2c9dc1,_0x4f0e2e){return function(_0x12b3bf){if(_0x12b3bf){var _0x561456=typeof _0x4f0e2e[_0xc1b6('0xd')]==='undefined'&&typeof _0x4f0e2e[_0xc1b6('0xe')]===_0xc1b6('0xf');var _0x491f29=_0x12b3bf[_0xc1b6('0x10')];var _0x99ff18=_0x561456?0x0:_0x4f0e2e[_0xc1b6('0xd')];var _0x53b937=_0x561456?_0x12b3bf[_0xc1b6('0x10')]:_0x4f0e2e['offset']+_0x4f0e2e['limit'];var _0x373327;if(_0x53b937>=_0x491f29){_0x53b937=_0x491f29;_0x373327=0xc8;}else{_0x373327=0xce;}_0x2c9dc1[_0xc1b6('0xb')](_0x373327);return _0x2c9dc1['set'](_0xc1b6('0x11'),_0x99ff18+'-'+_0x53b937+'/'+_0x491f29)[_0xc1b6('0xc')](_0x12b3bf);}return null;};}function saveUpdates(_0xc6b6a7){return function(_0x3254b2){if(_0x3254b2){return _0x3254b2['update'](_0xc6b6a7)[_0xc1b6('0x12')](function(_0x42878d){return _0x42878d;});}return null;};}function removeEntity(_0x376052){return function(_0x5002a0){if(_0x5002a0){return _0x5002a0[_0xc1b6('0x13')]()[_0xc1b6('0x12')](function(){_0x376052[_0xc1b6('0xb')](0xcc)[_0xc1b6('0xa')]();});}};}function handleEntityNotFound(_0xb91bec){return function(_0x4d7713){if(!_0x4d7713){_0xb91bec['sendStatus'](0x194);}return _0x4d7713;};}function handleError(_0x4c13bd,_0x562d9e){_0x562d9e=_0x562d9e||0x1f4;return function(_0x3bcddb){logger[_0xc1b6('0x14')](_0x3bcddb[_0xc1b6('0x15')]);if(_0x3bcddb[_0xc1b6('0x16')]){delete _0x3bcddb[_0xc1b6('0x16')];}_0x4c13bd[_0xc1b6('0xb')](_0x562d9e)[_0xc1b6('0x17')](_0x3bcddb);};}function maskClientSecret(_0x1277cd){return _[_0xc1b6('0x18')](_0x1277cd['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0xfbf336,_0x1729c2){var _0x564d3b={},_0x25a29b={},_0x256b67={'count':0x0,'rows':[]};var _0x4920b8=_[_0xc1b6('0x19')](db['CloudProvider'][_0xc1b6('0x1a')],function(_0x27c7e3){return{'name':_0x27c7e3[_0xc1b6('0x1b')],'type':_0x27c7e3[_0xc1b6('0x1c')][_0xc1b6('0x1d')]};});_0x25a29b[_0xc1b6('0x1e')]=_[_0xc1b6('0x19')](_0x4920b8,_0xc1b6('0x16'));_0x25a29b[_0xc1b6('0x1f')]=_['keys'](_0xfbf336['query']);_0x25a29b['filters']=_[_0xc1b6('0x20')](_0x25a29b[_0xc1b6('0x1e')],_0x25a29b[_0xc1b6('0x1f')]);_0x564d3b[_0xc1b6('0x21')]=_[_0xc1b6('0x20')](_0x25a29b[_0xc1b6('0x1e')],qs[_0xc1b6('0x22')](_0xfbf336[_0xc1b6('0x1f')][_0xc1b6('0x22')]));_0x564d3b[_0xc1b6('0x21')]=_0x564d3b['attributes'][_0xc1b6('0x23')]?_0x564d3b['attributes']:_0x25a29b[_0xc1b6('0x1e')];if(!_0xfbf336[_0xc1b6('0x1f')]['hasOwnProperty'](_0xc1b6('0x24'))){_0x564d3b['limit']=qs['limit'](_0xfbf336[_0xc1b6('0x1f')][_0xc1b6('0xe')]);_0x564d3b[_0xc1b6('0xd')]=qs[_0xc1b6('0xd')](_0xfbf336[_0xc1b6('0x1f')][_0xc1b6('0xd')]);}_0x564d3b[_0xc1b6('0x25')]=qs['sort'](_0xfbf336[_0xc1b6('0x1f')][_0xc1b6('0x26')]);_0x564d3b[_0xc1b6('0x27')]=qs[_0xc1b6('0x28')](_[_0xc1b6('0x29')](_0xfbf336[_0xc1b6('0x1f')],_0x25a29b[_0xc1b6('0x28')]),_0x4920b8);if(_0xfbf336[_0xc1b6('0x1f')][_0xc1b6('0x2a')]){_0x564d3b[_0xc1b6('0x27')]=_[_0xc1b6('0x2b')](_0x564d3b[_0xc1b6('0x27')],{'$or':_[_0xc1b6('0x19')](_0x4920b8,function(_0x1d3987){if(_0x1d3987['type']!==_0xc1b6('0x2c')){var _0x5d719b={};_0x5d719b[_0x1d3987['name']]={'$like':'%'+_0xfbf336[_0xc1b6('0x1f')]['filter']+'%'};return _0x5d719b;}})});}_0x564d3b=_['merge']({},_0x564d3b,_0xfbf336[_0xc1b6('0x2d')]);var _0x457463={'where':_0x564d3b[_0xc1b6('0x27')]};return db[_0xc1b6('0x2e')][_0xc1b6('0x10')](_0x457463)[_0xc1b6('0x12')](function(_0x432aa8){_0x256b67['count']=_0x432aa8;if(_0xfbf336[_0xc1b6('0x1f')]['includeAll']){_0x564d3b[_0xc1b6('0x2f')]=[{'all':!![]}];}return db[_0xc1b6('0x2e')][_0xc1b6('0x30')](_0x564d3b);})[_0xc1b6('0x12')](function(_0x94f45d){_0x256b67['rows']=_[_0xc1b6('0x19')](_0x94f45d,function(_0x3c6607){if(_0x3c6607[_0xc1b6('0x31')]===_0xc1b6('0x32')){var _0x957887=encryptor[_0xc1b6('0x33')](_0x3c6607[_0xc1b6('0x34')]);_0x3c6607[_0xc1b6('0x34')]=maskClientSecret(_0x957887);}return _0x3c6607;});return _0x256b67;})['then'](respondWithFilteredResult(_0x1729c2,_0x564d3b))[_0xc1b6('0x35')](handleError(_0x1729c2,null));};exports[_0xc1b6('0x36')]=function(_0x344de9,_0x4c1c8b){var _0x41a578={'raw':!![],'where':{'id':_0x344de9[_0xc1b6('0x37')]['id']}},_0x12a651={};_0x12a651[_0xc1b6('0x1e')]=_[_0xc1b6('0x38')](db[_0xc1b6('0x2e')][_0xc1b6('0x1a')]);_0x12a651[_0xc1b6('0x1f')]=_[_0xc1b6('0x38')](_0x344de9[_0xc1b6('0x1f')]);_0x12a651[_0xc1b6('0x28')]=_[_0xc1b6('0x20')](_0x12a651[_0xc1b6('0x1e')],_0x12a651['query']);_0x41a578[_0xc1b6('0x21')]=_['intersection'](_0x12a651[_0xc1b6('0x1e')],qs[_0xc1b6('0x22')](_0x344de9['query'][_0xc1b6('0x22')]));_0x41a578[_0xc1b6('0x21')]=_0x41a578[_0xc1b6('0x21')][_0xc1b6('0x23')]?_0x41a578[_0xc1b6('0x21')]:_0x12a651[_0xc1b6('0x1e')];if(_0x344de9[_0xc1b6('0x1f')]['includeAll']){_0x41a578['include']=[{'all':!![]}];}_0x41a578=_['merge']({},_0x41a578,_0x344de9[_0xc1b6('0x2d')]);return db[_0xc1b6('0x2e')][_0xc1b6('0x39')](_0x41a578)[_0xc1b6('0x12')](handleEntityNotFound(_0x4c1c8b,null))['then'](function(_0x5862fb){if(_0x5862fb[_0xc1b6('0x31')]==='MicrosoftAzure'){var _0xb8e41a=encryptor[_0xc1b6('0x33')](_0x5862fb[_0xc1b6('0x34')]);_0x5862fb['data3']=maskClientSecret(_0xb8e41a);}return _0x5862fb;})[_0xc1b6('0x12')](respondWithResult(_0x4c1c8b,null))['catch'](handleError(_0x4c1c8b,null));};exports[_0xc1b6('0x3a')]=function(_0x444ce1,_0x9c49e0){if(!_0x444ce1[_0xc1b6('0x3b')][_0xc1b6('0x16')])throw new Error(_0xc1b6('0x3c'));if(!_0x444ce1[_0xc1b6('0x3b')][_0xc1b6('0x31')])throw new Error(_0xc1b6('0x3d'));var _0xa3b62c=db[_0xc1b6('0x2e')]['rawAttributes'][_0xc1b6('0x31')][_0xc1b6('0x3e')];if(!_0xa3b62c['includes'](_0x444ce1[_0xc1b6('0x3b')][_0xc1b6('0x31')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0xa3b62c['join'](',\x20'));if(_0x444ce1['body'][_0xc1b6('0x31')]==='MicrosoftAzure'&&_0x444ce1['body'][_0xc1b6('0x34')]){_0x444ce1[_0xc1b6('0x3b')]['data3']=encryptor['encryptString'](_0x444ce1[_0xc1b6('0x3b')]['data3']);}return db[_0xc1b6('0x2e')][_0xc1b6('0x3a')](_0x444ce1[_0xc1b6('0x3b')],{})['then'](respondWithResult(_0x9c49e0,0xc9))[_0xc1b6('0x35')](handleError(_0x9c49e0,null));};exports[_0xc1b6('0x3f')]=function(_0xa5bf00,_0xe8a46f){if(_0xa5bf00[_0xc1b6('0x3b')]['id']){delete _0xa5bf00[_0xc1b6('0x3b')]['id'];}return db['CloudProvider'][_0xc1b6('0x39')]({'where':{'id':_0xa5bf00['params']['id']}})[_0xc1b6('0x12')](handleEntityNotFound(_0xe8a46f,null))[_0xc1b6('0x12')](function(_0x3ec733){if(_0x3ec733['service']==='MicrosoftAzure'&&_0xa5bf00['body'][_0xc1b6('0x34')]){_0xa5bf00[_0xc1b6('0x3b')][_0xc1b6('0x34')]=encryptor[_0xc1b6('0x40')](_0xa5bf00['body'][_0xc1b6('0x34')]);}return _0x3ec733;})[_0xc1b6('0x12')](saveUpdates(_0xa5bf00['body'],null))[_0xc1b6('0x12')](respondWithResult(_0xe8a46f,null))[_0xc1b6('0x35')](handleError(_0xe8a46f,null));};exports[_0xc1b6('0x13')]=function(_0x2b04bf,_0x3a9c49){return db[_0xc1b6('0x2e')]['find']({'where':{'id':_0x2b04bf[_0xc1b6('0x37')]['id']}})[_0xc1b6('0x12')](handleEntityNotFound(_0x3a9c49,null))[_0xc1b6('0x12')](removeEntity(_0x3a9c49,null))[_0xc1b6('0x35')](handleError(_0x3a9c49,null));};exports[_0xc1b6('0x41')]=function(_0x33973a,_0x463009){return db[_0xc1b6('0x2e')][_0xc1b6('0x42')]({'where':{'id':_0x33973a[_0xc1b6('0x37')]['id']},'raw':!![]})['then'](function(_0xaee003){if(!_0xaee003)return _0x463009[_0xc1b6('0x9')](0x194);return{'url':oauth[_0xc1b6('0x43')](_0xaee003,_0x33973a['user']['id'])};})['then'](respondWithResult(_0x463009,null))[_0xc1b6('0x35')](handleError(_0x463009,null));};exports[_0xc1b6('0x44')]=function(_0x1fbc09,_0x3f228a){var _0x6996e0=_0x1fbc09[_0xc1b6('0x3b')];var _0x175e8b;var _0x1b542a;if(_0x6996e0[_0xc1b6('0x14')])throw _0x6996e0;redis[_0xc1b6('0x45')](_0x6996e0[_0xc1b6('0x46')])['then'](function(_0x392034){if(!_0x392034)throw new Error(_0xc1b6('0x47'));_0x175e8b=JSON['parse'](_0x392034);var _0x2a52c9=Buffer[_0xc1b6('0x48')](_0x6996e0[_0xc1b6('0x46')],_0xc1b6('0x49'))[_0xc1b6('0x4a')](_0xc1b6('0x4b'));_0x1b542a=JSON['parse'](_0x2a52c9);if(!oauth[_0xc1b6('0x4c')](_0x6996e0[_0xc1b6('0x4d')],_0x175e8b[_0xc1b6('0x4e')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xc1b6('0x4f')](_0x6996e0[_0xc1b6('0x46')]);return oauth[_0xc1b6('0x50')](_0x6996e0[_0xc1b6('0x51')],_0x175e8b);})['then'](function(_0x4cd22b){_0x175e8b['data5']=_0x4cd22b[_0xc1b6('0x52')];_0x175e8b[_0xc1b6('0x53')]=_0x4cd22b[_0xc1b6('0x54')];return db[_0xc1b6('0x2e')][_0xc1b6('0x3f')]({'data5':_0x175e8b[_0xc1b6('0x55')],'data6':_0x175e8b['data6']},{'where':{'id':_0x175e8b['id']}});})['then'](function(){oauth[_0xc1b6('0x56')](_0x175e8b);socket[_0xc1b6('0x57')](_0xc1b6('0x58'),{'id':_0x1b542a['id']});return;})[_0xc1b6('0x12')](respondWithStatusCode(_0x3f228a,null))[_0xc1b6('0x35')](function(_0x487e0e){if(_0x1b542a){socket[_0xc1b6('0x57')](_0xc1b6('0x59'),{'id':_0x1b542a['id']});}if(!_0x175e8b){logger[_0xc1b6('0x14')]('Invalid\x20authentication\x20state\x20parameter',_0x487e0e);return _0x3f228a['status'](0x1f4)[_0xc1b6('0x17')](_0x487e0e[_0xc1b6('0x5a')]);}logger[_0xc1b6('0x14')](_0xc1b6('0x5b'),_0x175e8b['id'],JSON[_0xc1b6('0x5c')](_0x487e0e));});}; \ No newline at end of file +var _0x635f=['get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','access_token','refresh_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','sendStatus','name','send','slice','map','CloudProvider','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','includeAll','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','options','find','create','Name\x20parameter\x20not\x20specified','body','values','join','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error'];(function(_0x4bdf64,_0x3022b2){var _0x9a1a19=function(_0x4e551b){while(--_0x4e551b){_0x4bdf64['push'](_0x4bdf64['shift']());}};_0x9a1a19(++_0x3022b2);}(_0x635f,0x1d3));var _0xf635=function(_0x5bbd98,_0x1b89c0){_0x5bbd98=_0x5bbd98-0x0;var _0x44346f=_0x635f[_0x5bbd98];return _0x44346f;};'use strict';var _=require(_0xf635('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0xf635('0x1'));var config=require(_0xf635('0x2'));var logger=require(_0xf635('0x3'))(_0xf635('0x4'));var db=require(_0xf635('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config['redis']=_['defaults'](config[_0xf635('0x6')],{'host':_0xf635('0x7'),'port':0x18eb});var socket=require(_0xf635('0x8'))(new Redis(config[_0xf635('0x6')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x1aff26,_0x323724){_0x323724=_0x323724||0xcc;return function(_0x3f5651){if(_0x3f5651){return _0x1aff26['sendStatus'](_0x323724);}return _0x1aff26[_0xf635('0x9')](_0x323724)[_0xf635('0xa')]();};}function respondWithResult(_0x588564,_0x584da3){_0x584da3=_0x584da3||0xc8;return function(_0x20ba38){if(_0x20ba38){return _0x588564[_0xf635('0x9')](_0x584da3)[_0xf635('0xb')](_0x20ba38);}};}function respondWithFilteredResult(_0x3a4f4e,_0x4e9d83){return function(_0x1a5b46){if(_0x1a5b46){var _0x3fee8b=typeof _0x4e9d83[_0xf635('0xc')]==='undefined'&&typeof _0x4e9d83['limit']===_0xf635('0xd');var _0xd2932=_0x1a5b46[_0xf635('0xe')];var _0x1a7655=_0x3fee8b?0x0:_0x4e9d83['offset'];var _0x1bd958=_0x3fee8b?_0x1a5b46[_0xf635('0xe')]:_0x4e9d83['offset']+_0x4e9d83[_0xf635('0xf')];var _0x4e25f5;if(_0x1bd958>=_0xd2932){_0x1bd958=_0xd2932;_0x4e25f5=0xc8;}else{_0x4e25f5=0xce;}_0x3a4f4e[_0xf635('0x9')](_0x4e25f5);return _0x3a4f4e[_0xf635('0x10')](_0xf635('0x11'),_0x1a7655+'-'+_0x1bd958+'/'+_0xd2932)[_0xf635('0xb')](_0x1a5b46);}return null;};}function saveUpdates(_0x14d607){return function(_0x11e145){if(_0x11e145){return _0x11e145[_0xf635('0x12')](_0x14d607)[_0xf635('0x13')](function(_0x2bc417){return _0x2bc417;});}return null;};}function removeEntity(_0x3f39d6){return function(_0x995cbd){if(_0x995cbd){return _0x995cbd[_0xf635('0x14')]()[_0xf635('0x13')](function(){_0x3f39d6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a0d4a){return function(_0x49f7f8){if(!_0x49f7f8){_0x2a0d4a[_0xf635('0x15')](0x194);}return _0x49f7f8;};}function handleError(_0x5ade3a,_0x2ddca0){_0x2ddca0=_0x2ddca0||0x1f4;return function(_0x268ce0){logger['error'](_0x268ce0['stack']);if(_0x268ce0[_0xf635('0x16')]){delete _0x268ce0[_0xf635('0x16')];}_0x5ade3a['status'](_0x2ddca0)[_0xf635('0x17')](_0x268ce0);};}function maskClientSecret(_0x51b9d6){return _['padEnd'](_0x51b9d6[_0xf635('0x18')](0x0,0x3),0x14,'*');}exports['index']=function(_0x75d8fc,_0x1c5a5d){var _0x1aca91={},_0x1ddb93={},_0x73ec10={'count':0x0,'rows':[]};var _0x1a4a38=_[_0xf635('0x19')](db[_0xf635('0x1a')][_0xf635('0x1b')],function(_0x1eae81){return{'name':_0x1eae81['fieldName'],'type':_0x1eae81[_0xf635('0x1c')][_0xf635('0x1d')]};});_0x1ddb93[_0xf635('0x1e')]=_[_0xf635('0x19')](_0x1a4a38,'name');_0x1ddb93[_0xf635('0x1f')]=_[_0xf635('0x20')](_0x75d8fc[_0xf635('0x1f')]);_0x1ddb93[_0xf635('0x21')]=_[_0xf635('0x22')](_0x1ddb93['model'],_0x1ddb93[_0xf635('0x1f')]);_0x1aca91[_0xf635('0x23')]=_[_0xf635('0x22')](_0x1ddb93[_0xf635('0x1e')],qs[_0xf635('0x24')](_0x75d8fc['query']['fields']));_0x1aca91['attributes']=_0x1aca91[_0xf635('0x23')][_0xf635('0x25')]?_0x1aca91[_0xf635('0x23')]:_0x1ddb93[_0xf635('0x1e')];if(!_0x75d8fc[_0xf635('0x1f')][_0xf635('0x26')](_0xf635('0x27'))){_0x1aca91['limit']=qs[_0xf635('0xf')](_0x75d8fc[_0xf635('0x1f')][_0xf635('0xf')]);_0x1aca91[_0xf635('0xc')]=qs[_0xf635('0xc')](_0x75d8fc[_0xf635('0x1f')][_0xf635('0xc')]);}_0x1aca91['order']=qs['sort'](_0x75d8fc[_0xf635('0x1f')][_0xf635('0x28')]);_0x1aca91['where']=qs[_0xf635('0x21')](_['pick'](_0x75d8fc[_0xf635('0x1f')],_0x1ddb93[_0xf635('0x21')]),_0x1a4a38);if(_0x75d8fc['query']['filter']){_0x1aca91[_0xf635('0x29')]=_[_0xf635('0x2a')](_0x1aca91[_0xf635('0x29')],{'$or':_[_0xf635('0x19')](_0x1a4a38,function(_0x26ffad){if(_0x26ffad[_0xf635('0x1c')]!==_0xf635('0x2b')){var _0x3112c9={};_0x3112c9[_0x26ffad['name']]={'$like':'%'+_0x75d8fc['query']['filter']+'%'};return _0x3112c9;}})});}_0x1aca91=_['merge']({},_0x1aca91,_0x75d8fc['options']);var _0x51c74b={'where':_0x1aca91[_0xf635('0x29')]};return db[_0xf635('0x1a')]['count'](_0x51c74b)[_0xf635('0x13')](function(_0x811cb8){_0x73ec10[_0xf635('0xe')]=_0x811cb8;if(_0x75d8fc[_0xf635('0x1f')][_0xf635('0x2c')]){_0x1aca91['include']=[{'all':!![]}];}return db[_0xf635('0x1a')][_0xf635('0x2d')](_0x1aca91);})[_0xf635('0x13')](function(_0x51550e){_0x73ec10[_0xf635('0x2e')]=_[_0xf635('0x19')](_0x51550e,function(_0x58fd6f){if(_0x58fd6f[_0xf635('0x2f')]===_0xf635('0x30')){var _0x4cd27d=encryptor[_0xf635('0x31')](_0x58fd6f[_0xf635('0x32')]);_0x58fd6f['data3']=maskClientSecret(_0x4cd27d);}return _0x58fd6f;});return _0x73ec10;})[_0xf635('0x13')](respondWithFilteredResult(_0x1c5a5d,_0x1aca91))[_0xf635('0x33')](handleError(_0x1c5a5d,null));};exports[_0xf635('0x34')]=function(_0xadf949,_0x109d34){var _0x13a1e6={'raw':!![],'where':{'id':_0xadf949[_0xf635('0x35')]['id']}},_0x54ab46={};_0x54ab46[_0xf635('0x1e')]=_['keys'](db[_0xf635('0x1a')][_0xf635('0x1b')]);_0x54ab46[_0xf635('0x1f')]=_[_0xf635('0x20')](_0xadf949[_0xf635('0x1f')]);_0x54ab46[_0xf635('0x21')]=_['intersection'](_0x54ab46[_0xf635('0x1e')],_0x54ab46['query']);_0x13a1e6[_0xf635('0x23')]=_['intersection'](_0x54ab46[_0xf635('0x1e')],qs[_0xf635('0x24')](_0xadf949[_0xf635('0x1f')]['fields']));_0x13a1e6[_0xf635('0x23')]=_0x13a1e6[_0xf635('0x23')][_0xf635('0x25')]?_0x13a1e6[_0xf635('0x23')]:_0x54ab46['model'];if(_0xadf949[_0xf635('0x1f')][_0xf635('0x2c')]){_0x13a1e6['include']=[{'all':!![]}];}_0x13a1e6=_[_0xf635('0x2a')]({},_0x13a1e6,_0xadf949[_0xf635('0x36')]);return db[_0xf635('0x1a')][_0xf635('0x37')](_0x13a1e6)[_0xf635('0x13')](handleEntityNotFound(_0x109d34,null))[_0xf635('0x13')](function(_0xfd989a){if(_0xfd989a[_0xf635('0x2f')]==='MicrosoftAzure'){var _0x31ed0d=encryptor[_0xf635('0x31')](_0xfd989a[_0xf635('0x32')]);_0xfd989a[_0xf635('0x32')]=maskClientSecret(_0x31ed0d);}return _0xfd989a;})['then'](respondWithResult(_0x109d34,null))[_0xf635('0x33')](handleError(_0x109d34,null));};exports[_0xf635('0x38')]=function(_0x44f447,_0x526247){if(!_0x44f447['body'][_0xf635('0x16')])throw new Error(_0xf635('0x39'));if(!_0x44f447[_0xf635('0x3a')][_0xf635('0x2f')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x348048=db[_0xf635('0x1a')][_0xf635('0x1b')][_0xf635('0x2f')][_0xf635('0x3b')];if(!_0x348048['includes'](_0x44f447['body'][_0xf635('0x2f')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x348048[_0xf635('0x3c')](',\x20'));if(_0x44f447[_0xf635('0x3a')][_0xf635('0x2f')]===_0xf635('0x30')&&_0x44f447[_0xf635('0x3a')]['data3']){_0x44f447['body'][_0xf635('0x32')]=encryptor['encryptString'](_0x44f447[_0xf635('0x3a')][_0xf635('0x32')]);}return db[_0xf635('0x1a')][_0xf635('0x38')](_0x44f447[_0xf635('0x3a')],{})[_0xf635('0x13')](respondWithResult(_0x526247,0xc9))[_0xf635('0x33')](handleError(_0x526247,null));};exports[_0xf635('0x12')]=function(_0xebd9be,_0x208030){if(_0xebd9be['body']['id']){delete _0xebd9be[_0xf635('0x3a')]['id'];}return db['CloudProvider'][_0xf635('0x37')]({'where':{'id':_0xebd9be[_0xf635('0x35')]['id']}})[_0xf635('0x13')](handleEntityNotFound(_0x208030,null))[_0xf635('0x13')](function(_0x2fca83){if(_0x2fca83[_0xf635('0x2f')]===_0xf635('0x30')&&_0xebd9be[_0xf635('0x3a')][_0xf635('0x32')]){_0xebd9be[_0xf635('0x3a')][_0xf635('0x32')]=encryptor[_0xf635('0x3d')](_0xebd9be[_0xf635('0x3a')][_0xf635('0x32')]);}return _0x2fca83;})[_0xf635('0x13')](saveUpdates(_0xebd9be[_0xf635('0x3a')],null))[_0xf635('0x13')](respondWithResult(_0x208030,null))[_0xf635('0x33')](handleError(_0x208030,null));};exports['destroy']=function(_0x336c92,_0x3acceb){return db['CloudProvider'][_0xf635('0x37')]({'where':{'id':_0x336c92[_0xf635('0x35')]['id']}})['then'](handleEntityNotFound(_0x3acceb,null))['then'](removeEntity(_0x3acceb,null))['catch'](handleError(_0x3acceb,null));};exports[_0xf635('0x3e')]=function(_0x41ccd5,_0x4b0888){return db[_0xf635('0x1a')]['findOne']({'where':{'id':_0x41ccd5[_0xf635('0x35')]['id']},'raw':!![]})[_0xf635('0x13')](function(_0x8eb455){if(!_0x8eb455)return _0x4b0888[_0xf635('0x15')](0x194);return{'url':oauth[_0xf635('0x3f')](_0x8eb455,_0x41ccd5[_0xf635('0x40')]['id'])};})[_0xf635('0x13')](respondWithResult(_0x4b0888,null))[_0xf635('0x33')](handleError(_0x4b0888,null));};exports[_0xf635('0x41')]=function(_0x3db8d4,_0x4a4e26){var _0x1ea046=_0x3db8d4[_0xf635('0x3a')];var _0x1954a9;var _0x4864f2;if(_0x1ea046[_0xf635('0x42')])throw _0x1ea046;redis[_0xf635('0x43')](_0x1ea046[_0xf635('0x44')])['then'](function(_0x31559b){if(!_0x31559b)throw new Error(_0xf635('0x45'));_0x1954a9=JSON[_0xf635('0x46')](_0x31559b);var _0x239c1c=Buffer[_0xf635('0x47')](_0x1ea046['state'],_0xf635('0x48'))['toString'](_0xf635('0x49'));_0x4864f2=JSON[_0xf635('0x46')](_0x239c1c);if(!oauth['isValidIdToken'](_0x1ea046[_0xf635('0x4a')],_0x1954a9[_0xf635('0x4b')]))throw new Error(_0xf635('0x4c'));redis[_0xf635('0x4d')](_0x1ea046[_0xf635('0x44')]);return oauth['getOauth2MicrosoftAccessToken'](_0x1ea046[_0xf635('0x4e')],_0x1954a9);})[_0xf635('0x13')](function(_0x2c2424){_0x1954a9[_0xf635('0x4f')]=_0x2c2424[_0xf635('0x50')];_0x1954a9['data6']=_0x2c2424[_0xf635('0x51')];return db[_0xf635('0x1a')][_0xf635('0x12')]({'data5':_0x1954a9[_0xf635('0x4f')],'data6':_0x1954a9[_0xf635('0x52')]},{'where':{'id':_0x1954a9['id']}});})['then'](function(){oauth[_0xf635('0x53')](_0x1954a9);socket[_0xf635('0x54')](_0xf635('0x55'),{'id':_0x4864f2['id']});return;})[_0xf635('0x13')](respondWithStatusCode(_0x4a4e26,null))[_0xf635('0x33')](function(_0x34bb1e){if(_0x4864f2){socket[_0xf635('0x54')](_0xf635('0x56'),{'id':_0x4864f2['id']});}if(!_0x1954a9){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x34bb1e);return _0x4a4e26['status'](0x1f4)[_0xf635('0x17')](_0x34bb1e[_0xf635('0x57')]);}logger[_0xf635('0x42')](_0xf635('0x58'),_0x1954a9['id'],JSON['stringify'](_0x34bb1e));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index e7de3f6..a376b20 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 _0x5eae=['./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x48f8be,_0x2476d2){var _0x38f673=function(_0x47fc38){while(--_0x47fc38){_0x48f8be['push'](_0x48f8be['shift']());}};_0x38f673(++_0x2476d2);}(_0x5eae,0x1bf));var _0xe5ea=function(_0x4620ed,_0x2a1de2){_0x4620ed=_0x4620ed-0x0;var _0x1734ea=_0x5eae[_0x4620ed];return _0x1734ea;};'use strict';var _=require(_0xe5ea('0x0'));var util=require(_0xe5ea('0x1'));var logger=require(_0xe5ea('0x2'))(_0xe5ea('0x3'));var moment=require(_0xe5ea('0x4'));var BPromise=require(_0xe5ea('0x5'));var rp=require(_0xe5ea('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe5ea('0x7'));var config=require('../../config/environment');var attributes=require(_0xe5ea('0x8'));module[_0xe5ea('0x9')]=function(_0x4191b9,_0x5d5789){return _0x4191b9[_0xe5ea('0xa')](_0xe5ea('0xb'),attributes,{'tableName':_0xe5ea('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6115=['./cloudProvider.attributes','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3b75e7,_0x4a4dea){var _0x193814=function(_0x4cf876){while(--_0x4cf876){_0x3b75e7['push'](_0x3b75e7['shift']());}};_0x193814(++_0x4a4dea);}(_0x6115,0x13b));var _0x5611=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6115[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5611('0x0'));var util=require(_0x5611('0x1'));var logger=require(_0x5611('0x2'))(_0x5611('0x3'));var moment=require(_0x5611('0x4'));var BPromise=require('bluebird');var rp=require(_0x5611('0x5'));var fs=require('fs');var path=require(_0x5611('0x6'));var rimraf=require(_0x5611('0x7'));var config=require(_0x5611('0x8'));var attributes=require(_0x5611('0x9'));module['exports']=function(_0x54fd53,_0x85b567){return _0x54fd53['define'](_0x5611('0xa'),attributes,{'tableName':_0x5611('0xb'),'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 7ff9561..363a0b9 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 _0xcee5=['ioredis','request-promise','util','../../components/encryptor','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','/token','map','type','Dynamics365','push','/.default','Outlook365','data7','replace','{TENANT_ID}','code','id_token','from','stringify','toString','randomBytes','client_id','data1','redirect_uri','data4','response_mode','scope','state','nonce','key','value','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','findOne','refresh_token','data6','decryptString','POST','data2','data5','access_token','CloudProvider','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','findAll','catch','inspect','exports','lodash','crypto','jsonwebtoken','moment'];(function(_0x4d5143,_0x320103){var _0x5248c9=function(_0x201a29){while(--_0x201a29){_0x4d5143['push'](_0x4d5143['shift']());}};_0x5248c9(++_0x320103);}(_0xcee5,0x182));var _0x5cee=function(_0x209e1c,_0x135210){_0x209e1c=_0x209e1c-0x0;var _0x3f05bd=_0xcee5[_0x209e1c];return _0x3f05bd;};'use strict';var _=require(_0x5cee('0x0'));var crypto=require(_0x5cee('0x1'));var jwt=require(_0x5cee('0x2'));var moment=require(_0x5cee('0x3'));var Redis=require(_0x5cee('0x4'));var rp=require(_0x5cee('0x5'));var util=require(_0x5cee('0x6'));var encryptor=require(_0x5cee('0x7'));var config=require('../../config/environment');var logger=require('../../config/logger')('api');var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x5cee('0x8'))['db'];config[_0x5cee('0x9')]=_[_0x5cee('0xa')](config[_0x5cee('0x9')],{'host':_0x5cee('0xb'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x5cee('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x5cee('0xd'),_0x5cee('0xe'),_0x5cee('0xf'),'offline_access',_0x5cee('0x10'),'https://outlook.office.com/POP.AccessAsUser.All',_0x5cee('0x11')],'Dynamics365':[_0x5cee('0xd'),_0x5cee('0x12')]};var MICROSOFT_AUTH_ENDPOINT=_0x5cee('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x5cee('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x47957a){var _0x32d3f0=_[_0x5cee('0x15')](AZURE_AUTH_SCOPES[_0x47957a[_0x5cee('0x16')]]);if(_0x47957a[_0x5cee('0x16')]===_0x5cee('0x17'))_0x32d3f0[_0x5cee('0x18')](_0x47957a['data7']+_0x5cee('0x19'));return _0x32d3f0['join']('\x20');}function getAccessTokenScope(_0x1334f1){if(_0x1334f1[_0x5cee('0x16')]===_0x5cee('0x1a'))return _0x5cee('0x10');if(_0x1334f1[_0x5cee('0x16')]===_0x5cee('0x17'))return _0x1334f1[_0x5cee('0x1b')]+_0x5cee('0x19');}function generateMicrosoftAuthorizationUrl(_0xb67016,_0x3574bc){var _0x4b29fb=MICROSOFT_AUTH_URL[_0x5cee('0x1c')](_0x5cee('0x1d'),_0xb67016['data2']);var _0x213dd0=[_0x5cee('0x1e'),_0x5cee('0x1f')];var _0x5e33aa=Buffer[_0x5cee('0x20')](JSON[_0x5cee('0x21')]({'id':_0x3574bc}))[_0x5cee('0x22')]('base64');var _0x53ca87=crypto[_0x5cee('0x23')](0x10)[_0x5cee('0x22')]('hex');var _0x163aec=getAuthorizationScopes(_0xb67016);var _0x93461a=[{'key':_0x5cee('0x24'),'value':_0xb67016[_0x5cee('0x25')]},{'key':'response_type','value':encodeURIComponent(_0x213dd0['join']('\x20'))},{'key':_0x5cee('0x26'),'value':_0xb67016[_0x5cee('0x27')]},{'key':_0x5cee('0x28'),'value':'form_post'},{'key':_0x5cee('0x29'),'value':encodeURIComponent(_0x163aec)},{'key':_0x5cee('0x2a'),'value':_0x5e33aa},{'key':_0x5cee('0x2b'),'value':_0x53ca87},{'key':'prompt','value':'login'}];var _0x2513bd=_0x4b29fb+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x5cee('0x15')](_0x93461a,function(_0x558df3){return _0x558df3[_0x5cee('0x2c')]+'='+_0x558df3[_0x5cee('0x2d')];})['join']('&');_0xb67016[_0x5cee('0x2e')]={'issuer':_0x4b29fb[_0x5cee('0x1c')](_0x5cee('0x2f'),''),'audience':_0xb67016['data1'],'state':_0x5e33aa,'nonce':_0x53ca87};redis[_0x5cee('0x30')](_0x5e33aa,JSON[_0x5cee('0x21')](_0xb67016));return _0x2513bd;}function isValidIdToken(_0x2b10b1,_0x1593e4){try{var _0x31f33e=jwt[_0x5cee('0x31')](_0x2b10b1,{'complete':!![]});var _0x2f38e0=_0x31f33e[_0x5cee('0x32')];if(_0x2f38e0[_0x5cee('0x33')]!==_0x1593e4[_0x5cee('0x34')])return![];if(_0x2f38e0[_0x5cee('0x35')]!==_0x1593e4[_0x5cee('0x36')])return![];if(_0x2f38e0[_0x5cee('0x2b')]!==_0x1593e4[_0x5cee('0x2b')])return![];if(moment()[_0x5cee('0x37')](moment[_0x5cee('0x38')](_0x2f38e0[_0x5cee('0x39')])))return![];return!![];}catch(_0x2b0b75){throw _0x2b0b75;}}function refreshOauth2MicrosoftAccessToken(_0x56e907){return Promise[_0x5cee('0x3a')]()[_0x5cee('0x3b')](function(){if(_0x56e907[_0x5cee('0x3c')])return _0x56e907;return db['CloudProvider'][_0x5cee('0x3d')]({'where':{'id':_0x56e907['id']},'raw':!![]});})[_0x5cee('0x3b')](function(_0x3ccb7d){var _0x3bdd4f={'grant_type':_0x5cee('0x3e'),'refresh_token':_0x3ccb7d[_0x5cee('0x3f')],'scope':getAccessTokenScope(_0x3ccb7d),'redirect_uri':_0x3ccb7d[_0x5cee('0x27')],'client_id':_0x3ccb7d[_0x5cee('0x25')],'client_secret':encryptor[_0x5cee('0x40')](_0x3ccb7d[_0x5cee('0x3c')])};var _0x1020e8={'method':_0x5cee('0x41'),'uri':MICROSOFT_AUTH_URL[_0x5cee('0x1c')](_0x5cee('0x1d'),_0x3ccb7d[_0x5cee('0x42')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3bdd4f,'json':!![]};return rp(_0x1020e8);})[_0x5cee('0x3b')](function(_0x41c0f6){_0x56e907[_0x5cee('0x43')]=_0x41c0f6[_0x5cee('0x44')];_0x56e907[_0x5cee('0x3f')]=_0x41c0f6['refresh_token'];return db[_0x5cee('0x45')][_0x5cee('0x46')]({'data5':_0x56e907[_0x5cee('0x43')],'data6':_0x56e907[_0x5cee('0x3f')]},{'where':{'id':_0x56e907['id']}});})[_0x5cee('0x3b')](function(){return _0x56e907;})['catch'](function(_0x4fbde3){logger[_0x5cee('0x47')](_0x5cee('0x48'),_0x56e907['id'],_0x4fbde3);});}function getOauth2MicrosoftAccessToken(_0x222063,_0x3b2566){var _0x357550={'grant_type':'authorization_code','code':_0x222063,'scope':getAccessTokenScope(_0x3b2566),'redirect_uri':_0x3b2566[_0x5cee('0x27')],'client_id':_0x3b2566[_0x5cee('0x25')],'client_secret':encryptor['decryptString'](_0x3b2566[_0x5cee('0x3c')])};var _0x4c07a6={'method':_0x5cee('0x41'),'uri':MICROSOFT_AUTH_URL[_0x5cee('0x1c')]('{TENANT_ID}',_0x3b2566[_0x5cee('0x42')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x357550,'json':!![]};return rp(_0x4c07a6);}function startRefreshInterval(_0x694cc){var _0x53570b=schedule[_0x5cee('0x49')];if(_0x53570b[_0x694cc['id']])clearInterval(_0x53570b[_0x694cc['id']]);_0x53570b[_0x694cc['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x694cc['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x5cee('0x49')]=_0x53570b;}function startAllRefreshIntervals(){return db[_0x5cee('0x45')][_0x5cee('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x635c30){var _0x1978a4=_0x635c30['map'](function(_0x1fbb69){return refreshOauth2MicrosoftAccessToken(_0x1fbb69)[_0x5cee('0x3b')](function(_0x16548a){startRefreshInterval(_0x16548a);});});return Promise['all'](_0x1978a4);})[_0x5cee('0x4b')](function(_0x45be48){var _0x3973bb=_0x45be48?util[_0x5cee('0x4c')](_0x45be48,{'showHidden':![],'depth':null}):'';logger[_0x5cee('0x47')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x3973bb);});}module[_0x5cee('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x2676=['issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','data6','decryptString','data2','access_token','refresh_token','update','data5','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','findAll','all','catch','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','ioredis','request-promise','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','/.default','join','Outlook365','data7','replace','{TENANT_ID}','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','response_type','redirect_uri','data4','response_mode','form_post','scope','nonce','prompt','oauth2Claims','oauth2/','data1','set','iss'];(function(_0x430459,_0x58519c){var _0x3a2439=function(_0x27a0b3){while(--_0x27a0b3){_0x430459['push'](_0x430459['shift']());}};_0x3a2439(++_0x58519c);}(_0x2676,0x109));var _0x6267=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2676[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x6267('0x0'));var crypto=require(_0x6267('0x1'));var jwt=require('jsonwebtoken');var moment=require('moment');var Redis=require(_0x6267('0x2'));var rp=require(_0x6267('0x3'));var util=require('util');var encryptor=require(_0x6267('0x4'));var config=require(_0x6267('0x5'));var logger=require('../../config/logger')(_0x6267('0x6'));var schedule=require(_0x6267('0x7'));var db=require(_0x6267('0x8'))['db'];config[_0x6267('0x9')]=_[_0x6267('0xa')](config[_0x6267('0x9')],{'host':_0x6267('0xb'),'port':0x18eb});var redis=new Redis(config[_0x6267('0x9')]);var MICROSOFT_AUTH_URL=_0x6267('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x6267('0xd'),'profile',_0x6267('0xe'),_0x6267('0xf'),_0x6267('0x10'),'https://outlook.office.com/POP.AccessAsUser.All',_0x6267('0x11')],'Dynamics365':['openid',_0x6267('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x6267('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0x6267('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x43e42b){var _0x6f501e=_[_0x6267('0x14')](AZURE_AUTH_SCOPES[_0x43e42b['type']]);if(_0x43e42b[_0x6267('0x15')]===_0x6267('0x16'))_0x6f501e[_0x6267('0x17')](_0x43e42b['data7']+_0x6267('0x18'));return _0x6f501e[_0x6267('0x19')]('\x20');}function getAccessTokenScope(_0x3ee369){if(_0x3ee369[_0x6267('0x15')]===_0x6267('0x1a'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x3ee369[_0x6267('0x15')]===_0x6267('0x16'))return _0x3ee369[_0x6267('0x1b')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x3caf62,_0x4b44ec){var _0x3903fb=MICROSOFT_AUTH_URL[_0x6267('0x1c')](_0x6267('0x1d'),_0x3caf62['data2']);var _0x5781dc=['code',_0x6267('0x1e')];var _0x456a0a=Buffer[_0x6267('0x1f')](JSON[_0x6267('0x20')]({'id':_0x4b44ec}))[_0x6267('0x21')](_0x6267('0x22'));var _0x133acd=crypto[_0x6267('0x23')](0x10)['toString'](_0x6267('0x24'));var _0x1a4db3=getAuthorizationScopes(_0x3caf62);var _0x21ec67=[{'key':_0x6267('0x25'),'value':_0x3caf62['data1']},{'key':_0x6267('0x26'),'value':encodeURIComponent(_0x5781dc[_0x6267('0x19')]('\x20'))},{'key':_0x6267('0x27'),'value':_0x3caf62[_0x6267('0x28')]},{'key':_0x6267('0x29'),'value':_0x6267('0x2a')},{'key':_0x6267('0x2b'),'value':encodeURIComponent(_0x1a4db3)},{'key':'state','value':_0x456a0a},{'key':_0x6267('0x2c'),'value':_0x133acd},{'key':_0x6267('0x2d'),'value':'login'}];var _0x438755=_0x3903fb+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x6267('0x14')](_0x21ec67,function(_0x375920){return _0x375920['key']+'='+_0x375920['value'];})[_0x6267('0x19')]('&');_0x3caf62[_0x6267('0x2e')]={'issuer':_0x3903fb['replace'](_0x6267('0x2f'),''),'audience':_0x3caf62[_0x6267('0x30')],'state':_0x456a0a,'nonce':_0x133acd};redis[_0x6267('0x31')](_0x456a0a,JSON[_0x6267('0x20')](_0x3caf62));return _0x438755;}function isValidIdToken(_0x13ff40,_0x1e8640){try{var _0x55b082=jwt['decode'](_0x13ff40,{'complete':!![]});var _0x3ca7c4=_0x55b082['payload'];if(_0x3ca7c4[_0x6267('0x32')]!==_0x1e8640[_0x6267('0x33')])return![];if(_0x3ca7c4[_0x6267('0x34')]!==_0x1e8640[_0x6267('0x35')])return![];if(_0x3ca7c4[_0x6267('0x2c')]!==_0x1e8640[_0x6267('0x2c')])return![];if(moment()[_0x6267('0x36')](moment[_0x6267('0x37')](_0x3ca7c4[_0x6267('0x38')])))return![];return!![];}catch(_0x10214b){throw _0x10214b;}}function refreshOauth2MicrosoftAccessToken(_0x221a96){return Promise[_0x6267('0x39')]()[_0x6267('0x3a')](function(){if(_0x221a96[_0x6267('0x3b')])return _0x221a96;return db[_0x6267('0x3c')][_0x6267('0x3d')]({'where':{'id':_0x221a96['id']},'raw':!![]});})['then'](function(_0x173116){var _0x296237={'grant_type':'refresh_token','refresh_token':_0x173116[_0x6267('0x3e')],'scope':getAccessTokenScope(_0x173116),'redirect_uri':_0x173116['data4'],'client_id':_0x173116[_0x6267('0x30')],'client_secret':encryptor[_0x6267('0x3f')](_0x173116[_0x6267('0x3b')])};var _0x5b55df={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x6267('0x1d'),_0x173116[_0x6267('0x40')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x296237,'json':!![]};return rp(_0x5b55df);})[_0x6267('0x3a')](function(_0x2ac17c){_0x221a96['data5']=_0x2ac17c[_0x6267('0x41')];_0x221a96['data6']=_0x2ac17c[_0x6267('0x42')];return db[_0x6267('0x3c')][_0x6267('0x43')]({'data5':_0x221a96[_0x6267('0x44')],'data6':_0x221a96[_0x6267('0x3e')]},{'where':{'id':_0x221a96['id']}});})[_0x6267('0x3a')](function(){return _0x221a96;})['catch'](function(_0x22921b){logger['error'](_0x6267('0x45'),_0x221a96['id'],_0x22921b);});}function getOauth2MicrosoftAccessToken(_0x4f1b88,_0x15b55b){var _0x4f3668={'grant_type':_0x6267('0x46'),'code':_0x4f1b88,'scope':getAccessTokenScope(_0x15b55b),'redirect_uri':_0x15b55b[_0x6267('0x28')],'client_id':_0x15b55b[_0x6267('0x30')],'client_secret':encryptor['decryptString'](_0x15b55b[_0x6267('0x3b')])};var _0x15a704={'method':_0x6267('0x47'),'uri':MICROSOFT_AUTH_URL[_0x6267('0x1c')](_0x6267('0x1d'),_0x15b55b[_0x6267('0x40')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4f3668,'json':!![]};return rp(_0x15a704);}function startRefreshInterval(_0x4808b5){var _0x221e5e=schedule[_0x6267('0x48')];if(_0x221e5e[_0x4808b5['id']])clearInterval(_0x221e5e[_0x4808b5['id']]);_0x221e5e[_0x4808b5['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x6267('0x49')](this,{'id':_0x4808b5['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x6267('0x48')]=_0x221e5e;}function startAllRefreshIntervals(){return db[_0x6267('0x3c')][_0x6267('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x6267('0x3a')](function(_0x37d238){var _0x81e251=_0x37d238[_0x6267('0x14')](function(_0x551e69){return refreshOauth2MicrosoftAccessToken(_0x551e69)[_0x6267('0x3a')](function(_0x12705e){startRefreshInterval(_0x12705e);});});return Promise[_0x6267('0x4b')](_0x81e251);})[_0x6267('0x4c')](function(_0x58eb8){var _0x40e706=_0x58eb8?util[_0x6267('0x4d')](_0x58eb8,{'showHidden':![],'depth':null}):'';logger['error'](_0x6267('0x4e'),_0x40e706);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index b17428c..924e9d1 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 _0xaf60=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','error','code','message','info','CloudProvider,\x20%s,\x20%s','lodash','util','moment'];(function(_0x2565e0,_0x45bba1){var _0x5b7c07=function(_0x3d5923){while(--_0x3d5923){_0x2565e0['push'](_0x2565e0['shift']());}};_0x5b7c07(++_0x45bba1);}(_0xaf60,0x82));var _0x0af6=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xaf60[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x0af6('0x0'));var util=require(_0x0af6('0x1'));var moment=require(_0x0af6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0af6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0af6('0x4'))(_0x0af6('0x5'));var config=require(_0x0af6('0x6'));var jayson=require(_0x0af6('0x7'));var client=jayson[_0x0af6('0x8')][_0x0af6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eb218,_0x52c997,_0x376979){return new BPromise(function(_0x28d620,_0x525bcc){return client[_0x0af6('0xa')](_0x2eb218,_0x376979)[_0x0af6('0xb')](function(_0xe9d01a){logger['info']('CloudProvider,\x20%s,\x20%s',_0x52c997,'request\x20sent');logger[_0x0af6('0xc')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x52c997,_0x0af6('0xd'),JSON['stringify'](_0xe9d01a));if(_0xe9d01a['error']){if(_0xe9d01a[_0x0af6('0xe')][_0x0af6('0xf')]===0x1f4){logger[_0x0af6('0xe')]('CloudProvider,\x20%s,\x20%s',_0x52c997,_0xe9d01a[_0x0af6('0xe')][_0x0af6('0x10')]);return _0x525bcc(_0xe9d01a[_0x0af6('0xe')]['message']);}logger[_0x0af6('0xe')]('CloudProvider,\x20%s,\x20%s',_0x52c997,_0xe9d01a[_0x0af6('0xe')]['message']);return _0x28d620(_0xe9d01a[_0x0af6('0xe')][_0x0af6('0x10')]);}else{logger[_0x0af6('0x11')](_0x0af6('0x12'),_0x52c997,'request\x20sent');_0x28d620(_0xe9d01a['result']['message']);}})['catch'](function(_0x4d5936){logger[_0x0af6('0xe')](_0x0af6('0x12'),_0x52c997,_0x4d5936);_0x525bcc(_0x4d5936);});});} \ No newline at end of file +var _0xda81=['then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request'];(function(_0x2f4d7f,_0x62f4b7){var _0x147ba1=function(_0x14ef36){while(--_0x14ef36){_0x2f4d7f['push'](_0x2f4d7f['shift']());}};_0x147ba1(++_0x62f4b7);}(_0xda81,0x1c3));var _0x1da8=function(_0x366c77,_0x5ba3ca){_0x366c77=_0x366c77-0x0;var _0x649e5=_0xda81[_0x366c77];return _0x649e5;};'use strict';var _=require(_0x1da8('0x0'));var util=require(_0x1da8('0x1'));var moment=require(_0x1da8('0x2'));var BPromise=require('bluebird');var rs=require(_0x1da8('0x3'));var fs=require('fs');var Redis=require(_0x1da8('0x4'));var db=require(_0x1da8('0x5'))['db'];var utils=require(_0x1da8('0x6'));var logger=require('../../config/logger')(_0x1da8('0x7'));var config=require(_0x1da8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1da8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x891482,_0x2c2bb4,_0xea1eb1){return new BPromise(function(_0x1a3278,_0x11dc1e){return client[_0x1da8('0xa')](_0x891482,_0xea1eb1)[_0x1da8('0xb')](function(_0x17a7fc){logger[_0x1da8('0xc')]('CloudProvider,\x20%s,\x20%s',_0x2c2bb4,_0x1da8('0xd'));logger[_0x1da8('0xe')](_0x1da8('0xf'),_0x2c2bb4,_0x1da8('0xd'),JSON[_0x1da8('0x10')](_0x17a7fc));if(_0x17a7fc['error']){if(_0x17a7fc[_0x1da8('0x11')]['code']===0x1f4){logger[_0x1da8('0x11')](_0x1da8('0x12'),_0x2c2bb4,_0x17a7fc[_0x1da8('0x11')][_0x1da8('0x13')]);return _0x11dc1e(_0x17a7fc[_0x1da8('0x11')]['message']);}logger[_0x1da8('0x11')]('CloudProvider,\x20%s,\x20%s',_0x2c2bb4,_0x17a7fc[_0x1da8('0x11')][_0x1da8('0x13')]);return _0x1a3278(_0x17a7fc[_0x1da8('0x11')][_0x1da8('0x13')]);}else{logger[_0x1da8('0xc')](_0x1da8('0x12'),_0x2c2bb4,'request\x20sent');_0x1a3278(_0x17a7fc[_0x1da8('0x14')][_0x1da8('0x13')]);}})[_0x1da8('0x15')](function(_0x197b09){logger[_0x1da8('0x11')](_0x1da8('0x12'),_0x2c2bb4,_0x197b09);_0x11dc1e(_0x197b09);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 8fa8f5c..801aada 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 _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x28d28c,_0x9e6c9e){var _0x16717a=function(_0x4dadf9){while(--_0x4dadf9){_0x28d28c['push'](_0x28d28c['shift']());}};_0x16717a(++_0x9e6c9e);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'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')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x1261,0x144));var _0x1126=function(_0x3a7455,_0x46b004){_0x3a7455=_0x3a7455-0x0;var _0x216c72=_0x1261[_0x3a7455];return _0x216c72;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 76585ac..73007b5 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 _0xd3bd=['STRING','name'];(function(_0x5741c6,_0x46ffd1){var _0xa7c024=function(_0x513639){while(--_0x513639){_0x5741c6['push'](_0x5741c6['shift']());}};_0xa7c024(++_0x46ffd1);}(_0xd3bd,0xa9));var _0xdd3b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd3bd[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xdd3b('0x0'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xdd3b('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xdd3b('0x1')]},'phone':{'type':Sequelize[_0xdd3b('0x1')]},'fax':{'type':Sequelize[_0xdd3b('0x1')]},'type':{'type':Sequelize[_0xdd3b('0x1')]},'street':{'type':Sequelize[_0xdd3b('0x1')]},'postalCode':{'type':Sequelize[_0xdd3b('0x1')]},'city':{'type':Sequelize[_0xdd3b('0x1')]},'country':{'type':Sequelize[_0xdd3b('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xdd3b('0x1')]},'sStreet':{'type':Sequelize[_0xdd3b('0x1')]},'sPostalCode':{'type':Sequelize[_0xdd3b('0x1')]},'sCity':{'type':Sequelize[_0xdd3b('0x1')]},'sCountry':{'type':Sequelize[_0xdd3b('0x1')]},'description':{'type':Sequelize[_0xdd3b('0x1')]}}; \ No newline at end of file +var _0x8781=['sequelize','exports','name','STRING'];(function(_0x20d99d,_0x304c85){var _0x3870bc=function(_0x1b0b4f){while(--_0x1b0b4f){_0x20d99d['push'](_0x20d99d['shift']());}};_0x3870bc(++_0x304c85);}(_0x8781,0x118));var _0x1878=function(_0x1ad38b,_0xed3117){_0x1ad38b=_0x1ad38b-0x0;var _0x1d28f9=_0x8781[_0x1ad38b];return _0x1d28f9;};'use strict';var Sequelize=require(_0x1878('0x0'));module[_0x1878('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1878('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1878('0x3')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x1878('0x3')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x1878('0x3')]},'type':{'type':Sequelize[_0x1878('0x3')]},'street':{'type':Sequelize[_0x1878('0x3')]},'postalCode':{'type':Sequelize[_0x1878('0x3')]},'city':{'type':Sequelize[_0x1878('0x3')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1878('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1878('0x3')]},'sStreet':{'type':Sequelize[_0x1878('0x3')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x1878('0x3')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1878('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 3b6df5e..76f1987 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 _0x6367=['query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','map','includeAll','include','catch','show','params','rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContact','addContacts','ids','omit','getContacts','findOne','length','options','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','get','Companies','sendStatus','error','stack','name','send','index','CmCompany','describe','model','keys'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x6367,0x1c4));var _0x7636=function(_0x2b6600,_0x24c497){_0x2b6600=_0x2b6600-0x0;var _0x912ee2=_0x6367[_0x2b6600];return _0x912ee2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7636('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7636('0x1'));var rp=require(_0x7636('0x2'));var moment=require(_0x7636('0x3'));var BPromise=require(_0x7636('0x4'));var Mustache=require(_0x7636('0x5'));var util=require('util');var path=require('path');var sox=require(_0x7636('0x6'));var csv=require(_0x7636('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7636('0x8'));var _=require('lodash');var squel=require(_0x7636('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7636('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7636('0xb'));var Papa=require(_0x7636('0xc'));var Redis=require(_0x7636('0xd'));var authService=require(_0x7636('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7636('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7636('0x10'));var utils=require(_0x7636('0x11'));var config=require(_0x7636('0x12'));var licenseUtil=require(_0x7636('0x13'));var db=require(_0x7636('0x14'))['db'];function respondWithStatusCode(_0x4b6d8f,_0x25155c){_0x25155c=_0x25155c||0xcc;return function(_0xeddcb){if(_0xeddcb){return _0x4b6d8f['sendStatus'](_0x25155c);}return _0x4b6d8f[_0x7636('0x15')](_0x25155c)[_0x7636('0x16')]();};}function respondWithResult(_0x191a5a,_0x217255){_0x217255=_0x217255||0xc8;return function(_0x4d9d79){if(_0x4d9d79){return _0x191a5a[_0x7636('0x15')](_0x217255)['json'](_0x4d9d79);}};}function respondWithFilteredResult(_0x4156f0,_0x23e6b7){return function(_0x57181d){if(_0x57181d){var _0x145c30=typeof _0x23e6b7['offset']==='undefined'&&typeof _0x23e6b7['limit']===_0x7636('0x17');var _0xbad4f7=_0x57181d[_0x7636('0x18')];var _0x14089f=_0x145c30?0x0:_0x23e6b7['offset'];var _0x113ee3=_0x145c30?_0x57181d[_0x7636('0x18')]:_0x23e6b7['offset']+_0x23e6b7[_0x7636('0x19')];var _0x2d113f;if(_0x113ee3>=_0xbad4f7){_0x113ee3=_0xbad4f7;_0x2d113f=0xc8;}else{_0x2d113f=0xce;}_0x4156f0[_0x7636('0x15')](_0x2d113f);return _0x4156f0[_0x7636('0x1a')]('Content-Range',_0x14089f+'-'+_0x113ee3+'/'+_0xbad4f7)[_0x7636('0x1b')](_0x57181d);}return null;};}function patchUpdates(_0x36b795){return function(_0x57c407){try{jsonpatch[_0x7636('0x1c')](_0x57c407,_0x36b795,!![]);}catch(_0x1d51c1){return BPromise[_0x7636('0x1d')](_0x1d51c1);}return _0x57c407[_0x7636('0x1e')]();};}function saveUpdates(_0x1fdb84,_0x12cb1f){return function(_0x20dc2c){if(_0x20dc2c){return _0x20dc2c[_0x7636('0x1f')](_0x1fdb84)[_0x7636('0x20')](function(_0x426ee6){return _0x426ee6;});}return null;};}function removeEntity(_0x6b4efe,_0x18a5d6){return function(_0x41a746){if(_0x41a746){return _0x41a746[_0x7636('0x21')]()[_0x7636('0x20')](function(){var _0x4b914b=_0x41a746[_0x7636('0x22')]({'plain':!![]});var _0x889964=_0x7636('0x23');return db['UserProfileResource'][_0x7636('0x21')]({'where':{'type':_0x889964,'resourceId':_0x4b914b['id']}})['then'](function(){return _0x41a746;});})['then'](function(){_0x6b4efe[_0x7636('0x15')](0xcc)[_0x7636('0x16')]();});}};}function handleEntityNotFound(_0x42a7f4,_0x2a612d){return function(_0x85f0f5){if(!_0x85f0f5){_0x42a7f4[_0x7636('0x24')](0x194);}return _0x85f0f5;};}function handleError(_0x36eaab,_0x941b8a){_0x941b8a=_0x941b8a||0x1f4;return function(_0x114734){logger[_0x7636('0x25')](_0x114734[_0x7636('0x26')]);if(_0x114734[_0x7636('0x27')]){delete _0x114734[_0x7636('0x27')];}_0x36eaab[_0x7636('0x15')](_0x941b8a)[_0x7636('0x28')](_0x114734);};}exports[_0x7636('0x29')]=function(_0x2a5814,_0x43b223){var _0xfec09d={},_0x9fd638={},_0x37a6c7={'count':0x0,'rows':[]};return db[_0x7636('0x2a')][_0x7636('0x2b')]()[_0x7636('0x20')](function(_0xb73727){_0x9fd638[_0x7636('0x2c')]=_[_0x7636('0x2d')](_0xb73727);_0x9fd638[_0x7636('0x2e')]=_[_0x7636('0x2d')](_0x2a5814['query']);_0x9fd638[_0x7636('0x2f')]=_[_0x7636('0x30')](_0x9fd638[_0x7636('0x2c')],_0x9fd638[_0x7636('0x2e')]);_0xfec09d['attributes']=_[_0x7636('0x30')](_0x9fd638[_0x7636('0x2c')],qs[_0x7636('0x31')](_0x2a5814[_0x7636('0x2e')][_0x7636('0x31')]));_0xfec09d[_0x7636('0x32')]=_0xfec09d[_0x7636('0x32')]['length']?_0xfec09d['attributes']:_0x9fd638[_0x7636('0x2c')];if(!_0x2a5814[_0x7636('0x2e')][_0x7636('0x33')](_0x7636('0x34'))){_0xfec09d[_0x7636('0x19')]=qs[_0x7636('0x19')](_0x2a5814[_0x7636('0x2e')]['limit']);_0xfec09d[_0x7636('0x35')]=qs[_0x7636('0x35')](_0x2a5814[_0x7636('0x2e')][_0x7636('0x35')]);}_0xfec09d[_0x7636('0x36')]=qs[_0x7636('0x37')](_0x2a5814[_0x7636('0x2e')][_0x7636('0x37')]);_0xfec09d[_0x7636('0x38')]=qs['filters'](_[_0x7636('0x39')](_0x2a5814[_0x7636('0x2e')],_0x9fd638[_0x7636('0x2f')]),_0xb73727);if(_0x2a5814[_0x7636('0x2e')][_0x7636('0x3a')]){_0xfec09d[_0x7636('0x38')]=_[_0x7636('0x3b')](_0xfec09d[_0x7636('0x38')],{'$or':_[_0x7636('0x3c')](_0xfec09d[_0x7636('0x32')],function(_0x2306e0){var _0x17e8b6={};_0x17e8b6[_0x2306e0]={'$like':'%'+_0x2a5814[_0x7636('0x2e')][_0x7636('0x3a')]+'%'};return _0x17e8b6;})});}_0xfec09d=_['merge']({},_0xfec09d,_0x2a5814['options']);var _0x1f5eac={'where':_0xfec09d[_0x7636('0x38')]};return db['CmCompany'][_0x7636('0x18')](_0x1f5eac)[_0x7636('0x20')](function(_0x39922c){_0x37a6c7[_0x7636('0x18')]=_0x39922c;if(_0x2a5814['query'][_0x7636('0x3d')]){_0xfec09d[_0x7636('0x3e')]=[{'all':!![]}];}return db[_0x7636('0x2a')]['findAll'](_0xfec09d);})['then'](function(_0x24fea7){_0x37a6c7['rows']=_0x24fea7;return _0x37a6c7;})[_0x7636('0x20')](respondWithFilteredResult(_0x43b223,_0xfec09d))['catch'](handleError(_0x43b223,null));})[_0x7636('0x3f')](handleError(_0x43b223,null));};exports[_0x7636('0x40')]=function(_0x256a6e,_0x461467){var _0x5d9ed3={'raw':![],'where':{'id':_0x256a6e[_0x7636('0x41')]['id']}},_0x31b8b5={};_0x31b8b5[_0x7636('0x2c')]=_['keys'](db['CmCompany'][_0x7636('0x42')]);_0x31b8b5[_0x7636('0x2e')]=_[_0x7636('0x2d')](_0x256a6e[_0x7636('0x2e')]);_0x31b8b5['filters']=_['intersection'](_0x31b8b5[_0x7636('0x2c')],_0x31b8b5[_0x7636('0x2e')]);_0x5d9ed3[_0x7636('0x32')]=_[_0x7636('0x30')](_0x31b8b5[_0x7636('0x2c')],qs[_0x7636('0x31')](_0x256a6e[_0x7636('0x2e')][_0x7636('0x31')]));_0x5d9ed3['attributes']=_0x5d9ed3[_0x7636('0x32')]['length']?_0x5d9ed3[_0x7636('0x32')]:_0x31b8b5[_0x7636('0x2c')];if(_0x256a6e[_0x7636('0x2e')][_0x7636('0x3d')]){_0x5d9ed3[_0x7636('0x3e')]=[{'all':!![]}];}_0x5d9ed3=_['merge']({},_0x5d9ed3,_0x256a6e['options']);return db[_0x7636('0x2a')][_0x7636('0x43')](_0x5d9ed3)[_0x7636('0x20')](handleEntityNotFound(_0x461467,null))['then'](respondWithResult(_0x461467,null))[_0x7636('0x3f')](handleError(_0x461467,null));};exports['create']=function(_0x4a7507,_0x4f8158){return db['CmCompany'][_0x7636('0x44')](_0x4a7507['body'],{})[_0x7636('0x20')](function(_0x493c92){var _0x4c0805=_0x4a7507['user'][_0x7636('0x22')]({'plain':!![]});if(!_0x4c0805)throw new Error(_0x7636('0x45'));if(_0x4c0805[_0x7636('0x46')]===_0x7636('0x47')){var _0x49014d=_0x493c92[_0x7636('0x22')]({'plain':!![]});var _0x1952f3=_0x7636('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x1952f3,'userProfileId':_0x4c0805[_0x7636('0x48')]},'raw':!![]})[_0x7636('0x20')](function(_0x313c93){if(_0x313c93&&_0x313c93['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x49014d[_0x7636('0x27')],'resourceId':_0x49014d['id'],'type':_0x313c93[_0x7636('0x27')],'sectionId':_0x313c93['id']},{})[_0x7636('0x20')](function(){return _0x493c92;});}else{return _0x493c92;}})['catch'](function(_0x494a47){logger[_0x7636('0x25')](_0x7636('0x49'),_0x494a47);throw _0x494a47;});}return _0x493c92;})[_0x7636('0x20')](respondWithResult(_0x4f8158,0xc9))[_0x7636('0x3f')](handleError(_0x4f8158,null));};exports[_0x7636('0x1f')]=function(_0x222760,_0x6b3b51){if(_0x222760['body']['id']){delete _0x222760[_0x7636('0x4a')]['id'];}return db[_0x7636('0x2a')][_0x7636('0x43')]({'where':{'id':_0x222760[_0x7636('0x41')]['id']}})[_0x7636('0x20')](handleEntityNotFound(_0x6b3b51,null))['then'](saveUpdates(_0x222760[_0x7636('0x4a')],null))[_0x7636('0x20')](respondWithResult(_0x6b3b51,null))[_0x7636('0x3f')](handleError(_0x6b3b51,null));};exports[_0x7636('0x21')]=function(_0x29ae39,_0x52ca0e){return db[_0x7636('0x2a')]['find']({'where':{'id':_0x29ae39[_0x7636('0x41')]['id']}})['then'](handleEntityNotFound(_0x52ca0e,null))[_0x7636('0x20')](removeEntity(_0x52ca0e,null))['catch'](handleError(_0x52ca0e,null));};exports[_0x7636('0x2b')]=function(_0x8b9124,_0x23788a){return db[_0x7636('0x2a')][_0x7636('0x2b')]()[_0x7636('0x20')](respondWithResult(_0x23788a,null))[_0x7636('0x3f')](handleError(_0x23788a,null));};exports['addContacts']=function(_0x419c8e,_0x492d3e,_0x38e4a4){return db[_0x7636('0x4b')][_0x7636('0x43')]({'where':{'id':_0x419c8e['params']['id']}})[_0x7636('0x20')](handleEntityNotFound(_0x492d3e,null))[_0x7636('0x20')](function(_0x33848d){if(_0x33848d){return _0x33848d[_0x7636('0x4c')](_0x419c8e[_0x7636('0x4a')][_0x7636('0x4d')],_[_0x7636('0x4e')](_0x419c8e[_0x7636('0x4a')],[_0x7636('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x492d3e,null))[_0x7636('0x3f')](handleError(_0x492d3e,null));};exports[_0x7636('0x4f')]=function(_0x31e585,_0x4d50cf,_0x364ed9){var _0x1d4de9={};var _0x1d4eb3={};var _0x29f2a9;var _0x15e097;return db[_0x7636('0x2a')][_0x7636('0x50')]({'where':{'id':_0x31e585[_0x7636('0x41')]['id']}})[_0x7636('0x20')](handleEntityNotFound(_0x4d50cf,null))['then'](function(_0x4da182){if(_0x4da182){_0x29f2a9=_0x4da182;_0x1d4eb3[_0x7636('0x2c')]=_[_0x7636('0x2d')](db[_0x7636('0x4b')][_0x7636('0x42')]);_0x1d4eb3[_0x7636('0x2e')]=_['keys'](_0x31e585[_0x7636('0x2e')]);_0x1d4eb3['filters']=_[_0x7636('0x30')](_0x1d4eb3[_0x7636('0x2c')],_0x1d4eb3['query']);_0x1d4de9[_0x7636('0x32')]=_[_0x7636('0x30')](_0x1d4eb3[_0x7636('0x2c')],qs['fields'](_0x31e585['query'][_0x7636('0x31')]));_0x1d4de9['attributes']=_0x1d4de9[_0x7636('0x32')][_0x7636('0x51')]?_0x1d4de9[_0x7636('0x32')]:_0x1d4eb3[_0x7636('0x2c')];_0x1d4de9[_0x7636('0x36')]=qs['sort'](_0x31e585['query'][_0x7636('0x37')]);_0x1d4de9[_0x7636('0x38')]=qs['filters'](_['pick'](_0x31e585['query'],_0x1d4eb3['filters']));if(_0x31e585[_0x7636('0x2e')]['filter']){_0x1d4de9[_0x7636('0x38')]=_['merge'](_0x1d4de9[_0x7636('0x38')],{'$or':_[_0x7636('0x3c')](_0x1d4de9[_0x7636('0x32')],function(_0x1ca8cd){var _0x501808={};_0x501808[_0x1ca8cd]={'$like':'%'+_0x31e585[_0x7636('0x2e')][_0x7636('0x3a')]+'%'};return _0x501808;})});}_0x1d4de9=_[_0x7636('0x3b')]({},_0x1d4de9,_0x31e585[_0x7636('0x52')]);return _0x29f2a9['getContacts'](_0x1d4de9);}})[_0x7636('0x20')](function(_0x46fdcb){if(_0x46fdcb){_0x15e097=_0x46fdcb[_0x7636('0x51')];if(!_0x31e585['query']['hasOwnProperty'](_0x7636('0x34'))){_0x1d4de9[_0x7636('0x19')]=qs[_0x7636('0x19')](_0x31e585[_0x7636('0x2e')][_0x7636('0x19')]);_0x1d4de9[_0x7636('0x35')]=qs[_0x7636('0x35')](_0x31e585[_0x7636('0x2e')][_0x7636('0x35')]);}return _0x29f2a9[_0x7636('0x4f')](_0x1d4de9);}})[_0x7636('0x20')](function(_0x14dfa9){if(_0x14dfa9){return _0x14dfa9?{'count':_0x15e097,'rows':_0x14dfa9}:null;}})[_0x7636('0x20')](respondWithResult(_0x4d50cf,null))['catch'](handleError(_0x4d50cf,null));}; \ No newline at end of file +var _0x44ad=['update','then','destroy','get','Companies','error','stack','name','send','index','describe','model','keys','query','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','map','merge','options','CmCompany','includeAll','include','findAll','rows','catch','params','rawAttributes','fields','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContact','addContacts','omit','getContacts','findOne','order','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save'];(function(_0x2a745a,_0x16d63f){var _0x3d45bc=function(_0x45d3a8){while(--_0x45d3a8){_0x2a745a['push'](_0x2a745a['shift']());}};_0x3d45bc(++_0x16d63f);}(_0x44ad,0x1ee));var _0xd44a=function(_0x572de3,_0x3f4d83){_0x572de3=_0x572de3-0x0;var _0xd9ae3e=_0x44ad[_0x572de3];return _0xd9ae3e;};'use strict';var emlformat=require(_0xd44a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd44a('0x1'));var jsonpatch=require(_0xd44a('0x2'));var rp=require(_0xd44a('0x3'));var moment=require(_0xd44a('0x4'));var BPromise=require(_0xd44a('0x5'));var Mustache=require(_0xd44a('0x6'));var util=require(_0xd44a('0x7'));var path=require(_0xd44a('0x8'));var sox=require(_0xd44a('0x9'));var csv=require(_0xd44a('0xa'));var ejs=require(_0xd44a('0xb'));var fs=require('fs');var fs_extra=require(_0xd44a('0xc'));var _=require('lodash');var squel=require(_0xd44a('0xd'));var crypto=require(_0xd44a('0xe'));var jsforce=require(_0xd44a('0xf'));var deskjs=require(_0xd44a('0x10'));var toCsv=require(_0xd44a('0xa'));var querystring=require(_0xd44a('0x11'));var Papa=require(_0xd44a('0x12'));var Redis=require(_0xd44a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd44a('0x14'));var as=require(_0xd44a('0x15'));var hardwareService=require(_0xd44a('0x16'));var logger=require(_0xd44a('0x17'))(_0xd44a('0x18'));var utils=require(_0xd44a('0x19'));var config=require(_0xd44a('0x1a'));var licenseUtil=require(_0xd44a('0x1b'));var db=require(_0xd44a('0x1c'))['db'];function respondWithStatusCode(_0x7932fb,_0x18441a){_0x18441a=_0x18441a||0xcc;return function(_0x508200){if(_0x508200){return _0x7932fb[_0xd44a('0x1d')](_0x18441a);}return _0x7932fb[_0xd44a('0x1e')](_0x18441a)[_0xd44a('0x1f')]();};}function respondWithResult(_0x34ed42,_0x5d2e50){_0x5d2e50=_0x5d2e50||0xc8;return function(_0x583013){if(_0x583013){return _0x34ed42[_0xd44a('0x1e')](_0x5d2e50)[_0xd44a('0x20')](_0x583013);}};}function respondWithFilteredResult(_0x5506d5,_0x9f7db9){return function(_0x3775a1){if(_0x3775a1){var _0x4ab895=typeof _0x9f7db9[_0xd44a('0x21')]===_0xd44a('0x22')&&typeof _0x9f7db9[_0xd44a('0x23')]==='undefined';var _0x443732=_0x3775a1['count'];var _0x152629=_0x4ab895?0x0:_0x9f7db9['offset'];var _0x11ddf0=_0x4ab895?_0x3775a1[_0xd44a('0x24')]:_0x9f7db9[_0xd44a('0x21')]+_0x9f7db9[_0xd44a('0x23')];var _0x152768;if(_0x11ddf0>=_0x443732){_0x11ddf0=_0x443732;_0x152768=0xc8;}else{_0x152768=0xce;}_0x5506d5['status'](_0x152768);return _0x5506d5['set'](_0xd44a('0x25'),_0x152629+'-'+_0x11ddf0+'/'+_0x443732)[_0xd44a('0x20')](_0x3775a1);}return null;};}function patchUpdates(_0x2adb34){return function(_0x372aa9){try{jsonpatch[_0xd44a('0x26')](_0x372aa9,_0x2adb34,!![]);}catch(_0x66b12a){return BPromise['reject'](_0x66b12a);}return _0x372aa9[_0xd44a('0x27')]();};}function saveUpdates(_0x3337e8,_0x17ff6e){return function(_0x458ed1){if(_0x458ed1){return _0x458ed1[_0xd44a('0x28')](_0x3337e8)[_0xd44a('0x29')](function(_0x4f644d){return _0x4f644d;});}return null;};}function removeEntity(_0x539276,_0x1071d4){return function(_0x17232f){if(_0x17232f){return _0x17232f[_0xd44a('0x2a')]()[_0xd44a('0x29')](function(){var _0x31bef8=_0x17232f[_0xd44a('0x2b')]({'plain':!![]});var _0x46cdba=_0xd44a('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x46cdba,'resourceId':_0x31bef8['id']}})['then'](function(){return _0x17232f;});})[_0xd44a('0x29')](function(){_0x539276[_0xd44a('0x1e')](0xcc)[_0xd44a('0x1f')]();});}};}function handleEntityNotFound(_0x2bd4c1,_0xe467ea){return function(_0x532070){if(!_0x532070){_0x2bd4c1['sendStatus'](0x194);}return _0x532070;};}function handleError(_0x4ec497,_0x11611b){_0x11611b=_0x11611b||0x1f4;return function(_0x3d9eab){logger[_0xd44a('0x2d')](_0x3d9eab[_0xd44a('0x2e')]);if(_0x3d9eab[_0xd44a('0x2f')]){delete _0x3d9eab['name'];}_0x4ec497['status'](_0x11611b)[_0xd44a('0x30')](_0x3d9eab);};}exports[_0xd44a('0x31')]=function(_0x2823e8,_0x3ff08a){var _0x23d9f5={},_0x3b1fb0={},_0x3caf6c={'count':0x0,'rows':[]};return db['CmCompany'][_0xd44a('0x32')]()[_0xd44a('0x29')](function(_0x7cf04b){_0x3b1fb0[_0xd44a('0x33')]=_[_0xd44a('0x34')](_0x7cf04b);_0x3b1fb0[_0xd44a('0x35')]=_['keys'](_0x2823e8[_0xd44a('0x35')]);_0x3b1fb0[_0xd44a('0x36')]=_['intersection'](_0x3b1fb0['model'],_0x3b1fb0[_0xd44a('0x35')]);_0x23d9f5['attributes']=_[_0xd44a('0x37')](_0x3b1fb0[_0xd44a('0x33')],qs['fields'](_0x2823e8['query']['fields']));_0x23d9f5[_0xd44a('0x38')]=_0x23d9f5[_0xd44a('0x38')][_0xd44a('0x39')]?_0x23d9f5[_0xd44a('0x38')]:_0x3b1fb0[_0xd44a('0x33')];if(!_0x2823e8[_0xd44a('0x35')]['hasOwnProperty'](_0xd44a('0x3a'))){_0x23d9f5[_0xd44a('0x23')]=qs[_0xd44a('0x23')](_0x2823e8[_0xd44a('0x35')][_0xd44a('0x23')]);_0x23d9f5['offset']=qs[_0xd44a('0x21')](_0x2823e8[_0xd44a('0x35')][_0xd44a('0x21')]);}_0x23d9f5['order']=qs[_0xd44a('0x3b')](_0x2823e8[_0xd44a('0x35')][_0xd44a('0x3b')]);_0x23d9f5[_0xd44a('0x3c')]=qs[_0xd44a('0x36')](_[_0xd44a('0x3d')](_0x2823e8[_0xd44a('0x35')],_0x3b1fb0['filters']),_0x7cf04b);if(_0x2823e8[_0xd44a('0x35')][_0xd44a('0x3e')]){_0x23d9f5[_0xd44a('0x3c')]=_['merge'](_0x23d9f5['where'],{'$or':_[_0xd44a('0x3f')](_0x23d9f5[_0xd44a('0x38')],function(_0x4674a1){var _0x266f25={};_0x266f25[_0x4674a1]={'$like':'%'+_0x2823e8[_0xd44a('0x35')][_0xd44a('0x3e')]+'%'};return _0x266f25;})});}_0x23d9f5=_[_0xd44a('0x40')]({},_0x23d9f5,_0x2823e8[_0xd44a('0x41')]);var _0x235227={'where':_0x23d9f5[_0xd44a('0x3c')]};return db[_0xd44a('0x42')][_0xd44a('0x24')](_0x235227)[_0xd44a('0x29')](function(_0x5f287d){_0x3caf6c[_0xd44a('0x24')]=_0x5f287d;if(_0x2823e8[_0xd44a('0x35')][_0xd44a('0x43')]){_0x23d9f5[_0xd44a('0x44')]=[{'all':!![]}];}return db[_0xd44a('0x42')][_0xd44a('0x45')](_0x23d9f5);})[_0xd44a('0x29')](function(_0x294e5f){_0x3caf6c[_0xd44a('0x46')]=_0x294e5f;return _0x3caf6c;})['then'](respondWithFilteredResult(_0x3ff08a,_0x23d9f5))[_0xd44a('0x47')](handleError(_0x3ff08a,null));})[_0xd44a('0x47')](handleError(_0x3ff08a,null));};exports['show']=function(_0x1e68be,_0x1af736){var _0x5ad248={'raw':![],'where':{'id':_0x1e68be[_0xd44a('0x48')]['id']}},_0xb05854={};_0xb05854[_0xd44a('0x33')]=_['keys'](db[_0xd44a('0x42')][_0xd44a('0x49')]);_0xb05854['query']=_['keys'](_0x1e68be[_0xd44a('0x35')]);_0xb05854['filters']=_['intersection'](_0xb05854[_0xd44a('0x33')],_0xb05854[_0xd44a('0x35')]);_0x5ad248[_0xd44a('0x38')]=_[_0xd44a('0x37')](_0xb05854[_0xd44a('0x33')],qs[_0xd44a('0x4a')](_0x1e68be['query'][_0xd44a('0x4a')]));_0x5ad248['attributes']=_0x5ad248['attributes'][_0xd44a('0x39')]?_0x5ad248[_0xd44a('0x38')]:_0xb05854[_0xd44a('0x33')];if(_0x1e68be[_0xd44a('0x35')][_0xd44a('0x43')]){_0x5ad248[_0xd44a('0x44')]=[{'all':!![]}];}_0x5ad248=_[_0xd44a('0x40')]({},_0x5ad248,_0x1e68be[_0xd44a('0x41')]);return db[_0xd44a('0x42')][_0xd44a('0x4b')](_0x5ad248)['then'](handleEntityNotFound(_0x1af736,null))[_0xd44a('0x29')](respondWithResult(_0x1af736,null))['catch'](handleError(_0x1af736,null));};exports['create']=function(_0x337667,_0x113014){return db['CmCompany'][_0xd44a('0x4c')](_0x337667['body'],{})['then'](function(_0x12247b){var _0xb7ff5b=_0x337667['user'][_0xd44a('0x2b')]({'plain':!![]});if(!_0xb7ff5b)throw new Error(_0xd44a('0x4d'));if(_0xb7ff5b['role']===_0xd44a('0x4e')){var _0x5e9bb6=_0x12247b[_0xd44a('0x2b')]({'plain':!![]});var _0x127fde='Companies';return db['UserProfileSection']['find']({'where':{'name':_0x127fde,'userProfileId':_0xb7ff5b[_0xd44a('0x4f')]},'raw':!![]})[_0xd44a('0x29')](function(_0x536cc6){if(_0x536cc6&&_0x536cc6['autoAssociation']===0x0){return db[_0xd44a('0x50')][_0xd44a('0x4c')]({'name':_0x5e9bb6[_0xd44a('0x2f')],'resourceId':_0x5e9bb6['id'],'type':_0x536cc6[_0xd44a('0x2f')],'sectionId':_0x536cc6['id']},{})[_0xd44a('0x29')](function(){return _0x12247b;});}else{return _0x12247b;}})[_0xd44a('0x47')](function(_0xf4d17c){logger['error'](_0xd44a('0x51'),_0xf4d17c);throw _0xf4d17c;});}return _0x12247b;})[_0xd44a('0x29')](respondWithResult(_0x113014,0xc9))[_0xd44a('0x47')](handleError(_0x113014,null));};exports['update']=function(_0x165502,_0xe4638f){if(_0x165502['body']['id']){delete _0x165502[_0xd44a('0x52')]['id'];}return db[_0xd44a('0x42')][_0xd44a('0x4b')]({'where':{'id':_0x165502[_0xd44a('0x48')]['id']}})['then'](handleEntityNotFound(_0xe4638f,null))[_0xd44a('0x29')](saveUpdates(_0x165502[_0xd44a('0x52')],null))['then'](respondWithResult(_0xe4638f,null))[_0xd44a('0x47')](handleError(_0xe4638f,null));};exports[_0xd44a('0x2a')]=function(_0x505d8c,_0x1a4c53){return db['CmCompany']['find']({'where':{'id':_0x505d8c['params']['id']}})[_0xd44a('0x29')](handleEntityNotFound(_0x1a4c53,null))[_0xd44a('0x29')](removeEntity(_0x1a4c53,null))['catch'](handleError(_0x1a4c53,null));};exports[_0xd44a('0x32')]=function(_0x177d27,_0x522b14){return db['CmCompany'][_0xd44a('0x32')]()[_0xd44a('0x29')](respondWithResult(_0x522b14,null))[_0xd44a('0x47')](handleError(_0x522b14,null));};exports['addContacts']=function(_0x241611,_0x24d6ee,_0x7d0f52){return db[_0xd44a('0x53')][_0xd44a('0x4b')]({'where':{'id':_0x241611[_0xd44a('0x48')]['id']}})['then'](handleEntityNotFound(_0x24d6ee,null))[_0xd44a('0x29')](function(_0x311fcf){if(_0x311fcf){return _0x311fcf[_0xd44a('0x54')](_0x241611['body']['ids'],_[_0xd44a('0x55')](_0x241611['body'],['ids','id'])||{});}})[_0xd44a('0x29')](respondWithResult(_0x24d6ee,null))[_0xd44a('0x47')](handleError(_0x24d6ee,null));};exports[_0xd44a('0x56')]=function(_0x177543,_0x327b62,_0x4bd93c){var _0x48872a={};var _0x3dbaf5={};var _0x7658ed;var _0x38c11b;return db[_0xd44a('0x42')][_0xd44a('0x57')]({'where':{'id':_0x177543[_0xd44a('0x48')]['id']}})[_0xd44a('0x29')](handleEntityNotFound(_0x327b62,null))[_0xd44a('0x29')](function(_0x171322){if(_0x171322){_0x7658ed=_0x171322;_0x3dbaf5[_0xd44a('0x33')]=_[_0xd44a('0x34')](db[_0xd44a('0x53')][_0xd44a('0x49')]);_0x3dbaf5[_0xd44a('0x35')]=_[_0xd44a('0x34')](_0x177543[_0xd44a('0x35')]);_0x3dbaf5[_0xd44a('0x36')]=_['intersection'](_0x3dbaf5[_0xd44a('0x33')],_0x3dbaf5['query']);_0x48872a['attributes']=_['intersection'](_0x3dbaf5[_0xd44a('0x33')],qs[_0xd44a('0x4a')](_0x177543[_0xd44a('0x35')]['fields']));_0x48872a['attributes']=_0x48872a[_0xd44a('0x38')][_0xd44a('0x39')]?_0x48872a['attributes']:_0x3dbaf5['model'];_0x48872a[_0xd44a('0x58')]=qs[_0xd44a('0x3b')](_0x177543[_0xd44a('0x35')]['sort']);_0x48872a[_0xd44a('0x3c')]=qs[_0xd44a('0x36')](_[_0xd44a('0x3d')](_0x177543[_0xd44a('0x35')],_0x3dbaf5['filters']));if(_0x177543['query'][_0xd44a('0x3e')]){_0x48872a[_0xd44a('0x3c')]=_[_0xd44a('0x40')](_0x48872a[_0xd44a('0x3c')],{'$or':_[_0xd44a('0x3f')](_0x48872a[_0xd44a('0x38')],function(_0x5ccf73){var _0xc0dc7={};_0xc0dc7[_0x5ccf73]={'$like':'%'+_0x177543['query'][_0xd44a('0x3e')]+'%'};return _0xc0dc7;})});}_0x48872a=_[_0xd44a('0x40')]({},_0x48872a,_0x177543[_0xd44a('0x41')]);return _0x7658ed[_0xd44a('0x56')](_0x48872a);}})[_0xd44a('0x29')](function(_0x2ad4bf){if(_0x2ad4bf){_0x38c11b=_0x2ad4bf[_0xd44a('0x39')];if(!_0x177543['query']['hasOwnProperty'](_0xd44a('0x3a'))){_0x48872a['limit']=qs[_0xd44a('0x23')](_0x177543['query'][_0xd44a('0x23')]);_0x48872a[_0xd44a('0x21')]=qs[_0xd44a('0x21')](_0x177543['query'][_0xd44a('0x21')]);}return _0x7658ed[_0xd44a('0x56')](_0x48872a);}})[_0xd44a('0x29')](function(_0x2695d3){if(_0x2695d3){return _0x2695d3?{'count':_0x38c11b,'rows':_0x2695d3}:null;}})[_0xd44a('0x29')](respondWithResult(_0x327b62,null))[_0xd44a('0x47')](handleError(_0x327b62,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 5823592..e9d9b0c 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 _0xdf88=['CmCompany','cm_companies','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf88,0x91));var _0x8df8=function(_0x1340b3,_0x3d52bb){_0x1340b3=_0x1340b3-0x0;var _0x43f7c0=_0xdf88[_0x1340b3];return _0x43f7c0;};'use strict';var _=require(_0x8df8('0x0'));var util=require('util');var logger=require(_0x8df8('0x1'))(_0x8df8('0x2'));var moment=require(_0x8df8('0x3'));var BPromise=require(_0x8df8('0x4'));var rp=require(_0x8df8('0x5'));var fs=require('fs');var path=require(_0x8df8('0x6'));var rimraf=require(_0x8df8('0x7'));var config=require(_0x8df8('0x8'));var attributes=require(_0x8df8('0x9'));module['exports']=function(_0x11319e,_0xa3845a){return _0x11319e[_0x8df8('0xa')](_0x8df8('0xb'),attributes,{'tableName':_0x8df8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdb4=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmCompany.attributes','define','CmCompany'];(function(_0x517ad3,_0x6181f5){var _0x4dbff4=function(_0x10f378){while(--_0x10f378){_0x517ad3['push'](_0x517ad3['shift']());}};_0x4dbff4(++_0x6181f5);}(_0xbdb4,0x78));var _0x4bdb=function(_0x3893c9,_0x584785){_0x3893c9=_0x3893c9-0x0;var _0xb3ebc2=_0xbdb4[_0x3893c9];return _0xb3ebc2;};'use strict';var _=require(_0x4bdb('0x0'));var util=require('util');var logger=require(_0x4bdb('0x1'))(_0x4bdb('0x2'));var moment=require('moment');var BPromise=require(_0x4bdb('0x3'));var rp=require(_0x4bdb('0x4'));var fs=require('fs');var path=require(_0x4bdb('0x5'));var rimraf=require('rimraf');var config=require(_0x4bdb('0x6'));var attributes=require(_0x4bdb('0x7'));module['exports']=function(_0x59ea2e,_0x4b2232){return _0x59ea2e[_0x4bdb('0x8')](_0x4bdb('0x9'),attributes,{'tableName':'cm_companies','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 1d45118..8f36b59 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 _0x1d87=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','message','CmCompany,\x20%s,\x20%s','info','result','lodash','util','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d87,0x1cb));var _0x71d8=function(_0x18d5d7,_0x19074b){_0x18d5d7=_0x18d5d7-0x0;var _0x30a9ea=_0x1d87[_0x18d5d7];return _0x30a9ea;};'use strict';var _=require(_0x71d8('0x0'));var util=require(_0x71d8('0x1'));var moment=require('moment');var BPromise=require(_0x71d8('0x2'));var rs=require(_0x71d8('0x3'));var fs=require('fs');var Redis=require(_0x71d8('0x4'));var db=require(_0x71d8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x71d8('0x6'))(_0x71d8('0x7'));var config=require(_0x71d8('0x8'));var jayson=require(_0x71d8('0x9'));var client=jayson[_0x71d8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x169c4e,_0x4531b0,_0x121b06){return new BPromise(function(_0x395e40,_0x393b34){return client[_0x71d8('0xb')](_0x169c4e,_0x121b06)[_0x71d8('0xc')](function(_0x3d4be2){logger['info']('CmCompany,\x20%s,\x20%s',_0x4531b0,_0x71d8('0xd'));logger[_0x71d8('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x4531b0,_0x71d8('0xd'),JSON[_0x71d8('0xf')](_0x3d4be2));if(_0x3d4be2[_0x71d8('0x10')]){if(_0x3d4be2[_0x71d8('0x10')][_0x71d8('0x11')]===0x1f4){logger[_0x71d8('0x10')]('CmCompany,\x20%s,\x20%s',_0x4531b0,_0x3d4be2[_0x71d8('0x10')][_0x71d8('0x12')]);return _0x393b34(_0x3d4be2['error']['message']);}logger['error'](_0x71d8('0x13'),_0x4531b0,_0x3d4be2['error']['message']);return _0x395e40(_0x3d4be2[_0x71d8('0x10')][_0x71d8('0x12')]);}else{logger[_0x71d8('0x14')](_0x71d8('0x13'),_0x4531b0,_0x71d8('0xd'));_0x395e40(_0x3d4be2[_0x71d8('0x15')]['message']);}})['catch'](function(_0x255b1e){logger[_0x71d8('0x10')](_0x71d8('0x13'),_0x4531b0,_0x255b1e);_0x393b34(_0x255b1e);});});} \ No newline at end of file +var _0xceca=['lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','request\x20sent','error','code','message','CmCompany,\x20%s,\x20%s','result'];(function(_0x584928,_0x1ce73f){var _0x4811c9=function(_0x114fe5){while(--_0x114fe5){_0x584928['push'](_0x584928['shift']());}};_0x4811c9(++_0x1ce73f);}(_0xceca,0xe1));var _0xacec=function(_0xde9b70,_0x1c0d60){_0xde9b70=_0xde9b70-0x0;var _0x38db14=_0xceca[_0xde9b70];return _0x38db14;};'use strict';var _=require(_0xacec('0x0'));var util=require(_0xacec('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xacec('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xacec('0x3'))['db'];var utils=require(_0xacec('0x4'));var logger=require('../../config/logger')(_0xacec('0x5'));var config=require(_0xacec('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xacec('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3dd9c,_0x1acb40,_0x35d2c6){return new BPromise(function(_0x18088b,_0x49b103){return client['request'](_0x3dd9c,_0x35d2c6)[_0xacec('0x8')](function(_0x1a9d39){logger['info']('CmCompany,\x20%s,\x20%s',_0x1acb40,_0xacec('0x9'));logger['debug']('CmCompany,\x20%s,\x20%s,\x20%s',_0x1acb40,_0xacec('0x9'),JSON['stringify'](_0x1a9d39));if(_0x1a9d39[_0xacec('0xa')]){if(_0x1a9d39['error'][_0xacec('0xb')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x1acb40,_0x1a9d39[_0xacec('0xa')][_0xacec('0xc')]);return _0x49b103(_0x1a9d39[_0xacec('0xa')][_0xacec('0xc')]);}logger[_0xacec('0xa')]('CmCompany,\x20%s,\x20%s',_0x1acb40,_0x1a9d39[_0xacec('0xa')][_0xacec('0xc')]);return _0x18088b(_0x1a9d39['error'][_0xacec('0xc')]);}else{logger['info'](_0xacec('0xd'),_0x1acb40,_0xacec('0x9'));_0x18088b(_0x1a9d39[_0xacec('0xe')]['message']);}})['catch'](function(_0x1c0aa7){logger[_0xacec('0xa')](_0xacec('0xd'),_0x1acb40,_0x1c0aa7);_0x49b103(_0x1c0aa7);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index ca32ffe..7f50b60 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 _0xe49c=['get','isAuthenticated','describe','show','/:id/contacts','getContacts','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x618ad6,_0x4992d2){var _0x277505=function(_0x3bf48c){while(--_0x3bf48c){_0x618ad6['push'](_0x618ad6['shift']());}};_0x277505(++_0x4992d2);}(_0xe49c,0x189));var _0xce49=function(_0x42e013,_0x4e1584){_0x42e013=_0x42e013-0x0;var _0x3e951b=_0xe49c[_0x42e013];return _0x3e951b;};'use strict';var multer=require(_0xce49('0x0'));var util=require(_0xce49('0x1'));var path=require(_0xce49('0x2'));var timeout=require(_0xce49('0x3'));var express=require('express');var router=express[_0xce49('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xce49('0x5'));var config=require(_0xce49('0x6'));var controller=require('./cmCompany.controller');router[_0xce49('0x7')]('/',auth[_0xce49('0x8')](),controller['index']);router[_0xce49('0x7')]('/describe',auth[_0xce49('0x8')](),controller[_0xce49('0x9')]);router[_0xce49('0x7')]('/:id',auth[_0xce49('0x8')](),controller[_0xce49('0xa')]);router[_0xce49('0x7')](_0xce49('0xb'),auth[_0xce49('0x8')](),controller[_0xce49('0xc')]);router[_0xce49('0xd')]('/',auth['isAuthenticated'](),controller[_0xce49('0xe')]);router[_0xce49('0xd')](_0xce49('0xb'),auth[_0xce49('0x8')](),controller['addContacts']);router[_0xce49('0xf')](_0xce49('0x10'),auth[_0xce49('0x8')](),controller['update']);router[_0xce49('0x11')](_0xce49('0x10'),auth[_0xce49('0x8')](),controller[_0xce49('0x12')]);module[_0xce49('0x13')]=router; \ No newline at end of file +var _0x49ad=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','destroy','multer','util','express','Router'];(function(_0x374d40,_0x40aea){var _0x50a6fd=function(_0x4c01c5){while(--_0x4c01c5){_0x374d40['push'](_0x374d40['shift']());}};_0x50a6fd(++_0x40aea);}(_0x49ad,0x13e));var _0xd49a=function(_0x1d4934,_0x273e2b){_0x1d4934=_0x1d4934-0x0;var _0x3603f7=_0x49ad[_0x1d4934];return _0x3603f7;};'use strict';var multer=require(_0xd49a('0x0'));var util=require(_0xd49a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd49a('0x2'));var router=express[_0xd49a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd49a('0x4'));var interaction=require(_0xd49a('0x5'));var config=require(_0xd49a('0x6'));var controller=require(_0xd49a('0x7'));router[_0xd49a('0x8')]('/',auth['isAuthenticated'](),controller[_0xd49a('0x9')]);router[_0xd49a('0x8')](_0xd49a('0xa'),auth[_0xd49a('0xb')](),controller[_0xd49a('0xc')]);router['get'](_0xd49a('0xd'),auth[_0xd49a('0xb')](),controller[_0xd49a('0xe')]);router[_0xd49a('0x8')](_0xd49a('0xf'),auth[_0xd49a('0xb')](),controller[_0xd49a('0x10')]);router[_0xd49a('0x11')]('/',auth[_0xd49a('0xb')](),controller[_0xd49a('0x12')]);router[_0xd49a('0x11')](_0xd49a('0xf'),auth[_0xd49a('0xb')](),controller[_0xd49a('0x13')]);router[_0xd49a('0x14')](_0xd49a('0xd'),auth[_0xd49a('0xb')](),controller[_0xd49a('0x15')]);router['delete']('/:id',auth[_0xd49a('0xb')](),controller[_0xd49a('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 20ba0c8..94b2b2a 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 _0xb99d=['exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','lodash','sequelize'];(function(_0x50521f,_0x4375b3){var _0x29b4be=function(_0x1cb06e){while(--_0x1cb06e){_0x50521f['push'](_0x50521f['shift']());}};_0x29b4be(++_0x4375b3);}(_0xb99d,0x146));var _0xdb99=function(_0x159af1,_0x53820c){_0x159af1=_0x159af1-0x0;var _0x5ef35a=_0xb99d[_0x159af1];return _0x5ef35a;};'use strict';var _=require(_0xdb99('0x0'));var Sequelize=require(_0xdb99('0x1'));module[_0xdb99('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xdb99('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xdb99('0x3')]},'description':{'type':Sequelize[_0xdb99('0x4')]},'phone':{'type':Sequelize[_0xdb99('0x3')]},'mobile':{'type':Sequelize[_0xdb99('0x3')]},'fax':{'type':Sequelize[_0xdb99('0x3')]},'email':{'type':Sequelize[_0xdb99('0x3')]},'url':{'type':Sequelize[_0xdb99('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xdb99('0x3')]},'skype':{'type':Sequelize[_0xdb99('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xdb99('0x3')]},'line':{'type':Sequelize[_0xdb99('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xdb99('0x3')]},'UserId':{'type':Sequelize[_0xdb99('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xdb99('0x5')](0x2)[_0xdb99('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xdb99('0x7')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xdb99('0x5')]}}; \ No newline at end of file +var _0xa4b6=['lodash','exports','STRING','INTEGER','UNSIGNED','DATE'];(function(_0x4555f1,_0x1aec4d){var _0x414541=function(_0x1ffe89){while(--_0x1ffe89){_0x4555f1['push'](_0x4555f1['shift']());}};_0x414541(++_0x1aec4d);}(_0xa4b6,0x1f2));var _0x6a4b=function(_0x21b5bd,_0xbf9644){_0x21b5bd=_0x21b5bd-0x0;var _0x27ea5c=_0xa4b6[_0x21b5bd];return _0x27ea5c;};'use strict';var _=require(_0x6a4b('0x0'));var Sequelize=require('sequelize');module[_0x6a4b('0x1')]={'firstName':{'type':Sequelize[_0x6a4b('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x6a4b('0x2')]},'street':{'type':Sequelize[_0x6a4b('0x2')]},'postalCode':{'type':Sequelize[_0x6a4b('0x2')]},'city':{'type':Sequelize[_0x6a4b('0x2')]},'country':{'type':Sequelize[_0x6a4b('0x2')]},'dateOfBirth':{'type':Sequelize[_0x6a4b('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x6a4b('0x2')]},'mobile':{'type':Sequelize[_0x6a4b('0x2')]},'fax':{'type':Sequelize[_0x6a4b('0x2')]},'email':{'type':Sequelize[_0x6a4b('0x2')]},'url':{'type':Sequelize[_0x6a4b('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x6a4b('0x2')]},'twitter':{'type':Sequelize[_0x6a4b('0x2')]},'skype':{'type':Sequelize[_0x6a4b('0x2')]},'teams':{'type':Sequelize[_0x6a4b('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x6a4b('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x6a4b('0x2')]},'UserId':{'type':Sequelize[_0x6a4b('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x6a4b('0x2')]},'priority':{'type':Sequelize[_0x6a4b('0x3')](0x2)[_0x6a4b('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x6a4b('0x5')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x6a4b('0x2')]},'utcOffset':{'type':Sequelize[_0x6a4b('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index a79b158..54cb0de 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 _0xc2ad=['mergeWith','join','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','isArray','isNil','dialTimezone','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','findOrCreate','spread','push','contact','all','Tag','color','ContactItemType','literal','Phones.OrderBy','$and','map','format','cf_%d','timezones','omit','pickBy','startsWith','table','cm_contacts','id\x20=\x20?','toParam','sequelize','text','phone','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','filter','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','create','PHONE','item','ItemType','`ItemType`.OrderBy','CmHopperId','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','CmContactId','toContactId','hopperId','getHoppers','pick','ContactId','options','includeAll','include','rows','CmHopperHistory','getHopperFinals','getJscriptySessions','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','file','parse','meta','import','User','No\x20ListId\x20specified','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','agent','../../components/import/cm/csvUpdates','mail','chat','sms','openchannel','voice','-createdAt','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','callerid','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','UserId','DESC','findAndCountAll','fullname','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','key','Tags','customerIp','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','externalUrl','Interaction','Owner','flatten','sortBy','reverse','value','slice','moment','bluebird','util','path','lodash','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register','json','offset','undefined','limit','count','set','update','then','status','end','name','index','describe','getOptions','findAll','user','catch','destroy','CmContact','find','params','tags','keys','cf_','columnName','displayName','query','CmCustomField','length','custom','type','values','info','hasOwnProperty','merge','body','from','get'];(function(_0x3a4b75,_0x2be9a4){var _0x58b661=function(_0x50151f){while(--_0x50151f){_0x3a4b75['push'](_0x3a4b75['shift']());}};_0x58b661(++_0x2be9a4);}(_0xc2ad,0xc1));var _0xdc2a=function(_0x1070c5,_0x758964){_0x1070c5=_0x1070c5-0x0;var _0x3a58ee=_0xc2ad[_0x1070c5];return _0x3a58ee;};'use strict';var moment=require(_0xdc2a('0x0'));var BPromise=require(_0xdc2a('0x1'));var util=require(_0xdc2a('0x2'));var path=require(_0xdc2a('0x3'));var fs=require('fs');var _=require(_0xdc2a('0x4'));var squel=require('squel');var Papa=require(_0xdc2a('0x5'));var Redis=require(_0xdc2a('0x6'));var contacts=require(_0xdc2a('0x7'));var qs=require(_0xdc2a('0x8'));var logger=require(_0xdc2a('0x9'))(_0xdc2a('0xa'));var config=require(_0xdc2a('0xb'));var shared=require(_0xdc2a('0xc'));var db=require(_0xdc2a('0xd'))['db'];config['redis']=_[_0xdc2a('0xe')](config[_0xdc2a('0xf')],{'host':_0xdc2a('0x10'),'port':0x18eb});var socket=require(_0xdc2a('0x11'))(new Redis(config[_0xdc2a('0xf')]));require(_0xdc2a('0x12'))[_0xdc2a('0x13')](socket);function respondWithResult(_0x207e6e,_0xc10b78){_0xc10b78=_0xc10b78||0xc8;return function(_0xbb987){if(_0xbb987){return _0x207e6e['status'](_0xc10b78)[_0xdc2a('0x14')](_0xbb987);}};}function respondWithFilteredResult(_0x97a41b,_0x109bd1){return function(_0x2ba8a9){if(_0x2ba8a9){var _0x2afb24=typeof _0x109bd1[_0xdc2a('0x15')]===_0xdc2a('0x16')&&typeof _0x109bd1[_0xdc2a('0x17')]===_0xdc2a('0x16');var _0x5b2ae3=_0x2ba8a9[_0xdc2a('0x18')];var _0x44f010=_0x2afb24?0x0:_0x109bd1['offset'];var _0xb3783d=_0x2afb24?_0x2ba8a9['count']:_0x109bd1[_0xdc2a('0x15')]+_0x109bd1['limit'];var _0x2174fa;if(_0xb3783d>=_0x5b2ae3){_0xb3783d=_0x5b2ae3;_0x2174fa=0xc8;}else{_0x2174fa=0xce;}_0x97a41b['status'](_0x2174fa);return _0x97a41b[_0xdc2a('0x19')]('Content-Range',_0x44f010+'-'+_0xb3783d+'/'+_0x5b2ae3)[_0xdc2a('0x14')](_0x2ba8a9);}return null;};}function saveUpdates(_0x3775f0){return function(_0x13bc2b){if(_0x13bc2b){return _0x13bc2b[_0xdc2a('0x1a')](_0x3775f0)['then'](function(_0x4282c5){return _0x4282c5;});}return null;};}function removeEntity(_0x8100f){return function(_0x25958e){if(_0x25958e){return _0x25958e['destroy']()[_0xdc2a('0x1b')](function(){_0x8100f[_0xdc2a('0x1c')](0xcc)[_0xdc2a('0x1d')]();});}};}function handleEntityNotFound(_0x4af835){return function(_0x54d392){if(!_0x54d392){_0x4af835['sendStatus'](0x194);}return _0x54d392;};}function handleError(_0x27d247,_0x19acc1){_0x19acc1=_0x19acc1||0x1f4;return function(_0x276150){logger['error'](_0x276150['stack']);if(_0x276150[_0xdc2a('0x1e')]){delete _0x276150[_0xdc2a('0x1e')];}_0x27d247[_0xdc2a('0x1c')](_0x19acc1)['send'](_0x276150);};}exports[_0xdc2a('0x1f')]=function(_0x8afd1b,_0x3eca16){var _0x2b2c02={};return contacts[_0xdc2a('0x20')]()[_0xdc2a('0x1b')](function(_0x39afc3){_0x2b2c02=qs[_0xdc2a('0x21')](_0x39afc3,_0x8afd1b);return contacts[_0xdc2a('0x22')](_0x8afd1b['query'],_0x8afd1b[_0xdc2a('0x23')],_0x2b2c02,_0x39afc3);})['then'](respondWithFilteredResult(_0x3eca16,_0x2b2c02))[_0xdc2a('0x24')](handleError(_0x3eca16,null));};exports[_0xdc2a('0x25')]=function(_0xcddc40,_0x410cb1){return db[_0xdc2a('0x26')][_0xdc2a('0x27')]({'where':{'id':_0xcddc40[_0xdc2a('0x28')]['id']}})[_0xdc2a('0x1b')](handleEntityNotFound(_0x410cb1,null))['then'](removeEntity(_0x410cb1,null))[_0xdc2a('0x24')](handleError(_0x410cb1,null));};exports[_0xdc2a('0x20')]=function(_0x47ad8f,_0x2e6551){return db[_0xdc2a('0x26')][_0xdc2a('0x20')]()[_0xdc2a('0x1b')](function(_0x2247ef){delete _0x2247ef[_0xdc2a('0x29')];for(var _0xb47c3=0x0;_0xb47c30x0){return new Promise(function(_0x179a3b){var _0xc555bd=[];for(var _0x161a6c=0x0;_0x161a6c<_0x2253c9['length'];_0x161a6c++){_0xc555bd['push'](insertAdditionalPhones(_0x2253c9[_0x161a6c][_0xdc2a('0x5f')],_0x2253c9[_0x161a6c][_0xdc2a('0x55')]));}Promise[_0xdc2a('0x60')](_0xc555bd)[_0xdc2a('0x1b')](function(){_0x179a3b(0x1);});})[_0xdc2a('0x1b')](function(){return{'success':_0x333e63,'failure':_0xeb56e2,'duplicates':_0x4a5615};});}else{return{'success':_0x333e63,'failure':_0xeb56e2,'duplicates':_0x4a5615};}}})[_0xdc2a('0x1b')](respondWithResult(_0x2d6e2b,0xc9))[_0xdc2a('0x24')](handleError(_0x2d6e2b,null));};exports['show']=function(_0x482277,_0x3d5177){var _0xe4bcc5;return db[_0xdc2a('0x26')]['describe']()[_0xdc2a('0x1b')](function(_0x46be7b){return db['CmContact'][_0xdc2a('0x27')]({'where':{'id':_0x482277['params']['id']},'include':[{'model':db[_0xdc2a('0x61')],'as':'Tags','attributes':['id',_0xdc2a('0x1e'),_0xdc2a('0x62')],'required':_0x482277[_0xdc2a('0x2e')]['tag']?!![]:![]},{'model':db['CmContactHasItem'],'as':'Phones','where':{'CmContactId':_0x482277['params']['id']},'required':![],'include':[{'model':db[_0xdc2a('0x63')],'as':'ItemType'}]}],'order':[db['sequelize'][_0xdc2a('0x64')](_0xdc2a('0x65'))],'attributes':_[_0xdc2a('0x2a')](_0x46be7b)});})[_0xdc2a('0x1b')](function(_0x56c9bb){if(!_[_0xdc2a('0x52')](_0x56c9bb)){_0xe4bcc5=_0x56c9bb[_0xdc2a('0x39')]({'plain':!![]});var _0x2b851a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x56c9bb&&_0x56c9bb[_0xdc2a('0x5b')]){if(_0x56c9bb[_0xdc2a('0x5b')]){_0x2b851a[_0xdc2a('0x59')][_0xdc2a('0x66')][_0xdc2a('0x5e')]({'ListId':{'$ne':_0x56c9bb[_0xdc2a('0x5b')]}});}}return db[_0xdc2a('0x2f')]['findAll'](_0x2b851a);}})[_0xdc2a('0x1b')](function(_0x4c4813){if(!_[_0xdc2a('0x52')](_0x4c4813)){return _['omit'](_0xe4bcc5,_[_0xdc2a('0x67')](_0x4c4813,function(_0x29cd49){return util[_0xdc2a('0x68')](_0xdc2a('0x69'),_0x29cd49['id']);}));}})[_0xdc2a('0x1b')](handleEntityNotFound(_0x3d5177,null))[_0xdc2a('0x1b')](respondWithResult(_0x3d5177,null))[_0xdc2a('0x24')](handleError(_0x3d5177,null));};exports[_0xdc2a('0x1a')]=function(_0x2faa71,_0xcd7425){var _0x98ac1a;if(_0x2faa71['body']['id']){delete _0x2faa71[_0xdc2a('0x37')]['id'];}if(!_[_0xdc2a('0x52')](_0x2faa71[_0xdc2a('0x37')][_0xdc2a('0x53')])){var _0x69da10=_0x2faa71[_0xdc2a('0x37')]['dialTimezone'];if(!_[_0xdc2a('0x52')](shared['timezones'][_0x69da10]))_0x2faa71[_0xdc2a('0x37')][_0xdc2a('0x54')]=shared[_0xdc2a('0x6a')][_0x69da10]['utcOffset'];}return db[_0xdc2a('0x26')][_0xdc2a('0x27')]({'where':{'id':_0x2faa71[_0xdc2a('0x28')]['id']}})['then'](handleEntityNotFound(_0xcd7425,null))[_0xdc2a('0x1b')](saveUpdates(_0x2faa71[_0xdc2a('0x37')],null))['then'](function(_0x40f8af){_0x98ac1a=_0x40f8af;var _0x45c19f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x40f8af&&_0x40f8af[_0xdc2a('0x5b')]){if(_0x40f8af[_0xdc2a('0x5b')]){_0x45c19f[_0xdc2a('0x59')][_0xdc2a('0x66')][_0xdc2a('0x5e')]({'ListId':{'$ne':_0x40f8af[_0xdc2a('0x5b')]}});}}return db['CmCustomField'][_0xdc2a('0x22')](_0x45c19f);})[_0xdc2a('0x1b')](function(_0x49bdc5){if(_0x49bdc5){return _[_0xdc2a('0x6b')](_[_0xdc2a('0x6c')](_0x2faa71[_0xdc2a('0x37')],function(_0x1e1eba,_0x48cf00){return _[_0xdc2a('0x6d')](_0x48cf00,'cf_');}),_[_0xdc2a('0x67')](_0x49bdc5,function(_0x40b9e2){return util[_0xdc2a('0x68')](_0xdc2a('0x69'),_0x40b9e2['id']);}));}})[_0xdc2a('0x1b')](function(_0x4e66b1){if(_0x4e66b1&&!_['isEmpty'](_0x4e66b1)){var _0x16224a=squel[_0xdc2a('0x1a')]()[_0xdc2a('0x6e')](_0xdc2a('0x6f'))['setFields'](_0x4e66b1)['where'](_0xdc2a('0x70'),_0x2faa71[_0xdc2a('0x28')]['id'])[_0xdc2a('0x71')]();return db[_0xdc2a('0x72')]['query'](_0x16224a[_0xdc2a('0x73')],{'replacements':_0x16224a[_0xdc2a('0x33')]});}})[_0xdc2a('0x1b')](function(){if(_0x2faa71['body'][_0xdc2a('0x74')]&&_0x98ac1a){return db[_0xdc2a('0x3c')][_0xdc2a('0x1a')]({'phone':_0x2faa71[_0xdc2a('0x37')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x98ac1a['id']}});}})['then'](function(){return _0x98ac1a;})[_0xdc2a('0x1b')](respondWithResult(_0xcd7425,null))['catch'](handleError(_0xcd7425,null));};exports[_0xdc2a('0x75')]=function(_0x312848,_0x49b669){var _0x3d38da={};var _0x51128d={};var _0x630f8b;var _0x3be37f;return db[_0xdc2a('0x26')][_0xdc2a('0x76')]({'where':{'id':_0x312848[_0xdc2a('0x28')]['id']}})['then'](handleEntityNotFound(_0x49b669,null))[_0xdc2a('0x1b')](function(_0x2ffcb8){if(_0x2ffcb8){_0x630f8b=_0x2ffcb8;_0x51128d[_0xdc2a('0x77')]=_[_0xdc2a('0x2a')](db[_0xdc2a('0x61')][_0xdc2a('0x78')]);_0x51128d['query']=_[_0xdc2a('0x2a')](_0x312848[_0xdc2a('0x2e')]);_0x51128d[_0xdc2a('0x79')]=_[_0xdc2a('0x7a')](_0x51128d[_0xdc2a('0x77')],_0x51128d['query']);_0x3d38da[_0xdc2a('0x7b')]=_[_0xdc2a('0x7a')](_0x51128d[_0xdc2a('0x77')],qs[_0xdc2a('0x7c')](_0x312848[_0xdc2a('0x2e')][_0xdc2a('0x7c')]));_0x3d38da[_0xdc2a('0x7b')]=_0x3d38da[_0xdc2a('0x7b')][_0xdc2a('0x30')]?_0x3d38da[_0xdc2a('0x7b')]:_0x51128d[_0xdc2a('0x77')];_0x3d38da[_0xdc2a('0x7d')]=qs[_0xdc2a('0x7e')](_0x312848[_0xdc2a('0x2e')][_0xdc2a('0x7e')]);_0x3d38da['where']=qs[_0xdc2a('0x79')](_['pick'](_0x312848[_0xdc2a('0x2e')],_0x51128d[_0xdc2a('0x79')]));if(_0x312848[_0xdc2a('0x2e')]['filter']){_0x3d38da[_0xdc2a('0x59')]=_[_0xdc2a('0x36')](_0x3d38da[_0xdc2a('0x59')],{'$or':_[_0xdc2a('0x67')](_0x3d38da[_0xdc2a('0x7b')],function(_0x35489d){var _0x225afd={};_0x225afd[_0x35489d]={'$like':'%'+_0x312848[_0xdc2a('0x2e')][_0xdc2a('0x7f')]+'%'};return _0x225afd;})});}_0x3d38da=_[_0xdc2a('0x36')]({},_0x3d38da,_0x312848['options']);return _0x630f8b[_0xdc2a('0x75')](_0x3d38da);}})['then'](function(_0x9c96f8){if(_0x9c96f8){_0x3be37f=_0x9c96f8[_0xdc2a('0x30')];if(!_0x312848[_0xdc2a('0x2e')]['hasOwnProperty'](_0xdc2a('0x80'))){_0x3d38da[_0xdc2a('0x17')]=qs[_0xdc2a('0x17')](_0x312848['query'][_0xdc2a('0x17')]);_0x3d38da[_0xdc2a('0x15')]=qs[_0xdc2a('0x15')](_0x312848['query']['offset']);}return _0x630f8b[_0xdc2a('0x75')](_0x3d38da);}})[_0xdc2a('0x1b')](function(_0x2bc40d){if(_0x2bc40d){return _0x2bc40d?{'count':_0x3be37f,'rows':_0x2bc40d}:null;}})[_0xdc2a('0x1b')](respondWithResult(_0x49b669,null))[_0xdc2a('0x24')](handleError(_0x49b669,null));};exports[_0xdc2a('0x81')]=function(_0x38b9ee,_0x3e81d0){if(_0x38b9ee['body']['id']){delete _0x38b9ee[_0xdc2a('0x37')]['id'];}return db[_0xdc2a('0x26')][_0xdc2a('0x76')]({'where':{'id':_0x38b9ee['params']['id']}})[_0xdc2a('0x1b')](handleEntityNotFound(_0x3e81d0,null))[_0xdc2a('0x1b')](function(_0x315cb4){if(_0x315cb4){return _0x315cb4[_0xdc2a('0x81')](_0x38b9ee[_0xdc2a('0x37')][_0xdc2a('0x82')]||[]);}return null;})[_0xdc2a('0x1b')](respondWithResult(_0x3e81d0,null))['catch'](handleError(_0x3e81d0,null));};exports[_0xdc2a('0x83')]=function(_0x388d5f,_0x272005){var _0x54c4a3=[];_0x54c4a3[_0xdc2a('0x5e')](addAdditionalPhones(_0x388d5f[_0xdc2a('0x37')]));Promise[_0xdc2a('0x60')](_0x54c4a3)['then'](function(){_0x54c4a3=[];_0x54c4a3[_0xdc2a('0x5e')](deleteCmHopperPhones(_0x388d5f[_0xdc2a('0x37')]['id']));_0x54c4a3[_0xdc2a('0x5e')](addCmHopperPhones(_0x388d5f[_0xdc2a('0x37')]['id']));Promise['all'](_0x54c4a3)[_0xdc2a('0x1b')](function(){return[0x1];})[_0xdc2a('0x1b')](respondWithResult(_0x272005,null));});};function addAdditionalPhones(_0x3f78a2){var _0x1e05df;return new Promise(function(_0x46f7f6){return db[_0xdc2a('0x4a')][_0xdc2a('0x25')]({'where':{'CmContactId':_0x3f78a2['id']}})['then'](function(){db[_0xdc2a('0x63')][_0xdc2a('0x22')]({'raw':!![],'attributes':['id',_0xdc2a('0x84')]})[_0xdc2a('0x1b')](function(_0x252f20){var _0x489aae=[];for(var _0x52a5f2=0x0;_0x52a5f2<_0x3f78a2[_0xdc2a('0x85')][_0xdc2a('0x30')];_0x52a5f2++){var _0x307119=_0x3f78a2[_0xdc2a('0x86')]?_[_0xdc2a('0x52')](_0x3f78a2['item_types'][_0x52a5f2])?'':_0x3f78a2[_0xdc2a('0x86')][_0x52a5f2]:_0x3f78a2['items'][_0x52a5f2][_0xdc2a('0x87')]?_0x3f78a2[_0xdc2a('0x85')][_0x52a5f2]['ItemTypeId']:'';var _0x466251=_[_0xdc2a('0x52')](_0x3f78a2[_0xdc2a('0x85')][_0x52a5f2][_0xdc2a('0x88')])?'':_0x3f78a2['items'][_0x52a5f2][_0xdc2a('0x88')];var _0x590e65=_0x307119+':'+_0x3f78a2['items'][_0x52a5f2][_0xdc2a('0x74')]+'§'+_0x466251;if(_[_0xdc2a('0x52')](_0x1e05df))_0x1e05df=_0x590e65;else _0x1e05df+=';'+_0x590e65;var _0x34445b=null;var _0x48d3bc=null;if(_0x3f78a2[_0xdc2a('0x86')]){if(!_[_0xdc2a('0x52')](_0x3f78a2[_0xdc2a('0x86')][_0x52a5f2])){_0x48d3bc=_[_0xdc2a('0x27')](_0x252f20,function(_0x4b811a){return _0x4b811a['id']===_0x3f78a2[_0xdc2a('0x86')][_0x52a5f2];});if(!_[_0xdc2a('0x52')](_0x48d3bc)){_0x34445b=_0x48d3bc[_0xdc2a('0x84')];}}}else{if(!_[_0xdc2a('0x52')](_0x3f78a2[_0xdc2a('0x85')][_0x52a5f2])){_0x48d3bc=_[_0xdc2a('0x27')](_0x252f20,function(_0x4b9185){return _0x4b9185['id']===_0x3f78a2[_0xdc2a('0x85')][_0x52a5f2][_0xdc2a('0x87')];});if(!_[_0xdc2a('0x52')](_0x48d3bc)){_0x34445b=_0x52a5f2;}}}if(_[_0xdc2a('0x52')](_0x34445b)){_0x34445b=0x64;}_0x489aae['push'](addAdditionalPhone(_0x3f78a2['id'],_0x3f78a2[_0xdc2a('0x85')][_0x52a5f2][_0xdc2a('0x74')],_0x3f78a2['item_types']?_['isNil'](_0x3f78a2[_0xdc2a('0x86')][_0x52a5f2])?null:_0x3f78a2[_0xdc2a('0x86')][_0x52a5f2]:_0x3f78a2[_0xdc2a('0x85')][_0x52a5f2][_0xdc2a('0x87')]?_0x3f78a2[_0xdc2a('0x85')][_0x52a5f2][_0xdc2a('0x87')]:null,_0x34445b,_0x466251));}Promise['all'](_0x489aae)[_0xdc2a('0x1b')](function(){db[_0xdc2a('0x26')][_0xdc2a('0x1a')]({'AdditionalPhones':_0x1e05df},{'where':{'id':_0x3f78a2['id']}})['then'](function(){_0x46f7f6(0x1);});});});});});}function addAdditionalPhone(_0x1dc22f,_0x86794f,_0x46eac4,_0x2ec6cb,_0x18f5dd){return db['CmContactHasItem'][_0xdc2a('0x27')]({'where':{'CmContactId':_0x1dc22f,'item':_0x86794f}})[_0xdc2a('0x1b')](function(_0x2803db){if(_0x2803db)logger[_0xdc2a('0x34')]('contact\x20phone\x20exists',_0x2803db);else{db['CmContactHasItem'][_0xdc2a('0x89')]({'CmContactId':_0x1dc22f,'item':_0x86794f,'ItemTypeId':_0x46eac4,'OrderBy':_0x2ec6cb,'ItemClass':_0xdc2a('0x8a'),'description':_0x18f5dd});}});}function deleteCmHopperPhones(_0x589d2b){return new Promise(function(_0x39bdeb){return db[_0xdc2a('0x3c')][_0xdc2a('0x22')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x589d2b}})[_0xdc2a('0x1b')](function(_0x502c94){db['CmHopperAdditionalPhone'][_0xdc2a('0x25')]({'where':{'CmHopperId':{'$in':_[_0xdc2a('0x67')](_0x502c94,'id')}}});})['then'](function(){_0x39bdeb(0x1);});});}function addCmHopperPhones(_0x3414e8){return new Promise(function(_0x304d49){return db[_0xdc2a('0x3c')][_0xdc2a('0x22')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3414e8}})[_0xdc2a('0x1b')](function(_0x256f4d){var _0x22fe25=[];_[_0xdc2a('0x67')](_0x256f4d,function(_0xdb85e2){_0x22fe25[_0xdc2a('0x5e')](createCmHopperPhone(_0x3414e8,_0xdb85e2['id']));});Promise[_0xdc2a('0x60')](_0x22fe25)[_0xdc2a('0x1b')](function(){_0x304d49(0x1);});});});}function createCmHopperPhone(_0x33722,_0x60e52c){return new Promise(function(_0x4e4265){db[_0xdc2a('0x4a')][_0xdc2a('0x22')]({'raw':!![],'attributes':[_0xdc2a('0x8b'),_0xdc2a('0x84')],'where':{'CmContactId':_0x33722,'ItemClass':_0xdc2a('0x8a')},'include':[{'model':db[_0xdc2a('0x63')],'attributes':['OrderBy'],'as':_0xdc2a('0x8c')}],'order':[_0xdc2a('0x84'),db[_0xdc2a('0x72')][_0xdc2a('0x64')](_0xdc2a('0x8d'))]})[_0xdc2a('0x1b')](function(_0x2e9a79){var _0x176039=0x1;var _0x1d2b95=_[_0xdc2a('0x67')](_0x2e9a79,function(_0x410d77){_0x410d77[_0xdc2a('0x8e')]=_0x60e52c;_0x410d77[_0xdc2a('0x74')]=_0x410d77[_0xdc2a('0x8b')];_0x410d77[_0xdc2a('0x84')]=_0x176039;delete _0x410d77['ItemType.OrderBy'];_0x176039=_0x176039+0x1;return _0x410d77;});return db[_0xdc2a('0x8f')][_0xdc2a('0x56')](_0x1d2b95,{});})[_0xdc2a('0x1b')](function(){_0x4e4265(0x1);});});}function insertAdditionalPhones(_0xf73697,_0x3b5dad){return new Promise(function(_0x4b3119){var _0x88dd6=[];for(var _0x4418e6=0x0;_0x4418e6<_0x3b5dad[_0xdc2a('0x30')];_0x4418e6++){var _0x362fe7=_0x3b5dad[_0x4418e6];_0x88dd6[_0xdc2a('0x5e')](parseContactItemType(_0x362fe7));}Promise[_0xdc2a('0x60')](_0x88dd6)['then'](function(){var _0x1f7009={'id':_0xf73697['id'],'items':_0x3b5dad};return addAdditionalPhones(_0x1f7009)[_0xdc2a('0x1b')](function(){return addCmHopperPhones(_0xf73697['id']);});})[_0xdc2a('0x1b')](function(){_0x4b3119(_0xf73697);});});}function parseContactItemType(_0x4026ad){return new Promise(function(_0x43f044){if(_0x4026ad[_0xdc2a('0x35')](_0xdc2a('0x87'))){_0x43f044(_0x4026ad);}else{return db[_0xdc2a('0x63')][_0xdc2a('0x27')]({'where':{'name':_0x4026ad[_0xdc2a('0x8c')]}})[_0xdc2a('0x1b')](function(_0x578836){if(_['isNil'](_0x578836))_0x4026ad[_0xdc2a('0x87')]=null;else _0x4026ad[_0xdc2a('0x87')]=_0x578836['id'];_0x43f044(_0x4026ad);});}});}exports[_0xdc2a('0x90')]=function(_0x82dc7c,_0x3b4d96){return db[_0xdc2a('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x82dc7c[_0xdc2a('0x28')]['id'],'ItemClass':_0xdc2a('0x8a')},'include':[{'model':db['ContactItemType'],'as':_0xdc2a('0x8c')}],'order':[[_0xdc2a('0x84')],[db[_0xdc2a('0x72')][_0xdc2a('0x64')]('`ItemType`.OrderBy')]]})['then'](function(_0x154116){return _0x154116;})[_0xdc2a('0x1b')](respondWithResult(_0x3b4d96,null))[_0xdc2a('0x24')](handleError(_0x3b4d96,null));};exports[_0xdc2a('0x91')]=function(_0x97b14e,_0x1cbee1){return db['CmContactHasItem'][_0xdc2a('0x22')]({'raw':!![],'where':{'CmContactId':_0x97b14e[_0xdc2a('0x37')]['fromContactId']}})[_0xdc2a('0x1b')](function(_0x581a05){var _0x4322cc=_[_0xdc2a('0x67')](_0x581a05,function(_0x5d10f0){_0x5d10f0[_0xdc2a('0x92')]=_0x97b14e[_0xdc2a('0x37')][_0xdc2a('0x93')];return _0x5d10f0;});return db[_0xdc2a('0x4a')][_0xdc2a('0x56')](_0x4322cc,{});})[_0xdc2a('0x1b')](function(){return addCmHopperPhones(_0x97b14e['body'][_0xdc2a('0x93')]);})['then'](function(){return['ok'];})[_0xdc2a('0x1b')](respondWithResult(_0x1cbee1,null))[_0xdc2a('0x24')](handleError(_0x1cbee1,null));};exports['rescheduleAdditionalPhones']=function(_0x210b15,_0x5af04c){var _0x365a07=[];_0x365a07[_0xdc2a('0x5e')](createCmHopperPhone(_0x210b15[_0xdc2a('0x37')]['id'],_0x210b15['body'][_0xdc2a('0x94')]));Promise[_0xdc2a('0x60')](_0x365a07)[_0xdc2a('0x1b')](function(){return[0x1];})[_0xdc2a('0x1b')](respondWithResult(_0x5af04c,null));};exports[_0xdc2a('0x95')]=function(_0x488139,_0x4fb47c){var _0x401651={'raw':![],'where':{}};var _0x3dba07={};var _0x5e11a5={'count':0x0,'rows':[]};return db['CmContact'][_0xdc2a('0x76')]({'where':{'id':_0x488139['params']['id']}})[_0xdc2a('0x1b')](handleEntityNotFound(_0x4fb47c,null))[_0xdc2a('0x1b')](function(_0x142ff5){if(_0x142ff5){_0x3dba07[_0xdc2a('0x77')]=_[_0xdc2a('0x2a')](db['CmHopper'][_0xdc2a('0x78')]);_0x3dba07[_0xdc2a('0x2e')]=_['keys'](_0x488139['query']);_0x3dba07[_0xdc2a('0x79')]=_[_0xdc2a('0x7a')](_0x3dba07[_0xdc2a('0x77')],_0x3dba07['query']);_0x401651[_0xdc2a('0x7b')]=_[_0xdc2a('0x7a')](_0x3dba07[_0xdc2a('0x77')],qs[_0xdc2a('0x7c')](_0x488139[_0xdc2a('0x2e')][_0xdc2a('0x7c')]));_0x401651[_0xdc2a('0x7b')]=_0x401651[_0xdc2a('0x7b')]['length']?_0x401651[_0xdc2a('0x7b')]:_0x3dba07[_0xdc2a('0x77')];if(!_0x488139['query']['hasOwnProperty'](_0xdc2a('0x80'))){_0x401651[_0xdc2a('0x17')]=qs[_0xdc2a('0x17')](_0x488139['query'][_0xdc2a('0x17')]);_0x401651[_0xdc2a('0x15')]=qs[_0xdc2a('0x15')](_0x488139[_0xdc2a('0x2e')][_0xdc2a('0x15')]);}_0x401651['order']=qs[_0xdc2a('0x7e')](_0x488139[_0xdc2a('0x2e')][_0xdc2a('0x7e')]);_0x401651[_0xdc2a('0x59')]=qs[_0xdc2a('0x79')](_[_0xdc2a('0x96')](_0x488139[_0xdc2a('0x2e')],_0x3dba07[_0xdc2a('0x79')]));_0x401651[_0xdc2a('0x59')][_0xdc2a('0x97')]=_0x142ff5['id'];if(_0x488139[_0xdc2a('0x2e')][_0xdc2a('0x7f')]){_0x401651[_0xdc2a('0x59')]=_[_0xdc2a('0x36')](_0x401651['where'],{'$or':_[_0xdc2a('0x67')](_0x401651[_0xdc2a('0x7b')],function(_0x1605d6){var _0x2e9381={};_0x2e9381[_0x1605d6]={'$like':'%'+_0x488139[_0xdc2a('0x2e')]['filter']+'%'};return _0x2e9381;})});}_0x401651=_[_0xdc2a('0x36')]({},_0x401651,_0x488139[_0xdc2a('0x98')]);return db[_0xdc2a('0x3c')]['count']({'where':_0x401651[_0xdc2a('0x59')]})['then'](function(_0x1dfe8c){_0x5e11a5[_0xdc2a('0x18')]=_0x1dfe8c;if(_0x488139[_0xdc2a('0x2e')][_0xdc2a('0x99')]){_0x401651[_0xdc2a('0x9a')]=[{'all':!![]}];}return db['CmHopper'][_0xdc2a('0x22')](_0x401651);})[_0xdc2a('0x1b')](function(_0xc1302b){_0x5e11a5[_0xdc2a('0x9b')]=_0xc1302b;return _0x5e11a5;});}})[_0xdc2a('0x1b')](respondWithFilteredResult(_0x4fb47c,_0x401651))[_0xdc2a('0x24')](handleError(_0x4fb47c,null));};exports['getHopperHistories']=function(_0x24ce87,_0x148738){var _0x334973={'raw':!![],'where':{}};var _0x2765aa={};var _0x2a5eb9={'count':0x0,'rows':[]};return db[_0xdc2a('0x26')]['findOne']({'where':{'id':_0x24ce87[_0xdc2a('0x28')]['id']}})[_0xdc2a('0x1b')](handleEntityNotFound(_0x148738,null))[_0xdc2a('0x1b')](function(_0x45d3bb){if(_0x45d3bb){_0x2765aa[_0xdc2a('0x77')]=_['keys'](db[_0xdc2a('0x9c')][_0xdc2a('0x78')]);_0x2765aa[_0xdc2a('0x2e')]=_[_0xdc2a('0x2a')](_0x24ce87[_0xdc2a('0x2e')]);_0x2765aa[_0xdc2a('0x79')]=_[_0xdc2a('0x7a')](_0x2765aa['model'],_0x2765aa[_0xdc2a('0x2e')]);_0x334973['attributes']=_['intersection'](_0x2765aa[_0xdc2a('0x77')],qs[_0xdc2a('0x7c')](_0x24ce87[_0xdc2a('0x2e')][_0xdc2a('0x7c')]));_0x334973[_0xdc2a('0x7b')]=_0x334973[_0xdc2a('0x7b')][_0xdc2a('0x30')]?_0x334973[_0xdc2a('0x7b')]:_0x2765aa[_0xdc2a('0x77')];if(!_0x24ce87['query']['hasOwnProperty'](_0xdc2a('0x80'))){_0x334973['limit']=qs['limit'](_0x24ce87[_0xdc2a('0x2e')][_0xdc2a('0x17')]);_0x334973['offset']=qs['offset'](_0x24ce87['query'][_0xdc2a('0x15')]);}_0x334973['order']=qs[_0xdc2a('0x7e')](_0x24ce87['query'][_0xdc2a('0x7e')]);_0x334973[_0xdc2a('0x59')]=qs[_0xdc2a('0x79')](_[_0xdc2a('0x96')](_0x24ce87[_0xdc2a('0x2e')],_0x2765aa[_0xdc2a('0x79')]));_0x334973[_0xdc2a('0x59')][_0xdc2a('0x97')]=_0x45d3bb['id'];if(_0x24ce87[_0xdc2a('0x2e')][_0xdc2a('0x7f')]){_0x334973['where']=_[_0xdc2a('0x36')](_0x334973['where'],{'$or':_['map'](_0x334973[_0xdc2a('0x7b')],function(_0x4df2a1){var _0xa5f3ff={};_0xa5f3ff[_0x4df2a1]={'$like':'%'+_0x24ce87[_0xdc2a('0x2e')][_0xdc2a('0x7f')]+'%'};return _0xa5f3ff;})});}_0x334973=_[_0xdc2a('0x36')]({},_0x334973,_0x24ce87[_0xdc2a('0x98')]);return db['CmHopperHistory'][_0xdc2a('0x18')]({'where':_0x334973[_0xdc2a('0x59')]})['then'](function(_0x35dc87){_0x2a5eb9[_0xdc2a('0x18')]=_0x35dc87;if(_0x24ce87['query'][_0xdc2a('0x99')]){_0x334973[_0xdc2a('0x9a')]=[{'all':!![]}];}return db[_0xdc2a('0x9c')][_0xdc2a('0x22')](_0x334973);})[_0xdc2a('0x1b')](function(_0x558352){_0x2a5eb9[_0xdc2a('0x9b')]=_0x558352;return _0x2a5eb9;});}})[_0xdc2a('0x1b')](respondWithFilteredResult(_0x148738,_0x334973))[_0xdc2a('0x24')](handleError(_0x148738,null));};exports[_0xdc2a('0x9d')]=function(_0x4f692c,_0x3029dd){var _0x274e87={'raw':!![],'where':{}};var _0x4ee992={};var _0x5658e0={'count':0x0,'rows':[]};return db[_0xdc2a('0x26')]['findOne']({'where':{'id':_0x4f692c[_0xdc2a('0x28')]['id']}})['then'](handleEntityNotFound(_0x3029dd,null))[_0xdc2a('0x1b')](function(_0x38ded2){if(_0x38ded2){_0x4ee992[_0xdc2a('0x77')]=_['keys'](db[_0xdc2a('0x4b')]['rawAttributes']);_0x4ee992[_0xdc2a('0x2e')]=_[_0xdc2a('0x2a')](_0x4f692c[_0xdc2a('0x2e')]);_0x4ee992[_0xdc2a('0x79')]=_[_0xdc2a('0x7a')](_0x4ee992[_0xdc2a('0x77')],_0x4ee992[_0xdc2a('0x2e')]);_0x274e87['attributes']=_['intersection'](_0x4ee992['model'],qs[_0xdc2a('0x7c')](_0x4f692c[_0xdc2a('0x2e')]['fields']));_0x274e87[_0xdc2a('0x7b')]=_0x274e87[_0xdc2a('0x7b')]['length']?_0x274e87[_0xdc2a('0x7b')]:_0x4ee992[_0xdc2a('0x77')];if(!_0x4f692c[_0xdc2a('0x2e')][_0xdc2a('0x35')](_0xdc2a('0x80'))){_0x274e87[_0xdc2a('0x17')]=qs[_0xdc2a('0x17')](_0x4f692c['query'][_0xdc2a('0x17')]);_0x274e87[_0xdc2a('0x15')]=qs[_0xdc2a('0x15')](_0x4f692c['query'][_0xdc2a('0x15')]);}_0x274e87[_0xdc2a('0x7d')]=qs['sort'](_0x4f692c[_0xdc2a('0x2e')][_0xdc2a('0x7e')]);_0x274e87[_0xdc2a('0x59')]=qs[_0xdc2a('0x79')](_[_0xdc2a('0x96')](_0x4f692c[_0xdc2a('0x2e')],_0x4ee992[_0xdc2a('0x79')]));_0x274e87[_0xdc2a('0x59')][_0xdc2a('0x97')]=_0x38ded2['id'];if(_0x4f692c[_0xdc2a('0x2e')]['filter']){_0x274e87['where']=_[_0xdc2a('0x36')](_0x274e87[_0xdc2a('0x59')],{'$or':_['map'](_0x274e87[_0xdc2a('0x7b')],function(_0x51657a){var _0x127142={};_0x127142[_0x51657a]={'$like':'%'+_0x4f692c[_0xdc2a('0x2e')]['filter']+'%'};return _0x127142;})});}_0x274e87=_[_0xdc2a('0x36')]({},_0x274e87,_0x4f692c['options']);return db['CmHopperFinal'][_0xdc2a('0x18')]({'where':_0x274e87[_0xdc2a('0x59')]})[_0xdc2a('0x1b')](function(_0x5e7dab){_0x5658e0[_0xdc2a('0x18')]=_0x5e7dab;if(_0x4f692c[_0xdc2a('0x2e')][_0xdc2a('0x99')]){_0x274e87[_0xdc2a('0x9a')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xdc2a('0x22')](_0x274e87);})['then'](function(_0x496b54){_0x5658e0[_0xdc2a('0x9b')]=_0x496b54;return _0x5658e0;});}})[_0xdc2a('0x1b')](respondWithFilteredResult(_0x3029dd,_0x274e87))[_0xdc2a('0x24')](handleError(_0x3029dd,null));};exports[_0xdc2a('0x9e')]=function(_0x46d451,_0x5f449a){var _0x261d33={'raw':!![],'where':{}};var _0x900e1c={};var _0x37f36e={'count':0x0,'rows':[]};return db[_0xdc2a('0x26')][_0xdc2a('0x76')]({'where':{'id':_0x46d451['params']['id']}})[_0xdc2a('0x1b')](handleEntityNotFound(_0x5f449a,null))[_0xdc2a('0x1b')](function(_0x190865){if(_0x190865){_0x900e1c[_0xdc2a('0x77')]=_[_0xdc2a('0x2a')](db[_0xdc2a('0x50')][_0xdc2a('0x78')]);_0x900e1c[_0xdc2a('0x2e')]=_[_0xdc2a('0x2a')](_0x46d451[_0xdc2a('0x2e')]);_0x900e1c[_0xdc2a('0x79')]=_['intersection'](_0x900e1c['model'],_0x900e1c[_0xdc2a('0x2e')]);_0x261d33['attributes']=_[_0xdc2a('0x7a')](_0x900e1c[_0xdc2a('0x77')],qs[_0xdc2a('0x7c')](_0x46d451[_0xdc2a('0x2e')][_0xdc2a('0x7c')]));_0x261d33[_0xdc2a('0x7b')]=_0x261d33[_0xdc2a('0x7b')]['length']?_0x261d33[_0xdc2a('0x7b')]:_0x900e1c['model'];if(!_0x46d451[_0xdc2a('0x2e')][_0xdc2a('0x35')](_0xdc2a('0x80'))){_0x261d33['limit']=qs[_0xdc2a('0x17')](_0x46d451[_0xdc2a('0x2e')][_0xdc2a('0x17')]);_0x261d33[_0xdc2a('0x15')]=qs[_0xdc2a('0x15')](_0x46d451[_0xdc2a('0x2e')][_0xdc2a('0x15')]);}_0x261d33['order']=qs[_0xdc2a('0x7e')](_0x46d451['query']['sort']);_0x261d33[_0xdc2a('0x59')]=qs[_0xdc2a('0x79')](_['pick'](_0x46d451[_0xdc2a('0x2e')],_0x900e1c[_0xdc2a('0x79')]));_0x261d33[_0xdc2a('0x59')][_0xdc2a('0x97')]=_0x190865['id'];if(_0x46d451['query']['filter']){_0x261d33['where']=_[_0xdc2a('0x36')](_0x261d33[_0xdc2a('0x59')],{'$or':_[_0xdc2a('0x67')](_0x261d33['attributes'],function(_0x5d1cc3){var _0x18ee3a={};_0x18ee3a[_0x5d1cc3]={'$like':'%'+_0x46d451[_0xdc2a('0x2e')][_0xdc2a('0x7f')]+'%'};return _0x18ee3a;})});}_0x261d33=_[_0xdc2a('0x36')]({},_0x261d33,_0x46d451[_0xdc2a('0x98')]);return db[_0xdc2a('0x50')][_0xdc2a('0x18')]({'where':_0x261d33[_0xdc2a('0x59')]})[_0xdc2a('0x1b')](function(_0x4c5aeb){_0x37f36e[_0xdc2a('0x18')]=_0x4c5aeb;if(_0x46d451[_0xdc2a('0x2e')][_0xdc2a('0x99')]){_0x261d33[_0xdc2a('0x9a')]=[{'all':!![]}];}return db[_0xdc2a('0x50')][_0xdc2a('0x22')](_0x261d33);})[_0xdc2a('0x1b')](function(_0x3229e0){_0x37f36e[_0xdc2a('0x9b')]=_0x3229e0;return _0x37f36e;});}})[_0xdc2a('0x1b')](respondWithFilteredResult(_0x5f449a,_0x261d33))[_0xdc2a('0x24')](handleError(_0x5f449a,null));};exports[_0xdc2a('0x9f')]=function(_0x1e2a4c,_0x3b907d){try{if(!_0x1e2a4c[_0xdc2a('0x37')][_0xdc2a('0x5b')]){throw new Error('No\x20ListId\x20specified');}if(!_0x1e2a4c['body'][_0xdc2a('0xa0')]){throw new Error(_0xdc2a('0xa1'));}if(!_0x1e2a4c[_0xdc2a('0x37')][_0xdc2a('0xa2')]){throw new Error(_0xdc2a('0xa3'));}if(!_0x1e2a4c['body'][_0xdc2a('0xa4')]){throw new Error(_0xdc2a('0xa5'));}var _0x9d09db=_0x1e2a4c['body'][_0xdc2a('0xa0')]['split'](',');var _0x47d8a5=_0x1e2a4c[_0xdc2a('0x37')][_0xdc2a('0xa2')][_0xdc2a('0xa6')](',');if(!_0x9d09db[_0xdc2a('0x30')]||!_0x47d8a5[_0xdc2a('0x30')]||_0x9d09db[_0xdc2a('0x30')]!==_0x47d8a5[_0xdc2a('0x30')]){throw new Error(_0xdc2a('0xa7'));}_0x1e2a4c['body'][_0xdc2a('0x7c')]=_[_0xdc2a('0xa8')](_0x9d09db,_0x47d8a5);if(!_0x1e2a4c[_0xdc2a('0x37')]['fields'][_0xdc2a('0x74')]){throw new Error(_0xdc2a('0xa9'));}if(!_0x1e2a4c[_0xdc2a('0x37')][_0xdc2a('0x7c')][_0xdc2a('0xaa')]){throw new Error(_0xdc2a('0xab'));}var _0x308910=path[_0xdc2a('0x3b')](config[_0xdc2a('0xac')],'server/files/tmp',_0x1e2a4c['file'][_0xdc2a('0xad')]);fs[_0xdc2a('0xae')](_0x308910,parseInt(_0xdc2a('0xaf'),0x8));var _0x4b2bee=require(_0xdc2a('0xb0'))[_0xdc2a('0xb1')](path[_0xdc2a('0x3b')](__dirname,_0xdc2a('0xb2')),[_0x308910,_0x1e2a4c[_0xdc2a('0x37')][_0xdc2a('0xa0')],_0x1e2a4c[_0xdc2a('0x37')][_0xdc2a('0xa2')],_0x1e2a4c[_0xdc2a('0x37')][_0xdc2a('0x5b')],_0x1e2a4c[_0xdc2a('0x37')][_0xdc2a('0xb3')],_0x1e2a4c[_0xdc2a('0x37')]['duplicates'],_0x1e2a4c[_0xdc2a('0x37')][_0xdc2a('0xa4')]]);return _0x3b907d[_0xdc2a('0x1c')](0xc8)['json']({'message':_0xdc2a('0xb4'),'pid':_0x4b2bee[_0xdc2a('0xb5')]});}catch(_0x621830){return _0x3b907d[_0xdc2a('0x1c')](0x1f4)[_0xdc2a('0xb6')](_0x621830);}};exports[_0xdc2a('0xb7')]=function(_0x39a981,_0x49507d){var _0x52ca70=fs[_0xdc2a('0xb8')](_0x39a981[_0xdc2a('0xb9')][_0xdc2a('0x3')]);Papa[_0xdc2a('0xba')](_0x52ca70,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0xe6b1a3){return _0x49507d[_0xdc2a('0x1c')](0xc8)['json']({'file':_0x39a981[_0xdc2a('0xb9')],'fields':_0xe6b1a3[_0xdc2a('0xbb')][_0xdc2a('0x7c')]});}});};exports[_0xdc2a('0xbc')]=function(_0x4afa6c,_0x26afce){return db[_0xdc2a('0xbd')][_0xdc2a('0x22')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0xdc2a('0x1b')](function(_0x1c5cc7){var _0x30c660=![];if(!_0x4afa6c[_0xdc2a('0x37')]['ListId']){throw new Error(_0xdc2a('0xbe'));}if(!_0x4afa6c[_0xdc2a('0x37')][_0xdc2a('0xbf')][_0xdc2a('0x74')]){throw new Error(_0xdc2a('0xa9'));}if(!_0x4afa6c[_0xdc2a('0x37')][_0xdc2a('0xbf')]['firstName']){throw new Error(_0xdc2a('0xab'));}if(!_0x4afa6c[_0xdc2a('0x37')]['socket_timestamp']){throw new Error(_0xdc2a('0xa5'));}var _0x45a68e=require(_0xdc2a('0xb0'))[_0xdc2a('0xb1')](path[_0xdc2a('0x3b')](__dirname,_0xdc2a('0xc0')),[_0x4afa6c[_0xdc2a('0x28')]['id'],JSON['stringify'](_0x4afa6c[_0xdc2a('0x37')]),JSON[_0xdc2a('0xc1')](_0x1c5cc7)]);_0x45a68e['on'](_0xdc2a('0xc2'),function(){_0x30c660=!![];return _0x26afce[_0xdc2a('0x1c')](0xc8)['json']({'message':_0xdc2a('0xc3'),'pid':_0x45a68e[_0xdc2a('0xb5')]});});_0x45a68e['on']('exit',function(_0x3b82fb){if(_0x3b82fb&&!_0x30c660){return _0x26afce[_0xdc2a('0x1c')](0x1f4)[_0xdc2a('0x14')]({'message':_0xdc2a('0xc4'),'pid':_0x45a68e['pid']});}});})[_0xdc2a('0x24')](handleError(_0x26afce,null));};exports[_0xdc2a('0xc5')]=function(_0x19d841,_0x63b318){return db[_0xdc2a('0xbd')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xdc2a('0xc6')}})[_0xdc2a('0x1b')](function(_0x32b6f0){var _0x9ec3f8=![];if(!_0x19d841[_0xdc2a('0x37')][_0xdc2a('0x5b')]){throw new Error(_0xdc2a('0xbe'));}if(!_0x19d841[_0xdc2a('0x37')][_0xdc2a('0xbf')][_0xdc2a('0x74')]){throw new Error(_0xdc2a('0xa9'));}if(!_0x19d841[_0xdc2a('0x37')][_0xdc2a('0xbf')][_0xdc2a('0xaa')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x19d841[_0xdc2a('0x37')][_0xdc2a('0xa4')]){throw new Error(_0xdc2a('0xa5'));}var _0x16f373=require(_0xdc2a('0xb0'))[_0xdc2a('0xb1')](path['join'](__dirname,_0xdc2a('0xc7')),[_0x19d841[_0xdc2a('0x28')]['id'],JSON[_0xdc2a('0xc1')](_0x19d841[_0xdc2a('0x37')]),JSON[_0xdc2a('0xc1')](_0x32b6f0)]);_0x16f373['on'](_0xdc2a('0xc2'),function(){_0x9ec3f8=!![];return _0x63b318[_0xdc2a('0x1c')](0xc8)[_0xdc2a('0x14')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x16f373[_0xdc2a('0xb5')]});});_0x16f373['on']('exit',function(_0x3ac450){if(_0x3ac450&&!_0x9ec3f8){return _0x63b318[_0xdc2a('0x1c')](0x1f4)[_0xdc2a('0x14')]({'message':_0xdc2a('0xc4'),'pid':_0x16f373[_0xdc2a('0xb5')]});}});})[_0xdc2a('0x24')](handleError(_0x63b318,null));};exports['getJourney']=function(_0x5179c7,_0x336a6c){var _0x4ab22b=[_0xdc2a('0xc8'),_0xdc2a('0xc9'),_0xdc2a('0xca'),_0xdc2a('0xcb'),'fax','whatsapp',_0xdc2a('0xcc')];var _0x10d76f={'offset':0x0,'order':qs[_0xdc2a('0x7e')](_0xdc2a('0xcd'))},_0x488329={'count':0x0,'rows':[]};Promise['resolve']()['then'](function(){if(_0x5179c7[_0xdc2a('0x2e')][_0xdc2a('0xce')]){if(!_['includes'](_0x4ab22b,_0x5179c7[_0xdc2a('0x2e')]['channel'][_0xdc2a('0xcf')]())){throw new Error(_0xdc2a('0xd0'));}_0x4ab22b=[_0x5179c7[_0xdc2a('0x2e')][_0xdc2a('0xce')][_0xdc2a('0xcf')]()];}if(_0x5179c7[_0xdc2a('0x2e')][_0xdc2a('0xd1')]){try{var _0x3e3b26=JSON[_0xdc2a('0xba')](_0x5179c7[_0xdc2a('0x2e')][_0xdc2a('0xd1')]);if(!moment(_0x3e3b26['from'])[_0xdc2a('0xd2')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x3e3b26['to'])['isValid']()){throw new Error(_0xdc2a('0xd3'));}}catch(_0x42a407){throw new Error(_0xdc2a('0xd4'));}}if(!_0x5179c7[_0xdc2a('0x2e')][_0xdc2a('0x35')](_0xdc2a('0x80'))){_0x10d76f[_0xdc2a('0x17')]=qs['limit'](_0x5179c7[_0xdc2a('0x2e')][_0xdc2a('0x17')]||0xa);_0x10d76f[_0xdc2a('0x15')]=qs[_0xdc2a('0x15')](_0x5179c7[_0xdc2a('0x2e')]['offset']);}var _0x47f864=_0x4ab22b[_0xdc2a('0x67')](function(_0x27c000){if(_0x27c000===_0xdc2a('0xcc')){var _0x36c1ad={'attributes':['id',_0xdc2a('0xd5'),_0xdc2a('0x32'),_0xdc2a('0xd6'),'destination',_0xdc2a('0xd7'),'starttime',_0xdc2a('0xd8'),_0xdc2a('0xd9'),_0xdc2a('0xda'),_0xdc2a('0xdb'),_0xdc2a('0xdc'),_0xdc2a('0xdd'),'userThirdDisposition',_0xdc2a('0xde')],'where':{'ContactId':_0x5179c7['params']['id']},'include':[{'model':db[_0xdc2a('0xbd')],'as':_0xdc2a('0xbd'),'attributes':['id',_0xdc2a('0x1e'),'fullname','alias']}],'order':[[_0xdc2a('0xdb'),_0xdc2a('0xdf')]]};if(_0x5179c7[_0xdc2a('0x2e')][_0xdc2a('0xd1')]){_0x36c1ad[_0xdc2a('0x59')][_0xdc2a('0xdb')]={'$gte':_0x3e3b26['from'],'$lte':_0x3e3b26['to']};}return db['VoiceCallReport'][_0xdc2a('0xe0')](_0x36c1ad)[_0xdc2a('0x1b')](function(_0xd0575b){_0x488329[_0xdc2a('0x18')]+=_0xd0575b[_0xdc2a('0x18')];return _[_0xdc2a('0x67')](_0xd0575b[_0xdc2a('0x9b')],function(_0x4c1bc4){var _0x2903f4=_0x4c1bc4['get']({'plain':!![]});_0x2903f4[_0xdc2a('0xce')]=_0x27c000;if(_0x2903f4[_0xdc2a('0xbd')]){_0x2903f4['User']={'id':_0x2903f4[_0xdc2a('0xbd')]['id'],'name':_0x2903f4['User'][_0xdc2a('0x1e')],'fullname':_0x2903f4[_0xdc2a('0xbd')][_0xdc2a('0xe1')],'alias':_0x2903f4[_0xdc2a('0xbd')]['alias']};}return _0x2903f4;});});}else{var _0x34c8ff=_[_0xdc2a('0xe2')](_0x27c000)+(_0x27c000==='chat'?_0xdc2a('0xe3'):_0xdc2a('0xe4'));var _0x2e5db1={'attributes':['id',_0xdc2a('0xe5'),_0xdc2a('0xe6'),_0xdc2a('0xdb'),_0xdc2a('0xda'),_0xdc2a('0xe7'),_0xdc2a('0xe8'),'thirdDisposition',_0xdc2a('0xde'),_0x34c8ff+'Id'],'where':{'ContactId':_0x5179c7[_0xdc2a('0x28')]['id']},'include':[{'model':db[_0x34c8ff],'as':_0xdc2a('0xe4'),'attributes':['id',_0xdc2a('0x1e'),_0xdc2a('0xe9')]},{'model':db[_0xdc2a('0xbd')],'as':'Owner','attributes':['id',_0xdc2a('0x1e'),_0xdc2a('0xe1')]},{'model':db['Tag'],'as':_0xdc2a('0xea'),'attributes':['id','name',_0xdc2a('0x62')],'through':{'attributes':[]}}],'order':[['createdAt',_0xdc2a('0xdf')]]};if(_0x5179c7['query']['range']){_0x2e5db1[_0xdc2a('0x59')][_0xdc2a('0xdb')]={'$gte':_0x3e3b26[_0xdc2a('0x38')],'$lte':_0x3e3b26['to']};}switch(_0x27c000){case _0xdc2a('0xc9'):_0x2e5db1[_0xdc2a('0x7b')][_0xdc2a('0x5e')]('browserName',_0xdc2a('0xeb'),'customerPort',_0xdc2a('0xec'),_0xdc2a('0xed'),_0xdc2a('0xee'),'ratingType',_0xdc2a('0xef'),_0xdc2a('0xf0'));break;case'mail':_0x2e5db1[_0xdc2a('0x7b')][_0xdc2a('0x5e')](_0xdc2a('0xf1'),_0xdc2a('0xf2'));break;case _0xdc2a('0xcb'):_0x2e5db1['attributes'][_0xdc2a('0x5e')](_0xdc2a('0xf3'),'threadId');break;}return db[_[_0xdc2a('0xe2')](_0x27c000)+_0xdc2a('0xf4')][_0xdc2a('0xe0')](_0x2e5db1)['then'](function(_0x5b242d){_0x488329[_0xdc2a('0x18')]+=_0x5b242d['count'];return _[_0xdc2a('0x67')](_0x5b242d['rows'],function(_0x434cad){var _0x337d6f=_0x434cad[_0xdc2a('0x39')]({'plain':!![]});_0x337d6f[_0xdc2a('0xce')]=_0x27c000;if(_0x337d6f[_0xdc2a('0xf5')]){_0x337d6f[_0xdc2a('0xf5')]={'id':_0x337d6f['Owner']['id'],'name':_0x337d6f[_0xdc2a('0xf5')][_0xdc2a('0x1e')],'fullname':_0x337d6f['Owner'][_0xdc2a('0xe1')]};}return _0x337d6f;});});}});return Promise[_0xdc2a('0x60')](_0x47f864);})[_0xdc2a('0x1b')](function(_0x597907){return _(_0x597907)[_0xdc2a('0xf6')]()[_0xdc2a('0xf7')]('createdAt')[_0xdc2a('0xf8')]()[_0xdc2a('0xf9')]();})['then'](function(_0x54b5c1){_0x488329[_0xdc2a('0x9b')]=_0x10d76f[_0xdc2a('0x17')]?_0x54b5c1[_0xdc2a('0xfa')](_0x10d76f[_0xdc2a('0x15')],_0x10d76f[_0xdc2a('0x15')]+_0x10d76f[_0xdc2a('0x17')]):_0x54b5c1;return _0x488329;})['then'](respondWithFilteredResult(_0x336a6c,_0x10d76f))['catch'](handleError(_0x336a6c,null));}; \ No newline at end of file +var _0x4777=['intersection','model','fields','attributes','sort','filter','nolimit','setTags','ids','setAdditionalPhones','CmContactHasItem','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','literal','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','order','pick','options','includeAll','include','rows','getHopperHistories','ContactId','getJscriptySessions','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','split','zipObject','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','createReadStream','import','User','agent','binding','firstName','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','start\x20child\x20process\x20correctly!','exit','importUpdates','No\x20ListId\x20specified','No\x20phone\x20column\x20specified','stringify','message','getJourney','mail','chat','sms','whatsapp','-createdAt','resolve','channel','toLowerCase','Invalid\x20channel','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','source','destination','endtime','duration','note','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','createdAt','DESC','range','VoiceCallReport','findAndCountAll','alias','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','browserName','customerIp','customerPort','deviceModel','osName','ratingType','ratingValue','subject','openchannel','externalUrl','threadId','Interaction','Owner','flatten','sortBy','reverse','slice','moment','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','update','then','sendStatus','error','name','send','index','getOptions','findAll','query','catch','destroy','CmContact','find','params','describe','tags','columnName','displayName','analytics','CmCustomField','cf_','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','keys','hasOwnProperty','merge','body','length','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopperBlack','create','ChatInteraction','ChatMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','push','ListId','findOrCreate','all','Tag','Tags','color','tag','ItemType','sequelize','Phones.OrderBy','$and','omit','map','format','cf_%d','pickBy','startsWith','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','text','phone','CmHopper','getTags','findOne','rawAttributes','filters'];(function(_0xcb5183,_0x2a8d28){var _0x314f32=function(_0x8dddcc){while(--_0x8dddcc){_0xcb5183['push'](_0xcb5183['shift']());}};_0x314f32(++_0x2a8d28);}(_0x4777,0x18c));var _0x7477=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x4777[_0x54d4a8];return _0x3b321b;};'use strict';var moment=require(_0x7477('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x7477('0x1'));var fs=require('fs');var _=require(_0x7477('0x2'));var squel=require(_0x7477('0x3'));var Papa=require(_0x7477('0x4'));var Redis=require(_0x7477('0x5'));var contacts=require(_0x7477('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x7477('0x7'))(_0x7477('0x8'));var config=require(_0x7477('0x9'));var shared=require(_0x7477('0xa'));var db=require(_0x7477('0xb'))['db'];config[_0x7477('0xc')]=_[_0x7477('0xd')](config[_0x7477('0xc')],{'host':_0x7477('0xe'),'port':0x18eb});var socket=require(_0x7477('0xf'))(new Redis(config[_0x7477('0xc')]));require(_0x7477('0x10'))[_0x7477('0x11')](socket);function respondWithResult(_0x23bf04,_0x2c2224){_0x2c2224=_0x2c2224||0xc8;return function(_0x4a1815){if(_0x4a1815){return _0x23bf04[_0x7477('0x12')](_0x2c2224)[_0x7477('0x13')](_0x4a1815);}};}function respondWithFilteredResult(_0x3356d4,_0x20c669){return function(_0x21377c){if(_0x21377c){var _0x1e4d0f=typeof _0x20c669[_0x7477('0x14')]===_0x7477('0x15')&&typeof _0x20c669['limit']==='undefined';var _0x9332d0=_0x21377c[_0x7477('0x16')];var _0x85b1b5=_0x1e4d0f?0x0:_0x20c669[_0x7477('0x14')];var _0x166372=_0x1e4d0f?_0x21377c[_0x7477('0x16')]:_0x20c669[_0x7477('0x14')]+_0x20c669[_0x7477('0x17')];var _0x1231b1;if(_0x166372>=_0x9332d0){_0x166372=_0x9332d0;_0x1231b1=0xc8;}else{_0x1231b1=0xce;}_0x3356d4[_0x7477('0x12')](_0x1231b1);return _0x3356d4[_0x7477('0x18')](_0x7477('0x19'),_0x85b1b5+'-'+_0x166372+'/'+_0x9332d0)[_0x7477('0x13')](_0x21377c);}return null;};}function saveUpdates(_0x799a92){return function(_0x5e1680){if(_0x5e1680){return _0x5e1680[_0x7477('0x1a')](_0x799a92)[_0x7477('0x1b')](function(_0x36672e){return _0x36672e;});}return null;};}function removeEntity(_0x4f5659){return function(_0x2609b9){if(_0x2609b9){return _0x2609b9['destroy']()[_0x7477('0x1b')](function(){_0x4f5659[_0x7477('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x238f23){return function(_0xd364c){if(!_0xd364c){_0x238f23[_0x7477('0x1c')](0x194);}return _0xd364c;};}function handleError(_0x513358,_0x4aaf9c){_0x4aaf9c=_0x4aaf9c||0x1f4;return function(_0x98b206){logger[_0x7477('0x1d')](_0x98b206['stack']);if(_0x98b206[_0x7477('0x1e')]){delete _0x98b206[_0x7477('0x1e')];}_0x513358[_0x7477('0x12')](_0x4aaf9c)[_0x7477('0x1f')](_0x98b206);};}exports[_0x7477('0x20')]=function(_0x1f7376,_0xa9e45a){var _0x44d25e={};return contacts['describe']()[_0x7477('0x1b')](function(_0x16010e){_0x44d25e=qs[_0x7477('0x21')](_0x16010e,_0x1f7376);return contacts[_0x7477('0x22')](_0x1f7376[_0x7477('0x23')],_0x1f7376['user'],_0x44d25e,_0x16010e);})[_0x7477('0x1b')](respondWithFilteredResult(_0xa9e45a,_0x44d25e))[_0x7477('0x24')](handleError(_0xa9e45a,null));};exports[_0x7477('0x25')]=function(_0x368ae5,_0x4c5a00){return db[_0x7477('0x26')][_0x7477('0x27')]({'where':{'id':_0x368ae5[_0x7477('0x28')]['id']}})[_0x7477('0x1b')](handleEntityNotFound(_0x4c5a00,null))[_0x7477('0x1b')](removeEntity(_0x4c5a00,null))[_0x7477('0x24')](handleError(_0x4c5a00,null));};exports[_0x7477('0x29')]=function(_0x301712,_0x13b484){return db['CmContact']['describe']()[_0x7477('0x1b')](function(_0x58b273){delete _0x58b273[_0x7477('0x2a')];for(var _0x58c7dd=0x0;_0x58c7dd0x0){return new Promise(function(_0x5b42fc){var _0x1cfe06=[];for(var _0x5c8619=0x0;_0x5c8619<_0x3cd5a7[_0x7477('0x39')];_0x5c8619++){_0x1cfe06[_0x7477('0x60')](insertAdditionalPhones(_0x3cd5a7[_0x5c8619]['contact'],_0x3cd5a7[_0x5c8619][_0x7477('0x5b')]));}Promise[_0x7477('0x63')](_0x1cfe06)['then'](function(){_0x5b42fc(0x1);});})[_0x7477('0x1b')](function(){return{'success':_0x265c48,'failure':_0x2888e4,'duplicates':_0x1f4e7c};});}else{return{'success':_0x265c48,'failure':_0x2888e4,'duplicates':_0x1f4e7c};}}})[_0x7477('0x1b')](respondWithResult(_0x38b440,0xc9))[_0x7477('0x24')](handleError(_0x38b440,null));};exports['show']=function(_0x482c4b,_0x555ac4){var _0x3d6546;return db[_0x7477('0x26')][_0x7477('0x29')]()[_0x7477('0x1b')](function(_0x140d52){return db['CmContact']['find']({'where':{'id':_0x482c4b[_0x7477('0x28')]['id']},'include':[{'model':db[_0x7477('0x64')],'as':_0x7477('0x65'),'attributes':['id','name',_0x7477('0x66')],'required':_0x482c4b[_0x7477('0x23')][_0x7477('0x67')]?!![]:![]},{'model':db['CmContactHasItem'],'as':'Phones','where':{'CmContactId':_0x482c4b[_0x7477('0x28')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x7477('0x68')}]}],'order':[db[_0x7477('0x69')]['literal'](_0x7477('0x6a'))],'attributes':_[_0x7477('0x35')](_0x140d52)});})['then'](function(_0x53e401){if(!_[_0x7477('0x57')](_0x53e401)){_0x3d6546=_0x53e401[_0x7477('0x3a')]({'plain':!![]});var _0x5ade17={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x53e401&&_0x53e401[_0x7477('0x61')]){if(_0x53e401[_0x7477('0x61')]){_0x5ade17[_0x7477('0x5f')][_0x7477('0x6b')][_0x7477('0x60')]({'ListId':{'$ne':_0x53e401[_0x7477('0x61')]}});}}return db[_0x7477('0x2e')]['findAll'](_0x5ade17);}})['then'](function(_0x32840e){if(!_[_0x7477('0x57')](_0x32840e)){return _[_0x7477('0x6c')](_0x3d6546,_[_0x7477('0x6d')](_0x32840e,function(_0x27b0e1){return util[_0x7477('0x6e')](_0x7477('0x6f'),_0x27b0e1['id']);}));}})[_0x7477('0x1b')](handleEntityNotFound(_0x555ac4,null))[_0x7477('0x1b')](respondWithResult(_0x555ac4,null))['catch'](handleError(_0x555ac4,null));};exports[_0x7477('0x1a')]=function(_0x5b3a4d,_0x314578){var _0x592786;if(_0x5b3a4d[_0x7477('0x38')]['id']){delete _0x5b3a4d[_0x7477('0x38')]['id'];}if(!_[_0x7477('0x57')](_0x5b3a4d[_0x7477('0x38')]['dialTimezone'])){var _0x14a2f1=_0x5b3a4d[_0x7477('0x38')][_0x7477('0x58')];if(!_[_0x7477('0x57')](shared[_0x7477('0x59')][_0x14a2f1]))_0x5b3a4d[_0x7477('0x38')]['utcOffset']=shared[_0x7477('0x59')][_0x14a2f1]['utcOffset'];}return db[_0x7477('0x26')][_0x7477('0x27')]({'where':{'id':_0x5b3a4d[_0x7477('0x28')]['id']}})['then'](handleEntityNotFound(_0x314578,null))[_0x7477('0x1b')](saveUpdates(_0x5b3a4d['body'],null))[_0x7477('0x1b')](function(_0x58aecc){_0x592786=_0x58aecc;var _0x31f1de={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x58aecc&&_0x58aecc['ListId']){if(_0x58aecc[_0x7477('0x61')]){_0x31f1de[_0x7477('0x5f')][_0x7477('0x6b')][_0x7477('0x60')]({'ListId':{'$ne':_0x58aecc['ListId']}});}}return db[_0x7477('0x2e')][_0x7477('0x22')](_0x31f1de);})[_0x7477('0x1b')](function(_0x1391af){if(_0x1391af){return _['omit'](_[_0x7477('0x70')](_0x5b3a4d[_0x7477('0x38')],function(_0x26cb0a,_0x4d4994){return _[_0x7477('0x71')](_0x4d4994,'cf_');}),_[_0x7477('0x6d')](_0x1391af,function(_0x13f975){return util['format'](_0x7477('0x6f'),_0x13f975['id']);}));}})['then'](function(_0x55e91f){if(_0x55e91f&&!_[_0x7477('0x72')](_0x55e91f)){var _0x18a695=squel[_0x7477('0x1a')]()[_0x7477('0x73')](_0x7477('0x74'))[_0x7477('0x75')](_0x55e91f)[_0x7477('0x5f')](_0x7477('0x76'),_0x5b3a4d[_0x7477('0x28')]['id'])['toParam']();return db[_0x7477('0x69')][_0x7477('0x23')](_0x18a695[_0x7477('0x77')],{'replacements':_0x18a695[_0x7477('0x32')]});}})[_0x7477('0x1b')](function(){if(_0x5b3a4d[_0x7477('0x38')][_0x7477('0x78')]&&_0x592786){return db[_0x7477('0x79')][_0x7477('0x1a')]({'phone':_0x5b3a4d[_0x7477('0x38')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x592786['id']}});}})[_0x7477('0x1b')](function(){return _0x592786;})['then'](respondWithResult(_0x314578,null))[_0x7477('0x24')](handleError(_0x314578,null));};exports[_0x7477('0x7a')]=function(_0x39ce70,_0x6d4188){var _0x22b77a={};var _0x44b897={};var _0x2df0f1;var _0x2924bd;return db['CmContact'][_0x7477('0x7b')]({'where':{'id':_0x39ce70['params']['id']}})[_0x7477('0x1b')](handleEntityNotFound(_0x6d4188,null))[_0x7477('0x1b')](function(_0x317d64){if(_0x317d64){_0x2df0f1=_0x317d64;_0x44b897['model']=_[_0x7477('0x35')](db[_0x7477('0x64')][_0x7477('0x7c')]);_0x44b897[_0x7477('0x23')]=_['keys'](_0x39ce70[_0x7477('0x23')]);_0x44b897[_0x7477('0x7d')]=_[_0x7477('0x7e')](_0x44b897[_0x7477('0x7f')],_0x44b897[_0x7477('0x23')]);_0x22b77a['attributes']=_[_0x7477('0x7e')](_0x44b897[_0x7477('0x7f')],qs[_0x7477('0x80')](_0x39ce70[_0x7477('0x23')][_0x7477('0x80')]));_0x22b77a[_0x7477('0x81')]=_0x22b77a[_0x7477('0x81')][_0x7477('0x39')]?_0x22b77a[_0x7477('0x81')]:_0x44b897[_0x7477('0x7f')];_0x22b77a['order']=qs[_0x7477('0x82')](_0x39ce70[_0x7477('0x23')]['sort']);_0x22b77a[_0x7477('0x5f')]=qs[_0x7477('0x7d')](_['pick'](_0x39ce70[_0x7477('0x23')],_0x44b897['filters']));if(_0x39ce70[_0x7477('0x23')][_0x7477('0x83')]){_0x22b77a[_0x7477('0x5f')]=_['merge'](_0x22b77a['where'],{'$or':_[_0x7477('0x6d')](_0x22b77a[_0x7477('0x81')],function(_0x2214a2){var _0xe4be66={};_0xe4be66[_0x2214a2]={'$like':'%'+_0x39ce70[_0x7477('0x23')]['filter']+'%'};return _0xe4be66;})});}_0x22b77a=_[_0x7477('0x37')]({},_0x22b77a,_0x39ce70['options']);return _0x2df0f1[_0x7477('0x7a')](_0x22b77a);}})[_0x7477('0x1b')](function(_0x510b62){if(_0x510b62){_0x2924bd=_0x510b62[_0x7477('0x39')];if(!_0x39ce70[_0x7477('0x23')][_0x7477('0x36')](_0x7477('0x84'))){_0x22b77a[_0x7477('0x17')]=qs[_0x7477('0x17')](_0x39ce70['query']['limit']);_0x22b77a[_0x7477('0x14')]=qs['offset'](_0x39ce70[_0x7477('0x23')][_0x7477('0x14')]);}return _0x2df0f1['getTags'](_0x22b77a);}})[_0x7477('0x1b')](function(_0x59ac25){if(_0x59ac25){return _0x59ac25?{'count':_0x2924bd,'rows':_0x59ac25}:null;}})['then'](respondWithResult(_0x6d4188,null))['catch'](handleError(_0x6d4188,null));};exports[_0x7477('0x85')]=function(_0x244921,_0x3e88ac){if(_0x244921[_0x7477('0x38')]['id']){delete _0x244921[_0x7477('0x38')]['id'];}return db[_0x7477('0x26')]['findOne']({'where':{'id':_0x244921[_0x7477('0x28')]['id']}})[_0x7477('0x1b')](handleEntityNotFound(_0x3e88ac,null))[_0x7477('0x1b')](function(_0x3b4fa0){if(_0x3b4fa0){return _0x3b4fa0['setTags'](_0x244921[_0x7477('0x38')][_0x7477('0x86')]||[]);}return null;})['then'](respondWithResult(_0x3e88ac,null))['catch'](handleError(_0x3e88ac,null));};exports[_0x7477('0x87')]=function(_0x2aaaaa,_0xc84f08){var _0x101f77=[];_0x101f77[_0x7477('0x60')](addAdditionalPhones(_0x2aaaaa[_0x7477('0x38')]));Promise[_0x7477('0x63')](_0x101f77)[_0x7477('0x1b')](function(){_0x101f77=[];_0x101f77[_0x7477('0x60')](deleteCmHopperPhones(_0x2aaaaa[_0x7477('0x38')]['id']));_0x101f77['push'](addCmHopperPhones(_0x2aaaaa[_0x7477('0x38')]['id']));Promise['all'](_0x101f77)[_0x7477('0x1b')](function(){return[0x1];})['then'](respondWithResult(_0xc84f08,null));});};function addAdditionalPhones(_0x1cc3dc){var _0x308002;return new Promise(function(_0x11a71b){return db[_0x7477('0x88')]['destroy']({'where':{'CmContactId':_0x1cc3dc['id']}})[_0x7477('0x1b')](function(){db[_0x7477('0x89')][_0x7477('0x22')]({'raw':!![],'attributes':['id',_0x7477('0x8a')]})['then'](function(_0x585b10){var _0x3a711b=[];for(var _0x5b97bc=0x0;_0x5b97bc<_0x1cc3dc[_0x7477('0x8b')][_0x7477('0x39')];_0x5b97bc++){var _0x26018e=_0x1cc3dc[_0x7477('0x8c')]?_[_0x7477('0x57')](_0x1cc3dc[_0x7477('0x8c')][_0x5b97bc])?'':_0x1cc3dc[_0x7477('0x8c')][_0x5b97bc]:_0x1cc3dc[_0x7477('0x8b')][_0x5b97bc][_0x7477('0x8d')]?_0x1cc3dc[_0x7477('0x8b')][_0x5b97bc][_0x7477('0x8d')]:'';var _0xe239ab=_['isNil'](_0x1cc3dc[_0x7477('0x8b')][_0x5b97bc][_0x7477('0x8e')])?'':_0x1cc3dc[_0x7477('0x8b')][_0x5b97bc][_0x7477('0x8e')];var _0x20e8c6=_0x26018e+':'+_0x1cc3dc[_0x7477('0x8b')][_0x5b97bc][_0x7477('0x78')]+'§'+_0xe239ab;if(_[_0x7477('0x57')](_0x308002))_0x308002=_0x20e8c6;else _0x308002+=';'+_0x20e8c6;var _0x4e6fd6=null;var _0x5c72d3=null;if(_0x1cc3dc[_0x7477('0x8c')]){if(!_[_0x7477('0x57')](_0x1cc3dc['item_types'][_0x5b97bc])){_0x5c72d3=_[_0x7477('0x27')](_0x585b10,function(_0x1a7957){return _0x1a7957['id']===_0x1cc3dc[_0x7477('0x8c')][_0x5b97bc];});if(!_['isNil'](_0x5c72d3)){_0x4e6fd6=_0x5c72d3[_0x7477('0x8a')];}}}else{if(!_[_0x7477('0x57')](_0x1cc3dc['items'][_0x5b97bc])){_0x5c72d3=_[_0x7477('0x27')](_0x585b10,function(_0x270994){return _0x270994['id']===_0x1cc3dc[_0x7477('0x8b')][_0x5b97bc][_0x7477('0x8d')];});if(!_['isNil'](_0x5c72d3)){_0x4e6fd6=_0x5b97bc;}}}if(_[_0x7477('0x57')](_0x4e6fd6)){_0x4e6fd6=0x64;}_0x3a711b['push'](addAdditionalPhone(_0x1cc3dc['id'],_0x1cc3dc[_0x7477('0x8b')][_0x5b97bc][_0x7477('0x78')],_0x1cc3dc[_0x7477('0x8c')]?_[_0x7477('0x57')](_0x1cc3dc[_0x7477('0x8c')][_0x5b97bc])?null:_0x1cc3dc['item_types'][_0x5b97bc]:_0x1cc3dc[_0x7477('0x8b')][_0x5b97bc][_0x7477('0x8d')]?_0x1cc3dc['items'][_0x5b97bc][_0x7477('0x8d')]:null,_0x4e6fd6,_0xe239ab));}Promise[_0x7477('0x63')](_0x3a711b)[_0x7477('0x1b')](function(){db[_0x7477('0x26')][_0x7477('0x1a')]({'AdditionalPhones':_0x308002},{'where':{'id':_0x1cc3dc['id']}})[_0x7477('0x1b')](function(){_0x11a71b(0x1);});});});});});}function addAdditionalPhone(_0x4e1379,_0x25115a,_0x1e5ab2,_0xe86f51,_0x215bb9){return db[_0x7477('0x88')]['find']({'where':{'CmContactId':_0x4e1379,'item':_0x25115a}})[_0x7477('0x1b')](function(_0x5d9784){if(_0x5d9784)logger[_0x7477('0x33')](_0x7477('0x8f'),_0x5d9784);else{db[_0x7477('0x88')]['create']({'CmContactId':_0x4e1379,'item':_0x25115a,'ItemTypeId':_0x1e5ab2,'OrderBy':_0xe86f51,'ItemClass':_0x7477('0x90'),'description':_0x215bb9});}});}function deleteCmHopperPhones(_0x137629){return new Promise(function(_0x19d998){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x137629}})[_0x7477('0x1b')](function(_0x79383c){db[_0x7477('0x91')][_0x7477('0x25')]({'where':{'CmHopperId':{'$in':_['map'](_0x79383c,'id')}}});})[_0x7477('0x1b')](function(){_0x19d998(0x1);});});}function addCmHopperPhones(_0x3be784){return new Promise(function(_0x54d217){return db['CmHopper'][_0x7477('0x22')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3be784}})['then'](function(_0xda3db2){var _0x46d151=[];_['map'](_0xda3db2,function(_0x6181da){_0x46d151[_0x7477('0x60')](createCmHopperPhone(_0x3be784,_0x6181da['id']));});Promise['all'](_0x46d151)['then'](function(){_0x54d217(0x1);});});});}function createCmHopperPhone(_0x343551,_0x24f7d2){return new Promise(function(_0x51f443){db[_0x7477('0x88')][_0x7477('0x22')]({'raw':!![],'attributes':[_0x7477('0x92'),'OrderBy'],'where':{'CmContactId':_0x343551,'ItemClass':'PHONE'},'include':[{'model':db[_0x7477('0x89')],'attributes':['OrderBy'],'as':_0x7477('0x68')}],'order':[_0x7477('0x8a'),db[_0x7477('0x69')][_0x7477('0x93')](_0x7477('0x94'))]})[_0x7477('0x1b')](function(_0x40cf7d){var _0x24843c=0x1;var _0x16910d=_['map'](_0x40cf7d,function(_0x201462){_0x201462[_0x7477('0x95')]=_0x24f7d2;_0x201462[_0x7477('0x78')]=_0x201462[_0x7477('0x92')];_0x201462[_0x7477('0x8a')]=_0x24843c;delete _0x201462[_0x7477('0x96')];_0x24843c=_0x24843c+0x1;return _0x201462;});return db['CmHopperAdditionalPhone'][_0x7477('0x5c')](_0x16910d,{});})[_0x7477('0x1b')](function(){_0x51f443(0x1);});});}function insertAdditionalPhones(_0x4f72df,_0x2c2be5){return new Promise(function(_0x20e25e){var _0xc5c63f=[];for(var _0x5e94e9=0x0;_0x5e94e9<_0x2c2be5['length'];_0x5e94e9++){var _0x2fd504=_0x2c2be5[_0x5e94e9];_0xc5c63f[_0x7477('0x60')](parseContactItemType(_0x2fd504));}Promise[_0x7477('0x63')](_0xc5c63f)[_0x7477('0x1b')](function(){var _0x356ac6={'id':_0x4f72df['id'],'items':_0x2c2be5};return addAdditionalPhones(_0x356ac6)[_0x7477('0x1b')](function(){return addCmHopperPhones(_0x4f72df['id']);});})['then'](function(){_0x20e25e(_0x4f72df);});});}function parseContactItemType(_0x26edd9){return new Promise(function(_0x4c4a55){if(_0x26edd9['hasOwnProperty']('ItemTypeId')){_0x4c4a55(_0x26edd9);}else{return db[_0x7477('0x89')][_0x7477('0x27')]({'where':{'name':_0x26edd9[_0x7477('0x68')]}})[_0x7477('0x1b')](function(_0x43d076){if(_[_0x7477('0x57')](_0x43d076))_0x26edd9['ItemTypeId']=null;else _0x26edd9[_0x7477('0x8d')]=_0x43d076['id'];_0x4c4a55(_0x26edd9);});}});}exports[_0x7477('0x97')]=function(_0x554772,_0x29bd47){return db[_0x7477('0x88')][_0x7477('0x22')]({'raw':!![],'where':{'CmContactId':_0x554772['params']['id'],'ItemClass':_0x7477('0x90')},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[['OrderBy'],[db[_0x7477('0x69')][_0x7477('0x93')](_0x7477('0x94'))]]})[_0x7477('0x1b')](function(_0x3f51c2){return _0x3f51c2;})[_0x7477('0x1b')](respondWithResult(_0x29bd47,null))['catch'](handleError(_0x29bd47,null));};exports[_0x7477('0x98')]=function(_0x14dfb4,_0x514f4b){return db[_0x7477('0x88')][_0x7477('0x22')]({'raw':!![],'where':{'CmContactId':_0x14dfb4['body'][_0x7477('0x99')]}})[_0x7477('0x1b')](function(_0x549ccc){var _0x442ceb=_[_0x7477('0x6d')](_0x549ccc,function(_0x55ca5d){_0x55ca5d[_0x7477('0x9a')]=_0x14dfb4['body'][_0x7477('0x9b')];return _0x55ca5d;});return db[_0x7477('0x88')][_0x7477('0x5c')](_0x442ceb,{});})[_0x7477('0x1b')](function(){return addCmHopperPhones(_0x14dfb4['body'][_0x7477('0x9b')]);})['then'](function(){return['ok'];})['then'](respondWithResult(_0x514f4b,null))[_0x7477('0x24')](handleError(_0x514f4b,null));};exports[_0x7477('0x9c')]=function(_0x2bd0bd,_0x3b9ea6){var _0x293616=[];_0x293616['push'](createCmHopperPhone(_0x2bd0bd[_0x7477('0x38')]['id'],_0x2bd0bd[_0x7477('0x38')][_0x7477('0x9d')]));Promise[_0x7477('0x63')](_0x293616)['then'](function(){return[0x1];})[_0x7477('0x1b')](respondWithResult(_0x3b9ea6,null));};exports['getHoppers']=function(_0x5d9407,_0x3ab0a4){var _0x3e4aa0={'raw':![],'where':{}};var _0x19209d={};var _0x2972d1={'count':0x0,'rows':[]};return db[_0x7477('0x26')][_0x7477('0x7b')]({'where':{'id':_0x5d9407[_0x7477('0x28')]['id']}})['then'](handleEntityNotFound(_0x3ab0a4,null))[_0x7477('0x1b')](function(_0x31f643){if(_0x31f643){_0x19209d[_0x7477('0x7f')]=_['keys'](db['CmHopper'][_0x7477('0x7c')]);_0x19209d[_0x7477('0x23')]=_[_0x7477('0x35')](_0x5d9407['query']);_0x19209d[_0x7477('0x7d')]=_[_0x7477('0x7e')](_0x19209d[_0x7477('0x7f')],_0x19209d[_0x7477('0x23')]);_0x3e4aa0[_0x7477('0x81')]=_[_0x7477('0x7e')](_0x19209d['model'],qs[_0x7477('0x80')](_0x5d9407[_0x7477('0x23')][_0x7477('0x80')]));_0x3e4aa0[_0x7477('0x81')]=_0x3e4aa0[_0x7477('0x81')][_0x7477('0x39')]?_0x3e4aa0[_0x7477('0x81')]:_0x19209d[_0x7477('0x7f')];if(!_0x5d9407[_0x7477('0x23')][_0x7477('0x36')](_0x7477('0x84'))){_0x3e4aa0['limit']=qs[_0x7477('0x17')](_0x5d9407[_0x7477('0x23')][_0x7477('0x17')]);_0x3e4aa0[_0x7477('0x14')]=qs['offset'](_0x5d9407[_0x7477('0x23')]['offset']);}_0x3e4aa0[_0x7477('0x9e')]=qs[_0x7477('0x82')](_0x5d9407[_0x7477('0x23')][_0x7477('0x82')]);_0x3e4aa0[_0x7477('0x5f')]=qs[_0x7477('0x7d')](_[_0x7477('0x9f')](_0x5d9407[_0x7477('0x23')],_0x19209d[_0x7477('0x7d')]));_0x3e4aa0['where']['ContactId']=_0x31f643['id'];if(_0x5d9407[_0x7477('0x23')][_0x7477('0x83')]){_0x3e4aa0[_0x7477('0x5f')]=_[_0x7477('0x37')](_0x3e4aa0[_0x7477('0x5f')],{'$or':_['map'](_0x3e4aa0[_0x7477('0x81')],function(_0x3b4bfc){var _0xfed4c3={};_0xfed4c3[_0x3b4bfc]={'$like':'%'+_0x5d9407[_0x7477('0x23')][_0x7477('0x83')]+'%'};return _0xfed4c3;})});}_0x3e4aa0=_[_0x7477('0x37')]({},_0x3e4aa0,_0x5d9407[_0x7477('0xa0')]);return db['CmHopper'][_0x7477('0x16')]({'where':_0x3e4aa0[_0x7477('0x5f')]})[_0x7477('0x1b')](function(_0x4781eb){_0x2972d1['count']=_0x4781eb;if(_0x5d9407[_0x7477('0x23')][_0x7477('0xa1')]){_0x3e4aa0[_0x7477('0xa2')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x3e4aa0);})['then'](function(_0x2549b4){_0x2972d1[_0x7477('0xa3')]=_0x2549b4;return _0x2972d1;});}})['then'](respondWithFilteredResult(_0x3ab0a4,_0x3e4aa0))[_0x7477('0x24')](handleError(_0x3ab0a4,null));};exports[_0x7477('0xa4')]=function(_0x4bf7c4,_0xd13475){var _0x18366d={'raw':!![],'where':{}};var _0xf15f52={};var _0x40a0a2={'count':0x0,'rows':[]};return db[_0x7477('0x26')][_0x7477('0x7b')]({'where':{'id':_0x4bf7c4[_0x7477('0x28')]['id']}})['then'](handleEntityNotFound(_0xd13475,null))[_0x7477('0x1b')](function(_0x4f4fcb){if(_0x4f4fcb){_0xf15f52[_0x7477('0x7f')]=_[_0x7477('0x35')](db[_0x7477('0x4d')][_0x7477('0x7c')]);_0xf15f52[_0x7477('0x23')]=_[_0x7477('0x35')](_0x4bf7c4[_0x7477('0x23')]);_0xf15f52[_0x7477('0x7d')]=_[_0x7477('0x7e')](_0xf15f52[_0x7477('0x7f')],_0xf15f52[_0x7477('0x23')]);_0x18366d[_0x7477('0x81')]=_[_0x7477('0x7e')](_0xf15f52[_0x7477('0x7f')],qs[_0x7477('0x80')](_0x4bf7c4['query'][_0x7477('0x80')]));_0x18366d['attributes']=_0x18366d['attributes'][_0x7477('0x39')]?_0x18366d[_0x7477('0x81')]:_0xf15f52['model'];if(!_0x4bf7c4['query'][_0x7477('0x36')](_0x7477('0x84'))){_0x18366d['limit']=qs['limit'](_0x4bf7c4[_0x7477('0x23')][_0x7477('0x17')]);_0x18366d[_0x7477('0x14')]=qs['offset'](_0x4bf7c4[_0x7477('0x23')][_0x7477('0x14')]);}_0x18366d[_0x7477('0x9e')]=qs[_0x7477('0x82')](_0x4bf7c4[_0x7477('0x23')][_0x7477('0x82')]);_0x18366d[_0x7477('0x5f')]=qs[_0x7477('0x7d')](_['pick'](_0x4bf7c4[_0x7477('0x23')],_0xf15f52['filters']));_0x18366d[_0x7477('0x5f')][_0x7477('0xa5')]=_0x4f4fcb['id'];if(_0x4bf7c4[_0x7477('0x23')][_0x7477('0x83')]){_0x18366d[_0x7477('0x5f')]=_[_0x7477('0x37')](_0x18366d['where'],{'$or':_['map'](_0x18366d[_0x7477('0x81')],function(_0x14d8e9){var _0x2c5089={};_0x2c5089[_0x14d8e9]={'$like':'%'+_0x4bf7c4['query'][_0x7477('0x83')]+'%'};return _0x2c5089;})});}_0x18366d=_[_0x7477('0x37')]({},_0x18366d,_0x4bf7c4['options']);return db[_0x7477('0x4d')][_0x7477('0x16')]({'where':_0x18366d[_0x7477('0x5f')]})[_0x7477('0x1b')](function(_0x4f7c30){_0x40a0a2[_0x7477('0x16')]=_0x4f7c30;if(_0x4bf7c4[_0x7477('0x23')][_0x7477('0xa1')]){_0x18366d[_0x7477('0xa2')]=[{'all':!![]}];}return db[_0x7477('0x4d')][_0x7477('0x22')](_0x18366d);})[_0x7477('0x1b')](function(_0x5c153a){_0x40a0a2['rows']=_0x5c153a;return _0x40a0a2;});}})[_0x7477('0x1b')](respondWithFilteredResult(_0xd13475,_0x18366d))['catch'](handleError(_0xd13475,null));};exports['getHopperFinals']=function(_0x20006d,_0x397cc8){var _0x39bff0={'raw':!![],'where':{}};var _0x249fb3={};var _0x4d077c={'count':0x0,'rows':[]};return db[_0x7477('0x26')]['findOne']({'where':{'id':_0x20006d[_0x7477('0x28')]['id']}})[_0x7477('0x1b')](handleEntityNotFound(_0x397cc8,null))[_0x7477('0x1b')](function(_0x316805){if(_0x316805){_0x249fb3[_0x7477('0x7f')]=_[_0x7477('0x35')](db[_0x7477('0x4c')][_0x7477('0x7c')]);_0x249fb3[_0x7477('0x23')]=_[_0x7477('0x35')](_0x20006d['query']);_0x249fb3[_0x7477('0x7d')]=_[_0x7477('0x7e')](_0x249fb3[_0x7477('0x7f')],_0x249fb3[_0x7477('0x23')]);_0x39bff0[_0x7477('0x81')]=_[_0x7477('0x7e')](_0x249fb3[_0x7477('0x7f')],qs[_0x7477('0x80')](_0x20006d[_0x7477('0x23')]['fields']));_0x39bff0[_0x7477('0x81')]=_0x39bff0['attributes'][_0x7477('0x39')]?_0x39bff0[_0x7477('0x81')]:_0x249fb3[_0x7477('0x7f')];if(!_0x20006d[_0x7477('0x23')][_0x7477('0x36')](_0x7477('0x84'))){_0x39bff0[_0x7477('0x17')]=qs[_0x7477('0x17')](_0x20006d[_0x7477('0x23')][_0x7477('0x17')]);_0x39bff0[_0x7477('0x14')]=qs['offset'](_0x20006d[_0x7477('0x23')][_0x7477('0x14')]);}_0x39bff0[_0x7477('0x9e')]=qs[_0x7477('0x82')](_0x20006d[_0x7477('0x23')][_0x7477('0x82')]);_0x39bff0['where']=qs[_0x7477('0x7d')](_[_0x7477('0x9f')](_0x20006d['query'],_0x249fb3[_0x7477('0x7d')]));_0x39bff0['where'][_0x7477('0xa5')]=_0x316805['id'];if(_0x20006d['query'][_0x7477('0x83')]){_0x39bff0[_0x7477('0x5f')]=_[_0x7477('0x37')](_0x39bff0[_0x7477('0x5f')],{'$or':_['map'](_0x39bff0[_0x7477('0x81')],function(_0x31f1e3){var _0x549ff7={};_0x549ff7[_0x31f1e3]={'$like':'%'+_0x20006d[_0x7477('0x23')][_0x7477('0x83')]+'%'};return _0x549ff7;})});}_0x39bff0=_[_0x7477('0x37')]({},_0x39bff0,_0x20006d[_0x7477('0xa0')]);return db[_0x7477('0x4c')][_0x7477('0x16')]({'where':_0x39bff0[_0x7477('0x5f')]})[_0x7477('0x1b')](function(_0x593b3c){_0x4d077c[_0x7477('0x16')]=_0x593b3c;if(_0x20006d['query']['includeAll']){_0x39bff0[_0x7477('0xa2')]=[{'all':!![]}];}return db[_0x7477('0x4c')][_0x7477('0x22')](_0x39bff0);})[_0x7477('0x1b')](function(_0x4e1901){_0x4d077c[_0x7477('0xa3')]=_0x4e1901;return _0x4d077c;});}})[_0x7477('0x1b')](respondWithFilteredResult(_0x397cc8,_0x39bff0))['catch'](handleError(_0x397cc8,null));};exports[_0x7477('0xa6')]=function(_0x3e1a42,_0x1d398d){var _0x2e1c12={'raw':!![],'where':{}};var _0x18e629={};var _0x53607b={'count':0x0,'rows':[]};return db['CmContact'][_0x7477('0x7b')]({'where':{'id':_0x3e1a42['params']['id']}})[_0x7477('0x1b')](handleEntityNotFound(_0x1d398d,null))[_0x7477('0x1b')](function(_0x32d021){if(_0x32d021){_0x18e629[_0x7477('0x7f')]=_[_0x7477('0x35')](db[_0x7477('0x53')]['rawAttributes']);_0x18e629[_0x7477('0x23')]=_[_0x7477('0x35')](_0x3e1a42['query']);_0x18e629[_0x7477('0x7d')]=_[_0x7477('0x7e')](_0x18e629[_0x7477('0x7f')],_0x18e629[_0x7477('0x23')]);_0x2e1c12[_0x7477('0x81')]=_[_0x7477('0x7e')](_0x18e629[_0x7477('0x7f')],qs[_0x7477('0x80')](_0x3e1a42[_0x7477('0x23')][_0x7477('0x80')]));_0x2e1c12[_0x7477('0x81')]=_0x2e1c12[_0x7477('0x81')]['length']?_0x2e1c12[_0x7477('0x81')]:_0x18e629[_0x7477('0x7f')];if(!_0x3e1a42[_0x7477('0x23')][_0x7477('0x36')](_0x7477('0x84'))){_0x2e1c12[_0x7477('0x17')]=qs[_0x7477('0x17')](_0x3e1a42['query'][_0x7477('0x17')]);_0x2e1c12[_0x7477('0x14')]=qs[_0x7477('0x14')](_0x3e1a42[_0x7477('0x23')][_0x7477('0x14')]);}_0x2e1c12[_0x7477('0x9e')]=qs[_0x7477('0x82')](_0x3e1a42[_0x7477('0x23')][_0x7477('0x82')]);_0x2e1c12['where']=qs[_0x7477('0x7d')](_[_0x7477('0x9f')](_0x3e1a42[_0x7477('0x23')],_0x18e629[_0x7477('0x7d')]));_0x2e1c12[_0x7477('0x5f')][_0x7477('0xa5')]=_0x32d021['id'];if(_0x3e1a42[_0x7477('0x23')][_0x7477('0x83')]){_0x2e1c12[_0x7477('0x5f')]=_[_0x7477('0x37')](_0x2e1c12[_0x7477('0x5f')],{'$or':_[_0x7477('0x6d')](_0x2e1c12[_0x7477('0x81')],function(_0x3947a6){var _0x36fc12={};_0x36fc12[_0x3947a6]={'$like':'%'+_0x3e1a42[_0x7477('0x23')][_0x7477('0x83')]+'%'};return _0x36fc12;})});}_0x2e1c12=_[_0x7477('0x37')]({},_0x2e1c12,_0x3e1a42[_0x7477('0xa0')]);return db['JscriptySessionReport'][_0x7477('0x16')]({'where':_0x2e1c12[_0x7477('0x5f')]})[_0x7477('0x1b')](function(_0x58a166){_0x53607b[_0x7477('0x16')]=_0x58a166;if(_0x3e1a42[_0x7477('0x23')][_0x7477('0xa1')]){_0x2e1c12[_0x7477('0xa2')]=[{'all':!![]}];}return db[_0x7477('0x53')][_0x7477('0x22')](_0x2e1c12);})[_0x7477('0x1b')](function(_0x22dfdc){_0x53607b['rows']=_0x22dfdc;return _0x53607b;});}})[_0x7477('0x1b')](respondWithFilteredResult(_0x1d398d,_0x2e1c12))[_0x7477('0x24')](handleError(_0x1d398d,null));};exports[_0x7477('0xa7')]=function(_0x20f66f,_0x181382){try{if(!_0x20f66f['body'][_0x7477('0x61')]){throw new Error('No\x20ListId\x20specified');}if(!_0x20f66f[_0x7477('0x38')][_0x7477('0xa8')]){throw new Error(_0x7477('0xa9'));}if(!_0x20f66f[_0x7477('0x38')][_0x7477('0xaa')]){throw new Error(_0x7477('0xab'));}if(!_0x20f66f['body'][_0x7477('0xac')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x4931c9=_0x20f66f[_0x7477('0x38')][_0x7477('0xa8')][_0x7477('0xad')](',');var _0x45788b=_0x20f66f[_0x7477('0x38')][_0x7477('0xaa')]['split'](',');if(!_0x4931c9[_0x7477('0x39')]||!_0x45788b[_0x7477('0x39')]||_0x4931c9[_0x7477('0x39')]!==_0x45788b[_0x7477('0x39')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x20f66f[_0x7477('0x38')][_0x7477('0x80')]=_[_0x7477('0xae')](_0x4931c9,_0x45788b);if(!_0x20f66f[_0x7477('0x38')]['fields'][_0x7477('0x78')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x20f66f['body'][_0x7477('0x80')]['firstName']){throw new Error(_0x7477('0xaf'));}var _0x2dcbb7=path[_0x7477('0x3d')](config[_0x7477('0xb0')],_0x7477('0xb1'),_0x20f66f[_0x7477('0xb2')][_0x7477('0xb3')]);fs[_0x7477('0xb4')](_0x2dcbb7,parseInt(_0x7477('0xb5'),0x8));var _0x38da02=require(_0x7477('0xb6'))[_0x7477('0xb7')](path[_0x7477('0x3d')](__dirname,_0x7477('0xb8')),[_0x2dcbb7,_0x20f66f[_0x7477('0x38')][_0x7477('0xa8')],_0x20f66f[_0x7477('0x38')][_0x7477('0xaa')],_0x20f66f[_0x7477('0x38')][_0x7477('0x61')],_0x20f66f[_0x7477('0x38')][_0x7477('0xb9')],_0x20f66f[_0x7477('0x38')]['duplicates'],_0x20f66f[_0x7477('0x38')][_0x7477('0xac')]]);return _0x181382[_0x7477('0x12')](0xc8)['json']({'message':_0x7477('0xba'),'pid':_0x38da02[_0x7477('0xbb')]});}catch(_0xd987a0){return _0x181382[_0x7477('0x12')](0x1f4)[_0x7477('0x1f')](_0xd987a0);}};exports['upload']=function(_0x4648ed,_0x43a64c){var _0x1d6be3=fs[_0x7477('0xbc')](_0x4648ed['file'][_0x7477('0x1')]);Papa['parse'](_0x1d6be3,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x328de7){return _0x43a64c[_0x7477('0x12')](0xc8)[_0x7477('0x13')]({'file':_0x4648ed['file'],'fields':_0x328de7['meta'][_0x7477('0x80')]});}});};exports[_0x7477('0xbd')]=function(_0x2b3f8a,_0x491fa8){return db[_0x7477('0xbe')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x7477('0xbf')}})[_0x7477('0x1b')](function(_0x11bc88){var _0x5f99e2=![];if(!_0x2b3f8a[_0x7477('0x38')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x2b3f8a[_0x7477('0x38')][_0x7477('0xc0')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x2b3f8a[_0x7477('0x38')][_0x7477('0xc0')][_0x7477('0xc1')]){throw new Error(_0x7477('0xaf'));}if(!_0x2b3f8a['body']['socket_timestamp']){throw new Error(_0x7477('0xc2'));}var _0xeea14=require(_0x7477('0xb6'))[_0x7477('0xb7')](path[_0x7477('0x3d')](__dirname,_0x7477('0xc3')),[_0x2b3f8a[_0x7477('0x28')]['id'],JSON['stringify'](_0x2b3f8a['body']),JSON['stringify'](_0x11bc88)]);_0xeea14['on']('message',function(){_0x5f99e2=!![];return _0x491fa8[_0x7477('0x12')](0xc8)[_0x7477('0x13')]({'message':_0x7477('0xc4'),'pid':_0xeea14[_0x7477('0xbb')]});});_0xeea14['on'](_0x7477('0xc5'),function(_0xb40c3f){if(_0xb40c3f&&!_0x5f99e2){return _0x491fa8['status'](0x1f4)[_0x7477('0x13')]({'message':'error\x20child\x20process','pid':_0xeea14[_0x7477('0xbb')]});}});})['catch'](handleError(_0x491fa8,null));};exports[_0x7477('0xc6')]=function(_0x3301e1,_0x4cd3b8){return db[_0x7477('0xbe')][_0x7477('0x22')]({'raw':!![],'attributes':['id'],'where':{'role':_0x7477('0xbf')}})[_0x7477('0x1b')](function(_0x476c97){var _0x38406f=![];if(!_0x3301e1[_0x7477('0x38')][_0x7477('0x61')]){throw new Error(_0x7477('0xc7'));}if(!_0x3301e1[_0x7477('0x38')][_0x7477('0xc0')]['phone']){throw new Error(_0x7477('0xc8'));}if(!_0x3301e1[_0x7477('0x38')][_0x7477('0xc0')][_0x7477('0xc1')]){throw new Error(_0x7477('0xaf'));}if(!_0x3301e1[_0x7477('0x38')]['socket_timestamp']){throw new Error(_0x7477('0xc2'));}var _0x4e2657=require(_0x7477('0xb6'))[_0x7477('0xb7')](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x3301e1[_0x7477('0x28')]['id'],JSON[_0x7477('0xc9')](_0x3301e1[_0x7477('0x38')]),JSON['stringify'](_0x476c97)]);_0x4e2657['on'](_0x7477('0xca'),function(){_0x38406f=!![];return _0x4cd3b8['status'](0xc8)['json']({'message':_0x7477('0xc4'),'pid':_0x4e2657[_0x7477('0xbb')]});});_0x4e2657['on'](_0x7477('0xc5'),function(_0x53e335){if(_0x53e335&&!_0x38406f){return _0x4cd3b8['status'](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0x4e2657[_0x7477('0xbb')]});}});})[_0x7477('0x24')](handleError(_0x4cd3b8,null));};exports[_0x7477('0xcb')]=function(_0x246ad6,_0x1d8641){var _0x239945=[_0x7477('0xcc'),_0x7477('0xcd'),_0x7477('0xce'),'openchannel','fax',_0x7477('0xcf'),'voice'];var _0x41adbf={'offset':0x0,'order':qs[_0x7477('0x82')](_0x7477('0xd0'))},_0x3c67e4={'count':0x0,'rows':[]};Promise[_0x7477('0xd1')]()[_0x7477('0x1b')](function(){if(_0x246ad6[_0x7477('0x23')][_0x7477('0xd2')]){if(!_['includes'](_0x239945,_0x246ad6[_0x7477('0x23')][_0x7477('0xd2')][_0x7477('0xd3')]())){throw new Error(_0x7477('0xd4'));}_0x239945=[_0x246ad6[_0x7477('0x23')]['channel'][_0x7477('0xd3')]()];}if(_0x246ad6['query']['range']){try{var _0x177a59=JSON[_0x7477('0xd5')](_0x246ad6['query']['range']);if(!moment(_0x177a59['from'])[_0x7477('0xd6')]()){throw new Error(_0x7477('0xd7'));}if(!moment(_0x177a59['to'])[_0x7477('0xd6')]()){throw new Error(_0x7477('0xd8'));}}catch(_0x11e087){throw new Error(_0x7477('0xd9'));}}if(!_0x246ad6[_0x7477('0x23')][_0x7477('0x36')]('nolimit')){_0x41adbf[_0x7477('0x17')]=qs[_0x7477('0x17')](_0x246ad6[_0x7477('0x23')][_0x7477('0x17')]||0xa);_0x41adbf[_0x7477('0x14')]=qs[_0x7477('0x14')](_0x246ad6[_0x7477('0x23')][_0x7477('0x14')]);}var _0x4750ae=_0x239945[_0x7477('0x6d')](function(_0x4b8b9a){if(_0x4b8b9a===_0x7477('0xda')){var _0x3f4714={'attributes':['id',_0x7477('0xdb'),'type',_0x7477('0xdc'),_0x7477('0xdd'),'callerid','starttime',_0x7477('0xde'),_0x7477('0xdf'),_0x7477('0xe0'),'createdAt',_0x7477('0xe1'),_0x7477('0xe2'),_0x7477('0xe3'),_0x7477('0xe4')],'where':{'ContactId':_0x246ad6['params']['id']},'include':[{'model':db[_0x7477('0xbe')],'as':_0x7477('0xbe'),'attributes':['id',_0x7477('0x1e'),_0x7477('0xe5'),'alias']}],'order':[[_0x7477('0xe6'),_0x7477('0xe7')]]};if(_0x246ad6[_0x7477('0x23')][_0x7477('0xe8')]){_0x3f4714['where'][_0x7477('0xe6')]={'$gte':_0x177a59[_0x7477('0x3f')],'$lte':_0x177a59['to']};}return db[_0x7477('0xe9')][_0x7477('0xea')](_0x3f4714)[_0x7477('0x1b')](function(_0x2561d9){_0x3c67e4[_0x7477('0x16')]+=_0x2561d9[_0x7477('0x16')];return _['map'](_0x2561d9['rows'],function(_0x3e762b){var _0x3b0d93=_0x3e762b[_0x7477('0x3a')]({'plain':!![]});_0x3b0d93[_0x7477('0xd2')]=_0x4b8b9a;if(_0x3b0d93[_0x7477('0xbe')]){_0x3b0d93[_0x7477('0xbe')]={'id':_0x3b0d93[_0x7477('0xbe')]['id'],'name':_0x3b0d93[_0x7477('0xbe')][_0x7477('0x1e')],'fullname':_0x3b0d93[_0x7477('0xbe')][_0x7477('0xe5')],'alias':_0x3b0d93[_0x7477('0xbe')][_0x7477('0xeb')]};}return _0x3b0d93;});});}else{var _0x3e6726=_[_0x7477('0xec')](_0x4b8b9a)+(_0x4b8b9a===_0x7477('0xcd')?_0x7477('0xed'):_0x7477('0xee'));var _0x44b60a={'attributes':['id',_0x7477('0xef'),_0x7477('0xf0'),_0x7477('0xe6'),'note',_0x7477('0xf1'),_0x7477('0xf2'),_0x7477('0xf3'),'UserId',_0x3e6726+'Id'],'where':{'ContactId':_0x246ad6[_0x7477('0x28')]['id']},'include':[{'model':db[_0x3e6726],'as':_0x7477('0xee'),'attributes':['id',_0x7477('0x1e'),'key']},{'model':db[_0x7477('0xbe')],'as':'Owner','attributes':['id','name',_0x7477('0xe5')]},{'model':db[_0x7477('0x64')],'as':_0x7477('0x65'),'attributes':['id',_0x7477('0x1e'),'color'],'through':{'attributes':[]}}],'order':[[_0x7477('0xe6'),_0x7477('0xe7')]]};if(_0x246ad6[_0x7477('0x23')][_0x7477('0xe8')]){_0x44b60a[_0x7477('0x5f')][_0x7477('0xe6')]={'$gte':_0x177a59[_0x7477('0x3f')],'$lte':_0x177a59['to']};}switch(_0x4b8b9a){case _0x7477('0xcd'):_0x44b60a[_0x7477('0x81')][_0x7477('0x60')](_0x7477('0xf4'),_0x7477('0xf5'),_0x7477('0xf6'),_0x7477('0xf7'),_0x7477('0xf8'),'ratingMessage',_0x7477('0xf9'),_0x7477('0xfa'),'referer');break;case'mail':_0x44b60a[_0x7477('0x81')]['push'](_0x7477('0xfb'),'substatus');break;case _0x7477('0xfc'):_0x44b60a[_0x7477('0x81')][_0x7477('0x60')](_0x7477('0xfd'),_0x7477('0xfe'));break;}return db[_['startCase'](_0x4b8b9a)+_0x7477('0xff')][_0x7477('0xea')](_0x44b60a)['then'](function(_0x3a5de2){_0x3c67e4['count']+=_0x3a5de2[_0x7477('0x16')];return _[_0x7477('0x6d')](_0x3a5de2['rows'],function(_0x2db7b0){var _0x4fdb57=_0x2db7b0[_0x7477('0x3a')]({'plain':!![]});_0x4fdb57['channel']=_0x4b8b9a;if(_0x4fdb57[_0x7477('0x100')]){_0x4fdb57[_0x7477('0x100')]={'id':_0x4fdb57[_0x7477('0x100')]['id'],'name':_0x4fdb57[_0x7477('0x100')][_0x7477('0x1e')],'fullname':_0x4fdb57[_0x7477('0x100')]['fullname']};}return _0x4fdb57;});});}});return Promise[_0x7477('0x63')](_0x4750ae);})[_0x7477('0x1b')](function(_0x46917b){return _(_0x46917b)[_0x7477('0x101')]()[_0x7477('0x102')](_0x7477('0xe6'))[_0x7477('0x103')]()['value']();})[_0x7477('0x1b')](function(_0x3ced76){_0x3c67e4[_0x7477('0xa3')]=_0x41adbf[_0x7477('0x17')]?_0x3ced76[_0x7477('0x104')](_0x41adbf[_0x7477('0x14')],_0x41adbf[_0x7477('0x14')]+_0x41adbf[_0x7477('0x17')]):_0x3ced76;return _0x3c67e4;})[_0x7477('0x1b')](respondWithFilteredResult(_0x1d8641,_0x41adbf))[_0x7477('0x24')](handleError(_0x1d8641,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 8e1a0d4..6b7698b 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 _0x2e62=['update','remove','emit','hasOwnProperty','hook','exports','events','CmContact','setMaxListeners','save'];(function(_0x58a888,_0x2432db){var _0x23049c=function(_0x517fbb){while(--_0x517fbb){_0x58a888['push'](_0x58a888['shift']());}};_0x23049c(++_0x2432db);}(_0x2e62,0x1be));var _0x22e6=function(_0x38c471,_0x5888bd){_0x38c471=_0x38c471-0x0;var _0x452335=_0x2e62[_0x38c471];return _0x452335;};'use strict';var EventEmitter=require(_0x22e6('0x0'));var CmContact=require('../../mysqldb')['db'][_0x22e6('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x22e6('0x2')](0x0);var events={'afterCreate':_0x22e6('0x3'),'afterUpdate':_0x22e6('0x4'),'afterDestroy':_0x22e6('0x5')};function emitEvent(_0xfbbe1d){return function(_0x129f5f,_0x3deae7,_0x42be13){CmContactEvents[_0x22e6('0x6')](_0xfbbe1d+':'+_0x129f5f['id'],_0x129f5f);CmContactEvents[_0x22e6('0x6')](_0xfbbe1d,_0x129f5f);_0x42be13(null);};}for(var e in events){if(events[_0x22e6('0x7')](e)){var event=events[e];CmContact[_0x22e6('0x8')](e,emitEvent(event));}}module[_0x22e6('0x9')]=CmContactEvents; \ No newline at end of file +var _0xcd06=['../../mysqldb','CmContact','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcd06,0xf9));var _0x6cd0=function(_0x2c783e,_0x3287a5){_0x2c783e=_0x2c783e-0x0;var _0x3066ca=_0xcd06[_0x2c783e];return _0x3066ca;};'use strict';var EventEmitter=require(_0x6cd0('0x0'));var CmContact=require(_0x6cd0('0x1'))['db'][_0x6cd0('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x6cd0('0x3')](0x0);var events={'afterCreate':_0x6cd0('0x4'),'afterUpdate':'update','afterDestroy':_0x6cd0('0x5')};function emitEvent(_0x229fb7){return function(_0x13ccc5,_0x107d5e,_0x1016f7){CmContactEvents[_0x6cd0('0x6')](_0x229fb7+':'+_0x13ccc5['id'],_0x13ccc5);CmContactEvents[_0x6cd0('0x6')](_0x229fb7,_0x13ccc5);_0x1016f7(null);};}for(var e in events){if(events[_0x6cd0('0x7')](e)){var event=events[e];CmContact[_0x6cd0('0x8')](e,emitEvent(event));}}module[_0x6cd0('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index c7b5d3e..5736a05 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 _0x4b7e=['scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','findOne','then','isNil','resolve','utcOffset','add','minutes','phone','ListId','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','dialCheckDuplicateType','always','onlyIfOpen','findAll','outbound','CmList','Lists','map','all','BlackLists','CmHopperBlack','exports','CmContact','cm_contacts','fti_cm_contacts','firstName','mobile','fax','email','FULLTEXT','utf8mb4','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message','isEmpty','length','destroy','push','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','../../config/environment/shared','Campaign','VoiceQueue'];(function(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0x4b7e,0x149));var _0xe4b7=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x4b7e[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xe4b7('0x0'));var util=require('util');var logger=require(_0xe4b7('0x1'))(_0xe4b7('0x2'));var moment=require('moment');var shared=require(_0xe4b7('0x3'));var attributes=require('./cmContact.attributes');function getTimezoneCallbackAt(_0x154caf,_0x2db3ec,_0x6b3013,_0x35c00d){var _0x1b767e=_0x35c00d?_0xe4b7('0x4'):_0xe4b7('0x5');var _0x36857=_0x6b3013[_0xe4b7('0x6')]?_0x6b3013[_0xe4b7('0x6')]:moment()[_0xe4b7('0x7')](_0xe4b7('0x8'));if(_['isNil'](_0x6b3013[_0xe4b7('0x9')])){return Promise['resolve'](_0x36857);}return _0x154caf[_0x1b767e][_0xe4b7('0xa')]({'where':{'id':_0x2db3ec}})[_0xe4b7('0xb')](function(_0x550229){if(_['isNil'](_0x550229)||_[_0xe4b7('0xc')](_0x550229[_0xe4b7('0x9')])){return Promise['resolve'](_0x36857);}var _0x69769=shared['timezones'];var _0xdaeaf0=_0x69769[_0x550229['dialTimezone']];var _0x4256b9=_0x69769[_0x6b3013[_0xe4b7('0x9')]];if(_[_0xe4b7('0xc')](_0xdaeaf0)&&_[_0xe4b7('0xc')](_0x4256b9)){return Promise[_0xe4b7('0xd')](_0x36857);}var _0x2e1e61=_0xdaeaf0[_0xe4b7('0xe')]-_0x4256b9[_0xe4b7('0xe')];var _0x456cd4=_0x6b3013[_0xe4b7('0x6')]?_0x6b3013[_0xe4b7('0x6')]:moment();_0x36857=moment(_0x456cd4)[_0xe4b7('0xf')](_0x2e1e61,_0xe4b7('0x10'))[_0xe4b7('0x7')](_0xe4b7('0x8'));return Promise['resolve'](_0x36857);});}function getNewHopperPayload(_0xbe3590){return{'phone':_0xbe3590[_0xe4b7('0x11')],'ContactId':_0xbe3590['id'],'ListId':_0xbe3590[_0xe4b7('0x12')],'scheduledat':_0xbe3590[_0xe4b7('0x6')]?_0xbe3590[_0xe4b7('0x6')]:moment()[_0xe4b7('0x7')](_0xe4b7('0x8')),'priority':_0xbe3590[_0xe4b7('0x13')]?_0xbe3590[_0xe4b7('0x13')]:0x2,'callback':_0xbe3590[_0xe4b7('0x14')]?!![]:![],'callbackuniqueid':_0xbe3590[_0xe4b7('0x14')]?_0xbe3590['callbackUniqueid']:undefined,'callbackat':_0xbe3590[_0xe4b7('0x14')]?moment()[_0xe4b7('0x7')](_0xe4b7('0x8')):undefined};}function handleAlwaysCheckDuplicate(_0x7b47df,_0x2a6fc1,_0x1805b5,_0xdc883c){var _0x388c4f={'phone':_0x1805b5[_0xe4b7('0x11')]};var _0x54e17c={'calleridnum':_0x1805b5[_0xe4b7('0x11')]};if(_0xdc883c){Object[_0xe4b7('0x15')](_0x388c4f,{'CampaignId':_0x2a6fc1['id']});Object[_0xe4b7('0x15')](_0x54e17c,{'CampaignId':_0x2a6fc1['id']});}else{Object['assign'](_0x388c4f,{'VoiceQueueId':_0x2a6fc1['id']});Object[_0xe4b7('0x15')](_0x54e17c,{'VoiceQueueId':_0x2a6fc1['id']});}return _0x7b47df[_0xe4b7('0x16')]['findOne']({'where':_0x388c4f})[_0xe4b7('0xb')](function(_0x19d14f){if(_0x19d14f){throw new Error(_0xe4b7('0x17')+_0x1805b5[_0xe4b7('0x11')]+_0xe4b7('0x18')+_0x2a6fc1['id']);}return _0x7b47df[_0xe4b7('0x19')]['findOne']({'where':_0x54e17c});})[_0xe4b7('0xb')](function(_0x5a2607){if(_0x5a2607){throw new Error(_0xe4b7('0x1a')+_0x1805b5['phone']+_0xe4b7('0x18')+_0x2a6fc1['id']);}var _0x3c82a3=getNewHopperPayload(_0x1805b5);if(_0xdc883c){_0x3c82a3[_0xe4b7('0x1b')]=_0x2a6fc1['id'];}else{_0x3c82a3[_0xe4b7('0x1c')]=_0x2a6fc1['id'];}return _0x7b47df[_0xe4b7('0x16')][_0xe4b7('0x1d')](_0x3c82a3);});}function handleOnlyIfOpenCheckDuplicate(_0x4eb311,_0x58377c,_0x47a182,_0x207c11){var _0x54adc7={'phone':_0x47a182['phone']};if(_0x207c11){Object[_0xe4b7('0x15')](_0x54adc7,{'CampaignId':_0x58377c['id']});}else{Object[_0xe4b7('0x15')](_0x54adc7,{'VoiceQueueId':_0x58377c['id']});}return _0x4eb311[_0xe4b7('0x16')]['findOne']({'where':_0x54adc7})[_0xe4b7('0xb')](function(_0x28483a){if(_0x28483a){throw new Error(_0xe4b7('0x1e')+_0x47a182['phone']+'\x20in\x20Campaign\x20with\x20id\x20'+_0x58377c['id']);}var _0x3e27b0=getNewHopperPayload(_0x47a182);if(_0x207c11){_0x3e27b0[_0xe4b7('0x1b')]=_0x58377c['id'];}else{_0x3e27b0[_0xe4b7('0x1c')]=_0x58377c['id'];}return _0x4eb311[_0xe4b7('0x16')][_0xe4b7('0x1d')](_0x3e27b0);});}function handleNeverCheckDuplicate(_0x3e5f5d,_0x43b73b,_0x1982a8){var _0x33e2c2=getNewHopperPayload(_0x1982a8);_0x33e2c2[_0xe4b7('0x1c')]=_0x43b73b['id'];return _0x3e5f5d[_0xe4b7('0x16')][_0xe4b7('0x1d')](_0x33e2c2);}function handleCheckDuplicate(_0x16dac1,_0x56a390,_0x10ba56,_0x33ec11){return getTimezoneCallbackAt(_0x16dac1,_0x56a390,_0x10ba56,_0x33ec11)[_0xe4b7('0xb')](function(_0x3f6675){_0x10ba56['scheduledat']=_0x3f6675;switch(_0x56a390[_0xe4b7('0x1f')]){case _0xe4b7('0x20'):return handleAlwaysCheckDuplicate(_0x16dac1,_0x56a390,_0x10ba56,_0x33ec11);case _0xe4b7('0x21'):return handleOnlyIfOpenCheckDuplicate(_0x16dac1,_0x56a390,_0x10ba56,_0x33ec11);default:return handleNeverCheckDuplicate(_0x16dac1,_0x56a390,_0x10ba56);}});}function createHopperForVoiceQueues(_0x40b6c8,_0x4c36fc){return _0x40b6c8[_0xe4b7('0x5')][_0xe4b7('0x22')]({'where':{'type':_0xe4b7('0x23')},'attributes':['id',_0xe4b7('0x1f'),_0xe4b7('0x9')],'include':[{'model':_0x40b6c8[_0xe4b7('0x24')],'as':_0xe4b7('0x25'),'where':{'id':_0x4c36fc[_0xe4b7('0x12')]}}],'raw':!![]})[_0xe4b7('0xb')](function(_0x1eff63){var _0x3d2d41=_0x1eff63[_0xe4b7('0x26')](function(_0x34d4da){return handleCheckDuplicate(_0x40b6c8,_0x34d4da,_0x4c36fc,![]);});return Promise[_0xe4b7('0x27')](_0x3d2d41);});}function createHopperForCampaigns(_0x517efa,_0x4e03ac){return _0x517efa['Campaign'][_0xe4b7('0x22')]({'attributes':['id','dialCheckDuplicateType',_0xe4b7('0x9')],'include':[{'model':_0x517efa[_0xe4b7('0x24')],'as':_0xe4b7('0x25'),'where':{'id':_0x4e03ac[_0xe4b7('0x12')]}}],'raw':!![]})[_0xe4b7('0xb')](function(_0x2640f4){var _0x1524c4=_0x2640f4[_0xe4b7('0x26')](function(_0x637bf3){return handleCheckDuplicate(_0x517efa,_0x637bf3,_0x4e03ac,!![]);});return Promise['all'](_0x1524c4);});}function createHopperBlackForVoiceQueues(_0x4555a1,_0x5e4a7a){return _0x4555a1['VoiceQueue'][_0xe4b7('0x22')]({'where':{'type':_0xe4b7('0x23')},'attributes':['id'],'include':[{'model':_0x4555a1[_0xe4b7('0x24')],'as':_0xe4b7('0x28'),'where':{'id':_0x5e4a7a[_0xe4b7('0x12')]}}],'raw':!![]})[_0xe4b7('0xb')](function(_0x1d35ca){var _0x2cccaa=_0x1d35ca['map'](function(_0x549de5){return _0x4555a1[_0xe4b7('0x29')][_0xe4b7('0x1d')]({'phone':_0x5e4a7a[_0xe4b7('0x11')],'ContactId':_0x5e4a7a['id'],'ListId':_0x5e4a7a[_0xe4b7('0x12')],'VoiceQueueId':_0x549de5['id']});});return Promise[_0xe4b7('0x27')](_0x2cccaa);});}function createHopperBlackForCampaigns(_0x1fdf1c,_0x1ff58b){return _0x1fdf1c[_0xe4b7('0x4')][_0xe4b7('0x22')]({'attributes':['id'],'include':[{'model':_0x1fdf1c[_0xe4b7('0x24')],'as':_0xe4b7('0x28'),'where':{'id':_0x1ff58b[_0xe4b7('0x12')]}}],'raw':!![]})[_0xe4b7('0xb')](function(_0x385382){var _0x4e7839=_0x385382['map'](function(_0x19b949){return _0x1fdf1c[_0xe4b7('0x29')]['create']({'phone':_0x1ff58b[_0xe4b7('0x11')],'ContactId':_0x1ff58b['id'],'ListId':_0x1ff58b['ListId'],'CampaignId':_0x19b949['id']});});return Promise[_0xe4b7('0x27')](_0x4e7839);});}module[_0xe4b7('0x2a')]=function(_0xe6bac2){return _0xe6bac2['define'](_0xe4b7('0x2b'),attributes,{'tableName':_0xe4b7('0x2c'),'paranoid':!![],'indexes':[{'name':_0xe4b7('0x11'),'fields':[_0xe4b7('0x11')]},{'name':_0xe4b7('0x2d'),'fields':[_0xe4b7('0x2e'),'lastName',_0xe4b7('0x11'),_0xe4b7('0x2f'),_0xe4b7('0x30'),_0xe4b7('0x31')],'type':_0xe4b7('0x32')}],'timestamps':!![],'charset':_0xe4b7('0x33'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x26e407,_0x4a1bf0,_0x25e99f){var _0x1546d4=_0xe6bac2[_0xe4b7('0x34')];var _0x305d4a=_0x26e407[_0xe4b7('0x35')]({'plain':!![]});if(!_0x305d4a[_0xe4b7('0x12')]){logger[_0xe4b7('0x36')](_0xe4b7('0x37')+_0x305d4a['id']);return _0x25e99f();}if(!_0x305d4a[_0xe4b7('0x11')]){return _0x25e99f();}return createHopperForVoiceQueues(_0x1546d4,_0x305d4a)['then'](function(){return createHopperBlackForVoiceQueues(_0x1546d4,_0x305d4a);})[_0xe4b7('0xb')](function(){return createHopperForCampaigns(_0x1546d4,_0x305d4a);})[_0xe4b7('0xb')](function(){return createHopperBlackForCampaigns(_0x1546d4,_0x305d4a);})[_0xe4b7('0xb')](function(){return _0x25e99f();})[_0xe4b7('0x38')](function(_0x2dd132){logger[_0xe4b7('0x36')](_0xe4b7('0x39'),_0x2dd132[_0xe4b7('0x3a')]);_0x25e99f();});},'afterDestroy':function(_0x47e79c,_0x4e1555,_0x58ee4d){var _0x35015d=_0xe6bac2[_0xe4b7('0x34')];var _0x449d60=_0x47e79c[_0xe4b7('0x35')]({'plain':!![]});return _0x35015d[_0xe4b7('0x16')]['findAll']({'raw':!![],'where':{'ListId':_0x449d60[_0xe4b7('0x12')],'ContactId':_0x449d60['id']}})[_0xe4b7('0xb')](function(_0x463fba){if(!_[_0xe4b7('0x3b')](_0x463fba)){var _0xf2e361=[];for(var _0x547ef0=0x0;_0x547ef0<_0x463fba[_0xe4b7('0x3c')];_0x547ef0+=0x1){var _0xf27f4e=_0x35015d['CmHopper'][_0xe4b7('0x3d')]({'where':{'ListId':_0x463fba[_0x547ef0][_0xe4b7('0x12')],'ContactId':_0x463fba[_0x547ef0]['ContactId'],'VoiceQueueId':_0x463fba[_0x547ef0][_0xe4b7('0x1c')],'CampaignId':_0x463fba[_0x547ef0][_0xe4b7('0x1b')]}});_0xf2e361[_0xe4b7('0x3e')](_0xf27f4e);}return Promise[_0xe4b7('0x27')](_0xf2e361);}})[_0xe4b7('0xb')](function(_0x417213){logger[_0xe4b7('0x3f')](_0xe4b7('0x40'),util[_0xe4b7('0x41')](_0x417213,{'showHidden':![],'depth':null}));_0x58ee4d();})[_0xe4b7('0x38')](function(_0x12f48b){logger[_0xe4b7('0x36')](_0xe4b7('0x42'),util[_0xe4b7('0x41')](_0x12f48b,{'showHidden':![],'depth':null}));_0x58ee4d(_0x12f48b);});}}});}; \ No newline at end of file +var _0xdb9b=['exports','define','cm_contacts','fti_cm_contacts','firstName','lastName','mobile','fax','email','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]','message','isEmpty','push','info','[CmContact][afterDestroy][Succesfull]','inspect','catch','[CmContact][afterDestroy][Error]','lodash','util','api','moment','Campaign','VoiceQueue','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','findOne','utcOffset','add','minutes','format','ListId','callbackUniqueid','phone','assign','CmHopper','then','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','dialCheckDuplicateType','always','findAll','outbound','CmList','map','all','Lists','BlackLists'];(function(_0x246f50,_0x19aac6){var _0x4c50f3=function(_0x4b890a){while(--_0x4b890a){_0x246f50['push'](_0x246f50['shift']());}};_0x4c50f3(++_0x19aac6);}(_0xdb9b,0x185));var _0xbdb9=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xdb9b[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0xbdb9('0x0'));var util=require(_0xbdb9('0x1'));var logger=require('../../config/logger')(_0xbdb9('0x2'));var moment=require(_0xbdb9('0x3'));var shared=require('../../config/environment/shared');var attributes=require('./cmContact.attributes');function getTimezoneCallbackAt(_0x4725c0,_0x729143,_0x2e3405,_0x554969){var _0x192839=_0x554969?_0xbdb9('0x4'):_0xbdb9('0x5');var _0x399cbc=_0x2e3405[_0xbdb9('0x6')]?_0x2e3405[_0xbdb9('0x6')]:moment()['format'](_0xbdb9('0x7'));if(_[_0xbdb9('0x8')](_0x2e3405[_0xbdb9('0x9')])){return Promise[_0xbdb9('0xa')](_0x399cbc);}return _0x4725c0[_0x192839][_0xbdb9('0xb')]({'where':{'id':_0x729143}})['then'](function(_0x5e9f5f){if(_[_0xbdb9('0x8')](_0x5e9f5f)||_['isNil'](_0x5e9f5f[_0xbdb9('0x9')])){return Promise[_0xbdb9('0xa')](_0x399cbc);}var _0xdc57c8=shared['timezones'];var _0x34c53f=_0xdc57c8[_0x5e9f5f[_0xbdb9('0x9')]];var _0x1deb10=_0xdc57c8[_0x2e3405[_0xbdb9('0x9')]];if(_[_0xbdb9('0x8')](_0x34c53f)&&_[_0xbdb9('0x8')](_0x1deb10)){return Promise[_0xbdb9('0xa')](_0x399cbc);}var _0x2e7633=_0x34c53f[_0xbdb9('0xc')]-_0x1deb10[_0xbdb9('0xc')];var _0xd53871=_0x2e3405['scheduledat']?_0x2e3405[_0xbdb9('0x6')]:moment();_0x399cbc=moment(_0xd53871)[_0xbdb9('0xd')](_0x2e7633,_0xbdb9('0xe'))[_0xbdb9('0xf')](_0xbdb9('0x7'));return Promise[_0xbdb9('0xa')](_0x399cbc);});}function getNewHopperPayload(_0x54ad15){return{'phone':_0x54ad15['phone'],'ContactId':_0x54ad15['id'],'ListId':_0x54ad15[_0xbdb9('0x10')],'scheduledat':_0x54ad15[_0xbdb9('0x6')]?_0x54ad15[_0xbdb9('0x6')]:moment()[_0xbdb9('0xf')](_0xbdb9('0x7')),'priority':_0x54ad15['priority']?_0x54ad15['priority']:0x2,'callback':_0x54ad15[_0xbdb9('0x11')]?!![]:![],'callbackuniqueid':_0x54ad15[_0xbdb9('0x11')]?_0x54ad15['callbackUniqueid']:undefined,'callbackat':_0x54ad15[_0xbdb9('0x11')]?moment()['format'](_0xbdb9('0x7')):undefined};}function handleAlwaysCheckDuplicate(_0xf3bf44,_0x563b3e,_0x549d5a,_0x4d76e4){var _0x229eb3={'phone':_0x549d5a[_0xbdb9('0x12')]};var _0x39fe56={'calleridnum':_0x549d5a['phone']};if(_0x4d76e4){Object[_0xbdb9('0x13')](_0x229eb3,{'CampaignId':_0x563b3e['id']});Object[_0xbdb9('0x13')](_0x39fe56,{'CampaignId':_0x563b3e['id']});}else{Object[_0xbdb9('0x13')](_0x229eb3,{'VoiceQueueId':_0x563b3e['id']});Object[_0xbdb9('0x13')](_0x39fe56,{'VoiceQueueId':_0x563b3e['id']});}return _0xf3bf44[_0xbdb9('0x14')]['findOne']({'where':_0x229eb3})[_0xbdb9('0x15')](function(_0x1cceb2){if(_0x1cceb2){throw new Error('[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x549d5a[_0xbdb9('0x12')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x563b3e['id']);}return _0xf3bf44[_0xbdb9('0x16')]['findOne']({'where':_0x39fe56});})[_0xbdb9('0x15')](function(_0x11c310){if(_0x11c310){throw new Error(_0xbdb9('0x17')+_0x549d5a[_0xbdb9('0x12')]+_0xbdb9('0x18')+_0x563b3e['id']);}var _0x5b10a1=getNewHopperPayload(_0x549d5a);if(_0x4d76e4){_0x5b10a1['CampaignId']=_0x563b3e['id'];}else{_0x5b10a1['VoiceQueueId']=_0x563b3e['id'];}return _0xf3bf44[_0xbdb9('0x14')][_0xbdb9('0x19')](_0x5b10a1);});}function handleOnlyIfOpenCheckDuplicate(_0x4bf849,_0x58fa94,_0x49a391,_0x50135e){var _0x58d096={'phone':_0x49a391[_0xbdb9('0x12')]};if(_0x50135e){Object['assign'](_0x58d096,{'CampaignId':_0x58fa94['id']});}else{Object['assign'](_0x58d096,{'VoiceQueueId':_0x58fa94['id']});}return _0x4bf849[_0xbdb9('0x14')][_0xbdb9('0xb')]({'where':_0x58d096})['then'](function(_0x4b3d40){if(_0x4b3d40){throw new Error(_0xbdb9('0x1a')+_0x49a391[_0xbdb9('0x12')]+_0xbdb9('0x18')+_0x58fa94['id']);}var _0x3d931b=getNewHopperPayload(_0x49a391);if(_0x50135e){_0x3d931b[_0xbdb9('0x1b')]=_0x58fa94['id'];}else{_0x3d931b['VoiceQueueId']=_0x58fa94['id'];}return _0x4bf849['CmHopper'][_0xbdb9('0x19')](_0x3d931b);});}function handleNeverCheckDuplicate(_0x18c74f,_0x2e93da,_0xa952dc){var _0x3f7f6a=getNewHopperPayload(_0xa952dc);_0x3f7f6a[_0xbdb9('0x1c')]=_0x2e93da['id'];return _0x18c74f['CmHopper'][_0xbdb9('0x19')](_0x3f7f6a);}function handleCheckDuplicate(_0x1be2db,_0x1342c2,_0x1ce5f9,_0x47c601){return getTimezoneCallbackAt(_0x1be2db,_0x1342c2,_0x1ce5f9,_0x47c601)[_0xbdb9('0x15')](function(_0x39da12){_0x1ce5f9[_0xbdb9('0x6')]=_0x39da12;switch(_0x1342c2[_0xbdb9('0x1d')]){case _0xbdb9('0x1e'):return handleAlwaysCheckDuplicate(_0x1be2db,_0x1342c2,_0x1ce5f9,_0x47c601);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x1be2db,_0x1342c2,_0x1ce5f9,_0x47c601);default:return handleNeverCheckDuplicate(_0x1be2db,_0x1342c2,_0x1ce5f9);}});}function createHopperForVoiceQueues(_0x116666,_0x2163e5){return _0x116666['VoiceQueue'][_0xbdb9('0x1f')]({'where':{'type':_0xbdb9('0x20')},'attributes':['id',_0xbdb9('0x1d'),'dialTimezone'],'include':[{'model':_0x116666[_0xbdb9('0x21')],'as':'Lists','where':{'id':_0x2163e5['ListId']}}],'raw':!![]})['then'](function(_0x270fd7){var _0x342d0=_0x270fd7[_0xbdb9('0x22')](function(_0x528422){return handleCheckDuplicate(_0x116666,_0x528422,_0x2163e5,![]);});return Promise[_0xbdb9('0x23')](_0x342d0);});}function createHopperForCampaigns(_0x84c1b1,_0x12569b){return _0x84c1b1[_0xbdb9('0x4')][_0xbdb9('0x1f')]({'attributes':['id',_0xbdb9('0x1d'),_0xbdb9('0x9')],'include':[{'model':_0x84c1b1[_0xbdb9('0x21')],'as':_0xbdb9('0x24'),'where':{'id':_0x12569b[_0xbdb9('0x10')]}}],'raw':!![]})[_0xbdb9('0x15')](function(_0x2c4b33){var _0x5a368f=_0x2c4b33[_0xbdb9('0x22')](function(_0x19a167){return handleCheckDuplicate(_0x84c1b1,_0x19a167,_0x12569b,!![]);});return Promise['all'](_0x5a368f);});}function createHopperBlackForVoiceQueues(_0x4fea11,_0x387b94){return _0x4fea11[_0xbdb9('0x5')][_0xbdb9('0x1f')]({'where':{'type':_0xbdb9('0x20')},'attributes':['id'],'include':[{'model':_0x4fea11[_0xbdb9('0x21')],'as':_0xbdb9('0x25'),'where':{'id':_0x387b94[_0xbdb9('0x10')]}}],'raw':!![]})[_0xbdb9('0x15')](function(_0x2a94ef){var _0x130509=_0x2a94ef[_0xbdb9('0x22')](function(_0x33ee6c){return _0x4fea11['CmHopperBlack'][_0xbdb9('0x19')]({'phone':_0x387b94[_0xbdb9('0x12')],'ContactId':_0x387b94['id'],'ListId':_0x387b94['ListId'],'VoiceQueueId':_0x33ee6c['id']});});return Promise[_0xbdb9('0x23')](_0x130509);});}function createHopperBlackForCampaigns(_0x50f9dd,_0x2da9b9){return _0x50f9dd['Campaign'][_0xbdb9('0x1f')]({'attributes':['id'],'include':[{'model':_0x50f9dd[_0xbdb9('0x21')],'as':_0xbdb9('0x25'),'where':{'id':_0x2da9b9[_0xbdb9('0x10')]}}],'raw':!![]})[_0xbdb9('0x15')](function(_0x286eaf){var _0x48a5ac=_0x286eaf[_0xbdb9('0x22')](function(_0x838ea7){return _0x50f9dd['CmHopperBlack'][_0xbdb9('0x19')]({'phone':_0x2da9b9['phone'],'ContactId':_0x2da9b9['id'],'ListId':_0x2da9b9['ListId'],'CampaignId':_0x838ea7['id']});});return Promise[_0xbdb9('0x23')](_0x48a5ac);});}module[_0xbdb9('0x26')]=function(_0x2515bb){return _0x2515bb[_0xbdb9('0x27')]('CmContact',attributes,{'tableName':_0xbdb9('0x28'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0xbdb9('0x12')]},{'name':_0xbdb9('0x29'),'fields':[_0xbdb9('0x2a'),_0xbdb9('0x2b'),_0xbdb9('0x12'),_0xbdb9('0x2c'),_0xbdb9('0x2d'),_0xbdb9('0x2e')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xbdb9('0x2f'),'collate':_0xbdb9('0x30'),'hooks':{'afterCreate':function(_0x29b0ae,_0x3017bf,_0x10ad87){var _0x425448=_0x2515bb[_0xbdb9('0x31')];var _0x708d0a=_0x29b0ae[_0xbdb9('0x32')]({'plain':!![]});if(!_0x708d0a['ListId']){logger[_0xbdb9('0x33')]('[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'+_0x708d0a['id']);return _0x10ad87();}if(!_0x708d0a[_0xbdb9('0x12')]){return _0x10ad87();}return createHopperForVoiceQueues(_0x425448,_0x708d0a)[_0xbdb9('0x15')](function(){return createHopperBlackForVoiceQueues(_0x425448,_0x708d0a);})[_0xbdb9('0x15')](function(){return createHopperForCampaigns(_0x425448,_0x708d0a);})['then'](function(){return createHopperBlackForCampaigns(_0x425448,_0x708d0a);})[_0xbdb9('0x15')](function(){return _0x10ad87();})['catch'](function(_0x1799ec){logger[_0xbdb9('0x33')](_0xbdb9('0x34'),_0x1799ec[_0xbdb9('0x35')]);_0x10ad87();});},'afterDestroy':function(_0x453c4f,_0x20f0b8,_0x24078c){var _0x38a764=_0x2515bb[_0xbdb9('0x31')];var _0x1649ed=_0x453c4f[_0xbdb9('0x32')]({'plain':!![]});return _0x38a764[_0xbdb9('0x14')][_0xbdb9('0x1f')]({'raw':!![],'where':{'ListId':_0x1649ed[_0xbdb9('0x10')],'ContactId':_0x1649ed['id']}})[_0xbdb9('0x15')](function(_0x293af1){if(!_[_0xbdb9('0x36')](_0x293af1)){var _0x383175=[];for(var _0x32c1ab=0x0;_0x32c1ab<_0x293af1['length'];_0x32c1ab+=0x1){var _0x2b4c93=_0x38a764['CmHopper']['destroy']({'where':{'ListId':_0x293af1[_0x32c1ab][_0xbdb9('0x10')],'ContactId':_0x293af1[_0x32c1ab]['ContactId'],'VoiceQueueId':_0x293af1[_0x32c1ab][_0xbdb9('0x1c')],'CampaignId':_0x293af1[_0x32c1ab][_0xbdb9('0x1b')]}});_0x383175[_0xbdb9('0x37')](_0x2b4c93);}return Promise[_0xbdb9('0x23')](_0x383175);}})[_0xbdb9('0x15')](function(_0x5ee3ce){logger[_0xbdb9('0x38')](_0xbdb9('0x39'),util[_0xbdb9('0x3a')](_0x5ee3ce,{'showHidden':![],'depth':null}));_0x24078c();})[_0xbdb9('0x3b')](function(_0x3dc2f8){logger[_0xbdb9('0x33')](_0xbdb9('0x3c'),util[_0xbdb9('0x3a')](_0x3dc2f8,{'showHidden':![],'depth':null}));_0x24078c(_0x3dc2f8);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index d9b7a8b..976ef44 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x5499a6,_0x2317ec){var _0x19b408=function(_0x487706){while(--_0x487706){_0x5499a6['push'](_0x5499a6['shift']());}};_0x19b408(++_0x2317ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 2cc74d0..62e1eb8 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 _0xaaa2=['sequelize','exports','INTEGER','STRING'];(function(_0x5ca11c,_0x2382e3){var _0x319387=function(_0x564ebf){while(--_0x564ebf){_0x5ca11c['push'](_0x5ca11c['shift']());}};_0x319387(++_0x2382e3);}(_0xaaa2,0xac));var _0x2aaa=function(_0x7724a5,_0x53fc73){_0x7724a5=_0x7724a5-0x0;var _0x3fad7d=_0xaaa2[_0x7724a5];return _0x3fad7d;};'use strict';var Sequelize=require(_0x2aaa('0x0'));module[_0x2aaa('0x1')]={'CmContactId':{'type':Sequelize[_0x2aaa('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x2aaa('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x2aaa('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x2aaa('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x2aaa('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x7a2c=['INTEGER','STRING','PHONE','sequelize'];(function(_0x5afcc0,_0x46ca28){var _0x10c0e4=function(_0xb32a2a){while(--_0xb32a2a){_0x5afcc0['push'](_0x5afcc0['shift']());}};_0x10c0e4(++_0x46ca28);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x5d3c5f,_0x9375b3){_0x5d3c5f=_0x5d3c5f-0x0;var _0x2e3b06=_0x7a2c[_0x5d3c5f];return _0x2e3b06;};'use strict';var Sequelize=require(_0xc7a2('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xc7a2('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xc7a2('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xc7a2('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xc7a2('0x2')],'defaultValue':_0xc7a2('0x3')},'OrderBy':{'type':Sequelize[_0xc7a2('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xc7a2('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 3214218..12e9f3d 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 _0x6e82=['type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','apply','reject','update','destroy','then','get','CmContactHasItems','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6e82,0x118));var _0x26e8=function(_0x15e812,_0x44748d){_0x15e812=_0x15e812-0x0;var _0x264014=_0x6e82[_0x15e812];return _0x264014;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x26e8('0x0'));var jsonpatch=require(_0x26e8('0x1'));var rp=require('request-promise');var moment=require(_0x26e8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x26e8('0x3'));var util=require(_0x26e8('0x4'));var path=require(_0x26e8('0x5'));var sox=require(_0x26e8('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x26e8('0x7'));var _=require('lodash');var squel=require(_0x26e8('0x8'));var crypto=require('crypto');var jsforce=require(_0x26e8('0x9'));var deskjs=require(_0x26e8('0xa'));var toCsv=require(_0x26e8('0xb'));var querystring=require(_0x26e8('0xc'));var Papa=require(_0x26e8('0xd'));var Redis=require(_0x26e8('0xe'));var authService=require(_0x26e8('0xf'));var qs=require(_0x26e8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x26e8('0x11'));var logger=require(_0x26e8('0x12'))('api');var utils=require(_0x26e8('0x13'));var config=require(_0x26e8('0x14'));var licenseUtil=require(_0x26e8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d9f34,_0x5d0aa7){_0x5d0aa7=_0x5d0aa7||0xcc;return function(_0x3bd8a6){if(_0x3bd8a6){return _0x4d9f34['sendStatus'](_0x5d0aa7);}return _0x4d9f34[_0x26e8('0x16')](_0x5d0aa7)[_0x26e8('0x17')]();};}function respondWithResult(_0x4baf97,_0x36bd7e){_0x36bd7e=_0x36bd7e||0xc8;return function(_0x72cd62){if(_0x72cd62){return _0x4baf97[_0x26e8('0x16')](_0x36bd7e)[_0x26e8('0x18')](_0x72cd62);}};}function respondWithFilteredResult(_0xdcf352,_0xc8c8f){return function(_0x5d24bd){if(_0x5d24bd){var _0xdbc1c=typeof _0xc8c8f[_0x26e8('0x19')]===_0x26e8('0x1a')&&typeof _0xc8c8f['limit']==='undefined';var _0x7ffe2c=_0x5d24bd[_0x26e8('0x1b')];var _0x79265e=_0xdbc1c?0x0:_0xc8c8f[_0x26e8('0x19')];var _0x10ab6a=_0xdbc1c?_0x5d24bd[_0x26e8('0x1b')]:_0xc8c8f[_0x26e8('0x19')]+_0xc8c8f[_0x26e8('0x1c')];var _0xd5e4ce;if(_0x10ab6a>=_0x7ffe2c){_0x10ab6a=_0x7ffe2c;_0xd5e4ce=0xc8;}else{_0xd5e4ce=0xce;}_0xdcf352[_0x26e8('0x16')](_0xd5e4ce);return _0xdcf352[_0x26e8('0x1d')]('Content-Range',_0x79265e+'-'+_0x10ab6a+'/'+_0x7ffe2c)['json'](_0x5d24bd);}return null;};}function patchUpdates(_0x445471){return function(_0x250e8a){try{jsonpatch[_0x26e8('0x1e')](_0x250e8a,_0x445471,!![]);}catch(_0x485334){return BPromise[_0x26e8('0x1f')](_0x485334);}return _0x250e8a['save']();};}function saveUpdates(_0x82de95,_0x3a1737){return function(_0x5248c4){if(_0x5248c4){return _0x5248c4[_0x26e8('0x20')](_0x82de95)['then'](function(_0xa63c){return _0xa63c;});}return null;};}function removeEntity(_0x2c786e,_0x3124c1){return function(_0x41136c){if(_0x41136c){return _0x41136c[_0x26e8('0x21')]()[_0x26e8('0x22')](function(){var _0x28bc05=_0x41136c[_0x26e8('0x23')]({'plain':!![]});var _0x50ea7f=_0x26e8('0x24');return db[_0x26e8('0x25')][_0x26e8('0x21')]({'where':{'type':_0x50ea7f,'resourceId':_0x28bc05['id']}})['then'](function(){return _0x41136c;});})['then'](function(){_0x2c786e['status'](0xcc)[_0x26e8('0x17')]();});}};}function handleEntityNotFound(_0xe4b7b7,_0x3e5737){return function(_0x1ca75e){if(!_0x1ca75e){_0xe4b7b7[_0x26e8('0x26')](0x194);}return _0x1ca75e;};}function handleError(_0x597b18,_0xce33a7){_0xce33a7=_0xce33a7||0x1f4;return function(_0x233555){logger[_0x26e8('0x27')](_0x233555[_0x26e8('0x28')]);if(_0x233555[_0x26e8('0x29')]){delete _0x233555[_0x26e8('0x29')];}_0x597b18[_0x26e8('0x16')](_0xce33a7)[_0x26e8('0x2a')](_0x233555);};}exports[_0x26e8('0x2b')]=function(_0x37263a,_0x536a41){var _0x417111={},_0x3ffac5={},_0x26621c={'count':0x0,'rows':[]};var _0x1eaa00=_[_0x26e8('0x2c')](db[_0x26e8('0x2d')][_0x26e8('0x2e')],function(_0x47e32c){return{'name':_0x47e32c[_0x26e8('0x2f')],'type':_0x47e32c[_0x26e8('0x30')][_0x26e8('0x31')]};});_0x3ffac5[_0x26e8('0x32')]=_[_0x26e8('0x2c')](_0x1eaa00,_0x26e8('0x29'));_0x3ffac5[_0x26e8('0x33')]=_[_0x26e8('0x34')](_0x37263a['query']);_0x3ffac5[_0x26e8('0x35')]=_['intersection'](_0x3ffac5[_0x26e8('0x32')],_0x3ffac5['query']);_0x417111[_0x26e8('0x36')]=_[_0x26e8('0x37')](_0x3ffac5[_0x26e8('0x32')],qs[_0x26e8('0x38')](_0x37263a[_0x26e8('0x33')][_0x26e8('0x38')]));_0x417111[_0x26e8('0x36')]=_0x417111[_0x26e8('0x36')][_0x26e8('0x39')]?_0x417111[_0x26e8('0x36')]:_0x3ffac5['model'];if(!_0x37263a[_0x26e8('0x33')][_0x26e8('0x3a')](_0x26e8('0x3b'))){_0x417111[_0x26e8('0x1c')]=qs[_0x26e8('0x1c')](_0x37263a['query']['limit']);_0x417111[_0x26e8('0x19')]=qs[_0x26e8('0x19')](_0x37263a[_0x26e8('0x33')][_0x26e8('0x19')]);}_0x417111[_0x26e8('0x3c')]=qs[_0x26e8('0x3d')](_0x37263a['query'][_0x26e8('0x3d')]);_0x417111[_0x26e8('0x3e')]=qs[_0x26e8('0x35')](_[_0x26e8('0x3f')](_0x37263a[_0x26e8('0x33')],_0x3ffac5[_0x26e8('0x35')]),_0x1eaa00);if(_0x37263a[_0x26e8('0x33')]['filter']){_0x417111[_0x26e8('0x3e')]=_['merge'](_0x417111[_0x26e8('0x3e')],{'$or':_[_0x26e8('0x2c')](_0x1eaa00,function(_0x262f3d){if(_0x262f3d[_0x26e8('0x30')]!==_0x26e8('0x40')){var _0x50824e={};_0x50824e[_0x262f3d[_0x26e8('0x29')]]={'$like':'%'+_0x37263a[_0x26e8('0x33')]['filter']+'%'};return _0x50824e;}})});}_0x417111=_[_0x26e8('0x41')]({},_0x417111,_0x37263a[_0x26e8('0x42')]);var _0x3af0af={'where':_0x417111[_0x26e8('0x3e')]};return db[_0x26e8('0x2d')][_0x26e8('0x1b')](_0x3af0af)['then'](function(_0x18af8d){_0x26621c['count']=_0x18af8d;if(_0x37263a[_0x26e8('0x33')][_0x26e8('0x43')]){_0x417111[_0x26e8('0x44')]=[{'all':!![]}];}return db[_0x26e8('0x2d')][_0x26e8('0x45')](_0x417111);})[_0x26e8('0x22')](function(_0x183a91){_0x26621c[_0x26e8('0x46')]=_0x183a91;return _0x26621c;})[_0x26e8('0x22')](respondWithFilteredResult(_0x536a41,_0x417111))[_0x26e8('0x47')](handleError(_0x536a41,null));};exports[_0x26e8('0x48')]=function(_0x5ef18d,_0x290436){var _0x9b25d5={'raw':!![],'where':{'id':_0x5ef18d[_0x26e8('0x49')]['id']}},_0x2a7c49={};_0x2a7c49[_0x26e8('0x32')]=_[_0x26e8('0x34')](db[_0x26e8('0x2d')][_0x26e8('0x2e')]);_0x2a7c49['query']=_[_0x26e8('0x34')](_0x5ef18d['query']);_0x2a7c49[_0x26e8('0x35')]=_[_0x26e8('0x37')](_0x2a7c49[_0x26e8('0x32')],_0x2a7c49[_0x26e8('0x33')]);_0x9b25d5[_0x26e8('0x36')]=_[_0x26e8('0x37')](_0x2a7c49[_0x26e8('0x32')],qs['fields'](_0x5ef18d[_0x26e8('0x33')][_0x26e8('0x38')]));_0x9b25d5['attributes']=_0x9b25d5[_0x26e8('0x36')][_0x26e8('0x39')]?_0x9b25d5[_0x26e8('0x36')]:_0x2a7c49[_0x26e8('0x32')];if(_0x5ef18d['query'][_0x26e8('0x43')]){_0x9b25d5['include']=[{'all':!![]}];}_0x9b25d5=_[_0x26e8('0x41')]({},_0x9b25d5,_0x5ef18d[_0x26e8('0x42')]);return db[_0x26e8('0x2d')][_0x26e8('0x4a')](_0x9b25d5)['then'](handleEntityNotFound(_0x290436,null))['then'](respondWithResult(_0x290436,null))[_0x26e8('0x47')](handleError(_0x290436,null));};exports[_0x26e8('0x4b')]=function(_0x258be1,_0x2a16cf){return db[_0x26e8('0x2d')][_0x26e8('0x4b')](_0x258be1[_0x26e8('0x4c')],{})[_0x26e8('0x22')](function(_0x2559f6){var _0x8c0103=_0x258be1['user'][_0x26e8('0x23')]({'plain':!![]});if(!_0x8c0103)throw new Error(_0x26e8('0x4d'));if(_0x8c0103['role']===_0x26e8('0x4e')){var _0x435ba2=_0x2559f6[_0x26e8('0x23')]({'plain':!![]});var _0x1b9424=_0x26e8('0x24');return db[_0x26e8('0x4f')]['find']({'where':{'name':_0x1b9424,'userProfileId':_0x8c0103[_0x26e8('0x50')]},'raw':!![]})[_0x26e8('0x22')](function(_0x486682){if(_0x486682&&_0x486682['autoAssociation']===0x0){return db['UserProfileResource'][_0x26e8('0x4b')]({'name':_0x435ba2[_0x26e8('0x29')],'resourceId':_0x435ba2['id'],'type':_0x486682[_0x26e8('0x29')],'sectionId':_0x486682['id']},{})[_0x26e8('0x22')](function(){return _0x2559f6;});}else{return _0x2559f6;}})['catch'](function(_0xe7b5d1){logger[_0x26e8('0x27')](_0x26e8('0x51'),_0xe7b5d1);throw _0xe7b5d1;});}return _0x2559f6;})['then'](respondWithResult(_0x2a16cf,0xc9))[_0x26e8('0x47')](handleError(_0x2a16cf,null));};exports['update']=function(_0x33e9f5,_0x168297){if(_0x33e9f5[_0x26e8('0x4c')]['id']){delete _0x33e9f5[_0x26e8('0x4c')]['id'];}return db[_0x26e8('0x2d')]['find']({'where':{'id':_0x33e9f5[_0x26e8('0x49')]['id']}})[_0x26e8('0x22')](handleEntityNotFound(_0x168297,null))[_0x26e8('0x22')](saveUpdates(_0x33e9f5[_0x26e8('0x4c')],null))[_0x26e8('0x22')](respondWithResult(_0x168297,null))[_0x26e8('0x47')](handleError(_0x168297,null));};exports['destroy']=function(_0xdb1397,_0x2f8a54){return db[_0x26e8('0x2d')]['find']({'where':{'id':_0xdb1397['params']['id']}})[_0x26e8('0x22')](handleEntityNotFound(_0x2f8a54,null))[_0x26e8('0x22')](removeEntity(_0x2f8a54,null))[_0x26e8('0x47')](handleError(_0x2f8a54,null));}; \ No newline at end of file +var _0x0bb4=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','count','status','set','Content-Range','json','apply','save','update','then','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','include','findAll','rows','show','params','keys','options','find','create'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x0bb4,0x199));var _0x40bb=function(_0x2b2287,_0x55c479){_0x2b2287=_0x2b2287-0x0;var _0x121aea=_0x0bb4[_0x2b2287];return _0x121aea;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x40bb('0x0'));var moment=require(_0x40bb('0x1'));var BPromise=require(_0x40bb('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x40bb('0x3'));var ejs=require(_0x40bb('0x4'));var fs=require('fs');var fs_extra=require(_0x40bb('0x5'));var _=require(_0x40bb('0x6'));var squel=require(_0x40bb('0x7'));var crypto=require(_0x40bb('0x8'));var jsforce=require(_0x40bb('0x9'));var deskjs=require(_0x40bb('0xa'));var toCsv=require(_0x40bb('0x3'));var querystring=require(_0x40bb('0xb'));var Papa=require(_0x40bb('0xc'));var Redis=require(_0x40bb('0xd'));var authService=require(_0x40bb('0xe'));var qs=require(_0x40bb('0xf'));var as=require(_0x40bb('0x10'));var hardwareService=require(_0x40bb('0x11'));var logger=require(_0x40bb('0x12'))(_0x40bb('0x13'));var utils=require('../../config/utils');var config=require(_0x40bb('0x14'));var licenseUtil=require(_0x40bb('0x15'));var db=require(_0x40bb('0x16'))['db'];function respondWithStatusCode(_0xea90f3,_0x108746){_0x108746=_0x108746||0xcc;return function(_0x32a21f){if(_0x32a21f){return _0xea90f3[_0x40bb('0x17')](_0x108746);}return _0xea90f3['status'](_0x108746)[_0x40bb('0x18')]();};}function respondWithResult(_0x799023,_0x240932){_0x240932=_0x240932||0xc8;return function(_0x10d32b){if(_0x10d32b){return _0x799023['status'](_0x240932)['json'](_0x10d32b);}};}function respondWithFilteredResult(_0x401d55,_0x1595dd){return function(_0x2fe90b){if(_0x2fe90b){var _0x2448a3=typeof _0x1595dd[_0x40bb('0x19')]==='undefined'&&typeof _0x1595dd[_0x40bb('0x1a')]==='undefined';var _0x35c6bf=_0x2fe90b[_0x40bb('0x1b')];var _0xc17f65=_0x2448a3?0x0:_0x1595dd[_0x40bb('0x19')];var _0x3621a7=_0x2448a3?_0x2fe90b['count']:_0x1595dd[_0x40bb('0x19')]+_0x1595dd[_0x40bb('0x1a')];var _0x3c3820;if(_0x3621a7>=_0x35c6bf){_0x3621a7=_0x35c6bf;_0x3c3820=0xc8;}else{_0x3c3820=0xce;}_0x401d55[_0x40bb('0x1c')](_0x3c3820);return _0x401d55[_0x40bb('0x1d')](_0x40bb('0x1e'),_0xc17f65+'-'+_0x3621a7+'/'+_0x35c6bf)[_0x40bb('0x1f')](_0x2fe90b);}return null;};}function patchUpdates(_0x180473){return function(_0x327ae4){try{jsonpatch[_0x40bb('0x20')](_0x327ae4,_0x180473,!![]);}catch(_0x4df5fd){return BPromise['reject'](_0x4df5fd);}return _0x327ae4[_0x40bb('0x21')]();};}function saveUpdates(_0x3ec6af,_0x4f1903){return function(_0x32be1b){if(_0x32be1b){return _0x32be1b[_0x40bb('0x22')](_0x3ec6af)[_0x40bb('0x23')](function(_0x36def1){return _0x36def1;});}return null;};}function removeEntity(_0x50b287,_0x5bcffc){return function(_0x56a341){if(_0x56a341){return _0x56a341['destroy']()[_0x40bb('0x23')](function(){var _0x5cd536=_0x56a341['get']({'plain':!![]});var _0x324194=_0x40bb('0x24');return db[_0x40bb('0x25')]['destroy']({'where':{'type':_0x324194,'resourceId':_0x5cd536['id']}})['then'](function(){return _0x56a341;});})[_0x40bb('0x23')](function(){_0x50b287[_0x40bb('0x1c')](0xcc)[_0x40bb('0x18')]();});}};}function handleEntityNotFound(_0x4e9a9e,_0x4c46c8){return function(_0x348ebd){if(!_0x348ebd){_0x4e9a9e[_0x40bb('0x17')](0x194);}return _0x348ebd;};}function handleError(_0x19e893,_0x539912){_0x539912=_0x539912||0x1f4;return function(_0x48c7e4){logger[_0x40bb('0x26')](_0x48c7e4[_0x40bb('0x27')]);if(_0x48c7e4[_0x40bb('0x28')]){delete _0x48c7e4['name'];}_0x19e893[_0x40bb('0x1c')](_0x539912)[_0x40bb('0x29')](_0x48c7e4);};}exports[_0x40bb('0x2a')]=function(_0x2e7ebb,_0x3f5779){var _0x2e8c1e={},_0xbc2a96={},_0x282c3c={'count':0x0,'rows':[]};var _0x55bfed=_[_0x40bb('0x2b')](db[_0x40bb('0x2c')][_0x40bb('0x2d')],function(_0x2dff9a){return{'name':_0x2dff9a[_0x40bb('0x2e')],'type':_0x2dff9a['type']['key']};});_0xbc2a96[_0x40bb('0x2f')]=_['map'](_0x55bfed,'name');_0xbc2a96[_0x40bb('0x30')]=_['keys'](_0x2e7ebb[_0x40bb('0x30')]);_0xbc2a96[_0x40bb('0x31')]=_[_0x40bb('0x32')](_0xbc2a96[_0x40bb('0x2f')],_0xbc2a96[_0x40bb('0x30')]);_0x2e8c1e['attributes']=_[_0x40bb('0x32')](_0xbc2a96[_0x40bb('0x2f')],qs[_0x40bb('0x33')](_0x2e7ebb[_0x40bb('0x30')][_0x40bb('0x33')]));_0x2e8c1e['attributes']=_0x2e8c1e[_0x40bb('0x34')][_0x40bb('0x35')]?_0x2e8c1e[_0x40bb('0x34')]:_0xbc2a96[_0x40bb('0x2f')];if(!_0x2e7ebb[_0x40bb('0x30')][_0x40bb('0x36')]('nolimit')){_0x2e8c1e[_0x40bb('0x1a')]=qs[_0x40bb('0x1a')](_0x2e7ebb[_0x40bb('0x30')][_0x40bb('0x1a')]);_0x2e8c1e[_0x40bb('0x19')]=qs[_0x40bb('0x19')](_0x2e7ebb[_0x40bb('0x30')]['offset']);}_0x2e8c1e[_0x40bb('0x37')]=qs['sort'](_0x2e7ebb['query'][_0x40bb('0x38')]);_0x2e8c1e['where']=qs[_0x40bb('0x31')](_[_0x40bb('0x39')](_0x2e7ebb[_0x40bb('0x30')],_0xbc2a96[_0x40bb('0x31')]),_0x55bfed);if(_0x2e7ebb['query'][_0x40bb('0x3a')]){_0x2e8c1e[_0x40bb('0x3b')]=_[_0x40bb('0x3c')](_0x2e8c1e[_0x40bb('0x3b')],{'$or':_[_0x40bb('0x2b')](_0x55bfed,function(_0x40ce53){if(_0x40ce53[_0x40bb('0x3d')]!=='VIRTUAL'){var _0x4914b7={};_0x4914b7[_0x40ce53[_0x40bb('0x28')]]={'$like':'%'+_0x2e7ebb[_0x40bb('0x30')][_0x40bb('0x3a')]+'%'};return _0x4914b7;}})});}_0x2e8c1e=_['merge']({},_0x2e8c1e,_0x2e7ebb['options']);var _0x3dee3e={'where':_0x2e8c1e['where']};return db[_0x40bb('0x2c')]['count'](_0x3dee3e)[_0x40bb('0x23')](function(_0x473fe3){_0x282c3c[_0x40bb('0x1b')]=_0x473fe3;if(_0x2e7ebb['query']['includeAll']){_0x2e8c1e[_0x40bb('0x3e')]=[{'all':!![]}];}return db[_0x40bb('0x2c')][_0x40bb('0x3f')](_0x2e8c1e);})[_0x40bb('0x23')](function(_0x47efc0){_0x282c3c[_0x40bb('0x40')]=_0x47efc0;return _0x282c3c;})['then'](respondWithFilteredResult(_0x3f5779,_0x2e8c1e))['catch'](handleError(_0x3f5779,null));};exports[_0x40bb('0x41')]=function(_0x40c06b,_0x31fd90){var _0x3f4282={'raw':!![],'where':{'id':_0x40c06b[_0x40bb('0x42')]['id']}},_0x2b8e53={};_0x2b8e53[_0x40bb('0x2f')]=_['keys'](db[_0x40bb('0x2c')][_0x40bb('0x2d')]);_0x2b8e53[_0x40bb('0x30')]=_[_0x40bb('0x43')](_0x40c06b[_0x40bb('0x30')]);_0x2b8e53['filters']=_['intersection'](_0x2b8e53['model'],_0x2b8e53[_0x40bb('0x30')]);_0x3f4282[_0x40bb('0x34')]=_[_0x40bb('0x32')](_0x2b8e53[_0x40bb('0x2f')],qs[_0x40bb('0x33')](_0x40c06b[_0x40bb('0x30')][_0x40bb('0x33')]));_0x3f4282['attributes']=_0x3f4282[_0x40bb('0x34')]['length']?_0x3f4282[_0x40bb('0x34')]:_0x2b8e53[_0x40bb('0x2f')];if(_0x40c06b[_0x40bb('0x30')]['includeAll']){_0x3f4282[_0x40bb('0x3e')]=[{'all':!![]}];}_0x3f4282=_[_0x40bb('0x3c')]({},_0x3f4282,_0x40c06b[_0x40bb('0x44')]);return db[_0x40bb('0x2c')][_0x40bb('0x45')](_0x3f4282)[_0x40bb('0x23')](handleEntityNotFound(_0x31fd90,null))[_0x40bb('0x23')](respondWithResult(_0x31fd90,null))['catch'](handleError(_0x31fd90,null));};exports['create']=function(_0x284676,_0x15f3be){return db['CmContactHasItem'][_0x40bb('0x46')](_0x284676[_0x40bb('0x47')],{})[_0x40bb('0x23')](function(_0xe26d80){var _0x1fc1eb=_0x284676[_0x40bb('0x48')]['get']({'plain':!![]});if(!_0x1fc1eb)throw new Error(_0x40bb('0x49'));if(_0x1fc1eb['role']===_0x40bb('0x48')){var _0x54a486=_0xe26d80[_0x40bb('0x4a')]({'plain':!![]});var _0x5872ed=_0x40bb('0x24');return db[_0x40bb('0x4b')][_0x40bb('0x45')]({'where':{'name':_0x5872ed,'userProfileId':_0x1fc1eb[_0x40bb('0x4c')]},'raw':!![]})['then'](function(_0x5ad2f6){if(_0x5ad2f6&&_0x5ad2f6['autoAssociation']===0x0){return db[_0x40bb('0x25')][_0x40bb('0x46')]({'name':_0x54a486[_0x40bb('0x28')],'resourceId':_0x54a486['id'],'type':_0x5ad2f6[_0x40bb('0x28')],'sectionId':_0x5ad2f6['id']},{})[_0x40bb('0x23')](function(){return _0xe26d80;});}else{return _0xe26d80;}})[_0x40bb('0x4d')](function(_0x5dd674){logger[_0x40bb('0x26')](_0x40bb('0x4e'),_0x5dd674);throw _0x5dd674;});}return _0xe26d80;})[_0x40bb('0x23')](respondWithResult(_0x15f3be,0xc9))[_0x40bb('0x4d')](handleError(_0x15f3be,null));};exports[_0x40bb('0x22')]=function(_0xaf7d9e,_0x9eea20){if(_0xaf7d9e[_0x40bb('0x47')]['id']){delete _0xaf7d9e[_0x40bb('0x47')]['id'];}return db[_0x40bb('0x2c')][_0x40bb('0x45')]({'where':{'id':_0xaf7d9e['params']['id']}})[_0x40bb('0x23')](handleEntityNotFound(_0x9eea20,null))['then'](saveUpdates(_0xaf7d9e[_0x40bb('0x47')],null))[_0x40bb('0x23')](respondWithResult(_0x9eea20,null))[_0x40bb('0x4d')](handleError(_0x9eea20,null));};exports[_0x40bb('0x4f')]=function(_0x475ea5,_0x595662){return db[_0x40bb('0x2c')][_0x40bb('0x45')]({'where':{'id':_0x475ea5[_0x40bb('0x42')]['id']}})[_0x40bb('0x23')](handleEntityNotFound(_0x595662,null))[_0x40bb('0x23')](removeEntity(_0x595662,null))[_0x40bb('0x4d')](handleError(_0x595662,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 1a69d45..3646793 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 _0x0d9e=['moment','request-promise','path','rimraf','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api'];(function(_0x23a55f,_0x716042){var _0x2be677=function(_0x56df7d){while(--_0x56df7d){_0x23a55f['push'](_0x23a55f['shift']());}};_0x2be677(++_0x716042);}(_0x0d9e,0x14c));var _0xe0d9=function(_0x2e20d3,_0x2f7ed8){_0x2e20d3=_0x2e20d3-0x0;var _0x3f3d80=_0x0d9e[_0x2e20d3];return _0x3f3d80;};'use strict';var _=require(_0xe0d9('0x0'));var util=require(_0xe0d9('0x1'));var logger=require(_0xe0d9('0x2'))(_0xe0d9('0x3'));var moment=require(_0xe0d9('0x4'));var BPromise=require('bluebird');var rp=require(_0xe0d9('0x5'));var fs=require('fs');var path=require(_0xe0d9('0x6'));var rimraf=require(_0xe0d9('0x7'));var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0xe0d9('0x8')]=function(_0x573d7e,_0x190414){return _0x573d7e[_0xe0d9('0x9')](_0xe0d9('0xa'),attributes,{'tableName':_0xe0d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa699=['CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define'];(function(_0x1dc79f,_0x455445){var _0x1625e4=function(_0x16662d){while(--_0x16662d){_0x1dc79f['push'](_0x1dc79f['shift']());}};_0x1625e4(++_0x455445);}(_0xa699,0x6b));var _0x9a69=function(_0x3da707,_0x30c36d){_0x3da707=_0x3da707-0x0;var _0x342ee7=_0xa699[_0x3da707];return _0x342ee7;};'use strict';var _=require(_0x9a69('0x0'));var util=require(_0x9a69('0x1'));var logger=require(_0x9a69('0x2'))(_0x9a69('0x3'));var moment=require(_0x9a69('0x4'));var BPromise=require(_0x9a69('0x5'));var rp=require(_0x9a69('0x6'));var fs=require('fs');var path=require(_0x9a69('0x7'));var rimraf=require(_0x9a69('0x8'));var config=require(_0x9a69('0x9'));var attributes=require(_0x9a69('0xa'));module[_0x9a69('0xb')]=function(_0x15f2fc,_0x58eb4d){return _0x15f2fc[_0x9a69('0xc')](_0x9a69('0xd'),attributes,{'tableName':_0x9a69('0xe'),'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 ad4c4eb..c42b6ef 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 _0xd1f1=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','bluebird','randomstring','ioredis'];(function(_0x30c797,_0x35c32a){var _0x19bd1e=function(_0x4c435b){while(--_0x4c435b){_0x30c797['push'](_0x30c797['shift']());}};_0x19bd1e(++_0x35c32a);}(_0xd1f1,0xe3));var _0x1d1f=function(_0x1202a2,_0x2912d9){_0x1202a2=_0x1202a2-0x0;var _0x3a8ac6=_0xd1f1[_0x1202a2];return _0x3a8ac6;};'use strict';var _=require('lodash');var util=require(_0x1d1f('0x0'));var moment=require('moment');var BPromise=require(_0x1d1f('0x1'));var rs=require(_0x1d1f('0x2'));var fs=require('fs');var Redis=require(_0x1d1f('0x3'));var db=require(_0x1d1f('0x4'))['db'];var utils=require(_0x1d1f('0x5'));var logger=require('../../config/logger')(_0x1d1f('0x6'));var config=require(_0x1d1f('0x7'));var jayson=require(_0x1d1f('0x8'));var client=jayson[_0x1d1f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa92a3e,_0x4d133d,_0x2fd329){return new BPromise(function(_0x16aaf1,_0x536ba6){return client[_0x1d1f('0xa')](_0xa92a3e,_0x2fd329)[_0x1d1f('0xb')](function(_0x8b11c3){logger[_0x1d1f('0xc')](_0x1d1f('0xd'),_0x4d133d,_0x1d1f('0xe'));logger[_0x1d1f('0xf')](_0x1d1f('0x10'),_0x4d133d,_0x1d1f('0xe'),JSON['stringify'](_0x8b11c3));if(_0x8b11c3[_0x1d1f('0x11')]){if(_0x8b11c3[_0x1d1f('0x11')][_0x1d1f('0x12')]===0x1f4){logger[_0x1d1f('0x11')](_0x1d1f('0xd'),_0x4d133d,_0x8b11c3['error']['message']);return _0x536ba6(_0x8b11c3['error'][_0x1d1f('0x13')]);}logger[_0x1d1f('0x11')](_0x1d1f('0xd'),_0x4d133d,_0x8b11c3['error'][_0x1d1f('0x13')]);return _0x16aaf1(_0x8b11c3[_0x1d1f('0x11')][_0x1d1f('0x13')]);}else{logger[_0x1d1f('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x4d133d,'request\x20sent');_0x16aaf1(_0x8b11c3['result'][_0x1d1f('0x13')]);}})[_0x1d1f('0x14')](function(_0x461b07){logger['error'](_0x1d1f('0xd'),_0x4d133d,_0x461b07);_0x536ba6(_0x461b07);});});} \ No newline at end of file +var _0x8eef=['code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8eef,0x134));var _0xf8ee=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x8eef[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xf8ee('0x0'));var util=require(_0xf8ee('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf8ee('0x2'));var fs=require('fs');var Redis=require(_0xf8ee('0x3'));var db=require(_0xf8ee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8ee('0x5'))('rpc');var config=require(_0xf8ee('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf8ee('0x7')][_0xf8ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f1510,_0x5f3ae3,_0x365e07){return new BPromise(function(_0x23640d,_0x4bd5b3){return client[_0xf8ee('0x9')](_0x4f1510,_0x365e07)[_0xf8ee('0xa')](function(_0x18e220){logger[_0xf8ee('0xb')](_0xf8ee('0xc'),_0x5f3ae3,_0xf8ee('0xd'));logger['debug']('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x5f3ae3,'request\x20sent',JSON['stringify'](_0x18e220));if(_0x18e220[_0xf8ee('0xe')]){if(_0x18e220[_0xf8ee('0xe')][_0xf8ee('0xf')]===0x1f4){logger[_0xf8ee('0xe')](_0xf8ee('0xc'),_0x5f3ae3,_0x18e220[_0xf8ee('0xe')]['message']);return _0x4bd5b3(_0x18e220[_0xf8ee('0xe')]['message']);}logger[_0xf8ee('0xe')](_0xf8ee('0xc'),_0x5f3ae3,_0x18e220['error'][_0xf8ee('0x10')]);return _0x23640d(_0x18e220[_0xf8ee('0xe')][_0xf8ee('0x10')]);}else{logger['info'](_0xf8ee('0xc'),_0x5f3ae3,_0xf8ee('0xd'));_0x23640d(_0x18e220[_0xf8ee('0x11')][_0xf8ee('0x10')]);}})[_0xf8ee('0x12')](function(_0xf9efe){logger[_0xf8ee('0xe')](_0xf8ee('0xc'),_0x5f3ae3,_0xf9efe);_0x4bd5b3(_0xf9efe);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 6d8dcb9..c138f72 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 _0xe438=['Router','fs-extra','../../components/auth/service','./cmContactHasItem.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x369829,_0x5149ad){var _0xb9c603=function(_0x2fc8c9){while(--_0x2fc8c9){_0x369829['push'](_0x369829['shift']());}};_0xb9c603(++_0x5149ad);}(_0xe438,0x1e3));var _0x8e43=function(_0x2116b5,_0x56cf34){_0x2116b5=_0x2116b5-0x0;var _0x2c907a=_0xe438[_0x2116b5];return _0x2c907a;};'use strict';var multer=require(_0x8e43('0x0'));var util=require('util');var path=require(_0x8e43('0x1'));var timeout=require(_0x8e43('0x2'));var express=require('express');var router=express[_0x8e43('0x3')]();var fs_extra=require(_0x8e43('0x4'));var auth=require(_0x8e43('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8e43('0x6'));router[_0x8e43('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8e43('0x7')](_0x8e43('0x8'),auth[_0x8e43('0x9')](),controller[_0x8e43('0xa')]);router[_0x8e43('0xb')]('/',auth[_0x8e43('0x9')](),controller[_0x8e43('0xc')]);router[_0x8e43('0xd')]('/:id',auth[_0x8e43('0x9')](),controller[_0x8e43('0xe')]);router[_0x8e43('0xf')](_0x8e43('0x8'),auth[_0x8e43('0x9')](),controller[_0x8e43('0x10')]);module[_0x8e43('0x11')]=router; \ No newline at end of file +var _0x31a3=['isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get'];(function(_0x23129b,_0x2d13ae){var _0x3b2fe9=function(_0x4cd6b7){while(--_0x4cd6b7){_0x23129b['push'](_0x23129b['shift']());}};_0x3b2fe9(++_0x2d13ae);}(_0x31a3,0x183));var _0x331a=function(_0x5b06fb,_0x1190f4){_0x5b06fb=_0x5b06fb-0x0;var _0x53a53a=_0x31a3[_0x5b06fb];return _0x53a53a;};'use strict';var multer=require(_0x331a('0x0'));var util=require(_0x331a('0x1'));var path=require(_0x331a('0x2'));var timeout=require(_0x331a('0x3'));var express=require(_0x331a('0x4'));var router=express[_0x331a('0x5')]();var fs_extra=require(_0x331a('0x6'));var auth=require(_0x331a('0x7'));var interaction=require(_0x331a('0x8'));var config=require(_0x331a('0x9'));var controller=require(_0x331a('0xa'));router[_0x331a('0xb')]('/',auth[_0x331a('0xc')](),controller[_0x331a('0xd')]);router[_0x331a('0xb')](_0x331a('0xe'),auth[_0x331a('0xc')](),controller[_0x331a('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x331a('0x10')]);router[_0x331a('0x11')](_0x331a('0xe'),auth[_0x331a('0xc')](),controller[_0x331a('0x12')]);router[_0x331a('0x13')](_0x331a('0xe'),auth[_0x331a('0xc')](),controller['destroy']);module[_0x331a('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 68ff1c0..ded988e 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 _0x1591=['long','type','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','TEXT'];(function(_0x5c59b7,_0x6371bf){var _0x12f72a=function(_0x2c3f73){while(--_0x2c3f73){_0x5c59b7['push'](_0x5c59b7['shift']());}};_0x12f72a(++_0x6371bf);}(_0x1591,0x17f));var _0x1159=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x1591[_0x5311e8];return _0x582ad8;};'use strict';var Sequelize=require(_0x1159('0x0'));var _=require(_0x1159('0x1'));module['exports']={'name':{'type':Sequelize[_0x1159('0x2')],'get':function(_0x2961c8){return this[_0x1159('0x3')](_0x1159('0x4'));}},'alias':{'type':Sequelize[_0x1159('0x5')],'allowNull':![],'set':function(_0x5aeb97){this[_0x1159('0x6')](_0x1159('0x4'),_0x5aeb97?_0x5aeb97:this[_0x1159('0x3')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x1159('0x7')](_0x1159('0x8')),'get':function(){if(this[_0x1159('0x3')](_0x1159('0x9'))==='select'){return JSON[_0x1159('0xa')](this['getDataValue']('values'));}else{return this[_0x1159('0x3')](_0x1159('0xb'));}},'set':function(_0x1ae875){if(Array[_0x1159('0xc')](_0x1ae875)){this[_0x1159('0x6')]('values',JSON[_0x1159('0xd')](_0x1ae875));}else{this[_0x1159('0x6')]('values',_0x1ae875);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1159('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1159('0xf')](_0x1159('0x10'))}}; \ No newline at end of file +var _0x6d30=['parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','exports','getDataValue','alias','STRING','setDataValue','name','TEXT','select'];(function(_0x3f787e,_0x951303){var _0x26242d=function(_0x58622a){while(--_0x58622a){_0x3f787e['push'](_0x3f787e['shift']());}};_0x26242d(++_0x951303);}(_0x6d30,0x1d7));var _0x06d3=function(_0x3feb8a,_0x47c784){_0x3feb8a=_0x3feb8a-0x0;var _0x4523ca=_0x6d30[_0x3feb8a];return _0x4523ca;};'use strict';var Sequelize=require(_0x06d3('0x0'));var _=require('lodash');module[_0x06d3('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5ec7fc){return this[_0x06d3('0x2')](_0x06d3('0x3'));}},'alias':{'type':Sequelize[_0x06d3('0x4')],'allowNull':![],'set':function(_0x8fa1da){this[_0x06d3('0x5')](_0x06d3('0x3'),_0x8fa1da?_0x8fa1da:this[_0x06d3('0x2')](_0x06d3('0x6')));}},'type':{'type':Sequelize[_0x06d3('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x06d3('0x7')]('long'),'get':function(){if(this[_0x06d3('0x2')]('type')===_0x06d3('0x8')){return JSON[_0x06d3('0x9')](this['getDataValue'](_0x06d3('0xa')));}else{return this[_0x06d3('0x2')]('values');}},'set':function(_0x10aff8){if(Array[_0x06d3('0xb')](_0x10aff8)){this[_0x06d3('0x5')](_0x06d3('0xa'),JSON[_0x06d3('0xc')](_0x10aff8));}else{this[_0x06d3('0x5')](_0x06d3('0xa'),_0x10aff8);}}},'required':{'type':Sequelize[_0x06d3('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x06d3('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x06d3('0xe')](_0x06d3('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 8caf501..f8bc8a9 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 _0x775b=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','sendStatus','error','name','send','map','CmCustomField','fieldName','type','key','differenceBy','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','find','update','body','create','transaction','Sequelize','TEXT','number','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse'];(function(_0x1c40f1,_0x82ac9f){var _0xaf7aed=function(_0x2a47b3){while(--_0x2a47b3){_0x1c40f1['push'](_0x1c40f1['shift']());}};_0xaf7aed(++_0x82ac9f);}(_0x775b,0x145));var _0xb775=function(_0x5d5827,_0x512422){_0x5d5827=_0x5d5827-0x0;var _0x463c75=_0x775b[_0x5d5827];return _0x463c75;};'use strict';var emlformat=require(_0xb775('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb775('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb775('0x2'));var moment=require('moment');var BPromise=require(_0xb775('0x3'));var Mustache=require(_0xb775('0x4'));var util=require(_0xb775('0x5'));var path=require(_0xb775('0x6'));var sox=require(_0xb775('0x7'));var csv=require(_0xb775('0x8'));var ejs=require(_0xb775('0x9'));var fs=require('fs');var fs_extra=require(_0xb775('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb775('0xb'));var jsforce=require(_0xb775('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb775('0x8'));var querystring=require(_0xb775('0xd'));var Papa=require(_0xb775('0xe'));var Redis=require(_0xb775('0xf'));var authService=require(_0xb775('0x10'));var qs=require(_0xb775('0x11'));var as=require(_0xb775('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb775('0x13'))(_0xb775('0x14'));var utils=require(_0xb775('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb775('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d67d2,_0x2664ea){_0x2664ea=_0x2664ea||0xcc;return function(_0x12575d){if(_0x12575d){return _0x3d67d2['sendStatus'](_0x2664ea);}return _0x3d67d2[_0xb775('0x17')](_0x2664ea)['end']();};}function respondWithResult(_0x376ba9,_0x247b7a){_0x247b7a=_0x247b7a||0xc8;return function(_0x37d430){if(_0x37d430){return _0x376ba9[_0xb775('0x17')](_0x247b7a)[_0xb775('0x18')](_0x37d430);}};}function respondWithFilteredResult(_0x20a5f6,_0x86ec9d){return function(_0x286915){if(_0x286915){var _0xb2d682=typeof _0x86ec9d[_0xb775('0x19')]===_0xb775('0x1a')&&typeof _0x86ec9d[_0xb775('0x1b')]===_0xb775('0x1a');var _0x26b4ef=_0x286915[_0xb775('0x1c')];var _0x22494a=_0xb2d682?0x0:_0x86ec9d[_0xb775('0x19')];var _0x46009e=_0xb2d682?_0x286915[_0xb775('0x1c')]:_0x86ec9d[_0xb775('0x19')]+_0x86ec9d[_0xb775('0x1b')];var _0x4d995d;if(_0x46009e>=_0x26b4ef){_0x46009e=_0x26b4ef;_0x4d995d=0xc8;}else{_0x4d995d=0xce;}_0x20a5f6[_0xb775('0x17')](_0x4d995d);return _0x20a5f6[_0xb775('0x1d')]('Content-Range',_0x22494a+'-'+_0x46009e+'/'+_0x26b4ef)['json'](_0x286915);}return null;};}function patchUpdates(_0x1e1fc7){return function(_0x3357cc){try{jsonpatch[_0xb775('0x1e')](_0x3357cc,_0x1e1fc7,!![]);}catch(_0x5ac361){return BPromise[_0xb775('0x1f')](_0x5ac361);}return _0x3357cc[_0xb775('0x20')]();};}function saveUpdates(_0x34ec0c,_0x54aa26){return function(_0x2f54c7){if(_0x2f54c7){return _0x2f54c7['update'](_0x34ec0c)[_0xb775('0x21')](function(_0x2cabe4){return _0x2cabe4;});}return null;};}function removeEntity(_0x146bfc,_0x1e73c8){return function(_0x586f39){if(_0x586f39){return _0x586f39[_0xb775('0x22')]()[_0xb775('0x21')](function(){_0x146bfc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52f0c0,_0x7f8e32){return function(_0x288021){if(!_0x288021){_0x52f0c0[_0xb775('0x23')](0x194);}return _0x288021;};}function handleError(_0x2729ab,_0x3d66cb){_0x3d66cb=_0x3d66cb||0x1f4;return function(_0x3e404d){logger[_0xb775('0x24')](_0x3e404d['stack']);if(_0x3e404d[_0xb775('0x25')]){delete _0x3e404d[_0xb775('0x25')];}_0x2729ab['status'](_0x3d66cb)[_0xb775('0x26')](_0x3e404d);};}exports['index']=function(_0x389c83,_0x46a8c8){var _0xfb9fb3={},_0x18bfe0={},_0x167ed6={'count':0x0,'rows':[]};var _0x46d4ed=_[_0xb775('0x27')](db[_0xb775('0x28')]['rawAttributes'],function(_0x5eba93){return{'name':_0x5eba93[_0xb775('0x29')],'type':_0x5eba93[_0xb775('0x2a')][_0xb775('0x2b')]};});_0x18bfe0['model']=_[_0xb775('0x2c')](_[_0xb775('0x27')](_0x46d4ed,_0xb775('0x25')),[_0xb775('0x25')]);_0x18bfe0[_0xb775('0x2d')]=_[_0xb775('0x2e')](_0x389c83[_0xb775('0x2d')]);_0x18bfe0['filters']=_[_0xb775('0x2f')](_0x18bfe0[_0xb775('0x30')],_0x18bfe0[_0xb775('0x2d')]);_0xfb9fb3[_0xb775('0x31')]=_[_0xb775('0x2f')](_0x18bfe0[_0xb775('0x30')],qs[_0xb775('0x32')](_0x389c83['query'][_0xb775('0x32')]));_0xfb9fb3[_0xb775('0x31')]=_0xfb9fb3[_0xb775('0x31')]['length']?_0xfb9fb3['attributes']:_0x18bfe0[_0xb775('0x30')];if(!_0x389c83[_0xb775('0x2d')][_0xb775('0x33')]('nolimit')){_0xfb9fb3[_0xb775('0x1b')]=qs['limit'](_0x389c83[_0xb775('0x2d')][_0xb775('0x1b')]);_0xfb9fb3['offset']=qs[_0xb775('0x19')](_0x389c83[_0xb775('0x2d')]['offset']);}_0xfb9fb3[_0xb775('0x34')]=qs[_0xb775('0x35')](_0x389c83[_0xb775('0x2d')]['sort']);_0xfb9fb3['where']=qs[_0xb775('0x36')](_[_0xb775('0x37')](_0x389c83[_0xb775('0x2d')],_0x18bfe0[_0xb775('0x36')]),_0x46d4ed);if(_0x389c83[_0xb775('0x2d')][_0xb775('0x38')]){_0xfb9fb3[_0xb775('0x39')]=_[_0xb775('0x3a')](_0xfb9fb3[_0xb775('0x39')],{'$or':_[_0xb775('0x27')](_0x46d4ed,function(_0x3e3952){if(_0x3e3952['type']!==_0xb775('0x3b')){var _0x41e9fd={};_0x41e9fd[_0x3e3952['name']]={'$like':'%'+_0x389c83[_0xb775('0x2d')][_0xb775('0x38')]+'%'};return _0x41e9fd;}})});}_0xfb9fb3=_[_0xb775('0x3a')]({},_0xfb9fb3,_0x389c83[_0xb775('0x3c')]);var _0x4da2e2={'where':_0xfb9fb3[_0xb775('0x39')]};return db[_0xb775('0x28')][_0xb775('0x1c')](_0x4da2e2)['then'](function(_0x1542ba){_0x167ed6[_0xb775('0x1c')]=_0x1542ba;if(_0x389c83[_0xb775('0x2d')][_0xb775('0x3d')]){_0xfb9fb3['include']=[{'all':!![]}];}return db['CmCustomField'][_0xb775('0x3e')](_0xfb9fb3);})[_0xb775('0x21')](function(_0x9cfe45){_0x167ed6[_0xb775('0x3f')]=_0x9cfe45;return _0x167ed6;})[_0xb775('0x21')](respondWithFilteredResult(_0x46a8c8,_0xfb9fb3))[_0xb775('0x40')](handleError(_0x46a8c8,null));};exports[_0xb775('0x41')]=function(_0x25f034,_0x31acc4){var _0x54a272={'raw':!![],'where':{'id':_0x25f034[_0xb775('0x42')]['id']}},_0xb9d2a={};_0xb9d2a[_0xb775('0x30')]=_[_0xb775('0x2e')](db[_0xb775('0x28')][_0xb775('0x43')]);_0xb9d2a['query']=_[_0xb775('0x2e')](_0x25f034[_0xb775('0x2d')]);_0xb9d2a[_0xb775('0x36')]=_[_0xb775('0x2f')](_0xb9d2a['model'],_0xb9d2a[_0xb775('0x2d')]);_0x54a272[_0xb775('0x31')]=_[_0xb775('0x2f')](_0xb9d2a['model'],qs[_0xb775('0x32')](_0x25f034[_0xb775('0x2d')]['fields']));_0x54a272['attributes']=_0x54a272[_0xb775('0x31')][_0xb775('0x44')]?_0x54a272[_0xb775('0x31')]:_0xb9d2a[_0xb775('0x30')];if(_0x25f034[_0xb775('0x2d')]['includeAll']){_0x54a272[_0xb775('0x45')]=[{'all':!![]}];}_0x54a272=_[_0xb775('0x3a')]({},_0x54a272,_0x25f034['options']);return db[_0xb775('0x28')][_0xb775('0x46')](_0x54a272)[_0xb775('0x21')](handleEntityNotFound(_0x31acc4,null))[_0xb775('0x21')](respondWithResult(_0x31acc4,null))['catch'](handleError(_0x31acc4,null));};exports[_0xb775('0x47')]=function(_0x4f5f7d,_0x171ff7){if(_0x4f5f7d['body']['id']){delete _0x4f5f7d[_0xb775('0x48')]['id'];}return db[_0xb775('0x28')]['find']({'where':{'id':_0x4f5f7d[_0xb775('0x42')]['id']}})['then'](handleEntityNotFound(_0x171ff7,null))[_0xb775('0x21')](saveUpdates(_0x4f5f7d[_0xb775('0x48')],null))[_0xb775('0x21')](respondWithResult(_0x171ff7,null))[_0xb775('0x40')](handleError(_0x171ff7,null));};exports[_0xb775('0x22')]=function(_0x2c38e1,_0x445147){return db[_0xb775('0x28')][_0xb775('0x46')]({'where':{'id':_0x2c38e1[_0xb775('0x42')]['id']}})['then'](handleEntityNotFound(_0x445147,null))[_0xb775('0x21')](removeEntity(_0x445147,null))[_0xb775('0x40')](handleError(_0x445147,null));};exports[_0xb775('0x49')]=function(_0x4f65c7,_0xbf98c3){var _0xc8a34c;return db['sequelize'][_0xb775('0x4a')](function(_0x5bd83a){return db[_0xb775('0x28')][_0xb775('0x49')](_0x4f65c7[_0xb775('0x48')],{'transaction':_0x5bd83a})['then'](function(_0x181f9c){_0xc8a34c=_0x181f9c;var _0x4f8cda={'type':db[_0xb775('0x4b')][_0xb775('0x4c')],'transaction':_0x5bd83a};switch(_0x4f65c7['body']['type']){case'text':_0x4f8cda['type']=db[_0xb775('0x4b')][_0xb775('0x4c')];break;case _0xb775('0x4d'):_0x4f8cda[_0xb775('0x2a')]=db['Sequelize']['INTEGER'];break;case'switch':_0x4f8cda[_0xb775('0x2a')]=db['Sequelize'][_0xb775('0x4e')];_0x4f8cda[_0xb775('0x4f')]=![];break;default:}return db[_0xb775('0x50')][_0xb775('0x51')][_0xb775('0x52')](_0xb775('0x53'),util['format'](_0xb775('0x54'),_0xc8a34c['id']),_0x4f8cda);})[_0xb775('0x21')](function(){return _0xc8a34c;});})[_0xb775('0x21')](respondWithResult(_0xbf98c3,0xc9))[_0xb775('0x40')](handleError(_0xbf98c3,null));}; \ No newline at end of file +var _0x345c=['undefined','count','limit','set','Content-Range','apply','reject','update','then','stack','send','index','map','CmCustomField','rawAttributes','type','key','model','differenceBy','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','params','keys','includeAll','find','catch','body','destroy','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x19a28d,_0x472544){var _0x5368ff=function(_0x5311db){while(--_0x5311db){_0x19a28d['push'](_0x19a28d['shift']());}};_0x5368ff(++_0x472544);}(_0x345c,0x1e9));var _0xc345=function(_0x4b6548,_0xcf8db9){_0x4b6548=_0x4b6548-0x0;var _0x1089b3=_0x345c[_0x4b6548];return _0x1089b3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc345('0x0'));var zipdir=require(_0xc345('0x1'));var jsonpatch=require(_0xc345('0x2'));var rp=require(_0xc345('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc345('0x4'));var path=require(_0xc345('0x5'));var sox=require(_0xc345('0x6'));var csv=require(_0xc345('0x7'));var ejs=require(_0xc345('0x8'));var fs=require('fs');var fs_extra=require(_0xc345('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc345('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc345('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc345('0xc'));var Papa=require('papaparse');var Redis=require(_0xc345('0xd'));var authService=require(_0xc345('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc345('0xf'));var hardwareService=require(_0xc345('0x10'));var logger=require(_0xc345('0x11'))(_0xc345('0x12'));var utils=require(_0xc345('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc345('0x14'));var db=require(_0xc345('0x15'))['db'];function respondWithStatusCode(_0x3e02ba,_0xffb7d1){_0xffb7d1=_0xffb7d1||0xcc;return function(_0x1604c5){if(_0x1604c5){return _0x3e02ba[_0xc345('0x16')](_0xffb7d1);}return _0x3e02ba[_0xc345('0x17')](_0xffb7d1)[_0xc345('0x18')]();};}function respondWithResult(_0x505f9e,_0x82b569){_0x82b569=_0x82b569||0xc8;return function(_0x4fa957){if(_0x4fa957){return _0x505f9e[_0xc345('0x17')](_0x82b569)[_0xc345('0x19')](_0x4fa957);}};}function respondWithFilteredResult(_0x4bca02,_0x4ac203){return function(_0x570ff6){if(_0x570ff6){var _0x5e4fea=typeof _0x4ac203[_0xc345('0x1a')]===_0xc345('0x1b')&&typeof _0x4ac203['limit']==='undefined';var _0x1bfed9=_0x570ff6[_0xc345('0x1c')];var _0x51059c=_0x5e4fea?0x0:_0x4ac203[_0xc345('0x1a')];var _0x2afb0c=_0x5e4fea?_0x570ff6[_0xc345('0x1c')]:_0x4ac203[_0xc345('0x1a')]+_0x4ac203[_0xc345('0x1d')];var _0x1ac58d;if(_0x2afb0c>=_0x1bfed9){_0x2afb0c=_0x1bfed9;_0x1ac58d=0xc8;}else{_0x1ac58d=0xce;}_0x4bca02['status'](_0x1ac58d);return _0x4bca02[_0xc345('0x1e')](_0xc345('0x1f'),_0x51059c+'-'+_0x2afb0c+'/'+_0x1bfed9)[_0xc345('0x19')](_0x570ff6);}return null;};}function patchUpdates(_0xb8365a){return function(_0x715f3a){try{jsonpatch[_0xc345('0x20')](_0x715f3a,_0xb8365a,!![]);}catch(_0x5a89bf){return BPromise[_0xc345('0x21')](_0x5a89bf);}return _0x715f3a['save']();};}function saveUpdates(_0x3a7976,_0xd589c1){return function(_0x52074a){if(_0x52074a){return _0x52074a[_0xc345('0x22')](_0x3a7976)[_0xc345('0x23')](function(_0xc5e4a9){return _0xc5e4a9;});}return null;};}function removeEntity(_0x2d31ee,_0x4e93ef){return function(_0x5af918){if(_0x5af918){return _0x5af918['destroy']()[_0xc345('0x23')](function(){_0x2d31ee[_0xc345('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51f490,_0x52d833){return function(_0x2eb17c){if(!_0x2eb17c){_0x51f490['sendStatus'](0x194);}return _0x2eb17c;};}function handleError(_0x1c9db6,_0xe6c669){_0xe6c669=_0xe6c669||0x1f4;return function(_0x13c715){logger['error'](_0x13c715[_0xc345('0x24')]);if(_0x13c715['name']){delete _0x13c715['name'];}_0x1c9db6[_0xc345('0x17')](_0xe6c669)[_0xc345('0x25')](_0x13c715);};}exports[_0xc345('0x26')]=function(_0x3974e2,_0x48df4e){var _0x5807f1={},_0x2204d1={},_0x4d0d39={'count':0x0,'rows':[]};var _0x6aa16=_[_0xc345('0x27')](db[_0xc345('0x28')][_0xc345('0x29')],function(_0x289c1e){return{'name':_0x289c1e['fieldName'],'type':_0x289c1e[_0xc345('0x2a')][_0xc345('0x2b')]};});_0x2204d1[_0xc345('0x2c')]=_[_0xc345('0x2d')](_[_0xc345('0x27')](_0x6aa16,_0xc345('0x2e')),['name']);_0x2204d1[_0xc345('0x2f')]=_['keys'](_0x3974e2[_0xc345('0x2f')]);_0x2204d1[_0xc345('0x30')]=_[_0xc345('0x31')](_0x2204d1[_0xc345('0x2c')],_0x2204d1[_0xc345('0x2f')]);_0x5807f1[_0xc345('0x32')]=_[_0xc345('0x31')](_0x2204d1[_0xc345('0x2c')],qs[_0xc345('0x33')](_0x3974e2[_0xc345('0x2f')]['fields']));_0x5807f1[_0xc345('0x32')]=_0x5807f1['attributes'][_0xc345('0x34')]?_0x5807f1[_0xc345('0x32')]:_0x2204d1[_0xc345('0x2c')];if(!_0x3974e2['query'][_0xc345('0x35')]('nolimit')){_0x5807f1[_0xc345('0x1d')]=qs['limit'](_0x3974e2[_0xc345('0x2f')]['limit']);_0x5807f1['offset']=qs[_0xc345('0x1a')](_0x3974e2[_0xc345('0x2f')][_0xc345('0x1a')]);}_0x5807f1[_0xc345('0x36')]=qs[_0xc345('0x37')](_0x3974e2[_0xc345('0x2f')]['sort']);_0x5807f1[_0xc345('0x38')]=qs['filters'](_[_0xc345('0x39')](_0x3974e2[_0xc345('0x2f')],_0x2204d1[_0xc345('0x30')]),_0x6aa16);if(_0x3974e2['query'][_0xc345('0x3a')]){_0x5807f1[_0xc345('0x38')]=_[_0xc345('0x3b')](_0x5807f1['where'],{'$or':_[_0xc345('0x27')](_0x6aa16,function(_0x4560b8){if(_0x4560b8[_0xc345('0x2a')]!==_0xc345('0x3c')){var _0x14d4c0={};_0x14d4c0[_0x4560b8[_0xc345('0x2e')]]={'$like':'%'+_0x3974e2[_0xc345('0x2f')]['filter']+'%'};return _0x14d4c0;}})});}_0x5807f1=_['merge']({},_0x5807f1,_0x3974e2[_0xc345('0x3d')]);var _0x573df7={'where':_0x5807f1[_0xc345('0x38')]};return db[_0xc345('0x28')][_0xc345('0x1c')](_0x573df7)['then'](function(_0x2fde26){_0x4d0d39['count']=_0x2fde26;if(_0x3974e2['query']['includeAll']){_0x5807f1['include']=[{'all':!![]}];}return db[_0xc345('0x28')][_0xc345('0x3e')](_0x5807f1);})['then'](function(_0x2bc06a){_0x4d0d39[_0xc345('0x3f')]=_0x2bc06a;return _0x4d0d39;})[_0xc345('0x23')](respondWithFilteredResult(_0x48df4e,_0x5807f1))['catch'](handleError(_0x48df4e,null));};exports['show']=function(_0x551386,_0x8f3040){var _0x2300a0={'raw':!![],'where':{'id':_0x551386[_0xc345('0x40')]['id']}},_0x29a74b={};_0x29a74b['model']=_[_0xc345('0x41')](db['CmCustomField'][_0xc345('0x29')]);_0x29a74b['query']=_[_0xc345('0x41')](_0x551386[_0xc345('0x2f')]);_0x29a74b[_0xc345('0x30')]=_[_0xc345('0x31')](_0x29a74b[_0xc345('0x2c')],_0x29a74b['query']);_0x2300a0['attributes']=_[_0xc345('0x31')](_0x29a74b[_0xc345('0x2c')],qs[_0xc345('0x33')](_0x551386[_0xc345('0x2f')][_0xc345('0x33')]));_0x2300a0['attributes']=_0x2300a0[_0xc345('0x32')][_0xc345('0x34')]?_0x2300a0[_0xc345('0x32')]:_0x29a74b[_0xc345('0x2c')];if(_0x551386[_0xc345('0x2f')][_0xc345('0x42')]){_0x2300a0['include']=[{'all':!![]}];}_0x2300a0=_[_0xc345('0x3b')]({},_0x2300a0,_0x551386[_0xc345('0x3d')]);return db[_0xc345('0x28')][_0xc345('0x43')](_0x2300a0)[_0xc345('0x23')](handleEntityNotFound(_0x8f3040,null))[_0xc345('0x23')](respondWithResult(_0x8f3040,null))[_0xc345('0x44')](handleError(_0x8f3040,null));};exports[_0xc345('0x22')]=function(_0x5280bd,_0x4326b8){if(_0x5280bd['body']['id']){delete _0x5280bd[_0xc345('0x45')]['id'];}return db[_0xc345('0x28')][_0xc345('0x43')]({'where':{'id':_0x5280bd[_0xc345('0x40')]['id']}})[_0xc345('0x23')](handleEntityNotFound(_0x4326b8,null))[_0xc345('0x23')](saveUpdates(_0x5280bd['body'],null))[_0xc345('0x23')](respondWithResult(_0x4326b8,null))[_0xc345('0x44')](handleError(_0x4326b8,null));};exports[_0xc345('0x46')]=function(_0xc23302,_0x7f505){return db[_0xc345('0x28')][_0xc345('0x43')]({'where':{'id':_0xc23302['params']['id']}})['then'](handleEntityNotFound(_0x7f505,null))[_0xc345('0x23')](removeEntity(_0x7f505,null))['catch'](handleError(_0x7f505,null));};exports[_0xc345('0x47')]=function(_0x2e2e27,_0x5943ef){var _0x5b4342;return db[_0xc345('0x48')][_0xc345('0x49')](function(_0x40aa38){return db['CmCustomField'][_0xc345('0x47')](_0x2e2e27[_0xc345('0x45')],{'transaction':_0x40aa38})[_0xc345('0x23')](function(_0x557a01){_0x5b4342=_0x557a01;var _0x474172={'type':db[_0xc345('0x4a')][_0xc345('0x4b')],'transaction':_0x40aa38};switch(_0x2e2e27[_0xc345('0x45')][_0xc345('0x2a')]){case'text':_0x474172[_0xc345('0x2a')]=db[_0xc345('0x4a')]['TEXT'];break;case _0xc345('0x4c'):_0x474172[_0xc345('0x2a')]=db[_0xc345('0x4a')][_0xc345('0x4d')];break;case _0xc345('0x4e'):_0x474172[_0xc345('0x2a')]=db[_0xc345('0x4a')][_0xc345('0x4f')];_0x474172[_0xc345('0x50')]=![];break;default:}return db['sequelize'][_0xc345('0x51')][_0xc345('0x52')](_0xc345('0x53'),util[_0xc345('0x54')](_0xc345('0x55'),_0x5b4342['id']),_0x474172);})[_0xc345('0x23')](function(){return _0x5b4342;});})[_0xc345('0x23')](respondWithResult(_0x5943ef,0xc9))['catch'](handleError(_0x5943ef,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index af8b85e..f54ea1f 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 _0x0b08=['define','CmCustomField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports'];(function(_0x2e545e,_0xf3d4ec){var _0x43228e=function(_0x5f4b5c){while(--_0x5f4b5c){_0x2e545e['push'](_0x2e545e['shift']());}};_0x43228e(++_0xf3d4ec);}(_0x0b08,0x10a));var _0x80b0=function(_0xf951ef,_0x111d3c){_0xf951ef=_0xf951ef-0x0;var _0x25357b=_0x0b08[_0xf951ef];return _0x25357b;};'use strict';var _=require(_0x80b0('0x0'));var util=require(_0x80b0('0x1'));var logger=require(_0x80b0('0x2'))(_0x80b0('0x3'));var moment=require(_0x80b0('0x4'));var BPromise=require(_0x80b0('0x5'));var rp=require(_0x80b0('0x6'));var fs=require('fs');var path=require(_0x80b0('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0x80b0('0x8')]=function(_0x29e55f,_0xe98cdf){return _0x29e55f[_0x80b0('0x9')](_0x80b0('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d16=['cm_custom_fields','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0x5d16,0x146));var _0x65d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d16[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x65d1('0x0'));var util=require(_0x65d1('0x1'));var logger=require(_0x65d1('0x2'))(_0x65d1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x65d1('0x4'));var fs=require('fs');var path=require(_0x65d1('0x5'));var rimraf=require(_0x65d1('0x6'));var config=require(_0x65d1('0x7'));var attributes=require(_0x65d1('0x8'));module[_0x65d1('0x9')]=function(_0x28e1a0,_0xcf10ba){return _0x28e1a0[_0x65d1('0xa')](_0x65d1('0xb'),attributes,{'tableName':_0x65d1('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 8d912b1..d07e11c 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 _0x97dc=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','lodash'];(function(_0x2bcb36,_0x42e112){var _0x31a16c=function(_0x4c8164){while(--_0x4c8164){_0x2bcb36['push'](_0x2bcb36['shift']());}};_0x31a16c(++_0x42e112);}(_0x97dc,0xa7));var _0xc97d=function(_0x4e4e9b,_0x59c3e1){_0x4e4e9b=_0x4e4e9b-0x0;var _0x30ab7a=_0x97dc[_0x4e4e9b];return _0x30ab7a;};'use strict';var _=require(_0xc97d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc97d('0x1'));var rs=require(_0xc97d('0x2'));var fs=require('fs');var Redis=require(_0xc97d('0x3'));var db=require(_0xc97d('0x4'))['db'];var utils=require(_0xc97d('0x5'));var logger=require(_0xc97d('0x6'))(_0xc97d('0x7'));var config=require(_0xc97d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc97d('0x9')][_0xc97d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f316e,_0x1f2ccb,_0x3ef3ff){return new BPromise(function(_0x29b31d,_0x16ea06){return client[_0xc97d('0xb')](_0x1f316e,_0x3ef3ff)['then'](function(_0x3cd55d){logger[_0xc97d('0xc')]('CmCustomField,\x20%s,\x20%s',_0x1f2ccb,_0xc97d('0xd'));logger['debug'](_0xc97d('0xe'),_0x1f2ccb,_0xc97d('0xd'),JSON[_0xc97d('0xf')](_0x3cd55d));if(_0x3cd55d[_0xc97d('0x10')]){if(_0x3cd55d[_0xc97d('0x10')][_0xc97d('0x11')]===0x1f4){logger[_0xc97d('0x10')](_0xc97d('0x12'),_0x1f2ccb,_0x3cd55d[_0xc97d('0x10')][_0xc97d('0x13')]);return _0x16ea06(_0x3cd55d[_0xc97d('0x10')]['message']);}logger[_0xc97d('0x10')](_0xc97d('0x12'),_0x1f2ccb,_0x3cd55d[_0xc97d('0x10')][_0xc97d('0x13')]);return _0x29b31d(_0x3cd55d[_0xc97d('0x10')]['message']);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x1f2ccb,_0xc97d('0xd'));_0x29b31d(_0x3cd55d[_0xc97d('0x14')][_0xc97d('0x13')]);}})['catch'](function(_0x5832aa){logger[_0xc97d('0x10')](_0xc97d('0x12'),_0x1f2ccb,_0x5832aa);_0x16ea06(_0x5832aa);});});} \ No newline at end of file +var _0x6de3=['jayson/promise','client','http','request','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x49669a,_0x135f9c){var _0x348b21=function(_0xa016de){while(--_0xa016de){_0x49669a['push'](_0x49669a['shift']());}};_0x348b21(++_0x135f9c);}(_0x6de3,0x148));var _0x36de=function(_0x2d99fc,_0x50830a){_0x2d99fc=_0x2d99fc-0x0;var _0x5131ee=_0x6de3[_0x2d99fc];return _0x5131ee;};'use strict';var _=require(_0x36de('0x0'));var util=require(_0x36de('0x1'));var moment=require(_0x36de('0x2'));var BPromise=require('bluebird');var rs=require(_0x36de('0x3'));var fs=require('fs');var Redis=require(_0x36de('0x4'));var db=require(_0x36de('0x5'))['db'];var utils=require(_0x36de('0x6'));var logger=require('../../config/logger')(_0x36de('0x7'));var config=require('../../config/environment');var jayson=require(_0x36de('0x8'));var client=jayson[_0x36de('0x9')][_0x36de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ddb12,_0x3a86c5,_0x39eb76){return new BPromise(function(_0x545382,_0x38e027){return client[_0x36de('0xb')](_0x2ddb12,_0x39eb76)['then'](function(_0xb14c71){logger[_0x36de('0xc')](_0x36de('0xd'),_0x3a86c5,'request\x20sent');logger[_0x36de('0xe')](_0x36de('0xf'),_0x3a86c5,'request\x20sent',JSON['stringify'](_0xb14c71));if(_0xb14c71[_0x36de('0x10')]){if(_0xb14c71[_0x36de('0x10')]['code']===0x1f4){logger[_0x36de('0x10')](_0x36de('0xd'),_0x3a86c5,_0xb14c71['error']['message']);return _0x38e027(_0xb14c71[_0x36de('0x10')]['message']);}logger[_0x36de('0x10')](_0x36de('0xd'),_0x3a86c5,_0xb14c71[_0x36de('0x10')][_0x36de('0x11')]);return _0x545382(_0xb14c71['error'][_0x36de('0x11')]);}else{logger[_0x36de('0xc')](_0x36de('0xd'),_0x3a86c5,_0x36de('0x12'));_0x545382(_0xb14c71[_0x36de('0x13')][_0x36de('0x11')]);}})[_0x36de('0x14')](function(_0x1714d1){logger['error'](_0x36de('0xd'),_0x3a86c5,_0x1714d1);_0x38e027(_0x1714d1);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 8e29dde..6783bcb 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 _0x11e5=['../../components/auth/service','../../config/environment','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x391ad7,_0x264aa4){var _0x5215a8=function(_0x4973b6){while(--_0x4973b6){_0x391ad7['push'](_0x391ad7['shift']());}};_0x5215a8(++_0x264aa4);}(_0x11e5,0x8b));var _0x511e=function(_0x2996f2,_0x4da366){_0x2996f2=_0x2996f2-0x0;var _0x3554d8=_0x11e5[_0x2996f2];return _0x3554d8;};'use strict';var multer=require(_0x511e('0x0'));var util=require('util');var path=require(_0x511e('0x1'));var timeout=require(_0x511e('0x2'));var express=require('express');var router=express[_0x511e('0x3')]();var fs_extra=require(_0x511e('0x4'));var auth=require(_0x511e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x511e('0x6'));var controller=require('./cmCustomField.controller');router['get']('/',auth[_0x511e('0x7')](),controller[_0x511e('0x8')]);router[_0x511e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x511e('0xa')]);router[_0x511e('0xb')]('/',auth[_0x511e('0x7')](),controller[_0x511e('0xc')]);router[_0x511e('0xd')](_0x511e('0xe'),auth[_0x511e('0x7')](),controller[_0x511e('0xf')]);router[_0x511e('0x10')](_0x511e('0xe'),auth[_0x511e('0x7')](),controller['destroy']);module[_0x511e('0x11')]=router; \ No newline at end of file +var _0x5f7d=['get','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0xab9f3d,_0xb336fa){var _0x5283bf=function(_0x505e6c){while(--_0x505e6c){_0xab9f3d['push'](_0xab9f3d['shift']());}};_0x5283bf(++_0xb336fa);}(_0x5f7d,0x6d));var _0xd5f7=function(_0x45d6f9,_0x443787){_0x45d6f9=_0x45d6f9-0x0;var _0x3b7316=_0x5f7d[_0x45d6f9];return _0x3b7316;};'use strict';var multer=require(_0xd5f7('0x0'));var util=require(_0xd5f7('0x1'));var path=require(_0xd5f7('0x2'));var timeout=require(_0xd5f7('0x3'));var express=require('express');var router=express[_0xd5f7('0x4')]();var fs_extra=require(_0xd5f7('0x5'));var auth=require(_0xd5f7('0x6'));var interaction=require(_0xd5f7('0x7'));var config=require(_0xd5f7('0x8'));var controller=require('./cmCustomField.controller');router['get']('/',auth[_0xd5f7('0x9')](),controller['index']);router[_0xd5f7('0xa')]('/:id',auth[_0xd5f7('0x9')](),controller['show']);router[_0xd5f7('0xb')]('/',auth['isAuthenticated'](),controller[_0xd5f7('0xc')]);router['put'](_0xd5f7('0xd'),auth[_0xd5f7('0x9')](),controller['update']);router[_0xd5f7('0xe')](_0xd5f7('0xd'),auth['isAuthenticated'](),controller[_0xd5f7('0xf')]);module[_0xd5f7('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index e266162..0f19c67 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 _0xd27b=['INTEGER','DATE','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x567a53,_0x50aa1c){var _0x234588=function(_0x518c39){while(--_0x518c39){_0x567a53['push'](_0x567a53['shift']());}};_0x234588(++_0x50aa1c);}(_0xd27b,0xc1));var _0xbd27=function(_0x19688b,_0x5cae76){_0x19688b=_0x19688b-0x0;var _0x196944=_0xd27b[_0x19688b];return _0x196944;};'use strict';var moment=require(_0xbd27('0x0'));var Sequelize=require(_0xbd27('0x1'));module[_0xbd27('0x2')]={'phone':{'type':Sequelize[_0xbd27('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xbd27('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xbd27('0x5')](_0xbd27('0x6'))},'countbusyretry':{'type':Sequelize[_0xbd27('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbd27('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbd27('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbd27('0x8')]},'priority':{'type':Sequelize[_0xbd27('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xbd27('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xbd27('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xbd27('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xbd27('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xbd27('0x7')],'unique':_0xbd27('0x9')},'CampaignId':{'type':Sequelize[_0xbd27('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xbd27('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbd27('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbd27('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbd27('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbd27('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xbd27('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x9ae0=['BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','sequelize','exports','STRING'];(function(_0x15994d,_0x316832){var _0x1b767e=function(_0x4c6849){while(--_0x4c6849){_0x15994d['push'](_0x15994d['shift']());}};_0x1b767e(++_0x316832);}(_0x9ae0,0xe5));var _0x09ae=function(_0x32ac9f,_0x5e6bbf){_0x32ac9f=_0x32ac9f-0x0;var _0x301c44=_0x9ae0[_0x32ac9f];return _0x301c44;};'use strict';var moment=require('moment');var Sequelize=require(_0x09ae('0x0'));module[_0x09ae('0x1')]={'phone':{'type':Sequelize[_0x09ae('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x09ae('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x09ae('0x4')],'defaultValue':moment()['format'](_0x09ae('0x5'))},'countbusyretry':{'type':Sequelize[_0x09ae('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x09ae('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x09ae('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x09ae('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x09ae('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x09ae('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x09ae('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x09ae('0x7')},'UserId':{'type':Sequelize[_0x09ae('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x09ae('0x7')},'CampaignId':{'type':Sequelize[_0x09ae('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x09ae('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x09ae('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x09ae('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x09ae('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x09ae('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 9afe4ca..06ba67b 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 _0x44e8=['merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','updatedAt','state','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','end','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','hopperIds','ASC','scheduledAt','dialOrderByScheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','isEmpty','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','List','Queue','dialActive','getPreviewRecall','recallme','Contact','CmCompany','Company','CmList','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','push','utcOffset','moment','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','update','then','error','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','key','keys','query','filters','intersection','$and','$or','$gt','$gte','$lt','$ne','$eq','$not','$between','$notBetween','$notIn','$iLike','$notILike','$like','$contains','$contained','$any','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44e8,0xd7));var _0x844e=function(_0x15a806,_0x2f81f8){_0x15a806=_0x15a806-0x0;var _0x306ee5=_0x44e8[_0x15a806];return _0x306ee5;};'use strict';var moment=require(_0x844e('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x844e('0x1'))(_0x844e('0x2'));var shared=require(_0x844e('0x3'));var db=require(_0x844e('0x4'))['db'];function respondWithResult(_0x49ce1b,_0x3a8b3c){_0x3a8b3c=_0x3a8b3c||0xc8;return function(_0x167368){if(_0x167368){return _0x49ce1b[_0x844e('0x5')](_0x3a8b3c)[_0x844e('0x6')](_0x167368);}};}function respondWithFilteredResult(_0x5c8f67,_0x2f6539){return function(_0x238796){if(_0x238796){var _0x1706b3=typeof _0x2f6539[_0x844e('0x7')]==='undefined'&&typeof _0x2f6539[_0x844e('0x8')]===_0x844e('0x9');var _0x336881=_0x238796[_0x844e('0xa')];var _0x32c6c7=_0x1706b3?0x0:_0x2f6539[_0x844e('0x7')];var _0x536601=_0x1706b3?_0x238796[_0x844e('0xa')]:_0x2f6539[_0x844e('0x7')]+_0x2f6539[_0x844e('0x8')];var _0x285a64;if(_0x536601>=_0x336881){_0x536601=_0x336881;_0x285a64=0xc8;}else{_0x285a64=0xce;}_0x5c8f67[_0x844e('0x5')](_0x285a64);return _0x5c8f67[_0x844e('0xb')](_0x844e('0xc'),_0x32c6c7+'-'+_0x536601+'/'+_0x336881)['json'](_0x238796);}return null;};}function saveUpdates(_0x8d3bea,_0x23df3f){return function(_0x52ac76){if(_0x52ac76){return _0x52ac76[_0x844e('0xd')](_0x8d3bea)[_0x844e('0xe')](function(_0x492094){return _0x492094;});}return null;};}function handleEntityNotFound(_0x1f48e2,_0x6b542d){return function(_0x1c1689){if(!_0x1c1689){_0x1f48e2['sendStatus'](0x194);}return _0x1c1689;};}function handleError(_0x6cc6fb,_0x465e49){_0x465e49=_0x465e49||0x1f4;return function(_0x380eb4){logger[_0x844e('0xf')](_0x380eb4[_0x844e('0x10')]);if(_0x380eb4[_0x844e('0x11')]){delete _0x380eb4[_0x844e('0x11')];}_0x6cc6fb[_0x844e('0x5')](_0x465e49)['send'](_0x380eb4);};}exports[_0x844e('0x12')]=function(_0x56791b,_0x3c307f){var _0x4b0c6c={},_0x315c50={},_0x55bcd6={'count':0x0,'rows':[]};var _0x43f05d=_[_0x844e('0x13')](db[_0x844e('0x14')][_0x844e('0x15')],function(_0x3ea7da){return{'name':_0x3ea7da[_0x844e('0x16')],'type':_0x3ea7da[_0x844e('0x17')][_0x844e('0x18')]};});_0x315c50['model']=_[_0x844e('0x13')](_0x43f05d,'name');_0x315c50['query']=_[_0x844e('0x19')](_0x56791b[_0x844e('0x1a')]);_0x315c50[_0x844e('0x1b')]=_[_0x844e('0x1c')](_0x315c50['model'],_0x315c50[_0x844e('0x1a')]);_0x315c50[_0x844e('0x1b')]=_['concat'](_0x315c50[_0x844e('0x1b')],[_0x844e('0x1d'),_0x844e('0x1e'),_0x844e('0x1f'),_0x844e('0x20'),_0x844e('0x21'),'$lte',_0x844e('0x22'),_0x844e('0x23'),_0x844e('0x24'),_0x844e('0x25'),_0x844e('0x26'),'$in',_0x844e('0x27'),'$like','$notLike',_0x844e('0x28'),_0x844e('0x29'),_0x844e('0x2a'),'$overlap',_0x844e('0x2b'),_0x844e('0x2c'),_0x844e('0x2d')]);_0x4b0c6c['attributes']=_[_0x844e('0x1c')](_0x315c50[_0x844e('0x2e')],qs[_0x844e('0x2f')](_0x56791b[_0x844e('0x1a')][_0x844e('0x2f')]));_0x4b0c6c[_0x844e('0x30')]=_0x4b0c6c[_0x844e('0x30')][_0x844e('0x31')]?_0x4b0c6c[_0x844e('0x30')]:_0x315c50[_0x844e('0x2e')];if(!_0x56791b['query'][_0x844e('0x32')](_0x844e('0x33'))){_0x4b0c6c[_0x844e('0x8')]=qs[_0x844e('0x8')](_0x56791b[_0x844e('0x1a')][_0x844e('0x8')]);_0x4b0c6c[_0x844e('0x7')]=qs['offset'](_0x56791b[_0x844e('0x1a')][_0x844e('0x7')]);}_0x4b0c6c[_0x844e('0x34')]=qs['sort'](_0x56791b[_0x844e('0x1a')][_0x844e('0x35')]);_0x4b0c6c['where']=qs[_0x844e('0x1b')](_[_0x844e('0x36')](_0x56791b['query'],_0x315c50[_0x844e('0x1b')]),_0x43f05d);if(_0x56791b[_0x844e('0x1a')][_0x844e('0x37')]){_0x4b0c6c[_0x844e('0x38')]=_[_0x844e('0x39')](_0x4b0c6c[_0x844e('0x38')],{'$or':_[_0x844e('0x13')](_0x43f05d,function(_0x4f3768){if(_0x4f3768[_0x844e('0x17')]!==_0x844e('0x3a')){var _0x29637e={};_0x29637e[_0x4f3768[_0x844e('0x11')]]={'$like':'%'+_0x56791b[_0x844e('0x1a')][_0x844e('0x37')]+'%'};return _0x29637e;}})});}_0x4b0c6c=_[_0x844e('0x39')]({},_0x4b0c6c,_0x56791b[_0x844e('0x3b')]);var _0x10dc63={'where':_0x4b0c6c[_0x844e('0x38')]};return db[_0x844e('0x14')]['count'](_0x10dc63)['then'](function(_0x3ad6d5){_0x55bcd6[_0x844e('0xa')]=_0x3ad6d5;if(_0x56791b[_0x844e('0x1a')][_0x844e('0x3c')]){_0x4b0c6c[_0x844e('0x3d')]=[{'all':!![]}];}return db[_0x844e('0x14')][_0x844e('0x3e')](_0x4b0c6c);})[_0x844e('0xe')](function(_0x16fc54){_0x55bcd6['rows']=_0x16fc54;return _0x55bcd6;})[_0x844e('0xe')](respondWithFilteredResult(_0x3c307f,_0x4b0c6c))['catch'](handleError(_0x3c307f,null));};exports[_0x844e('0x3f')]=function(_0x535e21,_0x286eb6){var _0x5dc530={'raw':!![],'where':{'id':_0x535e21[_0x844e('0x40')]['id']}},_0x240199={};_0x240199[_0x844e('0x2e')]=_[_0x844e('0x19')](db[_0x844e('0x14')][_0x844e('0x15')]);_0x240199[_0x844e('0x1a')]=_[_0x844e('0x19')](_0x535e21[_0x844e('0x1a')]);_0x240199[_0x844e('0x1b')]=_[_0x844e('0x1c')](_0x240199['model'],_0x240199[_0x844e('0x1a')]);_0x5dc530[_0x844e('0x30')]=_[_0x844e('0x1c')](_0x240199['model'],qs['fields'](_0x535e21[_0x844e('0x1a')][_0x844e('0x2f')]));_0x5dc530[_0x844e('0x30')]=_0x5dc530['attributes']['length']?_0x5dc530['attributes']:_0x240199['model'];if(_0x535e21[_0x844e('0x1a')][_0x844e('0x3c')]){_0x5dc530[_0x844e('0x3d')]=[{'all':!![]}];}_0x5dc530=_[_0x844e('0x39')]({},_0x5dc530,_0x535e21[_0x844e('0x3b')]);return db['CmHopper'][_0x844e('0x41')](_0x5dc530)['then'](handleEntityNotFound(_0x286eb6,null))['then'](respondWithResult(_0x286eb6,null))[_0x844e('0x42')](handleError(_0x286eb6,null));};exports[_0x844e('0x43')]=function(_0x2a57c7,_0x121ebf){return db['CmHopper'][_0x844e('0x43')](_0x2a57c7[_0x844e('0x44')],{})[_0x844e('0xe')](respondWithResult(_0x121ebf,0xc9))['catch'](handleError(_0x121ebf,null));};exports[_0x844e('0xd')]=function(_0x1bcbda,_0x558f21){if(_0x1bcbda[_0x844e('0x44')]['id']){delete _0x1bcbda[_0x844e('0x44')]['id'];}return db[_0x844e('0x14')][_0x844e('0x41')]({'where':{'id':_0x1bcbda[_0x844e('0x40')]['id']}})[_0x844e('0xe')](handleEntityNotFound(_0x558f21,null))['then'](saveUpdates(_0x1bcbda[_0x844e('0x44')],null))[_0x844e('0xe')](respondWithResult(_0x558f21,null))[_0x844e('0x42')](handleError(_0x558f21,null));};exports[_0x844e('0x45')]=function(_0x1dcfcb,_0x165078){return db[_0x844e('0x14')][_0x844e('0x45')]()[_0x844e('0xe')](respondWithResult(_0x165078,null))[_0x844e('0x42')](handleError(_0x165078,null));};exports['destroy']=function(_0x32e097,_0x694791){var _0x40410d;var _0x510089=_0x32e097[_0x844e('0x40')]['id'];return db[_0x844e('0x14')][_0x844e('0x41')]({'where':{'id':_0x32e097[_0x844e('0x40')]['id']}})[_0x844e('0xe')](handleEntityNotFound(_0x694791,null))[_0x844e('0xe')](function(_0x2c2c46){if(_0x2c2c46){return _0x2c2c46['destroy']()[_0x844e('0xe')](function(_0x3c680c){return _0x3c680c;});}})[_0x844e('0xe')](function(_0x1f2d5c){_0x40410d=_0x1f2d5c;if(_0x1f2d5c){if(_0x1f2d5c[_0x844e('0x46')]||_0x1f2d5c[_0x844e('0x47')]){return db[_0x1f2d5c[_0x844e('0x46')]?_0x844e('0x48'):_0x844e('0x49')][_0x844e('0x41')]({'where':{'id':_0x1f2d5c[_0x844e('0x46')]?_0x1f2d5c[_0x844e('0x46')]:_0x1f2d5c[_0x844e('0x47')]},'attributes':['id','name'],'raw':!![]});}}})[_0x844e('0xe')](function(_0x3d4a20){var _0x5dca66={};if(_0x3d4a20){_[_0x844e('0x39')](_0x5dca66,_[_0x844e('0x4a')](_0x40410d[_0x844e('0x4b')],['createdAt',_0x844e('0x4c'),'id']));_0x5dca66[_0x844e('0x4d')]=0x15;_0x5dca66['statedesc']=_0x844e('0x4e');_0x5dca66[_0x844e('0x4f')]=_0x3d4a20[_0x844e('0x11')];_0x5dca66[_0x844e('0x50')]=_0x32e097[_0x844e('0x51')][_0x844e('0x11')];_0x5dca66[_0x844e('0x52')]=_0x32e097[_0x844e('0x51')]['id'];_0x5dca66[_0x844e('0x4e')]=!![];_0x5dca66[_0x844e('0x53')]=moment()[_0x844e('0x54')](_0x844e('0x55'));_0x5dca66[_0x844e('0x56')]=_0x40410d[_0x844e('0x57')];_0x5dca66['campaigntype']=_0x40410d[_0x844e('0x46')]?_0x844e('0x58'):'ivr';return db[_0x844e('0x59')]['find']({'where':{'id':_0x5dca66[_0x844e('0x5a')]},'attributes':[_0x844e('0x5b'),_0x844e('0x5c')]})['then'](function(_0x48202c){if(!_[_0x844e('0x5d')](_0x694791)&&!_[_0x844e('0x5d')](_0x48202c[_0x844e('0x5b')])){_0x5dca66[_0x844e('0x5e')]=_0x48202c[_0x844e('0x5b')];if(!_['isNil'](_0x48202c[_0x844e('0x5c')])){_0x5dca66[_0x844e('0x5e')]+='\x20'+_0x48202c[_0x844e('0x5c')];}}})[_0x844e('0x5f')](function(){return db['CmHopperFinal'][_0x844e('0x43')](_0x5dca66);});}})[_0x844e('0xe')](function(_0x2fe55d){return db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':_0x510089}});})[_0x844e('0xe')](function(){return _0x694791[_0x844e('0x5')](0xcc)[_0x844e('0x60')]();})['catch'](handleError(_0x694791,null));};exports['getPreview']=function(_0x33798f,_0xd36868){var _0xd73b00=[];return db['CmContact'][_0x844e('0x45')]()[_0x844e('0xe')](function(_0x210a37){_0xd73b00=_['keys'](_0x210a37);return _0x33798f[_0x844e('0x51')][_0x844e('0x61')]({'where':{'type':_0x844e('0x62'),'dialActive':!![],'dialMethod':_0x844e('0x63')},'attributes':['id','dialOrderByScheduledAt',_0x844e('0x64')],'raw':!![]});})[_0x844e('0xe')](function(_0x3ca50f){if(_0x3ca50f&&_0x3ca50f[_0x844e('0x31')]){return db[_0x844e('0x65')][_0x844e('0x66')](function(_0x42d335){var _0x651093={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x844e('0x13')](_0x3ca50f,'id')},'$or':[{'UserId':null},{'UserId':_0x33798f['user']['id']}]};var _0x252ff9={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3ca50f)[_0x844e('0x37')]([_0x844e('0x64'),0x0])[_0x844e('0x13')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x33798f['user']['id']}]};var _0x4ff698={'$or':[_0x651093,_0x252ff9]};var _0x4e4ece=[];if(_0x33798f['body']['direction']&&_0x33798f[_0x844e('0x44')][_0x844e('0x67')]===_0x844e('0x68')){if(!_['isEmpty'](_0x33798f[_0x844e('0x44')][_0x844e('0x69')])){_0x4ff698['id']={'$in':_0x33798f['body'][_0x844e('0x69')]};}_0x4e4ece=[['priority',_0x844e('0x6a')],[_0x844e('0x6b'),_0x3ca50f[0x0][_0x844e('0x6c')]===_0x844e('0x6a')?'DESC':'ASC'],db['sequelize'][_0x844e('0x6d')](_0x844e('0x6e')),['id',_0x844e('0x6f')]];}else{if(!_[_0x844e('0x70')](_0x33798f[_0x844e('0x44')]['hopperIds'])){_0x4ff698['id']={'$notIn':_0x33798f['body'][_0x844e('0x69')]};}_0x4e4ece=[[_0x844e('0x71'),_0x844e('0x6f')],[_0x844e('0x6b'),_0x3ca50f[0x0][_0x844e('0x6c')]],db[_0x844e('0x65')]['literal'](_0x844e('0x72')),['id',_0x844e('0x6a')]];}return db['CmHopper'][_0x844e('0x73')]({'attributes':['id',_0x844e('0x74'),'phone','recallme'],'where':_0x4ff698,'order':_0x4e4ece,'transaction':_0x42d335,'lock':_0x42d335[_0x844e('0x75')][_0x844e('0x76')],'include':[{'model':db[_0x844e('0x59')],'as':'Contact','attributes':_0xd73b00,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x844e('0x11')]}]},{'model':db['CmList'],'as':_0x844e('0x77'),'attributes':['id',_0x844e('0x11')]},{'model':db[_0x844e('0x48')],'as':_0x844e('0x78'),'attributes':['id',_0x844e('0x11'),_0x844e('0x79')]}]})['then'](function(_0x1e8663){if(_0x1e8663){return _0x1e8663[_0x844e('0xd')]({'UserId':_0x33798f['user']['id']},{'transaction':_0x42d335});}});});}})[_0x844e('0xe')](handleEntityNotFound(_0xd36868,null))[_0x844e('0xe')](respondWithResult(_0xd36868,null))[_0x844e('0x42')](handleError(_0xd36868,null));};exports[_0x844e('0x7a')]=function(_0x36ec29,_0x5c53b8,_0x48b7df){var _0x304e7b=[];var _0x14b226=_0x36ec29[_0x844e('0x40')]['id'];var _0xfc0fb3=_0x36ec29[_0x844e('0x51')]['id'];return db[_0x844e('0x59')][_0x844e('0x45')]()['then'](function(_0x24862f){_0x304e7b=_[_0x844e('0x19')](_0x24862f);return db['sequelize'][_0x844e('0x66')](function(_0x3a0b58){const _0x78bf8f={'id':_0x14b226};return db['CmHopper']['findOne']({'attributes':['id',_0x844e('0x74'),_0x844e('0x7b')],'where':_0x78bf8f,'transaction':_0x3a0b58,'lock':_0x3a0b58['LOCK'][_0x844e('0x76')],'include':[{'model':db[_0x844e('0x59')],'as':_0x844e('0x7c'),'attributes':_0x304e7b,'include':[{'model':db[_0x844e('0x7d')],'as':_0x844e('0x7e'),'attributes':['id',_0x844e('0x11')]}]},{'model':db[_0x844e('0x7f')],'as':'List','attributes':['id',_0x844e('0x11')]},{'model':db['VoiceQueue'],'as':_0x844e('0x78'),'attributes':['id','name',_0x844e('0x79')]}]})['then'](function(_0x396c72){if(_0x396c72){return _0x396c72[_0x844e('0xd')]({'UserId':_0xfc0fb3},{'transaction':_0x3a0b58});}});});})['then'](handleEntityNotFound(_0x5c53b8,null))[_0x844e('0xe')](respondWithResult(_0x5c53b8,null))[_0x844e('0x42')](handleError(_0x5c53b8,null));};exports[_0x844e('0x80')]=function(_0x1a9c64,_0x4508af){return _0x1a9c64['user'][_0x844e('0x61')]({'where':{'type':_0x844e('0x62'),'dialActive':!![],'dialMethod':_0x844e('0x63')},'attributes':['id'],'raw':!![]})[_0x844e('0xe')](function(_0x220b2c){if(_0x220b2c&&_0x220b2c[_0x844e('0x31')]){return db[_0x844e('0x14')][_0x844e('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x844e('0x54')](_0x844e('0x55'))},'VoiceQueueId':{'$in':_['map'](_0x220b2c,'id')},'$or':[{'UserId':null},{'UserId':_0x1a9c64[_0x844e('0x51')]['id']}]}});}return 0x0;})[_0x844e('0xe')](function(_0x264d2d){if(!_[_0x844e('0x5d')](_0x264d2d)&&_[_0x844e('0x81')](_0x264d2d)){return _0x4508af[_0x844e('0x5')](0xc8)[_0x844e('0x6')]({'contacts':_0x264d2d});}else{logger[_0x844e('0xf')](_0x844e('0x82'),_0x844e('0x80'),0x194,_0x844e('0x83'));_0x4508af[_0x844e('0x84')](0x194);}})[_0x844e('0x42')](handleError(_0x4508af,null));};exports[_0x844e('0x85')]=function(_0xa16879,_0x5320cb){var _0x3f8c41=shared['timezones'];var _0x2b975b=[];_[_0x844e('0x13')](_0x3f8c41,function(_0x2df9ac){_0x2b975b[_0x844e('0x86')]({'id':_0x2df9ac[_0x844e('0x11')],'name':_0x2df9ac['name'],'utcOffset':_0x2df9ac[_0x844e('0x87')]});});return _0x5320cb[_0x844e('0x5')](0xc8)[_0x844e('0x6')]({'tz':_0x2b975b});};exports['getTimezone']=function(_0x5a8ac3,_0x2e4bcb){var _0x29fd78=shared['timezones'];var _0x2d5c5f={};if(!_[_0x844e('0x5d')](_0x29fd78[_0x5a8ac3[_0x844e('0x44')]['id']]))_0x2d5c5f=_0x29fd78[_0x5a8ac3[_0x844e('0x44')]['id']];return _0x2e4bcb[_0x844e('0x5')](0xc8)[_0x844e('0x6')](_0x2d5c5f);}; \ No newline at end of file +var _0x56e6=['filters','intersection','model','concat','$and','$or','$lt','$ne','$between','$in','$notIn','$like','$notILike','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','CmHopper','includeAll','include','findAll','rows','show','keys','rawAttributes','length','find','create','body','catch','update','params','describe','destroy','VoiceQueueId','CampaignId','omit','dataValues','createdAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','calleridnum','queue','ivr','ContactId','isNil','firstName','calleridname','lastName','finally','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','YYYY-MM-DD\x20HH:mm:ss','value','direction','isEmpty','hopperIds','ASC','DESC','sequelize','priority','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','VoiceQueue','getPreviewRecall','transaction','List','Queue','dialActive','getOpenContacts','isNumber','error','entity\x20not\x20found','timezones','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','Content-Range','then','sendStatus','stack','name','send','fieldName','type','key','map','query'];(function(_0x2a7028,_0x24c722){var _0x779981=function(_0xe3655f){while(--_0xe3655f){_0x2a7028['push'](_0x2a7028['shift']());}};_0x779981(++_0x24c722);}(_0x56e6,0x6b));var _0x656e=function(_0x5cba78,_0x3e1e1c){_0x5cba78=_0x5cba78-0x0;var _0x3af348=_0x56e6[_0x5cba78];return _0x3af348;};'use strict';var moment=require(_0x656e('0x0'));var _=require(_0x656e('0x1'));var qs=require(_0x656e('0x2'));var logger=require(_0x656e('0x3'))(_0x656e('0x4'));var shared=require(_0x656e('0x5'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x40a874,_0x23c947){_0x23c947=_0x23c947||0xc8;return function(_0xe7d540){if(_0xe7d540){return _0x40a874[_0x656e('0x6')](_0x23c947)[_0x656e('0x7')](_0xe7d540);}};}function respondWithFilteredResult(_0x3fef98,_0x81c232){return function(_0x54eddb){if(_0x54eddb){var _0x35d629=typeof _0x81c232[_0x656e('0x8')]===_0x656e('0x9')&&typeof _0x81c232[_0x656e('0xa')]===_0x656e('0x9');var _0x16260d=_0x54eddb[_0x656e('0xb')];var _0x202205=_0x35d629?0x0:_0x81c232[_0x656e('0x8')];var _0x1f4bc9=_0x35d629?_0x54eddb[_0x656e('0xb')]:_0x81c232[_0x656e('0x8')]+_0x81c232[_0x656e('0xa')];var _0x2add6b;if(_0x1f4bc9>=_0x16260d){_0x1f4bc9=_0x16260d;_0x2add6b=0xc8;}else{_0x2add6b=0xce;}_0x3fef98['status'](_0x2add6b);return _0x3fef98['set'](_0x656e('0xc'),_0x202205+'-'+_0x1f4bc9+'/'+_0x16260d)[_0x656e('0x7')](_0x54eddb);}return null;};}function saveUpdates(_0x3cb3c8,_0x460aad){return function(_0x581525){if(_0x581525){return _0x581525['update'](_0x3cb3c8)[_0x656e('0xd')](function(_0x3b1bb6){return _0x3b1bb6;});}return null;};}function handleEntityNotFound(_0x53699e,_0x230249){return function(_0x5059d9){if(!_0x5059d9){_0x53699e[_0x656e('0xe')](0x194);}return _0x5059d9;};}function handleError(_0x7e4d57,_0x2a52f7){_0x2a52f7=_0x2a52f7||0x1f4;return function(_0x1f839f){logger['error'](_0x1f839f[_0x656e('0xf')]);if(_0x1f839f[_0x656e('0x10')]){delete _0x1f839f[_0x656e('0x10')];}_0x7e4d57[_0x656e('0x6')](_0x2a52f7)[_0x656e('0x11')](_0x1f839f);};}exports['index']=function(_0x5e762d,_0x526b83){var _0x4318d1={},_0x1b0fdd={},_0x577deb={'count':0x0,'rows':[]};var _0x2d7a83=_['map'](db['CmHopper']['rawAttributes'],function(_0x17fa10){return{'name':_0x17fa10[_0x656e('0x12')],'type':_0x17fa10[_0x656e('0x13')][_0x656e('0x14')]};});_0x1b0fdd['model']=_[_0x656e('0x15')](_0x2d7a83,_0x656e('0x10'));_0x1b0fdd[_0x656e('0x16')]=_['keys'](_0x5e762d[_0x656e('0x16')]);_0x1b0fdd[_0x656e('0x17')]=_[_0x656e('0x18')](_0x1b0fdd[_0x656e('0x19')],_0x1b0fdd[_0x656e('0x16')]);_0x1b0fdd[_0x656e('0x17')]=_[_0x656e('0x1a')](_0x1b0fdd['filters'],[_0x656e('0x1b'),_0x656e('0x1c'),'$gt','$gte',_0x656e('0x1d'),'$lte',_0x656e('0x1e'),'$eq','$not',_0x656e('0x1f'),'$notBetween',_0x656e('0x20'),_0x656e('0x21'),_0x656e('0x22'),'$notLike','$iLike',_0x656e('0x23'),_0x656e('0x22'),_0x656e('0x24'),_0x656e('0x25'),_0x656e('0x26'),_0x656e('0x27')]);_0x4318d1[_0x656e('0x28')]=_['intersection'](_0x1b0fdd[_0x656e('0x19')],qs['fields'](_0x5e762d[_0x656e('0x16')][_0x656e('0x29')]));_0x4318d1['attributes']=_0x4318d1[_0x656e('0x28')]['length']?_0x4318d1['attributes']:_0x1b0fdd[_0x656e('0x19')];if(!_0x5e762d[_0x656e('0x16')][_0x656e('0x2a')]('nolimit')){_0x4318d1[_0x656e('0xa')]=qs['limit'](_0x5e762d[_0x656e('0x16')][_0x656e('0xa')]);_0x4318d1['offset']=qs[_0x656e('0x8')](_0x5e762d['query']['offset']);}_0x4318d1[_0x656e('0x2b')]=qs['sort'](_0x5e762d[_0x656e('0x16')][_0x656e('0x2c')]);_0x4318d1[_0x656e('0x2d')]=qs[_0x656e('0x17')](_['pick'](_0x5e762d['query'],_0x1b0fdd[_0x656e('0x17')]),_0x2d7a83);if(_0x5e762d['query'][_0x656e('0x2e')]){_0x4318d1[_0x656e('0x2d')]=_[_0x656e('0x2f')](_0x4318d1[_0x656e('0x2d')],{'$or':_[_0x656e('0x15')](_0x2d7a83,function(_0x1e897a){if(_0x1e897a['type']!=='VIRTUAL'){var _0x4f770c={};_0x4f770c[_0x1e897a['name']]={'$like':'%'+_0x5e762d['query'][_0x656e('0x2e')]+'%'};return _0x4f770c;}})});}_0x4318d1=_['merge']({},_0x4318d1,_0x5e762d['options']);var _0x10dfd6={'where':_0x4318d1[_0x656e('0x2d')]};return db[_0x656e('0x30')][_0x656e('0xb')](_0x10dfd6)[_0x656e('0xd')](function(_0x9efc05){_0x577deb[_0x656e('0xb')]=_0x9efc05;if(_0x5e762d[_0x656e('0x16')][_0x656e('0x31')]){_0x4318d1[_0x656e('0x32')]=[{'all':!![]}];}return db[_0x656e('0x30')][_0x656e('0x33')](_0x4318d1);})[_0x656e('0xd')](function(_0x4c49be){_0x577deb[_0x656e('0x34')]=_0x4c49be;return _0x577deb;})['then'](respondWithFilteredResult(_0x526b83,_0x4318d1))['catch'](handleError(_0x526b83,null));};exports[_0x656e('0x35')]=function(_0x1d10eb,_0x4163c3){var _0x5cd5e9={'raw':!![],'where':{'id':_0x1d10eb['params']['id']}},_0x554ef2={};_0x554ef2[_0x656e('0x19')]=_[_0x656e('0x36')](db[_0x656e('0x30')][_0x656e('0x37')]);_0x554ef2[_0x656e('0x16')]=_[_0x656e('0x36')](_0x1d10eb[_0x656e('0x16')]);_0x554ef2[_0x656e('0x17')]=_[_0x656e('0x18')](_0x554ef2[_0x656e('0x19')],_0x554ef2[_0x656e('0x16')]);_0x5cd5e9[_0x656e('0x28')]=_[_0x656e('0x18')](_0x554ef2['model'],qs[_0x656e('0x29')](_0x1d10eb['query'][_0x656e('0x29')]));_0x5cd5e9[_0x656e('0x28')]=_0x5cd5e9[_0x656e('0x28')][_0x656e('0x38')]?_0x5cd5e9[_0x656e('0x28')]:_0x554ef2[_0x656e('0x19')];if(_0x1d10eb[_0x656e('0x16')][_0x656e('0x31')]){_0x5cd5e9[_0x656e('0x32')]=[{'all':!![]}];}_0x5cd5e9=_[_0x656e('0x2f')]({},_0x5cd5e9,_0x1d10eb['options']);return db[_0x656e('0x30')][_0x656e('0x39')](_0x5cd5e9)[_0x656e('0xd')](handleEntityNotFound(_0x4163c3,null))['then'](respondWithResult(_0x4163c3,null))['catch'](handleError(_0x4163c3,null));};exports[_0x656e('0x3a')]=function(_0x20f6fb,_0xca79c6){return db[_0x656e('0x30')]['create'](_0x20f6fb[_0x656e('0x3b')],{})[_0x656e('0xd')](respondWithResult(_0xca79c6,0xc9))[_0x656e('0x3c')](handleError(_0xca79c6,null));};exports[_0x656e('0x3d')]=function(_0x3d1241,_0x572035){if(_0x3d1241[_0x656e('0x3b')]['id']){delete _0x3d1241[_0x656e('0x3b')]['id'];}return db[_0x656e('0x30')][_0x656e('0x39')]({'where':{'id':_0x3d1241[_0x656e('0x3e')]['id']}})[_0x656e('0xd')](handleEntityNotFound(_0x572035,null))['then'](saveUpdates(_0x3d1241[_0x656e('0x3b')],null))[_0x656e('0xd')](respondWithResult(_0x572035,null))[_0x656e('0x3c')](handleError(_0x572035,null));};exports[_0x656e('0x3f')]=function(_0x5dbcfb,_0x4ff9b5){return db[_0x656e('0x30')]['describe']()['then'](respondWithResult(_0x4ff9b5,null))['catch'](handleError(_0x4ff9b5,null));};exports[_0x656e('0x40')]=function(_0x2c648e,_0x59cb0f){var _0x48c36d;var _0x57d0e3=_0x2c648e['params']['id'];return db[_0x656e('0x30')][_0x656e('0x39')]({'where':{'id':_0x2c648e['params']['id']}})[_0x656e('0xd')](handleEntityNotFound(_0x59cb0f,null))[_0x656e('0xd')](function(_0x40bf72){if(_0x40bf72){return _0x40bf72[_0x656e('0x40')]()[_0x656e('0xd')](function(_0x3e8d90){return _0x3e8d90;});}})[_0x656e('0xd')](function(_0x2525da){_0x48c36d=_0x2525da;if(_0x2525da){if(_0x2525da[_0x656e('0x41')]||_0x2525da[_0x656e('0x42')]){return db[_0x2525da[_0x656e('0x41')]?'VoiceQueue':'Campaign']['find']({'where':{'id':_0x2525da['VoiceQueueId']?_0x2525da[_0x656e('0x41')]:_0x2525da[_0x656e('0x42')]},'attributes':['id',_0x656e('0x10')],'raw':!![]});}}})['then'](function(_0x4c3834){var _0x23f758={};if(_0x4c3834){_['merge'](_0x23f758,_[_0x656e('0x43')](_0x48c36d[_0x656e('0x44')],[_0x656e('0x45'),'updatedAt','id']));_0x23f758['state']=0x15;_0x23f758[_0x656e('0x46')]=_0x656e('0x47');_0x23f758[_0x656e('0x48')]=_0x4c3834[_0x656e('0x10')];_0x23f758[_0x656e('0x49')]=_0x2c648e[_0x656e('0x4a')][_0x656e('0x10')];_0x23f758[_0x656e('0x4b')]=_0x2c648e[_0x656e('0x4a')]['id'];_0x23f758['deleted']=!![];_0x23f758[_0x656e('0x4c')]=moment()[_0x656e('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x23f758[_0x656e('0x4e')]=_0x48c36d['phone'];_0x23f758['campaigntype']=_0x48c36d[_0x656e('0x41')]?_0x656e('0x4f'):_0x656e('0x50');return db['CmContact'][_0x656e('0x39')]({'where':{'id':_0x23f758[_0x656e('0x51')]},'attributes':['firstName','lastName']})['then'](function(_0x470e8c){if(!_[_0x656e('0x52')](_0x59cb0f)&&!_['isNil'](_0x470e8c[_0x656e('0x53')])){_0x23f758[_0x656e('0x54')]=_0x470e8c[_0x656e('0x53')];if(!_[_0x656e('0x52')](_0x470e8c[_0x656e('0x55')])){_0x23f758['calleridname']+='\x20'+_0x470e8c[_0x656e('0x55')];}}})[_0x656e('0x56')](function(){return db['CmHopperFinal']['create'](_0x23f758);});}})[_0x656e('0xd')](function(_0x5247d7){return db[_0x656e('0x57')][_0x656e('0x40')]({'where':{'CmHopperId':_0x57d0e3}});})[_0x656e('0xd')](function(){return _0x59cb0f['status'](0xcc)[_0x656e('0x58')]();})[_0x656e('0x3c')](handleError(_0x59cb0f,null));};exports[_0x656e('0x59')]=function(_0x3bcf5b,_0x12ccf0){var _0x50a941=[];return db[_0x656e('0x5a')][_0x656e('0x3f')]()['then'](function(_0x1f1eaf){_0x50a941=_[_0x656e('0x36')](_0x1f1eaf);return _0x3bcf5b[_0x656e('0x4a')][_0x656e('0x5b')]({'where':{'type':_0x656e('0x5c'),'dialActive':!![],'dialMethod':_0x656e('0x5d')},'attributes':['id',_0x656e('0x5e'),_0x656e('0x5f')],'raw':!![]});})['then'](function(_0x104c44){if(_0x104c44&&_0x104c44[_0x656e('0x38')]){return db['sequelize']['transaction'](function(_0xfe3fdf){var _0x139212={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x656e('0x4d')](_0x656e('0x60'))},'VoiceQueueId':{'$in':_[_0x656e('0x15')](_0x104c44,'id')},'$or':[{'UserId':null},{'UserId':_0x3bcf5b['user']['id']}]};var _0x3ee153={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x104c44)['filter']([_0x656e('0x5f'),0x0])[_0x656e('0x15')]('id')[_0x656e('0x61')]()},'$or':[{'UserId':null},{'UserId':_0x3bcf5b['user']['id']}]};var _0x1ad6e8={'$or':[_0x139212,_0x3ee153]};var _0x5487c6=[];if(_0x3bcf5b[_0x656e('0x3b')][_0x656e('0x62')]&&_0x3bcf5b[_0x656e('0x3b')][_0x656e('0x62')]==='prev'){if(!_[_0x656e('0x63')](_0x3bcf5b[_0x656e('0x3b')][_0x656e('0x64')])){_0x1ad6e8['id']={'$in':_0x3bcf5b['body']['hopperIds']};}_0x5487c6=[['priority','ASC'],['scheduledAt',_0x104c44[0x0][_0x656e('0x5e')]===_0x656e('0x65')?_0x656e('0x66'):'ASC'],db[_0x656e('0x67')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x656e('0x66')]];}else{if(!_[_0x656e('0x63')](_0x3bcf5b['body'][_0x656e('0x64')])){_0x1ad6e8['id']={'$notIn':_0x3bcf5b[_0x656e('0x3b')][_0x656e('0x64')]};}_0x5487c6=[[_0x656e('0x68'),_0x656e('0x66')],[_0x656e('0x69'),_0x104c44[0x0][_0x656e('0x5e')]],db[_0x656e('0x67')][_0x656e('0x6a')](_0x656e('0x6b')),['id',_0x656e('0x65')]];}return db[_0x656e('0x30')][_0x656e('0x6c')]({'attributes':['id',_0x656e('0x6d'),_0x656e('0x6e'),_0x656e('0x6f')],'where':_0x1ad6e8,'order':_0x5487c6,'transaction':_0xfe3fdf,'lock':_0xfe3fdf[_0x656e('0x70')][_0x656e('0x71')],'include':[{'model':db['CmContact'],'as':_0x656e('0x72'),'attributes':_0x50a941,'include':[{'model':db[_0x656e('0x73')],'as':_0x656e('0x74'),'attributes':['id','name']}]},{'model':db[_0x656e('0x75')],'as':'List','attributes':['id',_0x656e('0x10')]},{'model':db[_0x656e('0x76')],'as':'Queue','attributes':['id',_0x656e('0x10'),'dialActive']}]})['then'](function(_0x11b41e){if(_0x11b41e){return _0x11b41e['update']({'UserId':_0x3bcf5b[_0x656e('0x4a')]['id']},{'transaction':_0xfe3fdf});}});});}})[_0x656e('0xd')](handleEntityNotFound(_0x12ccf0,null))[_0x656e('0xd')](respondWithResult(_0x12ccf0,null))[_0x656e('0x3c')](handleError(_0x12ccf0,null));};exports[_0x656e('0x77')]=function(_0xe8d91a,_0x25788b,_0x42f8cf){var _0x510aa0=[];var _0x1e8069=_0xe8d91a[_0x656e('0x3e')]['id'];var _0x185bb5=_0xe8d91a[_0x656e('0x4a')]['id'];return db[_0x656e('0x5a')][_0x656e('0x3f')]()[_0x656e('0xd')](function(_0x133864){_0x510aa0=_[_0x656e('0x36')](_0x133864);return db[_0x656e('0x67')][_0x656e('0x78')](function(_0x3373b5){const _0x35ae18={'id':_0x1e8069};return db[_0x656e('0x30')][_0x656e('0x6c')]({'attributes':['id',_0x656e('0x6d'),'recallme'],'where':_0x35ae18,'transaction':_0x3373b5,'lock':_0x3373b5[_0x656e('0x70')][_0x656e('0x71')],'include':[{'model':db[_0x656e('0x5a')],'as':_0x656e('0x72'),'attributes':_0x510aa0,'include':[{'model':db['CmCompany'],'as':_0x656e('0x74'),'attributes':['id',_0x656e('0x10')]}]},{'model':db[_0x656e('0x75')],'as':_0x656e('0x79'),'attributes':['id','name']},{'model':db[_0x656e('0x76')],'as':_0x656e('0x7a'),'attributes':['id',_0x656e('0x10'),_0x656e('0x7b')]}]})[_0x656e('0xd')](function(_0x10921d){if(_0x10921d){return _0x10921d[_0x656e('0x3d')]({'UserId':_0x185bb5},{'transaction':_0x3373b5});}});});})[_0x656e('0xd')](handleEntityNotFound(_0x25788b,null))[_0x656e('0xd')](respondWithResult(_0x25788b,null))[_0x656e('0x3c')](handleError(_0x25788b,null));};exports[_0x656e('0x7c')]=function(_0xbd6e0a,_0x221d91){return _0xbd6e0a['user']['getVoiceQueues']({'where':{'type':_0x656e('0x5c'),'dialActive':!![],'dialMethod':_0x656e('0x5d')},'attributes':['id'],'raw':!![]})[_0x656e('0xd')](function(_0x4ee759){if(_0x4ee759&&_0x4ee759[_0x656e('0x38')]){return db[_0x656e('0x30')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x656e('0x60'))},'VoiceQueueId':{'$in':_[_0x656e('0x15')](_0x4ee759,'id')},'$or':[{'UserId':null},{'UserId':_0xbd6e0a[_0x656e('0x4a')]['id']}]}});}return 0x0;})[_0x656e('0xd')](function(_0x2c2bd1){if(!_[_0x656e('0x52')](_0x2c2bd1)&&_[_0x656e('0x7d')](_0x2c2bd1)){return _0x221d91[_0x656e('0x6')](0xc8)[_0x656e('0x7')]({'contacts':_0x2c2bd1});}else{logger[_0x656e('0x7e')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x656e('0x7c'),0x194,_0x656e('0x7f'));_0x221d91[_0x656e('0xe')](0x194);}})[_0x656e('0x3c')](handleError(_0x221d91,null));};exports['getTimezones']=function(_0x2c4349,_0x5298ce){var _0x43079d=shared[_0x656e('0x80')];var _0x1db833=[];_['map'](_0x43079d,function(_0x2ad34a){_0x1db833['push']({'id':_0x2ad34a[_0x656e('0x10')],'name':_0x2ad34a[_0x656e('0x10')],'utcOffset':_0x2ad34a['utcOffset']});});return _0x5298ce[_0x656e('0x6')](0xc8)[_0x656e('0x7')]({'tz':_0x1db833});};exports[_0x656e('0x81')]=function(_0x5bf139,_0x3c82e1){var _0x1d5fe2=shared[_0x656e('0x80')];var _0xe636e4={};if(!_[_0x656e('0x52')](_0x1d5fe2[_0x5bf139[_0x656e('0x3b')]['id']]))_0xe636e4=_0x1d5fe2[_0x5bf139[_0x656e('0x3b')]['id']];return _0x3c82e1[_0x656e('0x6')](0xc8)[_0x656e('0x7')](_0xe636e4);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index c308585..f6b831a 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 _0x7a54=['bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','priority','lodash','util','../../config/logger','moment'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x7a54,0x106));var _0x47a5=function(_0x563669,_0x28e4e5){_0x563669=_0x563669-0x0;var _0x3d1015=_0x7a54[_0x563669];return _0x3d1015;};'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':'scheduledat','fields':[_0x47a5('0xc')]},{'name':'phone','fields':['phone']},{'name':'priority','fields':[_0x47a5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f47=['CmHopper','scheduledat','phone','priority','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports','define'];(function(_0x529f1c,_0x437ed1){var _0x4d57ab=function(_0x39d479){while(--_0x39d479){_0x529f1c['push'](_0x529f1c['shift']());}};_0x4d57ab(++_0x437ed1);}(_0x6f47,0xc7));var _0x76f4=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x6f47[_0xd1d19a];return _0x52a79d;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var logger=require(_0x76f4('0x1'))('api');var moment=require(_0x76f4('0x2'));var BPromise=require('bluebird');var rp=require(_0x76f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var attributes=require(_0x76f4('0x6'));module[_0x76f4('0x7')]=function(_0x5754ca,_0x35602f){return _0x5754ca[_0x76f4('0x8')](_0x76f4('0x9'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x76f4('0xa'),'fields':[_0x76f4('0xa')]},{'name':_0x76f4('0xb'),'fields':[_0x76f4('0xb')]},{'name':_0x76f4('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index a43d401..8dbbe15 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 _0xba88=['DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','CmList','List','lodash','util','moment','bluebird','../../config/logger','rpc','GetCmHopper','findAll','options','raw','attributes','limit','map','include','model','then','stringify','error','message','ShowCmHopper','CmHopper','find','where','info','debug','catch','body','CreateCmHopper','UpdateCmHopper','update','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','order','UPDATE','keys','User','Agent','name','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','contactsRescheduled','GetContactRecallMe','LOCK','Contact','dialTimezone'];(function(_0xa77a6,_0x41f62a){var _0x2cae66=function(_0x271380){while(--_0x271380){_0xa77a6['push'](_0xa77a6['shift']());}};_0x2cae66(++_0x41f62a);}(_0xba88,0xed));var _0x8ba8=function(_0x2ccad2,_0x2e9ff1){_0x2ccad2=_0x2ccad2-0x0;var _0x31d6e6=_0xba88[_0x2ccad2];return _0x31d6e6;};'use strict';var _=require(_0x8ba8('0x0'));var util=require(_0x8ba8('0x1'));var moment=require(_0x8ba8('0x2'));var BPromise=require(_0x8ba8('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x8ba8('0x4'))(_0x8ba8('0x5'));exports[_0x8ba8('0x6')]=function(_0x5ac532){var _0x435aba=this;return new Promise(function(_0xf4e6de,_0x2fe9a1){return db['CmHopper'][_0x8ba8('0x7')]({'raw':_0x5ac532[_0x8ba8('0x8')]?_0x5ac532[_0x8ba8('0x8')][_0x8ba8('0x9')]===undefined?!![]:![]:!![],'where':_0x5ac532[_0x8ba8('0x8')]?_0x5ac532[_0x8ba8('0x8')]['where']||null:null,'attributes':_0x5ac532[_0x8ba8('0x8')]?_0x5ac532[_0x8ba8('0x8')][_0x8ba8('0xa')]||null:null,'limit':_0x5ac532['options']?_0x5ac532[_0x8ba8('0x8')][_0x8ba8('0xb')]||null:null,'include':_0x5ac532['options']?_0x5ac532[_0x8ba8('0x8')]['include']?_[_0x8ba8('0xc')](_0x5ac532['options'][_0x8ba8('0xd')],function(_0x63d6be){return{'model':db[_0x63d6be[_0x8ba8('0xe')]],'as':_0x63d6be['as'],'attributes':_0x63d6be['attributes'],'include':_0x63d6be[_0x8ba8('0xd')]?_[_0x8ba8('0xc')](_0x63d6be[_0x8ba8('0xd')],function(_0x33c0f3){return{'model':db[_0x33c0f3['model']],'as':_0x33c0f3['as'],'attributes':_0x33c0f3[_0x8ba8('0xa')],'include':_0x33c0f3['include']?_['map'](_0x33c0f3[_0x8ba8('0xd')],function(_0xbb6f59){return{'model':db[_0xbb6f59[_0x8ba8('0xe')]],'as':_0xbb6f59['as'],'attributes':_0xbb6f59['attributes']};}):[]};}):[]};}):[]:[]})[_0x8ba8('0xf')](function(_0x5bb8a1){logger['info'](_0x8ba8('0x6'),_0x5ac532);logger['debug'](_0x8ba8('0x6'),_0x5ac532,JSON[_0x8ba8('0x10')](_0x5bb8a1));_0xf4e6de(_0x5bb8a1);})['catch'](function(_0x640c2b){logger[_0x8ba8('0x11')](_0x8ba8('0x6'),_0x640c2b[_0x8ba8('0x12')],_0x5ac532);_0x2fe9a1(_0x435aba[_0x8ba8('0x11')](0x1f4,_0x640c2b[_0x8ba8('0x12')]));});});};exports[_0x8ba8('0x13')]=function(_0xd2ddd0){var _0x4c02e6=this;return new Promise(function(_0xf00c19,_0x1e6c74){return db[_0x8ba8('0x14')][_0x8ba8('0x15')]({'raw':_0xd2ddd0[_0x8ba8('0x8')]?_0xd2ddd0[_0x8ba8('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0xd2ddd0[_0x8ba8('0x8')]?_0xd2ddd0[_0x8ba8('0x8')][_0x8ba8('0x16')]||null:null,'attributes':_0xd2ddd0[_0x8ba8('0x8')]?_0xd2ddd0[_0x8ba8('0x8')][_0x8ba8('0xa')]||null:null,'include':_0xd2ddd0[_0x8ba8('0x8')]?_0xd2ddd0[_0x8ba8('0x8')][_0x8ba8('0xd')]?_['map'](_0xd2ddd0[_0x8ba8('0x8')][_0x8ba8('0xd')],function(_0x3fac2c){return{'model':db[_0x3fac2c[_0x8ba8('0xe')]],'as':_0x3fac2c['as'],'attributes':_0x3fac2c[_0x8ba8('0xa')],'include':_0x3fac2c['include']?_['map'](_0x3fac2c[_0x8ba8('0xd')],function(_0xa31ad3){return{'model':db[_0xa31ad3[_0x8ba8('0xe')]],'as':_0xa31ad3['as'],'attributes':_0xa31ad3[_0x8ba8('0xa')],'include':_0xa31ad3[_0x8ba8('0xd')]?_[_0x8ba8('0xc')](_0xa31ad3[_0x8ba8('0xd')],function(_0x4bda2e){return{'model':db[_0x4bda2e[_0x8ba8('0xe')]],'as':_0x4bda2e['as'],'attributes':_0x4bda2e[_0x8ba8('0xa')]};}):[]};}):[]};}):[]:[]})[_0x8ba8('0xf')](function(_0x3dccb4){logger[_0x8ba8('0x17')]('ShowCmHopper',_0xd2ddd0);logger[_0x8ba8('0x18')]('ShowCmHopper',_0xd2ddd0,JSON[_0x8ba8('0x10')](_0x3dccb4));_0xf00c19(_0x3dccb4);})[_0x8ba8('0x19')](function(_0x4f3f52){logger[_0x8ba8('0x11')](_0x8ba8('0x13'),_0x4f3f52[_0x8ba8('0x12')],_0xd2ddd0);_0x1e6c74(_0x4c02e6['error'](0x1f4,_0x4f3f52[_0x8ba8('0x12')]));});});};exports['CreateCmHopper']=function(_0x32fc2d){var _0x5dcbf7=this;return new Promise(function(_0x29b8c2,_0x1723fc){return db['CmHopper']['create'](_0x32fc2d[_0x8ba8('0x1a')],{'raw':_0x32fc2d[_0x8ba8('0x8')]?_0x32fc2d[_0x8ba8('0x8')][_0x8ba8('0x9')]===undefined?!![]:![]:!![]})[_0x8ba8('0xf')](function(_0x12a97e){logger[_0x8ba8('0x17')](_0x8ba8('0x1b'),_0x32fc2d);logger[_0x8ba8('0x18')](_0x8ba8('0x1b'),_0x32fc2d,JSON['stringify'](_0x12a97e));_0x29b8c2(_0x12a97e);})[_0x8ba8('0x19')](function(_0x32d56b){logger[_0x8ba8('0x11')]('CreateCmHopper',_0x32d56b['message'],_0x32fc2d);_0x1723fc(_0x5dcbf7[_0x8ba8('0x11')](0x1f4,_0x32d56b[_0x8ba8('0x12')]));});});};exports[_0x8ba8('0x1c')]=function(_0x1b1e26){var _0x58e56d=this;return new Promise(function(_0x19d1fe,_0x1a0f99){return db['CmHopper'][_0x8ba8('0x1d')](_0x1b1e26['body'],{'raw':_0x1b1e26[_0x8ba8('0x8')]?_0x1b1e26['options'][_0x8ba8('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b1e26['options']?_0x1b1e26[_0x8ba8('0x8')][_0x8ba8('0x16')]||null:null,'attributes':_0x1b1e26[_0x8ba8('0x8')]?_0x1b1e26[_0x8ba8('0x8')][_0x8ba8('0xa')]||null:null,'limit':_0x1b1e26[_0x8ba8('0x8')]?_0x1b1e26[_0x8ba8('0x8')][_0x8ba8('0xb')]||null:null})[_0x8ba8('0xf')](function(_0x592c84){logger['info'](_0x8ba8('0x1c'),_0x1b1e26);logger[_0x8ba8('0x17')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x8ba8('0x10')](_0x1b1e26['options']['where']),_0x1b1e26[_0x8ba8('0x1a')][_0x8ba8('0x1e')]);logger[_0x8ba8('0x18')](_0x8ba8('0x1c'),_0x1b1e26,JSON['stringify'](_0x592c84));_0x19d1fe(_0x592c84);})['catch'](function(_0x1d614c){logger[_0x8ba8('0x11')](_0x8ba8('0x1c'),_0x1d614c['message'],_0x1b1e26);_0x1a0f99(_0x58e56d[_0x8ba8('0x11')](0x1f4,_0x1d614c[_0x8ba8('0x12')]));});});};exports[_0x8ba8('0x1f')]=function(_0x309690){var _0x1296f7=this;return new Promise(function(_0x2f9905,_0x1e3d29){return db[_0x8ba8('0x14')][_0x8ba8('0x20')]({'where':_0x309690[_0x8ba8('0x8')]?_0x309690[_0x8ba8('0x8')][_0x8ba8('0x16')]||null:null})[_0x8ba8('0xf')](function(_0x5290c8){logger[_0x8ba8('0x17')](_0x8ba8('0x1f'),_0x309690);logger[_0x8ba8('0x18')](_0x8ba8('0x1f'),_0x309690,JSON[_0x8ba8('0x10')](_0x5290c8));_0x2f9905(_0x5290c8);})['catch'](function(_0x18a8b5){logger[_0x8ba8('0x11')](_0x8ba8('0x1f'),_0x18a8b5[_0x8ba8('0x12')],_0x309690);_0x1e3d29(_0x1296f7[_0x8ba8('0x11')](0x1f4,_0x18a8b5[_0x8ba8('0x12')]));});});};exports[_0x8ba8('0x21')]=function(_0x584645){var _0x451d7c=this;return new Promise(function(_0x294a55,_0x58172e){return db[_0x8ba8('0x22')][_0x8ba8('0x23')]()[_0x8ba8('0xf')](function(_0x145b02){return db['sequelize'][_0x8ba8('0x24')](function(_0x50e2bc){return db[_0x8ba8('0x14')]['findAll']({'where':_0x584645[_0x8ba8('0x8')]?_0x584645[_0x8ba8('0x8')]['where']||null:null,'attributes':_0x584645[_0x8ba8('0x8')]?_0x584645[_0x8ba8('0x8')][_0x8ba8('0xa')]||null:null,'limit':_0x584645[_0x8ba8('0x8')]?_0x584645['options'][_0x8ba8('0xb')]||null:null,'order':_0x584645[_0x8ba8('0x8')]?_0x584645[_0x8ba8('0x8')][_0x8ba8('0x25')]||null:null,'transaction':_0x50e2bc,'lock':_0x50e2bc['LOCK'][_0x8ba8('0x26')],'include':[{'model':db[_0x8ba8('0x22')],'as':'Contact','attributes':_[_0x8ba8('0x27')](_0x145b02)},{'model':db[_0x8ba8('0x28')],'as':_0x8ba8('0x29'),'attributes':['id',_0x8ba8('0x2a'),_0x8ba8('0x2b')]}]})['then'](function(_0xc53001){var _0x456579=[];var _0x4bf048=[];for(var _0x5b2c35=0x0;_0x5b2c35<_0xc53001[_0x8ba8('0x2c')];_0x5b2c35+=0x1){var _0xb4c5bb=_0xc53001[_0x5b2c35][_0x8ba8('0x2d')];if(_0xb4c5bb===null){_0x456579[_0x8ba8('0x2e')](_0xc53001[_0x5b2c35][_0x8ba8('0x1d')](_0x584645[_0x8ba8('0x1a')],{'transaction':_0x50e2bc}));}else if(!_0x4bf048[_0x8ba8('0x2f')](_0xb4c5bb)){_0x4bf048[_0x8ba8('0x2e')](_0xb4c5bb);_0x456579['push'](_0xc53001[_0x5b2c35]['update'](_0x584645['body'],{'transaction':_0x50e2bc}));}}return BPromise[_0x8ba8('0x30')](_0x456579);});})[_0x8ba8('0xf')](function(_0x50a672){logger[_0x8ba8('0x17')](_0x8ba8('0x21'),_0x584645);if(_0x50a672[_0x8ba8('0x2c')]>0x0){logger[_0x8ba8('0x17')](_0x8ba8('0x31'),_0x50a672[0x0]['dataValues']['id'],_0x50a672[0x0][_0x8ba8('0x32')][_0x8ba8('0x33')],_0x50a672[0x0][_0x8ba8('0x32')][_0x8ba8('0x1e')]);}logger[_0x8ba8('0x18')](_0x8ba8('0x21'),_0x584645,JSON[_0x8ba8('0x10')](_0x50a672));_0x294a55(_0x50a672);})[_0x8ba8('0x19')](function(_0xe688b0){logger[_0x8ba8('0x11')]('GetContactDialer',_0xe688b0[_0x8ba8('0x12')],_0x584645);_0x58172e(_0x451d7c[_0x8ba8('0x11')](0x1f4,_0xe688b0[_0x8ba8('0x12')]));});});});};exports[_0x8ba8('0x34')]=function(_0x49b0ab){var _0x4ec6fe=this;return new Promise(function(_0x51d050,_0x51339d){return db[_0x8ba8('0x35')][_0x8ba8('0x24')](function(_0x7f9cdb){return db[_0x8ba8('0x36')][_0x8ba8('0x37')](_0x49b0ab[_0x8ba8('0x1a')],{'raw':_0x49b0ab[_0x8ba8('0x8')]?_0x49b0ab[_0x8ba8('0x8')][_0x8ba8('0x9')]===undefined?!![]:![]:!![],'transaction':_0x7f9cdb})[_0x8ba8('0xf')](function(){logger[_0x8ba8('0x17')](_0x8ba8('0x38'),JSON[_0x8ba8('0x10')](_0x49b0ab[_0x8ba8('0x8')][_0x8ba8('0x16')]),_0x49b0ab['options'][_0x8ba8('0x16')]['active']);return db[_0x8ba8('0x14')]['destroy']({'where':_0x49b0ab['options']?_0x49b0ab[_0x8ba8('0x8')][_0x8ba8('0x16')]||null:null,'transaction':_0x7f9cdb});});})[_0x8ba8('0xf')](function(_0x5cb4d4){logger[_0x8ba8('0x17')](_0x8ba8('0x34'),_0x49b0ab);logger[_0x8ba8('0x18')](_0x8ba8('0x34'),_0x49b0ab,JSON['stringify'](_0x5cb4d4));_0x51d050(_0x5cb4d4);})[_0x8ba8('0x19')](function(_0x3688df){logger[_0x8ba8('0x11')](_0x8ba8('0x34'),_0x3688df[_0x8ba8('0x12')],_0x49b0ab);_0x51339d(_0x4ec6fe['error'](0x1f4,_0x3688df[_0x8ba8('0x12')]));});});};exports[_0x8ba8('0x39')]=function(_0x4e2306){var _0xb4fe14=this;return new Promise(function(_0xccfe63,_0x5206ea){return db[_0x8ba8('0x14')][_0x8ba8('0x7')]({'raw':_0x4e2306[_0x8ba8('0x8')]?_0x4e2306[_0x8ba8('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x4e2306[_0x8ba8('0x8')]?_0x4e2306[_0x8ba8('0x8')]['where']||null:null,'attributes':[[db[_0x8ba8('0x35')]['fn']('COUNT',db[_0x8ba8('0x35')]['fn']('IF',db[_0x8ba8('0x35')][_0x8ba8('0x3a')](_0x8ba8('0x3b')+util[_0x8ba8('0x3c')](_0x8ba8('0x3d'),moment()[_0x8ba8('0x3c')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0x8ba8('0x3e')]]})[_0x8ba8('0xf')](function(_0x38d609){logger[_0x8ba8('0x17')](_0x8ba8('0x39'),_0x4e2306);logger[_0x8ba8('0x18')]('CountReScheduled',_0x4e2306,JSON[_0x8ba8('0x10')](_0x38d609));_0xccfe63(_0x38d609);})['catch'](function(_0x31741e){logger[_0x8ba8('0x11')](_0x8ba8('0x39'),_0x31741e[_0x8ba8('0x12')],_0x4e2306);_0x5206ea(_0xb4fe14['error'](0x1f4,_0x31741e[_0x8ba8('0x12')]));});});};exports[_0x8ba8('0x3f')]=function(_0x172f01){var _0x59f0c5=this;return new Promise(function(_0x1f5fc7,_0x2cbae3){return db[_0x8ba8('0x22')][_0x8ba8('0x23')]()[_0x8ba8('0xf')](function(){return db[_0x8ba8('0x35')][_0x8ba8('0x24')](function(_0x372110){return db[_0x8ba8('0x14')]['findAll']({'where':_0x172f01[_0x8ba8('0x8')]?_0x172f01[_0x8ba8('0x8')][_0x8ba8('0x16')]||null:null,'attributes':_0x172f01[_0x8ba8('0x8')]?_0x172f01[_0x8ba8('0x8')][_0x8ba8('0xa')]||null:null,'limit':0x1,'order':_0x172f01[_0x8ba8('0x8')]?_0x172f01[_0x8ba8('0x8')][_0x8ba8('0x25')]||null:null,'group':db[_0x8ba8('0x14')]['UserId'],'transaction':_0x372110,'lock':_0x372110[_0x8ba8('0x40')][_0x8ba8('0x26')],'include':_0x172f01[_0x8ba8('0x8')]?_0x172f01[_0x8ba8('0x8')][_0x8ba8('0xd')]?_['map'](_0x172f01[_0x8ba8('0x8')][_0x8ba8('0xd')],function(_0x4cb7aa){return{'model':db[_0x4cb7aa['model']],'as':_0x4cb7aa['as'],'attributes':_0x4cb7aa[_0x8ba8('0xa')],'include':_0x4cb7aa['include']?_['map'](_0x4cb7aa[_0x8ba8('0xd')],function(_0x585209){return{'model':db[_0x585209['model']],'as':_0x585209['as'],'attributes':_0x585209[_0x8ba8('0xa')],'include':_0x585209[_0x8ba8('0xd')]?_['map'](_0x585209['include'],function(_0x3eeb19){return{'model':db[_0x3eeb19['model']],'as':_0x3eeb19['as'],'attributes':_0x3eeb19[_0x8ba8('0xa')]};}):[]};}):[]};}):[]:[]})[_0x8ba8('0xf')](function(_0x5012e2){var _0x5bbf1e=[];for(var _0xd7ad20=0x0;_0xd7ad20<_0x5012e2[_0x8ba8('0x2c')];_0xd7ad20+=0x1){_0x5bbf1e['push'](_0x5012e2[_0xd7ad20]['update'](_0x172f01[_0x8ba8('0x1a')],{'transaction':_0x372110}));}return BPromise[_0x8ba8('0x30')](_0x5bbf1e);});})[_0x8ba8('0xf')](function(_0x24af10){logger[_0x8ba8('0x17')](_0x8ba8('0x3f'),_0x172f01);logger['debug'](_0x8ba8('0x3f'),_0x172f01,JSON['stringify'](_0x24af10));_0x1f5fc7(_0x24af10);})[_0x8ba8('0x19')](function(_0xcb4497){logger[_0x8ba8('0x11')]('GetContactRecallMe',_0xcb4497[_0x8ba8('0x12')],_0x172f01);_0x2cbae3(_0x59f0c5[_0x8ba8('0x11')](0x1f4,_0xcb4497[_0x8ba8('0x12')]));});});});};exports['GetCmHopperPreview']=function(_0x1a0465){var _0x5ccf08=this;return new Promise(function(_0x5113ff,_0x543a26){db[_0x8ba8('0x22')][_0x8ba8('0x23')]()[_0x8ba8('0xf')](function(_0x88a4){return db[_0x8ba8('0x14')][_0x8ba8('0x7')]({'raw':_0x1a0465[_0x8ba8('0x8')]?_0x1a0465[_0x8ba8('0x8')][_0x8ba8('0x9')]===undefined?!![]:![]:!![],'where':_0x1a0465[_0x8ba8('0x8')]?_0x1a0465[_0x8ba8('0x8')]['where']||null:null,'attributes':_0x1a0465['options']?_0x1a0465[_0x8ba8('0x8')][_0x8ba8('0xa')]||null:null,'limit':_0x1a0465[_0x8ba8('0x8')]?_0x1a0465[_0x8ba8('0x8')][_0x8ba8('0xb')]||null:null,'include':_0x1a0465[_0x8ba8('0x8')]?_0x1a0465[_0x8ba8('0x8')][_0x8ba8('0xd')]?_['map'](_0x1a0465[_0x8ba8('0x8')][_0x8ba8('0xd')],function(_0x117c5e){return{'model':db[_0x117c5e[_0x8ba8('0xe')]],'as':_0x117c5e['as'],'attributes':_0x117c5e['as']===_0x8ba8('0x41')?_[_0x8ba8('0x27')](_0x88a4):_0x117c5e[_0x8ba8('0xa')],'include':_0x117c5e[_0x8ba8('0xd')]?_[_0x8ba8('0xc')](_0x117c5e['include'],function(_0x549b84){return{'model':db[_0x549b84[_0x8ba8('0xe')]],'as':_0x549b84['as'],'attributes':_0x549b84[_0x8ba8('0xa')],'include':_0x549b84[_0x8ba8('0xd')]?_[_0x8ba8('0xc')](_0x549b84['include'],function(_0x2bf4b2){return{'model':db[_0x2bf4b2[_0x8ba8('0xe')]],'as':_0x2bf4b2['as'],'attributes':_0x2bf4b2[_0x8ba8('0xa')]};}):[]};}):[]};}):[]:[]})[_0x8ba8('0xf')](function(_0x327ccf){logger[_0x8ba8('0x17')]('GetCmHopper',_0x1a0465);logger[_0x8ba8('0x18')](_0x8ba8('0x6'),_0x1a0465,JSON['stringify'](_0x327ccf));_0x5113ff(_0x327ccf);})['catch'](function(_0x57116d){logger['error'](_0x8ba8('0x6'),_0x57116d[_0x8ba8('0x12')],_0x1a0465);_0x543a26(_0x5ccf08[_0x8ba8('0x11')](0x1f4,_0x57116d[_0x8ba8('0x12')]));});});});};exports['GetContactByPhone']=function(_0x2443f5){var _0x2276fa=this;return new Promise(function(_0xaf6415,_0x41cfe4){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x2443f5[_0x8ba8('0x8')][_0x8ba8('0x16')]['phone']},'attributes':['id',_0x8ba8('0x42')],'order':[['id',_0x8ba8('0x43')]]})['then'](function(_0x46145e){logger[_0x8ba8('0x17')](_0x8ba8('0x44'),_0x2443f5);logger[_0x8ba8('0x18')](_0x8ba8('0x44'),_0x2443f5,JSON[_0x8ba8('0x10')](_0x46145e));_0xaf6415(_0x46145e);})[_0x8ba8('0x19')](function(_0x4a7d43){logger[_0x8ba8('0x11')](_0x8ba8('0x44'),_0x4a7d43[_0x8ba8('0x12')],_0x2443f5);_0x41cfe4(_0x2276fa[_0x8ba8('0x11')](0x1f4,_0x4a7d43['message']));});});};exports[_0x8ba8('0x45')]=function(_0x1f0315){var _0x1915d5=this;return new Promise(function(_0x410b8c,_0x226532){return db[_0x8ba8('0x35')][_0x8ba8('0x24')](function(_0x545fc1){var _0x3a5a88=_0x1f0315['options']&&_0x1f0315['options'][_0x8ba8('0x16')]?_0x1f0315[_0x8ba8('0x8')][_0x8ba8('0x16')]:{};return db[_0x8ba8('0x14')]['update'](_0x1f0315[_0x8ba8('0x1a')],{'where':_0x3a5a88,'transaction':_0x545fc1})[_0x8ba8('0xf')](function(_0x2d2b3b){logger[_0x8ba8('0x17')](_0x8ba8('0x45'),_0x1f0315);logger[_0x8ba8('0x18')]('ResetActiveCalls',_0x1f0315,JSON[_0x8ba8('0x10')](_0x2d2b3b));_0x410b8c(_0x2d2b3b);})[_0x8ba8('0x19')](function(_0x11e3d4){logger[_0x8ba8('0x11')](_0x8ba8('0x45'),_0x11e3d4[_0x8ba8('0x12')],_0x1f0315);_0x226532(_0x1915d5['error'](0x1f4,_0x11e3d4[_0x8ba8('0x12')]));});});});};exports[_0x8ba8('0x46')]=function(_0x5e492b){var _0x88c0e9=this;var _0x1a05d0=_0x5e492b[_0x8ba8('0x1a')]['where'][_0x8ba8('0x47')];var _0x149e1f=_0x5e492b[_0x8ba8('0x1a')][_0x8ba8('0x16')][_0x8ba8('0x48')];var _0x1c3805=_0x5e492b[_0x8ba8('0x1a')][_0x8ba8('0x16')][_0x8ba8('0x49')];return new Promise(function(_0x5cf997,_0x4f973e){return db[_0x8ba8('0x14')][_0x8ba8('0x7')]({'where':{'voiceQueueId':{'$in':_0x1a05d0},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x8ba8('0x3a')]('NOW()\x20+\x20INTERVAL\x20'+_0x149e1f+'\x20MINUTE'),'$gt':db[_0x8ba8('0x35')][_0x8ba8('0x3a')]('NOW()')}},'UserId':{'$in':_0x1c3805}},'include':[{'model':db[_0x8ba8('0x22')],'as':'Contact'},{'model':db['User'],'as':_0x8ba8('0x29'),'attributes':['id',_0x8ba8('0x2a'),'voicePause']},{'model':db[_0x8ba8('0x4a')],'as':_0x8ba8('0x4b')}]})[_0x8ba8('0xf')](function(_0x1ded80){if(_0x1ded80[_0x8ba8('0x2c')]>0x0){return db[_0x8ba8('0x35')]['transaction'](function(_0x1a3a7c){return db['CmHopper'][_0x8ba8('0x1d')]({'recallmeNotifiedDate':db['sequelize'][_0x8ba8('0x3a')]('NOW()')},{'where':{'id':{'$in':_[_0x8ba8('0xc')](_0x1ded80,'id')}},'transaction':_0x1a3a7c})['then'](function(){_0x5cf997(_0x1ded80);})[_0x8ba8('0x19')](function(_0x508bd9){logger[_0x8ba8('0x11')](_0x8ba8('0x46'),_0x508bd9['message'],_0x5e492b);_0x4f973e(_0x88c0e9['error'](0x1f4,_0x508bd9[_0x8ba8('0x12')]));});})['catch'](function(_0x406891){logger[_0x8ba8('0x11')](_0x8ba8('0x46'),_0x406891[_0x8ba8('0x12')],_0x5e492b);_0x4f973e(_0x88c0e9[_0x8ba8('0x11')](0x1f4,_0x406891[_0x8ba8('0x12')]));});}else{_0x5cf997(_0x1ded80);}});});}; \ No newline at end of file +var _0xe288=['COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','UserId','GetCmHopperPreview','keys','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','Agent','name','CmList','List','util','moment','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','then','debug','catch','message','error','find','info','ShowCmHopper','create','body','CreateCmHopper','stringify','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','User','voicePause','length','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy'];(function(_0x17d09b,_0x3575e4){var _0x16321a=function(_0x2928f0){while(--_0x2928f0){_0x17d09b['push'](_0x17d09b['shift']());}};_0x16321a(++_0x3575e4);}(_0xe288,0xbc));var _0x8e28=function(_0x272bde,_0x4c190d){_0x272bde=_0x272bde-0x0;var _0x22bd40=_0xe288[_0x272bde];return _0x22bd40;};'use strict';var _=require('lodash');var util=require(_0x8e28('0x0'));var moment=require(_0x8e28('0x1'));var BPromise=require(_0x8e28('0x2'));var db=require(_0x8e28('0x3'))['db'];var logger=require('../../config/logger')(_0x8e28('0x4'));exports[_0x8e28('0x5')]=function(_0x283873){var _0x26d997=this;return new Promise(function(_0x2b95cc,_0x2c31e7){return db[_0x8e28('0x6')][_0x8e28('0x7')]({'raw':_0x283873[_0x8e28('0x8')]?_0x283873[_0x8e28('0x8')][_0x8e28('0x9')]===undefined?!![]:![]:!![],'where':_0x283873['options']?_0x283873[_0x8e28('0x8')][_0x8e28('0xa')]||null:null,'attributes':_0x283873[_0x8e28('0x8')]?_0x283873[_0x8e28('0x8')][_0x8e28('0xb')]||null:null,'limit':_0x283873[_0x8e28('0x8')]?_0x283873[_0x8e28('0x8')]['limit']||null:null,'include':_0x283873[_0x8e28('0x8')]?_0x283873[_0x8e28('0x8')][_0x8e28('0xc')]?_[_0x8e28('0xd')](_0x283873[_0x8e28('0x8')][_0x8e28('0xc')],function(_0x25eedb){return{'model':db[_0x25eedb[_0x8e28('0xe')]],'as':_0x25eedb['as'],'attributes':_0x25eedb['attributes'],'include':_0x25eedb[_0x8e28('0xc')]?_['map'](_0x25eedb['include'],function(_0x402f64){return{'model':db[_0x402f64[_0x8e28('0xe')]],'as':_0x402f64['as'],'attributes':_0x402f64[_0x8e28('0xb')],'include':_0x402f64['include']?_[_0x8e28('0xd')](_0x402f64[_0x8e28('0xc')],function(_0x4bb5d7){return{'model':db[_0x4bb5d7[_0x8e28('0xe')]],'as':_0x4bb5d7['as'],'attributes':_0x4bb5d7[_0x8e28('0xb')]};}):[]};}):[]};}):[]:[]})[_0x8e28('0xf')](function(_0x38f187){logger['info'](_0x8e28('0x5'),_0x283873);logger[_0x8e28('0x10')](_0x8e28('0x5'),_0x283873,JSON['stringify'](_0x38f187));_0x2b95cc(_0x38f187);})[_0x8e28('0x11')](function(_0x4c47a1){logger['error']('GetCmHopper',_0x4c47a1[_0x8e28('0x12')],_0x283873);_0x2c31e7(_0x26d997[_0x8e28('0x13')](0x1f4,_0x4c47a1[_0x8e28('0x12')]));});});};exports['ShowCmHopper']=function(_0x9692a8){var _0x23d472=this;return new Promise(function(_0x2bc052,_0x7e0b0b){return db[_0x8e28('0x6')][_0x8e28('0x14')]({'raw':_0x9692a8[_0x8e28('0x8')]?_0x9692a8['options'][_0x8e28('0x9')]===undefined?!![]:![]:!![],'where':_0x9692a8[_0x8e28('0x8')]?_0x9692a8[_0x8e28('0x8')][_0x8e28('0xa')]||null:null,'attributes':_0x9692a8[_0x8e28('0x8')]?_0x9692a8[_0x8e28('0x8')][_0x8e28('0xb')]||null:null,'include':_0x9692a8[_0x8e28('0x8')]?_0x9692a8['options'][_0x8e28('0xc')]?_['map'](_0x9692a8[_0x8e28('0x8')][_0x8e28('0xc')],function(_0x191691){return{'model':db[_0x191691[_0x8e28('0xe')]],'as':_0x191691['as'],'attributes':_0x191691[_0x8e28('0xb')],'include':_0x191691[_0x8e28('0xc')]?_['map'](_0x191691[_0x8e28('0xc')],function(_0x2953c3){return{'model':db[_0x2953c3[_0x8e28('0xe')]],'as':_0x2953c3['as'],'attributes':_0x2953c3[_0x8e28('0xb')],'include':_0x2953c3[_0x8e28('0xc')]?_[_0x8e28('0xd')](_0x2953c3[_0x8e28('0xc')],function(_0x1d5c32){return{'model':db[_0x1d5c32['model']],'as':_0x1d5c32['as'],'attributes':_0x1d5c32[_0x8e28('0xb')]};}):[]};}):[]};}):[]:[]})[_0x8e28('0xf')](function(_0x1a21a5){logger[_0x8e28('0x15')](_0x8e28('0x16'),_0x9692a8);logger['debug'](_0x8e28('0x16'),_0x9692a8,JSON['stringify'](_0x1a21a5));_0x2bc052(_0x1a21a5);})[_0x8e28('0x11')](function(_0xaa76d8){logger[_0x8e28('0x13')](_0x8e28('0x16'),_0xaa76d8['message'],_0x9692a8);_0x7e0b0b(_0x23d472[_0x8e28('0x13')](0x1f4,_0xaa76d8[_0x8e28('0x12')]));});});};exports['CreateCmHopper']=function(_0x31e28d){var _0x3aa682=this;return new Promise(function(_0xa4833d,_0x13f33c){return db[_0x8e28('0x6')][_0x8e28('0x17')](_0x31e28d[_0x8e28('0x18')],{'raw':_0x31e28d[_0x8e28('0x8')]?_0x31e28d[_0x8e28('0x8')][_0x8e28('0x9')]===undefined?!![]:![]:!![]})[_0x8e28('0xf')](function(_0x4af6e4){logger[_0x8e28('0x15')](_0x8e28('0x19'),_0x31e28d);logger['debug'](_0x8e28('0x19'),_0x31e28d,JSON[_0x8e28('0x1a')](_0x4af6e4));_0xa4833d(_0x4af6e4);})[_0x8e28('0x11')](function(_0xe8fee0){logger[_0x8e28('0x13')]('CreateCmHopper',_0xe8fee0[_0x8e28('0x12')],_0x31e28d);_0x13f33c(_0x3aa682[_0x8e28('0x13')](0x1f4,_0xe8fee0['message']));});});};exports[_0x8e28('0x1b')]=function(_0xd4d0d){var _0x42f6bd=this;return new Promise(function(_0x3aa3bd,_0x420bf5){return db[_0x8e28('0x6')][_0x8e28('0x1c')](_0xd4d0d[_0x8e28('0x18')],{'raw':_0xd4d0d[_0x8e28('0x8')]?_0xd4d0d[_0x8e28('0x8')][_0x8e28('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd4d0d['options']?_0xd4d0d[_0x8e28('0x8')][_0x8e28('0xa')]||null:null,'attributes':_0xd4d0d[_0x8e28('0x8')]?_0xd4d0d['options'][_0x8e28('0xb')]||null:null,'limit':_0xd4d0d[_0x8e28('0x8')]?_0xd4d0d[_0x8e28('0x8')][_0x8e28('0x1d')]||null:null})[_0x8e28('0xf')](function(_0x428dd4){logger[_0x8e28('0x15')](_0x8e28('0x1b'),_0xd4d0d);logger['info'](_0x8e28('0x1e'),JSON[_0x8e28('0x1a')](_0xd4d0d[_0x8e28('0x8')][_0x8e28('0xa')]),_0xd4d0d[_0x8e28('0x18')][_0x8e28('0x1f')]);logger[_0x8e28('0x10')](_0x8e28('0x1b'),_0xd4d0d,JSON['stringify'](_0x428dd4));_0x3aa3bd(_0x428dd4);})[_0x8e28('0x11')](function(_0x4e824b){logger[_0x8e28('0x13')](_0x8e28('0x1b'),_0x4e824b[_0x8e28('0x12')],_0xd4d0d);_0x420bf5(_0x42f6bd[_0x8e28('0x13')](0x1f4,_0x4e824b[_0x8e28('0x12')]));});});};exports[_0x8e28('0x20')]=function(_0x5cae7e){var _0x74937e=this;return new Promise(function(_0x14f4ee,_0xd4da6d){return db[_0x8e28('0x6')]['destroy']({'where':_0x5cae7e[_0x8e28('0x8')]?_0x5cae7e[_0x8e28('0x8')][_0x8e28('0xa')]||null:null})['then'](function(_0x49624e){logger['info'](_0x8e28('0x20'),_0x5cae7e);logger['debug']('DestroyCmHopper',_0x5cae7e,JSON[_0x8e28('0x1a')](_0x49624e));_0x14f4ee(_0x49624e);})[_0x8e28('0x11')](function(_0x5f91dc){logger[_0x8e28('0x13')](_0x8e28('0x20'),_0x5f91dc[_0x8e28('0x12')],_0x5cae7e);_0xd4da6d(_0x74937e[_0x8e28('0x13')](0x1f4,_0x5f91dc[_0x8e28('0x12')]));});});};exports[_0x8e28('0x21')]=function(_0x12154f){var _0x8a2275=this;return new Promise(function(_0x3e13a7,_0x2e38f3){return db[_0x8e28('0x22')][_0x8e28('0x23')]()[_0x8e28('0xf')](function(_0x5afd53){return db[_0x8e28('0x24')][_0x8e28('0x25')](function(_0x26b7b9){return db['CmHopper'][_0x8e28('0x7')]({'where':_0x12154f[_0x8e28('0x8')]?_0x12154f[_0x8e28('0x8')][_0x8e28('0xa')]||null:null,'attributes':_0x12154f[_0x8e28('0x8')]?_0x12154f[_0x8e28('0x8')][_0x8e28('0xb')]||null:null,'limit':_0x12154f['options']?_0x12154f[_0x8e28('0x8')]['limit']||null:null,'order':_0x12154f[_0x8e28('0x8')]?_0x12154f[_0x8e28('0x8')][_0x8e28('0x26')]||null:null,'transaction':_0x26b7b9,'lock':_0x26b7b9[_0x8e28('0x27')][_0x8e28('0x28')],'include':[{'model':db[_0x8e28('0x22')],'as':_0x8e28('0x29'),'attributes':_['keys'](_0x5afd53)},{'model':db[_0x8e28('0x2a')],'as':'Agent','attributes':['id','name',_0x8e28('0x2b')]}]})[_0x8e28('0xf')](function(_0x357033){var _0x48c633=[];var _0x59bed8=[];for(var _0xe1fed9=0x0;_0xe1fed9<_0x357033[_0x8e28('0x2c')];_0xe1fed9+=0x1){var _0x1d2de0=_0x357033[_0xe1fed9]['UserId'];if(_0x1d2de0===null){_0x48c633[_0x8e28('0x2d')](_0x357033[_0xe1fed9][_0x8e28('0x1c')](_0x12154f[_0x8e28('0x18')],{'transaction':_0x26b7b9}));}else if(!_0x59bed8[_0x8e28('0x2e')](_0x1d2de0)){_0x59bed8[_0x8e28('0x2d')](_0x1d2de0);_0x48c633[_0x8e28('0x2d')](_0x357033[_0xe1fed9]['update'](_0x12154f[_0x8e28('0x18')],{'transaction':_0x26b7b9}));}}return BPromise[_0x8e28('0x2f')](_0x48c633);});})[_0x8e28('0xf')](function(_0x1e1103){logger[_0x8e28('0x15')]('GetContactDialer',_0x12154f);if(_0x1e1103['length']>0x0){logger['info'](_0x8e28('0x30'),_0x1e1103[0x0][_0x8e28('0x31')]['id'],_0x1e1103[0x0][_0x8e28('0x31')][_0x8e28('0x32')],_0x1e1103[0x0][_0x8e28('0x31')][_0x8e28('0x1f')]);}logger[_0x8e28('0x10')]('GetContactDialer',_0x12154f,JSON[_0x8e28('0x1a')](_0x1e1103));_0x3e13a7(_0x1e1103);})['catch'](function(_0x1ab19d){logger[_0x8e28('0x13')](_0x8e28('0x21'),_0x1ab19d[_0x8e28('0x12')],_0x12154f);_0x2e38f3(_0x8a2275[_0x8e28('0x13')](0x1f4,_0x1ab19d[_0x8e28('0x12')]));});});});};exports[_0x8e28('0x33')]=function(_0xfbba64){var _0x17a56d=this;return new Promise(function(_0x408fac,_0x23a13f){return db['sequelize'][_0x8e28('0x25')](function(_0x58c65f){return db[_0x8e28('0x34')][_0x8e28('0x17')](_0xfbba64[_0x8e28('0x18')],{'raw':_0xfbba64['options']?_0xfbba64[_0x8e28('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x58c65f})['then'](function(){logger[_0x8e28('0x15')](_0x8e28('0x35'),JSON[_0x8e28('0x1a')](_0xfbba64['options'][_0x8e28('0xa')]),_0xfbba64['options'][_0x8e28('0xa')]['active']);return db[_0x8e28('0x6')][_0x8e28('0x36')]({'where':_0xfbba64[_0x8e28('0x8')]?_0xfbba64[_0x8e28('0x8')][_0x8e28('0xa')]||null:null,'transaction':_0x58c65f});});})[_0x8e28('0xf')](function(_0x4515b1){logger['info'](_0x8e28('0x33'),_0xfbba64);logger[_0x8e28('0x10')](_0x8e28('0x33'),_0xfbba64,JSON[_0x8e28('0x1a')](_0x4515b1));_0x408fac(_0x4515b1);})['catch'](function(_0x9b3150){logger[_0x8e28('0x13')]('MoveContactManagedDialer',_0x9b3150[_0x8e28('0x12')],_0xfbba64);_0x23a13f(_0x17a56d[_0x8e28('0x13')](0x1f4,_0x9b3150[_0x8e28('0x12')]));});});};exports['CountReScheduled']=function(_0xe43987){var _0x10de44=this;return new Promise(function(_0xdb796e,_0x3ef131){return db[_0x8e28('0x6')][_0x8e28('0x7')]({'raw':_0xe43987[_0x8e28('0x8')]?_0xe43987[_0x8e28('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0xe43987[_0x8e28('0x8')]?_0xe43987[_0x8e28('0x8')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x8e28('0x37'),db[_0x8e28('0x24')]['fn']('IF',db['sequelize']['literal'](_0x8e28('0x38')+util[_0x8e28('0x39')](_0x8e28('0x3a'),moment()[_0x8e28('0x39')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x8e28('0x3b')))),_0x8e28('0x3c')]]})[_0x8e28('0xf')](function(_0x4e74c8){logger[_0x8e28('0x15')](_0x8e28('0x3d'),_0xe43987);logger[_0x8e28('0x10')](_0x8e28('0x3d'),_0xe43987,JSON[_0x8e28('0x1a')](_0x4e74c8));_0xdb796e(_0x4e74c8);})['catch'](function(_0x2f2d){logger[_0x8e28('0x13')]('CountReScheduled',_0x2f2d['message'],_0xe43987);_0x3ef131(_0x10de44['error'](0x1f4,_0x2f2d['message']));});});};exports[_0x8e28('0x3e')]=function(_0x54dafe){var _0x5e9a59=this;return new Promise(function(_0x2fbad4,_0x5d28f1){return db['CmContact'][_0x8e28('0x23')]()[_0x8e28('0xf')](function(){return db[_0x8e28('0x24')][_0x8e28('0x25')](function(_0x8b976a){return db[_0x8e28('0x6')][_0x8e28('0x7')]({'where':_0x54dafe[_0x8e28('0x8')]?_0x54dafe[_0x8e28('0x8')]['where']||null:null,'attributes':_0x54dafe['options']?_0x54dafe[_0x8e28('0x8')][_0x8e28('0xb')]||null:null,'limit':0x1,'order':_0x54dafe[_0x8e28('0x8')]?_0x54dafe[_0x8e28('0x8')][_0x8e28('0x26')]||null:null,'group':db[_0x8e28('0x6')][_0x8e28('0x3f')],'transaction':_0x8b976a,'lock':_0x8b976a['LOCK'][_0x8e28('0x28')],'include':_0x54dafe['options']?_0x54dafe['options']['include']?_['map'](_0x54dafe['options'][_0x8e28('0xc')],function(_0x23f72b){return{'model':db[_0x23f72b[_0x8e28('0xe')]],'as':_0x23f72b['as'],'attributes':_0x23f72b['attributes'],'include':_0x23f72b[_0x8e28('0xc')]?_[_0x8e28('0xd')](_0x23f72b[_0x8e28('0xc')],function(_0xb3adf8){return{'model':db[_0xb3adf8[_0x8e28('0xe')]],'as':_0xb3adf8['as'],'attributes':_0xb3adf8[_0x8e28('0xb')],'include':_0xb3adf8['include']?_['map'](_0xb3adf8[_0x8e28('0xc')],function(_0x27264f){return{'model':db[_0x27264f[_0x8e28('0xe')]],'as':_0x27264f['as'],'attributes':_0x27264f[_0x8e28('0xb')]};}):[]};}):[]};}):[]:[]})[_0x8e28('0xf')](function(_0x398aeb){var _0x2b09c1=[];for(var _0x295722=0x0;_0x295722<_0x398aeb[_0x8e28('0x2c')];_0x295722+=0x1){_0x2b09c1[_0x8e28('0x2d')](_0x398aeb[_0x295722]['update'](_0x54dafe['body'],{'transaction':_0x8b976a}));}return BPromise['all'](_0x2b09c1);});})[_0x8e28('0xf')](function(_0x5104ff){logger['info']('GetContactRecallMe',_0x54dafe);logger[_0x8e28('0x10')](_0x8e28('0x3e'),_0x54dafe,JSON['stringify'](_0x5104ff));_0x2fbad4(_0x5104ff);})[_0x8e28('0x11')](function(_0xdd35d5){logger[_0x8e28('0x13')](_0x8e28('0x3e'),_0xdd35d5['message'],_0x54dafe);_0x5d28f1(_0x5e9a59[_0x8e28('0x13')](0x1f4,_0xdd35d5['message']));});});});};exports[_0x8e28('0x40')]=function(_0x3bf3d3){var _0x2af843=this;return new Promise(function(_0x26ee70,_0x41b7a5){db[_0x8e28('0x22')]['describe']()[_0x8e28('0xf')](function(_0x3c0fb7){return db[_0x8e28('0x6')][_0x8e28('0x7')]({'raw':_0x3bf3d3['options']?_0x3bf3d3[_0x8e28('0x8')][_0x8e28('0x9')]===undefined?!![]:![]:!![],'where':_0x3bf3d3[_0x8e28('0x8')]?_0x3bf3d3[_0x8e28('0x8')][_0x8e28('0xa')]||null:null,'attributes':_0x3bf3d3[_0x8e28('0x8')]?_0x3bf3d3[_0x8e28('0x8')][_0x8e28('0xb')]||null:null,'limit':_0x3bf3d3[_0x8e28('0x8')]?_0x3bf3d3['options']['limit']||null:null,'include':_0x3bf3d3[_0x8e28('0x8')]?_0x3bf3d3['options']['include']?_['map'](_0x3bf3d3['options'][_0x8e28('0xc')],function(_0x4edcbd){return{'model':db[_0x4edcbd[_0x8e28('0xe')]],'as':_0x4edcbd['as'],'attributes':_0x4edcbd['as']===_0x8e28('0x29')?_[_0x8e28('0x41')](_0x3c0fb7):_0x4edcbd['attributes'],'include':_0x4edcbd[_0x8e28('0xc')]?_[_0x8e28('0xd')](_0x4edcbd[_0x8e28('0xc')],function(_0x5ce843){return{'model':db[_0x5ce843[_0x8e28('0xe')]],'as':_0x5ce843['as'],'attributes':_0x5ce843[_0x8e28('0xb')],'include':_0x5ce843[_0x8e28('0xc')]?_['map'](_0x5ce843[_0x8e28('0xc')],function(_0x2ced90){return{'model':db[_0x2ced90[_0x8e28('0xe')]],'as':_0x2ced90['as'],'attributes':_0x2ced90[_0x8e28('0xb')]};}):[]};}):[]};}):[]:[]})[_0x8e28('0xf')](function(_0x3626ac){logger['info']('GetCmHopper',_0x3bf3d3);logger[_0x8e28('0x10')](_0x8e28('0x5'),_0x3bf3d3,JSON[_0x8e28('0x1a')](_0x3626ac));_0x26ee70(_0x3626ac);})['catch'](function(_0x190f25){logger[_0x8e28('0x13')](_0x8e28('0x5'),_0x190f25[_0x8e28('0x12')],_0x3bf3d3);_0x41b7a5(_0x2af843[_0x8e28('0x13')](0x1f4,_0x190f25[_0x8e28('0x12')]));});});});};exports[_0x8e28('0x42')]=function(_0x17bd8e){var _0x3e9d1e=this;return new Promise(function(_0x625118,_0xce363b){return db[_0x8e28('0x22')][_0x8e28('0x43')]({'raw':!![],'where':{'phone':_0x17bd8e[_0x8e28('0x8')][_0x8e28('0xa')]['phone']},'attributes':['id',_0x8e28('0x44')],'order':[['id',_0x8e28('0x45')]]})[_0x8e28('0xf')](function(_0x204133){logger['info']('getContactByPhone',_0x17bd8e);logger[_0x8e28('0x10')]('getContactByPhone',_0x17bd8e,JSON[_0x8e28('0x1a')](_0x204133));_0x625118(_0x204133);})['catch'](function(_0xfdc945){logger[_0x8e28('0x13')](_0x8e28('0x46'),_0xfdc945[_0x8e28('0x12')],_0x17bd8e);_0xce363b(_0x3e9d1e['error'](0x1f4,_0xfdc945[_0x8e28('0x12')]));});});};exports[_0x8e28('0x47')]=function(_0x4e4212){var _0x454b17=this;return new Promise(function(_0x6afdfc,_0x2e713b){return db[_0x8e28('0x24')]['transaction'](function(_0x209571){var _0x1b0d31=_0x4e4212[_0x8e28('0x8')]&&_0x4e4212[_0x8e28('0x8')][_0x8e28('0xa')]?_0x4e4212[_0x8e28('0x8')][_0x8e28('0xa')]:{};return db['CmHopper'][_0x8e28('0x1c')](_0x4e4212[_0x8e28('0x18')],{'where':_0x1b0d31,'transaction':_0x209571})[_0x8e28('0xf')](function(_0x421cc1){logger[_0x8e28('0x15')](_0x8e28('0x47'),_0x4e4212);logger['debug'](_0x8e28('0x47'),_0x4e4212,JSON[_0x8e28('0x1a')](_0x421cc1));_0x6afdfc(_0x421cc1);})[_0x8e28('0x11')](function(_0xf170bd){logger[_0x8e28('0x13')]('ResetActiveCalls',_0xf170bd['message'],_0x4e4212);_0x2e713b(_0x454b17[_0x8e28('0x13')](0x1f4,_0xf170bd[_0x8e28('0x12')]));});});});};exports[_0x8e28('0x48')]=function(_0x2b3583){var _0xfe06f2=this;var _0x265902=_0x2b3583[_0x8e28('0x18')][_0x8e28('0xa')][_0x8e28('0x49')];var _0x378801=_0x2b3583[_0x8e28('0x18')][_0x8e28('0xa')]['interval'];var _0x49909f=_0x2b3583[_0x8e28('0x18')][_0x8e28('0xa')][_0x8e28('0x4a')];return new Promise(function(_0x4b30d1,_0x24938d){return db[_0x8e28('0x6')][_0x8e28('0x7')]({'where':{'voiceQueueId':{'$in':_0x265902},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x8e28('0x24')][_0x8e28('0x4b')](_0x8e28('0x4c')+_0x378801+'\x20MINUTE'),'$gt':db['sequelize'][_0x8e28('0x4b')]('NOW()')}},'UserId':{'$in':_0x49909f}},'include':[{'model':db[_0x8e28('0x22')],'as':_0x8e28('0x29')},{'model':db['User'],'as':_0x8e28('0x4d'),'attributes':['id',_0x8e28('0x4e'),'voicePause']},{'model':db[_0x8e28('0x4f')],'as':_0x8e28('0x50')}]})[_0x8e28('0xf')](function(_0x2e929f){if(_0x2e929f[_0x8e28('0x2c')]>0x0){return db[_0x8e28('0x24')][_0x8e28('0x25')](function(_0x323d5c){return db[_0x8e28('0x6')][_0x8e28('0x1c')]({'recallmeNotifiedDate':db['sequelize']['literal']('NOW()')},{'where':{'id':{'$in':_[_0x8e28('0xd')](_0x2e929f,'id')}},'transaction':_0x323d5c})['then'](function(){_0x4b30d1(_0x2e929f);})[_0x8e28('0x11')](function(_0x1746f7){logger[_0x8e28('0x13')](_0x8e28('0x48'),_0x1746f7[_0x8e28('0x12')],_0x2b3583);_0x24938d(_0xfe06f2[_0x8e28('0x13')](0x1f4,_0x1746f7['message']));});})[_0x8e28('0x11')](function(_0x77a12c){logger[_0x8e28('0x13')](_0x8e28('0x48'),_0x77a12c['message'],_0x2b3583);_0x24938d(_0xfe06f2[_0x8e28('0x13')](0x1f4,_0x77a12c[_0x8e28('0x12')]));});}else{_0x4b30d1(_0x2e929f);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index b80c0e0..c3bdc5b 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 _0x119a=['getPreview','getTimezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','isAuthenticated','index','describe','/opencontacts','getOpenContacts','/timezones','get','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview'];(function(_0x18f9e1,_0x2763b3){var _0x61a32d=function(_0x19b837){while(--_0x19b837){_0x18f9e1['push'](_0x18f9e1['shift']());}};_0x61a32d(++_0x2763b3);}(_0x119a,0x197));var _0xa119=function(_0x46707f,_0x2df240){_0x46707f=_0x46707f-0x0;var _0x4625ec=_0x119a[_0x46707f];return _0x4625ec;};'use strict';var express=require(_0xa119('0x0'));var router=express[_0xa119('0x1')]();var auth=require(_0xa119('0x2'));var controller=require(_0xa119('0x3'));router['get']('/',auth[_0xa119('0x4')](),controller[_0xa119('0x5')]);router['get']('/describe',auth[_0xa119('0x4')](),controller[_0xa119('0x6')]);router['get'](_0xa119('0x7'),auth['isAuthenticated'](),controller[_0xa119('0x8')]);router['get'](_0xa119('0x9'),auth[_0xa119('0x4')](),controller['getTimezones']);router[_0xa119('0xa')](_0xa119('0xb'),auth[_0xa119('0x4')](),controller[_0xa119('0xc')]);router['get'](_0xa119('0xd'),auth[_0xa119('0x4')](),controller[_0xa119('0xe')]);router[_0xa119('0xf')]('/',auth[_0xa119('0x4')](),controller[_0xa119('0x10')]);router[_0xa119('0xf')](_0xa119('0x11'),auth[_0xa119('0x4')](),controller[_0xa119('0x12')]);router[_0xa119('0xf')]('/timezone',auth[_0xa119('0x4')](),controller[_0xa119('0x13')]);router[_0xa119('0x14')]('/:id',auth[_0xa119('0x4')](),controller[_0xa119('0x15')]);router[_0xa119('0x16')](_0xa119('0xb'),auth[_0xa119('0x4')](),controller[_0xa119('0x17')]);module[_0xa119('0x18')]=router; \ No newline at end of file +var _0xa468=['destroy','express','Router','../../components/auth/service','isAuthenticated','index','get','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','getPreviewRecall','post','/timezone','getTimezone','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa468,0x1dc));var _0x8a46=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa468[_0x3ab51d];return _0x29a04e;};'use strict';var express=require(_0x8a46('0x0'));var router=express[_0x8a46('0x1')]();var auth=require(_0x8a46('0x2'));var controller=require('./cmHopper.controller');router['get']('/',auth[_0x8a46('0x3')](),controller[_0x8a46('0x4')]);router[_0x8a46('0x5')](_0x8a46('0x6'),auth[_0x8a46('0x3')](),controller[_0x8a46('0x7')]);router[_0x8a46('0x5')](_0x8a46('0x8'),auth[_0x8a46('0x3')](),controller[_0x8a46('0x9')]);router[_0x8a46('0x5')](_0x8a46('0xa'),auth[_0x8a46('0x3')](),controller[_0x8a46('0xb')]);router['get'](_0x8a46('0xc'),auth[_0x8a46('0x3')](),controller['show']);router[_0x8a46('0x5')]('/:id/previewrecall',auth[_0x8a46('0x3')](),controller[_0x8a46('0xd')]);router[_0x8a46('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8a46('0xe')]('/preview',auth[_0x8a46('0x3')](),controller['getPreview']);router[_0x8a46('0xe')](_0x8a46('0xf'),auth[_0x8a46('0x3')](),controller[_0x8a46('0x10')]);router[_0x8a46('0x11')](_0x8a46('0xc'),auth[_0x8a46('0x3')](),controller['update']);router['delete']('/:id',auth[_0x8a46('0x3')](),controller[_0x8a46('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 614331b..e339da5 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 _0x38a6=['INTEGER','moment','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2dc8ee,_0x2f56da){var _0x1745e5=function(_0x4ee010){while(--_0x4ee010){_0x2dc8ee['push'](_0x2dc8ee['shift']());}};_0x1745e5(++_0x2f56da);}(_0x38a6,0x18d));var _0x638a=function(_0x52c998,_0x1f4258){_0x52c998=_0x52c998-0x0;var _0x2a0d4a=_0x38a6[_0x52c998];return _0x2a0d4a;};'use strict';var moment=require(_0x638a('0x0'));var Sequelize=require('sequelize');module[_0x638a('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x638a('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x638a('0x3')](_0x638a('0x4'))},'countbusyretry':{'type':Sequelize[_0x638a('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x638a('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x638a('0x5')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x638a('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x638a('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x638a('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x638a('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x638a('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3985=['INTEGER','STRING','format','moment','sequelize','exports'];(function(_0x3888b1,_0x605f37){var _0x553ddb=function(_0x5f086e){while(--_0x5f086e){_0x3888b1['push'](_0x3888b1['shift']());}};_0x553ddb(++_0x605f37);}(_0x3985,0x81));var _0x5398=function(_0x406244,_0x2c3e17){_0x406244=_0x406244-0x0;var _0x40745d=_0x3985[_0x406244];return _0x40745d;};'use strict';var moment=require(_0x5398('0x0'));var Sequelize=require(_0x5398('0x1'));module[_0x5398('0x2')]={'CmHopperId':{'type':Sequelize[_0x5398('0x3')]},'phone':{'type':Sequelize[_0x5398('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x5398('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x5398('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5398('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x5398('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5398('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5398('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5398('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 0201689..081282b 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 _0x9ee3=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','findAll','rows','catch','params','length','include','create','body','user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4a6a5e,_0x70e1f2){var _0x3f7382=function(_0x273c77){while(--_0x273c77){_0x4a6a5e['push'](_0x4a6a5e['shift']());}};_0x3f7382(++_0x70e1f2);}(_0x9ee3,0x120));var _0x39ee=function(_0x3573bb,_0xd99a54){_0x3573bb=_0x3573bb-0x0;var _0x59f274=_0x9ee3[_0x3573bb];return _0x59f274;};'use strict';var emlformat=require(_0x39ee('0x0'));var rimraf=require(_0x39ee('0x1'));var zipdir=require(_0x39ee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x39ee('0x3'));var moment=require(_0x39ee('0x4'));var BPromise=require(_0x39ee('0x5'));var Mustache=require(_0x39ee('0x6'));var util=require(_0x39ee('0x7'));var path=require(_0x39ee('0x8'));var sox=require(_0x39ee('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x39ee('0xa'));var _=require('lodash');var squel=require(_0x39ee('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x39ee('0xc'));var toCsv=require(_0x39ee('0xd'));var querystring=require(_0x39ee('0xe'));var Papa=require('papaparse');var Redis=require(_0x39ee('0xf'));var authService=require(_0x39ee('0x10'));var qs=require(_0x39ee('0x11'));var as=require(_0x39ee('0x12'));var hardwareService=require(_0x39ee('0x13'));var logger=require(_0x39ee('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x39ee('0x15'));var licenseUtil=require(_0x39ee('0x16'));var db=require(_0x39ee('0x17'))['db'];function respondWithStatusCode(_0x5b1be0,_0x269593){_0x269593=_0x269593||0xcc;return function(_0x48e218){if(_0x48e218){return _0x5b1be0[_0x39ee('0x18')](_0x269593);}return _0x5b1be0[_0x39ee('0x19')](_0x269593)[_0x39ee('0x1a')]();};}function respondWithResult(_0x7bb76c,_0x1f38d4){_0x1f38d4=_0x1f38d4||0xc8;return function(_0x1de292){if(_0x1de292){return _0x7bb76c[_0x39ee('0x19')](_0x1f38d4)[_0x39ee('0x1b')](_0x1de292);}};}function respondWithFilteredResult(_0x253222,_0x594b61){return function(_0x30aa68){if(_0x30aa68){var _0x2c8710=typeof _0x594b61[_0x39ee('0x1c')]===_0x39ee('0x1d')&&typeof _0x594b61[_0x39ee('0x1e')]==='undefined';var _0x5b0383=_0x30aa68[_0x39ee('0x1f')];var _0x3b5c04=_0x2c8710?0x0:_0x594b61[_0x39ee('0x1c')];var _0x2c0c7=_0x2c8710?_0x30aa68['count']:_0x594b61['offset']+_0x594b61[_0x39ee('0x1e')];var _0x38c970;if(_0x2c0c7>=_0x5b0383){_0x2c0c7=_0x5b0383;_0x38c970=0xc8;}else{_0x38c970=0xce;}_0x253222['status'](_0x38c970);return _0x253222[_0x39ee('0x20')](_0x39ee('0x21'),_0x3b5c04+'-'+_0x2c0c7+'/'+_0x5b0383)['json'](_0x30aa68);}return null;};}function patchUpdates(_0x51ced7){return function(_0x58c03d){try{jsonpatch[_0x39ee('0x22')](_0x58c03d,_0x51ced7,!![]);}catch(_0x33d6b9){return BPromise[_0x39ee('0x23')](_0x33d6b9);}return _0x58c03d[_0x39ee('0x24')]();};}function saveUpdates(_0x5e43e2,_0x3e0175){return function(_0x407e4c){if(_0x407e4c){return _0x407e4c[_0x39ee('0x25')](_0x5e43e2)[_0x39ee('0x26')](function(_0x13b91c){return _0x13b91c;});}return null;};}function removeEntity(_0x3baf66,_0x4b1d64){return function(_0x27f9a5){if(_0x27f9a5){return _0x27f9a5['destroy']()[_0x39ee('0x26')](function(){var _0x451f65=_0x27f9a5[_0x39ee('0x27')]({'plain':!![]});var _0x298096='CmHopperAdditionalPhones';return db[_0x39ee('0x28')][_0x39ee('0x29')]({'where':{'type':_0x298096,'resourceId':_0x451f65['id']}})['then'](function(){return _0x27f9a5;});})['then'](function(){_0x3baf66[_0x39ee('0x19')](0xcc)[_0x39ee('0x1a')]();});}};}function handleEntityNotFound(_0x122a9,_0x417bc6){return function(_0x31a62b){if(!_0x31a62b){_0x122a9[_0x39ee('0x18')](0x194);}return _0x31a62b;};}function handleError(_0x5d0284,_0x9b22f1){_0x9b22f1=_0x9b22f1||0x1f4;return function(_0x2cd2a3){logger[_0x39ee('0x2a')](_0x2cd2a3[_0x39ee('0x2b')]);if(_0x2cd2a3[_0x39ee('0x2c')]){delete _0x2cd2a3[_0x39ee('0x2c')];}_0x5d0284['status'](_0x9b22f1)[_0x39ee('0x2d')](_0x2cd2a3);};}exports['index']=function(_0x4a6b93,_0x4b3769){var _0x1f99d7={},_0xc0c39={},_0x3c3475={'count':0x0,'rows':[]};var _0x942265=_[_0x39ee('0x2e')](db[_0x39ee('0x2f')][_0x39ee('0x30')],function(_0x5b5853){return{'name':_0x5b5853['fieldName'],'type':_0x5b5853['type'][_0x39ee('0x31')]};});_0xc0c39[_0x39ee('0x32')]=_['map'](_0x942265,_0x39ee('0x2c'));_0xc0c39[_0x39ee('0x33')]=_[_0x39ee('0x34')](_0x4a6b93[_0x39ee('0x33')]);_0xc0c39[_0x39ee('0x35')]=_[_0x39ee('0x36')](_0xc0c39[_0x39ee('0x32')],_0xc0c39[_0x39ee('0x33')]);_0x1f99d7[_0x39ee('0x37')]=_[_0x39ee('0x36')](_0xc0c39[_0x39ee('0x32')],qs[_0x39ee('0x38')](_0x4a6b93[_0x39ee('0x33')][_0x39ee('0x38')]));_0x1f99d7['attributes']=_0x1f99d7[_0x39ee('0x37')]['length']?_0x1f99d7[_0x39ee('0x37')]:_0xc0c39['model'];if(!_0x4a6b93[_0x39ee('0x33')][_0x39ee('0x39')]('nolimit')){_0x1f99d7[_0x39ee('0x1e')]=qs[_0x39ee('0x1e')](_0x4a6b93['query'][_0x39ee('0x1e')]);_0x1f99d7[_0x39ee('0x1c')]=qs[_0x39ee('0x1c')](_0x4a6b93['query'][_0x39ee('0x1c')]);}_0x1f99d7[_0x39ee('0x3a')]=qs['sort'](_0x4a6b93[_0x39ee('0x33')][_0x39ee('0x3b')]);_0x1f99d7['where']=qs[_0x39ee('0x35')](_[_0x39ee('0x3c')](_0x4a6b93['query'],_0xc0c39[_0x39ee('0x35')]),_0x942265);if(_0x4a6b93[_0x39ee('0x33')]['filter']){_0x1f99d7[_0x39ee('0x3d')]=_[_0x39ee('0x3e')](_0x1f99d7['where'],{'$or':_['map'](_0x942265,function(_0x5a295c){if(_0x5a295c['type']!==_0x39ee('0x3f')){var _0x6af828={};_0x6af828[_0x5a295c[_0x39ee('0x2c')]]={'$like':'%'+_0x4a6b93[_0x39ee('0x33')]['filter']+'%'};return _0x6af828;}})});}_0x1f99d7=_['merge']({},_0x1f99d7,_0x4a6b93[_0x39ee('0x40')]);var _0x4d5438={'where':_0x1f99d7['where']};return db[_0x39ee('0x2f')][_0x39ee('0x1f')](_0x4d5438)[_0x39ee('0x26')](function(_0x3922e8){_0x3c3475[_0x39ee('0x1f')]=_0x3922e8;if(_0x4a6b93[_0x39ee('0x33')]['includeAll']){_0x1f99d7['include']=[{'all':!![]}];}return db[_0x39ee('0x2f')][_0x39ee('0x41')](_0x1f99d7);})[_0x39ee('0x26')](function(_0x599d65){_0x3c3475[_0x39ee('0x42')]=_0x599d65;return _0x3c3475;})['then'](respondWithFilteredResult(_0x4b3769,_0x1f99d7))[_0x39ee('0x43')](handleError(_0x4b3769,null));};exports['show']=function(_0x1a8aa4,_0x360bbe){var _0x22f1e1={'raw':!![],'where':{'id':_0x1a8aa4[_0x39ee('0x44')]['id']}},_0x390e7f={};_0x390e7f['model']=_['keys'](db['CmHopperAdditionalPhone'][_0x39ee('0x30')]);_0x390e7f[_0x39ee('0x33')]=_[_0x39ee('0x34')](_0x1a8aa4['query']);_0x390e7f[_0x39ee('0x35')]=_[_0x39ee('0x36')](_0x390e7f['model'],_0x390e7f[_0x39ee('0x33')]);_0x22f1e1[_0x39ee('0x37')]=_[_0x39ee('0x36')](_0x390e7f[_0x39ee('0x32')],qs['fields'](_0x1a8aa4[_0x39ee('0x33')][_0x39ee('0x38')]));_0x22f1e1[_0x39ee('0x37')]=_0x22f1e1[_0x39ee('0x37')][_0x39ee('0x45')]?_0x22f1e1[_0x39ee('0x37')]:_0x390e7f[_0x39ee('0x32')];if(_0x1a8aa4[_0x39ee('0x33')]['includeAll']){_0x22f1e1[_0x39ee('0x46')]=[{'all':!![]}];}_0x22f1e1=_[_0x39ee('0x3e')]({},_0x22f1e1,_0x1a8aa4['options']);return db['CmHopperAdditionalPhone']['find'](_0x22f1e1)[_0x39ee('0x26')](handleEntityNotFound(_0x360bbe,null))[_0x39ee('0x26')](respondWithResult(_0x360bbe,null))['catch'](handleError(_0x360bbe,null));};exports[_0x39ee('0x47')]=function(_0x2faf05,_0x7a9c09){return db[_0x39ee('0x2f')][_0x39ee('0x47')](_0x2faf05[_0x39ee('0x48')],{})['then'](function(_0x4fea18){var _0x105bbf=_0x2faf05[_0x39ee('0x49')][_0x39ee('0x27')]({'plain':!![]});if(!_0x105bbf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x105bbf[_0x39ee('0x4a')]==='user'){var _0x4e8604=_0x4fea18[_0x39ee('0x27')]({'plain':!![]});var _0x2a8e82='CmHopperAdditionalPhones';return db[_0x39ee('0x4b')][_0x39ee('0x4c')]({'where':{'name':_0x2a8e82,'userProfileId':_0x105bbf['userProfileId']},'raw':!![]})['then'](function(_0x4a1cd8){if(_0x4a1cd8&&_0x4a1cd8['autoAssociation']===0x0){return db[_0x39ee('0x28')][_0x39ee('0x47')]({'name':_0x4e8604['name'],'resourceId':_0x4e8604['id'],'type':_0x4a1cd8[_0x39ee('0x2c')],'sectionId':_0x4a1cd8['id']},{})[_0x39ee('0x26')](function(){return _0x4fea18;});}else{return _0x4fea18;}})['catch'](function(_0x24d238){logger[_0x39ee('0x2a')](_0x39ee('0x4d'),_0x24d238);throw _0x24d238;});}return _0x4fea18;})[_0x39ee('0x26')](respondWithResult(_0x7a9c09,0xc9))[_0x39ee('0x43')](handleError(_0x7a9c09,null));};exports[_0x39ee('0x25')]=function(_0x4d1c95,_0x15f8c6){if(_0x4d1c95['body']['id']){delete _0x4d1c95['body']['id'];}return db[_0x39ee('0x2f')][_0x39ee('0x4c')]({'where':{'id':_0x4d1c95[_0x39ee('0x44')]['id']}})[_0x39ee('0x26')](handleEntityNotFound(_0x15f8c6,null))['then'](saveUpdates(_0x4d1c95['body'],null))[_0x39ee('0x26')](respondWithResult(_0x15f8c6,null))[_0x39ee('0x43')](handleError(_0x15f8c6,null));};exports['destroy']=function(_0x58cbbd,_0x192484){return db[_0x39ee('0x2f')][_0x39ee('0x4c')]({'where':{'id':_0x58cbbd['params']['id']}})['then'](handleEntityNotFound(_0x192484,null))['then'](removeEntity(_0x192484,null))[_0x39ee('0x43')](handleError(_0x192484,null));}; \ No newline at end of file +var _0x478f=['CmHopperAdditionalPhones','end','sendStatus','error','stack','name','index','map','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','CmHopperAdditionalPhone','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','get'];(function(_0x2ac4fd,_0x2e8d8d){var _0x2e5ffb=function(_0x59114b){while(--_0x59114b){_0x2ac4fd['push'](_0x2ac4fd['shift']());}};_0x2e5ffb(++_0x2e8d8d);}(_0x478f,0x127));var _0xf478=function(_0x3a2057,_0x99761c){_0x3a2057=_0x3a2057-0x0;var _0x1d602e=_0x478f[_0x3a2057];return _0x1d602e;};'use strict';var emlformat=require(_0xf478('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf478('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf478('0x2'));var moment=require('moment');var BPromise=require(_0xf478('0x3'));var Mustache=require(_0xf478('0x4'));var util=require('util');var path=require(_0xf478('0x5'));var sox=require(_0xf478('0x6'));var csv=require(_0xf478('0x7'));var ejs=require(_0xf478('0x8'));var fs=require('fs');var fs_extra=require(_0xf478('0x9'));var _=require(_0xf478('0xa'));var squel=require(_0xf478('0xb'));var crypto=require('crypto');var jsforce=require(_0xf478('0xc'));var deskjs=require(_0xf478('0xd'));var toCsv=require(_0xf478('0x7'));var querystring=require('querystring');var Papa=require(_0xf478('0xe'));var Redis=require(_0xf478('0xf'));var authService=require(_0xf478('0x10'));var qs=require(_0xf478('0x11'));var as=require(_0xf478('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf478('0x13'))(_0xf478('0x14'));var utils=require(_0xf478('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf478('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb32b15,_0x1a6488){_0x1a6488=_0x1a6488||0xcc;return function(_0x4bc187){if(_0x4bc187){return _0xb32b15['sendStatus'](_0x1a6488);}return _0xb32b15[_0xf478('0x17')](_0x1a6488)['end']();};}function respondWithResult(_0x32d380,_0x24f48d){_0x24f48d=_0x24f48d||0xc8;return function(_0x4672de){if(_0x4672de){return _0x32d380[_0xf478('0x17')](_0x24f48d)[_0xf478('0x18')](_0x4672de);}};}function respondWithFilteredResult(_0xe8f9a8,_0x138346){return function(_0x295b1f){if(_0x295b1f){var _0x17e138=typeof _0x138346['offset']===_0xf478('0x19')&&typeof _0x138346[_0xf478('0x1a')]==='undefined';var _0x5a9456=_0x295b1f['count'];var _0x52350b=_0x17e138?0x0:_0x138346[_0xf478('0x1b')];var _0x407451=_0x17e138?_0x295b1f[_0xf478('0x1c')]:_0x138346[_0xf478('0x1b')]+_0x138346[_0xf478('0x1a')];var _0x3f612d;if(_0x407451>=_0x5a9456){_0x407451=_0x5a9456;_0x3f612d=0xc8;}else{_0x3f612d=0xce;}_0xe8f9a8[_0xf478('0x17')](_0x3f612d);return _0xe8f9a8[_0xf478('0x1d')](_0xf478('0x1e'),_0x52350b+'-'+_0x407451+'/'+_0x5a9456)[_0xf478('0x18')](_0x295b1f);}return null;};}function patchUpdates(_0x49dc5e){return function(_0x263b6a){try{jsonpatch[_0xf478('0x1f')](_0x263b6a,_0x49dc5e,!![]);}catch(_0xef115b){return BPromise[_0xf478('0x20')](_0xef115b);}return _0x263b6a['save']();};}function saveUpdates(_0xdbc4c8,_0x249e71){return function(_0x5467df){if(_0x5467df){return _0x5467df[_0xf478('0x21')](_0xdbc4c8)[_0xf478('0x22')](function(_0x4a04db){return _0x4a04db;});}return null;};}function removeEntity(_0x1ce0d7,_0x5ed139){return function(_0x166f63){if(_0x166f63){return _0x166f63[_0xf478('0x23')]()[_0xf478('0x22')](function(){var _0x33af43=_0x166f63[_0xf478('0x24')]({'plain':!![]});var _0x50b3ef=_0xf478('0x25');return db['UserProfileResource'][_0xf478('0x23')]({'where':{'type':_0x50b3ef,'resourceId':_0x33af43['id']}})[_0xf478('0x22')](function(){return _0x166f63;});})[_0xf478('0x22')](function(){_0x1ce0d7[_0xf478('0x17')](0xcc)[_0xf478('0x26')]();});}};}function handleEntityNotFound(_0x4405a0,_0x5a1fda){return function(_0x5e3192){if(!_0x5e3192){_0x4405a0[_0xf478('0x27')](0x194);}return _0x5e3192;};}function handleError(_0x4d4bec,_0x1e9d74){_0x1e9d74=_0x1e9d74||0x1f4;return function(_0x135d0e){logger[_0xf478('0x28')](_0x135d0e[_0xf478('0x29')]);if(_0x135d0e[_0xf478('0x2a')]){delete _0x135d0e[_0xf478('0x2a')];}_0x4d4bec[_0xf478('0x17')](_0x1e9d74)['send'](_0x135d0e);};}exports[_0xf478('0x2b')]=function(_0x5ddd47,_0x1e0a31){var _0xb77070={},_0x21585f={},_0x59920d={'count':0x0,'rows':[]};var _0xee5c3e=_[_0xf478('0x2c')](db['CmHopperAdditionalPhone'][_0xf478('0x2d')],function(_0x1633d2){return{'name':_0x1633d2['fieldName'],'type':_0x1633d2[_0xf478('0x2e')]['key']};});_0x21585f[_0xf478('0x2f')]=_['map'](_0xee5c3e,'name');_0x21585f['query']=_['keys'](_0x5ddd47[_0xf478('0x30')]);_0x21585f[_0xf478('0x31')]=_[_0xf478('0x32')](_0x21585f[_0xf478('0x2f')],_0x21585f[_0xf478('0x30')]);_0xb77070['attributes']=_[_0xf478('0x32')](_0x21585f[_0xf478('0x2f')],qs[_0xf478('0x33')](_0x5ddd47[_0xf478('0x30')]['fields']));_0xb77070['attributes']=_0xb77070[_0xf478('0x34')][_0xf478('0x35')]?_0xb77070[_0xf478('0x34')]:_0x21585f['model'];if(!_0x5ddd47[_0xf478('0x30')][_0xf478('0x36')](_0xf478('0x37'))){_0xb77070[_0xf478('0x1a')]=qs['limit'](_0x5ddd47[_0xf478('0x30')][_0xf478('0x1a')]);_0xb77070['offset']=qs[_0xf478('0x1b')](_0x5ddd47[_0xf478('0x30')][_0xf478('0x1b')]);}_0xb77070[_0xf478('0x38')]=qs[_0xf478('0x39')](_0x5ddd47[_0xf478('0x30')][_0xf478('0x39')]);_0xb77070[_0xf478('0x3a')]=qs[_0xf478('0x31')](_[_0xf478('0x3b')](_0x5ddd47[_0xf478('0x30')],_0x21585f['filters']),_0xee5c3e);if(_0x5ddd47[_0xf478('0x30')]['filter']){_0xb77070[_0xf478('0x3a')]=_[_0xf478('0x3c')](_0xb77070[_0xf478('0x3a')],{'$or':_['map'](_0xee5c3e,function(_0x86f0b2){if(_0x86f0b2[_0xf478('0x2e')]!==_0xf478('0x3d')){var _0x398770={};_0x398770[_0x86f0b2['name']]={'$like':'%'+_0x5ddd47[_0xf478('0x30')][_0xf478('0x3e')]+'%'};return _0x398770;}})});}_0xb77070=_['merge']({},_0xb77070,_0x5ddd47['options']);var _0x555f30={'where':_0xb77070[_0xf478('0x3a')]};return db[_0xf478('0x3f')][_0xf478('0x1c')](_0x555f30)[_0xf478('0x22')](function(_0x2338d2){_0x59920d['count']=_0x2338d2;if(_0x5ddd47[_0xf478('0x30')][_0xf478('0x40')]){_0xb77070[_0xf478('0x41')]=[{'all':!![]}];}return db[_0xf478('0x3f')][_0xf478('0x42')](_0xb77070);})['then'](function(_0x439f13){_0x59920d[_0xf478('0x43')]=_0x439f13;return _0x59920d;})['then'](respondWithFilteredResult(_0x1e0a31,_0xb77070))['catch'](handleError(_0x1e0a31,null));};exports[_0xf478('0x44')]=function(_0x2a2e10,_0x41dec3){var _0x5667ea={'raw':!![],'where':{'id':_0x2a2e10[_0xf478('0x45')]['id']}},_0x3e5c83={};_0x3e5c83[_0xf478('0x2f')]=_[_0xf478('0x46')](db[_0xf478('0x3f')][_0xf478('0x2d')]);_0x3e5c83[_0xf478('0x30')]=_['keys'](_0x2a2e10[_0xf478('0x30')]);_0x3e5c83[_0xf478('0x31')]=_[_0xf478('0x32')](_0x3e5c83[_0xf478('0x2f')],_0x3e5c83[_0xf478('0x30')]);_0x5667ea[_0xf478('0x34')]=_[_0xf478('0x32')](_0x3e5c83[_0xf478('0x2f')],qs['fields'](_0x2a2e10[_0xf478('0x30')]['fields']));_0x5667ea['attributes']=_0x5667ea[_0xf478('0x34')][_0xf478('0x35')]?_0x5667ea[_0xf478('0x34')]:_0x3e5c83['model'];if(_0x2a2e10[_0xf478('0x30')][_0xf478('0x40')]){_0x5667ea['include']=[{'all':!![]}];}_0x5667ea=_[_0xf478('0x3c')]({},_0x5667ea,_0x2a2e10[_0xf478('0x47')]);return db[_0xf478('0x3f')][_0xf478('0x48')](_0x5667ea)[_0xf478('0x22')](handleEntityNotFound(_0x41dec3,null))[_0xf478('0x22')](respondWithResult(_0x41dec3,null))[_0xf478('0x49')](handleError(_0x41dec3,null));};exports[_0xf478('0x4a')]=function(_0x3281be,_0x5721a0){return db[_0xf478('0x3f')][_0xf478('0x4a')](_0x3281be[_0xf478('0x4b')],{})['then'](function(_0xfa8bf){var _0x587169=_0x3281be[_0xf478('0x4c')][_0xf478('0x24')]({'plain':!![]});if(!_0x587169)throw new Error(_0xf478('0x4d'));if(_0x587169[_0xf478('0x4e')]===_0xf478('0x4c')){var _0xb610d0=_0xfa8bf[_0xf478('0x24')]({'plain':!![]});var _0xbe0cf1=_0xf478('0x25');return db[_0xf478('0x4f')][_0xf478('0x48')]({'where':{'name':_0xbe0cf1,'userProfileId':_0x587169['userProfileId']},'raw':!![]})[_0xf478('0x22')](function(_0x16beba){if(_0x16beba&&_0x16beba[_0xf478('0x50')]===0x0){return db[_0xf478('0x51')][_0xf478('0x4a')]({'name':_0xb610d0[_0xf478('0x2a')],'resourceId':_0xb610d0['id'],'type':_0x16beba[_0xf478('0x2a')],'sectionId':_0x16beba['id']},{})[_0xf478('0x22')](function(){return _0xfa8bf;});}else{return _0xfa8bf;}})[_0xf478('0x49')](function(_0x167893){logger[_0xf478('0x28')](_0xf478('0x52'),_0x167893);throw _0x167893;});}return _0xfa8bf;})[_0xf478('0x22')](respondWithResult(_0x5721a0,0xc9))['catch'](handleError(_0x5721a0,null));};exports[_0xf478('0x21')]=function(_0x2f11fd,_0x8ce934){if(_0x2f11fd['body']['id']){delete _0x2f11fd[_0xf478('0x4b')]['id'];}return db[_0xf478('0x3f')][_0xf478('0x48')]({'where':{'id':_0x2f11fd['params']['id']}})[_0xf478('0x22')](handleEntityNotFound(_0x8ce934,null))[_0xf478('0x22')](saveUpdates(_0x2f11fd['body'],null))[_0xf478('0x22')](respondWithResult(_0x8ce934,null))[_0xf478('0x49')](handleError(_0x8ce934,null));};exports['destroy']=function(_0xca3e55,_0x51efc1){return db['CmHopperAdditionalPhone'][_0xf478('0x48')]({'where':{'id':_0xca3e55[_0xf478('0x45')]['id']}})[_0xf478('0x22')](handleEntityNotFound(_0x51efc1,null))[_0xf478('0x22')](removeEntity(_0x51efc1,null))[_0xf478('0x49')](handleError(_0x51efc1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 33d5027..f4544eb 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 _0x02f4=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02f4,0xdc));var _0x402f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x02f4[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x402f('0x0'));var util=require(_0x402f('0x1'));var logger=require('../../config/logger')(_0x402f('0x2'));var moment=require(_0x402f('0x3'));var BPromise=require(_0x402f('0x4'));var rp=require(_0x402f('0x5'));var fs=require('fs');var path=require(_0x402f('0x6'));var rimraf=require(_0x402f('0x7'));var config=require(_0x402f('0x8'));var attributes=require(_0x402f('0x9'));module[_0x402f('0xa')]=function(_0x56d84f,_0x3257b6){return _0x56d84f[_0x402f('0xb')](_0x402f('0xc'),attributes,{'tableName':_0x402f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x855e=['CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports'];(function(_0x3b2908,_0xd369e1){var _0x28f29b=function(_0x91d62c){while(--_0x91d62c){_0x3b2908['push'](_0x3b2908['shift']());}};_0x28f29b(++_0xd369e1);}(_0x855e,0x1af));var _0xe855=function(_0x151732,_0x82b764){_0x151732=_0x151732-0x0;var _0x1cda86=_0x855e[_0x151732];return _0x1cda86;};'use strict';var _=require(_0xe855('0x0'));var util=require(_0xe855('0x1'));var logger=require(_0xe855('0x2'))(_0xe855('0x3'));var moment=require(_0xe855('0x4'));var BPromise=require('bluebird');var rp=require(_0xe855('0x5'));var fs=require('fs');var path=require(_0xe855('0x6'));var rimraf=require(_0xe855('0x7'));var config=require(_0xe855('0x8'));var attributes=require(_0xe855('0x9'));module[_0xe855('0xa')]=function(_0x3554bb,_0x2ff243){return _0x3554bb['define'](_0xe855('0xb'),attributes,{'tableName':_0xe855('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 1dbe671..04a65bc 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 _0xb82c=['sequelize','update','activateAdditionalPhone','field','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','then','OrderBy','ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countnoanswerretry','countabandonedretry','SwapAdditionalPhones','ContactId','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt'];(function(_0x4c1934,_0xc9251f){var _0x202246=function(_0x4ed122){while(--_0x4ed122){_0x4c1934['push'](_0x4c1934['shift']());}};_0x202246(++_0xc9251f);}(_0xb82c,0x7a));var _0xcb82=function(_0x1f9f98,_0xf30157){_0x1f9f98=_0x1f9f98-0x0;var _0xcac5c2=_0xb82c[_0x1f9f98];return _0xcac5c2;};'use strict';var _=require(_0xcb82('0x0'));var util=require(_0xcb82('0x1'));var moment=require(_0xcb82('0x2'));var BPromise=require('bluebird');var rs=require(_0xcb82('0x3'));var fs=require('fs');var Redis=require(_0xcb82('0x4'));var db=require(_0xcb82('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb82('0x6'))(_0xcb82('0x7'));var config=require(_0xcb82('0x8'));var jayson=require(_0xcb82('0x9'));var client=jayson[_0xcb82('0xa')][_0xcb82('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4859e1,_0x596d42,_0x3b52a7){return new BPromise(function(_0x185e54,_0x58aeac){return client[_0xcb82('0xc')](_0x4859e1,_0x3b52a7)['then'](function(_0x329628){logger[_0xcb82('0xd')](_0xcb82('0xe'),_0x596d42,'request\x20sent');logger[_0xcb82('0xf')](_0xcb82('0x10'),_0x596d42,_0xcb82('0x11'),JSON[_0xcb82('0x12')](_0x329628));if(_0x329628[_0xcb82('0x13')]){if(_0x329628[_0xcb82('0x13')]['code']===0x1f4){logger[_0xcb82('0x13')](_0xcb82('0xe'),_0x596d42,_0x329628['error']['message']);return _0x58aeac(_0x329628[_0xcb82('0x13')][_0xcb82('0x14')]);}logger[_0xcb82('0x13')](_0xcb82('0xe'),_0x596d42,_0x329628['error']['message']);return _0x185e54(_0x329628[_0xcb82('0x13')][_0xcb82('0x14')]);}else{logger['info'](_0xcb82('0xe'),_0x596d42,_0xcb82('0x11'));_0x185e54(_0x329628[_0xcb82('0x15')][_0xcb82('0x14')]);}})[_0xcb82('0x16')](function(_0x5b8fbc){logger[_0xcb82('0x13')](_0xcb82('0xe'),_0x596d42,_0x5b8fbc);_0x58aeac(_0x5b8fbc);});});}exports[_0xcb82('0x17')]=function(_0x3a92e3){var _0x5d8b19=this;return new Promise(function(_0x1342b5,_0x23cc41){return db[_0xcb82('0x18')][_0xcb82('0x19')]({'raw':!![],'where':{'ContactId':_0x3a92e3[_0xcb82('0x1a')]['ContactId'],'ListId':_0x3a92e3[_0xcb82('0x1a')][_0xcb82('0x1b')],'VoiceQueueId':_0x3a92e3[_0xcb82('0x1a')][_0xcb82('0x1c')]===undefined?null:_0x3a92e3['body'][_0xcb82('0x1c')],'CampaignId':_0x3a92e3[_0xcb82('0x1a')][_0xcb82('0x1d')]===undefined?null:_0x3a92e3[_0xcb82('0x1a')][_0xcb82('0x1d')]}})[_0xcb82('0x1e')](function(_0x5e1730){if(_0x5e1730!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x5e1730['id'],'OrderBy':{'$gt':_0x5e1730[_0xcb82('0x1f')]}},'order':[[_0xcb82('0x1f'),_0xcb82('0x20')]]})[_0xcb82('0x1e')](function(_0x4f03b){var _0x1cd7bf=0x0;if(_0x4f03b){if(_0x4f03b[_0xcb82('0x21')]+_0x4f03b[_0xcb82('0x22')]+_0x4f03b['countnoanswerretry']+_0x4f03b[_0xcb82('0x23')]+_0x4f03b[_0xcb82('0x24')]+_0x4f03b['countabandonedretry']+_0x4f03b[_0xcb82('0x25')]+_0x4f03b[_0xcb82('0x26')]<_0x3a92e3[_0xcb82('0x27')][_0xcb82('0x28')])_0x1cd7bf=0x1;_0x1342b5({'additional':_0x1cd7bf});}else{return db[_0xcb82('0x29')][_0xcb82('0x19')]({'raw':!![],'where':{'CmHopperId':_0x5e1730['id']},'order':[[_0xcb82('0x1f'),'ASC']]})[_0xcb82('0x1e')](function(_0x3e582d){var _0x2e5f12=0x0;if(_0x3e582d){if(_0x3e582d[_0xcb82('0x21')]+_0x3e582d[_0xcb82('0x22')]+_0x3e582d[_0xcb82('0x2a')]+_0x3e582d[_0xcb82('0x23')]+_0x3e582d[_0xcb82('0x24')]+_0x3e582d[_0xcb82('0x2b')]+_0x3e582d['countmachineretry']+_0x3e582d[_0xcb82('0x26')]<_0x3a92e3[_0xcb82('0x27')][_0xcb82('0x28')])_0x2e5f12=0x1;_0x1342b5({'additional':_0x2e5f12});}else{_0x1342b5({'additional':0x0});}})[_0xcb82('0x16')](function(_0x6090e6){logger[_0xcb82('0x13')](_0xcb82('0x17'),_0x6090e6[_0xcb82('0x14')]);_0x23cc41(_0x5d8b19[_0xcb82('0x13')](0x1f4,_0x6090e6[_0xcb82('0x14')]));});}})[_0xcb82('0x16')](function(_0x7ce0df){logger[_0xcb82('0x13')](_0xcb82('0x17'),_0x7ce0df[_0xcb82('0x14')]);_0x23cc41(_0x5d8b19[_0xcb82('0x13')](0x1f4,_0x7ce0df[_0xcb82('0x14')]));});}else _0x1342b5({'additional':0x0});});});};exports[_0xcb82('0x2c')]=function(_0x59e394){var _0x3f5712=this;return new Promise(function(_0x3b41fb,_0x33db0b){return db[_0xcb82('0x18')][_0xcb82('0x19')]({'raw':!![],'where':{'ContactId':_0x59e394[_0xcb82('0x1a')][_0xcb82('0x2d')],'ListId':_0x59e394['body']['ListId'],'VoiceQueueId':_0x59e394[_0xcb82('0x1a')][_0xcb82('0x1c')]===undefined?null:_0x59e394[_0xcb82('0x1a')][_0xcb82('0x1c')],'CampaignId':_0x59e394[_0xcb82('0x1a')][_0xcb82('0x1d')]===undefined?null:_0x59e394[_0xcb82('0x1a')][_0xcb82('0x1d')]}})[_0xcb82('0x1e')](function(_0x1896dd){if(_0x1896dd!=null){return db[_0xcb82('0x29')][_0xcb82('0x19')]({'raw':!![],'where':{'CmHopperId':_0x1896dd['id'],'OrderBy':{'$gte':_0x1896dd[_0xcb82('0x1f')]}},'order':[[_0xcb82('0x1f'),_0xcb82('0x20')]]})[_0xcb82('0x1e')](function(_0x5c6a2b){if(_0x5c6a2b)return activateAdditionalPhone(_0x1896dd,_0x59e394[_0xcb82('0x1a')],_0x5c6a2b,_0x59e394[_0xcb82('0x2e')],_0x59e394[_0xcb82('0x2f')])[_0xcb82('0x1e')](function(_0x3a67b6){_0x3b41fb(_0x3a67b6);});else{return db[_0xcb82('0x29')][_0xcb82('0x19')]({'raw':!![],'where':{'CmHopperId':_0x1896dd['id']},'order':[[_0xcb82('0x1f'),'ASC']]})[_0xcb82('0x1e')](function(_0x45b796){if(_0x45b796)return activateAdditionalPhone(_0x1896dd,_0x59e394[_0xcb82('0x1a')],_0x45b796,_0x59e394[_0xcb82('0x2e')],_0x59e394[_0xcb82('0x2f')])[_0xcb82('0x1e')](function(_0x2178f7){_0x3b41fb(_0x2178f7);});else{_0x3b41fb({'id':_0x1896dd['id'],'phone':''});}})[_0xcb82('0x16')](function(_0x3b5e63){logger[_0xcb82('0x13')](_0xcb82('0x17'),_0x3b5e63[_0xcb82('0x14')]);_0x33db0b(_0x3f5712['error'](0x1f4,_0x3b5e63[_0xcb82('0x14')]));});}})['catch'](function(_0x20eb30){logger[_0xcb82('0x13')](_0xcb82('0x17'),_0x20eb30[_0xcb82('0x14')]);_0x33db0b(_0x3f5712[_0xcb82('0x13')](0x1f4,_0x20eb30[_0xcb82('0x14')]));});}else _0x3b41fb(0x1);});});};function activateAdditionalPhone(_0x5e1cef,_0x8cdbbb,_0x1c89d0,_0x19368a,_0x5c64ba){return new Promise(function(_0x2e396e,_0x24f911){var _0x28ae74;if(_[_0xcb82('0x30')](_0x1c89d0[_0xcb82('0x31')])){_0x1c89d0[_0xcb82('0x31')]=moment();}if(moment()>moment(_0x1c89d0['scheduledat'])){_0x28ae74=moment()[_0xcb82('0x32')](_0x5c64ba||0x3,_0xcb82('0x33'));}else{if(_0x1c89d0[_0xcb82('0x1f')]==0x0){_0x28ae74=moment(_0x1c89d0[_0xcb82('0x31')]);}else{_0x28ae74=moment()[_0xcb82('0x32')](_0x5c64ba||0x3,'minutes');}}if(_[_0xcb82('0x30')](_0x28ae74)){_0x28ae74=moment()[_0xcb82('0x32')](_0x5c64ba||0x3,_0xcb82('0x33'));}var _0x595e64={'phone':_0x5e1cef[_0xcb82('0x34')],'active':0x0,'OrderBy':_[_0xcb82('0x30')](_0x5e1cef['OrderBy'])?0x0:_0x5e1cef[_0xcb82('0x1f')],'scheduledat':moment()[_0xcb82('0x32')](_0x19368a||0x1,_0xcb82('0x33')),'countbusyretry':_0x8cdbbb[_0xcb82('0x21')],'countcongestionretry':_0x8cdbbb['countcongestionretry'],'countnoanswerretry':_0x8cdbbb['countnoanswerretry'],'countnosuchnumberretry':_0x8cdbbb[_0xcb82('0x23')],'countdropretry':_0x8cdbbb[_0xcb82('0x24')],'countabandonedretry':_0x8cdbbb['countabandonedretry'],'countmachineretry':_0x8cdbbb[_0xcb82('0x25')],'countagentrejectretry':_0x8cdbbb[_0xcb82('0x26')],'createdAt':_0x8cdbbb['createdAt'],'updatedAt':_0x8cdbbb['updatedAt']};var _0x252434={'CmHopperId':_0x5e1cef['id'],'phone':_0x1c89d0[_0xcb82('0x34')],'active':0x0,'OrderBy':_[_0xcb82('0x30')](_0x1c89d0[_0xcb82('0x1f')])?0x0:_0x1c89d0[_0xcb82('0x1f')],'scheduledat':_0x28ae74,'countbusyretry':_0x1c89d0['countbusyretry'],'countcongestionretry':_0x1c89d0['countcongestionretry'],'countnoanswerretry':_0x1c89d0['countnoanswerretry'],'countnosuchnumberretry':_0x1c89d0[_0xcb82('0x23')],'countdropretry':_0x1c89d0[_0xcb82('0x24')],'countabandonedretry':_0x1c89d0[_0xcb82('0x2b')],'countmachineretry':_0x1c89d0[_0xcb82('0x25')],'countagentrejectretry':_0x1c89d0[_0xcb82('0x26')],'createdAt':_0x1c89d0[_0xcb82('0x35')],'updatedAt':_0x1c89d0[_0xcb82('0x36')]};return db[_0xcb82('0x37')]['transaction'](function(_0x20cbda){return db[_0xcb82('0x29')][_0xcb82('0x38')](_0x595e64,{'where':{'id':_0x1c89d0['id']}},{'transaction':_0x20cbda})['then'](function(){return db[_0xcb82('0x18')][_0xcb82('0x38')](_0x252434,{'where':{'id':_0x5e1cef['id']}},{'transaction':_0x20cbda});});})[_0xcb82('0x1e')](function(_0x35fbd6){_0x2e396e({'id':_0x5e1cef['id'],'phone':_0x1c89d0[_0xcb82('0x34')]});})[_0xcb82('0x16')](function(_0x2a58b2){logger['error'](_0xcb82('0x39'),_0x2a58b2['message']);_0x24f911({'error':_0x2a58b2['message']});});});}exports['IncrementPreviewCounters']=function(_0x39d1c0){var _0x3b5d3e=this;return new Promise(function(_0x1171e2,_0x13e3ca){return db[_0xcb82('0x18')][_0xcb82('0x38')](_0x39d1c0[_0xcb82('0x1a')][_0xcb82('0x3a')],{'where':{'id':_0x39d1c0[_0xcb82('0x1a')]['id']}})['then'](function(_0x3b2466){_0x1171e2(_0x3b2466);})['catch'](function(_0x5ad10d){logger[_0xcb82('0x13')]('IncrementPreviewCounters',_0x5ad10d['message']);_0x13e3ca(_0x3b5d3e[_0xcb82('0x13')](0x1f4,_0x5ad10d[_0xcb82('0x14')]));});});}; \ No newline at end of file +var _0xc625=['phone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','VerifyAdditionalPhones','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','countbusyretry','countdropretry','entity','SwapAdditionalPhones','CmHopper','ContactId','duration','waitTime','isNil','scheduledat','minutes','add','createdAt','updatedAt','sequelize','transaction','update'];(function(_0x37f5a1,_0x461925){var _0x3a97a5=function(_0x11f158){while(--_0x11f158){_0x37f5a1['push'](_0x37f5a1['shift']());}};_0x3a97a5(++_0x461925);}(_0xc625,0xef));var _0x5c62=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0xc625[_0x4c6d6f];return _0x2d4478;};'use strict';var _=require(_0x5c62('0x0'));var util=require(_0x5c62('0x1'));var moment=require(_0x5c62('0x2'));var BPromise=require(_0x5c62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c62('0x4'));var db=require(_0x5c62('0x5'))['db'];var utils=require(_0x5c62('0x6'));var logger=require('../../config/logger')(_0x5c62('0x7'));var config=require(_0x5c62('0x8'));var jayson=require(_0x5c62('0x9'));var client=jayson[_0x5c62('0xa')][_0x5c62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x515376,_0x36e11f,_0x6e7c9d){return new BPromise(function(_0x2d4be2,_0x21112a){return client['request'](_0x515376,_0x6e7c9d)[_0x5c62('0xc')](function(_0x4177c7){logger['info'](_0x5c62('0xd'),_0x36e11f,'request\x20sent');logger[_0x5c62('0xe')](_0x5c62('0xf'),_0x36e11f,_0x5c62('0x10'),JSON[_0x5c62('0x11')](_0x4177c7));if(_0x4177c7[_0x5c62('0x12')]){if(_0x4177c7[_0x5c62('0x12')]['code']===0x1f4){logger[_0x5c62('0x12')](_0x5c62('0xd'),_0x36e11f,_0x4177c7[_0x5c62('0x12')][_0x5c62('0x13')]);return _0x21112a(_0x4177c7[_0x5c62('0x12')][_0x5c62('0x13')]);}logger['error'](_0x5c62('0xd'),_0x36e11f,_0x4177c7[_0x5c62('0x12')][_0x5c62('0x13')]);return _0x2d4be2(_0x4177c7[_0x5c62('0x12')][_0x5c62('0x13')]);}else{logger[_0x5c62('0x14')](_0x5c62('0xd'),_0x36e11f,_0x5c62('0x10'));_0x2d4be2(_0x4177c7[_0x5c62('0x15')][_0x5c62('0x13')]);}})[_0x5c62('0x16')](function(_0x56e8f1){logger[_0x5c62('0x12')](_0x5c62('0xd'),_0x36e11f,_0x56e8f1);_0x21112a(_0x56e8f1);});});}exports[_0x5c62('0x17')]=function(_0x10c36f){var _0x497f91=this;return new Promise(function(_0x49da6a,_0x404c5f){return db['CmHopper'][_0x5c62('0x18')]({'raw':!![],'where':{'ContactId':_0x10c36f[_0x5c62('0x19')]['ContactId'],'ListId':_0x10c36f[_0x5c62('0x19')][_0x5c62('0x1a')],'VoiceQueueId':_0x10c36f['body']['VoiceQueueId']===undefined?null:_0x10c36f[_0x5c62('0x19')][_0x5c62('0x1b')],'CampaignId':_0x10c36f[_0x5c62('0x19')][_0x5c62('0x1c')]===undefined?null:_0x10c36f[_0x5c62('0x19')][_0x5c62('0x1c')]}})['then'](function(_0x556ba5){if(_0x556ba5!=null){return db[_0x5c62('0x1d')][_0x5c62('0x18')]({'raw':!![],'where':{'CmHopperId':_0x556ba5['id'],'OrderBy':{'$gt':_0x556ba5[_0x5c62('0x1e')]}},'order':[[_0x5c62('0x1e'),_0x5c62('0x1f')]]})[_0x5c62('0xc')](function(_0x304a7e){var _0x2f5536=0x0;if(_0x304a7e){if(_0x304a7e['countbusyretry']+_0x304a7e[_0x5c62('0x20')]+_0x304a7e[_0x5c62('0x21')]+_0x304a7e[_0x5c62('0x22')]+_0x304a7e['countdropretry']+_0x304a7e[_0x5c62('0x23')]+_0x304a7e[_0x5c62('0x24')]+_0x304a7e[_0x5c62('0x25')]<_0x10c36f['entity'][_0x5c62('0x26')])_0x2f5536=0x1;_0x49da6a({'additional':_0x2f5536});}else{return db[_0x5c62('0x1d')][_0x5c62('0x18')]({'raw':!![],'where':{'CmHopperId':_0x556ba5['id']},'order':[[_0x5c62('0x1e'),'ASC']]})[_0x5c62('0xc')](function(_0x2ffc12){var _0x4d505f=0x0;if(_0x2ffc12){if(_0x2ffc12[_0x5c62('0x27')]+_0x2ffc12[_0x5c62('0x20')]+_0x2ffc12['countnoanswerretry']+_0x2ffc12[_0x5c62('0x22')]+_0x2ffc12[_0x5c62('0x28')]+_0x2ffc12[_0x5c62('0x23')]+_0x2ffc12[_0x5c62('0x24')]+_0x2ffc12[_0x5c62('0x25')]<_0x10c36f[_0x5c62('0x29')]['dialGlobalMaxRetry'])_0x4d505f=0x1;_0x49da6a({'additional':_0x4d505f});}else{_0x49da6a({'additional':0x0});}})['catch'](function(_0x443c10){logger[_0x5c62('0x12')](_0x5c62('0x17'),_0x443c10[_0x5c62('0x13')]);_0x404c5f(_0x497f91['error'](0x1f4,_0x443c10['message']));});}})['catch'](function(_0x416e98){logger[_0x5c62('0x12')](_0x5c62('0x17'),_0x416e98['message']);_0x404c5f(_0x497f91[_0x5c62('0x12')](0x1f4,_0x416e98[_0x5c62('0x13')]));});}else _0x49da6a({'additional':0x0});});});};exports[_0x5c62('0x2a')]=function(_0x3eb207){var _0x1d749b=this;return new Promise(function(_0xbc732,_0xa7b68b){return db[_0x5c62('0x2b')][_0x5c62('0x18')]({'raw':!![],'where':{'ContactId':_0x3eb207[_0x5c62('0x19')][_0x5c62('0x2c')],'ListId':_0x3eb207[_0x5c62('0x19')][_0x5c62('0x1a')],'VoiceQueueId':_0x3eb207[_0x5c62('0x19')][_0x5c62('0x1b')]===undefined?null:_0x3eb207[_0x5c62('0x19')][_0x5c62('0x1b')],'CampaignId':_0x3eb207[_0x5c62('0x19')]['CampaignId']===undefined?null:_0x3eb207[_0x5c62('0x19')][_0x5c62('0x1c')]}})[_0x5c62('0xc')](function(_0x37bb85){if(_0x37bb85!=null){return db[_0x5c62('0x1d')][_0x5c62('0x18')]({'raw':!![],'where':{'CmHopperId':_0x37bb85['id'],'OrderBy':{'$gte':_0x37bb85[_0x5c62('0x1e')]}},'order':[[_0x5c62('0x1e'),_0x5c62('0x1f')]]})[_0x5c62('0xc')](function(_0x2c211c){if(_0x2c211c)return activateAdditionalPhone(_0x37bb85,_0x3eb207[_0x5c62('0x19')],_0x2c211c,_0x3eb207[_0x5c62('0x2d')],_0x3eb207[_0x5c62('0x2e')])[_0x5c62('0xc')](function(_0x309eb3){_0xbc732(_0x309eb3);});else{return db[_0x5c62('0x1d')][_0x5c62('0x18')]({'raw':!![],'where':{'CmHopperId':_0x37bb85['id']},'order':[[_0x5c62('0x1e'),_0x5c62('0x1f')]]})[_0x5c62('0xc')](function(_0x4d93f5){if(_0x4d93f5)return activateAdditionalPhone(_0x37bb85,_0x3eb207['body'],_0x4d93f5,_0x3eb207['duration'],_0x3eb207[_0x5c62('0x2e')])[_0x5c62('0xc')](function(_0x35af89){_0xbc732(_0x35af89);});else{_0xbc732({'id':_0x37bb85['id'],'phone':''});}})[_0x5c62('0x16')](function(_0x5b73e2){logger[_0x5c62('0x12')]('VerifyAdditionalPhones',_0x5b73e2[_0x5c62('0x13')]);_0xa7b68b(_0x1d749b['error'](0x1f4,_0x5b73e2[_0x5c62('0x13')]));});}})[_0x5c62('0x16')](function(_0x27918a){logger[_0x5c62('0x12')](_0x5c62('0x17'),_0x27918a['message']);_0xa7b68b(_0x1d749b['error'](0x1f4,_0x27918a[_0x5c62('0x13')]));});}else _0xbc732(0x1);});});};function activateAdditionalPhone(_0x303971,_0x3882f4,_0x36d122,_0x26f530,_0x538b5c){return new Promise(function(_0x50bf36,_0x1d8457){var _0x15ca79;if(_[_0x5c62('0x2f')](_0x36d122[_0x5c62('0x30')])){_0x36d122[_0x5c62('0x30')]=moment();}if(moment()>moment(_0x36d122[_0x5c62('0x30')])){_0x15ca79=moment()['add'](_0x538b5c||0x3,_0x5c62('0x31'));}else{if(_0x36d122[_0x5c62('0x1e')]==0x0){_0x15ca79=moment(_0x36d122[_0x5c62('0x30')]);}else{_0x15ca79=moment()[_0x5c62('0x32')](_0x538b5c||0x3,_0x5c62('0x31'));}}if(_[_0x5c62('0x2f')](_0x15ca79)){_0x15ca79=moment()[_0x5c62('0x32')](_0x538b5c||0x3,_0x5c62('0x31'));}var _0x19aec4={'phone':_0x303971['phone'],'active':0x0,'OrderBy':_[_0x5c62('0x2f')](_0x303971['OrderBy'])?0x0:_0x303971[_0x5c62('0x1e')],'scheduledat':moment()[_0x5c62('0x32')](_0x26f530||0x1,'minutes'),'countbusyretry':_0x3882f4['countbusyretry'],'countcongestionretry':_0x3882f4['countcongestionretry'],'countnoanswerretry':_0x3882f4[_0x5c62('0x21')],'countnosuchnumberretry':_0x3882f4['countnosuchnumberretry'],'countdropretry':_0x3882f4[_0x5c62('0x28')],'countabandonedretry':_0x3882f4['countabandonedretry'],'countmachineretry':_0x3882f4[_0x5c62('0x24')],'countagentrejectretry':_0x3882f4[_0x5c62('0x25')],'createdAt':_0x3882f4[_0x5c62('0x33')],'updatedAt':_0x3882f4[_0x5c62('0x34')]};var _0x3cedb6={'CmHopperId':_0x303971['id'],'phone':_0x36d122['phone'],'active':0x0,'OrderBy':_[_0x5c62('0x2f')](_0x36d122[_0x5c62('0x1e')])?0x0:_0x36d122['OrderBy'],'scheduledat':_0x15ca79,'countbusyretry':_0x36d122[_0x5c62('0x27')],'countcongestionretry':_0x36d122[_0x5c62('0x20')],'countnoanswerretry':_0x36d122['countnoanswerretry'],'countnosuchnumberretry':_0x36d122[_0x5c62('0x22')],'countdropretry':_0x36d122[_0x5c62('0x28')],'countabandonedretry':_0x36d122[_0x5c62('0x23')],'countmachineretry':_0x36d122[_0x5c62('0x24')],'countagentrejectretry':_0x36d122[_0x5c62('0x25')],'createdAt':_0x36d122['createdAt'],'updatedAt':_0x36d122[_0x5c62('0x34')]};return db[_0x5c62('0x35')][_0x5c62('0x36')](function(_0x44a02d){return db['CmHopperAdditionalPhone'][_0x5c62('0x37')](_0x19aec4,{'where':{'id':_0x36d122['id']}},{'transaction':_0x44a02d})['then'](function(){return db[_0x5c62('0x2b')][_0x5c62('0x37')](_0x3cedb6,{'where':{'id':_0x303971['id']}},{'transaction':_0x44a02d});});})['then'](function(_0x35e541){_0x50bf36({'id':_0x303971['id'],'phone':_0x36d122[_0x5c62('0x38')]});})['catch'](function(_0x2b8602){logger[_0x5c62('0x12')]('activateAdditionalPhone',_0x2b8602[_0x5c62('0x13')]);_0x1d8457({'error':_0x2b8602[_0x5c62('0x13')]});});});}exports[_0x5c62('0x39')]=function(_0x1e05c8){var _0x15261e=this;return new Promise(function(_0x4c0eac,_0x3ef460){return db['CmHopper'][_0x5c62('0x37')](_0x1e05c8[_0x5c62('0x19')][_0x5c62('0x3a')],{'where':{'id':_0x1e05c8[_0x5c62('0x19')]['id']}})[_0x5c62('0xc')](function(_0x1a4019){_0x4c0eac(_0x1a4019);})[_0x5c62('0x16')](function(_0x4a536f){logger[_0x5c62('0x12')]('IncrementPreviewCounters',_0x4a536f['message']);_0x3ef460(_0x15261e[_0x5c62('0x12')](0x1f4,_0x4a536f[_0x5c62('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 2c9a08c..4dfd498 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 _0x10ff=['/:id','create','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index'];(function(_0x35b5d2,_0x15fdb0){var _0x55fccd=function(_0x3c06a2){while(--_0x3c06a2){_0x35b5d2['push'](_0x35b5d2['shift']());}};_0x55fccd(++_0x15fdb0);}(_0x10ff,0x1b5));var _0xf10f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x10ff[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xf10f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf10f('0x1'));var express=require(_0xf10f('0x2'));var router=express['Router']();var fs_extra=require(_0xf10f('0x3'));var auth=require(_0xf10f('0x4'));var interaction=require(_0xf10f('0x5'));var config=require(_0xf10f('0x6'));var controller=require(_0xf10f('0x7'));router[_0xf10f('0x8')]('/',auth[_0xf10f('0x9')](),controller[_0xf10f('0xa')]);router[_0xf10f('0x8')](_0xf10f('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xf10f('0x9')](),controller[_0xf10f('0xc')]);router['put'](_0xf10f('0xb'),auth[_0xf10f('0x9')](),controller['update']);router[_0xf10f('0xd')](_0xf10f('0xb'),auth['isAuthenticated'](),controller[_0xf10f('0xe')]);module[_0xf10f('0xf')]=router; \ No newline at end of file +var _0x8e6d=['../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3be7a2,_0x2e07f2){var _0x4a6d5f=function(_0x4cf454){while(--_0x4cf454){_0x3be7a2['push'](_0x3be7a2['shift']());}};_0x4a6d5f(++_0x2e07f2);}(_0x8e6d,0x92));var _0xd8e6=function(_0x3091a3,_0x1e577a){_0x3091a3=_0x3091a3-0x0;var _0x373930=_0x8e6d[_0x3091a3];return _0x373930;};'use strict';var multer=require(_0xd8e6('0x0'));var util=require(_0xd8e6('0x1'));var path=require(_0xd8e6('0x2'));var timeout=require(_0xd8e6('0x3'));var express=require(_0xd8e6('0x4'));var router=express[_0xd8e6('0x5')]();var fs_extra=require(_0xd8e6('0x6'));var auth=require(_0xd8e6('0x7'));var interaction=require(_0xd8e6('0x8'));var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0xd8e6('0x9')]('/',auth['isAuthenticated'](),controller[_0xd8e6('0xa')]);router[_0xd8e6('0x9')]('/:id',auth[_0xd8e6('0xb')](),controller[_0xd8e6('0xc')]);router['post']('/',auth[_0xd8e6('0xb')](),controller['create']);router['put'](_0xd8e6('0xd'),auth[_0xd8e6('0xb')](),controller[_0xd8e6('0xe')]);router[_0xd8e6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xd8e6('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 0ef04e6..3d802d3 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 _0xcba8=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcba8,0x1f0));var _0x8cba=function(_0x488103,_0x2a50e0){_0x488103=_0x488103-0x0;var _0x3ed120=_0xcba8[_0x488103];return _0x3ed120;};'use strict';var moment=require(_0x8cba('0x0'));var Sequelize=require(_0x8cba('0x1'));module[_0x8cba('0x2')]={'phone':{'type':Sequelize[_0x8cba('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x8cba('0x4')],'unique':_0x8cba('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x8cba('0x4')],'unique':_0x8cba('0x5')}}; \ No newline at end of file +var _0x2a9a=['moment','exports','contactListQueue','INTEGER'];(function(_0x2af99e,_0x3b12b2){var _0x167bef=function(_0x26d6a6){while(--_0x26d6a6){_0x2af99e['push'](_0x2af99e['shift']());}};_0x167bef(++_0x3b12b2);}(_0x2a9a,0x64));var _0xa2a9=function(_0x15e406,_0x2e27cc){_0x15e406=_0x15e406-0x0;var _0x1aa743=_0x2a9a[_0x15e406];return _0x1aa743;};'use strict';var moment=require(_0xa2a9('0x0'));var Sequelize=require('sequelize');module[_0xa2a9('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xa2a9('0x2')},'ListId':{'type':Sequelize[_0xa2a9('0x3')],'unique':_0xa2a9('0x2')},'VoiceQueueId':{'type':Sequelize[_0xa2a9('0x3')],'unique':_0xa2a9('0x2')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 1661373..d4d3269 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 _0x286e=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','includeAll','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x5b365d,_0x308faa){var _0x7da320=function(_0x4cef2){while(--_0x4cef2){_0x5b365d['push'](_0x5b365d['shift']());}};_0x7da320(++_0x308faa);}(_0x286e,0x85));var _0xe286=function(_0x4610f6,_0x5fe8c3){_0x4610f6=_0x4610f6-0x0;var _0x422a4d=_0x286e[_0x4610f6];return _0x422a4d;};'use strict';var emlformat=require(_0xe286('0x0'));var rimraf=require(_0xe286('0x1'));var zipdir=require(_0xe286('0x2'));var jsonpatch=require(_0xe286('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe286('0x4'));var Mustache=require(_0xe286('0x5'));var util=require(_0xe286('0x6'));var path=require('path');var sox=require(_0xe286('0x7'));var csv=require('to-csv');var ejs=require(_0xe286('0x8'));var fs=require('fs');var fs_extra=require(_0xe286('0x9'));var _=require('lodash');var squel=require(_0xe286('0xa'));var crypto=require(_0xe286('0xb'));var jsforce=require(_0xe286('0xc'));var deskjs=require(_0xe286('0xd'));var toCsv=require(_0xe286('0xe'));var querystring=require(_0xe286('0xf'));var Papa=require(_0xe286('0x10'));var Redis=require(_0xe286('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe286('0x12'));var as=require(_0xe286('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe286('0x14'))(_0xe286('0x15'));var utils=require(_0xe286('0x16'));var config=require(_0xe286('0x17'));var licenseUtil=require(_0xe286('0x18'));var db=require(_0xe286('0x19'))['db'];function respondWithStatusCode(_0x13a5d3,_0x48830f){_0x48830f=_0x48830f||0xcc;return function(_0x9bb20a){if(_0x9bb20a){return _0x13a5d3[_0xe286('0x1a')](_0x48830f);}return _0x13a5d3['status'](_0x48830f)[_0xe286('0x1b')]();};}function respondWithResult(_0x55692a,_0x1c2a33){_0x1c2a33=_0x1c2a33||0xc8;return function(_0x260820){if(_0x260820){return _0x55692a['status'](_0x1c2a33)[_0xe286('0x1c')](_0x260820);}};}function respondWithFilteredResult(_0xd02c9a,_0x23d1e0){return function(_0x4afd13){if(_0x4afd13){var _0x2e30c7=typeof _0x23d1e0[_0xe286('0x1d')]===_0xe286('0x1e')&&typeof _0x23d1e0[_0xe286('0x1f')]===_0xe286('0x1e');var _0x5abf43=_0x4afd13[_0xe286('0x20')];var _0x582d39=_0x2e30c7?0x0:_0x23d1e0[_0xe286('0x1d')];var _0x3f483e=_0x2e30c7?_0x4afd13[_0xe286('0x20')]:_0x23d1e0['offset']+_0x23d1e0['limit'];var _0xeb4289;if(_0x3f483e>=_0x5abf43){_0x3f483e=_0x5abf43;_0xeb4289=0xc8;}else{_0xeb4289=0xce;}_0xd02c9a[_0xe286('0x21')](_0xeb4289);return _0xd02c9a[_0xe286('0x22')]('Content-Range',_0x582d39+'-'+_0x3f483e+'/'+_0x5abf43)[_0xe286('0x1c')](_0x4afd13);}return null;};}function patchUpdates(_0xd318ad){return function(_0x58cd92){try{jsonpatch[_0xe286('0x23')](_0x58cd92,_0xd318ad,!![]);}catch(_0x31ff9c){return BPromise[_0xe286('0x24')](_0x31ff9c);}return _0x58cd92[_0xe286('0x25')]();};}function saveUpdates(_0x202157,_0x3b285f){return function(_0x506163){if(_0x506163){return _0x506163[_0xe286('0x26')](_0x202157)[_0xe286('0x27')](function(_0x2e2cfa){return _0x2e2cfa;});}return null;};}function removeEntity(_0x176479,_0x117185){return function(_0x1c6721){if(_0x1c6721){return _0x1c6721[_0xe286('0x28')]()[_0xe286('0x27')](function(){_0x176479[_0xe286('0x21')](0xcc)[_0xe286('0x1b')]();});}};}function handleEntityNotFound(_0x93c89,_0x391ee7){return function(_0x5c00de){if(!_0x5c00de){_0x93c89[_0xe286('0x1a')](0x194);}return _0x5c00de;};}function handleError(_0x5dfb29,_0x27f6ce){_0x27f6ce=_0x27f6ce||0x1f4;return function(_0x47fa50){logger[_0xe286('0x29')](_0x47fa50[_0xe286('0x2a')]);if(_0x47fa50[_0xe286('0x2b')]){delete _0x47fa50[_0xe286('0x2b')];}_0x5dfb29['status'](_0x27f6ce)[_0xe286('0x2c')](_0x47fa50);};}exports[_0xe286('0x2d')]=function(_0x2f6345,_0x256661){var _0x236d20={},_0x176477={},_0x4632c8={'count':0x0,'rows':[]};var _0x51ece5=_['map'](db[_0xe286('0x2e')][_0xe286('0x2f')],function(_0x2cf479){return{'name':_0x2cf479[_0xe286('0x30')],'type':_0x2cf479[_0xe286('0x31')][_0xe286('0x32')]};});_0x176477[_0xe286('0x33')]=_[_0xe286('0x34')](_0x51ece5,_0xe286('0x2b'));_0x176477[_0xe286('0x35')]=_[_0xe286('0x36')](_0x2f6345[_0xe286('0x35')]);_0x176477[_0xe286('0x37')]=_[_0xe286('0x38')](_0x176477[_0xe286('0x33')],_0x176477[_0xe286('0x35')]);_0x236d20[_0xe286('0x39')]=_['intersection'](_0x176477['model'],qs[_0xe286('0x3a')](_0x2f6345[_0xe286('0x35')]['fields']));_0x236d20[_0xe286('0x39')]=_0x236d20[_0xe286('0x39')][_0xe286('0x3b')]?_0x236d20[_0xe286('0x39')]:_0x176477[_0xe286('0x33')];if(!_0x2f6345[_0xe286('0x35')][_0xe286('0x3c')](_0xe286('0x3d'))){_0x236d20[_0xe286('0x1f')]=qs[_0xe286('0x1f')](_0x2f6345[_0xe286('0x35')][_0xe286('0x1f')]);_0x236d20[_0xe286('0x1d')]=qs[_0xe286('0x1d')](_0x2f6345['query'][_0xe286('0x1d')]);}_0x236d20['order']=qs['sort'](_0x2f6345[_0xe286('0x35')][_0xe286('0x3e')]);_0x236d20[_0xe286('0x3f')]=qs['filters'](_[_0xe286('0x40')](_0x2f6345['query'],_0x176477['filters']),_0x51ece5);if(_0x2f6345['query']['filter']){_0x236d20[_0xe286('0x3f')]=_['merge'](_0x236d20[_0xe286('0x3f')],{'$or':_[_0xe286('0x34')](_0x51ece5,function(_0x413138){if(_0x413138[_0xe286('0x31')]!=='VIRTUAL'){var _0xf8e032={};_0xf8e032[_0x413138['name']]={'$like':'%'+_0x2f6345['query'][_0xe286('0x41')]+'%'};return _0xf8e032;}})});}_0x236d20=_[_0xe286('0x42')]({},_0x236d20,_0x2f6345[_0xe286('0x43')]);var _0x546837={'where':_0x236d20[_0xe286('0x3f')]};return db['CmHopperBlack'][_0xe286('0x20')](_0x546837)[_0xe286('0x27')](function(_0x1eb0b3){_0x4632c8[_0xe286('0x20')]=_0x1eb0b3;if(_0x2f6345[_0xe286('0x35')]['includeAll']){_0x236d20[_0xe286('0x44')]=[{'all':!![]}];}return db[_0xe286('0x2e')][_0xe286('0x45')](_0x236d20);})[_0xe286('0x27')](function(_0x40e17b){_0x4632c8[_0xe286('0x46')]=_0x40e17b;return _0x4632c8;})[_0xe286('0x27')](respondWithFilteredResult(_0x256661,_0x236d20))[_0xe286('0x47')](handleError(_0x256661,null));};exports[_0xe286('0x48')]=function(_0x1d3ec4,_0x1f6564){var _0x15c927={'raw':!![],'where':{'id':_0x1d3ec4['params']['id']}},_0x105b59={};_0x105b59[_0xe286('0x33')]=_['keys'](db[_0xe286('0x2e')]['rawAttributes']);_0x105b59['query']=_['keys'](_0x1d3ec4[_0xe286('0x35')]);_0x105b59[_0xe286('0x37')]=_['intersection'](_0x105b59[_0xe286('0x33')],_0x105b59[_0xe286('0x35')]);_0x15c927[_0xe286('0x39')]=_[_0xe286('0x38')](_0x105b59['model'],qs[_0xe286('0x3a')](_0x1d3ec4[_0xe286('0x35')][_0xe286('0x3a')]));_0x15c927['attributes']=_0x15c927[_0xe286('0x39')][_0xe286('0x3b')]?_0x15c927[_0xe286('0x39')]:_0x105b59[_0xe286('0x33')];if(_0x1d3ec4[_0xe286('0x35')][_0xe286('0x49')]){_0x15c927[_0xe286('0x44')]=[{'all':!![]}];}_0x15c927=_[_0xe286('0x42')]({},_0x15c927,_0x1d3ec4[_0xe286('0x43')]);return db[_0xe286('0x2e')]['find'](_0x15c927)[_0xe286('0x27')](handleEntityNotFound(_0x1f6564,null))[_0xe286('0x27')](respondWithResult(_0x1f6564,null))[_0xe286('0x47')](handleError(_0x1f6564,null));};exports[_0xe286('0x26')]=function(_0x14b362,_0x7c014d){if(_0x14b362['body']['id']){delete _0x14b362[_0xe286('0x4a')]['id'];}return db[_0xe286('0x2e')]['find']({'where':{'id':_0x14b362['params']['id']}})[_0xe286('0x27')](handleEntityNotFound(_0x7c014d,null))['then'](saveUpdates(_0x14b362[_0xe286('0x4a')],null))[_0xe286('0x27')](respondWithResult(_0x7c014d,null))[_0xe286('0x47')](handleError(_0x7c014d,null));};exports[_0xe286('0x28')]=function(_0x217d9d,_0x34035d){return db[_0xe286('0x2e')][_0xe286('0x4b')]({'where':{'id':_0x217d9d[_0xe286('0x4c')]['id']}})[_0xe286('0x27')](handleEntityNotFound(_0x34035d,null))['then'](removeEntity(_0x34035d,null))[_0xe286('0x47')](handleError(_0x34035d,null));};exports[_0xe286('0x4d')]=function(_0x46783f,_0x46dadd){return db[_0xe286('0x2e')][_0xe286('0x4d')]()[_0xe286('0x27')](respondWithResult(_0x46dadd,null))[_0xe286('0x47')](handleError(_0x46dadd,null));}; \ No newline at end of file +var _0xb4c1=['sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','params','length','include','find','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x390abd,_0x55c783){var _0x3ec0cc=function(_0x28a4f7){while(--_0x28a4f7){_0x390abd['push'](_0x390abd['shift']());}};_0x3ec0cc(++_0x55c783);}(_0xb4c1,0x1c6));var _0x1b4c=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xb4c1[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b4c('0x0'));var zipdir=require(_0x1b4c('0x1'));var jsonpatch=require(_0x1b4c('0x2'));var rp=require(_0x1b4c('0x3'));var moment=require(_0x1b4c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1b4c('0x5'));var util=require(_0x1b4c('0x6'));var path=require(_0x1b4c('0x7'));var sox=require(_0x1b4c('0x8'));var csv=require(_0x1b4c('0x9'));var ejs=require(_0x1b4c('0xa'));var fs=require('fs');var fs_extra=require(_0x1b4c('0xb'));var _=require('lodash');var squel=require(_0x1b4c('0xc'));var crypto=require(_0x1b4c('0xd'));var jsforce=require(_0x1b4c('0xe'));var deskjs=require(_0x1b4c('0xf'));var toCsv=require(_0x1b4c('0x9'));var querystring=require(_0x1b4c('0x10'));var Papa=require(_0x1b4c('0x11'));var Redis=require(_0x1b4c('0x12'));var authService=require(_0x1b4c('0x13'));var qs=require(_0x1b4c('0x14'));var as=require(_0x1b4c('0x15'));var hardwareService=require(_0x1b4c('0x16'));var logger=require(_0x1b4c('0x17'))(_0x1b4c('0x18'));var utils=require(_0x1b4c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1b4c('0x1a'));var db=require(_0x1b4c('0x1b'))['db'];function respondWithStatusCode(_0x1570a6,_0x22c706){_0x22c706=_0x22c706||0xcc;return function(_0x457455){if(_0x457455){return _0x1570a6[_0x1b4c('0x1c')](_0x22c706);}return _0x1570a6[_0x1b4c('0x1d')](_0x22c706)[_0x1b4c('0x1e')]();};}function respondWithResult(_0x2f96f7,_0x42d555){_0x42d555=_0x42d555||0xc8;return function(_0x5e6e2b){if(_0x5e6e2b){return _0x2f96f7['status'](_0x42d555)[_0x1b4c('0x1f')](_0x5e6e2b);}};}function respondWithFilteredResult(_0x2f2e64,_0x1eb03c){return function(_0x328c60){if(_0x328c60){var _0x140b2b=typeof _0x1eb03c[_0x1b4c('0x20')]==='undefined'&&typeof _0x1eb03c[_0x1b4c('0x21')]===_0x1b4c('0x22');var _0x3348f7=_0x328c60[_0x1b4c('0x23')];var _0x2d278a=_0x140b2b?0x0:_0x1eb03c[_0x1b4c('0x20')];var _0x42b461=_0x140b2b?_0x328c60[_0x1b4c('0x23')]:_0x1eb03c[_0x1b4c('0x20')]+_0x1eb03c[_0x1b4c('0x21')];var _0x5baae0;if(_0x42b461>=_0x3348f7){_0x42b461=_0x3348f7;_0x5baae0=0xc8;}else{_0x5baae0=0xce;}_0x2f2e64[_0x1b4c('0x1d')](_0x5baae0);return _0x2f2e64[_0x1b4c('0x24')](_0x1b4c('0x25'),_0x2d278a+'-'+_0x42b461+'/'+_0x3348f7)['json'](_0x328c60);}return null;};}function patchUpdates(_0x2a4dec){return function(_0x121e3c){try{jsonpatch['apply'](_0x121e3c,_0x2a4dec,!![]);}catch(_0x13e706){return BPromise[_0x1b4c('0x26')](_0x13e706);}return _0x121e3c[_0x1b4c('0x27')]();};}function saveUpdates(_0x540163,_0xb865a){return function(_0x3b2c2a){if(_0x3b2c2a){return _0x3b2c2a[_0x1b4c('0x28')](_0x540163)[_0x1b4c('0x29')](function(_0x242a9f){return _0x242a9f;});}return null;};}function removeEntity(_0x504895,_0x177b13){return function(_0x3294e5){if(_0x3294e5){return _0x3294e5[_0x1b4c('0x2a')]()['then'](function(){_0x504895[_0x1b4c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x554f37,_0x581e22){return function(_0x375f67){if(!_0x375f67){_0x554f37['sendStatus'](0x194);}return _0x375f67;};}function handleError(_0x3ada53,_0x28e2e8){_0x28e2e8=_0x28e2e8||0x1f4;return function(_0x5c5b7a){logger['error'](_0x5c5b7a['stack']);if(_0x5c5b7a[_0x1b4c('0x2b')]){delete _0x5c5b7a[_0x1b4c('0x2b')];}_0x3ada53[_0x1b4c('0x1d')](_0x28e2e8)[_0x1b4c('0x2c')](_0x5c5b7a);};}exports[_0x1b4c('0x2d')]=function(_0x55b869,_0x1c28ed){var _0x501f83={},_0x4a0be2={},_0x50b0d5={'count':0x0,'rows':[]};var _0x20a34c=_[_0x1b4c('0x2e')](db[_0x1b4c('0x2f')][_0x1b4c('0x30')],function(_0x2932c4){return{'name':_0x2932c4[_0x1b4c('0x31')],'type':_0x2932c4[_0x1b4c('0x32')][_0x1b4c('0x33')]};});_0x4a0be2['model']=_[_0x1b4c('0x2e')](_0x20a34c,_0x1b4c('0x2b'));_0x4a0be2[_0x1b4c('0x34')]=_[_0x1b4c('0x35')](_0x55b869[_0x1b4c('0x34')]);_0x4a0be2[_0x1b4c('0x36')]=_[_0x1b4c('0x37')](_0x4a0be2[_0x1b4c('0x38')],_0x4a0be2[_0x1b4c('0x34')]);_0x501f83[_0x1b4c('0x39')]=_[_0x1b4c('0x37')](_0x4a0be2[_0x1b4c('0x38')],qs['fields'](_0x55b869['query'][_0x1b4c('0x3a')]));_0x501f83['attributes']=_0x501f83[_0x1b4c('0x39')]['length']?_0x501f83[_0x1b4c('0x39')]:_0x4a0be2['model'];if(!_0x55b869[_0x1b4c('0x34')]['hasOwnProperty']('nolimit')){_0x501f83['limit']=qs[_0x1b4c('0x21')](_0x55b869['query'][_0x1b4c('0x21')]);_0x501f83[_0x1b4c('0x20')]=qs[_0x1b4c('0x20')](_0x55b869[_0x1b4c('0x34')][_0x1b4c('0x20')]);}_0x501f83[_0x1b4c('0x3b')]=qs[_0x1b4c('0x3c')](_0x55b869['query'][_0x1b4c('0x3c')]);_0x501f83[_0x1b4c('0x3d')]=qs[_0x1b4c('0x36')](_[_0x1b4c('0x3e')](_0x55b869['query'],_0x4a0be2[_0x1b4c('0x36')]),_0x20a34c);if(_0x55b869[_0x1b4c('0x34')][_0x1b4c('0x3f')]){_0x501f83[_0x1b4c('0x3d')]=_['merge'](_0x501f83[_0x1b4c('0x3d')],{'$or':_[_0x1b4c('0x2e')](_0x20a34c,function(_0x331b2c){if(_0x331b2c[_0x1b4c('0x32')]!==_0x1b4c('0x40')){var _0x4c7e52={};_0x4c7e52[_0x331b2c[_0x1b4c('0x2b')]]={'$like':'%'+_0x55b869[_0x1b4c('0x34')]['filter']+'%'};return _0x4c7e52;}})});}_0x501f83=_[_0x1b4c('0x41')]({},_0x501f83,_0x55b869[_0x1b4c('0x42')]);var _0x3e7357={'where':_0x501f83['where']};return db['CmHopperBlack'][_0x1b4c('0x23')](_0x3e7357)[_0x1b4c('0x29')](function(_0x4350be){_0x50b0d5[_0x1b4c('0x23')]=_0x4350be;if(_0x55b869[_0x1b4c('0x34')][_0x1b4c('0x43')]){_0x501f83['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x1b4c('0x44')](_0x501f83);})[_0x1b4c('0x29')](function(_0x4b6781){_0x50b0d5[_0x1b4c('0x45')]=_0x4b6781;return _0x50b0d5;})[_0x1b4c('0x29')](respondWithFilteredResult(_0x1c28ed,_0x501f83))['catch'](handleError(_0x1c28ed,null));};exports['show']=function(_0xb1e6f7,_0x42e4d9){var _0xcfabc9={'raw':!![],'where':{'id':_0xb1e6f7[_0x1b4c('0x46')]['id']}},_0x339f45={};_0x339f45[_0x1b4c('0x38')]=_['keys'](db[_0x1b4c('0x2f')]['rawAttributes']);_0x339f45[_0x1b4c('0x34')]=_[_0x1b4c('0x35')](_0xb1e6f7[_0x1b4c('0x34')]);_0x339f45['filters']=_[_0x1b4c('0x37')](_0x339f45[_0x1b4c('0x38')],_0x339f45[_0x1b4c('0x34')]);_0xcfabc9[_0x1b4c('0x39')]=_[_0x1b4c('0x37')](_0x339f45['model'],qs[_0x1b4c('0x3a')](_0xb1e6f7[_0x1b4c('0x34')][_0x1b4c('0x3a')]));_0xcfabc9['attributes']=_0xcfabc9[_0x1b4c('0x39')][_0x1b4c('0x47')]?_0xcfabc9[_0x1b4c('0x39')]:_0x339f45[_0x1b4c('0x38')];if(_0xb1e6f7[_0x1b4c('0x34')][_0x1b4c('0x43')]){_0xcfabc9[_0x1b4c('0x48')]=[{'all':!![]}];}_0xcfabc9=_[_0x1b4c('0x41')]({},_0xcfabc9,_0xb1e6f7[_0x1b4c('0x42')]);return db[_0x1b4c('0x2f')][_0x1b4c('0x49')](_0xcfabc9)['then'](handleEntityNotFound(_0x42e4d9,null))[_0x1b4c('0x29')](respondWithResult(_0x42e4d9,null))['catch'](handleError(_0x42e4d9,null));};exports['update']=function(_0x5dcfdd,_0x4168c6){if(_0x5dcfdd[_0x1b4c('0x4a')]['id']){delete _0x5dcfdd[_0x1b4c('0x4a')]['id'];}return db[_0x1b4c('0x2f')][_0x1b4c('0x49')]({'where':{'id':_0x5dcfdd['params']['id']}})[_0x1b4c('0x29')](handleEntityNotFound(_0x4168c6,null))['then'](saveUpdates(_0x5dcfdd[_0x1b4c('0x4a')],null))[_0x1b4c('0x29')](respondWithResult(_0x4168c6,null))[_0x1b4c('0x4b')](handleError(_0x4168c6,null));};exports[_0x1b4c('0x2a')]=function(_0x2140f3,_0x3622af){return db[_0x1b4c('0x2f')][_0x1b4c('0x49')]({'where':{'id':_0x2140f3[_0x1b4c('0x46')]['id']}})[_0x1b4c('0x29')](handleEntityNotFound(_0x3622af,null))[_0x1b4c('0x29')](removeEntity(_0x3622af,null))[_0x1b4c('0x4b')](handleError(_0x3622af,null));};exports[_0x1b4c('0x4c')]=function(_0x23b8c9,_0x33f084){return db['CmHopperBlack']['describe']()[_0x1b4c('0x29')](respondWithResult(_0x33f084,null))[_0x1b4c('0x4b')](handleError(_0x33f084,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index f15977f..2cc33b3 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 _0x631a=['./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x4df6b2,_0x3d1b36){var _0x12ddb5=function(_0x1b1fab){while(--_0x1b1fab){_0x4df6b2['push'](_0x4df6b2['shift']());}};_0x12ddb5(++_0x3d1b36);}(_0x631a,0xcb));var _0xa631=function(_0x263347,_0x1b79fe){_0x263347=_0x263347-0x0;var _0x2af480=_0x631a[_0x263347];return _0x2af480;};'use strict';var _=require(_0xa631('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa631('0x1'));var moment=require(_0xa631('0x2'));var BPromise=require('bluebird');var rp=require(_0xa631('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa631('0x4'));var config=require(_0xa631('0x5'));var attributes=require(_0xa631('0x6'));module[_0xa631('0x7')]=function(_0x39470c,_0x3c136f){return _0x39470c[_0xa631('0x8')](_0xa631('0x9'),attributes,{'tableName':_0xa631('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69f0=['exports','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','bluebird','request-promise','rimraf','./cmHopperBlack.attributes'];(function(_0x5724e6,_0xa6ee67){var _0x4ccb15=function(_0x48a8c2){while(--_0x48a8c2){_0x5724e6['push'](_0x5724e6['shift']());}};_0x4ccb15(++_0xa6ee67);}(_0x69f0,0x125));var _0x069f=function(_0x31c479,_0x4c2820){_0x31c479=_0x31c479-0x0;var _0x3d5652=_0x69f0[_0x31c479];return _0x3d5652;};'use strict';var _=require(_0x069f('0x0'));var util=require('util');var logger=require(_0x069f('0x1'))(_0x069f('0x2'));var moment=require('moment');var BPromise=require(_0x069f('0x3'));var rp=require(_0x069f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x069f('0x5'));var config=require('../../config/environment');var attributes=require(_0x069f('0x6'));module[_0x069f('0x7')]=function(_0x4a33e9,_0x43f97a){return _0x4a33e9['define'](_0x069f('0x8'),attributes,{'tableName':_0x069f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 11f0ee2..587aa1e 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 _0xffc1=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','body','stringify','DestroyCmHopperBlack','lodash','util','moment','bluebird'];(function(_0x1dee40,_0x1d8afc){var _0x438773=function(_0x5cf9a4){while(--_0x5cf9a4){_0x1dee40['push'](_0x1dee40['shift']());}};_0x438773(++_0x1d8afc);}(_0xffc1,0x149));var _0x1ffc=function(_0x9b6d95,_0x383584){_0x9b6d95=_0x9b6d95-0x0;var _0x15c2c7=_0xffc1[_0x9b6d95];return _0x15c2c7;};'use strict';var _=require(_0x1ffc('0x0'));var util=require(_0x1ffc('0x1'));var moment=require(_0x1ffc('0x2'));var BPromise=require(_0x1ffc('0x3'));var rs=require(_0x1ffc('0x4'));var fs=require('fs');var Redis=require(_0x1ffc('0x5'));var db=require(_0x1ffc('0x6'))['db'];var utils=require(_0x1ffc('0x7'));var logger=require(_0x1ffc('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1ffc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x153079,_0x150917,_0x254f73){return new BPromise(function(_0x45475b,_0x4f39ff){return client[_0x1ffc('0xa')](_0x153079,_0x254f73)[_0x1ffc('0xb')](function(_0x2817d8){logger[_0x1ffc('0xc')](_0x1ffc('0xd'),_0x150917,'request\x20sent');logger[_0x1ffc('0xe')](_0x1ffc('0xf'),_0x150917,_0x1ffc('0x10'),JSON['stringify'](_0x2817d8));if(_0x2817d8[_0x1ffc('0x11')]){if(_0x2817d8[_0x1ffc('0x11')]['code']===0x1f4){logger[_0x1ffc('0x11')](_0x1ffc('0xd'),_0x150917,_0x2817d8[_0x1ffc('0x11')][_0x1ffc('0x12')]);return _0x4f39ff(_0x2817d8[_0x1ffc('0x11')][_0x1ffc('0x12')]);}logger[_0x1ffc('0x11')](_0x1ffc('0xd'),_0x150917,_0x2817d8['error'][_0x1ffc('0x12')]);return _0x45475b(_0x2817d8['error'][_0x1ffc('0x12')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x150917,_0x1ffc('0x10'));_0x45475b(_0x2817d8[_0x1ffc('0x13')][_0x1ffc('0x12')]);}})[_0x1ffc('0x14')](function(_0x2a71f5){logger[_0x1ffc('0x11')](_0x1ffc('0xd'),_0x150917,_0x2a71f5);_0x4f39ff(_0x2a71f5);});});}exports[_0x1ffc('0x15')]=function(_0x4ec115){var _0x596f16=this;return new Promise(function(_0x4a12ae,_0x123042){return db[_0x1ffc('0x16')][_0x1ffc('0x17')]({'raw':_0x4ec115[_0x1ffc('0x18')]?_0x4ec115[_0x1ffc('0x18')][_0x1ffc('0x19')]===undefined?!![]:![]:!![],'where':_0x4ec115[_0x1ffc('0x18')]?_0x4ec115['options'][_0x1ffc('0x1a')]||null:null,'attributes':_0x4ec115[_0x1ffc('0x18')]?_0x4ec115[_0x1ffc('0x18')][_0x1ffc('0x1b')]||null:null,'limit':_0x4ec115[_0x1ffc('0x18')]?_0x4ec115[_0x1ffc('0x18')][_0x1ffc('0x1c')]||null:null,'include':_0x4ec115[_0x1ffc('0x18')]?_0x4ec115[_0x1ffc('0x18')][_0x1ffc('0x1d')]?_[_0x1ffc('0x1e')](_0x4ec115[_0x1ffc('0x18')]['include'],function(_0x3a829a){return{'model':db[_0x3a829a[_0x1ffc('0x1f')]],'as':_0x3a829a['as'],'attributes':_0x3a829a[_0x1ffc('0x1b')],'include':_0x3a829a[_0x1ffc('0x1d')]?_['map'](_0x3a829a[_0x1ffc('0x1d')],function(_0x3004dc){return{'model':db[_0x3004dc['model']],'as':_0x3004dc['as'],'attributes':_0x3004dc[_0x1ffc('0x1b')],'include':_0x3004dc[_0x1ffc('0x1d')]?_['map'](_0x3004dc[_0x1ffc('0x1d')],function(_0x36e8dc){return{'model':db[_0x36e8dc['model']],'as':_0x36e8dc['as'],'attributes':_0x36e8dc[_0x1ffc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1ffc('0xb')](function(_0x19adfb){logger[_0x1ffc('0xc')](_0x1ffc('0x15'),_0x4ec115);logger[_0x1ffc('0xe')](_0x1ffc('0x15'),_0x4ec115,JSON['stringify'](_0x19adfb));_0x4a12ae(_0x19adfb);})['catch'](function(_0x1c387d){logger[_0x1ffc('0x11')](_0x1ffc('0x15'),_0x1c387d['message'],_0x4ec115);_0x123042(_0x596f16[_0x1ffc('0x11')](0x1f4,_0x1c387d[_0x1ffc('0x12')]));});});};exports[_0x1ffc('0x20')]=function(_0x268dac){var _0xfb3e93=this;return new Promise(function(_0x59d5be,_0x1b3007){return db[_0x1ffc('0x16')][_0x1ffc('0x21')](_0x268dac[_0x1ffc('0x22')],{'raw':_0x268dac[_0x1ffc('0x18')]?_0x268dac[_0x1ffc('0x18')][_0x1ffc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x268dac[_0x1ffc('0x18')]?_0x268dac[_0x1ffc('0x18')]['where']||null:null,'attributes':_0x268dac[_0x1ffc('0x18')]?_0x268dac['options'][_0x1ffc('0x1b')]||null:null,'limit':_0x268dac[_0x1ffc('0x18')]?_0x268dac[_0x1ffc('0x18')][_0x1ffc('0x1c')]||null:null})[_0x1ffc('0xb')](function(_0x323cc1){logger[_0x1ffc('0xc')](_0x1ffc('0x20'),_0x268dac);logger[_0x1ffc('0xe')](_0x1ffc('0x20'),_0x268dac,JSON[_0x1ffc('0x23')](_0x323cc1));_0x59d5be(_0x323cc1);})['catch'](function(_0x281980){logger[_0x1ffc('0x11')]('UpdateCmHopperBlack',_0x281980[_0x1ffc('0x12')],_0x268dac);_0x1b3007(_0xfb3e93[_0x1ffc('0x11')](0x1f4,_0x281980[_0x1ffc('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x2e7c8f){var _0x12d388=this;return new Promise(function(_0x75f73f,_0x380b9f){return db['CmHopperBlack']['destroy']({'where':_0x2e7c8f[_0x1ffc('0x18')]?_0x2e7c8f[_0x1ffc('0x18')][_0x1ffc('0x1a')]||null:null})[_0x1ffc('0xb')](function(_0x2f1205){logger[_0x1ffc('0xc')](_0x1ffc('0x24'),_0x2e7c8f);logger[_0x1ffc('0xe')]('DestroyCmHopperBlack',_0x2e7c8f,JSON[_0x1ffc('0x23')](_0x2f1205));_0x75f73f(_0x2f1205);})[_0x1ffc('0x14')](function(_0x232b2d){logger['error'](_0x1ffc('0x24'),_0x232b2d[_0x1ffc('0x12')],_0x2e7c8f);_0x380b9f(_0x12d388[_0x1ffc('0x11')](0x1f4,_0x232b2d[_0x1ffc('0x12')]));});});}; \ No newline at end of file +var _0x71dc=['options','where','limit','include','map','model','attributes','GetCmHopperBlack','update','body','raw','DestroyCmHopperBlack','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmHopperBlack,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','CmHopperBlack','findAll'];(function(_0x3e7edd,_0x43953a){var _0x20f450=function(_0x1dcb7a){while(--_0x1dcb7a){_0x3e7edd['push'](_0x3e7edd['shift']());}};_0x20f450(++_0x43953a);}(_0x71dc,0xea));var _0xc71d=function(_0x271a22,_0xef764b){_0x271a22=_0x271a22-0x0;var _0x26431b=_0x71dc[_0x271a22];return _0x26431b;};'use strict';var _=require('lodash');var util=require(_0xc71d('0x0'));var moment=require(_0xc71d('0x1'));var BPromise=require(_0xc71d('0x2'));var rs=require(_0xc71d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc71d('0x4'))['db'];var utils=require(_0xc71d('0x5'));var logger=require(_0xc71d('0x6'))(_0xc71d('0x7'));var config=require(_0xc71d('0x8'));var jayson=require(_0xc71d('0x9'));var client=jayson[_0xc71d('0xa')][_0xc71d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2aca3f,_0x4721f7,_0x365ff8){return new BPromise(function(_0x1cd42b,_0x360c38){return client['request'](_0x2aca3f,_0x365ff8)[_0xc71d('0xc')](function(_0x47ad24){logger['info'](_0xc71d('0xd'),_0x4721f7,'request\x20sent');logger[_0xc71d('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x4721f7,_0xc71d('0xf'),JSON[_0xc71d('0x10')](_0x47ad24));if(_0x47ad24[_0xc71d('0x11')]){if(_0x47ad24[_0xc71d('0x11')][_0xc71d('0x12')]===0x1f4){logger[_0xc71d('0x11')](_0xc71d('0xd'),_0x4721f7,_0x47ad24[_0xc71d('0x11')][_0xc71d('0x13')]);return _0x360c38(_0x47ad24[_0xc71d('0x11')][_0xc71d('0x13')]);}logger[_0xc71d('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x4721f7,_0x47ad24[_0xc71d('0x11')][_0xc71d('0x13')]);return _0x1cd42b(_0x47ad24[_0xc71d('0x11')][_0xc71d('0x13')]);}else{logger[_0xc71d('0x14')](_0xc71d('0xd'),_0x4721f7,_0xc71d('0xf'));_0x1cd42b(_0x47ad24[_0xc71d('0x15')][_0xc71d('0x13')]);}})[_0xc71d('0x16')](function(_0x415829){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x4721f7,_0x415829);_0x360c38(_0x415829);});});}exports['GetCmHopperBlack']=function(_0x66b9c1){var _0x1a0643=this;return new Promise(function(_0x21ab7a,_0x5722c2){return db[_0xc71d('0x17')][_0xc71d('0x18')]({'raw':_0x66b9c1['options']?_0x66b9c1[_0xc71d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x66b9c1['options']?_0x66b9c1[_0xc71d('0x19')][_0xc71d('0x1a')]||null:null,'attributes':_0x66b9c1[_0xc71d('0x19')]?_0x66b9c1['options']['attributes']||null:null,'limit':_0x66b9c1['options']?_0x66b9c1[_0xc71d('0x19')][_0xc71d('0x1b')]||null:null,'include':_0x66b9c1[_0xc71d('0x19')]?_0x66b9c1[_0xc71d('0x19')][_0xc71d('0x1c')]?_[_0xc71d('0x1d')](_0x66b9c1['options'][_0xc71d('0x1c')],function(_0x65de42){return{'model':db[_0x65de42[_0xc71d('0x1e')]],'as':_0x65de42['as'],'attributes':_0x65de42[_0xc71d('0x1f')],'include':_0x65de42[_0xc71d('0x1c')]?_['map'](_0x65de42[_0xc71d('0x1c')],function(_0x55c89c){return{'model':db[_0x55c89c[_0xc71d('0x1e')]],'as':_0x55c89c['as'],'attributes':_0x55c89c[_0xc71d('0x1f')],'include':_0x55c89c['include']?_[_0xc71d('0x1d')](_0x55c89c[_0xc71d('0x1c')],function(_0xda76e){return{'model':db[_0xda76e['model']],'as':_0xda76e['as'],'attributes':_0xda76e['attributes']};}):[]};}):[]};}):[]:[]})[_0xc71d('0xc')](function(_0x43c1f7){logger[_0xc71d('0x14')](_0xc71d('0x20'),_0x66b9c1);logger[_0xc71d('0xe')](_0xc71d('0x20'),_0x66b9c1,JSON[_0xc71d('0x10')](_0x43c1f7));_0x21ab7a(_0x43c1f7);})[_0xc71d('0x16')](function(_0x1de7ff){logger[_0xc71d('0x11')](_0xc71d('0x20'),_0x1de7ff['message'],_0x66b9c1);_0x5722c2(_0x1a0643[_0xc71d('0x11')](0x1f4,_0x1de7ff[_0xc71d('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x3f46c8){var _0x510737=this;return new Promise(function(_0x2a2242,_0x2288f8){return db['CmHopperBlack'][_0xc71d('0x21')](_0x3f46c8[_0xc71d('0x22')],{'raw':_0x3f46c8['options']?_0x3f46c8[_0xc71d('0x19')][_0xc71d('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f46c8[_0xc71d('0x19')]?_0x3f46c8[_0xc71d('0x19')][_0xc71d('0x1a')]||null:null,'attributes':_0x3f46c8[_0xc71d('0x19')]?_0x3f46c8['options']['attributes']||null:null,'limit':_0x3f46c8[_0xc71d('0x19')]?_0x3f46c8['options'][_0xc71d('0x1b')]||null:null})[_0xc71d('0xc')](function(_0x240cb8){logger[_0xc71d('0x14')]('UpdateCmHopperBlack',_0x3f46c8);logger[_0xc71d('0xe')]('UpdateCmHopperBlack',_0x3f46c8,JSON[_0xc71d('0x10')](_0x240cb8));_0x2a2242(_0x240cb8);})[_0xc71d('0x16')](function(_0x40b8cf){logger[_0xc71d('0x11')]('UpdateCmHopperBlack',_0x40b8cf[_0xc71d('0x13')],_0x3f46c8);_0x2288f8(_0x510737[_0xc71d('0x11')](0x1f4,_0x40b8cf[_0xc71d('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x2e67a5){var _0xd2eb6f=this;return new Promise(function(_0x3fcb5f,_0x518707){return db[_0xc71d('0x17')]['destroy']({'where':_0x2e67a5['options']?_0x2e67a5[_0xc71d('0x19')][_0xc71d('0x1a')]||null:null})[_0xc71d('0xc')](function(_0x1e69f4){logger[_0xc71d('0x14')]('DestroyCmHopperBlack',_0x2e67a5);logger[_0xc71d('0xe')](_0xc71d('0x24'),_0x2e67a5,JSON[_0xc71d('0x10')](_0x1e69f4));_0x3fcb5f(_0x1e69f4);})[_0xc71d('0x16')](function(_0x7eb4b3){logger[_0xc71d('0x11')](_0xc71d('0x24'),_0x7eb4b3[_0xc71d('0x13')],_0x2e67a5);_0x518707(_0xd2eb6f[_0xc71d('0x11')](0x1f4,_0x7eb4b3[_0xc71d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index f20061e..4ec2ba8 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 _0x8f9d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','/:id','show','update','delete','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8f9d,0x93));var _0xd8f9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8f9d[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xd8f9('0x0'));var util=require('util');var path=require(_0xd8f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8f9('0x2'));var router=express[_0xd8f9('0x3')]();var fs_extra=require(_0xd8f9('0x4'));var auth=require(_0xd8f9('0x5'));var interaction=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var controller=require(_0xd8f9('0x8'));router['get']('/',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xa')]);router[_0xd8f9('0xb')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller['describe']);router[_0xd8f9('0xb')](_0xd8f9('0xd'),auth['isAuthenticated'](),controller[_0xd8f9('0xe')]);router['put']('/:id',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xf')]);router[_0xd8f9('0x10')](_0xd8f9('0xd'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x11')]);module[_0xd8f9('0x12')]=router; \ No newline at end of file +var _0xb016=['multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','put','/:id','destroy'];(function(_0x8ae2cc,_0x29d665){var _0x73bf94=function(_0x2d571d){while(--_0x2d571d){_0x8ae2cc['push'](_0x8ae2cc['shift']());}};_0x73bf94(++_0x29d665);}(_0xb016,0x159));var _0x6b01=function(_0x5d7357,_0x29f677){_0x5d7357=_0x5d7357-0x0;var _0xa26a93=_0xb016[_0x5d7357];return _0xa26a93;};'use strict';var multer=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b01('0x2'));var router=express['Router']();var fs_extra=require(_0x6b01('0x3'));var auth=require(_0x6b01('0x4'));var interaction=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var controller=require('./cmHopperBlack.controller');router[_0x6b01('0x7')]('/',auth[_0x6b01('0x8')](),controller[_0x6b01('0x9')]);router['get']('/describe',auth[_0x6b01('0x8')](),controller[_0x6b01('0xa')]);router['get']('/:id',auth[_0x6b01('0x8')](),controller[_0x6b01('0xb')]);router[_0x6b01('0xc')](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller['update']);router['delete'](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller[_0x6b01('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index b1ca357..9b15e57 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 _0xe690=['STRING','DATE','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xe690,0x74));var _0x0e69=function(_0x58d7f5,_0x52c869){_0x58d7f5=_0x58d7f5-0x0;var _0x2cb9b4=_0xe690[_0x58d7f5];return _0x2cb9b4;};'use strict';var Sequelize=require(_0x0e69('0x0'));var moment=require(_0x0e69('0x1'));module[_0x0e69('0x2')]={'state':{'type':Sequelize[_0x0e69('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x0e69('0x4')]},'scheduledat':{'type':Sequelize[_0x0e69('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0e69('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0e69('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0e69('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x0e69('0x4')]},'originatecalleridname':{'type':Sequelize[_0x0e69('0x4')]},'calleridnum':{'type':Sequelize[_0x0e69('0x4')]},'calleridname':{'type':Sequelize[_0x0e69('0x4')]},'starttime':{'type':Sequelize[_0x0e69('0x5')]},'responsetime':{'type':Sequelize[_0x0e69('0x5')]},'answertime':{'type':Sequelize[_0x0e69('0x5')]},'droptime':{'type':Sequelize[_0x0e69('0x5')]},'endtime':{'type':Sequelize[_0x0e69('0x5')]},'ringtime':{'type':Sequelize[_0x0e69('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0e69('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0e69('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0e69('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x0e69('0x4')]},'campaigntype':{'type':Sequelize[_0x0e69('0x4')]},'membername':{'type':Sequelize[_0x0e69('0x4')]},'reason':{'type':Sequelize[_0x0e69('0x4')]},'disposition':{'type':Sequelize[_0x0e69('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x0e69('0x4')]},'dispositionat':{'type':Sequelize[_0x0e69('0x5')],'set':function(_0x167805){var _0x1f874e=this['getDataValue']('endtime');if(_0x1f874e&&_0x167805){this['setDataValue'](_0x0e69('0x6'),moment(_0x167805)[_0x0e69('0x7')](moment(_0x1f874e),_0x0e69('0x8')));}}},'amd':{'type':Sequelize[_0x0e69('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0e69('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0e69('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0e69('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0e69('0x5')]},'deleted':{'type':Sequelize[_0x0e69('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0e69('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0e69('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0e69('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0e69('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0e69('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7d33=['STRING','endtime','setDataValue','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','DATE'];(function(_0xf852,_0x4ddd76){var _0x5b2550=function(_0x4811b1){while(--_0x4811b1){_0xf852['push'](_0xf852['shift']());}};_0x5b2550(++_0x4ddd76);}(_0x7d33,0x19f));var _0x37d3=function(_0x1a300b,_0x4af88f){_0x1a300b=_0x1a300b-0x0;var _0x31008d=_0x7d33[_0x1a300b];return _0x31008d;};'use strict';var Sequelize=require(_0x37d3('0x0'));var moment=require(_0x37d3('0x1'));module[_0x37d3('0x2')]={'state':{'type':Sequelize[_0x37d3('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x37d3('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x37d3('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x37d3('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x37d3('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x37d3('0x5')]},'originatecalleridnum':{'type':Sequelize[_0x37d3('0x5')]},'originatecalleridname':{'type':Sequelize[_0x37d3('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x37d3('0x5')]},'starttime':{'type':Sequelize[_0x37d3('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x37d3('0x4')]},'droptime':{'type':Sequelize[_0x37d3('0x4')]},'endtime':{'type':Sequelize[_0x37d3('0x4')]},'ringtime':{'type':Sequelize[_0x37d3('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x37d3('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x37d3('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x37d3('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x37d3('0x5')]},'campaign':{'type':Sequelize[_0x37d3('0x5')]},'campaigntype':{'type':Sequelize[_0x37d3('0x5')]},'membername':{'type':Sequelize[_0x37d3('0x5')]},'reason':{'type':Sequelize[_0x37d3('0x5')]},'disposition':{'type':Sequelize[_0x37d3('0x5')]},'secondDisposition':{'type':Sequelize[_0x37d3('0x5')]},'thirdDisposition':{'type':Sequelize[_0x37d3('0x5')]},'dispositionat':{'type':Sequelize[_0x37d3('0x4')],'set':function(_0x3494ea){var _0xc5be34=this['getDataValue'](_0x37d3('0x6'));if(_0xc5be34&&_0x3494ea){this[_0x37d3('0x7')]('followuptime',moment(_0x3494ea)['diff'](moment(_0xc5be34),_0x37d3('0x8')));}}},'amd':{'type':Sequelize[_0x37d3('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x37d3('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x37d3('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x37d3('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x37d3('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x37d3('0x4')]},'deleted':{'type':Sequelize[_0x37d3('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x37d3('0x4')]},'recallme':{'type':Sequelize[_0x37d3('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x37d3('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x37d3('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x37d3('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x37d3('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 8441c5e..592a610 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 _0x5496=['set','Content-Range','apply','reject','save','update','then','error','stack','name','index','CmHopperFinal','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`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','countContactsIvrCampaignHopperFinal','dropContacts','abandonedContacts','reCallContacts','answeringMachine','into','cm_hopper','fromQuery','ListId','VoiceQueueId','createdAt','field','phone','NOW()','scheduledAt','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(calleridnum)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','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','sendStatus','end','status','json','undefined','limit','count'];(function(_0x460933,_0x478c45){var _0x12da2b=function(_0x39ec3f){while(--_0x39ec3f){_0x460933['push'](_0x460933['shift']());}};_0x12da2b(++_0x478c45);}(_0x5496,0x175));var _0x6549=function(_0x4a50f5,_0x289d36){_0x4a50f5=_0x4a50f5-0x0;var _0x22dc5d=_0x5496[_0x4a50f5];return _0x22dc5d;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':!![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['describe']()[_0x6549('0x26')](respondWithResult(_0x1712f3,null))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0x6121af,_0xa4c650){if(_0x6121af[_0x6549('0x4c')][_0x6549('0x4d')]){delete _0x6121af[_0x6549('0x4c')]['uniqueid'];}return db[_0x6549('0x2b')]['find']({'where':{'uniqueid':_0x6121af[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0xa4c650,null))[_0x6549('0x26')](saveUpdates(_0x6121af['body'],null))[_0x6549('0x26')](respondWithResult(_0xa4c650,null))[_0x6549('0x43')](handleError(_0xa4c650,null));};exports[_0x6549('0x4e')]=function(_0x5300c8,_0x19ac50,_0x17d7ce){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x5300c8[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn']('COUNT',db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x52')))),_0x6549('0x53')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x55')))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x57')))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),'dropContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5c')))),'abandonedContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5d')))),'reCallContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x5e')))),'answeringMachine']]})[_0x6549('0x26')](handleEntityNotFound(_0x19ac50,null))[_0x6549('0x26')](respondWithResult(_0x19ac50,null))[_0x6549('0x43')](handleError(_0x19ac50,null));};exports[_0x6549('0x5f')]=function(_0x2da535,_0x45eb28,_0x3b01d9){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'CampaignId':_0x2da535[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x52')))),_0x6549('0x53')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x203,\x201,\x20null'))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')]('`state`\x20=\x205,\x201,\x20null'))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),_0x6549('0x60')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5c')))),_0x6549('0x61')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5d')))),_0x6549('0x62')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x2019,\x201,\x20null'))),_0x6549('0x63')]]})['then'](handleEntityNotFound(_0x45eb28,null))[_0x6549('0x26')](respondWithResult(_0x45eb28,null))[_0x6549('0x43')](handleError(_0x45eb28,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x372b67,_0x2c00a1,_0x2e6b4b){return db['VoiceQueue'][_0x6549('0x4a')]({'where':{'id':_0x372b67[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x2c00a1,null))[_0x6549('0x26')](function(_0x15b906){var _0x34c5f9;if(_0x15b906){_0x34c5f9=squel['insert']()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone','scheduledAt','ContactId',_0x6549('0x67'),_0x6549('0x68'),_0x6549('0x69'),'updatedAt'],squel['select']()[_0x6549('0x6a')]('ANY_VALUE(calleridnum)',_0x6549('0x6b'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x6d'))[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))['field'](_0x6549('0x70'),_0x6549('0x67'))[_0x6549('0x6a')]('ANY_VALUE(VoiceQueueId)',_0x6549('0x68'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x69'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x71'))['from'](_0x6549('0x72'))['where'](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x372b67[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())['where'](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67['params']['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db[_0x6549('0x50')]['query'](_0x34c5f9);}return[];})[_0x6549('0x26')](respondWithResult(_0x2c00a1,null))[_0x6549('0x43')](handleError(_0x2c00a1,null));};exports[_0x6549('0x7e')]=function(_0x35bad6,_0x371d8a,_0xfde69e){return db[_0x6549('0x7f')][_0x6549('0x4a')]({'where':{'id':_0x35bad6[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x371d8a,null))[_0x6549('0x26')](function(_0x1da2d7){var _0x348d55;if(_0x1da2d7){_0x348d55=squel[_0x6549('0x80')]()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone',_0x6549('0x6d'),_0x6549('0x6f'),_0x6549('0x67'),_0x6549('0x81'),_0x6549('0x69'),_0x6549('0x71')],squel[_0x6549('0x79')]()['field'](_0x6549('0x82'),'phone')['field'](_0x6549('0x6c'),'scheduledAt')[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))[_0x6549('0x6a')](_0x6549('0x70'),'ListId')[_0x6549('0x6a')]('ANY_VALUE(CampaignId)',_0x6549('0x81'))[_0x6549('0x6a')](_0x6549('0x6c'),'createdAt')[_0x6549('0x6a')](_0x6549('0x6c'),'updatedAt')['from'](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x83'),_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x35bad6[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))['where']('CampaignId\x20=\x20?',_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')]('CampaignId\x20=\x20?',_0x35bad6['params']['id']['toString']())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db['sequelize'][_0x6549('0x32')](_0x348d55);}return[];})[_0x6549('0x26')](respondWithResult(_0x371d8a,null))[_0x6549('0x43')](handleError(_0x371d8a,null));};exports[_0x6549('0x84')]=function(_0x230874,_0x3be369,_0xaf1a80){return db[_0x6549('0x85')][_0x6549('0x86')]({'where':{'VoiceQueueId':_0x230874[_0x6549('0x4c')][_0x6549('0x68')],'CampaignId':_0x230874['body'][_0x6549('0x81')],'ContactId':_0x230874[_0x6549('0x4c')][_0x6549('0x6f')]}})[_0x6549('0x26')](handleEntityNotFound(_0x3be369,null))['then'](function(_0x158c92){if(_0x158c92){return _0x158c92;}return null;})[_0x6549('0x26')](respondWithResult(_0x3be369,null))[_0x6549('0x43')](handleError(_0x3be369,null));}; \ No newline at end of file +var _0x1883=['abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','scheduledAt','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','NOW()','ContactId','field','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperFinal','includeAll','include','findAll','params','catch','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null'];(function(_0x3778e4,_0x1552cd){var _0x12562b=function(_0x1fcfe6){while(--_0x1fcfe6){_0x3778e4['push'](_0x3778e4['shift']());}};_0x12562b(++_0x1552cd);}(_0x1883,0xab));var _0x3188=function(_0x3800a1,_0x2f706d){_0x3800a1=_0x3800a1-0x0;var _0x1ac34f=_0x1883[_0x3800a1];return _0x1ac34f;};'use strict';var emlformat=require(_0x3188('0x0'));var rimraf=require(_0x3188('0x1'));var zipdir=require(_0x3188('0x2'));var jsonpatch=require(_0x3188('0x3'));var rp=require(_0x3188('0x4'));var moment=require(_0x3188('0x5'));var BPromise=require(_0x3188('0x6'));var Mustache=require(_0x3188('0x7'));var util=require(_0x3188('0x8'));var path=require(_0x3188('0x9'));var sox=require(_0x3188('0xa'));var csv=require(_0x3188('0xb'));var ejs=require(_0x3188('0xc'));var fs=require('fs');var fs_extra=require(_0x3188('0xd'));var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xb'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3188('0x19'))['db'];function respondWithStatusCode(_0x45e94e,_0x20fef6){_0x20fef6=_0x20fef6||0xcc;return function(_0x3ae228){if(_0x3ae228){return _0x45e94e[_0x3188('0x1a')](_0x20fef6);}return _0x45e94e[_0x3188('0x1b')](_0x20fef6)['end']();};}function respondWithResult(_0x276d69,_0x5e0044){_0x5e0044=_0x5e0044||0xc8;return function(_0x4a2f36){if(_0x4a2f36){return _0x276d69[_0x3188('0x1b')](_0x5e0044)['json'](_0x4a2f36);}};}function respondWithFilteredResult(_0x54a87f,_0x32c239){return function(_0x1beead){if(_0x1beead){var _0xa2269=typeof _0x32c239[_0x3188('0x1c')]===_0x3188('0x1d')&&typeof _0x32c239[_0x3188('0x1e')]==='undefined';var _0x19cc72=_0x1beead[_0x3188('0x1f')];var _0x3f5b35=_0xa2269?0x0:_0x32c239[_0x3188('0x1c')];var _0x18a71a=_0xa2269?_0x1beead[_0x3188('0x1f')]:_0x32c239[_0x3188('0x1c')]+_0x32c239[_0x3188('0x1e')];var _0x5bcbba;if(_0x18a71a>=_0x19cc72){_0x18a71a=_0x19cc72;_0x5bcbba=0xc8;}else{_0x5bcbba=0xce;}_0x54a87f[_0x3188('0x1b')](_0x5bcbba);return _0x54a87f[_0x3188('0x20')]('Content-Range',_0x3f5b35+'-'+_0x18a71a+'/'+_0x19cc72)['json'](_0x1beead);}return null;};}function patchUpdates(_0x5d8d62){return function(_0x46a318){try{jsonpatch[_0x3188('0x21')](_0x46a318,_0x5d8d62,!![]);}catch(_0xd292b5){return BPromise['reject'](_0xd292b5);}return _0x46a318['save']();};}function saveUpdates(_0x266260,_0x461286){return function(_0x375077){if(_0x375077){return _0x375077[_0x3188('0x22')](_0x266260)[_0x3188('0x23')](function(_0x4bd5ee){return _0x4bd5ee;});}return null;};}function removeEntity(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(_0x5a2e67){return _0x5a2e67[_0x3188('0x24')]()['then'](function(){_0x30cf2c['status'](0xcc)[_0x3188('0x25')]();});}};}function handleEntityNotFound(_0x129bd7,_0x87d5a3){return function(_0x1aeaba){if(!_0x1aeaba){_0x129bd7[_0x3188('0x1a')](0x194);}return _0x1aeaba;};}function handleError(_0x2cd060,_0xe57f73){_0xe57f73=_0xe57f73||0x1f4;return function(_0x11021c){logger['error'](_0x11021c[_0x3188('0x26')]);if(_0x11021c[_0x3188('0x27')]){delete _0x11021c['name'];}_0x2cd060[_0x3188('0x1b')](_0xe57f73)[_0x3188('0x28')](_0x11021c);};}exports[_0x3188('0x29')]=function(_0x44db9a,_0x20e6aa){var _0x1f1c6f={},_0x8f810f={},_0x472926={'count':0x0,'rows':[]};var _0x57c21c=_[_0x3188('0x2a')](db['CmHopperFinal'][_0x3188('0x2b')],function(_0x5623f1){return{'name':_0x5623f1[_0x3188('0x2c')],'type':_0x5623f1[_0x3188('0x2d')][_0x3188('0x2e')]};});_0x8f810f[_0x3188('0x2f')]=_[_0x3188('0x2a')](_0x57c21c,_0x3188('0x27'));_0x8f810f[_0x3188('0x30')]=_[_0x3188('0x31')](_0x44db9a[_0x3188('0x30')]);_0x8f810f[_0x3188('0x32')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],_0x8f810f[_0x3188('0x30')]);_0x1f1c6f[_0x3188('0x34')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],qs[_0x3188('0x35')](_0x44db9a[_0x3188('0x30')]['fields']));_0x1f1c6f[_0x3188('0x34')]=_0x1f1c6f['attributes'][_0x3188('0x36')]?_0x1f1c6f[_0x3188('0x34')]:_0x8f810f['model'];if(!_0x44db9a[_0x3188('0x30')][_0x3188('0x37')](_0x3188('0x38'))){_0x1f1c6f[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x44db9a[_0x3188('0x30')][_0x3188('0x1e')]);_0x1f1c6f['offset']=qs['offset'](_0x44db9a[_0x3188('0x30')][_0x3188('0x1c')]);}_0x1f1c6f[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x44db9a['query'][_0x3188('0x3a')]);_0x1f1c6f[_0x3188('0x3b')]=qs[_0x3188('0x32')](_[_0x3188('0x3c')](_0x44db9a['query'],_0x8f810f[_0x3188('0x32')]),_0x57c21c);if(_0x44db9a['query'][_0x3188('0x3d')]){_0x1f1c6f['where']=_[_0x3188('0x3e')](_0x1f1c6f[_0x3188('0x3b')],{'$or':_[_0x3188('0x2a')](_0x57c21c,function(_0x2990c4){if(_0x2990c4[_0x3188('0x2d')]!==_0x3188('0x3f')){var _0x4666b2={};_0x4666b2[_0x2990c4[_0x3188('0x27')]]={'$like':'%'+_0x44db9a[_0x3188('0x30')][_0x3188('0x3d')]+'%'};return _0x4666b2;}})});}_0x1f1c6f=_['merge']({},_0x1f1c6f,_0x44db9a[_0x3188('0x40')]);var _0x2bad0f={'where':_0x1f1c6f[_0x3188('0x3b')]};return db[_0x3188('0x41')][_0x3188('0x1f')](_0x2bad0f)[_0x3188('0x23')](function(_0x5a815d){_0x472926[_0x3188('0x1f')]=_0x5a815d;if(_0x44db9a['query'][_0x3188('0x42')]){_0x1f1c6f[_0x3188('0x43')]=[{'all':!![]}];}return db[_0x3188('0x41')][_0x3188('0x44')](_0x1f1c6f);})[_0x3188('0x23')](function(_0x549ab2){_0x472926['rows']=_0x549ab2;return _0x472926;})['then'](respondWithFilteredResult(_0x20e6aa,_0x1f1c6f))['catch'](handleError(_0x20e6aa,null));};exports['show']=function(_0x763943,_0x28c224){var _0x3e5f90={'raw':!![],'where':{'id':_0x763943[_0x3188('0x45')]['id']}},_0x1b40b1={};_0x1b40b1['model']=_[_0x3188('0x31')](db['CmHopperFinal'][_0x3188('0x2b')]);_0x1b40b1[_0x3188('0x30')]=_[_0x3188('0x31')](_0x763943[_0x3188('0x30')]);_0x1b40b1['filters']=_[_0x3188('0x33')](_0x1b40b1[_0x3188('0x2f')],_0x1b40b1[_0x3188('0x30')]);_0x3e5f90[_0x3188('0x34')]=_[_0x3188('0x33')](_0x1b40b1['model'],qs['fields'](_0x763943[_0x3188('0x30')][_0x3188('0x35')]));_0x3e5f90['attributes']=_0x3e5f90[_0x3188('0x34')][_0x3188('0x36')]?_0x3e5f90['attributes']:_0x1b40b1[_0x3188('0x2f')];if(_0x763943[_0x3188('0x30')][_0x3188('0x42')]){_0x3e5f90[_0x3188('0x43')]=[{'all':!![]}];}_0x3e5f90=_[_0x3188('0x3e')]({},_0x3e5f90,_0x763943['options']);return db[_0x3188('0x41')]['find'](_0x3e5f90)[_0x3188('0x23')](handleEntityNotFound(_0x28c224,null))[_0x3188('0x23')](respondWithResult(_0x28c224,null))[_0x3188('0x46')](handleError(_0x28c224,null));};exports[_0x3188('0x47')]=function(_0xe4cbb0,_0x315524){return db[_0x3188('0x41')][_0x3188('0x47')]()[_0x3188('0x23')](respondWithResult(_0x315524,null))[_0x3188('0x46')](handleError(_0x315524,null));};exports[_0x3188('0x22')]=function(_0x50c08d,_0x50fd56){if(_0x50c08d[_0x3188('0x48')]['uniqueid']){delete _0x50c08d[_0x3188('0x48')][_0x3188('0x49')];}return db['CmHopperFinal'][_0x3188('0x4a')]({'where':{'uniqueid':_0x50c08d[_0x3188('0x45')]['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x50fd56,null))[_0x3188('0x23')](saveUpdates(_0x50c08d[_0x3188('0x48')],null))[_0x3188('0x23')](respondWithResult(_0x50fd56,null))[_0x3188('0x46')](handleError(_0x50fd56,null));};exports[_0x3188('0x4b')]=function(_0x59a177,_0x3b8fe9,_0x3051ce){return db['CmHopperFinal'][_0x3188('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x59a177['params']['id']},'attributes':[[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x4f')))),'noAnswerContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x50')))),_0x3188('0x51')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')]['literal'](_0x3188('0x52')))),_0x3188('0x53')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x54')))),_0x3188('0x55')],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3188('0x56')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x57')))),'answeringMachine']]})[_0x3188('0x23')](handleEntityNotFound(_0x3b8fe9,null))[_0x3188('0x23')](respondWithResult(_0x3b8fe9,null))[_0x3188('0x46')](handleError(_0x3b8fe9,null));};exports[_0x3188('0x58')]=function(_0x3afd94,_0x447827,_0x27983c){return db['CmHopperFinal'][_0x3188('0x44')]({'raw':![],'where':{'CampaignId':_0x3afd94[_0x3188('0x45')]['id']},'attributes':[[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x59')))),'noSuchContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x4f')))),_0x3188('0x5a')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')]['literal'](_0x3188('0x50')))),'busyContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x5b')))),_0x3188('0x5c')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x3188('0x53')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3188('0x55')],[db[_0x3188('0x4c')]['fn']('COUNT',db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3188('0x56')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x57')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x447827,null))['then'](respondWithResult(_0x447827,null))['catch'](handleError(_0x447827,null));};exports[_0x3188('0x5d')]=function(_0x693395,_0x3b6a13,_0x30f3b3){return db[_0x3188('0x5e')]['find']({'where':{'id':_0x693395[_0x3188('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b6a13,null))[_0x3188('0x23')](function(_0x96600f){var _0x5b93cd;if(_0x96600f){_0x5b93cd=squel[_0x3188('0x5f')]()['into'](_0x3188('0x60'))[_0x3188('0x61')](['phone',_0x3188('0x62'),'ContactId',_0x3188('0x63'),_0x3188('0x64'),_0x3188('0x65'),_0x3188('0x66')],squel[_0x3188('0x67')]()['field'](_0x3188('0x68'),_0x3188('0x69'))['field'](_0x3188('0x6a'),_0x3188('0x62'))['field']('ANY_VALUE(ContactId)',_0x3188('0x6b'))[_0x3188('0x6c')](_0x3188('0x6d'),_0x3188('0x63'))[_0x3188('0x6c')](_0x3188('0x6e'),'VoiceQueueId')[_0x3188('0x6c')](_0x3188('0x6a'),_0x3188('0x65'))['field'](_0x3188('0x6a'),_0x3188('0x66'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395['params']['id']['toString']())['where'](_0x3188('0x72'),_0x693395[_0x3188('0x48')]['state'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x74'))[_0x3188('0x3b')](_0x3188('0x75'),squel[_0x3188('0x67')]()['field'](_0x3188('0x69'))[_0x3188('0x6f')](_0x3188('0x60'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395[_0x3188('0x45')]['id'][_0x3188('0x73')]()))[_0x3188('0x3b')](_0x3188('0x75'),squel[_0x3188('0x67')]()[_0x3188('0x6c')](_0x3188('0x76'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395[_0x3188('0x45')]['id'][_0x3188('0x73')]())['where'](_0x3188('0x77')))[_0x3188('0x78')](_0x3188('0x6b')))[_0x3188('0x73')]();return db[_0x3188('0x4c')]['query'](_0x5b93cd);}return[];})[_0x3188('0x23')](respondWithResult(_0x3b6a13,null))[_0x3188('0x46')](handleError(_0x3b6a13,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0xc1ee8e,_0x2ba5a5,_0x43212c){return db['Campaign'][_0x3188('0x4a')]({'where':{'id':_0xc1ee8e['params']['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x2ba5a5,null))[_0x3188('0x23')](function(_0x31029d){var _0xcf9ceb;if(_0x31029d){_0xcf9ceb=squel[_0x3188('0x5f')]()[_0x3188('0x79')]('cm_hopper')['fromQuery']([_0x3188('0x69'),_0x3188('0x62'),_0x3188('0x6b'),_0x3188('0x63'),_0x3188('0x7a'),_0x3188('0x65'),'updatedAt'],squel[_0x3188('0x67')]()[_0x3188('0x6c')](_0x3188('0x68'),_0x3188('0x69'))['field'](_0x3188('0x6a'),'scheduledAt')['field']('ANY_VALUE(ContactId)','ContactId')[_0x3188('0x6c')](_0x3188('0x6d'),'ListId')[_0x3188('0x6c')](_0x3188('0x7b'),'CampaignId')[_0x3188('0x6c')]('NOW()',_0x3188('0x65'))[_0x3188('0x6c')]('NOW()',_0x3188('0x66'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x7c'),_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x72'),_0xc1ee8e[_0x3188('0x48')]['state'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x74'))['where'](_0x3188('0x75'),squel['select']()[_0x3188('0x6c')]('phone')['from']('cm_hopper')['where'](_0x3188('0x7c'),_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]()))[_0x3188('0x3b')](_0x3188('0x75'),squel['select']()[_0x3188('0x6c')]('calleridnum')['from'](_0x3188('0x70'))[_0x3188('0x3b')]('CampaignId\x20=\x20?',_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x77')))[_0x3188('0x78')](_0x3188('0x6b')))[_0x3188('0x73')]();return db['sequelize'][_0x3188('0x30')](_0xcf9ceb);}return[];})[_0x3188('0x23')](respondWithResult(_0x2ba5a5,null))[_0x3188('0x46')](handleError(_0x2ba5a5,null));};exports[_0x3188('0x7d')]=function(_0x203f04,_0x12c18c,_0x11b74c){return db[_0x3188('0x7e')][_0x3188('0x7f')]({'where':{'VoiceQueueId':_0x203f04['body'][_0x3188('0x64')],'CampaignId':_0x203f04['body'][_0x3188('0x7a')],'ContactId':_0x203f04[_0x3188('0x48')][_0x3188('0x6b')]}})[_0x3188('0x23')](handleEntityNotFound(_0x12c18c,null))[_0x3188('0x23')](function(_0x41ca86){if(_0x41ca86){return _0x41ca86;}return null;})[_0x3188('0x23')](respondWithResult(_0x12c18c,null))[_0x3188('0x46')](handleError(_0x12c18c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 9b901b2..8f3388a 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 _0x4663=['CmHopperFinal','calleridnum','lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x490e05,_0x13ec2e){var _0x895e51=function(_0x32d22a){while(--_0x32d22a){_0x490e05['push'](_0x490e05['shift']());}};_0x895e51(++_0x13ec2e);}(_0x4663,0x176));var _0x3466=function(_0xc8ee55,_0x50114a){_0xc8ee55=_0xc8ee55-0x0;var _0x3fc930=_0x4663[_0xc8ee55];return _0x3fc930;};'use strict';var _=require(_0x3466('0x0'));var util=require(_0x3466('0x1'));var logger=require('../../config/logger')(_0x3466('0x2'));var moment=require(_0x3466('0x3'));var BPromise=require(_0x3466('0x4'));var rp=require(_0x3466('0x5'));var fs=require('fs');var path=require(_0x3466('0x6'));var rimraf=require(_0x3466('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0x3466('0x8')]=function(_0x5cca16,_0x512b0c){return _0x5cca16[_0x3466('0x9')](_0x3466('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x3466('0xb'),'fields':[_0x3466('0xb')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x41ac=['path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x41ac,0x73));var _0xc41a=function(_0x57ffab,_0x2fcd91){_0x57ffab=_0x57ffab-0x0;var _0x2ddb5e=_0x41ac[_0x57ffab];return _0x2ddb5e;};'use strict';var _=require(_0xc41a('0x0'));var util=require(_0xc41a('0x1'));var logger=require(_0xc41a('0x2'))('api');var moment=require(_0xc41a('0x3'));var BPromise=require(_0xc41a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc41a('0x5'));var rimraf=require(_0xc41a('0x6'));var config=require(_0xc41a('0x7'));var attributes=require(_0xc41a('0x8'));module[_0xc41a('0x9')]=function(_0x21fe9a,_0x441807){return _0x21fe9a[_0xc41a('0xa')](_0xc41a('0xb'),attributes,{'tableName':_0xc41a('0xc'),'paranoid':![],'indexes':[{'name':_0xc41a('0xd'),'fields':[_0xc41a('0xd')]},{'name':_0xc41a('0xe'),'fields':[_0xc41a('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 9830d53..6a75024 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 _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x89b043,_0x1f03c3){var _0x3ab7e6=function(_0xc02cf2){while(--_0xc02cf2){_0x89b043['push'](_0x89b043['shift']());}};_0x3ab7e6(++_0x1f03c3);}(_0x7a54,0x106));var _0x47a5=function(_0x157bee,_0x534071){_0x157bee=_0x157bee-0x0;var _0x5dbaf7=_0x7a54[_0x157bee];return _0x5dbaf7;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +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(_0x30b08a,_0x1b5f49){var _0x9ad7e3=function(_0x42021b){while(--_0x42021b){_0x30b08a['push'](_0x30b08a['shift']());}};_0x9ad7e3(++_0x1b5f49);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a3243,_0x201872){_0x1a3243=_0x1a3243-0x0;var _0x33f2ca=_0xb10b[_0x1a3243];return _0x33f2ca;};'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 fa908b8..1b4adf2 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 _0xaf2a=['moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','put','update','exports','util','express','Router','fs-extra','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','post'];(function(_0x130faf,_0x320f2f){var _0x5555ea=function(_0x153147){while(--_0x153147){_0x130faf['push'](_0x130faf['shift']());}};_0x5555ea(++_0x320f2f);}(_0xaf2a,0xe2));var _0xaaf2=function(_0x244851,_0x5caaf2){_0x244851=_0x244851-0x0;var _0x14d1a6=_0xaf2a[_0x244851];return _0x14d1a6;};'use strict';var multer=require('multer');var util=require(_0xaaf2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaaf2('0x1'));var router=express[_0xaaf2('0x2')]();var fs_extra=require(_0xaaf2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xaaf2('0x4'));var config=require('../../config/environment');var controller=require(_0xaaf2('0x5'));router[_0xaaf2('0x6')]('/',auth[_0xaaf2('0x7')](),controller[_0xaaf2('0x8')]);router[_0xaaf2('0x6')](_0xaaf2('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xaaf2('0x6')]('/:id',auth[_0xaaf2('0x7')](),controller[_0xaaf2('0xa')]);router['get'](_0xaaf2('0xb'),auth[_0xaaf2('0x7')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xaaf2('0x6')](_0xaaf2('0xc'),auth[_0xaaf2('0x7')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xaaf2('0xd')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0xaaf2('0xe')]);router['post'](_0xaaf2('0xf'),auth['isAuthenticated'](),controller[_0xaaf2('0x10')]);router[_0xaaf2('0xd')]('/checkContactHopper',auth[_0xaaf2('0x7')](),controller['checkContactHopper']);router[_0xaaf2('0x11')]('/:id',auth[_0xaaf2('0x7')](),controller[_0xaaf2('0x12')]);module[_0xaaf2('0x13')]=router; \ No newline at end of file +var _0xd19f=['put','update','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','/describe','get','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsIvrCampaignHopperFinal','/checkContactHopper'];(function(_0x53e83d,_0x760f0f){var _0x212614=function(_0x3fc40a){while(--_0x3fc40a){_0x53e83d['push'](_0x53e83d['shift']());}};_0x212614(++_0x760f0f);}(_0xd19f,0x161));var _0xfd19=function(_0x231b2e,_0x2a33f9){_0x231b2e=_0x231b2e-0x0;var _0x3feb2a=_0xd19f[_0x231b2e];return _0x3feb2a;};'use strict';var multer=require(_0xfd19('0x0'));var util=require(_0xfd19('0x1'));var path=require(_0xfd19('0x2'));var timeout=require('connect-timeout');var express=require(_0xfd19('0x3'));var router=express[_0xfd19('0x4')]();var fs_extra=require(_0xfd19('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfd19('0x6'));var config=require(_0xfd19('0x7'));var controller=require(_0xfd19('0x8'));router['get']('/',auth[_0xfd19('0x9')](),controller[_0xfd19('0xa')]);router['get'](_0xfd19('0xb'),auth[_0xfd19('0x9')](),controller['describe']);router[_0xfd19('0xc')](_0xfd19('0xd'),auth[_0xfd19('0x9')](),controller[_0xfd19('0xe')]);router[_0xfd19('0xc')](_0xfd19('0xf'),auth[_0xfd19('0x9')](),controller[_0xfd19('0x10')]);router[_0xfd19('0xc')](_0xfd19('0x11'),auth['isAuthenticated'](),controller[_0xfd19('0x12')]);router[_0xfd19('0x13')]('/voice/queue/moveContacts/:id',auth[_0xfd19('0x9')](),controller['moveContactsQueueCampaignHopperFinal']);router['post']('/voice/campaign/moveContacts/:id',auth[_0xfd19('0x9')](),controller[_0xfd19('0x14')]);router[_0xfd19('0x13')](_0xfd19('0x15'),auth[_0xfd19('0x9')](),controller['checkContactHopper']);router[_0xfd19('0x16')](_0xfd19('0xd'),auth[_0xfd19('0x9')](),controller[_0xfd19('0x17')]);module[_0xfd19('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index d5098a5..2178668 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 _0x06f8=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0x57dbca,_0x1ba9eb){var _0x5ed29f=function(_0x7cb4a4){while(--_0x7cb4a4){_0x57dbca['push'](_0x57dbca['shift']());}};_0x5ed29f(++_0x1ba9eb);}(_0x06f8,0x8f));var _0x806f=function(_0x31ab49,_0x31e84a){_0x31ab49=_0x31ab49-0x0;var _0x1d90a4=_0x06f8[_0x31ab49];return _0x1d90a4;};'use strict';var Sequelize=require(_0x806f('0x0'));module['exports']={'state':{'type':Sequelize[_0x806f('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x806f('0x2')]},'scheduledat':{'type':Sequelize[_0x806f('0x3')]},'countbusyretry':{'type':Sequelize[_0x806f('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x806f('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x806f('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x806f('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x806f('0x3')]},'responsetime':{'type':Sequelize[_0x806f('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x806f('0x3')]},'ringtime':{'type':Sequelize[_0x806f('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x806f('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x806f('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x806f('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x806f('0x2')]},'campaign':{'type':Sequelize[_0x806f('0x2')]},'campaigntype':{'type':Sequelize[_0x806f('0x2')]},'membername':{'type':Sequelize[_0x806f('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x806f('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x806f('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x806f('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x806f('0x3')]},'recallme':{'type':Sequelize[_0x806f('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x806f('0x3')]},'edited':{'type':Sequelize[_0x806f('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x806f('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x806f('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x806f('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x344f=['BOOLEAN','sequelize','exports','DATE','INTEGER','STRING'];(function(_0x4fb84b,_0x24b3cf){var _0x5b6323=function(_0x278e4a){while(--_0x278e4a){_0x4fb84b['push'](_0x4fb84b['shift']());}};_0x5b6323(++_0x24b3cf);}(_0x344f,0x103));var _0xf344=function(_0x5393c6,_0x46f298){_0x5393c6=_0x5393c6-0x0;var _0x2954dc=_0x344f[_0x5393c6];return _0x2954dc;};'use strict';var Sequelize=require(_0xf344('0x0'));module[_0xf344('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xf344('0x2')]},'countbusyretry':{'type':Sequelize[_0xf344('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf344('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf344('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf344('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xf344('0x4')]},'originatecalleridname':{'type':Sequelize[_0xf344('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf344('0x4')]},'starttime':{'type':Sequelize[_0xf344('0x2')]},'responsetime':{'type':Sequelize[_0xf344('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xf344('0x2')]},'endtime':{'type':Sequelize[_0xf344('0x2')]},'ringtime':{'type':Sequelize[_0xf344('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf344('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf344('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf344('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf344('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xf344('0x4')]},'membername':{'type':Sequelize[_0xf344('0x4')]},'reason':{'type':Sequelize[_0xf344('0x4')]},'amd':{'type':Sequelize[_0xf344('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf344('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xf344('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf344('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xf344('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf344('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf344('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xf344('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 71ebb6e..0339889 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 _0xf211=['index','map','CmHopperHistory','rawAttributes','fieldName','key','query','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','sendStatus','stack','name','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf211,0x1f2));var _0x1f21=function(_0x4fa3d2,_0x1bb8db){_0x4fa3d2=_0x4fa3d2-0x0;var _0x1ea3fd=_0xf211[_0x4fa3d2];return _0x1ea3fd;};'use strict';var emlformat=require(_0x1f21('0x0'));var rimraf=require(_0x1f21('0x1'));var zipdir=require(_0x1f21('0x2'));var jsonpatch=require(_0x1f21('0x3'));var rp=require(_0x1f21('0x4'));var moment=require(_0x1f21('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1f21('0x6'));var util=require(_0x1f21('0x7'));var path=require(_0x1f21('0x8'));var sox=require(_0x1f21('0x9'));var csv=require(_0x1f21('0xa'));var ejs=require(_0x1f21('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1f21('0xc'));var crypto=require(_0x1f21('0xd'));var jsforce=require(_0x1f21('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1f21('0xa'));var querystring=require('querystring');var Papa=require(_0x1f21('0xf'));var Redis=require('ioredis');var authService=require(_0x1f21('0x10'));var qs=require(_0x1f21('0x11'));var as=require(_0x1f21('0x12'));var hardwareService=require(_0x1f21('0x13'));var logger=require(_0x1f21('0x14'))(_0x1f21('0x15'));var utils=require(_0x1f21('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1f21('0x17'))['db'];function respondWithStatusCode(_0x5e6be3,_0x4d8bc7){_0x4d8bc7=_0x4d8bc7||0xcc;return function(_0x130776){if(_0x130776){return _0x5e6be3['sendStatus'](_0x4d8bc7);}return _0x5e6be3[_0x1f21('0x18')](_0x4d8bc7)[_0x1f21('0x19')]();};}function respondWithResult(_0x2f3361,_0x5091a9){_0x5091a9=_0x5091a9||0xc8;return function(_0x3b63ef){if(_0x3b63ef){return _0x2f3361['status'](_0x5091a9)['json'](_0x3b63ef);}};}function respondWithFilteredResult(_0x493a38,_0x57811f){return function(_0x393843){if(_0x393843){var _0x2b1520=typeof _0x57811f[_0x1f21('0x1a')]===_0x1f21('0x1b')&&typeof _0x57811f['limit']===_0x1f21('0x1b');var _0x19b6f0=_0x393843[_0x1f21('0x1c')];var _0x3e786c=_0x2b1520?0x0:_0x57811f[_0x1f21('0x1a')];var _0x5e2cc0=_0x2b1520?_0x393843['count']:_0x57811f[_0x1f21('0x1a')]+_0x57811f[_0x1f21('0x1d')];var _0x2a680e;if(_0x5e2cc0>=_0x19b6f0){_0x5e2cc0=_0x19b6f0;_0x2a680e=0xc8;}else{_0x2a680e=0xce;}_0x493a38['status'](_0x2a680e);return _0x493a38[_0x1f21('0x1e')]('Content-Range',_0x3e786c+'-'+_0x5e2cc0+'/'+_0x19b6f0)[_0x1f21('0x1f')](_0x393843);}return null;};}function patchUpdates(_0x4c37bf){return function(_0xe068b7){try{jsonpatch[_0x1f21('0x20')](_0xe068b7,_0x4c37bf,!![]);}catch(_0x53b679){return BPromise[_0x1f21('0x21')](_0x53b679);}return _0xe068b7[_0x1f21('0x22')]();};}function saveUpdates(_0x1306b2,_0x4c8f94){return function(_0x456892){if(_0x456892){return _0x456892[_0x1f21('0x23')](_0x1306b2)[_0x1f21('0x24')](function(_0x5bfcde){return _0x5bfcde;});}return null;};}function removeEntity(_0x2ab3c3,_0x133ef1){return function(_0x1162f3){if(_0x1162f3){return _0x1162f3['destroy']()['then'](function(){_0x2ab3c3[_0x1f21('0x18')](0xcc)[_0x1f21('0x19')]();});}};}function handleEntityNotFound(_0x52a2e9,_0x1d4299){return function(_0x456f57){if(!_0x456f57){_0x52a2e9[_0x1f21('0x25')](0x194);}return _0x456f57;};}function handleError(_0x2c821b,_0x32a279){_0x32a279=_0x32a279||0x1f4;return function(_0xe18901){logger['error'](_0xe18901[_0x1f21('0x26')]);if(_0xe18901[_0x1f21('0x27')]){delete _0xe18901[_0x1f21('0x27')];}_0x2c821b[_0x1f21('0x18')](_0x32a279)[_0x1f21('0x28')](_0xe18901);};}exports[_0x1f21('0x29')]=function(_0x3bbab2,_0x20d85d){var _0x463d33={},_0x37b5d7={},_0x51bb38={'count':0x0,'rows':[]};var _0x1f3b34=_[_0x1f21('0x2a')](db[_0x1f21('0x2b')][_0x1f21('0x2c')],function(_0x517b37){return{'name':_0x517b37[_0x1f21('0x2d')],'type':_0x517b37['type'][_0x1f21('0x2e')]};});_0x37b5d7['model']=_[_0x1f21('0x2a')](_0x1f3b34,_0x1f21('0x27'));_0x37b5d7[_0x1f21('0x2f')]=_['keys'](_0x3bbab2[_0x1f21('0x2f')]);_0x37b5d7['filters']=_[_0x1f21('0x30')](_0x37b5d7[_0x1f21('0x31')],_0x37b5d7[_0x1f21('0x2f')]);_0x463d33[_0x1f21('0x32')]=_['intersection'](_0x37b5d7[_0x1f21('0x31')],qs['fields'](_0x3bbab2[_0x1f21('0x2f')]['fields']));_0x463d33['attributes']=_0x463d33[_0x1f21('0x32')][_0x1f21('0x33')]?_0x463d33[_0x1f21('0x32')]:_0x37b5d7['model'];if(!_0x3bbab2[_0x1f21('0x2f')][_0x1f21('0x34')](_0x1f21('0x35'))){_0x463d33[_0x1f21('0x1d')]=qs[_0x1f21('0x1d')](_0x3bbab2[_0x1f21('0x2f')][_0x1f21('0x1d')]);_0x463d33['offset']=qs[_0x1f21('0x1a')](_0x3bbab2['query'][_0x1f21('0x1a')]);}_0x463d33['order']=qs[_0x1f21('0x36')](_0x3bbab2[_0x1f21('0x2f')][_0x1f21('0x36')]);_0x463d33[_0x1f21('0x37')]=qs[_0x1f21('0x38')](_[_0x1f21('0x39')](_0x3bbab2['query'],_0x37b5d7[_0x1f21('0x38')]),_0x1f3b34);if(_0x3bbab2[_0x1f21('0x2f')][_0x1f21('0x3a')]){_0x463d33[_0x1f21('0x37')]=_[_0x1f21('0x3b')](_0x463d33[_0x1f21('0x37')],{'$or':_[_0x1f21('0x2a')](_0x1f3b34,function(_0x43f0df){if(_0x43f0df[_0x1f21('0x3c')]!==_0x1f21('0x3d')){var _0x2d2f86={};_0x2d2f86[_0x43f0df[_0x1f21('0x27')]]={'$like':'%'+_0x3bbab2[_0x1f21('0x2f')][_0x1f21('0x3a')]+'%'};return _0x2d2f86;}})});}_0x463d33=_[_0x1f21('0x3b')]({},_0x463d33,_0x3bbab2[_0x1f21('0x3e')]);var _0x38c667={'where':_0x463d33[_0x1f21('0x37')]};return db['CmHopperHistory'][_0x1f21('0x1c')](_0x38c667)[_0x1f21('0x24')](function(_0x1d18dd){_0x51bb38[_0x1f21('0x1c')]=_0x1d18dd;if(_0x3bbab2[_0x1f21('0x2f')][_0x1f21('0x3f')]){_0x463d33[_0x1f21('0x40')]=[{'all':!![]}];}return db[_0x1f21('0x2b')][_0x1f21('0x41')](_0x463d33);})[_0x1f21('0x24')](function(_0x798d30){_0x51bb38[_0x1f21('0x42')]=_0x798d30;return _0x51bb38;})['then'](respondWithFilteredResult(_0x20d85d,_0x463d33))[_0x1f21('0x43')](handleError(_0x20d85d,null));};exports[_0x1f21('0x44')]=function(_0x516f6a,_0x2eab57){var _0x5c406b={'raw':!![],'where':{'id':_0x516f6a[_0x1f21('0x45')]['id']}},_0x5e1daf={};_0x5e1daf['model']=_['keys'](db[_0x1f21('0x2b')][_0x1f21('0x2c')]);_0x5e1daf[_0x1f21('0x2f')]=_[_0x1f21('0x46')](_0x516f6a[_0x1f21('0x2f')]);_0x5e1daf[_0x1f21('0x38')]=_[_0x1f21('0x30')](_0x5e1daf[_0x1f21('0x31')],_0x5e1daf[_0x1f21('0x2f')]);_0x5c406b[_0x1f21('0x32')]=_[_0x1f21('0x30')](_0x5e1daf[_0x1f21('0x31')],qs['fields'](_0x516f6a[_0x1f21('0x2f')][_0x1f21('0x47')]));_0x5c406b[_0x1f21('0x32')]=_0x5c406b[_0x1f21('0x32')][_0x1f21('0x33')]?_0x5c406b['attributes']:_0x5e1daf[_0x1f21('0x31')];if(_0x516f6a[_0x1f21('0x2f')][_0x1f21('0x3f')]){_0x5c406b[_0x1f21('0x40')]=[{'all':!![]}];}_0x5c406b=_[_0x1f21('0x3b')]({},_0x5c406b,_0x516f6a[_0x1f21('0x3e')]);return db[_0x1f21('0x2b')]['find'](_0x5c406b)[_0x1f21('0x24')](handleEntityNotFound(_0x2eab57,null))['then'](respondWithResult(_0x2eab57,null))[_0x1f21('0x43')](handleError(_0x2eab57,null));};exports[_0x1f21('0x48')]=function(_0x31290b,_0x27da6f){return db[_0x1f21('0x2b')]['create'](_0x31290b[_0x1f21('0x49')],{})['then'](respondWithResult(_0x27da6f,0xc9))[_0x1f21('0x43')](handleError(_0x27da6f,null));};exports['describe']=function(_0x24f111,_0x2d72f0){return db[_0x1f21('0x2b')][_0x1f21('0x4a')]()[_0x1f21('0x24')](respondWithResult(_0x2d72f0,null))[_0x1f21('0x43')](handleError(_0x2d72f0,null));};exports[_0x1f21('0x23')]=function(_0x3306be,_0x2efb24){if(_0x3306be[_0x1f21('0x49')][_0x1f21('0x4b')]){delete _0x3306be['body']['uniqueid'];}return db[_0x1f21('0x2b')][_0x1f21('0x4c')]({'where':{'uniqueid':_0x3306be[_0x1f21('0x45')]['id']}})[_0x1f21('0x24')](handleEntityNotFound(_0x2efb24,null))[_0x1f21('0x24')](saveUpdates(_0x3306be['body'],null))['then'](respondWithResult(_0x2efb24,null))[_0x1f21('0x43')](handleError(_0x2efb24,null));}; \ No newline at end of file +var _0x4b70=['undefined','limit','count','set','Content-Range','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','length','includeAll','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x3cd99c,_0x298ec7){var _0x680840=function(_0x264fb5){while(--_0x264fb5){_0x3cd99c['push'](_0x3cd99c['shift']());}};_0x680840(++_0x298ec7);}(_0x4b70,0x19e));var _0x04b7=function(_0x24fac8,_0x2fb38c){_0x24fac8=_0x24fac8-0x0;var _0x264b75=_0x4b70[_0x24fac8];return _0x264b75;};'use strict';var emlformat=require(_0x04b7('0x0'));var rimraf=require(_0x04b7('0x1'));var zipdir=require(_0x04b7('0x2'));var jsonpatch=require(_0x04b7('0x3'));var rp=require(_0x04b7('0x4'));var moment=require('moment');var BPromise=require(_0x04b7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04b7('0x6'));var csv=require(_0x04b7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x04b7('0x8'));var _=require(_0x04b7('0x9'));var squel=require(_0x04b7('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x04b7('0xb'));var toCsv=require(_0x04b7('0x7'));var querystring=require(_0x04b7('0xc'));var Papa=require(_0x04b7('0xd'));var Redis=require(_0x04b7('0xe'));var authService=require(_0x04b7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x04b7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04b7('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x04b7('0x12'));var licenseUtil=require(_0x04b7('0x13'));var db=require(_0x04b7('0x14'))['db'];function respondWithStatusCode(_0x4a22be,_0x4294b0){_0x4294b0=_0x4294b0||0xcc;return function(_0x352e67){if(_0x352e67){return _0x4a22be['sendStatus'](_0x4294b0);}return _0x4a22be['status'](_0x4294b0)['end']();};}function respondWithResult(_0x48b5c1,_0x345e84){_0x345e84=_0x345e84||0xc8;return function(_0x1fb950){if(_0x1fb950){return _0x48b5c1[_0x04b7('0x15')](_0x345e84)[_0x04b7('0x16')](_0x1fb950);}};}function respondWithFilteredResult(_0x1fd7d9,_0x18250d){return function(_0x1efd88){if(_0x1efd88){var _0x348322=typeof _0x18250d[_0x04b7('0x17')]===_0x04b7('0x18')&&typeof _0x18250d[_0x04b7('0x19')]===_0x04b7('0x18');var _0x2ac40b=_0x1efd88[_0x04b7('0x1a')];var _0x2d9ebc=_0x348322?0x0:_0x18250d['offset'];var _0xb2d7fc=_0x348322?_0x1efd88['count']:_0x18250d[_0x04b7('0x17')]+_0x18250d[_0x04b7('0x19')];var _0x58ec20;if(_0xb2d7fc>=_0x2ac40b){_0xb2d7fc=_0x2ac40b;_0x58ec20=0xc8;}else{_0x58ec20=0xce;}_0x1fd7d9['status'](_0x58ec20);return _0x1fd7d9[_0x04b7('0x1b')](_0x04b7('0x1c'),_0x2d9ebc+'-'+_0xb2d7fc+'/'+_0x2ac40b)['json'](_0x1efd88);}return null;};}function patchUpdates(_0x4db11d){return function(_0x486d35){try{jsonpatch['apply'](_0x486d35,_0x4db11d,!![]);}catch(_0x1ed918){return BPromise[_0x04b7('0x1d')](_0x1ed918);}return _0x486d35[_0x04b7('0x1e')]();};}function saveUpdates(_0x5ba31e,_0x55b560){return function(_0x2e82d6){if(_0x2e82d6){return _0x2e82d6[_0x04b7('0x1f')](_0x5ba31e)[_0x04b7('0x20')](function(_0x499276){return _0x499276;});}return null;};}function removeEntity(_0x17b139,_0x5b48fb){return function(_0x13f02){if(_0x13f02){return _0x13f02['destroy']()[_0x04b7('0x20')](function(){_0x17b139['status'](0xcc)[_0x04b7('0x21')]();});}};}function handleEntityNotFound(_0x4d4a0d,_0x2319ff){return function(_0x17d19d){if(!_0x17d19d){_0x4d4a0d[_0x04b7('0x22')](0x194);}return _0x17d19d;};}function handleError(_0xb4ffba,_0x1e9631){_0x1e9631=_0x1e9631||0x1f4;return function(_0xf31206){logger[_0x04b7('0x23')](_0xf31206[_0x04b7('0x24')]);if(_0xf31206[_0x04b7('0x25')]){delete _0xf31206[_0x04b7('0x25')];}_0xb4ffba['status'](_0x1e9631)[_0x04b7('0x26')](_0xf31206);};}exports[_0x04b7('0x27')]=function(_0x4df3e7,_0x17210f){var _0x270014={},_0x38801a={},_0x5eecb1={'count':0x0,'rows':[]};var _0xb5a62c=_[_0x04b7('0x28')](db[_0x04b7('0x29')][_0x04b7('0x2a')],function(_0x504f8f){return{'name':_0x504f8f[_0x04b7('0x2b')],'type':_0x504f8f[_0x04b7('0x2c')]['key']};});_0x38801a[_0x04b7('0x2d')]=_[_0x04b7('0x28')](_0xb5a62c,_0x04b7('0x25'));_0x38801a[_0x04b7('0x2e')]=_['keys'](_0x4df3e7[_0x04b7('0x2e')]);_0x38801a[_0x04b7('0x2f')]=_[_0x04b7('0x30')](_0x38801a[_0x04b7('0x2d')],_0x38801a['query']);_0x270014[_0x04b7('0x31')]=_[_0x04b7('0x30')](_0x38801a[_0x04b7('0x2d')],qs[_0x04b7('0x32')](_0x4df3e7['query']['fields']));_0x270014['attributes']=_0x270014[_0x04b7('0x31')]['length']?_0x270014[_0x04b7('0x31')]:_0x38801a[_0x04b7('0x2d')];if(!_0x4df3e7[_0x04b7('0x2e')][_0x04b7('0x33')]('nolimit')){_0x270014[_0x04b7('0x19')]=qs[_0x04b7('0x19')](_0x4df3e7['query'][_0x04b7('0x19')]);_0x270014[_0x04b7('0x17')]=qs[_0x04b7('0x17')](_0x4df3e7[_0x04b7('0x2e')][_0x04b7('0x17')]);}_0x270014[_0x04b7('0x34')]=qs[_0x04b7('0x35')](_0x4df3e7[_0x04b7('0x2e')][_0x04b7('0x35')]);_0x270014[_0x04b7('0x36')]=qs[_0x04b7('0x2f')](_['pick'](_0x4df3e7[_0x04b7('0x2e')],_0x38801a['filters']),_0xb5a62c);if(_0x4df3e7['query']['filter']){_0x270014['where']=_[_0x04b7('0x37')](_0x270014[_0x04b7('0x36')],{'$or':_[_0x04b7('0x28')](_0xb5a62c,function(_0x4a61f6){if(_0x4a61f6['type']!==_0x04b7('0x38')){var _0x140602={};_0x140602[_0x4a61f6[_0x04b7('0x25')]]={'$like':'%'+_0x4df3e7[_0x04b7('0x2e')][_0x04b7('0x39')]+'%'};return _0x140602;}})});}_0x270014=_[_0x04b7('0x37')]({},_0x270014,_0x4df3e7[_0x04b7('0x3a')]);var _0x1fff7d={'where':_0x270014['where']};return db['CmHopperHistory'][_0x04b7('0x1a')](_0x1fff7d)[_0x04b7('0x20')](function(_0x2b595a){_0x5eecb1[_0x04b7('0x1a')]=_0x2b595a;if(_0x4df3e7[_0x04b7('0x2e')]['includeAll']){_0x270014[_0x04b7('0x3b')]=[{'all':!![]}];}return db[_0x04b7('0x29')][_0x04b7('0x3c')](_0x270014);})[_0x04b7('0x20')](function(_0x3c0ccb){_0x5eecb1[_0x04b7('0x3d')]=_0x3c0ccb;return _0x5eecb1;})['then'](respondWithFilteredResult(_0x17210f,_0x270014))[_0x04b7('0x3e')](handleError(_0x17210f,null));};exports[_0x04b7('0x3f')]=function(_0x55958c,_0x385096){var _0x24fd19={'raw':!![],'where':{'id':_0x55958c[_0x04b7('0x40')]['id']}},_0x4326f7={};_0x4326f7['model']=_['keys'](db[_0x04b7('0x29')][_0x04b7('0x2a')]);_0x4326f7['query']=_[_0x04b7('0x41')](_0x55958c[_0x04b7('0x2e')]);_0x4326f7['filters']=_['intersection'](_0x4326f7[_0x04b7('0x2d')],_0x4326f7['query']);_0x24fd19[_0x04b7('0x31')]=_['intersection'](_0x4326f7['model'],qs[_0x04b7('0x32')](_0x55958c[_0x04b7('0x2e')][_0x04b7('0x32')]));_0x24fd19[_0x04b7('0x31')]=_0x24fd19['attributes'][_0x04b7('0x42')]?_0x24fd19[_0x04b7('0x31')]:_0x4326f7['model'];if(_0x55958c['query'][_0x04b7('0x43')]){_0x24fd19[_0x04b7('0x3b')]=[{'all':!![]}];}_0x24fd19=_[_0x04b7('0x37')]({},_0x24fd19,_0x55958c[_0x04b7('0x3a')]);return db['CmHopperHistory'][_0x04b7('0x44')](_0x24fd19)[_0x04b7('0x20')](handleEntityNotFound(_0x385096,null))[_0x04b7('0x20')](respondWithResult(_0x385096,null))[_0x04b7('0x3e')](handleError(_0x385096,null));};exports[_0x04b7('0x45')]=function(_0x360a86,_0x3eead){return db[_0x04b7('0x29')][_0x04b7('0x45')](_0x360a86[_0x04b7('0x46')],{})[_0x04b7('0x20')](respondWithResult(_0x3eead,0xc9))[_0x04b7('0x3e')](handleError(_0x3eead,null));};exports[_0x04b7('0x47')]=function(_0x270d33,_0x25460b){return db['CmHopperHistory'][_0x04b7('0x47')]()[_0x04b7('0x20')](respondWithResult(_0x25460b,null))['catch'](handleError(_0x25460b,null));};exports[_0x04b7('0x1f')]=function(_0x3e34df,_0x30dfc5){if(_0x3e34df[_0x04b7('0x46')]['uniqueid']){delete _0x3e34df[_0x04b7('0x46')][_0x04b7('0x48')];}return db['CmHopperHistory'][_0x04b7('0x44')]({'where':{'uniqueid':_0x3e34df[_0x04b7('0x40')]['id']}})['then'](handleEntityNotFound(_0x30dfc5,null))[_0x04b7('0x20')](saveUpdates(_0x3e34df[_0x04b7('0x46')],null))[_0x04b7('0x20')](respondWithResult(_0x30dfc5,null))[_0x04b7('0x3e')](handleError(_0x30dfc5,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 753bb04..95cd437 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 _0x022a=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','cm_hopper_history','endtime'];(function(_0x28ac49,_0x3ba227){var _0x113128=function(_0x5683c6){while(--_0x5683c6){_0x28ac49['push'](_0x28ac49['shift']());}};_0x113128(++_0x3ba227);}(_0x022a,0x1f0));var _0xa022=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x022a[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xa022('0x0'));var util=require(_0xa022('0x1'));var logger=require(_0xa022('0x2'))(_0xa022('0x3'));var moment=require(_0xa022('0x4'));var BPromise=require(_0xa022('0x5'));var rp=require(_0xa022('0x6'));var fs=require('fs');var path=require(_0xa022('0x7'));var rimraf=require(_0xa022('0x8'));var config=require(_0xa022('0x9'));var attributes=require(_0xa022('0xa'));module[_0xa022('0xb')]=function(_0x4bc874,_0x29e5cf){return _0x4bc874['define']('CmHopperHistory',attributes,{'tableName':_0xa022('0xc'),'paranoid':![],'indexes':[{'name':_0xa022('0xd'),'fields':[_0xa022('0xd')]},{'name':_0xa022('0xe'),'fields':[_0xa022('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x40f3=['rimraf','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','uniqueid','util','../../config/logger','moment','bluebird'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x40f3,0x8b));var _0x340f=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0x40f3[_0x48e1ec];return _0x3b33eb;};'use strict';var _=require('lodash');var util=require(_0x340f('0x0'));var logger=require(_0x340f('0x1'))('api');var moment=require(_0x340f('0x2'));var BPromise=require(_0x340f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x340f('0x4'));var config=require(_0x340f('0x5'));var attributes=require('./cmHopperHistory.attributes');module[_0x340f('0x6')]=function(_0x496502,_0x48d1e8){return _0x496502[_0x340f('0x7')](_0x340f('0x8'),attributes,{'tableName':_0x340f('0x9'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x340f('0xa'),'fields':[_0x340f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index ec52dc8..300472f 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 _0x1239=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','debug','AvgHandleTime','findAll','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','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=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util'];(function(_0x542163,_0x3b96b0){var _0x3f3d2f=function(_0x30860c){while(--_0x30860c){_0x542163['push'](_0x542163['shift']());}};_0x3f3d2f(++_0x3b96b0);}(_0x1239,0xd3));var _0x9123=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1239[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x9123('0x0'));var util=require(_0x9123('0x1'));var moment=require(_0x9123('0x2'));var BPromise=require(_0x9123('0x3'));var rs=require(_0x9123('0x4'));var fs=require('fs');var Redis=require(_0x9123('0x5'));var db=require(_0x9123('0x6'))['db'];var utils=require(_0x9123('0x7'));var logger=require(_0x9123('0x8'))(_0x9123('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9123('0xa')][_0x9123('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4639c3,_0x28efdd,_0x16516f){return new BPromise(function(_0x19f959,_0x22a7ca){return client[_0x9123('0xc')](_0x4639c3,_0x16516f)[_0x9123('0xd')](function(_0xcdf1f4){logger['info'](_0x9123('0xe'),_0x28efdd,'request\x20sent');logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x28efdd,_0x9123('0xf'),JSON[_0x9123('0x10')](_0xcdf1f4));if(_0xcdf1f4[_0x9123('0x11')]){if(_0xcdf1f4[_0x9123('0x11')]['code']===0x1f4){logger[_0x9123('0x11')](_0x9123('0xe'),_0x28efdd,_0xcdf1f4[_0x9123('0x11')][_0x9123('0x12')]);return _0x22a7ca(_0xcdf1f4[_0x9123('0x11')][_0x9123('0x12')]);}logger[_0x9123('0x11')](_0x9123('0xe'),_0x28efdd,_0xcdf1f4[_0x9123('0x11')][_0x9123('0x12')]);return _0x19f959(_0xcdf1f4[_0x9123('0x11')][_0x9123('0x12')]);}else{logger[_0x9123('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x28efdd,_0x9123('0xf'));_0x19f959(_0xcdf1f4[_0x9123('0x14')][_0x9123('0x12')]);}})[_0x9123('0x15')](function(_0x369db5){logger[_0x9123('0x11')](_0x9123('0xe'),_0x28efdd,_0x369db5);_0x22a7ca(_0x369db5);});});}exports[_0x9123('0x16')]=function(_0x5c00ab){var _0x531272=this;return new Promise(function(_0x52fdbd,_0x365637){return db[_0x9123('0x17')]['create'](_0x5c00ab[_0x9123('0x18')],{'raw':_0x5c00ab[_0x9123('0x19')]?_0x5c00ab['options'][_0x9123('0x1a')]===undefined?!![]:![]:!![]})[_0x9123('0xd')](function(_0x562670){logger['info'](_0x9123('0x16'),_0x5c00ab);logger[_0x9123('0x1b')](_0x9123('0x16'),_0x5c00ab,JSON[_0x9123('0x10')](_0x562670));_0x52fdbd(_0x562670);})[_0x9123('0x15')](function(_0x4dbcc6){logger[_0x9123('0x11')]('CreateCmHopperHistory',_0x4dbcc6[_0x9123('0x12')],_0x5c00ab);_0x365637(_0x531272[_0x9123('0x11')](0x1f4,_0x4dbcc6['message']));});});};exports[_0x9123('0x1c')]=function(_0x34aa5a){var _0x162661=this;return new Promise(function(_0x45df19,_0x5c7b72){return db['CmHopperHistory'][_0x9123('0x1d')]({'raw':_0x34aa5a[_0x9123('0x19')]?_0x34aa5a[_0x9123('0x19')][_0x9123('0x1a')]===undefined?!![]:![]:!![],'where':_0x34aa5a[_0x9123('0x19')]?_0x34aa5a[_0x9123('0x19')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x9123('0x1e'),db[_0x9123('0x1f')][_0x9123('0x20')]('id')),_0x9123('0x21')],[db[_0x9123('0x1f')]['fn'](_0x9123('0x1e'),db[_0x9123('0x1f')]['fn']('IF',db[_0x9123('0x1f')][_0x9123('0x22')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x9123('0x1f')]['fn']('COUNT',db[_0x9123('0x1f')]['fn']('IF',db[_0x9123('0x1f')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x9123('0x23')],[db[_0x9123('0x1f')]['fn'](_0x9123('0x1e'),db[_0x9123('0x1f')]['fn']('IF',db[_0x9123('0x1f')]['literal'](_0x9123('0x24')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x9123('0x1f')]['fn'](_0x9123('0x25'),db[_0x9123('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x9123('0x26')))),_0x9123('0x27')],[db[_0x9123('0x1f')]['fn']('AVG',db[_0x9123('0x1f')]['fn']('IF',db[_0x9123('0x1f')][_0x9123('0x22')](_0x9123('0x28')))),_0x9123('0x29')]]})[_0x9123('0xd')](function(_0x5cfda5){logger[_0x9123('0x13')](_0x9123('0x1c'),_0x34aa5a);logger[_0x9123('0x1b')](_0x9123('0x1c'),_0x34aa5a,JSON[_0x9123('0x10')](_0x5cfda5));_0x45df19(_0x5cfda5);})[_0x9123('0x15')](function(_0x35b4f8){logger[_0x9123('0x11')]('AvgHandleTime',_0x35b4f8[_0x9123('0x12')],_0x34aa5a);_0x5c7b72(_0x162661[_0x9123('0x11')](0x1f4,_0x35b4f8[_0x9123('0x12')]));});});};exports[_0x9123('0x2a')]=function(_0x571878){var _0x6f5116=this;return new Promise(function(_0x205b38,_0x28adbb){return db[_0x9123('0x17')][_0x9123('0x1d')]({'raw':_0x571878[_0x9123('0x19')]?_0x571878[_0x9123('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x571878[_0x9123('0x19')]?_0x571878[_0x9123('0x19')][_0x9123('0x2b')]||null:null,'attributes':[[_0x9123('0x2c'),_0x9123('0x2d')],[db['sequelize']['fn']('COUNT',db[_0x9123('0x1f')]['fn']('IF',db[_0x9123('0x1f')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x9123('0x2e')],[db[_0x9123('0x1f')]['fn'](_0x9123('0x1e'),db['sequelize']['fn']('IF',db[_0x9123('0x1f')][_0x9123('0x22')]('`state`\x20=\x203,\x201,\x20null'))),_0x9123('0x2f')],[db['sequelize']['fn'](_0x9123('0x1e'),db[_0x9123('0x1f')]['fn']('IF',db[_0x9123('0x1f')]['literal'](_0x9123('0x30')))),_0x9123('0x31')],[db['sequelize']['fn'](_0x9123('0x1e'),db[_0x9123('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x9123('0x32')],[db[_0x9123('0x1f')]['fn']('COUNT',db[_0x9123('0x1f')]['fn']('IF',db[_0x9123('0x1f')][_0x9123('0x22')](_0x9123('0x33')))),_0x9123('0x34')],[db[_0x9123('0x1f')]['fn'](_0x9123('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x9123('0x35')],[db[_0x9123('0x1f')]['fn']('COUNT',db[_0x9123('0x1f')]['fn']('IF',db[_0x9123('0x1f')][_0x9123('0x22')](_0x9123('0x36')))),_0x9123('0x37')],[db[_0x9123('0x1f')]['fn'](_0x9123('0x1e'),db[_0x9123('0x1f')]['fn']('IF',db['sequelize'][_0x9123('0x22')](_0x9123('0x38')))),_0x9123('0x39')],[db[_0x9123('0x1f')]['fn']('COUNT',db[_0x9123('0x1f')]['fn']('IF',db[_0x9123('0x1f')][_0x9123('0x22')](_0x9123('0x3a')))),_0x9123('0x3b')],[db[_0x9123('0x1f')]['fn'](_0x9123('0x1e'),db['sequelize']['fn']('IF',db[_0x9123('0x1f')][_0x9123('0x22')](_0x9123('0x3c')))),_0x9123('0x3d')],[db['sequelize']['fn']('COUNT',db[_0x9123('0x1f')]['fn']('IF',db['sequelize'][_0x9123('0x22')](_0x9123('0x3e')))),_0x9123('0x3f')],[db[_0x9123('0x1f')]['fn'](_0x9123('0x1e'),db[_0x9123('0x1f')]['fn']('IF',db[_0x9123('0x1f')][_0x9123('0x22')](_0x9123('0x40')))),_0x9123('0x41')],[db[_0x9123('0x1f')]['fn'](_0x9123('0x1e'),db[_0x9123('0x1f')]['fn']('IF',db['sequelize'][_0x9123('0x22')]('`state`\x20=\x2020,\x201,\x20null'))),_0x9123('0x3f')],[db[_0x9123('0x1f')]['fn']('COUNT',db[_0x9123('0x1f')]['fn']('IF',db[_0x9123('0x1f')]['literal'](_0x9123('0x42')))),_0x9123('0x43')]],'group':[_0x9123('0x2c')]})[_0x9123('0xd')](function(_0x59b92a){logger[_0x9123('0x13')](_0x9123('0x2a'),_0x571878);logger[_0x9123('0x1b')](_0x9123('0x2a'),_0x571878,JSON['stringify'](_0x59b92a));_0x205b38(_0x59b92a);})[_0x9123('0x15')](function(_0x4b041f){logger[_0x9123('0x11')]('GetVoiceQueueHopperHistory',_0x4b041f[_0x9123('0x12')],_0x571878);_0x28adbb(_0x6f5116[_0x9123('0x11')](0x1f4,_0x4b041f['message']));});});};exports[_0x9123('0x44')]=function(_0x5319cd){var _0x2e2126=this;return new Promise(function(_0x3107ec,_0x35fe9a){return db[_0x9123('0x17')][_0x9123('0x1d')]({'raw':_0x5319cd[_0x9123('0x19')]?_0x5319cd['options']['raw']===undefined?!![]:![]:!![],'where':_0x5319cd[_0x9123('0x19')]?_0x5319cd[_0x9123('0x19')][_0x9123('0x2b')]||null:null,'attributes':[[_0x9123('0x2c'),_0x9123('0x2d')],[db[_0x9123('0x1f')]['fn'](_0x9123('0x1e'),db[_0x9123('0x1f')][_0x9123('0x20')]('id')),_0x9123('0x45')],[db[_0x9123('0x1f')]['fn'](_0x9123('0x1e'),db['sequelize']['fn']('IF',db[_0x9123('0x1f')][_0x9123('0x22')](_0x9123('0x30')))),_0x9123('0x46')]],'group':[_0x9123('0x2c')]})['then'](function(_0x2a115c){logger['info'](_0x9123('0x44'),_0x5319cd);logger[_0x9123('0x1b')](_0x9123('0x44'),_0x5319cd,JSON[_0x9123('0x10')](_0x2a115c));_0x3107ec(_0x2a115c);})[_0x9123('0x15')](function(_0x43eb0b){logger[_0x9123('0x11')](_0x9123('0x44'),_0x43eb0b['message'],_0x5319cd);_0x35fe9a(_0x2e2126[_0x9123('0x11')](0x1f4,_0x43eb0b[_0x9123('0x12')]));});});}; \ No newline at end of file +var _0xc686=['findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundReCallsDay','ivrAnswerCallsDay','GetCampaignHopperHistory','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','message','CmHopperHistory,\x20%s,\x20%s','catch','CmHopperHistory','create','body','options','raw','CreateCmHopperHistory','stringify','AvgHandleTime'];(function(_0x1d7037,_0x57dd95){var _0x4d6568=function(_0x5c64c5){while(--_0x5c64c5){_0x1d7037['push'](_0x1d7037['shift']());}};_0x4d6568(++_0x57dd95);}(_0xc686,0x148));var _0x6c68=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xc686[_0x5b561d];return _0x431060;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6c68('0x0'));var BPromise=require('bluebird');var rs=require(_0x6c68('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c68('0x2'))['db'];var utils=require(_0x6c68('0x3'));var logger=require(_0x6c68('0x4'))(_0x6c68('0x5'));var config=require(_0x6c68('0x6'));var jayson=require(_0x6c68('0x7'));var client=jayson[_0x6c68('0x8')][_0x6c68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3dc035,_0x1e88b0,_0x12e935){return new BPromise(function(_0x394644,_0x5634c4){return client[_0x6c68('0xa')](_0x3dc035,_0x12e935)[_0x6c68('0xb')](function(_0x4ff2ce){logger[_0x6c68('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x1e88b0,_0x6c68('0xd'));logger[_0x6c68('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x1e88b0,_0x6c68('0xd'),JSON['stringify'](_0x4ff2ce));if(_0x4ff2ce[_0x6c68('0xf')]){if(_0x4ff2ce[_0x6c68('0xf')]['code']===0x1f4){logger[_0x6c68('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x1e88b0,_0x4ff2ce['error'][_0x6c68('0x10')]);return _0x5634c4(_0x4ff2ce['error'][_0x6c68('0x10')]);}logger[_0x6c68('0xf')](_0x6c68('0x11'),_0x1e88b0,_0x4ff2ce['error'][_0x6c68('0x10')]);return _0x394644(_0x4ff2ce[_0x6c68('0xf')][_0x6c68('0x10')]);}else{logger[_0x6c68('0xc')](_0x6c68('0x11'),_0x1e88b0,'request\x20sent');_0x394644(_0x4ff2ce['result']['message']);}})[_0x6c68('0x12')](function(_0x32cfd2){logger[_0x6c68('0xf')](_0x6c68('0x11'),_0x1e88b0,_0x32cfd2);_0x5634c4(_0x32cfd2);});});}exports['CreateCmHopperHistory']=function(_0x2cd5f6){var _0x16a4a0=this;return new Promise(function(_0x5045e3,_0x54a792){return db[_0x6c68('0x13')][_0x6c68('0x14')](_0x2cd5f6[_0x6c68('0x15')],{'raw':_0x2cd5f6['options']?_0x2cd5f6[_0x6c68('0x16')][_0x6c68('0x17')]===undefined?!![]:![]:!![]})[_0x6c68('0xb')](function(_0x29b74d){logger[_0x6c68('0xc')](_0x6c68('0x18'),_0x2cd5f6);logger[_0x6c68('0xe')](_0x6c68('0x18'),_0x2cd5f6,JSON[_0x6c68('0x19')](_0x29b74d));_0x5045e3(_0x29b74d);})[_0x6c68('0x12')](function(_0x5974e8){logger[_0x6c68('0xf')](_0x6c68('0x18'),_0x5974e8[_0x6c68('0x10')],_0x2cd5f6);_0x54a792(_0x16a4a0[_0x6c68('0xf')](0x1f4,_0x5974e8[_0x6c68('0x10')]));});});};exports[_0x6c68('0x1a')]=function(_0x3e680a){var _0x47560e=this;return new Promise(function(_0x2496db,_0xfd98ef){return db[_0x6c68('0x13')][_0x6c68('0x1b')]({'raw':_0x3e680a[_0x6c68('0x16')]?_0x3e680a[_0x6c68('0x16')][_0x6c68('0x17')]===undefined?!![]:![]:!![],'where':_0x3e680a[_0x6c68('0x16')]?_0x3e680a[_0x6c68('0x16')]['where']||null:null,'attributes':[[db[_0x6c68('0x1c')]['fn'](_0x6c68('0x1d'),db[_0x6c68('0x1c')][_0x6c68('0x1e')]('id')),_0x6c68('0x1f')],[db[_0x6c68('0x1c')]['fn'](_0x6c68('0x1d'),db[_0x6c68('0x1c')]['fn']('IF',db[_0x6c68('0x1c')]['literal'](_0x6c68('0x20')))),_0x6c68('0x21')],[db['sequelize']['fn'](_0x6c68('0x1d'),db[_0x6c68('0x1c')]['fn']('IF',db[_0x6c68('0x1c')]['literal'](_0x6c68('0x22')))),_0x6c68('0x23')],[db[_0x6c68('0x1c')]['fn']('COUNT',db[_0x6c68('0x1c')]['fn']('IF',db[_0x6c68('0x1c')][_0x6c68('0x24')](_0x6c68('0x25')))),_0x6c68('0x26')],[db[_0x6c68('0x1c')]['fn'](_0x6c68('0x27'),db[_0x6c68('0x1c')]['fn']('IF',db[_0x6c68('0x1c')][_0x6c68('0x24')](_0x6c68('0x28')))),_0x6c68('0x29')],[db[_0x6c68('0x1c')]['fn'](_0x6c68('0x27'),db[_0x6c68('0x1c')]['fn']('IF',db[_0x6c68('0x1c')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x6c68('0x2a')]]})[_0x6c68('0xb')](function(_0x214c0){logger[_0x6c68('0xc')](_0x6c68('0x1a'),_0x3e680a);logger['debug'](_0x6c68('0x1a'),_0x3e680a,JSON[_0x6c68('0x19')](_0x214c0));_0x2496db(_0x214c0);})[_0x6c68('0x12')](function(_0x37005a){logger[_0x6c68('0xf')](_0x6c68('0x1a'),_0x37005a['message'],_0x3e680a);_0xfd98ef(_0x47560e['error'](0x1f4,_0x37005a[_0x6c68('0x10')]));});});};exports[_0x6c68('0x2b')]=function(_0x4e6855){var _0x486867=this;return new Promise(function(_0x46c389,_0x4f782d){return db[_0x6c68('0x13')][_0x6c68('0x1b')]({'raw':_0x4e6855['options']?_0x4e6855[_0x6c68('0x16')][_0x6c68('0x17')]===undefined?!![]:![]:!![],'where':_0x4e6855[_0x6c68('0x16')]?_0x4e6855[_0x6c68('0x16')][_0x6c68('0x2c')]||null:null,'attributes':[[_0x6c68('0x2d'),_0x6c68('0x2e')],[db[_0x6c68('0x1c')]['fn'](_0x6c68('0x1d'),db[_0x6c68('0x1c')]['fn']('IF',db[_0x6c68('0x1c')][_0x6c68('0x24')](_0x6c68('0x2f')))),_0x6c68('0x30')],[db[_0x6c68('0x1c')]['fn'](_0x6c68('0x1d'),db[_0x6c68('0x1c')]['fn']('IF',db[_0x6c68('0x1c')][_0x6c68('0x24')](_0x6c68('0x31')))),_0x6c68('0x32')],[db[_0x6c68('0x1c')]['fn'](_0x6c68('0x1d'),db['sequelize']['fn']('IF',db[_0x6c68('0x1c')][_0x6c68('0x24')](_0x6c68('0x20')))),'outboundAnswerCallsDay'],[db[_0x6c68('0x1c')]['fn'](_0x6c68('0x1d'),db[_0x6c68('0x1c')]['fn']('IF',db[_0x6c68('0x1c')][_0x6c68('0x24')](_0x6c68('0x33')))),_0x6c68('0x34')],[db[_0x6c68('0x1c')]['fn'](_0x6c68('0x1d'),db[_0x6c68('0x1c')]['fn']('IF',db[_0x6c68('0x1c')][_0x6c68('0x24')](_0x6c68('0x35')))),_0x6c68('0x36')],[db[_0x6c68('0x1c')]['fn'](_0x6c68('0x1d'),db['sequelize']['fn']('IF',db[_0x6c68('0x1c')][_0x6c68('0x24')](_0x6c68('0x37')))),_0x6c68('0x38')],[db['sequelize']['fn'](_0x6c68('0x1d'),db[_0x6c68('0x1c')]['fn']('IF',db['sequelize'][_0x6c68('0x24')](_0x6c68('0x39')))),_0x6c68('0x3a')],[db['sequelize']['fn'](_0x6c68('0x1d'),db[_0x6c68('0x1c')]['fn']('IF',db[_0x6c68('0x1c')][_0x6c68('0x24')](_0x6c68('0x3b')))),_0x6c68('0x3c')],[db['sequelize']['fn'](_0x6c68('0x1d'),db['sequelize']['fn']('IF',db[_0x6c68('0x1c')]['literal'](_0x6c68('0x3d')))),'outboundBlacklistCallsDay'],[db[_0x6c68('0x1c')]['fn'](_0x6c68('0x1d'),db[_0x6c68('0x1c')]['fn']('IF',db[_0x6c68('0x1c')][_0x6c68('0x24')](_0x6c68('0x3e')))),_0x6c68('0x3f')],[db[_0x6c68('0x1c')]['fn']('COUNT',db[_0x6c68('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x6c68('0x40')))),_0x6c68('0x41')],[db[_0x6c68('0x1c')]['fn'](_0x6c68('0x1d'),db[_0x6c68('0x1c')]['fn']('IF',db['sequelize'][_0x6c68('0x24')](_0x6c68('0x42')))),_0x6c68('0x43')],[db['sequelize']['fn'](_0x6c68('0x1d'),db[_0x6c68('0x1c')]['fn']('IF',db[_0x6c68('0x1c')][_0x6c68('0x24')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x6c68('0x1c')]['fn'](_0x6c68('0x1d'),db['sequelize']['fn']('IF',db[_0x6c68('0x1c')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x6c68('0x44')]],'group':['campaign']})[_0x6c68('0xb')](function(_0x1cf860){logger[_0x6c68('0xc')]('GetVoiceQueueHopperHistory',_0x4e6855);logger['debug']('GetVoiceQueueHopperHistory',_0x4e6855,JSON[_0x6c68('0x19')](_0x1cf860));_0x46c389(_0x1cf860);})[_0x6c68('0x12')](function(_0x1bcd6d){logger[_0x6c68('0xf')](_0x6c68('0x2b'),_0x1bcd6d[_0x6c68('0x10')],_0x4e6855);_0x4f782d(_0x486867[_0x6c68('0xf')](0x1f4,_0x1bcd6d[_0x6c68('0x10')]));});});};exports['GetCampaignHopperHistory']=function(_0x9c8a89){var _0x5d4777=this;return new Promise(function(_0x63f159,_0x358056){return db[_0x6c68('0x13')][_0x6c68('0x1b')]({'raw':_0x9c8a89['options']?_0x9c8a89[_0x6c68('0x16')][_0x6c68('0x17')]===undefined?!![]:![]:!![],'where':_0x9c8a89['options']?_0x9c8a89[_0x6c68('0x16')][_0x6c68('0x2c')]||null:null,'attributes':[[_0x6c68('0x2d'),_0x6c68('0x2e')],[db[_0x6c68('0x1c')]['fn']('COUNT',db[_0x6c68('0x1c')][_0x6c68('0x1e')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x6c68('0x1d'),db['sequelize']['fn']('IF',db[_0x6c68('0x1c')][_0x6c68('0x24')](_0x6c68('0x20')))),_0x6c68('0x45')]],'group':[_0x6c68('0x2d')]})[_0x6c68('0xb')](function(_0x5b86d5){logger['info'](_0x6c68('0x46'),_0x9c8a89);logger[_0x6c68('0xe')](_0x6c68('0x46'),_0x9c8a89,JSON[_0x6c68('0x19')](_0x5b86d5));_0x63f159(_0x5b86d5);})[_0x6c68('0x12')](function(_0x214e0b){logger[_0x6c68('0xf')](_0x6c68('0x46'),_0x214e0b['message'],_0x9c8a89);_0x358056(_0x5d4777['error'](0x1f4,_0x214e0b['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 8f1b419..222621f 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 _0xab50=['show','post','create','update','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x117886,_0x98c46e){var _0x387bde=function(_0x475487){while(--_0x475487){_0x117886['push'](_0x117886['shift']());}};_0x387bde(++_0x98c46e);}(_0xab50,0x148));var _0x0ab5=function(_0x5aaa29,_0xa9c05e){_0x5aaa29=_0x5aaa29-0x0;var _0xe34275=_0xab50[_0x5aaa29];return _0xe34275;};'use strict';var multer=require('multer');var util=require(_0x0ab5('0x0'));var path=require(_0x0ab5('0x1'));var timeout=require(_0x0ab5('0x2'));var express=require('express');var router=express[_0x0ab5('0x3')]();var fs_extra=require(_0x0ab5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0ab5('0x5'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0x0ab5('0x6')]('/',auth[_0x0ab5('0x7')](),controller[_0x0ab5('0x8')]);router[_0x0ab5('0x6')](_0x0ab5('0x9'),auth[_0x0ab5('0x7')](),controller[_0x0ab5('0xa')]);router[_0x0ab5('0x6')](_0x0ab5('0xb'),auth[_0x0ab5('0x7')](),controller[_0x0ab5('0xc')]);router[_0x0ab5('0xd')]('/',auth[_0x0ab5('0x7')](),controller[_0x0ab5('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0ab5('0xf')]);module[_0x0ab5('0x10')]=router; \ No newline at end of file +var _0x7f85=['post','create','put','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','/describe','/:id'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0x7f85,0x174));var _0x57f8=function(_0x36d8ff,_0x224895){_0x36d8ff=_0x36d8ff-0x0;var _0x906ef5=_0x7f85[_0x36d8ff];return _0x906ef5;};'use strict';var multer=require(_0x57f8('0x0'));var util=require(_0x57f8('0x1'));var path=require('path');var timeout=require(_0x57f8('0x2'));var express=require(_0x57f8('0x3'));var router=express[_0x57f8('0x4')]();var fs_extra=require(_0x57f8('0x5'));var auth=require(_0x57f8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x57f8('0x7'));var controller=require(_0x57f8('0x8'));router['get']('/',auth[_0x57f8('0x9')](),controller['index']);router['get'](_0x57f8('0xa'),auth[_0x57f8('0x9')](),controller['describe']);router['get'](_0x57f8('0xb'),auth[_0x57f8('0x9')](),controller['show']);router[_0x57f8('0xc')]('/',auth['isAuthenticated'](),controller[_0x57f8('0xd')]);router[_0x57f8('0xe')]('/:id',auth[_0x57f8('0x9')](),controller['update']);module[_0x57f8('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 6746b70..70106ea 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 _0x9b67=['STRING','name','sequelize','exports'];(function(_0x171ff8,_0x33a90f){var _0x5ad879=function(_0x3250b6){while(--_0x3250b6){_0x171ff8['push'](_0x171ff8['shift']());}};_0x5ad879(++_0x33a90f);}(_0x9b67,0xf6));var _0x79b6=function(_0x491385,_0x34f885){_0x491385=_0x491385-0x0;var _0x3613ad=_0x9b67[_0x491385];return _0x3613ad;};'use strict';var Sequelize=require(_0x79b6('0x0'));module[_0x79b6('0x1')]={'name':{'type':Sequelize[_0x79b6('0x2')],'unique':_0x79b6('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x79b6('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7dfd=['STRING','name','sequelize','exports'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'unique':_0xd7df('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd7df('0x2')]},'dialPrefix':{'type':Sequelize[_0xd7df('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 119a9b0..1c6539d 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 _0xe925=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','Lists','name','index','map','CmList','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','findAll','rows','catch','show','params','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','Disposition','findOne','order','ListId','includeAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','format','cf_%d','raw','getContacts','getContactsCsv','ContactItemType','OrderBy','alias','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','additionalPhone_','select','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-type','text/csv','download','sequelize','addCustomFields','TEXT','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe925,0x99));var _0x5e92=function(_0x4558b9,_0x3f2a71){_0x4558b9=_0x4558b9-0x0;var _0x3e9d74=_0xe925[_0x4558b9];return _0x3e9d74;};'use strict';var emlformat=require(_0x5e92('0x0'));var rimraf=require(_0x5e92('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e92('0x2'));var rp=require('request-promise');var moment=require(_0x5e92('0x3'));var BPromise=require(_0x5e92('0x4'));var Mustache=require(_0x5e92('0x5'));var util=require('util');var path=require(_0x5e92('0x6'));var sox=require(_0x5e92('0x7'));var csv=require(_0x5e92('0x8'));var ejs=require(_0x5e92('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5e92('0xa'));var squel=require(_0x5e92('0xb'));var crypto=require(_0x5e92('0xc'));var jsforce=require(_0x5e92('0xd'));var deskjs=require(_0x5e92('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5e92('0xf'));var Papa=require(_0x5e92('0x10'));var Redis=require(_0x5e92('0x11'));var authService=require(_0x5e92('0x12'));var qs=require(_0x5e92('0x13'));var as=require(_0x5e92('0x14'));var hardwareService=require(_0x5e92('0x15'));var logger=require('../../config/logger')(_0x5e92('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5e92('0x17'));var db=require('../../mysqldb')['db'];var csv_results;config['redis']=_[_0x5e92('0x18')](config[_0x5e92('0x19')],{'host':_0x5e92('0x1a'),'port':0x18eb});var socket=require(_0x5e92('0x1b'))(new Redis(config[_0x5e92('0x19')]));require(_0x5e92('0x1c'))['register'](socket);function respondWithStatusCode(_0x5d57be,_0x3ddfa2){_0x3ddfa2=_0x3ddfa2||0xcc;return function(_0x972cc1){if(_0x972cc1){return _0x5d57be[_0x5e92('0x1d')](_0x3ddfa2);}return _0x5d57be[_0x5e92('0x1e')](_0x3ddfa2)[_0x5e92('0x1f')]();};}function respondWithResult(_0x4bf65e,_0x35f121){_0x35f121=_0x35f121||0xc8;return function(_0x371319){if(_0x371319){return _0x4bf65e[_0x5e92('0x1e')](_0x35f121)[_0x5e92('0x20')](_0x371319);}};}function respondWithFilteredResult(_0x1c220b,_0x1ed841){return function(_0x2e456f){if(_0x2e456f){var _0x35a32c=typeof _0x1ed841[_0x5e92('0x21')]==='undefined'&&typeof _0x1ed841[_0x5e92('0x22')]==='undefined';var _0x22dddc=_0x2e456f[_0x5e92('0x23')];var _0x5dd7c1=_0x35a32c?0x0:_0x1ed841[_0x5e92('0x21')];var _0x21705a=_0x35a32c?_0x2e456f['count']:_0x1ed841[_0x5e92('0x21')]+_0x1ed841['limit'];var _0x7ee6a5;if(_0x21705a>=_0x22dddc){_0x21705a=_0x22dddc;_0x7ee6a5=0xc8;}else{_0x7ee6a5=0xce;}_0x1c220b['status'](_0x7ee6a5);return _0x1c220b['set'](_0x5e92('0x24'),_0x5dd7c1+'-'+_0x21705a+'/'+_0x22dddc)[_0x5e92('0x20')](_0x2e456f);}return null;};}function patchUpdates(_0x1aefd9){return function(_0x354970){try{jsonpatch[_0x5e92('0x25')](_0x354970,_0x1aefd9,!![]);}catch(_0x2f26ad){return BPromise[_0x5e92('0x26')](_0x2f26ad);}return _0x354970[_0x5e92('0x27')]();};}function saveUpdates(_0x46da00,_0x13eccc){return function(_0x2716b4){if(_0x2716b4){return _0x2716b4[_0x5e92('0x28')](_0x46da00)['then'](function(_0x2dcb1a){return _0x2dcb1a;});}return null;};}function removeEntity(_0x462383,_0x4890d1){return function(_0x2c7ba0){if(_0x2c7ba0){return _0x2c7ba0[_0x5e92('0x29')]()[_0x5e92('0x2a')](function(){var _0xc517c=_0x2c7ba0[_0x5e92('0x2b')]({'plain':!![]});var _0x740e47=_0x5e92('0x2c');return db['UserProfileResource'][_0x5e92('0x29')]({'where':{'type':_0x740e47,'resourceId':_0xc517c['id']}})[_0x5e92('0x2a')](function(){return _0x2c7ba0;});})[_0x5e92('0x2a')](function(){_0x462383['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x292e01,_0x3537f4){return function(_0x503df1){if(!_0x503df1){_0x292e01[_0x5e92('0x1d')](0x194);}return _0x503df1;};}function handleError(_0x76c6e5,_0x5b71ce){_0x5b71ce=_0x5b71ce||0x1f4;return function(_0x1dcb3b){logger['error'](_0x1dcb3b['stack']);if(_0x1dcb3b[_0x5e92('0x2d')]){delete _0x1dcb3b[_0x5e92('0x2d')];}_0x76c6e5[_0x5e92('0x1e')](_0x5b71ce)['send'](_0x1dcb3b);};}exports[_0x5e92('0x2e')]=function(_0x259928,_0x4ddcd0){var _0x2f9a8d={},_0x3c5597={},_0x1c6f9f={'count':0x0,'rows':[]};var _0x1dda31=_[_0x5e92('0x2f')](db[_0x5e92('0x30')]['rawAttributes'],function(_0x41a6d2){return{'name':_0x41a6d2[_0x5e92('0x31')],'type':_0x41a6d2[_0x5e92('0x32')][_0x5e92('0x33')]};});_0x3c5597[_0x5e92('0x34')]=_[_0x5e92('0x2f')](_0x1dda31,_0x5e92('0x2d'));_0x3c5597[_0x5e92('0x35')]=_[_0x5e92('0x36')](_0x259928[_0x5e92('0x35')]);_0x3c5597[_0x5e92('0x37')]=_[_0x5e92('0x38')](_0x3c5597['model'],_0x3c5597[_0x5e92('0x35')]);_0x2f9a8d[_0x5e92('0x39')]=_[_0x5e92('0x38')](_0x3c5597[_0x5e92('0x34')],qs[_0x5e92('0x3a')](_0x259928[_0x5e92('0x35')][_0x5e92('0x3a')]));_0x2f9a8d[_0x5e92('0x39')]=_0x2f9a8d[_0x5e92('0x39')][_0x5e92('0x3b')]?_0x2f9a8d[_0x5e92('0x39')]:_0x3c5597[_0x5e92('0x34')];if(!_0x259928[_0x5e92('0x35')][_0x5e92('0x3c')](_0x5e92('0x3d'))){_0x2f9a8d['limit']=qs[_0x5e92('0x22')](_0x259928[_0x5e92('0x35')][_0x5e92('0x22')]);_0x2f9a8d[_0x5e92('0x21')]=qs[_0x5e92('0x21')](_0x259928[_0x5e92('0x35')][_0x5e92('0x21')]);}_0x2f9a8d['order']=qs[_0x5e92('0x3e')](_0x259928[_0x5e92('0x35')][_0x5e92('0x3e')]);_0x2f9a8d[_0x5e92('0x3f')]=qs['filters'](_[_0x5e92('0x40')](_0x259928[_0x5e92('0x35')],_0x3c5597[_0x5e92('0x37')]),_0x1dda31);if(_0x259928[_0x5e92('0x35')][_0x5e92('0x41')]){_0x2f9a8d[_0x5e92('0x3f')]=_[_0x5e92('0x42')](_0x2f9a8d[_0x5e92('0x3f')],{'$or':_[_0x5e92('0x2f')](_0x1dda31,function(_0x3947f5){if(_0x3947f5[_0x5e92('0x32')]!=='VIRTUAL'){var _0x316f60={};_0x316f60[_0x3947f5[_0x5e92('0x2d')]]={'$like':'%'+_0x259928['query']['filter']+'%'};return _0x316f60;}})});}_0x2f9a8d=_['merge']({},_0x2f9a8d,_0x259928[_0x5e92('0x43')]);var _0x1bcb63={'where':_0x2f9a8d[_0x5e92('0x3f')]};return db['CmList'][_0x5e92('0x23')](_0x1bcb63)[_0x5e92('0x2a')](function(_0x2bdcd5){_0x1c6f9f['count']=_0x2bdcd5;if(_0x259928[_0x5e92('0x35')]['includeAll']){_0x2f9a8d['include']=[{'all':!![]}];}return db[_0x5e92('0x30')][_0x5e92('0x44')](_0x2f9a8d);})[_0x5e92('0x2a')](function(_0x57e956){_0x1c6f9f[_0x5e92('0x45')]=_0x57e956;return _0x1c6f9f;})[_0x5e92('0x2a')](respondWithFilteredResult(_0x4ddcd0,_0x2f9a8d))[_0x5e92('0x46')](handleError(_0x4ddcd0,null));};exports[_0x5e92('0x47')]=function(_0x2e1bb0,_0x51c42f){var _0x5ba74b={'raw':![],'where':{'id':_0x2e1bb0[_0x5e92('0x48')]['id']}},_0x3f0244={};_0x3f0244[_0x5e92('0x34')]=_[_0x5e92('0x36')](db['CmList'][_0x5e92('0x49')]);_0x3f0244[_0x5e92('0x35')]=_[_0x5e92('0x36')](_0x2e1bb0[_0x5e92('0x35')]);_0x3f0244[_0x5e92('0x37')]=_[_0x5e92('0x38')](_0x3f0244[_0x5e92('0x34')],_0x3f0244[_0x5e92('0x35')]);_0x5ba74b[_0x5e92('0x39')]=_[_0x5e92('0x38')](_0x3f0244[_0x5e92('0x34')],qs[_0x5e92('0x3a')](_0x2e1bb0[_0x5e92('0x35')][_0x5e92('0x3a')]));_0x5ba74b[_0x5e92('0x39')]=_0x5ba74b['attributes'][_0x5e92('0x3b')]?_0x5ba74b[_0x5e92('0x39')]:_0x3f0244[_0x5e92('0x34')];if(_0x2e1bb0[_0x5e92('0x35')]['includeAll']){_0x5ba74b[_0x5e92('0x4a')]=[{'all':!![]}];}_0x5ba74b=_[_0x5e92('0x42')]({},_0x5ba74b,_0x2e1bb0[_0x5e92('0x43')]);return db['CmList']['find'](_0x5ba74b)[_0x5e92('0x2a')](handleEntityNotFound(_0x51c42f,null))[_0x5e92('0x2a')](respondWithResult(_0x51c42f,null))[_0x5e92('0x46')](handleError(_0x51c42f,null));};exports[_0x5e92('0x4b')]=function(_0x4ac923,_0x199857){return db[_0x5e92('0x30')][_0x5e92('0x4b')](_0x4ac923[_0x5e92('0x4c')],{})[_0x5e92('0x2a')](function(_0x3b0c07){var _0xd35ded=_0x4ac923[_0x5e92('0x4d')][_0x5e92('0x2b')]({'plain':!![]});if(!_0xd35ded)throw new Error(_0x5e92('0x4e'));if(_0xd35ded[_0x5e92('0x4f')]===_0x5e92('0x4d')){var _0x23b25c=_0x3b0c07[_0x5e92('0x2b')]({'plain':!![]});var _0x1ae7a6=_0x5e92('0x2c');return db[_0x5e92('0x50')]['find']({'where':{'name':_0x1ae7a6,'userProfileId':_0xd35ded[_0x5e92('0x51')]},'raw':!![]})[_0x5e92('0x2a')](function(_0x101341){if(_0x101341&&_0x101341[_0x5e92('0x52')]===0x0){return db[_0x5e92('0x53')]['create']({'name':_0x23b25c[_0x5e92('0x2d')],'resourceId':_0x23b25c['id'],'type':_0x101341[_0x5e92('0x2d')],'sectionId':_0x101341['id']},{})[_0x5e92('0x2a')](function(){return _0x3b0c07;});}else{return _0x3b0c07;}})[_0x5e92('0x46')](function(_0x239dce){logger[_0x5e92('0x54')](_0x5e92('0x55'),_0x239dce);throw _0x239dce;});}return _0x3b0c07;})[_0x5e92('0x2a')](respondWithResult(_0x199857,0xc9))['catch'](handleError(_0x199857,null));};exports[_0x5e92('0x28')]=function(_0x23f12e,_0x106758){if(_0x23f12e['body']['id']){delete _0x23f12e[_0x5e92('0x4c')]['id'];}return db['CmList']['find']({'where':{'id':_0x23f12e[_0x5e92('0x48')]['id']}})[_0x5e92('0x2a')](handleEntityNotFound(_0x106758,null))['then'](saveUpdates(_0x23f12e[_0x5e92('0x4c')],null))['then'](respondWithResult(_0x106758,null))[_0x5e92('0x46')](handleError(_0x106758,null));};exports[_0x5e92('0x29')]=function(_0x3e2f7b,_0x417161){return db[_0x5e92('0x30')][_0x5e92('0x56')]({'where':{'id':_0x3e2f7b['params']['id']}})[_0x5e92('0x2a')](handleEntityNotFound(_0x417161,null))[_0x5e92('0x2a')](removeEntity(_0x417161,null))[_0x5e92('0x46')](handleError(_0x417161,null));};exports[_0x5e92('0x57')]=function(_0xe23965,_0x54b6f2){return db[_0x5e92('0x30')][_0x5e92('0x57')]()[_0x5e92('0x2a')](respondWithResult(_0x54b6f2,null))[_0x5e92('0x46')](handleError(_0x54b6f2,null));};exports['addDisposition']=function(_0x25ccf9,_0x50ac23,_0x4af6ee){if(_0x25ccf9[_0x5e92('0x4c')]['id']){delete _0x25ccf9[_0x5e92('0x4c')]['id'];}return db['CmList']['find']({'where':{'id':_0x25ccf9[_0x5e92('0x48')]['id']}})[_0x5e92('0x2a')](handleEntityNotFound(_0x50ac23,null))[_0x5e92('0x2a')](function(_0x2e678d){if(_0x2e678d){_0x25ccf9['body']['ListId']=_0x2e678d['id'];return db[_0x5e92('0x58')][_0x5e92('0x4b')](_0x25ccf9[_0x5e92('0x4c')]);}})[_0x5e92('0x2a')](respondWithResult(_0x50ac23,null))[_0x5e92('0x46')](handleError(_0x50ac23,null));};exports['getDispositions']=function(_0xf5e2d8,_0x571846,_0x13e008){var _0xb47fe5={'raw':![],'where':{}};var _0x2fbdca={};var _0x2b3794={'count':0x0,'rows':[]};return db['CmList'][_0x5e92('0x59')]({'where':{'id':_0xf5e2d8[_0x5e92('0x48')]['id']}})[_0x5e92('0x2a')](handleEntityNotFound(_0x571846,null))['then'](function(_0x4ba4b9){if(_0x4ba4b9){_0x2fbdca['model']=_[_0x5e92('0x36')](db['Disposition']['rawAttributes']);_0x2fbdca['query']=_['keys'](_0xf5e2d8['query']);_0x2fbdca[_0x5e92('0x37')]=_[_0x5e92('0x38')](_0x2fbdca['model'],_0x2fbdca[_0x5e92('0x35')]);_0xb47fe5['attributes']=_[_0x5e92('0x38')](_0x2fbdca[_0x5e92('0x34')],qs['fields'](_0xf5e2d8[_0x5e92('0x35')][_0x5e92('0x3a')]));_0xb47fe5['attributes']=_0xb47fe5[_0x5e92('0x39')][_0x5e92('0x3b')]?_0xb47fe5['attributes']:_0x2fbdca[_0x5e92('0x34')];if(!_0xf5e2d8[_0x5e92('0x35')]['hasOwnProperty']('nolimit')){_0xb47fe5[_0x5e92('0x22')]=qs[_0x5e92('0x22')](_0xf5e2d8[_0x5e92('0x35')][_0x5e92('0x22')]);_0xb47fe5[_0x5e92('0x21')]=qs[_0x5e92('0x21')](_0xf5e2d8[_0x5e92('0x35')][_0x5e92('0x21')]);}_0xb47fe5[_0x5e92('0x5a')]=qs[_0x5e92('0x3e')](_0xf5e2d8[_0x5e92('0x35')][_0x5e92('0x3e')]);_0xb47fe5[_0x5e92('0x3f')]=qs[_0x5e92('0x37')](_[_0x5e92('0x40')](_0xf5e2d8[_0x5e92('0x35')],_0x2fbdca['filters']));_0xb47fe5[_0x5e92('0x3f')][_0x5e92('0x5b')]=_0x4ba4b9['id'];if(_0xf5e2d8[_0x5e92('0x35')]['filter']){_0xb47fe5[_0x5e92('0x3f')]=_[_0x5e92('0x42')](_0xb47fe5[_0x5e92('0x3f')],{'$or':_[_0x5e92('0x2f')](_0xb47fe5[_0x5e92('0x39')],function(_0x6bc272){var _0x3a5166={};_0x3a5166[_0x6bc272]={'$like':'%'+_0xf5e2d8['query'][_0x5e92('0x41')]+'%'};return _0x3a5166;})});}_0xb47fe5=_[_0x5e92('0x42')]({},_0xb47fe5,_0xf5e2d8[_0x5e92('0x43')]);return db[_0x5e92('0x58')][_0x5e92('0x23')]({'where':_0xb47fe5[_0x5e92('0x3f')]})[_0x5e92('0x2a')](function(_0x3228f6){_0x2b3794[_0x5e92('0x23')]=_0x3228f6;if(_0xf5e2d8[_0x5e92('0x35')][_0x5e92('0x5c')]){_0xb47fe5[_0x5e92('0x4a')]=[{'all':!![]}];}return db[_0x5e92('0x58')]['findAll'](_0xb47fe5);})[_0x5e92('0x2a')](function(_0x4aef7b){_0x2b3794[_0x5e92('0x45')]=_0x4aef7b;return _0x2b3794;});}})[_0x5e92('0x2a')](respondWithFilteredResult(_0x571846,_0xb47fe5))[_0x5e92('0x46')](handleError(_0x571846,null));};exports['removeDispositions']=function(_0xe83510,_0x9d867a,_0x184cc7){return db['CmList'][_0x5e92('0x56')]({'where':{'id':_0xe83510[_0x5e92('0x48')]['id']}})[_0x5e92('0x2a')](handleEntityNotFound(_0x9d867a,null))['then'](function(_0x31aa77){if(_0x31aa77){return _0x31aa77[_0x5e92('0x5d')](_0xe83510[_0x5e92('0x35')][_0x5e92('0x5e')]);}})[_0x5e92('0x2a')](respondWithStatusCode(_0x9d867a,null))[_0x5e92('0x46')](handleError(_0x9d867a,null));};exports[_0x5e92('0x5f')]=function(_0x3aa2e2,_0x721680,_0x7380f4){return db['CmList'][_0x5e92('0x56')]({'where':{'id':_0x3aa2e2[_0x5e92('0x48')]['id']}})[_0x5e92('0x2a')](handleEntityNotFound(_0x721680,null))['then'](function(_0x194103){if(_0x194103){var _0x54d0bb=[];var _0x35bcc5={'success':[],'errors':[]};return db[_0x5e92('0x60')][_0x5e92('0x57')]()['then'](function(_0x135ee1){if(_0x3aa2e2[_0x5e92('0x4c')][_0x5e92('0x61')]&&_['isArray'](_0x3aa2e2[_0x5e92('0x4c')]['tags'])){if(_0x3aa2e2[_0x5e92('0x4c')]['tags'][_0x5e92('0x3b')]){_0x3aa2e2[_0x5e92('0x4c')][_0x5e92('0x61')]=_0x3aa2e2[_0x5e92('0x4c')]['tags']['join'](';')+';';}else{_0x3aa2e2[_0x5e92('0x4c')]['tags']=null;}}else{_0x3aa2e2[_0x5e92('0x4c')][_0x5e92('0x61')]=null;}if(_0x3aa2e2[_0x5e92('0x4c')]&&_[_0x5e92('0x62')](_0x3aa2e2[_0x5e92('0x4c')])){for(var _0x520774=0x0;_0x520774<_0x3aa2e2[_0x5e92('0x4c')][_0x5e92('0x3b')];_0x520774+=0x1){_0x3aa2e2[_0x5e92('0x4c')][_0x520774][_0x5e92('0x5b')]=_0x3aa2e2[_0x5e92('0x48')]['id'];_0x54d0bb[_0x5e92('0x63')](_0x3aa2e2[_0x5e92('0x4c')][_0x520774]);}return BPromise[_0x5e92('0x64')](_0x54d0bb,function(_0x46012a){return db['CmContact'][_0x5e92('0x4b')](_[_0x5e92('0x65')](_0x46012a,['ids','id'])||{},{'fields':_['keys'](_0x135ee1),'raw':!![]})['then'](function(_0x57d1c4){_0x35bcc5[_0x5e92('0x66')][_0x5e92('0x63')](_0x57d1c4[_0x5e92('0x67')]);})['catch'](function(_0x5eab63){_0x35bcc5[_0x5e92('0x68')][_0x5e92('0x63')]({'data':_0x46012a,'error':_0x5eab63[_0x5e92('0x69')]});});})[_0x5e92('0x2a')](function(_0x1dc07f){return _0x35bcc5;})['catch'](function(_0x5b6e98){return _0x5b6e98;});}else{_0x721680[_0x5e92('0x1e')](0x190)[_0x5e92('0x20')]({'message':_0x5e92('0x6a')});}});}})[_0x5e92('0x2a')](respondWithResult(_0x721680,null))['catch'](handleError(_0x721680,null));};exports['getContacts']=function(_0x4059f1,_0x507337,_0x30e0ae){var _0x44782e;return db[_0x5e92('0x30')][_0x5e92('0x56')]({'where':{'id':_0x4059f1['params']['id']},'include':[{'model':db[_0x5e92('0x6b')],'as':_0x5e92('0x6c')}]})[_0x5e92('0x2a')](handleEntityNotFound(_0x507337,null))[_0x5e92('0x2a')](function(_0x32b358){if(_0x32b358){_0x44782e=_0x32b358;return db[_0x5e92('0x60')][_0x5e92('0x49')];}})[_0x5e92('0x2a')](function(_0x20d6ed){if(_0x20d6ed){var _0x3a37a7={};var _0x50f788={};_0x50f788['model']=_['concat'](_[_0x5e92('0x36')](_0x20d6ed),_['map'](_0x44782e['CustomFields'],function(_0x443488){return util[_0x5e92('0x6d')](_0x5e92('0x6e'),_0x443488['id']);}));_0x50f788[_0x5e92('0x35')]=_[_0x5e92('0x36')](_0x4059f1[_0x5e92('0x35')]);_0x50f788[_0x5e92('0x37')]=_[_0x5e92('0x38')](_0x50f788[_0x5e92('0x34')],_0x50f788[_0x5e92('0x35')]);_0x3a37a7['attributes']=_[_0x5e92('0x38')](_0x50f788[_0x5e92('0x34')],qs[_0x5e92('0x3a')](_0x4059f1[_0x5e92('0x35')][_0x5e92('0x3a')]));_0x3a37a7['attributes']=_0x3a37a7[_0x5e92('0x39')][_0x5e92('0x3b')]?_0x3a37a7['attributes']:_0x50f788[_0x5e92('0x34')];if(!_0x4059f1['query']['hasOwnProperty'](_0x5e92('0x3d'))){_0x3a37a7['limit']=qs[_0x5e92('0x22')](_0x4059f1[_0x5e92('0x35')][_0x5e92('0x22')]);_0x3a37a7[_0x5e92('0x21')]=qs[_0x5e92('0x21')](_0x4059f1[_0x5e92('0x35')][_0x5e92('0x21')]);}_0x3a37a7[_0x5e92('0x5a')]=qs[_0x5e92('0x3e')](_0x4059f1[_0x5e92('0x35')]['sort']);_0x3a37a7[_0x5e92('0x3f')]=qs[_0x5e92('0x37')](_[_0x5e92('0x40')](_0x4059f1[_0x5e92('0x35')],_0x50f788['filters']));_0x3a37a7[_0x5e92('0x6f')]=!![];if(_0x4059f1[_0x5e92('0x35')]['filter']){_0x3a37a7[_0x5e92('0x3f')]=_['merge'](_0x3a37a7['where'],{'$or':_['map'](_0x3a37a7['attributes'],function(_0x1dede1){var _0xf95d6={};_0xf95d6[_0x1dede1]={'$like':'%'+_0x4059f1[_0x5e92('0x35')][_0x5e92('0x41')]+'%'};return _0xf95d6;})});}_0x3a37a7=_[_0x5e92('0x42')]({},_0x3a37a7,_0x4059f1[_0x5e92('0x43')]);return _0x44782e[_0x5e92('0x70')](_0x3a37a7);}})[_0x5e92('0x2a')](respondWithResult(_0x507337,null))[_0x5e92('0x46')](handleError(_0x507337,null));};exports[_0x5e92('0x71')]=function(_0x12be33,_0x3b528d,_0x3d7009){var _0x33fec4;var _0x65288c;var _0x35bad5;var _0x4a70c1=_0x12be33[_0x5e92('0x48')]['id'];csv_results=[];return db[_0x5e92('0x72')]['findAll']({'attributes':['id',_0x5e92('0x2d')],'raw':!![],'order':[_0x5e92('0x73')]})[_0x5e92('0x2a')](function(_0x487640){_0x33fec4=_0x487640;var _0x157744=_[_0x5e92('0x36')](db['CmContact'][_0x5e92('0x49')]);return db[_0x5e92('0x6b')][_0x5e92('0x44')]({'raw':!![],'attributes':['id',_0x5e92('0x74')]})[_0x5e92('0x2a')](function(_0x52c337){_0x65288c=_0x52c337;var _0x2d7f1b=squel['select']()[_0x5e92('0x3a')](_0x157744)[_0x5e92('0x75')](_0x5e92('0x76'),'c')[_0x5e92('0x3f')]('c.ListId\x20=\x20?',_0x4a70c1)['where'](_0x5e92('0x77'))[_0x5e92('0x78')]();for(var _0xe4eec6=0x0;_0xe4eec6<_0x65288c[_0x5e92('0x3b')];_0xe4eec6++){_0x2d7f1b[_0x5e92('0x79')](_0x5e92('0x7a')+_0x65288c[_0xe4eec6]['id'],_0x5e92('0x7b')+_0x65288c[_0xe4eec6][_0x5e92('0x74')]);}for(var _0xe4eec6=0x0;_0xe4eec6<_0x33fec4[_0x5e92('0x3b')];_0xe4eec6++){_0x2d7f1b[_0x5e92('0x79')](squel['select']()[_0x5e92('0x79')](_0x5e92('0x7c'))[_0x5e92('0x75')]('cm_contact_has_items')[_0x5e92('0x3f')]('ItemTypeId\x20=\x20?',_0x33fec4[_0xe4eec6]['id'])[_0x5e92('0x3f')]('CmContactId\x20=\x20c.id'),_0x5e92('0x7d')+_0x33fec4[_0xe4eec6]['name']);_0x2d7f1b[_0x5e92('0x79')](squel[_0x5e92('0x7e')]()[_0x5e92('0x79')]('description')[_0x5e92('0x75')]('cm_contact_has_items')[_0x5e92('0x3f')]('ItemTypeId\x20=\x20?',_0x33fec4[_0xe4eec6]['id'])[_0x5e92('0x3f')](_0x5e92('0x7f')),_0x5e92('0x80')+_0x33fec4[_0xe4eec6]['name']);}var _0x2a79ce=[];_0x2a79ce[_0x5e92('0x63')](_0x2d7f1b[_0x5e92('0x81')]());BPromise[_0x5e92('0x64')](_0x2a79ce,handleQuery)[_0x5e92('0x2a')](function(_0x304ad8){handleQuery(_0x2d7f1b[_0x5e92('0x81')]());var _0x176616=csv_results[0x0];if(!_[_0x5e92('0x82')](_0x176616)){var _0x2271bb=toCsv(_0x176616);var _0x3ca2df=Date[_0x5e92('0x83')]();fs[_0x5e92('0x84')](util[_0x5e92('0x6d')](_0x5e92('0x85'),_0x4a70c1,_0x3ca2df),_0x2271bb);_0x3b528d[_0x5e92('0x86')]('Content-disposition','attachment;\x20filename='+util['format']('list_%d_%s.csv',_0x4a70c1,_0x3ca2df));_0x3b528d[_0x5e92('0x86')](_0x5e92('0x87'),_0x5e92('0x88'));return _0x3b528d[_0x5e92('0x89')](util[_0x5e92('0x6d')]('/tmp/list_%d_%s.csv',_0x4a70c1,_0x3ca2df));}else{return _0x3b528d[_0x5e92('0x1d')](0xcc);}});});});};exports['addCustomField']=function(_0x5df879,_0x1516af,_0xc1ff3d){var _0x11529f;delete _0x5df879['body']['id'];return db[_0x5e92('0x30')]['findOne']({'where':{'id':_0x5df879['params']['id']}})[_0x5e92('0x2a')](handleEntityNotFound(_0x1516af,null))[_0x5e92('0x2a')](function(_0x118938){if(_0x118938){return db[_0x5e92('0x8a')]['transaction'](function(_0x571746){return db[_0x5e92('0x6b')][_0x5e92('0x4b')](_0x5df879[_0x5e92('0x4c')],{'transaction':_0x571746})[_0x5e92('0x2a')](function(_0x4d509c){_0x11529f=_0x4d509c;return _0x118938[_0x5e92('0x8b')](_0x4d509c,{'transaction':_0x571746});})[_0x5e92('0x2a')](function(){var _0x403d97={'type':db['Sequelize'][_0x5e92('0x8c')],'transaction':_0x571746};switch(_0x5df879[_0x5e92('0x4c')][_0x5e92('0x32')]){case'text':_0x403d97[_0x5e92('0x32')]=db[_0x5e92('0x8d')][_0x5e92('0x8c')];break;case _0x5e92('0x8e'):_0x403d97[_0x5e92('0x32')]=db['Sequelize'][_0x5e92('0x8f')];break;case _0x5e92('0x90'):_0x403d97[_0x5e92('0x32')]=db[_0x5e92('0x8d')][_0x5e92('0x91')];_0x403d97[_0x5e92('0x92')]=![];break;default:}return db[_0x5e92('0x8a')][_0x5e92('0x93')]['addColumn'](_0x5e92('0x76'),util['format'](_0x5e92('0x94'),_0x11529f['id']),_0x403d97);})[_0x5e92('0x2a')](function(){return _0x11529f;});});}})[_0x5e92('0x2a')](respondWithResult(_0x1516af,null))[_0x5e92('0x46')](handleError(_0x1516af,null));};exports[_0x5e92('0x95')]=function(_0x33a6ca,_0x3f2762,_0x20ebd6){var _0x293cab={};var _0x496226={};var _0x4fd84f;var _0x38ea93;return db[_0x5e92('0x30')]['findOne']({'where':{'id':_0x33a6ca['params']['id']}})[_0x5e92('0x2a')](handleEntityNotFound(_0x3f2762,null))[_0x5e92('0x2a')](function(_0x5490bf){if(_0x5490bf){_0x4fd84f=_0x5490bf;_0x496226[_0x5e92('0x34')]=_['keys'](db[_0x5e92('0x6b')]['rawAttributes']);_0x496226['query']=_[_0x5e92('0x36')](_0x33a6ca['query']);_0x496226[_0x5e92('0x37')]=_[_0x5e92('0x38')](_0x496226['model'],_0x496226[_0x5e92('0x35')]);_0x293cab[_0x5e92('0x39')]=_['intersection'](_0x496226[_0x5e92('0x34')],qs['fields'](_0x33a6ca[_0x5e92('0x35')][_0x5e92('0x3a')]));_0x293cab[_0x5e92('0x39')]=_0x293cab[_0x5e92('0x39')][_0x5e92('0x3b')]?_0x293cab[_0x5e92('0x39')]:_0x496226[_0x5e92('0x34')];_0x293cab[_0x5e92('0x5a')]=qs['sort'](_0x33a6ca[_0x5e92('0x35')][_0x5e92('0x3e')]);_0x293cab[_0x5e92('0x3f')]=qs['filters'](_[_0x5e92('0x40')](_0x33a6ca[_0x5e92('0x35')],_0x496226['filters']));_0x293cab['where']=_[_0x5e92('0x42')](_0x293cab['where'],{'$or':[{'ListId':_0x5490bf['id']},{'ListId':null}]});if(_0x33a6ca['query'][_0x5e92('0x41')]){_0x293cab[_0x5e92('0x3f')]=_['merge'](_0x293cab[_0x5e92('0x3f')],{'$or':_[_0x5e92('0x2f')](_0x293cab['attributes'],function(_0x5c58b5){var _0x3919de={};_0x3919de[_0x5c58b5]={'$like':'%'+_0x33a6ca[_0x5e92('0x35')]['filter']+'%'};return _0x3919de;})});}_0x293cab=_['merge']({},_0x293cab,_0x33a6ca[_0x5e92('0x43')]);return db[_0x5e92('0x6b')][_0x5e92('0x96')](_0x293cab);}})[_0x5e92('0x2a')](respondWithResult(_0x3f2762,null))[_0x5e92('0x46')](handleError(_0x3f2762,null));};exports[_0x5e92('0x97')]=function(_0x9acd7b,_0x295d41){return db['CmCustomField'][_0x5e92('0x96')]({'where':{'ListId':null}})[_0x5e92('0x2a')](handleEntityNotFound(_0x295d41,null))['then'](function(_0x467e29){return _0x467e29;})[_0x5e92('0x2a')](respondWithResult(_0x295d41,null))['catch'](handleError(_0x295d41,null));};exports[_0x5e92('0x98')]=function(_0x3274f4,_0x2fb91c,_0x11b607){return db['CmList'][_0x5e92('0x56')]({'where':{'id':_0x3274f4['params']['id']}})[_0x5e92('0x2a')](handleEntityNotFound(_0x2fb91c,null))['then'](function(_0x528a46){if(_0x528a46){return _0x528a46[_0x5e92('0x98')](_0x3274f4['body']['ids'],_[_0x5e92('0x65')](_0x3274f4['body'],[_0x5e92('0x5e'),'id'])||{})[_0x5e92('0x99')](function(_0x5808b8){for(var _0x2856ff=0x0;_0x2856ff<_0x3274f4[_0x5e92('0x4c')][_0x5e92('0x5e')]['length'];_0x2856ff+=0x1){socket[_0x5e92('0x9a')](_0x5e92('0x9b'),{'UserId':Number(_0x3274f4[_0x5e92('0x4c')][_0x5e92('0x5e')][_0x2856ff]),'CmListId':Number(_0x3274f4[_0x5e92('0x48')]['id'])});}return _0x5808b8;});}})[_0x5e92('0x2a')](respondWithResult(_0x2fb91c,null))[_0x5e92('0x46')](handleError(_0x2fb91c,null));};exports[_0x5e92('0x9c')]=function(_0x27d52b,_0x1aacc8,_0x1ba56c){return db[_0x5e92('0x30')][_0x5e92('0x56')]({'where':{'id':_0x27d52b['params']['id']}})[_0x5e92('0x2a')](handleEntityNotFound(_0x1aacc8,null))['then'](function(_0x1b282f){if(_0x1b282f){return _0x1b282f['removeAgents'](_0x27d52b[_0x5e92('0x35')][_0x5e92('0x5e')])[_0x5e92('0x2a')](function(){if(_['isArray'](_0x27d52b[_0x5e92('0x35')]['ids'])){for(var _0x90f24=0x0;_0x90f24<_0x27d52b[_0x5e92('0x35')][_0x5e92('0x5e')][_0x5e92('0x3b')];_0x90f24+=0x1){socket[_0x5e92('0x9a')]('userCmList:remove',{'UserId':Number(_0x27d52b[_0x5e92('0x35')]['ids'][_0x90f24]),'CmListId':Number(_0x27d52b[_0x5e92('0x48')]['id'])});}}else{socket[_0x5e92('0x9a')](_0x5e92('0x9d'),{'UserId':Number(_0x27d52b[_0x5e92('0x35')][_0x5e92('0x5e')]),'CmListId':Number(_0x27d52b[_0x5e92('0x48')]['id'])});}});}})[_0x5e92('0x2a')](respondWithStatusCode(_0x1aacc8,null))[_0x5e92('0x46')](handleError(_0x1aacc8,null));};exports[_0x5e92('0x9e')]=function(_0x129149,_0x4ac921,_0xbd7eaf){var _0x3c5481={};var _0x597281={};var _0x306bf5;var _0x48e088;return db[_0x5e92('0x30')]['findOne']({'where':{'id':_0x129149[_0x5e92('0x48')]['id']}})[_0x5e92('0x2a')](handleEntityNotFound(_0x4ac921,null))[_0x5e92('0x2a')](function(_0x5155c9){if(_0x5155c9){_0x306bf5=_0x5155c9;_0x597281[_0x5e92('0x34')]=_[_0x5e92('0x36')](db[_0x5e92('0x9f')][_0x5e92('0x49')]);_0x597281[_0x5e92('0x35')]=_[_0x5e92('0x36')](_0x129149[_0x5e92('0x35')]);_0x597281[_0x5e92('0x37')]=_[_0x5e92('0x38')](_0x597281[_0x5e92('0x34')],_0x597281[_0x5e92('0x35')]);_0x3c5481[_0x5e92('0x39')]=_['intersection'](_0x597281[_0x5e92('0x34')],qs[_0x5e92('0x3a')](_0x129149[_0x5e92('0x35')][_0x5e92('0x3a')]));_0x3c5481[_0x5e92('0x39')]=_0x3c5481[_0x5e92('0x39')]['length']?_0x3c5481[_0x5e92('0x39')]:_0x597281[_0x5e92('0x34')];_0x3c5481[_0x5e92('0x5a')]=qs[_0x5e92('0x3e')](_0x129149[_0x5e92('0x35')][_0x5e92('0x3e')]);_0x3c5481['where']=qs[_0x5e92('0x37')](_['pick'](_0x129149[_0x5e92('0x35')],_0x597281[_0x5e92('0x37')]));if(_0x129149[_0x5e92('0x35')]['filter']){_0x3c5481[_0x5e92('0x3f')]=_[_0x5e92('0x42')](_0x3c5481['where'],{'$or':_[_0x5e92('0x2f')](_0x3c5481[_0x5e92('0x39')],function(_0x3fda06){var _0x2142db={};_0x2142db[_0x3fda06]={'$like':'%'+_0x129149[_0x5e92('0x35')]['filter']+'%'};return _0x2142db;})});}_0x3c5481=_[_0x5e92('0x42')]({},_0x3c5481,_0x129149[_0x5e92('0x43')]);return _0x306bf5['getAgents'](_0x3c5481);}})['then'](function(_0x14e369){if(_0x14e369){_0x48e088=_0x14e369[_0x5e92('0x3b')];if(!_0x129149[_0x5e92('0x35')][_0x5e92('0x3c')](_0x5e92('0x3d'))){_0x3c5481['limit']=qs['limit'](_0x129149[_0x5e92('0x35')][_0x5e92('0x22')]);_0x3c5481[_0x5e92('0x21')]=qs[_0x5e92('0x21')](_0x129149[_0x5e92('0x35')]['offset']);}return _0x306bf5[_0x5e92('0x9e')](_0x3c5481);}})[_0x5e92('0x2a')](function(_0x50e04d){if(_0x50e04d){return _0x50e04d?{'count':_0x48e088,'rows':_0x50e04d}:null;}})[_0x5e92('0x2a')](respondWithResult(_0x4ac921,null))[_0x5e92('0x46')](handleError(_0x4ac921,null));};function handleQuery(_0x3aa8fa){logger[_0x5e92('0xa0')](_0x3aa8fa);return db[_0x5e92('0x8a')][_0x5e92('0x35')](_0x3aa8fa)[_0x5e92('0x99')](function(_0x322cad){csv_results[_0x5e92('0x63')](_0x322cad);})['catch'](function(_0x35284e){logger[_0x5e92('0x54')](_0x35284e['message']);});} \ No newline at end of file +var _0x39c8=['show','rawAttributes','includeAll','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','filter','merge','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','format','cf_%d','hasOwnProperty','raw','getContactsCsv','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','customField_','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','toString','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','switch','defaultValue','queryInterface','findAndCountAll','addAgents','removeAgents','emit','userCmList:remove','getAgents','info','spread','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','get','Lists','UserProfileResource','destroy','name','send','index','CmList','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','type','VIRTUAL','findAll','rows','catch'];(function(_0x56d8b4,_0x3146a1){var _0x18e685=function(_0x162aa4){while(--_0x162aa4){_0x56d8b4['push'](_0x56d8b4['shift']());}};_0x18e685(++_0x3146a1);}(_0x39c8,0xe9));var _0x839c=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0x39c8[_0xdeefbd];return _0x4ff63f;};'use strict';var emlformat=require(_0x839c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x839c('0x1'));var jsonpatch=require(_0x839c('0x2'));var rp=require(_0x839c('0x3'));var moment=require('moment');var BPromise=require(_0x839c('0x4'));var Mustache=require(_0x839c('0x5'));var util=require(_0x839c('0x6'));var path=require(_0x839c('0x7'));var sox=require(_0x839c('0x8'));var csv=require(_0x839c('0x9'));var ejs=require(_0x839c('0xa'));var fs=require('fs');var fs_extra=require(_0x839c('0xb'));var _=require(_0x839c('0xc'));var squel=require(_0x839c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x839c('0x9'));var querystring=require('querystring');var Papa=require(_0x839c('0xe'));var Redis=require(_0x839c('0xf'));var authService=require(_0x839c('0x10'));var qs=require(_0x839c('0x11'));var as=require(_0x839c('0x12'));var hardwareService=require(_0x839c('0x13'));var logger=require(_0x839c('0x14'))(_0x839c('0x15'));var utils=require(_0x839c('0x16'));var config=require(_0x839c('0x17'));var licenseUtil=require(_0x839c('0x18'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x839c('0x19')]=_[_0x839c('0x1a')](config[_0x839c('0x19')],{'host':_0x839c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x839c('0x19')]));require('./cmList.socket')[_0x839c('0x1c')](socket);function respondWithStatusCode(_0x1238ca,_0x1e3882){_0x1e3882=_0x1e3882||0xcc;return function(_0x2c9330){if(_0x2c9330){return _0x1238ca[_0x839c('0x1d')](_0x1e3882);}return _0x1238ca[_0x839c('0x1e')](_0x1e3882)[_0x839c('0x1f')]();};}function respondWithResult(_0x41a5a4,_0x12249f){_0x12249f=_0x12249f||0xc8;return function(_0x4e325c){if(_0x4e325c){return _0x41a5a4[_0x839c('0x1e')](_0x12249f)[_0x839c('0x20')](_0x4e325c);}};}function respondWithFilteredResult(_0x25765a,_0x57a539){return function(_0x27b7a1){if(_0x27b7a1){var _0x71d082=typeof _0x57a539['offset']===_0x839c('0x21')&&typeof _0x57a539[_0x839c('0x22')]===_0x839c('0x21');var _0x4ed645=_0x27b7a1[_0x839c('0x23')];var _0x19d4fb=_0x71d082?0x0:_0x57a539[_0x839c('0x24')];var _0x4495e2=_0x71d082?_0x27b7a1[_0x839c('0x23')]:_0x57a539[_0x839c('0x24')]+_0x57a539[_0x839c('0x22')];var _0x44783d;if(_0x4495e2>=_0x4ed645){_0x4495e2=_0x4ed645;_0x44783d=0xc8;}else{_0x44783d=0xce;}_0x25765a[_0x839c('0x1e')](_0x44783d);return _0x25765a['set'](_0x839c('0x25'),_0x19d4fb+'-'+_0x4495e2+'/'+_0x4ed645)['json'](_0x27b7a1);}return null;};}function patchUpdates(_0x5d72e7){return function(_0x270965){try{jsonpatch[_0x839c('0x26')](_0x270965,_0x5d72e7,!![]);}catch(_0x2c5dbe){return BPromise[_0x839c('0x27')](_0x2c5dbe);}return _0x270965[_0x839c('0x28')]();};}function saveUpdates(_0x957686,_0x3bd086){return function(_0x1c01b2){if(_0x1c01b2){return _0x1c01b2[_0x839c('0x29')](_0x957686)[_0x839c('0x2a')](function(_0x115715){return _0x115715;});}return null;};}function removeEntity(_0x30a26d,_0x2c649d){return function(_0x48a238){if(_0x48a238){return _0x48a238['destroy']()[_0x839c('0x2a')](function(){var _0xfe1092=_0x48a238[_0x839c('0x2b')]({'plain':!![]});var _0x45d493=_0x839c('0x2c');return db[_0x839c('0x2d')][_0x839c('0x2e')]({'where':{'type':_0x45d493,'resourceId':_0xfe1092['id']}})[_0x839c('0x2a')](function(){return _0x48a238;});})['then'](function(){_0x30a26d['status'](0xcc)[_0x839c('0x1f')]();});}};}function handleEntityNotFound(_0x1a94f7,_0xa58f59){return function(_0x211625){if(!_0x211625){_0x1a94f7[_0x839c('0x1d')](0x194);}return _0x211625;};}function handleError(_0x2ff921,_0x5b2636){_0x5b2636=_0x5b2636||0x1f4;return function(_0x54d6b1){logger['error'](_0x54d6b1['stack']);if(_0x54d6b1[_0x839c('0x2f')]){delete _0x54d6b1[_0x839c('0x2f')];}_0x2ff921['status'](_0x5b2636)[_0x839c('0x30')](_0x54d6b1);};}exports[_0x839c('0x31')]=function(_0x55256d,_0x56d216){var _0x10d041={},_0x1e4458={},_0x2721af={'count':0x0,'rows':[]};var _0x43d15c=_['map'](db[_0x839c('0x32')]['rawAttributes'],function(_0x4c65e2){return{'name':_0x4c65e2['fieldName'],'type':_0x4c65e2['type'][_0x839c('0x33')]};});_0x1e4458[_0x839c('0x34')]=_[_0x839c('0x35')](_0x43d15c,_0x839c('0x2f'));_0x1e4458[_0x839c('0x36')]=_[_0x839c('0x37')](_0x55256d['query']);_0x1e4458['filters']=_[_0x839c('0x38')](_0x1e4458[_0x839c('0x34')],_0x1e4458[_0x839c('0x36')]);_0x10d041[_0x839c('0x39')]=_['intersection'](_0x1e4458[_0x839c('0x34')],qs[_0x839c('0x3a')](_0x55256d['query'][_0x839c('0x3a')]));_0x10d041[_0x839c('0x39')]=_0x10d041['attributes'][_0x839c('0x3b')]?_0x10d041['attributes']:_0x1e4458[_0x839c('0x34')];if(!_0x55256d[_0x839c('0x36')]['hasOwnProperty'](_0x839c('0x3c'))){_0x10d041[_0x839c('0x22')]=qs[_0x839c('0x22')](_0x55256d[_0x839c('0x36')][_0x839c('0x22')]);_0x10d041['offset']=qs[_0x839c('0x24')](_0x55256d['query'][_0x839c('0x24')]);}_0x10d041[_0x839c('0x3d')]=qs[_0x839c('0x3e')](_0x55256d[_0x839c('0x36')][_0x839c('0x3e')]);_0x10d041[_0x839c('0x3f')]=qs[_0x839c('0x40')](_[_0x839c('0x41')](_0x55256d[_0x839c('0x36')],_0x1e4458[_0x839c('0x40')]),_0x43d15c);if(_0x55256d['query']['filter']){_0x10d041[_0x839c('0x3f')]=_['merge'](_0x10d041[_0x839c('0x3f')],{'$or':_['map'](_0x43d15c,function(_0x3878d4){if(_0x3878d4[_0x839c('0x42')]!==_0x839c('0x43')){var _0x3f7124={};_0x3f7124[_0x3878d4[_0x839c('0x2f')]]={'$like':'%'+_0x55256d[_0x839c('0x36')]['filter']+'%'};return _0x3f7124;}})});}_0x10d041=_['merge']({},_0x10d041,_0x55256d['options']);var _0x46b37e={'where':_0x10d041[_0x839c('0x3f')]};return db['CmList'][_0x839c('0x23')](_0x46b37e)[_0x839c('0x2a')](function(_0x5a30f7){_0x2721af[_0x839c('0x23')]=_0x5a30f7;if(_0x55256d[_0x839c('0x36')]['includeAll']){_0x10d041['include']=[{'all':!![]}];}return db[_0x839c('0x32')][_0x839c('0x44')](_0x10d041);})[_0x839c('0x2a')](function(_0xc6c1f3){_0x2721af[_0x839c('0x45')]=_0xc6c1f3;return _0x2721af;})[_0x839c('0x2a')](respondWithFilteredResult(_0x56d216,_0x10d041))[_0x839c('0x46')](handleError(_0x56d216,null));};exports[_0x839c('0x47')]=function(_0x4c03a9,_0x30c060){var _0x25d289={'raw':![],'where':{'id':_0x4c03a9['params']['id']}},_0x2fb1aa={};_0x2fb1aa['model']=_[_0x839c('0x37')](db['CmList'][_0x839c('0x48')]);_0x2fb1aa[_0x839c('0x36')]=_[_0x839c('0x37')](_0x4c03a9[_0x839c('0x36')]);_0x2fb1aa['filters']=_[_0x839c('0x38')](_0x2fb1aa[_0x839c('0x34')],_0x2fb1aa[_0x839c('0x36')]);_0x25d289['attributes']=_[_0x839c('0x38')](_0x2fb1aa[_0x839c('0x34')],qs[_0x839c('0x3a')](_0x4c03a9['query'][_0x839c('0x3a')]));_0x25d289[_0x839c('0x39')]=_0x25d289[_0x839c('0x39')][_0x839c('0x3b')]?_0x25d289[_0x839c('0x39')]:_0x2fb1aa[_0x839c('0x34')];if(_0x4c03a9[_0x839c('0x36')][_0x839c('0x49')]){_0x25d289[_0x839c('0x4a')]=[{'all':!![]}];}_0x25d289=_['merge']({},_0x25d289,_0x4c03a9[_0x839c('0x4b')]);return db[_0x839c('0x32')]['find'](_0x25d289)[_0x839c('0x2a')](handleEntityNotFound(_0x30c060,null))[_0x839c('0x2a')](respondWithResult(_0x30c060,null))['catch'](handleError(_0x30c060,null));};exports[_0x839c('0x4c')]=function(_0x476995,_0x3d6c92){return db[_0x839c('0x32')][_0x839c('0x4c')](_0x476995[_0x839c('0x4d')],{})[_0x839c('0x2a')](function(_0x18afbd){var _0x7a9442=_0x476995[_0x839c('0x4e')][_0x839c('0x2b')]({'plain':!![]});if(!_0x7a9442)throw new Error(_0x839c('0x4f'));if(_0x7a9442[_0x839c('0x50')]==='user'){var _0x19aa45=_0x18afbd[_0x839c('0x2b')]({'plain':!![]});var _0x17e7a9=_0x839c('0x2c');return db[_0x839c('0x51')][_0x839c('0x52')]({'where':{'name':_0x17e7a9,'userProfileId':_0x7a9442['userProfileId']},'raw':!![]})['then'](function(_0x466a4c){if(_0x466a4c&&_0x466a4c['autoAssociation']===0x0){return db[_0x839c('0x2d')][_0x839c('0x4c')]({'name':_0x19aa45[_0x839c('0x2f')],'resourceId':_0x19aa45['id'],'type':_0x466a4c['name'],'sectionId':_0x466a4c['id']},{})['then'](function(){return _0x18afbd;});}else{return _0x18afbd;}})[_0x839c('0x46')](function(_0x5b56f5){logger[_0x839c('0x53')](_0x839c('0x54'),_0x5b56f5);throw _0x5b56f5;});}return _0x18afbd;})['then'](respondWithResult(_0x3d6c92,0xc9))['catch'](handleError(_0x3d6c92,null));};exports['update']=function(_0x30a886,_0x48e4d9){if(_0x30a886['body']['id']){delete _0x30a886[_0x839c('0x4d')]['id'];}return db[_0x839c('0x32')][_0x839c('0x52')]({'where':{'id':_0x30a886[_0x839c('0x55')]['id']}})[_0x839c('0x2a')](handleEntityNotFound(_0x48e4d9,null))[_0x839c('0x2a')](saveUpdates(_0x30a886['body'],null))['then'](respondWithResult(_0x48e4d9,null))[_0x839c('0x46')](handleError(_0x48e4d9,null));};exports[_0x839c('0x2e')]=function(_0x156546,_0x4a646c){return db[_0x839c('0x32')][_0x839c('0x52')]({'where':{'id':_0x156546[_0x839c('0x55')]['id']}})[_0x839c('0x2a')](handleEntityNotFound(_0x4a646c,null))[_0x839c('0x2a')](removeEntity(_0x4a646c,null))['catch'](handleError(_0x4a646c,null));};exports[_0x839c('0x56')]=function(_0x1a9794,_0x19ea68){return db[_0x839c('0x32')][_0x839c('0x56')]()['then'](respondWithResult(_0x19ea68,null))[_0x839c('0x46')](handleError(_0x19ea68,null));};exports[_0x839c('0x57')]=function(_0x6e3ca0,_0x363da6,_0x13c8af){if(_0x6e3ca0['body']['id']){delete _0x6e3ca0[_0x839c('0x4d')]['id'];}return db[_0x839c('0x32')][_0x839c('0x52')]({'where':{'id':_0x6e3ca0[_0x839c('0x55')]['id']}})[_0x839c('0x2a')](handleEntityNotFound(_0x363da6,null))[_0x839c('0x2a')](function(_0x49877b){if(_0x49877b){_0x6e3ca0[_0x839c('0x4d')][_0x839c('0x58')]=_0x49877b['id'];return db[_0x839c('0x59')]['create'](_0x6e3ca0[_0x839c('0x4d')]);}})[_0x839c('0x2a')](respondWithResult(_0x363da6,null))[_0x839c('0x46')](handleError(_0x363da6,null));};exports[_0x839c('0x5a')]=function(_0x52480d,_0x498f1a,_0x5a6922){var _0x155d00={'raw':![],'where':{}};var _0x1ff94c={};var _0x54508b={'count':0x0,'rows':[]};return db['CmList'][_0x839c('0x5b')]({'where':{'id':_0x52480d[_0x839c('0x55')]['id']}})[_0x839c('0x2a')](handleEntityNotFound(_0x498f1a,null))[_0x839c('0x2a')](function(_0x32d044){if(_0x32d044){_0x1ff94c[_0x839c('0x34')]=_[_0x839c('0x37')](db[_0x839c('0x59')][_0x839c('0x48')]);_0x1ff94c['query']=_['keys'](_0x52480d[_0x839c('0x36')]);_0x1ff94c['filters']=_['intersection'](_0x1ff94c[_0x839c('0x34')],_0x1ff94c[_0x839c('0x36')]);_0x155d00[_0x839c('0x39')]=_[_0x839c('0x38')](_0x1ff94c[_0x839c('0x34')],qs[_0x839c('0x3a')](_0x52480d['query']['fields']));_0x155d00['attributes']=_0x155d00['attributes']['length']?_0x155d00[_0x839c('0x39')]:_0x1ff94c['model'];if(!_0x52480d['query']['hasOwnProperty'](_0x839c('0x3c'))){_0x155d00[_0x839c('0x22')]=qs[_0x839c('0x22')](_0x52480d[_0x839c('0x36')][_0x839c('0x22')]);_0x155d00[_0x839c('0x24')]=qs[_0x839c('0x24')](_0x52480d[_0x839c('0x36')][_0x839c('0x24')]);}_0x155d00[_0x839c('0x3d')]=qs[_0x839c('0x3e')](_0x52480d[_0x839c('0x36')][_0x839c('0x3e')]);_0x155d00['where']=qs[_0x839c('0x40')](_['pick'](_0x52480d[_0x839c('0x36')],_0x1ff94c['filters']));_0x155d00[_0x839c('0x3f')][_0x839c('0x58')]=_0x32d044['id'];if(_0x52480d[_0x839c('0x36')][_0x839c('0x5c')]){_0x155d00[_0x839c('0x3f')]=_['merge'](_0x155d00[_0x839c('0x3f')],{'$or':_['map'](_0x155d00[_0x839c('0x39')],function(_0x188eb7){var _0x49a720={};_0x49a720[_0x188eb7]={'$like':'%'+_0x52480d[_0x839c('0x36')][_0x839c('0x5c')]+'%'};return _0x49a720;})});}_0x155d00=_[_0x839c('0x5d')]({},_0x155d00,_0x52480d[_0x839c('0x4b')]);return db['Disposition']['count']({'where':_0x155d00[_0x839c('0x3f')]})['then'](function(_0x50a147){_0x54508b['count']=_0x50a147;if(_0x52480d[_0x839c('0x36')][_0x839c('0x49')]){_0x155d00[_0x839c('0x4a')]=[{'all':!![]}];}return db[_0x839c('0x59')]['findAll'](_0x155d00);})[_0x839c('0x2a')](function(_0xe9aa7f){_0x54508b[_0x839c('0x45')]=_0xe9aa7f;return _0x54508b;});}})[_0x839c('0x2a')](respondWithFilteredResult(_0x498f1a,_0x155d00))['catch'](handleError(_0x498f1a,null));};exports[_0x839c('0x5e')]=function(_0x2b7834,_0x38d7b8,_0x45903c){return db[_0x839c('0x32')][_0x839c('0x52')]({'where':{'id':_0x2b7834[_0x839c('0x55')]['id']}})[_0x839c('0x2a')](handleEntityNotFound(_0x38d7b8,null))[_0x839c('0x2a')](function(_0x436440){if(_0x436440){return _0x436440['removeDispositions'](_0x2b7834[_0x839c('0x36')][_0x839c('0x5f')]);}})[_0x839c('0x2a')](respondWithStatusCode(_0x38d7b8,null))[_0x839c('0x46')](handleError(_0x38d7b8,null));};exports[_0x839c('0x60')]=function(_0x170990,_0x8baff,_0x5cb24f){return db[_0x839c('0x32')][_0x839c('0x52')]({'where':{'id':_0x170990[_0x839c('0x55')]['id']}})[_0x839c('0x2a')](handleEntityNotFound(_0x8baff,null))[_0x839c('0x2a')](function(_0x26e6bb){if(_0x26e6bb){var _0x2df755=[];var _0x2ba5af={'success':[],'errors':[]};return db[_0x839c('0x61')]['describe']()[_0x839c('0x2a')](function(_0x406721){if(_0x170990['body'][_0x839c('0x62')]&&_[_0x839c('0x63')](_0x170990['body'][_0x839c('0x62')])){if(_0x170990[_0x839c('0x4d')]['tags'][_0x839c('0x3b')]){_0x170990[_0x839c('0x4d')]['tags']=_0x170990[_0x839c('0x4d')][_0x839c('0x62')][_0x839c('0x64')](';')+';';}else{_0x170990[_0x839c('0x4d')][_0x839c('0x62')]=null;}}else{_0x170990[_0x839c('0x4d')]['tags']=null;}if(_0x170990['body']&&_['isArray'](_0x170990[_0x839c('0x4d')])){for(var _0x4e1142=0x0;_0x4e1142<_0x170990[_0x839c('0x4d')][_0x839c('0x3b')];_0x4e1142+=0x1){_0x170990[_0x839c('0x4d')][_0x4e1142][_0x839c('0x58')]=_0x170990['params']['id'];_0x2df755[_0x839c('0x65')](_0x170990[_0x839c('0x4d')][_0x4e1142]);}return BPromise[_0x839c('0x66')](_0x2df755,function(_0x1dee78){return db[_0x839c('0x61')][_0x839c('0x4c')](_[_0x839c('0x67')](_0x1dee78,[_0x839c('0x5f'),'id'])||{},{'fields':_[_0x839c('0x37')](_0x406721),'raw':!![]})['then'](function(_0x11ddd5){_0x2ba5af[_0x839c('0x68')][_0x839c('0x65')](_0x11ddd5[_0x839c('0x69')]);})[_0x839c('0x46')](function(_0x336edd){_0x2ba5af[_0x839c('0x6a')]['push']({'data':_0x1dee78,'error':_0x336edd[_0x839c('0x6b')]});});})[_0x839c('0x2a')](function(_0x295e15){return _0x2ba5af;})['catch'](function(_0x540c59){return _0x540c59;});}else{_0x8baff[_0x839c('0x1e')](0x190)[_0x839c('0x20')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x839c('0x2a')](respondWithResult(_0x8baff,null))['catch'](handleError(_0x8baff,null));};exports[_0x839c('0x6c')]=function(_0x5eac1b,_0x5e030a,_0x1f9b2){var _0x165b58;return db['CmList'][_0x839c('0x52')]({'where':{'id':_0x5eac1b[_0x839c('0x55')]['id']},'include':[{'model':db[_0x839c('0x6d')],'as':_0x839c('0x6e')}]})[_0x839c('0x2a')](handleEntityNotFound(_0x5e030a,null))['then'](function(_0x5e9f98){if(_0x5e9f98){_0x165b58=_0x5e9f98;return db[_0x839c('0x61')][_0x839c('0x48')];}})[_0x839c('0x2a')](function(_0x55a52a){if(_0x55a52a){var _0xdd97c5={};var _0x669b16={};_0x669b16['model']=_['concat'](_['keys'](_0x55a52a),_[_0x839c('0x35')](_0x165b58[_0x839c('0x6e')],function(_0x1d7cc0){return util[_0x839c('0x6f')](_0x839c('0x70'),_0x1d7cc0['id']);}));_0x669b16['query']=_[_0x839c('0x37')](_0x5eac1b[_0x839c('0x36')]);_0x669b16[_0x839c('0x40')]=_['intersection'](_0x669b16[_0x839c('0x34')],_0x669b16[_0x839c('0x36')]);_0xdd97c5[_0x839c('0x39')]=_[_0x839c('0x38')](_0x669b16[_0x839c('0x34')],qs[_0x839c('0x3a')](_0x5eac1b[_0x839c('0x36')][_0x839c('0x3a')]));_0xdd97c5[_0x839c('0x39')]=_0xdd97c5[_0x839c('0x39')][_0x839c('0x3b')]?_0xdd97c5['attributes']:_0x669b16[_0x839c('0x34')];if(!_0x5eac1b[_0x839c('0x36')][_0x839c('0x71')]('nolimit')){_0xdd97c5[_0x839c('0x22')]=qs[_0x839c('0x22')](_0x5eac1b['query']['limit']);_0xdd97c5['offset']=qs[_0x839c('0x24')](_0x5eac1b['query'][_0x839c('0x24')]);}_0xdd97c5[_0x839c('0x3d')]=qs[_0x839c('0x3e')](_0x5eac1b[_0x839c('0x36')][_0x839c('0x3e')]);_0xdd97c5[_0x839c('0x3f')]=qs[_0x839c('0x40')](_[_0x839c('0x41')](_0x5eac1b[_0x839c('0x36')],_0x669b16[_0x839c('0x40')]));_0xdd97c5[_0x839c('0x72')]=!![];if(_0x5eac1b[_0x839c('0x36')][_0x839c('0x5c')]){_0xdd97c5[_0x839c('0x3f')]=_[_0x839c('0x5d')](_0xdd97c5[_0x839c('0x3f')],{'$or':_[_0x839c('0x35')](_0xdd97c5[_0x839c('0x39')],function(_0x16cd36){var _0x2f31e1={};_0x2f31e1[_0x16cd36]={'$like':'%'+_0x5eac1b['query'][_0x839c('0x5c')]+'%'};return _0x2f31e1;})});}_0xdd97c5=_[_0x839c('0x5d')]({},_0xdd97c5,_0x5eac1b[_0x839c('0x4b')]);return _0x165b58[_0x839c('0x6c')](_0xdd97c5);}})['then'](respondWithResult(_0x5e030a,null))[_0x839c('0x46')](handleError(_0x5e030a,null));};exports[_0x839c('0x73')]=function(_0x46ae29,_0x5553af,_0x17d4b3){var _0x2c92e4;var _0x33058e;var _0x374c7e;var _0x33b9f3=_0x46ae29[_0x839c('0x55')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id','name'],'raw':!![],'order':['OrderBy']})[_0x839c('0x2a')](function(_0x36f783){_0x2c92e4=_0x36f783;var _0x49d013=_[_0x839c('0x37')](db[_0x839c('0x61')][_0x839c('0x48')]);return db[_0x839c('0x6d')][_0x839c('0x44')]({'raw':!![],'attributes':['id',_0x839c('0x74')]})[_0x839c('0x2a')](function(_0x4dba78){_0x33058e=_0x4dba78;var _0xea46cc=squel[_0x839c('0x75')]()[_0x839c('0x3a')](_0x49d013)[_0x839c('0x76')](_0x839c('0x77'),'c')[_0x839c('0x3f')](_0x839c('0x78'),_0x33b9f3)[_0x839c('0x3f')](_0x839c('0x79'))[_0x839c('0x7a')]();for(var _0x4dfd55=0x0;_0x4dfd55<_0x33058e[_0x839c('0x3b')];_0x4dfd55++){_0xea46cc[_0x839c('0x7b')]('c.cf_'+_0x33058e[_0x4dfd55]['id'],_0x839c('0x7c')+_0x33058e[_0x4dfd55][_0x839c('0x74')]);}for(var _0x4dfd55=0x0;_0x4dfd55<_0x2c92e4['length'];_0x4dfd55++){_0xea46cc[_0x839c('0x7b')](squel['select']()[_0x839c('0x7b')]('item')[_0x839c('0x76')](_0x839c('0x7d'))['where'](_0x839c('0x7e'),_0x2c92e4[_0x4dfd55]['id'])['where'](_0x839c('0x7f')),'additionalPhone_'+_0x2c92e4[_0x4dfd55]['name']);_0xea46cc[_0x839c('0x7b')](squel[_0x839c('0x75')]()['field'](_0x839c('0x80'))[_0x839c('0x76')](_0x839c('0x7d'))['where']('ItemTypeId\x20=\x20?',_0x2c92e4[_0x4dfd55]['id'])[_0x839c('0x3f')](_0x839c('0x7f')),'description_additionalPhone_'+_0x2c92e4[_0x4dfd55][_0x839c('0x2f')]);}var _0x596433=[];_0x596433[_0x839c('0x65')](_0xea46cc[_0x839c('0x81')]());BPromise['each'](_0x596433,handleQuery)['then'](function(_0x2eff80){handleQuery(_0xea46cc[_0x839c('0x81')]());var _0x5f09f4=csv_results[0x0];if(!_['isEmpty'](_0x5f09f4)){var _0x528e9a=toCsv(_0x5f09f4);var _0x453dfd=Date['now']();fs['writeFileSync'](util['format'](_0x839c('0x82'),_0x33b9f3,_0x453dfd),_0x528e9a);_0x5553af[_0x839c('0x83')](_0x839c('0x84'),_0x839c('0x85')+util['format']('list_%d_%s.csv',_0x33b9f3,_0x453dfd));_0x5553af['setHeader']('Content-type','text/csv');return _0x5553af[_0x839c('0x86')](util[_0x839c('0x6f')](_0x839c('0x82'),_0x33b9f3,_0x453dfd));}else{return _0x5553af[_0x839c('0x1d')](0xcc);}});});});};exports[_0x839c('0x87')]=function(_0x2a8366,_0x5651cd,_0x3f8c5d){var _0x61c1e4;delete _0x2a8366[_0x839c('0x4d')]['id'];return db['CmList'][_0x839c('0x5b')]({'where':{'id':_0x2a8366[_0x839c('0x55')]['id']}})[_0x839c('0x2a')](handleEntityNotFound(_0x5651cd,null))['then'](function(_0x5c3045){if(_0x5c3045){return db[_0x839c('0x88')][_0x839c('0x89')](function(_0x37bad3){return db[_0x839c('0x6d')]['create'](_0x2a8366[_0x839c('0x4d')],{'transaction':_0x37bad3})['then'](function(_0x277e47){_0x61c1e4=_0x277e47;return _0x5c3045[_0x839c('0x8a')](_0x277e47,{'transaction':_0x37bad3});})['then'](function(){var _0x349c5a={'type':db[_0x839c('0x8b')]['TEXT'],'transaction':_0x37bad3};switch(_0x2a8366[_0x839c('0x4d')][_0x839c('0x42')]){case'text':_0x349c5a[_0x839c('0x42')]=db[_0x839c('0x8b')][_0x839c('0x8c')];break;case'number':_0x349c5a[_0x839c('0x42')]=db[_0x839c('0x8b')]['INTEGER'];break;case _0x839c('0x8d'):_0x349c5a['type']=db[_0x839c('0x8b')]['BOOLEAN'];_0x349c5a[_0x839c('0x8e')]=![];break;default:}return db[_0x839c('0x88')][_0x839c('0x8f')]['addColumn'](_0x839c('0x77'),util[_0x839c('0x6f')]('cf_%s',_0x61c1e4['id']),_0x349c5a);})[_0x839c('0x2a')](function(){return _0x61c1e4;});});}})['then'](respondWithResult(_0x5651cd,null))[_0x839c('0x46')](handleError(_0x5651cd,null));};exports['getCustomFields']=function(_0x1d83ae,_0x8a6ed0,_0x314235){var _0x3da757={};var _0x35e330={};var _0x2ba4e2;var _0x149d5c;return db['CmList']['findOne']({'where':{'id':_0x1d83ae[_0x839c('0x55')]['id']}})[_0x839c('0x2a')](handleEntityNotFound(_0x8a6ed0,null))[_0x839c('0x2a')](function(_0x25d151){if(_0x25d151){_0x2ba4e2=_0x25d151;_0x35e330[_0x839c('0x34')]=_[_0x839c('0x37')](db[_0x839c('0x6d')][_0x839c('0x48')]);_0x35e330[_0x839c('0x36')]=_['keys'](_0x1d83ae[_0x839c('0x36')]);_0x35e330[_0x839c('0x40')]=_[_0x839c('0x38')](_0x35e330['model'],_0x35e330['query']);_0x3da757['attributes']=_['intersection'](_0x35e330[_0x839c('0x34')],qs[_0x839c('0x3a')](_0x1d83ae[_0x839c('0x36')][_0x839c('0x3a')]));_0x3da757[_0x839c('0x39')]=_0x3da757[_0x839c('0x39')][_0x839c('0x3b')]?_0x3da757[_0x839c('0x39')]:_0x35e330[_0x839c('0x34')];_0x3da757[_0x839c('0x3d')]=qs[_0x839c('0x3e')](_0x1d83ae[_0x839c('0x36')][_0x839c('0x3e')]);_0x3da757[_0x839c('0x3f')]=qs[_0x839c('0x40')](_[_0x839c('0x41')](_0x1d83ae[_0x839c('0x36')],_0x35e330[_0x839c('0x40')]));_0x3da757['where']=_[_0x839c('0x5d')](_0x3da757[_0x839c('0x3f')],{'$or':[{'ListId':_0x25d151['id']},{'ListId':null}]});if(_0x1d83ae[_0x839c('0x36')][_0x839c('0x5c')]){_0x3da757['where']=_[_0x839c('0x5d')](_0x3da757['where'],{'$or':_[_0x839c('0x35')](_0x3da757[_0x839c('0x39')],function(_0x3a6007){var _0xc26cba={};_0xc26cba[_0x3a6007]={'$like':'%'+_0x1d83ae[_0x839c('0x36')][_0x839c('0x5c')]+'%'};return _0xc26cba;})});}_0x3da757=_[_0x839c('0x5d')]({},_0x3da757,_0x1d83ae[_0x839c('0x4b')]);return db['CmCustomField'][_0x839c('0x90')](_0x3da757);}})[_0x839c('0x2a')](respondWithResult(_0x8a6ed0,null))['catch'](handleError(_0x8a6ed0,null));};exports['getGlobalCustomFields']=function(_0x57bfeb,_0x4c29c8){return db[_0x839c('0x6d')][_0x839c('0x90')]({'where':{'ListId':null}})[_0x839c('0x2a')](handleEntityNotFound(_0x4c29c8,null))[_0x839c('0x2a')](function(_0x143e2a){return _0x143e2a;})[_0x839c('0x2a')](respondWithResult(_0x4c29c8,null))[_0x839c('0x46')](handleError(_0x4c29c8,null));};exports[_0x839c('0x91')]=function(_0x35cd98,_0x486a86,_0x2c1ac2){return db[_0x839c('0x32')][_0x839c('0x52')]({'where':{'id':_0x35cd98[_0x839c('0x55')]['id']}})[_0x839c('0x2a')](handleEntityNotFound(_0x486a86,null))[_0x839c('0x2a')](function(_0x1d6da4){if(_0x1d6da4){return _0x1d6da4['addAgents'](_0x35cd98[_0x839c('0x4d')][_0x839c('0x5f')],_[_0x839c('0x67')](_0x35cd98[_0x839c('0x4d')],[_0x839c('0x5f'),'id'])||{})['spread'](function(_0x23c95f){for(var _0x35494e=0x0;_0x35494e<_0x35cd98[_0x839c('0x4d')][_0x839c('0x5f')][_0x839c('0x3b')];_0x35494e+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x35cd98[_0x839c('0x4d')][_0x839c('0x5f')][_0x35494e]),'CmListId':Number(_0x35cd98['params']['id'])});}return _0x23c95f;});}})['then'](respondWithResult(_0x486a86,null))[_0x839c('0x46')](handleError(_0x486a86,null));};exports[_0x839c('0x92')]=function(_0x18ed2b,_0x5b1c4c,_0x344ceb){return db[_0x839c('0x32')][_0x839c('0x52')]({'where':{'id':_0x18ed2b['params']['id']}})[_0x839c('0x2a')](handleEntityNotFound(_0x5b1c4c,null))[_0x839c('0x2a')](function(_0x431197){if(_0x431197){return _0x431197[_0x839c('0x92')](_0x18ed2b['query']['ids'])['then'](function(){if(_['isArray'](_0x18ed2b[_0x839c('0x36')][_0x839c('0x5f')])){for(var _0xc3fd3e=0x0;_0xc3fd3e<_0x18ed2b[_0x839c('0x36')]['ids']['length'];_0xc3fd3e+=0x1){socket[_0x839c('0x93')](_0x839c('0x94'),{'UserId':Number(_0x18ed2b[_0x839c('0x36')]['ids'][_0xc3fd3e]),'CmListId':Number(_0x18ed2b[_0x839c('0x55')]['id'])});}}else{socket['emit'](_0x839c('0x94'),{'UserId':Number(_0x18ed2b['query']['ids']),'CmListId':Number(_0x18ed2b['params']['id'])});}});}})[_0x839c('0x2a')](respondWithStatusCode(_0x5b1c4c,null))[_0x839c('0x46')](handleError(_0x5b1c4c,null));};exports[_0x839c('0x95')]=function(_0x2dec19,_0x58cc43,_0x194443){var _0x451a98={};var _0x17ad90={};var _0x1ef5ec;var _0x11fa9a;return db[_0x839c('0x32')][_0x839c('0x5b')]({'where':{'id':_0x2dec19[_0x839c('0x55')]['id']}})[_0x839c('0x2a')](handleEntityNotFound(_0x58cc43,null))[_0x839c('0x2a')](function(_0x1fc4e3){if(_0x1fc4e3){_0x1ef5ec=_0x1fc4e3;_0x17ad90[_0x839c('0x34')]=_[_0x839c('0x37')](db['User']['rawAttributes']);_0x17ad90[_0x839c('0x36')]=_[_0x839c('0x37')](_0x2dec19[_0x839c('0x36')]);_0x17ad90[_0x839c('0x40')]=_['intersection'](_0x17ad90[_0x839c('0x34')],_0x17ad90[_0x839c('0x36')]);_0x451a98[_0x839c('0x39')]=_[_0x839c('0x38')](_0x17ad90[_0x839c('0x34')],qs['fields'](_0x2dec19['query']['fields']));_0x451a98[_0x839c('0x39')]=_0x451a98[_0x839c('0x39')][_0x839c('0x3b')]?_0x451a98[_0x839c('0x39')]:_0x17ad90['model'];_0x451a98[_0x839c('0x3d')]=qs['sort'](_0x2dec19['query'][_0x839c('0x3e')]);_0x451a98[_0x839c('0x3f')]=qs['filters'](_[_0x839c('0x41')](_0x2dec19[_0x839c('0x36')],_0x17ad90['filters']));if(_0x2dec19[_0x839c('0x36')]['filter']){_0x451a98[_0x839c('0x3f')]=_[_0x839c('0x5d')](_0x451a98[_0x839c('0x3f')],{'$or':_[_0x839c('0x35')](_0x451a98['attributes'],function(_0x37c3aa){var _0x3814e0={};_0x3814e0[_0x37c3aa]={'$like':'%'+_0x2dec19['query'][_0x839c('0x5c')]+'%'};return _0x3814e0;})});}_0x451a98=_[_0x839c('0x5d')]({},_0x451a98,_0x2dec19['options']);return _0x1ef5ec['getAgents'](_0x451a98);}})['then'](function(_0x5bcd06){if(_0x5bcd06){_0x11fa9a=_0x5bcd06[_0x839c('0x3b')];if(!_0x2dec19['query'][_0x839c('0x71')](_0x839c('0x3c'))){_0x451a98[_0x839c('0x22')]=qs[_0x839c('0x22')](_0x2dec19['query'][_0x839c('0x22')]);_0x451a98[_0x839c('0x24')]=qs[_0x839c('0x24')](_0x2dec19[_0x839c('0x36')][_0x839c('0x24')]);}return _0x1ef5ec['getAgents'](_0x451a98);}})[_0x839c('0x2a')](function(_0x925d9c){if(_0x925d9c){return _0x925d9c?{'count':_0x11fa9a,'rows':_0x925d9c}:null;}})['then'](respondWithResult(_0x58cc43,null))[_0x839c('0x46')](handleError(_0x58cc43,null));};function handleQuery(_0x33d916){logger[_0x839c('0x96')](_0x33d916);return db[_0x839c('0x88')][_0x839c('0x36')](_0x33d916)[_0x839c('0x97')](function(_0x5a9d88){csv_results[_0x839c('0x65')](_0x5a9d88);})['catch'](function(_0x3e8044){logger[_0x839c('0x53')](_0x3e8044[_0x839c('0x6b')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index b69be50..f4099fa 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x53b398,_0x39bfd8){var _0x32c9ed=function(_0x5f5c4f){while(--_0x5f5c4f){_0x53b398['push'](_0x53b398['shift']());}};_0x32c9ed(++_0x39bfd8);}(_0x7217,0x19e));var _0x7721=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x7217[_0xbe200f];return _0x192597;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file +var _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x326f,0xd1));var _0xf326=function(_0x1c4023,_0x22f301){_0x1c4023=_0x1c4023-0x0;var _0x58eb7b=_0x326f[_0x1c4023];return _0x58eb7b;};'use strict';var EventEmitter=require(_0xf326('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){CmListEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);CmListEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 041c230..3af70fa 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 _0x6c76=['define','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x908595,_0x262d83){var _0x2ff12e=function(_0x9fb120){while(--_0x9fb120){_0x908595['push'](_0x908595['shift']());}};_0x2ff12e(++_0x262d83);}(_0x6c76,0x184));var _0x66c7=function(_0x14c9e3,_0x4c7bd5){_0x14c9e3=_0x14c9e3-0x0;var _0x514c33=_0x6c76[_0x14c9e3];return _0x514c33;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))('api');var moment=require(_0x66c7('0x3'));var BPromise=require(_0x66c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var attributes=require('./cmList.attributes');module[_0x66c7('0x7')]=function(_0x45b0a5,_0x52f71b){return _0x45b0a5[_0x66c7('0x8')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c76=['define','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x9f07d2,_0x3c4ccb){var _0x365a98=function(_0x3f7aec){while(--_0x3f7aec){_0x9f07d2['push'](_0x9f07d2['shift']());}};_0x365a98(++_0x3c4ccb);}(_0x6c76,0x184));var _0x66c7=function(_0x84d75f,_0x1a6a34){_0x84d75f=_0x84d75f-0x0;var _0x52af73=_0x6c76[_0x84d75f];return _0x52af73;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))('api');var moment=require(_0x66c7('0x3'));var BPromise=require(_0x66c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var attributes=require('./cmList.attributes');module[_0x66c7('0x7')]=function(_0x45b0a5,_0x52f71b){return _0x45b0a5[_0x66c7('0x8')]('CmList',attributes,{'tableName':'cm_lists','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 b9cb3b0..a2870b1 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 _0x6ece=['redis','localhost','./cmList.socket','register','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client'];(function(_0xfed22f,_0x12435a){var _0x834bfa=function(_0xb1b5f4){while(--_0xb1b5f4){_0xfed22f['push'](_0xfed22f['shift']());}};_0x834bfa(++_0x12435a);}(_0x6ece,0x85));var _0xe6ec=function(_0x21a0b7,_0x2f99f2){_0x21a0b7=_0x21a0b7-0x0;var _0x116813=_0x6ece[_0x21a0b7];return _0x116813;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe6ec('0x0'));var BPromise=require('bluebird');var rs=require(_0xe6ec('0x1'));var fs=require('fs');var Redis=require(_0xe6ec('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe6ec('0x3'))(_0xe6ec('0x4'));var config=require(_0xe6ec('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe6ec('0x6')]['http']({'port':0x232a});config[_0xe6ec('0x7')]=_['defaults'](config['redis'],{'host':_0xe6ec('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe6ec('0x7')]));require(_0xe6ec('0x9'))[_0xe6ec('0xa')](socket);function respondWithRpcPromise(_0x8a29d8,_0x17a4bd,_0x169f1b){return new BPromise(function(_0x36393d,_0x502a68){return client['request'](_0x8a29d8,_0x169f1b)['then'](function(_0x3869f5){logger['info'](_0xe6ec('0xb'),_0x17a4bd,_0xe6ec('0xc'));logger[_0xe6ec('0xd')](_0xe6ec('0xe'),_0x17a4bd,_0xe6ec('0xc'),JSON[_0xe6ec('0xf')](_0x3869f5));if(_0x3869f5[_0xe6ec('0x10')]){if(_0x3869f5[_0xe6ec('0x10')][_0xe6ec('0x11')]===0x1f4){logger[_0xe6ec('0x10')]('CmList,\x20%s,\x20%s',_0x17a4bd,_0x3869f5['error'][_0xe6ec('0x12')]);return _0x502a68(_0x3869f5[_0xe6ec('0x10')]['message']);}logger[_0xe6ec('0x10')]('CmList,\x20%s,\x20%s',_0x17a4bd,_0x3869f5[_0xe6ec('0x10')]['message']);return _0x36393d(_0x3869f5[_0xe6ec('0x10')][_0xe6ec('0x12')]);}else{logger['info'](_0xe6ec('0xb'),_0x17a4bd,_0xe6ec('0xc'));_0x36393d(_0x3869f5[_0xe6ec('0x13')][_0xe6ec('0x12')]);}})['catch'](function(_0x5428c1){logger[_0xe6ec('0x10')](_0xe6ec('0xb'),_0x17a4bd,_0x5428c1);_0x502a68(_0x5428c1);});});} \ No newline at end of file +var _0xd20a=['error','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./cmList.socket','request','info','CmList,\x20%s,\x20%s','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message'];(function(_0x2f6dfe,_0x115dab){var _0x5e5c9c=function(_0x502840){while(--_0x502840){_0x2f6dfe['push'](_0x2f6dfe['shift']());}};_0x5e5c9c(++_0x115dab);}(_0xd20a,0xe3));var _0xad20=function(_0x7dd1ad,_0x591860){_0x7dd1ad=_0x7dd1ad-0x0;var _0x172e5f=_0xd20a[_0x7dd1ad];return _0x172e5f;};'use strict';var _=require(_0xad20('0x0'));var util=require(_0xad20('0x1'));var moment=require(_0xad20('0x2'));var BPromise=require(_0xad20('0x3'));var rs=require(_0xad20('0x4'));var fs=require('fs');var Redis=require(_0xad20('0x5'));var db=require(_0xad20('0x6'))['db'];var utils=require(_0xad20('0x7'));var logger=require(_0xad20('0x8'))(_0xad20('0x9'));var config=require(_0xad20('0xa'));var jayson=require(_0xad20('0xb'));var client=jayson[_0xad20('0xc')]['http']({'port':0x232a});config[_0xad20('0xd')]=_['defaults'](config[_0xad20('0xd')],{'host':_0xad20('0xe'),'port':0x18eb});var socket=require(_0xad20('0xf'))(new Redis(config[_0xad20('0xd')]));require(_0xad20('0x10'))['register'](socket);function respondWithRpcPromise(_0x48d10b,_0x173bde,_0x430002){return new BPromise(function(_0x292b0c,_0x1fb565){return client[_0xad20('0x11')](_0x48d10b,_0x430002)['then'](function(_0x132107){logger[_0xad20('0x12')](_0xad20('0x13'),_0x173bde,'request\x20sent');logger['debug'](_0xad20('0x14'),_0x173bde,_0xad20('0x15'),JSON[_0xad20('0x16')](_0x132107));if(_0x132107['error']){if(_0x132107['error'][_0xad20('0x17')]===0x1f4){logger['error'](_0xad20('0x13'),_0x173bde,_0x132107['error'][_0xad20('0x18')]);return _0x1fb565(_0x132107[_0xad20('0x19')]['message']);}logger[_0xad20('0x19')]('CmList,\x20%s,\x20%s',_0x173bde,_0x132107[_0xad20('0x19')]['message']);return _0x292b0c(_0x132107[_0xad20('0x19')][_0xad20('0x18')]);}else{logger[_0xad20('0x12')](_0xad20('0x13'),_0x173bde,_0xad20('0x15'));_0x292b0c(_0x132107[_0xad20('0x1a')][_0xad20('0x18')]);}})[_0xad20('0x1b')](function(_0x4555b1){logger[_0xad20('0x19')](_0xad20('0x13'),_0x173bde,_0x4555b1);_0x1fb565(_0x4555b1);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 49a0080..e28ef4b 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 _0xbb25=['register','length','cmList:','save','update','emit','removeListener'];(function(_0x5669f9,_0x234dc2){var _0x26cf70=function(_0x191295){while(--_0x191295){_0x5669f9['push'](_0x5669f9['shift']());}};_0x26cf70(++_0x234dc2);}(_0xbb25,0xf1));var _0x5bb2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb25[_0x3dd15e];return _0x231fd0;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x5bb2('0x0'),'remove',_0x5bb2('0x1')];function createListener(_0x3e6716,_0x7a7f9){return function(_0x463d59){_0x7a7f9[_0x5bb2('0x2')](_0x3e6716,_0x463d59);};}function removeListener(_0x132bce,_0xac1a95){return function(){CmListEvents[_0x5bb2('0x3')](_0x132bce,_0xac1a95);};}exports[_0x5bb2('0x4')]=function(_0x2ff5f9){for(var _0x4729f1=0x0,_0x2ff7f2=events[_0x5bb2('0x5')];_0x4729f1<_0x2ff7f2;_0x4729f1++){var _0x4e6be5=events[_0x4729f1];var _0x54bb69=createListener(_0x5bb2('0x6')+_0x4e6be5,_0x2ff5f9);CmListEvents['on'](_0x4e6be5,_0x54bb69);}}; \ No newline at end of file +var _0x3de1=['remove','emit','register','length','save'];(function(_0x60b71a,_0xea75e6){var _0x177250=function(_0x7655be){while(--_0x7655be){_0x60b71a['push'](_0x60b71a['shift']());}};_0x177250(++_0xea75e6);}(_0x3de1,0xd1));var _0x13de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3de1[_0x3dd15e];return _0x231fd0;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x13de('0x0'),_0x13de('0x1'),'update'];function createListener(_0x36c0c0,_0xa66e4b){return function(_0x22e676){_0xa66e4b[_0x13de('0x2')](_0x36c0c0,_0x22e676);};}function removeListener(_0x47b319,_0x4969f4){return function(){CmListEvents['removeListener'](_0x47b319,_0x4969f4);};}exports[_0x13de('0x3')]=function(_0x15426a){for(var _0x27b457=0x0,_0x3da585=events[_0x13de('0x4')];_0x27b457<_0x3da585;_0x27b457++){var _0x2f160d=events[_0x27b457];var _0xd1bb71=createListener('cmList:'+_0x2f160d,_0x15426a);CmListEvents['on'](_0x2f160d,_0xd1bb71);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 352fc38..c551029 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 _0x61d0=['getContactsCsv','/:id/fields','/:id/users','getAgents','post','create','/:id/dispositions','put','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','getGlobalCustomFields','/:id','show','/:id/contacts','getContacts','/:id/contacts/csv'];(function(_0x26394d,_0x547eea){var _0x5c7861=function(_0x252805){while(--_0x252805){_0x26394d['push'](_0x26394d['shift']());}};_0x5c7861(++_0x547eea);}(_0x61d0,0x123));var _0x061d=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0x61d0[_0x420d8d];return _0x4865d7;};'use strict';var multer=require(_0x061d('0x0'));var util=require(_0x061d('0x1'));var path=require(_0x061d('0x2'));var timeout=require(_0x061d('0x3'));var express=require(_0x061d('0x4'));var router=express['Router']();var fs_extra=require(_0x061d('0x5'));var auth=require(_0x061d('0x6'));var interaction=require(_0x061d('0x7'));var config=require(_0x061d('0x8'));var controller=require('./cmList.controller');router[_0x061d('0x9')]('/',auth[_0x061d('0xa')](),controller[_0x061d('0xb')]);router[_0x061d('0x9')](_0x061d('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/global_fields',auth[_0x061d('0xa')](),controller[_0x061d('0xd')]);router[_0x061d('0x9')](_0x061d('0xe'),auth[_0x061d('0xa')](),controller[_0x061d('0xf')]);router[_0x061d('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x061d('0x9')](_0x061d('0x10'),auth['isAuthenticated'](),controller[_0x061d('0x11')]);router[_0x061d('0x9')](_0x061d('0x12'),auth[_0x061d('0xa')](),controller[_0x061d('0x13')]);router[_0x061d('0x9')](_0x061d('0x14'),auth[_0x061d('0xa')](),controller['getCustomFields']);router[_0x061d('0x9')](_0x061d('0x15'),auth[_0x061d('0xa')](),controller[_0x061d('0x16')]);router[_0x061d('0x17')]('/',auth[_0x061d('0xa')](),controller[_0x061d('0x18')]);router['post'](_0x061d('0x19'),auth[_0x061d('0xa')](),controller['addDisposition']);router[_0x061d('0x17')]('/:id/contacts',auth[_0x061d('0xa')](),controller['addContacts']);router[_0x061d('0x17')](_0x061d('0x14'),auth['isAuthenticated'](),controller['addCustomField']);router[_0x061d('0x17')](_0x061d('0x15'),auth[_0x061d('0xa')](),controller['addAgents']);router[_0x061d('0x1a')](_0x061d('0xe'),auth[_0x061d('0xa')](),controller['update']);router['delete'](_0x061d('0xe'),auth[_0x061d('0xa')](),controller['destroy']);router[_0x061d('0x1b')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x061d('0x1c')]);router[_0x061d('0x1b')]('/:id/users',auth[_0x061d('0xa')](),controller[_0x061d('0x1d')]);module[_0x061d('0x1e')]=router; \ No newline at end of file +var _0xdd64=['getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','addDisposition','/:id/contacts','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions'];(function(_0x5f5959,_0x3cb150){var _0x3c8e56=function(_0x1a087a){while(--_0x1a087a){_0x5f5959['push'](_0x5f5959['shift']());}};_0x3c8e56(++_0x3cb150);}(_0xdd64,0xd3));var _0x4dd6=function(_0x3c5f1d,_0x1a566b){_0x3c5f1d=_0x3c5f1d-0x0;var _0xfad0ee=_0xdd64[_0x3c5f1d];return _0xfad0ee;};'use strict';var multer=require(_0x4dd6('0x0'));var util=require(_0x4dd6('0x1'));var path=require(_0x4dd6('0x2'));var timeout=require(_0x4dd6('0x3'));var express=require('express');var router=express[_0x4dd6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4dd6('0x5'));var interaction=require(_0x4dd6('0x6'));var config=require(_0x4dd6('0x7'));var controller=require('./cmList.controller');router[_0x4dd6('0x8')]('/',auth[_0x4dd6('0x9')](),controller[_0x4dd6('0xa')]);router['get']('/describe',auth[_0x4dd6('0x9')](),controller[_0x4dd6('0xb')]);router[_0x4dd6('0x8')](_0x4dd6('0xc'),auth[_0x4dd6('0x9')](),controller[_0x4dd6('0xd')]);router['get'](_0x4dd6('0xe'),auth[_0x4dd6('0x9')](),controller[_0x4dd6('0xf')]);router['get'](_0x4dd6('0x10'),auth[_0x4dd6('0x9')](),controller[_0x4dd6('0x11')]);router[_0x4dd6('0x8')]('/:id/contacts',auth[_0x4dd6('0x9')](),controller[_0x4dd6('0x12')]);router[_0x4dd6('0x8')](_0x4dd6('0x13'),auth[_0x4dd6('0x9')](),controller[_0x4dd6('0x14')]);router['get'](_0x4dd6('0x15'),auth[_0x4dd6('0x9')](),controller[_0x4dd6('0x16')]);router[_0x4dd6('0x8')](_0x4dd6('0x17'),auth[_0x4dd6('0x9')](),controller['getAgents']);router[_0x4dd6('0x18')]('/',auth[_0x4dd6('0x9')](),controller[_0x4dd6('0x19')]);router[_0x4dd6('0x18')](_0x4dd6('0x10'),auth[_0x4dd6('0x9')](),controller[_0x4dd6('0x1a')]);router['post'](_0x4dd6('0x1b'),auth[_0x4dd6('0x9')](),controller[_0x4dd6('0x1c')]);router[_0x4dd6('0x18')](_0x4dd6('0x15'),auth[_0x4dd6('0x9')](),controller[_0x4dd6('0x1d')]);router['post']('/:id/users',auth[_0x4dd6('0x9')](),controller[_0x4dd6('0x1e')]);router[_0x4dd6('0x1f')](_0x4dd6('0xe'),auth[_0x4dd6('0x9')](),controller[_0x4dd6('0x20')]);router[_0x4dd6('0x21')](_0x4dd6('0xe'),auth[_0x4dd6('0x9')](),controller[_0x4dd6('0x22')]);router[_0x4dd6('0x21')](_0x4dd6('0x10'),auth['isAuthenticated'](),controller[_0x4dd6('0x23')]);router[_0x4dd6('0x21')](_0x4dd6('0x17'),auth[_0x4dd6('0x9')](),controller[_0x4dd6('0x24')]);module[_0x4dd6('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 3264a1d..6b2cd7c 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 _0x9c31=['VIRTUAL','field','STRING','exports'];(function(_0x455ff7,_0x51ba55){var _0x51c1aa=function(_0x1faf0d){while(--_0x1faf0d){_0x455ff7['push'](_0x455ff7['shift']());}};_0x51c1aa(++_0x51ba55);}(_0x9c31,0xd7));var _0x19c3=function(_0x44be2a,_0x106108){_0x44be2a=_0x44be2a-0x0;var _0x472766=_0x9c31[_0x44be2a];return _0x472766;};'use strict';var Sequelize=require('sequelize');module[_0x19c3('0x0')]={'name':{'type':Sequelize[_0x19c3('0x1')],'get':function(_0x2df690){return this['getDataValue'](_0x19c3('0x2'));}},'field':{'type':Sequelize[_0x19c3('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x19c3('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x6d65=['getDataValue','field','STRING','exports','VIRTUAL'];(function(_0x3da647,_0xa1a501){var _0x2e91a2=function(_0x34a811){while(--_0x34a811){_0x3da647['push'](_0x3da647['shift']());}};_0x2e91a2(++_0xa1a501);}(_0x6d65,0x14d));var _0x56d6=function(_0x33abfb,_0x2bc697){_0x33abfb=_0x33abfb-0x0;var _0x55e087=_0x6d65[_0x33abfb];return _0x55e087;};'use strict';var Sequelize=require('sequelize');module[_0x56d6('0x0')]={'name':{'type':Sequelize[_0x56d6('0x1')],'get':function(_0x5dc5db){return this[_0x56d6('0x2')](_0x56d6('0x3'));}},'field':{'type':Sequelize[_0x56d6('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x56d6('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 1fff882..20a0087 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x4aa424,_0x21ba61){var _0x4f2750=function(_0x2c8a91){while(--_0x2c8a91){_0x4aa424['push'](_0x4aa424['shift']());}};_0x4f2750(++_0x21ba61);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +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(_0x28ab95,_0x128251){var _0x3a81a1=function(_0x5ae2f1){while(--_0x5ae2f1){_0x28ab95['push'](_0x28ab95['shift']());}};_0x3a81a1(++_0x128251);}(_0x7a54,0x106));var _0x47a5=function(_0x4e0f8d,_0x3ff34b){_0x4e0f8d=_0x4e0f8d-0x0;var _0x2e5e2c=_0x7a54[_0x4e0f8d];return _0x2e5e2c;};'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 f04d44e..6bd6427 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 _0xcf85=['path','rimraf','../../config/environment','exports','define','Condition','tools_conditions','util','api','moment','bluebird','request-promise'];(function(_0x375be9,_0x28a9a7){var _0x5dbcb8=function(_0x5cf63d){while(--_0x5cf63d){_0x375be9['push'](_0x375be9['shift']());}};_0x5dbcb8(++_0x28a9a7);}(_0xcf85,0x67));var _0x5cf8=function(_0x31de22,_0x7cf6ea){_0x31de22=_0x31de22-0x0;var _0x1b2bea=_0xcf85[_0x31de22];return _0x1b2bea;};'use strict';var _=require('lodash');var util=require(_0x5cf8('0x0'));var logger=require('../../config/logger')(_0x5cf8('0x1'));var moment=require(_0x5cf8('0x2'));var BPromise=require(_0x5cf8('0x3'));var rp=require(_0x5cf8('0x4'));var fs=require('fs');var path=require(_0x5cf8('0x5'));var rimraf=require(_0x5cf8('0x6'));var config=require(_0x5cf8('0x7'));var attributes=require('./condition.attributes');module[_0x5cf8('0x8')]=function(_0x53dd46,_0x16ce55){return _0x53dd46[_0x5cf8('0x9')](_0x5cf8('0xa'),attributes,{'tableName':_0x5cf8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7990=['exports','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./condition.attributes'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0x7990,0x6f));var _0x0799=function(_0x277b9a,_0x5bf31d){_0x277b9a=_0x277b9a-0x0;var _0x1ece7b=_0x7990[_0x277b9a];return _0x1ece7b;};'use strict';var _=require(_0x0799('0x0'));var util=require(_0x0799('0x1'));var logger=require(_0x0799('0x2'))(_0x0799('0x3'));var moment=require('moment');var BPromise=require(_0x0799('0x4'));var rp=require(_0x0799('0x5'));var fs=require('fs');var path=require(_0x0799('0x6'));var rimraf=require('rimraf');var config=require(_0x0799('0x7'));var attributes=require(_0x0799('0x8'));module[_0x0799('0x9')]=function(_0x4a547f,_0x10bfc9){return _0x4a547f['define']('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 ea1dc4c..22b0564 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 _0x80c4=['message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','Condition,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x3f2c78,_0x38ba93){var _0x3d6dc2=function(_0xaaebf1){while(--_0xaaebf1){_0x3f2c78['push'](_0x3f2c78['shift']());}};_0x3d6dc2(++_0x38ba93);}(_0x80c4,0x154));var _0x480c=function(_0x2eaa11,_0x414cce){_0x2eaa11=_0x2eaa11-0x0;var _0x515001=_0x80c4[_0x2eaa11];return _0x515001;};'use strict';var _=require(_0x480c('0x0'));var util=require(_0x480c('0x1'));var moment=require(_0x480c('0x2'));var BPromise=require('bluebird');var rs=require(_0x480c('0x3'));var fs=require('fs');var Redis=require(_0x480c('0x4'));var db=require(_0x480c('0x5'))['db'];var utils=require(_0x480c('0x6'));var logger=require(_0x480c('0x7'))(_0x480c('0x8'));var config=require('../../config/environment');var jayson=require(_0x480c('0x9'));var client=jayson[_0x480c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1166c1,_0x472e23,_0x31117f){return new BPromise(function(_0x3000f9,_0x4a83eb){return client['request'](_0x1166c1,_0x31117f)[_0x480c('0xb')](function(_0x2ed3c7){logger['info'](_0x480c('0xc'),_0x472e23,_0x480c('0xd'));logger[_0x480c('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x472e23,_0x480c('0xd'),JSON['stringify'](_0x2ed3c7));if(_0x2ed3c7[_0x480c('0xf')]){if(_0x2ed3c7['error'][_0x480c('0x10')]===0x1f4){logger['error'](_0x480c('0xc'),_0x472e23,_0x2ed3c7['error'][_0x480c('0x11')]);return _0x4a83eb(_0x2ed3c7[_0x480c('0xf')]['message']);}logger[_0x480c('0xf')]('Condition,\x20%s,\x20%s',_0x472e23,_0x2ed3c7[_0x480c('0xf')]['message']);return _0x3000f9(_0x2ed3c7[_0x480c('0xf')][_0x480c('0x11')]);}else{logger[_0x480c('0x12')](_0x480c('0xc'),_0x472e23,'request\x20sent');_0x3000f9(_0x2ed3c7[_0x480c('0x13')][_0x480c('0x11')]);}})[_0x480c('0x14')](function(_0x55cd41){logger[_0x480c('0xf')]('Condition,\x20%s,\x20%s',_0x472e23,_0x55cd41);_0x4a83eb(_0x55cd41);});});} \ No newline at end of file +var _0x780d=['debug','Condition,\x20%s,\x20%s,\x20%s','stringify','code','error','Condition,\x20%s,\x20%s','message','result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','client','http','request','then','info','request\x20sent'];(function(_0x32facd,_0x37fba1){var _0x427138=function(_0x5b4676){while(--_0x5b4676){_0x32facd['push'](_0x32facd['shift']());}};_0x427138(++_0x37fba1);}(_0x780d,0xec));var _0xd780=function(_0x58b6fe,_0x1b20c4){_0x58b6fe=_0x58b6fe-0x0;var _0x12d78e=_0x780d[_0x58b6fe];return _0x12d78e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd780('0x0'));var BPromise=require(_0xd780('0x1'));var rs=require(_0xd780('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd780('0x3'))['db'];var utils=require(_0xd780('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd780('0x5')][_0xd780('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4e18d1,_0x4d6f76,_0x93535a){return new BPromise(function(_0x6f42e,_0x2fb570){return client[_0xd780('0x7')](_0x4e18d1,_0x93535a)[_0xd780('0x8')](function(_0x236422){logger[_0xd780('0x9')]('Condition,\x20%s,\x20%s',_0x4d6f76,_0xd780('0xa'));logger[_0xd780('0xb')](_0xd780('0xc'),_0x4d6f76,_0xd780('0xa'),JSON[_0xd780('0xd')](_0x236422));if(_0x236422['error']){if(_0x236422['error'][_0xd780('0xe')]===0x1f4){logger[_0xd780('0xf')](_0xd780('0x10'),_0x4d6f76,_0x236422[_0xd780('0xf')][_0xd780('0x11')]);return _0x2fb570(_0x236422[_0xd780('0xf')][_0xd780('0x11')]);}logger[_0xd780('0xf')](_0xd780('0x10'),_0x4d6f76,_0x236422[_0xd780('0xf')][_0xd780('0x11')]);return _0x6f42e(_0x236422[_0xd780('0xf')][_0xd780('0x11')]);}else{logger[_0xd780('0x9')](_0xd780('0x10'),_0x4d6f76,'request\x20sent');_0x6f42e(_0x236422[_0xd780('0x12')][_0xd780('0x11')]);}})['catch'](function(_0x5d9f02){logger[_0xd780('0xf')](_0xd780('0x10'),_0x4d6f76,_0x5d9f02);_0x2fb570(_0x5d9f02);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 250d81a..4b97ebf 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 _0x87a0=['../../components/auth/service','../../config/environment','./condition.controller','/:id','isAuthenticated','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x87a0,0x12e));var _0x087a=function(_0x4b4fde,_0x36fd8a){_0x4b4fde=_0x4b4fde-0x0;var _0x6da9ea=_0x87a0[_0x4b4fde];return _0x6da9ea;};'use strict';var multer=require(_0x087a('0x0'));var util=require(_0x087a('0x1'));var path=require(_0x087a('0x2'));var timeout=require(_0x087a('0x3'));var express=require(_0x087a('0x4'));var router=express['Router']();var fs_extra=require(_0x087a('0x5'));var auth=require(_0x087a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x087a('0x7'));var controller=require(_0x087a('0x8'));router['put'](_0x087a('0x9'),auth[_0x087a('0xa')](),controller['update']);router[_0x087a('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x087a('0xc')]);module[_0x087a('0xd')]=router; \ No newline at end of file +var _0xa16e=['destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','delete','/:id'];(function(_0x1121b1,_0x4e40f2){var _0x5bf648=function(_0x1d3b12){while(--_0x1d3b12){_0x1121b1['push'](_0x1121b1['shift']());}};_0x5bf648(++_0x4e40f2);}(_0xa16e,0x1dd));var _0xea16=function(_0x380142,_0x10e9bb){_0x380142=_0x380142-0x0;var _0x573790=_0xa16e[_0x380142];return _0x573790;};'use strict';var multer=require(_0xea16('0x0'));var util=require(_0xea16('0x1'));var path=require(_0xea16('0x2'));var timeout=require('connect-timeout');var express=require(_0xea16('0x3'));var router=express[_0xea16('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xea16('0x5'));var interaction=require(_0xea16('0x6'));var config=require(_0xea16('0x7'));var controller=require(_0xea16('0x8'));router[_0xea16('0x9')]('/:id',auth[_0xea16('0xa')](),controller['update']);router[_0xea16('0xb')](_0xea16('0xc'),auth['isAuthenticated'](),controller[_0xea16('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 6c28264..073c32c 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 _0x1a5b=['exports','STRING','name','INTEGER','sequelize'];(function(_0x741084,_0x17e720){var _0x1bbb2e=function(_0x5e5154){while(--_0x5e5154){_0x741084['push'](_0x741084['shift']());}};_0x1bbb2e(++_0x17e720);}(_0x1a5b,0x153));var _0xb1a5=function(_0xacdd90,_0x2a896c){_0xacdd90=_0xacdd90-0x0;var _0x46aae0=_0x1a5b[_0xacdd90];return _0x46aae0;};'use strict';var Sequelize=require(_0xb1a5('0x0'));module[_0xb1a5('0x1')]={'name':{'type':Sequelize[_0xb1a5('0x2')],'allowNull':![],'unique':_0xb1a5('0x3')},'OrderBy':{'type':Sequelize[_0xb1a5('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x3a27=['name','INTEGER','sequelize','STRING'];(function(_0x5d2cf3,_0x16bfd2){var _0x45a3fc=function(_0x24e67f){while(--_0x24e67f){_0x5d2cf3['push'](_0x5d2cf3['shift']());}};_0x45a3fc(++_0x16bfd2);}(_0x3a27,0xa6));var _0x73a2=function(_0x4c2237,_0x5424f9){_0x4c2237=_0x4c2237-0x0;var _0x49f041=_0x3a27[_0x4c2237];return _0x49f041;};'use strict';var Sequelize=require(_0x73a2('0x0'));module['exports']={'name':{'type':Sequelize[_0x73a2('0x1')],'allowNull':![],'unique':_0x73a2('0x2')},'OrderBy':{'type':Sequelize[_0x73a2('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x73a2('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 6399cb4..baecaf2 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 _0x7880=['pick','filter','merge','includeAll','include','rows','params','options','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','error','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','ContactItemTypes','sendStatus','name','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','where'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x7880,0x1f4));var _0x0788=function(_0x4e82bb,_0x4c39d5){_0x4e82bb=_0x4e82bb-0x0;var _0x1b5ac5=_0x7880[_0x4e82bb];return _0x1b5ac5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];function respondWithStatusCode(_0x311729,_0xce4342){_0xce4342=_0xce4342||0xcc;return function(_0x261ebc){if(_0x261ebc){return _0x311729['sendStatus'](_0xce4342);}return _0x311729[_0x0788('0x1a')](_0xce4342)[_0x0788('0x1b')]();};}function respondWithResult(_0x3bdcdf,_0x13cf07){_0x13cf07=_0x13cf07||0xc8;return function(_0x51e5d3){if(_0x51e5d3){return _0x3bdcdf[_0x0788('0x1a')](_0x13cf07)['json'](_0x51e5d3);}};}function respondWithFilteredResult(_0x195f14,_0x170d56){return function(_0x3fd1e4){if(_0x3fd1e4){var _0xb406fb=typeof _0x170d56[_0x0788('0x1c')]===_0x0788('0x1d')&&typeof _0x170d56['limit']==='undefined';var _0x17d805=_0x3fd1e4[_0x0788('0x1e')];var _0x5b2bdc=_0xb406fb?0x0:_0x170d56[_0x0788('0x1c')];var _0x415f19=_0xb406fb?_0x3fd1e4[_0x0788('0x1e')]:_0x170d56['offset']+_0x170d56[_0x0788('0x1f')];var _0x3fb723;if(_0x415f19>=_0x17d805){_0x415f19=_0x17d805;_0x3fb723=0xc8;}else{_0x3fb723=0xce;}_0x195f14['status'](_0x3fb723);return _0x195f14[_0x0788('0x20')]('Content-Range',_0x5b2bdc+'-'+_0x415f19+'/'+_0x17d805)[_0x0788('0x21')](_0x3fd1e4);}return null;};}function patchUpdates(_0x48bc5f){return function(_0x17cca3){try{jsonpatch[_0x0788('0x22')](_0x17cca3,_0x48bc5f,!![]);}catch(_0x18ff22){return BPromise[_0x0788('0x23')](_0x18ff22);}return _0x17cca3[_0x0788('0x24')]();};}function saveUpdates(_0x4f0005,_0x48ec43){return function(_0x2270d4){if(_0x2270d4){return _0x2270d4[_0x0788('0x25')](_0x4f0005)[_0x0788('0x26')](function(_0x7a99a1){return _0x7a99a1;});}return null;};}function removeEntity(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(_0x79204e){return _0x79204e[_0x0788('0x27')]()[_0x0788('0x26')](function(){var _0x50b65c=_0x79204e['get']({'plain':!![]});var _0x240459=_0x0788('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x240459,'resourceId':_0x50b65c['id']}})[_0x0788('0x26')](function(){return _0x79204e;});})[_0x0788('0x26')](function(){_0x5ba1da['status'](0xcc)[_0x0788('0x1b')]();});}};}function handleEntityNotFound(_0x40e7a6,_0x467d52){return function(_0x18fc0e){if(!_0x18fc0e){_0x40e7a6[_0x0788('0x29')](0x194);}return _0x18fc0e;};}function handleError(_0xb2f4a5,_0x6bf651){_0x6bf651=_0x6bf651||0x1f4;return function(_0x3ffe4f){logger['error'](_0x3ffe4f['stack']);if(_0x3ffe4f[_0x0788('0x2a')]){delete _0x3ffe4f[_0x0788('0x2a')];}_0xb2f4a5['status'](_0x6bf651)['send'](_0x3ffe4f);};}exports[_0x0788('0x2b')]=function(_0x68658a,_0x20fcd8){var _0x436031={},_0x44cbfb={},_0x44bff2={'count':0x0,'rows':[]};var _0x327d67=_[_0x0788('0x2c')](db[_0x0788('0x2d')][_0x0788('0x2e')],function(_0x5ec0ed){return{'name':_0x5ec0ed[_0x0788('0x2f')],'type':_0x5ec0ed[_0x0788('0x30')][_0x0788('0x31')]};});_0x44cbfb[_0x0788('0x32')]=_[_0x0788('0x2c')](_0x327d67,_0x0788('0x2a'));_0x44cbfb[_0x0788('0x33')]=_[_0x0788('0x34')](_0x68658a[_0x0788('0x33')]);_0x44cbfb[_0x0788('0x35')]=_['intersection'](_0x44cbfb['model'],_0x44cbfb['query']);_0x436031['attributes']=_['intersection'](_0x44cbfb['model'],qs[_0x0788('0x36')](_0x68658a[_0x0788('0x33')][_0x0788('0x36')]));_0x436031['attributes']=_0x436031[_0x0788('0x37')][_0x0788('0x38')]?_0x436031[_0x0788('0x37')]:_0x44cbfb[_0x0788('0x32')];if(!_0x68658a['query'][_0x0788('0x39')]('nolimit')){_0x436031[_0x0788('0x1f')]=qs['limit'](_0x68658a[_0x0788('0x33')][_0x0788('0x1f')]);_0x436031['offset']=qs[_0x0788('0x1c')](_0x68658a[_0x0788('0x33')]['offset']);}_0x436031[_0x0788('0x3a')]=qs['sort'](_0x68658a[_0x0788('0x33')]['sort']);_0x436031[_0x0788('0x3b')]=qs['filters'](_[_0x0788('0x3c')](_0x68658a['query'],_0x44cbfb['filters']),_0x327d67);if(_0x68658a[_0x0788('0x33')][_0x0788('0x3d')]){_0x436031[_0x0788('0x3b')]=_[_0x0788('0x3e')](_0x436031[_0x0788('0x3b')],{'$or':_['map'](_0x327d67,function(_0x530c5a){if(_0x530c5a['type']!=='VIRTUAL'){var _0x501dd5={};_0x501dd5[_0x530c5a[_0x0788('0x2a')]]={'$like':'%'+_0x68658a[_0x0788('0x33')][_0x0788('0x3d')]+'%'};return _0x501dd5;}})});}_0x436031=_[_0x0788('0x3e')]({},_0x436031,_0x68658a['options']);var _0x4c7833={'where':_0x436031[_0x0788('0x3b')]};return db[_0x0788('0x2d')][_0x0788('0x1e')](_0x4c7833)[_0x0788('0x26')](function(_0x236b63){_0x44bff2[_0x0788('0x1e')]=_0x236b63;if(_0x68658a[_0x0788('0x33')][_0x0788('0x3f')]){_0x436031[_0x0788('0x40')]=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x436031);})[_0x0788('0x26')](function(_0x1d579d){_0x44bff2[_0x0788('0x41')]=_0x1d579d;return _0x44bff2;})['then'](respondWithFilteredResult(_0x20fcd8,_0x436031))['catch'](handleError(_0x20fcd8,null));};exports['show']=function(_0x172424,_0x150c1e){var _0x25501b={'raw':!![],'where':{'id':_0x172424[_0x0788('0x42')]['id']}},_0x189d33={};_0x189d33[_0x0788('0x32')]=_[_0x0788('0x34')](db[_0x0788('0x2d')]['rawAttributes']);_0x189d33[_0x0788('0x33')]=_[_0x0788('0x34')](_0x172424[_0x0788('0x33')]);_0x189d33[_0x0788('0x35')]=_['intersection'](_0x189d33[_0x0788('0x32')],_0x189d33[_0x0788('0x33')]);_0x25501b['attributes']=_['intersection'](_0x189d33['model'],qs[_0x0788('0x36')](_0x172424['query'][_0x0788('0x36')]));_0x25501b[_0x0788('0x37')]=_0x25501b[_0x0788('0x37')][_0x0788('0x38')]?_0x25501b[_0x0788('0x37')]:_0x189d33[_0x0788('0x32')];if(_0x172424[_0x0788('0x33')][_0x0788('0x3f')]){_0x25501b['include']=[{'all':!![]}];}_0x25501b=_['merge']({},_0x25501b,_0x172424[_0x0788('0x43')]);return db[_0x0788('0x2d')][_0x0788('0x44')](_0x25501b)['then'](handleEntityNotFound(_0x150c1e,null))[_0x0788('0x26')](respondWithResult(_0x150c1e,null))[_0x0788('0x45')](handleError(_0x150c1e,null));};exports[_0x0788('0x46')]=function(_0x4563cd,_0x2395ad){return db['ContactItemType']['create'](_0x4563cd[_0x0788('0x47')],{})[_0x0788('0x26')](function(_0x5f1542){var _0x2b1479=_0x4563cd['user'][_0x0788('0x48')]({'plain':!![]});if(!_0x2b1479)throw new Error(_0x0788('0x49'));if(_0x2b1479[_0x0788('0x4a')]===_0x0788('0x4b')){var _0x3c757a=_0x5f1542[_0x0788('0x48')]({'plain':!![]});var _0x1722d4=_0x0788('0x28');return db['UserProfileSection'][_0x0788('0x44')]({'where':{'name':_0x1722d4,'userProfileId':_0x2b1479[_0x0788('0x4c')]},'raw':!![]})[_0x0788('0x26')](function(_0x5ef557){if(_0x5ef557&&_0x5ef557[_0x0788('0x4d')]===0x0){return db[_0x0788('0x4e')]['create']({'name':_0x3c757a[_0x0788('0x2a')],'resourceId':_0x3c757a['id'],'type':_0x5ef557[_0x0788('0x2a')],'sectionId':_0x5ef557['id']},{})[_0x0788('0x26')](function(){return _0x5f1542;});}else{return _0x5f1542;}})[_0x0788('0x45')](function(_0x137e24){logger[_0x0788('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x137e24);throw _0x137e24;});}return _0x5f1542;})['then'](respondWithResult(_0x2395ad,0xc9))[_0x0788('0x45')](handleError(_0x2395ad,null));};exports[_0x0788('0x25')]=function(_0x4b345d,_0x17d9fc){if(_0x4b345d[_0x0788('0x47')]['id']){delete _0x4b345d[_0x0788('0x47')]['id'];}return db[_0x0788('0x2d')][_0x0788('0x44')]({'where':{'id':_0x4b345d[_0x0788('0x42')]['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x17d9fc,null))[_0x0788('0x26')](saveUpdates(_0x4b345d[_0x0788('0x47')],null))[_0x0788('0x26')](respondWithResult(_0x17d9fc,null))[_0x0788('0x45')](handleError(_0x17d9fc,null));};exports[_0x0788('0x27')]=function(_0x55481c,_0x1c8be0){return db[_0x0788('0x2d')][_0x0788('0x44')]({'where':{'id':_0x55481c['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x1c8be0,null))[_0x0788('0x26')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x55481c[_0x0788('0x42')]['id']}}))[_0x0788('0x26')](removeEntity(_0x1c8be0,null))[_0x0788('0x45')](handleError(_0x1c8be0,null));}; \ No newline at end of file +var _0xd914=['count','set','Content-Range','apply','reject','update','then','destroy','ContactItemTypes','UserProfileResource','name','send','map','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','VIRTUAL','options','ContactItemType','includeAll','include','rows','catch','show','params','merge','find','create','body','get','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x49aa7d,_0x5d46d8){var _0xdd0d26=function(_0x159df7){while(--_0x159df7){_0x49aa7d['push'](_0x49aa7d['shift']());}};_0xdd0d26(++_0x5d46d8);}(_0xd914,0x17f));var _0x4d91=function(_0x4cfa2e,_0x5752b5){_0x4cfa2e=_0x4cfa2e-0x0;var _0x279b50=_0xd914[_0x4cfa2e];return _0x279b50;};'use strict';var emlformat=require(_0x4d91('0x0'));var rimraf=require(_0x4d91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d91('0x2'));var rp=require(_0x4d91('0x3'));var moment=require(_0x4d91('0x4'));var BPromise=require(_0x4d91('0x5'));var Mustache=require(_0x4d91('0x6'));var util=require(_0x4d91('0x7'));var path=require('path');var sox=require(_0x4d91('0x8'));var csv=require('to-csv');var ejs=require(_0x4d91('0x9'));var fs=require('fs');var fs_extra=require(_0x4d91('0xa'));var _=require(_0x4d91('0xb'));var squel=require(_0x4d91('0xc'));var crypto=require(_0x4d91('0xd'));var jsforce=require(_0x4d91('0xe'));var deskjs=require(_0x4d91('0xf'));var toCsv=require(_0x4d91('0x10'));var querystring=require('querystring');var Papa=require(_0x4d91('0x11'));var Redis=require(_0x4d91('0x12'));var authService=require(_0x4d91('0x13'));var qs=require(_0x4d91('0x14'));var as=require(_0x4d91('0x15'));var hardwareService=require(_0x4d91('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x4d91('0x17'));var config=require(_0x4d91('0x18'));var licenseUtil=require(_0x4d91('0x19'));var db=require(_0x4d91('0x1a'))['db'];function respondWithStatusCode(_0x1c15b7,_0x318e0c){_0x318e0c=_0x318e0c||0xcc;return function(_0x4ea591){if(_0x4ea591){return _0x1c15b7['sendStatus'](_0x318e0c);}return _0x1c15b7[_0x4d91('0x1b')](_0x318e0c)[_0x4d91('0x1c')]();};}function respondWithResult(_0xb6590d,_0x3c9fd6){_0x3c9fd6=_0x3c9fd6||0xc8;return function(_0x33fbd4){if(_0x33fbd4){return _0xb6590d[_0x4d91('0x1b')](_0x3c9fd6)[_0x4d91('0x1d')](_0x33fbd4);}};}function respondWithFilteredResult(_0x4f5aef,_0x3a8ec9){return function(_0x42631a){if(_0x42631a){var _0x1e2ef7=typeof _0x3a8ec9[_0x4d91('0x1e')]===_0x4d91('0x1f')&&typeof _0x3a8ec9['limit']===_0x4d91('0x1f');var _0xb75abf=_0x42631a[_0x4d91('0x20')];var _0x44b9a7=_0x1e2ef7?0x0:_0x3a8ec9['offset'];var _0x350e23=_0x1e2ef7?_0x42631a[_0x4d91('0x20')]:_0x3a8ec9[_0x4d91('0x1e')]+_0x3a8ec9['limit'];var _0x13ef2c;if(_0x350e23>=_0xb75abf){_0x350e23=_0xb75abf;_0x13ef2c=0xc8;}else{_0x13ef2c=0xce;}_0x4f5aef[_0x4d91('0x1b')](_0x13ef2c);return _0x4f5aef[_0x4d91('0x21')](_0x4d91('0x22'),_0x44b9a7+'-'+_0x350e23+'/'+_0xb75abf)[_0x4d91('0x1d')](_0x42631a);}return null;};}function patchUpdates(_0x40cde4){return function(_0xc1d44f){try{jsonpatch[_0x4d91('0x23')](_0xc1d44f,_0x40cde4,!![]);}catch(_0x30d911){return BPromise[_0x4d91('0x24')](_0x30d911);}return _0xc1d44f['save']();};}function saveUpdates(_0x4493da,_0x5f5236){return function(_0x57913e){if(_0x57913e){return _0x57913e[_0x4d91('0x25')](_0x4493da)[_0x4d91('0x26')](function(_0x341d18){return _0x341d18;});}return null;};}function removeEntity(_0x9cb864,_0x7d8cbf){return function(_0x12b722){if(_0x12b722){return _0x12b722[_0x4d91('0x27')]()[_0x4d91('0x26')](function(){var _0x55356b=_0x12b722['get']({'plain':!![]});var _0x1ee6b3=_0x4d91('0x28');return db[_0x4d91('0x29')][_0x4d91('0x27')]({'where':{'type':_0x1ee6b3,'resourceId':_0x55356b['id']}})[_0x4d91('0x26')](function(){return _0x12b722;});})[_0x4d91('0x26')](function(){_0x9cb864[_0x4d91('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dc353,_0xda9802){return function(_0x12ac74){if(!_0x12ac74){_0x3dc353['sendStatus'](0x194);}return _0x12ac74;};}function handleError(_0x480a56,_0x299f27){_0x299f27=_0x299f27||0x1f4;return function(_0x470079){logger['error'](_0x470079['stack']);if(_0x470079[_0x4d91('0x2a')]){delete _0x470079[_0x4d91('0x2a')];}_0x480a56[_0x4d91('0x1b')](_0x299f27)[_0x4d91('0x2b')](_0x470079);};}exports['index']=function(_0x2587a1,_0x31bbf8){var _0x468e95={},_0xee7535={},_0xa63422={'count':0x0,'rows':[]};var _0x3466f3=_[_0x4d91('0x2c')](db['ContactItemType'][_0x4d91('0x2d')],function(_0x4f44ff){return{'name':_0x4f44ff['fieldName'],'type':_0x4f44ff[_0x4d91('0x2e')][_0x4d91('0x2f')]};});_0xee7535['model']=_[_0x4d91('0x2c')](_0x3466f3,_0x4d91('0x2a'));_0xee7535[_0x4d91('0x30')]=_[_0x4d91('0x31')](_0x2587a1[_0x4d91('0x30')]);_0xee7535['filters']=_[_0x4d91('0x32')](_0xee7535[_0x4d91('0x33')],_0xee7535[_0x4d91('0x30')]);_0x468e95[_0x4d91('0x34')]=_[_0x4d91('0x32')](_0xee7535[_0x4d91('0x33')],qs['fields'](_0x2587a1[_0x4d91('0x30')][_0x4d91('0x35')]));_0x468e95['attributes']=_0x468e95[_0x4d91('0x34')][_0x4d91('0x36')]?_0x468e95[_0x4d91('0x34')]:_0xee7535['model'];if(!_0x2587a1[_0x4d91('0x30')][_0x4d91('0x37')](_0x4d91('0x38'))){_0x468e95[_0x4d91('0x39')]=qs['limit'](_0x2587a1[_0x4d91('0x30')][_0x4d91('0x39')]);_0x468e95[_0x4d91('0x1e')]=qs[_0x4d91('0x1e')](_0x2587a1['query']['offset']);}_0x468e95[_0x4d91('0x3a')]=qs[_0x4d91('0x3b')](_0x2587a1['query'][_0x4d91('0x3b')]);_0x468e95[_0x4d91('0x3c')]=qs[_0x4d91('0x3d')](_[_0x4d91('0x3e')](_0x2587a1['query'],_0xee7535[_0x4d91('0x3d')]),_0x3466f3);if(_0x2587a1[_0x4d91('0x30')]['filter']){_0x468e95[_0x4d91('0x3c')]=_['merge'](_0x468e95[_0x4d91('0x3c')],{'$or':_['map'](_0x3466f3,function(_0x2dc892){if(_0x2dc892['type']!==_0x4d91('0x3f')){var _0x2782d2={};_0x2782d2[_0x2dc892[_0x4d91('0x2a')]]={'$like':'%'+_0x2587a1[_0x4d91('0x30')]['filter']+'%'};return _0x2782d2;}})});}_0x468e95=_['merge']({},_0x468e95,_0x2587a1[_0x4d91('0x40')]);var _0x55c8d0={'where':_0x468e95[_0x4d91('0x3c')]};return db[_0x4d91('0x41')]['count'](_0x55c8d0)[_0x4d91('0x26')](function(_0x2ae356){_0xa63422[_0x4d91('0x20')]=_0x2ae356;if(_0x2587a1[_0x4d91('0x30')][_0x4d91('0x42')]){_0x468e95[_0x4d91('0x43')]=[{'all':!![]}];}return db[_0x4d91('0x41')]['findAll'](_0x468e95);})[_0x4d91('0x26')](function(_0x4c70af){_0xa63422[_0x4d91('0x44')]=_0x4c70af;return _0xa63422;})[_0x4d91('0x26')](respondWithFilteredResult(_0x31bbf8,_0x468e95))[_0x4d91('0x45')](handleError(_0x31bbf8,null));};exports[_0x4d91('0x46')]=function(_0x20ec78,_0x1fc884){var _0x4b8e12={'raw':!![],'where':{'id':_0x20ec78[_0x4d91('0x47')]['id']}},_0x4ffc08={};_0x4ffc08[_0x4d91('0x33')]=_['keys'](db[_0x4d91('0x41')][_0x4d91('0x2d')]);_0x4ffc08[_0x4d91('0x30')]=_[_0x4d91('0x31')](_0x20ec78[_0x4d91('0x30')]);_0x4ffc08[_0x4d91('0x3d')]=_[_0x4d91('0x32')](_0x4ffc08[_0x4d91('0x33')],_0x4ffc08[_0x4d91('0x30')]);_0x4b8e12['attributes']=_['intersection'](_0x4ffc08[_0x4d91('0x33')],qs['fields'](_0x20ec78[_0x4d91('0x30')][_0x4d91('0x35')]));_0x4b8e12[_0x4d91('0x34')]=_0x4b8e12[_0x4d91('0x34')]['length']?_0x4b8e12[_0x4d91('0x34')]:_0x4ffc08['model'];if(_0x20ec78['query'][_0x4d91('0x42')]){_0x4b8e12[_0x4d91('0x43')]=[{'all':!![]}];}_0x4b8e12=_[_0x4d91('0x48')]({},_0x4b8e12,_0x20ec78[_0x4d91('0x40')]);return db[_0x4d91('0x41')][_0x4d91('0x49')](_0x4b8e12)['then'](handleEntityNotFound(_0x1fc884,null))[_0x4d91('0x26')](respondWithResult(_0x1fc884,null))[_0x4d91('0x45')](handleError(_0x1fc884,null));};exports[_0x4d91('0x4a')]=function(_0x449dd8,_0x106e5b){return db[_0x4d91('0x41')][_0x4d91('0x4a')](_0x449dd8[_0x4d91('0x4b')],{})[_0x4d91('0x26')](function(_0x145dfd){var _0x16f776=_0x449dd8['user'][_0x4d91('0x4c')]({'plain':!![]});if(!_0x16f776)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16f776[_0x4d91('0x4d')]===_0x4d91('0x4e')){var _0x195e65=_0x145dfd[_0x4d91('0x4c')]({'plain':!![]});var _0x436a3d=_0x4d91('0x28');return db[_0x4d91('0x4f')][_0x4d91('0x49')]({'where':{'name':_0x436a3d,'userProfileId':_0x16f776['userProfileId']},'raw':!![]})[_0x4d91('0x26')](function(_0x43e72c){if(_0x43e72c&&_0x43e72c[_0x4d91('0x50')]===0x0){return db[_0x4d91('0x29')][_0x4d91('0x4a')]({'name':_0x195e65[_0x4d91('0x2a')],'resourceId':_0x195e65['id'],'type':_0x43e72c[_0x4d91('0x2a')],'sectionId':_0x43e72c['id']},{})['then'](function(){return _0x145dfd;});}else{return _0x145dfd;}})[_0x4d91('0x45')](function(_0x2159e4){logger[_0x4d91('0x51')](_0x4d91('0x52'),_0x2159e4);throw _0x2159e4;});}return _0x145dfd;})[_0x4d91('0x26')](respondWithResult(_0x106e5b,0xc9))[_0x4d91('0x45')](handleError(_0x106e5b,null));};exports[_0x4d91('0x25')]=function(_0x4138c5,_0x645923){if(_0x4138c5[_0x4d91('0x4b')]['id']){delete _0x4138c5[_0x4d91('0x4b')]['id'];}return db[_0x4d91('0x41')][_0x4d91('0x49')]({'where':{'id':_0x4138c5[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x645923,null))[_0x4d91('0x26')](saveUpdates(_0x4138c5[_0x4d91('0x4b')],null))['then'](respondWithResult(_0x645923,null))['catch'](handleError(_0x645923,null));};exports['destroy']=function(_0x45cf4e,_0x10c1dd){return db[_0x4d91('0x41')]['find']({'where':{'id':_0x45cf4e[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x10c1dd,null))[_0x4d91('0x26')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x45cf4e['params']['id']}}))[_0x4d91('0x26')](removeEntity(_0x10c1dd,null))[_0x4d91('0x45')](handleError(_0x10c1dd,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index ce5b28d..4dc5fbc 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 _0xa978=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types'];(function(_0xe443f3,_0x2b0e94){var _0x24cfe=function(_0x1c394e){while(--_0x1c394e){_0xe443f3['push'](_0xe443f3['shift']());}};_0x24cfe(++_0x2b0e94);}(_0xa978,0x145));var _0x8a97=function(_0x16e85b,_0x3aedbd){_0x16e85b=_0x16e85b-0x0;var _0x4dc26f=_0xa978[_0x16e85b];return _0x4dc26f;};'use strict';var _=require(_0x8a97('0x0'));var util=require(_0x8a97('0x1'));var logger=require(_0x8a97('0x2'))(_0x8a97('0x3'));var moment=require('moment');var BPromise=require(_0x8a97('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a97('0x5'));var rimraf=require(_0x8a97('0x6'));var config=require(_0x8a97('0x7'));var attributes=require(_0x8a97('0x8'));module[_0x8a97('0x9')]=function(_0x5b9b3c,_0x22a8cd){return _0x5b9b3c[_0x8a97('0xa')](_0x8a97('0xb'),attributes,{'tableName':_0x8a97('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x209d=['moment','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','tools_contact_item_types','lodash','util','../../config/logger','api'];(function(_0x38e1e6,_0x1f695a){var _0x541808=function(_0x43b930){while(--_0x43b930){_0x38e1e6['push'](_0x38e1e6['shift']());}};_0x541808(++_0x1f695a);}(_0x209d,0xec));var _0xd209=function(_0x57e623,_0xc21662){_0x57e623=_0x57e623-0x0;var _0x57a085=_0x209d[_0x57e623];return _0x57a085;};'use strict';var _=require(_0xd209('0x0'));var util=require(_0xd209('0x1'));var logger=require(_0xd209('0x2'))(_0xd209('0x3'));var moment=require(_0xd209('0x4'));var BPromise=require('bluebird');var rp=require(_0xd209('0x5'));var fs=require('fs');var path=require(_0xd209('0x6'));var rimraf=require(_0xd209('0x7'));var config=require(_0xd209('0x8'));var attributes=require(_0xd209('0x9'));module[_0xd209('0xa')]=function(_0x54102f,_0x52bbde){return _0x54102f['define']('ContactItemType',attributes,{'tableName':_0xd209('0xb'),'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 2f53be6..448bf1d 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 _0xe09d=['code','message','result','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2d12f2,_0x5befbb){var _0x592e8c=function(_0x1a2311){while(--_0x1a2311){_0x2d12f2['push'](_0x2d12f2['shift']());}};_0x592e8c(++_0x5befbb);}(_0xe09d,0x9d));var _0xde09=function(_0x1b38f0,_0x2ac7e6){_0x1b38f0=_0x1b38f0-0x0;var _0x1822e2=_0xe09d[_0x1b38f0];return _0x1822e2;};'use strict';var _=require(_0xde09('0x0'));var util=require(_0xde09('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xde09('0x2'));var fs=require('fs');var Redis=require(_0xde09('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xde09('0x4'));var logger=require(_0xde09('0x5'))('rpc');var config=require(_0xde09('0x6'));var jayson=require(_0xde09('0x7'));var client=jayson[_0xde09('0x8')][_0xde09('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22134c,_0x9a458,_0x4302e8){return new BPromise(function(_0x44e890,_0x588823){return client[_0xde09('0xa')](_0x22134c,_0x4302e8)[_0xde09('0xb')](function(_0x202936){logger[_0xde09('0xc')](_0xde09('0xd'),_0x9a458,_0xde09('0xe'));logger[_0xde09('0xf')](_0xde09('0x10'),_0x9a458,_0xde09('0xe'),JSON[_0xde09('0x11')](_0x202936));if(_0x202936[_0xde09('0x12')]){if(_0x202936[_0xde09('0x12')][_0xde09('0x13')]===0x1f4){logger[_0xde09('0x12')](_0xde09('0xd'),_0x9a458,_0x202936[_0xde09('0x12')][_0xde09('0x14')]);return _0x588823(_0x202936[_0xde09('0x12')][_0xde09('0x14')]);}logger['error'](_0xde09('0xd'),_0x9a458,_0x202936[_0xde09('0x12')][_0xde09('0x14')]);return _0x44e890(_0x202936[_0xde09('0x12')][_0xde09('0x14')]);}else{logger['info'](_0xde09('0xd'),_0x9a458,_0xde09('0xe'));_0x44e890(_0x202936[_0xde09('0x15')]['message']);}})['catch'](function(_0x351472){logger[_0xde09('0x12')](_0xde09('0xd'),_0x9a458,_0x351472);_0x588823(_0x351472);});});} \ No newline at end of file +var _0x5ae6=['catch','lodash','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x427e50,_0x5a1c6b){var _0x26d120=function(_0x451498){while(--_0x451498){_0x427e50['push'](_0x427e50['shift']());}};_0x26d120(++_0x5a1c6b);}(_0x5ae6,0x105));var _0x65ae=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0x5ae6[_0x450bf9];return _0x268350;};'use strict';var _=require(_0x65ae('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x65ae('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ae('0x2'))['db'];var utils=require(_0x65ae('0x3'));var logger=require('../../config/logger')(_0x65ae('0x4'));var config=require('../../config/environment');var jayson=require(_0x65ae('0x5'));var client=jayson[_0x65ae('0x6')][_0x65ae('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15751b,_0x3eb49b,_0x49ee85){return new BPromise(function(_0x36a3d6,_0x1f20b6){return client[_0x65ae('0x8')](_0x15751b,_0x49ee85)['then'](function(_0x33526c){logger[_0x65ae('0x9')](_0x65ae('0xa'),_0x3eb49b,_0x65ae('0xb'));logger[_0x65ae('0xc')](_0x65ae('0xd'),_0x3eb49b,_0x65ae('0xb'),JSON[_0x65ae('0xe')](_0x33526c));if(_0x33526c[_0x65ae('0xf')]){if(_0x33526c['error'][_0x65ae('0x10')]===0x1f4){logger['error'](_0x65ae('0xa'),_0x3eb49b,_0x33526c['error'][_0x65ae('0x11')]);return _0x1f20b6(_0x33526c[_0x65ae('0xf')][_0x65ae('0x11')]);}logger[_0x65ae('0xf')]('ContactItemType,\x20%s,\x20%s',_0x3eb49b,_0x33526c[_0x65ae('0xf')][_0x65ae('0x11')]);return _0x36a3d6(_0x33526c[_0x65ae('0xf')][_0x65ae('0x11')]);}else{logger[_0x65ae('0x9')](_0x65ae('0xa'),_0x3eb49b,_0x65ae('0xb'));_0x36a3d6(_0x33526c[_0x65ae('0x12')][_0x65ae('0x11')]);}})[_0x65ae('0x13')](function(_0x129fa4){logger[_0x65ae('0xf')](_0x65ae('0xa'),_0x3eb49b,_0x129fa4);_0x1f20b6(_0x129fa4);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 23aa766..2e30cc7 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 _0x335a=['put','/:id','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','show','post','create'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_0x335a,0x112));var _0xa335=function(_0x3d78ca,_0x5a5cd6){_0x3d78ca=_0x3d78ca-0x0;var _0x212cb7=_0x335a[_0x3d78ca];return _0x212cb7;};'use strict';var multer=require(_0xa335('0x0'));var util=require('util');var path=require(_0xa335('0x1'));var timeout=require(_0xa335('0x2'));var express=require(_0xa335('0x3'));var router=express[_0xa335('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa335('0x5'));var interaction=require(_0xa335('0x6'));var config=require(_0xa335('0x7'));var controller=require(_0xa335('0x8'));router[_0xa335('0x9')]('/',auth[_0xa335('0xa')](),controller['index']);router[_0xa335('0x9')]('/:id',auth[_0xa335('0xa')](),controller[_0xa335('0xb')]);router[_0xa335('0xc')]('/',auth[_0xa335('0xa')](),controller[_0xa335('0xd')]);router[_0xa335('0xe')](_0xa335('0xf'),auth[_0xa335('0xa')](),controller[_0xa335('0x10')]);router['delete'](_0xa335('0xf'),auth[_0xa335('0xa')](),controller['destroy']);module[_0xa335('0x11')]=router; \ No newline at end of file +var _0x784d=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','put','update','delete','exports'];(function(_0x28cd2e,_0x4e8564){var _0x14a9c9=function(_0xbd8d05){while(--_0xbd8d05){_0x28cd2e['push'](_0x28cd2e['shift']());}};_0x14a9c9(++_0x4e8564);}(_0x784d,0x1c0));var _0xd784=function(_0x1f7341,_0x4076a2){_0x1f7341=_0x1f7341-0x0;var _0x410a8c=_0x784d[_0x1f7341];return _0x410a8c;};'use strict';var multer=require('multer');var util=require(_0xd784('0x0'));var path=require(_0xd784('0x1'));var timeout=require('connect-timeout');var express=require(_0xd784('0x2'));var router=express['Router']();var fs_extra=require(_0xd784('0x3'));var auth=require(_0xd784('0x4'));var interaction=require(_0xd784('0x5'));var config=require(_0xd784('0x6'));var controller=require(_0xd784('0x7'));router[_0xd784('0x8')]('/',auth[_0xd784('0x9')](),controller['index']);router[_0xd784('0x8')](_0xd784('0xa'),auth[_0xd784('0x9')](),controller[_0xd784('0xb')]);router['post']('/',auth[_0xd784('0x9')](),controller['create']);router[_0xd784('0xc')](_0xd784('0xa'),auth[_0xd784('0x9')](),controller[_0xd784('0xd')]);router[_0xd784('0xe')](_0xd784('0xa'),auth[_0xd784('0x9')](),controller['destroy']);module[_0xd784('0xf')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index fdcb0b9..da362a5 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(_0x3262e7,_0xae980f){var _0x297196=function(_0x408dd7){while(--_0x408dd7){_0x3262e7['push'](_0x3262e7['shift']());}};_0x297196(++_0xae980f);}(_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 _0xd8b0=['exports','sequelize'];(function(_0x2fef70,_0x529198){var _0x1b2868=function(_0x19cbef){while(--_0x19cbef){_0x2fef70['push'](_0x2fef70['shift']());}};_0x1b2868(++_0x529198);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 9598c0b..003fdfe 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 _0xc332=['attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','pick','hasOwnProperty','nolimit','getItems','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','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','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','json','limit','undefined','count','offset','set','apply','save','then','get','UserProfileResource','end','name','send','index','map','Dashboard','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','createdAt','updatedAt','body','omit','error','destroy','attrUrl','attrs','value','https://','custom','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total'];(function(_0x2db417,_0x1e53e1){var _0x3b421e=function(_0x53792a){while(--_0x53792a){_0x2db417['push'](_0x2db417['shift']());}};_0x3b421e(++_0x1e53e1);}(_0xc332,0x9e));var _0x2c33=function(_0x4e691f,_0x3d7dd8){_0x4e691f=_0x4e691f-0x0;var _0x47793f=_0xc332[_0x4e691f];return _0x47793f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c33('0x0'));var zipdir=require(_0x2c33('0x1'));var jsonpatch=require(_0x2c33('0x2'));var rp=require(_0x2c33('0x3'));var moment=require(_0x2c33('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2c33('0x5'));var util=require(_0x2c33('0x6'));var path=require(_0x2c33('0x7'));var sox=require(_0x2c33('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c33('0x9'));var _=require(_0x2c33('0xa'));var squel=require(_0x2c33('0xb'));var crypto=require('crypto');var jsforce=require(_0x2c33('0xc'));var deskjs=require(_0x2c33('0xd'));var toCsv=require(_0x2c33('0xe'));var querystring=require(_0x2c33('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2c33('0x10'));var qs=require(_0x2c33('0x11'));var as=require(_0x2c33('0x12'));var hardwareService=require(_0x2c33('0x13'));var logger=require(_0x2c33('0x14'))(_0x2c33('0x15'));var utils=require(_0x2c33('0x16'));var config=require(_0x2c33('0x17'));var licenseUtil=require(_0x2c33('0x18'));var db=require(_0x2c33('0x19'))['db'];config[_0x2c33('0x1a')]=_[_0x2c33('0x1b')](config['redis'],{'host':_0x2c33('0x1c'),'port':0x18eb});var socket=require(_0x2c33('0x1d'))(new Redis(config[_0x2c33('0x1a')]));require(_0x2c33('0x1e'))['register'](socket);function respondWithStatusCode(_0x58e92e,_0x18a7aa){_0x18a7aa=_0x18a7aa||0xcc;return function(_0x451cb9){if(_0x451cb9){return _0x58e92e[_0x2c33('0x1f')](_0x18a7aa);}return _0x58e92e['status'](_0x18a7aa)['end']();};}function respondWithResult(_0x1f082c,_0x62e1e2){_0x62e1e2=_0x62e1e2||0xc8;return function(_0x550674){if(_0x550674){return _0x1f082c[_0x2c33('0x20')](_0x62e1e2)[_0x2c33('0x21')](_0x550674);}};}function respondWithFilteredResult(_0x245eaa,_0xf1f569){return function(_0x7ed493){if(_0x7ed493){var _0x55db7c=typeof _0xf1f569['offset']==='undefined'&&typeof _0xf1f569[_0x2c33('0x22')]===_0x2c33('0x23');var _0x515baf=_0x7ed493[_0x2c33('0x24')];var _0x36d486=_0x55db7c?0x0:_0xf1f569[_0x2c33('0x25')];var _0x25c2ce=_0x55db7c?_0x7ed493[_0x2c33('0x24')]:_0xf1f569['offset']+_0xf1f569[_0x2c33('0x22')];var _0x453bfc;if(_0x25c2ce>=_0x515baf){_0x25c2ce=_0x515baf;_0x453bfc=0xc8;}else{_0x453bfc=0xce;}_0x245eaa[_0x2c33('0x20')](_0x453bfc);return _0x245eaa[_0x2c33('0x26')]('Content-Range',_0x36d486+'-'+_0x25c2ce+'/'+_0x515baf)['json'](_0x7ed493);}return null;};}function patchUpdates(_0x4cd36f){return function(_0x12fb8d){try{jsonpatch[_0x2c33('0x27')](_0x12fb8d,_0x4cd36f,!![]);}catch(_0x584bfe){return BPromise['reject'](_0x584bfe);}return _0x12fb8d[_0x2c33('0x28')]();};}function saveUpdates(_0x52b571,_0x4632cd){return function(_0xfe6fcf){if(_0xfe6fcf){return _0xfe6fcf['update'](_0x52b571)[_0x2c33('0x29')](function(_0x337e76){return _0x337e76;});}return null;};}function removeEntity(_0x400d8a,_0x391ea3){return function(_0x2c9f3c){if(_0x2c9f3c){return _0x2c9f3c['destroy']()[_0x2c33('0x29')](function(){var _0x1153ad=_0x2c9f3c[_0x2c33('0x2a')]({'plain':!![]});var _0x26870d='CustomDashboards';return db[_0x2c33('0x2b')]['destroy']({'where':{'type':_0x26870d,'resourceId':_0x1153ad['id']}})[_0x2c33('0x29')](function(){return _0x2c9f3c;});})[_0x2c33('0x29')](function(){_0x400d8a[_0x2c33('0x20')](0xcc)[_0x2c33('0x2c')]();});}};}function handleEntityNotFound(_0x5369e6,_0x165c62){return function(_0x7a241a){if(!_0x7a241a){_0x5369e6[_0x2c33('0x1f')](0x194);}return _0x7a241a;};}function handleError(_0x534e94,_0x18f1dd){_0x18f1dd=_0x18f1dd||0x1f4;return function(_0x5827da){logger['error'](_0x5827da['stack']);if(_0x5827da[_0x2c33('0x2d')]){delete _0x5827da[_0x2c33('0x2d')];}_0x534e94[_0x2c33('0x20')](_0x18f1dd)[_0x2c33('0x2e')](_0x5827da);};}exports[_0x2c33('0x2f')]=function(_0x5eb718,_0x4a715f){var _0x414a79={},_0xec68bb={},_0xcc234d={'count':0x0,'rows':[]};var _0x78692b=_[_0x2c33('0x30')](db[_0x2c33('0x31')][_0x2c33('0x32')],function(_0x414538){return{'name':_0x414538['fieldName'],'type':_0x414538[_0x2c33('0x33')][_0x2c33('0x34')]};});_0xec68bb['model']=_['map'](_0x78692b,_0x2c33('0x2d'));_0xec68bb['query']=_['keys'](_0x5eb718[_0x2c33('0x35')]);_0xec68bb[_0x2c33('0x36')]=_[_0x2c33('0x37')](_0xec68bb[_0x2c33('0x38')],_0xec68bb['query']);_0x414a79[_0x2c33('0x39')]=_[_0x2c33('0x37')](_0xec68bb[_0x2c33('0x38')],qs[_0x2c33('0x3a')](_0x5eb718[_0x2c33('0x35')][_0x2c33('0x3a')]));_0x414a79['attributes']=_0x414a79[_0x2c33('0x39')]['length']?_0x414a79[_0x2c33('0x39')]:_0xec68bb[_0x2c33('0x38')];if(!_0x5eb718[_0x2c33('0x35')]['hasOwnProperty']('nolimit')){_0x414a79[_0x2c33('0x22')]=qs[_0x2c33('0x22')](_0x5eb718['query']['limit']);_0x414a79[_0x2c33('0x25')]=qs[_0x2c33('0x25')](_0x5eb718['query'][_0x2c33('0x25')]);}_0x414a79[_0x2c33('0x3b')]=qs[_0x2c33('0x3c')](_0x5eb718[_0x2c33('0x35')][_0x2c33('0x3c')]);_0x414a79[_0x2c33('0x3d')]=qs[_0x2c33('0x36')](_['pick'](_0x5eb718[_0x2c33('0x35')],_0xec68bb[_0x2c33('0x36')]),_0x78692b);if(_0x5eb718[_0x2c33('0x35')][_0x2c33('0x3e')]){_0x414a79[_0x2c33('0x3d')]=_['merge'](_0x414a79[_0x2c33('0x3d')],{'$or':_['map'](_0x78692b,function(_0x1d0f8a){if(_0x1d0f8a[_0x2c33('0x33')]!==_0x2c33('0x3f')){var _0xdc6b07={};_0xdc6b07[_0x1d0f8a[_0x2c33('0x2d')]]={'$like':'%'+_0x5eb718['query']['filter']+'%'};return _0xdc6b07;}})});}_0x414a79=_[_0x2c33('0x40')]({},_0x414a79,_0x5eb718[_0x2c33('0x41')]);var _0x2a1cf7={'where':_0x414a79[_0x2c33('0x3d')]};return db['Dashboard'][_0x2c33('0x24')](_0x2a1cf7)[_0x2c33('0x29')](function(_0x539164){_0xcc234d['count']=_0x539164;if(_0x5eb718[_0x2c33('0x35')][_0x2c33('0x42')]){_0x414a79[_0x2c33('0x43')]=[{'all':!![]}];}return db[_0x2c33('0x31')]['findAll'](_0x414a79);})['then'](function(_0x28f03c){_0xcc234d[_0x2c33('0x44')]=_0x28f03c;return _0xcc234d;})[_0x2c33('0x29')](respondWithFilteredResult(_0x4a715f,_0x414a79))[_0x2c33('0x45')](handleError(_0x4a715f,null));};exports['show']=function(_0x129a81,_0x35e263){var _0x59e000={'raw':![],'where':{'id':_0x129a81[_0x2c33('0x46')]['id']}},_0x56ae83={};_0x56ae83[_0x2c33('0x38')]=_[_0x2c33('0x47')](db[_0x2c33('0x31')][_0x2c33('0x32')]);_0x56ae83[_0x2c33('0x35')]=_[_0x2c33('0x47')](_0x129a81['query']);_0x56ae83[_0x2c33('0x36')]=_[_0x2c33('0x37')](_0x56ae83[_0x2c33('0x38')],_0x56ae83[_0x2c33('0x35')]);_0x59e000[_0x2c33('0x39')]=_['intersection'](_0x56ae83[_0x2c33('0x38')],qs['fields'](_0x129a81['query']['fields']));_0x59e000[_0x2c33('0x39')]=_0x59e000[_0x2c33('0x39')]['length']?_0x59e000[_0x2c33('0x39')]:_0x56ae83[_0x2c33('0x38')];if(_0x129a81['query']['includeAll']){_0x59e000[_0x2c33('0x43')]=[{'all':!![]}];}_0x59e000=_[_0x2c33('0x40')]({},_0x59e000,_0x129a81[_0x2c33('0x41')]);return db[_0x2c33('0x31')][_0x2c33('0x48')](_0x59e000)[_0x2c33('0x29')](handleEntityNotFound(_0x35e263,null))['then'](respondWithResult(_0x35e263,null))['catch'](handleError(_0x35e263,null));};exports[_0x2c33('0x49')]=function(_0x1b2cba,_0x221235){return db['Dashboard'][_0x2c33('0x49')](_0x1b2cba['body'],{})['then'](function(_0x2efd29){var _0x2e9bdf=_0x1b2cba[_0x2c33('0x4a')]['get']({'plain':!![]});if(!_0x2e9bdf)throw new Error(_0x2c33('0x4b'));if(_0x2e9bdf[_0x2c33('0x4c')]===_0x2c33('0x4a')){var _0x202443=_0x2efd29[_0x2c33('0x2a')]({'plain':!![]});var _0x223499=_0x2c33('0x4d');return db[_0x2c33('0x4e')][_0x2c33('0x48')]({'where':{'name':_0x223499,'userProfileId':_0x2e9bdf[_0x2c33('0x4f')]},'raw':!![]})['then'](function(_0x2cf595){if(_0x2cf595&&_0x2cf595[_0x2c33('0x50')]===0x0){return db[_0x2c33('0x2b')][_0x2c33('0x49')]({'name':_0x202443[_0x2c33('0x2d')],'resourceId':_0x202443['id'],'type':_0x2cf595['name'],'sectionId':_0x2cf595['id']},{})[_0x2c33('0x29')](function(){return _0x2efd29;});}else{return _0x2efd29;}})[_0x2c33('0x45')](function(_0x36c6f0){logger['error'](_0x2c33('0x51'),_0x36c6f0);throw _0x36c6f0;});}return _0x2efd29;})[_0x2c33('0x29')](respondWithResult(_0x221235,0xc9))[_0x2c33('0x45')](handleError(_0x221235,null));};exports[_0x2c33('0x52')]=function(_0x145cff,_0x58920e){var _0x1a227a={'where':{'id':_0x145cff[_0x2c33('0x46')]['id']}},_0x9df663={};_0x9df663[_0x2c33('0x38')]=_['keys'](db[_0x2c33('0x31')][_0x2c33('0x32')]);_0x1a227a[_0x2c33('0x39')]=_[_0x2c33('0x37')](_0x9df663[_0x2c33('0x38')],qs[_0x2c33('0x3a')](_0x145cff[_0x2c33('0x35')][_0x2c33('0x3a')]));_0x1a227a['attributes']=_0x1a227a[_0x2c33('0x39')][_0x2c33('0x53')]?_0x1a227a[_0x2c33('0x39')]:_0x9df663[_0x2c33('0x38')];if(_0x145cff[_0x2c33('0x35')][_0x2c33('0x42')]){_0x1a227a['include']=[{'all':!![]}];}_0x1a227a=_['merge']({},_0x1a227a,_0x145cff[_0x2c33('0x41')]);return db[_0x2c33('0x31')][_0x2c33('0x48')](_0x1a227a)[_0x2c33('0x29')](handleEntityNotFound(_0x58920e,null))[_0x2c33('0x29')](function(_0x3835f5){if(_0x3835f5){var _0x30c895=_0x3835f5[_0x2c33('0x2a')]({'plain':!![]});_0x30c895=qs['omit'](_0x30c895,['id',_0x2c33('0x54'),_0x2c33('0x55')]);_0x145cff[_0x2c33('0x56')]=_[_0x2c33('0x57')](_0x145cff['body'],['id',_0x2c33('0x54'),_0x2c33('0x55')]);return db['Dashboard'][_0x2c33('0x49')](_[_0x2c33('0x40')](_0x30c895,_0x145cff[_0x2c33('0x56')]),{'include':_0x145cff[_0x2c33('0x35')][_0x2c33('0x42')]?[{'all':!![]}]:undefined})[_0x2c33('0x29')](function(_0x20101f){var _0x18fedf=_0x145cff[_0x2c33('0x4a')][_0x2c33('0x2a')]({'plain':!![]});if(!_0x18fedf)throw new Error(_0x2c33('0x4b'));if(_0x18fedf[_0x2c33('0x4c')]===_0x2c33('0x4a')){var _0x34df3e=_0x20101f[_0x2c33('0x2a')]({'plain':!![]});var _0x159b7e=_0x2c33('0x4d');return db[_0x2c33('0x4e')]['find']({'where':{'name':_0x159b7e,'userProfileId':_0x18fedf['userProfileId']},'raw':!![]})[_0x2c33('0x29')](function(_0x5f8b8){if(_0x5f8b8&&_0x5f8b8[_0x2c33('0x50')]===0x0){return db[_0x2c33('0x2b')][_0x2c33('0x49')]({'name':_0x34df3e[_0x2c33('0x2d')],'resourceId':_0x34df3e['id'],'type':_0x5f8b8[_0x2c33('0x2d')],'sectionId':_0x5f8b8['id']},{})['then'](function(){return _0x20101f;});}else{return _0x20101f;}})[_0x2c33('0x45')](function(_0x110ddd){logger[_0x2c33('0x58')](_0x2c33('0x51'),_0x110ddd);throw _0x110ddd;});}return _0x20101f;});}})[_0x2c33('0x29')](respondWithResult(_0x58920e,0xc9))[_0x2c33('0x45')](handleError(_0x58920e,null));};exports['update']=function(_0x1fcfb9,_0x347728){if(_0x1fcfb9[_0x2c33('0x56')]['id']){delete _0x1fcfb9['body']['id'];}return db[_0x2c33('0x31')]['find']({'where':{'id':_0x1fcfb9[_0x2c33('0x46')]['id']}})[_0x2c33('0x29')](handleEntityNotFound(_0x347728,null))['then'](saveUpdates(_0x1fcfb9['body'],null))['then'](respondWithResult(_0x347728,null))['catch'](handleError(_0x347728,null));};exports[_0x2c33('0x59')]=function(_0x5ef495,_0x46f624){return db[_0x2c33('0x31')][_0x2c33('0x48')]({'where':{'id':_0x5ef495[_0x2c33('0x46')]['id']}})['then'](handleEntityNotFound(_0x46f624,null))[_0x2c33('0x29')](removeEntity(_0x46f624,null))[_0x2c33('0x45')](handleError(_0x46f624,null));};function widgetAttributes(_0x378117){try{switch(_0x378117[_0x2c33('0x33')]){case'iframe':return[{'name':_0x2c33('0x5a'),'value':_0x378117[_0x2c33('0x5a')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117['attrs'][0x0]?_0x378117[_0x2c33('0x5b')][0x0][_0x2c33('0x5c')]:undefined)||_0x2c33('0x5d')}];case _0x2c33('0x5e'):return[{'name':_0x2c33('0x5f'),'value':_0x378117[_0x2c33('0x5f')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117[_0x2c33('0x5b')][0x0]?_0x378117[_0x2c33('0x5b')][0x0][_0x2c33('0x5c')]:undefined)||''}];case _0x2c33('0x60'):return[{'name':'attrHourFormat','value':_0x378117['attrHourFormat']||(_0x378117['attrs']&&_0x378117[_0x2c33('0x5b')][0x0]?_0x378117[_0x2c33('0x5b')][0x0]['value']:undefined)||_0x2c33('0x61')},{'name':_0x2c33('0x62'),'value':_0x378117[_0x2c33('0x62')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117[_0x2c33('0x5b')][0x1]?_0x378117[_0x2c33('0x5b')][0x1][_0x2c33('0x5c')]:undefined)||_0x2c33('0x63')},{'name':_0x2c33('0x64'),'value':_0x378117['attrFontSize']||(_0x378117['attrs']&&_0x378117[_0x2c33('0x5b')][0x2]?_0x378117[_0x2c33('0x5b')][0x2][_0x2c33('0x5c')]:undefined)||0xc}];case _0x2c33('0x65'):return[{'name':_0x2c33('0x66'),'value':_0x378117[_0x2c33('0x66')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117[_0x2c33('0x5b')][0x0]?_0x378117[_0x2c33('0x5b')][0x0][_0x2c33('0x5c')]:undefined)||_0x2c33('0x67')},{'name':'attrVoiceQueues','value':_0x378117[_0x2c33('0x68')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117['attrs'][0x1]?_0x378117['attrs'][0x1][_0x2c33('0x5c')]:undefined)||[]},{'name':'attrFontSize','value':_0x378117[_0x2c33('0x64')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117[_0x2c33('0x5b')][0x2]?_0x378117[_0x2c33('0x5b')][0x2][_0x2c33('0x5c')]:undefined)||0x14},{'name':'attrChannel','value':_0x378117[_0x2c33('0x69')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117[_0x2c33('0x5b')][0x3]?_0x378117['attrs'][0x3]['value']:undefined)||_0x2c33('0x6a')},{'name':_0x2c33('0x6b'),'value':_0x378117[_0x2c33('0x6b')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117['attrs'][0x4]?_0x378117[_0x2c33('0x5b')][0x4][_0x2c33('0x5c')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x378117[_0x2c33('0x6c')]||(_0x378117['attrs']&&_0x378117[_0x2c33('0x5b')][0x5]?_0x378117[_0x2c33('0x5b')][0x5][_0x2c33('0x5c')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x378117['attrSmsAccounts']||(_0x378117[_0x2c33('0x5b')]&&_0x378117[_0x2c33('0x5b')][0x6]?_0x378117[_0x2c33('0x5b')][0x6]['value']:undefined)||''},{'name':_0x2c33('0x6d'),'value':_0x378117[_0x2c33('0x6d')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117[_0x2c33('0x5b')][0x7]?_0x378117[_0x2c33('0x5b')][0x7][_0x2c33('0x5c')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x378117[_0x2c33('0x6e')]||(_0x378117['attrs']&&_0x378117['attrs'][0x8]?_0x378117[_0x2c33('0x5b')][0x8][_0x2c33('0x5c')]:undefined)||''},{'name':_0x2c33('0x6f'),'value':_0x378117[_0x2c33('0x6f')]||(_0x378117['attrs']&&_0x378117[_0x2c33('0x5b')][0x9]?_0x378117[_0x2c33('0x5b')][0x9][_0x2c33('0x5c')]:undefined)||''}];case'multibar-chart':case _0x2c33('0x70'):return[{'name':_0x2c33('0x71'),'value':_0x378117['attrSerie1']||(_0x378117[_0x2c33('0x5b')]&&_0x378117[_0x2c33('0x5b')][0x0]?_0x378117[_0x2c33('0x5b')][0x0]['value']:undefined)||_0x2c33('0x67')},{'name':_0x2c33('0x72'),'value':_0x378117[_0x2c33('0x72')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117[_0x2c33('0x5b')][0x1]?_0x378117[_0x2c33('0x5b')][0x1]['value']:undefined)||null},{'name':_0x2c33('0x73'),'value':_0x378117[_0x2c33('0x73')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117[_0x2c33('0x5b')][0x2]?_0x378117[_0x2c33('0x5b')][0x2][_0x2c33('0x5c')]:undefined)||null},{'name':_0x2c33('0x68'),'value':_0x378117[_0x2c33('0x68')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117['attrs'][0x3]?_0x378117['attrs'][0x3][_0x2c33('0x5c')]:undefined)||[]},{'name':'attrChannel','value':_0x378117['attrChannel']||(_0x378117[_0x2c33('0x5b')]&&_0x378117[_0x2c33('0x5b')][0x4]?_0x378117['attrs'][0x4][_0x2c33('0x5c')]:undefined)||_0x2c33('0x6a')},{'name':_0x2c33('0x6b'),'value':_0x378117[_0x2c33('0x6b')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117['attrs'][0x5]?_0x378117['attrs'][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x378117[_0x2c33('0x6c')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117[_0x2c33('0x5b')][0x6]?_0x378117[_0x2c33('0x5b')][0x6][_0x2c33('0x5c')]:undefined)||''},{'name':_0x2c33('0x74'),'value':_0x378117['attrSmsAccounts']||(_0x378117['attrs']&&_0x378117[_0x2c33('0x5b')][0x7]?_0x378117[_0x2c33('0x5b')][0x7][_0x2c33('0x5c')]:undefined)||''},{'name':_0x2c33('0x6d'),'value':_0x378117[_0x2c33('0x6d')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117[_0x2c33('0x5b')][0x8]?_0x378117['attrs'][0x8][_0x2c33('0x5c')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x378117[_0x2c33('0x6e')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117[_0x2c33('0x5b')][0x9]?_0x378117[_0x2c33('0x5b')][0x9][_0x2c33('0x5c')]:undefined)||''},{'name':_0x2c33('0x6f'),'value':_0x378117[_0x2c33('0x6f')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117[_0x2c33('0x5b')][0xa]?_0x378117['attrs'][0xa]['value']:undefined)||''}];case _0x2c33('0x75'):return[{'name':'attrReport','type':_0x378117[_0x2c33('0x76')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117[_0x2c33('0x5b')][0x0]?_0x378117[_0x2c33('0x5b')][0x0][_0x2c33('0x33')]:undefined)||null,'value':_0x378117[_0x2c33('0x77')]||(_0x378117[_0x2c33('0x5b')]&&_0x378117[_0x2c33('0x5b')][0x0]?_0x378117[_0x2c33('0x5b')][0x0][_0x2c33('0x5c')]:undefined)||null},{'name':_0x2c33('0x78'),'value':_0x378117['attrRefresh']||(_0x378117[_0x2c33('0x5b')]&&_0x378117[_0x2c33('0x5b')][0x1]?_0x378117[_0x2c33('0x5b')][0x1][_0x2c33('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x4f3d95){logger[_0x2c33('0x58')](_0x2c33('0x79'),JSON[_0x2c33('0x7a')](_0x4f3d95));return[];}}exports[_0x2c33('0x7b')]=function(_0x172203,_0x2ec584,_0x16f2ad){if(_0x172203[_0x2c33('0x56')]['id']){delete _0x172203['body']['id'];}return db[_0x2c33('0x31')][_0x2c33('0x48')]({'where':{'id':_0x172203[_0x2c33('0x46')]['id']}})[_0x2c33('0x29')](handleEntityNotFound(_0x2ec584,null))[_0x2c33('0x29')](function(_0x49e187){if(_0x49e187){_0x172203['body'][_0x2c33('0x7c')]=_0x49e187['id'];_0x172203[_0x2c33('0x56')]['attrs']=widgetAttributes(_0x172203['body']);return db[_0x2c33('0x7d')][_0x2c33('0x49')](_0x172203[_0x2c33('0x56')]);}})[_0x2c33('0x29')](respondWithResult(_0x2ec584,null))['catch'](handleError(_0x2ec584,null));};exports['getItems']=function(_0x2c29a0,_0x17e724,_0x2c1263){var _0x2861cc={};var _0x13e4c4={};var _0x2b68f4;var _0x29a326;return db[_0x2c33('0x31')][_0x2c33('0x7e')]({'where':{'id':_0x2c29a0[_0x2c33('0x46')]['id']}})[_0x2c33('0x29')](handleEntityNotFound(_0x17e724,null))[_0x2c33('0x29')](function(_0x334baa){if(_0x334baa){_0x2b68f4=_0x334baa;_0x13e4c4['model']=_[_0x2c33('0x47')](db[_0x2c33('0x7d')]['rawAttributes']);_0x13e4c4[_0x2c33('0x35')]=_[_0x2c33('0x47')](_0x2c29a0[_0x2c33('0x35')]);_0x13e4c4[_0x2c33('0x36')]=_[_0x2c33('0x37')](_0x13e4c4[_0x2c33('0x38')],_0x13e4c4[_0x2c33('0x35')]);_0x2861cc[_0x2c33('0x39')]=_[_0x2c33('0x37')](_0x13e4c4[_0x2c33('0x38')],qs[_0x2c33('0x3a')](_0x2c29a0[_0x2c33('0x35')][_0x2c33('0x3a')]));_0x2861cc[_0x2c33('0x39')]=_0x2861cc[_0x2c33('0x39')]['length']?_0x2861cc[_0x2c33('0x39')]:_0x13e4c4[_0x2c33('0x38')];_0x2861cc[_0x2c33('0x3b')]=qs[_0x2c33('0x3c')](_0x2c29a0[_0x2c33('0x35')][_0x2c33('0x3c')]);_0x2861cc[_0x2c33('0x3d')]=qs['filters'](_[_0x2c33('0x7f')](_0x2c29a0['query'],_0x13e4c4[_0x2c33('0x36')]));if(_0x2c29a0[_0x2c33('0x35')]['filter']){_0x2861cc['where']=_[_0x2c33('0x40')](_0x2861cc[_0x2c33('0x3d')],{'$or':_['map'](_0x2861cc[_0x2c33('0x39')],function(_0x43f9b9){var _0x1f16bb={};_0x1f16bb[_0x43f9b9]={'$like':'%'+_0x2c29a0['query'][_0x2c33('0x3e')]+'%'};return _0x1f16bb;})});}_0x2861cc=_[_0x2c33('0x40')]({},_0x2861cc,_0x2c29a0['options']);return _0x2b68f4['getItems'](_0x2861cc);}})[_0x2c33('0x29')](function(_0x1b93cf){if(_0x1b93cf){_0x29a326=_0x1b93cf[_0x2c33('0x53')];if(!_0x2c29a0['query'][_0x2c33('0x80')](_0x2c33('0x81'))){_0x2861cc[_0x2c33('0x22')]=qs[_0x2c33('0x22')](_0x2c29a0[_0x2c33('0x35')][_0x2c33('0x22')]);_0x2861cc[_0x2c33('0x25')]=qs[_0x2c33('0x25')](_0x2c29a0['query'][_0x2c33('0x25')]);}return _0x2b68f4[_0x2c33('0x82')](_0x2861cc);}})[_0x2c33('0x29')](function(_0x55947d){if(_0x55947d){return _0x55947d?{'count':_0x29a326,'rows':_0x55947d}:null;}})[_0x2c33('0x29')](respondWithResult(_0x17e724,null))['catch'](handleError(_0x17e724,null));}; \ No newline at end of file +var _0x3831=['attrs','value','custom','attrPath','clock','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','stringify','DashboardId','getItems','findOne','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','sendStatus','error','stack','name','send','index','map','Dashboard','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','role','CustomDashboards','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rawAttributes','merge','omit','updatedAt','createdAt','UserProfileSection','update','iframe','attrUrl'];(function(_0x2963d7,_0x2ae31c){var _0x3095e1=function(_0x3c14c6){while(--_0x3c14c6){_0x2963d7['push'](_0x2963d7['shift']());}};_0x3095e1(++_0x2ae31c);}(_0x3831,0x197));var _0x1383=function(_0x4f9e31,_0x19881c){_0x4f9e31=_0x4f9e31-0x0;var _0x2f9fc7=_0x3831[_0x4f9e31];return _0x2f9fc7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1383('0x0'));var zipdir=require(_0x1383('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1383('0x2'));var moment=require(_0x1383('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1383('0x4'));var util=require('util');var path=require(_0x1383('0x5'));var sox=require(_0x1383('0x6'));var csv=require(_0x1383('0x7'));var ejs=require(_0x1383('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1383('0x9'));var squel=require(_0x1383('0xa'));var crypto=require(_0x1383('0xb'));var jsforce=require(_0x1383('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1383('0x7'));var querystring=require(_0x1383('0xd'));var Papa=require(_0x1383('0xe'));var Redis=require(_0x1383('0xf'));var authService=require(_0x1383('0x10'));var qs=require(_0x1383('0x11'));var as=require(_0x1383('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1383('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1383('0x14'));var db=require(_0x1383('0x15'))['db'];config[_0x1383('0x16')]=_['defaults'](config[_0x1383('0x16')],{'host':_0x1383('0x17'),'port':0x18eb});var socket=require(_0x1383('0x18'))(new Redis(config[_0x1383('0x16')]));require('./dashboard.socket')[_0x1383('0x19')](socket);function respondWithStatusCode(_0x163fba,_0xc030e6){_0xc030e6=_0xc030e6||0xcc;return function(_0x3b8889){if(_0x3b8889){return _0x163fba['sendStatus'](_0xc030e6);}return _0x163fba[_0x1383('0x1a')](_0xc030e6)[_0x1383('0x1b')]();};}function respondWithResult(_0x3e66f1,_0x431eed){_0x431eed=_0x431eed||0xc8;return function(_0x2f957a){if(_0x2f957a){return _0x3e66f1[_0x1383('0x1a')](_0x431eed)[_0x1383('0x1c')](_0x2f957a);}};}function respondWithFilteredResult(_0x4505b5,_0x53bd69){return function(_0x1d1c33){if(_0x1d1c33){var _0x43a876=typeof _0x53bd69[_0x1383('0x1d')]===_0x1383('0x1e')&&typeof _0x53bd69[_0x1383('0x1f')]===_0x1383('0x1e');var _0x5a927a=_0x1d1c33[_0x1383('0x20')];var _0x3e278e=_0x43a876?0x0:_0x53bd69[_0x1383('0x1d')];var _0xf27b4b=_0x43a876?_0x1d1c33['count']:_0x53bd69[_0x1383('0x1d')]+_0x53bd69['limit'];var _0x52d72d;if(_0xf27b4b>=_0x5a927a){_0xf27b4b=_0x5a927a;_0x52d72d=0xc8;}else{_0x52d72d=0xce;}_0x4505b5[_0x1383('0x1a')](_0x52d72d);return _0x4505b5[_0x1383('0x21')](_0x1383('0x22'),_0x3e278e+'-'+_0xf27b4b+'/'+_0x5a927a)[_0x1383('0x1c')](_0x1d1c33);}return null;};}function patchUpdates(_0x550e1f){return function(_0x454c5f){try{jsonpatch[_0x1383('0x23')](_0x454c5f,_0x550e1f,!![]);}catch(_0x156aa2){return BPromise['reject'](_0x156aa2);}return _0x454c5f[_0x1383('0x24')]();};}function saveUpdates(_0x5c883f,_0x344dc0){return function(_0x78b0d6){if(_0x78b0d6){return _0x78b0d6['update'](_0x5c883f)[_0x1383('0x25')](function(_0x2208a6){return _0x2208a6;});}return null;};}function removeEntity(_0x345ca1,_0x2df49d){return function(_0x4c1b2e){if(_0x4c1b2e){return _0x4c1b2e[_0x1383('0x26')]()[_0x1383('0x25')](function(){var _0x5a5375=_0x4c1b2e[_0x1383('0x27')]({'plain':!![]});var _0x5a4fd3='CustomDashboards';return db['UserProfileResource']['destroy']({'where':{'type':_0x5a4fd3,'resourceId':_0x5a5375['id']}})[_0x1383('0x25')](function(){return _0x4c1b2e;});})['then'](function(){_0x345ca1[_0x1383('0x1a')](0xcc)[_0x1383('0x1b')]();});}};}function handleEntityNotFound(_0x827291,_0x1c48b7){return function(_0x5b5f54){if(!_0x5b5f54){_0x827291[_0x1383('0x28')](0x194);}return _0x5b5f54;};}function handleError(_0x135c16,_0x189e1a){_0x189e1a=_0x189e1a||0x1f4;return function(_0x2309fd){logger[_0x1383('0x29')](_0x2309fd[_0x1383('0x2a')]);if(_0x2309fd[_0x1383('0x2b')]){delete _0x2309fd['name'];}_0x135c16[_0x1383('0x1a')](_0x189e1a)[_0x1383('0x2c')](_0x2309fd);};}exports[_0x1383('0x2d')]=function(_0x352c1e,_0x291e19){var _0x1cdd52={},_0x2c4f1f={},_0x24c79d={'count':0x0,'rows':[]};var _0x32a54b=_[_0x1383('0x2e')](db[_0x1383('0x2f')]['rawAttributes'],function(_0x525d94){return{'name':_0x525d94[_0x1383('0x30')],'type':_0x525d94['type'][_0x1383('0x31')]};});_0x2c4f1f[_0x1383('0x32')]=_[_0x1383('0x2e')](_0x32a54b,_0x1383('0x2b'));_0x2c4f1f['query']=_[_0x1383('0x33')](_0x352c1e[_0x1383('0x34')]);_0x2c4f1f['filters']=_[_0x1383('0x35')](_0x2c4f1f[_0x1383('0x32')],_0x2c4f1f[_0x1383('0x34')]);_0x1cdd52[_0x1383('0x36')]=_[_0x1383('0x35')](_0x2c4f1f[_0x1383('0x32')],qs['fields'](_0x352c1e[_0x1383('0x34')][_0x1383('0x37')]));_0x1cdd52[_0x1383('0x36')]=_0x1cdd52['attributes'][_0x1383('0x38')]?_0x1cdd52[_0x1383('0x36')]:_0x2c4f1f[_0x1383('0x32')];if(!_0x352c1e[_0x1383('0x34')][_0x1383('0x39')](_0x1383('0x3a'))){_0x1cdd52[_0x1383('0x1f')]=qs[_0x1383('0x1f')](_0x352c1e['query'][_0x1383('0x1f')]);_0x1cdd52['offset']=qs['offset'](_0x352c1e[_0x1383('0x34')][_0x1383('0x1d')]);}_0x1cdd52[_0x1383('0x3b')]=qs['sort'](_0x352c1e[_0x1383('0x34')][_0x1383('0x3c')]);_0x1cdd52['where']=qs[_0x1383('0x3d')](_[_0x1383('0x3e')](_0x352c1e[_0x1383('0x34')],_0x2c4f1f['filters']),_0x32a54b);if(_0x352c1e[_0x1383('0x34')]['filter']){_0x1cdd52[_0x1383('0x3f')]=_['merge'](_0x1cdd52['where'],{'$or':_[_0x1383('0x2e')](_0x32a54b,function(_0x568ea5){if(_0x568ea5[_0x1383('0x40')]!==_0x1383('0x41')){var _0x4c273b={};_0x4c273b[_0x568ea5['name']]={'$like':'%'+_0x352c1e[_0x1383('0x34')][_0x1383('0x42')]+'%'};return _0x4c273b;}})});}_0x1cdd52=_['merge']({},_0x1cdd52,_0x352c1e[_0x1383('0x43')]);var _0x2c24b2={'where':_0x1cdd52[_0x1383('0x3f')]};return db[_0x1383('0x2f')][_0x1383('0x20')](_0x2c24b2)[_0x1383('0x25')](function(_0x1ef082){_0x24c79d[_0x1383('0x20')]=_0x1ef082;if(_0x352c1e[_0x1383('0x34')][_0x1383('0x44')]){_0x1cdd52[_0x1383('0x45')]=[{'all':!![]}];}return db[_0x1383('0x2f')][_0x1383('0x46')](_0x1cdd52);})[_0x1383('0x25')](function(_0x4d8ac7){_0x24c79d[_0x1383('0x47')]=_0x4d8ac7;return _0x24c79d;})[_0x1383('0x25')](respondWithFilteredResult(_0x291e19,_0x1cdd52))[_0x1383('0x48')](handleError(_0x291e19,null));};exports['show']=function(_0x43cf3b,_0x24017a){var _0x3cbbbf={'raw':![],'where':{'id':_0x43cf3b[_0x1383('0x49')]['id']}},_0x2b34d0={};_0x2b34d0[_0x1383('0x32')]=_['keys'](db[_0x1383('0x2f')]['rawAttributes']);_0x2b34d0[_0x1383('0x34')]=_[_0x1383('0x33')](_0x43cf3b[_0x1383('0x34')]);_0x2b34d0[_0x1383('0x3d')]=_[_0x1383('0x35')](_0x2b34d0[_0x1383('0x32')],_0x2b34d0[_0x1383('0x34')]);_0x3cbbbf[_0x1383('0x36')]=_[_0x1383('0x35')](_0x2b34d0[_0x1383('0x32')],qs['fields'](_0x43cf3b['query'][_0x1383('0x37')]));_0x3cbbbf['attributes']=_0x3cbbbf[_0x1383('0x36')][_0x1383('0x38')]?_0x3cbbbf[_0x1383('0x36')]:_0x2b34d0[_0x1383('0x32')];if(_0x43cf3b['query'][_0x1383('0x44')]){_0x3cbbbf[_0x1383('0x45')]=[{'all':!![]}];}_0x3cbbbf=_['merge']({},_0x3cbbbf,_0x43cf3b['options']);return db[_0x1383('0x2f')][_0x1383('0x4a')](_0x3cbbbf)[_0x1383('0x25')](handleEntityNotFound(_0x24017a,null))['then'](respondWithResult(_0x24017a,null))['catch'](handleError(_0x24017a,null));};exports[_0x1383('0x4b')]=function(_0x110b39,_0x298658){return db[_0x1383('0x2f')][_0x1383('0x4b')](_0x110b39[_0x1383('0x4c')],{})[_0x1383('0x25')](function(_0x386c2b){var _0x42a37b=_0x110b39[_0x1383('0x4d')][_0x1383('0x27')]({'plain':!![]});if(!_0x42a37b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42a37b[_0x1383('0x4e')]==='user'){var _0x16c035=_0x386c2b['get']({'plain':!![]});var _0x172608=_0x1383('0x4f');return db['UserProfileSection'][_0x1383('0x4a')]({'where':{'name':_0x172608,'userProfileId':_0x42a37b[_0x1383('0x50')]},'raw':!![]})['then'](function(_0x26e6b8){if(_0x26e6b8&&_0x26e6b8[_0x1383('0x51')]===0x0){return db[_0x1383('0x52')][_0x1383('0x4b')]({'name':_0x16c035['name'],'resourceId':_0x16c035['id'],'type':_0x26e6b8[_0x1383('0x2b')],'sectionId':_0x26e6b8['id']},{})[_0x1383('0x25')](function(){return _0x386c2b;});}else{return _0x386c2b;}})[_0x1383('0x48')](function(_0x44ac83){logger[_0x1383('0x29')](_0x1383('0x53'),_0x44ac83);throw _0x44ac83;});}return _0x386c2b;})[_0x1383('0x25')](respondWithResult(_0x298658,0xc9))[_0x1383('0x48')](handleError(_0x298658,null));};exports['clone']=function(_0x186734,_0x431e0e){var _0x2ecee5={'where':{'id':_0x186734[_0x1383('0x49')]['id']}},_0x1c782c={};_0x1c782c[_0x1383('0x32')]=_[_0x1383('0x33')](db['Dashboard'][_0x1383('0x54')]);_0x2ecee5[_0x1383('0x36')]=_[_0x1383('0x35')](_0x1c782c[_0x1383('0x32')],qs[_0x1383('0x37')](_0x186734[_0x1383('0x34')][_0x1383('0x37')]));_0x2ecee5['attributes']=_0x2ecee5[_0x1383('0x36')]['length']?_0x2ecee5[_0x1383('0x36')]:_0x1c782c['model'];if(_0x186734['query'][_0x1383('0x44')]){_0x2ecee5[_0x1383('0x45')]=[{'all':!![]}];}_0x2ecee5=_[_0x1383('0x55')]({},_0x2ecee5,_0x186734[_0x1383('0x43')]);return db[_0x1383('0x2f')]['find'](_0x2ecee5)['then'](handleEntityNotFound(_0x431e0e,null))[_0x1383('0x25')](function(_0x55b711){if(_0x55b711){var _0x564ea7=_0x55b711[_0x1383('0x27')]({'plain':!![]});_0x564ea7=qs[_0x1383('0x56')](_0x564ea7,['id','createdAt',_0x1383('0x57')]);_0x186734[_0x1383('0x4c')]=_[_0x1383('0x56')](_0x186734[_0x1383('0x4c')],['id',_0x1383('0x58'),_0x1383('0x57')]);return db[_0x1383('0x2f')][_0x1383('0x4b')](_[_0x1383('0x55')](_0x564ea7,_0x186734[_0x1383('0x4c')]),{'include':_0x186734[_0x1383('0x34')][_0x1383('0x44')]?[{'all':!![]}]:undefined})[_0x1383('0x25')](function(_0x17f021){var _0x5c4804=_0x186734[_0x1383('0x4d')]['get']({'plain':!![]});if(!_0x5c4804)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c4804[_0x1383('0x4e')]===_0x1383('0x4d')){var _0x53ab16=_0x17f021['get']({'plain':!![]});var _0x3872bf=_0x1383('0x4f');return db[_0x1383('0x59')]['find']({'where':{'name':_0x3872bf,'userProfileId':_0x5c4804['userProfileId']},'raw':!![]})[_0x1383('0x25')](function(_0x498fd7){if(_0x498fd7&&_0x498fd7[_0x1383('0x51')]===0x0){return db[_0x1383('0x52')]['create']({'name':_0x53ab16['name'],'resourceId':_0x53ab16['id'],'type':_0x498fd7['name'],'sectionId':_0x498fd7['id']},{})[_0x1383('0x25')](function(){return _0x17f021;});}else{return _0x17f021;}})[_0x1383('0x48')](function(_0x50406c){logger[_0x1383('0x29')](_0x1383('0x53'),_0x50406c);throw _0x50406c;});}return _0x17f021;});}})[_0x1383('0x25')](respondWithResult(_0x431e0e,0xc9))['catch'](handleError(_0x431e0e,null));};exports[_0x1383('0x5a')]=function(_0x21173f,_0x326d71){if(_0x21173f[_0x1383('0x4c')]['id']){delete _0x21173f['body']['id'];}return db[_0x1383('0x2f')][_0x1383('0x4a')]({'where':{'id':_0x21173f[_0x1383('0x49')]['id']}})[_0x1383('0x25')](handleEntityNotFound(_0x326d71,null))[_0x1383('0x25')](saveUpdates(_0x21173f[_0x1383('0x4c')],null))[_0x1383('0x25')](respondWithResult(_0x326d71,null))[_0x1383('0x48')](handleError(_0x326d71,null));};exports['destroy']=function(_0x284b08,_0x1de66e){return db['Dashboard'][_0x1383('0x4a')]({'where':{'id':_0x284b08[_0x1383('0x49')]['id']}})[_0x1383('0x25')](handleEntityNotFound(_0x1de66e,null))[_0x1383('0x25')](removeEntity(_0x1de66e,null))[_0x1383('0x48')](handleError(_0x1de66e,null));};function widgetAttributes(_0x56513a){try{switch(_0x56513a[_0x1383('0x40')]){case _0x1383('0x5b'):return[{'name':_0x1383('0x5c'),'value':_0x56513a['attrUrl']||(_0x56513a['attrs']&&_0x56513a[_0x1383('0x5d')][0x0]?_0x56513a['attrs'][0x0][_0x1383('0x5e')]:undefined)||'https://'}];case _0x1383('0x5f'):return[{'name':_0x1383('0x60'),'value':_0x56513a['attrPath']||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0x0]?_0x56513a[_0x1383('0x5d')][0x0][_0x1383('0x5e')]:undefined)||''}];case _0x1383('0x61'):return[{'name':'attrHourFormat','value':_0x56513a['attrHourFormat']||(_0x56513a['attrs']&&_0x56513a['attrs'][0x0]?_0x56513a[_0x1383('0x5d')][0x0][_0x1383('0x5e')]:undefined)||_0x1383('0x62')},{'name':_0x1383('0x63'),'value':_0x56513a[_0x1383('0x63')]||(_0x56513a['attrs']&&_0x56513a[_0x1383('0x5d')][0x1]?_0x56513a[_0x1383('0x5d')][0x1]['value']:undefined)||'0.00'},{'name':_0x1383('0x64'),'value':_0x56513a[_0x1383('0x64')]||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0x2]?_0x56513a[_0x1383('0x5d')][0x2][_0x1383('0x5e')]:undefined)||0xc}];case _0x1383('0x65'):return[{'name':_0x1383('0x66'),'value':_0x56513a[_0x1383('0x66')]||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0x0]?_0x56513a['attrs'][0x0][_0x1383('0x5e')]:undefined)||_0x1383('0x67')},{'name':_0x1383('0x68'),'value':_0x56513a[_0x1383('0x68')]||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0x1]?_0x56513a[_0x1383('0x5d')][0x1][_0x1383('0x5e')]:undefined)||[]},{'name':_0x1383('0x64'),'value':_0x56513a['attrFontSize']||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0x2]?_0x56513a['attrs'][0x2]['value']:undefined)||0x14},{'name':_0x1383('0x69'),'value':_0x56513a[_0x1383('0x69')]||(_0x56513a['attrs']&&_0x56513a['attrs'][0x3]?_0x56513a[_0x1383('0x5d')][0x3]['value']:undefined)||_0x1383('0x6a')},{'name':_0x1383('0x6b'),'value':_0x56513a[_0x1383('0x6b')]||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0x4]?_0x56513a[_0x1383('0x5d')][0x4][_0x1383('0x5e')]:undefined)||''},{'name':_0x1383('0x6c'),'value':_0x56513a[_0x1383('0x6c')]||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0x5]?_0x56513a['attrs'][0x5]['value']:undefined)||''},{'name':_0x1383('0x6d'),'value':_0x56513a[_0x1383('0x6d')]||(_0x56513a[_0x1383('0x5d')]&&_0x56513a['attrs'][0x6]?_0x56513a[_0x1383('0x5d')][0x6][_0x1383('0x5e')]:undefined)||''},{'name':_0x1383('0x6e'),'value':_0x56513a[_0x1383('0x6e')]||(_0x56513a[_0x1383('0x5d')]&&_0x56513a['attrs'][0x7]?_0x56513a['attrs'][0x7][_0x1383('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x56513a[_0x1383('0x6f')]||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0x8]?_0x56513a['attrs'][0x8][_0x1383('0x5e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x56513a[_0x1383('0x70')]||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0x9]?_0x56513a[_0x1383('0x5d')][0x9][_0x1383('0x5e')]:undefined)||''}];case'multibar-chart':case _0x1383('0x71'):return[{'name':_0x1383('0x72'),'value':_0x56513a[_0x1383('0x72')]||(_0x56513a[_0x1383('0x5d')]&&_0x56513a['attrs'][0x0]?_0x56513a[_0x1383('0x5d')][0x0][_0x1383('0x5e')]:undefined)||_0x1383('0x67')},{'name':_0x1383('0x73'),'value':_0x56513a['attrSerie2']||(_0x56513a['attrs']&&_0x56513a['attrs'][0x1]?_0x56513a[_0x1383('0x5d')][0x1][_0x1383('0x5e')]:undefined)||null},{'name':'attrSerie3','value':_0x56513a[_0x1383('0x74')]||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0x2]?_0x56513a['attrs'][0x2][_0x1383('0x5e')]:undefined)||null},{'name':_0x1383('0x68'),'value':_0x56513a[_0x1383('0x68')]||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0x3]?_0x56513a['attrs'][0x3][_0x1383('0x5e')]:undefined)||[]},{'name':'attrChannel','value':_0x56513a[_0x1383('0x69')]||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0x4]?_0x56513a['attrs'][0x4]['value']:undefined)||_0x1383('0x6a')},{'name':_0x1383('0x6b'),'value':_0x56513a[_0x1383('0x6b')]||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0x5]?_0x56513a['attrs'][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x56513a[_0x1383('0x6c')]||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0x6]?_0x56513a[_0x1383('0x5d')][0x6][_0x1383('0x5e')]:undefined)||''},{'name':_0x1383('0x6d'),'value':_0x56513a['attrSmsAccounts']||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0x7]?_0x56513a[_0x1383('0x5d')][0x7][_0x1383('0x5e')]:undefined)||''},{'name':_0x1383('0x6e'),'value':_0x56513a[_0x1383('0x6e')]||(_0x56513a['attrs']&&_0x56513a[_0x1383('0x5d')][0x8]?_0x56513a[_0x1383('0x5d')][0x8][_0x1383('0x5e')]:undefined)||''},{'name':_0x1383('0x6f'),'value':_0x56513a['attrWhatsappAccounts']||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0x9]?_0x56513a[_0x1383('0x5d')][0x9][_0x1383('0x5e')]:undefined)||''},{'name':_0x1383('0x70'),'value':_0x56513a['attrChatWebsites']||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0xa]?_0x56513a['attrs'][0xa]['value']:undefined)||''}];case _0x1383('0x75'):return[{'name':'attrReport','type':_0x56513a[_0x1383('0x76')]||(_0x56513a[_0x1383('0x5d')]&&_0x56513a['attrs'][0x0]?_0x56513a['attrs'][0x0][_0x1383('0x40')]:undefined)||null,'value':_0x56513a[_0x1383('0x77')]||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0x0]?_0x56513a['attrs'][0x0][_0x1383('0x5e')]:undefined)||null},{'name':_0x1383('0x78'),'value':_0x56513a[_0x1383('0x78')]||(_0x56513a[_0x1383('0x5d')]&&_0x56513a[_0x1383('0x5d')][0x1]?_0x56513a[_0x1383('0x5d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1ed07a){logger[_0x1383('0x29')]('widgetAttributes:\x20%s',JSON[_0x1383('0x79')](_0x1ed07a));return[];}}exports['addItem']=function(_0x5a583b,_0x3f6348,_0x530301){if(_0x5a583b['body']['id']){delete _0x5a583b[_0x1383('0x4c')]['id'];}return db[_0x1383('0x2f')][_0x1383('0x4a')]({'where':{'id':_0x5a583b[_0x1383('0x49')]['id']}})[_0x1383('0x25')](handleEntityNotFound(_0x3f6348,null))[_0x1383('0x25')](function(_0x534ab6){if(_0x534ab6){_0x5a583b[_0x1383('0x4c')][_0x1383('0x7a')]=_0x534ab6['id'];_0x5a583b[_0x1383('0x4c')][_0x1383('0x5d')]=widgetAttributes(_0x5a583b[_0x1383('0x4c')]);return db['DashboardItem'][_0x1383('0x4b')](_0x5a583b[_0x1383('0x4c')]);}})[_0x1383('0x25')](respondWithResult(_0x3f6348,null))[_0x1383('0x48')](handleError(_0x3f6348,null));};exports[_0x1383('0x7b')]=function(_0x5cce9f,_0x499050,_0x1a7293){var _0x2e1c24={};var _0x362d61={};var _0x15cd4a;var _0x342699;return db['Dashboard'][_0x1383('0x7c')]({'where':{'id':_0x5cce9f[_0x1383('0x49')]['id']}})[_0x1383('0x25')](handleEntityNotFound(_0x499050,null))[_0x1383('0x25')](function(_0x23b682){if(_0x23b682){_0x15cd4a=_0x23b682;_0x362d61[_0x1383('0x32')]=_['keys'](db['DashboardItem'][_0x1383('0x54')]);_0x362d61[_0x1383('0x34')]=_[_0x1383('0x33')](_0x5cce9f['query']);_0x362d61[_0x1383('0x3d')]=_[_0x1383('0x35')](_0x362d61['model'],_0x362d61['query']);_0x2e1c24['attributes']=_['intersection'](_0x362d61['model'],qs[_0x1383('0x37')](_0x5cce9f[_0x1383('0x34')]['fields']));_0x2e1c24['attributes']=_0x2e1c24[_0x1383('0x36')][_0x1383('0x38')]?_0x2e1c24[_0x1383('0x36')]:_0x362d61[_0x1383('0x32')];_0x2e1c24[_0x1383('0x3b')]=qs['sort'](_0x5cce9f[_0x1383('0x34')][_0x1383('0x3c')]);_0x2e1c24[_0x1383('0x3f')]=qs['filters'](_[_0x1383('0x3e')](_0x5cce9f[_0x1383('0x34')],_0x362d61[_0x1383('0x3d')]));if(_0x5cce9f['query'][_0x1383('0x42')]){_0x2e1c24[_0x1383('0x3f')]=_[_0x1383('0x55')](_0x2e1c24[_0x1383('0x3f')],{'$or':_['map'](_0x2e1c24[_0x1383('0x36')],function(_0x34dfec){var _0x308e0b={};_0x308e0b[_0x34dfec]={'$like':'%'+_0x5cce9f[_0x1383('0x34')][_0x1383('0x42')]+'%'};return _0x308e0b;})});}_0x2e1c24=_[_0x1383('0x55')]({},_0x2e1c24,_0x5cce9f[_0x1383('0x43')]);return _0x15cd4a[_0x1383('0x7b')](_0x2e1c24);}})[_0x1383('0x25')](function(_0x44bc22){if(_0x44bc22){_0x342699=_0x44bc22[_0x1383('0x38')];if(!_0x5cce9f[_0x1383('0x34')][_0x1383('0x39')](_0x1383('0x3a'))){_0x2e1c24[_0x1383('0x1f')]=qs[_0x1383('0x1f')](_0x5cce9f['query'][_0x1383('0x1f')]);_0x2e1c24[_0x1383('0x1d')]=qs[_0x1383('0x1d')](_0x5cce9f['query'][_0x1383('0x1d')]);}return _0x15cd4a[_0x1383('0x7b')](_0x2e1c24);}})['then'](function(_0x2cbc9f){if(_0x2cbc9f){return _0x2cbc9f?{'count':_0x342699,'rows':_0x2cbc9f}:null;}})[_0x1383('0x25')](respondWithResult(_0x499050,null))['catch'](handleError(_0x499050,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 6eac28a..72afd38 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 _0xc81d=['save','update','remove','emit','hook','exports','../../mysqldb','Dashboard'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xc81d,0x86));var _0xdc81=function(_0x46abc5,_0x97f68d){_0x46abc5=_0x46abc5-0x0;var _0x49badb=_0xc81d[_0x46abc5];return _0x49badb;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xdc81('0x0'))['db'][_0xdc81('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdc81('0x2'),'afterUpdate':_0xdc81('0x3'),'afterDestroy':_0xdc81('0x4')};function emitEvent(_0x5f3b0f){return function(_0x42f133,_0x2091d1,_0x35dd88){DashboardEvents['emit'](_0x5f3b0f+':'+_0x42f133['id'],_0x42f133);DashboardEvents[_0xdc81('0x5')](_0x5f3b0f,_0x42f133);_0x35dd88(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xdc81('0x6')](e,emitEvent(event));}}module[_0xdc81('0x7')]=DashboardEvents; \ No newline at end of file +var _0x7ea9=['update','emit','hasOwnProperty','hook','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0x2401fa,_0x331180){var _0xd31ea7=function(_0x577da6){while(--_0x577da6){_0x2401fa['push'](_0x2401fa['shift']());}};_0xd31ea7(++_0x331180);}(_0x7ea9,0xec));var _0x97ea=function(_0x315d2c,_0x6d45c3){_0x315d2c=_0x315d2c-0x0;var _0x1df050=_0x7ea9[_0x315d2c];return _0x1df050;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x97ea('0x0'))['db'][_0x97ea('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x97ea('0x2')](0x0);var events={'afterCreate':_0x97ea('0x3'),'afterUpdate':_0x97ea('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3be4e3){return function(_0xd02076,_0x2c80e6,_0x54a19f){DashboardEvents[_0x97ea('0x5')](_0x3be4e3+':'+_0xd02076['id'],_0xd02076);DashboardEvents[_0x97ea('0x5')](_0x3be4e3,_0xd02076);_0x54a19f(null);};}for(var e in events){if(events[_0x97ea('0x6')](e)){var event=events[e];Dashboard[_0x97ea('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index ac736b4..d39d561 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 _0xff17=['Dashboard','dashboards','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','define'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xff17,0x1ee));var _0x7ff1=function(_0x547cbc,_0x409d60){_0x547cbc=_0x547cbc-0x0;var _0x19be06=_0xff17[_0x547cbc];return _0x19be06;};'use strict';var _=require(_0x7ff1('0x0'));var util=require(_0x7ff1('0x1'));var logger=require('../../config/logger')(_0x7ff1('0x2'));var moment=require(_0x7ff1('0x3'));var BPromise=require(_0x7ff1('0x4'));var rp=require(_0x7ff1('0x5'));var fs=require('fs');var path=require(_0x7ff1('0x6'));var rimraf=require('rimraf');var config=require(_0x7ff1('0x7'));var attributes=require(_0x7ff1('0x8'));module['exports']=function(_0x503ae2,_0x2fa878){return _0x503ae2[_0x7ff1('0x9')](_0x7ff1('0xa'),attributes,{'tableName':_0x7ff1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c82=['moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash','util','../../config/logger','api'];(function(_0xc0c1d4,_0x421cde){var _0x4b92da=function(_0x218da7){while(--_0x218da7){_0xc0c1d4['push'](_0xc0c1d4['shift']());}};_0x4b92da(++_0x421cde);}(_0x9c82,0x100));var _0x29c8=function(_0x59be55,_0xe924b1){_0x59be55=_0x59be55-0x0;var _0x167b2e=_0x9c82[_0x59be55];return _0x167b2e;};'use strict';var _=require(_0x29c8('0x0'));var util=require(_0x29c8('0x1'));var logger=require(_0x29c8('0x2'))(_0x29c8('0x3'));var moment=require(_0x29c8('0x4'));var BPromise=require(_0x29c8('0x5'));var rp=require(_0x29c8('0x6'));var fs=require('fs');var path=require(_0x29c8('0x7'));var rimraf=require('rimraf');var config=require(_0x29c8('0x8'));var attributes=require(_0x29c8('0x9'));module[_0x29c8('0xa')]=function(_0x1deff6,_0x3449b8){return _0x1deff6[_0x29c8('0xb')](_0x29c8('0xc'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 095aa09..ff4c4b7 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 _0x7486=['info','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Dashboard,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','defaults','socket.io-emitter','./dashboard.socket','register','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7486,0xea));var _0x6748=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7486[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6748('0x0'));var util=require(_0x6748('0x1'));var moment=require('moment');var BPromise=require(_0x6748('0x2'));var rs=require(_0x6748('0x3'));var fs=require('fs');var Redis=require(_0x6748('0x4'));var db=require(_0x6748('0x5'))['db'];var utils=require(_0x6748('0x6'));var logger=require(_0x6748('0x7'))('rpc');var config=require(_0x6748('0x8'));var jayson=require(_0x6748('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x6748('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6748('0xb'))(new Redis(config['redis']));require(_0x6748('0xc'))[_0x6748('0xd')](socket);function respondWithRpcPromise(_0x204e35,_0xd74df5,_0x44a0f6){return new BPromise(function(_0x43d054,_0x14cd6d){return client[_0x6748('0xe')](_0x204e35,_0x44a0f6)[_0x6748('0xf')](function(_0x5ef307){logger[_0x6748('0x10')]('Dashboard,\x20%s,\x20%s',_0xd74df5,'request\x20sent');logger['debug'](_0x6748('0x11'),_0xd74df5,_0x6748('0x12'),JSON[_0x6748('0x13')](_0x5ef307));if(_0x5ef307[_0x6748('0x14')]){if(_0x5ef307[_0x6748('0x14')]['code']===0x1f4){logger[_0x6748('0x14')](_0x6748('0x15'),_0xd74df5,_0x5ef307[_0x6748('0x14')][_0x6748('0x16')]);return _0x14cd6d(_0x5ef307[_0x6748('0x14')]['message']);}logger[_0x6748('0x14')](_0x6748('0x15'),_0xd74df5,_0x5ef307['error'][_0x6748('0x16')]);return _0x43d054(_0x5ef307[_0x6748('0x14')][_0x6748('0x16')]);}else{logger['info'](_0x6748('0x15'),_0xd74df5,_0x6748('0x12'));_0x43d054(_0x5ef307[_0x6748('0x17')][_0x6748('0x16')]);}})[_0x6748('0x18')](function(_0x34707c){logger['error']('Dashboard,\x20%s,\x20%s',_0xd74df5,_0x34707c);_0x14cd6d(_0x34707c);});});} \ No newline at end of file +var _0x2f65=['./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults'];(function(_0x25a63d,_0x579919){var _0x17be47=function(_0x5d428b){while(--_0x5d428b){_0x25a63d['push'](_0x25a63d['shift']());}};_0x17be47(++_0x579919);}(_0x2f65,0x1e7));var _0x52f6=function(_0xefffb3,_0x37dd2a){_0xefffb3=_0xefffb3-0x0;var _0x30dcea=_0x2f65[_0xefffb3];return _0x30dcea;};'use strict';var _=require('lodash');var util=require(_0x52f6('0x0'));var moment=require(_0x52f6('0x1'));var BPromise=require(_0x52f6('0x2'));var rs=require(_0x52f6('0x3'));var fs=require('fs');var Redis=require(_0x52f6('0x4'));var db=require(_0x52f6('0x5'))['db'];var utils=require(_0x52f6('0x6'));var logger=require(_0x52f6('0x7'))(_0x52f6('0x8'));var config=require(_0x52f6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x52f6('0xa')]['http']({'port':0x232a});config[_0x52f6('0xb')]=_[_0x52f6('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x52f6('0xb')]));require(_0x52f6('0xd'))[_0x52f6('0xe')](socket);function respondWithRpcPromise(_0x6e2e65,_0x3edf43,_0x39a8cf){return new BPromise(function(_0x10251b,_0x1b508b){return client[_0x52f6('0xf')](_0x6e2e65,_0x39a8cf)[_0x52f6('0x10')](function(_0x2723b4){logger[_0x52f6('0x11')](_0x52f6('0x12'),_0x3edf43,_0x52f6('0x13'));logger[_0x52f6('0x14')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x3edf43,_0x52f6('0x13'),JSON[_0x52f6('0x15')](_0x2723b4));if(_0x2723b4[_0x52f6('0x16')]){if(_0x2723b4[_0x52f6('0x16')][_0x52f6('0x17')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x3edf43,_0x2723b4[_0x52f6('0x16')][_0x52f6('0x18')]);return _0x1b508b(_0x2723b4[_0x52f6('0x16')][_0x52f6('0x18')]);}logger['error'](_0x52f6('0x12'),_0x3edf43,_0x2723b4['error'][_0x52f6('0x18')]);return _0x10251b(_0x2723b4[_0x52f6('0x16')]['message']);}else{logger[_0x52f6('0x11')](_0x52f6('0x12'),_0x3edf43,_0x52f6('0x13'));_0x10251b(_0x2723b4['result']['message']);}})['catch'](function(_0x42934f){logger[_0x52f6('0x16')](_0x52f6('0x12'),_0x3edf43,_0x42934f);_0x1b508b(_0x42934f);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index aef4c68..6a9cf15 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 _0x582a=['./dashboard.events','save','remove','update','emit','removeListener','length','dashboard:'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x582a,0x118));var _0xa582=function(_0x53dc2f,_0x352f5f){_0x53dc2f=_0x53dc2f-0x0;var _0x2db8b6=_0x582a[_0x53dc2f];return _0x2db8b6;};'use strict';var DashboardEvents=require(_0xa582('0x0'));var events=[_0xa582('0x1'),_0xa582('0x2'),_0xa582('0x3')];function createListener(_0x36387b,_0x11d0a3){return function(_0x3fc0e2){_0x11d0a3[_0xa582('0x4')](_0x36387b,_0x3fc0e2);};}function removeListener(_0x538499,_0x254f78){return function(){DashboardEvents[_0xa582('0x5')](_0x538499,_0x254f78);};}exports['register']=function(_0x4f7c14){for(var _0x19b6fe=0x0,_0x3fa477=events[_0xa582('0x6')];_0x19b6fe<_0x3fa477;_0x19b6fe++){var _0x32631d=events[_0x19b6fe];var _0x24ce8f=createListener(_0xa582('0x7')+_0x32631d,_0x4f7c14);DashboardEvents['on'](_0x32631d,_0x24ce8f);}}; \ No newline at end of file +var _0x357d=['remove','emit','removeListener','register','length','./dashboard.events'];(function(_0x22b7e1,_0x3ec631){var _0xdbf588=function(_0x448c67){while(--_0x448c67){_0x22b7e1['push'](_0x22b7e1['shift']());}};_0xdbf588(++_0x3ec631);}(_0x357d,0x161));var _0xd357=function(_0x2970cf,_0x2b517d){_0x2970cf=_0x2970cf-0x0;var _0x2425e5=_0x357d[_0x2970cf];return _0x2425e5;};'use strict';var DashboardEvents=require(_0xd357('0x0'));var events=['save',_0xd357('0x1'),'update'];function createListener(_0x3f0134,_0x39e830){return function(_0x478b47){_0x39e830[_0xd357('0x2')](_0x3f0134,_0x478b47);};}function removeListener(_0x48b0a0,_0x370f75){return function(){DashboardEvents[_0xd357('0x3')](_0x48b0a0,_0x370f75);};}exports[_0xd357('0x4')]=function(_0x3ddb11){for(var _0x5a2d2b=0x0,_0x447bd4=events[_0xd357('0x5')];_0x5a2d2b<_0x447bd4;_0x5a2d2b++){var _0x1738ff=events[_0x5a2d2b];var _0x2e4779=createListener('dashboard:'+_0x1738ff,_0x3ddb11);DashboardEvents['on'](_0x1738ff,_0x2e4779);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 088ce44..22890f4 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 _0x6ffd=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','post','create','put','update','delete'];(function(_0x1a0bcd,_0x230d46){var _0x1e22a0=function(_0x241f9f){while(--_0x241f9f){_0x1a0bcd['push'](_0x1a0bcd['shift']());}};_0x1e22a0(++_0x230d46);}(_0x6ffd,0x1ce));var _0xd6ff=function(_0x214cae,_0x3d11fc){_0x214cae=_0x214cae-0x0;var _0x3e242d=_0x6ffd[_0x214cae];return _0x3e242d;};'use strict';var multer=require(_0xd6ff('0x0'));var util=require('util');var path=require(_0xd6ff('0x1'));var timeout=require(_0xd6ff('0x2'));var express=require(_0xd6ff('0x3'));var router=express[_0xd6ff('0x4')]();var fs_extra=require(_0xd6ff('0x5'));var auth=require(_0xd6ff('0x6'));var interaction=require(_0xd6ff('0x7'));var config=require(_0xd6ff('0x8'));var controller=require(_0xd6ff('0x9'));router[_0xd6ff('0xa')]('/',auth[_0xd6ff('0xb')](),controller[_0xd6ff('0xc')]);router['get'](_0xd6ff('0xd'),auth['isAuthenticated'](),controller[_0xd6ff('0xe')]);router[_0xd6ff('0xa')](_0xd6ff('0xf'),auth[_0xd6ff('0xb')](),controller['getItems']);router[_0xd6ff('0x10')]('/',auth[_0xd6ff('0xb')](),controller[_0xd6ff('0x11')]);router[_0xd6ff('0x10')]('/:id/clone',auth[_0xd6ff('0xb')](),controller['clone']);router['post'](_0xd6ff('0xf'),auth['isAuthenticated'](),controller['addItem']);router[_0xd6ff('0x12')](_0xd6ff('0xd'),auth[_0xd6ff('0xb')](),controller[_0xd6ff('0x13')]);router[_0xd6ff('0x14')]('/:id',auth[_0xd6ff('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc541=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','/:id','show','isAuthenticated','getItems','post','clone','/:id/items','addItem','put','delete','destroy','multer','path'];(function(_0x4ac3ec,_0x47e0da){var _0x2c20b8=function(_0x21a777){while(--_0x21a777){_0x4ac3ec['push'](_0x4ac3ec['shift']());}};_0x2c20b8(++_0x47e0da);}(_0xc541,0xd0));var _0x1c54=function(_0x223bdb,_0x5882e6){_0x223bdb=_0x223bdb-0x0;var _0xef8e68=_0xc541[_0x223bdb];return _0xef8e68;};'use strict';var multer=require(_0x1c54('0x0'));var util=require('util');var path=require(_0x1c54('0x1'));var timeout=require(_0x1c54('0x2'));var express=require(_0x1c54('0x3'));var router=express['Router']();var fs_extra=require(_0x1c54('0x4'));var auth=require(_0x1c54('0x5'));var interaction=require(_0x1c54('0x6'));var config=require(_0x1c54('0x7'));var controller=require(_0x1c54('0x8'));router[_0x1c54('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1c54('0x9')](_0x1c54('0xa'),auth['isAuthenticated'](),controller[_0x1c54('0xb')]);router[_0x1c54('0x9')]('/:id/items',auth[_0x1c54('0xc')](),controller[_0x1c54('0xd')]);router[_0x1c54('0xe')]('/',auth[_0x1c54('0xc')](),controller['create']);router[_0x1c54('0xe')]('/:id/clone',auth[_0x1c54('0xc')](),controller[_0x1c54('0xf')]);router[_0x1c54('0xe')](_0x1c54('0x10'),auth[_0x1c54('0xc')](),controller[_0x1c54('0x11')]);router[_0x1c54('0x12')](_0x1c54('0xa'),auth[_0x1c54('0xc')](),controller['update']);router[_0x1c54('0x13')](_0x1c54('0xa'),auth[_0x1c54('0xc')](),controller[_0x1c54('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 8444c69..b9ae28b 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 _0x3f8a=['parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','TEXT','long'];(function(_0x30a956,_0x11222e){var _0x2ac17d=function(_0x3be1d2){while(--_0x3be1d2){_0x30a956['push'](_0x30a956['shift']());}};_0x2ac17d(++_0x11222e);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x818178,_0x61b802){_0x818178=_0x818178-0x0;var _0x4ddb7f=_0x3f8a[_0x818178];return _0x4ddb7f;};'use strict';var Sequelize=require(_0xa3f8('0x0'));var squel=require(_0xa3f8('0x1'));var _=require(_0xa3f8('0x2'));module[_0xa3f8('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa3f8('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xa3f8('0x5')](_0xa3f8('0x6')),'get':function(){try{return JSON[_0xa3f8('0x7')](this[_0xa3f8('0x8')](_0xa3f8('0x9')));}catch(_0x39d2e4){return[];}},'set':function(_0x471464){try{this[_0xa3f8('0xa')](_0xa3f8('0x9'),JSON[_0xa3f8('0xb')](_0x471464));}catch(_0x268332){this[_0xa3f8('0xa')](_0xa3f8('0x9'),JSON[_0xa3f8('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0xa3f8('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xa3f8('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xa3f8('0xc')]},'background':{'type':Sequelize[_0xa3f8('0x4')],'allowNull':![],'defaultValue':_0xa3f8('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xa3f8('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xa3f8('0x4')]},'titleFontSize':{'type':Sequelize[_0xa3f8('0xc')],'defaultValue':0xc}}; \ No newline at end of file +var _0x2542=['exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash'];(function(_0x9fb081,_0x48f480){var _0x43f8b0=function(_0x418570){while(--_0x418570){_0x9fb081['push'](_0x9fb081['shift']());}};_0x43f8b0(++_0x48f480);}(_0x2542,0x169));var _0x2254=function(_0x28099d,_0x1f06e7){_0x28099d=_0x28099d-0x0;var _0x53ebe4=_0x2542[_0x28099d];return _0x53ebe4;};'use strict';var Sequelize=require(_0x2254('0x0'));var squel=require(_0x2254('0x1'));var _=require(_0x2254('0x2'));module[_0x2254('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2254('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x2254('0x5')),'get':function(){try{return JSON[_0x2254('0x6')](this[_0x2254('0x7')](_0x2254('0x8')));}catch(_0x76c902){return[];}},'set':function(_0x508183){try{this[_0x2254('0x9')](_0x2254('0x8'),JSON[_0x2254('0xa')](_0x508183));}catch(_0x3c45ec){this[_0x2254('0x9')](_0x2254('0x8'),JSON[_0x2254('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x2254('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x2254('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x2254('0xb')]},'col':{'type':Sequelize[_0x2254('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2254('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x2254('0x4')],'allowNull':![],'defaultValue':_0x2254('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x2254('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 58f1893..9d14e4a 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 _0x5a99=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','DashboardItem','find','then','catch','type','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format'];(function(_0x122a10,_0x55e197){var _0xfbd30c=function(_0x4f3e20){while(--_0x4f3e20){_0x122a10['push'](_0x122a10['shift']());}};_0xfbd30c(++_0x55e197);}(_0x5a99,0xc9));var _0x95a9=function(_0x1ed977,_0x1fa8f0){_0x1ed977=_0x1ed977-0x0;var _0x5f27ad=_0x5a99[_0x1ed977];return _0x5f27ad;};'use strict';var emlformat=require(_0x95a9('0x0'));var rimraf=require(_0x95a9('0x1'));var zipdir=require(_0x95a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x95a9('0x3'));var moment=require(_0x95a9('0x4'));var BPromise=require(_0x95a9('0x5'));var Mustache=require(_0x95a9('0x6'));var util=require('util');var path=require(_0x95a9('0x7'));var sox=require(_0x95a9('0x8'));var csv=require(_0x95a9('0x9'));var ejs=require(_0x95a9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95a9('0xb'));var squel=require(_0x95a9('0xc'));var crypto=require(_0x95a9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x95a9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x95a9('0xf'));var Papa=require(_0x95a9('0x10'));var Redis=require(_0x95a9('0x11'));var authService=require(_0x95a9('0x12'));var qs=require(_0x95a9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x95a9('0x14'))(_0x95a9('0x15'));var utils=require('../../config/utils');var config=require(_0x95a9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x95a9('0x17'))['db'];config[_0x95a9('0x18')]=_[_0x95a9('0x19')](config[_0x95a9('0x18')],{'host':_0x95a9('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboardItem.socket')[_0x95a9('0x1b')](socket);function respondWithStatusCode(_0x537c35,_0xccaf69){_0xccaf69=_0xccaf69||0xcc;return function(_0x45f48e){if(_0x45f48e){return _0x537c35[_0x95a9('0x1c')](_0xccaf69);}return _0x537c35['status'](_0xccaf69)[_0x95a9('0x1d')]();};}function respondWithResult(_0x4900b3,_0x37ccf1){_0x37ccf1=_0x37ccf1||0xc8;return function(_0x43768a){if(_0x43768a){return _0x4900b3[_0x95a9('0x1e')](_0x37ccf1)['json'](_0x43768a);}};}function respondWithFilteredResult(_0x45d1d2,_0x4b1efc){return function(_0x4bcec6){if(_0x4bcec6){var _0x3ee15f=typeof _0x4b1efc[_0x95a9('0x1f')]===_0x95a9('0x20')&&typeof _0x4b1efc[_0x95a9('0x21')]===_0x95a9('0x20');var _0x2e1322=_0x4bcec6[_0x95a9('0x22')];var _0xab9d9a=_0x3ee15f?0x0:_0x4b1efc[_0x95a9('0x1f')];var _0x2249dd=_0x3ee15f?_0x4bcec6[_0x95a9('0x22')]:_0x4b1efc['offset']+_0x4b1efc[_0x95a9('0x21')];var _0x261f2b;if(_0x2249dd>=_0x2e1322){_0x2249dd=_0x2e1322;_0x261f2b=0xc8;}else{_0x261f2b=0xce;}_0x45d1d2[_0x95a9('0x1e')](_0x261f2b);return _0x45d1d2[_0x95a9('0x23')]('Content-Range',_0xab9d9a+'-'+_0x2249dd+'/'+_0x2e1322)[_0x95a9('0x24')](_0x4bcec6);}return null;};}function patchUpdates(_0x21b556){return function(_0xc4520e){try{jsonpatch[_0x95a9('0x25')](_0xc4520e,_0x21b556,!![]);}catch(_0x465e5b){return BPromise[_0x95a9('0x26')](_0x465e5b);}return _0xc4520e[_0x95a9('0x27')]();};}function saveUpdates(_0x48de16,_0x345cef){return function(_0x19e8f0){if(_0x19e8f0){return _0x19e8f0[_0x95a9('0x28')](_0x48de16)['then'](function(_0x493acf){return _0x493acf;});}return null;};}function removeEntity(_0x1672a6,_0x49413f){return function(_0x4b664c){if(_0x4b664c){return _0x4b664c[_0x95a9('0x29')]()['then'](function(){_0x1672a6[_0x95a9('0x1e')](0xcc)[_0x95a9('0x1d')]();});}};}function handleEntityNotFound(_0x333260,_0xc6a07b){return function(_0x2951f4){if(!_0x2951f4){_0x333260[_0x95a9('0x1c')](0x194);}return _0x2951f4;};}function handleError(_0x22bcb5,_0x16dee8){_0x16dee8=_0x16dee8||0x1f4;return function(_0x381672){logger[_0x95a9('0x2a')](_0x381672[_0x95a9('0x2b')]);if(_0x381672[_0x95a9('0x2c')]){delete _0x381672[_0x95a9('0x2c')];}_0x22bcb5[_0x95a9('0x1e')](_0x16dee8)[_0x95a9('0x2d')](_0x381672);};}exports[_0x95a9('0x2e')]=function(_0x3f3e2f,_0x499dc7){var _0x5edbf1={'raw':![],'where':{'id':_0x3f3e2f[_0x95a9('0x2f')]['id']}},_0x59087c={};_0x59087c[_0x95a9('0x30')]=_[_0x95a9('0x31')](db['DashboardItem'][_0x95a9('0x32')]);_0x59087c[_0x95a9('0x33')]=_[_0x95a9('0x31')](_0x3f3e2f[_0x95a9('0x33')]);_0x59087c[_0x95a9('0x34')]=_[_0x95a9('0x35')](_0x59087c[_0x95a9('0x30')],_0x59087c[_0x95a9('0x33')]);_0x5edbf1['attributes']=_['intersection'](_0x59087c['model'],qs[_0x95a9('0x36')](_0x3f3e2f[_0x95a9('0x33')][_0x95a9('0x36')]));_0x5edbf1[_0x95a9('0x37')]=_0x5edbf1['attributes'][_0x95a9('0x38')]?_0x5edbf1[_0x95a9('0x37')]:_0x59087c[_0x95a9('0x30')];if(_0x3f3e2f[_0x95a9('0x33')][_0x95a9('0x39')]){_0x5edbf1[_0x95a9('0x3a')]=[{'all':!![]}];}_0x5edbf1=_[_0x95a9('0x3b')]({},_0x5edbf1,_0x3f3e2f[_0x95a9('0x3c')]);return db[_0x95a9('0x3d')][_0x95a9('0x3e')](_0x5edbf1)[_0x95a9('0x3f')](handleEntityNotFound(_0x499dc7,null))['then'](respondWithResult(_0x499dc7,null))[_0x95a9('0x40')](handleError(_0x499dc7,null));};exports[_0x95a9('0x29')]=function(_0x3d571c,_0x31b8c2){return db[_0x95a9('0x3d')][_0x95a9('0x3e')]({'where':{'id':_0x3d571c['params']['id']}})[_0x95a9('0x3f')](handleEntityNotFound(_0x31b8c2,null))[_0x95a9('0x3f')](removeEntity(_0x31b8c2,null))[_0x95a9('0x40')](handleError(_0x31b8c2,null));};function widgetAttributes(_0x2c758c){try{switch(_0x2c758c[_0x95a9('0x41')]){case'iframe':return[{'name':_0x95a9('0x42'),'value':_0x2c758c[_0x95a9('0x42')]||(_0x2c758c['attrs']&&_0x2c758c[_0x95a9('0x43')][0x0]?_0x2c758c[_0x95a9('0x43')][0x0]['value']:undefined)||'https://'}];case _0x95a9('0x44'):return[{'name':_0x95a9('0x45'),'value':_0x2c758c[_0x95a9('0x45')]||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x0]?_0x2c758c[_0x95a9('0x43')][0x0][_0x95a9('0x46')]:undefined)||''}];case _0x95a9('0x47'):return[{'name':'attrHourFormat','value':_0x2c758c[_0x95a9('0x48')]||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x0]?_0x2c758c[_0x95a9('0x43')][0x0][_0x95a9('0x46')]:undefined)||_0x95a9('0x49')},{'name':_0x95a9('0x4a'),'value':_0x2c758c[_0x95a9('0x4a')]||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x1]?_0x2c758c[_0x95a9('0x43')][0x1][_0x95a9('0x46')]:undefined)||'0.00'},{'name':_0x95a9('0x4b'),'value':_0x2c758c['attrFontSize']||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x2]?_0x2c758c['attrs'][0x2][_0x95a9('0x46')]:undefined)||0xc}];case _0x95a9('0x4c'):return[{'name':_0x95a9('0x4d'),'value':_0x2c758c[_0x95a9('0x4d')]||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x0]?_0x2c758c[_0x95a9('0x43')][0x0][_0x95a9('0x46')]:undefined)||_0x95a9('0x4e')},{'name':_0x95a9('0x4f'),'value':_0x2c758c[_0x95a9('0x4f')]||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x1]?_0x2c758c[_0x95a9('0x43')][0x1][_0x95a9('0x46')]:undefined)||[]},{'name':_0x95a9('0x4b'),'value':_0x2c758c['attrFontSize']||(_0x2c758c['attrs']&&_0x2c758c[_0x95a9('0x43')][0x2]?_0x2c758c[_0x95a9('0x43')][0x2][_0x95a9('0x46')]:undefined)||0x14},{'name':_0x95a9('0x50'),'value':_0x2c758c[_0x95a9('0x50')]||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x3]?_0x2c758c[_0x95a9('0x43')][0x3][_0x95a9('0x46')]:undefined)||_0x95a9('0x51')},{'name':_0x95a9('0x52'),'value':_0x2c758c['attrEmailAccounts']||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x4]?_0x2c758c['attrs'][0x4][_0x95a9('0x46')]:undefined)||''},{'name':_0x95a9('0x53'),'value':_0x2c758c[_0x95a9('0x53')]||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x5]?_0x2c758c[_0x95a9('0x43')][0x5][_0x95a9('0x46')]:undefined)||''},{'name':_0x95a9('0x54'),'value':_0x2c758c['attrSmsAccounts']||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x6]?_0x2c758c[_0x95a9('0x43')][0x6][_0x95a9('0x46')]:undefined)||''},{'name':_0x95a9('0x55'),'value':_0x2c758c[_0x95a9('0x55')]||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x7]?_0x2c758c[_0x95a9('0x43')][0x7][_0x95a9('0x46')]:undefined)||''},{'name':_0x95a9('0x56'),'value':_0x2c758c['attrWhatsappAccounts']||(_0x2c758c['attrs']&&_0x2c758c[_0x95a9('0x43')][0x8]?_0x2c758c[_0x95a9('0x43')][0x8]['value']:undefined)||''},{'name':_0x95a9('0x57'),'value':_0x2c758c['attrChatWebsites']||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x9]?_0x2c758c[_0x95a9('0x43')][0x9]['value']:undefined)||''}];case _0x95a9('0x58'):case _0x95a9('0x59'):return[{'name':_0x95a9('0x5a'),'value':_0x2c758c['attrSerie1']||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x0]?_0x2c758c[_0x95a9('0x43')][0x0][_0x95a9('0x46')]:undefined)||_0x95a9('0x4e')},{'name':_0x95a9('0x5b'),'value':_0x2c758c[_0x95a9('0x5b')]||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x1]?_0x2c758c[_0x95a9('0x43')][0x1][_0x95a9('0x46')]:undefined)||null},{'name':_0x95a9('0x5c'),'value':_0x2c758c[_0x95a9('0x5c')]||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x2]?_0x2c758c['attrs'][0x2][_0x95a9('0x46')]:undefined)||null},{'name':_0x95a9('0x4f'),'value':_0x2c758c[_0x95a9('0x4f')]||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x3]?_0x2c758c[_0x95a9('0x43')][0x3][_0x95a9('0x46')]:undefined)||[]},{'name':_0x95a9('0x50'),'value':_0x2c758c[_0x95a9('0x50')]||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x4]?_0x2c758c[_0x95a9('0x43')][0x4][_0x95a9('0x46')]:undefined)||_0x95a9('0x51')},{'name':_0x95a9('0x52'),'value':_0x2c758c[_0x95a9('0x52')]||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x5]?_0x2c758c[_0x95a9('0x43')][0x5][_0x95a9('0x46')]:undefined)||''},{'name':_0x95a9('0x53'),'value':_0x2c758c[_0x95a9('0x53')]||(_0x2c758c['attrs']&&_0x2c758c['attrs'][0x6]?_0x2c758c[_0x95a9('0x43')][0x6][_0x95a9('0x46')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2c758c[_0x95a9('0x54')]||(_0x2c758c['attrs']&&_0x2c758c['attrs'][0x7]?_0x2c758c[_0x95a9('0x43')][0x7]['value']:undefined)||''},{'name':_0x95a9('0x55'),'value':_0x2c758c[_0x95a9('0x55')]||(_0x2c758c['attrs']&&_0x2c758c[_0x95a9('0x43')][0x8]?_0x2c758c[_0x95a9('0x43')][0x8]['value']:undefined)||''},{'name':_0x95a9('0x56'),'value':_0x2c758c[_0x95a9('0x56')]||(_0x2c758c['attrs']&&_0x2c758c[_0x95a9('0x43')][0x9]?_0x2c758c[_0x95a9('0x43')][0x9][_0x95a9('0x46')]:undefined)||''},{'name':_0x95a9('0x57'),'value':_0x2c758c['attrChatWebsites']||(_0x2c758c['attrs']&&_0x2c758c[_0x95a9('0x43')][0xa]?_0x2c758c[_0x95a9('0x43')][0xa][_0x95a9('0x46')]:undefined)||''}];case _0x95a9('0x5d'):return[{'name':_0x95a9('0x5e'),'type':_0x2c758c[_0x95a9('0x5f')]||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c['attrs'][0x0]?_0x2c758c['attrs'][0x0]['type']:undefined)||null,'value':_0x2c758c[_0x95a9('0x5e')]||(_0x2c758c[_0x95a9('0x43')]&&_0x2c758c[_0x95a9('0x43')][0x0]?_0x2c758c[_0x95a9('0x43')][0x0]['value']:undefined)||null},{'name':_0x95a9('0x60'),'value':_0x2c758c[_0x95a9('0x60')]||(_0x2c758c['attrs']&&_0x2c758c[_0x95a9('0x43')][0x1]?_0x2c758c[_0x95a9('0x43')][0x1][_0x95a9('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x4612b8){logger[_0x95a9('0x2a')](_0x95a9('0x61'),JSON[_0x95a9('0x62')](_0x4612b8));return[];}}exports[_0x95a9('0x63')]=function(_0x3fb158,_0x3cb345){if(_0x3fb158['body']){_0x3fb158[_0x95a9('0x64')][_0x95a9('0x43')]=widgetAttributes(_0x3fb158['body']);}return db[_0x95a9('0x3d')][_0x95a9('0x63')](_0x3fb158[_0x95a9('0x64')],{})['then'](respondWithResult(_0x3cb345,0xc9))['catch'](handleError(_0x3cb345,null));};exports[_0x95a9('0x28')]=function(_0x4a79d0,_0xc6fbbe){if(_0x4a79d0['body']['id']){delete _0x4a79d0[_0x95a9('0x64')]['id'];}_0x4a79d0[_0x95a9('0x64')][_0x95a9('0x43')]=widgetAttributes(_0x4a79d0['body']);return db[_0x95a9('0x3d')][_0x95a9('0x3e')]({'where':{'id':_0x4a79d0[_0x95a9('0x2f')]['id']}})[_0x95a9('0x3f')](handleEntityNotFound(_0xc6fbbe,null))[_0x95a9('0x3f')](saveUpdates(_0x4a79d0['body'],null))[_0x95a9('0x3f')](respondWithResult(_0xc6fbbe,null))[_0x95a9('0x40')](handleError(_0xc6fbbe,null));}; \ No newline at end of file +var _0xc9ab=['attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','stringify','create','body','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','show','params','DashboardItem','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','include','catch','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts'];(function(_0x29ffa7,_0x2ae6c2){var _0x39fee9=function(_0x473109){while(--_0x473109){_0x29ffa7['push'](_0x29ffa7['shift']());}};_0x39fee9(++_0x2ae6c2);}(_0xc9ab,0x125));var _0xbc9a=function(_0x1da827,_0x37b758){_0x1da827=_0x1da827-0x0;var _0x13cd71=_0xc9ab[_0x1da827];return _0x13cd71;};'use strict';var emlformat=require(_0xbc9a('0x0'));var rimraf=require(_0xbc9a('0x1'));var zipdir=require(_0xbc9a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbc9a('0x3'));var Mustache=require(_0xbc9a('0x4'));var util=require(_0xbc9a('0x5'));var path=require(_0xbc9a('0x6'));var sox=require(_0xbc9a('0x7'));var csv=require(_0xbc9a('0x8'));var ejs=require(_0xbc9a('0x9'));var fs=require('fs');var fs_extra=require(_0xbc9a('0xa'));var _=require(_0xbc9a('0xb'));var squel=require(_0xbc9a('0xc'));var crypto=require(_0xbc9a('0xd'));var jsforce=require(_0xbc9a('0xe'));var deskjs=require(_0xbc9a('0xf'));var toCsv=require(_0xbc9a('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbc9a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbc9a('0x11'));var hardwareService=require(_0xbc9a('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xbc9a('0x13'));var licenseUtil=require(_0xbc9a('0x14'));var db=require('../../mysqldb')['db'];config[_0xbc9a('0x15')]=_[_0xbc9a('0x16')](config[_0xbc9a('0x15')],{'host':_0xbc9a('0x17'),'port':0x18eb});var socket=require(_0xbc9a('0x18'))(new Redis(config[_0xbc9a('0x15')]));require(_0xbc9a('0x19'))['register'](socket);function respondWithStatusCode(_0x1a5a50,_0x417527){_0x417527=_0x417527||0xcc;return function(_0x4392a7){if(_0x4392a7){return _0x1a5a50['sendStatus'](_0x417527);}return _0x1a5a50['status'](_0x417527)[_0xbc9a('0x1a')]();};}function respondWithResult(_0x2026fa,_0x4583b2){_0x4583b2=_0x4583b2||0xc8;return function(_0x42175f){if(_0x42175f){return _0x2026fa[_0xbc9a('0x1b')](_0x4583b2)[_0xbc9a('0x1c')](_0x42175f);}};}function respondWithFilteredResult(_0x585954,_0x4b1f4a){return function(_0x1f11ca){if(_0x1f11ca){var _0x3cc279=typeof _0x4b1f4a['offset']===_0xbc9a('0x1d')&&typeof _0x4b1f4a[_0xbc9a('0x1e')]===_0xbc9a('0x1d');var _0x49895f=_0x1f11ca[_0xbc9a('0x1f')];var _0x2969ef=_0x3cc279?0x0:_0x4b1f4a[_0xbc9a('0x20')];var _0x24032b=_0x3cc279?_0x1f11ca[_0xbc9a('0x1f')]:_0x4b1f4a[_0xbc9a('0x20')]+_0x4b1f4a[_0xbc9a('0x1e')];var _0x1a5866;if(_0x24032b>=_0x49895f){_0x24032b=_0x49895f;_0x1a5866=0xc8;}else{_0x1a5866=0xce;}_0x585954[_0xbc9a('0x1b')](_0x1a5866);return _0x585954[_0xbc9a('0x21')](_0xbc9a('0x22'),_0x2969ef+'-'+_0x24032b+'/'+_0x49895f)['json'](_0x1f11ca);}return null;};}function patchUpdates(_0x5cf651){return function(_0x46ec93){try{jsonpatch[_0xbc9a('0x23')](_0x46ec93,_0x5cf651,!![]);}catch(_0x29c6d5){return BPromise[_0xbc9a('0x24')](_0x29c6d5);}return _0x46ec93[_0xbc9a('0x25')]();};}function saveUpdates(_0xdea80c,_0x15af2f){return function(_0x433689){if(_0x433689){return _0x433689[_0xbc9a('0x26')](_0xdea80c)[_0xbc9a('0x27')](function(_0x141b3f){return _0x141b3f;});}return null;};}function removeEntity(_0x3a2fa6,_0x5dd6b2){return function(_0x35a3d7){if(_0x35a3d7){return _0x35a3d7[_0xbc9a('0x28')]()[_0xbc9a('0x27')](function(){_0x3a2fa6[_0xbc9a('0x1b')](0xcc)[_0xbc9a('0x1a')]();});}};}function handleEntityNotFound(_0x379256,_0x2ea21b){return function(_0x47fff5){if(!_0x47fff5){_0x379256[_0xbc9a('0x29')](0x194);}return _0x47fff5;};}function handleError(_0x176a4f,_0x34a217){_0x34a217=_0x34a217||0x1f4;return function(_0x47b196){logger[_0xbc9a('0x2a')](_0x47b196[_0xbc9a('0x2b')]);if(_0x47b196[_0xbc9a('0x2c')]){delete _0x47b196[_0xbc9a('0x2c')];}_0x176a4f[_0xbc9a('0x1b')](_0x34a217)[_0xbc9a('0x2d')](_0x47b196);};}exports[_0xbc9a('0x2e')]=function(_0x3d3d34,_0x31627e){var _0x4eaa7d={'raw':![],'where':{'id':_0x3d3d34[_0xbc9a('0x2f')]['id']}},_0x2d3231={};_0x2d3231['model']=_['keys'](db[_0xbc9a('0x30')][_0xbc9a('0x31')]);_0x2d3231[_0xbc9a('0x32')]=_[_0xbc9a('0x33')](_0x3d3d34[_0xbc9a('0x32')]);_0x2d3231[_0xbc9a('0x34')]=_[_0xbc9a('0x35')](_0x2d3231[_0xbc9a('0x36')],_0x2d3231[_0xbc9a('0x32')]);_0x4eaa7d['attributes']=_[_0xbc9a('0x35')](_0x2d3231[_0xbc9a('0x36')],qs[_0xbc9a('0x37')](_0x3d3d34[_0xbc9a('0x32')]['fields']));_0x4eaa7d[_0xbc9a('0x38')]=_0x4eaa7d[_0xbc9a('0x38')][_0xbc9a('0x39')]?_0x4eaa7d[_0xbc9a('0x38')]:_0x2d3231[_0xbc9a('0x36')];if(_0x3d3d34[_0xbc9a('0x32')]['includeAll']){_0x4eaa7d[_0xbc9a('0x3a')]=[{'all':!![]}];}_0x4eaa7d=_['merge']({},_0x4eaa7d,_0x3d3d34['options']);return db[_0xbc9a('0x30')]['find'](_0x4eaa7d)[_0xbc9a('0x27')](handleEntityNotFound(_0x31627e,null))['then'](respondWithResult(_0x31627e,null))[_0xbc9a('0x3b')](handleError(_0x31627e,null));};exports[_0xbc9a('0x28')]=function(_0x49d91e,_0x396400){return db['DashboardItem'][_0xbc9a('0x3c')]({'where':{'id':_0x49d91e[_0xbc9a('0x2f')]['id']}})[_0xbc9a('0x27')](handleEntityNotFound(_0x396400,null))[_0xbc9a('0x27')](removeEntity(_0x396400,null))[_0xbc9a('0x3b')](handleError(_0x396400,null));};function widgetAttributes(_0x53601a){try{switch(_0x53601a[_0xbc9a('0x3d')]){case _0xbc9a('0x3e'):return[{'name':_0xbc9a('0x3f'),'value':_0x53601a[_0xbc9a('0x3f')]||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a[_0xbc9a('0x40')][0x0]?_0x53601a[_0xbc9a('0x40')][0x0][_0xbc9a('0x41')]:undefined)||_0xbc9a('0x42')}];case _0xbc9a('0x43'):return[{'name':_0xbc9a('0x44'),'value':_0x53601a[_0xbc9a('0x44')]||(_0x53601a['attrs']&&_0x53601a[_0xbc9a('0x40')][0x0]?_0x53601a[_0xbc9a('0x40')][0x0][_0xbc9a('0x41')]:undefined)||''}];case _0xbc9a('0x45'):return[{'name':_0xbc9a('0x46'),'value':_0x53601a[_0xbc9a('0x46')]||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a[_0xbc9a('0x40')][0x0]?_0x53601a[_0xbc9a('0x40')][0x0]['value']:undefined)||_0xbc9a('0x47')},{'name':_0xbc9a('0x48'),'value':_0x53601a['attrTimezone']||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a[_0xbc9a('0x40')][0x1]?_0x53601a['attrs'][0x1][_0xbc9a('0x41')]:undefined)||'0.00'},{'name':_0xbc9a('0x49'),'value':_0x53601a[_0xbc9a('0x49')]||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a[_0xbc9a('0x40')][0x2]?_0x53601a[_0xbc9a('0x40')][0x2][_0xbc9a('0x41')]:undefined)||0xc}];case _0xbc9a('0x4a'):return[{'name':_0xbc9a('0x4b'),'value':_0x53601a['attrMetric']||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a[_0xbc9a('0x40')][0x0]?_0x53601a[_0xbc9a('0x40')][0x0][_0xbc9a('0x41')]:undefined)||_0xbc9a('0x4c')},{'name':_0xbc9a('0x4d'),'value':_0x53601a[_0xbc9a('0x4d')]||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a['attrs'][0x1]?_0x53601a[_0xbc9a('0x40')][0x1][_0xbc9a('0x41')]:undefined)||[]},{'name':_0xbc9a('0x49'),'value':_0x53601a['attrFontSize']||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a[_0xbc9a('0x40')][0x2]?_0x53601a[_0xbc9a('0x40')][0x2][_0xbc9a('0x41')]:undefined)||0x14},{'name':_0xbc9a('0x4e'),'value':_0x53601a['attrChannel']||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a[_0xbc9a('0x40')][0x3]?_0x53601a['attrs'][0x3][_0xbc9a('0x41')]:undefined)||_0xbc9a('0x4f')},{'name':_0xbc9a('0x50'),'value':_0x53601a['attrEmailAccounts']||(_0x53601a['attrs']&&_0x53601a[_0xbc9a('0x40')][0x4]?_0x53601a[_0xbc9a('0x40')][0x4][_0xbc9a('0x41')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x53601a[_0xbc9a('0x51')]||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a[_0xbc9a('0x40')][0x5]?_0x53601a[_0xbc9a('0x40')][0x5][_0xbc9a('0x41')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x53601a[_0xbc9a('0x52')]||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a['attrs'][0x6]?_0x53601a['attrs'][0x6][_0xbc9a('0x41')]:undefined)||''},{'name':_0xbc9a('0x53'),'value':_0x53601a[_0xbc9a('0x53')]||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a['attrs'][0x7]?_0x53601a[_0xbc9a('0x40')][0x7][_0xbc9a('0x41')]:undefined)||''},{'name':_0xbc9a('0x54'),'value':_0x53601a[_0xbc9a('0x54')]||(_0x53601a['attrs']&&_0x53601a[_0xbc9a('0x40')][0x8]?_0x53601a[_0xbc9a('0x40')][0x8][_0xbc9a('0x41')]:undefined)||''},{'name':_0xbc9a('0x55'),'value':_0x53601a[_0xbc9a('0x55')]||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a['attrs'][0x9]?_0x53601a[_0xbc9a('0x40')][0x9][_0xbc9a('0x41')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x53601a['attrSerie1']||(_0x53601a['attrs']&&_0x53601a[_0xbc9a('0x40')][0x0]?_0x53601a['attrs'][0x0]['value']:undefined)||_0xbc9a('0x4c')},{'name':'attrSerie2','value':_0x53601a[_0xbc9a('0x56')]||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a['attrs'][0x1]?_0x53601a['attrs'][0x1][_0xbc9a('0x41')]:undefined)||null},{'name':_0xbc9a('0x57'),'value':_0x53601a[_0xbc9a('0x57')]||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a[_0xbc9a('0x40')][0x2]?_0x53601a[_0xbc9a('0x40')][0x2][_0xbc9a('0x41')]:undefined)||null},{'name':_0xbc9a('0x4d'),'value':_0x53601a[_0xbc9a('0x4d')]||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a['attrs'][0x3]?_0x53601a['attrs'][0x3][_0xbc9a('0x41')]:undefined)||[]},{'name':_0xbc9a('0x4e'),'value':_0x53601a['attrChannel']||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a[_0xbc9a('0x40')][0x4]?_0x53601a[_0xbc9a('0x40')][0x4][_0xbc9a('0x41')]:undefined)||_0xbc9a('0x4f')},{'name':_0xbc9a('0x50'),'value':_0x53601a['attrEmailAccounts']||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a[_0xbc9a('0x40')][0x5]?_0x53601a[_0xbc9a('0x40')][0x5]['value']:undefined)||''},{'name':_0xbc9a('0x51'),'value':_0x53601a[_0xbc9a('0x51')]||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a['attrs'][0x6]?_0x53601a['attrs'][0x6]['value']:undefined)||''},{'name':_0xbc9a('0x52'),'value':_0x53601a[_0xbc9a('0x52')]||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a[_0xbc9a('0x40')][0x7]?_0x53601a[_0xbc9a('0x40')][0x7][_0xbc9a('0x41')]:undefined)||''},{'name':_0xbc9a('0x53'),'value':_0x53601a[_0xbc9a('0x53')]||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a[_0xbc9a('0x40')][0x8]?_0x53601a[_0xbc9a('0x40')][0x8][_0xbc9a('0x41')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x53601a['attrWhatsappAccounts']||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a[_0xbc9a('0x40')][0x9]?_0x53601a[_0xbc9a('0x40')][0x9][_0xbc9a('0x41')]:undefined)||''},{'name':_0xbc9a('0x55'),'value':_0x53601a[_0xbc9a('0x55')]||(_0x53601a['attrs']&&_0x53601a['attrs'][0xa]?_0x53601a[_0xbc9a('0x40')][0xa][_0xbc9a('0x41')]:undefined)||''}];case _0xbc9a('0x58'):return[{'name':_0xbc9a('0x59'),'type':_0x53601a['reportType']||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a['attrs'][0x0]?_0x53601a[_0xbc9a('0x40')][0x0][_0xbc9a('0x3d')]:undefined)||null,'value':_0x53601a['attrReport']||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a['attrs'][0x0]?_0x53601a[_0xbc9a('0x40')][0x0]['value']:undefined)||null},{'name':_0xbc9a('0x5a'),'value':_0x53601a[_0xbc9a('0x5a')]||(_0x53601a[_0xbc9a('0x40')]&&_0x53601a[_0xbc9a('0x40')][0x1]?_0x53601a['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x435a38){logger[_0xbc9a('0x2a')]('widgetAttributes:\x20%s',JSON[_0xbc9a('0x5b')](_0x435a38));return[];}}exports[_0xbc9a('0x5c')]=function(_0x400953,_0xed4f26){if(_0x400953[_0xbc9a('0x5d')]){_0x400953[_0xbc9a('0x5d')][_0xbc9a('0x40')]=widgetAttributes(_0x400953['body']);}return db[_0xbc9a('0x30')][_0xbc9a('0x5c')](_0x400953[_0xbc9a('0x5d')],{})[_0xbc9a('0x27')](respondWithResult(_0xed4f26,0xc9))[_0xbc9a('0x3b')](handleError(_0xed4f26,null));};exports[_0xbc9a('0x26')]=function(_0xcba517,_0x4c53f3){if(_0xcba517[_0xbc9a('0x5d')]['id']){delete _0xcba517[_0xbc9a('0x5d')]['id'];}_0xcba517[_0xbc9a('0x5d')][_0xbc9a('0x40')]=widgetAttributes(_0xcba517[_0xbc9a('0x5d')]);return db[_0xbc9a('0x30')]['find']({'where':{'id':_0xcba517[_0xbc9a('0x2f')]['id']}})['then'](handleEntityNotFound(_0x4c53f3,null))[_0xbc9a('0x27')](saveUpdates(_0xcba517[_0xbc9a('0x5d')],null))[_0xbc9a('0x27')](respondWithResult(_0x4c53f3,null))[_0xbc9a('0x3b')](handleError(_0x4c53f3,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 41489ae..1480b85 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 _0x6f96=['save','update','emit','hook','events','../../mysqldb','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f96,0x13f));var _0x66f9=function(_0x1b4f11,_0x483f2c){_0x1b4f11=_0x1b4f11-0x0;var _0x7cf6ea=_0x6f96[_0x1b4f11];return _0x7cf6ea;};'use strict';var EventEmitter=require(_0x66f9('0x0'));var DashboardItem=require(_0x66f9('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x66f9('0x2')](0x0);var events={'afterCreate':_0x66f9('0x3'),'afterUpdate':_0x66f9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x39c747){return function(_0x4491d0,_0x512918,_0x5bb031){DashboardItemEvents['emit'](_0x39c747+':'+_0x4491d0['id'],_0x4491d0);DashboardItemEvents[_0x66f9('0x5')](_0x39c747,_0x4491d0);_0x5bb031(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x66f9('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x88b5=['../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x5047f5,_0x24ece7){var _0x95290=function(_0xbee806){while(--_0xbee806){_0x5047f5['push'](_0x5047f5['shift']());}};_0x95290(++_0x24ece7);}(_0x88b5,0x167));var _0x588b=function(_0x968a6d,_0x26d6a3){_0x968a6d=_0x968a6d-0x0;var _0x436f63=_0x88b5[_0x968a6d];return _0x436f63;};'use strict';var EventEmitter=require(_0x588b('0x0'));var DashboardItem=require(_0x588b('0x1'))['db'][_0x588b('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x588b('0x3')](0x0);var events={'afterCreate':_0x588b('0x4'),'afterUpdate':_0x588b('0x5'),'afterDestroy':_0x588b('0x6')};function emitEvent(_0x38af1e){return function(_0x2c277e,_0x2d144e,_0x1feb4b){DashboardItemEvents[_0x588b('0x7')](_0x38af1e+':'+_0x2c277e['id'],_0x2c277e);DashboardItemEvents[_0x588b('0x7')](_0x38af1e,_0x2c277e);_0x1feb4b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x588b('0x8')](e,emitEvent(event));}}module[_0x588b('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index d8958d0..ad2c98a 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 _0x5541=['exports','define','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./dashboardItem.attributes'];(function(_0x2e95d8,_0x1050cc){var _0x158020=function(_0x59f6ef){while(--_0x59f6ef){_0x2e95d8['push'](_0x2e95d8['shift']());}};_0x158020(++_0x1050cc);}(_0x5541,0x1df));var _0x1554=function(_0x10e840,_0x5b3935){_0x10e840=_0x10e840-0x0;var _0x405caa=_0x5541[_0x10e840];return _0x405caa;};'use strict';var _=require(_0x1554('0x0'));var util=require('util');var logger=require(_0x1554('0x1'))(_0x1554('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1554('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1554('0x4'));var config=require(_0x1554('0x5'));var attributes=require(_0x1554('0x6'));module[_0x1554('0x7')]=function(_0x4ed779,_0x53e436){return _0x4ed779[_0x1554('0x8')]('DashboardItem',attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1803=['request-promise','path','rimraf','../../config/environment','define','dashboard_items','util','api','moment','bluebird'];(function(_0x5a7dd3,_0x26b7cf){var _0x2f4d07=function(_0x280510){while(--_0x280510){_0x5a7dd3['push'](_0x5a7dd3['shift']());}};_0x2f4d07(++_0x26b7cf);}(_0x1803,0x1be));var _0x3180=function(_0x1ec06f,_0x4519da){_0x1ec06f=_0x1ec06f-0x0;var _0x44f4db=_0x1803[_0x1ec06f];return _0x44f4db;};'use strict';var _=require('lodash');var util=require(_0x3180('0x0'));var logger=require('../../config/logger')(_0x3180('0x1'));var moment=require(_0x3180('0x2'));var BPromise=require(_0x3180('0x3'));var rp=require(_0x3180('0x4'));var fs=require('fs');var path=require(_0x3180('0x5'));var rimraf=require(_0x3180('0x6'));var config=require(_0x3180('0x7'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x355046,_0x252ebc){return _0x355046[_0x3180('0x8')]('DashboardItem',attributes,{'tableName':_0x3180('0x9'),'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 5726f6c..d68d083 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 _0x696e=['client','http','redis','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1c8abc,_0x4e4fdb){var _0x4beee5=function(_0x1158d4){while(--_0x1158d4){_0x1c8abc['push'](_0x1c8abc['shift']());}};_0x4beee5(++_0x4e4fdb);}(_0x696e,0x1a6));var _0xe696=function(_0x3c9dad,_0x361159){_0x3c9dad=_0x3c9dad-0x0;var _0x26ebd3=_0x696e[_0x3c9dad];return _0x26ebd3;};'use strict';var _=require('lodash');var util=require(_0xe696('0x0'));var moment=require(_0xe696('0x1'));var BPromise=require(_0xe696('0x2'));var rs=require(_0xe696('0x3'));var fs=require('fs');var Redis=require(_0xe696('0x4'));var db=require(_0xe696('0x5'))['db'];var utils=require(_0xe696('0x6'));var logger=require('../../config/logger')(_0xe696('0x7'));var config=require(_0xe696('0x8'));var jayson=require(_0xe696('0x9'));var client=jayson[_0xe696('0xa')][_0xe696('0xb')]({'port':0x232a});config[_0xe696('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe696('0xc')]));require('./dashboardItem.socket')[_0xe696('0xd')](socket);function respondWithRpcPromise(_0x3a5aac,_0x5cf30c,_0x284dba){return new BPromise(function(_0x30e05b,_0x432c18){return client[_0xe696('0xe')](_0x3a5aac,_0x284dba)[_0xe696('0xf')](function(_0x1c5585){logger['info'](_0xe696('0x10'),_0x5cf30c,_0xe696('0x11'));logger[_0xe696('0x12')](_0xe696('0x13'),_0x5cf30c,_0xe696('0x11'),JSON[_0xe696('0x14')](_0x1c5585));if(_0x1c5585[_0xe696('0x15')]){if(_0x1c5585[_0xe696('0x15')][_0xe696('0x16')]===0x1f4){logger[_0xe696('0x15')](_0xe696('0x10'),_0x5cf30c,_0x1c5585[_0xe696('0x15')]['message']);return _0x432c18(_0x1c5585['error'][_0xe696('0x17')]);}logger[_0xe696('0x15')](_0xe696('0x10'),_0x5cf30c,_0x1c5585[_0xe696('0x15')][_0xe696('0x17')]);return _0x30e05b(_0x1c5585['error'][_0xe696('0x17')]);}else{logger[_0xe696('0x18')](_0xe696('0x10'),_0x5cf30c,_0xe696('0x11'));_0x30e05b(_0x1c5585[_0xe696('0x19')][_0xe696('0x17')]);}})[_0xe696('0x1a')](function(_0x2fd56e){logger['error']('DashboardItem,\x20%s,\x20%s',_0x5cf30c,_0x2fd56e);_0x432c18(_0x2fd56e);});});} \ No newline at end of file +var _0x5479=['redis','defaults','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x21a645,_0x250e94){var _0x1a91c1=function(_0x1694de){while(--_0x1694de){_0x21a645['push'](_0x21a645['shift']());}};_0x1a91c1(++_0x250e94);}(_0x5479,0x1e2));var _0x9547=function(_0x1b44b5,_0x4bfc7b){_0x1b44b5=_0x1b44b5-0x0;var _0x2a08b1=_0x5479[_0x1b44b5];return _0x2a08b1;};'use strict';var _=require(_0x9547('0x0'));var util=require(_0x9547('0x1'));var moment=require(_0x9547('0x2'));var BPromise=require(_0x9547('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9547('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9547('0x5'))(_0x9547('0x6'));var config=require(_0x9547('0x7'));var jayson=require(_0x9547('0x8'));var client=jayson[_0x9547('0x9')][_0x9547('0xa')]({'port':0x232a});config[_0x9547('0xb')]=_[_0x9547('0xc')](config[_0x9547('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9547('0xd'))(new Redis(config[_0x9547('0xb')]));require(_0x9547('0xe'))[_0x9547('0xf')](socket);function respondWithRpcPromise(_0x3d62fd,_0x576bec,_0xe8b8d5){return new BPromise(function(_0x54e6b5,_0x1d45d2){return client[_0x9547('0x10')](_0x3d62fd,_0xe8b8d5)[_0x9547('0x11')](function(_0xb3e587){logger['info'](_0x9547('0x12'),_0x576bec,_0x9547('0x13'));logger[_0x9547('0x14')](_0x9547('0x15'),_0x576bec,_0x9547('0x13'),JSON[_0x9547('0x16')](_0xb3e587));if(_0xb3e587['error']){if(_0xb3e587[_0x9547('0x17')][_0x9547('0x18')]===0x1f4){logger[_0x9547('0x17')](_0x9547('0x12'),_0x576bec,_0xb3e587[_0x9547('0x17')][_0x9547('0x19')]);return _0x1d45d2(_0xb3e587[_0x9547('0x17')][_0x9547('0x19')]);}logger[_0x9547('0x17')](_0x9547('0x12'),_0x576bec,_0xb3e587[_0x9547('0x17')]['message']);return _0x54e6b5(_0xb3e587[_0x9547('0x17')][_0x9547('0x19')]);}else{logger[_0x9547('0x1a')](_0x9547('0x12'),_0x576bec,_0x9547('0x13'));_0x54e6b5(_0xb3e587[_0x9547('0x1b')][_0x9547('0x19')]);}})[_0x9547('0x1c')](function(_0x5bfcab){logger['error'](_0x9547('0x12'),_0x576bec,_0x5bfcab);_0x1d45d2(_0x5bfcab);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 4ebdfcc..0a9deef 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 _0xee92=['register','dashboardItem:','save','remove','update','emit'];(function(_0x4df949,_0xacb5f8){var _0xfc1c90=function(_0x4df349){while(--_0x4df349){_0x4df949['push'](_0x4df949['shift']());}};_0xfc1c90(++_0xacb5f8);}(_0xee92,0xfe));var _0x2ee9=function(_0x170979,_0x22d945){_0x170979=_0x170979-0x0;var _0x4dab2e=_0xee92[_0x170979];return _0x4dab2e;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x2ee9('0x0'),_0x2ee9('0x1'),_0x2ee9('0x2')];function createListener(_0xa4a291,_0x5ce933){return function(_0x204f32){_0x5ce933[_0x2ee9('0x3')](_0xa4a291,_0x204f32);};}function removeListener(_0x4c98c8,_0x2ce9fb){return function(){DashboardItemEvents['removeListener'](_0x4c98c8,_0x2ce9fb);};}exports[_0x2ee9('0x4')]=function(_0x3a9780){for(var _0x4fa17d=0x0,_0x33203a=events['length'];_0x4fa17d<_0x33203a;_0x4fa17d++){var _0x4d5b15=events[_0x4fa17d];var _0x3a8fb9=createListener(_0x2ee9('0x5')+_0x4d5b15,_0x3a9780);DashboardItemEvents['on'](_0x4d5b15,_0x3a8fb9);}}; \ No newline at end of file +var _0xc57b=['dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','register'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xc57b,0x149));var _0xbc57=function(_0x414564,_0x496715){_0x414564=_0x414564-0x0;var _0x1a6071=_0xc57b[_0x414564];return _0x1a6071;};'use strict';var DashboardItemEvents=require(_0xbc57('0x0'));var events=[_0xbc57('0x1'),_0xbc57('0x2'),_0xbc57('0x3')];function createListener(_0x503848,_0x291d50){return function(_0xa101dd){_0x291d50[_0xbc57('0x4')](_0x503848,_0xa101dd);};}function removeListener(_0x1b7ecf,_0x5b7421){return function(){DashboardItemEvents[_0xbc57('0x5')](_0x1b7ecf,_0x5b7421);};}exports[_0xbc57('0x6')]=function(_0x570abb){for(var _0x38fa5f=0x0,_0x5e810a=events['length'];_0x38fa5f<_0x5e810a;_0x38fa5f++){var _0x444373=events[_0x38fa5f];var _0x88e744=createListener(_0xbc57('0x7')+_0x444373,_0x570abb);DashboardItemEvents['on'](_0x444373,_0x88e744);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 1435720..51c4355 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 _0x0996=['isAuthenticated','create','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id'];(function(_0x11a94b,_0x193fa4){var _0x32b21a=function(_0x563060){while(--_0x563060){_0x11a94b['push'](_0x11a94b['shift']());}};_0x32b21a(++_0x193fa4);}(_0x0996,0x1d8));var _0x6099=function(_0x3f8008,_0x58635d){_0x3f8008=_0x3f8008-0x0;var _0x47220f=_0x0996[_0x3f8008];return _0x47220f;};'use strict';var multer=require(_0x6099('0x0'));var util=require('util');var path=require(_0x6099('0x1'));var timeout=require('connect-timeout');var express=require(_0x6099('0x2'));var router=express['Router']();var fs_extra=require(_0x6099('0x3'));var auth=require(_0x6099('0x4'));var interaction=require(_0x6099('0x5'));var config=require(_0x6099('0x6'));var controller=require('./dashboardItem.controller');router['get'](_0x6099('0x7'),auth[_0x6099('0x8')](),controller['show']);router['post']('/',auth[_0x6099('0x8')](),controller[_0x6099('0x9')]);router[_0x6099('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6099('0xb')]);router[_0x6099('0xc')](_0x6099('0x7'),auth[_0x6099('0x8')](),controller[_0x6099('0xd')]);module[_0x6099('0xe')]=router; \ No newline at end of file +var _0xa1a5=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0xa1a5,0x177));var _0x5a1a=function(_0xf4f78e,_0x4596f6){_0xf4f78e=_0xf4f78e-0x0;var _0x5431e0=_0xa1a5[_0xf4f78e];return _0x5431e0;};'use strict';var multer=require('multer');var util=require(_0x5a1a('0x0'));var path=require(_0x5a1a('0x1'));var timeout=require(_0x5a1a('0x2'));var express=require(_0x5a1a('0x3'));var router=express[_0x5a1a('0x4')]();var fs_extra=require(_0x5a1a('0x5'));var auth=require(_0x5a1a('0x6'));var interaction=require(_0x5a1a('0x7'));var config=require(_0x5a1a('0x8'));var controller=require(_0x5a1a('0x9'));router[_0x5a1a('0xa')](_0x5a1a('0xb'),auth[_0x5a1a('0xc')](),controller[_0x5a1a('0xd')]);router[_0x5a1a('0xe')]('/',auth[_0x5a1a('0xc')](),controller[_0x5a1a('0xf')]);router[_0x5a1a('0x10')]('/:id',auth[_0x5a1a('0xc')](),controller[_0x5a1a('0x11')]);router[_0x5a1a('0x12')](_0x5a1a('0xb'),auth[_0x5a1a('0xc')](),controller[_0x5a1a('0x13')]);module[_0x5a1a('0x14')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index da26676..fc7fa7c 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 _0x972a=['second','third','STRING'];(function(_0x3c9bdf,_0x3b30cd){var _0x5664a6=function(_0x4ea55c){while(--_0x4ea55c){_0x3c9bdf['push'](_0x3c9bdf['shift']());}};_0x5664a6(++_0x3b30cd);}(_0x972a,0x1ad));var _0xa972=function(_0x3cc6b4,_0x58b1aa){_0x3cc6b4=_0x3cc6b4-0x0;var _0x1c07b8=_0x972a[_0x3cc6b4];return _0x1c07b8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0xa972('0x0'),_0xa972('0x1')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xa972('0x2')]}}; \ No newline at end of file +var _0xe0e3=['exports','STRING','ENUM','first','second','third','sequelize'];(function(_0x117309,_0x4fd03c){var _0x55c107=function(_0x38345c){while(--_0x38345c){_0x117309['push'](_0x117309['shift']());}};_0x55c107(++_0x4fd03c);}(_0xe0e3,0x7d));var _0x3e0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0e3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3e0e('0x0'));module[_0x3e0e('0x1')]={'name':{'type':Sequelize[_0x3e0e('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x3e0e('0x3')](_0x3e0e('0x4'),_0x3e0e('0x5'),_0x3e0e('0x6')),'allowNull':![],'defaultValue':_0x3e0e('0x4')},'description':{'type':Sequelize[_0x3e0e('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index a94f278..bfea9d1 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 _0xc9cb=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','then','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xc9cb,0x91));var _0xbc9c=function(_0x15dafc,_0x22cfb8){_0x15dafc=_0x15dafc-0x0;var _0x21413c=_0xc9cb[_0x15dafc];return _0x21413c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc9c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbc9c('0x1'));var moment=require('moment');var BPromise=require(_0xbc9c('0x2'));var Mustache=require('mustache');var util=require(_0xbc9c('0x3'));var path=require(_0xbc9c('0x4'));var sox=require(_0xbc9c('0x5'));var csv=require(_0xbc9c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc9c('0x7'));var _=require(_0xbc9c('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbc9c('0x9'));var toCsv=require('to-csv');var querystring=require(_0xbc9c('0xa'));var Papa=require(_0xbc9c('0xb'));var Redis=require(_0xbc9c('0xc'));var authService=require(_0xbc9c('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xbc9c('0xe'));var hardwareService=require(_0xbc9c('0xf'));var logger=require(_0xbc9c('0x10'))(_0xbc9c('0x11'));var utils=require(_0xbc9c('0x12'));var config=require(_0xbc9c('0x13'));var licenseUtil=require(_0xbc9c('0x14'));var db=require(_0xbc9c('0x15'))['db'];function respondWithStatusCode(_0x16bd61,_0xeb1b51){_0xeb1b51=_0xeb1b51||0xcc;return function(_0x505a66){if(_0x505a66){return _0x16bd61[_0xbc9c('0x16')](_0xeb1b51);}return _0x16bd61[_0xbc9c('0x17')](_0xeb1b51)[_0xbc9c('0x18')]();};}function respondWithResult(_0x220324,_0x9173be){_0x9173be=_0x9173be||0xc8;return function(_0x4ecaa8){if(_0x4ecaa8){return _0x220324[_0xbc9c('0x17')](_0x9173be)[_0xbc9c('0x19')](_0x4ecaa8);}};}function respondWithFilteredResult(_0x3bc2d4,_0x2a83fd){return function(_0x3e63e4){if(_0x3e63e4){var _0x525e4b=typeof _0x2a83fd[_0xbc9c('0x1a')]===_0xbc9c('0x1b')&&typeof _0x2a83fd['limit']===_0xbc9c('0x1b');var _0x5d3245=_0x3e63e4[_0xbc9c('0x1c')];var _0x5c6fb2=_0x525e4b?0x0:_0x2a83fd['offset'];var _0x1097b6=_0x525e4b?_0x3e63e4[_0xbc9c('0x1c')]:_0x2a83fd[_0xbc9c('0x1a')]+_0x2a83fd[_0xbc9c('0x1d')];var _0x4b6ce2;if(_0x1097b6>=_0x5d3245){_0x1097b6=_0x5d3245;_0x4b6ce2=0xc8;}else{_0x4b6ce2=0xce;}_0x3bc2d4[_0xbc9c('0x17')](_0x4b6ce2);return _0x3bc2d4[_0xbc9c('0x1e')](_0xbc9c('0x1f'),_0x5c6fb2+'-'+_0x1097b6+'/'+_0x5d3245)[_0xbc9c('0x19')](_0x3e63e4);}return null;};}function patchUpdates(_0x1d5146){return function(_0x4ab8bf){try{jsonpatch[_0xbc9c('0x20')](_0x4ab8bf,_0x1d5146,!![]);}catch(_0x55dc19){return BPromise[_0xbc9c('0x21')](_0x55dc19);}return _0x4ab8bf['save']();};}function saveUpdates(_0x57ab8b,_0x21a539){return function(_0x2ee7fe){if(_0x2ee7fe){return _0x2ee7fe['update'](_0x57ab8b)['then'](function(_0x525c6b){return _0x525c6b;});}return null;};}function removeEntity(_0x2298a7,_0x471ede){return function(_0x41e081){if(_0x41e081){return _0x41e081[_0xbc9c('0x22')]()[_0xbc9c('0x23')](function(){var _0x2fe6c3=_0x41e081['get']({'plain':!![]});var _0xb04459=_0xbc9c('0x24');return db[_0xbc9c('0x25')][_0xbc9c('0x22')]({'where':{'type':_0xb04459,'resourceId':_0x2fe6c3['id']}})[_0xbc9c('0x23')](function(){return _0x41e081;});})[_0xbc9c('0x23')](function(){_0x2298a7['status'](0xcc)[_0xbc9c('0x18')]();});}};}function handleEntityNotFound(_0x380b86,_0x404e14){return function(_0x122605){if(!_0x122605){_0x380b86[_0xbc9c('0x16')](0x194);}return _0x122605;};}function handleError(_0x5a77fe,_0x37317d){_0x37317d=_0x37317d||0x1f4;return function(_0x4a99fe){logger[_0xbc9c('0x26')](_0x4a99fe[_0xbc9c('0x27')]);if(_0x4a99fe[_0xbc9c('0x28')]){delete _0x4a99fe[_0xbc9c('0x28')];}_0x5a77fe['status'](_0x37317d)[_0xbc9c('0x29')](_0x4a99fe);};}exports[_0xbc9c('0x2a')]=function(_0x557dd0,_0x228a47){var _0x26b7ef={},_0xfeeb04={},_0xab09ec={'count':0x0,'rows':[]};var _0x397552=_[_0xbc9c('0x2b')](db[_0xbc9c('0x2c')][_0xbc9c('0x2d')],function(_0x54d40a){return{'name':_0x54d40a[_0xbc9c('0x2e')],'type':_0x54d40a[_0xbc9c('0x2f')][_0xbc9c('0x30')]};});_0xfeeb04['model']=_['map'](_0x397552,'name');_0xfeeb04[_0xbc9c('0x31')]=_[_0xbc9c('0x32')](_0x557dd0['query']);_0xfeeb04[_0xbc9c('0x33')]=_[_0xbc9c('0x34')](_0xfeeb04['model'],_0xfeeb04[_0xbc9c('0x31')]);_0x26b7ef[_0xbc9c('0x35')]=_[_0xbc9c('0x34')](_0xfeeb04[_0xbc9c('0x36')],qs[_0xbc9c('0x37')](_0x557dd0[_0xbc9c('0x31')][_0xbc9c('0x37')]));_0x26b7ef[_0xbc9c('0x35')]=_0x26b7ef[_0xbc9c('0x35')][_0xbc9c('0x38')]?_0x26b7ef['attributes']:_0xfeeb04['model'];if(!_0x557dd0[_0xbc9c('0x31')]['hasOwnProperty']('nolimit')){_0x26b7ef[_0xbc9c('0x1d')]=qs[_0xbc9c('0x1d')](_0x557dd0['query'][_0xbc9c('0x1d')]);_0x26b7ef[_0xbc9c('0x1a')]=qs[_0xbc9c('0x1a')](_0x557dd0[_0xbc9c('0x31')]['offset']);}_0x26b7ef[_0xbc9c('0x39')]=qs[_0xbc9c('0x3a')](_0x557dd0['query'][_0xbc9c('0x3a')]);_0x26b7ef['where']=qs['filters'](_[_0xbc9c('0x3b')](_0x557dd0['query'],_0xfeeb04[_0xbc9c('0x33')]),_0x397552);if(_0x557dd0['query'][_0xbc9c('0x3c')]){_0x26b7ef[_0xbc9c('0x3d')]=_[_0xbc9c('0x3e')](_0x26b7ef[_0xbc9c('0x3d')],{'$or':_[_0xbc9c('0x2b')](_0x397552,function(_0x265728){if(_0x265728[_0xbc9c('0x2f')]!==_0xbc9c('0x3f')){var _0x18506e={};_0x18506e[_0x265728[_0xbc9c('0x28')]]={'$like':'%'+_0x557dd0[_0xbc9c('0x31')]['filter']+'%'};return _0x18506e;}})});}_0x26b7ef=_[_0xbc9c('0x3e')]({},_0x26b7ef,_0x557dd0[_0xbc9c('0x40')]);var _0x4d01a9={'where':_0x26b7ef[_0xbc9c('0x3d')]};return db['Disposition']['count'](_0x4d01a9)['then'](function(_0x369165){_0xab09ec[_0xbc9c('0x1c')]=_0x369165;if(_0x557dd0[_0xbc9c('0x31')][_0xbc9c('0x41')]){_0x26b7ef[_0xbc9c('0x42')]=[{'all':!![]}];}return db[_0xbc9c('0x2c')][_0xbc9c('0x43')](_0x26b7ef);})[_0xbc9c('0x23')](function(_0x37f9e6){_0xab09ec[_0xbc9c('0x44')]=_0x37f9e6;return _0xab09ec;})[_0xbc9c('0x23')](respondWithFilteredResult(_0x228a47,_0x26b7ef))[_0xbc9c('0x45')](handleError(_0x228a47,null));};exports['show']=function(_0x4aabc5,_0x294db7){var _0xb781f6={'raw':!![],'where':{'id':_0x4aabc5[_0xbc9c('0x46')]['id']}},_0x58bb61={};_0x58bb61[_0xbc9c('0x36')]=_[_0xbc9c('0x32')](db[_0xbc9c('0x2c')][_0xbc9c('0x2d')]);_0x58bb61[_0xbc9c('0x31')]=_[_0xbc9c('0x32')](_0x4aabc5['query']);_0x58bb61[_0xbc9c('0x33')]=_[_0xbc9c('0x34')](_0x58bb61[_0xbc9c('0x36')],_0x58bb61[_0xbc9c('0x31')]);_0xb781f6['attributes']=_[_0xbc9c('0x34')](_0x58bb61[_0xbc9c('0x36')],qs['fields'](_0x4aabc5[_0xbc9c('0x31')]['fields']));_0xb781f6[_0xbc9c('0x35')]=_0xb781f6['attributes'][_0xbc9c('0x38')]?_0xb781f6[_0xbc9c('0x35')]:_0x58bb61[_0xbc9c('0x36')];if(_0x4aabc5['query']['includeAll']){_0xb781f6[_0xbc9c('0x42')]=[{'all':!![]}];}_0xb781f6=_[_0xbc9c('0x3e')]({},_0xb781f6,_0x4aabc5['options']);return db[_0xbc9c('0x2c')][_0xbc9c('0x47')](_0xb781f6)[_0xbc9c('0x23')](handleEntityNotFound(_0x294db7,null))[_0xbc9c('0x23')](respondWithResult(_0x294db7,null))['catch'](handleError(_0x294db7,null));};exports[_0xbc9c('0x48')]=function(_0x20d02d,_0x20cad8){return db[_0xbc9c('0x2c')][_0xbc9c('0x48')](_0x20d02d[_0xbc9c('0x49')],{})['then'](function(_0x2de2a8){var _0x344add=_0x20d02d[_0xbc9c('0x4a')][_0xbc9c('0x4b')]({'plain':!![]});if(!_0x344add)throw new Error(_0xbc9c('0x4c'));if(_0x344add[_0xbc9c('0x4d')]===_0xbc9c('0x4a')){var _0x209ac6=_0x2de2a8[_0xbc9c('0x4b')]({'plain':!![]});var _0x44c8b6=_0xbc9c('0x24');return db['UserProfileSection'][_0xbc9c('0x47')]({'where':{'name':_0x44c8b6,'userProfileId':_0x344add['userProfileId']},'raw':!![]})['then'](function(_0x326d73){if(_0x326d73&&_0x326d73[_0xbc9c('0x4e')]===0x0){return db[_0xbc9c('0x25')][_0xbc9c('0x48')]({'name':_0x209ac6[_0xbc9c('0x28')],'resourceId':_0x209ac6['id'],'type':_0x326d73[_0xbc9c('0x28')],'sectionId':_0x326d73['id']},{})[_0xbc9c('0x23')](function(){return _0x2de2a8;});}else{return _0x2de2a8;}})[_0xbc9c('0x45')](function(_0x47aab8){logger['error'](_0xbc9c('0x4f'),_0x47aab8);throw _0x47aab8;});}return _0x2de2a8;})[_0xbc9c('0x23')](respondWithResult(_0x20cad8,0xc9))[_0xbc9c('0x45')](handleError(_0x20cad8,null));};exports[_0xbc9c('0x50')]=function(_0x1394b4,_0x205d47){if(_0x1394b4[_0xbc9c('0x49')]['id']){delete _0x1394b4[_0xbc9c('0x49')]['id'];}return db[_0xbc9c('0x2c')]['find']({'where':{'id':_0x1394b4[_0xbc9c('0x46')]['id']}})[_0xbc9c('0x23')](handleEntityNotFound(_0x205d47,null))[_0xbc9c('0x23')](saveUpdates(_0x1394b4[_0xbc9c('0x49')],null))[_0xbc9c('0x23')](respondWithResult(_0x205d47,null))[_0xbc9c('0x45')](handleError(_0x205d47,null));};exports[_0xbc9c('0x22')]=function(_0x395b12,_0x498821){return db['Disposition']['find']({'where':{'id':_0x395b12[_0xbc9c('0x46')]['id']}})['then'](handleEntityNotFound(_0x498821,null))[_0xbc9c('0x23')](removeEntity(_0x498821,null))['catch'](handleError(_0x498821,null));}; \ No newline at end of file +var _0x16a7=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Disposition','count','includeAll','findAll','rows','catch','params','include','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv'];(function(_0x123ce7,_0x577566){var _0x347850=function(_0x2bebd1){while(--_0x2bebd1){_0x123ce7['push'](_0x123ce7['shift']());}};_0x347850(++_0x577566);}(_0x16a7,0xa5));var _0x716a=function(_0xebd863,_0x1ff1aa){_0xebd863=_0xebd863-0x0;var _0x118bb9=_0x16a7[_0xebd863];return _0x118bb9;};'use strict';var emlformat=require(_0x716a('0x0'));var rimraf=require(_0x716a('0x1'));var zipdir=require(_0x716a('0x2'));var jsonpatch=require(_0x716a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x716a('0x4'));var Mustache=require(_0x716a('0x5'));var util=require('util');var path=require(_0x716a('0x6'));var sox=require(_0x716a('0x7'));var csv=require(_0x716a('0x8'));var ejs=require(_0x716a('0x9'));var fs=require('fs');var fs_extra=require(_0x716a('0xa'));var _=require('lodash');var squel=require(_0x716a('0xb'));var crypto=require(_0x716a('0xc'));var jsforce=require(_0x716a('0xd'));var deskjs=require(_0x716a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x716a('0xf'));var Papa=require(_0x716a('0x10'));var Redis=require(_0x716a('0x11'));var authService=require(_0x716a('0x12'));var qs=require(_0x716a('0x13'));var as=require(_0x716a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x716a('0x15'))(_0x716a('0x16'));var utils=require(_0x716a('0x17'));var config=require(_0x716a('0x18'));var licenseUtil=require(_0x716a('0x19'));var db=require(_0x716a('0x1a'))['db'];function respondWithStatusCode(_0x341c18,_0x59ebf1){_0x59ebf1=_0x59ebf1||0xcc;return function(_0xdab1a5){if(_0xdab1a5){return _0x341c18[_0x716a('0x1b')](_0x59ebf1);}return _0x341c18['status'](_0x59ebf1)[_0x716a('0x1c')]();};}function respondWithResult(_0x5e75c8,_0x3f629f){_0x3f629f=_0x3f629f||0xc8;return function(_0x153da9){if(_0x153da9){return _0x5e75c8['status'](_0x3f629f)[_0x716a('0x1d')](_0x153da9);}};}function respondWithFilteredResult(_0x3096fe,_0x3a9793){return function(_0x34860f){if(_0x34860f){var _0x2f31b2=typeof _0x3a9793[_0x716a('0x1e')]===_0x716a('0x1f')&&typeof _0x3a9793['limit']===_0x716a('0x1f');var _0x2ad622=_0x34860f['count'];var _0x3776d3=_0x2f31b2?0x0:_0x3a9793['offset'];var _0x3fb152=_0x2f31b2?_0x34860f['count']:_0x3a9793[_0x716a('0x1e')]+_0x3a9793[_0x716a('0x20')];var _0x58c183;if(_0x3fb152>=_0x2ad622){_0x3fb152=_0x2ad622;_0x58c183=0xc8;}else{_0x58c183=0xce;}_0x3096fe[_0x716a('0x21')](_0x58c183);return _0x3096fe['set'](_0x716a('0x22'),_0x3776d3+'-'+_0x3fb152+'/'+_0x2ad622)[_0x716a('0x1d')](_0x34860f);}return null;};}function patchUpdates(_0x43fcd7){return function(_0x32e549){try{jsonpatch[_0x716a('0x23')](_0x32e549,_0x43fcd7,!![]);}catch(_0x1e1e0e){return BPromise[_0x716a('0x24')](_0x1e1e0e);}return _0x32e549[_0x716a('0x25')]();};}function saveUpdates(_0x309779,_0x31219d){return function(_0x427265){if(_0x427265){return _0x427265[_0x716a('0x26')](_0x309779)[_0x716a('0x27')](function(_0x2b878d){return _0x2b878d;});}return null;};}function removeEntity(_0x44093c,_0x3f8160){return function(_0x45ed14){if(_0x45ed14){return _0x45ed14[_0x716a('0x28')]()[_0x716a('0x27')](function(){var _0x27d5bc=_0x45ed14[_0x716a('0x29')]({'plain':!![]});var _0x3217e4=_0x716a('0x2a');return db[_0x716a('0x2b')][_0x716a('0x28')]({'where':{'type':_0x3217e4,'resourceId':_0x27d5bc['id']}})['then'](function(){return _0x45ed14;});})[_0x716a('0x27')](function(){_0x44093c[_0x716a('0x21')](0xcc)[_0x716a('0x1c')]();});}};}function handleEntityNotFound(_0x37363d,_0x10d7fe){return function(_0x102dbd){if(!_0x102dbd){_0x37363d[_0x716a('0x1b')](0x194);}return _0x102dbd;};}function handleError(_0x585ee8,_0xec79c9){_0xec79c9=_0xec79c9||0x1f4;return function(_0x3b3406){logger[_0x716a('0x2c')](_0x3b3406[_0x716a('0x2d')]);if(_0x3b3406[_0x716a('0x2e')]){delete _0x3b3406['name'];}_0x585ee8[_0x716a('0x21')](_0xec79c9)[_0x716a('0x2f')](_0x3b3406);};}exports[_0x716a('0x30')]=function(_0x448d1e,_0x1c947f){var _0x436777={},_0x2529d5={},_0x15e6da={'count':0x0,'rows':[]};var _0x41589f=_[_0x716a('0x31')](db['Disposition'][_0x716a('0x32')],function(_0x56f796){return{'name':_0x56f796[_0x716a('0x33')],'type':_0x56f796['type'][_0x716a('0x34')]};});_0x2529d5[_0x716a('0x35')]=_[_0x716a('0x31')](_0x41589f,'name');_0x2529d5['query']=_[_0x716a('0x36')](_0x448d1e[_0x716a('0x37')]);_0x2529d5[_0x716a('0x38')]=_[_0x716a('0x39')](_0x2529d5['model'],_0x2529d5[_0x716a('0x37')]);_0x436777[_0x716a('0x3a')]=_[_0x716a('0x39')](_0x2529d5[_0x716a('0x35')],qs[_0x716a('0x3b')](_0x448d1e[_0x716a('0x37')][_0x716a('0x3b')]));_0x436777[_0x716a('0x3a')]=_0x436777[_0x716a('0x3a')][_0x716a('0x3c')]?_0x436777[_0x716a('0x3a')]:_0x2529d5[_0x716a('0x35')];if(!_0x448d1e[_0x716a('0x37')]['hasOwnProperty'](_0x716a('0x3d'))){_0x436777[_0x716a('0x20')]=qs[_0x716a('0x20')](_0x448d1e[_0x716a('0x37')][_0x716a('0x20')]);_0x436777['offset']=qs[_0x716a('0x1e')](_0x448d1e[_0x716a('0x37')]['offset']);}_0x436777['order']=qs[_0x716a('0x3e')](_0x448d1e[_0x716a('0x37')]['sort']);_0x436777[_0x716a('0x3f')]=qs['filters'](_[_0x716a('0x40')](_0x448d1e['query'],_0x2529d5[_0x716a('0x38')]),_0x41589f);if(_0x448d1e['query'][_0x716a('0x41')]){_0x436777['where']=_[_0x716a('0x42')](_0x436777[_0x716a('0x3f')],{'$or':_[_0x716a('0x31')](_0x41589f,function(_0x3edb9c){if(_0x3edb9c['type']!==_0x716a('0x43')){var _0x2c508e={};_0x2c508e[_0x3edb9c['name']]={'$like':'%'+_0x448d1e[_0x716a('0x37')]['filter']+'%'};return _0x2c508e;}})});}_0x436777=_[_0x716a('0x42')]({},_0x436777,_0x448d1e[_0x716a('0x44')]);var _0x563288={'where':_0x436777[_0x716a('0x3f')]};return db[_0x716a('0x45')]['count'](_0x563288)['then'](function(_0xa32b5a){_0x15e6da[_0x716a('0x46')]=_0xa32b5a;if(_0x448d1e[_0x716a('0x37')][_0x716a('0x47')]){_0x436777['include']=[{'all':!![]}];}return db[_0x716a('0x45')][_0x716a('0x48')](_0x436777);})[_0x716a('0x27')](function(_0x4dcce9){_0x15e6da[_0x716a('0x49')]=_0x4dcce9;return _0x15e6da;})['then'](respondWithFilteredResult(_0x1c947f,_0x436777))[_0x716a('0x4a')](handleError(_0x1c947f,null));};exports['show']=function(_0x92b5f4,_0x45dd65){var _0x28eddb={'raw':!![],'where':{'id':_0x92b5f4[_0x716a('0x4b')]['id']}},_0x592aca={};_0x592aca['model']=_['keys'](db[_0x716a('0x45')][_0x716a('0x32')]);_0x592aca[_0x716a('0x37')]=_[_0x716a('0x36')](_0x92b5f4['query']);_0x592aca[_0x716a('0x38')]=_['intersection'](_0x592aca[_0x716a('0x35')],_0x592aca['query']);_0x28eddb[_0x716a('0x3a')]=_[_0x716a('0x39')](_0x592aca[_0x716a('0x35')],qs[_0x716a('0x3b')](_0x92b5f4['query'][_0x716a('0x3b')]));_0x28eddb[_0x716a('0x3a')]=_0x28eddb[_0x716a('0x3a')][_0x716a('0x3c')]?_0x28eddb[_0x716a('0x3a')]:_0x592aca[_0x716a('0x35')];if(_0x92b5f4[_0x716a('0x37')]['includeAll']){_0x28eddb[_0x716a('0x4c')]=[{'all':!![]}];}_0x28eddb=_[_0x716a('0x42')]({},_0x28eddb,_0x92b5f4['options']);return db['Disposition'][_0x716a('0x4d')](_0x28eddb)[_0x716a('0x27')](handleEntityNotFound(_0x45dd65,null))['then'](respondWithResult(_0x45dd65,null))[_0x716a('0x4a')](handleError(_0x45dd65,null));};exports['create']=function(_0x3360e2,_0x5c1e25){return db[_0x716a('0x45')]['create'](_0x3360e2['body'],{})[_0x716a('0x27')](function(_0x5d1da2){var _0x48d919=_0x3360e2[_0x716a('0x4e')][_0x716a('0x29')]({'plain':!![]});if(!_0x48d919)throw new Error(_0x716a('0x4f'));if(_0x48d919[_0x716a('0x50')]===_0x716a('0x4e')){var _0x2023f9=_0x5d1da2['get']({'plain':!![]});var _0x268f90=_0x716a('0x2a');return db[_0x716a('0x51')][_0x716a('0x4d')]({'where':{'name':_0x268f90,'userProfileId':_0x48d919[_0x716a('0x52')]},'raw':!![]})[_0x716a('0x27')](function(_0x5dfd9c){if(_0x5dfd9c&&_0x5dfd9c[_0x716a('0x53')]===0x0){return db[_0x716a('0x2b')][_0x716a('0x54')]({'name':_0x2023f9['name'],'resourceId':_0x2023f9['id'],'type':_0x5dfd9c[_0x716a('0x2e')],'sectionId':_0x5dfd9c['id']},{})[_0x716a('0x27')](function(){return _0x5d1da2;});}else{return _0x5d1da2;}})[_0x716a('0x4a')](function(_0x441199){logger[_0x716a('0x2c')](_0x716a('0x55'),_0x441199);throw _0x441199;});}return _0x5d1da2;})[_0x716a('0x27')](respondWithResult(_0x5c1e25,0xc9))[_0x716a('0x4a')](handleError(_0x5c1e25,null));};exports['update']=function(_0x2fee59,_0x5c7634){if(_0x2fee59[_0x716a('0x56')]['id']){delete _0x2fee59[_0x716a('0x56')]['id'];}return db[_0x716a('0x45')][_0x716a('0x4d')]({'where':{'id':_0x2fee59['params']['id']}})[_0x716a('0x27')](handleEntityNotFound(_0x5c7634,null))[_0x716a('0x27')](saveUpdates(_0x2fee59[_0x716a('0x56')],null))[_0x716a('0x27')](respondWithResult(_0x5c7634,null))[_0x716a('0x4a')](handleError(_0x5c7634,null));};exports[_0x716a('0x28')]=function(_0x5a00e6,_0xd4239a){return db['Disposition']['find']({'where':{'id':_0x5a00e6['params']['id']}})[_0x716a('0x27')](handleEntityNotFound(_0xd4239a,null))[_0x716a('0x27')](removeEntity(_0xd4239a,null))[_0x716a('0x4a')](handleError(_0xd4239a,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 4671bed..48edf51 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 _0x9533=['tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition'];(function(_0x10b578,_0x1bddb1){var _0x2ccf34=function(_0x502475){while(--_0x502475){_0x10b578['push'](_0x10b578['shift']());}};_0x2ccf34(++_0x1bddb1);}(_0x9533,0x114));var _0x3953=function(_0x31abe9,_0x4f13c0){_0x31abe9=_0x31abe9-0x0;var _0x59d96b=_0x9533[_0x31abe9];return _0x59d96b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3953('0x0'))(_0x3953('0x1'));var moment=require('moment');var BPromise=require(_0x3953('0x2'));var rp=require(_0x3953('0x3'));var fs=require('fs');var path=require(_0x3953('0x4'));var rimraf=require(_0x3953('0x5'));var config=require(_0x3953('0x6'));var attributes=require(_0x3953('0x7'));module['exports']=function(_0x591253,_0x54df53){return _0x591253[_0x3953('0x8')](_0x3953('0x9'),attributes,{'tableName':_0x3953('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x3953('0xb'),_0x3953('0xc')]},{'unique':!![],'name':_0x3953('0xd'),'fields':[_0x3953('0xb'),_0x3953('0xe')]},{'unique':!![],'name':'name_mail','fields':[_0x3953('0xb'),'MailAccountId']},{'unique':!![],'name':_0x3953('0xf'),'fields':[_0x3953('0xb'),'SmsAccountId']},{'unique':!![],'name':_0x3953('0x10'),'fields':[_0x3953('0xb'),_0x3953('0x11')]},{'unique':!![],'name':_0x3953('0x12'),'fields':[_0x3953('0xb'),_0x3953('0x13')]},{'unique':!![],'name':_0x3953('0x14'),'fields':[_0x3953('0xb'),_0x3953('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x615d=['tools_dispositions','name','ListId','ChatWebsiteId','name_mail','name_sms','SmsAccountId','FaxAccountId','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','exports','define'];(function(_0x5332c9,_0x2d8321){var _0x1eb750=function(_0x1de28c){while(--_0x1de28c){_0x5332c9['push'](_0x5332c9['shift']());}};_0x1eb750(++_0x2d8321);}(_0x615d,0x180));var _0xd615=function(_0x5a7cbc,_0x573d85){_0x5a7cbc=_0x5a7cbc-0x0;var _0x44d2cc=_0x615d[_0x5a7cbc];return _0x44d2cc;};'use strict';var _=require(_0xd615('0x0'));var util=require(_0xd615('0x1'));var logger=require(_0xd615('0x2'))(_0xd615('0x3'));var moment=require(_0xd615('0x4'));var BPromise=require(_0xd615('0x5'));var rp=require(_0xd615('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd615('0x7'));var config=require(_0xd615('0x8'));var attributes=require(_0xd615('0x9'));module[_0xd615('0xa')]=function(_0x2883ea,_0x168df9){return _0x2883ea[_0xd615('0xb')]('Disposition',attributes,{'tableName':_0xd615('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xd615('0xd'),_0xd615('0xe')]},{'unique':!![],'name':'name_chat','fields':['name',_0xd615('0xf')]},{'unique':!![],'name':_0xd615('0x10'),'fields':[_0xd615('0xd'),'MailAccountId']},{'unique':!![],'name':_0xd615('0x11'),'fields':[_0xd615('0xd'),_0xd615('0x12')]},{'unique':!![],'name':'name_fax','fields':[_0xd615('0xd'),_0xd615('0x13')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0xd615('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xd615('0xd'),_0xd615('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 388acfd..6005884 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(_0x446ef4,_0x1c2706){var _0x48db4b=function(_0xde7834){while(--_0xde7834){_0x446ef4['push'](_0x446ef4['shift']());}};_0x48db4b(++_0x1c2706);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x553eba,_0x415437){var _0x499530=function(_0x178bc5){while(--_0x178bc5){_0x553eba['push'](_0x553eba['shift']());}};_0x499530(++_0x415437);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 806be3c..5355ec6 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 _0x9406=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','put'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0x9406,0x75));var _0x6940=function(_0x4f4aae,_0x128fff){_0x4f4aae=_0x4f4aae-0x0;var _0x907cdc=_0x9406[_0x4f4aae];return _0x907cdc;};'use strict';var multer=require(_0x6940('0x0'));var util=require(_0x6940('0x1'));var path=require(_0x6940('0x2'));var timeout=require(_0x6940('0x3'));var express=require(_0x6940('0x4'));var router=express[_0x6940('0x5')]();var fs_extra=require(_0x6940('0x6'));var auth=require(_0x6940('0x7'));var interaction=require(_0x6940('0x8'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x6940('0x9')]('/',auth['isAuthenticated'](),controller[_0x6940('0xa')]);router[_0x6940('0x9')](_0x6940('0xb'),auth[_0x6940('0xc')](),controller[_0x6940('0xd')]);router[_0x6940('0xe')]('/',auth[_0x6940('0xc')](),controller['create']);router[_0x6940('0xf')](_0x6940('0xb'),auth[_0x6940('0xc')](),controller[_0x6940('0x10')]);router[_0x6940('0x11')](_0x6940('0xb'),auth[_0x6940('0xc')](),controller[_0x6940('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb7a9=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2a4300,_0x16244f){var _0x3f1108=function(_0x458de0){while(--_0x458de0){_0x2a4300['push'](_0x2a4300['shift']());}};_0x3f1108(++_0x16244f);}(_0xb7a9,0x110));var _0x9b7a=function(_0x73057e,_0x29956c){_0x73057e=_0x73057e-0x0;var _0x710231=_0xb7a9[_0x73057e];return _0x710231;};'use strict';var multer=require('multer');var util=require(_0x9b7a('0x0'));var path=require(_0x9b7a('0x1'));var timeout=require(_0x9b7a('0x2'));var express=require(_0x9b7a('0x3'));var router=express['Router']();var fs_extra=require(_0x9b7a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9b7a('0x5'));var config=require(_0x9b7a('0x6'));var controller=require(_0x9b7a('0x7'));router[_0x9b7a('0x8')]('/',auth[_0x9b7a('0x9')](),controller[_0x9b7a('0xa')]);router['get'](_0x9b7a('0xb'),auth[_0x9b7a('0x9')](),controller[_0x9b7a('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9b7a('0xd')]);router[_0x9b7a('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x9b7a('0xf')]);router[_0x9b7a('0x10')]('/:id',auth[_0x9b7a('0x9')](),controller[_0x9b7a('0x11')]);module[_0x9b7a('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index d32b7cc..580a54a 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 _0xd8fb=['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','sequelize','exports','STRING','xCALLY\x20Motion\x20Fax','localstationid','ENUM','4800','9600','14400','7200','INTEGER','SIP','IAX','DADHI','KHOMP'];(function(_0x55c2a5,_0x3ab35b){var _0x177d1d=function(_0x130a2b){while(--_0x130a2b){_0x55c2a5['push'](_0x55c2a5['shift']());}};_0x177d1d(++_0x3ab35b);}(_0xd8fb,0x99));var _0xbd8f=function(_0xef824f,_0x34af96){_0xef824f=_0xef824f-0x0;var _0x3e7de7=_0xd8fb[_0xef824f];return _0x3e7de7;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'name':{'type':Sequelize[_0xbd8f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbd8f('0x2')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xbd8f('0x2')],'defaultValue':_0xbd8f('0x3')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xbd8f('0x4')},'minrate':{'type':Sequelize[_0xbd8f('0x5')]('2400',_0xbd8f('0x6'),'7200',_0xbd8f('0x7'),'12000',_0xbd8f('0x8')),'defaultValue':_0xbd8f('0x6')},'maxrate':{'type':Sequelize['ENUM']('2400',_0xbd8f('0x6'),_0xbd8f('0x9'),_0xbd8f('0x7'),'12000',_0xbd8f('0x8')),'defaultValue':_0xbd8f('0x8')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xbd8f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xbd8f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xbd8f('0xa')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xbd8f('0xb'),_0xbd8f('0xc'),_0xbd8f('0xd'),_0xbd8f('0xe')),'defaultValue':_0xbd8f('0xb')},'key':{'type':Sequelize[_0xbd8f('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbd8f('0xf')],'defaultValue':function(){return _0xbd8f('0x10');}},'notificationSound':{'type':Sequelize[_0xbd8f('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbd8f('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xbd8f('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbd8f('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbd8f('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbd8f('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbd8f('0xa')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xbd8f('0x11')],'defaultValue':![],'comment':_0xbd8f('0x12'),'set':function(_0x504adb){if(!_0x504adb)this[_0xbd8f('0x13')](_0xbd8f('0x14'),null);this['setDataValue']('mandatoryDisposition',_0x504adb);}}}; \ No newline at end of file +var _0xfcf0=['9600','14400','v17,v27,v29','SIP','DADHI','KHOMP','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xfcf0,0x138));var _0x0fcf=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xfcf0[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require(_0x0fcf('0x0'));module[_0x0fcf('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0fcf('0x2')]},'ecm':{'type':Sequelize[_0x0fcf('0x3')](_0x0fcf('0x4'),'no'),'defaultValue':_0x0fcf('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x0fcf('0x5')},'localstationid':{'type':Sequelize[_0x0fcf('0x2')],'unique':_0x0fcf('0x6')},'minrate':{'type':Sequelize[_0x0fcf('0x3')](_0x0fcf('0x7'),_0x0fcf('0x8'),_0x0fcf('0x9'),_0x0fcf('0xa'),'12000',_0x0fcf('0xb')),'defaultValue':_0x0fcf('0x8')},'maxrate':{'type':Sequelize[_0x0fcf('0x3')]('2400',_0x0fcf('0x8'),_0x0fcf('0x9'),_0x0fcf('0xa'),'12000',_0x0fcf('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x0fcf('0x2')],'defaultValue':_0x0fcf('0xc')},'gateway':{'type':Sequelize[_0x0fcf('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['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x0fcf('0x3')](_0x0fcf('0xd'),'IAX',_0x0fcf('0xe'),_0x0fcf('0xf')),'defaultValue':_0x0fcf('0xd')},'key':{'type':Sequelize[_0x0fcf('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0fcf('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x0fcf('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0fcf('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0fcf('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0fcf('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0fcf('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0fcf('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0fcf('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x0fcf('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x0fcf('0x11')],'defaultValue':![],'comment':_0x0fcf('0x14'),'set':function(_0x8581bd){if(!_0x8581bd)this[_0x0fcf('0x15')]('mandatoryDispositionPauseId',null);this[_0x0fcf('0x15')](_0x0fcf('0x16'),_0x8581bd);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 6cf7e17..3b33481 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 _0x6cb6=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','Pause','mandatoryDispositionPause','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','options','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','FaxInteraction','addInteraction','omit','CmContact','User','Owner','fullname','internal','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','exten','localstationid','app','system','description','Fax\x20Extension','push','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','tech','createdAt','ListId','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','updatedAt','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','Contacts','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','out','ContactId','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','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','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./faxAccount.socket','register','jayson/promise','client','http','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','info','request\x20sent','result','sendStatus','end','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','get','FaxAccounts','destroy','name','send','index','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes'];(function(_0x2dc8fb,_0x5655ce){var _0x336da0=function(_0x56645d){while(--_0x56645d){_0x2dc8fb['push'](_0x2dc8fb['shift']());}};_0x336da0(++_0x5655ce);}(_0x6cb6,0x7c));var _0x66cb=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x6cb6[_0x279d37];return _0x530173;};'use strict';var emlformat=require(_0x66cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x66cb('0x1'));var jsonpatch=require(_0x66cb('0x2'));var rp=require(_0x66cb('0x3'));var moment=require(_0x66cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x66cb('0x5'));var util=require('util');var path=require(_0x66cb('0x6'));var sox=require('sox');var csv=require(_0x66cb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x66cb('0x8'));var _=require('lodash');var squel=require(_0x66cb('0x9'));var crypto=require(_0x66cb('0xa'));var jsforce=require(_0x66cb('0xb'));var deskjs=require(_0x66cb('0xc'));var toCsv=require(_0x66cb('0x7'));var querystring=require(_0x66cb('0xd'));var Papa=require(_0x66cb('0xe'));var Redis=require(_0x66cb('0xf'));var authService=require(_0x66cb('0x10'));var qs=require(_0x66cb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66cb('0x12'));var logger=require(_0x66cb('0x13'))(_0x66cb('0x14'));var utils=require(_0x66cb('0x15'));var config=require(_0x66cb('0x16'));var licenseUtil=require(_0x66cb('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x66cb('0x18')](config['redis'],{'host':_0x66cb('0x19'),'port':0x18eb});var socket=require(_0x66cb('0x1a'))(new Redis(config[_0x66cb('0x1b')]));require(_0x66cb('0x1c'))[_0x66cb('0x1d')](socket);var jayson=require(_0x66cb('0x1e'));var client=jayson[_0x66cb('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x66cb('0x1f')][_0x66cb('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3f5a8f,_0x4aa029,_0x513ae5,_0x26fe2a){return new BPromise(function(_0x3a1f31,_0x151eed){var _0x3f8a16=_0x26fe2a||client;return _0x3f8a16['request'](_0x3f5a8f,_0x513ae5)['then'](function(_0x532507){logger['info']('FaxAccount,\x20%s,\x20%s',_0x4aa029,'request\x20sent');logger[_0x66cb('0x21')](_0x66cb('0x22'),_0x4aa029,'request\x20sent',JSON['stringify'](_0x532507));if(_0x532507[_0x66cb('0x23')]){if(_0x532507[_0x66cb('0x23')][_0x66cb('0x24')]===0x1f4){logger[_0x66cb('0x23')](_0x66cb('0x25'),_0x4aa029,_0x532507[_0x66cb('0x23')][_0x66cb('0x26')]);return _0x151eed(_0x532507[_0x66cb('0x23')][_0x66cb('0x26')]);}logger[_0x66cb('0x23')](_0x66cb('0x25'),_0x4aa029,_0x532507[_0x66cb('0x23')][_0x66cb('0x26')]);return _0x3a1f31(_0x532507[_0x66cb('0x23')]['message']);}else{logger[_0x66cb('0x27')]('FaxAccount,\x20%s,\x20%s',_0x4aa029,_0x66cb('0x28'));_0x3a1f31(_0x532507[_0x66cb('0x29')][_0x66cb('0x26')]);}})['catch'](function(_0x79bc3c){logger[_0x66cb('0x23')](_0x66cb('0x25'),_0x4aa029,_0x79bc3c);_0x151eed(_0x79bc3c);});});}function respondWithStatusCode(_0x3fc9fe,_0x380712){_0x380712=_0x380712||0xcc;return function(_0x5a37a5){if(_0x5a37a5){return _0x3fc9fe[_0x66cb('0x2a')](_0x380712);}return _0x3fc9fe['status'](_0x380712)[_0x66cb('0x2b')]();};}function respondWithResult(_0xec71b4,_0x45c4a1){_0x45c4a1=_0x45c4a1||0xc8;return function(_0x301662){if(_0x301662){return _0xec71b4[_0x66cb('0x2c')](_0x45c4a1)['json'](_0x301662);}};}function respondWithFilteredResult(_0x51773f,_0x52230c){return function(_0x14a376){if(_0x14a376){var _0x249298=typeof _0x52230c['offset']===_0x66cb('0x2d')&&typeof _0x52230c[_0x66cb('0x2e')]===_0x66cb('0x2d');var _0xf8acae=_0x14a376[_0x66cb('0x2f')];var _0xca0e89=_0x249298?0x0:_0x52230c[_0x66cb('0x30')];var _0x5e4107=_0x249298?_0x14a376[_0x66cb('0x2f')]:_0x52230c[_0x66cb('0x30')]+_0x52230c[_0x66cb('0x2e')];var _0x63014a;if(_0x5e4107>=_0xf8acae){_0x5e4107=_0xf8acae;_0x63014a=0xc8;}else{_0x63014a=0xce;}_0x51773f[_0x66cb('0x2c')](_0x63014a);return _0x51773f['set'](_0x66cb('0x31'),_0xca0e89+'-'+_0x5e4107+'/'+_0xf8acae)[_0x66cb('0x32')](_0x14a376);}return null;};}function patchUpdates(_0x219acf){return function(_0x299529){try{jsonpatch[_0x66cb('0x33')](_0x299529,_0x219acf,!![]);}catch(_0x482009){return BPromise[_0x66cb('0x34')](_0x482009);}return _0x299529[_0x66cb('0x35')]();};}function saveUpdates(_0x822101,_0x4aa46a){return function(_0x572b0a){if(_0x572b0a){return _0x572b0a[_0x66cb('0x36')](_0x822101)[_0x66cb('0x37')](function(_0x5679cc){return _0x5679cc;});}return null;};}function removeEntity(_0x154ba3,_0x3da84a){return function(_0x336ba4){if(_0x336ba4){return _0x336ba4['destroy']()[_0x66cb('0x37')](function(){var _0x502648=_0x336ba4[_0x66cb('0x38')]({'plain':!![]});var _0x27f8a7=_0x66cb('0x39');return db['UserProfileResource'][_0x66cb('0x3a')]({'where':{'type':_0x27f8a7,'resourceId':_0x502648['id']}})['then'](function(){return _0x336ba4;});})[_0x66cb('0x37')](function(){_0x154ba3['status'](0xcc)[_0x66cb('0x2b')]();});}};}function handleEntityNotFound(_0x8fe788,_0x279404){return function(_0x3653a3){if(!_0x3653a3){_0x8fe788[_0x66cb('0x2a')](0x194);}return _0x3653a3;};}function handleError(_0x4514f9,_0x514112){_0x514112=_0x514112||0x1f4;return function(_0x4a2ab6){logger[_0x66cb('0x23')](_0x4a2ab6['stack']);if(_0x4a2ab6[_0x66cb('0x3b')]){delete _0x4a2ab6['name'];}_0x4514f9[_0x66cb('0x2c')](_0x514112)[_0x66cb('0x3c')](_0x4a2ab6);};}exports[_0x66cb('0x3d')]=function(_0x31b7ac,_0x6861c0){var _0x1df3b6={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2e8bee={},_0x2e7bb8={'count':0x0,'rows':[]};var _0x2886e8=_['map'](db[_0x66cb('0x3e')][_0x66cb('0x3f')],function(_0x2eff7a){return{'name':_0x2eff7a[_0x66cb('0x40')],'type':_0x2eff7a[_0x66cb('0x41')][_0x66cb('0x42')]};});_0x2e8bee[_0x66cb('0x43')]=_[_0x66cb('0x44')](_0x2886e8,_0x66cb('0x3b'));_0x2e8bee[_0x66cb('0x45')]=_[_0x66cb('0x46')](_0x31b7ac[_0x66cb('0x45')]);_0x2e8bee[_0x66cb('0x47')]=_[_0x66cb('0x48')](_0x2e8bee['model'],_0x2e8bee['query']);_0x1df3b6[_0x66cb('0x49')]=_[_0x66cb('0x48')](_0x2e8bee[_0x66cb('0x43')],qs[_0x66cb('0x4a')](_0x31b7ac[_0x66cb('0x45')][_0x66cb('0x4a')]));_0x1df3b6[_0x66cb('0x49')]=_0x1df3b6[_0x66cb('0x49')][_0x66cb('0x4b')]?_0x1df3b6[_0x66cb('0x49')]:_0x2e8bee['model'];if(!_0x31b7ac[_0x66cb('0x45')][_0x66cb('0x4c')](_0x66cb('0x4d'))){_0x1df3b6[_0x66cb('0x2e')]=qs[_0x66cb('0x2e')](_0x31b7ac['query'][_0x66cb('0x2e')]);_0x1df3b6['offset']=qs[_0x66cb('0x30')](_0x31b7ac[_0x66cb('0x45')][_0x66cb('0x30')]);}_0x1df3b6[_0x66cb('0x4e')]=qs[_0x66cb('0x4f')](_0x31b7ac['query'][_0x66cb('0x4f')]);_0x1df3b6[_0x66cb('0x50')]=qs[_0x66cb('0x47')](_[_0x66cb('0x51')](_0x31b7ac[_0x66cb('0x45')],_0x2e8bee[_0x66cb('0x47')]),_0x2886e8);if(_0x31b7ac['query'][_0x66cb('0x52')]){_0x1df3b6[_0x66cb('0x50')]=_[_0x66cb('0x53')](_0x1df3b6['where'],{'$or':_[_0x66cb('0x44')](_0x2886e8,function(_0x3ea34d){if(_0x3ea34d[_0x66cb('0x41')]!==_0x66cb('0x54')){var _0x3eef0b={};_0x3eef0b[_0x3ea34d[_0x66cb('0x3b')]]={'$like':'%'+_0x31b7ac[_0x66cb('0x45')][_0x66cb('0x52')]+'%'};return _0x3eef0b;}})});}_0x1df3b6=_[_0x66cb('0x53')]({},_0x1df3b6,_0x31b7ac['options']);var _0x2010de={'where':_0x1df3b6[_0x66cb('0x50')]};return db[_0x66cb('0x3e')][_0x66cb('0x2f')](_0x2010de)[_0x66cb('0x37')](function(_0xe0c528){_0x2e7bb8['count']=_0xe0c528;if(_0x31b7ac[_0x66cb('0x45')][_0x66cb('0x55')]){_0x1df3b6[_0x66cb('0x56')]=[{'all':!![]}];}return db[_0x66cb('0x3e')]['findAll'](_0x1df3b6);})[_0x66cb('0x37')](function(_0x2d31ab){_0x2e7bb8[_0x66cb('0x57')]=_0x2d31ab;return _0x2e7bb8;})[_0x66cb('0x37')](respondWithFilteredResult(_0x6861c0,_0x1df3b6))[_0x66cb('0x58')](handleError(_0x6861c0,null));};exports[_0x66cb('0x59')]=function(_0x548dec,_0x29124b){var _0x40f1b8={'raw':![],'where':{'id':_0x548dec[_0x66cb('0x5a')]['id']},'include':[{'model':db[_0x66cb('0x5b')],'as':_0x66cb('0x5c')}]},_0x5295f6={};_0x5295f6['model']=_[_0x66cb('0x46')](db[_0x66cb('0x3e')][_0x66cb('0x3f')]);_0x5295f6[_0x66cb('0x45')]=_[_0x66cb('0x46')](_0x548dec['query']);_0x5295f6[_0x66cb('0x47')]=_[_0x66cb('0x48')](_0x5295f6[_0x66cb('0x43')],_0x5295f6[_0x66cb('0x45')]);_0x40f1b8[_0x66cb('0x49')]=_[_0x66cb('0x48')](_0x5295f6[_0x66cb('0x43')],qs[_0x66cb('0x4a')](_0x548dec[_0x66cb('0x45')][_0x66cb('0x4a')]));_0x40f1b8[_0x66cb('0x49')]=_0x40f1b8['attributes'][_0x66cb('0x4b')]?_0x40f1b8[_0x66cb('0x49')]:_0x5295f6['model'];if(_0x548dec[_0x66cb('0x45')]['includeAll']){_0x40f1b8[_0x66cb('0x56')]=[{'all':!![]}];}_0x40f1b8=_['merge']({},_0x40f1b8,_0x548dec['options']);return db['FaxAccount'][_0x66cb('0x5d')](_0x40f1b8)[_0x66cb('0x37')](handleEntityNotFound(_0x29124b,null))['then'](respondWithResult(_0x29124b,null))['catch'](handleError(_0x29124b,null));};exports[_0x66cb('0x5e')]=function(_0x1e13f0,_0x3a47b0){return db[_0x66cb('0x3e')]['create'](_0x1e13f0[_0x66cb('0x5f')],{})[_0x66cb('0x37')](function(_0x3c2bd6){var _0x5a6eb8=_0x1e13f0['user'][_0x66cb('0x38')]({'plain':!![]});if(!_0x5a6eb8)throw new Error(_0x66cb('0x60'));if(_0x5a6eb8[_0x66cb('0x61')]===_0x66cb('0x62')){var _0x3f3bc2=_0x3c2bd6[_0x66cb('0x38')]({'plain':!![]});var _0x162f72=_0x66cb('0x39');return db[_0x66cb('0x63')][_0x66cb('0x5d')]({'where':{'name':_0x162f72,'userProfileId':_0x5a6eb8[_0x66cb('0x64')]},'raw':!![]})[_0x66cb('0x37')](function(_0x3a0080){if(_0x3a0080&&_0x3a0080[_0x66cb('0x65')]===0x0){return db[_0x66cb('0x66')][_0x66cb('0x5e')]({'name':_0x3f3bc2['name'],'resourceId':_0x3f3bc2['id'],'type':_0x3a0080[_0x66cb('0x3b')],'sectionId':_0x3a0080['id']},{})[_0x66cb('0x37')](function(){return _0x3c2bd6;});}else{return _0x3c2bd6;}})['catch'](function(_0x62cc7){logger[_0x66cb('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x62cc7);throw _0x62cc7;});}return _0x3c2bd6;})[_0x66cb('0x37')](respondWithResult(_0x3a47b0,0xc9))[_0x66cb('0x58')](handleError(_0x3a47b0,null));};exports[_0x66cb('0x36')]=function(_0x5f23da,_0x42f0c6){if(_0x5f23da[_0x66cb('0x5f')]['id']){delete _0x5f23da['body']['id'];}return db[_0x66cb('0x3e')][_0x66cb('0x5d')]({'where':{'id':_0x5f23da[_0x66cb('0x5a')]['id']},'include':[{'model':db[_0x66cb('0x5b')],'as':'mandatoryDispositionPause'}]})[_0x66cb('0x37')](handleEntityNotFound(_0x42f0c6,null))['then'](saveUpdates(_0x5f23da[_0x66cb('0x5f')],null))[_0x66cb('0x37')](respondWithResult(_0x42f0c6,null))['catch'](handleError(_0x42f0c6,null));};exports[_0x66cb('0x3a')]=function(_0x1404d9,_0x25021a){return db[_0x66cb('0x3e')]['find']({'where':{'id':_0x1404d9[_0x66cb('0x5a')]['id']}})[_0x66cb('0x37')](handleEntityNotFound(_0x25021a,null))[_0x66cb('0x37')](removeEntity(_0x25021a,null))[_0x66cb('0x58')](handleError(_0x25021a,null));};exports[_0x66cb('0x67')]=function(_0x5e9660,_0x38319a){return db[_0x66cb('0x3e')][_0x66cb('0x67')]()[_0x66cb('0x37')](respondWithResult(_0x38319a,null))['catch'](handleError(_0x38319a,null));};exports[_0x66cb('0x68')]=function(_0x54af11,_0x57340c,_0x4c41b0){if(_0x54af11[_0x66cb('0x5f')]['id']){delete _0x54af11[_0x66cb('0x5f')]['id'];}return db[_0x66cb('0x3e')][_0x66cb('0x5d')]({'where':{'id':_0x54af11[_0x66cb('0x5a')]['id']}})[_0x66cb('0x37')](handleEntityNotFound(_0x57340c,null))[_0x66cb('0x37')](function(_0x5615fd){if(_0x5615fd){_0x54af11['body'][_0x66cb('0x69')]=_0x5615fd['id'];return db[_0x66cb('0x6a')][_0x66cb('0x5e')](_0x54af11[_0x66cb('0x5f')]);}})[_0x66cb('0x37')](respondWithResult(_0x57340c,null))['catch'](handleError(_0x57340c,null));};exports[_0x66cb('0x6b')]=function(_0x23f538,_0xa6d8ad,_0x212471){var _0x3f29bc={'raw':![],'where':{}};var _0x5b41bf={};var _0x57c138={'count':0x0,'rows':[]};return db[_0x66cb('0x3e')][_0x66cb('0x6c')]({'where':{'id':_0x23f538[_0x66cb('0x5a')]['id']}})[_0x66cb('0x37')](handleEntityNotFound(_0xa6d8ad,null))[_0x66cb('0x37')](function(_0x3cfbb7){if(_0x3cfbb7){_0x5b41bf[_0x66cb('0x43')]=_[_0x66cb('0x46')](db['Disposition']['rawAttributes']);_0x5b41bf[_0x66cb('0x45')]=_[_0x66cb('0x46')](_0x23f538[_0x66cb('0x45')]);_0x5b41bf[_0x66cb('0x47')]=_[_0x66cb('0x48')](_0x5b41bf[_0x66cb('0x43')],_0x5b41bf['query']);_0x3f29bc['attributes']=_['intersection'](_0x5b41bf[_0x66cb('0x43')],qs[_0x66cb('0x4a')](_0x23f538[_0x66cb('0x45')][_0x66cb('0x4a')]));_0x3f29bc[_0x66cb('0x49')]=_0x3f29bc['attributes'][_0x66cb('0x4b')]?_0x3f29bc[_0x66cb('0x49')]:_0x5b41bf[_0x66cb('0x43')];if(!_0x23f538[_0x66cb('0x45')][_0x66cb('0x4c')](_0x66cb('0x4d'))){_0x3f29bc[_0x66cb('0x2e')]=qs[_0x66cb('0x2e')](_0x23f538[_0x66cb('0x45')][_0x66cb('0x2e')]);_0x3f29bc[_0x66cb('0x30')]=qs[_0x66cb('0x30')](_0x23f538[_0x66cb('0x45')][_0x66cb('0x30')]);}_0x3f29bc[_0x66cb('0x4e')]=qs[_0x66cb('0x4f')](_0x23f538[_0x66cb('0x45')][_0x66cb('0x4f')]);_0x3f29bc[_0x66cb('0x50')]=qs[_0x66cb('0x47')](_['pick'](_0x23f538[_0x66cb('0x45')],_0x5b41bf['filters']));_0x3f29bc[_0x66cb('0x50')][_0x66cb('0x69')]=_0x3cfbb7['id'];if(_0x23f538['query'][_0x66cb('0x52')]){_0x3f29bc[_0x66cb('0x50')]=_[_0x66cb('0x53')](_0x3f29bc[_0x66cb('0x50')],{'$or':_['map'](_0x3f29bc[_0x66cb('0x49')],function(_0x41f963){var _0x4b50df={};_0x4b50df[_0x41f963]={'$like':'%'+_0x23f538[_0x66cb('0x45')][_0x66cb('0x52')]+'%'};return _0x4b50df;})});}_0x3f29bc=_[_0x66cb('0x53')]({},_0x3f29bc,_0x23f538[_0x66cb('0x6d')]);return db['Disposition'][_0x66cb('0x2f')]({'where':_0x3f29bc[_0x66cb('0x50')]})['then'](function(_0x410ce9){_0x57c138[_0x66cb('0x2f')]=_0x410ce9;if(_0x23f538[_0x66cb('0x45')][_0x66cb('0x55')]){_0x3f29bc[_0x66cb('0x56')]=[{'all':!![]}];}return db[_0x66cb('0x6a')][_0x66cb('0x6e')](_0x3f29bc);})['then'](function(_0x5a0ec7){_0x57c138[_0x66cb('0x57')]=_0x5a0ec7;return _0x57c138;});}})[_0x66cb('0x37')](respondWithFilteredResult(_0xa6d8ad,_0x3f29bc))[_0x66cb('0x58')](handleError(_0xa6d8ad,null));};exports['removeDispositions']=function(_0x3d691d,_0x55e5b2,_0x11000c){return db[_0x66cb('0x3e')][_0x66cb('0x5d')]({'where':{'id':_0x3d691d[_0x66cb('0x5a')]['id']}})[_0x66cb('0x37')](handleEntityNotFound(_0x55e5b2,null))[_0x66cb('0x37')](function(_0x29a1f2){if(_0x29a1f2){return _0x29a1f2[_0x66cb('0x6f')](_0x3d691d[_0x66cb('0x45')][_0x66cb('0x70')]);}})['then'](respondWithStatusCode(_0x55e5b2,null))['catch'](handleError(_0x55e5b2,null));};exports[_0x66cb('0x71')]=function(_0x5c993f,_0x32c7bb,_0x4e724f){if(_0x5c993f[_0x66cb('0x5f')]['id']){delete _0x5c993f[_0x66cb('0x5f')]['id'];}return db['FaxAccount'][_0x66cb('0x5d')]({'where':{'id':_0x5c993f[_0x66cb('0x5a')]['id']}})[_0x66cb('0x37')](handleEntityNotFound(_0x32c7bb,null))[_0x66cb('0x37')](function(_0x1c0a8d){if(_0x1c0a8d){_0x5c993f[_0x66cb('0x5f')][_0x66cb('0x69')]=_0x1c0a8d['id'];return db['CannedAnswer'][_0x66cb('0x5e')](_0x5c993f['body']);}})[_0x66cb('0x37')](respondWithResult(_0x32c7bb,null))['catch'](handleError(_0x32c7bb,null));};exports[_0x66cb('0x72')]=function(_0x3b9fd1,_0x29730b,_0x5a905d){var _0x27ea8c={'raw':![],'where':{}};var _0x46a81f={};var _0x30f5e5={'count':0x0,'rows':[]};return db[_0x66cb('0x3e')][_0x66cb('0x6c')]({'where':{'id':_0x3b9fd1[_0x66cb('0x5a')]['id']}})[_0x66cb('0x37')](handleEntityNotFound(_0x29730b,null))['then'](function(_0x258699){if(_0x258699){_0x46a81f['model']=_[_0x66cb('0x46')](db[_0x66cb('0x73')][_0x66cb('0x3f')]);_0x46a81f[_0x66cb('0x45')]=_[_0x66cb('0x46')](_0x3b9fd1['query']);_0x46a81f['filters']=_['intersection'](_0x46a81f[_0x66cb('0x43')],_0x46a81f[_0x66cb('0x45')]);_0x27ea8c[_0x66cb('0x49')]=_[_0x66cb('0x48')](_0x46a81f[_0x66cb('0x43')],qs[_0x66cb('0x4a')](_0x3b9fd1[_0x66cb('0x45')]['fields']));_0x27ea8c[_0x66cb('0x49')]=_0x27ea8c[_0x66cb('0x49')][_0x66cb('0x4b')]?_0x27ea8c[_0x66cb('0x49')]:_0x46a81f[_0x66cb('0x43')];if(!_0x3b9fd1['query']['hasOwnProperty'](_0x66cb('0x4d'))){_0x27ea8c[_0x66cb('0x2e')]=qs[_0x66cb('0x2e')](_0x3b9fd1[_0x66cb('0x45')][_0x66cb('0x2e')]);_0x27ea8c[_0x66cb('0x30')]=qs[_0x66cb('0x30')](_0x3b9fd1[_0x66cb('0x45')]['offset']);}_0x27ea8c[_0x66cb('0x4e')]=qs['sort'](_0x3b9fd1[_0x66cb('0x45')][_0x66cb('0x4f')]);_0x27ea8c[_0x66cb('0x50')]=qs[_0x66cb('0x47')](_[_0x66cb('0x51')](_0x3b9fd1['query'],_0x46a81f['filters']));_0x27ea8c['where'][_0x66cb('0x69')]=_0x258699['id'];if(_0x3b9fd1[_0x66cb('0x45')]['filter']){_0x27ea8c[_0x66cb('0x50')]=_[_0x66cb('0x53')](_0x27ea8c[_0x66cb('0x50')],{'$or':_[_0x66cb('0x44')](_0x27ea8c[_0x66cb('0x49')],function(_0x432721){var _0x4bcad5={};_0x4bcad5[_0x432721]={'$like':'%'+_0x3b9fd1['query'][_0x66cb('0x52')]+'%'};return _0x4bcad5;})});}_0x27ea8c=_['merge']({},_0x27ea8c,_0x3b9fd1[_0x66cb('0x6d')]);return db[_0x66cb('0x73')][_0x66cb('0x2f')]({'where':_0x27ea8c[_0x66cb('0x50')]})[_0x66cb('0x37')](function(_0x46de87){_0x30f5e5[_0x66cb('0x2f')]=_0x46de87;if(_0x3b9fd1[_0x66cb('0x45')][_0x66cb('0x55')]){_0x27ea8c[_0x66cb('0x56')]=[{'all':!![]}];}return db[_0x66cb('0x73')]['findAll'](_0x27ea8c);})[_0x66cb('0x37')](function(_0x2e7b12){_0x30f5e5['rows']=_0x2e7b12;return _0x30f5e5;});}})[_0x66cb('0x37')](respondWithFilteredResult(_0x29730b,_0x27ea8c))[_0x66cb('0x58')](handleError(_0x29730b,null));};exports[_0x66cb('0x74')]=function(_0x574bee,_0x456c71,_0x32fb98){return db[_0x66cb('0x3e')][_0x66cb('0x5d')]({'where':{'id':_0x574bee[_0x66cb('0x5a')]['id']}})['then'](handleEntityNotFound(_0x456c71,null))[_0x66cb('0x37')](function(_0x25f27d){if(_0x25f27d){return _0x25f27d[_0x66cb('0x74')](_0x574bee[_0x66cb('0x45')][_0x66cb('0x70')]);}})[_0x66cb('0x37')](respondWithStatusCode(_0x456c71,null))[_0x66cb('0x58')](handleError(_0x456c71,null));};exports['addInteraction']=function(_0x535543,_0x29c3f8,_0x3ca2c7){return db[_0x66cb('0x75')][_0x66cb('0x5d')]({'where':{'id':_0x535543['params']['id']}})[_0x66cb('0x37')](handleEntityNotFound(_0x29c3f8,null))[_0x66cb('0x37')](function(_0x42852f){if(_0x42852f){return _0x42852f[_0x66cb('0x76')](_0x535543[_0x66cb('0x5f')][_0x66cb('0x70')],_[_0x66cb('0x77')](_0x535543[_0x66cb('0x5f')],['ids','id'])||{});}})['then'](respondWithResult(_0x29c3f8,null))[_0x66cb('0x58')](handleError(_0x29c3f8,null));};exports['getInteractions']=function(_0x4a5a20,_0x3fbc47,_0x21e838){var _0x35c8a2={'raw':![],'where':{}};var _0xb37681={};var _0x17cf88={'count':0x0,'rows':[]};return db['FaxAccount'][_0x66cb('0x6c')]({'where':{'id':_0x4a5a20[_0x66cb('0x5a')]['id']}})[_0x66cb('0x37')](handleEntityNotFound(_0x3fbc47,null))['then'](function(_0x250535){if(_0x250535){_0xb37681[_0x66cb('0x43')]=_[_0x66cb('0x46')](db[_0x66cb('0x75')][_0x66cb('0x3f')]);_0xb37681[_0x66cb('0x45')]=_[_0x66cb('0x46')](_0x4a5a20['query']);_0xb37681[_0x66cb('0x47')]=_[_0x66cb('0x48')](_0xb37681[_0x66cb('0x43')],_0xb37681[_0x66cb('0x45')]);_0x35c8a2[_0x66cb('0x49')]=_['intersection'](_0xb37681[_0x66cb('0x43')],qs[_0x66cb('0x4a')](_0x4a5a20['query'][_0x66cb('0x4a')]));_0x35c8a2[_0x66cb('0x49')]=_0x35c8a2[_0x66cb('0x49')][_0x66cb('0x4b')]?_0x35c8a2[_0x66cb('0x49')]:_0xb37681[_0x66cb('0x43')];if(!_0x4a5a20[_0x66cb('0x45')][_0x66cb('0x4c')]('nolimit')){_0x35c8a2[_0x66cb('0x2e')]=qs[_0x66cb('0x2e')](_0x4a5a20[_0x66cb('0x45')][_0x66cb('0x2e')]);_0x35c8a2[_0x66cb('0x30')]=qs['offset'](_0x4a5a20['query'][_0x66cb('0x30')]);}_0x35c8a2[_0x66cb('0x4e')]=qs[_0x66cb('0x4f')](_0x4a5a20[_0x66cb('0x45')][_0x66cb('0x4f')]);_0x35c8a2['where']=qs[_0x66cb('0x47')](_[_0x66cb('0x51')](_0x4a5a20[_0x66cb('0x45')],_0xb37681[_0x66cb('0x47')]));_0x35c8a2[_0x66cb('0x50')][_0x66cb('0x69')]=_0x250535['id'];if(_0x4a5a20[_0x66cb('0x45')][_0x66cb('0x52')]){_0x35c8a2[_0x66cb('0x50')]=_[_0x66cb('0x53')](_0x35c8a2['where'],{'$or':_['map'](_0x35c8a2['attributes'],function(_0x20d28c){var _0x25e35a={};_0x25e35a[_0x20d28c]={'$like':'%'+_0x4a5a20[_0x66cb('0x45')]['filter']+'%'};return _0x25e35a;})});}_0x35c8a2=_['merge']({},_0x35c8a2,_0x4a5a20[_0x66cb('0x6d')]);return db[_0x66cb('0x75')][_0x66cb('0x2f')]({'where':_0x35c8a2[_0x66cb('0x50')]})['then'](function(_0x4f56fa){_0x17cf88[_0x66cb('0x2f')]=_0x4f56fa;if(_0x4a5a20['query'][_0x66cb('0x55')]){_0x35c8a2[_0x66cb('0x56')]=[{'model':db[_0x66cb('0x78')],'as':'Contact','required':![]},{'model':db[_0x66cb('0x79')],'as':_0x66cb('0x7a'),'attributes':[_0x66cb('0x3b'),_0x66cb('0x7b'),_0x66cb('0x7c')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x66cb('0x3b'),_0x66cb('0x7d')],'where':_0x4a5a20[_0x66cb('0x45')]['tag']?{'id':_0x4a5a20[_0x66cb('0x45')][_0x66cb('0x7e')]}:undefined,'required':_0x4a5a20[_0x66cb('0x45')][_0x66cb('0x7e')]?!![]:![]}];}return db[_0x66cb('0x75')]['findAll'](_0x35c8a2);})[_0x66cb('0x37')](function(_0x4970c4){_0x17cf88[_0x66cb('0x57')]=_0x4970c4;return _0x17cf88;});}})[_0x66cb('0x37')](respondWithFilteredResult(_0x3fbc47,_0x35c8a2))[_0x66cb('0x58')](handleError(_0x3fbc47,null));};exports[_0x66cb('0x7f')]=function(_0x51559a,_0x58abdb){var _0x468875=_0x51559a['params']['id'];var _0x5e729a=_0x51559a[_0x66cb('0x5f')];var _0x2c371c=0xc8;var _0x21d6f6=null;return db[_0x66cb('0x80')][_0x66cb('0x81')]({'isolationLevel':db['sequelize'][_0x66cb('0x82')][_0x66cb('0x83')][_0x66cb('0x84')]},function(_0x128461){return db[_0x66cb('0x3e')]['findOne']({'where':{'id':_0x468875},'transaction':_0x128461})[_0x66cb('0x37')](function(_0x4c6ecf){if(_0x4c6ecf){return db[_0x66cb('0x85')][_0x66cb('0x3a')]({'where':{'FaxAccountId':_0x468875},'transaction':_0x128461})['then'](function(){var _0xc4e4ad=_[_0x66cb('0x44')](_0x5e729a,function(_0x35157b){_0x35157b['FaxAccountId']=_0x468875;return _0x35157b;});return db['FaxApplication'][_0x66cb('0x86')](_0xc4e4ad,{'transaction':_0x128461});});}else{_0x2c371c=0x194;_0x21d6f6=[];}});})[_0x66cb('0x37')](function(){if(_0x2c371c!==0x194){return db[_0x66cb('0x85')][_0x66cb('0x87')]({'where':{'FaxAccountId':_0x468875},'order':_0x66cb('0x88')})['then'](function(_0x5f2e8f){_0x21d6f6=_0x5f2e8f;});}})[_0x66cb('0x58')](function(_0x55967c){_0x2c371c=0x1f4;logger[_0x66cb('0x23')](_0x55967c['stack']);if(_0x55967c[_0x66cb('0x3b')]){delete _0x55967c[_0x66cb('0x3b')];}_0x21d6f6=_0x55967c;})[_0x66cb('0x89')](function(){if(_0x21d6f6===null){_0x58abdb[_0x66cb('0x2a')](_0x2c371c);}else{if(_0x2c371c===0x1f4){_0x58abdb[_0x66cb('0x2c')](_0x2c371c)[_0x66cb('0x3c')](_0x21d6f6);}else{_0x58abdb['status'](_0x2c371c)['json'](_0x21d6f6);}}});};exports[_0x66cb('0x8a')]=function(_0x3f5fae,_0x1cbaba,_0x2b4826){var _0x35ad1f={};var _0x38e0c6={};var _0x13c7b6;var _0x3ef6c9;return db[_0x66cb('0x3e')][_0x66cb('0x6c')]({'where':{'id':_0x3f5fae['params']['id']}})[_0x66cb('0x37')](handleEntityNotFound(_0x1cbaba,null))[_0x66cb('0x37')](function(_0x596b6a){if(_0x596b6a){_0x13c7b6=_0x596b6a;_0x38e0c6[_0x66cb('0x43')]=_[_0x66cb('0x46')](db[_0x66cb('0x85')][_0x66cb('0x3f')]);_0x38e0c6[_0x66cb('0x45')]=_[_0x66cb('0x46')](_0x3f5fae[_0x66cb('0x45')]);_0x38e0c6[_0x66cb('0x47')]=_['intersection'](_0x38e0c6[_0x66cb('0x43')],_0x38e0c6[_0x66cb('0x45')]);_0x35ad1f[_0x66cb('0x49')]=_[_0x66cb('0x48')](_0x38e0c6['model'],qs[_0x66cb('0x4a')](_0x3f5fae[_0x66cb('0x45')][_0x66cb('0x4a')]));_0x35ad1f[_0x66cb('0x49')]=_0x35ad1f['attributes'][_0x66cb('0x4b')]?_0x35ad1f[_0x66cb('0x49')]:_0x38e0c6[_0x66cb('0x43')];_0x35ad1f[_0x66cb('0x4e')]=qs[_0x66cb('0x4f')](_0x3f5fae['query'][_0x66cb('0x4f')]);_0x35ad1f[_0x66cb('0x50')]=qs['filters'](_['pick'](_0x3f5fae['query'],_0x38e0c6[_0x66cb('0x47')]));if(_0x3f5fae['query'][_0x66cb('0x52')]){_0x35ad1f[_0x66cb('0x50')]=_[_0x66cb('0x53')](_0x35ad1f[_0x66cb('0x50')],{'$or':_['map'](_0x35ad1f[_0x66cb('0x49')],function(_0x15b18e){var _0x477536={};_0x477536[_0x15b18e]={'$like':'%'+_0x3f5fae[_0x66cb('0x45')]['filter']+'%'};return _0x477536;})});}_0x35ad1f=_['merge']({},_0x35ad1f,_0x3f5fae[_0x66cb('0x6d')]);return _0x13c7b6[_0x66cb('0x8a')](_0x35ad1f);}})[_0x66cb('0x37')](function(_0x52609c){if(_0x52609c){_0x3ef6c9=_0x52609c[_0x66cb('0x4b')];if(!_0x3f5fae['query'][_0x66cb('0x4c')](_0x66cb('0x4d'))){_0x35ad1f[_0x66cb('0x2e')]=qs[_0x66cb('0x2e')](_0x3f5fae[_0x66cb('0x45')][_0x66cb('0x2e')]);_0x35ad1f['offset']=qs[_0x66cb('0x30')](_0x3f5fae[_0x66cb('0x45')][_0x66cb('0x30')]);}return _0x13c7b6[_0x66cb('0x8a')](_0x35ad1f);}})[_0x66cb('0x37')](function(_0x2dfb91){if(_0x2dfb91){return _0x2dfb91?{'count':_0x3ef6c9,'rows':_0x2dfb91}:null;}})[_0x66cb('0x37')](respondWithResult(_0x1cbaba,null))['catch'](handleError(_0x1cbaba,null));};function Extension(_0x34fafc,_0x3a4d11,_0x3e629d,_0x3f446a){this[_0x66cb('0x8b')]='from-voip-provider';this[_0x66cb('0x8c')]=_0x34fafc[_0x66cb('0x8d')];this[_0x66cb('0x8e')]=_0x3f446a;this[_0x66cb('0x41')]=_0x66cb('0x8f');this[_0x66cb('0x90')]=_0x66cb('0x91');this[_0x66cb('0x69')]=_0x34fafc['id'];this[_0x66cb('0x88')]=_0x3a4d11;this['appdata']=_0x3e629d;}function createExtensionsReciveFax(_0x31a13f){var _0x3a203c=0x1;var _0x4673f4=[];_0x4673f4[_0x66cb('0x92')](new Extension(_0x31a13f,_0x3a203c,'','Answer'));_0x3a203c+=0x1;_0x4673f4[_0x66cb('0x92')](new Extension(_0x31a13f,_0x3a203c,'CDR(type)=inbound-fax',_0x66cb('0x93')));_0x3a203c+=0x1;for(var _0x463236 in _0x31a13f){if(_0x31a13f[_0x66cb('0x4c')](_0x463236)&&(_0x463236===_0x66cb('0x94')||_0x463236==='localstationid'||_0x463236===_0x66cb('0x95')||_0x463236===_0x66cb('0x96')||_0x463236===_0x66cb('0x97')||_0x463236===_0x66cb('0x98')||_0x463236===_0x66cb('0x99')||_0x463236===_0x66cb('0x9a')||_0x463236===_0x66cb('0x9b'))){_0x4673f4[_0x66cb('0x92')](new Extension(_0x31a13f,_0x3a203c,'FAXOPT('+_0x463236+')='+_0x31a13f[_0x463236],_0x66cb('0x93')));_0x3a203c+=0x1;}}_0x4673f4[_0x66cb('0x92')](new Extension(_0x31a13f,_0x3a203c,'6',_0x66cb('0x9c')));_0x3a203c+=0x1;_0x4673f4['push'](new Extension(_0x31a13f,_0x3a203c,_0x66cb('0x9d'),_0x66cb('0x9e')));_0x3a203c=0x0;return _0x4673f4;}exports[_0x66cb('0x9f')]=function(_0x113a33,_0x32faf4,_0x555c47){var _0x52a0f8;return db[_0x66cb('0x80')][_0x66cb('0x81')](function(_0x47e35c){return db[_0x66cb('0x3e')]['create'](_0x113a33['body'],{'transaction':_0x47e35c})['then'](function(_0x18e9cf){_0x52a0f8=_0x18e9cf[_0x66cb('0x38')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x52a0f8),{'transaction':_0x47e35c});});})[_0x66cb('0x37')](function(){return _0x52a0f8;})['then'](respondWithResult(_0x32faf4,null))['catch'](handleError(_0x32faf4,null));};exports[_0x66cb('0xa0')]=function(_0x13046a,_0x4f55c7,_0x38e488){var _0x392b06;return db[_0x66cb('0x80')][_0x66cb('0x81')](function(_0x5434d9){return db['FaxAccount'][_0x66cb('0x36')](_0x13046a[_0x66cb('0x5f')],{'where':{'id':_0x13046a['body']['id']},'transaction':_0x5434d9})[_0x66cb('0x37')](function(_0x36382f){return db[_0x66cb('0xa1')]['destroy']({'where':{'FaxAccountId':_0x13046a[_0x66cb('0x5f')]['id']},'transaction':_0x5434d9})[_0x66cb('0x37')](function(_0x1014af){return db[_0x66cb('0xa1')]['bulkCreate'](createExtensionsReciveFax(_[_0x66cb('0x77')](_0x13046a[_0x66cb('0x5f')],[_0x66cb('0xa2'),'key',_0x66cb('0xa3'),'updatedAt','TrunkId',_0x66cb('0xa4')])),{'transaction':_0x5434d9});});});})['then'](function(){return db[_0x66cb('0x3e')]['findById'](_0x13046a['body']['id']);})['then'](respondWithResult(_0x4f55c7,null))[_0x66cb('0x58')](handleError(_0x4f55c7,null));};exports['getMessages']=function(_0x4c4494,_0x4e439b,_0x5bfe52){var _0x665f7e={'raw':!![],'where':{}};var _0x441782={};var _0x554605={'count':0x0,'rows':[]};return db[_0x66cb('0x3e')][_0x66cb('0x6c')]({'where':{'id':_0x4c4494[_0x66cb('0x5a')]['id']}})[_0x66cb('0x37')](handleEntityNotFound(_0x4e439b,null))[_0x66cb('0x37')](function(_0x4d1c93){if(_0x4d1c93){_0x441782['model']=_[_0x66cb('0x46')](db[_0x66cb('0xa5')][_0x66cb('0x3f')]);_0x441782[_0x66cb('0x45')]=_[_0x66cb('0x46')](_0x4c4494['query']);_0x441782[_0x66cb('0x47')]=_[_0x66cb('0x48')](_0x441782[_0x66cb('0x43')],_0x441782[_0x66cb('0x45')]);_0x665f7e[_0x66cb('0x49')]=_['intersection'](_0x441782[_0x66cb('0x43')],qs[_0x66cb('0x4a')](_0x4c4494[_0x66cb('0x45')][_0x66cb('0x4a')]));_0x665f7e[_0x66cb('0x49')]=_0x665f7e['attributes'][_0x66cb('0x4b')]?_0x665f7e[_0x66cb('0x49')]:_0x441782[_0x66cb('0x43')];if(!_0x4c4494[_0x66cb('0x45')]['hasOwnProperty']('nolimit')){_0x665f7e[_0x66cb('0x2e')]=qs['limit'](_0x4c4494['query'][_0x66cb('0x2e')]);_0x665f7e[_0x66cb('0x30')]=qs[_0x66cb('0x30')](_0x4c4494['query'][_0x66cb('0x30')]);}_0x665f7e[_0x66cb('0x4e')]=qs[_0x66cb('0x4f')](_0x4c4494['query'][_0x66cb('0x4f')]);_0x665f7e['where']=qs[_0x66cb('0x47')](_[_0x66cb('0x51')](_0x4c4494['query'],_0x441782[_0x66cb('0x47')]));_0x665f7e[_0x66cb('0x50')]['FaxAccountId']=_0x4d1c93['id'];if(_0x4c4494['query']['filter']){_0x665f7e[_0x66cb('0x50')]=_[_0x66cb('0x53')](_0x665f7e[_0x66cb('0x50')],{'$or':_['map'](_0x665f7e[_0x66cb('0x49')],function(_0x10f06e){var _0x2c75ef={};_0x2c75ef[_0x10f06e]={'$like':'%'+_0x4c4494['query']['filter']+'%'};return _0x2c75ef;})});}if(_0x4c4494[_0x66cb('0x45')][_0x66cb('0xa6')]){var _0x2a5e8f=_0x4c4494[_0x66cb('0x45')][_0x66cb('0xa6')][_0x66cb('0xa7')](',');var _0x13ecda={};_0x13ecda[_0x2a5e8f[0x0]]={'$gte':moment(_0x2a5e8f[0x1])[_0x66cb('0xa8')](_0x66cb('0xa9'))};_0x665f7e[_0x66cb('0x50')]=_['merge'](_0x665f7e['where'],_0x13ecda);}_0x665f7e=_[_0x66cb('0x53')]({},_0x665f7e,_0x4c4494['options']);return db[_0x66cb('0xa5')][_0x66cb('0x2f')]({'where':_0x665f7e[_0x66cb('0x50')]})['then'](function(_0x303215){_0x554605[_0x66cb('0x2f')]=_0x303215;if(_0x4c4494[_0x66cb('0x45')]['includeAll']){_0x665f7e[_0x66cb('0x56')]=[{'all':!![]}];}return db[_0x66cb('0xa5')][_0x66cb('0x6e')](_0x665f7e);})[_0x66cb('0x37')](function(_0xccb881){_0x554605[_0x66cb('0x57')]=_0xccb881;return _0x554605;});}})['then'](respondWithFilteredResult(_0x4e439b,_0x665f7e))['catch'](handleError(_0x4e439b,null));};exports[_0x66cb('0x3c')]=function(_0xc12190,_0x52d14b,_0x3c36c0){var _0x264334,_0x4c0ece={},_0x537065;if(_0xc12190[_0x66cb('0x5f')]['to']){_0x537065=_0xc12190['body']['to'][0x0];}return db['FaxAccount'][_0x66cb('0x5d')]({'where':{'id':_0xc12190['params']['id']},'include':[{'model':db[_0x66cb('0xaa')],'as':_0x66cb('0xab'),'include':[{'model':db[_0x66cb('0x78')],'as':'Contacts','where':{'fax':_0x537065},'limit':0x1,'order':[[_0x66cb('0xac'),'DESC']]}]}]})[_0x66cb('0x37')](handleEntityNotFound(_0x52d14b,null))['then'](function(_0xcc6a99){_0x264334=_0xcc6a99;if(_0xc12190['body'][_0x66cb('0xad')]&&_0xc12190['body'][_0x66cb('0xad')]['length']){for(var _0x5a724d=0x0;_0x5a724d<_0xc12190[_0x66cb('0x5f')][_0x66cb('0xad')][_0x66cb('0x4b')];_0x5a724d+=0x1){_0xc12190['body'][_0x66cb('0xad')][_0x5a724d]={'filename':_0xc12190[_0x66cb('0x5f')][_0x66cb('0xad')][_0x5a724d][_0x66cb('0x3b')],'id':_0xc12190[_0x66cb('0x5f')][_0x66cb('0xad')][_0x5a724d]['id'],'path':path[_0x66cb('0xae')](config[_0x66cb('0xaf')],_0x66cb('0xb0'),_0xc12190[_0x66cb('0x5f')][_0x66cb('0xad')][_0x5a724d][_0x66cb('0xb1')])};}}return respondWithRpcPromise('CheckAfterSend',_0x66cb('0xb2'),{'FaxAccountId':_['isNil'](_0xc12190[_0x66cb('0x5a')]['id'])?undefined:_0xc12190['params']['id'],'path':_[_0x66cb('0xb3')](_0xc12190[_0x66cb('0x5f')][_0x66cb('0xad')][0x0][_0x66cb('0x6')])?undefined:_0xc12190[_0x66cb('0x5f')][_0x66cb('0xad')][0x0][_0x66cb('0x6')],'fax':_[_0x66cb('0xb3')](_0xc12190['body']['to'][0x0])?undefined:_0xc12190[_0x66cb('0x5f')]['to'][0x0]},client9002);})[_0x66cb('0x37')](function(){if(_0x264334){if(_[_0x66cb('0xb3')](_0xc12190[_0x66cb('0x5f')][_0x66cb('0xb4')])){_0xc12190[_0x66cb('0x5f')][_0x66cb('0xb4')]=util[_0x66cb('0xa8')](_0x66cb('0xb5'),_0x264334[_0x66cb('0x3b')],_0x264334['fax']);}if(_0x264334[_0x66cb('0xab')]){if(_0x264334[_0x66cb('0xab')][_0x66cb('0xb6')][_0x66cb('0x4b')]){return _0x264334[_0x66cb('0xab')][_0x66cb('0xb6')][0x0];}else{return db[_0x66cb('0x78')][_0x66cb('0x5e')](_[_0x66cb('0x18')](_0xc12190[_0x66cb('0x5f')],{'firstName':_0xc12190[_0x66cb('0x5f')]['to'][0x0],'phone':_0xc12190[_0x66cb('0x5f')]['to'][0x0],'fax':_0xc12190[_0x66cb('0x5f')]['to'][0x0],'ListId':_0x264334[_0x66cb('0xa4')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x66cb('0xb7'));}})[_0x66cb('0x37')](function(_0x375752){if(_0x375752){return db[_0x66cb('0x75')][_0x66cb('0x5d')]({'where':{'ContactId':_0x375752['id'],'closed':![],'FaxAccountId':_0x264334['id']}})[_0x66cb('0x37')](function(_0x4906de){if(_0x4906de){return[_0x4906de,![]];}return db[_0x66cb('0x75')]['create']({'UserId':_0xc12190['user']['id'],'ContactId':_0x375752['id'],'FaxAccountId':_0x264334['id'],'fax':_0xc12190['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0xc12190[_0x66cb('0x5f')],{'read':![],'body':_0xc12190['body'][_0x66cb('0xad')][0x0][_0x66cb('0xb8')],'FaxAccountId':_0x264334['id'],'UserId':_0xc12190[_0x66cb('0x62')]['id'],'ContactId':_0x375752['id'],'AttachmentId':_0xc12190[_0x66cb('0x5f')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x66cb('0xb9')}]})['then'](function(_0x425358){return[_0x425358,!![]];});});}else{throw new Error(_0x66cb('0xba'));}})['spread'](function(_0x43545e,_0x223c14){if(_0x223c14){return _0x43545e;}return db[_0x66cb('0xa5')]['create']({'direction':_0x66cb('0xbb'),'read':![],'body':_0xc12190[_0x66cb('0x5f')]['attachments'][0x0][_0x66cb('0xb8')],'FaxAccountId':_0x264334['id'],'FaxInteractionId':_0x43545e['id'],'UserId':_0xc12190[_0x66cb('0x62')]['id'],'ContactId':_0x43545e[_0x66cb('0xbc')],'AttachmentId':_0xc12190[_0x66cb('0x5f')][_0x66cb('0xad')][0x0]['id']})[_0x66cb('0x37')](function(_0x4cceb1){_0x43545e['dataValues'][_0x66cb('0xb9')]=[];_0x43545e['dataValues'][_0x66cb('0xb9')][_0x66cb('0x92')](_0x4cceb1['dataValues']);return _0x43545e;});})[_0x66cb('0x37')](function(_0x418748){respondWithRpcPromise('SendFax',_0x66cb('0xbd'),{'FaxAccountId':_[_0x66cb('0xb3')](_0xc12190[_0x66cb('0x5a')]['id'])?undefined:_0xc12190[_0x66cb('0x5a')]['id'],'path':_[_0x66cb('0xb3')](_0xc12190['body'][_0x66cb('0xad')][0x0][_0x66cb('0x6')])?undefined:_0xc12190['body'][_0x66cb('0xad')][0x0][_0x66cb('0x6')],'fax':_[_0x66cb('0xb3')](_0xc12190[_0x66cb('0x5f')]['to'][0x0])?undefined:_0xc12190[_0x66cb('0x5f')]['to'][0x0],'AttachmentId':_0xc12190['body'][_0x66cb('0xad')][0x0]['id']},client9002)[_0x66cb('0x37')](function(_0x3243f4){logger[_0x66cb('0x27')]('SendFaxRpc,\x20%s',_0x3243f4);})[_0x66cb('0x58')](function(_0x31b999){logger[_0x66cb('0x27')](_0x66cb('0xbe'),_0x31b999);});return _0x418748;})['then'](respondWithResult(_0x52d14b,null))[_0x66cb('0x58')](handleError(_0x52d14b,null));};exports[_0x66cb('0xbf')]=function(_0x2f78d8,_0x554a6e,_0x4e3534){return db[_0x66cb('0x3e')][_0x66cb('0x5d')]({'where':{'id':_0x2f78d8['params']['id']}})[_0x66cb('0x37')](handleEntityNotFound(_0x554a6e,null))[_0x66cb('0x37')](function(_0x57c394){if(_0x57c394){return _0x57c394[_0x66cb('0xbf')](_0x2f78d8[_0x66cb('0x5f')]['ids'],_[_0x66cb('0x77')](_0x2f78d8[_0x66cb('0x5f')],['ids','id'])||{})[_0x66cb('0xc0')](function(_0x170f65){for(var _0x5d7989=0x0;_0x5d7989<_0x2f78d8[_0x66cb('0x5f')][_0x66cb('0x70')]['length'];_0x5d7989+=0x1){socket[_0x66cb('0xc1')]('userFaxAccount:save',{'UserId':Number(_0x2f78d8[_0x66cb('0x5f')][_0x66cb('0x70')][_0x5d7989]),'FaxAccountId':Number(_0x2f78d8[_0x66cb('0x5a')]['id'])});}return _0x170f65;});}})[_0x66cb('0x37')](respondWithResult(_0x554a6e,null))[_0x66cb('0x58')](handleError(_0x554a6e,null));};exports['removeAgents']=function(_0x2710d7,_0x7db1d2,_0x3f210e){return db['FaxAccount'][_0x66cb('0x5d')]({'where':{'id':_0x2710d7[_0x66cb('0x5a')]['id']}})[_0x66cb('0x37')](handleEntityNotFound(_0x7db1d2,null))[_0x66cb('0x37')](function(_0x1581ae){if(_0x1581ae){return _0x1581ae[_0x66cb('0xc2')](_0x2710d7[_0x66cb('0x45')]['ids'])[_0x66cb('0x37')](function(){if(_[_0x66cb('0xc3')](_0x2710d7[_0x66cb('0x45')][_0x66cb('0x70')])){for(var _0xc1982e=0x0;_0xc1982e<_0x2710d7['query'][_0x66cb('0x70')][_0x66cb('0x4b')];_0xc1982e+=0x1){socket[_0x66cb('0xc1')](_0x66cb('0xc4'),{'UserId':Number(_0x2710d7[_0x66cb('0x45')][_0x66cb('0x70')][_0xc1982e]),'FaxAccountId':Number(_0x2710d7[_0x66cb('0x5a')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x2710d7[_0x66cb('0x45')]['ids']),'FaxAccountId':Number(_0x2710d7['params']['id'])});}});}})['then'](respondWithStatusCode(_0x7db1d2,null))[_0x66cb('0x58')](handleError(_0x7db1d2,null));};exports['getAgents']=function(_0x50bb99,_0x4922cd,_0x2b0f8e){var _0x4518c3={};var _0x5bf555={};var _0x5bb161;var _0x313fa9;return db['FaxAccount'][_0x66cb('0x6c')]({'where':{'id':_0x50bb99[_0x66cb('0x5a')]['id']}})[_0x66cb('0x37')](handleEntityNotFound(_0x4922cd,null))[_0x66cb('0x37')](function(_0x430353){if(_0x430353){_0x5bb161=_0x430353;_0x5bf555[_0x66cb('0x43')]=_[_0x66cb('0x46')](db[_0x66cb('0x79')][_0x66cb('0x3f')]);_0x5bf555[_0x66cb('0x45')]=_[_0x66cb('0x46')](_0x50bb99[_0x66cb('0x45')]);_0x5bf555[_0x66cb('0x47')]=_['intersection'](_0x5bf555[_0x66cb('0x43')],_0x5bf555[_0x66cb('0x45')]);_0x4518c3['attributes']=_['intersection'](_0x5bf555[_0x66cb('0x43')],qs[_0x66cb('0x4a')](_0x50bb99[_0x66cb('0x45')][_0x66cb('0x4a')]));_0x4518c3[_0x66cb('0x49')]=_0x4518c3[_0x66cb('0x49')][_0x66cb('0x4b')]?_0x4518c3[_0x66cb('0x49')]:_0x5bf555['model'];_0x4518c3[_0x66cb('0x4e')]=qs[_0x66cb('0x4f')](_0x50bb99[_0x66cb('0x45')]['sort']);_0x4518c3[_0x66cb('0x50')]=qs[_0x66cb('0x47')](_['pick'](_0x50bb99[_0x66cb('0x45')],_0x5bf555[_0x66cb('0x47')]));if(_0x50bb99[_0x66cb('0x45')]['filter']){_0x4518c3['where']=_['merge'](_0x4518c3[_0x66cb('0x50')],{'$or':_[_0x66cb('0x44')](_0x4518c3[_0x66cb('0x49')],function(_0x297954){var _0xa6cdad={};_0xa6cdad[_0x297954]={'$like':'%'+_0x50bb99[_0x66cb('0x45')]['filter']+'%'};return _0xa6cdad;})});}_0x4518c3=_[_0x66cb('0x53')]({},_0x4518c3,_0x50bb99[_0x66cb('0x6d')]);return _0x5bb161['getAgents'](_0x4518c3);}})[_0x66cb('0x37')](function(_0xc05fb2){if(_0xc05fb2){_0x313fa9=_0xc05fb2[_0x66cb('0x4b')];if(!_0x50bb99[_0x66cb('0x45')][_0x66cb('0x4c')]('nolimit')){_0x4518c3[_0x66cb('0x2e')]=qs[_0x66cb('0x2e')](_0x50bb99['query']['limit']);_0x4518c3[_0x66cb('0x30')]=qs[_0x66cb('0x30')](_0x50bb99[_0x66cb('0x45')]['offset']);}return _0x5bb161[_0x66cb('0xc5')](_0x4518c3);}})[_0x66cb('0x37')](function(_0x54f87f){if(_0x54f87f){return _0x54f87f?{'count':_0x313fa9,'rows':_0x54f87f}:null;}})['then'](respondWithResult(_0x4922cd,null))[_0x66cb('0x58')](handleError(_0x4922cd,null));}; \ No newline at end of file +var _0x13e0=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','findAll','rows','removeDispositions','addAnswer','CannedAnswer','includeAll','removeAnswers','ids','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','stack','finally','getApplications','from-voip-provider','localstationid','app','system','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','updateAccountApplications','tech','key','createdAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','root','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','FaxAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','map','filter','options','include','catch','Pause','keys','length','merge','find'];(function(_0x56b734,_0x4b8243){var _0x164be7=function(_0x6028d7){while(--_0x6028d7){_0x56b734['push'](_0x56b734['shift']());}};_0x164be7(++_0x4b8243);}(_0x13e0,0x131));var _0x013e=function(_0x3df85f,_0x37c170){_0x3df85f=_0x3df85f-0x0;var _0x2543c8=_0x13e0[_0x3df85f];return _0x2543c8;};'use strict';var emlformat=require(_0x013e('0x0'));var rimraf=require(_0x013e('0x1'));var zipdir=require(_0x013e('0x2'));var jsonpatch=require(_0x013e('0x3'));var rp=require('request-promise');var moment=require(_0x013e('0x4'));var BPromise=require(_0x013e('0x5'));var Mustache=require(_0x013e('0x6'));var util=require(_0x013e('0x7'));var path=require(_0x013e('0x8'));var sox=require('sox');var csv=require(_0x013e('0x9'));var ejs=require(_0x013e('0xa'));var fs=require('fs');var fs_extra=require(_0x013e('0xb'));var _=require(_0x013e('0xc'));var squel=require(_0x013e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x013e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x013e('0xf'));var Papa=require(_0x013e('0x10'));var Redis=require('ioredis');var authService=require(_0x013e('0x11'));var qs=require(_0x013e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x013e('0x13'));var logger=require(_0x013e('0x14'))('api');var utils=require(_0x013e('0x15'));var config=require(_0x013e('0x16'));var licenseUtil=require(_0x013e('0x17'));var db=require(_0x013e('0x18'))['db'];config[_0x013e('0x19')]=_[_0x013e('0x1a')](config[_0x013e('0x19')],{'host':_0x013e('0x1b'),'port':0x18eb});var socket=require(_0x013e('0x1c'))(new Redis(config[_0x013e('0x19')]));require('./faxAccount.socket')[_0x013e('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x013e('0x1e')][_0x013e('0x1f')]({'port':0x232c});var client9002=jayson[_0x013e('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53fc34,_0x5ab2fe,_0x1603e8,_0x49ce91){return new BPromise(function(_0x4347d3,_0x2ac5b3){var _0x4163ba=_0x49ce91||client;return _0x4163ba['request'](_0x53fc34,_0x1603e8)[_0x013e('0x20')](function(_0x22eb26){logger[_0x013e('0x21')](_0x013e('0x22'),_0x5ab2fe,_0x013e('0x23'));logger[_0x013e('0x24')](_0x013e('0x25'),_0x5ab2fe,_0x013e('0x23'),JSON['stringify'](_0x22eb26));if(_0x22eb26[_0x013e('0x26')]){if(_0x22eb26[_0x013e('0x26')][_0x013e('0x27')]===0x1f4){logger[_0x013e('0x26')](_0x013e('0x22'),_0x5ab2fe,_0x22eb26[_0x013e('0x26')][_0x013e('0x28')]);return _0x2ac5b3(_0x22eb26[_0x013e('0x26')][_0x013e('0x28')]);}logger[_0x013e('0x26')](_0x013e('0x22'),_0x5ab2fe,_0x22eb26['error']['message']);return _0x4347d3(_0x22eb26[_0x013e('0x26')][_0x013e('0x28')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x5ab2fe,_0x013e('0x23'));_0x4347d3(_0x22eb26[_0x013e('0x29')][_0x013e('0x28')]);}})['catch'](function(_0x25bb7c){logger[_0x013e('0x26')](_0x013e('0x22'),_0x5ab2fe,_0x25bb7c);_0x2ac5b3(_0x25bb7c);});});}function respondWithStatusCode(_0x341c8f,_0x63a5cd){_0x63a5cd=_0x63a5cd||0xcc;return function(_0x4e5906){if(_0x4e5906){return _0x341c8f['sendStatus'](_0x63a5cd);}return _0x341c8f[_0x013e('0x2a')](_0x63a5cd)[_0x013e('0x2b')]();};}function respondWithResult(_0x2a3bb5,_0x25721a){_0x25721a=_0x25721a||0xc8;return function(_0x315841){if(_0x315841){return _0x2a3bb5[_0x013e('0x2a')](_0x25721a)[_0x013e('0x2c')](_0x315841);}};}function respondWithFilteredResult(_0x22003f,_0x1d4920){return function(_0x52caa5){if(_0x52caa5){var _0x4d2840=typeof _0x1d4920[_0x013e('0x2d')]===_0x013e('0x2e')&&typeof _0x1d4920[_0x013e('0x2f')]===_0x013e('0x2e');var _0xa73452=_0x52caa5[_0x013e('0x30')];var _0x575e82=_0x4d2840?0x0:_0x1d4920[_0x013e('0x2d')];var _0x3368c2=_0x4d2840?_0x52caa5[_0x013e('0x30')]:_0x1d4920[_0x013e('0x2d')]+_0x1d4920[_0x013e('0x2f')];var _0x493649;if(_0x3368c2>=_0xa73452){_0x3368c2=_0xa73452;_0x493649=0xc8;}else{_0x493649=0xce;}_0x22003f[_0x013e('0x2a')](_0x493649);return _0x22003f[_0x013e('0x31')](_0x013e('0x32'),_0x575e82+'-'+_0x3368c2+'/'+_0xa73452)[_0x013e('0x2c')](_0x52caa5);}return null;};}function patchUpdates(_0x16f039){return function(_0x2cca72){try{jsonpatch[_0x013e('0x33')](_0x2cca72,_0x16f039,!![]);}catch(_0x3f4c95){return BPromise[_0x013e('0x34')](_0x3f4c95);}return _0x2cca72['save']();};}function saveUpdates(_0x42e433,_0x4ae543){return function(_0x4c8ba6){if(_0x4c8ba6){return _0x4c8ba6[_0x013e('0x35')](_0x42e433)[_0x013e('0x20')](function(_0x5a432e){return _0x5a432e;});}return null;};}function removeEntity(_0x370735,_0x5ced79){return function(_0x375dcd){if(_0x375dcd){return _0x375dcd[_0x013e('0x36')]()[_0x013e('0x20')](function(){var _0x1af7d3=_0x375dcd['get']({'plain':!![]});var _0x5f3acb=_0x013e('0x37');return db[_0x013e('0x38')][_0x013e('0x36')]({'where':{'type':_0x5f3acb,'resourceId':_0x1af7d3['id']}})[_0x013e('0x20')](function(){return _0x375dcd;});})[_0x013e('0x20')](function(){_0x370735[_0x013e('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b9150,_0x3c170f){return function(_0x72933){if(!_0x72933){_0x3b9150['sendStatus'](0x194);}return _0x72933;};}function handleError(_0x5a5988,_0x4cabf5){_0x4cabf5=_0x4cabf5||0x1f4;return function(_0x1c81ae){logger[_0x013e('0x26')](_0x1c81ae['stack']);if(_0x1c81ae[_0x013e('0x39')]){delete _0x1c81ae[_0x013e('0x39')];}_0x5a5988[_0x013e('0x2a')](_0x4cabf5)[_0x013e('0x3a')](_0x1c81ae);};}exports[_0x013e('0x3b')]=function(_0x3e61be,_0x3c17c6){var _0x11fa38={'include':[{'model':db['Pause'],'as':_0x013e('0x3c')}]},_0x54e981={},_0x3ccb63={'count':0x0,'rows':[]};var _0x5690ca=_['map'](db[_0x013e('0x3d')][_0x013e('0x3e')],function(_0x45f3d2){return{'name':_0x45f3d2[_0x013e('0x3f')],'type':_0x45f3d2[_0x013e('0x40')]['key']};});_0x54e981[_0x013e('0x41')]=_['map'](_0x5690ca,_0x013e('0x39'));_0x54e981[_0x013e('0x42')]=_['keys'](_0x3e61be[_0x013e('0x42')]);_0x54e981[_0x013e('0x43')]=_[_0x013e('0x44')](_0x54e981[_0x013e('0x41')],_0x54e981[_0x013e('0x42')]);_0x11fa38[_0x013e('0x45')]=_[_0x013e('0x44')](_0x54e981[_0x013e('0x41')],qs[_0x013e('0x46')](_0x3e61be['query'][_0x013e('0x46')]));_0x11fa38['attributes']=_0x11fa38['attributes']['length']?_0x11fa38['attributes']:_0x54e981['model'];if(!_0x3e61be[_0x013e('0x42')][_0x013e('0x47')](_0x013e('0x48'))){_0x11fa38['limit']=qs[_0x013e('0x2f')](_0x3e61be['query'][_0x013e('0x2f')]);_0x11fa38[_0x013e('0x2d')]=qs[_0x013e('0x2d')](_0x3e61be['query']['offset']);}_0x11fa38[_0x013e('0x49')]=qs['sort'](_0x3e61be[_0x013e('0x42')][_0x013e('0x4a')]);_0x11fa38[_0x013e('0x4b')]=qs['filters'](_[_0x013e('0x4c')](_0x3e61be[_0x013e('0x42')],_0x54e981[_0x013e('0x43')]),_0x5690ca);if(_0x3e61be[_0x013e('0x42')]['filter']){_0x11fa38['where']=_['merge'](_0x11fa38['where'],{'$or':_[_0x013e('0x4d')](_0x5690ca,function(_0x2d6eac){if(_0x2d6eac['type']!=='VIRTUAL'){var _0x4987f9={};_0x4987f9[_0x2d6eac['name']]={'$like':'%'+_0x3e61be[_0x013e('0x42')][_0x013e('0x4e')]+'%'};return _0x4987f9;}})});}_0x11fa38=_['merge']({},_0x11fa38,_0x3e61be[_0x013e('0x4f')]);var _0x4f8c26={'where':_0x11fa38[_0x013e('0x4b')]};return db[_0x013e('0x3d')]['count'](_0x4f8c26)[_0x013e('0x20')](function(_0x717e43){_0x3ccb63[_0x013e('0x30')]=_0x717e43;if(_0x3e61be[_0x013e('0x42')]['includeAll']){_0x11fa38[_0x013e('0x50')]=[{'all':!![]}];}return db[_0x013e('0x3d')]['findAll'](_0x11fa38);})['then'](function(_0x5c2757){_0x3ccb63['rows']=_0x5c2757;return _0x3ccb63;})[_0x013e('0x20')](respondWithFilteredResult(_0x3c17c6,_0x11fa38))[_0x013e('0x51')](handleError(_0x3c17c6,null));};exports['show']=function(_0x17d6b5,_0x3b5199){var _0xd276e6={'raw':![],'where':{'id':_0x17d6b5['params']['id']},'include':[{'model':db[_0x013e('0x52')],'as':_0x013e('0x3c')}]},_0x1ce6ff={};_0x1ce6ff[_0x013e('0x41')]=_[_0x013e('0x53')](db['FaxAccount']['rawAttributes']);_0x1ce6ff[_0x013e('0x42')]=_[_0x013e('0x53')](_0x17d6b5[_0x013e('0x42')]);_0x1ce6ff[_0x013e('0x43')]=_[_0x013e('0x44')](_0x1ce6ff['model'],_0x1ce6ff[_0x013e('0x42')]);_0xd276e6[_0x013e('0x45')]=_['intersection'](_0x1ce6ff[_0x013e('0x41')],qs[_0x013e('0x46')](_0x17d6b5[_0x013e('0x42')][_0x013e('0x46')]));_0xd276e6[_0x013e('0x45')]=_0xd276e6['attributes'][_0x013e('0x54')]?_0xd276e6[_0x013e('0x45')]:_0x1ce6ff[_0x013e('0x41')];if(_0x17d6b5[_0x013e('0x42')]['includeAll']){_0xd276e6[_0x013e('0x50')]=[{'all':!![]}];}_0xd276e6=_[_0x013e('0x55')]({},_0xd276e6,_0x17d6b5[_0x013e('0x4f')]);return db[_0x013e('0x3d')][_0x013e('0x56')](_0xd276e6)[_0x013e('0x20')](handleEntityNotFound(_0x3b5199,null))['then'](respondWithResult(_0x3b5199,null))[_0x013e('0x51')](handleError(_0x3b5199,null));};exports[_0x013e('0x57')]=function(_0x4a9d7d,_0x2e33aa){return db[_0x013e('0x3d')][_0x013e('0x57')](_0x4a9d7d[_0x013e('0x58')],{})[_0x013e('0x20')](function(_0x1ccb22){var _0x112345=_0x4a9d7d[_0x013e('0x59')]['get']({'plain':!![]});if(!_0x112345)throw new Error(_0x013e('0x5a'));if(_0x112345[_0x013e('0x5b')]===_0x013e('0x59')){var _0x26339d=_0x1ccb22[_0x013e('0x5c')]({'plain':!![]});var _0x4c86f6=_0x013e('0x37');return db[_0x013e('0x5d')]['find']({'where':{'name':_0x4c86f6,'userProfileId':_0x112345[_0x013e('0x5e')]},'raw':!![]})[_0x013e('0x20')](function(_0xc9a454){if(_0xc9a454&&_0xc9a454[_0x013e('0x5f')]===0x0){return db[_0x013e('0x38')]['create']({'name':_0x26339d[_0x013e('0x39')],'resourceId':_0x26339d['id'],'type':_0xc9a454['name'],'sectionId':_0xc9a454['id']},{})[_0x013e('0x20')](function(){return _0x1ccb22;});}else{return _0x1ccb22;}})[_0x013e('0x51')](function(_0x2872a0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2872a0);throw _0x2872a0;});}return _0x1ccb22;})[_0x013e('0x20')](respondWithResult(_0x2e33aa,0xc9))[_0x013e('0x51')](handleError(_0x2e33aa,null));};exports['update']=function(_0x362600,_0x443142){if(_0x362600[_0x013e('0x58')]['id']){delete _0x362600[_0x013e('0x58')]['id'];}return db[_0x013e('0x3d')]['find']({'where':{'id':_0x362600[_0x013e('0x60')]['id']},'include':[{'model':db[_0x013e('0x52')],'as':_0x013e('0x3c')}]})['then'](handleEntityNotFound(_0x443142,null))[_0x013e('0x20')](saveUpdates(_0x362600[_0x013e('0x58')],null))[_0x013e('0x20')](respondWithResult(_0x443142,null))[_0x013e('0x51')](handleError(_0x443142,null));};exports[_0x013e('0x36')]=function(_0x3f23da,_0x1f4f9a){return db['FaxAccount'][_0x013e('0x56')]({'where':{'id':_0x3f23da[_0x013e('0x60')]['id']}})[_0x013e('0x20')](handleEntityNotFound(_0x1f4f9a,null))[_0x013e('0x20')](removeEntity(_0x1f4f9a,null))[_0x013e('0x51')](handleError(_0x1f4f9a,null));};exports[_0x013e('0x61')]=function(_0x366206,_0x3054e6){return db[_0x013e('0x3d')][_0x013e('0x61')]()[_0x013e('0x20')](respondWithResult(_0x3054e6,null))[_0x013e('0x51')](handleError(_0x3054e6,null));};exports[_0x013e('0x62')]=function(_0x57abf7,_0x1df010,_0x271201){if(_0x57abf7[_0x013e('0x58')]['id']){delete _0x57abf7[_0x013e('0x58')]['id'];}return db[_0x013e('0x3d')][_0x013e('0x56')]({'where':{'id':_0x57abf7[_0x013e('0x60')]['id']}})['then'](handleEntityNotFound(_0x1df010,null))[_0x013e('0x20')](function(_0x13c1aa){if(_0x13c1aa){_0x57abf7[_0x013e('0x58')][_0x013e('0x63')]=_0x13c1aa['id'];return db[_0x013e('0x64')][_0x013e('0x57')](_0x57abf7[_0x013e('0x58')]);}})[_0x013e('0x20')](respondWithResult(_0x1df010,null))['catch'](handleError(_0x1df010,null));};exports[_0x013e('0x65')]=function(_0x358e71,_0x3d05c9,_0x226dce){var _0x4db595={'raw':![],'where':{}};var _0x4e4345={};var _0x3e7dca={'count':0x0,'rows':[]};return db[_0x013e('0x3d')][_0x013e('0x66')]({'where':{'id':_0x358e71[_0x013e('0x60')]['id']}})[_0x013e('0x20')](handleEntityNotFound(_0x3d05c9,null))[_0x013e('0x20')](function(_0x5b8d55){if(_0x5b8d55){_0x4e4345[_0x013e('0x41')]=_[_0x013e('0x53')](db['Disposition'][_0x013e('0x3e')]);_0x4e4345[_0x013e('0x42')]=_[_0x013e('0x53')](_0x358e71[_0x013e('0x42')]);_0x4e4345[_0x013e('0x43')]=_[_0x013e('0x44')](_0x4e4345[_0x013e('0x41')],_0x4e4345[_0x013e('0x42')]);_0x4db595[_0x013e('0x45')]=_[_0x013e('0x44')](_0x4e4345[_0x013e('0x41')],qs[_0x013e('0x46')](_0x358e71[_0x013e('0x42')][_0x013e('0x46')]));_0x4db595[_0x013e('0x45')]=_0x4db595[_0x013e('0x45')][_0x013e('0x54')]?_0x4db595['attributes']:_0x4e4345[_0x013e('0x41')];if(!_0x358e71[_0x013e('0x42')]['hasOwnProperty'](_0x013e('0x48'))){_0x4db595['limit']=qs[_0x013e('0x2f')](_0x358e71['query'][_0x013e('0x2f')]);_0x4db595[_0x013e('0x2d')]=qs[_0x013e('0x2d')](_0x358e71[_0x013e('0x42')][_0x013e('0x2d')]);}_0x4db595[_0x013e('0x49')]=qs['sort'](_0x358e71[_0x013e('0x42')]['sort']);_0x4db595[_0x013e('0x4b')]=qs[_0x013e('0x43')](_[_0x013e('0x4c')](_0x358e71['query'],_0x4e4345['filters']));_0x4db595['where'][_0x013e('0x63')]=_0x5b8d55['id'];if(_0x358e71[_0x013e('0x42')][_0x013e('0x4e')]){_0x4db595[_0x013e('0x4b')]=_[_0x013e('0x55')](_0x4db595['where'],{'$or':_[_0x013e('0x4d')](_0x4db595['attributes'],function(_0x43d04b){var _0x359bd6={};_0x359bd6[_0x43d04b]={'$like':'%'+_0x358e71['query']['filter']+'%'};return _0x359bd6;})});}_0x4db595=_[_0x013e('0x55')]({},_0x4db595,_0x358e71[_0x013e('0x4f')]);return db['Disposition'][_0x013e('0x30')]({'where':_0x4db595[_0x013e('0x4b')]})[_0x013e('0x20')](function(_0x45c6d4){_0x3e7dca[_0x013e('0x30')]=_0x45c6d4;if(_0x358e71['query']['includeAll']){_0x4db595[_0x013e('0x50')]=[{'all':!![]}];}return db[_0x013e('0x64')][_0x013e('0x67')](_0x4db595);})[_0x013e('0x20')](function(_0x3499c8){_0x3e7dca[_0x013e('0x68')]=_0x3499c8;return _0x3e7dca;});}})[_0x013e('0x20')](respondWithFilteredResult(_0x3d05c9,_0x4db595))['catch'](handleError(_0x3d05c9,null));};exports[_0x013e('0x69')]=function(_0x3f986f,_0x3c7ad3,_0x19b9d2){return db[_0x013e('0x3d')][_0x013e('0x56')]({'where':{'id':_0x3f986f['params']['id']}})[_0x013e('0x20')](handleEntityNotFound(_0x3c7ad3,null))[_0x013e('0x20')](function(_0x24ed83){if(_0x24ed83){return _0x24ed83['removeDispositions'](_0x3f986f['query']['ids']);}})['then'](respondWithStatusCode(_0x3c7ad3,null))[_0x013e('0x51')](handleError(_0x3c7ad3,null));};exports[_0x013e('0x6a')]=function(_0x43b5ce,_0x3680c4,_0xe55674){if(_0x43b5ce[_0x013e('0x58')]['id']){delete _0x43b5ce[_0x013e('0x58')]['id'];}return db['FaxAccount'][_0x013e('0x56')]({'where':{'id':_0x43b5ce['params']['id']}})[_0x013e('0x20')](handleEntityNotFound(_0x3680c4,null))[_0x013e('0x20')](function(_0x25b935){if(_0x25b935){_0x43b5ce[_0x013e('0x58')][_0x013e('0x63')]=_0x25b935['id'];return db[_0x013e('0x6b')][_0x013e('0x57')](_0x43b5ce[_0x013e('0x58')]);}})[_0x013e('0x20')](respondWithResult(_0x3680c4,null))[_0x013e('0x51')](handleError(_0x3680c4,null));};exports['getAnswers']=function(_0x8a415c,_0x1ee064,_0x24ba75){var _0x49114b={'raw':![],'where':{}};var _0x150263={};var _0x1c989a={'count':0x0,'rows':[]};return db[_0x013e('0x3d')]['findOne']({'where':{'id':_0x8a415c['params']['id']}})['then'](handleEntityNotFound(_0x1ee064,null))['then'](function(_0x1eb6e6){if(_0x1eb6e6){_0x150263[_0x013e('0x41')]=_[_0x013e('0x53')](db[_0x013e('0x6b')][_0x013e('0x3e')]);_0x150263[_0x013e('0x42')]=_['keys'](_0x8a415c[_0x013e('0x42')]);_0x150263[_0x013e('0x43')]=_[_0x013e('0x44')](_0x150263[_0x013e('0x41')],_0x150263[_0x013e('0x42')]);_0x49114b['attributes']=_[_0x013e('0x44')](_0x150263[_0x013e('0x41')],qs[_0x013e('0x46')](_0x8a415c['query']['fields']));_0x49114b[_0x013e('0x45')]=_0x49114b[_0x013e('0x45')][_0x013e('0x54')]?_0x49114b[_0x013e('0x45')]:_0x150263[_0x013e('0x41')];if(!_0x8a415c[_0x013e('0x42')][_0x013e('0x47')](_0x013e('0x48'))){_0x49114b['limit']=qs[_0x013e('0x2f')](_0x8a415c['query'][_0x013e('0x2f')]);_0x49114b[_0x013e('0x2d')]=qs['offset'](_0x8a415c[_0x013e('0x42')]['offset']);}_0x49114b[_0x013e('0x49')]=qs['sort'](_0x8a415c['query']['sort']);_0x49114b['where']=qs['filters'](_[_0x013e('0x4c')](_0x8a415c[_0x013e('0x42')],_0x150263[_0x013e('0x43')]));_0x49114b[_0x013e('0x4b')][_0x013e('0x63')]=_0x1eb6e6['id'];if(_0x8a415c[_0x013e('0x42')]['filter']){_0x49114b[_0x013e('0x4b')]=_[_0x013e('0x55')](_0x49114b['where'],{'$or':_['map'](_0x49114b['attributes'],function(_0x148829){var _0x11a8b4={};_0x11a8b4[_0x148829]={'$like':'%'+_0x8a415c[_0x013e('0x42')][_0x013e('0x4e')]+'%'};return _0x11a8b4;})});}_0x49114b=_[_0x013e('0x55')]({},_0x49114b,_0x8a415c[_0x013e('0x4f')]);return db[_0x013e('0x6b')][_0x013e('0x30')]({'where':_0x49114b[_0x013e('0x4b')]})[_0x013e('0x20')](function(_0x569668){_0x1c989a[_0x013e('0x30')]=_0x569668;if(_0x8a415c['query'][_0x013e('0x6c')]){_0x49114b[_0x013e('0x50')]=[{'all':!![]}];}return db[_0x013e('0x6b')][_0x013e('0x67')](_0x49114b);})['then'](function(_0x82d4dc){_0x1c989a[_0x013e('0x68')]=_0x82d4dc;return _0x1c989a;});}})['then'](respondWithFilteredResult(_0x1ee064,_0x49114b))[_0x013e('0x51')](handleError(_0x1ee064,null));};exports[_0x013e('0x6d')]=function(_0x566cbc,_0x2aee76,_0x2944d5){return db[_0x013e('0x3d')][_0x013e('0x56')]({'where':{'id':_0x566cbc[_0x013e('0x60')]['id']}})[_0x013e('0x20')](handleEntityNotFound(_0x2aee76,null))[_0x013e('0x20')](function(_0x1f4ebf){if(_0x1f4ebf){return _0x1f4ebf[_0x013e('0x6d')](_0x566cbc[_0x013e('0x42')][_0x013e('0x6e')]);}})[_0x013e('0x20')](respondWithStatusCode(_0x2aee76,null))[_0x013e('0x51')](handleError(_0x2aee76,null));};exports[_0x013e('0x6f')]=function(_0x5407f6,_0x2992c0,_0x34d784){return db['FaxInteraction'][_0x013e('0x56')]({'where':{'id':_0x5407f6['params']['id']}})['then'](handleEntityNotFound(_0x2992c0,null))['then'](function(_0x492757){if(_0x492757){return _0x492757[_0x013e('0x6f')](_0x5407f6[_0x013e('0x58')][_0x013e('0x6e')],_[_0x013e('0x70')](_0x5407f6[_0x013e('0x58')],[_0x013e('0x6e'),'id'])||{});}})[_0x013e('0x20')](respondWithResult(_0x2992c0,null))[_0x013e('0x51')](handleError(_0x2992c0,null));};exports[_0x013e('0x71')]=function(_0x496ee6,_0x15a22a,_0x16a98d){var _0x276784={'raw':![],'where':{}};var _0x1e6828={};var _0x4aaffb={'count':0x0,'rows':[]};return db[_0x013e('0x3d')][_0x013e('0x66')]({'where':{'id':_0x496ee6['params']['id']}})[_0x013e('0x20')](handleEntityNotFound(_0x15a22a,null))[_0x013e('0x20')](function(_0x56da41){if(_0x56da41){_0x1e6828['model']=_[_0x013e('0x53')](db[_0x013e('0x72')][_0x013e('0x3e')]);_0x1e6828[_0x013e('0x42')]=_['keys'](_0x496ee6[_0x013e('0x42')]);_0x1e6828['filters']=_['intersection'](_0x1e6828[_0x013e('0x41')],_0x1e6828[_0x013e('0x42')]);_0x276784[_0x013e('0x45')]=_['intersection'](_0x1e6828['model'],qs[_0x013e('0x46')](_0x496ee6[_0x013e('0x42')][_0x013e('0x46')]));_0x276784[_0x013e('0x45')]=_0x276784[_0x013e('0x45')][_0x013e('0x54')]?_0x276784[_0x013e('0x45')]:_0x1e6828['model'];if(!_0x496ee6[_0x013e('0x42')][_0x013e('0x47')](_0x013e('0x48'))){_0x276784[_0x013e('0x2f')]=qs[_0x013e('0x2f')](_0x496ee6['query'][_0x013e('0x2f')]);_0x276784[_0x013e('0x2d')]=qs['offset'](_0x496ee6['query'][_0x013e('0x2d')]);}_0x276784['order']=qs['sort'](_0x496ee6[_0x013e('0x42')][_0x013e('0x4a')]);_0x276784[_0x013e('0x4b')]=qs[_0x013e('0x43')](_['pick'](_0x496ee6['query'],_0x1e6828[_0x013e('0x43')]));_0x276784[_0x013e('0x4b')][_0x013e('0x63')]=_0x56da41['id'];if(_0x496ee6[_0x013e('0x42')][_0x013e('0x4e')]){_0x276784[_0x013e('0x4b')]=_[_0x013e('0x55')](_0x276784[_0x013e('0x4b')],{'$or':_[_0x013e('0x4d')](_0x276784[_0x013e('0x45')],function(_0x2bcece){var _0x3b1b1e={};_0x3b1b1e[_0x2bcece]={'$like':'%'+_0x496ee6[_0x013e('0x42')][_0x013e('0x4e')]+'%'};return _0x3b1b1e;})});}_0x276784=_['merge']({},_0x276784,_0x496ee6[_0x013e('0x4f')]);return db[_0x013e('0x72')][_0x013e('0x30')]({'where':_0x276784[_0x013e('0x4b')]})[_0x013e('0x20')](function(_0x19e115){_0x4aaffb[_0x013e('0x30')]=_0x19e115;if(_0x496ee6[_0x013e('0x42')][_0x013e('0x6c')]){_0x276784[_0x013e('0x50')]=[{'model':db[_0x013e('0x73')],'as':_0x013e('0x74'),'required':![]},{'model':db[_0x013e('0x75')],'as':_0x013e('0x76'),'attributes':[_0x013e('0x39'),_0x013e('0x77'),_0x013e('0x78')],'required':![]},{'model':db[_0x013e('0x79')],'as':'Tags','attributes':['id','name','color'],'where':_0x496ee6[_0x013e('0x42')][_0x013e('0x7a')]?{'id':_0x496ee6[_0x013e('0x42')][_0x013e('0x7a')]}:undefined,'required':_0x496ee6['query'][_0x013e('0x7a')]?!![]:![]}];}return db[_0x013e('0x72')][_0x013e('0x67')](_0x276784);})[_0x013e('0x20')](function(_0x53d4bb){_0x4aaffb[_0x013e('0x68')]=_0x53d4bb;return _0x4aaffb;});}})[_0x013e('0x20')](respondWithFilteredResult(_0x15a22a,_0x276784))[_0x013e('0x51')](handleError(_0x15a22a,null));};exports[_0x013e('0x7b')]=function(_0x37df7b,_0x3a1f8b){var _0x575a44=_0x37df7b[_0x013e('0x60')]['id'];var _0x42b16e=_0x37df7b['body'];var _0x26d4af=0xc8;var _0x425489=null;return db[_0x013e('0x7c')][_0x013e('0x7d')]({'isolationLevel':db[_0x013e('0x7c')]['Transaction'][_0x013e('0x7e')][_0x013e('0x7f')]},function(_0x3cb4c0){return db[_0x013e('0x3d')]['findOne']({'where':{'id':_0x575a44},'transaction':_0x3cb4c0})[_0x013e('0x20')](function(_0x31a909){if(_0x31a909){return db['FaxApplication'][_0x013e('0x36')]({'where':{'FaxAccountId':_0x575a44},'transaction':_0x3cb4c0})[_0x013e('0x20')](function(){var _0x316c40=_[_0x013e('0x4d')](_0x42b16e,function(_0x5ce1ad){_0x5ce1ad[_0x013e('0x63')]=_0x575a44;return _0x5ce1ad;});return db[_0x013e('0x80')][_0x013e('0x81')](_0x316c40,{'transaction':_0x3cb4c0});});}else{_0x26d4af=0x194;_0x425489=[];}});})['then'](function(){if(_0x26d4af!==0x194){return db[_0x013e('0x80')]['findAndCountAll']({'where':{'FaxAccountId':_0x575a44},'order':_0x013e('0x82')})[_0x013e('0x20')](function(_0x3cb91c){_0x425489=_0x3cb91c;});}})['catch'](function(_0x12a3c2){_0x26d4af=0x1f4;logger[_0x013e('0x26')](_0x12a3c2[_0x013e('0x83')]);if(_0x12a3c2['name']){delete _0x12a3c2[_0x013e('0x39')];}_0x425489=_0x12a3c2;})[_0x013e('0x84')](function(){if(_0x425489===null){_0x3a1f8b['sendStatus'](_0x26d4af);}else{if(_0x26d4af===0x1f4){_0x3a1f8b[_0x013e('0x2a')](_0x26d4af)[_0x013e('0x3a')](_0x425489);}else{_0x3a1f8b[_0x013e('0x2a')](_0x26d4af)[_0x013e('0x2c')](_0x425489);}}});};exports[_0x013e('0x85')]=function(_0x29d935,_0x588f6f,_0x2676e8){var _0x10fb2c={};var _0xa57964={};var _0x2f5138;var _0x249ac8;return db[_0x013e('0x3d')][_0x013e('0x66')]({'where':{'id':_0x29d935[_0x013e('0x60')]['id']}})['then'](handleEntityNotFound(_0x588f6f,null))['then'](function(_0x135789){if(_0x135789){_0x2f5138=_0x135789;_0xa57964['model']=_[_0x013e('0x53')](db[_0x013e('0x80')][_0x013e('0x3e')]);_0xa57964['query']=_[_0x013e('0x53')](_0x29d935['query']);_0xa57964['filters']=_['intersection'](_0xa57964['model'],_0xa57964[_0x013e('0x42')]);_0x10fb2c[_0x013e('0x45')]=_[_0x013e('0x44')](_0xa57964[_0x013e('0x41')],qs['fields'](_0x29d935[_0x013e('0x42')][_0x013e('0x46')]));_0x10fb2c[_0x013e('0x45')]=_0x10fb2c['attributes'][_0x013e('0x54')]?_0x10fb2c[_0x013e('0x45')]:_0xa57964[_0x013e('0x41')];_0x10fb2c['order']=qs[_0x013e('0x4a')](_0x29d935[_0x013e('0x42')]['sort']);_0x10fb2c[_0x013e('0x4b')]=qs[_0x013e('0x43')](_['pick'](_0x29d935[_0x013e('0x42')],_0xa57964['filters']));if(_0x29d935[_0x013e('0x42')]['filter']){_0x10fb2c[_0x013e('0x4b')]=_[_0x013e('0x55')](_0x10fb2c[_0x013e('0x4b')],{'$or':_[_0x013e('0x4d')](_0x10fb2c['attributes'],function(_0x2237ba){var _0x23b56b={};_0x23b56b[_0x2237ba]={'$like':'%'+_0x29d935[_0x013e('0x42')][_0x013e('0x4e')]+'%'};return _0x23b56b;})});}_0x10fb2c=_[_0x013e('0x55')]({},_0x10fb2c,_0x29d935[_0x013e('0x4f')]);return _0x2f5138['getApplications'](_0x10fb2c);}})[_0x013e('0x20')](function(_0x29d93d){if(_0x29d93d){_0x249ac8=_0x29d93d[_0x013e('0x54')];if(!_0x29d935[_0x013e('0x42')][_0x013e('0x47')](_0x013e('0x48'))){_0x10fb2c[_0x013e('0x2f')]=qs[_0x013e('0x2f')](_0x29d935[_0x013e('0x42')][_0x013e('0x2f')]);_0x10fb2c[_0x013e('0x2d')]=qs[_0x013e('0x2d')](_0x29d935[_0x013e('0x42')][_0x013e('0x2d')]);}return _0x2f5138[_0x013e('0x85')](_0x10fb2c);}})[_0x013e('0x20')](function(_0x2b65d1){if(_0x2b65d1){return _0x2b65d1?{'count':_0x249ac8,'rows':_0x2b65d1}:null;}})[_0x013e('0x20')](respondWithResult(_0x588f6f,null))[_0x013e('0x51')](handleError(_0x588f6f,null));};function Extension(_0xf4e5d7,_0x5f1cba,_0x423103,_0x22770a){this['context']=_0x013e('0x86');this['exten']=_0xf4e5d7[_0x013e('0x87')];this[_0x013e('0x88')]=_0x22770a;this['type']=_0x013e('0x89');this[_0x013e('0x8a')]=_0x013e('0x8b');this['FaxAccountId']=_0xf4e5d7['id'];this[_0x013e('0x82')]=_0x5f1cba;this['appdata']=_0x423103;}function createExtensionsReciveFax(_0x1a18d1){var _0x24eb68=0x1;var _0x53560e=[];_0x53560e[_0x013e('0x8c')](new Extension(_0x1a18d1,_0x24eb68,'',_0x013e('0x8d')));_0x24eb68+=0x1;_0x53560e['push'](new Extension(_0x1a18d1,_0x24eb68,_0x013e('0x8e'),_0x013e('0x8f')));_0x24eb68+=0x1;for(var _0x186049 in _0x1a18d1){if(_0x1a18d1[_0x013e('0x47')](_0x186049)&&(_0x186049===_0x013e('0x90')||_0x186049===_0x013e('0x87')||_0x186049===_0x013e('0x91')||_0x186049===_0x013e('0x92')||_0x186049===_0x013e('0x93')||_0x186049===_0x013e('0x94')||_0x186049===_0x013e('0x95')||_0x186049==='modem'||_0x186049===_0x013e('0x96'))){_0x53560e['push'](new Extension(_0x1a18d1,_0x24eb68,_0x013e('0x97')+_0x186049+')='+_0x1a18d1[_0x186049],_0x013e('0x8f')));_0x24eb68+=0x1;}}_0x53560e[_0x013e('0x8c')](new Extension(_0x1a18d1,_0x24eb68,'6',_0x013e('0x98')));_0x24eb68+=0x1;_0x53560e['push'](new Extension(_0x1a18d1,_0x24eb68,_0x013e('0x99'),'ReceiveFax'));_0x24eb68=0x0;return _0x53560e;}exports[_0x013e('0x9a')]=function(_0x6aad93,_0x5ce059,_0x28a869){var _0x9f07eb;return db[_0x013e('0x7c')]['transaction'](function(_0x56ab45){return db[_0x013e('0x3d')][_0x013e('0x57')](_0x6aad93[_0x013e('0x58')],{'transaction':_0x56ab45})[_0x013e('0x20')](function(_0x4060f1){_0x9f07eb=_0x4060f1[_0x013e('0x5c')]({'plain':!![]});return db[_0x013e('0x9b')][_0x013e('0x81')](createExtensionsReciveFax(_0x9f07eb),{'transaction':_0x56ab45});});})[_0x013e('0x20')](function(){return _0x9f07eb;})[_0x013e('0x20')](respondWithResult(_0x5ce059,null))[_0x013e('0x51')](handleError(_0x5ce059,null));};exports[_0x013e('0x9c')]=function(_0x56e9f9,_0x3a78fd,_0xc7f668){var _0x253bd5;return db['sequelize'][_0x013e('0x7d')](function(_0x39778d){return db[_0x013e('0x3d')][_0x013e('0x35')](_0x56e9f9[_0x013e('0x58')],{'where':{'id':_0x56e9f9[_0x013e('0x58')]['id']},'transaction':_0x39778d})[_0x013e('0x20')](function(_0x42e04e){return db[_0x013e('0x9b')][_0x013e('0x36')]({'where':{'FaxAccountId':_0x56e9f9[_0x013e('0x58')]['id']},'transaction':_0x39778d})[_0x013e('0x20')](function(_0x534116){return db[_0x013e('0x9b')][_0x013e('0x81')](createExtensionsReciveFax(_[_0x013e('0x70')](_0x56e9f9[_0x013e('0x58')],[_0x013e('0x9d'),_0x013e('0x9e'),_0x013e('0x9f'),'updatedAt','TrunkId',_0x013e('0xa0')])),{'transaction':_0x39778d});});});})[_0x013e('0x20')](function(){return db[_0x013e('0x3d')][_0x013e('0xa1')](_0x56e9f9[_0x013e('0x58')]['id']);})[_0x013e('0x20')](respondWithResult(_0x3a78fd,null))[_0x013e('0x51')](handleError(_0x3a78fd,null));};exports[_0x013e('0xa2')]=function(_0x4fe0d6,_0x54bfc2,_0x2d2c43){var _0x2b1123={'raw':!![],'where':{}};var _0x23d796={};var _0x7dfb63={'count':0x0,'rows':[]};return db[_0x013e('0x3d')][_0x013e('0x66')]({'where':{'id':_0x4fe0d6[_0x013e('0x60')]['id']}})[_0x013e('0x20')](handleEntityNotFound(_0x54bfc2,null))[_0x013e('0x20')](function(_0x2d24d4){if(_0x2d24d4){_0x23d796[_0x013e('0x41')]=_[_0x013e('0x53')](db[_0x013e('0xa3')][_0x013e('0x3e')]);_0x23d796[_0x013e('0x42')]=_[_0x013e('0x53')](_0x4fe0d6[_0x013e('0x42')]);_0x23d796[_0x013e('0x43')]=_[_0x013e('0x44')](_0x23d796[_0x013e('0x41')],_0x23d796['query']);_0x2b1123[_0x013e('0x45')]=_[_0x013e('0x44')](_0x23d796['model'],qs[_0x013e('0x46')](_0x4fe0d6[_0x013e('0x42')][_0x013e('0x46')]));_0x2b1123[_0x013e('0x45')]=_0x2b1123[_0x013e('0x45')][_0x013e('0x54')]?_0x2b1123[_0x013e('0x45')]:_0x23d796[_0x013e('0x41')];if(!_0x4fe0d6[_0x013e('0x42')][_0x013e('0x47')](_0x013e('0x48'))){_0x2b1123[_0x013e('0x2f')]=qs['limit'](_0x4fe0d6[_0x013e('0x42')][_0x013e('0x2f')]);_0x2b1123[_0x013e('0x2d')]=qs[_0x013e('0x2d')](_0x4fe0d6['query'][_0x013e('0x2d')]);}_0x2b1123['order']=qs[_0x013e('0x4a')](_0x4fe0d6[_0x013e('0x42')][_0x013e('0x4a')]);_0x2b1123[_0x013e('0x4b')]=qs[_0x013e('0x43')](_[_0x013e('0x4c')](_0x4fe0d6[_0x013e('0x42')],_0x23d796[_0x013e('0x43')]));_0x2b1123['where'][_0x013e('0x63')]=_0x2d24d4['id'];if(_0x4fe0d6[_0x013e('0x42')][_0x013e('0x4e')]){_0x2b1123[_0x013e('0x4b')]=_['merge'](_0x2b1123['where'],{'$or':_['map'](_0x2b1123[_0x013e('0x45')],function(_0x380672){var _0x1165e0={};_0x1165e0[_0x380672]={'$like':'%'+_0x4fe0d6['query']['filter']+'%'};return _0x1165e0;})});}if(_0x4fe0d6[_0x013e('0x42')][_0x013e('0xa4')]){var _0x5bb819=_0x4fe0d6['query']['$gte'][_0x013e('0xa5')](',');var _0x5c609b={};_0x5c609b[_0x5bb819[0x0]]={'$gte':moment(_0x5bb819[0x1])[_0x013e('0xa6')](_0x013e('0xa7'))};_0x2b1123[_0x013e('0x4b')]=_[_0x013e('0x55')](_0x2b1123['where'],_0x5c609b);}_0x2b1123=_[_0x013e('0x55')]({},_0x2b1123,_0x4fe0d6[_0x013e('0x4f')]);return db[_0x013e('0xa3')][_0x013e('0x30')]({'where':_0x2b1123[_0x013e('0x4b')]})[_0x013e('0x20')](function(_0x1846fb){_0x7dfb63['count']=_0x1846fb;if(_0x4fe0d6[_0x013e('0x42')][_0x013e('0x6c')]){_0x2b1123[_0x013e('0x50')]=[{'all':!![]}];}return db[_0x013e('0xa3')][_0x013e('0x67')](_0x2b1123);})[_0x013e('0x20')](function(_0x27007a){_0x7dfb63[_0x013e('0x68')]=_0x27007a;return _0x7dfb63;});}})[_0x013e('0x20')](respondWithFilteredResult(_0x54bfc2,_0x2b1123))[_0x013e('0x51')](handleError(_0x54bfc2,null));};exports[_0x013e('0x3a')]=function(_0x131597,_0x8ea4ca,_0x2a6e25){var _0x5e6705,_0x11e24d={},_0x27d878;if(_0x131597['body']['to']){_0x27d878=_0x131597[_0x013e('0x58')]['to'][0x0];}return db[_0x013e('0x3d')][_0x013e('0x56')]({'where':{'id':_0x131597[_0x013e('0x60')]['id']},'include':[{'model':db[_0x013e('0xa8')],'as':_0x013e('0xa9'),'include':[{'model':db[_0x013e('0x73')],'as':_0x013e('0xaa'),'where':{'fax':_0x27d878},'limit':0x1,'order':[[_0x013e('0xab'),_0x013e('0xac')]]}]}]})[_0x013e('0x20')](handleEntityNotFound(_0x8ea4ca,null))['then'](function(_0x4c4245){_0x5e6705=_0x4c4245;if(_0x131597[_0x013e('0x58')][_0x013e('0xad')]&&_0x131597[_0x013e('0x58')][_0x013e('0xad')][_0x013e('0x54')]){for(var _0x7eaad5=0x0;_0x7eaad5<_0x131597['body'][_0x013e('0xad')][_0x013e('0x54')];_0x7eaad5+=0x1){_0x131597[_0x013e('0x58')]['attachments'][_0x7eaad5]={'filename':_0x131597[_0x013e('0x58')][_0x013e('0xad')][_0x7eaad5]['name'],'id':_0x131597[_0x013e('0x58')]['attachments'][_0x7eaad5]['id'],'path':path['join'](config[_0x013e('0xae')],'server/files/attachments',_0x131597[_0x013e('0x58')][_0x013e('0xad')][_0x7eaad5]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0x013e('0xaf'),{'FaxAccountId':_['isNil'](_0x131597[_0x013e('0x60')]['id'])?undefined:_0x131597['params']['id'],'path':_['isNil'](_0x131597[_0x013e('0x58')][_0x013e('0xad')][0x0][_0x013e('0x8')])?undefined:_0x131597[_0x013e('0x58')][_0x013e('0xad')][0x0][_0x013e('0x8')],'fax':_[_0x013e('0xb0')](_0x131597[_0x013e('0x58')]['to'][0x0])?undefined:_0x131597['body']['to'][0x0]},client9002);})[_0x013e('0x20')](function(){if(_0x5e6705){if(_[_0x013e('0xb0')](_0x131597[_0x013e('0x58')][_0x013e('0xb1')])){_0x131597[_0x013e('0x58')]['from']=util[_0x013e('0xa6')](_0x013e('0xb2'),_0x5e6705[_0x013e('0x39')],_0x5e6705[_0x013e('0xb3')]);}if(_0x5e6705[_0x013e('0xa9')]){if(_0x5e6705['List'][_0x013e('0xaa')]['length']){return _0x5e6705['List'][_0x013e('0xaa')][0x0];}else{return db[_0x013e('0x73')][_0x013e('0x57')](_[_0x013e('0x1a')](_0x131597[_0x013e('0x58')],{'firstName':_0x131597[_0x013e('0x58')]['to'][0x0],'phone':_0x131597['body']['to'][0x0],'fax':_0x131597[_0x013e('0x58')]['to'][0x0],'ListId':_0x5e6705['ListId']}));}}else{throw new Error(_0x013e('0xb4'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x013e('0x20')](function(_0x39303d){if(_0x39303d){return db[_0x013e('0x72')][_0x013e('0x56')]({'where':{'ContactId':_0x39303d['id'],'closed':![],'FaxAccountId':_0x5e6705['id']}})['then'](function(_0x2a66c3){if(_0x2a66c3){return[_0x2a66c3,![]];}return db[_0x013e('0x72')][_0x013e('0x57')]({'UserId':_0x131597[_0x013e('0x59')]['id'],'ContactId':_0x39303d['id'],'FaxAccountId':_0x5e6705['id'],'fax':_0x131597['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x131597['body'],{'read':![],'body':_0x131597['body'][_0x013e('0xad')][0x0]['filename'],'FaxAccountId':_0x5e6705['id'],'UserId':_0x131597[_0x013e('0x59')]['id'],'ContactId':_0x39303d['id'],'AttachmentId':_0x131597[_0x013e('0x58')][_0x013e('0xad')][0x0]['id']})]},{'include':[{'model':db[_0x013e('0xa3')],'as':_0x013e('0xb5')}]})[_0x013e('0x20')](function(_0x48d2c1){return[_0x48d2c1,!![]];});});}else{throw new Error(_0x013e('0xb6'));}})[_0x013e('0xb7')](function(_0x4afcb5,_0x36fc31){if(_0x36fc31){return _0x4afcb5;}return db['FaxMessage'][_0x013e('0x57')]({'direction':_0x013e('0xb8'),'read':![],'body':_0x131597[_0x013e('0x58')][_0x013e('0xad')][0x0]['filename'],'FaxAccountId':_0x5e6705['id'],'FaxInteractionId':_0x4afcb5['id'],'UserId':_0x131597[_0x013e('0x59')]['id'],'ContactId':_0x4afcb5[_0x013e('0xb9')],'AttachmentId':_0x131597[_0x013e('0x58')][_0x013e('0xad')][0x0]['id']})[_0x013e('0x20')](function(_0x5a0e11){_0x4afcb5[_0x013e('0xba')][_0x013e('0xb5')]=[];_0x4afcb5[_0x013e('0xba')][_0x013e('0xb5')][_0x013e('0x8c')](_0x5a0e11[_0x013e('0xba')]);return _0x4afcb5;});})['then'](function(_0x1c339b){respondWithRpcPromise('SendFax',_0x013e('0xbb'),{'FaxAccountId':_['isNil'](_0x131597[_0x013e('0x60')]['id'])?undefined:_0x131597[_0x013e('0x60')]['id'],'path':_[_0x013e('0xb0')](_0x131597[_0x013e('0x58')][_0x013e('0xad')][0x0][_0x013e('0x8')])?undefined:_0x131597[_0x013e('0x58')]['attachments'][0x0][_0x013e('0x8')],'fax':_[_0x013e('0xb0')](_0x131597['body']['to'][0x0])?undefined:_0x131597[_0x013e('0x58')]['to'][0x0],'AttachmentId':_0x131597[_0x013e('0x58')]['attachments'][0x0]['id']},client9002)[_0x013e('0x20')](function(_0x22d943){logger[_0x013e('0x21')](_0x013e('0xbc'),_0x22d943);})['catch'](function(_0x49678b){logger[_0x013e('0x21')]('SendFaxRpc,\x20%s',_0x49678b);});return _0x1c339b;})[_0x013e('0x20')](respondWithResult(_0x8ea4ca,null))[_0x013e('0x51')](handleError(_0x8ea4ca,null));};exports[_0x013e('0xbd')]=function(_0x374ecc,_0x1bc7ce,_0x296f8b){return db['FaxAccount']['find']({'where':{'id':_0x374ecc['params']['id']}})[_0x013e('0x20')](handleEntityNotFound(_0x1bc7ce,null))[_0x013e('0x20')](function(_0x2f907e){if(_0x2f907e){return _0x2f907e[_0x013e('0xbd')](_0x374ecc[_0x013e('0x58')][_0x013e('0x6e')],_[_0x013e('0x70')](_0x374ecc[_0x013e('0x58')],[_0x013e('0x6e'),'id'])||{})['spread'](function(_0x41183f){for(var _0x141fab=0x0;_0x141fab<_0x374ecc[_0x013e('0x58')]['ids'][_0x013e('0x54')];_0x141fab+=0x1){socket[_0x013e('0xbe')](_0x013e('0xbf'),{'UserId':Number(_0x374ecc['body'][_0x013e('0x6e')][_0x141fab]),'FaxAccountId':Number(_0x374ecc[_0x013e('0x60')]['id'])});}return _0x41183f;});}})[_0x013e('0x20')](respondWithResult(_0x1bc7ce,null))['catch'](handleError(_0x1bc7ce,null));};exports[_0x013e('0xc0')]=function(_0xe74c78,_0x4e42d9,_0x5ebda8){return db[_0x013e('0x3d')][_0x013e('0x56')]({'where':{'id':_0xe74c78[_0x013e('0x60')]['id']}})[_0x013e('0x20')](handleEntityNotFound(_0x4e42d9,null))[_0x013e('0x20')](function(_0x4b5055){if(_0x4b5055){return _0x4b5055[_0x013e('0xc0')](_0xe74c78[_0x013e('0x42')][_0x013e('0x6e')])[_0x013e('0x20')](function(){if(_[_0x013e('0xc1')](_0xe74c78['query'][_0x013e('0x6e')])){for(var _0x2c21ec=0x0;_0x2c21ec<_0xe74c78['query']['ids'][_0x013e('0x54')];_0x2c21ec+=0x1){socket['emit'](_0x013e('0xc2'),{'UserId':Number(_0xe74c78[_0x013e('0x42')][_0x013e('0x6e')][_0x2c21ec]),'FaxAccountId':Number(_0xe74c78[_0x013e('0x60')]['id'])});}}else{socket[_0x013e('0xbe')](_0x013e('0xc2'),{'UserId':Number(_0xe74c78['query'][_0x013e('0x6e')]),'FaxAccountId':Number(_0xe74c78[_0x013e('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x4e42d9,null))[_0x013e('0x51')](handleError(_0x4e42d9,null));};exports[_0x013e('0xc3')]=function(_0x50c39f,_0x939c54,_0x5e43c0){var _0x2ff0c0={};var _0x1c67e4={};var _0x472e5c;var _0x21e1d5;return db[_0x013e('0x3d')]['findOne']({'where':{'id':_0x50c39f['params']['id']}})[_0x013e('0x20')](handleEntityNotFound(_0x939c54,null))[_0x013e('0x20')](function(_0x16251f){if(_0x16251f){_0x472e5c=_0x16251f;_0x1c67e4[_0x013e('0x41')]=_[_0x013e('0x53')](db[_0x013e('0x75')][_0x013e('0x3e')]);_0x1c67e4['query']=_['keys'](_0x50c39f[_0x013e('0x42')]);_0x1c67e4[_0x013e('0x43')]=_[_0x013e('0x44')](_0x1c67e4[_0x013e('0x41')],_0x1c67e4['query']);_0x2ff0c0[_0x013e('0x45')]=_[_0x013e('0x44')](_0x1c67e4[_0x013e('0x41')],qs['fields'](_0x50c39f[_0x013e('0x42')][_0x013e('0x46')]));_0x2ff0c0['attributes']=_0x2ff0c0[_0x013e('0x45')][_0x013e('0x54')]?_0x2ff0c0[_0x013e('0x45')]:_0x1c67e4[_0x013e('0x41')];_0x2ff0c0[_0x013e('0x49')]=qs['sort'](_0x50c39f[_0x013e('0x42')][_0x013e('0x4a')]);_0x2ff0c0[_0x013e('0x4b')]=qs[_0x013e('0x43')](_[_0x013e('0x4c')](_0x50c39f['query'],_0x1c67e4[_0x013e('0x43')]));if(_0x50c39f[_0x013e('0x42')]['filter']){_0x2ff0c0[_0x013e('0x4b')]=_[_0x013e('0x55')](_0x2ff0c0[_0x013e('0x4b')],{'$or':_[_0x013e('0x4d')](_0x2ff0c0['attributes'],function(_0x44de17){var _0x2311a8={};_0x2311a8[_0x44de17]={'$like':'%'+_0x50c39f[_0x013e('0x42')]['filter']+'%'};return _0x2311a8;})});}_0x2ff0c0=_[_0x013e('0x55')]({},_0x2ff0c0,_0x50c39f['options']);return _0x472e5c[_0x013e('0xc3')](_0x2ff0c0);}})[_0x013e('0x20')](function(_0x2cf661){if(_0x2cf661){_0x21e1d5=_0x2cf661[_0x013e('0x54')];if(!_0x50c39f[_0x013e('0x42')][_0x013e('0x47')](_0x013e('0x48'))){_0x2ff0c0[_0x013e('0x2f')]=qs[_0x013e('0x2f')](_0x50c39f[_0x013e('0x42')][_0x013e('0x2f')]);_0x2ff0c0[_0x013e('0x2d')]=qs[_0x013e('0x2d')](_0x50c39f[_0x013e('0x42')][_0x013e('0x2d')]);}return _0x472e5c['getAgents'](_0x2ff0c0);}})[_0x013e('0x20')](function(_0x18d59d){if(_0x18d59d){return _0x18d59d?{'count':_0x21e1d5,'rows':_0x18d59d}:null;}})[_0x013e('0x20')](respondWithResult(_0x939c54,null))[_0x013e('0x51')](handleError(_0x939c54,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 8b70cc6..6de15c8 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 _0xc852=['exports','events','../../mysqldb','FaxAccount','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x43576f,_0x1356ed){var _0x4d2466=function(_0x865deb){while(--_0x865deb){_0x43576f['push'](_0x43576f['shift']());}};_0x4d2466(++_0x1356ed);}(_0xc852,0x1d5));var _0x2c85=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc852[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x2c85('0x0'));var FaxAccount=require(_0x2c85('0x1'))['db'][_0x2c85('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x2c85('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2c85('0x4')};function emitEvent(_0x4504a8){return function(_0x4a21cd,_0x1fbb0c,_0x50906b){FaxAccountEvents[_0x2c85('0x5')](_0x4504a8+':'+_0x4a21cd['id'],_0x4a21cd);FaxAccountEvents[_0x2c85('0x5')](_0x4504a8,_0x4a21cd);_0x50906b(null);};}for(var e in events){if(events[_0x2c85('0x6')](e)){var event=events[e];FaxAccount[_0x2c85('0x7')](e,emitEvent(event));}}module[_0x2c85('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x73cb=['FaxAccount','setMaxListeners','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x72895a,_0x433607){var _0x5226d5=function(_0x5b7d21){while(--_0x5b7d21){_0x72895a['push'](_0x72895a['shift']());}};_0x5226d5(++_0x433607);}(_0x73cb,0x101));var _0xb73c=function(_0x3d9339,_0x566f3c){_0x3d9339=_0x3d9339-0x0;var _0x5721cb=_0x73cb[_0x3d9339];return _0x5721cb;};'use strict';var EventEmitter=require(_0xb73c('0x0'));var FaxAccount=require(_0xb73c('0x1'))['db'][_0xb73c('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb73c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb73c('0x4')};function emitEvent(_0x52650f){return function(_0x42d885,_0x593bd6,_0x2dda00){FaxAccountEvents[_0xb73c('0x5')](_0x52650f+':'+_0x42d885['id'],_0x42d885);FaxAccountEvents['emit'](_0x52650f,_0x42d885);_0x2dda00(null);};}for(var e in events){if(events[_0xb73c('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index b107302..96dd10d 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 _0x3140=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts'];(function(_0x3ba7df,_0x232c79){var _0x2ecef4=function(_0x1fbf35){while(--_0x1fbf35){_0x3ba7df['push'](_0x3ba7df['shift']());}};_0x2ecef4(++_0x232c79);}(_0x3140,0xb6));var _0x0314=function(_0x3b5a4a,_0x4096e5){_0x3b5a4a=_0x3b5a4a-0x0;var _0xaaec44=_0x3140[_0x3b5a4a];return _0xaaec44;};'use strict';var _=require(_0x0314('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0314('0x1'));var moment=require(_0x0314('0x2'));var BPromise=require(_0x0314('0x3'));var rp=require(_0x0314('0x4'));var fs=require('fs');var path=require(_0x0314('0x5'));var rimraf=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var attributes=require(_0x0314('0x8'));module[_0x0314('0x9')]=function(_0x1ad2f0,_0x20841b){return _0x1ad2f0[_0x0314('0xa')](_0x0314('0xb'),attributes,{'tableName':_0x0314('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb17e=['rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0xb17e,0x133));var _0xeb17=function(_0x28ee89,_0x45ea94){_0x28ee89=_0x28ee89-0x0;var _0x3d08e0=_0xb17e[_0x28ee89];return _0x3d08e0;};'use strict';var _=require(_0xeb17('0x0'));var util=require(_0xeb17('0x1'));var logger=require(_0xeb17('0x2'))(_0xeb17('0x3'));var moment=require(_0xeb17('0x4'));var BPromise=require(_0xeb17('0x5'));var rp=require(_0xeb17('0x6'));var fs=require('fs');var path=require(_0xeb17('0x7'));var rimraf=require(_0xeb17('0x8'));var config=require(_0xeb17('0x9'));var attributes=require(_0xeb17('0xa'));module[_0xeb17('0xb')]=function(_0x3b1c5a,_0x1ab8b5){return _0x3b1c5a[_0xeb17('0xc')](_0xeb17('0xd'),attributes,{'tableName':_0xeb17('0xe'),'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 9c26b56..f3652d0 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 _0x69d7=['UserId','agent','waitForTheAssignedAgent','interaction','queueId','FaxQueue','name','unshift','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetFaxAccount','findAll','options','raw','where','attributes','include','map','model','stringify','body','fax','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','CmList','List','Contacts','DESC','FaxApplication','get','account','applications','Applications','asc','length','CmContact','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','*,*,*,*','created','FaxMessage','AttachmentId','User'];(function(_0x2a32ee,_0x49627a){var _0x41f391=function(_0x201336){while(--_0x201336){_0x2a32ee['push'](_0x2a32ee['shift']());}};_0x41f391(++_0x49627a);}(_0x69d7,0x118));var _0x769d=function(_0x130e8c,_0x1fd1f2){_0x130e8c=_0x130e8c-0x0;var _0x55243e=_0x69d7[_0x130e8c];return _0x55243e;};'use strict';var _=require(_0x769d('0x0'));var util=require('util');var moment=require(_0x769d('0x1'));var BPromise=require(_0x769d('0x2'));var rs=require(_0x769d('0x3'));var fs=require('fs');var Redis=require(_0x769d('0x4'));var db=require(_0x769d('0x5'))['db'];var utils=require(_0x769d('0x6'));var logger=require(_0x769d('0x7'))(_0x769d('0x8'));var config=require('../../config/environment');var jayson=require(_0x769d('0x9'));var client=jayson[_0x769d('0xa')][_0x769d('0xb')]({'port':0x232c});config['redis']=_[_0x769d('0xc')](config[_0x769d('0xd')],{'host':_0x769d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x769d('0xd')]));require(_0x769d('0xf'))['register'](socket);function respondWithRpcPromise(_0x5990cc,_0x1063e7,_0x5c704f){return new BPromise(function(_0x30ce32,_0x396277){return client[_0x769d('0x10')](_0x5990cc,_0x5c704f)[_0x769d('0x11')](function(_0x1cf7e5){logger[_0x769d('0x12')](_0x769d('0x13'),_0x1063e7,_0x769d('0x14'));logger[_0x769d('0x15')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1063e7,_0x769d('0x14'),JSON['stringify'](_0x1cf7e5));if(_0x1cf7e5[_0x769d('0x16')]){if(_0x1cf7e5[_0x769d('0x16')][_0x769d('0x17')]===0x1f4){logger[_0x769d('0x16')](_0x769d('0x13'),_0x1063e7,_0x1cf7e5[_0x769d('0x16')][_0x769d('0x18')]);return _0x396277(_0x1cf7e5[_0x769d('0x16')]['message']);}logger[_0x769d('0x16')](_0x769d('0x13'),_0x1063e7,_0x1cf7e5[_0x769d('0x16')][_0x769d('0x18')]);return _0x30ce32(_0x1cf7e5[_0x769d('0x16')][_0x769d('0x18')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x1063e7,_0x769d('0x14'));_0x30ce32(_0x1cf7e5[_0x769d('0x19')][_0x769d('0x18')]);}})[_0x769d('0x1a')](function(_0x2f475f){logger[_0x769d('0x16')]('FaxAccount,\x20%s,\x20%s',_0x1063e7,_0x2f475f);_0x396277(_0x2f475f);});});}exports[_0x769d('0x1b')]=function(_0x3f068f){var _0x34cc9a=this;return new Promise(function(_0x213503,_0x23407f){return db['FaxAccount'][_0x769d('0x1c')]({'raw':_0x3f068f[_0x769d('0x1d')]?_0x3f068f['options'][_0x769d('0x1e')]===undefined?!![]:![]:!![],'where':_0x3f068f[_0x769d('0x1d')]?_0x3f068f[_0x769d('0x1d')][_0x769d('0x1f')]||null:null,'attributes':_0x3f068f[_0x769d('0x1d')]?_0x3f068f['options'][_0x769d('0x20')]||null:null,'limit':_0x3f068f['options']?_0x3f068f[_0x769d('0x1d')]['limit']||null:null,'include':_0x3f068f[_0x769d('0x1d')]?_0x3f068f[_0x769d('0x1d')][_0x769d('0x21')]?_[_0x769d('0x22')](_0x3f068f[_0x769d('0x1d')][_0x769d('0x21')],function(_0x41994e){return{'model':db[_0x41994e[_0x769d('0x23')]],'as':_0x41994e['as'],'attributes':_0x41994e[_0x769d('0x20')],'include':_0x41994e[_0x769d('0x21')]?_[_0x769d('0x22')](_0x41994e[_0x769d('0x21')],function(_0x20f191){return{'model':db[_0x20f191[_0x769d('0x23')]],'as':_0x20f191['as'],'attributes':_0x20f191['attributes'],'include':_0x20f191[_0x769d('0x21')]?_[_0x769d('0x22')](_0x20f191['include'],function(_0x203442){return{'model':db[_0x203442[_0x769d('0x23')]],'as':_0x203442['as'],'attributes':_0x203442[_0x769d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x769d('0x11')](function(_0x3d83fb){logger[_0x769d('0x12')]('GetFaxAccount',_0x3f068f);logger[_0x769d('0x15')](_0x769d('0x1b'),_0x3f068f,JSON[_0x769d('0x24')](_0x3d83fb));_0x213503(_0x3d83fb);})[_0x769d('0x1a')](function(_0x39f223){logger[_0x769d('0x16')](_0x769d('0x1b'),_0x39f223[_0x769d('0x18')],_0x3f068f);_0x23407f(_0x34cc9a[_0x769d('0x16')](0x1f4,_0x39f223[_0x769d('0x18')]));});});};exports['NotifyFaxAccount']=function(_0x4cc419,_0x531ec7,_0x49bc44){var _0x325680=this;return new Promise(function(_0xec288f,_0x47623a){var _0x45c943={'body':_0x4cc419[_0x769d('0x25')],'channel':_0x769d('0x26')};var _0x31ad5a=[];var _0x13877e=[];var _0x35a17e={};return db['CmContact']['describe']()[_0x769d('0x11')](function(_0x5930b2){if(!_0x5930b2){throw new db[(_0x769d('0x27'))][(_0x769d('0x28'))](_0x769d('0x29'));}_0x31ad5a=_[_0x769d('0x2a')](_['keys'](_0x5930b2),[_0x769d('0x2b'),_0x769d('0x2c')]);_0x13877e=_[_0x769d('0x2a')](_[_0x769d('0x2d')](_0x5930b2),['createdAt','updatedAt',_0x769d('0x2e'),_0x769d('0x2f')]);if(_0x4cc419[_0x769d('0x25')]['id']){delete _0x4cc419[_0x769d('0x25')]['id'];}if(_[_0x769d('0x30')](_0x4cc419[_0x769d('0x25')][_0x769d('0x31')])){throw new db[(_0x769d('0x27'))][(_0x769d('0x28'))](_0x769d('0x32'));}if(_['isNil'](_0x4cc419['body']['body'])||_0x4cc419[_0x769d('0x25')][_0x769d('0x25')]===''){throw new db[(_0x769d('0x27'))][(_0x769d('0x28'))](_0x769d('0x33'));}if(_['isNil'](_0x4cc419[_0x769d('0x25')][_0x769d('0x34')])){throw new db[(_0x769d('0x27'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x13877e);}if(!_[_0x769d('0x35')](_0x13877e,_0x4cc419[_0x769d('0x25')]['mapKey'])){throw new db[(_0x769d('0x27'))]['ValidationError'](_0x769d('0x36')+_0x13877e);}_0x35a17e[_0x4cc419[_0x769d('0x25')][_0x769d('0x34')]]=_0x4cc419[_0x769d('0x25')][_0x769d('0x31')];})[_0x769d('0x11')](function(){return db[_0x769d('0x37')][_0x769d('0x38')]({'where':{'id':_0x4cc419['account']['id']},'include':[{'model':db[_0x769d('0x39')],'as':_0x769d('0x3a'),'include':[{'model':db['CmContact'],'as':_0x769d('0x3b'),'where':_0x35a17e,'limit':0x1,'order':[['updatedAt',_0x769d('0x3c')]]}]},{'model':db[_0x769d('0x3d')],'as':'Applications'}]});})[_0x769d('0x11')](function(_0x365bfd){if(_0x365bfd&&_0x365bfd[_0x769d('0x3a')]){var _0x4ef79e=_0x365bfd[_0x769d('0x3e')]({'plain':!![]});_0x45c943[_0x769d('0x3f')]=_0x4ef79e;_0x45c943[_0x769d('0x40')]=_0x4ef79e[_0x769d('0x41')];_0x45c943['list']=_0x4ef79e[_0x769d('0x3a')];_0x45c943[_0x769d('0x40')]=_['orderBy'](_0x45c943['applications'],['priority'],[_0x769d('0x42')]);if(_0x45c943[_0x769d('0x3f')][_0x769d('0x41')]){delete _0x45c943['account'][_0x769d('0x41')];}if(_0x45c943[_0x769d('0x3f')][_0x769d('0x3a')]&&_0x45c943[_0x769d('0x3f')][_0x769d('0x3a')][_0x769d('0x3b')][_0x769d('0x43')]){return _0x45c943[_0x769d('0x3f')][_0x769d('0x3a')][_0x769d('0x3b')][0x0];}var _0x47102e=_[_0x769d('0xc')](_0x4cc419['body'],{'firstName':_0x4cc419[_0x769d('0x25')]['from'],'ListId':_0x4ef79e['ListId']});_0x47102e[_0x4cc419['body']['mapKey']]=_0x4cc419['body'][_0x769d('0x31')];return db[_0x769d('0x44')][_0x769d('0x45')](_0x47102e,{'fields':_0x31ad5a,'raw':!![]});}})['then'](function(_0x230063){_0x45c943[_0x769d('0x46')]=_0x230063;if(_0x230063){var _0x272d0e={'ContactId':_0x230063['id'],'FaxAccountId':_0x4cc419[_0x769d('0x3f')]['id'],'fax':_0x230063[_0x769d('0x26')]};return db[_0x769d('0x47')]['find']({'where':{'ContactId':_0x230063['id'],'closed':![],'FaxAccountId':_0x4cc419[_0x769d('0x3f')]['id']}})[_0x769d('0x11')](function(_0x3ca3a4){if(_0x3ca3a4){return[_0x3ca3a4,![]];}return db[_0x769d('0x47')]['create'](_0x272d0e)[_0x769d('0x11')](function(_0x4435c2){return[_0x4435c2,!![]];});});}else{throw new Error(_0x769d('0x48'));}})[_0x769d('0x49')](function(_0x2ec1dd,_0x4d7ba5){var _0x1e20fd=_0x2ec1dd[_0x769d('0x3e')]({'plain':!![]});if(_0x4d7ba5){if(_0x45c943[_0x769d('0x3f')]['autoclose']){_0x45c943[_0x769d('0x40')][_0x769d('0x4a')]({'id':0x0,'priority':_0x45c943[_0x769d('0x40')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x769d('0x4b')});}_0x1e20fd['created']=!![];}else{_0x1e20fd[_0x769d('0x4c')]=![];}_0x45c943['interaction']=_0x1e20fd;return db[_0x769d('0x4d')][_0x769d('0x45')]({'body':_0x4cc419[_0x769d('0x25')]['body'],'FaxAccountId':_0x4cc419['account']['id'],'FaxInteractionId':_0x2ec1dd['id'],'direction':'in','ContactId':_0x2ec1dd['ContactId'],'AttachmentId':_0x4cc419['body'][_0x769d('0x4e')]});})[_0x769d('0x11')](function(_0x5f394b){_0x45c943[_0x769d('0x18')]=_0x5f394b;if(!_0x45c943['interaction']['UserId'])return;return db[_0x769d('0x4f')][_0x769d('0x38')]({'attributes':['id','name'],'where':{'id':_0x45c943['interaction'][_0x769d('0x50')]}});})[_0x769d('0x11')](function(_0x168378){if(_0x168378){_0x45c943[_0x769d('0x40')]['unshift']({'id':0x0,'priority':0x0,'app':_0x769d('0x51'),'appdata':_0x168378['name']+','+(_0x45c943[_0x769d('0x3f')][_0x769d('0x52')]||0xa),'interval':_0x769d('0x4b')});}if(!_0x45c943[_0x769d('0x53')][_0x769d('0x54')])return;return db[_0x769d('0x55')][_0x769d('0x38')]({'attributes':['id',_0x769d('0x56')],'where':{'id':_0x45c943[_0x769d('0x53')][_0x769d('0x54')]}});})[_0x769d('0x11')](function(_0x39ff7e){if(_0x39ff7e){_0x45c943[_0x769d('0x40')][_0x769d('0x57')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x39ff7e[_0x769d('0x56')]+','+(_0x45c943[_0x769d('0x3f')]['waitForTheAssignedQueue']||0x12c),'interval':_0x769d('0x4b')});}return respondWithRpcPromise(_0x769d('0x58'),_0x769d('0x59'),_0x45c943);})[_0x769d('0x11')](function(_0x3e6a38){_0xec288f(_0x3e6a38);})['catch'](function(_0x2576c8){_0x47623a(_0x325680['error'](0x1f4,_0x2576c8[_0x769d('0x18')]));});});}; \ No newline at end of file +var _0xe255=['FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','agent','waitForTheAssignedAgent','FaxQueue','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','limit','include','map','model','attributes','NotifyFaxAccount','body','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','List','CmContact','Contacts','FaxApplication','get','applications','Applications','orderBy','asc','length','create','fax'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe255,0x136));var _0x5e25=function(_0x2ea952,_0x1a626e){_0x2ea952=_0x2ea952-0x0;var _0x51c766=_0xe255[_0x2ea952];return _0x51c766;};'use strict';var _=require(_0x5e25('0x0'));var util=require(_0x5e25('0x1'));var moment=require(_0x5e25('0x2'));var BPromise=require(_0x5e25('0x3'));var rs=require(_0x5e25('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e25('0x5'))['db'];var utils=require(_0x5e25('0x6'));var logger=require(_0x5e25('0x7'))(_0x5e25('0x8'));var config=require(_0x5e25('0x9'));var jayson=require(_0x5e25('0xa'));var client=jayson['client'][_0x5e25('0xb')]({'port':0x232c});config[_0x5e25('0xc')]=_[_0x5e25('0xd')](config[_0x5e25('0xc')],{'host':_0x5e25('0xe'),'port':0x18eb});var socket=require(_0x5e25('0xf'))(new Redis(config[_0x5e25('0xc')]));require(_0x5e25('0x10'))['register'](socket);function respondWithRpcPromise(_0x1f2b5f,_0x2d6c26,_0x534c39){return new BPromise(function(_0x3d3ca5,_0x49f8e2){return client[_0x5e25('0x11')](_0x1f2b5f,_0x534c39)[_0x5e25('0x12')](function(_0x2e8288){logger[_0x5e25('0x13')](_0x5e25('0x14'),_0x2d6c26,_0x5e25('0x15'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2d6c26,'request\x20sent',JSON[_0x5e25('0x16')](_0x2e8288));if(_0x2e8288[_0x5e25('0x17')]){if(_0x2e8288[_0x5e25('0x17')][_0x5e25('0x18')]===0x1f4){logger['error'](_0x5e25('0x14'),_0x2d6c26,_0x2e8288[_0x5e25('0x17')][_0x5e25('0x19')]);return _0x49f8e2(_0x2e8288[_0x5e25('0x17')][_0x5e25('0x19')]);}logger[_0x5e25('0x17')](_0x5e25('0x14'),_0x2d6c26,_0x2e8288['error']['message']);return _0x3d3ca5(_0x2e8288[_0x5e25('0x17')][_0x5e25('0x19')]);}else{logger[_0x5e25('0x13')](_0x5e25('0x14'),_0x2d6c26,_0x5e25('0x15'));_0x3d3ca5(_0x2e8288[_0x5e25('0x1a')][_0x5e25('0x19')]);}})[_0x5e25('0x1b')](function(_0x26a890){logger[_0x5e25('0x17')]('FaxAccount,\x20%s,\x20%s',_0x2d6c26,_0x26a890);_0x49f8e2(_0x26a890);});});}exports[_0x5e25('0x1c')]=function(_0xd7510b){var _0x2bc23b=this;return new Promise(function(_0x360bbb,_0x418ab7){return db[_0x5e25('0x1d')]['findAll']({'raw':_0xd7510b[_0x5e25('0x1e')]?_0xd7510b[_0x5e25('0x1e')][_0x5e25('0x1f')]===undefined?!![]:![]:!![],'where':_0xd7510b[_0x5e25('0x1e')]?_0xd7510b[_0x5e25('0x1e')][_0x5e25('0x20')]||null:null,'attributes':_0xd7510b[_0x5e25('0x1e')]?_0xd7510b[_0x5e25('0x1e')]['attributes']||null:null,'limit':_0xd7510b[_0x5e25('0x1e')]?_0xd7510b['options'][_0x5e25('0x21')]||null:null,'include':_0xd7510b[_0x5e25('0x1e')]?_0xd7510b['options'][_0x5e25('0x22')]?_[_0x5e25('0x23')](_0xd7510b[_0x5e25('0x1e')][_0x5e25('0x22')],function(_0x1af93f){return{'model':db[_0x1af93f[_0x5e25('0x24')]],'as':_0x1af93f['as'],'attributes':_0x1af93f[_0x5e25('0x25')],'include':_0x1af93f[_0x5e25('0x22')]?_[_0x5e25('0x23')](_0x1af93f[_0x5e25('0x22')],function(_0x57f42d){return{'model':db[_0x57f42d[_0x5e25('0x24')]],'as':_0x57f42d['as'],'attributes':_0x57f42d[_0x5e25('0x25')],'include':_0x57f42d[_0x5e25('0x22')]?_[_0x5e25('0x23')](_0x57f42d[_0x5e25('0x22')],function(_0x5ac404){return{'model':db[_0x5ac404['model']],'as':_0x5ac404['as'],'attributes':_0x5ac404[_0x5e25('0x25')]};}):[]};}):[]};}):[]:[]})[_0x5e25('0x12')](function(_0x2c633e){logger['info']('GetFaxAccount',_0xd7510b);logger['debug'](_0x5e25('0x1c'),_0xd7510b,JSON[_0x5e25('0x16')](_0x2c633e));_0x360bbb(_0x2c633e);})[_0x5e25('0x1b')](function(_0x2249a7){logger[_0x5e25('0x17')](_0x5e25('0x1c'),_0x2249a7[_0x5e25('0x19')],_0xd7510b);_0x418ab7(_0x2bc23b[_0x5e25('0x17')](0x1f4,_0x2249a7['message']));});});};exports[_0x5e25('0x26')]=function(_0x91e285,_0x438706,_0x4ac5a8){var _0x505101=this;return new Promise(function(_0x33150c,_0x5adfd1){var _0x7ff2a={'body':_0x91e285[_0x5e25('0x27')],'channel':'fax'};var _0x5281a8=[];var _0x38076a=[];var _0x1a7549={};return db['CmContact'][_0x5e25('0x28')]()['then'](function(_0x1abe91){if(!_0x1abe91){throw new db[(_0x5e25('0x29'))]['ValidationError'](_0x5e25('0x2a'));}_0x5281a8=_[_0x5e25('0x2b')](_[_0x5e25('0x2c')](_0x1abe91),[_0x5e25('0x2d'),_0x5e25('0x2e')]);_0x38076a=_[_0x5e25('0x2b')](_[_0x5e25('0x2c')](_0x1abe91),['createdAt',_0x5e25('0x2e'),_0x5e25('0x2f'),_0x5e25('0x30')]);if(_0x91e285[_0x5e25('0x27')]['id']){delete _0x91e285[_0x5e25('0x27')]['id'];}if(_[_0x5e25('0x31')](_0x91e285['body'][_0x5e25('0x32')])){throw new db[(_0x5e25('0x29'))][(_0x5e25('0x33'))]('from\x20is\x20mandatory');}if(_[_0x5e25('0x31')](_0x91e285[_0x5e25('0x27')][_0x5e25('0x27')])||_0x91e285[_0x5e25('0x27')]['body']===''){throw new db[(_0x5e25('0x29'))]['ValidationError'](_0x5e25('0x34'));}if(_[_0x5e25('0x31')](_0x91e285[_0x5e25('0x27')]['mapKey'])){throw new db[(_0x5e25('0x29'))][(_0x5e25('0x33'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x38076a);}if(!_[_0x5e25('0x35')](_0x38076a,_0x91e285[_0x5e25('0x27')]['mapKey'])){throw new db[(_0x5e25('0x29'))]['ValidationError'](_0x5e25('0x36')+_0x38076a);}_0x1a7549[_0x91e285[_0x5e25('0x27')][_0x5e25('0x37')]]=_0x91e285[_0x5e25('0x27')]['from'];})[_0x5e25('0x12')](function(){return db['FaxAccount']['find']({'where':{'id':_0x91e285[_0x5e25('0x38')]['id']},'include':[{'model':db[_0x5e25('0x39')],'as':_0x5e25('0x3a'),'include':[{'model':db[_0x5e25('0x3b')],'as':_0x5e25('0x3c'),'where':_0x1a7549,'limit':0x1,'order':[[_0x5e25('0x2e'),'DESC']]}]},{'model':db[_0x5e25('0x3d')],'as':'Applications'}]});})[_0x5e25('0x12')](function(_0xd920fc){if(_0xd920fc&&_0xd920fc[_0x5e25('0x3a')]){var _0x2fca91=_0xd920fc[_0x5e25('0x3e')]({'plain':!![]});_0x7ff2a[_0x5e25('0x38')]=_0x2fca91;_0x7ff2a[_0x5e25('0x3f')]=_0x2fca91[_0x5e25('0x40')];_0x7ff2a['list']=_0x2fca91[_0x5e25('0x3a')];_0x7ff2a[_0x5e25('0x3f')]=_[_0x5e25('0x41')](_0x7ff2a['applications'],['priority'],[_0x5e25('0x42')]);if(_0x7ff2a[_0x5e25('0x38')][_0x5e25('0x40')]){delete _0x7ff2a['account']['Applications'];}if(_0x7ff2a[_0x5e25('0x38')][_0x5e25('0x3a')]&&_0x7ff2a[_0x5e25('0x38')][_0x5e25('0x3a')][_0x5e25('0x3c')][_0x5e25('0x43')]){return _0x7ff2a['account'][_0x5e25('0x3a')][_0x5e25('0x3c')][0x0];}var _0x18cb95=_[_0x5e25('0xd')](_0x91e285[_0x5e25('0x27')],{'firstName':_0x91e285[_0x5e25('0x27')][_0x5e25('0x32')],'ListId':_0x2fca91[_0x5e25('0x30')]});_0x18cb95[_0x91e285[_0x5e25('0x27')][_0x5e25('0x37')]]=_0x91e285[_0x5e25('0x27')][_0x5e25('0x32')];return db[_0x5e25('0x3b')][_0x5e25('0x44')](_0x18cb95,{'fields':_0x5281a8,'raw':!![]});}})[_0x5e25('0x12')](function(_0x314ba2){_0x7ff2a['contact']=_0x314ba2;if(_0x314ba2){var _0x1d407e={'ContactId':_0x314ba2['id'],'FaxAccountId':_0x91e285['account']['id'],'fax':_0x314ba2[_0x5e25('0x45')]};return db[_0x5e25('0x46')][_0x5e25('0x47')]({'where':{'ContactId':_0x314ba2['id'],'closed':![],'FaxAccountId':_0x91e285[_0x5e25('0x38')]['id']}})[_0x5e25('0x12')](function(_0x201d31){if(_0x201d31){return[_0x201d31,![]];}return db[_0x5e25('0x46')]['create'](_0x1d407e)[_0x5e25('0x12')](function(_0xea6d9){return[_0xea6d9,!![]];});});}else{throw new Error(_0x5e25('0x48'));}})[_0x5e25('0x49')](function(_0x4aa264,_0x53082e){var _0x2daae3=_0x4aa264[_0x5e25('0x3e')]({'plain':!![]});if(_0x53082e){if(_0x7ff2a[_0x5e25('0x38')][_0x5e25('0x4a')]){_0x7ff2a[_0x5e25('0x3f')]['push']({'id':0x0,'priority':_0x7ff2a[_0x5e25('0x3f')]['length']+0x1,'app':_0x5e25('0x4b'),'appdata':_0x5e25('0x4c'),'interval':_0x5e25('0x4d')});}_0x2daae3[_0x5e25('0x4e')]=!![];}else{_0x2daae3[_0x5e25('0x4e')]=![];}_0x7ff2a[_0x5e25('0x4f')]=_0x2daae3;return db[_0x5e25('0x50')][_0x5e25('0x44')]({'body':_0x91e285[_0x5e25('0x27')]['body'],'FaxAccountId':_0x91e285[_0x5e25('0x38')]['id'],'FaxInteractionId':_0x4aa264['id'],'direction':'in','ContactId':_0x4aa264[_0x5e25('0x51')],'AttachmentId':_0x91e285['body'][_0x5e25('0x52')]});})[_0x5e25('0x12')](function(_0x10683f){_0x7ff2a[_0x5e25('0x19')]=_0x10683f;if(!_0x7ff2a['interaction'][_0x5e25('0x53')])return;return db[_0x5e25('0x54')]['find']({'attributes':['id',_0x5e25('0x55')],'where':{'id':_0x7ff2a[_0x5e25('0x4f')]['UserId']}});})['then'](function(_0x1f5c29){if(_0x1f5c29){_0x7ff2a[_0x5e25('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5e25('0x56'),'appdata':_0x1f5c29[_0x5e25('0x55')]+','+(_0x7ff2a[_0x5e25('0x38')][_0x5e25('0x57')]||0xa),'interval':'*,*,*,*'});}if(!_0x7ff2a[_0x5e25('0x4f')]['queueId'])return;return db[_0x5e25('0x58')][_0x5e25('0x47')]({'attributes':['id',_0x5e25('0x55')],'where':{'id':_0x7ff2a[_0x5e25('0x4f')][_0x5e25('0x59')]}});})['then'](function(_0xa8dcca){if(_0xa8dcca){_0x7ff2a['applications'][_0x5e25('0x5a')]({'id':0x0,'priority':0x1,'app':_0x5e25('0x5b'),'appdata':_0xa8dcca[_0x5e25('0x55')]+','+(_0x7ff2a[_0x5e25('0x38')][_0x5e25('0x5c')]||0x12c),'interval':_0x5e25('0x4d')});}return respondWithRpcPromise(_0x5e25('0x5d'),_0x5e25('0x5e'),_0x7ff2a);})['then'](function(_0x1449fb){_0x33150c(_0x1449fb);})[_0x5e25('0x1b')](function(_0x2ac510){_0x5adfd1(_0x505101[_0x5e25('0x17')](0x1f4,_0x2ac510[_0x5e25('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 114dbca..fe5284d 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 _0x798f=['length','faxAccount:','remove','update','emit','register'];(function(_0x27ef17,_0x5cf8ae){var _0x3dcd27=function(_0x73d7f){while(--_0x73d7f){_0x27ef17['push'](_0x27ef17['shift']());}};_0x3dcd27(++_0x5cf8ae);}(_0x798f,0x1be));var _0xf798=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x798f[_0x14add3];return _0x4a174f;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0xf798('0x0'),_0xf798('0x1')];function createListener(_0x420f82,_0x5e03d6){return function(_0x12fbfc){_0x5e03d6[_0xf798('0x2')](_0x420f82,_0x12fbfc);};}function removeListener(_0x537e20,_0x3dfb18){return function(){FaxAccountEvents['removeListener'](_0x537e20,_0x3dfb18);};}exports[_0xf798('0x3')]=function(_0x384144){for(var _0x53a280=0x0,_0x47beee=events[_0xf798('0x4')];_0x53a280<_0x47beee;_0x53a280++){var _0x5c5ad1=events[_0x53a280];var _0x2added=createListener(_0xf798('0x5')+_0x5c5ad1,_0x384144);FaxAccountEvents['on'](_0x5c5ad1,_0x2added);}}; \ No newline at end of file +var _0xe344=['faxAccount:','./faxAccount.events','save','remove','emit','removeListener','register','length'];(function(_0x4dca99,_0x9f7cb2){var _0x54fa6a=function(_0x2d79d2){while(--_0x2d79d2){_0x4dca99['push'](_0x4dca99['shift']());}};_0x54fa6a(++_0x9f7cb2);}(_0xe344,0x69));var _0x4e34=function(_0x24245b,_0x2212da){_0x24245b=_0x24245b-0x0;var _0x45ff13=_0xe344[_0x24245b];return _0x45ff13;};'use strict';var FaxAccountEvents=require(_0x4e34('0x0'));var events=[_0x4e34('0x1'),_0x4e34('0x2'),'update'];function createListener(_0x28eb86,_0x444f4e){return function(_0x3e6db5){_0x444f4e[_0x4e34('0x3')](_0x28eb86,_0x3e6db5);};}function removeListener(_0x496107,_0x2c5e98){return function(){FaxAccountEvents[_0x4e34('0x4')](_0x496107,_0x2c5e98);};}exports[_0x4e34('0x5')]=function(_0x893ca2){for(var _0xc46486=0x0,_0x56cc45=events[_0x4e34('0x6')];_0xc46486<_0x56cc45;_0xc46486++){var _0x9d5e0e=events[_0xc46486];var _0x2270ae=createListener(_0x4e34('0x7')+_0x9d5e0e,_0x893ca2);FaxAccountEvents['on'](_0x9d5e0e,_0x2270ae);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index d16d6a0..7e6d2b7 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 _0xf7af=['isAuthenticated','index','get','/describe','describe','show','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/users','getAgents','create','/:id/dispositions','addAnswer','post','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','addAgents','update','/:id','destroy','removeDispositions','delete','/:id/canned_answers','removeAnswers','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x543a79,_0x3145bc){var _0x160628=function(_0x48252b){while(--_0x48252b){_0x543a79['push'](_0x543a79['shift']());}};_0x160628(++_0x3145bc);}(_0xf7af,0x19c));var _0xff7a=function(_0x334574,_0x1b7eb7){_0x334574=_0x334574-0x0;var _0x282909=_0xf7af[_0x334574];return _0x282909;};'use strict';var multer=require(_0xff7a('0x0'));var util=require(_0xff7a('0x1'));var path=require(_0xff7a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xff7a('0x3')]();var fs_extra=require(_0xff7a('0x4'));var auth=require(_0xff7a('0x5'));var interaction=require(_0xff7a('0x6'));var config=require(_0xff7a('0x7'));var controller=require('./faxAccount.controller');router['get']('/',auth[_0xff7a('0x8')](),controller[_0xff7a('0x9')]);router[_0xff7a('0xa')](_0xff7a('0xb'),auth[_0xff7a('0x8')](),controller[_0xff7a('0xc')]);router[_0xff7a('0xa')]('/:id',auth[_0xff7a('0x8')](),controller[_0xff7a('0xd')]);router[_0xff7a('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xff7a('0xe')]);router[_0xff7a('0xa')]('/:id/canned_answers',auth[_0xff7a('0x8')](),controller[_0xff7a('0xf')]);router['get'](_0xff7a('0x10'),auth[_0xff7a('0x8')](),controller[_0xff7a('0x11')]);router[_0xff7a('0xa')](_0xff7a('0x12'),auth[_0xff7a('0x8')](),controller[_0xff7a('0x13')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xff7a('0x14')]);router['get'](_0xff7a('0x15'),auth['isAuthenticated'](),controller[_0xff7a('0x16')]);router['post']('/',auth[_0xff7a('0x8')](),controller[_0xff7a('0x17')]);router['post'](_0xff7a('0x18'),auth['isAuthenticated'](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0xff7a('0x8')](),controller[_0xff7a('0x19')]);router[_0xff7a('0x1a')](_0xff7a('0x10'),auth[_0xff7a('0x8')](),controller[_0xff7a('0x1b')]);router[_0xff7a('0x1a')](_0xff7a('0x12'),auth['isAuthenticated'](),controller[_0xff7a('0x1c')]);router[_0xff7a('0x1a')](_0xff7a('0x1d'),auth[_0xff7a('0x8')](),controller[_0xff7a('0x1e')]);router[_0xff7a('0x1a')](_0xff7a('0x1f'),auth['isAuthenticated'](),controller[_0xff7a('0x20')]);router[_0xff7a('0x1a')]('/:id/send',auth[_0xff7a('0x8')](),controller[_0xff7a('0x21')]);router['post'](_0xff7a('0x15'),auth[_0xff7a('0x8')](),controller[_0xff7a('0x22')]);router['put']('/:id',auth[_0xff7a('0x8')](),controller[_0xff7a('0x23')]);router['delete'](_0xff7a('0x24'),auth[_0xff7a('0x8')](),controller[_0xff7a('0x25')]);router['delete'](_0xff7a('0x18'),auth[_0xff7a('0x8')](),controller[_0xff7a('0x26')]);router[_0xff7a('0x27')](_0xff7a('0x28'),auth[_0xff7a('0x8')](),controller[_0xff7a('0x29')]);router['delete']('/:id/users',auth[_0xff7a('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x5c71=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/messages','getAgents','create','post','addAnswer','addInteraction','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id/users','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','exports'];(function(_0xd34da8,_0x52f307){var _0x52cc3e=function(_0x2dfc54){while(--_0x2dfc54){_0xd34da8['push'](_0xd34da8['shift']());}};_0x52cc3e(++_0x52f307);}(_0x5c71,0x1ae));var _0x15c7=function(_0x3a0a70,_0x586139){_0x3a0a70=_0x3a0a70-0x0;var _0x3501b8=_0x5c71[_0x3a0a70];return _0x3501b8;};'use strict';var multer=require(_0x15c7('0x0'));var util=require('util');var path=require(_0x15c7('0x1'));var timeout=require(_0x15c7('0x2'));var express=require(_0x15c7('0x3'));var router=express[_0x15c7('0x4')]();var fs_extra=require(_0x15c7('0x5'));var auth=require(_0x15c7('0x6'));var interaction=require(_0x15c7('0x7'));var config=require(_0x15c7('0x8'));var controller=require(_0x15c7('0x9'));router[_0x15c7('0xa')]('/',auth[_0x15c7('0xb')](),controller[_0x15c7('0xc')]);router['get']('/describe',auth[_0x15c7('0xb')](),controller['describe']);router[_0x15c7('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x15c7('0xd')]);router[_0x15c7('0xa')](_0x15c7('0xe'),auth[_0x15c7('0xb')](),controller[_0x15c7('0xf')]);router[_0x15c7('0xa')](_0x15c7('0x10'),auth[_0x15c7('0xb')](),controller[_0x15c7('0x11')]);router[_0x15c7('0xa')]('/:id/interactions',auth[_0x15c7('0xb')](),controller[_0x15c7('0x12')]);router['get']('/:id/applications',auth[_0x15c7('0xb')](),controller['getApplications']);router[_0x15c7('0xa')](_0x15c7('0x13'),auth['isAuthenticated'](),controller['getMessages']);router['get']('/:id/users',auth[_0x15c7('0xb')](),controller[_0x15c7('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x15c7('0x15')]);router[_0x15c7('0x16')](_0x15c7('0xe'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x15c7('0x16')](_0x15c7('0x10'),auth[_0x15c7('0xb')](),controller[_0x15c7('0x17')]);router[_0x15c7('0x16')]('/:id/interactions',auth[_0x15c7('0xb')](),controller[_0x15c7('0x18')]);router[_0x15c7('0x16')](_0x15c7('0x19'),auth['isAuthenticated'](),controller[_0x15c7('0x1a')]);router[_0x15c7('0x16')](_0x15c7('0x1b'),auth[_0x15c7('0xb')](),controller[_0x15c7('0x1c')]);router[_0x15c7('0x16')](_0x15c7('0x1d'),auth['isAuthenticated'](),controller[_0x15c7('0x1e')]);router[_0x15c7('0x16')](_0x15c7('0x1f'),auth[_0x15c7('0xb')](),controller[_0x15c7('0x20')]);router[_0x15c7('0x16')](_0x15c7('0x21'),auth[_0x15c7('0xb')](),controller[_0x15c7('0x22')]);router[_0x15c7('0x23')](_0x15c7('0x24'),auth[_0x15c7('0xb')](),controller[_0x15c7('0x25')]);router[_0x15c7('0x26')]('/:id',auth[_0x15c7('0xb')](),controller['destroy']);router[_0x15c7('0x26')]('/:id/dispositions',auth[_0x15c7('0xb')](),controller[_0x15c7('0x27')]);router['delete']('/:id/canned_answers',auth[_0x15c7('0xb')](),controller[_0x15c7('0x28')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x15c7('0x29')]);module[_0x15c7('0x2a')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 1abd88c..f11b84b 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 _0xe728=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x3c4370,_0x16a88b){var _0x184b69=function(_0xaa2d0d){while(--_0xaa2d0d){_0x3c4370['push'](_0x3c4370['shift']());}};_0x184b69(++_0x16a88b);}(_0xe728,0x13e));var _0x8e72=function(_0x2a3b93,_0x341682){_0x2a3b93=_0x2a3b93-0x0;var _0x247056=_0xe728[_0x2a3b93];return _0x247056;};'use strict';var Sequelize=require(_0x8e72('0x0'));module[_0x8e72('0x1')]={'priority':{'type':Sequelize[_0x8e72('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8e72('0x3')},'appdata':{'type':Sequelize[_0x8e72('0x4')]()},'description':{'type':Sequelize[_0x8e72('0x5')]},'interval':{'type':Sequelize[_0x8e72('0x5')],'defaultValue':_0x8e72('0x6')}}; \ No newline at end of file +var _0xa486=['INTEGER','STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa486,0xa6));var _0x6a48=function(_0x2c2407,_0xd8affa){_0x2c2407=_0x2c2407-0x0;var _0x4fd32e=_0xa486[_0x2c2407];return _0x4fd32e;};'use strict';var Sequelize=require(_0x6a48('0x0'));module[_0x6a48('0x1')]={'priority':{'type':Sequelize[_0x6a48('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6a48('0x3')],'allowNull':![],'defaultValue':_0x6a48('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6a48('0x3')],'defaultValue':_0x6a48('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 7609d77..09e72e9 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 _0x3c23=['sort','where','pick','merge','VIRTUAL','filter','options','FaxApplication','includeAll','include','findAll','rows','catch','params','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','destroy','then','stack','name','map','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x4511e6,_0x2c3afe){var _0x573951=function(_0x24f895){while(--_0x24f895){_0x4511e6['push'](_0x4511e6['shift']());}};_0x573951(++_0x2c3afe);}(_0x3c23,0x94));var _0x33c2=function(_0x3cd949,_0x1eaf90){_0x3cd949=_0x3cd949-0x0;var _0x387347=_0x3c23[_0x3cd949];return _0x387347;};'use strict';var emlformat=require(_0x33c2('0x0'));var rimraf=require(_0x33c2('0x1'));var zipdir=require(_0x33c2('0x2'));var jsonpatch=require(_0x33c2('0x3'));var rp=require(_0x33c2('0x4'));var moment=require('moment');var BPromise=require(_0x33c2('0x5'));var Mustache=require(_0x33c2('0x6'));var util=require(_0x33c2('0x7'));var path=require(_0x33c2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x33c2('0x9'));var fs=require('fs');var fs_extra=require(_0x33c2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x33c2('0xb'));var jsforce=require(_0x33c2('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x33c2('0xd'));var Papa=require(_0x33c2('0xe'));var Redis=require(_0x33c2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x33c2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x33c2('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x33c2('0x12'));var licenseUtil=require(_0x33c2('0x13'));var db=require(_0x33c2('0x14'))['db'];function respondWithStatusCode(_0x587666,_0x577b1f){_0x577b1f=_0x577b1f||0xcc;return function(_0x32e3af){if(_0x32e3af){return _0x587666[_0x33c2('0x15')](_0x577b1f);}return _0x587666[_0x33c2('0x16')](_0x577b1f)[_0x33c2('0x17')]();};}function respondWithResult(_0x4fc891,_0xc2d055){_0xc2d055=_0xc2d055||0xc8;return function(_0x4e8998){if(_0x4e8998){return _0x4fc891[_0x33c2('0x16')](_0xc2d055)[_0x33c2('0x18')](_0x4e8998);}};}function respondWithFilteredResult(_0x4103ff,_0x1d8e6f){return function(_0x2aa276){if(_0x2aa276){var _0x325a02=typeof _0x1d8e6f['offset']==='undefined'&&typeof _0x1d8e6f[_0x33c2('0x19')]===_0x33c2('0x1a');var _0x1b012=_0x2aa276[_0x33c2('0x1b')];var _0x4bb4b9=_0x325a02?0x0:_0x1d8e6f[_0x33c2('0x1c')];var _0x1fbffa=_0x325a02?_0x2aa276['count']:_0x1d8e6f['offset']+_0x1d8e6f[_0x33c2('0x19')];var _0x1401eb;if(_0x1fbffa>=_0x1b012){_0x1fbffa=_0x1b012;_0x1401eb=0xc8;}else{_0x1401eb=0xce;}_0x4103ff[_0x33c2('0x16')](_0x1401eb);return _0x4103ff[_0x33c2('0x1d')](_0x33c2('0x1e'),_0x4bb4b9+'-'+_0x1fbffa+'/'+_0x1b012)[_0x33c2('0x18')](_0x2aa276);}return null;};}function patchUpdates(_0x74ce40){return function(_0x2b5f48){try{jsonpatch['apply'](_0x2b5f48,_0x74ce40,!![]);}catch(_0x32c281){return BPromise[_0x33c2('0x1f')](_0x32c281);}return _0x2b5f48[_0x33c2('0x20')]();};}function saveUpdates(_0x314637,_0x20d1d9){return function(_0x1ba75d){if(_0x1ba75d){return _0x1ba75d[_0x33c2('0x21')](_0x314637)['then'](function(_0x2bf051){return _0x2bf051;});}return null;};}function removeEntity(_0x593a4d,_0x4cdaf2){return function(_0x51ff0f){if(_0x51ff0f){return _0x51ff0f[_0x33c2('0x22')]()[_0x33c2('0x23')](function(){_0x593a4d[_0x33c2('0x16')](0xcc)[_0x33c2('0x17')]();});}};}function handleEntityNotFound(_0x4e76c0,_0x191004){return function(_0x855315){if(!_0x855315){_0x4e76c0[_0x33c2('0x15')](0x194);}return _0x855315;};}function handleError(_0x399c8b,_0x8ce034){_0x8ce034=_0x8ce034||0x1f4;return function(_0x5f9ae6){logger['error'](_0x5f9ae6[_0x33c2('0x24')]);if(_0x5f9ae6[_0x33c2('0x25')]){delete _0x5f9ae6[_0x33c2('0x25')];}_0x399c8b[_0x33c2('0x16')](_0x8ce034)['send'](_0x5f9ae6);};}exports['index']=function(_0x1ff51c,_0x3fbd72){var _0x38a32c={},_0x4bc6e5={},_0x136fc3={'count':0x0,'rows':[]};var _0xd74a73=_[_0x33c2('0x26')](db['FaxApplication']['rawAttributes'],function(_0x497c7b){return{'name':_0x497c7b['fieldName'],'type':_0x497c7b[_0x33c2('0x27')]['key']};});_0x4bc6e5[_0x33c2('0x28')]=_[_0x33c2('0x26')](_0xd74a73,_0x33c2('0x25'));_0x4bc6e5[_0x33c2('0x29')]=_[_0x33c2('0x2a')](_0x1ff51c[_0x33c2('0x29')]);_0x4bc6e5[_0x33c2('0x2b')]=_[_0x33c2('0x2c')](_0x4bc6e5[_0x33c2('0x28')],_0x4bc6e5[_0x33c2('0x29')]);_0x38a32c[_0x33c2('0x2d')]=_[_0x33c2('0x2c')](_0x4bc6e5[_0x33c2('0x28')],qs[_0x33c2('0x2e')](_0x1ff51c[_0x33c2('0x29')][_0x33c2('0x2e')]));_0x38a32c[_0x33c2('0x2d')]=_0x38a32c['attributes']['length']?_0x38a32c['attributes']:_0x4bc6e5[_0x33c2('0x28')];if(!_0x1ff51c['query'][_0x33c2('0x2f')](_0x33c2('0x30'))){_0x38a32c[_0x33c2('0x19')]=qs[_0x33c2('0x19')](_0x1ff51c[_0x33c2('0x29')][_0x33c2('0x19')]);_0x38a32c[_0x33c2('0x1c')]=qs[_0x33c2('0x1c')](_0x1ff51c[_0x33c2('0x29')][_0x33c2('0x1c')]);}_0x38a32c[_0x33c2('0x31')]=qs[_0x33c2('0x32')](_0x1ff51c[_0x33c2('0x29')]['sort']);_0x38a32c[_0x33c2('0x33')]=qs[_0x33c2('0x2b')](_[_0x33c2('0x34')](_0x1ff51c['query'],_0x4bc6e5[_0x33c2('0x2b')]),_0xd74a73);if(_0x1ff51c[_0x33c2('0x29')]['filter']){_0x38a32c['where']=_[_0x33c2('0x35')](_0x38a32c[_0x33c2('0x33')],{'$or':_['map'](_0xd74a73,function(_0xd02e85){if(_0xd02e85[_0x33c2('0x27')]!==_0x33c2('0x36')){var _0x5d61a1={};_0x5d61a1[_0xd02e85[_0x33c2('0x25')]]={'$like':'%'+_0x1ff51c['query'][_0x33c2('0x37')]+'%'};return _0x5d61a1;}})});}_0x38a32c=_[_0x33c2('0x35')]({},_0x38a32c,_0x1ff51c[_0x33c2('0x38')]);var _0x4624cc={'where':_0x38a32c['where']};return db[_0x33c2('0x39')]['count'](_0x4624cc)[_0x33c2('0x23')](function(_0x52d85f){_0x136fc3[_0x33c2('0x1b')]=_0x52d85f;if(_0x1ff51c[_0x33c2('0x29')][_0x33c2('0x3a')]){_0x38a32c[_0x33c2('0x3b')]=[{'all':!![]}];}return db[_0x33c2('0x39')][_0x33c2('0x3c')](_0x38a32c);})[_0x33c2('0x23')](function(_0xa015){_0x136fc3[_0x33c2('0x3d')]=_0xa015;return _0x136fc3;})['then'](respondWithFilteredResult(_0x3fbd72,_0x38a32c))[_0x33c2('0x3e')](handleError(_0x3fbd72,null));};exports['show']=function(_0x4c90c4,_0x3f6f7d){var _0x33bf66={'raw':!![],'where':{'id':_0x4c90c4[_0x33c2('0x3f')]['id']}},_0x4f38b8={};_0x4f38b8[_0x33c2('0x28')]=_['keys'](db[_0x33c2('0x39')]['rawAttributes']);_0x4f38b8[_0x33c2('0x29')]=_[_0x33c2('0x2a')](_0x4c90c4[_0x33c2('0x29')]);_0x4f38b8[_0x33c2('0x2b')]=_['intersection'](_0x4f38b8['model'],_0x4f38b8[_0x33c2('0x29')]);_0x33bf66['attributes']=_[_0x33c2('0x2c')](_0x4f38b8[_0x33c2('0x28')],qs[_0x33c2('0x2e')](_0x4c90c4[_0x33c2('0x29')]['fields']));_0x33bf66[_0x33c2('0x2d')]=_0x33bf66['attributes']['length']?_0x33bf66['attributes']:_0x4f38b8[_0x33c2('0x28')];if(_0x4c90c4[_0x33c2('0x29')]['includeAll']){_0x33bf66[_0x33c2('0x3b')]=[{'all':!![]}];}_0x33bf66=_[_0x33c2('0x35')]({},_0x33bf66,_0x4c90c4[_0x33c2('0x38')]);return db['FaxApplication'][_0x33c2('0x40')](_0x33bf66)[_0x33c2('0x23')](handleEntityNotFound(_0x3f6f7d,null))[_0x33c2('0x23')](respondWithResult(_0x3f6f7d,null))[_0x33c2('0x3e')](handleError(_0x3f6f7d,null));};exports['create']=function(_0x4a871b,_0x2f2be0){return db[_0x33c2('0x39')]['create'](_0x4a871b['body'],{})['then'](respondWithResult(_0x2f2be0,0xc9))[_0x33c2('0x3e')](handleError(_0x2f2be0,null));};exports[_0x33c2('0x21')]=function(_0x17e475,_0x5f3a4e){if(_0x17e475['body']['id']){delete _0x17e475['body']['id'];}return db[_0x33c2('0x39')]['find']({'where':{'id':_0x17e475[_0x33c2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5f3a4e,null))[_0x33c2('0x23')](saveUpdates(_0x17e475[_0x33c2('0x41')],null))[_0x33c2('0x23')](respondWithResult(_0x5f3a4e,null))[_0x33c2('0x3e')](handleError(_0x5f3a4e,null));};exports[_0x33c2('0x22')]=function(_0x4bf9c5,_0x54a12e){return db[_0x33c2('0x39')][_0x33c2('0x40')]({'where':{'id':_0x4bf9c5[_0x33c2('0x3f')]['id']}})[_0x33c2('0x23')](handleEntityNotFound(_0x54a12e,null))[_0x33c2('0x23')](removeEntity(_0x54a12e,null))[_0x33c2('0x3e')](handleError(_0x54a12e,null));}; \ No newline at end of file +var _0xe5ed=['model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','count','includeAll','findAll','rows','catch','show','params','keys','length','include','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../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','reject','save','update','then','error','name','send','map','FaxApplication','rawAttributes','fieldName','key'];(function(_0x507c8e,_0x3f77b6){var _0xc4ba7a=function(_0x1a4a39){while(--_0x1a4a39){_0x507c8e['push'](_0x507c8e['shift']());}};_0xc4ba7a(++_0x3f77b6);}(_0xe5ed,0xa9));var _0xde5e=function(_0x1530f4,_0x15a0c8){_0x1530f4=_0x1530f4-0x0;var _0x20371f=_0xe5ed[_0x1530f4];return _0x20371f;};'use strict';var emlformat=require(_0xde5e('0x0'));var rimraf=require(_0xde5e('0x1'));var zipdir=require(_0xde5e('0x2'));var jsonpatch=require(_0xde5e('0x3'));var rp=require(_0xde5e('0x4'));var moment=require('moment');var BPromise=require(_0xde5e('0x5'));var Mustache=require(_0xde5e('0x6'));var util=require('util');var path=require('path');var sox=require(_0xde5e('0x7'));var csv=require(_0xde5e('0x8'));var ejs=require(_0xde5e('0x9'));var fs=require('fs');var fs_extra=require(_0xde5e('0xa'));var _=require('lodash');var squel=require(_0xde5e('0xb'));var crypto=require(_0xde5e('0xc'));var jsforce=require(_0xde5e('0xd'));var deskjs=require(_0xde5e('0xe'));var toCsv=require(_0xde5e('0x8'));var querystring=require(_0xde5e('0xf'));var Papa=require('papaparse');var Redis=require(_0xde5e('0x10'));var authService=require(_0xde5e('0x11'));var qs=require(_0xde5e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde5e('0x13'));var logger=require(_0xde5e('0x14'))(_0xde5e('0x15'));var utils=require(_0xde5e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xde5e('0x17'));var db=require(_0xde5e('0x18'))['db'];function respondWithStatusCode(_0x53f4d6,_0x1cfb2c){_0x1cfb2c=_0x1cfb2c||0xcc;return function(_0x2da3b4){if(_0x2da3b4){return _0x53f4d6[_0xde5e('0x19')](_0x1cfb2c);}return _0x53f4d6[_0xde5e('0x1a')](_0x1cfb2c)[_0xde5e('0x1b')]();};}function respondWithResult(_0x599781,_0x286933){_0x286933=_0x286933||0xc8;return function(_0x29c6dd){if(_0x29c6dd){return _0x599781[_0xde5e('0x1a')](_0x286933)[_0xde5e('0x1c')](_0x29c6dd);}};}function respondWithFilteredResult(_0x376815,_0x181584){return function(_0x2cbc97){if(_0x2cbc97){var _0x428bed=typeof _0x181584[_0xde5e('0x1d')]===_0xde5e('0x1e')&&typeof _0x181584[_0xde5e('0x1f')]==='undefined';var _0x693b98=_0x2cbc97['count'];var _0x259f3d=_0x428bed?0x0:_0x181584['offset'];var _0x58f45b=_0x428bed?_0x2cbc97['count']:_0x181584[_0xde5e('0x1d')]+_0x181584[_0xde5e('0x1f')];var _0x3df54a;if(_0x58f45b>=_0x693b98){_0x58f45b=_0x693b98;_0x3df54a=0xc8;}else{_0x3df54a=0xce;}_0x376815[_0xde5e('0x1a')](_0x3df54a);return _0x376815['set']('Content-Range',_0x259f3d+'-'+_0x58f45b+'/'+_0x693b98)[_0xde5e('0x1c')](_0x2cbc97);}return null;};}function patchUpdates(_0x1e8152){return function(_0x247056){try{jsonpatch['apply'](_0x247056,_0x1e8152,!![]);}catch(_0x4e22a5){return BPromise[_0xde5e('0x20')](_0x4e22a5);}return _0x247056[_0xde5e('0x21')]();};}function saveUpdates(_0x5c56c8,_0x1c10f3){return function(_0x341f79){if(_0x341f79){return _0x341f79[_0xde5e('0x22')](_0x5c56c8)[_0xde5e('0x23')](function(_0x3a69e9){return _0x3a69e9;});}return null;};}function removeEntity(_0x90761c,_0x356b89){return function(_0x154e35){if(_0x154e35){return _0x154e35['destroy']()[_0xde5e('0x23')](function(){_0x90761c['status'](0xcc)[_0xde5e('0x1b')]();});}};}function handleEntityNotFound(_0x27d51f,_0x2014f8){return function(_0x18e019){if(!_0x18e019){_0x27d51f[_0xde5e('0x19')](0x194);}return _0x18e019;};}function handleError(_0x5ef347,_0x10b39f){_0x10b39f=_0x10b39f||0x1f4;return function(_0x11311f){logger[_0xde5e('0x24')](_0x11311f['stack']);if(_0x11311f['name']){delete _0x11311f[_0xde5e('0x25')];}_0x5ef347[_0xde5e('0x1a')](_0x10b39f)[_0xde5e('0x26')](_0x11311f);};}exports['index']=function(_0x2a205d,_0xec5363){var _0x1d222e={},_0x2f1854={},_0x37935a={'count':0x0,'rows':[]};var _0x562d90=_[_0xde5e('0x27')](db[_0xde5e('0x28')][_0xde5e('0x29')],function(_0x409b6b){return{'name':_0x409b6b[_0xde5e('0x2a')],'type':_0x409b6b['type'][_0xde5e('0x2b')]};});_0x2f1854[_0xde5e('0x2c')]=_[_0xde5e('0x27')](_0x562d90,'name');_0x2f1854[_0xde5e('0x2d')]=_['keys'](_0x2a205d[_0xde5e('0x2d')]);_0x2f1854[_0xde5e('0x2e')]=_[_0xde5e('0x2f')](_0x2f1854[_0xde5e('0x2c')],_0x2f1854[_0xde5e('0x2d')]);_0x1d222e[_0xde5e('0x30')]=_['intersection'](_0x2f1854[_0xde5e('0x2c')],qs[_0xde5e('0x31')](_0x2a205d[_0xde5e('0x2d')]['fields']));_0x1d222e[_0xde5e('0x30')]=_0x1d222e['attributes']['length']?_0x1d222e[_0xde5e('0x30')]:_0x2f1854[_0xde5e('0x2c')];if(!_0x2a205d['query'][_0xde5e('0x32')](_0xde5e('0x33'))){_0x1d222e[_0xde5e('0x1f')]=qs[_0xde5e('0x1f')](_0x2a205d[_0xde5e('0x2d')][_0xde5e('0x1f')]);_0x1d222e[_0xde5e('0x1d')]=qs[_0xde5e('0x1d')](_0x2a205d[_0xde5e('0x2d')][_0xde5e('0x1d')]);}_0x1d222e['order']=qs[_0xde5e('0x34')](_0x2a205d['query'][_0xde5e('0x34')]);_0x1d222e[_0xde5e('0x35')]=qs[_0xde5e('0x2e')](_[_0xde5e('0x36')](_0x2a205d[_0xde5e('0x2d')],_0x2f1854[_0xde5e('0x2e')]),_0x562d90);if(_0x2a205d[_0xde5e('0x2d')][_0xde5e('0x37')]){_0x1d222e['where']=_[_0xde5e('0x38')](_0x1d222e[_0xde5e('0x35')],{'$or':_[_0xde5e('0x27')](_0x562d90,function(_0x449c76){if(_0x449c76['type']!=='VIRTUAL'){var _0x3d3c66={};_0x3d3c66[_0x449c76[_0xde5e('0x25')]]={'$like':'%'+_0x2a205d[_0xde5e('0x2d')]['filter']+'%'};return _0x3d3c66;}})});}_0x1d222e=_[_0xde5e('0x38')]({},_0x1d222e,_0x2a205d['options']);var _0x24f7a9={'where':_0x1d222e['where']};return db[_0xde5e('0x28')][_0xde5e('0x39')](_0x24f7a9)[_0xde5e('0x23')](function(_0x192765){_0x37935a[_0xde5e('0x39')]=_0x192765;if(_0x2a205d[_0xde5e('0x2d')][_0xde5e('0x3a')]){_0x1d222e['include']=[{'all':!![]}];}return db[_0xde5e('0x28')][_0xde5e('0x3b')](_0x1d222e);})[_0xde5e('0x23')](function(_0xfba01d){_0x37935a[_0xde5e('0x3c')]=_0xfba01d;return _0x37935a;})[_0xde5e('0x23')](respondWithFilteredResult(_0xec5363,_0x1d222e))[_0xde5e('0x3d')](handleError(_0xec5363,null));};exports[_0xde5e('0x3e')]=function(_0x50a082,_0x427303){var _0x32dd04={'raw':!![],'where':{'id':_0x50a082[_0xde5e('0x3f')]['id']}},_0x136696={};_0x136696[_0xde5e('0x2c')]=_[_0xde5e('0x40')](db[_0xde5e('0x28')]['rawAttributes']);_0x136696['query']=_[_0xde5e('0x40')](_0x50a082[_0xde5e('0x2d')]);_0x136696[_0xde5e('0x2e')]=_['intersection'](_0x136696[_0xde5e('0x2c')],_0x136696[_0xde5e('0x2d')]);_0x32dd04['attributes']=_['intersection'](_0x136696['model'],qs[_0xde5e('0x31')](_0x50a082[_0xde5e('0x2d')][_0xde5e('0x31')]));_0x32dd04['attributes']=_0x32dd04[_0xde5e('0x30')][_0xde5e('0x41')]?_0x32dd04[_0xde5e('0x30')]:_0x136696[_0xde5e('0x2c')];if(_0x50a082['query'][_0xde5e('0x3a')]){_0x32dd04[_0xde5e('0x42')]=[{'all':!![]}];}_0x32dd04=_[_0xde5e('0x38')]({},_0x32dd04,_0x50a082[_0xde5e('0x43')]);return db[_0xde5e('0x28')]['find'](_0x32dd04)[_0xde5e('0x23')](handleEntityNotFound(_0x427303,null))[_0xde5e('0x23')](respondWithResult(_0x427303,null))[_0xde5e('0x3d')](handleError(_0x427303,null));};exports[_0xde5e('0x44')]=function(_0x38bbd0,_0x4643dd){return db['FaxApplication'][_0xde5e('0x44')](_0x38bbd0[_0xde5e('0x45')],{})[_0xde5e('0x23')](respondWithResult(_0x4643dd,0xc9))[_0xde5e('0x3d')](handleError(_0x4643dd,null));};exports[_0xde5e('0x22')]=function(_0x33e200,_0x5b7c01){if(_0x33e200['body']['id']){delete _0x33e200['body']['id'];}return db[_0xde5e('0x28')][_0xde5e('0x46')]({'where':{'id':_0x33e200['params']['id']}})['then'](handleEntityNotFound(_0x5b7c01,null))['then'](saveUpdates(_0x33e200['body'],null))[_0xde5e('0x23')](respondWithResult(_0x5b7c01,null))[_0xde5e('0x3d')](handleError(_0x5b7c01,null));};exports['destroy']=function(_0x375318,_0x481f53){return db[_0xde5e('0x28')]['find']({'where':{'id':_0x375318[_0xde5e('0x3f')]['id']}})[_0xde5e('0x23')](handleEntityNotFound(_0x481f53,null))[_0xde5e('0x23')](removeEntity(_0x481f53,null))[_0xde5e('0x3d')](handleError(_0x481f53,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 3cde912..9f7d588 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 _0x8d64=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5bfa44,_0x76dacc){var _0x43815f=function(_0x307fca){while(--_0x307fca){_0x5bfa44['push'](_0x5bfa44['shift']());}};_0x43815f(++_0x76dacc);}(_0x8d64,0x151));var _0x48d6=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x8d64[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x48d6('0x0'));var util=require(_0x48d6('0x1'));var logger=require('../../config/logger')(_0x48d6('0x2'));var moment=require(_0x48d6('0x3'));var BPromise=require(_0x48d6('0x4'));var rp=require(_0x48d6('0x5'));var fs=require('fs');var path=require(_0x48d6('0x6'));var rimraf=require('rimraf');var config=require(_0x48d6('0x7'));var attributes=require(_0x48d6('0x8'));module['exports']=function(_0x2b7ce8,_0x309586){return _0x2b7ce8['define'](_0x48d6('0x9'),attributes,{'tableName':_0x48d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x48d6('0xb'),'collate':_0x48d6('0xc')});}; \ No newline at end of file +var _0xfd9e=['FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports'];(function(_0x3e89e1,_0xcac5c){var _0x507092=function(_0xa58665){while(--_0xa58665){_0x3e89e1['push'](_0x3e89e1['shift']());}};_0x507092(++_0xcac5c);}(_0xfd9e,0x138));var _0xefd9=function(_0x46a2f1,_0x4055c1){_0x46a2f1=_0x46a2f1-0x0;var _0x5cb140=_0xfd9e[_0x46a2f1];return _0x5cb140;};'use strict';var _=require(_0xefd9('0x0'));var util=require('util');var logger=require(_0xefd9('0x1'))(_0xefd9('0x2'));var moment=require(_0xefd9('0x3'));var BPromise=require(_0xefd9('0x4'));var rp=require(_0xefd9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xefd9('0x6'));var config=require(_0xefd9('0x7'));var attributes=require(_0xefd9('0x8'));module[_0xefd9('0x9')]=function(_0x23b970,_0x361b16){return _0x23b970['define'](_0xefd9('0xa'),attributes,{'tableName':_0xefd9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xefd9('0xc'),'collate':_0xefd9('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 0eaa004..208dd44 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 _0xe531=['FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','FaxApplication','options','where','attributes','then','UpdateFaxApplication','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe531,0x64));var _0x1e53=function(_0x365135,_0x21d6cd){_0x365135=_0x365135-0x0;var _0x5b00c0=_0xe531[_0x365135];return _0x5b00c0;};'use strict';var _=require(_0x1e53('0x0'));var util=require(_0x1e53('0x1'));var moment=require(_0x1e53('0x2'));var BPromise=require('bluebird');var rs=require(_0x1e53('0x3'));var fs=require('fs');var Redis=require(_0x1e53('0x4'));var db=require(_0x1e53('0x5'))['db'];var utils=require(_0x1e53('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1e53('0x7'));var jayson=require(_0x1e53('0x8'));var client=jayson[_0x1e53('0x9')][_0x1e53('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31f5b5,_0x5095b9,_0x29c3c0){return new BPromise(function(_0x1d0b7e,_0x21d3eb){return client[_0x1e53('0xb')](_0x31f5b5,_0x29c3c0)['then'](function(_0xb50f09){logger['info'](_0x1e53('0xc'),_0x5095b9,_0x1e53('0xd'));logger[_0x1e53('0xe')](_0x1e53('0xf'),_0x5095b9,_0x1e53('0xd'),JSON[_0x1e53('0x10')](_0xb50f09));if(_0xb50f09[_0x1e53('0x11')]){if(_0xb50f09[_0x1e53('0x11')]['code']===0x1f4){logger[_0x1e53('0x11')]('FaxApplication,\x20%s,\x20%s',_0x5095b9,_0xb50f09['error'][_0x1e53('0x12')]);return _0x21d3eb(_0xb50f09['error']['message']);}logger[_0x1e53('0x11')]('FaxApplication,\x20%s,\x20%s',_0x5095b9,_0xb50f09[_0x1e53('0x11')][_0x1e53('0x12')]);return _0x1d0b7e(_0xb50f09[_0x1e53('0x11')]['message']);}else{logger[_0x1e53('0x13')](_0x1e53('0xc'),_0x5095b9,_0x1e53('0xd'));_0x1d0b7e(_0xb50f09[_0x1e53('0x14')][_0x1e53('0x12')]);}})[_0x1e53('0x15')](function(_0x36300f){logger['error'](_0x1e53('0xc'),_0x5095b9,_0x36300f);_0x21d3eb(_0x36300f);});});}exports['UpdateFaxApplication']=function(_0x5e334d){var _0x4be00c=this;return new Promise(function(_0x3e3bb0,_0x39d71f){return db[_0x1e53('0x16')]['update'](_0x5e334d['body'],{'raw':_0x5e334d[_0x1e53('0x17')]?_0x5e334d[_0x1e53('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e334d['options']?_0x5e334d[_0x1e53('0x17')][_0x1e53('0x18')]||null:null,'attributes':_0x5e334d['options']?_0x5e334d[_0x1e53('0x17')][_0x1e53('0x19')]||null:null,'limit':_0x5e334d[_0x1e53('0x17')]?_0x5e334d[_0x1e53('0x17')]['limit']||null:null})[_0x1e53('0x1a')](function(_0x36e20f){logger[_0x1e53('0x13')](_0x1e53('0x1b'),_0x5e334d);logger[_0x1e53('0xe')](_0x1e53('0x1b'),_0x5e334d,JSON['stringify'](_0x36e20f));_0x3e3bb0(_0x36e20f);})[_0x1e53('0x15')](function(_0x452c32){logger[_0x1e53('0x11')](_0x1e53('0x1b'),_0x452c32[_0x1e53('0x12')],_0x5e334d);_0x39d71f(_0x4be00c[_0x1e53('0x11')](0x1f4,_0x452c32[_0x1e53('0x12')]));});});}; \ No newline at end of file +var _0x9682=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','update','body','options','raw','attributes','limit','lodash','util'];(function(_0x383f07,_0x1fb25d){var _0x156529=function(_0xf326b7){while(--_0xf326b7){_0x383f07['push'](_0x383f07['shift']());}};_0x156529(++_0x1fb25d);}(_0x9682,0x134));var _0x2968=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9682[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x2968('0x0'));var util=require(_0x2968('0x1'));var moment=require(_0x2968('0x2'));var BPromise=require(_0x2968('0x3'));var rs=require(_0x2968('0x4'));var fs=require('fs');var Redis=require(_0x2968('0x5'));var db=require(_0x2968('0x6'))['db'];var utils=require(_0x2968('0x7'));var logger=require(_0x2968('0x8'))(_0x2968('0x9'));var config=require('../../config/environment');var jayson=require(_0x2968('0xa'));var client=jayson['client'][_0x2968('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x377711,_0x440eb0,_0x1dfc39){return new BPromise(function(_0x2cfe96,_0x45f5c8){return client[_0x2968('0xc')](_0x377711,_0x1dfc39)[_0x2968('0xd')](function(_0x55fdcd){logger[_0x2968('0xe')]('FaxApplication,\x20%s,\x20%s',_0x440eb0,_0x2968('0xf'));logger[_0x2968('0x10')](_0x2968('0x11'),_0x440eb0,'request\x20sent',JSON[_0x2968('0x12')](_0x55fdcd));if(_0x55fdcd[_0x2968('0x13')]){if(_0x55fdcd[_0x2968('0x13')]['code']===0x1f4){logger['error'](_0x2968('0x14'),_0x440eb0,_0x55fdcd[_0x2968('0x13')][_0x2968('0x15')]);return _0x45f5c8(_0x55fdcd[_0x2968('0x13')]['message']);}logger[_0x2968('0x13')](_0x2968('0x14'),_0x440eb0,_0x55fdcd[_0x2968('0x13')][_0x2968('0x15')]);return _0x2cfe96(_0x55fdcd['error']['message']);}else{logger[_0x2968('0xe')](_0x2968('0x14'),_0x440eb0,'request\x20sent');_0x2cfe96(_0x55fdcd[_0x2968('0x16')]['message']);}})[_0x2968('0x17')](function(_0x38004d){logger[_0x2968('0x13')](_0x2968('0x14'),_0x440eb0,_0x38004d);_0x45f5c8(_0x38004d);});});}exports[_0x2968('0x18')]=function(_0x6dbdb1){var _0x4307dd=this;return new Promise(function(_0x4c591b,_0x512d61){return db['FaxApplication'][_0x2968('0x19')](_0x6dbdb1[_0x2968('0x1a')],{'raw':_0x6dbdb1[_0x2968('0x1b')]?_0x6dbdb1['options'][_0x2968('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6dbdb1[_0x2968('0x1b')]?_0x6dbdb1[_0x2968('0x1b')]['where']||null:null,'attributes':_0x6dbdb1['options']?_0x6dbdb1['options'][_0x2968('0x1d')]||null:null,'limit':_0x6dbdb1[_0x2968('0x1b')]?_0x6dbdb1[_0x2968('0x1b')][_0x2968('0x1e')]||null:null})[_0x2968('0xd')](function(_0x1b96d5){logger['info'](_0x2968('0x18'),_0x6dbdb1);logger[_0x2968('0x10')](_0x2968('0x18'),_0x6dbdb1,JSON['stringify'](_0x1b96d5));_0x4c591b(_0x1b96d5);})['catch'](function(_0x4622d4){logger[_0x2968('0x13')](_0x2968('0x18'),_0x4622d4[_0x2968('0x15')],_0x6dbdb1);_0x512d61(_0x4307dd['error'](0x1f4,_0x4622d4['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 4d4f782..671e659 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 _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4ff3b9,_0xe79494){var _0x2890f7=function(_0x4a953e){while(--_0x4a953e){_0x4ff3b9['push'](_0x4ff3b9['shift']());}};_0x2890f7(++_0xe79494);}(_0xac4a,0x13f));var _0xaac4=function(_0x2de4a9,_0x9baa43){_0x2de4a9=_0x2de4a9-0x0;var _0x585801=_0xac4a[_0x2de4a9];return _0x585801;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router; \ No newline at end of file +var _0xea28=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xea28,0x13a));var _0x8ea2=function(_0x34ea72,_0x506652){_0x34ea72=_0x34ea72-0x0;var _0x132544=_0xea28[_0x34ea72];return _0x132544;};'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('0xf')]('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0x11')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x12')]);router['delete']('/:id',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);module[_0x8ea2('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 8210fe3..0a5bda1 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 _0x7096=['STRING','ENUM','out','INTEGER','exports','DATE'];(function(_0xcd93fd,_0x3519fe){var _0x49b971=function(_0x27de1b){while(--_0x27de1b){_0xcd93fd['push'](_0xcd93fd['shift']());}};_0x49b971(++_0x3519fe);}(_0x7096,0x10c));var _0x6709=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x7096[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require('sequelize');module[_0x6709('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6709('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6709('0x2')]},'thirdDisposition':{'type':Sequelize[_0x6709('0x2')]},'note':{'type':Sequelize[_0x6709('0x2')]},'read1stAt':{'type':Sequelize[_0x6709('0x1')]},'fax':{'type':Sequelize[_0x6709('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x6709('0x3')]('in',_0x6709('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6709('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x6709('0x3')]('in',_0x6709('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x6709('0x5')]}}; \ No newline at end of file +var _0x1a85=['STRING','out','ENUM','INTEGER','BOOLEAN','DATE'];(function(_0xc87da8,_0x7212e8){var _0xc7a390=function(_0x2b1db3){while(--_0x2b1db3){_0xc87da8['push'](_0xc87da8['shift']());}};_0xc7a390(++_0x7212e8);}(_0x1a85,0x178));var _0x51a8=function(_0x1ca995,_0x458edc){_0x1ca995=_0x1ca995-0x0;var _0x6c1cbb=_0x1a85[_0x1ca995];return _0x6c1cbb;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x51a8('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x51a8('0x1')]},'disposition':{'type':Sequelize[_0x51a8('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x51a8('0x2')]},'read1stAt':{'type':Sequelize[_0x51a8('0x1')]},'fax':{'type':Sequelize[_0x51a8('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x51a8('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x51a8('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x51a8('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 0b788f0..87109ae 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 _0xd8aa=['get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','update','destroy','then','error','name','send','map','FaxInteraction','rawAttributes','fieldName','key','getOptions','findAll','fax','query','user','catch','show','params','model','keys','filters','attributes','intersection','fields','length','include','options','create','body','find','describe','addMessage','FaxMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','setTags','spread','removeTags','download','unix','toString','root','server','join','format','transcript-%d-%s.zip','push','Attachment','Messages','createdAt'];(function(_0x488818,_0x17c6de){var _0x30783c=function(_0x1b418c){while(--_0x1b418c){_0x488818['push'](_0x488818['shift']());}};_0x30783c(++_0x17c6de);}(_0xd8aa,0x1ab));var _0xad8a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xd8aa[_0x432682];return _0x463d05;};'use strict';var rimraf=require(_0xad8a('0x0'));var zipdir=require(_0xad8a('0x1'));var moment=require(_0xad8a('0x2'));var BPromise=require(_0xad8a('0x3'));var util=require(_0xad8a('0x4'));var path=require(_0xad8a('0x5'));var fs=require('fs');var _=require(_0xad8a('0x6'));var Redis=require(_0xad8a('0x7'));var interaction=require(_0xad8a('0x8'));var qs=require(_0xad8a('0x9'));var logger=require(_0xad8a('0xa'))(_0xad8a('0xb'));var config=require(_0xad8a('0xc'));var db=require(_0xad8a('0xd'))['db'];config[_0xad8a('0xe')]=_['defaults'](config['redis'],{'host':_0xad8a('0xf'),'port':0x18eb});var socket=require(_0xad8a('0x10'))(new Redis(config[_0xad8a('0xe')]));require(_0xad8a('0x11'))[_0xad8a('0x12')](socket);function respondWithStatusCode(_0x3c5c6e,_0x5a3e9f){_0x5a3e9f=_0x5a3e9f||0xcc;return function(_0xf65afb){if(_0xf65afb){return _0x3c5c6e[_0xad8a('0x13')](_0x5a3e9f);}return _0x3c5c6e[_0xad8a('0x14')](_0x5a3e9f)[_0xad8a('0x15')]();};}function respondWithResult(_0x17ede8,_0x15cd28){_0x15cd28=_0x15cd28||0xc8;return function(_0x5615e1){if(_0x5615e1){return _0x17ede8[_0xad8a('0x14')](_0x15cd28)[_0xad8a('0x16')](_0x5615e1);}};}function respondWithFilteredResult(_0x31dd43,_0x247461){return function(_0x227f41){if(_0x227f41){var _0x3d1f79=typeof _0x247461[_0xad8a('0x17')]==='undefined'&&typeof _0x247461['limit']===_0xad8a('0x18');var _0x1fa87d=_0x227f41[_0xad8a('0x19')];var _0xfe5e47=_0x3d1f79?0x0:_0x247461[_0xad8a('0x17')];var _0x372219=_0x3d1f79?_0x227f41['count']:_0x247461[_0xad8a('0x17')]+_0x247461[_0xad8a('0x1a')];var _0x531587;if(_0x372219>=_0x1fa87d){_0x372219=_0x1fa87d;_0x531587=0xc8;}else{_0x531587=0xce;}_0x31dd43['status'](_0x531587);return _0x31dd43['set']('Content-Range',_0xfe5e47+'-'+_0x372219+'/'+_0x1fa87d)[_0xad8a('0x16')](_0x227f41);}return null;};}function saveUpdates(_0x4497e8){return function(_0xfa0223){if(_0xfa0223){return _0xfa0223[_0xad8a('0x1b')](_0x4497e8)['then'](function(_0x32af7){return _0x32af7;});}return null;};}function removeEntity(_0x20dfec){return function(_0x569c8e){if(_0x569c8e){return _0x569c8e[_0xad8a('0x1c')]()[_0xad8a('0x1d')](function(){_0x20dfec[_0xad8a('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f0dfd){return function(_0x387553){if(!_0x387553){_0x5f0dfd[_0xad8a('0x13')](0x194);}return _0x387553;};}function handleError(_0x4fd2ec,_0x5359ac){_0x5359ac=_0x5359ac||0x1f4;return function(_0x3d8db1){logger[_0xad8a('0x1e')](_0x3d8db1['stack']);if(_0x3d8db1['name']){delete _0x3d8db1[_0xad8a('0x1f')];}_0x4fd2ec[_0xad8a('0x14')](_0x5359ac)[_0xad8a('0x20')](_0x3d8db1);};}exports['index']=function(_0x3c1c3a,_0x1e1b15){var _0x11dd5d={};var _0x106a4b=_[_0xad8a('0x21')](db[_0xad8a('0x22')][_0xad8a('0x23')],function(_0x4eef25){return{'name':_0x4eef25[_0xad8a('0x24')],'type':_0x4eef25['type'][_0xad8a('0x25')]};});_0x11dd5d=qs[_0xad8a('0x26')](_0x106a4b,_0x3c1c3a);return interaction[_0xad8a('0x27')](_0xad8a('0x28'),_0x3c1c3a[_0xad8a('0x29')],_0x3c1c3a[_0xad8a('0x2a')],_0x11dd5d,_0x106a4b)[_0xad8a('0x1d')](respondWithFilteredResult(_0x1e1b15,_0x11dd5d))[_0xad8a('0x2b')](handleError(_0x1e1b15,null));};exports[_0xad8a('0x2c')]=function(_0x3557a9,_0x3e2af4){var _0x352ba1={'raw':![],'where':{'id':_0x3557a9[_0xad8a('0x2d')]['id']}},_0x428b26={};_0x428b26[_0xad8a('0x2e')]=_[_0xad8a('0x2f')](db[_0xad8a('0x22')][_0xad8a('0x23')]);_0x428b26[_0xad8a('0x29')]=_[_0xad8a('0x2f')](_0x3557a9[_0xad8a('0x29')]);_0x428b26[_0xad8a('0x30')]=_['intersection'](_0x428b26[_0xad8a('0x2e')],_0x428b26['query']);_0x352ba1[_0xad8a('0x31')]=_[_0xad8a('0x32')](_0x428b26['model'],qs[_0xad8a('0x33')](_0x3557a9[_0xad8a('0x29')][_0xad8a('0x33')]));_0x352ba1['attributes']=_0x352ba1[_0xad8a('0x31')][_0xad8a('0x34')]?_0x352ba1[_0xad8a('0x31')]:_0x428b26[_0xad8a('0x2e')];if(_0x3557a9['query']['includeAll']){_0x352ba1[_0xad8a('0x35')]=[{'all':!![]}];}_0x352ba1=_['merge']({},_0x352ba1,_0x3557a9[_0xad8a('0x36')]);return db[_0xad8a('0x22')]['find'](_0x352ba1)[_0xad8a('0x1d')](handleEntityNotFound(_0x3e2af4,null))[_0xad8a('0x1d')](respondWithResult(_0x3e2af4,null))['catch'](handleError(_0x3e2af4,null));};exports['create']=function(_0x503d78,_0x219f88){return db['FaxInteraction'][_0xad8a('0x37')](_0x503d78[_0xad8a('0x38')],{})['then'](respondWithResult(_0x219f88,0xc9))['catch'](handleError(_0x219f88,null));};exports[_0xad8a('0x1b')]=function(_0x7d118,_0x3df33f){if(_0x7d118[_0xad8a('0x38')]['id']){delete _0x7d118[_0xad8a('0x38')]['id'];}return db[_0xad8a('0x22')]['find']({'where':{'id':_0x7d118[_0xad8a('0x2d')]['id']}})[_0xad8a('0x1d')](handleEntityNotFound(_0x3df33f,null))[_0xad8a('0x1d')](saveUpdates(_0x7d118[_0xad8a('0x38')],null))[_0xad8a('0x1d')](respondWithResult(_0x3df33f,null))[_0xad8a('0x2b')](handleError(_0x3df33f,null));};exports[_0xad8a('0x1c')]=function(_0x10fd95,_0x33550b){return db['FaxInteraction'][_0xad8a('0x39')]({'where':{'id':_0x10fd95[_0xad8a('0x2d')]['id']}})[_0xad8a('0x1d')](handleEntityNotFound(_0x33550b,null))[_0xad8a('0x1d')](removeEntity(_0x33550b,null))['catch'](handleError(_0x33550b,null));};exports[_0xad8a('0x3a')]=function(_0x4f5fc0,_0x464270){return db['FaxInteraction'][_0xad8a('0x3a')]()[_0xad8a('0x1d')](respondWithResult(_0x464270,null))['catch'](handleError(_0x464270,null));};exports[_0xad8a('0x3b')]=function(_0x20b124,_0x38c247){return db[_0xad8a('0x3c')][_0xad8a('0x39')]({'where':{'id':_0x20b124[_0xad8a('0x2d')]['id']}})[_0xad8a('0x1d')](handleEntityNotFound(_0x38c247,null))[_0xad8a('0x1d')](function(_0x1c3bf6){if(_0x1c3bf6){return _0x1c3bf6[_0xad8a('0x3b')](_0x20b124[_0xad8a('0x38')][_0xad8a('0x3d')],_[_0xad8a('0x3e')](_0x20b124['body'],[_0xad8a('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x38c247,null))[_0xad8a('0x2b')](handleError(_0x38c247,null));};exports[_0xad8a('0x3f')]=function(_0x480b89,_0x172c55){var _0x48078={'raw':![],'where':{}};var _0x2cd42b={};var _0x3ae406={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x480b89['params']['id']}})[_0xad8a('0x1d')](handleEntityNotFound(_0x172c55,null))[_0xad8a('0x1d')](function(_0x75166){if(_0x75166){_0x2cd42b[_0xad8a('0x2e')]=_[_0xad8a('0x2f')](db['FaxMessage'][_0xad8a('0x23')]);_0x2cd42b[_0xad8a('0x29')]=_[_0xad8a('0x2f')](_0x480b89['query']);_0x2cd42b[_0xad8a('0x30')]=_[_0xad8a('0x32')](_0x2cd42b['model'],_0x2cd42b[_0xad8a('0x29')]);_0x48078[_0xad8a('0x31')]=_[_0xad8a('0x32')](_0x2cd42b['model'],qs[_0xad8a('0x33')](_0x480b89['query'][_0xad8a('0x33')]));_0x48078[_0xad8a('0x31')]=_0x48078[_0xad8a('0x31')][_0xad8a('0x34')]?_0x48078[_0xad8a('0x31')]:_0x2cd42b[_0xad8a('0x2e')];if(!_0x480b89[_0xad8a('0x29')][_0xad8a('0x40')](_0xad8a('0x41'))){_0x48078[_0xad8a('0x1a')]=qs[_0xad8a('0x1a')](_0x480b89[_0xad8a('0x29')][_0xad8a('0x1a')]);_0x48078['offset']=qs[_0xad8a('0x17')](_0x480b89[_0xad8a('0x29')][_0xad8a('0x17')]);}_0x48078[_0xad8a('0x42')]=qs[_0xad8a('0x43')](_0x480b89[_0xad8a('0x29')]['sort']);_0x48078[_0xad8a('0x44')]=qs[_0xad8a('0x30')](_[_0xad8a('0x45')](_0x480b89[_0xad8a('0x29')],_0x2cd42b[_0xad8a('0x30')]));_0x48078[_0xad8a('0x44')][_0xad8a('0x46')]=_0x75166['id'];if(_0x480b89[_0xad8a('0x29')][_0xad8a('0x47')]){_0x48078[_0xad8a('0x44')]=_[_0xad8a('0x48')](_0x48078[_0xad8a('0x44')],{'$or':_[_0xad8a('0x21')](_0x48078[_0xad8a('0x31')],function(_0x321709){var _0x236e1d={};_0x236e1d[_0x321709]={'$like':'%'+_0x480b89[_0xad8a('0x29')][_0xad8a('0x47')]+'%'};return _0x236e1d;})});}if(_0x480b89['query'][_0xad8a('0x49')]){var _0x3e698e=_0x480b89['query'][_0xad8a('0x49')][_0xad8a('0x4a')](',');var _0x23b47c={};_0x23b47c[_0x3e698e[0x0]]={'$gte':moment(_0x3e698e[0x1])['format'](_0xad8a('0x4b'))};_0x48078['where']=_[_0xad8a('0x48')](_0x48078['where'],_0x23b47c);}_0x48078=_[_0xad8a('0x48')]({},_0x48078,_0x480b89[_0xad8a('0x36')]);return db[_0xad8a('0x3c')]['count']({'where':_0x48078[_0xad8a('0x44')]})[_0xad8a('0x1d')](function(_0x536445){_0x3ae406[_0xad8a('0x19')]=_0x536445;if(_0x480b89[_0xad8a('0x29')][_0xad8a('0x4c')]){_0x48078['include']=[{'all':!![]}];}return db[_0xad8a('0x3c')][_0xad8a('0x27')](_0x48078);})[_0xad8a('0x1d')](function(_0x12767a){_0x3ae406['rows']=_0x12767a;return _0x3ae406;});}})[_0xad8a('0x1d')](respondWithFilteredResult(_0x172c55,_0x48078))['catch'](handleError(_0x172c55,null));};exports[_0xad8a('0x4d')]=function(_0x5f064c,_0x24d085){return db[_0xad8a('0x22')][_0xad8a('0x39')]({'where':{'id':_0x5f064c[_0xad8a('0x2d')]['id']}})[_0xad8a('0x1d')](handleEntityNotFound(_0x24d085,null))[_0xad8a('0x1d')](function(_0x8dfcfc){if(_0x8dfcfc){return _0x8dfcfc[_0xad8a('0x4e')](_0x5f064c[_0xad8a('0x38')][_0xad8a('0x3d')],_['omit'](_0x5f064c[_0xad8a('0x38')],['ids','id'])||{})[_0xad8a('0x4f')](function(){return db['Tag'][_0xad8a('0x27')]({'attributes':['id',_0xad8a('0x1f'),'color'],'where':{'id':_0x5f064c[_0xad8a('0x38')][_0xad8a('0x3d')]}});})[_0xad8a('0x1d')](function(_0x4da546){socket['emit']('faxInteractionTags:save',{'id':Number(_0x5f064c[_0xad8a('0x2d')]['id']),'tags':_0x4da546||[]});return{'id':Number(_0x5f064c[_0xad8a('0x2d')]['id']),'tags':_0x4da546||[]};});}})['then'](respondWithResult(_0x24d085,null))[_0xad8a('0x2b')](handleError(_0x24d085,null));};exports[_0xad8a('0x50')]=function(_0x10ddaf,_0x83f51){return db[_0xad8a('0x22')][_0xad8a('0x39')]({'where':{'id':_0x10ddaf[_0xad8a('0x2d')]['id']}})[_0xad8a('0x1d')](handleEntityNotFound(_0x83f51,null))[_0xad8a('0x1d')](function(_0x2d908b){if(_0x2d908b){return _0x2d908b[_0xad8a('0x50')](_0x10ddaf[_0xad8a('0x29')][_0xad8a('0x3d')]);}})['then'](respondWithStatusCode(_0x83f51,null))['catch'](handleError(_0x83f51,null));};exports[_0xad8a('0x51')]=function(_0x3dc48a,_0xac89b5){var _0x3044b7=moment()[_0xad8a('0x52')]()[_0xad8a('0x53')]();var _0x2e138a=path['join'](config[_0xad8a('0x54')],_0xad8a('0x55'),'files','tmp');var _0x5d106e=path[_0xad8a('0x56')](config[_0xad8a('0x54')],_0xad8a('0x55'),'files','attachments');var _0x17f6c0=path['join'](_0x2e138a,_0x3044b7);var _0x4ce82b=util[_0xad8a('0x57')](_0xad8a('0x58'),_0x3dc48a[_0xad8a('0x2d')]['id'],_0x3044b7);var _0x39f554=path[_0xad8a('0x56')](_0x2e138a,_0x4ce82b);var _0x578b60=[];_0x578b60[_0xad8a('0x59')]({'model':db[_0xad8a('0x5a')],'as':_0xad8a('0x5a'),'raw':!![]});var _0x23c081=[{'model':db[_0xad8a('0x3c')],'as':_0xad8a('0x5b'),'attributes':['id',_0xad8a('0x38'),_0xad8a('0x5c')],'include':_0x578b60}];return db[_0xad8a('0x22')][_0xad8a('0x39')]({'where':{'id':_0x3dc48a[_0xad8a('0x2d')]['id']},'include':_0x23c081})[_0xad8a('0x1d')](handleEntityNotFound(_0xac89b5,null))[_0xad8a('0x1d')](function(_0x1d8ce5){if(_0x1d8ce5&&_0x1d8ce5[_0xad8a('0x5b')]){var _0x19c826=_0x1d8ce5[_0xad8a('0x5d')]({'plain':!![]});fs[_0xad8a('0x5e')](_0x17f6c0);for(var _0x31da87=0x0;_0x31da87<_0x19c826[_0xad8a('0x5b')][_0xad8a('0x34')];_0x31da87++){var _0x298bf8=_0x19c826['Messages'][_0x31da87][_0xad8a('0x5a')];if(_0x298bf8){var _0x262a60=path[_0xad8a('0x56')](_0x5d106e,_0x298bf8[_0xad8a('0x5f')]);if(fs[_0xad8a('0x60')](_0x262a60)){fs[_0xad8a('0x61')](_0x262a60)[_0xad8a('0x62')](fs[_0xad8a('0x63')](path[_0xad8a('0x56')](_0x17f6c0,_0x298bf8['basename'])));}}}return BPromise[_0xad8a('0x64')]()[_0xad8a('0x1d')](function(){return new BPromise(function(_0x5ad629,_0x4154b7){zipdir(_0x17f6c0,{'saveTo':_0x39f554},function(_0x3aab11,_0x3367ac){if(_0x3aab11)return _0x4154b7(_0x3aab11);return _0x5ad629(_0x3367ac);});})[_0xad8a('0x1d')](function(){return new BPromise(function(_0x4db7bc,_0x37c96a){rimraf(_0x17f6c0,function(_0x5f23cf){if(_0x5f23cf)_0x37c96a(_0x5f23cf);return _0x4db7bc();});});})[_0xad8a('0x1d')](function(){return _0xac89b5['download'](_0x39f554,_0x4ce82b,function(_0x5ef2c9){if(_0x5ef2c9){console[_0xad8a('0x65')](_0xad8a('0x66'),_0x5ef2c9);}else{fs[_0xad8a('0x67')](_0x39f554);}});});});}else{return _0xac89b5[_0xad8a('0x13')](0xc8);}})[_0xad8a('0x2b')](handleError(_0xac89b5,null));}; \ No newline at end of file +var _0xa97b=['basename','createReadStream','createWriteStream','resolve','download','log','err','unlinkSync','zip-dir','bluebird','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','./faxInteraction.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','stack','name','send','map','FaxInteraction','fieldName','type','findAll','fax','query','show','params','model','keys','rawAttributes','intersection','attributes','fields','length','includeAll','include','merge','find','create','body','catch','describe','addMessage','FaxMessage','ids','omit','getMessages','filters','hasOwnProperty','nolimit','order','sort','pick','where','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','color','emit','faxInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','mkdirSync'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa97b,0x69));var _0xba97=function(_0x144fe9,_0x2aeca8){_0x144fe9=_0x144fe9-0x0;var _0x4bf580=_0xa97b[_0x144fe9];return _0x4bf580;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xba97('0x0'));var moment=require('moment');var BPromise=require(_0xba97('0x1'));var util=require(_0xba97('0x2'));var path=require(_0xba97('0x3'));var fs=require('fs');var _=require(_0xba97('0x4'));var Redis=require('ioredis');var interaction=require(_0xba97('0x5'));var qs=require(_0xba97('0x6'));var logger=require(_0xba97('0x7'))(_0xba97('0x8'));var config=require(_0xba97('0x9'));var db=require('../../mysqldb')['db'];config[_0xba97('0xa')]=_['defaults'](config[_0xba97('0xa')],{'host':_0xba97('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xba97('0xc'))[_0xba97('0xd')](socket);function respondWithStatusCode(_0x2ba2a7,_0x33d5d5){_0x33d5d5=_0x33d5d5||0xcc;return function(_0x1b3fef){if(_0x1b3fef){return _0x2ba2a7[_0xba97('0xe')](_0x33d5d5);}return _0x2ba2a7['status'](_0x33d5d5)[_0xba97('0xf')]();};}function respondWithResult(_0x2e09ca,_0x59d9b1){_0x59d9b1=_0x59d9b1||0xc8;return function(_0x463b9b){if(_0x463b9b){return _0x2e09ca[_0xba97('0x10')](_0x59d9b1)[_0xba97('0x11')](_0x463b9b);}};}function respondWithFilteredResult(_0x47d8aa,_0xb3468a){return function(_0x15c7e4){if(_0x15c7e4){var _0x3f4bcb=typeof _0xb3468a[_0xba97('0x12')]===_0xba97('0x13')&&typeof _0xb3468a['limit']===_0xba97('0x13');var _0x16b1f6=_0x15c7e4[_0xba97('0x14')];var _0x3c70d3=_0x3f4bcb?0x0:_0xb3468a[_0xba97('0x12')];var _0x4dd8f6=_0x3f4bcb?_0x15c7e4[_0xba97('0x14')]:_0xb3468a['offset']+_0xb3468a[_0xba97('0x15')];var _0x5463ab;if(_0x4dd8f6>=_0x16b1f6){_0x4dd8f6=_0x16b1f6;_0x5463ab=0xc8;}else{_0x5463ab=0xce;}_0x47d8aa[_0xba97('0x10')](_0x5463ab);return _0x47d8aa[_0xba97('0x16')](_0xba97('0x17'),_0x3c70d3+'-'+_0x4dd8f6+'/'+_0x16b1f6)[_0xba97('0x11')](_0x15c7e4);}return null;};}function saveUpdates(_0x312ba6){return function(_0x2329ef){if(_0x2329ef){return _0x2329ef[_0xba97('0x18')](_0x312ba6)[_0xba97('0x19')](function(_0x37e923){return _0x37e923;});}return null;};}function removeEntity(_0x4bad6c){return function(_0x5a92b4){if(_0x5a92b4){return _0x5a92b4[_0xba97('0x1a')]()[_0xba97('0x19')](function(){_0x4bad6c['status'](0xcc)[_0xba97('0xf')]();});}};}function handleEntityNotFound(_0x54890f){return function(_0x1e671d){if(!_0x1e671d){_0x54890f['sendStatus'](0x194);}return _0x1e671d;};}function handleError(_0x5410d2,_0x551fcb){_0x551fcb=_0x551fcb||0x1f4;return function(_0x25ea2b){logger['error'](_0x25ea2b[_0xba97('0x1b')]);if(_0x25ea2b['name']){delete _0x25ea2b[_0xba97('0x1c')];}_0x5410d2['status'](_0x551fcb)[_0xba97('0x1d')](_0x25ea2b);};}exports['index']=function(_0x41e095,_0x6581ed){var _0x3de356={};var _0x3151d2=_[_0xba97('0x1e')](db[_0xba97('0x1f')]['rawAttributes'],function(_0x25e88b){return{'name':_0x25e88b[_0xba97('0x20')],'type':_0x25e88b[_0xba97('0x21')]['key']};});_0x3de356=qs['getOptions'](_0x3151d2,_0x41e095);return interaction[_0xba97('0x22')](_0xba97('0x23'),_0x41e095[_0xba97('0x24')],_0x41e095['user'],_0x3de356,_0x3151d2)[_0xba97('0x19')](respondWithFilteredResult(_0x6581ed,_0x3de356))['catch'](handleError(_0x6581ed,null));};exports[_0xba97('0x25')]=function(_0x9e08e,_0x1c9d28){var _0x3d78ea={'raw':![],'where':{'id':_0x9e08e[_0xba97('0x26')]['id']}},_0x91f753={};_0x91f753[_0xba97('0x27')]=_[_0xba97('0x28')](db[_0xba97('0x1f')][_0xba97('0x29')]);_0x91f753[_0xba97('0x24')]=_[_0xba97('0x28')](_0x9e08e[_0xba97('0x24')]);_0x91f753['filters']=_[_0xba97('0x2a')](_0x91f753[_0xba97('0x27')],_0x91f753[_0xba97('0x24')]);_0x3d78ea[_0xba97('0x2b')]=_[_0xba97('0x2a')](_0x91f753[_0xba97('0x27')],qs[_0xba97('0x2c')](_0x9e08e[_0xba97('0x24')][_0xba97('0x2c')]));_0x3d78ea[_0xba97('0x2b')]=_0x3d78ea['attributes'][_0xba97('0x2d')]?_0x3d78ea['attributes']:_0x91f753[_0xba97('0x27')];if(_0x9e08e[_0xba97('0x24')][_0xba97('0x2e')]){_0x3d78ea[_0xba97('0x2f')]=[{'all':!![]}];}_0x3d78ea=_[_0xba97('0x30')]({},_0x3d78ea,_0x9e08e['options']);return db[_0xba97('0x1f')][_0xba97('0x31')](_0x3d78ea)[_0xba97('0x19')](handleEntityNotFound(_0x1c9d28,null))[_0xba97('0x19')](respondWithResult(_0x1c9d28,null))['catch'](handleError(_0x1c9d28,null));};exports[_0xba97('0x32')]=function(_0x1bc850,_0x28520e){return db[_0xba97('0x1f')]['create'](_0x1bc850['body'],{})[_0xba97('0x19')](respondWithResult(_0x28520e,0xc9))['catch'](handleError(_0x28520e,null));};exports[_0xba97('0x18')]=function(_0x42ed59,_0x142bf0){if(_0x42ed59[_0xba97('0x33')]['id']){delete _0x42ed59['body']['id'];}return db['FaxInteraction'][_0xba97('0x31')]({'where':{'id':_0x42ed59[_0xba97('0x26')]['id']}})[_0xba97('0x19')](handleEntityNotFound(_0x142bf0,null))['then'](saveUpdates(_0x42ed59[_0xba97('0x33')],null))[_0xba97('0x19')](respondWithResult(_0x142bf0,null))[_0xba97('0x34')](handleError(_0x142bf0,null));};exports[_0xba97('0x1a')]=function(_0x31f78d,_0x1c7b2c){return db[_0xba97('0x1f')]['find']({'where':{'id':_0x31f78d[_0xba97('0x26')]['id']}})[_0xba97('0x19')](handleEntityNotFound(_0x1c7b2c,null))['then'](removeEntity(_0x1c7b2c,null))[_0xba97('0x34')](handleError(_0x1c7b2c,null));};exports[_0xba97('0x35')]=function(_0x61ad56,_0x48e63a){return db['FaxInteraction'][_0xba97('0x35')]()[_0xba97('0x19')](respondWithResult(_0x48e63a,null))[_0xba97('0x34')](handleError(_0x48e63a,null));};exports[_0xba97('0x36')]=function(_0x594d74,_0x5c27aa){return db[_0xba97('0x37')]['find']({'where':{'id':_0x594d74['params']['id']}})[_0xba97('0x19')](handleEntityNotFound(_0x5c27aa,null))[_0xba97('0x19')](function(_0x986ca0){if(_0x986ca0){return _0x986ca0[_0xba97('0x36')](_0x594d74[_0xba97('0x33')][_0xba97('0x38')],_[_0xba97('0x39')](_0x594d74[_0xba97('0x33')],[_0xba97('0x38'),'id'])||{});}})[_0xba97('0x19')](respondWithResult(_0x5c27aa,null))[_0xba97('0x34')](handleError(_0x5c27aa,null));};exports[_0xba97('0x3a')]=function(_0x3f7c3f,_0x5477b3){var _0x343061={'raw':![],'where':{}};var _0x59e281={};var _0x16f258={'count':0x0,'rows':[]};return db[_0xba97('0x1f')]['findOne']({'where':{'id':_0x3f7c3f[_0xba97('0x26')]['id']}})[_0xba97('0x19')](handleEntityNotFound(_0x5477b3,null))[_0xba97('0x19')](function(_0x3d6a99){if(_0x3d6a99){_0x59e281[_0xba97('0x27')]=_[_0xba97('0x28')](db['FaxMessage']['rawAttributes']);_0x59e281[_0xba97('0x24')]=_[_0xba97('0x28')](_0x3f7c3f[_0xba97('0x24')]);_0x59e281[_0xba97('0x3b')]=_['intersection'](_0x59e281[_0xba97('0x27')],_0x59e281['query']);_0x343061[_0xba97('0x2b')]=_[_0xba97('0x2a')](_0x59e281[_0xba97('0x27')],qs[_0xba97('0x2c')](_0x3f7c3f[_0xba97('0x24')][_0xba97('0x2c')]));_0x343061[_0xba97('0x2b')]=_0x343061[_0xba97('0x2b')]['length']?_0x343061['attributes']:_0x59e281[_0xba97('0x27')];if(!_0x3f7c3f[_0xba97('0x24')][_0xba97('0x3c')](_0xba97('0x3d'))){_0x343061[_0xba97('0x15')]=qs[_0xba97('0x15')](_0x3f7c3f[_0xba97('0x24')][_0xba97('0x15')]);_0x343061[_0xba97('0x12')]=qs[_0xba97('0x12')](_0x3f7c3f[_0xba97('0x24')]['offset']);}_0x343061[_0xba97('0x3e')]=qs[_0xba97('0x3f')](_0x3f7c3f[_0xba97('0x24')][_0xba97('0x3f')]);_0x343061['where']=qs['filters'](_[_0xba97('0x40')](_0x3f7c3f['query'],_0x59e281['filters']));_0x343061[_0xba97('0x41')]['FaxInteractionId']=_0x3d6a99['id'];if(_0x3f7c3f[_0xba97('0x24')]['filter']){_0x343061[_0xba97('0x41')]=_['merge'](_0x343061[_0xba97('0x41')],{'$or':_['map'](_0x343061[_0xba97('0x2b')],function(_0x22458a){var _0x4033af={};_0x4033af[_0x22458a]={'$like':'%'+_0x3f7c3f[_0xba97('0x24')][_0xba97('0x42')]+'%'};return _0x4033af;})});}if(_0x3f7c3f[_0xba97('0x24')][_0xba97('0x43')]){var _0x142707=_0x3f7c3f['query']['$gte']['split'](',');var _0x2a7ad2={};_0x2a7ad2[_0x142707[0x0]]={'$gte':moment(_0x142707[0x1])['format'](_0xba97('0x44'))};_0x343061['where']=_[_0xba97('0x30')](_0x343061[_0xba97('0x41')],_0x2a7ad2);}_0x343061=_[_0xba97('0x30')]({},_0x343061,_0x3f7c3f['options']);return db[_0xba97('0x37')][_0xba97('0x14')]({'where':_0x343061[_0xba97('0x41')]})[_0xba97('0x19')](function(_0x17b969){_0x16f258[_0xba97('0x14')]=_0x17b969;if(_0x3f7c3f[_0xba97('0x24')][_0xba97('0x2e')]){_0x343061[_0xba97('0x2f')]=[{'all':!![]}];}return db[_0xba97('0x37')][_0xba97('0x22')](_0x343061);})[_0xba97('0x19')](function(_0x170a94){_0x16f258[_0xba97('0x45')]=_0x170a94;return _0x16f258;});}})[_0xba97('0x19')](respondWithFilteredResult(_0x5477b3,_0x343061))[_0xba97('0x34')](handleError(_0x5477b3,null));};exports[_0xba97('0x46')]=function(_0x12d2e6,_0x2f7f6e){return db['FaxInteraction'][_0xba97('0x31')]({'where':{'id':_0x12d2e6['params']['id']}})['then'](handleEntityNotFound(_0x2f7f6e,null))['then'](function(_0x2133ca){if(_0x2133ca){return _0x2133ca[_0xba97('0x47')](_0x12d2e6[_0xba97('0x33')][_0xba97('0x38')],_[_0xba97('0x39')](_0x12d2e6['body'],[_0xba97('0x38'),'id'])||{})[_0xba97('0x48')](function(){return db['Tag'][_0xba97('0x22')]({'attributes':['id',_0xba97('0x1c'),_0xba97('0x49')],'where':{'id':_0x12d2e6[_0xba97('0x33')][_0xba97('0x38')]}});})[_0xba97('0x19')](function(_0x34e4c8){socket[_0xba97('0x4a')](_0xba97('0x4b'),{'id':Number(_0x12d2e6['params']['id']),'tags':_0x34e4c8||[]});return{'id':Number(_0x12d2e6[_0xba97('0x26')]['id']),'tags':_0x34e4c8||[]};});}})[_0xba97('0x19')](respondWithResult(_0x2f7f6e,null))[_0xba97('0x34')](handleError(_0x2f7f6e,null));};exports['removeTags']=function(_0x1e79a0,_0x29ef90){return db[_0xba97('0x1f')]['find']({'where':{'id':_0x1e79a0['params']['id']}})[_0xba97('0x19')](handleEntityNotFound(_0x29ef90,null))[_0xba97('0x19')](function(_0x450f97){if(_0x450f97){return _0x450f97[_0xba97('0x4c')](_0x1e79a0[_0xba97('0x24')][_0xba97('0x38')]);}})[_0xba97('0x19')](respondWithStatusCode(_0x29ef90,null))[_0xba97('0x34')](handleError(_0x29ef90,null));};exports['download']=function(_0x5299cb,_0x43a82b){var _0x2dfa72=moment()[_0xba97('0x4d')]()['toString']();var _0x1702e5=path[_0xba97('0x4e')](config[_0xba97('0x4f')],_0xba97('0x50'),_0xba97('0x51'),_0xba97('0x52'));var _0x218a6d=path[_0xba97('0x4e')](config[_0xba97('0x4f')],_0xba97('0x50'),_0xba97('0x51'),_0xba97('0x53'));var _0x132204=path[_0xba97('0x4e')](_0x1702e5,_0x2dfa72);var _0x1836f3=util['format'](_0xba97('0x54'),_0x5299cb['params']['id'],_0x2dfa72);var _0x496ddf=path[_0xba97('0x4e')](_0x1702e5,_0x1836f3);var _0x1ae856=[];_0x1ae856['push']({'model':db[_0xba97('0x55')],'as':_0xba97('0x55'),'raw':!![]});var _0xf2e832=[{'model':db['FaxMessage'],'as':_0xba97('0x56'),'attributes':['id',_0xba97('0x33'),_0xba97('0x57')],'include':_0x1ae856}];return db['FaxInteraction'][_0xba97('0x31')]({'where':{'id':_0x5299cb[_0xba97('0x26')]['id']},'include':_0xf2e832})[_0xba97('0x19')](handleEntityNotFound(_0x43a82b,null))[_0xba97('0x19')](function(_0x1f50b8){if(_0x1f50b8&&_0x1f50b8[_0xba97('0x56')]){var _0x11d5d7=_0x1f50b8['get']({'plain':!![]});fs[_0xba97('0x58')](_0x132204);for(var _0x5c6ba0=0x0;_0x5c6ba0<_0x11d5d7[_0xba97('0x56')][_0xba97('0x2d')];_0x5c6ba0++){var _0x33887e=_0x11d5d7['Messages'][_0x5c6ba0][_0xba97('0x55')];if(_0x33887e){var _0x1ae929=path['join'](_0x218a6d,_0x33887e[_0xba97('0x59')]);if(fs['existsSync'](_0x1ae929)){fs[_0xba97('0x5a')](_0x1ae929)['pipe'](fs[_0xba97('0x5b')](path[_0xba97('0x4e')](_0x132204,_0x33887e[_0xba97('0x59')])));}}}return BPromise[_0xba97('0x5c')]()[_0xba97('0x19')](function(){return new BPromise(function(_0x5a718c,_0x5e8bcb){zipdir(_0x132204,{'saveTo':_0x496ddf},function(_0x35feef,_0x407f6c){if(_0x35feef)return _0x5e8bcb(_0x35feef);return _0x5a718c(_0x407f6c);});})['then'](function(){return new BPromise(function(_0x5da557,_0x98c4e8){rimraf(_0x132204,function(_0x179ea3){if(_0x179ea3)_0x98c4e8(_0x179ea3);return _0x5da557();});});})[_0xba97('0x19')](function(){return _0x43a82b[_0xba97('0x5d')](_0x496ddf,_0x1836f3,function(_0x15103e){if(_0x15103e){console[_0xba97('0x5e')](_0xba97('0x5f'),_0x15103e);}else{fs[_0xba97('0x60')](_0x496ddf);}});});});}else{return _0x43a82b[_0xba97('0xe')](0xc8);}})['catch'](handleError(_0x43a82b,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index f848626..38f2e6c 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 _0x91c4=['emit','catch','hasOwnProperty','exports','FaxInteraction','../../mysqldb','FaxMessage','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0xacb1e2,_0x55e0ab){var _0x463815=function(_0x413c3b){while(--_0x413c3b){_0xacb1e2['push'](_0xacb1e2['shift']());}};_0x463815(++_0x55e0ab);}(_0x91c4,0x1c4));var _0x491c=function(_0x2accda,_0x3c8ee6){_0x2accda=_0x2accda-0x0;var _0x1fae4c=_0x91c4[_0x2accda];return _0x1fae4c;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0x491c('0x0')];var FaxMessage=require(_0x491c('0x1'))['db'][_0x491c('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x491c('0x3'),'afterDestroy':_0x491c('0x4')};function emitEvent(_0x3287e9){return function(_0x3f7eec,_0x183360,_0x324db3){_0x3f7eec[_0x491c('0x5')]({'attributes':['id'],'raw':!![]})[_0x491c('0x6')](function(_0xddd788){_0x3f7eec[_0x491c('0x7')](_0x491c('0x8'),_0xddd788[_0x491c('0x9')](function(_0x58eda8){return{'id':_0x58eda8['id']};}));return FaxMessage[_0x491c('0xa')]({'where':{'FaxInteractionId':_0x3f7eec['id'],'direction':'in','read':![]},'raw':!![]});})[_0x491c('0x6')](function(_0x49e9c4){_0x3f7eec[_0x491c('0x7')](_0x491c('0xb'),_0x49e9c4['length']);FaxInteractionEvents['emit'](_0x3287e9+':'+_0x3f7eec['id'],_0x3f7eec);FaxInteractionEvents[_0x491c('0xc')](_0x3287e9,_0x3f7eec);_0x324db3(null);})[_0x491c('0xd')](_0x324db3(null));};}for(var e in events){if(events[_0x491c('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x491c('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x1dbb=['FaxMessage','setMaxListeners','save','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x1dbb,0xf4));var _0xb1db=function(_0xd16cd8,_0xdfedf4){_0xd16cd8=_0xd16cd8-0x0;var _0x2a4e63=_0x1dbb[_0xd16cd8];return _0x2a4e63;};'use strict';var EventEmitter=require(_0xb1db('0x0'));var FaxInteraction=require(_0xb1db('0x1'))['db'][_0xb1db('0x2')];var FaxMessage=require(_0xb1db('0x1'))['db'][_0xb1db('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb1db('0x4')](0x0);var events={'afterCreate':_0xb1db('0x5'),'afterUpdate':'update','afterDestroy':_0xb1db('0x6')};function emitEvent(_0x29f0dd){return function(_0x28fd52,_0x5be646,_0x504ef8){_0x28fd52[_0xb1db('0x7')]({'attributes':['id'],'raw':!![]})[_0xb1db('0x8')](function(_0x4b1dfa){_0x28fd52['setDataValue'](_0xb1db('0x9'),_0x4b1dfa[_0xb1db('0xa')](function(_0x356ac2){return{'id':_0x356ac2['id']};}));return FaxMessage[_0xb1db('0xb')]({'where':{'FaxInteractionId':_0x28fd52['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb1db('0x8')](function(_0x1dc36d){_0x28fd52[_0xb1db('0xc')](_0xb1db('0xd'),_0x1dc36d[_0xb1db('0xe')]);FaxInteractionEvents[_0xb1db('0xf')](_0x29f0dd+':'+_0x28fd52['id'],_0x28fd52);FaxInteractionEvents[_0xb1db('0xf')](_0x29f0dd,_0x28fd52);_0x504ef8(null);})[_0xb1db('0x10')](_0x504ef8(null));};}for(var e in events){if(events[_0xb1db('0x11')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb1db('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 b7be7ba..1112fb0 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 _0x6b3d=['fax_interactions','changed','closed','closedAt','format','lodash','bluebird','rimraf','./faxInteraction.attributes','exports','define'];(function(_0x15ece6,_0x51a965){var _0x3dc05c=function(_0x43e0c1){while(--_0x43e0c1){_0x15ece6['push'](_0x15ece6['shift']());}};_0x3dc05c(++_0x51a965);}(_0x6b3d,0x14f));var _0xd6b3=function(_0x32d4f2,_0x45502c){_0x32d4f2=_0x32d4f2-0x0;var _0x2278e4=_0x6b3d[_0x32d4f2];return _0x2278e4;};'use strict';var _=require(_0xd6b3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd6b3('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd6b3('0x2'));var config=require('../../config/environment');var attributes=require(_0xd6b3('0x3'));module[_0xd6b3('0x4')]=function(_0x41abe3,_0x39dedb){return _0x41abe3[_0xd6b3('0x5')]('FaxInteraction',attributes,{'tableName':_0xd6b3('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b9dac,_0x43fbe9,_0xdfa279){if(_0x5b9dac[_0xd6b3('0x7')](_0xd6b3('0x8'))){_0x5b9dac[_0xd6b3('0x9')]=moment()[_0xd6b3('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}_0xdfa279(null,_0x5b9dac);}}});}; \ No newline at end of file +var _0xa6d4=['closedAt','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','changed'];(function(_0x1118b2,_0x21baa2){var _0x68c2d1=function(_0x4c42fe){while(--_0x4c42fe){_0x1118b2['push'](_0x1118b2['shift']());}};_0x68c2d1(++_0x21baa2);}(_0xa6d4,0x1dd));var _0x4a6d=function(_0x5d2550,_0x2d0ea6){_0x5d2550=_0x5d2550-0x0;var _0x421e10=_0xa6d4[_0x5d2550];return _0x421e10;};'use strict';var _=require('lodash');var util=require(_0x4a6d('0x0'));var logger=require(_0x4a6d('0x1'))(_0x4a6d('0x2'));var moment=require(_0x4a6d('0x3'));var BPromise=require(_0x4a6d('0x4'));var rp=require(_0x4a6d('0x5'));var fs=require('fs');var path=require(_0x4a6d('0x6'));var rimraf=require(_0x4a6d('0x7'));var config=require(_0x4a6d('0x8'));var attributes=require(_0x4a6d('0x9'));module[_0x4a6d('0xa')]=function(_0x494e7d,_0x1ada8e){return _0x494e7d[_0x4a6d('0xb')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59f5b8,_0x509e71,_0x1bcf8b){if(_0x59f5b8[_0x4a6d('0xc')]('closed')){_0x59f5b8[_0x4a6d('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1bcf8b(null,_0x59f5b8);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 04d1596..2b5ed37 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 _0x3a46=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','limit','debug','AddTagsToFaxInteraction','find','addTags','ids','omit','AddTags','util','moment'];(function(_0x3dc7c9,_0x40956b){var _0x39c475=function(_0x17c20c){while(--_0x17c20c){_0x3dc7c9['push'](_0x3dc7c9['shift']());}};_0x39c475(++_0x40956b);}(_0x3a46,0x1e2));var _0x63a4=function(_0x5228fe,_0x1ae3ba){_0x5228fe=_0x5228fe-0x0;var _0x269333=_0x3a46[_0x5228fe];return _0x269333;};'use strict';var _=require('lodash');var util=require(_0x63a4('0x0'));var moment=require(_0x63a4('0x1'));var BPromise=require(_0x63a4('0x2'));var rs=require(_0x63a4('0x3'));var fs=require('fs');var Redis=require(_0x63a4('0x4'));var db=require(_0x63a4('0x5'))['db'];var utils=require(_0x63a4('0x6'));var logger=require('../../config/logger')(_0x63a4('0x7'));var config=require(_0x63a4('0x8'));var jayson=require(_0x63a4('0x9'));var client=jayson[_0x63a4('0xa')][_0x63a4('0xb')]({'port':0x232a});config[_0x63a4('0xc')]=_[_0x63a4('0xd')](config[_0x63a4('0xc')],{'host':_0x63a4('0xe'),'port':0x18eb});var socket=require(_0x63a4('0xf'))(new Redis(config[_0x63a4('0xc')]));require(_0x63a4('0x10'))[_0x63a4('0x11')](socket);function respondWithRpcPromise(_0x162bd7,_0x1f16aa,_0x23326d){return new BPromise(function(_0x114ebd,_0x1d81d3){return client[_0x63a4('0x12')](_0x162bd7,_0x23326d)[_0x63a4('0x13')](function(_0x1e45e4){logger[_0x63a4('0x14')](_0x63a4('0x15'),_0x1f16aa,_0x63a4('0x16'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x1f16aa,_0x63a4('0x16'),JSON[_0x63a4('0x17')](_0x1e45e4));if(_0x1e45e4[_0x63a4('0x18')]){if(_0x1e45e4[_0x63a4('0x18')][_0x63a4('0x19')]===0x1f4){logger[_0x63a4('0x18')](_0x63a4('0x15'),_0x1f16aa,_0x1e45e4[_0x63a4('0x18')][_0x63a4('0x1a')]);return _0x1d81d3(_0x1e45e4['error'][_0x63a4('0x1a')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x1f16aa,_0x1e45e4[_0x63a4('0x18')][_0x63a4('0x1a')]);return _0x114ebd(_0x1e45e4[_0x63a4('0x18')][_0x63a4('0x1a')]);}else{logger[_0x63a4('0x14')](_0x63a4('0x15'),_0x1f16aa,'request\x20sent');_0x114ebd(_0x1e45e4[_0x63a4('0x1b')]['message']);}})[_0x63a4('0x1c')](function(_0x1dd403){logger[_0x63a4('0x18')](_0x63a4('0x15'),_0x1f16aa,_0x1dd403);_0x1d81d3(_0x1dd403);});});}exports[_0x63a4('0x1d')]=function(_0x14f40d){var _0x55a274=this;return new Promise(function(_0x4bb4f3,_0x33e8a7){return db[_0x63a4('0x1e')]['update'](_0x14f40d[_0x63a4('0x1f')],{'raw':_0x14f40d[_0x63a4('0x20')]?_0x14f40d[_0x63a4('0x20')][_0x63a4('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14f40d[_0x63a4('0x20')]?_0x14f40d[_0x63a4('0x20')][_0x63a4('0x22')]||null:null,'attributes':_0x14f40d['options']?_0x14f40d[_0x63a4('0x20')][_0x63a4('0x23')]||null:null,'limit':_0x14f40d[_0x63a4('0x20')]?_0x14f40d['options'][_0x63a4('0x24')]||null:null})['then'](function(_0xccf480){logger['info']('UpdateFaxInteraction',_0x14f40d);logger[_0x63a4('0x25')](_0x63a4('0x1d'),_0x14f40d,JSON[_0x63a4('0x17')](_0xccf480));_0x4bb4f3(_0xccf480);})[_0x63a4('0x1c')](function(_0x38ae57){logger[_0x63a4('0x18')](_0x63a4('0x1d'),_0x38ae57['message'],_0x14f40d);_0x33e8a7(_0x55a274[_0x63a4('0x18')](0x1f4,_0x38ae57['message']));});});};exports[_0x63a4('0x26')]=function(_0x507145){return new Promise(function(_0x2d5d69,_0x5d190e){return db[_0x63a4('0x1e')][_0x63a4('0x27')]({'where':_0x507145['options']?_0x507145['options'][_0x63a4('0x22')]||null:null})[_0x63a4('0x13')](function(_0x49cc94){if(_0x49cc94){return _0x49cc94[_0x63a4('0x28')](_0x507145[_0x63a4('0x1f')][_0x63a4('0x29')],_[_0x63a4('0x2a')](_0x507145['body'],[_0x63a4('0x29'),'id'])||{});}})['spread'](function(_0x295da5){logger[_0x63a4('0x14')](_0x63a4('0x2b'),_0x507145);logger[_0x63a4('0x25')](_0x63a4('0x2b'),_0x507145,JSON[_0x63a4('0x17')](_0x295da5));_0x2d5d69(_0x295da5);})[_0x63a4('0x1c')](function(_0x6cfa50){logger[_0x63a4('0x18')]('AddTags',_0x6cfa50[_0x63a4('0x1a')],_0x507145);_0x5d190e(_this[_0x63a4('0x18')](0x1f4,_0x6cfa50[_0x63a4('0x1a')]));});});}; \ No newline at end of file +var _0x1e82=['FaxInteraction','find','addTags','omit','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','UpdateFaxInteraction','update','body','options','raw','where','attributes','limit','debug','catch'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0x1e82,0x88));var _0x21e8=function(_0x264231,_0x5e6932){_0x264231=_0x264231-0x0;var _0x104760=_0x1e82[_0x264231];return _0x104760;};'use strict';var _=require('lodash');var util=require(_0x21e8('0x0'));var moment=require(_0x21e8('0x1'));var BPromise=require(_0x21e8('0x2'));var rs=require(_0x21e8('0x3'));var fs=require('fs');var Redis=require(_0x21e8('0x4'));var db=require(_0x21e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x21e8('0x6'))(_0x21e8('0x7'));var config=require(_0x21e8('0x8'));var jayson=require(_0x21e8('0x9'));var client=jayson[_0x21e8('0xa')]['http']({'port':0x232a});config[_0x21e8('0xb')]=_[_0x21e8('0xc')](config[_0x21e8('0xb')],{'host':_0x21e8('0xd'),'port':0x18eb});var socket=require(_0x21e8('0xe'))(new Redis(config['redis']));require(_0x21e8('0xf'))['register'](socket);function respondWithRpcPromise(_0x53ff47,_0x4d564a,_0x4afa06){return new BPromise(function(_0x19165f,_0x4e7897){return client[_0x21e8('0x10')](_0x53ff47,_0x4afa06)[_0x21e8('0x11')](function(_0x23da6f){logger[_0x21e8('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x4d564a,_0x21e8('0x13'));logger['debug'](_0x21e8('0x14'),_0x4d564a,_0x21e8('0x13'),JSON[_0x21e8('0x15')](_0x23da6f));if(_0x23da6f[_0x21e8('0x16')]){if(_0x23da6f[_0x21e8('0x16')][_0x21e8('0x17')]===0x1f4){logger[_0x21e8('0x16')](_0x21e8('0x18'),_0x4d564a,_0x23da6f[_0x21e8('0x16')]['message']);return _0x4e7897(_0x23da6f[_0x21e8('0x16')][_0x21e8('0x19')]);}logger[_0x21e8('0x16')](_0x21e8('0x18'),_0x4d564a,_0x23da6f[_0x21e8('0x16')]['message']);return _0x19165f(_0x23da6f['error']['message']);}else{logger[_0x21e8('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x4d564a,_0x21e8('0x13'));_0x19165f(_0x23da6f['result'][_0x21e8('0x19')]);}})['catch'](function(_0x51fe5f){logger[_0x21e8('0x16')](_0x21e8('0x18'),_0x4d564a,_0x51fe5f);_0x4e7897(_0x51fe5f);});});}exports[_0x21e8('0x1a')]=function(_0x3472e1){var _0x207646=this;return new Promise(function(_0x3a3c12,_0x4a030d){return db['FaxInteraction'][_0x21e8('0x1b')](_0x3472e1[_0x21e8('0x1c')],{'raw':_0x3472e1['options']?_0x3472e1[_0x21e8('0x1d')][_0x21e8('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3472e1[_0x21e8('0x1d')]?_0x3472e1['options'][_0x21e8('0x1f')]||null:null,'attributes':_0x3472e1['options']?_0x3472e1[_0x21e8('0x1d')][_0x21e8('0x20')]||null:null,'limit':_0x3472e1[_0x21e8('0x1d')]?_0x3472e1[_0x21e8('0x1d')][_0x21e8('0x21')]||null:null})[_0x21e8('0x11')](function(_0x281705){logger[_0x21e8('0x12')](_0x21e8('0x1a'),_0x3472e1);logger[_0x21e8('0x22')](_0x21e8('0x1a'),_0x3472e1,JSON[_0x21e8('0x15')](_0x281705));_0x3a3c12(_0x281705);})[_0x21e8('0x23')](function(_0x32aa22){logger['error'](_0x21e8('0x1a'),_0x32aa22['message'],_0x3472e1);_0x4a030d(_0x207646[_0x21e8('0x16')](0x1f4,_0x32aa22[_0x21e8('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0x5d9591){return new Promise(function(_0x5396fe,_0x44b832){return db[_0x21e8('0x24')][_0x21e8('0x25')]({'where':_0x5d9591['options']?_0x5d9591['options'][_0x21e8('0x1f')]||null:null})[_0x21e8('0x11')](function(_0x3e00ef){if(_0x3e00ef){return _0x3e00ef[_0x21e8('0x26')](_0x5d9591['body']['ids'],_[_0x21e8('0x27')](_0x5d9591[_0x21e8('0x1c')],[_0x21e8('0x28'),'id'])||{});}})[_0x21e8('0x29')](function(_0xfff37e){logger[_0x21e8('0x12')](_0x21e8('0x2a'),_0x5d9591);logger['debug'](_0x21e8('0x2a'),_0x5d9591,JSON[_0x21e8('0x15')](_0xfff37e));_0x5396fe(_0xfff37e);})['catch'](function(_0x40b498){logger[_0x21e8('0x16')](_0x21e8('0x2a'),_0x40b498[_0x21e8('0x19')],_0x5d9591);_0x44b832(_this['error'](0x1f4,_0x40b498[_0x21e8('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index ad974e0..372680b 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 _0x5986=['length','./faxInteraction.events','remove','update','emit','removeListener'];(function(_0x2659e1,_0x98ff99){var _0x58d5fc=function(_0x5d9292){while(--_0x5d9292){_0x2659e1['push'](_0x2659e1['shift']());}};_0x58d5fc(++_0x98ff99);}(_0x5986,0x1ab));var _0x6598=function(_0x2b9549,_0x48a282){_0x2b9549=_0x2b9549-0x0;var _0x3d10cf=_0x5986[_0x2b9549];return _0x3d10cf;};'use strict';var FaxInteractionEvents=require(_0x6598('0x0'));var events=['save',_0x6598('0x1'),_0x6598('0x2')];function createListener(_0x13f5a5,_0x1fb4b3){return function(_0x5f58b2){_0x1fb4b3[_0x6598('0x3')](_0x13f5a5,_0x5f58b2);};}function removeListener(_0x3962b5,_0x1cf71d){return function(){FaxInteractionEvents[_0x6598('0x4')](_0x3962b5,_0x1cf71d);};}exports['register']=function(_0x552d1a){for(var _0x2c5004=0x0,_0x3f443a=events[_0x6598('0x5')];_0x2c5004<_0x3f443a;_0x2c5004++){var _0x3058ca=events[_0x2c5004];var _0x31ba71=createListener('faxInteraction:'+_0x3058ca,_0x552d1a);FaxInteractionEvents['on'](_0x3058ca,_0x31ba71);}}; \ No newline at end of file +var _0xdce7=['length','faxInteraction:','./faxInteraction.events','remove','removeListener','register'];(function(_0x4a5951,_0x36f2a4){var _0x599b18=function(_0x5b1b6c){while(--_0x5b1b6c){_0x4a5951['push'](_0x4a5951['shift']());}};_0x599b18(++_0x36f2a4);}(_0xdce7,0x15e));var _0x7dce=function(_0x40b7ea,_0x550490){_0x40b7ea=_0x40b7ea-0x0;var _0x2627ec=_0xdce7[_0x40b7ea];return _0x2627ec;};'use strict';var FaxInteractionEvents=require(_0x7dce('0x0'));var events=['save',_0x7dce('0x1'),'update'];function createListener(_0x559b2d,_0x1897af){return function(_0xbb3a98){_0x1897af['emit'](_0x559b2d,_0xbb3a98);};}function removeListener(_0x257bd0,_0x5b30b0){return function(){FaxInteractionEvents[_0x7dce('0x2')](_0x257bd0,_0x5b30b0);};}exports[_0x7dce('0x3')]=function(_0x49431b){for(var _0x20dcf6=0x0,_0x4c6444=events[_0x7dce('0x4')];_0x20dcf6<_0x4c6444;_0x20dcf6++){var _0x20aa2a=events[_0x20dcf6];var _0x2929c3=createListener(_0x7dce('0x5')+_0x20aa2a,_0x49431b);FaxInteractionEvents['on'](_0x20aa2a,_0x2929c3);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 08ce337..ad45d45 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 _0xefd8=['tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','download','post','/:id/tags'];(function(_0x27dd5f,_0x5a38e4){var _0x5d736d=function(_0x2ccc3d){while(--_0x2ccc3d){_0x27dd5f['push'](_0x27dd5f['shift']());}};_0x5d736d(++_0x5a38e4);}(_0xefd8,0x104));var _0x8efd=function(_0x1e27b1,_0x10123){_0x1e27b1=_0x1e27b1-0x0;var _0x3e5a0f=_0xefd8[_0x1e27b1];return _0x3e5a0f;};'use strict';var multer=require(_0x8efd('0x0'));var util=require(_0x8efd('0x1'));var path=require(_0x8efd('0x2'));var timeout=require(_0x8efd('0x3'));var express=require(_0x8efd('0x4'));var router=express[_0x8efd('0x5')]();var fs_extra=require(_0x8efd('0x6'));var auth=require(_0x8efd('0x7'));var interaction=require(_0x8efd('0x8'));var config=require('../../config/environment');var controller=require(_0x8efd('0x9'));router[_0x8efd('0xa')]('/',auth[_0x8efd('0xb')](),controller[_0x8efd('0xc')]);router[_0x8efd('0xa')](_0x8efd('0xd'),auth[_0x8efd('0xb')](),controller[_0x8efd('0xe')]);router[_0x8efd('0xa')](_0x8efd('0xf'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/messages',auth[_0x8efd('0xb')](),controller['getMessages']);router[_0x8efd('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x8efd('0x10')]);router[_0x8efd('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8efd('0x11')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x8efd('0x11')](_0x8efd('0x12'),auth[_0x8efd('0xb')](),interaction[_0x8efd('0x13')](_0x8efd('0x14'),_0x8efd('0x15')),controller[_0x8efd('0x16')]);router[_0x8efd('0x17')]('/:id',auth[_0x8efd('0xb')](),interaction[_0x8efd('0x13')](_0x8efd('0x14'),_0x8efd('0x18')),controller[_0x8efd('0x19')]);router[_0x8efd('0x1a')]('/:id',auth[_0x8efd('0xb')](),interaction[_0x8efd('0x13')](_0x8efd('0x14'),_0x8efd('0x1b')),controller[_0x8efd('0x1c')]);router[_0x8efd('0x1a')](_0x8efd('0x12'),auth['isAuthenticated'](),controller[_0x8efd('0x1d')]);module[_0x8efd('0x1e')]=router; \ No newline at end of file +var _0x295f=['fs-extra','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','delete','faxinteraction:destroy','util','path','connect-timeout','Router'];(function(_0x42e060,_0x460da6){var _0x566c32=function(_0x4aea92){while(--_0x4aea92){_0x42e060['push'](_0x42e060['shift']());}};_0x566c32(++_0x460da6);}(_0x295f,0x168));var _0xf295=function(_0x3a17f8,_0x4dc5e8){_0x3a17f8=_0x3a17f8-0x0;var _0x3bc759=_0x295f[_0x3a17f8];return _0x3bc759;};'use strict';var multer=require('multer');var util=require(_0xf295('0x0'));var path=require(_0xf295('0x1'));var timeout=require(_0xf295('0x2'));var express=require('express');var router=express[_0xf295('0x3')]();var fs_extra=require(_0xf295('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf295('0x5'));var controller=require(_0xf295('0x6'));router[_0xf295('0x7')]('/',auth[_0xf295('0x8')](),controller[_0xf295('0x9')]);router['get'](_0xf295('0xa'),auth[_0xf295('0x8')](),controller[_0xf295('0xb')]);router[_0xf295('0x7')](_0xf295('0xc'),auth[_0xf295('0x8')](),controller[_0xf295('0xd')]);router[_0xf295('0x7')](_0xf295('0xe'),auth[_0xf295('0x8')](),controller[_0xf295('0xf')]);router[_0xf295('0x7')]('/:id/download',auth[_0xf295('0x8')](),controller[_0xf295('0x10')]);router['post']('/',auth[_0xf295('0x8')](),controller[_0xf295('0x11')]);router[_0xf295('0x12')](_0xf295('0xe'),auth[_0xf295('0x8')](),controller[_0xf295('0x13')]);router[_0xf295('0x12')](_0xf295('0x14'),auth[_0xf295('0x8')](),interaction[_0xf295('0x15')](_0xf295('0x16'),_0xf295('0x17')),controller[_0xf295('0x18')]);router[_0xf295('0x19')](_0xf295('0xc'),auth[_0xf295('0x8')](),interaction[_0xf295('0x15')](_0xf295('0x16'),'faxinteraction:update'),controller['update']);router[_0xf295('0x1a')](_0xf295('0xc'),auth['isAuthenticated'](),interaction[_0xf295('0x15')]('fax',_0xf295('0x1b')),controller['destroy']);router['delete'](_0xf295('0x14'),auth[_0xf295('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 3dbdc7a..6defbd7 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 _0xcc73=['TEXT','ENUM','out','exports'];(function(_0x3fb5eb,_0x5947a6){var _0x481291=function(_0x74e4e){while(--_0x74e4e){_0x3fb5eb['push'](_0x3fb5eb['shift']());}};_0x481291(++_0x5947a6);}(_0xcc73,0x1cb));var _0x3cc7=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xcc73[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x3cc7('0x0')]={'body':{'type':Sequelize[_0x3cc7('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3cc7('0x2')]('in','out'),'defaultValue':_0x3cc7('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x79a8=['out','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x589e00,_0x13b8e3){var _0x2b2980=function(_0x2a6730){while(--_0x2a6730){_0x589e00['push'](_0x589e00['shift']());}};_0x2b2980(++_0x13b8e3);}(_0x79a8,0x1d0));var _0x879a=function(_0x5d9c37,_0x518b93){_0x5d9c37=_0x5d9c37-0x0;var _0x1ba9eb=_0x79a8[_0x5d9c37];return _0x1ba9eb;};'use strict';var Sequelize=require(_0x879a('0x0'));module['exports']={'body':{'type':Sequelize[_0x879a('0x1')](_0x879a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x879a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x879a('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x879a('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x879a('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 23df51d..32dd878 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 _0x3c09=['acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','rejectmessage','create','findOne','fax','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','files','attachments','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','include','findAll','rows','catch','show','params','FaxMessage','includeAll','options','body','find','describe','fax-interactions','accept','read','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','null'];(function(_0x15d4a3,_0x5df11e){var _0xd81f49=function(_0x21397a){while(--_0x21397a){_0x15d4a3['push'](_0x15d4a3['shift']());}};_0xd81f49(++_0x5df11e);}(_0x3c09,0x1de));var _0x93c0=function(_0x365917,_0x545bcc){_0x365917=_0x365917-0x0;var _0x20f7a0=_0x3c09[_0x365917];return _0x20f7a0;};'use strict';var emlformat=require(_0x93c0('0x0'));var rimraf=require(_0x93c0('0x1'));var zipdir=require(_0x93c0('0x2'));var jsonpatch=require(_0x93c0('0x3'));var rp=require(_0x93c0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x93c0('0x5'));var util=require(_0x93c0('0x6'));var path=require(_0x93c0('0x7'));var sox=require(_0x93c0('0x8'));var csv=require(_0x93c0('0x9'));var ejs=require(_0x93c0('0xa'));var fs=require('fs');var fs_extra=require(_0x93c0('0xb'));var _=require(_0x93c0('0xc'));var squel=require(_0x93c0('0xd'));var crypto=require('crypto');var jsforce=require(_0x93c0('0xe'));var deskjs=require(_0x93c0('0xf'));var toCsv=require(_0x93c0('0x9'));var querystring=require(_0x93c0('0x10'));var Papa=require(_0x93c0('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x93c0('0x12'));var as=require(_0x93c0('0x13'));var hardwareService=require(_0x93c0('0x14'));var logger=require(_0x93c0('0x15'))(_0x93c0('0x16'));var utils=require('../../config/utils');var config=require(_0x93c0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x93c0('0x18'))['db'];config[_0x93c0('0x19')]=_[_0x93c0('0x1a')](config['redis'],{'host':_0x93c0('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x93c0('0x19')]));require(_0x93c0('0x1c'))[_0x93c0('0x1d')](socket);var jayson=require(_0x93c0('0x1e'));var client=jayson[_0x93c0('0x1f')][_0x93c0('0x20')]({'port':0x232c});var client9002=jayson[_0x93c0('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1086b8,_0x558b7b,_0xe6e2b4,_0x53df66){return new BPromise(function(_0x304a25,_0x277183){var _0x167899=_0x53df66||client;return _0x167899[_0x93c0('0x21')](_0x1086b8,_0xe6e2b4)[_0x93c0('0x22')](function(_0x109994){logger[_0x93c0('0x23')](_0x93c0('0x24'),_0x558b7b,_0x93c0('0x25'));logger[_0x93c0('0x26')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x558b7b,_0x93c0('0x25'),JSON[_0x93c0('0x27')](_0x109994));if(_0x109994[_0x93c0('0x28')]){if(_0x109994[_0x93c0('0x28')]['code']===0x1f4){logger[_0x93c0('0x28')]('FaxMessage,\x20%s,\x20%s',_0x558b7b,_0x109994[_0x93c0('0x28')][_0x93c0('0x29')]);return _0x277183(_0x109994[_0x93c0('0x28')][_0x93c0('0x29')]);}logger[_0x93c0('0x28')](_0x93c0('0x24'),_0x558b7b,_0x109994[_0x93c0('0x28')][_0x93c0('0x29')]);return _0x304a25(_0x109994[_0x93c0('0x28')][_0x93c0('0x29')]);}else{logger[_0x93c0('0x23')](_0x93c0('0x24'),_0x558b7b,_0x93c0('0x25'));_0x304a25(_0x109994[_0x93c0('0x2a')][_0x93c0('0x29')]);}})['catch'](function(_0x369d43){logger[_0x93c0('0x28')](_0x93c0('0x24'),_0x558b7b,_0x369d43);_0x277183(_0x369d43);});});}function respondWithStatusCode(_0x428fc5,_0x391766){_0x391766=_0x391766||0xcc;return function(_0x36cbfe){if(_0x36cbfe){return _0x428fc5['sendStatus'](_0x391766);}return _0x428fc5[_0x93c0('0x2b')](_0x391766)[_0x93c0('0x2c')]();};}function respondWithResult(_0x2fba4d,_0x905926){_0x905926=_0x905926||0xc8;return function(_0x5e6a90){if(_0x5e6a90){return _0x2fba4d[_0x93c0('0x2b')](_0x905926)[_0x93c0('0x2d')](_0x5e6a90);}};}function respondWithFilteredResult(_0xbaada7,_0xdd8c8f){return function(_0x1517cf){if(_0x1517cf){var _0x40ed50=typeof _0xdd8c8f[_0x93c0('0x2e')]===_0x93c0('0x2f')&&typeof _0xdd8c8f[_0x93c0('0x30')]===_0x93c0('0x2f');var _0x470984=_0x1517cf[_0x93c0('0x31')];var _0x29d643=_0x40ed50?0x0:_0xdd8c8f['offset'];var _0x518dff=_0x40ed50?_0x1517cf[_0x93c0('0x31')]:_0xdd8c8f[_0x93c0('0x2e')]+_0xdd8c8f[_0x93c0('0x30')];var _0x466d5;if(_0x518dff>=_0x470984){_0x518dff=_0x470984;_0x466d5=0xc8;}else{_0x466d5=0xce;}_0xbaada7[_0x93c0('0x2b')](_0x466d5);return _0xbaada7[_0x93c0('0x32')](_0x93c0('0x33'),_0x29d643+'-'+_0x518dff+'/'+_0x470984)['json'](_0x1517cf);}return null;};}function patchUpdates(_0x5e43f4){return function(_0x203058){try{jsonpatch[_0x93c0('0x34')](_0x203058,_0x5e43f4,!![]);}catch(_0x446830){return BPromise[_0x93c0('0x35')](_0x446830);}return _0x203058[_0x93c0('0x36')]();};}function saveUpdates(_0x43db2f,_0x18df60){return function(_0x222d79){if(_0x222d79){return _0x222d79[_0x93c0('0x37')](_0x43db2f)[_0x93c0('0x22')](function(_0xae59b4){return _0xae59b4;});}return null;};}function removeEntity(_0x5906ae,_0x7feda9){return function(_0x76dcc0){if(_0x76dcc0){return _0x76dcc0[_0x93c0('0x38')]()[_0x93c0('0x22')](function(){_0x5906ae[_0x93c0('0x2b')](0xcc)[_0x93c0('0x2c')]();});}};}function handleEntityNotFound(_0x30708b,_0x53b8af){return function(_0x3afd45){if(!_0x3afd45){_0x30708b[_0x93c0('0x39')](0x194);}return _0x3afd45;};}function handleError(_0x24ffcb,_0x1ca8f4){_0x1ca8f4=_0x1ca8f4||0x1f4;return function(_0x334b70){logger['error'](_0x334b70[_0x93c0('0x3a')]);if(_0x334b70[_0x93c0('0x3b')]){delete _0x334b70[_0x93c0('0x3b')];}_0x24ffcb['status'](_0x1ca8f4)['send'](_0x334b70);};}exports[_0x93c0('0x3c')]=function(_0x7feaeb,_0x3b929f){var _0x127e72={},_0x4b6689={},_0x304e6c={'count':0x0,'rows':[]};var _0x8b7ecf=_[_0x93c0('0x3d')](db['FaxMessage'][_0x93c0('0x3e')],function(_0x15d7a0){return{'name':_0x15d7a0[_0x93c0('0x3f')],'type':_0x15d7a0[_0x93c0('0x40')][_0x93c0('0x41')]};});_0x4b6689[_0x93c0('0x42')]=_[_0x93c0('0x3d')](_0x8b7ecf,_0x93c0('0x3b'));_0x4b6689[_0x93c0('0x43')]=_[_0x93c0('0x44')](_0x7feaeb[_0x93c0('0x43')]);_0x4b6689[_0x93c0('0x45')]=_[_0x93c0('0x46')](_0x4b6689[_0x93c0('0x42')],_0x4b6689[_0x93c0('0x43')]);_0x127e72[_0x93c0('0x47')]=_[_0x93c0('0x46')](_0x4b6689[_0x93c0('0x42')],qs[_0x93c0('0x48')](_0x7feaeb[_0x93c0('0x43')][_0x93c0('0x48')]));_0x127e72['attributes']=_0x127e72[_0x93c0('0x47')][_0x93c0('0x49')]?_0x127e72[_0x93c0('0x47')]:_0x4b6689[_0x93c0('0x42')];if(!_0x7feaeb['query'][_0x93c0('0x4a')](_0x93c0('0x4b'))){_0x127e72[_0x93c0('0x30')]=qs[_0x93c0('0x30')](_0x7feaeb[_0x93c0('0x43')][_0x93c0('0x30')]);_0x127e72['offset']=qs['offset'](_0x7feaeb[_0x93c0('0x43')][_0x93c0('0x2e')]);}_0x127e72['order']=qs['sort'](_0x7feaeb[_0x93c0('0x43')][_0x93c0('0x4c')]);_0x127e72[_0x93c0('0x4d')]=qs[_0x93c0('0x45')](_[_0x93c0('0x4e')](_0x7feaeb[_0x93c0('0x43')],_0x4b6689[_0x93c0('0x45')]),_0x8b7ecf);if(_0x7feaeb['query']['filter']){_0x127e72[_0x93c0('0x4d')]=_[_0x93c0('0x4f')](_0x127e72['where'],{'$or':_['map'](_0x8b7ecf,function(_0x17b007){if(_0x17b007[_0x93c0('0x40')]!==_0x93c0('0x50')){var _0x3d66a2={};_0x3d66a2[_0x17b007[_0x93c0('0x3b')]]={'$like':'%'+_0x7feaeb['query']['filter']+'%'};return _0x3d66a2;}})});}_0x127e72=_[_0x93c0('0x4f')]({},_0x127e72,_0x7feaeb['options']);var _0x46fa1f={'where':_0x127e72['where']};return db['FaxMessage']['count'](_0x46fa1f)[_0x93c0('0x22')](function(_0x4bbf1d){_0x304e6c['count']=_0x4bbf1d;if(_0x7feaeb[_0x93c0('0x43')]['includeAll']){_0x127e72[_0x93c0('0x51')]=[{'all':!![]}];}return db['FaxMessage'][_0x93c0('0x52')](_0x127e72);})[_0x93c0('0x22')](function(_0x1b0b36){_0x304e6c[_0x93c0('0x53')]=_0x1b0b36;return _0x304e6c;})[_0x93c0('0x22')](respondWithFilteredResult(_0x3b929f,_0x127e72))[_0x93c0('0x54')](handleError(_0x3b929f,null));};exports[_0x93c0('0x55')]=function(_0x11d292,_0x53e845){var _0x29010f={'raw':!![],'where':{'id':_0x11d292[_0x93c0('0x56')]['id']}},_0x4f03fb={};_0x4f03fb[_0x93c0('0x42')]=_['keys'](db[_0x93c0('0x57')][_0x93c0('0x3e')]);_0x4f03fb[_0x93c0('0x43')]=_[_0x93c0('0x44')](_0x11d292[_0x93c0('0x43')]);_0x4f03fb[_0x93c0('0x45')]=_[_0x93c0('0x46')](_0x4f03fb['model'],_0x4f03fb[_0x93c0('0x43')]);_0x29010f['attributes']=_['intersection'](_0x4f03fb[_0x93c0('0x42')],qs[_0x93c0('0x48')](_0x11d292[_0x93c0('0x43')][_0x93c0('0x48')]));_0x29010f[_0x93c0('0x47')]=_0x29010f[_0x93c0('0x47')][_0x93c0('0x49')]?_0x29010f[_0x93c0('0x47')]:_0x4f03fb[_0x93c0('0x42')];if(_0x11d292[_0x93c0('0x43')][_0x93c0('0x58')]){_0x29010f[_0x93c0('0x51')]=[{'all':!![]}];}_0x29010f=_[_0x93c0('0x4f')]({},_0x29010f,_0x11d292[_0x93c0('0x59')]);return db[_0x93c0('0x57')]['find'](_0x29010f)[_0x93c0('0x22')](handleEntityNotFound(_0x53e845,null))[_0x93c0('0x22')](respondWithResult(_0x53e845,null))[_0x93c0('0x54')](handleError(_0x53e845,null));};exports[_0x93c0('0x37')]=function(_0x14b8ca,_0x359115){if(_0x14b8ca[_0x93c0('0x5a')]['id']){delete _0x14b8ca['body']['id'];}return db[_0x93c0('0x57')][_0x93c0('0x5b')]({'where':{'id':_0x14b8ca[_0x93c0('0x56')]['id']}})[_0x93c0('0x22')](handleEntityNotFound(_0x359115,null))['then'](saveUpdates(_0x14b8ca[_0x93c0('0x5a')],null))[_0x93c0('0x22')](respondWithResult(_0x359115,null))[_0x93c0('0x54')](handleError(_0x359115,null));};exports['destroy']=function(_0x1fb0d9,_0x3fb3f5){return db[_0x93c0('0x57')][_0x93c0('0x5b')]({'where':{'id':_0x1fb0d9[_0x93c0('0x56')]['id']}})[_0x93c0('0x22')](handleEntityNotFound(_0x3fb3f5,null))[_0x93c0('0x22')](removeEntity(_0x3fb3f5,null))[_0x93c0('0x54')](handleError(_0x3fb3f5,null));};exports['describe']=function(_0x1effdd,_0x3796dc){return db['FaxMessage'][_0x93c0('0x5c')]()[_0x93c0('0x22')](respondWithResult(_0x3796dc,null))['catch'](handleError(_0x3796dc,null));};var interaction_log=require(_0x93c0('0x15'))(_0x93c0('0x5d'));exports[_0x93c0('0x5e')]=function(_0x1d5e27,_0x5dd603,_0x2ee2f5){var _0x4f1568={'agent':{},'channel':'fax'};if(_0x1d5e27[_0x93c0('0x5a')]['id']){delete _0x1d5e27[_0x93c0('0x5a')]['id'];}_0x1d5e27[_0x93c0('0x5a')][_0x93c0('0x5f')]=!![];_0x1d5e27[_0x93c0('0x5a')]['readAt']=moment()[_0x93c0('0x60')](_0x93c0('0x61'));_0x1d5e27[_0x93c0('0x5a')][_0x93c0('0x62')]=_0x1d5e27[_0x93c0('0x5a')][_0x93c0('0x62')]||_0x1d5e27[_0x93c0('0x63')]['id'];_0x4f1568[_0x93c0('0x64')]['id']=_0x1d5e27[_0x93c0('0x5a')]['UserId'];return db['FaxMessage'][_0x93c0('0x5b')]({'where':{'id':_0x1d5e27[_0x93c0('0x56')]['id'],'UserId':null}})[_0x93c0('0x22')](handleEntityNotFound(_0x5dd603,null))['then'](saveUpdates(_0x1d5e27[_0x93c0('0x5a')],null))['then'](function(_0x4bb461){if(_0x4bb461){_0x4f1568[_0x93c0('0x29')]=_0x4bb461[_0x93c0('0x65')]({'plain':!![]});return db[_0x93c0('0x66')]['find']({'where':{'id':_0x4bb461[_0x93c0('0x67')]}});}return null;})[_0x93c0('0x22')](handleEntityNotFound(_0x5dd603,null))['then'](function(_0x11d7bd){if(_0x11d7bd){return _0x11d7bd[_0x93c0('0x37')]({'UserId':_0x1d5e27['body'][_0x93c0('0x62')],'read1stAt':_[_0x93c0('0x68')](_0x11d7bd[_0x93c0('0x69')])?moment()[_0x93c0('0x60')](_0x93c0('0x61')):undefined});}return null;})[_0x93c0('0x22')](function(_0x1e6b61){if(_0x1e6b61){_0x4f1568[_0x93c0('0x6a')]=_0x1e6b61['get']({'plain':!![]});interaction_log[_0x93c0('0x23')](_0x93c0('0x6b'),_0x1d5e27[_0x93c0('0x63')]['id'],_0x1d5e27[_0x93c0('0x63')][_0x93c0('0x3b')],_0x1d5e27['user'][_0x93c0('0x6c')],_0x4f1568[_0x93c0('0x6a')]['id'],_0x1d5e27['body']?JSON[_0x93c0('0x27')](_0x1d5e27['body']):_0x93c0('0x6d'));return respondWithRpcPromise('AcceptMessage',_0x93c0('0x6e'),_0x4f1568);}return null;})[_0x93c0('0x22')](function(_0x47ace3){var _0x232651=_0x93c0('0x6f')+_0x47ace3[_0x93c0('0x29')][_0x93c0('0x70')];return db[_0x93c0('0x71')][_0x93c0('0x43')](_0x232651,{'type':db['Sequelize'][_0x93c0('0x72')][_0x93c0('0x73')],'raw':!![]})[_0x93c0('0x22')](function(_0x5c74e3){return _0x5c74e3;});})['then'](function(_0x61ad59){if(_0x61ad59){_0x4f1568[_0x93c0('0x29')][_0x93c0('0x74')]=_0x61ad59[0x0];if(!_0x1d5e27[_0x93c0('0x5a')]['UserId'])return;return db[_0x93c0('0x75')][_0x93c0('0x5b')]({'where':{'id':_0x1d5e27['body'][_0x93c0('0x62')],'role':_0x93c0('0x64')},'attributes':['id',_0x93c0('0x3b'),_0x93c0('0x76'),_0x93c0('0x77'),_0x93c0('0x78')],'raw':!![]});}return null;})[_0x93c0('0x22')](function(_0x5067d7){if(!_0x5067d7)return null;_0x4f1568[_0x93c0('0x29')]['agent']=_0x5067d7;return _0x4f1568;})[_0x93c0('0x22')](function(_0x5dd2c7){if(_0x5dd2c7){if(_0x1d5e27[_0x93c0('0x5a')][_0x93c0('0x79')]){_0x4f1568[_0x93c0('0x29')][_0x93c0('0x7a')]=util['format'](_0x93c0('0x7b'),_0x1d5e27['user'][_0x93c0('0x3b')]);_0x4f1568[_0x93c0('0x29')]['channel']=_0x4f1568[_0x93c0('0x7c')];_0x4f1568[_0x93c0('0x29')][_0x93c0('0x7d')]=_0x4f1568[_0x93c0('0x7c')];_0x4f1568['message'][_0x93c0('0x7e')]=_0x93c0('0x5e');return respondWithRpcPromise(_0x93c0('0x7f'),_0x93c0('0x7f'),{'event':'acceptmessage','message':_0x4f1568[_0x93c0('0x29')]},client9002)[_0x93c0('0x22')](function(){return _0x4f1568;});}return _0x4f1568;}return null;})[_0x93c0('0x22')](respondWithResult(_0x5dd603,null))['catch'](handleError(_0x5dd603,null));};var interaction_log=require(_0x93c0('0x15'))(_0x93c0('0x5d'));exports[_0x93c0('0x35')]=function(_0xe3a65a,_0x20c40,_0x378ce5){var _0x5cd77f={'agent':{},'channel':'fax'};if(_0xe3a65a[_0x93c0('0x5a')]['id']){delete _0xe3a65a[_0x93c0('0x5a')]['id'];}_0xe3a65a[_0x93c0('0x5a')]['UserId']=_0xe3a65a['body'][_0x93c0('0x62')]||_0xe3a65a['user']['id'];_0x5cd77f[_0x93c0('0x64')]['id']=_0xe3a65a[_0x93c0('0x5a')][_0x93c0('0x62')];return db[_0x93c0('0x57')][_0x93c0('0x5b')]({'where':{'id':_0xe3a65a['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x20c40,null))[_0x93c0('0x22')](function(_0x1bedec){if(_0x1bedec){_0x5cd77f[_0x93c0('0x29')]=_0x1bedec[_0x93c0('0x65')]({'plain':!![]});return db[_0x93c0('0x66')][_0x93c0('0x5b')]({'where':{'id':_0x1bedec[_0x93c0('0x67')]}});}return null;})[_0x93c0('0x22')](handleEntityNotFound(_0x20c40,null))[_0x93c0('0x22')](function(_0x23e8e2){if(_0x23e8e2){_0x5cd77f[_0x93c0('0x6a')]=_0x23e8e2[_0x93c0('0x65')]({'plain':!![]});interaction_log[_0x93c0('0x23')](_0x93c0('0x80'),_0xe3a65a[_0x93c0('0x63')]['id'],_0xe3a65a[_0x93c0('0x63')][_0x93c0('0x3b')],_0xe3a65a[_0x93c0('0x63')][_0x93c0('0x6c')],_0x5cd77f['interaction']['id'],_0xe3a65a[_0x93c0('0x5a')]?JSON[_0x93c0('0x27')](_0xe3a65a['body']):_0x93c0('0x6d'));return respondWithRpcPromise(_0x93c0('0x81'),_0x93c0('0x82'),_0x5cd77f);}return null;})[_0x93c0('0x22')](function(_0x408697){var _0x378d04=_0x93c0('0x6f')+_0x408697[_0x93c0('0x29')][_0x93c0('0x70')];return db[_0x93c0('0x71')][_0x93c0('0x43')](_0x378d04,{'type':db[_0x93c0('0x83')][_0x93c0('0x72')][_0x93c0('0x73')],'raw':!![]})[_0x93c0('0x22')](function(_0x335f57){return _0x335f57;});})[_0x93c0('0x22')](function(_0x268f1c){if(_0x268f1c){_0x5cd77f[_0x93c0('0x29')]['contact']=_0x268f1c[0x0];if(!_0xe3a65a[_0x93c0('0x5a')][_0x93c0('0x62')])return;return db[_0x93c0('0x75')][_0x93c0('0x5b')]({'where':{'id':_0xe3a65a[_0x93c0('0x5a')]['UserId'],'role':_0x93c0('0x64')},'attributes':['id',_0x93c0('0x3b'),_0x93c0('0x76'),_0x93c0('0x77'),_0x93c0('0x78')],'raw':!![]});}return null;})[_0x93c0('0x22')](function(_0x57293d){if(!_0x57293d)return null;_0x5cd77f[_0x93c0('0x29')]['agent']=_0x57293d;return _0x5cd77f;})[_0x93c0('0x22')](function(_0x15420d){if(_0x15420d){_0x15420d[_0x93c0('0x29')]['interface']=util['format'](_0x93c0('0x7b'),_0xe3a65a['user']['name']);_0x15420d[_0x93c0('0x29')][_0x93c0('0x7c')]=_0x5cd77f['channel'];_0x15420d[_0x93c0('0x29')][_0x93c0('0x7d')]=_0x5cd77f[_0x93c0('0x7c')];_0x15420d[_0x93c0('0x29')][_0x93c0('0x7e')]=_0x93c0('0x35');respondWithRpcPromise(_0x93c0('0x7f'),_0x93c0('0x7f'),{'event':_0x93c0('0x84'),'message':_0x15420d['message']},client9002);return _0x5cd77f;}return null;})['then'](respondWithResult(_0x20c40,null))[_0x93c0('0x54')](handleError(_0x20c40,null));};exports['create']=function(_0x3cbf03,_0x267599){var _0x3e2696;return db[_0x93c0('0x57')][_0x93c0('0x85')](_0x3cbf03[_0x93c0('0x5a')],{})['then'](function(_0x4cd07e){_0x3e2696=_0x4cd07e;return db['CmContact'][_0x93c0('0x86')]({'where':{'id':_0x3e2696['ContactId']}});})['then'](function(_0x36a2ab){if(_['isNil'](_0x36a2ab)){return;}else{_0x3e2696[_0x93c0('0x87')]=_0x36a2ab['fax'];return db[_0x93c0('0x88')][_0x93c0('0x86')]({'where':{'id':_0x3e2696[_0x93c0('0x89')]}});}})[_0x93c0('0x22')](function(_0x40721c){return respondWithRpcPromise(_0x93c0('0x8a'),_0x93c0('0x8a'),{'FaxAccountId':_[_0x93c0('0x68')](_0x3cbf03[_0x93c0('0x5a')])?undefined:_0x3cbf03['body'][_0x93c0('0x8b')],'path':_[_0x93c0('0x68')](_0x40721c)?undefined:util['format'](_0x93c0('0x8c'),_0x40721c[_0x93c0('0x8d')]),'fax':_['isNil'](_0x3e2696[_0x93c0('0x87')])?undefined:_0x3e2696['fax'],'AttachmentId':_0x3e2696[_0x93c0('0x89')]},client9002);})[_0x93c0('0x22')](respondWithResult(_0x267599,0xc9))[_0x93c0('0x54')](handleError(_0x267599,null));};exports['download']=function(_0x33a624,_0x38a9b8){var _0x2d0add=path[_0x93c0('0x8e')](config[_0x93c0('0x8f')],'server',_0x93c0('0x90'),_0x93c0('0x91'));return db[_0x93c0('0x57')][_0x93c0('0x5b')]({'where':{'id':_0x33a624[_0x93c0('0x56')]['id']},'include':[{'model':db[_0x93c0('0x88')],'as':_0x93c0('0x88')}]})[_0x93c0('0x22')](handleEntityNotFound(_0x38a9b8,null))[_0x93c0('0x22')](function(_0xa1aeeb){if(_0xa1aeeb){return _0x38a9b8[_0x93c0('0x92')](path[_0x93c0('0x8e')](_0x2d0add,_0xa1aeeb[_0x93c0('0x88')][_0x93c0('0x8d')]));}})[_0x93c0('0x54')](handleError(_0x38a9b8,null));}; \ No newline at end of file +var _0xedd3=['create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./faxMessage.socket','register','client','http','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','FaxMessage,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','name','send','index','FaxMessage','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','VIRTUAL','options','includeAll','rows','show','params','keys','include','merge','body','find','destroy','describe','../../config/logger','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','update','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','fax-interactions','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','event','rejectmessage'];(function(_0x84f57c,_0x2ea321){var _0x37507a=function(_0x2fc746){while(--_0x2fc746){_0x84f57c['push'](_0x84f57c['shift']());}};_0x37507a(++_0x2ea321);}(_0xedd3,0xa1));var _0x3edd=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xedd3[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x3edd('0x0'));var rimraf=require(_0x3edd('0x1'));var zipdir=require(_0x3edd('0x2'));var jsonpatch=require(_0x3edd('0x3'));var rp=require('request-promise');var moment=require(_0x3edd('0x4'));var BPromise=require(_0x3edd('0x5'));var Mustache=require(_0x3edd('0x6'));var util=require(_0x3edd('0x7'));var path=require(_0x3edd('0x8'));var sox=require(_0x3edd('0x9'));var csv=require(_0x3edd('0xa'));var ejs=require(_0x3edd('0xb'));var fs=require('fs');var fs_extra=require(_0x3edd('0xc'));var _=require(_0x3edd('0xd'));var squel=require(_0x3edd('0xe'));var crypto=require(_0x3edd('0xf'));var jsforce=require(_0x3edd('0x10'));var deskjs=require(_0x3edd('0x11'));var toCsv=require(_0x3edd('0xa'));var querystring=require(_0x3edd('0x12'));var Papa=require(_0x3edd('0x13'));var Redis=require(_0x3edd('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3edd('0x15'));var hardwareService=require(_0x3edd('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x3edd('0x17'));var config=require(_0x3edd('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3edd('0x19')]=_[_0x3edd('0x1a')](config[_0x3edd('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x3edd('0x1b'))(new Redis(config[_0x3edd('0x19')]));require(_0x3edd('0x1c'))[_0x3edd('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3edd('0x1e')][_0x3edd('0x1f')]({'port':0x232c});var client9002=jayson[_0x3edd('0x1e')][_0x3edd('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5c3a31,_0x2518e1,_0x5a541b,_0x499dc2){return new BPromise(function(_0x555fb8,_0x1006bb){var _0x38bf98=_0x499dc2||client;return _0x38bf98['request'](_0x5c3a31,_0x5a541b)[_0x3edd('0x20')](function(_0x422e1b){logger['info']('FaxMessage,\x20%s,\x20%s',_0x2518e1,_0x3edd('0x21'));logger[_0x3edd('0x22')](_0x3edd('0x23'),_0x2518e1,'request\x20sent',JSON['stringify'](_0x422e1b));if(_0x422e1b[_0x3edd('0x24')]){if(_0x422e1b[_0x3edd('0x24')]['code']===0x1f4){logger[_0x3edd('0x24')]('FaxMessage,\x20%s,\x20%s',_0x2518e1,_0x422e1b[_0x3edd('0x24')][_0x3edd('0x25')]);return _0x1006bb(_0x422e1b[_0x3edd('0x24')]['message']);}logger[_0x3edd('0x24')](_0x3edd('0x26'),_0x2518e1,_0x422e1b[_0x3edd('0x24')][_0x3edd('0x25')]);return _0x555fb8(_0x422e1b[_0x3edd('0x24')][_0x3edd('0x25')]);}else{logger[_0x3edd('0x27')](_0x3edd('0x26'),_0x2518e1,'request\x20sent');_0x555fb8(_0x422e1b[_0x3edd('0x28')]['message']);}})[_0x3edd('0x29')](function(_0x39a5eb){logger[_0x3edd('0x24')](_0x3edd('0x26'),_0x2518e1,_0x39a5eb);_0x1006bb(_0x39a5eb);});});}function respondWithStatusCode(_0xc8218e,_0x2992fe){_0x2992fe=_0x2992fe||0xcc;return function(_0x1c7e6f){if(_0x1c7e6f){return _0xc8218e[_0x3edd('0x2a')](_0x2992fe);}return _0xc8218e[_0x3edd('0x2b')](_0x2992fe)[_0x3edd('0x2c')]();};}function respondWithResult(_0xe03841,_0x37adb3){_0x37adb3=_0x37adb3||0xc8;return function(_0xc1d12a){if(_0xc1d12a){return _0xe03841['status'](_0x37adb3)[_0x3edd('0x2d')](_0xc1d12a);}};}function respondWithFilteredResult(_0x134341,_0x53c5a3){return function(_0x3fc5fa){if(_0x3fc5fa){var _0x447973=typeof _0x53c5a3[_0x3edd('0x2e')]===_0x3edd('0x2f')&&typeof _0x53c5a3['limit']===_0x3edd('0x2f');var _0x2da222=_0x3fc5fa[_0x3edd('0x30')];var _0x549fcc=_0x447973?0x0:_0x53c5a3['offset'];var _0x55ec3a=_0x447973?_0x3fc5fa[_0x3edd('0x30')]:_0x53c5a3[_0x3edd('0x2e')]+_0x53c5a3[_0x3edd('0x31')];var _0x496cef;if(_0x55ec3a>=_0x2da222){_0x55ec3a=_0x2da222;_0x496cef=0xc8;}else{_0x496cef=0xce;}_0x134341[_0x3edd('0x2b')](_0x496cef);return _0x134341[_0x3edd('0x32')](_0x3edd('0x33'),_0x549fcc+'-'+_0x55ec3a+'/'+_0x2da222)['json'](_0x3fc5fa);}return null;};}function patchUpdates(_0x24eb60){return function(_0x1d1677){try{jsonpatch[_0x3edd('0x34')](_0x1d1677,_0x24eb60,!![]);}catch(_0xa7909b){return BPromise[_0x3edd('0x35')](_0xa7909b);}return _0x1d1677[_0x3edd('0x36')]();};}function saveUpdates(_0xa549db,_0x378def){return function(_0x2a08db){if(_0x2a08db){return _0x2a08db['update'](_0xa549db)['then'](function(_0x1d6b4b){return _0x1d6b4b;});}return null;};}function removeEntity(_0x5b56da,_0xe3a780){return function(_0x3b8778){if(_0x3b8778){return _0x3b8778['destroy']()[_0x3edd('0x20')](function(){_0x5b56da['status'](0xcc)[_0x3edd('0x2c')]();});}};}function handleEntityNotFound(_0xcdf96b,_0x56bd78){return function(_0x441c53){if(!_0x441c53){_0xcdf96b[_0x3edd('0x2a')](0x194);}return _0x441c53;};}function handleError(_0x4c1f6d,_0x5056b4){_0x5056b4=_0x5056b4||0x1f4;return function(_0x2d4670){logger['error'](_0x2d4670['stack']);if(_0x2d4670[_0x3edd('0x37')]){delete _0x2d4670[_0x3edd('0x37')];}_0x4c1f6d[_0x3edd('0x2b')](_0x5056b4)[_0x3edd('0x38')](_0x2d4670);};}exports[_0x3edd('0x39')]=function(_0x358603,_0x4757eb){var _0x59dafa={},_0x45681c={},_0x1310f1={'count':0x0,'rows':[]};var _0x5b7ee8=_['map'](db[_0x3edd('0x3a')][_0x3edd('0x3b')],function(_0x3df5f1){return{'name':_0x3df5f1[_0x3edd('0x3c')],'type':_0x3df5f1[_0x3edd('0x3d')][_0x3edd('0x3e')]};});_0x45681c[_0x3edd('0x3f')]=_[_0x3edd('0x40')](_0x5b7ee8,_0x3edd('0x37'));_0x45681c[_0x3edd('0x41')]=_['keys'](_0x358603[_0x3edd('0x41')]);_0x45681c[_0x3edd('0x42')]=_[_0x3edd('0x43')](_0x45681c['model'],_0x45681c[_0x3edd('0x41')]);_0x59dafa[_0x3edd('0x44')]=_['intersection'](_0x45681c[_0x3edd('0x3f')],qs[_0x3edd('0x45')](_0x358603[_0x3edd('0x41')][_0x3edd('0x45')]));_0x59dafa['attributes']=_0x59dafa[_0x3edd('0x44')]['length']?_0x59dafa[_0x3edd('0x44')]:_0x45681c[_0x3edd('0x3f')];if(!_0x358603[_0x3edd('0x41')][_0x3edd('0x46')]('nolimit')){_0x59dafa[_0x3edd('0x31')]=qs['limit'](_0x358603[_0x3edd('0x41')]['limit']);_0x59dafa[_0x3edd('0x2e')]=qs[_0x3edd('0x2e')](_0x358603[_0x3edd('0x41')]['offset']);}_0x59dafa[_0x3edd('0x47')]=qs[_0x3edd('0x48')](_0x358603[_0x3edd('0x41')][_0x3edd('0x48')]);_0x59dafa[_0x3edd('0x49')]=qs[_0x3edd('0x42')](_['pick'](_0x358603['query'],_0x45681c['filters']),_0x5b7ee8);if(_0x358603[_0x3edd('0x41')][_0x3edd('0x4a')]){_0x59dafa[_0x3edd('0x49')]=_['merge'](_0x59dafa[_0x3edd('0x49')],{'$or':_[_0x3edd('0x40')](_0x5b7ee8,function(_0x54a271){if(_0x54a271[_0x3edd('0x3d')]!==_0x3edd('0x4b')){var _0x21d1ed={};_0x21d1ed[_0x54a271[_0x3edd('0x37')]]={'$like':'%'+_0x358603[_0x3edd('0x41')][_0x3edd('0x4a')]+'%'};return _0x21d1ed;}})});}_0x59dafa=_['merge']({},_0x59dafa,_0x358603[_0x3edd('0x4c')]);var _0x34434d={'where':_0x59dafa[_0x3edd('0x49')]};return db['FaxMessage'][_0x3edd('0x30')](_0x34434d)[_0x3edd('0x20')](function(_0x1c0f76){_0x1310f1[_0x3edd('0x30')]=_0x1c0f76;if(_0x358603[_0x3edd('0x41')][_0x3edd('0x4d')]){_0x59dafa['include']=[{'all':!![]}];}return db[_0x3edd('0x3a')]['findAll'](_0x59dafa);})['then'](function(_0x335d47){_0x1310f1[_0x3edd('0x4e')]=_0x335d47;return _0x1310f1;})[_0x3edd('0x20')](respondWithFilteredResult(_0x4757eb,_0x59dafa))[_0x3edd('0x29')](handleError(_0x4757eb,null));};exports[_0x3edd('0x4f')]=function(_0x576286,_0x4d4bd8){var _0x57dccd={'raw':!![],'where':{'id':_0x576286[_0x3edd('0x50')]['id']}},_0x5c41ae={};_0x5c41ae[_0x3edd('0x3f')]=_['keys'](db['FaxMessage'][_0x3edd('0x3b')]);_0x5c41ae[_0x3edd('0x41')]=_[_0x3edd('0x51')](_0x576286[_0x3edd('0x41')]);_0x5c41ae['filters']=_[_0x3edd('0x43')](_0x5c41ae['model'],_0x5c41ae['query']);_0x57dccd[_0x3edd('0x44')]=_[_0x3edd('0x43')](_0x5c41ae[_0x3edd('0x3f')],qs[_0x3edd('0x45')](_0x576286[_0x3edd('0x41')][_0x3edd('0x45')]));_0x57dccd[_0x3edd('0x44')]=_0x57dccd['attributes']['length']?_0x57dccd['attributes']:_0x5c41ae[_0x3edd('0x3f')];if(_0x576286[_0x3edd('0x41')][_0x3edd('0x4d')]){_0x57dccd[_0x3edd('0x52')]=[{'all':!![]}];}_0x57dccd=_[_0x3edd('0x53')]({},_0x57dccd,_0x576286[_0x3edd('0x4c')]);return db['FaxMessage']['find'](_0x57dccd)[_0x3edd('0x20')](handleEntityNotFound(_0x4d4bd8,null))[_0x3edd('0x20')](respondWithResult(_0x4d4bd8,null))[_0x3edd('0x29')](handleError(_0x4d4bd8,null));};exports['update']=function(_0x55a488,_0x38d8c5){if(_0x55a488['body']['id']){delete _0x55a488[_0x3edd('0x54')]['id'];}return db['FaxMessage'][_0x3edd('0x55')]({'where':{'id':_0x55a488[_0x3edd('0x50')]['id']}})[_0x3edd('0x20')](handleEntityNotFound(_0x38d8c5,null))['then'](saveUpdates(_0x55a488[_0x3edd('0x54')],null))[_0x3edd('0x20')](respondWithResult(_0x38d8c5,null))[_0x3edd('0x29')](handleError(_0x38d8c5,null));};exports[_0x3edd('0x56')]=function(_0x46de05,_0x22d9f7){return db[_0x3edd('0x3a')][_0x3edd('0x55')]({'where':{'id':_0x46de05[_0x3edd('0x50')]['id']}})['then'](handleEntityNotFound(_0x22d9f7,null))[_0x3edd('0x20')](removeEntity(_0x22d9f7,null))[_0x3edd('0x29')](handleError(_0x22d9f7,null));};exports[_0x3edd('0x57')]=function(_0x553aaa,_0x593517){return db[_0x3edd('0x3a')]['describe']()[_0x3edd('0x20')](respondWithResult(_0x593517,null))[_0x3edd('0x29')](handleError(_0x593517,null));};var interaction_log=require(_0x3edd('0x58'))('fax-interactions');exports[_0x3edd('0x59')]=function(_0xffa645,_0x39fc48,_0x447818){var _0x5e5017={'agent':{},'channel':_0x3edd('0x5a')};if(_0xffa645[_0x3edd('0x54')]['id']){delete _0xffa645['body']['id'];}_0xffa645[_0x3edd('0x54')]['read']=!![];_0xffa645['body'][_0x3edd('0x5b')]=moment()[_0x3edd('0x5c')](_0x3edd('0x5d'));_0xffa645[_0x3edd('0x54')][_0x3edd('0x5e')]=_0xffa645[_0x3edd('0x54')][_0x3edd('0x5e')]||_0xffa645[_0x3edd('0x5f')]['id'];_0x5e5017[_0x3edd('0x60')]['id']=_0xffa645['body'][_0x3edd('0x5e')];return db[_0x3edd('0x3a')]['find']({'where':{'id':_0xffa645[_0x3edd('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x39fc48,null))[_0x3edd('0x20')](saveUpdates(_0xffa645[_0x3edd('0x54')],null))[_0x3edd('0x20')](function(_0x16b907){if(_0x16b907){_0x5e5017['message']=_0x16b907[_0x3edd('0x61')]({'plain':!![]});return db[_0x3edd('0x62')][_0x3edd('0x55')]({'where':{'id':_0x16b907['FaxInteractionId']}});}return null;})[_0x3edd('0x20')](handleEntityNotFound(_0x39fc48,null))[_0x3edd('0x20')](function(_0x155235){if(_0x155235){return _0x155235[_0x3edd('0x63')]({'UserId':_0xffa645[_0x3edd('0x54')][_0x3edd('0x5e')],'read1stAt':_[_0x3edd('0x64')](_0x155235[_0x3edd('0x65')])?moment()[_0x3edd('0x5c')](_0x3edd('0x5d')):undefined});}return null;})[_0x3edd('0x20')](function(_0x1d1dc0){if(_0x1d1dc0){_0x5e5017['interaction']=_0x1d1dc0[_0x3edd('0x61')]({'plain':!![]});interaction_log['info'](_0x3edd('0x66'),_0xffa645[_0x3edd('0x5f')]['id'],_0xffa645[_0x3edd('0x5f')][_0x3edd('0x37')],_0xffa645[_0x3edd('0x5f')][_0x3edd('0x67')],_0x5e5017[_0x3edd('0x68')]['id'],_0xffa645[_0x3edd('0x54')]?JSON['stringify'](_0xffa645[_0x3edd('0x54')]):_0x3edd('0x69'));return respondWithRpcPromise('AcceptMessage',_0x3edd('0x6a'),_0x5e5017);}return null;})[_0x3edd('0x20')](function(_0x1721eb){var _0x4c6106='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1721eb['message'][_0x3edd('0x6b')];return db[_0x3edd('0x6c')]['query'](_0x4c6106,{'type':db[_0x3edd('0x6d')][_0x3edd('0x6e')][_0x3edd('0x6f')],'raw':!![]})[_0x3edd('0x20')](function(_0x1b6c1a){return _0x1b6c1a;});})[_0x3edd('0x20')](function(_0x138769){if(_0x138769){_0x5e5017['message'][_0x3edd('0x70')]=_0x138769[0x0];if(!_0xffa645[_0x3edd('0x54')][_0x3edd('0x5e')])return;return db[_0x3edd('0x71')][_0x3edd('0x55')]({'where':{'id':_0xffa645[_0x3edd('0x54')][_0x3edd('0x5e')],'role':'agent'},'attributes':['id','name',_0x3edd('0x72'),_0x3edd('0x73'),_0x3edd('0x74')],'raw':!![]});}return null;})[_0x3edd('0x20')](function(_0x5ce460){if(!_0x5ce460)return null;_0x5e5017[_0x3edd('0x25')][_0x3edd('0x60')]=_0x5ce460;return _0x5e5017;})[_0x3edd('0x20')](function(_0x200cf0){if(_0x200cf0){if(_0xffa645[_0x3edd('0x54')][_0x3edd('0x75')]){_0x5e5017[_0x3edd('0x25')][_0x3edd('0x76')]=util[_0x3edd('0x5c')](_0x3edd('0x77'),_0xffa645['user'][_0x3edd('0x37')]);_0x5e5017[_0x3edd('0x25')][_0x3edd('0x78')]=_0x5e5017[_0x3edd('0x78')];_0x5e5017[_0x3edd('0x25')][_0x3edd('0x79')]=_0x5e5017['channel'];_0x5e5017[_0x3edd('0x25')]['event']=_0x3edd('0x59');return respondWithRpcPromise('EventManager',_0x3edd('0x7a'),{'event':_0x3edd('0x7b'),'message':_0x5e5017[_0x3edd('0x25')]},client9002)[_0x3edd('0x20')](function(){return _0x5e5017;});}return _0x5e5017;}return null;})[_0x3edd('0x20')](respondWithResult(_0x39fc48,null))[_0x3edd('0x29')](handleError(_0x39fc48,null));};var interaction_log=require(_0x3edd('0x58'))(_0x3edd('0x7c'));exports[_0x3edd('0x35')]=function(_0x5dd52b,_0xce7e9b,_0x2f33a3){var _0x36db12={'agent':{},'channel':_0x3edd('0x5a')};if(_0x5dd52b[_0x3edd('0x54')]['id']){delete _0x5dd52b[_0x3edd('0x54')]['id'];}_0x5dd52b['body'][_0x3edd('0x5e')]=_0x5dd52b[_0x3edd('0x54')][_0x3edd('0x5e')]||_0x5dd52b[_0x3edd('0x5f')]['id'];_0x36db12['agent']['id']=_0x5dd52b['body']['UserId'];return db[_0x3edd('0x3a')]['find']({'where':{'id':_0x5dd52b[_0x3edd('0x50')]['id'],'UserId':null}})[_0x3edd('0x20')](handleEntityNotFound(_0xce7e9b,null))[_0x3edd('0x20')](function(_0x1f1687){if(_0x1f1687){_0x36db12[_0x3edd('0x25')]=_0x1f1687[_0x3edd('0x61')]({'plain':!![]});return db[_0x3edd('0x62')][_0x3edd('0x55')]({'where':{'id':_0x1f1687[_0x3edd('0x7d')]}});}return null;})[_0x3edd('0x20')](handleEntityNotFound(_0xce7e9b,null))['then'](function(_0x129de9){if(_0x129de9){_0x36db12['interaction']=_0x129de9[_0x3edd('0x61')]({'plain':!![]});interaction_log[_0x3edd('0x27')](_0x3edd('0x7e'),_0x5dd52b[_0x3edd('0x5f')]['id'],_0x5dd52b['user']['name'],_0x5dd52b['user']['role'],_0x36db12[_0x3edd('0x68')]['id'],_0x5dd52b[_0x3edd('0x54')]?JSON[_0x3edd('0x7f')](_0x5dd52b[_0x3edd('0x54')]):_0x3edd('0x69'));return respondWithRpcPromise(_0x3edd('0x80'),_0x3edd('0x81'),_0x36db12);}return null;})['then'](function(_0xab1616){var _0x5124ce=_0x3edd('0x82')+_0xab1616['message'][_0x3edd('0x6b')];return db[_0x3edd('0x6c')][_0x3edd('0x41')](_0x5124ce,{'type':db[_0x3edd('0x6d')][_0x3edd('0x6e')][_0x3edd('0x6f')],'raw':!![]})[_0x3edd('0x20')](function(_0x2348b3){return _0x2348b3;});})[_0x3edd('0x20')](function(_0x4c4636){if(_0x4c4636){_0x36db12[_0x3edd('0x25')][_0x3edd('0x70')]=_0x4c4636[0x0];if(!_0x5dd52b[_0x3edd('0x54')][_0x3edd('0x5e')])return;return db['User']['find']({'where':{'id':_0x5dd52b[_0x3edd('0x54')][_0x3edd('0x5e')],'role':_0x3edd('0x60')},'attributes':['id',_0x3edd('0x37'),'fullname',_0x3edd('0x73'),'internal'],'raw':!![]});}return null;})[_0x3edd('0x20')](function(_0x30d62b){if(!_0x30d62b)return null;_0x36db12['message']['agent']=_0x30d62b;return _0x36db12;})[_0x3edd('0x20')](function(_0x5e7f36){if(_0x5e7f36){_0x5e7f36[_0x3edd('0x25')]['interface']=util[_0x3edd('0x5c')](_0x3edd('0x77'),_0x5dd52b[_0x3edd('0x5f')][_0x3edd('0x37')]);_0x5e7f36[_0x3edd('0x25')][_0x3edd('0x78')]=_0x36db12[_0x3edd('0x78')];_0x5e7f36[_0x3edd('0x25')][_0x3edd('0x79')]=_0x36db12['channel'];_0x5e7f36[_0x3edd('0x25')][_0x3edd('0x83')]=_0x3edd('0x35');respondWithRpcPromise(_0x3edd('0x7a'),_0x3edd('0x7a'),{'event':_0x3edd('0x84'),'message':_0x5e7f36['message']},client9002);return _0x36db12;}return null;})[_0x3edd('0x20')](respondWithResult(_0xce7e9b,null))['catch'](handleError(_0xce7e9b,null));};exports[_0x3edd('0x85')]=function(_0x27a296,_0x43b0af){var _0x3f177f;return db['FaxMessage'][_0x3edd('0x85')](_0x27a296[_0x3edd('0x54')],{})[_0x3edd('0x20')](function(_0x1ed6da){_0x3f177f=_0x1ed6da;return db[_0x3edd('0x86')][_0x3edd('0x87')]({'where':{'id':_0x3f177f[_0x3edd('0x6b')]}});})['then'](function(_0x105be9){if(_[_0x3edd('0x64')](_0x105be9)){return;}else{_0x3f177f[_0x3edd('0x5a')]=_0x105be9[_0x3edd('0x5a')];return db[_0x3edd('0x88')][_0x3edd('0x87')]({'where':{'id':_0x3f177f[_0x3edd('0x89')]}});}})['then'](function(_0x2747d1){return respondWithRpcPromise(_0x3edd('0x8a'),'SendFax',{'FaxAccountId':_[_0x3edd('0x64')](_0x27a296[_0x3edd('0x54')])?undefined:_0x27a296['body'][_0x3edd('0x8b')],'path':_[_0x3edd('0x64')](_0x2747d1)?undefined:util['format'](_0x3edd('0x8c'),_0x2747d1[_0x3edd('0x8d')]),'fax':_[_0x3edd('0x64')](_0x3f177f['fax'])?undefined:_0x3f177f[_0x3edd('0x5a')],'AttachmentId':_0x3f177f[_0x3edd('0x89')]},client9002);})[_0x3edd('0x20')](respondWithResult(_0x43b0af,0xc9))[_0x3edd('0x29')](handleError(_0x43b0af,null));};exports[_0x3edd('0x8e')]=function(_0x2bbc11,_0xb3aed6){var _0x55ffd3=path[_0x3edd('0x8f')](config[_0x3edd('0x90')],_0x3edd('0x91'),_0x3edd('0x92'),'attachments');return db[_0x3edd('0x3a')][_0x3edd('0x55')]({'where':{'id':_0x2bbc11[_0x3edd('0x50')]['id']},'include':[{'model':db[_0x3edd('0x88')],'as':_0x3edd('0x88')}]})[_0x3edd('0x20')](handleEntityNotFound(_0xb3aed6,null))[_0x3edd('0x20')](function(_0x52bfa6){if(_0x52bfa6){return _0xb3aed6[_0x3edd('0x8e')](path[_0x3edd('0x8f')](_0x55ffd3,_0x52bfa6[_0x3edd('0x88')][_0x3edd('0x8d')]));}})[_0x3edd('0x29')](handleError(_0xb3aed6,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 3b8b73e..0600349 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 _0xc0f9=['../../mysqldb','FaxMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x550f37,_0x48c697){var _0x4f2de5=function(_0xfa6c67){while(--_0xfa6c67){_0x550f37['push'](_0x550f37['shift']());}};_0x4f2de5(++_0x48c697);}(_0xc0f9,0xc5));var _0x9c0f=function(_0x4b33d1,_0x2414e1){_0x4b33d1=_0x4b33d1-0x0;var _0x9e7221=_0xc0f9[_0x4b33d1];return _0x9e7221;};'use strict';var EventEmitter=require(_0x9c0f('0x0'));var FaxMessage=require(_0x9c0f('0x1'))['db'][_0x9c0f('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x9c0f('0x3')](0x0);var events={'afterCreate':_0x9c0f('0x4'),'afterUpdate':_0x9c0f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x79623d){return function(_0x273940,_0x154d45,_0x54b878){FaxMessageEvents[_0x9c0f('0x6')](_0x79623d+':'+_0x273940['id'],_0x273940);FaxMessageEvents[_0x9c0f('0x6')](_0x79623d,_0x273940);_0x54b878(null);};}for(var e in events){if(events[_0x9c0f('0x7')](e)){var event=events[e];FaxMessage[_0x9c0f('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x3646=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x5bef26,_0x3f1f44){var _0x262d69=function(_0x111b63){while(--_0x111b63){_0x5bef26['push'](_0x5bef26['shift']());}};_0x262d69(++_0x3f1f44);}(_0x3646,0x15f));var _0x6364=function(_0x55b781,_0x38d078){_0x55b781=_0x55b781-0x0;var _0x339d96=_0x3646[_0x55b781];return _0x339d96;};'use strict';var EventEmitter=require(_0x6364('0x0'));var FaxMessage=require(_0x6364('0x1'))['db'][_0x6364('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x6364('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6364('0x4'),'afterDestroy':_0x6364('0x5')};function emitEvent(_0x37eb9a){return function(_0x328286,_0x2efdbf,_0x2448c6){FaxMessageEvents[_0x6364('0x6')](_0x37eb9a+':'+_0x328286['id'],_0x328286);FaxMessageEvents[_0x6364('0x6')](_0x37eb9a,_0x328286);_0x2448c6(null);};}for(var e in events){if(events[_0x6364('0x7')](e)){var event=events[e];FaxMessage[_0x6364('0x8')](e,emitEvent(event));}}module[_0x6364('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index c6febec..70860cf 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 _0xa0ad=['error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','models','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xa0ad,0x162));var _0xda0a=function(_0x56a871,_0x18b7fe){_0x56a871=_0x56a871-0x0;var _0x124954=_0xa0ad[_0x56a871];return _0x124954;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xda0a('0x0'))(_0xda0a('0x1'));var moment=require(_0xda0a('0x2'));var BPromise=require(_0xda0a('0x3'));var rp=require(_0xda0a('0x4'));var fs=require('fs');var path=require(_0xda0a('0x5'));var rimraf=require('rimraf');var config=require(_0xda0a('0x6'));var attributes=require(_0xda0a('0x7'));module[_0xda0a('0x8')]=function(_0x4a92cc,_0x3cb6da){return _0x4a92cc['define'](_0xda0a('0x9'),attributes,{'tableName':_0xda0a('0xa'),'paranoid':![],'indexes':[{'name':_0xda0a('0xb'),'fields':[_0xda0a('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xb45bc8,_0x40a518,_0x430363){var _0x1caaf6=_0x4a92cc[_0xda0a('0xd')];var _0x55ca86=_0xb45bc8['get']({'plain':!![]});if(_0x55ca86[_0xda0a('0xe')][_0xda0a('0xf')]()==='in'||_0x55ca86[_0xda0a('0xe')][_0xda0a('0xf')]()===_0xda0a('0x10')&&!_0x55ca86[_0xda0a('0x11')]&&!_[_0xda0a('0x12')](_0x55ca86[_0xda0a('0x13')])){_0x1caaf6[_0xda0a('0x14')][_0xda0a('0x15')]({'where':{'id':_0x55ca86[_0xda0a('0x16')]}})[_0xda0a('0x17')](function(_0x4383d4){if(_0x4383d4){_0x4383d4['update']({'lastMsgAt':_0x55ca86['createdAt'],'lastMsgDirection':_0x55ca86[_0xda0a('0xe')][_0xda0a('0xf')]()});}})['catch'](function(_0x3bf4aa){console[_0xda0a('0x18')](_0x3bf4aa);});}_0x430363();}},'charset':_0xda0a('0x19'),'collate':_0xda0a('0x1a')});}; \ No newline at end of file +var _0x29e3=['path','exports','define','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','FaxInteraction','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','moment'];(function(_0x2efc84,_0x4b2559){var _0x44cf16=function(_0x1a0e7c){while(--_0x1a0e7c){_0x2efc84['push'](_0x2efc84['shift']());}};_0x44cf16(++_0x4b2559);}(_0x29e3,0x11d));var _0x329e=function(_0x1f8a9b,_0x5ae254){_0x1f8a9b=_0x1f8a9b-0x0;var _0x365820=_0x29e3[_0x1f8a9b];return _0x365820;};'use strict';var _=require('lodash');var util=require(_0x329e('0x0'));var logger=require('../../config/logger')(_0x329e('0x1'));var moment=require(_0x329e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x329e('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0x329e('0x4')]=function(_0x3298c6,_0x19c0d5){return _0x3298c6[_0x329e('0x5')]('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x329e('0x6'),'fields':[_0x329e('0x7')],'type':_0x329e('0x8')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x15aefa,_0x546914,_0x2a74cf){var _0x3907f3=_0x3298c6[_0x329e('0x9')];var _0x4cfc51=_0x15aefa[_0x329e('0xa')]({'plain':!![]});if(_0x4cfc51['direction'][_0x329e('0xb')]()==='in'||_0x4cfc51[_0x329e('0xc')][_0x329e('0xb')]()===_0x329e('0xd')&&!_0x4cfc51[_0x329e('0xe')]&&!_[_0x329e('0xf')](_0x4cfc51['UserId'])){_0x3907f3[_0x329e('0x10')][_0x329e('0x11')]({'where':{'id':_0x4cfc51['FaxInteractionId']}})['then'](function(_0x143b07){if(_0x143b07){_0x143b07[_0x329e('0x12')]({'lastMsgAt':_0x4cfc51[_0x329e('0x13')],'lastMsgDirection':_0x4cfc51[_0x329e('0xc')][_0x329e('0xb')]()});}})[_0x329e('0x14')](function(_0x1d80e3){console[_0x329e('0x15')](_0x1d80e3);});}_0x2a74cf();}},'charset':_0x329e('0x16'),'collate':_0x329e('0x17')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index da844e7..a66396f 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 _0x22fb=['request','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','options','raw','then','debug','UpdateFaxMessage','update','body','attributes','limit','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x22fb,0x192));var _0xb22f=function(_0x3af0a4,_0x344e12){_0x3af0a4=_0x3af0a4-0x0;var _0x6b1667=_0x22fb[_0x3af0a4];return _0x6b1667;};'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});config[_0xb22f('0xa')]=_[_0xb22f('0xb')](config['redis'],{'host':_0xb22f('0xc'),'port':0x18eb});var socket=require(_0xb22f('0xd'))(new Redis(config[_0xb22f('0xa')]));require(_0xb22f('0xe'))[_0xb22f('0xf')](socket);function respondWithRpcPromise(_0x3593fb,_0x188cea,_0x2ca6dd){return new BPromise(function(_0x26cf79,_0x2676f3){return client[_0xb22f('0x10')](_0x3593fb,_0x2ca6dd)['then'](function(_0x4b9e56){logger['info'](_0xb22f('0x11'),_0x188cea,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x188cea,_0xb22f('0x12'),JSON[_0xb22f('0x13')](_0x4b9e56));if(_0x4b9e56[_0xb22f('0x14')]){if(_0x4b9e56[_0xb22f('0x14')][_0xb22f('0x15')]===0x1f4){logger[_0xb22f('0x14')]('FaxMessage,\x20%s,\x20%s',_0x188cea,_0x4b9e56[_0xb22f('0x14')]['message']);return _0x2676f3(_0x4b9e56[_0xb22f('0x14')]['message']);}logger[_0xb22f('0x14')](_0xb22f('0x11'),_0x188cea,_0x4b9e56[_0xb22f('0x14')][_0xb22f('0x16')]);return _0x26cf79(_0x4b9e56[_0xb22f('0x14')]['message']);}else{logger[_0xb22f('0x17')]('FaxMessage,\x20%s,\x20%s',_0x188cea,_0xb22f('0x12'));_0x26cf79(_0x4b9e56[_0xb22f('0x18')][_0xb22f('0x16')]);}})[_0xb22f('0x19')](function(_0x139bb6){logger[_0xb22f('0x14')]('FaxMessage,\x20%s,\x20%s',_0x188cea,_0x139bb6);_0x2676f3(_0x139bb6);});});}exports[_0xb22f('0x1a')]=function(_0x4b4510){var _0x3e05ce=this;return new Promise(function(_0x3878d8,_0x316f11){return db[_0xb22f('0x1b')][_0xb22f('0x1c')](_0x4b4510['body'],{'raw':_0x4b4510['options']?_0x4b4510[_0xb22f('0x1d')][_0xb22f('0x1e')]===undefined?!![]:![]:!![]})[_0xb22f('0x1f')](function(_0x16e465){logger[_0xb22f('0x17')](_0xb22f('0x1a'),_0x4b4510);logger[_0xb22f('0x20')](_0xb22f('0x1a'),_0x4b4510,JSON['stringify'](_0x16e465));_0x3878d8(_0x16e465);})['catch'](function(_0x3ab1d8){logger[_0xb22f('0x14')]('CreateFaxMessage',_0x3ab1d8[_0xb22f('0x16')],_0x4b4510);_0x316f11(_0x3e05ce[_0xb22f('0x14')](0x1f4,_0x3ab1d8['message']));});});};exports[_0xb22f('0x21')]=function(_0x2918be){var _0x4dfb62=this;return new Promise(function(_0x3e471f,_0x2c4a9e){return db[_0xb22f('0x1b')][_0xb22f('0x22')](_0x2918be[_0xb22f('0x23')],{'raw':_0x2918be[_0xb22f('0x1d')]?_0x2918be[_0xb22f('0x1d')][_0xb22f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2918be['options']?_0x2918be['options']['where']||null:null,'attributes':_0x2918be[_0xb22f('0x1d')]?_0x2918be['options'][_0xb22f('0x24')]||null:null,'limit':_0x2918be[_0xb22f('0x1d')]?_0x2918be[_0xb22f('0x1d')][_0xb22f('0x25')]||null:null})[_0xb22f('0x1f')](function(_0x5b2a42){logger['info'](_0xb22f('0x21'),_0x2918be);logger[_0xb22f('0x20')](_0xb22f('0x21'),_0x2918be,JSON[_0xb22f('0x13')](_0x5b2a42));_0x3e471f(_0x5b2a42);})['catch'](function(_0x176133){logger[_0xb22f('0x14')]('UpdateFaxMessage',_0x176133[_0xb22f('0x16')],_0x2918be);_0x2c4a9e(_0x4dfb62[_0xb22f('0x14')](0x1f4,_0x176133[_0xb22f('0x16')]));});});}; \ No newline at end of file +var _0x2dae=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','result','catch','CreateFaxMessage','FaxMessage','create','body','options','debug','UpdateFaxMessage','update','raw','attributes'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x2dae,0xc3));var _0xe2da=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0x2dae[_0x2afbb0];return _0x411ff2;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var moment=require(_0xe2da('0x1'));var BPromise=require(_0xe2da('0x2'));var rs=require(_0xe2da('0x3'));var fs=require('fs');var Redis=require(_0xe2da('0x4'));var db=require(_0xe2da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2da('0x6'))(_0xe2da('0x7'));var config=require(_0xe2da('0x8'));var jayson=require(_0xe2da('0x9'));var client=jayson['client'][_0xe2da('0xa')]({'port':0x232a});config[_0xe2da('0xb')]=_[_0xe2da('0xc')](config[_0xe2da('0xb')],{'host':_0xe2da('0xd'),'port':0x18eb});var socket=require(_0xe2da('0xe'))(new Redis(config[_0xe2da('0xb')]));require(_0xe2da('0xf'))[_0xe2da('0x10')](socket);function respondWithRpcPromise(_0x5a2fc5,_0x52e650,_0x3baaa8){return new BPromise(function(_0x104fb3,_0x17086c){return client[_0xe2da('0x11')](_0x5a2fc5,_0x3baaa8)[_0xe2da('0x12')](function(_0x1a29b9){logger[_0xe2da('0x13')]('FaxMessage,\x20%s,\x20%s',_0x52e650,_0xe2da('0x14'));logger['debug'](_0xe2da('0x15'),_0x52e650,_0xe2da('0x14'),JSON[_0xe2da('0x16')](_0x1a29b9));if(_0x1a29b9[_0xe2da('0x17')]){if(_0x1a29b9[_0xe2da('0x17')][_0xe2da('0x18')]===0x1f4){logger[_0xe2da('0x17')]('FaxMessage,\x20%s,\x20%s',_0x52e650,_0x1a29b9[_0xe2da('0x17')]['message']);return _0x17086c(_0x1a29b9['error'][_0xe2da('0x19')]);}logger[_0xe2da('0x17')](_0xe2da('0x1a'),_0x52e650,_0x1a29b9['error'][_0xe2da('0x19')]);return _0x104fb3(_0x1a29b9[_0xe2da('0x17')][_0xe2da('0x19')]);}else{logger[_0xe2da('0x13')]('FaxMessage,\x20%s,\x20%s',_0x52e650,_0xe2da('0x14'));_0x104fb3(_0x1a29b9[_0xe2da('0x1b')][_0xe2da('0x19')]);}})[_0xe2da('0x1c')](function(_0x329ffe){logger['error'](_0xe2da('0x1a'),_0x52e650,_0x329ffe);_0x17086c(_0x329ffe);});});}exports[_0xe2da('0x1d')]=function(_0x538d96){var _0x1a9324=this;return new Promise(function(_0x254b37,_0x332193){return db[_0xe2da('0x1e')][_0xe2da('0x1f')](_0x538d96[_0xe2da('0x20')],{'raw':_0x538d96['options']?_0x538d96[_0xe2da('0x21')]['raw']===undefined?!![]:![]:!![]})[_0xe2da('0x12')](function(_0x191d38){logger[_0xe2da('0x13')](_0xe2da('0x1d'),_0x538d96);logger[_0xe2da('0x22')](_0xe2da('0x1d'),_0x538d96,JSON[_0xe2da('0x16')](_0x191d38));_0x254b37(_0x191d38);})[_0xe2da('0x1c')](function(_0x5a08d6){logger[_0xe2da('0x17')](_0xe2da('0x1d'),_0x5a08d6[_0xe2da('0x19')],_0x538d96);_0x332193(_0x1a9324[_0xe2da('0x17')](0x1f4,_0x5a08d6[_0xe2da('0x19')]));});});};exports[_0xe2da('0x23')]=function(_0x124d93){var _0x56c37e=this;return new Promise(function(_0x2adc49,_0x3e23d7){return db[_0xe2da('0x1e')][_0xe2da('0x24')](_0x124d93[_0xe2da('0x20')],{'raw':_0x124d93[_0xe2da('0x21')]?_0x124d93[_0xe2da('0x21')][_0xe2da('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x124d93['options']?_0x124d93['options']['where']||null:null,'attributes':_0x124d93[_0xe2da('0x21')]?_0x124d93[_0xe2da('0x21')][_0xe2da('0x26')]||null:null,'limit':_0x124d93[_0xe2da('0x21')]?_0x124d93['options']['limit']||null:null})[_0xe2da('0x12')](function(_0x1ec8ca){logger[_0xe2da('0x13')](_0xe2da('0x23'),_0x124d93);logger[_0xe2da('0x22')](_0xe2da('0x23'),_0x124d93,JSON[_0xe2da('0x16')](_0x1ec8ca));_0x2adc49(_0x1ec8ca);})[_0xe2da('0x1c')](function(_0x461610){logger['error']('UpdateFaxMessage',_0x461610[_0xe2da('0x19')],_0x124d93);_0x3e23d7(_0x56c37e[_0xe2da('0x17')](0x1f4,_0x461610[_0xe2da('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 4f6c73d..9a81c67 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 _0x5be5=['emit','length','faxMessage:','save','remove','update'];(function(_0x4ded50,_0x4a6af3){var _0xa92135=function(_0xe09b41){while(--_0xe09b41){_0x4ded50['push'](_0x4ded50['shift']());}};_0xa92135(++_0x4a6af3);}(_0x5be5,0x1b9));var _0x55be=function(_0x59481b,_0x4c7624){_0x59481b=_0x59481b-0x0;var _0x55e559=_0x5be5[_0x59481b];return _0x55e559;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x55be('0x0'),_0x55be('0x1'),_0x55be('0x2')];function createListener(_0x1854e2,_0x3f298b){return function(_0x281067){_0x3f298b[_0x55be('0x3')](_0x1854e2,_0x281067);};}function removeListener(_0x3c22af,_0x35fe6e){return function(){FaxMessageEvents['removeListener'](_0x3c22af,_0x35fe6e);};}exports['register']=function(_0x4e6a46){for(var _0x9800ca=0x0,_0x242392=events[_0x55be('0x4')];_0x9800ca<_0x242392;_0x9800ca++){var _0x2606b9=events[_0x9800ca];var _0xfe7f3c=createListener(_0x55be('0x5')+_0x2606b9,_0x4e6a46);FaxMessageEvents['on'](_0x2606b9,_0xfe7f3c);}}; \ No newline at end of file +var _0x96bd=['./faxMessage.events','remove','update','emit','register','length'];(function(_0x34ff54,_0x37fb35){var _0x852b19=function(_0x2df4a6){while(--_0x2df4a6){_0x34ff54['push'](_0x34ff54['shift']());}};_0x852b19(++_0x37fb35);}(_0x96bd,0xa8));var _0xd96b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x96bd[_0x57b54c];return _0x59cc19;};'use strict';var FaxMessageEvents=require(_0xd96b('0x0'));var events=['save',_0xd96b('0x1'),_0xd96b('0x2')];function createListener(_0x577871,_0x3e32e1){return function(_0xda031){_0x3e32e1[_0xd96b('0x3')](_0x577871,_0xda031);};}function removeListener(_0x315c3c,_0x22de5c){return function(){FaxMessageEvents['removeListener'](_0x315c3c,_0x22de5c);};}exports[_0xd96b('0x4')]=function(_0x7672f2){for(var _0x219786=0x0,_0x12da3d=events[_0xd96b('0x5')];_0x219786<_0x12da3d;_0x219786++){var _0x2754d2=events[_0x219786];var _0x569cf8=createListener('faxMessage:'+_0x2754d2,_0x7672f2);FaxMessageEvents['on'](_0x2754d2,_0x569cf8);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 040949f..45df4e1 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 _0xd404=['/:id','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe'];(function(_0xfc5c31,_0xda2333){var _0x4b7909=function(_0xc6c452){while(--_0xc6c452){_0xfc5c31['push'](_0xfc5c31['shift']());}};_0x4b7909(++_0xda2333);}(_0xd404,0x15b));var _0x4d40=function(_0x1105cd,_0x7c9763){_0x1105cd=_0x1105cd-0x0;var _0x16e868=_0xd404[_0x1105cd];return _0x16e868;};'use strict';var multer=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var path=require('path');var timeout=require(_0x4d40('0x2'));var express=require(_0x4d40('0x3'));var router=express['Router']();var fs_extra=require(_0x4d40('0x4'));var auth=require(_0x4d40('0x5'));var interaction=require(_0x4d40('0x6'));var config=require(_0x4d40('0x7'));var controller=require(_0x4d40('0x8'));router[_0x4d40('0x9')]('/',auth[_0x4d40('0xa')](),controller[_0x4d40('0xb')]);router[_0x4d40('0x9')]('/describe',auth[_0x4d40('0xa')](),controller[_0x4d40('0xc')]);router['get'](_0x4d40('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4d40('0x9')](_0x4d40('0xe'),auth[_0x4d40('0xa')](),controller[_0x4d40('0xf')]);router[_0x4d40('0x10')]('/',auth[_0x4d40('0xa')](),interaction[_0x4d40('0x11')](_0x4d40('0x12'),_0x4d40('0x13')),controller[_0x4d40('0x14')]);router[_0x4d40('0x15')](_0x4d40('0xd'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x16')]);router['put'](_0x4d40('0x17'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x18')]);router[_0x4d40('0x15')](_0x4d40('0x19'),auth['isAuthenticated'](),controller[_0x4d40('0x1a')]);router[_0x4d40('0x1b')](_0x4d40('0xd'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x1c')]);module[_0x4d40('0x1d')]=router; \ No newline at end of file +var _0xc788=['describe','/:id','show','post','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc788,0xc4));var _0x8c78=function(_0x34b1b8,_0x54c9bf){_0x34b1b8=_0x34b1b8-0x0;var _0x542dd8=_0xc788[_0x34b1b8];return _0x542dd8;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var fs_extra=require(_0x8c78('0x4'));var auth=require(_0x8c78('0x5'));var interaction=require(_0x8c78('0x6'));var config=require(_0x8c78('0x7'));var controller=require('./faxMessage.controller');router[_0x8c78('0x8')]('/',auth[_0x8c78('0x9')](),controller[_0x8c78('0xa')]);router[_0x8c78('0x8')](_0x8c78('0xb'),auth['isAuthenticated'](),controller[_0x8c78('0xc')]);router[_0x8c78('0x8')](_0x8c78('0xd'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xe')]);router[_0x8c78('0x8')]('/:id/download',auth[_0x8c78('0x9')](),controller['download']);router[_0x8c78('0xf')]('/',auth[_0x8c78('0x9')](),interaction['tracked'](_0x8c78('0x10'),_0x8c78('0x11')),controller['create']);router[_0x8c78('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8c78('0x13')]);router[_0x8c78('0x12')](_0x8c78('0x14'),auth[_0x8c78('0x9')](),controller[_0x8c78('0x15')]);router[_0x8c78('0x12')](_0x8c78('0x16'),auth[_0x8c78('0x9')](),controller[_0x8c78('0x17')]);router[_0x8c78('0x18')]('/:id',auth[_0x8c78('0x9')](),controller[_0x8c78('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index b64c835..94acbd1 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 _0xa7a8=['beepall','roundrobin','sequelize','STRING','INTEGER','ENUM','rrmemory'];(function(_0x46102b,_0x2cfef4){var _0x3532fb=function(_0x3e9d0d){while(--_0x3e9d0d){_0x46102b['push'](_0x46102b['shift']());}};_0x3532fb(++_0x2cfef4);}(_0xa7a8,0x183));var _0x8a7a=function(_0x587d3d,_0x187db7){_0x587d3d=_0x587d3d-0x0;var _0x263d5b=_0xa7a8[_0x587d3d];return _0x263d5b;};'use strict';var Sequelize=require(_0x8a7a('0x0'));module['exports']={'name':{'type':Sequelize[_0x8a7a('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8a7a('0x1')]},'timeout':{'type':Sequelize[_0x8a7a('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8a7a('0x3')](_0x8a7a('0x4'),_0x8a7a('0x5'),_0x8a7a('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb153=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x11e83e,_0x1d0d57){var _0x1dcd6b=function(_0x3f1b86){while(--_0x3f1b86){_0x11e83e['push'](_0x11e83e['shift']());}};_0x1dcd6b(++_0x1d0d57);}(_0xb153,0x136));var _0x3b15=function(_0x30ef60,_0x56dce2){_0x30ef60=_0x30ef60-0x0;var _0x4ee730=_0xb153[_0x30ef60];return _0x4ee730;};'use strict';var Sequelize=require(_0x3b15('0x0'));module['exports']={'name':{'type':Sequelize[_0x3b15('0x1')],'unique':_0x3b15('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3b15('0x1')]},'timeout':{'type':Sequelize[_0x3b15('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3b15('0x4')](_0x3b15('0x5'),_0x3b15('0x6'),_0x3b15('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'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 cc3c4e5..56132d5 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 _0xe2bc=['Team','pick','addTeams','ids','online','interface','Agents','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','where','FaxQueue','include','findAll','rows','catch','show','params','keys','query','filters','intersection','model','attributes','fields','length','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','describe','UserFaxQueue','hasOwnProperty','nolimit','order','sort','FaxQueueId','filter','merge','User','findAndCountAll','UserId','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne'];(function(_0x5084fc,_0x326bee){var _0x536106=function(_0x43a5ec){while(--_0x43a5ec){_0x5084fc['push'](_0x5084fc['shift']());}};_0x536106(++_0x326bee);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xe2bc[_0x2dadb9];return _0x2f0097;};'use strict';var BPromise=require(_0xce2b('0x0'));var util=require('util');var _=require(_0xce2b('0x1'));var squel=require('squel');var Redis=require(_0xce2b('0x2'));var qs=require(_0xce2b('0x3'));var logger=require(_0xce2b('0x4'))(_0xce2b('0x5'));var config=require(_0xce2b('0x6'));var db=require('../../mysqldb')['db'];config[_0xce2b('0x7')]=_[_0xce2b('0x8')](config[_0xce2b('0x7')],{'host':_0xce2b('0x9'),'port':0x18eb});var socket=require(_0xce2b('0xa'))(new Redis(config['redis']));require(_0xce2b('0xb'))[_0xce2b('0xc')](socket);function respondWithStatusCode(_0x53c0de,_0x97112a){_0x97112a=_0x97112a||0xcc;return function(_0x7dee3c){if(_0x7dee3c){return _0x53c0de[_0xce2b('0xd')](_0x97112a);}return _0x53c0de[_0xce2b('0xe')](_0x97112a)[_0xce2b('0xf')]();};}function respondWithResult(_0xc6cdb,_0x3eae6d){_0x3eae6d=_0x3eae6d||0xc8;return function(_0xa7941){if(_0xa7941){return _0xc6cdb[_0xce2b('0xe')](_0x3eae6d)[_0xce2b('0x10')](_0xa7941);}};}function respondWithFilteredResult(_0x47a597,_0x46f2a1){return function(_0x5dca7e){if(_0x5dca7e){var _0xf7ae89=typeof _0x46f2a1[_0xce2b('0x11')]===_0xce2b('0x12')&&typeof _0x46f2a1[_0xce2b('0x13')]===_0xce2b('0x12');var _0x422c23=_0x5dca7e[_0xce2b('0x14')];var _0x368499=_0xf7ae89?0x0:_0x46f2a1['offset'];var _0x308391=_0xf7ae89?_0x5dca7e[_0xce2b('0x14')]:_0x46f2a1['offset']+_0x46f2a1['limit'];var _0x48f890;if(_0x308391>=_0x422c23){_0x308391=_0x422c23;_0x48f890=0xc8;}else{_0x48f890=0xce;}_0x47a597[_0xce2b('0xe')](_0x48f890);return _0x47a597[_0xce2b('0x15')](_0xce2b('0x16'),_0x368499+'-'+_0x308391+'/'+_0x422c23)['json'](_0x5dca7e);}return null;};}function saveUpdates(_0x5558c9){return function(_0x216c48){if(_0x216c48){return _0x216c48[_0xce2b('0x17')](_0x5558c9)[_0xce2b('0x18')](function(_0x41b4bf){return _0x41b4bf;});}return null;};}function removeEntity(_0x377aa3){return function(_0x32fd68){if(_0x32fd68){return _0x32fd68[_0xce2b('0x19')]()[_0xce2b('0x18')](function(){var _0x3716f9=_0x32fd68[_0xce2b('0x1a')]({'plain':!![]});var _0x4e92fd=_0xce2b('0x1b');return db[_0xce2b('0x1c')][_0xce2b('0x19')]({'where':{'type':_0x4e92fd,'resourceId':_0x3716f9['id']}})[_0xce2b('0x18')](function(){return _0x32fd68;});})[_0xce2b('0x18')](function(){_0x377aa3[_0xce2b('0xe')](0xcc)[_0xce2b('0xf')]();});}};}function handleEntityNotFound(_0x26f878){return function(_0x4268df){if(!_0x4268df){_0x26f878[_0xce2b('0xd')](0x194);}return _0x4268df;};}function handleError(_0x481ac9,_0x29ef4a){_0x29ef4a=_0x29ef4a||0x1f4;return function(_0x3e80b7){logger[_0xce2b('0x1d')](_0x3e80b7[_0xce2b('0x1e')]);if(_0x3e80b7[_0xce2b('0x1f')]){delete _0x3e80b7[_0xce2b('0x1f')];}_0x481ac9[_0xce2b('0xe')](_0x29ef4a)[_0xce2b('0x20')](_0x3e80b7);};}exports[_0xce2b('0x21')]=function(_0x19d178,_0x14ca70){var _0x56047c={};var _0x49a52c={'count':0x0,'rows':[]};var _0x527b03=_[_0xce2b('0x22')](db['FaxQueue'][_0xce2b('0x23')],function(_0x294af8){return{'name':_0x294af8['fieldName'],'type':_0x294af8[_0xce2b('0x24')][_0xce2b('0x25')]};});_0x56047c=qs['getOptions'](_0x527b03,_0x19d178);var _0x7bebe5={'where':_0x56047c[_0xce2b('0x26')]};return db[_0xce2b('0x27')]['count'](_0x7bebe5)['then'](function(_0x433a89){_0x49a52c[_0xce2b('0x14')]=_0x433a89;_0x56047c[_0xce2b('0x28')]=qs['include'](_0x19d178['query']);return db[_0xce2b('0x27')][_0xce2b('0x29')](_0x56047c);})[_0xce2b('0x18')](function(_0x4f9615){_0x49a52c[_0xce2b('0x2a')]=_0x4f9615;return _0x49a52c;})[_0xce2b('0x18')](respondWithFilteredResult(_0x14ca70,_0x56047c))[_0xce2b('0x2b')](handleError(_0x14ca70,null));};exports[_0xce2b('0x2c')]=function(_0x43771a,_0x476d1a){var _0x45c9ca={'raw':!![],'where':{'id':_0x43771a[_0xce2b('0x2d')]['id']}},_0x5ae887={};_0x5ae887['model']=_[_0xce2b('0x2e')](db[_0xce2b('0x27')][_0xce2b('0x23')]);_0x5ae887[_0xce2b('0x2f')]=_[_0xce2b('0x2e')](_0x43771a['query']);_0x5ae887[_0xce2b('0x30')]=_[_0xce2b('0x31')](_0x5ae887[_0xce2b('0x32')],_0x5ae887[_0xce2b('0x2f')]);_0x45c9ca[_0xce2b('0x33')]=_[_0xce2b('0x31')](_0x5ae887[_0xce2b('0x32')],qs[_0xce2b('0x34')](_0x43771a[_0xce2b('0x2f')][_0xce2b('0x34')]));_0x45c9ca[_0xce2b('0x33')]=_0x45c9ca[_0xce2b('0x33')][_0xce2b('0x35')]?_0x45c9ca[_0xce2b('0x33')]:_0x5ae887[_0xce2b('0x32')];if(_0x43771a[_0xce2b('0x2f')]['includeAll']){_0x45c9ca[_0xce2b('0x28')]=[{'all':!![]}];}_0x45c9ca=_['merge']({},_0x45c9ca,_0x43771a[_0xce2b('0x36')]);return db[_0xce2b('0x27')][_0xce2b('0x37')](_0x45c9ca)[_0xce2b('0x18')](handleEntityNotFound(_0x476d1a,null))[_0xce2b('0x18')](respondWithResult(_0x476d1a,null))[_0xce2b('0x2b')](handleError(_0x476d1a,null));};exports['create']=function(_0x12f1e1,_0xef673b){return db[_0xce2b('0x27')][_0xce2b('0x38')](_0x12f1e1[_0xce2b('0x39')],{})[_0xce2b('0x18')](function(_0x585de8){var _0xa6d26e=_0x12f1e1[_0xce2b('0x3a')][_0xce2b('0x1a')]({'plain':!![]});if(!_0xa6d26e)throw new Error(_0xce2b('0x3b'));if(_0xa6d26e[_0xce2b('0x3c')]===_0xce2b('0x3a')){var _0x5a3593=_0x585de8['get']({'plain':!![]});var _0x354277=_0xce2b('0x1b');return db[_0xce2b('0x3d')][_0xce2b('0x37')]({'where':{'name':_0x354277,'userProfileId':_0xa6d26e[_0xce2b('0x3e')]},'raw':!![]})[_0xce2b('0x18')](function(_0x3fcf5e){if(_0x3fcf5e&&_0x3fcf5e[_0xce2b('0x3f')]===0x0){return db[_0xce2b('0x1c')][_0xce2b('0x38')]({'name':_0x5a3593[_0xce2b('0x1f')],'resourceId':_0x5a3593['id'],'type':_0x3fcf5e[_0xce2b('0x1f')],'sectionId':_0x3fcf5e['id']},{})[_0xce2b('0x18')](function(){return _0x585de8;});}else{return _0x585de8;}})[_0xce2b('0x2b')](function(_0x4ee759){logger['error'](_0xce2b('0x40'),_0x4ee759);throw _0x4ee759;});}return _0x585de8;})[_0xce2b('0x18')](respondWithResult(_0xef673b,0xc9))['catch'](handleError(_0xef673b,null));};exports[_0xce2b('0x17')]=function(_0x4cba66,_0x2aad8a){if(_0x4cba66[_0xce2b('0x39')]['id']){delete _0x4cba66[_0xce2b('0x39')]['id'];}return db['FaxQueue'][_0xce2b('0x37')]({'where':{'id':_0x4cba66[_0xce2b('0x2d')]['id']}})['then'](handleEntityNotFound(_0x2aad8a,null))['then'](saveUpdates(_0x4cba66[_0xce2b('0x39')],null))[_0xce2b('0x18')](respondWithResult(_0x2aad8a,null))[_0xce2b('0x2b')](handleError(_0x2aad8a,null));};exports[_0xce2b('0x19')]=function(_0x1218d3,_0x4c7177){return db[_0xce2b('0x27')][_0xce2b('0x37')]({'where':{'id':_0x1218d3[_0xce2b('0x2d')]['id']}})[_0xce2b('0x18')](handleEntityNotFound(_0x4c7177,null))[_0xce2b('0x18')](removeEntity(_0x4c7177,null))['catch'](handleError(_0x4c7177,null));};exports[_0xce2b('0x41')]=function(_0x3207c5,_0xc7a9b4){return db[_0xce2b('0x27')][_0xce2b('0x41')]()[_0xce2b('0x18')](respondWithResult(_0xc7a9b4,null))[_0xce2b('0x2b')](handleError(_0xc7a9b4,null));};exports['getMembers']=function(_0x52909f,_0x565396){var _0x346fd5={'raw':!![],'where':{}},_0xfc823d={},_0x841c2e;return db['FaxQueue']['findOne']({'where':{'id':_0x52909f['params']['id']}})[_0xce2b('0x18')](handleEntityNotFound(_0x565396,null))[_0xce2b('0x18')](function(_0x15d45e){if(_0x15d45e){_0x841c2e=_0x15d45e['get']({'plain':!![]});_0xfc823d[_0xce2b('0x32')]=_[_0xce2b('0x2e')](db[_0xce2b('0x42')]['rawAttributes']);_0xfc823d[_0xce2b('0x2f')]=_['keys'](_0x52909f[_0xce2b('0x2f')]);_0xfc823d[_0xce2b('0x30')]=_[_0xce2b('0x31')](_0xfc823d['model'],_0xfc823d[_0xce2b('0x2f')]);_0x346fd5[_0xce2b('0x33')]=_[_0xce2b('0x31')](_0xfc823d[_0xce2b('0x32')],qs['fields'](_0x52909f[_0xce2b('0x2f')][_0xce2b('0x34')]));_0x346fd5[_0xce2b('0x33')]=_0x346fd5[_0xce2b('0x33')][_0xce2b('0x35')]?_0x346fd5['attributes']:_0xfc823d[_0xce2b('0x32')];if(!_0x52909f[_0xce2b('0x2f')][_0xce2b('0x43')](_0xce2b('0x44'))){_0x346fd5[_0xce2b('0x13')]=qs['limit'](_0x52909f[_0xce2b('0x2f')]['limit']);_0x346fd5[_0xce2b('0x11')]=qs[_0xce2b('0x11')](_0x52909f['query']['offset']);}_0x346fd5[_0xce2b('0x45')]=qs[_0xce2b('0x46')](_0x52909f[_0xce2b('0x2f')]['sort']);_0x346fd5[_0xce2b('0x26')]=qs[_0xce2b('0x30')](_['pick'](_0x52909f[_0xce2b('0x2f')],_0xfc823d[_0xce2b('0x30')]));_0x346fd5[_0xce2b('0x26')][_0xce2b('0x47')]=_0x15d45e['id'];if(_0x52909f[_0xce2b('0x2f')][_0xce2b('0x48')]){_0x346fd5['where']=_[_0xce2b('0x49')](_0x346fd5['where'],{'$or':_[_0xce2b('0x22')](_0x346fd5[_0xce2b('0x33')],function(_0x2ce9f5){var _0x105d3f={};_0x105d3f[_0x2ce9f5]={'$like':'%'+_0x52909f['query'][_0xce2b('0x48')]+'%'};return _0x105d3f;})});}_0x346fd5=_[_0xce2b('0x49')]({},_0x346fd5,_0x52909f[_0xce2b('0x36')]);return db[_0xce2b('0x42')]['findAll'](_0x346fd5);}})[_0xce2b('0x18')](function(_0x23b39e){if(_0x23b39e){return db[_0xce2b('0x4a')][_0xce2b('0x4b')]({'where':{'id':_[_0xce2b('0x22')](_0x23b39e,_0xce2b('0x4c')),'role':_0xce2b('0x4d')},'attributes':['id','name',_0xce2b('0x4e'),'updatedAt',_0xce2b('0x4f')]});}})[_0xce2b('0x18')](function(_0x2ae9ae){if(_0x2ae9ae){return{'count':_0x2ae9ae[_0xce2b('0x14')],'rows':_[_0xce2b('0x22')](_0x2ae9ae[_0xce2b('0x2a')],function(_0x3c62b4){return{'membername':_0x3c62b4[_0xce2b('0x1f')],'UserId':_0x3c62b4['id'],'queue_name':_0x841c2e['name'],'FaxQueueId':_0x841c2e['id'],'interface':util[_0xce2b('0x50')](_0xce2b('0x51'),_0xce2b('0x52'),_0x3c62b4[_0xce2b('0x1f')]),'penalty':0x0,'paused':_0x3c62b4[_0xce2b('0x4e')],'createdAt':_0x3c62b4['createdAt'],'updatedAt':_0x3c62b4[_0xce2b('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xce2b('0x18')](respondWithFilteredResult(_0x565396,_0x346fd5))['catch'](handleError(_0x565396,null));};exports[_0xce2b('0x54')]=function(_0x287072,_0xd0ed7a){var _0x275b98={};var _0x23f0f0={};var _0x893f84;var _0x43213e;return db[_0xce2b('0x27')][_0xce2b('0x55')]({'where':{'id':_0x287072[_0xce2b('0x2d')]['id']}})[_0xce2b('0x18')](handleEntityNotFound(_0xd0ed7a,null))[_0xce2b('0x18')](function(_0x6d8ce0){if(_0x6d8ce0){_0x893f84=_0x6d8ce0;_0x23f0f0[_0xce2b('0x32')]=_['keys'](db[_0xce2b('0x56')][_0xce2b('0x23')]);_0x23f0f0[_0xce2b('0x2f')]=_['keys'](_0x287072[_0xce2b('0x2f')]);_0x23f0f0[_0xce2b('0x30')]=_['intersection'](_0x23f0f0[_0xce2b('0x32')],_0x23f0f0[_0xce2b('0x2f')]);_0x275b98['attributes']=_[_0xce2b('0x31')](_0x23f0f0[_0xce2b('0x32')],qs[_0xce2b('0x34')](_0x287072[_0xce2b('0x2f')][_0xce2b('0x34')]));_0x275b98[_0xce2b('0x33')]=_0x275b98[_0xce2b('0x33')]['length']?_0x275b98[_0xce2b('0x33')]:_0x23f0f0[_0xce2b('0x32')];_0x275b98['order']=qs[_0xce2b('0x46')](_0x287072[_0xce2b('0x2f')][_0xce2b('0x46')]);_0x275b98[_0xce2b('0x26')]=qs['filters'](_[_0xce2b('0x57')](_0x287072[_0xce2b('0x2f')],_0x23f0f0['filters']));if(_0x287072['query']['filter']){_0x275b98['where']=_[_0xce2b('0x49')](_0x275b98[_0xce2b('0x26')],{'$or':_['map'](_0x275b98['attributes'],function(_0x14b437){var _0x1b1f79={};_0x1b1f79[_0x14b437]={'$like':'%'+_0x287072[_0xce2b('0x2f')]['filter']+'%'};return _0x1b1f79;})});}_0x275b98=_[_0xce2b('0x49')]({},_0x275b98,_0x287072[_0xce2b('0x36')]);return _0x893f84['getTeams'](_0x275b98);}})[_0xce2b('0x18')](function(_0xeca50f){if(_0xeca50f){_0x43213e=_0xeca50f[_0xce2b('0x35')];if(!_0x287072[_0xce2b('0x2f')]['hasOwnProperty'](_0xce2b('0x44'))){_0x275b98[_0xce2b('0x13')]=qs['limit'](_0x287072[_0xce2b('0x2f')]['limit']);_0x275b98['offset']=qs[_0xce2b('0x11')](_0x287072[_0xce2b('0x2f')][_0xce2b('0x11')]);}return _0x893f84[_0xce2b('0x54')](_0x275b98);}})['then'](function(_0x5a57c3){if(_0x5a57c3){return _0x5a57c3?{'count':_0x43213e,'rows':_0x5a57c3}:null;}})[_0xce2b('0x18')](respondWithResult(_0xd0ed7a,null))[_0xce2b('0x2b')](handleError(_0xd0ed7a,null));};exports[_0xce2b('0x58')]=function(_0x28338c,_0x6c0669){var _0x293339=_0x28338c['body'][_0xce2b('0x59')];return db[_0xce2b('0x56')][_0xce2b('0x29')]({'where':{'id':_0x293339},'attributes':['id'],'include':[{'model':db[_0xce2b('0x4a')],'as':'Agents','attributes':['id','name',_0xce2b('0x5a'),'voicePause',_0xce2b('0x5b')],'raw':!![]}]})[_0xce2b('0x18')](function(_0x13bc87){if(_0x13bc87){var _0x559aba=_['flatMap'](_0x13bc87,function(_0x1de23b){var _0x44139b=_0x1de23b[_0xce2b('0x1a')]({'plain':!![]});return _0x44139b[_0xce2b('0x5c')];});return db[_0xce2b('0x27')]['find']({'where':{'id':_0x28338c[_0xce2b('0x2d')]['id']}})[_0xce2b('0x18')](function(_0x2014c5){return db[_0xce2b('0x5d')][_0xce2b('0x5e')](function(_0x7ef707){return _0x2014c5['addTeams'](_0x293339,{'transaction':_0x7ef707})[_0xce2b('0x18')](function(){return BPromise['each'](_0x559aba,function(_0x581897){return db[_0xce2b('0x42')][_0xce2b('0x5f')]({'where':{'UserId':_0x581897['id'],'FaxQueueId':_0x28338c[_0xce2b('0x2d')]['id']},'transaction':_0x7ef707});});})['then'](function(){_0x559aba[_0xce2b('0x60')](function(_0x5f02f8){socket[_0xce2b('0x61')]('userFaxQueue:save',{'UserId':_0x5f02f8['id'],'FaxQueueId':_0x2014c5['id']});});});});});}})['then'](respondWithStatusCode(_0x6c0669,null))['catch'](handleError(_0x6c0669,null));};exports[_0xce2b('0x62')]=function(_0x36986d,_0x49c650){return db['Team']['findAll']({'where':{'id':_0x36986d['query'][_0xce2b('0x59')]},'attributes':['id'],'include':[{'model':db[_0xce2b('0x4a')],'as':_0xce2b('0x5c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x49c650,null))[_0xce2b('0x18')](function(_0x5ea866){var _0x2c887d=_[_0xce2b('0x22')](_0x5ea866,'id');var _0x433d31=[];var _0x4d902f=[];var _0x3b1ad=squel[_0xce2b('0x63')]();_0x3b1ad[_0xce2b('0x64')](_0xce2b('0x65'))[_0xce2b('0x66')](_0xce2b('0x67'),'tq')[_0xce2b('0x68')](_0xce2b('0x69'),'ut',_0xce2b('0x6a'))[_0xce2b('0x26')](_0xce2b('0x6b'),_0x36986d[_0xce2b('0x2d')]['id']);for(var _0x436cf7=0x0;_0x436cf7<_0x5ea866[_0xce2b('0x35')];_0x436cf7+=0x1){let _0x5a6470=_0x5ea866[_0x436cf7];for(var _0x54de5f=0x0;_0x54de5f<_0x5a6470[_0xce2b('0x5c')][_0xce2b('0x35')];_0x54de5f+=0x1){let _0x4fabe8=_0x5a6470[_0xce2b('0x5c')][_0x54de5f];var _0x568862=_0x3b1ad[_0xce2b('0x6c')]();_0x568862[_0xce2b('0x26')]('ut.UserId\x20=\x20?',_0x4fabe8['id']);_0x4d902f[_0xce2b('0x6d')](db['sequelize'][_0xce2b('0x2f')](_0x568862[_0xce2b('0x6e')](),{'type':db[_0xce2b('0x5d')]['QueryTypes'][_0xce2b('0x6f')]})[_0xce2b('0x18')](function(_0x2d087e){if(_0x2d087e['length']===0x1){return _0x4fabe8['id'];}else{var _0xbc41b8=_[_0xce2b('0x70')](_[_0xce2b('0x22')](_0x2d087e,_0xce2b('0x71')),function(_0x2d32af){return _[_0xce2b('0x72')](_0x2c887d,_0x2d32af);});if(_0xbc41b8){return _0x4fabe8['id'];}}}));}}return BPromise[_0xce2b('0x73')](_0x4d902f)[_0xce2b('0x18')](function(_0x557c84){_0x433d31=_(_0x433d31)[_0xce2b('0x74')](_0x557c84)[_0xce2b('0x75')]()[_0xce2b('0x76')]();return db[_0xce2b('0x27')][_0xce2b('0x37')]({'where':{'id':_0x36986d[_0xce2b('0x2d')]['id']}})['then'](function(_0xc36ed8){return db[_0xce2b('0x5d')][_0xce2b('0x5e')](function(_0x52f9c1){return _0xc36ed8[_0xce2b('0x62')](_0x36986d[_0xce2b('0x2f')]['ids'],{'transaction':_0x52f9c1})[_0xce2b('0x18')](function(){if(!_['isEmpty'](_0x433d31)){return _0xc36ed8[_0xce2b('0x77')](_0x433d31,{'transaction':_0x52f9c1});}})[_0xce2b('0x18')](function(){_0x433d31[_0xce2b('0x60')](function(_0x3fc6d3){socket[_0xce2b('0x61')](_0xce2b('0x78'),{'UserId':_0x3fc6d3,'FaxQueueId':_0xc36ed8['id']});});});});});});})[_0xce2b('0x18')](respondWithStatusCode(_0x49c650,null))[_0xce2b('0x2b')](handleError(_0x49c650,null));};exports[_0xce2b('0x79')]=function(_0x1678df,_0x4c2ffd){return db[_0xce2b('0x27')][_0xce2b('0x37')]({'where':{'id':_0x1678df[_0xce2b('0x2d')]['id']}})[_0xce2b('0x18')](handleEntityNotFound(_0x4c2ffd,null))['then'](function(_0x6a2546){if(_0x6a2546){return _0x6a2546[_0xce2b('0x79')](_0x1678df[_0xce2b('0x39')]['ids'],_[_0xce2b('0x7a')](_0x1678df[_0xce2b('0x39')],['ids','id'])||{})[_0xce2b('0x7b')](function(_0x2a3fa){for(var _0x3ed2c6=0x0;_0x3ed2c6<_0x1678df['body'][_0xce2b('0x59')]['length'];_0x3ed2c6+=0x1){socket[_0xce2b('0x61')](_0xce2b('0x7c'),{'UserId':Number(_0x1678df[_0xce2b('0x39')][_0xce2b('0x59')][_0x3ed2c6]),'FaxQueueId':Number(_0x1678df[_0xce2b('0x2d')]['id'])});}return _0x2a3fa;});}})[_0xce2b('0x18')](respondWithResult(_0x4c2ffd,null))[_0xce2b('0x2b')](handleError(_0x4c2ffd,null));};exports[_0xce2b('0x77')]=function(_0x2d27f6,_0x13fdec){return db['FaxQueue']['find']({'where':{'id':_0x2d27f6['params']['id']}})['then'](handleEntityNotFound(_0x13fdec,null))[_0xce2b('0x18')](function(_0x15d7a1){if(_0x15d7a1){return _0x15d7a1[_0xce2b('0x77')](_0x2d27f6['query'][_0xce2b('0x59')])[_0xce2b('0x18')](function(){if(_[_0xce2b('0x7d')](_0x2d27f6[_0xce2b('0x2f')][_0xce2b('0x59')])){for(var _0x330d7a=0x0;_0x330d7a<_0x2d27f6[_0xce2b('0x2f')][_0xce2b('0x59')][_0xce2b('0x35')];_0x330d7a+=0x1){socket['emit'](_0xce2b('0x78'),{'UserId':Number(_0x2d27f6[_0xce2b('0x2f')][_0xce2b('0x59')][_0x330d7a]),'FaxQueueId':Number(_0x2d27f6[_0xce2b('0x2d')]['id'])});}}else{socket[_0xce2b('0x61')](_0xce2b('0x78'),{'UserId':Number(_0x2d27f6[_0xce2b('0x2f')][_0xce2b('0x59')]),'FaxQueueId':Number(_0x2d27f6[_0xce2b('0x2d')]['id'])});}});}})[_0xce2b('0x18')](respondWithStatusCode(_0x13fdec,null))[_0xce2b('0x2b')](handleError(_0x13fdec,null));};exports[_0xce2b('0x7e')]=function(_0x473c8f,_0x36ec17){var _0x11b765={};var _0x5b2948={};var _0x6f09c9;var _0x56d87b;return db['FaxQueue'][_0xce2b('0x55')]({'where':{'id':_0x473c8f[_0xce2b('0x2d')]['id']}})[_0xce2b('0x18')](handleEntityNotFound(_0x36ec17,null))[_0xce2b('0x18')](function(_0x15819a){if(_0x15819a){_0x6f09c9=_0x15819a;_0x5b2948['model']=_[_0xce2b('0x2e')](db['User'][_0xce2b('0x23')]);_0x5b2948['query']=_['keys'](_0x473c8f['query']);_0x5b2948[_0xce2b('0x30')]=_[_0xce2b('0x31')](_0x5b2948['model'],_0x5b2948[_0xce2b('0x2f')]);_0x11b765['attributes']=_[_0xce2b('0x31')](_0x5b2948['model'],qs[_0xce2b('0x34')](_0x473c8f[_0xce2b('0x2f')]['fields']));_0x11b765[_0xce2b('0x33')]=_0x11b765[_0xce2b('0x33')][_0xce2b('0x35')]?_0x11b765[_0xce2b('0x33')]:_0x5b2948[_0xce2b('0x32')];_0x11b765[_0xce2b('0x45')]=qs['sort'](_0x473c8f['query'][_0xce2b('0x46')]);_0x11b765[_0xce2b('0x26')]=qs[_0xce2b('0x30')](_[_0xce2b('0x57')](_0x473c8f['query'],_0x5b2948[_0xce2b('0x30')]));if(_0x473c8f[_0xce2b('0x2f')][_0xce2b('0x48')]){_0x11b765[_0xce2b('0x26')]=_[_0xce2b('0x49')](_0x11b765[_0xce2b('0x26')],{'$or':_[_0xce2b('0x22')](_0x11b765[_0xce2b('0x33')],function(_0x538230){var _0x5fd11d={};_0x5fd11d[_0x538230]={'$like':'%'+_0x473c8f['query'][_0xce2b('0x48')]+'%'};return _0x5fd11d;})});}_0x11b765=_[_0xce2b('0x49')]({},_0x11b765,_0x473c8f[_0xce2b('0x36')]);return _0x6f09c9[_0xce2b('0x7e')](_0x11b765);}})[_0xce2b('0x18')](function(_0x17905f){if(_0x17905f){_0x56d87b=_0x17905f['length'];if(!_0x473c8f[_0xce2b('0x2f')][_0xce2b('0x43')]('nolimit')){_0x11b765[_0xce2b('0x13')]=qs['limit'](_0x473c8f['query']['limit']);_0x11b765[_0xce2b('0x11')]=qs[_0xce2b('0x11')](_0x473c8f[_0xce2b('0x2f')][_0xce2b('0x11')]);}return _0x6f09c9['getAgents'](_0x11b765);}})[_0xce2b('0x18')](function(_0x15c3b2){if(_0x15c3b2){return _0x15c3b2?{'count':_0x56d87b,'rows':_0x15c3b2}:null;}})['then'](respondWithResult(_0x36ec17,null))[_0xce2b('0x2b')](handleError(_0x36ec17,null));}; \ No newline at end of file +var _0xa423=['all','union','compact','value','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','order','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','get','FaxQueues','UserProfileResource','error','name','send','index','map','rawAttributes','type','getOptions','where','FaxQueue','include','query','findAll','rows','catch','show','model','keys','filters','intersection','fields','length','attributes','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','findOne','UserFaxQueue','nolimit','sort','pick','FaxQueueId','filter','options','User','UserId','agent','faxPause','updatedAt','format','%s/%s','getTeams','hasOwnProperty','ids','Agents','online','voicePause','flatMap','transaction','addTeams','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','Team','select','tq.TeamId','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','TeamId','includes'];(function(_0x59a8d7,_0xb067c2){var _0x4b2c3f=function(_0x51aa6b){while(--_0x51aa6b){_0x59a8d7['push'](_0x59a8d7['shift']());}};_0x4b2c3f(++_0xb067c2);}(_0xa423,0x16c));var _0x3a42=function(_0x7e5e6,_0x3e0055){_0x7e5e6=_0x7e5e6-0x0;var _0x1434cb=_0xa423[_0x7e5e6];return _0x1434cb;};'use strict';var BPromise=require(_0x3a42('0x0'));var util=require(_0x3a42('0x1'));var _=require(_0x3a42('0x2'));var squel=require(_0x3a42('0x3'));var Redis=require(_0x3a42('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x3a42('0x5'))(_0x3a42('0x6'));var config=require('../../config/environment');var db=require(_0x3a42('0x7'))['db'];config[_0x3a42('0x8')]=_[_0x3a42('0x9')](config[_0x3a42('0x8')],{'host':_0x3a42('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3a42('0x8')]));require(_0x3a42('0xb'))[_0x3a42('0xc')](socket);function respondWithStatusCode(_0x3a08a1,_0x1be0b7){_0x1be0b7=_0x1be0b7||0xcc;return function(_0x30f605){if(_0x30f605){return _0x3a08a1[_0x3a42('0xd')](_0x1be0b7);}return _0x3a08a1[_0x3a42('0xe')](_0x1be0b7)[_0x3a42('0xf')]();};}function respondWithResult(_0x2a25c0,_0x397559){_0x397559=_0x397559||0xc8;return function(_0x4b2df6){if(_0x4b2df6){return _0x2a25c0[_0x3a42('0xe')](_0x397559)[_0x3a42('0x10')](_0x4b2df6);}};}function respondWithFilteredResult(_0x1f50f4,_0x168835){return function(_0x578a1d){if(_0x578a1d){var _0x55ffa5=typeof _0x168835[_0x3a42('0x11')]==='undefined'&&typeof _0x168835[_0x3a42('0x12')]===_0x3a42('0x13');var _0x198bf1=_0x578a1d[_0x3a42('0x14')];var _0x891963=_0x55ffa5?0x0:_0x168835[_0x3a42('0x11')];var _0x5f5244=_0x55ffa5?_0x578a1d[_0x3a42('0x14')]:_0x168835['offset']+_0x168835[_0x3a42('0x12')];var _0x4b1d68;if(_0x5f5244>=_0x198bf1){_0x5f5244=_0x198bf1;_0x4b1d68=0xc8;}else{_0x4b1d68=0xce;}_0x1f50f4[_0x3a42('0xe')](_0x4b1d68);return _0x1f50f4[_0x3a42('0x15')](_0x3a42('0x16'),_0x891963+'-'+_0x5f5244+'/'+_0x198bf1)['json'](_0x578a1d);}return null;};}function saveUpdates(_0x486c74){return function(_0x4eae89){if(_0x4eae89){return _0x4eae89[_0x3a42('0x17')](_0x486c74)[_0x3a42('0x18')](function(_0x438cf1){return _0x438cf1;});}return null;};}function removeEntity(_0x39e620){return function(_0x318526){if(_0x318526){return _0x318526['destroy']()[_0x3a42('0x18')](function(){var _0x2e5e64=_0x318526[_0x3a42('0x19')]({'plain':!![]});var _0x151835=_0x3a42('0x1a');return db[_0x3a42('0x1b')]['destroy']({'where':{'type':_0x151835,'resourceId':_0x2e5e64['id']}})[_0x3a42('0x18')](function(){return _0x318526;});})[_0x3a42('0x18')](function(){_0x39e620[_0x3a42('0xe')](0xcc)[_0x3a42('0xf')]();});}};}function handleEntityNotFound(_0x6f49b4){return function(_0x526d7c){if(!_0x526d7c){_0x6f49b4[_0x3a42('0xd')](0x194);}return _0x526d7c;};}function handleError(_0x42b40f,_0x379fe6){_0x379fe6=_0x379fe6||0x1f4;return function(_0x434283){logger[_0x3a42('0x1c')](_0x434283['stack']);if(_0x434283[_0x3a42('0x1d')]){delete _0x434283[_0x3a42('0x1d')];}_0x42b40f[_0x3a42('0xe')](_0x379fe6)[_0x3a42('0x1e')](_0x434283);};}exports[_0x3a42('0x1f')]=function(_0x258917,_0x2ee4b8){var _0x434044={};var _0x2c4b3a={'count':0x0,'rows':[]};var _0x3a3f87=_[_0x3a42('0x20')](db['FaxQueue'][_0x3a42('0x21')],function(_0x468ea8){return{'name':_0x468ea8['fieldName'],'type':_0x468ea8[_0x3a42('0x22')]['key']};});_0x434044=qs[_0x3a42('0x23')](_0x3a3f87,_0x258917);var _0x2a4878={'where':_0x434044[_0x3a42('0x24')]};return db[_0x3a42('0x25')][_0x3a42('0x14')](_0x2a4878)[_0x3a42('0x18')](function(_0x4b8fe7){_0x2c4b3a[_0x3a42('0x14')]=_0x4b8fe7;_0x434044[_0x3a42('0x26')]=qs[_0x3a42('0x26')](_0x258917[_0x3a42('0x27')]);return db[_0x3a42('0x25')][_0x3a42('0x28')](_0x434044);})[_0x3a42('0x18')](function(_0x56ee5d){_0x2c4b3a[_0x3a42('0x29')]=_0x56ee5d;return _0x2c4b3a;})[_0x3a42('0x18')](respondWithFilteredResult(_0x2ee4b8,_0x434044))[_0x3a42('0x2a')](handleError(_0x2ee4b8,null));};exports[_0x3a42('0x2b')]=function(_0x158f02,_0x50ece0){var _0x4d9701={'raw':!![],'where':{'id':_0x158f02['params']['id']}},_0x1032eb={};_0x1032eb[_0x3a42('0x2c')]=_[_0x3a42('0x2d')](db[_0x3a42('0x25')][_0x3a42('0x21')]);_0x1032eb[_0x3a42('0x27')]=_[_0x3a42('0x2d')](_0x158f02['query']);_0x1032eb[_0x3a42('0x2e')]=_[_0x3a42('0x2f')](_0x1032eb[_0x3a42('0x2c')],_0x1032eb['query']);_0x4d9701['attributes']=_[_0x3a42('0x2f')](_0x1032eb[_0x3a42('0x2c')],qs[_0x3a42('0x30')](_0x158f02[_0x3a42('0x27')][_0x3a42('0x30')]));_0x4d9701['attributes']=_0x4d9701['attributes'][_0x3a42('0x31')]?_0x4d9701[_0x3a42('0x32')]:_0x1032eb[_0x3a42('0x2c')];if(_0x158f02[_0x3a42('0x27')]['includeAll']){_0x4d9701[_0x3a42('0x26')]=[{'all':!![]}];}_0x4d9701=_[_0x3a42('0x33')]({},_0x4d9701,_0x158f02['options']);return db['FaxQueue']['find'](_0x4d9701)[_0x3a42('0x18')](handleEntityNotFound(_0x50ece0,null))['then'](respondWithResult(_0x50ece0,null))[_0x3a42('0x2a')](handleError(_0x50ece0,null));};exports[_0x3a42('0x34')]=function(_0x29312e,_0x1fcbcb){return db[_0x3a42('0x25')][_0x3a42('0x34')](_0x29312e[_0x3a42('0x35')],{})[_0x3a42('0x18')](function(_0x1db96b){var _0x54004c=_0x29312e[_0x3a42('0x36')][_0x3a42('0x19')]({'plain':!![]});if(!_0x54004c)throw new Error(_0x3a42('0x37'));if(_0x54004c[_0x3a42('0x38')]===_0x3a42('0x36')){var _0x567043=_0x1db96b[_0x3a42('0x19')]({'plain':!![]});var _0x542335='FaxQueues';return db['UserProfileSection']['find']({'where':{'name':_0x542335,'userProfileId':_0x54004c[_0x3a42('0x39')]},'raw':!![]})['then'](function(_0x56e32b){if(_0x56e32b&&_0x56e32b['autoAssociation']===0x0){return db[_0x3a42('0x1b')]['create']({'name':_0x567043['name'],'resourceId':_0x567043['id'],'type':_0x56e32b[_0x3a42('0x1d')],'sectionId':_0x56e32b['id']},{})[_0x3a42('0x18')](function(){return _0x1db96b;});}else{return _0x1db96b;}})[_0x3a42('0x2a')](function(_0x1f49e9){logger[_0x3a42('0x1c')](_0x3a42('0x3a'),_0x1f49e9);throw _0x1f49e9;});}return _0x1db96b;})['then'](respondWithResult(_0x1fcbcb,0xc9))[_0x3a42('0x2a')](handleError(_0x1fcbcb,null));};exports[_0x3a42('0x17')]=function(_0x3e5f89,_0x52a21c){if(_0x3e5f89[_0x3a42('0x35')]['id']){delete _0x3e5f89[_0x3a42('0x35')]['id'];}return db['FaxQueue'][_0x3a42('0x3b')]({'where':{'id':_0x3e5f89[_0x3a42('0x3c')]['id']}})[_0x3a42('0x18')](handleEntityNotFound(_0x52a21c,null))[_0x3a42('0x18')](saveUpdates(_0x3e5f89[_0x3a42('0x35')],null))[_0x3a42('0x18')](respondWithResult(_0x52a21c,null))[_0x3a42('0x2a')](handleError(_0x52a21c,null));};exports['destroy']=function(_0x384758,_0x2b2190){return db[_0x3a42('0x25')][_0x3a42('0x3b')]({'where':{'id':_0x384758[_0x3a42('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2b2190,null))[_0x3a42('0x18')](removeEntity(_0x2b2190,null))[_0x3a42('0x2a')](handleError(_0x2b2190,null));};exports[_0x3a42('0x3d')]=function(_0x4ec596,_0x432387){return db[_0x3a42('0x25')][_0x3a42('0x3d')]()[_0x3a42('0x18')](respondWithResult(_0x432387,null))[_0x3a42('0x2a')](handleError(_0x432387,null));};exports['getMembers']=function(_0x40c746,_0x33209c){var _0x3a3293={'raw':!![],'where':{}},_0xa46b2a={},_0x52ab00;return db[_0x3a42('0x25')][_0x3a42('0x3e')]({'where':{'id':_0x40c746[_0x3a42('0x3c')]['id']}})[_0x3a42('0x18')](handleEntityNotFound(_0x33209c,null))[_0x3a42('0x18')](function(_0x9799a){if(_0x9799a){_0x52ab00=_0x9799a[_0x3a42('0x19')]({'plain':!![]});_0xa46b2a['model']=_[_0x3a42('0x2d')](db[_0x3a42('0x3f')][_0x3a42('0x21')]);_0xa46b2a[_0x3a42('0x27')]=_[_0x3a42('0x2d')](_0x40c746[_0x3a42('0x27')]);_0xa46b2a['filters']=_[_0x3a42('0x2f')](_0xa46b2a['model'],_0xa46b2a[_0x3a42('0x27')]);_0x3a3293[_0x3a42('0x32')]=_[_0x3a42('0x2f')](_0xa46b2a[_0x3a42('0x2c')],qs[_0x3a42('0x30')](_0x40c746[_0x3a42('0x27')][_0x3a42('0x30')]));_0x3a3293[_0x3a42('0x32')]=_0x3a3293[_0x3a42('0x32')]['length']?_0x3a3293[_0x3a42('0x32')]:_0xa46b2a[_0x3a42('0x2c')];if(!_0x40c746['query']['hasOwnProperty'](_0x3a42('0x40'))){_0x3a3293[_0x3a42('0x12')]=qs['limit'](_0x40c746[_0x3a42('0x27')][_0x3a42('0x12')]);_0x3a3293[_0x3a42('0x11')]=qs['offset'](_0x40c746[_0x3a42('0x27')][_0x3a42('0x11')]);}_0x3a3293['order']=qs[_0x3a42('0x41')](_0x40c746['query'][_0x3a42('0x41')]);_0x3a3293[_0x3a42('0x24')]=qs['filters'](_[_0x3a42('0x42')](_0x40c746[_0x3a42('0x27')],_0xa46b2a[_0x3a42('0x2e')]));_0x3a3293[_0x3a42('0x24')][_0x3a42('0x43')]=_0x9799a['id'];if(_0x40c746[_0x3a42('0x27')][_0x3a42('0x44')]){_0x3a3293[_0x3a42('0x24')]=_[_0x3a42('0x33')](_0x3a3293[_0x3a42('0x24')],{'$or':_['map'](_0x3a3293[_0x3a42('0x32')],function(_0x2545e6){var _0x32ea5e={};_0x32ea5e[_0x2545e6]={'$like':'%'+_0x40c746[_0x3a42('0x27')][_0x3a42('0x44')]+'%'};return _0x32ea5e;})});}_0x3a3293=_['merge']({},_0x3a3293,_0x40c746[_0x3a42('0x45')]);return db[_0x3a42('0x3f')][_0x3a42('0x28')](_0x3a3293);}})['then'](function(_0x3b08b6){if(_0x3b08b6){return db[_0x3a42('0x46')]['findAndCountAll']({'where':{'id':_[_0x3a42('0x20')](_0x3b08b6,_0x3a42('0x47')),'role':_0x3a42('0x48')},'attributes':['id',_0x3a42('0x1d'),_0x3a42('0x49'),_0x3a42('0x4a'),'createdAt']});}})['then'](function(_0x4c20f4){if(_0x4c20f4){return{'count':_0x4c20f4[_0x3a42('0x14')],'rows':_[_0x3a42('0x20')](_0x4c20f4[_0x3a42('0x29')],function(_0x46cd72){return{'membername':_0x46cd72['name'],'UserId':_0x46cd72['id'],'queue_name':_0x52ab00[_0x3a42('0x1d')],'FaxQueueId':_0x52ab00['id'],'interface':util[_0x3a42('0x4b')](_0x3a42('0x4c'),'SIP',_0x46cd72[_0x3a42('0x1d')]),'penalty':0x0,'paused':_0x46cd72[_0x3a42('0x49')],'createdAt':_0x46cd72['createdAt'],'updatedAt':_0x46cd72[_0x3a42('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3a42('0x18')](respondWithFilteredResult(_0x33209c,_0x3a3293))[_0x3a42('0x2a')](handleError(_0x33209c,null));};exports[_0x3a42('0x4d')]=function(_0x30636d,_0x3349e8){var _0x297a39={};var _0x3fbf45={};var _0x319402;var _0x55541b;return db[_0x3a42('0x25')][_0x3a42('0x3e')]({'where':{'id':_0x30636d[_0x3a42('0x3c')]['id']}})[_0x3a42('0x18')](handleEntityNotFound(_0x3349e8,null))[_0x3a42('0x18')](function(_0x106246){if(_0x106246){_0x319402=_0x106246;_0x3fbf45[_0x3a42('0x2c')]=_[_0x3a42('0x2d')](db['Team'][_0x3a42('0x21')]);_0x3fbf45[_0x3a42('0x27')]=_[_0x3a42('0x2d')](_0x30636d['query']);_0x3fbf45['filters']=_['intersection'](_0x3fbf45[_0x3a42('0x2c')],_0x3fbf45[_0x3a42('0x27')]);_0x297a39[_0x3a42('0x32')]=_[_0x3a42('0x2f')](_0x3fbf45[_0x3a42('0x2c')],qs[_0x3a42('0x30')](_0x30636d[_0x3a42('0x27')]['fields']));_0x297a39[_0x3a42('0x32')]=_0x297a39[_0x3a42('0x32')]['length']?_0x297a39[_0x3a42('0x32')]:_0x3fbf45[_0x3a42('0x2c')];_0x297a39['order']=qs[_0x3a42('0x41')](_0x30636d['query'][_0x3a42('0x41')]);_0x297a39['where']=qs[_0x3a42('0x2e')](_[_0x3a42('0x42')](_0x30636d[_0x3a42('0x27')],_0x3fbf45[_0x3a42('0x2e')]));if(_0x30636d[_0x3a42('0x27')][_0x3a42('0x44')]){_0x297a39[_0x3a42('0x24')]=_['merge'](_0x297a39[_0x3a42('0x24')],{'$or':_[_0x3a42('0x20')](_0x297a39['attributes'],function(_0x9c3224){var _0x176aba={};_0x176aba[_0x9c3224]={'$like':'%'+_0x30636d['query'][_0x3a42('0x44')]+'%'};return _0x176aba;})});}_0x297a39=_[_0x3a42('0x33')]({},_0x297a39,_0x30636d[_0x3a42('0x45')]);return _0x319402[_0x3a42('0x4d')](_0x297a39);}})[_0x3a42('0x18')](function(_0x5a1844){if(_0x5a1844){_0x55541b=_0x5a1844['length'];if(!_0x30636d[_0x3a42('0x27')][_0x3a42('0x4e')](_0x3a42('0x40'))){_0x297a39['limit']=qs['limit'](_0x30636d['query'][_0x3a42('0x12')]);_0x297a39['offset']=qs[_0x3a42('0x11')](_0x30636d['query'][_0x3a42('0x11')]);}return _0x319402['getTeams'](_0x297a39);}})['then'](function(_0xc3ad1f){if(_0xc3ad1f){return _0xc3ad1f?{'count':_0x55541b,'rows':_0xc3ad1f}:null;}})['then'](respondWithResult(_0x3349e8,null))[_0x3a42('0x2a')](handleError(_0x3349e8,null));};exports['addTeams']=function(_0x579e6c,_0x3958fc){var _0x3b92a5=_0x579e6c[_0x3a42('0x35')][_0x3a42('0x4f')];return db['Team'][_0x3a42('0x28')]({'where':{'id':_0x3b92a5},'attributes':['id'],'include':[{'model':db[_0x3a42('0x46')],'as':_0x3a42('0x50'),'attributes':['id','name',_0x3a42('0x51'),_0x3a42('0x52'),'interface'],'raw':!![]}]})[_0x3a42('0x18')](function(_0x3212b7){if(_0x3212b7){var _0x15648d=_[_0x3a42('0x53')](_0x3212b7,function(_0x317061){var _0x123c77=_0x317061['get']({'plain':!![]});return _0x123c77[_0x3a42('0x50')];});return db['FaxQueue'][_0x3a42('0x3b')]({'where':{'id':_0x579e6c[_0x3a42('0x3c')]['id']}})['then'](function(_0x3fefc9){return db['sequelize'][_0x3a42('0x54')](function(_0x375db3){return _0x3fefc9[_0x3a42('0x55')](_0x3b92a5,{'transaction':_0x375db3})[_0x3a42('0x18')](function(){return BPromise['each'](_0x15648d,function(_0x31b83c){return db[_0x3a42('0x3f')][_0x3a42('0x56')]({'where':{'UserId':_0x31b83c['id'],'FaxQueueId':_0x579e6c['params']['id']},'transaction':_0x375db3});});})[_0x3a42('0x18')](function(){_0x15648d[_0x3a42('0x57')](function(_0x2a1c5d){socket[_0x3a42('0x58')](_0x3a42('0x59'),{'UserId':_0x2a1c5d['id'],'FaxQueueId':_0x3fefc9['id']});});});});});}})[_0x3a42('0x18')](respondWithStatusCode(_0x3958fc,null))['catch'](handleError(_0x3958fc,null));};exports[_0x3a42('0x5a')]=function(_0xd7db09,_0x541a15){return db[_0x3a42('0x5b')][_0x3a42('0x28')]({'where':{'id':_0xd7db09[_0x3a42('0x27')][_0x3a42('0x4f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3a42('0x50'),'attributes':['id'],'raw':!![]}]})[_0x3a42('0x18')](handleEntityNotFound(_0x541a15,null))[_0x3a42('0x18')](function(_0x2e36af){var _0x997202=_[_0x3a42('0x20')](_0x2e36af,'id');var _0x188436=[];var _0x2b9798=[];var _0x3727c8=squel[_0x3a42('0x5c')]();_0x3727c8['field'](_0x3a42('0x5d'))['from'](_0x3a42('0x5e'),'tq')['join'](_0x3a42('0x5f'),'ut',_0x3a42('0x60'))[_0x3a42('0x24')]('FaxQueueId\x20=\x20?',_0xd7db09[_0x3a42('0x3c')]['id']);for(var _0xe03cc8=0x0;_0xe03cc8<_0x2e36af[_0x3a42('0x31')];_0xe03cc8+=0x1){let _0x38d342=_0x2e36af[_0xe03cc8];for(var _0x1896f2=0x0;_0x1896f2<_0x38d342[_0x3a42('0x50')][_0x3a42('0x31')];_0x1896f2+=0x1){let _0x55ded0=_0x38d342[_0x3a42('0x50')][_0x1896f2];var _0x9e9a0e=_0x3727c8['clone']();_0x9e9a0e[_0x3a42('0x24')](_0x3a42('0x61'),_0x55ded0['id']);_0x2b9798[_0x3a42('0x62')](db['sequelize'][_0x3a42('0x27')](_0x9e9a0e[_0x3a42('0x63')](),{'type':db[_0x3a42('0x64')][_0x3a42('0x65')]['SELECT']})[_0x3a42('0x18')](function(_0x3b6984){if(_0x3b6984[_0x3a42('0x31')]===0x1){return _0x55ded0['id'];}else{var _0x118d23=_['every'](_[_0x3a42('0x20')](_0x3b6984,_0x3a42('0x66')),function(_0x24740d){return _[_0x3a42('0x67')](_0x997202,_0x24740d);});if(_0x118d23){return _0x55ded0['id'];}}}));}}return BPromise[_0x3a42('0x68')](_0x2b9798)[_0x3a42('0x18')](function(_0x2cd983){_0x188436=_(_0x188436)[_0x3a42('0x69')](_0x2cd983)[_0x3a42('0x6a')]()[_0x3a42('0x6b')]();return db[_0x3a42('0x25')][_0x3a42('0x3b')]({'where':{'id':_0xd7db09[_0x3a42('0x3c')]['id']}})[_0x3a42('0x18')](function(_0x54150c){return db[_0x3a42('0x64')]['transaction'](function(_0x41e00b){return _0x54150c[_0x3a42('0x5a')](_0xd7db09[_0x3a42('0x27')]['ids'],{'transaction':_0x41e00b})['then'](function(){if(!_[_0x3a42('0x6c')](_0x188436)){return _0x54150c['removeAgents'](_0x188436,{'transaction':_0x41e00b});}})[_0x3a42('0x18')](function(){_0x188436[_0x3a42('0x57')](function(_0x2fc6d2){socket['emit'](_0x3a42('0x6d'),{'UserId':_0x2fc6d2,'FaxQueueId':_0x54150c['id']});});});});});});})[_0x3a42('0x18')](respondWithStatusCode(_0x541a15,null))['catch'](handleError(_0x541a15,null));};exports[_0x3a42('0x6e')]=function(_0x549ef4,_0x2985d2){return db[_0x3a42('0x25')][_0x3a42('0x3b')]({'where':{'id':_0x549ef4[_0x3a42('0x3c')]['id']}})[_0x3a42('0x18')](handleEntityNotFound(_0x2985d2,null))[_0x3a42('0x18')](function(_0x5c699e){if(_0x5c699e){return _0x5c699e['addAgents'](_0x549ef4[_0x3a42('0x35')]['ids'],_[_0x3a42('0x6f')](_0x549ef4['body'],['ids','id'])||{})[_0x3a42('0x70')](function(_0x575f61){for(var _0x525022=0x0;_0x525022<_0x549ef4[_0x3a42('0x35')][_0x3a42('0x4f')][_0x3a42('0x31')];_0x525022+=0x1){socket[_0x3a42('0x58')]('userFaxQueue:save',{'UserId':Number(_0x549ef4['body'][_0x3a42('0x4f')][_0x525022]),'FaxQueueId':Number(_0x549ef4[_0x3a42('0x3c')]['id'])});}return _0x575f61;});}})['then'](respondWithResult(_0x2985d2,null))['catch'](handleError(_0x2985d2,null));};exports[_0x3a42('0x71')]=function(_0x4175fc,_0x2c6950){return db[_0x3a42('0x25')][_0x3a42('0x3b')]({'where':{'id':_0x4175fc[_0x3a42('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2c6950,null))['then'](function(_0x108185){if(_0x108185){return _0x108185[_0x3a42('0x71')](_0x4175fc[_0x3a42('0x27')][_0x3a42('0x4f')])['then'](function(){if(_[_0x3a42('0x72')](_0x4175fc[_0x3a42('0x27')]['ids'])){for(var _0x1bba4e=0x0;_0x1bba4e<_0x4175fc[_0x3a42('0x27')][_0x3a42('0x4f')][_0x3a42('0x31')];_0x1bba4e+=0x1){socket['emit'](_0x3a42('0x6d'),{'UserId':Number(_0x4175fc[_0x3a42('0x27')][_0x3a42('0x4f')][_0x1bba4e]),'FaxQueueId':Number(_0x4175fc['params']['id'])});}}else{socket[_0x3a42('0x58')](_0x3a42('0x6d'),{'UserId':Number(_0x4175fc['query'][_0x3a42('0x4f')]),'FaxQueueId':Number(_0x4175fc[_0x3a42('0x3c')]['id'])});}});}})[_0x3a42('0x18')](respondWithStatusCode(_0x2c6950,null))['catch'](handleError(_0x2c6950,null));};exports[_0x3a42('0x73')]=function(_0x48ea2f,_0x35b712){var _0xcce2d1={};var _0x6dfb47={};var _0x31b165;var _0xd68556;return db[_0x3a42('0x25')][_0x3a42('0x3e')]({'where':{'id':_0x48ea2f[_0x3a42('0x3c')]['id']}})[_0x3a42('0x18')](handleEntityNotFound(_0x35b712,null))[_0x3a42('0x18')](function(_0x36cf4a){if(_0x36cf4a){_0x31b165=_0x36cf4a;_0x6dfb47[_0x3a42('0x2c')]=_[_0x3a42('0x2d')](db[_0x3a42('0x46')][_0x3a42('0x21')]);_0x6dfb47[_0x3a42('0x27')]=_['keys'](_0x48ea2f['query']);_0x6dfb47['filters']=_[_0x3a42('0x2f')](_0x6dfb47[_0x3a42('0x2c')],_0x6dfb47[_0x3a42('0x27')]);_0xcce2d1[_0x3a42('0x32')]=_[_0x3a42('0x2f')](_0x6dfb47[_0x3a42('0x2c')],qs[_0x3a42('0x30')](_0x48ea2f[_0x3a42('0x27')][_0x3a42('0x30')]));_0xcce2d1[_0x3a42('0x32')]=_0xcce2d1[_0x3a42('0x32')][_0x3a42('0x31')]?_0xcce2d1[_0x3a42('0x32')]:_0x6dfb47[_0x3a42('0x2c')];_0xcce2d1[_0x3a42('0x74')]=qs[_0x3a42('0x41')](_0x48ea2f['query'][_0x3a42('0x41')]);_0xcce2d1[_0x3a42('0x24')]=qs[_0x3a42('0x2e')](_[_0x3a42('0x42')](_0x48ea2f[_0x3a42('0x27')],_0x6dfb47[_0x3a42('0x2e')]));if(_0x48ea2f['query'][_0x3a42('0x44')]){_0xcce2d1[_0x3a42('0x24')]=_[_0x3a42('0x33')](_0xcce2d1[_0x3a42('0x24')],{'$or':_[_0x3a42('0x20')](_0xcce2d1[_0x3a42('0x32')],function(_0xc4ac3f){var _0x123537={};_0x123537[_0xc4ac3f]={'$like':'%'+_0x48ea2f[_0x3a42('0x27')]['filter']+'%'};return _0x123537;})});}_0xcce2d1=_[_0x3a42('0x33')]({},_0xcce2d1,_0x48ea2f[_0x3a42('0x45')]);return _0x31b165[_0x3a42('0x73')](_0xcce2d1);}})[_0x3a42('0x18')](function(_0x44fb0a){if(_0x44fb0a){_0xd68556=_0x44fb0a['length'];if(!_0x48ea2f[_0x3a42('0x27')][_0x3a42('0x4e')](_0x3a42('0x40'))){_0xcce2d1[_0x3a42('0x12')]=qs[_0x3a42('0x12')](_0x48ea2f[_0x3a42('0x27')][_0x3a42('0x12')]);_0xcce2d1['offset']=qs['offset'](_0x48ea2f['query']['offset']);}return _0x31b165[_0x3a42('0x73')](_0xcce2d1);}})['then'](function(_0x755115){if(_0x755115){return _0x755115?{'count':_0xd68556,'rows':_0x755115}:null;}})[_0x3a42('0x18')](respondWithResult(_0x35b712,null))[_0x3a42('0x2a')](handleError(_0x35b712,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index ca767e7..6f98654 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 _0xa292=['exports','events','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x7be21,_0x46c866){var _0x2ab76b=function(_0x5a667c){while(--_0x5a667c){_0x7be21['push'](_0x7be21['shift']());}};_0x2ab76b(++_0x46c866);}(_0xa292,0x1e1));var _0x2a29=function(_0x368fc3,_0x2b7c2c){_0x368fc3=_0x368fc3-0x0;var _0x1fa4b2=_0xa292[_0x368fc3];return _0x1fa4b2;};'use strict';var EventEmitter=require(_0x2a29('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x2a29('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x2a29('0x2')](0x0);var events={'afterCreate':_0x2a29('0x3'),'afterUpdate':_0x2a29('0x4'),'afterDestroy':_0x2a29('0x5')};function emitEvent(_0x2aa5a5){return function(_0x2c6755,_0x6120e8,_0xe5c9e4){FaxQueueEvents['emit'](_0x2aa5a5+':'+_0x2c6755['id'],_0x2c6755);FaxQueueEvents[_0x2a29('0x6')](_0x2aa5a5,_0x2c6755);_0xe5c9e4(null);};}for(var e in events){if(events[_0x2a29('0x7')](e)){var event=events[e];FaxQueue[_0x2a29('0x8')](e,emitEvent(event));}}module[_0x2a29('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x7977=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x857149,_0x33a620){var _0x4a34e0=function(_0x4d5ece){while(--_0x4d5ece){_0x857149['push'](_0x857149['shift']());}};_0x4a34e0(++_0x33a620);}(_0x7977,0x105));var _0x7797=function(_0x5c98ea,_0xa782aa){_0x5c98ea=_0x5c98ea-0x0;var _0x51e853=_0x7977[_0x5c98ea];return _0x51e853;};'use strict';var EventEmitter=require(_0x7797('0x0'));var FaxQueue=require(_0x7797('0x1'))['db'][_0x7797('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x7797('0x3')](0x0);var events={'afterCreate':_0x7797('0x4'),'afterUpdate':_0x7797('0x5'),'afterDestroy':'remove'};function emitEvent(_0x62af81){return function(_0x9ad2f9,_0x5e3293,_0x5c06ec){FaxQueueEvents[_0x7797('0x6')](_0x62af81+':'+_0x9ad2f9['id'],_0x9ad2f9);FaxQueueEvents['emit'](_0x62af81,_0x9ad2f9);_0x5c06ec(null);};}for(var e in events){if(events[_0x7797('0x7')](e)){var event=events[e];FaxQueue[_0x7797('0x8')](e,emitEvent(event));}}module[_0x7797('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 55eac06..a489378 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 _0x2ec7=['exports','define','FaxQueue','fax_queues','util','api','moment','request-promise','../../config/environment','./faxQueue.attributes'];(function(_0x135e71,_0x137120){var _0x2789bf=function(_0xf994f2){while(--_0xf994f2){_0x135e71['push'](_0x135e71['shift']());}};_0x2789bf(++_0x137120);}(_0x2ec7,0xcc));var _0x72ec=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x2ec7[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require(_0x72ec('0x0'));var logger=require('../../config/logger')(_0x72ec('0x1'));var moment=require(_0x72ec('0x2'));var BPromise=require('bluebird');var rp=require(_0x72ec('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x72ec('0x4'));var attributes=require(_0x72ec('0x5'));module[_0x72ec('0x6')]=function(_0x43182d,_0x591e3c){return _0x43182d[_0x72ec('0x7')](_0x72ec('0x8'),attributes,{'tableName':_0x72ec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdee4=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes','define','FaxQueue'];(function(_0x1132c2,_0x8491f3){var _0x236374=function(_0x5564db){while(--_0x5564db){_0x1132c2['push'](_0x1132c2['shift']());}};_0x236374(++_0x8491f3);}(_0xdee4,0xd1));var _0x4dee=function(_0x176d14,_0x3984ea){_0x176d14=_0x176d14-0x0;var _0x89522c=_0xdee4[_0x176d14];return _0x89522c;};'use strict';var _=require(_0x4dee('0x0'));var util=require(_0x4dee('0x1'));var logger=require('../../config/logger')(_0x4dee('0x2'));var moment=require(_0x4dee('0x3'));var BPromise=require(_0x4dee('0x4'));var rp=require(_0x4dee('0x5'));var fs=require('fs');var path=require(_0x4dee('0x6'));var rimraf=require(_0x4dee('0x7'));var config=require('../../config/environment');var attributes=require(_0x4dee('0x8'));module['exports']=function(_0x3fbb1c,_0x3f56d5){return _0x3fbb1c[_0x4dee('0x9')](_0x4dee('0xa'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 9fa66ba..baf0cd3 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 _0xebf2=['catch','ShowFaxQueue','find','where','lodash','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','include','map','model'];(function(_0x109c89,_0x5336d3){var _0x2b00e6=function(_0x2beb12){while(--_0x2beb12){_0x109c89['push'](_0x109c89['shift']());}};_0x2b00e6(++_0x5336d3);}(_0xebf2,0x180));var _0x2ebf=function(_0x17af33,_0xbd7fd7){_0x17af33=_0x17af33-0x0;var _0xccb817=_0xebf2[_0x17af33];return _0xccb817;};'use strict';var _=require(_0x2ebf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2ebf('0x1'));var fs=require('fs');var Redis=require(_0x2ebf('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ebf('0x3'));var logger=require(_0x2ebf('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2ebf('0x5'));var client=jayson[_0x2ebf('0x6')]['http']({'port':0x232a});config[_0x2ebf('0x7')]=_[_0x2ebf('0x8')](config['redis'],{'host':_0x2ebf('0x9'),'port':0x18eb});var socket=require(_0x2ebf('0xa'))(new Redis(config[_0x2ebf('0x7')]));require(_0x2ebf('0xb'))[_0x2ebf('0xc')](socket);function respondWithRpcPromise(_0x4e5aae,_0x461568,_0x29bb46){return new BPromise(function(_0x5b3fd5,_0x3111a5){return client[_0x2ebf('0xd')](_0x4e5aae,_0x29bb46)[_0x2ebf('0xe')](function(_0xdfabaf){logger[_0x2ebf('0xf')](_0x2ebf('0x10'),_0x461568,_0x2ebf('0x11'));logger[_0x2ebf('0x12')](_0x2ebf('0x13'),_0x461568,_0x2ebf('0x11'),JSON[_0x2ebf('0x14')](_0xdfabaf));if(_0xdfabaf[_0x2ebf('0x15')]){if(_0xdfabaf[_0x2ebf('0x15')][_0x2ebf('0x16')]===0x1f4){logger[_0x2ebf('0x15')]('FaxQueue,\x20%s,\x20%s',_0x461568,_0xdfabaf['error'][_0x2ebf('0x17')]);return _0x3111a5(_0xdfabaf[_0x2ebf('0x15')][_0x2ebf('0x17')]);}logger[_0x2ebf('0x15')](_0x2ebf('0x10'),_0x461568,_0xdfabaf[_0x2ebf('0x15')][_0x2ebf('0x17')]);return _0x5b3fd5(_0xdfabaf['error'][_0x2ebf('0x17')]);}else{logger[_0x2ebf('0xf')](_0x2ebf('0x10'),_0x461568,'request\x20sent');_0x5b3fd5(_0xdfabaf[_0x2ebf('0x18')][_0x2ebf('0x17')]);}})['catch'](function(_0xdbe2dd){logger[_0x2ebf('0x15')](_0x2ebf('0x10'),_0x461568,_0xdbe2dd);_0x3111a5(_0xdbe2dd);});});}exports[_0x2ebf('0x19')]=function(_0x4d3f92){var _0x507f55=this;return new Promise(function(_0x49392b,_0xd62660){return db[_0x2ebf('0x1a')][_0x2ebf('0x1b')]({'raw':_0x4d3f92[_0x2ebf('0x1c')]?_0x4d3f92[_0x2ebf('0x1c')][_0x2ebf('0x1d')]===undefined?!![]:![]:!![],'where':_0x4d3f92[_0x2ebf('0x1c')]?_0x4d3f92[_0x2ebf('0x1c')]['where']||null:null,'attributes':_0x4d3f92[_0x2ebf('0x1c')]?_0x4d3f92[_0x2ebf('0x1c')][_0x2ebf('0x1e')]||null:null,'limit':_0x4d3f92[_0x2ebf('0x1c')]?_0x4d3f92[_0x2ebf('0x1c')]['limit']||null:null,'include':_0x4d3f92[_0x2ebf('0x1c')]?_0x4d3f92[_0x2ebf('0x1c')][_0x2ebf('0x1f')]?_[_0x2ebf('0x20')](_0x4d3f92['options'][_0x2ebf('0x1f')],function(_0x4210a0){return{'model':db[_0x4210a0['model']],'as':_0x4210a0['as'],'attributes':_0x4210a0[_0x2ebf('0x1e')],'include':_0x4210a0[_0x2ebf('0x1f')]?_[_0x2ebf('0x20')](_0x4210a0[_0x2ebf('0x1f')],function(_0x12a3e1){return{'model':db[_0x12a3e1['model']],'as':_0x12a3e1['as'],'attributes':_0x12a3e1['attributes'],'include':_0x12a3e1[_0x2ebf('0x1f')]?_[_0x2ebf('0x20')](_0x12a3e1[_0x2ebf('0x1f')],function(_0x34e623){return{'model':db[_0x34e623[_0x2ebf('0x21')]],'as':_0x34e623['as'],'attributes':_0x34e623[_0x2ebf('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48fe3d){logger[_0x2ebf('0xf')](_0x2ebf('0x19'),_0x4d3f92);logger[_0x2ebf('0x12')](_0x2ebf('0x19'),_0x4d3f92,JSON[_0x2ebf('0x14')](_0x48fe3d));_0x49392b(_0x48fe3d);})[_0x2ebf('0x22')](function(_0xef94ed){logger['error'](_0x2ebf('0x19'),_0xef94ed[_0x2ebf('0x17')],_0x4d3f92);_0xd62660(_0x507f55[_0x2ebf('0x15')](0x1f4,_0xef94ed[_0x2ebf('0x17')]));});});};exports[_0x2ebf('0x23')]=function(_0x66cacb){var _0x38f973=this;return new Promise(function(_0x2db1aa,_0xfe5c88){return db['FaxQueue'][_0x2ebf('0x24')]({'raw':_0x66cacb[_0x2ebf('0x1c')]?_0x66cacb[_0x2ebf('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x66cacb[_0x2ebf('0x1c')]?_0x66cacb[_0x2ebf('0x1c')][_0x2ebf('0x25')]||null:null,'attributes':_0x66cacb[_0x2ebf('0x1c')]?_0x66cacb[_0x2ebf('0x1c')][_0x2ebf('0x1e')]||null:null,'include':_0x66cacb[_0x2ebf('0x1c')]?_0x66cacb[_0x2ebf('0x1c')][_0x2ebf('0x1f')]?_[_0x2ebf('0x20')](_0x66cacb[_0x2ebf('0x1c')][_0x2ebf('0x1f')],function(_0x4623de){return{'model':db[_0x4623de[_0x2ebf('0x21')]],'as':_0x4623de['as'],'attributes':_0x4623de[_0x2ebf('0x1e')],'include':_0x4623de[_0x2ebf('0x1f')]?_[_0x2ebf('0x20')](_0x4623de[_0x2ebf('0x1f')],function(_0x24c8fb){return{'model':db[_0x24c8fb['model']],'as':_0x24c8fb['as'],'attributes':_0x24c8fb[_0x2ebf('0x1e')],'include':_0x24c8fb[_0x2ebf('0x1f')]?_[_0x2ebf('0x20')](_0x24c8fb[_0x2ebf('0x1f')],function(_0x28acec){return{'model':db[_0x28acec['model']],'as':_0x28acec['as'],'attributes':_0x28acec[_0x2ebf('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2ebf('0xe')](function(_0x55ec8e){logger[_0x2ebf('0xf')](_0x2ebf('0x23'),_0x66cacb);logger[_0x2ebf('0x12')](_0x2ebf('0x23'),_0x66cacb,JSON[_0x2ebf('0x14')](_0x55ec8e));_0x2db1aa(_0x55ec8e);})['catch'](function(_0xb2bd78){logger[_0x2ebf('0x15')](_0x2ebf('0x23'),_0xb2bd78[_0x2ebf('0x17')],_0x66cacb);_0xfe5c88(_0x38f973[_0x2ebf('0x15')](0x1f4,_0xb2bd78[_0x2ebf('0x17')]));});});}; \ No newline at end of file +var _0x127f=['map','GetFaxQueue','ShowFaxQueue','find','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./faxQueue.socket','register','request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','FaxQueue','findAll','options','raw','where','limit','include','model','attributes'];(function(_0x120e59,_0x443649){var _0x53ff80=function(_0x5a642e){while(--_0x5a642e){_0x120e59['push'](_0x120e59['shift']());}};_0x53ff80(++_0x443649);}(_0x127f,0x176));var _0xf127=function(_0x6dac8b,_0x13c586){_0x6dac8b=_0x6dac8b-0x0;var _0x5a6969=_0x127f[_0x6dac8b];return _0x5a6969;};'use strict';var _=require(_0xf127('0x0'));var util=require(_0xf127('0x1'));var moment=require(_0xf127('0x2'));var BPromise=require(_0xf127('0x3'));var rs=require(_0xf127('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf127('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf127('0x6'))('rpc');var config=require(_0xf127('0x7'));var jayson=require(_0xf127('0x8'));var client=jayson[_0xf127('0x9')][_0xf127('0xa')]({'port':0x232a});config['redis']=_[_0xf127('0xb')](config[_0xf127('0xc')],{'host':_0xf127('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf127('0xe'))[_0xf127('0xf')](socket);function respondWithRpcPromise(_0x454452,_0x4d54dc,_0x5915b7){return new BPromise(function(_0x98a342,_0x20de3){return client[_0xf127('0x10')](_0x454452,_0x5915b7)['then'](function(_0x50d076){logger['info'](_0xf127('0x11'),_0x4d54dc,_0xf127('0x12'));logger[_0xf127('0x13')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x4d54dc,_0xf127('0x12'),JSON[_0xf127('0x14')](_0x50d076));if(_0x50d076[_0xf127('0x15')]){if(_0x50d076['error'][_0xf127('0x16')]===0x1f4){logger[_0xf127('0x15')](_0xf127('0x11'),_0x4d54dc,_0x50d076['error'][_0xf127('0x17')]);return _0x20de3(_0x50d076[_0xf127('0x15')][_0xf127('0x17')]);}logger[_0xf127('0x15')](_0xf127('0x11'),_0x4d54dc,_0x50d076[_0xf127('0x15')]['message']);return _0x98a342(_0x50d076[_0xf127('0x15')]['message']);}else{logger[_0xf127('0x18')](_0xf127('0x11'),_0x4d54dc,_0xf127('0x12'));_0x98a342(_0x50d076[_0xf127('0x19')][_0xf127('0x17')]);}})[_0xf127('0x1a')](function(_0x4bb504){logger[_0xf127('0x15')](_0xf127('0x11'),_0x4d54dc,_0x4bb504);_0x20de3(_0x4bb504);});});}exports['GetFaxQueue']=function(_0x110503){var _0x4c6dc3=this;return new Promise(function(_0x10868d,_0xdbc907){return db[_0xf127('0x1b')][_0xf127('0x1c')]({'raw':_0x110503[_0xf127('0x1d')]?_0x110503[_0xf127('0x1d')][_0xf127('0x1e')]===undefined?!![]:![]:!![],'where':_0x110503[_0xf127('0x1d')]?_0x110503[_0xf127('0x1d')][_0xf127('0x1f')]||null:null,'attributes':_0x110503[_0xf127('0x1d')]?_0x110503[_0xf127('0x1d')]['attributes']||null:null,'limit':_0x110503[_0xf127('0x1d')]?_0x110503['options'][_0xf127('0x20')]||null:null,'include':_0x110503[_0xf127('0x1d')]?_0x110503[_0xf127('0x1d')]['include']?_['map'](_0x110503['options'][_0xf127('0x21')],function(_0x297b18){return{'model':db[_0x297b18[_0xf127('0x22')]],'as':_0x297b18['as'],'attributes':_0x297b18[_0xf127('0x23')],'include':_0x297b18['include']?_[_0xf127('0x24')](_0x297b18[_0xf127('0x21')],function(_0x5eb481){return{'model':db[_0x5eb481[_0xf127('0x22')]],'as':_0x5eb481['as'],'attributes':_0x5eb481[_0xf127('0x23')],'include':_0x5eb481['include']?_[_0xf127('0x24')](_0x5eb481[_0xf127('0x21')],function(_0x34f174){return{'model':db[_0x34f174[_0xf127('0x22')]],'as':_0x34f174['as'],'attributes':_0x34f174[_0xf127('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30d196){logger['info'](_0xf127('0x25'),_0x110503);logger[_0xf127('0x13')]('GetFaxQueue',_0x110503,JSON[_0xf127('0x14')](_0x30d196));_0x10868d(_0x30d196);})[_0xf127('0x1a')](function(_0x1640b0){logger[_0xf127('0x15')](_0xf127('0x25'),_0x1640b0['message'],_0x110503);_0xdbc907(_0x4c6dc3[_0xf127('0x15')](0x1f4,_0x1640b0[_0xf127('0x17')]));});});};exports[_0xf127('0x26')]=function(_0x2afbd5){var _0x4877a9=this;return new Promise(function(_0xdab38e,_0x102453){return db[_0xf127('0x1b')][_0xf127('0x27')]({'raw':_0x2afbd5[_0xf127('0x1d')]?_0x2afbd5[_0xf127('0x1d')][_0xf127('0x1e')]===undefined?!![]:![]:!![],'where':_0x2afbd5[_0xf127('0x1d')]?_0x2afbd5['options'][_0xf127('0x1f')]||null:null,'attributes':_0x2afbd5[_0xf127('0x1d')]?_0x2afbd5['options'][_0xf127('0x23')]||null:null,'include':_0x2afbd5[_0xf127('0x1d')]?_0x2afbd5[_0xf127('0x1d')][_0xf127('0x21')]?_[_0xf127('0x24')](_0x2afbd5[_0xf127('0x1d')]['include'],function(_0x4d7b67){return{'model':db[_0x4d7b67[_0xf127('0x22')]],'as':_0x4d7b67['as'],'attributes':_0x4d7b67['attributes'],'include':_0x4d7b67[_0xf127('0x21')]?_[_0xf127('0x24')](_0x4d7b67[_0xf127('0x21')],function(_0x315c33){return{'model':db[_0x315c33[_0xf127('0x22')]],'as':_0x315c33['as'],'attributes':_0x315c33[_0xf127('0x23')],'include':_0x315c33[_0xf127('0x21')]?_['map'](_0x315c33[_0xf127('0x21')],function(_0x3c6768){return{'model':db[_0x3c6768[_0xf127('0x22')]],'as':_0x3c6768['as'],'attributes':_0x3c6768[_0xf127('0x23')]};}):[]};}):[]};}):[]:[]})[_0xf127('0x28')](function(_0x3c2477){logger[_0xf127('0x18')](_0xf127('0x26'),_0x2afbd5);logger[_0xf127('0x13')](_0xf127('0x26'),_0x2afbd5,JSON['stringify'](_0x3c2477));_0xdab38e(_0x3c2477);})[_0xf127('0x1a')](function(_0x3c9fcc){logger[_0xf127('0x15')](_0xf127('0x26'),_0x3c9fcc[_0xf127('0x17')],_0x2afbd5);_0x102453(_0x4877a9[_0xf127('0x15')](0x1f4,_0x3c9fcc[_0xf127('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 734b925..2c12188 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 _0xd5b1=['length','faxQueue:','./faxQueue.events','update','removeListener','register'];(function(_0x2213ed,_0x46afa1){var _0x2491fc=function(_0x3f2773){while(--_0x3f2773){_0x2213ed['push'](_0x2213ed['shift']());}};_0x2491fc(++_0x46afa1);}(_0xd5b1,0x116));var _0x1d5b=function(_0x5b15a6,_0x1ad76b){_0x5b15a6=_0x5b15a6-0x0;var _0x287d3f=_0xd5b1[_0x5b15a6];return _0x287d3f;};'use strict';var FaxQueueEvents=require(_0x1d5b('0x0'));var events=['save','remove',_0x1d5b('0x1')];function createListener(_0x510342,_0x151066){return function(_0x2d3bcc){_0x151066['emit'](_0x510342,_0x2d3bcc);};}function removeListener(_0x41d4cd,_0x4bf66f){return function(){FaxQueueEvents[_0x1d5b('0x2')](_0x41d4cd,_0x4bf66f);};}exports[_0x1d5b('0x3')]=function(_0x3080d0){for(var _0x40e6c7=0x0,_0x1aba5a=events[_0x1d5b('0x4')];_0x40e6c7<_0x1aba5a;_0x40e6c7++){var _0x4a8370=events[_0x40e6c7];var _0x7c8b0e=createListener(_0x1d5b('0x5')+_0x4a8370,_0x3080d0);FaxQueueEvents['on'](_0x4a8370,_0x7c8b0e);}}; \ No newline at end of file +var _0xdcf4=['remove','update','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x285b3a,_0x4fa5d2){var _0x13a33b=function(_0x1afcfd){while(--_0x1afcfd){_0x285b3a['push'](_0x285b3a['shift']());}};_0x13a33b(++_0x4fa5d2);}(_0xdcf4,0x126));var _0x4dcf=function(_0x3cbb50,_0x595be0){_0x3cbb50=_0x3cbb50-0x0;var _0xc0001e=_0xdcf4[_0x3cbb50];return _0xc0001e;};'use strict';var FaxQueueEvents=require(_0x4dcf('0x0'));var events=[_0x4dcf('0x1'),_0x4dcf('0x2'),_0x4dcf('0x3')];function createListener(_0x2db783,_0x208f57){return function(_0x16308d){_0x208f57['emit'](_0x2db783,_0x16308d);};}function removeListener(_0x6c603e,_0x359b9e){return function(){FaxQueueEvents[_0x4dcf('0x4')](_0x6c603e,_0x359b9e);};}exports[_0x4dcf('0x5')]=function(_0x497687){for(var _0x12f560=0x0,_0x332a07=events[_0x4dcf('0x6')];_0x12f560<_0x332a07;_0x12f560++){var _0x230470=events[_0x12f560];var _0x17f421=createListener(_0x4dcf('0x7')+_0x230470,_0x497687);FaxQueueEvents['on'](_0x230470,_0x17f421);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 6b4ef1a..bbae398 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 _0x13f5=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','put','update','delete','removeTeams','exports','multer'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x13f5,0xc3));var _0x513f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x13f5[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x513f('0x0'));var util=require(_0x513f('0x1'));var path=require(_0x513f('0x2'));var timeout=require(_0x513f('0x3'));var express=require('express');var router=express[_0x513f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x513f('0x5'));var config=require(_0x513f('0x6'));var controller=require(_0x513f('0x7'));router[_0x513f('0x8')]('/',auth[_0x513f('0x9')](),controller[_0x513f('0xa')]);router[_0x513f('0x8')](_0x513f('0xb'),auth[_0x513f('0x9')](),controller[_0x513f('0xc')]);router[_0x513f('0x8')](_0x513f('0xd'),auth['isAuthenticated'](),controller[_0x513f('0xe')]);router[_0x513f('0x8')](_0x513f('0xf'),auth[_0x513f('0x9')](),controller[_0x513f('0x10')]);router['get'](_0x513f('0x11'),auth[_0x513f('0x9')](),controller['getTeams']);router[_0x513f('0x8')](_0x513f('0x12'),auth[_0x513f('0x9')](),controller[_0x513f('0x13')]);router[_0x513f('0x14')]('/',auth[_0x513f('0x9')](),controller[_0x513f('0x15')]);router[_0x513f('0x14')](_0x513f('0x11'),auth[_0x513f('0x9')](),controller[_0x513f('0x16')]);router[_0x513f('0x14')](_0x513f('0x12'),auth[_0x513f('0x9')](),controller['addAgents']);router[_0x513f('0x17')]('/:id',auth[_0x513f('0x9')](),controller[_0x513f('0x18')]);router[_0x513f('0x19')](_0x513f('0xd'),auth[_0x513f('0x9')](),controller['destroy']);router[_0x513f('0x19')](_0x513f('0x11'),auth['isAuthenticated'](),controller[_0x513f('0x1a')]);router['delete'](_0x513f('0x12'),auth[_0x513f('0x9')](),controller['removeAgents']);module[_0x513f('0x1b')]=router; \ No newline at end of file +var _0xfc46=['destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','/:id','update','delete'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xfc46,0x9a));var _0x6fc4=function(_0x57da0a,_0x284aed){_0x57da0a=_0x57da0a-0x0;var _0x3145d5=_0xfc46[_0x57da0a];return _0x3145d5;};'use strict';var multer=require(_0x6fc4('0x0'));var util=require('util');var path=require(_0x6fc4('0x1'));var timeout=require(_0x6fc4('0x2'));var express=require(_0x6fc4('0x3'));var router=express['Router']();var fs_extra=require(_0x6fc4('0x4'));var auth=require(_0x6fc4('0x5'));var interaction=require(_0x6fc4('0x6'));var config=require(_0x6fc4('0x7'));var controller=require('./faxQueue.controller');router[_0x6fc4('0x8')]('/',auth[_0x6fc4('0x9')](),controller[_0x6fc4('0xa')]);router[_0x6fc4('0x8')](_0x6fc4('0xb'),auth[_0x6fc4('0x9')](),controller['describe']);router[_0x6fc4('0x8')]('/:id',auth[_0x6fc4('0x9')](),controller[_0x6fc4('0xc')]);router['get'](_0x6fc4('0xd'),auth[_0x6fc4('0x9')](),controller[_0x6fc4('0xe')]);router[_0x6fc4('0x8')](_0x6fc4('0xf'),auth[_0x6fc4('0x9')](),controller[_0x6fc4('0x10')]);router[_0x6fc4('0x8')](_0x6fc4('0x11'),auth[_0x6fc4('0x9')](),controller[_0x6fc4('0x12')]);router[_0x6fc4('0x13')]('/',auth[_0x6fc4('0x9')](),controller[_0x6fc4('0x14')]);router[_0x6fc4('0x13')](_0x6fc4('0xf'),auth[_0x6fc4('0x9')](),controller['addTeams']);router['post'](_0x6fc4('0x11'),auth[_0x6fc4('0x9')](),controller[_0x6fc4('0x15')]);router[_0x6fc4('0x16')](_0x6fc4('0x17'),auth[_0x6fc4('0x9')](),controller[_0x6fc4('0x18')]);router[_0x6fc4('0x19')](_0x6fc4('0x17'),auth['isAuthenticated'](),controller[_0x6fc4('0x1a')]);router[_0x6fc4('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6fc4('0x1b')]);router[_0x6fc4('0x19')]('/:id/users',auth[_0x6fc4('0x9')](),controller[_0x6fc4('0x1c')]);module[_0x6fc4('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 9d1a59b..166b2ef 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 _0xa566=['sequelize','exports','STRING','DATE','moment'];(function(_0x1e73f0,_0x472ddf){var _0xb54ade=function(_0xc95ceb){while(--_0xc95ceb){_0x1e73f0['push'](_0x1e73f0['shift']());}};_0xb54ade(++_0x472ddf);}(_0xa566,0x1c1));var _0x6a56=function(_0x3de6e0,_0x116ce7){_0x3de6e0=_0x3de6e0-0x0;var _0x1c43b9=_0xa566[_0x3de6e0];return _0x1c43b9;};'use strict';var moment=require(_0x6a56('0x0'));var Sequelize=require(_0x6a56('0x1'));module[_0x6a56('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x6a56('0x3')]},'joinAt':{'type':Sequelize[_0x6a56('0x4')]},'leaveAt':{'type':Sequelize[_0x6a56('0x4')]},'acceptAt':{'type':Sequelize[_0x6a56('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x6a56('0x3')]}}; \ No newline at end of file +var _0x13ff=['STRING','DATE','moment','exports'];(function(_0x4c321c,_0x3e9da0){var _0x25accb=function(_0x21bf7a){while(--_0x21bf7a){_0x4c321c['push'](_0x4c321c['shift']());}};_0x25accb(++_0x3e9da0);}(_0x13ff,0xe6));var _0xf13f=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x13ff[_0x1caf6a];return _0x1bf493;};'use strict';var moment=require(_0xf13f('0x0'));var Sequelize=require('sequelize');module[_0xf13f('0x1')]={'uniqueid':{'type':Sequelize[_0xf13f('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf13f('0x2')]},'joinAt':{'type':Sequelize[_0xf13f('0x3')]},'leaveAt':{'type':Sequelize[_0xf13f('0x3')]},'acceptAt':{'type':Sequelize[_0xf13f('0x3')]},'exitAt':{'type':Sequelize[_0xf13f('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 4223cd7..a70455e 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 _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x222d2d,_0x56fc0c){var _0x2ccf8c=function(_0x3fe8ff){while(--_0x3fe8ff){_0x222d2d['push'](_0x222d2d['shift']());}};_0x2ccf8c(++_0x56fc0c);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['FaxQueueReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['FaxQueueReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _0x18e0=['filter','where','VIRTUAL','includeAll','include','findAll','rows','show','merge','options','find','create','body','params','catch','describe','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3017af,_0x2a9c7d){var _0x10dcff=function(_0x44d897){while(--_0x44d897){_0x3017af['push'](_0x3017af['shift']());}};_0x10dcff(++_0x2a9c7d);}(_0x18e0,0xa2));var _0x018e=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x18e0[_0xbd08b4];return _0x314f1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x018e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x018e('0x1'));var rp=require(_0x018e('0x2'));var moment=require(_0x018e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x018e('0x4'));var util=require('util');var path=require('path');var sox=require(_0x018e('0x5'));var csv=require(_0x018e('0x6'));var ejs=require(_0x018e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x018e('0x8'));var crypto=require(_0x018e('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x018e('0xa'));var toCsv=require(_0x018e('0x6'));var querystring=require(_0x018e('0xb'));var Papa=require(_0x018e('0xc'));var Redis=require(_0x018e('0xd'));var authService=require(_0x018e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x018e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x018e('0x10'));var config=require(_0x018e('0x11'));var licenseUtil=require(_0x018e('0x12'));var db=require(_0x018e('0x13'))['db'];function respondWithStatusCode(_0x167572,_0xd16776){_0xd16776=_0xd16776||0xcc;return function(_0xc940bb){if(_0xc940bb){return _0x167572[_0x018e('0x14')](_0xd16776);}return _0x167572[_0x018e('0x15')](_0xd16776)['end']();};}function respondWithResult(_0xec531a,_0x3b1e5e){_0x3b1e5e=_0x3b1e5e||0xc8;return function(_0x2d6aa0){if(_0x2d6aa0){return _0xec531a[_0x018e('0x15')](_0x3b1e5e)[_0x018e('0x16')](_0x2d6aa0);}};}function respondWithFilteredResult(_0x5bfd6e,_0x275c21){return function(_0x142f1e){if(_0x142f1e){var _0x41cbd8=typeof _0x275c21[_0x018e('0x17')]==='undefined'&&typeof _0x275c21[_0x018e('0x18')]===_0x018e('0x19');var _0x4d46aa=_0x142f1e[_0x018e('0x1a')];var _0x237ba1=_0x41cbd8?0x0:_0x275c21[_0x018e('0x17')];var _0xdf15f8=_0x41cbd8?_0x142f1e[_0x018e('0x1a')]:_0x275c21['offset']+_0x275c21[_0x018e('0x18')];var _0x421942;if(_0xdf15f8>=_0x4d46aa){_0xdf15f8=_0x4d46aa;_0x421942=0xc8;}else{_0x421942=0xce;}_0x5bfd6e[_0x018e('0x15')](_0x421942);return _0x5bfd6e[_0x018e('0x1b')](_0x018e('0x1c'),_0x237ba1+'-'+_0xdf15f8+'/'+_0x4d46aa)[_0x018e('0x16')](_0x142f1e);}return null;};}function patchUpdates(_0x15c3fa){return function(_0x4f59e7){try{jsonpatch[_0x018e('0x1d')](_0x4f59e7,_0x15c3fa,!![]);}catch(_0x213989){return BPromise[_0x018e('0x1e')](_0x213989);}return _0x4f59e7[_0x018e('0x1f')]();};}function saveUpdates(_0x23ef86,_0x5d9fef){return function(_0x5cffe9){if(_0x5cffe9){return _0x5cffe9[_0x018e('0x20')](_0x23ef86)[_0x018e('0x21')](function(_0x2c813e){return _0x2c813e;});}return null;};}function removeEntity(_0x1e3106,_0x2ef801){return function(_0x198b0b){if(_0x198b0b){return _0x198b0b[_0x018e('0x22')]()[_0x018e('0x21')](function(){_0x1e3106[_0x018e('0x15')](0xcc)[_0x018e('0x23')]();});}};}function handleEntityNotFound(_0x35f9a3,_0x7596f4){return function(_0x4e7d9a){if(!_0x4e7d9a){_0x35f9a3[_0x018e('0x14')](0x194);}return _0x4e7d9a;};}function handleError(_0x289931,_0x176822){_0x176822=_0x176822||0x1f4;return function(_0x344e2b){logger[_0x018e('0x24')](_0x344e2b[_0x018e('0x25')]);if(_0x344e2b[_0x018e('0x26')]){delete _0x344e2b[_0x018e('0x26')];}_0x289931[_0x018e('0x15')](_0x176822)[_0x018e('0x27')](_0x344e2b);};}exports['index']=function(_0x29455a,_0x1a4726){var _0x4af339={},_0xac43bc={},_0x2ebdfa={'count':0x0,'rows':[]};var _0x471e30=_[_0x018e('0x28')](db[_0x018e('0x29')][_0x018e('0x2a')],function(_0x47af9d){return{'name':_0x47af9d[_0x018e('0x2b')],'type':_0x47af9d[_0x018e('0x2c')]['key']};});_0xac43bc[_0x018e('0x2d')]=_[_0x018e('0x28')](_0x471e30,_0x018e('0x26'));_0xac43bc[_0x018e('0x2e')]=_[_0x018e('0x2f')](_0x29455a['query']);_0xac43bc[_0x018e('0x30')]=_[_0x018e('0x31')](_0xac43bc[_0x018e('0x2d')],_0xac43bc['query']);_0x4af339[_0x018e('0x32')]=_['intersection'](_0xac43bc[_0x018e('0x2d')],qs[_0x018e('0x33')](_0x29455a['query']['fields']));_0x4af339[_0x018e('0x32')]=_0x4af339[_0x018e('0x32')][_0x018e('0x34')]?_0x4af339[_0x018e('0x32')]:_0xac43bc[_0x018e('0x2d')];if(!_0x29455a['query'][_0x018e('0x35')](_0x018e('0x36'))){_0x4af339[_0x018e('0x18')]=qs['limit'](_0x29455a['query'][_0x018e('0x18')]);_0x4af339[_0x018e('0x17')]=qs[_0x018e('0x17')](_0x29455a[_0x018e('0x2e')][_0x018e('0x17')]);}_0x4af339[_0x018e('0x37')]=qs['sort'](_0x29455a[_0x018e('0x2e')][_0x018e('0x38')]);_0x4af339['where']=qs['filters'](_['pick'](_0x29455a[_0x018e('0x2e')],_0xac43bc[_0x018e('0x30')]),_0x471e30);if(_0x29455a[_0x018e('0x2e')][_0x018e('0x39')]){_0x4af339[_0x018e('0x3a')]=_['merge'](_0x4af339[_0x018e('0x3a')],{'$or':_['map'](_0x471e30,function(_0xcaf318){if(_0xcaf318[_0x018e('0x2c')]!==_0x018e('0x3b')){var _0x2e792d={};_0x2e792d[_0xcaf318['name']]={'$like':'%'+_0x29455a[_0x018e('0x2e')][_0x018e('0x39')]+'%'};return _0x2e792d;}})});}_0x4af339=_['merge']({},_0x4af339,_0x29455a['options']);var _0x22f0c7={'where':_0x4af339['where']};return db[_0x018e('0x29')][_0x018e('0x1a')](_0x22f0c7)['then'](function(_0xc4cdf7){_0x2ebdfa[_0x018e('0x1a')]=_0xc4cdf7;if(_0x29455a[_0x018e('0x2e')][_0x018e('0x3c')]){_0x4af339[_0x018e('0x3d')]=[{'all':!![]}];}return db[_0x018e('0x29')][_0x018e('0x3e')](_0x4af339);})[_0x018e('0x21')](function(_0x4b0b9b){_0x2ebdfa[_0x018e('0x3f')]=_0x4b0b9b;return _0x2ebdfa;})[_0x018e('0x21')](respondWithFilteredResult(_0x1a4726,_0x4af339))['catch'](handleError(_0x1a4726,null));};exports[_0x018e('0x40')]=function(_0x40d098,_0x239d09){var _0x17b11a={'raw':!![],'where':{'id':_0x40d098['params']['id']}},_0x34bfec={};_0x34bfec[_0x018e('0x2d')]=_['keys'](db[_0x018e('0x29')][_0x018e('0x2a')]);_0x34bfec[_0x018e('0x2e')]=_[_0x018e('0x2f')](_0x40d098['query']);_0x34bfec[_0x018e('0x30')]=_[_0x018e('0x31')](_0x34bfec['model'],_0x34bfec[_0x018e('0x2e')]);_0x17b11a[_0x018e('0x32')]=_[_0x018e('0x31')](_0x34bfec[_0x018e('0x2d')],qs[_0x018e('0x33')](_0x40d098[_0x018e('0x2e')]['fields']));_0x17b11a[_0x018e('0x32')]=_0x17b11a[_0x018e('0x32')]['length']?_0x17b11a[_0x018e('0x32')]:_0x34bfec[_0x018e('0x2d')];if(_0x40d098[_0x018e('0x2e')][_0x018e('0x3c')]){_0x17b11a[_0x018e('0x3d')]=[{'all':!![]}];}_0x17b11a=_[_0x018e('0x41')]({},_0x17b11a,_0x40d098[_0x018e('0x42')]);return db[_0x018e('0x29')][_0x018e('0x43')](_0x17b11a)[_0x018e('0x21')](handleEntityNotFound(_0x239d09,null))[_0x018e('0x21')](respondWithResult(_0x239d09,null))['catch'](handleError(_0x239d09,null));};exports[_0x018e('0x44')]=function(_0x4c982e,_0x45f567){return db[_0x018e('0x29')]['create'](_0x4c982e['body'],{})[_0x018e('0x21')](respondWithResult(_0x45f567,0xc9))['catch'](handleError(_0x45f567,null));};exports['update']=function(_0x4f1df6,_0x3e26b1){if(_0x4f1df6[_0x018e('0x45')]['id']){delete _0x4f1df6[_0x018e('0x45')]['id'];}return db[_0x018e('0x29')]['find']({'where':{'id':_0x4f1df6[_0x018e('0x46')]['id']}})[_0x018e('0x21')](handleEntityNotFound(_0x3e26b1,null))[_0x018e('0x21')](saveUpdates(_0x4f1df6[_0x018e('0x45')],null))[_0x018e('0x21')](respondWithResult(_0x3e26b1,null))[_0x018e('0x47')](handleError(_0x3e26b1,null));};exports[_0x018e('0x22')]=function(_0x1e8929,_0x4d2a9c){return db[_0x018e('0x29')][_0x018e('0x43')]({'where':{'id':_0x1e8929[_0x018e('0x46')]['id']}})[_0x018e('0x21')](handleEntityNotFound(_0x4d2a9c,null))['then'](removeEntity(_0x4d2a9c,null))[_0x018e('0x47')](handleError(_0x4d2a9c,null));};exports[_0x018e('0x48')]=function(_0x301aa8,_0x500b05){return db[_0x018e('0x29')][_0x018e('0x48')]()['then'](respondWithResult(_0x500b05,null))[_0x018e('0x47')](handleError(_0x500b05,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 6a76e8c..0244009 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x52d16a,_0x444b84){var _0x1f57ff=function(_0x3cc1f4){while(--_0x3cc1f4){_0x52d16a['push'](_0x52d16a['shift']());}};_0x1f57ff(++_0x444b84);}(_0x4975,0x86));var _0x5497=function(_0x5ec7b0,_0x2fb0b4){_0x5ec7b0=_0x5ec7b0-0x0;var _0x395ce4=_0x4975[_0x5ec7b0];return _0x395ce4;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x31ab84,_0x2b5210){var _0x3a674a=function(_0x4bd3ba){while(--_0x4bd3ba){_0x31ab84['push'](_0x31ab84['shift']());}};_0x3a674a(++_0x2b5210);}(_0x53ec,0x192));var _0xc53e=function(_0xdfb29a,_0x3443b5){_0xdfb29a=_0xdfb29a-0x0;var _0x52f21e=_0x53ec[_0xdfb29a];return _0x52f21e;};'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 diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 05571f6..192e89e 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 _0x6042=['FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','UpdateFaxQueueReport','update','where','attributes','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x38bbed,_0x1c44ee){var _0x30a8e7=function(_0x402fb3){while(--_0x402fb3){_0x38bbed['push'](_0x38bbed['shift']());}};_0x30a8e7(++_0x1c44ee);}(_0x6042,0x188));var _0x2604=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6042[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2604('0x0'));var util=require('util');var moment=require(_0x2604('0x1'));var BPromise=require('bluebird');var rs=require(_0x2604('0x2'));var fs=require('fs');var Redis=require(_0x2604('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2604('0x4'));var logger=require(_0x2604('0x5'))(_0x2604('0x6'));var config=require(_0x2604('0x7'));var jayson=require(_0x2604('0x8'));var client=jayson[_0x2604('0x9')][_0x2604('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b2266,_0x33bf75,_0x56e040){return new BPromise(function(_0x59d779,_0x449f2b){return client[_0x2604('0xb')](_0x2b2266,_0x56e040)['then'](function(_0x3effc9){logger[_0x2604('0xc')](_0x2604('0xd'),_0x33bf75,_0x2604('0xe'));logger[_0x2604('0xf')](_0x2604('0x10'),_0x33bf75,_0x2604('0xe'),JSON[_0x2604('0x11')](_0x3effc9));if(_0x3effc9[_0x2604('0x12')]){if(_0x3effc9[_0x2604('0x12')][_0x2604('0x13')]===0x1f4){logger[_0x2604('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x33bf75,_0x3effc9[_0x2604('0x12')]['message']);return _0x449f2b(_0x3effc9[_0x2604('0x12')]['message']);}logger[_0x2604('0x12')](_0x2604('0xd'),_0x33bf75,_0x3effc9[_0x2604('0x12')][_0x2604('0x14')]);return _0x59d779(_0x3effc9[_0x2604('0x12')][_0x2604('0x14')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x33bf75,_0x2604('0xe'));_0x59d779(_0x3effc9[_0x2604('0x15')][_0x2604('0x14')]);}})[_0x2604('0x16')](function(_0x4b76c4){logger[_0x2604('0x12')](_0x2604('0xd'),_0x33bf75,_0x4b76c4);_0x449f2b(_0x4b76c4);});});}exports[_0x2604('0x17')]=function(_0xe5ca33){var _0x38b78e=this;return new Promise(function(_0x5f2f86,_0x547caa){return db[_0x2604('0x18')][_0x2604('0x19')](_0xe5ca33[_0x2604('0x1a')],{'raw':_0xe5ca33[_0x2604('0x1b')]?_0xe5ca33[_0x2604('0x1b')][_0x2604('0x1c')]===undefined?!![]:![]:!![]})[_0x2604('0x1d')](function(_0xbbc32c){logger[_0x2604('0xc')](_0x2604('0x17'),_0xe5ca33);logger[_0x2604('0xf')](_0x2604('0x17'),_0xe5ca33,JSON[_0x2604('0x11')](_0xbbc32c));_0x5f2f86(_0xbbc32c);})[_0x2604('0x16')](function(_0x16100e){logger[_0x2604('0x12')](_0x2604('0x17'),_0x16100e['message'],_0xe5ca33);_0x547caa(_0x38b78e[_0x2604('0x12')](0x1f4,_0x16100e['message']));});});};exports[_0x2604('0x1e')]=function(_0x55589d){var _0x4c252e=this;return new Promise(function(_0x37d223,_0x262479){return db['FaxQueueReport'][_0x2604('0x1f')](_0x55589d[_0x2604('0x1a')],{'raw':_0x55589d['options']?_0x55589d[_0x2604('0x1b')][_0x2604('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55589d['options']?_0x55589d['options'][_0x2604('0x20')]||null:null,'attributes':_0x55589d[_0x2604('0x1b')]?_0x55589d[_0x2604('0x1b')][_0x2604('0x21')]||null:null,'limit':_0x55589d['options']?_0x55589d['options']['limit']||null:null})['then'](function(_0x337299){logger[_0x2604('0xc')](_0x2604('0x1e'),_0x55589d);logger[_0x2604('0xf')](_0x2604('0x1e'),_0x55589d,JSON[_0x2604('0x11')](_0x337299));_0x37d223(_0x337299);})[_0x2604('0x16')](function(_0xfbf1ce){logger[_0x2604('0x12')](_0x2604('0x1e'),_0xfbf1ce[_0x2604('0x14')],_0x55589d);_0x262479(_0x4c252e[_0x2604('0x12')](0x1f4,_0xfbf1ce[_0x2604('0x14')]));});});}; \ No newline at end of file +var _0xc546=['http','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','create','options','raw','info','body','where','limit','UpdateFaxQueueReport','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5a5c0c,_0x53c8b5){var _0x55fb76=function(_0x28a6e0){while(--_0x28a6e0){_0x5a5c0c['push'](_0x5a5c0c['shift']());}};_0x55fb76(++_0x53c8b5);}(_0xc546,0x1d0));var _0x6c54=function(_0x138d9c,_0x25fbbc){_0x138d9c=_0x138d9c-0x0;var _0x3c19f5=_0xc546[_0x138d9c];return _0x3c19f5;};'use strict';var _=require(_0x6c54('0x0'));var util=require(_0x6c54('0x1'));var moment=require(_0x6c54('0x2'));var BPromise=require(_0x6c54('0x3'));var rs=require(_0x6c54('0x4'));var fs=require('fs');var Redis=require(_0x6c54('0x5'));var db=require(_0x6c54('0x6'))['db'];var utils=require(_0x6c54('0x7'));var logger=require(_0x6c54('0x8'))(_0x6c54('0x9'));var config=require(_0x6c54('0xa'));var jayson=require(_0x6c54('0xb'));var client=jayson['client'][_0x6c54('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38bcb0,_0x220940,_0x420658){return new BPromise(function(_0x31e244,_0x5660b9){return client['request'](_0x38bcb0,_0x420658)[_0x6c54('0xd')](function(_0x10b8c5){logger['info'](_0x6c54('0xe'),_0x220940,_0x6c54('0xf'));logger[_0x6c54('0x10')](_0x6c54('0x11'),_0x220940,'request\x20sent',JSON['stringify'](_0x10b8c5));if(_0x10b8c5['error']){if(_0x10b8c5[_0x6c54('0x12')][_0x6c54('0x13')]===0x1f4){logger[_0x6c54('0x12')](_0x6c54('0xe'),_0x220940,_0x10b8c5[_0x6c54('0x12')]['message']);return _0x5660b9(_0x10b8c5[_0x6c54('0x12')][_0x6c54('0x14')]);}logger['error'](_0x6c54('0xe'),_0x220940,_0x10b8c5['error'][_0x6c54('0x14')]);return _0x31e244(_0x10b8c5[_0x6c54('0x12')][_0x6c54('0x14')]);}else{logger['info'](_0x6c54('0xe'),_0x220940,'request\x20sent');_0x31e244(_0x10b8c5[_0x6c54('0x15')][_0x6c54('0x14')]);}})['catch'](function(_0x32525a){logger[_0x6c54('0x12')](_0x6c54('0xe'),_0x220940,_0x32525a);_0x5660b9(_0x32525a);});});}exports[_0x6c54('0x16')]=function(_0x27af33){var _0x22b0a8=this;return new Promise(function(_0x14e675,_0x1bce9e){return db[_0x6c54('0x17')][_0x6c54('0x18')](_0x27af33['body'],{'raw':_0x27af33[_0x6c54('0x19')]?_0x27af33['options'][_0x6c54('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x32eea7){logger[_0x6c54('0x1b')](_0x6c54('0x16'),_0x27af33);logger[_0x6c54('0x10')](_0x6c54('0x16'),_0x27af33,JSON['stringify'](_0x32eea7));_0x14e675(_0x32eea7);})['catch'](function(_0xe9680a){logger[_0x6c54('0x12')](_0x6c54('0x16'),_0xe9680a[_0x6c54('0x14')],_0x27af33);_0x1bce9e(_0x22b0a8[_0x6c54('0x12')](0x1f4,_0xe9680a[_0x6c54('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x59ebf6){var _0xfb994b=this;return new Promise(function(_0x583247,_0xce693d){return db[_0x6c54('0x17')]['update'](_0x59ebf6[_0x6c54('0x1c')],{'raw':_0x59ebf6[_0x6c54('0x19')]?_0x59ebf6[_0x6c54('0x19')][_0x6c54('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59ebf6[_0x6c54('0x19')]?_0x59ebf6['options'][_0x6c54('0x1d')]||null:null,'attributes':_0x59ebf6['options']?_0x59ebf6[_0x6c54('0x19')]['attributes']||null:null,'limit':_0x59ebf6[_0x6c54('0x19')]?_0x59ebf6[_0x6c54('0x19')][_0x6c54('0x1e')]||null:null})[_0x6c54('0xd')](function(_0x2598a7){logger['info'](_0x6c54('0x1f'),_0x59ebf6);logger[_0x6c54('0x10')](_0x6c54('0x1f'),_0x59ebf6,JSON[_0x6c54('0x20')](_0x2598a7));_0x583247(_0x2598a7);})[_0x6c54('0x21')](function(_0xfb209f){logger[_0x6c54('0x12')](_0x6c54('0x1f'),_0xfb209f[_0x6c54('0x14')],_0x59ebf6);_0xce693d(_0xfb994b[_0x6c54('0x12')](0x1f4,_0xfb209f['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 30b917a..78bdc98 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 _0xc02e=['/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxQueueReport.controller','get','/describe','isAuthenticated','describe'];(function(_0x200cbf,_0x5d347d){var _0x4e2835=function(_0x335f5c){while(--_0x335f5c){_0x200cbf['push'](_0x200cbf['shift']());}};_0x4e2835(++_0x5d347d);}(_0xc02e,0x119));var _0xec02=function(_0x4b2a90,_0xba32e6){_0x4b2a90=_0x4b2a90-0x0;var _0x1cea31=_0xc02e[_0x4b2a90];return _0x1cea31;};'use strict';var multer=require(_0xec02('0x0'));var util=require(_0xec02('0x1'));var path=require(_0xec02('0x2'));var timeout=require(_0xec02('0x3'));var express=require(_0xec02('0x4'));var router=express[_0xec02('0x5')]();var fs_extra=require(_0xec02('0x6'));var auth=require(_0xec02('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xec02('0x8'));router[_0xec02('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xec02('0x9')](_0xec02('0xa'),auth[_0xec02('0xb')](),controller[_0xec02('0xc')]);router[_0xec02('0x9')](_0xec02('0xd'),auth[_0xec02('0xb')](),controller[_0xec02('0xe')]);router[_0xec02('0xf')]('/',auth[_0xec02('0xb')](),controller[_0xec02('0x10')]);router[_0xec02('0x11')](_0xec02('0xd'),auth[_0xec02('0xb')](),controller[_0xec02('0x12')]);router[_0xec02('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xec02('0x14')]=router; \ No newline at end of file +var _0x5d7b=['isAuthenticated','index','/describe','describe','/:id','show','post','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get'];(function(_0x424d82,_0x594352){var _0x3451d7=function(_0x560563){while(--_0x560563){_0x424d82['push'](_0x424d82['shift']());}};_0x3451d7(++_0x594352);}(_0x5d7b,0x1c2));var _0xb5d7=function(_0x2a0765,_0x3ae964){_0x2a0765=_0x2a0765-0x0;var _0x547461=_0x5d7b[_0x2a0765];return _0x547461;};'use strict';var multer=require(_0xb5d7('0x0'));var util=require(_0xb5d7('0x1'));var path=require(_0xb5d7('0x2'));var timeout=require(_0xb5d7('0x3'));var express=require('express');var router=express[_0xb5d7('0x4')]();var fs_extra=require(_0xb5d7('0x5'));var auth=require(_0xb5d7('0x6'));var interaction=require(_0xb5d7('0x7'));var config=require('../../config/environment');var controller=require(_0xb5d7('0x8'));router[_0xb5d7('0x9')]('/',auth[_0xb5d7('0xa')](),controller[_0xb5d7('0xb')]);router[_0xb5d7('0x9')](_0xb5d7('0xc'),auth[_0xb5d7('0xa')](),controller[_0xb5d7('0xd')]);router[_0xb5d7('0x9')](_0xb5d7('0xe'),auth['isAuthenticated'](),controller[_0xb5d7('0xf')]);router[_0xb5d7('0x10')]('/',auth[_0xb5d7('0xa')](),controller['create']);router[_0xb5d7('0x11')](_0xb5d7('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xb5d7('0xe'),auth[_0xb5d7('0xa')](),controller[_0xb5d7('0x12')]);module[_0xb5d7('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 86c7abf..32af38a 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x703acb,_0x1a182b){var _0x22a40e=function(_0x5c8bd2){while(--_0x5c8bd2){_0x703acb['push'](_0x703acb['shift']());}};_0x22a40e(++_0x1a182b);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x00bb[_0x4709c0];return _0x13348b;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x5f3d6c,_0x2a7be6){var _0x38fdd5=function(_0x5eab6d){while(--_0x5eab6d){_0x5f3d6c['push'](_0x5f3d6c['shift']());}};_0x38fdd5(++_0x2a7be6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0xcb91[_0x3d4ef1];return _0x409423;};'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 diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 2a848da..740c76a 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 _0x6825=['apply','reject','update','then','destroy','end','error','stack','name','send','index','FaxTransferReport','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x3af172,_0x5663f3){var _0x4594f7=function(_0x545638){while(--_0x545638){_0x3af172['push'](_0x3af172['shift']());}};_0x4594f7(++_0x5663f3);}(_0x6825,0xc2));var _0x5682=function(_0x4e45e0,_0x38edea){_0x4e45e0=_0x4e45e0-0x0;var _0x4ed503=_0x6825[_0x4e45e0];return _0x4ed503;};'use strict';var emlformat=require(_0x5682('0x0'));var rimraf=require(_0x5682('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5682('0x2'));var BPromise=require(_0x5682('0x3'));var Mustache=require(_0x5682('0x4'));var util=require(_0x5682('0x5'));var path=require(_0x5682('0x6'));var sox=require(_0x5682('0x7'));var csv=require(_0x5682('0x8'));var ejs=require(_0x5682('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5682('0xa'));var squel=require(_0x5682('0xb'));var crypto=require('crypto');var jsforce=require(_0x5682('0xc'));var deskjs=require(_0x5682('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5682('0xe'));var Redis=require(_0x5682('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5682('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5682('0x11'));var logger=require(_0x5682('0x12'))('api');var utils=require(_0x5682('0x13'));var config=require(_0x5682('0x14'));var licenseUtil=require(_0x5682('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2aeb59,_0x3f0985){_0x3f0985=_0x3f0985||0xcc;return function(_0x4f46b8){if(_0x4f46b8){return _0x2aeb59[_0x5682('0x16')](_0x3f0985);}return _0x2aeb59[_0x5682('0x17')](_0x3f0985)['end']();};}function respondWithResult(_0x443423,_0x51a9e8){_0x51a9e8=_0x51a9e8||0xc8;return function(_0x3093b8){if(_0x3093b8){return _0x443423['status'](_0x51a9e8)[_0x5682('0x18')](_0x3093b8);}};}function respondWithFilteredResult(_0x41225c,_0x1f823a){return function(_0x3008b8){if(_0x3008b8){var _0x10e622=typeof _0x1f823a[_0x5682('0x19')]===_0x5682('0x1a')&&typeof _0x1f823a['limit']===_0x5682('0x1a');var _0x245e50=_0x3008b8[_0x5682('0x1b')];var _0x4f74ae=_0x10e622?0x0:_0x1f823a['offset'];var _0x35ccd9=_0x10e622?_0x3008b8['count']:_0x1f823a[_0x5682('0x19')]+_0x1f823a[_0x5682('0x1c')];var _0x13d55c;if(_0x35ccd9>=_0x245e50){_0x35ccd9=_0x245e50;_0x13d55c=0xc8;}else{_0x13d55c=0xce;}_0x41225c[_0x5682('0x17')](_0x13d55c);return _0x41225c[_0x5682('0x1d')](_0x5682('0x1e'),_0x4f74ae+'-'+_0x35ccd9+'/'+_0x245e50)[_0x5682('0x18')](_0x3008b8);}return null;};}function patchUpdates(_0x3b5c57){return function(_0x4af1b9){try{jsonpatch[_0x5682('0x1f')](_0x4af1b9,_0x3b5c57,!![]);}catch(_0x45a3da){return BPromise[_0x5682('0x20')](_0x45a3da);}return _0x4af1b9['save']();};}function saveUpdates(_0x3ea718,_0x1cca92){return function(_0xf38fbf){if(_0xf38fbf){return _0xf38fbf[_0x5682('0x21')](_0x3ea718)[_0x5682('0x22')](function(_0x5154de){return _0x5154de;});}return null;};}function removeEntity(_0x5ac485,_0x859ec9){return function(_0xce4a41){if(_0xce4a41){return _0xce4a41[_0x5682('0x23')]()[_0x5682('0x22')](function(){_0x5ac485[_0x5682('0x17')](0xcc)[_0x5682('0x24')]();});}};}function handleEntityNotFound(_0x29d5df,_0x21311f){return function(_0xae34){if(!_0xae34){_0x29d5df[_0x5682('0x16')](0x194);}return _0xae34;};}function handleError(_0x3c8471,_0x5c87b9){_0x5c87b9=_0x5c87b9||0x1f4;return function(_0x2ac024){logger[_0x5682('0x25')](_0x2ac024[_0x5682('0x26')]);if(_0x2ac024[_0x5682('0x27')]){delete _0x2ac024[_0x5682('0x27')];}_0x3c8471['status'](_0x5c87b9)[_0x5682('0x28')](_0x2ac024);};}exports[_0x5682('0x29')]=function(_0x1b3e37,_0x5f22ff){var _0x35b097={},_0x42f542={},_0x5c7f69={'count':0x0,'rows':[]};var _0x2f0ead=_['map'](db[_0x5682('0x2a')]['rawAttributes'],function(_0x39fe93){return{'name':_0x39fe93['fieldName'],'type':_0x39fe93['type'][_0x5682('0x2b')]};});_0x42f542[_0x5682('0x2c')]=_[_0x5682('0x2d')](_0x2f0ead,'name');_0x42f542[_0x5682('0x2e')]=_['keys'](_0x1b3e37[_0x5682('0x2e')]);_0x42f542[_0x5682('0x2f')]=_[_0x5682('0x30')](_0x42f542[_0x5682('0x2c')],_0x42f542[_0x5682('0x2e')]);_0x35b097[_0x5682('0x31')]=_[_0x5682('0x30')](_0x42f542[_0x5682('0x2c')],qs['fields'](_0x1b3e37[_0x5682('0x2e')][_0x5682('0x32')]));_0x35b097[_0x5682('0x31')]=_0x35b097[_0x5682('0x31')][_0x5682('0x33')]?_0x35b097['attributes']:_0x42f542[_0x5682('0x2c')];if(!_0x1b3e37['query'][_0x5682('0x34')](_0x5682('0x35'))){_0x35b097[_0x5682('0x1c')]=qs[_0x5682('0x1c')](_0x1b3e37[_0x5682('0x2e')][_0x5682('0x1c')]);_0x35b097[_0x5682('0x19')]=qs[_0x5682('0x19')](_0x1b3e37[_0x5682('0x2e')]['offset']);}_0x35b097[_0x5682('0x36')]=qs[_0x5682('0x37')](_0x1b3e37[_0x5682('0x2e')][_0x5682('0x37')]);_0x35b097[_0x5682('0x38')]=qs[_0x5682('0x2f')](_[_0x5682('0x39')](_0x1b3e37[_0x5682('0x2e')],_0x42f542['filters']),_0x2f0ead);if(_0x1b3e37[_0x5682('0x2e')][_0x5682('0x3a')]){_0x35b097['where']=_[_0x5682('0x3b')](_0x35b097[_0x5682('0x38')],{'$or':_[_0x5682('0x2d')](_0x2f0ead,function(_0x31df5d){if(_0x31df5d['type']!==_0x5682('0x3c')){var _0x3cf20e={};_0x3cf20e[_0x31df5d['name']]={'$like':'%'+_0x1b3e37[_0x5682('0x2e')]['filter']+'%'};return _0x3cf20e;}})});}_0x35b097=_[_0x5682('0x3b')]({},_0x35b097,_0x1b3e37[_0x5682('0x3d')]);var _0x142a20={'where':_0x35b097[_0x5682('0x38')]};return db[_0x5682('0x2a')][_0x5682('0x1b')](_0x142a20)[_0x5682('0x22')](function(_0x33f457){_0x5c7f69[_0x5682('0x1b')]=_0x33f457;if(_0x1b3e37[_0x5682('0x2e')]['includeAll']){_0x35b097[_0x5682('0x3e')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x5682('0x3f')](_0x35b097);})[_0x5682('0x22')](function(_0x1828df){_0x5c7f69[_0x5682('0x40')]=_0x1828df;return _0x5c7f69;})[_0x5682('0x22')](respondWithFilteredResult(_0x5f22ff,_0x35b097))[_0x5682('0x41')](handleError(_0x5f22ff,null));};exports[_0x5682('0x42')]=function(_0x4e0b26,_0x5013a1){var _0x3c6dc1={'raw':!![],'where':{'id':_0x4e0b26[_0x5682('0x43')]['id']}},_0x5cb161={};_0x5cb161[_0x5682('0x2c')]=_[_0x5682('0x44')](db['FaxTransferReport'][_0x5682('0x45')]);_0x5cb161['query']=_[_0x5682('0x44')](_0x4e0b26[_0x5682('0x2e')]);_0x5cb161['filters']=_['intersection'](_0x5cb161[_0x5682('0x2c')],_0x5cb161['query']);_0x3c6dc1[_0x5682('0x31')]=_[_0x5682('0x30')](_0x5cb161[_0x5682('0x2c')],qs[_0x5682('0x32')](_0x4e0b26[_0x5682('0x2e')]['fields']));_0x3c6dc1[_0x5682('0x31')]=_0x3c6dc1[_0x5682('0x31')][_0x5682('0x33')]?_0x3c6dc1[_0x5682('0x31')]:_0x5cb161[_0x5682('0x2c')];if(_0x4e0b26['query'][_0x5682('0x46')]){_0x3c6dc1[_0x5682('0x3e')]=[{'all':!![]}];}_0x3c6dc1=_['merge']({},_0x3c6dc1,_0x4e0b26[_0x5682('0x3d')]);return db['FaxTransferReport'][_0x5682('0x47')](_0x3c6dc1)['then'](handleEntityNotFound(_0x5013a1,null))[_0x5682('0x22')](respondWithResult(_0x5013a1,null))[_0x5682('0x41')](handleError(_0x5013a1,null));};exports[_0x5682('0x48')]=function(_0x559ffc,_0x5bbe80){return db[_0x5682('0x2a')][_0x5682('0x48')](_0x559ffc[_0x5682('0x49')],{})[_0x5682('0x22')](respondWithResult(_0x5bbe80,0xc9))['catch'](handleError(_0x5bbe80,null));};exports[_0x5682('0x21')]=function(_0x353d74,_0x5124d6){if(_0x353d74[_0x5682('0x49')]['id']){delete _0x353d74[_0x5682('0x49')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x353d74[_0x5682('0x43')]['id']}})[_0x5682('0x22')](handleEntityNotFound(_0x5124d6,null))[_0x5682('0x22')](saveUpdates(_0x353d74[_0x5682('0x49')],null))['then'](respondWithResult(_0x5124d6,null))[_0x5682('0x41')](handleError(_0x5124d6,null));};exports[_0x5682('0x23')]=function(_0xb6bc3d,_0x53c3ec){return db[_0x5682('0x2a')]['find']({'where':{'id':_0xb6bc3d[_0x5682('0x43')]['id']}})[_0x5682('0x22')](handleEntityNotFound(_0x53c3ec,null))[_0x5682('0x22')](removeEntity(_0x53c3ec,null))[_0x5682('0x41')](handleError(_0x53c3ec,null));};exports['describe']=function(_0x26e2a3,_0x3772d1){return db[_0x5682('0x2a')][_0x5682('0x4a')]()[_0x5682('0x22')](respondWithResult(_0x3772d1,null))['catch'](handleError(_0x3772d1,null));}; \ No newline at end of file +var _0x63b8=['map','FaxTransferReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','find','create','body','catch','update','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','save','then','destroy','error','name','index'];(function(_0x5ad9e8,_0x1aa170){var _0x2352da=function(_0x4d5a25){while(--_0x4d5a25){_0x5ad9e8['push'](_0x5ad9e8['shift']());}};_0x2352da(++_0x1aa170);}(_0x63b8,0xff));var _0x863b=function(_0x297c28,_0x1db7a7){_0x297c28=_0x297c28-0x0;var _0xea6ec2=_0x63b8[_0x297c28];return _0xea6ec2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x863b('0x0'));var jsonpatch=require(_0x863b('0x1'));var rp=require(_0x863b('0x2'));var moment=require(_0x863b('0x3'));var BPromise=require(_0x863b('0x4'));var Mustache=require(_0x863b('0x5'));var util=require(_0x863b('0x6'));var path=require('path');var sox=require(_0x863b('0x7'));var csv=require(_0x863b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x863b('0x9'));var _=require(_0x863b('0xa'));var squel=require('squel');var crypto=require(_0x863b('0xb'));var jsforce=require(_0x863b('0xc'));var deskjs=require(_0x863b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x863b('0xe'));var Papa=require(_0x863b('0xf'));var Redis=require(_0x863b('0x10'));var authService=require(_0x863b('0x11'));var qs=require(_0x863b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x863b('0x13'));var logger=require(_0x863b('0x14'))(_0x863b('0x15'));var utils=require(_0x863b('0x16'));var config=require(_0x863b('0x17'));var licenseUtil=require(_0x863b('0x18'));var db=require(_0x863b('0x19'))['db'];function respondWithStatusCode(_0x14ea87,_0x1fd16d){_0x1fd16d=_0x1fd16d||0xcc;return function(_0x2a7260){if(_0x2a7260){return _0x14ea87[_0x863b('0x1a')](_0x1fd16d);}return _0x14ea87[_0x863b('0x1b')](_0x1fd16d)[_0x863b('0x1c')]();};}function respondWithResult(_0x5de334,_0x178ac4){_0x178ac4=_0x178ac4||0xc8;return function(_0x2f13e2){if(_0x2f13e2){return _0x5de334['status'](_0x178ac4)[_0x863b('0x1d')](_0x2f13e2);}};}function respondWithFilteredResult(_0xa74153,_0x117a59){return function(_0x1a5ee7){if(_0x1a5ee7){var _0x42f8e0=typeof _0x117a59[_0x863b('0x1e')]===_0x863b('0x1f')&&typeof _0x117a59[_0x863b('0x20')]===_0x863b('0x1f');var _0x280e87=_0x1a5ee7[_0x863b('0x21')];var _0x309c34=_0x42f8e0?0x0:_0x117a59['offset'];var _0x30c5c5=_0x42f8e0?_0x1a5ee7['count']:_0x117a59['offset']+_0x117a59[_0x863b('0x20')];var _0x2ce6c9;if(_0x30c5c5>=_0x280e87){_0x30c5c5=_0x280e87;_0x2ce6c9=0xc8;}else{_0x2ce6c9=0xce;}_0xa74153['status'](_0x2ce6c9);return _0xa74153[_0x863b('0x22')]('Content-Range',_0x309c34+'-'+_0x30c5c5+'/'+_0x280e87)[_0x863b('0x1d')](_0x1a5ee7);}return null;};}function patchUpdates(_0x394e5c){return function(_0x4035d4){try{jsonpatch['apply'](_0x4035d4,_0x394e5c,!![]);}catch(_0x19d1b7){return BPromise['reject'](_0x19d1b7);}return _0x4035d4[_0x863b('0x23')]();};}function saveUpdates(_0x2137e4,_0x57dd3e){return function(_0x235d54){if(_0x235d54){return _0x235d54['update'](_0x2137e4)[_0x863b('0x24')](function(_0x5bfb8b){return _0x5bfb8b;});}return null;};}function removeEntity(_0xf3e236,_0xe6ca27){return function(_0x12da91){if(_0x12da91){return _0x12da91[_0x863b('0x25')]()[_0x863b('0x24')](function(){_0xf3e236['status'](0xcc)[_0x863b('0x1c')]();});}};}function handleEntityNotFound(_0x58b1ed,_0x18cf8b){return function(_0x3fbaf4){if(!_0x3fbaf4){_0x58b1ed[_0x863b('0x1a')](0x194);}return _0x3fbaf4;};}function handleError(_0x4188e4,_0x20a260){_0x20a260=_0x20a260||0x1f4;return function(_0x201967){logger[_0x863b('0x26')](_0x201967['stack']);if(_0x201967[_0x863b('0x27')]){delete _0x201967[_0x863b('0x27')];}_0x4188e4[_0x863b('0x1b')](_0x20a260)['send'](_0x201967);};}exports[_0x863b('0x28')]=function(_0x48a288,_0x2567c8){var _0x4cf6cb={},_0x4deb27={},_0x371502={'count':0x0,'rows':[]};var _0x175b8f=_[_0x863b('0x29')](db[_0x863b('0x2a')]['rawAttributes'],function(_0x10e7af){return{'name':_0x10e7af[_0x863b('0x2b')],'type':_0x10e7af[_0x863b('0x2c')][_0x863b('0x2d')]};});_0x4deb27[_0x863b('0x2e')]=_['map'](_0x175b8f,'name');_0x4deb27[_0x863b('0x2f')]=_[_0x863b('0x30')](_0x48a288['query']);_0x4deb27[_0x863b('0x31')]=_['intersection'](_0x4deb27[_0x863b('0x2e')],_0x4deb27[_0x863b('0x2f')]);_0x4cf6cb[_0x863b('0x32')]=_[_0x863b('0x33')](_0x4deb27['model'],qs[_0x863b('0x34')](_0x48a288[_0x863b('0x2f')]['fields']));_0x4cf6cb['attributes']=_0x4cf6cb[_0x863b('0x32')][_0x863b('0x35')]?_0x4cf6cb[_0x863b('0x32')]:_0x4deb27[_0x863b('0x2e')];if(!_0x48a288[_0x863b('0x2f')]['hasOwnProperty'](_0x863b('0x36'))){_0x4cf6cb[_0x863b('0x20')]=qs[_0x863b('0x20')](_0x48a288['query'][_0x863b('0x20')]);_0x4cf6cb[_0x863b('0x1e')]=qs[_0x863b('0x1e')](_0x48a288[_0x863b('0x2f')][_0x863b('0x1e')]);}_0x4cf6cb['order']=qs[_0x863b('0x37')](_0x48a288[_0x863b('0x2f')][_0x863b('0x37')]);_0x4cf6cb['where']=qs[_0x863b('0x31')](_[_0x863b('0x38')](_0x48a288[_0x863b('0x2f')],_0x4deb27[_0x863b('0x31')]),_0x175b8f);if(_0x48a288[_0x863b('0x2f')]['filter']){_0x4cf6cb[_0x863b('0x39')]=_['merge'](_0x4cf6cb['where'],{'$or':_[_0x863b('0x29')](_0x175b8f,function(_0xe75801){if(_0xe75801[_0x863b('0x2c')]!==_0x863b('0x3a')){var _0x20aa06={};_0x20aa06[_0xe75801[_0x863b('0x27')]]={'$like':'%'+_0x48a288[_0x863b('0x2f')][_0x863b('0x3b')]+'%'};return _0x20aa06;}})});}_0x4cf6cb=_[_0x863b('0x3c')]({},_0x4cf6cb,_0x48a288[_0x863b('0x3d')]);var _0x3140fc={'where':_0x4cf6cb[_0x863b('0x39')]};return db['FaxTransferReport']['count'](_0x3140fc)[_0x863b('0x24')](function(_0x4079e4){_0x371502[_0x863b('0x21')]=_0x4079e4;if(_0x48a288['query'][_0x863b('0x3e')]){_0x4cf6cb[_0x863b('0x3f')]=[{'all':!![]}];}return db[_0x863b('0x2a')][_0x863b('0x40')](_0x4cf6cb);})[_0x863b('0x24')](function(_0x59786e){_0x371502['rows']=_0x59786e;return _0x371502;})['then'](respondWithFilteredResult(_0x2567c8,_0x4cf6cb))['catch'](handleError(_0x2567c8,null));};exports[_0x863b('0x41')]=function(_0x1a2e67,_0x142c63){var _0x35dc6a={'raw':!![],'where':{'id':_0x1a2e67[_0x863b('0x42')]['id']}},_0x3a7fdd={};_0x3a7fdd['model']=_[_0x863b('0x30')](db[_0x863b('0x2a')][_0x863b('0x43')]);_0x3a7fdd[_0x863b('0x2f')]=_[_0x863b('0x30')](_0x1a2e67[_0x863b('0x2f')]);_0x3a7fdd[_0x863b('0x31')]=_[_0x863b('0x33')](_0x3a7fdd[_0x863b('0x2e')],_0x3a7fdd[_0x863b('0x2f')]);_0x35dc6a[_0x863b('0x32')]=_[_0x863b('0x33')](_0x3a7fdd[_0x863b('0x2e')],qs[_0x863b('0x34')](_0x1a2e67[_0x863b('0x2f')]['fields']));_0x35dc6a['attributes']=_0x35dc6a[_0x863b('0x32')][_0x863b('0x35')]?_0x35dc6a[_0x863b('0x32')]:_0x3a7fdd[_0x863b('0x2e')];if(_0x1a2e67[_0x863b('0x2f')][_0x863b('0x3e')]){_0x35dc6a[_0x863b('0x3f')]=[{'all':!![]}];}_0x35dc6a=_[_0x863b('0x3c')]({},_0x35dc6a,_0x1a2e67[_0x863b('0x3d')]);return db['FaxTransferReport'][_0x863b('0x44')](_0x35dc6a)[_0x863b('0x24')](handleEntityNotFound(_0x142c63,null))[_0x863b('0x24')](respondWithResult(_0x142c63,null))['catch'](handleError(_0x142c63,null));};exports['create']=function(_0x119a4f,_0x35d07){return db['FaxTransferReport'][_0x863b('0x45')](_0x119a4f[_0x863b('0x46')],{})[_0x863b('0x24')](respondWithResult(_0x35d07,0xc9))[_0x863b('0x47')](handleError(_0x35d07,null));};exports[_0x863b('0x48')]=function(_0x2195af,_0xa12f2b){if(_0x2195af[_0x863b('0x46')]['id']){delete _0x2195af[_0x863b('0x46')]['id'];}return db[_0x863b('0x2a')][_0x863b('0x44')]({'where':{'id':_0x2195af[_0x863b('0x42')]['id']}})['then'](handleEntityNotFound(_0xa12f2b,null))[_0x863b('0x24')](saveUpdates(_0x2195af[_0x863b('0x46')],null))[_0x863b('0x24')](respondWithResult(_0xa12f2b,null))[_0x863b('0x47')](handleError(_0xa12f2b,null));};exports['destroy']=function(_0x40eca2,_0x5579b8){return db[_0x863b('0x2a')][_0x863b('0x44')]({'where':{'id':_0x40eca2[_0x863b('0x42')]['id']}})[_0x863b('0x24')](handleEntityNotFound(_0x5579b8,null))[_0x863b('0x24')](removeEntity(_0x5579b8,null))['catch'](handleError(_0x5579b8,null));};exports[_0x863b('0x49')]=function(_0x5c1949,_0x195fa5){return db['FaxTransferReport'][_0x863b('0x49')]()[_0x863b('0x24')](respondWithResult(_0x195fa5,null))[_0x863b('0x47')](handleError(_0x195fa5,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index dbe8bac..71decc3 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 _0xd9ee=['exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x201bc7,_0x290b5e){var _0x3108b3=function(_0x24182e){while(--_0x24182e){_0x201bc7['push'](_0x201bc7['shift']());}};_0x3108b3(++_0x290b5e);}(_0xd9ee,0x9f));var _0xed9e=function(_0x405c61,_0x86672e){_0x405c61=_0x405c61-0x0;var _0x3c7c18=_0xd9ee[_0x405c61];return _0x3c7c18;};'use strict';var _=require(_0xed9e('0x0'));var util=require('util');var logger=require(_0xed9e('0x1'))('api');var moment=require(_0xed9e('0x2'));var BPromise=require(_0xed9e('0x3'));var rp=require(_0xed9e('0x4'));var fs=require('fs');var path=require(_0xed9e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0xed9e('0x6')]=function(_0x3a88de,_0x90bf34){return _0x3a88de[_0xed9e('0x7')](_0xed9e('0x8'),attributes,{'tableName':_0xed9e('0x9'),'paranoid':![],'indexes':[{'name':_0xed9e('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c64=['uniqueid','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x2c64,0x181));var _0x42c6=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x2c64[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0x42c6('0x0'));var util=require(_0x42c6('0x1'));var logger=require('../../config/logger')(_0x42c6('0x2'));var moment=require(_0x42c6('0x3'));var BPromise=require(_0x42c6('0x4'));var rp=require(_0x42c6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x42c6('0x6'));var attributes=require(_0x42c6('0x7'));module[_0x42c6('0x8')]=function(_0x56b317,_0x553bd9){return _0x56b317['define'](_0x42c6('0x9'),attributes,{'tableName':_0x42c6('0xa'),'paranoid':![],'indexes':[{'name':_0x42c6('0xb'),'fields':[_0x42c6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 106f0d1..b7ad1b8 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 _0x7225=['error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0x7225,0x13a));var _0x5722=function(_0x1bdd35,_0x36f9fd){_0x1bdd35=_0x1bdd35-0x0;var _0x5b4294=_0x7225[_0x1bdd35];return _0x5b4294;};'use strict';var _=require(_0x5722('0x0'));var util=require('util');var moment=require(_0x5722('0x1'));var BPromise=require('bluebird');var rs=require(_0x5722('0x2'));var fs=require('fs');var Redis=require(_0x5722('0x3'));var db=require(_0x5722('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5722('0x5'))(_0x5722('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5722('0x7')][_0x5722('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53c272,_0x434368,_0x81d2a1){return new BPromise(function(_0x5b1e7c,_0x260fd5){return client[_0x5722('0x9')](_0x53c272,_0x81d2a1)[_0x5722('0xa')](function(_0x554d70){logger['info'](_0x5722('0xb'),_0x434368,_0x5722('0xc'));logger[_0x5722('0xd')](_0x5722('0xe'),_0x434368,_0x5722('0xc'),JSON[_0x5722('0xf')](_0x554d70));if(_0x554d70['error']){if(_0x554d70[_0x5722('0x10')][_0x5722('0x11')]===0x1f4){logger[_0x5722('0x10')](_0x5722('0xb'),_0x434368,_0x554d70['error'][_0x5722('0x12')]);return _0x260fd5(_0x554d70[_0x5722('0x10')][_0x5722('0x12')]);}logger[_0x5722('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x434368,_0x554d70[_0x5722('0x10')][_0x5722('0x12')]);return _0x5b1e7c(_0x554d70[_0x5722('0x10')][_0x5722('0x12')]);}else{logger[_0x5722('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x434368,_0x5722('0xc'));_0x5b1e7c(_0x554d70[_0x5722('0x14')]['message']);}})[_0x5722('0x15')](function(_0x33442f){logger[_0x5722('0x10')](_0x5722('0xb'),_0x434368,_0x33442f);_0x260fd5(_0x33442f);});});} \ No newline at end of file +var _0xebd4=['message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1af4d3,_0x52f783){var _0x117816=function(_0x5946be){while(--_0x5946be){_0x1af4d3['push'](_0x1af4d3['shift']());}};_0x117816(++_0x52f783);}(_0xebd4,0xf2));var _0x4ebd=function(_0x2d36af,_0x48f20a){_0x2d36af=_0x2d36af-0x0;var _0x7b908a=_0xebd4[_0x2d36af];return _0x7b908a;};'use strict';var _=require(_0x4ebd('0x0'));var util=require(_0x4ebd('0x1'));var moment=require(_0x4ebd('0x2'));var BPromise=require(_0x4ebd('0x3'));var rs=require(_0x4ebd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ebd('0x5'))['db'];var utils=require(_0x4ebd('0x6'));var logger=require(_0x4ebd('0x7'))(_0x4ebd('0x8'));var config=require(_0x4ebd('0x9'));var jayson=require(_0x4ebd('0xa'));var client=jayson[_0x4ebd('0xb')][_0x4ebd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x255356,_0x44be26,_0x58c5de){return new BPromise(function(_0x417fbc,_0x50e80f){return client['request'](_0x255356,_0x58c5de)[_0x4ebd('0xd')](function(_0x44c9f6){logger[_0x4ebd('0xe')](_0x4ebd('0xf'),_0x44be26,_0x4ebd('0x10'));logger[_0x4ebd('0x11')](_0x4ebd('0x12'),_0x44be26,_0x4ebd('0x10'),JSON[_0x4ebd('0x13')](_0x44c9f6));if(_0x44c9f6['error']){if(_0x44c9f6[_0x4ebd('0x14')][_0x4ebd('0x15')]===0x1f4){logger[_0x4ebd('0x14')](_0x4ebd('0xf'),_0x44be26,_0x44c9f6[_0x4ebd('0x14')][_0x4ebd('0x16')]);return _0x50e80f(_0x44c9f6[_0x4ebd('0x14')]['message']);}logger[_0x4ebd('0x14')](_0x4ebd('0xf'),_0x44be26,_0x44c9f6[_0x4ebd('0x14')][_0x4ebd('0x16')]);return _0x417fbc(_0x44c9f6[_0x4ebd('0x14')]['message']);}else{logger['info'](_0x4ebd('0xf'),_0x44be26,_0x4ebd('0x10'));_0x417fbc(_0x44c9f6[_0x4ebd('0x17')]['message']);}})['catch'](function(_0x244aa5){logger[_0x4ebd('0x14')](_0x4ebd('0xf'),_0x44be26,_0x244aa5);_0x50e80f(_0x244aa5);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 9e41ee3..e333fc0 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 _0x244e=['get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller'];(function(_0xf6bb6d,_0x39f16b){var _0x586466=function(_0x4eb3c0){while(--_0x4eb3c0){_0xf6bb6d['push'](_0xf6bb6d['shift']());}};_0x586466(++_0x39f16b);}(_0x244e,0x11d));var _0xe244=function(_0x38f75e,_0x1c1ac0){_0x38f75e=_0x38f75e-0x0;var _0x345c5f=_0x244e[_0x38f75e];return _0x345c5f;};'use strict';var multer=require(_0xe244('0x0'));var util=require('util');var path=require(_0xe244('0x1'));var timeout=require(_0xe244('0x2'));var express=require(_0xe244('0x3'));var router=express[_0xe244('0x4')]();var fs_extra=require(_0xe244('0x5'));var auth=require(_0xe244('0x6'));var interaction=require(_0xe244('0x7'));var config=require('../../config/environment');var controller=require(_0xe244('0x8'));router[_0xe244('0x9')]('/',auth[_0xe244('0xa')](),controller['index']);router[_0xe244('0x9')](_0xe244('0xb'),auth[_0xe244('0xa')](),controller[_0xe244('0xc')]);router[_0xe244('0x9')](_0xe244('0xd'),auth['isAuthenticated'](),controller[_0xe244('0xe')]);router['post']('/',auth[_0xe244('0xa')](),controller[_0xe244('0xf')]);router[_0xe244('0x10')](_0xe244('0xd'),auth[_0xe244('0xa')](),controller[_0xe244('0x11')]);router[_0xe244('0x12')](_0xe244('0xd'),auth[_0xe244('0xa')](),controller[_0xe244('0x13')]);module[_0xe244('0x14')]=router; \ No newline at end of file +var _0xb769=['Router','fs-extra','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put','update','exports','util','path','connect-timeout','express'];(function(_0x23282f,_0x197359){var _0x3df2b6=function(_0x21c921){while(--_0x21c921){_0x23282f['push'](_0x23282f['shift']());}};_0x3df2b6(++_0x197359);}(_0xb769,0x10a));var _0x9b76=function(_0x52b735,_0x5ac648){_0x52b735=_0x52b735-0x0;var _0x205572=_0xb769[_0x52b735];return _0x205572;};'use strict';var multer=require('multer');var util=require(_0x9b76('0x0'));var path=require(_0x9b76('0x1'));var timeout=require(_0x9b76('0x2'));var express=require(_0x9b76('0x3'));var router=express[_0x9b76('0x4')]();var fs_extra=require(_0x9b76('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9b76('0x6'));var controller=require(_0x9b76('0x7'));router[_0x9b76('0x8')]('/',auth[_0x9b76('0x9')](),controller[_0x9b76('0xa')]);router[_0x9b76('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x9b76('0xb')]);router['get'](_0x9b76('0xc'),auth[_0x9b76('0x9')](),controller[_0x9b76('0xd')]);router[_0x9b76('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9b76('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x9b76('0x10')]);router['delete'](_0x9b76('0xc'),auth[_0x9b76('0x9')](),controller['destroy']);module[_0x9b76('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 7168d58..5afcc72 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 _0x6c22=['addConfiguration','put','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations'];(function(_0x38d7d5,_0x1af762){var _0x23bc4f=function(_0x2418ee){while(--_0x2418ee){_0x38d7d5['push'](_0x38d7d5['shift']());}};_0x23bc4f(++_0x1af762);}(_0x6c22,0x64));var _0x26c2=function(_0x1c4865,_0x163598){_0x1c4865=_0x1c4865-0x0;var _0x2a3640=_0x6c22[_0x1c4865];return _0x2a3640;};'use strict';var multer=require(_0x26c2('0x0'));var util=require('util');var path=require(_0x26c2('0x1'));var timeout=require(_0x26c2('0x2'));var express=require(_0x26c2('0x3'));var router=express[_0x26c2('0x4')]();var fs_extra=require(_0x26c2('0x5'));var auth=require(_0x26c2('0x6'));var interaction=require(_0x26c2('0x7'));var config=require(_0x26c2('0x8'));var controller=require(_0x26c2('0x9'));router[_0x26c2('0xa')]('/',auth[_0x26c2('0xb')](),controller[_0x26c2('0xc')]);router[_0x26c2('0xa')](_0x26c2('0xd'),auth[_0x26c2('0xb')](),controller['show']);router[_0x26c2('0xa')]('/:id/configurations',auth[_0x26c2('0xb')](),controller[_0x26c2('0xe')]);router[_0x26c2('0xa')](_0x26c2('0xf'),auth[_0x26c2('0xb')](),controller[_0x26c2('0x10')]);router[_0x26c2('0x11')]('/',auth['isAuthenticated'](),controller[_0x26c2('0x12')]);router[_0x26c2('0x11')](_0x26c2('0x13'),auth[_0x26c2('0xb')](),controller[_0x26c2('0x14')]);router[_0x26c2('0x15')](_0x26c2('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x26c2('0xd'),auth[_0x26c2('0xb')](),controller[_0x26c2('0x16')]);module[_0x26c2('0x17')]=router; \ No newline at end of file +var _0x3a31=['/:id','isAuthenticated','show','/:id/fields','post','addConfiguration','put','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','index','get'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x3a31,0x8f));var _0x13a3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3a31[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x13a3('0x0'));var util=require('util');var path=require(_0x13a3('0x1'));var timeout=require(_0x13a3('0x2'));var express=require(_0x13a3('0x3'));var router=express['Router']();var fs_extra=require(_0x13a3('0x4'));var auth=require(_0x13a3('0x5'));var interaction=require(_0x13a3('0x6'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x13a3('0x7')]);router[_0x13a3('0x8')](_0x13a3('0x9'),auth[_0x13a3('0xa')](),controller[_0x13a3('0xb')]);router['get']('/:id/configurations',auth[_0x13a3('0xa')](),controller['getConfigurations']);router[_0x13a3('0x8')](_0x13a3('0xc'),auth[_0x13a3('0xa')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x13a3('0xd')]('/:id/configurations',auth[_0x13a3('0xa')](),controller[_0x13a3('0xe')]);router[_0x13a3('0xf')](_0x13a3('0x9'),auth['isAuthenticated'](),controller[_0x13a3('0x10')]);router[_0x13a3('0x11')]('/:id',auth[_0x13a3('0xa')](),controller[_0x13a3('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 7b9dcc4..e71024c 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 _0x12f4=['newTab','sequelize','STRING','ENUM','basic','integrationTab'];(function(_0x1454a2,_0x55b0cc){var _0x515154=function(_0x27c99c){while(--_0x27c99c){_0x1454a2['push'](_0x1454a2['shift']());}};_0x515154(++_0x55b0cc);}(_0x12f4,0x91));var _0x412f=function(_0x216359,_0xbfd4a1){_0x216359=_0x216359-0x0;var _0x32aab6=_0x12f4[_0x216359];return _0x32aab6;};'use strict';var Sequelize=require(_0x412f('0x0'));module['exports']={'name':{'type':Sequelize[_0x412f('0x1')]},'description':{'type':Sequelize[_0x412f('0x1')]},'username':{'type':Sequelize[_0x412f('0x1')]},'remoteUri':{'type':Sequelize[_0x412f('0x1')]},'authType':{'type':Sequelize[_0x412f('0x2')](_0x412f('0x3')),'defaultValue':_0x412f('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x412f('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x412f('0x1')]},'tokenSecret':{'type':Sequelize[_0x412f('0x1')]},'serverUrl':{'type':Sequelize[_0x412f('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x412f('0x4'),_0x412f('0x5')),'defaultValue':_0x412f('0x4')}}; \ No newline at end of file +var _0x6b02=['STRING','basic','ENUM','integrationTab','sequelize'];(function(_0x146e35,_0x3853e0){var _0x11aa4d=function(_0x3e491d){while(--_0x3e491d){_0x146e35['push'](_0x146e35['shift']());}};_0x11aa4d(++_0x3853e0);}(_0x6b02,0x158));var _0x26b0=function(_0x16bd44,_0x587581){_0x16bd44=_0x16bd44-0x0;var _0x4cd2a7=_0x6b02[_0x16bd44];return _0x4cd2a7;};'use strict';var Sequelize=require(_0x26b0('0x0'));module['exports']={'name':{'type':Sequelize[_0x26b0('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x26b0('0x1')]},'authType':{'type':Sequelize['ENUM'](_0x26b0('0x2')),'defaultValue':_0x26b0('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x26b0('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x26b0('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x26b0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x26b0('0x3')]('integrationTab','newTab'),'defaultValue':_0x26b0('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index bf2d682..d144029 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 _0x4fdb=['hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','intersection','catch','create','body','find','params','findOne','DeskConfiguration','length','pick','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','toString','base64','concat','_embedded','entries','label','statusCode','stringify','send','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields'];(function(_0x2918de,_0x3d4077){var _0x5d62b4=function(_0x5f1e1b){while(--_0x5f1e1b){_0x2918de['push'](_0x2918de['shift']());}};_0x5d62b4(++_0x3d4077);}(_0x4fdb,0xb0));var _0xb4fd=function(_0x3db448,_0x357059){_0x3db448=_0x3db448-0x0;var _0x58024d=_0x4fdb[_0x3db448];return _0x58024d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb4fd('0x0'));var zipdir=require(_0xb4fd('0x1'));var jsonpatch=require(_0xb4fd('0x2'));var rp=require(_0xb4fd('0x3'));var moment=require(_0xb4fd('0x4'));var BPromise=require(_0xb4fd('0x5'));var Mustache=require(_0xb4fd('0x6'));var util=require(_0xb4fd('0x7'));var path=require(_0xb4fd('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb4fd('0x9'));var fs=require('fs');var fs_extra=require(_0xb4fd('0xa'));var _=require('lodash');var squel=require(_0xb4fd('0xb'));var crypto=require(_0xb4fd('0xc'));var jsforce=require(_0xb4fd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb4fd('0xe'));var querystring=require(_0xb4fd('0xf'));var Papa=require('papaparse');var Redis=require(_0xb4fd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb4fd('0x11'));var as=require(_0xb4fd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb4fd('0x13'))(_0xb4fd('0x14'));var utils=require('../../config/utils');var config=require(_0xb4fd('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xb4fd('0x16'));function respondWithStatusCode(_0x5359d0,_0xbfbf6a){_0xbfbf6a=_0xbfbf6a||0xcc;return function(_0x54ad8f){if(_0x54ad8f){return _0x5359d0[_0xb4fd('0x17')](_0xbfbf6a);}return _0x5359d0[_0xb4fd('0x18')](_0xbfbf6a)[_0xb4fd('0x19')]();};}function respondWithResult(_0x2c4881,_0x5e54f2){_0x5e54f2=_0x5e54f2||0xc8;return function(_0x5a58c3){if(_0x5a58c3){return _0x2c4881[_0xb4fd('0x18')](_0x5e54f2)[_0xb4fd('0x1a')](_0x5a58c3);}};}function respondWithFilteredResult(_0x5b513b,_0x493214){return function(_0x31bdbc){if(_0x31bdbc){var _0x422d65=typeof _0x493214[_0xb4fd('0x1b')]===_0xb4fd('0x1c')&&typeof _0x493214[_0xb4fd('0x1d')]===_0xb4fd('0x1c');var _0x5a12cd=_0x31bdbc[_0xb4fd('0x1e')];var _0x2f9246=_0x422d65?0x0:_0x493214[_0xb4fd('0x1b')];var _0x16e09b=_0x422d65?_0x31bdbc[_0xb4fd('0x1e')]:_0x493214[_0xb4fd('0x1b')]+_0x493214['limit'];var _0x136626;if(_0x16e09b>=_0x5a12cd){_0x16e09b=_0x5a12cd;_0x136626=0xc8;}else{_0x136626=0xce;}_0x5b513b[_0xb4fd('0x18')](_0x136626);return _0x5b513b[_0xb4fd('0x1f')](_0xb4fd('0x20'),_0x2f9246+'-'+_0x16e09b+'/'+_0x5a12cd)[_0xb4fd('0x1a')](_0x31bdbc);}return null;};}function patchUpdates(_0x29ad7d){return function(_0x21e2cc){try{jsonpatch[_0xb4fd('0x21')](_0x21e2cc,_0x29ad7d,!![]);}catch(_0x4d418a){return BPromise[_0xb4fd('0x22')](_0x4d418a);}return _0x21e2cc[_0xb4fd('0x23')]();};}function saveUpdates(_0xa634d9,_0x58afc2){return function(_0x5b0512){if(_0x5b0512){return _0x5b0512[_0xb4fd('0x24')](_0xa634d9)[_0xb4fd('0x25')](function(_0x321077){return _0x321077;});}return null;};}function removeEntity(_0x284044,_0x2a3a03){return function(_0x343b09){if(_0x343b09){return _0x343b09[_0xb4fd('0x26')]()[_0xb4fd('0x25')](function(){_0x284044['status'](0xcc)[_0xb4fd('0x19')]();});}};}function handleEntityNotFound(_0x4eacf2,_0x568057){return function(_0x2818e3){if(!_0x2818e3){_0x4eacf2['sendStatus'](0x194);}return _0x2818e3;};}function handleError(_0xe69170,_0x5e2707){_0x5e2707=_0x5e2707||0x1f4;return function(_0x15e8b7){logger[_0xb4fd('0x27')](_0x15e8b7[_0xb4fd('0x28')]);if(_0x15e8b7['name']){delete _0x15e8b7[_0xb4fd('0x29')];}_0xe69170[_0xb4fd('0x18')](_0x5e2707)['send'](_0x15e8b7);};}exports[_0xb4fd('0x2a')]=function(_0xe05e94,_0x38282d){var _0x2a593b={},_0x46c7f9={},_0x31c213={'count':0x0,'rows':[]};var _0x196d42=_[_0xb4fd('0x2b')](db[_0xb4fd('0x2c')][_0xb4fd('0x2d')],function(_0x5b1d59){return{'name':_0x5b1d59[_0xb4fd('0x2e')],'type':_0x5b1d59[_0xb4fd('0x2f')]['key']};});_0x46c7f9[_0xb4fd('0x30')]=_['map'](_0x196d42,'name');_0x46c7f9[_0xb4fd('0x31')]=_[_0xb4fd('0x32')](_0xe05e94[_0xb4fd('0x31')]);_0x46c7f9[_0xb4fd('0x33')]=_['intersection'](_0x46c7f9[_0xb4fd('0x30')],_0x46c7f9[_0xb4fd('0x31')]);_0x2a593b[_0xb4fd('0x34')]=_['intersection'](_0x46c7f9[_0xb4fd('0x30')],qs[_0xb4fd('0x35')](_0xe05e94['query'][_0xb4fd('0x35')]));_0x2a593b['attributes']=_0x2a593b[_0xb4fd('0x34')]['length']?_0x2a593b[_0xb4fd('0x34')]:_0x46c7f9[_0xb4fd('0x30')];if(!_0xe05e94[_0xb4fd('0x31')][_0xb4fd('0x36')](_0xb4fd('0x37'))){_0x2a593b['limit']=qs[_0xb4fd('0x1d')](_0xe05e94[_0xb4fd('0x31')][_0xb4fd('0x1d')]);_0x2a593b['offset']=qs[_0xb4fd('0x1b')](_0xe05e94[_0xb4fd('0x31')]['offset']);}_0x2a593b[_0xb4fd('0x38')]=qs['sort'](_0xe05e94[_0xb4fd('0x31')][_0xb4fd('0x39')]);_0x2a593b['where']=qs[_0xb4fd('0x33')](_['pick'](_0xe05e94[_0xb4fd('0x31')],_0x46c7f9['filters']),_0x196d42);if(_0xe05e94['query'][_0xb4fd('0x3a')]){_0x2a593b['where']=_[_0xb4fd('0x3b')](_0x2a593b[_0xb4fd('0x3c')],{'$or':_[_0xb4fd('0x2b')](_0x196d42,function(_0xfb5eab){if(_0xfb5eab[_0xb4fd('0x2f')]!==_0xb4fd('0x3d')){var _0x13b08a={};_0x13b08a[_0xfb5eab['name']]={'$like':'%'+_0xe05e94[_0xb4fd('0x31')][_0xb4fd('0x3a')]+'%'};return _0x13b08a;}})});}_0x2a593b=_[_0xb4fd('0x3b')]({},_0x2a593b,_0xe05e94[_0xb4fd('0x3e')]);var _0x5396c3={'where':_0x2a593b[_0xb4fd('0x3c')]};return db[_0xb4fd('0x2c')][_0xb4fd('0x1e')](_0x5396c3)[_0xb4fd('0x25')](function(_0x5c641e){_0x31c213['count']=_0x5c641e;if(_0xe05e94[_0xb4fd('0x31')][_0xb4fd('0x3f')]){_0x2a593b[_0xb4fd('0x40')]=[{'all':!![]}];}return db[_0xb4fd('0x2c')][_0xb4fd('0x41')](_0x2a593b);})['then'](function(_0x537348){_0x31c213[_0xb4fd('0x42')]=_0x537348;return _0x31c213;})[_0xb4fd('0x25')](respondWithFilteredResult(_0x38282d,_0x2a593b))['catch'](handleError(_0x38282d,null));};exports['show']=function(_0x3e9b40,_0x1ee8eb){var _0x598267={'raw':![],'where':{'id':_0x3e9b40['params']['id']}},_0x413053={};_0x413053['model']=_['keys'](db[_0xb4fd('0x2c')][_0xb4fd('0x2d')]);_0x413053[_0xb4fd('0x31')]=_[_0xb4fd('0x32')](_0x3e9b40[_0xb4fd('0x31')]);_0x413053[_0xb4fd('0x33')]=_[_0xb4fd('0x43')](_0x413053[_0xb4fd('0x30')],_0x413053[_0xb4fd('0x31')]);_0x598267[_0xb4fd('0x34')]=_[_0xb4fd('0x43')](_0x413053[_0xb4fd('0x30')],qs[_0xb4fd('0x35')](_0x3e9b40[_0xb4fd('0x31')][_0xb4fd('0x35')]));_0x598267[_0xb4fd('0x34')]=_0x598267[_0xb4fd('0x34')]['length']?_0x598267[_0xb4fd('0x34')]:_0x413053[_0xb4fd('0x30')];if(_0x3e9b40[_0xb4fd('0x31')][_0xb4fd('0x3f')]){_0x598267['include']=[{'all':!![]}];}_0x598267=_['merge']({},_0x598267,_0x3e9b40[_0xb4fd('0x3e')]);return db['DeskAccount']['find'](_0x598267)['then'](handleEntityNotFound(_0x1ee8eb,null))['then'](respondWithResult(_0x1ee8eb,null))[_0xb4fd('0x44')](handleError(_0x1ee8eb,null));};exports[_0xb4fd('0x45')]=function(_0x590c1e,_0x64b373){return db[_0xb4fd('0x2c')][_0xb4fd('0x45')](_0x590c1e[_0xb4fd('0x46')],{})[_0xb4fd('0x25')](respondWithResult(_0x64b373,0xc9))[_0xb4fd('0x44')](handleError(_0x64b373,null));};exports[_0xb4fd('0x24')]=function(_0x1d081f,_0x3fab95){if(_0x1d081f[_0xb4fd('0x46')]['id']){delete _0x1d081f[_0xb4fd('0x46')]['id'];}return db['DeskAccount'][_0xb4fd('0x47')]({'where':{'id':_0x1d081f['params']['id']}})['then'](handleEntityNotFound(_0x3fab95,null))[_0xb4fd('0x25')](saveUpdates(_0x1d081f[_0xb4fd('0x46')],null))[_0xb4fd('0x25')](respondWithResult(_0x3fab95,null))[_0xb4fd('0x44')](handleError(_0x3fab95,null));};exports['destroy']=function(_0x4cbb06,_0x44ee9c){return db[_0xb4fd('0x2c')][_0xb4fd('0x47')]({'where':{'id':_0x4cbb06[_0xb4fd('0x48')]['id']}})[_0xb4fd('0x25')](handleEntityNotFound(_0x44ee9c,null))[_0xb4fd('0x25')](removeEntity(_0x44ee9c,null))['catch'](handleError(_0x44ee9c,null));};exports['getConfigurations']=function(_0x4266c1,_0x170bc7,_0x5cc78d){var _0x224957={};var _0x1589c7={};var _0x43531d;var _0x129011;return db[_0xb4fd('0x2c')][_0xb4fd('0x49')]({'where':{'id':_0x4266c1[_0xb4fd('0x48')]['id']}})[_0xb4fd('0x25')](handleEntityNotFound(_0x170bc7,null))['then'](function(_0x1d29d1){if(_0x1d29d1){_0x43531d=_0x1d29d1;_0x1589c7[_0xb4fd('0x30')]=_['keys'](db[_0xb4fd('0x4a')][_0xb4fd('0x2d')]);_0x1589c7['query']=_[_0xb4fd('0x32')](_0x4266c1[_0xb4fd('0x31')]);_0x1589c7[_0xb4fd('0x33')]=_[_0xb4fd('0x43')](_0x1589c7[_0xb4fd('0x30')],_0x1589c7[_0xb4fd('0x31')]);_0x224957['attributes']=_[_0xb4fd('0x43')](_0x1589c7[_0xb4fd('0x30')],qs[_0xb4fd('0x35')](_0x4266c1['query'][_0xb4fd('0x35')]));_0x224957[_0xb4fd('0x34')]=_0x224957[_0xb4fd('0x34')][_0xb4fd('0x4b')]?_0x224957[_0xb4fd('0x34')]:_0x1589c7['model'];_0x224957[_0xb4fd('0x38')]=qs[_0xb4fd('0x39')](_0x4266c1[_0xb4fd('0x31')][_0xb4fd('0x39')]);_0x224957[_0xb4fd('0x3c')]=qs[_0xb4fd('0x33')](_[_0xb4fd('0x4c')](_0x4266c1[_0xb4fd('0x31')],_0x1589c7[_0xb4fd('0x33')]));if(_0x4266c1['query'][_0xb4fd('0x3a')]){_0x224957[_0xb4fd('0x3c')]=_['merge'](_0x224957['where'],{'$or':_[_0xb4fd('0x2b')](_0x224957[_0xb4fd('0x34')],function(_0x168cd9){var _0xe8cba8={};_0xe8cba8[_0x168cd9]={'$like':'%'+_0x4266c1['query'][_0xb4fd('0x3a')]+'%'};return _0xe8cba8;})});}_0x224957=_[_0xb4fd('0x3b')]({},_0x224957,_0x4266c1[_0xb4fd('0x3e')]);return _0x43531d[_0xb4fd('0x4d')](_0x224957);}})[_0xb4fd('0x25')](function(_0x25502b){if(_0x25502b){_0x129011=_0x25502b[_0xb4fd('0x4b')];if(!_0x4266c1[_0xb4fd('0x31')][_0xb4fd('0x36')](_0xb4fd('0x37'))){_0x224957['limit']=qs[_0xb4fd('0x1d')](_0x4266c1[_0xb4fd('0x31')][_0xb4fd('0x1d')]);_0x224957['offset']=qs['offset'](_0x4266c1[_0xb4fd('0x31')]['offset']);}return _0x43531d[_0xb4fd('0x4d')](_0x224957);}})[_0xb4fd('0x25')](function(_0x368267){if(_0x368267){return _0x368267?{'count':_0x129011,'rows':_0x368267}:null;}})[_0xb4fd('0x25')](respondWithResult(_0x170bc7,null))['catch'](handleError(_0x170bc7,null));};exports['addConfiguration']=function(_0x3585db,_0x33bb60,_0x5b1105){if(_0x3585db[_0xb4fd('0x46')]['id']){delete _0x3585db[_0xb4fd('0x46')]['id'];}return db[_0xb4fd('0x2c')][_0xb4fd('0x49')]({'where':{'id':_0x3585db['params']['id']}})[_0xb4fd('0x25')](handleEntityNotFound(_0x33bb60,null))[_0xb4fd('0x25')](function(_0x5e7402){if(_0x5e7402){_0x3585db[_0xb4fd('0x46')][_0xb4fd('0x4e')]=_0x5e7402['id'];_0x3585db[_0xb4fd('0x46')][_0xb4fd('0x4f')]=integrations[_0xb4fd('0x50')](_0x3585db[_0xb4fd('0x46')][_0xb4fd('0x51')],_0x3585db['body'][_0xb4fd('0x2f')]);_0x3585db['body'][_0xb4fd('0x52')]=integrations[_0xb4fd('0x53')](_0x3585db['body']['channel'],_0x3585db[_0xb4fd('0x46')]['type']);return db[_0xb4fd('0x4a')][_0xb4fd('0x45')](_0x3585db[_0xb4fd('0x46')],{'include':[{'model':db[_0xb4fd('0x54')],'as':_0xb4fd('0x4f')},{'model':db[_0xb4fd('0x54')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x33bb60,null))[_0xb4fd('0x44')](handleError(_0x33bb60,null));};exports[_0xb4fd('0x55')]=function(_0x37e018,_0x20d207,_0x26ab0e){var _0x223089=[{'name':_0xb4fd('0x56'),'label':_0xb4fd('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 _0xc81c6f='';return db[_0xb4fd('0x2c')][_0xb4fd('0x49')]({'where':{'id':_0x37e018[_0xb4fd('0x48')]['id']},'attributes':['id',_0xb4fd('0x57'),_0xb4fd('0x58'),_0xb4fd('0x59'),_0xb4fd('0x5a'),_0xb4fd('0x5b'),'consumerSecret',_0xb4fd('0x5c'),_0xb4fd('0x5d')]})[_0xb4fd('0x25')](handleEntityNotFound(_0x20d207,null))[_0xb4fd('0x25')](function(_0x32173c){if(_0x32173c){_0xc81c6f=_0x32173c[_0xb4fd('0x57')];var _0x2b37b0=_0xc81c6f['slice'](-0x1);if(_0x2b37b0==='/'){_0xc81c6f=_0xc81c6f[_0xb4fd('0x5e')](0x0,_0xc81c6f[_0xb4fd('0x5f')](_0x2b37b0));}var _0x3eaab0={'method':_0xb4fd('0x60'),'uri':util[_0xb4fd('0x61')](_0xb4fd('0x62'),_0xc81c6f),'headers':{'Content-Type':'application/json','Accept':_0xb4fd('0x63')},'json':!![]};if(_0x32173c['authType']===_0xb4fd('0x64')){_0x3eaab0[_0xb4fd('0x65')][_0xb4fd('0x66')]=util[_0xb4fd('0x61')](_0xb4fd('0x67'),new Buffer(util['format']('%s:%s',_0x32173c[_0xb4fd('0x59')],_0x32173c[_0xb4fd('0x5a')]))[_0xb4fd('0x68')](_0xb4fd('0x69')));}return rp(_0x3eaab0)[_0xb4fd('0x25')](function(_0x15afc5){return _0x223089[_0xb4fd('0x6a')](_[_0xb4fd('0x2b')](_0x15afc5[_0xb4fd('0x6b')][_0xb4fd('0x6c')],function(_0x43b9f3){return{'id':_0x43b9f3[_0xb4fd('0x29')],'name':_0x43b9f3['name'],'type':_0x43b9f3[_0xb4fd('0x2f')],'active':_0x43b9f3['active'],'label':_0x43b9f3[_0xb4fd('0x6d')],'custom':!![]};}));});}})[_0xb4fd('0x25')](function(_0x333768){return{'count':_0x333768['length'],'rows':_0x333768};})[_0xb4fd('0x25')](respondWithResult(_0x20d207,null))[_0xb4fd('0x44')](function(_0x5ddc67){var _0x26c170=_0x37e018[_0xb4fd('0x31')]['test']?0x1f4:_0x5ddc67[_0xb4fd('0x6e')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xb4fd('0x55'),_0x26c170,JSON[_0xb4fd('0x6f')](_0x5ddc67));delete _0x5ddc67[_0xb4fd('0x29')];if(_0x26c170===0x191){_0x26c170=0x190;}_0x20d207[_0xb4fd('0x18')](_0x26c170)[_0xb4fd('0x70')](_0x37e018[_0xb4fd('0x31')][_0xb4fd('0x71')]?{'message':_0xb4fd('0x72'),'statusCode':_0x5ddc67[_0xb4fd('0x6e')]}:_0x5ddc67);});}; \ No newline at end of file +var _0x2845=['concat','_embedded','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','test','Wrong\x20credentials','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','json','reject','update','then','destroy','error','index','DeskAccount','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','findOne','DeskConfiguration','rawAttributes','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','priority','remoteUri','authType','username','consumerKey','slice','substring','lastIndexOf','GET','format','application/json','headers','Authorization','Basic\x20%s','%s:%s','password','base64'];(function(_0x254bb7,_0x74ba90){var _0x11491f=function(_0x5e7e22){while(--_0x5e7e22){_0x254bb7['push'](_0x254bb7['shift']());}};_0x11491f(++_0x74ba90);}(_0x2845,0x76));var _0x5284=function(_0x36feee,_0x5883c0){_0x36feee=_0x36feee-0x0;var _0x46cb6c=_0x2845[_0x36feee];return _0x46cb6c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5284('0x0'));var rp=require(_0x5284('0x1'));var moment=require(_0x5284('0x2'));var BPromise=require(_0x5284('0x3'));var Mustache=require(_0x5284('0x4'));var util=require(_0x5284('0x5'));var path=require('path');var sox=require(_0x5284('0x6'));var csv=require(_0x5284('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5284('0x8'));var _=require('lodash');var squel=require(_0x5284('0x9'));var crypto=require(_0x5284('0xa'));var jsforce=require(_0x5284('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5284('0x7'));var querystring=require(_0x5284('0xc'));var Papa=require('papaparse');var Redis=require(_0x5284('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5284('0xe'));var as=require(_0x5284('0xf'));var hardwareService=require(_0x5284('0x10'));var logger=require(_0x5284('0x11'))(_0x5284('0x12'));var utils=require(_0x5284('0x13'));var config=require(_0x5284('0x14'));var licenseUtil=require(_0x5284('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3896b9,_0x25f02f){_0x25f02f=_0x25f02f||0xcc;return function(_0x68006){if(_0x68006){return _0x3896b9[_0x5284('0x16')](_0x25f02f);}return _0x3896b9['status'](_0x25f02f)[_0x5284('0x17')]();};}function respondWithResult(_0x1edf70,_0x3bf846){_0x3bf846=_0x3bf846||0xc8;return function(_0x1c83d9){if(_0x1c83d9){return _0x1edf70[_0x5284('0x18')](_0x3bf846)['json'](_0x1c83d9);}};}function respondWithFilteredResult(_0x266a83,_0x5768a2){return function(_0x290fea){if(_0x290fea){var _0x2a6494=typeof _0x5768a2[_0x5284('0x19')]===_0x5284('0x1a')&&typeof _0x5768a2[_0x5284('0x1b')]===_0x5284('0x1a');var _0x900172=_0x290fea[_0x5284('0x1c')];var _0x15f970=_0x2a6494?0x0:_0x5768a2['offset'];var _0x3ccb37=_0x2a6494?_0x290fea[_0x5284('0x1c')]:_0x5768a2['offset']+_0x5768a2['limit'];var _0x3e3260;if(_0x3ccb37>=_0x900172){_0x3ccb37=_0x900172;_0x3e3260=0xc8;}else{_0x3e3260=0xce;}_0x266a83['status'](_0x3e3260);return _0x266a83[_0x5284('0x1d')]('Content-Range',_0x15f970+'-'+_0x3ccb37+'/'+_0x900172)[_0x5284('0x1e')](_0x290fea);}return null;};}function patchUpdates(_0x46cbc5){return function(_0xa074cc){try{jsonpatch['apply'](_0xa074cc,_0x46cbc5,!![]);}catch(_0x1c552d){return BPromise[_0x5284('0x1f')](_0x1c552d);}return _0xa074cc['save']();};}function saveUpdates(_0x12904b,_0x2c0df0){return function(_0x19b744){if(_0x19b744){return _0x19b744[_0x5284('0x20')](_0x12904b)[_0x5284('0x21')](function(_0x4fd7a0){return _0x4fd7a0;});}return null;};}function removeEntity(_0x3c42b3,_0x3e6ead){return function(_0xcf231b){if(_0xcf231b){return _0xcf231b[_0x5284('0x22')]()[_0x5284('0x21')](function(){_0x3c42b3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5abf8a,_0x70da4f){return function(_0x372d50){if(!_0x372d50){_0x5abf8a[_0x5284('0x16')](0x194);}return _0x372d50;};}function handleError(_0x453063,_0x27818d){_0x27818d=_0x27818d||0x1f4;return function(_0x40cc6b){logger[_0x5284('0x23')](_0x40cc6b['stack']);if(_0x40cc6b['name']){delete _0x40cc6b['name'];}_0x453063['status'](_0x27818d)['send'](_0x40cc6b);};}exports[_0x5284('0x24')]=function(_0x5e25a4,_0xf27d83){var _0x48ebc7={},_0x1b798e={},_0x316bbe={'count':0x0,'rows':[]};var _0x5b9986=_['map'](db[_0x5284('0x25')]['rawAttributes'],function(_0x3ed2c3){return{'name':_0x3ed2c3['fieldName'],'type':_0x3ed2c3[_0x5284('0x26')]['key']};});_0x1b798e[_0x5284('0x27')]=_[_0x5284('0x28')](_0x5b9986,_0x5284('0x29'));_0x1b798e[_0x5284('0x2a')]=_[_0x5284('0x2b')](_0x5e25a4['query']);_0x1b798e[_0x5284('0x2c')]=_[_0x5284('0x2d')](_0x1b798e[_0x5284('0x27')],_0x1b798e['query']);_0x48ebc7[_0x5284('0x2e')]=_[_0x5284('0x2d')](_0x1b798e[_0x5284('0x27')],qs[_0x5284('0x2f')](_0x5e25a4[_0x5284('0x2a')][_0x5284('0x2f')]));_0x48ebc7[_0x5284('0x2e')]=_0x48ebc7[_0x5284('0x2e')][_0x5284('0x30')]?_0x48ebc7[_0x5284('0x2e')]:_0x1b798e[_0x5284('0x27')];if(!_0x5e25a4[_0x5284('0x2a')][_0x5284('0x31')]('nolimit')){_0x48ebc7[_0x5284('0x1b')]=qs['limit'](_0x5e25a4[_0x5284('0x2a')]['limit']);_0x48ebc7[_0x5284('0x19')]=qs[_0x5284('0x19')](_0x5e25a4[_0x5284('0x2a')]['offset']);}_0x48ebc7[_0x5284('0x32')]=qs[_0x5284('0x33')](_0x5e25a4[_0x5284('0x2a')][_0x5284('0x33')]);_0x48ebc7[_0x5284('0x34')]=qs[_0x5284('0x2c')](_[_0x5284('0x35')](_0x5e25a4[_0x5284('0x2a')],_0x1b798e[_0x5284('0x2c')]),_0x5b9986);if(_0x5e25a4[_0x5284('0x2a')]['filter']){_0x48ebc7['where']=_[_0x5284('0x36')](_0x48ebc7[_0x5284('0x34')],{'$or':_['map'](_0x5b9986,function(_0x922f40){if(_0x922f40[_0x5284('0x26')]!=='VIRTUAL'){var _0x58cf31={};_0x58cf31[_0x922f40[_0x5284('0x29')]]={'$like':'%'+_0x5e25a4[_0x5284('0x2a')][_0x5284('0x37')]+'%'};return _0x58cf31;}})});}_0x48ebc7=_[_0x5284('0x36')]({},_0x48ebc7,_0x5e25a4[_0x5284('0x38')]);var _0x57ec97={'where':_0x48ebc7[_0x5284('0x34')]};return db[_0x5284('0x25')][_0x5284('0x1c')](_0x57ec97)[_0x5284('0x21')](function(_0x10a20b){_0x316bbe[_0x5284('0x1c')]=_0x10a20b;if(_0x5e25a4['query'][_0x5284('0x39')]){_0x48ebc7[_0x5284('0x3a')]=[{'all':!![]}];}return db[_0x5284('0x25')][_0x5284('0x3b')](_0x48ebc7);})[_0x5284('0x21')](function(_0x2c4248){_0x316bbe['rows']=_0x2c4248;return _0x316bbe;})[_0x5284('0x21')](respondWithFilteredResult(_0xf27d83,_0x48ebc7))[_0x5284('0x3c')](handleError(_0xf27d83,null));};exports[_0x5284('0x3d')]=function(_0x1c3223,_0x2f42d7){var _0x59738c={'raw':![],'where':{'id':_0x1c3223[_0x5284('0x3e')]['id']}},_0x1dc520={};_0x1dc520['model']=_['keys'](db[_0x5284('0x25')]['rawAttributes']);_0x1dc520[_0x5284('0x2a')]=_[_0x5284('0x2b')](_0x1c3223[_0x5284('0x2a')]);_0x1dc520[_0x5284('0x2c')]=_[_0x5284('0x2d')](_0x1dc520[_0x5284('0x27')],_0x1dc520[_0x5284('0x2a')]);_0x59738c[_0x5284('0x2e')]=_[_0x5284('0x2d')](_0x1dc520[_0x5284('0x27')],qs[_0x5284('0x2f')](_0x1c3223[_0x5284('0x2a')][_0x5284('0x2f')]));_0x59738c[_0x5284('0x2e')]=_0x59738c[_0x5284('0x2e')][_0x5284('0x30')]?_0x59738c[_0x5284('0x2e')]:_0x1dc520[_0x5284('0x27')];if(_0x1c3223['query']['includeAll']){_0x59738c[_0x5284('0x3a')]=[{'all':!![]}];}_0x59738c=_[_0x5284('0x36')]({},_0x59738c,_0x1c3223[_0x5284('0x38')]);return db[_0x5284('0x25')][_0x5284('0x3f')](_0x59738c)['then'](handleEntityNotFound(_0x2f42d7,null))['then'](respondWithResult(_0x2f42d7,null))[_0x5284('0x3c')](handleError(_0x2f42d7,null));};exports[_0x5284('0x40')]=function(_0x4e8447,_0x1f6c4a){return db[_0x5284('0x25')]['create'](_0x4e8447[_0x5284('0x41')],{})[_0x5284('0x21')](respondWithResult(_0x1f6c4a,0xc9))[_0x5284('0x3c')](handleError(_0x1f6c4a,null));};exports[_0x5284('0x20')]=function(_0x3be950,_0x4bb4de){if(_0x3be950[_0x5284('0x41')]['id']){delete _0x3be950['body']['id'];}return db[_0x5284('0x25')][_0x5284('0x3f')]({'where':{'id':_0x3be950[_0x5284('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4bb4de,null))[_0x5284('0x21')](saveUpdates(_0x3be950[_0x5284('0x41')],null))[_0x5284('0x21')](respondWithResult(_0x4bb4de,null))['catch'](handleError(_0x4bb4de,null));};exports[_0x5284('0x22')]=function(_0x4e2f40,_0x144a1e){return db[_0x5284('0x25')][_0x5284('0x3f')]({'where':{'id':_0x4e2f40[_0x5284('0x3e')]['id']}})['then'](handleEntityNotFound(_0x144a1e,null))[_0x5284('0x21')](removeEntity(_0x144a1e,null))[_0x5284('0x3c')](handleError(_0x144a1e,null));};exports[_0x5284('0x42')]=function(_0x2cc2ec,_0x583dac,_0xb13ce){var _0x235965={};var _0xaecb0d={};var _0x1d65dd;var _0x24771c;return db[_0x5284('0x25')][_0x5284('0x43')]({'where':{'id':_0x2cc2ec[_0x5284('0x3e')]['id']}})[_0x5284('0x21')](handleEntityNotFound(_0x583dac,null))[_0x5284('0x21')](function(_0x499cc9){if(_0x499cc9){_0x1d65dd=_0x499cc9;_0xaecb0d[_0x5284('0x27')]=_[_0x5284('0x2b')](db[_0x5284('0x44')][_0x5284('0x45')]);_0xaecb0d[_0x5284('0x2a')]=_[_0x5284('0x2b')](_0x2cc2ec[_0x5284('0x2a')]);_0xaecb0d[_0x5284('0x2c')]=_[_0x5284('0x2d')](_0xaecb0d[_0x5284('0x27')],_0xaecb0d['query']);_0x235965[_0x5284('0x2e')]=_['intersection'](_0xaecb0d[_0x5284('0x27')],qs[_0x5284('0x2f')](_0x2cc2ec[_0x5284('0x2a')][_0x5284('0x2f')]));_0x235965[_0x5284('0x2e')]=_0x235965[_0x5284('0x2e')][_0x5284('0x30')]?_0x235965[_0x5284('0x2e')]:_0xaecb0d['model'];_0x235965[_0x5284('0x32')]=qs[_0x5284('0x33')](_0x2cc2ec[_0x5284('0x2a')][_0x5284('0x33')]);_0x235965[_0x5284('0x34')]=qs[_0x5284('0x2c')](_['pick'](_0x2cc2ec[_0x5284('0x2a')],_0xaecb0d['filters']));if(_0x2cc2ec[_0x5284('0x2a')][_0x5284('0x37')]){_0x235965[_0x5284('0x34')]=_[_0x5284('0x36')](_0x235965[_0x5284('0x34')],{'$or':_[_0x5284('0x28')](_0x235965[_0x5284('0x2e')],function(_0x5dc645){var _0x23fae1={};_0x23fae1[_0x5dc645]={'$like':'%'+_0x2cc2ec[_0x5284('0x2a')][_0x5284('0x37')]+'%'};return _0x23fae1;})});}_0x235965=_[_0x5284('0x36')]({},_0x235965,_0x2cc2ec[_0x5284('0x38')]);return _0x1d65dd[_0x5284('0x42')](_0x235965);}})[_0x5284('0x21')](function(_0x4a230a){if(_0x4a230a){_0x24771c=_0x4a230a[_0x5284('0x30')];if(!_0x2cc2ec[_0x5284('0x2a')]['hasOwnProperty'](_0x5284('0x46'))){_0x235965['limit']=qs['limit'](_0x2cc2ec[_0x5284('0x2a')]['limit']);_0x235965[_0x5284('0x19')]=qs[_0x5284('0x19')](_0x2cc2ec['query'][_0x5284('0x19')]);}return _0x1d65dd['getConfigurations'](_0x235965);}})[_0x5284('0x21')](function(_0x14f5d6){if(_0x14f5d6){return _0x14f5d6?{'count':_0x24771c,'rows':_0x14f5d6}:null;}})[_0x5284('0x21')](respondWithResult(_0x583dac,null))['catch'](handleError(_0x583dac,null));};exports[_0x5284('0x47')]=function(_0x156a73,_0xc7dc54,_0x19e6be){if(_0x156a73[_0x5284('0x41')]['id']){delete _0x156a73[_0x5284('0x41')]['id'];}return db[_0x5284('0x25')][_0x5284('0x43')]({'where':{'id':_0x156a73[_0x5284('0x3e')]['id']}})['then'](handleEntityNotFound(_0xc7dc54,null))[_0x5284('0x21')](function(_0x9f7d16){if(_0x9f7d16){_0x156a73[_0x5284('0x41')][_0x5284('0x48')]=_0x9f7d16['id'];_0x156a73[_0x5284('0x41')][_0x5284('0x49')]=integrations[_0x5284('0x4a')](_0x156a73[_0x5284('0x41')]['channel'],_0x156a73[_0x5284('0x41')][_0x5284('0x26')]);_0x156a73['body'][_0x5284('0x4b')]=integrations[_0x5284('0x4c')](_0x156a73[_0x5284('0x41')][_0x5284('0x4d')],_0x156a73[_0x5284('0x41')][_0x5284('0x26')]);return db['DeskConfiguration'][_0x5284('0x40')](_0x156a73[_0x5284('0x41')],{'include':[{'model':db[_0x5284('0x4e')],'as':_0x5284('0x49')},{'model':db[_0x5284('0x4e')],'as':_0x5284('0x4b')}]});}return null;})['then'](respondWithResult(_0xc7dc54,null))['catch'](handleError(_0xc7dc54,null));};exports['getFields']=function(_0x3cf207,_0x55ac8c,_0x478ae3){var _0x7376e7=[{'name':_0x5284('0x4f'),'label':_0x5284('0x4f'),'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 _0x463abf='';return db[_0x5284('0x25')][_0x5284('0x43')]({'where':{'id':_0x3cf207[_0x5284('0x3e')]['id']},'attributes':['id',_0x5284('0x50'),_0x5284('0x51'),_0x5284('0x52'),'password',_0x5284('0x53'),'consumerSecret','token','tokenSecret']})['then'](handleEntityNotFound(_0x55ac8c,null))[_0x5284('0x21')](function(_0x57a1e2){if(_0x57a1e2){_0x463abf=_0x57a1e2['remoteUri'];var _0x239e40=_0x463abf[_0x5284('0x54')](-0x1);if(_0x239e40==='/'){_0x463abf=_0x463abf[_0x5284('0x55')](0x0,_0x463abf[_0x5284('0x56')](_0x239e40));}var _0x47a580={'method':_0x5284('0x57'),'uri':util[_0x5284('0x58')]('%s/custom_fields',_0x463abf),'headers':{'Content-Type':_0x5284('0x59'),'Accept':_0x5284('0x59')},'json':!![]};if(_0x57a1e2['authType']==='basic'){_0x47a580[_0x5284('0x5a')][_0x5284('0x5b')]=util[_0x5284('0x58')](_0x5284('0x5c'),new Buffer(util[_0x5284('0x58')](_0x5284('0x5d'),_0x57a1e2['username'],_0x57a1e2[_0x5284('0x5e')]))['toString'](_0x5284('0x5f')));}return rp(_0x47a580)[_0x5284('0x21')](function(_0x2c075d){return _0x7376e7[_0x5284('0x60')](_['map'](_0x2c075d[_0x5284('0x61')]['entries'],function(_0x34847a){return{'id':_0x34847a[_0x5284('0x29')],'name':_0x34847a[_0x5284('0x29')],'type':_0x34847a[_0x5284('0x26')],'active':_0x34847a[_0x5284('0x62')],'label':_0x34847a[_0x5284('0x63')],'custom':!![]};}));});}})[_0x5284('0x21')](function(_0x40d8c2){return{'count':_0x40d8c2[_0x5284('0x30')],'rows':_0x40d8c2};})[_0x5284('0x21')](respondWithResult(_0x55ac8c,null))['catch'](function(_0x895c82){var _0x5ecdba=_0x3cf207[_0x5284('0x2a')]['test']?0x1f4:_0x895c82[_0x5284('0x64')]||0x1f4;logger[_0x5284('0x23')](_0x5284('0x65'),_0x5284('0x66'),_0x5ecdba,JSON[_0x5284('0x67')](_0x895c82));delete _0x895c82[_0x5284('0x29')];if(_0x5ecdba===0x191){_0x5ecdba=0x190;}_0x55ac8c[_0x5284('0x18')](_0x5ecdba)[_0x5284('0x68')](_0x3cf207[_0x5284('0x2a')][_0x5284('0x69')]?{'message':_0x5284('0x6a'),'statusCode':_0x895c82[_0x5284('0x64')]}:_0x895c82);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 5913a1a..ba03f7e 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 _0xc8af=['path','../../config/environment','./intDeskAccount.attributes','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','moment'];(function(_0x5bf2a8,_0x559f97){var _0x1fe54f=function(_0x47158d){while(--_0x47158d){_0x5bf2a8['push'](_0x5bf2a8['shift']());}};_0x1fe54f(++_0x559f97);}(_0xc8af,0x10a));var _0xfc8a=function(_0x293ad7,_0x3757df){_0x293ad7=_0x293ad7-0x0;var _0x5a6318=_0xc8af[_0x293ad7];return _0x5a6318;};'use strict';var _=require(_0xfc8a('0x0'));var util=require(_0xfc8a('0x1'));var logger=require(_0xfc8a('0x2'))('api');var moment=require(_0xfc8a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc8a('0x4'));var rimraf=require('rimraf');var config=require(_0xfc8a('0x5'));var attributes=require(_0xfc8a('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x55e04e,_0x5c3be2){return _0x55e04e['define'](_0xfc8a('0x7'),attributes,{'tableName':_0xfc8a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x466a=['define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x501a92,_0x21bf74){var _0x1766ca=function(_0x2b5903){while(--_0x2b5903){_0x501a92['push'](_0x501a92['shift']());}};_0x1766ca(++_0x21bf74);}(_0x466a,0x18b));var _0xa466=function(_0x187426,_0x3a69c0){_0x187426=_0x187426-0x0;var _0x57e2c9=_0x466a[_0x187426];return _0x57e2c9;};'use strict';var _=require(_0xa466('0x0'));var util=require(_0xa466('0x1'));var logger=require(_0xa466('0x2'))('api');var moment=require(_0xa466('0x3'));var BPromise=require(_0xa466('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa466('0x5'));var rimraf=require(_0xa466('0x6'));var config=require(_0xa466('0x7'));var attributes=require(_0xa466('0x8'));var integrations=require(_0xa466('0x9'));module[_0xa466('0xa')]=function(_0x487338,_0x15ea66){return _0x487338[_0xa466('0xb')](_0xa466('0xc'),attributes,{'tableName':_0xa466('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 3c2316e..3bd4a57 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 _0xac08=['DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowDeskAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x1ac4ce,_0xf33460){var _0x2995d5=function(_0x57cda2){while(--_0x57cda2){_0x1ac4ce['push'](_0x1ac4ce['shift']());}};_0x2995d5(++_0xf33460);}(_0xac08,0xa1));var _0x8ac0=function(_0x2da36c,_0xce32f7){_0x2da36c=_0x2da36c-0x0;var _0x6c1f70=_0xac08[_0x2da36c];return _0x6c1f70;};'use strict';var _=require('lodash');var util=require(_0x8ac0('0x0'));var moment=require(_0x8ac0('0x1'));var BPromise=require(_0x8ac0('0x2'));var rs=require(_0x8ac0('0x3'));var fs=require('fs');var Redis=require(_0x8ac0('0x4'));var db=require(_0x8ac0('0x5'))['db'];var utils=require(_0x8ac0('0x6'));var logger=require(_0x8ac0('0x7'))(_0x8ac0('0x8'));var config=require(_0x8ac0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8ac0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x588114,_0x9573eb,_0x1790eb){return new BPromise(function(_0x1cf2c1,_0x362f2f){return client[_0x8ac0('0xb')](_0x588114,_0x1790eb)[_0x8ac0('0xc')](function(_0xf493fe){logger[_0x8ac0('0xd')](_0x8ac0('0xe'),_0x9573eb,_0x8ac0('0xf'));logger[_0x8ac0('0x10')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x9573eb,_0x8ac0('0xf'),JSON[_0x8ac0('0x11')](_0xf493fe));if(_0xf493fe[_0x8ac0('0x12')]){if(_0xf493fe[_0x8ac0('0x12')][_0x8ac0('0x13')]===0x1f4){logger[_0x8ac0('0x12')](_0x8ac0('0xe'),_0x9573eb,_0xf493fe[_0x8ac0('0x12')]['message']);return _0x362f2f(_0xf493fe[_0x8ac0('0x12')][_0x8ac0('0x14')]);}logger[_0x8ac0('0x12')](_0x8ac0('0xe'),_0x9573eb,_0xf493fe[_0x8ac0('0x12')][_0x8ac0('0x14')]);return _0x1cf2c1(_0xf493fe[_0x8ac0('0x12')][_0x8ac0('0x14')]);}else{logger['info'](_0x8ac0('0xe'),_0x9573eb,_0x8ac0('0xf'));_0x1cf2c1(_0xf493fe['result'][_0x8ac0('0x14')]);}})[_0x8ac0('0x15')](function(_0xe0e154){logger[_0x8ac0('0x12')](_0x8ac0('0xe'),_0x9573eb,_0xe0e154);_0x362f2f(_0xe0e154);});});}exports[_0x8ac0('0x16')]=function(_0xd36882){var _0x4084db=this;return new Promise(function(_0x17608,_0x1bf631){return db[_0x8ac0('0x17')][_0x8ac0('0x18')]({'raw':_0xd36882['options']?_0xd36882[_0x8ac0('0x19')][_0x8ac0('0x1a')]===undefined?!![]:![]:!![],'where':_0xd36882['options']?_0xd36882[_0x8ac0('0x19')][_0x8ac0('0x1b')]||null:null,'attributes':_0xd36882[_0x8ac0('0x19')]?_0xd36882[_0x8ac0('0x19')][_0x8ac0('0x1c')]||null:null,'limit':_0xd36882[_0x8ac0('0x19')]?_0xd36882['options'][_0x8ac0('0x1d')]||null:null,'include':_0xd36882[_0x8ac0('0x19')]?_0xd36882['options'][_0x8ac0('0x1e')]?_[_0x8ac0('0x1f')](_0xd36882[_0x8ac0('0x19')][_0x8ac0('0x1e')],function(_0x254c00){return{'model':db[_0x254c00['model']],'as':_0x254c00['as'],'attributes':_0x254c00['attributes'],'include':_0x254c00[_0x8ac0('0x1e')]?_[_0x8ac0('0x1f')](_0x254c00[_0x8ac0('0x1e')],function(_0x4c048c){return{'model':db[_0x4c048c[_0x8ac0('0x20')]],'as':_0x4c048c['as'],'attributes':_0x4c048c['attributes'],'include':_0x4c048c[_0x8ac0('0x1e')]?_[_0x8ac0('0x1f')](_0x4c048c[_0x8ac0('0x1e')],function(_0x43730c){return{'model':db[_0x43730c[_0x8ac0('0x20')]],'as':_0x43730c['as'],'attributes':_0x43730c[_0x8ac0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8ac0('0xc')](function(_0x39e2aa){logger[_0x8ac0('0xd')](_0x8ac0('0x16'),_0xd36882);logger[_0x8ac0('0x10')](_0x8ac0('0x16'),_0xd36882,JSON[_0x8ac0('0x11')](_0x39e2aa));_0x17608(_0x39e2aa);})['catch'](function(_0x30accf){logger[_0x8ac0('0x12')]('GetDeskAccount',_0x30accf['message'],_0xd36882);_0x1bf631(_0x4084db[_0x8ac0('0x12')](0x1f4,_0x30accf[_0x8ac0('0x14')]));});});};exports[_0x8ac0('0x21')]=function(_0x1786d6){var _0x3a0cc3=this;return new Promise(function(_0x5d354b,_0x549a05){return db['DeskAccount'][_0x8ac0('0x22')]({'raw':_0x1786d6[_0x8ac0('0x19')]?_0x1786d6[_0x8ac0('0x19')][_0x8ac0('0x1a')]===undefined?!![]:![]:!![],'where':_0x1786d6[_0x8ac0('0x19')]?_0x1786d6['options'][_0x8ac0('0x1b')]||null:null,'attributes':_0x1786d6[_0x8ac0('0x19')]?_0x1786d6['options'][_0x8ac0('0x1c')]||null:null,'include':_0x1786d6[_0x8ac0('0x19')]?_0x1786d6[_0x8ac0('0x19')]['include']?_['map'](_0x1786d6[_0x8ac0('0x19')]['include'],function(_0x15053d){return{'model':db[_0x15053d[_0x8ac0('0x20')]],'as':_0x15053d['as'],'attributes':_0x15053d['attributes'],'include':_0x15053d[_0x8ac0('0x1e')]?_['map'](_0x15053d[_0x8ac0('0x1e')],function(_0x5027ac){return{'model':db[_0x5027ac['model']],'as':_0x5027ac['as'],'attributes':_0x5027ac[_0x8ac0('0x1c')],'include':_0x5027ac[_0x8ac0('0x1e')]?_[_0x8ac0('0x1f')](_0x5027ac[_0x8ac0('0x1e')],function(_0x1e0301){return{'model':db[_0x1e0301[_0x8ac0('0x20')]],'as':_0x1e0301['as'],'attributes':_0x1e0301['attributes']};}):[]};}):[]};}):[]:[]})[_0x8ac0('0xc')](function(_0x1db90e){logger[_0x8ac0('0xd')](_0x8ac0('0x21'),_0x1786d6);logger[_0x8ac0('0x10')](_0x8ac0('0x21'),_0x1786d6,JSON[_0x8ac0('0x11')](_0x1db90e));_0x5d354b(_0x1db90e);})[_0x8ac0('0x15')](function(_0x363be7){logger[_0x8ac0('0x12')](_0x8ac0('0x21'),_0x363be7['message'],_0x1786d6);_0x549a05(_0x3a0cc3[_0x8ac0('0x12')](0x1f4,_0x363be7[_0x8ac0('0x14')]));});});}; \ No newline at end of file +var _0xffd8=['../../config/logger','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','model','attributes','include','map','GetDeskAccount','DeskAccount','where','ShowDeskAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3a3c17,_0x5b7b7e){var _0xd07f21=function(_0xeaad44){while(--_0xeaad44){_0x3a3c17['push'](_0x3a3c17['shift']());}};_0xd07f21(++_0x5b7b7e);}(_0xffd8,0x90));var _0x8ffd=function(_0x5e4eb8,_0xcae319){_0x5e4eb8=_0x5e4eb8-0x0;var _0x27751c=_0xffd8[_0x5e4eb8];return _0x27751c;};'use strict';var _=require(_0x8ffd('0x0'));var util=require(_0x8ffd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8ffd('0x2'));var fs=require('fs');var Redis=require(_0x8ffd('0x3'));var db=require(_0x8ffd('0x4'))['db'];var utils=require(_0x8ffd('0x5'));var logger=require(_0x8ffd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8ffd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3fed10,_0x5901db,_0x1d8b09){return new BPromise(function(_0xb26932,_0x3b2f15){return client['request'](_0x3fed10,_0x1d8b09)[_0x8ffd('0x8')](function(_0x2267df){logger[_0x8ffd('0x9')](_0x8ffd('0xa'),_0x5901db,_0x8ffd('0xb'));logger[_0x8ffd('0xc')](_0x8ffd('0xd'),_0x5901db,_0x8ffd('0xb'),JSON[_0x8ffd('0xe')](_0x2267df));if(_0x2267df[_0x8ffd('0xf')]){if(_0x2267df['error'][_0x8ffd('0x10')]===0x1f4){logger[_0x8ffd('0xf')](_0x8ffd('0xa'),_0x5901db,_0x2267df[_0x8ffd('0xf')]['message']);return _0x3b2f15(_0x2267df[_0x8ffd('0xf')][_0x8ffd('0x11')]);}logger[_0x8ffd('0xf')](_0x8ffd('0xa'),_0x5901db,_0x2267df[_0x8ffd('0xf')][_0x8ffd('0x11')]);return _0xb26932(_0x2267df[_0x8ffd('0xf')][_0x8ffd('0x11')]);}else{logger['info'](_0x8ffd('0xa'),_0x5901db,_0x8ffd('0xb'));_0xb26932(_0x2267df[_0x8ffd('0x12')]['message']);}})[_0x8ffd('0x13')](function(_0x4e8a74){logger[_0x8ffd('0xf')](_0x8ffd('0xa'),_0x5901db,_0x4e8a74);_0x3b2f15(_0x4e8a74);});});}exports['GetDeskAccount']=function(_0x1675d4){var _0x57b3fa=this;return new Promise(function(_0x4305c0,_0x5c7ad0){return db['DeskAccount'][_0x8ffd('0x14')]({'raw':_0x1675d4[_0x8ffd('0x15')]?_0x1675d4[_0x8ffd('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1675d4[_0x8ffd('0x15')]?_0x1675d4[_0x8ffd('0x15')]['where']||null:null,'attributes':_0x1675d4[_0x8ffd('0x15')]?_0x1675d4[_0x8ffd('0x15')]['attributes']||null:null,'limit':_0x1675d4['options']?_0x1675d4[_0x8ffd('0x15')]['limit']||null:null,'include':_0x1675d4[_0x8ffd('0x15')]?_0x1675d4['options']['include']?_['map'](_0x1675d4[_0x8ffd('0x15')]['include'],function(_0x4c4304){return{'model':db[_0x4c4304[_0x8ffd('0x16')]],'as':_0x4c4304['as'],'attributes':_0x4c4304[_0x8ffd('0x17')],'include':_0x4c4304[_0x8ffd('0x18')]?_[_0x8ffd('0x19')](_0x4c4304['include'],function(_0x4c87fc){return{'model':db[_0x4c87fc[_0x8ffd('0x16')]],'as':_0x4c87fc['as'],'attributes':_0x4c87fc[_0x8ffd('0x17')],'include':_0x4c87fc[_0x8ffd('0x18')]?_[_0x8ffd('0x19')](_0x4c87fc['include'],function(_0x3c473c){return{'model':db[_0x3c473c[_0x8ffd('0x16')]],'as':_0x3c473c['as'],'attributes':_0x3c473c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x144f44){logger[_0x8ffd('0x9')]('GetDeskAccount',_0x1675d4);logger['debug'](_0x8ffd('0x1a'),_0x1675d4,JSON[_0x8ffd('0xe')](_0x144f44));_0x4305c0(_0x144f44);})['catch'](function(_0x174c49){logger[_0x8ffd('0xf')](_0x8ffd('0x1a'),_0x174c49[_0x8ffd('0x11')],_0x1675d4);_0x5c7ad0(_0x57b3fa['error'](0x1f4,_0x174c49[_0x8ffd('0x11')]));});});};exports['ShowDeskAccount']=function(_0x201a0e){var _0x2441b0=this;return new Promise(function(_0x29462c,_0x57f9ee){return db[_0x8ffd('0x1b')]['find']({'raw':_0x201a0e[_0x8ffd('0x15')]?_0x201a0e[_0x8ffd('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x201a0e[_0x8ffd('0x15')]?_0x201a0e[_0x8ffd('0x15')][_0x8ffd('0x1c')]||null:null,'attributes':_0x201a0e['options']?_0x201a0e[_0x8ffd('0x15')][_0x8ffd('0x17')]||null:null,'include':_0x201a0e[_0x8ffd('0x15')]?_0x201a0e[_0x8ffd('0x15')][_0x8ffd('0x18')]?_['map'](_0x201a0e[_0x8ffd('0x15')][_0x8ffd('0x18')],function(_0x533a9d){return{'model':db[_0x533a9d[_0x8ffd('0x16')]],'as':_0x533a9d['as'],'attributes':_0x533a9d[_0x8ffd('0x17')],'include':_0x533a9d[_0x8ffd('0x18')]?_[_0x8ffd('0x19')](_0x533a9d[_0x8ffd('0x18')],function(_0x3d33cc){return{'model':db[_0x3d33cc[_0x8ffd('0x16')]],'as':_0x3d33cc['as'],'attributes':_0x3d33cc[_0x8ffd('0x17')],'include':_0x3d33cc[_0x8ffd('0x18')]?_[_0x8ffd('0x19')](_0x3d33cc[_0x8ffd('0x18')],function(_0x103429){return{'model':db[_0x103429[_0x8ffd('0x16')]],'as':_0x103429['as'],'attributes':_0x103429[_0x8ffd('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8ffd('0x8')](function(_0x356e2e){logger[_0x8ffd('0x9')](_0x8ffd('0x1d'),_0x201a0e);logger[_0x8ffd('0xc')](_0x8ffd('0x1d'),_0x201a0e,JSON[_0x8ffd('0xe')](_0x356e2e));_0x29462c(_0x356e2e);})[_0x8ffd('0x13')](function(_0x12a737){logger[_0x8ffd('0xf')](_0x8ffd('0x1d'),_0x12a737[_0x8ffd('0x11')],_0x201a0e);_0x57f9ee(_0x2441b0['error'](0x1f4,_0x12a737[_0x8ffd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 2c3e559..773e250 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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x4f9522,_0x399e9f){var _0x5a89a7=function(_0x853a9a){while(--_0x853a9a){_0x4f9522['push'](_0x4f9522['shift']());}};_0x5a89a7(++_0x399e9f);}(_0x55ca,0x126));var _0xa55c=function(_0x20463f,_0x4cc37a){_0x20463f=_0x20463f-0x0;var _0x143ee4=_0x55ca[_0x20463f];return _0x143ee4;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x725bd2,_0x5de588){var _0x295210=function(_0x20f4d8){while(--_0x20f4d8){_0x725bd2['push'](_0x725bd2['shift']());}};_0x295210(++_0x5de588);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 1508508..3cfc3d6 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 _0xde9a=['sequelize','STRING'];(function(_0x4b0dd4,_0x2ce831){var _0x1e1425=function(_0x2ef082){while(--_0x2ef082){_0x4b0dd4['push'](_0x4b0dd4['shift']());}};_0x1e1425(++_0x2ce831);}(_0xde9a,0x1c0));var _0xade9=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xde9a[_0x50a0c2];return _0x5ebadd;};'use strict';var Sequelize=require(_0xade9('0x0'));module['exports']={'name':{'type':Sequelize[_0xade9('0x1')]},'description':{'type':Sequelize[_0xade9('0x1')]}}; \ No newline at end of file +var _0x7fde=['STRING','sequelize','exports'];(function(_0x31ef5e,_0x2ab617){var _0x400b2b=function(_0x253638){while(--_0x253638){_0x31ef5e['push'](_0x31ef5e['shift']());}};_0x400b2b(++_0x2ab617);}(_0x7fde,0x163));var _0xe7fd=function(_0x5768f7,_0x1fe626){_0x5768f7=_0x5768f7-0x0;var _0x282a23=_0x7fde[_0x5768f7];return _0x282a23;};'use strict';var Sequelize=require(_0xe7fd('0x0'));module[_0xe7fd('0x1')]={'name':{'type':Sequelize[_0xe7fd('0x2')]},'description':{'type':Sequelize[_0xe7fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index c2d7ea9..ec8d81a 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 _0x0c71=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','set','Content-Range','save','then','destroy','error','name','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','map','options','DeskConfiguration','include','findAll','show','params','intersection','fields','length','includeAll','find','catch','body','getFields','findOne','DeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x3b3fd4,_0x349537){var _0x56715a=function(_0x255828){while(--_0x255828){_0x3b3fd4['push'](_0x3b3fd4['shift']());}};_0x56715a(++_0x349537);}(_0x0c71,0x89));var _0x10c7=function(_0x228a79,_0xf0a3d7){_0x228a79=_0x228a79-0x0;var _0x591998=_0x0c71[_0x228a79];return _0x591998;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x10c7('0x0'));var zipdir=require(_0x10c7('0x1'));var jsonpatch=require(_0x10c7('0x2'));var rp=require(_0x10c7('0x3'));var moment=require(_0x10c7('0x4'));var BPromise=require(_0x10c7('0x5'));var Mustache=require(_0x10c7('0x6'));var util=require(_0x10c7('0x7'));var path=require(_0x10c7('0x8'));var sox=require('sox');var csv=require(_0x10c7('0x9'));var ejs=require(_0x10c7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x10c7('0xb'));var squel=require(_0x10c7('0xc'));var crypto=require('crypto');var jsforce=require(_0x10c7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x10c7('0x9'));var querystring=require(_0x10c7('0xe'));var Papa=require(_0x10c7('0xf'));var Redis=require(_0x10c7('0x10'));var authService=require(_0x10c7('0x11'));var qs=require(_0x10c7('0x12'));var as=require(_0x10c7('0x13'));var hardwareService=require(_0x10c7('0x14'));var logger=require(_0x10c7('0x15'))(_0x10c7('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x10c7('0x17'));var db=require(_0x10c7('0x18'))['db'];function respondWithStatusCode(_0x5cffc4,_0x2943c0){_0x2943c0=_0x2943c0||0xcc;return function(_0x3c2a61){if(_0x3c2a61){return _0x5cffc4[_0x10c7('0x19')](_0x2943c0);}return _0x5cffc4[_0x10c7('0x1a')](_0x2943c0)[_0x10c7('0x1b')]();};}function respondWithResult(_0x424c3b,_0xb81aa){_0xb81aa=_0xb81aa||0xc8;return function(_0x4e5ca5){if(_0x4e5ca5){return _0x424c3b['status'](_0xb81aa)[_0x10c7('0x1c')](_0x4e5ca5);}};}function respondWithFilteredResult(_0x51b783,_0x58150f){return function(_0xb4a25e){if(_0xb4a25e){var _0x1681c9=typeof _0x58150f['offset']==='undefined'&&typeof _0x58150f[_0x10c7('0x1d')]===_0x10c7('0x1e');var _0x28d466=_0xb4a25e['count'];var _0xea657d=_0x1681c9?0x0:_0x58150f['offset'];var _0x2b55eb=_0x1681c9?_0xb4a25e[_0x10c7('0x1f')]:_0x58150f['offset']+_0x58150f[_0x10c7('0x1d')];var _0x38cffc;if(_0x2b55eb>=_0x28d466){_0x2b55eb=_0x28d466;_0x38cffc=0xc8;}else{_0x38cffc=0xce;}_0x51b783[_0x10c7('0x1a')](_0x38cffc);return _0x51b783[_0x10c7('0x20')](_0x10c7('0x21'),_0xea657d+'-'+_0x2b55eb+'/'+_0x28d466)[_0x10c7('0x1c')](_0xb4a25e);}return null;};}function patchUpdates(_0x2c01f0){return function(_0x421ca9){try{jsonpatch['apply'](_0x421ca9,_0x2c01f0,!![]);}catch(_0x117e0c){return BPromise['reject'](_0x117e0c);}return _0x421ca9[_0x10c7('0x22')]();};}function saveUpdates(_0x547f6d,_0x4a584a){return function(_0x1ce6aa){if(_0x1ce6aa){return _0x1ce6aa['update'](_0x547f6d)[_0x10c7('0x23')](function(_0x3e2e09){return _0x3e2e09;});}return null;};}function removeEntity(_0x2392b0,_0x802fc5){return function(_0x4c0681){if(_0x4c0681){return _0x4c0681[_0x10c7('0x24')]()[_0x10c7('0x23')](function(){_0x2392b0[_0x10c7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a2c3c,_0x33aa39){return function(_0x4ff84d){if(!_0x4ff84d){_0x5a2c3c[_0x10c7('0x19')](0x194);}return _0x4ff84d;};}function handleError(_0xe8abdf,_0x54d9cc){_0x54d9cc=_0x54d9cc||0x1f4;return function(_0x186032){logger[_0x10c7('0x25')](_0x186032['stack']);if(_0x186032[_0x10c7('0x26')]){delete _0x186032[_0x10c7('0x26')];}_0xe8abdf[_0x10c7('0x1a')](_0x54d9cc)['send'](_0x186032);};}exports['index']=function(_0xca44aa,_0x25dbcf){var _0x38ee5e={},_0x37b800={},_0x48dea1={'count':0x0,'rows':[]};var _0x3daef7=_['map'](db['DeskConfiguration'][_0x10c7('0x27')],function(_0xc5aea1){return{'name':_0xc5aea1[_0x10c7('0x28')],'type':_0xc5aea1[_0x10c7('0x29')][_0x10c7('0x2a')]};});_0x37b800['model']=_['map'](_0x3daef7,_0x10c7('0x26'));_0x37b800[_0x10c7('0x2b')]=_[_0x10c7('0x2c')](_0xca44aa[_0x10c7('0x2b')]);_0x37b800[_0x10c7('0x2d')]=_['intersection'](_0x37b800['model'],_0x37b800[_0x10c7('0x2b')]);_0x38ee5e['attributes']=_['intersection'](_0x37b800[_0x10c7('0x2e')],qs['fields'](_0xca44aa['query']['fields']));_0x38ee5e[_0x10c7('0x2f')]=_0x38ee5e['attributes']['length']?_0x38ee5e[_0x10c7('0x2f')]:_0x37b800[_0x10c7('0x2e')];if(!_0xca44aa['query'][_0x10c7('0x30')](_0x10c7('0x31'))){_0x38ee5e[_0x10c7('0x1d')]=qs['limit'](_0xca44aa[_0x10c7('0x2b')][_0x10c7('0x1d')]);_0x38ee5e[_0x10c7('0x32')]=qs[_0x10c7('0x32')](_0xca44aa[_0x10c7('0x2b')][_0x10c7('0x32')]);}_0x38ee5e[_0x10c7('0x33')]=qs[_0x10c7('0x34')](_0xca44aa[_0x10c7('0x2b')][_0x10c7('0x34')]);_0x38ee5e[_0x10c7('0x35')]=qs['filters'](_[_0x10c7('0x36')](_0xca44aa['query'],_0x37b800[_0x10c7('0x2d')]),_0x3daef7);if(_0xca44aa[_0x10c7('0x2b')][_0x10c7('0x37')]){_0x38ee5e[_0x10c7('0x35')]=_[_0x10c7('0x38')](_0x38ee5e[_0x10c7('0x35')],{'$or':_[_0x10c7('0x39')](_0x3daef7,function(_0xe2c57c){if(_0xe2c57c[_0x10c7('0x29')]!=='VIRTUAL'){var _0x2c5d71={};_0x2c5d71[_0xe2c57c[_0x10c7('0x26')]]={'$like':'%'+_0xca44aa[_0x10c7('0x2b')]['filter']+'%'};return _0x2c5d71;}})});}_0x38ee5e=_[_0x10c7('0x38')]({},_0x38ee5e,_0xca44aa[_0x10c7('0x3a')]);var _0xa956a5={'where':_0x38ee5e[_0x10c7('0x35')]};return db[_0x10c7('0x3b')]['count'](_0xa956a5)['then'](function(_0x362e8a){_0x48dea1[_0x10c7('0x1f')]=_0x362e8a;if(_0xca44aa[_0x10c7('0x2b')]['includeAll']){_0x38ee5e[_0x10c7('0x3c')]=[{'all':!![]}];}return db[_0x10c7('0x3b')][_0x10c7('0x3d')](_0x38ee5e);})['then'](function(_0x886b03){_0x48dea1['rows']=_0x886b03;return _0x48dea1;})[_0x10c7('0x23')](respondWithFilteredResult(_0x25dbcf,_0x38ee5e))['catch'](handleError(_0x25dbcf,null));};exports[_0x10c7('0x3e')]=function(_0x5173d6,_0x3650cb){var _0x3a4349={'raw':![],'where':{'id':_0x5173d6[_0x10c7('0x3f')]['id']}},_0x56dbda={};_0x56dbda[_0x10c7('0x2e')]=_[_0x10c7('0x2c')](db[_0x10c7('0x3b')][_0x10c7('0x27')]);_0x56dbda['query']=_[_0x10c7('0x2c')](_0x5173d6[_0x10c7('0x2b')]);_0x56dbda[_0x10c7('0x2d')]=_['intersection'](_0x56dbda[_0x10c7('0x2e')],_0x56dbda[_0x10c7('0x2b')]);_0x3a4349[_0x10c7('0x2f')]=_[_0x10c7('0x40')](_0x56dbda['model'],qs['fields'](_0x5173d6[_0x10c7('0x2b')][_0x10c7('0x41')]));_0x3a4349[_0x10c7('0x2f')]=_0x3a4349['attributes'][_0x10c7('0x42')]?_0x3a4349[_0x10c7('0x2f')]:_0x56dbda[_0x10c7('0x2e')];if(_0x5173d6[_0x10c7('0x2b')][_0x10c7('0x43')]){_0x3a4349[_0x10c7('0x3c')]=[{'all':!![]}];}_0x3a4349=_[_0x10c7('0x38')]({},_0x3a4349,_0x5173d6['options']);return db[_0x10c7('0x3b')][_0x10c7('0x44')](_0x3a4349)[_0x10c7('0x23')](handleEntityNotFound(_0x3650cb,null))[_0x10c7('0x23')](respondWithResult(_0x3650cb,null))[_0x10c7('0x45')](handleError(_0x3650cb,null));};exports['create']=function(_0x513e62,_0x2730a6){return db[_0x10c7('0x3b')]['create'](_0x513e62[_0x10c7('0x46')],{})[_0x10c7('0x23')](respondWithResult(_0x2730a6,0xc9))['catch'](handleError(_0x2730a6,null));};exports['update']=function(_0x5a508a,_0x227061){if(_0x5a508a['body']['id']){delete _0x5a508a[_0x10c7('0x46')]['id'];}return db[_0x10c7('0x3b')][_0x10c7('0x44')]({'where':{'id':_0x5a508a[_0x10c7('0x3f')]['id']}})['then'](handleEntityNotFound(_0x227061,null))[_0x10c7('0x23')](saveUpdates(_0x5a508a['body'],null))[_0x10c7('0x23')](respondWithResult(_0x227061,null))[_0x10c7('0x45')](handleError(_0x227061,null));};exports[_0x10c7('0x24')]=function(_0x4f80d2,_0x2f6773){return db[_0x10c7('0x3b')]['find']({'where':{'id':_0x4f80d2['params']['id']}})['then'](handleEntityNotFound(_0x2f6773,null))[_0x10c7('0x23')](removeEntity(_0x2f6773,null))[_0x10c7('0x45')](handleError(_0x2f6773,null));};exports[_0x10c7('0x47')]=function(_0x50590f,_0x8a2857,_0xae2c5f){var _0x179065={};var _0x46a1a0={};var _0x5f0c1f;var _0xd2e08;return db['DeskConfiguration'][_0x10c7('0x48')]({'where':{'id':_0x50590f[_0x10c7('0x3f')]['id']}})['then'](handleEntityNotFound(_0x8a2857,null))['then'](function(_0x3d67f1){if(_0x3d67f1){_0x5f0c1f=_0x3d67f1;_0x46a1a0[_0x10c7('0x2e')]=_[_0x10c7('0x2c')](db[_0x10c7('0x49')][_0x10c7('0x27')]);_0x46a1a0['query']=_[_0x10c7('0x2c')](_0x50590f['query']);_0x46a1a0[_0x10c7('0x2d')]=_[_0x10c7('0x40')](_0x46a1a0['model'],_0x46a1a0[_0x10c7('0x2b')]);_0x179065[_0x10c7('0x2f')]=_[_0x10c7('0x40')](_0x46a1a0['model'],qs[_0x10c7('0x41')](_0x50590f[_0x10c7('0x2b')][_0x10c7('0x41')]));_0x179065['attributes']=_0x179065[_0x10c7('0x2f')][_0x10c7('0x42')]?_0x179065[_0x10c7('0x2f')]:_0x46a1a0[_0x10c7('0x2e')];_0x179065['order']=qs['sort'](_0x50590f[_0x10c7('0x2b')]['sort']);_0x179065[_0x10c7('0x35')]=qs[_0x10c7('0x2d')](_['pick'](_0x50590f['query'],_0x46a1a0['filters']));if(_0x50590f[_0x10c7('0x2b')][_0x10c7('0x37')]){_0x179065[_0x10c7('0x35')]=_['merge'](_0x179065['where'],{'$or':_[_0x10c7('0x39')](_0x179065[_0x10c7('0x2f')],function(_0x1884bc){var _0x28c6f2={};_0x28c6f2[_0x1884bc]={'$like':'%'+_0x50590f[_0x10c7('0x2b')][_0x10c7('0x37')]+'%'};return _0x28c6f2;})});}_0x179065=_[_0x10c7('0x38')]({},_0x179065,_0x50590f[_0x10c7('0x3a')]);return _0x5f0c1f['getFields'](_0x179065);}})[_0x10c7('0x23')](function(_0x577cf0){if(_0x577cf0){_0xd2e08=_0x577cf0[_0x10c7('0x42')];if(!_0x50590f[_0x10c7('0x2b')]['hasOwnProperty'](_0x10c7('0x31'))){_0x179065['limit']=qs[_0x10c7('0x1d')](_0x50590f[_0x10c7('0x2b')][_0x10c7('0x1d')]);_0x179065['offset']=qs['offset'](_0x50590f[_0x10c7('0x2b')][_0x10c7('0x32')]);}return _0x5f0c1f['getFields'](_0x179065);}})[_0x10c7('0x23')](function(_0x4d143f){if(_0x4d143f){return _0x4d143f?{'count':_0xd2e08,'rows':_0x4d143f}:null;}})['then'](respondWithResult(_0x8a2857,null))[_0x10c7('0x45')](handleError(_0x8a2857,null));};exports[_0x10c7('0x4a')]=function(_0x3ed9a1,_0x3ad76c,_0xe9cf4b){var _0x393023={};var _0xc23deb={};var _0x42563a;var _0x5f15e1;return db['DeskConfiguration'][_0x10c7('0x48')]({'where':{'id':_0x3ed9a1[_0x10c7('0x3f')]['id']}})[_0x10c7('0x23')](handleEntityNotFound(_0x3ad76c,null))[_0x10c7('0x23')](function(_0x75c09e){if(_0x75c09e){_0x42563a=_0x75c09e;_0xc23deb[_0x10c7('0x2e')]=_['keys'](db['DeskField']['rawAttributes']);_0xc23deb[_0x10c7('0x2b')]=_[_0x10c7('0x2c')](_0x3ed9a1[_0x10c7('0x2b')]);_0xc23deb[_0x10c7('0x2d')]=_[_0x10c7('0x40')](_0xc23deb[_0x10c7('0x2e')],_0xc23deb[_0x10c7('0x2b')]);_0x393023['attributes']=_[_0x10c7('0x40')](_0xc23deb[_0x10c7('0x2e')],qs[_0x10c7('0x41')](_0x3ed9a1[_0x10c7('0x2b')][_0x10c7('0x41')]));_0x393023[_0x10c7('0x2f')]=_0x393023[_0x10c7('0x2f')][_0x10c7('0x42')]?_0x393023[_0x10c7('0x2f')]:_0xc23deb[_0x10c7('0x2e')];_0x393023['order']=qs[_0x10c7('0x34')](_0x3ed9a1['query'][_0x10c7('0x34')]);_0x393023['where']=qs[_0x10c7('0x2d')](_[_0x10c7('0x36')](_0x3ed9a1[_0x10c7('0x2b')],_0xc23deb[_0x10c7('0x2d')]));if(_0x3ed9a1['query'][_0x10c7('0x37')]){_0x393023[_0x10c7('0x35')]=_[_0x10c7('0x38')](_0x393023[_0x10c7('0x35')],{'$or':_[_0x10c7('0x39')](_0x393023[_0x10c7('0x2f')],function(_0x1e5a7b){var _0x4339f2={};_0x4339f2[_0x1e5a7b]={'$like':'%'+_0x3ed9a1[_0x10c7('0x2b')][_0x10c7('0x37')]+'%'};return _0x4339f2;})});}_0x393023=_['merge']({},_0x393023,_0x3ed9a1[_0x10c7('0x3a')]);return _0x42563a['getSubjects'](_0x393023);}})[_0x10c7('0x23')](function(_0x17a14f){if(_0x17a14f){_0x5f15e1=_0x17a14f[_0x10c7('0x42')];if(!_0x3ed9a1[_0x10c7('0x2b')][_0x10c7('0x30')]('nolimit')){_0x393023[_0x10c7('0x1d')]=qs[_0x10c7('0x1d')](_0x3ed9a1[_0x10c7('0x2b')]['limit']);_0x393023[_0x10c7('0x32')]=qs[_0x10c7('0x32')](_0x3ed9a1[_0x10c7('0x2b')]['offset']);}return _0x42563a[_0x10c7('0x4a')](_0x393023);}})[_0x10c7('0x23')](function(_0x2623bd){if(_0x2623bd){return _0x2623bd?{'count':_0x5f15e1,'rows':_0x2623bd}:null;}})[_0x10c7('0x23')](respondWithResult(_0x3ad76c,null))['catch'](handleError(_0x3ad76c,null));};exports[_0x10c7('0x4b')]=function(_0x3b8e48,_0x69a8f8,_0x2fb72f){var _0x4069fb={};var _0x360f8e={};var _0x267219;var _0x57399e;return db['DeskConfiguration'][_0x10c7('0x48')]({'where':{'id':_0x3b8e48[_0x10c7('0x3f')]['id']}})['then'](handleEntityNotFound(_0x69a8f8,null))['then'](function(_0x5e92a3){if(_0x5e92a3){_0x267219=_0x5e92a3;_0x360f8e[_0x10c7('0x2e')]=_['keys'](db[_0x10c7('0x49')][_0x10c7('0x27')]);_0x360f8e[_0x10c7('0x2b')]=_[_0x10c7('0x2c')](_0x3b8e48[_0x10c7('0x2b')]);_0x360f8e['filters']=_[_0x10c7('0x40')](_0x360f8e[_0x10c7('0x2e')],_0x360f8e[_0x10c7('0x2b')]);_0x4069fb['attributes']=_[_0x10c7('0x40')](_0x360f8e[_0x10c7('0x2e')],qs[_0x10c7('0x41')](_0x3b8e48['query'][_0x10c7('0x41')]));_0x4069fb[_0x10c7('0x2f')]=_0x4069fb[_0x10c7('0x2f')]['length']?_0x4069fb['attributes']:_0x360f8e[_0x10c7('0x2e')];_0x4069fb[_0x10c7('0x33')]=qs[_0x10c7('0x34')](_0x3b8e48[_0x10c7('0x2b')][_0x10c7('0x34')]);_0x4069fb[_0x10c7('0x35')]=qs[_0x10c7('0x2d')](_[_0x10c7('0x36')](_0x3b8e48['query'],_0x360f8e[_0x10c7('0x2d')]));if(_0x3b8e48[_0x10c7('0x2b')][_0x10c7('0x37')]){_0x4069fb['where']=_[_0x10c7('0x38')](_0x4069fb[_0x10c7('0x35')],{'$or':_['map'](_0x4069fb[_0x10c7('0x2f')],function(_0x442661){var _0x160ca4={};_0x160ca4[_0x442661]={'$like':'%'+_0x3b8e48['query'][_0x10c7('0x37')]+'%'};return _0x160ca4;})});}_0x4069fb=_['merge']({},_0x4069fb,_0x3b8e48[_0x10c7('0x3a')]);return _0x267219['getDescriptions'](_0x4069fb);}})[_0x10c7('0x23')](function(_0x3d98c2){if(_0x3d98c2){_0x57399e=_0x3d98c2[_0x10c7('0x42')];if(!_0x3b8e48['query'][_0x10c7('0x30')]('nolimit')){_0x4069fb['limit']=qs[_0x10c7('0x1d')](_0x3b8e48[_0x10c7('0x2b')][_0x10c7('0x1d')]);_0x4069fb['offset']=qs['offset'](_0x3b8e48['query'][_0x10c7('0x32')]);}return _0x267219[_0x10c7('0x4b')](_0x4069fb);}})[_0x10c7('0x23')](function(_0x61bfbc){if(_0x61bfbc){return _0x61bfbc?{'count':_0x57399e,'rows':_0x61bfbc}:null;}})[_0x10c7('0x23')](respondWithResult(_0x69a8f8,null))[_0x10c7('0x45')](handleError(_0x69a8f8,null));};exports['getTags']=function(_0x5a3417,_0x1e11e9,_0x4f981b){var _0x4af2c6={};var _0x41dd45={};var _0x1a724b;var _0x91bf35;return db['DeskConfiguration'][_0x10c7('0x48')]({'where':{'id':_0x5a3417['params']['id']}})[_0x10c7('0x23')](handleEntityNotFound(_0x1e11e9,null))[_0x10c7('0x23')](function(_0x46449c){if(_0x46449c){_0x1a724b=_0x46449c;_0x41dd45[_0x10c7('0x2e')]=_[_0x10c7('0x2c')](db[_0x10c7('0x4c')][_0x10c7('0x27')]);_0x41dd45[_0x10c7('0x2b')]=_[_0x10c7('0x2c')](_0x5a3417[_0x10c7('0x2b')]);_0x41dd45[_0x10c7('0x2d')]=_[_0x10c7('0x40')](_0x41dd45[_0x10c7('0x2e')],_0x41dd45['query']);_0x4af2c6[_0x10c7('0x2f')]=_[_0x10c7('0x40')](_0x41dd45['model'],qs[_0x10c7('0x41')](_0x5a3417[_0x10c7('0x2b')][_0x10c7('0x41')]));_0x4af2c6[_0x10c7('0x2f')]=_0x4af2c6[_0x10c7('0x2f')]['length']?_0x4af2c6[_0x10c7('0x2f')]:_0x41dd45[_0x10c7('0x2e')];_0x4af2c6['order']=qs[_0x10c7('0x34')](_0x5a3417['query'][_0x10c7('0x34')]);_0x4af2c6[_0x10c7('0x35')]=qs[_0x10c7('0x2d')](_[_0x10c7('0x36')](_0x5a3417[_0x10c7('0x2b')],_0x41dd45[_0x10c7('0x2d')]));if(_0x5a3417[_0x10c7('0x2b')][_0x10c7('0x37')]){_0x4af2c6['where']=_[_0x10c7('0x38')](_0x4af2c6[_0x10c7('0x35')],{'$or':_[_0x10c7('0x39')](_0x4af2c6['attributes'],function(_0x3c4bc1){var _0x40b48d={};_0x40b48d[_0x3c4bc1]={'$like':'%'+_0x5a3417['query'][_0x10c7('0x37')]+'%'};return _0x40b48d;})});}_0x4af2c6=_[_0x10c7('0x38')]({},_0x4af2c6,_0x5a3417[_0x10c7('0x3a')]);return _0x1a724b['getTags'](_0x4af2c6);}})[_0x10c7('0x23')](function(_0x97ea07){if(_0x97ea07){_0x91bf35=_0x97ea07[_0x10c7('0x42')];if(!_0x5a3417['query'][_0x10c7('0x30')](_0x10c7('0x31'))){_0x4af2c6[_0x10c7('0x1d')]=qs[_0x10c7('0x1d')](_0x5a3417[_0x10c7('0x2b')][_0x10c7('0x1d')]);_0x4af2c6[_0x10c7('0x32')]=qs[_0x10c7('0x32')](_0x5a3417[_0x10c7('0x2b')][_0x10c7('0x32')]);}return _0x1a724b[_0x10c7('0x4d')](_0x4af2c6);}})[_0x10c7('0x23')](function(_0x5f0acb){if(_0x5f0acb){return _0x5f0acb?{'count':_0x91bf35,'rows':_0x5f0acb}:null;}})[_0x10c7('0x23')](respondWithResult(_0x1e11e9,null))[_0x10c7('0x45')](handleError(_0x1e11e9,null));};exports[_0x10c7('0x4e')]=function(_0x5773a4,_0x3d17b3,_0x52de7e){if(_0x5773a4[_0x10c7('0x46')]['id']){delete _0x5773a4[_0x10c7('0x46')]['id'];}return db['DeskConfiguration'][_0x10c7('0x48')]({'where':{'id':_0x5773a4[_0x10c7('0x3f')]['id']}})[_0x10c7('0x23')](handleEntityNotFound(_0x3d17b3,null))[_0x10c7('0x23')](function(_0x28edc8){if(_0x28edc8){return _0x28edc8[_0x10c7('0x4e')](_0x5773a4[_0x10c7('0x46')][_0x10c7('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x3d17b3,null))[_0x10c7('0x45')](handleError(_0x3d17b3,null));}; \ No newline at end of file +var _0xcc4c=['path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','DeskConfiguration','include','findAll','rows','catch','show','params','includeAll','create','body','findOne','length','getFields','getSubjects','DeskField','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util'];(function(_0x48e71b,_0x3c7a1b){var _0x13958d=function(_0x33cce6){while(--_0x33cce6){_0x48e71b['push'](_0x48e71b['shift']());}};_0x13958d(++_0x3c7a1b);}(_0xcc4c,0x1df));var _0xccc4=function(_0x3db461,_0x482b14){_0x3db461=_0x3db461-0x0;var _0x412557=_0xcc4c[_0x3db461];return _0x412557;};'use strict';var emlformat=require(_0xccc4('0x0'));var rimraf=require(_0xccc4('0x1'));var zipdir=require(_0xccc4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xccc4('0x3'));var BPromise=require(_0xccc4('0x4'));var Mustache=require(_0xccc4('0x5'));var util=require(_0xccc4('0x6'));var path=require(_0xccc4('0x7'));var sox=require(_0xccc4('0x8'));var csv=require('to-csv');var ejs=require(_0xccc4('0x9'));var fs=require('fs');var fs_extra=require(_0xccc4('0xa'));var _=require(_0xccc4('0xb'));var squel=require(_0xccc4('0xc'));var crypto=require(_0xccc4('0xd'));var jsforce=require(_0xccc4('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xccc4('0xf'));var Redis=require(_0xccc4('0x10'));var authService=require(_0xccc4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xccc4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xccc4('0x13'))(_0xccc4('0x14'));var utils=require('../../config/utils');var config=require(_0xccc4('0x15'));var licenseUtil=require(_0xccc4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x138188,_0x2d5dc0){_0x2d5dc0=_0x2d5dc0||0xcc;return function(_0x1da20a){if(_0x1da20a){return _0x138188['sendStatus'](_0x2d5dc0);}return _0x138188[_0xccc4('0x17')](_0x2d5dc0)[_0xccc4('0x18')]();};}function respondWithResult(_0x474067,_0x428372){_0x428372=_0x428372||0xc8;return function(_0x5d28d0){if(_0x5d28d0){return _0x474067['status'](_0x428372)[_0xccc4('0x19')](_0x5d28d0);}};}function respondWithFilteredResult(_0x5dff56,_0x5a4993){return function(_0x497c5c){if(_0x497c5c){var _0x35c320=typeof _0x5a4993['offset']===_0xccc4('0x1a')&&typeof _0x5a4993['limit']==='undefined';var _0x48f9dc=_0x497c5c[_0xccc4('0x1b')];var _0x1242fe=_0x35c320?0x0:_0x5a4993['offset'];var _0x170495=_0x35c320?_0x497c5c['count']:_0x5a4993[_0xccc4('0x1c')]+_0x5a4993[_0xccc4('0x1d')];var _0x48e8a3;if(_0x170495>=_0x48f9dc){_0x170495=_0x48f9dc;_0x48e8a3=0xc8;}else{_0x48e8a3=0xce;}_0x5dff56['status'](_0x48e8a3);return _0x5dff56[_0xccc4('0x1e')](_0xccc4('0x1f'),_0x1242fe+'-'+_0x170495+'/'+_0x48f9dc)[_0xccc4('0x19')](_0x497c5c);}return null;};}function patchUpdates(_0xf0b1a9){return function(_0x5391e0){try{jsonpatch[_0xccc4('0x20')](_0x5391e0,_0xf0b1a9,!![]);}catch(_0x5d3db4){return BPromise[_0xccc4('0x21')](_0x5d3db4);}return _0x5391e0['save']();};}function saveUpdates(_0x233fc0,_0x54825c){return function(_0xd4b8f){if(_0xd4b8f){return _0xd4b8f[_0xccc4('0x22')](_0x233fc0)[_0xccc4('0x23')](function(_0x9de834){return _0x9de834;});}return null;};}function removeEntity(_0x352cd1,_0x1dec46){return function(_0xb82492){if(_0xb82492){return _0xb82492[_0xccc4('0x24')]()[_0xccc4('0x23')](function(){_0x352cd1[_0xccc4('0x17')](0xcc)[_0xccc4('0x18')]();});}};}function handleEntityNotFound(_0x544cc2,_0x3ccc8e){return function(_0xbd8531){if(!_0xbd8531){_0x544cc2['sendStatus'](0x194);}return _0xbd8531;};}function handleError(_0x48b804,_0xbfde0c){_0xbfde0c=_0xbfde0c||0x1f4;return function(_0x44e825){logger[_0xccc4('0x25')](_0x44e825[_0xccc4('0x26')]);if(_0x44e825[_0xccc4('0x27')]){delete _0x44e825[_0xccc4('0x27')];}_0x48b804[_0xccc4('0x17')](_0xbfde0c)[_0xccc4('0x28')](_0x44e825);};}exports['index']=function(_0x82b90d,_0x46481d){var _0x344b2c={},_0x2c4eac={},_0x1b499d={'count':0x0,'rows':[]};var _0x323db0=_[_0xccc4('0x29')](db['DeskConfiguration'][_0xccc4('0x2a')],function(_0x5f5566){return{'name':_0x5f5566[_0xccc4('0x2b')],'type':_0x5f5566[_0xccc4('0x2c')]['key']};});_0x2c4eac['model']=_['map'](_0x323db0,'name');_0x2c4eac[_0xccc4('0x2d')]=_[_0xccc4('0x2e')](_0x82b90d[_0xccc4('0x2d')]);_0x2c4eac[_0xccc4('0x2f')]=_[_0xccc4('0x30')](_0x2c4eac['model'],_0x2c4eac[_0xccc4('0x2d')]);_0x344b2c[_0xccc4('0x31')]=_[_0xccc4('0x30')](_0x2c4eac['model'],qs[_0xccc4('0x32')](_0x82b90d[_0xccc4('0x2d')][_0xccc4('0x32')]));_0x344b2c['attributes']=_0x344b2c[_0xccc4('0x31')]['length']?_0x344b2c[_0xccc4('0x31')]:_0x2c4eac[_0xccc4('0x33')];if(!_0x82b90d[_0xccc4('0x2d')][_0xccc4('0x34')](_0xccc4('0x35'))){_0x344b2c[_0xccc4('0x1d')]=qs[_0xccc4('0x1d')](_0x82b90d[_0xccc4('0x2d')][_0xccc4('0x1d')]);_0x344b2c[_0xccc4('0x1c')]=qs[_0xccc4('0x1c')](_0x82b90d[_0xccc4('0x2d')]['offset']);}_0x344b2c[_0xccc4('0x36')]=qs[_0xccc4('0x37')](_0x82b90d[_0xccc4('0x2d')]['sort']);_0x344b2c[_0xccc4('0x38')]=qs['filters'](_[_0xccc4('0x39')](_0x82b90d[_0xccc4('0x2d')],_0x2c4eac[_0xccc4('0x2f')]),_0x323db0);if(_0x82b90d[_0xccc4('0x2d')][_0xccc4('0x3a')]){_0x344b2c[_0xccc4('0x38')]=_[_0xccc4('0x3b')](_0x344b2c[_0xccc4('0x38')],{'$or':_['map'](_0x323db0,function(_0x354fa4){if(_0x354fa4[_0xccc4('0x2c')]!=='VIRTUAL'){var _0x46602c={};_0x46602c[_0x354fa4['name']]={'$like':'%'+_0x82b90d[_0xccc4('0x2d')]['filter']+'%'};return _0x46602c;}})});}_0x344b2c=_['merge']({},_0x344b2c,_0x82b90d[_0xccc4('0x3c')]);var _0x4771b3={'where':_0x344b2c[_0xccc4('0x38')]};return db[_0xccc4('0x3d')][_0xccc4('0x1b')](_0x4771b3)[_0xccc4('0x23')](function(_0x38ea44){_0x1b499d[_0xccc4('0x1b')]=_0x38ea44;if(_0x82b90d[_0xccc4('0x2d')]['includeAll']){_0x344b2c[_0xccc4('0x3e')]=[{'all':!![]}];}return db[_0xccc4('0x3d')][_0xccc4('0x3f')](_0x344b2c);})[_0xccc4('0x23')](function(_0x453293){_0x1b499d[_0xccc4('0x40')]=_0x453293;return _0x1b499d;})['then'](respondWithFilteredResult(_0x46481d,_0x344b2c))[_0xccc4('0x41')](handleError(_0x46481d,null));};exports[_0xccc4('0x42')]=function(_0x194264,_0x190aa2){var _0x59c26c={'raw':![],'where':{'id':_0x194264[_0xccc4('0x43')]['id']}},_0x2315c0={};_0x2315c0['model']=_['keys'](db[_0xccc4('0x3d')]['rawAttributes']);_0x2315c0[_0xccc4('0x2d')]=_['keys'](_0x194264[_0xccc4('0x2d')]);_0x2315c0['filters']=_[_0xccc4('0x30')](_0x2315c0[_0xccc4('0x33')],_0x2315c0[_0xccc4('0x2d')]);_0x59c26c['attributes']=_['intersection'](_0x2315c0['model'],qs[_0xccc4('0x32')](_0x194264[_0xccc4('0x2d')][_0xccc4('0x32')]));_0x59c26c['attributes']=_0x59c26c[_0xccc4('0x31')]['length']?_0x59c26c[_0xccc4('0x31')]:_0x2315c0['model'];if(_0x194264['query'][_0xccc4('0x44')]){_0x59c26c[_0xccc4('0x3e')]=[{'all':!![]}];}_0x59c26c=_['merge']({},_0x59c26c,_0x194264[_0xccc4('0x3c')]);return db[_0xccc4('0x3d')]['find'](_0x59c26c)[_0xccc4('0x23')](handleEntityNotFound(_0x190aa2,null))[_0xccc4('0x23')](respondWithResult(_0x190aa2,null))[_0xccc4('0x41')](handleError(_0x190aa2,null));};exports['create']=function(_0xfbd34e,_0x64be79){return db[_0xccc4('0x3d')][_0xccc4('0x45')](_0xfbd34e[_0xccc4('0x46')],{})[_0xccc4('0x23')](respondWithResult(_0x64be79,0xc9))[_0xccc4('0x41')](handleError(_0x64be79,null));};exports['update']=function(_0x45af95,_0x47e32d){if(_0x45af95[_0xccc4('0x46')]['id']){delete _0x45af95[_0xccc4('0x46')]['id'];}return db[_0xccc4('0x3d')]['find']({'where':{'id':_0x45af95[_0xccc4('0x43')]['id']}})[_0xccc4('0x23')](handleEntityNotFound(_0x47e32d,null))[_0xccc4('0x23')](saveUpdates(_0x45af95[_0xccc4('0x46')],null))['then'](respondWithResult(_0x47e32d,null))[_0xccc4('0x41')](handleError(_0x47e32d,null));};exports[_0xccc4('0x24')]=function(_0xa1e1dd,_0x512e10){return db[_0xccc4('0x3d')]['find']({'where':{'id':_0xa1e1dd['params']['id']}})[_0xccc4('0x23')](handleEntityNotFound(_0x512e10,null))[_0xccc4('0x23')](removeEntity(_0x512e10,null))[_0xccc4('0x41')](handleError(_0x512e10,null));};exports['getFields']=function(_0x5005ce,_0x29361c,_0x475dce){var _0x1fa36f={};var _0x49a4ce={};var _0x18122e;var _0x9f6147;return db[_0xccc4('0x3d')][_0xccc4('0x47')]({'where':{'id':_0x5005ce[_0xccc4('0x43')]['id']}})[_0xccc4('0x23')](handleEntityNotFound(_0x29361c,null))[_0xccc4('0x23')](function(_0x3f75c9){if(_0x3f75c9){_0x18122e=_0x3f75c9;_0x49a4ce['model']=_['keys'](db['DeskField'][_0xccc4('0x2a')]);_0x49a4ce[_0xccc4('0x2d')]=_['keys'](_0x5005ce[_0xccc4('0x2d')]);_0x49a4ce[_0xccc4('0x2f')]=_['intersection'](_0x49a4ce[_0xccc4('0x33')],_0x49a4ce[_0xccc4('0x2d')]);_0x1fa36f[_0xccc4('0x31')]=_[_0xccc4('0x30')](_0x49a4ce['model'],qs[_0xccc4('0x32')](_0x5005ce[_0xccc4('0x2d')][_0xccc4('0x32')]));_0x1fa36f[_0xccc4('0x31')]=_0x1fa36f[_0xccc4('0x31')][_0xccc4('0x48')]?_0x1fa36f[_0xccc4('0x31')]:_0x49a4ce[_0xccc4('0x33')];_0x1fa36f[_0xccc4('0x36')]=qs[_0xccc4('0x37')](_0x5005ce[_0xccc4('0x2d')][_0xccc4('0x37')]);_0x1fa36f[_0xccc4('0x38')]=qs['filters'](_[_0xccc4('0x39')](_0x5005ce[_0xccc4('0x2d')],_0x49a4ce[_0xccc4('0x2f')]));if(_0x5005ce['query'][_0xccc4('0x3a')]){_0x1fa36f['where']=_['merge'](_0x1fa36f['where'],{'$or':_[_0xccc4('0x29')](_0x1fa36f[_0xccc4('0x31')],function(_0x23a3b5){var _0x1f1301={};_0x1f1301[_0x23a3b5]={'$like':'%'+_0x5005ce[_0xccc4('0x2d')]['filter']+'%'};return _0x1f1301;})});}_0x1fa36f=_[_0xccc4('0x3b')]({},_0x1fa36f,_0x5005ce[_0xccc4('0x3c')]);return _0x18122e[_0xccc4('0x49')](_0x1fa36f);}})['then'](function(_0x42634d){if(_0x42634d){_0x9f6147=_0x42634d[_0xccc4('0x48')];if(!_0x5005ce[_0xccc4('0x2d')][_0xccc4('0x34')](_0xccc4('0x35'))){_0x1fa36f[_0xccc4('0x1d')]=qs[_0xccc4('0x1d')](_0x5005ce[_0xccc4('0x2d')][_0xccc4('0x1d')]);_0x1fa36f[_0xccc4('0x1c')]=qs[_0xccc4('0x1c')](_0x5005ce[_0xccc4('0x2d')][_0xccc4('0x1c')]);}return _0x18122e[_0xccc4('0x49')](_0x1fa36f);}})[_0xccc4('0x23')](function(_0x7ae72){if(_0x7ae72){return _0x7ae72?{'count':_0x9f6147,'rows':_0x7ae72}:null;}})[_0xccc4('0x23')](respondWithResult(_0x29361c,null))[_0xccc4('0x41')](handleError(_0x29361c,null));};exports[_0xccc4('0x4a')]=function(_0x2e6c5a,_0x42484c,_0x1f2f8a){var _0x46f07d={};var _0x82c5e0={};var _0x36537e;var _0x265efe;return db['DeskConfiguration']['findOne']({'where':{'id':_0x2e6c5a[_0xccc4('0x43')]['id']}})[_0xccc4('0x23')](handleEntityNotFound(_0x42484c,null))[_0xccc4('0x23')](function(_0x24e5dd){if(_0x24e5dd){_0x36537e=_0x24e5dd;_0x82c5e0[_0xccc4('0x33')]=_['keys'](db[_0xccc4('0x4b')]['rawAttributes']);_0x82c5e0[_0xccc4('0x2d')]=_[_0xccc4('0x2e')](_0x2e6c5a['query']);_0x82c5e0[_0xccc4('0x2f')]=_[_0xccc4('0x30')](_0x82c5e0[_0xccc4('0x33')],_0x82c5e0[_0xccc4('0x2d')]);_0x46f07d[_0xccc4('0x31')]=_[_0xccc4('0x30')](_0x82c5e0[_0xccc4('0x33')],qs[_0xccc4('0x32')](_0x2e6c5a['query'][_0xccc4('0x32')]));_0x46f07d['attributes']=_0x46f07d[_0xccc4('0x31')]['length']?_0x46f07d[_0xccc4('0x31')]:_0x82c5e0[_0xccc4('0x33')];_0x46f07d[_0xccc4('0x36')]=qs[_0xccc4('0x37')](_0x2e6c5a[_0xccc4('0x2d')][_0xccc4('0x37')]);_0x46f07d['where']=qs[_0xccc4('0x2f')](_[_0xccc4('0x39')](_0x2e6c5a['query'],_0x82c5e0['filters']));if(_0x2e6c5a[_0xccc4('0x2d')][_0xccc4('0x3a')]){_0x46f07d[_0xccc4('0x38')]=_[_0xccc4('0x3b')](_0x46f07d['where'],{'$or':_[_0xccc4('0x29')](_0x46f07d['attributes'],function(_0x4f2c30){var _0x555292={};_0x555292[_0x4f2c30]={'$like':'%'+_0x2e6c5a[_0xccc4('0x2d')][_0xccc4('0x3a')]+'%'};return _0x555292;})});}_0x46f07d=_['merge']({},_0x46f07d,_0x2e6c5a['options']);return _0x36537e['getSubjects'](_0x46f07d);}})[_0xccc4('0x23')](function(_0x102077){if(_0x102077){_0x265efe=_0x102077['length'];if(!_0x2e6c5a[_0xccc4('0x2d')][_0xccc4('0x34')](_0xccc4('0x35'))){_0x46f07d[_0xccc4('0x1d')]=qs['limit'](_0x2e6c5a[_0xccc4('0x2d')][_0xccc4('0x1d')]);_0x46f07d[_0xccc4('0x1c')]=qs[_0xccc4('0x1c')](_0x2e6c5a[_0xccc4('0x2d')][_0xccc4('0x1c')]);}return _0x36537e[_0xccc4('0x4a')](_0x46f07d);}})[_0xccc4('0x23')](function(_0x53afa3){if(_0x53afa3){return _0x53afa3?{'count':_0x265efe,'rows':_0x53afa3}:null;}})[_0xccc4('0x23')](respondWithResult(_0x42484c,null))['catch'](handleError(_0x42484c,null));};exports[_0xccc4('0x4c')]=function(_0x5c2c4a,_0x2f9e58,_0x18b1b8){var _0x261b65={};var _0x4b980f={};var _0x53dbc5;var _0x345b1b;return db[_0xccc4('0x3d')]['findOne']({'where':{'id':_0x5c2c4a[_0xccc4('0x43')]['id']}})[_0xccc4('0x23')](handleEntityNotFound(_0x2f9e58,null))[_0xccc4('0x23')](function(_0x3c05be){if(_0x3c05be){_0x53dbc5=_0x3c05be;_0x4b980f[_0xccc4('0x33')]=_[_0xccc4('0x2e')](db['DeskField'][_0xccc4('0x2a')]);_0x4b980f[_0xccc4('0x2d')]=_[_0xccc4('0x2e')](_0x5c2c4a['query']);_0x4b980f[_0xccc4('0x2f')]=_['intersection'](_0x4b980f['model'],_0x4b980f[_0xccc4('0x2d')]);_0x261b65['attributes']=_[_0xccc4('0x30')](_0x4b980f['model'],qs[_0xccc4('0x32')](_0x5c2c4a[_0xccc4('0x2d')][_0xccc4('0x32')]));_0x261b65[_0xccc4('0x31')]=_0x261b65[_0xccc4('0x31')]['length']?_0x261b65[_0xccc4('0x31')]:_0x4b980f[_0xccc4('0x33')];_0x261b65[_0xccc4('0x36')]=qs['sort'](_0x5c2c4a[_0xccc4('0x2d')][_0xccc4('0x37')]);_0x261b65['where']=qs[_0xccc4('0x2f')](_['pick'](_0x5c2c4a['query'],_0x4b980f[_0xccc4('0x2f')]));if(_0x5c2c4a['query'][_0xccc4('0x3a')]){_0x261b65['where']=_[_0xccc4('0x3b')](_0x261b65[_0xccc4('0x38')],{'$or':_[_0xccc4('0x29')](_0x261b65[_0xccc4('0x31')],function(_0x19414f){var _0x1d7ee8={};_0x1d7ee8[_0x19414f]={'$like':'%'+_0x5c2c4a[_0xccc4('0x2d')]['filter']+'%'};return _0x1d7ee8;})});}_0x261b65=_['merge']({},_0x261b65,_0x5c2c4a[_0xccc4('0x3c')]);return _0x53dbc5[_0xccc4('0x4c')](_0x261b65);}})[_0xccc4('0x23')](function(_0x1c024f){if(_0x1c024f){_0x345b1b=_0x1c024f[_0xccc4('0x48')];if(!_0x5c2c4a[_0xccc4('0x2d')][_0xccc4('0x34')](_0xccc4('0x35'))){_0x261b65['limit']=qs[_0xccc4('0x1d')](_0x5c2c4a[_0xccc4('0x2d')]['limit']);_0x261b65[_0xccc4('0x1c')]=qs['offset'](_0x5c2c4a['query'][_0xccc4('0x1c')]);}return _0x53dbc5[_0xccc4('0x4c')](_0x261b65);}})[_0xccc4('0x23')](function(_0x1ca0f5){if(_0x1ca0f5){return _0x1ca0f5?{'count':_0x345b1b,'rows':_0x1ca0f5}:null;}})[_0xccc4('0x23')](respondWithResult(_0x2f9e58,null))[_0xccc4('0x41')](handleError(_0x2f9e58,null));};exports['getTags']=function(_0x570de2,_0x4045e6,_0x2e9ebc){var _0x15135c={};var _0x52a22a={};var _0x27143f;var _0x451632;return db[_0xccc4('0x3d')][_0xccc4('0x47')]({'where':{'id':_0x570de2[_0xccc4('0x43')]['id']}})[_0xccc4('0x23')](handleEntityNotFound(_0x4045e6,null))[_0xccc4('0x23')](function(_0x5bec3a){if(_0x5bec3a){_0x27143f=_0x5bec3a;_0x52a22a['model']=_[_0xccc4('0x2e')](db[_0xccc4('0x4d')][_0xccc4('0x2a')]);_0x52a22a[_0xccc4('0x2d')]=_[_0xccc4('0x2e')](_0x570de2[_0xccc4('0x2d')]);_0x52a22a[_0xccc4('0x2f')]=_[_0xccc4('0x30')](_0x52a22a[_0xccc4('0x33')],_0x52a22a[_0xccc4('0x2d')]);_0x15135c['attributes']=_[_0xccc4('0x30')](_0x52a22a[_0xccc4('0x33')],qs[_0xccc4('0x32')](_0x570de2[_0xccc4('0x2d')][_0xccc4('0x32')]));_0x15135c[_0xccc4('0x31')]=_0x15135c[_0xccc4('0x31')][_0xccc4('0x48')]?_0x15135c[_0xccc4('0x31')]:_0x52a22a[_0xccc4('0x33')];_0x15135c[_0xccc4('0x36')]=qs['sort'](_0x570de2[_0xccc4('0x2d')][_0xccc4('0x37')]);_0x15135c[_0xccc4('0x38')]=qs[_0xccc4('0x2f')](_['pick'](_0x570de2['query'],_0x52a22a[_0xccc4('0x2f')]));if(_0x570de2[_0xccc4('0x2d')][_0xccc4('0x3a')]){_0x15135c[_0xccc4('0x38')]=_[_0xccc4('0x3b')](_0x15135c[_0xccc4('0x38')],{'$or':_['map'](_0x15135c['attributes'],function(_0x581eff){var _0xc04088={};_0xc04088[_0x581eff]={'$like':'%'+_0x570de2[_0xccc4('0x2d')][_0xccc4('0x3a')]+'%'};return _0xc04088;})});}_0x15135c=_[_0xccc4('0x3b')]({},_0x15135c,_0x570de2[_0xccc4('0x3c')]);return _0x27143f[_0xccc4('0x4e')](_0x15135c);}})['then'](function(_0x4850c0){if(_0x4850c0){_0x451632=_0x4850c0['length'];if(!_0x570de2[_0xccc4('0x2d')][_0xccc4('0x34')](_0xccc4('0x35'))){_0x15135c[_0xccc4('0x1d')]=qs[_0xccc4('0x1d')](_0x570de2[_0xccc4('0x2d')][_0xccc4('0x1d')]);_0x15135c[_0xccc4('0x1c')]=qs['offset'](_0x570de2[_0xccc4('0x2d')]['offset']);}return _0x27143f[_0xccc4('0x4e')](_0x15135c);}})['then'](function(_0x5e37f6){if(_0x5e37f6){return _0x5e37f6?{'count':_0x451632,'rows':_0x5e37f6}:null;}})['then'](respondWithResult(_0x4045e6,null))[_0xccc4('0x41')](handleError(_0x4045e6,null));};exports['setTags']=function(_0x5200c3,_0x1c59db,_0x5bc306){if(_0x5200c3[_0xccc4('0x46')]['id']){delete _0x5200c3[_0xccc4('0x46')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x5200c3[_0xccc4('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c59db,null))[_0xccc4('0x23')](function(_0x29a9f3){if(_0x29a9f3){return _0x29a9f3[_0xccc4('0x4f')](_0x5200c3['body'][_0xccc4('0x50')]||[]);}return null;})[_0xccc4('0x23')](respondWithResult(_0x1c59db,null))[_0xccc4('0x41')](handleError(_0x1c59db,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index a433be4..63bf3ed 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 _0x7945=['int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x7945,0x112));var _0x5794=function(_0x1a7246,_0x38fb60){_0x1a7246=_0x1a7246-0x0;var _0x31bfbe=_0x7945[_0x1a7246];return _0x31bfbe;};'use strict';var _=require(_0x5794('0x0'));var util=require(_0x5794('0x1'));var logger=require(_0x5794('0x2'))(_0x5794('0x3'));var moment=require(_0x5794('0x4'));var BPromise=require(_0x5794('0x5'));var rp=require(_0x5794('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5794('0x7'));var config=require(_0x5794('0x8'));var attributes=require(_0x5794('0x9'));module['exports']=function(_0x27d495,_0x44a1b3){return _0x27d495[_0x5794('0xa')](_0x5794('0xb'),attributes,{'tableName':_0x5794('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3276=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','int_desk_configurations','lodash'];(function(_0x567c9e,_0x1ef36e){var _0x5d41f3=function(_0xe8fd3a){while(--_0xe8fd3a){_0x567c9e['push'](_0x567c9e['shift']());}};_0x5d41f3(++_0x1ef36e);}(_0x3276,0xc7));var _0x6327=function(_0x1881fa,_0x468255){_0x1881fa=_0x1881fa-0x0;var _0x16d41a=_0x3276[_0x1881fa];return _0x16d41a;};'use strict';var _=require(_0x6327('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6327('0x1'));var moment=require(_0x6327('0x2'));var BPromise=require(_0x6327('0x3'));var rp=require(_0x6327('0x4'));var fs=require('fs');var path=require(_0x6327('0x5'));var rimraf=require(_0x6327('0x6'));var config=require(_0x6327('0x7'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x10b982,_0x37adde){return _0x10b982[_0x6327('0x8')]('DeskConfiguration',attributes,{'tableName':_0x6327('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 77ff129..763d042 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 _0xcefd=['error','DeskConfiguration,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x29be75,_0x315450){var _0x4b6db4=function(_0x1c44bc){while(--_0x1c44bc){_0x29be75['push'](_0x29be75['shift']());}};_0x4b6db4(++_0x315450);}(_0xcefd,0x1bd));var _0xdcef=function(_0x5d351c,_0x5ccac8){_0x5d351c=_0x5d351c-0x0;var _0x526cf1=_0xcefd[_0x5d351c];return _0x526cf1;};'use strict';var _=require('lodash');var util=require(_0xdcef('0x0'));var moment=require(_0xdcef('0x1'));var BPromise=require(_0xdcef('0x2'));var rs=require(_0xdcef('0x3'));var fs=require('fs');var Redis=require(_0xdcef('0x4'));var db=require(_0xdcef('0x5'))['db'];var utils=require(_0xdcef('0x6'));var logger=require('../../config/logger')(_0xdcef('0x7'));var config=require(_0xdcef('0x8'));var jayson=require(_0xdcef('0x9'));var client=jayson[_0xdcef('0xa')][_0xdcef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ba458,_0x3b9fec,_0x25dfd5){return new BPromise(function(_0x3dc2b0,_0x11a5a6){return client['request'](_0x4ba458,_0x25dfd5)[_0xdcef('0xc')](function(_0xbb7067){logger[_0xdcef('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x3b9fec,_0xdcef('0xe'));logger['debug'](_0xdcef('0xf'),_0x3b9fec,_0xdcef('0xe'),JSON[_0xdcef('0x10')](_0xbb7067));if(_0xbb7067[_0xdcef('0x11')]){if(_0xbb7067[_0xdcef('0x11')]['code']===0x1f4){logger[_0xdcef('0x11')](_0xdcef('0x12'),_0x3b9fec,_0xbb7067['error'][_0xdcef('0x13')]);return _0x11a5a6(_0xbb7067['error'][_0xdcef('0x13')]);}logger[_0xdcef('0x11')](_0xdcef('0x12'),_0x3b9fec,_0xbb7067[_0xdcef('0x11')]['message']);return _0x3dc2b0(_0xbb7067[_0xdcef('0x11')][_0xdcef('0x13')]);}else{logger['info'](_0xdcef('0x12'),_0x3b9fec,_0xdcef('0xe'));_0x3dc2b0(_0xbb7067[_0xdcef('0x14')]['message']);}})['catch'](function(_0x386368){logger[_0xdcef('0x11')](_0xdcef('0x12'),_0x3b9fec,_0x386368);_0x11a5a6(_0x386368);});});} \ No newline at end of file +var _0x6a18=['then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request'];(function(_0x35d116,_0x529031){var _0x48e353=function(_0x377823){while(--_0x377823){_0x35d116['push'](_0x35d116['shift']());}};_0x48e353(++_0x529031);}(_0x6a18,0x114));var _0x86a1=function(_0xe38f5c,_0x5dc27d){_0xe38f5c=_0xe38f5c-0x0;var _0x18d71b=_0x6a18[_0xe38f5c];return _0x18d71b;};'use strict';var _=require(_0x86a1('0x0'));var util=require(_0x86a1('0x1'));var moment=require(_0x86a1('0x2'));var BPromise=require(_0x86a1('0x3'));var rs=require(_0x86a1('0x4'));var fs=require('fs');var Redis=require(_0x86a1('0x5'));var db=require(_0x86a1('0x6'))['db'];var utils=require(_0x86a1('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x86a1('0x8'));var jayson=require(_0x86a1('0x9'));var client=jayson[_0x86a1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a5210,_0x189a52,_0xa44f84){return new BPromise(function(_0x4e93de,_0x228791){return client[_0x86a1('0xb')](_0x2a5210,_0xa44f84)[_0x86a1('0xc')](function(_0x37f26f){logger[_0x86a1('0xd')](_0x86a1('0xe'),_0x189a52,'request\x20sent');logger[_0x86a1('0xf')](_0x86a1('0x10'),_0x189a52,_0x86a1('0x11'),JSON[_0x86a1('0x12')](_0x37f26f));if(_0x37f26f[_0x86a1('0x13')]){if(_0x37f26f[_0x86a1('0x13')][_0x86a1('0x14')]===0x1f4){logger[_0x86a1('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x189a52,_0x37f26f[_0x86a1('0x13')][_0x86a1('0x15')]);return _0x228791(_0x37f26f[_0x86a1('0x13')]['message']);}logger[_0x86a1('0x13')](_0x86a1('0xe'),_0x189a52,_0x37f26f[_0x86a1('0x13')][_0x86a1('0x15')]);return _0x4e93de(_0x37f26f[_0x86a1('0x13')]['message']);}else{logger[_0x86a1('0xd')](_0x86a1('0xe'),_0x189a52,'request\x20sent');_0x4e93de(_0x37f26f[_0x86a1('0x16')][_0x86a1('0x15')]);}})[_0x86a1('0x17')](function(_0x10a995){logger[_0x86a1('0x13')](_0x86a1('0xe'),_0x189a52,_0x10a995);_0x228791(_0x10a995);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index f7ad7dd..edfd70f 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 _0x8952=['/:id','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create'];(function(_0x106a9c,_0x424918){var _0x3ba2a0=function(_0x48f55c){while(--_0x48f55c){_0x106a9c['push'](_0x106a9c['shift']());}};_0x3ba2a0(++_0x424918);}(_0x8952,0x17e));var _0x2895=function(_0x161f9a,_0x325987){_0x161f9a=_0x161f9a-0x0;var _0x501839=_0x8952[_0x161f9a];return _0x501839;};'use strict';var multer=require('multer');var util=require(_0x2895('0x0'));var path=require(_0x2895('0x1'));var timeout=require(_0x2895('0x2'));var express=require(_0x2895('0x3'));var router=express[_0x2895('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2895('0x5'));var interaction=require(_0x2895('0x6'));var config=require(_0x2895('0x7'));var controller=require('./intDeskField.controller');router[_0x2895('0x8')]('/',auth[_0x2895('0x9')](),controller[_0x2895('0xa')]);router['get']('/:id',auth[_0x2895('0x9')](),controller[_0x2895('0xb')]);router[_0x2895('0xc')]('/',auth[_0x2895('0x9')](),controller[_0x2895('0xd')]);router['put'](_0x2895('0xe'),auth['isAuthenticated'](),controller[_0x2895('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2895('0x10')]);module[_0x2895('0x11')]=router; \ No newline at end of file +var _0xf0ba=['delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xf0ba,0x7a));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xaf0b('0x0'));var util=require(_0xaf0b('0x1'));var path=require(_0xaf0b('0x2'));var timeout=require(_0xaf0b('0x3'));var express=require(_0xaf0b('0x4'));var router=express['Router']();var fs_extra=require(_0xaf0b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaf0b('0x6'));var config=require(_0xaf0b('0x7'));var controller=require(_0xaf0b('0x8'));router[_0xaf0b('0x9')]('/',auth[_0xaf0b('0xa')](),controller[_0xaf0b('0xb')]);router[_0xaf0b('0x9')](_0xaf0b('0xc'),auth[_0xaf0b('0xa')](),controller[_0xaf0b('0xd')]);router[_0xaf0b('0xe')]('/',auth[_0xaf0b('0xa')](),controller[_0xaf0b('0xf')]);router[_0xaf0b('0x10')](_0xaf0b('0xc'),auth[_0xaf0b('0xa')](),controller[_0xaf0b('0x11')]);router[_0xaf0b('0x12')](_0xaf0b('0xc'),auth['isAuthenticated'](),controller[_0xaf0b('0x13')]);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 3e8dee3..436535d 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 _0x3d8c=['sequelize','exports','ENUM','string','variable','picklist','STRING','customVariable','BOOLEAN'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3d8c,0xe1));var _0xc3d8=function(_0x21fc68,_0x459828){_0x21fc68=_0x21fc68-0x0;var _0x3561e1=_0x3d8c[_0x21fc68];return _0x3561e1;};'use strict';var Sequelize=require(_0xc3d8('0x0'));module[_0xc3d8('0x1')]={'type':{'type':Sequelize[_0xc3d8('0x2')](_0xc3d8('0x3'),_0xc3d8('0x4'),'customVariable','keyValue',_0xc3d8('0x5')),'defaultValue':_0xc3d8('0x3')},'content':{'type':Sequelize[_0xc3d8('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xc3d8('0x3'),_0xc3d8('0x4'),_0xc3d8('0x7'))},'keyContent':{'type':Sequelize[_0xc3d8('0x6')]},'idField':{'type':Sequelize[_0xc3d8('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc3d8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc3d8('0x6')]}}; \ No newline at end of file +var _0x0809=['exports','ENUM','variable','customVariable','picklist','string','STRING','BOOLEAN'];(function(_0x3e478c,_0x152670){var _0x29ef89=function(_0x3d0d77){while(--_0x3d0d77){_0x3e478c['push'](_0x3e478c['shift']());}};_0x29ef89(++_0x152670);}(_0x0809,0x1b8));var _0x9080=function(_0x1bf859,_0x19d75a){_0x1bf859=_0x1bf859-0x0;var _0x7524f8=_0x0809[_0x1bf859];return _0x7524f8;};'use strict';var Sequelize=require('sequelize');module[_0x9080('0x0')]={'type':{'type':Sequelize[_0x9080('0x1')]('string',_0x9080('0x2'),_0x9080('0x3'),'keyValue',_0x9080('0x4')),'defaultValue':_0x9080('0x5')},'content':{'type':Sequelize[_0x9080('0x6')]},'key':{'type':Sequelize[_0x9080('0x6')]},'keyType':{'type':Sequelize[_0x9080('0x1')]('string','variable',_0x9080('0x3'))},'keyContent':{'type':Sequelize[_0x9080('0x6')]},'idField':{'type':Sequelize[_0x9080('0x6')]},'nameField':{'type':Sequelize[_0x9080('0x6')]},'customField':{'type':Sequelize[_0x9080('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9080('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 9911ba5..53e9863 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 _0xa4dc=['desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','DeskField','includeAll','catch','show','params','keys','length','include','options','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x46ff36,_0x11fec8){var _0x4cb5a6=function(_0x8ff1fc){while(--_0x8ff1fc){_0x46ff36['push'](_0x46ff36['shift']());}};_0x4cb5a6(++_0x11fec8);}(_0xa4dc,0x16a));var _0xca4d=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xa4dc[_0x2b9b7f];return _0x4ed19a;};'use strict';var emlformat=require(_0xca4d('0x0'));var rimraf=require(_0xca4d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xca4d('0x2'));var moment=require(_0xca4d('0x3'));var BPromise=require(_0xca4d('0x4'));var Mustache=require(_0xca4d('0x5'));var util=require(_0xca4d('0x6'));var path=require('path');var sox=require(_0xca4d('0x7'));var csv=require(_0xca4d('0x8'));var ejs=require(_0xca4d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca4d('0xa'));var squel=require('squel');var crypto=require(_0xca4d('0xb'));var jsforce=require(_0xca4d('0xc'));var deskjs=require(_0xca4d('0xd'));var toCsv=require(_0xca4d('0x8'));var querystring=require('querystring');var Papa=require(_0xca4d('0xe'));var Redis=require(_0xca4d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xca4d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca4d('0x11'));var logger=require(_0xca4d('0x12'))(_0xca4d('0x13'));var utils=require(_0xca4d('0x14'));var config=require(_0xca4d('0x15'));var licenseUtil=require(_0xca4d('0x16'));var db=require(_0xca4d('0x17'))['db'];function respondWithStatusCode(_0x2009d4,_0x5e5163){_0x5e5163=_0x5e5163||0xcc;return function(_0x3fc3ab){if(_0x3fc3ab){return _0x2009d4['sendStatus'](_0x5e5163);}return _0x2009d4[_0xca4d('0x18')](_0x5e5163)[_0xca4d('0x19')]();};}function respondWithResult(_0x2e86ae,_0x4ab15d){_0x4ab15d=_0x4ab15d||0xc8;return function(_0x47285f){if(_0x47285f){return _0x2e86ae['status'](_0x4ab15d)[_0xca4d('0x1a')](_0x47285f);}};}function respondWithFilteredResult(_0x3dddc8,_0x33a7d6){return function(_0x334ab4){if(_0x334ab4){var _0x40e945=typeof _0x33a7d6[_0xca4d('0x1b')]===_0xca4d('0x1c')&&typeof _0x33a7d6['limit']===_0xca4d('0x1c');var _0x20ed84=_0x334ab4[_0xca4d('0x1d')];var _0x388ff7=_0x40e945?0x0:_0x33a7d6[_0xca4d('0x1b')];var _0x395319=_0x40e945?_0x334ab4[_0xca4d('0x1d')]:_0x33a7d6[_0xca4d('0x1b')]+_0x33a7d6[_0xca4d('0x1e')];var _0x5738b6;if(_0x395319>=_0x20ed84){_0x395319=_0x20ed84;_0x5738b6=0xc8;}else{_0x5738b6=0xce;}_0x3dddc8['status'](_0x5738b6);return _0x3dddc8[_0xca4d('0x1f')]('Content-Range',_0x388ff7+'-'+_0x395319+'/'+_0x20ed84)[_0xca4d('0x1a')](_0x334ab4);}return null;};}function patchUpdates(_0x555f0e){return function(_0x375efa){try{jsonpatch[_0xca4d('0x20')](_0x375efa,_0x555f0e,!![]);}catch(_0x35295c){return BPromise[_0xca4d('0x21')](_0x35295c);}return _0x375efa[_0xca4d('0x22')]();};}function saveUpdates(_0x4f692b,_0x58e346){return function(_0xe29bfc){if(_0xe29bfc){return _0xe29bfc[_0xca4d('0x23')](_0x4f692b)[_0xca4d('0x24')](function(_0x390634){return _0x390634;});}return null;};}function removeEntity(_0x5ef722,_0x2515fc){return function(_0x4d7f1a){if(_0x4d7f1a){return _0x4d7f1a[_0xca4d('0x25')]()['then'](function(){_0x5ef722[_0xca4d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1763f3,_0x3ffe67){return function(_0x3e0210){if(!_0x3e0210){_0x1763f3[_0xca4d('0x26')](0x194);}return _0x3e0210;};}function handleError(_0x57a079,_0x327006){_0x327006=_0x327006||0x1f4;return function(_0xfea1c5){logger[_0xca4d('0x27')](_0xfea1c5[_0xca4d('0x28')]);if(_0xfea1c5[_0xca4d('0x29')]){delete _0xfea1c5[_0xca4d('0x29')];}_0x57a079[_0xca4d('0x18')](_0x327006)[_0xca4d('0x2a')](_0xfea1c5);};}exports[_0xca4d('0x2b')]=function(_0x37d563,_0xfacacb){var _0x319dea={},_0x522be8={},_0x53efdb={'count':0x0,'rows':[]};var _0xcc6dd5=_[_0xca4d('0x2c')](db['DeskField'][_0xca4d('0x2d')],function(_0x532066){return{'name':_0x532066[_0xca4d('0x2e')],'type':_0x532066[_0xca4d('0x2f')]['key']};});_0x522be8[_0xca4d('0x30')]=_[_0xca4d('0x2c')](_0xcc6dd5,_0xca4d('0x29'));_0x522be8[_0xca4d('0x31')]=_['keys'](_0x37d563[_0xca4d('0x31')]);_0x522be8[_0xca4d('0x32')]=_[_0xca4d('0x33')](_0x522be8[_0xca4d('0x30')],_0x522be8['query']);_0x319dea[_0xca4d('0x34')]=_[_0xca4d('0x33')](_0x522be8[_0xca4d('0x30')],qs[_0xca4d('0x35')](_0x37d563['query'][_0xca4d('0x35')]));_0x319dea[_0xca4d('0x34')]=_0x319dea[_0xca4d('0x34')]['length']?_0x319dea[_0xca4d('0x34')]:_0x522be8[_0xca4d('0x30')];if(!_0x37d563[_0xca4d('0x31')][_0xca4d('0x36')](_0xca4d('0x37'))){_0x319dea['limit']=qs[_0xca4d('0x1e')](_0x37d563[_0xca4d('0x31')][_0xca4d('0x1e')]);_0x319dea[_0xca4d('0x1b')]=qs[_0xca4d('0x1b')](_0x37d563['query'][_0xca4d('0x1b')]);}_0x319dea[_0xca4d('0x38')]=qs[_0xca4d('0x39')](_0x37d563[_0xca4d('0x31')]['sort']);_0x319dea['where']=qs[_0xca4d('0x32')](_[_0xca4d('0x3a')](_0x37d563['query'],_0x522be8[_0xca4d('0x32')]),_0xcc6dd5);if(_0x37d563['query'][_0xca4d('0x3b')]){_0x319dea['where']=_[_0xca4d('0x3c')](_0x319dea['where'],{'$or':_[_0xca4d('0x2c')](_0xcc6dd5,function(_0x2e7dd7){if(_0x2e7dd7[_0xca4d('0x2f')]!==_0xca4d('0x3d')){var _0x361835={};_0x361835[_0x2e7dd7['name']]={'$like':'%'+_0x37d563[_0xca4d('0x31')][_0xca4d('0x3b')]+'%'};return _0x361835;}})});}_0x319dea=_[_0xca4d('0x3c')]({},_0x319dea,_0x37d563['options']);var _0x1f0b3e={'where':_0x319dea[_0xca4d('0x3e')]};return db[_0xca4d('0x3f')]['count'](_0x1f0b3e)[_0xca4d('0x24')](function(_0x206391){_0x53efdb[_0xca4d('0x1d')]=_0x206391;if(_0x37d563['query'][_0xca4d('0x40')]){_0x319dea['include']=[{'all':!![]}];}return db[_0xca4d('0x3f')]['findAll'](_0x319dea);})['then'](function(_0x173bca){_0x53efdb['rows']=_0x173bca;return _0x53efdb;})['then'](respondWithFilteredResult(_0xfacacb,_0x319dea))[_0xca4d('0x41')](handleError(_0xfacacb,null));};exports[_0xca4d('0x42')]=function(_0x39dd75,_0x27f9da){var _0x44430c={'raw':!![],'where':{'id':_0x39dd75[_0xca4d('0x43')]['id']}},_0x164509={};_0x164509[_0xca4d('0x30')]=_[_0xca4d('0x44')](db['DeskField']['rawAttributes']);_0x164509[_0xca4d('0x31')]=_[_0xca4d('0x44')](_0x39dd75[_0xca4d('0x31')]);_0x164509['filters']=_[_0xca4d('0x33')](_0x164509[_0xca4d('0x30')],_0x164509['query']);_0x44430c[_0xca4d('0x34')]=_[_0xca4d('0x33')](_0x164509[_0xca4d('0x30')],qs['fields'](_0x39dd75['query'][_0xca4d('0x35')]));_0x44430c[_0xca4d('0x34')]=_0x44430c[_0xca4d('0x34')][_0xca4d('0x45')]?_0x44430c[_0xca4d('0x34')]:_0x164509['model'];if(_0x39dd75[_0xca4d('0x31')][_0xca4d('0x40')]){_0x44430c[_0xca4d('0x46')]=[{'all':!![]}];}_0x44430c=_[_0xca4d('0x3c')]({},_0x44430c,_0x39dd75[_0xca4d('0x47')]);return db[_0xca4d('0x3f')][_0xca4d('0x48')](_0x44430c)[_0xca4d('0x24')](handleEntityNotFound(_0x27f9da,null))['then'](respondWithResult(_0x27f9da,null))[_0xca4d('0x41')](handleError(_0x27f9da,null));};exports['create']=function(_0x505fb7,_0x5f335c){return db[_0xca4d('0x3f')][_0xca4d('0x49')](_0x505fb7[_0xca4d('0x4a')],{})[_0xca4d('0x24')](respondWithResult(_0x5f335c,0xc9))[_0xca4d('0x41')](handleError(_0x5f335c,null));};exports[_0xca4d('0x23')]=function(_0x3bba4d,_0x3f7dd6){if(_0x3bba4d[_0xca4d('0x4a')]['id']){delete _0x3bba4d[_0xca4d('0x4a')]['id'];}return db[_0xca4d('0x3f')][_0xca4d('0x48')]({'where':{'id':_0x3bba4d[_0xca4d('0x43')]['id']}})[_0xca4d('0x24')](handleEntityNotFound(_0x3f7dd6,null))[_0xca4d('0x24')](saveUpdates(_0x3bba4d[_0xca4d('0x4a')],null))[_0xca4d('0x24')](respondWithResult(_0x3f7dd6,null))[_0xca4d('0x41')](handleError(_0x3f7dd6,null));};exports[_0xca4d('0x25')]=function(_0x3b91d3,_0x5a3a45){return db[_0xca4d('0x3f')][_0xca4d('0x48')]({'where':{'id':_0x3b91d3['params']['id']}})['then'](handleEntityNotFound(_0x5a3a45,null))[_0xca4d('0x24')](removeEntity(_0x5a3a45,null))[_0xca4d('0x41')](handleError(_0x5a3a45,null));}; \ No newline at end of file +var _0x7172=['send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','DeskField','includeAll','include','findAll','catch','show','params','find','create','body','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x4de545,_0x419395){var _0x51b692=function(_0x4a5f45){while(--_0x4a5f45){_0x4de545['push'](_0x4de545['shift']());}};_0x51b692(++_0x419395);}(_0x7172,0x1ef));var _0x2717=function(_0x2dbaf4,_0x1abfb0){_0x2dbaf4=_0x2dbaf4-0x0;var _0x3c6a3=_0x7172[_0x2dbaf4];return _0x3c6a3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2717('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2717('0x1'));var moment=require(_0x2717('0x2'));var BPromise=require(_0x2717('0x3'));var Mustache=require(_0x2717('0x4'));var util=require(_0x2717('0x5'));var path=require(_0x2717('0x6'));var sox=require(_0x2717('0x7'));var csv=require(_0x2717('0x8'));var ejs=require(_0x2717('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2717('0xa'));var squel=require(_0x2717('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2717('0xc'));var toCsv=require(_0x2717('0x8'));var querystring=require(_0x2717('0xd'));var Papa=require(_0x2717('0xe'));var Redis=require(_0x2717('0xf'));var authService=require(_0x2717('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2717('0x11'));var hardwareService=require(_0x2717('0x12'));var logger=require(_0x2717('0x13'))(_0x2717('0x14'));var utils=require(_0x2717('0x15'));var config=require(_0x2717('0x16'));var licenseUtil=require(_0x2717('0x17'));var db=require(_0x2717('0x18'))['db'];function respondWithStatusCode(_0xf8504e,_0x1f8d0d){_0x1f8d0d=_0x1f8d0d||0xcc;return function(_0x17ca13){if(_0x17ca13){return _0xf8504e[_0x2717('0x19')](_0x1f8d0d);}return _0xf8504e[_0x2717('0x1a')](_0x1f8d0d)[_0x2717('0x1b')]();};}function respondWithResult(_0x5c6cd3,_0xff55ec){_0xff55ec=_0xff55ec||0xc8;return function(_0x591562){if(_0x591562){return _0x5c6cd3[_0x2717('0x1a')](_0xff55ec)[_0x2717('0x1c')](_0x591562);}};}function respondWithFilteredResult(_0x28c38c,_0x4dcf5a){return function(_0x36da0e){if(_0x36da0e){var _0x268efd=typeof _0x4dcf5a['offset']===_0x2717('0x1d')&&typeof _0x4dcf5a[_0x2717('0x1e')]===_0x2717('0x1d');var _0x1a2f36=_0x36da0e[_0x2717('0x1f')];var _0x224334=_0x268efd?0x0:_0x4dcf5a['offset'];var _0x7bf873=_0x268efd?_0x36da0e['count']:_0x4dcf5a[_0x2717('0x20')]+_0x4dcf5a[_0x2717('0x1e')];var _0x14a955;if(_0x7bf873>=_0x1a2f36){_0x7bf873=_0x1a2f36;_0x14a955=0xc8;}else{_0x14a955=0xce;}_0x28c38c[_0x2717('0x1a')](_0x14a955);return _0x28c38c[_0x2717('0x21')](_0x2717('0x22'),_0x224334+'-'+_0x7bf873+'/'+_0x1a2f36)[_0x2717('0x1c')](_0x36da0e);}return null;};}function patchUpdates(_0x590de1){return function(_0x549dd3){try{jsonpatch[_0x2717('0x23')](_0x549dd3,_0x590de1,!![]);}catch(_0x7d3f92){return BPromise[_0x2717('0x24')](_0x7d3f92);}return _0x549dd3[_0x2717('0x25')]();};}function saveUpdates(_0x397de2,_0x5f171b){return function(_0xc9d9bf){if(_0xc9d9bf){return _0xc9d9bf[_0x2717('0x26')](_0x397de2)[_0x2717('0x27')](function(_0x128cf5){return _0x128cf5;});}return null;};}function removeEntity(_0x5852ec,_0x1e654e){return function(_0xfbb849){if(_0xfbb849){return _0xfbb849[_0x2717('0x28')]()[_0x2717('0x27')](function(){_0x5852ec[_0x2717('0x1a')](0xcc)[_0x2717('0x1b')]();});}};}function handleEntityNotFound(_0x56c2a0,_0x533c82){return function(_0x18f1cd){if(!_0x18f1cd){_0x56c2a0[_0x2717('0x19')](0x194);}return _0x18f1cd;};}function handleError(_0x5b58f1,_0xa0d56){_0xa0d56=_0xa0d56||0x1f4;return function(_0x4d1476){logger[_0x2717('0x29')](_0x4d1476[_0x2717('0x2a')]);if(_0x4d1476[_0x2717('0x2b')]){delete _0x4d1476[_0x2717('0x2b')];}_0x5b58f1[_0x2717('0x1a')](_0xa0d56)[_0x2717('0x2c')](_0x4d1476);};}exports[_0x2717('0x2d')]=function(_0x103c9c,_0x366ea8){var _0x38e744={},_0x1a35e3={},_0x21096a={'count':0x0,'rows':[]};var _0x8fc540=_[_0x2717('0x2e')](db['DeskField'][_0x2717('0x2f')],function(_0x5568f1){return{'name':_0x5568f1[_0x2717('0x30')],'type':_0x5568f1[_0x2717('0x31')]['key']};});_0x1a35e3[_0x2717('0x32')]=_['map'](_0x8fc540,_0x2717('0x2b'));_0x1a35e3[_0x2717('0x33')]=_[_0x2717('0x34')](_0x103c9c['query']);_0x1a35e3['filters']=_[_0x2717('0x35')](_0x1a35e3[_0x2717('0x32')],_0x1a35e3[_0x2717('0x33')]);_0x38e744[_0x2717('0x36')]=_[_0x2717('0x35')](_0x1a35e3[_0x2717('0x32')],qs[_0x2717('0x37')](_0x103c9c[_0x2717('0x33')]['fields']));_0x38e744['attributes']=_0x38e744['attributes'][_0x2717('0x38')]?_0x38e744[_0x2717('0x36')]:_0x1a35e3['model'];if(!_0x103c9c[_0x2717('0x33')]['hasOwnProperty'](_0x2717('0x39'))){_0x38e744['limit']=qs[_0x2717('0x1e')](_0x103c9c[_0x2717('0x33')][_0x2717('0x1e')]);_0x38e744['offset']=qs[_0x2717('0x20')](_0x103c9c[_0x2717('0x33')]['offset']);}_0x38e744[_0x2717('0x3a')]=qs[_0x2717('0x3b')](_0x103c9c[_0x2717('0x33')][_0x2717('0x3b')]);_0x38e744['where']=qs[_0x2717('0x3c')](_[_0x2717('0x3d')](_0x103c9c[_0x2717('0x33')],_0x1a35e3[_0x2717('0x3c')]),_0x8fc540);if(_0x103c9c[_0x2717('0x33')]['filter']){_0x38e744[_0x2717('0x3e')]=_[_0x2717('0x3f')](_0x38e744[_0x2717('0x3e')],{'$or':_[_0x2717('0x2e')](_0x8fc540,function(_0xee74e1){if(_0xee74e1[_0x2717('0x31')]!==_0x2717('0x40')){var _0x4da5dd={};_0x4da5dd[_0xee74e1[_0x2717('0x2b')]]={'$like':'%'+_0x103c9c['query'][_0x2717('0x41')]+'%'};return _0x4da5dd;}})});}_0x38e744=_[_0x2717('0x3f')]({},_0x38e744,_0x103c9c[_0x2717('0x42')]);var _0x3a4f72={'where':_0x38e744[_0x2717('0x3e')]};return db[_0x2717('0x43')][_0x2717('0x1f')](_0x3a4f72)[_0x2717('0x27')](function(_0x1718f0){_0x21096a[_0x2717('0x1f')]=_0x1718f0;if(_0x103c9c['query'][_0x2717('0x44')]){_0x38e744[_0x2717('0x45')]=[{'all':!![]}];}return db[_0x2717('0x43')][_0x2717('0x46')](_0x38e744);})[_0x2717('0x27')](function(_0x509424){_0x21096a['rows']=_0x509424;return _0x21096a;})[_0x2717('0x27')](respondWithFilteredResult(_0x366ea8,_0x38e744))[_0x2717('0x47')](handleError(_0x366ea8,null));};exports[_0x2717('0x48')]=function(_0x45544b,_0x6f24c4){var _0xae9b96={'raw':!![],'where':{'id':_0x45544b[_0x2717('0x49')]['id']}},_0xb10d49={};_0xb10d49['model']=_[_0x2717('0x34')](db['DeskField'][_0x2717('0x2f')]);_0xb10d49[_0x2717('0x33')]=_[_0x2717('0x34')](_0x45544b[_0x2717('0x33')]);_0xb10d49[_0x2717('0x3c')]=_['intersection'](_0xb10d49['model'],_0xb10d49[_0x2717('0x33')]);_0xae9b96[_0x2717('0x36')]=_['intersection'](_0xb10d49['model'],qs[_0x2717('0x37')](_0x45544b[_0x2717('0x33')][_0x2717('0x37')]));_0xae9b96['attributes']=_0xae9b96[_0x2717('0x36')][_0x2717('0x38')]?_0xae9b96[_0x2717('0x36')]:_0xb10d49['model'];if(_0x45544b[_0x2717('0x33')][_0x2717('0x44')]){_0xae9b96[_0x2717('0x45')]=[{'all':!![]}];}_0xae9b96=_[_0x2717('0x3f')]({},_0xae9b96,_0x45544b[_0x2717('0x42')]);return db[_0x2717('0x43')][_0x2717('0x4a')](_0xae9b96)['then'](handleEntityNotFound(_0x6f24c4,null))['then'](respondWithResult(_0x6f24c4,null))['catch'](handleError(_0x6f24c4,null));};exports[_0x2717('0x4b')]=function(_0x395960,_0x24f270){return db[_0x2717('0x43')][_0x2717('0x4b')](_0x395960['body'],{})[_0x2717('0x27')](respondWithResult(_0x24f270,0xc9))['catch'](handleError(_0x24f270,null));};exports['update']=function(_0x413db6,_0x48d524){if(_0x413db6[_0x2717('0x4c')]['id']){delete _0x413db6[_0x2717('0x4c')]['id'];}return db[_0x2717('0x43')]['find']({'where':{'id':_0x413db6['params']['id']}})[_0x2717('0x27')](handleEntityNotFound(_0x48d524,null))[_0x2717('0x27')](saveUpdates(_0x413db6[_0x2717('0x4c')],null))[_0x2717('0x27')](respondWithResult(_0x48d524,null))[_0x2717('0x47')](handleError(_0x48d524,null));};exports[_0x2717('0x28')]=function(_0x1a03fe,_0x16a2d4){return db[_0x2717('0x43')][_0x2717('0x4a')]({'where':{'id':_0x1a03fe[_0x2717('0x49')]['id']}})[_0x2717('0x27')](handleEntityNotFound(_0x16a2d4,null))[_0x2717('0x27')](removeEntity(_0x16a2d4,null))[_0x2717('0x47')](handleError(_0x16a2d4,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index f211ea2..209f5a1 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 _0x9e3c=['moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField','FieldId','../../config/logger','api'];(function(_0x17dc7e,_0x1b6122){var _0x16586a=function(_0x56a12d){while(--_0x56a12d){_0x17dc7e['push'](_0x17dc7e['shift']());}};_0x16586a(++_0x1b6122);}(_0x9e3c,0x124));var _0xc9e3=function(_0x3b3127,_0x51cdc5){_0x3b3127=_0x3b3127-0x0;var _0x19c58f=_0x9e3c[_0x3b3127];return _0x19c58f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc9e3('0x0'))(_0xc9e3('0x1'));var moment=require(_0xc9e3('0x2'));var BPromise=require(_0xc9e3('0x3'));var rp=require(_0xc9e3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc9e3('0x5'));var config=require(_0xc9e3('0x6'));var attributes=require(_0xc9e3('0x7'));module[_0xc9e3('0x8')]=function(_0x39afd9,_0x428ee6){return _0x39afd9[_0xc9e3('0x9')]('DeskField',attributes,{'tableName':_0xc9e3('0xa'),'paranoid':![],'indexes':[{'name':_0xc9e3('0xb'),'fields':[_0xc9e3('0xc'),_0xc9e3('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x901e=['idField','FieldId','bluebird','request-promise','./intDeskField.attributes','exports','define','DeskField'];(function(_0x47e713,_0x112df9){var _0x2f243a=function(_0x56d014){while(--_0x56d014){_0x47e713['push'](_0x47e713['shift']());}};_0x2f243a(++_0x112df9);}(_0x901e,0x1e2));var _0xe901=function(_0x573a27,_0x26d295){_0x573a27=_0x573a27-0x0;var _0x49f7c0=_0x901e[_0x573a27];return _0x49f7c0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe901('0x0'));var rp=require(_0xe901('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe901('0x2'));module[_0xe901('0x3')]=function(_0x7b4ccf,_0xf7c772){return _0x7b4ccf[_0xe901('0x4')](_0xe901('0x5'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xe901('0x6'),_0xe901('0x7')],'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 52e3dbd..1d72e8a 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 _0xf4e0=['../../config/environment','client','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf4e0,0x186));var _0x0f4e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf4e0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0f4e('0x0'));var util=require(_0x0f4e('0x1'));var moment=require(_0x0f4e('0x2'));var BPromise=require(_0x0f4e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0f4e('0x4'));var logger=require(_0x0f4e('0x5'))('rpc');var config=require(_0x0f4e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0f4e('0x7')][_0x0f4e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x571c22,_0xa5bf29,_0x3f8cd8){return new BPromise(function(_0x51d92d,_0x393356){return client[_0x0f4e('0x9')](_0x571c22,_0x3f8cd8)['then'](function(_0x5ce30f){logger[_0x0f4e('0xa')](_0x0f4e('0xb'),_0xa5bf29,'request\x20sent');logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0xa5bf29,_0x0f4e('0xc'),JSON['stringify'](_0x5ce30f));if(_0x5ce30f[_0x0f4e('0xd')]){if(_0x5ce30f['error'][_0x0f4e('0xe')]===0x1f4){logger[_0x0f4e('0xd')](_0x0f4e('0xb'),_0xa5bf29,_0x5ce30f[_0x0f4e('0xd')][_0x0f4e('0xf')]);return _0x393356(_0x5ce30f[_0x0f4e('0xd')][_0x0f4e('0xf')]);}logger['error'](_0x0f4e('0xb'),_0xa5bf29,_0x5ce30f[_0x0f4e('0xd')][_0x0f4e('0xf')]);return _0x51d92d(_0x5ce30f[_0x0f4e('0xd')]['message']);}else{logger[_0x0f4e('0xa')](_0x0f4e('0xb'),_0xa5bf29,_0x0f4e('0xc'));_0x51d92d(_0x5ce30f[_0x0f4e('0x10')]['message']);}})[_0x0f4e('0x11')](function(_0x2135ee){logger[_0x0f4e('0xd')](_0x0f4e('0xb'),_0xa5bf29,_0x2135ee);_0x393356(_0x2135ee);});});} \ No newline at end of file +var _0xf5ff=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash'];(function(_0x1f4907,_0x5ce009){var _0x5f2fb4=function(_0x50f098){while(--_0x50f098){_0x1f4907['push'](_0x1f4907['shift']());}};_0x5f2fb4(++_0x5ce009);}(_0xf5ff,0x103));var _0xff5f=function(_0x1fd603,_0x46b502){_0x1fd603=_0x1fd603-0x0;var _0x245403=_0xf5ff[_0x1fd603];return _0x245403;};'use strict';var _=require(_0xff5f('0x0'));var util=require('util');var moment=require(_0xff5f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff5f('0x2'));var db=require(_0xff5f('0x3'))['db'];var utils=require(_0xff5f('0x4'));var logger=require(_0xff5f('0x5'))('rpc');var config=require(_0xff5f('0x6'));var jayson=require(_0xff5f('0x7'));var client=jayson[_0xff5f('0x8')][_0xff5f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x83dadd,_0x460982,_0x1c100b){return new BPromise(function(_0xcd2c29,_0xbcb14c){return client[_0xff5f('0xa')](_0x83dadd,_0x1c100b)[_0xff5f('0xb')](function(_0x76d014){logger['info'](_0xff5f('0xc'),_0x460982,_0xff5f('0xd'));logger[_0xff5f('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x460982,_0xff5f('0xd'),JSON['stringify'](_0x76d014));if(_0x76d014[_0xff5f('0xf')]){if(_0x76d014[_0xff5f('0xf')][_0xff5f('0x10')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x460982,_0x76d014[_0xff5f('0xf')]['message']);return _0xbcb14c(_0x76d014['error'][_0xff5f('0x11')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x460982,_0x76d014[_0xff5f('0xf')][_0xff5f('0x11')]);return _0xcd2c29(_0x76d014['error']['message']);}else{logger['info'](_0xff5f('0xc'),_0x460982,_0xff5f('0xd'));_0xcd2c29(_0x76d014[_0xff5f('0x12')][_0xff5f('0x11')]);}})[_0xff5f('0x13')](function(_0x50ed9f){logger[_0xff5f('0xf')](_0xff5f('0xc'),_0x460982,_0x50ed9f);_0xbcb14c(_0x50ed9f);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index a400303..782ce11 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 _0xd963=['update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x3b981b,_0x597d4b){var _0x330e35=function(_0x3abc80){while(--_0x3abc80){_0x3b981b['push'](_0x3b981b['shift']());}};_0x330e35(++_0x597d4b);}(_0xd963,0x1b4));var _0x3d96=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0xd963[_0x44a64f];return _0x52024b;};'use strict';var multer=require(_0x3d96('0x0'));var util=require(_0x3d96('0x1'));var path=require(_0x3d96('0x2'));var timeout=require(_0x3d96('0x3'));var express=require(_0x3d96('0x4'));var router=express[_0x3d96('0x5')]();var fs_extra=require(_0x3d96('0x6'));var auth=require(_0x3d96('0x7'));var interaction=require(_0x3d96('0x8'));var config=require(_0x3d96('0x9'));var controller=require(_0x3d96('0xa'));router[_0x3d96('0xb')]('/',auth[_0x3d96('0xc')](),controller[_0x3d96('0xd')]);router['get']('/:id',auth[_0x3d96('0xc')](),controller[_0x3d96('0xe')]);router[_0x3d96('0xb')](_0x3d96('0xf'),auth['isAuthenticated'](),controller[_0x3d96('0x10')]);router['get'](_0x3d96('0x11'),auth['isAuthenticated'](),controller[_0x3d96('0x12')]);router[_0x3d96('0x13')]('/',auth[_0x3d96('0xc')](),controller[_0x3d96('0x14')]);router[_0x3d96('0x13')](_0x3d96('0xf'),auth['isAuthenticated'](),controller[_0x3d96('0x15')]);router[_0x3d96('0x16')]('/:id',auth[_0x3d96('0xc')](),controller[_0x3d96('0x17')]);router[_0x3d96('0x18')](_0x3d96('0x19'),auth['isAuthenticated'](),controller[_0x3d96('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xedf9=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0xedf9,0x14c));var _0x9edf=function(_0x261631,_0x4749d8){_0x261631=_0x261631-0x0;var _0x4067ad=_0xedf9[_0x261631];return _0x4067ad;};'use strict';var multer=require(_0x9edf('0x0'));var util=require(_0x9edf('0x1'));var path=require(_0x9edf('0x2'));var timeout=require(_0x9edf('0x3'));var express=require(_0x9edf('0x4'));var router=express[_0x9edf('0x5')]();var fs_extra=require(_0x9edf('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9edf('0x7'));var config=require(_0x9edf('0x8'));var controller=require('./intDynamics365Account.controller');router[_0x9edf('0x9')]('/',auth[_0x9edf('0xa')](),controller[_0x9edf('0xb')]);router[_0x9edf('0x9')]('/:id',auth[_0x9edf('0xa')](),controller[_0x9edf('0xc')]);router[_0x9edf('0x9')](_0x9edf('0xd'),auth[_0x9edf('0xa')](),controller[_0x9edf('0xe')]);router[_0x9edf('0x9')](_0x9edf('0xf'),auth['isAuthenticated'](),controller[_0x9edf('0x10')]);router[_0x9edf('0x11')]('/',auth[_0x9edf('0xa')](),controller[_0x9edf('0x12')]);router['post'](_0x9edf('0xd'),auth[_0x9edf('0xa')](),controller[_0x9edf('0x13')]);router['put'](_0x9edf('0x14'),auth[_0x9edf('0xa')](),controller[_0x9edf('0x15')]);router['delete'](_0x9edf('0x14'),auth[_0x9edf('0xa')](),controller[_0x9edf('0x16')]);module[_0x9edf('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 8ad24da..4ea9b6a 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 _0xbf25=['STRING','BOOLEAN','sequelize'];(function(_0x5927f5,_0x4d02e3){var _0x1815d3=function(_0x2af9b0){while(--_0x2af9b0){_0x5927f5['push'](_0x5927f5['shift']());}};_0x1815d3(++_0x4d02e3);}(_0xbf25,0x15e));var _0x5bf2=function(_0x5c6a4c,_0x28c6a7){_0x5c6a4c=_0x5c6a4c-0x0;var _0x54e103=_0xbf25[_0x5c6a4c];return _0x54e103;};'use strict';var Sequelize=require(_0x5bf2('0x0'));module['exports']={'name':{'type':Sequelize[_0x5bf2('0x1')]},'username':{'type':Sequelize[_0x5bf2('0x1')]},'password':{'type':Sequelize[_0x5bf2('0x1')]},'remoteUri':{'type':Sequelize[_0x5bf2('0x1')]},'tenantId':{'type':Sequelize[_0x5bf2('0x1')]},'clientId':{'type':Sequelize[_0x5bf2('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x5bf2('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x5bf2('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x535f=['exports','STRING','BOOLEAN'];(function(_0x3e30e4,_0xd14221){var _0x398d1d=function(_0x21a234){while(--_0x21a234){_0x3e30e4['push'](_0x3e30e4['shift']());}};_0x398d1d(++_0xd14221);}(_0x535f,0x111));var _0xf535=function(_0x1300ec,_0x3ff267){_0x1300ec=_0x1300ec-0x0;var _0x2c13c9=_0x535f[_0x1300ec];return _0x2c13c9;};'use strict';var Sequelize=require('sequelize');module[_0xf535('0x0')]={'name':{'type':Sequelize[_0xf535('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xf535('0x1')]},'remoteUri':{'type':Sequelize[_0xf535('0x1')]},'tenantId':{'type':Sequelize[_0xf535('0x1')]},'clientId':{'type':Sequelize[_0xf535('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf535('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf535('0x1')]},'modernAuthentication':{'type':Sequelize[_0xf535('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index cbf9c62..355c046 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 _0x6b62=['title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','CloudProvider','data5','data7','modernAuthentication','access_token','/oauth2/token','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','forEach','@odata.type','push','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','all','statusCode','stack',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','json','offset','limit','undefined','count','Content-Range','update','then','destroy','end','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','Dynamics365Account','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall'];(function(_0x413306,_0x76f1ed){var _0x460ef2=function(_0x2afeb5){while(--_0x2afeb5){_0x413306['push'](_0x413306['shift']());}};_0x460ef2(++_0x76f1ed);}(_0x6b62,0x73));var _0x26b6=function(_0x593e3a,_0x55f8ec){_0x593e3a=_0x593e3a-0x0;var _0x5ada0a=_0x6b62[_0x593e3a];return _0x5ada0a;};'use strict';var rp=require(_0x26b6('0x0'));var util=require(_0x26b6('0x1'));var _=require(_0x26b6('0x2'));var qs=require(_0x26b6('0x3'));var logger=require(_0x26b6('0x4'))(_0x26b6('0x5'));var db=require('../../mysqldb')['db'];var integrations=require(_0x26b6('0x6'));function respondWithResult(_0x5a0cc0,_0x30d0e0){_0x30d0e0=_0x30d0e0||0xc8;return function(_0x99830f){if(_0x99830f){return _0x5a0cc0[_0x26b6('0x7')](_0x30d0e0)[_0x26b6('0x8')](_0x99830f);}};}function respondWithFilteredResult(_0x1bf35f,_0x53df70){return function(_0x159576){if(_0x159576){var _0x2e7a94=typeof _0x53df70[_0x26b6('0x9')]==='undefined'&&typeof _0x53df70[_0x26b6('0xa')]===_0x26b6('0xb');var _0x2ff2dd=_0x159576[_0x26b6('0xc')];var _0x2832b4=_0x2e7a94?0x0:_0x53df70[_0x26b6('0x9')];var _0xe00aa7=_0x2e7a94?_0x159576[_0x26b6('0xc')]:_0x53df70['offset']+_0x53df70[_0x26b6('0xa')];var _0x524016;if(_0xe00aa7>=_0x2ff2dd){_0xe00aa7=_0x2ff2dd;_0x524016=0xc8;}else{_0x524016=0xce;}_0x1bf35f[_0x26b6('0x7')](_0x524016);return _0x1bf35f['set'](_0x26b6('0xd'),_0x2832b4+'-'+_0xe00aa7+'/'+_0x2ff2dd)[_0x26b6('0x8')](_0x159576);}return null;};}function saveUpdates(_0x399cb2){return function(_0x307ff9){if(_0x307ff9){return _0x307ff9[_0x26b6('0xe')](_0x399cb2)[_0x26b6('0xf')](function(_0x2e6afc){return _0x2e6afc;});}return null;};}function removeEntity(_0x198724){return function(_0xa24995){if(_0xa24995){return _0xa24995[_0x26b6('0x10')]()[_0x26b6('0xf')](function(){_0x198724[_0x26b6('0x7')](0xcc)[_0x26b6('0x11')]();});}};}function handleEntityNotFound(_0x4c9a23){return function(_0x221cef){if(!_0x221cef){_0x4c9a23[_0x26b6('0x12')](0x194);}return _0x221cef;};}function handleError(_0x2777b6,_0x446d32){_0x446d32=_0x446d32||0x1f4;return function(_0x2c4bab){logger[_0x26b6('0x13')](_0x2c4bab['stack']);if(_0x2c4bab[_0x26b6('0x14')]){delete _0x2c4bab[_0x26b6('0x14')];}_0x2777b6[_0x26b6('0x7')](_0x446d32)[_0x26b6('0x15')](_0x2c4bab);};}exports[_0x26b6('0x16')]=function(_0x17012e,_0x3091c0){var _0x13b9d7={},_0x40b3ab={},_0x209a43={'count':0x0,'rows':[]};var _0x207d74=_[_0x26b6('0x17')](db['Dynamics365Account'][_0x26b6('0x18')],function(_0x500854){return{'name':_0x500854[_0x26b6('0x19')],'type':_0x500854[_0x26b6('0x1a')][_0x26b6('0x1b')]};});_0x40b3ab[_0x26b6('0x1c')]=_[_0x26b6('0x17')](_0x207d74,_0x26b6('0x14'));_0x40b3ab[_0x26b6('0x1d')]=_[_0x26b6('0x1e')](_0x17012e['query']);_0x40b3ab['filters']=_[_0x26b6('0x1f')](_0x40b3ab['model'],_0x40b3ab[_0x26b6('0x1d')]);_0x13b9d7[_0x26b6('0x20')]=_['intersection'](_0x40b3ab[_0x26b6('0x1c')],qs[_0x26b6('0x21')](_0x17012e[_0x26b6('0x1d')]['fields']));_0x13b9d7[_0x26b6('0x20')]=_0x13b9d7[_0x26b6('0x20')][_0x26b6('0x22')]?_0x13b9d7[_0x26b6('0x20')]:_0x40b3ab[_0x26b6('0x1c')];if(!_0x17012e[_0x26b6('0x1d')]['hasOwnProperty'](_0x26b6('0x23'))){_0x13b9d7[_0x26b6('0xa')]=qs['limit'](_0x17012e[_0x26b6('0x1d')]['limit']);_0x13b9d7['offset']=qs['offset'](_0x17012e[_0x26b6('0x1d')][_0x26b6('0x9')]);}_0x13b9d7[_0x26b6('0x24')]=qs[_0x26b6('0x25')](_0x17012e['query'][_0x26b6('0x25')]);_0x13b9d7[_0x26b6('0x26')]=qs[_0x26b6('0x27')](_[_0x26b6('0x28')](_0x17012e[_0x26b6('0x1d')],_0x40b3ab[_0x26b6('0x27')]),_0x207d74);if(_0x17012e[_0x26b6('0x1d')][_0x26b6('0x29')]){_0x13b9d7[_0x26b6('0x26')]=_['merge'](_0x13b9d7[_0x26b6('0x26')],{'$or':_[_0x26b6('0x17')](_0x207d74,function(_0x250ece){if(_0x250ece[_0x26b6('0x1a')]!=='VIRTUAL'){var _0x1416c4={};_0x1416c4[_0x250ece[_0x26b6('0x14')]]={'$like':'%'+_0x17012e['query'][_0x26b6('0x29')]+'%'};return _0x1416c4;}})});}_0x13b9d7=_[_0x26b6('0x2a')]({},_0x13b9d7,_0x17012e[_0x26b6('0x2b')]);var _0x1e945a={'where':_0x13b9d7['where']};return db[_0x26b6('0x2c')][_0x26b6('0xc')](_0x1e945a)[_0x26b6('0xf')](function(_0x5575f8){_0x209a43[_0x26b6('0xc')]=_0x5575f8;if(_0x17012e[_0x26b6('0x1d')][_0x26b6('0x2d')]){_0x13b9d7[_0x26b6('0x2e')]=[{'all':!![]}];}return db[_0x26b6('0x2c')][_0x26b6('0x2f')](_0x13b9d7);})[_0x26b6('0xf')](function(_0x3254ce){_0x209a43[_0x26b6('0x30')]=_0x3254ce;return _0x209a43;})['then'](respondWithFilteredResult(_0x3091c0,_0x13b9d7))[_0x26b6('0x31')](handleError(_0x3091c0,null));};exports['show']=function(_0x1c2bd2,_0x9a1585){var _0x4459d3={'raw':![],'where':{'id':_0x1c2bd2[_0x26b6('0x32')]['id']}},_0x189975={};_0x189975[_0x26b6('0x1c')]=_[_0x26b6('0x1e')](db['Dynamics365Account'][_0x26b6('0x18')]);_0x189975[_0x26b6('0x1d')]=_['keys'](_0x1c2bd2[_0x26b6('0x1d')]);_0x189975[_0x26b6('0x27')]=_['intersection'](_0x189975[_0x26b6('0x1c')],_0x189975[_0x26b6('0x1d')]);_0x4459d3[_0x26b6('0x20')]=_[_0x26b6('0x1f')](_0x189975['model'],qs['fields'](_0x1c2bd2['query'][_0x26b6('0x21')]));_0x4459d3['attributes']=_0x4459d3[_0x26b6('0x20')]['length']?_0x4459d3[_0x26b6('0x20')]:_0x189975['model'];if(_0x1c2bd2['query'][_0x26b6('0x2d')]){_0x4459d3['include']=[{'all':!![]}];}_0x4459d3=_[_0x26b6('0x2a')]({},_0x4459d3,_0x1c2bd2[_0x26b6('0x2b')]);return db['Dynamics365Account'][_0x26b6('0x33')](_0x4459d3)['then'](handleEntityNotFound(_0x9a1585,null))[_0x26b6('0xf')](respondWithResult(_0x9a1585,null))[_0x26b6('0x31')](handleError(_0x9a1585,null));};exports[_0x26b6('0x34')]=function(_0x3218ad,_0x571dc3){return db['Dynamics365Account'][_0x26b6('0x34')](_0x3218ad[_0x26b6('0x35')],{})['then'](respondWithResult(_0x571dc3,0xc9))['catch'](handleError(_0x571dc3,null));};exports['update']=function(_0x4699f9,_0x15c86b){if(_0x4699f9['body']['id']){delete _0x4699f9[_0x26b6('0x35')]['id'];}return db[_0x26b6('0x2c')][_0x26b6('0x33')]({'where':{'id':_0x4699f9[_0x26b6('0x32')]['id']}})[_0x26b6('0xf')](handleEntityNotFound(_0x15c86b,null))[_0x26b6('0xf')](saveUpdates(_0x4699f9[_0x26b6('0x35')],null))[_0x26b6('0xf')](respondWithResult(_0x15c86b,null))[_0x26b6('0x31')](handleError(_0x15c86b,null));};exports[_0x26b6('0x10')]=function(_0x1b72b5,_0x1d77e0){return db[_0x26b6('0x2c')][_0x26b6('0x33')]({'where':{'id':_0x1b72b5['params']['id']}})[_0x26b6('0xf')](handleEntityNotFound(_0x1d77e0,null))['then'](removeEntity(_0x1d77e0,null))[_0x26b6('0x31')](handleError(_0x1d77e0,null));};exports[_0x26b6('0x36')]=function(_0x486dba,_0x2f5365){var _0x12ee75={};var _0x3bec35={};var _0x2e23e1;var _0x235e1b;return db[_0x26b6('0x2c')][_0x26b6('0x37')]({'where':{'id':_0x486dba['params']['id']}})[_0x26b6('0xf')](handleEntityNotFound(_0x2f5365,null))[_0x26b6('0xf')](function(_0x16a798){if(_0x16a798){_0x2e23e1=_0x16a798;_0x3bec35[_0x26b6('0x1c')]=_['keys'](db[_0x26b6('0x38')]['rawAttributes']);_0x3bec35[_0x26b6('0x1d')]=_[_0x26b6('0x1e')](_0x486dba[_0x26b6('0x1d')]);_0x3bec35['filters']=_[_0x26b6('0x1f')](_0x3bec35[_0x26b6('0x1c')],_0x3bec35[_0x26b6('0x1d')]);_0x12ee75[_0x26b6('0x20')]=_['intersection'](_0x3bec35[_0x26b6('0x1c')],qs[_0x26b6('0x21')](_0x486dba['query'][_0x26b6('0x21')]));_0x12ee75[_0x26b6('0x20')]=_0x12ee75[_0x26b6('0x20')][_0x26b6('0x22')]?_0x12ee75[_0x26b6('0x20')]:_0x3bec35['model'];_0x12ee75[_0x26b6('0x24')]=qs[_0x26b6('0x25')](_0x486dba[_0x26b6('0x1d')][_0x26b6('0x25')]);_0x12ee75[_0x26b6('0x26')]=qs[_0x26b6('0x27')](_[_0x26b6('0x28')](_0x486dba[_0x26b6('0x1d')],_0x3bec35['filters']));if(_0x486dba[_0x26b6('0x1d')][_0x26b6('0x29')]){_0x12ee75[_0x26b6('0x26')]=_[_0x26b6('0x2a')](_0x12ee75[_0x26b6('0x26')],{'$or':_[_0x26b6('0x17')](_0x12ee75['attributes'],function(_0x10519f){var _0x46fa58={};_0x46fa58[_0x10519f]={'$like':'%'+_0x486dba[_0x26b6('0x1d')][_0x26b6('0x29')]+'%'};return _0x46fa58;})});}_0x12ee75=_[_0x26b6('0x2a')]({},_0x12ee75,_0x486dba[_0x26b6('0x2b')]);return _0x2e23e1[_0x26b6('0x36')](_0x12ee75);}})[_0x26b6('0xf')](function(_0x4f579e){if(_0x4f579e){_0x235e1b=_0x4f579e[_0x26b6('0x22')];if(!_0x486dba[_0x26b6('0x1d')][_0x26b6('0x39')](_0x26b6('0x23'))){_0x12ee75['limit']=qs[_0x26b6('0xa')](_0x486dba[_0x26b6('0x1d')][_0x26b6('0xa')]);_0x12ee75[_0x26b6('0x9')]=qs[_0x26b6('0x9')](_0x486dba[_0x26b6('0x1d')][_0x26b6('0x9')]);}return _0x2e23e1[_0x26b6('0x36')](_0x12ee75);}})[_0x26b6('0xf')](function(_0x4621d9){if(_0x4621d9){return _0x4621d9?{'count':_0x235e1b,'rows':_0x4621d9}:null;}})['then'](respondWithResult(_0x2f5365,null))[_0x26b6('0x31')](handleError(_0x2f5365,null));};exports[_0x26b6('0x3a')]=function(_0x416f2b,_0x33ae41){if(_0x416f2b[_0x26b6('0x35')]['id']){delete _0x416f2b['body']['id'];}return db['Dynamics365Account'][_0x26b6('0x37')]({'where':{'id':_0x416f2b[_0x26b6('0x32')]['id']}})[_0x26b6('0xf')](handleEntityNotFound(_0x33ae41,null))[_0x26b6('0xf')](function(_0x2b9cb6){if(_0x2b9cb6){_0x416f2b[_0x26b6('0x35')][_0x26b6('0x3b')]=_0x2b9cb6['id'];_0x416f2b[_0x26b6('0x35')][_0x26b6('0x3c')]=integrations[_0x26b6('0x3d')](_0x416f2b['body'][_0x26b6('0x3e')],_0x416f2b[_0x26b6('0x35')][_0x26b6('0x1a')]);_0x416f2b['body'][_0x26b6('0x3f')]=integrations[_0x26b6('0x40')](_0x416f2b[_0x26b6('0x35')]['channel'],_0x416f2b['body'][_0x26b6('0x1a')]);return db['Dynamics365Configuration'][_0x26b6('0x34')](_0x416f2b[_0x26b6('0x35')],{'include':[{'model':db[_0x26b6('0x41')],'as':_0x26b6('0x3c')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x26b6('0xf')](respondWithResult(_0x33ae41,null))[_0x26b6('0x31')](handleError(_0x33ae41,null));};function sanitizeRemoteUri(_0x37f638){var _0x1ad49e=_0x37f638['slice'](-0x1);if(_0x1ad49e==='/')return _0x37f638[_0x26b6('0x42')](0x0,_0x37f638[_0x26b6('0x43')](_0x1ad49e));return _0x37f638;}function getWebApiUrl(_0x1fc8a3){return util[_0x26b6('0x44')](_0x26b6('0x45'),_0x1fc8a3);}exports[_0x26b6('0x46')]=function(_0x528b69,_0x27b42f){var _0x5e5d5e=_0x528b69[_0x26b6('0x1d')][_0x26b6('0x47')];var _0x507949=_0x5e5d5e===_0x26b6('0x48')?_0x26b6('0x49'):_0x26b6('0x4a');var _0x5ea16e='';var _0x59b1db='';var _0x2dc7e1='';var _0xf123b='';var _0x212f8b='';var _0x503f6c='';var _0x32fc0f='';var _0x50e4d2='';var _0x50036f=[_0x26b6('0x4b'),_0x26b6('0x4c'),_0x26b6('0x4d'),_0x26b6('0x4e'),'caseorigincode',_0x26b6('0x4f'),_0x26b6('0x50'),_0x26b6('0x51'),_0x26b6('0x52'),_0x26b6('0x53')];var _0x46e9a5=[_0x26b6('0x54'),_0x26b6('0x55'),_0x26b6('0x56'),_0x26b6('0x57'),_0x26b6('0x58'),'contactidyominame',_0x26b6('0x59'),_0x26b6('0x5a'),_0x26b6('0x5b'),'createdbyexternalpartyyominame','createdbyname',_0x26b6('0x5c'),_0x26b6('0x5d'),_0x26b6('0x5e'),_0x26b6('0x5f'),_0x26b6('0x60'),_0x26b6('0x61'),_0x26b6('0x62'),'emailaddress','entitlementidname',_0x26b6('0x63'),_0x26b6('0x64'),_0x26b6('0x65'),_0x26b6('0x66'),_0x26b6('0x67'),'followupby',_0x26b6('0x68'),_0x26b6('0x69'),_0x26b6('0x6a'),_0x26b6('0x6b'),_0x26b6('0x6c'),_0x26b6('0x6d'),_0x26b6('0x6e'),_0x26b6('0x6f'),_0x26b6('0x70'),_0x26b6('0x71'),_0x26b6('0x72'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0x26b6('0x73'),_0x26b6('0x74'),_0x26b6('0x75'),'overriddencreatedon',_0x26b6('0x76'),_0x26b6('0x77'),'owneridyominame',_0x26b6('0x78'),_0x26b6('0x79'),_0x26b6('0x7a'),_0x26b6('0x7b'),_0x26b6('0x7c'),_0x26b6('0x7d'),_0x26b6('0x7e'),_0x26b6('0x7f'),_0x26b6('0x80'),'responsiblecontactidname',_0x26b6('0x81'),_0x26b6('0x82'),'slainvokedidname',_0x26b6('0x83'),_0x26b6('0x84'),_0x26b6('0x85'),_0x26b6('0x86'),'subjectidname','ticketnumber','timezoneruleversionnumber',_0x26b6('0x87'),_0x26b6('0x88'),_0x26b6('0x89'),_0x26b6('0x8a')];var _0x173a6c=_0x50036f[_0x26b6('0x8b')](_0x46e9a5);return db[_0x26b6('0x2c')][_0x26b6('0x37')]({'where':{'id':_0x528b69['params']['id']},'attributes':['id',_0x26b6('0x8c'),_0x26b6('0x8d'),_0x26b6('0x8e'),_0x26b6('0x8f'),_0x26b6('0x90'),'clientSecret','modernAuthentication'],'include':[{'model':db[_0x26b6('0x91')],'as':_0x26b6('0x91'),'attributes':['id',_0x26b6('0x92'),_0x26b6('0x93')]}]})[_0x26b6('0xf')](handleEntityNotFound(_0x27b42f,null))['then'](function(_0x458aa6){if(_0x458aa6){if(_0x458aa6[_0x26b6('0x94')]){_0x458aa6[_0x26b6('0x95')]=_0x458aa6['CloudProvider'][_0x26b6('0x92')];_0x50e4d2=sanitizeRemoteUri(_0x458aa6['CloudProvider'][_0x26b6('0x93')]);_0x32fc0f=getWebApiUrl(_0x50e4d2);return _0x458aa6;}_0x50e4d2=sanitizeRemoteUri(_0x458aa6[_0x26b6('0x8e')]);_0x32fc0f=getWebApiUrl(_0x50e4d2);var _0x391a8e={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x458aa6[_0x26b6('0x8f')]+_0x26b6('0x96'),'form':{'client_id':_0x458aa6[_0x26b6('0x90')],'resource':_0x50e4d2,'username':_0x458aa6[_0x26b6('0x8c')],'password':_0x458aa6[_0x26b6('0x8d')],'grant_type':_0x26b6('0x8d'),'client_secret':_0x458aa6[_0x26b6('0x97')]},'json':!![]};return rp(_0x391a8e);}})[_0x26b6('0xf')](function(_0x12f848){_0x503f6c=_0x12f848[_0x26b6('0x95')];var _0x3f38ea={'method':_0x26b6('0x98'),'uri':encodeURI(_0x32fc0f+_0x26b6('0x99')+_0x507949+'\x27'),'headers':{'Authorization':_0x26b6('0x9a')+_0x503f6c,'If-None-Match':null,'OData-Version':_0x26b6('0x9b')},'json':!![]};return rp(_0x3f38ea);})[_0x26b6('0xf')](function(_0x10b4b4){var _0x338b3a=_0x10b4b4['value'][0x0];var _0x1b675b=_0x338b3a[_0x26b6('0x9c')];var _0x54aa0a={'method':'GET','uri':_0x32fc0f+_0x26b6('0x9d')+_0x1b675b+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x26b6('0x9a')+_0x503f6c,'If-None-Match':null,'OData-Version':_0x26b6('0x9b')},'json':!![]};return rp(_0x54aa0a);})['then'](function(_0x4ccd9b){_0x5ea16e=_0x4ccd9b;_0x59b1db=_0x5ea16e[_0x26b6('0x9e')];_0x59b1db=_[_0x26b6('0x9f')](_0x59b1db,function(_0x253a82){return!_0x173a6c[_0x26b6('0xa0')](_0x253a82[_0x26b6('0xa1')]);});var _0x552573=[];var _0x4421d5=[];_0x59b1db[_0x26b6('0xa2')](function(_0x30cbef){if(_0x30cbef[_0x26b6('0xa3')]){var _0xc80da1=_0x30cbef[_0x26b6('0xa3')][_0x26b6('0x42')](_0x30cbef['@odata.type'][_0x26b6('0x43')]('.')+0x1);if(_0xc80da1==='PicklistAttributeMetadata'){_0x552573[_0x26b6('0xa4')](getSelectList(_0x32fc0f,_0x5e5d5e,_0x4421d5,_0x5ea16e[_0x26b6('0x9c')],_0x30cbef[_0x26b6('0x9c')],_0x503f6c));}}});return Promise['all'](_0x552573);})[_0x26b6('0xf')](function(_0x13a3c8){_0x2dc7e1=_0x13a3c8[0x0];var _0x167a39=[];var _0x31a386=[];_0x59b1db['forEach'](function(_0x33b3c1){if(!_[_0x26b6('0xa5')](_0x33b3c1[_0x26b6('0xa3')])){var _0x5ac5e7=_0x33b3c1[_0x26b6('0xa3')][_0x26b6('0x42')](_0x33b3c1[_0x26b6('0xa3')][_0x26b6('0x43')]('.')+0x1);if(_0x5ac5e7===_0x26b6('0xa6')){_0x167a39[_0x26b6('0xa4')](getBooleanList(_0x32fc0f,_0x5e5d5e,_0x31a386,_0x5ea16e[_0x26b6('0x9c')],_0x33b3c1[_0x26b6('0x9c')],_0x503f6c));}}});return Promise['all'](_0x167a39);})[_0x26b6('0xf')](function(_0xcac18){_0xf123b=_0xcac18[0x0];var _0x2bf7f5=[];var _0x25ef86=[];_0x59b1db[_0x26b6('0xa2')](function(_0x2cb8a0){if(_0x2cb8a0[_0x26b6('0xa3')]){var _0x50e1c0=_0x2cb8a0[_0x26b6('0xa3')][_0x26b6('0x42')](_0x2cb8a0[_0x26b6('0xa3')][_0x26b6('0x43')]('.')+0x1);if(_0x50e1c0==='StringAttributeMetadata'||_0x50e1c0===_0x26b6('0xa7')||_0x50e1c0==='BigIntAttributeMetadata'||_0x50e1c0===_0x26b6('0xa8')||_0x50e1c0===_0x26b6('0xa9')||_0x50e1c0===_0x26b6('0xaa')||_0x50e1c0===_0x26b6('0xab')||_0x50e1c0===_0x26b6('0xac')||_0x50e1c0===_0x26b6('0xad')||_0x50e1c0==='DecimalAttributeMetadata'){_0x2bf7f5[_0x26b6('0xa4')](getInputList(_0x32fc0f,_0x5e5d5e,_0x50e1c0,_0x25ef86,_0x5ea16e['MetadataId'],_0x2cb8a0[_0x26b6('0x9c')],_0x503f6c));}}});return Promise[_0x26b6('0xae')](_0x2bf7f5);})[_0x26b6('0xf')](function(_0x28b745){_0x212f8b=_0x28b745[0x0];var _0x405396=_0x2dc7e1[_0x26b6('0x8b')](_0xf123b)[_0x26b6('0x8b')](_0x212f8b);var _0x2e7e35={'count':_0x405396['length'],'rows':_0x405396};return _0x2e7e35;})['then'](respondWithResult(_0x27b42f,null))[_0x26b6('0x31')](function(_0x14ee94){var _0x40c64=_0x528b69[_0x26b6('0x1d')]['test']?0x1f4:_0x14ee94[_0x26b6('0xaf')]||0x1f4;logger['error'](_0x14ee94[_0x26b6('0xb0')]);delete _0x14ee94[_0x26b6('0x14')];if(_0x40c64===0x191){_0x40c64=0x190;}_0x27b42f['status'](_0x40c64)[_0x26b6('0x15')](_0x528b69[_0x26b6('0x1d')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x14ee94['statusCode']}:_0x14ee94);});};function getSelectList(_0x112594,_0x4999c4,_0x5c34bc,_0x5c7043,_0x61859d,_0x230a8a){var _0x1ffe3f={'method':'GET','uri':_0x112594+'EntityDefinitions('+_0x5c7043+_0x26b6('0xb1')+_0x61859d+_0x26b6('0xb2')+_0x26b6('0xb3'),'headers':{'Authorization':_0x26b6('0x9a')+_0x230a8a,'If-None-Match':null,'OData-Version':_0x26b6('0x9b')},'json':!![]};return rp(_0x1ffe3f)['then'](function(_0x2a9c7a){var _0x42da19=[];var _0x1fe7e9=_0x2a9c7a[_0x26b6('0xb4')][_0x26b6('0xb5')];_0x1fe7e9[_0x26b6('0xa2')](function(_0x4973ec){_0x42da19[_0x26b6('0xa4')]({'name':_0x4973ec[_0x26b6('0xb6')][_0x26b6('0xb7')][_0x26b6('0xb6')],'value':String(_0x4973ec[_0x26b6('0xb8')])});});var _0x4e4b5c={'id':_0x4999c4+'_'+_0x2a9c7a[_0x26b6('0xa1')],'name':_0x2a9c7a[_0x26b6('0xb9')][_0x26b6('0xb7')][_0x26b6('0xb6')],'custom':![],'options':_0x42da19};_0x5c34bc['push'](_0x4e4b5c);return _0x5c34bc;});}function getBooleanList(_0x3eec40,_0x189d3a,_0x53b9b7,_0x1fa40f,_0x341ce9,_0xd3224f){var _0xb67554={'method':_0x26b6('0x98'),'uri':_0x3eec40+'EntityDefinitions('+_0x1fa40f+_0x26b6('0xb1')+_0x341ce9+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0xd3224f,'If-None-Match':null,'OData-Version':_0x26b6('0x9b')},'json':!![]};return rp(_0xb67554)['then'](function(_0x54fe9b){var _0xa0008=[];_0xa0008[_0x26b6('0xa4')]({'name':_0x54fe9b[_0x26b6('0xb4')]['TrueOption'][_0x26b6('0xb6')][_0x26b6('0xb7')][_0x26b6('0xb6')],'value':_0x26b6('0xba')},{'name':_0x54fe9b[_0x26b6('0xb4')]['FalseOption'][_0x26b6('0xb6')][_0x26b6('0xb7')]['Label'],'value':_0x26b6('0xbb')});var _0x273b14={'id':_0x189d3a+'_'+_0x54fe9b[_0x26b6('0xa1')],'name':_0x54fe9b[_0x26b6('0xb9')][_0x26b6('0xb7')][_0x26b6('0xb6')],'custom':![],'options':_0xa0008};_0x53b9b7[_0x26b6('0xa4')](_0x273b14);return _0x53b9b7;});}function getInputList(_0x4c97fc,_0x646cba,_0x3490d1,_0x52c178,_0x269cf3,_0x27f85b,_0x1adfef){var _0x28e6b2={'method':_0x26b6('0x98'),'uri':_0x4c97fc+_0x26b6('0x9d')+_0x269cf3+_0x26b6('0xb1')+_0x27f85b+_0x26b6('0xbc')+_0x3490d1+_0x26b6('0xbd'),'headers':{'Authorization':'Bearer\x20'+_0x1adfef,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x28e6b2)[_0x26b6('0xf')](function(_0xe17c4e){var _0x43eecb={'id':_0x646cba+'_'+_0xe17c4e[_0x26b6('0xa1')],'name':_0xe17c4e['DisplayName'][_0x26b6('0xb7')]?_0xe17c4e[_0x26b6('0xb9')][_0x26b6('0xb7')][_0x26b6('0xb6')]:_0xe17c4e['LogicalName'],'custom':![],'options':[]};_0x52c178[_0x26b6('0xa4')](_0x43eecb);return _0x52c178;});} \ No newline at end of file +var _0x43c8=['stack','name','index','Dynamics365Account','fieldName','key','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','options','find','create','body','findOne','Dynamics365Configuration','order','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','getFields','ticketType','incident','PhoneCall','title','customerid','caseorigincode','subject','phonenumber','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','followupby','importsequencenumber','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','primarycontactidyominame','prioritycodename','productidname','productserialnumber','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','modernAuthentication','CloudProvider','data5','access_token','data7','POST','https://login.microsoftonline.com/','tenantId','clientId','clientSecret','GET','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','send','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','sendStatus'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x43c8,0xaf));var _0x843c=function(_0x4496fc,_0x3e4bdb){_0x4496fc=_0x4496fc-0x0;var _0x5dcf3d=_0x43c8[_0x4496fc];return _0x5dcf3d;};'use strict';var rp=require('request-promise');var util=require(_0x843c('0x0'));var _=require('lodash');var qs=require(_0x843c('0x1'));var logger=require(_0x843c('0x2'))(_0x843c('0x3'));var db=require(_0x843c('0x4'))['db'];var integrations=require(_0x843c('0x5'));function respondWithResult(_0x199998,_0x3ca11e){_0x3ca11e=_0x3ca11e||0xc8;return function(_0x4d6199){if(_0x4d6199){return _0x199998[_0x843c('0x6')](_0x3ca11e)[_0x843c('0x7')](_0x4d6199);}};}function respondWithFilteredResult(_0xc5913e,_0x15bb1f){return function(_0xd198e5){if(_0xd198e5){var _0x49aee7=typeof _0x15bb1f[_0x843c('0x8')]===_0x843c('0x9')&&typeof _0x15bb1f['limit']===_0x843c('0x9');var _0x566777=_0xd198e5['count'];var _0x204fdb=_0x49aee7?0x0:_0x15bb1f['offset'];var _0x3a360e=_0x49aee7?_0xd198e5[_0x843c('0xa')]:_0x15bb1f[_0x843c('0x8')]+_0x15bb1f[_0x843c('0xb')];var _0x4d7aeb;if(_0x3a360e>=_0x566777){_0x3a360e=_0x566777;_0x4d7aeb=0xc8;}else{_0x4d7aeb=0xce;}_0xc5913e[_0x843c('0x6')](_0x4d7aeb);return _0xc5913e[_0x843c('0xc')](_0x843c('0xd'),_0x204fdb+'-'+_0x3a360e+'/'+_0x566777)[_0x843c('0x7')](_0xd198e5);}return null;};}function saveUpdates(_0x231ce1){return function(_0x34e297){if(_0x34e297){return _0x34e297[_0x843c('0xe')](_0x231ce1)[_0x843c('0xf')](function(_0x1c1fa0){return _0x1c1fa0;});}return null;};}function removeEntity(_0x7092f0){return function(_0x313947){if(_0x313947){return _0x313947[_0x843c('0x10')]()[_0x843c('0xf')](function(){_0x7092f0[_0x843c('0x6')](0xcc)[_0x843c('0x11')]();});}};}function handleEntityNotFound(_0x5577ff){return function(_0x3dc50d){if(!_0x3dc50d){_0x5577ff[_0x843c('0x12')](0x194);}return _0x3dc50d;};}function handleError(_0x1d92cf,_0x42558b){_0x42558b=_0x42558b||0x1f4;return function(_0x16e8f6){logger['error'](_0x16e8f6[_0x843c('0x13')]);if(_0x16e8f6[_0x843c('0x14')]){delete _0x16e8f6[_0x843c('0x14')];}_0x1d92cf[_0x843c('0x6')](_0x42558b)['send'](_0x16e8f6);};}exports[_0x843c('0x15')]=function(_0x44b41a,_0x181508){var _0x65b0e5={},_0x1db871={},_0x556049={'count':0x0,'rows':[]};var _0x23cd34=_['map'](db[_0x843c('0x16')]['rawAttributes'],function(_0x3422a3){return{'name':_0x3422a3[_0x843c('0x17')],'type':_0x3422a3['type'][_0x843c('0x18')]};});_0x1db871[_0x843c('0x19')]=_[_0x843c('0x1a')](_0x23cd34,_0x843c('0x14'));_0x1db871['query']=_['keys'](_0x44b41a['query']);_0x1db871[_0x843c('0x1b')]=_[_0x843c('0x1c')](_0x1db871[_0x843c('0x19')],_0x1db871[_0x843c('0x1d')]);_0x65b0e5[_0x843c('0x1e')]=_[_0x843c('0x1c')](_0x1db871[_0x843c('0x19')],qs['fields'](_0x44b41a[_0x843c('0x1d')][_0x843c('0x1f')]));_0x65b0e5[_0x843c('0x1e')]=_0x65b0e5['attributes'][_0x843c('0x20')]?_0x65b0e5['attributes']:_0x1db871[_0x843c('0x19')];if(!_0x44b41a[_0x843c('0x1d')][_0x843c('0x21')]('nolimit')){_0x65b0e5[_0x843c('0xb')]=qs[_0x843c('0xb')](_0x44b41a[_0x843c('0x1d')][_0x843c('0xb')]);_0x65b0e5[_0x843c('0x8')]=qs[_0x843c('0x8')](_0x44b41a['query'][_0x843c('0x8')]);}_0x65b0e5['order']=qs[_0x843c('0x22')](_0x44b41a[_0x843c('0x1d')][_0x843c('0x22')]);_0x65b0e5[_0x843c('0x23')]=qs['filters'](_[_0x843c('0x24')](_0x44b41a[_0x843c('0x1d')],_0x1db871[_0x843c('0x1b')]),_0x23cd34);if(_0x44b41a[_0x843c('0x1d')][_0x843c('0x25')]){_0x65b0e5[_0x843c('0x23')]=_[_0x843c('0x26')](_0x65b0e5[_0x843c('0x23')],{'$or':_[_0x843c('0x1a')](_0x23cd34,function(_0x2682b9){if(_0x2682b9[_0x843c('0x27')]!==_0x843c('0x28')){var _0x59c027={};_0x59c027[_0x2682b9[_0x843c('0x14')]]={'$like':'%'+_0x44b41a['query'][_0x843c('0x25')]+'%'};return _0x59c027;}})});}_0x65b0e5=_[_0x843c('0x26')]({},_0x65b0e5,_0x44b41a['options']);var _0x2cb970={'where':_0x65b0e5[_0x843c('0x23')]};return db[_0x843c('0x16')]['count'](_0x2cb970)[_0x843c('0xf')](function(_0x770e0b){_0x556049['count']=_0x770e0b;if(_0x44b41a[_0x843c('0x1d')]['includeAll']){_0x65b0e5[_0x843c('0x29')]=[{'all':!![]}];}return db[_0x843c('0x16')][_0x843c('0x2a')](_0x65b0e5);})['then'](function(_0x37a2ad){_0x556049[_0x843c('0x2b')]=_0x37a2ad;return _0x556049;})[_0x843c('0xf')](respondWithFilteredResult(_0x181508,_0x65b0e5))[_0x843c('0x2c')](handleError(_0x181508,null));};exports[_0x843c('0x2d')]=function(_0x5351de,_0x11a182){var _0x17309a={'raw':![],'where':{'id':_0x5351de[_0x843c('0x2e')]['id']}},_0x6932cc={};_0x6932cc[_0x843c('0x19')]=_[_0x843c('0x2f')](db['Dynamics365Account'][_0x843c('0x30')]);_0x6932cc[_0x843c('0x1d')]=_[_0x843c('0x2f')](_0x5351de[_0x843c('0x1d')]);_0x6932cc[_0x843c('0x1b')]=_[_0x843c('0x1c')](_0x6932cc[_0x843c('0x19')],_0x6932cc['query']);_0x17309a['attributes']=_[_0x843c('0x1c')](_0x6932cc[_0x843c('0x19')],qs[_0x843c('0x1f')](_0x5351de['query'][_0x843c('0x1f')]));_0x17309a[_0x843c('0x1e')]=_0x17309a[_0x843c('0x1e')][_0x843c('0x20')]?_0x17309a[_0x843c('0x1e')]:_0x6932cc['model'];if(_0x5351de[_0x843c('0x1d')][_0x843c('0x31')]){_0x17309a[_0x843c('0x29')]=[{'all':!![]}];}_0x17309a=_[_0x843c('0x26')]({},_0x17309a,_0x5351de[_0x843c('0x32')]);return db[_0x843c('0x16')][_0x843c('0x33')](_0x17309a)[_0x843c('0xf')](handleEntityNotFound(_0x11a182,null))[_0x843c('0xf')](respondWithResult(_0x11a182,null))[_0x843c('0x2c')](handleError(_0x11a182,null));};exports[_0x843c('0x34')]=function(_0x6017d6,_0x3daa99){return db[_0x843c('0x16')][_0x843c('0x34')](_0x6017d6['body'],{})['then'](respondWithResult(_0x3daa99,0xc9))['catch'](handleError(_0x3daa99,null));};exports[_0x843c('0xe')]=function(_0x5b244c,_0x2b17bf){if(_0x5b244c[_0x843c('0x35')]['id']){delete _0x5b244c['body']['id'];}return db[_0x843c('0x16')]['find']({'where':{'id':_0x5b244c['params']['id']}})['then'](handleEntityNotFound(_0x2b17bf,null))[_0x843c('0xf')](saveUpdates(_0x5b244c['body'],null))[_0x843c('0xf')](respondWithResult(_0x2b17bf,null))[_0x843c('0x2c')](handleError(_0x2b17bf,null));};exports['destroy']=function(_0x4e2e6a,_0x10d611){return db[_0x843c('0x16')][_0x843c('0x33')]({'where':{'id':_0x4e2e6a[_0x843c('0x2e')]['id']}})[_0x843c('0xf')](handleEntityNotFound(_0x10d611,null))['then'](removeEntity(_0x10d611,null))[_0x843c('0x2c')](handleError(_0x10d611,null));};exports['getConfigurations']=function(_0x3e9a75,_0x2551e3){var _0x2222a8={};var _0x35cb8f={};var _0x278952;var _0x29b6b2;return db[_0x843c('0x16')][_0x843c('0x36')]({'where':{'id':_0x3e9a75[_0x843c('0x2e')]['id']}})[_0x843c('0xf')](handleEntityNotFound(_0x2551e3,null))[_0x843c('0xf')](function(_0x41f9fa){if(_0x41f9fa){_0x278952=_0x41f9fa;_0x35cb8f[_0x843c('0x19')]=_[_0x843c('0x2f')](db[_0x843c('0x37')][_0x843c('0x30')]);_0x35cb8f[_0x843c('0x1d')]=_['keys'](_0x3e9a75[_0x843c('0x1d')]);_0x35cb8f[_0x843c('0x1b')]=_[_0x843c('0x1c')](_0x35cb8f[_0x843c('0x19')],_0x35cb8f[_0x843c('0x1d')]);_0x2222a8['attributes']=_[_0x843c('0x1c')](_0x35cb8f['model'],qs[_0x843c('0x1f')](_0x3e9a75['query'][_0x843c('0x1f')]));_0x2222a8[_0x843c('0x1e')]=_0x2222a8[_0x843c('0x1e')][_0x843c('0x20')]?_0x2222a8[_0x843c('0x1e')]:_0x35cb8f[_0x843c('0x19')];_0x2222a8[_0x843c('0x38')]=qs[_0x843c('0x22')](_0x3e9a75[_0x843c('0x1d')][_0x843c('0x22')]);_0x2222a8['where']=qs[_0x843c('0x1b')](_[_0x843c('0x24')](_0x3e9a75[_0x843c('0x1d')],_0x35cb8f[_0x843c('0x1b')]));if(_0x3e9a75[_0x843c('0x1d')][_0x843c('0x25')]){_0x2222a8[_0x843c('0x23')]=_[_0x843c('0x26')](_0x2222a8[_0x843c('0x23')],{'$or':_[_0x843c('0x1a')](_0x2222a8['attributes'],function(_0x2c4044){var _0x110b6b={};_0x110b6b[_0x2c4044]={'$like':'%'+_0x3e9a75[_0x843c('0x1d')]['filter']+'%'};return _0x110b6b;})});}_0x2222a8=_[_0x843c('0x26')]({},_0x2222a8,_0x3e9a75[_0x843c('0x32')]);return _0x278952[_0x843c('0x39')](_0x2222a8);}})[_0x843c('0xf')](function(_0x3d2d2d){if(_0x3d2d2d){_0x29b6b2=_0x3d2d2d[_0x843c('0x20')];if(!_0x3e9a75[_0x843c('0x1d')][_0x843c('0x21')]('nolimit')){_0x2222a8['limit']=qs[_0x843c('0xb')](_0x3e9a75[_0x843c('0x1d')][_0x843c('0xb')]);_0x2222a8['offset']=qs[_0x843c('0x8')](_0x3e9a75[_0x843c('0x1d')][_0x843c('0x8')]);}return _0x278952[_0x843c('0x39')](_0x2222a8);}})[_0x843c('0xf')](function(_0x55803e){if(_0x55803e){return _0x55803e?{'count':_0x29b6b2,'rows':_0x55803e}:null;}})[_0x843c('0xf')](respondWithResult(_0x2551e3,null))['catch'](handleError(_0x2551e3,null));};exports[_0x843c('0x3a')]=function(_0x3eb528,_0x3faa1f){if(_0x3eb528[_0x843c('0x35')]['id']){delete _0x3eb528[_0x843c('0x35')]['id'];}return db['Dynamics365Account'][_0x843c('0x36')]({'where':{'id':_0x3eb528['params']['id']}})[_0x843c('0xf')](handleEntityNotFound(_0x3faa1f,null))[_0x843c('0xf')](function(_0x52a704){if(_0x52a704){_0x3eb528[_0x843c('0x35')][_0x843c('0x3b')]=_0x52a704['id'];_0x3eb528[_0x843c('0x35')][_0x843c('0x3c')]=integrations[_0x843c('0x3d')](_0x3eb528[_0x843c('0x35')][_0x843c('0x3e')],_0x3eb528[_0x843c('0x35')][_0x843c('0x27')]);_0x3eb528['body'][_0x843c('0x3f')]=integrations[_0x843c('0x40')](_0x3eb528['body'][_0x843c('0x3e')],_0x3eb528[_0x843c('0x35')]['type']);return db[_0x843c('0x37')][_0x843c('0x34')](_0x3eb528[_0x843c('0x35')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0x843c('0x41')],'as':'Descriptions'}]});}return null;})[_0x843c('0xf')](respondWithResult(_0x3faa1f,null))[_0x843c('0x2c')](handleError(_0x3faa1f,null));};function sanitizeRemoteUri(_0x357d82){var _0x1098d0=_0x357d82[_0x843c('0x42')](-0x1);if(_0x1098d0==='/')return _0x357d82[_0x843c('0x43')](0x0,_0x357d82[_0x843c('0x44')](_0x1098d0));return _0x357d82;}function getWebApiUrl(_0x3a348d){return util[_0x843c('0x45')]('%s/api/data/v9.0/',_0x3a348d);}exports[_0x843c('0x46')]=function(_0x5e4880,_0x1bdf14){var _0x49d091=_0x5e4880[_0x843c('0x1d')][_0x843c('0x47')];var _0x37e8e1=_0x49d091===_0x843c('0x48')?'Incident':_0x843c('0x49');var _0x355fbd='';var _0xb9078c='';var _0x5dc47a='';var _0x15b36e='';var _0x5388cf='';var _0x249e63='';var _0x227971='';var _0x53d1dc='';var _0x16983d=[_0x843c('0x4a'),'description',_0x843c('0x4b'),'ownerid',_0x843c('0x4c'),_0x843c('0x4d'),_0x843c('0x4e'),'regardingobjectid',_0x843c('0x4f'),'phonecall_activity_parties'];var _0x26ec01=[_0x843c('0x50'),_0x843c('0x51'),_0x843c('0x52'),_0x843c('0x53'),_0x843c('0x54'),_0x843c('0x55'),_0x843c('0x56'),_0x843c('0x57'),_0x843c('0x58'),_0x843c('0x59'),_0x843c('0x5a'),_0x843c('0x5b'),_0x843c('0x5c'),_0x843c('0x5d'),_0x843c('0x5e'),_0x843c('0x5f'),_0x843c('0x60'),_0x843c('0x61'),_0x843c('0x62'),_0x843c('0x63'),_0x843c('0x64'),_0x843c('0x65'),'escalatedon',_0x843c('0x66'),'firstresponsebykpiidname',_0x843c('0x67'),_0x843c('0x68'),'influencescore','kbarticleidname','lastonholdtime',_0x843c('0x69'),_0x843c('0x6a'),_0x843c('0x6b'),'modifiedbyname',_0x843c('0x6c'),_0x843c('0x6d'),_0x843c('0x6e'),_0x843c('0x6f'),_0x843c('0x70'),'msdyn_iotalertname',_0x843c('0x71'),_0x843c('0x72'),_0x843c('0x73'),_0x843c('0x74'),'owneridtype',_0x843c('0x75'),'parentcaseidname','primarycontactidname',_0x843c('0x76'),_0x843c('0x77'),_0x843c('0x78'),_0x843c('0x79'),'resolveby','resolvebykpiidname',_0x843c('0x7a'),_0x843c('0x7b'),_0x843c('0x7c'),_0x843c('0x7d'),_0x843c('0x7e'),_0x843c('0x7f'),_0x843c('0x80'),_0x843c('0x81'),_0x843c('0x82'),_0x843c('0x83'),_0x843c('0x84'),_0x843c('0x85'),_0x843c('0x86'),_0x843c('0x87'),_0x843c('0x88'),_0x843c('0x89')];var _0x159b57=_0x16983d[_0x843c('0x8a')](_0x26ec01);return db[_0x843c('0x16')]['findOne']({'where':{'id':_0x5e4880['params']['id']},'attributes':['id',_0x843c('0x8b'),_0x843c('0x8c'),_0x843c('0x8d'),'tenantId','clientId','clientSecret',_0x843c('0x8e')],'include':[{'model':db[_0x843c('0x8f')],'as':_0x843c('0x8f'),'attributes':['id',_0x843c('0x90'),'data7']}]})['then'](handleEntityNotFound(_0x1bdf14,null))[_0x843c('0xf')](function(_0x3bd36b){if(_0x3bd36b){if(_0x3bd36b[_0x843c('0x8e')]){_0x3bd36b[_0x843c('0x91')]=_0x3bd36b[_0x843c('0x8f')]['data5'];_0x53d1dc=sanitizeRemoteUri(_0x3bd36b[_0x843c('0x8f')][_0x843c('0x92')]);_0x227971=getWebApiUrl(_0x53d1dc);return _0x3bd36b;}_0x53d1dc=sanitizeRemoteUri(_0x3bd36b['remoteUri']);_0x227971=getWebApiUrl(_0x53d1dc);var _0x260035={'method':_0x843c('0x93'),'uri':_0x843c('0x94')+_0x3bd36b[_0x843c('0x95')]+'/oauth2/token','form':{'client_id':_0x3bd36b[_0x843c('0x96')],'resource':_0x53d1dc,'username':_0x3bd36b[_0x843c('0x8b')],'password':_0x3bd36b['password'],'grant_type':'password','client_secret':_0x3bd36b[_0x843c('0x97')]},'json':!![]};return rp(_0x260035);}})[_0x843c('0xf')](function(_0x2f0a8e){_0x249e63=_0x2f0a8e['access_token'];var _0x1441fb={'method':_0x843c('0x98'),'uri':encodeURI(_0x227971+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x37e8e1+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x249e63,'If-None-Match':null,'OData-Version':_0x843c('0x99')},'json':!![]};return rp(_0x1441fb);})['then'](function(_0x2b5eae){var _0x44642a=_0x2b5eae[_0x843c('0x9a')][0x0];var _0x1e8b53=_0x44642a[_0x843c('0x9b')];var _0x49804d={'method':_0x843c('0x98'),'uri':_0x227971+'EntityDefinitions('+_0x1e8b53+_0x843c('0x9c'),'headers':{'Authorization':'Bearer\x20'+_0x249e63,'If-None-Match':null,'OData-Version':_0x843c('0x99')},'json':!![]};return rp(_0x49804d);})[_0x843c('0xf')](function(_0x2829cd){_0x355fbd=_0x2829cd;_0xb9078c=_0x355fbd[_0x843c('0x9d')];_0xb9078c=_[_0x843c('0x9e')](_0xb9078c,function(_0x3f377e){return!_0x159b57['includes'](_0x3f377e[_0x843c('0x9f')]);});var _0x571a6f=[];var _0x151d7c=[];_0xb9078c[_0x843c('0xa0')](function(_0x21aef9){if(_0x21aef9[_0x843c('0xa1')]){var _0x4fa90b=_0x21aef9[_0x843c('0xa1')][_0x843c('0x43')](_0x21aef9[_0x843c('0xa1')][_0x843c('0x44')]('.')+0x1);if(_0x4fa90b===_0x843c('0xa2')){_0x571a6f[_0x843c('0xa3')](getSelectList(_0x227971,_0x49d091,_0x151d7c,_0x355fbd[_0x843c('0x9b')],_0x21aef9[_0x843c('0x9b')],_0x249e63));}}});return Promise[_0x843c('0xa4')](_0x571a6f);})['then'](function(_0x5eaa62){_0x5dc47a=_0x5eaa62[0x0];var _0x1069e7=[];var _0x4ebf2f=[];_0xb9078c[_0x843c('0xa0')](function(_0x509b4d){if(!_[_0x843c('0xa5')](_0x509b4d['@odata.type'])){var _0x3a5410=_0x509b4d['@odata.type']['substring'](_0x509b4d['@odata.type']['lastIndexOf']('.')+0x1);if(_0x3a5410===_0x843c('0xa6')){_0x1069e7[_0x843c('0xa3')](getBooleanList(_0x227971,_0x49d091,_0x4ebf2f,_0x355fbd[_0x843c('0x9b')],_0x509b4d[_0x843c('0x9b')],_0x249e63));}}});return Promise[_0x843c('0xa4')](_0x1069e7);})[_0x843c('0xf')](function(_0x4c18bb){_0x15b36e=_0x4c18bb[0x0];var _0x34ca3d=[];var _0x56d34d=[];_0xb9078c[_0x843c('0xa0')](function(_0x4d49c0){if(_0x4d49c0[_0x843c('0xa1')]){var _0x3b2c7c=_0x4d49c0[_0x843c('0xa1')][_0x843c('0x43')](_0x4d49c0[_0x843c('0xa1')][_0x843c('0x44')]('.')+0x1);if(_0x3b2c7c===_0x843c('0xa7')||_0x3b2c7c===_0x843c('0xa8')||_0x3b2c7c===_0x843c('0xa9')||_0x3b2c7c===_0x843c('0xaa')||_0x3b2c7c==='MemoAttributeMetadata'||_0x3b2c7c==='DateTimeAttributeMetadata'||_0x3b2c7c===_0x843c('0xab')||_0x3b2c7c===_0x843c('0xac')||_0x3b2c7c==='StateAttributeMetadata'||_0x3b2c7c===_0x843c('0xad')){_0x34ca3d[_0x843c('0xa3')](getInputList(_0x227971,_0x49d091,_0x3b2c7c,_0x56d34d,_0x355fbd[_0x843c('0x9b')],_0x4d49c0[_0x843c('0x9b')],_0x249e63));}}});return Promise[_0x843c('0xa4')](_0x34ca3d);})['then'](function(_0x365340){_0x5388cf=_0x365340[0x0];var _0x2d9e4a=_0x5dc47a[_0x843c('0x8a')](_0x15b36e)[_0x843c('0x8a')](_0x5388cf);var _0x2e9970={'count':_0x2d9e4a[_0x843c('0x20')],'rows':_0x2d9e4a};return _0x2e9970;})[_0x843c('0xf')](respondWithResult(_0x1bdf14,null))['catch'](function(_0x33dec7){var _0x58d319=_0x5e4880[_0x843c('0x1d')][_0x843c('0xae')]?0x1f4:_0x33dec7[_0x843c('0xaf')]||0x1f4;logger[_0x843c('0xb0')](_0x33dec7[_0x843c('0x13')]);delete _0x33dec7[_0x843c('0x14')];if(_0x58d319===0x191){_0x58d319=0x190;}_0x1bdf14[_0x843c('0x6')](_0x58d319)[_0x843c('0xb1')](_0x5e4880['query'][_0x843c('0xae')]?{'message':_0x843c('0xb2'),'statusCode':_0x33dec7[_0x843c('0xaf')]}:_0x33dec7);});};function getSelectList(_0x1c3240,_0x58fe34,_0x4fcdbc,_0x378837,_0xa6f375,_0x5b6b15){var _0x34584d={'method':'GET','uri':_0x1c3240+_0x843c('0xb3')+_0x378837+_0x843c('0xb4')+_0xa6f375+_0x843c('0xb5')+_0x843c('0xb6'),'headers':{'Authorization':_0x843c('0xb7')+_0x5b6b15,'If-None-Match':null,'OData-Version':_0x843c('0x99')},'json':!![]};return rp(_0x34584d)['then'](function(_0x3eb8c){var _0x5a8a6a=[];var _0x5f5d14=_0x3eb8c[_0x843c('0xb8')]['Options'];_0x5f5d14[_0x843c('0xa0')](function(_0x2201a6){_0x5a8a6a[_0x843c('0xa3')]({'name':_0x2201a6[_0x843c('0xb9')][_0x843c('0xba')][_0x843c('0xb9')],'value':String(_0x2201a6['Value'])});});var _0x432f0a={'id':_0x58fe34+'_'+_0x3eb8c['LogicalName'],'name':_0x3eb8c[_0x843c('0xbb')][_0x843c('0xba')]['Label'],'custom':![],'options':_0x5a8a6a};_0x4fcdbc[_0x843c('0xa3')](_0x432f0a);return _0x4fcdbc;});}function getBooleanList(_0x29c121,_0x2318af,_0x470eec,_0x57b2ee,_0x1bfdb9,_0x598435){var _0x5de4da={'method':_0x843c('0x98'),'uri':_0x29c121+_0x843c('0xb3')+_0x57b2ee+_0x843c('0xb4')+_0x1bfdb9+_0x843c('0xbc'),'headers':{'Authorization':'Bearer\x20'+_0x598435,'If-None-Match':null,'OData-Version':_0x843c('0x99')},'json':!![]};return rp(_0x5de4da)[_0x843c('0xf')](function(_0x20e6e1){var _0x16b5aa=[];_0x16b5aa[_0x843c('0xa3')]({'name':_0x20e6e1['OptionSet'][_0x843c('0xbd')]['Label'][_0x843c('0xba')]['Label'],'value':_0x843c('0xbe')},{'name':_0x20e6e1[_0x843c('0xb8')][_0x843c('0xbf')]['Label']['UserLocalizedLabel'][_0x843c('0xb9')],'value':_0x843c('0xc0')});var _0x575c46={'id':_0x2318af+'_'+_0x20e6e1[_0x843c('0x9f')],'name':_0x20e6e1[_0x843c('0xbb')][_0x843c('0xba')][_0x843c('0xb9')],'custom':![],'options':_0x16b5aa};_0x470eec[_0x843c('0xa3')](_0x575c46);return _0x470eec;});}function getInputList(_0x4571de,_0x5aed2f,_0x5b4184,_0xf35a01,_0x3d48f8,_0x3afa85,_0x32a393){var _0x22b9b4={'method':_0x843c('0x98'),'uri':_0x4571de+_0x843c('0xb3')+_0x3d48f8+_0x843c('0xb4')+_0x3afa85+_0x843c('0xc1')+_0x5b4184+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x843c('0xb7')+_0x32a393,'If-None-Match':null,'OData-Version':_0x843c('0x99')},'json':!![]};return rp(_0x22b9b4)[_0x843c('0xf')](function(_0x6e937c){var _0x2d8ac3={'id':_0x5aed2f+'_'+_0x6e937c[_0x843c('0x9f')],'name':_0x6e937c[_0x843c('0xbb')][_0x843c('0xba')]?_0x6e937c['DisplayName'][_0x843c('0xba')]['Label']:_0x6e937c[_0x843c('0x9f')],'custom':![],'options':[]};_0xf35a01[_0x843c('0xa3')](_0x2d8ac3);return _0xf35a01;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index cba017c..201aa2d 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x2f8842,_0x32da96){var _0xc3e700=function(_0x1721bc){while(--_0x1721bc){_0x2f8842['push'](_0x2f8842['shift']());}};_0xc3e700(++_0x32da96);}(_0xe706,0xa3));var _0x6e70=function(_0x2ace95,_0x186b37){_0x2ace95=_0x2ace95-0x0;var _0x35ecfa=_0xe706[_0x2ace95];return _0x35ecfa;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4075f3,_0x338036){var _0x38f42a=function(_0x396d7f){while(--_0x396d7f){_0x4075f3['push'](_0x4075f3['shift']());}};_0x38f42a(++_0x338036);}(_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('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index d06eadf..859b02a 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 _0x70ef=['model','then','info','ShowDynamics365Account','Dynamics365Account','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetDynamics365Account','findAll','options','raw','where','attributes','map','include'];(function(_0x73c1d7,_0x1a25be){var _0x484817=function(_0x2987f0){while(--_0x2987f0){_0x73c1d7['push'](_0x73c1d7['shift']());}};_0x484817(++_0x1a25be);}(_0x70ef,0x105));var _0xf70e=function(_0x1c7d76,_0x60f2cc){_0x1c7d76=_0x1c7d76-0x0;var _0x34cb61=_0x70ef[_0x1c7d76];return _0x34cb61;};'use strict';var _=require(_0xf70e('0x0'));var util=require(_0xf70e('0x1'));var moment=require(_0xf70e('0x2'));var BPromise=require(_0xf70e('0x3'));var rs=require(_0xf70e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf70e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf70e('0x6'));var jayson=require(_0xf70e('0x7'));var client=jayson[_0xf70e('0x8')][_0xf70e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21464a,_0x4ecaa4,_0x1adae8){return new BPromise(function(_0x330b82,_0x24b3aa){return client['request'](_0x21464a,_0x1adae8)['then'](function(_0x1cd82a){logger['info'](_0xf70e('0xa'),_0x4ecaa4,'request\x20sent');logger[_0xf70e('0xb')](_0xf70e('0xc'),_0x4ecaa4,'request\x20sent',JSON[_0xf70e('0xd')](_0x1cd82a));if(_0x1cd82a[_0xf70e('0xe')]){if(_0x1cd82a[_0xf70e('0xe')]['code']===0x1f4){logger[_0xf70e('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x4ecaa4,_0x1cd82a['error'][_0xf70e('0xf')]);return _0x24b3aa(_0x1cd82a[_0xf70e('0xe')]['message']);}logger[_0xf70e('0xe')](_0xf70e('0xa'),_0x4ecaa4,_0x1cd82a[_0xf70e('0xe')][_0xf70e('0xf')]);return _0x330b82(_0x1cd82a[_0xf70e('0xe')][_0xf70e('0xf')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x4ecaa4,_0xf70e('0x10'));_0x330b82(_0x1cd82a[_0xf70e('0x11')][_0xf70e('0xf')]);}})[_0xf70e('0x12')](function(_0x489270){logger[_0xf70e('0xe')](_0xf70e('0xa'),_0x4ecaa4,_0x489270);_0x24b3aa(_0x489270);});});}exports[_0xf70e('0x13')]=function(_0x53b60e){var _0x5757e4=this;return new Promise(function(_0x1bf14f,_0x18b562){return db['Dynamics365Account'][_0xf70e('0x14')]({'raw':_0x53b60e[_0xf70e('0x15')]?_0x53b60e['options'][_0xf70e('0x16')]===undefined?!![]:![]:!![],'where':_0x53b60e[_0xf70e('0x15')]?_0x53b60e[_0xf70e('0x15')][_0xf70e('0x17')]||null:null,'attributes':_0x53b60e[_0xf70e('0x15')]?_0x53b60e['options'][_0xf70e('0x18')]||null:null,'limit':_0x53b60e[_0xf70e('0x15')]?_0x53b60e['options']['limit']||null:null,'include':_0x53b60e[_0xf70e('0x15')]?_0x53b60e[_0xf70e('0x15')]['include']?_[_0xf70e('0x19')](_0x53b60e[_0xf70e('0x15')][_0xf70e('0x1a')],function(_0x510c38){return{'model':db[_0x510c38['model']],'as':_0x510c38['as'],'attributes':_0x510c38[_0xf70e('0x18')],'include':_0x510c38['include']?_[_0xf70e('0x19')](_0x510c38[_0xf70e('0x1a')],function(_0xe50afd){return{'model':db[_0xe50afd[_0xf70e('0x1b')]],'as':_0xe50afd['as'],'attributes':_0xe50afd['attributes'],'include':_0xe50afd[_0xf70e('0x1a')]?_[_0xf70e('0x19')](_0xe50afd[_0xf70e('0x1a')],function(_0x5adceb){return{'model':db[_0x5adceb['model']],'as':_0x5adceb['as'],'attributes':_0x5adceb[_0xf70e('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf70e('0x1c')](function(_0xc8c0d5){logger[_0xf70e('0x1d')](_0xf70e('0x13'),_0x53b60e);logger[_0xf70e('0xb')]('GetDynamics365Account',_0x53b60e,JSON[_0xf70e('0xd')](_0xc8c0d5));_0x1bf14f(_0xc8c0d5);})[_0xf70e('0x12')](function(_0x285049){logger[_0xf70e('0xe')](_0xf70e('0x13'),_0x285049[_0xf70e('0xf')],_0x53b60e);_0x18b562(_0x5757e4[_0xf70e('0xe')](0x1f4,_0x285049['message']));});});};exports[_0xf70e('0x1e')]=function(_0xfed764){var _0x38ee58=this;return new Promise(function(_0x3c1662,_0x4b5042){return db[_0xf70e('0x1f')]['find']({'raw':_0xfed764[_0xf70e('0x15')]?_0xfed764[_0xf70e('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0xfed764[_0xf70e('0x15')]?_0xfed764[_0xf70e('0x15')][_0xf70e('0x17')]||null:null,'attributes':_0xfed764[_0xf70e('0x15')]?_0xfed764[_0xf70e('0x15')][_0xf70e('0x18')]||null:null,'include':_0xfed764[_0xf70e('0x15')]?_0xfed764[_0xf70e('0x15')][_0xf70e('0x1a')]?_['map'](_0xfed764[_0xf70e('0x15')][_0xf70e('0x1a')],function(_0x245b45){return{'model':db[_0x245b45[_0xf70e('0x1b')]],'as':_0x245b45['as'],'attributes':_0x245b45[_0xf70e('0x18')],'include':_0x245b45[_0xf70e('0x1a')]?_['map'](_0x245b45[_0xf70e('0x1a')],function(_0x6fc133){return{'model':db[_0x6fc133[_0xf70e('0x1b')]],'as':_0x6fc133['as'],'attributes':_0x6fc133['attributes'],'include':_0x6fc133[_0xf70e('0x1a')]?_[_0xf70e('0x19')](_0x6fc133['include'],function(_0x127f4f){return{'model':db[_0x127f4f[_0xf70e('0x1b')]],'as':_0x127f4f['as'],'attributes':_0x127f4f[_0xf70e('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25458b){logger[_0xf70e('0x1d')](_0xf70e('0x1e'),_0xfed764);logger[_0xf70e('0xb')](_0xf70e('0x1e'),_0xfed764,JSON['stringify'](_0x25458b));_0x3c1662(_0x25458b);})[_0xf70e('0x12')](function(_0x585786){logger[_0xf70e('0xe')](_0xf70e('0x1e'),_0x585786[_0xf70e('0xf')],_0xfed764);_0x4b5042(_0x38ee58[_0xf70e('0xe')](0x1f4,_0x585786['message']));});});}; \ No newline at end of file +var _0x6966=['error','code','message','result','catch','Dynamics365Account','options','raw','where','attributes','include','model','map','then','info','GetDynamics365Account','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x408934,_0x3048a){var _0x458ddf=function(_0xb75039){while(--_0xb75039){_0x408934['push'](_0x408934['shift']());}};_0x458ddf(++_0x3048a);}(_0x6966,0x7a));var _0x6696=function(_0x30f272,_0x401f2d){_0x30f272=_0x30f272-0x0;var _0x1969ce=_0x6966[_0x30f272];return _0x1969ce;};'use strict';var _=require(_0x6696('0x0'));var util=require(_0x6696('0x1'));var moment=require(_0x6696('0x2'));var BPromise=require(_0x6696('0x3'));var rs=require(_0x6696('0x4'));var fs=require('fs');var Redis=require(_0x6696('0x5'));var db=require(_0x6696('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6696('0x7'))(_0x6696('0x8'));var config=require(_0x6696('0x9'));var jayson=require(_0x6696('0xa'));var client=jayson['client'][_0x6696('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35b4d7,_0xff723d,_0x3e655f){return new BPromise(function(_0x14f206,_0x362bc2){return client[_0x6696('0xc')](_0x35b4d7,_0x3e655f)['then'](function(_0x5375ea){logger['info'](_0x6696('0xd'),_0xff723d,_0x6696('0xe'));logger[_0x6696('0xf')](_0x6696('0x10'),_0xff723d,_0x6696('0xe'),JSON[_0x6696('0x11')](_0x5375ea));if(_0x5375ea['error']){if(_0x5375ea[_0x6696('0x12')][_0x6696('0x13')]===0x1f4){logger[_0x6696('0x12')](_0x6696('0xd'),_0xff723d,_0x5375ea[_0x6696('0x12')][_0x6696('0x14')]);return _0x362bc2(_0x5375ea[_0x6696('0x12')][_0x6696('0x14')]);}logger[_0x6696('0x12')](_0x6696('0xd'),_0xff723d,_0x5375ea[_0x6696('0x12')][_0x6696('0x14')]);return _0x14f206(_0x5375ea[_0x6696('0x12')]['message']);}else{logger['info'](_0x6696('0xd'),_0xff723d,_0x6696('0xe'));_0x14f206(_0x5375ea[_0x6696('0x15')][_0x6696('0x14')]);}})[_0x6696('0x16')](function(_0x3c1a98){logger[_0x6696('0x12')](_0x6696('0xd'),_0xff723d,_0x3c1a98);_0x362bc2(_0x3c1a98);});});}exports['GetDynamics365Account']=function(_0x46df24){var _0x19c020=this;return new Promise(function(_0x43fd2f,_0x3db89a){return db[_0x6696('0x17')]['findAll']({'raw':_0x46df24[_0x6696('0x18')]?_0x46df24[_0x6696('0x18')][_0x6696('0x19')]===undefined?!![]:![]:!![],'where':_0x46df24[_0x6696('0x18')]?_0x46df24[_0x6696('0x18')][_0x6696('0x1a')]||null:null,'attributes':_0x46df24[_0x6696('0x18')]?_0x46df24[_0x6696('0x18')][_0x6696('0x1b')]||null:null,'limit':_0x46df24[_0x6696('0x18')]?_0x46df24['options']['limit']||null:null,'include':_0x46df24['options']?_0x46df24['options'][_0x6696('0x1c')]?_['map'](_0x46df24[_0x6696('0x18')][_0x6696('0x1c')],function(_0x3c948c){return{'model':db[_0x3c948c[_0x6696('0x1d')]],'as':_0x3c948c['as'],'attributes':_0x3c948c['attributes'],'include':_0x3c948c['include']?_[_0x6696('0x1e')](_0x3c948c[_0x6696('0x1c')],function(_0x32c9fa){return{'model':db[_0x32c9fa[_0x6696('0x1d')]],'as':_0x32c9fa['as'],'attributes':_0x32c9fa[_0x6696('0x1b')],'include':_0x32c9fa[_0x6696('0x1c')]?_['map'](_0x32c9fa[_0x6696('0x1c')],function(_0x1246f1){return{'model':db[_0x1246f1[_0x6696('0x1d')]],'as':_0x1246f1['as'],'attributes':_0x1246f1['attributes']};}):[]};}):[]};}):[]:[]})[_0x6696('0x1f')](function(_0x3be8a0){logger[_0x6696('0x20')]('GetDynamics365Account',_0x46df24);logger[_0x6696('0xf')](_0x6696('0x21'),_0x46df24,JSON['stringify'](_0x3be8a0));_0x43fd2f(_0x3be8a0);})[_0x6696('0x16')](function(_0x9c145){logger[_0x6696('0x12')](_0x6696('0x21'),_0x9c145[_0x6696('0x14')],_0x46df24);_0x3db89a(_0x19c020[_0x6696('0x12')](0x1f4,_0x9c145[_0x6696('0x14')]));});});};exports[_0x6696('0x22')]=function(_0xa5de09){var _0xea1a36=this;return new Promise(function(_0x4fcf14,_0x5f3294){return db[_0x6696('0x17')]['find']({'raw':_0xa5de09[_0x6696('0x18')]?_0xa5de09[_0x6696('0x18')][_0x6696('0x19')]===undefined?!![]:![]:!![],'where':_0xa5de09['options']?_0xa5de09[_0x6696('0x18')][_0x6696('0x1a')]||null:null,'attributes':_0xa5de09[_0x6696('0x18')]?_0xa5de09[_0x6696('0x18')][_0x6696('0x1b')]||null:null,'include':_0xa5de09['options']?_0xa5de09['options'][_0x6696('0x1c')]?_[_0x6696('0x1e')](_0xa5de09[_0x6696('0x18')][_0x6696('0x1c')],function(_0x732cd3){return{'model':db[_0x732cd3['model']],'as':_0x732cd3['as'],'attributes':_0x732cd3[_0x6696('0x1b')],'include':_0x732cd3['include']?_['map'](_0x732cd3[_0x6696('0x1c')],function(_0x5d49e1){return{'model':db[_0x5d49e1[_0x6696('0x1d')]],'as':_0x5d49e1['as'],'attributes':_0x5d49e1[_0x6696('0x1b')],'include':_0x5d49e1['include']?_[_0x6696('0x1e')](_0x5d49e1[_0x6696('0x1c')],function(_0x591daa){return{'model':db[_0x591daa[_0x6696('0x1d')]],'as':_0x591daa['as'],'attributes':_0x591daa['attributes']};}):[]};}):[]};}):[]:[]})[_0x6696('0x1f')](function(_0xcf2e4a){logger['info'](_0x6696('0x22'),_0xa5de09);logger[_0x6696('0xf')](_0x6696('0x22'),_0xa5de09,JSON[_0x6696('0x11')](_0xcf2e4a));_0x4fcf14(_0xcf2e4a);})[_0x6696('0x16')](function(_0x17c909){logger[_0x6696('0x12')](_0x6696('0x22'),_0x17c909[_0x6696('0x14')],_0xa5de09);_0x5f3294(_0xea1a36[_0x6696('0x12')](0x1f4,_0x17c909[_0x6696('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 00f2b9b..525c0d1 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 _0xb03e=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0xe84bf8,_0x4cb234){var _0x22e9c3=function(_0x15563f){while(--_0x15563f){_0xe84bf8['push'](_0xe84bf8['shift']());}};_0x22e9c3(++_0x4cb234);}(_0xb03e,0x1eb));var _0xeb03=function(_0x18887d,_0x377848){_0x18887d=_0x18887d-0x0;var _0x2acc06=_0xb03e[_0x18887d];return _0x2acc06;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xa')](_0xeb03('0xe'),auth['isAuthenticated'](),controller[_0xeb03('0xf')]);router[_0xeb03('0xa')](_0xeb03('0x10'),auth['isAuthenticated'](),controller[_0xeb03('0x11')]);router['get'](_0xeb03('0x12'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x13')]);router[_0xeb03('0x14')]('/',auth[_0xeb03('0xb')](),controller[_0xeb03('0x15')]);router[_0xeb03('0x16')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x17')]);router[_0xeb03('0x18')](_0xeb03('0xc'),auth['isAuthenticated'](),controller[_0xeb03('0x19')]);module[_0xeb03('0x1a')]=router; \ No newline at end of file +var _0xe0bf=['connect-timeout','express','Router','fs-extra','./intDynamics365Configuration.controller','isAuthenticated','index','/:id','/:id/fields','getFields','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3ad2f8,_0x20efa8){var _0x1fe449=function(_0x9250b6){while(--_0x9250b6){_0x3ad2f8['push'](_0x3ad2f8['shift']());}};_0x1fe449(++_0x20efa8);}(_0xe0bf,0x75));var _0xfe0b=function(_0x28a659,_0x17834b){_0x28a659=_0x28a659-0x0;var _0x51627a=_0xe0bf[_0x28a659];return _0x51627a;};'use strict';var multer=require(_0xfe0b('0x0'));var util=require(_0xfe0b('0x1'));var path=require(_0xfe0b('0x2'));var timeout=require(_0xfe0b('0x3'));var express=require(_0xfe0b('0x4'));var router=express[_0xfe0b('0x5')]();var fs_extra=require(_0xfe0b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfe0b('0x7'));router['get']('/',auth[_0xfe0b('0x8')](),controller[_0xfe0b('0x9')]);router['get'](_0xfe0b('0xa'),auth[_0xfe0b('0x8')](),controller['show']);router['get'](_0xfe0b('0xb'),auth['isAuthenticated'](),controller[_0xfe0b('0xc')]);router[_0xfe0b('0xd')](_0xfe0b('0xe'),auth[_0xfe0b('0x8')](),controller[_0xfe0b('0xf')]);router[_0xfe0b('0xd')](_0xfe0b('0x10'),auth[_0xfe0b('0x8')](),controller[_0xfe0b('0x11')]);router['post']('/',auth[_0xfe0b('0x8')](),controller[_0xfe0b('0x12')]);router[_0xfe0b('0x13')](_0xfe0b('0xa'),auth[_0xfe0b('0x8')](),controller[_0xfe0b('0x14')]);router[_0xfe0b('0x15')](_0xfe0b('0xa'),auth[_0xfe0b('0x8')](),controller[_0xfe0b('0x16')]);module[_0xfe0b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index bb0b40c..7c9fc0f 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 _0x9bfe=['STRING','ENUM','phonecall','incident','contact','nothing','BOOLEAN','sequelize','exports'];(function(_0x56cf14,_0x3a8aac){var _0x19e482=function(_0x2c5b0a){while(--_0x2c5b0a){_0x56cf14['push'](_0x56cf14['shift']());}};_0x19e482(++_0x3a8aac);}(_0x9bfe,0x166));var _0xe9bf=function(_0x2e8f2c,_0x1f36ed){_0x2e8f2c=_0x2e8f2c-0x0;var _0xa49a1a=_0x9bfe[_0x2e8f2c];return _0xa49a1a;};'use strict';var Sequelize=require(_0xe9bf('0x0'));module[_0xe9bf('0x1')]={'name':{'type':Sequelize[_0xe9bf('0x2')]},'description':{'type':Sequelize[_0xe9bf('0x2')]},'ticketType':{'type':Sequelize[_0xe9bf('0x3')]('incident',_0xe9bf('0x4')),'defaultValue':_0xe9bf('0x5')},'moduleCreate':{'type':Sequelize[_0xe9bf('0x3')](_0xe9bf('0x6'),_0xe9bf('0x7')),'defaultValue':_0xe9bf('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xe9bf('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xe9bf('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb77f=['exports','STRING','ENUM','incident','BOOLEAN','sequelize'];(function(_0x2a3cdb,_0x1b8c18){var _0x143a62=function(_0x54fb2a){while(--_0x54fb2a){_0x2a3cdb['push'](_0x2a3cdb['shift']());}};_0x143a62(++_0x1b8c18);}(_0xb77f,0xf5));var _0xfb77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb77f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xfb77('0x0'));module[_0xfb77('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfb77('0x2')]},'ticketType':{'type':Sequelize[_0xfb77('0x3')]('incident','phonecall'),'defaultValue':_0xfb77('0x4')},'moduleCreate':{'type':Sequelize[_0xfb77('0x3')]('contact','nothing'),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xfb77('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 2740714..70395a4 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 _0xf450=['sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','keys','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','filter','options','Dynamics365Configuration','count','include','findAll','catch','params','includeAll','create','body','find','getFields','sort','getSubjects','findOne','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','Content-Range','apply','reject','save','update','then','destroy'];(function(_0xfd5f37,_0x24a79c){var _0x11bd01=function(_0x4ae9bd){while(--_0x4ae9bd){_0xfd5f37['push'](_0xfd5f37['shift']());}};_0x11bd01(++_0x24a79c);}(_0xf450,0x11a));var _0x0f45=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf450[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x0f45('0x0'));var rimraf=require(_0x0f45('0x1'));var zipdir=require(_0x0f45('0x2'));var jsonpatch=require(_0x0f45('0x3'));var rp=require(_0x0f45('0x4'));var moment=require(_0x0f45('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0f45('0x6'));var util=require(_0x0f45('0x7'));var path=require('path');var sox=require(_0x0f45('0x8'));var csv=require(_0x0f45('0x9'));var ejs=require(_0x0f45('0xa'));var fs=require('fs');var fs_extra=require(_0x0f45('0xb'));var _=require(_0x0f45('0xc'));var squel=require('squel');var crypto=require(_0x0f45('0xd'));var jsforce=require(_0x0f45('0xe'));var deskjs=require(_0x0f45('0xf'));var toCsv=require(_0x0f45('0x9'));var querystring=require(_0x0f45('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0f45('0x11'));var qs=require(_0x0f45('0x12'));var as=require(_0x0f45('0x13'));var hardwareService=require(_0x0f45('0x14'));var logger=require(_0x0f45('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x0f45('0x16'));var licenseUtil=require(_0x0f45('0x17'));var db=require(_0x0f45('0x18'))['db'];function respondWithStatusCode(_0x4f3754,_0x4030f6){_0x4030f6=_0x4030f6||0xcc;return function(_0x96b850){if(_0x96b850){return _0x4f3754['sendStatus'](_0x4030f6);}return _0x4f3754[_0x0f45('0x19')](_0x4030f6)[_0x0f45('0x1a')]();};}function respondWithResult(_0x4fc2dc,_0x3997e9){_0x3997e9=_0x3997e9||0xc8;return function(_0x3a45bf){if(_0x3a45bf){return _0x4fc2dc[_0x0f45('0x19')](_0x3997e9)[_0x0f45('0x1b')](_0x3a45bf);}};}function respondWithFilteredResult(_0x27e0fa,_0x5d4fe5){return function(_0x50d227){if(_0x50d227){var _0x379e06=typeof _0x5d4fe5['offset']===_0x0f45('0x1c')&&typeof _0x5d4fe5[_0x0f45('0x1d')]===_0x0f45('0x1c');var _0x3d944c=_0x50d227['count'];var _0x473a02=_0x379e06?0x0:_0x5d4fe5[_0x0f45('0x1e')];var _0x1d5c14=_0x379e06?_0x50d227['count']:_0x5d4fe5[_0x0f45('0x1e')]+_0x5d4fe5[_0x0f45('0x1d')];var _0x2d128c;if(_0x1d5c14>=_0x3d944c){_0x1d5c14=_0x3d944c;_0x2d128c=0xc8;}else{_0x2d128c=0xce;}_0x27e0fa['status'](_0x2d128c);return _0x27e0fa['set'](_0x0f45('0x1f'),_0x473a02+'-'+_0x1d5c14+'/'+_0x3d944c)[_0x0f45('0x1b')](_0x50d227);}return null;};}function patchUpdates(_0x4975d3){return function(_0x394e07){try{jsonpatch[_0x0f45('0x20')](_0x394e07,_0x4975d3,!![]);}catch(_0x4485d0){return BPromise[_0x0f45('0x21')](_0x4485d0);}return _0x394e07[_0x0f45('0x22')]();};}function saveUpdates(_0x954da9,_0x1ce5eb){return function(_0x3e3d34){if(_0x3e3d34){return _0x3e3d34[_0x0f45('0x23')](_0x954da9)[_0x0f45('0x24')](function(_0x544dc8){return _0x544dc8;});}return null;};}function removeEntity(_0x45da83,_0x325500){return function(_0x329606){if(_0x329606){return _0x329606[_0x0f45('0x25')]()[_0x0f45('0x24')](function(){_0x45da83['status'](0xcc)[_0x0f45('0x1a')]();});}};}function handleEntityNotFound(_0x1a6797,_0x3bdb35){return function(_0x3c8f53){if(!_0x3c8f53){_0x1a6797[_0x0f45('0x26')](0x194);}return _0x3c8f53;};}function handleError(_0x4b8531,_0x153f6b){_0x153f6b=_0x153f6b||0x1f4;return function(_0x162c49){logger[_0x0f45('0x27')](_0x162c49['stack']);if(_0x162c49[_0x0f45('0x28')]){delete _0x162c49[_0x0f45('0x28')];}_0x4b8531[_0x0f45('0x19')](_0x153f6b)[_0x0f45('0x29')](_0x162c49);};}exports[_0x0f45('0x2a')]=function(_0x524954,_0x7c2146){var _0x46f631={},_0x5f101d={},_0x587ea7={'count':0x0,'rows':[]};var _0x4ae625=_[_0x0f45('0x2b')](db['Dynamics365Configuration'][_0x0f45('0x2c')],function(_0x10bfa4){return{'name':_0x10bfa4[_0x0f45('0x2d')],'type':_0x10bfa4[_0x0f45('0x2e')]['key']};});_0x5f101d['model']=_[_0x0f45('0x2b')](_0x4ae625,_0x0f45('0x28'));_0x5f101d['query']=_[_0x0f45('0x2f')](_0x524954[_0x0f45('0x30')]);_0x5f101d[_0x0f45('0x31')]=_[_0x0f45('0x32')](_0x5f101d['model'],_0x5f101d[_0x0f45('0x30')]);_0x46f631['attributes']=_[_0x0f45('0x32')](_0x5f101d['model'],qs[_0x0f45('0x33')](_0x524954['query'][_0x0f45('0x33')]));_0x46f631[_0x0f45('0x34')]=_0x46f631[_0x0f45('0x34')][_0x0f45('0x35')]?_0x46f631[_0x0f45('0x34')]:_0x5f101d[_0x0f45('0x36')];if(!_0x524954['query'][_0x0f45('0x37')](_0x0f45('0x38'))){_0x46f631['limit']=qs[_0x0f45('0x1d')](_0x524954[_0x0f45('0x30')][_0x0f45('0x1d')]);_0x46f631[_0x0f45('0x1e')]=qs[_0x0f45('0x1e')](_0x524954[_0x0f45('0x30')][_0x0f45('0x1e')]);}_0x46f631[_0x0f45('0x39')]=qs['sort'](_0x524954[_0x0f45('0x30')]['sort']);_0x46f631['where']=qs[_0x0f45('0x31')](_[_0x0f45('0x3a')](_0x524954[_0x0f45('0x30')],_0x5f101d[_0x0f45('0x31')]),_0x4ae625);if(_0x524954[_0x0f45('0x30')]['filter']){_0x46f631[_0x0f45('0x3b')]=_[_0x0f45('0x3c')](_0x46f631['where'],{'$or':_[_0x0f45('0x2b')](_0x4ae625,function(_0x51c825){if(_0x51c825[_0x0f45('0x2e')]!==_0x0f45('0x3d')){var _0x58eb3e={};_0x58eb3e[_0x51c825['name']]={'$like':'%'+_0x524954['query'][_0x0f45('0x3e')]+'%'};return _0x58eb3e;}})});}_0x46f631=_[_0x0f45('0x3c')]({},_0x46f631,_0x524954[_0x0f45('0x3f')]);var _0x23defd={'where':_0x46f631['where']};return db[_0x0f45('0x40')][_0x0f45('0x41')](_0x23defd)['then'](function(_0x57f83a){_0x587ea7[_0x0f45('0x41')]=_0x57f83a;if(_0x524954['query']['includeAll']){_0x46f631[_0x0f45('0x42')]=[{'all':!![]}];}return db[_0x0f45('0x40')][_0x0f45('0x43')](_0x46f631);})[_0x0f45('0x24')](function(_0x33dedd){_0x587ea7['rows']=_0x33dedd;return _0x587ea7;})[_0x0f45('0x24')](respondWithFilteredResult(_0x7c2146,_0x46f631))[_0x0f45('0x44')](handleError(_0x7c2146,null));};exports['show']=function(_0x542334,_0x957d39){var _0x5ba865={'raw':![],'where':{'id':_0x542334[_0x0f45('0x45')]['id']}},_0x44354d={};_0x44354d[_0x0f45('0x36')]=_['keys'](db[_0x0f45('0x40')][_0x0f45('0x2c')]);_0x44354d[_0x0f45('0x30')]=_[_0x0f45('0x2f')](_0x542334[_0x0f45('0x30')]);_0x44354d[_0x0f45('0x31')]=_[_0x0f45('0x32')](_0x44354d[_0x0f45('0x36')],_0x44354d['query']);_0x5ba865[_0x0f45('0x34')]=_[_0x0f45('0x32')](_0x44354d[_0x0f45('0x36')],qs[_0x0f45('0x33')](_0x542334[_0x0f45('0x30')][_0x0f45('0x33')]));_0x5ba865[_0x0f45('0x34')]=_0x5ba865[_0x0f45('0x34')][_0x0f45('0x35')]?_0x5ba865['attributes']:_0x44354d[_0x0f45('0x36')];if(_0x542334['query'][_0x0f45('0x46')]){_0x5ba865['include']=[{'all':!![]}];}_0x5ba865=_[_0x0f45('0x3c')]({},_0x5ba865,_0x542334[_0x0f45('0x3f')]);return db[_0x0f45('0x40')]['find'](_0x5ba865)['then'](handleEntityNotFound(_0x957d39,null))[_0x0f45('0x24')](respondWithResult(_0x957d39,null))[_0x0f45('0x44')](handleError(_0x957d39,null));};exports[_0x0f45('0x47')]=function(_0x550ad6,_0x5106c8){return db[_0x0f45('0x40')][_0x0f45('0x47')](_0x550ad6[_0x0f45('0x48')],{})[_0x0f45('0x24')](respondWithResult(_0x5106c8,0xc9))[_0x0f45('0x44')](handleError(_0x5106c8,null));};exports[_0x0f45('0x23')]=function(_0x2145ed,_0x3b7e07){if(_0x2145ed['body']['id']){delete _0x2145ed[_0x0f45('0x48')]['id'];}return db[_0x0f45('0x40')][_0x0f45('0x49')]({'where':{'id':_0x2145ed['params']['id']}})[_0x0f45('0x24')](handleEntityNotFound(_0x3b7e07,null))['then'](saveUpdates(_0x2145ed[_0x0f45('0x48')],null))[_0x0f45('0x24')](respondWithResult(_0x3b7e07,null))[_0x0f45('0x44')](handleError(_0x3b7e07,null));};exports['destroy']=function(_0x5663d8,_0x109f46){return db[_0x0f45('0x40')]['find']({'where':{'id':_0x5663d8[_0x0f45('0x45')]['id']}})[_0x0f45('0x24')](handleEntityNotFound(_0x109f46,null))['then'](removeEntity(_0x109f46,null))[_0x0f45('0x44')](handleError(_0x109f46,null));};exports[_0x0f45('0x4a')]=function(_0x28a6cd,_0x30d3fa,_0x13d916){var _0x4c9cae={};var _0x48f30d={};var _0x3e77c7;var _0x3cad90;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x28a6cd[_0x0f45('0x45')]['id']}})[_0x0f45('0x24')](handleEntityNotFound(_0x30d3fa,null))[_0x0f45('0x24')](function(_0x394bbc){if(_0x394bbc){_0x3e77c7=_0x394bbc;_0x48f30d[_0x0f45('0x36')]=_[_0x0f45('0x2f')](db['Dynamics365Field']['rawAttributes']);_0x48f30d[_0x0f45('0x30')]=_['keys'](_0x28a6cd[_0x0f45('0x30')]);_0x48f30d[_0x0f45('0x31')]=_[_0x0f45('0x32')](_0x48f30d['model'],_0x48f30d[_0x0f45('0x30')]);_0x4c9cae['attributes']=_[_0x0f45('0x32')](_0x48f30d[_0x0f45('0x36')],qs[_0x0f45('0x33')](_0x28a6cd['query'][_0x0f45('0x33')]));_0x4c9cae[_0x0f45('0x34')]=_0x4c9cae[_0x0f45('0x34')][_0x0f45('0x35')]?_0x4c9cae[_0x0f45('0x34')]:_0x48f30d[_0x0f45('0x36')];_0x4c9cae[_0x0f45('0x39')]=qs[_0x0f45('0x4b')](_0x28a6cd[_0x0f45('0x30')][_0x0f45('0x4b')]);_0x4c9cae[_0x0f45('0x3b')]=qs['filters'](_[_0x0f45('0x3a')](_0x28a6cd[_0x0f45('0x30')],_0x48f30d[_0x0f45('0x31')]));if(_0x28a6cd[_0x0f45('0x30')][_0x0f45('0x3e')]){_0x4c9cae[_0x0f45('0x3b')]=_[_0x0f45('0x3c')](_0x4c9cae['where'],{'$or':_['map'](_0x4c9cae['attributes'],function(_0x582929){var _0x519274={};_0x519274[_0x582929]={'$like':'%'+_0x28a6cd[_0x0f45('0x30')][_0x0f45('0x3e')]+'%'};return _0x519274;})});}_0x4c9cae=_[_0x0f45('0x3c')]({},_0x4c9cae,_0x28a6cd[_0x0f45('0x3f')]);return _0x3e77c7[_0x0f45('0x4a')](_0x4c9cae);}})[_0x0f45('0x24')](function(_0x5d9fd2){if(_0x5d9fd2){_0x3cad90=_0x5d9fd2[_0x0f45('0x35')];if(!_0x28a6cd[_0x0f45('0x30')]['hasOwnProperty'](_0x0f45('0x38'))){_0x4c9cae[_0x0f45('0x1d')]=qs[_0x0f45('0x1d')](_0x28a6cd['query'][_0x0f45('0x1d')]);_0x4c9cae[_0x0f45('0x1e')]=qs[_0x0f45('0x1e')](_0x28a6cd[_0x0f45('0x30')]['offset']);}return _0x3e77c7[_0x0f45('0x4a')](_0x4c9cae);}})[_0x0f45('0x24')](function(_0x4bed35){if(_0x4bed35){return _0x4bed35?{'count':_0x3cad90,'rows':_0x4bed35}:null;}})[_0x0f45('0x24')](respondWithResult(_0x30d3fa,null))[_0x0f45('0x44')](handleError(_0x30d3fa,null));};exports[_0x0f45('0x4c')]=function(_0x2c4d12,_0x2d93c3,_0x321257){var _0x51e534={};var _0x1e0bf4={};var _0x195567;var _0x27b983;return db['Dynamics365Configuration'][_0x0f45('0x4d')]({'where':{'id':_0x2c4d12[_0x0f45('0x45')]['id']}})[_0x0f45('0x24')](handleEntityNotFound(_0x2d93c3,null))['then'](function(_0x30f0a1){if(_0x30f0a1){_0x195567=_0x30f0a1;_0x1e0bf4[_0x0f45('0x36')]=_[_0x0f45('0x2f')](db[_0x0f45('0x4e')][_0x0f45('0x2c')]);_0x1e0bf4[_0x0f45('0x30')]=_['keys'](_0x2c4d12[_0x0f45('0x30')]);_0x1e0bf4[_0x0f45('0x31')]=_[_0x0f45('0x32')](_0x1e0bf4[_0x0f45('0x36')],_0x1e0bf4['query']);_0x51e534[_0x0f45('0x34')]=_[_0x0f45('0x32')](_0x1e0bf4[_0x0f45('0x36')],qs[_0x0f45('0x33')](_0x2c4d12['query'][_0x0f45('0x33')]));_0x51e534[_0x0f45('0x34')]=_0x51e534[_0x0f45('0x34')][_0x0f45('0x35')]?_0x51e534['attributes']:_0x1e0bf4['model'];_0x51e534[_0x0f45('0x39')]=qs[_0x0f45('0x4b')](_0x2c4d12[_0x0f45('0x30')][_0x0f45('0x4b')]);_0x51e534[_0x0f45('0x3b')]=qs[_0x0f45('0x31')](_['pick'](_0x2c4d12[_0x0f45('0x30')],_0x1e0bf4[_0x0f45('0x31')]));if(_0x2c4d12[_0x0f45('0x30')][_0x0f45('0x3e')]){_0x51e534[_0x0f45('0x3b')]=_[_0x0f45('0x3c')](_0x51e534[_0x0f45('0x3b')],{'$or':_[_0x0f45('0x2b')](_0x51e534[_0x0f45('0x34')],function(_0x16818d){var _0x3c82be={};_0x3c82be[_0x16818d]={'$like':'%'+_0x2c4d12[_0x0f45('0x30')][_0x0f45('0x3e')]+'%'};return _0x3c82be;})});}_0x51e534=_[_0x0f45('0x3c')]({},_0x51e534,_0x2c4d12[_0x0f45('0x3f')]);return _0x195567[_0x0f45('0x4c')](_0x51e534);}})[_0x0f45('0x24')](function(_0x388271){if(_0x388271){_0x27b983=_0x388271['length'];if(!_0x2c4d12[_0x0f45('0x30')]['hasOwnProperty'](_0x0f45('0x38'))){_0x51e534[_0x0f45('0x1d')]=qs['limit'](_0x2c4d12[_0x0f45('0x30')][_0x0f45('0x1d')]);_0x51e534[_0x0f45('0x1e')]=qs['offset'](_0x2c4d12['query'][_0x0f45('0x1e')]);}return _0x195567[_0x0f45('0x4c')](_0x51e534);}})[_0x0f45('0x24')](function(_0x3fe0f0){if(_0x3fe0f0){return _0x3fe0f0?{'count':_0x27b983,'rows':_0x3fe0f0}:null;}})[_0x0f45('0x24')](respondWithResult(_0x2d93c3,null))[_0x0f45('0x44')](handleError(_0x2d93c3,null));};exports[_0x0f45('0x4f')]=function(_0x26aa7e,_0x1dd53e,_0x391fd6){var _0x22b701={};var _0x1e3c65={};var _0x111dcd;var _0x5c516a;return db[_0x0f45('0x40')][_0x0f45('0x4d')]({'where':{'id':_0x26aa7e[_0x0f45('0x45')]['id']}})[_0x0f45('0x24')](handleEntityNotFound(_0x1dd53e,null))[_0x0f45('0x24')](function(_0x1947d8){if(_0x1947d8){_0x111dcd=_0x1947d8;_0x1e3c65[_0x0f45('0x36')]=_[_0x0f45('0x2f')](db[_0x0f45('0x4e')][_0x0f45('0x2c')]);_0x1e3c65[_0x0f45('0x30')]=_[_0x0f45('0x2f')](_0x26aa7e['query']);_0x1e3c65[_0x0f45('0x31')]=_[_0x0f45('0x32')](_0x1e3c65[_0x0f45('0x36')],_0x1e3c65['query']);_0x22b701['attributes']=_[_0x0f45('0x32')](_0x1e3c65[_0x0f45('0x36')],qs['fields'](_0x26aa7e[_0x0f45('0x30')][_0x0f45('0x33')]));_0x22b701[_0x0f45('0x34')]=_0x22b701[_0x0f45('0x34')][_0x0f45('0x35')]?_0x22b701[_0x0f45('0x34')]:_0x1e3c65[_0x0f45('0x36')];_0x22b701[_0x0f45('0x39')]=qs[_0x0f45('0x4b')](_0x26aa7e['query']['sort']);_0x22b701[_0x0f45('0x3b')]=qs[_0x0f45('0x31')](_[_0x0f45('0x3a')](_0x26aa7e[_0x0f45('0x30')],_0x1e3c65[_0x0f45('0x31')]));if(_0x26aa7e[_0x0f45('0x30')][_0x0f45('0x3e')]){_0x22b701[_0x0f45('0x3b')]=_[_0x0f45('0x3c')](_0x22b701['where'],{'$or':_[_0x0f45('0x2b')](_0x22b701[_0x0f45('0x34')],function(_0x4dc91){var _0x3f6547={};_0x3f6547[_0x4dc91]={'$like':'%'+_0x26aa7e[_0x0f45('0x30')][_0x0f45('0x3e')]+'%'};return _0x3f6547;})});}_0x22b701=_[_0x0f45('0x3c')]({},_0x22b701,_0x26aa7e[_0x0f45('0x3f')]);return _0x111dcd[_0x0f45('0x4f')](_0x22b701);}})[_0x0f45('0x24')](function(_0x5d9b1d){if(_0x5d9b1d){_0x5c516a=_0x5d9b1d[_0x0f45('0x35')];if(!_0x26aa7e['query'][_0x0f45('0x37')](_0x0f45('0x38'))){_0x22b701[_0x0f45('0x1d')]=qs[_0x0f45('0x1d')](_0x26aa7e[_0x0f45('0x30')][_0x0f45('0x1d')]);_0x22b701[_0x0f45('0x1e')]=qs[_0x0f45('0x1e')](_0x26aa7e[_0x0f45('0x30')][_0x0f45('0x1e')]);}return _0x111dcd[_0x0f45('0x4f')](_0x22b701);}})[_0x0f45('0x24')](function(_0x42cbb0){if(_0x42cbb0){return _0x42cbb0?{'count':_0x5c516a,'rows':_0x42cbb0}:null;}})[_0x0f45('0x24')](respondWithResult(_0x1dd53e,null))[_0x0f45('0x44')](handleError(_0x1dd53e,null));}; \ No newline at end of file +var _0xfd9f=['Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','Dynamics365Configuration','includeAll','findAll','catch','include','find','create','body','params','destroy','getFields','length','nolimit','getSubjects','Dynamics365Field','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit'];(function(_0x49f67f,_0x4113a4){var _0x4779a1=function(_0x5064b0){while(--_0x5064b0){_0x49f67f['push'](_0x49f67f['shift']());}};_0x4779a1(++_0x4113a4);}(_0xfd9f,0x1b9));var _0xffd9=function(_0x1ed409,_0x150a02){_0x1ed409=_0x1ed409-0x0;var _0x561ae5=_0xfd9f[_0x1ed409];return _0x561ae5;};'use strict';var emlformat=require(_0xffd9('0x0'));var rimraf=require(_0xffd9('0x1'));var zipdir=require(_0xffd9('0x2'));var jsonpatch=require(_0xffd9('0x3'));var rp=require(_0xffd9('0x4'));var moment=require(_0xffd9('0x5'));var BPromise=require(_0xffd9('0x6'));var Mustache=require('mustache');var util=require(_0xffd9('0x7'));var path=require(_0xffd9('0x8'));var sox=require(_0xffd9('0x9'));var csv=require(_0xffd9('0xa'));var ejs=require(_0xffd9('0xb'));var fs=require('fs');var fs_extra=require(_0xffd9('0xc'));var _=require(_0xffd9('0xd'));var squel=require(_0xffd9('0xe'));var crypto=require(_0xffd9('0xf'));var jsforce=require(_0xffd9('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xffd9('0xa'));var querystring=require(_0xffd9('0x11'));var Papa=require('papaparse');var Redis=require(_0xffd9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xffd9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xffd9('0x14'));var logger=require(_0xffd9('0x15'))('api');var utils=require(_0xffd9('0x16'));var config=require(_0xffd9('0x17'));var licenseUtil=require(_0xffd9('0x18'));var db=require(_0xffd9('0x19'))['db'];function respondWithStatusCode(_0x166acd,_0x549ef2){_0x549ef2=_0x549ef2||0xcc;return function(_0x88b1fb){if(_0x88b1fb){return _0x166acd[_0xffd9('0x1a')](_0x549ef2);}return _0x166acd[_0xffd9('0x1b')](_0x549ef2)['end']();};}function respondWithResult(_0x2dcea0,_0x333852){_0x333852=_0x333852||0xc8;return function(_0x1d9ffd){if(_0x1d9ffd){return _0x2dcea0[_0xffd9('0x1b')](_0x333852)[_0xffd9('0x1c')](_0x1d9ffd);}};}function respondWithFilteredResult(_0x4c58a3,_0x5067a9){return function(_0x4112be){if(_0x4112be){var _0x54aa29=typeof _0x5067a9[_0xffd9('0x1d')]===_0xffd9('0x1e')&&typeof _0x5067a9['limit']==='undefined';var _0x58eddb=_0x4112be[_0xffd9('0x1f')];var _0x54eb6a=_0x54aa29?0x0:_0x5067a9[_0xffd9('0x1d')];var _0x42c979=_0x54aa29?_0x4112be[_0xffd9('0x1f')]:_0x5067a9[_0xffd9('0x1d')]+_0x5067a9[_0xffd9('0x20')];var _0x4f7d38;if(_0x42c979>=_0x58eddb){_0x42c979=_0x58eddb;_0x4f7d38=0xc8;}else{_0x4f7d38=0xce;}_0x4c58a3[_0xffd9('0x1b')](_0x4f7d38);return _0x4c58a3['set'](_0xffd9('0x21'),_0x54eb6a+'-'+_0x42c979+'/'+_0x58eddb)['json'](_0x4112be);}return null;};}function patchUpdates(_0x46461a){return function(_0x5bca68){try{jsonpatch[_0xffd9('0x22')](_0x5bca68,_0x46461a,!![]);}catch(_0x400e5f){return BPromise['reject'](_0x400e5f);}return _0x5bca68[_0xffd9('0x23')]();};}function saveUpdates(_0x126aed,_0x5dc322){return function(_0x5bb3d0){if(_0x5bb3d0){return _0x5bb3d0[_0xffd9('0x24')](_0x126aed)[_0xffd9('0x25')](function(_0x513aa8){return _0x513aa8;});}return null;};}function removeEntity(_0x8e1874,_0xcc647b){return function(_0x4d2df4){if(_0x4d2df4){return _0x4d2df4['destroy']()['then'](function(){_0x8e1874['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x375116,_0x497576){return function(_0x34fe47){if(!_0x34fe47){_0x375116['sendStatus'](0x194);}return _0x34fe47;};}function handleError(_0x553948,_0x3c1568){_0x3c1568=_0x3c1568||0x1f4;return function(_0x35ad2e){logger[_0xffd9('0x26')](_0x35ad2e[_0xffd9('0x27')]);if(_0x35ad2e['name']){delete _0x35ad2e[_0xffd9('0x28')];}_0x553948[_0xffd9('0x1b')](_0x3c1568)[_0xffd9('0x29')](_0x35ad2e);};}exports[_0xffd9('0x2a')]=function(_0x1cb964,_0x550bc0){var _0x2b8e83={},_0x255b00={},_0x2a57da={'count':0x0,'rows':[]};var _0x557f27=_[_0xffd9('0x2b')](db['Dynamics365Configuration'][_0xffd9('0x2c')],function(_0x48b9a3){return{'name':_0x48b9a3['fieldName'],'type':_0x48b9a3[_0xffd9('0x2d')]['key']};});_0x255b00[_0xffd9('0x2e')]=_[_0xffd9('0x2b')](_0x557f27,'name');_0x255b00['query']=_[_0xffd9('0x2f')](_0x1cb964[_0xffd9('0x30')]);_0x255b00[_0xffd9('0x31')]=_[_0xffd9('0x32')](_0x255b00['model'],_0x255b00['query']);_0x2b8e83[_0xffd9('0x33')]=_[_0xffd9('0x32')](_0x255b00[_0xffd9('0x2e')],qs[_0xffd9('0x34')](_0x1cb964['query'][_0xffd9('0x34')]));_0x2b8e83[_0xffd9('0x33')]=_0x2b8e83['attributes']['length']?_0x2b8e83[_0xffd9('0x33')]:_0x255b00[_0xffd9('0x2e')];if(!_0x1cb964[_0xffd9('0x30')][_0xffd9('0x35')]('nolimit')){_0x2b8e83[_0xffd9('0x20')]=qs[_0xffd9('0x20')](_0x1cb964[_0xffd9('0x30')][_0xffd9('0x20')]);_0x2b8e83[_0xffd9('0x1d')]=qs['offset'](_0x1cb964[_0xffd9('0x30')][_0xffd9('0x1d')]);}_0x2b8e83[_0xffd9('0x36')]=qs[_0xffd9('0x37')](_0x1cb964['query']['sort']);_0x2b8e83['where']=qs[_0xffd9('0x31')](_[_0xffd9('0x38')](_0x1cb964[_0xffd9('0x30')],_0x255b00[_0xffd9('0x31')]),_0x557f27);if(_0x1cb964[_0xffd9('0x30')][_0xffd9('0x39')]){_0x2b8e83[_0xffd9('0x3a')]=_[_0xffd9('0x3b')](_0x2b8e83[_0xffd9('0x3a')],{'$or':_[_0xffd9('0x2b')](_0x557f27,function(_0x42159d){if(_0x42159d[_0xffd9('0x2d')]!==_0xffd9('0x3c')){var _0x4c8f5c={};_0x4c8f5c[_0x42159d[_0xffd9('0x28')]]={'$like':'%'+_0x1cb964['query']['filter']+'%'};return _0x4c8f5c;}})});}_0x2b8e83=_[_0xffd9('0x3b')]({},_0x2b8e83,_0x1cb964[_0xffd9('0x3d')]);var _0x3837ab={'where':_0x2b8e83[_0xffd9('0x3a')]};return db[_0xffd9('0x3e')][_0xffd9('0x1f')](_0x3837ab)[_0xffd9('0x25')](function(_0x4dfd27){_0x2a57da[_0xffd9('0x1f')]=_0x4dfd27;if(_0x1cb964['query'][_0xffd9('0x3f')]){_0x2b8e83['include']=[{'all':!![]}];}return db[_0xffd9('0x3e')][_0xffd9('0x40')](_0x2b8e83);})['then'](function(_0x4a48bd){_0x2a57da['rows']=_0x4a48bd;return _0x2a57da;})['then'](respondWithFilteredResult(_0x550bc0,_0x2b8e83))[_0xffd9('0x41')](handleError(_0x550bc0,null));};exports['show']=function(_0xd24ad7,_0x3c320d){var _0x39ba2c={'raw':![],'where':{'id':_0xd24ad7['params']['id']}},_0xce0d9c={};_0xce0d9c[_0xffd9('0x2e')]=_[_0xffd9('0x2f')](db[_0xffd9('0x3e')]['rawAttributes']);_0xce0d9c[_0xffd9('0x30')]=_[_0xffd9('0x2f')](_0xd24ad7['query']);_0xce0d9c[_0xffd9('0x31')]=_[_0xffd9('0x32')](_0xce0d9c[_0xffd9('0x2e')],_0xce0d9c[_0xffd9('0x30')]);_0x39ba2c['attributes']=_[_0xffd9('0x32')](_0xce0d9c['model'],qs['fields'](_0xd24ad7['query']['fields']));_0x39ba2c[_0xffd9('0x33')]=_0x39ba2c['attributes']['length']?_0x39ba2c['attributes']:_0xce0d9c[_0xffd9('0x2e')];if(_0xd24ad7[_0xffd9('0x30')][_0xffd9('0x3f')]){_0x39ba2c[_0xffd9('0x42')]=[{'all':!![]}];}_0x39ba2c=_[_0xffd9('0x3b')]({},_0x39ba2c,_0xd24ad7[_0xffd9('0x3d')]);return db['Dynamics365Configuration'][_0xffd9('0x43')](_0x39ba2c)[_0xffd9('0x25')](handleEntityNotFound(_0x3c320d,null))[_0xffd9('0x25')](respondWithResult(_0x3c320d,null))[_0xffd9('0x41')](handleError(_0x3c320d,null));};exports[_0xffd9('0x44')]=function(_0xd17f75,_0x2ce92e){return db[_0xffd9('0x3e')][_0xffd9('0x44')](_0xd17f75[_0xffd9('0x45')],{})[_0xffd9('0x25')](respondWithResult(_0x2ce92e,0xc9))[_0xffd9('0x41')](handleError(_0x2ce92e,null));};exports[_0xffd9('0x24')]=function(_0x2d8b66,_0x23d067){if(_0x2d8b66['body']['id']){delete _0x2d8b66['body']['id'];}return db[_0xffd9('0x3e')][_0xffd9('0x43')]({'where':{'id':_0x2d8b66[_0xffd9('0x46')]['id']}})[_0xffd9('0x25')](handleEntityNotFound(_0x23d067,null))[_0xffd9('0x25')](saveUpdates(_0x2d8b66[_0xffd9('0x45')],null))['then'](respondWithResult(_0x23d067,null))[_0xffd9('0x41')](handleError(_0x23d067,null));};exports[_0xffd9('0x47')]=function(_0x23d796,_0x163723){return db[_0xffd9('0x3e')][_0xffd9('0x43')]({'where':{'id':_0x23d796[_0xffd9('0x46')]['id']}})[_0xffd9('0x25')](handleEntityNotFound(_0x163723,null))[_0xffd9('0x25')](removeEntity(_0x163723,null))['catch'](handleError(_0x163723,null));};exports[_0xffd9('0x48')]=function(_0x2e8185,_0x5ba6b2,_0x5c63a5){var _0x12e512={};var _0x11d3f9={};var _0x2edbcf;var _0x11ddb1;return db[_0xffd9('0x3e')]['findOne']({'where':{'id':_0x2e8185['params']['id']}})['then'](handleEntityNotFound(_0x5ba6b2,null))[_0xffd9('0x25')](function(_0x4b187a){if(_0x4b187a){_0x2edbcf=_0x4b187a;_0x11d3f9['model']=_[_0xffd9('0x2f')](db['Dynamics365Field'][_0xffd9('0x2c')]);_0x11d3f9[_0xffd9('0x30')]=_[_0xffd9('0x2f')](_0x2e8185[_0xffd9('0x30')]);_0x11d3f9[_0xffd9('0x31')]=_[_0xffd9('0x32')](_0x11d3f9[_0xffd9('0x2e')],_0x11d3f9['query']);_0x12e512[_0xffd9('0x33')]=_[_0xffd9('0x32')](_0x11d3f9[_0xffd9('0x2e')],qs[_0xffd9('0x34')](_0x2e8185[_0xffd9('0x30')]['fields']));_0x12e512['attributes']=_0x12e512[_0xffd9('0x33')][_0xffd9('0x49')]?_0x12e512[_0xffd9('0x33')]:_0x11d3f9[_0xffd9('0x2e')];_0x12e512[_0xffd9('0x36')]=qs[_0xffd9('0x37')](_0x2e8185[_0xffd9('0x30')][_0xffd9('0x37')]);_0x12e512[_0xffd9('0x3a')]=qs[_0xffd9('0x31')](_[_0xffd9('0x38')](_0x2e8185[_0xffd9('0x30')],_0x11d3f9['filters']));if(_0x2e8185['query'][_0xffd9('0x39')]){_0x12e512[_0xffd9('0x3a')]=_[_0xffd9('0x3b')](_0x12e512[_0xffd9('0x3a')],{'$or':_[_0xffd9('0x2b')](_0x12e512[_0xffd9('0x33')],function(_0x47d6ed){var _0x4588a5={};_0x4588a5[_0x47d6ed]={'$like':'%'+_0x2e8185['query'][_0xffd9('0x39')]+'%'};return _0x4588a5;})});}_0x12e512=_[_0xffd9('0x3b')]({},_0x12e512,_0x2e8185[_0xffd9('0x3d')]);return _0x2edbcf[_0xffd9('0x48')](_0x12e512);}})[_0xffd9('0x25')](function(_0x584f75){if(_0x584f75){_0x11ddb1=_0x584f75[_0xffd9('0x49')];if(!_0x2e8185['query'][_0xffd9('0x35')](_0xffd9('0x4a'))){_0x12e512[_0xffd9('0x20')]=qs[_0xffd9('0x20')](_0x2e8185[_0xffd9('0x30')][_0xffd9('0x20')]);_0x12e512['offset']=qs[_0xffd9('0x1d')](_0x2e8185[_0xffd9('0x30')]['offset']);}return _0x2edbcf[_0xffd9('0x48')](_0x12e512);}})[_0xffd9('0x25')](function(_0x52581f){if(_0x52581f){return _0x52581f?{'count':_0x11ddb1,'rows':_0x52581f}:null;}})[_0xffd9('0x25')](respondWithResult(_0x5ba6b2,null))[_0xffd9('0x41')](handleError(_0x5ba6b2,null));};exports[_0xffd9('0x4b')]=function(_0x11fd21,_0x2cca86,_0x25ff23){var _0x4275b4={};var _0x28db39={};var _0x441915;var _0xd8eeaf;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x11fd21['params']['id']}})[_0xffd9('0x25')](handleEntityNotFound(_0x2cca86,null))[_0xffd9('0x25')](function(_0x1d9c58){if(_0x1d9c58){_0x441915=_0x1d9c58;_0x28db39[_0xffd9('0x2e')]=_[_0xffd9('0x2f')](db[_0xffd9('0x4c')][_0xffd9('0x2c')]);_0x28db39['query']=_['keys'](_0x11fd21[_0xffd9('0x30')]);_0x28db39[_0xffd9('0x31')]=_[_0xffd9('0x32')](_0x28db39[_0xffd9('0x2e')],_0x28db39[_0xffd9('0x30')]);_0x4275b4[_0xffd9('0x33')]=_[_0xffd9('0x32')](_0x28db39[_0xffd9('0x2e')],qs[_0xffd9('0x34')](_0x11fd21[_0xffd9('0x30')][_0xffd9('0x34')]));_0x4275b4[_0xffd9('0x33')]=_0x4275b4['attributes'][_0xffd9('0x49')]?_0x4275b4[_0xffd9('0x33')]:_0x28db39[_0xffd9('0x2e')];_0x4275b4[_0xffd9('0x36')]=qs[_0xffd9('0x37')](_0x11fd21[_0xffd9('0x30')]['sort']);_0x4275b4[_0xffd9('0x3a')]=qs[_0xffd9('0x31')](_['pick'](_0x11fd21['query'],_0x28db39[_0xffd9('0x31')]));if(_0x11fd21[_0xffd9('0x30')][_0xffd9('0x39')]){_0x4275b4['where']=_[_0xffd9('0x3b')](_0x4275b4[_0xffd9('0x3a')],{'$or':_['map'](_0x4275b4[_0xffd9('0x33')],function(_0x2d5972){var _0x29e9ab={};_0x29e9ab[_0x2d5972]={'$like':'%'+_0x11fd21[_0xffd9('0x30')][_0xffd9('0x39')]+'%'};return _0x29e9ab;})});}_0x4275b4=_[_0xffd9('0x3b')]({},_0x4275b4,_0x11fd21[_0xffd9('0x3d')]);return _0x441915['getSubjects'](_0x4275b4);}})['then'](function(_0x2a34c5){if(_0x2a34c5){_0xd8eeaf=_0x2a34c5[_0xffd9('0x49')];if(!_0x11fd21['query'][_0xffd9('0x35')]('nolimit')){_0x4275b4['limit']=qs[_0xffd9('0x20')](_0x11fd21[_0xffd9('0x30')][_0xffd9('0x20')]);_0x4275b4['offset']=qs[_0xffd9('0x1d')](_0x11fd21[_0xffd9('0x30')][_0xffd9('0x1d')]);}return _0x441915[_0xffd9('0x4b')](_0x4275b4);}})[_0xffd9('0x25')](function(_0x50bd68){if(_0x50bd68){return _0x50bd68?{'count':_0xd8eeaf,'rows':_0x50bd68}:null;}})[_0xffd9('0x25')](respondWithResult(_0x2cca86,null))[_0xffd9('0x41')](handleError(_0x2cca86,null));};exports[_0xffd9('0x4d')]=function(_0x41fcd1,_0x24e015,_0x3385a6){var _0x18f01b={};var _0x106c85={};var _0x527ee1;var _0x37ee6e;return db[_0xffd9('0x3e')][_0xffd9('0x4e')]({'where':{'id':_0x41fcd1[_0xffd9('0x46')]['id']}})[_0xffd9('0x25')](handleEntityNotFound(_0x24e015,null))[_0xffd9('0x25')](function(_0x3c0122){if(_0x3c0122){_0x527ee1=_0x3c0122;_0x106c85[_0xffd9('0x2e')]=_[_0xffd9('0x2f')](db[_0xffd9('0x4c')][_0xffd9('0x2c')]);_0x106c85[_0xffd9('0x30')]=_[_0xffd9('0x2f')](_0x41fcd1[_0xffd9('0x30')]);_0x106c85[_0xffd9('0x31')]=_[_0xffd9('0x32')](_0x106c85['model'],_0x106c85[_0xffd9('0x30')]);_0x18f01b[_0xffd9('0x33')]=_[_0xffd9('0x32')](_0x106c85[_0xffd9('0x2e')],qs['fields'](_0x41fcd1['query']['fields']));_0x18f01b[_0xffd9('0x33')]=_0x18f01b['attributes'][_0xffd9('0x49')]?_0x18f01b[_0xffd9('0x33')]:_0x106c85[_0xffd9('0x2e')];_0x18f01b[_0xffd9('0x36')]=qs[_0xffd9('0x37')](_0x41fcd1[_0xffd9('0x30')][_0xffd9('0x37')]);_0x18f01b['where']=qs[_0xffd9('0x31')](_['pick'](_0x41fcd1[_0xffd9('0x30')],_0x106c85[_0xffd9('0x31')]));if(_0x41fcd1[_0xffd9('0x30')][_0xffd9('0x39')]){_0x18f01b[_0xffd9('0x3a')]=_[_0xffd9('0x3b')](_0x18f01b[_0xffd9('0x3a')],{'$or':_[_0xffd9('0x2b')](_0x18f01b['attributes'],function(_0x37d4aa){var _0x1a0da6={};_0x1a0da6[_0x37d4aa]={'$like':'%'+_0x41fcd1['query'][_0xffd9('0x39')]+'%'};return _0x1a0da6;})});}_0x18f01b=_[_0xffd9('0x3b')]({},_0x18f01b,_0x41fcd1[_0xffd9('0x3d')]);return _0x527ee1['getDescriptions'](_0x18f01b);}})['then'](function(_0x5f1a03){if(_0x5f1a03){_0x37ee6e=_0x5f1a03[_0xffd9('0x49')];if(!_0x41fcd1[_0xffd9('0x30')][_0xffd9('0x35')]('nolimit')){_0x18f01b[_0xffd9('0x20')]=qs[_0xffd9('0x20')](_0x41fcd1[_0xffd9('0x30')][_0xffd9('0x20')]);_0x18f01b[_0xffd9('0x1d')]=qs[_0xffd9('0x1d')](_0x41fcd1['query'][_0xffd9('0x1d')]);}return _0x527ee1[_0xffd9('0x4d')](_0x18f01b);}})[_0xffd9('0x25')](function(_0x2bad46){if(_0x2bad46){return _0x2bad46?{'count':_0x37ee6e,'rows':_0x2bad46}:null;}})[_0xffd9('0x25')](respondWithResult(_0x24e015,null))['catch'](handleError(_0x24e015,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index b70e639..08f69af 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 _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','lodash','util'];(function(_0x2e4bd6,_0x40c3e1){var _0xa0bb49=function(_0x4e8ae1){while(--_0x4e8ae1){_0x2e4bd6['push'](_0x2e4bd6['shift']());}};_0xa0bb49(++_0x40c3e1);}(_0x54ef,0x112));var _0xf54e=function(_0x54358c,_0x4cacb2){_0x54358c=_0x54358c-0x0;var _0x1696f8=_0x54ef[_0x54358c];return _0x1696f8;};'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 +var _0x9c44=['request-promise','path','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','../../config/logger','api','moment','bluebird'];(function(_0x5ba08a,_0x5b0376){var _0xb95c1e=function(_0x2f8642){while(--_0x2f8642){_0x5ba08a['push'](_0x5ba08a['shift']());}};_0xb95c1e(++_0x5b0376);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 7b0d87c..b7a8988 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 _0xd16d=['message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x73d003,_0x3eb2df){var _0x35082e=function(_0x591511){while(--_0x591511){_0x73d003['push'](_0x73d003['shift']());}};_0x35082e(++_0x3eb2df);}(_0xd16d,0x1ab));var _0xdd16=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd16d[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xdd16('0x0'));var rs=require(_0xdd16('0x1'));var fs=require('fs');var Redis=require(_0xdd16('0x2'));var db=require(_0xdd16('0x3'))['db'];var utils=require(_0xdd16('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xdd16('0x5'));var jayson=require(_0xdd16('0x6'));var client=jayson[_0xdd16('0x7')][_0xdd16('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24e315,_0x2c3bf4,_0x54e112){return new BPromise(function(_0x3226f9,_0x42ee0b){return client['request'](_0x24e315,_0x54e112)[_0xdd16('0x9')](function(_0x2cf30d){logger[_0xdd16('0xa')](_0xdd16('0xb'),_0x2c3bf4,_0xdd16('0xc'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x2c3bf4,_0xdd16('0xc'),JSON[_0xdd16('0xd')](_0x2cf30d));if(_0x2cf30d['error']){if(_0x2cf30d[_0xdd16('0xe')]['code']===0x1f4){logger['error'](_0xdd16('0xb'),_0x2c3bf4,_0x2cf30d[_0xdd16('0xe')]['message']);return _0x42ee0b(_0x2cf30d['error'][_0xdd16('0xf')]);}logger[_0xdd16('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2c3bf4,_0x2cf30d[_0xdd16('0xe')][_0xdd16('0xf')]);return _0x3226f9(_0x2cf30d[_0xdd16('0xe')][_0xdd16('0xf')]);}else{logger[_0xdd16('0xa')](_0xdd16('0xb'),_0x2c3bf4,_0xdd16('0xc'));_0x3226f9(_0x2cf30d['result']['message']);}})[_0xdd16('0x10')](function(_0x1bdc85){logger['error'](_0xdd16('0xb'),_0x2c3bf4,_0x1bdc85);_0x42ee0b(_0x1bdc85);});});} \ No newline at end of file +var _0xc563=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message'];(function(_0x2bd453,_0x322572){var _0x36c295=function(_0xd3ad02){while(--_0xd3ad02){_0x2bd453['push'](_0x2bd453['shift']());}};_0x36c295(++_0x322572);}(_0xc563,0x65));var _0x3c56=function(_0x4c7a67,_0x3847b4){_0x4c7a67=_0x4c7a67-0x0;var _0x545e58=_0xc563[_0x4c7a67];return _0x545e58;};'use strict';var _=require(_0x3c56('0x0'));var util=require('util');var moment=require(_0x3c56('0x1'));var BPromise=require(_0x3c56('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c56('0x3'));var db=require(_0x3c56('0x4'))['db'];var utils=require(_0x3c56('0x5'));var logger=require(_0x3c56('0x6'))(_0x3c56('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3c56('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c930f,_0x44e595,_0x9f8298){return new BPromise(function(_0x22e527,_0x565612){return client[_0x3c56('0x9')](_0x4c930f,_0x9f8298)[_0x3c56('0xa')](function(_0x10af5d){logger[_0x3c56('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x44e595,'request\x20sent');logger['debug'](_0x3c56('0xc'),_0x44e595,_0x3c56('0xd'),JSON[_0x3c56('0xe')](_0x10af5d));if(_0x10af5d['error']){if(_0x10af5d[_0x3c56('0xf')][_0x3c56('0x10')]===0x1f4){logger[_0x3c56('0xf')](_0x3c56('0x11'),_0x44e595,_0x10af5d[_0x3c56('0xf')][_0x3c56('0x12')]);return _0x565612(_0x10af5d[_0x3c56('0xf')]['message']);}logger[_0x3c56('0xf')](_0x3c56('0x11'),_0x44e595,_0x10af5d['error']['message']);return _0x22e527(_0x10af5d[_0x3c56('0xf')][_0x3c56('0x12')]);}else{logger[_0x3c56('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x44e595,'request\x20sent');_0x22e527(_0x10af5d['result']['message']);}})[_0x3c56('0x13')](function(_0x198ba3){logger[_0x3c56('0xf')](_0x3c56('0x11'),_0x44e595,_0x198ba3);_0x565612(_0x198ba3);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 233078a..3d8e57d 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 _0x8aae=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','multer'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8aae,0x153));var _0xe8aa=function(_0x4edb26,_0xb63087){_0x4edb26=_0x4edb26-0x0;var _0x57eeb6=_0x8aae[_0x4edb26];return _0x57eeb6;};'use strict';var multer=require(_0xe8aa('0x0'));var util=require(_0xe8aa('0x1'));var path=require(_0xe8aa('0x2'));var timeout=require('connect-timeout');var express=require(_0xe8aa('0x3'));var router=express[_0xe8aa('0x4')]();var fs_extra=require(_0xe8aa('0x5'));var auth=require(_0xe8aa('0x6'));var interaction=require(_0xe8aa('0x7'));var config=require(_0xe8aa('0x8'));var controller=require(_0xe8aa('0x9'));router['get']('/',auth[_0xe8aa('0xa')](),controller[_0xe8aa('0xb')]);router[_0xe8aa('0xc')](_0xe8aa('0xd'),auth[_0xe8aa('0xa')](),controller[_0xe8aa('0xe')]);router['post']('/',auth[_0xe8aa('0xa')](),controller[_0xe8aa('0xf')]);router[_0xe8aa('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe8aa('0x11')]);router[_0xe8aa('0x12')](_0xe8aa('0xd'),auth[_0xe8aa('0xa')](),controller[_0xe8aa('0x13')]);module['exports']=router; \ No newline at end of file +var _0x4bc6=['post','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x4bc6,0x15a));var _0x64bc=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x4bc6[_0x1deb03];return _0x189fe7;};'use strict';var multer=require('multer');var util=require(_0x64bc('0x0'));var path=require(_0x64bc('0x1'));var timeout=require(_0x64bc('0x2'));var express=require('express');var router=express[_0x64bc('0x3')]();var fs_extra=require(_0x64bc('0x4'));var auth=require(_0x64bc('0x5'));var interaction=require(_0x64bc('0x6'));var config=require(_0x64bc('0x7'));var controller=require(_0x64bc('0x8'));router[_0x64bc('0x9')]('/',auth[_0x64bc('0xa')](),controller[_0x64bc('0xb')]);router[_0x64bc('0x9')](_0x64bc('0xc'),auth['isAuthenticated'](),controller[_0x64bc('0xd')]);router[_0x64bc('0xe')]('/',auth[_0x64bc('0xa')](),controller['create']);router[_0x64bc('0xf')](_0x64bc('0xc'),auth[_0x64bc('0xa')](),controller[_0x64bc('0x10')]);router[_0x64bc('0x11')](_0x64bc('0xc'),auth['isAuthenticated'](),controller[_0x64bc('0x12')]);module[_0x64bc('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index ad7b115..8aa62a4 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 _0x8584=['sequelize','ENUM','variable','keyValue','picklist','string','STRING','customVariable','BOOLEAN'];(function(_0x791035,_0x251541){var _0x83952d=function(_0x252de7){while(--_0x252de7){_0x791035['push'](_0x791035['shift']());}};_0x83952d(++_0x251541);}(_0x8584,0x120));var _0x4858=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x8584[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0x4858('0x0'));module['exports']={'type':{'type':Sequelize[_0x4858('0x1')]('string',_0x4858('0x2'),'customVariable',_0x4858('0x3'),_0x4858('0x4')),'defaultValue':_0x4858('0x5')},'content':{'type':Sequelize[_0x4858('0x6')]},'key':{'type':Sequelize[_0x4858('0x6')]},'keyType':{'type':Sequelize[_0x4858('0x1')]('string','variable',_0x4858('0x7'))},'keyContent':{'type':Sequelize[_0x4858('0x6')]},'idField':{'type':Sequelize[_0x4858('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4858('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4858('0x6')]}}; \ No newline at end of file +var _0xa377=['BOOLEAN','exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x3225ed,_0x1a1954){var _0x200420=function(_0x4d516c){while(--_0x4d516c){_0x3225ed['push'](_0x3225ed['shift']());}};_0x200420(++_0x1a1954);}(_0xa377,0x1a9));var _0x7a37=function(_0x38e9d5,_0xf7a325){_0x38e9d5=_0x38e9d5-0x0;var _0x409acb=_0xa377[_0x38e9d5];return _0x409acb;};'use strict';var Sequelize=require('sequelize');module[_0x7a37('0x0')]={'type':{'type':Sequelize[_0x7a37('0x1')](_0x7a37('0x2'),_0x7a37('0x3'),_0x7a37('0x4'),'keyValue',_0x7a37('0x5')),'defaultValue':_0x7a37('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7a37('0x6')]},'keyType':{'type':Sequelize[_0x7a37('0x1')](_0x7a37('0x2'),_0x7a37('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x7a37('0x6')]},'idField':{'type':Sequelize[_0x7a37('0x6')]},'nameField':{'type':Sequelize[_0x7a37('0x6')]},'customField':{'type':Sequelize[_0x7a37('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7a37('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index e959620..5f797db 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 _0xa6bf=['map','Dynamics365Field','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','merge','where','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','index'];(function(_0x30bb60,_0x10f5d5){var _0x220785=function(_0x3f0770){while(--_0x3f0770){_0x30bb60['push'](_0x30bb60['shift']());}};_0x220785(++_0x10f5d5);}(_0xa6bf,0xb7));var _0xfa6b=function(_0x56ea43,_0x324fab){_0x56ea43=_0x56ea43-0x0;var _0x2731b1=_0xa6bf[_0x56ea43];return _0x2731b1;};'use strict';var emlformat=require(_0xfa6b('0x0'));var rimraf=require(_0xfa6b('0x1'));var zipdir=require(_0xfa6b('0x2'));var jsonpatch=require(_0xfa6b('0x3'));var rp=require(_0xfa6b('0x4'));var moment=require('moment');var BPromise=require(_0xfa6b('0x5'));var Mustache=require(_0xfa6b('0x6'));var util=require(_0xfa6b('0x7'));var path=require(_0xfa6b('0x8'));var sox=require(_0xfa6b('0x9'));var csv=require(_0xfa6b('0xa'));var ejs=require(_0xfa6b('0xb'));var fs=require('fs');var fs_extra=require(_0xfa6b('0xc'));var _=require(_0xfa6b('0xd'));var squel=require('squel');var crypto=require(_0xfa6b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfa6b('0xf'));var toCsv=require(_0xfa6b('0xa'));var querystring=require(_0xfa6b('0x10'));var Papa=require(_0xfa6b('0x11'));var Redis=require(_0xfa6b('0x12'));var authService=require(_0xfa6b('0x13'));var qs=require(_0xfa6b('0x14'));var as=require(_0xfa6b('0x15'));var hardwareService=require(_0xfa6b('0x16'));var logger=require(_0xfa6b('0x17'))(_0xfa6b('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfa6b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x836c1d,_0x14aea7){_0x14aea7=_0x14aea7||0xcc;return function(_0x16c4d0){if(_0x16c4d0){return _0x836c1d[_0xfa6b('0x1a')](_0x14aea7);}return _0x836c1d[_0xfa6b('0x1b')](_0x14aea7)['end']();};}function respondWithResult(_0x21cb47,_0x376183){_0x376183=_0x376183||0xc8;return function(_0x25d56b){if(_0x25d56b){return _0x21cb47['status'](_0x376183)[_0xfa6b('0x1c')](_0x25d56b);}};}function respondWithFilteredResult(_0x1081ba,_0x596acd){return function(_0x497bc){if(_0x497bc){var _0x272534=typeof _0x596acd[_0xfa6b('0x1d')]===_0xfa6b('0x1e')&&typeof _0x596acd[_0xfa6b('0x1f')]===_0xfa6b('0x1e');var _0xa4a95b=_0x497bc[_0xfa6b('0x20')];var _0x5d213d=_0x272534?0x0:_0x596acd[_0xfa6b('0x1d')];var _0x4fd2eb=_0x272534?_0x497bc[_0xfa6b('0x20')]:_0x596acd[_0xfa6b('0x1d')]+_0x596acd['limit'];var _0x3f8ffa;if(_0x4fd2eb>=_0xa4a95b){_0x4fd2eb=_0xa4a95b;_0x3f8ffa=0xc8;}else{_0x3f8ffa=0xce;}_0x1081ba[_0xfa6b('0x1b')](_0x3f8ffa);return _0x1081ba[_0xfa6b('0x21')](_0xfa6b('0x22'),_0x5d213d+'-'+_0x4fd2eb+'/'+_0xa4a95b)[_0xfa6b('0x1c')](_0x497bc);}return null;};}function patchUpdates(_0x5db567){return function(_0x26ad88){try{jsonpatch[_0xfa6b('0x23')](_0x26ad88,_0x5db567,!![]);}catch(_0x5b1817){return BPromise[_0xfa6b('0x24')](_0x5b1817);}return _0x26ad88['save']();};}function saveUpdates(_0x4664a3,_0x53356b){return function(_0x129a72){if(_0x129a72){return _0x129a72[_0xfa6b('0x25')](_0x4664a3)[_0xfa6b('0x26')](function(_0x3ba982){return _0x3ba982;});}return null;};}function removeEntity(_0x5385c3,_0x2512c2){return function(_0x2d779b){if(_0x2d779b){return _0x2d779b[_0xfa6b('0x27')]()[_0xfa6b('0x26')](function(){_0x5385c3['status'](0xcc)[_0xfa6b('0x28')]();});}};}function handleEntityNotFound(_0x292a3c,_0x144f86){return function(_0x471f9b){if(!_0x471f9b){_0x292a3c[_0xfa6b('0x1a')](0x194);}return _0x471f9b;};}function handleError(_0x181bcc,_0x46e6da){_0x46e6da=_0x46e6da||0x1f4;return function(_0x23d2b4){logger['error'](_0x23d2b4[_0xfa6b('0x29')]);if(_0x23d2b4['name']){delete _0x23d2b4[_0xfa6b('0x2a')];}_0x181bcc['status'](_0x46e6da)[_0xfa6b('0x2b')](_0x23d2b4);};}exports[_0xfa6b('0x2c')]=function(_0x160754,_0xa47f61){var _0x3f5fbb={},_0x168603={},_0x29f7e5={'count':0x0,'rows':[]};var _0x1b5669=_[_0xfa6b('0x2d')](db[_0xfa6b('0x2e')][_0xfa6b('0x2f')],function(_0x722c90){return{'name':_0x722c90['fieldName'],'type':_0x722c90[_0xfa6b('0x30')][_0xfa6b('0x31')]};});_0x168603[_0xfa6b('0x32')]=_[_0xfa6b('0x2d')](_0x1b5669,_0xfa6b('0x2a'));_0x168603['query']=_[_0xfa6b('0x33')](_0x160754[_0xfa6b('0x34')]);_0x168603[_0xfa6b('0x35')]=_[_0xfa6b('0x36')](_0x168603[_0xfa6b('0x32')],_0x168603[_0xfa6b('0x34')]);_0x3f5fbb[_0xfa6b('0x37')]=_[_0xfa6b('0x36')](_0x168603[_0xfa6b('0x32')],qs[_0xfa6b('0x38')](_0x160754[_0xfa6b('0x34')][_0xfa6b('0x38')]));_0x3f5fbb['attributes']=_0x3f5fbb['attributes']['length']?_0x3f5fbb[_0xfa6b('0x37')]:_0x168603['model'];if(!_0x160754[_0xfa6b('0x34')][_0xfa6b('0x39')](_0xfa6b('0x3a'))){_0x3f5fbb[_0xfa6b('0x1f')]=qs[_0xfa6b('0x1f')](_0x160754[_0xfa6b('0x34')][_0xfa6b('0x1f')]);_0x3f5fbb[_0xfa6b('0x1d')]=qs[_0xfa6b('0x1d')](_0x160754[_0xfa6b('0x34')][_0xfa6b('0x1d')]);}_0x3f5fbb[_0xfa6b('0x3b')]=qs[_0xfa6b('0x3c')](_0x160754[_0xfa6b('0x34')][_0xfa6b('0x3c')]);_0x3f5fbb['where']=qs[_0xfa6b('0x35')](_[_0xfa6b('0x3d')](_0x160754[_0xfa6b('0x34')],_0x168603[_0xfa6b('0x35')]),_0x1b5669);if(_0x160754[_0xfa6b('0x34')]['filter']){_0x3f5fbb['where']=_[_0xfa6b('0x3e')](_0x3f5fbb[_0xfa6b('0x3f')],{'$or':_[_0xfa6b('0x2d')](_0x1b5669,function(_0xcb361a){if(_0xcb361a[_0xfa6b('0x30')]!=='VIRTUAL'){var _0xee0c4c={};_0xee0c4c[_0xcb361a[_0xfa6b('0x2a')]]={'$like':'%'+_0x160754[_0xfa6b('0x34')]['filter']+'%'};return _0xee0c4c;}})});}_0x3f5fbb=_[_0xfa6b('0x3e')]({},_0x3f5fbb,_0x160754[_0xfa6b('0x40')]);var _0x23c512={'where':_0x3f5fbb[_0xfa6b('0x3f')]};return db[_0xfa6b('0x2e')]['count'](_0x23c512)['then'](function(_0x331302){_0x29f7e5[_0xfa6b('0x20')]=_0x331302;if(_0x160754[_0xfa6b('0x34')][_0xfa6b('0x41')]){_0x3f5fbb['include']=[{'all':!![]}];}return db[_0xfa6b('0x2e')][_0xfa6b('0x42')](_0x3f5fbb);})[_0xfa6b('0x26')](function(_0x496e00){_0x29f7e5[_0xfa6b('0x43')]=_0x496e00;return _0x29f7e5;})[_0xfa6b('0x26')](respondWithFilteredResult(_0xa47f61,_0x3f5fbb))[_0xfa6b('0x44')](handleError(_0xa47f61,null));};exports[_0xfa6b('0x45')]=function(_0x49a7db,_0x161c53){var _0x274a64={'raw':!![],'where':{'id':_0x49a7db[_0xfa6b('0x46')]['id']}},_0x180aec={};_0x180aec['model']=_['keys'](db[_0xfa6b('0x2e')][_0xfa6b('0x2f')]);_0x180aec[_0xfa6b('0x34')]=_['keys'](_0x49a7db[_0xfa6b('0x34')]);_0x180aec[_0xfa6b('0x35')]=_[_0xfa6b('0x36')](_0x180aec[_0xfa6b('0x32')],_0x180aec[_0xfa6b('0x34')]);_0x274a64[_0xfa6b('0x37')]=_[_0xfa6b('0x36')](_0x180aec[_0xfa6b('0x32')],qs[_0xfa6b('0x38')](_0x49a7db[_0xfa6b('0x34')][_0xfa6b('0x38')]));_0x274a64[_0xfa6b('0x37')]=_0x274a64[_0xfa6b('0x37')][_0xfa6b('0x47')]?_0x274a64['attributes']:_0x180aec[_0xfa6b('0x32')];if(_0x49a7db[_0xfa6b('0x34')][_0xfa6b('0x41')]){_0x274a64[_0xfa6b('0x48')]=[{'all':!![]}];}_0x274a64=_[_0xfa6b('0x3e')]({},_0x274a64,_0x49a7db[_0xfa6b('0x40')]);return db[_0xfa6b('0x2e')][_0xfa6b('0x49')](_0x274a64)[_0xfa6b('0x26')](handleEntityNotFound(_0x161c53,null))[_0xfa6b('0x26')](respondWithResult(_0x161c53,null))[_0xfa6b('0x44')](handleError(_0x161c53,null));};exports['create']=function(_0x70df7d,_0x527c53){return db['Dynamics365Field'][_0xfa6b('0x4a')](_0x70df7d['body'],{})[_0xfa6b('0x26')](respondWithResult(_0x527c53,0xc9))[_0xfa6b('0x44')](handleError(_0x527c53,null));};exports[_0xfa6b('0x25')]=function(_0x117a88,_0x15b331){if(_0x117a88[_0xfa6b('0x4b')]['id']){delete _0x117a88[_0xfa6b('0x4b')]['id'];}return db[_0xfa6b('0x2e')][_0xfa6b('0x49')]({'where':{'id':_0x117a88[_0xfa6b('0x46')]['id']}})[_0xfa6b('0x26')](handleEntityNotFound(_0x15b331,null))[_0xfa6b('0x26')](saveUpdates(_0x117a88[_0xfa6b('0x4b')],null))[_0xfa6b('0x26')](respondWithResult(_0x15b331,null))['catch'](handleError(_0x15b331,null));};exports['destroy']=function(_0x78e404,_0x48d391){return db[_0xfa6b('0x2e')][_0xfa6b('0x49')]({'where':{'id':_0x78e404[_0xfa6b('0x46')]['id']}})[_0xfa6b('0x26')](handleEntityNotFound(_0x48d391,null))[_0xfa6b('0x26')](removeEntity(_0x48d391,null))['catch'](handleError(_0x48d391,null));}; \ No newline at end of file +var _0x237f=['find','create','body','update','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','then','error','name','send','index','map','Dynamics365Field','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','filter','merge','where','type','VIRTUAL','options','include','rows','catch','params','rawAttributes','intersection','includeAll'];(function(_0x54bb04,_0x3aaec2){var _0xf7a4f4=function(_0x352481){while(--_0x352481){_0x54bb04['push'](_0x54bb04['shift']());}};_0xf7a4f4(++_0x3aaec2);}(_0x237f,0x1bd));var _0xf237=function(_0x43c62a,_0x125d82){_0x43c62a=_0x43c62a-0x0;var _0x367fb8=_0x237f[_0x43c62a];return _0x367fb8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf237('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf237('0x1'));var BPromise=require(_0xf237('0x2'));var Mustache=require('mustache');var util=require(_0xf237('0x3'));var path=require(_0xf237('0x4'));var sox=require(_0xf237('0x5'));var csv=require(_0xf237('0x6'));var ejs=require(_0xf237('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf237('0x8'));var squel=require(_0xf237('0x9'));var crypto=require(_0xf237('0xa'));var jsforce=require(_0xf237('0xb'));var deskjs=require(_0xf237('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf237('0xd'));var Redis=require(_0xf237('0xe'));var authService=require(_0xf237('0xf'));var qs=require(_0xf237('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf237('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xf237('0x12'));var db=require(_0xf237('0x13'))['db'];function respondWithStatusCode(_0x4c2c8d,_0x166612){_0x166612=_0x166612||0xcc;return function(_0x5c962a){if(_0x5c962a){return _0x4c2c8d[_0xf237('0x14')](_0x166612);}return _0x4c2c8d[_0xf237('0x15')](_0x166612)[_0xf237('0x16')]();};}function respondWithResult(_0x302620,_0x1d7a13){_0x1d7a13=_0x1d7a13||0xc8;return function(_0x482ddd){if(_0x482ddd){return _0x302620[_0xf237('0x15')](_0x1d7a13)[_0xf237('0x17')](_0x482ddd);}};}function respondWithFilteredResult(_0x32b197,_0x528c4d){return function(_0x1e3fc4){if(_0x1e3fc4){var _0x4cb5c6=typeof _0x528c4d[_0xf237('0x18')]===_0xf237('0x19')&&typeof _0x528c4d[_0xf237('0x1a')]===_0xf237('0x19');var _0x5c4dcb=_0x1e3fc4['count'];var _0x348d78=_0x4cb5c6?0x0:_0x528c4d[_0xf237('0x18')];var _0x17f382=_0x4cb5c6?_0x1e3fc4[_0xf237('0x1b')]:_0x528c4d[_0xf237('0x18')]+_0x528c4d['limit'];var _0x56f450;if(_0x17f382>=_0x5c4dcb){_0x17f382=_0x5c4dcb;_0x56f450=0xc8;}else{_0x56f450=0xce;}_0x32b197[_0xf237('0x15')](_0x56f450);return _0x32b197[_0xf237('0x1c')]('Content-Range',_0x348d78+'-'+_0x17f382+'/'+_0x5c4dcb)[_0xf237('0x17')](_0x1e3fc4);}return null;};}function patchUpdates(_0x2c082f){return function(_0x19da4f){try{jsonpatch['apply'](_0x19da4f,_0x2c082f,!![]);}catch(_0x415514){return BPromise['reject'](_0x415514);}return _0x19da4f['save']();};}function saveUpdates(_0x3effa9,_0xbccfd2){return function(_0x4ba532){if(_0x4ba532){return _0x4ba532['update'](_0x3effa9)['then'](function(_0x3b5b51){return _0x3b5b51;});}return null;};}function removeEntity(_0xbc960b,_0x2ca6bf){return function(_0x476231){if(_0x476231){return _0x476231[_0xf237('0x1d')]()[_0xf237('0x1e')](function(){_0xbc960b[_0xf237('0x15')](0xcc)[_0xf237('0x16')]();});}};}function handleEntityNotFound(_0x4cade8,_0x320107){return function(_0x39677f){if(!_0x39677f){_0x4cade8['sendStatus'](0x194);}return _0x39677f;};}function handleError(_0x2d6d57,_0x12dd61){_0x12dd61=_0x12dd61||0x1f4;return function(_0x2d3274){logger[_0xf237('0x1f')](_0x2d3274['stack']);if(_0x2d3274[_0xf237('0x20')]){delete _0x2d3274[_0xf237('0x20')];}_0x2d6d57[_0xf237('0x15')](_0x12dd61)[_0xf237('0x21')](_0x2d3274);};}exports[_0xf237('0x22')]=function(_0x5af8e3,_0x4a57df){var _0x2a80c0={},_0xcd993c={},_0x2f20f6={'count':0x0,'rows':[]};var _0x5159c0=_[_0xf237('0x23')](db[_0xf237('0x24')]['rawAttributes'],function(_0x3bd6bf){return{'name':_0x3bd6bf['fieldName'],'type':_0x3bd6bf['type']['key']};});_0xcd993c[_0xf237('0x25')]=_[_0xf237('0x23')](_0x5159c0,'name');_0xcd993c[_0xf237('0x26')]=_[_0xf237('0x27')](_0x5af8e3[_0xf237('0x26')]);_0xcd993c[_0xf237('0x28')]=_['intersection'](_0xcd993c[_0xf237('0x25')],_0xcd993c[_0xf237('0x26')]);_0x2a80c0[_0xf237('0x29')]=_['intersection'](_0xcd993c[_0xf237('0x25')],qs[_0xf237('0x2a')](_0x5af8e3[_0xf237('0x26')][_0xf237('0x2a')]));_0x2a80c0[_0xf237('0x29')]=_0x2a80c0[_0xf237('0x29')][_0xf237('0x2b')]?_0x2a80c0[_0xf237('0x29')]:_0xcd993c[_0xf237('0x25')];if(!_0x5af8e3[_0xf237('0x26')][_0xf237('0x2c')]('nolimit')){_0x2a80c0[_0xf237('0x1a')]=qs[_0xf237('0x1a')](_0x5af8e3['query'][_0xf237('0x1a')]);_0x2a80c0['offset']=qs['offset'](_0x5af8e3[_0xf237('0x26')][_0xf237('0x18')]);}_0x2a80c0['order']=qs[_0xf237('0x2d')](_0x5af8e3[_0xf237('0x26')][_0xf237('0x2d')]);_0x2a80c0['where']=qs[_0xf237('0x28')](_['pick'](_0x5af8e3[_0xf237('0x26')],_0xcd993c[_0xf237('0x28')]),_0x5159c0);if(_0x5af8e3['query'][_0xf237('0x2e')]){_0x2a80c0['where']=_[_0xf237('0x2f')](_0x2a80c0[_0xf237('0x30')],{'$or':_['map'](_0x5159c0,function(_0x441b14){if(_0x441b14[_0xf237('0x31')]!==_0xf237('0x32')){var _0x4e7a06={};_0x4e7a06[_0x441b14[_0xf237('0x20')]]={'$like':'%'+_0x5af8e3['query']['filter']+'%'};return _0x4e7a06;}})});}_0x2a80c0=_[_0xf237('0x2f')]({},_0x2a80c0,_0x5af8e3[_0xf237('0x33')]);var _0xc366b8={'where':_0x2a80c0[_0xf237('0x30')]};return db[_0xf237('0x24')][_0xf237('0x1b')](_0xc366b8)[_0xf237('0x1e')](function(_0x98c051){_0x2f20f6[_0xf237('0x1b')]=_0x98c051;if(_0x5af8e3[_0xf237('0x26')]['includeAll']){_0x2a80c0[_0xf237('0x34')]=[{'all':!![]}];}return db[_0xf237('0x24')]['findAll'](_0x2a80c0);})[_0xf237('0x1e')](function(_0x4d60aa){_0x2f20f6[_0xf237('0x35')]=_0x4d60aa;return _0x2f20f6;})['then'](respondWithFilteredResult(_0x4a57df,_0x2a80c0))[_0xf237('0x36')](handleError(_0x4a57df,null));};exports['show']=function(_0x5de051,_0x1b1898){var _0x339472={'raw':!![],'where':{'id':_0x5de051[_0xf237('0x37')]['id']}},_0x1227c6={};_0x1227c6[_0xf237('0x25')]=_[_0xf237('0x27')](db['Dynamics365Field'][_0xf237('0x38')]);_0x1227c6[_0xf237('0x26')]=_[_0xf237('0x27')](_0x5de051[_0xf237('0x26')]);_0x1227c6[_0xf237('0x28')]=_[_0xf237('0x39')](_0x1227c6[_0xf237('0x25')],_0x1227c6['query']);_0x339472[_0xf237('0x29')]=_['intersection'](_0x1227c6[_0xf237('0x25')],qs[_0xf237('0x2a')](_0x5de051[_0xf237('0x26')][_0xf237('0x2a')]));_0x339472[_0xf237('0x29')]=_0x339472[_0xf237('0x29')][_0xf237('0x2b')]?_0x339472[_0xf237('0x29')]:_0x1227c6[_0xf237('0x25')];if(_0x5de051[_0xf237('0x26')][_0xf237('0x3a')]){_0x339472[_0xf237('0x34')]=[{'all':!![]}];}_0x339472=_['merge']({},_0x339472,_0x5de051[_0xf237('0x33')]);return db[_0xf237('0x24')][_0xf237('0x3b')](_0x339472)[_0xf237('0x1e')](handleEntityNotFound(_0x1b1898,null))[_0xf237('0x1e')](respondWithResult(_0x1b1898,null))[_0xf237('0x36')](handleError(_0x1b1898,null));};exports['create']=function(_0x323f05,_0x1582d6){return db[_0xf237('0x24')][_0xf237('0x3c')](_0x323f05[_0xf237('0x3d')],{})['then'](respondWithResult(_0x1582d6,0xc9))[_0xf237('0x36')](handleError(_0x1582d6,null));};exports[_0xf237('0x3e')]=function(_0x2f07b0,_0x2f4e9a){if(_0x2f07b0[_0xf237('0x3d')]['id']){delete _0x2f07b0[_0xf237('0x3d')]['id'];}return db[_0xf237('0x24')]['find']({'where':{'id':_0x2f07b0['params']['id']}})[_0xf237('0x1e')](handleEntityNotFound(_0x2f4e9a,null))[_0xf237('0x1e')](saveUpdates(_0x2f07b0['body'],null))[_0xf237('0x1e')](respondWithResult(_0x2f4e9a,null))['catch'](handleError(_0x2f4e9a,null));};exports[_0xf237('0x1d')]=function(_0x1183f9,_0x5d7b79){return db['Dynamics365Field'][_0xf237('0x3b')]({'where':{'id':_0x1183f9[_0xf237('0x37')]['id']}})['then'](handleEntityNotFound(_0x5d7b79,null))[_0xf237('0x1e')](removeEntity(_0x5d7b79,null))['catch'](handleError(_0x5d7b79,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index b6fe709..d808f4f 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 _0x4870=['define','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2353c6,_0x2fcd24){var _0xbec9a2=function(_0x3f35cd){while(--_0x3f35cd){_0x2353c6['push'](_0x2353c6['shift']());}};_0xbec9a2(++_0x2fcd24);}(_0x4870,0x6c));var _0x0487=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x4870[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x0487('0x0'));var util=require(_0x0487('0x1'));var logger=require(_0x0487('0x2'))(_0x0487('0x3'));var moment=require(_0x0487('0x4'));var BPromise=require('bluebird');var rp=require(_0x0487('0x5'));var fs=require('fs');var path=require(_0x0487('0x6'));var rimraf=require(_0x0487('0x7'));var config=require(_0x0487('0x8'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x5523bd,_0x274187){return _0x5523bd[_0x0487('0x9')]('Dynamics365Field',attributes,{'tableName':_0x0487('0xa'),'paranoid':![],'indexes':[{'name':_0x0487('0xb'),'fields':[_0x0487('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf011=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','Dynamics365Field','idField','FieldId','lodash','util'];(function(_0x4ed625,_0x384757){var _0x5b4bad=function(_0x4b4baf){while(--_0x4b4baf){_0x4ed625['push'](_0x4ed625['shift']());}};_0x5b4bad(++_0x384757);}(_0xf011,0x66));var _0x1f01=function(_0x109726,_0x304327){_0x109726=_0x109726-0x0;var _0x5c5db5=_0xf011[_0x109726];return _0x5c5db5;};'use strict';var _=require(_0x1f01('0x0'));var util=require(_0x1f01('0x1'));var logger=require(_0x1f01('0x2'))(_0x1f01('0x3'));var moment=require(_0x1f01('0x4'));var BPromise=require(_0x1f01('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f01('0x6'));var rimraf=require(_0x1f01('0x7'));var config=require(_0x1f01('0x8'));var attributes=require(_0x1f01('0x9'));module['exports']=function(_0x2f3e68,_0x33dfef){return _0x2f3e68['define'](_0x1f01('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x1f01('0xb'),_0x1f01('0xc')],'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 5f258f4..02f8915 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 _0xf0ad=['request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x5be6cd,_0xb96ed0){var _0x4416d7=function(_0x47a22b){while(--_0x47a22b){_0x5be6cd['push'](_0x5be6cd['shift']());}};_0x4416d7(++_0xb96ed0);}(_0xf0ad,0x1bb));var _0xdf0a=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0xf0ad[_0x178856];return _0x3c7fe7;};'use strict';var _=require(_0xdf0a('0x0'));var util=require(_0xdf0a('0x1'));var moment=require(_0xdf0a('0x2'));var BPromise=require(_0xdf0a('0x3'));var rs=require(_0xdf0a('0x4'));var fs=require('fs');var Redis=require(_0xdf0a('0x5'));var db=require(_0xdf0a('0x6'))['db'];var utils=require(_0xdf0a('0x7'));var logger=require(_0xdf0a('0x8'))('rpc');var config=require(_0xdf0a('0x9'));var jayson=require(_0xdf0a('0xa'));var client=jayson[_0xdf0a('0xb')][_0xdf0a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e74f5,_0x3e8220,_0x58aa38){return new BPromise(function(_0x2c6bd3,_0xb4bcf0){return client[_0xdf0a('0xd')](_0x3e74f5,_0x58aa38)[_0xdf0a('0xe')](function(_0x1d2cbf){logger['info'](_0xdf0a('0xf'),_0x3e8220,_0xdf0a('0x10'));logger[_0xdf0a('0x11')](_0xdf0a('0x12'),_0x3e8220,_0xdf0a('0x10'),JSON['stringify'](_0x1d2cbf));if(_0x1d2cbf[_0xdf0a('0x13')]){if(_0x1d2cbf[_0xdf0a('0x13')][_0xdf0a('0x14')]===0x1f4){logger[_0xdf0a('0x13')](_0xdf0a('0xf'),_0x3e8220,_0x1d2cbf[_0xdf0a('0x13')][_0xdf0a('0x15')]);return _0xb4bcf0(_0x1d2cbf[_0xdf0a('0x13')]['message']);}logger['error'](_0xdf0a('0xf'),_0x3e8220,_0x1d2cbf['error']['message']);return _0x2c6bd3(_0x1d2cbf[_0xdf0a('0x13')][_0xdf0a('0x15')]);}else{logger['info'](_0xdf0a('0xf'),_0x3e8220,_0xdf0a('0x10'));_0x2c6bd3(_0x1d2cbf[_0xdf0a('0x16')]['message']);}})[_0xdf0a('0x17')](function(_0x4c9c34){logger[_0xdf0a('0x13')](_0xdf0a('0xf'),_0x3e8220,_0x4c9c34);_0xb4bcf0(_0x4c9c34);});});} \ No newline at end of file +var _0x74a9=['result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x74a9,0x105));var _0x974a=function(_0x4a02e9,_0x5d7b67){_0x4a02e9=_0x4a02e9-0x0;var _0x229ed7=_0x74a9[_0x4a02e9];return _0x229ed7;};'use strict';var _=require('lodash');var util=require(_0x974a('0x0'));var moment=require(_0x974a('0x1'));var BPromise=require('bluebird');var rs=require(_0x974a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x974a('0x3'))['db'];var utils=require(_0x974a('0x4'));var logger=require(_0x974a('0x5'))(_0x974a('0x6'));var config=require(_0x974a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x974a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x246c1b,_0x170746,_0xb31eae){return new BPromise(function(_0x336e50,_0x541f7c){return client[_0x974a('0x9')](_0x246c1b,_0xb31eae)[_0x974a('0xa')](function(_0x5574aa){logger[_0x974a('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x170746,'request\x20sent');logger['debug'](_0x974a('0xc'),_0x170746,_0x974a('0xd'),JSON[_0x974a('0xe')](_0x5574aa));if(_0x5574aa[_0x974a('0xf')]){if(_0x5574aa[_0x974a('0xf')][_0x974a('0x10')]===0x1f4){logger[_0x974a('0xf')](_0x974a('0x11'),_0x170746,_0x5574aa[_0x974a('0xf')][_0x974a('0x12')]);return _0x541f7c(_0x5574aa[_0x974a('0xf')][_0x974a('0x12')]);}logger[_0x974a('0xf')](_0x974a('0x11'),_0x170746,_0x5574aa[_0x974a('0xf')][_0x974a('0x12')]);return _0x336e50(_0x5574aa[_0x974a('0xf')][_0x974a('0x12')]);}else{logger['info'](_0x974a('0x11'),_0x170746,_0x974a('0xd'));_0x336e50(_0x5574aa[_0x974a('0x13')]['message']);}})['catch'](function(_0xd66c51){logger[_0x974a('0xf')](_0x974a('0x11'),_0x170746,_0xd66c51);_0x541f7c(_0xd66c51);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 7e89db5..a8d990c 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 _0x39f5=['fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','Router'];(function(_0xb57a17,_0x374b2f){var _0x26874c=function(_0x336d71){while(--_0x336d71){_0xb57a17['push'](_0xb57a17['shift']());}};_0x26874c(++_0x374b2f);}(_0x39f5,0xed));var _0x539f=function(_0x938808,_0x5c2a90){_0x938808=_0x938808-0x0;var _0xfed299=_0x39f5[_0x938808];return _0xfed299;};'use strict';var multer=require(_0x539f('0x0'));var util=require(_0x539f('0x1'));var path=require(_0x539f('0x2'));var timeout=require(_0x539f('0x3'));var express=require('express');var router=express[_0x539f('0x4')]();var fs_extra=require(_0x539f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x539f('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0x539f('0x7')]('/',auth[_0x539f('0x8')](),controller['index']);router['get'](_0x539f('0x9'),auth['isAuthenticated'](),controller[_0x539f('0xa')]);router[_0x539f('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x539f('0xb')]);router[_0x539f('0x7')](_0x539f('0xc'),auth[_0x539f('0x8')](),controller[_0x539f('0xd')]);router[_0x539f('0xe')]('/',auth['isAuthenticated'](),controller[_0x539f('0xf')]);router[_0x539f('0xe')](_0x539f('0x10'),auth[_0x539f('0x8')](),controller[_0x539f('0x11')]);router[_0x539f('0x12')](_0x539f('0x9'),auth[_0x539f('0x8')](),controller[_0x539f('0x13')]);router[_0x539f('0x14')](_0x539f('0x9'),auth[_0x539f('0x8')](),controller[_0x539f('0x15')]);module['exports']=router; \ No newline at end of file +var _0x59bf=['util','path','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','multer'];(function(_0x1af574,_0x528bcb){var _0x5d2bfd=function(_0x102331){while(--_0x102331){_0x1af574['push'](_0x1af574['shift']());}};_0x5d2bfd(++_0x528bcb);}(_0x59bf,0x9f));var _0xf59b=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x59bf[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0xf59b('0x0'));var util=require(_0xf59b('0x1'));var path=require(_0xf59b('0x2'));var timeout=require('connect-timeout');var express=require(_0xf59b('0x3'));var router=express[_0xf59b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf59b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0xf59b('0x6')]('/',auth[_0xf59b('0x7')](),controller[_0xf59b('0x8')]);router[_0xf59b('0x6')](_0xf59b('0x9'),auth[_0xf59b('0x7')](),controller['show']);router[_0xf59b('0x6')](_0xf59b('0xa'),auth[_0xf59b('0x7')](),controller[_0xf59b('0xb')]);router[_0xf59b('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0xf59b('0xc')]);router[_0xf59b('0xd')]('/',auth[_0xf59b('0x7')](),controller[_0xf59b('0xe')]);router[_0xf59b('0xd')](_0xf59b('0xa'),auth['isAuthenticated'](),controller[_0xf59b('0xf')]);router[_0xf59b('0x10')](_0xf59b('0x9'),auth['isAuthenticated'](),controller[_0xf59b('0x11')]);router[_0xf59b('0x12')]('/:id',auth[_0xf59b('0x7')](),controller[_0xf59b('0x13')]);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 4ddfd3a..acae516 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 _0xd7d1=['sequelize','exports','STRING','username','remoteUri'];(function(_0x194873,_0x1f363c){var _0x56fd85=function(_0x45013d){while(--_0x45013d){_0x194873['push'](_0x194873['shift']());}};_0x56fd85(++_0x1f363c);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x33fe47,_0x5e5700){_0x33fe47=_0x33fe47-0x0;var _0x327090=_0xd7d1[_0x33fe47];return _0x327090;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'name':{'type':Sequelize[_0x1d7d('0x2')]},'description':{'type':Sequelize[_0x1d7d('0x2')]},'username':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x3')},'apiKey':{'type':Sequelize[_0x1d7d('0x2')]},'remoteUri':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x4')},'serverUrl':{'type':Sequelize[_0x1d7d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5464=['remoteUri','sequelize','exports','STRING'];(function(_0x1863bd,_0x466e24){var _0x4b9184=function(_0x13bf14){while(--_0x13bf14){_0x1863bd['push'](_0x1863bd['shift']());}};_0x4b9184(++_0x466e24);}(_0x5464,0x15d));var _0x4546=function(_0x436fcb,_0x325f56){_0x436fcb=_0x436fcb-0x0;var _0x1bac40=_0x5464[_0x436fcb];return _0x1bac40;};'use strict';var Sequelize=require(_0x4546('0x0'));module[_0x4546('0x1')]={'name':{'type':Sequelize[_0x4546('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4546('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x4546('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x4546('0x3')},'serverUrl':{'type':Sequelize[_0x4546('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 dd8ac46..7668ec8 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 _0xf109=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','set','Content-Range','apply','reject','then','destroy','end','stack','name','send','FreshdeskAccount','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','find','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','nolimit','Subjects','type','getDescriptions','channel','FreshdeskField','Descriptions','remoteUri','apiKey','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','description','priority','group','ticket_type','company','remove','default','custom_text','custom_dropdown','label','choices','capitalize','test','error','getFields','stringify','statusCode','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0xf109,0xce));var _0x9f10=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xf109[_0x2aecb2];return _0x3ebb80;};'use strict';var emlformat=require(_0x9f10('0x0'));var rimraf=require(_0x9f10('0x1'));var zipdir=require(_0x9f10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9f10('0x3'));var Mustache=require(_0x9f10('0x4'));var util=require(_0x9f10('0x5'));var path=require(_0x9f10('0x6'));var sox=require(_0x9f10('0x7'));var csv=require(_0x9f10('0x8'));var ejs=require(_0x9f10('0x9'));var fs=require('fs');var fs_extra=require(_0x9f10('0xa'));var _=require(_0x9f10('0xb'));var squel=require(_0x9f10('0xc'));var crypto=require(_0x9f10('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9f10('0xe'));var toCsv=require(_0x9f10('0x8'));var querystring=require(_0x9f10('0xf'));var Papa=require(_0x9f10('0x10'));var Redis=require(_0x9f10('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9f10('0x12'));var as=require(_0x9f10('0x13'));var hardwareService=require(_0x9f10('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9f10('0x15'));var config=require(_0x9f10('0x16'));var licenseUtil=require(_0x9f10('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9f10('0x18'));function respondWithStatusCode(_0x260606,_0x35c529){_0x35c529=_0x35c529||0xcc;return function(_0x58067f){if(_0x58067f){return _0x260606[_0x9f10('0x19')](_0x35c529);}return _0x260606[_0x9f10('0x1a')](_0x35c529)['end']();};}function respondWithResult(_0x40a48a,_0x236e28){_0x236e28=_0x236e28||0xc8;return function(_0x507e1a){if(_0x507e1a){return _0x40a48a['status'](_0x236e28)[_0x9f10('0x1b')](_0x507e1a);}};}function respondWithFilteredResult(_0x177918,_0x549217){return function(_0x11154b){if(_0x11154b){var _0x5ae255=typeof _0x549217[_0x9f10('0x1c')]===_0x9f10('0x1d')&&typeof _0x549217['limit']===_0x9f10('0x1d');var _0xd2950c=_0x11154b['count'];var _0x150813=_0x5ae255?0x0:_0x549217['offset'];var _0xe221d0=_0x5ae255?_0x11154b['count']:_0x549217[_0x9f10('0x1c')]+_0x549217['limit'];var _0x54c262;if(_0xe221d0>=_0xd2950c){_0xe221d0=_0xd2950c;_0x54c262=0xc8;}else{_0x54c262=0xce;}_0x177918[_0x9f10('0x1a')](_0x54c262);return _0x177918[_0x9f10('0x1e')](_0x9f10('0x1f'),_0x150813+'-'+_0xe221d0+'/'+_0xd2950c)[_0x9f10('0x1b')](_0x11154b);}return null;};}function patchUpdates(_0xa810c){return function(_0x332575){try{jsonpatch[_0x9f10('0x20')](_0x332575,_0xa810c,!![]);}catch(_0x4cdc00){return BPromise[_0x9f10('0x21')](_0x4cdc00);}return _0x332575['save']();};}function saveUpdates(_0x293990,_0x36ace4){return function(_0x3d25cb){if(_0x3d25cb){return _0x3d25cb['update'](_0x293990)[_0x9f10('0x22')](function(_0x3dde2e){return _0x3dde2e;});}return null;};}function removeEntity(_0x213567,_0x4d21c5){return function(_0x36821e){if(_0x36821e){return _0x36821e[_0x9f10('0x23')]()[_0x9f10('0x22')](function(){_0x213567['status'](0xcc)[_0x9f10('0x24')]();});}};}function handleEntityNotFound(_0x23c2e7,_0x11cae7){return function(_0x1647c0){if(!_0x1647c0){_0x23c2e7['sendStatus'](0x194);}return _0x1647c0;};}function handleError(_0x57539b,_0x5c1800){_0x5c1800=_0x5c1800||0x1f4;return function(_0x385a39){logger['error'](_0x385a39[_0x9f10('0x25')]);if(_0x385a39[_0x9f10('0x26')]){delete _0x385a39[_0x9f10('0x26')];}_0x57539b[_0x9f10('0x1a')](_0x5c1800)[_0x9f10('0x27')](_0x385a39);};}exports['index']=function(_0x522805,_0x22814f){var _0x40f96b={},_0xfbb37f={},_0x181aec={'count':0x0,'rows':[]};var _0x2c4373=_['map'](db[_0x9f10('0x28')][_0x9f10('0x29')],function(_0x44207f){return{'name':_0x44207f[_0x9f10('0x2a')],'type':_0x44207f['type'][_0x9f10('0x2b')]};});_0xfbb37f[_0x9f10('0x2c')]=_[_0x9f10('0x2d')](_0x2c4373,'name');_0xfbb37f[_0x9f10('0x2e')]=_['keys'](_0x522805[_0x9f10('0x2e')]);_0xfbb37f[_0x9f10('0x2f')]=_[_0x9f10('0x30')](_0xfbb37f['model'],_0xfbb37f[_0x9f10('0x2e')]);_0x40f96b[_0x9f10('0x31')]=_[_0x9f10('0x30')](_0xfbb37f[_0x9f10('0x2c')],qs[_0x9f10('0x32')](_0x522805['query'][_0x9f10('0x32')]));_0x40f96b['attributes']=_0x40f96b[_0x9f10('0x31')][_0x9f10('0x33')]?_0x40f96b[_0x9f10('0x31')]:_0xfbb37f[_0x9f10('0x2c')];if(!_0x522805[_0x9f10('0x2e')][_0x9f10('0x34')]('nolimit')){_0x40f96b[_0x9f10('0x35')]=qs[_0x9f10('0x35')](_0x522805[_0x9f10('0x2e')]['limit']);_0x40f96b[_0x9f10('0x1c')]=qs[_0x9f10('0x1c')](_0x522805['query'][_0x9f10('0x1c')]);}_0x40f96b['order']=qs[_0x9f10('0x36')](_0x522805[_0x9f10('0x2e')][_0x9f10('0x36')]);_0x40f96b[_0x9f10('0x37')]=qs[_0x9f10('0x2f')](_[_0x9f10('0x38')](_0x522805[_0x9f10('0x2e')],_0xfbb37f[_0x9f10('0x2f')]),_0x2c4373);if(_0x522805['query'][_0x9f10('0x39')]){_0x40f96b[_0x9f10('0x37')]=_[_0x9f10('0x3a')](_0x40f96b['where'],{'$or':_[_0x9f10('0x2d')](_0x2c4373,function(_0x193b59){if(_0x193b59['type']!==_0x9f10('0x3b')){var _0x26f0ba={};_0x26f0ba[_0x193b59[_0x9f10('0x26')]]={'$like':'%'+_0x522805['query']['filter']+'%'};return _0x26f0ba;}})});}_0x40f96b=_[_0x9f10('0x3a')]({},_0x40f96b,_0x522805[_0x9f10('0x3c')]);var _0x1deed4={'where':_0x40f96b[_0x9f10('0x37')]};return db[_0x9f10('0x28')][_0x9f10('0x3d')](_0x1deed4)[_0x9f10('0x22')](function(_0x34869c){_0x181aec[_0x9f10('0x3d')]=_0x34869c;if(_0x522805[_0x9f10('0x2e')][_0x9f10('0x3e')]){_0x40f96b[_0x9f10('0x3f')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x40f96b);})['then'](function(_0x24700a){_0x181aec['rows']=_0x24700a;return _0x181aec;})[_0x9f10('0x22')](respondWithFilteredResult(_0x22814f,_0x40f96b))[_0x9f10('0x40')](handleError(_0x22814f,null));};exports[_0x9f10('0x41')]=function(_0x47d25c,_0x3cfce6){var _0xf1164={'raw':![],'where':{'id':_0x47d25c[_0x9f10('0x42')]['id']}},_0x1d334e={};_0x1d334e[_0x9f10('0x2c')]=_['keys'](db['FreshdeskAccount']['rawAttributes']);_0x1d334e[_0x9f10('0x2e')]=_['keys'](_0x47d25c[_0x9f10('0x2e')]);_0x1d334e['filters']=_[_0x9f10('0x30')](_0x1d334e[_0x9f10('0x2c')],_0x1d334e[_0x9f10('0x2e')]);_0xf1164[_0x9f10('0x31')]=_['intersection'](_0x1d334e[_0x9f10('0x2c')],qs[_0x9f10('0x32')](_0x47d25c['query'][_0x9f10('0x32')]));_0xf1164[_0x9f10('0x31')]=_0xf1164[_0x9f10('0x31')][_0x9f10('0x33')]?_0xf1164[_0x9f10('0x31')]:_0x1d334e[_0x9f10('0x2c')];if(_0x47d25c[_0x9f10('0x2e')][_0x9f10('0x3e')]){_0xf1164[_0x9f10('0x3f')]=[{'all':!![]}];}_0xf1164=_[_0x9f10('0x3a')]({},_0xf1164,_0x47d25c['options']);return db[_0x9f10('0x28')][_0x9f10('0x43')](_0xf1164)['then'](handleEntityNotFound(_0x3cfce6,null))[_0x9f10('0x22')](respondWithResult(_0x3cfce6,null))[_0x9f10('0x40')](handleError(_0x3cfce6,null));};exports[_0x9f10('0x44')]=function(_0x1807b3,_0x58b5b5){return db[_0x9f10('0x28')][_0x9f10('0x44')](_0x1807b3[_0x9f10('0x45')],{})[_0x9f10('0x22')](respondWithResult(_0x58b5b5,0xc9))[_0x9f10('0x40')](handleError(_0x58b5b5,null));};exports[_0x9f10('0x46')]=function(_0x479b46,_0x24ebc4){if(_0x479b46[_0x9f10('0x45')]['id']){delete _0x479b46[_0x9f10('0x45')]['id'];}return db[_0x9f10('0x28')][_0x9f10('0x43')]({'where':{'id':_0x479b46[_0x9f10('0x42')]['id']}})['then'](handleEntityNotFound(_0x24ebc4,null))[_0x9f10('0x22')](saveUpdates(_0x479b46[_0x9f10('0x45')],null))[_0x9f10('0x22')](respondWithResult(_0x24ebc4,null))[_0x9f10('0x40')](handleError(_0x24ebc4,null));};exports[_0x9f10('0x23')]=function(_0x15d676,_0x2b6fe7){return db[_0x9f10('0x28')]['find']({'where':{'id':_0x15d676[_0x9f10('0x42')]['id']}})['then'](handleEntityNotFound(_0x2b6fe7,null))[_0x9f10('0x22')](removeEntity(_0x2b6fe7,null))['catch'](handleError(_0x2b6fe7,null));};exports[_0x9f10('0x47')]=function(_0x2d06b2,_0x30fad9,_0x30ea41){var _0x10d6dc={};var _0x497260={};var _0x12cf34;var _0x63abfb;return db[_0x9f10('0x28')][_0x9f10('0x48')]({'where':{'id':_0x2d06b2['params']['id']}})['then'](handleEntityNotFound(_0x30fad9,null))[_0x9f10('0x22')](function(_0x22e236){if(_0x22e236){_0x12cf34=_0x22e236;_0x497260['model']=_['keys'](db[_0x9f10('0x49')][_0x9f10('0x29')]);_0x497260[_0x9f10('0x2e')]=_['keys'](_0x2d06b2[_0x9f10('0x2e')]);_0x497260[_0x9f10('0x2f')]=_[_0x9f10('0x30')](_0x497260['model'],_0x497260[_0x9f10('0x2e')]);_0x10d6dc[_0x9f10('0x31')]=_[_0x9f10('0x30')](_0x497260['model'],qs[_0x9f10('0x32')](_0x2d06b2[_0x9f10('0x2e')]['fields']));_0x10d6dc[_0x9f10('0x31')]=_0x10d6dc[_0x9f10('0x31')][_0x9f10('0x33')]?_0x10d6dc[_0x9f10('0x31')]:_0x497260[_0x9f10('0x2c')];_0x10d6dc['order']=qs[_0x9f10('0x36')](_0x2d06b2['query']['sort']);_0x10d6dc[_0x9f10('0x37')]=qs[_0x9f10('0x2f')](_[_0x9f10('0x38')](_0x2d06b2[_0x9f10('0x2e')],_0x497260[_0x9f10('0x2f')]));if(_0x2d06b2[_0x9f10('0x2e')][_0x9f10('0x39')]){_0x10d6dc['where']=_['merge'](_0x10d6dc[_0x9f10('0x37')],{'$or':_[_0x9f10('0x2d')](_0x10d6dc[_0x9f10('0x31')],function(_0x40f845){var _0x2625ca={};_0x2625ca[_0x40f845]={'$like':'%'+_0x2d06b2[_0x9f10('0x2e')][_0x9f10('0x39')]+'%'};return _0x2625ca;})});}_0x10d6dc=_['merge']({},_0x10d6dc,_0x2d06b2[_0x9f10('0x3c')]);return _0x12cf34[_0x9f10('0x47')](_0x10d6dc);}})['then'](function(_0x29589e){if(_0x29589e){_0x63abfb=_0x29589e[_0x9f10('0x33')];if(!_0x2d06b2['query'][_0x9f10('0x34')](_0x9f10('0x4a'))){_0x10d6dc['limit']=qs[_0x9f10('0x35')](_0x2d06b2['query'][_0x9f10('0x35')]);_0x10d6dc[_0x9f10('0x1c')]=qs[_0x9f10('0x1c')](_0x2d06b2[_0x9f10('0x2e')][_0x9f10('0x1c')]);}return _0x12cf34['getConfigurations'](_0x10d6dc);}})[_0x9f10('0x22')](function(_0x364a6e){if(_0x364a6e){return _0x364a6e?{'count':_0x63abfb,'rows':_0x364a6e}:null;}})[_0x9f10('0x22')](respondWithResult(_0x30fad9,null))['catch'](handleError(_0x30fad9,null));};exports['addConfiguration']=function(_0x5b60ef,_0x41d949,_0x216d6c){if(_0x5b60ef[_0x9f10('0x45')]['id']){delete _0x5b60ef[_0x9f10('0x45')]['id'];}return db[_0x9f10('0x28')][_0x9f10('0x48')]({'where':{'id':_0x5b60ef['params']['id']}})[_0x9f10('0x22')](handleEntityNotFound(_0x41d949,null))[_0x9f10('0x22')](function(_0x498ad6){if(_0x498ad6){_0x5b60ef[_0x9f10('0x45')]['AccountId']=_0x498ad6['id'];_0x5b60ef[_0x9f10('0x45')][_0x9f10('0x4b')]=integrations['getSubjects'](_0x5b60ef[_0x9f10('0x45')]['channel'],_0x5b60ef[_0x9f10('0x45')][_0x9f10('0x4c')]);_0x5b60ef[_0x9f10('0x45')]['Descriptions']=integrations[_0x9f10('0x4d')](_0x5b60ef['body'][_0x9f10('0x4e')],_0x5b60ef[_0x9f10('0x45')][_0x9f10('0x4c')]);return db['FreshdeskConfiguration'][_0x9f10('0x44')](_0x5b60ef['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x9f10('0x4b')},{'model':db[_0x9f10('0x4f')],'as':_0x9f10('0x50')}]});}return null;})['then'](respondWithResult(_0x41d949,null))[_0x9f10('0x40')](handleError(_0x41d949,null));};exports['getFields']=function(_0x48ce93,_0x329a74,_0x551a5d){var _0x4e7b27='';return db[_0x9f10('0x28')]['findOne']({'where':{'id':_0x48ce93[_0x9f10('0x42')]['id']},'attributes':['id',_0x9f10('0x51'),_0x9f10('0x52')]})['then'](handleEntityNotFound(_0x329a74,null))[_0x9f10('0x22')](function(_0x1cbcf3){if(_0x1cbcf3){_0x4e7b27=_0x1cbcf3['remoteUri'];var _0x2941dc=_0x4e7b27['slice'](-0x1);if(_0x2941dc==='/'){_0x4e7b27=_0x4e7b27['substring'](0x0,_0x4e7b27[_0x9f10('0x53')](_0x2941dc));}return rp({'method':_0x9f10('0x54'),'uri':util[_0x9f10('0x55')](_0x9f10('0x56'),_0x4e7b27,_0x9f10('0x57')),'headers':{'Authorization':util[_0x9f10('0x55')](_0x9f10('0x58'),new Buffer(util['format'](_0x9f10('0x59'),_0x1cbcf3[_0x9f10('0x52')]))[_0x9f10('0x5a')](_0x9f10('0x5b')))},'json':!![]});}})[_0x9f10('0x22')](function(_0x16b217){if(_0x16b217){var _0x26d49b=[_0x9f10('0x5c'),_0x9f10('0x5d'),'agent',_0x9f10('0x5e'),_0x9f10('0x1a'),_0x9f10('0x5f'),_0x9f10('0x60'),'source',_0x9f10('0x61'),_0x9f10('0x60'),_0x9f10('0x62')];_[_0x9f10('0x63')](_0x16b217,function(_0x4d68d3){return _0x26d49b['includes'](_0x4d68d3[_0x9f10('0x26')])||!_0x4d68d3[_0x9f10('0x64')]&&_0x4d68d3[_0x9f10('0x4c')]!==_0x9f10('0x65')&&_0x4d68d3[_0x9f10('0x4c')]!==_0x9f10('0x66');});return{'count':_0x16b217[_0x9f10('0x33')],'rows':_[_0x9f10('0x2d')](_0x16b217,function(_0x129f91){return{'id':_0x129f91[_0x9f10('0x26')],'name':_0x129f91[_0x9f10('0x67')],'custom':!_0x129f91[_0x9f10('0x64')],'options':_0x129f91[_0x9f10('0x68')]?_[_0x9f10('0x2d')](_0x129f91[_0x9f10('0x68')],function(_0x514315){return{'name':_[_0x9f10('0x69')](_0x514315),'value':_0x514315};}):[]};})};}})[_0x9f10('0x22')](respondWithResult(_0x329a74,null))['catch'](function(_0x3bcea2){var _0x21d1df=_0x48ce93[_0x9f10('0x2e')][_0x9f10('0x6a')]?0x1f4:_0x3bcea2['statusCode']||0x1f4;logger[_0x9f10('0x6b')]('getFields,\x20%s,\x20%s,\x20%s',_0x9f10('0x6c'),_0x21d1df,JSON[_0x9f10('0x6d')](_0x3bcea2));delete _0x3bcea2[_0x9f10('0x26')];if(_0x21d1df===0x191){_0x21d1df=0x190;}_0x329a74['status'](_0x21d1df)[_0x9f10('0x27')](_0x48ce93[_0x9f10('0x2e')][_0x9f10('0x6a')]?{'message':'Wrong\x20credentials','statusCode':_0x3bcea2[_0x9f10('0x6e')]}:_0x3bcea2);});}; \ No newline at end of file +var _0xe87e=['format','%s/%s','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','priority','group','source','ticket_type','includes','custom_text','custom_dropdown','label','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','undefined','count','offset','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','merge','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','pick','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','apiKey','slice','substring','lastIndexOf'];(function(_0x3a2c1a,_0x3096c7){var _0x3931c5=function(_0x35de16){while(--_0x35de16){_0x3a2c1a['push'](_0x3a2c1a['shift']());}};_0x3931c5(++_0x3096c7);}(_0xe87e,0x17d));var _0xee87=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0xe87e[_0x1bc013];return _0x55df36;};'use strict';var emlformat=require(_0xee87('0x0'));var rimraf=require(_0xee87('0x1'));var zipdir=require(_0xee87('0x2'));var jsonpatch=require(_0xee87('0x3'));var rp=require(_0xee87('0x4'));var moment=require('moment');var BPromise=require(_0xee87('0x5'));var Mustache=require(_0xee87('0x6'));var util=require(_0xee87('0x7'));var path=require(_0xee87('0x8'));var sox=require(_0xee87('0x9'));var csv=require(_0xee87('0xa'));var ejs=require(_0xee87('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xee87('0xc'));var crypto=require(_0xee87('0xd'));var jsforce=require(_0xee87('0xe'));var deskjs=require(_0xee87('0xf'));var toCsv=require(_0xee87('0xa'));var querystring=require('querystring');var Papa=require(_0xee87('0x10'));var Redis=require(_0xee87('0x11'));var authService=require(_0xee87('0x12'));var qs=require(_0xee87('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee87('0x14'));var logger=require(_0xee87('0x15'))('api');var utils=require(_0xee87('0x16'));var config=require(_0xee87('0x17'));var licenseUtil=require(_0xee87('0x18'));var db=require(_0xee87('0x19'))['db'];var integrations=require(_0xee87('0x1a'));function respondWithStatusCode(_0x2768f7,_0x317dcd){_0x317dcd=_0x317dcd||0xcc;return function(_0x129b04){if(_0x129b04){return _0x2768f7['sendStatus'](_0x317dcd);}return _0x2768f7[_0xee87('0x1b')](_0x317dcd)[_0xee87('0x1c')]();};}function respondWithResult(_0x49df11,_0x4be77d){_0x4be77d=_0x4be77d||0xc8;return function(_0x37780f){if(_0x37780f){return _0x49df11[_0xee87('0x1b')](_0x4be77d)['json'](_0x37780f);}};}function respondWithFilteredResult(_0x420526,_0x35d1c7){return function(_0x67df24){if(_0x67df24){var _0x2d1ae0=typeof _0x35d1c7['offset']===_0xee87('0x1d')&&typeof _0x35d1c7['limit']===_0xee87('0x1d');var _0x305924=_0x67df24[_0xee87('0x1e')];var _0x5f378c=_0x2d1ae0?0x0:_0x35d1c7['offset'];var _0x2a1feb=_0x2d1ae0?_0x67df24[_0xee87('0x1e')]:_0x35d1c7[_0xee87('0x1f')]+_0x35d1c7['limit'];var _0x4700fa;if(_0x2a1feb>=_0x305924){_0x2a1feb=_0x305924;_0x4700fa=0xc8;}else{_0x4700fa=0xce;}_0x420526[_0xee87('0x1b')](_0x4700fa);return _0x420526[_0xee87('0x20')](_0xee87('0x21'),_0x5f378c+'-'+_0x2a1feb+'/'+_0x305924)[_0xee87('0x22')](_0x67df24);}return null;};}function patchUpdates(_0x1d48c6){return function(_0x11c939){try{jsonpatch['apply'](_0x11c939,_0x1d48c6,!![]);}catch(_0x2d9a1d){return BPromise[_0xee87('0x23')](_0x2d9a1d);}return _0x11c939[_0xee87('0x24')]();};}function saveUpdates(_0x35e7cf,_0x3176c6){return function(_0xd7236d){if(_0xd7236d){return _0xd7236d[_0xee87('0x25')](_0x35e7cf)[_0xee87('0x26')](function(_0xb41cbc){return _0xb41cbc;});}return null;};}function removeEntity(_0x49e9f5,_0x5cc9a3){return function(_0x415073){if(_0x415073){return _0x415073[_0xee87('0x27')]()['then'](function(){_0x49e9f5[_0xee87('0x1b')](0xcc)[_0xee87('0x1c')]();});}};}function handleEntityNotFound(_0x36a651,_0x55236e){return function(_0x4f5c11){if(!_0x4f5c11){_0x36a651[_0xee87('0x28')](0x194);}return _0x4f5c11;};}function handleError(_0x48fe19,_0x36e381){_0x36e381=_0x36e381||0x1f4;return function(_0x49bf41){logger[_0xee87('0x29')](_0x49bf41[_0xee87('0x2a')]);if(_0x49bf41['name']){delete _0x49bf41[_0xee87('0x2b')];}_0x48fe19[_0xee87('0x1b')](_0x36e381)[_0xee87('0x2c')](_0x49bf41);};}exports[_0xee87('0x2d')]=function(_0x3fcc5e,_0x5ac56a){var _0x3eb538={},_0x439b55={},_0x3f3cd7={'count':0x0,'rows':[]};var _0x3daec7=_[_0xee87('0x2e')](db[_0xee87('0x2f')][_0xee87('0x30')],function(_0x5bbd08){return{'name':_0x5bbd08[_0xee87('0x31')],'type':_0x5bbd08[_0xee87('0x32')][_0xee87('0x33')]};});_0x439b55[_0xee87('0x34')]=_[_0xee87('0x2e')](_0x3daec7,_0xee87('0x2b'));_0x439b55[_0xee87('0x35')]=_[_0xee87('0x36')](_0x3fcc5e[_0xee87('0x35')]);_0x439b55['filters']=_['intersection'](_0x439b55[_0xee87('0x34')],_0x439b55['query']);_0x3eb538[_0xee87('0x37')]=_[_0xee87('0x38')](_0x439b55[_0xee87('0x34')],qs[_0xee87('0x39')](_0x3fcc5e[_0xee87('0x35')][_0xee87('0x39')]));_0x3eb538['attributes']=_0x3eb538['attributes'][_0xee87('0x3a')]?_0x3eb538['attributes']:_0x439b55['model'];if(!_0x3fcc5e[_0xee87('0x35')][_0xee87('0x3b')](_0xee87('0x3c'))){_0x3eb538['limit']=qs[_0xee87('0x3d')](_0x3fcc5e[_0xee87('0x35')][_0xee87('0x3d')]);_0x3eb538[_0xee87('0x1f')]=qs['offset'](_0x3fcc5e[_0xee87('0x35')][_0xee87('0x1f')]);}_0x3eb538[_0xee87('0x3e')]=qs['sort'](_0x3fcc5e[_0xee87('0x35')][_0xee87('0x3f')]);_0x3eb538[_0xee87('0x40')]=qs[_0xee87('0x41')](_['pick'](_0x3fcc5e[_0xee87('0x35')],_0x439b55['filters']),_0x3daec7);if(_0x3fcc5e[_0xee87('0x35')][_0xee87('0x42')]){_0x3eb538[_0xee87('0x40')]=_['merge'](_0x3eb538[_0xee87('0x40')],{'$or':_[_0xee87('0x2e')](_0x3daec7,function(_0x5b818d){if(_0x5b818d[_0xee87('0x32')]!==_0xee87('0x43')){var _0x203e0a={};_0x203e0a[_0x5b818d['name']]={'$like':'%'+_0x3fcc5e[_0xee87('0x35')][_0xee87('0x42')]+'%'};return _0x203e0a;}})});}_0x3eb538=_['merge']({},_0x3eb538,_0x3fcc5e[_0xee87('0x44')]);var _0x468aff={'where':_0x3eb538['where']};return db[_0xee87('0x2f')][_0xee87('0x1e')](_0x468aff)['then'](function(_0x2c276d){_0x3f3cd7['count']=_0x2c276d;if(_0x3fcc5e[_0xee87('0x35')]['includeAll']){_0x3eb538[_0xee87('0x45')]=[{'all':!![]}];}return db[_0xee87('0x2f')][_0xee87('0x46')](_0x3eb538);})[_0xee87('0x26')](function(_0x4eadab){_0x3f3cd7[_0xee87('0x47')]=_0x4eadab;return _0x3f3cd7;})['then'](respondWithFilteredResult(_0x5ac56a,_0x3eb538))[_0xee87('0x48')](handleError(_0x5ac56a,null));};exports[_0xee87('0x49')]=function(_0x5a7786,_0x1652a3){var _0x3fd9d4={'raw':![],'where':{'id':_0x5a7786[_0xee87('0x4a')]['id']}},_0x59362b={};_0x59362b[_0xee87('0x34')]=_[_0xee87('0x36')](db[_0xee87('0x2f')]['rawAttributes']);_0x59362b[_0xee87('0x35')]=_[_0xee87('0x36')](_0x5a7786[_0xee87('0x35')]);_0x59362b['filters']=_[_0xee87('0x38')](_0x59362b[_0xee87('0x34')],_0x59362b[_0xee87('0x35')]);_0x3fd9d4[_0xee87('0x37')]=_[_0xee87('0x38')](_0x59362b[_0xee87('0x34')],qs['fields'](_0x5a7786[_0xee87('0x35')][_0xee87('0x39')]));_0x3fd9d4[_0xee87('0x37')]=_0x3fd9d4[_0xee87('0x37')][_0xee87('0x3a')]?_0x3fd9d4[_0xee87('0x37')]:_0x59362b['model'];if(_0x5a7786[_0xee87('0x35')][_0xee87('0x4b')]){_0x3fd9d4['include']=[{'all':!![]}];}_0x3fd9d4=_[_0xee87('0x4c')]({},_0x3fd9d4,_0x5a7786[_0xee87('0x44')]);return db[_0xee87('0x2f')][_0xee87('0x4d')](_0x3fd9d4)[_0xee87('0x26')](handleEntityNotFound(_0x1652a3,null))['then'](respondWithResult(_0x1652a3,null))[_0xee87('0x48')](handleError(_0x1652a3,null));};exports[_0xee87('0x4e')]=function(_0x4f6f23,_0x468259){return db[_0xee87('0x2f')][_0xee87('0x4e')](_0x4f6f23[_0xee87('0x4f')],{})[_0xee87('0x26')](respondWithResult(_0x468259,0xc9))[_0xee87('0x48')](handleError(_0x468259,null));};exports['update']=function(_0x4605ec,_0x467bb9){if(_0x4605ec[_0xee87('0x4f')]['id']){delete _0x4605ec['body']['id'];}return db[_0xee87('0x2f')][_0xee87('0x4d')]({'where':{'id':_0x4605ec['params']['id']}})[_0xee87('0x26')](handleEntityNotFound(_0x467bb9,null))[_0xee87('0x26')](saveUpdates(_0x4605ec['body'],null))[_0xee87('0x26')](respondWithResult(_0x467bb9,null))['catch'](handleError(_0x467bb9,null));};exports[_0xee87('0x27')]=function(_0x33a2ce,_0x3bc696){return db[_0xee87('0x2f')][_0xee87('0x4d')]({'where':{'id':_0x33a2ce[_0xee87('0x4a')]['id']}})[_0xee87('0x26')](handleEntityNotFound(_0x3bc696,null))['then'](removeEntity(_0x3bc696,null))[_0xee87('0x48')](handleError(_0x3bc696,null));};exports[_0xee87('0x50')]=function(_0x4b1fdd,_0x40f9df,_0x10d307){var _0x5dc4e3={};var _0x1f6511={};var _0x25e473;var _0x504518;return db[_0xee87('0x2f')][_0xee87('0x51')]({'where':{'id':_0x4b1fdd[_0xee87('0x4a')]['id']}})['then'](handleEntityNotFound(_0x40f9df,null))[_0xee87('0x26')](function(_0x38d811){if(_0x38d811){_0x25e473=_0x38d811;_0x1f6511[_0xee87('0x34')]=_[_0xee87('0x36')](db[_0xee87('0x52')]['rawAttributes']);_0x1f6511[_0xee87('0x35')]=_['keys'](_0x4b1fdd[_0xee87('0x35')]);_0x1f6511[_0xee87('0x41')]=_[_0xee87('0x38')](_0x1f6511[_0xee87('0x34')],_0x1f6511['query']);_0x5dc4e3[_0xee87('0x37')]=_['intersection'](_0x1f6511[_0xee87('0x34')],qs['fields'](_0x4b1fdd['query']['fields']));_0x5dc4e3[_0xee87('0x37')]=_0x5dc4e3[_0xee87('0x37')][_0xee87('0x3a')]?_0x5dc4e3[_0xee87('0x37')]:_0x1f6511[_0xee87('0x34')];_0x5dc4e3[_0xee87('0x3e')]=qs[_0xee87('0x3f')](_0x4b1fdd[_0xee87('0x35')]['sort']);_0x5dc4e3['where']=qs['filters'](_[_0xee87('0x53')](_0x4b1fdd[_0xee87('0x35')],_0x1f6511[_0xee87('0x41')]));if(_0x4b1fdd['query'][_0xee87('0x42')]){_0x5dc4e3[_0xee87('0x40')]=_[_0xee87('0x4c')](_0x5dc4e3[_0xee87('0x40')],{'$or':_['map'](_0x5dc4e3[_0xee87('0x37')],function(_0x1b8ec0){var _0x3c88a0={};_0x3c88a0[_0x1b8ec0]={'$like':'%'+_0x4b1fdd[_0xee87('0x35')][_0xee87('0x42')]+'%'};return _0x3c88a0;})});}_0x5dc4e3=_[_0xee87('0x4c')]({},_0x5dc4e3,_0x4b1fdd['options']);return _0x25e473[_0xee87('0x50')](_0x5dc4e3);}})[_0xee87('0x26')](function(_0x27f8ef){if(_0x27f8ef){_0x504518=_0x27f8ef[_0xee87('0x3a')];if(!_0x4b1fdd['query'][_0xee87('0x3b')]('nolimit')){_0x5dc4e3[_0xee87('0x3d')]=qs[_0xee87('0x3d')](_0x4b1fdd[_0xee87('0x35')][_0xee87('0x3d')]);_0x5dc4e3['offset']=qs['offset'](_0x4b1fdd[_0xee87('0x35')][_0xee87('0x1f')]);}return _0x25e473['getConfigurations'](_0x5dc4e3);}})[_0xee87('0x26')](function(_0x2f282f){if(_0x2f282f){return _0x2f282f?{'count':_0x504518,'rows':_0x2f282f}:null;}})[_0xee87('0x26')](respondWithResult(_0x40f9df,null))[_0xee87('0x48')](handleError(_0x40f9df,null));};exports['addConfiguration']=function(_0x583541,_0xc6bf20,_0x1f0827){if(_0x583541[_0xee87('0x4f')]['id']){delete _0x583541[_0xee87('0x4f')]['id'];}return db[_0xee87('0x2f')][_0xee87('0x51')]({'where':{'id':_0x583541[_0xee87('0x4a')]['id']}})[_0xee87('0x26')](handleEntityNotFound(_0xc6bf20,null))[_0xee87('0x26')](function(_0x45a60d){if(_0x45a60d){_0x583541[_0xee87('0x4f')][_0xee87('0x54')]=_0x45a60d['id'];_0x583541['body'][_0xee87('0x55')]=integrations['getSubjects'](_0x583541[_0xee87('0x4f')][_0xee87('0x56')],_0x583541[_0xee87('0x4f')][_0xee87('0x32')]);_0x583541[_0xee87('0x4f')][_0xee87('0x57')]=integrations[_0xee87('0x58')](_0x583541[_0xee87('0x4f')][_0xee87('0x56')],_0x583541[_0xee87('0x4f')]['type']);return db[_0xee87('0x52')]['create'](_0x583541[_0xee87('0x4f')],{'include':[{'model':db['FreshdeskField'],'as':_0xee87('0x55')},{'model':db[_0xee87('0x59')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xc6bf20,null))[_0xee87('0x48')](handleError(_0xc6bf20,null));};exports[_0xee87('0x5a')]=function(_0x161fb7,_0x2c4721,_0x1733c0){var _0x5b4887='';return db[_0xee87('0x2f')]['findOne']({'where':{'id':_0x161fb7['params']['id']},'attributes':['id','remoteUri',_0xee87('0x5b')]})[_0xee87('0x26')](handleEntityNotFound(_0x2c4721,null))[_0xee87('0x26')](function(_0x3bccae){if(_0x3bccae){_0x5b4887=_0x3bccae['remoteUri'];var _0x4ee718=_0x5b4887[_0xee87('0x5c')](-0x1);if(_0x4ee718==='/'){_0x5b4887=_0x5b4887[_0xee87('0x5d')](0x0,_0x5b4887[_0xee87('0x5e')](_0x4ee718));}return rp({'method':'GET','uri':util[_0xee87('0x5f')](_0xee87('0x60'),_0x5b4887,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xee87('0x5f')](_0xee87('0x61'),new Buffer(util[_0xee87('0x5f')](_0xee87('0x62'),_0x3bccae['apiKey']))[_0xee87('0x63')](_0xee87('0x64')))},'json':!![]});}})[_0xee87('0x26')](function(_0x4b6ecc){if(_0x4b6ecc){var _0x49cf3e=[_0xee87('0x65'),_0xee87('0x66'),_0xee87('0x67'),'description','status',_0xee87('0x68'),_0xee87('0x69'),_0xee87('0x6a'),_0xee87('0x6b'),_0xee87('0x69'),'company'];_['remove'](_0x4b6ecc,function(_0x36477d){return _0x49cf3e[_0xee87('0x6c')](_0x36477d[_0xee87('0x2b')])||!_0x36477d['default']&&_0x36477d[_0xee87('0x32')]!==_0xee87('0x6d')&&_0x36477d['type']!==_0xee87('0x6e');});return{'count':_0x4b6ecc[_0xee87('0x3a')],'rows':_[_0xee87('0x2e')](_0x4b6ecc,function(_0x4ee95f){return{'id':_0x4ee95f['name'],'name':_0x4ee95f[_0xee87('0x6f')],'custom':!_0x4ee95f[_0xee87('0x70')],'options':_0x4ee95f[_0xee87('0x71')]?_[_0xee87('0x2e')](_0x4ee95f[_0xee87('0x71')],function(_0x51c3a7){return{'name':_[_0xee87('0x72')](_0x51c3a7),'value':_0x51c3a7};}):[]};})};}})[_0xee87('0x26')](respondWithResult(_0x2c4721,null))['catch'](function(_0x527425){var _0x391bba=_0x161fb7['query'][_0xee87('0x73')]?0x1f4:_0x527425[_0xee87('0x74')]||0x1f4;logger['error'](_0xee87('0x75'),_0xee87('0x5a'),_0x391bba,JSON[_0xee87('0x76')](_0x527425));delete _0x527425[_0xee87('0x2b')];if(_0x391bba===0x191){_0x391bba=0x190;}_0x2c4721[_0xee87('0x1b')](_0x391bba)[_0xee87('0x2c')](_0x161fb7[_0xee87('0x35')][_0xee87('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x527425[_0xee87('0x74')]}:_0x527425);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 481f7bc..f73dddb 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 _0xc8c8=['lodash','util','moment','bluebird','request-promise','../../config/environment','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x2f0fbf,_0x5e83c5){var _0x12cd8f=function(_0x3f12c1){while(--_0x3f12c1){_0x2f0fbf['push'](_0x2f0fbf['shift']());}};_0x12cd8f(++_0x5e83c5);}(_0xc8c8,0x17c));var _0x8c8c=function(_0xd7b1ae,_0x36db4e){_0xd7b1ae=_0xd7b1ae-0x0;var _0x5055ef=_0xc8c8[_0xd7b1ae];return _0x5055ef;};'use strict';var _=require(_0x8c8c('0x0'));var util=require(_0x8c8c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8c8c('0x2'));var BPromise=require(_0x8c8c('0x3'));var rp=require(_0x8c8c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8c8c('0x5'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x8c8c('0x6')]=function(_0x3393fa,_0x3512a9){return _0x3393fa[_0x8c8c('0x7')](_0x8c8c('0x8'),attributes,{'tableName':_0x8c8c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeaab=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshdeskAccount.attributes','exports'];(function(_0x44b865,_0x4e95d6){var _0x60248c=function(_0x1367d3){while(--_0x1367d3){_0x44b865['push'](_0x44b865['shift']());}};_0x60248c(++_0x4e95d6);}(_0xeaab,0x16b));var _0xbeaa=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xeaab[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xbeaa('0x0'));var util=require('util');var logger=require(_0xbeaa('0x1'))(_0xbeaa('0x2'));var moment=require(_0xbeaa('0x3'));var BPromise=require(_0xbeaa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbeaa('0x5'));var rimraf=require('rimraf');var config=require(_0xbeaa('0x6'));var attributes=require(_0xbeaa('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xbeaa('0x8')]=function(_0x27d953,_0x401bcc){return _0x27d953[_0xbeaa('0x9')](_0xbeaa('0xa'),attributes,{'tableName':_0xbeaa('0xb'),'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 08a70d7..34fbb57 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 _0x7a6d=['map','model','stringify','ShowFreshdeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x15f144,_0x29d22a){var _0x5f4db7=function(_0x3f4f74){while(--_0x3f4f74){_0x15f144['push'](_0x15f144['shift']());}};_0x5f4db7(++_0x29d22a);}(_0x7a6d,0x99));var _0xd7a6=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x7a6d[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0xd7a6('0x0'));var util=require(_0xd7a6('0x1'));var moment=require('moment');var BPromise=require(_0xd7a6('0x2'));var rs=require(_0xd7a6('0x3'));var fs=require('fs');var Redis=require(_0xd7a6('0x4'));var db=require(_0xd7a6('0x5'))['db'];var utils=require(_0xd7a6('0x6'));var logger=require('../../config/logger')(_0xd7a6('0x7'));var config=require(_0xd7a6('0x8'));var jayson=require(_0xd7a6('0x9'));var client=jayson[_0xd7a6('0xa')][_0xd7a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ad8e8,_0x6925d6,_0x20ecc5){return new BPromise(function(_0x18b032,_0x1dec54){return client['request'](_0x3ad8e8,_0x20ecc5)[_0xd7a6('0xc')](function(_0x23ecf8){logger[_0xd7a6('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x6925d6,_0xd7a6('0xe'));logger[_0xd7a6('0xf')](_0xd7a6('0x10'),_0x6925d6,_0xd7a6('0xe'),JSON['stringify'](_0x23ecf8));if(_0x23ecf8[_0xd7a6('0x11')]){if(_0x23ecf8[_0xd7a6('0x11')][_0xd7a6('0x12')]===0x1f4){logger['error'](_0xd7a6('0x13'),_0x6925d6,_0x23ecf8[_0xd7a6('0x11')][_0xd7a6('0x14')]);return _0x1dec54(_0x23ecf8[_0xd7a6('0x11')][_0xd7a6('0x14')]);}logger[_0xd7a6('0x11')](_0xd7a6('0x13'),_0x6925d6,_0x23ecf8[_0xd7a6('0x11')]['message']);return _0x18b032(_0x23ecf8[_0xd7a6('0x11')][_0xd7a6('0x14')]);}else{logger['info'](_0xd7a6('0x13'),_0x6925d6,_0xd7a6('0xe'));_0x18b032(_0x23ecf8[_0xd7a6('0x15')][_0xd7a6('0x14')]);}})[_0xd7a6('0x16')](function(_0x89ddec){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x6925d6,_0x89ddec);_0x1dec54(_0x89ddec);});});}exports[_0xd7a6('0x17')]=function(_0x319cb5){var _0x4f5b13=this;return new Promise(function(_0xb70f84,_0x1fea82){return db[_0xd7a6('0x18')][_0xd7a6('0x19')]({'raw':_0x319cb5[_0xd7a6('0x1a')]?_0x319cb5[_0xd7a6('0x1a')][_0xd7a6('0x1b')]===undefined?!![]:![]:!![],'where':_0x319cb5[_0xd7a6('0x1a')]?_0x319cb5[_0xd7a6('0x1a')][_0xd7a6('0x1c')]||null:null,'attributes':_0x319cb5[_0xd7a6('0x1a')]?_0x319cb5[_0xd7a6('0x1a')][_0xd7a6('0x1d')]||null:null,'limit':_0x319cb5[_0xd7a6('0x1a')]?_0x319cb5[_0xd7a6('0x1a')][_0xd7a6('0x1e')]||null:null,'include':_0x319cb5[_0xd7a6('0x1a')]?_0x319cb5[_0xd7a6('0x1a')][_0xd7a6('0x1f')]?_[_0xd7a6('0x20')](_0x319cb5[_0xd7a6('0x1a')]['include'],function(_0x3ba194){return{'model':db[_0x3ba194[_0xd7a6('0x21')]],'as':_0x3ba194['as'],'attributes':_0x3ba194[_0xd7a6('0x1d')],'include':_0x3ba194[_0xd7a6('0x1f')]?_[_0xd7a6('0x20')](_0x3ba194[_0xd7a6('0x1f')],function(_0x509e91){return{'model':db[_0x509e91[_0xd7a6('0x21')]],'as':_0x509e91['as'],'attributes':_0x509e91[_0xd7a6('0x1d')],'include':_0x509e91['include']?_[_0xd7a6('0x20')](_0x509e91[_0xd7a6('0x1f')],function(_0x120ff7){return{'model':db[_0x120ff7['model']],'as':_0x120ff7['as'],'attributes':_0x120ff7[_0xd7a6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd7a6('0xc')](function(_0x49d6f1){logger[_0xd7a6('0xd')](_0xd7a6('0x17'),_0x319cb5);logger[_0xd7a6('0xf')](_0xd7a6('0x17'),_0x319cb5,JSON[_0xd7a6('0x22')](_0x49d6f1));_0xb70f84(_0x49d6f1);})[_0xd7a6('0x16')](function(_0x261678){logger[_0xd7a6('0x11')](_0xd7a6('0x17'),_0x261678[_0xd7a6('0x14')],_0x319cb5);_0x1fea82(_0x4f5b13[_0xd7a6('0x11')](0x1f4,_0x261678['message']));});});};exports[_0xd7a6('0x23')]=function(_0x3337c1){var _0x18db34=this;return new Promise(function(_0x4643a9,_0x4597a7){return db[_0xd7a6('0x18')][_0xd7a6('0x24')]({'raw':_0x3337c1[_0xd7a6('0x1a')]?_0x3337c1['options']['raw']===undefined?!![]:![]:!![],'where':_0x3337c1[_0xd7a6('0x1a')]?_0x3337c1[_0xd7a6('0x1a')][_0xd7a6('0x1c')]||null:null,'attributes':_0x3337c1[_0xd7a6('0x1a')]?_0x3337c1['options'][_0xd7a6('0x1d')]||null:null,'include':_0x3337c1[_0xd7a6('0x1a')]?_0x3337c1[_0xd7a6('0x1a')][_0xd7a6('0x1f')]?_[_0xd7a6('0x20')](_0x3337c1['options'][_0xd7a6('0x1f')],function(_0x16e0db){return{'model':db[_0x16e0db['model']],'as':_0x16e0db['as'],'attributes':_0x16e0db['attributes'],'include':_0x16e0db[_0xd7a6('0x1f')]?_[_0xd7a6('0x20')](_0x16e0db[_0xd7a6('0x1f')],function(_0x306005){return{'model':db[_0x306005['model']],'as':_0x306005['as'],'attributes':_0x306005[_0xd7a6('0x1d')],'include':_0x306005[_0xd7a6('0x1f')]?_[_0xd7a6('0x20')](_0x306005[_0xd7a6('0x1f')],function(_0x181da5){return{'model':db[_0x181da5['model']],'as':_0x181da5['as'],'attributes':_0x181da5[_0xd7a6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd7a6('0xc')](function(_0xc96ca2){logger[_0xd7a6('0xd')]('ShowFreshdeskAccount',_0x3337c1);logger[_0xd7a6('0xf')]('ShowFreshdeskAccount',_0x3337c1,JSON[_0xd7a6('0x22')](_0xc96ca2));_0x4643a9(_0xc96ca2);})['catch'](function(_0x1af5e9){logger[_0xd7a6('0x11')](_0xd7a6('0x23'),_0x1af5e9[_0xd7a6('0x14')],_0x3337c1);_0x4597a7(_0x18db34['error'](0x1f4,_0x1af5e9[_0xd7a6('0x14')]));});});}; \ No newline at end of file +var _0x6ef0=['limit','include','map','model','attributes','GetFreshdeskAccount','ShowFreshdeskAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','FreshdeskAccount','options','raw','where'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x6ef0,0x100));var _0x06ef=function(_0x4001ef,_0x29c6f3){_0x4001ef=_0x4001ef-0x0;var _0x3c691c=_0x6ef0[_0x4001ef];return _0x3c691c;};'use strict';var _=require('lodash');var util=require(_0x06ef('0x0'));var moment=require('moment');var BPromise=require(_0x06ef('0x1'));var rs=require(_0x06ef('0x2'));var fs=require('fs');var Redis=require(_0x06ef('0x3'));var db=require(_0x06ef('0x4'))['db'];var utils=require(_0x06ef('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x06ef('0x6'));var jayson=require(_0x06ef('0x7'));var client=jayson[_0x06ef('0x8')][_0x06ef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x64f9f8,_0x2b02ac,_0x2293d6){return new BPromise(function(_0x856bce,_0x65f4dc){return client['request'](_0x64f9f8,_0x2293d6)[_0x06ef('0xa')](function(_0x4c0360){logger[_0x06ef('0xb')](_0x06ef('0xc'),_0x2b02ac,_0x06ef('0xd'));logger[_0x06ef('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2b02ac,_0x06ef('0xd'),JSON[_0x06ef('0xf')](_0x4c0360));if(_0x4c0360[_0x06ef('0x10')]){if(_0x4c0360['error']['code']===0x1f4){logger[_0x06ef('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x2b02ac,_0x4c0360[_0x06ef('0x10')][_0x06ef('0x11')]);return _0x65f4dc(_0x4c0360[_0x06ef('0x10')][_0x06ef('0x11')]);}logger[_0x06ef('0x10')](_0x06ef('0xc'),_0x2b02ac,_0x4c0360[_0x06ef('0x10')]['message']);return _0x856bce(_0x4c0360[_0x06ef('0x10')]['message']);}else{logger[_0x06ef('0xb')](_0x06ef('0xc'),_0x2b02ac,_0x06ef('0xd'));_0x856bce(_0x4c0360['result']['message']);}})[_0x06ef('0x12')](function(_0x4abfe6){logger[_0x06ef('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x2b02ac,_0x4abfe6);_0x65f4dc(_0x4abfe6);});});}exports['GetFreshdeskAccount']=function(_0x5214e7){var _0x1d6e21=this;return new Promise(function(_0x2341a0,_0x47177f){return db[_0x06ef('0x13')]['findAll']({'raw':_0x5214e7[_0x06ef('0x14')]?_0x5214e7[_0x06ef('0x14')][_0x06ef('0x15')]===undefined?!![]:![]:!![],'where':_0x5214e7[_0x06ef('0x14')]?_0x5214e7['options'][_0x06ef('0x16')]||null:null,'attributes':_0x5214e7['options']?_0x5214e7['options']['attributes']||null:null,'limit':_0x5214e7[_0x06ef('0x14')]?_0x5214e7['options'][_0x06ef('0x17')]||null:null,'include':_0x5214e7[_0x06ef('0x14')]?_0x5214e7[_0x06ef('0x14')][_0x06ef('0x18')]?_[_0x06ef('0x19')](_0x5214e7['options'][_0x06ef('0x18')],function(_0x4fa14e){return{'model':db[_0x4fa14e[_0x06ef('0x1a')]],'as':_0x4fa14e['as'],'attributes':_0x4fa14e[_0x06ef('0x1b')],'include':_0x4fa14e[_0x06ef('0x18')]?_[_0x06ef('0x19')](_0x4fa14e[_0x06ef('0x18')],function(_0x263914){return{'model':db[_0x263914[_0x06ef('0x1a')]],'as':_0x263914['as'],'attributes':_0x263914[_0x06ef('0x1b')],'include':_0x263914['include']?_[_0x06ef('0x19')](_0x263914[_0x06ef('0x18')],function(_0x100a8b){return{'model':db[_0x100a8b[_0x06ef('0x1a')]],'as':_0x100a8b['as'],'attributes':_0x100a8b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x7e58f0){logger['info'](_0x06ef('0x1c'),_0x5214e7);logger['debug'](_0x06ef('0x1c'),_0x5214e7,JSON[_0x06ef('0xf')](_0x7e58f0));_0x2341a0(_0x7e58f0);})[_0x06ef('0x12')](function(_0x17de02){logger[_0x06ef('0x10')](_0x06ef('0x1c'),_0x17de02['message'],_0x5214e7);_0x47177f(_0x1d6e21[_0x06ef('0x10')](0x1f4,_0x17de02[_0x06ef('0x11')]));});});};exports[_0x06ef('0x1d')]=function(_0x41f074){var _0xf41ad9=this;return new Promise(function(_0x1b47e5,_0x4e0d3a){return db['FreshdeskAccount'][_0x06ef('0x1e')]({'raw':_0x41f074[_0x06ef('0x14')]?_0x41f074[_0x06ef('0x14')][_0x06ef('0x15')]===undefined?!![]:![]:!![],'where':_0x41f074[_0x06ef('0x14')]?_0x41f074[_0x06ef('0x14')]['where']||null:null,'attributes':_0x41f074['options']?_0x41f074['options']['attributes']||null:null,'include':_0x41f074[_0x06ef('0x14')]?_0x41f074[_0x06ef('0x14')][_0x06ef('0x18')]?_[_0x06ef('0x19')](_0x41f074['options'][_0x06ef('0x18')],function(_0x222367){return{'model':db[_0x222367[_0x06ef('0x1a')]],'as':_0x222367['as'],'attributes':_0x222367[_0x06ef('0x1b')],'include':_0x222367[_0x06ef('0x18')]?_[_0x06ef('0x19')](_0x222367['include'],function(_0x7bda42){return{'model':db[_0x7bda42[_0x06ef('0x1a')]],'as':_0x7bda42['as'],'attributes':_0x7bda42[_0x06ef('0x1b')],'include':_0x7bda42[_0x06ef('0x18')]?_[_0x06ef('0x19')](_0x7bda42[_0x06ef('0x18')],function(_0x2e0f83){return{'model':db[_0x2e0f83[_0x06ef('0x1a')]],'as':_0x2e0f83['as'],'attributes':_0x2e0f83[_0x06ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x06ef('0xa')](function(_0x5da1b4){logger[_0x06ef('0xb')](_0x06ef('0x1d'),_0x41f074);logger[_0x06ef('0xe')]('ShowFreshdeskAccount',_0x41f074,JSON[_0x06ef('0xf')](_0x5da1b4));_0x1b47e5(_0x5da1b4);})[_0x06ef('0x12')](function(_0xec04de){logger['error'](_0x06ef('0x1d'),_0xec04de[_0x06ef('0x11')],_0x41f074);_0x4e0d3a(_0xf41ad9[_0x06ef('0x10')](0x1f4,_0xec04de[_0x06ef('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index e1494a1..6385548 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 _0x56a2=['connect-timeout','express','Router','../../components/interaction/service','./intFreshdeskConfiguration.controller','isAuthenticated','index','show','getFields','get','/:id/subjects','getSubjects','getDescriptions','getTags','post','/:id/tags','setTags','put','/:id','update','destroy','exports','path'];(function(_0x3eeef3,_0x17fe78){var _0x1026ce=function(_0x2df8bb){while(--_0x2df8bb){_0x3eeef3['push'](_0x3eeef3['shift']());}};_0x1026ce(++_0x17fe78);}(_0x56a2,0x1cb));var _0x256a=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0x56a2[_0x45c981];return _0x4f62c8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x256a('0x0'));var timeout=require(_0x256a('0x1'));var express=require(_0x256a('0x2'));var router=express[_0x256a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x256a('0x4'));var config=require('../../config/environment');var controller=require(_0x256a('0x5'));router['get']('/',auth[_0x256a('0x6')](),controller[_0x256a('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x256a('0x8')]);router['get']('/:id/fields',auth[_0x256a('0x6')](),controller[_0x256a('0x9')]);router[_0x256a('0xa')](_0x256a('0xb'),auth[_0x256a('0x6')](),controller[_0x256a('0xc')]);router[_0x256a('0xa')]('/:id/descriptions',auth[_0x256a('0x6')](),controller[_0x256a('0xd')]);router['get']('/:id/tags',auth[_0x256a('0x6')](),controller[_0x256a('0xe')]);router[_0x256a('0xf')]('/',auth[_0x256a('0x6')](),controller['create']);router[_0x256a('0xf')](_0x256a('0x10'),auth[_0x256a('0x6')](),controller[_0x256a('0x11')]);router[_0x256a('0x12')](_0x256a('0x13'),auth['isAuthenticated'](),controller[_0x256a('0x14')]);router['delete'](_0x256a('0x13'),auth[_0x256a('0x6')](),controller[_0x256a('0x15')]);module[_0x256a('0x16')]=router; \ No newline at end of file +var _0xf1c9=['get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','setTags','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf1c9,0x1b5));var _0x9f1c=function(_0x1f0ef0,_0xb5318f){_0x1f0ef0=_0x1f0ef0-0x0;var _0x45b6d4=_0xf1c9[_0x1f0ef0];return _0x45b6d4;};'use strict';var multer=require(_0x9f1c('0x0'));var util=require(_0x9f1c('0x1'));var path=require(_0x9f1c('0x2'));var timeout=require(_0x9f1c('0x3'));var express=require(_0x9f1c('0x4'));var router=express[_0x9f1c('0x5')]();var fs_extra=require(_0x9f1c('0x6'));var auth=require(_0x9f1c('0x7'));var interaction=require(_0x9f1c('0x8'));var config=require(_0x9f1c('0x9'));var controller=require(_0x9f1c('0xa'));router[_0x9f1c('0xb')]('/',auth[_0x9f1c('0xc')](),controller[_0x9f1c('0xd')]);router['get']('/:id',auth[_0x9f1c('0xc')](),controller[_0x9f1c('0xe')]);router['get'](_0x9f1c('0xf'),auth['isAuthenticated'](),controller[_0x9f1c('0x10')]);router['get'](_0x9f1c('0x11'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x9f1c('0x12'),auth['isAuthenticated'](),controller[_0x9f1c('0x13')]);router[_0x9f1c('0xb')]('/:id/tags',auth[_0x9f1c('0xc')](),controller['getTags']);router[_0x9f1c('0x14')]('/',auth[_0x9f1c('0xc')](),controller[_0x9f1c('0x15')]);router[_0x9f1c('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x9f1c('0x16')]);router[_0x9f1c('0x17')](_0x9f1c('0x18'),auth[_0x9f1c('0xc')](),controller[_0x9f1c('0x19')]);router[_0x9f1c('0x1a')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9f1c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 6bd58f0..974432b 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 _0x2fc5=['exports'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x2fc5,0x146));var _0x52fc=function(_0x34b821,_0x504e55){_0x34b821=_0x34b821-0x0;var _0x5e00a0=_0x2fc5[_0x34b821];return _0x5e00a0;};'use strict';var Sequelize=require('sequelize');module[_0x52fc('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4ff6=['STRING','sequelize'];(function(_0x3792e6,_0x32bd91){var _0x441e44=function(_0x357478){while(--_0x357478){_0x3792e6['push'](_0x3792e6['shift']());}};_0x441e44(++_0x32bd91);}(_0x4ff6,0x73));var _0x64ff=function(_0x42869f,_0xa33224){_0x42869f=_0x42869f-0x0;var _0x3d4f05=_0x4ff6[_0x42869f];return _0x3d4f05;};'use strict';var Sequelize=require(_0x64ff('0x0'));module['exports']={'name':{'type':Sequelize[_0x64ff('0x1')]},'description':{'type':Sequelize[_0x64ff('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index a67454d..09c4321 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 _0x2527=['getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','stack','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','map','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','show','params','options','find','body','catch','destroy','getFields','FreshdeskField','order'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x2527,0xa5));var _0x7252=function(_0x415f83,_0x57bb52){_0x415f83=_0x415f83-0x0;var _0x14d8ee=_0x2527[_0x415f83];return _0x14d8ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7252('0x0'));var zipdir=require(_0x7252('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7252('0x2'));var BPromise=require(_0x7252('0x3'));var Mustache=require(_0x7252('0x4'));var util=require(_0x7252('0x5'));var path=require(_0x7252('0x6'));var sox=require(_0x7252('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7252('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7252('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7252('0xa'));var toCsv=require(_0x7252('0xb'));var querystring=require(_0x7252('0xc'));var Papa=require('papaparse');var Redis=require(_0x7252('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7252('0xe'));var as=require(_0x7252('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7252('0x10'))(_0x7252('0x11'));var utils=require(_0x7252('0x12'));var config=require(_0x7252('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7252('0x14'))['db'];function respondWithStatusCode(_0x4e540c,_0x46728b){_0x46728b=_0x46728b||0xcc;return function(_0x1f47d0){if(_0x1f47d0){return _0x4e540c[_0x7252('0x15')](_0x46728b);}return _0x4e540c['status'](_0x46728b)[_0x7252('0x16')]();};}function respondWithResult(_0x3a64c2,_0x47d433){_0x47d433=_0x47d433||0xc8;return function(_0x165440){if(_0x165440){return _0x3a64c2[_0x7252('0x17')](_0x47d433)[_0x7252('0x18')](_0x165440);}};}function respondWithFilteredResult(_0x3f07f8,_0x50e0cd){return function(_0x4766e9){if(_0x4766e9){var _0x594308=typeof _0x50e0cd[_0x7252('0x19')]===_0x7252('0x1a')&&typeof _0x50e0cd['limit']==='undefined';var _0x3e7cf9=_0x4766e9[_0x7252('0x1b')];var _0x53f891=_0x594308?0x0:_0x50e0cd['offset'];var _0x5e1115=_0x594308?_0x4766e9[_0x7252('0x1b')]:_0x50e0cd['offset']+_0x50e0cd[_0x7252('0x1c')];var _0x51222d;if(_0x5e1115>=_0x3e7cf9){_0x5e1115=_0x3e7cf9;_0x51222d=0xc8;}else{_0x51222d=0xce;}_0x3f07f8[_0x7252('0x17')](_0x51222d);return _0x3f07f8[_0x7252('0x1d')]('Content-Range',_0x53f891+'-'+_0x5e1115+'/'+_0x3e7cf9)['json'](_0x4766e9);}return null;};}function patchUpdates(_0x2abe02){return function(_0x16d36e){try{jsonpatch[_0x7252('0x1e')](_0x16d36e,_0x2abe02,!![]);}catch(_0x936cca){return BPromise['reject'](_0x936cca);}return _0x16d36e[_0x7252('0x1f')]();};}function saveUpdates(_0x521221,_0x239f82){return function(_0x215d9f){if(_0x215d9f){return _0x215d9f[_0x7252('0x20')](_0x521221)[_0x7252('0x21')](function(_0x4bbeae){return _0x4bbeae;});}return null;};}function removeEntity(_0x8677cc,_0x267cfc){return function(_0x32ddb9){if(_0x32ddb9){return _0x32ddb9['destroy']()[_0x7252('0x21')](function(){_0x8677cc[_0x7252('0x17')](0xcc)[_0x7252('0x16')]();});}};}function handleEntityNotFound(_0x587d81,_0x4e0c27){return function(_0x5b81bd){if(!_0x5b81bd){_0x587d81['sendStatus'](0x194);}return _0x5b81bd;};}function handleError(_0x19e99a,_0x36080a){_0x36080a=_0x36080a||0x1f4;return function(_0x177c56){logger['error'](_0x177c56[_0x7252('0x22')]);if(_0x177c56['name']){delete _0x177c56['name'];}_0x19e99a[_0x7252('0x17')](_0x36080a)['send'](_0x177c56);};}exports[_0x7252('0x23')]=function(_0x451392,_0x59adc4){var _0x524f35={},_0x9be0b5={},_0x492573={'count':0x0,'rows':[]};var _0x3fe12b=_['map'](db[_0x7252('0x24')][_0x7252('0x25')],function(_0x5ed53c){return{'name':_0x5ed53c[_0x7252('0x26')],'type':_0x5ed53c[_0x7252('0x27')][_0x7252('0x28')]};});_0x9be0b5[_0x7252('0x29')]=_[_0x7252('0x2a')](_0x3fe12b,_0x7252('0x2b'));_0x9be0b5[_0x7252('0x2c')]=_[_0x7252('0x2d')](_0x451392[_0x7252('0x2c')]);_0x9be0b5['filters']=_[_0x7252('0x2e')](_0x9be0b5[_0x7252('0x29')],_0x9be0b5['query']);_0x524f35['attributes']=_[_0x7252('0x2e')](_0x9be0b5[_0x7252('0x29')],qs[_0x7252('0x2f')](_0x451392[_0x7252('0x2c')][_0x7252('0x2f')]));_0x524f35[_0x7252('0x30')]=_0x524f35[_0x7252('0x30')][_0x7252('0x31')]?_0x524f35['attributes']:_0x9be0b5[_0x7252('0x29')];if(!_0x451392[_0x7252('0x2c')][_0x7252('0x32')](_0x7252('0x33'))){_0x524f35[_0x7252('0x1c')]=qs[_0x7252('0x1c')](_0x451392[_0x7252('0x2c')][_0x7252('0x1c')]);_0x524f35['offset']=qs[_0x7252('0x19')](_0x451392['query']['offset']);}_0x524f35['order']=qs[_0x7252('0x34')](_0x451392['query']['sort']);_0x524f35[_0x7252('0x35')]=qs[_0x7252('0x36')](_[_0x7252('0x37')](_0x451392[_0x7252('0x2c')],_0x9be0b5[_0x7252('0x36')]),_0x3fe12b);if(_0x451392[_0x7252('0x2c')][_0x7252('0x38')]){_0x524f35[_0x7252('0x35')]=_[_0x7252('0x39')](_0x524f35[_0x7252('0x35')],{'$or':_[_0x7252('0x2a')](_0x3fe12b,function(_0xce4078){if(_0xce4078['type']!=='VIRTUAL'){var _0x41afe2={};_0x41afe2[_0xce4078[_0x7252('0x2b')]]={'$like':'%'+_0x451392['query'][_0x7252('0x38')]+'%'};return _0x41afe2;}})});}_0x524f35=_[_0x7252('0x39')]({},_0x524f35,_0x451392['options']);var _0x39838b={'where':_0x524f35['where']};return db[_0x7252('0x24')][_0x7252('0x1b')](_0x39838b)['then'](function(_0x2d637e){_0x492573[_0x7252('0x1b')]=_0x2d637e;if(_0x451392[_0x7252('0x2c')][_0x7252('0x3a')]){_0x524f35[_0x7252('0x3b')]=[{'all':!![]}];}return db[_0x7252('0x24')][_0x7252('0x3c')](_0x524f35);})[_0x7252('0x21')](function(_0xf82db3){_0x492573[_0x7252('0x3d')]=_0xf82db3;return _0x492573;})['then'](respondWithFilteredResult(_0x59adc4,_0x524f35))['catch'](handleError(_0x59adc4,null));};exports[_0x7252('0x3e')]=function(_0x1a387a,_0x5d2698){var _0x17465a={'raw':![],'where':{'id':_0x1a387a[_0x7252('0x3f')]['id']}},_0x549b4d={};_0x549b4d[_0x7252('0x29')]=_[_0x7252('0x2d')](db[_0x7252('0x24')][_0x7252('0x25')]);_0x549b4d[_0x7252('0x2c')]=_[_0x7252('0x2d')](_0x1a387a['query']);_0x549b4d[_0x7252('0x36')]=_['intersection'](_0x549b4d[_0x7252('0x29')],_0x549b4d[_0x7252('0x2c')]);_0x17465a[_0x7252('0x30')]=_[_0x7252('0x2e')](_0x549b4d[_0x7252('0x29')],qs[_0x7252('0x2f')](_0x1a387a[_0x7252('0x2c')][_0x7252('0x2f')]));_0x17465a[_0x7252('0x30')]=_0x17465a['attributes'][_0x7252('0x31')]?_0x17465a[_0x7252('0x30')]:_0x549b4d['model'];if(_0x1a387a[_0x7252('0x2c')][_0x7252('0x3a')]){_0x17465a[_0x7252('0x3b')]=[{'all':!![]}];}_0x17465a=_[_0x7252('0x39')]({},_0x17465a,_0x1a387a[_0x7252('0x40')]);return db[_0x7252('0x24')][_0x7252('0x41')](_0x17465a)[_0x7252('0x21')](handleEntityNotFound(_0x5d2698,null))['then'](respondWithResult(_0x5d2698,null))['catch'](handleError(_0x5d2698,null));};exports['create']=function(_0x3b3e9c,_0x1b4e5f){return db[_0x7252('0x24')]['create'](_0x3b3e9c[_0x7252('0x42')],{})[_0x7252('0x21')](respondWithResult(_0x1b4e5f,0xc9))[_0x7252('0x43')](handleError(_0x1b4e5f,null));};exports[_0x7252('0x20')]=function(_0x25f418,_0x42fcbd){if(_0x25f418[_0x7252('0x42')]['id']){delete _0x25f418[_0x7252('0x42')]['id'];}return db[_0x7252('0x24')]['find']({'where':{'id':_0x25f418['params']['id']}})[_0x7252('0x21')](handleEntityNotFound(_0x42fcbd,null))[_0x7252('0x21')](saveUpdates(_0x25f418[_0x7252('0x42')],null))['then'](respondWithResult(_0x42fcbd,null))['catch'](handleError(_0x42fcbd,null));};exports[_0x7252('0x44')]=function(_0x519723,_0xfa8f64){return db[_0x7252('0x24')][_0x7252('0x41')]({'where':{'id':_0x519723[_0x7252('0x3f')]['id']}})[_0x7252('0x21')](handleEntityNotFound(_0xfa8f64,null))[_0x7252('0x21')](removeEntity(_0xfa8f64,null))['catch'](handleError(_0xfa8f64,null));};exports[_0x7252('0x45')]=function(_0x453afd,_0x1bad5e,_0x3edd55){var _0x3986e6={};var _0x160ae3={};var _0x1e1a8a;var _0x1e43b5;return db[_0x7252('0x24')]['findOne']({'where':{'id':_0x453afd['params']['id']}})['then'](handleEntityNotFound(_0x1bad5e,null))[_0x7252('0x21')](function(_0x29a6c7){if(_0x29a6c7){_0x1e1a8a=_0x29a6c7;_0x160ae3[_0x7252('0x29')]=_[_0x7252('0x2d')](db[_0x7252('0x46')][_0x7252('0x25')]);_0x160ae3['query']=_['keys'](_0x453afd['query']);_0x160ae3[_0x7252('0x36')]=_[_0x7252('0x2e')](_0x160ae3[_0x7252('0x29')],_0x160ae3[_0x7252('0x2c')]);_0x3986e6[_0x7252('0x30')]=_['intersection'](_0x160ae3[_0x7252('0x29')],qs[_0x7252('0x2f')](_0x453afd['query'][_0x7252('0x2f')]));_0x3986e6[_0x7252('0x30')]=_0x3986e6[_0x7252('0x30')][_0x7252('0x31')]?_0x3986e6[_0x7252('0x30')]:_0x160ae3['model'];_0x3986e6[_0x7252('0x47')]=qs[_0x7252('0x34')](_0x453afd[_0x7252('0x2c')][_0x7252('0x34')]);_0x3986e6[_0x7252('0x35')]=qs['filters'](_[_0x7252('0x37')](_0x453afd['query'],_0x160ae3[_0x7252('0x36')]));if(_0x453afd[_0x7252('0x2c')][_0x7252('0x38')]){_0x3986e6['where']=_['merge'](_0x3986e6[_0x7252('0x35')],{'$or':_[_0x7252('0x2a')](_0x3986e6['attributes'],function(_0x5ebc8d){var _0x13afa6={};_0x13afa6[_0x5ebc8d]={'$like':'%'+_0x453afd[_0x7252('0x2c')][_0x7252('0x38')]+'%'};return _0x13afa6;})});}_0x3986e6=_[_0x7252('0x39')]({},_0x3986e6,_0x453afd['options']);return _0x1e1a8a[_0x7252('0x45')](_0x3986e6);}})[_0x7252('0x21')](function(_0x36ad94){if(_0x36ad94){_0x1e43b5=_0x36ad94[_0x7252('0x31')];if(!_0x453afd[_0x7252('0x2c')][_0x7252('0x32')](_0x7252('0x33'))){_0x3986e6[_0x7252('0x1c')]=qs[_0x7252('0x1c')](_0x453afd[_0x7252('0x2c')]['limit']);_0x3986e6[_0x7252('0x19')]=qs[_0x7252('0x19')](_0x453afd[_0x7252('0x2c')]['offset']);}return _0x1e1a8a[_0x7252('0x45')](_0x3986e6);}})['then'](function(_0x1344ff){if(_0x1344ff){return _0x1344ff?{'count':_0x1e43b5,'rows':_0x1344ff}:null;}})['then'](respondWithResult(_0x1bad5e,null))[_0x7252('0x43')](handleError(_0x1bad5e,null));};exports[_0x7252('0x48')]=function(_0x4c5bdb,_0x47fec1,_0x2c02e2){var _0x5bdbd8={};var _0x2771c0={};var _0x549635;var _0xa7b4ef;return db['FreshdeskConfiguration'][_0x7252('0x49')]({'where':{'id':_0x4c5bdb['params']['id']}})['then'](handleEntityNotFound(_0x47fec1,null))[_0x7252('0x21')](function(_0x207277){if(_0x207277){_0x549635=_0x207277;_0x2771c0['model']=_[_0x7252('0x2d')](db[_0x7252('0x46')][_0x7252('0x25')]);_0x2771c0[_0x7252('0x2c')]=_[_0x7252('0x2d')](_0x4c5bdb[_0x7252('0x2c')]);_0x2771c0['filters']=_[_0x7252('0x2e')](_0x2771c0[_0x7252('0x29')],_0x2771c0[_0x7252('0x2c')]);_0x5bdbd8[_0x7252('0x30')]=_['intersection'](_0x2771c0[_0x7252('0x29')],qs[_0x7252('0x2f')](_0x4c5bdb[_0x7252('0x2c')][_0x7252('0x2f')]));_0x5bdbd8[_0x7252('0x30')]=_0x5bdbd8['attributes']['length']?_0x5bdbd8[_0x7252('0x30')]:_0x2771c0[_0x7252('0x29')];_0x5bdbd8['order']=qs[_0x7252('0x34')](_0x4c5bdb[_0x7252('0x2c')][_0x7252('0x34')]);_0x5bdbd8['where']=qs[_0x7252('0x36')](_[_0x7252('0x37')](_0x4c5bdb[_0x7252('0x2c')],_0x2771c0[_0x7252('0x36')]));if(_0x4c5bdb[_0x7252('0x2c')][_0x7252('0x38')]){_0x5bdbd8[_0x7252('0x35')]=_['merge'](_0x5bdbd8['where'],{'$or':_[_0x7252('0x2a')](_0x5bdbd8[_0x7252('0x30')],function(_0xe2547c){var _0x2bf808={};_0x2bf808[_0xe2547c]={'$like':'%'+_0x4c5bdb[_0x7252('0x2c')]['filter']+'%'};return _0x2bf808;})});}_0x5bdbd8=_[_0x7252('0x39')]({},_0x5bdbd8,_0x4c5bdb[_0x7252('0x40')]);return _0x549635[_0x7252('0x48')](_0x5bdbd8);}})['then'](function(_0x2408a5){if(_0x2408a5){_0xa7b4ef=_0x2408a5[_0x7252('0x31')];if(!_0x4c5bdb['query'][_0x7252('0x32')](_0x7252('0x33'))){_0x5bdbd8[_0x7252('0x1c')]=qs[_0x7252('0x1c')](_0x4c5bdb['query']['limit']);_0x5bdbd8[_0x7252('0x19')]=qs[_0x7252('0x19')](_0x4c5bdb[_0x7252('0x2c')][_0x7252('0x19')]);}return _0x549635[_0x7252('0x48')](_0x5bdbd8);}})[_0x7252('0x21')](function(_0x208cdb){if(_0x208cdb){return _0x208cdb?{'count':_0xa7b4ef,'rows':_0x208cdb}:null;}})['then'](respondWithResult(_0x47fec1,null))[_0x7252('0x43')](handleError(_0x47fec1,null));};exports['getDescriptions']=function(_0x1e649a,_0x25deac,_0x8ea0c1){var _0x3fabd4={};var _0xb1f615={};var _0x258a44;var _0x58dc3c;return db[_0x7252('0x24')]['findOne']({'where':{'id':_0x1e649a[_0x7252('0x3f')]['id']}})[_0x7252('0x21')](handleEntityNotFound(_0x25deac,null))['then'](function(_0x1a1750){if(_0x1a1750){_0x258a44=_0x1a1750;_0xb1f615['model']=_[_0x7252('0x2d')](db['FreshdeskField'][_0x7252('0x25')]);_0xb1f615[_0x7252('0x2c')]=_['keys'](_0x1e649a[_0x7252('0x2c')]);_0xb1f615[_0x7252('0x36')]=_['intersection'](_0xb1f615[_0x7252('0x29')],_0xb1f615[_0x7252('0x2c')]);_0x3fabd4[_0x7252('0x30')]=_[_0x7252('0x2e')](_0xb1f615[_0x7252('0x29')],qs[_0x7252('0x2f')](_0x1e649a[_0x7252('0x2c')]['fields']));_0x3fabd4[_0x7252('0x30')]=_0x3fabd4[_0x7252('0x30')][_0x7252('0x31')]?_0x3fabd4['attributes']:_0xb1f615[_0x7252('0x29')];_0x3fabd4['order']=qs[_0x7252('0x34')](_0x1e649a[_0x7252('0x2c')][_0x7252('0x34')]);_0x3fabd4[_0x7252('0x35')]=qs['filters'](_[_0x7252('0x37')](_0x1e649a[_0x7252('0x2c')],_0xb1f615[_0x7252('0x36')]));if(_0x1e649a[_0x7252('0x2c')]['filter']){_0x3fabd4[_0x7252('0x35')]=_['merge'](_0x3fabd4['where'],{'$or':_[_0x7252('0x2a')](_0x3fabd4['attributes'],function(_0x150f1b){var _0x209304={};_0x209304[_0x150f1b]={'$like':'%'+_0x1e649a[_0x7252('0x2c')][_0x7252('0x38')]+'%'};return _0x209304;})});}_0x3fabd4=_[_0x7252('0x39')]({},_0x3fabd4,_0x1e649a[_0x7252('0x40')]);return _0x258a44['getDescriptions'](_0x3fabd4);}})[_0x7252('0x21')](function(_0x57d8e8){if(_0x57d8e8){_0x58dc3c=_0x57d8e8[_0x7252('0x31')];if(!_0x1e649a[_0x7252('0x2c')][_0x7252('0x32')](_0x7252('0x33'))){_0x3fabd4[_0x7252('0x1c')]=qs[_0x7252('0x1c')](_0x1e649a[_0x7252('0x2c')][_0x7252('0x1c')]);_0x3fabd4[_0x7252('0x19')]=qs[_0x7252('0x19')](_0x1e649a[_0x7252('0x2c')][_0x7252('0x19')]);}return _0x258a44[_0x7252('0x4a')](_0x3fabd4);}})['then'](function(_0x374bc2){if(_0x374bc2){return _0x374bc2?{'count':_0x58dc3c,'rows':_0x374bc2}:null;}})[_0x7252('0x21')](respondWithResult(_0x25deac,null))[_0x7252('0x43')](handleError(_0x25deac,null));};exports[_0x7252('0x4b')]=function(_0x5a8379,_0x2f2ab4,_0x240a2c){var _0x5913d8={};var _0x49b12d={};var _0xeaa136;var _0x56d2c5;return db['FreshdeskConfiguration'][_0x7252('0x49')]({'where':{'id':_0x5a8379[_0x7252('0x3f')]['id']}})[_0x7252('0x21')](handleEntityNotFound(_0x2f2ab4,null))[_0x7252('0x21')](function(_0x13d387){if(_0x13d387){_0xeaa136=_0x13d387;_0x49b12d[_0x7252('0x29')]=_['keys'](db[_0x7252('0x4c')]['rawAttributes']);_0x49b12d['query']=_[_0x7252('0x2d')](_0x5a8379[_0x7252('0x2c')]);_0x49b12d['filters']=_[_0x7252('0x2e')](_0x49b12d[_0x7252('0x29')],_0x49b12d['query']);_0x5913d8[_0x7252('0x30')]=_[_0x7252('0x2e')](_0x49b12d['model'],qs[_0x7252('0x2f')](_0x5a8379[_0x7252('0x2c')][_0x7252('0x2f')]));_0x5913d8[_0x7252('0x30')]=_0x5913d8[_0x7252('0x30')][_0x7252('0x31')]?_0x5913d8['attributes']:_0x49b12d['model'];_0x5913d8[_0x7252('0x47')]=qs['sort'](_0x5a8379[_0x7252('0x2c')]['sort']);_0x5913d8['where']=qs[_0x7252('0x36')](_['pick'](_0x5a8379['query'],_0x49b12d[_0x7252('0x36')]));if(_0x5a8379[_0x7252('0x2c')][_0x7252('0x38')]){_0x5913d8[_0x7252('0x35')]=_[_0x7252('0x39')](_0x5913d8[_0x7252('0x35')],{'$or':_[_0x7252('0x2a')](_0x5913d8[_0x7252('0x30')],function(_0x3106a5){var _0x5e51d5={};_0x5e51d5[_0x3106a5]={'$like':'%'+_0x5a8379[_0x7252('0x2c')][_0x7252('0x38')]+'%'};return _0x5e51d5;})});}_0x5913d8=_[_0x7252('0x39')]({},_0x5913d8,_0x5a8379[_0x7252('0x40')]);return _0xeaa136[_0x7252('0x4b')](_0x5913d8);}})['then'](function(_0x2cf482){if(_0x2cf482){_0x56d2c5=_0x2cf482[_0x7252('0x31')];if(!_0x5a8379[_0x7252('0x2c')]['hasOwnProperty'](_0x7252('0x33'))){_0x5913d8[_0x7252('0x1c')]=qs[_0x7252('0x1c')](_0x5a8379['query']['limit']);_0x5913d8[_0x7252('0x19')]=qs[_0x7252('0x19')](_0x5a8379[_0x7252('0x2c')][_0x7252('0x19')]);}return _0xeaa136[_0x7252('0x4b')](_0x5913d8);}})[_0x7252('0x21')](function(_0x1e6e98){if(_0x1e6e98){return _0x1e6e98?{'count':_0x56d2c5,'rows':_0x1e6e98}:null;}})[_0x7252('0x21')](respondWithResult(_0x2f2ab4,null))[_0x7252('0x43')](handleError(_0x2f2ab4,null));};exports[_0x7252('0x4d')]=function(_0x21fa2f,_0x542033,_0x599560){if(_0x21fa2f[_0x7252('0x42')]['id']){delete _0x21fa2f['body']['id'];}return db[_0x7252('0x24')][_0x7252('0x49')]({'where':{'id':_0x21fa2f['params']['id']}})[_0x7252('0x21')](handleEntityNotFound(_0x542033,null))[_0x7252('0x21')](function(_0x2d6c47){if(_0x2d6c47){return _0x2d6c47[_0x7252('0x4d')](_0x21fa2f[_0x7252('0x42')][_0x7252('0x4e')]||[]);}return null;})[_0x7252('0x21')](respondWithResult(_0x542033,null))[_0x7252('0x43')](handleError(_0x542033,null));}; \ No newline at end of file +var _0xb0ae=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','options','find','body','getFields','FreshdeskField','filters','order','pick','nolimit','getSubjects','getDescriptions','getTags','findOne','setTags','ids','eml-format','rimraf','fast-json-patch','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis'];(function(_0x167b85,_0x2b8e0c){var _0x587cbf=function(_0x354d0d){while(--_0x354d0d){_0x167b85['push'](_0x167b85['shift']());}};_0x587cbf(++_0x2b8e0c);}(_0xb0ae,0xe6));var _0xeb0a=function(_0x4b2543,_0x3d30ae){_0x4b2543=_0x4b2543-0x0;var _0x5f592c=_0xb0ae[_0x4b2543];return _0x5f592c;};'use strict';var emlformat=require(_0xeb0a('0x0'));var rimraf=require(_0xeb0a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb0a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xeb0a('0x3'));var sox=require(_0xeb0a('0x4'));var csv=require(_0xeb0a('0x5'));var ejs=require(_0xeb0a('0x6'));var fs=require('fs');var fs_extra=require(_0xeb0a('0x7'));var _=require(_0xeb0a('0x8'));var squel=require('squel');var crypto=require(_0xeb0a('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeb0a('0x5'));var querystring=require(_0xeb0a('0xa'));var Papa=require(_0xeb0a('0xb'));var Redis=require(_0xeb0a('0xc'));var authService=require(_0xeb0a('0xd'));var qs=require(_0xeb0a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb0a('0xf'));var logger=require(_0xeb0a('0x10'))(_0xeb0a('0x11'));var utils=require(_0xeb0a('0x12'));var config=require(_0xeb0a('0x13'));var licenseUtil=require(_0xeb0a('0x14'));var db=require(_0xeb0a('0x15'))['db'];function respondWithStatusCode(_0x52852a,_0x2c2b89){_0x2c2b89=_0x2c2b89||0xcc;return function(_0x2a18fb){if(_0x2a18fb){return _0x52852a['sendStatus'](_0x2c2b89);}return _0x52852a[_0xeb0a('0x16')](_0x2c2b89)[_0xeb0a('0x17')]();};}function respondWithResult(_0x20cc57,_0x2b1fbc){_0x2b1fbc=_0x2b1fbc||0xc8;return function(_0x584908){if(_0x584908){return _0x20cc57[_0xeb0a('0x16')](_0x2b1fbc)[_0xeb0a('0x18')](_0x584908);}};}function respondWithFilteredResult(_0x3e48af,_0x9aa047){return function(_0x4c67f6){if(_0x4c67f6){var _0x102feb=typeof _0x9aa047[_0xeb0a('0x19')]==='undefined'&&typeof _0x9aa047[_0xeb0a('0x1a')]===_0xeb0a('0x1b');var _0x37e7d5=_0x4c67f6[_0xeb0a('0x1c')];var _0x2d3176=_0x102feb?0x0:_0x9aa047[_0xeb0a('0x19')];var _0x3ea7e3=_0x102feb?_0x4c67f6['count']:_0x9aa047[_0xeb0a('0x19')]+_0x9aa047['limit'];var _0x34f071;if(_0x3ea7e3>=_0x37e7d5){_0x3ea7e3=_0x37e7d5;_0x34f071=0xc8;}else{_0x34f071=0xce;}_0x3e48af[_0xeb0a('0x16')](_0x34f071);return _0x3e48af[_0xeb0a('0x1d')](_0xeb0a('0x1e'),_0x2d3176+'-'+_0x3ea7e3+'/'+_0x37e7d5)['json'](_0x4c67f6);}return null;};}function patchUpdates(_0xd719e5){return function(_0xd290dd){try{jsonpatch[_0xeb0a('0x1f')](_0xd290dd,_0xd719e5,!![]);}catch(_0x38d527){return BPromise[_0xeb0a('0x20')](_0x38d527);}return _0xd290dd[_0xeb0a('0x21')]();};}function saveUpdates(_0x2f17be,_0x341bac){return function(_0x2be8a2){if(_0x2be8a2){return _0x2be8a2[_0xeb0a('0x22')](_0x2f17be)['then'](function(_0x44ae6b){return _0x44ae6b;});}return null;};}function removeEntity(_0x1a42c0,_0x29e219){return function(_0x439e2c){if(_0x439e2c){return _0x439e2c[_0xeb0a('0x23')]()[_0xeb0a('0x24')](function(){_0x1a42c0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39657f,_0x30f7e4){return function(_0x5c2175){if(!_0x5c2175){_0x39657f[_0xeb0a('0x25')](0x194);}return _0x5c2175;};}function handleError(_0x250652,_0x4eacac){_0x4eacac=_0x4eacac||0x1f4;return function(_0x3fe4a2){logger['error'](_0x3fe4a2['stack']);if(_0x3fe4a2[_0xeb0a('0x26')]){delete _0x3fe4a2[_0xeb0a('0x26')];}_0x250652['status'](_0x4eacac)[_0xeb0a('0x27')](_0x3fe4a2);};}exports[_0xeb0a('0x28')]=function(_0x186e18,_0x162b2f){var _0x2963d3={},_0x536325={},_0x31db3e={'count':0x0,'rows':[]};var _0xfa95f4=_[_0xeb0a('0x29')](db[_0xeb0a('0x2a')][_0xeb0a('0x2b')],function(_0x1cdc8a){return{'name':_0x1cdc8a[_0xeb0a('0x2c')],'type':_0x1cdc8a['type'][_0xeb0a('0x2d')]};});_0x536325[_0xeb0a('0x2e')]=_[_0xeb0a('0x29')](_0xfa95f4,_0xeb0a('0x26'));_0x536325['query']=_[_0xeb0a('0x2f')](_0x186e18[_0xeb0a('0x30')]);_0x536325['filters']=_['intersection'](_0x536325[_0xeb0a('0x2e')],_0x536325[_0xeb0a('0x30')]);_0x2963d3['attributes']=_[_0xeb0a('0x31')](_0x536325[_0xeb0a('0x2e')],qs['fields'](_0x186e18[_0xeb0a('0x30')][_0xeb0a('0x32')]));_0x2963d3['attributes']=_0x2963d3[_0xeb0a('0x33')][_0xeb0a('0x34')]?_0x2963d3[_0xeb0a('0x33')]:_0x536325[_0xeb0a('0x2e')];if(!_0x186e18[_0xeb0a('0x30')][_0xeb0a('0x35')]('nolimit')){_0x2963d3[_0xeb0a('0x1a')]=qs[_0xeb0a('0x1a')](_0x186e18[_0xeb0a('0x30')][_0xeb0a('0x1a')]);_0x2963d3['offset']=qs[_0xeb0a('0x19')](_0x186e18[_0xeb0a('0x30')][_0xeb0a('0x19')]);}_0x2963d3['order']=qs[_0xeb0a('0x36')](_0x186e18[_0xeb0a('0x30')]['sort']);_0x2963d3[_0xeb0a('0x37')]=qs['filters'](_['pick'](_0x186e18['query'],_0x536325['filters']),_0xfa95f4);if(_0x186e18[_0xeb0a('0x30')][_0xeb0a('0x38')]){_0x2963d3[_0xeb0a('0x37')]=_['merge'](_0x2963d3[_0xeb0a('0x37')],{'$or':_[_0xeb0a('0x29')](_0xfa95f4,function(_0x44abae){if(_0x44abae[_0xeb0a('0x39')]!==_0xeb0a('0x3a')){var _0x1ba219={};_0x1ba219[_0x44abae[_0xeb0a('0x26')]]={'$like':'%'+_0x186e18['query'][_0xeb0a('0x38')]+'%'};return _0x1ba219;}})});}_0x2963d3=_[_0xeb0a('0x3b')]({},_0x2963d3,_0x186e18['options']);var _0x46ec52={'where':_0x2963d3[_0xeb0a('0x37')]};return db['FreshdeskConfiguration']['count'](_0x46ec52)['then'](function(_0x708d8d){_0x31db3e[_0xeb0a('0x1c')]=_0x708d8d;if(_0x186e18[_0xeb0a('0x30')][_0xeb0a('0x3c')]){_0x2963d3[_0xeb0a('0x3d')]=[{'all':!![]}];}return db[_0xeb0a('0x2a')][_0xeb0a('0x3e')](_0x2963d3);})[_0xeb0a('0x24')](function(_0x70a0da){_0x31db3e[_0xeb0a('0x3f')]=_0x70a0da;return _0x31db3e;})[_0xeb0a('0x24')](respondWithFilteredResult(_0x162b2f,_0x2963d3))[_0xeb0a('0x40')](handleError(_0x162b2f,null));};exports['show']=function(_0x55f3e5,_0x3b2cae){var _0xaf2ebf={'raw':![],'where':{'id':_0x55f3e5[_0xeb0a('0x41')]['id']}},_0x8cc670={};_0x8cc670[_0xeb0a('0x2e')]=_['keys'](db[_0xeb0a('0x2a')][_0xeb0a('0x2b')]);_0x8cc670[_0xeb0a('0x30')]=_[_0xeb0a('0x2f')](_0x55f3e5[_0xeb0a('0x30')]);_0x8cc670['filters']=_[_0xeb0a('0x31')](_0x8cc670[_0xeb0a('0x2e')],_0x8cc670[_0xeb0a('0x30')]);_0xaf2ebf[_0xeb0a('0x33')]=_[_0xeb0a('0x31')](_0x8cc670['model'],qs[_0xeb0a('0x32')](_0x55f3e5[_0xeb0a('0x30')][_0xeb0a('0x32')]));_0xaf2ebf[_0xeb0a('0x33')]=_0xaf2ebf[_0xeb0a('0x33')]['length']?_0xaf2ebf[_0xeb0a('0x33')]:_0x8cc670['model'];if(_0x55f3e5[_0xeb0a('0x30')][_0xeb0a('0x3c')]){_0xaf2ebf[_0xeb0a('0x3d')]=[{'all':!![]}];}_0xaf2ebf=_[_0xeb0a('0x3b')]({},_0xaf2ebf,_0x55f3e5[_0xeb0a('0x42')]);return db['FreshdeskConfiguration'][_0xeb0a('0x43')](_0xaf2ebf)['then'](handleEntityNotFound(_0x3b2cae,null))[_0xeb0a('0x24')](respondWithResult(_0x3b2cae,null))[_0xeb0a('0x40')](handleError(_0x3b2cae,null));};exports['create']=function(_0x366d0e,_0x161779){return db[_0xeb0a('0x2a')]['create'](_0x366d0e[_0xeb0a('0x44')],{})[_0xeb0a('0x24')](respondWithResult(_0x161779,0xc9))[_0xeb0a('0x40')](handleError(_0x161779,null));};exports[_0xeb0a('0x22')]=function(_0x49e704,_0x17b1fe){if(_0x49e704[_0xeb0a('0x44')]['id']){delete _0x49e704['body']['id'];}return db[_0xeb0a('0x2a')][_0xeb0a('0x43')]({'where':{'id':_0x49e704[_0xeb0a('0x41')]['id']}})['then'](handleEntityNotFound(_0x17b1fe,null))[_0xeb0a('0x24')](saveUpdates(_0x49e704[_0xeb0a('0x44')],null))[_0xeb0a('0x24')](respondWithResult(_0x17b1fe,null))['catch'](handleError(_0x17b1fe,null));};exports[_0xeb0a('0x23')]=function(_0x1ce3b5,_0x429794){return db[_0xeb0a('0x2a')][_0xeb0a('0x43')]({'where':{'id':_0x1ce3b5[_0xeb0a('0x41')]['id']}})[_0xeb0a('0x24')](handleEntityNotFound(_0x429794,null))[_0xeb0a('0x24')](removeEntity(_0x429794,null))['catch'](handleError(_0x429794,null));};exports[_0xeb0a('0x45')]=function(_0x1d3d6b,_0x4fb7e1,_0x5aa97b){var _0x34ce59={};var _0x478ed9={};var _0x1ce87b;var _0x1b354b;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x1d3d6b['params']['id']}})[_0xeb0a('0x24')](handleEntityNotFound(_0x4fb7e1,null))[_0xeb0a('0x24')](function(_0x809ad1){if(_0x809ad1){_0x1ce87b=_0x809ad1;_0x478ed9['model']=_[_0xeb0a('0x2f')](db[_0xeb0a('0x46')][_0xeb0a('0x2b')]);_0x478ed9[_0xeb0a('0x30')]=_[_0xeb0a('0x2f')](_0x1d3d6b[_0xeb0a('0x30')]);_0x478ed9[_0xeb0a('0x47')]=_[_0xeb0a('0x31')](_0x478ed9[_0xeb0a('0x2e')],_0x478ed9[_0xeb0a('0x30')]);_0x34ce59[_0xeb0a('0x33')]=_[_0xeb0a('0x31')](_0x478ed9['model'],qs[_0xeb0a('0x32')](_0x1d3d6b[_0xeb0a('0x30')][_0xeb0a('0x32')]));_0x34ce59['attributes']=_0x34ce59[_0xeb0a('0x33')][_0xeb0a('0x34')]?_0x34ce59['attributes']:_0x478ed9[_0xeb0a('0x2e')];_0x34ce59[_0xeb0a('0x48')]=qs[_0xeb0a('0x36')](_0x1d3d6b[_0xeb0a('0x30')]['sort']);_0x34ce59[_0xeb0a('0x37')]=qs[_0xeb0a('0x47')](_[_0xeb0a('0x49')](_0x1d3d6b[_0xeb0a('0x30')],_0x478ed9[_0xeb0a('0x47')]));if(_0x1d3d6b['query'][_0xeb0a('0x38')]){_0x34ce59[_0xeb0a('0x37')]=_[_0xeb0a('0x3b')](_0x34ce59[_0xeb0a('0x37')],{'$or':_[_0xeb0a('0x29')](_0x34ce59[_0xeb0a('0x33')],function(_0xef9902){var _0xdf3951={};_0xdf3951[_0xef9902]={'$like':'%'+_0x1d3d6b[_0xeb0a('0x30')][_0xeb0a('0x38')]+'%'};return _0xdf3951;})});}_0x34ce59=_[_0xeb0a('0x3b')]({},_0x34ce59,_0x1d3d6b[_0xeb0a('0x42')]);return _0x1ce87b[_0xeb0a('0x45')](_0x34ce59);}})[_0xeb0a('0x24')](function(_0x395979){if(_0x395979){_0x1b354b=_0x395979[_0xeb0a('0x34')];if(!_0x1d3d6b[_0xeb0a('0x30')]['hasOwnProperty'](_0xeb0a('0x4a'))){_0x34ce59[_0xeb0a('0x1a')]=qs['limit'](_0x1d3d6b[_0xeb0a('0x30')][_0xeb0a('0x1a')]);_0x34ce59[_0xeb0a('0x19')]=qs[_0xeb0a('0x19')](_0x1d3d6b[_0xeb0a('0x30')][_0xeb0a('0x19')]);}return _0x1ce87b[_0xeb0a('0x45')](_0x34ce59);}})[_0xeb0a('0x24')](function(_0x4b86b7){if(_0x4b86b7){return _0x4b86b7?{'count':_0x1b354b,'rows':_0x4b86b7}:null;}})['then'](respondWithResult(_0x4fb7e1,null))[_0xeb0a('0x40')](handleError(_0x4fb7e1,null));};exports[_0xeb0a('0x4b')]=function(_0xe6c340,_0xc4d15f,_0x51a6f3){var _0x284cec={};var _0x45eb6e={};var _0x176cb2;var _0x18e30f;return db[_0xeb0a('0x2a')]['findOne']({'where':{'id':_0xe6c340[_0xeb0a('0x41')]['id']}})[_0xeb0a('0x24')](handleEntityNotFound(_0xc4d15f,null))['then'](function(_0x16d76c){if(_0x16d76c){_0x176cb2=_0x16d76c;_0x45eb6e[_0xeb0a('0x2e')]=_[_0xeb0a('0x2f')](db[_0xeb0a('0x46')][_0xeb0a('0x2b')]);_0x45eb6e['query']=_['keys'](_0xe6c340[_0xeb0a('0x30')]);_0x45eb6e[_0xeb0a('0x47')]=_[_0xeb0a('0x31')](_0x45eb6e[_0xeb0a('0x2e')],_0x45eb6e[_0xeb0a('0x30')]);_0x284cec[_0xeb0a('0x33')]=_[_0xeb0a('0x31')](_0x45eb6e[_0xeb0a('0x2e')],qs[_0xeb0a('0x32')](_0xe6c340[_0xeb0a('0x30')][_0xeb0a('0x32')]));_0x284cec[_0xeb0a('0x33')]=_0x284cec['attributes'][_0xeb0a('0x34')]?_0x284cec[_0xeb0a('0x33')]:_0x45eb6e['model'];_0x284cec[_0xeb0a('0x48')]=qs[_0xeb0a('0x36')](_0xe6c340[_0xeb0a('0x30')]['sort']);_0x284cec[_0xeb0a('0x37')]=qs[_0xeb0a('0x47')](_[_0xeb0a('0x49')](_0xe6c340[_0xeb0a('0x30')],_0x45eb6e[_0xeb0a('0x47')]));if(_0xe6c340[_0xeb0a('0x30')][_0xeb0a('0x38')]){_0x284cec[_0xeb0a('0x37')]=_[_0xeb0a('0x3b')](_0x284cec[_0xeb0a('0x37')],{'$or':_[_0xeb0a('0x29')](_0x284cec[_0xeb0a('0x33')],function(_0x3ec108){var _0x68a71={};_0x68a71[_0x3ec108]={'$like':'%'+_0xe6c340[_0xeb0a('0x30')]['filter']+'%'};return _0x68a71;})});}_0x284cec=_[_0xeb0a('0x3b')]({},_0x284cec,_0xe6c340[_0xeb0a('0x42')]);return _0x176cb2['getSubjects'](_0x284cec);}})[_0xeb0a('0x24')](function(_0x1921b4){if(_0x1921b4){_0x18e30f=_0x1921b4[_0xeb0a('0x34')];if(!_0xe6c340[_0xeb0a('0x30')][_0xeb0a('0x35')](_0xeb0a('0x4a'))){_0x284cec[_0xeb0a('0x1a')]=qs[_0xeb0a('0x1a')](_0xe6c340[_0xeb0a('0x30')][_0xeb0a('0x1a')]);_0x284cec[_0xeb0a('0x19')]=qs['offset'](_0xe6c340[_0xeb0a('0x30')][_0xeb0a('0x19')]);}return _0x176cb2[_0xeb0a('0x4b')](_0x284cec);}})[_0xeb0a('0x24')](function(_0x51e623){if(_0x51e623){return _0x51e623?{'count':_0x18e30f,'rows':_0x51e623}:null;}})[_0xeb0a('0x24')](respondWithResult(_0xc4d15f,null))[_0xeb0a('0x40')](handleError(_0xc4d15f,null));};exports[_0xeb0a('0x4c')]=function(_0x2104cd,_0x3bef6a,_0x987eaa){var _0x3ad9f8={};var _0x42c65d={};var _0x443063;var _0x1bfe74;return db[_0xeb0a('0x2a')]['findOne']({'where':{'id':_0x2104cd['params']['id']}})[_0xeb0a('0x24')](handleEntityNotFound(_0x3bef6a,null))[_0xeb0a('0x24')](function(_0xa6ed13){if(_0xa6ed13){_0x443063=_0xa6ed13;_0x42c65d[_0xeb0a('0x2e')]=_[_0xeb0a('0x2f')](db['FreshdeskField'][_0xeb0a('0x2b')]);_0x42c65d[_0xeb0a('0x30')]=_[_0xeb0a('0x2f')](_0x2104cd['query']);_0x42c65d[_0xeb0a('0x47')]=_[_0xeb0a('0x31')](_0x42c65d[_0xeb0a('0x2e')],_0x42c65d[_0xeb0a('0x30')]);_0x3ad9f8[_0xeb0a('0x33')]=_[_0xeb0a('0x31')](_0x42c65d[_0xeb0a('0x2e')],qs['fields'](_0x2104cd[_0xeb0a('0x30')]['fields']));_0x3ad9f8['attributes']=_0x3ad9f8[_0xeb0a('0x33')]['length']?_0x3ad9f8[_0xeb0a('0x33')]:_0x42c65d[_0xeb0a('0x2e')];_0x3ad9f8[_0xeb0a('0x48')]=qs[_0xeb0a('0x36')](_0x2104cd[_0xeb0a('0x30')][_0xeb0a('0x36')]);_0x3ad9f8[_0xeb0a('0x37')]=qs[_0xeb0a('0x47')](_[_0xeb0a('0x49')](_0x2104cd[_0xeb0a('0x30')],_0x42c65d[_0xeb0a('0x47')]));if(_0x2104cd[_0xeb0a('0x30')][_0xeb0a('0x38')]){_0x3ad9f8['where']=_[_0xeb0a('0x3b')](_0x3ad9f8[_0xeb0a('0x37')],{'$or':_[_0xeb0a('0x29')](_0x3ad9f8[_0xeb0a('0x33')],function(_0x4c25db){var _0x500336={};_0x500336[_0x4c25db]={'$like':'%'+_0x2104cd[_0xeb0a('0x30')][_0xeb0a('0x38')]+'%'};return _0x500336;})});}_0x3ad9f8=_[_0xeb0a('0x3b')]({},_0x3ad9f8,_0x2104cd[_0xeb0a('0x42')]);return _0x443063['getDescriptions'](_0x3ad9f8);}})[_0xeb0a('0x24')](function(_0x3cd24a){if(_0x3cd24a){_0x1bfe74=_0x3cd24a[_0xeb0a('0x34')];if(!_0x2104cd[_0xeb0a('0x30')]['hasOwnProperty'](_0xeb0a('0x4a'))){_0x3ad9f8['limit']=qs['limit'](_0x2104cd[_0xeb0a('0x30')][_0xeb0a('0x1a')]);_0x3ad9f8['offset']=qs[_0xeb0a('0x19')](_0x2104cd[_0xeb0a('0x30')][_0xeb0a('0x19')]);}return _0x443063[_0xeb0a('0x4c')](_0x3ad9f8);}})[_0xeb0a('0x24')](function(_0x2722ee){if(_0x2722ee){return _0x2722ee?{'count':_0x1bfe74,'rows':_0x2722ee}:null;}})['then'](respondWithResult(_0x3bef6a,null))['catch'](handleError(_0x3bef6a,null));};exports[_0xeb0a('0x4d')]=function(_0x82f0e9,_0x227ae6,_0x15f1f7){var _0x1050a1={};var _0x59bcb1={};var _0x2eda48;var _0x49f8c3;return db[_0xeb0a('0x2a')][_0xeb0a('0x4e')]({'where':{'id':_0x82f0e9['params']['id']}})['then'](handleEntityNotFound(_0x227ae6,null))['then'](function(_0x4933c7){if(_0x4933c7){_0x2eda48=_0x4933c7;_0x59bcb1[_0xeb0a('0x2e')]=_['keys'](db['Tag'][_0xeb0a('0x2b')]);_0x59bcb1[_0xeb0a('0x30')]=_[_0xeb0a('0x2f')](_0x82f0e9[_0xeb0a('0x30')]);_0x59bcb1[_0xeb0a('0x47')]=_[_0xeb0a('0x31')](_0x59bcb1[_0xeb0a('0x2e')],_0x59bcb1['query']);_0x1050a1[_0xeb0a('0x33')]=_['intersection'](_0x59bcb1[_0xeb0a('0x2e')],qs[_0xeb0a('0x32')](_0x82f0e9[_0xeb0a('0x30')][_0xeb0a('0x32')]));_0x1050a1[_0xeb0a('0x33')]=_0x1050a1[_0xeb0a('0x33')][_0xeb0a('0x34')]?_0x1050a1[_0xeb0a('0x33')]:_0x59bcb1[_0xeb0a('0x2e')];_0x1050a1[_0xeb0a('0x48')]=qs[_0xeb0a('0x36')](_0x82f0e9['query'][_0xeb0a('0x36')]);_0x1050a1[_0xeb0a('0x37')]=qs['filters'](_[_0xeb0a('0x49')](_0x82f0e9[_0xeb0a('0x30')],_0x59bcb1[_0xeb0a('0x47')]));if(_0x82f0e9[_0xeb0a('0x30')]['filter']){_0x1050a1[_0xeb0a('0x37')]=_['merge'](_0x1050a1[_0xeb0a('0x37')],{'$or':_['map'](_0x1050a1['attributes'],function(_0x468cd5){var _0xb968e4={};_0xb968e4[_0x468cd5]={'$like':'%'+_0x82f0e9[_0xeb0a('0x30')][_0xeb0a('0x38')]+'%'};return _0xb968e4;})});}_0x1050a1=_[_0xeb0a('0x3b')]({},_0x1050a1,_0x82f0e9[_0xeb0a('0x42')]);return _0x2eda48[_0xeb0a('0x4d')](_0x1050a1);}})[_0xeb0a('0x24')](function(_0x1e73ca){if(_0x1e73ca){_0x49f8c3=_0x1e73ca['length'];if(!_0x82f0e9[_0xeb0a('0x30')]['hasOwnProperty'](_0xeb0a('0x4a'))){_0x1050a1[_0xeb0a('0x1a')]=qs[_0xeb0a('0x1a')](_0x82f0e9['query']['limit']);_0x1050a1[_0xeb0a('0x19')]=qs[_0xeb0a('0x19')](_0x82f0e9[_0xeb0a('0x30')][_0xeb0a('0x19')]);}return _0x2eda48['getTags'](_0x1050a1);}})['then'](function(_0x47edeb){if(_0x47edeb){return _0x47edeb?{'count':_0x49f8c3,'rows':_0x47edeb}:null;}})[_0xeb0a('0x24')](respondWithResult(_0x227ae6,null))[_0xeb0a('0x40')](handleError(_0x227ae6,null));};exports[_0xeb0a('0x4f')]=function(_0x35d1a9,_0x1ce193,_0x3061e2){if(_0x35d1a9['body']['id']){delete _0x35d1a9[_0xeb0a('0x44')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x35d1a9[_0xeb0a('0x41')]['id']}})['then'](handleEntityNotFound(_0x1ce193,null))[_0xeb0a('0x24')](function(_0x2dafda){if(_0x2dafda){return _0x2dafda[_0xeb0a('0x4f')](_0x35d1a9[_0xeb0a('0x44')][_0xeb0a('0x50')]||[]);}return null;})[_0xeb0a('0x24')](respondWithResult(_0x1ce193,null))['catch'](handleError(_0x1ce193,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 051a0d9..61454e8 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 _0x144b=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash'];(function(_0x51b19b,_0x5015d2){var _0x1a3cd6=function(_0x495134){while(--_0x495134){_0x51b19b['push'](_0x51b19b['shift']());}};_0x1a3cd6(++_0x5015d2);}(_0x144b,0xb3));var _0xb144=function(_0x4d6d3b,_0x4a8808){_0x4d6d3b=_0x4d6d3b-0x0;var _0x19e62a=_0x144b[_0x4d6d3b];return _0x19e62a;};'use strict';var _=require(_0xb144('0x0'));var util=require(_0xb144('0x1'));var logger=require(_0xb144('0x2'))('api');var moment=require(_0xb144('0x3'));var BPromise=require(_0xb144('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb144('0x5'));var rimraf=require(_0xb144('0x6'));var config=require(_0xb144('0x7'));var attributes=require(_0xb144('0x8'));module[_0xb144('0x9')]=function(_0x5e0692,_0x15d296){return _0x5e0692[_0xb144('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0xb144('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a15=['define','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','moment','request-promise','./intFreshdeskConfiguration.attributes','exports'];(function(_0x543f36,_0x407e1f){var _0x4ca109=function(_0x3621c2){while(--_0x3621c2){_0x543f36['push'](_0x543f36['shift']());}};_0x4ca109(++_0x407e1f);}(_0x6a15,0x111));var _0x56a1=function(_0x46c710,_0x5a3f77){_0x46c710=_0x46c710-0x0;var _0x12cc7e=_0x6a15[_0x46c710];return _0x12cc7e;};'use strict';var _=require('lodash');var util=require(_0x56a1('0x0'));var logger=require(_0x56a1('0x1'))('api');var moment=require(_0x56a1('0x2'));var BPromise=require('bluebird');var rp=require(_0x56a1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x56a1('0x4'));module[_0x56a1('0x5')]=function(_0x4c500d,_0x2df0b5){return _0x4c500d[_0x56a1('0x6')](_0x56a1('0x7'),attributes,{'tableName':_0x56a1('0x8'),'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 7318399..3bc8d43 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 _0x4a06=['result','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4a06,0xf8));var _0x64a0=function(_0x1e71a2,_0x4e1195){_0x1e71a2=_0x1e71a2-0x0;var _0xacf886=_0x4a06[_0x1e71a2];return _0xacf886;};'use strict';var _=require(_0x64a0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64a0('0x1'));var db=require(_0x64a0('0x2'))['db'];var utils=require(_0x64a0('0x3'));var logger=require(_0x64a0('0x4'))(_0x64a0('0x5'));var config=require('../../config/environment');var jayson=require(_0x64a0('0x6'));var client=jayson['client'][_0x64a0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x11e3e3,_0x3fd654,_0x2832c2){return new BPromise(function(_0x3e4316,_0x2bc85b){return client[_0x64a0('0x8')](_0x11e3e3,_0x2832c2)[_0x64a0('0x9')](function(_0x4e0b7d){logger[_0x64a0('0xa')](_0x64a0('0xb'),_0x3fd654,_0x64a0('0xc'));logger[_0x64a0('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3fd654,_0x64a0('0xc'),JSON[_0x64a0('0xe')](_0x4e0b7d));if(_0x4e0b7d[_0x64a0('0xf')]){if(_0x4e0b7d[_0x64a0('0xf')][_0x64a0('0x10')]===0x1f4){logger[_0x64a0('0xf')](_0x64a0('0xb'),_0x3fd654,_0x4e0b7d[_0x64a0('0xf')]['message']);return _0x2bc85b(_0x4e0b7d[_0x64a0('0xf')]['message']);}logger[_0x64a0('0xf')](_0x64a0('0xb'),_0x3fd654,_0x4e0b7d['error'][_0x64a0('0x11')]);return _0x3e4316(_0x4e0b7d['error'][_0x64a0('0x11')]);}else{logger[_0x64a0('0xa')](_0x64a0('0xb'),_0x3fd654,_0x64a0('0xc'));_0x3e4316(_0x4e0b7d[_0x64a0('0x12')][_0x64a0('0x11')]);}})['catch'](function(_0xb93485){logger['error'](_0x64a0('0xb'),_0x3fd654,_0xb93485);_0x2bc85b(_0xb93485);});});} \ No newline at end of file +var _0xc733=['FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request','info'];(function(_0x68b90b,_0xb8b06a){var _0x5220ec=function(_0x226484){while(--_0x226484){_0x68b90b['push'](_0x68b90b['shift']());}};_0x5220ec(++_0xb8b06a);}(_0xc733,0x1d1));var _0x3c73=function(_0x165059,_0x5d5d7d){_0x165059=_0x165059-0x0;var _0x24091f=_0xc733[_0x165059];return _0x24091f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3c73('0x0'));var BPromise=require(_0x3c73('0x1'));var rs=require(_0x3c73('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c73('0x3'))['db'];var utils=require(_0x3c73('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x3c73('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3c73('0x6')][_0x3c73('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x20a3f2,_0x461400,_0x291a02){return new BPromise(function(_0x3fab47,_0x146446){return client[_0x3c73('0x8')](_0x20a3f2,_0x291a02)['then'](function(_0x1c5141){logger[_0x3c73('0x9')](_0x3c73('0xa'),_0x461400,'request\x20sent');logger[_0x3c73('0xb')](_0x3c73('0xc'),_0x461400,_0x3c73('0xd'),JSON['stringify'](_0x1c5141));if(_0x1c5141[_0x3c73('0xe')]){if(_0x1c5141[_0x3c73('0xe')][_0x3c73('0xf')]===0x1f4){logger['error'](_0x3c73('0xa'),_0x461400,_0x1c5141[_0x3c73('0xe')][_0x3c73('0x10')]);return _0x146446(_0x1c5141[_0x3c73('0xe')]['message']);}logger['error'](_0x3c73('0xa'),_0x461400,_0x1c5141['error'][_0x3c73('0x10')]);return _0x3fab47(_0x1c5141['error'][_0x3c73('0x10')]);}else{logger[_0x3c73('0x9')](_0x3c73('0xa'),_0x461400,_0x3c73('0xd'));_0x3fab47(_0x1c5141[_0x3c73('0x11')][_0x3c73('0x10')]);}})[_0x3c73('0x12')](function(_0x32a050){logger['error'](_0x3c73('0xa'),_0x461400,_0x32a050);_0x146446(_0x32a050);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 63fc7ae..afe56ee 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 _0x2b8d=['/:id','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','create'];(function(_0x2fd235,_0x41e51d){var _0x1a40e7=function(_0x2b341f){while(--_0x2b341f){_0x2fd235['push'](_0x2fd235['shift']());}};_0x1a40e7(++_0x41e51d);}(_0x2b8d,0x10c));var _0xd2b8=function(_0x1b8e60,_0x21b885){_0x1b8e60=_0x1b8e60-0x0;var _0x363363=_0x2b8d[_0x1b8e60];return _0x363363;};'use strict';var multer=require(_0xd2b8('0x0'));var util=require(_0xd2b8('0x1'));var path=require(_0xd2b8('0x2'));var timeout=require('connect-timeout');var express=require(_0xd2b8('0x3'));var router=express[_0xd2b8('0x4')]();var fs_extra=require(_0xd2b8('0x5'));var auth=require(_0xd2b8('0x6'));var interaction=require(_0xd2b8('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0xd2b8('0x8')]('/',auth[_0xd2b8('0x9')](),controller[_0xd2b8('0xa')]);router[_0xd2b8('0x8')]('/:id',auth[_0xd2b8('0x9')](),controller['show']);router['post']('/',auth[_0xd2b8('0x9')](),controller[_0xd2b8('0xb')]);router['put'](_0xd2b8('0xc'),auth[_0xd2b8('0x9')](),controller['update']);router['delete'](_0xd2b8('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xd2b8('0xd')]=router; \ No newline at end of file +var _0x6b14=['show','create','put','isAuthenticated','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','index','get','/:id'];(function(_0x4366a6,_0x57fa43){var _0x31f547=function(_0x5c2e40){while(--_0x5c2e40){_0x4366a6['push'](_0x4366a6['shift']());}};_0x31f547(++_0x57fa43);}(_0x6b14,0x97));var _0x46b1=function(_0x210db5,_0x43e85c){_0x210db5=_0x210db5-0x0;var _0x3913e4=_0x6b14[_0x210db5];return _0x3913e4;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x46b1('0x0'));var express=require(_0x46b1('0x1'));var router=express[_0x46b1('0x2')]();var fs_extra=require(_0x46b1('0x3'));var auth=require(_0x46b1('0x4'));var interaction=require(_0x46b1('0x5'));var config=require(_0x46b1('0x6'));var controller=require(_0x46b1('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x46b1('0x8')]);router[_0x46b1('0x9')](_0x46b1('0xa'),auth['isAuthenticated'](),controller[_0x46b1('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x46b1('0xc')]);router[_0x46b1('0xd')](_0x46b1('0xa'),auth[_0x46b1('0xe')](),controller['update']);router[_0x46b1('0xf')](_0x46b1('0xa'),auth[_0x46b1('0xe')](),controller[_0x46b1('0x10')]);module[_0x46b1('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index ba1ef9e..4349790 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 _0x5b4f=['string','STRING','BOOLEAN','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x5e9545,_0x2dd7d){var _0x195d37=function(_0x4050e6){while(--_0x4050e6){_0x5e9545['push'](_0x5e9545['shift']());}};_0x195d37(++_0x2dd7d);}(_0x5b4f,0x1e3));var _0xf5b4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5b4f[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xf5b4('0x0')]('string',_0xf5b4('0x1'),_0xf5b4('0x2'),_0xf5b4('0x3'),_0xf5b4('0x4')),'defaultValue':_0xf5b4('0x5')},'content':{'type':Sequelize[_0xf5b4('0x6')]},'key':{'type':Sequelize[_0xf5b4('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xf5b4('0x1'),_0xf5b4('0x2'))},'keyContent':{'type':Sequelize[_0xf5b4('0x6')]},'idField':{'type':Sequelize[_0xf5b4('0x6')]},'nameField':{'type':Sequelize[_0xf5b4('0x6')]},'customField':{'type':Sequelize[_0xf5b4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf5b4('0x6')]}}; \ No newline at end of file +var _0xb029=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x2f3082,_0x363258){var _0x4a1200=function(_0x3c25c9){while(--_0x3c25c9){_0x2f3082['push'](_0x2f3082['shift']());}};_0x4a1200(++_0x363258);}(_0xb029,0xba));var _0x9b02=function(_0x499f33,_0xc8c3d1){_0x499f33=_0x499f33-0x0;var _0x3c283a=_0xb029[_0x499f33];return _0x3c283a;};'use strict';var Sequelize=require(_0x9b02('0x0'));module[_0x9b02('0x1')]={'type':{'type':Sequelize[_0x9b02('0x2')](_0x9b02('0x3'),_0x9b02('0x4'),_0x9b02('0x5'),_0x9b02('0x6'),'picklist'),'defaultValue':_0x9b02('0x3')},'content':{'type':Sequelize[_0x9b02('0x7')]},'key':{'type':Sequelize[_0x9b02('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x9b02('0x4'),_0x9b02('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9b02('0x7')]},'customField':{'type':Sequelize[_0x9b02('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9b02('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 5cae4d3..a2fc9c3 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 _0xaaa2=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshdeskField','type','key'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xaaa2,0xac));var _0x2aaa=function(_0x131357,_0x3a64f8){_0x131357=_0x131357-0x0;var _0x190014=_0xaaa2[_0x131357];return _0x190014;};'use strict';var emlformat=require(_0x2aaa('0x0'));var rimraf=require(_0x2aaa('0x1'));var zipdir=require(_0x2aaa('0x2'));var jsonpatch=require(_0x2aaa('0x3'));var rp=require(_0x2aaa('0x4'));var moment=require(_0x2aaa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2aaa('0x6'));var util=require('util');var path=require(_0x2aaa('0x7'));var sox=require(_0x2aaa('0x8'));var csv=require(_0x2aaa('0x9'));var ejs=require(_0x2aaa('0xa'));var fs=require('fs');var fs_extra=require(_0x2aaa('0xb'));var _=require(_0x2aaa('0xc'));var squel=require('squel');var crypto=require(_0x2aaa('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2aaa('0x9'));var querystring=require('querystring');var Papa=require(_0x2aaa('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2aaa('0xf'));var as=require(_0x2aaa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2aaa('0x11'))(_0x2aaa('0x12'));var utils=require(_0x2aaa('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2aaa('0x14'));var db=require(_0x2aaa('0x15'))['db'];function respondWithStatusCode(_0x8a5be3,_0x2b51f0){_0x2b51f0=_0x2b51f0||0xcc;return function(_0xd38d6d){if(_0xd38d6d){return _0x8a5be3[_0x2aaa('0x16')](_0x2b51f0);}return _0x8a5be3[_0x2aaa('0x17')](_0x2b51f0)[_0x2aaa('0x18')]();};}function respondWithResult(_0x32dfbf,_0xe22151){_0xe22151=_0xe22151||0xc8;return function(_0x314366){if(_0x314366){return _0x32dfbf[_0x2aaa('0x17')](_0xe22151)['json'](_0x314366);}};}function respondWithFilteredResult(_0x166321,_0x4df56b){return function(_0x35fbc1){if(_0x35fbc1){var _0x1a5573=typeof _0x4df56b['offset']==='undefined'&&typeof _0x4df56b['limit']===_0x2aaa('0x19');var _0x1dc0ba=_0x35fbc1[_0x2aaa('0x1a')];var _0x3b94bf=_0x1a5573?0x0:_0x4df56b[_0x2aaa('0x1b')];var _0xdaa445=_0x1a5573?_0x35fbc1[_0x2aaa('0x1a')]:_0x4df56b['offset']+_0x4df56b[_0x2aaa('0x1c')];var _0x30951c;if(_0xdaa445>=_0x1dc0ba){_0xdaa445=_0x1dc0ba;_0x30951c=0xc8;}else{_0x30951c=0xce;}_0x166321['status'](_0x30951c);return _0x166321[_0x2aaa('0x1d')]('Content-Range',_0x3b94bf+'-'+_0xdaa445+'/'+_0x1dc0ba)['json'](_0x35fbc1);}return null;};}function patchUpdates(_0x1ec32e){return function(_0x5052eb){try{jsonpatch[_0x2aaa('0x1e')](_0x5052eb,_0x1ec32e,!![]);}catch(_0x3e7649){return BPromise[_0x2aaa('0x1f')](_0x3e7649);}return _0x5052eb[_0x2aaa('0x20')]();};}function saveUpdates(_0x2c255f,_0x24da1e){return function(_0x4f581f){if(_0x4f581f){return _0x4f581f[_0x2aaa('0x21')](_0x2c255f)[_0x2aaa('0x22')](function(_0x4836b2){return _0x4836b2;});}return null;};}function removeEntity(_0x4d35aa,_0x19153e){return function(_0x4d7151){if(_0x4d7151){return _0x4d7151[_0x2aaa('0x23')]()[_0x2aaa('0x22')](function(){_0x4d35aa['status'](0xcc)[_0x2aaa('0x18')]();});}};}function handleEntityNotFound(_0x3b99d8,_0x4e1c0f){return function(_0x2ab888){if(!_0x2ab888){_0x3b99d8[_0x2aaa('0x16')](0x194);}return _0x2ab888;};}function handleError(_0x41253c,_0x5371cd){_0x5371cd=_0x5371cd||0x1f4;return function(_0x1f626b){logger[_0x2aaa('0x24')](_0x1f626b['stack']);if(_0x1f626b['name']){delete _0x1f626b[_0x2aaa('0x25')];}_0x41253c[_0x2aaa('0x17')](_0x5371cd)[_0x2aaa('0x26')](_0x1f626b);};}exports[_0x2aaa('0x27')]=function(_0x3a6a63,_0x292297){var _0x2f8305={},_0x166dc0={},_0x12cd47={'count':0x0,'rows':[]};var _0x19472b=_[_0x2aaa('0x28')](db[_0x2aaa('0x29')]['rawAttributes'],function(_0x101b6e){return{'name':_0x101b6e['fieldName'],'type':_0x101b6e[_0x2aaa('0x2a')][_0x2aaa('0x2b')]};});_0x166dc0[_0x2aaa('0x2c')]=_[_0x2aaa('0x28')](_0x19472b,_0x2aaa('0x25'));_0x166dc0[_0x2aaa('0x2d')]=_[_0x2aaa('0x2e')](_0x3a6a63[_0x2aaa('0x2d')]);_0x166dc0[_0x2aaa('0x2f')]=_[_0x2aaa('0x30')](_0x166dc0['model'],_0x166dc0['query']);_0x2f8305['attributes']=_['intersection'](_0x166dc0['model'],qs[_0x2aaa('0x31')](_0x3a6a63[_0x2aaa('0x2d')][_0x2aaa('0x31')]));_0x2f8305[_0x2aaa('0x32')]=_0x2f8305[_0x2aaa('0x32')][_0x2aaa('0x33')]?_0x2f8305[_0x2aaa('0x32')]:_0x166dc0[_0x2aaa('0x2c')];if(!_0x3a6a63['query'][_0x2aaa('0x34')](_0x2aaa('0x35'))){_0x2f8305['limit']=qs[_0x2aaa('0x1c')](_0x3a6a63[_0x2aaa('0x2d')]['limit']);_0x2f8305[_0x2aaa('0x1b')]=qs[_0x2aaa('0x1b')](_0x3a6a63[_0x2aaa('0x2d')][_0x2aaa('0x1b')]);}_0x2f8305[_0x2aaa('0x36')]=qs[_0x2aaa('0x37')](_0x3a6a63[_0x2aaa('0x2d')]['sort']);_0x2f8305['where']=qs[_0x2aaa('0x2f')](_['pick'](_0x3a6a63[_0x2aaa('0x2d')],_0x166dc0[_0x2aaa('0x2f')]),_0x19472b);if(_0x3a6a63['query'][_0x2aaa('0x38')]){_0x2f8305[_0x2aaa('0x39')]=_[_0x2aaa('0x3a')](_0x2f8305['where'],{'$or':_[_0x2aaa('0x28')](_0x19472b,function(_0x337ae8){if(_0x337ae8[_0x2aaa('0x2a')]!==_0x2aaa('0x3b')){var _0x5023d2={};_0x5023d2[_0x337ae8[_0x2aaa('0x25')]]={'$like':'%'+_0x3a6a63[_0x2aaa('0x2d')][_0x2aaa('0x38')]+'%'};return _0x5023d2;}})});}_0x2f8305=_[_0x2aaa('0x3a')]({},_0x2f8305,_0x3a6a63[_0x2aaa('0x3c')]);var _0x362060={'where':_0x2f8305[_0x2aaa('0x39')]};return db[_0x2aaa('0x29')][_0x2aaa('0x1a')](_0x362060)[_0x2aaa('0x22')](function(_0x127f7e){_0x12cd47[_0x2aaa('0x1a')]=_0x127f7e;if(_0x3a6a63[_0x2aaa('0x2d')]['includeAll']){_0x2f8305[_0x2aaa('0x3d')]=[{'all':!![]}];}return db[_0x2aaa('0x29')][_0x2aaa('0x3e')](_0x2f8305);})['then'](function(_0x17042f){_0x12cd47[_0x2aaa('0x3f')]=_0x17042f;return _0x12cd47;})[_0x2aaa('0x22')](respondWithFilteredResult(_0x292297,_0x2f8305))['catch'](handleError(_0x292297,null));};exports[_0x2aaa('0x40')]=function(_0x1bb225,_0x25b932){var _0x4ad537={'raw':!![],'where':{'id':_0x1bb225[_0x2aaa('0x41')]['id']}},_0x57554e={};_0x57554e[_0x2aaa('0x2c')]=_[_0x2aaa('0x2e')](db['FreshdeskField'][_0x2aaa('0x42')]);_0x57554e[_0x2aaa('0x2d')]=_[_0x2aaa('0x2e')](_0x1bb225[_0x2aaa('0x2d')]);_0x57554e[_0x2aaa('0x2f')]=_[_0x2aaa('0x30')](_0x57554e[_0x2aaa('0x2c')],_0x57554e[_0x2aaa('0x2d')]);_0x4ad537['attributes']=_['intersection'](_0x57554e[_0x2aaa('0x2c')],qs['fields'](_0x1bb225[_0x2aaa('0x2d')]['fields']));_0x4ad537['attributes']=_0x4ad537['attributes'][_0x2aaa('0x33')]?_0x4ad537[_0x2aaa('0x32')]:_0x57554e['model'];if(_0x1bb225[_0x2aaa('0x2d')][_0x2aaa('0x43')]){_0x4ad537['include']=[{'all':!![]}];}_0x4ad537=_[_0x2aaa('0x3a')]({},_0x4ad537,_0x1bb225['options']);return db[_0x2aaa('0x29')][_0x2aaa('0x44')](_0x4ad537)['then'](handleEntityNotFound(_0x25b932,null))[_0x2aaa('0x22')](respondWithResult(_0x25b932,null))[_0x2aaa('0x45')](handleError(_0x25b932,null));};exports[_0x2aaa('0x46')]=function(_0x367a63,_0x745414){return db['FreshdeskField']['create'](_0x367a63['body'],{})[_0x2aaa('0x22')](respondWithResult(_0x745414,0xc9))[_0x2aaa('0x45')](handleError(_0x745414,null));};exports[_0x2aaa('0x21')]=function(_0x393073,_0x23290d){if(_0x393073[_0x2aaa('0x47')]['id']){delete _0x393073[_0x2aaa('0x47')]['id'];}return db[_0x2aaa('0x29')][_0x2aaa('0x44')]({'where':{'id':_0x393073['params']['id']}})[_0x2aaa('0x22')](handleEntityNotFound(_0x23290d,null))[_0x2aaa('0x22')](saveUpdates(_0x393073[_0x2aaa('0x47')],null))[_0x2aaa('0x22')](respondWithResult(_0x23290d,null))['catch'](handleError(_0x23290d,null));};exports[_0x2aaa('0x23')]=function(_0xe935c3,_0x3906f8){return db['FreshdeskField']['find']({'where':{'id':_0xe935c3[_0x2aaa('0x41')]['id']}})[_0x2aaa('0x22')](handleEntityNotFound(_0x3906f8,null))[_0x2aaa('0x22')](removeEntity(_0x3906f8,null))[_0x2aaa('0x45')](handleError(_0x3906f8,null));}; \ No newline at end of file +var _0xb921=['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','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','error','stack','name','index','FreshdeskField','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','show','params','include','options','create','body','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x39f734,_0x3be17a){var _0x366597=function(_0x30a9d2){while(--_0x30a9d2){_0x39f734['push'](_0x39f734['shift']());}};_0x366597(++_0x3be17a);}(_0xb921,0x16a));var _0x1b92=function(_0x372f27,_0x1395fc){_0x372f27=_0x372f27-0x0;var _0x12b5f4=_0xb921[_0x372f27];return _0x12b5f4;};'use strict';var emlformat=require(_0x1b92('0x0'));var rimraf=require(_0x1b92('0x1'));var zipdir=require(_0x1b92('0x2'));var jsonpatch=require(_0x1b92('0x3'));var rp=require(_0x1b92('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b92('0x5'));var util=require(_0x1b92('0x6'));var path=require(_0x1b92('0x7'));var sox=require(_0x1b92('0x8'));var csv=require(_0x1b92('0x9'));var ejs=require(_0x1b92('0xa'));var fs=require('fs');var fs_extra=require(_0x1b92('0xb'));var _=require(_0x1b92('0xc'));var squel=require(_0x1b92('0xd'));var crypto=require(_0x1b92('0xe'));var jsforce=require(_0x1b92('0xf'));var deskjs=require(_0x1b92('0x10'));var toCsv=require(_0x1b92('0x9'));var querystring=require(_0x1b92('0x11'));var Papa=require(_0x1b92('0x12'));var Redis=require('ioredis');var authService=require(_0x1b92('0x13'));var qs=require(_0x1b92('0x14'));var as=require(_0x1b92('0x15'));var hardwareService=require(_0x1b92('0x16'));var logger=require(_0x1b92('0x17'))(_0x1b92('0x18'));var utils=require(_0x1b92('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1b92('0x1a'));var db=require(_0x1b92('0x1b'))['db'];function respondWithStatusCode(_0x5a1ca5,_0x81cbe0){_0x81cbe0=_0x81cbe0||0xcc;return function(_0x29a7ed){if(_0x29a7ed){return _0x5a1ca5[_0x1b92('0x1c')](_0x81cbe0);}return _0x5a1ca5[_0x1b92('0x1d')](_0x81cbe0)[_0x1b92('0x1e')]();};}function respondWithResult(_0x290be6,_0x1d33bf){_0x1d33bf=_0x1d33bf||0xc8;return function(_0x4bbb76){if(_0x4bbb76){return _0x290be6[_0x1b92('0x1d')](_0x1d33bf)['json'](_0x4bbb76);}};}function respondWithFilteredResult(_0x1a559b,_0x511a97){return function(_0x694d4f){if(_0x694d4f){var _0x523285=typeof _0x511a97[_0x1b92('0x1f')]===_0x1b92('0x20')&&typeof _0x511a97[_0x1b92('0x21')]==='undefined';var _0x2d171f=_0x694d4f[_0x1b92('0x22')];var _0x289523=_0x523285?0x0:_0x511a97[_0x1b92('0x1f')];var _0x4368dc=_0x523285?_0x694d4f['count']:_0x511a97[_0x1b92('0x1f')]+_0x511a97[_0x1b92('0x21')];var _0x30b0d8;if(_0x4368dc>=_0x2d171f){_0x4368dc=_0x2d171f;_0x30b0d8=0xc8;}else{_0x30b0d8=0xce;}_0x1a559b['status'](_0x30b0d8);return _0x1a559b[_0x1b92('0x23')](_0x1b92('0x24'),_0x289523+'-'+_0x4368dc+'/'+_0x2d171f)[_0x1b92('0x25')](_0x694d4f);}return null;};}function patchUpdates(_0x4bfc51){return function(_0x1d9d28){try{jsonpatch['apply'](_0x1d9d28,_0x4bfc51,!![]);}catch(_0x39ef4e){return BPromise[_0x1b92('0x26')](_0x39ef4e);}return _0x1d9d28['save']();};}function saveUpdates(_0x4ea25f,_0x34c5c9){return function(_0x311487){if(_0x311487){return _0x311487[_0x1b92('0x27')](_0x4ea25f)[_0x1b92('0x28')](function(_0x41fc82){return _0x41fc82;});}return null;};}function removeEntity(_0x186030,_0x48cdf1){return function(_0x3be220){if(_0x3be220){return _0x3be220[_0x1b92('0x29')]()[_0x1b92('0x28')](function(){_0x186030[_0x1b92('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f0e1b,_0x53025e){return function(_0x4369e2){if(!_0x4369e2){_0x3f0e1b[_0x1b92('0x1c')](0x194);}return _0x4369e2;};}function handleError(_0x1abb9a,_0x3c1fa1){_0x3c1fa1=_0x3c1fa1||0x1f4;return function(_0x3e353){logger[_0x1b92('0x2a')](_0x3e353[_0x1b92('0x2b')]);if(_0x3e353[_0x1b92('0x2c')]){delete _0x3e353['name'];}_0x1abb9a['status'](_0x3c1fa1)['send'](_0x3e353);};}exports[_0x1b92('0x2d')]=function(_0x525d05,_0x2c4e02){var _0x5d006b={},_0x462949={},_0x4656aa={'count':0x0,'rows':[]};var _0x26f832=_['map'](db[_0x1b92('0x2e')][_0x1b92('0x2f')],function(_0x55eafd){return{'name':_0x55eafd['fieldName'],'type':_0x55eafd[_0x1b92('0x30')][_0x1b92('0x31')]};});_0x462949[_0x1b92('0x32')]=_[_0x1b92('0x33')](_0x26f832,_0x1b92('0x2c'));_0x462949['query']=_[_0x1b92('0x34')](_0x525d05[_0x1b92('0x35')]);_0x462949[_0x1b92('0x36')]=_[_0x1b92('0x37')](_0x462949[_0x1b92('0x32')],_0x462949[_0x1b92('0x35')]);_0x5d006b[_0x1b92('0x38')]=_['intersection'](_0x462949[_0x1b92('0x32')],qs[_0x1b92('0x39')](_0x525d05['query'][_0x1b92('0x39')]));_0x5d006b[_0x1b92('0x38')]=_0x5d006b[_0x1b92('0x38')]['length']?_0x5d006b[_0x1b92('0x38')]:_0x462949[_0x1b92('0x32')];if(!_0x525d05['query']['hasOwnProperty'](_0x1b92('0x3a'))){_0x5d006b[_0x1b92('0x21')]=qs[_0x1b92('0x21')](_0x525d05[_0x1b92('0x35')]['limit']);_0x5d006b['offset']=qs['offset'](_0x525d05[_0x1b92('0x35')][_0x1b92('0x1f')]);}_0x5d006b[_0x1b92('0x3b')]=qs[_0x1b92('0x3c')](_0x525d05[_0x1b92('0x35')][_0x1b92('0x3c')]);_0x5d006b[_0x1b92('0x3d')]=qs['filters'](_[_0x1b92('0x3e')](_0x525d05[_0x1b92('0x35')],_0x462949['filters']),_0x26f832);if(_0x525d05[_0x1b92('0x35')][_0x1b92('0x3f')]){_0x5d006b[_0x1b92('0x3d')]=_[_0x1b92('0x40')](_0x5d006b[_0x1b92('0x3d')],{'$or':_[_0x1b92('0x33')](_0x26f832,function(_0x115e5f){if(_0x115e5f[_0x1b92('0x30')]!==_0x1b92('0x41')){var _0x14571e={};_0x14571e[_0x115e5f['name']]={'$like':'%'+_0x525d05[_0x1b92('0x35')]['filter']+'%'};return _0x14571e;}})});}_0x5d006b=_[_0x1b92('0x40')]({},_0x5d006b,_0x525d05['options']);var _0x4589fb={'where':_0x5d006b[_0x1b92('0x3d')]};return db[_0x1b92('0x2e')][_0x1b92('0x22')](_0x4589fb)[_0x1b92('0x28')](function(_0x29cda5){_0x4656aa[_0x1b92('0x22')]=_0x29cda5;if(_0x525d05[_0x1b92('0x35')][_0x1b92('0x42')]){_0x5d006b['include']=[{'all':!![]}];}return db[_0x1b92('0x2e')]['findAll'](_0x5d006b);})[_0x1b92('0x28')](function(_0x1e945){_0x4656aa[_0x1b92('0x43')]=_0x1e945;return _0x4656aa;})[_0x1b92('0x28')](respondWithFilteredResult(_0x2c4e02,_0x5d006b))['catch'](handleError(_0x2c4e02,null));};exports[_0x1b92('0x44')]=function(_0xfb5b49,_0x133500){var _0x469a88={'raw':!![],'where':{'id':_0xfb5b49[_0x1b92('0x45')]['id']}},_0xd3f7b0={};_0xd3f7b0['model']=_[_0x1b92('0x34')](db[_0x1b92('0x2e')][_0x1b92('0x2f')]);_0xd3f7b0[_0x1b92('0x35')]=_[_0x1b92('0x34')](_0xfb5b49[_0x1b92('0x35')]);_0xd3f7b0['filters']=_[_0x1b92('0x37')](_0xd3f7b0[_0x1b92('0x32')],_0xd3f7b0['query']);_0x469a88[_0x1b92('0x38')]=_['intersection'](_0xd3f7b0[_0x1b92('0x32')],qs[_0x1b92('0x39')](_0xfb5b49[_0x1b92('0x35')]['fields']));_0x469a88[_0x1b92('0x38')]=_0x469a88[_0x1b92('0x38')]['length']?_0x469a88['attributes']:_0xd3f7b0['model'];if(_0xfb5b49[_0x1b92('0x35')][_0x1b92('0x42')]){_0x469a88[_0x1b92('0x46')]=[{'all':!![]}];}_0x469a88=_[_0x1b92('0x40')]({},_0x469a88,_0xfb5b49[_0x1b92('0x47')]);return db[_0x1b92('0x2e')]['find'](_0x469a88)[_0x1b92('0x28')](handleEntityNotFound(_0x133500,null))[_0x1b92('0x28')](respondWithResult(_0x133500,null))['catch'](handleError(_0x133500,null));};exports[_0x1b92('0x48')]=function(_0x30dbb0,_0x121be9){return db['FreshdeskField'][_0x1b92('0x48')](_0x30dbb0[_0x1b92('0x49')],{})[_0x1b92('0x28')](respondWithResult(_0x121be9,0xc9))[_0x1b92('0x4a')](handleError(_0x121be9,null));};exports[_0x1b92('0x27')]=function(_0x5ac096,_0x142d28){if(_0x5ac096[_0x1b92('0x49')]['id']){delete _0x5ac096[_0x1b92('0x49')]['id'];}return db[_0x1b92('0x2e')][_0x1b92('0x4b')]({'where':{'id':_0x5ac096['params']['id']}})['then'](handleEntityNotFound(_0x142d28,null))[_0x1b92('0x28')](saveUpdates(_0x5ac096[_0x1b92('0x49')],null))[_0x1b92('0x28')](respondWithResult(_0x142d28,null))[_0x1b92('0x4a')](handleError(_0x142d28,null));};exports['destroy']=function(_0x4e0954,_0xfdae28){return db['FreshdeskField'][_0x1b92('0x4b')]({'where':{'id':_0x4e0954[_0x1b92('0x45')]['id']}})[_0x1b92('0x28')](handleEntityNotFound(_0xfdae28,null))['then'](removeEntity(_0xfdae28,null))[_0x1b92('0x4a')](handleError(_0xfdae28,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 64f8b92..641f302 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 _0x0a39=['moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0a39,0xec));var _0x90a3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0a39[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x90a3('0x0'));var util=require(_0x90a3('0x1'));var logger=require(_0x90a3('0x2'))(_0x90a3('0x3'));var moment=require(_0x90a3('0x4'));var BPromise=require('bluebird');var rp=require(_0x90a3('0x5'));var fs=require('fs');var path=require(_0x90a3('0x6'));var rimraf=require(_0x90a3('0x7'));var config=require(_0x90a3('0x8'));var attributes=require(_0x90a3('0x9'));module[_0x90a3('0xa')]=function(_0x339022,_0x2b78ba){return _0x339022[_0x90a3('0xb')](_0x90a3('0xc'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x90a3('0xd'),_0x90a3('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdefc=['./intFreshdeskField.attributes','exports','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x19df6a,_0x55d5d9){var _0x8376d4=function(_0x7a3f59){while(--_0x7a3f59){_0x19df6a['push'](_0x19df6a['shift']());}};_0x8376d4(++_0x55d5d9);}(_0xdefc,0x1b3));var _0xcdef=function(_0x37a06f,_0x4062f7){_0x37a06f=_0x37a06f-0x0;var _0x54b1ca=_0xdefc[_0x37a06f];return _0x54b1ca;};'use strict';var _=require(_0xcdef('0x0'));var util=require(_0xcdef('0x1'));var logger=require(_0xcdef('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcdef('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdef('0x4'));var rimraf=require(_0xcdef('0x5'));var config=require(_0xcdef('0x6'));var attributes=require(_0xcdef('0x7'));module[_0xcdef('0x8')]=function(_0x107383,_0x269261){return _0x107383['define'](_0xcdef('0x9'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xcdef('0xa'),'fields':[_0xcdef('0xb'),_0xcdef('0xc')],'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 ddfd8ba..109bcad 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 _0x7c5a=['randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','FreshdeskField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird'];(function(_0x5bd4cc,_0x41a112){var _0x462dfc=function(_0x442736){while(--_0x442736){_0x5bd4cc['push'](_0x5bd4cc['shift']());}};_0x462dfc(++_0x41a112);}(_0x7c5a,0x123));var _0xa7c5=function(_0x13cf64,_0x596644){_0x13cf64=_0x13cf64-0x0;var _0x14c102=_0x7c5a[_0x13cf64];return _0x14c102;};'use strict';var _=require('lodash');var util=require(_0xa7c5('0x0'));var moment=require(_0xa7c5('0x1'));var BPromise=require(_0xa7c5('0x2'));var rs=require(_0xa7c5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa7c5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7c5('0x5'))('rpc');var config=require(_0xa7c5('0x6'));var jayson=require(_0xa7c5('0x7'));var client=jayson[_0xa7c5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48458e,_0x25ec1d,_0x3cc76d){return new BPromise(function(_0x3d87ee,_0x1fe365){return client[_0xa7c5('0x9')](_0x48458e,_0x3cc76d)[_0xa7c5('0xa')](function(_0xeeb134){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x25ec1d,_0xa7c5('0xb'));logger[_0xa7c5('0xc')](_0xa7c5('0xd'),_0x25ec1d,_0xa7c5('0xb'),JSON['stringify'](_0xeeb134));if(_0xeeb134[_0xa7c5('0xe')]){if(_0xeeb134[_0xa7c5('0xe')][_0xa7c5('0xf')]===0x1f4){logger['error'](_0xa7c5('0x10'),_0x25ec1d,_0xeeb134[_0xa7c5('0xe')]['message']);return _0x1fe365(_0xeeb134['error'][_0xa7c5('0x11')]);}logger[_0xa7c5('0xe')](_0xa7c5('0x10'),_0x25ec1d,_0xeeb134['error'][_0xa7c5('0x11')]);return _0x3d87ee(_0xeeb134[_0xa7c5('0xe')][_0xa7c5('0x11')]);}else{logger[_0xa7c5('0x12')](_0xa7c5('0x10'),_0x25ec1d,_0xa7c5('0xb'));_0x3d87ee(_0xeeb134[_0xa7c5('0x13')][_0xa7c5('0x11')]);}})[_0xa7c5('0x14')](function(_0x555ae4){logger[_0xa7c5('0xe')](_0xa7c5('0x10'),_0x25ec1d,_0x555ae4);_0x1fe365(_0x555ae4);});});} \ No newline at end of file +var _0xef1e=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x20d9d5,_0xc55f88){var _0x48b1c6=function(_0x3afcc5){while(--_0x3afcc5){_0x20d9d5['push'](_0x20d9d5['shift']());}};_0x48b1c6(++_0xc55f88);}(_0xef1e,0x11a));var _0xeef1=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xef1e[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xeef1('0x0'));var util=require(_0xeef1('0x1'));var moment=require(_0xeef1('0x2'));var BPromise=require('bluebird');var rs=require(_0xeef1('0x3'));var fs=require('fs');var Redis=require(_0xeef1('0x4'));var db=require(_0xeef1('0x5'))['db'];var utils=require(_0xeef1('0x6'));var logger=require('../../config/logger')(_0xeef1('0x7'));var config=require(_0xeef1('0x8'));var jayson=require(_0xeef1('0x9'));var client=jayson['client'][_0xeef1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4912e7,_0x4b4c57,_0x4946f5){return new BPromise(function(_0x231f09,_0xf1e4fe){return client['request'](_0x4912e7,_0x4946f5)['then'](function(_0x480a09){logger[_0xeef1('0xb')](_0xeef1('0xc'),_0x4b4c57,_0xeef1('0xd'));logger[_0xeef1('0xe')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x4b4c57,_0xeef1('0xd'),JSON[_0xeef1('0xf')](_0x480a09));if(_0x480a09['error']){if(_0x480a09[_0xeef1('0x10')]['code']===0x1f4){logger[_0xeef1('0x10')](_0xeef1('0xc'),_0x4b4c57,_0x480a09[_0xeef1('0x10')][_0xeef1('0x11')]);return _0xf1e4fe(_0x480a09[_0xeef1('0x10')]['message']);}logger['error'](_0xeef1('0xc'),_0x4b4c57,_0x480a09[_0xeef1('0x10')][_0xeef1('0x11')]);return _0x231f09(_0x480a09[_0xeef1('0x10')]['message']);}else{logger[_0xeef1('0xb')](_0xeef1('0xc'),_0x4b4c57,_0xeef1('0xd'));_0x231f09(_0x480a09[_0xeef1('0x12')][_0xeef1('0x11')]);}})[_0xeef1('0x13')](function(_0x3dd33b){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x4b4c57,_0x3dd33b);_0xf1e4fe(_0x3dd33b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index f0866ce..6da5fd6 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 _0xe5b5=['index','/:id','show','/:id/configurations','getConfigurations','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated'];(function(_0x2209c9,_0x518c20){var _0x8c3095=function(_0x407794){while(--_0x407794){_0x2209c9['push'](_0x2209c9['shift']());}};_0x8c3095(++_0x518c20);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x2eec1f,_0x1b9987){_0x2eec1f=_0x2eec1f-0x0;var _0x543075=_0xe5b5[_0x2eec1f];return _0x543075;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/fields',auth[_0x5e5b('0xc')](),controller['getFields']);router[_0x5e5b('0x12')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router[_0x5e5b('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x5e5b('0x14')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x15')]);router[_0x5e5b('0x16')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller['destroy']);module[_0x5e5b('0x17')]=router; \ No newline at end of file +var _0xb688=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete'];(function(_0x2330e0,_0x58b062){var _0x502f01=function(_0x5b3926){while(--_0x5b3926){_0x2330e0['push'](_0x2330e0['shift']());}};_0x502f01(++_0x58b062);}(_0xb688,0xcf));var _0x8b68=function(_0x308fb9,_0x49fb39){_0x308fb9=_0x308fb9-0x0;var _0x2faac1=_0xb688[_0x308fb9];return _0x2faac1;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x12')]('/',auth[_0x8b68('0xc')](),controller['create']);router[_0x8b68('0x12')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x13')]);router[_0x8b68('0x14')](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 029a4b3..0e64abf 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 _0x7880=['exports','STRING','username','remoteUri'];(function(_0x1c6633,_0x222d86){var _0x499802=function(_0x2bb38c){while(--_0x2bb38c){_0x1c6633['push'](_0x1c6633['shift']());}};_0x499802(++_0x222d86);}(_0x7880,0x1f4));var _0x0788=function(_0x3bceea,_0x58af75){_0x3bceea=_0x3bceea-0x0;var _0x30a8d3=_0x7880[_0x3bceea];return _0x30a8d3;};'use strict';var Sequelize=require('sequelize');module[_0x0788('0x0')]={'name':{'type':Sequelize[_0x0788('0x1')]},'description':{'type':Sequelize[_0x0788('0x1')]},'username':{'type':Sequelize[_0x0788('0x1')],'unique':_0x0788('0x2')},'apiKey':{'type':Sequelize[_0x0788('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x0788('0x3')},'serverUrl':{'type':Sequelize[_0x0788('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x524e=['username','remoteUri','STRING'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x524e,0x15e));var _0xe524=function(_0x113a87,_0x434dd8){_0x113a87=_0x113a87-0x0;var _0x52907c=_0x524e[_0x113a87];return _0x52907c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe524('0x0')]},'description':{'type':Sequelize[_0xe524('0x0')]},'username':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x1')},'apiKey':{'type':Sequelize[_0xe524('0x0')]},'remoteUri':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x2')},'serverUrl':{'type':Sequelize[_0xe524('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index d5c48ef..fa7f154 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 _0x7613=['limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshsalesAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','rawAttributes','fields','length','find','create','body','params','catch','getConfigurations','findOne','FreshsalesConfiguration','order','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset'];(function(_0xf61d36,_0x428a17){var _0xff5b31=function(_0x5ef943){while(--_0x5ef943){_0xf61d36['push'](_0xf61d36['shift']());}};_0xff5b31(++_0x428a17);}(_0x7613,0x191));var _0x3761=function(_0x2dc520,_0x562e06){_0x2dc520=_0x2dc520-0x0;var _0x4e3c28=_0x7613[_0x2dc520];return _0x4e3c28;};'use strict';var emlformat=require(_0x3761('0x0'));var rimraf=require(_0x3761('0x1'));var zipdir=require(_0x3761('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3761('0x3'));var moment=require(_0x3761('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3761('0x5'));var util=require(_0x3761('0x6'));var path=require(_0x3761('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3761('0x8'));var fs=require('fs');var fs_extra=require(_0x3761('0x9'));var _=require(_0x3761('0xa'));var squel=require(_0x3761('0xb'));var crypto=require(_0x3761('0xc'));var jsforce=require(_0x3761('0xd'));var deskjs=require(_0x3761('0xe'));var toCsv=require(_0x3761('0xf'));var querystring=require(_0x3761('0x10'));var Papa=require('papaparse');var Redis=require(_0x3761('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3761('0x12'));var as=require(_0x3761('0x13'));var hardwareService=require(_0x3761('0x14'));var logger=require(_0x3761('0x15'))(_0x3761('0x16'));var utils=require(_0x3761('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3761('0x18'));var db=require(_0x3761('0x19'))['db'];var integrations=require(_0x3761('0x1a'));function respondWithStatusCode(_0x2b6725,_0x434e58){_0x434e58=_0x434e58||0xcc;return function(_0x3a9b5b){if(_0x3a9b5b){return _0x2b6725['sendStatus'](_0x434e58);}return _0x2b6725[_0x3761('0x1b')](_0x434e58)[_0x3761('0x1c')]();};}function respondWithResult(_0x4123bf,_0xdccd9){_0xdccd9=_0xdccd9||0xc8;return function(_0x522c07){if(_0x522c07){return _0x4123bf[_0x3761('0x1b')](_0xdccd9)[_0x3761('0x1d')](_0x522c07);}};}function respondWithFilteredResult(_0x427dfe,_0x1b6c34){return function(_0x589eae){if(_0x589eae){var _0x3bda9d=typeof _0x1b6c34[_0x3761('0x1e')]==='undefined'&&typeof _0x1b6c34[_0x3761('0x1f')]===_0x3761('0x20');var _0x102eb7=_0x589eae['count'];var _0x5c8ec9=_0x3bda9d?0x0:_0x1b6c34[_0x3761('0x1e')];var _0x5bb96d=_0x3bda9d?_0x589eae[_0x3761('0x21')]:_0x1b6c34[_0x3761('0x1e')]+_0x1b6c34[_0x3761('0x1f')];var _0x89eea7;if(_0x5bb96d>=_0x102eb7){_0x5bb96d=_0x102eb7;_0x89eea7=0xc8;}else{_0x89eea7=0xce;}_0x427dfe[_0x3761('0x1b')](_0x89eea7);return _0x427dfe[_0x3761('0x22')](_0x3761('0x23'),_0x5c8ec9+'-'+_0x5bb96d+'/'+_0x102eb7)[_0x3761('0x1d')](_0x589eae);}return null;};}function patchUpdates(_0x418572){return function(_0x16ba63){try{jsonpatch[_0x3761('0x24')](_0x16ba63,_0x418572,!![]);}catch(_0x5d39ed){return BPromise['reject'](_0x5d39ed);}return _0x16ba63[_0x3761('0x25')]();};}function saveUpdates(_0x3f7d93,_0x1224d7){return function(_0x4a775f){if(_0x4a775f){return _0x4a775f[_0x3761('0x26')](_0x3f7d93)[_0x3761('0x27')](function(_0x14f863){return _0x14f863;});}return null;};}function removeEntity(_0x2c92e8,_0x57b4f4){return function(_0x1288e9){if(_0x1288e9){return _0x1288e9[_0x3761('0x28')]()['then'](function(){_0x2c92e8['status'](0xcc)[_0x3761('0x1c')]();});}};}function handleEntityNotFound(_0x1e4ad6,_0x176521){return function(_0x47dbd3){if(!_0x47dbd3){_0x1e4ad6[_0x3761('0x29')](0x194);}return _0x47dbd3;};}function handleError(_0x824042,_0x494a14){_0x494a14=_0x494a14||0x1f4;return function(_0x4f2110){logger[_0x3761('0x2a')](_0x4f2110[_0x3761('0x2b')]);if(_0x4f2110[_0x3761('0x2c')]){delete _0x4f2110['name'];}_0x824042[_0x3761('0x1b')](_0x494a14)[_0x3761('0x2d')](_0x4f2110);};}exports[_0x3761('0x2e')]=function(_0x598904,_0x230b68){var _0x13a6b8={},_0x21785d={},_0x2282d6={'count':0x0,'rows':[]};var _0x8e3de6=_[_0x3761('0x2f')](db[_0x3761('0x30')]['rawAttributes'],function(_0x4be8d5){return{'name':_0x4be8d5[_0x3761('0x31')],'type':_0x4be8d5[_0x3761('0x32')][_0x3761('0x33')]};});_0x21785d[_0x3761('0x34')]=_[_0x3761('0x2f')](_0x8e3de6,_0x3761('0x2c'));_0x21785d[_0x3761('0x35')]=_[_0x3761('0x36')](_0x598904[_0x3761('0x35')]);_0x21785d[_0x3761('0x37')]=_[_0x3761('0x38')](_0x21785d[_0x3761('0x34')],_0x21785d['query']);_0x13a6b8[_0x3761('0x39')]=_['intersection'](_0x21785d['model'],qs['fields'](_0x598904[_0x3761('0x35')]['fields']));_0x13a6b8[_0x3761('0x39')]=_0x13a6b8[_0x3761('0x39')]['length']?_0x13a6b8[_0x3761('0x39')]:_0x21785d[_0x3761('0x34')];if(!_0x598904[_0x3761('0x35')][_0x3761('0x3a')](_0x3761('0x3b'))){_0x13a6b8[_0x3761('0x1f')]=qs[_0x3761('0x1f')](_0x598904[_0x3761('0x35')][_0x3761('0x1f')]);_0x13a6b8[_0x3761('0x1e')]=qs[_0x3761('0x1e')](_0x598904[_0x3761('0x35')][_0x3761('0x1e')]);}_0x13a6b8['order']=qs[_0x3761('0x3c')](_0x598904['query'][_0x3761('0x3c')]);_0x13a6b8['where']=qs[_0x3761('0x37')](_[_0x3761('0x3d')](_0x598904['query'],_0x21785d[_0x3761('0x37')]),_0x8e3de6);if(_0x598904[_0x3761('0x35')][_0x3761('0x3e')]){_0x13a6b8[_0x3761('0x3f')]=_[_0x3761('0x40')](_0x13a6b8[_0x3761('0x3f')],{'$or':_['map'](_0x8e3de6,function(_0x16f94c){if(_0x16f94c[_0x3761('0x32')]!==_0x3761('0x41')){var _0x105a63={};_0x105a63[_0x16f94c[_0x3761('0x2c')]]={'$like':'%'+_0x598904[_0x3761('0x35')][_0x3761('0x3e')]+'%'};return _0x105a63;}})});}_0x13a6b8=_[_0x3761('0x40')]({},_0x13a6b8,_0x598904[_0x3761('0x42')]);var _0x3b872d={'where':_0x13a6b8[_0x3761('0x3f')]};return db[_0x3761('0x30')]['count'](_0x3b872d)[_0x3761('0x27')](function(_0x55e2a1){_0x2282d6[_0x3761('0x21')]=_0x55e2a1;if(_0x598904[_0x3761('0x35')][_0x3761('0x43')]){_0x13a6b8[_0x3761('0x44')]=[{'all':!![]}];}return db[_0x3761('0x30')]['findAll'](_0x13a6b8);})[_0x3761('0x27')](function(_0x4f5174){_0x2282d6[_0x3761('0x45')]=_0x4f5174;return _0x2282d6;})[_0x3761('0x27')](respondWithFilteredResult(_0x230b68,_0x13a6b8))['catch'](handleError(_0x230b68,null));};exports['show']=function(_0x10a575,_0x912ef1){var _0x425439={'raw':![],'where':{'id':_0x10a575['params']['id']}},_0x4dec6a={};_0x4dec6a[_0x3761('0x34')]=_[_0x3761('0x36')](db['FreshsalesAccount'][_0x3761('0x46')]);_0x4dec6a[_0x3761('0x35')]=_['keys'](_0x10a575[_0x3761('0x35')]);_0x4dec6a[_0x3761('0x37')]=_[_0x3761('0x38')](_0x4dec6a['model'],_0x4dec6a[_0x3761('0x35')]);_0x425439[_0x3761('0x39')]=_[_0x3761('0x38')](_0x4dec6a['model'],qs[_0x3761('0x47')](_0x10a575[_0x3761('0x35')]['fields']));_0x425439['attributes']=_0x425439[_0x3761('0x39')][_0x3761('0x48')]?_0x425439[_0x3761('0x39')]:_0x4dec6a[_0x3761('0x34')];if(_0x10a575[_0x3761('0x35')][_0x3761('0x43')]){_0x425439['include']=[{'all':!![]}];}_0x425439=_['merge']({},_0x425439,_0x10a575['options']);return db['FreshsalesAccount'][_0x3761('0x49')](_0x425439)[_0x3761('0x27')](handleEntityNotFound(_0x912ef1,null))[_0x3761('0x27')](respondWithResult(_0x912ef1,null))['catch'](handleError(_0x912ef1,null));};exports[_0x3761('0x4a')]=function(_0x59d885,_0x370341){return db['FreshsalesAccount'][_0x3761('0x4a')](_0x59d885[_0x3761('0x4b')],{})[_0x3761('0x27')](respondWithResult(_0x370341,0xc9))['catch'](handleError(_0x370341,null));};exports['update']=function(_0x401300,_0x1a4dca){if(_0x401300[_0x3761('0x4b')]['id']){delete _0x401300['body']['id'];}return db['FreshsalesAccount'][_0x3761('0x49')]({'where':{'id':_0x401300[_0x3761('0x4c')]['id']}})[_0x3761('0x27')](handleEntityNotFound(_0x1a4dca,null))[_0x3761('0x27')](saveUpdates(_0x401300[_0x3761('0x4b')],null))[_0x3761('0x27')](respondWithResult(_0x1a4dca,null))[_0x3761('0x4d')](handleError(_0x1a4dca,null));};exports[_0x3761('0x28')]=function(_0x252a2d,_0x4009e6){return db[_0x3761('0x30')][_0x3761('0x49')]({'where':{'id':_0x252a2d[_0x3761('0x4c')]['id']}})[_0x3761('0x27')](handleEntityNotFound(_0x4009e6,null))[_0x3761('0x27')](removeEntity(_0x4009e6,null))[_0x3761('0x4d')](handleError(_0x4009e6,null));};exports[_0x3761('0x4e')]=function(_0x356aca,_0x15bad8,_0x3f287b){var _0x1f35e={};var _0x44d301={};var _0x14a765;var _0xc1ff2f;return db['FreshsalesAccount'][_0x3761('0x4f')]({'where':{'id':_0x356aca[_0x3761('0x4c')]['id']}})['then'](handleEntityNotFound(_0x15bad8,null))[_0x3761('0x27')](function(_0x46fe1e){if(_0x46fe1e){_0x14a765=_0x46fe1e;_0x44d301[_0x3761('0x34')]=_[_0x3761('0x36')](db[_0x3761('0x50')][_0x3761('0x46')]);_0x44d301[_0x3761('0x35')]=_[_0x3761('0x36')](_0x356aca[_0x3761('0x35')]);_0x44d301[_0x3761('0x37')]=_['intersection'](_0x44d301['model'],_0x44d301[_0x3761('0x35')]);_0x1f35e[_0x3761('0x39')]=_['intersection'](_0x44d301[_0x3761('0x34')],qs['fields'](_0x356aca[_0x3761('0x35')]['fields']));_0x1f35e[_0x3761('0x39')]=_0x1f35e[_0x3761('0x39')][_0x3761('0x48')]?_0x1f35e[_0x3761('0x39')]:_0x44d301[_0x3761('0x34')];_0x1f35e[_0x3761('0x51')]=qs[_0x3761('0x3c')](_0x356aca[_0x3761('0x35')][_0x3761('0x3c')]);_0x1f35e['where']=qs[_0x3761('0x37')](_['pick'](_0x356aca[_0x3761('0x35')],_0x44d301[_0x3761('0x37')]));if(_0x356aca[_0x3761('0x35')][_0x3761('0x3e')]){_0x1f35e[_0x3761('0x3f')]=_[_0x3761('0x40')](_0x1f35e[_0x3761('0x3f')],{'$or':_['map'](_0x1f35e['attributes'],function(_0x1e675d){var _0x2cd440={};_0x2cd440[_0x1e675d]={'$like':'%'+_0x356aca['query'][_0x3761('0x3e')]+'%'};return _0x2cd440;})});}_0x1f35e=_[_0x3761('0x40')]({},_0x1f35e,_0x356aca[_0x3761('0x42')]);return _0x14a765[_0x3761('0x4e')](_0x1f35e);}})['then'](function(_0x2ada5e){if(_0x2ada5e){_0xc1ff2f=_0x2ada5e[_0x3761('0x48')];if(!_0x356aca['query']['hasOwnProperty'](_0x3761('0x3b'))){_0x1f35e['limit']=qs[_0x3761('0x1f')](_0x356aca[_0x3761('0x35')][_0x3761('0x1f')]);_0x1f35e[_0x3761('0x1e')]=qs['offset'](_0x356aca[_0x3761('0x35')][_0x3761('0x1e')]);}return _0x14a765['getConfigurations'](_0x1f35e);}})[_0x3761('0x27')](function(_0x4e523){if(_0x4e523){return _0x4e523?{'count':_0xc1ff2f,'rows':_0x4e523}:null;}})[_0x3761('0x27')](respondWithResult(_0x15bad8,null))[_0x3761('0x4d')](handleError(_0x15bad8,null));};exports[_0x3761('0x52')]=function(_0x20ba3b,_0x2cd5ea,_0x21c199){if(_0x20ba3b[_0x3761('0x4b')]['id']){delete _0x20ba3b[_0x3761('0x4b')]['id'];}return db[_0x3761('0x30')][_0x3761('0x4f')]({'where':{'id':_0x20ba3b[_0x3761('0x4c')]['id']}})[_0x3761('0x27')](handleEntityNotFound(_0x2cd5ea,null))['then'](function(_0x482833){if(_0x482833){_0x20ba3b['body']['AccountId']=_0x482833['id'];_0x20ba3b[_0x3761('0x4b')][_0x3761('0x53')]=integrations[_0x3761('0x54')](_0x20ba3b[_0x3761('0x4b')]['channel'],_0x20ba3b[_0x3761('0x4b')][_0x3761('0x32')]);_0x20ba3b[_0x3761('0x4b')][_0x3761('0x55')]=integrations[_0x3761('0x56')](_0x20ba3b[_0x3761('0x4b')][_0x3761('0x57')],_0x20ba3b['body']['type']);return db[_0x3761('0x50')][_0x3761('0x4a')](_0x20ba3b['body'],{'include':[{'model':db[_0x3761('0x58')],'as':_0x3761('0x53')},{'model':db['FreshsalesField'],'as':_0x3761('0x55')}]});}return null;})[_0x3761('0x27')](respondWithResult(_0x2cd5ea,null))['catch'](handleError(_0x2cd5ea,null));};exports['getFields']=function(_0x5dc269,_0x5d4e35,_0x3fa882){var _0x3d63fb='';var _0x4cbab7='';return db[_0x3761('0x30')]['findOne']({'where':{'id':_0x5dc269[_0x3761('0x4c')]['id']},'attributes':['id',_0x3761('0x59'),'remoteUri',_0x3761('0x5a')]})['then'](handleEntityNotFound(_0x5d4e35,null))[_0x3761('0x27')](function(_0x1b28ad){if(_0x1b28ad){_0x4cbab7=_0x1b28ad[_0x3761('0x59')];_0x3d63fb=_0x1b28ad[_0x3761('0x5b')];var _0x540b81=_0x1b28ad[_0x3761('0x5b')][_0x3761('0x5c')](-0x1);if(_0x540b81==='/'){_0x3d63fb=_0x3d63fb[_0x3761('0x5d')](0x0,_0x3d63fb[_0x3761('0x5e')](_0x540b81));}return rp({'method':_0x3761('0x5f'),'uri':util[_0x3761('0x60')](_0x3761('0x61'),_0x3d63fb,_0x3761('0x62')),'headers':{'Authorization':'Token\x20token='+_0x1b28ad['apiKey']},'json':!![]});}})['then'](function(_0x3fecb8){if(_0x3fecb8){var _0x4d0434=_0x3fecb8[_0x3761('0x63')];var _0x2b170f=![];var _0x271aee=null;for(_0x271aee=0x0;_0x271aee<_0x4d0434[_0x3761('0x48')];_0x271aee++){if(_0x4d0434[_0x271aee][_0x3761('0x64')]===_0x4cbab7){_0x2b170f=!![];}}if(_0x2b170f){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3761('0x65')});}}})[_0x3761('0x27')](respondWithResult(_0x5d4e35,null))[_0x3761('0x4d')](function(_0x4baf64){var _0x9dbd69=_0x5dc269[_0x3761('0x35')][_0x3761('0x66')]?0x1f4:_0x4baf64[_0x3761('0x67')]||0x1f4;logger[_0x3761('0x2a')](_0x3761('0x68'),_0x3761('0x69'),_0x9dbd69,JSON[_0x3761('0x6a')](_0x4baf64));delete _0x4baf64['name'];if(_0x9dbd69===0x191){_0x9dbd69=0x190;}_0x5d4e35[_0x3761('0x1b')](_0x9dbd69)['send'](_0x5dc269[_0x3761('0x35')][_0x3761('0x66')]?{'message':_0x3761('0x6b'),'statusCode':_0x4baf64['statusCode']}:_0x4baf64);});}; \ No newline at end of file +var _0x1405=['Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','statusCode','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','then','end','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','includeAll','include','FreshsalesAccount','rows','show','params','options','find','create','body','catch','update','destroy','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','length','email'];(function(_0x36cff7,_0x5cb048){var _0x21c697=function(_0x1aab10){while(--_0x1aab10){_0x36cff7['push'](_0x36cff7['shift']());}};_0x21c697(++_0x5cb048);}(_0x1405,0xda));var _0x5140=function(_0x1790ae,_0x162478){_0x1790ae=_0x1790ae-0x0;var _0x326cce=_0x1405[_0x1790ae];return _0x326cce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5140('0x0'));var zipdir=require(_0x5140('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5140('0x2'));var BPromise=require(_0x5140('0x3'));var Mustache=require(_0x5140('0x4'));var util=require(_0x5140('0x5'));var path=require(_0x5140('0x6'));var sox=require('sox');var csv=require(_0x5140('0x7'));var ejs=require(_0x5140('0x8'));var fs=require('fs');var fs_extra=require(_0x5140('0x9'));var _=require(_0x5140('0xa'));var squel=require(_0x5140('0xb'));var crypto=require(_0x5140('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5140('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5140('0xe'));var authService=require(_0x5140('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5140('0x10'));var hardwareService=require(_0x5140('0x11'));var logger=require(_0x5140('0x12'))(_0x5140('0x13'));var utils=require(_0x5140('0x14'));var config=require(_0x5140('0x15'));var licenseUtil=require(_0x5140('0x16'));var db=require(_0x5140('0x17'))['db'];var integrations=require(_0x5140('0x18'));function respondWithStatusCode(_0x5cb427,_0x396696){_0x396696=_0x396696||0xcc;return function(_0x5207cb){if(_0x5207cb){return _0x5cb427[_0x5140('0x19')](_0x396696);}return _0x5cb427[_0x5140('0x1a')](_0x396696)['end']();};}function respondWithResult(_0x525657,_0x23b1b5){_0x23b1b5=_0x23b1b5||0xc8;return function(_0x48e375){if(_0x48e375){return _0x525657[_0x5140('0x1a')](_0x23b1b5)[_0x5140('0x1b')](_0x48e375);}};}function respondWithFilteredResult(_0x3a0f49,_0xdd61de){return function(_0x109dec){if(_0x109dec){var _0x5ee6a9=typeof _0xdd61de['offset']===_0x5140('0x1c')&&typeof _0xdd61de[_0x5140('0x1d')]===_0x5140('0x1c');var _0x4894fd=_0x109dec[_0x5140('0x1e')];var _0x3e9922=_0x5ee6a9?0x0:_0xdd61de[_0x5140('0x1f')];var _0x4857cd=_0x5ee6a9?_0x109dec[_0x5140('0x1e')]:_0xdd61de[_0x5140('0x1f')]+_0xdd61de[_0x5140('0x1d')];var _0x27f730;if(_0x4857cd>=_0x4894fd){_0x4857cd=_0x4894fd;_0x27f730=0xc8;}else{_0x27f730=0xce;}_0x3a0f49[_0x5140('0x1a')](_0x27f730);return _0x3a0f49[_0x5140('0x20')]('Content-Range',_0x3e9922+'-'+_0x4857cd+'/'+_0x4894fd)[_0x5140('0x1b')](_0x109dec);}return null;};}function patchUpdates(_0x424129){return function(_0x33806e){try{jsonpatch[_0x5140('0x21')](_0x33806e,_0x424129,!![]);}catch(_0x181a82){return BPromise[_0x5140('0x22')](_0x181a82);}return _0x33806e[_0x5140('0x23')]();};}function saveUpdates(_0x3a1636,_0x5ea016){return function(_0x50618e){if(_0x50618e){return _0x50618e['update'](_0x3a1636)['then'](function(_0x43f613){return _0x43f613;});}return null;};}function removeEntity(_0x2c9683,_0x4c5ee9){return function(_0x1f8713){if(_0x1f8713){return _0x1f8713['destroy']()[_0x5140('0x24')](function(){_0x2c9683['status'](0xcc)[_0x5140('0x25')]();});}};}function handleEntityNotFound(_0x483d17,_0x39e3f1){return function(_0x24562b){if(!_0x24562b){_0x483d17[_0x5140('0x19')](0x194);}return _0x24562b;};}function handleError(_0x424ec4,_0x367af7){_0x367af7=_0x367af7||0x1f4;return function(_0x23d628){logger[_0x5140('0x26')](_0x23d628['stack']);if(_0x23d628[_0x5140('0x27')]){delete _0x23d628[_0x5140('0x27')];}_0x424ec4[_0x5140('0x1a')](_0x367af7)[_0x5140('0x28')](_0x23d628);};}exports[_0x5140('0x29')]=function(_0x3b0f8a,_0x3537f6){var _0x5a16eb={},_0x15b298={},_0x30215b={'count':0x0,'rows':[]};var _0x55e1a0=_[_0x5140('0x2a')](db['FreshsalesAccount'][_0x5140('0x2b')],function(_0x5a1509){return{'name':_0x5a1509[_0x5140('0x2c')],'type':_0x5a1509['type'][_0x5140('0x2d')]};});_0x15b298[_0x5140('0x2e')]=_[_0x5140('0x2a')](_0x55e1a0,_0x5140('0x27'));_0x15b298[_0x5140('0x2f')]=_[_0x5140('0x30')](_0x3b0f8a['query']);_0x15b298[_0x5140('0x31')]=_['intersection'](_0x15b298[_0x5140('0x2e')],_0x15b298[_0x5140('0x2f')]);_0x5a16eb['attributes']=_[_0x5140('0x32')](_0x15b298[_0x5140('0x2e')],qs['fields'](_0x3b0f8a[_0x5140('0x2f')][_0x5140('0x33')]));_0x5a16eb[_0x5140('0x34')]=_0x5a16eb[_0x5140('0x34')]['length']?_0x5a16eb['attributes']:_0x15b298[_0x5140('0x2e')];if(!_0x3b0f8a[_0x5140('0x2f')][_0x5140('0x35')](_0x5140('0x36'))){_0x5a16eb[_0x5140('0x1d')]=qs['limit'](_0x3b0f8a[_0x5140('0x2f')][_0x5140('0x1d')]);_0x5a16eb[_0x5140('0x1f')]=qs[_0x5140('0x1f')](_0x3b0f8a[_0x5140('0x2f')]['offset']);}_0x5a16eb[_0x5140('0x37')]=qs['sort'](_0x3b0f8a[_0x5140('0x2f')][_0x5140('0x38')]);_0x5a16eb['where']=qs[_0x5140('0x31')](_[_0x5140('0x39')](_0x3b0f8a[_0x5140('0x2f')],_0x15b298[_0x5140('0x31')]),_0x55e1a0);if(_0x3b0f8a['query'][_0x5140('0x3a')]){_0x5a16eb[_0x5140('0x3b')]=_[_0x5140('0x3c')](_0x5a16eb[_0x5140('0x3b')],{'$or':_[_0x5140('0x2a')](_0x55e1a0,function(_0x128ca3){if(_0x128ca3[_0x5140('0x3d')]!=='VIRTUAL'){var _0x2e0853={};_0x2e0853[_0x128ca3[_0x5140('0x27')]]={'$like':'%'+_0x3b0f8a[_0x5140('0x2f')][_0x5140('0x3a')]+'%'};return _0x2e0853;}})});}_0x5a16eb=_['merge']({},_0x5a16eb,_0x3b0f8a['options']);var _0x40cce4={'where':_0x5a16eb[_0x5140('0x3b')]};return db['FreshsalesAccount']['count'](_0x40cce4)[_0x5140('0x24')](function(_0x184690){_0x30215b[_0x5140('0x1e')]=_0x184690;if(_0x3b0f8a[_0x5140('0x2f')][_0x5140('0x3e')]){_0x5a16eb[_0x5140('0x3f')]=[{'all':!![]}];}return db[_0x5140('0x40')]['findAll'](_0x5a16eb);})[_0x5140('0x24')](function(_0x25517f){_0x30215b[_0x5140('0x41')]=_0x25517f;return _0x30215b;})[_0x5140('0x24')](respondWithFilteredResult(_0x3537f6,_0x5a16eb))['catch'](handleError(_0x3537f6,null));};exports[_0x5140('0x42')]=function(_0x5e87aa,_0x146d0){var _0x39f750={'raw':![],'where':{'id':_0x5e87aa[_0x5140('0x43')]['id']}},_0xd66eac={};_0xd66eac[_0x5140('0x2e')]=_[_0x5140('0x30')](db['FreshsalesAccount'][_0x5140('0x2b')]);_0xd66eac[_0x5140('0x2f')]=_[_0x5140('0x30')](_0x5e87aa['query']);_0xd66eac[_0x5140('0x31')]=_[_0x5140('0x32')](_0xd66eac['model'],_0xd66eac[_0x5140('0x2f')]);_0x39f750['attributes']=_[_0x5140('0x32')](_0xd66eac[_0x5140('0x2e')],qs['fields'](_0x5e87aa['query'][_0x5140('0x33')]));_0x39f750[_0x5140('0x34')]=_0x39f750[_0x5140('0x34')]['length']?_0x39f750[_0x5140('0x34')]:_0xd66eac[_0x5140('0x2e')];if(_0x5e87aa['query'][_0x5140('0x3e')]){_0x39f750[_0x5140('0x3f')]=[{'all':!![]}];}_0x39f750=_[_0x5140('0x3c')]({},_0x39f750,_0x5e87aa[_0x5140('0x44')]);return db['FreshsalesAccount'][_0x5140('0x45')](_0x39f750)['then'](handleEntityNotFound(_0x146d0,null))[_0x5140('0x24')](respondWithResult(_0x146d0,null))['catch'](handleError(_0x146d0,null));};exports[_0x5140('0x46')]=function(_0x4dfbe0,_0x5e3174){return db[_0x5140('0x40')]['create'](_0x4dfbe0[_0x5140('0x47')],{})[_0x5140('0x24')](respondWithResult(_0x5e3174,0xc9))[_0x5140('0x48')](handleError(_0x5e3174,null));};exports[_0x5140('0x49')]=function(_0x5d1a06,_0x13685d){if(_0x5d1a06[_0x5140('0x47')]['id']){delete _0x5d1a06[_0x5140('0x47')]['id'];}return db[_0x5140('0x40')][_0x5140('0x45')]({'where':{'id':_0x5d1a06[_0x5140('0x43')]['id']}})[_0x5140('0x24')](handleEntityNotFound(_0x13685d,null))[_0x5140('0x24')](saveUpdates(_0x5d1a06[_0x5140('0x47')],null))[_0x5140('0x24')](respondWithResult(_0x13685d,null))[_0x5140('0x48')](handleError(_0x13685d,null));};exports[_0x5140('0x4a')]=function(_0x3a381b,_0x339114){return db[_0x5140('0x40')][_0x5140('0x45')]({'where':{'id':_0x3a381b[_0x5140('0x43')]['id']}})[_0x5140('0x24')](handleEntityNotFound(_0x339114,null))['then'](removeEntity(_0x339114,null))[_0x5140('0x48')](handleError(_0x339114,null));};exports[_0x5140('0x4b')]=function(_0xd864c8,_0x20881f,_0x25c163){var _0x130acc={};var _0x285ef4={};var _0x337f98;var _0x24e4f7;return db[_0x5140('0x40')][_0x5140('0x4c')]({'where':{'id':_0xd864c8['params']['id']}})[_0x5140('0x24')](handleEntityNotFound(_0x20881f,null))[_0x5140('0x24')](function(_0x4ec0bc){if(_0x4ec0bc){_0x337f98=_0x4ec0bc;_0x285ef4[_0x5140('0x2e')]=_['keys'](db[_0x5140('0x4d')][_0x5140('0x2b')]);_0x285ef4[_0x5140('0x2f')]=_[_0x5140('0x30')](_0xd864c8['query']);_0x285ef4[_0x5140('0x31')]=_[_0x5140('0x32')](_0x285ef4[_0x5140('0x2e')],_0x285ef4[_0x5140('0x2f')]);_0x130acc['attributes']=_[_0x5140('0x32')](_0x285ef4['model'],qs[_0x5140('0x33')](_0xd864c8[_0x5140('0x2f')][_0x5140('0x33')]));_0x130acc[_0x5140('0x34')]=_0x130acc['attributes']['length']?_0x130acc[_0x5140('0x34')]:_0x285ef4[_0x5140('0x2e')];_0x130acc[_0x5140('0x37')]=qs[_0x5140('0x38')](_0xd864c8[_0x5140('0x2f')][_0x5140('0x38')]);_0x130acc[_0x5140('0x3b')]=qs[_0x5140('0x31')](_[_0x5140('0x39')](_0xd864c8[_0x5140('0x2f')],_0x285ef4[_0x5140('0x31')]));if(_0xd864c8['query']['filter']){_0x130acc['where']=_[_0x5140('0x3c')](_0x130acc['where'],{'$or':_[_0x5140('0x2a')](_0x130acc[_0x5140('0x34')],function(_0x4c8e67){var _0x319730={};_0x319730[_0x4c8e67]={'$like':'%'+_0xd864c8[_0x5140('0x2f')][_0x5140('0x3a')]+'%'};return _0x319730;})});}_0x130acc=_['merge']({},_0x130acc,_0xd864c8[_0x5140('0x44')]);return _0x337f98[_0x5140('0x4b')](_0x130acc);}})[_0x5140('0x24')](function(_0x3fcbca){if(_0x3fcbca){_0x24e4f7=_0x3fcbca['length'];if(!_0xd864c8[_0x5140('0x2f')][_0x5140('0x35')](_0x5140('0x36'))){_0x130acc[_0x5140('0x1d')]=qs[_0x5140('0x1d')](_0xd864c8[_0x5140('0x2f')][_0x5140('0x1d')]);_0x130acc[_0x5140('0x1f')]=qs[_0x5140('0x1f')](_0xd864c8[_0x5140('0x2f')][_0x5140('0x1f')]);}return _0x337f98[_0x5140('0x4b')](_0x130acc);}})[_0x5140('0x24')](function(_0x5b30a8){if(_0x5b30a8){return _0x5b30a8?{'count':_0x24e4f7,'rows':_0x5b30a8}:null;}})[_0x5140('0x24')](respondWithResult(_0x20881f,null))['catch'](handleError(_0x20881f,null));};exports[_0x5140('0x4e')]=function(_0x32940d,_0x22833b,_0x3dd666){if(_0x32940d['body']['id']){delete _0x32940d[_0x5140('0x47')]['id'];}return db['FreshsalesAccount'][_0x5140('0x4c')]({'where':{'id':_0x32940d['params']['id']}})[_0x5140('0x24')](handleEntityNotFound(_0x22833b,null))['then'](function(_0x3e8c75){if(_0x3e8c75){_0x32940d[_0x5140('0x47')][_0x5140('0x4f')]=_0x3e8c75['id'];_0x32940d[_0x5140('0x47')][_0x5140('0x50')]=integrations[_0x5140('0x51')](_0x32940d[_0x5140('0x47')][_0x5140('0x52')],_0x32940d['body'][_0x5140('0x3d')]);_0x32940d['body'][_0x5140('0x53')]=integrations[_0x5140('0x54')](_0x32940d[_0x5140('0x47')][_0x5140('0x52')],_0x32940d[_0x5140('0x47')][_0x5140('0x3d')]);return db[_0x5140('0x4d')][_0x5140('0x46')](_0x32940d[_0x5140('0x47')],{'include':[{'model':db[_0x5140('0x55')],'as':_0x5140('0x50')},{'model':db[_0x5140('0x55')],'as':_0x5140('0x53')}]});}return null;})[_0x5140('0x24')](respondWithResult(_0x22833b,null))['catch'](handleError(_0x22833b,null));};exports['getFields']=function(_0x542843,_0x410b82,_0x2aec82){var _0x4afc52='';var _0x4ac2aa='';return db[_0x5140('0x40')]['findOne']({'where':{'id':_0x542843[_0x5140('0x43')]['id']},'attributes':['id',_0x5140('0x56'),'remoteUri','apiKey']})['then'](handleEntityNotFound(_0x410b82,null))['then'](function(_0x43fe0b){if(_0x43fe0b){_0x4ac2aa=_0x43fe0b[_0x5140('0x56')];_0x4afc52=_0x43fe0b[_0x5140('0x57')];var _0x234927=_0x43fe0b['remoteUri'][_0x5140('0x58')](-0x1);if(_0x234927==='/'){_0x4afc52=_0x4afc52[_0x5140('0x59')](0x0,_0x4afc52[_0x5140('0x5a')](_0x234927));}return rp({'method':_0x5140('0x5b'),'uri':util[_0x5140('0x5c')](_0x5140('0x5d'),_0x4afc52,_0x5140('0x5e')),'headers':{'Authorization':_0x5140('0x5f')+_0x43fe0b[_0x5140('0x60')]},'json':!![]});}})[_0x5140('0x24')](function(_0x4e8e06){if(_0x4e8e06){var _0x3f758f=_0x4e8e06[_0x5140('0x61')];var _0x258160=![];var _0x199328=null;for(_0x199328=0x0;_0x199328<_0x3f758f[_0x5140('0x62')];_0x199328++){if(_0x3f758f[_0x199328][_0x5140('0x63')]===_0x4ac2aa){_0x258160=!![];}}if(_0x258160){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5140('0x64')});}}})[_0x5140('0x24')](respondWithResult(_0x410b82,null))[_0x5140('0x48')](function(_0x3d56e9){var _0xb27f61=_0x542843[_0x5140('0x2f')]['test']?0x1f4:_0x3d56e9['statusCode']||0x1f4;logger[_0x5140('0x26')](_0x5140('0x65'),_0x5140('0x66'),_0xb27f61,JSON[_0x5140('0x67')](_0x3d56e9));delete _0x3d56e9[_0x5140('0x27')];if(_0xb27f61===0x191){_0xb27f61=0x190;}_0x410b82['status'](_0xb27f61)['send'](_0x542843[_0x5140('0x2f')][_0x5140('0x68')]?{'message':'Wrong\x20credentials','statusCode':_0x3d56e9[_0x5140('0x69')]}:_0x3d56e9);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index dbc356b..abe16cb 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 _0x8ace=['request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x8ace[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var logger=require(_0xe8ac('0x2'))(_0xe8ac('0x3'));var moment=require(_0xe8ac('0x4'));var BPromise=require(_0xe8ac('0x5'));var rp=require(_0xe8ac('0x6'));var fs=require('fs');var path=require(_0xe8ac('0x7'));var rimraf=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var attributes=require(_0xe8ac('0xa'));var integrations=require(_0xe8ac('0xb'));module[_0xe8ac('0xc')]=function(_0x2b48ec,_0x4eb087){return _0x2b48ec[_0xe8ac('0xd')](_0xe8ac('0xe'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1623=['path','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','api','moment','bluebird','request-promise'];(function(_0x235bc2,_0x8b0c00){var _0x59a3df=function(_0x55bbb9){while(--_0x55bbb9){_0x235bc2['push'](_0x235bc2['shift']());}};_0x59a3df(++_0x8b0c00);}(_0x1623,0xab));var _0x3162=function(_0x4aa3cb,_0x3edd14){_0x4aa3cb=_0x4aa3cb-0x0;var _0x5406c1=_0x1623[_0x4aa3cb];return _0x5406c1;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x3162('0x7')]=function(_0x428de6,_0x53260d){return _0x428de6[_0x3162('0x8')](_0x3162('0x9'),attributes,{'tableName':_0x3162('0xa'),'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 d50888f..a5eeb6f 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 _0xa456=['message','result','GetFreshsalesAccount','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x3211b5,_0x5dec0c){var _0x2db6c6=function(_0x3ea406){while(--_0x3ea406){_0x3211b5['push'](_0x3211b5['shift']());}};_0x2db6c6(++_0x5dec0c);}(_0xa456,0x142));var _0x6a45=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xa456[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var moment=require(_0x6a45('0x2'));var BPromise=require(_0x6a45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a45('0x4'));var db=require(_0x6a45('0x5'))['db'];var utils=require(_0x6a45('0x6'));var logger=require('../../config/logger')(_0x6a45('0x7'));var config=require(_0x6a45('0x8'));var jayson=require(_0x6a45('0x9'));var client=jayson[_0x6a45('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25cf8d,_0x26bfc0,_0x214514){return new BPromise(function(_0x19e67c,_0x3deb09){return client['request'](_0x25cf8d,_0x214514)[_0x6a45('0xb')](function(_0x517040){logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));logger[_0x6a45('0xf')](_0x6a45('0x10'),_0x26bfc0,'request\x20sent',JSON['stringify'](_0x517040));if(_0x517040[_0x6a45('0x11')]){if(_0x517040[_0x6a45('0x11')]['code']===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x26bfc0,_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);return _0x3deb09(_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);}logger[_0x6a45('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x26bfc0,_0x517040['error'][_0x6a45('0x12')]);return _0x19e67c(_0x517040[_0x6a45('0x11')]['message']);}else{logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));_0x19e67c(_0x517040[_0x6a45('0x13')]['message']);}})['catch'](function(_0x49023f){logger[_0x6a45('0x11')](_0x6a45('0xd'),_0x26bfc0,_0x49023f);_0x3deb09(_0x49023f);});});}exports[_0x6a45('0x14')]=function(_0x52a055){var _0x379c22=this;return new Promise(function(_0x102981,_0x3439c8){return db['FreshsalesAccount']['findAll']({'raw':_0x52a055['options']?_0x52a055[_0x6a45('0x15')][_0x6a45('0x16')]===undefined?!![]:![]:!![],'where':_0x52a055['options']?_0x52a055[_0x6a45('0x15')][_0x6a45('0x17')]||null:null,'attributes':_0x52a055['options']?_0x52a055[_0x6a45('0x15')][_0x6a45('0x18')]||null:null,'limit':_0x52a055[_0x6a45('0x15')]?_0x52a055[_0x6a45('0x15')][_0x6a45('0x19')]||null:null,'include':_0x52a055['options']?_0x52a055['options'][_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x52a055[_0x6a45('0x15')][_0x6a45('0x1a')],function(_0x25a380){return{'model':db[_0x25a380[_0x6a45('0x1c')]],'as':_0x25a380['as'],'attributes':_0x25a380[_0x6a45('0x18')],'include':_0x25a380[_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x25a380[_0x6a45('0x1a')],function(_0x1310d7){return{'model':db[_0x1310d7[_0x6a45('0x1c')]],'as':_0x1310d7['as'],'attributes':_0x1310d7['attributes'],'include':_0x1310d7[_0x6a45('0x1a')]?_['map'](_0x1310d7[_0x6a45('0x1a')],function(_0x25467d){return{'model':db[_0x25467d[_0x6a45('0x1c')]],'as':_0x25467d['as'],'attributes':_0x25467d[_0x6a45('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6a45('0xb')](function(_0x526062){logger[_0x6a45('0xc')](_0x6a45('0x14'),_0x52a055);logger[_0x6a45('0xf')](_0x6a45('0x14'),_0x52a055,JSON[_0x6a45('0x1d')](_0x526062));_0x102981(_0x526062);})[_0x6a45('0x1e')](function(_0x3fac9b){logger[_0x6a45('0x11')]('GetFreshsalesAccount',_0x3fac9b[_0x6a45('0x12')],_0x52a055);_0x3439c8(_0x379c22[_0x6a45('0x11')](0x1f4,_0x3fac9b[_0x6a45('0x12')]));});});};exports[_0x6a45('0x1f')]=function(_0x3b07a1){var _0x5dc288=this;return new Promise(function(_0x1f95d4,_0x1f96bf){return db[_0x6a45('0x20')][_0x6a45('0x21')]({'raw':_0x3b07a1['options']?_0x3b07a1['options'][_0x6a45('0x16')]===undefined?!![]:![]:!![],'where':_0x3b07a1['options']?_0x3b07a1[_0x6a45('0x15')]['where']||null:null,'attributes':_0x3b07a1[_0x6a45('0x15')]?_0x3b07a1[_0x6a45('0x15')][_0x6a45('0x18')]||null:null,'include':_0x3b07a1[_0x6a45('0x15')]?_0x3b07a1[_0x6a45('0x15')][_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x3b07a1[_0x6a45('0x15')][_0x6a45('0x1a')],function(_0x36f4a4){return{'model':db[_0x36f4a4[_0x6a45('0x1c')]],'as':_0x36f4a4['as'],'attributes':_0x36f4a4[_0x6a45('0x18')],'include':_0x36f4a4[_0x6a45('0x1a')]?_['map'](_0x36f4a4[_0x6a45('0x1a')],function(_0x4ae2ac){return{'model':db[_0x4ae2ac[_0x6a45('0x1c')]],'as':_0x4ae2ac['as'],'attributes':_0x4ae2ac[_0x6a45('0x18')],'include':_0x4ae2ac[_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x4ae2ac[_0x6a45('0x1a')],function(_0x2199c1){return{'model':db[_0x2199c1['model']],'as':_0x2199c1['as'],'attributes':_0x2199c1[_0x6a45('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6a45('0xb')](function(_0x2b75f6){logger[_0x6a45('0xc')](_0x6a45('0x1f'),_0x3b07a1);logger[_0x6a45('0xf')]('ShowFreshsalesAccount',_0x3b07a1,JSON[_0x6a45('0x1d')](_0x2b75f6));_0x1f95d4(_0x2b75f6);})[_0x6a45('0x1e')](function(_0x5c76bd){logger[_0x6a45('0x11')](_0x6a45('0x1f'),_0x5c76bd[_0x6a45('0x12')],_0x3b07a1);_0x1f96bf(_0x5dc288[_0x6a45('0x11')](0x1f4,_0x5c76bd[_0x6a45('0x12')]));});});}; \ No newline at end of file +var _0xef0f=['FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','include','model','attributes','map','ShowFreshsalesAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2b6ae5,_0x3c3219){var _0x497026=function(_0x2a73c3){while(--_0x2a73c3){_0x2b6ae5['push'](_0x2b6ae5['shift']());}};_0x497026(++_0x3c3219);}(_0xef0f,0x168));var _0xfef0=function(_0x44f454,_0x3944f9){_0x44f454=_0x44f454-0x0;var _0x57b408=_0xef0f[_0x44f454];return _0x57b408;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});}exports[_0xfef0('0x18')]=function(_0x581459){var _0xd60678=this;return new Promise(function(_0x1642cd,_0x1577fa){return db[_0xfef0('0x19')][_0xfef0('0x1a')]({'raw':_0x581459['options']?_0x581459[_0xfef0('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x581459[_0xfef0('0x1b')]?_0x581459[_0xfef0('0x1b')][_0xfef0('0x1c')]||null:null,'attributes':_0x581459['options']?_0x581459[_0xfef0('0x1b')]['attributes']||null:null,'limit':_0x581459[_0xfef0('0x1b')]?_0x581459[_0xfef0('0x1b')]['limit']||null:null,'include':_0x581459['options']?_0x581459['options'][_0xfef0('0x1d')]?_['map'](_0x581459[_0xfef0('0x1b')][_0xfef0('0x1d')],function(_0x1a8d66){return{'model':db[_0x1a8d66[_0xfef0('0x1e')]],'as':_0x1a8d66['as'],'attributes':_0x1a8d66[_0xfef0('0x1f')],'include':_0x1a8d66[_0xfef0('0x1d')]?_['map'](_0x1a8d66['include'],function(_0x316e20){return{'model':db[_0x316e20[_0xfef0('0x1e')]],'as':_0x316e20['as'],'attributes':_0x316e20[_0xfef0('0x1f')],'include':_0x316e20[_0xfef0('0x1d')]?_[_0xfef0('0x20')](_0x316e20[_0xfef0('0x1d')],function(_0x5df04f){return{'model':db[_0x5df04f[_0xfef0('0x1e')]],'as':_0x5df04f['as'],'attributes':_0x5df04f[_0xfef0('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a6758){logger[_0xfef0('0xd')](_0xfef0('0x18'),_0x581459);logger[_0xfef0('0x10')](_0xfef0('0x18'),_0x581459,JSON[_0xfef0('0x12')](_0x1a6758));_0x1642cd(_0x1a6758);})[_0xfef0('0x17')](function(_0x3e026a){logger[_0xfef0('0x13')](_0xfef0('0x18'),_0x3e026a[_0xfef0('0x15')],_0x581459);_0x1577fa(_0xd60678[_0xfef0('0x13')](0x1f4,_0x3e026a['message']));});});};exports[_0xfef0('0x21')]=function(_0x5806bd){var _0x4eaf74=this;return new Promise(function(_0x7d1692,_0x2ae54a){return db['FreshsalesAccount']['find']({'raw':_0x5806bd['options']?_0x5806bd['options']['raw']===undefined?!![]:![]:!![],'where':_0x5806bd[_0xfef0('0x1b')]?_0x5806bd[_0xfef0('0x1b')][_0xfef0('0x1c')]||null:null,'attributes':_0x5806bd['options']?_0x5806bd['options']['attributes']||null:null,'include':_0x5806bd[_0xfef0('0x1b')]?_0x5806bd['options'][_0xfef0('0x1d')]?_[_0xfef0('0x20')](_0x5806bd[_0xfef0('0x1b')]['include'],function(_0x3cad13){return{'model':db[_0x3cad13['model']],'as':_0x3cad13['as'],'attributes':_0x3cad13[_0xfef0('0x1f')],'include':_0x3cad13[_0xfef0('0x1d')]?_[_0xfef0('0x20')](_0x3cad13[_0xfef0('0x1d')],function(_0x3e1a64){return{'model':db[_0x3e1a64[_0xfef0('0x1e')]],'as':_0x3e1a64['as'],'attributes':_0x3e1a64[_0xfef0('0x1f')],'include':_0x3e1a64[_0xfef0('0x1d')]?_['map'](_0x3e1a64[_0xfef0('0x1d')],function(_0xea09ec){return{'model':db[_0xea09ec[_0xfef0('0x1e')]],'as':_0xea09ec['as'],'attributes':_0xea09ec[_0xfef0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfef0('0xc')](function(_0x262341){logger[_0xfef0('0xd')](_0xfef0('0x21'),_0x5806bd);logger[_0xfef0('0x10')](_0xfef0('0x21'),_0x5806bd,JSON[_0xfef0('0x12')](_0x262341));_0x7d1692(_0x262341);})[_0xfef0('0x17')](function(_0x366667){logger['error'](_0xfef0('0x21'),_0x366667['message'],_0x5806bd);_0x2ae54a(_0x4eaf74[_0xfef0('0x13')](0x1f4,_0x366667[_0xfef0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 24d77ef..ec27575 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 _0x37bd=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put'];(function(_0x149b76,_0x28126d){var _0x1de285=function(_0x5c3f1f){while(--_0x5c3f1f){_0x149b76['push'](_0x149b76['shift']());}};_0x1de285(++_0x28126d);}(_0x37bd,0x152));var _0xd37b=function(_0xb6e76a,_0x3d4a90){_0xb6e76a=_0xb6e76a-0x0;var _0x17abba=_0x37bd[_0xb6e76a];return _0x17abba;};'use strict';var multer=require(_0xd37b('0x0'));var util=require('util');var path=require(_0xd37b('0x1'));var timeout=require(_0xd37b('0x2'));var express=require('express');var router=express[_0xd37b('0x3')]();var fs_extra=require(_0xd37b('0x4'));var auth=require(_0xd37b('0x5'));var interaction=require(_0xd37b('0x6'));var config=require(_0xd37b('0x7'));var controller=require(_0xd37b('0x8'));router[_0xd37b('0x9')]('/',auth[_0xd37b('0xa')](),controller['index']);router[_0xd37b('0x9')](_0xd37b('0xb'),auth['isAuthenticated'](),controller[_0xd37b('0xc')]);router[_0xd37b('0x9')](_0xd37b('0xd'),auth['isAuthenticated'](),controller[_0xd37b('0xe')]);router[_0xd37b('0x9')](_0xd37b('0xf'),auth[_0xd37b('0xa')](),controller[_0xd37b('0x10')]);router['get'](_0xd37b('0x11'),auth[_0xd37b('0xa')](),controller[_0xd37b('0x12')]);router[_0xd37b('0x13')]('/',auth[_0xd37b('0xa')](),controller[_0xd37b('0x14')]);router[_0xd37b('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xd37b('0xa')](),controller[_0xd37b('0x16')]);module[_0xd37b('0x17')]=router; \ No newline at end of file +var _0xf70c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','post','put','update','delete','destroy','exports','multer','Router'];(function(_0x451d2e,_0xec68e2){var _0x4aec0b=function(_0x17174d){while(--_0x17174d){_0x451d2e['push'](_0x451d2e['shift']());}};_0x4aec0b(++_0xec68e2);}(_0xf70c,0x82));var _0xcf70=function(_0x2d6658,_0x5a3f03){_0x2d6658=_0x2d6658-0x0;var _0x1d0312=_0xf70c[_0x2d6658];return _0x1d0312;};'use strict';var multer=require(_0xcf70('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcf70('0x1')]();var fs_extra=require(_0xcf70('0x2'));var auth=require(_0xcf70('0x3'));var interaction=require(_0xcf70('0x4'));var config=require(_0xcf70('0x5'));var controller=require(_0xcf70('0x6'));router[_0xcf70('0x7')]('/',auth[_0xcf70('0x8')](),controller[_0xcf70('0x9')]);router[_0xcf70('0x7')](_0xcf70('0xa'),auth[_0xcf70('0x8')](),controller[_0xcf70('0xb')]);router[_0xcf70('0x7')](_0xcf70('0xc'),auth[_0xcf70('0x8')](),controller[_0xcf70('0xd')]);router[_0xcf70('0x7')]('/:id/descriptions',auth[_0xcf70('0x8')](),controller[_0xcf70('0xe')]);router[_0xcf70('0x7')](_0xcf70('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0xcf70('0x10')]('/',auth[_0xcf70('0x8')](),controller['create']);router[_0xcf70('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xcf70('0x12')]);router[_0xcf70('0x13')](_0xcf70('0xa'),auth[_0xcf70('0x8')](),controller[_0xcf70('0x14')]);module[_0xcf70('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 67eb3ab..726a277 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 _0xb8b7=['STRING'];(function(_0x2d58a3,_0xe83a5b){var _0xc59d42=function(_0x189cbf){while(--_0x189cbf){_0x2d58a3['push'](_0x2d58a3['shift']());}};_0xc59d42(++_0xe83a5b);}(_0xb8b7,0x143));var _0x7b8b=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb8b7[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7b8b('0x0')]},'description':{'type':Sequelize[_0x7b8b('0x0')]}}; \ No newline at end of file +var _0xe30e=['sequelize','STRING'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xe30e,0xfa));var _0xee30=function(_0x3ecf65,_0x3bac13){_0x3ecf65=_0x3ecf65-0x0;var _0x1907df=_0xe30e[_0x3ecf65];return _0x1907df;};'use strict';var Sequelize=require(_0xee30('0x0'));module['exports']={'name':{'type':Sequelize[_0xee30('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 3295dbe..0121f15 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 _0x9c1c=['../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','name','send','index','FreshsalesConfiguration','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','destroy','getSubjects','findOne','FreshsalesField','rawAttributes','hasOwnProperty','getDescriptions','getFields','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x310794,_0x39733e){var _0xe40989=function(_0x18a117){while(--_0x18a117){_0x310794['push'](_0x310794['shift']());}};_0xe40989(++_0x39733e);}(_0x9c1c,0x12e));var _0xc9c1=function(_0x5d225a,_0x2debe9){_0x5d225a=_0x5d225a-0x0;var _0x1e7761=_0x9c1c[_0x5d225a];return _0x1e7761;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc9c1('0x0'));var jsonpatch=require(_0xc9c1('0x1'));var rp=require(_0xc9c1('0x2'));var moment=require(_0xc9c1('0x3'));var BPromise=require(_0xc9c1('0x4'));var Mustache=require(_0xc9c1('0x5'));var util=require(_0xc9c1('0x6'));var path=require(_0xc9c1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc9c1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc9c1('0x9'));var squel=require(_0xc9c1('0xa'));var crypto=require(_0xc9c1('0xb'));var jsforce=require(_0xc9c1('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc9c1('0xd'));var Papa=require(_0xc9c1('0xe'));var Redis=require(_0xc9c1('0xf'));var authService=require(_0xc9c1('0x10'));var qs=require(_0xc9c1('0x11'));var as=require(_0xc9c1('0x12'));var hardwareService=require(_0xc9c1('0x13'));var logger=require(_0xc9c1('0x14'))(_0xc9c1('0x15'));var utils=require(_0xc9c1('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc9c1('0x17'))['db'];function respondWithStatusCode(_0x4420b9,_0x21d574){_0x21d574=_0x21d574||0xcc;return function(_0x2cd7b5){if(_0x2cd7b5){return _0x4420b9[_0xc9c1('0x18')](_0x21d574);}return _0x4420b9['status'](_0x21d574)[_0xc9c1('0x19')]();};}function respondWithResult(_0x2a01f1,_0x48a369){_0x48a369=_0x48a369||0xc8;return function(_0x392292){if(_0x392292){return _0x2a01f1[_0xc9c1('0x1a')](_0x48a369)[_0xc9c1('0x1b')](_0x392292);}};}function respondWithFilteredResult(_0x4c4e55,_0x5e2750){return function(_0xdeb6d0){if(_0xdeb6d0){var _0x3c7a0a=typeof _0x5e2750[_0xc9c1('0x1c')]===_0xc9c1('0x1d')&&typeof _0x5e2750[_0xc9c1('0x1e')]==='undefined';var _0x5f4572=_0xdeb6d0[_0xc9c1('0x1f')];var _0x1fb46a=_0x3c7a0a?0x0:_0x5e2750[_0xc9c1('0x1c')];var _0x14d1c6=_0x3c7a0a?_0xdeb6d0[_0xc9c1('0x1f')]:_0x5e2750[_0xc9c1('0x1c')]+_0x5e2750[_0xc9c1('0x1e')];var _0x3c6c8d;if(_0x14d1c6>=_0x5f4572){_0x14d1c6=_0x5f4572;_0x3c6c8d=0xc8;}else{_0x3c6c8d=0xce;}_0x4c4e55[_0xc9c1('0x1a')](_0x3c6c8d);return _0x4c4e55[_0xc9c1('0x20')]('Content-Range',_0x1fb46a+'-'+_0x14d1c6+'/'+_0x5f4572)[_0xc9c1('0x1b')](_0xdeb6d0);}return null;};}function patchUpdates(_0x4fb382){return function(_0x53a157){try{jsonpatch[_0xc9c1('0x21')](_0x53a157,_0x4fb382,!![]);}catch(_0x4f72eb){return BPromise[_0xc9c1('0x22')](_0x4f72eb);}return _0x53a157[_0xc9c1('0x23')]();};}function saveUpdates(_0x564b20,_0xb296e9){return function(_0x4d5d1d){if(_0x4d5d1d){return _0x4d5d1d[_0xc9c1('0x24')](_0x564b20)[_0xc9c1('0x25')](function(_0x113313){return _0x113313;});}return null;};}function removeEntity(_0x57676a,_0xd6060f){return function(_0x5390af){if(_0x5390af){return _0x5390af['destroy']()[_0xc9c1('0x25')](function(){_0x57676a[_0xc9c1('0x1a')](0xcc)[_0xc9c1('0x19')]();});}};}function handleEntityNotFound(_0x390a58,_0xe0a507){return function(_0x5bfb2a){if(!_0x5bfb2a){_0x390a58[_0xc9c1('0x18')](0x194);}return _0x5bfb2a;};}function handleError(_0x343aa9,_0x10dc5f){_0x10dc5f=_0x10dc5f||0x1f4;return function(_0x3aa2f1){logger['error'](_0x3aa2f1['stack']);if(_0x3aa2f1[_0xc9c1('0x26')]){delete _0x3aa2f1[_0xc9c1('0x26')];}_0x343aa9[_0xc9c1('0x1a')](_0x10dc5f)[_0xc9c1('0x27')](_0x3aa2f1);};}exports[_0xc9c1('0x28')]=function(_0xb5c954,_0x43ee5f){var _0x4d964d={},_0x391975={},_0x5304c8={'count':0x0,'rows':[]};var _0x341e4a=_['map'](db[_0xc9c1('0x29')]['rawAttributes'],function(_0x3e2301){return{'name':_0x3e2301[_0xc9c1('0x2a')],'type':_0x3e2301[_0xc9c1('0x2b')][_0xc9c1('0x2c')]};});_0x391975[_0xc9c1('0x2d')]=_[_0xc9c1('0x2e')](_0x341e4a,_0xc9c1('0x26'));_0x391975['query']=_['keys'](_0xb5c954[_0xc9c1('0x2f')]);_0x391975[_0xc9c1('0x30')]=_[_0xc9c1('0x31')](_0x391975[_0xc9c1('0x2d')],_0x391975[_0xc9c1('0x2f')]);_0x4d964d[_0xc9c1('0x32')]=_[_0xc9c1('0x31')](_0x391975[_0xc9c1('0x2d')],qs['fields'](_0xb5c954[_0xc9c1('0x2f')][_0xc9c1('0x33')]));_0x4d964d[_0xc9c1('0x32')]=_0x4d964d['attributes'][_0xc9c1('0x34')]?_0x4d964d[_0xc9c1('0x32')]:_0x391975[_0xc9c1('0x2d')];if(!_0xb5c954['query']['hasOwnProperty'](_0xc9c1('0x35'))){_0x4d964d[_0xc9c1('0x1e')]=qs[_0xc9c1('0x1e')](_0xb5c954['query'][_0xc9c1('0x1e')]);_0x4d964d[_0xc9c1('0x1c')]=qs[_0xc9c1('0x1c')](_0xb5c954['query']['offset']);}_0x4d964d[_0xc9c1('0x36')]=qs[_0xc9c1('0x37')](_0xb5c954[_0xc9c1('0x2f')][_0xc9c1('0x37')]);_0x4d964d['where']=qs['filters'](_[_0xc9c1('0x38')](_0xb5c954['query'],_0x391975[_0xc9c1('0x30')]),_0x341e4a);if(_0xb5c954[_0xc9c1('0x2f')]['filter']){_0x4d964d[_0xc9c1('0x39')]=_['merge'](_0x4d964d[_0xc9c1('0x39')],{'$or':_[_0xc9c1('0x2e')](_0x341e4a,function(_0x3a85a3){if(_0x3a85a3['type']!==_0xc9c1('0x3a')){var _0x4b43fe={};_0x4b43fe[_0x3a85a3['name']]={'$like':'%'+_0xb5c954[_0xc9c1('0x2f')][_0xc9c1('0x3b')]+'%'};return _0x4b43fe;}})});}_0x4d964d=_[_0xc9c1('0x3c')]({},_0x4d964d,_0xb5c954[_0xc9c1('0x3d')]);var _0x1652f6={'where':_0x4d964d[_0xc9c1('0x39')]};return db[_0xc9c1('0x29')][_0xc9c1('0x1f')](_0x1652f6)[_0xc9c1('0x25')](function(_0x209303){_0x5304c8[_0xc9c1('0x1f')]=_0x209303;if(_0xb5c954['query'][_0xc9c1('0x3e')]){_0x4d964d[_0xc9c1('0x3f')]=[{'all':!![]}];}return db[_0xc9c1('0x29')][_0xc9c1('0x40')](_0x4d964d);})['then'](function(_0x231700){_0x5304c8[_0xc9c1('0x41')]=_0x231700;return _0x5304c8;})[_0xc9c1('0x25')](respondWithFilteredResult(_0x43ee5f,_0x4d964d))[_0xc9c1('0x42')](handleError(_0x43ee5f,null));};exports[_0xc9c1('0x43')]=function(_0x3f6a7f,_0x2ed0d7){var _0xc00906={'raw':![],'where':{'id':_0x3f6a7f[_0xc9c1('0x44')]['id']}},_0x3de7be={};_0x3de7be['model']=_[_0xc9c1('0x45')](db[_0xc9c1('0x29')]['rawAttributes']);_0x3de7be[_0xc9c1('0x2f')]=_[_0xc9c1('0x45')](_0x3f6a7f[_0xc9c1('0x2f')]);_0x3de7be[_0xc9c1('0x30')]=_[_0xc9c1('0x31')](_0x3de7be[_0xc9c1('0x2d')],_0x3de7be[_0xc9c1('0x2f')]);_0xc00906[_0xc9c1('0x32')]=_[_0xc9c1('0x31')](_0x3de7be[_0xc9c1('0x2d')],qs[_0xc9c1('0x33')](_0x3f6a7f[_0xc9c1('0x2f')]['fields']));_0xc00906[_0xc9c1('0x32')]=_0xc00906[_0xc9c1('0x32')][_0xc9c1('0x34')]?_0xc00906[_0xc9c1('0x32')]:_0x3de7be[_0xc9c1('0x2d')];if(_0x3f6a7f[_0xc9c1('0x2f')][_0xc9c1('0x3e')]){_0xc00906[_0xc9c1('0x3f')]=[{'all':!![]}];}_0xc00906=_[_0xc9c1('0x3c')]({},_0xc00906,_0x3f6a7f[_0xc9c1('0x3d')]);return db[_0xc9c1('0x29')]['find'](_0xc00906)['then'](handleEntityNotFound(_0x2ed0d7,null))['then'](respondWithResult(_0x2ed0d7,null))[_0xc9c1('0x42')](handleError(_0x2ed0d7,null));};exports[_0xc9c1('0x46')]=function(_0x1baa3c,_0x2e0408){return db[_0xc9c1('0x29')]['create'](_0x1baa3c[_0xc9c1('0x47')],{})[_0xc9c1('0x25')](respondWithResult(_0x2e0408,0xc9))[_0xc9c1('0x42')](handleError(_0x2e0408,null));};exports[_0xc9c1('0x24')]=function(_0x3e8eda,_0x325766){if(_0x3e8eda[_0xc9c1('0x47')]['id']){delete _0x3e8eda[_0xc9c1('0x47')]['id'];}return db[_0xc9c1('0x29')][_0xc9c1('0x48')]({'where':{'id':_0x3e8eda['params']['id']}})[_0xc9c1('0x25')](handleEntityNotFound(_0x325766,null))[_0xc9c1('0x25')](saveUpdates(_0x3e8eda[_0xc9c1('0x47')],null))[_0xc9c1('0x25')](respondWithResult(_0x325766,null))[_0xc9c1('0x42')](handleError(_0x325766,null));};exports[_0xc9c1('0x49')]=function(_0x1dfc3e,_0x308f46){return db[_0xc9c1('0x29')][_0xc9c1('0x48')]({'where':{'id':_0x1dfc3e[_0xc9c1('0x44')]['id']}})[_0xc9c1('0x25')](handleEntityNotFound(_0x308f46,null))[_0xc9c1('0x25')](removeEntity(_0x308f46,null))['catch'](handleError(_0x308f46,null));};exports[_0xc9c1('0x4a')]=function(_0x3fba2c,_0x371df3,_0x2a459b){var _0x184fb3={};var _0x414294={};var _0x5b31b3;var _0x27d851;return db[_0xc9c1('0x29')][_0xc9c1('0x4b')]({'where':{'id':_0x3fba2c[_0xc9c1('0x44')]['id']}})[_0xc9c1('0x25')](handleEntityNotFound(_0x371df3,null))[_0xc9c1('0x25')](function(_0x1d09db){if(_0x1d09db){_0x5b31b3=_0x1d09db;_0x414294[_0xc9c1('0x2d')]=_[_0xc9c1('0x45')](db[_0xc9c1('0x4c')][_0xc9c1('0x4d')]);_0x414294[_0xc9c1('0x2f')]=_['keys'](_0x3fba2c['query']);_0x414294[_0xc9c1('0x30')]=_[_0xc9c1('0x31')](_0x414294[_0xc9c1('0x2d')],_0x414294[_0xc9c1('0x2f')]);_0x184fb3[_0xc9c1('0x32')]=_[_0xc9c1('0x31')](_0x414294['model'],qs[_0xc9c1('0x33')](_0x3fba2c[_0xc9c1('0x2f')][_0xc9c1('0x33')]));_0x184fb3['attributes']=_0x184fb3[_0xc9c1('0x32')]['length']?_0x184fb3[_0xc9c1('0x32')]:_0x414294[_0xc9c1('0x2d')];_0x184fb3[_0xc9c1('0x36')]=qs[_0xc9c1('0x37')](_0x3fba2c[_0xc9c1('0x2f')][_0xc9c1('0x37')]);_0x184fb3[_0xc9c1('0x39')]=qs[_0xc9c1('0x30')](_[_0xc9c1('0x38')](_0x3fba2c['query'],_0x414294[_0xc9c1('0x30')]));if(_0x3fba2c['query'][_0xc9c1('0x3b')]){_0x184fb3['where']=_[_0xc9c1('0x3c')](_0x184fb3['where'],{'$or':_[_0xc9c1('0x2e')](_0x184fb3[_0xc9c1('0x32')],function(_0x2cd7dd){var _0x2162d0={};_0x2162d0[_0x2cd7dd]={'$like':'%'+_0x3fba2c[_0xc9c1('0x2f')][_0xc9c1('0x3b')]+'%'};return _0x2162d0;})});}_0x184fb3=_[_0xc9c1('0x3c')]({},_0x184fb3,_0x3fba2c['options']);return _0x5b31b3['getSubjects'](_0x184fb3);}})[_0xc9c1('0x25')](function(_0x172b63){if(_0x172b63){_0x27d851=_0x172b63['length'];if(!_0x3fba2c[_0xc9c1('0x2f')][_0xc9c1('0x4e')](_0xc9c1('0x35'))){_0x184fb3['limit']=qs[_0xc9c1('0x1e')](_0x3fba2c['query'][_0xc9c1('0x1e')]);_0x184fb3[_0xc9c1('0x1c')]=qs['offset'](_0x3fba2c[_0xc9c1('0x2f')][_0xc9c1('0x1c')]);}return _0x5b31b3['getSubjects'](_0x184fb3);}})[_0xc9c1('0x25')](function(_0x4c986d){if(_0x4c986d){return _0x4c986d?{'count':_0x27d851,'rows':_0x4c986d}:null;}})[_0xc9c1('0x25')](respondWithResult(_0x371df3,null))[_0xc9c1('0x42')](handleError(_0x371df3,null));};exports['getDescriptions']=function(_0x5592b6,_0x17e000,_0x153a81){var _0x297ba9={};var _0x7a135e={};var _0xf9ff99;var _0x23f4cb;return db[_0xc9c1('0x29')][_0xc9c1('0x4b')]({'where':{'id':_0x5592b6[_0xc9c1('0x44')]['id']}})[_0xc9c1('0x25')](handleEntityNotFound(_0x17e000,null))[_0xc9c1('0x25')](function(_0x467151){if(_0x467151){_0xf9ff99=_0x467151;_0x7a135e[_0xc9c1('0x2d')]=_[_0xc9c1('0x45')](db[_0xc9c1('0x4c')][_0xc9c1('0x4d')]);_0x7a135e['query']=_[_0xc9c1('0x45')](_0x5592b6[_0xc9c1('0x2f')]);_0x7a135e[_0xc9c1('0x30')]=_[_0xc9c1('0x31')](_0x7a135e['model'],_0x7a135e[_0xc9c1('0x2f')]);_0x297ba9['attributes']=_[_0xc9c1('0x31')](_0x7a135e[_0xc9c1('0x2d')],qs[_0xc9c1('0x33')](_0x5592b6[_0xc9c1('0x2f')]['fields']));_0x297ba9[_0xc9c1('0x32')]=_0x297ba9['attributes'][_0xc9c1('0x34')]?_0x297ba9[_0xc9c1('0x32')]:_0x7a135e[_0xc9c1('0x2d')];_0x297ba9[_0xc9c1('0x36')]=qs[_0xc9c1('0x37')](_0x5592b6[_0xc9c1('0x2f')][_0xc9c1('0x37')]);_0x297ba9[_0xc9c1('0x39')]=qs['filters'](_[_0xc9c1('0x38')](_0x5592b6[_0xc9c1('0x2f')],_0x7a135e[_0xc9c1('0x30')]));if(_0x5592b6[_0xc9c1('0x2f')]['filter']){_0x297ba9[_0xc9c1('0x39')]=_[_0xc9c1('0x3c')](_0x297ba9[_0xc9c1('0x39')],{'$or':_[_0xc9c1('0x2e')](_0x297ba9[_0xc9c1('0x32')],function(_0x39ce9f){var _0x52a93d={};_0x52a93d[_0x39ce9f]={'$like':'%'+_0x5592b6[_0xc9c1('0x2f')][_0xc9c1('0x3b')]+'%'};return _0x52a93d;})});}_0x297ba9=_['merge']({},_0x297ba9,_0x5592b6[_0xc9c1('0x3d')]);return _0xf9ff99['getDescriptions'](_0x297ba9);}})[_0xc9c1('0x25')](function(_0x239ff5){if(_0x239ff5){_0x23f4cb=_0x239ff5[_0xc9c1('0x34')];if(!_0x5592b6[_0xc9c1('0x2f')][_0xc9c1('0x4e')](_0xc9c1('0x35'))){_0x297ba9[_0xc9c1('0x1e')]=qs[_0xc9c1('0x1e')](_0x5592b6[_0xc9c1('0x2f')][_0xc9c1('0x1e')]);_0x297ba9[_0xc9c1('0x1c')]=qs[_0xc9c1('0x1c')](_0x5592b6['query'][_0xc9c1('0x1c')]);}return _0xf9ff99[_0xc9c1('0x4f')](_0x297ba9);}})[_0xc9c1('0x25')](function(_0x1db386){if(_0x1db386){return _0x1db386?{'count':_0x23f4cb,'rows':_0x1db386}:null;}})[_0xc9c1('0x25')](respondWithResult(_0x17e000,null))[_0xc9c1('0x42')](handleError(_0x17e000,null));};exports[_0xc9c1('0x50')]=function(_0x49d15d,_0x305606,_0x220f5b){var _0x201eef={};var _0x4396d1={};var _0x4ce539;var _0x5a868f;return db['FreshsalesConfiguration'][_0xc9c1('0x4b')]({'where':{'id':_0x49d15d[_0xc9c1('0x44')]['id']}})[_0xc9c1('0x25')](handleEntityNotFound(_0x305606,null))[_0xc9c1('0x25')](function(_0x1aadd8){if(_0x1aadd8){_0x4ce539=_0x1aadd8;_0x4396d1['model']=_[_0xc9c1('0x45')](db[_0xc9c1('0x4c')]['rawAttributes']);_0x4396d1[_0xc9c1('0x2f')]=_[_0xc9c1('0x45')](_0x49d15d['query']);_0x4396d1['filters']=_[_0xc9c1('0x31')](_0x4396d1['model'],_0x4396d1[_0xc9c1('0x2f')]);_0x201eef['attributes']=_[_0xc9c1('0x31')](_0x4396d1[_0xc9c1('0x2d')],qs[_0xc9c1('0x33')](_0x49d15d['query'][_0xc9c1('0x33')]));_0x201eef[_0xc9c1('0x32')]=_0x201eef[_0xc9c1('0x32')]['length']?_0x201eef[_0xc9c1('0x32')]:_0x4396d1['model'];_0x201eef[_0xc9c1('0x36')]=qs[_0xc9c1('0x37')](_0x49d15d[_0xc9c1('0x2f')][_0xc9c1('0x37')]);_0x201eef[_0xc9c1('0x39')]=qs['filters'](_[_0xc9c1('0x38')](_0x49d15d[_0xc9c1('0x2f')],_0x4396d1[_0xc9c1('0x30')]));if(_0x49d15d[_0xc9c1('0x2f')]['filter']){_0x201eef[_0xc9c1('0x39')]=_[_0xc9c1('0x3c')](_0x201eef['where'],{'$or':_[_0xc9c1('0x2e')](_0x201eef[_0xc9c1('0x32')],function(_0x359a65){var _0x45ceba={};_0x45ceba[_0x359a65]={'$like':'%'+_0x49d15d[_0xc9c1('0x2f')][_0xc9c1('0x3b')]+'%'};return _0x45ceba;})});}_0x201eef=_[_0xc9c1('0x3c')]({},_0x201eef,_0x49d15d['options']);return _0x4ce539[_0xc9c1('0x50')](_0x201eef);}})[_0xc9c1('0x25')](function(_0x5ed62e){if(_0x5ed62e){_0x5a868f=_0x5ed62e[_0xc9c1('0x34')];if(!_0x49d15d[_0xc9c1('0x2f')][_0xc9c1('0x4e')](_0xc9c1('0x35'))){_0x201eef[_0xc9c1('0x1e')]=qs[_0xc9c1('0x1e')](_0x49d15d[_0xc9c1('0x2f')][_0xc9c1('0x1e')]);_0x201eef[_0xc9c1('0x1c')]=qs[_0xc9c1('0x1c')](_0x49d15d[_0xc9c1('0x2f')][_0xc9c1('0x1c')]);}return _0x4ce539[_0xc9c1('0x50')](_0x201eef);}})[_0xc9c1('0x25')](function(_0x58d184){if(_0x58d184){return _0x58d184?{'count':_0x5a868f,'rows':_0x58d184}:null;}})[_0xc9c1('0x25')](respondWithResult(_0x305606,null))[_0xc9c1('0x42')](handleError(_0x305606,null));}; \ No newline at end of file +var _0x344b=['findOne','FreshsalesField','filter','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','index','map','FreshsalesConfiguration','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','includeAll','include','rows','show','params','keys','rawAttributes','options','find','catch','create','body','getSubjects'];(function(_0x1502a2,_0x4e7122){var _0xa2bb7=function(_0x53f4f8){while(--_0x53f4f8){_0x1502a2['push'](_0x1502a2['shift']());}};_0xa2bb7(++_0x4e7122);}(_0x344b,0x195));var _0xb344=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x344b[_0x243b2f];return _0xcb3c2d;};'use strict';var emlformat=require(_0xb344('0x0'));var rimraf=require(_0xb344('0x1'));var zipdir=require(_0xb344('0x2'));var jsonpatch=require(_0xb344('0x3'));var rp=require(_0xb344('0x4'));var moment=require(_0xb344('0x5'));var BPromise=require(_0xb344('0x6'));var Mustache=require(_0xb344('0x7'));var util=require(_0xb344('0x8'));var path=require('path');var sox=require(_0xb344('0x9'));var csv=require(_0xb344('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb344('0xb'));var _=require(_0xb344('0xc'));var squel=require('squel');var crypto=require(_0xb344('0xd'));var jsforce=require(_0xb344('0xe'));var deskjs=require(_0xb344('0xf'));var toCsv=require(_0xb344('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb344('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb344('0x11'));var logger=require(_0xb344('0x12'))('api');var utils=require(_0xb344('0x13'));var config=require(_0xb344('0x14'));var licenseUtil=require(_0xb344('0x15'));var db=require(_0xb344('0x16'))['db'];function respondWithStatusCode(_0x277720,_0x4b155f){_0x4b155f=_0x4b155f||0xcc;return function(_0x571f59){if(_0x571f59){return _0x277720[_0xb344('0x17')](_0x4b155f);}return _0x277720[_0xb344('0x18')](_0x4b155f)[_0xb344('0x19')]();};}function respondWithResult(_0xbe9a7a,_0x16ef47){_0x16ef47=_0x16ef47||0xc8;return function(_0xa67f8d){if(_0xa67f8d){return _0xbe9a7a[_0xb344('0x18')](_0x16ef47)['json'](_0xa67f8d);}};}function respondWithFilteredResult(_0x32a0c2,_0x1fcba3){return function(_0xc1a3ab){if(_0xc1a3ab){var _0x5f2b27=typeof _0x1fcba3[_0xb344('0x1a')]==='undefined'&&typeof _0x1fcba3[_0xb344('0x1b')]===_0xb344('0x1c');var _0xa55483=_0xc1a3ab[_0xb344('0x1d')];var _0x3a5e83=_0x5f2b27?0x0:_0x1fcba3[_0xb344('0x1a')];var _0x2359a1=_0x5f2b27?_0xc1a3ab[_0xb344('0x1d')]:_0x1fcba3[_0xb344('0x1a')]+_0x1fcba3[_0xb344('0x1b')];var _0x45c2be;if(_0x2359a1>=_0xa55483){_0x2359a1=_0xa55483;_0x45c2be=0xc8;}else{_0x45c2be=0xce;}_0x32a0c2[_0xb344('0x18')](_0x45c2be);return _0x32a0c2[_0xb344('0x1e')](_0xb344('0x1f'),_0x3a5e83+'-'+_0x2359a1+'/'+_0xa55483)[_0xb344('0x20')](_0xc1a3ab);}return null;};}function patchUpdates(_0x23a329){return function(_0x400767){try{jsonpatch['apply'](_0x400767,_0x23a329,!![]);}catch(_0x2b010b){return BPromise[_0xb344('0x21')](_0x2b010b);}return _0x400767[_0xb344('0x22')]();};}function saveUpdates(_0x2b6232,_0x8b9a0e){return function(_0x261a07){if(_0x261a07){return _0x261a07[_0xb344('0x23')](_0x2b6232)['then'](function(_0x3519ef){return _0x3519ef;});}return null;};}function removeEntity(_0xc41ef9,_0x13965c){return function(_0x1dc06c){if(_0x1dc06c){return _0x1dc06c[_0xb344('0x24')]()[_0xb344('0x25')](function(){_0xc41ef9[_0xb344('0x18')](0xcc)[_0xb344('0x19')]();});}};}function handleEntityNotFound(_0xff61d9,_0x21a172){return function(_0x4a4e55){if(!_0x4a4e55){_0xff61d9['sendStatus'](0x194);}return _0x4a4e55;};}function handleError(_0x44ca7b,_0x5840c9){_0x5840c9=_0x5840c9||0x1f4;return function(_0x256e2f){logger[_0xb344('0x26')](_0x256e2f[_0xb344('0x27')]);if(_0x256e2f[_0xb344('0x28')]){delete _0x256e2f[_0xb344('0x28')];}_0x44ca7b['status'](_0x5840c9)['send'](_0x256e2f);};}exports[_0xb344('0x29')]=function(_0x1973b3,_0x31d5c7){var _0xb596a6={},_0x430188={},_0xb78d68={'count':0x0,'rows':[]};var _0x2b6fd9=_[_0xb344('0x2a')](db[_0xb344('0x2b')]['rawAttributes'],function(_0x284fc0){return{'name':_0x284fc0[_0xb344('0x2c')],'type':_0x284fc0['type'][_0xb344('0x2d')]};});_0x430188[_0xb344('0x2e')]=_['map'](_0x2b6fd9,_0xb344('0x28'));_0x430188['query']=_['keys'](_0x1973b3[_0xb344('0x2f')]);_0x430188[_0xb344('0x30')]=_[_0xb344('0x31')](_0x430188['model'],_0x430188[_0xb344('0x2f')]);_0xb596a6['attributes']=_[_0xb344('0x31')](_0x430188[_0xb344('0x2e')],qs[_0xb344('0x32')](_0x1973b3[_0xb344('0x2f')]['fields']));_0xb596a6[_0xb344('0x33')]=_0xb596a6['attributes'][_0xb344('0x34')]?_0xb596a6[_0xb344('0x33')]:_0x430188[_0xb344('0x2e')];if(!_0x1973b3[_0xb344('0x2f')][_0xb344('0x35')](_0xb344('0x36'))){_0xb596a6[_0xb344('0x1b')]=qs[_0xb344('0x1b')](_0x1973b3[_0xb344('0x2f')]['limit']);_0xb596a6[_0xb344('0x1a')]=qs[_0xb344('0x1a')](_0x1973b3[_0xb344('0x2f')]['offset']);}_0xb596a6[_0xb344('0x37')]=qs[_0xb344('0x38')](_0x1973b3[_0xb344('0x2f')][_0xb344('0x38')]);_0xb596a6[_0xb344('0x39')]=qs[_0xb344('0x30')](_[_0xb344('0x3a')](_0x1973b3[_0xb344('0x2f')],_0x430188['filters']),_0x2b6fd9);if(_0x1973b3[_0xb344('0x2f')]['filter']){_0xb596a6['where']=_[_0xb344('0x3b')](_0xb596a6['where'],{'$or':_[_0xb344('0x2a')](_0x2b6fd9,function(_0x102412){if(_0x102412[_0xb344('0x3c')]!==_0xb344('0x3d')){var _0x5cb4b1={};_0x5cb4b1[_0x102412[_0xb344('0x28')]]={'$like':'%'+_0x1973b3[_0xb344('0x2f')]['filter']+'%'};return _0x5cb4b1;}})});}_0xb596a6=_[_0xb344('0x3b')]({},_0xb596a6,_0x1973b3['options']);var _0x28d535={'where':_0xb596a6[_0xb344('0x39')]};return db[_0xb344('0x2b')][_0xb344('0x1d')](_0x28d535)[_0xb344('0x25')](function(_0xc3eda9){_0xb78d68[_0xb344('0x1d')]=_0xc3eda9;if(_0x1973b3['query'][_0xb344('0x3e')]){_0xb596a6[_0xb344('0x3f')]=[{'all':!![]}];}return db[_0xb344('0x2b')]['findAll'](_0xb596a6);})['then'](function(_0x22666f){_0xb78d68[_0xb344('0x40')]=_0x22666f;return _0xb78d68;})['then'](respondWithFilteredResult(_0x31d5c7,_0xb596a6))['catch'](handleError(_0x31d5c7,null));};exports[_0xb344('0x41')]=function(_0x281ef6,_0x1edc2a){var _0x10697b={'raw':![],'where':{'id':_0x281ef6[_0xb344('0x42')]['id']}},_0x3eb9cd={};_0x3eb9cd[_0xb344('0x2e')]=_[_0xb344('0x43')](db['FreshsalesConfiguration'][_0xb344('0x44')]);_0x3eb9cd[_0xb344('0x2f')]=_['keys'](_0x281ef6[_0xb344('0x2f')]);_0x3eb9cd[_0xb344('0x30')]=_[_0xb344('0x31')](_0x3eb9cd[_0xb344('0x2e')],_0x3eb9cd[_0xb344('0x2f')]);_0x10697b[_0xb344('0x33')]=_[_0xb344('0x31')](_0x3eb9cd['model'],qs[_0xb344('0x32')](_0x281ef6[_0xb344('0x2f')][_0xb344('0x32')]));_0x10697b[_0xb344('0x33')]=_0x10697b[_0xb344('0x33')][_0xb344('0x34')]?_0x10697b[_0xb344('0x33')]:_0x3eb9cd[_0xb344('0x2e')];if(_0x281ef6[_0xb344('0x2f')][_0xb344('0x3e')]){_0x10697b['include']=[{'all':!![]}];}_0x10697b=_[_0xb344('0x3b')]({},_0x10697b,_0x281ef6[_0xb344('0x45')]);return db[_0xb344('0x2b')][_0xb344('0x46')](_0x10697b)['then'](handleEntityNotFound(_0x1edc2a,null))[_0xb344('0x25')](respondWithResult(_0x1edc2a,null))[_0xb344('0x47')](handleError(_0x1edc2a,null));};exports[_0xb344('0x48')]=function(_0x2662db,_0x1b1035){return db[_0xb344('0x2b')][_0xb344('0x48')](_0x2662db['body'],{})[_0xb344('0x25')](respondWithResult(_0x1b1035,0xc9))[_0xb344('0x47')](handleError(_0x1b1035,null));};exports[_0xb344('0x23')]=function(_0x63876c,_0x4f7270){if(_0x63876c[_0xb344('0x49')]['id']){delete _0x63876c['body']['id'];}return db['FreshsalesConfiguration'][_0xb344('0x46')]({'where':{'id':_0x63876c[_0xb344('0x42')]['id']}})[_0xb344('0x25')](handleEntityNotFound(_0x4f7270,null))['then'](saveUpdates(_0x63876c[_0xb344('0x49')],null))[_0xb344('0x25')](respondWithResult(_0x4f7270,null))[_0xb344('0x47')](handleError(_0x4f7270,null));};exports[_0xb344('0x24')]=function(_0x498d21,_0x295f7f){return db['FreshsalesConfiguration'][_0xb344('0x46')]({'where':{'id':_0x498d21[_0xb344('0x42')]['id']}})[_0xb344('0x25')](handleEntityNotFound(_0x295f7f,null))[_0xb344('0x25')](removeEntity(_0x295f7f,null))[_0xb344('0x47')](handleError(_0x295f7f,null));};exports[_0xb344('0x4a')]=function(_0xa94ac6,_0xa79b32,_0xa52b6e){var _0x16ffd6={};var _0x329855={};var _0x21aee8;var _0xbf256a;return db[_0xb344('0x2b')][_0xb344('0x4b')]({'where':{'id':_0xa94ac6[_0xb344('0x42')]['id']}})['then'](handleEntityNotFound(_0xa79b32,null))[_0xb344('0x25')](function(_0x576fa4){if(_0x576fa4){_0x21aee8=_0x576fa4;_0x329855[_0xb344('0x2e')]=_[_0xb344('0x43')](db['FreshsalesField']['rawAttributes']);_0x329855[_0xb344('0x2f')]=_[_0xb344('0x43')](_0xa94ac6['query']);_0x329855['filters']=_[_0xb344('0x31')](_0x329855[_0xb344('0x2e')],_0x329855[_0xb344('0x2f')]);_0x16ffd6['attributes']=_[_0xb344('0x31')](_0x329855[_0xb344('0x2e')],qs[_0xb344('0x32')](_0xa94ac6[_0xb344('0x2f')]['fields']));_0x16ffd6[_0xb344('0x33')]=_0x16ffd6[_0xb344('0x33')]['length']?_0x16ffd6[_0xb344('0x33')]:_0x329855[_0xb344('0x2e')];_0x16ffd6[_0xb344('0x37')]=qs['sort'](_0xa94ac6[_0xb344('0x2f')][_0xb344('0x38')]);_0x16ffd6['where']=qs['filters'](_[_0xb344('0x3a')](_0xa94ac6['query'],_0x329855[_0xb344('0x30')]));if(_0xa94ac6[_0xb344('0x2f')]['filter']){_0x16ffd6[_0xb344('0x39')]=_['merge'](_0x16ffd6[_0xb344('0x39')],{'$or':_[_0xb344('0x2a')](_0x16ffd6['attributes'],function(_0x243d9e){var _0x4d09da={};_0x4d09da[_0x243d9e]={'$like':'%'+_0xa94ac6[_0xb344('0x2f')]['filter']+'%'};return _0x4d09da;})});}_0x16ffd6=_[_0xb344('0x3b')]({},_0x16ffd6,_0xa94ac6[_0xb344('0x45')]);return _0x21aee8[_0xb344('0x4a')](_0x16ffd6);}})[_0xb344('0x25')](function(_0x3dad2a){if(_0x3dad2a){_0xbf256a=_0x3dad2a['length'];if(!_0xa94ac6[_0xb344('0x2f')][_0xb344('0x35')](_0xb344('0x36'))){_0x16ffd6[_0xb344('0x1b')]=qs[_0xb344('0x1b')](_0xa94ac6[_0xb344('0x2f')][_0xb344('0x1b')]);_0x16ffd6[_0xb344('0x1a')]=qs[_0xb344('0x1a')](_0xa94ac6[_0xb344('0x2f')][_0xb344('0x1a')]);}return _0x21aee8[_0xb344('0x4a')](_0x16ffd6);}})[_0xb344('0x25')](function(_0x2b0fc9){if(_0x2b0fc9){return _0x2b0fc9?{'count':_0xbf256a,'rows':_0x2b0fc9}:null;}})[_0xb344('0x25')](respondWithResult(_0xa79b32,null))[_0xb344('0x47')](handleError(_0xa79b32,null));};exports['getDescriptions']=function(_0x5ea1e8,_0x3a4f5f,_0x4bbad3){var _0x299b6d={};var _0x548f1a={};var _0x2ada6b;var _0x55bed0;return db[_0xb344('0x2b')][_0xb344('0x4b')]({'where':{'id':_0x5ea1e8['params']['id']}})[_0xb344('0x25')](handleEntityNotFound(_0x3a4f5f,null))['then'](function(_0x4e7b6f){if(_0x4e7b6f){_0x2ada6b=_0x4e7b6f;_0x548f1a[_0xb344('0x2e')]=_[_0xb344('0x43')](db[_0xb344('0x4c')]['rawAttributes']);_0x548f1a[_0xb344('0x2f')]=_[_0xb344('0x43')](_0x5ea1e8[_0xb344('0x2f')]);_0x548f1a[_0xb344('0x30')]=_['intersection'](_0x548f1a[_0xb344('0x2e')],_0x548f1a[_0xb344('0x2f')]);_0x299b6d[_0xb344('0x33')]=_[_0xb344('0x31')](_0x548f1a[_0xb344('0x2e')],qs['fields'](_0x5ea1e8[_0xb344('0x2f')][_0xb344('0x32')]));_0x299b6d[_0xb344('0x33')]=_0x299b6d[_0xb344('0x33')][_0xb344('0x34')]?_0x299b6d[_0xb344('0x33')]:_0x548f1a[_0xb344('0x2e')];_0x299b6d[_0xb344('0x37')]=qs['sort'](_0x5ea1e8['query'][_0xb344('0x38')]);_0x299b6d['where']=qs['filters'](_[_0xb344('0x3a')](_0x5ea1e8['query'],_0x548f1a[_0xb344('0x30')]));if(_0x5ea1e8[_0xb344('0x2f')][_0xb344('0x4d')]){_0x299b6d[_0xb344('0x39')]=_[_0xb344('0x3b')](_0x299b6d[_0xb344('0x39')],{'$or':_['map'](_0x299b6d['attributes'],function(_0x36b786){var _0x4ff98d={};_0x4ff98d[_0x36b786]={'$like':'%'+_0x5ea1e8[_0xb344('0x2f')][_0xb344('0x4d')]+'%'};return _0x4ff98d;})});}_0x299b6d=_[_0xb344('0x3b')]({},_0x299b6d,_0x5ea1e8[_0xb344('0x45')]);return _0x2ada6b['getDescriptions'](_0x299b6d);}})[_0xb344('0x25')](function(_0x3e1056){if(_0x3e1056){_0x55bed0=_0x3e1056[_0xb344('0x34')];if(!_0x5ea1e8[_0xb344('0x2f')]['hasOwnProperty'](_0xb344('0x36'))){_0x299b6d[_0xb344('0x1b')]=qs[_0xb344('0x1b')](_0x5ea1e8['query'][_0xb344('0x1b')]);_0x299b6d[_0xb344('0x1a')]=qs[_0xb344('0x1a')](_0x5ea1e8[_0xb344('0x2f')][_0xb344('0x1a')]);}return _0x2ada6b[_0xb344('0x4e')](_0x299b6d);}})[_0xb344('0x25')](function(_0x2bb2d0){if(_0x2bb2d0){return _0x2bb2d0?{'count':_0x55bed0,'rows':_0x2bb2d0}:null;}})[_0xb344('0x25')](respondWithResult(_0x3a4f5f,null))['catch'](handleError(_0x3a4f5f,null));};exports[_0xb344('0x4f')]=function(_0x1fe0f9,_0x3adc36,_0x46a53c){var _0x5dd478={};var _0x5723cd={};var _0x240244;var _0x1a0944;return db[_0xb344('0x2b')][_0xb344('0x4b')]({'where':{'id':_0x1fe0f9[_0xb344('0x42')]['id']}})[_0xb344('0x25')](handleEntityNotFound(_0x3adc36,null))[_0xb344('0x25')](function(_0x3f3c9d){if(_0x3f3c9d){_0x240244=_0x3f3c9d;_0x5723cd[_0xb344('0x2e')]=_[_0xb344('0x43')](db[_0xb344('0x4c')][_0xb344('0x44')]);_0x5723cd['query']=_[_0xb344('0x43')](_0x1fe0f9[_0xb344('0x2f')]);_0x5723cd[_0xb344('0x30')]=_[_0xb344('0x31')](_0x5723cd[_0xb344('0x2e')],_0x5723cd['query']);_0x5dd478[_0xb344('0x33')]=_['intersection'](_0x5723cd[_0xb344('0x2e')],qs[_0xb344('0x32')](_0x1fe0f9[_0xb344('0x2f')][_0xb344('0x32')]));_0x5dd478['attributes']=_0x5dd478['attributes']['length']?_0x5dd478[_0xb344('0x33')]:_0x5723cd[_0xb344('0x2e')];_0x5dd478['order']=qs[_0xb344('0x38')](_0x1fe0f9[_0xb344('0x2f')]['sort']);_0x5dd478[_0xb344('0x39')]=qs[_0xb344('0x30')](_[_0xb344('0x3a')](_0x1fe0f9[_0xb344('0x2f')],_0x5723cd[_0xb344('0x30')]));if(_0x1fe0f9[_0xb344('0x2f')][_0xb344('0x4d')]){_0x5dd478[_0xb344('0x39')]=_['merge'](_0x5dd478[_0xb344('0x39')],{'$or':_['map'](_0x5dd478[_0xb344('0x33')],function(_0x13875f){var _0x10b750={};_0x10b750[_0x13875f]={'$like':'%'+_0x1fe0f9[_0xb344('0x2f')][_0xb344('0x4d')]+'%'};return _0x10b750;})});}_0x5dd478=_[_0xb344('0x3b')]({},_0x5dd478,_0x1fe0f9[_0xb344('0x45')]);return _0x240244[_0xb344('0x4f')](_0x5dd478);}})[_0xb344('0x25')](function(_0x2ab6e8){if(_0x2ab6e8){_0x1a0944=_0x2ab6e8['length'];if(!_0x1fe0f9[_0xb344('0x2f')][_0xb344('0x35')]('nolimit')){_0x5dd478[_0xb344('0x1b')]=qs[_0xb344('0x1b')](_0x1fe0f9['query'][_0xb344('0x1b')]);_0x5dd478[_0xb344('0x1a')]=qs[_0xb344('0x1a')](_0x1fe0f9[_0xb344('0x2f')]['offset']);}return _0x240244[_0xb344('0x4f')](_0x5dd478);}})[_0xb344('0x25')](function(_0x25cee2){if(_0x25cee2){return _0x25cee2?{'count':_0x1a0944,'rows':_0x25cee2}:null;}})[_0xb344('0x25')](respondWithResult(_0x3adc36,null))[_0xb344('0x47')](handleError(_0x3adc36,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index eb14e43..1ff0aea 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 _0x7e26=['path','rimraf','exports','FreshsalesConfiguration','lodash','util','../../config/logger','bluebird'];(function(_0x39692f,_0xf32aeb){var _0x228923=function(_0x268ff3){while(--_0x268ff3){_0x39692f['push'](_0x39692f['shift']());}};_0x228923(++_0xf32aeb);}(_0x7e26,0x164));var _0x67e2=function(_0x26ddbd,_0x2bee79){_0x26ddbd=_0x26ddbd-0x0;var _0x206719=_0x7e26[_0x26ddbd];return _0x206719;};'use strict';var _=require(_0x67e2('0x0'));var util=require(_0x67e2('0x1'));var logger=require(_0x67e2('0x2'))('api');var moment=require('moment');var BPromise=require(_0x67e2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x67e2('0x4'));var rimraf=require(_0x67e2('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x67e2('0x6')]=function(_0x37c7c7,_0x243030){return _0x37c7c7['define'](_0x67e2('0x7'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4653=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4653,0x131));var _0x3465=function(_0x380a76,_0x3111c9){_0x380a76=_0x380a76-0x0;var _0x2f6160=_0x4653[_0x380a76];return _0x2f6160;};'use strict';var _=require(_0x3465('0x0'));var util=require(_0x3465('0x1'));var logger=require(_0x3465('0x2'))(_0x3465('0x3'));var moment=require(_0x3465('0x4'));var BPromise=require(_0x3465('0x5'));var rp=require(_0x3465('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3465('0x7'));var config=require(_0x3465('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x3465('0x9')]=function(_0x1ae677,_0x5a9146){return _0x1ae677[_0x3465('0xa')]('FreshsalesConfiguration',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 378a627..cd743ec 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 _0xf5a6=['result','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x73ea7e,_0x33fc83){var _0x15f467=function(_0xa5bc47){while(--_0xa5bc47){_0x73ea7e['push'](_0x73ea7e['shift']());}};_0x15f467(++_0x33fc83);}(_0xf5a6,0xbf));var _0x6f5a=function(_0xa35e79,_0x429d07){_0xa35e79=_0xa35e79-0x0;var _0x5384c7=_0xf5a6[_0xa35e79];return _0x5384c7;};'use strict';var _=require('lodash');var util=require(_0x6f5a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6f5a('0x1'));var fs=require('fs');var Redis=require(_0x6f5a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f5a('0x3'));var logger=require(_0x6f5a('0x4'))(_0x6f5a('0x5'));var config=require(_0x6f5a('0x6'));var jayson=require(_0x6f5a('0x7'));var client=jayson[_0x6f5a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x187a68,_0x7da111,_0x45b9e7){return new BPromise(function(_0x36d0c3,_0x10a8e1){return client[_0x6f5a('0x9')](_0x187a68,_0x45b9e7)['then'](function(_0x116785){logger[_0x6f5a('0xa')](_0x6f5a('0xb'),_0x7da111,_0x6f5a('0xc'));logger[_0x6f5a('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x7da111,_0x6f5a('0xc'),JSON[_0x6f5a('0xe')](_0x116785));if(_0x116785[_0x6f5a('0xf')]){if(_0x116785[_0x6f5a('0xf')][_0x6f5a('0x10')]===0x1f4){logger[_0x6f5a('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x7da111,_0x116785['error']['message']);return _0x10a8e1(_0x116785[_0x6f5a('0xf')][_0x6f5a('0x11')]);}logger[_0x6f5a('0xf')](_0x6f5a('0xb'),_0x7da111,_0x116785['error'][_0x6f5a('0x11')]);return _0x36d0c3(_0x116785[_0x6f5a('0xf')]['message']);}else{logger['info'](_0x6f5a('0xb'),_0x7da111,_0x6f5a('0xc'));_0x36d0c3(_0x116785[_0x6f5a('0x12')][_0x6f5a('0x11')]);}})['catch'](function(_0x4c7c06){logger['error'](_0x6f5a('0xb'),_0x7da111,_0x4c7c06);_0x10a8e1(_0x4c7c06);});});} \ No newline at end of file +var _0x742c=['then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x36c16a,_0x492ad7){var _0x24727f=function(_0x2fe567){while(--_0x2fe567){_0x36c16a['push'](_0x36c16a['shift']());}};_0x24727f(++_0x492ad7);}(_0x742c,0x192));var _0xc742=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0x742c[_0x28394f];return _0x2618d2;};'use strict';var _=require(_0xc742('0x0'));var util=require(_0xc742('0x1'));var moment=require(_0xc742('0x2'));var BPromise=require(_0xc742('0x3'));var rs=require(_0xc742('0x4'));var fs=require('fs');var Redis=require(_0xc742('0x5'));var db=require(_0xc742('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc742('0x7'))('rpc');var config=require(_0xc742('0x8'));var jayson=require(_0xc742('0x9'));var client=jayson['client'][_0xc742('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c1f8a,_0x46d7e7,_0x2a2f95){return new BPromise(function(_0x42dfd4,_0x4eb180){return client[_0xc742('0xb')](_0x4c1f8a,_0x2a2f95)[_0xc742('0xc')](function(_0x574667){logger[_0xc742('0xd')](_0xc742('0xe'),_0x46d7e7,'request\x20sent');logger[_0xc742('0xf')](_0xc742('0x10'),_0x46d7e7,_0xc742('0x11'),JSON['stringify'](_0x574667));if(_0x574667['error']){if(_0x574667['error'][_0xc742('0x12')]===0x1f4){logger['error'](_0xc742('0xe'),_0x46d7e7,_0x574667[_0xc742('0x13')][_0xc742('0x14')]);return _0x4eb180(_0x574667['error'][_0xc742('0x14')]);}logger[_0xc742('0x13')](_0xc742('0xe'),_0x46d7e7,_0x574667[_0xc742('0x13')][_0xc742('0x14')]);return _0x42dfd4(_0x574667[_0xc742('0x13')]['message']);}else{logger[_0xc742('0xd')](_0xc742('0xe'),_0x46d7e7,'request\x20sent');_0x42dfd4(_0x574667[_0xc742('0x15')][_0xc742('0x14')]);}})[_0xc742('0x16')](function(_0x54795){logger[_0xc742('0x13')](_0xc742('0xe'),_0x46d7e7,_0x54795);_0x4eb180(_0x54795);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index ddc8813..0f292d5 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 _0x2392=['get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x5f4dd2,_0x50441f){var _0x303498=function(_0xdf4382){while(--_0xdf4382){_0x5f4dd2['push'](_0x5f4dd2['shift']());}};_0x303498(++_0x50441f);}(_0x2392,0xd0));var _0x2239=function(_0x3af4f4,_0x54fe36){_0x3af4f4=_0x3af4f4-0x0;var _0x48cd1b=_0x2392[_0x3af4f4];return _0x48cd1b;};'use strict';var multer=require(_0x2239('0x0'));var util=require(_0x2239('0x1'));var path=require('path');var timeout=require(_0x2239('0x2'));var express=require(_0x2239('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2239('0x4'));var interaction=require(_0x2239('0x5'));var config=require(_0x2239('0x6'));var controller=require(_0x2239('0x7'));router[_0x2239('0x8')]('/',auth[_0x2239('0x9')](),controller[_0x2239('0xa')]);router[_0x2239('0x8')](_0x2239('0xb'),auth[_0x2239('0x9')](),controller[_0x2239('0xc')]);router[_0x2239('0xd')]('/',auth[_0x2239('0x9')](),controller['create']);router[_0x2239('0xe')](_0x2239('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x2239('0xf')](_0x2239('0xb'),auth[_0x2239('0x9')](),controller[_0x2239('0x10')]);module[_0x2239('0x11')]=router; \ No newline at end of file +var _0xe356=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','put'];(function(_0x113c1d,_0x460c81){var _0xced497=function(_0x3f8d9b){while(--_0x3f8d9b){_0x113c1d['push'](_0x113c1d['shift']());}};_0xced497(++_0x460c81);}(_0xe356,0x1ee));var _0x6e35=function(_0x3adb0e,_0x464843){_0x3adb0e=_0x3adb0e-0x0;var _0x154245=_0xe356[_0x3adb0e];return _0x154245;};'use strict';var multer=require(_0x6e35('0x0'));var util=require(_0x6e35('0x1'));var path=require(_0x6e35('0x2'));var timeout=require(_0x6e35('0x3'));var express=require('express');var router=express[_0x6e35('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6e35('0x5'));var interaction=require(_0x6e35('0x6'));var config=require(_0x6e35('0x7'));var controller=require('./intFreshsalesField.controller');router[_0x6e35('0x8')]('/',auth[_0x6e35('0x9')](),controller['index']);router[_0x6e35('0x8')](_0x6e35('0xa'),auth[_0x6e35('0x9')](),controller[_0x6e35('0xb')]);router['post']('/',auth[_0x6e35('0x9')](),controller['create']);router[_0x6e35('0xc')]('/:id',auth[_0x6e35('0x9')](),controller['update']);router['delete'](_0x6e35('0xa'),auth[_0x6e35('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 5596671..243e658 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 _0xb05f=['keyValue','STRING','exports','ENUM','string','variable','customVariable'];(function(_0x26bbd1,_0xb274f3){var _0x26b1eb=function(_0x4cf794){while(--_0x4cf794){_0x26bbd1['push'](_0x26bbd1['shift']());}};_0x26b1eb(++_0xb274f3);}(_0xb05f,0x1d7));var _0xfb05=function(_0x53e744,_0x2a0f0f){_0x53e744=_0x53e744-0x0;var _0x3009cc=_0xb05f[_0x53e744];return _0x3009cc;};'use strict';var Sequelize=require('sequelize');module[_0xfb05('0x0')]={'type':{'type':Sequelize[_0xfb05('0x1')](_0xfb05('0x2'),_0xfb05('0x3'),_0xfb05('0x4'),_0xfb05('0x5'),'picklist'),'defaultValue':_0xfb05('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xfb05('0x6')]},'keyType':{'type':Sequelize[_0xfb05('0x1')]('string',_0xfb05('0x3'),_0xfb05('0x4'))},'keyContent':{'type':Sequelize[_0xfb05('0x6')]},'idField':{'type':Sequelize[_0xfb05('0x6')]},'nameField':{'type':Sequelize[_0xfb05('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfb05('0x6')]}}; \ No newline at end of file +var _0xc922=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x5f1f63,_0x740dbf){var _0x4ff682=function(_0x1b1395){while(--_0x1b1395){_0x5f1f63['push'](_0x5f1f63['shift']());}};_0x4ff682(++_0x740dbf);}(_0xc922,0x8c));var _0x2c92=function(_0x56666c,_0x38dd4d){_0x56666c=_0x56666c-0x0;var _0x5148ba=_0xc922[_0x56666c];return _0x5148ba;};'use strict';var Sequelize=require(_0x2c92('0x0'));module[_0x2c92('0x1')]={'type':{'type':Sequelize[_0x2c92('0x2')](_0x2c92('0x3'),_0x2c92('0x4'),_0x2c92('0x5'),_0x2c92('0x6'),_0x2c92('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2c92('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2c92('0x2')](_0x2c92('0x3'),_0x2c92('0x4'),_0x2c92('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2c92('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2c92('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2c92('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 27a4ac5..b38305d 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 _0xbf6d=['apply','reject','update','then','error','stack','name','send','index','map','FreshsalesField','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','filter','options','count','includeAll','include','findAll','show','rawAttributes','create','body','catch','find','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','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','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range'];(function(_0x4d5721,_0x51a33d){var _0x88a224=function(_0x2b2609){while(--_0x2b2609){_0x4d5721['push'](_0x4d5721['shift']());}};_0x88a224(++_0x51a33d);}(_0xbf6d,0x15a));var _0xdbf6=function(_0x99d37,_0x4e7974){_0x99d37=_0x99d37-0x0;var _0x2db098=_0xbf6d[_0x99d37];return _0x2db098;};'use strict';var emlformat=require(_0xdbf6('0x0'));var rimraf=require(_0xdbf6('0x1'));var zipdir=require(_0xdbf6('0x2'));var jsonpatch=require(_0xdbf6('0x3'));var rp=require(_0xdbf6('0x4'));var moment=require(_0xdbf6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdbf6('0x6'));var util=require(_0xdbf6('0x7'));var path=require(_0xdbf6('0x8'));var sox=require('sox');var csv=require(_0xdbf6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdbf6('0xa'));var _=require(_0xdbf6('0xb'));var squel=require('squel');var crypto=require(_0xdbf6('0xc'));var jsforce=require(_0xdbf6('0xd'));var deskjs=require(_0xdbf6('0xe'));var toCsv=require(_0xdbf6('0x9'));var querystring=require(_0xdbf6('0xf'));var Papa=require('papaparse');var Redis=require(_0xdbf6('0x10'));var authService=require(_0xdbf6('0x11'));var qs=require(_0xdbf6('0x12'));var as=require(_0xdbf6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdbf6('0x14'))(_0xdbf6('0x15'));var utils=require(_0xdbf6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdbf6('0x17'));var db=require(_0xdbf6('0x18'))['db'];function respondWithStatusCode(_0x50667d,_0x52359c){_0x52359c=_0x52359c||0xcc;return function(_0x2d58c4){if(_0x2d58c4){return _0x50667d[_0xdbf6('0x19')](_0x52359c);}return _0x50667d[_0xdbf6('0x1a')](_0x52359c)[_0xdbf6('0x1b')]();};}function respondWithResult(_0x5185a1,_0x147280){_0x147280=_0x147280||0xc8;return function(_0x399212){if(_0x399212){return _0x5185a1[_0xdbf6('0x1a')](_0x147280)[_0xdbf6('0x1c')](_0x399212);}};}function respondWithFilteredResult(_0x54ebb6,_0xa7af77){return function(_0x4850cf){if(_0x4850cf){var _0x8a9ff=typeof _0xa7af77[_0xdbf6('0x1d')]===_0xdbf6('0x1e')&&typeof _0xa7af77[_0xdbf6('0x1f')]===_0xdbf6('0x1e');var _0x176208=_0x4850cf['count'];var _0x3000cb=_0x8a9ff?0x0:_0xa7af77[_0xdbf6('0x1d')];var _0x2266c1=_0x8a9ff?_0x4850cf['count']:_0xa7af77[_0xdbf6('0x1d')]+_0xa7af77['limit'];var _0x22a4ec;if(_0x2266c1>=_0x176208){_0x2266c1=_0x176208;_0x22a4ec=0xc8;}else{_0x22a4ec=0xce;}_0x54ebb6[_0xdbf6('0x1a')](_0x22a4ec);return _0x54ebb6[_0xdbf6('0x20')](_0xdbf6('0x21'),_0x3000cb+'-'+_0x2266c1+'/'+_0x176208)['json'](_0x4850cf);}return null;};}function patchUpdates(_0x2855da){return function(_0x449669){try{jsonpatch[_0xdbf6('0x22')](_0x449669,_0x2855da,!![]);}catch(_0x51df10){return BPromise[_0xdbf6('0x23')](_0x51df10);}return _0x449669['save']();};}function saveUpdates(_0xd7a9bc,_0x331e87){return function(_0x582285){if(_0x582285){return _0x582285[_0xdbf6('0x24')](_0xd7a9bc)[_0xdbf6('0x25')](function(_0x3b57af){return _0x3b57af;});}return null;};}function removeEntity(_0x44d970,_0x1fa2df){return function(_0x177304){if(_0x177304){return _0x177304['destroy']()['then'](function(){_0x44d970[_0xdbf6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b7e72,_0x46eabe){return function(_0x468a0a){if(!_0x468a0a){_0x4b7e72[_0xdbf6('0x19')](0x194);}return _0x468a0a;};}function handleError(_0x2262e6,_0x3e0955){_0x3e0955=_0x3e0955||0x1f4;return function(_0x248aab){logger[_0xdbf6('0x26')](_0x248aab[_0xdbf6('0x27')]);if(_0x248aab[_0xdbf6('0x28')]){delete _0x248aab[_0xdbf6('0x28')];}_0x2262e6[_0xdbf6('0x1a')](_0x3e0955)[_0xdbf6('0x29')](_0x248aab);};}exports[_0xdbf6('0x2a')]=function(_0x30f308,_0x12f22e){var _0x2c13df={},_0x33865a={},_0x1b6041={'count':0x0,'rows':[]};var _0x1e6304=_[_0xdbf6('0x2b')](db[_0xdbf6('0x2c')]['rawAttributes'],function(_0x178d3f){return{'name':_0x178d3f[_0xdbf6('0x2d')],'type':_0x178d3f['type']['key']};});_0x33865a[_0xdbf6('0x2e')]=_[_0xdbf6('0x2b')](_0x1e6304,_0xdbf6('0x28'));_0x33865a[_0xdbf6('0x2f')]=_[_0xdbf6('0x30')](_0x30f308['query']);_0x33865a['filters']=_[_0xdbf6('0x31')](_0x33865a[_0xdbf6('0x2e')],_0x33865a['query']);_0x2c13df[_0xdbf6('0x32')]=_[_0xdbf6('0x31')](_0x33865a['model'],qs['fields'](_0x30f308['query'][_0xdbf6('0x33')]));_0x2c13df[_0xdbf6('0x32')]=_0x2c13df['attributes'][_0xdbf6('0x34')]?_0x2c13df[_0xdbf6('0x32')]:_0x33865a[_0xdbf6('0x2e')];if(!_0x30f308['query'][_0xdbf6('0x35')](_0xdbf6('0x36'))){_0x2c13df['limit']=qs[_0xdbf6('0x1f')](_0x30f308[_0xdbf6('0x2f')][_0xdbf6('0x1f')]);_0x2c13df[_0xdbf6('0x1d')]=qs[_0xdbf6('0x1d')](_0x30f308[_0xdbf6('0x2f')][_0xdbf6('0x1d')]);}_0x2c13df[_0xdbf6('0x37')]=qs[_0xdbf6('0x38')](_0x30f308['query'][_0xdbf6('0x38')]);_0x2c13df[_0xdbf6('0x39')]=qs[_0xdbf6('0x3a')](_[_0xdbf6('0x3b')](_0x30f308[_0xdbf6('0x2f')],_0x33865a[_0xdbf6('0x3a')]),_0x1e6304);if(_0x30f308['query']['filter']){_0x2c13df[_0xdbf6('0x39')]=_[_0xdbf6('0x3c')](_0x2c13df[_0xdbf6('0x39')],{'$or':_['map'](_0x1e6304,function(_0x4047f0){if(_0x4047f0[_0xdbf6('0x3d')]!=='VIRTUAL'){var _0x139ae0={};_0x139ae0[_0x4047f0[_0xdbf6('0x28')]]={'$like':'%'+_0x30f308['query'][_0xdbf6('0x3e')]+'%'};return _0x139ae0;}})});}_0x2c13df=_[_0xdbf6('0x3c')]({},_0x2c13df,_0x30f308[_0xdbf6('0x3f')]);var _0x4d97f8={'where':_0x2c13df[_0xdbf6('0x39')]};return db[_0xdbf6('0x2c')][_0xdbf6('0x40')](_0x4d97f8)[_0xdbf6('0x25')](function(_0x3f4115){_0x1b6041['count']=_0x3f4115;if(_0x30f308[_0xdbf6('0x2f')][_0xdbf6('0x41')]){_0x2c13df[_0xdbf6('0x42')]=[{'all':!![]}];}return db[_0xdbf6('0x2c')][_0xdbf6('0x43')](_0x2c13df);})[_0xdbf6('0x25')](function(_0x485f74){_0x1b6041['rows']=_0x485f74;return _0x1b6041;})[_0xdbf6('0x25')](respondWithFilteredResult(_0x12f22e,_0x2c13df))['catch'](handleError(_0x12f22e,null));};exports[_0xdbf6('0x44')]=function(_0x3af884,_0x2dc6e8){var _0x17fa6f={'raw':!![],'where':{'id':_0x3af884['params']['id']}},_0x377a38={};_0x377a38[_0xdbf6('0x2e')]=_[_0xdbf6('0x30')](db['FreshsalesField'][_0xdbf6('0x45')]);_0x377a38['query']=_['keys'](_0x3af884['query']);_0x377a38[_0xdbf6('0x3a')]=_[_0xdbf6('0x31')](_0x377a38[_0xdbf6('0x2e')],_0x377a38['query']);_0x17fa6f[_0xdbf6('0x32')]=_[_0xdbf6('0x31')](_0x377a38[_0xdbf6('0x2e')],qs[_0xdbf6('0x33')](_0x3af884[_0xdbf6('0x2f')][_0xdbf6('0x33')]));_0x17fa6f[_0xdbf6('0x32')]=_0x17fa6f[_0xdbf6('0x32')]['length']?_0x17fa6f['attributes']:_0x377a38[_0xdbf6('0x2e')];if(_0x3af884[_0xdbf6('0x2f')]['includeAll']){_0x17fa6f['include']=[{'all':!![]}];}_0x17fa6f=_[_0xdbf6('0x3c')]({},_0x17fa6f,_0x3af884[_0xdbf6('0x3f')]);return db[_0xdbf6('0x2c')]['find'](_0x17fa6f)['then'](handleEntityNotFound(_0x2dc6e8,null))['then'](respondWithResult(_0x2dc6e8,null))['catch'](handleError(_0x2dc6e8,null));};exports[_0xdbf6('0x46')]=function(_0x1112bd,_0x267b30){return db[_0xdbf6('0x2c')][_0xdbf6('0x46')](_0x1112bd[_0xdbf6('0x47')],{})[_0xdbf6('0x25')](respondWithResult(_0x267b30,0xc9))[_0xdbf6('0x48')](handleError(_0x267b30,null));};exports[_0xdbf6('0x24')]=function(_0x64cdc6,_0x3ccd41){if(_0x64cdc6[_0xdbf6('0x47')]['id']){delete _0x64cdc6[_0xdbf6('0x47')]['id'];}return db[_0xdbf6('0x2c')][_0xdbf6('0x49')]({'where':{'id':_0x64cdc6[_0xdbf6('0x4a')]['id']}})[_0xdbf6('0x25')](handleEntityNotFound(_0x3ccd41,null))[_0xdbf6('0x25')](saveUpdates(_0x64cdc6[_0xdbf6('0x47')],null))['then'](respondWithResult(_0x3ccd41,null))[_0xdbf6('0x48')](handleError(_0x3ccd41,null));};exports[_0xdbf6('0x4b')]=function(_0x34cb6b,_0x467e91){return db['FreshsalesField'][_0xdbf6('0x49')]({'where':{'id':_0x34cb6b['params']['id']}})[_0xdbf6('0x25')](handleEntityNotFound(_0x467e91,null))[_0xdbf6('0x25')](removeEntity(_0x467e91,null))['catch'](handleError(_0x467e91,null));}; \ No newline at end of file +var _0xd8da=['catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows'];(function(_0xec722a,_0x354472){var _0xbb0f9e=function(_0x2a017b){while(--_0x2a017b){_0xec722a['push'](_0xec722a['shift']());}};_0xbb0f9e(++_0x354472);}(_0xd8da,0x9d));var _0xad8d=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xd8da[_0xd1d19a];return _0x52a79d;};'use strict';var emlformat=require(_0xad8d('0x0'));var rimraf=require(_0xad8d('0x1'));var zipdir=require(_0xad8d('0x2'));var jsonpatch=require(_0xad8d('0x3'));var rp=require(_0xad8d('0x4'));var moment=require(_0xad8d('0x5'));var BPromise=require(_0xad8d('0x6'));var Mustache=require(_0xad8d('0x7'));var util=require(_0xad8d('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xad8d('0x9'));var fs=require('fs');var fs_extra=require(_0xad8d('0xa'));var _=require('lodash');var squel=require(_0xad8d('0xb'));var crypto=require(_0xad8d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xad8d('0xd'));var toCsv=require(_0xad8d('0xe'));var querystring=require(_0xad8d('0xf'));var Papa=require('papaparse');var Redis=require(_0xad8d('0x10'));var authService=require(_0xad8d('0x11'));var qs=require(_0xad8d('0x12'));var as=require(_0xad8d('0x13'));var hardwareService=require(_0xad8d('0x14'));var logger=require(_0xad8d('0x15'))(_0xad8d('0x16'));var utils=require(_0xad8d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xad8d('0x18'))['db'];function respondWithStatusCode(_0x243ebf,_0x3022e3){_0x3022e3=_0x3022e3||0xcc;return function(_0x41f9d4){if(_0x41f9d4){return _0x243ebf[_0xad8d('0x19')](_0x3022e3);}return _0x243ebf[_0xad8d('0x1a')](_0x3022e3)[_0xad8d('0x1b')]();};}function respondWithResult(_0x553900,_0x3b3483){_0x3b3483=_0x3b3483||0xc8;return function(_0x530a4b){if(_0x530a4b){return _0x553900[_0xad8d('0x1a')](_0x3b3483)[_0xad8d('0x1c')](_0x530a4b);}};}function respondWithFilteredResult(_0x2a4606,_0x1509a0){return function(_0x3ff95c){if(_0x3ff95c){var _0x44e1c7=typeof _0x1509a0[_0xad8d('0x1d')]==='undefined'&&typeof _0x1509a0['limit']==='undefined';var _0x5797bc=_0x3ff95c[_0xad8d('0x1e')];var _0x3e6074=_0x44e1c7?0x0:_0x1509a0[_0xad8d('0x1d')];var _0x2ac802=_0x44e1c7?_0x3ff95c[_0xad8d('0x1e')]:_0x1509a0['offset']+_0x1509a0[_0xad8d('0x1f')];var _0x511849;if(_0x2ac802>=_0x5797bc){_0x2ac802=_0x5797bc;_0x511849=0xc8;}else{_0x511849=0xce;}_0x2a4606['status'](_0x511849);return _0x2a4606[_0xad8d('0x20')](_0xad8d('0x21'),_0x3e6074+'-'+_0x2ac802+'/'+_0x5797bc)[_0xad8d('0x1c')](_0x3ff95c);}return null;};}function patchUpdates(_0x3b400f){return function(_0x58fef7){try{jsonpatch[_0xad8d('0x22')](_0x58fef7,_0x3b400f,!![]);}catch(_0x352012){return BPromise[_0xad8d('0x23')](_0x352012);}return _0x58fef7[_0xad8d('0x24')]();};}function saveUpdates(_0x11014d,_0x4e8d04){return function(_0x33c061){if(_0x33c061){return _0x33c061[_0xad8d('0x25')](_0x11014d)[_0xad8d('0x26')](function(_0x8074d9){return _0x8074d9;});}return null;};}function removeEntity(_0xb20d4e,_0x5190b2){return function(_0x5695ba){if(_0x5695ba){return _0x5695ba[_0xad8d('0x27')]()[_0xad8d('0x26')](function(){_0xb20d4e[_0xad8d('0x1a')](0xcc)[_0xad8d('0x1b')]();});}};}function handleEntityNotFound(_0x43e7e8,_0xa7a2ed){return function(_0x29a1e2){if(!_0x29a1e2){_0x43e7e8[_0xad8d('0x19')](0x194);}return _0x29a1e2;};}function handleError(_0xa4d012,_0x2fed39){_0x2fed39=_0x2fed39||0x1f4;return function(_0x2aaf7e){logger[_0xad8d('0x28')](_0x2aaf7e[_0xad8d('0x29')]);if(_0x2aaf7e['name']){delete _0x2aaf7e[_0xad8d('0x2a')];}_0xa4d012[_0xad8d('0x1a')](_0x2fed39)[_0xad8d('0x2b')](_0x2aaf7e);};}exports[_0xad8d('0x2c')]=function(_0x2c6eab,_0x57c6df){var _0x5d3671={},_0x4e077c={},_0x4ef061={'count':0x0,'rows':[]};var _0x4f6d79=_[_0xad8d('0x2d')](db[_0xad8d('0x2e')][_0xad8d('0x2f')],function(_0x1acc7d){return{'name':_0x1acc7d['fieldName'],'type':_0x1acc7d[_0xad8d('0x30')][_0xad8d('0x31')]};});_0x4e077c[_0xad8d('0x32')]=_['map'](_0x4f6d79,_0xad8d('0x2a'));_0x4e077c[_0xad8d('0x33')]=_[_0xad8d('0x34')](_0x2c6eab[_0xad8d('0x33')]);_0x4e077c[_0xad8d('0x35')]=_['intersection'](_0x4e077c['model'],_0x4e077c[_0xad8d('0x33')]);_0x5d3671[_0xad8d('0x36')]=_[_0xad8d('0x37')](_0x4e077c['model'],qs[_0xad8d('0x38')](_0x2c6eab[_0xad8d('0x33')]['fields']));_0x5d3671[_0xad8d('0x36')]=_0x5d3671['attributes'][_0xad8d('0x39')]?_0x5d3671[_0xad8d('0x36')]:_0x4e077c['model'];if(!_0x2c6eab[_0xad8d('0x33')]['hasOwnProperty'](_0xad8d('0x3a'))){_0x5d3671[_0xad8d('0x1f')]=qs[_0xad8d('0x1f')](_0x2c6eab[_0xad8d('0x33')][_0xad8d('0x1f')]);_0x5d3671[_0xad8d('0x1d')]=qs['offset'](_0x2c6eab[_0xad8d('0x33')]['offset']);}_0x5d3671[_0xad8d('0x3b')]=qs[_0xad8d('0x3c')](_0x2c6eab['query'][_0xad8d('0x3c')]);_0x5d3671[_0xad8d('0x3d')]=qs[_0xad8d('0x35')](_['pick'](_0x2c6eab[_0xad8d('0x33')],_0x4e077c[_0xad8d('0x35')]),_0x4f6d79);if(_0x2c6eab[_0xad8d('0x33')][_0xad8d('0x3e')]){_0x5d3671[_0xad8d('0x3d')]=_[_0xad8d('0x3f')](_0x5d3671[_0xad8d('0x3d')],{'$or':_[_0xad8d('0x2d')](_0x4f6d79,function(_0x2dc557){if(_0x2dc557['type']!==_0xad8d('0x40')){var _0x5f260e={};_0x5f260e[_0x2dc557[_0xad8d('0x2a')]]={'$like':'%'+_0x2c6eab[_0xad8d('0x33')][_0xad8d('0x3e')]+'%'};return _0x5f260e;}})});}_0x5d3671=_[_0xad8d('0x3f')]({},_0x5d3671,_0x2c6eab[_0xad8d('0x41')]);var _0x56e524={'where':_0x5d3671['where']};return db[_0xad8d('0x2e')]['count'](_0x56e524)['then'](function(_0x192a6c){_0x4ef061[_0xad8d('0x1e')]=_0x192a6c;if(_0x2c6eab[_0xad8d('0x33')]['includeAll']){_0x5d3671[_0xad8d('0x42')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x5d3671);})['then'](function(_0x3c7157){_0x4ef061[_0xad8d('0x43')]=_0x3c7157;return _0x4ef061;})['then'](respondWithFilteredResult(_0x57c6df,_0x5d3671))[_0xad8d('0x44')](handleError(_0x57c6df,null));};exports[_0xad8d('0x45')]=function(_0x4e9cc5,_0x478015){var _0x33f58b={'raw':!![],'where':{'id':_0x4e9cc5[_0xad8d('0x46')]['id']}},_0x42979c={};_0x42979c[_0xad8d('0x32')]=_[_0xad8d('0x34')](db[_0xad8d('0x2e')][_0xad8d('0x2f')]);_0x42979c[_0xad8d('0x33')]=_[_0xad8d('0x34')](_0x4e9cc5[_0xad8d('0x33')]);_0x42979c[_0xad8d('0x35')]=_[_0xad8d('0x37')](_0x42979c[_0xad8d('0x32')],_0x42979c[_0xad8d('0x33')]);_0x33f58b[_0xad8d('0x36')]=_[_0xad8d('0x37')](_0x42979c['model'],qs[_0xad8d('0x38')](_0x4e9cc5['query'][_0xad8d('0x38')]));_0x33f58b[_0xad8d('0x36')]=_0x33f58b['attributes'][_0xad8d('0x39')]?_0x33f58b[_0xad8d('0x36')]:_0x42979c[_0xad8d('0x32')];if(_0x4e9cc5[_0xad8d('0x33')][_0xad8d('0x47')]){_0x33f58b[_0xad8d('0x42')]=[{'all':!![]}];}_0x33f58b=_[_0xad8d('0x3f')]({},_0x33f58b,_0x4e9cc5['options']);return db[_0xad8d('0x2e')][_0xad8d('0x48')](_0x33f58b)['then'](handleEntityNotFound(_0x478015,null))[_0xad8d('0x26')](respondWithResult(_0x478015,null))[_0xad8d('0x44')](handleError(_0x478015,null));};exports[_0xad8d('0x49')]=function(_0x531e2d,_0x59979a){return db[_0xad8d('0x2e')][_0xad8d('0x49')](_0x531e2d[_0xad8d('0x4a')],{})[_0xad8d('0x26')](respondWithResult(_0x59979a,0xc9))['catch'](handleError(_0x59979a,null));};exports[_0xad8d('0x25')]=function(_0x1d8a51,_0x2a0389){if(_0x1d8a51['body']['id']){delete _0x1d8a51[_0xad8d('0x4a')]['id'];}return db[_0xad8d('0x2e')][_0xad8d('0x48')]({'where':{'id':_0x1d8a51[_0xad8d('0x46')]['id']}})[_0xad8d('0x26')](handleEntityNotFound(_0x2a0389,null))[_0xad8d('0x26')](saveUpdates(_0x1d8a51[_0xad8d('0x4a')],null))['then'](respondWithResult(_0x2a0389,null))[_0xad8d('0x44')](handleError(_0x2a0389,null));};exports[_0xad8d('0x27')]=function(_0x4f0bfd,_0x4bec22){return db[_0xad8d('0x2e')][_0xad8d('0x48')]({'where':{'id':_0x4f0bfd[_0xad8d('0x46')]['id']}})[_0xad8d('0x26')](handleEntityNotFound(_0x4bec22,null))[_0xad8d('0x26')](removeEntity(_0x4bec22,null))[_0xad8d('0x44')](handleError(_0x4bec22,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 53bcf0c..465cdbb 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 _0x0e21=['api','bluebird','request-promise','path','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','util','../../config/logger'];(function(_0x235622,_0x49aa66){var _0xbb0c4=function(_0x537ef4){while(--_0x537ef4){_0x235622['push'](_0x235622['shift']());}};_0xbb0c4(++_0x49aa66);}(_0x0e21,0xe8));var _0x10e2=function(_0x4b6e45,_0x2ef239){_0x4b6e45=_0x4b6e45-0x0;var _0x297e4c=_0x0e21[_0x4b6e45];return _0x297e4c;};'use strict';var _=require('lodash');var util=require(_0x10e2('0x0'));var logger=require(_0x10e2('0x1'))(_0x10e2('0x2'));var moment=require('moment');var BPromise=require(_0x10e2('0x3'));var rp=require(_0x10e2('0x4'));var fs=require('fs');var path=require(_0x10e2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x10e2('0x6'));module[_0x10e2('0x7')]=function(_0x2fb9e4,_0x44e30e){return _0x2fb9e4[_0x10e2('0x8')](_0x10e2('0x9'),attributes,{'tableName':_0x10e2('0xa'),'paranoid':![],'indexes':[{'name':_0x10e2('0xb'),'fields':[_0x10e2('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8374=['FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports'];(function(_0x5a0406,_0x4c79a1){var _0x5100b9=function(_0x44f0d1){while(--_0x44f0d1){_0x5a0406['push'](_0x5a0406['shift']());}};_0x5100b9(++_0x4c79a1);}(_0x8374,0x174));var _0x4837=function(_0x1b5a3e,_0x1787ac){_0x1b5a3e=_0x1b5a3e-0x0;var _0x2f4e29=_0x8374[_0x1b5a3e];return _0x2f4e29;};'use strict';var _=require(_0x4837('0x0'));var util=require(_0x4837('0x1'));var logger=require(_0x4837('0x2'))(_0x4837('0x3'));var moment=require(_0x4837('0x4'));var BPromise=require(_0x4837('0x5'));var rp=require(_0x4837('0x6'));var fs=require('fs');var path=require(_0x4837('0x7'));var rimraf=require(_0x4837('0x8'));var config=require(_0x4837('0x9'));var attributes=require(_0x4837('0xa'));module[_0x4837('0xb')]=function(_0x2bd5a7,_0x425c07){return _0x2bd5a7['define'](_0x4837('0xc'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x4837('0xd'),'fields':[_0x4837('0xe'),_0x4837('0xf')],'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 6777619..8f6747e 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 _0x3f8a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x583769,_0x3bb161){_0x583769=_0x583769-0x0;var _0x70593d=_0x3f8a[_0x583769];return _0x70593d;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('FreshsalesField,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});} \ No newline at end of file +var _0x5d58=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x188832,_0x49101d){var _0x2b990f=function(_0x231635){while(--_0x231635){_0x188832['push'](_0x188832['shift']());}};_0x2b990f(++_0x49101d);}(_0x5d58,0x187));var _0x85d5=function(_0x4a79f4,_0x29d823){_0x4a79f4=_0x4a79f4-0x0;var _0x2b69be=_0x5d58[_0x4a79f4];return _0x2b69be;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85d5('0x0'));var db=require(_0x85d5('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x85d5('0x2'))(_0x85d5('0x3'));var config=require('../../config/environment');var jayson=require(_0x85d5('0x4'));var client=jayson[_0x85d5('0x5')][_0x85d5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x46e7b4,_0x5f47ec,_0x98c963){return new BPromise(function(_0x3fecca,_0x4ca293){return client[_0x85d5('0x7')](_0x46e7b4,_0x98c963)['then'](function(_0x1098be){logger[_0x85d5('0x8')](_0x85d5('0x9'),_0x5f47ec,'request\x20sent');logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x5f47ec,_0x85d5('0xa'),JSON[_0x85d5('0xb')](_0x1098be));if(_0x1098be[_0x85d5('0xc')]){if(_0x1098be[_0x85d5('0xc')][_0x85d5('0xd')]===0x1f4){logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x1098be['error']['message']);return _0x4ca293(_0x1098be['error'][_0x85d5('0xe')]);}logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x1098be[_0x85d5('0xc')][_0x85d5('0xe')]);return _0x3fecca(_0x1098be[_0x85d5('0xc')][_0x85d5('0xe')]);}else{logger['info'](_0x85d5('0x9'),_0x5f47ec,_0x85d5('0xa'));_0x3fecca(_0x1098be[_0x85d5('0xf')][_0x85d5('0xe')]);}})[_0x85d5('0x10')](function(_0x3dc83c){logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x3dc83c);_0x4ca293(_0x3dc83c);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 34aa5c9..1c5553d 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(_0x374f2f,_0x121f48){var _0x3b2543=function(_0x2529fe){while(--_0x2529fe){_0x374f2f['push'](_0x374f2f['shift']());}};_0x3b2543(++_0x121f48);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x4fd05f,_0xff2d51){var _0x286aab=function(_0x1b7d55){while(--_0x1b7d55){_0x4fd05f['push'](_0x4fd05f['shift']());}};_0x286aab(++_0xff2d51);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 5c8c702..dda1927 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 _0x078f=['username','ENUM','integrationTab','newTab','exports','STRING'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0x078f,0x1b4));var _0xf078=function(_0x48c163,_0x2e74e6){_0x48c163=_0x48c163-0x0;var _0x395a7e=_0x078f[_0x48c163];return _0x395a7e;};'use strict';var Sequelize=require('sequelize');module[_0xf078('0x0')]={'name':{'type':Sequelize[_0xf078('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf078('0x1')],'unique':_0xf078('0x2')},'remoteUri':{'type':Sequelize[_0xf078('0x1')]},'password':{'type':Sequelize[_0xf078('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xf078('0x1')]},'securityToken':{'type':Sequelize[_0xf078('0x1')]},'serverUrl':{'type':Sequelize[_0xf078('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf078('0x3')](_0xf078('0x4'),_0xf078('0x5')),'defaultValue':_0xf078('0x4')}}; \ No newline at end of file +var _0xd61c=['ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x52b13d,_0x3ec3b2){var _0x25ef61=function(_0x416148){while(--_0x416148){_0x52b13d['push'](_0x52b13d['shift']());}};_0x25ef61(++_0x3ec3b2);}(_0xd61c,0xb1));var _0xcd61=function(_0x2201ad,_0x21fc1a){_0x2201ad=_0x2201ad-0x0;var _0x1be935=_0xd61c[_0x2201ad];return _0x1be935;};'use strict';var Sequelize=require(_0xcd61('0x0'));module[_0xcd61('0x1')]={'name':{'type':Sequelize[_0xcd61('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xcd61('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xcd61('0x2')]},'password':{'type':Sequelize[_0xcd61('0x2')]},'clientId':{'type':Sequelize[_0xcd61('0x2')]},'clientSecret':{'type':Sequelize[_0xcd61('0x2')]},'securityToken':{'type':Sequelize[_0xcd61('0x2')]},'serverUrl':{'type':Sequelize[_0xcd61('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xcd61('0x3')](_0xcd61('0x4'),_0xcd61('0x5')),'defaultValue':_0xcd61('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 140d5d3..419d16f 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 _0xfa4d=['key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','find','create','body','params','destroy','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','slice','substring','lastIndexOf','login','username','concat','isNil','ticketType','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','limit','undefined','count','offset','set','json','apply','reject','save','update','then','end','error','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type'];(function(_0x20a52f,_0x14f2e6){var _0x4ac92a=function(_0x1119a3){while(--_0x1119a3){_0x20a52f['push'](_0x20a52f['shift']());}};_0x4ac92a(++_0x14f2e6);}(_0xfa4d,0x159));var _0xdfa4=function(_0x1c6aa3,_0x1df236){_0x1c6aa3=_0x1c6aa3-0x0;var _0x409780=_0xfa4d[_0x1c6aa3];return _0x409780;};'use strict';var emlformat=require(_0xdfa4('0x0'));var rimraf=require(_0xdfa4('0x1'));var zipdir=require(_0xdfa4('0x2'));var jsonpatch=require(_0xdfa4('0x3'));var rp=require(_0xdfa4('0x4'));var moment=require(_0xdfa4('0x5'));var BPromise=require(_0xdfa4('0x6'));var Mustache=require(_0xdfa4('0x7'));var util=require(_0xdfa4('0x8'));var path=require(_0xdfa4('0x9'));var sox=require(_0xdfa4('0xa'));var csv=require(_0xdfa4('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdfa4('0xc'));var _=require(_0xdfa4('0xd'));var squel=require(_0xdfa4('0xe'));var crypto=require('crypto');var jsforce=require(_0xdfa4('0xf'));var deskjs=require(_0xdfa4('0x10'));var toCsv=require(_0xdfa4('0xb'));var querystring=require(_0xdfa4('0x11'));var Papa=require(_0xdfa4('0x12'));var Redis=require(_0xdfa4('0x13'));var authService=require(_0xdfa4('0x14'));var qs=require(_0xdfa4('0x15'));var as=require(_0xdfa4('0x16'));var hardwareService=require(_0xdfa4('0x17'));var logger=require(_0xdfa4('0x18'))(_0xdfa4('0x19'));var utils=require(_0xdfa4('0x1a'));var config=require(_0xdfa4('0x1b'));var licenseUtil=require(_0xdfa4('0x1c'));var db=require(_0xdfa4('0x1d'))['db'];var integrations=require(_0xdfa4('0x1e'));function respondWithStatusCode(_0x2d5176,_0xbe938b){_0xbe938b=_0xbe938b||0xcc;return function(_0x55aa31){if(_0x55aa31){return _0x2d5176[_0xdfa4('0x1f')](_0xbe938b);}return _0x2d5176['status'](_0xbe938b)['end']();};}function respondWithResult(_0x2dcf3a,_0x7c06c7){_0x7c06c7=_0x7c06c7||0xc8;return function(_0x5fbfb6){if(_0x5fbfb6){return _0x2dcf3a[_0xdfa4('0x20')](_0x7c06c7)['json'](_0x5fbfb6);}};}function respondWithFilteredResult(_0x31cddf,_0x5b7ebc){return function(_0x2b5c58){if(_0x2b5c58){var _0x3c1ef4=typeof _0x5b7ebc['offset']==='undefined'&&typeof _0x5b7ebc[_0xdfa4('0x21')]===_0xdfa4('0x22');var _0x34089e=_0x2b5c58[_0xdfa4('0x23')];var _0x1aeea4=_0x3c1ef4?0x0:_0x5b7ebc['offset'];var _0x2f4c19=_0x3c1ef4?_0x2b5c58['count']:_0x5b7ebc[_0xdfa4('0x24')]+_0x5b7ebc['limit'];var _0x5ae211;if(_0x2f4c19>=_0x34089e){_0x2f4c19=_0x34089e;_0x5ae211=0xc8;}else{_0x5ae211=0xce;}_0x31cddf[_0xdfa4('0x20')](_0x5ae211);return _0x31cddf[_0xdfa4('0x25')]('Content-Range',_0x1aeea4+'-'+_0x2f4c19+'/'+_0x34089e)[_0xdfa4('0x26')](_0x2b5c58);}return null;};}function patchUpdates(_0x2110b8){return function(_0x5917b7){try{jsonpatch[_0xdfa4('0x27')](_0x5917b7,_0x2110b8,!![]);}catch(_0x1e2e24){return BPromise[_0xdfa4('0x28')](_0x1e2e24);}return _0x5917b7[_0xdfa4('0x29')]();};}function saveUpdates(_0x5366ec,_0x27016e){return function(_0x37a516){if(_0x37a516){return _0x37a516[_0xdfa4('0x2a')](_0x5366ec)[_0xdfa4('0x2b')](function(_0x3eee06){return _0x3eee06;});}return null;};}function removeEntity(_0xcf776b,_0x1d3428){return function(_0x151bed){if(_0x151bed){return _0x151bed['destroy']()[_0xdfa4('0x2b')](function(){_0xcf776b[_0xdfa4('0x20')](0xcc)[_0xdfa4('0x2c')]();});}};}function handleEntityNotFound(_0x53deff,_0x11cb60){return function(_0x114e98){if(!_0x114e98){_0x53deff[_0xdfa4('0x1f')](0x194);}return _0x114e98;};}function handleError(_0x7f50ee,_0x27f929){_0x27f929=_0x27f929||0x1f4;return function(_0x22ab99){logger[_0xdfa4('0x2d')](_0x22ab99['stack']);if(_0x22ab99[_0xdfa4('0x2e')]){delete _0x22ab99[_0xdfa4('0x2e')];}_0x7f50ee[_0xdfa4('0x20')](_0x27f929)[_0xdfa4('0x2f')](_0x22ab99);};}exports[_0xdfa4('0x30')]=function(_0xe24a6,_0x33118f){var _0xbbb14={},_0x4496ca={},_0x4fd6b6={'count':0x0,'rows':[]};var _0x2a2c6c=_[_0xdfa4('0x31')](db[_0xdfa4('0x32')][_0xdfa4('0x33')],function(_0x29db4d){return{'name':_0x29db4d[_0xdfa4('0x34')],'type':_0x29db4d[_0xdfa4('0x35')][_0xdfa4('0x36')]};});_0x4496ca[_0xdfa4('0x37')]=_[_0xdfa4('0x31')](_0x2a2c6c,'name');_0x4496ca['query']=_[_0xdfa4('0x38')](_0xe24a6[_0xdfa4('0x39')]);_0x4496ca[_0xdfa4('0x3a')]=_['intersection'](_0x4496ca[_0xdfa4('0x37')],_0x4496ca[_0xdfa4('0x39')]);_0xbbb14[_0xdfa4('0x3b')]=_[_0xdfa4('0x3c')](_0x4496ca[_0xdfa4('0x37')],qs[_0xdfa4('0x3d')](_0xe24a6['query'][_0xdfa4('0x3d')]));_0xbbb14[_0xdfa4('0x3b')]=_0xbbb14['attributes'][_0xdfa4('0x3e')]?_0xbbb14[_0xdfa4('0x3b')]:_0x4496ca[_0xdfa4('0x37')];if(!_0xe24a6['query'][_0xdfa4('0x3f')]('nolimit')){_0xbbb14[_0xdfa4('0x21')]=qs[_0xdfa4('0x21')](_0xe24a6[_0xdfa4('0x39')][_0xdfa4('0x21')]);_0xbbb14['offset']=qs[_0xdfa4('0x24')](_0xe24a6['query'][_0xdfa4('0x24')]);}_0xbbb14[_0xdfa4('0x40')]=qs[_0xdfa4('0x41')](_0xe24a6[_0xdfa4('0x39')][_0xdfa4('0x41')]);_0xbbb14[_0xdfa4('0x42')]=qs['filters'](_[_0xdfa4('0x43')](_0xe24a6[_0xdfa4('0x39')],_0x4496ca[_0xdfa4('0x3a')]),_0x2a2c6c);if(_0xe24a6['query'][_0xdfa4('0x44')]){_0xbbb14[_0xdfa4('0x42')]=_[_0xdfa4('0x45')](_0xbbb14['where'],{'$or':_[_0xdfa4('0x31')](_0x2a2c6c,function(_0x21fa7e){if(_0x21fa7e[_0xdfa4('0x35')]!==_0xdfa4('0x46')){var _0x323db8={};_0x323db8[_0x21fa7e[_0xdfa4('0x2e')]]={'$like':'%'+_0xe24a6[_0xdfa4('0x39')][_0xdfa4('0x44')]+'%'};return _0x323db8;}})});}_0xbbb14=_['merge']({},_0xbbb14,_0xe24a6[_0xdfa4('0x47')]);var _0x194be1={'where':_0xbbb14['where']};return db[_0xdfa4('0x32')][_0xdfa4('0x23')](_0x194be1)[_0xdfa4('0x2b')](function(_0x5638cb){_0x4fd6b6['count']=_0x5638cb;if(_0xe24a6[_0xdfa4('0x39')]['includeAll']){_0xbbb14[_0xdfa4('0x48')]=[{'all':!![]}];}return db[_0xdfa4('0x32')]['findAll'](_0xbbb14);})[_0xdfa4('0x2b')](function(_0x3c3432){_0x4fd6b6[_0xdfa4('0x49')]=_0x3c3432;return _0x4fd6b6;})[_0xdfa4('0x2b')](respondWithFilteredResult(_0x33118f,_0xbbb14))[_0xdfa4('0x4a')](handleError(_0x33118f,null));};exports[_0xdfa4('0x4b')]=function(_0x4a20d0,_0x355931){var _0x4002e0={'raw':![],'where':{'id':_0x4a20d0['params']['id']}},_0x2be578={};_0x2be578[_0xdfa4('0x37')]=_[_0xdfa4('0x38')](db[_0xdfa4('0x32')][_0xdfa4('0x33')]);_0x2be578[_0xdfa4('0x39')]=_[_0xdfa4('0x38')](_0x4a20d0['query']);_0x2be578['filters']=_[_0xdfa4('0x3c')](_0x2be578[_0xdfa4('0x37')],_0x2be578[_0xdfa4('0x39')]);_0x4002e0[_0xdfa4('0x3b')]=_[_0xdfa4('0x3c')](_0x2be578[_0xdfa4('0x37')],qs['fields'](_0x4a20d0[_0xdfa4('0x39')][_0xdfa4('0x3d')]));_0x4002e0[_0xdfa4('0x3b')]=_0x4002e0[_0xdfa4('0x3b')][_0xdfa4('0x3e')]?_0x4002e0[_0xdfa4('0x3b')]:_0x2be578[_0xdfa4('0x37')];if(_0x4a20d0[_0xdfa4('0x39')]['includeAll']){_0x4002e0[_0xdfa4('0x48')]=[{'all':!![]}];}_0x4002e0=_[_0xdfa4('0x45')]({},_0x4002e0,_0x4a20d0[_0xdfa4('0x47')]);return db[_0xdfa4('0x32')][_0xdfa4('0x4c')](_0x4002e0)[_0xdfa4('0x2b')](handleEntityNotFound(_0x355931,null))[_0xdfa4('0x2b')](respondWithResult(_0x355931,null))['catch'](handleError(_0x355931,null));};exports[_0xdfa4('0x4d')]=function(_0x65cd34,_0x43ea6b){return db['SalesforceAccount'][_0xdfa4('0x4d')](_0x65cd34[_0xdfa4('0x4e')],{})[_0xdfa4('0x2b')](respondWithResult(_0x43ea6b,0xc9))['catch'](handleError(_0x43ea6b,null));};exports[_0xdfa4('0x2a')]=function(_0xe05bcd,_0x1b1bc8){if(_0xe05bcd[_0xdfa4('0x4e')]['id']){delete _0xe05bcd['body']['id'];}return db[_0xdfa4('0x32')][_0xdfa4('0x4c')]({'where':{'id':_0xe05bcd[_0xdfa4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1b1bc8,null))['then'](saveUpdates(_0xe05bcd[_0xdfa4('0x4e')],null))[_0xdfa4('0x2b')](respondWithResult(_0x1b1bc8,null))[_0xdfa4('0x4a')](handleError(_0x1b1bc8,null));};exports[_0xdfa4('0x50')]=function(_0x5beab6,_0x2f9878){return db[_0xdfa4('0x32')][_0xdfa4('0x4c')]({'where':{'id':_0x5beab6[_0xdfa4('0x4f')]['id']}})[_0xdfa4('0x2b')](handleEntityNotFound(_0x2f9878,null))[_0xdfa4('0x2b')](removeEntity(_0x2f9878,null))['catch'](handleError(_0x2f9878,null));};exports['getConfigurations']=function(_0x46d947,_0x1384e5,_0x464cab){var _0x4e7451={};var _0x2a54d2={};var _0x5c5dce;var _0x1905ce;return db[_0xdfa4('0x32')][_0xdfa4('0x51')]({'where':{'id':_0x46d947[_0xdfa4('0x4f')]['id']}})[_0xdfa4('0x2b')](handleEntityNotFound(_0x1384e5,null))[_0xdfa4('0x2b')](function(_0xcbffe9){if(_0xcbffe9){_0x5c5dce=_0xcbffe9;_0x2a54d2[_0xdfa4('0x37')]=_[_0xdfa4('0x38')](db[_0xdfa4('0x52')][_0xdfa4('0x33')]);_0x2a54d2[_0xdfa4('0x39')]=_[_0xdfa4('0x38')](_0x46d947[_0xdfa4('0x39')]);_0x2a54d2[_0xdfa4('0x3a')]=_[_0xdfa4('0x3c')](_0x2a54d2[_0xdfa4('0x37')],_0x2a54d2['query']);_0x4e7451[_0xdfa4('0x3b')]=_[_0xdfa4('0x3c')](_0x2a54d2[_0xdfa4('0x37')],qs['fields'](_0x46d947[_0xdfa4('0x39')][_0xdfa4('0x3d')]));_0x4e7451[_0xdfa4('0x3b')]=_0x4e7451[_0xdfa4('0x3b')][_0xdfa4('0x3e')]?_0x4e7451['attributes']:_0x2a54d2[_0xdfa4('0x37')];_0x4e7451[_0xdfa4('0x40')]=qs[_0xdfa4('0x41')](_0x46d947[_0xdfa4('0x39')][_0xdfa4('0x41')]);_0x4e7451['where']=qs['filters'](_[_0xdfa4('0x43')](_0x46d947['query'],_0x2a54d2[_0xdfa4('0x3a')]));if(_0x46d947['query'][_0xdfa4('0x44')]){_0x4e7451[_0xdfa4('0x42')]=_[_0xdfa4('0x45')](_0x4e7451[_0xdfa4('0x42')],{'$or':_[_0xdfa4('0x31')](_0x4e7451[_0xdfa4('0x3b')],function(_0x37ed12){var _0x33d8e3={};_0x33d8e3[_0x37ed12]={'$like':'%'+_0x46d947[_0xdfa4('0x39')]['filter']+'%'};return _0x33d8e3;})});}_0x4e7451=_['merge']({},_0x4e7451,_0x46d947['options']);return _0x5c5dce['getConfigurations'](_0x4e7451);}})[_0xdfa4('0x2b')](function(_0x25c806){if(_0x25c806){_0x1905ce=_0x25c806[_0xdfa4('0x3e')];if(!_0x46d947[_0xdfa4('0x39')][_0xdfa4('0x3f')]('nolimit')){_0x4e7451['limit']=qs[_0xdfa4('0x21')](_0x46d947[_0xdfa4('0x39')][_0xdfa4('0x21')]);_0x4e7451[_0xdfa4('0x24')]=qs[_0xdfa4('0x24')](_0x46d947[_0xdfa4('0x39')][_0xdfa4('0x24')]);}return _0x5c5dce[_0xdfa4('0x53')](_0x4e7451);}})[_0xdfa4('0x2b')](function(_0x4cd5bf){if(_0x4cd5bf){return _0x4cd5bf?{'count':_0x1905ce,'rows':_0x4cd5bf}:null;}})['then'](respondWithResult(_0x1384e5,null))[_0xdfa4('0x4a')](handleError(_0x1384e5,null));};exports[_0xdfa4('0x54')]=function(_0x52c81e,_0x50e05f,_0x11f9e2){if(_0x52c81e[_0xdfa4('0x4e')]['id']){delete _0x52c81e['body']['id'];}return db[_0xdfa4('0x32')][_0xdfa4('0x51')]({'where':{'id':_0x52c81e[_0xdfa4('0x4f')]['id']}})[_0xdfa4('0x2b')](handleEntityNotFound(_0x50e05f,null))['then'](function(_0x4f4840){if(_0x4f4840){_0x52c81e['body'][_0xdfa4('0x55')]=_0x4f4840['id'];_0x52c81e[_0xdfa4('0x4e')][_0xdfa4('0x56')]=integrations[_0xdfa4('0x57')](_0x52c81e[_0xdfa4('0x4e')]['channel'],_0x52c81e[_0xdfa4('0x4e')][_0xdfa4('0x35')]);_0x52c81e[_0xdfa4('0x4e')][_0xdfa4('0x58')]=integrations[_0xdfa4('0x59')](_0x52c81e['body'][_0xdfa4('0x5a')],_0x52c81e['body'][_0xdfa4('0x35')]);return db['SalesforceConfiguration'][_0xdfa4('0x4d')](_0x52c81e['body'],{'include':[{'model':db['SalesforceField'],'as':_0xdfa4('0x56')},{'model':db[_0xdfa4('0x5b')],'as':_0xdfa4('0x58')}]});}return null;})[_0xdfa4('0x2b')](respondWithResult(_0x50e05f,null))[_0xdfa4('0x4a')](handleError(_0x50e05f,null));};exports[_0xdfa4('0x5c')]=function(_0x391f2c,_0x1b3fcc,_0x4ef6ba){var _0x5ea8dc;var _0x1b70f0='';var _0x1a1668=_0xdfa4('0x5d');return db['SalesforceAccount']['findOne']({'where':{'id':_0x391f2c['params']['id']},'attributes':['id',_0xdfa4('0x5e'),_0xdfa4('0x5f'),_0xdfa4('0x60'),'username',_0xdfa4('0x61'),_0xdfa4('0x62')]})[_0xdfa4('0x2b')](handleEntityNotFound(_0x1b3fcc,null))[_0xdfa4('0x2b')](function(_0x2cf406){if(_0x2cf406){_0x1b70f0=_0x2cf406[_0xdfa4('0x5e')];var _0x5d3f87=_0x1b70f0[_0xdfa4('0x63')](-0x1);if(_0x5d3f87==='/'){_0x1b70f0=_0x1b70f0[_0xdfa4('0x64')](0x0,_0x1b70f0[_0xdfa4('0x65')](_0x5d3f87));}_0x5ea8dc=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1b70f0,'clientId':_0x2cf406[_0xdfa4('0x5f')],'clientSecret':_0x2cf406['clientSecret']}});return _0x5ea8dc[_0xdfa4('0x66')](_0x2cf406[_0xdfa4('0x67')],_0x2cf406['password'][_0xdfa4('0x68')](_0x2cf406[_0xdfa4('0x62')]));}})[_0xdfa4('0x2b')](function(_0x26c9aa){if(_0x26c9aa){if(!_[_0xdfa4('0x69')](_0x391f2c['query'][_0xdfa4('0x6a')])){_0x1a1668=_0x391f2c['query'][_0xdfa4('0x6a')];}return _0x5ea8dc['sobject'](_0x1a1668)['describe']();}})['then'](function(_0x374c6e){var _0x5ba949=[_0xdfa4('0x6b'),'ActivityDate',_0xdfa4('0x6c'),_0xdfa4('0x6d'),_0xdfa4('0x6e'),_0xdfa4('0x6f')];var _0x102a40=[_0xdfa4('0x70'),_0xdfa4('0x71'),_0xdfa4('0x72'),_0xdfa4('0x73'),_0xdfa4('0x74'),_0xdfa4('0x75'),_0xdfa4('0x76')];if(_0x374c6e){_[_0xdfa4('0x77')](_0x374c6e['fields'],function(_0x49106b){return _0x5ba949['includes'](_0x49106b[_0xdfa4('0x2e')])||!_0x102a40[_0xdfa4('0x78')](_0x49106b[_0xdfa4('0x35')]);});return{'count':_0x374c6e[_0xdfa4('0x3d')]['length'],'rows':_['map'](_0x374c6e[_0xdfa4('0x3d')],function(_0x34a97e){return{'id':_0x34a97e[_0xdfa4('0x2e')],'name':_0x34a97e[_0xdfa4('0x79')],'custom':_0x34a97e[_0xdfa4('0x7a')],'options':_0x34a97e['picklistValues'][_0xdfa4('0x3e')]>0x0?_[_0xdfa4('0x31')](_0x34a97e[_0xdfa4('0x7b')],function(_0x5722cc){return{'name':_0x5722cc[_0xdfa4('0x79')],'value':_0x5722cc[_0xdfa4('0x7c')]};}):_0x34a97e[_0xdfa4('0x35')]==_0xdfa4('0x73')?[{'name':_0xdfa4('0x7d'),'value':_0xdfa4('0x7e')},{'name':'False','value':_0xdfa4('0x7f')}]:[]};})};}})[_0xdfa4('0x2b')](respondWithResult(_0x1b3fcc,null))['catch'](function(_0x5106d4){var _0x4b49c2=_0x391f2c[_0xdfa4('0x39')][_0xdfa4('0x80')]?0x1f4:_0x5106d4[_0xdfa4('0x81')]||0x1f4;logger['error'](_0xdfa4('0x82'),'getFields',_0x4b49c2,JSON[_0xdfa4('0x83')](_0x5106d4));delete _0x5106d4[_0xdfa4('0x2e')];if(_0x4b49c2===0x191){_0x4b49c2=0x190;}_0x1b3fcc[_0xdfa4('0x20')](_0x4b49c2)[_0xdfa4('0x2f')](_0x391f2c[_0xdfa4('0x39')][_0xdfa4('0x80')]?{'message':_0xdfa4('0x84'),'statusCode':_0x5106d4['statusCode']}:_0x5106d4);});}; \ No newline at end of file +var _0x1819=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','map','SalesforceAccount','fieldName','key','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','rawAttributes','create','body','find','getConfigurations','findOne','params','SalesforceConfiguration','length','sort','addConfiguration','Subjects','getSubjects','channel','Descriptions','type','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','securityToken','slice','lastIndexOf','Connection','login','password','isNil','sobject','describe','OwnerId','ActivityDate','Subject','string','picklist','boolean','textarea','remove','includes','label','custom','picklistValues','true','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv'];(function(_0x52af6b,_0x495320){var _0x4028ec=function(_0xcd6727){while(--_0xcd6727){_0x52af6b['push'](_0x52af6b['shift']());}};_0x4028ec(++_0x495320);}(_0x1819,0x1ce));var _0x9181=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x1819[_0xd0b415];return _0x2bdf2c;};'use strict';var emlformat=require(_0x9181('0x0'));var rimraf=require(_0x9181('0x1'));var zipdir=require(_0x9181('0x2'));var jsonpatch=require(_0x9181('0x3'));var rp=require('request-promise');var moment=require(_0x9181('0x4'));var BPromise=require(_0x9181('0x5'));var Mustache=require('mustache');var util=require(_0x9181('0x6'));var path=require(_0x9181('0x7'));var sox=require(_0x9181('0x8'));var csv=require(_0x9181('0x9'));var ejs=require(_0x9181('0xa'));var fs=require('fs');var fs_extra=require(_0x9181('0xb'));var _=require(_0x9181('0xc'));var squel=require(_0x9181('0xd'));var crypto=require('crypto');var jsforce=require(_0x9181('0xe'));var deskjs=require(_0x9181('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9181('0x10'));var Papa=require(_0x9181('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9181('0x12'));var as=require(_0x9181('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9181('0x14'));var utils=require(_0x9181('0x15'));var config=require(_0x9181('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9181('0x17'))['db'];var integrations=require(_0x9181('0x18'));function respondWithStatusCode(_0x410dea,_0x149680){_0x149680=_0x149680||0xcc;return function(_0x3a335d){if(_0x3a335d){return _0x410dea[_0x9181('0x19')](_0x149680);}return _0x410dea['status'](_0x149680)['end']();};}function respondWithResult(_0x2ba54a,_0x54a855){_0x54a855=_0x54a855||0xc8;return function(_0xa69e57){if(_0xa69e57){return _0x2ba54a[_0x9181('0x1a')](_0x54a855)['json'](_0xa69e57);}};}function respondWithFilteredResult(_0x42e69e,_0x3b353a){return function(_0x51f1ac){if(_0x51f1ac){var _0x500a09=typeof _0x3b353a[_0x9181('0x1b')]===_0x9181('0x1c')&&typeof _0x3b353a['limit']===_0x9181('0x1c');var _0x3008f2=_0x51f1ac[_0x9181('0x1d')];var _0x5f0c35=_0x500a09?0x0:_0x3b353a[_0x9181('0x1b')];var _0x2499b1=_0x500a09?_0x51f1ac[_0x9181('0x1d')]:_0x3b353a['offset']+_0x3b353a[_0x9181('0x1e')];var _0x55a818;if(_0x2499b1>=_0x3008f2){_0x2499b1=_0x3008f2;_0x55a818=0xc8;}else{_0x55a818=0xce;}_0x42e69e[_0x9181('0x1a')](_0x55a818);return _0x42e69e[_0x9181('0x1f')](_0x9181('0x20'),_0x5f0c35+'-'+_0x2499b1+'/'+_0x3008f2)['json'](_0x51f1ac);}return null;};}function patchUpdates(_0x2d2f7f){return function(_0x4de5f4){try{jsonpatch[_0x9181('0x21')](_0x4de5f4,_0x2d2f7f,!![]);}catch(_0x3418e9){return BPromise['reject'](_0x3418e9);}return _0x4de5f4[_0x9181('0x22')]();};}function saveUpdates(_0xb690a,_0x109bcd){return function(_0xc85583){if(_0xc85583){return _0xc85583[_0x9181('0x23')](_0xb690a)[_0x9181('0x24')](function(_0x24ca44){return _0x24ca44;});}return null;};}function removeEntity(_0x1cbcec,_0x35f035){return function(_0x587f1a){if(_0x587f1a){return _0x587f1a[_0x9181('0x25')]()[_0x9181('0x24')](function(){_0x1cbcec[_0x9181('0x1a')](0xcc)[_0x9181('0x26')]();});}};}function handleEntityNotFound(_0x30a76a,_0x4c12d7){return function(_0x40bbd1){if(!_0x40bbd1){_0x30a76a[_0x9181('0x19')](0x194);}return _0x40bbd1;};}function handleError(_0x19133c,_0x20bac8){_0x20bac8=_0x20bac8||0x1f4;return function(_0x5c495e){logger[_0x9181('0x27')](_0x5c495e[_0x9181('0x28')]);if(_0x5c495e['name']){delete _0x5c495e[_0x9181('0x29')];}_0x19133c[_0x9181('0x1a')](_0x20bac8)[_0x9181('0x2a')](_0x5c495e);};}exports['index']=function(_0x25cb79,_0x4d002c){var _0x34250b={},_0x36e44d={},_0xa32926={'count':0x0,'rows':[]};var _0x5645ed=_[_0x9181('0x2b')](db[_0x9181('0x2c')]['rawAttributes'],function(_0x3def56){return{'name':_0x3def56[_0x9181('0x2d')],'type':_0x3def56['type'][_0x9181('0x2e')]};});_0x36e44d[_0x9181('0x2f')]=_[_0x9181('0x2b')](_0x5645ed,_0x9181('0x29'));_0x36e44d['query']=_['keys'](_0x25cb79['query']);_0x36e44d[_0x9181('0x30')]=_[_0x9181('0x31')](_0x36e44d[_0x9181('0x2f')],_0x36e44d[_0x9181('0x32')]);_0x34250b[_0x9181('0x33')]=_['intersection'](_0x36e44d[_0x9181('0x2f')],qs['fields'](_0x25cb79[_0x9181('0x32')][_0x9181('0x34')]));_0x34250b[_0x9181('0x33')]=_0x34250b[_0x9181('0x33')]['length']?_0x34250b[_0x9181('0x33')]:_0x36e44d[_0x9181('0x2f')];if(!_0x25cb79[_0x9181('0x32')][_0x9181('0x35')](_0x9181('0x36'))){_0x34250b['limit']=qs[_0x9181('0x1e')](_0x25cb79[_0x9181('0x32')][_0x9181('0x1e')]);_0x34250b[_0x9181('0x1b')]=qs['offset'](_0x25cb79[_0x9181('0x32')]['offset']);}_0x34250b[_0x9181('0x37')]=qs['sort'](_0x25cb79['query']['sort']);_0x34250b[_0x9181('0x38')]=qs[_0x9181('0x30')](_[_0x9181('0x39')](_0x25cb79['query'],_0x36e44d[_0x9181('0x30')]),_0x5645ed);if(_0x25cb79[_0x9181('0x32')][_0x9181('0x3a')]){_0x34250b[_0x9181('0x38')]=_[_0x9181('0x3b')](_0x34250b[_0x9181('0x38')],{'$or':_['map'](_0x5645ed,function(_0x208a6b){if(_0x208a6b['type']!==_0x9181('0x3c')){var _0x490518={};_0x490518[_0x208a6b['name']]={'$like':'%'+_0x25cb79[_0x9181('0x32')]['filter']+'%'};return _0x490518;}})});}_0x34250b=_['merge']({},_0x34250b,_0x25cb79[_0x9181('0x3d')]);var _0x49b305={'where':_0x34250b[_0x9181('0x38')]};return db[_0x9181('0x2c')][_0x9181('0x1d')](_0x49b305)['then'](function(_0x140308){_0xa32926['count']=_0x140308;if(_0x25cb79[_0x9181('0x32')][_0x9181('0x3e')]){_0x34250b[_0x9181('0x3f')]=[{'all':!![]}];}return db[_0x9181('0x2c')]['findAll'](_0x34250b);})[_0x9181('0x24')](function(_0x199572){_0xa32926[_0x9181('0x40')]=_0x199572;return _0xa32926;})[_0x9181('0x24')](respondWithFilteredResult(_0x4d002c,_0x34250b))[_0x9181('0x41')](handleError(_0x4d002c,null));};exports[_0x9181('0x42')]=function(_0xcdcc7,_0x2f3ba3){var _0x2c5adc={'raw':![],'where':{'id':_0xcdcc7['params']['id']}},_0x31570={};_0x31570[_0x9181('0x2f')]=_[_0x9181('0x43')](db[_0x9181('0x2c')][_0x9181('0x44')]);_0x31570[_0x9181('0x32')]=_['keys'](_0xcdcc7[_0x9181('0x32')]);_0x31570[_0x9181('0x30')]=_[_0x9181('0x31')](_0x31570[_0x9181('0x2f')],_0x31570[_0x9181('0x32')]);_0x2c5adc[_0x9181('0x33')]=_[_0x9181('0x31')](_0x31570[_0x9181('0x2f')],qs['fields'](_0xcdcc7[_0x9181('0x32')][_0x9181('0x34')]));_0x2c5adc[_0x9181('0x33')]=_0x2c5adc[_0x9181('0x33')]['length']?_0x2c5adc[_0x9181('0x33')]:_0x31570[_0x9181('0x2f')];if(_0xcdcc7[_0x9181('0x32')][_0x9181('0x3e')]){_0x2c5adc[_0x9181('0x3f')]=[{'all':!![]}];}_0x2c5adc=_[_0x9181('0x3b')]({},_0x2c5adc,_0xcdcc7[_0x9181('0x3d')]);return db['SalesforceAccount']['find'](_0x2c5adc)['then'](handleEntityNotFound(_0x2f3ba3,null))[_0x9181('0x24')](respondWithResult(_0x2f3ba3,null))[_0x9181('0x41')](handleError(_0x2f3ba3,null));};exports[_0x9181('0x45')]=function(_0x38cbf0,_0x5ca797){return db['SalesforceAccount'][_0x9181('0x45')](_0x38cbf0[_0x9181('0x46')],{})[_0x9181('0x24')](respondWithResult(_0x5ca797,0xc9))['catch'](handleError(_0x5ca797,null));};exports[_0x9181('0x23')]=function(_0x1b8455,_0x4e62d7){if(_0x1b8455['body']['id']){delete _0x1b8455[_0x9181('0x46')]['id'];}return db[_0x9181('0x2c')]['find']({'where':{'id':_0x1b8455['params']['id']}})[_0x9181('0x24')](handleEntityNotFound(_0x4e62d7,null))[_0x9181('0x24')](saveUpdates(_0x1b8455['body'],null))[_0x9181('0x24')](respondWithResult(_0x4e62d7,null))[_0x9181('0x41')](handleError(_0x4e62d7,null));};exports['destroy']=function(_0x18d30a,_0x54e37c){return db[_0x9181('0x2c')][_0x9181('0x47')]({'where':{'id':_0x18d30a['params']['id']}})['then'](handleEntityNotFound(_0x54e37c,null))['then'](removeEntity(_0x54e37c,null))[_0x9181('0x41')](handleError(_0x54e37c,null));};exports[_0x9181('0x48')]=function(_0x7278b3,_0x403885,_0x251873){var _0x23fc97={};var _0x42c165={};var _0x26da83;var _0x5f13ff;return db[_0x9181('0x2c')][_0x9181('0x49')]({'where':{'id':_0x7278b3[_0x9181('0x4a')]['id']}})[_0x9181('0x24')](handleEntityNotFound(_0x403885,null))[_0x9181('0x24')](function(_0x3166ea){if(_0x3166ea){_0x26da83=_0x3166ea;_0x42c165[_0x9181('0x2f')]=_[_0x9181('0x43')](db[_0x9181('0x4b')][_0x9181('0x44')]);_0x42c165[_0x9181('0x32')]=_[_0x9181('0x43')](_0x7278b3['query']);_0x42c165[_0x9181('0x30')]=_['intersection'](_0x42c165[_0x9181('0x2f')],_0x42c165['query']);_0x23fc97['attributes']=_['intersection'](_0x42c165[_0x9181('0x2f')],qs[_0x9181('0x34')](_0x7278b3[_0x9181('0x32')][_0x9181('0x34')]));_0x23fc97['attributes']=_0x23fc97[_0x9181('0x33')][_0x9181('0x4c')]?_0x23fc97['attributes']:_0x42c165[_0x9181('0x2f')];_0x23fc97['order']=qs[_0x9181('0x4d')](_0x7278b3['query']['sort']);_0x23fc97[_0x9181('0x38')]=qs[_0x9181('0x30')](_['pick'](_0x7278b3['query'],_0x42c165[_0x9181('0x30')]));if(_0x7278b3[_0x9181('0x32')][_0x9181('0x3a')]){_0x23fc97[_0x9181('0x38')]=_[_0x9181('0x3b')](_0x23fc97[_0x9181('0x38')],{'$or':_['map'](_0x23fc97['attributes'],function(_0x5a9742){var _0xb05b65={};_0xb05b65[_0x5a9742]={'$like':'%'+_0x7278b3[_0x9181('0x32')][_0x9181('0x3a')]+'%'};return _0xb05b65;})});}_0x23fc97=_[_0x9181('0x3b')]({},_0x23fc97,_0x7278b3[_0x9181('0x3d')]);return _0x26da83[_0x9181('0x48')](_0x23fc97);}})[_0x9181('0x24')](function(_0x21da7d){if(_0x21da7d){_0x5f13ff=_0x21da7d[_0x9181('0x4c')];if(!_0x7278b3['query'][_0x9181('0x35')](_0x9181('0x36'))){_0x23fc97['limit']=qs[_0x9181('0x1e')](_0x7278b3['query'][_0x9181('0x1e')]);_0x23fc97[_0x9181('0x1b')]=qs[_0x9181('0x1b')](_0x7278b3['query'][_0x9181('0x1b')]);}return _0x26da83['getConfigurations'](_0x23fc97);}})['then'](function(_0x7d7962){if(_0x7d7962){return _0x7d7962?{'count':_0x5f13ff,'rows':_0x7d7962}:null;}})['then'](respondWithResult(_0x403885,null))[_0x9181('0x41')](handleError(_0x403885,null));};exports[_0x9181('0x4e')]=function(_0x127b73,_0x5d31ab,_0x2bb80a){if(_0x127b73[_0x9181('0x46')]['id']){delete _0x127b73[_0x9181('0x46')]['id'];}return db[_0x9181('0x2c')][_0x9181('0x49')]({'where':{'id':_0x127b73['params']['id']}})[_0x9181('0x24')](handleEntityNotFound(_0x5d31ab,null))['then'](function(_0x558667){if(_0x558667){_0x127b73[_0x9181('0x46')]['AccountId']=_0x558667['id'];_0x127b73[_0x9181('0x46')][_0x9181('0x4f')]=integrations[_0x9181('0x50')](_0x127b73[_0x9181('0x46')][_0x9181('0x51')],_0x127b73[_0x9181('0x46')]['type']);_0x127b73[_0x9181('0x46')][_0x9181('0x52')]=integrations['getDescriptions'](_0x127b73[_0x9181('0x46')][_0x9181('0x51')],_0x127b73[_0x9181('0x46')][_0x9181('0x53')]);return db[_0x9181('0x4b')][_0x9181('0x45')](_0x127b73[_0x9181('0x46')],{'include':[{'model':db[_0x9181('0x54')],'as':_0x9181('0x4f')},{'model':db['SalesforceField'],'as':_0x9181('0x52')}]});}return null;})[_0x9181('0x24')](respondWithResult(_0x5d31ab,null))[_0x9181('0x41')](handleError(_0x5d31ab,null));};exports[_0x9181('0x55')]=function(_0x4b8a88,_0x5046a7,_0x73ebe7){var _0x5c3e8d;var _0x52b4b1='';var _0x4758c2=_0x9181('0x56');return db[_0x9181('0x2c')][_0x9181('0x49')]({'where':{'id':_0x4b8a88[_0x9181('0x4a')]['id']},'attributes':['id',_0x9181('0x57'),_0x9181('0x58'),_0x9181('0x59'),_0x9181('0x5a'),'password',_0x9181('0x5b')]})[_0x9181('0x24')](handleEntityNotFound(_0x5046a7,null))[_0x9181('0x24')](function(_0x14acbb){if(_0x14acbb){_0x52b4b1=_0x14acbb[_0x9181('0x57')];var _0x54b676=_0x52b4b1[_0x9181('0x5c')](-0x1);if(_0x54b676==='/'){_0x52b4b1=_0x52b4b1['substring'](0x0,_0x52b4b1[_0x9181('0x5d')](_0x54b676));}_0x5c3e8d=new jsforce[(_0x9181('0x5e'))]({'oauth2':{'loginUrl':_0x52b4b1,'clientId':_0x14acbb['clientId'],'clientSecret':_0x14acbb[_0x9181('0x59')]}});return _0x5c3e8d[_0x9181('0x5f')](_0x14acbb[_0x9181('0x5a')],_0x14acbb[_0x9181('0x60')]['concat'](_0x14acbb['securityToken']));}})['then'](function(_0x49ff4f){if(_0x49ff4f){if(!_[_0x9181('0x61')](_0x4b8a88['query']['ticketType'])){_0x4758c2=_0x4b8a88[_0x9181('0x32')]['ticketType'];}return _0x5c3e8d[_0x9181('0x62')](_0x4758c2)[_0x9181('0x63')]();}})[_0x9181('0x24')](function(_0x37d6e8){var _0x53ff7d=[_0x9181('0x64'),_0x9181('0x65'),'IsReminderSet','IsRecurrence',_0x9181('0x66'),'Description'];var _0x550aa6=[_0x9181('0x67'),'int',_0x9181('0x68'),_0x9181('0x69'),'email',_0x9181('0x6a'),'phone'];if(_0x37d6e8){_[_0x9181('0x6b')](_0x37d6e8['fields'],function(_0x35c533){return _0x53ff7d['includes'](_0x35c533['name'])||!_0x550aa6[_0x9181('0x6c')](_0x35c533[_0x9181('0x53')]);});return{'count':_0x37d6e8[_0x9181('0x34')]['length'],'rows':_[_0x9181('0x2b')](_0x37d6e8[_0x9181('0x34')],function(_0x5b69f2){return{'id':_0x5b69f2[_0x9181('0x29')],'name':_0x5b69f2[_0x9181('0x6d')],'custom':_0x5b69f2[_0x9181('0x6e')],'options':_0x5b69f2[_0x9181('0x6f')][_0x9181('0x4c')]>0x0?_[_0x9181('0x2b')](_0x5b69f2[_0x9181('0x6f')],function(_0x59cbbf){return{'name':_0x59cbbf[_0x9181('0x6d')],'value':_0x59cbbf['value']};}):_0x5b69f2[_0x9181('0x53')]==_0x9181('0x69')?[{'name':'True','value':_0x9181('0x70')},{'name':'False','value':_0x9181('0x71')}]:[]};})};}})[_0x9181('0x24')](respondWithResult(_0x5046a7,null))[_0x9181('0x41')](function(_0x236010){var _0x1237e7=_0x4b8a88[_0x9181('0x32')]['test']?0x1f4:_0x236010[_0x9181('0x72')]||0x1f4;logger[_0x9181('0x27')](_0x9181('0x73'),_0x9181('0x55'),_0x1237e7,JSON[_0x9181('0x74')](_0x236010));delete _0x236010['name'];if(_0x1237e7===0x191){_0x1237e7=0x190;}_0x5046a7[_0x9181('0x1a')](_0x1237e7)[_0x9181('0x2a')](_0x4b8a88[_0x9181('0x32')][_0x9181('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x236010[_0x9181('0x72')]}:_0x236010);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index b746c4e..09491c6 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 _0xaf3a=['int_salesforce_accounts','../../config/logger','moment','bluebird','request-promise','./intSalesforceAccount.attributes','define'];(function(_0xc0109d,_0x416433){var _0x31cb9c=function(_0x229de6){while(--_0x229de6){_0xc0109d['push'](_0xc0109d['shift']());}};_0x31cb9c(++_0x416433);}(_0xaf3a,0xef));var _0xaaf3=function(_0xc80b2b,_0x5a12e9){_0xc80b2b=_0xc80b2b-0x0;var _0x22af6f=_0xaf3a[_0xc80b2b];return _0x22af6f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaaf3('0x0'))('api');var moment=require(_0xaaf3('0x1'));var BPromise=require(_0xaaf3('0x2'));var rp=require(_0xaaf3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaaf3('0x4'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x87f74d,_0x492966){return _0x87f74d[_0xaaf3('0x5')]('SalesforceAccount',attributes,{'tableName':_0xaaf3('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e24=['../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','int_salesforce_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2f6799,_0x4e7f00){var _0x3cb26f=function(_0x3c5a3d){while(--_0x3c5a3d){_0x2f6799['push'](_0x2f6799['shift']());}};_0x3cb26f(++_0x4e7f00);}(_0x0e24,0x1da));var _0x40e2=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x0e24[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x40e2('0x0'))(_0x40e2('0x1'));var moment=require(_0x40e2('0x2'));var BPromise=require(_0x40e2('0x3'));var rp=require(_0x40e2('0x4'));var fs=require('fs');var path=require(_0x40e2('0x5'));var rimraf=require(_0x40e2('0x6'));var config=require(_0x40e2('0x7'));var attributes=require(_0x40e2('0x8'));var integrations=require(_0x40e2('0x9'));module[_0x40e2('0xa')]=function(_0x38f499,_0x17db32){return _0x38f499[_0x40e2('0xb')]('SalesforceAccount',attributes,{'tableName':_0x40e2('0xc'),'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 5588cf6..507b05f 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 _0xb461=['debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetSalesforceAccount','SalesforceAccount','findAll','options','map','include','attributes','model','catch','ShowSalesforceAccount','find','raw','where','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb461,0xa1));var _0x1b46=function(_0x5727ee,_0xf02419){_0x5727ee=_0x5727ee-0x0;var _0xa5455e=_0xb461[_0x5727ee];return _0xa5455e;};'use strict';var _=require(_0x1b46('0x0'));var util=require(_0x1b46('0x1'));var moment=require('moment');var BPromise=require(_0x1b46('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b46('0x3'))['db'];var utils=require(_0x1b46('0x4'));var logger=require(_0x1b46('0x5'))(_0x1b46('0x6'));var config=require(_0x1b46('0x7'));var jayson=require(_0x1b46('0x8'));var client=jayson[_0x1b46('0x9')][_0x1b46('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14b75b,_0x7c3c53,_0x3b0568){return new BPromise(function(_0x9e24c7,_0x34cdf6){return client['request'](_0x14b75b,_0x3b0568)[_0x1b46('0xb')](function(_0x3efb70){logger['info'](_0x1b46('0xc'),_0x7c3c53,_0x1b46('0xd'));logger[_0x1b46('0xe')](_0x1b46('0xf'),_0x7c3c53,_0x1b46('0xd'),JSON[_0x1b46('0x10')](_0x3efb70));if(_0x3efb70[_0x1b46('0x11')]){if(_0x3efb70[_0x1b46('0x11')][_0x1b46('0x12')]===0x1f4){logger[_0x1b46('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x7c3c53,_0x3efb70[_0x1b46('0x11')][_0x1b46('0x13')]);return _0x34cdf6(_0x3efb70[_0x1b46('0x11')][_0x1b46('0x13')]);}logger[_0x1b46('0x11')](_0x1b46('0xc'),_0x7c3c53,_0x3efb70['error'][_0x1b46('0x13')]);return _0x9e24c7(_0x3efb70[_0x1b46('0x11')]['message']);}else{logger[_0x1b46('0x14')](_0x1b46('0xc'),_0x7c3c53,'request\x20sent');_0x9e24c7(_0x3efb70[_0x1b46('0x15')][_0x1b46('0x13')]);}})['catch'](function(_0x5dc66c){logger['error'](_0x1b46('0xc'),_0x7c3c53,_0x5dc66c);_0x34cdf6(_0x5dc66c);});});}exports[_0x1b46('0x16')]=function(_0x35e40d){var _0x1e44ae=this;return new Promise(function(_0x4ca5ee,_0x7e2997){return db[_0x1b46('0x17')][_0x1b46('0x18')]({'raw':_0x35e40d[_0x1b46('0x19')]?_0x35e40d['options']['raw']===undefined?!![]:![]:!![],'where':_0x35e40d[_0x1b46('0x19')]?_0x35e40d[_0x1b46('0x19')]['where']||null:null,'attributes':_0x35e40d[_0x1b46('0x19')]?_0x35e40d['options']['attributes']||null:null,'limit':_0x35e40d[_0x1b46('0x19')]?_0x35e40d[_0x1b46('0x19')]['limit']||null:null,'include':_0x35e40d[_0x1b46('0x19')]?_0x35e40d[_0x1b46('0x19')]['include']?_[_0x1b46('0x1a')](_0x35e40d[_0x1b46('0x19')][_0x1b46('0x1b')],function(_0x4549e8){return{'model':db[_0x4549e8['model']],'as':_0x4549e8['as'],'attributes':_0x4549e8[_0x1b46('0x1c')],'include':_0x4549e8['include']?_[_0x1b46('0x1a')](_0x4549e8[_0x1b46('0x1b')],function(_0x166e14){return{'model':db[_0x166e14[_0x1b46('0x1d')]],'as':_0x166e14['as'],'attributes':_0x166e14[_0x1b46('0x1c')],'include':_0x166e14[_0x1b46('0x1b')]?_[_0x1b46('0x1a')](_0x166e14['include'],function(_0x4a03bc){return{'model':db[_0x4a03bc[_0x1b46('0x1d')]],'as':_0x4a03bc['as'],'attributes':_0x4a03bc[_0x1b46('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1b46('0xb')](function(_0x283b01){logger[_0x1b46('0x14')](_0x1b46('0x16'),_0x35e40d);logger[_0x1b46('0xe')](_0x1b46('0x16'),_0x35e40d,JSON[_0x1b46('0x10')](_0x283b01));_0x4ca5ee(_0x283b01);})[_0x1b46('0x1e')](function(_0x5dcccc){logger[_0x1b46('0x11')](_0x1b46('0x16'),_0x5dcccc[_0x1b46('0x13')],_0x35e40d);_0x7e2997(_0x1e44ae[_0x1b46('0x11')](0x1f4,_0x5dcccc[_0x1b46('0x13')]));});});};exports[_0x1b46('0x1f')]=function(_0x2d8378){var _0x27ec1e=this;return new Promise(function(_0x5a477e,_0x40337d){return db[_0x1b46('0x17')][_0x1b46('0x20')]({'raw':_0x2d8378[_0x1b46('0x19')]?_0x2d8378[_0x1b46('0x19')][_0x1b46('0x21')]===undefined?!![]:![]:!![],'where':_0x2d8378[_0x1b46('0x19')]?_0x2d8378[_0x1b46('0x19')][_0x1b46('0x22')]||null:null,'attributes':_0x2d8378[_0x1b46('0x19')]?_0x2d8378[_0x1b46('0x19')][_0x1b46('0x1c')]||null:null,'include':_0x2d8378['options']?_0x2d8378['options']['include']?_[_0x1b46('0x1a')](_0x2d8378['options'][_0x1b46('0x1b')],function(_0x22e69f){return{'model':db[_0x22e69f[_0x1b46('0x1d')]],'as':_0x22e69f['as'],'attributes':_0x22e69f[_0x1b46('0x1c')],'include':_0x22e69f['include']?_[_0x1b46('0x1a')](_0x22e69f[_0x1b46('0x1b')],function(_0x5b44be){return{'model':db[_0x5b44be['model']],'as':_0x5b44be['as'],'attributes':_0x5b44be[_0x1b46('0x1c')],'include':_0x5b44be['include']?_['map'](_0x5b44be['include'],function(_0x3fd126){return{'model':db[_0x3fd126[_0x1b46('0x1d')]],'as':_0x3fd126['as'],'attributes':_0x3fd126[_0x1b46('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1b46('0xb')](function(_0x188451){logger[_0x1b46('0x14')](_0x1b46('0x1f'),_0x2d8378);logger[_0x1b46('0xe')](_0x1b46('0x1f'),_0x2d8378,JSON[_0x1b46('0x10')](_0x188451));_0x5a477e(_0x188451);})['catch'](function(_0x378088){logger[_0x1b46('0x11')](_0x1b46('0x1f'),_0x378088['message'],_0x2d8378);_0x40337d(_0x27ec1e[_0x1b46('0x11')](0x1f4,_0x378088[_0x1b46('0x13')]));});});}; \ No newline at end of file +var _0x172c=['SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetSalesforceAccount','SalesforceAccount','options','where','attributes','limit','include','map','model','then','ShowSalesforceAccount','find','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info'];(function(_0xc5ff15,_0x2584bd){var _0xfb3fe0=function(_0x4221e7){while(--_0x4221e7){_0xc5ff15['push'](_0xc5ff15['shift']());}};_0xfb3fe0(++_0x2584bd);}(_0x172c,0x95));var _0xc172=function(_0x3825a8,_0x2ce1a2){_0x3825a8=_0x3825a8-0x0;var _0xabc9bc=_0x172c[_0x3825a8];return _0xabc9bc;};'use strict';var _=require(_0xc172('0x0'));var util=require('util');var moment=require(_0xc172('0x1'));var BPromise=require('bluebird');var rs=require(_0xc172('0x2'));var fs=require('fs');var Redis=require(_0xc172('0x3'));var db=require(_0xc172('0x4'))['db'];var utils=require(_0xc172('0x5'));var logger=require(_0xc172('0x6'))(_0xc172('0x7'));var config=require(_0xc172('0x8'));var jayson=require(_0xc172('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1634f6,_0x4f8344,_0x4cdeca){return new BPromise(function(_0x24645e,_0x4b67c5){return client['request'](_0x1634f6,_0x4cdeca)['then'](function(_0x5de4f2){logger[_0xc172('0xa')](_0xc172('0xb'),_0x4f8344,'request\x20sent');logger[_0xc172('0xc')](_0xc172('0xd'),_0x4f8344,_0xc172('0xe'),JSON[_0xc172('0xf')](_0x5de4f2));if(_0x5de4f2[_0xc172('0x10')]){if(_0x5de4f2['error']['code']===0x1f4){logger[_0xc172('0x10')](_0xc172('0xb'),_0x4f8344,_0x5de4f2['error']['message']);return _0x4b67c5(_0x5de4f2['error'][_0xc172('0x11')]);}logger[_0xc172('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x4f8344,_0x5de4f2[_0xc172('0x10')][_0xc172('0x11')]);return _0x24645e(_0x5de4f2[_0xc172('0x10')][_0xc172('0x11')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x4f8344,'request\x20sent');_0x24645e(_0x5de4f2[_0xc172('0x12')][_0xc172('0x11')]);}})['catch'](function(_0x599a4c){logger[_0xc172('0x10')](_0xc172('0xb'),_0x4f8344,_0x599a4c);_0x4b67c5(_0x599a4c);});});}exports[_0xc172('0x13')]=function(_0xc01a3d){var _0x325a72=this;return new Promise(function(_0xf4fcf2,_0x1eb4cb){return db[_0xc172('0x14')]['findAll']({'raw':_0xc01a3d['options']?_0xc01a3d['options']['raw']===undefined?!![]:![]:!![],'where':_0xc01a3d['options']?_0xc01a3d[_0xc172('0x15')][_0xc172('0x16')]||null:null,'attributes':_0xc01a3d['options']?_0xc01a3d[_0xc172('0x15')][_0xc172('0x17')]||null:null,'limit':_0xc01a3d['options']?_0xc01a3d[_0xc172('0x15')][_0xc172('0x18')]||null:null,'include':_0xc01a3d[_0xc172('0x15')]?_0xc01a3d['options'][_0xc172('0x19')]?_[_0xc172('0x1a')](_0xc01a3d[_0xc172('0x15')][_0xc172('0x19')],function(_0xdf6004){return{'model':db[_0xdf6004[_0xc172('0x1b')]],'as':_0xdf6004['as'],'attributes':_0xdf6004[_0xc172('0x17')],'include':_0xdf6004[_0xc172('0x19')]?_['map'](_0xdf6004['include'],function(_0x162cab){return{'model':db[_0x162cab[_0xc172('0x1b')]],'as':_0x162cab['as'],'attributes':_0x162cab[_0xc172('0x17')],'include':_0x162cab[_0xc172('0x19')]?_[_0xc172('0x1a')](_0x162cab[_0xc172('0x19')],function(_0x1a5ca7){return{'model':db[_0x1a5ca7['model']],'as':_0x1a5ca7['as'],'attributes':_0x1a5ca7['attributes']};}):[]};}):[]};}):[]:[]})[_0xc172('0x1c')](function(_0x3d49a3){logger[_0xc172('0xa')](_0xc172('0x13'),_0xc01a3d);logger[_0xc172('0xc')](_0xc172('0x13'),_0xc01a3d,JSON[_0xc172('0xf')](_0x3d49a3));_0xf4fcf2(_0x3d49a3);})['catch'](function(_0xdac399){logger[_0xc172('0x10')](_0xc172('0x13'),_0xdac399[_0xc172('0x11')],_0xc01a3d);_0x1eb4cb(_0x325a72['error'](0x1f4,_0xdac399[_0xc172('0x11')]));});});};exports[_0xc172('0x1d')]=function(_0x38fafc){var _0x276a1f=this;return new Promise(function(_0x1d5d87,_0x21b107){return db[_0xc172('0x14')][_0xc172('0x1e')]({'raw':_0x38fafc[_0xc172('0x15')]?_0x38fafc[_0xc172('0x15')][_0xc172('0x1f')]===undefined?!![]:![]:!![],'where':_0x38fafc[_0xc172('0x15')]?_0x38fafc['options'][_0xc172('0x16')]||null:null,'attributes':_0x38fafc[_0xc172('0x15')]?_0x38fafc['options'][_0xc172('0x17')]||null:null,'include':_0x38fafc[_0xc172('0x15')]?_0x38fafc['options'][_0xc172('0x19')]?_['map'](_0x38fafc[_0xc172('0x15')][_0xc172('0x19')],function(_0x5c187e){return{'model':db[_0x5c187e[_0xc172('0x1b')]],'as':_0x5c187e['as'],'attributes':_0x5c187e[_0xc172('0x17')],'include':_0x5c187e[_0xc172('0x19')]?_[_0xc172('0x1a')](_0x5c187e['include'],function(_0x1f938a){return{'model':db[_0x1f938a[_0xc172('0x1b')]],'as':_0x1f938a['as'],'attributes':_0x1f938a[_0xc172('0x17')],'include':_0x1f938a[_0xc172('0x19')]?_['map'](_0x1f938a[_0xc172('0x19')],function(_0x169a77){return{'model':db[_0x169a77['model']],'as':_0x169a77['as'],'attributes':_0x169a77['attributes']};}):[]};}):[]};}):[]:[]})[_0xc172('0x1c')](function(_0x4a505b){logger[_0xc172('0xa')](_0xc172('0x1d'),_0x38fafc);logger[_0xc172('0xc')]('ShowSalesforceAccount',_0x38fafc,JSON[_0xc172('0xf')](_0x4a505b));_0x1d5d87(_0x4a505b);})['catch'](function(_0x571f19){logger[_0xc172('0x10')](_0xc172('0x1d'),_0x571f19['message'],_0x38fafc);_0x21b107(_0x276a1f[_0xc172('0x10')](0x1f4,_0x571f19[_0xc172('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index fa186b9..61d816d 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xdb28,0x106));var _0x8db2=function(_0x4d1f7c,_0x39e7bd){_0x4d1f7c=_0x4d1f7c-0x0;var _0x7501e3=_0xdb28[_0x4d1f7c];return _0x7501e3;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x3f4190,_0x4bd53a){var _0x5b8e7e=function(_0x1ba6c5){while(--_0x1ba6c5){_0x3f4190['push'](_0x3f4190['shift']());}};_0x5b8e7e(++_0x4bd53a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 20edcdc..860aa96 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 _0x95c9=['ENUM','contact','lead','account_contact_lead','account','contact_lead','nothing','exports','STRING','Task'];(function(_0x42c1b3,_0x35f945){var _0x1a9450=function(_0x49d7b0){while(--_0x49d7b0){_0x42c1b3['push'](_0x42c1b3['shift']());}};_0x1a9450(++_0x35f945);}(_0x95c9,0x1e7));var _0x995c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x95c9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x995c('0x0')]={'name':{'type':Sequelize[_0x995c('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x995c('0x2'),'Case'),'defaultValue':_0x995c('0x2')},'moduleSearch':{'type':Sequelize[_0x995c('0x3')]('contact_lead',_0x995c('0x4'),_0x995c('0x5'),_0x995c('0x6'),_0x995c('0x7')),'defaultValue':_0x995c('0x8')},'moduleCreate':{'type':Sequelize['ENUM'](_0x995c('0x9'),'contact','lead','account'),'defaultValue':_0x995c('0x5')},'leadId':{'type':Sequelize[_0x995c('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x995c('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x995c('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x995c('0x1')]}}; \ No newline at end of file +var _0x7f8d=['ENUM','Case','contact','lead','account_contact_lead','account','contact_lead','nothing','sequelize','exports','STRING'];(function(_0x2efaa9,_0x4a1a2e){var _0x593b7f=function(_0x39fc3d){while(--_0x39fc3d){_0x2efaa9['push'](_0x2efaa9['shift']());}};_0x593b7f(++_0x4a1a2e);}(_0x7f8d,0x1ec));var _0xd7f8=function(_0x2c5d5a,_0x4d7380){_0x2c5d5a=_0x2c5d5a-0x0;var _0x13fddf=_0x7f8d[_0x2c5d5a];return _0x13fddf;};'use strict';var Sequelize=require(_0xd7f8('0x0'));module[_0xd7f8('0x1')]={'name':{'type':Sequelize[_0xd7f8('0x2')]},'description':{'type':Sequelize[_0xd7f8('0x2')]},'ticketType':{'type':Sequelize[_0xd7f8('0x3')]('Task',_0xd7f8('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xd7f8('0x3')]('contact_lead',_0xd7f8('0x5'),_0xd7f8('0x6'),_0xd7f8('0x7'),_0xd7f8('0x8')),'defaultValue':_0xd7f8('0x9')},'moduleCreate':{'type':Sequelize[_0xd7f8('0x3')](_0xd7f8('0xa'),_0xd7f8('0x5'),'lead',_0xd7f8('0x8')),'defaultValue':_0xd7f8('0x6')},'leadId':{'type':Sequelize[_0xd7f8('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xd7f8('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xd7f8('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xd7f8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 13fa993..f238aea 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 _0xfaa1=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','body','getFields','findOne','SalesforceField','rawAttributes','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','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','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','SalesforceConfiguration','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x307809,_0x3377e5){var _0x4f9872=function(_0x161253){while(--_0x161253){_0x307809['push'](_0x307809['shift']());}};_0x4f9872(++_0x3377e5);}(_0xfaa1,0x110));var _0x1faa=function(_0x360b7b,_0x8fce27){_0x360b7b=_0x360b7b-0x0;var _0x7040ed=_0xfaa1[_0x360b7b];return _0x7040ed;};'use strict';var emlformat=require(_0x1faa('0x0'));var rimraf=require(_0x1faa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1faa('0x2'));var rp=require(_0x1faa('0x3'));var moment=require('moment');var BPromise=require(_0x1faa('0x4'));var Mustache=require(_0x1faa('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1faa('0x6'));var csv=require(_0x1faa('0x7'));var ejs=require(_0x1faa('0x8'));var fs=require('fs');var fs_extra=require(_0x1faa('0x9'));var _=require(_0x1faa('0xa'));var squel=require(_0x1faa('0xb'));var crypto=require(_0x1faa('0xc'));var jsforce=require(_0x1faa('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1faa('0x7'));var querystring=require(_0x1faa('0xe'));var Papa=require(_0x1faa('0xf'));var Redis=require(_0x1faa('0x10'));var authService=require(_0x1faa('0x11'));var qs=require(_0x1faa('0x12'));var as=require(_0x1faa('0x13'));var hardwareService=require(_0x1faa('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1faa('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1faa('0x16'))['db'];function respondWithStatusCode(_0x34c321,_0x2d7a4d){_0x2d7a4d=_0x2d7a4d||0xcc;return function(_0x439e8a){if(_0x439e8a){return _0x34c321['sendStatus'](_0x2d7a4d);}return _0x34c321[_0x1faa('0x17')](_0x2d7a4d)[_0x1faa('0x18')]();};}function respondWithResult(_0x47dadb,_0x2d7fcb){_0x2d7fcb=_0x2d7fcb||0xc8;return function(_0x4d55f2){if(_0x4d55f2){return _0x47dadb[_0x1faa('0x17')](_0x2d7fcb)[_0x1faa('0x19')](_0x4d55f2);}};}function respondWithFilteredResult(_0x54f593,_0x40f003){return function(_0x458c4c){if(_0x458c4c){var _0x710b66=typeof _0x40f003[_0x1faa('0x1a')]===_0x1faa('0x1b')&&typeof _0x40f003['limit']===_0x1faa('0x1b');var _0xd150aa=_0x458c4c[_0x1faa('0x1c')];var _0xc431f1=_0x710b66?0x0:_0x40f003[_0x1faa('0x1a')];var _0x3fd3a0=_0x710b66?_0x458c4c[_0x1faa('0x1c')]:_0x40f003[_0x1faa('0x1a')]+_0x40f003[_0x1faa('0x1d')];var _0x4e4f25;if(_0x3fd3a0>=_0xd150aa){_0x3fd3a0=_0xd150aa;_0x4e4f25=0xc8;}else{_0x4e4f25=0xce;}_0x54f593['status'](_0x4e4f25);return _0x54f593[_0x1faa('0x1e')]('Content-Range',_0xc431f1+'-'+_0x3fd3a0+'/'+_0xd150aa)[_0x1faa('0x19')](_0x458c4c);}return null;};}function patchUpdates(_0x555d37){return function(_0x395180){try{jsonpatch[_0x1faa('0x1f')](_0x395180,_0x555d37,!![]);}catch(_0x2b63be){return BPromise[_0x1faa('0x20')](_0x2b63be);}return _0x395180['save']();};}function saveUpdates(_0x2d47ff,_0x439a12){return function(_0x40b0c6){if(_0x40b0c6){return _0x40b0c6[_0x1faa('0x21')](_0x2d47ff)[_0x1faa('0x22')](function(_0x511235){return _0x511235;});}return null;};}function removeEntity(_0x54d6ea,_0x2f7343){return function(_0x4fb7d0){if(_0x4fb7d0){return _0x4fb7d0[_0x1faa('0x23')]()['then'](function(){_0x54d6ea[_0x1faa('0x17')](0xcc)[_0x1faa('0x18')]();});}};}function handleEntityNotFound(_0x2736dc,_0x4a0e7b){return function(_0x3a0b94){if(!_0x3a0b94){_0x2736dc[_0x1faa('0x24')](0x194);}return _0x3a0b94;};}function handleError(_0x110149,_0x5d3fde){_0x5d3fde=_0x5d3fde||0x1f4;return function(_0x2ee9ad){logger[_0x1faa('0x25')](_0x2ee9ad[_0x1faa('0x26')]);if(_0x2ee9ad[_0x1faa('0x27')]){delete _0x2ee9ad[_0x1faa('0x27')];}_0x110149[_0x1faa('0x17')](_0x5d3fde)[_0x1faa('0x28')](_0x2ee9ad);};}exports[_0x1faa('0x29')]=function(_0x55e24c,_0x5b0fe8){var _0x45bde9={},_0x5db843={},_0x2ca1c8={'count':0x0,'rows':[]};var _0x47740a=_[_0x1faa('0x2a')](db[_0x1faa('0x2b')]['rawAttributes'],function(_0x5df5ae){return{'name':_0x5df5ae[_0x1faa('0x2c')],'type':_0x5df5ae[_0x1faa('0x2d')][_0x1faa('0x2e')]};});_0x5db843[_0x1faa('0x2f')]=_[_0x1faa('0x2a')](_0x47740a,_0x1faa('0x27'));_0x5db843[_0x1faa('0x30')]=_[_0x1faa('0x31')](_0x55e24c[_0x1faa('0x30')]);_0x5db843[_0x1faa('0x32')]=_[_0x1faa('0x33')](_0x5db843[_0x1faa('0x2f')],_0x5db843[_0x1faa('0x30')]);_0x45bde9[_0x1faa('0x34')]=_[_0x1faa('0x33')](_0x5db843[_0x1faa('0x2f')],qs[_0x1faa('0x35')](_0x55e24c['query']['fields']));_0x45bde9[_0x1faa('0x34')]=_0x45bde9[_0x1faa('0x34')]['length']?_0x45bde9[_0x1faa('0x34')]:_0x5db843[_0x1faa('0x2f')];if(!_0x55e24c['query'][_0x1faa('0x36')](_0x1faa('0x37'))){_0x45bde9['limit']=qs[_0x1faa('0x1d')](_0x55e24c[_0x1faa('0x30')][_0x1faa('0x1d')]);_0x45bde9[_0x1faa('0x1a')]=qs[_0x1faa('0x1a')](_0x55e24c['query'][_0x1faa('0x1a')]);}_0x45bde9[_0x1faa('0x38')]=qs['sort'](_0x55e24c['query'][_0x1faa('0x39')]);_0x45bde9[_0x1faa('0x3a')]=qs[_0x1faa('0x32')](_[_0x1faa('0x3b')](_0x55e24c[_0x1faa('0x30')],_0x5db843[_0x1faa('0x32')]),_0x47740a);if(_0x55e24c[_0x1faa('0x30')][_0x1faa('0x3c')]){_0x45bde9[_0x1faa('0x3a')]=_[_0x1faa('0x3d')](_0x45bde9['where'],{'$or':_[_0x1faa('0x2a')](_0x47740a,function(_0x59e8e2){if(_0x59e8e2['type']!==_0x1faa('0x3e')){var _0xf0dc6b={};_0xf0dc6b[_0x59e8e2[_0x1faa('0x27')]]={'$like':'%'+_0x55e24c[_0x1faa('0x30')][_0x1faa('0x3c')]+'%'};return _0xf0dc6b;}})});}_0x45bde9=_['merge']({},_0x45bde9,_0x55e24c['options']);var _0x43132a={'where':_0x45bde9[_0x1faa('0x3a')]};return db[_0x1faa('0x2b')][_0x1faa('0x1c')](_0x43132a)[_0x1faa('0x22')](function(_0x3eb61e){_0x2ca1c8[_0x1faa('0x1c')]=_0x3eb61e;if(_0x55e24c['query'][_0x1faa('0x3f')]){_0x45bde9['include']=[{'all':!![]}];}return db[_0x1faa('0x2b')][_0x1faa('0x40')](_0x45bde9);})[_0x1faa('0x22')](function(_0x6b3d8a){_0x2ca1c8[_0x1faa('0x41')]=_0x6b3d8a;return _0x2ca1c8;})[_0x1faa('0x22')](respondWithFilteredResult(_0x5b0fe8,_0x45bde9))[_0x1faa('0x42')](handleError(_0x5b0fe8,null));};exports[_0x1faa('0x43')]=function(_0x22a24b,_0x1e61bd){var _0x3c82c6={'raw':![],'where':{'id':_0x22a24b[_0x1faa('0x44')]['id']}},_0x5ac974={};_0x5ac974[_0x1faa('0x2f')]=_[_0x1faa('0x31')](db[_0x1faa('0x2b')]['rawAttributes']);_0x5ac974[_0x1faa('0x30')]=_[_0x1faa('0x31')](_0x22a24b['query']);_0x5ac974[_0x1faa('0x32')]=_[_0x1faa('0x33')](_0x5ac974['model'],_0x5ac974['query']);_0x3c82c6[_0x1faa('0x34')]=_[_0x1faa('0x33')](_0x5ac974[_0x1faa('0x2f')],qs[_0x1faa('0x35')](_0x22a24b[_0x1faa('0x30')]['fields']));_0x3c82c6[_0x1faa('0x34')]=_0x3c82c6['attributes'][_0x1faa('0x45')]?_0x3c82c6['attributes']:_0x5ac974[_0x1faa('0x2f')];if(_0x22a24b[_0x1faa('0x30')][_0x1faa('0x3f')]){_0x3c82c6[_0x1faa('0x46')]=[{'all':!![]}];}_0x3c82c6=_[_0x1faa('0x3d')]({},_0x3c82c6,_0x22a24b[_0x1faa('0x47')]);return db[_0x1faa('0x2b')][_0x1faa('0x48')](_0x3c82c6)[_0x1faa('0x22')](handleEntityNotFound(_0x1e61bd,null))[_0x1faa('0x22')](respondWithResult(_0x1e61bd,null))['catch'](handleError(_0x1e61bd,null));};exports[_0x1faa('0x49')]=function(_0x4bc18d,_0x1085d6){return db[_0x1faa('0x2b')][_0x1faa('0x49')](_0x4bc18d[_0x1faa('0x4a')],{})[_0x1faa('0x22')](respondWithResult(_0x1085d6,0xc9))[_0x1faa('0x42')](handleError(_0x1085d6,null));};exports[_0x1faa('0x21')]=function(_0x2a3c81,_0x1cdc72){if(_0x2a3c81['body']['id']){delete _0x2a3c81['body']['id'];}return db[_0x1faa('0x2b')]['find']({'where':{'id':_0x2a3c81[_0x1faa('0x44')]['id']}})[_0x1faa('0x22')](handleEntityNotFound(_0x1cdc72,null))['then'](saveUpdates(_0x2a3c81[_0x1faa('0x4a')],null))[_0x1faa('0x22')](respondWithResult(_0x1cdc72,null))[_0x1faa('0x42')](handleError(_0x1cdc72,null));};exports[_0x1faa('0x23')]=function(_0x54ccfa,_0x189b5d){return db[_0x1faa('0x2b')][_0x1faa('0x48')]({'where':{'id':_0x54ccfa[_0x1faa('0x44')]['id']}})[_0x1faa('0x22')](handleEntityNotFound(_0x189b5d,null))[_0x1faa('0x22')](removeEntity(_0x189b5d,null))[_0x1faa('0x42')](handleError(_0x189b5d,null));};exports[_0x1faa('0x4b')]=function(_0x93d99b,_0xa71afb,_0x517a78){var _0x313a26={};var _0x4c04c5={};var _0x390a3f;var _0x5da4df;return db[_0x1faa('0x2b')][_0x1faa('0x4c')]({'where':{'id':_0x93d99b[_0x1faa('0x44')]['id']}})[_0x1faa('0x22')](handleEntityNotFound(_0xa71afb,null))[_0x1faa('0x22')](function(_0xb301de){if(_0xb301de){_0x390a3f=_0xb301de;_0x4c04c5[_0x1faa('0x2f')]=_[_0x1faa('0x31')](db[_0x1faa('0x4d')][_0x1faa('0x4e')]);_0x4c04c5[_0x1faa('0x30')]=_[_0x1faa('0x31')](_0x93d99b['query']);_0x4c04c5[_0x1faa('0x32')]=_[_0x1faa('0x33')](_0x4c04c5[_0x1faa('0x2f')],_0x4c04c5[_0x1faa('0x30')]);_0x313a26['attributes']=_[_0x1faa('0x33')](_0x4c04c5['model'],qs[_0x1faa('0x35')](_0x93d99b[_0x1faa('0x30')][_0x1faa('0x35')]));_0x313a26[_0x1faa('0x34')]=_0x313a26[_0x1faa('0x34')]['length']?_0x313a26['attributes']:_0x4c04c5[_0x1faa('0x2f')];_0x313a26['order']=qs[_0x1faa('0x39')](_0x93d99b[_0x1faa('0x30')][_0x1faa('0x39')]);_0x313a26[_0x1faa('0x3a')]=qs[_0x1faa('0x32')](_[_0x1faa('0x3b')](_0x93d99b[_0x1faa('0x30')],_0x4c04c5[_0x1faa('0x32')]));if(_0x93d99b[_0x1faa('0x30')][_0x1faa('0x3c')]){_0x313a26[_0x1faa('0x3a')]=_[_0x1faa('0x3d')](_0x313a26['where'],{'$or':_['map'](_0x313a26[_0x1faa('0x34')],function(_0x29b4ed){var _0xc133fe={};_0xc133fe[_0x29b4ed]={'$like':'%'+_0x93d99b['query'][_0x1faa('0x3c')]+'%'};return _0xc133fe;})});}_0x313a26=_[_0x1faa('0x3d')]({},_0x313a26,_0x93d99b[_0x1faa('0x47')]);return _0x390a3f[_0x1faa('0x4b')](_0x313a26);}})[_0x1faa('0x22')](function(_0x56177d){if(_0x56177d){_0x5da4df=_0x56177d[_0x1faa('0x45')];if(!_0x93d99b[_0x1faa('0x30')][_0x1faa('0x36')]('nolimit')){_0x313a26[_0x1faa('0x1d')]=qs[_0x1faa('0x1d')](_0x93d99b[_0x1faa('0x30')][_0x1faa('0x1d')]);_0x313a26['offset']=qs[_0x1faa('0x1a')](_0x93d99b[_0x1faa('0x30')][_0x1faa('0x1a')]);}return _0x390a3f['getFields'](_0x313a26);}})[_0x1faa('0x22')](function(_0x492db3){if(_0x492db3){return _0x492db3?{'count':_0x5da4df,'rows':_0x492db3}:null;}})[_0x1faa('0x22')](respondWithResult(_0xa71afb,null))[_0x1faa('0x42')](handleError(_0xa71afb,null));};exports[_0x1faa('0x4f')]=function(_0x29afbd,_0x1f6822,_0x46f37a){var _0x4547e1={};var _0x7aac6={};var _0x3d309c;var _0x3744d0;return db['SalesforceConfiguration'][_0x1faa('0x4c')]({'where':{'id':_0x29afbd[_0x1faa('0x44')]['id']}})[_0x1faa('0x22')](handleEntityNotFound(_0x1f6822,null))[_0x1faa('0x22')](function(_0x5787b1){if(_0x5787b1){_0x3d309c=_0x5787b1;_0x7aac6['model']=_[_0x1faa('0x31')](db[_0x1faa('0x4d')][_0x1faa('0x4e')]);_0x7aac6[_0x1faa('0x30')]=_['keys'](_0x29afbd[_0x1faa('0x30')]);_0x7aac6[_0x1faa('0x32')]=_[_0x1faa('0x33')](_0x7aac6[_0x1faa('0x2f')],_0x7aac6[_0x1faa('0x30')]);_0x4547e1[_0x1faa('0x34')]=_['intersection'](_0x7aac6[_0x1faa('0x2f')],qs[_0x1faa('0x35')](_0x29afbd[_0x1faa('0x30')][_0x1faa('0x35')]));_0x4547e1[_0x1faa('0x34')]=_0x4547e1[_0x1faa('0x34')][_0x1faa('0x45')]?_0x4547e1[_0x1faa('0x34')]:_0x7aac6['model'];_0x4547e1[_0x1faa('0x38')]=qs['sort'](_0x29afbd[_0x1faa('0x30')][_0x1faa('0x39')]);_0x4547e1[_0x1faa('0x3a')]=qs[_0x1faa('0x32')](_[_0x1faa('0x3b')](_0x29afbd[_0x1faa('0x30')],_0x7aac6[_0x1faa('0x32')]));if(_0x29afbd['query'][_0x1faa('0x3c')]){_0x4547e1[_0x1faa('0x3a')]=_['merge'](_0x4547e1[_0x1faa('0x3a')],{'$or':_[_0x1faa('0x2a')](_0x4547e1[_0x1faa('0x34')],function(_0xf99f33){var _0x3cfb06={};_0x3cfb06[_0xf99f33]={'$like':'%'+_0x29afbd[_0x1faa('0x30')][_0x1faa('0x3c')]+'%'};return _0x3cfb06;})});}_0x4547e1=_[_0x1faa('0x3d')]({},_0x4547e1,_0x29afbd[_0x1faa('0x47')]);return _0x3d309c[_0x1faa('0x4f')](_0x4547e1);}})[_0x1faa('0x22')](function(_0x1cb6a5){if(_0x1cb6a5){_0x3744d0=_0x1cb6a5[_0x1faa('0x45')];if(!_0x29afbd[_0x1faa('0x30')][_0x1faa('0x36')](_0x1faa('0x37'))){_0x4547e1[_0x1faa('0x1d')]=qs['limit'](_0x29afbd[_0x1faa('0x30')][_0x1faa('0x1d')]);_0x4547e1[_0x1faa('0x1a')]=qs[_0x1faa('0x1a')](_0x29afbd[_0x1faa('0x30')]['offset']);}return _0x3d309c[_0x1faa('0x4f')](_0x4547e1);}})['then'](function(_0x2887bf){if(_0x2887bf){return _0x2887bf?{'count':_0x3744d0,'rows':_0x2887bf}:null;}})[_0x1faa('0x22')](respondWithResult(_0x1f6822,null))[_0x1faa('0x42')](handleError(_0x1f6822,null));};exports[_0x1faa('0x50')]=function(_0x24ab61,_0x192e1d,_0x2192fd){var _0xdaac2e={};var _0x182416={};var _0x140e9d;var _0x461b9b;return db[_0x1faa('0x2b')][_0x1faa('0x4c')]({'where':{'id':_0x24ab61[_0x1faa('0x44')]['id']}})[_0x1faa('0x22')](handleEntityNotFound(_0x192e1d,null))[_0x1faa('0x22')](function(_0x46f4f3){if(_0x46f4f3){_0x140e9d=_0x46f4f3;_0x182416[_0x1faa('0x2f')]=_[_0x1faa('0x31')](db[_0x1faa('0x4d')][_0x1faa('0x4e')]);_0x182416['query']=_[_0x1faa('0x31')](_0x24ab61[_0x1faa('0x30')]);_0x182416[_0x1faa('0x32')]=_['intersection'](_0x182416['model'],_0x182416[_0x1faa('0x30')]);_0xdaac2e['attributes']=_['intersection'](_0x182416[_0x1faa('0x2f')],qs[_0x1faa('0x35')](_0x24ab61[_0x1faa('0x30')][_0x1faa('0x35')]));_0xdaac2e['attributes']=_0xdaac2e[_0x1faa('0x34')][_0x1faa('0x45')]?_0xdaac2e['attributes']:_0x182416[_0x1faa('0x2f')];_0xdaac2e[_0x1faa('0x38')]=qs[_0x1faa('0x39')](_0x24ab61[_0x1faa('0x30')][_0x1faa('0x39')]);_0xdaac2e['where']=qs[_0x1faa('0x32')](_[_0x1faa('0x3b')](_0x24ab61[_0x1faa('0x30')],_0x182416[_0x1faa('0x32')]));if(_0x24ab61[_0x1faa('0x30')][_0x1faa('0x3c')]){_0xdaac2e[_0x1faa('0x3a')]=_[_0x1faa('0x3d')](_0xdaac2e[_0x1faa('0x3a')],{'$or':_[_0x1faa('0x2a')](_0xdaac2e[_0x1faa('0x34')],function(_0x1fefce){var _0x85c1c5={};_0x85c1c5[_0x1fefce]={'$like':'%'+_0x24ab61['query'][_0x1faa('0x3c')]+'%'};return _0x85c1c5;})});}_0xdaac2e=_[_0x1faa('0x3d')]({},_0xdaac2e,_0x24ab61['options']);return _0x140e9d['getDescriptions'](_0xdaac2e);}})[_0x1faa('0x22')](function(_0x445ead){if(_0x445ead){_0x461b9b=_0x445ead[_0x1faa('0x45')];if(!_0x24ab61[_0x1faa('0x30')][_0x1faa('0x36')](_0x1faa('0x37'))){_0xdaac2e['limit']=qs[_0x1faa('0x1d')](_0x24ab61[_0x1faa('0x30')]['limit']);_0xdaac2e['offset']=qs[_0x1faa('0x1a')](_0x24ab61[_0x1faa('0x30')]['offset']);}return _0x140e9d['getDescriptions'](_0xdaac2e);}})[_0x1faa('0x22')](function(_0xa7fa09){if(_0xa7fa09){return _0xa7fa09?{'count':_0x461b9b,'rows':_0xa7fa09}:null;}})[_0x1faa('0x22')](respondWithResult(_0x192e1d,null))[_0x1faa('0x42')](handleError(_0x192e1d,null));}; \ No newline at end of file +var _0xd58c=['attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','keys','find','catch','create','body','getFields','SalesforceField','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection'];(function(_0x44e167,_0x377fc6){var _0x32abc6=function(_0xb4a31b){while(--_0xb4a31b){_0x44e167['push'](_0x44e167['shift']());}};_0x32abc6(++_0x377fc6);}(_0xd58c,0x70));var _0xcd58=function(_0xe971aa,_0x403c38){_0xe971aa=_0xe971aa-0x0;var _0x1125dd=_0xd58c[_0xe971aa];return _0x1125dd;};'use strict';var emlformat=require(_0xcd58('0x0'));var rimraf=require(_0xcd58('0x1'));var zipdir=require(_0xcd58('0x2'));var jsonpatch=require(_0xcd58('0x3'));var rp=require(_0xcd58('0x4'));var moment=require(_0xcd58('0x5'));var BPromise=require(_0xcd58('0x6'));var Mustache=require(_0xcd58('0x7'));var util=require(_0xcd58('0x8'));var path=require(_0xcd58('0x9'));var sox=require(_0xcd58('0xa'));var csv=require(_0xcd58('0xb'));var ejs=require(_0xcd58('0xc'));var fs=require('fs');var fs_extra=require(_0xcd58('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcd58('0xe'));var jsforce=require(_0xcd58('0xf'));var deskjs=require(_0xcd58('0x10'));var toCsv=require(_0xcd58('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcd58('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcd58('0x12'));var as=require(_0xcd58('0x13'));var hardwareService=require(_0xcd58('0x14'));var logger=require(_0xcd58('0x15'))(_0xcd58('0x16'));var utils=require(_0xcd58('0x17'));var config=require(_0xcd58('0x18'));var licenseUtil=require(_0xcd58('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c9b36,_0x1a5636){_0x1a5636=_0x1a5636||0xcc;return function(_0x377ec6){if(_0x377ec6){return _0x4c9b36[_0xcd58('0x1a')](_0x1a5636);}return _0x4c9b36[_0xcd58('0x1b')](_0x1a5636)['end']();};}function respondWithResult(_0x2688b0,_0x1de60e){_0x1de60e=_0x1de60e||0xc8;return function(_0x428e47){if(_0x428e47){return _0x2688b0['status'](_0x1de60e)[_0xcd58('0x1c')](_0x428e47);}};}function respondWithFilteredResult(_0x4d3644,_0x51e49b){return function(_0x35e966){if(_0x35e966){var _0x438e5a=typeof _0x51e49b[_0xcd58('0x1d')]===_0xcd58('0x1e')&&typeof _0x51e49b[_0xcd58('0x1f')]===_0xcd58('0x1e');var _0x120b4f=_0x35e966['count'];var _0x5b0a9a=_0x438e5a?0x0:_0x51e49b[_0xcd58('0x1d')];var _0x2950cc=_0x438e5a?_0x35e966['count']:_0x51e49b[_0xcd58('0x1d')]+_0x51e49b[_0xcd58('0x1f')];var _0x147426;if(_0x2950cc>=_0x120b4f){_0x2950cc=_0x120b4f;_0x147426=0xc8;}else{_0x147426=0xce;}_0x4d3644[_0xcd58('0x1b')](_0x147426);return _0x4d3644[_0xcd58('0x20')](_0xcd58('0x21'),_0x5b0a9a+'-'+_0x2950cc+'/'+_0x120b4f)[_0xcd58('0x1c')](_0x35e966);}return null;};}function patchUpdates(_0x3ddcb1){return function(_0x239baa){try{jsonpatch[_0xcd58('0x22')](_0x239baa,_0x3ddcb1,!![]);}catch(_0x933c68){return BPromise[_0xcd58('0x23')](_0x933c68);}return _0x239baa['save']();};}function saveUpdates(_0x1b5bd8,_0xd80df7){return function(_0xa51a69){if(_0xa51a69){return _0xa51a69[_0xcd58('0x24')](_0x1b5bd8)[_0xcd58('0x25')](function(_0x1755d0){return _0x1755d0;});}return null;};}function removeEntity(_0x2b4879,_0x368536){return function(_0x42f061){if(_0x42f061){return _0x42f061[_0xcd58('0x26')]()['then'](function(){_0x2b4879[_0xcd58('0x1b')](0xcc)[_0xcd58('0x27')]();});}};}function handleEntityNotFound(_0x4496cf,_0x45dc8a){return function(_0xa20ef9){if(!_0xa20ef9){_0x4496cf[_0xcd58('0x1a')](0x194);}return _0xa20ef9;};}function handleError(_0xe57e05,_0x39b470){_0x39b470=_0x39b470||0x1f4;return function(_0x2dbcb2){logger[_0xcd58('0x28')](_0x2dbcb2['stack']);if(_0x2dbcb2[_0xcd58('0x29')]){delete _0x2dbcb2['name'];}_0xe57e05[_0xcd58('0x1b')](_0x39b470)[_0xcd58('0x2a')](_0x2dbcb2);};}exports[_0xcd58('0x2b')]=function(_0x8b11f8,_0xe82743){var _0x59f9c2={},_0x301ee1={},_0x36a3c1={'count':0x0,'rows':[]};var _0x2e20db=_[_0xcd58('0x2c')](db[_0xcd58('0x2d')][_0xcd58('0x2e')],function(_0x59e0cc){return{'name':_0x59e0cc[_0xcd58('0x2f')],'type':_0x59e0cc[_0xcd58('0x30')][_0xcd58('0x31')]};});_0x301ee1[_0xcd58('0x32')]=_[_0xcd58('0x2c')](_0x2e20db,_0xcd58('0x29'));_0x301ee1[_0xcd58('0x33')]=_['keys'](_0x8b11f8[_0xcd58('0x33')]);_0x301ee1[_0xcd58('0x34')]=_[_0xcd58('0x35')](_0x301ee1['model'],_0x301ee1[_0xcd58('0x33')]);_0x59f9c2[_0xcd58('0x36')]=_[_0xcd58('0x35')](_0x301ee1[_0xcd58('0x32')],qs['fields'](_0x8b11f8['query'][_0xcd58('0x37')]));_0x59f9c2[_0xcd58('0x36')]=_0x59f9c2[_0xcd58('0x36')][_0xcd58('0x38')]?_0x59f9c2[_0xcd58('0x36')]:_0x301ee1['model'];if(!_0x8b11f8[_0xcd58('0x33')]['hasOwnProperty'](_0xcd58('0x39'))){_0x59f9c2[_0xcd58('0x1f')]=qs[_0xcd58('0x1f')](_0x8b11f8[_0xcd58('0x33')][_0xcd58('0x1f')]);_0x59f9c2[_0xcd58('0x1d')]=qs[_0xcd58('0x1d')](_0x8b11f8[_0xcd58('0x33')]['offset']);}_0x59f9c2[_0xcd58('0x3a')]=qs[_0xcd58('0x3b')](_0x8b11f8['query']['sort']);_0x59f9c2[_0xcd58('0x3c')]=qs[_0xcd58('0x34')](_[_0xcd58('0x3d')](_0x8b11f8['query'],_0x301ee1[_0xcd58('0x34')]),_0x2e20db);if(_0x8b11f8[_0xcd58('0x33')][_0xcd58('0x3e')]){_0x59f9c2[_0xcd58('0x3c')]=_[_0xcd58('0x3f')](_0x59f9c2[_0xcd58('0x3c')],{'$or':_[_0xcd58('0x2c')](_0x2e20db,function(_0x199be8){if(_0x199be8['type']!==_0xcd58('0x40')){var _0x1431b9={};_0x1431b9[_0x199be8[_0xcd58('0x29')]]={'$like':'%'+_0x8b11f8[_0xcd58('0x33')][_0xcd58('0x3e')]+'%'};return _0x1431b9;}})});}_0x59f9c2=_[_0xcd58('0x3f')]({},_0x59f9c2,_0x8b11f8[_0xcd58('0x41')]);var _0x3ab699={'where':_0x59f9c2['where']};return db[_0xcd58('0x2d')][_0xcd58('0x42')](_0x3ab699)[_0xcd58('0x25')](function(_0x2870da){_0x36a3c1[_0xcd58('0x42')]=_0x2870da;if(_0x8b11f8[_0xcd58('0x33')][_0xcd58('0x43')]){_0x59f9c2[_0xcd58('0x44')]=[{'all':!![]}];}return db[_0xcd58('0x2d')]['findAll'](_0x59f9c2);})[_0xcd58('0x25')](function(_0x45c924){_0x36a3c1[_0xcd58('0x45')]=_0x45c924;return _0x36a3c1;})[_0xcd58('0x25')](respondWithFilteredResult(_0xe82743,_0x59f9c2))['catch'](handleError(_0xe82743,null));};exports[_0xcd58('0x46')]=function(_0x331482,_0x26e510){var _0x26e8a0={'raw':![],'where':{'id':_0x331482[_0xcd58('0x47')]['id']}},_0x3b7673={};_0x3b7673[_0xcd58('0x32')]=_[_0xcd58('0x48')](db[_0xcd58('0x2d')]['rawAttributes']);_0x3b7673[_0xcd58('0x33')]=_[_0xcd58('0x48')](_0x331482[_0xcd58('0x33')]);_0x3b7673['filters']=_[_0xcd58('0x35')](_0x3b7673[_0xcd58('0x32')],_0x3b7673[_0xcd58('0x33')]);_0x26e8a0[_0xcd58('0x36')]=_[_0xcd58('0x35')](_0x3b7673[_0xcd58('0x32')],qs['fields'](_0x331482[_0xcd58('0x33')][_0xcd58('0x37')]));_0x26e8a0[_0xcd58('0x36')]=_0x26e8a0['attributes'][_0xcd58('0x38')]?_0x26e8a0['attributes']:_0x3b7673[_0xcd58('0x32')];if(_0x331482[_0xcd58('0x33')][_0xcd58('0x43')]){_0x26e8a0[_0xcd58('0x44')]=[{'all':!![]}];}_0x26e8a0=_[_0xcd58('0x3f')]({},_0x26e8a0,_0x331482[_0xcd58('0x41')]);return db[_0xcd58('0x2d')][_0xcd58('0x49')](_0x26e8a0)['then'](handleEntityNotFound(_0x26e510,null))[_0xcd58('0x25')](respondWithResult(_0x26e510,null))[_0xcd58('0x4a')](handleError(_0x26e510,null));};exports[_0xcd58('0x4b')]=function(_0x1b7da6,_0x21e4cd){return db['SalesforceConfiguration'][_0xcd58('0x4b')](_0x1b7da6[_0xcd58('0x4c')],{})[_0xcd58('0x25')](respondWithResult(_0x21e4cd,0xc9))['catch'](handleError(_0x21e4cd,null));};exports[_0xcd58('0x24')]=function(_0x35e9f1,_0x5af325){if(_0x35e9f1[_0xcd58('0x4c')]['id']){delete _0x35e9f1[_0xcd58('0x4c')]['id'];}return db['SalesforceConfiguration'][_0xcd58('0x49')]({'where':{'id':_0x35e9f1[_0xcd58('0x47')]['id']}})[_0xcd58('0x25')](handleEntityNotFound(_0x5af325,null))[_0xcd58('0x25')](saveUpdates(_0x35e9f1[_0xcd58('0x4c')],null))[_0xcd58('0x25')](respondWithResult(_0x5af325,null))[_0xcd58('0x4a')](handleError(_0x5af325,null));};exports[_0xcd58('0x26')]=function(_0x4ae5ae,_0x56a3e3){return db['SalesforceConfiguration']['find']({'where':{'id':_0x4ae5ae[_0xcd58('0x47')]['id']}})[_0xcd58('0x25')](handleEntityNotFound(_0x56a3e3,null))[_0xcd58('0x25')](removeEntity(_0x56a3e3,null))[_0xcd58('0x4a')](handleError(_0x56a3e3,null));};exports[_0xcd58('0x4d')]=function(_0x12eb08,_0x1abafe,_0x1f519e){var _0x5bc763={};var _0x24a371={};var _0x598566;var _0x3fa72e;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x12eb08[_0xcd58('0x47')]['id']}})[_0xcd58('0x25')](handleEntityNotFound(_0x1abafe,null))[_0xcd58('0x25')](function(_0x46ae72){if(_0x46ae72){_0x598566=_0x46ae72;_0x24a371[_0xcd58('0x32')]=_[_0xcd58('0x48')](db[_0xcd58('0x4e')][_0xcd58('0x2e')]);_0x24a371[_0xcd58('0x33')]=_[_0xcd58('0x48')](_0x12eb08[_0xcd58('0x33')]);_0x24a371[_0xcd58('0x34')]=_[_0xcd58('0x35')](_0x24a371[_0xcd58('0x32')],_0x24a371[_0xcd58('0x33')]);_0x5bc763['attributes']=_['intersection'](_0x24a371[_0xcd58('0x32')],qs[_0xcd58('0x37')](_0x12eb08[_0xcd58('0x33')][_0xcd58('0x37')]));_0x5bc763[_0xcd58('0x36')]=_0x5bc763[_0xcd58('0x36')]['length']?_0x5bc763[_0xcd58('0x36')]:_0x24a371[_0xcd58('0x32')];_0x5bc763[_0xcd58('0x3a')]=qs[_0xcd58('0x3b')](_0x12eb08[_0xcd58('0x33')][_0xcd58('0x3b')]);_0x5bc763[_0xcd58('0x3c')]=qs[_0xcd58('0x34')](_[_0xcd58('0x3d')](_0x12eb08[_0xcd58('0x33')],_0x24a371[_0xcd58('0x34')]));if(_0x12eb08[_0xcd58('0x33')][_0xcd58('0x3e')]){_0x5bc763[_0xcd58('0x3c')]=_[_0xcd58('0x3f')](_0x5bc763[_0xcd58('0x3c')],{'$or':_[_0xcd58('0x2c')](_0x5bc763[_0xcd58('0x36')],function(_0x24feaa){var _0x1b3fea={};_0x1b3fea[_0x24feaa]={'$like':'%'+_0x12eb08[_0xcd58('0x33')]['filter']+'%'};return _0x1b3fea;})});}_0x5bc763=_['merge']({},_0x5bc763,_0x12eb08[_0xcd58('0x41')]);return _0x598566[_0xcd58('0x4d')](_0x5bc763);}})[_0xcd58('0x25')](function(_0x1c4a74){if(_0x1c4a74){_0x3fa72e=_0x1c4a74['length'];if(!_0x12eb08[_0xcd58('0x33')][_0xcd58('0x4f')](_0xcd58('0x39'))){_0x5bc763[_0xcd58('0x1f')]=qs['limit'](_0x12eb08[_0xcd58('0x33')]['limit']);_0x5bc763[_0xcd58('0x1d')]=qs[_0xcd58('0x1d')](_0x12eb08[_0xcd58('0x33')][_0xcd58('0x1d')]);}return _0x598566[_0xcd58('0x4d')](_0x5bc763);}})[_0xcd58('0x25')](function(_0x42a9d6){if(_0x42a9d6){return _0x42a9d6?{'count':_0x3fa72e,'rows':_0x42a9d6}:null;}})[_0xcd58('0x25')](respondWithResult(_0x1abafe,null))[_0xcd58('0x4a')](handleError(_0x1abafe,null));};exports[_0xcd58('0x50')]=function(_0x399556,_0x4d97e4,_0x550eb2){var _0x508d27={};var _0x2ac17c={};var _0x22f2bb;var _0x188d99;return db[_0xcd58('0x2d')][_0xcd58('0x51')]({'where':{'id':_0x399556['params']['id']}})[_0xcd58('0x25')](handleEntityNotFound(_0x4d97e4,null))['then'](function(_0x3153b1){if(_0x3153b1){_0x22f2bb=_0x3153b1;_0x2ac17c[_0xcd58('0x32')]=_[_0xcd58('0x48')](db['SalesforceField'][_0xcd58('0x2e')]);_0x2ac17c['query']=_[_0xcd58('0x48')](_0x399556['query']);_0x2ac17c['filters']=_[_0xcd58('0x35')](_0x2ac17c['model'],_0x2ac17c[_0xcd58('0x33')]);_0x508d27[_0xcd58('0x36')]=_[_0xcd58('0x35')](_0x2ac17c[_0xcd58('0x32')],qs['fields'](_0x399556[_0xcd58('0x33')][_0xcd58('0x37')]));_0x508d27['attributes']=_0x508d27[_0xcd58('0x36')]['length']?_0x508d27['attributes']:_0x2ac17c['model'];_0x508d27['order']=qs[_0xcd58('0x3b')](_0x399556['query'][_0xcd58('0x3b')]);_0x508d27[_0xcd58('0x3c')]=qs['filters'](_[_0xcd58('0x3d')](_0x399556[_0xcd58('0x33')],_0x2ac17c[_0xcd58('0x34')]));if(_0x399556[_0xcd58('0x33')][_0xcd58('0x3e')]){_0x508d27[_0xcd58('0x3c')]=_[_0xcd58('0x3f')](_0x508d27[_0xcd58('0x3c')],{'$or':_[_0xcd58('0x2c')](_0x508d27['attributes'],function(_0x3e2060){var _0x470b31={};_0x470b31[_0x3e2060]={'$like':'%'+_0x399556['query'][_0xcd58('0x3e')]+'%'};return _0x470b31;})});}_0x508d27=_[_0xcd58('0x3f')]({},_0x508d27,_0x399556[_0xcd58('0x41')]);return _0x22f2bb[_0xcd58('0x50')](_0x508d27);}})[_0xcd58('0x25')](function(_0x49f5e7){if(_0x49f5e7){_0x188d99=_0x49f5e7[_0xcd58('0x38')];if(!_0x399556[_0xcd58('0x33')]['hasOwnProperty'](_0xcd58('0x39'))){_0x508d27['limit']=qs['limit'](_0x399556['query'][_0xcd58('0x1f')]);_0x508d27[_0xcd58('0x1d')]=qs[_0xcd58('0x1d')](_0x399556[_0xcd58('0x33')][_0xcd58('0x1d')]);}return _0x22f2bb[_0xcd58('0x50')](_0x508d27);}})[_0xcd58('0x25')](function(_0x21e02f){if(_0x21e02f){return _0x21e02f?{'count':_0x188d99,'rows':_0x21e02f}:null;}})[_0xcd58('0x25')](respondWithResult(_0x4d97e4,null))[_0xcd58('0x4a')](handleError(_0x4d97e4,null));};exports['getDescriptions']=function(_0x586467,_0x2d30f3,_0x38ecad){var _0x3a1e2e={};var _0x4ee300={};var _0x126b7b;var _0x1ff92a;return db[_0xcd58('0x2d')][_0xcd58('0x51')]({'where':{'id':_0x586467[_0xcd58('0x47')]['id']}})[_0xcd58('0x25')](handleEntityNotFound(_0x2d30f3,null))[_0xcd58('0x25')](function(_0x420332){if(_0x420332){_0x126b7b=_0x420332;_0x4ee300[_0xcd58('0x32')]=_[_0xcd58('0x48')](db[_0xcd58('0x4e')][_0xcd58('0x2e')]);_0x4ee300['query']=_[_0xcd58('0x48')](_0x586467['query']);_0x4ee300[_0xcd58('0x34')]=_[_0xcd58('0x35')](_0x4ee300[_0xcd58('0x32')],_0x4ee300[_0xcd58('0x33')]);_0x3a1e2e[_0xcd58('0x36')]=_['intersection'](_0x4ee300[_0xcd58('0x32')],qs[_0xcd58('0x37')](_0x586467[_0xcd58('0x33')][_0xcd58('0x37')]));_0x3a1e2e[_0xcd58('0x36')]=_0x3a1e2e['attributes'][_0xcd58('0x38')]?_0x3a1e2e[_0xcd58('0x36')]:_0x4ee300['model'];_0x3a1e2e[_0xcd58('0x3a')]=qs[_0xcd58('0x3b')](_0x586467[_0xcd58('0x33')][_0xcd58('0x3b')]);_0x3a1e2e[_0xcd58('0x3c')]=qs[_0xcd58('0x34')](_[_0xcd58('0x3d')](_0x586467[_0xcd58('0x33')],_0x4ee300[_0xcd58('0x34')]));if(_0x586467[_0xcd58('0x33')][_0xcd58('0x3e')]){_0x3a1e2e[_0xcd58('0x3c')]=_['merge'](_0x3a1e2e[_0xcd58('0x3c')],{'$or':_[_0xcd58('0x2c')](_0x3a1e2e[_0xcd58('0x36')],function(_0x215275){var _0x53f933={};_0x53f933[_0x215275]={'$like':'%'+_0x586467[_0xcd58('0x33')][_0xcd58('0x3e')]+'%'};return _0x53f933;})});}_0x3a1e2e=_[_0xcd58('0x3f')]({},_0x3a1e2e,_0x586467['options']);return _0x126b7b[_0xcd58('0x52')](_0x3a1e2e);}})[_0xcd58('0x25')](function(_0x20159a){if(_0x20159a){_0x1ff92a=_0x20159a[_0xcd58('0x38')];if(!_0x586467['query']['hasOwnProperty']('nolimit')){_0x3a1e2e[_0xcd58('0x1f')]=qs['limit'](_0x586467[_0xcd58('0x33')]['limit']);_0x3a1e2e[_0xcd58('0x1d')]=qs['offset'](_0x586467[_0xcd58('0x33')][_0xcd58('0x1d')]);}return _0x126b7b[_0xcd58('0x52')](_0x3a1e2e);}})[_0xcd58('0x25')](function(_0x55724c){if(_0x55724c){return _0x55724c?{'count':_0x1ff92a,'rows':_0x55724c}:null;}})[_0xcd58('0x25')](respondWithResult(_0x2d30f3,null))[_0xcd58('0x4a')](handleError(_0x2d30f3,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index c7fd0f7..bcd752c 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 _0x8ea0=['request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2cd151,_0x2d94bb){var _0x15676b=function(_0x46770e){while(--_0x46770e){_0x2cd151['push'](_0x2cd151['shift']());}};_0x15676b(++_0x2d94bb);}(_0x8ea0,0x127));var _0x08ea=function(_0x1d6d71,_0x1875e0){_0x1d6d71=_0x1d6d71-0x0;var _0x381b13=_0x8ea0[_0x1d6d71];return _0x381b13;};'use strict';var _=require(_0x08ea('0x0'));var util=require(_0x08ea('0x1'));var logger=require(_0x08ea('0x2'))('api');var moment=require(_0x08ea('0x3'));var BPromise=require(_0x08ea('0x4'));var rp=require(_0x08ea('0x5'));var fs=require('fs');var path=require(_0x08ea('0x6'));var rimraf=require('rimraf');var config=require(_0x08ea('0x7'));var attributes=require(_0x08ea('0x8'));module[_0x08ea('0x9')]=function(_0x3642c5,_0x2e5a2a){return _0x3642c5[_0x08ea('0xa')](_0x08ea('0xb'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6aa=['./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x22adc3,_0x442817){var _0x317adb=function(_0x585311){while(--_0x585311){_0x22adc3['push'](_0x22adc3['shift']());}};_0x317adb(++_0x442817);}(_0xf6aa,0x104));var _0xaf6a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf6aa[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xaf6a('0x0'));var util=require(_0xaf6a('0x1'));var logger=require(_0xaf6a('0x2'))(_0xaf6a('0x3'));var moment=require(_0xaf6a('0x4'));var BPromise=require(_0xaf6a('0x5'));var rp=require(_0xaf6a('0x6'));var fs=require('fs');var path=require(_0xaf6a('0x7'));var rimraf=require(_0xaf6a('0x8'));var config=require(_0xaf6a('0x9'));var attributes=require(_0xaf6a('0xa'));module[_0xaf6a('0xb')]=function(_0x32c974,_0x1f6a16){return _0x32c974[_0xaf6a('0xc')](_0xaf6a('0xd'),attributes,{'tableName':_0xaf6a('0xe'),'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 758f807..f5d0ea8 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 _0x9951=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash'];(function(_0x514bbd,_0x3da515){var _0x34c092=function(_0x504a53){while(--_0x504a53){_0x514bbd['push'](_0x514bbd['shift']());}};_0x34c092(++_0x3da515);}(_0x9951,0x1e2));var _0x1995=function(_0x48f56d,_0x31dc14){_0x48f56d=_0x48f56d-0x0;var _0x14b6cd=_0x9951[_0x48f56d];return _0x14b6cd;};'use strict';var _=require(_0x1995('0x0'));var util=require(_0x1995('0x1'));var moment=require(_0x1995('0x2'));var BPromise=require(_0x1995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1995('0x4'));var db=require(_0x1995('0x5'))['db'];var utils=require(_0x1995('0x6'));var logger=require('../../config/logger')(_0x1995('0x7'));var config=require(_0x1995('0x8'));var jayson=require(_0x1995('0x9'));var client=jayson[_0x1995('0xa')][_0x1995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x175b71,_0x44f88c,_0x5caecd){return new BPromise(function(_0x1b6c8b,_0x5942dd){return client[_0x1995('0xc')](_0x175b71,_0x5caecd)[_0x1995('0xd')](function(_0x32cb0a){logger[_0x1995('0xe')](_0x1995('0xf'),_0x44f88c,'request\x20sent');logger[_0x1995('0x10')](_0x1995('0x11'),_0x44f88c,_0x1995('0x12'),JSON['stringify'](_0x32cb0a));if(_0x32cb0a['error']){if(_0x32cb0a[_0x1995('0x13')]['code']===0x1f4){logger[_0x1995('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x44f88c,_0x32cb0a[_0x1995('0x13')][_0x1995('0x14')]);return _0x5942dd(_0x32cb0a['error']['message']);}logger['error'](_0x1995('0xf'),_0x44f88c,_0x32cb0a[_0x1995('0x13')]['message']);return _0x1b6c8b(_0x32cb0a[_0x1995('0x13')]['message']);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x44f88c,_0x1995('0x12'));_0x1b6c8b(_0x32cb0a[_0x1995('0x15')][_0x1995('0x14')]);}})[_0x1995('0x16')](function(_0x21c4e9){logger['error'](_0x1995('0xf'),_0x44f88c,_0x21c4e9);_0x5942dd(_0x21c4e9);});});} \ No newline at end of file +var _0xe14e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','lodash','util','moment'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0xe14e,0x189));var _0xee14=function(_0x5f2efa,_0x5dc0b9){_0x5f2efa=_0x5f2efa-0x0;var _0x2066b8=_0xe14e[_0x5f2efa];return _0x2066b8;};'use strict';var _=require(_0xee14('0x0'));var util=require(_0xee14('0x1'));var moment=require(_0xee14('0x2'));var BPromise=require(_0xee14('0x3'));var rs=require(_0xee14('0x4'));var fs=require('fs');var Redis=require(_0xee14('0x5'));var db=require(_0xee14('0x6'))['db'];var utils=require(_0xee14('0x7'));var logger=require('../../config/logger')(_0xee14('0x8'));var config=require(_0xee14('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xee14('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5da46b,_0x55e17a,_0x4183d3){return new BPromise(function(_0x4d208b,_0x405ccb){return client[_0xee14('0xb')](_0x5da46b,_0x4183d3)['then'](function(_0x518839){logger[_0xee14('0xc')](_0xee14('0xd'),_0x55e17a,'request\x20sent');logger[_0xee14('0xe')](_0xee14('0xf'),_0x55e17a,'request\x20sent',JSON['stringify'](_0x518839));if(_0x518839[_0xee14('0x10')]){if(_0x518839[_0xee14('0x10')]['code']===0x1f4){logger['error'](_0xee14('0xd'),_0x55e17a,_0x518839[_0xee14('0x10')][_0xee14('0x11')]);return _0x405ccb(_0x518839[_0xee14('0x10')][_0xee14('0x11')]);}logger[_0xee14('0x10')](_0xee14('0xd'),_0x55e17a,_0x518839[_0xee14('0x10')]['message']);return _0x4d208b(_0x518839[_0xee14('0x10')]['message']);}else{logger[_0xee14('0xc')](_0xee14('0xd'),_0x55e17a,'request\x20sent');_0x4d208b(_0x518839['result']['message']);}})['catch'](function(_0x12c16f){logger[_0xee14('0x10')](_0xee14('0xd'),_0x55e17a,_0x12c16f);_0x405ccb(_0x12c16f);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index e3efc15..4b1fa91 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 _0x552d=['put','update','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post'];(function(_0x426a18,_0x210d36){var _0x1512a5=function(_0x1c4598){while(--_0x1c4598){_0x426a18['push'](_0x426a18['shift']());}};_0x1512a5(++_0x210d36);}(_0x552d,0x15c));var _0xd552=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x552d[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require(_0xd552('0x0'));var util=require('util');var path=require(_0xd552('0x1'));var timeout=require(_0xd552('0x2'));var express=require(_0xd552('0x3'));var router=express[_0xd552('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd552('0x5'));var config=require(_0xd552('0x6'));var controller=require('./intSalesforceField.controller');router[_0xd552('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd552('0x7')](_0xd552('0x8'),auth[_0xd552('0x9')](),controller[_0xd552('0xa')]);router[_0xd552('0xb')]('/',auth[_0xd552('0x9')](),controller['create']);router[_0xd552('0xc')](_0xd552('0x8'),auth[_0xd552('0x9')](),controller[_0xd552('0xd')]);router['delete'](_0xd552('0x8'),auth[_0xd552('0x9')](),controller['destroy']);module[_0xd552('0xe')]=router; \ No newline at end of file +var _0xce71=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','/:id','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x53cecc,_0xec2802){var _0x35fc1d=function(_0x1f56ad){while(--_0x1f56ad){_0x53cecc['push'](_0x53cecc['shift']());}};_0x35fc1d(++_0xec2802);}(_0xce71,0xfd));var _0x1ce7=function(_0x16e150,_0xe14fd7){_0x16e150=_0x16e150-0x0;var _0x3c2556=_0xce71[_0x16e150];return _0x3c2556;};'use strict';var multer=require(_0x1ce7('0x0'));var util=require(_0x1ce7('0x1'));var path=require('path');var timeout=require(_0x1ce7('0x2'));var express=require(_0x1ce7('0x3'));var router=express[_0x1ce7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1ce7('0x5'));var interaction=require(_0x1ce7('0x6'));var config=require(_0x1ce7('0x7'));var controller=require(_0x1ce7('0x8'));router[_0x1ce7('0x9')]('/',auth[_0x1ce7('0xa')](),controller['index']);router['get'](_0x1ce7('0xb'),auth[_0x1ce7('0xa')](),controller['show']);router['post']('/',auth[_0x1ce7('0xa')](),controller['create']);router['put'](_0x1ce7('0xb'),auth[_0x1ce7('0xa')](),controller[_0x1ce7('0xc')]);router[_0x1ce7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x1ce7('0xe')]);module[_0x1ce7('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 0432573..c99d9b6 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 _0xe9a8=['customVariable','keyValue','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0xe9a8,0x153));var _0x8e9a=function(_0x1be153,_0x22290f){_0x1be153=_0x1be153-0x0;var _0x316441=_0xe9a8[_0x1be153];return _0x316441;};'use strict';var Sequelize=require(_0x8e9a('0x0'));module[_0x8e9a('0x1')]={'type':{'type':Sequelize[_0x8e9a('0x2')](_0x8e9a('0x3'),_0x8e9a('0x4'),_0x8e9a('0x5'),_0x8e9a('0x6'),'picklist'),'defaultValue':_0x8e9a('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8e9a('0x7')]},'keyType':{'type':Sequelize[_0x8e9a('0x2')]('string','variable',_0x8e9a('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8e9a('0x7')]},'variableName':{'type':Sequelize[_0x8e9a('0x7')]}}; \ No newline at end of file +var _0xf987=['exports','string','customVariable','keyValue','picklist','STRING','ENUM','variable'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0xf987,0x78));var _0x7f98=function(_0x1c9a40,_0x3ddb50){_0x1c9a40=_0x1c9a40-0x0;var _0x119ede=_0xf987[_0x1c9a40];return _0x119ede;};'use strict';var Sequelize=require('sequelize');module[_0x7f98('0x0')]={'type':{'type':Sequelize['ENUM'](_0x7f98('0x1'),'variable',_0x7f98('0x2'),_0x7f98('0x3'),_0x7f98('0x4')),'defaultValue':_0x7f98('0x1')},'content':{'type':Sequelize[_0x7f98('0x5')]},'key':{'type':Sequelize[_0x7f98('0x5')]},'keyType':{'type':Sequelize[_0x7f98('0x6')](_0x7f98('0x1'),_0x7f98('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 3d39445..4627d78 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 _0x7aaf=['rows','catch','params','intersection','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x4eab91,_0xb8e558){var _0x435d44=function(_0x5c1e4a){while(--_0x5c1e4a){_0x4eab91['push'](_0x4eab91['shift']());}};_0x435d44(++_0xb8e558);}(_0x7aaf,0x130));var _0xf7aa=function(_0x29077c,_0x8d7953){_0x29077c=_0x29077c-0x0;var _0x5c324a=_0x7aaf[_0x29077c];return _0x5c324a;};'use strict';var emlformat=require(_0xf7aa('0x0'));var rimraf=require(_0xf7aa('0x1'));var zipdir=require(_0xf7aa('0x2'));var jsonpatch=require(_0xf7aa('0x3'));var rp=require(_0xf7aa('0x4'));var moment=require(_0xf7aa('0x5'));var BPromise=require(_0xf7aa('0x6'));var Mustache=require(_0xf7aa('0x7'));var util=require(_0xf7aa('0x8'));var path=require(_0xf7aa('0x9'));var sox=require(_0xf7aa('0xa'));var csv=require(_0xf7aa('0xb'));var ejs=require(_0xf7aa('0xc'));var fs=require('fs');var fs_extra=require(_0xf7aa('0xd'));var _=require(_0xf7aa('0xe'));var squel=require(_0xf7aa('0xf'));var crypto=require(_0xf7aa('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xf7aa('0x11'));var toCsv=require('to-csv');var querystring=require(_0xf7aa('0x12'));var Papa=require('papaparse');var Redis=require(_0xf7aa('0x13'));var authService=require(_0xf7aa('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xf7aa('0x15'));var hardwareService=require(_0xf7aa('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf7aa('0x17'))['db'];function respondWithStatusCode(_0x15c324,_0x4c9bcb){_0x4c9bcb=_0x4c9bcb||0xcc;return function(_0x480ee3){if(_0x480ee3){return _0x15c324[_0xf7aa('0x18')](_0x4c9bcb);}return _0x15c324['status'](_0x4c9bcb)[_0xf7aa('0x19')]();};}function respondWithResult(_0xa4c038,_0x3cb2bb){_0x3cb2bb=_0x3cb2bb||0xc8;return function(_0x6116b2){if(_0x6116b2){return _0xa4c038[_0xf7aa('0x1a')](_0x3cb2bb)[_0xf7aa('0x1b')](_0x6116b2);}};}function respondWithFilteredResult(_0x1e865e,_0x589090){return function(_0x36f954){if(_0x36f954){var _0x1aae8b=typeof _0x589090[_0xf7aa('0x1c')]===_0xf7aa('0x1d')&&typeof _0x589090['limit']===_0xf7aa('0x1d');var _0x3b1061=_0x36f954[_0xf7aa('0x1e')];var _0x387108=_0x1aae8b?0x0:_0x589090[_0xf7aa('0x1c')];var _0x53010f=_0x1aae8b?_0x36f954[_0xf7aa('0x1e')]:_0x589090[_0xf7aa('0x1c')]+_0x589090[_0xf7aa('0x1f')];var _0x338be5;if(_0x53010f>=_0x3b1061){_0x53010f=_0x3b1061;_0x338be5=0xc8;}else{_0x338be5=0xce;}_0x1e865e[_0xf7aa('0x1a')](_0x338be5);return _0x1e865e[_0xf7aa('0x20')](_0xf7aa('0x21'),_0x387108+'-'+_0x53010f+'/'+_0x3b1061)[_0xf7aa('0x1b')](_0x36f954);}return null;};}function patchUpdates(_0x1407a2){return function(_0x439e45){try{jsonpatch[_0xf7aa('0x22')](_0x439e45,_0x1407a2,!![]);}catch(_0x1f6614){return BPromise[_0xf7aa('0x23')](_0x1f6614);}return _0x439e45[_0xf7aa('0x24')]();};}function saveUpdates(_0x3a7fd6,_0x6ea188){return function(_0x17b806){if(_0x17b806){return _0x17b806['update'](_0x3a7fd6)[_0xf7aa('0x25')](function(_0x3ef8ee){return _0x3ef8ee;});}return null;};}function removeEntity(_0x5da344,_0x4a3203){return function(_0x5ef16e){if(_0x5ef16e){return _0x5ef16e[_0xf7aa('0x26')]()[_0xf7aa('0x25')](function(){_0x5da344['status'](0xcc)[_0xf7aa('0x19')]();});}};}function handleEntityNotFound(_0x133678,_0x46cea1){return function(_0xc2ce0b){if(!_0xc2ce0b){_0x133678[_0xf7aa('0x18')](0x194);}return _0xc2ce0b;};}function handleError(_0x32d9ee,_0x10013e){_0x10013e=_0x10013e||0x1f4;return function(_0x3e98d5){logger[_0xf7aa('0x27')](_0x3e98d5[_0xf7aa('0x28')]);if(_0x3e98d5[_0xf7aa('0x29')]){delete _0x3e98d5[_0xf7aa('0x29')];}_0x32d9ee[_0xf7aa('0x1a')](_0x10013e)['send'](_0x3e98d5);};}exports[_0xf7aa('0x2a')]=function(_0x46aa59,_0x2a4b2e){var _0x4d26ae={},_0x47494f={},_0x238ece={'count':0x0,'rows':[]};var _0x4e74da=_[_0xf7aa('0x2b')](db[_0xf7aa('0x2c')][_0xf7aa('0x2d')],function(_0xe345e1){return{'name':_0xe345e1[_0xf7aa('0x2e')],'type':_0xe345e1[_0xf7aa('0x2f')][_0xf7aa('0x30')]};});_0x47494f[_0xf7aa('0x31')]=_['map'](_0x4e74da,_0xf7aa('0x29'));_0x47494f['query']=_[_0xf7aa('0x32')](_0x46aa59[_0xf7aa('0x33')]);_0x47494f[_0xf7aa('0x34')]=_['intersection'](_0x47494f['model'],_0x47494f['query']);_0x4d26ae[_0xf7aa('0x35')]=_['intersection'](_0x47494f[_0xf7aa('0x31')],qs[_0xf7aa('0x36')](_0x46aa59[_0xf7aa('0x33')][_0xf7aa('0x36')]));_0x4d26ae[_0xf7aa('0x35')]=_0x4d26ae[_0xf7aa('0x35')][_0xf7aa('0x37')]?_0x4d26ae[_0xf7aa('0x35')]:_0x47494f['model'];if(!_0x46aa59['query'][_0xf7aa('0x38')]('nolimit')){_0x4d26ae[_0xf7aa('0x1f')]=qs[_0xf7aa('0x1f')](_0x46aa59['query'][_0xf7aa('0x1f')]);_0x4d26ae[_0xf7aa('0x1c')]=qs[_0xf7aa('0x1c')](_0x46aa59['query'][_0xf7aa('0x1c')]);}_0x4d26ae[_0xf7aa('0x39')]=qs[_0xf7aa('0x3a')](_0x46aa59[_0xf7aa('0x33')][_0xf7aa('0x3a')]);_0x4d26ae[_0xf7aa('0x3b')]=qs[_0xf7aa('0x34')](_[_0xf7aa('0x3c')](_0x46aa59[_0xf7aa('0x33')],_0x47494f['filters']),_0x4e74da);if(_0x46aa59[_0xf7aa('0x33')][_0xf7aa('0x3d')]){_0x4d26ae[_0xf7aa('0x3b')]=_['merge'](_0x4d26ae[_0xf7aa('0x3b')],{'$or':_['map'](_0x4e74da,function(_0x2ae0e1){if(_0x2ae0e1[_0xf7aa('0x2f')]!=='VIRTUAL'){var _0x44c56f={};_0x44c56f[_0x2ae0e1['name']]={'$like':'%'+_0x46aa59['query'][_0xf7aa('0x3d')]+'%'};return _0x44c56f;}})});}_0x4d26ae=_[_0xf7aa('0x3e')]({},_0x4d26ae,_0x46aa59[_0xf7aa('0x3f')]);var _0x4d27dc={'where':_0x4d26ae[_0xf7aa('0x3b')]};return db[_0xf7aa('0x2c')][_0xf7aa('0x1e')](_0x4d27dc)[_0xf7aa('0x25')](function(_0x231e64){_0x238ece[_0xf7aa('0x1e')]=_0x231e64;if(_0x46aa59[_0xf7aa('0x33')][_0xf7aa('0x40')]){_0x4d26ae[_0xf7aa('0x41')]=[{'all':!![]}];}return db[_0xf7aa('0x2c')]['findAll'](_0x4d26ae);})[_0xf7aa('0x25')](function(_0x41f3d5){_0x238ece[_0xf7aa('0x42')]=_0x41f3d5;return _0x238ece;})[_0xf7aa('0x25')](respondWithFilteredResult(_0x2a4b2e,_0x4d26ae))[_0xf7aa('0x43')](handleError(_0x2a4b2e,null));};exports['show']=function(_0xa7be41,_0x25e9f7){var _0x3f157b={'raw':!![],'where':{'id':_0xa7be41[_0xf7aa('0x44')]['id']}},_0x288af3={};_0x288af3[_0xf7aa('0x31')]=_[_0xf7aa('0x32')](db[_0xf7aa('0x2c')][_0xf7aa('0x2d')]);_0x288af3[_0xf7aa('0x33')]=_[_0xf7aa('0x32')](_0xa7be41[_0xf7aa('0x33')]);_0x288af3['filters']=_[_0xf7aa('0x45')](_0x288af3[_0xf7aa('0x31')],_0x288af3[_0xf7aa('0x33')]);_0x3f157b[_0xf7aa('0x35')]=_[_0xf7aa('0x45')](_0x288af3[_0xf7aa('0x31')],qs[_0xf7aa('0x36')](_0xa7be41['query'][_0xf7aa('0x36')]));_0x3f157b['attributes']=_0x3f157b[_0xf7aa('0x35')][_0xf7aa('0x37')]?_0x3f157b[_0xf7aa('0x35')]:_0x288af3[_0xf7aa('0x31')];if(_0xa7be41[_0xf7aa('0x33')][_0xf7aa('0x40')]){_0x3f157b[_0xf7aa('0x41')]=[{'all':!![]}];}_0x3f157b=_[_0xf7aa('0x3e')]({},_0x3f157b,_0xa7be41[_0xf7aa('0x3f')]);return db[_0xf7aa('0x2c')]['find'](_0x3f157b)[_0xf7aa('0x25')](handleEntityNotFound(_0x25e9f7,null))[_0xf7aa('0x25')](respondWithResult(_0x25e9f7,null))[_0xf7aa('0x43')](handleError(_0x25e9f7,null));};exports[_0xf7aa('0x46')]=function(_0x5f0f21,_0x11f5e0){return db[_0xf7aa('0x2c')][_0xf7aa('0x46')](_0x5f0f21[_0xf7aa('0x47')],{})['then'](respondWithResult(_0x11f5e0,0xc9))[_0xf7aa('0x43')](handleError(_0x11f5e0,null));};exports[_0xf7aa('0x48')]=function(_0x11a30c,_0x425f87){if(_0x11a30c[_0xf7aa('0x47')]['id']){delete _0x11a30c[_0xf7aa('0x47')]['id'];}return db[_0xf7aa('0x2c')][_0xf7aa('0x49')]({'where':{'id':_0x11a30c['params']['id']}})['then'](handleEntityNotFound(_0x425f87,null))[_0xf7aa('0x25')](saveUpdates(_0x11a30c['body'],null))[_0xf7aa('0x25')](respondWithResult(_0x425f87,null))[_0xf7aa('0x43')](handleError(_0x425f87,null));};exports[_0xf7aa('0x26')]=function(_0x591527,_0x54b596){return db['SalesforceField'][_0xf7aa('0x49')]({'where':{'id':_0x591527[_0xf7aa('0x44')]['id']}})['then'](handleEntityNotFound(_0x54b596,null))[_0xf7aa('0x25')](removeEntity(_0x54b596,null))[_0xf7aa('0x43')](handleError(_0x54b596,null));}; \ No newline at end of file +var _0xf034=['status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','index','map','SalesforceField','rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','show','params','keys','intersection','includeAll','find','create','body','catch','update','eml-format','rimraf','zip-dir','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x3f59b1,_0x25cdbe){var _0x11d2e8=function(_0x37b3fc){while(--_0x37b3fc){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x11d2e8(++_0x25cdbe);}(_0xf034,0x15c));var _0x4f03=function(_0x4748a9,_0x1c1600){_0x4748a9=_0x4748a9-0x0;var _0x4bbf32=_0xf034[_0x4748a9];return _0x4bbf32;};'use strict';var emlformat=require(_0x4f03('0x0'));var rimraf=require(_0x4f03('0x1'));var zipdir=require(_0x4f03('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4f03('0x3'));var Mustache=require('mustache');var util=require(_0x4f03('0x4'));var path=require(_0x4f03('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4f03('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4f03('0x7'));var squel=require(_0x4f03('0x8'));var crypto=require(_0x4f03('0x9'));var jsforce=require(_0x4f03('0xa'));var deskjs=require(_0x4f03('0xb'));var toCsv=require(_0x4f03('0xc'));var querystring=require(_0x4f03('0xd'));var Papa=require('papaparse');var Redis=require(_0x4f03('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4f03('0xf'));var as=require(_0x4f03('0x10'));var hardwareService=require(_0x4f03('0x11'));var logger=require(_0x4f03('0x12'))(_0x4f03('0x13'));var utils=require('../../config/utils');var config=require(_0x4f03('0x14'));var licenseUtil=require(_0x4f03('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d7e1e,_0x781ce9){_0x781ce9=_0x781ce9||0xcc;return function(_0x9e8482){if(_0x9e8482){return _0x2d7e1e['sendStatus'](_0x781ce9);}return _0x2d7e1e[_0x4f03('0x16')](_0x781ce9)['end']();};}function respondWithResult(_0x46aa3f,_0xcbe48a){_0xcbe48a=_0xcbe48a||0xc8;return function(_0x4946bb){if(_0x4946bb){return _0x46aa3f[_0x4f03('0x16')](_0xcbe48a)[_0x4f03('0x17')](_0x4946bb);}};}function respondWithFilteredResult(_0x13093f,_0x379be9){return function(_0x5e6d18){if(_0x5e6d18){var _0x3a0cd1=typeof _0x379be9[_0x4f03('0x18')]===_0x4f03('0x19')&&typeof _0x379be9['limit']===_0x4f03('0x19');var _0x5c82bd=_0x5e6d18['count'];var _0x2e8677=_0x3a0cd1?0x0:_0x379be9[_0x4f03('0x18')];var _0x1ff627=_0x3a0cd1?_0x5e6d18[_0x4f03('0x1a')]:_0x379be9[_0x4f03('0x18')]+_0x379be9[_0x4f03('0x1b')];var _0x3129a2;if(_0x1ff627>=_0x5c82bd){_0x1ff627=_0x5c82bd;_0x3129a2=0xc8;}else{_0x3129a2=0xce;}_0x13093f[_0x4f03('0x16')](_0x3129a2);return _0x13093f[_0x4f03('0x1c')](_0x4f03('0x1d'),_0x2e8677+'-'+_0x1ff627+'/'+_0x5c82bd)['json'](_0x5e6d18);}return null;};}function patchUpdates(_0x3554e1){return function(_0x37067c){try{jsonpatch[_0x4f03('0x1e')](_0x37067c,_0x3554e1,!![]);}catch(_0x3c1c8f){return BPromise[_0x4f03('0x1f')](_0x3c1c8f);}return _0x37067c[_0x4f03('0x20')]();};}function saveUpdates(_0x3bbf81,_0x5c656a){return function(_0x1f652d){if(_0x1f652d){return _0x1f652d['update'](_0x3bbf81)[_0x4f03('0x21')](function(_0x371f2e){return _0x371f2e;});}return null;};}function removeEntity(_0x3691b3,_0x3c1c1e){return function(_0x17ae70){if(_0x17ae70){return _0x17ae70[_0x4f03('0x22')]()['then'](function(){_0x3691b3[_0x4f03('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x557beb,_0x113bce){return function(_0x164acc){if(!_0x164acc){_0x557beb[_0x4f03('0x23')](0x194);}return _0x164acc;};}function handleError(_0x1b02f9,_0x5bbb6d){_0x5bbb6d=_0x5bbb6d||0x1f4;return function(_0x1fed30){logger[_0x4f03('0x24')](_0x1fed30['stack']);if(_0x1fed30[_0x4f03('0x25')]){delete _0x1fed30[_0x4f03('0x25')];}_0x1b02f9[_0x4f03('0x16')](_0x5bbb6d)[_0x4f03('0x26')](_0x1fed30);};}exports[_0x4f03('0x27')]=function(_0x2aecf1,_0xb4ac3f){var _0x55ebcb={},_0x11179a={},_0x331858={'count':0x0,'rows':[]};var _0x48bca6=_[_0x4f03('0x28')](db[_0x4f03('0x29')][_0x4f03('0x2a')],function(_0x3f18c8){return{'name':_0x3f18c8['fieldName'],'type':_0x3f18c8[_0x4f03('0x2b')][_0x4f03('0x2c')]};});_0x11179a[_0x4f03('0x2d')]=_[_0x4f03('0x28')](_0x48bca6,'name');_0x11179a[_0x4f03('0x2e')]=_['keys'](_0x2aecf1[_0x4f03('0x2e')]);_0x11179a[_0x4f03('0x2f')]=_['intersection'](_0x11179a[_0x4f03('0x2d')],_0x11179a[_0x4f03('0x2e')]);_0x55ebcb[_0x4f03('0x30')]=_['intersection'](_0x11179a['model'],qs[_0x4f03('0x31')](_0x2aecf1[_0x4f03('0x2e')]['fields']));_0x55ebcb[_0x4f03('0x30')]=_0x55ebcb[_0x4f03('0x30')][_0x4f03('0x32')]?_0x55ebcb[_0x4f03('0x30')]:_0x11179a['model'];if(!_0x2aecf1[_0x4f03('0x2e')][_0x4f03('0x33')](_0x4f03('0x34'))){_0x55ebcb[_0x4f03('0x1b')]=qs[_0x4f03('0x1b')](_0x2aecf1[_0x4f03('0x2e')][_0x4f03('0x1b')]);_0x55ebcb[_0x4f03('0x18')]=qs['offset'](_0x2aecf1[_0x4f03('0x2e')][_0x4f03('0x18')]);}_0x55ebcb[_0x4f03('0x35')]=qs[_0x4f03('0x36')](_0x2aecf1[_0x4f03('0x2e')][_0x4f03('0x36')]);_0x55ebcb['where']=qs['filters'](_[_0x4f03('0x37')](_0x2aecf1[_0x4f03('0x2e')],_0x11179a[_0x4f03('0x2f')]),_0x48bca6);if(_0x2aecf1[_0x4f03('0x2e')][_0x4f03('0x38')]){_0x55ebcb[_0x4f03('0x39')]=_['merge'](_0x55ebcb[_0x4f03('0x39')],{'$or':_[_0x4f03('0x28')](_0x48bca6,function(_0x5ea9e8){if(_0x5ea9e8[_0x4f03('0x2b')]!==_0x4f03('0x3a')){var _0x3dc46f={};_0x3dc46f[_0x5ea9e8['name']]={'$like':'%'+_0x2aecf1[_0x4f03('0x2e')][_0x4f03('0x38')]+'%'};return _0x3dc46f;}})});}_0x55ebcb=_[_0x4f03('0x3b')]({},_0x55ebcb,_0x2aecf1[_0x4f03('0x3c')]);var _0x1bce37={'where':_0x55ebcb[_0x4f03('0x39')]};return db[_0x4f03('0x29')][_0x4f03('0x1a')](_0x1bce37)[_0x4f03('0x21')](function(_0x57b1b5){_0x331858['count']=_0x57b1b5;if(_0x2aecf1['query']['includeAll']){_0x55ebcb[_0x4f03('0x3d')]=[{'all':!![]}];}return db[_0x4f03('0x29')][_0x4f03('0x3e')](_0x55ebcb);})[_0x4f03('0x21')](function(_0x6456cf){_0x331858[_0x4f03('0x3f')]=_0x6456cf;return _0x331858;})[_0x4f03('0x21')](respondWithFilteredResult(_0xb4ac3f,_0x55ebcb))['catch'](handleError(_0xb4ac3f,null));};exports[_0x4f03('0x40')]=function(_0x3c127f,_0x176e65){var _0x3d20f3={'raw':!![],'where':{'id':_0x3c127f[_0x4f03('0x41')]['id']}},_0x9a81a1={};_0x9a81a1[_0x4f03('0x2d')]=_[_0x4f03('0x42')](db[_0x4f03('0x29')][_0x4f03('0x2a')]);_0x9a81a1['query']=_[_0x4f03('0x42')](_0x3c127f[_0x4f03('0x2e')]);_0x9a81a1[_0x4f03('0x2f')]=_[_0x4f03('0x43')](_0x9a81a1[_0x4f03('0x2d')],_0x9a81a1[_0x4f03('0x2e')]);_0x3d20f3[_0x4f03('0x30')]=_['intersection'](_0x9a81a1[_0x4f03('0x2d')],qs[_0x4f03('0x31')](_0x3c127f[_0x4f03('0x2e')][_0x4f03('0x31')]));_0x3d20f3[_0x4f03('0x30')]=_0x3d20f3[_0x4f03('0x30')]['length']?_0x3d20f3[_0x4f03('0x30')]:_0x9a81a1[_0x4f03('0x2d')];if(_0x3c127f[_0x4f03('0x2e')][_0x4f03('0x44')]){_0x3d20f3[_0x4f03('0x3d')]=[{'all':!![]}];}_0x3d20f3=_['merge']({},_0x3d20f3,_0x3c127f['options']);return db[_0x4f03('0x29')][_0x4f03('0x45')](_0x3d20f3)['then'](handleEntityNotFound(_0x176e65,null))[_0x4f03('0x21')](respondWithResult(_0x176e65,null))['catch'](handleError(_0x176e65,null));};exports['create']=function(_0x4e3b76,_0x24aee9){return db['SalesforceField'][_0x4f03('0x46')](_0x4e3b76[_0x4f03('0x47')],{})['then'](respondWithResult(_0x24aee9,0xc9))[_0x4f03('0x48')](handleError(_0x24aee9,null));};exports[_0x4f03('0x49')]=function(_0x3b23e5,_0xc5db95){if(_0x3b23e5[_0x4f03('0x47')]['id']){delete _0x3b23e5['body']['id'];}return db[_0x4f03('0x29')][_0x4f03('0x45')]({'where':{'id':_0x3b23e5['params']['id']}})[_0x4f03('0x21')](handleEntityNotFound(_0xc5db95,null))['then'](saveUpdates(_0x3b23e5[_0x4f03('0x47')],null))[_0x4f03('0x21')](respondWithResult(_0xc5db95,null))[_0x4f03('0x48')](handleError(_0xc5db95,null));};exports[_0x4f03('0x22')]=function(_0x5547cb,_0x14bd97){return db['SalesforceField']['find']({'where':{'id':_0x5547cb[_0x4f03('0x41')]['id']}})[_0x4f03('0x21')](handleEntityNotFound(_0x14bd97,null))['then'](removeEntity(_0x14bd97,null))[_0x4f03('0x48')](handleError(_0x14bd97,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 78cd22a..0bdfdf2 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 _0xafe8=['lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xafe8,0xe0));var _0x8afe=function(_0x580cf8,_0x26751e){_0x580cf8=_0x580cf8-0x0;var _0xcc9a9e=_0xafe8[_0x580cf8];return _0xcc9a9e;};'use strict';var _=require(_0x8afe('0x0'));var util=require(_0x8afe('0x1'));var logger=require(_0x8afe('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8afe('0x3'));var fs=require('fs');var path=require(_0x8afe('0x4'));var rimraf=require(_0x8afe('0x5'));var config=require(_0x8afe('0x6'));var attributes=require(_0x8afe('0x7'));module[_0x8afe('0x8')]=function(_0x220771,_0xb16174){return _0x220771[_0x8afe('0x9')]('SalesforceField',attributes,{'tableName':_0x8afe('0xa'),'paranoid':![],'indexes':[{'name':_0x8afe('0xb'),'fields':[_0x8afe('0xc'),_0x8afe('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x37f0=['moment','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','../../config/logger','api'];(function(_0x95c9ea,_0x32d741){var _0x5e5589=function(_0x4d0fd9){while(--_0x4d0fd9){_0x95c9ea['push'](_0x95c9ea['shift']());}};_0x5e5589(++_0x32d741);}(_0x37f0,0x1dd));var _0x037f=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x37f0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x037f('0x0'));var util=require('util');var logger=require(_0x037f('0x1'))(_0x037f('0x2'));var moment=require(_0x037f('0x3'));var BPromise=require(_0x037f('0x4'));var rp=require(_0x037f('0x5'));var fs=require('fs');var path=require(_0x037f('0x6'));var rimraf=require('rimraf');var config=require(_0x037f('0x7'));var attributes=require(_0x037f('0x8'));module[_0x037f('0x9')]=function(_0x9d143f,_0x1fd9dd){return _0x9d143f[_0x037f('0xa')](_0x037f('0xb'),attributes,{'tableName':_0x037f('0xc'),'paranoid':![],'indexes':[{'name':_0x037f('0xd'),'fields':['idField',_0x037f('0xe')],'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 f4a50ba..8aa8e23 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 _0x5de6=['code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x55d83d,_0x3241d8){var _0x25df7f=function(_0x224f76){while(--_0x224f76){_0x55d83d['push'](_0x55d83d['shift']());}};_0x25df7f(++_0x3241d8);}(_0x5de6,0xd3));var _0x65de=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5de6[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x65de('0x0'));var util=require(_0x65de('0x1'));var moment=require('moment');var BPromise=require(_0x65de('0x2'));var rs=require(_0x65de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x65de('0x4'));var logger=require(_0x65de('0x5'))(_0x65de('0x6'));var config=require(_0x65de('0x7'));var jayson=require(_0x65de('0x8'));var client=jayson[_0x65de('0x9')][_0x65de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5304d6,_0x55036c,_0x333543){return new BPromise(function(_0x56574c,_0x9699f7){return client['request'](_0x5304d6,_0x333543)[_0x65de('0xb')](function(_0x49acab){logger[_0x65de('0xc')](_0x65de('0xd'),_0x55036c,_0x65de('0xe'));logger[_0x65de('0xf')](_0x65de('0x10'),_0x55036c,'request\x20sent',JSON[_0x65de('0x11')](_0x49acab));if(_0x49acab[_0x65de('0x12')]){if(_0x49acab[_0x65de('0x12')][_0x65de('0x13')]===0x1f4){logger[_0x65de('0x12')](_0x65de('0xd'),_0x55036c,_0x49acab['error'][_0x65de('0x14')]);return _0x9699f7(_0x49acab[_0x65de('0x12')][_0x65de('0x14')]);}logger[_0x65de('0x12')]('SalesforceField,\x20%s,\x20%s',_0x55036c,_0x49acab[_0x65de('0x12')][_0x65de('0x14')]);return _0x56574c(_0x49acab[_0x65de('0x12')][_0x65de('0x14')]);}else{logger[_0x65de('0xc')](_0x65de('0xd'),_0x55036c,_0x65de('0xe'));_0x56574c(_0x49acab[_0x65de('0x15')][_0x65de('0x14')]);}})[_0x65de('0x16')](function(_0x3cdddd){logger[_0x65de('0x12')](_0x65de('0xd'),_0x55036c,_0x3cdddd);_0x9699f7(_0x3cdddd);});});} \ No newline at end of file +var _0x8a7f=['SalesforceField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x8a7f,0x12b));var _0xf8a7=function(_0x39d7e9,_0x4ebe0e){_0x39d7e9=_0x39d7e9-0x0;var _0x454bc4=_0x8a7f[_0x39d7e9];return _0x454bc4;};'use strict';var _=require(_0xf8a7('0x0'));var util=require(_0xf8a7('0x1'));var moment=require(_0xf8a7('0x2'));var BPromise=require(_0xf8a7('0x3'));var rs=require(_0xf8a7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8a7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8a7('0x6'))(_0xf8a7('0x7'));var config=require(_0xf8a7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf8a7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f5173,_0x73e1ba,_0x5a732b){return new BPromise(function(_0x29ee84,_0x27d495){return client['request'](_0x2f5173,_0x5a732b)[_0xf8a7('0xa')](function(_0x587870){logger['info']('SalesforceField,\x20%s,\x20%s',_0x73e1ba,_0xf8a7('0xb'));logger[_0xf8a7('0xc')](_0xf8a7('0xd'),_0x73e1ba,_0xf8a7('0xb'),JSON[_0xf8a7('0xe')](_0x587870));if(_0x587870['error']){if(_0x587870['error']['code']===0x1f4){logger[_0xf8a7('0xf')](_0xf8a7('0x10'),_0x73e1ba,_0x587870[_0xf8a7('0xf')][_0xf8a7('0x11')]);return _0x27d495(_0x587870[_0xf8a7('0xf')][_0xf8a7('0x11')]);}logger['error'](_0xf8a7('0x10'),_0x73e1ba,_0x587870[_0xf8a7('0xf')][_0xf8a7('0x11')]);return _0x29ee84(_0x587870[_0xf8a7('0xf')][_0xf8a7('0x11')]);}else{logger[_0xf8a7('0x12')](_0xf8a7('0x10'),_0x73e1ba,_0xf8a7('0xb'));_0x29ee84(_0x587870[_0xf8a7('0x13')]['message']);}})[_0xf8a7('0x14')](function(_0x88a82a){logger[_0xf8a7('0xf')](_0xf8a7('0x10'),_0x73e1ba,_0x88a82a);_0x27d495(_0x88a82a);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index f0ebb90..0b80e6b 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 _0x064b=['../../config/environment','index','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x064b,0xd9));var _0xb064=function(_0xee852a,_0xaa3a3a){_0xee852a=_0xee852a-0x0;var _0x2af24d=_0x064b[_0xee852a];return _0x2af24d;};'use strict';var multer=require(_0xb064('0x0'));var util=require(_0xb064('0x1'));var path=require(_0xb064('0x2'));var timeout=require(_0xb064('0x3'));var express=require('express');var router=express[_0xb064('0x4')]();var fs_extra=require(_0xb064('0x5'));var auth=require(_0xb064('0x6'));var interaction=require(_0xb064('0x7'));var config=require(_0xb064('0x8'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb064('0x9')]);router[_0xb064('0xa')](_0xb064('0xb'),auth[_0xb064('0xc')](),controller['show']);router['get'](_0xb064('0xd'),auth[_0xb064('0xc')](),controller[_0xb064('0xe')]);router[_0xb064('0xa')](_0xb064('0xf'),auth[_0xb064('0xc')](),controller[_0xb064('0x10')]);router[_0xb064('0x11')]('/',auth[_0xb064('0xc')](),controller[_0xb064('0x12')]);router[_0xb064('0x11')](_0xb064('0xd'),auth[_0xb064('0xc')](),controller[_0xb064('0x13')]);router[_0xb064('0x14')]('/:id',auth[_0xb064('0xc')](),controller[_0xb064('0x15')]);router[_0xb064('0x16')](_0xb064('0xb'),auth['isAuthenticated'](),controller[_0xb064('0x17')]);module[_0xb064('0x18')]=router; \ No newline at end of file +var _0x6697=['isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get'];(function(_0x2ea2a2,_0x4bcb5a){var _0x52191c=function(_0x2b236f){while(--_0x2b236f){_0x2ea2a2['push'](_0x2ea2a2['shift']());}};_0x52191c(++_0x4bcb5a);}(_0x6697,0x1c3));var _0x7669=function(_0x2e30cb,_0x211465){_0x2e30cb=_0x2e30cb-0x0;var _0x4469e8=_0x6697[_0x2e30cb];return _0x4469e8;};'use strict';var multer=require(_0x7669('0x0'));var util=require(_0x7669('0x1'));var path=require(_0x7669('0x2'));var timeout=require(_0x7669('0x3'));var express=require(_0x7669('0x4'));var router=express[_0x7669('0x5')]();var fs_extra=require(_0x7669('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7669('0x7'));var config=require(_0x7669('0x8'));var controller=require(_0x7669('0x9'));router[_0x7669('0xa')]('/',auth[_0x7669('0xb')](),controller['index']);router[_0x7669('0xa')](_0x7669('0xc'),auth[_0x7669('0xb')](),controller[_0x7669('0xd')]);router[_0x7669('0xa')](_0x7669('0xe'),auth[_0x7669('0xb')](),controller[_0x7669('0xf')]);router[_0x7669('0xa')]('/:id/fields',auth[_0x7669('0xb')](),controller[_0x7669('0x10')]);router[_0x7669('0x11')]('/',auth[_0x7669('0xb')](),controller['create']);router[_0x7669('0x11')](_0x7669('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x7669('0x12')](_0x7669('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x7669('0x13')]('/:id',auth[_0x7669('0xb')](),controller[_0x7669('0x14')]);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 a8ff3d2..74bdc80 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 _0xbbf5=['exports','STRING','username','remoteUri'];(function(_0x59ae8f,_0x148344){var _0x3900b5=function(_0x63af51){while(--_0x63af51){_0x59ae8f['push'](_0x59ae8f['shift']());}};_0x3900b5(++_0x148344);}(_0xbbf5,0x178));var _0x5bbf=function(_0x3ea811,_0x3a6495){_0x3ea811=_0x3ea811-0x0;var _0x51b9e9=_0xbbf5[_0x3ea811];return _0x51b9e9;};'use strict';var Sequelize=require('sequelize');module[_0x5bbf('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5bbf('0x1')]},'username':{'type':Sequelize[_0x5bbf('0x1')],'unique':_0x5bbf('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x5bbf('0x1')]},'remoteUri':{'type':Sequelize[_0x5bbf('0x1')],'unique':_0x5bbf('0x3')},'serverUrl':{'type':Sequelize[_0x5bbf('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4b85=['username','remoteUri','sequelize','exports','STRING'];(function(_0x194a0d,_0x47cb1b){var _0x25c690=function(_0x1e5f64){while(--_0x1e5f64){_0x194a0d['push'](_0x194a0d['shift']());}};_0x25c690(++_0x47cb1b);}(_0x4b85,0x1d8));var _0x54b8=function(_0x573bc7,_0x22c352){_0x573bc7=_0x573bc7-0x0;var _0x3a9009=_0x4b85[_0x573bc7];return _0x3a9009;};'use strict';var Sequelize=require(_0x54b8('0x0'));module[_0x54b8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x54b8('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x54b8('0x3')},'password':{'type':Sequelize[_0x54b8('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x54b8('0x2')],'unique':_0x54b8('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index db0303c..47fc136 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 _0x5be0=['sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','category','username','password','email','serverUrl','remoteUri','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','label','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','error','stack','send','index','ServicenowAccount','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','catch','show','merge','find','create','body','getConfigurations','findOne','params','ServicenowConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','notify','caused_by','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','company','reassignment_count','activity_due','assigned_to','comments','sla_due','comments_and_work_notes','due_date'];(function(_0x228963,_0x34838a){var _0x47b978=function(_0x57dd47){while(--_0x57dd47){_0x228963['push'](_0x228963['shift']());}};_0x47b978(++_0x34838a);}(_0x5be0,0xe9));var _0x05be=function(_0x585738,_0xcab72a){_0x585738=_0x585738-0x0;var _0x2454fe=_0x5be0[_0x585738];return _0x2454fe;};'use strict';var emlformat=require(_0x05be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x05be('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05be('0x2'));var moment=require(_0x05be('0x3'));var BPromise=require(_0x05be('0x4'));var Mustache=require(_0x05be('0x5'));var util=require('util');var path=require(_0x05be('0x6'));var sox=require(_0x05be('0x7'));var csv=require(_0x05be('0x8'));var ejs=require(_0x05be('0x9'));var fs=require('fs');var fs_extra=require(_0x05be('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x05be('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x05be('0xc'));var toCsv=require('to-csv');var querystring=require(_0x05be('0xd'));var Papa=require(_0x05be('0xe'));var Redis=require(_0x05be('0xf'));var authService=require(_0x05be('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x05be('0x11'));var hardwareService=require(_0x05be('0x12'));var logger=require('../../config/logger')(_0x05be('0x13'));var utils=require(_0x05be('0x14'));var config=require(_0x05be('0x15'));var licenseUtil=require(_0x05be('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x05be('0x17'));function respondWithStatusCode(_0x3217d3,_0x32aa0a){_0x32aa0a=_0x32aa0a||0xcc;return function(_0x5e7cb4){if(_0x5e7cb4){return _0x3217d3[_0x05be('0x18')](_0x32aa0a);}return _0x3217d3[_0x05be('0x19')](_0x32aa0a)['end']();};}function respondWithResult(_0x2fa672,_0x3c890e){_0x3c890e=_0x3c890e||0xc8;return function(_0x19443b){if(_0x19443b){return _0x2fa672[_0x05be('0x19')](_0x3c890e)[_0x05be('0x1a')](_0x19443b);}};}function respondWithFilteredResult(_0x3f28bc,_0x253424){return function(_0x3a0fc){if(_0x3a0fc){var _0x4f7472=typeof _0x253424[_0x05be('0x1b')]===_0x05be('0x1c')&&typeof _0x253424[_0x05be('0x1d')]===_0x05be('0x1c');var _0xe6af42=_0x3a0fc[_0x05be('0x1e')];var _0x2dad8b=_0x4f7472?0x0:_0x253424[_0x05be('0x1b')];var _0x1d3e98=_0x4f7472?_0x3a0fc[_0x05be('0x1e')]:_0x253424[_0x05be('0x1b')]+_0x253424[_0x05be('0x1d')];var _0x3364dc;if(_0x1d3e98>=_0xe6af42){_0x1d3e98=_0xe6af42;_0x3364dc=0xc8;}else{_0x3364dc=0xce;}_0x3f28bc[_0x05be('0x19')](_0x3364dc);return _0x3f28bc[_0x05be('0x1f')]('Content-Range',_0x2dad8b+'-'+_0x1d3e98+'/'+_0xe6af42)[_0x05be('0x1a')](_0x3a0fc);}return null;};}function patchUpdates(_0x455fe7){return function(_0x318d4a){try{jsonpatch[_0x05be('0x20')](_0x318d4a,_0x455fe7,!![]);}catch(_0x340773){return BPromise[_0x05be('0x21')](_0x340773);}return _0x318d4a[_0x05be('0x22')]();};}function saveUpdates(_0x59c6d0,_0x2f881f){return function(_0x5d875d){if(_0x5d875d){return _0x5d875d['update'](_0x59c6d0)[_0x05be('0x23')](function(_0xb1c1fe){return _0xb1c1fe;});}return null;};}function removeEntity(_0x4c87c0,_0x3bed7a){return function(_0x1d532c){if(_0x1d532c){return _0x1d532c[_0x05be('0x24')]()[_0x05be('0x23')](function(){_0x4c87c0[_0x05be('0x19')](0xcc)[_0x05be('0x25')]();});}};}function handleEntityNotFound(_0x350185,_0x815f6b){return function(_0x586d59){if(!_0x586d59){_0x350185[_0x05be('0x18')](0x194);}return _0x586d59;};}function handleError(_0x395b3a,_0xd5e3ae){_0xd5e3ae=_0xd5e3ae||0x1f4;return function(_0x2be51e){logger[_0x05be('0x26')](_0x2be51e[_0x05be('0x27')]);if(_0x2be51e['name']){delete _0x2be51e['name'];}_0x395b3a[_0x05be('0x19')](_0xd5e3ae)[_0x05be('0x28')](_0x2be51e);};}exports[_0x05be('0x29')]=function(_0x2069e8,_0x5865a6){var _0x1549a9={},_0x2e0664={},_0x1a22ae={'count':0x0,'rows':[]};var _0x44df3e=_['map'](db[_0x05be('0x2a')][_0x05be('0x2b')],function(_0x5f53cf){return{'name':_0x5f53cf[_0x05be('0x2c')],'type':_0x5f53cf[_0x05be('0x2d')][_0x05be('0x2e')]};});_0x2e0664[_0x05be('0x2f')]=_[_0x05be('0x30')](_0x44df3e,_0x05be('0x31'));_0x2e0664[_0x05be('0x32')]=_[_0x05be('0x33')](_0x2069e8[_0x05be('0x32')]);_0x2e0664[_0x05be('0x34')]=_['intersection'](_0x2e0664[_0x05be('0x2f')],_0x2e0664[_0x05be('0x32')]);_0x1549a9['attributes']=_[_0x05be('0x35')](_0x2e0664['model'],qs[_0x05be('0x36')](_0x2069e8['query']['fields']));_0x1549a9[_0x05be('0x37')]=_0x1549a9[_0x05be('0x37')][_0x05be('0x38')]?_0x1549a9[_0x05be('0x37')]:_0x2e0664[_0x05be('0x2f')];if(!_0x2069e8['query'][_0x05be('0x39')](_0x05be('0x3a'))){_0x1549a9[_0x05be('0x1d')]=qs['limit'](_0x2069e8['query'][_0x05be('0x1d')]);_0x1549a9['offset']=qs[_0x05be('0x1b')](_0x2069e8['query'][_0x05be('0x1b')]);}_0x1549a9['order']=qs[_0x05be('0x3b')](_0x2069e8[_0x05be('0x32')][_0x05be('0x3b')]);_0x1549a9[_0x05be('0x3c')]=qs[_0x05be('0x34')](_[_0x05be('0x3d')](_0x2069e8[_0x05be('0x32')],_0x2e0664[_0x05be('0x34')]),_0x44df3e);if(_0x2069e8[_0x05be('0x32')][_0x05be('0x3e')]){_0x1549a9[_0x05be('0x3c')]=_['merge'](_0x1549a9[_0x05be('0x3c')],{'$or':_[_0x05be('0x30')](_0x44df3e,function(_0x4f257d){if(_0x4f257d[_0x05be('0x2d')]!==_0x05be('0x3f')){var _0xd11901={};_0xd11901[_0x4f257d[_0x05be('0x31')]]={'$like':'%'+_0x2069e8[_0x05be('0x32')][_0x05be('0x3e')]+'%'};return _0xd11901;}})});}_0x1549a9=_['merge']({},_0x1549a9,_0x2069e8[_0x05be('0x40')]);var _0x54c52e={'where':_0x1549a9[_0x05be('0x3c')]};return db[_0x05be('0x2a')][_0x05be('0x1e')](_0x54c52e)[_0x05be('0x23')](function(_0x128e0f){_0x1a22ae[_0x05be('0x1e')]=_0x128e0f;if(_0x2069e8['query'][_0x05be('0x41')]){_0x1549a9[_0x05be('0x42')]=[{'all':!![]}];}return db[_0x05be('0x2a')]['findAll'](_0x1549a9);})[_0x05be('0x23')](function(_0x3f94b1){_0x1a22ae['rows']=_0x3f94b1;return _0x1a22ae;})[_0x05be('0x23')](respondWithFilteredResult(_0x5865a6,_0x1549a9))[_0x05be('0x43')](handleError(_0x5865a6,null));};exports[_0x05be('0x44')]=function(_0x2b1d03,_0x5ce6e2){var _0x31c412={'raw':![],'where':{'id':_0x2b1d03['params']['id']}},_0x2ba961={};_0x2ba961[_0x05be('0x2f')]=_[_0x05be('0x33')](db[_0x05be('0x2a')]['rawAttributes']);_0x2ba961[_0x05be('0x32')]=_[_0x05be('0x33')](_0x2b1d03[_0x05be('0x32')]);_0x2ba961[_0x05be('0x34')]=_[_0x05be('0x35')](_0x2ba961['model'],_0x2ba961[_0x05be('0x32')]);_0x31c412['attributes']=_[_0x05be('0x35')](_0x2ba961[_0x05be('0x2f')],qs[_0x05be('0x36')](_0x2b1d03['query']['fields']));_0x31c412[_0x05be('0x37')]=_0x31c412[_0x05be('0x37')]['length']?_0x31c412[_0x05be('0x37')]:_0x2ba961['model'];if(_0x2b1d03[_0x05be('0x32')]['includeAll']){_0x31c412['include']=[{'all':!![]}];}_0x31c412=_[_0x05be('0x45')]({},_0x31c412,_0x2b1d03[_0x05be('0x40')]);return db[_0x05be('0x2a')][_0x05be('0x46')](_0x31c412)['then'](handleEntityNotFound(_0x5ce6e2,null))['then'](respondWithResult(_0x5ce6e2,null))[_0x05be('0x43')](handleError(_0x5ce6e2,null));};exports[_0x05be('0x47')]=function(_0x278cd1,_0x4d9283){return db['ServicenowAccount'][_0x05be('0x47')](_0x278cd1[_0x05be('0x48')],{})[_0x05be('0x23')](respondWithResult(_0x4d9283,0xc9))['catch'](handleError(_0x4d9283,null));};exports['update']=function(_0x527def,_0x10b32c){if(_0x527def[_0x05be('0x48')]['id']){delete _0x527def['body']['id'];}return db[_0x05be('0x2a')][_0x05be('0x46')]({'where':{'id':_0x527def['params']['id']}})[_0x05be('0x23')](handleEntityNotFound(_0x10b32c,null))[_0x05be('0x23')](saveUpdates(_0x527def[_0x05be('0x48')],null))[_0x05be('0x23')](respondWithResult(_0x10b32c,null))[_0x05be('0x43')](handleError(_0x10b32c,null));};exports[_0x05be('0x24')]=function(_0x589561,_0x2872d5){return db[_0x05be('0x2a')][_0x05be('0x46')]({'where':{'id':_0x589561['params']['id']}})[_0x05be('0x23')](handleEntityNotFound(_0x2872d5,null))[_0x05be('0x23')](removeEntity(_0x2872d5,null))[_0x05be('0x43')](handleError(_0x2872d5,null));};exports[_0x05be('0x49')]=function(_0x591dc3,_0x3c32f2,_0x58768b){var _0x5de200={};var _0x19d1ca={};var _0x553342;var _0x41a11d;return db[_0x05be('0x2a')][_0x05be('0x4a')]({'where':{'id':_0x591dc3[_0x05be('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3c32f2,null))[_0x05be('0x23')](function(_0x13205f){if(_0x13205f){_0x553342=_0x13205f;_0x19d1ca['model']=_[_0x05be('0x33')](db[_0x05be('0x4c')]['rawAttributes']);_0x19d1ca[_0x05be('0x32')]=_[_0x05be('0x33')](_0x591dc3[_0x05be('0x32')]);_0x19d1ca[_0x05be('0x34')]=_[_0x05be('0x35')](_0x19d1ca[_0x05be('0x2f')],_0x19d1ca[_0x05be('0x32')]);_0x5de200[_0x05be('0x37')]=_[_0x05be('0x35')](_0x19d1ca[_0x05be('0x2f')],qs[_0x05be('0x36')](_0x591dc3[_0x05be('0x32')]['fields']));_0x5de200[_0x05be('0x37')]=_0x5de200['attributes']['length']?_0x5de200[_0x05be('0x37')]:_0x19d1ca[_0x05be('0x2f')];_0x5de200[_0x05be('0x4d')]=qs[_0x05be('0x3b')](_0x591dc3[_0x05be('0x32')][_0x05be('0x3b')]);_0x5de200[_0x05be('0x3c')]=qs[_0x05be('0x34')](_[_0x05be('0x3d')](_0x591dc3[_0x05be('0x32')],_0x19d1ca[_0x05be('0x34')]));if(_0x591dc3['query'][_0x05be('0x3e')]){_0x5de200[_0x05be('0x3c')]=_[_0x05be('0x45')](_0x5de200[_0x05be('0x3c')],{'$or':_['map'](_0x5de200[_0x05be('0x37')],function(_0x47e387){var _0x2b69a8={};_0x2b69a8[_0x47e387]={'$like':'%'+_0x591dc3[_0x05be('0x32')][_0x05be('0x3e')]+'%'};return _0x2b69a8;})});}_0x5de200=_[_0x05be('0x45')]({},_0x5de200,_0x591dc3['options']);return _0x553342['getConfigurations'](_0x5de200);}})[_0x05be('0x23')](function(_0x54c25b){if(_0x54c25b){_0x41a11d=_0x54c25b['length'];if(!_0x591dc3['query']['hasOwnProperty'](_0x05be('0x3a'))){_0x5de200['limit']=qs[_0x05be('0x1d')](_0x591dc3[_0x05be('0x32')][_0x05be('0x1d')]);_0x5de200[_0x05be('0x1b')]=qs[_0x05be('0x1b')](_0x591dc3[_0x05be('0x32')][_0x05be('0x1b')]);}return _0x553342[_0x05be('0x49')](_0x5de200);}})[_0x05be('0x23')](function(_0x5170e1){if(_0x5170e1){return _0x5170e1?{'count':_0x41a11d,'rows':_0x5170e1}:null;}})[_0x05be('0x23')](respondWithResult(_0x3c32f2,null))[_0x05be('0x43')](handleError(_0x3c32f2,null));};exports[_0x05be('0x4e')]=function(_0x5e0d2d,_0x862814,_0x57a64d){if(_0x5e0d2d[_0x05be('0x48')]['id']){delete _0x5e0d2d[_0x05be('0x48')]['id'];}return db['ServicenowAccount'][_0x05be('0x4a')]({'where':{'id':_0x5e0d2d[_0x05be('0x4b')]['id']}})['then'](handleEntityNotFound(_0x862814,null))[_0x05be('0x23')](function(_0x13eb30){if(_0x13eb30){_0x5e0d2d[_0x05be('0x48')][_0x05be('0x4f')]=_0x13eb30['id'];_0x5e0d2d['body'][_0x05be('0x50')]=integrations[_0x05be('0x51')](_0x5e0d2d[_0x05be('0x48')]['channel'],_0x5e0d2d[_0x05be('0x48')][_0x05be('0x2d')]);_0x5e0d2d[_0x05be('0x48')]['Descriptions']=integrations[_0x05be('0x52')](_0x5e0d2d[_0x05be('0x48')][_0x05be('0x53')],_0x5e0d2d[_0x05be('0x48')][_0x05be('0x2d')]);return db[_0x05be('0x4c')][_0x05be('0x47')](_0x5e0d2d[_0x05be('0x48')],{'include':[{'model':db[_0x05be('0x54')],'as':_0x05be('0x50')},{'model':db[_0x05be('0x54')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x862814,null))['catch'](handleError(_0x862814,null));};exports[_0x05be('0x55')]=function(_0x33da8d,_0x289467,_0x4856ce){var _0x22e549=[_0x05be('0x56'),_0x05be('0x57'),'knowledge',_0x05be('0x58'),_0x05be('0x59'),_0x05be('0x5a'),'incident_state','severity','category'];var _0x267266=['parent',_0x05be('0x56'),_0x05be('0x5b'),'watch_list','upon_reject',_0x05be('0x5c'),_0x05be('0x5d'),'hold_reason',_0x05be('0x5e'),_0x05be('0x5f'),_0x05be('0x60'),_0x05be('0x61'),_0x05be('0x62'),_0x05be('0x63'),_0x05be('0x64'),_0x05be('0x65'),_0x05be('0x66'),'sys_created_by','knowledge',_0x05be('0x4d'),_0x05be('0x67'),_0x05be('0x68'),_0x05be('0x69'),'delivery_plan',_0x05be('0x6a'),_0x05be('0x6b'),_0x05be('0x6c'),_0x05be('0x6d'),_0x05be('0x6e'),_0x05be('0x6f'),_0x05be('0x70'),_0x05be('0x71'),_0x05be('0x72'),_0x05be('0x73'),'business_duration',_0x05be('0x74'),_0x05be('0x75'),_0x05be('0x76'),_0x05be('0x77'),'caller_id','approval_set','subcategory',_0x05be('0x78'),_0x05be('0x79'),_0x05be('0x59'),_0x05be('0x7a'),_0x05be('0x7b'),_0x05be('0x7c'),_0x05be('0x7d'),_0x05be('0x7e'),'additional_assignee_list',_0x05be('0x7f'),'calendar_duration','notify',_0x05be('0x80'),'close_notes',_0x05be('0x81'),_0x05be('0x82'),_0x05be('0x83'),_0x05be('0x84'),_0x05be('0x85'),_0x05be('0x86'),_0x05be('0x87'),_0x05be('0x88'),'problem_id',_0x05be('0x89'),_0x05be('0x8a'),_0x05be('0x8b'),_0x05be('0x8c'),'severity',_0x05be('0x8d'),_0x05be('0x8e'),'approval',_0x05be('0x8f'),_0x05be('0x90'),_0x05be('0x91'),_0x05be('0x92'),_0x05be('0x93'),_0x05be('0x94'),_0x05be('0x95'),'correlation_id',_0x05be('0x96'),_0x05be('0x97')];var _0x47ae95='';var _0x53cf73='';var _0xd8dcc4=[];var _0x3153dc='';var _0x117c48='';var _0x1a1da0=[];var _0xc5d518='';var _0x3ebc07='';var _0x29e851={};var _0x2b41c2='';return db[_0x05be('0x2a')]['findOne']({'where':{'id':_0x33da8d[_0x05be('0x4b')]['id']},'attributes':['id',_0x05be('0x98'),_0x05be('0x99'),_0x05be('0x9a'),'remoteUri',_0x05be('0x9b')]})[_0x05be('0x23')](handleEntityNotFound(_0x289467,null))[_0x05be('0x23')](function(_0x26cad5){if(_0x26cad5){_0x2b41c2=_0x26cad5[_0x05be('0x9c')];var _0x2b9509=_0x2b41c2[_0x05be('0x9d')](-0x1);if(_0x2b9509==='/'){_0x2b41c2=_0x2b41c2[_0x05be('0x9e')](0x0,_0x2b41c2[_0x05be('0x9f')](_0x2b9509));}_0x3ebc07=util['format'](_0x05be('0xa0'),_0x2b41c2);_0xc5d518=util[_0x05be('0xa1')](_0x05be('0xa2'),_0x2b41c2);_0x29e851={'user':_0x26cad5[_0x05be('0x98')],'pass':_0x26cad5[_0x05be('0x99')]};var _0x31a284={'method':_0x05be('0xa3'),'uri':_0x3ebc07+'incident?sysparm_display_value=all','auth':_0x29e851,'json':!![]};return rp(_0x31a284);}})[_0x05be('0x23')](function(_0x4b8dc0){if(_0x4b8dc0[_0x05be('0xa4')][_0x05be('0x38')]>0x0){_0x47ae95=_0x4b8dc0[_0x05be('0xa4')];}console[_0x05be('0xa5')](_0x05be('0xa6'),_0x47ae95);_0x1a1da0=[];_0x53cf73=Object[_0x05be('0xa7')]([],_0x47ae95);_[_0x05be('0xa8')](_0x53cf73,function(_0x554645){return!_0x22e549[_0x05be('0xa9')](_0x554645[_0x05be('0x31')]);});_0x53cf73['forEach'](function(_0x462c1e){var _0x8ee4c8=createFieldObject(_0xc5d518,_0x29e851,_0x462c1e[_0x05be('0xaa')],_0x462c1e[_0x05be('0x31')],_0x462c1e['label'],![]);_0x1a1da0[_0x05be('0xab')](_0x8ee4c8);});return Promise[_0x05be('0xac')](_0x1a1da0);})[_0x05be('0x23')](function(_0x5d9aac){_0xd8dcc4=_0x5d9aac;_0x3153dc=Object[_0x05be('0xa7')]([],_0x47ae95);console[_0x05be('0xa5')](_0x05be('0xad'),_0x47ae95);_[_0x05be('0xa8')](_0x3153dc,function(_0x2fdb0a){return _0x267266[_0x05be('0xa9')](_0x2fdb0a[_0x05be('0x31')]);});console['log'](_0x05be('0xae'),_0x3153dc);_0x1a1da0=[];_0x3153dc[_0x05be('0xaf')](function(_0x505352){var _0x16e850=createFieldObject(_0xc5d518,_0x29e851,_0x505352['internalType'],_0x505352[_0x05be('0x31')],_0x505352[_0x05be('0xb0')],!![]);_0x1a1da0[_0x05be('0xab')](_0x16e850);});return Promise[_0x05be('0xac')](_0x1a1da0);})[_0x05be('0x23')](function(_0x5131f7){_0x117c48=_0x5131f7;var _0x6718a9=_0xd8dcc4[_0x05be('0xb1')](_0x117c48);return{'count':_0x6718a9[_0x05be('0x38')],'rows':_0x6718a9};})[_0x05be('0x23')](respondWithResult(_0x289467,null))[_0x05be('0x43')](function(_0x5f5c11){console[_0x05be('0xa5')](_0x05be('0xb2')+_0x5f5c11);var _0x201b1f=_0x33da8d[_0x05be('0x32')][_0x05be('0xb3')]?0x1f4:_0x5f5c11[_0x05be('0xb4')]||0x1f4;logger[_0x05be('0x26')](_0x5f5c11[_0x05be('0x27')]);delete _0x5f5c11[_0x05be('0x31')];if(_0x201b1f===0x191){_0x201b1f=0x190;}_0x289467['status'](_0x201b1f)['send'](_0x33da8d[_0x05be('0x32')][_0x05be('0xb3')]?{'message':_0x05be('0xb5'),'statusCode':_0x5f5c11['statusCode']}:_0x5f5c11);});};function createFieldObject(_0x30e11b,_0x1e0f68,_0x4eca33,_0x4c5ccd,_0x32ffdc,_0x2ee120){return new Promise(function(_0x488ea5,_0x102199){var _0x154fe2={'id':_0x4c5ccd,'name':_0x32ffdc,'custom':_0x2ee120};if(_0x4eca33===_0x05be('0xb6')){_0x154fe2[_0x05be('0x40')]=[{'name':_0x05be('0xb7'),'value':_0x05be('0xb8')},{'name':_0x05be('0xb9'),'value':_0x05be('0xba')}];_0x488ea5(_0x154fe2);}else{var _0x530072={'method':_0x05be('0xa3'),'uri':_0x30e11b+_0x05be('0xbb')+_0x4c5ccd,'auth':_0x1e0f68,'json':!![]};return rp(_0x530072)['then'](function(_0x5af1f3){var _0xd9ed99=[];if(_0x5af1f3[_0x05be('0xa4')][_0x05be('0x38')]>0x0){_0x5af1f3[_0x05be('0xa4')]['forEach'](function(_0x25a025){if(_0x25a025['inactive']==='false'){var _0x40a3fb={'name':_0x25a025[_0x05be('0xb0')],'value':_0x25a025[_0x05be('0xbc')]};_0xd9ed99['push'](_0x40a3fb);}});}_0x154fe2[_0x05be('0x40')]=_0xd9ed99;if(_0x154fe2[_0x05be('0x40')][_0x05be('0x38')]>0x0){_0x488ea5(_0x154fe2);}else{if(_0x2ee120==![]){_0x488ea5();}else{_0x488ea5(_0x154fe2);}}});}});} \ No newline at end of file +var _0xdf9a=['user_input','sys_created_on','sys_domain','sys_created_by','closed_at','cmdb_ci','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','comments','approval','comments_and_work_notes','due_date','sys_mod_count','escalation','upon_approval','correlation_id','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','statusCode','test','Wrong\x20credentials','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ServicenowAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','includeAll','create','body','find','params','getConfigurations','findOne','order','Subjects','getSubjects','channel','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by'];(function(_0x4a6ad9,_0x2e86f6){var _0x10ee7f=function(_0x3a2396){while(--_0x3a2396){_0x4a6ad9['push'](_0x4a6ad9['shift']());}};_0x10ee7f(++_0x2e86f6);}(_0xdf9a,0x1ca));var _0xadf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf9a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xadf9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xadf9('0x1'));var rp=require('request-promise');var moment=require(_0xadf9('0x2'));var BPromise=require(_0xadf9('0x3'));var Mustache=require(_0xadf9('0x4'));var util=require('util');var path=require(_0xadf9('0x5'));var sox=require('sox');var csv=require(_0xadf9('0x6'));var ejs=require(_0xadf9('0x7'));var fs=require('fs');var fs_extra=require(_0xadf9('0x8'));var _=require(_0xadf9('0x9'));var squel=require(_0xadf9('0xa'));var crypto=require(_0xadf9('0xb'));var jsforce=require(_0xadf9('0xc'));var deskjs=require(_0xadf9('0xd'));var toCsv=require(_0xadf9('0x6'));var querystring=require(_0xadf9('0xe'));var Papa=require(_0xadf9('0xf'));var Redis=require(_0xadf9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xadf9('0x11'));var as=require(_0xadf9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xadf9('0x13'))(_0xadf9('0x14'));var utils=require('../../config/utils');var config=require(_0xadf9('0x15'));var licenseUtil=require(_0xadf9('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xadf9('0x17'));function respondWithStatusCode(_0x2fd6e3,_0x5341b1){_0x5341b1=_0x5341b1||0xcc;return function(_0x400d48){if(_0x400d48){return _0x2fd6e3[_0xadf9('0x18')](_0x5341b1);}return _0x2fd6e3[_0xadf9('0x19')](_0x5341b1)[_0xadf9('0x1a')]();};}function respondWithResult(_0x435eb1,_0x1c9611){_0x1c9611=_0x1c9611||0xc8;return function(_0x2e899e){if(_0x2e899e){return _0x435eb1[_0xadf9('0x19')](_0x1c9611)[_0xadf9('0x1b')](_0x2e899e);}};}function respondWithFilteredResult(_0x5d95c2,_0x5ad155){return function(_0x2d5ae0){if(_0x2d5ae0){var _0x4bd442=typeof _0x5ad155[_0xadf9('0x1c')]===_0xadf9('0x1d')&&typeof _0x5ad155[_0xadf9('0x1e')]===_0xadf9('0x1d');var _0x1c4f25=_0x2d5ae0[_0xadf9('0x1f')];var _0x301d9=_0x4bd442?0x0:_0x5ad155['offset'];var _0x1ee3cb=_0x4bd442?_0x2d5ae0['count']:_0x5ad155[_0xadf9('0x1c')]+_0x5ad155[_0xadf9('0x1e')];var _0x36ec91;if(_0x1ee3cb>=_0x1c4f25){_0x1ee3cb=_0x1c4f25;_0x36ec91=0xc8;}else{_0x36ec91=0xce;}_0x5d95c2['status'](_0x36ec91);return _0x5d95c2[_0xadf9('0x20')](_0xadf9('0x21'),_0x301d9+'-'+_0x1ee3cb+'/'+_0x1c4f25)[_0xadf9('0x1b')](_0x2d5ae0);}return null;};}function patchUpdates(_0x2dbbe0){return function(_0x41964b){try{jsonpatch[_0xadf9('0x22')](_0x41964b,_0x2dbbe0,!![]);}catch(_0x303048){return BPromise[_0xadf9('0x23')](_0x303048);}return _0x41964b[_0xadf9('0x24')]();};}function saveUpdates(_0x260467,_0x2c7f99){return function(_0x2221dd){if(_0x2221dd){return _0x2221dd[_0xadf9('0x25')](_0x260467)[_0xadf9('0x26')](function(_0x2f9f62){return _0x2f9f62;});}return null;};}function removeEntity(_0x27f7ef,_0xe84a4b){return function(_0x13ae47){if(_0x13ae47){return _0x13ae47[_0xadf9('0x27')]()[_0xadf9('0x26')](function(){_0x27f7ef[_0xadf9('0x19')](0xcc)[_0xadf9('0x1a')]();});}};}function handleEntityNotFound(_0xf75ff3,_0x3fc3a4){return function(_0x43edc2){if(!_0x43edc2){_0xf75ff3[_0xadf9('0x18')](0x194);}return _0x43edc2;};}function handleError(_0x40443a,_0x473571){_0x473571=_0x473571||0x1f4;return function(_0x27fc85){logger[_0xadf9('0x28')](_0x27fc85[_0xadf9('0x29')]);if(_0x27fc85['name']){delete _0x27fc85[_0xadf9('0x2a')];}_0x40443a[_0xadf9('0x19')](_0x473571)[_0xadf9('0x2b')](_0x27fc85);};}exports[_0xadf9('0x2c')]=function(_0x2e39a0,_0x3eca0c){var _0x1e8321={},_0x163dd2={},_0x354ea6={'count':0x0,'rows':[]};var _0x2e4d2a=_['map'](db[_0xadf9('0x2d')][_0xadf9('0x2e')],function(_0xd4b179){return{'name':_0xd4b179['fieldName'],'type':_0xd4b179[_0xadf9('0x2f')][_0xadf9('0x30')]};});_0x163dd2[_0xadf9('0x31')]=_[_0xadf9('0x32')](_0x2e4d2a,_0xadf9('0x2a'));_0x163dd2[_0xadf9('0x33')]=_[_0xadf9('0x34')](_0x2e39a0[_0xadf9('0x33')]);_0x163dd2[_0xadf9('0x35')]=_[_0xadf9('0x36')](_0x163dd2[_0xadf9('0x31')],_0x163dd2[_0xadf9('0x33')]);_0x1e8321[_0xadf9('0x37')]=_[_0xadf9('0x36')](_0x163dd2[_0xadf9('0x31')],qs[_0xadf9('0x38')](_0x2e39a0[_0xadf9('0x33')][_0xadf9('0x38')]));_0x1e8321[_0xadf9('0x37')]=_0x1e8321[_0xadf9('0x37')][_0xadf9('0x39')]?_0x1e8321['attributes']:_0x163dd2[_0xadf9('0x31')];if(!_0x2e39a0[_0xadf9('0x33')][_0xadf9('0x3a')](_0xadf9('0x3b'))){_0x1e8321['limit']=qs[_0xadf9('0x1e')](_0x2e39a0[_0xadf9('0x33')][_0xadf9('0x1e')]);_0x1e8321[_0xadf9('0x1c')]=qs['offset'](_0x2e39a0[_0xadf9('0x33')][_0xadf9('0x1c')]);}_0x1e8321['order']=qs[_0xadf9('0x3c')](_0x2e39a0[_0xadf9('0x33')][_0xadf9('0x3c')]);_0x1e8321[_0xadf9('0x3d')]=qs[_0xadf9('0x35')](_[_0xadf9('0x3e')](_0x2e39a0[_0xadf9('0x33')],_0x163dd2['filters']),_0x2e4d2a);if(_0x2e39a0[_0xadf9('0x33')][_0xadf9('0x3f')]){_0x1e8321[_0xadf9('0x3d')]=_['merge'](_0x1e8321[_0xadf9('0x3d')],{'$or':_[_0xadf9('0x32')](_0x2e4d2a,function(_0x255ee4){if(_0x255ee4[_0xadf9('0x2f')]!==_0xadf9('0x40')){var _0x1c2646={};_0x1c2646[_0x255ee4['name']]={'$like':'%'+_0x2e39a0['query']['filter']+'%'};return _0x1c2646;}})});}_0x1e8321=_[_0xadf9('0x41')]({},_0x1e8321,_0x2e39a0[_0xadf9('0x42')]);var _0x130583={'where':_0x1e8321[_0xadf9('0x3d')]};return db[_0xadf9('0x2d')]['count'](_0x130583)[_0xadf9('0x26')](function(_0x531156){_0x354ea6[_0xadf9('0x1f')]=_0x531156;if(_0x2e39a0[_0xadf9('0x33')]['includeAll']){_0x1e8321[_0xadf9('0x43')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x1e8321);})[_0xadf9('0x26')](function(_0x1c00da){_0x354ea6[_0xadf9('0x44')]=_0x1c00da;return _0x354ea6;})[_0xadf9('0x26')](respondWithFilteredResult(_0x3eca0c,_0x1e8321))[_0xadf9('0x45')](handleError(_0x3eca0c,null));};exports['show']=function(_0x2aa0c2,_0x51f869){var _0x3219ea={'raw':![],'where':{'id':_0x2aa0c2['params']['id']}},_0xb47c40={};_0xb47c40[_0xadf9('0x31')]=_[_0xadf9('0x34')](db['ServicenowAccount'][_0xadf9('0x2e')]);_0xb47c40[_0xadf9('0x33')]=_['keys'](_0x2aa0c2[_0xadf9('0x33')]);_0xb47c40[_0xadf9('0x35')]=_[_0xadf9('0x36')](_0xb47c40[_0xadf9('0x31')],_0xb47c40[_0xadf9('0x33')]);_0x3219ea[_0xadf9('0x37')]=_[_0xadf9('0x36')](_0xb47c40[_0xadf9('0x31')],qs[_0xadf9('0x38')](_0x2aa0c2['query'][_0xadf9('0x38')]));_0x3219ea[_0xadf9('0x37')]=_0x3219ea['attributes'][_0xadf9('0x39')]?_0x3219ea[_0xadf9('0x37')]:_0xb47c40['model'];if(_0x2aa0c2['query'][_0xadf9('0x46')]){_0x3219ea[_0xadf9('0x43')]=[{'all':!![]}];}_0x3219ea=_[_0xadf9('0x41')]({},_0x3219ea,_0x2aa0c2[_0xadf9('0x42')]);return db[_0xadf9('0x2d')]['find'](_0x3219ea)['then'](handleEntityNotFound(_0x51f869,null))[_0xadf9('0x26')](respondWithResult(_0x51f869,null))[_0xadf9('0x45')](handleError(_0x51f869,null));};exports[_0xadf9('0x47')]=function(_0x18f666,_0x35391b){return db['ServicenowAccount'][_0xadf9('0x47')](_0x18f666[_0xadf9('0x48')],{})['then'](respondWithResult(_0x35391b,0xc9))[_0xadf9('0x45')](handleError(_0x35391b,null));};exports['update']=function(_0x1d7933,_0x4ca813){if(_0x1d7933[_0xadf9('0x48')]['id']){delete _0x1d7933[_0xadf9('0x48')]['id'];}return db[_0xadf9('0x2d')][_0xadf9('0x49')]({'where':{'id':_0x1d7933['params']['id']}})[_0xadf9('0x26')](handleEntityNotFound(_0x4ca813,null))[_0xadf9('0x26')](saveUpdates(_0x1d7933[_0xadf9('0x48')],null))[_0xadf9('0x26')](respondWithResult(_0x4ca813,null))[_0xadf9('0x45')](handleError(_0x4ca813,null));};exports[_0xadf9('0x27')]=function(_0x50bfc1,_0x3eeafe){return db[_0xadf9('0x2d')][_0xadf9('0x49')]({'where':{'id':_0x50bfc1[_0xadf9('0x4a')]['id']}})[_0xadf9('0x26')](handleEntityNotFound(_0x3eeafe,null))[_0xadf9('0x26')](removeEntity(_0x3eeafe,null))[_0xadf9('0x45')](handleError(_0x3eeafe,null));};exports[_0xadf9('0x4b')]=function(_0x2b3364,_0x151262,_0x4a8853){var _0x39afa6={};var _0x16aa55={};var _0x394ac1;var _0x3c303a;return db[_0xadf9('0x2d')][_0xadf9('0x4c')]({'where':{'id':_0x2b3364[_0xadf9('0x4a')]['id']}})[_0xadf9('0x26')](handleEntityNotFound(_0x151262,null))['then'](function(_0x5b3f0f){if(_0x5b3f0f){_0x394ac1=_0x5b3f0f;_0x16aa55['model']=_[_0xadf9('0x34')](db['ServicenowConfiguration'][_0xadf9('0x2e')]);_0x16aa55[_0xadf9('0x33')]=_[_0xadf9('0x34')](_0x2b3364[_0xadf9('0x33')]);_0x16aa55[_0xadf9('0x35')]=_[_0xadf9('0x36')](_0x16aa55[_0xadf9('0x31')],_0x16aa55[_0xadf9('0x33')]);_0x39afa6[_0xadf9('0x37')]=_[_0xadf9('0x36')](_0x16aa55['model'],qs['fields'](_0x2b3364[_0xadf9('0x33')][_0xadf9('0x38')]));_0x39afa6[_0xadf9('0x37')]=_0x39afa6[_0xadf9('0x37')][_0xadf9('0x39')]?_0x39afa6[_0xadf9('0x37')]:_0x16aa55[_0xadf9('0x31')];_0x39afa6[_0xadf9('0x4d')]=qs[_0xadf9('0x3c')](_0x2b3364[_0xadf9('0x33')][_0xadf9('0x3c')]);_0x39afa6[_0xadf9('0x3d')]=qs['filters'](_[_0xadf9('0x3e')](_0x2b3364[_0xadf9('0x33')],_0x16aa55[_0xadf9('0x35')]));if(_0x2b3364[_0xadf9('0x33')][_0xadf9('0x3f')]){_0x39afa6[_0xadf9('0x3d')]=_[_0xadf9('0x41')](_0x39afa6[_0xadf9('0x3d')],{'$or':_['map'](_0x39afa6['attributes'],function(_0x2eb38f){var _0x50dbce={};_0x50dbce[_0x2eb38f]={'$like':'%'+_0x2b3364['query']['filter']+'%'};return _0x50dbce;})});}_0x39afa6=_['merge']({},_0x39afa6,_0x2b3364[_0xadf9('0x42')]);return _0x394ac1[_0xadf9('0x4b')](_0x39afa6);}})[_0xadf9('0x26')](function(_0x57f670){if(_0x57f670){_0x3c303a=_0x57f670['length'];if(!_0x2b3364[_0xadf9('0x33')]['hasOwnProperty'](_0xadf9('0x3b'))){_0x39afa6[_0xadf9('0x1e')]=qs[_0xadf9('0x1e')](_0x2b3364[_0xadf9('0x33')][_0xadf9('0x1e')]);_0x39afa6['offset']=qs[_0xadf9('0x1c')](_0x2b3364[_0xadf9('0x33')][_0xadf9('0x1c')]);}return _0x394ac1['getConfigurations'](_0x39afa6);}})['then'](function(_0x303182){if(_0x303182){return _0x303182?{'count':_0x3c303a,'rows':_0x303182}:null;}})['then'](respondWithResult(_0x151262,null))[_0xadf9('0x45')](handleError(_0x151262,null));};exports['addConfiguration']=function(_0x212b00,_0x4406e6,_0x1bee42){if(_0x212b00['body']['id']){delete _0x212b00['body']['id'];}return db[_0xadf9('0x2d')][_0xadf9('0x4c')]({'where':{'id':_0x212b00[_0xadf9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4406e6,null))['then'](function(_0x1062dc){if(_0x1062dc){_0x212b00[_0xadf9('0x48')]['AccountId']=_0x1062dc['id'];_0x212b00[_0xadf9('0x48')][_0xadf9('0x4e')]=integrations[_0xadf9('0x4f')](_0x212b00[_0xadf9('0x48')][_0xadf9('0x50')],_0x212b00[_0xadf9('0x48')]['type']);_0x212b00['body']['Descriptions']=integrations[_0xadf9('0x51')](_0x212b00[_0xadf9('0x48')][_0xadf9('0x50')],_0x212b00['body'][_0xadf9('0x2f')]);return db[_0xadf9('0x52')][_0xadf9('0x47')](_0x212b00['body'],{'include':[{'model':db[_0xadf9('0x53')],'as':_0xadf9('0x4e')},{'model':db[_0xadf9('0x53')],'as':'Descriptions'}]});}return null;})[_0xadf9('0x26')](respondWithResult(_0x4406e6,null))[_0xadf9('0x45')](handleError(_0x4406e6,null));};exports[_0xadf9('0x54')]=function(_0x2313d5,_0x13c3a2,_0x5180fa){var _0x4d4111=[_0xadf9('0x55'),_0xadf9('0x56'),_0xadf9('0x57'),_0xadf9('0x58'),_0xadf9('0x59'),_0xadf9('0x5a'),_0xadf9('0x5b'),_0xadf9('0x5c'),_0xadf9('0x5d')];var _0x23f1ce=['parent',_0xadf9('0x55'),_0xadf9('0x5e'),_0xadf9('0x5f'),_0xadf9('0x60'),_0xadf9('0x61'),_0xadf9('0x62'),_0xadf9('0x56'),_0xadf9('0x63'),_0xadf9('0x64'),'resolved_by',_0xadf9('0x65'),_0xadf9('0x66'),_0xadf9('0x67'),_0xadf9('0x68'),_0xadf9('0x69'),'state',_0xadf9('0x6a'),_0xadf9('0x57'),'order','calendar_stc',_0xadf9('0x6b'),_0xadf9('0x6c'),'delivery_plan',_0xadf9('0x6d'),'active',_0xadf9('0x6e'),_0xadf9('0x6f'),_0xadf9('0x70'),_0xadf9('0x71'),_0xadf9('0x72'),_0xadf9('0x73'),_0xadf9('0x74'),_0xadf9('0x75'),_0xadf9('0x76'),'group_list',_0xadf9('0x77'),_0xadf9('0x78'),'resolved_at',_0xadf9('0x79'),_0xadf9('0x7a'),_0xadf9('0x58'),_0xadf9('0x7b'),_0xadf9('0x7c'),'close_code',_0xadf9('0x7d'),_0xadf9('0x7e'),_0xadf9('0x7f'),_0xadf9('0x80'),_0xadf9('0x81'),_0xadf9('0x82'),_0xadf9('0x83'),_0xadf9('0x84'),_0xadf9('0x5a'),'sys_class_name',_0xadf9('0x85'),_0xadf9('0x86'),_0xadf9('0x87'),'parent_incident',_0xadf9('0x88'),_0xadf9('0x89'),_0xadf9('0x8a'),_0xadf9('0x5b'),'urgency',_0xadf9('0x8b'),_0xadf9('0x8c'),_0xadf9('0x8d'),_0xadf9('0x8e'),_0xadf9('0x8f'),_0xadf9('0x5c'),_0xadf9('0x90'),'sla_due',_0xadf9('0x91'),_0xadf9('0x92'),_0xadf9('0x93'),_0xadf9('0x94'),'reopen_count','sys_tags',_0xadf9('0x95'),_0xadf9('0x96'),_0xadf9('0x97'),'location','category'];var _0x5c50e7='';var _0x4046e5='';var _0x2072e8=[];var _0x57158b='';var _0x13ff6d='';var _0x36ec57=[];var _0x3257bb='';var _0x457b4c='';var _0xea21c0={};var _0x8286eb='';return db[_0xadf9('0x2d')][_0xadf9('0x4c')]({'where':{'id':_0x2313d5[_0xadf9('0x4a')]['id']},'attributes':['id',_0xadf9('0x98'),_0xadf9('0x99'),_0xadf9('0x9a'),_0xadf9('0x9b'),_0xadf9('0x9c')]})[_0xadf9('0x26')](handleEntityNotFound(_0x13c3a2,null))[_0xadf9('0x26')](function(_0x152fd6){if(_0x152fd6){_0x8286eb=_0x152fd6['remoteUri'];var _0x4b23c5=_0x8286eb[_0xadf9('0x9d')](-0x1);if(_0x4b23c5==='/'){_0x8286eb=_0x8286eb[_0xadf9('0x9e')](0x0,_0x8286eb[_0xadf9('0x9f')](_0x4b23c5));}_0x457b4c=util[_0xadf9('0xa0')](_0xadf9('0xa1'),_0x8286eb);_0x3257bb=util[_0xadf9('0xa0')](_0xadf9('0xa2'),_0x8286eb);_0xea21c0={'user':_0x152fd6[_0xadf9('0x98')],'pass':_0x152fd6[_0xadf9('0x99')]};var _0x43561f={'method':_0xadf9('0xa3'),'uri':_0x457b4c+_0xadf9('0xa4'),'auth':_0xea21c0,'json':!![]};return rp(_0x43561f);}})[_0xadf9('0x26')](function(_0x2ee003){if(_0x2ee003[_0xadf9('0xa5')][_0xadf9('0x39')]>0x0){_0x5c50e7=_0x2ee003[_0xadf9('0xa5')];}console[_0xadf9('0xa6')]('incident\x20table\x20objects',_0x5c50e7);_0x36ec57=[];_0x4046e5=Object[_0xadf9('0xa7')]([],_0x5c50e7);_[_0xadf9('0xa8')](_0x4046e5,function(_0x475325){return!_0x4d4111[_0xadf9('0xa9')](_0x475325['name']);});_0x4046e5[_0xadf9('0xaa')](function(_0x253b9c){var _0x163408=createFieldObject(_0x3257bb,_0xea21c0,_0x253b9c[_0xadf9('0xab')],_0x253b9c[_0xadf9('0x2a')],_0x253b9c[_0xadf9('0xac')],![]);_0x36ec57[_0xadf9('0xad')](_0x163408);});return Promise[_0xadf9('0xae')](_0x36ec57);})[_0xadf9('0x26')](function(_0x3a7d26){_0x2072e8=_0x3a7d26;_0x57158b=Object[_0xadf9('0xa7')]([],_0x5c50e7);console[_0xadf9('0xa6')](_0xadf9('0xaf'),_0x5c50e7);_['remove'](_0x57158b,function(_0x7c48c2){return _0x23f1ce[_0xadf9('0xa9')](_0x7c48c2[_0xadf9('0x2a')]);});console[_0xadf9('0xa6')](_0xadf9('0xb0'),_0x57158b);_0x36ec57=[];_0x57158b[_0xadf9('0xaa')](function(_0x590b34){var _0x14e7c1=createFieldObject(_0x3257bb,_0xea21c0,_0x590b34['internalType'],_0x590b34[_0xadf9('0x2a')],_0x590b34[_0xadf9('0xac')],!![]);_0x36ec57['push'](_0x14e7c1);});return Promise[_0xadf9('0xae')](_0x36ec57);})[_0xadf9('0x26')](function(_0x219c15){_0x13ff6d=_0x219c15;var _0x21e179=_0x2072e8[_0xadf9('0xb1')](_0x13ff6d);return{'count':_0x21e179['length'],'rows':_0x21e179};})['then'](respondWithResult(_0x13c3a2,null))[_0xadf9('0x45')](function(_0x98352e){console['log']('ServiceNow\x20error:\x20'+_0x98352e);var _0x526a4d=_0x2313d5[_0xadf9('0x33')]['test']?0x1f4:_0x98352e[_0xadf9('0xb2')]||0x1f4;logger[_0xadf9('0x28')](_0x98352e[_0xadf9('0x29')]);delete _0x98352e['name'];if(_0x526a4d===0x191){_0x526a4d=0x190;}_0x13c3a2['status'](_0x526a4d)[_0xadf9('0x2b')](_0x2313d5['query'][_0xadf9('0xb3')]?{'message':_0xadf9('0xb4'),'statusCode':_0x98352e[_0xadf9('0xb2')]}:_0x98352e);});};function createFieldObject(_0x2d27ef,_0x52c9a4,_0x4c1970,_0x52ace8,_0x4a9717,_0xe83e16){return new Promise(function(_0x20b8d5,_0x5dc6f6){var _0x40052e={'id':_0x52ace8,'name':_0x4a9717,'custom':_0xe83e16};if(_0x4c1970==='boolean'){_0x40052e['options']=[{'name':'True','value':_0xadf9('0xb5')},{'name':_0xadf9('0xb6'),'value':'false'}];_0x20b8d5(_0x40052e);}else{var _0x12051b={'method':_0xadf9('0xa3'),'uri':_0x2d27ef+_0xadf9('0xb7')+_0x52ace8,'auth':_0x52c9a4,'json':!![]};return rp(_0x12051b)[_0xadf9('0x26')](function(_0x222047){var _0x240f71=[];if(_0x222047[_0xadf9('0xa5')][_0xadf9('0x39')]>0x0){_0x222047[_0xadf9('0xa5')][_0xadf9('0xaa')](function(_0x84c28f){if(_0x84c28f[_0xadf9('0xb8')]===_0xadf9('0xb9')){var _0x470392={'name':_0x84c28f['label'],'value':_0x84c28f[_0xadf9('0xba')]};_0x240f71[_0xadf9('0xad')](_0x470392);}});}_0x40052e[_0xadf9('0x42')]=_0x240f71;if(_0x40052e[_0xadf9('0x42')][_0xadf9('0x39')]>0x0){_0x20b8d5(_0x40052e);}else{if(_0xe83e16==![]){_0x20b8d5();}else{_0x20b8d5(_0x40052e);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 0e47074..178d5a2 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 _0x038b=['path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','util','../../config/logger','api','bluebird'];(function(_0x946455,_0x3ec7b6){var _0x48196f=function(_0x102390){while(--_0x102390){_0x946455['push'](_0x946455['shift']());}};_0x48196f(++_0x3ec7b6);}(_0x038b,0x114));var _0xb038=function(_0x205ad1,_0xc1f539){_0x205ad1=_0x205ad1-0x0;var _0x302e9a=_0x038b[_0x205ad1];return _0x302e9a;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));var integrations=require(_0xb038('0x7'));module['exports']=function(_0x54e1e7,_0x2e3e64){return _0x54e1e7[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4819=['request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x57a91b,_0x1a9e54){var _0x161e7f=function(_0x2e2ed3){while(--_0x2e2ed3){_0x57a91b['push'](_0x57a91b['shift']());}};_0x161e7f(++_0x1a9e54);}(_0x4819,0xcd));var _0x9481=function(_0x495ebf,_0x27df21){_0x495ebf=_0x495ebf-0x0;var _0x5841ef=_0x4819[_0x495ebf];return _0x5841ef;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x9481('0xa')]=function(_0x5def07,_0x54cc78){return _0x5def07[_0x9481('0xb')](_0x9481('0xc'),attributes,{'tableName':_0x9481('0xd'),'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 e62b9a0..30fd566 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 _0x06f6=['ServicenowAccount','findAll','options','raw','where','attributes','include','map','model','debug','ShowServicenowAccount','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x06f6,0x6e));var _0x606f=function(_0x4af7ec,_0x23f411){_0x4af7ec=_0x4af7ec-0x0;var _0xb937fb=_0x06f6[_0x4af7ec];return _0xb937fb;};'use strict';var _=require(_0x606f('0x0'));var util=require(_0x606f('0x1'));var moment=require(_0x606f('0x2'));var BPromise=require(_0x606f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x606f('0x4'));var logger=require(_0x606f('0x5'))(_0x606f('0x6'));var config=require(_0x606f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x606f('0x8')][_0x606f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f3ce7,_0x3c3bc1,_0x4c194e){return new BPromise(function(_0x303074,_0x106d6b){return client[_0x606f('0xa')](_0x1f3ce7,_0x4c194e)[_0x606f('0xb')](function(_0x2545cf){logger[_0x606f('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x3c3bc1,_0x606f('0xd'));logger['debug'](_0x606f('0xe'),_0x3c3bc1,'request\x20sent',JSON[_0x606f('0xf')](_0x2545cf));if(_0x2545cf[_0x606f('0x10')]){if(_0x2545cf[_0x606f('0x10')]['code']===0x1f4){logger['error'](_0x606f('0x11'),_0x3c3bc1,_0x2545cf[_0x606f('0x10')][_0x606f('0x12')]);return _0x106d6b(_0x2545cf[_0x606f('0x10')][_0x606f('0x12')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x3c3bc1,_0x2545cf[_0x606f('0x10')][_0x606f('0x12')]);return _0x303074(_0x2545cf['error'][_0x606f('0x12')]);}else{logger[_0x606f('0xc')](_0x606f('0x11'),_0x3c3bc1,'request\x20sent');_0x303074(_0x2545cf[_0x606f('0x13')][_0x606f('0x12')]);}})[_0x606f('0x14')](function(_0x2c9cc2){logger['error'](_0x606f('0x11'),_0x3c3bc1,_0x2c9cc2);_0x106d6b(_0x2c9cc2);});});}exports[_0x606f('0x15')]=function(_0x49a8f4){var _0x1bf9f6=this;return new Promise(function(_0x2094a2,_0x2a9cae){return db[_0x606f('0x16')][_0x606f('0x17')]({'raw':_0x49a8f4[_0x606f('0x18')]?_0x49a8f4[_0x606f('0x18')][_0x606f('0x19')]===undefined?!![]:![]:!![],'where':_0x49a8f4[_0x606f('0x18')]?_0x49a8f4[_0x606f('0x18')][_0x606f('0x1a')]||null:null,'attributes':_0x49a8f4[_0x606f('0x18')]?_0x49a8f4['options'][_0x606f('0x1b')]||null:null,'limit':_0x49a8f4[_0x606f('0x18')]?_0x49a8f4[_0x606f('0x18')]['limit']||null:null,'include':_0x49a8f4[_0x606f('0x18')]?_0x49a8f4['options'][_0x606f('0x1c')]?_[_0x606f('0x1d')](_0x49a8f4['options'][_0x606f('0x1c')],function(_0x5f1287){return{'model':db[_0x5f1287[_0x606f('0x1e')]],'as':_0x5f1287['as'],'attributes':_0x5f1287[_0x606f('0x1b')],'include':_0x5f1287[_0x606f('0x1c')]?_[_0x606f('0x1d')](_0x5f1287['include'],function(_0x91dc57){return{'model':db[_0x91dc57[_0x606f('0x1e')]],'as':_0x91dc57['as'],'attributes':_0x91dc57[_0x606f('0x1b')],'include':_0x91dc57[_0x606f('0x1c')]?_[_0x606f('0x1d')](_0x91dc57[_0x606f('0x1c')],function(_0x3eae51){return{'model':db[_0x3eae51['model']],'as':_0x3eae51['as'],'attributes':_0x3eae51[_0x606f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x606f('0xb')](function(_0x4f5f81){logger[_0x606f('0xc')](_0x606f('0x15'),_0x49a8f4);logger['debug'](_0x606f('0x15'),_0x49a8f4,JSON[_0x606f('0xf')](_0x4f5f81));_0x2094a2(_0x4f5f81);})['catch'](function(_0x48d182){logger[_0x606f('0x10')](_0x606f('0x15'),_0x48d182[_0x606f('0x12')],_0x49a8f4);_0x2a9cae(_0x1bf9f6['error'](0x1f4,_0x48d182[_0x606f('0x12')]));});});};exports['ShowServicenowAccount']=function(_0x196bd6){var _0x2bc781=this;return new Promise(function(_0x295664,_0x9108ef){return db[_0x606f('0x16')]['find']({'raw':_0x196bd6['options']?_0x196bd6[_0x606f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x196bd6[_0x606f('0x18')]?_0x196bd6[_0x606f('0x18')][_0x606f('0x1a')]||null:null,'attributes':_0x196bd6['options']?_0x196bd6['options']['attributes']||null:null,'include':_0x196bd6[_0x606f('0x18')]?_0x196bd6[_0x606f('0x18')][_0x606f('0x1c')]?_['map'](_0x196bd6['options']['include'],function(_0x6444a0){return{'model':db[_0x6444a0[_0x606f('0x1e')]],'as':_0x6444a0['as'],'attributes':_0x6444a0[_0x606f('0x1b')],'include':_0x6444a0['include']?_['map'](_0x6444a0[_0x606f('0x1c')],function(_0xbe0fb5){return{'model':db[_0xbe0fb5[_0x606f('0x1e')]],'as':_0xbe0fb5['as'],'attributes':_0xbe0fb5[_0x606f('0x1b')],'include':_0xbe0fb5['include']?_[_0x606f('0x1d')](_0xbe0fb5[_0x606f('0x1c')],function(_0x28121b){return{'model':db[_0x28121b[_0x606f('0x1e')]],'as':_0x28121b['as'],'attributes':_0x28121b[_0x606f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x284b77){logger['info']('ShowServicenowAccount',_0x196bd6);logger[_0x606f('0x1f')]('ShowServicenowAccount',_0x196bd6,JSON[_0x606f('0xf')](_0x284b77));_0x295664(_0x284b77);})[_0x606f('0x14')](function(_0x682353){logger['error'](_0x606f('0x20'),_0x682353[_0x606f('0x12')],_0x196bd6);_0x9108ef(_0x2bc781[_0x606f('0x10')](0x1f4,_0x682353['message']));});});}; \ No newline at end of file +var _0xc276=['jayson/promise','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include','map','model','ShowServicenowAccount','find','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc276,0x17a));var _0x6c27=function(_0x41c6f7,_0xea6a15){_0x41c6f7=_0x41c6f7-0x0;var _0x2902e2=_0xc276[_0x41c6f7];return _0x2902e2;};'use strict';var _=require(_0x6c27('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6c27('0x1'));var fs=require('fs');var Redis=require(_0x6c27('0x2'));var db=require(_0x6c27('0x3'))['db'];var utils=require(_0x6c27('0x4'));var logger=require(_0x6c27('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c27('0x6'));var client=jayson['client'][_0x6c27('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e71c2,_0x51a5bc,_0x5a8eec){return new BPromise(function(_0x1e36f0,_0x4ae2ac){return client['request'](_0x4e71c2,_0x5a8eec)[_0x6c27('0x8')](function(_0x2fe5c3){logger[_0x6c27('0x9')](_0x6c27('0xa'),_0x51a5bc,_0x6c27('0xb'));logger[_0x6c27('0xc')](_0x6c27('0xd'),_0x51a5bc,_0x6c27('0xb'),JSON[_0x6c27('0xe')](_0x2fe5c3));if(_0x2fe5c3[_0x6c27('0xf')]){if(_0x2fe5c3[_0x6c27('0xf')][_0x6c27('0x10')]===0x1f4){logger[_0x6c27('0xf')](_0x6c27('0xa'),_0x51a5bc,_0x2fe5c3[_0x6c27('0xf')]['message']);return _0x4ae2ac(_0x2fe5c3[_0x6c27('0xf')]['message']);}logger['error'](_0x6c27('0xa'),_0x51a5bc,_0x2fe5c3['error']['message']);return _0x1e36f0(_0x2fe5c3[_0x6c27('0xf')][_0x6c27('0x11')]);}else{logger[_0x6c27('0x9')](_0x6c27('0xa'),_0x51a5bc,'request\x20sent');_0x1e36f0(_0x2fe5c3[_0x6c27('0x12')][_0x6c27('0x11')]);}})[_0x6c27('0x13')](function(_0x426bbb){logger[_0x6c27('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x51a5bc,_0x426bbb);_0x4ae2ac(_0x426bbb);});});}exports[_0x6c27('0x14')]=function(_0x362400){var _0x42d9b5=this;return new Promise(function(_0x538afc,_0x19c837){return db[_0x6c27('0x15')]['findAll']({'raw':_0x362400[_0x6c27('0x16')]?_0x362400[_0x6c27('0x16')][_0x6c27('0x17')]===undefined?!![]:![]:!![],'where':_0x362400['options']?_0x362400[_0x6c27('0x16')][_0x6c27('0x18')]||null:null,'attributes':_0x362400['options']?_0x362400[_0x6c27('0x16')][_0x6c27('0x19')]||null:null,'limit':_0x362400['options']?_0x362400[_0x6c27('0x16')][_0x6c27('0x1a')]||null:null,'include':_0x362400[_0x6c27('0x16')]?_0x362400[_0x6c27('0x16')][_0x6c27('0x1b')]?_[_0x6c27('0x1c')](_0x362400['options'][_0x6c27('0x1b')],function(_0x26adce){return{'model':db[_0x26adce[_0x6c27('0x1d')]],'as':_0x26adce['as'],'attributes':_0x26adce[_0x6c27('0x19')],'include':_0x26adce[_0x6c27('0x1b')]?_[_0x6c27('0x1c')](_0x26adce[_0x6c27('0x1b')],function(_0x404519){return{'model':db[_0x404519['model']],'as':_0x404519['as'],'attributes':_0x404519[_0x6c27('0x19')],'include':_0x404519[_0x6c27('0x1b')]?_['map'](_0x404519[_0x6c27('0x1b')],function(_0xc28d5a){return{'model':db[_0xc28d5a[_0x6c27('0x1d')]],'as':_0xc28d5a['as'],'attributes':_0xc28d5a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x137873){logger['info']('GetServicenowAccount',_0x362400);logger[_0x6c27('0xc')](_0x6c27('0x14'),_0x362400,JSON[_0x6c27('0xe')](_0x137873));_0x538afc(_0x137873);})[_0x6c27('0x13')](function(_0x1cb34a){logger[_0x6c27('0xf')](_0x6c27('0x14'),_0x1cb34a['message'],_0x362400);_0x19c837(_0x42d9b5[_0x6c27('0xf')](0x1f4,_0x1cb34a[_0x6c27('0x11')]));});});};exports[_0x6c27('0x1e')]=function(_0x25a69f){var _0x133315=this;return new Promise(function(_0x1fb4f1,_0x3a439c){return db['ServicenowAccount'][_0x6c27('0x1f')]({'raw':_0x25a69f[_0x6c27('0x16')]?_0x25a69f['options'][_0x6c27('0x17')]===undefined?!![]:![]:!![],'where':_0x25a69f['options']?_0x25a69f[_0x6c27('0x16')][_0x6c27('0x18')]||null:null,'attributes':_0x25a69f[_0x6c27('0x16')]?_0x25a69f[_0x6c27('0x16')]['attributes']||null:null,'include':_0x25a69f['options']?_0x25a69f[_0x6c27('0x16')][_0x6c27('0x1b')]?_['map'](_0x25a69f[_0x6c27('0x16')][_0x6c27('0x1b')],function(_0x2d16bd){return{'model':db[_0x2d16bd[_0x6c27('0x1d')]],'as':_0x2d16bd['as'],'attributes':_0x2d16bd[_0x6c27('0x19')],'include':_0x2d16bd[_0x6c27('0x1b')]?_[_0x6c27('0x1c')](_0x2d16bd[_0x6c27('0x1b')],function(_0x5f5604){return{'model':db[_0x5f5604['model']],'as':_0x5f5604['as'],'attributes':_0x5f5604[_0x6c27('0x19')],'include':_0x5f5604['include']?_[_0x6c27('0x1c')](_0x5f5604[_0x6c27('0x1b')],function(_0x5460a6){return{'model':db[_0x5460a6[_0x6c27('0x1d')]],'as':_0x5460a6['as'],'attributes':_0x5460a6['attributes']};}):[]};}):[]};}):[]:[]})[_0x6c27('0x8')](function(_0x5179f9){logger[_0x6c27('0x9')]('ShowServicenowAccount',_0x25a69f);logger[_0x6c27('0xc')](_0x6c27('0x1e'),_0x25a69f,JSON[_0x6c27('0xe')](_0x5179f9));_0x1fb4f1(_0x5179f9);})['catch'](function(_0x46891f){logger['error'](_0x6c27('0x1e'),_0x46891f[_0x6c27('0x11')],_0x25a69f);_0x3a439c(_0x133315[_0x6c27('0xf')](0x1f4,_0x46891f[_0x6c27('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index b186028..fca4bf0 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 _0x4794=['../../config/environment','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','post','update','delete','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1603c9,_0x499c56){var _0x7d9be5=function(_0x18b3fe){while(--_0x18b3fe){_0x1603c9['push'](_0x1603c9['shift']());}};_0x7d9be5(++_0x499c56);}(_0x4794,0xeb));var _0x4479=function(_0x2aa24f,_0xb48644){_0x2aa24f=_0x2aa24f-0x0;var _0x49bb8e=_0x4794[_0x2aa24f];return _0x49bb8e;};'use strict';var multer=require(_0x4479('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4479('0x1'));var express=require('express');var router=express[_0x4479('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4479('0x3'));var interaction=require(_0x4479('0x4'));var config=require(_0x4479('0x5'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0x4479('0x6')](),controller[_0x4479('0x7')]);router['get'](_0x4479('0x8'),auth[_0x4479('0x6')](),controller[_0x4479('0x9')]);router[_0x4479('0xa')](_0x4479('0xb'),auth[_0x4479('0x6')](),controller[_0x4479('0xc')]);router[_0x4479('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x4479('0xa')]('/:id/descriptions',auth[_0x4479('0x6')](),controller['getDescriptions']);router[_0x4479('0xd')]('/',auth[_0x4479('0x6')](),controller['create']);router['put'](_0x4479('0x8'),auth['isAuthenticated'](),controller[_0x4479('0xe')]);router[_0x4479('0xf')]('/:id',auth[_0x4479('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdd3d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','delete','destroy','exports','path','connect-timeout','express'];(function(_0x573f6d,_0xa3cd19){var _0x1c672b=function(_0x4ccaca){while(--_0x4ccaca){_0x573f6d['push'](_0x573f6d['shift']());}};_0x1c672b(++_0xa3cd19);}(_0xdd3d,0x75));var _0xddd3=function(_0x5c6f58,_0x3f6e3f){_0x5c6f58=_0x5c6f58-0x0;var _0x2103d0=_0xdd3d[_0x5c6f58];return _0x2103d0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xddd3('0x0'));var timeout=require(_0xddd3('0x1'));var express=require(_0xddd3('0x2'));var router=express['Router']();var fs_extra=require(_0xddd3('0x3'));var auth=require(_0xddd3('0x4'));var interaction=require(_0xddd3('0x5'));var config=require(_0xddd3('0x6'));var controller=require(_0xddd3('0x7'));router['get']('/',auth[_0xddd3('0x8')](),controller[_0xddd3('0x9')]);router[_0xddd3('0xa')](_0xddd3('0xb'),auth[_0xddd3('0x8')](),controller[_0xddd3('0xc')]);router[_0xddd3('0xa')](_0xddd3('0xd'),auth[_0xddd3('0x8')](),controller[_0xddd3('0xe')]);router['get'](_0xddd3('0xf'),auth[_0xddd3('0x8')](),controller[_0xddd3('0x10')]);router['get']('/:id/descriptions',auth[_0xddd3('0x8')](),controller[_0xddd3('0x11')]);router[_0xddd3('0x12')]('/',auth['isAuthenticated'](),controller[_0xddd3('0x13')]);router[_0xddd3('0x14')](_0xddd3('0xb'),auth[_0xddd3('0x8')](),controller['update']);router[_0xddd3('0x15')](_0xddd3('0xb'),auth[_0xddd3('0x8')](),controller[_0xddd3('0x16')]);module[_0xddd3('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 2f64d46..01c2525 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 _0x069d=['STRING','sequelize'];(function(_0x62b58e,_0x46fe1e){var _0x37fe84=function(_0x12a2ca){while(--_0x12a2ca){_0x62b58e['push'](_0x62b58e['shift']());}};_0x37fe84(++_0x46fe1e);}(_0x069d,0x13d));var _0xd069=function(_0x3665e8,_0xe89046){_0x3665e8=_0x3665e8-0x0;var _0x4b00b2=_0x069d[_0x3665e8];return _0x4b00b2;};'use strict';var Sequelize=require(_0xd069('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd069('0x1')]}}; \ No newline at end of file +var _0xc42c=['exports'];(function(_0x2ebda9,_0x10d455){var _0x108b33=function(_0x46be81){while(--_0x46be81){_0x2ebda9['push'](_0x2ebda9['shift']());}};_0x108b33(++_0x10d455);}(_0xc42c,0xd4));var _0xcc42=function(_0x54e485,_0x34ecd8){_0x54e485=_0x54e485-0x0;var _0x57cb92=_0xc42c[_0x54e485];return _0x57cb92;};'use strict';var Sequelize=require('sequelize');module[_0xcc42('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index f72755e..7a1b855 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 _0xfb2e=['length','hasOwnProperty','sort','filters','pick','merge','filter','options','where','includeAll','include','rows','catch','params','rawAttributes','find','create','body','update','getFields','ServicenowField','order','nolimit','getSubjects','getDescriptions','findOne','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','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','ServicenowConfiguration','fieldName','type','key','map','query','keys','intersection','model','attributes','fields'];(function(_0x104c7a,_0x219911){var _0x2a7492=function(_0x40047e){while(--_0x40047e){_0x104c7a['push'](_0x104c7a['shift']());}};_0x2a7492(++_0x219911);}(_0xfb2e,0x110));var _0xefb2=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xfb2e[_0x24237f];return _0x48298e;};'use strict';var emlformat=require(_0xefb2('0x0'));var rimraf=require(_0xefb2('0x1'));var zipdir=require(_0xefb2('0x2'));var jsonpatch=require(_0xefb2('0x3'));var rp=require(_0xefb2('0x4'));var moment=require(_0xefb2('0x5'));var BPromise=require(_0xefb2('0x6'));var Mustache=require(_0xefb2('0x7'));var util=require(_0xefb2('0x8'));var path=require('path');var sox=require(_0xefb2('0x9'));var csv=require(_0xefb2('0xa'));var ejs=require(_0xefb2('0xb'));var fs=require('fs');var fs_extra=require(_0xefb2('0xc'));var _=require(_0xefb2('0xd'));var squel=require(_0xefb2('0xe'));var crypto=require(_0xefb2('0xf'));var jsforce=require(_0xefb2('0x10'));var deskjs=require(_0xefb2('0x11'));var toCsv=require(_0xefb2('0xa'));var querystring=require(_0xefb2('0x12'));var Papa=require(_0xefb2('0x13'));var Redis=require('ioredis');var authService=require(_0xefb2('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xefb2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xefb2('0x16'))('api');var utils=require(_0xefb2('0x17'));var config=require(_0xefb2('0x18'));var licenseUtil=require(_0xefb2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2cd9c9,_0x48577b){_0x48577b=_0x48577b||0xcc;return function(_0x3c8286){if(_0x3c8286){return _0x2cd9c9[_0xefb2('0x1a')](_0x48577b);}return _0x2cd9c9[_0xefb2('0x1b')](_0x48577b)[_0xefb2('0x1c')]();};}function respondWithResult(_0x941141,_0x4163d5){_0x4163d5=_0x4163d5||0xc8;return function(_0x4f30ad){if(_0x4f30ad){return _0x941141['status'](_0x4163d5)[_0xefb2('0x1d')](_0x4f30ad);}};}function respondWithFilteredResult(_0xa2ed81,_0x4951d1){return function(_0xb708b2){if(_0xb708b2){var _0x2b5987=typeof _0x4951d1['offset']===_0xefb2('0x1e')&&typeof _0x4951d1['limit']===_0xefb2('0x1e');var _0x37b207=_0xb708b2[_0xefb2('0x1f')];var _0x294dc9=_0x2b5987?0x0:_0x4951d1[_0xefb2('0x20')];var _0x2e6815=_0x2b5987?_0xb708b2[_0xefb2('0x1f')]:_0x4951d1[_0xefb2('0x20')]+_0x4951d1[_0xefb2('0x21')];var _0x4dcc14;if(_0x2e6815>=_0x37b207){_0x2e6815=_0x37b207;_0x4dcc14=0xc8;}else{_0x4dcc14=0xce;}_0xa2ed81[_0xefb2('0x1b')](_0x4dcc14);return _0xa2ed81[_0xefb2('0x22')](_0xefb2('0x23'),_0x294dc9+'-'+_0x2e6815+'/'+_0x37b207)[_0xefb2('0x1d')](_0xb708b2);}return null;};}function patchUpdates(_0x2677a7){return function(_0x275e1b){try{jsonpatch[_0xefb2('0x24')](_0x275e1b,_0x2677a7,!![]);}catch(_0x22270a){return BPromise[_0xefb2('0x25')](_0x22270a);}return _0x275e1b[_0xefb2('0x26')]();};}function saveUpdates(_0x546826,_0xc21cf4){return function(_0x23ae53){if(_0x23ae53){return _0x23ae53['update'](_0x546826)['then'](function(_0x481244){return _0x481244;});}return null;};}function removeEntity(_0x2d98e0,_0x57acd4){return function(_0x3cff69){if(_0x3cff69){return _0x3cff69[_0xefb2('0x27')]()[_0xefb2('0x28')](function(){_0x2d98e0['status'](0xcc)[_0xefb2('0x1c')]();});}};}function handleEntityNotFound(_0x3f6461,_0x536c05){return function(_0x2b84de){if(!_0x2b84de){_0x3f6461[_0xefb2('0x1a')](0x194);}return _0x2b84de;};}function handleError(_0x1c2709,_0x5db0e5){_0x5db0e5=_0x5db0e5||0x1f4;return function(_0xf2d653){logger[_0xefb2('0x29')](_0xf2d653[_0xefb2('0x2a')]);if(_0xf2d653[_0xefb2('0x2b')]){delete _0xf2d653[_0xefb2('0x2b')];}_0x1c2709['status'](_0x5db0e5)['send'](_0xf2d653);};}exports[_0xefb2('0x2c')]=function(_0x56e15e,_0x2ea4c3){var _0x1f5148={},_0x4fba91={},_0x431837={'count':0x0,'rows':[]};var _0x53764a=_['map'](db[_0xefb2('0x2d')]['rawAttributes'],function(_0x36cf36){return{'name':_0x36cf36[_0xefb2('0x2e')],'type':_0x36cf36[_0xefb2('0x2f')][_0xefb2('0x30')]};});_0x4fba91['model']=_[_0xefb2('0x31')](_0x53764a,'name');_0x4fba91[_0xefb2('0x32')]=_[_0xefb2('0x33')](_0x56e15e[_0xefb2('0x32')]);_0x4fba91['filters']=_[_0xefb2('0x34')](_0x4fba91[_0xefb2('0x35')],_0x4fba91[_0xefb2('0x32')]);_0x1f5148[_0xefb2('0x36')]=_['intersection'](_0x4fba91[_0xefb2('0x35')],qs[_0xefb2('0x37')](_0x56e15e['query'][_0xefb2('0x37')]));_0x1f5148['attributes']=_0x1f5148[_0xefb2('0x36')][_0xefb2('0x38')]?_0x1f5148[_0xefb2('0x36')]:_0x4fba91[_0xefb2('0x35')];if(!_0x56e15e['query'][_0xefb2('0x39')]('nolimit')){_0x1f5148[_0xefb2('0x21')]=qs[_0xefb2('0x21')](_0x56e15e[_0xefb2('0x32')]['limit']);_0x1f5148['offset']=qs[_0xefb2('0x20')](_0x56e15e[_0xefb2('0x32')][_0xefb2('0x20')]);}_0x1f5148['order']=qs[_0xefb2('0x3a')](_0x56e15e['query'][_0xefb2('0x3a')]);_0x1f5148['where']=qs[_0xefb2('0x3b')](_[_0xefb2('0x3c')](_0x56e15e[_0xefb2('0x32')],_0x4fba91[_0xefb2('0x3b')]),_0x53764a);if(_0x56e15e['query']['filter']){_0x1f5148['where']=_[_0xefb2('0x3d')](_0x1f5148['where'],{'$or':_[_0xefb2('0x31')](_0x53764a,function(_0x5da754){if(_0x5da754[_0xefb2('0x2f')]!=='VIRTUAL'){var _0x4786dc={};_0x4786dc[_0x5da754['name']]={'$like':'%'+_0x56e15e[_0xefb2('0x32')][_0xefb2('0x3e')]+'%'};return _0x4786dc;}})});}_0x1f5148=_[_0xefb2('0x3d')]({},_0x1f5148,_0x56e15e[_0xefb2('0x3f')]);var _0x8dbe28={'where':_0x1f5148[_0xefb2('0x40')]};return db[_0xefb2('0x2d')][_0xefb2('0x1f')](_0x8dbe28)[_0xefb2('0x28')](function(_0x319529){_0x431837['count']=_0x319529;if(_0x56e15e[_0xefb2('0x32')][_0xefb2('0x41')]){_0x1f5148[_0xefb2('0x42')]=[{'all':!![]}];}return db[_0xefb2('0x2d')]['findAll'](_0x1f5148);})['then'](function(_0x4a0101){_0x431837[_0xefb2('0x43')]=_0x4a0101;return _0x431837;})['then'](respondWithFilteredResult(_0x2ea4c3,_0x1f5148))[_0xefb2('0x44')](handleError(_0x2ea4c3,null));};exports['show']=function(_0x1c6306,_0x2a6b87){var _0x5150ef={'raw':![],'where':{'id':_0x1c6306[_0xefb2('0x45')]['id']}},_0xee072d={};_0xee072d[_0xefb2('0x35')]=_[_0xefb2('0x33')](db[_0xefb2('0x2d')][_0xefb2('0x46')]);_0xee072d[_0xefb2('0x32')]=_[_0xefb2('0x33')](_0x1c6306['query']);_0xee072d['filters']=_[_0xefb2('0x34')](_0xee072d[_0xefb2('0x35')],_0xee072d['query']);_0x5150ef[_0xefb2('0x36')]=_[_0xefb2('0x34')](_0xee072d[_0xefb2('0x35')],qs[_0xefb2('0x37')](_0x1c6306[_0xefb2('0x32')][_0xefb2('0x37')]));_0x5150ef[_0xefb2('0x36')]=_0x5150ef['attributes'][_0xefb2('0x38')]?_0x5150ef['attributes']:_0xee072d['model'];if(_0x1c6306[_0xefb2('0x32')][_0xefb2('0x41')]){_0x5150ef['include']=[{'all':!![]}];}_0x5150ef=_['merge']({},_0x5150ef,_0x1c6306['options']);return db['ServicenowConfiguration'][_0xefb2('0x47')](_0x5150ef)[_0xefb2('0x28')](handleEntityNotFound(_0x2a6b87,null))['then'](respondWithResult(_0x2a6b87,null))['catch'](handleError(_0x2a6b87,null));};exports[_0xefb2('0x48')]=function(_0x455bb5,_0x119e4c){return db[_0xefb2('0x2d')][_0xefb2('0x48')](_0x455bb5[_0xefb2('0x49')],{})['then'](respondWithResult(_0x119e4c,0xc9))[_0xefb2('0x44')](handleError(_0x119e4c,null));};exports[_0xefb2('0x4a')]=function(_0x3ee88b,_0x24696d){if(_0x3ee88b[_0xefb2('0x49')]['id']){delete _0x3ee88b[_0xefb2('0x49')]['id'];}return db[_0xefb2('0x2d')][_0xefb2('0x47')]({'where':{'id':_0x3ee88b['params']['id']}})[_0xefb2('0x28')](handleEntityNotFound(_0x24696d,null))[_0xefb2('0x28')](saveUpdates(_0x3ee88b[_0xefb2('0x49')],null))[_0xefb2('0x28')](respondWithResult(_0x24696d,null))[_0xefb2('0x44')](handleError(_0x24696d,null));};exports[_0xefb2('0x27')]=function(_0x116d00,_0x59a93a){return db[_0xefb2('0x2d')]['find']({'where':{'id':_0x116d00[_0xefb2('0x45')]['id']}})[_0xefb2('0x28')](handleEntityNotFound(_0x59a93a,null))[_0xefb2('0x28')](removeEntity(_0x59a93a,null))['catch'](handleError(_0x59a93a,null));};exports[_0xefb2('0x4b')]=function(_0x58a44a,_0x523b64,_0x274be2){var _0x2e6afd={};var _0x48832b={};var _0x54c2c9;var _0x3eb91c;return db[_0xefb2('0x2d')]['findOne']({'where':{'id':_0x58a44a['params']['id']}})[_0xefb2('0x28')](handleEntityNotFound(_0x523b64,null))[_0xefb2('0x28')](function(_0x89a51f){if(_0x89a51f){_0x54c2c9=_0x89a51f;_0x48832b[_0xefb2('0x35')]=_['keys'](db[_0xefb2('0x4c')]['rawAttributes']);_0x48832b['query']=_['keys'](_0x58a44a[_0xefb2('0x32')]);_0x48832b['filters']=_[_0xefb2('0x34')](_0x48832b[_0xefb2('0x35')],_0x48832b['query']);_0x2e6afd[_0xefb2('0x36')]=_[_0xefb2('0x34')](_0x48832b[_0xefb2('0x35')],qs['fields'](_0x58a44a[_0xefb2('0x32')]['fields']));_0x2e6afd[_0xefb2('0x36')]=_0x2e6afd['attributes']['length']?_0x2e6afd['attributes']:_0x48832b['model'];_0x2e6afd[_0xefb2('0x4d')]=qs[_0xefb2('0x3a')](_0x58a44a['query'][_0xefb2('0x3a')]);_0x2e6afd[_0xefb2('0x40')]=qs[_0xefb2('0x3b')](_[_0xefb2('0x3c')](_0x58a44a[_0xefb2('0x32')],_0x48832b[_0xefb2('0x3b')]));if(_0x58a44a[_0xefb2('0x32')][_0xefb2('0x3e')]){_0x2e6afd[_0xefb2('0x40')]=_[_0xefb2('0x3d')](_0x2e6afd[_0xefb2('0x40')],{'$or':_[_0xefb2('0x31')](_0x2e6afd[_0xefb2('0x36')],function(_0x47cceb){var _0x4f459f={};_0x4f459f[_0x47cceb]={'$like':'%'+_0x58a44a[_0xefb2('0x32')]['filter']+'%'};return _0x4f459f;})});}_0x2e6afd=_['merge']({},_0x2e6afd,_0x58a44a[_0xefb2('0x3f')]);return _0x54c2c9[_0xefb2('0x4b')](_0x2e6afd);}})[_0xefb2('0x28')](function(_0x1130ef){if(_0x1130ef){_0x3eb91c=_0x1130ef[_0xefb2('0x38')];if(!_0x58a44a[_0xefb2('0x32')][_0xefb2('0x39')](_0xefb2('0x4e'))){_0x2e6afd['limit']=qs['limit'](_0x58a44a['query'][_0xefb2('0x21')]);_0x2e6afd[_0xefb2('0x20')]=qs[_0xefb2('0x20')](_0x58a44a['query']['offset']);}return _0x54c2c9['getFields'](_0x2e6afd);}})[_0xefb2('0x28')](function(_0x4da40f){if(_0x4da40f){return _0x4da40f?{'count':_0x3eb91c,'rows':_0x4da40f}:null;}})[_0xefb2('0x28')](respondWithResult(_0x523b64,null))[_0xefb2('0x44')](handleError(_0x523b64,null));};exports[_0xefb2('0x4f')]=function(_0x5b8c2b,_0x556a13,_0x10ba22){var _0x23a057={};var _0x48431b={};var _0x3a5e16;var _0x1b1f1b;return db[_0xefb2('0x2d')]['findOne']({'where':{'id':_0x5b8c2b[_0xefb2('0x45')]['id']}})[_0xefb2('0x28')](handleEntityNotFound(_0x556a13,null))['then'](function(_0x20a325){if(_0x20a325){_0x3a5e16=_0x20a325;_0x48431b[_0xefb2('0x35')]=_[_0xefb2('0x33')](db[_0xefb2('0x4c')][_0xefb2('0x46')]);_0x48431b[_0xefb2('0x32')]=_['keys'](_0x5b8c2b[_0xefb2('0x32')]);_0x48431b[_0xefb2('0x3b')]=_[_0xefb2('0x34')](_0x48431b[_0xefb2('0x35')],_0x48431b[_0xefb2('0x32')]);_0x23a057[_0xefb2('0x36')]=_[_0xefb2('0x34')](_0x48431b[_0xefb2('0x35')],qs['fields'](_0x5b8c2b['query'][_0xefb2('0x37')]));_0x23a057[_0xefb2('0x36')]=_0x23a057[_0xefb2('0x36')][_0xefb2('0x38')]?_0x23a057[_0xefb2('0x36')]:_0x48431b[_0xefb2('0x35')];_0x23a057[_0xefb2('0x4d')]=qs[_0xefb2('0x3a')](_0x5b8c2b[_0xefb2('0x32')][_0xefb2('0x3a')]);_0x23a057[_0xefb2('0x40')]=qs[_0xefb2('0x3b')](_[_0xefb2('0x3c')](_0x5b8c2b[_0xefb2('0x32')],_0x48431b['filters']));if(_0x5b8c2b['query']['filter']){_0x23a057[_0xefb2('0x40')]=_[_0xefb2('0x3d')](_0x23a057[_0xefb2('0x40')],{'$or':_[_0xefb2('0x31')](_0x23a057[_0xefb2('0x36')],function(_0x42f96e){var _0x432036={};_0x432036[_0x42f96e]={'$like':'%'+_0x5b8c2b[_0xefb2('0x32')][_0xefb2('0x3e')]+'%'};return _0x432036;})});}_0x23a057=_[_0xefb2('0x3d')]({},_0x23a057,_0x5b8c2b[_0xefb2('0x3f')]);return _0x3a5e16[_0xefb2('0x4f')](_0x23a057);}})[_0xefb2('0x28')](function(_0x4fafe1){if(_0x4fafe1){_0x1b1f1b=_0x4fafe1[_0xefb2('0x38')];if(!_0x5b8c2b[_0xefb2('0x32')][_0xefb2('0x39')](_0xefb2('0x4e'))){_0x23a057[_0xefb2('0x21')]=qs[_0xefb2('0x21')](_0x5b8c2b[_0xefb2('0x32')]['limit']);_0x23a057['offset']=qs[_0xefb2('0x20')](_0x5b8c2b[_0xefb2('0x32')][_0xefb2('0x20')]);}return _0x3a5e16[_0xefb2('0x4f')](_0x23a057);}})['then'](function(_0x474885){if(_0x474885){return _0x474885?{'count':_0x1b1f1b,'rows':_0x474885}:null;}})[_0xefb2('0x28')](respondWithResult(_0x556a13,null))[_0xefb2('0x44')](handleError(_0x556a13,null));};exports[_0xefb2('0x50')]=function(_0x158ba9,_0x5a78e2,_0x10ad9d){var _0xb8b41f={};var _0x7adee8={};var _0x7e28eb;var _0x3ce276;return db[_0xefb2('0x2d')][_0xefb2('0x51')]({'where':{'id':_0x158ba9[_0xefb2('0x45')]['id']}})[_0xefb2('0x28')](handleEntityNotFound(_0x5a78e2,null))['then'](function(_0x46857a){if(_0x46857a){_0x7e28eb=_0x46857a;_0x7adee8['model']=_[_0xefb2('0x33')](db[_0xefb2('0x4c')][_0xefb2('0x46')]);_0x7adee8['query']=_[_0xefb2('0x33')](_0x158ba9[_0xefb2('0x32')]);_0x7adee8[_0xefb2('0x3b')]=_[_0xefb2('0x34')](_0x7adee8[_0xefb2('0x35')],_0x7adee8[_0xefb2('0x32')]);_0xb8b41f[_0xefb2('0x36')]=_[_0xefb2('0x34')](_0x7adee8[_0xefb2('0x35')],qs[_0xefb2('0x37')](_0x158ba9[_0xefb2('0x32')][_0xefb2('0x37')]));_0xb8b41f[_0xefb2('0x36')]=_0xb8b41f[_0xefb2('0x36')][_0xefb2('0x38')]?_0xb8b41f[_0xefb2('0x36')]:_0x7adee8[_0xefb2('0x35')];_0xb8b41f[_0xefb2('0x4d')]=qs['sort'](_0x158ba9[_0xefb2('0x32')][_0xefb2('0x3a')]);_0xb8b41f[_0xefb2('0x40')]=qs['filters'](_[_0xefb2('0x3c')](_0x158ba9[_0xefb2('0x32')],_0x7adee8[_0xefb2('0x3b')]));if(_0x158ba9[_0xefb2('0x32')][_0xefb2('0x3e')]){_0xb8b41f[_0xefb2('0x40')]=_[_0xefb2('0x3d')](_0xb8b41f['where'],{'$or':_[_0xefb2('0x31')](_0xb8b41f[_0xefb2('0x36')],function(_0x55c9d9){var _0x58aca3={};_0x58aca3[_0x55c9d9]={'$like':'%'+_0x158ba9[_0xefb2('0x32')][_0xefb2('0x3e')]+'%'};return _0x58aca3;})});}_0xb8b41f=_['merge']({},_0xb8b41f,_0x158ba9['options']);return _0x7e28eb['getDescriptions'](_0xb8b41f);}})[_0xefb2('0x28')](function(_0x198c89){if(_0x198c89){_0x3ce276=_0x198c89[_0xefb2('0x38')];if(!_0x158ba9['query'][_0xefb2('0x39')](_0xefb2('0x4e'))){_0xb8b41f[_0xefb2('0x21')]=qs[_0xefb2('0x21')](_0x158ba9[_0xefb2('0x32')][_0xefb2('0x21')]);_0xb8b41f[_0xefb2('0x20')]=qs[_0xefb2('0x20')](_0x158ba9[_0xefb2('0x32')][_0xefb2('0x20')]);}return _0x7e28eb['getDescriptions'](_0xb8b41f);}})[_0xefb2('0x28')](function(_0x47bf93){if(_0x47bf93){return _0x47bf93?{'count':_0x3ce276,'rows':_0x47bf93}:null;}})['then'](respondWithResult(_0x5a78e2,null))['catch'](handleError(_0x5a78e2,null));}; \ No newline at end of file +var _0xa72f=['../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','stack','index','ServicenowConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','merge','map','VIRTUAL','name','filter','options','includeAll','include','catch','show','params','length','find','create','body','destroy','getFields','findOne','ServicenowField','rawAttributes','hasOwnProperty','pick','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x4c2cee,_0x5f176a){var _0x2df5a2=function(_0x33d0cb){while(--_0x33d0cb){_0x4c2cee['push'](_0x4c2cee['shift']());}};_0x2df5a2(++_0x5f176a);}(_0xa72f,0x17c));var _0xfa72=function(_0x110d59,_0x50c4fb){_0x110d59=_0x110d59-0x0;var _0x2fce64=_0xa72f[_0x110d59];return _0x2fce64;};'use strict';var emlformat=require(_0xfa72('0x0'));var rimraf=require(_0xfa72('0x1'));var zipdir=require(_0xfa72('0x2'));var jsonpatch=require(_0xfa72('0x3'));var rp=require(_0xfa72('0x4'));var moment=require(_0xfa72('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfa72('0x6'));var util=require(_0xfa72('0x7'));var path=require(_0xfa72('0x8'));var sox=require(_0xfa72('0x9'));var csv=require(_0xfa72('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa72('0xb'));var squel=require(_0xfa72('0xc'));var crypto=require(_0xfa72('0xd'));var jsforce=require(_0xfa72('0xe'));var deskjs=require(_0xfa72('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfa72('0x10'));var Papa=require(_0xfa72('0x11'));var Redis=require('ioredis');var authService=require(_0xfa72('0x12'));var qs=require(_0xfa72('0x13'));var as=require(_0xfa72('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa72('0x15'))('api');var utils=require(_0xfa72('0x16'));var config=require(_0xfa72('0x17'));var licenseUtil=require(_0xfa72('0x18'));var db=require(_0xfa72('0x19'))['db'];function respondWithStatusCode(_0x1edcbc,_0x2ad83a){_0x2ad83a=_0x2ad83a||0xcc;return function(_0x4a076b){if(_0x4a076b){return _0x1edcbc[_0xfa72('0x1a')](_0x2ad83a);}return _0x1edcbc[_0xfa72('0x1b')](_0x2ad83a)[_0xfa72('0x1c')]();};}function respondWithResult(_0x2d6683,_0x3eaf24){_0x3eaf24=_0x3eaf24||0xc8;return function(_0x5ccf61){if(_0x5ccf61){return _0x2d6683['status'](_0x3eaf24)[_0xfa72('0x1d')](_0x5ccf61);}};}function respondWithFilteredResult(_0x24524b,_0x11121b){return function(_0x4d598f){if(_0x4d598f){var _0x837540=typeof _0x11121b[_0xfa72('0x1e')]===_0xfa72('0x1f')&&typeof _0x11121b[_0xfa72('0x20')]==='undefined';var _0x55d9bf=_0x4d598f[_0xfa72('0x21')];var _0x5b9079=_0x837540?0x0:_0x11121b['offset'];var _0x5dfbc1=_0x837540?_0x4d598f[_0xfa72('0x21')]:_0x11121b['offset']+_0x11121b[_0xfa72('0x20')];var _0x1573de;if(_0x5dfbc1>=_0x55d9bf){_0x5dfbc1=_0x55d9bf;_0x1573de=0xc8;}else{_0x1573de=0xce;}_0x24524b[_0xfa72('0x1b')](_0x1573de);return _0x24524b[_0xfa72('0x22')]('Content-Range',_0x5b9079+'-'+_0x5dfbc1+'/'+_0x55d9bf)['json'](_0x4d598f);}return null;};}function patchUpdates(_0x34e5e4){return function(_0xb71747){try{jsonpatch['apply'](_0xb71747,_0x34e5e4,!![]);}catch(_0x56ed92){return BPromise[_0xfa72('0x23')](_0x56ed92);}return _0xb71747[_0xfa72('0x24')]();};}function saveUpdates(_0x7ddb0b,_0x5c9891){return function(_0x43f56c){if(_0x43f56c){return _0x43f56c[_0xfa72('0x25')](_0x7ddb0b)[_0xfa72('0x26')](function(_0x218902){return _0x218902;});}return null;};}function removeEntity(_0x1a42f5,_0x5b8e1c){return function(_0x71d37a){if(_0x71d37a){return _0x71d37a['destroy']()['then'](function(){_0x1a42f5[_0xfa72('0x1b')](0xcc)[_0xfa72('0x1c')]();});}};}function handleEntityNotFound(_0x1bd089,_0x4c12df){return function(_0x2ae90a){if(!_0x2ae90a){_0x1bd089[_0xfa72('0x1a')](0x194);}return _0x2ae90a;};}function handleError(_0x11434a,_0x3c880b){_0x3c880b=_0x3c880b||0x1f4;return function(_0x51c94c){logger['error'](_0x51c94c[_0xfa72('0x27')]);if(_0x51c94c['name']){delete _0x51c94c['name'];}_0x11434a[_0xfa72('0x1b')](_0x3c880b)['send'](_0x51c94c);};}exports[_0xfa72('0x28')]=function(_0x3e3476,_0x43c5c2){var _0x228182={},_0x1fc88e={},_0xbc4b98={'count':0x0,'rows':[]};var _0x209eb5=_['map'](db[_0xfa72('0x29')]['rawAttributes'],function(_0xe9fa3b){return{'name':_0xe9fa3b[_0xfa72('0x2a')],'type':_0xe9fa3b[_0xfa72('0x2b')][_0xfa72('0x2c')]};});_0x1fc88e[_0xfa72('0x2d')]=_['map'](_0x209eb5,'name');_0x1fc88e[_0xfa72('0x2e')]=_[_0xfa72('0x2f')](_0x3e3476['query']);_0x1fc88e[_0xfa72('0x30')]=_[_0xfa72('0x31')](_0x1fc88e[_0xfa72('0x2d')],_0x1fc88e['query']);_0x228182[_0xfa72('0x32')]=_[_0xfa72('0x31')](_0x1fc88e['model'],qs[_0xfa72('0x33')](_0x3e3476[_0xfa72('0x2e')][_0xfa72('0x33')]));_0x228182[_0xfa72('0x32')]=_0x228182[_0xfa72('0x32')]['length']?_0x228182[_0xfa72('0x32')]:_0x1fc88e[_0xfa72('0x2d')];if(!_0x3e3476[_0xfa72('0x2e')]['hasOwnProperty']('nolimit')){_0x228182[_0xfa72('0x20')]=qs[_0xfa72('0x20')](_0x3e3476[_0xfa72('0x2e')][_0xfa72('0x20')]);_0x228182[_0xfa72('0x1e')]=qs[_0xfa72('0x1e')](_0x3e3476['query'][_0xfa72('0x1e')]);}_0x228182[_0xfa72('0x34')]=qs[_0xfa72('0x35')](_0x3e3476['query'][_0xfa72('0x35')]);_0x228182[_0xfa72('0x36')]=qs[_0xfa72('0x30')](_['pick'](_0x3e3476[_0xfa72('0x2e')],_0x1fc88e[_0xfa72('0x30')]),_0x209eb5);if(_0x3e3476[_0xfa72('0x2e')]['filter']){_0x228182['where']=_[_0xfa72('0x37')](_0x228182[_0xfa72('0x36')],{'$or':_[_0xfa72('0x38')](_0x209eb5,function(_0xa8e5e9){if(_0xa8e5e9[_0xfa72('0x2b')]!==_0xfa72('0x39')){var _0x3c949b={};_0x3c949b[_0xa8e5e9[_0xfa72('0x3a')]]={'$like':'%'+_0x3e3476[_0xfa72('0x2e')][_0xfa72('0x3b')]+'%'};return _0x3c949b;}})});}_0x228182=_[_0xfa72('0x37')]({},_0x228182,_0x3e3476[_0xfa72('0x3c')]);var _0x428dfd={'where':_0x228182[_0xfa72('0x36')]};return db['ServicenowConfiguration'][_0xfa72('0x21')](_0x428dfd)[_0xfa72('0x26')](function(_0x28aca7){_0xbc4b98[_0xfa72('0x21')]=_0x28aca7;if(_0x3e3476[_0xfa72('0x2e')][_0xfa72('0x3d')]){_0x228182[_0xfa72('0x3e')]=[{'all':!![]}];}return db[_0xfa72('0x29')]['findAll'](_0x228182);})[_0xfa72('0x26')](function(_0x525989){_0xbc4b98['rows']=_0x525989;return _0xbc4b98;})[_0xfa72('0x26')](respondWithFilteredResult(_0x43c5c2,_0x228182))[_0xfa72('0x3f')](handleError(_0x43c5c2,null));};exports[_0xfa72('0x40')]=function(_0x42c978,_0x1ad4d2){var _0x2ff9fa={'raw':![],'where':{'id':_0x42c978[_0xfa72('0x41')]['id']}},_0x39ae9f={};_0x39ae9f[_0xfa72('0x2d')]=_[_0xfa72('0x2f')](db['ServicenowConfiguration']['rawAttributes']);_0x39ae9f[_0xfa72('0x2e')]=_[_0xfa72('0x2f')](_0x42c978[_0xfa72('0x2e')]);_0x39ae9f[_0xfa72('0x30')]=_[_0xfa72('0x31')](_0x39ae9f[_0xfa72('0x2d')],_0x39ae9f[_0xfa72('0x2e')]);_0x2ff9fa[_0xfa72('0x32')]=_[_0xfa72('0x31')](_0x39ae9f[_0xfa72('0x2d')],qs[_0xfa72('0x33')](_0x42c978[_0xfa72('0x2e')][_0xfa72('0x33')]));_0x2ff9fa[_0xfa72('0x32')]=_0x2ff9fa['attributes'][_0xfa72('0x42')]?_0x2ff9fa['attributes']:_0x39ae9f[_0xfa72('0x2d')];if(_0x42c978['query'][_0xfa72('0x3d')]){_0x2ff9fa[_0xfa72('0x3e')]=[{'all':!![]}];}_0x2ff9fa=_['merge']({},_0x2ff9fa,_0x42c978[_0xfa72('0x3c')]);return db[_0xfa72('0x29')][_0xfa72('0x43')](_0x2ff9fa)[_0xfa72('0x26')](handleEntityNotFound(_0x1ad4d2,null))[_0xfa72('0x26')](respondWithResult(_0x1ad4d2,null))['catch'](handleError(_0x1ad4d2,null));};exports[_0xfa72('0x44')]=function(_0x2617bb,_0x1b0fc4){return db[_0xfa72('0x29')]['create'](_0x2617bb[_0xfa72('0x45')],{})[_0xfa72('0x26')](respondWithResult(_0x1b0fc4,0xc9))[_0xfa72('0x3f')](handleError(_0x1b0fc4,null));};exports[_0xfa72('0x25')]=function(_0x18c9e4,_0x258db4){if(_0x18c9e4[_0xfa72('0x45')]['id']){delete _0x18c9e4['body']['id'];}return db[_0xfa72('0x29')]['find']({'where':{'id':_0x18c9e4['params']['id']}})['then'](handleEntityNotFound(_0x258db4,null))['then'](saveUpdates(_0x18c9e4[_0xfa72('0x45')],null))['then'](respondWithResult(_0x258db4,null))[_0xfa72('0x3f')](handleError(_0x258db4,null));};exports[_0xfa72('0x46')]=function(_0x279c2e,_0x54446d){return db['ServicenowConfiguration'][_0xfa72('0x43')]({'where':{'id':_0x279c2e['params']['id']}})[_0xfa72('0x26')](handleEntityNotFound(_0x54446d,null))[_0xfa72('0x26')](removeEntity(_0x54446d,null))[_0xfa72('0x3f')](handleError(_0x54446d,null));};exports[_0xfa72('0x47')]=function(_0x563e09,_0x48f967,_0x3585f4){var _0x9b5317={};var _0x4d676a={};var _0x4033b6;var _0x2e7e6a;return db['ServicenowConfiguration'][_0xfa72('0x48')]({'where':{'id':_0x563e09['params']['id']}})[_0xfa72('0x26')](handleEntityNotFound(_0x48f967,null))['then'](function(_0x2a4a01){if(_0x2a4a01){_0x4033b6=_0x2a4a01;_0x4d676a[_0xfa72('0x2d')]=_[_0xfa72('0x2f')](db[_0xfa72('0x49')][_0xfa72('0x4a')]);_0x4d676a[_0xfa72('0x2e')]=_[_0xfa72('0x2f')](_0x563e09[_0xfa72('0x2e')]);_0x4d676a['filters']=_[_0xfa72('0x31')](_0x4d676a['model'],_0x4d676a['query']);_0x9b5317[_0xfa72('0x32')]=_['intersection'](_0x4d676a[_0xfa72('0x2d')],qs[_0xfa72('0x33')](_0x563e09[_0xfa72('0x2e')][_0xfa72('0x33')]));_0x9b5317[_0xfa72('0x32')]=_0x9b5317['attributes'][_0xfa72('0x42')]?_0x9b5317[_0xfa72('0x32')]:_0x4d676a['model'];_0x9b5317[_0xfa72('0x34')]=qs[_0xfa72('0x35')](_0x563e09[_0xfa72('0x2e')]['sort']);_0x9b5317[_0xfa72('0x36')]=qs['filters'](_['pick'](_0x563e09[_0xfa72('0x2e')],_0x4d676a[_0xfa72('0x30')]));if(_0x563e09[_0xfa72('0x2e')][_0xfa72('0x3b')]){_0x9b5317[_0xfa72('0x36')]=_[_0xfa72('0x37')](_0x9b5317[_0xfa72('0x36')],{'$or':_[_0xfa72('0x38')](_0x9b5317['attributes'],function(_0x11abde){var _0x29b9cc={};_0x29b9cc[_0x11abde]={'$like':'%'+_0x563e09[_0xfa72('0x2e')]['filter']+'%'};return _0x29b9cc;})});}_0x9b5317=_['merge']({},_0x9b5317,_0x563e09[_0xfa72('0x3c')]);return _0x4033b6[_0xfa72('0x47')](_0x9b5317);}})[_0xfa72('0x26')](function(_0x40585b){if(_0x40585b){_0x2e7e6a=_0x40585b[_0xfa72('0x42')];if(!_0x563e09[_0xfa72('0x2e')][_0xfa72('0x4b')]('nolimit')){_0x9b5317['limit']=qs[_0xfa72('0x20')](_0x563e09['query'][_0xfa72('0x20')]);_0x9b5317[_0xfa72('0x1e')]=qs[_0xfa72('0x1e')](_0x563e09['query'][_0xfa72('0x1e')]);}return _0x4033b6[_0xfa72('0x47')](_0x9b5317);}})[_0xfa72('0x26')](function(_0x3e5aeb){if(_0x3e5aeb){return _0x3e5aeb?{'count':_0x2e7e6a,'rows':_0x3e5aeb}:null;}})[_0xfa72('0x26')](respondWithResult(_0x48f967,null))[_0xfa72('0x3f')](handleError(_0x48f967,null));};exports['getSubjects']=function(_0x3193c4,_0xdb95c0,_0xa14c1c){var _0x635a9b={};var _0x5990dd={};var _0x3839fa;var _0x590871;return db['ServicenowConfiguration'][_0xfa72('0x48')]({'where':{'id':_0x3193c4[_0xfa72('0x41')]['id']}})[_0xfa72('0x26')](handleEntityNotFound(_0xdb95c0,null))['then'](function(_0x5bfa6e){if(_0x5bfa6e){_0x3839fa=_0x5bfa6e;_0x5990dd['model']=_['keys'](db[_0xfa72('0x49')][_0xfa72('0x4a')]);_0x5990dd[_0xfa72('0x2e')]=_[_0xfa72('0x2f')](_0x3193c4[_0xfa72('0x2e')]);_0x5990dd['filters']=_['intersection'](_0x5990dd[_0xfa72('0x2d')],_0x5990dd[_0xfa72('0x2e')]);_0x635a9b[_0xfa72('0x32')]=_[_0xfa72('0x31')](_0x5990dd[_0xfa72('0x2d')],qs[_0xfa72('0x33')](_0x3193c4[_0xfa72('0x2e')][_0xfa72('0x33')]));_0x635a9b[_0xfa72('0x32')]=_0x635a9b[_0xfa72('0x32')][_0xfa72('0x42')]?_0x635a9b[_0xfa72('0x32')]:_0x5990dd[_0xfa72('0x2d')];_0x635a9b[_0xfa72('0x34')]=qs[_0xfa72('0x35')](_0x3193c4[_0xfa72('0x2e')][_0xfa72('0x35')]);_0x635a9b[_0xfa72('0x36')]=qs[_0xfa72('0x30')](_[_0xfa72('0x4c')](_0x3193c4[_0xfa72('0x2e')],_0x5990dd[_0xfa72('0x30')]));if(_0x3193c4[_0xfa72('0x2e')][_0xfa72('0x3b')]){_0x635a9b[_0xfa72('0x36')]=_['merge'](_0x635a9b[_0xfa72('0x36')],{'$or':_['map'](_0x635a9b[_0xfa72('0x32')],function(_0x26f5a7){var _0x5b14b0={};_0x5b14b0[_0x26f5a7]={'$like':'%'+_0x3193c4[_0xfa72('0x2e')][_0xfa72('0x3b')]+'%'};return _0x5b14b0;})});}_0x635a9b=_[_0xfa72('0x37')]({},_0x635a9b,_0x3193c4[_0xfa72('0x3c')]);return _0x3839fa[_0xfa72('0x4d')](_0x635a9b);}})['then'](function(_0xeb5e6f){if(_0xeb5e6f){_0x590871=_0xeb5e6f[_0xfa72('0x42')];if(!_0x3193c4['query'][_0xfa72('0x4b')](_0xfa72('0x4e'))){_0x635a9b[_0xfa72('0x20')]=qs['limit'](_0x3193c4[_0xfa72('0x2e')][_0xfa72('0x20')]);_0x635a9b['offset']=qs[_0xfa72('0x1e')](_0x3193c4[_0xfa72('0x2e')][_0xfa72('0x1e')]);}return _0x3839fa[_0xfa72('0x4d')](_0x635a9b);}})[_0xfa72('0x26')](function(_0xa45a35){if(_0xa45a35){return _0xa45a35?{'count':_0x590871,'rows':_0xa45a35}:null;}})[_0xfa72('0x26')](respondWithResult(_0xdb95c0,null))[_0xfa72('0x3f')](handleError(_0xdb95c0,null));};exports['getDescriptions']=function(_0x4f94b4,_0x360ba0,_0x433226){var _0x81212a={};var _0x330971={};var _0x24bda6;var _0x153190;return db[_0xfa72('0x29')][_0xfa72('0x48')]({'where':{'id':_0x4f94b4['params']['id']}})[_0xfa72('0x26')](handleEntityNotFound(_0x360ba0,null))['then'](function(_0x3bd3c4){if(_0x3bd3c4){_0x24bda6=_0x3bd3c4;_0x330971[_0xfa72('0x2d')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x330971[_0xfa72('0x2e')]=_[_0xfa72('0x2f')](_0x4f94b4[_0xfa72('0x2e')]);_0x330971[_0xfa72('0x30')]=_[_0xfa72('0x31')](_0x330971[_0xfa72('0x2d')],_0x330971[_0xfa72('0x2e')]);_0x81212a['attributes']=_[_0xfa72('0x31')](_0x330971[_0xfa72('0x2d')],qs['fields'](_0x4f94b4[_0xfa72('0x2e')]['fields']));_0x81212a[_0xfa72('0x32')]=_0x81212a[_0xfa72('0x32')][_0xfa72('0x42')]?_0x81212a[_0xfa72('0x32')]:_0x330971[_0xfa72('0x2d')];_0x81212a[_0xfa72('0x34')]=qs[_0xfa72('0x35')](_0x4f94b4[_0xfa72('0x2e')][_0xfa72('0x35')]);_0x81212a['where']=qs['filters'](_[_0xfa72('0x4c')](_0x4f94b4['query'],_0x330971['filters']));if(_0x4f94b4[_0xfa72('0x2e')][_0xfa72('0x3b')]){_0x81212a[_0xfa72('0x36')]=_['merge'](_0x81212a[_0xfa72('0x36')],{'$or':_[_0xfa72('0x38')](_0x81212a[_0xfa72('0x32')],function(_0x1914a0){var _0x52c7cb={};_0x52c7cb[_0x1914a0]={'$like':'%'+_0x4f94b4[_0xfa72('0x2e')][_0xfa72('0x3b')]+'%'};return _0x52c7cb;})});}_0x81212a=_['merge']({},_0x81212a,_0x4f94b4[_0xfa72('0x3c')]);return _0x24bda6[_0xfa72('0x4f')](_0x81212a);}})[_0xfa72('0x26')](function(_0x3f101a){if(_0x3f101a){_0x153190=_0x3f101a['length'];if(!_0x4f94b4[_0xfa72('0x2e')][_0xfa72('0x4b')](_0xfa72('0x4e'))){_0x81212a[_0xfa72('0x20')]=qs[_0xfa72('0x20')](_0x4f94b4[_0xfa72('0x2e')][_0xfa72('0x20')]);_0x81212a[_0xfa72('0x1e')]=qs[_0xfa72('0x1e')](_0x4f94b4['query'][_0xfa72('0x1e')]);}return _0x24bda6[_0xfa72('0x4f')](_0x81212a);}})[_0xfa72('0x26')](function(_0x349351){if(_0x349351){return _0x349351?{'count':_0x153190,'rows':_0x349351}:null;}})[_0xfa72('0x26')](respondWithResult(_0x360ba0,null))['catch'](handleError(_0x360ba0,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index cb01db7..4f7679f 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 _0x8eba=['rimraf','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','util','bluebird','request-promise','path'];(function(_0x426d50,_0x2d77c7){var _0x4e2dc5=function(_0x5682ab){while(--_0x5682ab){_0x426d50['push'](_0x426d50['shift']());}};_0x4e2dc5(++_0x2d77c7);}(_0x8eba,0xc3));var _0xa8eb=function(_0x48f7cf,_0x4baa04){_0x48f7cf=_0x48f7cf-0x0;var _0xc201c0=_0x8eba[_0x48f7cf];return _0xc201c0;};'use strict';var _=require(_0xa8eb('0x0'));var util=require(_0xa8eb('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa8eb('0x2'));var rp=require(_0xa8eb('0x3'));var fs=require('fs');var path=require(_0xa8eb('0x4'));var rimraf=require(_0xa8eb('0x5'));var config=require('../../config/environment');var attributes=require(_0xa8eb('0x6'));module[_0xa8eb('0x7')]=function(_0x5abab9,_0x321f2f){return _0x5abab9['define'](_0xa8eb('0x8'),attributes,{'tableName':_0xa8eb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fc9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','util'];(function(_0x2af9f7,_0xeb7b9c){var _0x52a86e=function(_0x18e981){while(--_0x18e981){_0x2af9f7['push'](_0x2af9f7['shift']());}};_0x52a86e(++_0xeb7b9c);}(_0x2fc9,0xc2));var _0x92fc=function(_0x2a7b50,_0x545d55){_0x2a7b50=_0x2a7b50-0x0;var _0x4224c9=_0x2fc9[_0x2a7b50];return _0x4224c9;};'use strict';var _=require('lodash');var util=require(_0x92fc('0x0'));var logger=require(_0x92fc('0x1'))(_0x92fc('0x2'));var moment=require(_0x92fc('0x3'));var BPromise=require(_0x92fc('0x4'));var rp=require(_0x92fc('0x5'));var fs=require('fs');var path=require(_0x92fc('0x6'));var rimraf=require(_0x92fc('0x7'));var config=require(_0x92fc('0x8'));var attributes=require(_0x92fc('0x9'));module[_0x92fc('0xa')]=function(_0x5d492e,_0x580d4a){return _0x5d492e['define'](_0x92fc('0xb'),attributes,{'tableName':_0x92fc('0xc'),'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 ad67e6f..fd6ad24 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 _0x36f3=['code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x329743,_0x109d58){var _0x5d9642=function(_0x4f187d){while(--_0x4f187d){_0x329743['push'](_0x329743['shift']());}};_0x5d9642(++_0x109d58);}(_0x36f3,0xe6));var _0x336f=function(_0x18b275,_0x256a3f){_0x18b275=_0x18b275-0x0;var _0xfb0782=_0x36f3[_0x18b275];return _0xfb0782;};'use strict';var _=require('lodash');var util=require(_0x336f('0x0'));var moment=require(_0x336f('0x1'));var BPromise=require(_0x336f('0x2'));var rs=require(_0x336f('0x3'));var fs=require('fs');var Redis=require(_0x336f('0x4'));var db=require(_0x336f('0x5'))['db'];var utils=require(_0x336f('0x6'));var logger=require(_0x336f('0x7'))(_0x336f('0x8'));var config=require('../../config/environment');var jayson=require(_0x336f('0x9'));var client=jayson[_0x336f('0xa')][_0x336f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ef72f,_0x56100c,_0x3963d1){return new BPromise(function(_0x3aab62,_0x3218df){return client[_0x336f('0xc')](_0x4ef72f,_0x3963d1)[_0x336f('0xd')](function(_0x176178){logger[_0x336f('0xe')](_0x336f('0xf'),_0x56100c,'request\x20sent');logger[_0x336f('0x10')](_0x336f('0x11'),_0x56100c,_0x336f('0x12'),JSON[_0x336f('0x13')](_0x176178));if(_0x176178['error']){if(_0x176178['error'][_0x336f('0x14')]===0x1f4){logger['error'](_0x336f('0xf'),_0x56100c,_0x176178[_0x336f('0x15')]['message']);return _0x3218df(_0x176178[_0x336f('0x15')][_0x336f('0x16')]);}logger[_0x336f('0x15')](_0x336f('0xf'),_0x56100c,_0x176178[_0x336f('0x15')][_0x336f('0x16')]);return _0x3aab62(_0x176178[_0x336f('0x15')]['message']);}else{logger[_0x336f('0xe')](_0x336f('0xf'),_0x56100c,_0x336f('0x12'));_0x3aab62(_0x176178[_0x336f('0x17')]['message']);}})[_0x336f('0x18')](function(_0x67953f){logger[_0x336f('0x15')](_0x336f('0xf'),_0x56100c,_0x67953f);_0x3218df(_0x67953f);});});} \ No newline at end of file +var _0xe740=['request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','ServicenowConfiguration,\x20%s,\x20%s','result','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info'];(function(_0x2c7906,_0x2e5922){var _0xb5e17a=function(_0x2a2249){while(--_0x2a2249){_0x2c7906['push'](_0x2c7906['shift']());}};_0xb5e17a(++_0x2e5922);}(_0xe740,0x14b));var _0x0e74=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0xe740[_0x1e3671];return _0x48d5f5;};'use strict';var _=require(_0x0e74('0x0'));var util=require('util');var moment=require(_0x0e74('0x1'));var BPromise=require(_0x0e74('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e74('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e74('0x4'));var logger=require('../../config/logger')(_0x0e74('0x5'));var config=require(_0x0e74('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0e74('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dfb73,_0x389072,_0xc4ae9f){return new BPromise(function(_0x1a9dc5,_0x5e0269){return client[_0x0e74('0x8')](_0x2dfb73,_0xc4ae9f)[_0x0e74('0x9')](function(_0x98da78){logger[_0x0e74('0xa')]('ServicenowConfiguration,\x20%s,\x20%s',_0x389072,_0x0e74('0xb'));logger['debug'](_0x0e74('0xc'),_0x389072,'request\x20sent',JSON['stringify'](_0x98da78));if(_0x98da78[_0x0e74('0xd')]){if(_0x98da78[_0x0e74('0xd')][_0x0e74('0xe')]===0x1f4){logger[_0x0e74('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x389072,_0x98da78[_0x0e74('0xd')]['message']);return _0x5e0269(_0x98da78[_0x0e74('0xd')][_0x0e74('0xf')]);}logger[_0x0e74('0xd')](_0x0e74('0x10'),_0x389072,_0x98da78[_0x0e74('0xd')][_0x0e74('0xf')]);return _0x1a9dc5(_0x98da78[_0x0e74('0xd')][_0x0e74('0xf')]);}else{logger[_0x0e74('0xa')](_0x0e74('0x10'),_0x389072,_0x0e74('0xb'));_0x1a9dc5(_0x98da78[_0x0e74('0x11')][_0x0e74('0xf')]);}})['catch'](function(_0x5a754e){logger[_0x0e74('0xd')](_0x0e74('0x10'),_0x389072,_0x5a754e);_0x5e0269(_0x5a754e);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 33c7b52..e3c756e 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 _0xe2ce=['../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3cc8d4,_0x3e53df){var _0x268582=function(_0x8c958f){while(--_0x8c958f){_0x3cc8d4['push'](_0x3cc8d4['shift']());}};_0x268582(++_0x3e53df);}(_0xe2ce,0x118));var _0xee2c=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0xe2ce[_0x245afe];return _0x4eefde;};'use strict';var multer=require(_0xee2c('0x0'));var util=require(_0xee2c('0x1'));var path=require(_0xee2c('0x2'));var timeout=require(_0xee2c('0x3'));var express=require(_0xee2c('0x4'));var router=express[_0xee2c('0x5')]();var fs_extra=require(_0xee2c('0x6'));var auth=require(_0xee2c('0x7'));var interaction=require(_0xee2c('0x8'));var config=require('../../config/environment');var controller=require(_0xee2c('0x9'));router[_0xee2c('0xa')]('/',auth[_0xee2c('0xb')](),controller[_0xee2c('0xc')]);router['get']('/:id',auth[_0xee2c('0xb')](),controller['show']);router['post']('/',auth[_0xee2c('0xb')](),controller[_0xee2c('0xd')]);router['put'](_0xee2c('0xe'),auth[_0xee2c('0xb')](),controller['update']);router[_0xee2c('0xf')](_0xee2c('0xe'),auth[_0xee2c('0xb')](),controller[_0xee2c('0x10')]);module[_0xee2c('0x11')]=router; \ No newline at end of file +var _0xead2=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x56b613,_0x4b6720){var _0x456efd=function(_0xa2da71){while(--_0xa2da71){_0x56b613['push'](_0x56b613['shift']());}};_0x456efd(++_0x4b6720);}(_0xead2,0x1f1));var _0x2ead=function(_0x1306f6,_0x4b2b81){_0x1306f6=_0x1306f6-0x0;var _0x3e4790=_0xead2[_0x1306f6];return _0x3e4790;};'use strict';var multer=require(_0x2ead('0x0'));var util=require(_0x2ead('0x1'));var path=require(_0x2ead('0x2'));var timeout=require(_0x2ead('0x3'));var express=require(_0x2ead('0x4'));var router=express[_0x2ead('0x5')]();var fs_extra=require(_0x2ead('0x6'));var auth=require(_0x2ead('0x7'));var interaction=require(_0x2ead('0x8'));var config=require('../../config/environment');var controller=require(_0x2ead('0x9'));router[_0x2ead('0xa')]('/',auth[_0x2ead('0xb')](),controller[_0x2ead('0xc')]);router[_0x2ead('0xa')](_0x2ead('0xd'),auth[_0x2ead('0xb')](),controller['show']);router[_0x2ead('0xe')]('/',auth[_0x2ead('0xb')](),controller[_0x2ead('0xf')]);router['put'](_0x2ead('0xd'),auth[_0x2ead('0xb')](),controller[_0x2ead('0x10')]);router[_0x2ead('0x11')]('/:id',auth[_0x2ead('0xb')](),controller[_0x2ead('0x12')]);module[_0x2ead('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 1f2f6de..7bc5172 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 _0x722b=['string','variable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports'];(function(_0x52cba1,_0x79222c){var _0x302e41=function(_0x43d492){while(--_0x43d492){_0x52cba1['push'](_0x52cba1['shift']());}};_0x302e41(++_0x79222c);}(_0x722b,0xf1));var _0xb722=function(_0x232ddf,_0x26d183){_0x232ddf=_0x232ddf-0x0;var _0x503d25=_0x722b[_0x232ddf];return _0x503d25;};'use strict';var Sequelize=require(_0xb722('0x0'));module[_0xb722('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb722('0x2'),_0xb722('0x3'),'customVariable',_0xb722('0x4'),_0xb722('0x5')),'defaultValue':_0xb722('0x2')},'content':{'type':Sequelize[_0xb722('0x6')]},'key':{'type':Sequelize[_0xb722('0x6')]},'keyType':{'type':Sequelize[_0xb722('0x7')](_0xb722('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb722('0x6')]},'nameField':{'type':Sequelize[_0xb722('0x6')]},'customField':{'type':Sequelize[_0xb722('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb722('0x6')]}}; \ No newline at end of file +var _0x0415=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x56a4b5,_0x119ba1){var _0x3cb937=function(_0x2f4054){while(--_0x2f4054){_0x56a4b5['push'](_0x56a4b5['shift']());}};_0x3cb937(++_0x119ba1);}(_0x0415,0x1b7));var _0x5041=function(_0x332163,_0x1789e0){_0x332163=_0x332163-0x0;var _0x3de6a9=_0x0415[_0x332163];return _0x3de6a9;};'use strict';var Sequelize=require(_0x5041('0x0'));module[_0x5041('0x1')]={'type':{'type':Sequelize[_0x5041('0x2')](_0x5041('0x3'),_0x5041('0x4'),_0x5041('0x5'),_0x5041('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x5041('0x7')]},'key':{'type':Sequelize[_0x5041('0x7')]},'keyType':{'type':Sequelize[_0x5041('0x2')](_0x5041('0x3'),_0x5041('0x4'),_0x5041('0x5'))},'keyContent':{'type':Sequelize[_0x5041('0x7')]},'idField':{'type':Sequelize[_0x5041('0x7')]},'nameField':{'type':Sequelize[_0x5041('0x7')]},'customField':{'type':Sequelize[_0x5041('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5041('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index a83a7c7..394acd8 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 _0xfe67=['map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','ServicenowField','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfe67,0x1e3));var _0x7fe6=function(_0x55a5c5,_0x421935){_0x55a5c5=_0x55a5c5-0x0;var _0x55f93a=_0xfe67[_0x55a5c5];return _0x55f93a;};'use strict';var emlformat=require(_0x7fe6('0x0'));var rimraf=require(_0x7fe6('0x1'));var zipdir=require(_0x7fe6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7fe6('0x3'));var moment=require(_0x7fe6('0x4'));var BPromise=require(_0x7fe6('0x5'));var Mustache=require(_0x7fe6('0x6'));var util=require(_0x7fe6('0x7'));var path=require(_0x7fe6('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7fe6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7fe6('0xa'));var squel=require('squel');var crypto=require(_0x7fe6('0xb'));var jsforce=require(_0x7fe6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7fe6('0xd'));var querystring=require(_0x7fe6('0xe'));var Papa=require('papaparse');var Redis=require(_0x7fe6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7fe6('0x10'));var as=require(_0x7fe6('0x11'));var hardwareService=require(_0x7fe6('0x12'));var logger=require(_0x7fe6('0x13'))(_0x7fe6('0x14'));var utils=require(_0x7fe6('0x15'));var config=require(_0x7fe6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7fe6('0x17'))['db'];function respondWithStatusCode(_0x1caa56,_0x5b33f4){_0x5b33f4=_0x5b33f4||0xcc;return function(_0x385f04){if(_0x385f04){return _0x1caa56[_0x7fe6('0x18')](_0x5b33f4);}return _0x1caa56[_0x7fe6('0x19')](_0x5b33f4)[_0x7fe6('0x1a')]();};}function respondWithResult(_0x174244,_0x584815){_0x584815=_0x584815||0xc8;return function(_0x52da05){if(_0x52da05){return _0x174244['status'](_0x584815)[_0x7fe6('0x1b')](_0x52da05);}};}function respondWithFilteredResult(_0x472fb2,_0x430c4c){return function(_0x33d783){if(_0x33d783){var _0x56fa0e=typeof _0x430c4c[_0x7fe6('0x1c')]===_0x7fe6('0x1d')&&typeof _0x430c4c['limit']===_0x7fe6('0x1d');var _0x414a51=_0x33d783['count'];var _0x3cf5b0=_0x56fa0e?0x0:_0x430c4c[_0x7fe6('0x1c')];var _0x29c12a=_0x56fa0e?_0x33d783[_0x7fe6('0x1e')]:_0x430c4c['offset']+_0x430c4c[_0x7fe6('0x1f')];var _0x46c5dc;if(_0x29c12a>=_0x414a51){_0x29c12a=_0x414a51;_0x46c5dc=0xc8;}else{_0x46c5dc=0xce;}_0x472fb2[_0x7fe6('0x19')](_0x46c5dc);return _0x472fb2[_0x7fe6('0x20')](_0x7fe6('0x21'),_0x3cf5b0+'-'+_0x29c12a+'/'+_0x414a51)[_0x7fe6('0x1b')](_0x33d783);}return null;};}function patchUpdates(_0x408cf5){return function(_0x314f1e){try{jsonpatch[_0x7fe6('0x22')](_0x314f1e,_0x408cf5,!![]);}catch(_0x4ba29b){return BPromise['reject'](_0x4ba29b);}return _0x314f1e[_0x7fe6('0x23')]();};}function saveUpdates(_0x3dc23d,_0x42685c){return function(_0x2b534f){if(_0x2b534f){return _0x2b534f[_0x7fe6('0x24')](_0x3dc23d)[_0x7fe6('0x25')](function(_0x1f74aa){return _0x1f74aa;});}return null;};}function removeEntity(_0x55a6bb,_0x23e014){return function(_0x5adba3){if(_0x5adba3){return _0x5adba3[_0x7fe6('0x26')]()[_0x7fe6('0x25')](function(){_0x55a6bb[_0x7fe6('0x19')](0xcc)[_0x7fe6('0x1a')]();});}};}function handleEntityNotFound(_0x533984,_0x143420){return function(_0x2479c5){if(!_0x2479c5){_0x533984[_0x7fe6('0x18')](0x194);}return _0x2479c5;};}function handleError(_0x2812cc,_0x29642a){_0x29642a=_0x29642a||0x1f4;return function(_0x29a524){logger[_0x7fe6('0x27')](_0x29a524[_0x7fe6('0x28')]);if(_0x29a524[_0x7fe6('0x29')]){delete _0x29a524['name'];}_0x2812cc['status'](_0x29642a)['send'](_0x29a524);};}exports['index']=function(_0x5a854b,_0x454e16){var _0x371f8d={},_0x1b9529={},_0x5113d6={'count':0x0,'rows':[]};var _0x1c2c63=_[_0x7fe6('0x2a')](db['ServicenowField'][_0x7fe6('0x2b')],function(_0x42de2e){return{'name':_0x42de2e[_0x7fe6('0x2c')],'type':_0x42de2e[_0x7fe6('0x2d')][_0x7fe6('0x2e')]};});_0x1b9529['model']=_[_0x7fe6('0x2a')](_0x1c2c63,'name');_0x1b9529[_0x7fe6('0x2f')]=_[_0x7fe6('0x30')](_0x5a854b['query']);_0x1b9529['filters']=_[_0x7fe6('0x31')](_0x1b9529[_0x7fe6('0x32')],_0x1b9529[_0x7fe6('0x2f')]);_0x371f8d[_0x7fe6('0x33')]=_['intersection'](_0x1b9529[_0x7fe6('0x32')],qs[_0x7fe6('0x34')](_0x5a854b[_0x7fe6('0x2f')]['fields']));_0x371f8d['attributes']=_0x371f8d[_0x7fe6('0x33')]['length']?_0x371f8d[_0x7fe6('0x33')]:_0x1b9529['model'];if(!_0x5a854b[_0x7fe6('0x2f')]['hasOwnProperty'](_0x7fe6('0x35'))){_0x371f8d[_0x7fe6('0x1f')]=qs['limit'](_0x5a854b[_0x7fe6('0x2f')][_0x7fe6('0x1f')]);_0x371f8d[_0x7fe6('0x1c')]=qs['offset'](_0x5a854b[_0x7fe6('0x2f')][_0x7fe6('0x1c')]);}_0x371f8d[_0x7fe6('0x36')]=qs['sort'](_0x5a854b['query'][_0x7fe6('0x37')]);_0x371f8d[_0x7fe6('0x38')]=qs[_0x7fe6('0x39')](_[_0x7fe6('0x3a')](_0x5a854b['query'],_0x1b9529[_0x7fe6('0x39')]),_0x1c2c63);if(_0x5a854b['query']['filter']){_0x371f8d[_0x7fe6('0x38')]=_[_0x7fe6('0x3b')](_0x371f8d[_0x7fe6('0x38')],{'$or':_[_0x7fe6('0x2a')](_0x1c2c63,function(_0x5550f0){if(_0x5550f0['type']!==_0x7fe6('0x3c')){var _0x28daf3={};_0x28daf3[_0x5550f0[_0x7fe6('0x29')]]={'$like':'%'+_0x5a854b[_0x7fe6('0x2f')][_0x7fe6('0x3d')]+'%'};return _0x28daf3;}})});}_0x371f8d=_[_0x7fe6('0x3b')]({},_0x371f8d,_0x5a854b[_0x7fe6('0x3e')]);var _0x596a10={'where':_0x371f8d[_0x7fe6('0x38')]};return db['ServicenowField'][_0x7fe6('0x1e')](_0x596a10)[_0x7fe6('0x25')](function(_0x5e779f){_0x5113d6[_0x7fe6('0x1e')]=_0x5e779f;if(_0x5a854b[_0x7fe6('0x2f')][_0x7fe6('0x3f')]){_0x371f8d[_0x7fe6('0x40')]=[{'all':!![]}];}return db[_0x7fe6('0x41')][_0x7fe6('0x42')](_0x371f8d);})[_0x7fe6('0x25')](function(_0x33fb52){_0x5113d6[_0x7fe6('0x43')]=_0x33fb52;return _0x5113d6;})['then'](respondWithFilteredResult(_0x454e16,_0x371f8d))[_0x7fe6('0x44')](handleError(_0x454e16,null));};exports[_0x7fe6('0x45')]=function(_0x10a6cf,_0x551c3b){var _0x49edb7={'raw':!![],'where':{'id':_0x10a6cf[_0x7fe6('0x46')]['id']}},_0x2dfd57={};_0x2dfd57[_0x7fe6('0x32')]=_['keys'](db[_0x7fe6('0x41')][_0x7fe6('0x2b')]);_0x2dfd57['query']=_[_0x7fe6('0x30')](_0x10a6cf[_0x7fe6('0x2f')]);_0x2dfd57[_0x7fe6('0x39')]=_[_0x7fe6('0x31')](_0x2dfd57[_0x7fe6('0x32')],_0x2dfd57['query']);_0x49edb7[_0x7fe6('0x33')]=_[_0x7fe6('0x31')](_0x2dfd57[_0x7fe6('0x32')],qs[_0x7fe6('0x34')](_0x10a6cf['query'][_0x7fe6('0x34')]));_0x49edb7['attributes']=_0x49edb7[_0x7fe6('0x33')][_0x7fe6('0x47')]?_0x49edb7[_0x7fe6('0x33')]:_0x2dfd57[_0x7fe6('0x32')];if(_0x10a6cf[_0x7fe6('0x2f')][_0x7fe6('0x3f')]){_0x49edb7[_0x7fe6('0x40')]=[{'all':!![]}];}_0x49edb7=_[_0x7fe6('0x3b')]({},_0x49edb7,_0x10a6cf[_0x7fe6('0x3e')]);return db[_0x7fe6('0x41')][_0x7fe6('0x48')](_0x49edb7)['then'](handleEntityNotFound(_0x551c3b,null))[_0x7fe6('0x25')](respondWithResult(_0x551c3b,null))[_0x7fe6('0x44')](handleError(_0x551c3b,null));};exports[_0x7fe6('0x49')]=function(_0xff0cb9,_0x2cd7c9){return db[_0x7fe6('0x41')]['create'](_0xff0cb9[_0x7fe6('0x4a')],{})[_0x7fe6('0x25')](respondWithResult(_0x2cd7c9,0xc9))[_0x7fe6('0x44')](handleError(_0x2cd7c9,null));};exports['update']=function(_0x56426d,_0x43de3e){if(_0x56426d[_0x7fe6('0x4a')]['id']){delete _0x56426d['body']['id'];}return db['ServicenowField'][_0x7fe6('0x48')]({'where':{'id':_0x56426d[_0x7fe6('0x46')]['id']}})[_0x7fe6('0x25')](handleEntityNotFound(_0x43de3e,null))[_0x7fe6('0x25')](saveUpdates(_0x56426d[_0x7fe6('0x4a')],null))['then'](respondWithResult(_0x43de3e,null))[_0x7fe6('0x44')](handleError(_0x43de3e,null));};exports[_0x7fe6('0x26')]=function(_0x947985,_0x27316b){return db[_0x7fe6('0x41')][_0x7fe6('0x48')]({'where':{'id':_0x947985[_0x7fe6('0x46')]['id']}})[_0x7fe6('0x25')](handleEntityNotFound(_0x27316b,null))[_0x7fe6('0x25')](removeEntity(_0x27316b,null))[_0x7fe6('0x44')](handleError(_0x27316b,null));}; \ No newline at end of file +var _0x89ba=['index','ServicenowField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','length','options','find','create','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','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/environment','../../config/license/util','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send'];(function(_0x288a8f,_0x10ccdb){var _0x51ddd4=function(_0x1032fd){while(--_0x1032fd){_0x288a8f['push'](_0x288a8f['shift']());}};_0x51ddd4(++_0x10ccdb);}(_0x89ba,0xb0));var _0xa89b=function(_0x2f2388,_0x4ea55c){_0x2f2388=_0x2f2388-0x0;var _0x451e17=_0x89ba[_0x2f2388];return _0x451e17;};'use strict';var emlformat=require(_0xa89b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa89b('0x1'));var jsonpatch=require(_0xa89b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa89b('0x3'));var Mustache=require(_0xa89b('0x4'));var util=require('util');var path=require(_0xa89b('0x5'));var sox=require('sox');var csv=require(_0xa89b('0x6'));var ejs=require(_0xa89b('0x7'));var fs=require('fs');var fs_extra=require(_0xa89b('0x8'));var _=require(_0xa89b('0x9'));var squel=require(_0xa89b('0xa'));var crypto=require(_0xa89b('0xb'));var jsforce=require(_0xa89b('0xc'));var deskjs=require(_0xa89b('0xd'));var toCsv=require(_0xa89b('0x6'));var querystring=require('querystring');var Papa=require(_0xa89b('0xe'));var Redis=require('ioredis');var authService=require(_0xa89b('0xf'));var qs=require(_0xa89b('0x10'));var as=require(_0xa89b('0x11'));var hardwareService=require(_0xa89b('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa89b('0x13'));var licenseUtil=require(_0xa89b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48a6fc,_0x3cd238){_0x3cd238=_0x3cd238||0xcc;return function(_0x50a562){if(_0x50a562){return _0x48a6fc['sendStatus'](_0x3cd238);}return _0x48a6fc['status'](_0x3cd238)[_0xa89b('0x15')]();};}function respondWithResult(_0x2c73dd,_0x6166d4){_0x6166d4=_0x6166d4||0xc8;return function(_0x5dda90){if(_0x5dda90){return _0x2c73dd[_0xa89b('0x16')](_0x6166d4)['json'](_0x5dda90);}};}function respondWithFilteredResult(_0x4d253f,_0x2724d4){return function(_0x4afd35){if(_0x4afd35){var _0x537517=typeof _0x2724d4[_0xa89b('0x17')]===_0xa89b('0x18')&&typeof _0x2724d4[_0xa89b('0x19')]===_0xa89b('0x18');var _0x4b3e29=_0x4afd35['count'];var _0x5896fb=_0x537517?0x0:_0x2724d4[_0xa89b('0x17')];var _0x38b1d7=_0x537517?_0x4afd35[_0xa89b('0x1a')]:_0x2724d4['offset']+_0x2724d4[_0xa89b('0x19')];var _0x23f49c;if(_0x38b1d7>=_0x4b3e29){_0x38b1d7=_0x4b3e29;_0x23f49c=0xc8;}else{_0x23f49c=0xce;}_0x4d253f[_0xa89b('0x16')](_0x23f49c);return _0x4d253f['set'](_0xa89b('0x1b'),_0x5896fb+'-'+_0x38b1d7+'/'+_0x4b3e29)[_0xa89b('0x1c')](_0x4afd35);}return null;};}function patchUpdates(_0x1bea08){return function(_0x4d7f73){try{jsonpatch[_0xa89b('0x1d')](_0x4d7f73,_0x1bea08,!![]);}catch(_0x3f817b){return BPromise[_0xa89b('0x1e')](_0x3f817b);}return _0x4d7f73[_0xa89b('0x1f')]();};}function saveUpdates(_0x3d309a,_0x46bbf2){return function(_0x232ae7){if(_0x232ae7){return _0x232ae7[_0xa89b('0x20')](_0x3d309a)[_0xa89b('0x21')](function(_0x4e8964){return _0x4e8964;});}return null;};}function removeEntity(_0x129188,_0x163216){return function(_0x443c12){if(_0x443c12){return _0x443c12[_0xa89b('0x22')]()['then'](function(){_0x129188[_0xa89b('0x16')](0xcc)[_0xa89b('0x15')]();});}};}function handleEntityNotFound(_0x2047cb,_0x49837a){return function(_0xa63585){if(!_0xa63585){_0x2047cb[_0xa89b('0x23')](0x194);}return _0xa63585;};}function handleError(_0x182ecf,_0x347bbc){_0x347bbc=_0x347bbc||0x1f4;return function(_0x32e145){logger[_0xa89b('0x24')](_0x32e145[_0xa89b('0x25')]);if(_0x32e145[_0xa89b('0x26')]){delete _0x32e145['name'];}_0x182ecf[_0xa89b('0x16')](_0x347bbc)[_0xa89b('0x27')](_0x32e145);};}exports[_0xa89b('0x28')]=function(_0x3a7486,_0x282c42){var _0x2e87e2={},_0xd78fed={},_0xcf1086={'count':0x0,'rows':[]};var _0x4a1624=_['map'](db[_0xa89b('0x29')][_0xa89b('0x2a')],function(_0x15387c){return{'name':_0x15387c[_0xa89b('0x2b')],'type':_0x15387c[_0xa89b('0x2c')][_0xa89b('0x2d')]};});_0xd78fed['model']=_[_0xa89b('0x2e')](_0x4a1624,'name');_0xd78fed[_0xa89b('0x2f')]=_[_0xa89b('0x30')](_0x3a7486['query']);_0xd78fed[_0xa89b('0x31')]=_[_0xa89b('0x32')](_0xd78fed['model'],_0xd78fed[_0xa89b('0x2f')]);_0x2e87e2[_0xa89b('0x33')]=_[_0xa89b('0x32')](_0xd78fed[_0xa89b('0x34')],qs[_0xa89b('0x35')](_0x3a7486[_0xa89b('0x2f')]['fields']));_0x2e87e2[_0xa89b('0x33')]=_0x2e87e2[_0xa89b('0x33')]['length']?_0x2e87e2[_0xa89b('0x33')]:_0xd78fed['model'];if(!_0x3a7486['query'][_0xa89b('0x36')]('nolimit')){_0x2e87e2[_0xa89b('0x19')]=qs['limit'](_0x3a7486[_0xa89b('0x2f')]['limit']);_0x2e87e2[_0xa89b('0x17')]=qs[_0xa89b('0x17')](_0x3a7486[_0xa89b('0x2f')][_0xa89b('0x17')]);}_0x2e87e2[_0xa89b('0x37')]=qs['sort'](_0x3a7486[_0xa89b('0x2f')][_0xa89b('0x38')]);_0x2e87e2[_0xa89b('0x39')]=qs[_0xa89b('0x31')](_[_0xa89b('0x3a')](_0x3a7486[_0xa89b('0x2f')],_0xd78fed[_0xa89b('0x31')]),_0x4a1624);if(_0x3a7486['query'][_0xa89b('0x3b')]){_0x2e87e2['where']=_[_0xa89b('0x3c')](_0x2e87e2['where'],{'$or':_[_0xa89b('0x2e')](_0x4a1624,function(_0x2d255f){if(_0x2d255f[_0xa89b('0x2c')]!=='VIRTUAL'){var _0x22e323={};_0x22e323[_0x2d255f[_0xa89b('0x26')]]={'$like':'%'+_0x3a7486['query'][_0xa89b('0x3b')]+'%'};return _0x22e323;}})});}_0x2e87e2=_[_0xa89b('0x3c')]({},_0x2e87e2,_0x3a7486['options']);var _0x2bf2b2={'where':_0x2e87e2[_0xa89b('0x39')]};return db['ServicenowField'][_0xa89b('0x1a')](_0x2bf2b2)[_0xa89b('0x21')](function(_0x5e6365){_0xcf1086[_0xa89b('0x1a')]=_0x5e6365;if(_0x3a7486[_0xa89b('0x2f')]['includeAll']){_0x2e87e2[_0xa89b('0x3d')]=[{'all':!![]}];}return db[_0xa89b('0x29')][_0xa89b('0x3e')](_0x2e87e2);})[_0xa89b('0x21')](function(_0x4871b9){_0xcf1086[_0xa89b('0x3f')]=_0x4871b9;return _0xcf1086;})[_0xa89b('0x21')](respondWithFilteredResult(_0x282c42,_0x2e87e2))[_0xa89b('0x40')](handleError(_0x282c42,null));};exports[_0xa89b('0x41')]=function(_0x44ea0a,_0x53bbba){var _0x33b155={'raw':!![],'where':{'id':_0x44ea0a[_0xa89b('0x42')]['id']}},_0x36d2fd={};_0x36d2fd[_0xa89b('0x34')]=_[_0xa89b('0x30')](db[_0xa89b('0x29')][_0xa89b('0x2a')]);_0x36d2fd['query']=_[_0xa89b('0x30')](_0x44ea0a[_0xa89b('0x2f')]);_0x36d2fd[_0xa89b('0x31')]=_[_0xa89b('0x32')](_0x36d2fd['model'],_0x36d2fd[_0xa89b('0x2f')]);_0x33b155[_0xa89b('0x33')]=_[_0xa89b('0x32')](_0x36d2fd[_0xa89b('0x34')],qs['fields'](_0x44ea0a[_0xa89b('0x2f')][_0xa89b('0x35')]));_0x33b155[_0xa89b('0x33')]=_0x33b155[_0xa89b('0x33')][_0xa89b('0x43')]?_0x33b155[_0xa89b('0x33')]:_0x36d2fd[_0xa89b('0x34')];if(_0x44ea0a[_0xa89b('0x2f')]['includeAll']){_0x33b155[_0xa89b('0x3d')]=[{'all':!![]}];}_0x33b155=_[_0xa89b('0x3c')]({},_0x33b155,_0x44ea0a[_0xa89b('0x44')]);return db[_0xa89b('0x29')][_0xa89b('0x45')](_0x33b155)[_0xa89b('0x21')](handleEntityNotFound(_0x53bbba,null))[_0xa89b('0x21')](respondWithResult(_0x53bbba,null))[_0xa89b('0x40')](handleError(_0x53bbba,null));};exports[_0xa89b('0x46')]=function(_0x272c13,_0x477549){return db[_0xa89b('0x29')][_0xa89b('0x46')](_0x272c13[_0xa89b('0x47')],{})[_0xa89b('0x21')](respondWithResult(_0x477549,0xc9))[_0xa89b('0x40')](handleError(_0x477549,null));};exports[_0xa89b('0x20')]=function(_0x2e7476,_0x41b57d){if(_0x2e7476[_0xa89b('0x47')]['id']){delete _0x2e7476[_0xa89b('0x47')]['id'];}return db[_0xa89b('0x29')][_0xa89b('0x45')]({'where':{'id':_0x2e7476['params']['id']}})[_0xa89b('0x21')](handleEntityNotFound(_0x41b57d,null))[_0xa89b('0x21')](saveUpdates(_0x2e7476[_0xa89b('0x47')],null))[_0xa89b('0x21')](respondWithResult(_0x41b57d,null))[_0xa89b('0x40')](handleError(_0x41b57d,null));};exports[_0xa89b('0x22')]=function(_0x50fd48,_0x5d2470){return db[_0xa89b('0x29')]['find']({'where':{'id':_0x50fd48[_0xa89b('0x42')]['id']}})[_0xa89b('0x21')](handleEntityNotFound(_0x5d2470,null))[_0xa89b('0x21')](removeEntity(_0x5d2470,null))[_0xa89b('0x40')](handleError(_0x5d2470,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 5ffba75..942b634 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 _0x67bc=['define','servicenow_unique_index','FieldId','lodash','moment','bluebird','request-promise','rimraf','./intServicenowField.attributes'];(function(_0x57d765,_0x199f46){var _0x113a93=function(_0xbd3862){while(--_0xbd3862){_0x57d765['push'](_0x57d765['shift']());}};_0x113a93(++_0x199f46);}(_0x67bc,0x1d7));var _0xc67b=function(_0x3ae2b2,_0x2d936f){_0x3ae2b2=_0x3ae2b2-0x0;var _0x1dbf00=_0x67bc[_0x3ae2b2];return _0x1dbf00;};'use strict';var _=require(_0xc67b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc67b('0x1'));var BPromise=require(_0xc67b('0x2'));var rp=require(_0xc67b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc67b('0x4'));var config=require('../../config/environment');var attributes=require(_0xc67b('0x5'));module['exports']=function(_0x326ef7,_0x4efed4){return _0x326ef7[_0xc67b('0x6')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xc67b('0x7'),'fields':['idField',_0xc67b('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3543=['servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields'];(function(_0x4dbe90,_0x17ccd9){var _0x1b0956=function(_0x49bf4f){while(--_0x49bf4f){_0x4dbe90['push'](_0x4dbe90['shift']());}};_0x1b0956(++_0x17ccd9);}(_0x3543,0x123));var _0x3354=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x3543[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var util=require(_0x3354('0x0'));var logger=require(_0x3354('0x1'))(_0x3354('0x2'));var moment=require(_0x3354('0x3'));var BPromise=require(_0x3354('0x4'));var rp=require(_0x3354('0x5'));var fs=require('fs');var path=require(_0x3354('0x6'));var rimraf=require(_0x3354('0x7'));var config=require(_0x3354('0x8'));var attributes=require(_0x3354('0x9'));module['exports']=function(_0x509310,_0x2b6fac){return _0x509310[_0x3354('0xa')](_0x3354('0xb'),attributes,{'tableName':_0x3354('0xc'),'paranoid':![],'indexes':[{'name':_0x3354('0xd'),'fields':[_0x3354('0xe'),_0x3354('0xf')],'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 024f52c..0d0b3b4 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 _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xac4a,0x13f));var _0xaac4=function(_0x54a763,_0x1a1ee5){_0x54a763=_0x54a763-0x0;var _0x212b3e=_0xac4a[_0x54a763];return _0x212b3e;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x856d23,_0x30bb8f){var _0x24c50a=function(_0x1bfbb5){while(--_0x1bfbb5){_0x856d23['push'](_0x856d23['shift']());}};_0x24c50a(++_0x30bb8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 3fc9b8d..c211888 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1ab9fd,_0x2faf38){var _0x428cc1=function(_0x403224){while(--_0x403224){_0x1ab9fd['push'](_0x1ab9fd['shift']());}};_0x428cc1(++_0x2faf38);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x407867,_0x2a1ee2){var _0x12bb5a=function(_0x3bdf83){while(--_0x3bdf83){_0x407867['push'](_0x407867['shift']());}};_0x12bb5a(++_0x2a1ee2);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 6e2cf82..5532df7 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(_0x9888c5,_0x2613d7){var _0x3b74d5=function(_0x793d54){while(--_0x793d54){_0x9888c5['push'](_0x9888c5['shift']());}};_0x3b74d5(++_0x2613d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x1d48c5,_0x300310){var _0x29b21a=function(_0x1a71ab){while(--_0x1a71ab){_0x1d48c5['push'](_0x1d48c5['shift']());}};_0x29b21a(++_0x300310);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 113d850..fe9850f 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 _0x733e=['name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','SugarcrmAccount','include','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','pick','options','addConfiguration','getSubjects','channel','getDescriptions','SugarcrmField','Subjects','Descriptions','getFields','assigned_user_id','description','date_start','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','POST','format','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Password\x20Expired','%s%s','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','limit','count','offset','set','Content-Range','update','then','destroy','error','stack'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x733e,0x138));var _0xe733=function(_0x4de9e8,_0x565ffa){_0x4de9e8=_0x4de9e8-0x0;var _0x4db0de=_0x733e[_0x4de9e8];return _0x4db0de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe733('0x0'));var zipdir=require(_0xe733('0x1'));var jsonpatch=require(_0xe733('0x2'));var rp=require(_0xe733('0x3'));var moment=require(_0xe733('0x4'));var BPromise=require(_0xe733('0x5'));var Mustache=require(_0xe733('0x6'));var util=require('util');var path=require(_0xe733('0x7'));var sox=require('sox');var csv=require(_0xe733('0x8'));var ejs=require(_0xe733('0x9'));var fs=require('fs');var fs_extra=require(_0xe733('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe733('0xb'));var jsforce=require(_0xe733('0xc'));var deskjs=require(_0xe733('0xd'));var toCsv=require(_0xe733('0x8'));var querystring=require(_0xe733('0xe'));var Papa=require('papaparse');var Redis=require(_0xe733('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe733('0x10'));var as=require(_0xe733('0x11'));var hardwareService=require(_0xe733('0x12'));var logger=require(_0xe733('0x13'))(_0xe733('0x14'));var utils=require(_0xe733('0x15'));var config=require(_0xe733('0x16'));var licenseUtil=require(_0xe733('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe733('0x18'));function respondWithStatusCode(_0x252958,_0x5491e8){_0x5491e8=_0x5491e8||0xcc;return function(_0x5870fa){if(_0x5870fa){return _0x252958[_0xe733('0x19')](_0x5491e8);}return _0x252958[_0xe733('0x1a')](_0x5491e8)[_0xe733('0x1b')]();};}function respondWithResult(_0x5e50b6,_0x47961b){_0x47961b=_0x47961b||0xc8;return function(_0x220139){if(_0x220139){return _0x5e50b6['status'](_0x47961b)[_0xe733('0x1c')](_0x220139);}};}function respondWithFilteredResult(_0x5b2579,_0x2ebfa4){return function(_0x1752c7){if(_0x1752c7){var _0x5d0dda=typeof _0x2ebfa4['offset']==='undefined'&&typeof _0x2ebfa4[_0xe733('0x1d')]==='undefined';var _0x77e77=_0x1752c7[_0xe733('0x1e')];var _0x49ba0e=_0x5d0dda?0x0:_0x2ebfa4[_0xe733('0x1f')];var _0x5d51d1=_0x5d0dda?_0x1752c7[_0xe733('0x1e')]:_0x2ebfa4[_0xe733('0x1f')]+_0x2ebfa4[_0xe733('0x1d')];var _0x3860a3;if(_0x5d51d1>=_0x77e77){_0x5d51d1=_0x77e77;_0x3860a3=0xc8;}else{_0x3860a3=0xce;}_0x5b2579[_0xe733('0x1a')](_0x3860a3);return _0x5b2579[_0xe733('0x20')](_0xe733('0x21'),_0x49ba0e+'-'+_0x5d51d1+'/'+_0x77e77)[_0xe733('0x1c')](_0x1752c7);}return null;};}function patchUpdates(_0x4adfbe){return function(_0x182f1a){try{jsonpatch['apply'](_0x182f1a,_0x4adfbe,!![]);}catch(_0x228b46){return BPromise['reject'](_0x228b46);}return _0x182f1a['save']();};}function saveUpdates(_0x33d676,_0x4047b4){return function(_0x263430){if(_0x263430){return _0x263430[_0xe733('0x22')](_0x33d676)[_0xe733('0x23')](function(_0x1f9ac7){return _0x1f9ac7;});}return null;};}function removeEntity(_0x476c5a,_0xc7e185){return function(_0xea9b6a){if(_0xea9b6a){return _0xea9b6a[_0xe733('0x24')]()[_0xe733('0x23')](function(){_0x476c5a[_0xe733('0x1a')](0xcc)[_0xe733('0x1b')]();});}};}function handleEntityNotFound(_0x5efb81,_0x5612c7){return function(_0x515ad8){if(!_0x515ad8){_0x5efb81[_0xe733('0x19')](0x194);}return _0x515ad8;};}function handleError(_0x4b8cc3,_0x41b08d){_0x41b08d=_0x41b08d||0x1f4;return function(_0x49380e){logger[_0xe733('0x25')](_0x49380e[_0xe733('0x26')]);if(_0x49380e[_0xe733('0x27')]){delete _0x49380e['name'];}_0x4b8cc3[_0xe733('0x1a')](_0x41b08d)[_0xe733('0x28')](_0x49380e);};}exports[_0xe733('0x29')]=function(_0x2abf70,_0x591621){var _0x15a16d={},_0x487223={},_0x16b670={'count':0x0,'rows':[]};var _0x4bc77c=_[_0xe733('0x2a')](db['SugarcrmAccount'][_0xe733('0x2b')],function(_0x1762c2){return{'name':_0x1762c2['fieldName'],'type':_0x1762c2[_0xe733('0x2c')][_0xe733('0x2d')]};});_0x487223[_0xe733('0x2e')]=_[_0xe733('0x2a')](_0x4bc77c,_0xe733('0x27'));_0x487223['query']=_[_0xe733('0x2f')](_0x2abf70[_0xe733('0x30')]);_0x487223[_0xe733('0x31')]=_[_0xe733('0x32')](_0x487223[_0xe733('0x2e')],_0x487223['query']);_0x15a16d[_0xe733('0x33')]=_[_0xe733('0x32')](_0x487223[_0xe733('0x2e')],qs[_0xe733('0x34')](_0x2abf70['query'][_0xe733('0x34')]));_0x15a16d[_0xe733('0x33')]=_0x15a16d[_0xe733('0x33')][_0xe733('0x35')]?_0x15a16d[_0xe733('0x33')]:_0x487223[_0xe733('0x2e')];if(!_0x2abf70[_0xe733('0x30')][_0xe733('0x36')](_0xe733('0x37'))){_0x15a16d[_0xe733('0x1d')]=qs[_0xe733('0x1d')](_0x2abf70[_0xe733('0x30')][_0xe733('0x1d')]);_0x15a16d[_0xe733('0x1f')]=qs[_0xe733('0x1f')](_0x2abf70[_0xe733('0x30')][_0xe733('0x1f')]);}_0x15a16d[_0xe733('0x38')]=qs[_0xe733('0x39')](_0x2abf70[_0xe733('0x30')][_0xe733('0x39')]);_0x15a16d[_0xe733('0x3a')]=qs['filters'](_['pick'](_0x2abf70[_0xe733('0x30')],_0x487223['filters']),_0x4bc77c);if(_0x2abf70['query'][_0xe733('0x3b')]){_0x15a16d['where']=_['merge'](_0x15a16d['where'],{'$or':_['map'](_0x4bc77c,function(_0x1e0561){if(_0x1e0561[_0xe733('0x2c')]!==_0xe733('0x3c')){var _0x429722={};_0x429722[_0x1e0561[_0xe733('0x27')]]={'$like':'%'+_0x2abf70[_0xe733('0x30')][_0xe733('0x3b')]+'%'};return _0x429722;}})});}_0x15a16d=_[_0xe733('0x3d')]({},_0x15a16d,_0x2abf70['options']);var _0x46987c={'where':_0x15a16d[_0xe733('0x3a')]};return db[_0xe733('0x3e')][_0xe733('0x1e')](_0x46987c)[_0xe733('0x23')](function(_0x420fdc){_0x16b670[_0xe733('0x1e')]=_0x420fdc;if(_0x2abf70[_0xe733('0x30')]['includeAll']){_0x15a16d[_0xe733('0x3f')]=[{'all':!![]}];}return db[_0xe733('0x3e')]['findAll'](_0x15a16d);})[_0xe733('0x23')](function(_0x2f080a){_0x16b670[_0xe733('0x40')]=_0x2f080a;return _0x16b670;})['then'](respondWithFilteredResult(_0x591621,_0x15a16d))[_0xe733('0x41')](handleError(_0x591621,null));};exports[_0xe733('0x42')]=function(_0x183949,_0x58d97){var _0xb4fb4d={'raw':![],'where':{'id':_0x183949[_0xe733('0x43')]['id']}},_0x1e8dc3={};_0x1e8dc3['model']=_['keys'](db['SugarcrmAccount'][_0xe733('0x2b')]);_0x1e8dc3['query']=_[_0xe733('0x2f')](_0x183949[_0xe733('0x30')]);_0x1e8dc3[_0xe733('0x31')]=_['intersection'](_0x1e8dc3['model'],_0x1e8dc3[_0xe733('0x30')]);_0xb4fb4d[_0xe733('0x33')]=_['intersection'](_0x1e8dc3[_0xe733('0x2e')],qs[_0xe733('0x34')](_0x183949[_0xe733('0x30')][_0xe733('0x34')]));_0xb4fb4d[_0xe733('0x33')]=_0xb4fb4d['attributes'][_0xe733('0x35')]?_0xb4fb4d[_0xe733('0x33')]:_0x1e8dc3['model'];if(_0x183949[_0xe733('0x30')][_0xe733('0x44')]){_0xb4fb4d['include']=[{'all':!![]}];}_0xb4fb4d=_[_0xe733('0x3d')]({},_0xb4fb4d,_0x183949['options']);return db[_0xe733('0x3e')][_0xe733('0x45')](_0xb4fb4d)[_0xe733('0x23')](handleEntityNotFound(_0x58d97,null))[_0xe733('0x23')](respondWithResult(_0x58d97,null))[_0xe733('0x41')](handleError(_0x58d97,null));};exports[_0xe733('0x46')]=function(_0x271f54,_0x357717){return db[_0xe733('0x3e')][_0xe733('0x46')](_0x271f54[_0xe733('0x47')],{})['then'](respondWithResult(_0x357717,0xc9))[_0xe733('0x41')](handleError(_0x357717,null));};exports[_0xe733('0x22')]=function(_0x1d6715,_0x19f3a8){if(_0x1d6715[_0xe733('0x47')]['id']){delete _0x1d6715[_0xe733('0x47')]['id'];}return db[_0xe733('0x3e')][_0xe733('0x45')]({'where':{'id':_0x1d6715[_0xe733('0x43')]['id']}})[_0xe733('0x23')](handleEntityNotFound(_0x19f3a8,null))[_0xe733('0x23')](saveUpdates(_0x1d6715['body'],null))[_0xe733('0x23')](respondWithResult(_0x19f3a8,null))[_0xe733('0x41')](handleError(_0x19f3a8,null));};exports[_0xe733('0x24')]=function(_0x40a7a8,_0x5f96e6){return db[_0xe733('0x3e')][_0xe733('0x45')]({'where':{'id':_0x40a7a8[_0xe733('0x43')]['id']}})[_0xe733('0x23')](handleEntityNotFound(_0x5f96e6,null))[_0xe733('0x23')](removeEntity(_0x5f96e6,null))['catch'](handleError(_0x5f96e6,null));};exports[_0xe733('0x48')]=function(_0xd85f4c,_0x272ad4,_0x2e1ab0){var _0x2db2f2={};var _0x40a4bb={};var _0x49c3bd;var _0x1e0e5c;return db[_0xe733('0x3e')][_0xe733('0x49')]({'where':{'id':_0xd85f4c[_0xe733('0x43')]['id']}})[_0xe733('0x23')](handleEntityNotFound(_0x272ad4,null))[_0xe733('0x23')](function(_0x40d05b){if(_0x40d05b){_0x49c3bd=_0x40d05b;_0x40a4bb[_0xe733('0x2e')]=_[_0xe733('0x2f')](db[_0xe733('0x4a')][_0xe733('0x2b')]);_0x40a4bb[_0xe733('0x30')]=_[_0xe733('0x2f')](_0xd85f4c[_0xe733('0x30')]);_0x40a4bb[_0xe733('0x31')]=_['intersection'](_0x40a4bb[_0xe733('0x2e')],_0x40a4bb[_0xe733('0x30')]);_0x2db2f2['attributes']=_[_0xe733('0x32')](_0x40a4bb[_0xe733('0x2e')],qs[_0xe733('0x34')](_0xd85f4c[_0xe733('0x30')][_0xe733('0x34')]));_0x2db2f2[_0xe733('0x33')]=_0x2db2f2[_0xe733('0x33')][_0xe733('0x35')]?_0x2db2f2[_0xe733('0x33')]:_0x40a4bb[_0xe733('0x2e')];_0x2db2f2[_0xe733('0x38')]=qs[_0xe733('0x39')](_0xd85f4c[_0xe733('0x30')][_0xe733('0x39')]);_0x2db2f2[_0xe733('0x3a')]=qs[_0xe733('0x31')](_[_0xe733('0x4b')](_0xd85f4c['query'],_0x40a4bb['filters']));if(_0xd85f4c[_0xe733('0x30')][_0xe733('0x3b')]){_0x2db2f2[_0xe733('0x3a')]=_[_0xe733('0x3d')](_0x2db2f2[_0xe733('0x3a')],{'$or':_['map'](_0x2db2f2['attributes'],function(_0x49046){var _0xe427bc={};_0xe427bc[_0x49046]={'$like':'%'+_0xd85f4c[_0xe733('0x30')][_0xe733('0x3b')]+'%'};return _0xe427bc;})});}_0x2db2f2=_['merge']({},_0x2db2f2,_0xd85f4c[_0xe733('0x4c')]);return _0x49c3bd[_0xe733('0x48')](_0x2db2f2);}})[_0xe733('0x23')](function(_0x32c0ee){if(_0x32c0ee){_0x1e0e5c=_0x32c0ee[_0xe733('0x35')];if(!_0xd85f4c[_0xe733('0x30')][_0xe733('0x36')](_0xe733('0x37'))){_0x2db2f2[_0xe733('0x1d')]=qs[_0xe733('0x1d')](_0xd85f4c[_0xe733('0x30')][_0xe733('0x1d')]);_0x2db2f2[_0xe733('0x1f')]=qs[_0xe733('0x1f')](_0xd85f4c[_0xe733('0x30')]['offset']);}return _0x49c3bd[_0xe733('0x48')](_0x2db2f2);}})[_0xe733('0x23')](function(_0x1ebd40){if(_0x1ebd40){return _0x1ebd40?{'count':_0x1e0e5c,'rows':_0x1ebd40}:null;}})['then'](respondWithResult(_0x272ad4,null))[_0xe733('0x41')](handleError(_0x272ad4,null));};exports[_0xe733('0x4d')]=function(_0x3b37f0,_0x143827,_0x22dcdd){if(_0x3b37f0[_0xe733('0x47')]['id']){delete _0x3b37f0[_0xe733('0x47')]['id'];}return db[_0xe733('0x3e')][_0xe733('0x49')]({'where':{'id':_0x3b37f0[_0xe733('0x43')]['id']}})[_0xe733('0x23')](handleEntityNotFound(_0x143827,null))[_0xe733('0x23')](function(_0x4bf970){if(_0x4bf970){_0x3b37f0[_0xe733('0x47')]['AccountId']=_0x4bf970['id'];_0x3b37f0[_0xe733('0x47')]['Subjects']=integrations[_0xe733('0x4e')](_0x3b37f0[_0xe733('0x47')][_0xe733('0x4f')],_0x3b37f0[_0xe733('0x47')]['type']);_0x3b37f0[_0xe733('0x47')]['Descriptions']=integrations[_0xe733('0x50')](_0x3b37f0[_0xe733('0x47')][_0xe733('0x4f')],_0x3b37f0[_0xe733('0x47')]['type']);return db['SugarcrmConfiguration'][_0xe733('0x46')](_0x3b37f0[_0xe733('0x47')],{'include':[{'model':db[_0xe733('0x51')],'as':_0xe733('0x52')},{'model':db['SugarcrmField'],'as':_0xe733('0x53')}]});}return null;})['then'](respondWithResult(_0x143827,null))[_0xe733('0x41')](handleError(_0x143827,null));};exports[_0xe733('0x54')]=function(_0x1d9ec8,_0x99eca9,_0x388d34){var _0x502cbd='';var _0x101c3e=['id',_0xe733('0x27'),_0xe733('0x55'),'created_by',_0xe733('0x56'),_0xe733('0x57'),'duration_hours','duration_minutes',_0xe733('0x58'),_0xe733('0x59'),_0xe733('0x5a'),_0xe733('0x5b')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x1d9ec8[_0xe733('0x43')]['id']},'attributes':['id',_0xe733('0x5c'),_0xe733('0x5d'),_0xe733('0x5e')]})[_0xe733('0x23')](handleEntityNotFound(_0x99eca9,null))[_0xe733('0x23')](function(_0x3d40ce){if(_0x3d40ce){_0x502cbd=_0x3d40ce['remoteUri'];var _0x172136=_0x502cbd[_0xe733('0x5f')](-0x1);if(_0x172136==='/'){_0x502cbd=_0x502cbd[_0xe733('0x60')](0x0,_0x502cbd['lastIndexOf'](_0x172136));}return rp({'method':_0xe733('0x61'),'uri':util[_0xe733('0x62')]('%s%s',_0x502cbd,_0xe733('0x63')),'json':!![],'form':{'method':_0xe733('0x64'),'input_type':_0xe733('0x65'),'response_type':'JSON','rest_data':JSON[_0xe733('0x66')]({'user_auth':{'user_name':_0x3d40ce[_0xe733('0x5c')],'password':_0x3d40ce[_0xe733('0x5d')],'encryption':'PLAIN'},'application':_0xe733('0x67')})}});}})[_0xe733('0x23')](function(_0x34ee2a){if(_0x34ee2a&&_0x34ee2a[_0xe733('0x27')]!=='Invalid\x20Login'&&_0x34ee2a[_0xe733('0x27')]!==_0xe733('0x68')){return rp({'method':'POST','uri':util[_0xe733('0x62')](_0xe733('0x69'),_0x502cbd,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0xe733('0x65'),'response_type':'JSON','rest_data':JSON[_0xe733('0x66')]({'session':_0x34ee2a['id'],'module_name':'Calls'})}})[_0xe733('0x23')](function(_0x5b6c06){if(_0x5b6c06){var _0x3ada17=_[_0xe733('0x6a')](_0x5b6c06[_0xe733('0x6b')]);_[_0xe733('0x6c')](_0x3ada17,function(_0x21d14d){return _0x101c3e[_0xe733('0x6d')](_0x21d14d[_0xe733('0x27')]);});return{'count':_0x3ada17['length'],'rows':_['map'](_0x3ada17,function(_0x4bc8bb){return{'id':_0x4bc8bb[_0xe733('0x27')],'name':_0x4bc8bb[_0xe733('0x6e')],'custom':_[_0xe733('0x6f')](_0x4bc8bb[_0xe733('0x27')],'_c')?!![]:![],'options':_0x4bc8bb[_0xe733('0x4c')]?_[_0xe733('0x2a')](_[_0xe733('0x6a')](_0x4bc8bb[_0xe733('0x4c')]),function(_0x493d5c){return{'name':_0x493d5c[_0xe733('0x70')],'value':_0x493d5c[_0xe733('0x27')]};}):[]};})};}})['then'](respondWithResult(_0x99eca9,null))[_0xe733('0x41')](function(_0x2cb522){var _0x598f27=_0x1d9ec8['query'][_0xe733('0x71')]?0x1f4:_0x2cb522[_0xe733('0x72')]||0x1f4;logger[_0xe733('0x25')](_0xe733('0x73'),_0xe733('0x54'),_0x598f27,JSON[_0xe733('0x66')](_0x2cb522));delete _0x2cb522['name'];if(_0x598f27===0x191){_0x598f27=0x190;}_0x99eca9[_0xe733('0x1a')](_0x598f27)[_0xe733('0x28')](_0x1d9ec8[_0xe733('0x30')][_0xe733('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x2cb522[_0xe733('0x72')]}:_0x2cb522);});}else{var _0x2f249f=0x1f4;_0x99eca9[_0xe733('0x1a')](_0x2f249f)['send']({'message':_0xe733('0x74'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x930f=['remove','includes','label','endsWith','values','test','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','update','then','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','fields','includeAll','find','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','password','remoteUri','slice','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','get_module_fields','stringify','Calls','module_fields'];(function(_0x92624e,_0x3ad9e0){var _0x592713=function(_0x1ca9e){while(--_0x1ca9e){_0x92624e['push'](_0x92624e['shift']());}};_0x592713(++_0x3ad9e0);}(_0x930f,0x17b));var _0xf930=function(_0x24babe,_0x46a7d6){_0x24babe=_0x24babe-0x0;var _0x412d82=_0x930f[_0x24babe];return _0x412d82;};'use strict';var emlformat=require(_0xf930('0x0'));var rimraf=require(_0xf930('0x1'));var zipdir=require(_0xf930('0x2'));var jsonpatch=require(_0xf930('0x3'));var rp=require(_0xf930('0x4'));var moment=require(_0xf930('0x5'));var BPromise=require(_0xf930('0x6'));var Mustache=require('mustache');var util=require(_0xf930('0x7'));var path=require(_0xf930('0x8'));var sox=require(_0xf930('0x9'));var csv=require(_0xf930('0xa'));var ejs=require(_0xf930('0xb'));var fs=require('fs');var fs_extra=require(_0xf930('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf930('0xd'));var deskjs=require(_0xf930('0xe'));var toCsv=require(_0xf930('0xa'));var querystring=require(_0xf930('0xf'));var Papa=require(_0xf930('0x10'));var Redis=require(_0xf930('0x11'));var authService=require(_0xf930('0x12'));var qs=require(_0xf930('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf930('0x14'));var logger=require(_0xf930('0x15'))('api');var utils=require(_0xf930('0x16'));var config=require(_0xf930('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xb8e8e,_0x562358){_0x562358=_0x562358||0xcc;return function(_0x47eec1){if(_0x47eec1){return _0xb8e8e[_0xf930('0x18')](_0x562358);}return _0xb8e8e['status'](_0x562358)[_0xf930('0x19')]();};}function respondWithResult(_0x302b65,_0x5ba7d8){_0x5ba7d8=_0x5ba7d8||0xc8;return function(_0x495c04){if(_0x495c04){return _0x302b65[_0xf930('0x1a')](_0x5ba7d8)[_0xf930('0x1b')](_0x495c04);}};}function respondWithFilteredResult(_0x595395,_0x4cf47a){return function(_0x3bf36d){if(_0x3bf36d){var _0x222b4d=typeof _0x4cf47a[_0xf930('0x1c')]===_0xf930('0x1d')&&typeof _0x4cf47a[_0xf930('0x1e')]===_0xf930('0x1d');var _0x124e31=_0x3bf36d[_0xf930('0x1f')];var _0x1781e4=_0x222b4d?0x0:_0x4cf47a[_0xf930('0x1c')];var _0xc0cb43=_0x222b4d?_0x3bf36d[_0xf930('0x1f')]:_0x4cf47a['offset']+_0x4cf47a[_0xf930('0x1e')];var _0x3a46cf;if(_0xc0cb43>=_0x124e31){_0xc0cb43=_0x124e31;_0x3a46cf=0xc8;}else{_0x3a46cf=0xce;}_0x595395[_0xf930('0x1a')](_0x3a46cf);return _0x595395['set']('Content-Range',_0x1781e4+'-'+_0xc0cb43+'/'+_0x124e31)['json'](_0x3bf36d);}return null;};}function patchUpdates(_0xd68ab4){return function(_0x44a4ef){try{jsonpatch[_0xf930('0x20')](_0x44a4ef,_0xd68ab4,!![]);}catch(_0x58243b){return BPromise[_0xf930('0x21')](_0x58243b);}return _0x44a4ef['save']();};}function saveUpdates(_0x421f24,_0x13aed5){return function(_0x816fa5){if(_0x816fa5){return _0x816fa5[_0xf930('0x22')](_0x421f24)[_0xf930('0x23')](function(_0x79930f){return _0x79930f;});}return null;};}function removeEntity(_0x4e5e27,_0x395cc6){return function(_0x3edcc8){if(_0x3edcc8){return _0x3edcc8['destroy']()[_0xf930('0x23')](function(){_0x4e5e27[_0xf930('0x1a')](0xcc)[_0xf930('0x19')]();});}};}function handleEntityNotFound(_0x52cf57,_0x46f3ff){return function(_0x3b1f45){if(!_0x3b1f45){_0x52cf57[_0xf930('0x18')](0x194);}return _0x3b1f45;};}function handleError(_0x3561c7,_0xcb11c7){_0xcb11c7=_0xcb11c7||0x1f4;return function(_0xf17ad6){logger['error'](_0xf17ad6[_0xf930('0x24')]);if(_0xf17ad6[_0xf930('0x25')]){delete _0xf17ad6[_0xf930('0x25')];}_0x3561c7[_0xf930('0x1a')](_0xcb11c7)[_0xf930('0x26')](_0xf17ad6);};}exports[_0xf930('0x27')]=function(_0x203531,_0x1097cf){var _0x2f535b={},_0x17d2a6={},_0x339528={'count':0x0,'rows':[]};var _0x4dd080=_[_0xf930('0x28')](db[_0xf930('0x29')][_0xf930('0x2a')],function(_0x26379f){return{'name':_0x26379f[_0xf930('0x2b')],'type':_0x26379f[_0xf930('0x2c')][_0xf930('0x2d')]};});_0x17d2a6[_0xf930('0x2e')]=_[_0xf930('0x28')](_0x4dd080,_0xf930('0x25'));_0x17d2a6['query']=_[_0xf930('0x2f')](_0x203531[_0xf930('0x30')]);_0x17d2a6[_0xf930('0x31')]=_[_0xf930('0x32')](_0x17d2a6[_0xf930('0x2e')],_0x17d2a6[_0xf930('0x30')]);_0x2f535b[_0xf930('0x33')]=_[_0xf930('0x32')](_0x17d2a6[_0xf930('0x2e')],qs['fields'](_0x203531[_0xf930('0x30')]['fields']));_0x2f535b[_0xf930('0x33')]=_0x2f535b[_0xf930('0x33')][_0xf930('0x34')]?_0x2f535b['attributes']:_0x17d2a6[_0xf930('0x2e')];if(!_0x203531['query'][_0xf930('0x35')](_0xf930('0x36'))){_0x2f535b[_0xf930('0x1e')]=qs[_0xf930('0x1e')](_0x203531['query'][_0xf930('0x1e')]);_0x2f535b[_0xf930('0x1c')]=qs[_0xf930('0x1c')](_0x203531[_0xf930('0x30')][_0xf930('0x1c')]);}_0x2f535b[_0xf930('0x37')]=qs[_0xf930('0x38')](_0x203531['query'][_0xf930('0x38')]);_0x2f535b[_0xf930('0x39')]=qs[_0xf930('0x31')](_[_0xf930('0x3a')](_0x203531['query'],_0x17d2a6[_0xf930('0x31')]),_0x4dd080);if(_0x203531[_0xf930('0x30')][_0xf930('0x3b')]){_0x2f535b[_0xf930('0x39')]=_[_0xf930('0x3c')](_0x2f535b['where'],{'$or':_[_0xf930('0x28')](_0x4dd080,function(_0x1838a1){if(_0x1838a1[_0xf930('0x2c')]!==_0xf930('0x3d')){var _0x2bc9b8={};_0x2bc9b8[_0x1838a1[_0xf930('0x25')]]={'$like':'%'+_0x203531[_0xf930('0x30')][_0xf930('0x3b')]+'%'};return _0x2bc9b8;}})});}_0x2f535b=_[_0xf930('0x3c')]({},_0x2f535b,_0x203531[_0xf930('0x3e')]);var _0x3ab451={'where':_0x2f535b[_0xf930('0x39')]};return db['SugarcrmAccount'][_0xf930('0x1f')](_0x3ab451)[_0xf930('0x23')](function(_0x12a12c){_0x339528[_0xf930('0x1f')]=_0x12a12c;if(_0x203531[_0xf930('0x30')]['includeAll']){_0x2f535b[_0xf930('0x3f')]=[{'all':!![]}];}return db[_0xf930('0x29')][_0xf930('0x40')](_0x2f535b);})['then'](function(_0x159e9e){_0x339528[_0xf930('0x41')]=_0x159e9e;return _0x339528;})[_0xf930('0x23')](respondWithFilteredResult(_0x1097cf,_0x2f535b))[_0xf930('0x42')](handleError(_0x1097cf,null));};exports[_0xf930('0x43')]=function(_0x486dda,_0x3dc751){var _0xd35d60={'raw':![],'where':{'id':_0x486dda[_0xf930('0x44')]['id']}},_0x4854ff={};_0x4854ff[_0xf930('0x2e')]=_[_0xf930('0x2f')](db['SugarcrmAccount']['rawAttributes']);_0x4854ff[_0xf930('0x30')]=_['keys'](_0x486dda[_0xf930('0x30')]);_0x4854ff[_0xf930('0x31')]=_[_0xf930('0x32')](_0x4854ff[_0xf930('0x2e')],_0x4854ff[_0xf930('0x30')]);_0xd35d60[_0xf930('0x33')]=_[_0xf930('0x32')](_0x4854ff['model'],qs[_0xf930('0x45')](_0x486dda[_0xf930('0x30')]['fields']));_0xd35d60['attributes']=_0xd35d60[_0xf930('0x33')]['length']?_0xd35d60[_0xf930('0x33')]:_0x4854ff[_0xf930('0x2e')];if(_0x486dda[_0xf930('0x30')][_0xf930('0x46')]){_0xd35d60[_0xf930('0x3f')]=[{'all':!![]}];}_0xd35d60=_['merge']({},_0xd35d60,_0x486dda[_0xf930('0x3e')]);return db['SugarcrmAccount'][_0xf930('0x47')](_0xd35d60)['then'](handleEntityNotFound(_0x3dc751,null))[_0xf930('0x23')](respondWithResult(_0x3dc751,null))['catch'](handleError(_0x3dc751,null));};exports['create']=function(_0x13bfbd,_0x32f7d1){return db['SugarcrmAccount'][_0xf930('0x48')](_0x13bfbd[_0xf930('0x49')],{})[_0xf930('0x23')](respondWithResult(_0x32f7d1,0xc9))['catch'](handleError(_0x32f7d1,null));};exports['update']=function(_0x1575e1,_0xeaf51){if(_0x1575e1['body']['id']){delete _0x1575e1[_0xf930('0x49')]['id'];}return db[_0xf930('0x29')][_0xf930('0x47')]({'where':{'id':_0x1575e1[_0xf930('0x44')]['id']}})[_0xf930('0x23')](handleEntityNotFound(_0xeaf51,null))['then'](saveUpdates(_0x1575e1[_0xf930('0x49')],null))[_0xf930('0x23')](respondWithResult(_0xeaf51,null))[_0xf930('0x42')](handleError(_0xeaf51,null));};exports[_0xf930('0x4a')]=function(_0x327b3a,_0x14f0a1){return db[_0xf930('0x29')][_0xf930('0x47')]({'where':{'id':_0x327b3a[_0xf930('0x44')]['id']}})[_0xf930('0x23')](handleEntityNotFound(_0x14f0a1,null))[_0xf930('0x23')](removeEntity(_0x14f0a1,null))['catch'](handleError(_0x14f0a1,null));};exports[_0xf930('0x4b')]=function(_0x1470f2,_0x1279dc,_0x2fe28f){var _0x12e151={};var _0x12d84b={};var _0x348bbd;var _0x1699f4;return db[_0xf930('0x29')][_0xf930('0x4c')]({'where':{'id':_0x1470f2[_0xf930('0x44')]['id']}})['then'](handleEntityNotFound(_0x1279dc,null))[_0xf930('0x23')](function(_0x8a8d5f){if(_0x8a8d5f){_0x348bbd=_0x8a8d5f;_0x12d84b[_0xf930('0x2e')]=_['keys'](db[_0xf930('0x4d')]['rawAttributes']);_0x12d84b[_0xf930('0x30')]=_[_0xf930('0x2f')](_0x1470f2[_0xf930('0x30')]);_0x12d84b['filters']=_[_0xf930('0x32')](_0x12d84b[_0xf930('0x2e')],_0x12d84b[_0xf930('0x30')]);_0x12e151[_0xf930('0x33')]=_[_0xf930('0x32')](_0x12d84b['model'],qs[_0xf930('0x45')](_0x1470f2['query'][_0xf930('0x45')]));_0x12e151[_0xf930('0x33')]=_0x12e151[_0xf930('0x33')][_0xf930('0x34')]?_0x12e151[_0xf930('0x33')]:_0x12d84b[_0xf930('0x2e')];_0x12e151[_0xf930('0x37')]=qs[_0xf930('0x38')](_0x1470f2['query'][_0xf930('0x38')]);_0x12e151[_0xf930('0x39')]=qs[_0xf930('0x31')](_['pick'](_0x1470f2[_0xf930('0x30')],_0x12d84b['filters']));if(_0x1470f2[_0xf930('0x30')][_0xf930('0x3b')]){_0x12e151[_0xf930('0x39')]=_[_0xf930('0x3c')](_0x12e151['where'],{'$or':_[_0xf930('0x28')](_0x12e151[_0xf930('0x33')],function(_0x52fc7e){var _0x4b75cf={};_0x4b75cf[_0x52fc7e]={'$like':'%'+_0x1470f2['query'][_0xf930('0x3b')]+'%'};return _0x4b75cf;})});}_0x12e151=_[_0xf930('0x3c')]({},_0x12e151,_0x1470f2['options']);return _0x348bbd[_0xf930('0x4b')](_0x12e151);}})[_0xf930('0x23')](function(_0x395e76){if(_0x395e76){_0x1699f4=_0x395e76[_0xf930('0x34')];if(!_0x1470f2['query'][_0xf930('0x35')](_0xf930('0x36'))){_0x12e151[_0xf930('0x1e')]=qs[_0xf930('0x1e')](_0x1470f2['query'][_0xf930('0x1e')]);_0x12e151['offset']=qs[_0xf930('0x1c')](_0x1470f2[_0xf930('0x30')][_0xf930('0x1c')]);}return _0x348bbd[_0xf930('0x4b')](_0x12e151);}})['then'](function(_0x44d4e1){if(_0x44d4e1){return _0x44d4e1?{'count':_0x1699f4,'rows':_0x44d4e1}:null;}})[_0xf930('0x23')](respondWithResult(_0x1279dc,null))[_0xf930('0x42')](handleError(_0x1279dc,null));};exports[_0xf930('0x4e')]=function(_0x27d52d,_0x25f3cb,_0x1bb9f2){if(_0x27d52d[_0xf930('0x49')]['id']){delete _0x27d52d[_0xf930('0x49')]['id'];}return db[_0xf930('0x29')][_0xf930('0x4c')]({'where':{'id':_0x27d52d[_0xf930('0x44')]['id']}})['then'](handleEntityNotFound(_0x25f3cb,null))['then'](function(_0x9f1449){if(_0x9f1449){_0x27d52d[_0xf930('0x49')][_0xf930('0x4f')]=_0x9f1449['id'];_0x27d52d[_0xf930('0x49')][_0xf930('0x50')]=integrations[_0xf930('0x51')](_0x27d52d['body'][_0xf930('0x52')],_0x27d52d[_0xf930('0x49')]['type']);_0x27d52d[_0xf930('0x49')][_0xf930('0x53')]=integrations[_0xf930('0x54')](_0x27d52d[_0xf930('0x49')][_0xf930('0x52')],_0x27d52d[_0xf930('0x49')][_0xf930('0x2c')]);return db[_0xf930('0x4d')][_0xf930('0x48')](_0x27d52d[_0xf930('0x49')],{'include':[{'model':db[_0xf930('0x55')],'as':_0xf930('0x50')},{'model':db[_0xf930('0x55')],'as':'Descriptions'}]});}return null;})[_0xf930('0x23')](respondWithResult(_0x25f3cb,null))['catch'](handleError(_0x25f3cb,null));};exports[_0xf930('0x56')]=function(_0x51858c,_0x43d3a2,_0x76f26a){var _0xd5fe88='';var _0x5d875c=['id',_0xf930('0x25'),_0xf930('0x57'),'created_by','description',_0xf930('0x58'),_0xf930('0x59'),_0xf930('0x5a'),_0xf930('0x5b'),_0xf930('0x5c'),_0xf930('0x5d'),'direction'];return db[_0xf930('0x29')][_0xf930('0x4c')]({'where':{'id':_0x51858c['params']['id']},'attributes':['id',_0xf930('0x5e'),_0xf930('0x5f'),_0xf930('0x60')]})['then'](handleEntityNotFound(_0x43d3a2,null))[_0xf930('0x23')](function(_0x451bec){if(_0x451bec){_0xd5fe88=_0x451bec['remoteUri'];var _0x4f76cd=_0xd5fe88[_0xf930('0x61')](-0x1);if(_0x4f76cd==='/'){_0xd5fe88=_0xd5fe88['substring'](0x0,_0xd5fe88[_0xf930('0x62')](_0x4f76cd));}return rp({'method':'POST','uri':util[_0xf930('0x63')](_0xf930('0x64'),_0xd5fe88,_0xf930('0x65')),'json':!![],'form':{'method':_0xf930('0x66'),'input_type':_0xf930('0x67'),'response_type':_0xf930('0x67'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x451bec[_0xf930('0x5e')],'password':_0x451bec['password'],'encryption':_0xf930('0x68')},'application':_0xf930('0x69')})}});}})[_0xf930('0x23')](function(_0x1f6a8c){if(_0x1f6a8c&&_0x1f6a8c[_0xf930('0x25')]!==_0xf930('0x6a')&&_0x1f6a8c[_0xf930('0x25')]!==_0xf930('0x6b')){return rp({'method':_0xf930('0x6c'),'uri':util['format']('%s%s',_0xd5fe88,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xf930('0x6d'),'input_type':_0xf930('0x67'),'response_type':_0xf930('0x67'),'rest_data':JSON[_0xf930('0x6e')]({'session':_0x1f6a8c['id'],'module_name':_0xf930('0x6f')})}})[_0xf930('0x23')](function(_0xab298f){if(_0xab298f){var _0x1b4059=_['values'](_0xab298f[_0xf930('0x70')]);_[_0xf930('0x71')](_0x1b4059,function(_0x1006b3){return _0x5d875c[_0xf930('0x72')](_0x1006b3['name']);});return{'count':_0x1b4059[_0xf930('0x34')],'rows':_[_0xf930('0x28')](_0x1b4059,function(_0x35f0f2){return{'id':_0x35f0f2['name'],'name':_0x35f0f2[_0xf930('0x73')],'custom':_[_0xf930('0x74')](_0x35f0f2[_0xf930('0x25')],'_c')?!![]:![],'options':_0x35f0f2[_0xf930('0x3e')]?_['map'](_[_0xf930('0x75')](_0x35f0f2[_0xf930('0x3e')]),function(_0x2d5913){return{'name':_0x2d5913['value'],'value':_0x2d5913[_0xf930('0x25')]};}):[]};})};}})[_0xf930('0x23')](respondWithResult(_0x43d3a2,null))[_0xf930('0x42')](function(_0x332b38){var _0x539273=_0x51858c[_0xf930('0x30')][_0xf930('0x76')]?0x1f4:_0x332b38['statusCode']||0x1f4;logger[_0xf930('0x77')](_0xf930('0x78'),_0xf930('0x56'),_0x539273,JSON[_0xf930('0x6e')](_0x332b38));delete _0x332b38['name'];if(_0x539273===0x191){_0x539273=0x190;}_0x43d3a2[_0xf930('0x1a')](_0x539273)[_0xf930('0x26')](_0x51858c[_0xf930('0x30')][_0xf930('0x76')]?{'message':_0xf930('0x79'),'statusCode':_0x332b38[_0xf930('0x7a')]}:_0x332b38);});}else{var _0x2baad7=0x1f4;_0x43d3a2[_0xf930('0x1a')](_0x2baad7)[_0xf930('0x26')]({'message':_0xf930('0x79'),'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 bdfd60e..9abf59f 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 _0xd065=['util','../../config/logger','api','moment','bluebird','request-promise','path','./intSugarcrmAccount.attributes','define','SugarcrmAccount','lodash'];(function(_0x5dac97,_0x316bcf){var _0x181fca=function(_0xf6ea90){while(--_0xf6ea90){_0x5dac97['push'](_0x5dac97['shift']());}};_0x181fca(++_0x316bcf);}(_0xd065,0xba));var _0x5d06=function(_0x4fa8b8,_0x18f294){_0x4fa8b8=_0x4fa8b8-0x0;var _0x29b472=_0xd065[_0x4fa8b8];return _0x29b472;};'use strict';var _=require(_0x5d06('0x0'));var util=require(_0x5d06('0x1'));var logger=require(_0x5d06('0x2'))(_0x5d06('0x3'));var moment=require(_0x5d06('0x4'));var BPromise=require(_0x5d06('0x5'));var rp=require(_0x5d06('0x6'));var fs=require('fs');var path=require(_0x5d06('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5d06('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xbec7a8,_0x3f12ec){return _0xbec7a8[_0x5d06('0x9')](_0x5d06('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd85c=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x37b8f5,_0x311e7a){var _0x4ead78=function(_0x489e0e){while(--_0x489e0e){_0x37b8f5['push'](_0x37b8f5['shift']());}};_0x4ead78(++_0x311e7a);}(_0xd85c,0x8a));var _0xcd85=function(_0x27926c,_0x37d579){_0x27926c=_0x27926c-0x0;var _0x584578=_0xd85c[_0x27926c];return _0x584578;};'use strict';var _=require(_0xcd85('0x0'));var util=require('util');var logger=require(_0xcd85('0x1'))('api');var moment=require(_0xcd85('0x2'));var BPromise=require(_0xcd85('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd85('0x4'));var rimraf=require(_0xcd85('0x5'));var config=require('../../config/environment');var attributes=require(_0xcd85('0x6'));var integrations=require(_0xcd85('0x7'));module[_0xcd85('0x8')]=function(_0x127cf3,_0x30b451){return _0x127cf3[_0xcd85('0x9')](_0xcd85('0xa'),attributes,{'tableName':_0xcd85('0xb'),'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 11b1ea3..d85bb30 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 _0x252d=['error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','model','map','attributes','then','ShowSugarcrmAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','jayson/promise','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2c997c,_0xc095ab){var _0x403975=function(_0x4cda62){while(--_0x4cda62){_0x2c997c['push'](_0x2c997c['shift']());}};_0x403975(++_0xc095ab);}(_0x252d,0x189));var _0xd252=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0x252d[_0x31bab3];return _0x4fd382;};'use strict';var _=require(_0xd252('0x0'));var util=require(_0xd252('0x1'));var moment=require(_0xd252('0x2'));var BPromise=require('bluebird');var rs=require(_0xd252('0x3'));var fs=require('fs');var Redis=require(_0xd252('0x4'));var db=require(_0xd252('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd252('0x6'));var client=jayson['client'][_0xd252('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d7844,_0x4171d2,_0xdc2777){return new BPromise(function(_0x502bc4,_0x252335){return client[_0xd252('0x8')](_0x5d7844,_0xdc2777)['then'](function(_0x719145){logger[_0xd252('0x9')](_0xd252('0xa'),_0x4171d2,_0xd252('0xb'));logger[_0xd252('0xc')](_0xd252('0xd'),_0x4171d2,_0xd252('0xb'),JSON[_0xd252('0xe')](_0x719145));if(_0x719145[_0xd252('0xf')]){if(_0x719145[_0xd252('0xf')][_0xd252('0x10')]===0x1f4){logger['error'](_0xd252('0xa'),_0x4171d2,_0x719145['error'][_0xd252('0x11')]);return _0x252335(_0x719145['error']['message']);}logger[_0xd252('0xf')](_0xd252('0xa'),_0x4171d2,_0x719145[_0xd252('0xf')][_0xd252('0x11')]);return _0x502bc4(_0x719145['error'][_0xd252('0x11')]);}else{logger[_0xd252('0x9')](_0xd252('0xa'),_0x4171d2,_0xd252('0xb'));_0x502bc4(_0x719145[_0xd252('0x12')][_0xd252('0x11')]);}})[_0xd252('0x13')](function(_0x1098a8){logger['error'](_0xd252('0xa'),_0x4171d2,_0x1098a8);_0x252335(_0x1098a8);});});}exports[_0xd252('0x14')]=function(_0x3a56d0){var _0x696234=this;return new Promise(function(_0x1f3533,_0x56380d){return db[_0xd252('0x15')][_0xd252('0x16')]({'raw':_0x3a56d0[_0xd252('0x17')]?_0x3a56d0[_0xd252('0x17')][_0xd252('0x18')]===undefined?!![]:![]:!![],'where':_0x3a56d0[_0xd252('0x17')]?_0x3a56d0[_0xd252('0x17')][_0xd252('0x19')]||null:null,'attributes':_0x3a56d0[_0xd252('0x17')]?_0x3a56d0['options']['attributes']||null:null,'limit':_0x3a56d0[_0xd252('0x17')]?_0x3a56d0[_0xd252('0x17')][_0xd252('0x1a')]||null:null,'include':_0x3a56d0['options']?_0x3a56d0[_0xd252('0x17')][_0xd252('0x1b')]?_['map'](_0x3a56d0[_0xd252('0x17')][_0xd252('0x1b')],function(_0x1aa0fc){return{'model':db[_0x1aa0fc[_0xd252('0x1c')]],'as':_0x1aa0fc['as'],'attributes':_0x1aa0fc['attributes'],'include':_0x1aa0fc[_0xd252('0x1b')]?_[_0xd252('0x1d')](_0x1aa0fc[_0xd252('0x1b')],function(_0x485a66){return{'model':db[_0x485a66[_0xd252('0x1c')]],'as':_0x485a66['as'],'attributes':_0x485a66[_0xd252('0x1e')],'include':_0x485a66[_0xd252('0x1b')]?_[_0xd252('0x1d')](_0x485a66[_0xd252('0x1b')],function(_0x1fa12f){return{'model':db[_0x1fa12f[_0xd252('0x1c')]],'as':_0x1fa12f['as'],'attributes':_0x1fa12f['attributes']};}):[]};}):[]};}):[]:[]})[_0xd252('0x1f')](function(_0xc8e591){logger[_0xd252('0x9')]('GetSugarcrmAccount',_0x3a56d0);logger[_0xd252('0xc')]('GetSugarcrmAccount',_0x3a56d0,JSON[_0xd252('0xe')](_0xc8e591));_0x1f3533(_0xc8e591);})[_0xd252('0x13')](function(_0x1094fa){logger[_0xd252('0xf')](_0xd252('0x14'),_0x1094fa['message'],_0x3a56d0);_0x56380d(_0x696234['error'](0x1f4,_0x1094fa['message']));});});};exports[_0xd252('0x20')]=function(_0x262e0a){var _0x16cf41=this;return new Promise(function(_0x4168c2,_0x55901e){return db[_0xd252('0x15')][_0xd252('0x21')]({'raw':_0x262e0a[_0xd252('0x17')]?_0x262e0a[_0xd252('0x17')][_0xd252('0x18')]===undefined?!![]:![]:!![],'where':_0x262e0a[_0xd252('0x17')]?_0x262e0a['options'][_0xd252('0x19')]||null:null,'attributes':_0x262e0a['options']?_0x262e0a['options'][_0xd252('0x1e')]||null:null,'include':_0x262e0a['options']?_0x262e0a[_0xd252('0x17')][_0xd252('0x1b')]?_['map'](_0x262e0a[_0xd252('0x17')]['include'],function(_0x4ba764){return{'model':db[_0x4ba764[_0xd252('0x1c')]],'as':_0x4ba764['as'],'attributes':_0x4ba764[_0xd252('0x1e')],'include':_0x4ba764[_0xd252('0x1b')]?_['map'](_0x4ba764[_0xd252('0x1b')],function(_0x11b7c3){return{'model':db[_0x11b7c3['model']],'as':_0x11b7c3['as'],'attributes':_0x11b7c3[_0xd252('0x1e')],'include':_0x11b7c3['include']?_['map'](_0x11b7c3[_0xd252('0x1b')],function(_0x59fcb9){return{'model':db[_0x59fcb9[_0xd252('0x1c')]],'as':_0x59fcb9['as'],'attributes':_0x59fcb9[_0xd252('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd252('0x1f')](function(_0x42ede8){logger[_0xd252('0x9')](_0xd252('0x20'),_0x262e0a);logger['debug'](_0xd252('0x20'),_0x262e0a,JSON[_0xd252('0xe')](_0x42ede8));_0x4168c2(_0x42ede8);})['catch'](function(_0x6719d6){logger[_0xd252('0xf')](_0xd252('0x20'),_0x6719d6['message'],_0x262e0a);_0x55901e(_0x16cf41[_0xd252('0xf')](0x1f4,_0x6719d6[_0xd252('0x11')]));});});}; \ No newline at end of file +var _0x2c89=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SugarcrmAccount','findAll','options','raw','attributes','limit','include','map','model','then','GetSugarcrmAccount','debug','stringify','ShowSugarcrmAccount','find','where'];(function(_0x27f69e,_0x3efb52){var _0x19b1f7=function(_0x3ac39e){while(--_0x3ac39e){_0x27f69e['push'](_0x27f69e['shift']());}};_0x19b1f7(++_0x3efb52);}(_0x2c89,0x66));var _0x92c8=function(_0x5a84e1,_0x185db1){_0x5a84e1=_0x5a84e1-0x0;var _0x36b99a=_0x2c89[_0x5a84e1];return _0x36b99a;};'use strict';var _=require(_0x92c8('0x0'));var util=require(_0x92c8('0x1'));var moment=require(_0x92c8('0x2'));var BPromise=require(_0x92c8('0x3'));var rs=require(_0x92c8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92c8('0x5'))['db'];var utils=require(_0x92c8('0x6'));var logger=require(_0x92c8('0x7'))(_0x92c8('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3eba72,_0x160f46,_0x338489){return new BPromise(function(_0x5b1bf1,_0x1502ce){return client['request'](_0x3eba72,_0x338489)['then'](function(_0x25cf30){logger[_0x92c8('0x9')](_0x92c8('0xa'),_0x160f46,_0x92c8('0xb'));logger['debug'](_0x92c8('0xc'),_0x160f46,_0x92c8('0xb'),JSON['stringify'](_0x25cf30));if(_0x25cf30[_0x92c8('0xd')]){if(_0x25cf30[_0x92c8('0xd')][_0x92c8('0xe')]===0x1f4){logger[_0x92c8('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x160f46,_0x25cf30['error'][_0x92c8('0xf')]);return _0x1502ce(_0x25cf30['error'][_0x92c8('0xf')]);}logger['error'](_0x92c8('0xa'),_0x160f46,_0x25cf30[_0x92c8('0xd')][_0x92c8('0xf')]);return _0x5b1bf1(_0x25cf30[_0x92c8('0xd')][_0x92c8('0xf')]);}else{logger[_0x92c8('0x9')](_0x92c8('0xa'),_0x160f46,_0x92c8('0xb'));_0x5b1bf1(_0x25cf30[_0x92c8('0x10')][_0x92c8('0xf')]);}})[_0x92c8('0x11')](function(_0x27c24f){logger[_0x92c8('0xd')](_0x92c8('0xa'),_0x160f46,_0x27c24f);_0x1502ce(_0x27c24f);});});}exports['GetSugarcrmAccount']=function(_0x4b8820){var _0x986d14=this;return new Promise(function(_0x5a7679,_0x46268f){return db[_0x92c8('0x12')][_0x92c8('0x13')]({'raw':_0x4b8820[_0x92c8('0x14')]?_0x4b8820[_0x92c8('0x14')][_0x92c8('0x15')]===undefined?!![]:![]:!![],'where':_0x4b8820[_0x92c8('0x14')]?_0x4b8820['options']['where']||null:null,'attributes':_0x4b8820[_0x92c8('0x14')]?_0x4b8820['options'][_0x92c8('0x16')]||null:null,'limit':_0x4b8820[_0x92c8('0x14')]?_0x4b8820[_0x92c8('0x14')][_0x92c8('0x17')]||null:null,'include':_0x4b8820[_0x92c8('0x14')]?_0x4b8820['options'][_0x92c8('0x18')]?_['map'](_0x4b8820[_0x92c8('0x14')][_0x92c8('0x18')],function(_0x253f6d){return{'model':db[_0x253f6d['model']],'as':_0x253f6d['as'],'attributes':_0x253f6d['attributes'],'include':_0x253f6d[_0x92c8('0x18')]?_[_0x92c8('0x19')](_0x253f6d[_0x92c8('0x18')],function(_0x42e3ef){return{'model':db[_0x42e3ef[_0x92c8('0x1a')]],'as':_0x42e3ef['as'],'attributes':_0x42e3ef['attributes'],'include':_0x42e3ef[_0x92c8('0x18')]?_[_0x92c8('0x19')](_0x42e3ef[_0x92c8('0x18')],function(_0x16439d){return{'model':db[_0x16439d[_0x92c8('0x1a')]],'as':_0x16439d['as'],'attributes':_0x16439d['attributes']};}):[]};}):[]};}):[]:[]})[_0x92c8('0x1b')](function(_0x274b9a){logger[_0x92c8('0x9')](_0x92c8('0x1c'),_0x4b8820);logger[_0x92c8('0x1d')](_0x92c8('0x1c'),_0x4b8820,JSON[_0x92c8('0x1e')](_0x274b9a));_0x5a7679(_0x274b9a);})[_0x92c8('0x11')](function(_0x23f599){logger[_0x92c8('0xd')](_0x92c8('0x1c'),_0x23f599[_0x92c8('0xf')],_0x4b8820);_0x46268f(_0x986d14['error'](0x1f4,_0x23f599['message']));});});};exports[_0x92c8('0x1f')]=function(_0x3ee754){var _0x1cfac2=this;return new Promise(function(_0x18d1e7,_0x196037){return db[_0x92c8('0x12')][_0x92c8('0x20')]({'raw':_0x3ee754[_0x92c8('0x14')]?_0x3ee754['options']['raw']===undefined?!![]:![]:!![],'where':_0x3ee754[_0x92c8('0x14')]?_0x3ee754[_0x92c8('0x14')][_0x92c8('0x21')]||null:null,'attributes':_0x3ee754[_0x92c8('0x14')]?_0x3ee754[_0x92c8('0x14')][_0x92c8('0x16')]||null:null,'include':_0x3ee754[_0x92c8('0x14')]?_0x3ee754['options'][_0x92c8('0x18')]?_[_0x92c8('0x19')](_0x3ee754[_0x92c8('0x14')][_0x92c8('0x18')],function(_0x435e9b){return{'model':db[_0x435e9b['model']],'as':_0x435e9b['as'],'attributes':_0x435e9b[_0x92c8('0x16')],'include':_0x435e9b['include']?_[_0x92c8('0x19')](_0x435e9b[_0x92c8('0x18')],function(_0x14cc1f){return{'model':db[_0x14cc1f[_0x92c8('0x1a')]],'as':_0x14cc1f['as'],'attributes':_0x14cc1f[_0x92c8('0x16')],'include':_0x14cc1f[_0x92c8('0x18')]?_[_0x92c8('0x19')](_0x14cc1f['include'],function(_0x24bea1){return{'model':db[_0x24bea1[_0x92c8('0x1a')]],'as':_0x24bea1['as'],'attributes':_0x24bea1[_0x92c8('0x16')]};}):[]};}):[]};}):[]:[]})[_0x92c8('0x1b')](function(_0x190d7c){logger[_0x92c8('0x9')](_0x92c8('0x1f'),_0x3ee754);logger[_0x92c8('0x1d')]('ShowSugarcrmAccount',_0x3ee754,JSON['stringify'](_0x190d7c));_0x18d1e7(_0x190d7c);})['catch'](function(_0x15c351){logger['error']('ShowSugarcrmAccount',_0x15c351[_0x92c8('0xf')],_0x3ee754);_0x196037(_0x1cfac2[_0x92c8('0xd')](0x1f4,_0x15c351['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 03bcd83..9575c89 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 _0x6341=['put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x6341,0xc4));var _0x1634=function(_0x32947c,_0x14f481){_0x32947c=_0x32947c-0x0;var _0x22f64f=_0x6341[_0x32947c];return _0x22f64f;};'use strict';var multer=require(_0x1634('0x0'));var util=require(_0x1634('0x1'));var path=require(_0x1634('0x2'));var timeout=require(_0x1634('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1634('0x4'));var auth=require(_0x1634('0x5'));var interaction=require(_0x1634('0x6'));var config=require(_0x1634('0x7'));var controller=require(_0x1634('0x8'));router[_0x1634('0x9')]('/',auth[_0x1634('0xa')](),controller[_0x1634('0xb')]);router[_0x1634('0x9')](_0x1634('0xc'),auth[_0x1634('0xa')](),controller[_0x1634('0xd')]);router[_0x1634('0x9')](_0x1634('0xe'),auth[_0x1634('0xa')](),controller['getFields']);router['get'](_0x1634('0xf'),auth[_0x1634('0xa')](),controller[_0x1634('0x10')]);router[_0x1634('0x9')](_0x1634('0x11'),auth[_0x1634('0xa')](),controller[_0x1634('0x12')]);router[_0x1634('0x13')]('/',auth[_0x1634('0xa')](),controller['create']);router[_0x1634('0x14')](_0x1634('0xc'),auth['isAuthenticated'](),controller[_0x1634('0x15')]);router[_0x1634('0x16')](_0x1634('0xc'),auth[_0x1634('0xa')](),controller[_0x1634('0x17')]);module['exports']=router; \ No newline at end of file +var _0x052c=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete'];(function(_0x365a5e,_0x80fe01){var _0x3aeb5c=function(_0x59c88e){while(--_0x59c88e){_0x365a5e['push'](_0x365a5e['shift']());}};_0x3aeb5c(++_0x80fe01);}(_0x052c,0x16a));var _0xc052=function(_0x4dd623,_0x315d08){_0x4dd623=_0x4dd623-0x0;var _0x11e713=_0x052c[_0x4dd623];return _0x11e713;};'use strict';var multer=require('multer');var util=require(_0xc052('0x0'));var path=require(_0xc052('0x1'));var timeout=require(_0xc052('0x2'));var express=require(_0xc052('0x3'));var router=express[_0xc052('0x4')]();var fs_extra=require(_0xc052('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc052('0x6'));var config=require(_0xc052('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xc052('0x8')]('/',auth['isAuthenticated'](),controller[_0xc052('0x9')]);router[_0xc052('0x8')](_0xc052('0xa'),auth[_0xc052('0xb')](),controller['show']);router[_0xc052('0x8')]('/:id/fields',auth[_0xc052('0xb')](),controller[_0xc052('0xc')]);router['get'](_0xc052('0xd'),auth['isAuthenticated'](),controller[_0xc052('0xe')]);router[_0xc052('0x8')](_0xc052('0xf'),auth[_0xc052('0xb')](),controller[_0xc052('0x10')]);router[_0xc052('0x11')]('/',auth['isAuthenticated'](),controller[_0xc052('0x12')]);router[_0xc052('0x13')](_0xc052('0xa'),auth['isAuthenticated'](),controller[_0xc052('0x14')]);router[_0xc052('0x15')]('/:id',auth[_0xc052('0xb')](),controller[_0xc052('0x16')]);module[_0xc052('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 7faf84e..d8c88ea 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 _0x8e25=['sequelize','exports','STRING'];(function(_0x34760d,_0x1535d8){var _0x5e1099=function(_0x1be04d){while(--_0x1be04d){_0x34760d['push'](_0x34760d['shift']());}};_0x5e1099(++_0x1535d8);}(_0x8e25,0x150));var _0x58e2=function(_0x153539,_0x524dc9){_0x153539=_0x153539-0x0;var _0x5f1342=_0x8e25[_0x153539];return _0x5f1342;};'use strict';var Sequelize=require(_0x58e2('0x0'));module[_0x58e2('0x1')]={'name':{'type':Sequelize[_0x58e2('0x2')]},'description':{'type':Sequelize[_0x58e2('0x2')]}}; \ No newline at end of file +var _0xe75e=['sequelize','exports','STRING'];(function(_0x310a1b,_0x4c9129){var _0xdea206=function(_0x1f1e8d){while(--_0x1f1e8d){_0x310a1b['push'](_0x310a1b['shift']());}};_0xdea206(++_0x4c9129);}(_0xe75e,0x1e6));var _0xee75=function(_0x2390bd,_0x212fbd){_0x2390bd=_0x2390bd-0x0;var _0x3a969d=_0xe75e[_0x2390bd];return _0x3a969d;};'use strict';var Sequelize=require(_0xee75('0x0'));module[_0xee75('0x1')]={'name':{'type':Sequelize[_0xee75('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 1abe863..3a9e714 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 _0xec0c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','map','SugarcrmConfiguration','fieldName','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','fields','find','create','body','findOne','SugarcrmField','hasOwnProperty','getFields','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x386b03,_0x5d0000){var _0xd3d524=function(_0x474754){while(--_0x474754){_0x386b03['push'](_0x386b03['shift']());}};_0xd3d524(++_0x5d0000);}(_0xec0c,0x130));var _0xcec0=function(_0x235bac,_0x2cde1b){_0x235bac=_0x235bac-0x0;var _0x2979f8=_0xec0c[_0x235bac];return _0x2979f8;};'use strict';var emlformat=require(_0xcec0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcec0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcec0('0x2'));var moment=require(_0xcec0('0x3'));var BPromise=require(_0xcec0('0x4'));var Mustache=require('mustache');var util=require(_0xcec0('0x5'));var path=require(_0xcec0('0x6'));var sox=require('sox');var csv=require(_0xcec0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcec0('0x8'));var _=require(_0xcec0('0x9'));var squel=require(_0xcec0('0xa'));var crypto=require(_0xcec0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcec0('0xc'));var toCsv=require(_0xcec0('0x7'));var querystring=require('querystring');var Papa=require(_0xcec0('0xd'));var Redis=require(_0xcec0('0xe'));var authService=require(_0xcec0('0xf'));var qs=require(_0xcec0('0x10'));var as=require(_0xcec0('0x11'));var hardwareService=require(_0xcec0('0x12'));var logger=require(_0xcec0('0x13'))(_0xcec0('0x14'));var utils=require('../../config/utils');var config=require(_0xcec0('0x15'));var licenseUtil=require(_0xcec0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x384f4b,_0x2ae504){_0x2ae504=_0x2ae504||0xcc;return function(_0x158e15){if(_0x158e15){return _0x384f4b[_0xcec0('0x17')](_0x2ae504);}return _0x384f4b[_0xcec0('0x18')](_0x2ae504)['end']();};}function respondWithResult(_0x381ed4,_0x1d3938){_0x1d3938=_0x1d3938||0xc8;return function(_0x5655b1){if(_0x5655b1){return _0x381ed4[_0xcec0('0x18')](_0x1d3938)[_0xcec0('0x19')](_0x5655b1);}};}function respondWithFilteredResult(_0x143545,_0x1822ff){return function(_0x5a913d){if(_0x5a913d){var _0x8362b8=typeof _0x1822ff[_0xcec0('0x1a')]===_0xcec0('0x1b')&&typeof _0x1822ff['limit']===_0xcec0('0x1b');var _0x39c7ec=_0x5a913d['count'];var _0x411053=_0x8362b8?0x0:_0x1822ff['offset'];var _0x3068cd=_0x8362b8?_0x5a913d[_0xcec0('0x1c')]:_0x1822ff[_0xcec0('0x1a')]+_0x1822ff[_0xcec0('0x1d')];var _0x3673e0;if(_0x3068cd>=_0x39c7ec){_0x3068cd=_0x39c7ec;_0x3673e0=0xc8;}else{_0x3673e0=0xce;}_0x143545[_0xcec0('0x18')](_0x3673e0);return _0x143545[_0xcec0('0x1e')]('Content-Range',_0x411053+'-'+_0x3068cd+'/'+_0x39c7ec)[_0xcec0('0x19')](_0x5a913d);}return null;};}function patchUpdates(_0x44c9e7){return function(_0x13e75e){try{jsonpatch[_0xcec0('0x1f')](_0x13e75e,_0x44c9e7,!![]);}catch(_0x343b85){return BPromise[_0xcec0('0x20')](_0x343b85);}return _0x13e75e[_0xcec0('0x21')]();};}function saveUpdates(_0x5acd09,_0x2ff633){return function(_0x4e1697){if(_0x4e1697){return _0x4e1697[_0xcec0('0x22')](_0x5acd09)[_0xcec0('0x23')](function(_0x475551){return _0x475551;});}return null;};}function removeEntity(_0x2df622,_0x23cf96){return function(_0x2eb117){if(_0x2eb117){return _0x2eb117[_0xcec0('0x24')]()[_0xcec0('0x23')](function(){_0x2df622['status'](0xcc)[_0xcec0('0x25')]();});}};}function handleEntityNotFound(_0x2d859f,_0x43f6f0){return function(_0xd142fa){if(!_0xd142fa){_0x2d859f[_0xcec0('0x17')](0x194);}return _0xd142fa;};}function handleError(_0x5bc5f9,_0x936ed7){_0x936ed7=_0x936ed7||0x1f4;return function(_0x42f9cf){logger[_0xcec0('0x26')](_0x42f9cf[_0xcec0('0x27')]);if(_0x42f9cf[_0xcec0('0x28')]){delete _0x42f9cf[_0xcec0('0x28')];}_0x5bc5f9[_0xcec0('0x18')](_0x936ed7)['send'](_0x42f9cf);};}exports['index']=function(_0x2e406e,_0x4023cc){var _0x1dec3={},_0x356934={},_0x201b99={'count':0x0,'rows':[]};var _0x5425e3=_[_0xcec0('0x29')](db[_0xcec0('0x2a')]['rawAttributes'],function(_0x21c0db){return{'name':_0x21c0db[_0xcec0('0x2b')],'type':_0x21c0db['type'][_0xcec0('0x2c')]};});_0x356934['model']=_[_0xcec0('0x29')](_0x5425e3,_0xcec0('0x28'));_0x356934['query']=_['keys'](_0x2e406e[_0xcec0('0x2d')]);_0x356934[_0xcec0('0x2e')]=_[_0xcec0('0x2f')](_0x356934[_0xcec0('0x30')],_0x356934['query']);_0x1dec3['attributes']=_[_0xcec0('0x2f')](_0x356934[_0xcec0('0x30')],qs['fields'](_0x2e406e['query']['fields']));_0x1dec3[_0xcec0('0x31')]=_0x1dec3[_0xcec0('0x31')][_0xcec0('0x32')]?_0x1dec3['attributes']:_0x356934[_0xcec0('0x30')];if(!_0x2e406e['query']['hasOwnProperty'](_0xcec0('0x33'))){_0x1dec3[_0xcec0('0x1d')]=qs[_0xcec0('0x1d')](_0x2e406e[_0xcec0('0x2d')][_0xcec0('0x1d')]);_0x1dec3[_0xcec0('0x1a')]=qs[_0xcec0('0x1a')](_0x2e406e['query']['offset']);}_0x1dec3[_0xcec0('0x34')]=qs[_0xcec0('0x35')](_0x2e406e[_0xcec0('0x2d')][_0xcec0('0x35')]);_0x1dec3[_0xcec0('0x36')]=qs[_0xcec0('0x2e')](_[_0xcec0('0x37')](_0x2e406e[_0xcec0('0x2d')],_0x356934[_0xcec0('0x2e')]),_0x5425e3);if(_0x2e406e[_0xcec0('0x2d')][_0xcec0('0x38')]){_0x1dec3[_0xcec0('0x36')]=_[_0xcec0('0x39')](_0x1dec3[_0xcec0('0x36')],{'$or':_['map'](_0x5425e3,function(_0x451915){if(_0x451915[_0xcec0('0x3a')]!==_0xcec0('0x3b')){var _0x1841d1={};_0x1841d1[_0x451915[_0xcec0('0x28')]]={'$like':'%'+_0x2e406e[_0xcec0('0x2d')][_0xcec0('0x38')]+'%'};return _0x1841d1;}})});}_0x1dec3=_[_0xcec0('0x39')]({},_0x1dec3,_0x2e406e[_0xcec0('0x3c')]);var _0x366c95={'where':_0x1dec3[_0xcec0('0x36')]};return db['SugarcrmConfiguration'][_0xcec0('0x1c')](_0x366c95)['then'](function(_0x28d6c7){_0x201b99[_0xcec0('0x1c')]=_0x28d6c7;if(_0x2e406e[_0xcec0('0x2d')][_0xcec0('0x3d')]){_0x1dec3[_0xcec0('0x3e')]=[{'all':!![]}];}return db[_0xcec0('0x2a')][_0xcec0('0x3f')](_0x1dec3);})['then'](function(_0x14147b){_0x201b99[_0xcec0('0x40')]=_0x14147b;return _0x201b99;})['then'](respondWithFilteredResult(_0x4023cc,_0x1dec3))[_0xcec0('0x41')](handleError(_0x4023cc,null));};exports[_0xcec0('0x42')]=function(_0x1dc3c2,_0x5b9161){var _0x577bbc={'raw':![],'where':{'id':_0x1dc3c2[_0xcec0('0x43')]['id']}},_0x17840a={};_0x17840a['model']=_[_0xcec0('0x44')](db[_0xcec0('0x2a')][_0xcec0('0x45')]);_0x17840a[_0xcec0('0x2d')]=_[_0xcec0('0x44')](_0x1dc3c2[_0xcec0('0x2d')]);_0x17840a[_0xcec0('0x2e')]=_[_0xcec0('0x2f')](_0x17840a[_0xcec0('0x30')],_0x17840a['query']);_0x577bbc[_0xcec0('0x31')]=_[_0xcec0('0x2f')](_0x17840a[_0xcec0('0x30')],qs[_0xcec0('0x46')](_0x1dc3c2[_0xcec0('0x2d')][_0xcec0('0x46')]));_0x577bbc[_0xcec0('0x31')]=_0x577bbc[_0xcec0('0x31')]['length']?_0x577bbc['attributes']:_0x17840a[_0xcec0('0x30')];if(_0x1dc3c2[_0xcec0('0x2d')][_0xcec0('0x3d')]){_0x577bbc[_0xcec0('0x3e')]=[{'all':!![]}];}_0x577bbc=_['merge']({},_0x577bbc,_0x1dc3c2[_0xcec0('0x3c')]);return db['SugarcrmConfiguration'][_0xcec0('0x47')](_0x577bbc)[_0xcec0('0x23')](handleEntityNotFound(_0x5b9161,null))[_0xcec0('0x23')](respondWithResult(_0x5b9161,null))[_0xcec0('0x41')](handleError(_0x5b9161,null));};exports['create']=function(_0x1b2480,_0x4cb03a){return db[_0xcec0('0x2a')][_0xcec0('0x48')](_0x1b2480[_0xcec0('0x49')],{})[_0xcec0('0x23')](respondWithResult(_0x4cb03a,0xc9))[_0xcec0('0x41')](handleError(_0x4cb03a,null));};exports[_0xcec0('0x22')]=function(_0x941202,_0x5538cf){if(_0x941202['body']['id']){delete _0x941202[_0xcec0('0x49')]['id'];}return db[_0xcec0('0x2a')]['find']({'where':{'id':_0x941202[_0xcec0('0x43')]['id']}})[_0xcec0('0x23')](handleEntityNotFound(_0x5538cf,null))[_0xcec0('0x23')](saveUpdates(_0x941202['body'],null))[_0xcec0('0x23')](respondWithResult(_0x5538cf,null))[_0xcec0('0x41')](handleError(_0x5538cf,null));};exports[_0xcec0('0x24')]=function(_0x4c86ca,_0x40ada9){return db[_0xcec0('0x2a')][_0xcec0('0x47')]({'where':{'id':_0x4c86ca[_0xcec0('0x43')]['id']}})[_0xcec0('0x23')](handleEntityNotFound(_0x40ada9,null))[_0xcec0('0x23')](removeEntity(_0x40ada9,null))['catch'](handleError(_0x40ada9,null));};exports['getFields']=function(_0x5bbab1,_0x2ad327,_0x18ac48){var _0x5a69e9={};var _0x455dee={};var _0x5ee300;var _0x378501;return db[_0xcec0('0x2a')][_0xcec0('0x4a')]({'where':{'id':_0x5bbab1[_0xcec0('0x43')]['id']}})[_0xcec0('0x23')](handleEntityNotFound(_0x2ad327,null))[_0xcec0('0x23')](function(_0x508bfd){if(_0x508bfd){_0x5ee300=_0x508bfd;_0x455dee[_0xcec0('0x30')]=_['keys'](db[_0xcec0('0x4b')][_0xcec0('0x45')]);_0x455dee[_0xcec0('0x2d')]=_[_0xcec0('0x44')](_0x5bbab1[_0xcec0('0x2d')]);_0x455dee[_0xcec0('0x2e')]=_[_0xcec0('0x2f')](_0x455dee['model'],_0x455dee[_0xcec0('0x2d')]);_0x5a69e9[_0xcec0('0x31')]=_[_0xcec0('0x2f')](_0x455dee[_0xcec0('0x30')],qs['fields'](_0x5bbab1[_0xcec0('0x2d')][_0xcec0('0x46')]));_0x5a69e9['attributes']=_0x5a69e9[_0xcec0('0x31')][_0xcec0('0x32')]?_0x5a69e9[_0xcec0('0x31')]:_0x455dee[_0xcec0('0x30')];_0x5a69e9[_0xcec0('0x34')]=qs['sort'](_0x5bbab1[_0xcec0('0x2d')][_0xcec0('0x35')]);_0x5a69e9[_0xcec0('0x36')]=qs[_0xcec0('0x2e')](_[_0xcec0('0x37')](_0x5bbab1[_0xcec0('0x2d')],_0x455dee[_0xcec0('0x2e')]));if(_0x5bbab1[_0xcec0('0x2d')][_0xcec0('0x38')]){_0x5a69e9['where']=_[_0xcec0('0x39')](_0x5a69e9[_0xcec0('0x36')],{'$or':_[_0xcec0('0x29')](_0x5a69e9[_0xcec0('0x31')],function(_0x2ddd9c){var _0x33ce6c={};_0x33ce6c[_0x2ddd9c]={'$like':'%'+_0x5bbab1[_0xcec0('0x2d')][_0xcec0('0x38')]+'%'};return _0x33ce6c;})});}_0x5a69e9=_[_0xcec0('0x39')]({},_0x5a69e9,_0x5bbab1['options']);return _0x5ee300['getFields'](_0x5a69e9);}})[_0xcec0('0x23')](function(_0x1c35b7){if(_0x1c35b7){_0x378501=_0x1c35b7['length'];if(!_0x5bbab1[_0xcec0('0x2d')][_0xcec0('0x4c')](_0xcec0('0x33'))){_0x5a69e9[_0xcec0('0x1d')]=qs[_0xcec0('0x1d')](_0x5bbab1['query'][_0xcec0('0x1d')]);_0x5a69e9[_0xcec0('0x1a')]=qs[_0xcec0('0x1a')](_0x5bbab1['query'][_0xcec0('0x1a')]);}return _0x5ee300[_0xcec0('0x4d')](_0x5a69e9);}})[_0xcec0('0x23')](function(_0x4e5017){if(_0x4e5017){return _0x4e5017?{'count':_0x378501,'rows':_0x4e5017}:null;}})['then'](respondWithResult(_0x2ad327,null))[_0xcec0('0x41')](handleError(_0x2ad327,null));};exports['getSubjects']=function(_0xca9cd7,_0x47c8bb,_0x2c973a){var _0x5b80bf={};var _0x376692={};var _0x5c3b03;var _0x4a6f64;return db[_0xcec0('0x2a')][_0xcec0('0x4a')]({'where':{'id':_0xca9cd7[_0xcec0('0x43')]['id']}})[_0xcec0('0x23')](handleEntityNotFound(_0x47c8bb,null))[_0xcec0('0x23')](function(_0x43fffb){if(_0x43fffb){_0x5c3b03=_0x43fffb;_0x376692[_0xcec0('0x30')]=_[_0xcec0('0x44')](db[_0xcec0('0x4b')]['rawAttributes']);_0x376692['query']=_[_0xcec0('0x44')](_0xca9cd7['query']);_0x376692[_0xcec0('0x2e')]=_[_0xcec0('0x2f')](_0x376692[_0xcec0('0x30')],_0x376692['query']);_0x5b80bf[_0xcec0('0x31')]=_['intersection'](_0x376692[_0xcec0('0x30')],qs[_0xcec0('0x46')](_0xca9cd7[_0xcec0('0x2d')][_0xcec0('0x46')]));_0x5b80bf[_0xcec0('0x31')]=_0x5b80bf[_0xcec0('0x31')][_0xcec0('0x32')]?_0x5b80bf[_0xcec0('0x31')]:_0x376692[_0xcec0('0x30')];_0x5b80bf[_0xcec0('0x34')]=qs[_0xcec0('0x35')](_0xca9cd7[_0xcec0('0x2d')][_0xcec0('0x35')]);_0x5b80bf[_0xcec0('0x36')]=qs[_0xcec0('0x2e')](_[_0xcec0('0x37')](_0xca9cd7[_0xcec0('0x2d')],_0x376692[_0xcec0('0x2e')]));if(_0xca9cd7[_0xcec0('0x2d')][_0xcec0('0x38')]){_0x5b80bf['where']=_[_0xcec0('0x39')](_0x5b80bf[_0xcec0('0x36')],{'$or':_[_0xcec0('0x29')](_0x5b80bf['attributes'],function(_0x3f41b8){var _0x488fb8={};_0x488fb8[_0x3f41b8]={'$like':'%'+_0xca9cd7[_0xcec0('0x2d')][_0xcec0('0x38')]+'%'};return _0x488fb8;})});}_0x5b80bf=_['merge']({},_0x5b80bf,_0xca9cd7['options']);return _0x5c3b03['getSubjects'](_0x5b80bf);}})[_0xcec0('0x23')](function(_0xb2952b){if(_0xb2952b){_0x4a6f64=_0xb2952b[_0xcec0('0x32')];if(!_0xca9cd7[_0xcec0('0x2d')][_0xcec0('0x4c')](_0xcec0('0x33'))){_0x5b80bf['limit']=qs[_0xcec0('0x1d')](_0xca9cd7[_0xcec0('0x2d')][_0xcec0('0x1d')]);_0x5b80bf['offset']=qs[_0xcec0('0x1a')](_0xca9cd7['query']['offset']);}return _0x5c3b03[_0xcec0('0x4e')](_0x5b80bf);}})['then'](function(_0x13fc9b){if(_0x13fc9b){return _0x13fc9b?{'count':_0x4a6f64,'rows':_0x13fc9b}:null;}})[_0xcec0('0x23')](respondWithResult(_0x47c8bb,null))[_0xcec0('0x41')](handleError(_0x47c8bb,null));};exports['getDescriptions']=function(_0x832d42,_0x5e0b2a,_0x34e415){var _0x4af884={};var _0x198895={};var _0x47b3b5;var _0x371e08;return db['SugarcrmConfiguration'][_0xcec0('0x4a')]({'where':{'id':_0x832d42['params']['id']}})[_0xcec0('0x23')](handleEntityNotFound(_0x5e0b2a,null))[_0xcec0('0x23')](function(_0x3a9519){if(_0x3a9519){_0x47b3b5=_0x3a9519;_0x198895[_0xcec0('0x30')]=_['keys'](db[_0xcec0('0x4b')][_0xcec0('0x45')]);_0x198895[_0xcec0('0x2d')]=_[_0xcec0('0x44')](_0x832d42[_0xcec0('0x2d')]);_0x198895[_0xcec0('0x2e')]=_[_0xcec0('0x2f')](_0x198895[_0xcec0('0x30')],_0x198895[_0xcec0('0x2d')]);_0x4af884['attributes']=_[_0xcec0('0x2f')](_0x198895['model'],qs[_0xcec0('0x46')](_0x832d42[_0xcec0('0x2d')]['fields']));_0x4af884[_0xcec0('0x31')]=_0x4af884[_0xcec0('0x31')]['length']?_0x4af884[_0xcec0('0x31')]:_0x198895[_0xcec0('0x30')];_0x4af884[_0xcec0('0x34')]=qs[_0xcec0('0x35')](_0x832d42['query'][_0xcec0('0x35')]);_0x4af884[_0xcec0('0x36')]=qs['filters'](_[_0xcec0('0x37')](_0x832d42[_0xcec0('0x2d')],_0x198895[_0xcec0('0x2e')]));if(_0x832d42[_0xcec0('0x2d')][_0xcec0('0x38')]){_0x4af884[_0xcec0('0x36')]=_[_0xcec0('0x39')](_0x4af884[_0xcec0('0x36')],{'$or':_['map'](_0x4af884[_0xcec0('0x31')],function(_0xe985a){var _0x1508b4={};_0x1508b4[_0xe985a]={'$like':'%'+_0x832d42[_0xcec0('0x2d')][_0xcec0('0x38')]+'%'};return _0x1508b4;})});}_0x4af884=_[_0xcec0('0x39')]({},_0x4af884,_0x832d42[_0xcec0('0x3c')]);return _0x47b3b5[_0xcec0('0x4f')](_0x4af884);}})['then'](function(_0x441726){if(_0x441726){_0x371e08=_0x441726[_0xcec0('0x32')];if(!_0x832d42[_0xcec0('0x2d')][_0xcec0('0x4c')](_0xcec0('0x33'))){_0x4af884['limit']=qs['limit'](_0x832d42['query'][_0xcec0('0x1d')]);_0x4af884['offset']=qs[_0xcec0('0x1a')](_0x832d42['query'][_0xcec0('0x1a')]);}return _0x47b3b5['getDescriptions'](_0x4af884);}})['then'](function(_0x56a2f9){if(_0x56a2f9){return _0x56a2f9?{'count':_0x371e08,'rows':_0x56a2f9}:null;}})[_0xcec0('0x23')](respondWithResult(_0x5e0b2a,null))[_0xcec0('0x41')](handleError(_0x5e0b2a,null));}; \ No newline at end of file +var _0x48f8=['bluebird','path','sox','to-csv','lodash','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','apply','reject','update','then','destroy','end','error','stack','send','index','SugarcrmConfiguration','rawAttributes','fieldName','model','map','name','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','create','body','getFields','SugarcrmField','order','hasOwnProperty','getSubjects','findOne','nolimit','getDescriptions','eml-format','zip-dir','fast-json-patch','moment'];(function(_0x36efe5,_0xa5b862){var _0x33181c=function(_0x518122){while(--_0x518122){_0x36efe5['push'](_0x36efe5['shift']());}};_0x33181c(++_0xa5b862);}(_0x48f8,0x1ac));var _0x848f=function(_0x479b99,_0x1e5bec){_0x479b99=_0x479b99-0x0;var _0x1e7eb7=_0x48f8[_0x479b99];return _0x1e7eb7;};'use strict';var emlformat=require(_0x848f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x848f('0x1'));var jsonpatch=require(_0x848f('0x2'));var rp=require('request-promise');var moment=require(_0x848f('0x3'));var BPromise=require(_0x848f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x848f('0x5'));var sox=require(_0x848f('0x6'));var csv=require(_0x848f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x848f('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x848f('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x848f('0xa'));var Redis=require('ioredis');var authService=require(_0x848f('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x848f('0xc'));var hardwareService=require(_0x848f('0xd'));var logger=require(_0x848f('0xe'))(_0x848f('0xf'));var utils=require(_0x848f('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x848f('0x11'));var db=require(_0x848f('0x12'))['db'];function respondWithStatusCode(_0x3403b1,_0x45e272){_0x45e272=_0x45e272||0xcc;return function(_0x643d55){if(_0x643d55){return _0x3403b1[_0x848f('0x13')](_0x45e272);}return _0x3403b1[_0x848f('0x14')](_0x45e272)['end']();};}function respondWithResult(_0x4af537,_0x351000){_0x351000=_0x351000||0xc8;return function(_0x4a997c){if(_0x4a997c){return _0x4af537[_0x848f('0x14')](_0x351000)[_0x848f('0x15')](_0x4a997c);}};}function respondWithFilteredResult(_0x576397,_0x5cc6cc){return function(_0x437077){if(_0x437077){var _0xd9c4f3=typeof _0x5cc6cc['offset']===_0x848f('0x16')&&typeof _0x5cc6cc[_0x848f('0x17')]===_0x848f('0x16');var _0x199e8e=_0x437077[_0x848f('0x18')];var _0x3339fb=_0xd9c4f3?0x0:_0x5cc6cc[_0x848f('0x19')];var _0x57b65a=_0xd9c4f3?_0x437077[_0x848f('0x18')]:_0x5cc6cc[_0x848f('0x19')]+_0x5cc6cc[_0x848f('0x17')];var _0x23696c;if(_0x57b65a>=_0x199e8e){_0x57b65a=_0x199e8e;_0x23696c=0xc8;}else{_0x23696c=0xce;}_0x576397[_0x848f('0x14')](_0x23696c);return _0x576397['set']('Content-Range',_0x3339fb+'-'+_0x57b65a+'/'+_0x199e8e)['json'](_0x437077);}return null;};}function patchUpdates(_0x6da20a){return function(_0x4d9860){try{jsonpatch[_0x848f('0x1a')](_0x4d9860,_0x6da20a,!![]);}catch(_0x5578b3){return BPromise[_0x848f('0x1b')](_0x5578b3);}return _0x4d9860['save']();};}function saveUpdates(_0x29aa6d,_0x319929){return function(_0x20e7bf){if(_0x20e7bf){return _0x20e7bf[_0x848f('0x1c')](_0x29aa6d)[_0x848f('0x1d')](function(_0x5487ef){return _0x5487ef;});}return null;};}function removeEntity(_0x130bbb,_0x2733fc){return function(_0x302b6a){if(_0x302b6a){return _0x302b6a[_0x848f('0x1e')]()[_0x848f('0x1d')](function(){_0x130bbb[_0x848f('0x14')](0xcc)[_0x848f('0x1f')]();});}};}function handleEntityNotFound(_0x47ef9a,_0x43dc4f){return function(_0x20475b){if(!_0x20475b){_0x47ef9a[_0x848f('0x13')](0x194);}return _0x20475b;};}function handleError(_0x24f7b1,_0x17716a){_0x17716a=_0x17716a||0x1f4;return function(_0x4f5338){logger[_0x848f('0x20')](_0x4f5338[_0x848f('0x21')]);if(_0x4f5338['name']){delete _0x4f5338['name'];}_0x24f7b1[_0x848f('0x14')](_0x17716a)[_0x848f('0x22')](_0x4f5338);};}exports[_0x848f('0x23')]=function(_0x4ac644,_0x48b3eb){var _0x59c731={},_0x23603d={},_0x5bab36={'count':0x0,'rows':[]};var _0x3d88d6=_['map'](db[_0x848f('0x24')][_0x848f('0x25')],function(_0x4fee58){return{'name':_0x4fee58[_0x848f('0x26')],'type':_0x4fee58['type']['key']};});_0x23603d[_0x848f('0x27')]=_[_0x848f('0x28')](_0x3d88d6,_0x848f('0x29'));_0x23603d[_0x848f('0x2a')]=_[_0x848f('0x2b')](_0x4ac644[_0x848f('0x2a')]);_0x23603d[_0x848f('0x2c')]=_[_0x848f('0x2d')](_0x23603d[_0x848f('0x27')],_0x23603d[_0x848f('0x2a')]);_0x59c731[_0x848f('0x2e')]=_[_0x848f('0x2d')](_0x23603d[_0x848f('0x27')],qs['fields'](_0x4ac644[_0x848f('0x2a')][_0x848f('0x2f')]));_0x59c731['attributes']=_0x59c731['attributes'][_0x848f('0x30')]?_0x59c731['attributes']:_0x23603d[_0x848f('0x27')];if(!_0x4ac644[_0x848f('0x2a')]['hasOwnProperty']('nolimit')){_0x59c731['limit']=qs[_0x848f('0x17')](_0x4ac644['query'][_0x848f('0x17')]);_0x59c731['offset']=qs[_0x848f('0x19')](_0x4ac644[_0x848f('0x2a')][_0x848f('0x19')]);}_0x59c731['order']=qs['sort'](_0x4ac644['query'][_0x848f('0x31')]);_0x59c731[_0x848f('0x32')]=qs['filters'](_[_0x848f('0x33')](_0x4ac644[_0x848f('0x2a')],_0x23603d[_0x848f('0x2c')]),_0x3d88d6);if(_0x4ac644[_0x848f('0x2a')][_0x848f('0x34')]){_0x59c731[_0x848f('0x32')]=_[_0x848f('0x35')](_0x59c731[_0x848f('0x32')],{'$or':_[_0x848f('0x28')](_0x3d88d6,function(_0x312bb7){if(_0x312bb7['type']!=='VIRTUAL'){var _0x2b7536={};_0x2b7536[_0x312bb7[_0x848f('0x29')]]={'$like':'%'+_0x4ac644['query'][_0x848f('0x34')]+'%'};return _0x2b7536;}})});}_0x59c731=_[_0x848f('0x35')]({},_0x59c731,_0x4ac644['options']);var _0x374692={'where':_0x59c731[_0x848f('0x32')]};return db['SugarcrmConfiguration'][_0x848f('0x18')](_0x374692)[_0x848f('0x1d')](function(_0x281c66){_0x5bab36[_0x848f('0x18')]=_0x281c66;if(_0x4ac644['query'][_0x848f('0x36')]){_0x59c731[_0x848f('0x37')]=[{'all':!![]}];}return db[_0x848f('0x24')]['findAll'](_0x59c731);})['then'](function(_0x2c7d16){_0x5bab36[_0x848f('0x38')]=_0x2c7d16;return _0x5bab36;})[_0x848f('0x1d')](respondWithFilteredResult(_0x48b3eb,_0x59c731))[_0x848f('0x39')](handleError(_0x48b3eb,null));};exports[_0x848f('0x3a')]=function(_0x12c4c8,_0x9ae150){var _0x274492={'raw':![],'where':{'id':_0x12c4c8[_0x848f('0x3b')]['id']}},_0x1cf9d8={};_0x1cf9d8[_0x848f('0x27')]=_[_0x848f('0x2b')](db[_0x848f('0x24')][_0x848f('0x25')]);_0x1cf9d8[_0x848f('0x2a')]=_[_0x848f('0x2b')](_0x12c4c8['query']);_0x1cf9d8[_0x848f('0x2c')]=_[_0x848f('0x2d')](_0x1cf9d8['model'],_0x1cf9d8[_0x848f('0x2a')]);_0x274492[_0x848f('0x2e')]=_['intersection'](_0x1cf9d8[_0x848f('0x27')],qs['fields'](_0x12c4c8[_0x848f('0x2a')][_0x848f('0x2f')]));_0x274492['attributes']=_0x274492[_0x848f('0x2e')][_0x848f('0x30')]?_0x274492['attributes']:_0x1cf9d8[_0x848f('0x27')];if(_0x12c4c8['query']['includeAll']){_0x274492['include']=[{'all':!![]}];}_0x274492=_[_0x848f('0x35')]({},_0x274492,_0x12c4c8[_0x848f('0x3c')]);return db[_0x848f('0x24')][_0x848f('0x3d')](_0x274492)[_0x848f('0x1d')](handleEntityNotFound(_0x9ae150,null))[_0x848f('0x1d')](respondWithResult(_0x9ae150,null))['catch'](handleError(_0x9ae150,null));};exports[_0x848f('0x3e')]=function(_0x58054b,_0x10730e){return db['SugarcrmConfiguration'][_0x848f('0x3e')](_0x58054b[_0x848f('0x3f')],{})['then'](respondWithResult(_0x10730e,0xc9))[_0x848f('0x39')](handleError(_0x10730e,null));};exports[_0x848f('0x1c')]=function(_0x14efac,_0x47bbb2){if(_0x14efac[_0x848f('0x3f')]['id']){delete _0x14efac[_0x848f('0x3f')]['id'];}return db['SugarcrmConfiguration'][_0x848f('0x3d')]({'where':{'id':_0x14efac['params']['id']}})[_0x848f('0x1d')](handleEntityNotFound(_0x47bbb2,null))[_0x848f('0x1d')](saveUpdates(_0x14efac[_0x848f('0x3f')],null))[_0x848f('0x1d')](respondWithResult(_0x47bbb2,null))['catch'](handleError(_0x47bbb2,null));};exports['destroy']=function(_0x22c787,_0x73920c){return db[_0x848f('0x24')][_0x848f('0x3d')]({'where':{'id':_0x22c787[_0x848f('0x3b')]['id']}})[_0x848f('0x1d')](handleEntityNotFound(_0x73920c,null))['then'](removeEntity(_0x73920c,null))[_0x848f('0x39')](handleError(_0x73920c,null));};exports[_0x848f('0x40')]=function(_0x688806,_0x3fa7e5,_0x248970){var _0x269a0c={};var _0x56c109={};var _0x8db503;var _0xf86a5e;return db[_0x848f('0x24')]['findOne']({'where':{'id':_0x688806[_0x848f('0x3b')]['id']}})[_0x848f('0x1d')](handleEntityNotFound(_0x3fa7e5,null))['then'](function(_0x5c4600){if(_0x5c4600){_0x8db503=_0x5c4600;_0x56c109[_0x848f('0x27')]=_[_0x848f('0x2b')](db[_0x848f('0x41')]['rawAttributes']);_0x56c109[_0x848f('0x2a')]=_['keys'](_0x688806[_0x848f('0x2a')]);_0x56c109[_0x848f('0x2c')]=_[_0x848f('0x2d')](_0x56c109[_0x848f('0x27')],_0x56c109[_0x848f('0x2a')]);_0x269a0c['attributes']=_[_0x848f('0x2d')](_0x56c109['model'],qs[_0x848f('0x2f')](_0x688806[_0x848f('0x2a')][_0x848f('0x2f')]));_0x269a0c[_0x848f('0x2e')]=_0x269a0c['attributes'][_0x848f('0x30')]?_0x269a0c[_0x848f('0x2e')]:_0x56c109[_0x848f('0x27')];_0x269a0c[_0x848f('0x42')]=qs[_0x848f('0x31')](_0x688806['query'][_0x848f('0x31')]);_0x269a0c['where']=qs['filters'](_[_0x848f('0x33')](_0x688806[_0x848f('0x2a')],_0x56c109[_0x848f('0x2c')]));if(_0x688806['query'][_0x848f('0x34')]){_0x269a0c[_0x848f('0x32')]=_[_0x848f('0x35')](_0x269a0c['where'],{'$or':_['map'](_0x269a0c[_0x848f('0x2e')],function(_0x199a21){var _0x4a379d={};_0x4a379d[_0x199a21]={'$like':'%'+_0x688806[_0x848f('0x2a')]['filter']+'%'};return _0x4a379d;})});}_0x269a0c=_[_0x848f('0x35')]({},_0x269a0c,_0x688806[_0x848f('0x3c')]);return _0x8db503[_0x848f('0x40')](_0x269a0c);}})[_0x848f('0x1d')](function(_0x45b5f0){if(_0x45b5f0){_0xf86a5e=_0x45b5f0[_0x848f('0x30')];if(!_0x688806['query'][_0x848f('0x43')]('nolimit')){_0x269a0c[_0x848f('0x17')]=qs[_0x848f('0x17')](_0x688806[_0x848f('0x2a')][_0x848f('0x17')]);_0x269a0c[_0x848f('0x19')]=qs[_0x848f('0x19')](_0x688806[_0x848f('0x2a')][_0x848f('0x19')]);}return _0x8db503[_0x848f('0x40')](_0x269a0c);}})[_0x848f('0x1d')](function(_0x4c2c66){if(_0x4c2c66){return _0x4c2c66?{'count':_0xf86a5e,'rows':_0x4c2c66}:null;}})[_0x848f('0x1d')](respondWithResult(_0x3fa7e5,null))['catch'](handleError(_0x3fa7e5,null));};exports[_0x848f('0x44')]=function(_0x2dbc3d,_0x52b346,_0x5e9250){var _0x41ac0b={};var _0x128b55={};var _0x56877e;var _0x11b630;return db[_0x848f('0x24')][_0x848f('0x45')]({'where':{'id':_0x2dbc3d[_0x848f('0x3b')]['id']}})[_0x848f('0x1d')](handleEntityNotFound(_0x52b346,null))[_0x848f('0x1d')](function(_0x3c20e2){if(_0x3c20e2){_0x56877e=_0x3c20e2;_0x128b55[_0x848f('0x27')]=_[_0x848f('0x2b')](db[_0x848f('0x41')]['rawAttributes']);_0x128b55[_0x848f('0x2a')]=_[_0x848f('0x2b')](_0x2dbc3d[_0x848f('0x2a')]);_0x128b55[_0x848f('0x2c')]=_['intersection'](_0x128b55['model'],_0x128b55[_0x848f('0x2a')]);_0x41ac0b[_0x848f('0x2e')]=_[_0x848f('0x2d')](_0x128b55[_0x848f('0x27')],qs[_0x848f('0x2f')](_0x2dbc3d['query'][_0x848f('0x2f')]));_0x41ac0b[_0x848f('0x2e')]=_0x41ac0b[_0x848f('0x2e')]['length']?_0x41ac0b[_0x848f('0x2e')]:_0x128b55[_0x848f('0x27')];_0x41ac0b['order']=qs[_0x848f('0x31')](_0x2dbc3d['query'][_0x848f('0x31')]);_0x41ac0b['where']=qs['filters'](_[_0x848f('0x33')](_0x2dbc3d[_0x848f('0x2a')],_0x128b55[_0x848f('0x2c')]));if(_0x2dbc3d[_0x848f('0x2a')][_0x848f('0x34')]){_0x41ac0b['where']=_[_0x848f('0x35')](_0x41ac0b['where'],{'$or':_[_0x848f('0x28')](_0x41ac0b['attributes'],function(_0x3fe780){var _0x510293={};_0x510293[_0x3fe780]={'$like':'%'+_0x2dbc3d[_0x848f('0x2a')]['filter']+'%'};return _0x510293;})});}_0x41ac0b=_['merge']({},_0x41ac0b,_0x2dbc3d['options']);return _0x56877e[_0x848f('0x44')](_0x41ac0b);}})[_0x848f('0x1d')](function(_0xd89271){if(_0xd89271){_0x11b630=_0xd89271[_0x848f('0x30')];if(!_0x2dbc3d[_0x848f('0x2a')][_0x848f('0x43')](_0x848f('0x46'))){_0x41ac0b['limit']=qs[_0x848f('0x17')](_0x2dbc3d['query'][_0x848f('0x17')]);_0x41ac0b[_0x848f('0x19')]=qs['offset'](_0x2dbc3d[_0x848f('0x2a')][_0x848f('0x19')]);}return _0x56877e[_0x848f('0x44')](_0x41ac0b);}})[_0x848f('0x1d')](function(_0x3fd1da){if(_0x3fd1da){return _0x3fd1da?{'count':_0x11b630,'rows':_0x3fd1da}:null;}})['then'](respondWithResult(_0x52b346,null))[_0x848f('0x39')](handleError(_0x52b346,null));};exports['getDescriptions']=function(_0x3d4ab4,_0x17a79a,_0x3053af){var _0x4985e7={};var _0x8e04b1={};var _0x8ab602;var _0x20ed3a;return db['SugarcrmConfiguration'][_0x848f('0x45')]({'where':{'id':_0x3d4ab4[_0x848f('0x3b')]['id']}})[_0x848f('0x1d')](handleEntityNotFound(_0x17a79a,null))[_0x848f('0x1d')](function(_0x2b80e8){if(_0x2b80e8){_0x8ab602=_0x2b80e8;_0x8e04b1[_0x848f('0x27')]=_[_0x848f('0x2b')](db[_0x848f('0x41')][_0x848f('0x25')]);_0x8e04b1['query']=_[_0x848f('0x2b')](_0x3d4ab4[_0x848f('0x2a')]);_0x8e04b1[_0x848f('0x2c')]=_['intersection'](_0x8e04b1[_0x848f('0x27')],_0x8e04b1[_0x848f('0x2a')]);_0x4985e7[_0x848f('0x2e')]=_['intersection'](_0x8e04b1[_0x848f('0x27')],qs[_0x848f('0x2f')](_0x3d4ab4[_0x848f('0x2a')][_0x848f('0x2f')]));_0x4985e7[_0x848f('0x2e')]=_0x4985e7[_0x848f('0x2e')][_0x848f('0x30')]?_0x4985e7[_0x848f('0x2e')]:_0x8e04b1[_0x848f('0x27')];_0x4985e7[_0x848f('0x42')]=qs['sort'](_0x3d4ab4[_0x848f('0x2a')][_0x848f('0x31')]);_0x4985e7[_0x848f('0x32')]=qs[_0x848f('0x2c')](_[_0x848f('0x33')](_0x3d4ab4[_0x848f('0x2a')],_0x8e04b1[_0x848f('0x2c')]));if(_0x3d4ab4[_0x848f('0x2a')]['filter']){_0x4985e7['where']=_[_0x848f('0x35')](_0x4985e7[_0x848f('0x32')],{'$or':_['map'](_0x4985e7[_0x848f('0x2e')],function(_0x59b442){var _0x2134d1={};_0x2134d1[_0x59b442]={'$like':'%'+_0x3d4ab4[_0x848f('0x2a')][_0x848f('0x34')]+'%'};return _0x2134d1;})});}_0x4985e7=_[_0x848f('0x35')]({},_0x4985e7,_0x3d4ab4[_0x848f('0x3c')]);return _0x8ab602[_0x848f('0x47')](_0x4985e7);}})[_0x848f('0x1d')](function(_0x3ee0ba){if(_0x3ee0ba){_0x20ed3a=_0x3ee0ba['length'];if(!_0x3d4ab4[_0x848f('0x2a')][_0x848f('0x43')]('nolimit')){_0x4985e7[_0x848f('0x17')]=qs['limit'](_0x3d4ab4[_0x848f('0x2a')][_0x848f('0x17')]);_0x4985e7[_0x848f('0x19')]=qs[_0x848f('0x19')](_0x3d4ab4[_0x848f('0x2a')][_0x848f('0x19')]);}return _0x8ab602[_0x848f('0x47')](_0x4985e7);}})[_0x848f('0x1d')](function(_0x3b9f51){if(_0x3b9f51){return _0x3b9f51?{'count':_0x20ed3a,'rows':_0x3b9f51}:null;}})[_0x848f('0x1d')](respondWithResult(_0x17a79a,null))['catch'](handleError(_0x17a79a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index f2f9caf..bf1571d 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 _0x621f=['bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash','util','api','moment'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x621f,0x128));var _0xf621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x621f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf621('0x0'));var util=require(_0xf621('0x1'));var logger=require('../../config/logger')(_0xf621('0x2'));var moment=require(_0xf621('0x3'));var BPromise=require(_0xf621('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf621('0x5'));var rimraf=require(_0xf621('0x6'));var config=require(_0xf621('0x7'));var attributes=require(_0xf621('0x8'));module[_0xf621('0x9')]=function(_0x38202a,_0x4b8205){return _0x38202a[_0xf621('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0xf621('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45ba=['exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x2203c3,_0xa335c7){var _0x30f9b9=function(_0x2d0e61){while(--_0x2d0e61){_0x2203c3['push'](_0x2203c3['shift']());}};_0x30f9b9(++_0xa335c7);}(_0x45ba,0x1d7));var _0xa45b=function(_0x6e814a,_0x2fc13d){_0x6e814a=_0x6e814a-0x0;var _0x439854=_0x45ba[_0x6e814a];return _0x439854;};'use strict';var _=require(_0xa45b('0x0'));var util=require(_0xa45b('0x1'));var logger=require(_0xa45b('0x2'))(_0xa45b('0x3'));var moment=require(_0xa45b('0x4'));var BPromise=require(_0xa45b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa45b('0x6'));var rimraf=require(_0xa45b('0x7'));var config=require(_0xa45b('0x8'));var attributes=require(_0xa45b('0x9'));module[_0xa45b('0xa')]=function(_0xf1eed6,_0x33cfd7){return _0xf1eed6['define'](_0xa45b('0xb'),attributes,{'tableName':_0xa45b('0xc'),'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 f2e5e07..851d2b5 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 _0x3857=['request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1e5b8b,_0x4937be){var _0x59393f=function(_0x14dc81){while(--_0x14dc81){_0x1e5b8b['push'](_0x1e5b8b['shift']());}};_0x59393f(++_0x4937be);}(_0x3857,0x146));var _0x7385=function(_0xccaf6c,_0x5f300d){_0xccaf6c=_0xccaf6c-0x0;var _0x49ecac=_0x3857[_0xccaf6c];return _0x49ecac;};'use strict';var _=require(_0x7385('0x0'));var util=require('util');var moment=require(_0x7385('0x1'));var BPromise=require(_0x7385('0x2'));var rs=require(_0x7385('0x3'));var fs=require('fs');var Redis=require(_0x7385('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7385('0x5'))(_0x7385('0x6'));var config=require(_0x7385('0x7'));var jayson=require(_0x7385('0x8'));var client=jayson['client'][_0x7385('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a2495,_0x445be6,_0x3609aa){return new BPromise(function(_0x2e428b,_0x1fbeec){return client[_0x7385('0xa')](_0x1a2495,_0x3609aa)[_0x7385('0xb')](function(_0x48f79a){logger[_0x7385('0xc')](_0x7385('0xd'),_0x445be6,'request\x20sent');logger[_0x7385('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x445be6,_0x7385('0xf'),JSON[_0x7385('0x10')](_0x48f79a));if(_0x48f79a['error']){if(_0x48f79a[_0x7385('0x11')][_0x7385('0x12')]===0x1f4){logger[_0x7385('0x11')](_0x7385('0xd'),_0x445be6,_0x48f79a['error'][_0x7385('0x13')]);return _0x1fbeec(_0x48f79a['error'][_0x7385('0x13')]);}logger[_0x7385('0x11')](_0x7385('0xd'),_0x445be6,_0x48f79a['error'][_0x7385('0x13')]);return _0x2e428b(_0x48f79a['error']['message']);}else{logger[_0x7385('0xc')](_0x7385('0xd'),_0x445be6,'request\x20sent');_0x2e428b(_0x48f79a[_0x7385('0x14')][_0x7385('0x13')]);}})['catch'](function(_0x4851f0){logger[_0x7385('0x11')](_0x7385('0xd'),_0x445be6,_0x4851f0);_0x1fbeec(_0x4851f0);});});} \ No newline at end of file +var _0x2365=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info'];(function(_0x3150ee,_0x1118d3){var _0x5a7680=function(_0x46b116){while(--_0x46b116){_0x3150ee['push'](_0x3150ee['shift']());}};_0x5a7680(++_0x1118d3);}(_0x2365,0xfe));var _0x5236=function(_0x2ca4cd,_0x5f9198){_0x2ca4cd=_0x2ca4cd-0x0;var _0x404865=_0x2365[_0x2ca4cd];return _0x404865;};'use strict';var _=require(_0x5236('0x0'));var util=require('util');var moment=require(_0x5236('0x1'));var BPromise=require(_0x5236('0x2'));var rs=require(_0x5236('0x3'));var fs=require('fs');var Redis=require(_0x5236('0x4'));var db=require(_0x5236('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5236('0x6'));var config=require(_0x5236('0x7'));var jayson=require(_0x5236('0x8'));var client=jayson[_0x5236('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x543510,_0x582cee,_0x5cb134){return new BPromise(function(_0x20e1d7,_0x5733db){return client['request'](_0x543510,_0x5cb134)[_0x5236('0xa')](function(_0x3d883e){logger[_0x5236('0xb')](_0x5236('0xc'),_0x582cee,_0x5236('0xd'));logger[_0x5236('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x582cee,_0x5236('0xd'),JSON[_0x5236('0xf')](_0x3d883e));if(_0x3d883e[_0x5236('0x10')]){if(_0x3d883e[_0x5236('0x10')][_0x5236('0x11')]===0x1f4){logger['error'](_0x5236('0xc'),_0x582cee,_0x3d883e[_0x5236('0x10')][_0x5236('0x12')]);return _0x5733db(_0x3d883e['error'][_0x5236('0x12')]);}logger[_0x5236('0x10')](_0x5236('0xc'),_0x582cee,_0x3d883e[_0x5236('0x10')][_0x5236('0x12')]);return _0x20e1d7(_0x3d883e['error'][_0x5236('0x12')]);}else{logger[_0x5236('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x582cee,_0x5236('0xd'));_0x20e1d7(_0x3d883e['result'][_0x5236('0x12')]);}})['catch'](function(_0x57f123){logger['error'](_0x5236('0xc'),_0x582cee,_0x57f123);_0x5733db(_0x57f123);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 9f97541..437b41e 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 _0x5583=['../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x44aac2,_0x336163){var _0x38a6bc=function(_0x423444){while(--_0x423444){_0x44aac2['push'](_0x44aac2['shift']());}};_0x38a6bc(++_0x336163);}(_0x5583,0xa4));var _0x3558=function(_0x584d37,_0x13fb20){_0x584d37=_0x584d37-0x0;var _0x1a1dbf=_0x5583[_0x584d37];return _0x1a1dbf;};'use strict';var multer=require(_0x3558('0x0'));var util=require(_0x3558('0x1'));var path=require(_0x3558('0x2'));var timeout=require(_0x3558('0x3'));var express=require(_0x3558('0x4'));var router=express['Router']();var fs_extra=require(_0x3558('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3558('0x6'));var config=require(_0x3558('0x7'));var controller=require(_0x3558('0x8'));router[_0x3558('0x9')]('/',auth[_0x3558('0xa')](),controller[_0x3558('0xb')]);router[_0x3558('0x9')](_0x3558('0xc'),auth['isAuthenticated'](),controller[_0x3558('0xd')]);router[_0x3558('0xe')]('/',auth[_0x3558('0xa')](),controller['create']);router[_0x3558('0xf')](_0x3558('0xc'),auth[_0x3558('0xa')](),controller['update']);router[_0x3558('0x10')](_0x3558('0xc'),auth[_0x3558('0xa')](),controller[_0x3558('0x11')]);module[_0x3558('0x12')]=router; \ No newline at end of file +var _0xdc23=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','/:id','show','post','create','put','delete','exports','multer'];(function(_0x11722b,_0x247eb2){var _0x2065f0=function(_0x102b0f){while(--_0x102b0f){_0x11722b['push'](_0x11722b['shift']());}};_0x2065f0(++_0x247eb2);}(_0xdc23,0x186));var _0x3dc2=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0xdc23[_0x3cea78];return _0x33b66b;};'use strict';var multer=require(_0x3dc2('0x0'));var util=require(_0x3dc2('0x1'));var path=require(_0x3dc2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3dc2('0x3')]();var fs_extra=require(_0x3dc2('0x4'));var auth=require(_0x3dc2('0x5'));var interaction=require(_0x3dc2('0x6'));var config=require('../../config/environment');var controller=require(_0x3dc2('0x7'));router[_0x3dc2('0x8')]('/',auth[_0x3dc2('0x9')](),controller['index']);router['get'](_0x3dc2('0xa'),auth['isAuthenticated'](),controller[_0x3dc2('0xb')]);router[_0x3dc2('0xc')]('/',auth['isAuthenticated'](),controller[_0x3dc2('0xd')]);router[_0x3dc2('0xe')](_0x3dc2('0xa'),auth[_0x3dc2('0x9')](),controller['update']);router[_0x3dc2('0xf')](_0x3dc2('0xa'),auth[_0x3dc2('0x9')](),controller['destroy']);module[_0x3dc2('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 5aa08bd..da83700 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 _0x233c=['string','variable','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x222c97,_0x3d9a9e){var _0x1a7fad=function(_0x161351){while(--_0x161351){_0x222c97['push'](_0x222c97['shift']());}};_0x1a7fad(++_0x3d9a9e);}(_0x233c,0x75));var _0xc233=function(_0x22536,_0xec6bc6){_0x22536=_0x22536-0x0;var _0x1a7159=_0x233c[_0x22536];return _0x1a7159;};'use strict';var Sequelize=require(_0xc233('0x0'));module[_0xc233('0x1')]={'type':{'type':Sequelize[_0xc233('0x2')](_0xc233('0x3'),_0xc233('0x4'),'customVariable','keyValue','picklist'),'defaultValue':_0xc233('0x3')},'content':{'type':Sequelize[_0xc233('0x5')]},'key':{'type':Sequelize[_0xc233('0x5')]},'keyType':{'type':Sequelize[_0xc233('0x2')](_0xc233('0x3'),_0xc233('0x4'),_0xc233('0x6'))},'keyContent':{'type':Sequelize[_0xc233('0x5')]},'idField':{'type':Sequelize[_0xc233('0x5')]},'nameField':{'type':Sequelize[_0xc233('0x5')]},'customField':{'type':Sequelize[_0xc233('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xccd6=['BOOLEAN','exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x15fc7a,_0xd21741){var _0x3aa9f4=function(_0x313108){while(--_0x313108){_0x15fc7a['push'](_0x15fc7a['shift']());}};_0x3aa9f4(++_0xd21741);}(_0xccd6,0x99));var _0x6ccd=function(_0x1a0ef3,_0x535bbf){_0x1a0ef3=_0x1a0ef3-0x0;var _0x2b86da=_0xccd6[_0x1a0ef3];return _0x2b86da;};'use strict';var Sequelize=require('sequelize');module[_0x6ccd('0x0')]={'type':{'type':Sequelize[_0x6ccd('0x1')](_0x6ccd('0x2'),_0x6ccd('0x3'),_0x6ccd('0x4'),'keyValue',_0x6ccd('0x5')),'defaultValue':_0x6ccd('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6ccd('0x6')]},'keyType':{'type':Sequelize[_0x6ccd('0x1')](_0x6ccd('0x2'),_0x6ccd('0x3'),_0x6ccd('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6ccd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6ccd('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 828431b..eb86317 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 _0x3839=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','SugarcrmField','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','limit','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x348e44,_0x21b760){var _0x17930f=function(_0x506fb2){while(--_0x506fb2){_0x348e44['push'](_0x348e44['shift']());}};_0x17930f(++_0x21b760);}(_0x3839,0x159));var _0x9383=function(_0x1b9e70,_0x55954f){_0x1b9e70=_0x1b9e70-0x0;var _0x4d87f7=_0x3839[_0x1b9e70];return _0x4d87f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9383('0x0'));var zipdir=require(_0x9383('0x1'));var jsonpatch=require(_0x9383('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9383('0x3'));var Mustache=require(_0x9383('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9383('0x5'));var csv=require(_0x9383('0x6'));var ejs=require(_0x9383('0x7'));var fs=require('fs');var fs_extra=require(_0x9383('0x8'));var _=require(_0x9383('0x9'));var squel=require('squel');var crypto=require(_0x9383('0xa'));var jsforce=require(_0x9383('0xb'));var deskjs=require(_0x9383('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9383('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9383('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9383('0xf'));var hardwareService=require(_0x9383('0x10'));var logger=require(_0x9383('0x11'))(_0x9383('0x12'));var utils=require(_0x9383('0x13'));var config=require(_0x9383('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fc7c,_0x5185c5){_0x5185c5=_0x5185c5||0xcc;return function(_0xb74af4){if(_0xb74af4){return _0x17fc7c[_0x9383('0x15')](_0x5185c5);}return _0x17fc7c[_0x9383('0x16')](_0x5185c5)[_0x9383('0x17')]();};}function respondWithResult(_0x140644,_0x2716b3){_0x2716b3=_0x2716b3||0xc8;return function(_0xf6a4ac){if(_0xf6a4ac){return _0x140644[_0x9383('0x16')](_0x2716b3)[_0x9383('0x18')](_0xf6a4ac);}};}function respondWithFilteredResult(_0x3d3cba,_0x156266){return function(_0x763701){if(_0x763701){var _0x1d98f9=typeof _0x156266[_0x9383('0x19')]===_0x9383('0x1a')&&typeof _0x156266['limit']===_0x9383('0x1a');var _0x10bec4=_0x763701['count'];var _0x498f5f=_0x1d98f9?0x0:_0x156266[_0x9383('0x19')];var _0x3ba7cd=_0x1d98f9?_0x763701[_0x9383('0x1b')]:_0x156266[_0x9383('0x19')]+_0x156266['limit'];var _0x20ce3b;if(_0x3ba7cd>=_0x10bec4){_0x3ba7cd=_0x10bec4;_0x20ce3b=0xc8;}else{_0x20ce3b=0xce;}_0x3d3cba[_0x9383('0x16')](_0x20ce3b);return _0x3d3cba['set'](_0x9383('0x1c'),_0x498f5f+'-'+_0x3ba7cd+'/'+_0x10bec4)['json'](_0x763701);}return null;};}function patchUpdates(_0x556690){return function(_0x49314f){try{jsonpatch[_0x9383('0x1d')](_0x49314f,_0x556690,!![]);}catch(_0xe1abfc){return BPromise[_0x9383('0x1e')](_0xe1abfc);}return _0x49314f[_0x9383('0x1f')]();};}function saveUpdates(_0x4a1d87,_0x372d39){return function(_0x1e761b){if(_0x1e761b){return _0x1e761b[_0x9383('0x20')](_0x4a1d87)['then'](function(_0x48d777){return _0x48d777;});}return null;};}function removeEntity(_0x163cdb,_0xd57a78){return function(_0x351949){if(_0x351949){return _0x351949[_0x9383('0x21')]()[_0x9383('0x22')](function(){_0x163cdb[_0x9383('0x16')](0xcc)[_0x9383('0x17')]();});}};}function handleEntityNotFound(_0x53f7e1,_0x59d74d){return function(_0x5d47f1){if(!_0x5d47f1){_0x53f7e1[_0x9383('0x15')](0x194);}return _0x5d47f1;};}function handleError(_0x173a0c,_0xb44af8){_0xb44af8=_0xb44af8||0x1f4;return function(_0x5ac16f){logger['error'](_0x5ac16f[_0x9383('0x23')]);if(_0x5ac16f[_0x9383('0x24')]){delete _0x5ac16f[_0x9383('0x24')];}_0x173a0c['status'](_0xb44af8)[_0x9383('0x25')](_0x5ac16f);};}exports['index']=function(_0x27b53a,_0x343ef2){var _0x14b080={},_0x12f6ef={},_0x46254c={'count':0x0,'rows':[]};var _0x2f4001=_['map'](db[_0x9383('0x26')]['rawAttributes'],function(_0x267b56){return{'name':_0x267b56[_0x9383('0x27')],'type':_0x267b56[_0x9383('0x28')][_0x9383('0x29')]};});_0x12f6ef[_0x9383('0x2a')]=_['map'](_0x2f4001,_0x9383('0x24'));_0x12f6ef[_0x9383('0x2b')]=_[_0x9383('0x2c')](_0x27b53a['query']);_0x12f6ef['filters']=_[_0x9383('0x2d')](_0x12f6ef[_0x9383('0x2a')],_0x12f6ef['query']);_0x14b080[_0x9383('0x2e')]=_[_0x9383('0x2d')](_0x12f6ef[_0x9383('0x2a')],qs['fields'](_0x27b53a[_0x9383('0x2b')][_0x9383('0x2f')]));_0x14b080[_0x9383('0x2e')]=_0x14b080['attributes'][_0x9383('0x30')]?_0x14b080['attributes']:_0x12f6ef[_0x9383('0x2a')];if(!_0x27b53a[_0x9383('0x2b')]['hasOwnProperty']('nolimit')){_0x14b080['limit']=qs[_0x9383('0x31')](_0x27b53a[_0x9383('0x2b')][_0x9383('0x31')]);_0x14b080[_0x9383('0x19')]=qs[_0x9383('0x19')](_0x27b53a['query'][_0x9383('0x19')]);}_0x14b080[_0x9383('0x32')]=qs[_0x9383('0x33')](_0x27b53a[_0x9383('0x2b')][_0x9383('0x33')]);_0x14b080['where']=qs[_0x9383('0x34')](_[_0x9383('0x35')](_0x27b53a[_0x9383('0x2b')],_0x12f6ef[_0x9383('0x34')]),_0x2f4001);if(_0x27b53a[_0x9383('0x2b')][_0x9383('0x36')]){_0x14b080[_0x9383('0x37')]=_[_0x9383('0x38')](_0x14b080[_0x9383('0x37')],{'$or':_[_0x9383('0x39')](_0x2f4001,function(_0x2b04bb){if(_0x2b04bb['type']!==_0x9383('0x3a')){var _0x22a27d={};_0x22a27d[_0x2b04bb[_0x9383('0x24')]]={'$like':'%'+_0x27b53a[_0x9383('0x2b')][_0x9383('0x36')]+'%'};return _0x22a27d;}})});}_0x14b080=_[_0x9383('0x38')]({},_0x14b080,_0x27b53a[_0x9383('0x3b')]);var _0x4bd404={'where':_0x14b080[_0x9383('0x37')]};return db[_0x9383('0x26')][_0x9383('0x1b')](_0x4bd404)[_0x9383('0x22')](function(_0x34e8c0){_0x46254c[_0x9383('0x1b')]=_0x34e8c0;if(_0x27b53a['query'][_0x9383('0x3c')]){_0x14b080['include']=[{'all':!![]}];}return db[_0x9383('0x26')][_0x9383('0x3d')](_0x14b080);})['then'](function(_0x20a9c4){_0x46254c[_0x9383('0x3e')]=_0x20a9c4;return _0x46254c;})[_0x9383('0x22')](respondWithFilteredResult(_0x343ef2,_0x14b080))[_0x9383('0x3f')](handleError(_0x343ef2,null));};exports[_0x9383('0x40')]=function(_0x20599b,_0x50a2cc){var _0x130522={'raw':!![],'where':{'id':_0x20599b[_0x9383('0x41')]['id']}},_0x2533e4={};_0x2533e4[_0x9383('0x2a')]=_[_0x9383('0x2c')](db[_0x9383('0x26')][_0x9383('0x42')]);_0x2533e4[_0x9383('0x2b')]=_[_0x9383('0x2c')](_0x20599b[_0x9383('0x2b')]);_0x2533e4[_0x9383('0x34')]=_['intersection'](_0x2533e4[_0x9383('0x2a')],_0x2533e4['query']);_0x130522[_0x9383('0x2e')]=_[_0x9383('0x2d')](_0x2533e4[_0x9383('0x2a')],qs['fields'](_0x20599b[_0x9383('0x2b')][_0x9383('0x2f')]));_0x130522[_0x9383('0x2e')]=_0x130522[_0x9383('0x2e')]['length']?_0x130522[_0x9383('0x2e')]:_0x2533e4[_0x9383('0x2a')];if(_0x20599b[_0x9383('0x2b')][_0x9383('0x3c')]){_0x130522['include']=[{'all':!![]}];}_0x130522=_[_0x9383('0x38')]({},_0x130522,_0x20599b[_0x9383('0x3b')]);return db['SugarcrmField'][_0x9383('0x43')](_0x130522)[_0x9383('0x22')](handleEntityNotFound(_0x50a2cc,null))[_0x9383('0x22')](respondWithResult(_0x50a2cc,null))[_0x9383('0x3f')](handleError(_0x50a2cc,null));};exports[_0x9383('0x44')]=function(_0x2c04d6,_0x28b08a){return db['SugarcrmField'][_0x9383('0x44')](_0x2c04d6[_0x9383('0x45')],{})[_0x9383('0x22')](respondWithResult(_0x28b08a,0xc9))[_0x9383('0x3f')](handleError(_0x28b08a,null));};exports['update']=function(_0x1db96b,_0x2c4b42){if(_0x1db96b[_0x9383('0x45')]['id']){delete _0x1db96b[_0x9383('0x45')]['id'];}return db[_0x9383('0x26')][_0x9383('0x43')]({'where':{'id':_0x1db96b['params']['id']}})[_0x9383('0x22')](handleEntityNotFound(_0x2c4b42,null))[_0x9383('0x22')](saveUpdates(_0x1db96b[_0x9383('0x45')],null))[_0x9383('0x22')](respondWithResult(_0x2c4b42,null))['catch'](handleError(_0x2c4b42,null));};exports[_0x9383('0x21')]=function(_0x45f331,_0x53db13){return db[_0x9383('0x26')][_0x9383('0x43')]({'where':{'id':_0x45f331[_0x9383('0x41')]['id']}})[_0x9383('0x22')](handleEntityNotFound(_0x53db13,null))[_0x9383('0x22')](removeEntity(_0x53db13,null))['catch'](handleError(_0x53db13,null));}; \ No newline at end of file +var _0x1601=['lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','then','rows','catch','show','params','intersection','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra'];(function(_0x20b805,_0x294c1a){var _0x3cc49c=function(_0x45f120){while(--_0x45f120){_0x20b805['push'](_0x20b805['shift']());}};_0x3cc49c(++_0x294c1a);}(_0x1601,0x129));var _0x1160=function(_0x2ee974,_0x1cceb5){_0x2ee974=_0x2ee974-0x0;var _0x20c5fb=_0x1601[_0x2ee974];return _0x20c5fb;};'use strict';var emlformat=require(_0x1160('0x0'));var rimraf=require(_0x1160('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1160('0x2'));var rp=require(_0x1160('0x3'));var moment=require(_0x1160('0x4'));var BPromise=require(_0x1160('0x5'));var Mustache=require(_0x1160('0x6'));var util=require(_0x1160('0x7'));var path=require('path');var sox=require(_0x1160('0x8'));var csv=require(_0x1160('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1160('0xa'));var _=require(_0x1160('0xb'));var squel=require(_0x1160('0xc'));var crypto=require(_0x1160('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1160('0xe'));var toCsv=require(_0x1160('0x9'));var querystring=require(_0x1160('0xf'));var Papa=require(_0x1160('0x10'));var Redis=require(_0x1160('0x11'));var authService=require(_0x1160('0x12'));var qs=require(_0x1160('0x13'));var as=require(_0x1160('0x14'));var hardwareService=require(_0x1160('0x15'));var logger=require(_0x1160('0x16'))(_0x1160('0x17'));var utils=require('../../config/utils');var config=require(_0x1160('0x18'));var licenseUtil=require(_0x1160('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37bfe0,_0x1e1625){_0x1e1625=_0x1e1625||0xcc;return function(_0x391370){if(_0x391370){return _0x37bfe0[_0x1160('0x1a')](_0x1e1625);}return _0x37bfe0[_0x1160('0x1b')](_0x1e1625)['end']();};}function respondWithResult(_0x47647e,_0x2bf21a){_0x2bf21a=_0x2bf21a||0xc8;return function(_0x51d7e1){if(_0x51d7e1){return _0x47647e[_0x1160('0x1b')](_0x2bf21a)[_0x1160('0x1c')](_0x51d7e1);}};}function respondWithFilteredResult(_0x4b2a4d,_0x1072e5){return function(_0x4946d2){if(_0x4946d2){var _0x5b61d3=typeof _0x1072e5[_0x1160('0x1d')]===_0x1160('0x1e')&&typeof _0x1072e5['limit']===_0x1160('0x1e');var _0x1797dd=_0x4946d2[_0x1160('0x1f')];var _0x425537=_0x5b61d3?0x0:_0x1072e5[_0x1160('0x1d')];var _0x51888f=_0x5b61d3?_0x4946d2[_0x1160('0x1f')]:_0x1072e5[_0x1160('0x1d')]+_0x1072e5[_0x1160('0x20')];var _0x133dbd;if(_0x51888f>=_0x1797dd){_0x51888f=_0x1797dd;_0x133dbd=0xc8;}else{_0x133dbd=0xce;}_0x4b2a4d[_0x1160('0x1b')](_0x133dbd);return _0x4b2a4d[_0x1160('0x21')](_0x1160('0x22'),_0x425537+'-'+_0x51888f+'/'+_0x1797dd)[_0x1160('0x1c')](_0x4946d2);}return null;};}function patchUpdates(_0x309a87){return function(_0x1fb5fc){try{jsonpatch[_0x1160('0x23')](_0x1fb5fc,_0x309a87,!![]);}catch(_0x331f55){return BPromise[_0x1160('0x24')](_0x331f55);}return _0x1fb5fc[_0x1160('0x25')]();};}function saveUpdates(_0x4ae844,_0x35aa01){return function(_0x524fca){if(_0x524fca){return _0x524fca['update'](_0x4ae844)['then'](function(_0x410cd5){return _0x410cd5;});}return null;};}function removeEntity(_0x2247f6,_0x1ce3c9){return function(_0x11b802){if(_0x11b802){return _0x11b802[_0x1160('0x26')]()['then'](function(){_0x2247f6[_0x1160('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x458d23,_0x5dbb6c){return function(_0x24c5a){if(!_0x24c5a){_0x458d23[_0x1160('0x1a')](0x194);}return _0x24c5a;};}function handleError(_0x49cff7,_0x24d69b){_0x24d69b=_0x24d69b||0x1f4;return function(_0x211ee5){logger[_0x1160('0x27')](_0x211ee5[_0x1160('0x28')]);if(_0x211ee5[_0x1160('0x29')]){delete _0x211ee5[_0x1160('0x29')];}_0x49cff7[_0x1160('0x1b')](_0x24d69b)[_0x1160('0x2a')](_0x211ee5);};}exports[_0x1160('0x2b')]=function(_0x46abd6,_0x3cc91d){var _0x2230ab={},_0x41a944={},_0x5d6ec9={'count':0x0,'rows':[]};var _0x1e7fad=_[_0x1160('0x2c')](db[_0x1160('0x2d')][_0x1160('0x2e')],function(_0x5a0233){return{'name':_0x5a0233[_0x1160('0x2f')],'type':_0x5a0233[_0x1160('0x30')]['key']};});_0x41a944[_0x1160('0x31')]=_[_0x1160('0x2c')](_0x1e7fad,'name');_0x41a944['query']=_[_0x1160('0x32')](_0x46abd6[_0x1160('0x33')]);_0x41a944[_0x1160('0x34')]=_['intersection'](_0x41a944['model'],_0x41a944[_0x1160('0x33')]);_0x2230ab[_0x1160('0x35')]=_['intersection'](_0x41a944['model'],qs[_0x1160('0x36')](_0x46abd6[_0x1160('0x33')][_0x1160('0x36')]));_0x2230ab[_0x1160('0x35')]=_0x2230ab[_0x1160('0x35')][_0x1160('0x37')]?_0x2230ab[_0x1160('0x35')]:_0x41a944[_0x1160('0x31')];if(!_0x46abd6[_0x1160('0x33')][_0x1160('0x38')](_0x1160('0x39'))){_0x2230ab['limit']=qs[_0x1160('0x20')](_0x46abd6[_0x1160('0x33')][_0x1160('0x20')]);_0x2230ab[_0x1160('0x1d')]=qs[_0x1160('0x1d')](_0x46abd6['query']['offset']);}_0x2230ab[_0x1160('0x3a')]=qs['sort'](_0x46abd6[_0x1160('0x33')][_0x1160('0x3b')]);_0x2230ab[_0x1160('0x3c')]=qs[_0x1160('0x34')](_[_0x1160('0x3d')](_0x46abd6[_0x1160('0x33')],_0x41a944['filters']),_0x1e7fad);if(_0x46abd6['query'][_0x1160('0x3e')]){_0x2230ab[_0x1160('0x3c')]=_[_0x1160('0x3f')](_0x2230ab[_0x1160('0x3c')],{'$or':_[_0x1160('0x2c')](_0x1e7fad,function(_0x1d7a38){if(_0x1d7a38[_0x1160('0x30')]!==_0x1160('0x40')){var _0x1e4439={};_0x1e4439[_0x1d7a38[_0x1160('0x29')]]={'$like':'%'+_0x46abd6[_0x1160('0x33')][_0x1160('0x3e')]+'%'};return _0x1e4439;}})});}_0x2230ab=_[_0x1160('0x3f')]({},_0x2230ab,_0x46abd6[_0x1160('0x41')]);var _0x2ba745={'where':_0x2230ab['where']};return db['SugarcrmField']['count'](_0x2ba745)['then'](function(_0x4021af){_0x5d6ec9[_0x1160('0x1f')]=_0x4021af;if(_0x46abd6[_0x1160('0x33')][_0x1160('0x42')]){_0x2230ab[_0x1160('0x43')]=[{'all':!![]}];}return db[_0x1160('0x2d')]['findAll'](_0x2230ab);})[_0x1160('0x44')](function(_0x2a3847){_0x5d6ec9[_0x1160('0x45')]=_0x2a3847;return _0x5d6ec9;})[_0x1160('0x44')](respondWithFilteredResult(_0x3cc91d,_0x2230ab))[_0x1160('0x46')](handleError(_0x3cc91d,null));};exports[_0x1160('0x47')]=function(_0x481e1b,_0xd79278){var _0x12d607={'raw':!![],'where':{'id':_0x481e1b[_0x1160('0x48')]['id']}},_0xe4cb2b={};_0xe4cb2b[_0x1160('0x31')]=_[_0x1160('0x32')](db[_0x1160('0x2d')][_0x1160('0x2e')]);_0xe4cb2b[_0x1160('0x33')]=_['keys'](_0x481e1b[_0x1160('0x33')]);_0xe4cb2b[_0x1160('0x34')]=_[_0x1160('0x49')](_0xe4cb2b[_0x1160('0x31')],_0xe4cb2b[_0x1160('0x33')]);_0x12d607[_0x1160('0x35')]=_[_0x1160('0x49')](_0xe4cb2b[_0x1160('0x31')],qs[_0x1160('0x36')](_0x481e1b[_0x1160('0x33')][_0x1160('0x36')]));_0x12d607['attributes']=_0x12d607[_0x1160('0x35')][_0x1160('0x37')]?_0x12d607[_0x1160('0x35')]:_0xe4cb2b['model'];if(_0x481e1b[_0x1160('0x33')]['includeAll']){_0x12d607['include']=[{'all':!![]}];}_0x12d607=_[_0x1160('0x3f')]({},_0x12d607,_0x481e1b['options']);return db[_0x1160('0x2d')][_0x1160('0x4a')](_0x12d607)[_0x1160('0x44')](handleEntityNotFound(_0xd79278,null))[_0x1160('0x44')](respondWithResult(_0xd79278,null))[_0x1160('0x46')](handleError(_0xd79278,null));};exports[_0x1160('0x4b')]=function(_0x2e3037,_0x131b0c){return db[_0x1160('0x2d')][_0x1160('0x4b')](_0x2e3037[_0x1160('0x4c')],{})[_0x1160('0x44')](respondWithResult(_0x131b0c,0xc9))[_0x1160('0x46')](handleError(_0x131b0c,null));};exports['update']=function(_0x3f70af,_0x5a3af3){if(_0x3f70af[_0x1160('0x4c')]['id']){delete _0x3f70af[_0x1160('0x4c')]['id'];}return db['SugarcrmField'][_0x1160('0x4a')]({'where':{'id':_0x3f70af['params']['id']}})[_0x1160('0x44')](handleEntityNotFound(_0x5a3af3,null))[_0x1160('0x44')](saveUpdates(_0x3f70af[_0x1160('0x4c')],null))['then'](respondWithResult(_0x5a3af3,null))[_0x1160('0x46')](handleError(_0x5a3af3,null));};exports[_0x1160('0x26')]=function(_0x3f42e1,_0x41a7f5){return db[_0x1160('0x2d')][_0x1160('0x4a')]({'where':{'id':_0x3f42e1['params']['id']}})[_0x1160('0x44')](handleEntityNotFound(_0x41a7f5,null))['then'](removeEntity(_0x41a7f5,null))['catch'](handleError(_0x41a7f5,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index b6d00d1..6202109 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 _0x2f48=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','SugarcrmField','int_sugarcrm_fields','FieldId','lodash'];(function(_0x35868b,_0x13dd64){var _0x5c170e=function(_0x4ec97d){while(--_0x4ec97d){_0x35868b['push'](_0x35868b['shift']());}};_0x5c170e(++_0x13dd64);}(_0x2f48,0x1b7));var _0x82f4=function(_0x1f1c68,_0x32ea8d){_0x1f1c68=_0x1f1c68-0x0;var _0x4dfaff=_0x2f48[_0x1f1c68];return _0x4dfaff;};'use strict';var _=require(_0x82f4('0x0'));var util=require('util');var logger=require(_0x82f4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x82f4('0x2'));var rp=require(_0x82f4('0x3'));var fs=require('fs');var path=require(_0x82f4('0x4'));var rimraf=require(_0x82f4('0x5'));var config=require(_0x82f4('0x6'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x302a9e,_0x49a902){return _0x302a9e['define'](_0x82f4('0x7'),attributes,{'tableName':_0x82f4('0x8'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0x82f4('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4daa=['idField','FieldId','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x2dcc0f,_0x127a16){var _0x95e2eb=function(_0x4466c1){while(--_0x4466c1){_0x2dcc0f['push'](_0x2dcc0f['shift']());}};_0x95e2eb(++_0x127a16);}(_0x4daa,0x1d3));var _0xa4da=function(_0x50d17b,_0x17cc5e){_0x50d17b=_0x50d17b-0x0;var _0x35038b=_0x4daa[_0x50d17b];return _0x35038b;};'use strict';var _=require(_0xa4da('0x0'));var util=require(_0xa4da('0x1'));var logger=require(_0xa4da('0x2'))(_0xa4da('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa4da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4da('0x5'));var config=require(_0xa4da('0x6'));var attributes=require(_0xa4da('0x7'));module[_0xa4da('0x8')]=function(_0x4c9114,_0x472f05){return _0x4c9114[_0xa4da('0x9')](_0xa4da('0xa'),attributes,{'tableName':_0xa4da('0xb'),'paranoid':![],'indexes':[{'name':_0xa4da('0xc'),'fields':[_0xa4da('0xd'),_0xa4da('0xe')],'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 3beef7e..a738fb7 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 _0xc1c4=['debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmField,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','request','info','request\x20sent'];(function(_0x5ebffc,_0x52d903){var _0x1138ec=function(_0x1c8f13){while(--_0x1c8f13){_0x5ebffc['push'](_0x5ebffc['shift']());}};_0x1138ec(++_0x52d903);}(_0xc1c4,0x9c));var _0x4c1c=function(_0x3c3b10,_0x3e163d){_0x3c3b10=_0x3c3b10-0x0;var _0x3c1ca3=_0xc1c4[_0x3c3b10];return _0x3c1ca3;};'use strict';var _=require('lodash');var util=require(_0x4c1c('0x0'));var moment=require(_0x4c1c('0x1'));var BPromise=require(_0x4c1c('0x2'));var rs=require(_0x4c1c('0x3'));var fs=require('fs');var Redis=require(_0x4c1c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4c1c('0x5'))('rpc');var config=require(_0x4c1c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4c1c('0x7')][_0x4c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x349295,_0x4a524c,_0x145596){return new BPromise(function(_0x20850b,_0x2b5d81){return client[_0x4c1c('0x9')](_0x349295,_0x145596)['then'](function(_0x5d575e){logger[_0x4c1c('0xa')]('SugarcrmField,\x20%s,\x20%s',_0x4a524c,_0x4c1c('0xb'));logger[_0x4c1c('0xc')](_0x4c1c('0xd'),_0x4a524c,_0x4c1c('0xb'),JSON[_0x4c1c('0xe')](_0x5d575e));if(_0x5d575e['error']){if(_0x5d575e[_0x4c1c('0xf')][_0x4c1c('0x10')]===0x1f4){logger[_0x4c1c('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x4a524c,_0x5d575e[_0x4c1c('0xf')][_0x4c1c('0x11')]);return _0x2b5d81(_0x5d575e[_0x4c1c('0xf')][_0x4c1c('0x11')]);}logger[_0x4c1c('0xf')](_0x4c1c('0x12'),_0x4a524c,_0x5d575e['error'][_0x4c1c('0x11')]);return _0x20850b(_0x5d575e[_0x4c1c('0xf')][_0x4c1c('0x11')]);}else{logger[_0x4c1c('0xa')](_0x4c1c('0x12'),_0x4a524c,_0x4c1c('0xb'));_0x20850b(_0x5d575e[_0x4c1c('0x13')]['message']);}})[_0x4c1c('0x14')](function(_0x170588){logger[_0x4c1c('0xf')](_0x4c1c('0x12'),_0x4a524c,_0x170588);_0x2b5d81(_0x170588);});});} \ No newline at end of file +var _0x303a=['message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','SugarcrmField,\x20%s,\x20%s'];(function(_0x36ec0b,_0x1deade){var _0x136eae=function(_0x4354fc){while(--_0x4354fc){_0x36ec0b['push'](_0x36ec0b['shift']());}};_0x136eae(++_0x1deade);}(_0x303a,0x110));var _0xa303=function(_0x24f870,_0x2c8a88){_0x24f870=_0x24f870-0x0;var _0x5d065b=_0x303a[_0x24f870];return _0x5d065b;};'use strict';var _=require('lodash');var util=require(_0xa303('0x0'));var moment=require(_0xa303('0x1'));var BPromise=require(_0xa303('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa303('0x3'));var db=require(_0xa303('0x4'))['db'];var utils=require(_0xa303('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa303('0x6'));var client=jayson['client'][_0xa303('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2de6ec,_0x249419,_0x7a300b){return new BPromise(function(_0x482257,_0x4fb399){return client[_0xa303('0x8')](_0x2de6ec,_0x7a300b)[_0xa303('0x9')](function(_0x1a2dd6){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x249419,_0xa303('0xa'));logger[_0xa303('0xb')](_0xa303('0xc'),_0x249419,_0xa303('0xa'),JSON['stringify'](_0x1a2dd6));if(_0x1a2dd6['error']){if(_0x1a2dd6[_0xa303('0xd')][_0xa303('0xe')]===0x1f4){logger[_0xa303('0xd')](_0xa303('0xf'),_0x249419,_0x1a2dd6[_0xa303('0xd')][_0xa303('0x10')]);return _0x4fb399(_0x1a2dd6[_0xa303('0xd')][_0xa303('0x10')]);}logger[_0xa303('0xd')](_0xa303('0xf'),_0x249419,_0x1a2dd6['error']['message']);return _0x482257(_0x1a2dd6[_0xa303('0xd')][_0xa303('0x10')]);}else{logger['info'](_0xa303('0xf'),_0x249419,_0xa303('0xa'));_0x482257(_0x1a2dd6['result']['message']);}})[_0xa303('0x11')](function(_0x21be1b){logger['error'](_0xa303('0xf'),_0x249419,_0x21be1b);_0x4fb399(_0x21be1b);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index dbd5645..15e8ca8 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 _0x5c12=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','destroy'];(function(_0x3efadf,_0x364aa4){var _0x1d1e97=function(_0x1351c1){while(--_0x1351c1){_0x3efadf['push'](_0x3efadf['shift']());}};_0x1d1e97(++_0x364aa4);}(_0x5c12,0x188));var _0x25c1=function(_0x414f67,_0x861aed){_0x414f67=_0x414f67-0x0;var _0x338537=_0x5c12[_0x414f67];return _0x338537;};'use strict';var multer=require('multer');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x25c1('0x2'));var router=express[_0x25c1('0x3')]();var fs_extra=require(_0x25c1('0x4'));var auth=require(_0x25c1('0x5'));var interaction=require(_0x25c1('0x6'));var config=require(_0x25c1('0x7'));var controller=require(_0x25c1('0x8'));router['get']('/',auth[_0x25c1('0x9')](),controller[_0x25c1('0xa')]);router[_0x25c1('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x25c1('0xc')]);router[_0x25c1('0xb')](_0x25c1('0xd'),auth[_0x25c1('0x9')](),controller[_0x25c1('0xe')]);router['get'](_0x25c1('0xf'),auth[_0x25c1('0x9')](),controller[_0x25c1('0x10')]);router[_0x25c1('0x11')]('/',auth[_0x25c1('0x9')](),controller['create']);router[_0x25c1('0x11')](_0x25c1('0xd'),auth['isAuthenticated'](),controller[_0x25c1('0x12')]);router[_0x25c1('0x13')](_0x25c1('0x14'),auth[_0x25c1('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x25c1('0x15')]);module[_0x25c1('0x16')]=router; \ No newline at end of file +var _0xaf40=['../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x35acd7,_0x57b6e6){var _0x500d30=function(_0x57d4ca){while(--_0x57d4ca){_0x35acd7['push'](_0x35acd7['shift']());}};_0x500d30(++_0x57b6e6);}(_0xaf40,0x75));var _0x0af4=function(_0x44cfc7,_0x3eb9bf){_0x44cfc7=_0x44cfc7-0x0;var _0x2edf54=_0xaf40[_0x44cfc7];return _0x2edf54;};'use strict';var multer=require('multer');var util=require(_0x0af4('0x0'));var path=require(_0x0af4('0x1'));var timeout=require(_0x0af4('0x2'));var express=require(_0x0af4('0x3'));var router=express[_0x0af4('0x4')]();var fs_extra=require(_0x0af4('0x5'));var auth=require(_0x0af4('0x6'));var interaction=require(_0x0af4('0x7'));var config=require(_0x0af4('0x8'));var controller=require(_0x0af4('0x9'));router[_0x0af4('0xa')]('/',auth[_0x0af4('0xb')](),controller[_0x0af4('0xc')]);router[_0x0af4('0xa')](_0x0af4('0xd'),auth['isAuthenticated'](),controller[_0x0af4('0xe')]);router[_0x0af4('0xa')](_0x0af4('0xf'),auth[_0x0af4('0xb')](),controller['getConfigurations']);router['get'](_0x0af4('0x10'),auth[_0x0af4('0xb')](),controller[_0x0af4('0x11')]);router['post']('/',auth[_0x0af4('0xb')](),controller[_0x0af4('0x12')]);router[_0x0af4('0x13')](_0x0af4('0xf'),auth[_0x0af4('0xb')](),controller['addConfiguration']);router[_0x0af4('0x14')]('/:id',auth[_0x0af4('0xb')](),controller[_0x0af4('0x15')]);router[_0x0af4('0x16')](_0x0af4('0xd'),auth[_0x0af4('0xb')](),controller[_0x0af4('0x17')]);module[_0x0af4('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 465c779..5e7d46b 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 _0x0e9b=['STRING','HelpDesk','sequelize','exports'];(function(_0x437c2a,_0x1b7739){var _0x16f2ca=function(_0x5e7fba){while(--_0x5e7fba){_0x437c2a['push'](_0x437c2a['shift']());}};_0x16f2ca(++_0x1b7739);}(_0x0e9b,0x1b6));var _0xb0e9=function(_0x3e37a1,_0x36cfbd){_0x3e37a1=_0x3e37a1-0x0;var _0x10ce1d=_0x0e9b[_0x3e37a1];return _0x10ce1d;};'use strict';var Sequelize=require(_0xb0e9('0x0'));module[_0xb0e9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb0e9('0x2')]},'username':{'type':Sequelize[_0xb0e9('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xb0e9('0x2')],'allowNull':![],'defaultValue':_0xb0e9('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xb0e9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1cf4=['STRING','HelpDesk','exports'];(function(_0x10ffc1,_0x4c35b3){var _0x569df6=function(_0x428bf3){while(--_0x428bf3){_0x10ffc1['push'](_0x10ffc1['shift']());}};_0x569df6(++_0x4c35b3);}(_0x1cf4,0x11f));var _0x41cf=function(_0xa51c8a,_0x18b349){_0xa51c8a=_0xa51c8a-0x0;var _0xbfafee=_0x1cf4[_0xa51c8a];return _0xbfafee;};'use strict';var Sequelize=require('sequelize');module[_0x41cf('0x0')]={'name':{'type':Sequelize[_0x41cf('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x41cf('0x1')]},'username':{'type':Sequelize[_0x41cf('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x41cf('0x1')],'allowNull':![],'defaultValue':_0x41cf('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x41cf('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x41cf('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 91651e7..35c3740 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 _0x2d87=['channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','accessKey','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','result','describe','sessionName','reference','remove','includes','false','label','startsWith','cf_','picklist','picklistValues','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','name','index','map','VtigerAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','find','create','body','catch','getConfigurations','findOne','VtigerConfiguration','addConfiguration','Subjects'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x2d87,0x96));var _0x72d8=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x2d87[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require(_0x72d8('0x0'));var rimraf=require(_0x72d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x72d8('0x2'));var moment=require('moment');var BPromise=require(_0x72d8('0x3'));var Mustache=require(_0x72d8('0x4'));var util=require(_0x72d8('0x5'));var path=require('path');var sox=require(_0x72d8('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x72d8('0x7'));var squel=require(_0x72d8('0x8'));var crypto=require(_0x72d8('0x9'));var jsforce=require(_0x72d8('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x72d8('0xb'));var Papa=require(_0x72d8('0xc'));var Redis=require('ioredis');var authService=require(_0x72d8('0xd'));var qs=require(_0x72d8('0xe'));var as=require(_0x72d8('0xf'));var hardwareService=require(_0x72d8('0x10'));var logger=require(_0x72d8('0x11'))(_0x72d8('0x12'));var utils=require(_0x72d8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x72d8('0x14'));var db=require(_0x72d8('0x15'))['db'];var integrations=require(_0x72d8('0x16'));function respondWithStatusCode(_0x51be3b,_0xea43f7){_0xea43f7=_0xea43f7||0xcc;return function(_0x32a736){if(_0x32a736){return _0x51be3b[_0x72d8('0x17')](_0xea43f7);}return _0x51be3b[_0x72d8('0x18')](_0xea43f7)['end']();};}function respondWithResult(_0x9714d9,_0x389620){_0x389620=_0x389620||0xc8;return function(_0x556e2b){if(_0x556e2b){return _0x9714d9[_0x72d8('0x18')](_0x389620)[_0x72d8('0x19')](_0x556e2b);}};}function respondWithFilteredResult(_0x51184f,_0x2b365c){return function(_0x2b3306){if(_0x2b3306){var _0x5885a2=typeof _0x2b365c[_0x72d8('0x1a')]===_0x72d8('0x1b')&&typeof _0x2b365c[_0x72d8('0x1c')]===_0x72d8('0x1b');var _0x6621ce=_0x2b3306[_0x72d8('0x1d')];var _0x32745e=_0x5885a2?0x0:_0x2b365c[_0x72d8('0x1a')];var _0x5e51e9=_0x5885a2?_0x2b3306[_0x72d8('0x1d')]:_0x2b365c[_0x72d8('0x1a')]+_0x2b365c[_0x72d8('0x1c')];var _0xdd559f;if(_0x5e51e9>=_0x6621ce){_0x5e51e9=_0x6621ce;_0xdd559f=0xc8;}else{_0xdd559f=0xce;}_0x51184f['status'](_0xdd559f);return _0x51184f[_0x72d8('0x1e')](_0x72d8('0x1f'),_0x32745e+'-'+_0x5e51e9+'/'+_0x6621ce)['json'](_0x2b3306);}return null;};}function patchUpdates(_0x1074ab){return function(_0x394fe6){try{jsonpatch['apply'](_0x394fe6,_0x1074ab,!![]);}catch(_0x4b03e0){return BPromise[_0x72d8('0x20')](_0x4b03e0);}return _0x394fe6['save']();};}function saveUpdates(_0x4a52b7,_0x3dcc18){return function(_0x4e30ed){if(_0x4e30ed){return _0x4e30ed[_0x72d8('0x21')](_0x4a52b7)[_0x72d8('0x22')](function(_0x332428){return _0x332428;});}return null;};}function removeEntity(_0x45beef,_0x58179f){return function(_0x2d5bf4){if(_0x2d5bf4){return _0x2d5bf4[_0x72d8('0x23')]()[_0x72d8('0x22')](function(){_0x45beef[_0x72d8('0x18')](0xcc)[_0x72d8('0x24')]();});}};}function handleEntityNotFound(_0x3a4a4c,_0x291cb3){return function(_0xb478de){if(!_0xb478de){_0x3a4a4c[_0x72d8('0x17')](0x194);}return _0xb478de;};}function handleError(_0x133ebf,_0x1723de){_0x1723de=_0x1723de||0x1f4;return function(_0xf9a281){logger[_0x72d8('0x25')](_0xf9a281['stack']);if(_0xf9a281[_0x72d8('0x26')]){delete _0xf9a281['name'];}_0x133ebf[_0x72d8('0x18')](_0x1723de)['send'](_0xf9a281);};}exports[_0x72d8('0x27')]=function(_0x367631,_0x454397){var _0x352203={},_0x133ea1={},_0x31da27={'count':0x0,'rows':[]};var _0x3f64a6=_[_0x72d8('0x28')](db[_0x72d8('0x29')][_0x72d8('0x2a')],function(_0x3e762e){return{'name':_0x3e762e[_0x72d8('0x2b')],'type':_0x3e762e[_0x72d8('0x2c')]['key']};});_0x133ea1['model']=_[_0x72d8('0x28')](_0x3f64a6,_0x72d8('0x26'));_0x133ea1[_0x72d8('0x2d')]=_[_0x72d8('0x2e')](_0x367631[_0x72d8('0x2d')]);_0x133ea1[_0x72d8('0x2f')]=_[_0x72d8('0x30')](_0x133ea1[_0x72d8('0x31')],_0x133ea1[_0x72d8('0x2d')]);_0x352203[_0x72d8('0x32')]=_['intersection'](_0x133ea1[_0x72d8('0x31')],qs[_0x72d8('0x33')](_0x367631['query']['fields']));_0x352203[_0x72d8('0x32')]=_0x352203[_0x72d8('0x32')][_0x72d8('0x34')]?_0x352203[_0x72d8('0x32')]:_0x133ea1['model'];if(!_0x367631[_0x72d8('0x2d')][_0x72d8('0x35')](_0x72d8('0x36'))){_0x352203[_0x72d8('0x1c')]=qs['limit'](_0x367631[_0x72d8('0x2d')][_0x72d8('0x1c')]);_0x352203[_0x72d8('0x1a')]=qs[_0x72d8('0x1a')](_0x367631['query'][_0x72d8('0x1a')]);}_0x352203[_0x72d8('0x37')]=qs[_0x72d8('0x38')](_0x367631[_0x72d8('0x2d')][_0x72d8('0x38')]);_0x352203[_0x72d8('0x39')]=qs[_0x72d8('0x2f')](_[_0x72d8('0x3a')](_0x367631[_0x72d8('0x2d')],_0x133ea1[_0x72d8('0x2f')]),_0x3f64a6);if(_0x367631[_0x72d8('0x2d')][_0x72d8('0x3b')]){_0x352203[_0x72d8('0x39')]=_[_0x72d8('0x3c')](_0x352203[_0x72d8('0x39')],{'$or':_['map'](_0x3f64a6,function(_0x4d9429){if(_0x4d9429[_0x72d8('0x2c')]!=='VIRTUAL'){var _0x446419={};_0x446419[_0x4d9429['name']]={'$like':'%'+_0x367631['query'][_0x72d8('0x3b')]+'%'};return _0x446419;}})});}_0x352203=_['merge']({},_0x352203,_0x367631[_0x72d8('0x3d')]);var _0x10985={'where':_0x352203[_0x72d8('0x39')]};return db[_0x72d8('0x29')][_0x72d8('0x1d')](_0x10985)['then'](function(_0x6b26a9){_0x31da27['count']=_0x6b26a9;if(_0x367631[_0x72d8('0x2d')][_0x72d8('0x3e')]){_0x352203[_0x72d8('0x3f')]=[{'all':!![]}];}return db[_0x72d8('0x29')][_0x72d8('0x40')](_0x352203);})[_0x72d8('0x22')](function(_0xec2f16){_0x31da27[_0x72d8('0x41')]=_0xec2f16;return _0x31da27;})[_0x72d8('0x22')](respondWithFilteredResult(_0x454397,_0x352203))['catch'](handleError(_0x454397,null));};exports['show']=function(_0x34879b,_0x488052){var _0x13f7fa={'raw':![],'where':{'id':_0x34879b[_0x72d8('0x42')]['id']}},_0x215215={};_0x215215[_0x72d8('0x31')]=_[_0x72d8('0x2e')](db[_0x72d8('0x29')]['rawAttributes']);_0x215215[_0x72d8('0x2d')]=_['keys'](_0x34879b[_0x72d8('0x2d')]);_0x215215[_0x72d8('0x2f')]=_[_0x72d8('0x30')](_0x215215[_0x72d8('0x31')],_0x215215[_0x72d8('0x2d')]);_0x13f7fa[_0x72d8('0x32')]=_[_0x72d8('0x30')](_0x215215['model'],qs[_0x72d8('0x33')](_0x34879b[_0x72d8('0x2d')][_0x72d8('0x33')]));_0x13f7fa[_0x72d8('0x32')]=_0x13f7fa[_0x72d8('0x32')][_0x72d8('0x34')]?_0x13f7fa[_0x72d8('0x32')]:_0x215215['model'];if(_0x34879b[_0x72d8('0x2d')]['includeAll']){_0x13f7fa[_0x72d8('0x3f')]=[{'all':!![]}];}_0x13f7fa=_[_0x72d8('0x3c')]({},_0x13f7fa,_0x34879b[_0x72d8('0x3d')]);return db[_0x72d8('0x29')][_0x72d8('0x43')](_0x13f7fa)[_0x72d8('0x22')](handleEntityNotFound(_0x488052,null))['then'](respondWithResult(_0x488052,null))['catch'](handleError(_0x488052,null));};exports[_0x72d8('0x44')]=function(_0x46a573,_0x3b423e){return db[_0x72d8('0x29')][_0x72d8('0x44')](_0x46a573[_0x72d8('0x45')],{})[_0x72d8('0x22')](respondWithResult(_0x3b423e,0xc9))[_0x72d8('0x46')](handleError(_0x3b423e,null));};exports[_0x72d8('0x21')]=function(_0x1a6c9b,_0x3470b3){if(_0x1a6c9b[_0x72d8('0x45')]['id']){delete _0x1a6c9b[_0x72d8('0x45')]['id'];}return db[_0x72d8('0x29')][_0x72d8('0x43')]({'where':{'id':_0x1a6c9b[_0x72d8('0x42')]['id']}})[_0x72d8('0x22')](handleEntityNotFound(_0x3470b3,null))[_0x72d8('0x22')](saveUpdates(_0x1a6c9b[_0x72d8('0x45')],null))[_0x72d8('0x22')](respondWithResult(_0x3470b3,null))[_0x72d8('0x46')](handleError(_0x3470b3,null));};exports['destroy']=function(_0x52088c,_0x78cfcb){return db[_0x72d8('0x29')][_0x72d8('0x43')]({'where':{'id':_0x52088c[_0x72d8('0x42')]['id']}})[_0x72d8('0x22')](handleEntityNotFound(_0x78cfcb,null))[_0x72d8('0x22')](removeEntity(_0x78cfcb,null))[_0x72d8('0x46')](handleError(_0x78cfcb,null));};exports[_0x72d8('0x47')]=function(_0x5d4490,_0x48820f,_0x35952c){var _0x204f06={};var _0x5d2603={};var _0x5aa2d6;var _0x832bdf;return db[_0x72d8('0x29')][_0x72d8('0x48')]({'where':{'id':_0x5d4490[_0x72d8('0x42')]['id']}})[_0x72d8('0x22')](handleEntityNotFound(_0x48820f,null))['then'](function(_0x1d8e4e){if(_0x1d8e4e){_0x5aa2d6=_0x1d8e4e;_0x5d2603[_0x72d8('0x31')]=_[_0x72d8('0x2e')](db[_0x72d8('0x49')][_0x72d8('0x2a')]);_0x5d2603['query']=_[_0x72d8('0x2e')](_0x5d4490[_0x72d8('0x2d')]);_0x5d2603[_0x72d8('0x2f')]=_['intersection'](_0x5d2603['model'],_0x5d2603['query']);_0x204f06['attributes']=_[_0x72d8('0x30')](_0x5d2603['model'],qs[_0x72d8('0x33')](_0x5d4490[_0x72d8('0x2d')]['fields']));_0x204f06[_0x72d8('0x32')]=_0x204f06[_0x72d8('0x32')]['length']?_0x204f06[_0x72d8('0x32')]:_0x5d2603[_0x72d8('0x31')];_0x204f06['order']=qs[_0x72d8('0x38')](_0x5d4490[_0x72d8('0x2d')][_0x72d8('0x38')]);_0x204f06[_0x72d8('0x39')]=qs['filters'](_[_0x72d8('0x3a')](_0x5d4490[_0x72d8('0x2d')],_0x5d2603['filters']));if(_0x5d4490['query']['filter']){_0x204f06[_0x72d8('0x39')]=_[_0x72d8('0x3c')](_0x204f06[_0x72d8('0x39')],{'$or':_[_0x72d8('0x28')](_0x204f06[_0x72d8('0x32')],function(_0x604eaf){var _0x396bd9={};_0x396bd9[_0x604eaf]={'$like':'%'+_0x5d4490['query'][_0x72d8('0x3b')]+'%'};return _0x396bd9;})});}_0x204f06=_[_0x72d8('0x3c')]({},_0x204f06,_0x5d4490[_0x72d8('0x3d')]);return _0x5aa2d6[_0x72d8('0x47')](_0x204f06);}})[_0x72d8('0x22')](function(_0x3c0a53){if(_0x3c0a53){_0x832bdf=_0x3c0a53['length'];if(!_0x5d4490['query'][_0x72d8('0x35')](_0x72d8('0x36'))){_0x204f06[_0x72d8('0x1c')]=qs[_0x72d8('0x1c')](_0x5d4490['query'][_0x72d8('0x1c')]);_0x204f06[_0x72d8('0x1a')]=qs[_0x72d8('0x1a')](_0x5d4490[_0x72d8('0x2d')][_0x72d8('0x1a')]);}return _0x5aa2d6[_0x72d8('0x47')](_0x204f06);}})['then'](function(_0x43f28e){if(_0x43f28e){return _0x43f28e?{'count':_0x832bdf,'rows':_0x43f28e}:null;}})['then'](respondWithResult(_0x48820f,null))['catch'](handleError(_0x48820f,null));};exports[_0x72d8('0x4a')]=function(_0x2ae7aa,_0x15dfc2,_0x5a7acb){if(_0x2ae7aa[_0x72d8('0x45')]['id']){delete _0x2ae7aa['body']['id'];}return db['VtigerAccount'][_0x72d8('0x48')]({'where':{'id':_0x2ae7aa[_0x72d8('0x42')]['id']}})['then'](handleEntityNotFound(_0x15dfc2,null))['then'](function(_0x5a438f){if(_0x5a438f){_0x2ae7aa[_0x72d8('0x45')]['AccountId']=_0x5a438f['id'];_0x2ae7aa['body'][_0x72d8('0x4b')]=integrations['getSubjects'](_0x2ae7aa['body'][_0x72d8('0x4c')],_0x2ae7aa[_0x72d8('0x45')][_0x72d8('0x2c')]);_0x2ae7aa[_0x72d8('0x45')][_0x72d8('0x4d')]=integrations[_0x72d8('0x4e')](_0x2ae7aa[_0x72d8('0x45')][_0x72d8('0x4c')],_0x2ae7aa[_0x72d8('0x45')][_0x72d8('0x2c')]);return db[_0x72d8('0x49')][_0x72d8('0x44')](_0x2ae7aa[_0x72d8('0x45')],{'include':[{'model':db[_0x72d8('0x4f')],'as':_0x72d8('0x4b')},{'model':db[_0x72d8('0x4f')],'as':'Descriptions'}]});}return null;})[_0x72d8('0x22')](respondWithResult(_0x15dfc2,null))[_0x72d8('0x46')](handleError(_0x15dfc2,null));};var md5=require(_0x72d8('0x50'));exports[_0x72d8('0x51')]=function(_0x4a397a,_0x24c935,_0x3a129d){var _0x4f1bf7=null;var _0x42ef3a=null;var _0x1d4ab8=null;var _0x50ac1d=null;var _0x4bbd2c='';return db[_0x72d8('0x29')][_0x72d8('0x48')]({'where':{'id':_0x4a397a[_0x72d8('0x42')]['id']},'attributes':['id',_0x72d8('0x26'),_0x72d8('0x52'),_0x72d8('0x53'),_0x72d8('0x54'),'remoteUri','serverUrl',_0x72d8('0x55')]})[_0x72d8('0x22')](handleEntityNotFound(_0x24c935,null))[_0x72d8('0x22')](function(_0x3ee7f4){if(_0x3ee7f4){_0x4f1bf7=_0x3ee7f4['username'];_0x42ef3a=_0x3ee7f4[_0x72d8('0x55')];_0x1d4ab8=_0x3ee7f4[_0x72d8('0x54')];_0x4bbd2c=_0x3ee7f4[_0x72d8('0x56')];var _0x5b6f90=_0x4bbd2c[_0x72d8('0x57')](-0x1);if(_0x5b6f90==='/'){_0x4bbd2c=_0x4bbd2c[_0x72d8('0x58')](0x0,_0x4bbd2c[_0x72d8('0x59')](_0x5b6f90));}_0x50ac1d=util[_0x72d8('0x5a')](_0x72d8('0x5b'),_0x4bbd2c);var _0x35a1d4={'method':_0x72d8('0x5c'),'uri':_0x50ac1d,'qs':{'operation':'getchallenge','username':_0x3ee7f4[_0x72d8('0x52')]},'json':!![]};return rp(_0x35a1d4);}})[_0x72d8('0x22')](function(_0x2ff106){if(_0x2ff106[_0x72d8('0x5d')]){var _0x213ed6={'method':_0x72d8('0x5e'),'uri':_0x50ac1d,'form':{'operation':_0x72d8('0x5f'),'username':_0x4f1bf7,'accessKey':md5(_0x2ff106[_0x72d8('0x60')]['token']+_0x42ef3a)},'json':!![]};return rp(_0x213ed6);}})[_0x72d8('0x22')](function(_0x2b601d){if(_0x2b601d[_0x72d8('0x5d')]){var _0xb7418f={'method':_0x72d8('0x5c'),'uri':_0x50ac1d,'qs':{'operation':_0x72d8('0x61'),'username':_0x4f1bf7,'sessionName':_0x2b601d[_0x72d8('0x60')][_0x72d8('0x62')],'elementType':_0x1d4ab8},'json':!![]};return rp(_0xb7418f);}})[_0x72d8('0x22')](function(_0x5bfed7){if(_0x5bfed7[_0x72d8('0x5d')]){var _0x477d22=['autogenerated',_0x72d8('0x63'),'owner'];_[_0x72d8('0x64')](_0x5bfed7['result'][_0x72d8('0x33')],function(_0x191a81){return _0x477d22[_0x72d8('0x65')](_0x191a81['type'][_0x72d8('0x26')]);});_['remove'](_0x5bfed7[_0x72d8('0x60')][_0x72d8('0x33')],function(_0x54b56f){return _0x54b56f['editable']===_0x72d8('0x66');});return{'count':_0x5bfed7[_0x72d8('0x60')][_0x72d8('0x33')][_0x72d8('0x34')],'rows':_[_0x72d8('0x28')](_0x5bfed7[_0x72d8('0x60')][_0x72d8('0x33')],function(_0x306bf6){return{'id':_0x306bf6[_0x72d8('0x26')],'name':_0x306bf6[_0x72d8('0x67')],'custom':_[_0x72d8('0x68')](_0x306bf6[_0x72d8('0x26')],_0x72d8('0x69'))?!![]:![],'options':_0x306bf6[_0x72d8('0x2c')][_0x72d8('0x26')]===_0x72d8('0x6a')&&_0x306bf6[_0x72d8('0x2c')][_0x72d8('0x6b')][_0x72d8('0x34')]>0x0?_[_0x72d8('0x28')](_0x306bf6[_0x72d8('0x2c')][_0x72d8('0x6b')],function(_0x32b61d){return{'name':_0x32b61d[_0x72d8('0x67')],'value':_0x32b61d['value']};}):[]};})};}})[_0x72d8('0x22')](respondWithResult(_0x24c935,null))[_0x72d8('0x46')](function(_0x2f0abc){console['log']('vTiger\x20error:\x20'+_0x2f0abc);var _0x537e0d=_0x4a397a[_0x72d8('0x2d')][_0x72d8('0x6c')]?0x1f4:_0x2f0abc[_0x72d8('0x6d')]||0x1f4;logger[_0x72d8('0x25')](_0x72d8('0x6e'),_0x72d8('0x51'),_0x537e0d,JSON[_0x72d8('0x6f')](_0x2f0abc));delete _0x2f0abc[_0x72d8('0x26')];if(_0x537e0d===0x191){_0x537e0d=0x190;}_0x24c935[_0x72d8('0x18')](_0x537e0d)[_0x72d8('0x70')](_0x4a397a[_0x72d8('0x2d')][_0x72d8('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x2f0abc['statusCode']}:_0x2f0abc);});}; \ No newline at end of file +var _0xe24c=['slice','substring','lastIndexOf','format','GET','success','result','token','describe','autogenerated','reference','owner','remove','includes','editable','false','startsWith','picklistValues','label','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','VtigerAccount','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','destroy','getConfigurations','order','map','merge','findOne','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','VtigerConfiguration','VtigerField','moduleName','remoteUri','serverUrl','accessKey','username'];(function(_0x425af8,_0x366c35){var _0x5c2eb1=function(_0x44785f){while(--_0x44785f){_0x425af8['push'](_0x425af8['shift']());}};_0x5c2eb1(++_0x366c35);}(_0xe24c,0x191));var _0xce24=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe24c[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xce24('0x0'));var rimraf=require(_0xce24('0x1'));var zipdir=require(_0xce24('0x2'));var jsonpatch=require(_0xce24('0x3'));var rp=require(_0xce24('0x4'));var moment=require('moment');var BPromise=require(_0xce24('0x5'));var Mustache=require(_0xce24('0x6'));var util=require(_0xce24('0x7'));var path=require(_0xce24('0x8'));var sox=require(_0xce24('0x9'));var csv=require(_0xce24('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce24('0xb'));var _=require(_0xce24('0xc'));var squel=require(_0xce24('0xd'));var crypto=require(_0xce24('0xe'));var jsforce=require(_0xce24('0xf'));var deskjs=require(_0xce24('0x10'));var toCsv=require(_0xce24('0xa'));var querystring=require(_0xce24('0x11'));var Papa=require(_0xce24('0x12'));var Redis=require(_0xce24('0x13'));var authService=require(_0xce24('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xce24('0x15'));var hardwareService=require(_0xce24('0x16'));var logger=require(_0xce24('0x17'))(_0xce24('0x18'));var utils=require(_0xce24('0x19'));var config=require(_0xce24('0x1a'));var licenseUtil=require(_0xce24('0x1b'));var db=require(_0xce24('0x1c'))['db'];var integrations=require(_0xce24('0x1d'));function respondWithStatusCode(_0xc33f,_0x3b07a2){_0x3b07a2=_0x3b07a2||0xcc;return function(_0x223a3a){if(_0x223a3a){return _0xc33f['sendStatus'](_0x3b07a2);}return _0xc33f['status'](_0x3b07a2)[_0xce24('0x1e')]();};}function respondWithResult(_0xdf63ac,_0x15671b){_0x15671b=_0x15671b||0xc8;return function(_0x39d48d){if(_0x39d48d){return _0xdf63ac[_0xce24('0x1f')](_0x15671b)[_0xce24('0x20')](_0x39d48d);}};}function respondWithFilteredResult(_0x4f3290,_0x42d5cc){return function(_0x65e9ab){if(_0x65e9ab){var _0xdcef9d=typeof _0x42d5cc[_0xce24('0x21')]===_0xce24('0x22')&&typeof _0x42d5cc[_0xce24('0x23')]===_0xce24('0x22');var _0x820a1f=_0x65e9ab[_0xce24('0x24')];var _0x48acc7=_0xdcef9d?0x0:_0x42d5cc['offset'];var _0x460605=_0xdcef9d?_0x65e9ab[_0xce24('0x24')]:_0x42d5cc[_0xce24('0x21')]+_0x42d5cc[_0xce24('0x23')];var _0x30f023;if(_0x460605>=_0x820a1f){_0x460605=_0x820a1f;_0x30f023=0xc8;}else{_0x30f023=0xce;}_0x4f3290[_0xce24('0x1f')](_0x30f023);return _0x4f3290[_0xce24('0x25')](_0xce24('0x26'),_0x48acc7+'-'+_0x460605+'/'+_0x820a1f)['json'](_0x65e9ab);}return null;};}function patchUpdates(_0xee3d00){return function(_0x4088b6){try{jsonpatch['apply'](_0x4088b6,_0xee3d00,!![]);}catch(_0x56ebc6){return BPromise[_0xce24('0x27')](_0x56ebc6);}return _0x4088b6[_0xce24('0x28')]();};}function saveUpdates(_0x41728f,_0x489381){return function(_0x5b66e5){if(_0x5b66e5){return _0x5b66e5[_0xce24('0x29')](_0x41728f)[_0xce24('0x2a')](function(_0x2d29f6){return _0x2d29f6;});}return null;};}function removeEntity(_0x73f75f,_0x3e72d9){return function(_0x2efa7c){if(_0x2efa7c){return _0x2efa7c['destroy']()[_0xce24('0x2a')](function(){_0x73f75f[_0xce24('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33f84f,_0x41375d){return function(_0x11aed0){if(!_0x11aed0){_0x33f84f[_0xce24('0x2b')](0x194);}return _0x11aed0;};}function handleError(_0x2eea41,_0x3374cc){_0x3374cc=_0x3374cc||0x1f4;return function(_0x3eee0f){logger[_0xce24('0x2c')](_0x3eee0f[_0xce24('0x2d')]);if(_0x3eee0f[_0xce24('0x2e')]){delete _0x3eee0f[_0xce24('0x2e')];}_0x2eea41[_0xce24('0x1f')](_0x3374cc)[_0xce24('0x2f')](_0x3eee0f);};}exports[_0xce24('0x30')]=function(_0x365ac1,_0x2878f6){var _0x4efbd8={},_0x4e61df={},_0x5e7b7a={'count':0x0,'rows':[]};var _0x1858bd=_['map'](db['VtigerAccount'][_0xce24('0x31')],function(_0x3333b){return{'name':_0x3333b[_0xce24('0x32')],'type':_0x3333b['type'][_0xce24('0x33')]};});_0x4e61df['model']=_['map'](_0x1858bd,'name');_0x4e61df[_0xce24('0x34')]=_[_0xce24('0x35')](_0x365ac1[_0xce24('0x34')]);_0x4e61df[_0xce24('0x36')]=_[_0xce24('0x37')](_0x4e61df[_0xce24('0x38')],_0x4e61df[_0xce24('0x34')]);_0x4efbd8[_0xce24('0x39')]=_[_0xce24('0x37')](_0x4e61df[_0xce24('0x38')],qs[_0xce24('0x3a')](_0x365ac1[_0xce24('0x34')][_0xce24('0x3a')]));_0x4efbd8[_0xce24('0x39')]=_0x4efbd8[_0xce24('0x39')][_0xce24('0x3b')]?_0x4efbd8[_0xce24('0x39')]:_0x4e61df[_0xce24('0x38')];if(!_0x365ac1[_0xce24('0x34')][_0xce24('0x3c')](_0xce24('0x3d'))){_0x4efbd8['limit']=qs[_0xce24('0x23')](_0x365ac1[_0xce24('0x34')][_0xce24('0x23')]);_0x4efbd8['offset']=qs['offset'](_0x365ac1['query'][_0xce24('0x21')]);}_0x4efbd8['order']=qs[_0xce24('0x3e')](_0x365ac1['query']['sort']);_0x4efbd8[_0xce24('0x3f')]=qs['filters'](_[_0xce24('0x40')](_0x365ac1[_0xce24('0x34')],_0x4e61df[_0xce24('0x36')]),_0x1858bd);if(_0x365ac1[_0xce24('0x34')][_0xce24('0x41')]){_0x4efbd8[_0xce24('0x3f')]=_['merge'](_0x4efbd8['where'],{'$or':_['map'](_0x1858bd,function(_0x28f278){if(_0x28f278['type']!==_0xce24('0x42')){var _0x1380a8={};_0x1380a8[_0x28f278[_0xce24('0x2e')]]={'$like':'%'+_0x365ac1['query']['filter']+'%'};return _0x1380a8;}})});}_0x4efbd8=_['merge']({},_0x4efbd8,_0x365ac1['options']);var _0x47fba3={'where':_0x4efbd8[_0xce24('0x3f')]};return db[_0xce24('0x43')][_0xce24('0x24')](_0x47fba3)[_0xce24('0x2a')](function(_0x19c012){_0x5e7b7a[_0xce24('0x24')]=_0x19c012;if(_0x365ac1[_0xce24('0x34')][_0xce24('0x44')]){_0x4efbd8[_0xce24('0x45')]=[{'all':!![]}];}return db[_0xce24('0x43')][_0xce24('0x46')](_0x4efbd8);})[_0xce24('0x2a')](function(_0x120177){_0x5e7b7a[_0xce24('0x47')]=_0x120177;return _0x5e7b7a;})[_0xce24('0x2a')](respondWithFilteredResult(_0x2878f6,_0x4efbd8))[_0xce24('0x48')](handleError(_0x2878f6,null));};exports[_0xce24('0x49')]=function(_0xe337e2,_0x4a167f){var _0x493b79={'raw':![],'where':{'id':_0xe337e2['params']['id']}},_0x4002a9={};_0x4002a9[_0xce24('0x38')]=_[_0xce24('0x35')](db[_0xce24('0x43')]['rawAttributes']);_0x4002a9[_0xce24('0x34')]=_[_0xce24('0x35')](_0xe337e2[_0xce24('0x34')]);_0x4002a9[_0xce24('0x36')]=_[_0xce24('0x37')](_0x4002a9[_0xce24('0x38')],_0x4002a9[_0xce24('0x34')]);_0x493b79[_0xce24('0x39')]=_[_0xce24('0x37')](_0x4002a9[_0xce24('0x38')],qs[_0xce24('0x3a')](_0xe337e2[_0xce24('0x34')]['fields']));_0x493b79['attributes']=_0x493b79[_0xce24('0x39')]['length']?_0x493b79['attributes']:_0x4002a9[_0xce24('0x38')];if(_0xe337e2[_0xce24('0x34')][_0xce24('0x44')]){_0x493b79[_0xce24('0x45')]=[{'all':!![]}];}_0x493b79=_['merge']({},_0x493b79,_0xe337e2[_0xce24('0x4a')]);return db[_0xce24('0x43')][_0xce24('0x4b')](_0x493b79)[_0xce24('0x2a')](handleEntityNotFound(_0x4a167f,null))[_0xce24('0x2a')](respondWithResult(_0x4a167f,null))[_0xce24('0x48')](handleError(_0x4a167f,null));};exports[_0xce24('0x4c')]=function(_0x61ef1a,_0x5cc7d1){return db['VtigerAccount'][_0xce24('0x4c')](_0x61ef1a[_0xce24('0x4d')],{})[_0xce24('0x2a')](respondWithResult(_0x5cc7d1,0xc9))['catch'](handleError(_0x5cc7d1,null));};exports[_0xce24('0x29')]=function(_0x3b7de4,_0x9a7bbb){if(_0x3b7de4['body']['id']){delete _0x3b7de4[_0xce24('0x4d')]['id'];}return db[_0xce24('0x43')][_0xce24('0x4b')]({'where':{'id':_0x3b7de4[_0xce24('0x4e')]['id']}})[_0xce24('0x2a')](handleEntityNotFound(_0x9a7bbb,null))[_0xce24('0x2a')](saveUpdates(_0x3b7de4[_0xce24('0x4d')],null))[_0xce24('0x2a')](respondWithResult(_0x9a7bbb,null))['catch'](handleError(_0x9a7bbb,null));};exports[_0xce24('0x4f')]=function(_0x4e5920,_0x31aac2){return db['VtigerAccount']['find']({'where':{'id':_0x4e5920[_0xce24('0x4e')]['id']}})[_0xce24('0x2a')](handleEntityNotFound(_0x31aac2,null))[_0xce24('0x2a')](removeEntity(_0x31aac2,null))[_0xce24('0x48')](handleError(_0x31aac2,null));};exports[_0xce24('0x50')]=function(_0x379b64,_0x385599,_0x5a998e){var _0x14a02e={};var _0x41f455={};var _0x4c7bc6;var _0x4011b8;return db['VtigerAccount']['findOne']({'where':{'id':_0x379b64[_0xce24('0x4e')]['id']}})[_0xce24('0x2a')](handleEntityNotFound(_0x385599,null))['then'](function(_0x1037e5){if(_0x1037e5){_0x4c7bc6=_0x1037e5;_0x41f455[_0xce24('0x38')]=_[_0xce24('0x35')](db['VtigerConfiguration'][_0xce24('0x31')]);_0x41f455['query']=_[_0xce24('0x35')](_0x379b64[_0xce24('0x34')]);_0x41f455['filters']=_[_0xce24('0x37')](_0x41f455['model'],_0x41f455[_0xce24('0x34')]);_0x14a02e[_0xce24('0x39')]=_[_0xce24('0x37')](_0x41f455[_0xce24('0x38')],qs['fields'](_0x379b64[_0xce24('0x34')][_0xce24('0x3a')]));_0x14a02e[_0xce24('0x39')]=_0x14a02e['attributes'][_0xce24('0x3b')]?_0x14a02e[_0xce24('0x39')]:_0x41f455['model'];_0x14a02e[_0xce24('0x51')]=qs[_0xce24('0x3e')](_0x379b64[_0xce24('0x34')][_0xce24('0x3e')]);_0x14a02e['where']=qs[_0xce24('0x36')](_[_0xce24('0x40')](_0x379b64[_0xce24('0x34')],_0x41f455['filters']));if(_0x379b64['query']['filter']){_0x14a02e[_0xce24('0x3f')]=_['merge'](_0x14a02e[_0xce24('0x3f')],{'$or':_[_0xce24('0x52')](_0x14a02e['attributes'],function(_0x2b4247){var _0xd4e990={};_0xd4e990[_0x2b4247]={'$like':'%'+_0x379b64[_0xce24('0x34')][_0xce24('0x41')]+'%'};return _0xd4e990;})});}_0x14a02e=_[_0xce24('0x53')]({},_0x14a02e,_0x379b64['options']);return _0x4c7bc6[_0xce24('0x50')](_0x14a02e);}})[_0xce24('0x2a')](function(_0xab8db5){if(_0xab8db5){_0x4011b8=_0xab8db5[_0xce24('0x3b')];if(!_0x379b64['query']['hasOwnProperty'](_0xce24('0x3d'))){_0x14a02e['limit']=qs[_0xce24('0x23')](_0x379b64[_0xce24('0x34')][_0xce24('0x23')]);_0x14a02e['offset']=qs['offset'](_0x379b64[_0xce24('0x34')][_0xce24('0x21')]);}return _0x4c7bc6['getConfigurations'](_0x14a02e);}})[_0xce24('0x2a')](function(_0x207952){if(_0x207952){return _0x207952?{'count':_0x4011b8,'rows':_0x207952}:null;}})[_0xce24('0x2a')](respondWithResult(_0x385599,null))['catch'](handleError(_0x385599,null));};exports['addConfiguration']=function(_0x240801,_0x4c7aca,_0x52adcb){if(_0x240801[_0xce24('0x4d')]['id']){delete _0x240801[_0xce24('0x4d')]['id'];}return db[_0xce24('0x43')][_0xce24('0x54')]({'where':{'id':_0x240801['params']['id']}})[_0xce24('0x2a')](handleEntityNotFound(_0x4c7aca,null))[_0xce24('0x2a')](function(_0x48e433){if(_0x48e433){_0x240801[_0xce24('0x4d')][_0xce24('0x55')]=_0x48e433['id'];_0x240801[_0xce24('0x4d')][_0xce24('0x56')]=integrations[_0xce24('0x57')](_0x240801[_0xce24('0x4d')]['channel'],_0x240801[_0xce24('0x4d')][_0xce24('0x58')]);_0x240801[_0xce24('0x4d')][_0xce24('0x59')]=integrations[_0xce24('0x5a')](_0x240801[_0xce24('0x4d')][_0xce24('0x5b')],_0x240801['body'][_0xce24('0x58')]);return db[_0xce24('0x5c')][_0xce24('0x4c')](_0x240801[_0xce24('0x4d')],{'include':[{'model':db[_0xce24('0x5d')],'as':_0xce24('0x56')},{'model':db[_0xce24('0x5d')],'as':_0xce24('0x59')}]});}return null;})[_0xce24('0x2a')](respondWithResult(_0x4c7aca,null))[_0xce24('0x48')](handleError(_0x4c7aca,null));};var md5=require('md5');exports['getFields']=function(_0x5029cf,_0x2f4906,_0x410af7){var _0x54c58f=null;var _0x5ed866=null;var _0x5a26c3=null;var _0x1efdaf=null;var _0x17fb58='';return db[_0xce24('0x43')][_0xce24('0x54')]({'where':{'id':_0x5029cf[_0xce24('0x4e')]['id']},'attributes':['id',_0xce24('0x2e'),'username','description',_0xce24('0x5e'),_0xce24('0x5f'),_0xce24('0x60'),_0xce24('0x61')]})[_0xce24('0x2a')](handleEntityNotFound(_0x2f4906,null))[_0xce24('0x2a')](function(_0x2152da){if(_0x2152da){_0x54c58f=_0x2152da[_0xce24('0x62')];_0x5ed866=_0x2152da[_0xce24('0x61')];_0x5a26c3=_0x2152da[_0xce24('0x5e')];_0x17fb58=_0x2152da[_0xce24('0x5f')];var _0x5522e1=_0x17fb58[_0xce24('0x63')](-0x1);if(_0x5522e1==='/'){_0x17fb58=_0x17fb58[_0xce24('0x64')](0x0,_0x17fb58[_0xce24('0x65')](_0x5522e1));}_0x1efdaf=util[_0xce24('0x66')]('%s/webservice.php',_0x17fb58);var _0x1372eb={'method':_0xce24('0x67'),'uri':_0x1efdaf,'qs':{'operation':'getchallenge','username':_0x2152da[_0xce24('0x62')]},'json':!![]};return rp(_0x1372eb);}})[_0xce24('0x2a')](function(_0x19a91f){if(_0x19a91f[_0xce24('0x68')]){var _0x404217={'method':'POST','uri':_0x1efdaf,'form':{'operation':'login','username':_0x54c58f,'accessKey':md5(_0x19a91f[_0xce24('0x69')][_0xce24('0x6a')]+_0x5ed866)},'json':!![]};return rp(_0x404217);}})[_0xce24('0x2a')](function(_0x513429){if(_0x513429[_0xce24('0x68')]){var _0x4bfc5e={'method':_0xce24('0x67'),'uri':_0x1efdaf,'qs':{'operation':_0xce24('0x6b'),'username':_0x54c58f,'sessionName':_0x513429['result']['sessionName'],'elementType':_0x5a26c3},'json':!![]};return rp(_0x4bfc5e);}})[_0xce24('0x2a')](function(_0x337883){if(_0x337883[_0xce24('0x68')]){var _0x328a92=[_0xce24('0x6c'),_0xce24('0x6d'),_0xce24('0x6e')];_[_0xce24('0x6f')](_0x337883[_0xce24('0x69')][_0xce24('0x3a')],function(_0x22af48){return _0x328a92[_0xce24('0x70')](_0x22af48[_0xce24('0x58')]['name']);});_[_0xce24('0x6f')](_0x337883[_0xce24('0x69')][_0xce24('0x3a')],function(_0x360ac4){return _0x360ac4[_0xce24('0x71')]===_0xce24('0x72');});return{'count':_0x337883[_0xce24('0x69')][_0xce24('0x3a')][_0xce24('0x3b')],'rows':_['map'](_0x337883['result']['fields'],function(_0x2527e1){return{'id':_0x2527e1[_0xce24('0x2e')],'name':_0x2527e1['label'],'custom':_[_0xce24('0x73')](_0x2527e1['name'],'cf_')?!![]:![],'options':_0x2527e1[_0xce24('0x58')]['name']==='picklist'&&_0x2527e1['type'][_0xce24('0x74')][_0xce24('0x3b')]>0x0?_[_0xce24('0x52')](_0x2527e1[_0xce24('0x58')][_0xce24('0x74')],function(_0x4ca85a){return{'name':_0x4ca85a[_0xce24('0x75')],'value':_0x4ca85a['value']};}):[]};})};}})[_0xce24('0x2a')](respondWithResult(_0x2f4906,null))[_0xce24('0x48')](function(_0xe56b86){console[_0xce24('0x76')](_0xce24('0x77')+_0xe56b86);var _0x5e09bf=_0x5029cf[_0xce24('0x34')][_0xce24('0x78')]?0x1f4:_0xe56b86['statusCode']||0x1f4;logger[_0xce24('0x2c')](_0xce24('0x79'),'getFields',_0x5e09bf,JSON[_0xce24('0x7a')](_0xe56b86));delete _0xe56b86[_0xce24('0x2e')];if(_0x5e09bf===0x191){_0x5e09bf=0x190;}_0x2f4906[_0xce24('0x1f')](_0x5e09bf)[_0xce24('0x2f')](_0x5029cf[_0xce24('0x34')]['test']?{'message':_0xce24('0x7b'),'statusCode':_0xe56b86[_0xce24('0x7c')]}:_0xe56b86);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index a4c992b..2ceae9d 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 _0x3067=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','VtigerAccount','int_vtiger_accounts'];(function(_0xbc4a94,_0x43ad12){var _0x4090bb=function(_0x455468){while(--_0x455468){_0xbc4a94['push'](_0xbc4a94['shift']());}};_0x4090bb(++_0x43ad12);}(_0x3067,0x179));var _0x7306=function(_0x648d02,_0x279ec4){_0x648d02=_0x648d02-0x0;var _0x42c3e5=_0x3067[_0x648d02];return _0x42c3e5;};'use strict';var _=require(_0x7306('0x0'));var util=require(_0x7306('0x1'));var logger=require(_0x7306('0x2'))(_0x7306('0x3'));var moment=require(_0x7306('0x4'));var BPromise=require('bluebird');var rp=require(_0x7306('0x5'));var fs=require('fs');var path=require(_0x7306('0x6'));var rimraf=require(_0x7306('0x7'));var config=require(_0x7306('0x8'));var attributes=require(_0x7306('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x7306('0xa')]=function(_0x2a32e7,_0x3abb11){return _0x2a32e7['define'](_0x7306('0xb'),attributes,{'tableName':_0x7306('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc5f=['../../config/environment','exports','VtigerAccount','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xcc5f,0x12f));var _0xfcc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfcc5('0x0'));var util=require(_0xfcc5('0x1'));var logger=require(_0xfcc5('0x2'))('api');var moment=require(_0xfcc5('0x3'));var BPromise=require('bluebird');var rp=require(_0xfcc5('0x4'));var fs=require('fs');var path=require(_0xfcc5('0x5'));var rimraf=require(_0xfcc5('0x6'));var config=require(_0xfcc5('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xfcc5('0x8')]=function(_0x1ba0c0,_0x1b65cc){return _0x1ba0c0['define'](_0xfcc5('0x9'),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 782f8e2..38863c7 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 _0x153f=['GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x32a387,_0xd5840d){var _0x3a18b7=function(_0x1a742e){while(--_0x1a742e){_0x32a387['push'](_0x32a387['shift']());}};_0x3a18b7(++_0xd5840d);}(_0x153f,0x15b));var _0xf153=function(_0x294e8b,_0x4d1f14){_0x294e8b=_0x294e8b-0x0;var _0x51516d=_0x153f[_0x294e8b];return _0x51516d;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});}exports[_0xf153('0x17')]=function(_0x138dbe){var _0x44272e=this;return new Promise(function(_0x4e790d,_0x357d57){return db[_0xf153('0x18')][_0xf153('0x19')]({'raw':_0x138dbe[_0xf153('0x1a')]?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1b')]===undefined?!![]:![]:!![],'where':_0x138dbe[_0xf153('0x1a')]?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1c')]||null:null,'attributes':_0x138dbe[_0xf153('0x1a')]?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1d')]||null:null,'limit':_0x138dbe['options']?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1e')]||null:null,'include':_0x138dbe[_0xf153('0x1a')]?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1f')]?_[_0xf153('0x20')](_0x138dbe[_0xf153('0x1a')][_0xf153('0x1f')],function(_0xf67cde){return{'model':db[_0xf67cde[_0xf153('0x21')]],'as':_0xf67cde['as'],'attributes':_0xf67cde[_0xf153('0x1d')],'include':_0xf67cde[_0xf153('0x1f')]?_[_0xf153('0x20')](_0xf67cde[_0xf153('0x1f')],function(_0xe490f8){return{'model':db[_0xe490f8[_0xf153('0x21')]],'as':_0xe490f8['as'],'attributes':_0xe490f8[_0xf153('0x1d')],'include':_0xe490f8[_0xf153('0x1f')]?_[_0xf153('0x20')](_0xe490f8[_0xf153('0x1f')],function(_0x48ebdc){return{'model':db[_0x48ebdc[_0xf153('0x21')]],'as':_0x48ebdc['as'],'attributes':_0x48ebdc[_0xf153('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16cdcd){logger[_0xf153('0xe')]('GetVtigerAccount',_0x138dbe);logger[_0xf153('0x11')](_0xf153('0x17'),_0x138dbe,JSON[_0xf153('0x12')](_0x16cdcd));_0x4e790d(_0x16cdcd);})[_0xf153('0x22')](function(_0x339e96){logger[_0xf153('0x13')](_0xf153('0x17'),_0x339e96[_0xf153('0x15')],_0x138dbe);_0x357d57(_0x44272e[_0xf153('0x13')](0x1f4,_0x339e96[_0xf153('0x15')]));});});};exports[_0xf153('0x23')]=function(_0x415a5f){var _0x5b5237=this;return new Promise(function(_0x258fb0,_0xbb3619){return db[_0xf153('0x18')][_0xf153('0x24')]({'raw':_0x415a5f['options']?_0x415a5f['options'][_0xf153('0x1b')]===undefined?!![]:![]:!![],'where':_0x415a5f['options']?_0x415a5f['options'][_0xf153('0x1c')]||null:null,'attributes':_0x415a5f['options']?_0x415a5f[_0xf153('0x1a')]['attributes']||null:null,'include':_0x415a5f[_0xf153('0x1a')]?_0x415a5f[_0xf153('0x1a')]['include']?_[_0xf153('0x20')](_0x415a5f[_0xf153('0x1a')][_0xf153('0x1f')],function(_0x40be52){return{'model':db[_0x40be52[_0xf153('0x21')]],'as':_0x40be52['as'],'attributes':_0x40be52[_0xf153('0x1d')],'include':_0x40be52['include']?_[_0xf153('0x20')](_0x40be52['include'],function(_0x40834b){return{'model':db[_0x40834b[_0xf153('0x21')]],'as':_0x40834b['as'],'attributes':_0x40834b[_0xf153('0x1d')],'include':_0x40834b[_0xf153('0x1f')]?_[_0xf153('0x20')](_0x40834b[_0xf153('0x1f')],function(_0x4becf3){return{'model':db[_0x4becf3[_0xf153('0x21')]],'as':_0x4becf3['as'],'attributes':_0x4becf3[_0xf153('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf153('0xd')](function(_0x4e0634){logger[_0xf153('0xe')](_0xf153('0x23'),_0x415a5f);logger[_0xf153('0x11')](_0xf153('0x23'),_0x415a5f,JSON[_0xf153('0x12')](_0x4e0634));_0x258fb0(_0x4e0634);})[_0xf153('0x22')](function(_0x4cc481){logger[_0xf153('0x13')](_0xf153('0x23'),_0x4cc481['message'],_0x415a5f);_0xbb3619(_0x5b5237[_0xf153('0x13')](0x1f4,_0x4cc481[_0xf153('0x15')]));});});}; \ No newline at end of file +var _0x6b20=['../../config/environment','jayson/promise','client','http','request','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','map','attributes','include','model','then','debug','stringify','catch','ShowVtigerAccount','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x6b20,0xd1));var _0x06b2=function(_0x501e8d,_0x56ab18){_0x501e8d=_0x501e8d-0x0;var _0x1c0f16=_0x6b20[_0x501e8d];return _0x1c0f16;};'use strict';var _=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var moment=require('moment');var BPromise=require(_0x06b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06b2('0x3'));var db=require(_0x06b2('0x4'))['db'];var utils=require(_0x06b2('0x5'));var logger=require('../../config/logger')(_0x06b2('0x6'));var config=require(_0x06b2('0x7'));var jayson=require(_0x06b2('0x8'));var client=jayson[_0x06b2('0x9')][_0x06b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37b825,_0x26a325,_0x4e6d3b){return new BPromise(function(_0x21cd31,_0x1828e4){return client[_0x06b2('0xb')](_0x37b825,_0x4e6d3b)['then'](function(_0x37ace0){logger['info'](_0x06b2('0xc'),_0x26a325,'request\x20sent');logger['debug'](_0x06b2('0xd'),_0x26a325,_0x06b2('0xe'),JSON['stringify'](_0x37ace0));if(_0x37ace0[_0x06b2('0xf')]){if(_0x37ace0[_0x06b2('0xf')][_0x06b2('0x10')]===0x1f4){logger[_0x06b2('0xf')](_0x06b2('0xc'),_0x26a325,_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);return _0x1828e4(_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);}logger[_0x06b2('0xf')](_0x06b2('0xc'),_0x26a325,_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);return _0x21cd31(_0x37ace0['error'][_0x06b2('0x11')]);}else{logger[_0x06b2('0x12')](_0x06b2('0xc'),_0x26a325,_0x06b2('0xe'));_0x21cd31(_0x37ace0[_0x06b2('0x13')][_0x06b2('0x11')]);}})['catch'](function(_0x17e69b){logger[_0x06b2('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x26a325,_0x17e69b);_0x1828e4(_0x17e69b);});});}exports[_0x06b2('0x14')]=function(_0x594b48){var _0x4c9cae=this;return new Promise(function(_0x192270,_0x1b4ab0){return db[_0x06b2('0x15')][_0x06b2('0x16')]({'raw':_0x594b48['options']?_0x594b48[_0x06b2('0x17')][_0x06b2('0x18')]===undefined?!![]:![]:!![],'where':_0x594b48[_0x06b2('0x17')]?_0x594b48[_0x06b2('0x17')][_0x06b2('0x19')]||null:null,'attributes':_0x594b48[_0x06b2('0x17')]?_0x594b48[_0x06b2('0x17')]['attributes']||null:null,'limit':_0x594b48[_0x06b2('0x17')]?_0x594b48[_0x06b2('0x17')][_0x06b2('0x1a')]||null:null,'include':_0x594b48[_0x06b2('0x17')]?_0x594b48['options']['include']?_[_0x06b2('0x1b')](_0x594b48[_0x06b2('0x17')]['include'],function(_0x39659f){return{'model':db[_0x39659f['model']],'as':_0x39659f['as'],'attributes':_0x39659f[_0x06b2('0x1c')],'include':_0x39659f[_0x06b2('0x1d')]?_[_0x06b2('0x1b')](_0x39659f['include'],function(_0x4382ce){return{'model':db[_0x4382ce[_0x06b2('0x1e')]],'as':_0x4382ce['as'],'attributes':_0x4382ce[_0x06b2('0x1c')],'include':_0x4382ce[_0x06b2('0x1d')]?_[_0x06b2('0x1b')](_0x4382ce['include'],function(_0xbb00ea){return{'model':db[_0xbb00ea[_0x06b2('0x1e')]],'as':_0xbb00ea['as'],'attributes':_0xbb00ea[_0x06b2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x06b2('0x1f')](function(_0x1976ac){logger[_0x06b2('0x12')]('GetVtigerAccount',_0x594b48);logger[_0x06b2('0x20')](_0x06b2('0x14'),_0x594b48,JSON[_0x06b2('0x21')](_0x1976ac));_0x192270(_0x1976ac);})[_0x06b2('0x22')](function(_0x1f02d8){logger[_0x06b2('0xf')](_0x06b2('0x14'),_0x1f02d8['message'],_0x594b48);_0x1b4ab0(_0x4c9cae[_0x06b2('0xf')](0x1f4,_0x1f02d8[_0x06b2('0x11')]));});});};exports[_0x06b2('0x23')]=function(_0x15a78b){var _0x1cc725=this;return new Promise(function(_0x37d391,_0x401551){return db[_0x06b2('0x15')]['find']({'raw':_0x15a78b[_0x06b2('0x17')]?_0x15a78b[_0x06b2('0x17')][_0x06b2('0x18')]===undefined?!![]:![]:!![],'where':_0x15a78b[_0x06b2('0x17')]?_0x15a78b[_0x06b2('0x17')][_0x06b2('0x19')]||null:null,'attributes':_0x15a78b[_0x06b2('0x17')]?_0x15a78b['options']['attributes']||null:null,'include':_0x15a78b[_0x06b2('0x17')]?_0x15a78b[_0x06b2('0x17')][_0x06b2('0x1d')]?_['map'](_0x15a78b[_0x06b2('0x17')][_0x06b2('0x1d')],function(_0x37bfb5){return{'model':db[_0x37bfb5[_0x06b2('0x1e')]],'as':_0x37bfb5['as'],'attributes':_0x37bfb5[_0x06b2('0x1c')],'include':_0x37bfb5[_0x06b2('0x1d')]?_['map'](_0x37bfb5[_0x06b2('0x1d')],function(_0x1e66f1){return{'model':db[_0x1e66f1[_0x06b2('0x1e')]],'as':_0x1e66f1['as'],'attributes':_0x1e66f1['attributes'],'include':_0x1e66f1[_0x06b2('0x1d')]?_[_0x06b2('0x1b')](_0x1e66f1['include'],function(_0x45ea67){return{'model':db[_0x45ea67[_0x06b2('0x1e')]],'as':_0x45ea67['as'],'attributes':_0x45ea67[_0x06b2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x06b2('0x1f')](function(_0x2e49df){logger[_0x06b2('0x12')](_0x06b2('0x23'),_0x15a78b);logger[_0x06b2('0x20')](_0x06b2('0x23'),_0x15a78b,JSON[_0x06b2('0x21')](_0x2e49df));_0x37d391(_0x2e49df);})[_0x06b2('0x22')](function(_0x1cc7b6){logger['error'](_0x06b2('0x23'),_0x1cc7b6['message'],_0x15a78b);_0x401551(_0x1cc725['error'](0x1f4,_0x1cc7b6[_0x06b2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 2a26c02..575c801 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 _0x8d93=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/subjects','getSubjects'];(function(_0x3f7191,_0x1d9f9e){var _0x55977c=function(_0x2b17a9){while(--_0x2b17a9){_0x3f7191['push'](_0x3f7191['shift']());}};_0x55977c(++_0x1d9f9e);}(_0x8d93,0x64));var _0x38d9=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0x8d93[_0x2adfb1];return _0xa52d45;};'use strict';var multer=require(_0x38d9('0x0'));var util=require(_0x38d9('0x1'));var path=require(_0x38d9('0x2'));var timeout=require(_0x38d9('0x3'));var express=require(_0x38d9('0x4'));var router=express[_0x38d9('0x5')]();var fs_extra=require(_0x38d9('0x6'));var auth=require(_0x38d9('0x7'));var interaction=require(_0x38d9('0x8'));var config=require(_0x38d9('0x9'));var controller=require('./intVtigerConfiguration.controller');router[_0x38d9('0xa')]('/',auth[_0x38d9('0xb')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x38d9('0xc')]);router[_0x38d9('0xa')]('/:id/fields',auth[_0x38d9('0xb')](),controller['getFields']);router['get'](_0x38d9('0xd'),auth[_0x38d9('0xb')](),controller[_0x38d9('0xe')]);router[_0x38d9('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x38d9('0xf')]('/',auth[_0x38d9('0xb')](),controller[_0x38d9('0x10')]);router[_0x38d9('0x11')](_0x38d9('0x12'),auth[_0x38d9('0xb')](),controller[_0x38d9('0x13')]);router[_0x38d9('0x14')](_0x38d9('0x12'),auth[_0x38d9('0xb')](),controller[_0x38d9('0x15')]);module[_0x38d9('0x16')]=router; \ No newline at end of file +var _0x9097=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0xcdee45,_0x3d9a00){var _0x260860=function(_0x4c6bf5){while(--_0x4c6bf5){_0xcdee45['push'](_0xcdee45['shift']());}};_0x260860(++_0x3d9a00);}(_0x9097,0x19b));var _0x7909=function(_0x8c1925,_0x280e1b){_0x8c1925=_0x8c1925-0x0;var _0x167778=_0x9097[_0x8c1925];return _0x167778;};'use strict';var multer=require(_0x7909('0x0'));var util=require(_0x7909('0x1'));var path=require('path');var timeout=require(_0x7909('0x2'));var express=require(_0x7909('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7909('0x4'));var interaction=require(_0x7909('0x5'));var config=require(_0x7909('0x6'));var controller=require(_0x7909('0x7'));router[_0x7909('0x8')]('/',auth[_0x7909('0x9')](),controller[_0x7909('0xa')]);router[_0x7909('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7909('0xb')]);router[_0x7909('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7909('0xc')]);router[_0x7909('0x8')](_0x7909('0xd'),auth['isAuthenticated'](),controller[_0x7909('0xe')]);router[_0x7909('0x8')](_0x7909('0xf'),auth['isAuthenticated'](),controller[_0x7909('0x10')]);router[_0x7909('0x11')]('/',auth['isAuthenticated'](),controller[_0x7909('0x12')]);router['put'](_0x7909('0x13'),auth[_0x7909('0x9')](),controller[_0x7909('0x14')]);router['delete'](_0x7909('0x13'),auth[_0x7909('0x9')](),controller[_0x7909('0x15')]);module[_0x7909('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index ad594de..64d80e8 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 _0x0b59=['exports','STRING','sequelize'];(function(_0x362f55,_0x340d08){var _0xac0797=function(_0x44463c){while(--_0x44463c){_0x362f55['push'](_0x362f55['shift']());}};_0xac0797(++_0x340d08);}(_0x0b59,0x1ca));var _0x90b5=function(_0x1dc422,_0x55fa37){_0x1dc422=_0x1dc422-0x0;var _0x1eb6ea=_0x0b59[_0x1dc422];return _0x1eb6ea;};'use strict';var Sequelize=require(_0x90b5('0x0'));module[_0x90b5('0x1')]={'name':{'type':Sequelize[_0x90b5('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x214b=['STRING','exports'];(function(_0x2f3990,_0x47a4e1){var _0x22981e=function(_0x22ce2c){while(--_0x22ce2c){_0x2f3990['push'](_0x2f3990['shift']());}};_0x22981e(++_0x47a4e1);}(_0x214b,0x85));var _0xb214=function(_0x17fa28,_0x182e78){_0x17fa28=_0x17fa28-0x0;var _0x288972=_0x214b[_0x17fa28];return _0x288972;};'use strict';var Sequelize=require('sequelize');module[_0xb214('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb214('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 40b73ca..6a564c2 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 _0xd526=['VtigerField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','VtigerConfiguration','rawAttributes','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','params','length','includeAll','find','catch','create','body','getFields','findOne'];(function(_0x571fb6,_0x32a500){var _0x2b4659=function(_0x10f64b){while(--_0x10f64b){_0x571fb6['push'](_0x571fb6['shift']());}};_0x2b4659(++_0x32a500);}(_0xd526,0xee));var _0x6d52=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd526[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x6d52('0x0'));var rimraf=require(_0x6d52('0x1'));var zipdir=require(_0x6d52('0x2'));var jsonpatch=require(_0x6d52('0x3'));var rp=require(_0x6d52('0x4'));var moment=require(_0x6d52('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6d52('0x6'));var util=require(_0x6d52('0x7'));var path=require(_0x6d52('0x8'));var sox=require(_0x6d52('0x9'));var csv=require(_0x6d52('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d52('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6d52('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6d52('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6d52('0xe'));var Redis=require(_0x6d52('0xf'));var authService=require(_0x6d52('0x10'));var qs=require(_0x6d52('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d52('0x12'));var logger=require(_0x6d52('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x6d52('0x14'));var licenseUtil=require(_0x6d52('0x15'));var db=require(_0x6d52('0x16'))['db'];function respondWithStatusCode(_0x594595,_0x4b0c00){_0x4b0c00=_0x4b0c00||0xcc;return function(_0x1bc9a4){if(_0x1bc9a4){return _0x594595[_0x6d52('0x17')](_0x4b0c00);}return _0x594595['status'](_0x4b0c00)[_0x6d52('0x18')]();};}function respondWithResult(_0xe47d8a,_0x52b05c){_0x52b05c=_0x52b05c||0xc8;return function(_0x2afc6f){if(_0x2afc6f){return _0xe47d8a[_0x6d52('0x19')](_0x52b05c)[_0x6d52('0x1a')](_0x2afc6f);}};}function respondWithFilteredResult(_0x25d35d,_0x420cb2){return function(_0x30ef52){if(_0x30ef52){var _0x3fbd61=typeof _0x420cb2[_0x6d52('0x1b')]===_0x6d52('0x1c')&&typeof _0x420cb2[_0x6d52('0x1d')]===_0x6d52('0x1c');var _0x2d9cec=_0x30ef52[_0x6d52('0x1e')];var _0x1aa89d=_0x3fbd61?0x0:_0x420cb2[_0x6d52('0x1b')];var _0x12c18c=_0x3fbd61?_0x30ef52[_0x6d52('0x1e')]:_0x420cb2[_0x6d52('0x1b')]+_0x420cb2['limit'];var _0xb96c05;if(_0x12c18c>=_0x2d9cec){_0x12c18c=_0x2d9cec;_0xb96c05=0xc8;}else{_0xb96c05=0xce;}_0x25d35d[_0x6d52('0x19')](_0xb96c05);return _0x25d35d[_0x6d52('0x1f')](_0x6d52('0x20'),_0x1aa89d+'-'+_0x12c18c+'/'+_0x2d9cec)[_0x6d52('0x1a')](_0x30ef52);}return null;};}function patchUpdates(_0x5dd04c){return function(_0x42140f){try{jsonpatch[_0x6d52('0x21')](_0x42140f,_0x5dd04c,!![]);}catch(_0x5563fa){return BPromise[_0x6d52('0x22')](_0x5563fa);}return _0x42140f[_0x6d52('0x23')]();};}function saveUpdates(_0x4a7b06,_0x1b5b0d){return function(_0xff8124){if(_0xff8124){return _0xff8124[_0x6d52('0x24')](_0x4a7b06)['then'](function(_0x589541){return _0x589541;});}return null;};}function removeEntity(_0x2e5521,_0x2ed108){return function(_0x1ff1a5){if(_0x1ff1a5){return _0x1ff1a5[_0x6d52('0x25')]()[_0x6d52('0x26')](function(){_0x2e5521[_0x6d52('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c092c,_0x25c310){return function(_0x2e864c){if(!_0x2e864c){_0x4c092c[_0x6d52('0x17')](0x194);}return _0x2e864c;};}function handleError(_0xf88161,_0x1a4d89){_0x1a4d89=_0x1a4d89||0x1f4;return function(_0x38c58c){logger[_0x6d52('0x27')](_0x38c58c[_0x6d52('0x28')]);if(_0x38c58c[_0x6d52('0x29')]){delete _0x38c58c[_0x6d52('0x29')];}_0xf88161['status'](_0x1a4d89)[_0x6d52('0x2a')](_0x38c58c);};}exports[_0x6d52('0x2b')]=function(_0x27b7ed,_0xdb35d2){var _0x3d2b7a={},_0x5be5b5={},_0x33a7d2={'count':0x0,'rows':[]};var _0x57f809=_['map'](db[_0x6d52('0x2c')][_0x6d52('0x2d')],function(_0x3718d8){return{'name':_0x3718d8['fieldName'],'type':_0x3718d8['type']['key']};});_0x5be5b5[_0x6d52('0x2e')]=_[_0x6d52('0x2f')](_0x57f809,_0x6d52('0x29'));_0x5be5b5['query']=_[_0x6d52('0x30')](_0x27b7ed[_0x6d52('0x31')]);_0x5be5b5[_0x6d52('0x32')]=_[_0x6d52('0x33')](_0x5be5b5[_0x6d52('0x2e')],_0x5be5b5[_0x6d52('0x31')]);_0x3d2b7a[_0x6d52('0x34')]=_['intersection'](_0x5be5b5[_0x6d52('0x2e')],qs[_0x6d52('0x35')](_0x27b7ed['query'][_0x6d52('0x35')]));_0x3d2b7a[_0x6d52('0x34')]=_0x3d2b7a['attributes']['length']?_0x3d2b7a['attributes']:_0x5be5b5[_0x6d52('0x2e')];if(!_0x27b7ed[_0x6d52('0x31')][_0x6d52('0x36')](_0x6d52('0x37'))){_0x3d2b7a[_0x6d52('0x1d')]=qs[_0x6d52('0x1d')](_0x27b7ed[_0x6d52('0x31')][_0x6d52('0x1d')]);_0x3d2b7a[_0x6d52('0x1b')]=qs[_0x6d52('0x1b')](_0x27b7ed['query']['offset']);}_0x3d2b7a[_0x6d52('0x38')]=qs['sort'](_0x27b7ed[_0x6d52('0x31')][_0x6d52('0x39')]);_0x3d2b7a[_0x6d52('0x3a')]=qs[_0x6d52('0x32')](_['pick'](_0x27b7ed['query'],_0x5be5b5[_0x6d52('0x32')]),_0x57f809);if(_0x27b7ed[_0x6d52('0x31')][_0x6d52('0x3b')]){_0x3d2b7a['where']=_[_0x6d52('0x3c')](_0x3d2b7a[_0x6d52('0x3a')],{'$or':_[_0x6d52('0x2f')](_0x57f809,function(_0x3824ad){if(_0x3824ad['type']!==_0x6d52('0x3d')){var _0x152684={};_0x152684[_0x3824ad[_0x6d52('0x29')]]={'$like':'%'+_0x27b7ed[_0x6d52('0x31')][_0x6d52('0x3b')]+'%'};return _0x152684;}})});}_0x3d2b7a=_[_0x6d52('0x3c')]({},_0x3d2b7a,_0x27b7ed[_0x6d52('0x3e')]);var _0x61138b={'where':_0x3d2b7a['where']};return db[_0x6d52('0x2c')]['count'](_0x61138b)[_0x6d52('0x26')](function(_0x1e776e){_0x33a7d2['count']=_0x1e776e;if(_0x27b7ed[_0x6d52('0x31')]['includeAll']){_0x3d2b7a[_0x6d52('0x3f')]=[{'all':!![]}];}return db[_0x6d52('0x2c')][_0x6d52('0x40')](_0x3d2b7a);})['then'](function(_0x22bae2){_0x33a7d2['rows']=_0x22bae2;return _0x33a7d2;})['then'](respondWithFilteredResult(_0xdb35d2,_0x3d2b7a))['catch'](handleError(_0xdb35d2,null));};exports['show']=function(_0x2bf191,_0x40e69b){var _0x25b7a8={'raw':![],'where':{'id':_0x2bf191[_0x6d52('0x41')]['id']}},_0x2bcbac={};_0x2bcbac[_0x6d52('0x2e')]=_['keys'](db[_0x6d52('0x2c')][_0x6d52('0x2d')]);_0x2bcbac['query']=_[_0x6d52('0x30')](_0x2bf191[_0x6d52('0x31')]);_0x2bcbac['filters']=_[_0x6d52('0x33')](_0x2bcbac[_0x6d52('0x2e')],_0x2bcbac[_0x6d52('0x31')]);_0x25b7a8[_0x6d52('0x34')]=_[_0x6d52('0x33')](_0x2bcbac[_0x6d52('0x2e')],qs[_0x6d52('0x35')](_0x2bf191[_0x6d52('0x31')][_0x6d52('0x35')]));_0x25b7a8[_0x6d52('0x34')]=_0x25b7a8['attributes'][_0x6d52('0x42')]?_0x25b7a8[_0x6d52('0x34')]:_0x2bcbac[_0x6d52('0x2e')];if(_0x2bf191[_0x6d52('0x31')][_0x6d52('0x43')]){_0x25b7a8[_0x6d52('0x3f')]=[{'all':!![]}];}_0x25b7a8=_[_0x6d52('0x3c')]({},_0x25b7a8,_0x2bf191['options']);return db[_0x6d52('0x2c')][_0x6d52('0x44')](_0x25b7a8)[_0x6d52('0x26')](handleEntityNotFound(_0x40e69b,null))[_0x6d52('0x26')](respondWithResult(_0x40e69b,null))[_0x6d52('0x45')](handleError(_0x40e69b,null));};exports[_0x6d52('0x46')]=function(_0x5c650b,_0x146c59){return db['VtigerConfiguration'][_0x6d52('0x46')](_0x5c650b[_0x6d52('0x47')],{})[_0x6d52('0x26')](respondWithResult(_0x146c59,0xc9))[_0x6d52('0x45')](handleError(_0x146c59,null));};exports[_0x6d52('0x24')]=function(_0xda73c3,_0x50e9b7){if(_0xda73c3['body']['id']){delete _0xda73c3[_0x6d52('0x47')]['id'];}return db[_0x6d52('0x2c')][_0x6d52('0x44')]({'where':{'id':_0xda73c3['params']['id']}})[_0x6d52('0x26')](handleEntityNotFound(_0x50e9b7,null))[_0x6d52('0x26')](saveUpdates(_0xda73c3['body'],null))[_0x6d52('0x26')](respondWithResult(_0x50e9b7,null))[_0x6d52('0x45')](handleError(_0x50e9b7,null));};exports['destroy']=function(_0x45abfd,_0x35f8a6){return db[_0x6d52('0x2c')]['find']({'where':{'id':_0x45abfd[_0x6d52('0x41')]['id']}})[_0x6d52('0x26')](handleEntityNotFound(_0x35f8a6,null))[_0x6d52('0x26')](removeEntity(_0x35f8a6,null))[_0x6d52('0x45')](handleError(_0x35f8a6,null));};exports[_0x6d52('0x48')]=function(_0x175392,_0x1639a8,_0x30e076){var _0x28d035={};var _0x5aae29={};var _0x1eee10;var _0x5f4efe;return db[_0x6d52('0x2c')][_0x6d52('0x49')]({'where':{'id':_0x175392[_0x6d52('0x41')]['id']}})[_0x6d52('0x26')](handleEntityNotFound(_0x1639a8,null))[_0x6d52('0x26')](function(_0x3053d7){if(_0x3053d7){_0x1eee10=_0x3053d7;_0x5aae29[_0x6d52('0x2e')]=_['keys'](db[_0x6d52('0x4a')]['rawAttributes']);_0x5aae29[_0x6d52('0x31')]=_[_0x6d52('0x30')](_0x175392[_0x6d52('0x31')]);_0x5aae29['filters']=_[_0x6d52('0x33')](_0x5aae29[_0x6d52('0x2e')],_0x5aae29[_0x6d52('0x31')]);_0x28d035[_0x6d52('0x34')]=_[_0x6d52('0x33')](_0x5aae29['model'],qs[_0x6d52('0x35')](_0x175392[_0x6d52('0x31')][_0x6d52('0x35')]));_0x28d035[_0x6d52('0x34')]=_0x28d035[_0x6d52('0x34')][_0x6d52('0x42')]?_0x28d035['attributes']:_0x5aae29[_0x6d52('0x2e')];_0x28d035[_0x6d52('0x38')]=qs[_0x6d52('0x39')](_0x175392[_0x6d52('0x31')][_0x6d52('0x39')]);_0x28d035[_0x6d52('0x3a')]=qs['filters'](_[_0x6d52('0x4b')](_0x175392['query'],_0x5aae29[_0x6d52('0x32')]));if(_0x175392[_0x6d52('0x31')]['filter']){_0x28d035[_0x6d52('0x3a')]=_[_0x6d52('0x3c')](_0x28d035[_0x6d52('0x3a')],{'$or':_[_0x6d52('0x2f')](_0x28d035['attributes'],function(_0x537d82){var _0x56a45e={};_0x56a45e[_0x537d82]={'$like':'%'+_0x175392[_0x6d52('0x31')][_0x6d52('0x3b')]+'%'};return _0x56a45e;})});}_0x28d035=_[_0x6d52('0x3c')]({},_0x28d035,_0x175392[_0x6d52('0x3e')]);return _0x1eee10[_0x6d52('0x48')](_0x28d035);}})[_0x6d52('0x26')](function(_0x2b016a){if(_0x2b016a){_0x5f4efe=_0x2b016a[_0x6d52('0x42')];if(!_0x175392[_0x6d52('0x31')][_0x6d52('0x36')](_0x6d52('0x37'))){_0x28d035[_0x6d52('0x1d')]=qs['limit'](_0x175392[_0x6d52('0x31')]['limit']);_0x28d035[_0x6d52('0x1b')]=qs[_0x6d52('0x1b')](_0x175392['query'][_0x6d52('0x1b')]);}return _0x1eee10[_0x6d52('0x48')](_0x28d035);}})[_0x6d52('0x26')](function(_0x58c7bd){if(_0x58c7bd){return _0x58c7bd?{'count':_0x5f4efe,'rows':_0x58c7bd}:null;}})[_0x6d52('0x26')](respondWithResult(_0x1639a8,null))[_0x6d52('0x45')](handleError(_0x1639a8,null));};exports[_0x6d52('0x4c')]=function(_0x3166a4,_0x3a71c4,_0x4d950e){var _0x49eae8={};var _0x477e89={};var _0x184f35;var _0x3ed17d;return db[_0x6d52('0x2c')][_0x6d52('0x49')]({'where':{'id':_0x3166a4['params']['id']}})[_0x6d52('0x26')](handleEntityNotFound(_0x3a71c4,null))['then'](function(_0x172a47){if(_0x172a47){_0x184f35=_0x172a47;_0x477e89[_0x6d52('0x2e')]=_['keys'](db[_0x6d52('0x4a')][_0x6d52('0x2d')]);_0x477e89[_0x6d52('0x31')]=_[_0x6d52('0x30')](_0x3166a4[_0x6d52('0x31')]);_0x477e89[_0x6d52('0x32')]=_['intersection'](_0x477e89[_0x6d52('0x2e')],_0x477e89[_0x6d52('0x31')]);_0x49eae8[_0x6d52('0x34')]=_[_0x6d52('0x33')](_0x477e89[_0x6d52('0x2e')],qs[_0x6d52('0x35')](_0x3166a4[_0x6d52('0x31')][_0x6d52('0x35')]));_0x49eae8['attributes']=_0x49eae8[_0x6d52('0x34')][_0x6d52('0x42')]?_0x49eae8[_0x6d52('0x34')]:_0x477e89[_0x6d52('0x2e')];_0x49eae8[_0x6d52('0x38')]=qs[_0x6d52('0x39')](_0x3166a4['query'][_0x6d52('0x39')]);_0x49eae8['where']=qs[_0x6d52('0x32')](_[_0x6d52('0x4b')](_0x3166a4[_0x6d52('0x31')],_0x477e89[_0x6d52('0x32')]));if(_0x3166a4[_0x6d52('0x31')][_0x6d52('0x3b')]){_0x49eae8[_0x6d52('0x3a')]=_[_0x6d52('0x3c')](_0x49eae8[_0x6d52('0x3a')],{'$or':_[_0x6d52('0x2f')](_0x49eae8[_0x6d52('0x34')],function(_0x3ff74a){var _0x3d12cc={};_0x3d12cc[_0x3ff74a]={'$like':'%'+_0x3166a4[_0x6d52('0x31')][_0x6d52('0x3b')]+'%'};return _0x3d12cc;})});}_0x49eae8=_[_0x6d52('0x3c')]({},_0x49eae8,_0x3166a4['options']);return _0x184f35[_0x6d52('0x4c')](_0x49eae8);}})[_0x6d52('0x26')](function(_0x58e942){if(_0x58e942){_0x3ed17d=_0x58e942[_0x6d52('0x42')];if(!_0x3166a4['query'][_0x6d52('0x36')](_0x6d52('0x37'))){_0x49eae8[_0x6d52('0x1d')]=qs[_0x6d52('0x1d')](_0x3166a4[_0x6d52('0x31')]['limit']);_0x49eae8[_0x6d52('0x1b')]=qs[_0x6d52('0x1b')](_0x3166a4[_0x6d52('0x31')][_0x6d52('0x1b')]);}return _0x184f35[_0x6d52('0x4c')](_0x49eae8);}})['then'](function(_0x3c702a){if(_0x3c702a){return _0x3c702a?{'count':_0x3ed17d,'rows':_0x3c702a}:null;}})['then'](respondWithResult(_0x3a71c4,null))[_0x6d52('0x45')](handleError(_0x3a71c4,null));};exports[_0x6d52('0x4d')]=function(_0xef07cc,_0x34f03c,_0x76a5c9){var _0x1f4e23={};var _0x537d37={};var _0x10a32b;var _0x48cb42;return db['VtigerConfiguration']['findOne']({'where':{'id':_0xef07cc[_0x6d52('0x41')]['id']}})[_0x6d52('0x26')](handleEntityNotFound(_0x34f03c,null))[_0x6d52('0x26')](function(_0x3e7256){if(_0x3e7256){_0x10a32b=_0x3e7256;_0x537d37[_0x6d52('0x2e')]=_[_0x6d52('0x30')](db[_0x6d52('0x4a')][_0x6d52('0x2d')]);_0x537d37[_0x6d52('0x31')]=_[_0x6d52('0x30')](_0xef07cc['query']);_0x537d37[_0x6d52('0x32')]=_['intersection'](_0x537d37['model'],_0x537d37[_0x6d52('0x31')]);_0x1f4e23[_0x6d52('0x34')]=_['intersection'](_0x537d37[_0x6d52('0x2e')],qs[_0x6d52('0x35')](_0xef07cc[_0x6d52('0x31')][_0x6d52('0x35')]));_0x1f4e23[_0x6d52('0x34')]=_0x1f4e23[_0x6d52('0x34')][_0x6d52('0x42')]?_0x1f4e23[_0x6d52('0x34')]:_0x537d37[_0x6d52('0x2e')];_0x1f4e23[_0x6d52('0x38')]=qs['sort'](_0xef07cc[_0x6d52('0x31')][_0x6d52('0x39')]);_0x1f4e23[_0x6d52('0x3a')]=qs[_0x6d52('0x32')](_['pick'](_0xef07cc['query'],_0x537d37[_0x6d52('0x32')]));if(_0xef07cc[_0x6d52('0x31')][_0x6d52('0x3b')]){_0x1f4e23['where']=_[_0x6d52('0x3c')](_0x1f4e23['where'],{'$or':_[_0x6d52('0x2f')](_0x1f4e23[_0x6d52('0x34')],function(_0x1fa4f9){var _0x4681a0={};_0x4681a0[_0x1fa4f9]={'$like':'%'+_0xef07cc['query']['filter']+'%'};return _0x4681a0;})});}_0x1f4e23=_['merge']({},_0x1f4e23,_0xef07cc[_0x6d52('0x3e')]);return _0x10a32b[_0x6d52('0x4d')](_0x1f4e23);}})[_0x6d52('0x26')](function(_0xa33f62){if(_0xa33f62){_0x48cb42=_0xa33f62['length'];if(!_0xef07cc['query'][_0x6d52('0x36')](_0x6d52('0x37'))){_0x1f4e23[_0x6d52('0x1d')]=qs['limit'](_0xef07cc[_0x6d52('0x31')][_0x6d52('0x1d')]);_0x1f4e23[_0x6d52('0x1b')]=qs[_0x6d52('0x1b')](_0xef07cc[_0x6d52('0x31')][_0x6d52('0x1b')]);}return _0x10a32b[_0x6d52('0x4d')](_0x1f4e23);}})[_0x6d52('0x26')](function(_0x4d8fd2){if(_0x4d8fd2){return _0x4d8fd2?{'count':_0x48cb42,'rows':_0x4d8fd2}:null;}})[_0x6d52('0x26')](respondWithResult(_0x34f03c,null))[_0x6d52('0x45')](handleError(_0x34f03c,null));}; \ No newline at end of file +var _0xf4d2=['catch','show','keys','length','find','create','body','params','getFields','findOne','VtigerField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','name','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll'];(function(_0x650e11,_0x284f86){var _0x1a9b47=function(_0x6e15e3){while(--_0x6e15e3){_0x650e11['push'](_0x650e11['shift']());}};_0x1a9b47(++_0x284f86);}(_0xf4d2,0x1a3));var _0x2f4d=function(_0x32ac7d,_0x17f001){_0x32ac7d=_0x32ac7d-0x0;var _0x5778d5=_0xf4d2[_0x32ac7d];return _0x5778d5;};'use strict';var emlformat=require(_0x2f4d('0x0'));var rimraf=require(_0x2f4d('0x1'));var zipdir=require(_0x2f4d('0x2'));var jsonpatch=require(_0x2f4d('0x3'));var rp=require(_0x2f4d('0x4'));var moment=require(_0x2f4d('0x5'));var BPromise=require(_0x2f4d('0x6'));var Mustache=require('mustache');var util=require(_0x2f4d('0x7'));var path=require(_0x2f4d('0x8'));var sox=require(_0x2f4d('0x9'));var csv=require(_0x2f4d('0xa'));var ejs=require(_0x2f4d('0xb'));var fs=require('fs');var fs_extra=require(_0x2f4d('0xc'));var _=require('lodash');var squel=require(_0x2f4d('0xd'));var crypto=require(_0x2f4d('0xe'));var jsforce=require(_0x2f4d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2f4d('0xa'));var querystring=require('querystring');var Papa=require(_0x2f4d('0x10'));var Redis=require('ioredis');var authService=require(_0x2f4d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2f4d('0x12'));var hardwareService=require(_0x2f4d('0x13'));var logger=require(_0x2f4d('0x14'))(_0x2f4d('0x15'));var utils=require('../../config/utils');var config=require(_0x2f4d('0x16'));var licenseUtil=require(_0x2f4d('0x17'));var db=require(_0x2f4d('0x18'))['db'];function respondWithStatusCode(_0x114cd0,_0x140846){_0x140846=_0x140846||0xcc;return function(_0xeb619){if(_0xeb619){return _0x114cd0[_0x2f4d('0x19')](_0x140846);}return _0x114cd0[_0x2f4d('0x1a')](_0x140846)[_0x2f4d('0x1b')]();};}function respondWithResult(_0x227a07,_0x38939e){_0x38939e=_0x38939e||0xc8;return function(_0x589acc){if(_0x589acc){return _0x227a07[_0x2f4d('0x1a')](_0x38939e)['json'](_0x589acc);}};}function respondWithFilteredResult(_0x5229b1,_0x3ecf8a){return function(_0x115594){if(_0x115594){var _0x3a3beb=typeof _0x3ecf8a[_0x2f4d('0x1c')]==='undefined'&&typeof _0x3ecf8a[_0x2f4d('0x1d')]==='undefined';var _0x1d4e2a=_0x115594[_0x2f4d('0x1e')];var _0x3b8552=_0x3a3beb?0x0:_0x3ecf8a['offset'];var _0x2e8ad3=_0x3a3beb?_0x115594[_0x2f4d('0x1e')]:_0x3ecf8a[_0x2f4d('0x1c')]+_0x3ecf8a[_0x2f4d('0x1d')];var _0x130d03;if(_0x2e8ad3>=_0x1d4e2a){_0x2e8ad3=_0x1d4e2a;_0x130d03=0xc8;}else{_0x130d03=0xce;}_0x5229b1[_0x2f4d('0x1a')](_0x130d03);return _0x5229b1[_0x2f4d('0x1f')](_0x2f4d('0x20'),_0x3b8552+'-'+_0x2e8ad3+'/'+_0x1d4e2a)[_0x2f4d('0x21')](_0x115594);}return null;};}function patchUpdates(_0xa4733b){return function(_0x4eaf47){try{jsonpatch[_0x2f4d('0x22')](_0x4eaf47,_0xa4733b,!![]);}catch(_0x3358d5){return BPromise[_0x2f4d('0x23')](_0x3358d5);}return _0x4eaf47[_0x2f4d('0x24')]();};}function saveUpdates(_0x1ce126,_0xb1f03e){return function(_0x257963){if(_0x257963){return _0x257963[_0x2f4d('0x25')](_0x1ce126)[_0x2f4d('0x26')](function(_0x1b05fd){return _0x1b05fd;});}return null;};}function removeEntity(_0x4f2727,_0x88c299){return function(_0x49b6e3){if(_0x49b6e3){return _0x49b6e3[_0x2f4d('0x27')]()['then'](function(){_0x4f2727['status'](0xcc)[_0x2f4d('0x1b')]();});}};}function handleEntityNotFound(_0xc9a81,_0x28c0fe){return function(_0x51ada5){if(!_0x51ada5){_0xc9a81[_0x2f4d('0x19')](0x194);}return _0x51ada5;};}function handleError(_0x36acb7,_0x48d8f1){_0x48d8f1=_0x48d8f1||0x1f4;return function(_0x4778e6){logger[_0x2f4d('0x28')](_0x4778e6['stack']);if(_0x4778e6['name']){delete _0x4778e6['name'];}_0x36acb7[_0x2f4d('0x1a')](_0x48d8f1)[_0x2f4d('0x29')](_0x4778e6);};}exports[_0x2f4d('0x2a')]=function(_0x29dc78,_0x1b06f4){var _0x3fb9de={},_0xd6a4be={},_0x2b7d4d={'count':0x0,'rows':[]};var _0x8c8c5e=_['map'](db[_0x2f4d('0x2b')][_0x2f4d('0x2c')],function(_0x26fc37){return{'name':_0x26fc37[_0x2f4d('0x2d')],'type':_0x26fc37[_0x2f4d('0x2e')][_0x2f4d('0x2f')]};});_0xd6a4be[_0x2f4d('0x30')]=_[_0x2f4d('0x31')](_0x8c8c5e,_0x2f4d('0x32'));_0xd6a4be[_0x2f4d('0x33')]=_['keys'](_0x29dc78['query']);_0xd6a4be['filters']=_[_0x2f4d('0x34')](_0xd6a4be[_0x2f4d('0x30')],_0xd6a4be[_0x2f4d('0x33')]);_0x3fb9de['attributes']=_[_0x2f4d('0x34')](_0xd6a4be[_0x2f4d('0x30')],qs[_0x2f4d('0x35')](_0x29dc78[_0x2f4d('0x33')][_0x2f4d('0x35')]));_0x3fb9de[_0x2f4d('0x36')]=_0x3fb9de[_0x2f4d('0x36')]['length']?_0x3fb9de['attributes']:_0xd6a4be['model'];if(!_0x29dc78['query'][_0x2f4d('0x37')](_0x2f4d('0x38'))){_0x3fb9de[_0x2f4d('0x1d')]=qs[_0x2f4d('0x1d')](_0x29dc78[_0x2f4d('0x33')]['limit']);_0x3fb9de[_0x2f4d('0x1c')]=qs[_0x2f4d('0x1c')](_0x29dc78[_0x2f4d('0x33')][_0x2f4d('0x1c')]);}_0x3fb9de[_0x2f4d('0x39')]=qs[_0x2f4d('0x3a')](_0x29dc78[_0x2f4d('0x33')]['sort']);_0x3fb9de[_0x2f4d('0x3b')]=qs[_0x2f4d('0x3c')](_['pick'](_0x29dc78[_0x2f4d('0x33')],_0xd6a4be[_0x2f4d('0x3c')]),_0x8c8c5e);if(_0x29dc78[_0x2f4d('0x33')][_0x2f4d('0x3d')]){_0x3fb9de[_0x2f4d('0x3b')]=_[_0x2f4d('0x3e')](_0x3fb9de[_0x2f4d('0x3b')],{'$or':_['map'](_0x8c8c5e,function(_0xa5967c){if(_0xa5967c[_0x2f4d('0x2e')]!=='VIRTUAL'){var _0x19f44d={};_0x19f44d[_0xa5967c[_0x2f4d('0x32')]]={'$like':'%'+_0x29dc78[_0x2f4d('0x33')][_0x2f4d('0x3d')]+'%'};return _0x19f44d;}})});}_0x3fb9de=_['merge']({},_0x3fb9de,_0x29dc78[_0x2f4d('0x3f')]);var _0x284734={'where':_0x3fb9de[_0x2f4d('0x3b')]};return db[_0x2f4d('0x2b')]['count'](_0x284734)['then'](function(_0x475f7c){_0x2b7d4d[_0x2f4d('0x1e')]=_0x475f7c;if(_0x29dc78[_0x2f4d('0x33')][_0x2f4d('0x40')]){_0x3fb9de[_0x2f4d('0x41')]=[{'all':!![]}];}return db[_0x2f4d('0x2b')][_0x2f4d('0x42')](_0x3fb9de);})[_0x2f4d('0x26')](function(_0x2c6194){_0x2b7d4d['rows']=_0x2c6194;return _0x2b7d4d;})['then'](respondWithFilteredResult(_0x1b06f4,_0x3fb9de))[_0x2f4d('0x43')](handleError(_0x1b06f4,null));};exports[_0x2f4d('0x44')]=function(_0x250214,_0x4fe592){var _0x37bdbf={'raw':![],'where':{'id':_0x250214['params']['id']}},_0x48ba0c={};_0x48ba0c[_0x2f4d('0x30')]=_[_0x2f4d('0x45')](db[_0x2f4d('0x2b')]['rawAttributes']);_0x48ba0c[_0x2f4d('0x33')]=_[_0x2f4d('0x45')](_0x250214[_0x2f4d('0x33')]);_0x48ba0c[_0x2f4d('0x3c')]=_[_0x2f4d('0x34')](_0x48ba0c[_0x2f4d('0x30')],_0x48ba0c[_0x2f4d('0x33')]);_0x37bdbf['attributes']=_[_0x2f4d('0x34')](_0x48ba0c[_0x2f4d('0x30')],qs[_0x2f4d('0x35')](_0x250214['query'][_0x2f4d('0x35')]));_0x37bdbf[_0x2f4d('0x36')]=_0x37bdbf['attributes'][_0x2f4d('0x46')]?_0x37bdbf[_0x2f4d('0x36')]:_0x48ba0c[_0x2f4d('0x30')];if(_0x250214[_0x2f4d('0x33')]['includeAll']){_0x37bdbf[_0x2f4d('0x41')]=[{'all':!![]}];}_0x37bdbf=_[_0x2f4d('0x3e')]({},_0x37bdbf,_0x250214['options']);return db['VtigerConfiguration'][_0x2f4d('0x47')](_0x37bdbf)[_0x2f4d('0x26')](handleEntityNotFound(_0x4fe592,null))['then'](respondWithResult(_0x4fe592,null))['catch'](handleError(_0x4fe592,null));};exports[_0x2f4d('0x48')]=function(_0xf09230,_0x5c3034){return db['VtigerConfiguration'][_0x2f4d('0x48')](_0xf09230['body'],{})[_0x2f4d('0x26')](respondWithResult(_0x5c3034,0xc9))[_0x2f4d('0x43')](handleError(_0x5c3034,null));};exports[_0x2f4d('0x25')]=function(_0x45437c,_0x4e2642){if(_0x45437c[_0x2f4d('0x49')]['id']){delete _0x45437c[_0x2f4d('0x49')]['id'];}return db['VtigerConfiguration'][_0x2f4d('0x47')]({'where':{'id':_0x45437c[_0x2f4d('0x4a')]['id']}})[_0x2f4d('0x26')](handleEntityNotFound(_0x4e2642,null))[_0x2f4d('0x26')](saveUpdates(_0x45437c[_0x2f4d('0x49')],null))[_0x2f4d('0x26')](respondWithResult(_0x4e2642,null))[_0x2f4d('0x43')](handleError(_0x4e2642,null));};exports[_0x2f4d('0x27')]=function(_0x576533,_0x27a8d3){return db[_0x2f4d('0x2b')][_0x2f4d('0x47')]({'where':{'id':_0x576533[_0x2f4d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x27a8d3,null))['then'](removeEntity(_0x27a8d3,null))[_0x2f4d('0x43')](handleError(_0x27a8d3,null));};exports[_0x2f4d('0x4b')]=function(_0x373533,_0x228d8d,_0x51b7b5){var _0x384b10={};var _0x24f7e4={};var _0x2735f9;var _0x1a19fa;return db[_0x2f4d('0x2b')][_0x2f4d('0x4c')]({'where':{'id':_0x373533['params']['id']}})[_0x2f4d('0x26')](handleEntityNotFound(_0x228d8d,null))[_0x2f4d('0x26')](function(_0x3c3b1b){if(_0x3c3b1b){_0x2735f9=_0x3c3b1b;_0x24f7e4[_0x2f4d('0x30')]=_[_0x2f4d('0x45')](db[_0x2f4d('0x4d')][_0x2f4d('0x2c')]);_0x24f7e4[_0x2f4d('0x33')]=_[_0x2f4d('0x45')](_0x373533[_0x2f4d('0x33')]);_0x24f7e4[_0x2f4d('0x3c')]=_['intersection'](_0x24f7e4['model'],_0x24f7e4[_0x2f4d('0x33')]);_0x384b10[_0x2f4d('0x36')]=_[_0x2f4d('0x34')](_0x24f7e4[_0x2f4d('0x30')],qs[_0x2f4d('0x35')](_0x373533[_0x2f4d('0x33')]['fields']));_0x384b10[_0x2f4d('0x36')]=_0x384b10[_0x2f4d('0x36')]['length']?_0x384b10['attributes']:_0x24f7e4[_0x2f4d('0x30')];_0x384b10[_0x2f4d('0x39')]=qs[_0x2f4d('0x3a')](_0x373533[_0x2f4d('0x33')][_0x2f4d('0x3a')]);_0x384b10['where']=qs[_0x2f4d('0x3c')](_[_0x2f4d('0x4e')](_0x373533['query'],_0x24f7e4[_0x2f4d('0x3c')]));if(_0x373533[_0x2f4d('0x33')][_0x2f4d('0x3d')]){_0x384b10[_0x2f4d('0x3b')]=_['merge'](_0x384b10[_0x2f4d('0x3b')],{'$or':_['map'](_0x384b10[_0x2f4d('0x36')],function(_0x14610e){var _0x5a2deb={};_0x5a2deb[_0x14610e]={'$like':'%'+_0x373533[_0x2f4d('0x33')][_0x2f4d('0x3d')]+'%'};return _0x5a2deb;})});}_0x384b10=_['merge']({},_0x384b10,_0x373533[_0x2f4d('0x3f')]);return _0x2735f9[_0x2f4d('0x4b')](_0x384b10);}})[_0x2f4d('0x26')](function(_0x53b2bb){if(_0x53b2bb){_0x1a19fa=_0x53b2bb[_0x2f4d('0x46')];if(!_0x373533[_0x2f4d('0x33')]['hasOwnProperty'](_0x2f4d('0x38'))){_0x384b10[_0x2f4d('0x1d')]=qs[_0x2f4d('0x1d')](_0x373533[_0x2f4d('0x33')]['limit']);_0x384b10[_0x2f4d('0x1c')]=qs[_0x2f4d('0x1c')](_0x373533[_0x2f4d('0x33')][_0x2f4d('0x1c')]);}return _0x2735f9[_0x2f4d('0x4b')](_0x384b10);}})['then'](function(_0x5d4e17){if(_0x5d4e17){return _0x5d4e17?{'count':_0x1a19fa,'rows':_0x5d4e17}:null;}})[_0x2f4d('0x26')](respondWithResult(_0x228d8d,null))[_0x2f4d('0x43')](handleError(_0x228d8d,null));};exports[_0x2f4d('0x4f')]=function(_0x4a14e3,_0x557ba0,_0x33e06a){var _0x4e4dbe={};var _0x5a3340={};var _0x4c370d;var _0x490737;return db[_0x2f4d('0x2b')][_0x2f4d('0x4c')]({'where':{'id':_0x4a14e3[_0x2f4d('0x4a')]['id']}})[_0x2f4d('0x26')](handleEntityNotFound(_0x557ba0,null))['then'](function(_0x56e0db){if(_0x56e0db){_0x4c370d=_0x56e0db;_0x5a3340[_0x2f4d('0x30')]=_[_0x2f4d('0x45')](db['VtigerField'][_0x2f4d('0x2c')]);_0x5a3340['query']=_[_0x2f4d('0x45')](_0x4a14e3[_0x2f4d('0x33')]);_0x5a3340['filters']=_[_0x2f4d('0x34')](_0x5a3340[_0x2f4d('0x30')],_0x5a3340[_0x2f4d('0x33')]);_0x4e4dbe[_0x2f4d('0x36')]=_[_0x2f4d('0x34')](_0x5a3340[_0x2f4d('0x30')],qs['fields'](_0x4a14e3[_0x2f4d('0x33')][_0x2f4d('0x35')]));_0x4e4dbe[_0x2f4d('0x36')]=_0x4e4dbe[_0x2f4d('0x36')][_0x2f4d('0x46')]?_0x4e4dbe[_0x2f4d('0x36')]:_0x5a3340[_0x2f4d('0x30')];_0x4e4dbe['order']=qs[_0x2f4d('0x3a')](_0x4a14e3[_0x2f4d('0x33')]['sort']);_0x4e4dbe['where']=qs['filters'](_[_0x2f4d('0x4e')](_0x4a14e3['query'],_0x5a3340[_0x2f4d('0x3c')]));if(_0x4a14e3[_0x2f4d('0x33')]['filter']){_0x4e4dbe[_0x2f4d('0x3b')]=_[_0x2f4d('0x3e')](_0x4e4dbe[_0x2f4d('0x3b')],{'$or':_[_0x2f4d('0x31')](_0x4e4dbe[_0x2f4d('0x36')],function(_0xd25a8e){var _0x26f3ff={};_0x26f3ff[_0xd25a8e]={'$like':'%'+_0x4a14e3[_0x2f4d('0x33')][_0x2f4d('0x3d')]+'%'};return _0x26f3ff;})});}_0x4e4dbe=_[_0x2f4d('0x3e')]({},_0x4e4dbe,_0x4a14e3[_0x2f4d('0x3f')]);return _0x4c370d[_0x2f4d('0x4f')](_0x4e4dbe);}})[_0x2f4d('0x26')](function(_0x3ce15b){if(_0x3ce15b){_0x490737=_0x3ce15b[_0x2f4d('0x46')];if(!_0x4a14e3[_0x2f4d('0x33')][_0x2f4d('0x37')](_0x2f4d('0x38'))){_0x4e4dbe['limit']=qs[_0x2f4d('0x1d')](_0x4a14e3[_0x2f4d('0x33')][_0x2f4d('0x1d')]);_0x4e4dbe[_0x2f4d('0x1c')]=qs[_0x2f4d('0x1c')](_0x4a14e3[_0x2f4d('0x33')][_0x2f4d('0x1c')]);}return _0x4c370d['getSubjects'](_0x4e4dbe);}})[_0x2f4d('0x26')](function(_0x534f98){if(_0x534f98){return _0x534f98?{'count':_0x490737,'rows':_0x534f98}:null;}})[_0x2f4d('0x26')](respondWithResult(_0x557ba0,null))['catch'](handleError(_0x557ba0,null));};exports[_0x2f4d('0x50')]=function(_0x209b39,_0x45f82c,_0x42bc02){var _0x577ca4={};var _0x1edcab={};var _0x2a4e63;var _0x137c86;return db[_0x2f4d('0x2b')]['findOne']({'where':{'id':_0x209b39[_0x2f4d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x45f82c,null))[_0x2f4d('0x26')](function(_0x555c39){if(_0x555c39){_0x2a4e63=_0x555c39;_0x1edcab['model']=_[_0x2f4d('0x45')](db[_0x2f4d('0x4d')]['rawAttributes']);_0x1edcab['query']=_[_0x2f4d('0x45')](_0x209b39[_0x2f4d('0x33')]);_0x1edcab[_0x2f4d('0x3c')]=_[_0x2f4d('0x34')](_0x1edcab['model'],_0x1edcab['query']);_0x577ca4[_0x2f4d('0x36')]=_[_0x2f4d('0x34')](_0x1edcab['model'],qs[_0x2f4d('0x35')](_0x209b39[_0x2f4d('0x33')][_0x2f4d('0x35')]));_0x577ca4[_0x2f4d('0x36')]=_0x577ca4[_0x2f4d('0x36')][_0x2f4d('0x46')]?_0x577ca4['attributes']:_0x1edcab['model'];_0x577ca4[_0x2f4d('0x39')]=qs['sort'](_0x209b39[_0x2f4d('0x33')][_0x2f4d('0x3a')]);_0x577ca4[_0x2f4d('0x3b')]=qs[_0x2f4d('0x3c')](_[_0x2f4d('0x4e')](_0x209b39[_0x2f4d('0x33')],_0x1edcab[_0x2f4d('0x3c')]));if(_0x209b39['query'][_0x2f4d('0x3d')]){_0x577ca4['where']=_['merge'](_0x577ca4['where'],{'$or':_[_0x2f4d('0x31')](_0x577ca4[_0x2f4d('0x36')],function(_0x2f263f){var _0x555e20={};_0x555e20[_0x2f263f]={'$like':'%'+_0x209b39[_0x2f4d('0x33')][_0x2f4d('0x3d')]+'%'};return _0x555e20;})});}_0x577ca4=_[_0x2f4d('0x3e')]({},_0x577ca4,_0x209b39['options']);return _0x2a4e63[_0x2f4d('0x50')](_0x577ca4);}})[_0x2f4d('0x26')](function(_0x307861){if(_0x307861){_0x137c86=_0x307861[_0x2f4d('0x46')];if(!_0x209b39['query'][_0x2f4d('0x37')](_0x2f4d('0x38'))){_0x577ca4[_0x2f4d('0x1d')]=qs[_0x2f4d('0x1d')](_0x209b39[_0x2f4d('0x33')][_0x2f4d('0x1d')]);_0x577ca4['offset']=qs[_0x2f4d('0x1c')](_0x209b39['query'][_0x2f4d('0x1c')]);}return _0x2a4e63['getDescriptions'](_0x577ca4);}})[_0x2f4d('0x26')](function(_0x5a2bee){if(_0x5a2bee){return _0x5a2bee?{'count':_0x137c86,'rows':_0x5a2bee}:null;}})[_0x2f4d('0x26')](respondWithResult(_0x45f82c,null))[_0x2f4d('0x43')](handleError(_0x45f82c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 447fffc..3a5f452 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 _0x24b8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_vtiger_configurations','lodash','util','../../config/logger'];(function(_0x57f732,_0xa83a63){var _0x5e04ef=function(_0x4c7984){while(--_0x4c7984){_0x57f732['push'](_0x57f732['shift']());}};_0x5e04ef(++_0xa83a63);}(_0x24b8,0x1ad));var _0x824b=function(_0x519c88,_0xb84103){_0x519c88=_0x519c88-0x0;var _0x4668d7=_0x24b8[_0x519c88];return _0x4668d7;};'use strict';var _=require(_0x824b('0x0'));var util=require(_0x824b('0x1'));var logger=require(_0x824b('0x2'))('api');var moment=require(_0x824b('0x3'));var BPromise=require(_0x824b('0x4'));var rp=require(_0x824b('0x5'));var fs=require('fs');var path=require(_0x824b('0x6'));var rimraf=require(_0x824b('0x7'));var config=require(_0x824b('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x824b('0x9')]=function(_0x3fd049,_0x2d34e1){return _0x3fd049[_0x824b('0xa')]('VtigerConfiguration',attributes,{'tableName':_0x824b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d9f=['api','bluebird','path','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger'];(function(_0x1e175d,_0x41ff45){var _0x3a3ce5=function(_0x186001){while(--_0x186001){_0x1e175d['push'](_0x1e175d['shift']());}};_0x3a3ce5(++_0x41ff45);}(_0x1d9f,0x166));var _0xf1d9=function(_0x2877e1,_0x177936){_0x2877e1=_0x2877e1-0x0;var _0x425c9f=_0x1d9f[_0x2877e1];return _0x425c9f;};'use strict';var _=require(_0xf1d9('0x0'));var util=require('util');var logger=require(_0xf1d9('0x1'))(_0xf1d9('0x2'));var moment=require('moment');var BPromise=require(_0xf1d9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1d9('0x4'));var rimraf=require('rimraf');var config=require(_0xf1d9('0x5'));var attributes=require(_0xf1d9('0x6'));module[_0xf1d9('0x7')]=function(_0xd1e83,_0x1fffd3){return _0xd1e83['define'](_0xf1d9('0x8'),attributes,{'tableName':_0xf1d9('0x9'),'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 161e940..2a78c61 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 _0x0d6f=['request\x20sent','debug','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x590f96,_0x39ae06){var _0x10c22a=function(_0x19c3ae){while(--_0x19c3ae){_0x590f96['push'](_0x590f96['shift']());}};_0x10c22a(++_0x39ae06);}(_0x0d6f,0x11c));var _0xf0d6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0d6f[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xf0d6('0x0'));var util=require(_0xf0d6('0x1'));var moment=require(_0xf0d6('0x2'));var BPromise=require(_0xf0d6('0x3'));var rs=require(_0xf0d6('0x4'));var fs=require('fs');var Redis=require(_0xf0d6('0x5'));var db=require(_0xf0d6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0d6('0x7'))(_0xf0d6('0x8'));var config=require(_0xf0d6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0d6('0xa')][_0xf0d6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c0cd6,_0x34c0c6,_0x578d0b){return new BPromise(function(_0x30153f,_0x1a8beb){return client[_0xf0d6('0xc')](_0x1c0cd6,_0x578d0b)[_0xf0d6('0xd')](function(_0x58baf9){logger[_0xf0d6('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x34c0c6,_0xf0d6('0xf'));logger[_0xf0d6('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x34c0c6,_0xf0d6('0xf'),JSON[_0xf0d6('0x11')](_0x58baf9));if(_0x58baf9[_0xf0d6('0x12')]){if(_0x58baf9['error']['code']===0x1f4){logger[_0xf0d6('0x12')](_0xf0d6('0x13'),_0x34c0c6,_0x58baf9['error'][_0xf0d6('0x14')]);return _0x1a8beb(_0x58baf9[_0xf0d6('0x12')][_0xf0d6('0x14')]);}logger[_0xf0d6('0x12')](_0xf0d6('0x13'),_0x34c0c6,_0x58baf9[_0xf0d6('0x12')][_0xf0d6('0x14')]);return _0x30153f(_0x58baf9[_0xf0d6('0x12')][_0xf0d6('0x14')]);}else{logger['info'](_0xf0d6('0x13'),_0x34c0c6,'request\x20sent');_0x30153f(_0x58baf9[_0xf0d6('0x15')][_0xf0d6('0x14')]);}})[_0xf0d6('0x16')](function(_0x1d4f9a){logger[_0xf0d6('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x34c0c6,_0x1d4f9a);_0x1a8beb(_0x1d4f9a);});});} \ No newline at end of file +var _0x8771=['ioredis','../../mysqldb','../../config/utils','../../config/logger','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x8771,0x140));var _0x1877=function(_0xc01d2,_0x29f146){_0xc01d2=_0xc01d2-0x0;var _0x17f297=_0x8771[_0xc01d2];return _0x17f297;};'use strict';var _=require('lodash');var util=require(_0x1877('0x0'));var moment=require('moment');var BPromise=require(_0x1877('0x1'));var rs=require(_0x1877('0x2'));var fs=require('fs');var Redis=require(_0x1877('0x3'));var db=require(_0x1877('0x4'))['db'];var utils=require(_0x1877('0x5'));var logger=require(_0x1877('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x568d97,_0x3d0657,_0x1d633e){return new BPromise(function(_0x3ea4cd,_0x233b3f){return client[_0x1877('0x7')](_0x568d97,_0x1d633e)[_0x1877('0x8')](function(_0xa60e86){logger[_0x1877('0x9')]('VtigerConfiguration,\x20%s,\x20%s',_0x3d0657,_0x1877('0xa'));logger[_0x1877('0xb')](_0x1877('0xc'),_0x3d0657,_0x1877('0xa'),JSON[_0x1877('0xd')](_0xa60e86));if(_0xa60e86[_0x1877('0xe')]){if(_0xa60e86[_0x1877('0xe')]['code']===0x1f4){logger[_0x1877('0xe')](_0x1877('0xf'),_0x3d0657,_0xa60e86[_0x1877('0xe')][_0x1877('0x10')]);return _0x233b3f(_0xa60e86[_0x1877('0xe')][_0x1877('0x10')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x3d0657,_0xa60e86[_0x1877('0xe')][_0x1877('0x10')]);return _0x3ea4cd(_0xa60e86[_0x1877('0xe')][_0x1877('0x10')]);}else{logger['info'](_0x1877('0xf'),_0x3d0657,_0x1877('0xa'));_0x3ea4cd(_0xa60e86[_0x1877('0x11')][_0x1877('0x10')]);}})[_0x1877('0x12')](function(_0x5328ca){logger[_0x1877('0xe')](_0x1877('0xf'),_0x3d0657,_0x5328ca);_0x233b3f(_0x5328ca);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 3df1ec7..53c59c6 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 _0x9a1d=['update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','/:id','isAuthenticated','show','create','put'];(function(_0x3095bb,_0x2e22e4){var _0x52478f=function(_0x43e484){while(--_0x43e484){_0x3095bb['push'](_0x3095bb['shift']());}};_0x52478f(++_0x2e22e4);}(_0x9a1d,0x19c));var _0xd9a1=function(_0xf95414,_0x5de21a){_0xf95414=_0xf95414-0x0;var _0x36d53f=_0x9a1d[_0xf95414];return _0x36d53f;};'use strict';var multer=require('multer');var util=require(_0xd9a1('0x0'));var path=require(_0xd9a1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd9a1('0x2'));var auth=require(_0xd9a1('0x3'));var interaction=require(_0xd9a1('0x4'));var config=require(_0xd9a1('0x5'));var controller=require(_0xd9a1('0x6'));router[_0xd9a1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd9a1('0x7')](_0xd9a1('0x8'),auth[_0xd9a1('0x9')](),controller[_0xd9a1('0xa')]);router['post']('/',auth[_0xd9a1('0x9')](),controller[_0xd9a1('0xb')]);router[_0xd9a1('0xc')]('/:id',auth[_0xd9a1('0x9')](),controller[_0xd9a1('0xd')]);router[_0xd9a1('0xe')](_0xd9a1('0x8'),auth[_0xd9a1('0x9')](),controller[_0xd9a1('0xf')]);module[_0xd9a1('0x10')]=router; \ No newline at end of file +var _0x5773=['get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller'];(function(_0x370284,_0x3348d5){var _0x1445c8=function(_0x573a25){while(--_0x573a25){_0x370284['push'](_0x370284['shift']());}};_0x1445c8(++_0x3348d5);}(_0x5773,0x161));var _0x3577=function(_0x5dd3a3,_0x24b2b3){_0x5dd3a3=_0x5dd3a3-0x0;var _0x51a4ba=_0x5773[_0x5dd3a3];return _0x51a4ba;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3577('0x0'));var timeout=require(_0x3577('0x1'));var express=require('express');var router=express[_0x3577('0x2')]();var fs_extra=require(_0x3577('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3577('0x4'));var config=require(_0x3577('0x5'));var controller=require(_0x3577('0x6'));router[_0x3577('0x7')]('/',auth[_0x3577('0x8')](),controller[_0x3577('0x9')]);router[_0x3577('0x7')]('/:id',auth[_0x3577('0x8')](),controller[_0x3577('0xa')]);router[_0x3577('0xb')]('/',auth[_0x3577('0x8')](),controller[_0x3577('0xc')]);router['put'](_0x3577('0xd'),auth[_0x3577('0x8')](),controller[_0x3577('0xe')]);router[_0x3577('0xf')]('/:id',auth[_0x3577('0x8')](),controller[_0x3577('0x10')]);module[_0x3577('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index dee9965..e7a7393 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 _0x6d31=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x6d31,0x81));var _0x16d3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6d31[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x16d3('0x0'));module[_0x16d3('0x1')]={'type':{'type':Sequelize[_0x16d3('0x2')](_0x16d3('0x3'),_0x16d3('0x4'),'customVariable',_0x16d3('0x5'),_0x16d3('0x6')),'defaultValue':_0x16d3('0x3')},'content':{'type':Sequelize[_0x16d3('0x7')]},'key':{'type':Sequelize[_0x16d3('0x7')]},'keyType':{'type':Sequelize[_0x16d3('0x2')]('string',_0x16d3('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x16d3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3fa5=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x4ce4a4,_0x32d6df){var _0x296fb0=function(_0x1a9619){while(--_0x1a9619){_0x4ce4a4['push'](_0x4ce4a4['shift']());}};_0x296fb0(++_0x32d6df);}(_0x3fa5,0x1d4));var _0x53fa=function(_0x1bba84,_0xdfd402){_0x1bba84=_0x1bba84-0x0;var _0x398a54=_0x3fa5[_0x1bba84];return _0x398a54;};'use strict';var Sequelize=require(_0x53fa('0x0'));module[_0x53fa('0x1')]={'type':{'type':Sequelize[_0x53fa('0x2')](_0x53fa('0x3'),_0x53fa('0x4'),_0x53fa('0x5'),_0x53fa('0x6'),_0x53fa('0x7')),'defaultValue':_0x53fa('0x3')},'content':{'type':Sequelize[_0x53fa('0x8')]},'key':{'type':Sequelize[_0x53fa('0x8')]},'keyType':{'type':Sequelize[_0x53fa('0x2')]('string',_0x53fa('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x53fa('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index f50cb18..5e8fa18 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 _0xe13d=['sendStatus','status','end','json','offset','count','set','Content-Range','apply','reject','save','then','error','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','limit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','params','find','catch','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb'];(function(_0x259f6f,_0x43b2a1){var _0x131516=function(_0x5b3959){while(--_0x5b3959){_0x259f6f['push'](_0x259f6f['shift']());}};_0x131516(++_0x43b2a1);}(_0xe13d,0x139));var _0xde13=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xe13d[_0x134c2e];return _0x2825db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde13('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde13('0x1'));var rp=require(_0xde13('0x2'));var moment=require(_0xde13('0x3'));var BPromise=require(_0xde13('0x4'));var Mustache=require(_0xde13('0x5'));var util=require('util');var path=require(_0xde13('0x6'));var sox=require(_0xde13('0x7'));var csv=require('to-csv');var ejs=require(_0xde13('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde13('0x9'));var squel=require(_0xde13('0xa'));var crypto=require(_0xde13('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xde13('0xc'));var querystring=require(_0xde13('0xd'));var Papa=require(_0xde13('0xe'));var Redis=require(_0xde13('0xf'));var authService=require(_0xde13('0x10'));var qs=require(_0xde13('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde13('0x12'));var logger=require(_0xde13('0x13'))('api');var utils=require(_0xde13('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xde13('0x15'))['db'];function respondWithStatusCode(_0x422293,_0x2b15d2){_0x2b15d2=_0x2b15d2||0xcc;return function(_0x46a073){if(_0x46a073){return _0x422293[_0xde13('0x16')](_0x2b15d2);}return _0x422293[_0xde13('0x17')](_0x2b15d2)[_0xde13('0x18')]();};}function respondWithResult(_0x5bc840,_0x462654){_0x462654=_0x462654||0xc8;return function(_0x1f5dbe){if(_0x1f5dbe){return _0x5bc840[_0xde13('0x17')](_0x462654)[_0xde13('0x19')](_0x1f5dbe);}};}function respondWithFilteredResult(_0x3806a2,_0x1ebe23){return function(_0xda1144){if(_0xda1144){var _0x5941be=typeof _0x1ebe23[_0xde13('0x1a')]==='undefined'&&typeof _0x1ebe23['limit']==='undefined';var _0x17f316=_0xda1144[_0xde13('0x1b')];var _0xf8be1f=_0x5941be?0x0:_0x1ebe23[_0xde13('0x1a')];var _0x489b93=_0x5941be?_0xda1144[_0xde13('0x1b')]:_0x1ebe23[_0xde13('0x1a')]+_0x1ebe23['limit'];var _0x3d44dd;if(_0x489b93>=_0x17f316){_0x489b93=_0x17f316;_0x3d44dd=0xc8;}else{_0x3d44dd=0xce;}_0x3806a2[_0xde13('0x17')](_0x3d44dd);return _0x3806a2[_0xde13('0x1c')](_0xde13('0x1d'),_0xf8be1f+'-'+_0x489b93+'/'+_0x17f316)[_0xde13('0x19')](_0xda1144);}return null;};}function patchUpdates(_0x4fff82){return function(_0x1e1eca){try{jsonpatch[_0xde13('0x1e')](_0x1e1eca,_0x4fff82,!![]);}catch(_0x22b5b5){return BPromise[_0xde13('0x1f')](_0x22b5b5);}return _0x1e1eca[_0xde13('0x20')]();};}function saveUpdates(_0x566460,_0x4afd20){return function(_0x42197c){if(_0x42197c){return _0x42197c['update'](_0x566460)[_0xde13('0x21')](function(_0x5c60c8){return _0x5c60c8;});}return null;};}function removeEntity(_0x508e32,_0x5e1d50){return function(_0x1ea393){if(_0x1ea393){return _0x1ea393['destroy']()[_0xde13('0x21')](function(){_0x508e32['status'](0xcc)[_0xde13('0x18')]();});}};}function handleEntityNotFound(_0x4cef47,_0x205286){return function(_0x33ade0){if(!_0x33ade0){_0x4cef47[_0xde13('0x16')](0x194);}return _0x33ade0;};}function handleError(_0x5d101b,_0x42a79f){_0x42a79f=_0x42a79f||0x1f4;return function(_0x432929){logger[_0xde13('0x22')](_0x432929['stack']);if(_0x432929[_0xde13('0x23')]){delete _0x432929['name'];}_0x5d101b[_0xde13('0x17')](_0x42a79f)[_0xde13('0x24')](_0x432929);};}exports[_0xde13('0x25')]=function(_0x56b831,_0x1e2b91){var _0xa7211e={},_0x45b09c={},_0x15953d={'count':0x0,'rows':[]};var _0x583943=_[_0xde13('0x26')](db[_0xde13('0x27')][_0xde13('0x28')],function(_0x190934){return{'name':_0x190934[_0xde13('0x29')],'type':_0x190934['type'][_0xde13('0x2a')]};});_0x45b09c[_0xde13('0x2b')]=_[_0xde13('0x26')](_0x583943,_0xde13('0x23'));_0x45b09c['query']=_[_0xde13('0x2c')](_0x56b831[_0xde13('0x2d')]);_0x45b09c[_0xde13('0x2e')]=_[_0xde13('0x2f')](_0x45b09c['model'],_0x45b09c[_0xde13('0x2d')]);_0xa7211e['attributes']=_['intersection'](_0x45b09c[_0xde13('0x2b')],qs[_0xde13('0x30')](_0x56b831[_0xde13('0x2d')]['fields']));_0xa7211e[_0xde13('0x31')]=_0xa7211e[_0xde13('0x31')][_0xde13('0x32')]?_0xa7211e[_0xde13('0x31')]:_0x45b09c['model'];if(!_0x56b831[_0xde13('0x2d')]['hasOwnProperty']('nolimit')){_0xa7211e[_0xde13('0x33')]=qs[_0xde13('0x33')](_0x56b831[_0xde13('0x2d')][_0xde13('0x33')]);_0xa7211e['offset']=qs[_0xde13('0x1a')](_0x56b831[_0xde13('0x2d')]['offset']);}_0xa7211e['order']=qs['sort'](_0x56b831['query'][_0xde13('0x34')]);_0xa7211e['where']=qs['filters'](_[_0xde13('0x35')](_0x56b831[_0xde13('0x2d')],_0x45b09c['filters']),_0x583943);if(_0x56b831[_0xde13('0x2d')][_0xde13('0x36')]){_0xa7211e[_0xde13('0x37')]=_[_0xde13('0x38')](_0xa7211e['where'],{'$or':_[_0xde13('0x26')](_0x583943,function(_0x380c9a){if(_0x380c9a[_0xde13('0x39')]!==_0xde13('0x3a')){var _0x7011ff={};_0x7011ff[_0x380c9a[_0xde13('0x23')]]={'$like':'%'+_0x56b831['query'][_0xde13('0x36')]+'%'};return _0x7011ff;}})});}_0xa7211e=_[_0xde13('0x38')]({},_0xa7211e,_0x56b831[_0xde13('0x3b')]);var _0x2b2810={'where':_0xa7211e[_0xde13('0x37')]};return db[_0xde13('0x27')]['count'](_0x2b2810)[_0xde13('0x21')](function(_0x3e544e){_0x15953d[_0xde13('0x1b')]=_0x3e544e;if(_0x56b831[_0xde13('0x2d')][_0xde13('0x3c')]){_0xa7211e['include']=[{'all':!![]}];}return db[_0xde13('0x27')][_0xde13('0x3d')](_0xa7211e);})[_0xde13('0x21')](function(_0x1affd4){_0x15953d['rows']=_0x1affd4;return _0x15953d;})[_0xde13('0x21')](respondWithFilteredResult(_0x1e2b91,_0xa7211e))['catch'](handleError(_0x1e2b91,null));};exports['show']=function(_0x469012,_0x5c714e){var _0x587dfc={'raw':!![],'where':{'id':_0x469012[_0xde13('0x3e')]['id']}},_0x49a6b4={};_0x49a6b4[_0xde13('0x2b')]=_[_0xde13('0x2c')](db[_0xde13('0x27')][_0xde13('0x28')]);_0x49a6b4[_0xde13('0x2d')]=_[_0xde13('0x2c')](_0x469012['query']);_0x49a6b4[_0xde13('0x2e')]=_[_0xde13('0x2f')](_0x49a6b4[_0xde13('0x2b')],_0x49a6b4['query']);_0x587dfc[_0xde13('0x31')]=_['intersection'](_0x49a6b4[_0xde13('0x2b')],qs[_0xde13('0x30')](_0x469012[_0xde13('0x2d')][_0xde13('0x30')]));_0x587dfc[_0xde13('0x31')]=_0x587dfc[_0xde13('0x31')][_0xde13('0x32')]?_0x587dfc[_0xde13('0x31')]:_0x49a6b4[_0xde13('0x2b')];if(_0x469012['query']['includeAll']){_0x587dfc['include']=[{'all':!![]}];}_0x587dfc=_[_0xde13('0x38')]({},_0x587dfc,_0x469012[_0xde13('0x3b')]);return db['VtigerField'][_0xde13('0x3f')](_0x587dfc)[_0xde13('0x21')](handleEntityNotFound(_0x5c714e,null))[_0xde13('0x21')](respondWithResult(_0x5c714e,null))[_0xde13('0x40')](handleError(_0x5c714e,null));};exports[_0xde13('0x41')]=function(_0x526cc8,_0x25c4e1){return db[_0xde13('0x27')]['create'](_0x526cc8['body'],{})[_0xde13('0x21')](respondWithResult(_0x25c4e1,0xc9))[_0xde13('0x40')](handleError(_0x25c4e1,null));};exports['update']=function(_0x119553,_0x2f0715){if(_0x119553['body']['id']){delete _0x119553[_0xde13('0x42')]['id'];}return db[_0xde13('0x27')][_0xde13('0x3f')]({'where':{'id':_0x119553[_0xde13('0x3e')]['id']}})[_0xde13('0x21')](handleEntityNotFound(_0x2f0715,null))[_0xde13('0x21')](saveUpdates(_0x119553[_0xde13('0x42')],null))[_0xde13('0x21')](respondWithResult(_0x2f0715,null))[_0xde13('0x40')](handleError(_0x2f0715,null));};exports['destroy']=function(_0x5aee4b,_0x546afa){return db['VtigerField'][_0xde13('0x3f')]({'where':{'id':_0x5aee4b[_0xde13('0x3e')]['id']}})[_0xde13('0x21')](handleEntityNotFound(_0x546afa,null))[_0xde13('0x21')](removeEntity(_0x546afa,null))[_0xde13('0x40')](handleError(_0x546afa,null));}; \ No newline at end of file +var _0x9086=['update','then','destroy','error','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','options','includeAll','include','findAll','catch','show','params','keys','merge','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x9086,0x6e));var _0x6908=function(_0xa6dfcb,_0x4d3529){_0xa6dfcb=_0xa6dfcb-0x0;var _0x5e7adc=_0x9086[_0xa6dfcb];return _0x5e7adc;};'use strict';var emlformat=require(_0x6908('0x0'));var rimraf=require(_0x6908('0x1'));var zipdir=require(_0x6908('0x2'));var jsonpatch=require(_0x6908('0x3'));var rp=require(_0x6908('0x4'));var moment=require('moment');var BPromise=require(_0x6908('0x5'));var Mustache=require(_0x6908('0x6'));var util=require(_0x6908('0x7'));var path=require(_0x6908('0x8'));var sox=require('sox');var csv=require(_0x6908('0x9'));var ejs=require(_0x6908('0xa'));var fs=require('fs');var fs_extra=require(_0x6908('0xb'));var _=require(_0x6908('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6908('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6908('0xe'));var Papa=require(_0x6908('0xf'));var Redis=require(_0x6908('0x10'));var authService=require(_0x6908('0x11'));var qs=require(_0x6908('0x12'));var as=require(_0x6908('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6908('0x14'))(_0x6908('0x15'));var utils=require('../../config/utils');var config=require(_0x6908('0x16'));var licenseUtil=require(_0x6908('0x17'));var db=require(_0x6908('0x18'))['db'];function respondWithStatusCode(_0x592804,_0xd84a40){_0xd84a40=_0xd84a40||0xcc;return function(_0x1a8945){if(_0x1a8945){return _0x592804[_0x6908('0x19')](_0xd84a40);}return _0x592804[_0x6908('0x1a')](_0xd84a40)[_0x6908('0x1b')]();};}function respondWithResult(_0x2e463c,_0x547c71){_0x547c71=_0x547c71||0xc8;return function(_0x24db93){if(_0x24db93){return _0x2e463c[_0x6908('0x1a')](_0x547c71)['json'](_0x24db93);}};}function respondWithFilteredResult(_0x16b2fc,_0x2c9206){return function(_0x1d800e){if(_0x1d800e){var _0xa6cf1=typeof _0x2c9206[_0x6908('0x1c')]===_0x6908('0x1d')&&typeof _0x2c9206[_0x6908('0x1e')]===_0x6908('0x1d');var _0x18ac59=_0x1d800e[_0x6908('0x1f')];var _0x54569f=_0xa6cf1?0x0:_0x2c9206[_0x6908('0x1c')];var _0x2314d5=_0xa6cf1?_0x1d800e[_0x6908('0x1f')]:_0x2c9206[_0x6908('0x1c')]+_0x2c9206[_0x6908('0x1e')];var _0x52aff0;if(_0x2314d5>=_0x18ac59){_0x2314d5=_0x18ac59;_0x52aff0=0xc8;}else{_0x52aff0=0xce;}_0x16b2fc[_0x6908('0x1a')](_0x52aff0);return _0x16b2fc[_0x6908('0x20')](_0x6908('0x21'),_0x54569f+'-'+_0x2314d5+'/'+_0x18ac59)[_0x6908('0x22')](_0x1d800e);}return null;};}function patchUpdates(_0xcca52d){return function(_0x571a28){try{jsonpatch[_0x6908('0x23')](_0x571a28,_0xcca52d,!![]);}catch(_0x5ebc98){return BPromise[_0x6908('0x24')](_0x5ebc98);}return _0x571a28[_0x6908('0x25')]();};}function saveUpdates(_0x3c65a1,_0x2bcf81){return function(_0x14321f){if(_0x14321f){return _0x14321f[_0x6908('0x26')](_0x3c65a1)[_0x6908('0x27')](function(_0x2130d2){return _0x2130d2;});}return null;};}function removeEntity(_0x4990d5,_0x559453){return function(_0x4aeea9){if(_0x4aeea9){return _0x4aeea9[_0x6908('0x28')]()[_0x6908('0x27')](function(){_0x4990d5[_0x6908('0x1a')](0xcc)[_0x6908('0x1b')]();});}};}function handleEntityNotFound(_0x282f55,_0x1e7a72){return function(_0x3e2fc1){if(!_0x3e2fc1){_0x282f55[_0x6908('0x19')](0x194);}return _0x3e2fc1;};}function handleError(_0xaadda9,_0x1e3d6f){_0x1e3d6f=_0x1e3d6f||0x1f4;return function(_0x6fe586){logger[_0x6908('0x29')](_0x6fe586['stack']);if(_0x6fe586[_0x6908('0x2a')]){delete _0x6fe586[_0x6908('0x2a')];}_0xaadda9[_0x6908('0x1a')](_0x1e3d6f)[_0x6908('0x2b')](_0x6fe586);};}exports[_0x6908('0x2c')]=function(_0x311fef,_0x320c64){var _0x4f26b6={},_0x2acb35={},_0x56ab40={'count':0x0,'rows':[]};var _0x5282bc=_[_0x6908('0x2d')](db[_0x6908('0x2e')][_0x6908('0x2f')],function(_0x4b474e){return{'name':_0x4b474e[_0x6908('0x30')],'type':_0x4b474e[_0x6908('0x31')][_0x6908('0x32')]};});_0x2acb35[_0x6908('0x33')]=_[_0x6908('0x2d')](_0x5282bc,_0x6908('0x2a'));_0x2acb35['query']=_['keys'](_0x311fef[_0x6908('0x34')]);_0x2acb35[_0x6908('0x35')]=_[_0x6908('0x36')](_0x2acb35[_0x6908('0x33')],_0x2acb35['query']);_0x4f26b6['attributes']=_[_0x6908('0x36')](_0x2acb35[_0x6908('0x33')],qs[_0x6908('0x37')](_0x311fef['query'][_0x6908('0x37')]));_0x4f26b6[_0x6908('0x38')]=_0x4f26b6[_0x6908('0x38')][_0x6908('0x39')]?_0x4f26b6[_0x6908('0x38')]:_0x2acb35[_0x6908('0x33')];if(!_0x311fef[_0x6908('0x34')]['hasOwnProperty'](_0x6908('0x3a'))){_0x4f26b6[_0x6908('0x1e')]=qs[_0x6908('0x1e')](_0x311fef[_0x6908('0x34')][_0x6908('0x1e')]);_0x4f26b6[_0x6908('0x1c')]=qs[_0x6908('0x1c')](_0x311fef['query'][_0x6908('0x1c')]);}_0x4f26b6['order']=qs['sort'](_0x311fef[_0x6908('0x34')][_0x6908('0x3b')]);_0x4f26b6[_0x6908('0x3c')]=qs[_0x6908('0x35')](_[_0x6908('0x3d')](_0x311fef[_0x6908('0x34')],_0x2acb35[_0x6908('0x35')]),_0x5282bc);if(_0x311fef[_0x6908('0x34')][_0x6908('0x3e')]){_0x4f26b6[_0x6908('0x3c')]=_['merge'](_0x4f26b6['where'],{'$or':_['map'](_0x5282bc,function(_0x206187){if(_0x206187[_0x6908('0x31')]!=='VIRTUAL'){var _0x254273={};_0x254273[_0x206187[_0x6908('0x2a')]]={'$like':'%'+_0x311fef[_0x6908('0x34')][_0x6908('0x3e')]+'%'};return _0x254273;}})});}_0x4f26b6=_['merge']({},_0x4f26b6,_0x311fef[_0x6908('0x3f')]);var _0x165d68={'where':_0x4f26b6[_0x6908('0x3c')]};return db[_0x6908('0x2e')][_0x6908('0x1f')](_0x165d68)[_0x6908('0x27')](function(_0x1bba42){_0x56ab40['count']=_0x1bba42;if(_0x311fef[_0x6908('0x34')][_0x6908('0x40')]){_0x4f26b6[_0x6908('0x41')]=[{'all':!![]}];}return db['VtigerField'][_0x6908('0x42')](_0x4f26b6);})[_0x6908('0x27')](function(_0x3cc18a){_0x56ab40['rows']=_0x3cc18a;return _0x56ab40;})[_0x6908('0x27')](respondWithFilteredResult(_0x320c64,_0x4f26b6))[_0x6908('0x43')](handleError(_0x320c64,null));};exports[_0x6908('0x44')]=function(_0xa01cfc,_0x4fbb9a){var _0x20b2d2={'raw':!![],'where':{'id':_0xa01cfc[_0x6908('0x45')]['id']}},_0xababbb={};_0xababbb[_0x6908('0x33')]=_[_0x6908('0x46')](db[_0x6908('0x2e')]['rawAttributes']);_0xababbb['query']=_[_0x6908('0x46')](_0xa01cfc[_0x6908('0x34')]);_0xababbb[_0x6908('0x35')]=_[_0x6908('0x36')](_0xababbb[_0x6908('0x33')],_0xababbb[_0x6908('0x34')]);_0x20b2d2[_0x6908('0x38')]=_[_0x6908('0x36')](_0xababbb['model'],qs[_0x6908('0x37')](_0xa01cfc[_0x6908('0x34')][_0x6908('0x37')]));_0x20b2d2[_0x6908('0x38')]=_0x20b2d2[_0x6908('0x38')][_0x6908('0x39')]?_0x20b2d2[_0x6908('0x38')]:_0xababbb[_0x6908('0x33')];if(_0xa01cfc[_0x6908('0x34')]['includeAll']){_0x20b2d2[_0x6908('0x41')]=[{'all':!![]}];}_0x20b2d2=_[_0x6908('0x47')]({},_0x20b2d2,_0xa01cfc['options']);return db[_0x6908('0x2e')]['find'](_0x20b2d2)[_0x6908('0x27')](handleEntityNotFound(_0x4fbb9a,null))['then'](respondWithResult(_0x4fbb9a,null))[_0x6908('0x43')](handleError(_0x4fbb9a,null));};exports[_0x6908('0x48')]=function(_0xef9ee,_0x3b1465){return db[_0x6908('0x2e')]['create'](_0xef9ee[_0x6908('0x49')],{})[_0x6908('0x27')](respondWithResult(_0x3b1465,0xc9))[_0x6908('0x43')](handleError(_0x3b1465,null));};exports[_0x6908('0x26')]=function(_0x157494,_0x53a03d){if(_0x157494[_0x6908('0x49')]['id']){delete _0x157494['body']['id'];}return db[_0x6908('0x2e')]['find']({'where':{'id':_0x157494[_0x6908('0x45')]['id']}})[_0x6908('0x27')](handleEntityNotFound(_0x53a03d,null))[_0x6908('0x27')](saveUpdates(_0x157494[_0x6908('0x49')],null))[_0x6908('0x27')](respondWithResult(_0x53a03d,null))['catch'](handleError(_0x53a03d,null));};exports[_0x6908('0x28')]=function(_0x489f7c,_0x3eccae){return db[_0x6908('0x2e')]['find']({'where':{'id':_0x489f7c[_0x6908('0x45')]['id']}})[_0x6908('0x27')](handleEntityNotFound(_0x3eccae,null))[_0x6908('0x27')](removeEntity(_0x3eccae,null))[_0x6908('0x43')](handleError(_0x3eccae,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 1714a08..ebc1b5f 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 _0x7b2e=['rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x2a6c47,_0x3c2e58){var _0x10fe76=function(_0x14a56e){while(--_0x14a56e){_0x2a6c47['push'](_0x2a6c47['shift']());}};_0x10fe76(++_0x3c2e58);}(_0x7b2e,0x82));var _0xe7b2=function(_0x4c0ed5,_0x24f47a){_0x4c0ed5=_0x4c0ed5-0x0;var _0x20b37a=_0x7b2e[_0x4c0ed5];return _0x20b37a;};'use strict';var _=require(_0xe7b2('0x0'));var util=require(_0xe7b2('0x1'));var logger=require(_0xe7b2('0x2'))(_0xe7b2('0x3'));var moment=require(_0xe7b2('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe7b2('0x5'));var config=require(_0xe7b2('0x6'));var attributes=require(_0xe7b2('0x7'));module[_0xe7b2('0x8')]=function(_0x58eaae,_0x5954ee){return _0x58eaae[_0xe7b2('0x9')](_0xe7b2('0xa'),attributes,{'tableName':_0xe7b2('0xb'),'paranoid':![],'indexes':[{'name':_0xe7b2('0xc'),'fields':[_0xe7b2('0xd'),_0xe7b2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa4fa=['moment','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','lodash','util','../../config/logger','api'];(function(_0x19dcfc,_0x3831f2){var _0x47deec=function(_0x2d2271){while(--_0x2d2271){_0x19dcfc['push'](_0x19dcfc['shift']());}};_0x47deec(++_0x3831f2);}(_0xa4fa,0x134));var _0xaa4f=function(_0x27a582,_0x5d031d){_0x27a582=_0x27a582-0x0;var _0x48833e=_0xa4fa[_0x27a582];return _0x48833e;};'use strict';var _=require(_0xaa4f('0x0'));var util=require(_0xaa4f('0x1'));var logger=require(_0xaa4f('0x2'))(_0xaa4f('0x3'));var moment=require(_0xaa4f('0x4'));var BPromise=require('bluebird');var rp=require(_0xaa4f('0x5'));var fs=require('fs');var path=require(_0xaa4f('0x6'));var rimraf=require(_0xaa4f('0x7'));var config=require(_0xaa4f('0x8'));var attributes=require(_0xaa4f('0x9'));module[_0xaa4f('0xa')]=function(_0x3d21ad,_0x29b471){return _0x3d21ad[_0xaa4f('0xb')](_0xaa4f('0xc'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField','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 5d8453f..8a454cb 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 _0x2971=['moment','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x1a56a5,_0x470d46){var _0x27a7c1=function(_0x25c805){while(--_0x25c805){_0x1a56a5['push'](_0x1a56a5['shift']());}};_0x27a7c1(++_0x470d46);}(_0x2971,0x84));var _0x1297=function(_0x574798,_0x151501){_0x574798=_0x574798-0x0;var _0x31b0f4=_0x2971[_0x574798];return _0x31b0f4;};'use strict';var _=require(_0x1297('0x0'));var util=require('util');var moment=require(_0x1297('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1297('0x2'));var logger=require('../../config/logger')(_0x1297('0x3'));var config=require(_0x1297('0x4'));var jayson=require(_0x1297('0x5'));var client=jayson['client'][_0x1297('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x27f93f,_0x4a0c07,_0x115922){return new BPromise(function(_0x2ed95c,_0x11b32f){return client['request'](_0x27f93f,_0x115922)[_0x1297('0x7')](function(_0x43d157){logger[_0x1297('0x8')]('VtigerField,\x20%s,\x20%s',_0x4a0c07,'request\x20sent');logger[_0x1297('0x9')](_0x1297('0xa'),_0x4a0c07,_0x1297('0xb'),JSON[_0x1297('0xc')](_0x43d157));if(_0x43d157[_0x1297('0xd')]){if(_0x43d157[_0x1297('0xd')][_0x1297('0xe')]===0x1f4){logger[_0x1297('0xd')](_0x1297('0xf'),_0x4a0c07,_0x43d157[_0x1297('0xd')][_0x1297('0x10')]);return _0x11b32f(_0x43d157[_0x1297('0xd')][_0x1297('0x10')]);}logger[_0x1297('0xd')](_0x1297('0xf'),_0x4a0c07,_0x43d157[_0x1297('0xd')]['message']);return _0x2ed95c(_0x43d157[_0x1297('0xd')]['message']);}else{logger[_0x1297('0x8')](_0x1297('0xf'),_0x4a0c07,_0x1297('0xb'));_0x2ed95c(_0x43d157[_0x1297('0x11')][_0x1297('0x10')]);}})[_0x1297('0x12')](function(_0x378f21){logger[_0x1297('0xd')](_0x1297('0xf'),_0x4a0c07,_0x378f21);_0x11b32f(_0x378f21);});});} \ No newline at end of file +var _0xcd1a=['jayson/promise','client','http','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x30f0b6,_0x1a983f){var _0x32879b=function(_0x37c8e7){while(--_0x37c8e7){_0x30f0b6['push'](_0x30f0b6['shift']());}};_0x32879b(++_0x1a983f);}(_0xcd1a,0x115));var _0xacd1=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xcd1a[_0x35885a];return _0xe86249;};'use strict';var _=require(_0xacd1('0x0'));var util=require(_0xacd1('0x1'));var moment=require(_0xacd1('0x2'));var BPromise=require('bluebird');var rs=require(_0xacd1('0x3'));var fs=require('fs');var Redis=require(_0xacd1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xacd1('0x5'));var logger=require('../../config/logger')(_0xacd1('0x6'));var config=require(_0xacd1('0x7'));var jayson=require(_0xacd1('0x8'));var client=jayson[_0xacd1('0x9')][_0xacd1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57d81d,_0x428f4c,_0x39e829){return new BPromise(function(_0x2ba0e7,_0x50a814){return client['request'](_0x57d81d,_0x39e829)['then'](function(_0x512167){logger['info'](_0xacd1('0xb'),_0x428f4c,_0xacd1('0xc'));logger[_0xacd1('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x428f4c,_0xacd1('0xc'),JSON[_0xacd1('0xe')](_0x512167));if(_0x512167[_0xacd1('0xf')]){if(_0x512167[_0xacd1('0xf')][_0xacd1('0x10')]===0x1f4){logger[_0xacd1('0xf')](_0xacd1('0xb'),_0x428f4c,_0x512167[_0xacd1('0xf')][_0xacd1('0x11')]);return _0x50a814(_0x512167[_0xacd1('0xf')][_0xacd1('0x11')]);}logger['error'](_0xacd1('0xb'),_0x428f4c,_0x512167[_0xacd1('0xf')][_0xacd1('0x11')]);return _0x2ba0e7(_0x512167[_0xacd1('0xf')]['message']);}else{logger['info'](_0xacd1('0xb'),_0x428f4c,_0xacd1('0xc'));_0x2ba0e7(_0x512167[_0xacd1('0x12')]['message']);}})['catch'](function(_0x4c9664){logger['error']('VtigerField,\x20%s,\x20%s',_0x428f4c,_0x4c9664);_0x50a814(_0x4c9664);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index f9d4edf..97724f5 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 _0x2cd8=['/:id/fields','getFields','post','create','put','delete','exports','multer','express','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x481e73,_0x20db76){var _0x5c7c55=function(_0x595621){while(--_0x595621){_0x481e73['push'](_0x481e73['shift']());}};_0x5c7c55(++_0x20db76);}(_0x2cd8,0x16f));var _0x82cd=function(_0x44038f,_0x19a7ed){_0x44038f=_0x44038f-0x0;var _0xb65443=_0x2cd8[_0x44038f];return _0xb65443;};'use strict';var multer=require(_0x82cd('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x82cd('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x82cd('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x82cd('0x3'));var controller=require(_0x82cd('0x4'));router[_0x82cd('0x5')]('/',auth[_0x82cd('0x6')](),controller[_0x82cd('0x7')]);router[_0x82cd('0x5')](_0x82cd('0x8'),auth[_0x82cd('0x6')](),controller[_0x82cd('0x9')]);router[_0x82cd('0x5')](_0x82cd('0xa'),auth[_0x82cd('0x6')](),controller['getConfigurations']);router[_0x82cd('0x5')](_0x82cd('0xb'),auth['isAuthenticated'](),controller[_0x82cd('0xc')]);router[_0x82cd('0xd')]('/',auth['isAuthenticated'](),controller[_0x82cd('0xe')]);router[_0x82cd('0xd')]('/:id/configurations',auth[_0x82cd('0x6')](),controller['addConfiguration']);router[_0x82cd('0xf')](_0x82cd('0x8'),auth[_0x82cd('0x6')](),controller['update']);router[_0x82cd('0x10')](_0x82cd('0x8'),auth[_0x82cd('0x6')](),controller['destroy']);module[_0x82cd('0x11')]=router; \ No newline at end of file +var _0x6aa1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','put','delete','exports','multer','util','path'];(function(_0x214d8d,_0x108364){var _0x2071d2=function(_0x2bd2fc){while(--_0x2bd2fc){_0x214d8d['push'](_0x214d8d['shift']());}};_0x2071d2(++_0x108364);}(_0x6aa1,0x7b));var _0x16aa=function(_0x2b1f45,_0x4bc67b){_0x2b1f45=_0x2b1f45-0x0;var _0x395c00=_0x6aa1[_0x2b1f45];return _0x395c00;};'use strict';var multer=require(_0x16aa('0x0'));var util=require(_0x16aa('0x1'));var path=require(_0x16aa('0x2'));var timeout=require(_0x16aa('0x3'));var express=require(_0x16aa('0x4'));var router=express[_0x16aa('0x5')]();var fs_extra=require(_0x16aa('0x6'));var auth=require(_0x16aa('0x7'));var interaction=require(_0x16aa('0x8'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0x16aa('0x9')]('/',auth[_0x16aa('0xa')](),controller[_0x16aa('0xb')]);router['get'](_0x16aa('0xc'),auth['isAuthenticated'](),controller[_0x16aa('0xd')]);router[_0x16aa('0x9')](_0x16aa('0xe'),auth[_0x16aa('0xa')](),controller[_0x16aa('0xf')]);router[_0x16aa('0x9')](_0x16aa('0x10'),auth[_0x16aa('0xa')](),controller['getFields']);router['post']('/',auth[_0x16aa('0xa')](),controller['create']);router[_0x16aa('0x11')](_0x16aa('0xe'),auth[_0x16aa('0xa')](),controller['addConfiguration']);router[_0x16aa('0x12')](_0x16aa('0xc'),auth[_0x16aa('0xa')](),controller['update']);router[_0x16aa('0x13')](_0x16aa('0xc'),auth[_0x16aa('0xa')](),controller['destroy']);module[_0x16aa('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index d5cc236..6f9cb93 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 _0x202a=['exports','STRING','username','remoteUri','ENUM','password','newTab','integrationTab'];(function(_0x3d96c3,_0x28474b){var _0x33837c=function(_0x4eee94){while(--_0x4eee94){_0x3d96c3['push'](_0x3d96c3['shift']());}};_0x33837c(++_0x28474b);}(_0x202a,0xc0));var _0xa202=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x202a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xa202('0x0')]={'name':{'type':Sequelize[_0xa202('0x1')]},'description':{'type':Sequelize[_0xa202('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xa202('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa202('0x3')},'authType':{'type':Sequelize[_0xa202('0x4')]('password','token'),'defaultValue':_0xa202('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xa202('0x6')),'defaultValue':_0xa202('0x7')}}; \ No newline at end of file +var _0xacc6=['sequelize','exports','STRING','ENUM','token','password','newTab','integrationTab'];(function(_0x13cd65,_0x58cc22){var _0x3dfcbb=function(_0x2d4813){while(--_0x2d4813){_0x13cd65['push'](_0x13cd65['shift']());}};_0x3dfcbb(++_0x58cc22);}(_0xacc6,0x150));var _0x6acc=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0xacc6[_0x111e94];return _0x3de107;};'use strict';var Sequelize=require(_0x6acc('0x0'));module[_0x6acc('0x1')]={'name':{'type':Sequelize[_0x6acc('0x2')]},'description':{'type':Sequelize[_0x6acc('0x2')]},'username':{'type':Sequelize[_0x6acc('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x6acc('0x2')]},'token':{'type':Sequelize[_0x6acc('0x2')]},'remoteUri':{'type':Sequelize[_0x6acc('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x6acc('0x3')]('password',_0x6acc('0x4')),'defaultValue':_0x6acc('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6acc('0x3')]('integrationTab',_0x6acc('0x6')),'defaultValue':_0x6acc('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 7637e16..96317ea 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 _0xd64b=['undefined','count','Content-Range','apply','update','then','stack','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','name','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','rows','catch','show','params','keys','includeAll','include','merge','options','find','create','body','destroy','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','ZendeskField','Descriptions','getFields','username','password','token','remoteUri','substring','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','subject','description','assignee','remove','position','title','system_field_options','custom_field_options','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit'];(function(_0x27d7e4,_0x500749){var _0x4f7d26=function(_0x5c9faa){while(--_0x5c9faa){_0x27d7e4['push'](_0x27d7e4['shift']());}};_0x4f7d26(++_0x500749);}(_0xd64b,0xc1));var _0xbd64=function(_0x30d249,_0xe500b9){_0x30d249=_0x30d249-0x0;var _0xa668f7=_0xd64b[_0x30d249];return _0xa668f7;};'use strict';var emlformat=require(_0xbd64('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd64('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd64('0x2'));var moment=require(_0xbd64('0x3'));var BPromise=require(_0xbd64('0x4'));var Mustache=require(_0xbd64('0x5'));var util=require(_0xbd64('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd64('0x7'));var _=require(_0xbd64('0x8'));var squel=require(_0xbd64('0x9'));var crypto=require(_0xbd64('0xa'));var jsforce=require(_0xbd64('0xb'));var deskjs=require(_0xbd64('0xc'));var toCsv=require(_0xbd64('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbd64('0xe'));var authService=require(_0xbd64('0xf'));var qs=require(_0xbd64('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd64('0x11'));var logger=require(_0xbd64('0x12'))(_0xbd64('0x13'));var utils=require(_0xbd64('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbd64('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbd64('0x16'));function respondWithStatusCode(_0x2729d8,_0x3a941c){_0x3a941c=_0x3a941c||0xcc;return function(_0x2183e2){if(_0x2183e2){return _0x2729d8[_0xbd64('0x17')](_0x3a941c);}return _0x2729d8[_0xbd64('0x18')](_0x3a941c)[_0xbd64('0x19')]();};}function respondWithResult(_0x269e2f,_0x2b5808){_0x2b5808=_0x2b5808||0xc8;return function(_0x4ae471){if(_0x4ae471){return _0x269e2f[_0xbd64('0x18')](_0x2b5808)[_0xbd64('0x1a')](_0x4ae471);}};}function respondWithFilteredResult(_0x3ff550,_0x32fd34){return function(_0x29fc16){if(_0x29fc16){var _0x49a914=typeof _0x32fd34[_0xbd64('0x1b')]==='undefined'&&typeof _0x32fd34[_0xbd64('0x1c')]===_0xbd64('0x1d');var _0x3aef70=_0x29fc16[_0xbd64('0x1e')];var _0x17d015=_0x49a914?0x0:_0x32fd34[_0xbd64('0x1b')];var _0xa5491d=_0x49a914?_0x29fc16[_0xbd64('0x1e')]:_0x32fd34['offset']+_0x32fd34[_0xbd64('0x1c')];var _0x1f618b;if(_0xa5491d>=_0x3aef70){_0xa5491d=_0x3aef70;_0x1f618b=0xc8;}else{_0x1f618b=0xce;}_0x3ff550['status'](_0x1f618b);return _0x3ff550['set'](_0xbd64('0x1f'),_0x17d015+'-'+_0xa5491d+'/'+_0x3aef70)[_0xbd64('0x1a')](_0x29fc16);}return null;};}function patchUpdates(_0x196d21){return function(_0x39e2eb){try{jsonpatch[_0xbd64('0x20')](_0x39e2eb,_0x196d21,!![]);}catch(_0x816e00){return BPromise['reject'](_0x816e00);}return _0x39e2eb['save']();};}function saveUpdates(_0x6038f,_0x41f2f){return function(_0x12f67b){if(_0x12f67b){return _0x12f67b[_0xbd64('0x21')](_0x6038f)['then'](function(_0x51d118){return _0x51d118;});}return null;};}function removeEntity(_0x28497c,_0x4afaff){return function(_0x46ab38){if(_0x46ab38){return _0x46ab38['destroy']()[_0xbd64('0x22')](function(){_0x28497c[_0xbd64('0x18')](0xcc)[_0xbd64('0x19')]();});}};}function handleEntityNotFound(_0x2d0993,_0x5ae417){return function(_0x9d0fb8){if(!_0x9d0fb8){_0x2d0993[_0xbd64('0x17')](0x194);}return _0x9d0fb8;};}function handleError(_0x13f527,_0x2a44d0){_0x2a44d0=_0x2a44d0||0x1f4;return function(_0x4d1563){logger['error'](_0x4d1563[_0xbd64('0x23')]);if(_0x4d1563['name']){delete _0x4d1563['name'];}_0x13f527[_0xbd64('0x18')](_0x2a44d0)['send'](_0x4d1563);};}exports[_0xbd64('0x24')]=function(_0x5300e8,_0x28199c){var _0x5d8c35={},_0x1db9f3={},_0x3c0eaf={'count':0x0,'rows':[]};var _0x3be63a=_[_0xbd64('0x25')](db[_0xbd64('0x26')][_0xbd64('0x27')],function(_0x4ed44a){return{'name':_0x4ed44a[_0xbd64('0x28')],'type':_0x4ed44a[_0xbd64('0x29')][_0xbd64('0x2a')]};});_0x1db9f3[_0xbd64('0x2b')]=_[_0xbd64('0x25')](_0x3be63a,_0xbd64('0x2c'));_0x1db9f3['query']=_['keys'](_0x5300e8[_0xbd64('0x2d')]);_0x1db9f3['filters']=_[_0xbd64('0x2e')](_0x1db9f3[_0xbd64('0x2b')],_0x1db9f3['query']);_0x5d8c35['attributes']=_[_0xbd64('0x2e')](_0x1db9f3['model'],qs['fields'](_0x5300e8[_0xbd64('0x2d')][_0xbd64('0x2f')]));_0x5d8c35[_0xbd64('0x30')]=_0x5d8c35['attributes'][_0xbd64('0x31')]?_0x5d8c35['attributes']:_0x1db9f3[_0xbd64('0x2b')];if(!_0x5300e8[_0xbd64('0x2d')][_0xbd64('0x32')](_0xbd64('0x33'))){_0x5d8c35[_0xbd64('0x1c')]=qs[_0xbd64('0x1c')](_0x5300e8['query']['limit']);_0x5d8c35[_0xbd64('0x1b')]=qs[_0xbd64('0x1b')](_0x5300e8[_0xbd64('0x2d')][_0xbd64('0x1b')]);}_0x5d8c35[_0xbd64('0x34')]=qs[_0xbd64('0x35')](_0x5300e8['query']['sort']);_0x5d8c35[_0xbd64('0x36')]=qs[_0xbd64('0x37')](_[_0xbd64('0x38')](_0x5300e8['query'],_0x1db9f3['filters']),_0x3be63a);if(_0x5300e8[_0xbd64('0x2d')]['filter']){_0x5d8c35[_0xbd64('0x36')]=_['merge'](_0x5d8c35[_0xbd64('0x36')],{'$or':_[_0xbd64('0x25')](_0x3be63a,function(_0x550221){if(_0x550221[_0xbd64('0x29')]!=='VIRTUAL'){var _0x534091={};_0x534091[_0x550221[_0xbd64('0x2c')]]={'$like':'%'+_0x5300e8[_0xbd64('0x2d')][_0xbd64('0x39')]+'%'};return _0x534091;}})});}_0x5d8c35=_['merge']({},_0x5d8c35,_0x5300e8['options']);var _0x5d6bcf={'where':_0x5d8c35[_0xbd64('0x36')]};return db[_0xbd64('0x26')]['count'](_0x5d6bcf)[_0xbd64('0x22')](function(_0x34b19a){_0x3c0eaf[_0xbd64('0x1e')]=_0x34b19a;if(_0x5300e8[_0xbd64('0x2d')]['includeAll']){_0x5d8c35['include']=[{'all':!![]}];}return db[_0xbd64('0x26')]['findAll'](_0x5d8c35);})['then'](function(_0x231fa6){_0x3c0eaf[_0xbd64('0x3a')]=_0x231fa6;return _0x3c0eaf;})[_0xbd64('0x22')](respondWithFilteredResult(_0x28199c,_0x5d8c35))[_0xbd64('0x3b')](handleError(_0x28199c,null));};exports[_0xbd64('0x3c')]=function(_0x3155b3,_0x247775){var _0x762380={'raw':![],'where':{'id':_0x3155b3[_0xbd64('0x3d')]['id']}},_0x4870fd={};_0x4870fd[_0xbd64('0x2b')]=_['keys'](db[_0xbd64('0x26')][_0xbd64('0x27')]);_0x4870fd[_0xbd64('0x2d')]=_[_0xbd64('0x3e')](_0x3155b3[_0xbd64('0x2d')]);_0x4870fd[_0xbd64('0x37')]=_[_0xbd64('0x2e')](_0x4870fd['model'],_0x4870fd[_0xbd64('0x2d')]);_0x762380['attributes']=_[_0xbd64('0x2e')](_0x4870fd['model'],qs[_0xbd64('0x2f')](_0x3155b3[_0xbd64('0x2d')][_0xbd64('0x2f')]));_0x762380['attributes']=_0x762380[_0xbd64('0x30')]['length']?_0x762380['attributes']:_0x4870fd['model'];if(_0x3155b3[_0xbd64('0x2d')][_0xbd64('0x3f')]){_0x762380[_0xbd64('0x40')]=[{'all':!![]}];}_0x762380=_[_0xbd64('0x41')]({},_0x762380,_0x3155b3[_0xbd64('0x42')]);return db[_0xbd64('0x26')][_0xbd64('0x43')](_0x762380)['then'](handleEntityNotFound(_0x247775,null))[_0xbd64('0x22')](respondWithResult(_0x247775,null))[_0xbd64('0x3b')](handleError(_0x247775,null));};exports[_0xbd64('0x44')]=function(_0x4e5efe,_0x105bee){return db[_0xbd64('0x26')][_0xbd64('0x44')](_0x4e5efe[_0xbd64('0x45')],{})[_0xbd64('0x22')](respondWithResult(_0x105bee,0xc9))['catch'](handleError(_0x105bee,null));};exports[_0xbd64('0x21')]=function(_0x1a9ec8,_0x2a8011){if(_0x1a9ec8[_0xbd64('0x45')]['id']){delete _0x1a9ec8['body']['id'];}return db['ZendeskAccount'][_0xbd64('0x43')]({'where':{'id':_0x1a9ec8[_0xbd64('0x3d')]['id']}})[_0xbd64('0x22')](handleEntityNotFound(_0x2a8011,null))[_0xbd64('0x22')](saveUpdates(_0x1a9ec8[_0xbd64('0x45')],null))[_0xbd64('0x22')](respondWithResult(_0x2a8011,null))[_0xbd64('0x3b')](handleError(_0x2a8011,null));};exports[_0xbd64('0x46')]=function(_0x460158,_0x2709b2){return db[_0xbd64('0x26')][_0xbd64('0x43')]({'where':{'id':_0x460158[_0xbd64('0x3d')]['id']}})[_0xbd64('0x22')](handleEntityNotFound(_0x2709b2,null))[_0xbd64('0x22')](removeEntity(_0x2709b2,null))['catch'](handleError(_0x2709b2,null));};exports[_0xbd64('0x47')]=function(_0x4952db,_0x5ede67,_0x552c95){var _0x4aa662={};var _0xced0ca={};var _0x2f56df;var _0x5480f5;return db[_0xbd64('0x26')][_0xbd64('0x48')]({'where':{'id':_0x4952db[_0xbd64('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5ede67,null))[_0xbd64('0x22')](function(_0x371bad){if(_0x371bad){_0x2f56df=_0x371bad;_0xced0ca[_0xbd64('0x2b')]=_[_0xbd64('0x3e')](db[_0xbd64('0x49')][_0xbd64('0x27')]);_0xced0ca['query']=_['keys'](_0x4952db['query']);_0xced0ca[_0xbd64('0x37')]=_[_0xbd64('0x2e')](_0xced0ca[_0xbd64('0x2b')],_0xced0ca[_0xbd64('0x2d')]);_0x4aa662['attributes']=_[_0xbd64('0x2e')](_0xced0ca[_0xbd64('0x2b')],qs[_0xbd64('0x2f')](_0x4952db[_0xbd64('0x2d')][_0xbd64('0x2f')]));_0x4aa662[_0xbd64('0x30')]=_0x4aa662['attributes'][_0xbd64('0x31')]?_0x4aa662[_0xbd64('0x30')]:_0xced0ca[_0xbd64('0x2b')];_0x4aa662[_0xbd64('0x34')]=qs[_0xbd64('0x35')](_0x4952db[_0xbd64('0x2d')][_0xbd64('0x35')]);_0x4aa662[_0xbd64('0x36')]=qs[_0xbd64('0x37')](_[_0xbd64('0x38')](_0x4952db[_0xbd64('0x2d')],_0xced0ca[_0xbd64('0x37')]));if(_0x4952db['query']['filter']){_0x4aa662[_0xbd64('0x36')]=_[_0xbd64('0x41')](_0x4aa662['where'],{'$or':_['map'](_0x4aa662[_0xbd64('0x30')],function(_0x12bc56){var _0x49051a={};_0x49051a[_0x12bc56]={'$like':'%'+_0x4952db[_0xbd64('0x2d')][_0xbd64('0x39')]+'%'};return _0x49051a;})});}_0x4aa662=_[_0xbd64('0x41')]({},_0x4aa662,_0x4952db[_0xbd64('0x42')]);return _0x2f56df[_0xbd64('0x47')](_0x4aa662);}})[_0xbd64('0x22')](function(_0x2d788){if(_0x2d788){_0x5480f5=_0x2d788[_0xbd64('0x31')];if(!_0x4952db[_0xbd64('0x2d')]['hasOwnProperty'](_0xbd64('0x33'))){_0x4aa662[_0xbd64('0x1c')]=qs[_0xbd64('0x1c')](_0x4952db['query'][_0xbd64('0x1c')]);_0x4aa662[_0xbd64('0x1b')]=qs['offset'](_0x4952db[_0xbd64('0x2d')][_0xbd64('0x1b')]);}return _0x2f56df[_0xbd64('0x47')](_0x4aa662);}})[_0xbd64('0x22')](function(_0x3615bc){if(_0x3615bc){return _0x3615bc?{'count':_0x5480f5,'rows':_0x3615bc}:null;}})[_0xbd64('0x22')](respondWithResult(_0x5ede67,null))['catch'](handleError(_0x5ede67,null));};exports[_0xbd64('0x4a')]=function(_0x1f3bd0,_0xc57eb1,_0x28d899){if(_0x1f3bd0['body']['id']){delete _0x1f3bd0[_0xbd64('0x45')]['id'];}return db[_0xbd64('0x26')]['findOne']({'where':{'id':_0x1f3bd0[_0xbd64('0x3d')]['id']}})['then'](handleEntityNotFound(_0xc57eb1,null))[_0xbd64('0x22')](function(_0x10e269){if(_0x10e269){_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x4b')]=_0x10e269['id'];_0x1f3bd0['body'][_0xbd64('0x4c')]=integrations[_0xbd64('0x4d')](_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x4e')],_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x29')]);_0x1f3bd0['body']['Descriptions']=integrations['getDescriptions'](_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x4e')],_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x29')]);return db[_0xbd64('0x49')][_0xbd64('0x44')](_0x1f3bd0['body'],{'include':[{'model':db[_0xbd64('0x4f')],'as':_0xbd64('0x4c')},{'model':db[_0xbd64('0x4f')],'as':_0xbd64('0x50')}]});}return null;})[_0xbd64('0x22')](respondWithResult(_0xc57eb1,null))[_0xbd64('0x3b')](handleError(_0xc57eb1,null));};exports[_0xbd64('0x51')]=function(_0x3d7e47,_0x301f42,_0x18e724){var _0x32e611='';return db[_0xbd64('0x26')]['findOne']({'where':{'id':_0x3d7e47['params']['id']},'attributes':['id',_0xbd64('0x52'),_0xbd64('0x53'),_0xbd64('0x54'),'authType',_0xbd64('0x55')]})['then'](handleEntityNotFound(_0x301f42,null))[_0xbd64('0x22')](function(_0x36ebb5){if(_0x36ebb5){_0x32e611=_0x36ebb5[_0xbd64('0x55')];var _0x819774=_0x32e611['slice'](-0x1);if(_0x819774==='/'){_0x32e611=_0x32e611[_0xbd64('0x56')](0x0,_0x32e611['lastIndexOf'](_0x819774));}var _0x14f79e={'method':_0xbd64('0x57'),'uri':util[_0xbd64('0x58')](_0xbd64('0x59'),_0x32e611,_0xbd64('0x5a')),'json':!![]};switch(_0x36ebb5['authType']){case _0xbd64('0x53'):_0x14f79e[_0xbd64('0x5b')]={'Authorization':util['format'](_0xbd64('0x5c'),new Buffer(util[_0xbd64('0x58')](_0xbd64('0x5d'),_0x36ebb5[_0xbd64('0x52')],_0x36ebb5['password']))[_0xbd64('0x5e')]('base64'))};break;case _0xbd64('0x54'):_0x14f79e[_0xbd64('0x5b')]={'Authorization':util[_0xbd64('0x58')]('Basic\x20%s',new Buffer(util['format']('%s/token:%s',_0x36ebb5['username'],_0x36ebb5[_0xbd64('0x54')]))[_0xbd64('0x5e')](_0xbd64('0x5f')))};break;default:throw new db[(_0xbd64('0x60'))][(_0xbd64('0x61'))]('Unknown\x20authentication\x20type');}return rp(_0x14f79e);}})[_0xbd64('0x22')](function(_0x23de71){if(_0x23de71){var _0xac13e6=[_0xbd64('0x62'),_0xbd64('0x63'),'group',_0xbd64('0x64')];_[_0xbd64('0x65')](_0x23de71[_0xbd64('0x5a')],function(_0x808467){return _0xac13e6['includes'](_0x808467['type']);});return{'count':_0x23de71[_0xbd64('0x5a')][_0xbd64('0x31')],'rows':_[_0xbd64('0x25')](_0x23de71[_0xbd64('0x5a')],function(_0x18b0f0){return{'id':_0x18b0f0['id'],'name':_0x18b0f0[_0xbd64('0x66')]>0x7?_0x18b0f0[_0xbd64('0x67')]:_0x18b0f0[_0xbd64('0x29')],'custom':_0x18b0f0['position']>0x7?!![]:![],'options':_0x18b0f0[_0xbd64('0x68')]?_0x18b0f0['system_field_options']:_0x18b0f0[_0xbd64('0x69')]?_0x18b0f0[_0xbd64('0x69')]:[]};})};}})[_0xbd64('0x22')](respondWithResult(_0x301f42,null))['catch'](function(_0x15b625){var _0x5c30f9=_0x3d7e47['query'][_0xbd64('0x6a')]?0x1f4:_0x15b625[_0xbd64('0x6b')]||0x1f4;logger[_0xbd64('0x6c')]('getFields,\x20%s,\x20%s,\x20%s',_0xbd64('0x51'),_0x5c30f9,JSON[_0xbd64('0x6d')](_0x15b625));delete _0x15b625[_0xbd64('0x2c')];if(_0x5c30f9===0x191){_0x5c30f9=0x190;}_0x301f42[_0xbd64('0x18')](_0x5c30f9)['send'](_0x3d7e47[_0xbd64('0x2d')][_0xbd64('0x6a')]?{'message':_0xbd64('0x6e'),'statusCode':_0x15b625[_0xbd64('0x6b')]}:_0x15b625);});}; \ No newline at end of file +var _0xbee3=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','count','limit','set','reject','save','update','then','error','name','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find','destroy','findOne','ZendeskConfiguration','rawAttributes','length','getConfigurations','addConfiguration','AccountId','Subjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1d7151,_0x57d01e){var _0x5f4ee4=function(_0x48b68e){while(--_0x48b68e){_0x1d7151['push'](_0x1d7151['shift']());}};_0x5f4ee4(++_0x57d01e);}(_0xbee3,0xd5));var _0x3bee=function(_0xa7c7be,_0x2df0cf){_0xa7c7be=_0xa7c7be-0x0;var _0x38496e=_0xbee3[_0xa7c7be];return _0x38496e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3bee('0x1'));var moment=require(_0x3bee('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3bee('0x3'));var util=require(_0x3bee('0x4'));var path=require(_0x3bee('0x5'));var sox=require('sox');var csv=require(_0x3bee('0x6'));var ejs=require(_0x3bee('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3bee('0x8'));var squel=require(_0x3bee('0x9'));var crypto=require(_0x3bee('0xa'));var jsforce=require(_0x3bee('0xb'));var deskjs=require(_0x3bee('0xc'));var toCsv=require(_0x3bee('0x6'));var querystring=require(_0x3bee('0xd'));var Papa=require('papaparse');var Redis=require(_0x3bee('0xe'));var authService=require(_0x3bee('0xf'));var qs=require(_0x3bee('0x10'));var as=require(_0x3bee('0x11'));var hardwareService=require(_0x3bee('0x12'));var logger=require(_0x3bee('0x13'))('api');var utils=require(_0x3bee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3bee('0x15'));var db=require(_0x3bee('0x16'))['db'];var integrations=require(_0x3bee('0x17'));function respondWithStatusCode(_0x6950d0,_0x410124){_0x410124=_0x410124||0xcc;return function(_0x459129){if(_0x459129){return _0x6950d0[_0x3bee('0x18')](_0x410124);}return _0x6950d0['status'](_0x410124)[_0x3bee('0x19')]();};}function respondWithResult(_0x33504d,_0x31ac52){_0x31ac52=_0x31ac52||0xc8;return function(_0x237110){if(_0x237110){return _0x33504d[_0x3bee('0x1a')](_0x31ac52)['json'](_0x237110);}};}function respondWithFilteredResult(_0x558436,_0x346767){return function(_0x515397){if(_0x515397){var _0x2cfba7=typeof _0x346767[_0x3bee('0x1b')]==='undefined'&&typeof _0x346767['limit']===_0x3bee('0x1c');var _0x36c5aa=_0x515397[_0x3bee('0x1d')];var _0x631ff8=_0x2cfba7?0x0:_0x346767['offset'];var _0x30a1de=_0x2cfba7?_0x515397[_0x3bee('0x1d')]:_0x346767[_0x3bee('0x1b')]+_0x346767[_0x3bee('0x1e')];var _0x33d812;if(_0x30a1de>=_0x36c5aa){_0x30a1de=_0x36c5aa;_0x33d812=0xc8;}else{_0x33d812=0xce;}_0x558436[_0x3bee('0x1a')](_0x33d812);return _0x558436[_0x3bee('0x1f')]('Content-Range',_0x631ff8+'-'+_0x30a1de+'/'+_0x36c5aa)['json'](_0x515397);}return null;};}function patchUpdates(_0x1afd0f){return function(_0x30bba2){try{jsonpatch['apply'](_0x30bba2,_0x1afd0f,!![]);}catch(_0x471027){return BPromise[_0x3bee('0x20')](_0x471027);}return _0x30bba2[_0x3bee('0x21')]();};}function saveUpdates(_0x179e62,_0x28c248){return function(_0x26e92e){if(_0x26e92e){return _0x26e92e[_0x3bee('0x22')](_0x179e62)['then'](function(_0x8ae4ca){return _0x8ae4ca;});}return null;};}function removeEntity(_0x1ed0c1,_0x1fed5a){return function(_0x3bb884){if(_0x3bb884){return _0x3bb884['destroy']()[_0x3bee('0x23')](function(){_0x1ed0c1[_0x3bee('0x1a')](0xcc)[_0x3bee('0x19')]();});}};}function handleEntityNotFound(_0x4b4cd4,_0x5ed022){return function(_0x13181e){if(!_0x13181e){_0x4b4cd4[_0x3bee('0x18')](0x194);}return _0x13181e;};}function handleError(_0x5341e2,_0x2c0e50){_0x2c0e50=_0x2c0e50||0x1f4;return function(_0x1b4ce0){logger[_0x3bee('0x24')](_0x1b4ce0['stack']);if(_0x1b4ce0[_0x3bee('0x25')]){delete _0x1b4ce0[_0x3bee('0x25')];}_0x5341e2[_0x3bee('0x1a')](_0x2c0e50)['send'](_0x1b4ce0);};}exports[_0x3bee('0x26')]=function(_0xf08fb3,_0x3a3d92){var _0x496abd={},_0x1115ed={},_0x24d523={'count':0x0,'rows':[]};var _0x27ed99=_[_0x3bee('0x27')](db[_0x3bee('0x28')]['rawAttributes'],function(_0x564e45){return{'name':_0x564e45[_0x3bee('0x29')],'type':_0x564e45[_0x3bee('0x2a')][_0x3bee('0x2b')]};});_0x1115ed[_0x3bee('0x2c')]=_['map'](_0x27ed99,'name');_0x1115ed[_0x3bee('0x2d')]=_[_0x3bee('0x2e')](_0xf08fb3['query']);_0x1115ed['filters']=_[_0x3bee('0x2f')](_0x1115ed[_0x3bee('0x2c')],_0x1115ed[_0x3bee('0x2d')]);_0x496abd[_0x3bee('0x30')]=_[_0x3bee('0x2f')](_0x1115ed[_0x3bee('0x2c')],qs[_0x3bee('0x31')](_0xf08fb3[_0x3bee('0x2d')][_0x3bee('0x31')]));_0x496abd[_0x3bee('0x30')]=_0x496abd['attributes']['length']?_0x496abd[_0x3bee('0x30')]:_0x1115ed['model'];if(!_0xf08fb3['query'][_0x3bee('0x32')](_0x3bee('0x33'))){_0x496abd[_0x3bee('0x1e')]=qs[_0x3bee('0x1e')](_0xf08fb3[_0x3bee('0x2d')][_0x3bee('0x1e')]);_0x496abd[_0x3bee('0x1b')]=qs[_0x3bee('0x1b')](_0xf08fb3['query'][_0x3bee('0x1b')]);}_0x496abd[_0x3bee('0x34')]=qs['sort'](_0xf08fb3[_0x3bee('0x2d')][_0x3bee('0x35')]);_0x496abd[_0x3bee('0x36')]=qs[_0x3bee('0x37')](_[_0x3bee('0x38')](_0xf08fb3['query'],_0x1115ed['filters']),_0x27ed99);if(_0xf08fb3[_0x3bee('0x2d')][_0x3bee('0x39')]){_0x496abd[_0x3bee('0x36')]=_[_0x3bee('0x3a')](_0x496abd[_0x3bee('0x36')],{'$or':_[_0x3bee('0x27')](_0x27ed99,function(_0x2c6ca3){if(_0x2c6ca3[_0x3bee('0x2a')]!==_0x3bee('0x3b')){var _0x2591f1={};_0x2591f1[_0x2c6ca3[_0x3bee('0x25')]]={'$like':'%'+_0xf08fb3[_0x3bee('0x2d')]['filter']+'%'};return _0x2591f1;}})});}_0x496abd=_[_0x3bee('0x3a')]({},_0x496abd,_0xf08fb3[_0x3bee('0x3c')]);var _0x25158b={'where':_0x496abd[_0x3bee('0x36')]};return db[_0x3bee('0x28')][_0x3bee('0x1d')](_0x25158b)[_0x3bee('0x23')](function(_0x6195a3){_0x24d523[_0x3bee('0x1d')]=_0x6195a3;if(_0xf08fb3[_0x3bee('0x2d')][_0x3bee('0x3d')]){_0x496abd[_0x3bee('0x3e')]=[{'all':!![]}];}return db[_0x3bee('0x28')]['findAll'](_0x496abd);})[_0x3bee('0x23')](function(_0x2f30d7){_0x24d523[_0x3bee('0x3f')]=_0x2f30d7;return _0x24d523;})[_0x3bee('0x23')](respondWithFilteredResult(_0x3a3d92,_0x496abd))[_0x3bee('0x40')](handleError(_0x3a3d92,null));};exports[_0x3bee('0x41')]=function(_0x13dd72,_0xd1140d){var _0x5d9e1b={'raw':![],'where':{'id':_0x13dd72[_0x3bee('0x42')]['id']}},_0x10a59d={};_0x10a59d[_0x3bee('0x2c')]=_['keys'](db[_0x3bee('0x28')]['rawAttributes']);_0x10a59d[_0x3bee('0x2d')]=_['keys'](_0x13dd72['query']);_0x10a59d[_0x3bee('0x37')]=_[_0x3bee('0x2f')](_0x10a59d[_0x3bee('0x2c')],_0x10a59d[_0x3bee('0x2d')]);_0x5d9e1b[_0x3bee('0x30')]=_['intersection'](_0x10a59d['model'],qs[_0x3bee('0x31')](_0x13dd72['query'][_0x3bee('0x31')]));_0x5d9e1b['attributes']=_0x5d9e1b[_0x3bee('0x30')]['length']?_0x5d9e1b[_0x3bee('0x30')]:_0x10a59d[_0x3bee('0x2c')];if(_0x13dd72[_0x3bee('0x2d')][_0x3bee('0x3d')]){_0x5d9e1b['include']=[{'all':!![]}];}_0x5d9e1b=_['merge']({},_0x5d9e1b,_0x13dd72[_0x3bee('0x3c')]);return db['ZendeskAccount']['find'](_0x5d9e1b)['then'](handleEntityNotFound(_0xd1140d,null))[_0x3bee('0x23')](respondWithResult(_0xd1140d,null))['catch'](handleError(_0xd1140d,null));};exports[_0x3bee('0x43')]=function(_0x33d615,_0xd87fd2){return db['ZendeskAccount'][_0x3bee('0x43')](_0x33d615['body'],{})[_0x3bee('0x23')](respondWithResult(_0xd87fd2,0xc9))['catch'](handleError(_0xd87fd2,null));};exports[_0x3bee('0x22')]=function(_0x16b096,_0x15a96a){if(_0x16b096['body']['id']){delete _0x16b096[_0x3bee('0x44')]['id'];}return db[_0x3bee('0x28')][_0x3bee('0x45')]({'where':{'id':_0x16b096['params']['id']}})['then'](handleEntityNotFound(_0x15a96a,null))[_0x3bee('0x23')](saveUpdates(_0x16b096[_0x3bee('0x44')],null))[_0x3bee('0x23')](respondWithResult(_0x15a96a,null))[_0x3bee('0x40')](handleError(_0x15a96a,null));};exports[_0x3bee('0x46')]=function(_0x21ab40,_0x4005a3){return db['ZendeskAccount'][_0x3bee('0x45')]({'where':{'id':_0x21ab40[_0x3bee('0x42')]['id']}})['then'](handleEntityNotFound(_0x4005a3,null))['then'](removeEntity(_0x4005a3,null))[_0x3bee('0x40')](handleError(_0x4005a3,null));};exports['getConfigurations']=function(_0x1cb54e,_0x2162ce,_0x1f0f23){var _0x4fb836={};var _0x1a13fd={};var _0x3beac9;var _0x127cb8;return db['ZendeskAccount'][_0x3bee('0x47')]({'where':{'id':_0x1cb54e[_0x3bee('0x42')]['id']}})['then'](handleEntityNotFound(_0x2162ce,null))[_0x3bee('0x23')](function(_0x14940e){if(_0x14940e){_0x3beac9=_0x14940e;_0x1a13fd['model']=_[_0x3bee('0x2e')](db[_0x3bee('0x48')][_0x3bee('0x49')]);_0x1a13fd[_0x3bee('0x2d')]=_[_0x3bee('0x2e')](_0x1cb54e[_0x3bee('0x2d')]);_0x1a13fd[_0x3bee('0x37')]=_[_0x3bee('0x2f')](_0x1a13fd['model'],_0x1a13fd['query']);_0x4fb836[_0x3bee('0x30')]=_['intersection'](_0x1a13fd[_0x3bee('0x2c')],qs[_0x3bee('0x31')](_0x1cb54e[_0x3bee('0x2d')]['fields']));_0x4fb836[_0x3bee('0x30')]=_0x4fb836[_0x3bee('0x30')][_0x3bee('0x4a')]?_0x4fb836['attributes']:_0x1a13fd[_0x3bee('0x2c')];_0x4fb836['order']=qs[_0x3bee('0x35')](_0x1cb54e[_0x3bee('0x2d')][_0x3bee('0x35')]);_0x4fb836['where']=qs[_0x3bee('0x37')](_[_0x3bee('0x38')](_0x1cb54e[_0x3bee('0x2d')],_0x1a13fd['filters']));if(_0x1cb54e['query'][_0x3bee('0x39')]){_0x4fb836[_0x3bee('0x36')]=_[_0x3bee('0x3a')](_0x4fb836['where'],{'$or':_['map'](_0x4fb836[_0x3bee('0x30')],function(_0x572fa6){var _0x5cd620={};_0x5cd620[_0x572fa6]={'$like':'%'+_0x1cb54e[_0x3bee('0x2d')][_0x3bee('0x39')]+'%'};return _0x5cd620;})});}_0x4fb836=_[_0x3bee('0x3a')]({},_0x4fb836,_0x1cb54e['options']);return _0x3beac9['getConfigurations'](_0x4fb836);}})[_0x3bee('0x23')](function(_0x1f4eb9){if(_0x1f4eb9){_0x127cb8=_0x1f4eb9['length'];if(!_0x1cb54e[_0x3bee('0x2d')]['hasOwnProperty'](_0x3bee('0x33'))){_0x4fb836[_0x3bee('0x1e')]=qs[_0x3bee('0x1e')](_0x1cb54e[_0x3bee('0x2d')][_0x3bee('0x1e')]);_0x4fb836[_0x3bee('0x1b')]=qs[_0x3bee('0x1b')](_0x1cb54e[_0x3bee('0x2d')][_0x3bee('0x1b')]);}return _0x3beac9[_0x3bee('0x4b')](_0x4fb836);}})[_0x3bee('0x23')](function(_0x5647c8){if(_0x5647c8){return _0x5647c8?{'count':_0x127cb8,'rows':_0x5647c8}:null;}})['then'](respondWithResult(_0x2162ce,null))['catch'](handleError(_0x2162ce,null));};exports[_0x3bee('0x4c')]=function(_0xb5a685,_0x4acba2,_0x9828ad){if(_0xb5a685['body']['id']){delete _0xb5a685[_0x3bee('0x44')]['id'];}return db[_0x3bee('0x28')]['findOne']({'where':{'id':_0xb5a685['params']['id']}})[_0x3bee('0x23')](handleEntityNotFound(_0x4acba2,null))[_0x3bee('0x23')](function(_0x20be01){if(_0x20be01){_0xb5a685['body'][_0x3bee('0x4d')]=_0x20be01['id'];_0xb5a685[_0x3bee('0x44')][_0x3bee('0x4e')]=integrations['getSubjects'](_0xb5a685[_0x3bee('0x44')][_0x3bee('0x4f')],_0xb5a685[_0x3bee('0x44')][_0x3bee('0x2a')]);_0xb5a685['body']['Descriptions']=integrations[_0x3bee('0x50')](_0xb5a685[_0x3bee('0x44')][_0x3bee('0x4f')],_0xb5a685[_0x3bee('0x44')][_0x3bee('0x2a')]);return db['ZendeskConfiguration'][_0x3bee('0x43')](_0xb5a685['body'],{'include':[{'model':db[_0x3bee('0x51')],'as':_0x3bee('0x4e')},{'model':db[_0x3bee('0x51')],'as':_0x3bee('0x52')}]});}return null;})[_0x3bee('0x23')](respondWithResult(_0x4acba2,null))[_0x3bee('0x40')](handleError(_0x4acba2,null));};exports[_0x3bee('0x53')]=function(_0x4d52f3,_0x25f936,_0x28c16e){var _0x42045d='';return db[_0x3bee('0x28')]['findOne']({'where':{'id':_0x4d52f3[_0x3bee('0x42')]['id']},'attributes':['id',_0x3bee('0x54'),_0x3bee('0x55'),_0x3bee('0x56'),_0x3bee('0x57'),_0x3bee('0x58')]})[_0x3bee('0x23')](handleEntityNotFound(_0x25f936,null))[_0x3bee('0x23')](function(_0x519efb){if(_0x519efb){_0x42045d=_0x519efb[_0x3bee('0x58')];var _0x110575=_0x42045d[_0x3bee('0x59')](-0x1);if(_0x110575==='/'){_0x42045d=_0x42045d['substring'](0x0,_0x42045d[_0x3bee('0x5a')](_0x110575));}var _0x479ee2={'method':_0x3bee('0x5b'),'uri':util[_0x3bee('0x5c')](_0x3bee('0x5d'),_0x42045d,_0x3bee('0x5e')),'json':!![]};switch(_0x519efb[_0x3bee('0x57')]){case _0x3bee('0x55'):_0x479ee2[_0x3bee('0x5f')]={'Authorization':util[_0x3bee('0x5c')](_0x3bee('0x60'),new Buffer(util[_0x3bee('0x5c')](_0x3bee('0x61'),_0x519efb[_0x3bee('0x54')],_0x519efb[_0x3bee('0x55')]))[_0x3bee('0x62')](_0x3bee('0x63')))};break;case _0x3bee('0x56'):_0x479ee2[_0x3bee('0x5f')]={'Authorization':util[_0x3bee('0x5c')](_0x3bee('0x60'),new Buffer(util[_0x3bee('0x5c')](_0x3bee('0x64'),_0x519efb[_0x3bee('0x54')],_0x519efb[_0x3bee('0x56')]))['toString'](_0x3bee('0x63')))};break;default:throw new db[(_0x3bee('0x65'))][(_0x3bee('0x66'))](_0x3bee('0x67'));}return rp(_0x479ee2);}})[_0x3bee('0x23')](function(_0x4be1c8){if(_0x4be1c8){var _0x2d6a3d=[_0x3bee('0x68'),_0x3bee('0x69'),'group',_0x3bee('0x6a')];_[_0x3bee('0x6b')](_0x4be1c8['ticket_fields'],function(_0xbfb4af){return _0x2d6a3d['includes'](_0xbfb4af[_0x3bee('0x2a')]);});return{'count':_0x4be1c8[_0x3bee('0x5e')][_0x3bee('0x4a')],'rows':_['map'](_0x4be1c8['ticket_fields'],function(_0x29a2ea){return{'id':_0x29a2ea['id'],'name':_0x29a2ea[_0x3bee('0x6c')]>0x7?_0x29a2ea[_0x3bee('0x6d')]:_0x29a2ea[_0x3bee('0x2a')],'custom':_0x29a2ea[_0x3bee('0x6c')]>0x7?!![]:![],'options':_0x29a2ea[_0x3bee('0x6e')]?_0x29a2ea[_0x3bee('0x6e')]:_0x29a2ea[_0x3bee('0x6f')]?_0x29a2ea['custom_field_options']:[]};})};}})[_0x3bee('0x23')](respondWithResult(_0x25f936,null))[_0x3bee('0x40')](function(_0x22d336){var _0x470ea8=_0x4d52f3[_0x3bee('0x2d')][_0x3bee('0x70')]?0x1f4:_0x22d336[_0x3bee('0x71')]||0x1f4;logger['error'](_0x3bee('0x72'),_0x3bee('0x53'),_0x470ea8,JSON['stringify'](_0x22d336));delete _0x22d336[_0x3bee('0x25')];if(_0x470ea8===0x191){_0x470ea8=0x190;}_0x25f936[_0x3bee('0x1a')](_0x470ea8)['send'](_0x4d52f3[_0x3bee('0x2d')]['test']?{'message':_0x3bee('0x73'),'statusCode':_0x22d336[_0x3bee('0x71')]}:_0x22d336);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 7c7c68f..be7218d 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 _0x506e=['exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes'];(function(_0x47b300,_0x287f4f){var _0x5cb84f=function(_0x4fa1d3){while(--_0x4fa1d3){_0x47b300['push'](_0x47b300['shift']());}};_0x5cb84f(++_0x287f4f);}(_0x506e,0x1a4));var _0xe506=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x506e[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xe506('0x0'));var util=require(_0xe506('0x1'));var logger=require(_0xe506('0x2'))(_0xe506('0x3'));var moment=require(_0xe506('0x4'));var BPromise=require('bluebird');var rp=require(_0xe506('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe506('0x6'));var config=require(_0xe506('0x7'));var attributes=require(_0xe506('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xe506('0x9')]=function(_0x359724,_0x35b133){return _0x359724[_0xe506('0xa')](_0xe506('0xb'),attributes,{'tableName':_0xe506('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b4e=['ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x28077d,_0x500bba){var _0x28b272=function(_0x6bd86c){while(--_0x6bd86c){_0x28077d['push'](_0x28077d['shift']());}};_0x28b272(++_0x500bba);}(_0x2b4e,0xc6));var _0xe2b4=function(_0x46800d,_0x588500){_0x46800d=_0x46800d-0x0;var _0x3824cd=_0x2b4e[_0x46800d];return _0x3824cd;};'use strict';var _=require(_0xe2b4('0x0'));var util=require('util');var logger=require(_0xe2b4('0x1'))(_0xe2b4('0x2'));var moment=require('moment');var BPromise=require(_0xe2b4('0x3'));var rp=require(_0xe2b4('0x4'));var fs=require('fs');var path=require(_0xe2b4('0x5'));var rimraf=require(_0xe2b4('0x6'));var config=require(_0xe2b4('0x7'));var attributes=require(_0xe2b4('0x8'));var integrations=require(_0xe2b4('0x9'));module[_0xe2b4('0xa')]=function(_0x47fc74,_0x1b7db7){return _0x47fc74[_0xe2b4('0xb')](_0xe2b4('0xc'),attributes,{'tableName':_0xe2b4('0xd'),'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 00fce3e..4554781 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 _0x9ea3=['request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskAccount','options','raw','where','attributes','limit','include','map','model','GetZendeskAccount','catch','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x1c94ab,_0x1292f8){var _0x4b9519=function(_0x341344){while(--_0x341344){_0x1c94ab['push'](_0x1c94ab['shift']());}};_0x4b9519(++_0x1292f8);}(_0x9ea3,0x126));var _0x39ea=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x9ea3[_0x40b3f2];return _0x4ce90c;};'use strict';var _=require(_0x39ea('0x0'));var util=require(_0x39ea('0x1'));var moment=require(_0x39ea('0x2'));var BPromise=require(_0x39ea('0x3'));var rs=require(_0x39ea('0x4'));var fs=require('fs');var Redis=require(_0x39ea('0x5'));var db=require(_0x39ea('0x6'))['db'];var utils=require(_0x39ea('0x7'));var logger=require(_0x39ea('0x8'))('rpc');var config=require(_0x39ea('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x39ea('0xa')][_0x39ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29e097,_0x48b0b6,_0x433300){return new BPromise(function(_0x437f50,_0x3f9583){return client[_0x39ea('0xc')](_0x29e097,_0x433300)[_0x39ea('0xd')](function(_0x371b60){logger[_0x39ea('0xe')](_0x39ea('0xf'),_0x48b0b6,'request\x20sent');logger[_0x39ea('0x10')](_0x39ea('0x11'),_0x48b0b6,'request\x20sent',JSON[_0x39ea('0x12')](_0x371b60));if(_0x371b60['error']){if(_0x371b60[_0x39ea('0x13')][_0x39ea('0x14')]===0x1f4){logger['error'](_0x39ea('0xf'),_0x48b0b6,_0x371b60[_0x39ea('0x13')][_0x39ea('0x15')]);return _0x3f9583(_0x371b60[_0x39ea('0x13')][_0x39ea('0x15')]);}logger['error'](_0x39ea('0xf'),_0x48b0b6,_0x371b60[_0x39ea('0x13')]['message']);return _0x437f50(_0x371b60[_0x39ea('0x13')][_0x39ea('0x15')]);}else{logger[_0x39ea('0xe')](_0x39ea('0xf'),_0x48b0b6,'request\x20sent');_0x437f50(_0x371b60['result'][_0x39ea('0x15')]);}})['catch'](function(_0x1d3024){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x48b0b6,_0x1d3024);_0x3f9583(_0x1d3024);});});}exports['GetZendeskAccount']=function(_0x4abba1){var _0x2f714b=this;return new Promise(function(_0x356ca6,_0x7d97eb){return db[_0x39ea('0x16')]['findAll']({'raw':_0x4abba1[_0x39ea('0x17')]?_0x4abba1[_0x39ea('0x17')][_0x39ea('0x18')]===undefined?!![]:![]:!![],'where':_0x4abba1[_0x39ea('0x17')]?_0x4abba1[_0x39ea('0x17')][_0x39ea('0x19')]||null:null,'attributes':_0x4abba1[_0x39ea('0x17')]?_0x4abba1[_0x39ea('0x17')][_0x39ea('0x1a')]||null:null,'limit':_0x4abba1[_0x39ea('0x17')]?_0x4abba1['options'][_0x39ea('0x1b')]||null:null,'include':_0x4abba1[_0x39ea('0x17')]?_0x4abba1[_0x39ea('0x17')][_0x39ea('0x1c')]?_[_0x39ea('0x1d')](_0x4abba1[_0x39ea('0x17')]['include'],function(_0x2a20da){return{'model':db[_0x2a20da[_0x39ea('0x1e')]],'as':_0x2a20da['as'],'attributes':_0x2a20da[_0x39ea('0x1a')],'include':_0x2a20da['include']?_[_0x39ea('0x1d')](_0x2a20da['include'],function(_0x7deae0){return{'model':db[_0x7deae0[_0x39ea('0x1e')]],'as':_0x7deae0['as'],'attributes':_0x7deae0[_0x39ea('0x1a')],'include':_0x7deae0[_0x39ea('0x1c')]?_[_0x39ea('0x1d')](_0x7deae0[_0x39ea('0x1c')],function(_0x1e849c){return{'model':db[_0x1e849c[_0x39ea('0x1e')]],'as':_0x1e849c['as'],'attributes':_0x1e849c[_0x39ea('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x39ea('0xd')](function(_0x3f80cc){logger[_0x39ea('0xe')](_0x39ea('0x1f'),_0x4abba1);logger[_0x39ea('0x10')](_0x39ea('0x1f'),_0x4abba1,JSON[_0x39ea('0x12')](_0x3f80cc));_0x356ca6(_0x3f80cc);})[_0x39ea('0x20')](function(_0x313633){logger[_0x39ea('0x13')](_0x39ea('0x1f'),_0x313633[_0x39ea('0x15')],_0x4abba1);_0x7d97eb(_0x2f714b[_0x39ea('0x13')](0x1f4,_0x313633['message']));});});};exports[_0x39ea('0x21')]=function(_0x111e48){var _0x18af98=this;return new Promise(function(_0x4c9929,_0x212f6b){return db['ZendeskAccount']['find']({'raw':_0x111e48[_0x39ea('0x17')]?_0x111e48[_0x39ea('0x17')][_0x39ea('0x18')]===undefined?!![]:![]:!![],'where':_0x111e48[_0x39ea('0x17')]?_0x111e48[_0x39ea('0x17')][_0x39ea('0x19')]||null:null,'attributes':_0x111e48[_0x39ea('0x17')]?_0x111e48[_0x39ea('0x17')]['attributes']||null:null,'include':_0x111e48[_0x39ea('0x17')]?_0x111e48[_0x39ea('0x17')][_0x39ea('0x1c')]?_['map'](_0x111e48['options'][_0x39ea('0x1c')],function(_0x600243){return{'model':db[_0x600243[_0x39ea('0x1e')]],'as':_0x600243['as'],'attributes':_0x600243['attributes'],'include':_0x600243[_0x39ea('0x1c')]?_[_0x39ea('0x1d')](_0x600243[_0x39ea('0x1c')],function(_0x4e953f){return{'model':db[_0x4e953f['model']],'as':_0x4e953f['as'],'attributes':_0x4e953f[_0x39ea('0x1a')],'include':_0x4e953f['include']?_[_0x39ea('0x1d')](_0x4e953f['include'],function(_0x583cfa){return{'model':db[_0x583cfa[_0x39ea('0x1e')]],'as':_0x583cfa['as'],'attributes':_0x583cfa[_0x39ea('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x39ea('0xd')](function(_0x4249ab){logger[_0x39ea('0xe')]('ShowZendeskAccount',_0x111e48);logger['debug'](_0x39ea('0x21'),_0x111e48,JSON['stringify'](_0x4249ab));_0x4c9929(_0x4249ab);})['catch'](function(_0x2b1a67){logger['error'](_0x39ea('0x21'),_0x2b1a67[_0x39ea('0x15')],_0x111e48);_0x212f6b(_0x18af98[_0x39ea('0x13')](0x1f4,_0x2b1a67['message']));});});}; \ No newline at end of file +var _0x8ab0=['limit','include','model','map','then','ShowZendeskAccount','ZendeskAccount','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZendeskAccount','findAll','options','raw','where','attributes'];(function(_0x219a83,_0x1b38ec){var _0x561f32=function(_0x43b1a9){while(--_0x43b1a9){_0x219a83['push'](_0x219a83['shift']());}};_0x561f32(++_0x1b38ec);}(_0x8ab0,0x1c1));var _0x08ab=function(_0x22d3e8,_0x59c024){_0x22d3e8=_0x22d3e8-0x0;var _0x3a7fa0=_0x8ab0[_0x22d3e8];return _0x3a7fa0;};'use strict';var _=require(_0x08ab('0x0'));var util=require(_0x08ab('0x1'));var moment=require(_0x08ab('0x2'));var BPromise=require('bluebird');var rs=require(_0x08ab('0x3'));var fs=require('fs');var Redis=require(_0x08ab('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x08ab('0x5'));var logger=require(_0x08ab('0x6'))(_0x08ab('0x7'));var config=require('../../config/environment');var jayson=require(_0x08ab('0x8'));var client=jayson[_0x08ab('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ca903,_0x567a53,_0x2b08c5){return new BPromise(function(_0x12e597,_0x5cd27e){return client[_0x08ab('0xa')](_0x1ca903,_0x2b08c5)['then'](function(_0x450be4){logger[_0x08ab('0xb')](_0x08ab('0xc'),_0x567a53,_0x08ab('0xd'));logger[_0x08ab('0xe')](_0x08ab('0xf'),_0x567a53,'request\x20sent',JSON[_0x08ab('0x10')](_0x450be4));if(_0x450be4['error']){if(_0x450be4[_0x08ab('0x11')]['code']===0x1f4){logger[_0x08ab('0x11')](_0x08ab('0xc'),_0x567a53,_0x450be4['error'][_0x08ab('0x12')]);return _0x5cd27e(_0x450be4[_0x08ab('0x11')]['message']);}logger[_0x08ab('0x11')](_0x08ab('0xc'),_0x567a53,_0x450be4[_0x08ab('0x11')]['message']);return _0x12e597(_0x450be4[_0x08ab('0x11')][_0x08ab('0x12')]);}else{logger['info'](_0x08ab('0xc'),_0x567a53,'request\x20sent');_0x12e597(_0x450be4[_0x08ab('0x13')]['message']);}})[_0x08ab('0x14')](function(_0x24de45){logger[_0x08ab('0x11')](_0x08ab('0xc'),_0x567a53,_0x24de45);_0x5cd27e(_0x24de45);});});}exports[_0x08ab('0x15')]=function(_0x996f6e){var _0x20b73d=this;return new Promise(function(_0xcbcd84,_0x4d6983){return db['ZendeskAccount'][_0x08ab('0x16')]({'raw':_0x996f6e[_0x08ab('0x17')]?_0x996f6e['options'][_0x08ab('0x18')]===undefined?!![]:![]:!![],'where':_0x996f6e['options']?_0x996f6e[_0x08ab('0x17')][_0x08ab('0x19')]||null:null,'attributes':_0x996f6e[_0x08ab('0x17')]?_0x996f6e[_0x08ab('0x17')][_0x08ab('0x1a')]||null:null,'limit':_0x996f6e[_0x08ab('0x17')]?_0x996f6e['options'][_0x08ab('0x1b')]||null:null,'include':_0x996f6e[_0x08ab('0x17')]?_0x996f6e[_0x08ab('0x17')][_0x08ab('0x1c')]?_['map'](_0x996f6e['options'][_0x08ab('0x1c')],function(_0x4613b0){return{'model':db[_0x4613b0[_0x08ab('0x1d')]],'as':_0x4613b0['as'],'attributes':_0x4613b0[_0x08ab('0x1a')],'include':_0x4613b0['include']?_[_0x08ab('0x1e')](_0x4613b0[_0x08ab('0x1c')],function(_0x12efaf){return{'model':db[_0x12efaf[_0x08ab('0x1d')]],'as':_0x12efaf['as'],'attributes':_0x12efaf[_0x08ab('0x1a')],'include':_0x12efaf[_0x08ab('0x1c')]?_[_0x08ab('0x1e')](_0x12efaf[_0x08ab('0x1c')],function(_0x17e410){return{'model':db[_0x17e410[_0x08ab('0x1d')]],'as':_0x17e410['as'],'attributes':_0x17e410[_0x08ab('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x08ab('0x1f')](function(_0x1d1c19){logger['info'](_0x08ab('0x15'),_0x996f6e);logger[_0x08ab('0xe')](_0x08ab('0x15'),_0x996f6e,JSON['stringify'](_0x1d1c19));_0xcbcd84(_0x1d1c19);})['catch'](function(_0x58161e){logger[_0x08ab('0x11')](_0x08ab('0x15'),_0x58161e[_0x08ab('0x12')],_0x996f6e);_0x4d6983(_0x20b73d['error'](0x1f4,_0x58161e[_0x08ab('0x12')]));});});};exports[_0x08ab('0x20')]=function(_0x4af3c8){var _0x12d898=this;return new Promise(function(_0x9506c4,_0x1afc6a){return db[_0x08ab('0x21')]['find']({'raw':_0x4af3c8[_0x08ab('0x17')]?_0x4af3c8[_0x08ab('0x17')][_0x08ab('0x18')]===undefined?!![]:![]:!![],'where':_0x4af3c8[_0x08ab('0x17')]?_0x4af3c8[_0x08ab('0x17')][_0x08ab('0x19')]||null:null,'attributes':_0x4af3c8[_0x08ab('0x17')]?_0x4af3c8[_0x08ab('0x17')][_0x08ab('0x1a')]||null:null,'include':_0x4af3c8[_0x08ab('0x17')]?_0x4af3c8[_0x08ab('0x17')]['include']?_['map'](_0x4af3c8[_0x08ab('0x17')][_0x08ab('0x1c')],function(_0x3ad2a0){return{'model':db[_0x3ad2a0['model']],'as':_0x3ad2a0['as'],'attributes':_0x3ad2a0[_0x08ab('0x1a')],'include':_0x3ad2a0[_0x08ab('0x1c')]?_['map'](_0x3ad2a0[_0x08ab('0x1c')],function(_0x28976e){return{'model':db[_0x28976e[_0x08ab('0x1d')]],'as':_0x28976e['as'],'attributes':_0x28976e[_0x08ab('0x1a')],'include':_0x28976e[_0x08ab('0x1c')]?_[_0x08ab('0x1e')](_0x28976e['include'],function(_0x537205){return{'model':db[_0x537205[_0x08ab('0x1d')]],'as':_0x537205['as'],'attributes':_0x537205['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x44bb15){logger[_0x08ab('0xb')](_0x08ab('0x20'),_0x4af3c8);logger['debug'](_0x08ab('0x20'),_0x4af3c8,JSON[_0x08ab('0x10')](_0x44bb15));_0x9506c4(_0x44bb15);})[_0x08ab('0x14')](function(_0x522b4c){logger[_0x08ab('0x11')](_0x08ab('0x20'),_0x522b4c[_0x08ab('0x12')],_0x4af3c8);_0x1afc6a(_0x12d898['error'](0x1f4,_0x522b4c[_0x08ab('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 7ef3af1..a7e17fb 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 _0xf4eb=['put','update','delete','/:id','destroy','exports','multer','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','create','post','setTags'];(function(_0xd7ac2b,_0x48046f){var _0x3722f5=function(_0x41653a){while(--_0x41653a){_0xd7ac2b['push'](_0xd7ac2b['shift']());}};_0x3722f5(++_0x48046f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x212caf,_0x545e80){_0x212caf=_0x212caf-0x0;var _0x243f4c=_0xf4eb[_0x212caf];return _0x243f4c;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/:id',auth[_0xbf4e('0x6')](),controller['show']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x5')](_0xbf4e('0xa'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router['get']('/:id/descriptions',auth[_0xbf4e('0x6')](),controller['getDescriptions']);router[_0xbf4e('0x5')](_0xbf4e('0xc'),auth['isAuthenticated'](),controller[_0xbf4e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0xe')]);router[_0xbf4e('0xf')](_0xbf4e('0xc'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x10')]);router[_0xbf4e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xbf4e('0x12')]);router[_0xbf4e('0x13')](_0xbf4e('0x14'),auth['isAuthenticated'](),controller[_0xbf4e('0x15')]);module[_0xbf4e('0x16')]=router; \ No newline at end of file +var _0xe5b5=['../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x20aaa0,_0x5547b3){var _0x2729c4=function(_0x54b0a1){while(--_0x54b0a1){_0x20aaa0['push'](_0x20aaa0['shift']());}};_0x2729c4(++_0x5547b3);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0xe5b5[_0x5ac0f0];return _0x4aceec;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/subjects',auth[_0x5e5b('0xc')](),controller['getSubjects']);router[_0x5e5b('0xb')](_0x5e5b('0x12'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x5e5b('0x14')]);router[_0x5e5b('0x15')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x16')]);router[_0x5e5b('0x15')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),controller['setTags']);router[_0x5e5b('0x18')](_0x5e5b('0xe'),auth['isAuthenticated'](),controller[_0x5e5b('0x19')]);router['delete']('/:id',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x1a')]);module[_0x5e5b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index f3b7e42..771563c 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 _0x812d=['sequelize','exports','STRING'];(function(_0x1e45ec,_0x2e11eb){var _0x42f22d=function(_0x35bd42){while(--_0x35bd42){_0x1e45ec['push'](_0x1e45ec['shift']());}};_0x42f22d(++_0x2e11eb);}(_0x812d,0x1bc));var _0xd812=function(_0x122879,_0x1fd3ed){_0x122879=_0x122879-0x0;var _0x5cbf8a=_0x812d[_0x122879];return _0x5cbf8a;};'use strict';var Sequelize=require(_0xd812('0x0'));module[_0xd812('0x1')]={'name':{'type':Sequelize[_0xd812('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc47a=['STRING','sequelize'];(function(_0x4b9689,_0x20c07a){var _0x5dc633=function(_0x216885){while(--_0x216885){_0x4b9689['push'](_0x4b9689['shift']());}};_0x5dc633(++_0x20c07a);}(_0xc47a,0xf3));var _0xac47=function(_0x413fa1,_0x473ae1){_0x413fa1=_0x413fa1-0x0;var _0xa1f3e9=_0xc47a[_0x413fa1];return _0xa1f3e9;};'use strict';var Sequelize=require(_0xac47('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xac47('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 73134c6..ae26795 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 _0x3b82=['index','ZendeskConfiguration','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','filters','create','body','find','destroy','getFields','findOne','sort','hasOwnProperty','catch','getSubjects','ZendeskField','getDescriptions','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','save','then','sendStatus','stack','name','send'];(function(_0xfaee68,_0xf7522f){var _0x4cb663=function(_0x34eb02){while(--_0x34eb02){_0xfaee68['push'](_0xfaee68['shift']());}};_0x4cb663(++_0xf7522f);}(_0x3b82,0x172));var _0x23b8=function(_0x2f75cb,_0x4fc45a){_0x2f75cb=_0x2f75cb-0x0;var _0x3b06e9=_0x3b82[_0x2f75cb];return _0x3b06e9;};'use strict';var emlformat=require(_0x23b8('0x0'));var rimraf=require(_0x23b8('0x1'));var zipdir=require(_0x23b8('0x2'));var jsonpatch=require(_0x23b8('0x3'));var rp=require(_0x23b8('0x4'));var moment=require(_0x23b8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x23b8('0x6'));var util=require(_0x23b8('0x7'));var path=require(_0x23b8('0x8'));var sox=require('sox');var csv=require(_0x23b8('0x9'));var ejs=require(_0x23b8('0xa'));var fs=require('fs');var fs_extra=require(_0x23b8('0xb'));var _=require(_0x23b8('0xc'));var squel=require(_0x23b8('0xd'));var crypto=require(_0x23b8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x23b8('0xf'));var toCsv=require(_0x23b8('0x9'));var querystring=require('querystring');var Papa=require(_0x23b8('0x10'));var Redis=require(_0x23b8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x23b8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x23b8('0x13'));var logger=require(_0x23b8('0x14'))('api');var utils=require(_0x23b8('0x15'));var config=require(_0x23b8('0x16'));var licenseUtil=require(_0x23b8('0x17'));var db=require(_0x23b8('0x18'))['db'];function respondWithStatusCode(_0x2a0ac1,_0x38f13c){_0x38f13c=_0x38f13c||0xcc;return function(_0x1bbb88){if(_0x1bbb88){return _0x2a0ac1['sendStatus'](_0x38f13c);}return _0x2a0ac1[_0x23b8('0x19')](_0x38f13c)[_0x23b8('0x1a')]();};}function respondWithResult(_0x140a36,_0x57b031){_0x57b031=_0x57b031||0xc8;return function(_0x25f8df){if(_0x25f8df){return _0x140a36[_0x23b8('0x19')](_0x57b031)['json'](_0x25f8df);}};}function respondWithFilteredResult(_0x25efad,_0x3b4617){return function(_0x2f5338){if(_0x2f5338){var _0x50dded=typeof _0x3b4617['offset']===_0x23b8('0x1b')&&typeof _0x3b4617[_0x23b8('0x1c')]==='undefined';var _0x9ef806=_0x2f5338[_0x23b8('0x1d')];var _0x1607be=_0x50dded?0x0:_0x3b4617['offset'];var _0x379f1b=_0x50dded?_0x2f5338[_0x23b8('0x1d')]:_0x3b4617[_0x23b8('0x1e')]+_0x3b4617[_0x23b8('0x1c')];var _0x4829df;if(_0x379f1b>=_0x9ef806){_0x379f1b=_0x9ef806;_0x4829df=0xc8;}else{_0x4829df=0xce;}_0x25efad[_0x23b8('0x19')](_0x4829df);return _0x25efad[_0x23b8('0x1f')](_0x23b8('0x20'),_0x1607be+'-'+_0x379f1b+'/'+_0x9ef806)[_0x23b8('0x21')](_0x2f5338);}return null;};}function patchUpdates(_0x40fb7a){return function(_0x339838){try{jsonpatch['apply'](_0x339838,_0x40fb7a,!![]);}catch(_0x30f2d4){return BPromise['reject'](_0x30f2d4);}return _0x339838[_0x23b8('0x22')]();};}function saveUpdates(_0x442df5,_0x5ed121){return function(_0x358b2c){if(_0x358b2c){return _0x358b2c['update'](_0x442df5)['then'](function(_0x54640c){return _0x54640c;});}return null;};}function removeEntity(_0x104db3,_0x2d85bd){return function(_0x143bfa){if(_0x143bfa){return _0x143bfa['destroy']()[_0x23b8('0x23')](function(){_0x104db3['status'](0xcc)[_0x23b8('0x1a')]();});}};}function handleEntityNotFound(_0x483086,_0x4cfe4e){return function(_0x3279d6){if(!_0x3279d6){_0x483086[_0x23b8('0x24')](0x194);}return _0x3279d6;};}function handleError(_0xd2a9a,_0x359f72){_0x359f72=_0x359f72||0x1f4;return function(_0x2d7bf9){logger['error'](_0x2d7bf9[_0x23b8('0x25')]);if(_0x2d7bf9[_0x23b8('0x26')]){delete _0x2d7bf9[_0x23b8('0x26')];}_0xd2a9a[_0x23b8('0x19')](_0x359f72)[_0x23b8('0x27')](_0x2d7bf9);};}exports[_0x23b8('0x28')]=function(_0x360d06,_0x56bcee){var _0x59c5fc={},_0x534fb9={},_0xeb7e1e={'count':0x0,'rows':[]};var _0x32e6ee=_['map'](db[_0x23b8('0x29')]['rawAttributes'],function(_0x9bb1f4){return{'name':_0x9bb1f4['fieldName'],'type':_0x9bb1f4[_0x23b8('0x2a')][_0x23b8('0x2b')]};});_0x534fb9['model']=_['map'](_0x32e6ee,'name');_0x534fb9[_0x23b8('0x2c')]=_[_0x23b8('0x2d')](_0x360d06['query']);_0x534fb9['filters']=_[_0x23b8('0x2e')](_0x534fb9[_0x23b8('0x2f')],_0x534fb9[_0x23b8('0x2c')]);_0x59c5fc[_0x23b8('0x30')]=_[_0x23b8('0x2e')](_0x534fb9[_0x23b8('0x2f')],qs[_0x23b8('0x31')](_0x360d06[_0x23b8('0x2c')][_0x23b8('0x31')]));_0x59c5fc[_0x23b8('0x30')]=_0x59c5fc[_0x23b8('0x30')][_0x23b8('0x32')]?_0x59c5fc[_0x23b8('0x30')]:_0x534fb9['model'];if(!_0x360d06[_0x23b8('0x2c')]['hasOwnProperty'](_0x23b8('0x33'))){_0x59c5fc[_0x23b8('0x1c')]=qs[_0x23b8('0x1c')](_0x360d06[_0x23b8('0x2c')][_0x23b8('0x1c')]);_0x59c5fc['offset']=qs[_0x23b8('0x1e')](_0x360d06[_0x23b8('0x2c')][_0x23b8('0x1e')]);}_0x59c5fc[_0x23b8('0x34')]=qs['sort'](_0x360d06[_0x23b8('0x2c')]['sort']);_0x59c5fc['where']=qs['filters'](_[_0x23b8('0x35')](_0x360d06[_0x23b8('0x2c')],_0x534fb9['filters']),_0x32e6ee);if(_0x360d06[_0x23b8('0x2c')][_0x23b8('0x36')]){_0x59c5fc[_0x23b8('0x37')]=_[_0x23b8('0x38')](_0x59c5fc[_0x23b8('0x37')],{'$or':_[_0x23b8('0x39')](_0x32e6ee,function(_0x236b77){if(_0x236b77[_0x23b8('0x2a')]!==_0x23b8('0x3a')){var _0x1ac6f8={};_0x1ac6f8[_0x236b77[_0x23b8('0x26')]]={'$like':'%'+_0x360d06[_0x23b8('0x2c')][_0x23b8('0x36')]+'%'};return _0x1ac6f8;}})});}_0x59c5fc=_['merge']({},_0x59c5fc,_0x360d06[_0x23b8('0x3b')]);var _0x25d811={'where':_0x59c5fc['where']};return db[_0x23b8('0x29')][_0x23b8('0x1d')](_0x25d811)['then'](function(_0x4afc8d){_0xeb7e1e[_0x23b8('0x1d')]=_0x4afc8d;if(_0x360d06[_0x23b8('0x2c')][_0x23b8('0x3c')]){_0x59c5fc[_0x23b8('0x3d')]=[{'all':!![]}];}return db[_0x23b8('0x29')][_0x23b8('0x3e')](_0x59c5fc);})[_0x23b8('0x23')](function(_0x3fb3bf){_0xeb7e1e[_0x23b8('0x3f')]=_0x3fb3bf;return _0xeb7e1e;})['then'](respondWithFilteredResult(_0x56bcee,_0x59c5fc))['catch'](handleError(_0x56bcee,null));};exports[_0x23b8('0x40')]=function(_0x33a75a,_0xa10182){var _0x2f9e03={'raw':![],'where':{'id':_0x33a75a[_0x23b8('0x41')]['id']}},_0x3e0d7d={};_0x3e0d7d[_0x23b8('0x2f')]=_['keys'](db[_0x23b8('0x29')][_0x23b8('0x42')]);_0x3e0d7d[_0x23b8('0x2c')]=_[_0x23b8('0x2d')](_0x33a75a['query']);_0x3e0d7d[_0x23b8('0x43')]=_[_0x23b8('0x2e')](_0x3e0d7d[_0x23b8('0x2f')],_0x3e0d7d[_0x23b8('0x2c')]);_0x2f9e03[_0x23b8('0x30')]=_[_0x23b8('0x2e')](_0x3e0d7d[_0x23b8('0x2f')],qs[_0x23b8('0x31')](_0x33a75a['query'][_0x23b8('0x31')]));_0x2f9e03[_0x23b8('0x30')]=_0x2f9e03[_0x23b8('0x30')]['length']?_0x2f9e03[_0x23b8('0x30')]:_0x3e0d7d['model'];if(_0x33a75a[_0x23b8('0x2c')][_0x23b8('0x3c')]){_0x2f9e03['include']=[{'all':!![]}];}_0x2f9e03=_[_0x23b8('0x38')]({},_0x2f9e03,_0x33a75a[_0x23b8('0x3b')]);return db[_0x23b8('0x29')]['find'](_0x2f9e03)[_0x23b8('0x23')](handleEntityNotFound(_0xa10182,null))[_0x23b8('0x23')](respondWithResult(_0xa10182,null))['catch'](handleError(_0xa10182,null));};exports[_0x23b8('0x44')]=function(_0x2a39e8,_0x170f69){return db[_0x23b8('0x29')]['create'](_0x2a39e8[_0x23b8('0x45')],{})['then'](respondWithResult(_0x170f69,0xc9))['catch'](handleError(_0x170f69,null));};exports['update']=function(_0x28905b,_0x370458){if(_0x28905b['body']['id']){delete _0x28905b[_0x23b8('0x45')]['id'];}return db[_0x23b8('0x29')][_0x23b8('0x46')]({'where':{'id':_0x28905b[_0x23b8('0x41')]['id']}})[_0x23b8('0x23')](handleEntityNotFound(_0x370458,null))[_0x23b8('0x23')](saveUpdates(_0x28905b[_0x23b8('0x45')],null))[_0x23b8('0x23')](respondWithResult(_0x370458,null))['catch'](handleError(_0x370458,null));};exports[_0x23b8('0x47')]=function(_0x490e71,_0xd924fc){return db[_0x23b8('0x29')]['find']({'where':{'id':_0x490e71[_0x23b8('0x41')]['id']}})[_0x23b8('0x23')](handleEntityNotFound(_0xd924fc,null))[_0x23b8('0x23')](removeEntity(_0xd924fc,null))['catch'](handleError(_0xd924fc,null));};exports[_0x23b8('0x48')]=function(_0x167492,_0x231708,_0x526b62){var _0x281ba7={};var _0x552c9d={};var _0x141c7f;var _0x5010c6;return db[_0x23b8('0x29')][_0x23b8('0x49')]({'where':{'id':_0x167492[_0x23b8('0x41')]['id']}})['then'](handleEntityNotFound(_0x231708,null))['then'](function(_0x41b5f5){if(_0x41b5f5){_0x141c7f=_0x41b5f5;_0x552c9d['model']=_[_0x23b8('0x2d')](db['ZendeskField'][_0x23b8('0x42')]);_0x552c9d['query']=_[_0x23b8('0x2d')](_0x167492[_0x23b8('0x2c')]);_0x552c9d[_0x23b8('0x43')]=_['intersection'](_0x552c9d[_0x23b8('0x2f')],_0x552c9d[_0x23b8('0x2c')]);_0x281ba7[_0x23b8('0x30')]=_[_0x23b8('0x2e')](_0x552c9d[_0x23b8('0x2f')],qs[_0x23b8('0x31')](_0x167492[_0x23b8('0x2c')][_0x23b8('0x31')]));_0x281ba7[_0x23b8('0x30')]=_0x281ba7[_0x23b8('0x30')][_0x23b8('0x32')]?_0x281ba7[_0x23b8('0x30')]:_0x552c9d['model'];_0x281ba7[_0x23b8('0x34')]=qs[_0x23b8('0x4a')](_0x167492[_0x23b8('0x2c')]['sort']);_0x281ba7['where']=qs[_0x23b8('0x43')](_[_0x23b8('0x35')](_0x167492['query'],_0x552c9d['filters']));if(_0x167492['query'][_0x23b8('0x36')]){_0x281ba7[_0x23b8('0x37')]=_['merge'](_0x281ba7[_0x23b8('0x37')],{'$or':_[_0x23b8('0x39')](_0x281ba7[_0x23b8('0x30')],function(_0x5ea98d){var _0x40c632={};_0x40c632[_0x5ea98d]={'$like':'%'+_0x167492[_0x23b8('0x2c')][_0x23b8('0x36')]+'%'};return _0x40c632;})});}_0x281ba7=_[_0x23b8('0x38')]({},_0x281ba7,_0x167492[_0x23b8('0x3b')]);return _0x141c7f['getFields'](_0x281ba7);}})['then'](function(_0x1a953a){if(_0x1a953a){_0x5010c6=_0x1a953a[_0x23b8('0x32')];if(!_0x167492['query'][_0x23b8('0x4b')](_0x23b8('0x33'))){_0x281ba7[_0x23b8('0x1c')]=qs['limit'](_0x167492[_0x23b8('0x2c')][_0x23b8('0x1c')]);_0x281ba7[_0x23b8('0x1e')]=qs[_0x23b8('0x1e')](_0x167492[_0x23b8('0x2c')]['offset']);}return _0x141c7f['getFields'](_0x281ba7);}})[_0x23b8('0x23')](function(_0x48332e){if(_0x48332e){return _0x48332e?{'count':_0x5010c6,'rows':_0x48332e}:null;}})[_0x23b8('0x23')](respondWithResult(_0x231708,null))[_0x23b8('0x4c')](handleError(_0x231708,null));};exports[_0x23b8('0x4d')]=function(_0x68423c,_0x3781fc,_0x1a2e56){var _0x566705={};var _0x41c3b0={};var _0x2b03b1;var _0x2a38cf;return db[_0x23b8('0x29')][_0x23b8('0x49')]({'where':{'id':_0x68423c[_0x23b8('0x41')]['id']}})['then'](handleEntityNotFound(_0x3781fc,null))['then'](function(_0x32c2e5){if(_0x32c2e5){_0x2b03b1=_0x32c2e5;_0x41c3b0[_0x23b8('0x2f')]=_[_0x23b8('0x2d')](db[_0x23b8('0x4e')][_0x23b8('0x42')]);_0x41c3b0[_0x23b8('0x2c')]=_[_0x23b8('0x2d')](_0x68423c[_0x23b8('0x2c')]);_0x41c3b0[_0x23b8('0x43')]=_['intersection'](_0x41c3b0[_0x23b8('0x2f')],_0x41c3b0['query']);_0x566705['attributes']=_[_0x23b8('0x2e')](_0x41c3b0['model'],qs[_0x23b8('0x31')](_0x68423c['query']['fields']));_0x566705[_0x23b8('0x30')]=_0x566705[_0x23b8('0x30')]['length']?_0x566705[_0x23b8('0x30')]:_0x41c3b0[_0x23b8('0x2f')];_0x566705[_0x23b8('0x34')]=qs[_0x23b8('0x4a')](_0x68423c['query'][_0x23b8('0x4a')]);_0x566705[_0x23b8('0x37')]=qs[_0x23b8('0x43')](_['pick'](_0x68423c[_0x23b8('0x2c')],_0x41c3b0[_0x23b8('0x43')]));if(_0x68423c['query'][_0x23b8('0x36')]){_0x566705[_0x23b8('0x37')]=_[_0x23b8('0x38')](_0x566705[_0x23b8('0x37')],{'$or':_[_0x23b8('0x39')](_0x566705[_0x23b8('0x30')],function(_0x486617){var _0xff1e7={};_0xff1e7[_0x486617]={'$like':'%'+_0x68423c[_0x23b8('0x2c')]['filter']+'%'};return _0xff1e7;})});}_0x566705=_['merge']({},_0x566705,_0x68423c[_0x23b8('0x3b')]);return _0x2b03b1[_0x23b8('0x4d')](_0x566705);}})['then'](function(_0x42a1c1){if(_0x42a1c1){_0x2a38cf=_0x42a1c1[_0x23b8('0x32')];if(!_0x68423c['query'][_0x23b8('0x4b')](_0x23b8('0x33'))){_0x566705[_0x23b8('0x1c')]=qs[_0x23b8('0x1c')](_0x68423c[_0x23b8('0x2c')][_0x23b8('0x1c')]);_0x566705['offset']=qs['offset'](_0x68423c['query'][_0x23b8('0x1e')]);}return _0x2b03b1[_0x23b8('0x4d')](_0x566705);}})['then'](function(_0x590cd6){if(_0x590cd6){return _0x590cd6?{'count':_0x2a38cf,'rows':_0x590cd6}:null;}})['then'](respondWithResult(_0x3781fc,null))[_0x23b8('0x4c')](handleError(_0x3781fc,null));};exports[_0x23b8('0x4f')]=function(_0x476312,_0x3147ee,_0x531199){var _0x59ad04={};var _0xdba2c9={};var _0x33f347;var _0xc8dc0f;return db[_0x23b8('0x29')][_0x23b8('0x49')]({'where':{'id':_0x476312[_0x23b8('0x41')]['id']}})[_0x23b8('0x23')](handleEntityNotFound(_0x3147ee,null))[_0x23b8('0x23')](function(_0x3474f7){if(_0x3474f7){_0x33f347=_0x3474f7;_0xdba2c9[_0x23b8('0x2f')]=_['keys'](db[_0x23b8('0x4e')][_0x23b8('0x42')]);_0xdba2c9['query']=_[_0x23b8('0x2d')](_0x476312[_0x23b8('0x2c')]);_0xdba2c9[_0x23b8('0x43')]=_[_0x23b8('0x2e')](_0xdba2c9['model'],_0xdba2c9[_0x23b8('0x2c')]);_0x59ad04[_0x23b8('0x30')]=_[_0x23b8('0x2e')](_0xdba2c9[_0x23b8('0x2f')],qs['fields'](_0x476312[_0x23b8('0x2c')]['fields']));_0x59ad04[_0x23b8('0x30')]=_0x59ad04[_0x23b8('0x30')][_0x23b8('0x32')]?_0x59ad04['attributes']:_0xdba2c9[_0x23b8('0x2f')];_0x59ad04[_0x23b8('0x34')]=qs[_0x23b8('0x4a')](_0x476312[_0x23b8('0x2c')][_0x23b8('0x4a')]);_0x59ad04[_0x23b8('0x37')]=qs[_0x23b8('0x43')](_[_0x23b8('0x35')](_0x476312[_0x23b8('0x2c')],_0xdba2c9[_0x23b8('0x43')]));if(_0x476312[_0x23b8('0x2c')]['filter']){_0x59ad04['where']=_[_0x23b8('0x38')](_0x59ad04['where'],{'$or':_[_0x23b8('0x39')](_0x59ad04['attributes'],function(_0x12c394){var _0x270ae6={};_0x270ae6[_0x12c394]={'$like':'%'+_0x476312[_0x23b8('0x2c')]['filter']+'%'};return _0x270ae6;})});}_0x59ad04=_[_0x23b8('0x38')]({},_0x59ad04,_0x476312[_0x23b8('0x3b')]);return _0x33f347[_0x23b8('0x4f')](_0x59ad04);}})[_0x23b8('0x23')](function(_0x39102f){if(_0x39102f){_0xc8dc0f=_0x39102f[_0x23b8('0x32')];if(!_0x476312[_0x23b8('0x2c')][_0x23b8('0x4b')]('nolimit')){_0x59ad04[_0x23b8('0x1c')]=qs['limit'](_0x476312[_0x23b8('0x2c')][_0x23b8('0x1c')]);_0x59ad04[_0x23b8('0x1e')]=qs[_0x23b8('0x1e')](_0x476312[_0x23b8('0x2c')]['offset']);}return _0x33f347[_0x23b8('0x4f')](_0x59ad04);}})[_0x23b8('0x23')](function(_0x36e5b3){if(_0x36e5b3){return _0x36e5b3?{'count':_0xc8dc0f,'rows':_0x36e5b3}:null;}})[_0x23b8('0x23')](respondWithResult(_0x3147ee,null))['catch'](handleError(_0x3147ee,null));};exports[_0x23b8('0x50')]=function(_0x36f85b,_0x12489b,_0x3debd9){var _0x402b79={};var _0x3b2b21={};var _0x151d37;var _0x4ac0ed;return db['ZendeskConfiguration'][_0x23b8('0x49')]({'where':{'id':_0x36f85b[_0x23b8('0x41')]['id']}})['then'](handleEntityNotFound(_0x12489b,null))[_0x23b8('0x23')](function(_0x54ae90){if(_0x54ae90){_0x151d37=_0x54ae90;_0x3b2b21[_0x23b8('0x2f')]=_[_0x23b8('0x2d')](db['Tag'][_0x23b8('0x42')]);_0x3b2b21[_0x23b8('0x2c')]=_[_0x23b8('0x2d')](_0x36f85b[_0x23b8('0x2c')]);_0x3b2b21['filters']=_['intersection'](_0x3b2b21[_0x23b8('0x2f')],_0x3b2b21[_0x23b8('0x2c')]);_0x402b79[_0x23b8('0x30')]=_[_0x23b8('0x2e')](_0x3b2b21[_0x23b8('0x2f')],qs['fields'](_0x36f85b[_0x23b8('0x2c')][_0x23b8('0x31')]));_0x402b79[_0x23b8('0x30')]=_0x402b79['attributes']['length']?_0x402b79[_0x23b8('0x30')]:_0x3b2b21[_0x23b8('0x2f')];_0x402b79[_0x23b8('0x34')]=qs[_0x23b8('0x4a')](_0x36f85b[_0x23b8('0x2c')][_0x23b8('0x4a')]);_0x402b79[_0x23b8('0x37')]=qs[_0x23b8('0x43')](_[_0x23b8('0x35')](_0x36f85b[_0x23b8('0x2c')],_0x3b2b21['filters']));if(_0x36f85b['query'][_0x23b8('0x36')]){_0x402b79[_0x23b8('0x37')]=_['merge'](_0x402b79[_0x23b8('0x37')],{'$or':_[_0x23b8('0x39')](_0x402b79['attributes'],function(_0x468840){var _0x35ab50={};_0x35ab50[_0x468840]={'$like':'%'+_0x36f85b[_0x23b8('0x2c')][_0x23b8('0x36')]+'%'};return _0x35ab50;})});}_0x402b79=_['merge']({},_0x402b79,_0x36f85b[_0x23b8('0x3b')]);return _0x151d37[_0x23b8('0x50')](_0x402b79);}})[_0x23b8('0x23')](function(_0x5c608d){if(_0x5c608d){_0x4ac0ed=_0x5c608d[_0x23b8('0x32')];if(!_0x36f85b[_0x23b8('0x2c')][_0x23b8('0x4b')](_0x23b8('0x33'))){_0x402b79[_0x23b8('0x1c')]=qs['limit'](_0x36f85b['query'][_0x23b8('0x1c')]);_0x402b79['offset']=qs['offset'](_0x36f85b['query'][_0x23b8('0x1e')]);}return _0x151d37[_0x23b8('0x50')](_0x402b79);}})[_0x23b8('0x23')](function(_0x461d47){if(_0x461d47){return _0x461d47?{'count':_0x4ac0ed,'rows':_0x461d47}:null;}})['then'](respondWithResult(_0x12489b,null))['catch'](handleError(_0x12489b,null));};exports[_0x23b8('0x51')]=function(_0x1a11f5,_0x4a5d9b,_0x37997b){if(_0x1a11f5['body']['id']){delete _0x1a11f5[_0x23b8('0x45')]['id'];}return db[_0x23b8('0x29')][_0x23b8('0x49')]({'where':{'id':_0x1a11f5[_0x23b8('0x41')]['id']}})[_0x23b8('0x23')](handleEntityNotFound(_0x4a5d9b,null))[_0x23b8('0x23')](function(_0xe16df1){if(_0xe16df1){return _0xe16df1[_0x23b8('0x51')](_0x1a11f5[_0x23b8('0x45')]['ids']||[]);}return null;})[_0x23b8('0x23')](respondWithResult(_0x4a5d9b,null))[_0x23b8('0x4c')](handleError(_0x4a5d9b,null));}; \ No newline at end of file +var _0x114b=['util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','error','stack','name','index','ZendeskConfiguration','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getFields','findOne','ZendeskField','length','options','getSubjects','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x114b,0x9f));var _0xb114=function(_0x22b297,_0x52df4b){_0x22b297=_0x22b297-0x0;var _0x2eff0e=_0x114b[_0x22b297];return _0x2eff0e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb114('0x0'));var zipdir=require(_0xb114('0x1'));var jsonpatch=require(_0xb114('0x2'));var rp=require(_0xb114('0x3'));var moment=require(_0xb114('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb114('0x5'));var path=require('path');var sox=require(_0xb114('0x6'));var csv=require('to-csv');var ejs=require(_0xb114('0x7'));var fs=require('fs');var fs_extra=require(_0xb114('0x8'));var _=require(_0xb114('0x9'));var squel=require(_0xb114('0xa'));var crypto=require('crypto');var jsforce=require(_0xb114('0xb'));var deskjs=require(_0xb114('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb114('0xd'));var Papa=require(_0xb114('0xe'));var Redis=require(_0xb114('0xf'));var authService=require(_0xb114('0x10'));var qs=require(_0xb114('0x11'));var as=require(_0xb114('0x12'));var hardwareService=require(_0xb114('0x13'));var logger=require('../../config/logger')(_0xb114('0x14'));var utils=require('../../config/utils');var config=require(_0xb114('0x15'));var licenseUtil=require(_0xb114('0x16'));var db=require(_0xb114('0x17'))['db'];function respondWithStatusCode(_0x9a1c71,_0x32dcaf){_0x32dcaf=_0x32dcaf||0xcc;return function(_0x39d3a5){if(_0x39d3a5){return _0x9a1c71[_0xb114('0x18')](_0x32dcaf);}return _0x9a1c71[_0xb114('0x19')](_0x32dcaf)[_0xb114('0x1a')]();};}function respondWithResult(_0x1e2df2,_0x5e92a3){_0x5e92a3=_0x5e92a3||0xc8;return function(_0x4c4874){if(_0x4c4874){return _0x1e2df2[_0xb114('0x19')](_0x5e92a3)[_0xb114('0x1b')](_0x4c4874);}};}function respondWithFilteredResult(_0x1b1bdd,_0x18d7fb){return function(_0x29c77d){if(_0x29c77d){var _0x110ae1=typeof _0x18d7fb['offset']===_0xb114('0x1c')&&typeof _0x18d7fb[_0xb114('0x1d')]===_0xb114('0x1c');var _0xfb6dd7=_0x29c77d[_0xb114('0x1e')];var _0x3703b1=_0x110ae1?0x0:_0x18d7fb[_0xb114('0x1f')];var _0x5aa11b=_0x110ae1?_0x29c77d[_0xb114('0x1e')]:_0x18d7fb[_0xb114('0x1f')]+_0x18d7fb[_0xb114('0x1d')];var _0x43c5eb;if(_0x5aa11b>=_0xfb6dd7){_0x5aa11b=_0xfb6dd7;_0x43c5eb=0xc8;}else{_0x43c5eb=0xce;}_0x1b1bdd['status'](_0x43c5eb);return _0x1b1bdd[_0xb114('0x20')](_0xb114('0x21'),_0x3703b1+'-'+_0x5aa11b+'/'+_0xfb6dd7)[_0xb114('0x1b')](_0x29c77d);}return null;};}function patchUpdates(_0x52eccc){return function(_0x522d98){try{jsonpatch['apply'](_0x522d98,_0x52eccc,!![]);}catch(_0x1f3108){return BPromise[_0xb114('0x22')](_0x1f3108);}return _0x522d98['save']();};}function saveUpdates(_0x17c915,_0x4ad553){return function(_0xea4b9c){if(_0xea4b9c){return _0xea4b9c[_0xb114('0x23')](_0x17c915)['then'](function(_0x3dd437){return _0x3dd437;});}return null;};}function removeEntity(_0x4617ac,_0x28e4e2){return function(_0x39adbc){if(_0x39adbc){return _0x39adbc['destroy']()[_0xb114('0x24')](function(){_0x4617ac['status'](0xcc)[_0xb114('0x1a')]();});}};}function handleEntityNotFound(_0x36fb7b,_0x25d21e){return function(_0x276989){if(!_0x276989){_0x36fb7b['sendStatus'](0x194);}return _0x276989;};}function handleError(_0x4d07db,_0xa1cda6){_0xa1cda6=_0xa1cda6||0x1f4;return function(_0x4ef74b){logger[_0xb114('0x25')](_0x4ef74b[_0xb114('0x26')]);if(_0x4ef74b[_0xb114('0x27')]){delete _0x4ef74b[_0xb114('0x27')];}_0x4d07db[_0xb114('0x19')](_0xa1cda6)['send'](_0x4ef74b);};}exports[_0xb114('0x28')]=function(_0x314e75,_0x1e970f){var _0x3618ea={},_0x4d6456={},_0x4288a2={'count':0x0,'rows':[]};var _0x8d8ab3=_['map'](db[_0xb114('0x29')][_0xb114('0x2a')],function(_0x51d1e2){return{'name':_0x51d1e2['fieldName'],'type':_0x51d1e2[_0xb114('0x2b')][_0xb114('0x2c')]};});_0x4d6456[_0xb114('0x2d')]=_[_0xb114('0x2e')](_0x8d8ab3,_0xb114('0x27'));_0x4d6456[_0xb114('0x2f')]=_[_0xb114('0x30')](_0x314e75['query']);_0x4d6456[_0xb114('0x31')]=_['intersection'](_0x4d6456[_0xb114('0x2d')],_0x4d6456['query']);_0x3618ea[_0xb114('0x32')]=_[_0xb114('0x33')](_0x4d6456[_0xb114('0x2d')],qs[_0xb114('0x34')](_0x314e75[_0xb114('0x2f')][_0xb114('0x34')]));_0x3618ea[_0xb114('0x32')]=_0x3618ea[_0xb114('0x32')]['length']?_0x3618ea[_0xb114('0x32')]:_0x4d6456['model'];if(!_0x314e75['query'][_0xb114('0x35')](_0xb114('0x36'))){_0x3618ea[_0xb114('0x1d')]=qs[_0xb114('0x1d')](_0x314e75[_0xb114('0x2f')][_0xb114('0x1d')]);_0x3618ea[_0xb114('0x1f')]=qs[_0xb114('0x1f')](_0x314e75[_0xb114('0x2f')]['offset']);}_0x3618ea[_0xb114('0x37')]=qs[_0xb114('0x38')](_0x314e75[_0xb114('0x2f')][_0xb114('0x38')]);_0x3618ea[_0xb114('0x39')]=qs[_0xb114('0x31')](_[_0xb114('0x3a')](_0x314e75[_0xb114('0x2f')],_0x4d6456[_0xb114('0x31')]),_0x8d8ab3);if(_0x314e75[_0xb114('0x2f')][_0xb114('0x3b')]){_0x3618ea['where']=_['merge'](_0x3618ea['where'],{'$or':_[_0xb114('0x2e')](_0x8d8ab3,function(_0x410dd6){if(_0x410dd6[_0xb114('0x2b')]!=='VIRTUAL'){var _0x9f1b33={};_0x9f1b33[_0x410dd6[_0xb114('0x27')]]={'$like':'%'+_0x314e75[_0xb114('0x2f')][_0xb114('0x3b')]+'%'};return _0x9f1b33;}})});}_0x3618ea=_[_0xb114('0x3c')]({},_0x3618ea,_0x314e75['options']);var _0x16e9d7={'where':_0x3618ea[_0xb114('0x39')]};return db[_0xb114('0x29')]['count'](_0x16e9d7)[_0xb114('0x24')](function(_0x5baca7){_0x4288a2[_0xb114('0x1e')]=_0x5baca7;if(_0x314e75[_0xb114('0x2f')][_0xb114('0x3d')]){_0x3618ea[_0xb114('0x3e')]=[{'all':!![]}];}return db[_0xb114('0x29')][_0xb114('0x3f')](_0x3618ea);})[_0xb114('0x24')](function(_0x422043){_0x4288a2[_0xb114('0x40')]=_0x422043;return _0x4288a2;})[_0xb114('0x24')](respondWithFilteredResult(_0x1e970f,_0x3618ea))[_0xb114('0x41')](handleError(_0x1e970f,null));};exports[_0xb114('0x42')]=function(_0x2a1cdc,_0x27b60f){var _0xb2e0dd={'raw':![],'where':{'id':_0x2a1cdc[_0xb114('0x43')]['id']}},_0x449b40={};_0x449b40['model']=_[_0xb114('0x30')](db[_0xb114('0x29')][_0xb114('0x2a')]);_0x449b40[_0xb114('0x2f')]=_[_0xb114('0x30')](_0x2a1cdc[_0xb114('0x2f')]);_0x449b40[_0xb114('0x31')]=_['intersection'](_0x449b40[_0xb114('0x2d')],_0x449b40[_0xb114('0x2f')]);_0xb2e0dd[_0xb114('0x32')]=_[_0xb114('0x33')](_0x449b40[_0xb114('0x2d')],qs[_0xb114('0x34')](_0x2a1cdc[_0xb114('0x2f')]['fields']));_0xb2e0dd[_0xb114('0x32')]=_0xb2e0dd[_0xb114('0x32')]['length']?_0xb2e0dd['attributes']:_0x449b40[_0xb114('0x2d')];if(_0x2a1cdc['query']['includeAll']){_0xb2e0dd['include']=[{'all':!![]}];}_0xb2e0dd=_[_0xb114('0x3c')]({},_0xb2e0dd,_0x2a1cdc['options']);return db[_0xb114('0x29')][_0xb114('0x44')](_0xb2e0dd)[_0xb114('0x24')](handleEntityNotFound(_0x27b60f,null))[_0xb114('0x24')](respondWithResult(_0x27b60f,null))['catch'](handleError(_0x27b60f,null));};exports[_0xb114('0x45')]=function(_0x4ad2a8,_0xcaff02){return db[_0xb114('0x29')]['create'](_0x4ad2a8[_0xb114('0x46')],{})[_0xb114('0x24')](respondWithResult(_0xcaff02,0xc9))[_0xb114('0x41')](handleError(_0xcaff02,null));};exports['update']=function(_0x3b4317,_0x302bbc){if(_0x3b4317[_0xb114('0x46')]['id']){delete _0x3b4317[_0xb114('0x46')]['id'];}return db[_0xb114('0x29')][_0xb114('0x44')]({'where':{'id':_0x3b4317['params']['id']}})[_0xb114('0x24')](handleEntityNotFound(_0x302bbc,null))[_0xb114('0x24')](saveUpdates(_0x3b4317[_0xb114('0x46')],null))[_0xb114('0x24')](respondWithResult(_0x302bbc,null))['catch'](handleError(_0x302bbc,null));};exports[_0xb114('0x47')]=function(_0x3ed016,_0x10bc7e){return db[_0xb114('0x29')][_0xb114('0x44')]({'where':{'id':_0x3ed016[_0xb114('0x43')]['id']}})[_0xb114('0x24')](handleEntityNotFound(_0x10bc7e,null))[_0xb114('0x24')](removeEntity(_0x10bc7e,null))[_0xb114('0x41')](handleError(_0x10bc7e,null));};exports[_0xb114('0x48')]=function(_0x118e85,_0x2fd82d,_0x3d6204){var _0x1605b1={};var _0x504aff={};var _0x3d4029;var _0x426d38;return db['ZendeskConfiguration'][_0xb114('0x49')]({'where':{'id':_0x118e85['params']['id']}})['then'](handleEntityNotFound(_0x2fd82d,null))[_0xb114('0x24')](function(_0x59f752){if(_0x59f752){_0x3d4029=_0x59f752;_0x504aff[_0xb114('0x2d')]=_['keys'](db[_0xb114('0x4a')][_0xb114('0x2a')]);_0x504aff[_0xb114('0x2f')]=_[_0xb114('0x30')](_0x118e85[_0xb114('0x2f')]);_0x504aff['filters']=_[_0xb114('0x33')](_0x504aff[_0xb114('0x2d')],_0x504aff['query']);_0x1605b1[_0xb114('0x32')]=_[_0xb114('0x33')](_0x504aff[_0xb114('0x2d')],qs[_0xb114('0x34')](_0x118e85['query'][_0xb114('0x34')]));_0x1605b1[_0xb114('0x32')]=_0x1605b1[_0xb114('0x32')][_0xb114('0x4b')]?_0x1605b1[_0xb114('0x32')]:_0x504aff['model'];_0x1605b1[_0xb114('0x37')]=qs['sort'](_0x118e85[_0xb114('0x2f')]['sort']);_0x1605b1[_0xb114('0x39')]=qs[_0xb114('0x31')](_[_0xb114('0x3a')](_0x118e85[_0xb114('0x2f')],_0x504aff[_0xb114('0x31')]));if(_0x118e85[_0xb114('0x2f')][_0xb114('0x3b')]){_0x1605b1['where']=_[_0xb114('0x3c')](_0x1605b1[_0xb114('0x39')],{'$or':_['map'](_0x1605b1[_0xb114('0x32')],function(_0x1f65f9){var _0x357eec={};_0x357eec[_0x1f65f9]={'$like':'%'+_0x118e85[_0xb114('0x2f')][_0xb114('0x3b')]+'%'};return _0x357eec;})});}_0x1605b1=_['merge']({},_0x1605b1,_0x118e85['options']);return _0x3d4029['getFields'](_0x1605b1);}})['then'](function(_0x3d9d38){if(_0x3d9d38){_0x426d38=_0x3d9d38[_0xb114('0x4b')];if(!_0x118e85[_0xb114('0x2f')][_0xb114('0x35')](_0xb114('0x36'))){_0x1605b1[_0xb114('0x1d')]=qs[_0xb114('0x1d')](_0x118e85['query']['limit']);_0x1605b1[_0xb114('0x1f')]=qs[_0xb114('0x1f')](_0x118e85[_0xb114('0x2f')][_0xb114('0x1f')]);}return _0x3d4029[_0xb114('0x48')](_0x1605b1);}})[_0xb114('0x24')](function(_0x370414){if(_0x370414){return _0x370414?{'count':_0x426d38,'rows':_0x370414}:null;}})[_0xb114('0x24')](respondWithResult(_0x2fd82d,null))[_0xb114('0x41')](handleError(_0x2fd82d,null));};exports['getSubjects']=function(_0x13397f,_0x3d9a1a,_0x4541ac){var _0x582bc5={};var _0x42d6cb={};var _0xeccf32;var _0x5a5dca;return db[_0xb114('0x29')][_0xb114('0x49')]({'where':{'id':_0x13397f[_0xb114('0x43')]['id']}})[_0xb114('0x24')](handleEntityNotFound(_0x3d9a1a,null))['then'](function(_0x39aea4){if(_0x39aea4){_0xeccf32=_0x39aea4;_0x42d6cb[_0xb114('0x2d')]=_[_0xb114('0x30')](db[_0xb114('0x4a')][_0xb114('0x2a')]);_0x42d6cb['query']=_[_0xb114('0x30')](_0x13397f[_0xb114('0x2f')]);_0x42d6cb[_0xb114('0x31')]=_[_0xb114('0x33')](_0x42d6cb[_0xb114('0x2d')],_0x42d6cb[_0xb114('0x2f')]);_0x582bc5[_0xb114('0x32')]=_[_0xb114('0x33')](_0x42d6cb[_0xb114('0x2d')],qs[_0xb114('0x34')](_0x13397f[_0xb114('0x2f')][_0xb114('0x34')]));_0x582bc5['attributes']=_0x582bc5[_0xb114('0x32')][_0xb114('0x4b')]?_0x582bc5[_0xb114('0x32')]:_0x42d6cb[_0xb114('0x2d')];_0x582bc5[_0xb114('0x37')]=qs[_0xb114('0x38')](_0x13397f[_0xb114('0x2f')][_0xb114('0x38')]);_0x582bc5['where']=qs['filters'](_['pick'](_0x13397f[_0xb114('0x2f')],_0x42d6cb['filters']));if(_0x13397f['query'][_0xb114('0x3b')]){_0x582bc5[_0xb114('0x39')]=_[_0xb114('0x3c')](_0x582bc5[_0xb114('0x39')],{'$or':_[_0xb114('0x2e')](_0x582bc5[_0xb114('0x32')],function(_0x15870d){var _0x23d461={};_0x23d461[_0x15870d]={'$like':'%'+_0x13397f[_0xb114('0x2f')][_0xb114('0x3b')]+'%'};return _0x23d461;})});}_0x582bc5=_[_0xb114('0x3c')]({},_0x582bc5,_0x13397f[_0xb114('0x4c')]);return _0xeccf32[_0xb114('0x4d')](_0x582bc5);}})[_0xb114('0x24')](function(_0x27b405){if(_0x27b405){_0x5a5dca=_0x27b405[_0xb114('0x4b')];if(!_0x13397f['query'][_0xb114('0x35')](_0xb114('0x36'))){_0x582bc5[_0xb114('0x1d')]=qs[_0xb114('0x1d')](_0x13397f['query'][_0xb114('0x1d')]);_0x582bc5['offset']=qs[_0xb114('0x1f')](_0x13397f[_0xb114('0x2f')][_0xb114('0x1f')]);}return _0xeccf32[_0xb114('0x4d')](_0x582bc5);}})[_0xb114('0x24')](function(_0x3529e5){if(_0x3529e5){return _0x3529e5?{'count':_0x5a5dca,'rows':_0x3529e5}:null;}})['then'](respondWithResult(_0x3d9a1a,null))[_0xb114('0x41')](handleError(_0x3d9a1a,null));};exports['getDescriptions']=function(_0x245e5c,_0x29f79b,_0x23f889){var _0x58c042={};var _0x1a44a6={};var _0x44908b;var _0x10aaf2;return db['ZendeskConfiguration'][_0xb114('0x49')]({'where':{'id':_0x245e5c[_0xb114('0x43')]['id']}})[_0xb114('0x24')](handleEntityNotFound(_0x29f79b,null))[_0xb114('0x24')](function(_0x2651bc){if(_0x2651bc){_0x44908b=_0x2651bc;_0x1a44a6['model']=_[_0xb114('0x30')](db[_0xb114('0x4a')][_0xb114('0x2a')]);_0x1a44a6[_0xb114('0x2f')]=_[_0xb114('0x30')](_0x245e5c[_0xb114('0x2f')]);_0x1a44a6['filters']=_[_0xb114('0x33')](_0x1a44a6[_0xb114('0x2d')],_0x1a44a6['query']);_0x58c042[_0xb114('0x32')]=_['intersection'](_0x1a44a6['model'],qs[_0xb114('0x34')](_0x245e5c['query'][_0xb114('0x34')]));_0x58c042['attributes']=_0x58c042[_0xb114('0x32')]['length']?_0x58c042[_0xb114('0x32')]:_0x1a44a6[_0xb114('0x2d')];_0x58c042[_0xb114('0x37')]=qs['sort'](_0x245e5c[_0xb114('0x2f')][_0xb114('0x38')]);_0x58c042[_0xb114('0x39')]=qs[_0xb114('0x31')](_[_0xb114('0x3a')](_0x245e5c[_0xb114('0x2f')],_0x1a44a6['filters']));if(_0x245e5c[_0xb114('0x2f')][_0xb114('0x3b')]){_0x58c042[_0xb114('0x39')]=_[_0xb114('0x3c')](_0x58c042[_0xb114('0x39')],{'$or':_['map'](_0x58c042[_0xb114('0x32')],function(_0x5601af){var _0x281a1f={};_0x281a1f[_0x5601af]={'$like':'%'+_0x245e5c[_0xb114('0x2f')]['filter']+'%'};return _0x281a1f;})});}_0x58c042=_[_0xb114('0x3c')]({},_0x58c042,_0x245e5c['options']);return _0x44908b[_0xb114('0x4e')](_0x58c042);}})[_0xb114('0x24')](function(_0x1fee23){if(_0x1fee23){_0x10aaf2=_0x1fee23[_0xb114('0x4b')];if(!_0x245e5c[_0xb114('0x2f')]['hasOwnProperty']('nolimit')){_0x58c042[_0xb114('0x1d')]=qs['limit'](_0x245e5c[_0xb114('0x2f')][_0xb114('0x1d')]);_0x58c042[_0xb114('0x1f')]=qs[_0xb114('0x1f')](_0x245e5c[_0xb114('0x2f')]['offset']);}return _0x44908b['getDescriptions'](_0x58c042);}})[_0xb114('0x24')](function(_0x16d3d8){if(_0x16d3d8){return _0x16d3d8?{'count':_0x10aaf2,'rows':_0x16d3d8}:null;}})[_0xb114('0x24')](respondWithResult(_0x29f79b,null))[_0xb114('0x41')](handleError(_0x29f79b,null));};exports[_0xb114('0x4f')]=function(_0x5ee98e,_0x4c0345,_0x2c9588){var _0x27efd4={};var _0x562b62={};var _0x336678;var _0x3fabf8;return db['ZendeskConfiguration'][_0xb114('0x49')]({'where':{'id':_0x5ee98e[_0xb114('0x43')]['id']}})[_0xb114('0x24')](handleEntityNotFound(_0x4c0345,null))[_0xb114('0x24')](function(_0x1e8c49){if(_0x1e8c49){_0x336678=_0x1e8c49;_0x562b62[_0xb114('0x2d')]=_[_0xb114('0x30')](db[_0xb114('0x50')][_0xb114('0x2a')]);_0x562b62[_0xb114('0x2f')]=_['keys'](_0x5ee98e[_0xb114('0x2f')]);_0x562b62[_0xb114('0x31')]=_[_0xb114('0x33')](_0x562b62[_0xb114('0x2d')],_0x562b62[_0xb114('0x2f')]);_0x27efd4[_0xb114('0x32')]=_['intersection'](_0x562b62[_0xb114('0x2d')],qs[_0xb114('0x34')](_0x5ee98e[_0xb114('0x2f')]['fields']));_0x27efd4[_0xb114('0x32')]=_0x27efd4[_0xb114('0x32')][_0xb114('0x4b')]?_0x27efd4['attributes']:_0x562b62[_0xb114('0x2d')];_0x27efd4[_0xb114('0x37')]=qs[_0xb114('0x38')](_0x5ee98e[_0xb114('0x2f')]['sort']);_0x27efd4[_0xb114('0x39')]=qs[_0xb114('0x31')](_[_0xb114('0x3a')](_0x5ee98e[_0xb114('0x2f')],_0x562b62[_0xb114('0x31')]));if(_0x5ee98e[_0xb114('0x2f')][_0xb114('0x3b')]){_0x27efd4[_0xb114('0x39')]=_['merge'](_0x27efd4[_0xb114('0x39')],{'$or':_[_0xb114('0x2e')](_0x27efd4['attributes'],function(_0x2d7108){var _0x329d32={};_0x329d32[_0x2d7108]={'$like':'%'+_0x5ee98e[_0xb114('0x2f')]['filter']+'%'};return _0x329d32;})});}_0x27efd4=_[_0xb114('0x3c')]({},_0x27efd4,_0x5ee98e[_0xb114('0x4c')]);return _0x336678[_0xb114('0x4f')](_0x27efd4);}})[_0xb114('0x24')](function(_0x9b2f51){if(_0x9b2f51){_0x3fabf8=_0x9b2f51['length'];if(!_0x5ee98e['query'][_0xb114('0x35')](_0xb114('0x36'))){_0x27efd4[_0xb114('0x1d')]=qs['limit'](_0x5ee98e[_0xb114('0x2f')][_0xb114('0x1d')]);_0x27efd4[_0xb114('0x1f')]=qs[_0xb114('0x1f')](_0x5ee98e[_0xb114('0x2f')][_0xb114('0x1f')]);}return _0x336678[_0xb114('0x4f')](_0x27efd4);}})['then'](function(_0x1ebe7c){if(_0x1ebe7c){return _0x1ebe7c?{'count':_0x3fabf8,'rows':_0x1ebe7c}:null;}})[_0xb114('0x24')](respondWithResult(_0x4c0345,null))[_0xb114('0x41')](handleError(_0x4c0345,null));};exports[_0xb114('0x51')]=function(_0x10cdad,_0x5cc74b,_0x4ce5e2){if(_0x10cdad['body']['id']){delete _0x10cdad[_0xb114('0x46')]['id'];}return db[_0xb114('0x29')]['findOne']({'where':{'id':_0x10cdad[_0xb114('0x43')]['id']}})['then'](handleEntityNotFound(_0x5cc74b,null))[_0xb114('0x24')](function(_0x1c1c7e){if(_0x1c1c7e){return _0x1c1c7e['setTags'](_0x10cdad[_0xb114('0x46')]['ids']||[]);}return null;})[_0xb114('0x24')](respondWithResult(_0x5cc74b,null))['catch'](handleError(_0x5cc74b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index bd79166..e4295e0 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 _0xd4a2=['ZendeskConfiguration','int_zendesk_configurations','lodash','api','bluebird','path','../../config/environment','./intZendeskConfiguration.attributes','exports'];(function(_0x790a1a,_0x4b2823){var _0x27d980=function(_0x5622d0){while(--_0x5622d0){_0x790a1a['push'](_0x790a1a['shift']());}};_0x27d980(++_0x4b2823);}(_0xd4a2,0x173));var _0x2d4a=function(_0x4e405a,_0x475541){_0x4e405a=_0x4e405a-0x0;var _0x5b67c2=_0xd4a2[_0x4e405a];return _0x5b67c2;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2d4a('0x1'));var moment=require('moment');var BPromise=require(_0x2d4a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d4a('0x3'));var rimraf=require('rimraf');var config=require(_0x2d4a('0x4'));var attributes=require(_0x2d4a('0x5'));module[_0x2d4a('0x6')]=function(_0x3a88e2,_0x1ca10b){return _0x3a88e2['define'](_0x2d4a('0x7'),attributes,{'tableName':_0x2d4a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9be=['path','rimraf','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x385f75,_0x7cf37a){var _0x199e11=function(_0x3db569){while(--_0x3db569){_0x385f75['push'](_0x385f75['shift']());}};_0x199e11(++_0x7cf37a);}(_0xb9be,0xc5));var _0xeb9b=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0xb9be[_0xc77819];return _0x1c9434;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var logger=require(_0xeb9b('0x2'))(_0xeb9b('0x3'));var moment=require(_0xeb9b('0x4'));var BPromise=require(_0xeb9b('0x5'));var rp=require(_0xeb9b('0x6'));var fs=require('fs');var path=require(_0xeb9b('0x7'));var rimraf=require(_0xeb9b('0x8'));var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module[_0xeb9b('0x9')]=function(_0x181810,_0x2529cb){return _0x181810['define'](_0xeb9b('0xa'),attributes,{'tableName':_0xeb9b('0xb'),'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 823b737..04d914b 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 _0xf5b8=['http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x352600,_0x287c21){var _0x3c9c52=function(_0x5f3b63){while(--_0x5f3b63){_0x352600['push'](_0x352600['shift']());}};_0x3c9c52(++_0x287c21);}(_0xf5b8,0xe5));var _0x8f5b=function(_0x3f33d5,_0x3ef528){_0x3f33d5=_0x3f33d5-0x0;var _0x37577f=_0xf5b8[_0x3f33d5];return _0x37577f;};'use strict';var _=require(_0x8f5b('0x0'));var util=require('util');var moment=require(_0x8f5b('0x1'));var BPromise=require(_0x8f5b('0x2'));var rs=require(_0x8f5b('0x3'));var fs=require('fs');var Redis=require(_0x8f5b('0x4'));var db=require(_0x8f5b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f5b('0x6'))(_0x8f5b('0x7'));var config=require(_0x8f5b('0x8'));var jayson=require(_0x8f5b('0x9'));var client=jayson[_0x8f5b('0xa')][_0x8f5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c3ecc,_0x5a8390,_0x457350){return new BPromise(function(_0x2a3465,_0x1ccedb){return client[_0x8f5b('0xc')](_0x3c3ecc,_0x457350)[_0x8f5b('0xd')](function(_0x30f368){logger[_0x8f5b('0xe')](_0x8f5b('0xf'),_0x5a8390,'request\x20sent');logger[_0x8f5b('0x10')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5a8390,_0x8f5b('0x11'),JSON[_0x8f5b('0x12')](_0x30f368));if(_0x30f368[_0x8f5b('0x13')]){if(_0x30f368[_0x8f5b('0x13')][_0x8f5b('0x14')]===0x1f4){logger['error'](_0x8f5b('0xf'),_0x5a8390,_0x30f368[_0x8f5b('0x13')][_0x8f5b('0x15')]);return _0x1ccedb(_0x30f368[_0x8f5b('0x13')][_0x8f5b('0x15')]);}logger[_0x8f5b('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5a8390,_0x30f368['error'][_0x8f5b('0x15')]);return _0x2a3465(_0x30f368[_0x8f5b('0x13')][_0x8f5b('0x15')]);}else{logger[_0x8f5b('0xe')](_0x8f5b('0xf'),_0x5a8390,_0x8f5b('0x11'));_0x2a3465(_0x30f368[_0x8f5b('0x16')][_0x8f5b('0x15')]);}})[_0x8f5b('0x17')](function(_0x59bc24){logger[_0x8f5b('0x13')](_0x8f5b('0xf'),_0x5a8390,_0x59bc24);_0x1ccedb(_0x59bc24);});});} \ No newline at end of file +var _0x6704=['message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6704,0x1ca));var _0x4670=function(_0x4d3d46,_0x35282a){_0x4d3d46=_0x4d3d46-0x0;var _0x4b76d4=_0x6704[_0x4d3d46];return _0x4b76d4;};'use strict';var _=require(_0x4670('0x0'));var util=require('util');var moment=require(_0x4670('0x1'));var BPromise=require(_0x4670('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4670('0x3'));var db=require(_0x4670('0x4'))['db'];var utils=require(_0x4670('0x5'));var logger=require(_0x4670('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4670('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34518e,_0x1ff43f,_0x33929e){return new BPromise(function(_0x4db5f9,_0x55e4ed){return client[_0x4670('0x8')](_0x34518e,_0x33929e)['then'](function(_0x361ff0){logger[_0x4670('0x9')](_0x4670('0xa'),_0x1ff43f,'request\x20sent');logger[_0x4670('0xb')](_0x4670('0xc'),_0x1ff43f,_0x4670('0xd'),JSON[_0x4670('0xe')](_0x361ff0));if(_0x361ff0['error']){if(_0x361ff0[_0x4670('0xf')][_0x4670('0x10')]===0x1f4){logger[_0x4670('0xf')](_0x4670('0xa'),_0x1ff43f,_0x361ff0['error'][_0x4670('0x11')]);return _0x55e4ed(_0x361ff0['error']['message']);}logger[_0x4670('0xf')](_0x4670('0xa'),_0x1ff43f,_0x361ff0['error']['message']);return _0x4db5f9(_0x361ff0[_0x4670('0xf')]['message']);}else{logger[_0x4670('0x9')](_0x4670('0xa'),_0x1ff43f,'request\x20sent');_0x4db5f9(_0x361ff0[_0x4670('0x12')][_0x4670('0x11')]);}})['catch'](function(_0x1c27f6){logger[_0x4670('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1ff43f,_0x1c27f6);_0x55e4ed(_0x1c27f6);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index e3d57e6..e85ace4 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 _0xffb0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','destroy','exports','multer','path'];(function(_0x37ab2f,_0x55b550){var _0x3353fb=function(_0x437a4e){while(--_0x437a4e){_0x37ab2f['push'](_0x37ab2f['shift']());}};_0x3353fb(++_0x55b550);}(_0xffb0,0xfa));var _0x0ffb=function(_0x46c5b7,_0xeef1a8){_0x46c5b7=_0x46c5b7-0x0;var _0x4cf44d=_0xffb0[_0x46c5b7];return _0x4cf44d;};'use strict';var multer=require(_0x0ffb('0x0'));var util=require('util');var path=require(_0x0ffb('0x1'));var timeout=require(_0x0ffb('0x2'));var express=require(_0x0ffb('0x3'));var router=express[_0x0ffb('0x4')]();var fs_extra=require(_0x0ffb('0x5'));var auth=require(_0x0ffb('0x6'));var interaction=require(_0x0ffb('0x7'));var config=require(_0x0ffb('0x8'));var controller=require(_0x0ffb('0x9'));router['get']('/',auth[_0x0ffb('0xa')](),controller[_0x0ffb('0xb')]);router[_0x0ffb('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x0ffb('0xd')]);router[_0x0ffb('0xe')]('/',auth[_0x0ffb('0xa')](),controller[_0x0ffb('0xf')]);router[_0x0ffb('0x10')](_0x0ffb('0x11'),auth[_0x0ffb('0xa')](),controller[_0x0ffb('0x12')]);router['delete'](_0x0ffb('0x11'),auth['isAuthenticated'](),controller[_0x0ffb('0x13')]);module[_0x0ffb('0x14')]=router; \ No newline at end of file +var _0x268e=['../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x424112,_0x49b356){var _0x28b81b=function(_0x129403){while(--_0x129403){_0x424112['push'](_0x424112['shift']());}};_0x28b81b(++_0x49b356);}(_0x268e,0x109));var _0xe268=function(_0x4534f9,_0x42ba84){_0x4534f9=_0x4534f9-0x0;var _0x209966=_0x268e[_0x4534f9];return _0x209966;};'use strict';var multer=require(_0xe268('0x0'));var util=require(_0xe268('0x1'));var path=require('path');var timeout=require(_0xe268('0x2'));var express=require(_0xe268('0x3'));var router=express[_0xe268('0x4')]();var fs_extra=require(_0xe268('0x5'));var auth=require(_0xe268('0x6'));var interaction=require(_0xe268('0x7'));var config=require(_0xe268('0x8'));var controller=require(_0xe268('0x9'));router[_0xe268('0xa')]('/',auth[_0xe268('0xb')](),controller['index']);router[_0xe268('0xa')](_0xe268('0xc'),auth['isAuthenticated'](),controller[_0xe268('0xd')]);router[_0xe268('0xe')]('/',auth[_0xe268('0xb')](),controller[_0xe268('0xf')]);router[_0xe268('0x10')]('/:id',auth[_0xe268('0xb')](),controller[_0xe268('0x11')]);router[_0xe268('0x12')](_0xe268('0xc'),auth[_0xe268('0xb')](),controller[_0xe268('0x13')]);module[_0xe268('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 938f5ae..93f4de1 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 _0x5f6c=['picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x15943c,_0x3ed9ab){var _0x14c656=function(_0x17d244){while(--_0x17d244){_0x15943c['push'](_0x15943c['shift']());}};_0x14c656(++_0x3ed9ab);}(_0x5f6c,0x158));var _0xc5f6=function(_0x4f3584,_0x2bf6b8){_0x4f3584=_0x4f3584-0x0;var _0x259c64=_0x5f6c[_0x4f3584];return _0x259c64;};'use strict';var Sequelize=require(_0xc5f6('0x0'));module[_0xc5f6('0x1')]={'type':{'type':Sequelize[_0xc5f6('0x2')](_0xc5f6('0x3'),'variable',_0xc5f6('0x4'),_0xc5f6('0x5'),_0xc5f6('0x6')),'defaultValue':_0xc5f6('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc5f6('0x7')]},'keyType':{'type':Sequelize[_0xc5f6('0x2')](_0xc5f6('0x3'),_0xc5f6('0x8'),_0xc5f6('0x4'))},'keyContent':{'type':Sequelize[_0xc5f6('0x7')]},'idField':{'type':Sequelize[_0xc5f6('0x7')]},'nameField':{'type':Sequelize[_0xc5f6('0x7')]},'customField':{'type':Sequelize[_0xc5f6('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc5f6('0x7')]}}; \ No newline at end of file +var _0xd49c=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x20f76a,_0x2605e2){var _0x30016d=function(_0x5b800a){while(--_0x5b800a){_0x20f76a['push'](_0x20f76a['shift']());}};_0x30016d(++_0x2605e2);}(_0xd49c,0x143));var _0xcd49=function(_0x14dde9,_0x699a04){_0x14dde9=_0x14dde9-0x0;var _0x3b1ad6=_0xd49c[_0x14dde9];return _0x3b1ad6;};'use strict';var Sequelize=require(_0xcd49('0x0'));module[_0xcd49('0x1')]={'type':{'type':Sequelize[_0xcd49('0x2')](_0xcd49('0x3'),_0xcd49('0x4'),_0xcd49('0x5'),_0xcd49('0x6'),_0xcd49('0x7')),'defaultValue':_0xcd49('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xcd49('0x8')]},'keyType':{'type':Sequelize[_0xcd49('0x2')](_0xcd49('0x3'),_0xcd49('0x4'),_0xcd49('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xcd49('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index ee8f0d1..f3b7171 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 _0x89a7=['error','stack','name','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','ZendeskField','includeAll','rows','catch','show','params','include','options','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','count','offset','limit','set','apply','save','then','destroy'];(function(_0x88aac5,_0x1dfaa5){var _0x56e2c7=function(_0x6a249b){while(--_0x6a249b){_0x88aac5['push'](_0x88aac5['shift']());}};_0x56e2c7(++_0x1dfaa5);}(_0x89a7,0x14f));var _0x789a=function(_0x2e0d56,_0x1db8b4){_0x2e0d56=_0x2e0d56-0x0;var _0x5ef110=_0x89a7[_0x2e0d56];return _0x5ef110;};'use strict';var emlformat=require(_0x789a('0x0'));var rimraf=require(_0x789a('0x1'));var zipdir=require(_0x789a('0x2'));var jsonpatch=require(_0x789a('0x3'));var rp=require(_0x789a('0x4'));var moment=require(_0x789a('0x5'));var BPromise=require(_0x789a('0x6'));var Mustache=require(_0x789a('0x7'));var util=require(_0x789a('0x8'));var path=require(_0x789a('0x9'));var sox=require(_0x789a('0xa'));var csv=require(_0x789a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x789a('0xc'));var _=require(_0x789a('0xd'));var squel=require(_0x789a('0xe'));var crypto=require(_0x789a('0xf'));var jsforce=require(_0x789a('0x10'));var deskjs=require(_0x789a('0x11'));var toCsv=require('to-csv');var querystring=require(_0x789a('0x12'));var Papa=require(_0x789a('0x13'));var Redis=require(_0x789a('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x789a('0x15'));var as=require(_0x789a('0x16'));var hardwareService=require(_0x789a('0x17'));var logger=require(_0x789a('0x18'))(_0x789a('0x19'));var utils=require('../../config/utils');var config=require(_0x789a('0x1a'));var licenseUtil=require(_0x789a('0x1b'));var db=require(_0x789a('0x1c'))['db'];function respondWithStatusCode(_0x54bada,_0x1f59d0){_0x1f59d0=_0x1f59d0||0xcc;return function(_0x40f080){if(_0x40f080){return _0x54bada[_0x789a('0x1d')](_0x1f59d0);}return _0x54bada['status'](_0x1f59d0)['end']();};}function respondWithResult(_0x5d37eb,_0x203e31){_0x203e31=_0x203e31||0xc8;return function(_0xa63bc5){if(_0xa63bc5){return _0x5d37eb['status'](_0x203e31)[_0x789a('0x1e')](_0xa63bc5);}};}function respondWithFilteredResult(_0x3f4a86,_0x120e5d){return function(_0x361e83){if(_0x361e83){var _0x2fadc2=typeof _0x120e5d['offset']===_0x789a('0x1f')&&typeof _0x120e5d['limit']===_0x789a('0x1f');var _0x5d85d6=_0x361e83[_0x789a('0x20')];var _0x4b28af=_0x2fadc2?0x0:_0x120e5d[_0x789a('0x21')];var _0x30922f=_0x2fadc2?_0x361e83[_0x789a('0x20')]:_0x120e5d[_0x789a('0x21')]+_0x120e5d[_0x789a('0x22')];var _0x114908;if(_0x30922f>=_0x5d85d6){_0x30922f=_0x5d85d6;_0x114908=0xc8;}else{_0x114908=0xce;}_0x3f4a86['status'](_0x114908);return _0x3f4a86[_0x789a('0x23')]('Content-Range',_0x4b28af+'-'+_0x30922f+'/'+_0x5d85d6)[_0x789a('0x1e')](_0x361e83);}return null;};}function patchUpdates(_0x217b47){return function(_0x3d0749){try{jsonpatch[_0x789a('0x24')](_0x3d0749,_0x217b47,!![]);}catch(_0x5a33bd){return BPromise['reject'](_0x5a33bd);}return _0x3d0749[_0x789a('0x25')]();};}function saveUpdates(_0x462d74,_0x4d2e){return function(_0x20d1db){if(_0x20d1db){return _0x20d1db['update'](_0x462d74)[_0x789a('0x26')](function(_0x3a0e2f){return _0x3a0e2f;});}return null;};}function removeEntity(_0x1b47d2,_0x59915f){return function(_0x16b203){if(_0x16b203){return _0x16b203[_0x789a('0x27')]()[_0x789a('0x26')](function(){_0x1b47d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f1cfa,_0x48df5a){return function(_0xd7de){if(!_0xd7de){_0x5f1cfa[_0x789a('0x1d')](0x194);}return _0xd7de;};}function handleError(_0x281c21,_0x4187ba){_0x4187ba=_0x4187ba||0x1f4;return function(_0x4bc51e){logger[_0x789a('0x28')](_0x4bc51e[_0x789a('0x29')]);if(_0x4bc51e[_0x789a('0x2a')]){delete _0x4bc51e[_0x789a('0x2a')];}_0x281c21['status'](_0x4187ba)['send'](_0x4bc51e);};}exports[_0x789a('0x2b')]=function(_0x609f89,_0x2c0584){var _0x3c830a={},_0x378dfa={},_0x5809bc={'count':0x0,'rows':[]};var _0xf4a65f=_[_0x789a('0x2c')](db['ZendeskField'][_0x789a('0x2d')],function(_0x33091d){return{'name':_0x33091d[_0x789a('0x2e')],'type':_0x33091d[_0x789a('0x2f')]['key']};});_0x378dfa['model']=_['map'](_0xf4a65f,'name');_0x378dfa[_0x789a('0x30')]=_[_0x789a('0x31')](_0x609f89['query']);_0x378dfa[_0x789a('0x32')]=_[_0x789a('0x33')](_0x378dfa[_0x789a('0x34')],_0x378dfa['query']);_0x3c830a[_0x789a('0x35')]=_[_0x789a('0x33')](_0x378dfa['model'],qs[_0x789a('0x36')](_0x609f89[_0x789a('0x30')][_0x789a('0x36')]));_0x3c830a['attributes']=_0x3c830a[_0x789a('0x35')][_0x789a('0x37')]?_0x3c830a[_0x789a('0x35')]:_0x378dfa[_0x789a('0x34')];if(!_0x609f89[_0x789a('0x30')][_0x789a('0x38')]('nolimit')){_0x3c830a[_0x789a('0x22')]=qs[_0x789a('0x22')](_0x609f89[_0x789a('0x30')][_0x789a('0x22')]);_0x3c830a['offset']=qs[_0x789a('0x21')](_0x609f89[_0x789a('0x30')][_0x789a('0x21')]);}_0x3c830a[_0x789a('0x39')]=qs[_0x789a('0x3a')](_0x609f89[_0x789a('0x30')][_0x789a('0x3a')]);_0x3c830a[_0x789a('0x3b')]=qs[_0x789a('0x32')](_['pick'](_0x609f89['query'],_0x378dfa[_0x789a('0x32')]),_0xf4a65f);if(_0x609f89['query'][_0x789a('0x3c')]){_0x3c830a[_0x789a('0x3b')]=_[_0x789a('0x3d')](_0x3c830a[_0x789a('0x3b')],{'$or':_[_0x789a('0x2c')](_0xf4a65f,function(_0x4755be){if(_0x4755be['type']!==_0x789a('0x3e')){var _0xceba8={};_0xceba8[_0x4755be['name']]={'$like':'%'+_0x609f89[_0x789a('0x30')]['filter']+'%'};return _0xceba8;}})});}_0x3c830a=_[_0x789a('0x3d')]({},_0x3c830a,_0x609f89['options']);var _0x5b2f10={'where':_0x3c830a[_0x789a('0x3b')]};return db[_0x789a('0x3f')][_0x789a('0x20')](_0x5b2f10)[_0x789a('0x26')](function(_0x25aff3){_0x5809bc[_0x789a('0x20')]=_0x25aff3;if(_0x609f89[_0x789a('0x30')][_0x789a('0x40')]){_0x3c830a['include']=[{'all':!![]}];}return db[_0x789a('0x3f')]['findAll'](_0x3c830a);})[_0x789a('0x26')](function(_0x55b802){_0x5809bc[_0x789a('0x41')]=_0x55b802;return _0x5809bc;})[_0x789a('0x26')](respondWithFilteredResult(_0x2c0584,_0x3c830a))[_0x789a('0x42')](handleError(_0x2c0584,null));};exports[_0x789a('0x43')]=function(_0x9315dc,_0x12a102){var _0x1b9d22={'raw':!![],'where':{'id':_0x9315dc[_0x789a('0x44')]['id']}},_0x523649={};_0x523649[_0x789a('0x34')]=_['keys'](db['ZendeskField'][_0x789a('0x2d')]);_0x523649[_0x789a('0x30')]=_[_0x789a('0x31')](_0x9315dc['query']);_0x523649[_0x789a('0x32')]=_[_0x789a('0x33')](_0x523649[_0x789a('0x34')],_0x523649[_0x789a('0x30')]);_0x1b9d22[_0x789a('0x35')]=_[_0x789a('0x33')](_0x523649[_0x789a('0x34')],qs[_0x789a('0x36')](_0x9315dc['query'][_0x789a('0x36')]));_0x1b9d22[_0x789a('0x35')]=_0x1b9d22[_0x789a('0x35')][_0x789a('0x37')]?_0x1b9d22[_0x789a('0x35')]:_0x523649[_0x789a('0x34')];if(_0x9315dc['query'][_0x789a('0x40')]){_0x1b9d22[_0x789a('0x45')]=[{'all':!![]}];}_0x1b9d22=_[_0x789a('0x3d')]({},_0x1b9d22,_0x9315dc[_0x789a('0x46')]);return db[_0x789a('0x3f')][_0x789a('0x47')](_0x1b9d22)['then'](handleEntityNotFound(_0x12a102,null))[_0x789a('0x26')](respondWithResult(_0x12a102,null))['catch'](handleError(_0x12a102,null));};exports[_0x789a('0x48')]=function(_0x59097e,_0x1047b5){return db[_0x789a('0x3f')][_0x789a('0x48')](_0x59097e['body'],{})[_0x789a('0x26')](respondWithResult(_0x1047b5,0xc9))[_0x789a('0x42')](handleError(_0x1047b5,null));};exports[_0x789a('0x49')]=function(_0x1e7239,_0x431dfb){if(_0x1e7239[_0x789a('0x4a')]['id']){delete _0x1e7239[_0x789a('0x4a')]['id'];}return db[_0x789a('0x3f')][_0x789a('0x47')]({'where':{'id':_0x1e7239[_0x789a('0x44')]['id']}})['then'](handleEntityNotFound(_0x431dfb,null))[_0x789a('0x26')](saveUpdates(_0x1e7239[_0x789a('0x4a')],null))[_0x789a('0x26')](respondWithResult(_0x431dfb,null))[_0x789a('0x42')](handleError(_0x431dfb,null));};exports[_0x789a('0x27')]=function(_0x1e3ff8,_0x3fc5ee){return db[_0x789a('0x3f')][_0x789a('0x47')]({'where':{'id':_0x1e3ff8['params']['id']}})[_0x789a('0x26')](handleEntityNotFound(_0x3fc5ee,null))[_0x789a('0x26')](removeEntity(_0x3fc5ee,null))[_0x789a('0x42')](handleError(_0x3fc5ee,null));}; \ No newline at end of file +var _0x4ac5=['papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','includeAll','find','create','body','update','destroy','catch','eml-format','rimraf','zip-dir','moment','path','sox','to-csv','lodash','crypto','desk.js','querystring'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x4ac5,0x1ed));var _0x54ac=function(_0x184cc6,_0x4961ee){_0x184cc6=_0x184cc6-0x0;var _0x3f7435=_0x4ac5[_0x184cc6];return _0x3f7435;};'use strict';var emlformat=require(_0x54ac('0x0'));var rimraf=require(_0x54ac('0x1'));var zipdir=require(_0x54ac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x54ac('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x54ac('0x4'));var sox=require(_0x54ac('0x5'));var csv=require(_0x54ac('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x54ac('0x7'));var squel=require('squel');var crypto=require(_0x54ac('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x54ac('0x9'));var toCsv=require('to-csv');var querystring=require(_0x54ac('0xa'));var Papa=require(_0x54ac('0xb'));var Redis=require(_0x54ac('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x54ac('0xd'));var logger=require(_0x54ac('0xe'))(_0x54ac('0xf'));var utils=require(_0x54ac('0x10'));var config=require(_0x54ac('0x11'));var licenseUtil=require(_0x54ac('0x12'));var db=require(_0x54ac('0x13'))['db'];function respondWithStatusCode(_0x575fef,_0x4b2db8){_0x4b2db8=_0x4b2db8||0xcc;return function(_0x481130){if(_0x481130){return _0x575fef['sendStatus'](_0x4b2db8);}return _0x575fef[_0x54ac('0x14')](_0x4b2db8)[_0x54ac('0x15')]();};}function respondWithResult(_0x1c3e9e,_0x28bce5){_0x28bce5=_0x28bce5||0xc8;return function(_0x4f2d5b){if(_0x4f2d5b){return _0x1c3e9e[_0x54ac('0x14')](_0x28bce5)[_0x54ac('0x16')](_0x4f2d5b);}};}function respondWithFilteredResult(_0xf1be47,_0x195d4e){return function(_0x4c49ea){if(_0x4c49ea){var _0x5dc85c=typeof _0x195d4e[_0x54ac('0x17')]==='undefined'&&typeof _0x195d4e[_0x54ac('0x18')]==='undefined';var _0x3c8195=_0x4c49ea['count'];var _0x535433=_0x5dc85c?0x0:_0x195d4e['offset'];var _0x4c9b78=_0x5dc85c?_0x4c49ea[_0x54ac('0x19')]:_0x195d4e[_0x54ac('0x17')]+_0x195d4e[_0x54ac('0x18')];var _0x389194;if(_0x4c9b78>=_0x3c8195){_0x4c9b78=_0x3c8195;_0x389194=0xc8;}else{_0x389194=0xce;}_0xf1be47['status'](_0x389194);return _0xf1be47[_0x54ac('0x1a')](_0x54ac('0x1b'),_0x535433+'-'+_0x4c9b78+'/'+_0x3c8195)[_0x54ac('0x16')](_0x4c49ea);}return null;};}function patchUpdates(_0x4faeed){return function(_0x524cbe){try{jsonpatch[_0x54ac('0x1c')](_0x524cbe,_0x4faeed,!![]);}catch(_0x3bddce){return BPromise[_0x54ac('0x1d')](_0x3bddce);}return _0x524cbe[_0x54ac('0x1e')]();};}function saveUpdates(_0x36fae1,_0xe16b92){return function(_0x1b0185){if(_0x1b0185){return _0x1b0185['update'](_0x36fae1)[_0x54ac('0x1f')](function(_0x180e80){return _0x180e80;});}return null;};}function removeEntity(_0x42eab6,_0x322165){return function(_0x324d16){if(_0x324d16){return _0x324d16['destroy']()['then'](function(){_0x42eab6[_0x54ac('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b1bf0,_0x44e063){return function(_0x2ec379){if(!_0x2ec379){_0x2b1bf0['sendStatus'](0x194);}return _0x2ec379;};}function handleError(_0x288b73,_0x111c62){_0x111c62=_0x111c62||0x1f4;return function(_0x30c650){logger[_0x54ac('0x20')](_0x30c650[_0x54ac('0x21')]);if(_0x30c650[_0x54ac('0x22')]){delete _0x30c650[_0x54ac('0x22')];}_0x288b73[_0x54ac('0x14')](_0x111c62)[_0x54ac('0x23')](_0x30c650);};}exports[_0x54ac('0x24')]=function(_0x354054,_0x19848e){var _0xdbaa16={},_0x82a237={},_0x2b8d10={'count':0x0,'rows':[]};var _0x4a4814=_[_0x54ac('0x25')](db[_0x54ac('0x26')][_0x54ac('0x27')],function(_0x3b10ab){return{'name':_0x3b10ab[_0x54ac('0x28')],'type':_0x3b10ab[_0x54ac('0x29')][_0x54ac('0x2a')]};});_0x82a237[_0x54ac('0x2b')]=_['map'](_0x4a4814,_0x54ac('0x22'));_0x82a237[_0x54ac('0x2c')]=_['keys'](_0x354054[_0x54ac('0x2c')]);_0x82a237[_0x54ac('0x2d')]=_['intersection'](_0x82a237[_0x54ac('0x2b')],_0x82a237[_0x54ac('0x2c')]);_0xdbaa16[_0x54ac('0x2e')]=_[_0x54ac('0x2f')](_0x82a237[_0x54ac('0x2b')],qs[_0x54ac('0x30')](_0x354054[_0x54ac('0x2c')][_0x54ac('0x30')]));_0xdbaa16[_0x54ac('0x2e')]=_0xdbaa16['attributes'][_0x54ac('0x31')]?_0xdbaa16[_0x54ac('0x2e')]:_0x82a237[_0x54ac('0x2b')];if(!_0x354054[_0x54ac('0x2c')][_0x54ac('0x32')]('nolimit')){_0xdbaa16[_0x54ac('0x18')]=qs[_0x54ac('0x18')](_0x354054['query'][_0x54ac('0x18')]);_0xdbaa16[_0x54ac('0x17')]=qs[_0x54ac('0x17')](_0x354054[_0x54ac('0x2c')][_0x54ac('0x17')]);}_0xdbaa16[_0x54ac('0x33')]=qs[_0x54ac('0x34')](_0x354054[_0x54ac('0x2c')][_0x54ac('0x34')]);_0xdbaa16[_0x54ac('0x35')]=qs[_0x54ac('0x2d')](_[_0x54ac('0x36')](_0x354054[_0x54ac('0x2c')],_0x82a237[_0x54ac('0x2d')]),_0x4a4814);if(_0x354054[_0x54ac('0x2c')]['filter']){_0xdbaa16[_0x54ac('0x35')]=_[_0x54ac('0x37')](_0xdbaa16[_0x54ac('0x35')],{'$or':_[_0x54ac('0x25')](_0x4a4814,function(_0x547ea4){if(_0x547ea4['type']!==_0x54ac('0x38')){var _0x207a56={};_0x207a56[_0x547ea4[_0x54ac('0x22')]]={'$like':'%'+_0x354054['query'][_0x54ac('0x39')]+'%'};return _0x207a56;}})});}_0xdbaa16=_[_0x54ac('0x37')]({},_0xdbaa16,_0x354054[_0x54ac('0x3a')]);var _0x205ed6={'where':_0xdbaa16[_0x54ac('0x35')]};return db[_0x54ac('0x26')][_0x54ac('0x19')](_0x205ed6)['then'](function(_0x29533b){_0x2b8d10[_0x54ac('0x19')]=_0x29533b;if(_0x354054[_0x54ac('0x2c')]['includeAll']){_0xdbaa16[_0x54ac('0x3b')]=[{'all':!![]}];}return db[_0x54ac('0x26')][_0x54ac('0x3c')](_0xdbaa16);})[_0x54ac('0x1f')](function(_0x5eb30c){_0x2b8d10[_0x54ac('0x3d')]=_0x5eb30c;return _0x2b8d10;})[_0x54ac('0x1f')](respondWithFilteredResult(_0x19848e,_0xdbaa16))['catch'](handleError(_0x19848e,null));};exports[_0x54ac('0x3e')]=function(_0x4622ba,_0x2cf5a6){var _0x381b1f={'raw':!![],'where':{'id':_0x4622ba[_0x54ac('0x3f')]['id']}},_0x517eab={};_0x517eab[_0x54ac('0x2b')]=_[_0x54ac('0x40')](db[_0x54ac('0x26')][_0x54ac('0x27')]);_0x517eab['query']=_[_0x54ac('0x40')](_0x4622ba['query']);_0x517eab[_0x54ac('0x2d')]=_[_0x54ac('0x2f')](_0x517eab[_0x54ac('0x2b')],_0x517eab[_0x54ac('0x2c')]);_0x381b1f[_0x54ac('0x2e')]=_[_0x54ac('0x2f')](_0x517eab[_0x54ac('0x2b')],qs[_0x54ac('0x30')](_0x4622ba[_0x54ac('0x2c')]['fields']));_0x381b1f[_0x54ac('0x2e')]=_0x381b1f[_0x54ac('0x2e')]['length']?_0x381b1f['attributes']:_0x517eab[_0x54ac('0x2b')];if(_0x4622ba['query'][_0x54ac('0x41')]){_0x381b1f['include']=[{'all':!![]}];}_0x381b1f=_['merge']({},_0x381b1f,_0x4622ba[_0x54ac('0x3a')]);return db['ZendeskField'][_0x54ac('0x42')](_0x381b1f)[_0x54ac('0x1f')](handleEntityNotFound(_0x2cf5a6,null))[_0x54ac('0x1f')](respondWithResult(_0x2cf5a6,null))['catch'](handleError(_0x2cf5a6,null));};exports[_0x54ac('0x43')]=function(_0x14b604,_0x1d100f){return db['ZendeskField'][_0x54ac('0x43')](_0x14b604[_0x54ac('0x44')],{})[_0x54ac('0x1f')](respondWithResult(_0x1d100f,0xc9))['catch'](handleError(_0x1d100f,null));};exports[_0x54ac('0x45')]=function(_0x261e73,_0x4765a2){if(_0x261e73[_0x54ac('0x44')]['id']){delete _0x261e73[_0x54ac('0x44')]['id'];}return db[_0x54ac('0x26')][_0x54ac('0x42')]({'where':{'id':_0x261e73[_0x54ac('0x3f')]['id']}})[_0x54ac('0x1f')](handleEntityNotFound(_0x4765a2,null))[_0x54ac('0x1f')](saveUpdates(_0x261e73['body'],null))[_0x54ac('0x1f')](respondWithResult(_0x4765a2,null))['catch'](handleError(_0x4765a2,null));};exports[_0x54ac('0x46')]=function(_0xcdb4db,_0x5e8368){return db[_0x54ac('0x26')]['find']({'where':{'id':_0xcdb4db[_0x54ac('0x3f')]['id']}})[_0x54ac('0x1f')](handleEntityNotFound(_0x5e8368,null))['then'](removeEntity(_0x5e8368,null))[_0x54ac('0x47')](handleError(_0x5e8368,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 9d1a4b7..7c158c2 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 _0x1c6d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZendeskField','zendesk_unique_index','idField','lodash'];(function(_0x4bfe65,_0x49bcfe){var _0x50596f=function(_0x44fa70){while(--_0x44fa70){_0x4bfe65['push'](_0x4bfe65['shift']());}};_0x50596f(++_0x49bcfe);}(_0x1c6d,0xa4));var _0xd1c6=function(_0x1ed791,_0x3c86aa){_0x1ed791=_0x1ed791-0x0;var _0xea6482=_0x1c6d[_0x1ed791];return _0xea6482;};'use strict';var _=require(_0xd1c6('0x0'));var util=require(_0xd1c6('0x1'));var logger=require(_0xd1c6('0x2'))(_0xd1c6('0x3'));var moment=require(_0xd1c6('0x4'));var BPromise=require(_0xd1c6('0x5'));var rp=require(_0xd1c6('0x6'));var fs=require('fs');var path=require(_0xd1c6('0x7'));var rimraf=require(_0xd1c6('0x8'));var config=require(_0xd1c6('0x9'));var attributes=require('./intZendeskField.attributes');module[_0xd1c6('0xa')]=function(_0x22f231,_0x22e341){return _0x22f231[_0xd1c6('0xb')](_0xd1c6('0xc'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xd1c6('0xd'),'fields':[_0xd1c6('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5edf=['int_zendesk_fields','zendesk_unique_index','idField','FieldId','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5edf,0x13c));var _0xf5ed=function(_0x3cb57c,_0x303e81){_0x3cb57c=_0x3cb57c-0x0;var _0x505262=_0x5edf[_0x3cb57c];return _0x505262;};'use strict';var _=require('lodash');var util=require(_0xf5ed('0x0'));var logger=require(_0xf5ed('0x1'))(_0xf5ed('0x2'));var moment=require(_0xf5ed('0x3'));var BPromise=require('bluebird');var rp=require(_0xf5ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf5ed('0x5'));var config=require(_0xf5ed('0x6'));var attributes=require('./intZendeskField.attributes');module[_0xf5ed('0x7')]=function(_0x94ac42,_0x3b853c){return _0x94ac42[_0xf5ed('0x8')]('ZendeskField',attributes,{'tableName':_0xf5ed('0x9'),'paranoid':![],'indexes':[{'name':_0xf5ed('0xa'),'fields':[_0xf5ed('0xb'),_0xf5ed('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 975c3e7..d15f3a5 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 _0xa5e6=['http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x2300fa,_0x41c382){var _0x11fef0=function(_0x597ffb){while(--_0x597ffb){_0x2300fa['push'](_0x2300fa['shift']());}};_0x11fef0(++_0x41c382);}(_0xa5e6,0x15d));var _0x6a5e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa5e6[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x6a5e('0x0'));var moment=require(_0x6a5e('0x1'));var BPromise=require(_0x6a5e('0x2'));var rs=require(_0x6a5e('0x3'));var fs=require('fs');var Redis=require(_0x6a5e('0x4'));var db=require(_0x6a5e('0x5'))['db'];var utils=require(_0x6a5e('0x6'));var logger=require(_0x6a5e('0x7'))(_0x6a5e('0x8'));var config=require(_0x6a5e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6a5e('0xa')][_0x6a5e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51790e,_0x39510e,_0x2524d4){return new BPromise(function(_0x44c1d1,_0x38271e){return client[_0x6a5e('0xc')](_0x51790e,_0x2524d4)[_0x6a5e('0xd')](function(_0x170b82){logger[_0x6a5e('0xe')](_0x6a5e('0xf'),_0x39510e,_0x6a5e('0x10'));logger[_0x6a5e('0x11')](_0x6a5e('0x12'),_0x39510e,_0x6a5e('0x10'),JSON['stringify'](_0x170b82));if(_0x170b82[_0x6a5e('0x13')]){if(_0x170b82[_0x6a5e('0x13')][_0x6a5e('0x14')]===0x1f4){logger[_0x6a5e('0x13')](_0x6a5e('0xf'),_0x39510e,_0x170b82[_0x6a5e('0x13')][_0x6a5e('0x15')]);return _0x38271e(_0x170b82[_0x6a5e('0x13')][_0x6a5e('0x15')]);}logger[_0x6a5e('0x13')](_0x6a5e('0xf'),_0x39510e,_0x170b82['error'][_0x6a5e('0x15')]);return _0x44c1d1(_0x170b82[_0x6a5e('0x13')][_0x6a5e('0x15')]);}else{logger[_0x6a5e('0xe')](_0x6a5e('0xf'),_0x39510e,'request\x20sent');_0x44c1d1(_0x170b82[_0x6a5e('0x16')]['message']);}})[_0x6a5e('0x17')](function(_0x5e1ad5){logger['error']('ZendeskField,\x20%s,\x20%s',_0x39510e,_0x5e1ad5);_0x38271e(_0x5e1ad5);});});} \ No newline at end of file +var _0xba22=['http','request','then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskField,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x21b87c,_0x1fcc0c){var _0x54cfec=function(_0x4b9ea8){while(--_0x4b9ea8){_0x21b87c['push'](_0x21b87c['shift']());}};_0x54cfec(++_0x1fcc0c);}(_0xba22,0x1ae));var _0x2ba2=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xba22[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x2ba2('0x0'));var util=require(_0x2ba2('0x1'));var moment=require(_0x2ba2('0x2'));var BPromise=require('bluebird');var rs=require(_0x2ba2('0x3'));var fs=require('fs');var Redis=require(_0x2ba2('0x4'));var db=require(_0x2ba2('0x5'))['db'];var utils=require(_0x2ba2('0x6'));var logger=require(_0x2ba2('0x7'))('rpc');var config=require(_0x2ba2('0x8'));var jayson=require(_0x2ba2('0x9'));var client=jayson['client'][_0x2ba2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x435909,_0x385cac,_0x4f5075){return new BPromise(function(_0x1da6c8,_0x2ae15a){return client[_0x2ba2('0xb')](_0x435909,_0x4f5075)[_0x2ba2('0xc')](function(_0x466ac5){logger[_0x2ba2('0xd')]('ZendeskField,\x20%s,\x20%s',_0x385cac,_0x2ba2('0xe'));logger[_0x2ba2('0xf')](_0x2ba2('0x10'),_0x385cac,_0x2ba2('0xe'),JSON[_0x2ba2('0x11')](_0x466ac5));if(_0x466ac5[_0x2ba2('0x12')]){if(_0x466ac5[_0x2ba2('0x12')]['code']===0x1f4){logger['error'](_0x2ba2('0x13'),_0x385cac,_0x466ac5[_0x2ba2('0x12')][_0x2ba2('0x14')]);return _0x2ae15a(_0x466ac5[_0x2ba2('0x12')][_0x2ba2('0x14')]);}logger[_0x2ba2('0x12')](_0x2ba2('0x13'),_0x385cac,_0x466ac5[_0x2ba2('0x12')][_0x2ba2('0x14')]);return _0x1da6c8(_0x466ac5[_0x2ba2('0x12')][_0x2ba2('0x14')]);}else{logger[_0x2ba2('0xd')](_0x2ba2('0x13'),_0x385cac,_0x2ba2('0xe'));_0x1da6c8(_0x466ac5['result'][_0x2ba2('0x14')]);}})[_0x2ba2('0x15')](function(_0x38af6e){logger[_0x2ba2('0x12')](_0x2ba2('0x13'),_0x385cac,_0x38af6e);_0x2ae15a(_0x38af6e);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 9d02af9..2fada5e 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 _0x0b5c=['create','addConfiguration','put','/:id','update','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post'];(function(_0xf1d988,_0x341f87){var _0x264fa0=function(_0x37f308){while(--_0x37f308){_0xf1d988['push'](_0xf1d988['shift']());}};_0x264fa0(++_0x341f87);}(_0x0b5c,0x83));var _0xc0b5=function(_0x13a7a2,_0x28589a){_0x13a7a2=_0x13a7a2-0x0;var _0x3e6e0a=_0x0b5c[_0x13a7a2];return _0x3e6e0a;};'use strict';var multer=require(_0xc0b5('0x0'));var util=require('util');var path=require(_0xc0b5('0x1'));var timeout=require(_0xc0b5('0x2'));var express=require(_0xc0b5('0x3'));var router=express['Router']();var fs_extra=require(_0xc0b5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc0b5('0x5'));var config=require(_0xc0b5('0x6'));var controller=require(_0xc0b5('0x7'));router[_0xc0b5('0x8')]('/',auth['isAuthenticated'](),controller[_0xc0b5('0x9')]);router[_0xc0b5('0x8')]('/:id',auth[_0xc0b5('0xa')](),controller[_0xc0b5('0xb')]);router[_0xc0b5('0x8')](_0xc0b5('0xc'),auth[_0xc0b5('0xa')](),controller['getConfigurations']);router[_0xc0b5('0x8')](_0xc0b5('0xd'),auth['isAuthenticated'](),controller[_0xc0b5('0xe')]);router[_0xc0b5('0xf')]('/',auth[_0xc0b5('0xa')](),controller[_0xc0b5('0x10')]);router[_0xc0b5('0xf')]('/:id/configurations',auth[_0xc0b5('0xa')](),controller[_0xc0b5('0x11')]);router[_0xc0b5('0x12')](_0xc0b5('0x13'),auth['isAuthenticated'](),controller[_0xc0b5('0x14')]);router['delete'](_0xc0b5('0x13'),auth[_0xc0b5('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2739=['put','update','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','post','create','addConfiguration'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x2739,0x10e));var _0x9273=function(_0xe72876,_0x3d7bfa){_0xe72876=_0xe72876-0x0;var _0xf2ffca=_0x2739[_0xe72876];return _0xf2ffca;};'use strict';var multer=require(_0x9273('0x0'));var util=require('util');var path=require(_0x9273('0x1'));var timeout=require(_0x9273('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9273('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9273('0x4'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0x9273('0x5')](),controller[_0x9273('0x6')]);router[_0x9273('0x7')](_0x9273('0x8'),auth['isAuthenticated'](),controller[_0x9273('0x9')]);router[_0x9273('0x7')](_0x9273('0xa'),auth[_0x9273('0x5')](),controller[_0x9273('0xb')]);router['get']('/:id/fields',auth[_0x9273('0x5')](),controller['getFields']);router[_0x9273('0xc')]('/',auth['isAuthenticated'](),controller[_0x9273('0xd')]);router[_0x9273('0xc')](_0x9273('0xa'),auth['isAuthenticated'](),controller[_0x9273('0xe')]);router[_0x9273('0xf')](_0x9273('0x8'),auth[_0x9273('0x5')](),controller[_0x9273('0x10')]);router[_0x9273('0x11')](_0x9273('0x8'),auth[_0x9273('0x5')](),controller[_0x9273('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index bc35e38..35e7cd3 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 _0x5b02=['exports','STRING','sequelize'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5b02,0xe9));var _0x25b0=function(_0x16095d,_0x5a995a){_0x16095d=_0x16095d-0x0;var _0xc0590d=_0x5b02[_0x16095d];return _0xc0590d;};'use strict';var Sequelize=require(_0x25b0('0x0'));module[_0x25b0('0x1')]={'name':{'type':Sequelize[_0x25b0('0x2')]},'description':{'type':Sequelize[_0x25b0('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x25b0('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x25b0('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x25b0('0x2')]},'refreshToken':{'type':Sequelize[_0x25b0('0x2')]}}; \ No newline at end of file +var _0xf4eb=['sequelize','STRING'];(function(_0x14cd60,_0x3dadce){var _0x809d1d=function(_0x32de4b){while(--_0x32de4b){_0x14cd60['push'](_0x14cd60['shift']());}};_0x809d1d(++_0x3dadce);}(_0xf4eb,0xec));var _0xbf4e=function(_0x37369c,_0x380f77){_0x37369c=_0x37369c-0x0;var _0x664371=_0xf4eb[_0x37369c];return _0x664371;};'use strict';var Sequelize=require(_0xbf4e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xbf4e('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xbf4e('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xbf4e('0x1')]},'refreshToken':{'type':Sequelize[_0xbf4e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index b524551..7de0b86 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 _0x5e47=['destroy','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','merge','find','body','findOne','ZohoConfiguration','order','pick','getConfigurations','AccountId','Subjects','channel','Descriptions','getDescriptions','create','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','code','zoho.eu','com','serverUrl','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','error','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then'];(function(_0xb36df8,_0x48159f){var _0x1670bd=function(_0xc25727){while(--_0xc25727){_0xb36df8['push'](_0xb36df8['shift']());}};_0x1670bd(++_0x48159f);}(_0x5e47,0x1e6));var _0x75e4=function(_0x868b7c,_0xfa438b){_0x868b7c=_0x868b7c-0x0;var _0x21683c=_0x5e47[_0x868b7c];return _0x21683c;};'use strict';var emlformat=require(_0x75e4('0x0'));var rimraf=require(_0x75e4('0x1'));var zipdir=require(_0x75e4('0x2'));var jsonpatch=require(_0x75e4('0x3'));var rp=require(_0x75e4('0x4'));var moment=require(_0x75e4('0x5'));var BPromise=require(_0x75e4('0x6'));var Mustache=require(_0x75e4('0x7'));var util=require(_0x75e4('0x8'));var path=require(_0x75e4('0x9'));var sox=require(_0x75e4('0xa'));var csv=require('to-csv');var ejs=require(_0x75e4('0xb'));var fs=require('fs');var fs_extra=require(_0x75e4('0xc'));var _=require(_0x75e4('0xd'));var squel=require(_0x75e4('0xe'));var crypto=require(_0x75e4('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x75e4('0x10'));var Redis=require(_0x75e4('0x11'));var authService=require(_0x75e4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x75e4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x75e4('0x14'))(_0x75e4('0x15'));var utils=require(_0x75e4('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x75e4('0x17'))['db'];var integrations=require(_0x75e4('0x18'));function respondWithStatusCode(_0x69d331,_0x45ceb6){_0x45ceb6=_0x45ceb6||0xcc;return function(_0x414a60){if(_0x414a60){return _0x69d331['sendStatus'](_0x45ceb6);}return _0x69d331[_0x75e4('0x19')](_0x45ceb6)[_0x75e4('0x1a')]();};}function respondWithResult(_0x1c8b1d,_0xbd8067){_0xbd8067=_0xbd8067||0xc8;return function(_0x14de7c){if(_0x14de7c){return _0x1c8b1d['status'](_0xbd8067)[_0x75e4('0x1b')](_0x14de7c);}};}function respondWithFilteredResult(_0x288dbc,_0x26a2ac){return function(_0x2660a3){if(_0x2660a3){var _0x3a3350=typeof _0x26a2ac[_0x75e4('0x1c')]===_0x75e4('0x1d')&&typeof _0x26a2ac[_0x75e4('0x1e')]===_0x75e4('0x1d');var _0x19dd9c=_0x2660a3[_0x75e4('0x1f')];var _0x4d881e=_0x3a3350?0x0:_0x26a2ac[_0x75e4('0x1c')];var _0x628aa8=_0x3a3350?_0x2660a3[_0x75e4('0x1f')]:_0x26a2ac[_0x75e4('0x1c')]+_0x26a2ac[_0x75e4('0x1e')];var _0x1a4703;if(_0x628aa8>=_0x19dd9c){_0x628aa8=_0x19dd9c;_0x1a4703=0xc8;}else{_0x1a4703=0xce;}_0x288dbc[_0x75e4('0x19')](_0x1a4703);return _0x288dbc['set'](_0x75e4('0x20'),_0x4d881e+'-'+_0x628aa8+'/'+_0x19dd9c)[_0x75e4('0x1b')](_0x2660a3);}return null;};}function patchUpdates(_0x474127){return function(_0x1025c2){try{jsonpatch[_0x75e4('0x21')](_0x1025c2,_0x474127,!![]);}catch(_0x4761d3){return BPromise[_0x75e4('0x22')](_0x4761d3);}return _0x1025c2[_0x75e4('0x23')]();};}function saveUpdates(_0x59df48,_0x37e0b7){return function(_0x2af01c){if(_0x2af01c){return _0x2af01c[_0x75e4('0x24')](_0x59df48)[_0x75e4('0x25')](function(_0x5786e4){return _0x5786e4;});}return null;};}function removeEntity(_0x58d581,_0x1bdb89){return function(_0x447d25){if(_0x447d25){return _0x447d25[_0x75e4('0x26')]()[_0x75e4('0x25')](function(){_0x58d581[_0x75e4('0x19')](0xcc)[_0x75e4('0x1a')]();});}};}function handleEntityNotFound(_0x188e5e,_0x4a0148){return function(_0x35f17){if(!_0x35f17){_0x188e5e['sendStatus'](0x194);}return _0x35f17;};}function handleError(_0x1c0f0d,_0x2518bc){_0x2518bc=_0x2518bc||0x1f4;return function(_0x2b47d1){logger['error'](_0x2b47d1[_0x75e4('0x27')]);if(_0x2b47d1[_0x75e4('0x28')]){delete _0x2b47d1[_0x75e4('0x28')];}_0x1c0f0d[_0x75e4('0x19')](_0x2518bc)['send'](_0x2b47d1);};}exports[_0x75e4('0x29')]=function(_0xb82734,_0x38bcab){var _0x280e89={},_0x2aa587={},_0x21e2a1={'count':0x0,'rows':[]};var _0x4c6fb1=_[_0x75e4('0x2a')](db[_0x75e4('0x2b')][_0x75e4('0x2c')],function(_0x1c7b8a){return{'name':_0x1c7b8a[_0x75e4('0x2d')],'type':_0x1c7b8a[_0x75e4('0x2e')][_0x75e4('0x2f')]};});_0x2aa587[_0x75e4('0x30')]=_[_0x75e4('0x2a')](_0x4c6fb1,_0x75e4('0x28'));_0x2aa587['query']=_[_0x75e4('0x31')](_0xb82734[_0x75e4('0x32')]);_0x2aa587[_0x75e4('0x33')]=_[_0x75e4('0x34')](_0x2aa587[_0x75e4('0x30')],_0x2aa587['query']);_0x280e89['attributes']=_['intersection'](_0x2aa587[_0x75e4('0x30')],qs[_0x75e4('0x35')](_0xb82734[_0x75e4('0x32')][_0x75e4('0x35')]));_0x280e89['attributes']=_0x280e89['attributes'][_0x75e4('0x36')]?_0x280e89[_0x75e4('0x37')]:_0x2aa587[_0x75e4('0x30')];if(!_0xb82734['query'][_0x75e4('0x38')](_0x75e4('0x39'))){_0x280e89[_0x75e4('0x1e')]=qs[_0x75e4('0x1e')](_0xb82734[_0x75e4('0x32')][_0x75e4('0x1e')]);_0x280e89[_0x75e4('0x1c')]=qs[_0x75e4('0x1c')](_0xb82734[_0x75e4('0x32')][_0x75e4('0x1c')]);}_0x280e89['order']=qs[_0x75e4('0x3a')](_0xb82734[_0x75e4('0x32')][_0x75e4('0x3a')]);_0x280e89[_0x75e4('0x3b')]=qs[_0x75e4('0x33')](_['pick'](_0xb82734[_0x75e4('0x32')],_0x2aa587[_0x75e4('0x33')]),_0x4c6fb1);if(_0xb82734[_0x75e4('0x32')][_0x75e4('0x3c')]){_0x280e89['where']=_['merge'](_0x280e89[_0x75e4('0x3b')],{'$or':_['map'](_0x4c6fb1,function(_0x369b5b){if(_0x369b5b['type']!==_0x75e4('0x3d')){var _0x306b32={};_0x306b32[_0x369b5b[_0x75e4('0x28')]]={'$like':'%'+_0xb82734[_0x75e4('0x32')][_0x75e4('0x3c')]+'%'};return _0x306b32;}})});}_0x280e89=_['merge']({},_0x280e89,_0xb82734[_0x75e4('0x3e')]);var _0x2bf4a7={'where':_0x280e89['where']};return db[_0x75e4('0x2b')][_0x75e4('0x1f')](_0x2bf4a7)['then'](function(_0x3b92a8){_0x21e2a1[_0x75e4('0x1f')]=_0x3b92a8;if(_0xb82734[_0x75e4('0x32')][_0x75e4('0x3f')]){_0x280e89[_0x75e4('0x40')]=[{'all':!![]}];}return db[_0x75e4('0x2b')][_0x75e4('0x41')](_0x280e89);})[_0x75e4('0x25')](function(_0x5a19ee){_0x21e2a1[_0x75e4('0x42')]=_0x5a19ee;return _0x21e2a1;})[_0x75e4('0x25')](respondWithFilteredResult(_0x38bcab,_0x280e89))[_0x75e4('0x43')](handleError(_0x38bcab,null));};exports['show']=function(_0x59b6ef,_0x1f689f){var _0x45a3d3={'raw':![],'where':{'id':_0x59b6ef[_0x75e4('0x44')]['id']}},_0x4d3cd7={};_0x4d3cd7[_0x75e4('0x30')]=_[_0x75e4('0x31')](db[_0x75e4('0x2b')][_0x75e4('0x2c')]);_0x4d3cd7[_0x75e4('0x32')]=_[_0x75e4('0x31')](_0x59b6ef['query']);_0x4d3cd7[_0x75e4('0x33')]=_[_0x75e4('0x34')](_0x4d3cd7[_0x75e4('0x30')],_0x4d3cd7[_0x75e4('0x32')]);_0x45a3d3['attributes']=_[_0x75e4('0x34')](_0x4d3cd7[_0x75e4('0x30')],qs[_0x75e4('0x35')](_0x59b6ef[_0x75e4('0x32')][_0x75e4('0x35')]));_0x45a3d3[_0x75e4('0x37')]=_0x45a3d3[_0x75e4('0x37')][_0x75e4('0x36')]?_0x45a3d3['attributes']:_0x4d3cd7[_0x75e4('0x30')];if(_0x59b6ef[_0x75e4('0x32')]['includeAll']){_0x45a3d3['include']=[{'all':!![]}];}_0x45a3d3=_[_0x75e4('0x45')]({},_0x45a3d3,_0x59b6ef[_0x75e4('0x3e')]);return db[_0x75e4('0x2b')][_0x75e4('0x46')](_0x45a3d3)[_0x75e4('0x25')](handleEntityNotFound(_0x1f689f,null))[_0x75e4('0x25')](respondWithResult(_0x1f689f,null))[_0x75e4('0x43')](handleError(_0x1f689f,null));};exports['create']=function(_0x446009,_0x373722){return db[_0x75e4('0x2b')]['create'](_0x446009[_0x75e4('0x47')],{})[_0x75e4('0x25')](respondWithResult(_0x373722,0xc9))[_0x75e4('0x43')](handleError(_0x373722,null));};exports['update']=function(_0x3e37ce,_0xa19c3){if(_0x3e37ce[_0x75e4('0x47')]['id']){delete _0x3e37ce[_0x75e4('0x47')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x3e37ce[_0x75e4('0x44')]['id']}})[_0x75e4('0x25')](handleEntityNotFound(_0xa19c3,null))['then'](saveUpdates(_0x3e37ce[_0x75e4('0x47')],null))[_0x75e4('0x25')](respondWithResult(_0xa19c3,null))[_0x75e4('0x43')](handleError(_0xa19c3,null));};exports[_0x75e4('0x26')]=function(_0x238f84,_0x262f06){return db[_0x75e4('0x2b')]['find']({'where':{'id':_0x238f84[_0x75e4('0x44')]['id']}})[_0x75e4('0x25')](handleEntityNotFound(_0x262f06,null))['then'](removeEntity(_0x262f06,null))[_0x75e4('0x43')](handleError(_0x262f06,null));};exports['getConfigurations']=function(_0x1589f1,_0x29bfea,_0x2137f4){var _0x39c1e2={};var _0x5cb37b={};var _0x34ca17;var _0x102c50;return db[_0x75e4('0x2b')][_0x75e4('0x48')]({'where':{'id':_0x1589f1['params']['id']}})[_0x75e4('0x25')](handleEntityNotFound(_0x29bfea,null))['then'](function(_0x3d2189){if(_0x3d2189){_0x34ca17=_0x3d2189;_0x5cb37b[_0x75e4('0x30')]=_[_0x75e4('0x31')](db[_0x75e4('0x49')][_0x75e4('0x2c')]);_0x5cb37b[_0x75e4('0x32')]=_[_0x75e4('0x31')](_0x1589f1[_0x75e4('0x32')]);_0x5cb37b[_0x75e4('0x33')]=_[_0x75e4('0x34')](_0x5cb37b['model'],_0x5cb37b[_0x75e4('0x32')]);_0x39c1e2[_0x75e4('0x37')]=_[_0x75e4('0x34')](_0x5cb37b[_0x75e4('0x30')],qs['fields'](_0x1589f1[_0x75e4('0x32')][_0x75e4('0x35')]));_0x39c1e2[_0x75e4('0x37')]=_0x39c1e2[_0x75e4('0x37')][_0x75e4('0x36')]?_0x39c1e2[_0x75e4('0x37')]:_0x5cb37b[_0x75e4('0x30')];_0x39c1e2[_0x75e4('0x4a')]=qs[_0x75e4('0x3a')](_0x1589f1[_0x75e4('0x32')][_0x75e4('0x3a')]);_0x39c1e2[_0x75e4('0x3b')]=qs[_0x75e4('0x33')](_[_0x75e4('0x4b')](_0x1589f1[_0x75e4('0x32')],_0x5cb37b[_0x75e4('0x33')]));if(_0x1589f1[_0x75e4('0x32')][_0x75e4('0x3c')]){_0x39c1e2[_0x75e4('0x3b')]=_[_0x75e4('0x45')](_0x39c1e2['where'],{'$or':_[_0x75e4('0x2a')](_0x39c1e2[_0x75e4('0x37')],function(_0x52a08e){var _0x106f43={};_0x106f43[_0x52a08e]={'$like':'%'+_0x1589f1[_0x75e4('0x32')]['filter']+'%'};return _0x106f43;})});}_0x39c1e2=_['merge']({},_0x39c1e2,_0x1589f1['options']);return _0x34ca17[_0x75e4('0x4c')](_0x39c1e2);}})['then'](function(_0x1be15a){if(_0x1be15a){_0x102c50=_0x1be15a[_0x75e4('0x36')];if(!_0x1589f1[_0x75e4('0x32')][_0x75e4('0x38')](_0x75e4('0x39'))){_0x39c1e2[_0x75e4('0x1e')]=qs[_0x75e4('0x1e')](_0x1589f1['query'][_0x75e4('0x1e')]);_0x39c1e2[_0x75e4('0x1c')]=qs[_0x75e4('0x1c')](_0x1589f1[_0x75e4('0x32')][_0x75e4('0x1c')]);}return _0x34ca17[_0x75e4('0x4c')](_0x39c1e2);}})[_0x75e4('0x25')](function(_0x1a1a8c){if(_0x1a1a8c){return _0x1a1a8c?{'count':_0x102c50,'rows':_0x1a1a8c}:null;}})['then'](respondWithResult(_0x29bfea,null))['catch'](handleError(_0x29bfea,null));};exports['addConfiguration']=function(_0x486fe1,_0xbef897,_0x43b191){if(_0x486fe1[_0x75e4('0x47')]['id']){delete _0x486fe1[_0x75e4('0x47')]['id'];}return db[_0x75e4('0x2b')][_0x75e4('0x48')]({'where':{'id':_0x486fe1[_0x75e4('0x44')]['id']}})['then'](handleEntityNotFound(_0xbef897,null))[_0x75e4('0x25')](function(_0x323bd4){if(_0x323bd4){_0x486fe1[_0x75e4('0x47')][_0x75e4('0x4d')]=_0x323bd4['id'];_0x486fe1[_0x75e4('0x47')][_0x75e4('0x4e')]=integrations['getSubjects'](_0x486fe1[_0x75e4('0x47')][_0x75e4('0x4f')],_0x486fe1[_0x75e4('0x47')][_0x75e4('0x2e')]);_0x486fe1['body'][_0x75e4('0x50')]=integrations[_0x75e4('0x51')](_0x486fe1[_0x75e4('0x47')][_0x75e4('0x4f')],_0x486fe1[_0x75e4('0x47')][_0x75e4('0x2e')]);return db[_0x75e4('0x49')][_0x75e4('0x52')](_0x486fe1[_0x75e4('0x47')],{'include':[{'model':db[_0x75e4('0x53')],'as':'Subjects'},{'model':db[_0x75e4('0x53')],'as':_0x75e4('0x50')}]});}return null;})[_0x75e4('0x25')](respondWithResult(_0xbef897,null))[_0x75e4('0x43')](handleError(_0xbef897,null));};function getAccessToken(_0x1911ab){return new Promise(function(_0x1f9ed8,_0x4d1150){var _0x26eef4;switch(_0x1911ab[_0x75e4('0x54')]){case'US':_0x26eef4=_0x75e4('0x55');break;case'AU':_0x26eef4='https://accounts.zoho.com.au';break;case'EU':_0x26eef4='https://accounts.zoho.eu';break;case'IN':_0x26eef4='https://accounts.zoho.in';break;case'CN':_0x26eef4=_0x75e4('0x56');break;default:_0x26eef4='https://accounts.zoho.eu';break;}var _0x58cad2={'method':_0x75e4('0x57'),'uri':_0x26eef4+_0x75e4('0x58'),'qs':{'refresh_token':_0x1911ab[_0x75e4('0x59')],'client_id':_0x1911ab[_0x75e4('0x5a')],'client_secret':_0x1911ab[_0x75e4('0x5b')],'grant_type':_0x75e4('0x5c')},'json':!![]};return rp(_0x58cad2)[_0x75e4('0x25')](function(_0x45f1e2){if(_0x45f1e2['access_token']){_0x1f9ed8(_0x45f1e2[_0x75e4('0x5d')]);}else{_0x4d1150(_0x75e4('0x5e'));}})[_0x75e4('0x43')](function(_0x30ff8f){_0x4d1150(_0x30ff8f);});});}exports['getFields']=function(_0x56a672,_0x250a5a,_0x5aa230){var _0x594c27,_0x458e8e,_0xe452bd,_0x5aff36,_0x662781;return db[_0x75e4('0x2b')][_0x75e4('0x48')]({'where':{'id':_0x56a672[_0x75e4('0x44')]['id']},'attributes':['id',_0x75e4('0x5f'),_0x75e4('0x54'),_0x75e4('0x5a'),_0x75e4('0x5b'),'serverUrl',_0x75e4('0x60'),_0x75e4('0x59')]})[_0x75e4('0x25')](handleEntityNotFound(_0x250a5a,null))[_0x75e4('0x25')](function(_0x22b409){_0x662781=_0x22b409;_0x594c27=_0x662781[_0x75e4('0x5f')];_0x458e8e=_0x594c27===_0x75e4('0x61')?'eu':_0x75e4('0x62');_0xe452bd=_0x662781[_0x75e4('0x63')];var _0x352c00=_0xe452bd['slice'](-0x1);if(_0x352c00==='/'||_0x352c00==='\x5c'||_0x352c00===':'){_0xe452bd=_0xe452bd[_0x75e4('0x64')](0x0,_0xe452bd[_0x75e4('0x65')](_0x352c00));}if(!_0x662781[_0x75e4('0x59')]){throw new Error(_0x75e4('0x66'));}return getAccessToken(_0x662781);})[_0x75e4('0x25')](function(_0xd43d68){if(_0xd43d68){return rp({'method':_0x75e4('0x67'),'uri':util[_0x75e4('0x68')](_0x75e4('0x69'),_0x458e8e),'qs':{'module':_0x75e4('0x6a')},'headers':{'Authorization':_0x75e4('0x6b')+_0xd43d68},'json':!![]});}})[_0x75e4('0x25')](function(_0x5edfcc){if(_0x5edfcc){if(_0x5edfcc['response']&&_0x5edfcc['response'][_0x75e4('0x6c')]){throw new Error(_0x5edfcc['response']['error'][_0x75e4('0x6d')]);}var _0x285212=[];var _0x1163d5=[];var _0x5a67ea=[_0x75e4('0x6e'),_0x75e4('0x6f'),'Description',_0x75e4('0x70'),_0x75e4('0x71'),_0x75e4('0x72'),_0x75e4('0x73'),_0x75e4('0x74')];_0x1163d5=_[_0x75e4('0x75')](_0x5edfcc['fields'],function(_0x48269e){return _0x5a67ea[_0x75e4('0x76')](_0x48269e[_0x75e4('0x77')]);});for(var _0x5b71ef=0x0;_0x5b71ef<_0x1163d5[_0x75e4('0x36')];_0x5b71ef++){if(_0x1163d5[_0x5b71ef]['system_mandatory']===![]){_0x285212[_0x75e4('0x78')]({'id':_0x1163d5[_0x5b71ef]['id'],'name':_0x1163d5[_0x5b71ef][_0x75e4('0x79')],'custom':_0x1163d5[_0x5b71ef][_0x75e4('0x7a')],'options':_0x1163d5[_0x5b71ef][_0x75e4('0x7b')]==='picklist'&&_0x1163d5[_0x5b71ef][_0x75e4('0x7c')]['length']>-0x1?_[_0x75e4('0x2a')](_0x1163d5[_0x5b71ef][_0x75e4('0x7c')],function(_0x4807e4){return{'name':_0x4807e4,'value':_0x4807e4};}):[]});}}return{'count':_0x285212[_0x75e4('0x36')],'rows':_0x285212};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x250a5a,null))['catch'](function(_0x2929de){var _0x4c0977=_0x56a672['query'][_0x75e4('0x7d')]?0x1f4:_0x2929de[_0x75e4('0x7e')]||0x1f4;logger[_0x75e4('0x6c')]('getFields,\x20%s,\x20%s,\x20%s',_0x75e4('0x7f'),_0x4c0977,JSON[_0x75e4('0x80')](_0x2929de));delete _0x2929de[_0x75e4('0x28')];if(_0x4c0977===0x191){_0x4c0977=0x190;}_0x250a5a['status'](_0x4c0977)[_0x75e4('0x81')](_0x56a672[_0x75e4('0x32')][_0x75e4('0x7d')]?{'message':_0x75e4('0x82'),'statusCode':_0x2929de[_0x75e4('0x7e')]}:_0x2929de);});}; \ No newline at end of file +var _0x1ceb=['pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','getConfigurations','findOne','ZohoConfiguration','pick','filter','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zone','clientId','code','refreshToken','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Description','WhoId','Call_Duration','Call_Result','remove','includes','api_name','system_mandatory','push','display_label','custom_field','picklist'];(function(_0x145bb4,_0x17cc24){var _0x46acbb=function(_0x167145){while(--_0x167145){_0x145bb4['push'](_0x145bb4['shift']());}};_0x46acbb(++_0x17cc24);}(_0x1ceb,0x10f));var _0xb1ce=function(_0x4022c4,_0xe1d104){_0x4022c4=_0x4022c4-0x0;var _0x1a00a8=_0x1ceb[_0x4022c4];return _0x1a00a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1ce('0x0'));var zipdir=require(_0xb1ce('0x1'));var jsonpatch=require(_0xb1ce('0x2'));var rp=require(_0xb1ce('0x3'));var moment=require('moment');var BPromise=require(_0xb1ce('0x4'));var Mustache=require('mustache');var util=require(_0xb1ce('0x5'));var path=require(_0xb1ce('0x6'));var sox=require(_0xb1ce('0x7'));var csv=require(_0xb1ce('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb1ce('0x9'));var _=require(_0xb1ce('0xa'));var squel=require(_0xb1ce('0xb'));var crypto=require('crypto');var jsforce=require(_0xb1ce('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb1ce('0x8'));var querystring=require(_0xb1ce('0xd'));var Papa=require('papaparse');var Redis=require(_0xb1ce('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb1ce('0xf'));var as=require(_0xb1ce('0x10'));var hardwareService=require(_0xb1ce('0x11'));var logger=require(_0xb1ce('0x12'))(_0xb1ce('0x13'));var utils=require('../../config/utils');var config=require(_0xb1ce('0x14'));var licenseUtil=require(_0xb1ce('0x15'));var db=require(_0xb1ce('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x136f77,_0x1e24ec){_0x1e24ec=_0x1e24ec||0xcc;return function(_0xad7950){if(_0xad7950){return _0x136f77[_0xb1ce('0x17')](_0x1e24ec);}return _0x136f77[_0xb1ce('0x18')](_0x1e24ec)[_0xb1ce('0x19')]();};}function respondWithResult(_0x3ca5e5,_0x4e90f3){_0x4e90f3=_0x4e90f3||0xc8;return function(_0x29e7fa){if(_0x29e7fa){return _0x3ca5e5['status'](_0x4e90f3)['json'](_0x29e7fa);}};}function respondWithFilteredResult(_0x240b80,_0x2f30af){return function(_0xa78f16){if(_0xa78f16){var _0x20953a=typeof _0x2f30af[_0xb1ce('0x1a')]===_0xb1ce('0x1b')&&typeof _0x2f30af[_0xb1ce('0x1c')]===_0xb1ce('0x1b');var _0x21affd=_0xa78f16[_0xb1ce('0x1d')];var _0x3191ea=_0x20953a?0x0:_0x2f30af[_0xb1ce('0x1a')];var _0x393fcd=_0x20953a?_0xa78f16[_0xb1ce('0x1d')]:_0x2f30af[_0xb1ce('0x1a')]+_0x2f30af[_0xb1ce('0x1c')];var _0x4dc14f;if(_0x393fcd>=_0x21affd){_0x393fcd=_0x21affd;_0x4dc14f=0xc8;}else{_0x4dc14f=0xce;}_0x240b80[_0xb1ce('0x18')](_0x4dc14f);return _0x240b80[_0xb1ce('0x1e')](_0xb1ce('0x1f'),_0x3191ea+'-'+_0x393fcd+'/'+_0x21affd)[_0xb1ce('0x20')](_0xa78f16);}return null;};}function patchUpdates(_0x5edb6f){return function(_0x333e3f){try{jsonpatch[_0xb1ce('0x21')](_0x333e3f,_0x5edb6f,!![]);}catch(_0x19896c){return BPromise[_0xb1ce('0x22')](_0x19896c);}return _0x333e3f[_0xb1ce('0x23')]();};}function saveUpdates(_0x6ca7c1,_0x5d8a99){return function(_0x29c8d9){if(_0x29c8d9){return _0x29c8d9[_0xb1ce('0x24')](_0x6ca7c1)[_0xb1ce('0x25')](function(_0xb07b25){return _0xb07b25;});}return null;};}function removeEntity(_0x3f7d4c,_0x4e98a7){return function(_0x476fff){if(_0x476fff){return _0x476fff[_0xb1ce('0x26')]()[_0xb1ce('0x25')](function(){_0x3f7d4c[_0xb1ce('0x18')](0xcc)[_0xb1ce('0x19')]();});}};}function handleEntityNotFound(_0x5dc818,_0x502fd6){return function(_0x140837){if(!_0x140837){_0x5dc818[_0xb1ce('0x17')](0x194);}return _0x140837;};}function handleError(_0x520606,_0x107e23){_0x107e23=_0x107e23||0x1f4;return function(_0x5362c5){logger[_0xb1ce('0x27')](_0x5362c5[_0xb1ce('0x28')]);if(_0x5362c5[_0xb1ce('0x29')]){delete _0x5362c5['name'];}_0x520606[_0xb1ce('0x18')](_0x107e23)[_0xb1ce('0x2a')](_0x5362c5);};}exports[_0xb1ce('0x2b')]=function(_0x24dc54,_0x3e5175){var _0x89bf1={},_0x2950db={},_0x3aeeda={'count':0x0,'rows':[]};var _0x3e1d46=_[_0xb1ce('0x2c')](db[_0xb1ce('0x2d')][_0xb1ce('0x2e')],function(_0x5c81d8){return{'name':_0x5c81d8[_0xb1ce('0x2f')],'type':_0x5c81d8[_0xb1ce('0x30')][_0xb1ce('0x31')]};});_0x2950db[_0xb1ce('0x32')]=_[_0xb1ce('0x2c')](_0x3e1d46,'name');_0x2950db['query']=_['keys'](_0x24dc54[_0xb1ce('0x33')]);_0x2950db['filters']=_[_0xb1ce('0x34')](_0x2950db['model'],_0x2950db['query']);_0x89bf1[_0xb1ce('0x35')]=_[_0xb1ce('0x34')](_0x2950db['model'],qs['fields'](_0x24dc54[_0xb1ce('0x33')][_0xb1ce('0x36')]));_0x89bf1[_0xb1ce('0x35')]=_0x89bf1[_0xb1ce('0x35')][_0xb1ce('0x37')]?_0x89bf1[_0xb1ce('0x35')]:_0x2950db['model'];if(!_0x24dc54[_0xb1ce('0x33')][_0xb1ce('0x38')](_0xb1ce('0x39'))){_0x89bf1[_0xb1ce('0x1c')]=qs[_0xb1ce('0x1c')](_0x24dc54[_0xb1ce('0x33')][_0xb1ce('0x1c')]);_0x89bf1[_0xb1ce('0x1a')]=qs[_0xb1ce('0x1a')](_0x24dc54['query'][_0xb1ce('0x1a')]);}_0x89bf1['order']=qs[_0xb1ce('0x3a')](_0x24dc54['query'][_0xb1ce('0x3a')]);_0x89bf1[_0xb1ce('0x3b')]=qs[_0xb1ce('0x3c')](_['pick'](_0x24dc54[_0xb1ce('0x33')],_0x2950db[_0xb1ce('0x3c')]),_0x3e1d46);if(_0x24dc54[_0xb1ce('0x33')]['filter']){_0x89bf1[_0xb1ce('0x3b')]=_[_0xb1ce('0x3d')](_0x89bf1[_0xb1ce('0x3b')],{'$or':_[_0xb1ce('0x2c')](_0x3e1d46,function(_0x3b0511){if(_0x3b0511[_0xb1ce('0x30')]!=='VIRTUAL'){var _0x556dc0={};_0x556dc0[_0x3b0511[_0xb1ce('0x29')]]={'$like':'%'+_0x24dc54[_0xb1ce('0x33')]['filter']+'%'};return _0x556dc0;}})});}_0x89bf1=_[_0xb1ce('0x3d')]({},_0x89bf1,_0x24dc54[_0xb1ce('0x3e')]);var _0x318644={'where':_0x89bf1[_0xb1ce('0x3b')]};return db[_0xb1ce('0x2d')]['count'](_0x318644)[_0xb1ce('0x25')](function(_0xb221f7){_0x3aeeda['count']=_0xb221f7;if(_0x24dc54[_0xb1ce('0x33')][_0xb1ce('0x3f')]){_0x89bf1[_0xb1ce('0x40')]=[{'all':!![]}];}return db[_0xb1ce('0x2d')][_0xb1ce('0x41')](_0x89bf1);})[_0xb1ce('0x25')](function(_0x1d3311){_0x3aeeda[_0xb1ce('0x42')]=_0x1d3311;return _0x3aeeda;})[_0xb1ce('0x25')](respondWithFilteredResult(_0x3e5175,_0x89bf1))[_0xb1ce('0x43')](handleError(_0x3e5175,null));};exports['show']=function(_0x3e585c,_0x4c2e3b){var _0x2ff743={'raw':![],'where':{'id':_0x3e585c[_0xb1ce('0x44')]['id']}},_0x31d5a5={};_0x31d5a5[_0xb1ce('0x32')]=_['keys'](db['ZohoAccount']['rawAttributes']);_0x31d5a5['query']=_[_0xb1ce('0x45')](_0x3e585c['query']);_0x31d5a5['filters']=_[_0xb1ce('0x34')](_0x31d5a5[_0xb1ce('0x32')],_0x31d5a5['query']);_0x2ff743[_0xb1ce('0x35')]=_['intersection'](_0x31d5a5[_0xb1ce('0x32')],qs[_0xb1ce('0x36')](_0x3e585c['query'][_0xb1ce('0x36')]));_0x2ff743[_0xb1ce('0x35')]=_0x2ff743[_0xb1ce('0x35')]['length']?_0x2ff743['attributes']:_0x31d5a5['model'];if(_0x3e585c[_0xb1ce('0x33')][_0xb1ce('0x3f')]){_0x2ff743[_0xb1ce('0x40')]=[{'all':!![]}];}_0x2ff743=_[_0xb1ce('0x3d')]({},_0x2ff743,_0x3e585c[_0xb1ce('0x3e')]);return db[_0xb1ce('0x2d')][_0xb1ce('0x46')](_0x2ff743)[_0xb1ce('0x25')](handleEntityNotFound(_0x4c2e3b,null))[_0xb1ce('0x25')](respondWithResult(_0x4c2e3b,null))['catch'](handleError(_0x4c2e3b,null));};exports[_0xb1ce('0x47')]=function(_0x53595e,_0x2996d1){return db[_0xb1ce('0x2d')][_0xb1ce('0x47')](_0x53595e[_0xb1ce('0x48')],{})['then'](respondWithResult(_0x2996d1,0xc9))[_0xb1ce('0x43')](handleError(_0x2996d1,null));};exports['update']=function(_0x11ed4c,_0x353525){if(_0x11ed4c[_0xb1ce('0x48')]['id']){delete _0x11ed4c[_0xb1ce('0x48')]['id'];}return db['ZohoAccount'][_0xb1ce('0x46')]({'where':{'id':_0x11ed4c[_0xb1ce('0x44')]['id']}})[_0xb1ce('0x25')](handleEntityNotFound(_0x353525,null))[_0xb1ce('0x25')](saveUpdates(_0x11ed4c[_0xb1ce('0x48')],null))['then'](respondWithResult(_0x353525,null))[_0xb1ce('0x43')](handleError(_0x353525,null));};exports[_0xb1ce('0x26')]=function(_0x550204,_0x11a637){return db['ZohoAccount'][_0xb1ce('0x46')]({'where':{'id':_0x550204['params']['id']}})['then'](handleEntityNotFound(_0x11a637,null))[_0xb1ce('0x25')](removeEntity(_0x11a637,null))['catch'](handleError(_0x11a637,null));};exports[_0xb1ce('0x49')]=function(_0x3f6d03,_0x5bb1d4,_0x2ce43a){var _0x297540={};var _0x52d925={};var _0x38446c;var _0x22ac93;return db[_0xb1ce('0x2d')][_0xb1ce('0x4a')]({'where':{'id':_0x3f6d03[_0xb1ce('0x44')]['id']}})[_0xb1ce('0x25')](handleEntityNotFound(_0x5bb1d4,null))[_0xb1ce('0x25')](function(_0x4659fb){if(_0x4659fb){_0x38446c=_0x4659fb;_0x52d925[_0xb1ce('0x32')]=_['keys'](db[_0xb1ce('0x4b')]['rawAttributes']);_0x52d925['query']=_[_0xb1ce('0x45')](_0x3f6d03[_0xb1ce('0x33')]);_0x52d925['filters']=_[_0xb1ce('0x34')](_0x52d925[_0xb1ce('0x32')],_0x52d925[_0xb1ce('0x33')]);_0x297540[_0xb1ce('0x35')]=_[_0xb1ce('0x34')](_0x52d925[_0xb1ce('0x32')],qs[_0xb1ce('0x36')](_0x3f6d03['query'][_0xb1ce('0x36')]));_0x297540[_0xb1ce('0x35')]=_0x297540[_0xb1ce('0x35')][_0xb1ce('0x37')]?_0x297540[_0xb1ce('0x35')]:_0x52d925[_0xb1ce('0x32')];_0x297540['order']=qs[_0xb1ce('0x3a')](_0x3f6d03['query'][_0xb1ce('0x3a')]);_0x297540['where']=qs[_0xb1ce('0x3c')](_[_0xb1ce('0x4c')](_0x3f6d03['query'],_0x52d925[_0xb1ce('0x3c')]));if(_0x3f6d03['query'][_0xb1ce('0x4d')]){_0x297540[_0xb1ce('0x3b')]=_['merge'](_0x297540[_0xb1ce('0x3b')],{'$or':_['map'](_0x297540[_0xb1ce('0x35')],function(_0x3bbeda){var _0x42fa68={};_0x42fa68[_0x3bbeda]={'$like':'%'+_0x3f6d03['query'][_0xb1ce('0x4d')]+'%'};return _0x42fa68;})});}_0x297540=_[_0xb1ce('0x3d')]({},_0x297540,_0x3f6d03[_0xb1ce('0x3e')]);return _0x38446c[_0xb1ce('0x49')](_0x297540);}})[_0xb1ce('0x25')](function(_0x3db0bd){if(_0x3db0bd){_0x22ac93=_0x3db0bd[_0xb1ce('0x37')];if(!_0x3f6d03[_0xb1ce('0x33')][_0xb1ce('0x38')](_0xb1ce('0x39'))){_0x297540['limit']=qs[_0xb1ce('0x1c')](_0x3f6d03[_0xb1ce('0x33')]['limit']);_0x297540['offset']=qs[_0xb1ce('0x1a')](_0x3f6d03[_0xb1ce('0x33')][_0xb1ce('0x1a')]);}return _0x38446c['getConfigurations'](_0x297540);}})['then'](function(_0x3280a4){if(_0x3280a4){return _0x3280a4?{'count':_0x22ac93,'rows':_0x3280a4}:null;}})[_0xb1ce('0x25')](respondWithResult(_0x5bb1d4,null))[_0xb1ce('0x43')](handleError(_0x5bb1d4,null));};exports[_0xb1ce('0x4e')]=function(_0x3658f1,_0xacb351,_0x55a732){if(_0x3658f1[_0xb1ce('0x48')]['id']){delete _0x3658f1['body']['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x3658f1[_0xb1ce('0x44')]['id']}})['then'](handleEntityNotFound(_0xacb351,null))[_0xb1ce('0x25')](function(_0x10d560){if(_0x10d560){_0x3658f1[_0xb1ce('0x48')][_0xb1ce('0x4f')]=_0x10d560['id'];_0x3658f1[_0xb1ce('0x48')][_0xb1ce('0x50')]=integrations[_0xb1ce('0x51')](_0x3658f1['body']['channel'],_0x3658f1[_0xb1ce('0x48')][_0xb1ce('0x30')]);_0x3658f1[_0xb1ce('0x48')][_0xb1ce('0x52')]=integrations[_0xb1ce('0x53')](_0x3658f1[_0xb1ce('0x48')][_0xb1ce('0x54')],_0x3658f1[_0xb1ce('0x48')][_0xb1ce('0x30')]);return db['ZohoConfiguration']['create'](_0x3658f1[_0xb1ce('0x48')],{'include':[{'model':db[_0xb1ce('0x55')],'as':'Subjects'},{'model':db[_0xb1ce('0x55')],'as':_0xb1ce('0x52')}]});}return null;})[_0xb1ce('0x25')](respondWithResult(_0xacb351,null))[_0xb1ce('0x43')](handleError(_0xacb351,null));};function getAccessToken(_0x16d2f0){return new Promise(function(_0x6cae9,_0x1e15cc){var _0x2aa1a5;switch(_0x16d2f0['zone']){case'US':_0x2aa1a5='https://accounts.zoho.com';break;case'AU':_0x2aa1a5=_0xb1ce('0x56');break;case'EU':_0x2aa1a5=_0xb1ce('0x57');break;case'IN':_0x2aa1a5='https://accounts.zoho.in';break;case'CN':_0x2aa1a5=_0xb1ce('0x58');break;default:_0x2aa1a5=_0xb1ce('0x57');break;}var _0x535747={'method':_0xb1ce('0x59'),'uri':_0x2aa1a5+_0xb1ce('0x5a'),'qs':{'refresh_token':_0x16d2f0['refreshToken'],'client_id':_0x16d2f0['clientId'],'client_secret':_0x16d2f0[_0xb1ce('0x5b')],'grant_type':_0xb1ce('0x5c')},'json':!![]};return rp(_0x535747)[_0xb1ce('0x25')](function(_0x5904be){if(_0x5904be[_0xb1ce('0x5d')]){_0x6cae9(_0x5904be[_0xb1ce('0x5d')]);}else{_0x1e15cc(_0xb1ce('0x5e'));}})['catch'](function(_0xee5b69){_0x1e15cc(_0xee5b69);});});}exports['getFields']=function(_0x24f66c,_0x2fa8d7,_0x553d26){var _0x39d7c7,_0x452f52,_0x5dad62,_0x130685,_0x57ec6b;return db[_0xb1ce('0x2d')][_0xb1ce('0x4a')]({'where':{'id':_0x24f66c['params']['id']},'attributes':['id',_0xb1ce('0x5f'),_0xb1ce('0x60'),_0xb1ce('0x61'),_0xb1ce('0x5b'),'serverUrl',_0xb1ce('0x62'),_0xb1ce('0x63')]})[_0xb1ce('0x25')](handleEntityNotFound(_0x2fa8d7,null))[_0xb1ce('0x25')](function(_0xbc08d1){_0x57ec6b=_0xbc08d1;_0x39d7c7=_0x57ec6b[_0xb1ce('0x5f')];_0x452f52=_0x39d7c7===_0xb1ce('0x64')?'eu':_0xb1ce('0x65');_0x5dad62=_0x57ec6b['serverUrl'];var _0x2f480c=_0x5dad62[_0xb1ce('0x66')](-0x1);if(_0x2f480c==='/'||_0x2f480c==='\x5c'||_0x2f480c===':'){_0x5dad62=_0x5dad62[_0xb1ce('0x67')](0x0,_0x5dad62[_0xb1ce('0x68')](_0x2f480c));}if(!_0x57ec6b[_0xb1ce('0x63')]){throw new Error(_0xb1ce('0x69'));}return getAccessToken(_0x57ec6b);})[_0xb1ce('0x25')](function(_0x2ab660){if(_0x2ab660){return rp({'method':_0xb1ce('0x6a'),'uri':util['format'](_0xb1ce('0x6b'),_0x452f52),'qs':{'module':_0xb1ce('0x6c')},'headers':{'Authorization':_0xb1ce('0x6d')+_0x2ab660},'json':!![]});}})['then'](function(_0x34b3fc){if(_0x34b3fc){if(_0x34b3fc['response']&&_0x34b3fc[_0xb1ce('0x6e')][_0xb1ce('0x27')]){throw new Error(_0x34b3fc['response'][_0xb1ce('0x27')][_0xb1ce('0x6f')]);}var _0x472fb8=[];var _0x38c101=[];var _0x1e3898=[_0xb1ce('0x70'),'Subject',_0xb1ce('0x71'),_0xb1ce('0x72'),_0xb1ce('0x73'),_0xb1ce('0x74'),'Call_Start_Time','Call_Type'];_0x38c101=_[_0xb1ce('0x75')](_0x34b3fc['fields'],function(_0x8d26be){return _0x1e3898[_0xb1ce('0x76')](_0x8d26be[_0xb1ce('0x77')]);});for(var _0x1d36c2=0x0;_0x1d36c2<_0x38c101['length'];_0x1d36c2++){if(_0x38c101[_0x1d36c2][_0xb1ce('0x78')]===![]){_0x472fb8[_0xb1ce('0x79')]({'id':_0x38c101[_0x1d36c2]['id'],'name':_0x38c101[_0x1d36c2][_0xb1ce('0x7a')],'custom':_0x38c101[_0x1d36c2][_0xb1ce('0x7b')],'options':_0x38c101[_0x1d36c2]['data_type']===_0xb1ce('0x7c')&&_0x38c101[_0x1d36c2][_0xb1ce('0x7d')]['length']>-0x1?_['map'](_0x38c101[_0x1d36c2]['pick_list_values'],function(_0x576d77){return{'name':_0x576d77,'value':_0x576d77};}):[]});}}return{'count':_0x472fb8['length'],'rows':_0x472fb8};}else{return{'count':0x0,'rows':[]};}})[_0xb1ce('0x25')](respondWithResult(_0x2fa8d7,null))['catch'](function(_0x156d22){var _0x544c98=_0x24f66c['query'][_0xb1ce('0x7e')]?0x1f4:_0x156d22[_0xb1ce('0x7f')]||0x1f4;logger[_0xb1ce('0x27')](_0xb1ce('0x80'),_0xb1ce('0x81'),_0x544c98,JSON[_0xb1ce('0x82')](_0x156d22));delete _0x156d22[_0xb1ce('0x29')];if(_0x544c98===0x191){_0x544c98=0x190;}_0x2fa8d7[_0xb1ce('0x18')](_0x544c98)[_0xb1ce('0x2a')](_0x24f66c['query']['test']?{'message':_0xb1ce('0x83'),'statusCode':_0x156d22[_0xb1ce('0x7f')]}:_0x156d22);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 7688ba7..08dcb84 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 _0x723e=['/oauth/v2/token','authorization_code','clientId','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientSecret','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST'];(function(_0x25c6d3,_0x42e5cb){var _0x7bd5d9=function(_0x317a4a){while(--_0x317a4a){_0x25c6d3['push'](_0x25c6d3['shift']());}};_0x7bd5d9(++_0x42e5cb);}(_0x723e,0x19d));var _0xe723=function(_0x1c5916,_0x2be108){_0x1c5916=_0x1c5916-0x0;var _0x37dcd5=_0x723e[_0x1c5916];return _0x37dcd5;};'use strict';var _=require(_0xe723('0x0'));var util=require('util');var logger=require(_0xe723('0x1'))(_0xe723('0x2'));var moment=require(_0xe723('0x3'));var BPromise=require(_0xe723('0x4'));var rp=require(_0xe723('0x5'));var fs=require('fs');var path=require(_0xe723('0x6'));var rimraf=require(_0xe723('0x7'));var config=require('../../config/environment');var attributes=require(_0xe723('0x8'));var integrations=require(_0xe723('0x9'));module[_0xe723('0xa')]=function(_0x114c49,_0x25ef65){return _0x114c49[_0xe723('0xb')](_0xe723('0xc'),attributes,{'tableName':_0xe723('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xe509b7,_0x45faac,_0x3ac2ec){if(_0xe509b7[_0xe723('0xe')](_0xe723('0xf'))||_0xe509b7[_0xe723('0xe')](_0xe723('0x10'))||_0xe509b7[_0xe723('0xe')]('clientId')||_0xe509b7['changed'](_0xe723('0x11'))||_0xe509b7['changed']('code')||_0xe509b7[_0xe723('0xe')](_0xe723('0x12'))){var _0x259228,_0x576858;_0x259228=_0xe509b7['serverUrl'];var _0x262539=_0x259228[_0xe723('0x13')](-0x1);if(_0x262539==='/'||_0x262539==='\x5c'||_0x262539===':'){_0x259228=_0x259228[_0xe723('0x14')](0x0,_0x259228[_0xe723('0x15')](_0x262539));}switch(_0xe509b7['zone']){case'US':_0x576858=_0xe723('0x16');break;case'AU':_0x576858='https://accounts.zoho.com.au';break;case'IN':_0x576858=_0xe723('0x17');break;case'CN':_0x576858=_0xe723('0x18');break;default:_0x576858=_0xe723('0x19');break;}var _0x175436={'method':_0xe723('0x1a'),'uri':_0x576858+_0xe723('0x1b'),'form':{'grant_type':_0xe723('0x1c'),'client_id':_0xe509b7[_0xe723('0x1d')],'client_secret':_0xe509b7[_0xe723('0x11')],'redirect_uri':_0xe509b7[_0xe723('0x10')],'code':_0xe509b7[_0xe723('0x1e')]},'headers':{'Content-Type':_0xe723('0x1f')}};return rp(_0x175436)[_0xe723('0x20')](function(_0x416026){var _0xff3176=JSON[_0xe723('0x21')](_0x416026);if(_0xff3176[_0xe723('0x22')]){_0xe509b7[_0xe723('0x23')]=_0xff3176[_0xe723('0x22')];logger[_0xe723('0x24')](util['format'](_0xe723('0x25'),_0xe509b7[_0xe723('0x26')],_0xe509b7['id']));}else{logger[_0xe723('0x27')](util[_0xe723('0x28')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xe509b7[_0xe723('0x26')],_0xe509b7['id']),util[_0xe723('0x29')](_0xff3176,{'showHidden':![],'depth':null}));}return _0x3ac2ec(null,_0x45faac);})[_0xe723('0x2a')](function(_0x173419){logger[_0xe723('0x27')](util[_0xe723('0x28')](_0xe723('0x2b'),_0xe509b7[_0xe723('0x26')],_0xe509b7['id']),util[_0xe723('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0x3ac2ec(_0x173419);});}else{return _0x3ac2ec(null,_0x45faac);}},'beforeUpdate':function(_0x24b6dd,_0x2c3f2c,_0xa586fb){if(_0x24b6dd['changed'](_0xe723('0xf'))||_0x24b6dd[_0xe723('0xe')](_0xe723('0x10'))||_0x24b6dd[_0xe723('0xe')](_0xe723('0x1d'))||_0x24b6dd[_0xe723('0xe')](_0xe723('0x11'))||_0x24b6dd[_0xe723('0xe')](_0xe723('0x1e'))||_0x24b6dd[_0xe723('0xe')](_0xe723('0x12'))){var _0x2b3a6e,_0x414e9a;_0x2b3a6e=_0x24b6dd[_0xe723('0x10')];var _0x5d0421=_0x2b3a6e[_0xe723('0x13')](-0x1);if(_0x5d0421==='/'||_0x5d0421==='\x5c'||_0x5d0421===':'){_0x2b3a6e=_0x2b3a6e[_0xe723('0x14')](0x0,_0x2b3a6e['lastIndexOf'](_0x5d0421));}switch(_0x24b6dd[_0xe723('0xf')]){case'US':_0x414e9a=_0xe723('0x16');break;case'AU':_0x414e9a='https://accounts.zoho.com.au';break;case'IN':_0x414e9a=_0xe723('0x17');break;case'CN':_0x414e9a=_0xe723('0x18');break;default:_0x414e9a='https://accounts.zoho.eu';break;}var _0x1374e8={'method':_0xe723('0x1a'),'uri':_0x414e9a+'/oauth/v2/token','form':{'grant_type':_0xe723('0x1c'),'client_id':_0x24b6dd[_0xe723('0x1d')],'client_secret':_0x24b6dd[_0xe723('0x11')],'redirect_uri':_0x24b6dd['serverUrl'],'code':_0x24b6dd['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1374e8)['then'](function(_0x343959){var _0x5ba5a3=JSON['parse'](_0x343959);if(_0x5ba5a3[_0xe723('0x22')]){_0x24b6dd[_0xe723('0x23')]=_0x5ba5a3[_0xe723('0x22')];logger['info'](util[_0xe723('0x28')](_0xe723('0x25'),_0x24b6dd[_0xe723('0x26')],_0x24b6dd['id']));}else{logger[_0xe723('0x27')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x24b6dd[_0xe723('0x26')],_0x24b6dd['id']),util[_0xe723('0x29')](_0x5ba5a3,{'showHidden':![],'depth':null}));}return _0xa586fb(null,_0x2c3f2c);})[_0xe723('0x2a')](function(_0x2761af){logger[_0xe723('0x27')](util[_0xe723('0x28')](_0xe723('0x2b'),_0x24b6dd[_0xe723('0x26')],_0x24b6dd['id']),util[_0xe723('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0xa586fb(_0x2761af);});}else{return _0xa586fb(null,_0x2c3f2c);}}}});}; \ No newline at end of file +var _0x13c5=['../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','serverUrl','changed','clientId','host','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientSecret','code','then','parse','refresh_token','refreshToken','info','format','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','slice','https://accounts.zoho.in','application/x-www-form-urlencoded','error','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x4dc347,_0x4cc08b){var _0x235d35=function(_0x50e3f0){while(--_0x50e3f0){_0x4dc347['push'](_0x4dc347['shift']());}};_0x235d35(++_0x4cc08b);}(_0x13c5,0x1c8));var _0x513c=function(_0x26b4cc,_0x4af276){_0x26b4cc=_0x26b4cc-0x0;var _0x4815b3=_0x13c5[_0x26b4cc];return _0x4815b3;};'use strict';var _=require(_0x513c('0x0'));var util=require('util');var logger=require(_0x513c('0x1'))('api');var moment=require(_0x513c('0x2'));var BPromise=require(_0x513c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x513c('0x4'));var rimraf=require(_0x513c('0x5'));var config=require(_0x513c('0x6'));var attributes=require(_0x513c('0x7'));var integrations=require(_0x513c('0x8'));module[_0x513c('0x9')]=function(_0x28f321,_0x557533){return _0x28f321[_0x513c('0xa')](_0x513c('0xb'),attributes,{'tableName':_0x513c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x28962a,_0x17dbea,_0x2909ad){if(_0x28962a['changed']('zone')||_0x28962a['changed'](_0x513c('0xd'))||_0x28962a[_0x513c('0xe')](_0x513c('0xf'))||_0x28962a[_0x513c('0xe')]('clientSecret')||_0x28962a[_0x513c('0xe')]('code')||_0x28962a[_0x513c('0xe')](_0x513c('0x10'))){var _0x227cca,_0x24349a;_0x227cca=_0x28962a['serverUrl'];var _0x4ea171=_0x227cca['slice'](-0x1);if(_0x4ea171==='/'||_0x4ea171==='\x5c'||_0x4ea171===':'){_0x227cca=_0x227cca[_0x513c('0x11')](0x0,_0x227cca[_0x513c('0x12')](_0x4ea171));}switch(_0x28962a[_0x513c('0x13')]){case'US':_0x24349a=_0x513c('0x14');break;case'AU':_0x24349a=_0x513c('0x15');break;case'IN':_0x24349a='https://accounts.zoho.in';break;case'CN':_0x24349a=_0x513c('0x16');break;default:_0x24349a=_0x513c('0x17');break;}var _0x5e4a01={'method':'POST','uri':_0x24349a+_0x513c('0x18'),'form':{'grant_type':_0x513c('0x19'),'client_id':_0x28962a[_0x513c('0xf')],'client_secret':_0x28962a[_0x513c('0x1a')],'redirect_uri':_0x28962a[_0x513c('0xd')],'code':_0x28962a[_0x513c('0x1b')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x5e4a01)[_0x513c('0x1c')](function(_0x4717cd){var _0x250eef=JSON[_0x513c('0x1d')](_0x4717cd);if(_0x250eef[_0x513c('0x1e')]){_0x28962a[_0x513c('0x1f')]=_0x250eef[_0x513c('0x1e')];logger[_0x513c('0x20')](util[_0x513c('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x28962a[_0x513c('0x22')],_0x28962a['id']));}else{logger['error'](util['format'](_0x513c('0x23'),_0x28962a[_0x513c('0x22')],_0x28962a['id']),util['inspect'](_0x250eef,{'showHidden':![],'depth':null}));}return _0x2909ad(null,_0x17dbea);})[_0x513c('0x24')](function(_0x4d6430){logger['error'](util[_0x513c('0x21')](_0x513c('0x23'),_0x28962a[_0x513c('0x22')],_0x28962a['id']),util[_0x513c('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x2909ad(_0x4d6430);});}else{return _0x2909ad(null,_0x17dbea);}},'beforeUpdate':function(_0x473e4b,_0x2b7b9b,_0x19ac64){if(_0x473e4b[_0x513c('0xe')](_0x513c('0x13'))||_0x473e4b[_0x513c('0xe')](_0x513c('0xd'))||_0x473e4b[_0x513c('0xe')](_0x513c('0xf'))||_0x473e4b[_0x513c('0xe')](_0x513c('0x1a'))||_0x473e4b[_0x513c('0xe')](_0x513c('0x1b'))||_0x473e4b[_0x513c('0xe')](_0x513c('0x10'))){var _0x953fc3,_0x596a12;_0x953fc3=_0x473e4b[_0x513c('0xd')];var _0x4a0bf0=_0x953fc3[_0x513c('0x26')](-0x1);if(_0x4a0bf0==='/'||_0x4a0bf0==='\x5c'||_0x4a0bf0===':'){_0x953fc3=_0x953fc3['substring'](0x0,_0x953fc3[_0x513c('0x12')](_0x4a0bf0));}switch(_0x473e4b[_0x513c('0x13')]){case'US':_0x596a12=_0x513c('0x14');break;case'AU':_0x596a12=_0x513c('0x15');break;case'IN':_0x596a12=_0x513c('0x27');break;case'CN':_0x596a12=_0x513c('0x16');break;default:_0x596a12=_0x513c('0x17');break;}var _0x43f640={'method':'POST','uri':_0x596a12+_0x513c('0x18'),'form':{'grant_type':_0x513c('0x19'),'client_id':_0x473e4b[_0x513c('0xf')],'client_secret':_0x473e4b['clientSecret'],'redirect_uri':_0x473e4b['serverUrl'],'code':_0x473e4b[_0x513c('0x1b')]},'headers':{'Content-Type':_0x513c('0x28')}};return rp(_0x43f640)[_0x513c('0x1c')](function(_0xba5995){var _0x228551=JSON[_0x513c('0x1d')](_0xba5995);if(_0x228551[_0x513c('0x1e')]){_0x473e4b[_0x513c('0x1f')]=_0x228551[_0x513c('0x1e')];logger[_0x513c('0x20')](util[_0x513c('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x473e4b[_0x513c('0x22')],_0x473e4b['id']));}else{logger[_0x513c('0x29')](util[_0x513c('0x21')](_0x513c('0x23'),_0x473e4b[_0x513c('0x22')],_0x473e4b['id']),util[_0x513c('0x25')](_0x228551,{'showHidden':![],'depth':null}));}return _0x19ac64(null,_0x2b7b9b);})[_0x513c('0x24')](function(_0x3822ea){logger['error'](util['format'](_0x513c('0x23'),_0x473e4b[_0x513c('0x22')],_0x473e4b['id']),util[_0x513c('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x19ac64(_0x3822ea);});}else{return _0x19ac64(null,_0x2b7b9b);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index f9cbdb6..6c9dd44 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 _0x29b6=['include','map','model','then','GetZohoAccount','catch','find','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoAccount','options','raw','attributes','limit'];(function(_0x54a9e3,_0x4a3813){var _0x247cce=function(_0x50aa49){while(--_0x50aa49){_0x54a9e3['push'](_0x54a9e3['shift']());}};_0x247cce(++_0x4a3813);}(_0x29b6,0x17e));var _0x629b=function(_0x1a8481,_0x27cb4b){_0x1a8481=_0x1a8481-0x0;var _0x2ca75f=_0x29b6[_0x1a8481];return _0x2ca75f;};'use strict';var _=require(_0x629b('0x0'));var util=require(_0x629b('0x1'));var moment=require(_0x629b('0x2'));var BPromise=require(_0x629b('0x3'));var rs=require(_0x629b('0x4'));var fs=require('fs');var Redis=require(_0x629b('0x5'));var db=require(_0x629b('0x6'))['db'];var utils=require(_0x629b('0x7'));var logger=require(_0x629b('0x8'))(_0x629b('0x9'));var config=require('../../config/environment');var jayson=require(_0x629b('0xa'));var client=jayson['client'][_0x629b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4acc5a,_0x26e439,_0x398ecb){return new BPromise(function(_0x4e90cd,_0xc44b27){return client[_0x629b('0xc')](_0x4acc5a,_0x398ecb)['then'](function(_0x28c152){logger[_0x629b('0xd')](_0x629b('0xe'),_0x26e439,_0x629b('0xf'));logger[_0x629b('0x10')](_0x629b('0x11'),_0x26e439,_0x629b('0xf'),JSON[_0x629b('0x12')](_0x28c152));if(_0x28c152[_0x629b('0x13')]){if(_0x28c152[_0x629b('0x13')]['code']===0x1f4){logger['error'](_0x629b('0xe'),_0x26e439,_0x28c152[_0x629b('0x13')][_0x629b('0x14')]);return _0xc44b27(_0x28c152['error'][_0x629b('0x14')]);}logger[_0x629b('0x13')](_0x629b('0xe'),_0x26e439,_0x28c152[_0x629b('0x13')]['message']);return _0x4e90cd(_0x28c152[_0x629b('0x13')][_0x629b('0x14')]);}else{logger[_0x629b('0xd')](_0x629b('0xe'),_0x26e439,_0x629b('0xf'));_0x4e90cd(_0x28c152['result'][_0x629b('0x14')]);}})['catch'](function(_0x151b93){logger[_0x629b('0x13')](_0x629b('0xe'),_0x26e439,_0x151b93);_0xc44b27(_0x151b93);});});}exports['GetZohoAccount']=function(_0x7f24d3){var _0x58f5a8=this;return new Promise(function(_0x1c93a1,_0x4f28dd){return db[_0x629b('0x15')]['findAll']({'raw':_0x7f24d3[_0x629b('0x16')]?_0x7f24d3[_0x629b('0x16')][_0x629b('0x17')]===undefined?!![]:![]:!![],'where':_0x7f24d3['options']?_0x7f24d3[_0x629b('0x16')]['where']||null:null,'attributes':_0x7f24d3[_0x629b('0x16')]?_0x7f24d3[_0x629b('0x16')][_0x629b('0x18')]||null:null,'limit':_0x7f24d3[_0x629b('0x16')]?_0x7f24d3['options'][_0x629b('0x19')]||null:null,'include':_0x7f24d3['options']?_0x7f24d3[_0x629b('0x16')][_0x629b('0x1a')]?_[_0x629b('0x1b')](_0x7f24d3['options'][_0x629b('0x1a')],function(_0x1e773e){return{'model':db[_0x1e773e[_0x629b('0x1c')]],'as':_0x1e773e['as'],'attributes':_0x1e773e[_0x629b('0x18')],'include':_0x1e773e[_0x629b('0x1a')]?_[_0x629b('0x1b')](_0x1e773e[_0x629b('0x1a')],function(_0x547b3c){return{'model':db[_0x547b3c['model']],'as':_0x547b3c['as'],'attributes':_0x547b3c['attributes'],'include':_0x547b3c['include']?_[_0x629b('0x1b')](_0x547b3c[_0x629b('0x1a')],function(_0xf68af8){return{'model':db[_0xf68af8[_0x629b('0x1c')]],'as':_0xf68af8['as'],'attributes':_0xf68af8[_0x629b('0x18')]};}):[]};}):[]};}):[]:[]})[_0x629b('0x1d')](function(_0x4c1f21){logger[_0x629b('0xd')](_0x629b('0x1e'),_0x7f24d3);logger[_0x629b('0x10')](_0x629b('0x1e'),_0x7f24d3,JSON[_0x629b('0x12')](_0x4c1f21));_0x1c93a1(_0x4c1f21);})[_0x629b('0x1f')](function(_0x3ef549){logger[_0x629b('0x13')]('GetZohoAccount',_0x3ef549['message'],_0x7f24d3);_0x4f28dd(_0x58f5a8[_0x629b('0x13')](0x1f4,_0x3ef549[_0x629b('0x14')]));});});};exports['ShowZohoAccount']=function(_0x1628cb){var _0x56c088=this;return new Promise(function(_0x86ee7c,_0x37b918){return db['ZohoAccount'][_0x629b('0x20')]({'raw':_0x1628cb[_0x629b('0x16')]?_0x1628cb[_0x629b('0x16')][_0x629b('0x17')]===undefined?!![]:![]:!![],'where':_0x1628cb[_0x629b('0x16')]?_0x1628cb[_0x629b('0x16')]['where']||null:null,'attributes':_0x1628cb[_0x629b('0x16')]?_0x1628cb[_0x629b('0x16')][_0x629b('0x18')]||null:null,'include':_0x1628cb[_0x629b('0x16')]?_0x1628cb[_0x629b('0x16')][_0x629b('0x1a')]?_[_0x629b('0x1b')](_0x1628cb[_0x629b('0x16')][_0x629b('0x1a')],function(_0x26a541){return{'model':db[_0x26a541[_0x629b('0x1c')]],'as':_0x26a541['as'],'attributes':_0x26a541[_0x629b('0x18')],'include':_0x26a541[_0x629b('0x1a')]?_['map'](_0x26a541['include'],function(_0x17aaef){return{'model':db[_0x17aaef[_0x629b('0x1c')]],'as':_0x17aaef['as'],'attributes':_0x17aaef[_0x629b('0x18')],'include':_0x17aaef[_0x629b('0x1a')]?_['map'](_0x17aaef[_0x629b('0x1a')],function(_0x202348){return{'model':db[_0x202348[_0x629b('0x1c')]],'as':_0x202348['as'],'attributes':_0x202348[_0x629b('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13cac7){logger[_0x629b('0xd')](_0x629b('0x21'),_0x1628cb);logger[_0x629b('0x10')](_0x629b('0x21'),_0x1628cb,JSON['stringify'](_0x13cac7));_0x86ee7c(_0x13cac7);})[_0x629b('0x1f')](function(_0x4024c7){logger[_0x629b('0x13')](_0x629b('0x21'),_0x4024c7[_0x629b('0x14')],_0x1628cb);_0x37b918(_0x56c088[_0x629b('0x13')](0x1f4,_0x4024c7[_0x629b('0x14')]));});});}; \ No newline at end of file +var _0xbe2c=['result','catch','ZohoAccount','findAll','options','where','attributes','include','map','model','then','GetZohoAccount','debug','ShowZohoAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3bd426,_0x57dfbb){var _0x397221=function(_0x331444){while(--_0x331444){_0x3bd426['push'](_0x3bd426['shift']());}};_0x397221(++_0x57dfbb);}(_0xbe2c,0x18f));var _0xcbe2=function(_0x2312fd,_0x14b86d){_0x2312fd=_0x2312fd-0x0;var _0x3ad224=_0xbe2c[_0x2312fd];return _0x3ad224;};'use strict';var _=require(_0xcbe2('0x0'));var util=require(_0xcbe2('0x1'));var moment=require('moment');var BPromise=require(_0xcbe2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbe2('0x3'));var db=require(_0xcbe2('0x4'))['db'];var utils=require(_0xcbe2('0x5'));var logger=require(_0xcbe2('0x6'))(_0xcbe2('0x7'));var config=require('../../config/environment');var jayson=require(_0xcbe2('0x8'));var client=jayson[_0xcbe2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0389,_0x3eb920,_0x1c28ab){return new BPromise(function(_0x294a61,_0x21233e){return client['request'](_0x2c0389,_0x1c28ab)['then'](function(_0xb7fe3c){logger[_0xcbe2('0xa')](_0xcbe2('0xb'),_0x3eb920,_0xcbe2('0xc'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3eb920,_0xcbe2('0xc'),JSON[_0xcbe2('0xd')](_0xb7fe3c));if(_0xb7fe3c[_0xcbe2('0xe')]){if(_0xb7fe3c[_0xcbe2('0xe')][_0xcbe2('0xf')]===0x1f4){logger[_0xcbe2('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x3eb920,_0xb7fe3c[_0xcbe2('0xe')][_0xcbe2('0x10')]);return _0x21233e(_0xb7fe3c['error'][_0xcbe2('0x10')]);}logger['error'](_0xcbe2('0xb'),_0x3eb920,_0xb7fe3c['error'][_0xcbe2('0x10')]);return _0x294a61(_0xb7fe3c['error']['message']);}else{logger[_0xcbe2('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x3eb920,_0xcbe2('0xc'));_0x294a61(_0xb7fe3c[_0xcbe2('0x11')][_0xcbe2('0x10')]);}})[_0xcbe2('0x12')](function(_0x40dc0f){logger[_0xcbe2('0xe')](_0xcbe2('0xb'),_0x3eb920,_0x40dc0f);_0x21233e(_0x40dc0f);});});}exports['GetZohoAccount']=function(_0xb968ac){var _0x5acacd=this;return new Promise(function(_0x1c09cb,_0xff2918){return db[_0xcbe2('0x13')][_0xcbe2('0x14')]({'raw':_0xb968ac['options']?_0xb968ac[_0xcbe2('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0xb968ac['options']?_0xb968ac[_0xcbe2('0x15')][_0xcbe2('0x16')]||null:null,'attributes':_0xb968ac[_0xcbe2('0x15')]?_0xb968ac['options'][_0xcbe2('0x17')]||null:null,'limit':_0xb968ac[_0xcbe2('0x15')]?_0xb968ac[_0xcbe2('0x15')]['limit']||null:null,'include':_0xb968ac[_0xcbe2('0x15')]?_0xb968ac[_0xcbe2('0x15')][_0xcbe2('0x18')]?_[_0xcbe2('0x19')](_0xb968ac[_0xcbe2('0x15')][_0xcbe2('0x18')],function(_0x2f1e25){return{'model':db[_0x2f1e25[_0xcbe2('0x1a')]],'as':_0x2f1e25['as'],'attributes':_0x2f1e25['attributes'],'include':_0x2f1e25[_0xcbe2('0x18')]?_[_0xcbe2('0x19')](_0x2f1e25['include'],function(_0x40039f){return{'model':db[_0x40039f[_0xcbe2('0x1a')]],'as':_0x40039f['as'],'attributes':_0x40039f[_0xcbe2('0x17')],'include':_0x40039f[_0xcbe2('0x18')]?_[_0xcbe2('0x19')](_0x40039f['include'],function(_0xbc5aab){return{'model':db[_0xbc5aab[_0xcbe2('0x1a')]],'as':_0xbc5aab['as'],'attributes':_0xbc5aab['attributes']};}):[]};}):[]};}):[]:[]})[_0xcbe2('0x1b')](function(_0x5ad2e9){logger[_0xcbe2('0xa')](_0xcbe2('0x1c'),_0xb968ac);logger[_0xcbe2('0x1d')](_0xcbe2('0x1c'),_0xb968ac,JSON['stringify'](_0x5ad2e9));_0x1c09cb(_0x5ad2e9);})[_0xcbe2('0x12')](function(_0x37eb8b){logger['error'](_0xcbe2('0x1c'),_0x37eb8b[_0xcbe2('0x10')],_0xb968ac);_0xff2918(_0x5acacd[_0xcbe2('0xe')](0x1f4,_0x37eb8b[_0xcbe2('0x10')]));});});};exports[_0xcbe2('0x1e')]=function(_0x3cffd1){var _0x3744f3=this;return new Promise(function(_0x8824fc,_0x39ab14){return db[_0xcbe2('0x13')][_0xcbe2('0x1f')]({'raw':_0x3cffd1[_0xcbe2('0x15')]?_0x3cffd1[_0xcbe2('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3cffd1[_0xcbe2('0x15')]?_0x3cffd1[_0xcbe2('0x15')]['where']||null:null,'attributes':_0x3cffd1['options']?_0x3cffd1[_0xcbe2('0x15')]['attributes']||null:null,'include':_0x3cffd1[_0xcbe2('0x15')]?_0x3cffd1[_0xcbe2('0x15')][_0xcbe2('0x18')]?_[_0xcbe2('0x19')](_0x3cffd1[_0xcbe2('0x15')][_0xcbe2('0x18')],function(_0x183953){return{'model':db[_0x183953['model']],'as':_0x183953['as'],'attributes':_0x183953[_0xcbe2('0x17')],'include':_0x183953['include']?_['map'](_0x183953[_0xcbe2('0x18')],function(_0x4bd628){return{'model':db[_0x4bd628[_0xcbe2('0x1a')]],'as':_0x4bd628['as'],'attributes':_0x4bd628['attributes'],'include':_0x4bd628[_0xcbe2('0x18')]?_[_0xcbe2('0x19')](_0x4bd628['include'],function(_0x97be46){return{'model':db[_0x97be46['model']],'as':_0x97be46['as'],'attributes':_0x97be46[_0xcbe2('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e9023){logger[_0xcbe2('0xa')]('ShowZohoAccount',_0x3cffd1);logger['debug'](_0xcbe2('0x1e'),_0x3cffd1,JSON['stringify'](_0x5e9023));_0x8824fc(_0x5e9023);})[_0xcbe2('0x12')](function(_0xc0cc08){logger[_0xcbe2('0xe')]('ShowZohoAccount',_0xc0cc08[_0xcbe2('0x10')],_0x3cffd1);_0x39ab14(_0x3744f3[_0xcbe2('0xe')](0x1f4,_0xc0cc08['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 1d62ddb..e9fbf9b 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 _0x771a=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id'];(function(_0x43e08c,_0x595324){var _0x329f2b=function(_0x20ca09){while(--_0x20ca09){_0x43e08c['push'](_0x43e08c['shift']());}};_0x329f2b(++_0x595324);}(_0x771a,0x1d9));var _0xa771=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x771a[_0x20589d];return _0x422de9;};'use strict';var multer=require(_0xa771('0x0'));var util=require('util');var path=require(_0xa771('0x1'));var timeout=require(_0xa771('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa771('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa771('0x4'));var config=require(_0xa771('0x5'));var controller=require(_0xa771('0x6'));router[_0xa771('0x7')]('/',auth[_0xa771('0x8')](),controller['index']);router[_0xa771('0x7')](_0xa771('0x9'),auth['isAuthenticated'](),controller[_0xa771('0xa')]);router['get'](_0xa771('0xb'),auth[_0xa771('0x8')](),controller[_0xa771('0xc')]);router[_0xa771('0x7')](_0xa771('0xd'),auth[_0xa771('0x8')](),controller[_0xa771('0xe')]);router[_0xa771('0x7')](_0xa771('0xf'),auth[_0xa771('0x8')](),controller['getDescriptions']);router[_0xa771('0x10')]('/',auth[_0xa771('0x8')](),controller[_0xa771('0x11')]);router['put'](_0xa771('0x9'),auth[_0xa771('0x8')](),controller[_0xa771('0x12')]);router['delete'](_0xa771('0x9'),auth[_0xa771('0x8')](),controller[_0xa771('0x13')]);module[_0xa771('0x14')]=router; \ No newline at end of file +var _0x6cfe=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6cfe,0x81));var _0xe6cf=function(_0x587e59,_0x494190){_0x587e59=_0x587e59-0x0;var _0x59242d=_0x6cfe[_0x587e59];return _0x59242d;};'use strict';var multer=require(_0xe6cf('0x0'));var util=require(_0xe6cf('0x1'));var path=require(_0xe6cf('0x2'));var timeout=require(_0xe6cf('0x3'));var express=require(_0xe6cf('0x4'));var router=express[_0xe6cf('0x5')]();var fs_extra=require(_0xe6cf('0x6'));var auth=require(_0xe6cf('0x7'));var interaction=require(_0xe6cf('0x8'));var config=require('../../config/environment');var controller=require(_0xe6cf('0x9'));router['get']('/',auth[_0xe6cf('0xa')](),controller['index']);router[_0xe6cf('0xb')](_0xe6cf('0xc'),auth['isAuthenticated'](),controller[_0xe6cf('0xd')]);router[_0xe6cf('0xb')](_0xe6cf('0xe'),auth[_0xe6cf('0xa')](),controller[_0xe6cf('0xf')]);router['get'](_0xe6cf('0x10'),auth[_0xe6cf('0xa')](),controller[_0xe6cf('0x11')]);router[_0xe6cf('0xb')](_0xe6cf('0x12'),auth[_0xe6cf('0xa')](),controller[_0xe6cf('0x13')]);router[_0xe6cf('0x14')]('/',auth['isAuthenticated'](),controller[_0xe6cf('0x15')]);router['put'](_0xe6cf('0xc'),auth[_0xe6cf('0xa')](),controller[_0xe6cf('0x16')]);router['delete'](_0xe6cf('0xc'),auth[_0xe6cf('0xa')](),controller[_0xe6cf('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 7eb2922..acb4ca3 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 _0x7550=['contact_lead','exports','STRING','ENUM','lead','contact'];(function(_0xb9f606,_0x3d038f){var _0x4ea771=function(_0x589a1d){while(--_0x589a1d){_0xb9f606['push'](_0xb9f606['shift']());}};_0x4ea771(++_0x3d038f);}(_0x7550,0x133));var _0x0755=function(_0x47dc02,_0x21bfad){_0x47dc02=_0x47dc02-0x0;var _0x189bfd=_0x7550[_0x47dc02];return _0x189bfd;};'use strict';var Sequelize=require('sequelize');module[_0x0755('0x0')]={'name':{'type':Sequelize[_0x0755('0x1')]},'moduleCreate':{'type':Sequelize[_0x0755('0x2')](_0x0755('0x3'),_0x0755('0x4'),'nothing'),'defaultValue':_0x0755('0x3')},'moduleSearch':{'type':Sequelize[_0x0755('0x2')](_0x0755('0x5'),_0x0755('0x4'),_0x0755('0x3')),'defaultValue':_0x0755('0x5')},'description':{'type':Sequelize[_0x0755('0x1')]}}; \ No newline at end of file +var _0x6c88=['ENUM','lead','contact','nothing','contact_lead','sequelize','exports','STRING'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x6c88,0xa5));var _0x86c8=function(_0x2b07a1,_0x25c79a){_0x2b07a1=_0x2b07a1-0x0;var _0x4bb96b=_0x6c88[_0x2b07a1];return _0x4bb96b;};'use strict';var Sequelize=require(_0x86c8('0x0'));module[_0x86c8('0x1')]={'name':{'type':Sequelize[_0x86c8('0x2')]},'moduleCreate':{'type':Sequelize[_0x86c8('0x3')](_0x86c8('0x4'),_0x86c8('0x5'),_0x86c8('0x6')),'defaultValue':_0x86c8('0x4')},'moduleSearch':{'type':Sequelize[_0x86c8('0x3')](_0x86c8('0x7'),_0x86c8('0x5'),_0x86c8('0x4')),'defaultValue':_0x86c8('0x7')},'description':{'type':Sequelize[_0x86c8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 23385c1..feede39 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 _0xda62=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','where','pick','filter','merge','count','includeAll','include','findAll','rows','show','params','keys','options','catch','create','body','find','getFields','findOne','order','sort','ZohoField','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x45de38,_0x21ae9f){var _0x3ce7ee=function(_0x566b90){while(--_0x566b90){_0x45de38['push'](_0x45de38['shift']());}};_0x3ce7ee(++_0x21ae9f);}(_0xda62,0xde));var _0x2da6=function(_0x35fea6,_0x571527){_0x35fea6=_0x35fea6-0x0;var _0x4cb7da=_0xda62[_0x35fea6];return _0x4cb7da;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2da6('0x0'));var jsonpatch=require(_0x2da6('0x1'));var rp=require(_0x2da6('0x2'));var moment=require(_0x2da6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2da6('0x4'));var util=require(_0x2da6('0x5'));var path=require(_0x2da6('0x6'));var sox=require(_0x2da6('0x7'));var csv=require(_0x2da6('0x8'));var ejs=require(_0x2da6('0x9'));var fs=require('fs');var fs_extra=require(_0x2da6('0xa'));var _=require(_0x2da6('0xb'));var squel=require('squel');var crypto=require(_0x2da6('0xc'));var jsforce=require(_0x2da6('0xd'));var deskjs=require(_0x2da6('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2da6('0xf'));var authService=require(_0x2da6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2da6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2da6('0x12'));var utils=require('../../config/utils');var config=require(_0x2da6('0x13'));var licenseUtil=require(_0x2da6('0x14'));var db=require(_0x2da6('0x15'))['db'];function respondWithStatusCode(_0x355681,_0x2b4701){_0x2b4701=_0x2b4701||0xcc;return function(_0x12ada6){if(_0x12ada6){return _0x355681[_0x2da6('0x16')](_0x2b4701);}return _0x355681[_0x2da6('0x17')](_0x2b4701)[_0x2da6('0x18')]();};}function respondWithResult(_0x229e69,_0x30b40f){_0x30b40f=_0x30b40f||0xc8;return function(_0x2c0361){if(_0x2c0361){return _0x229e69[_0x2da6('0x17')](_0x30b40f)[_0x2da6('0x19')](_0x2c0361);}};}function respondWithFilteredResult(_0x553c54,_0x353736){return function(_0x32396f){if(_0x32396f){var _0x54f0aa=typeof _0x353736[_0x2da6('0x1a')]===_0x2da6('0x1b')&&typeof _0x353736[_0x2da6('0x1c')]==='undefined';var _0xb4f0d2=_0x32396f['count'];var _0x3d4854=_0x54f0aa?0x0:_0x353736['offset'];var _0x45a451=_0x54f0aa?_0x32396f['count']:_0x353736['offset']+_0x353736[_0x2da6('0x1c')];var _0x575861;if(_0x45a451>=_0xb4f0d2){_0x45a451=_0xb4f0d2;_0x575861=0xc8;}else{_0x575861=0xce;}_0x553c54[_0x2da6('0x17')](_0x575861);return _0x553c54[_0x2da6('0x1d')](_0x2da6('0x1e'),_0x3d4854+'-'+_0x45a451+'/'+_0xb4f0d2)[_0x2da6('0x19')](_0x32396f);}return null;};}function patchUpdates(_0x55cf86){return function(_0x52ee30){try{jsonpatch[_0x2da6('0x1f')](_0x52ee30,_0x55cf86,!![]);}catch(_0x59dd57){return BPromise[_0x2da6('0x20')](_0x59dd57);}return _0x52ee30[_0x2da6('0x21')]();};}function saveUpdates(_0x365664,_0x181341){return function(_0x3b4f00){if(_0x3b4f00){return _0x3b4f00[_0x2da6('0x22')](_0x365664)[_0x2da6('0x23')](function(_0x2b4062){return _0x2b4062;});}return null;};}function removeEntity(_0xdbba83,_0x3786d3){return function(_0x15848e){if(_0x15848e){return _0x15848e[_0x2da6('0x24')]()[_0x2da6('0x23')](function(){_0xdbba83[_0x2da6('0x17')](0xcc)[_0x2da6('0x18')]();});}};}function handleEntityNotFound(_0x4589b5,_0x51bed1){return function(_0x4ebd28){if(!_0x4ebd28){_0x4589b5['sendStatus'](0x194);}return _0x4ebd28;};}function handleError(_0x3f868a,_0x1a6a6c){_0x1a6a6c=_0x1a6a6c||0x1f4;return function(_0x427327){logger[_0x2da6('0x25')](_0x427327['stack']);if(_0x427327['name']){delete _0x427327[_0x2da6('0x26')];}_0x3f868a[_0x2da6('0x17')](_0x1a6a6c)[_0x2da6('0x27')](_0x427327);};}exports[_0x2da6('0x28')]=function(_0x113aad,_0x557657){var _0x333e19={},_0x593d80={},_0x509f89={'count':0x0,'rows':[]};var _0x1b52b7=_[_0x2da6('0x29')](db[_0x2da6('0x2a')][_0x2da6('0x2b')],function(_0x3aecd7){return{'name':_0x3aecd7[_0x2da6('0x2c')],'type':_0x3aecd7[_0x2da6('0x2d')][_0x2da6('0x2e')]};});_0x593d80['model']=_[_0x2da6('0x29')](_0x1b52b7,_0x2da6('0x26'));_0x593d80['query']=_['keys'](_0x113aad[_0x2da6('0x2f')]);_0x593d80[_0x2da6('0x30')]=_[_0x2da6('0x31')](_0x593d80['model'],_0x593d80[_0x2da6('0x2f')]);_0x333e19[_0x2da6('0x32')]=_[_0x2da6('0x31')](_0x593d80['model'],qs['fields'](_0x113aad[_0x2da6('0x2f')][_0x2da6('0x33')]));_0x333e19['attributes']=_0x333e19[_0x2da6('0x32')][_0x2da6('0x34')]?_0x333e19[_0x2da6('0x32')]:_0x593d80[_0x2da6('0x35')];if(!_0x113aad[_0x2da6('0x2f')][_0x2da6('0x36')](_0x2da6('0x37'))){_0x333e19[_0x2da6('0x1c')]=qs['limit'](_0x113aad[_0x2da6('0x2f')]['limit']);_0x333e19[_0x2da6('0x1a')]=qs[_0x2da6('0x1a')](_0x113aad[_0x2da6('0x2f')][_0x2da6('0x1a')]);}_0x333e19['order']=qs['sort'](_0x113aad['query']['sort']);_0x333e19[_0x2da6('0x38')]=qs[_0x2da6('0x30')](_[_0x2da6('0x39')](_0x113aad[_0x2da6('0x2f')],_0x593d80[_0x2da6('0x30')]),_0x1b52b7);if(_0x113aad[_0x2da6('0x2f')][_0x2da6('0x3a')]){_0x333e19[_0x2da6('0x38')]=_[_0x2da6('0x3b')](_0x333e19[_0x2da6('0x38')],{'$or':_[_0x2da6('0x29')](_0x1b52b7,function(_0x4d4fe1){if(_0x4d4fe1[_0x2da6('0x2d')]!=='VIRTUAL'){var _0x3ea09b={};_0x3ea09b[_0x4d4fe1[_0x2da6('0x26')]]={'$like':'%'+_0x113aad['query'][_0x2da6('0x3a')]+'%'};return _0x3ea09b;}})});}_0x333e19=_['merge']({},_0x333e19,_0x113aad['options']);var _0x1fc0d4={'where':_0x333e19[_0x2da6('0x38')]};return db[_0x2da6('0x2a')]['count'](_0x1fc0d4)['then'](function(_0x394105){_0x509f89[_0x2da6('0x3c')]=_0x394105;if(_0x113aad['query'][_0x2da6('0x3d')]){_0x333e19[_0x2da6('0x3e')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x2da6('0x3f')](_0x333e19);})['then'](function(_0x430547){_0x509f89[_0x2da6('0x40')]=_0x430547;return _0x509f89;})['then'](respondWithFilteredResult(_0x557657,_0x333e19))['catch'](handleError(_0x557657,null));};exports[_0x2da6('0x41')]=function(_0x28a70e,_0x110f7f){var _0x42849f={'raw':![],'where':{'id':_0x28a70e[_0x2da6('0x42')]['id']}},_0x5ec7fc={};_0x5ec7fc[_0x2da6('0x35')]=_[_0x2da6('0x43')](db['ZohoConfiguration']['rawAttributes']);_0x5ec7fc[_0x2da6('0x2f')]=_[_0x2da6('0x43')](_0x28a70e[_0x2da6('0x2f')]);_0x5ec7fc[_0x2da6('0x30')]=_['intersection'](_0x5ec7fc[_0x2da6('0x35')],_0x5ec7fc['query']);_0x42849f[_0x2da6('0x32')]=_[_0x2da6('0x31')](_0x5ec7fc[_0x2da6('0x35')],qs[_0x2da6('0x33')](_0x28a70e[_0x2da6('0x2f')][_0x2da6('0x33')]));_0x42849f[_0x2da6('0x32')]=_0x42849f[_0x2da6('0x32')]['length']?_0x42849f[_0x2da6('0x32')]:_0x5ec7fc[_0x2da6('0x35')];if(_0x28a70e[_0x2da6('0x2f')][_0x2da6('0x3d')]){_0x42849f[_0x2da6('0x3e')]=[{'all':!![]}];}_0x42849f=_['merge']({},_0x42849f,_0x28a70e[_0x2da6('0x44')]);return db['ZohoConfiguration']['find'](_0x42849f)[_0x2da6('0x23')](handleEntityNotFound(_0x110f7f,null))['then'](respondWithResult(_0x110f7f,null))[_0x2da6('0x45')](handleError(_0x110f7f,null));};exports[_0x2da6('0x46')]=function(_0x530077,_0x14e20f){return db[_0x2da6('0x2a')]['create'](_0x530077[_0x2da6('0x47')],{})[_0x2da6('0x23')](respondWithResult(_0x14e20f,0xc9))['catch'](handleError(_0x14e20f,null));};exports['update']=function(_0x53ae5a,_0x3e45d7){if(_0x53ae5a['body']['id']){delete _0x53ae5a[_0x2da6('0x47')]['id'];}return db[_0x2da6('0x2a')][_0x2da6('0x48')]({'where':{'id':_0x53ae5a[_0x2da6('0x42')]['id']}})[_0x2da6('0x23')](handleEntityNotFound(_0x3e45d7,null))[_0x2da6('0x23')](saveUpdates(_0x53ae5a[_0x2da6('0x47')],null))['then'](respondWithResult(_0x3e45d7,null))[_0x2da6('0x45')](handleError(_0x3e45d7,null));};exports[_0x2da6('0x24')]=function(_0x5c6e01,_0x149e73){return db[_0x2da6('0x2a')][_0x2da6('0x48')]({'where':{'id':_0x5c6e01[_0x2da6('0x42')]['id']}})[_0x2da6('0x23')](handleEntityNotFound(_0x149e73,null))[_0x2da6('0x23')](removeEntity(_0x149e73,null))[_0x2da6('0x45')](handleError(_0x149e73,null));};exports[_0x2da6('0x49')]=function(_0x4bc2b0,_0x235d71,_0x1c3d08){var _0x595f5d={};var _0x2b04b5={};var _0x3ed453;var _0x1b87aa;return db[_0x2da6('0x2a')][_0x2da6('0x4a')]({'where':{'id':_0x4bc2b0[_0x2da6('0x42')]['id']}})[_0x2da6('0x23')](handleEntityNotFound(_0x235d71,null))[_0x2da6('0x23')](function(_0x4dda08){if(_0x4dda08){_0x3ed453=_0x4dda08;_0x2b04b5[_0x2da6('0x35')]=_[_0x2da6('0x43')](db['ZohoField'][_0x2da6('0x2b')]);_0x2b04b5[_0x2da6('0x2f')]=_[_0x2da6('0x43')](_0x4bc2b0[_0x2da6('0x2f')]);_0x2b04b5[_0x2da6('0x30')]=_['intersection'](_0x2b04b5[_0x2da6('0x35')],_0x2b04b5[_0x2da6('0x2f')]);_0x595f5d[_0x2da6('0x32')]=_[_0x2da6('0x31')](_0x2b04b5[_0x2da6('0x35')],qs[_0x2da6('0x33')](_0x4bc2b0['query']['fields']));_0x595f5d['attributes']=_0x595f5d['attributes'][_0x2da6('0x34')]?_0x595f5d[_0x2da6('0x32')]:_0x2b04b5[_0x2da6('0x35')];_0x595f5d[_0x2da6('0x4b')]=qs[_0x2da6('0x4c')](_0x4bc2b0[_0x2da6('0x2f')][_0x2da6('0x4c')]);_0x595f5d[_0x2da6('0x38')]=qs[_0x2da6('0x30')](_['pick'](_0x4bc2b0[_0x2da6('0x2f')],_0x2b04b5[_0x2da6('0x30')]));if(_0x4bc2b0['query'][_0x2da6('0x3a')]){_0x595f5d['where']=_[_0x2da6('0x3b')](_0x595f5d[_0x2da6('0x38')],{'$or':_[_0x2da6('0x29')](_0x595f5d[_0x2da6('0x32')],function(_0x385cb9){var _0x15f842={};_0x15f842[_0x385cb9]={'$like':'%'+_0x4bc2b0[_0x2da6('0x2f')][_0x2da6('0x3a')]+'%'};return _0x15f842;})});}_0x595f5d=_[_0x2da6('0x3b')]({},_0x595f5d,_0x4bc2b0['options']);return _0x3ed453['getFields'](_0x595f5d);}})[_0x2da6('0x23')](function(_0x6a2ca8){if(_0x6a2ca8){_0x1b87aa=_0x6a2ca8[_0x2da6('0x34')];if(!_0x4bc2b0['query'][_0x2da6('0x36')]('nolimit')){_0x595f5d['limit']=qs['limit'](_0x4bc2b0[_0x2da6('0x2f')][_0x2da6('0x1c')]);_0x595f5d[_0x2da6('0x1a')]=qs['offset'](_0x4bc2b0[_0x2da6('0x2f')]['offset']);}return _0x3ed453[_0x2da6('0x49')](_0x595f5d);}})[_0x2da6('0x23')](function(_0x538ba0){if(_0x538ba0){return _0x538ba0?{'count':_0x1b87aa,'rows':_0x538ba0}:null;}})[_0x2da6('0x23')](respondWithResult(_0x235d71,null))[_0x2da6('0x45')](handleError(_0x235d71,null));};exports['getSubjects']=function(_0x24a9b6,_0x3b5b06,_0x374165){var _0x182198={};var _0x22e7ae={};var _0x14c0ff;var _0x3f9a12;return db['ZohoConfiguration'][_0x2da6('0x4a')]({'where':{'id':_0x24a9b6[_0x2da6('0x42')]['id']}})[_0x2da6('0x23')](handleEntityNotFound(_0x3b5b06,null))[_0x2da6('0x23')](function(_0x4789f7){if(_0x4789f7){_0x14c0ff=_0x4789f7;_0x22e7ae[_0x2da6('0x35')]=_[_0x2da6('0x43')](db[_0x2da6('0x4d')]['rawAttributes']);_0x22e7ae[_0x2da6('0x2f')]=_[_0x2da6('0x43')](_0x24a9b6['query']);_0x22e7ae[_0x2da6('0x30')]=_[_0x2da6('0x31')](_0x22e7ae[_0x2da6('0x35')],_0x22e7ae['query']);_0x182198['attributes']=_[_0x2da6('0x31')](_0x22e7ae[_0x2da6('0x35')],qs[_0x2da6('0x33')](_0x24a9b6[_0x2da6('0x2f')][_0x2da6('0x33')]));_0x182198['attributes']=_0x182198[_0x2da6('0x32')][_0x2da6('0x34')]?_0x182198['attributes']:_0x22e7ae['model'];_0x182198[_0x2da6('0x4b')]=qs[_0x2da6('0x4c')](_0x24a9b6[_0x2da6('0x2f')][_0x2da6('0x4c')]);_0x182198[_0x2da6('0x38')]=qs[_0x2da6('0x30')](_[_0x2da6('0x39')](_0x24a9b6['query'],_0x22e7ae['filters']));if(_0x24a9b6[_0x2da6('0x2f')][_0x2da6('0x3a')]){_0x182198[_0x2da6('0x38')]=_['merge'](_0x182198[_0x2da6('0x38')],{'$or':_[_0x2da6('0x29')](_0x182198[_0x2da6('0x32')],function(_0x32d908){var _0x3a7563={};_0x3a7563[_0x32d908]={'$like':'%'+_0x24a9b6[_0x2da6('0x2f')][_0x2da6('0x3a')]+'%'};return _0x3a7563;})});}_0x182198=_['merge']({},_0x182198,_0x24a9b6['options']);return _0x14c0ff['getSubjects'](_0x182198);}})[_0x2da6('0x23')](function(_0x3853e4){if(_0x3853e4){_0x3f9a12=_0x3853e4[_0x2da6('0x34')];if(!_0x24a9b6[_0x2da6('0x2f')]['hasOwnProperty'](_0x2da6('0x37'))){_0x182198[_0x2da6('0x1c')]=qs[_0x2da6('0x1c')](_0x24a9b6[_0x2da6('0x2f')][_0x2da6('0x1c')]);_0x182198['offset']=qs[_0x2da6('0x1a')](_0x24a9b6[_0x2da6('0x2f')][_0x2da6('0x1a')]);}return _0x14c0ff['getSubjects'](_0x182198);}})[_0x2da6('0x23')](function(_0x43662f){if(_0x43662f){return _0x43662f?{'count':_0x3f9a12,'rows':_0x43662f}:null;}})[_0x2da6('0x23')](respondWithResult(_0x3b5b06,null))[_0x2da6('0x45')](handleError(_0x3b5b06,null));};exports[_0x2da6('0x4e')]=function(_0x53efc9,_0x5063d4,_0x5e4fbb){var _0x2e0b06={};var _0x40b0b6={};var _0x2aa632;var _0x30fbc0;return db[_0x2da6('0x2a')][_0x2da6('0x4a')]({'where':{'id':_0x53efc9[_0x2da6('0x42')]['id']}})[_0x2da6('0x23')](handleEntityNotFound(_0x5063d4,null))[_0x2da6('0x23')](function(_0x326eef){if(_0x326eef){_0x2aa632=_0x326eef;_0x40b0b6[_0x2da6('0x35')]=_[_0x2da6('0x43')](db[_0x2da6('0x4d')]['rawAttributes']);_0x40b0b6[_0x2da6('0x2f')]=_['keys'](_0x53efc9['query']);_0x40b0b6[_0x2da6('0x30')]=_[_0x2da6('0x31')](_0x40b0b6['model'],_0x40b0b6[_0x2da6('0x2f')]);_0x2e0b06['attributes']=_[_0x2da6('0x31')](_0x40b0b6[_0x2da6('0x35')],qs['fields'](_0x53efc9[_0x2da6('0x2f')]['fields']));_0x2e0b06[_0x2da6('0x32')]=_0x2e0b06[_0x2da6('0x32')]['length']?_0x2e0b06[_0x2da6('0x32')]:_0x40b0b6['model'];_0x2e0b06[_0x2da6('0x4b')]=qs[_0x2da6('0x4c')](_0x53efc9[_0x2da6('0x2f')][_0x2da6('0x4c')]);_0x2e0b06[_0x2da6('0x38')]=qs[_0x2da6('0x30')](_[_0x2da6('0x39')](_0x53efc9[_0x2da6('0x2f')],_0x40b0b6[_0x2da6('0x30')]));if(_0x53efc9['query'][_0x2da6('0x3a')]){_0x2e0b06[_0x2da6('0x38')]=_[_0x2da6('0x3b')](_0x2e0b06['where'],{'$or':_[_0x2da6('0x29')](_0x2e0b06[_0x2da6('0x32')],function(_0x31d39e){var _0x2c6034={};_0x2c6034[_0x31d39e]={'$like':'%'+_0x53efc9['query'][_0x2da6('0x3a')]+'%'};return _0x2c6034;})});}_0x2e0b06=_[_0x2da6('0x3b')]({},_0x2e0b06,_0x53efc9[_0x2da6('0x44')]);return _0x2aa632[_0x2da6('0x4e')](_0x2e0b06);}})['then'](function(_0x3b0b0e){if(_0x3b0b0e){_0x30fbc0=_0x3b0b0e[_0x2da6('0x34')];if(!_0x53efc9['query'][_0x2da6('0x36')]('nolimit')){_0x2e0b06[_0x2da6('0x1c')]=qs[_0x2da6('0x1c')](_0x53efc9[_0x2da6('0x2f')][_0x2da6('0x1c')]);_0x2e0b06[_0x2da6('0x1a')]=qs[_0x2da6('0x1a')](_0x53efc9[_0x2da6('0x2f')][_0x2da6('0x1a')]);}return _0x2aa632['getDescriptions'](_0x2e0b06);}})[_0x2da6('0x23')](function(_0x50430c){if(_0x50430c){return _0x50430c?{'count':_0x30fbc0,'rows':_0x50430c}:null;}})[_0x2da6('0x23')](respondWithResult(_0x5063d4,null))[_0x2da6('0x45')](handleError(_0x5063d4,null));}; \ No newline at end of file +var _0x5812=['fs-extra','lodash','crypto','jsforce','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','error','name','send','ZohoConfiguration','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','options','include','findAll','params','keys','includeAll','find','catch','body','findOne','ZohoField','order','sort','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs'];(function(_0x5c163c,_0x55da6a){var _0x4e2d05=function(_0x435717){while(--_0x435717){_0x5c163c['push'](_0x5c163c['shift']());}};_0x4e2d05(++_0x55da6a);}(_0x5812,0xe0));var _0x2581=function(_0x3f04d8,_0x5929f5){_0x3f04d8=_0x3f04d8-0x0;var _0x10c295=_0x5812[_0x3f04d8];return _0x10c295;};'use strict';var emlformat=require(_0x2581('0x0'));var rimraf=require(_0x2581('0x1'));var zipdir=require(_0x2581('0x2'));var jsonpatch=require(_0x2581('0x3'));var rp=require('request-promise');var moment=require(_0x2581('0x4'));var BPromise=require(_0x2581('0x5'));var Mustache=require('mustache');var util=require(_0x2581('0x6'));var path=require(_0x2581('0x7'));var sox=require(_0x2581('0x8'));var csv=require('to-csv');var ejs=require(_0x2581('0x9'));var fs=require('fs');var fs_extra=require(_0x2581('0xa'));var _=require(_0x2581('0xb'));var squel=require('squel');var crypto=require(_0x2581('0xc'));var jsforce=require(_0x2581('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2581('0xe'));var querystring=require('querystring');var Papa=require(_0x2581('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2581('0x10'));var as=require(_0x2581('0x11'));var hardwareService=require(_0x2581('0x12'));var logger=require(_0x2581('0x13'))(_0x2581('0x14'));var utils=require(_0x2581('0x15'));var config=require(_0x2581('0x16'));var licenseUtil=require(_0x2581('0x17'));var db=require(_0x2581('0x18'))['db'];function respondWithStatusCode(_0x1de8e5,_0x1d9a08){_0x1d9a08=_0x1d9a08||0xcc;return function(_0x54b3a7){if(_0x54b3a7){return _0x1de8e5[_0x2581('0x19')](_0x1d9a08);}return _0x1de8e5['status'](_0x1d9a08)[_0x2581('0x1a')]();};}function respondWithResult(_0x4ffd50,_0x40f1d8){_0x40f1d8=_0x40f1d8||0xc8;return function(_0x19c4c4){if(_0x19c4c4){return _0x4ffd50['status'](_0x40f1d8)[_0x2581('0x1b')](_0x19c4c4);}};}function respondWithFilteredResult(_0x3ccbe5,_0x45021b){return function(_0x5ac371){if(_0x5ac371){var _0x431eb5=typeof _0x45021b[_0x2581('0x1c')]===_0x2581('0x1d')&&typeof _0x45021b[_0x2581('0x1e')]===_0x2581('0x1d');var _0x1deb65=_0x5ac371['count'];var _0x404113=_0x431eb5?0x0:_0x45021b['offset'];var _0x1c02fc=_0x431eb5?_0x5ac371[_0x2581('0x1f')]:_0x45021b[_0x2581('0x1c')]+_0x45021b[_0x2581('0x1e')];var _0x5874ce;if(_0x1c02fc>=_0x1deb65){_0x1c02fc=_0x1deb65;_0x5874ce=0xc8;}else{_0x5874ce=0xce;}_0x3ccbe5[_0x2581('0x20')](_0x5874ce);return _0x3ccbe5[_0x2581('0x21')](_0x2581('0x22'),_0x404113+'-'+_0x1c02fc+'/'+_0x1deb65)[_0x2581('0x1b')](_0x5ac371);}return null;};}function patchUpdates(_0x59a427){return function(_0x4dbe1a){try{jsonpatch['apply'](_0x4dbe1a,_0x59a427,!![]);}catch(_0x4d44e9){return BPromise[_0x2581('0x23')](_0x4d44e9);}return _0x4dbe1a[_0x2581('0x24')]();};}function saveUpdates(_0x33b693,_0x2bf4ad){return function(_0x18a4c7){if(_0x18a4c7){return _0x18a4c7[_0x2581('0x25')](_0x33b693)[_0x2581('0x26')](function(_0x2afcd8){return _0x2afcd8;});}return null;};}function removeEntity(_0x3034f6,_0x2f7f04){return function(_0x4fda99){if(_0x4fda99){return _0x4fda99[_0x2581('0x27')]()['then'](function(){_0x3034f6['status'](0xcc)[_0x2581('0x1a')]();});}};}function handleEntityNotFound(_0x337fc2,_0x50f13e){return function(_0x5d18a4){if(!_0x5d18a4){_0x337fc2[_0x2581('0x19')](0x194);}return _0x5d18a4;};}function handleError(_0x28f4fc,_0xb36530){_0xb36530=_0xb36530||0x1f4;return function(_0x23ad51){logger[_0x2581('0x28')](_0x23ad51['stack']);if(_0x23ad51[_0x2581('0x29')]){delete _0x23ad51[_0x2581('0x29')];}_0x28f4fc[_0x2581('0x20')](_0xb36530)[_0x2581('0x2a')](_0x23ad51);};}exports['index']=function(_0x23fa11,_0x4f10ee){var _0x1f1c59={},_0x5c12e7={},_0x5ad7e7={'count':0x0,'rows':[]};var _0x1aa6c5=_['map'](db[_0x2581('0x2b')][_0x2581('0x2c')],function(_0x3ff971){return{'name':_0x3ff971['fieldName'],'type':_0x3ff971[_0x2581('0x2d')][_0x2581('0x2e')]};});_0x5c12e7[_0x2581('0x2f')]=_[_0x2581('0x30')](_0x1aa6c5,_0x2581('0x29'));_0x5c12e7[_0x2581('0x31')]=_['keys'](_0x23fa11['query']);_0x5c12e7[_0x2581('0x32')]=_[_0x2581('0x33')](_0x5c12e7[_0x2581('0x2f')],_0x5c12e7[_0x2581('0x31')]);_0x1f1c59[_0x2581('0x34')]=_[_0x2581('0x33')](_0x5c12e7[_0x2581('0x2f')],qs[_0x2581('0x35')](_0x23fa11['query'][_0x2581('0x35')]));_0x1f1c59[_0x2581('0x34')]=_0x1f1c59[_0x2581('0x34')][_0x2581('0x36')]?_0x1f1c59[_0x2581('0x34')]:_0x5c12e7['model'];if(!_0x23fa11[_0x2581('0x31')][_0x2581('0x37')](_0x2581('0x38'))){_0x1f1c59[_0x2581('0x1e')]=qs[_0x2581('0x1e')](_0x23fa11[_0x2581('0x31')]['limit']);_0x1f1c59[_0x2581('0x1c')]=qs['offset'](_0x23fa11[_0x2581('0x31')]['offset']);}_0x1f1c59['order']=qs['sort'](_0x23fa11[_0x2581('0x31')]['sort']);_0x1f1c59[_0x2581('0x39')]=qs[_0x2581('0x32')](_[_0x2581('0x3a')](_0x23fa11['query'],_0x5c12e7[_0x2581('0x32')]),_0x1aa6c5);if(_0x23fa11[_0x2581('0x31')]['filter']){_0x1f1c59[_0x2581('0x39')]=_[_0x2581('0x3b')](_0x1f1c59[_0x2581('0x39')],{'$or':_[_0x2581('0x30')](_0x1aa6c5,function(_0x4f1abe){if(_0x4f1abe[_0x2581('0x2d')]!==_0x2581('0x3c')){var _0x380680={};_0x380680[_0x4f1abe[_0x2581('0x29')]]={'$like':'%'+_0x23fa11[_0x2581('0x31')][_0x2581('0x3d')]+'%'};return _0x380680;}})});}_0x1f1c59=_[_0x2581('0x3b')]({},_0x1f1c59,_0x23fa11[_0x2581('0x3e')]);var _0x1a07d9={'where':_0x1f1c59[_0x2581('0x39')]};return db[_0x2581('0x2b')][_0x2581('0x1f')](_0x1a07d9)[_0x2581('0x26')](function(_0x48a5b7){_0x5ad7e7[_0x2581('0x1f')]=_0x48a5b7;if(_0x23fa11[_0x2581('0x31')]['includeAll']){_0x1f1c59[_0x2581('0x3f')]=[{'all':!![]}];}return db[_0x2581('0x2b')][_0x2581('0x40')](_0x1f1c59);})['then'](function(_0x3ab87e){_0x5ad7e7['rows']=_0x3ab87e;return _0x5ad7e7;})['then'](respondWithFilteredResult(_0x4f10ee,_0x1f1c59))['catch'](handleError(_0x4f10ee,null));};exports['show']=function(_0x336df3,_0x3e604c){var _0x5ef747={'raw':![],'where':{'id':_0x336df3[_0x2581('0x41')]['id']}},_0x357629={};_0x357629[_0x2581('0x2f')]=_[_0x2581('0x42')](db['ZohoConfiguration']['rawAttributes']);_0x357629[_0x2581('0x31')]=_[_0x2581('0x42')](_0x336df3[_0x2581('0x31')]);_0x357629['filters']=_['intersection'](_0x357629['model'],_0x357629[_0x2581('0x31')]);_0x5ef747[_0x2581('0x34')]=_[_0x2581('0x33')](_0x357629['model'],qs['fields'](_0x336df3[_0x2581('0x31')][_0x2581('0x35')]));_0x5ef747[_0x2581('0x34')]=_0x5ef747[_0x2581('0x34')][_0x2581('0x36')]?_0x5ef747[_0x2581('0x34')]:_0x357629[_0x2581('0x2f')];if(_0x336df3['query'][_0x2581('0x43')]){_0x5ef747['include']=[{'all':!![]}];}_0x5ef747=_[_0x2581('0x3b')]({},_0x5ef747,_0x336df3[_0x2581('0x3e')]);return db['ZohoConfiguration'][_0x2581('0x44')](_0x5ef747)[_0x2581('0x26')](handleEntityNotFound(_0x3e604c,null))[_0x2581('0x26')](respondWithResult(_0x3e604c,null))[_0x2581('0x45')](handleError(_0x3e604c,null));};exports['create']=function(_0x57c355,_0x275bad){return db[_0x2581('0x2b')]['create'](_0x57c355[_0x2581('0x46')],{})['then'](respondWithResult(_0x275bad,0xc9))[_0x2581('0x45')](handleError(_0x275bad,null));};exports[_0x2581('0x25')]=function(_0x2b727b,_0x2e08bd){if(_0x2b727b['body']['id']){delete _0x2b727b[_0x2581('0x46')]['id'];}return db[_0x2581('0x2b')][_0x2581('0x44')]({'where':{'id':_0x2b727b[_0x2581('0x41')]['id']}})[_0x2581('0x26')](handleEntityNotFound(_0x2e08bd,null))[_0x2581('0x26')](saveUpdates(_0x2b727b['body'],null))['then'](respondWithResult(_0x2e08bd,null))[_0x2581('0x45')](handleError(_0x2e08bd,null));};exports['destroy']=function(_0x2843f4,_0x5af20a){return db[_0x2581('0x2b')][_0x2581('0x44')]({'where':{'id':_0x2843f4[_0x2581('0x41')]['id']}})[_0x2581('0x26')](handleEntityNotFound(_0x5af20a,null))[_0x2581('0x26')](removeEntity(_0x5af20a,null))[_0x2581('0x45')](handleError(_0x5af20a,null));};exports['getFields']=function(_0x583727,_0x2793ef,_0x3c4fe7){var _0x2dea2e={};var _0x3a168e={};var _0x51ae42;var _0x1d41f8;return db[_0x2581('0x2b')][_0x2581('0x47')]({'where':{'id':_0x583727['params']['id']}})[_0x2581('0x26')](handleEntityNotFound(_0x2793ef,null))[_0x2581('0x26')](function(_0x6e9aca){if(_0x6e9aca){_0x51ae42=_0x6e9aca;_0x3a168e['model']=_[_0x2581('0x42')](db[_0x2581('0x48')]['rawAttributes']);_0x3a168e[_0x2581('0x31')]=_[_0x2581('0x42')](_0x583727['query']);_0x3a168e['filters']=_[_0x2581('0x33')](_0x3a168e[_0x2581('0x2f')],_0x3a168e['query']);_0x2dea2e[_0x2581('0x34')]=_[_0x2581('0x33')](_0x3a168e[_0x2581('0x2f')],qs['fields'](_0x583727['query']['fields']));_0x2dea2e[_0x2581('0x34')]=_0x2dea2e[_0x2581('0x34')][_0x2581('0x36')]?_0x2dea2e[_0x2581('0x34')]:_0x3a168e[_0x2581('0x2f')];_0x2dea2e[_0x2581('0x49')]=qs[_0x2581('0x4a')](_0x583727[_0x2581('0x31')][_0x2581('0x4a')]);_0x2dea2e[_0x2581('0x39')]=qs[_0x2581('0x32')](_[_0x2581('0x3a')](_0x583727['query'],_0x3a168e[_0x2581('0x32')]));if(_0x583727[_0x2581('0x31')][_0x2581('0x3d')]){_0x2dea2e[_0x2581('0x39')]=_[_0x2581('0x3b')](_0x2dea2e[_0x2581('0x39')],{'$or':_[_0x2581('0x30')](_0x2dea2e[_0x2581('0x34')],function(_0x22272e){var _0x5370d9={};_0x5370d9[_0x22272e]={'$like':'%'+_0x583727[_0x2581('0x31')][_0x2581('0x3d')]+'%'};return _0x5370d9;})});}_0x2dea2e=_[_0x2581('0x3b')]({},_0x2dea2e,_0x583727[_0x2581('0x3e')]);return _0x51ae42[_0x2581('0x4b')](_0x2dea2e);}})[_0x2581('0x26')](function(_0x4317f5){if(_0x4317f5){_0x1d41f8=_0x4317f5[_0x2581('0x36')];if(!_0x583727[_0x2581('0x31')][_0x2581('0x37')](_0x2581('0x38'))){_0x2dea2e[_0x2581('0x1e')]=qs['limit'](_0x583727[_0x2581('0x31')]['limit']);_0x2dea2e['offset']=qs['offset'](_0x583727[_0x2581('0x31')]['offset']);}return _0x51ae42[_0x2581('0x4b')](_0x2dea2e);}})['then'](function(_0xfde3c7){if(_0xfde3c7){return _0xfde3c7?{'count':_0x1d41f8,'rows':_0xfde3c7}:null;}})[_0x2581('0x26')](respondWithResult(_0x2793ef,null))[_0x2581('0x45')](handleError(_0x2793ef,null));};exports[_0x2581('0x4c')]=function(_0x4cabaf,_0x2f7f76,_0x579e68){var _0x3ef9b2={};var _0xfecc23={};var _0x3eb782;var _0x252eb8;return db['ZohoConfiguration'][_0x2581('0x47')]({'where':{'id':_0x4cabaf[_0x2581('0x41')]['id']}})[_0x2581('0x26')](handleEntityNotFound(_0x2f7f76,null))[_0x2581('0x26')](function(_0x3f1c90){if(_0x3f1c90){_0x3eb782=_0x3f1c90;_0xfecc23['model']=_[_0x2581('0x42')](db[_0x2581('0x48')][_0x2581('0x2c')]);_0xfecc23[_0x2581('0x31')]=_[_0x2581('0x42')](_0x4cabaf[_0x2581('0x31')]);_0xfecc23[_0x2581('0x32')]=_['intersection'](_0xfecc23[_0x2581('0x2f')],_0xfecc23['query']);_0x3ef9b2[_0x2581('0x34')]=_['intersection'](_0xfecc23[_0x2581('0x2f')],qs[_0x2581('0x35')](_0x4cabaf[_0x2581('0x31')][_0x2581('0x35')]));_0x3ef9b2[_0x2581('0x34')]=_0x3ef9b2[_0x2581('0x34')]['length']?_0x3ef9b2[_0x2581('0x34')]:_0xfecc23[_0x2581('0x2f')];_0x3ef9b2['order']=qs[_0x2581('0x4a')](_0x4cabaf[_0x2581('0x31')][_0x2581('0x4a')]);_0x3ef9b2['where']=qs['filters'](_[_0x2581('0x3a')](_0x4cabaf[_0x2581('0x31')],_0xfecc23['filters']));if(_0x4cabaf[_0x2581('0x31')]['filter']){_0x3ef9b2['where']=_[_0x2581('0x3b')](_0x3ef9b2['where'],{'$or':_[_0x2581('0x30')](_0x3ef9b2[_0x2581('0x34')],function(_0x52497f){var _0x30c1c4={};_0x30c1c4[_0x52497f]={'$like':'%'+_0x4cabaf[_0x2581('0x31')][_0x2581('0x3d')]+'%'};return _0x30c1c4;})});}_0x3ef9b2=_[_0x2581('0x3b')]({},_0x3ef9b2,_0x4cabaf[_0x2581('0x3e')]);return _0x3eb782['getSubjects'](_0x3ef9b2);}})[_0x2581('0x26')](function(_0x58b3f7){if(_0x58b3f7){_0x252eb8=_0x58b3f7[_0x2581('0x36')];if(!_0x4cabaf[_0x2581('0x31')][_0x2581('0x37')](_0x2581('0x38'))){_0x3ef9b2[_0x2581('0x1e')]=qs[_0x2581('0x1e')](_0x4cabaf[_0x2581('0x31')]['limit']);_0x3ef9b2[_0x2581('0x1c')]=qs[_0x2581('0x1c')](_0x4cabaf[_0x2581('0x31')]['offset']);}return _0x3eb782[_0x2581('0x4c')](_0x3ef9b2);}})[_0x2581('0x26')](function(_0x5e4a63){if(_0x5e4a63){return _0x5e4a63?{'count':_0x252eb8,'rows':_0x5e4a63}:null;}})[_0x2581('0x26')](respondWithResult(_0x2f7f76,null))['catch'](handleError(_0x2f7f76,null));};exports['getDescriptions']=function(_0x391807,_0x59b7d4,_0x10f408){var _0x3531ab={};var _0x58a7b4={};var _0x1844e3;var _0x2b9e4c;return db[_0x2581('0x2b')][_0x2581('0x47')]({'where':{'id':_0x391807[_0x2581('0x41')]['id']}})['then'](handleEntityNotFound(_0x59b7d4,null))[_0x2581('0x26')](function(_0x4408f8){if(_0x4408f8){_0x1844e3=_0x4408f8;_0x58a7b4[_0x2581('0x2f')]=_[_0x2581('0x42')](db[_0x2581('0x48')][_0x2581('0x2c')]);_0x58a7b4[_0x2581('0x31')]=_[_0x2581('0x42')](_0x391807[_0x2581('0x31')]);_0x58a7b4[_0x2581('0x32')]=_['intersection'](_0x58a7b4[_0x2581('0x2f')],_0x58a7b4[_0x2581('0x31')]);_0x3531ab['attributes']=_['intersection'](_0x58a7b4['model'],qs[_0x2581('0x35')](_0x391807[_0x2581('0x31')][_0x2581('0x35')]));_0x3531ab[_0x2581('0x34')]=_0x3531ab['attributes'][_0x2581('0x36')]?_0x3531ab[_0x2581('0x34')]:_0x58a7b4['model'];_0x3531ab[_0x2581('0x49')]=qs['sort'](_0x391807[_0x2581('0x31')][_0x2581('0x4a')]);_0x3531ab['where']=qs[_0x2581('0x32')](_['pick'](_0x391807[_0x2581('0x31')],_0x58a7b4['filters']));if(_0x391807[_0x2581('0x31')]['filter']){_0x3531ab[_0x2581('0x39')]=_[_0x2581('0x3b')](_0x3531ab[_0x2581('0x39')],{'$or':_[_0x2581('0x30')](_0x3531ab[_0x2581('0x34')],function(_0x11ce21){var _0x66e588={};_0x66e588[_0x11ce21]={'$like':'%'+_0x391807[_0x2581('0x31')][_0x2581('0x3d')]+'%'};return _0x66e588;})});}_0x3531ab=_['merge']({},_0x3531ab,_0x391807[_0x2581('0x3e')]);return _0x1844e3['getDescriptions'](_0x3531ab);}})['then'](function(_0x511ead){if(_0x511ead){_0x2b9e4c=_0x511ead['length'];if(!_0x391807[_0x2581('0x31')][_0x2581('0x37')](_0x2581('0x38'))){_0x3531ab[_0x2581('0x1e')]=qs[_0x2581('0x1e')](_0x391807[_0x2581('0x31')][_0x2581('0x1e')]);_0x3531ab[_0x2581('0x1c')]=qs['offset'](_0x391807[_0x2581('0x31')][_0x2581('0x1c')]);}return _0x1844e3[_0x2581('0x4d')](_0x3531ab);}})[_0x2581('0x26')](function(_0x378de0){if(_0x378de0){return _0x378de0?{'count':_0x2b9e4c,'rows':_0x378de0}:null;}})[_0x2581('0x26')](respondWithResult(_0x59b7d4,null))[_0x2581('0x45')](handleError(_0x59b7d4,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 61182f9..a8d46d7 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 _0x9821=['../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x24c18f,_0x5caa54){var _0x56952f=function(_0x47d713){while(--_0x47d713){_0x24c18f['push'](_0x24c18f['shift']());}};_0x56952f(++_0x5caa54);}(_0x9821,0x71));var _0x1982=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9821[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x1982('0x0'));var util=require(_0x1982('0x1'));var logger=require(_0x1982('0x2'))(_0x1982('0x3'));var moment=require(_0x1982('0x4'));var BPromise=require(_0x1982('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1982('0x6'));var rimraf=require('rimraf');var config=require(_0x1982('0x7'));var attributes=require(_0x1982('0x8'));module['exports']=function(_0x3ec16a,_0x2dfeaa){return _0x3ec16a[_0x1982('0x9')](_0x1982('0xa'),attributes,{'tableName':_0x1982('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bb8=['rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x27233d,_0x14f0f4){var _0x56c1fe=function(_0x346944){while(--_0x346944){_0x27233d['push'](_0x27233d['shift']());}};_0x56c1fe(++_0x14f0f4);}(_0x8bb8,0xa2));var _0x88bb=function(_0xd31a31,_0x282609){_0xd31a31=_0xd31a31-0x0;var _0x3cf7a2=_0x8bb8[_0xd31a31];return _0x3cf7a2;};'use strict';var _=require(_0x88bb('0x0'));var util=require(_0x88bb('0x1'));var logger=require(_0x88bb('0x2'))('api');var moment=require(_0x88bb('0x3'));var BPromise=require(_0x88bb('0x4'));var rp=require(_0x88bb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x88bb('0x6'));var config=require(_0x88bb('0x7'));var attributes=require(_0x88bb('0x8'));module['exports']=function(_0xf90e2b,_0xe79bb){return _0xf90e2b[_0x88bb('0x9')](_0x88bb('0xa'),attributes,{'tableName':_0x88bb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index e8a7e3d..bfb51f7 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 _0x9688=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x3d0d82,_0x2e5992){var _0x17abae=function(_0x291529){while(--_0x291529){_0x3d0d82['push'](_0x3d0d82['shift']());}};_0x17abae(++_0x2e5992);}(_0x9688,0xf1));var _0x8968=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9688[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0x8968('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8968('0x1'));var rs=require(_0x8968('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8968('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8968('0x4'))(_0x8968('0x5'));var config=require(_0x8968('0x6'));var jayson=require(_0x8968('0x7'));var client=jayson[_0x8968('0x8')][_0x8968('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x470c5d,_0x13d1fe,_0x573830){return new BPromise(function(_0x3f603c,_0x368917){return client['request'](_0x470c5d,_0x573830)[_0x8968('0xa')](function(_0x496c83){logger[_0x8968('0xb')](_0x8968('0xc'),_0x13d1fe,_0x8968('0xd'));logger[_0x8968('0xe')](_0x8968('0xf'),_0x13d1fe,'request\x20sent',JSON[_0x8968('0x10')](_0x496c83));if(_0x496c83[_0x8968('0x11')]){if(_0x496c83[_0x8968('0x11')][_0x8968('0x12')]===0x1f4){logger[_0x8968('0x11')](_0x8968('0xc'),_0x13d1fe,_0x496c83[_0x8968('0x11')][_0x8968('0x13')]);return _0x368917(_0x496c83['error']['message']);}logger[_0x8968('0x11')](_0x8968('0xc'),_0x13d1fe,_0x496c83[_0x8968('0x11')][_0x8968('0x13')]);return _0x3f603c(_0x496c83[_0x8968('0x11')][_0x8968('0x13')]);}else{logger[_0x8968('0xb')](_0x8968('0xc'),_0x13d1fe,_0x8968('0xd'));_0x3f603c(_0x496c83[_0x8968('0x14')][_0x8968('0x13')]);}})[_0x8968('0x15')](function(_0x119914){logger[_0x8968('0x11')](_0x8968('0xc'),_0x13d1fe,_0x119914);_0x368917(_0x119914);});});} \ No newline at end of file +var _0x7f93=['../../config/utils','rpc','jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x599242,_0x5e32a8){var _0x19eb01=function(_0x22d4f2){while(--_0x22d4f2){_0x599242['push'](_0x599242['shift']());}};_0x19eb01(++_0x5e32a8);}(_0x7f93,0x18a));var _0x37f9=function(_0x2cbeb7,_0x236da5){_0x2cbeb7=_0x2cbeb7-0x0;var _0x4210b6=_0x7f93[_0x2cbeb7];return _0x4210b6;};'use strict';var _=require(_0x37f9('0x0'));var util=require(_0x37f9('0x1'));var moment=require(_0x37f9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37f9('0x3'));var db=require(_0x37f9('0x4'))['db'];var utils=require(_0x37f9('0x5'));var logger=require('../../config/logger')(_0x37f9('0x6'));var config=require('../../config/environment');var jayson=require(_0x37f9('0x7'));var client=jayson[_0x37f9('0x8')][_0x37f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf2dc97,_0x41f3a6,_0x5497cc){return new BPromise(function(_0x592e87,_0x4597fa){return client[_0x37f9('0xa')](_0xf2dc97,_0x5497cc)['then'](function(_0x47befd){logger[_0x37f9('0xb')](_0x37f9('0xc'),_0x41f3a6,_0x37f9('0xd'));logger[_0x37f9('0xe')](_0x37f9('0xf'),_0x41f3a6,_0x37f9('0xd'),JSON[_0x37f9('0x10')](_0x47befd));if(_0x47befd[_0x37f9('0x11')]){if(_0x47befd[_0x37f9('0x11')]['code']===0x1f4){logger[_0x37f9('0x11')](_0x37f9('0xc'),_0x41f3a6,_0x47befd['error'][_0x37f9('0x12')]);return _0x4597fa(_0x47befd['error'][_0x37f9('0x12')]);}logger[_0x37f9('0x11')](_0x37f9('0xc'),_0x41f3a6,_0x47befd[_0x37f9('0x11')]['message']);return _0x592e87(_0x47befd['error'][_0x37f9('0x12')]);}else{logger[_0x37f9('0xb')](_0x37f9('0xc'),_0x41f3a6,_0x37f9('0xd'));_0x592e87(_0x47befd[_0x37f9('0x13')][_0x37f9('0x12')]);}})[_0x37f9('0x14')](function(_0x38c3ab){logger[_0x37f9('0x11')](_0x37f9('0xc'),_0x41f3a6,_0x38c3ab);_0x4597fa(_0x38c3ab);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 0c99ae4..ac7ad54 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 _0x099a=['index','create','put','update','delete','/:id','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated'];(function(_0x2db80f,_0x53a76c){var _0x386f4c=function(_0x469e4a){while(--_0x469e4a){_0x2db80f['push'](_0x2db80f['shift']());}};_0x386f4c(++_0x53a76c);}(_0x099a,0x9f));var _0xa099=function(_0x4e8d75,_0x400022){_0x4e8d75=_0x4e8d75-0x0;var _0x3329d6=_0x099a[_0x4e8d75];return _0x3329d6;};'use strict';var multer=require(_0xa099('0x0'));var util=require(_0xa099('0x1'));var path=require('path');var timeout=require(_0xa099('0x2'));var express=require(_0xa099('0x3'));var router=express[_0xa099('0x4')]();var fs_extra=require(_0xa099('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa099('0x6'));var config=require(_0xa099('0x7'));var controller=require(_0xa099('0x8'));router[_0xa099('0x9')]('/',auth[_0xa099('0xa')](),controller[_0xa099('0xb')]);router[_0xa099('0x9')]('/:id',auth[_0xa099('0xa')](),controller['show']);router['post']('/',auth[_0xa099('0xa')](),controller[_0xa099('0xc')]);router[_0xa099('0xd')]('/:id',auth[_0xa099('0xa')](),controller[_0xa099('0xe')]);router[_0xa099('0xf')](_0xa099('0x10'),auth[_0xa099('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4887=['../../config/environment','get','isAuthenticated','index','/:id','show','post','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2e22c5,_0x4b5788){var _0x28d3ec=function(_0x7561f){while(--_0x7561f){_0x2e22c5['push'](_0x2e22c5['shift']());}};_0x28d3ec(++_0x4b5788);}(_0x4887,0x8f));var _0x7488=function(_0x3c3035,_0x813cd2){_0x3c3035=_0x3c3035-0x0;var _0x5ecde8=_0x4887[_0x3c3035];return _0x5ecde8;};'use strict';var multer=require(_0x7488('0x0'));var util=require(_0x7488('0x1'));var path=require(_0x7488('0x2'));var timeout=require(_0x7488('0x3'));var express=require(_0x7488('0x4'));var router=express[_0x7488('0x5')]();var fs_extra=require(_0x7488('0x6'));var auth=require(_0x7488('0x7'));var interaction=require(_0x7488('0x8'));var config=require(_0x7488('0x9'));var controller=require('./intZohoField.controller');router[_0x7488('0xa')]('/',auth[_0x7488('0xb')](),controller[_0x7488('0xc')]);router[_0x7488('0xa')](_0x7488('0xd'),auth['isAuthenticated'](),controller[_0x7488('0xe')]);router[_0x7488('0xf')]('/',auth[_0x7488('0xb')](),controller['create']);router[_0x7488('0x10')](_0x7488('0xd'),auth[_0x7488('0xb')](),controller['update']);router[_0x7488('0x11')](_0x7488('0xd'),auth[_0x7488('0xb')](),controller['destroy']);module[_0x7488('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 31589a8..6a8d13c 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 _0xc4ea=['picklist','string','STRING','variable','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue'];(function(_0xbc2d9e,_0x40ef4f){var _0x2e315c=function(_0x57fc55){while(--_0x57fc55){_0xbc2d9e['push'](_0xbc2d9e['shift']());}};_0x2e315c(++_0x40ef4f);}(_0xc4ea,0xe1));var _0xac4e=function(_0x2e0a06,_0x245626){_0x2e0a06=_0x2e0a06-0x0;var _0x44e511=_0xc4ea[_0x2e0a06];return _0x44e511;};'use strict';var Sequelize=require(_0xac4e('0x0'));module[_0xac4e('0x1')]={'type':{'type':Sequelize[_0xac4e('0x2')]('string','variable',_0xac4e('0x3'),_0xac4e('0x4'),_0xac4e('0x5')),'defaultValue':_0xac4e('0x6')},'content':{'type':Sequelize[_0xac4e('0x7')]},'key':{'type':Sequelize[_0xac4e('0x7')]},'keyType':{'type':Sequelize[_0xac4e('0x2')](_0xac4e('0x6'),_0xac4e('0x8'),_0xac4e('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xac4e('0x7')]},'nameField':{'type':Sequelize[_0xac4e('0x7')]},'customField':{'type':Sequelize[_0xac4e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xac4e('0x7')]}}; \ No newline at end of file +var _0xc254=['customVariable','keyValue','picklist','STRING','variable','exports','ENUM','string'];(function(_0x13597c,_0xa7e638){var _0x18be5e=function(_0x640b63){while(--_0x640b63){_0x13597c['push'](_0x13597c['shift']());}};_0x18be5e(++_0xa7e638);}(_0xc254,0x19d));var _0x4c25=function(_0x307ad6,_0xd1a81f){_0x307ad6=_0x307ad6-0x0;var _0x583ec0=_0xc254[_0x307ad6];return _0x583ec0;};'use strict';var Sequelize=require('sequelize');module[_0x4c25('0x0')]={'type':{'type':Sequelize[_0x4c25('0x1')](_0x4c25('0x2'),'variable',_0x4c25('0x3'),_0x4c25('0x4'),_0x4c25('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4c25('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4c25('0x1')](_0x4c25('0x2'),_0x4c25('0x7'),_0x4c25('0x3'))},'keyContent':{'type':Sequelize[_0x4c25('0x6')]},'idField':{'type':Sequelize[_0x4c25('0x6')]},'nameField':{'type':Sequelize[_0x4c25('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4c25('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 7f55b14..97b12d3 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 _0x1669=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','destroy','error','name','send','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path'];(function(_0x499425,_0x4a8d43){var _0x1060ba=function(_0x3cb5d4){while(--_0x3cb5d4){_0x499425['push'](_0x499425['shift']());}};_0x1060ba(++_0x4a8d43);}(_0x1669,0x1e9));var _0x9166=function(_0x18ae72,_0x1d05d9){_0x18ae72=_0x18ae72-0x0;var _0x34f4ef=_0x1669[_0x18ae72];return _0x34f4ef;};'use strict';var emlformat=require(_0x9166('0x0'));var rimraf=require(_0x9166('0x1'));var zipdir=require(_0x9166('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9166('0x3'));var BPromise=require(_0x9166('0x4'));var Mustache=require(_0x9166('0x5'));var util=require(_0x9166('0x6'));var path=require(_0x9166('0x7'));var sox=require(_0x9166('0x8'));var csv=require(_0x9166('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9166('0xa'));var _=require('lodash');var squel=require(_0x9166('0xb'));var crypto=require(_0x9166('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9166('0xd'));var toCsv=require(_0x9166('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9166('0xe'));var authService=require(_0x9166('0xf'));var qs=require(_0x9166('0x10'));var as=require(_0x9166('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9166('0x12'))(_0x9166('0x13'));var utils=require('../../config/utils');var config=require(_0x9166('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9166('0x15'))['db'];function respondWithStatusCode(_0x3490dc,_0x54c744){_0x54c744=_0x54c744||0xcc;return function(_0x40ecb6){if(_0x40ecb6){return _0x3490dc[_0x9166('0x16')](_0x54c744);}return _0x3490dc[_0x9166('0x17')](_0x54c744)[_0x9166('0x18')]();};}function respondWithResult(_0x339b37,_0x3419c0){_0x3419c0=_0x3419c0||0xc8;return function(_0x3923a7){if(_0x3923a7){return _0x339b37[_0x9166('0x17')](_0x3419c0)['json'](_0x3923a7);}};}function respondWithFilteredResult(_0x527b3c,_0x5014e8){return function(_0x186de6){if(_0x186de6){var _0x16d9b2=typeof _0x5014e8[_0x9166('0x19')]===_0x9166('0x1a')&&typeof _0x5014e8['limit']===_0x9166('0x1a');var _0x3662e4=_0x186de6[_0x9166('0x1b')];var _0x413189=_0x16d9b2?0x0:_0x5014e8[_0x9166('0x19')];var _0x55dd23=_0x16d9b2?_0x186de6[_0x9166('0x1b')]:_0x5014e8[_0x9166('0x19')]+_0x5014e8[_0x9166('0x1c')];var _0x1b7cda;if(_0x55dd23>=_0x3662e4){_0x55dd23=_0x3662e4;_0x1b7cda=0xc8;}else{_0x1b7cda=0xce;}_0x527b3c[_0x9166('0x17')](_0x1b7cda);return _0x527b3c[_0x9166('0x1d')](_0x9166('0x1e'),_0x413189+'-'+_0x55dd23+'/'+_0x3662e4)[_0x9166('0x1f')](_0x186de6);}return null;};}function patchUpdates(_0x53d14b){return function(_0x5ef350){try{jsonpatch[_0x9166('0x20')](_0x5ef350,_0x53d14b,!![]);}catch(_0x5b19d9){return BPromise['reject'](_0x5b19d9);}return _0x5ef350[_0x9166('0x21')]();};}function saveUpdates(_0x52cd13,_0x597014){return function(_0x30f75c){if(_0x30f75c){return _0x30f75c['update'](_0x52cd13)[_0x9166('0x22')](function(_0x2e8547){return _0x2e8547;});}return null;};}function removeEntity(_0x3e047f,_0x15b17f){return function(_0x51cad7){if(_0x51cad7){return _0x51cad7[_0x9166('0x23')]()[_0x9166('0x22')](function(){_0x3e047f[_0x9166('0x17')](0xcc)[_0x9166('0x18')]();});}};}function handleEntityNotFound(_0x1e4e61,_0x4c7c25){return function(_0x21f3f8){if(!_0x21f3f8){_0x1e4e61['sendStatus'](0x194);}return _0x21f3f8;};}function handleError(_0x5e11a8,_0x2f3f6c){_0x2f3f6c=_0x2f3f6c||0x1f4;return function(_0x3dc3a3){logger[_0x9166('0x24')](_0x3dc3a3['stack']);if(_0x3dc3a3[_0x9166('0x25')]){delete _0x3dc3a3[_0x9166('0x25')];}_0x5e11a8[_0x9166('0x17')](_0x2f3f6c)[_0x9166('0x26')](_0x3dc3a3);};}exports['index']=function(_0x559f7d,_0x6989ea){var _0x63ef7={},_0x3896ad={},_0x4727aa={'count':0x0,'rows':[]};var _0x1e9d31=_[_0x9166('0x27')](db[_0x9166('0x28')][_0x9166('0x29')],function(_0x455fce){return{'name':_0x455fce[_0x9166('0x2a')],'type':_0x455fce[_0x9166('0x2b')][_0x9166('0x2c')]};});_0x3896ad[_0x9166('0x2d')]=_[_0x9166('0x27')](_0x1e9d31,_0x9166('0x25'));_0x3896ad[_0x9166('0x2e')]=_[_0x9166('0x2f')](_0x559f7d[_0x9166('0x2e')]);_0x3896ad[_0x9166('0x30')]=_[_0x9166('0x31')](_0x3896ad[_0x9166('0x2d')],_0x3896ad['query']);_0x63ef7['attributes']=_[_0x9166('0x31')](_0x3896ad[_0x9166('0x2d')],qs[_0x9166('0x32')](_0x559f7d[_0x9166('0x2e')][_0x9166('0x32')]));_0x63ef7[_0x9166('0x33')]=_0x63ef7[_0x9166('0x33')][_0x9166('0x34')]?_0x63ef7[_0x9166('0x33')]:_0x3896ad[_0x9166('0x2d')];if(!_0x559f7d[_0x9166('0x2e')][_0x9166('0x35')](_0x9166('0x36'))){_0x63ef7['limit']=qs[_0x9166('0x1c')](_0x559f7d['query'][_0x9166('0x1c')]);_0x63ef7[_0x9166('0x19')]=qs[_0x9166('0x19')](_0x559f7d[_0x9166('0x2e')][_0x9166('0x19')]);}_0x63ef7[_0x9166('0x37')]=qs['sort'](_0x559f7d[_0x9166('0x2e')][_0x9166('0x38')]);_0x63ef7[_0x9166('0x39')]=qs['filters'](_['pick'](_0x559f7d[_0x9166('0x2e')],_0x3896ad[_0x9166('0x30')]),_0x1e9d31);if(_0x559f7d[_0x9166('0x2e')][_0x9166('0x3a')]){_0x63ef7[_0x9166('0x39')]=_[_0x9166('0x3b')](_0x63ef7[_0x9166('0x39')],{'$or':_['map'](_0x1e9d31,function(_0x4c5855){if(_0x4c5855['type']!=='VIRTUAL'){var _0x1fd26e={};_0x1fd26e[_0x4c5855[_0x9166('0x25')]]={'$like':'%'+_0x559f7d[_0x9166('0x2e')][_0x9166('0x3a')]+'%'};return _0x1fd26e;}})});}_0x63ef7=_[_0x9166('0x3b')]({},_0x63ef7,_0x559f7d[_0x9166('0x3c')]);var _0x2af235={'where':_0x63ef7[_0x9166('0x39')]};return db[_0x9166('0x28')][_0x9166('0x1b')](_0x2af235)['then'](function(_0x4a0eb4){_0x4727aa[_0x9166('0x1b')]=_0x4a0eb4;if(_0x559f7d[_0x9166('0x2e')][_0x9166('0x3d')]){_0x63ef7['include']=[{'all':!![]}];}return db['ZohoField'][_0x9166('0x3e')](_0x63ef7);})[_0x9166('0x22')](function(_0x105ac7){_0x4727aa[_0x9166('0x3f')]=_0x105ac7;return _0x4727aa;})[_0x9166('0x22')](respondWithFilteredResult(_0x6989ea,_0x63ef7))[_0x9166('0x40')](handleError(_0x6989ea,null));};exports[_0x9166('0x41')]=function(_0x283c1a,_0x35349e){var _0x48f9c8={'raw':!![],'where':{'id':_0x283c1a[_0x9166('0x42')]['id']}},_0x23db67={};_0x23db67['model']=_[_0x9166('0x2f')](db[_0x9166('0x28')][_0x9166('0x29')]);_0x23db67[_0x9166('0x2e')]=_['keys'](_0x283c1a[_0x9166('0x2e')]);_0x23db67['filters']=_[_0x9166('0x31')](_0x23db67[_0x9166('0x2d')],_0x23db67[_0x9166('0x2e')]);_0x48f9c8['attributes']=_['intersection'](_0x23db67[_0x9166('0x2d')],qs[_0x9166('0x32')](_0x283c1a[_0x9166('0x2e')][_0x9166('0x32')]));_0x48f9c8[_0x9166('0x33')]=_0x48f9c8[_0x9166('0x33')]['length']?_0x48f9c8[_0x9166('0x33')]:_0x23db67[_0x9166('0x2d')];if(_0x283c1a['query'][_0x9166('0x3d')]){_0x48f9c8[_0x9166('0x43')]=[{'all':!![]}];}_0x48f9c8=_[_0x9166('0x3b')]({},_0x48f9c8,_0x283c1a[_0x9166('0x3c')]);return db['ZohoField']['find'](_0x48f9c8)[_0x9166('0x22')](handleEntityNotFound(_0x35349e,null))['then'](respondWithResult(_0x35349e,null))[_0x9166('0x40')](handleError(_0x35349e,null));};exports[_0x9166('0x44')]=function(_0x525319,_0x4c9509){return db['ZohoField'][_0x9166('0x44')](_0x525319[_0x9166('0x45')],{})[_0x9166('0x22')](respondWithResult(_0x4c9509,0xc9))[_0x9166('0x40')](handleError(_0x4c9509,null));};exports['update']=function(_0x30002d,_0x53cedb){if(_0x30002d[_0x9166('0x45')]['id']){delete _0x30002d[_0x9166('0x45')]['id'];}return db[_0x9166('0x28')][_0x9166('0x46')]({'where':{'id':_0x30002d[_0x9166('0x42')]['id']}})[_0x9166('0x22')](handleEntityNotFound(_0x53cedb,null))['then'](saveUpdates(_0x30002d[_0x9166('0x45')],null))['then'](respondWithResult(_0x53cedb,null))['catch'](handleError(_0x53cedb,null));};exports['destroy']=function(_0x4eae43,_0x16cf73){return db[_0x9166('0x28')]['find']({'where':{'id':_0x4eae43['params']['id']}})['then'](handleEntityNotFound(_0x16cf73,null))[_0x9166('0x22')](removeEntity(_0x16cf73,null))['catch'](handleError(_0x16cf73,null));}; \ No newline at end of file +var _0x8b42=['destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','options','include','ZohoField','findAll','catch','show','params','includeAll','create','body'];(function(_0x412f7d,_0x5c36c4){var _0xd46f09=function(_0x123d74){while(--_0x123d74){_0x412f7d['push'](_0x412f7d['shift']());}};_0xd46f09(++_0x5c36c4);}(_0x8b42,0x1d6));var _0x28b4=function(_0xaec5bc,_0x15d081){_0xaec5bc=_0xaec5bc-0x0;var _0x228d8c=_0x8b42[_0xaec5bc];return _0x228d8c;};'use strict';var emlformat=require(_0x28b4('0x0'));var rimraf=require(_0x28b4('0x1'));var zipdir=require(_0x28b4('0x2'));var jsonpatch=require(_0x28b4('0x3'));var rp=require(_0x28b4('0x4'));var moment=require(_0x28b4('0x5'));var BPromise=require(_0x28b4('0x6'));var Mustache=require(_0x28b4('0x7'));var util=require(_0x28b4('0x8'));var path=require(_0x28b4('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x28b4('0xa'));var fs=require('fs');var fs_extra=require(_0x28b4('0xb'));var _=require(_0x28b4('0xc'));var squel=require(_0x28b4('0xd'));var crypto=require(_0x28b4('0xe'));var jsforce=require(_0x28b4('0xf'));var deskjs=require(_0x28b4('0x10'));var toCsv=require(_0x28b4('0x11'));var querystring=require(_0x28b4('0x12'));var Papa=require(_0x28b4('0x13'));var Redis=require(_0x28b4('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x28b4('0x15'));var as=require(_0x28b4('0x16'));var hardwareService=require(_0x28b4('0x17'));var logger=require('../../config/logger')(_0x28b4('0x18'));var utils=require(_0x28b4('0x19'));var config=require(_0x28b4('0x1a'));var licenseUtil=require(_0x28b4('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ed96c,_0x475fe5){_0x475fe5=_0x475fe5||0xcc;return function(_0x1897fe){if(_0x1897fe){return _0x3ed96c['sendStatus'](_0x475fe5);}return _0x3ed96c['status'](_0x475fe5)[_0x28b4('0x1c')]();};}function respondWithResult(_0x3065c1,_0x1bee13){_0x1bee13=_0x1bee13||0xc8;return function(_0x26fde9){if(_0x26fde9){return _0x3065c1[_0x28b4('0x1d')](_0x1bee13)[_0x28b4('0x1e')](_0x26fde9);}};}function respondWithFilteredResult(_0x1eec93,_0x145d7d){return function(_0x2d1850){if(_0x2d1850){var _0x771bd1=typeof _0x145d7d[_0x28b4('0x1f')]===_0x28b4('0x20')&&typeof _0x145d7d[_0x28b4('0x21')]===_0x28b4('0x20');var _0x2c3975=_0x2d1850[_0x28b4('0x22')];var _0xe6ad78=_0x771bd1?0x0:_0x145d7d[_0x28b4('0x1f')];var _0x564c99=_0x771bd1?_0x2d1850[_0x28b4('0x22')]:_0x145d7d[_0x28b4('0x1f')]+_0x145d7d['limit'];var _0x1abe48;if(_0x564c99>=_0x2c3975){_0x564c99=_0x2c3975;_0x1abe48=0xc8;}else{_0x1abe48=0xce;}_0x1eec93[_0x28b4('0x1d')](_0x1abe48);return _0x1eec93[_0x28b4('0x23')](_0x28b4('0x24'),_0xe6ad78+'-'+_0x564c99+'/'+_0x2c3975)[_0x28b4('0x1e')](_0x2d1850);}return null;};}function patchUpdates(_0x1e6189){return function(_0x3a2c0f){try{jsonpatch[_0x28b4('0x25')](_0x3a2c0f,_0x1e6189,!![]);}catch(_0x24f671){return BPromise[_0x28b4('0x26')](_0x24f671);}return _0x3a2c0f[_0x28b4('0x27')]();};}function saveUpdates(_0x157d49,_0x4f1666){return function(_0x2325f5){if(_0x2325f5){return _0x2325f5[_0x28b4('0x28')](_0x157d49)[_0x28b4('0x29')](function(_0x581f14){return _0x581f14;});}return null;};}function removeEntity(_0xd2c329,_0x331fe2){return function(_0x2a6457){if(_0x2a6457){return _0x2a6457['destroy']()[_0x28b4('0x29')](function(){_0xd2c329[_0x28b4('0x1d')](0xcc)[_0x28b4('0x1c')]();});}};}function handleEntityNotFound(_0x492d0d,_0x1a1515){return function(_0x3c6efb){if(!_0x3c6efb){_0x492d0d[_0x28b4('0x2a')](0x194);}return _0x3c6efb;};}function handleError(_0x4aa0de,_0x43c9dd){_0x43c9dd=_0x43c9dd||0x1f4;return function(_0x4dd197){logger[_0x28b4('0x2b')](_0x4dd197[_0x28b4('0x2c')]);if(_0x4dd197[_0x28b4('0x2d')]){delete _0x4dd197[_0x28b4('0x2d')];}_0x4aa0de[_0x28b4('0x1d')](_0x43c9dd)[_0x28b4('0x2e')](_0x4dd197);};}exports['index']=function(_0x4cd829,_0x256c81){var _0x530313={},_0x2fa188={},_0x1590c9={'count':0x0,'rows':[]};var _0x285fd8=_[_0x28b4('0x2f')](db['ZohoField'][_0x28b4('0x30')],function(_0x14f27c){return{'name':_0x14f27c[_0x28b4('0x31')],'type':_0x14f27c[_0x28b4('0x32')][_0x28b4('0x33')]};});_0x2fa188['model']=_['map'](_0x285fd8,_0x28b4('0x2d'));_0x2fa188[_0x28b4('0x34')]=_[_0x28b4('0x35')](_0x4cd829[_0x28b4('0x34')]);_0x2fa188['filters']=_[_0x28b4('0x36')](_0x2fa188[_0x28b4('0x37')],_0x2fa188[_0x28b4('0x34')]);_0x530313[_0x28b4('0x38')]=_[_0x28b4('0x36')](_0x2fa188['model'],qs['fields'](_0x4cd829[_0x28b4('0x34')][_0x28b4('0x39')]));_0x530313['attributes']=_0x530313[_0x28b4('0x38')][_0x28b4('0x3a')]?_0x530313['attributes']:_0x2fa188[_0x28b4('0x37')];if(!_0x4cd829[_0x28b4('0x34')][_0x28b4('0x3b')]('nolimit')){_0x530313['limit']=qs[_0x28b4('0x21')](_0x4cd829[_0x28b4('0x34')]['limit']);_0x530313[_0x28b4('0x1f')]=qs[_0x28b4('0x1f')](_0x4cd829[_0x28b4('0x34')]['offset']);}_0x530313['order']=qs[_0x28b4('0x3c')](_0x4cd829[_0x28b4('0x34')][_0x28b4('0x3c')]);_0x530313[_0x28b4('0x3d')]=qs['filters'](_[_0x28b4('0x3e')](_0x4cd829[_0x28b4('0x34')],_0x2fa188[_0x28b4('0x3f')]),_0x285fd8);if(_0x4cd829[_0x28b4('0x34')][_0x28b4('0x40')]){_0x530313[_0x28b4('0x3d')]=_[_0x28b4('0x41')](_0x530313['where'],{'$or':_['map'](_0x285fd8,function(_0x5bfbe7){if(_0x5bfbe7['type']!=='VIRTUAL'){var _0x2fa4f5={};_0x2fa4f5[_0x5bfbe7['name']]={'$like':'%'+_0x4cd829[_0x28b4('0x34')]['filter']+'%'};return _0x2fa4f5;}})});}_0x530313=_[_0x28b4('0x41')]({},_0x530313,_0x4cd829[_0x28b4('0x42')]);var _0x47f533={'where':_0x530313[_0x28b4('0x3d')]};return db['ZohoField'][_0x28b4('0x22')](_0x47f533)[_0x28b4('0x29')](function(_0x66809f){_0x1590c9['count']=_0x66809f;if(_0x4cd829[_0x28b4('0x34')]['includeAll']){_0x530313[_0x28b4('0x43')]=[{'all':!![]}];}return db[_0x28b4('0x44')][_0x28b4('0x45')](_0x530313);})['then'](function(_0x5b549e){_0x1590c9['rows']=_0x5b549e;return _0x1590c9;})[_0x28b4('0x29')](respondWithFilteredResult(_0x256c81,_0x530313))[_0x28b4('0x46')](handleError(_0x256c81,null));};exports[_0x28b4('0x47')]=function(_0x34f138,_0xab854){var _0x572356={'raw':!![],'where':{'id':_0x34f138[_0x28b4('0x48')]['id']}},_0x1668b5={};_0x1668b5[_0x28b4('0x37')]=_['keys'](db[_0x28b4('0x44')][_0x28b4('0x30')]);_0x1668b5[_0x28b4('0x34')]=_[_0x28b4('0x35')](_0x34f138[_0x28b4('0x34')]);_0x1668b5[_0x28b4('0x3f')]=_['intersection'](_0x1668b5[_0x28b4('0x37')],_0x1668b5[_0x28b4('0x34')]);_0x572356[_0x28b4('0x38')]=_['intersection'](_0x1668b5[_0x28b4('0x37')],qs['fields'](_0x34f138[_0x28b4('0x34')]['fields']));_0x572356[_0x28b4('0x38')]=_0x572356[_0x28b4('0x38')][_0x28b4('0x3a')]?_0x572356[_0x28b4('0x38')]:_0x1668b5['model'];if(_0x34f138[_0x28b4('0x34')][_0x28b4('0x49')]){_0x572356['include']=[{'all':!![]}];}_0x572356=_['merge']({},_0x572356,_0x34f138['options']);return db[_0x28b4('0x44')]['find'](_0x572356)[_0x28b4('0x29')](handleEntityNotFound(_0xab854,null))[_0x28b4('0x29')](respondWithResult(_0xab854,null))['catch'](handleError(_0xab854,null));};exports['create']=function(_0x310b32,_0x463b19){return db[_0x28b4('0x44')][_0x28b4('0x4a')](_0x310b32['body'],{})[_0x28b4('0x29')](respondWithResult(_0x463b19,0xc9))[_0x28b4('0x46')](handleError(_0x463b19,null));};exports[_0x28b4('0x28')]=function(_0x5364de,_0x24a256){if(_0x5364de['body']['id']){delete _0x5364de[_0x28b4('0x4b')]['id'];}return db[_0x28b4('0x44')]['find']({'where':{'id':_0x5364de[_0x28b4('0x48')]['id']}})[_0x28b4('0x29')](handleEntityNotFound(_0x24a256,null))[_0x28b4('0x29')](saveUpdates(_0x5364de[_0x28b4('0x4b')],null))[_0x28b4('0x29')](respondWithResult(_0x24a256,null))[_0x28b4('0x46')](handleError(_0x24a256,null));};exports[_0x28b4('0x4c')]=function(_0x485964,_0x316278){return db[_0x28b4('0x44')][_0x28b4('0x4d')]({'where':{'id':_0x485964['params']['id']}})[_0x28b4('0x29')](handleEntityNotFound(_0x316278,null))[_0x28b4('0x29')](removeEntity(_0x316278,null))[_0x28b4('0x46')](handleError(_0x316278,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 1059f20..e2f8b87 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 _0x7046=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','ZohoField','idField'];(function(_0x1b2c84,_0xef85e){var _0x311f4d=function(_0x44336f){while(--_0x44336f){_0x1b2c84['push'](_0x1b2c84['shift']());}};_0x311f4d(++_0xef85e);}(_0x7046,0x144));var _0x6704=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7046[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));module[_0x6704('0x9')]=function(_0x626a14,_0x2917be){return _0x626a14['define'](_0x6704('0xa'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x6704('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0120=['rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5c1b05,_0x213768){var _0x1a65e7=function(_0x2845d7){while(--_0x2845d7){_0x5c1b05['push'](_0x5c1b05['shift']());}};_0x1a65e7(++_0x213768);}(_0x0120,0x6f));var _0x0012=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x0120[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var logger=require(_0x0012('0x2'))(_0x0012('0x3'));var moment=require(_0x0012('0x4'));var BPromise=require(_0x0012('0x5'));var rp=require(_0x0012('0x6'));var fs=require('fs');var path=require(_0x0012('0x7'));var rimraf=require(_0x0012('0x8'));var config=require(_0x0012('0x9'));var attributes=require(_0x0012('0xa'));module[_0x0012('0xb')]=function(_0x4eaa5b,_0x4b396c){return _0x4eaa5b['define'](_0x0012('0xc'),attributes,{'tableName':_0x0012('0xd'),'paranoid':![],'indexes':[{'name':_0x0012('0xe'),'fields':[_0x0012('0xf'),_0x0012('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index e1edb4f..c5e3979 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 _0xc325=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoField,\x20%s,\x20%s','message','lodash'];(function(_0x481ef5,_0x1932b4){var _0xe66fa2=function(_0xb4143){while(--_0xb4143){_0x481ef5['push'](_0x481ef5['shift']());}};_0xe66fa2(++_0x1932b4);}(_0xc325,0x1a3));var _0x5c32=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc325[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x5c32('0x0'));var util=require('util');var moment=require(_0x5c32('0x1'));var BPromise=require(_0x5c32('0x2'));var rs=require(_0x5c32('0x3'));var fs=require('fs');var Redis=require(_0x5c32('0x4'));var db=require(_0x5c32('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5c32('0x6'));var jayson=require(_0x5c32('0x7'));var client=jayson['client'][_0x5c32('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc007df,_0x25d25d,_0x213841){return new BPromise(function(_0x4491cd,_0xa62243){return client[_0x5c32('0x9')](_0xc007df,_0x213841)[_0x5c32('0xa')](function(_0x4c8380){logger[_0x5c32('0xb')]('ZohoField,\x20%s,\x20%s',_0x25d25d,_0x5c32('0xc'));logger[_0x5c32('0xd')](_0x5c32('0xe'),_0x25d25d,_0x5c32('0xc'),JSON[_0x5c32('0xf')](_0x4c8380));if(_0x4c8380[_0x5c32('0x10')]){if(_0x4c8380[_0x5c32('0x10')][_0x5c32('0x11')]===0x1f4){logger[_0x5c32('0x10')](_0x5c32('0x12'),_0x25d25d,_0x4c8380[_0x5c32('0x10')][_0x5c32('0x13')]);return _0xa62243(_0x4c8380[_0x5c32('0x10')]['message']);}logger['error']('ZohoField,\x20%s,\x20%s',_0x25d25d,_0x4c8380['error'][_0x5c32('0x13')]);return _0x4491cd(_0x4c8380[_0x5c32('0x10')]['message']);}else{logger[_0x5c32('0xb')](_0x5c32('0x12'),_0x25d25d,_0x5c32('0xc'));_0x4491cd(_0x4c8380['result'][_0x5c32('0x13')]);}})['catch'](function(_0x3892ea){logger['error'](_0x5c32('0x12'),_0x25d25d,_0x3892ea);_0xa62243(_0x3892ea);});});} \ No newline at end of file +var _0x1dce=['http','request','then','info','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','ZohoField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x1dce,0x12d));var _0xe1dc=function(_0x4117f2,_0x36615e){_0x4117f2=_0x4117f2-0x0;var _0x15718d=_0x1dce[_0x4117f2];return _0x15718d;};'use strict';var _=require(_0xe1dc('0x0'));var util=require(_0xe1dc('0x1'));var moment=require(_0xe1dc('0x2'));var BPromise=require(_0xe1dc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe1dc('0x4'));var db=require(_0xe1dc('0x5'))['db'];var utils=require(_0xe1dc('0x6'));var logger=require(_0xe1dc('0x7'))(_0xe1dc('0x8'));var config=require(_0xe1dc('0x9'));var jayson=require(_0xe1dc('0xa'));var client=jayson['client'][_0xe1dc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x274b41,_0x49a65d,_0x5cfb7c){return new BPromise(function(_0x164b64,_0xefc4cc){return client[_0xe1dc('0xc')](_0x274b41,_0x5cfb7c)[_0xe1dc('0xd')](function(_0x2b6b71){logger[_0xe1dc('0xe')]('ZohoField,\x20%s,\x20%s',_0x49a65d,'request\x20sent');logger[_0xe1dc('0xf')](_0xe1dc('0x10'),_0x49a65d,_0xe1dc('0x11'),JSON['stringify'](_0x2b6b71));if(_0x2b6b71['error']){if(_0x2b6b71[_0xe1dc('0x12')][_0xe1dc('0x13')]===0x1f4){logger[_0xe1dc('0x12')]('ZohoField,\x20%s,\x20%s',_0x49a65d,_0x2b6b71[_0xe1dc('0x12')][_0xe1dc('0x14')]);return _0xefc4cc(_0x2b6b71[_0xe1dc('0x12')][_0xe1dc('0x14')]);}logger[_0xe1dc('0x12')](_0xe1dc('0x15'),_0x49a65d,_0x2b6b71[_0xe1dc('0x12')][_0xe1dc('0x14')]);return _0x164b64(_0x2b6b71[_0xe1dc('0x12')][_0xe1dc('0x14')]);}else{logger['info'](_0xe1dc('0x15'),_0x49a65d,_0xe1dc('0x11'));_0x164b64(_0x2b6b71[_0xe1dc('0x16')][_0xe1dc('0x14')]);}})[_0xe1dc('0x17')](function(_0x5f56ee){logger[_0xe1dc('0x12')]('ZohoField,\x20%s,\x20%s',_0x49a65d,_0x5f56ee);_0xefc4cc(_0x5f56ee);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 2a66d0e..660b486 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4af223,_0x385f6c){var _0x70ed03=function(_0x5bc6b4){while(--_0x5bc6b4){_0x4af223['push'](_0x4af223['shift']());}};_0x70ed03(++_0x385f6c);}(_0xedd9,0xfc));var _0x9edd=function(_0x5ca721,_0x4a34b3){_0x5ca721=_0x5ca721-0x0;var _0x4b9d9b=_0xedd9[_0x5ca721];return _0x4b9d9b;};'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(_0x9fc5a2,_0x46c38f){var _0x10a4a8=function(_0x2aeef2){while(--_0x2aeef2){_0x9fc5a2['push'](_0x9fc5a2['shift']());}};_0x10a4a8(++_0x46c38f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index e10bb90..607d4cd 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 _0xb47f=['unique_name_and_version','INTEGER','BOOLEAN','state','sequelize','exports','STRING'];(function(_0x333fcb,_0x464d78){var _0x2ec584=function(_0x248366){while(--_0x248366){_0x333fcb['push'](_0x333fcb['shift']());}};_0x2ec584(++_0x464d78);}(_0xb47f,0x15b));var _0xfb47=function(_0x9a2f5,_0x6095ba){_0x9a2f5=_0x9a2f5-0x0;var _0x1b9757=_0xb47f[_0x9a2f5];return _0x1b9757;};'use strict';var Sequelize=require(_0xfb47('0x0'));module[_0xfb47('0x1')]={'name':{'type':Sequelize[_0xfb47('0x2')],'allowNull':![],'unique':_0xfb47('0x3')},'version':{'type':Sequelize[_0xfb47('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xfb47('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xfb47('0x2')]},'path':{'type':Sequelize[_0xfb47('0x2')]},'type':{'type':Sequelize[_0xfb47('0x2')]},'size':{'type':Sequelize[_0xfb47('0x4')]},'active':{'type':Sequelize[_0xfb47('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xfb47('0x2')]},'state':{'type':Sequelize[_0xfb47('0x2')],'unique':_0xfb47('0x6')},'description':{'type':Sequelize[_0xfb47('0x2')]},'title':{'type':Sequelize[_0xfb47('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xfb47('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x1dd1=['exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','sequelize'];(function(_0x10881f,_0xe03f73){var _0x5692e6=function(_0x4c7721){while(--_0x4c7721){_0x10881f['push'](_0x10881f['shift']());}};_0x5692e6(++_0xe03f73);}(_0x1dd1,0x1e2));var _0x11dd=function(_0x3a8b2d,_0x4ea870){_0x3a8b2d=_0x3a8b2d-0x0;var _0x54f1be=_0x1dd1[_0x3a8b2d];return _0x54f1be;};'use strict';var Sequelize=require(_0x11dd('0x0'));module[_0x11dd('0x1')]={'name':{'type':Sequelize[_0x11dd('0x2')],'allowNull':![],'unique':_0x11dd('0x3')},'version':{'type':Sequelize[_0x11dd('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0x11dd('0x4')},'filename':{'type':Sequelize[_0x11dd('0x2')]},'path':{'type':Sequelize[_0x11dd('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x11dd('0x5')]},'active':{'type':Sequelize[_0x11dd('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x11dd('0x2')]},'state':{'type':Sequelize[_0x11dd('0x2')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x11dd('0x2')]},'remoteUri':{'type':Sequelize[_0x11dd('0x2')]},'link':{'type':Sequelize[_0x11dd('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 2596bba..85ecd69 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 _0x1883=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Integration','includeAll','include','findAll','params','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x5d89a4,_0x34db72){var _0x544d8a=function(_0x585875){while(--_0x585875){_0x5d89a4['push'](_0x5d89a4['shift']());}};_0x544d8a(++_0x34db72);}(_0x1883,0xab));var _0x3188=function(_0x370656,_0x125dd9){_0x370656=_0x370656-0x0;var _0x33e1f5=_0x1883[_0x370656];return _0x33e1f5;};'use strict';var emlformat=require(_0x3188('0x0'));var rimraf=require(_0x3188('0x1'));var zipdir=require(_0x3188('0x2'));var jsonpatch=require(_0x3188('0x3'));var rp=require(_0x3188('0x4'));var moment=require(_0x3188('0x5'));var BPromise=require(_0x3188('0x6'));var Mustache=require(_0x3188('0x7'));var util=require(_0x3188('0x8'));var path=require(_0x3188('0x9'));var sox=require(_0x3188('0xa'));var csv=require(_0x3188('0xb'));var ejs=require(_0x3188('0xc'));var fs=require('fs');var fs_extra=require(_0x3188('0xd'));var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xb'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3188('0x19'))['db'];function respondWithStatusCode(_0x45e94e,_0x20fef6){_0x20fef6=_0x20fef6||0xcc;return function(_0x3ae228){if(_0x3ae228){return _0x45e94e[_0x3188('0x1a')](_0x20fef6);}return _0x45e94e[_0x3188('0x1b')](_0x20fef6)['end']();};}function respondWithResult(_0x276d69,_0x5e0044){_0x5e0044=_0x5e0044||0xc8;return function(_0x4a2f36){if(_0x4a2f36){return _0x276d69[_0x3188('0x1b')](_0x5e0044)['json'](_0x4a2f36);}};}function respondWithFilteredResult(_0x54a87f,_0x32c239){return function(_0x1beead){if(_0x1beead){var _0xa2269=typeof _0x32c239[_0x3188('0x1c')]===_0x3188('0x1d')&&typeof _0x32c239[_0x3188('0x1e')]==='undefined';var _0x19cc72=_0x1beead[_0x3188('0x1f')];var _0x3f5b35=_0xa2269?0x0:_0x32c239[_0x3188('0x1c')];var _0x18a71a=_0xa2269?_0x1beead[_0x3188('0x1f')]:_0x32c239[_0x3188('0x1c')]+_0x32c239[_0x3188('0x1e')];var _0x5bcbba;if(_0x18a71a>=_0x19cc72){_0x18a71a=_0x19cc72;_0x5bcbba=0xc8;}else{_0x5bcbba=0xce;}_0x54a87f[_0x3188('0x1b')](_0x5bcbba);return _0x54a87f[_0x3188('0x20')]('Content-Range',_0x3f5b35+'-'+_0x18a71a+'/'+_0x19cc72)['json'](_0x1beead);}return null;};}function patchUpdates(_0x5d8d62){return function(_0x46a318){try{jsonpatch[_0x3188('0x21')](_0x46a318,_0x5d8d62,!![]);}catch(_0xd292b5){return BPromise['reject'](_0xd292b5);}return _0x46a318['save']();};}function saveUpdates(_0x266260,_0x461286){return function(_0x375077){if(_0x375077){return _0x375077[_0x3188('0x22')](_0x266260)[_0x3188('0x23')](function(_0x4bd5ee){return _0x4bd5ee;});}return null;};}function removeEntity(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(_0x5a2e67){return _0x5a2e67[_0x3188('0x24')]()['then'](function(){_0x30cf2c['status'](0xcc)[_0x3188('0x25')]();});}};}function handleEntityNotFound(_0x129bd7,_0x87d5a3){return function(_0x1aeaba){if(!_0x1aeaba){_0x129bd7[_0x3188('0x1a')](0x194);}return _0x1aeaba;};}function handleError(_0x2cd060,_0xe57f73){_0xe57f73=_0xe57f73||0x1f4;return function(_0x11021c){logger['error'](_0x11021c[_0x3188('0x26')]);if(_0x11021c[_0x3188('0x27')]){delete _0x11021c['name'];}_0x2cd060[_0x3188('0x1b')](_0xe57f73)[_0x3188('0x28')](_0x11021c);};}exports[_0x3188('0x29')]=function(_0x44db9a,_0x20e6aa){var _0x1f1c6f={},_0x8f810f={},_0x472926={'count':0x0,'rows':[]};var _0x57c21c=_[_0x3188('0x2a')](db['Integration'][_0x3188('0x2b')],function(_0x5623f1){return{'name':_0x5623f1[_0x3188('0x2c')],'type':_0x5623f1[_0x3188('0x2d')][_0x3188('0x2e')]};});_0x8f810f[_0x3188('0x2f')]=_[_0x3188('0x2a')](_0x57c21c,_0x3188('0x27'));_0x8f810f[_0x3188('0x30')]=_[_0x3188('0x31')](_0x44db9a[_0x3188('0x30')]);_0x8f810f[_0x3188('0x32')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],_0x8f810f[_0x3188('0x30')]);_0x1f1c6f[_0x3188('0x34')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],qs[_0x3188('0x35')](_0x44db9a[_0x3188('0x30')]['fields']));_0x1f1c6f[_0x3188('0x34')]=_0x1f1c6f['attributes'][_0x3188('0x36')]?_0x1f1c6f[_0x3188('0x34')]:_0x8f810f['model'];if(!_0x44db9a[_0x3188('0x30')][_0x3188('0x37')](_0x3188('0x38'))){_0x1f1c6f[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x44db9a[_0x3188('0x30')][_0x3188('0x1e')]);_0x1f1c6f['offset']=qs['offset'](_0x44db9a[_0x3188('0x30')][_0x3188('0x1c')]);}_0x1f1c6f[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x44db9a['query'][_0x3188('0x3a')]);_0x1f1c6f[_0x3188('0x3b')]=qs[_0x3188('0x32')](_[_0x3188('0x3c')](_0x44db9a['query'],_0x8f810f[_0x3188('0x32')]),_0x57c21c);if(_0x44db9a['query'][_0x3188('0x3d')]){_0x1f1c6f['where']=_[_0x3188('0x3e')](_0x1f1c6f[_0x3188('0x3b')],{'$or':_[_0x3188('0x2a')](_0x57c21c,function(_0x2990c4){if(_0x2990c4[_0x3188('0x2d')]!==_0x3188('0x3f')){var _0x4666b2={};_0x4666b2[_0x2990c4[_0x3188('0x27')]]={'$like':'%'+_0x44db9a[_0x3188('0x30')][_0x3188('0x3d')]+'%'};return _0x4666b2;}})});}_0x1f1c6f=_['merge']({},_0x1f1c6f,_0x44db9a[_0x3188('0x40')]);var _0x2bad0f={'where':_0x1f1c6f[_0x3188('0x3b')]};return db[_0x3188('0x41')][_0x3188('0x1f')](_0x2bad0f)[_0x3188('0x23')](function(_0x5a815d){_0x472926[_0x3188('0x1f')]=_0x5a815d;if(_0x44db9a['query'][_0x3188('0x42')]){_0x1f1c6f[_0x3188('0x43')]=[{'all':!![]}];}return db[_0x3188('0x41')][_0x3188('0x44')](_0x1f1c6f);})[_0x3188('0x23')](function(_0x549ab2){_0x472926['rows']=_0x549ab2;return _0x472926;})['then'](respondWithFilteredResult(_0x20e6aa,_0x1f1c6f))['catch'](handleError(_0x20e6aa,null));};exports['show']=function(_0x763943,_0x28c224){var _0x3e5f90={'raw':![],'where':{'id':_0x763943[_0x3188('0x45')]['id']}},_0x1b40b1={};_0x1b40b1['model']=_[_0x3188('0x31')](db['Integration'][_0x3188('0x2b')]);_0x1b40b1[_0x3188('0x30')]=_[_0x3188('0x31')](_0x763943[_0x3188('0x30')]);_0x1b40b1['filters']=_[_0x3188('0x33')](_0x1b40b1[_0x3188('0x2f')],_0x1b40b1[_0x3188('0x30')]);_0x3e5f90[_0x3188('0x34')]=_[_0x3188('0x33')](_0x1b40b1['model'],qs['fields'](_0x763943[_0x3188('0x30')][_0x3188('0x35')]));_0x3e5f90['attributes']=_0x3e5f90[_0x3188('0x34')][_0x3188('0x36')]?_0x3e5f90['attributes']:_0x1b40b1[_0x3188('0x2f')];if(_0x763943[_0x3188('0x30')][_0x3188('0x42')]){_0x3e5f90[_0x3188('0x43')]=[{'all':!![]}];}_0x3e5f90=_[_0x3188('0x3e')]({},_0x3e5f90,_0x763943['options']);return db[_0x3188('0x41')]['find'](_0x3e5f90)[_0x3188('0x23')](handleEntityNotFound(_0x28c224,null))[_0x3188('0x23')](respondWithResult(_0x28c224,null))[_0x3188('0x46')](handleError(_0x28c224,null));};exports[_0x3188('0x47')]=function(_0xe4cbb0,_0x315524){return db[_0x3188('0x41')][_0x3188('0x47')](_0xe4cbb0[_0x3188('0x48')],{})[_0x3188('0x23')](respondWithResult(_0x315524,0xc9))[_0x3188('0x46')](handleError(_0x315524,null));};exports['update']=function(_0x50fd56,_0x1b012d){if(_0x50fd56['body']['id']){delete _0x50fd56[_0x3188('0x48')]['id'];}return db[_0x3188('0x41')]['find']({'where':{'id':_0x50fd56[_0x3188('0x45')]['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x1b012d,null))[_0x3188('0x23')](saveUpdates(_0x50fd56[_0x3188('0x48')],null))[_0x3188('0x23')](respondWithResult(_0x1b012d,null))[_0x3188('0x46')](handleError(_0x1b012d,null));};exports[_0x3188('0x24')]=function(_0x1e3592,_0x59a177){return db[_0x3188('0x41')][_0x3188('0x49')]({'where':{'id':_0x1e3592['params']['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x59a177,null))['then'](removeEntity(_0x59a177,null))[_0x3188('0x46')](handleError(_0x59a177,null));}; \ No newline at end of file +var _0x524e=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','Integration','then','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x524e,0x15e));var _0xe524=function(_0x54823a,_0xd9d810){_0x54823a=_0x54823a-0x0;var _0xa92669=_0x524e[_0x54823a];return _0xa92669;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['Integration'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['create'](_0x3d7ab7[_0xe524('0x49')],{})['then'](respondWithResult(_0x33b1c8,0xc9))['catch'](handleError(_0x33b1c8,null));};exports[_0xe524('0x27')]=function(_0x59fe6b,_0x232cf0){if(_0x59fe6b[_0xe524('0x49')]['id']){delete _0x59fe6b['body']['id'];}return db[_0xe524('0x3e')]['find']({'where':{'id':_0x59fe6b['params']['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x232cf0,null))[_0xe524('0x3f')](saveUpdates(_0x59fe6b[_0xe524('0x49')],null))['then'](respondWithResult(_0x232cf0,null))['catch'](handleError(_0x232cf0,null));};exports['destroy']=function(_0x4e9c3b,_0x4f7a64){return db['Integration'][_0xe524('0x47')]({'where':{'id':_0x4e9c3b[_0xe524('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f7a64,null))[_0xe524('0x3f')](removeEntity(_0x4f7a64,null))[_0xe524('0x44')](handleError(_0x4f7a64,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 292425a..de8160e 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 _0x851d=['bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','define','Integration','integrations','lodash','../../config/logger','api'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x851d,0x69));var _0xd851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd851('0x0'));var util=require('util');var logger=require(_0xd851('0x1'))(_0xd851('0x2'));var moment=require('moment');var BPromise=require(_0xd851('0x3'));var rp=require(_0xd851('0x4'));var fs=require('fs');var path=require(_0xd851('0x5'));var rimraf=require(_0xd851('0x6'));var config=require(_0xd851('0x7'));var attributes=require(_0xd851('0x8'));module['exports']=function(_0x578809,_0x1fff93){return _0x578809[_0xd851('0x9')](_0xd851('0xa'),attributes,{'tableName':_0xd851('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc96f=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Integration','integrations'];(function(_0x1f639e,_0x46d468){var _0x139959=function(_0x8b6b7b){while(--_0x8b6b7b){_0x1f639e['push'](_0x1f639e['shift']());}};_0x139959(++_0x46d468);}(_0xc96f,0x9c));var _0xfc96=function(_0x3485be,_0x5f3dd1){_0x3485be=_0x3485be-0x0;var _0x2ac6ae=_0xc96f[_0x3485be];return _0x2ac6ae;};'use strict';var _=require(_0xfc96('0x0'));var util=require(_0xfc96('0x1'));var logger=require(_0xfc96('0x2'))(_0xfc96('0x3'));var moment=require(_0xfc96('0x4'));var BPromise=require(_0xfc96('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc96('0x6'));var rimraf=require(_0xfc96('0x7'));var config=require(_0xfc96('0x8'));var attributes=require('./integration.attributes');module[_0xfc96('0x9')]=function(_0x569645,_0x2f78d2){return _0x569645[_0xfc96('0xa')](_0xfc96('0xb'),attributes,{'tableName':_0xfc96('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 1baebfc..a7bdccc 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(_0x32f776,_0x1bf7e6){var _0xa9f55=function(_0x3a1045){while(--_0x3a1045){_0x32f776['push'](_0x32f776['shift']());}};_0xa9f55(++_0x1bf7e6);}(_0x896e,0x1e9));var _0xe896=function(_0x38a643,_0x4a2997){_0x38a643=_0x38a643-0x0;var _0x4aa885=_0x896e[_0x38a643];return _0x4aa885;};'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 _0x0b0e=['Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','debug'];(function(_0x4f2c3a,_0x6bde90){var _0x17d91c=function(_0xaaf630){while(--_0xaaf630){_0x4f2c3a['push'](_0x4f2c3a['shift']());}};_0x17d91c(++_0x6bde90);}(_0x0b0e,0x187));var _0xe0b0=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0x0b0e[_0x21af3a];return _0x268a49;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('Integration,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 1768430..3155743 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 _0x896e=['show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x896e,0x1e9));var _0xe896=function(_0x86c8b3,_0x3c0e0e){_0x86c8b3=_0x86c8b3-0x0;var _0x49609e=_0x896e[_0x86c8b3];return _0x49609e;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var fs_extra=require(_0xe896('0x6'));var auth=require(_0xe896('0x7'));var interaction=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var controller=require(_0xe896('0xa'));router[_0xe896('0xb')]('/',auth['isAuthenticated'](),controller[_0xe896('0xc')]);router[_0xe896('0xb')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller[_0xe896('0xf')]);router['get'](_0xe896('0x10'),auth[_0xe896('0xe')](),controller[_0xe896('0x11')]);router['post']('/',auth[_0xe896('0xe')](),controller['create']);router[_0xe896('0x12')]('/:id',auth[_0xe896('0xe')](),controller[_0xe896('0x13')]);router[_0xe896('0x14')]('/:id',auth[_0xe896('0xe')](),controller[_0xe896('0x15')]);module[_0xe896('0x16')]=router; \ No newline at end of file +var _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x0295,0x1f0));var _0x5029=function(_0x16051a,_0x5e4326){_0x16051a=_0x16051a-0x0;var _0x35d20d=_0x0295[_0x16051a];return _0x35d20d;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5029('0x7')]('/:id',auth[_0x5029('0x8')](),controller['show']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 0d4acc4..d49bf9b 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 _0x61fa=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports'];(function(_0x58b167,_0xea3ef8){var _0x55da71=function(_0x14c50e){while(--_0x14c50e){_0x58b167['push'](_0x58b167['shift']());}};_0x55da71(++_0xea3ef8);}(_0x61fa,0x112));var _0xa61f=function(_0x3b3dcb,_0x6ff907){_0x3b3dcb=_0x3b3dcb-0x0;var _0x3d43cc=_0x61fa[_0x3b3dcb];return _0x3d43cc;};'use strict';var Sequelize=require(_0xa61f('0x0'));module[_0xa61f('0x1')]={'integration':{'type':Sequelize[_0xa61f('0x2')]},'eventChannel':{'type':Sequelize[_0xa61f('0x2')]},'exitStatus':{'type':Sequelize[_0xa61f('0x2')]},'ticketId':{'type':Sequelize[_0xa61f('0x2')]},'integrationId':{'type':Sequelize[_0xa61f('0x3')]},'contacts':{'type':Sequelize[_0xa61f('0x2')]},'uniqueid':{'type':Sequelize[_0xa61f('0x2')]},'calleridnum':{'type':Sequelize[_0xa61f('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xa61f('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xa61f('0x4')]},'holdtime':{'type':Sequelize[_0xa61f('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xa61f('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xa61f('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa61f('0x3')]},'reason':{'type':Sequelize[_0xa61f('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xa61f('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xa61f('0x4')]},'agentdump':{'type':Sequelize[_0xa61f('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xa61f('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa61f('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa61f('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa61f('0x2')]},'connectedlinename':{'type':Sequelize[_0xa61f('0x2')]},'language':{'type':Sequelize[_0xa61f('0x2')]},'accountcode':{'type':Sequelize[_0xa61f('0x2')]},'context':{'type':Sequelize[_0xa61f('0x2')]},'exten':{'type':Sequelize[_0xa61f('0x2')]},'priority':{'type':Sequelize[_0xa61f('0x2')]},'destchannel':{'type':Sequelize[_0xa61f('0x2')]},'destchannelstate':{'type':Sequelize[_0xa61f('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xa61f('0x2')]},'destcalleridname':{'type':Sequelize[_0xa61f('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xa61f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xa61f('0x2')]},'destlanguage':{'type':Sequelize[_0xa61f('0x2')]},'destaccountcode':{'type':Sequelize[_0xa61f('0x2')]},'destcontext':{'type':Sequelize[_0xa61f('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xa61f('0x2')]},'destuniqueid':{'type':Sequelize[_0xa61f('0x2')]},'messageId':{'type':Sequelize[_0xa61f('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xa61f('0x2')]},'from':{'type':Sequelize[_0xa61f('0x2')]},'to':{'type':Sequelize[_0xa61f('0x2')]},'cc':{'type':Sequelize[_0xa61f('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xa61f('0x6')]},'text':{'type':Sequelize[_0xa61f('0x6')]},'status':{'type':Sequelize[_0xa61f('0x7')](_0xa61f('0x8'),_0xa61f('0x9'),_0xa61f('0xa'),_0xa61f('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xa61f('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xa61f('0x3')]}}; \ No newline at end of file +var _0xb212=['RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING'];(function(_0x9979f9,_0x22dba0){var _0x53b7fe=function(_0x36dd9c){while(--_0x36dd9c){_0x9979f9['push'](_0x9979f9['shift']());}};_0x53b7fe(++_0x22dba0);}(_0xb212,0x7b));var _0x2b21=function(_0x171dab,_0x1397a8){_0x171dab=_0x171dab-0x0;var _0x49b0a1=_0xb212[_0x171dab];return _0x49b0a1;};'use strict';var Sequelize=require(_0x2b21('0x0'));module[_0x2b21('0x1')]={'integration':{'type':Sequelize[_0x2b21('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x2b21('0x2')]},'integrationId':{'type':Sequelize[_0x2b21('0x3')]},'contacts':{'type':Sequelize[_0x2b21('0x2')]},'uniqueid':{'type':Sequelize[_0x2b21('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2b21('0x2')]},'queue':{'type':Sequelize[_0x2b21('0x2')]},'interface':{'type':Sequelize[_0x2b21('0x2')]},'membername':{'type':Sequelize[_0x2b21('0x2')]},'agentcalledAt':{'type':Sequelize[_0x2b21('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x2b21('0x3')]},'agentcomplete':{'type':Sequelize[_0x2b21('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2b21('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x2b21('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2b21('0x3')]},'reason':{'type':Sequelize[_0x2b21('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x2b21('0x4')]},'agentdump':{'type':Sequelize[_0x2b21('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x2b21('0x4')]},'lastevent':{'type':Sequelize[_0x2b21('0x2')]},'channel':{'type':Sequelize[_0x2b21('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x2b21('0x2')]},'connectedlinenum':{'type':Sequelize[_0x2b21('0x2')]},'connectedlinename':{'type':Sequelize[_0x2b21('0x2')]},'language':{'type':Sequelize[_0x2b21('0x2')]},'accountcode':{'type':Sequelize[_0x2b21('0x2')]},'context':{'type':Sequelize[_0x2b21('0x2')]},'exten':{'type':Sequelize[_0x2b21('0x2')]},'priority':{'type':Sequelize[_0x2b21('0x2')]},'destchannel':{'type':Sequelize[_0x2b21('0x2')]},'destchannelstate':{'type':Sequelize[_0x2b21('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x2b21('0x2')]},'destcalleridnum':{'type':Sequelize[_0x2b21('0x2')]},'destcalleridname':{'type':Sequelize[_0x2b21('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x2b21('0x2')]},'destcontext':{'type':Sequelize[_0x2b21('0x2')]},'destexten':{'type':Sequelize[_0x2b21('0x2')]},'destpriority':{'type':Sequelize[_0x2b21('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x2b21('0x2')]},'subject':{'type':Sequelize[_0x2b21('0x2')]},'from':{'type':Sequelize[_0x2b21('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x2b21('0x2')]},'attachment':{'type':Sequelize[_0x2b21('0x6')]},'html':{'type':Sequelize[_0x2b21('0x6')]},'text':{'type':Sequelize[_0x2b21('0x6')]},'status':{'type':Sequelize[_0x2b21('0x7')]('SENT',_0x2b21('0x8'),_0x2b21('0x9'),_0x2b21('0xa'))},'url':{'type':Sequelize[_0x2b21('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x2b21('0x2')]},'projectId':{'type':Sequelize[_0x2b21('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 1458137..7222724 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 _0xeb5e=['rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','body','update','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','error','stack','name','send','map','IntegrationReport'];(function(_0x4b6986,_0x4aa104){var _0x18269f=function(_0x46ca57){while(--_0x46ca57){_0x4b6986['push'](_0x4b6986['shift']());}};_0x18269f(++_0x4aa104);}(_0xeb5e,0x14c));var _0xeeb5=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xeb5e[_0xb0f7c3];return _0x28ea68;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xeeb5('0x0'));var jsonpatch=require(_0xeeb5('0x1'));var rp=require(_0xeeb5('0x2'));var moment=require(_0xeeb5('0x3'));var BPromise=require(_0xeeb5('0x4'));var Mustache=require(_0xeeb5('0x5'));var util=require(_0xeeb5('0x6'));var path=require('path');var sox=require(_0xeeb5('0x7'));var csv=require(_0xeeb5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeeb5('0x9'));var _=require(_0xeeb5('0xa'));var squel=require(_0xeeb5('0xb'));var crypto=require(_0xeeb5('0xc'));var jsforce=require(_0xeeb5('0xd'));var deskjs=require(_0xeeb5('0xe'));var toCsv=require(_0xeeb5('0x8'));var querystring=require('querystring');var Papa=require(_0xeeb5('0xf'));var Redis=require('ioredis');var authService=require(_0xeeb5('0x10'));var qs=require(_0xeeb5('0x11'));var as=require(_0xeeb5('0x12'));var hardwareService=require(_0xeeb5('0x13'));var logger=require(_0xeeb5('0x14'))('api');var utils=require(_0xeeb5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xeeb5('0x16'));var db=require(_0xeeb5('0x17'))['db'];function respondWithStatusCode(_0x345365,_0x4f033c){_0x4f033c=_0x4f033c||0xcc;return function(_0x22f483){if(_0x22f483){return _0x345365[_0xeeb5('0x18')](_0x4f033c);}return _0x345365[_0xeeb5('0x19')](_0x4f033c)[_0xeeb5('0x1a')]();};}function respondWithResult(_0x12773b,_0x159834){_0x159834=_0x159834||0xc8;return function(_0x2185ab){if(_0x2185ab){return _0x12773b[_0xeeb5('0x19')](_0x159834)['json'](_0x2185ab);}};}function respondWithFilteredResult(_0x35cede,_0x35e74e){return function(_0x2ceb29){if(_0x2ceb29){var _0x192d2f=typeof _0x35e74e[_0xeeb5('0x1b')]===_0xeeb5('0x1c')&&typeof _0x35e74e[_0xeeb5('0x1d')]===_0xeeb5('0x1c');var _0x17650e=_0x2ceb29[_0xeeb5('0x1e')];var _0x23b403=_0x192d2f?0x0:_0x35e74e['offset'];var _0x63bd62=_0x192d2f?_0x2ceb29[_0xeeb5('0x1e')]:_0x35e74e[_0xeeb5('0x1b')]+_0x35e74e[_0xeeb5('0x1d')];var _0x4c55fb;if(_0x63bd62>=_0x17650e){_0x63bd62=_0x17650e;_0x4c55fb=0xc8;}else{_0x4c55fb=0xce;}_0x35cede[_0xeeb5('0x19')](_0x4c55fb);return _0x35cede['set'](_0xeeb5('0x1f'),_0x23b403+'-'+_0x63bd62+'/'+_0x17650e)[_0xeeb5('0x20')](_0x2ceb29);}return null;};}function patchUpdates(_0x1d3eb6){return function(_0x94e9c){try{jsonpatch[_0xeeb5('0x21')](_0x94e9c,_0x1d3eb6,!![]);}catch(_0x380060){return BPromise[_0xeeb5('0x22')](_0x380060);}return _0x94e9c[_0xeeb5('0x23')]();};}function saveUpdates(_0x1f1568,_0x2a8ce4){return function(_0x287d00){if(_0x287d00){return _0x287d00['update'](_0x1f1568)[_0xeeb5('0x24')](function(_0x48b339){return _0x48b339;});}return null;};}function removeEntity(_0xf89bb1,_0x4945ca){return function(_0x266e00){if(_0x266e00){return _0x266e00['destroy']()['then'](function(){_0xf89bb1[_0xeeb5('0x19')](0xcc)[_0xeeb5('0x1a')]();});}};}function handleEntityNotFound(_0x5538aa,_0x4fcfc7){return function(_0x49378b){if(!_0x49378b){_0x5538aa[_0xeeb5('0x18')](0x194);}return _0x49378b;};}function handleError(_0x120910,_0x320f04){_0x320f04=_0x320f04||0x1f4;return function(_0x5d22f2){logger[_0xeeb5('0x25')](_0x5d22f2[_0xeeb5('0x26')]);if(_0x5d22f2[_0xeeb5('0x27')]){delete _0x5d22f2[_0xeeb5('0x27')];}_0x120910[_0xeeb5('0x19')](_0x320f04)[_0xeeb5('0x28')](_0x5d22f2);};}exports['index']=function(_0x3e6170,_0x2ddcb4){var _0x47d0d7={},_0x5d071c={},_0x5e84e2={'count':0x0,'rows':[]};var _0x40da21=_[_0xeeb5('0x29')](db[_0xeeb5('0x2a')][_0xeeb5('0x2b')],function(_0x58c1db){return{'name':_0x58c1db[_0xeeb5('0x2c')],'type':_0x58c1db['type']['key']};});_0x5d071c[_0xeeb5('0x2d')]=_['map'](_0x40da21,'name');_0x5d071c[_0xeeb5('0x2e')]=_[_0xeeb5('0x2f')](_0x3e6170[_0xeeb5('0x2e')]);_0x5d071c[_0xeeb5('0x30')]=_[_0xeeb5('0x31')](_0x5d071c[_0xeeb5('0x2d')],_0x5d071c[_0xeeb5('0x2e')]);_0x47d0d7['attributes']=_['intersection'](_0x5d071c[_0xeeb5('0x2d')],qs[_0xeeb5('0x32')](_0x3e6170['query'][_0xeeb5('0x32')]));_0x47d0d7[_0xeeb5('0x33')]=_0x47d0d7[_0xeeb5('0x33')][_0xeeb5('0x34')]?_0x47d0d7[_0xeeb5('0x33')]:_0x5d071c['model'];if(!_0x3e6170[_0xeeb5('0x2e')][_0xeeb5('0x35')](_0xeeb5('0x36'))){_0x47d0d7[_0xeeb5('0x1d')]=qs['limit'](_0x3e6170[_0xeeb5('0x2e')][_0xeeb5('0x1d')]);_0x47d0d7[_0xeeb5('0x1b')]=qs['offset'](_0x3e6170[_0xeeb5('0x2e')][_0xeeb5('0x1b')]);}_0x47d0d7[_0xeeb5('0x37')]=qs['sort'](_0x3e6170[_0xeeb5('0x2e')]['sort']);_0x47d0d7['where']=qs['filters'](_[_0xeeb5('0x38')](_0x3e6170[_0xeeb5('0x2e')],_0x5d071c['filters']),_0x40da21);if(_0x3e6170[_0xeeb5('0x2e')]['filter']){_0x47d0d7[_0xeeb5('0x39')]=_[_0xeeb5('0x3a')](_0x47d0d7[_0xeeb5('0x39')],{'$or':_[_0xeeb5('0x29')](_0x40da21,function(_0x46701d){if(_0x46701d[_0xeeb5('0x3b')]!==_0xeeb5('0x3c')){var _0x2ca532={};_0x2ca532[_0x46701d[_0xeeb5('0x27')]]={'$like':'%'+_0x3e6170['query'][_0xeeb5('0x3d')]+'%'};return _0x2ca532;}})});}_0x47d0d7=_[_0xeeb5('0x3a')]({},_0x47d0d7,_0x3e6170[_0xeeb5('0x3e')]);var _0x3da23f={'where':_0x47d0d7['where']};return db[_0xeeb5('0x2a')][_0xeeb5('0x1e')](_0x3da23f)[_0xeeb5('0x24')](function(_0x989470){_0x5e84e2[_0xeeb5('0x1e')]=_0x989470;if(_0x3e6170[_0xeeb5('0x2e')]['includeAll']){_0x47d0d7[_0xeeb5('0x3f')]=[{'all':!![]}];}return db[_0xeeb5('0x2a')][_0xeeb5('0x40')](_0x47d0d7);})[_0xeeb5('0x24')](function(_0x37809f){_0x5e84e2[_0xeeb5('0x41')]=_0x37809f;return _0x5e84e2;})['then'](respondWithFilteredResult(_0x2ddcb4,_0x47d0d7))[_0xeeb5('0x42')](handleError(_0x2ddcb4,null));};exports[_0xeeb5('0x43')]=function(_0x12ac14,_0x4580e0){var _0x12d837={'raw':![],'where':{'id':_0x12ac14[_0xeeb5('0x44')]['id']}},_0x5433b6={};_0x5433b6[_0xeeb5('0x2d')]=_[_0xeeb5('0x2f')](db[_0xeeb5('0x2a')][_0xeeb5('0x2b')]);_0x5433b6[_0xeeb5('0x2e')]=_[_0xeeb5('0x2f')](_0x12ac14[_0xeeb5('0x2e')]);_0x5433b6[_0xeeb5('0x30')]=_['intersection'](_0x5433b6[_0xeeb5('0x2d')],_0x5433b6[_0xeeb5('0x2e')]);_0x12d837[_0xeeb5('0x33')]=_[_0xeeb5('0x31')](_0x5433b6[_0xeeb5('0x2d')],qs[_0xeeb5('0x32')](_0x12ac14[_0xeeb5('0x2e')][_0xeeb5('0x32')]));_0x12d837['attributes']=_0x12d837[_0xeeb5('0x33')][_0xeeb5('0x34')]?_0x12d837[_0xeeb5('0x33')]:_0x5433b6['model'];if(_0x12ac14[_0xeeb5('0x2e')][_0xeeb5('0x45')]){_0x12d837[_0xeeb5('0x3f')]=[{'all':!![]}];}_0x12d837=_['merge']({},_0x12d837,_0x12ac14['options']);return db[_0xeeb5('0x2a')][_0xeeb5('0x46')](_0x12d837)[_0xeeb5('0x24')](handleEntityNotFound(_0x4580e0,null))[_0xeeb5('0x24')](respondWithResult(_0x4580e0,null))[_0xeeb5('0x42')](handleError(_0x4580e0,null));};exports['create']=function(_0x4c3993,_0x3103cd){return db[_0xeeb5('0x2a')]['create'](_0x4c3993[_0xeeb5('0x47')],{})[_0xeeb5('0x24')](respondWithResult(_0x3103cd,0xc9))[_0xeeb5('0x42')](handleError(_0x3103cd,null));};exports[_0xeeb5('0x48')]=function(_0x83331c,_0x161d98){if(_0x83331c[_0xeeb5('0x47')]['id']){delete _0x83331c[_0xeeb5('0x47')]['id'];}return db[_0xeeb5('0x2a')][_0xeeb5('0x46')]({'where':{'id':_0x83331c[_0xeeb5('0x44')]['id']}})[_0xeeb5('0x24')](handleEntityNotFound(_0x161d98,null))[_0xeeb5('0x24')](saveUpdates(_0x83331c['body'],null))['then'](respondWithResult(_0x161d98,null))[_0xeeb5('0x42')](handleError(_0x161d98,null));};exports[_0xeeb5('0x49')]=function(_0xb2464f,_0x1d6f92){return db[_0xeeb5('0x2a')]['find']({'where':{'id':_0xb2464f[_0xeeb5('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d6f92,null))[_0xeeb5('0x24')](removeEntity(_0x1d6f92,null))[_0xeeb5('0x42')](handleError(_0x1d6f92,null));};exports['describe']=function(_0x3c10fa,_0x8acd29){return db[_0xeeb5('0x2a')][_0xeeb5('0x4a')]()[_0xeeb5('0x24')](respondWithResult(_0x8acd29,null))[_0xeeb5('0x42')](handleError(_0x8acd29,null));}; \ No newline at end of file +var _0xef1d=['status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','send','index','IntegrationReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','merge','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus'];(function(_0x13045d,_0x59f66a){var _0x27dfb7=function(_0x699d86){while(--_0x699d86){_0x13045d['push'](_0x13045d['shift']());}};_0x27dfb7(++_0x59f66a);}(_0xef1d,0xc7));var _0xdef1=function(_0x420664,_0x962511){_0x420664=_0x420664-0x0;var _0x13d86e=_0xef1d[_0x420664];return _0x13d86e;};'use strict';var emlformat=require(_0xdef1('0x0'));var rimraf=require(_0xdef1('0x1'));var zipdir=require(_0xdef1('0x2'));var jsonpatch=require(_0xdef1('0x3'));var rp=require(_0xdef1('0x4'));var moment=require(_0xdef1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdef1('0x6'));var util=require(_0xdef1('0x7'));var path=require(_0xdef1('0x8'));var sox=require(_0xdef1('0x9'));var csv=require(_0xdef1('0xa'));var ejs=require(_0xdef1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdef1('0xc'));var squel=require(_0xdef1('0xd'));var crypto=require(_0xdef1('0xe'));var jsforce=require(_0xdef1('0xf'));var deskjs=require(_0xdef1('0x10'));var toCsv=require(_0xdef1('0xa'));var querystring=require('querystring');var Papa=require(_0xdef1('0x11'));var Redis=require(_0xdef1('0x12'));var authService=require(_0xdef1('0x13'));var qs=require(_0xdef1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdef1('0x15'));var logger=require('../../config/logger')(_0xdef1('0x16'));var utils=require('../../config/utils');var config=require(_0xdef1('0x17'));var licenseUtil=require(_0xdef1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e07ba,_0xe76c22){_0xe76c22=_0xe76c22||0xcc;return function(_0x13ff33){if(_0x13ff33){return _0x2e07ba[_0xdef1('0x19')](_0xe76c22);}return _0x2e07ba[_0xdef1('0x1a')](_0xe76c22)[_0xdef1('0x1b')]();};}function respondWithResult(_0x90715e,_0x2320c3){_0x2320c3=_0x2320c3||0xc8;return function(_0x27b605){if(_0x27b605){return _0x90715e['status'](_0x2320c3)[_0xdef1('0x1c')](_0x27b605);}};}function respondWithFilteredResult(_0x4d8535,_0xca9567){return function(_0x583070){if(_0x583070){var _0x4e5f68=typeof _0xca9567[_0xdef1('0x1d')]===_0xdef1('0x1e')&&typeof _0xca9567[_0xdef1('0x1f')]==='undefined';var _0x2c57a4=_0x583070['count'];var _0x4fb597=_0x4e5f68?0x0:_0xca9567[_0xdef1('0x1d')];var _0x47ce74=_0x4e5f68?_0x583070[_0xdef1('0x20')]:_0xca9567[_0xdef1('0x1d')]+_0xca9567['limit'];var _0x596dd6;if(_0x47ce74>=_0x2c57a4){_0x47ce74=_0x2c57a4;_0x596dd6=0xc8;}else{_0x596dd6=0xce;}_0x4d8535[_0xdef1('0x1a')](_0x596dd6);return _0x4d8535[_0xdef1('0x21')](_0xdef1('0x22'),_0x4fb597+'-'+_0x47ce74+'/'+_0x2c57a4)[_0xdef1('0x1c')](_0x583070);}return null;};}function patchUpdates(_0x42d76c){return function(_0x110d33){try{jsonpatch['apply'](_0x110d33,_0x42d76c,!![]);}catch(_0x36aa21){return BPromise[_0xdef1('0x23')](_0x36aa21);}return _0x110d33[_0xdef1('0x24')]();};}function saveUpdates(_0x404cc8,_0x317d9d){return function(_0x46709d){if(_0x46709d){return _0x46709d[_0xdef1('0x25')](_0x404cc8)[_0xdef1('0x26')](function(_0x5f38e1){return _0x5f38e1;});}return null;};}function removeEntity(_0x507bda,_0x3fcb1b){return function(_0x3888aa){if(_0x3888aa){return _0x3888aa['destroy']()[_0xdef1('0x26')](function(){_0x507bda[_0xdef1('0x1a')](0xcc)[_0xdef1('0x1b')]();});}};}function handleEntityNotFound(_0xdc68e1,_0x5acbf5){return function(_0x8b3a73){if(!_0x8b3a73){_0xdc68e1[_0xdef1('0x19')](0x194);}return _0x8b3a73;};}function handleError(_0x416e3f,_0xdf9ab9){_0xdf9ab9=_0xdf9ab9||0x1f4;return function(_0x275002){logger[_0xdef1('0x27')](_0x275002['stack']);if(_0x275002[_0xdef1('0x28')]){delete _0x275002[_0xdef1('0x28')];}_0x416e3f[_0xdef1('0x1a')](_0xdf9ab9)[_0xdef1('0x29')](_0x275002);};}exports[_0xdef1('0x2a')]=function(_0x3d3a4d,_0x454594){var _0x5b371b={},_0x4d6d5f={},_0x1440b5={'count':0x0,'rows':[]};var _0x4a30eb=_['map'](db[_0xdef1('0x2b')][_0xdef1('0x2c')],function(_0x2fe0fd){return{'name':_0x2fe0fd[_0xdef1('0x2d')],'type':_0x2fe0fd[_0xdef1('0x2e')][_0xdef1('0x2f')]};});_0x4d6d5f[_0xdef1('0x30')]=_['map'](_0x4a30eb,'name');_0x4d6d5f[_0xdef1('0x31')]=_['keys'](_0x3d3a4d[_0xdef1('0x31')]);_0x4d6d5f[_0xdef1('0x32')]=_[_0xdef1('0x33')](_0x4d6d5f['model'],_0x4d6d5f['query']);_0x5b371b[_0xdef1('0x34')]=_['intersection'](_0x4d6d5f[_0xdef1('0x30')],qs[_0xdef1('0x35')](_0x3d3a4d['query'][_0xdef1('0x35')]));_0x5b371b[_0xdef1('0x34')]=_0x5b371b['attributes'][_0xdef1('0x36')]?_0x5b371b[_0xdef1('0x34')]:_0x4d6d5f[_0xdef1('0x30')];if(!_0x3d3a4d[_0xdef1('0x31')][_0xdef1('0x37')](_0xdef1('0x38'))){_0x5b371b[_0xdef1('0x1f')]=qs[_0xdef1('0x1f')](_0x3d3a4d[_0xdef1('0x31')][_0xdef1('0x1f')]);_0x5b371b[_0xdef1('0x1d')]=qs[_0xdef1('0x1d')](_0x3d3a4d[_0xdef1('0x31')][_0xdef1('0x1d')]);}_0x5b371b['order']=qs[_0xdef1('0x39')](_0x3d3a4d[_0xdef1('0x31')]['sort']);_0x5b371b[_0xdef1('0x3a')]=qs['filters'](_[_0xdef1('0x3b')](_0x3d3a4d[_0xdef1('0x31')],_0x4d6d5f['filters']),_0x4a30eb);if(_0x3d3a4d['query'][_0xdef1('0x3c')]){_0x5b371b[_0xdef1('0x3a')]=_['merge'](_0x5b371b[_0xdef1('0x3a')],{'$or':_[_0xdef1('0x3d')](_0x4a30eb,function(_0x596ff8){if(_0x596ff8[_0xdef1('0x2e')]!=='VIRTUAL'){var _0x4eec67={};_0x4eec67[_0x596ff8['name']]={'$like':'%'+_0x3d3a4d[_0xdef1('0x31')][_0xdef1('0x3c')]+'%'};return _0x4eec67;}})});}_0x5b371b=_[_0xdef1('0x3e')]({},_0x5b371b,_0x3d3a4d['options']);var _0x35c671={'where':_0x5b371b[_0xdef1('0x3a')]};return db['IntegrationReport'][_0xdef1('0x20')](_0x35c671)[_0xdef1('0x26')](function(_0x2a50f2){_0x1440b5[_0xdef1('0x20')]=_0x2a50f2;if(_0x3d3a4d[_0xdef1('0x31')]['includeAll']){_0x5b371b[_0xdef1('0x3f')]=[{'all':!![]}];}return db[_0xdef1('0x2b')][_0xdef1('0x40')](_0x5b371b);})[_0xdef1('0x26')](function(_0x33755e){_0x1440b5[_0xdef1('0x41')]=_0x33755e;return _0x1440b5;})[_0xdef1('0x26')](respondWithFilteredResult(_0x454594,_0x5b371b))[_0xdef1('0x42')](handleError(_0x454594,null));};exports[_0xdef1('0x43')]=function(_0x2401ea,_0x1a919d){var _0x4039f0={'raw':![],'where':{'id':_0x2401ea[_0xdef1('0x44')]['id']}},_0x26d299={};_0x26d299['model']=_[_0xdef1('0x45')](db[_0xdef1('0x2b')][_0xdef1('0x2c')]);_0x26d299[_0xdef1('0x31')]=_[_0xdef1('0x45')](_0x2401ea[_0xdef1('0x31')]);_0x26d299[_0xdef1('0x32')]=_[_0xdef1('0x33')](_0x26d299[_0xdef1('0x30')],_0x26d299[_0xdef1('0x31')]);_0x4039f0[_0xdef1('0x34')]=_[_0xdef1('0x33')](_0x26d299['model'],qs[_0xdef1('0x35')](_0x2401ea['query'][_0xdef1('0x35')]));_0x4039f0[_0xdef1('0x34')]=_0x4039f0[_0xdef1('0x34')][_0xdef1('0x36')]?_0x4039f0['attributes']:_0x26d299[_0xdef1('0x30')];if(_0x2401ea[_0xdef1('0x31')][_0xdef1('0x46')]){_0x4039f0['include']=[{'all':!![]}];}_0x4039f0=_['merge']({},_0x4039f0,_0x2401ea['options']);return db[_0xdef1('0x2b')][_0xdef1('0x47')](_0x4039f0)[_0xdef1('0x26')](handleEntityNotFound(_0x1a919d,null))[_0xdef1('0x26')](respondWithResult(_0x1a919d,null))['catch'](handleError(_0x1a919d,null));};exports[_0xdef1('0x48')]=function(_0xb3b309,_0x5d64b8){return db[_0xdef1('0x2b')][_0xdef1('0x48')](_0xb3b309['body'],{})[_0xdef1('0x26')](respondWithResult(_0x5d64b8,0xc9))['catch'](handleError(_0x5d64b8,null));};exports['update']=function(_0x1b1e4d,_0x2f6185){if(_0x1b1e4d[_0xdef1('0x49')]['id']){delete _0x1b1e4d[_0xdef1('0x49')]['id'];}return db['IntegrationReport'][_0xdef1('0x47')]({'where':{'id':_0x1b1e4d[_0xdef1('0x44')]['id']}})[_0xdef1('0x26')](handleEntityNotFound(_0x2f6185,null))[_0xdef1('0x26')](saveUpdates(_0x1b1e4d[_0xdef1('0x49')],null))[_0xdef1('0x26')](respondWithResult(_0x2f6185,null))['catch'](handleError(_0x2f6185,null));};exports['destroy']=function(_0x47a1f3,_0x3b7f1a){return db['IntegrationReport'][_0xdef1('0x47')]({'where':{'id':_0x47a1f3[_0xdef1('0x44')]['id']}})[_0xdef1('0x26')](handleEntityNotFound(_0x3b7f1a,null))[_0xdef1('0x26')](removeEntity(_0x3b7f1a,null))[_0xdef1('0x42')](handleError(_0x3b7f1a,null));};exports[_0xdef1('0x4a')]=function(_0x2ff516,_0x5ac62e){return db[_0xdef1('0x2b')]['describe']()['then'](respondWithResult(_0x5ac62e,null))['catch'](handleError(_0x5ac62e,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 1542afd..48ee426 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 _0x58d3=['path','rimraf','../../config/environment','./integrationReport.attributes','IntegrationReport','report_integration','lodash','util','api','moment'];(function(_0x1ae659,_0x22c62e){var _0x36e764=function(_0xfb2eea){while(--_0xfb2eea){_0x1ae659['push'](_0x1ae659['shift']());}};_0x36e764(++_0x22c62e);}(_0x58d3,0x1f0));var _0x358d=function(_0x48ba58,_0x2ab0d8){_0x48ba58=_0x48ba58-0x0;var _0x5c5936=_0x58d3[_0x48ba58];return _0x5c5936;};'use strict';var _=require(_0x358d('0x0'));var util=require(_0x358d('0x1'));var logger=require('../../config/logger')(_0x358d('0x2'));var moment=require(_0x358d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x358d('0x4'));var rimraf=require(_0x358d('0x5'));var config=require(_0x358d('0x6'));var attributes=require(_0x358d('0x7'));module['exports']=function(_0x9ec70e,_0x1f1ea1){return _0x9ec70e['define'](_0x358d('0x8'),attributes,{'tableName':_0x358d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00eb=['report_integration','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x00eb,0x12a));var _0xb00e=function(_0x112a80,_0x2c84b0){_0x112a80=_0x112a80-0x0;var _0x32f78d=_0x00eb[_0x112a80];return _0x32f78d;};'use strict';var _=require(_0xb00e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb00e('0x1'));var moment=require(_0xb00e('0x2'));var BPromise=require(_0xb00e('0x3'));var rp=require(_0xb00e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb00e('0x5'));var config=require(_0xb00e('0x6'));var attributes=require(_0xb00e('0x7'));module[_0xb00e('0x8')]=function(_0x11cdfb,_0x207a64){return _0x11cdfb[_0xb00e('0x9')]('IntegrationReport',attributes,{'tableName':_0xb00e('0xa'),'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 dab6169..b2a062b 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 _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xcb36a,_0x122533){var _0x242575=function(_0x5d0503){while(--_0x5d0503){_0xcb36a['push'](_0xcb36a['shift']());}};_0x242575(++_0x122533);}(_0xda19,0xd5));var _0x9da1=function(_0xf5754b,_0x50d057){_0xf5754b=_0xf5754b-0x0;var _0x1a9aa5=_0xda19[_0xf5754b];return _0x1a9aa5;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','IntegrationReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x410dd9,_0xa3bd5b){var _0x4d4735=function(_0x430767){while(--_0x430767){_0x410dd9['push'](_0x410dd9['shift']());}};_0x4d4735(++_0xa3bd5b);}(_0x57ca,0x108));var _0xa57c=function(_0x3a5ebd,_0x493272){_0x3a5ebd=_0x3a5ebd-0x0;var _0x3ff829=_0x57ca[_0x3a5ebd];return _0x3ff829;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 05f1972..fbeabc4 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 _0xfcd2=['/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','create','post','addInterval'];(function(_0x46137d,_0x51024f){var _0x3d2351=function(_0x309a56){while(--_0x309a56){_0x46137d['push'](_0x46137d['shift']());}};_0x3d2351(++_0x51024f);}(_0xfcd2,0x13f));var _0x2fcd=function(_0x59265c,_0x223711){_0x59265c=_0x59265c-0x0;var _0x37b8dc=_0xfcd2[_0x59265c];return _0x37b8dc;};'use strict';var multer=require(_0x2fcd('0x0'));var util=require(_0x2fcd('0x1'));var path=require(_0x2fcd('0x2'));var timeout=require(_0x2fcd('0x3'));var express=require(_0x2fcd('0x4'));var router=express[_0x2fcd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2fcd('0x6'));var interaction=require(_0x2fcd('0x7'));var config=require(_0x2fcd('0x8'));var controller=require('./interval.controller');router[_0x2fcd('0x9')]('/',auth['isAuthenticated'](),controller[_0x2fcd('0xa')]);router['get'](_0x2fcd('0xb'),auth[_0x2fcd('0xc')](),controller[_0x2fcd('0xd')]);router['get'](_0x2fcd('0xe'),auth['isAuthenticated'](),controller[_0x2fcd('0xf')]);router['post']('/',auth[_0x2fcd('0xc')](),controller[_0x2fcd('0x10')]);router[_0x2fcd('0x11')]('/:id/sub_intervals',auth[_0x2fcd('0xc')](),controller[_0x2fcd('0x12')]);router[_0x2fcd('0x11')](_0x2fcd('0x13'),auth[_0x2fcd('0xc')](),controller[_0x2fcd('0x14')]);router[_0x2fcd('0x15')]('/:id',auth[_0x2fcd('0xc')](),controller[_0x2fcd('0x16')]);router[_0x2fcd('0x17')]('/:id',auth[_0x2fcd('0xc')](),controller[_0x2fcd('0x18')]);module[_0x2fcd('0x19')]=router; \ No newline at end of file +var _0x34f2=['show','/:id/sub_intervals','create','post','/:id/sub_intervals/create_many','addIntervals','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34f2,0x15a));var _0x234f=function(_0x48015c,_0x34c152){_0x48015c=_0x48015c-0x0;var _0x509717=_0x34f2[_0x48015c];return _0x509717;};'use strict';var multer=require(_0x234f('0x0'));var util=require(_0x234f('0x1'));var path=require('path');var timeout=require(_0x234f('0x2'));var express=require(_0x234f('0x3'));var router=express[_0x234f('0x4')]();var fs_extra=require(_0x234f('0x5'));var auth=require(_0x234f('0x6'));var interaction=require(_0x234f('0x7'));var config=require(_0x234f('0x8'));var controller=require(_0x234f('0x9'));router[_0x234f('0xa')]('/',auth[_0x234f('0xb')](),controller[_0x234f('0xc')]);router[_0x234f('0xa')](_0x234f('0xd'),auth[_0x234f('0xb')](),controller[_0x234f('0xe')]);router['get'](_0x234f('0xf'),auth[_0x234f('0xb')](),controller['getIntervals']);router['post']('/',auth[_0x234f('0xb')](),controller[_0x234f('0x10')]);router[_0x234f('0x11')](_0x234f('0xf'),auth[_0x234f('0xb')](),controller['addInterval']);router[_0x234f('0x11')](_0x234f('0x12'),auth[_0x234f('0xb')](),controller[_0x234f('0x13')]);router['put'](_0x234f('0xd'),auth['isAuthenticated'](),controller[_0x234f('0x14')]);router[_0x234f('0x15')](_0x234f('0xd'),auth[_0x234f('0xb')](),controller[_0x234f('0x16')]);module[_0x234f('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index d7f06e8..55d0710 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 _0x7d16=['STRING','sequelize','exports'];(function(_0x512783,_0x466592){var _0x3fbc96=function(_0x1600f9){while(--_0x1600f9){_0x512783['push'](_0x512783['shift']());}};_0x3fbc96(++_0x466592);}(_0x7d16,0x154));var _0x67d1=function(_0x37b534,_0x26b624){_0x37b534=_0x37b534-0x0;var _0x5747f8=_0x7d16[_0x37b534];return _0x5747f8;};'use strict';var Sequelize=require(_0x67d1('0x0'));module[_0x67d1('0x1')]={'name':{'type':Sequelize[_0x67d1('0x2')]},'description':{'type':Sequelize[_0x67d1('0x2')]},'interval':{'type':Sequelize[_0x67d1('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x4eaa=['STRING','sequelize','exports'];(function(_0x56c477,_0x767ed4){var _0x1f9a1e=function(_0x281c32){while(--_0x281c32){_0x56c477['push'](_0x56c477['shift']());}};_0x1f9a1e(++_0x767ed4);}(_0x4eaa,0x64));var _0xa4ea=function(_0x38e917,_0x537701){_0x38e917=_0x38e917-0x0;var _0x567fc4=_0x4eaa[_0x38e917];return _0x567fc4;};'use strict';var Sequelize=require(_0xa4ea('0x0'));module[_0xa4ea('0x1')]={'name':{'type':Sequelize[_0xa4ea('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index aa65dd4..cbb6e0e 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 _0x77c8=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','IntervalId','getIntervals','findOne','pick','sequelize','transaction','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Intervals','UserProfileResource','destroy','end','error','stack','name','send','index','map','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','include','Interval','findAll','rows','catch','show','rawAttributes','find','create','body','user'];(function(_0x323d87,_0x4ef3f9){var _0x5e8f74=function(_0x185735){while(--_0x185735){_0x323d87['push'](_0x323d87['shift']());}};_0x5e8f74(++_0x4ef3f9);}(_0x77c8,0x17e));var _0x877c=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0x77c8[_0x421263];return _0x34e4b5;};'use strict';var emlformat=require(_0x877c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x877c('0x1'));var jsonpatch=require(_0x877c('0x2'));var rp=require(_0x877c('0x3'));var moment=require('moment');var BPromise=require(_0x877c('0x4'));var Mustache=require('mustache');var util=require(_0x877c('0x5'));var path=require(_0x877c('0x6'));var sox=require(_0x877c('0x7'));var csv=require(_0x877c('0x8'));var ejs=require(_0x877c('0x9'));var fs=require('fs');var fs_extra=require(_0x877c('0xa'));var _=require(_0x877c('0xb'));var squel=require(_0x877c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x877c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x877c('0xe'));var Papa=require('papaparse');var Redis=require(_0x877c('0xf'));var authService=require(_0x877c('0x10'));var qs=require(_0x877c('0x11'));var as=require(_0x877c('0x12'));var hardwareService=require(_0x877c('0x13'));var logger=require(_0x877c('0x14'))(_0x877c('0x15'));var utils=require(_0x877c('0x16'));var config=require(_0x877c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x877c('0x18'))['db'];var extensions=require(_0x877c('0x19'));function respondWithStatusCode(_0x1afd2e,_0x30d010){_0x30d010=_0x30d010||0xcc;return function(_0x1df0bc){if(_0x1df0bc){return _0x1afd2e['sendStatus'](_0x30d010);}return _0x1afd2e[_0x877c('0x1a')](_0x30d010)['end']();};}function respondWithResult(_0x40538a,_0x5139eb){_0x5139eb=_0x5139eb||0xc8;return function(_0x1059f6){if(_0x1059f6){return _0x40538a['status'](_0x5139eb)[_0x877c('0x1b')](_0x1059f6);}};}function respondWithFilteredResult(_0x198c33,_0x37800e){return function(_0x4b982d){if(_0x4b982d){var _0x189e17=typeof _0x37800e['offset']===_0x877c('0x1c')&&typeof _0x37800e[_0x877c('0x1d')]===_0x877c('0x1c');var _0xd37e4=_0x4b982d[_0x877c('0x1e')];var _0x47ef81=_0x189e17?0x0:_0x37800e[_0x877c('0x1f')];var _0x57203e=_0x189e17?_0x4b982d[_0x877c('0x1e')]:_0x37800e['offset']+_0x37800e[_0x877c('0x1d')];var _0x54740b;if(_0x57203e>=_0xd37e4){_0x57203e=_0xd37e4;_0x54740b=0xc8;}else{_0x54740b=0xce;}_0x198c33[_0x877c('0x1a')](_0x54740b);return _0x198c33[_0x877c('0x20')](_0x877c('0x21'),_0x47ef81+'-'+_0x57203e+'/'+_0xd37e4)[_0x877c('0x1b')](_0x4b982d);}return null;};}function patchUpdates(_0x1477b8){return function(_0x558303){try{jsonpatch[_0x877c('0x22')](_0x558303,_0x1477b8,!![]);}catch(_0x3d793d){return BPromise[_0x877c('0x23')](_0x3d793d);}return _0x558303[_0x877c('0x24')]();};}function saveUpdates(_0x211451,_0x3b423c){return function(_0x5b9601){if(_0x5b9601){return _0x5b9601[_0x877c('0x25')](_0x211451)[_0x877c('0x26')](function(_0x15d345){return _0x15d345;});}return null;};}function removeEntity(_0x3141d4,_0x39aa05){return function(_0xf9a101){if(_0xf9a101){return _0xf9a101['destroy']()[_0x877c('0x26')](function(){var _0x251956=_0xf9a101[_0x877c('0x27')]({'plain':!![]});var _0x42de74=_0x877c('0x28');return db[_0x877c('0x29')][_0x877c('0x2a')]({'where':{'type':_0x42de74,'resourceId':_0x251956['id']}})[_0x877c('0x26')](function(){return _0xf9a101;});})[_0x877c('0x26')](function(){_0x3141d4[_0x877c('0x1a')](0xcc)[_0x877c('0x2b')]();});}};}function handleEntityNotFound(_0x3e99c3,_0x62183a){return function(_0x44d5b4){if(!_0x44d5b4){_0x3e99c3['sendStatus'](0x194);}return _0x44d5b4;};}function handleError(_0x4396f2,_0x2f20d6){_0x2f20d6=_0x2f20d6||0x1f4;return function(_0x30937c){logger[_0x877c('0x2c')](_0x30937c[_0x877c('0x2d')]);if(_0x30937c[_0x877c('0x2e')]){delete _0x30937c['name'];}_0x4396f2[_0x877c('0x1a')](_0x2f20d6)[_0x877c('0x2f')](_0x30937c);};}exports[_0x877c('0x30')]=function(_0x5a479e,_0x188192){var _0x140a61={},_0x455d84={},_0x57d1b0={'count':0x0,'rows':[]};var _0x14ac9f=_[_0x877c('0x31')](db['Interval']['rawAttributes'],function(_0x2fd8dd){return{'name':_0x2fd8dd['fieldName'],'type':_0x2fd8dd['type'][_0x877c('0x32')]};});_0x455d84['model']=_['map'](_0x14ac9f,_0x877c('0x2e'));_0x455d84[_0x877c('0x33')]=_[_0x877c('0x34')](_0x5a479e[_0x877c('0x33')]);_0x455d84[_0x877c('0x35')]=_[_0x877c('0x36')](_0x455d84[_0x877c('0x37')],_0x455d84[_0x877c('0x33')]);_0x140a61[_0x877c('0x38')]=_[_0x877c('0x36')](_0x455d84['model'],qs[_0x877c('0x39')](_0x5a479e[_0x877c('0x33')]['fields']));_0x140a61[_0x877c('0x38')]=_0x140a61[_0x877c('0x38')][_0x877c('0x3a')]?_0x140a61[_0x877c('0x38')]:_0x455d84[_0x877c('0x37')];if(!_0x5a479e[_0x877c('0x33')][_0x877c('0x3b')](_0x877c('0x3c'))){_0x140a61[_0x877c('0x1d')]=qs[_0x877c('0x1d')](_0x5a479e['query']['limit']);_0x140a61['offset']=qs[_0x877c('0x1f')](_0x5a479e['query'][_0x877c('0x1f')]);}_0x140a61[_0x877c('0x3d')]=qs[_0x877c('0x3e')](_0x5a479e[_0x877c('0x33')]['sort']);_0x140a61[_0x877c('0x3f')]=qs[_0x877c('0x35')](_['pick'](_0x5a479e[_0x877c('0x33')],_0x455d84[_0x877c('0x35')]),_0x14ac9f);if(_0x5a479e[_0x877c('0x33')]['filter']){_0x140a61[_0x877c('0x3f')]=_[_0x877c('0x40')](_0x140a61[_0x877c('0x3f')],{'$or':_['map'](_0x14ac9f,function(_0x3529fd){if(_0x3529fd['type']!=='VIRTUAL'){var _0x3a488c={};_0x3a488c[_0x3529fd[_0x877c('0x2e')]]={'$like':'%'+_0x5a479e[_0x877c('0x33')][_0x877c('0x41')]+'%'};return _0x3a488c;}})});}_0x140a61=_[_0x877c('0x40')]({},_0x140a61,_0x5a479e[_0x877c('0x42')]);var _0x419537={'where':_0x140a61[_0x877c('0x3f')]};return db['Interval'][_0x877c('0x1e')](_0x419537)['then'](function(_0x598c09){_0x57d1b0[_0x877c('0x1e')]=_0x598c09;if(_0x5a479e[_0x877c('0x33')]['includeAll']){_0x140a61[_0x877c('0x43')]=[{'all':!![]}];}return db[_0x877c('0x44')][_0x877c('0x45')](_0x140a61);})[_0x877c('0x26')](function(_0x4ab97c){_0x57d1b0[_0x877c('0x46')]=_0x4ab97c;return _0x57d1b0;})[_0x877c('0x26')](respondWithFilteredResult(_0x188192,_0x140a61))[_0x877c('0x47')](handleError(_0x188192,null));};exports[_0x877c('0x48')]=function(_0x4ffbfe,_0x8600b0){var _0x4fb53b={'raw':!![],'where':{'id':_0x4ffbfe['params']['id']}},_0xfcc5a6={};_0xfcc5a6[_0x877c('0x37')]=_[_0x877c('0x34')](db['Interval'][_0x877c('0x49')]);_0xfcc5a6[_0x877c('0x33')]=_['keys'](_0x4ffbfe['query']);_0xfcc5a6['filters']=_['intersection'](_0xfcc5a6[_0x877c('0x37')],_0xfcc5a6['query']);_0x4fb53b[_0x877c('0x38')]=_[_0x877c('0x36')](_0xfcc5a6[_0x877c('0x37')],qs[_0x877c('0x39')](_0x4ffbfe[_0x877c('0x33')][_0x877c('0x39')]));_0x4fb53b['attributes']=_0x4fb53b[_0x877c('0x38')][_0x877c('0x3a')]?_0x4fb53b[_0x877c('0x38')]:_0xfcc5a6[_0x877c('0x37')];if(_0x4ffbfe[_0x877c('0x33')]['includeAll']){_0x4fb53b[_0x877c('0x43')]=[{'all':!![]}];}_0x4fb53b=_[_0x877c('0x40')]({},_0x4fb53b,_0x4ffbfe[_0x877c('0x42')]);return db[_0x877c('0x44')][_0x877c('0x4a')](_0x4fb53b)[_0x877c('0x26')](handleEntityNotFound(_0x8600b0,null))[_0x877c('0x26')](respondWithResult(_0x8600b0,null))['catch'](handleError(_0x8600b0,null));};exports['create']=function(_0x32ae37,_0x28e569){return db[_0x877c('0x44')][_0x877c('0x4b')](_0x32ae37[_0x877c('0x4c')],{})[_0x877c('0x26')](function(_0x5eff27){var _0x57ab7b=_0x32ae37[_0x877c('0x4d')][_0x877c('0x27')]({'plain':!![]});if(!_0x57ab7b)throw new Error(_0x877c('0x4e'));if(_0x57ab7b[_0x877c('0x4f')]==='user'){var _0x190960=_0x5eff27[_0x877c('0x27')]({'plain':!![]});var _0x274d46=_0x877c('0x28');return db[_0x877c('0x50')]['find']({'where':{'name':_0x274d46,'userProfileId':_0x57ab7b[_0x877c('0x51')]},'raw':!![]})[_0x877c('0x26')](function(_0x1201a4){if(_0x1201a4&&_0x1201a4[_0x877c('0x52')]===0x0){return db[_0x877c('0x29')][_0x877c('0x4b')]({'name':_0x190960['name'],'resourceId':_0x190960['id'],'type':_0x1201a4[_0x877c('0x2e')],'sectionId':_0x1201a4['id']},{})['then'](function(){return _0x5eff27;});}else{return _0x5eff27;}})['catch'](function(_0x18f508){logger[_0x877c('0x2c')](_0x877c('0x53'),_0x18f508);throw _0x18f508;});}return _0x5eff27;})[_0x877c('0x26')](respondWithResult(_0x28e569,0xc9))[_0x877c('0x47')](handleError(_0x28e569,null));};exports[_0x877c('0x25')]=function(_0xd98b1c,_0x23ca3a){if(_0xd98b1c[_0x877c('0x4c')]['id']){delete _0xd98b1c[_0x877c('0x4c')]['id'];}return db[_0x877c('0x44')][_0x877c('0x4a')]({'where':{'id':_0xd98b1c[_0x877c('0x54')]['id']}})[_0x877c('0x26')](handleEntityNotFound(_0x23ca3a,null))['then'](saveUpdates(_0xd98b1c[_0x877c('0x4c')],null))[_0x877c('0x26')](respondWithResult(_0x23ca3a,null))['catch'](handleError(_0x23ca3a,null));};exports[_0x877c('0x2a')]=function(_0x203358,_0x3cd670){return db['Interval']['find']({'where':{'id':_0x203358[_0x877c('0x54')]['id']}})[_0x877c('0x26')](handleEntityNotFound(_0x3cd670,null))[_0x877c('0x26')](removeEntity(_0x3cd670,null))['catch'](handleError(_0x3cd670,null));};exports['addInterval']=function(_0x90890d,_0x4b5a6f,_0x15bd7b){if(_0x90890d[_0x877c('0x4c')]['id']){delete _0x90890d[_0x877c('0x4c')]['id'];}return db[_0x877c('0x44')][_0x877c('0x4a')]({'where':{'id':_0x90890d[_0x877c('0x54')]['id']}})[_0x877c('0x26')](handleEntityNotFound(_0x4b5a6f,null))[_0x877c('0x26')](function(_0x4c6747){if(_0x4c6747){_0x90890d[_0x877c('0x4c')][_0x877c('0x55')]=_0x4c6747['id'];return db[_0x877c('0x44')][_0x877c('0x4b')](_0x90890d[_0x877c('0x4c')]);}})[_0x877c('0x26')](respondWithResult(_0x4b5a6f,null))[_0x877c('0x47')](handleError(_0x4b5a6f,null));};exports[_0x877c('0x56')]=function(_0x38c664,_0x125c9e,_0x353451){var _0x42e480={};var _0x5e7f22={};var _0xdd2d05;var _0x39920c;return db[_0x877c('0x44')][_0x877c('0x57')]({'where':{'id':_0x38c664[_0x877c('0x54')]['id']}})['then'](handleEntityNotFound(_0x125c9e,null))['then'](function(_0x29d9b2){if(_0x29d9b2){_0xdd2d05=_0x29d9b2;_0x5e7f22[_0x877c('0x37')]=_[_0x877c('0x34')](db['Interval'][_0x877c('0x49')]);_0x5e7f22['query']=_[_0x877c('0x34')](_0x38c664[_0x877c('0x33')]);_0x5e7f22[_0x877c('0x35')]=_[_0x877c('0x36')](_0x5e7f22['model'],_0x5e7f22[_0x877c('0x33')]);_0x42e480[_0x877c('0x38')]=_[_0x877c('0x36')](_0x5e7f22[_0x877c('0x37')],qs['fields'](_0x38c664['query'][_0x877c('0x39')]));_0x42e480[_0x877c('0x38')]=_0x42e480[_0x877c('0x38')]['length']?_0x42e480[_0x877c('0x38')]:_0x5e7f22[_0x877c('0x37')];_0x42e480['order']=qs[_0x877c('0x3e')](_0x38c664[_0x877c('0x33')]['sort']);_0x42e480[_0x877c('0x3f')]=qs['filters'](_[_0x877c('0x58')](_0x38c664[_0x877c('0x33')],_0x5e7f22[_0x877c('0x35')]));if(_0x38c664[_0x877c('0x33')][_0x877c('0x41')]){_0x42e480['where']=_[_0x877c('0x40')](_0x42e480[_0x877c('0x3f')],{'$or':_[_0x877c('0x31')](_0x42e480['attributes'],function(_0x5cd815){var _0x3a690e={};_0x3a690e[_0x5cd815]={'$like':'%'+_0x38c664[_0x877c('0x33')][_0x877c('0x41')]+'%'};return _0x3a690e;})});}_0x42e480=_[_0x877c('0x40')]({},_0x42e480,_0x38c664[_0x877c('0x42')]);return _0xdd2d05[_0x877c('0x56')](_0x42e480);}})[_0x877c('0x26')](function(_0x37d29c){if(_0x37d29c){_0x39920c=_0x37d29c[_0x877c('0x3a')];if(!_0x38c664[_0x877c('0x33')][_0x877c('0x3b')]('nolimit')){_0x42e480['limit']=qs['limit'](_0x38c664[_0x877c('0x33')][_0x877c('0x1d')]);_0x42e480[_0x877c('0x1f')]=qs[_0x877c('0x1f')](_0x38c664['query'][_0x877c('0x1f')]);}return _0xdd2d05[_0x877c('0x56')](_0x42e480);}})['then'](function(_0x381126){if(_0x381126){return _0x381126?{'count':_0x39920c,'rows':_0x381126}:null;}})[_0x877c('0x26')](respondWithResult(_0x125c9e,null))['catch'](handleError(_0x125c9e,null));};exports['addIntervals']=function(_0x55ecfe,_0x482392,_0x1c00a5){return db[_0x877c('0x44')][_0x877c('0x57')]({'where':{'id':_0x55ecfe[_0x877c('0x54')]['id']}})['then'](handleEntityNotFound(_0x482392,null))[_0x877c('0x26')](function(_0x1b61e2){if(_0x1b61e2){return db[_0x877c('0x59')][_0x877c('0x5a')](function(_0x55997a){return db[_0x877c('0x44')][_0x877c('0x2a')]({'where':{'IntervalId':_0x55ecfe[_0x877c('0x54')]['id']},'transaction':_0x55997a})['then'](function(_0x265a3d){var _0x102904=_[_0x877c('0x31')](_0x55ecfe[_0x877c('0x4c')],function(_0x415338){delete _0x415338['id'];_0x415338[_0x877c('0x55')]=_0x55ecfe[_0x877c('0x54')]['id'];return _0x415338;});return db[_0x877c('0x44')][_0x877c('0x5b')](_0x102904,{'transaction':_0x55997a});});})['then'](function(){return db['Interval'][_0x877c('0x45')]({'where':{'IntervalId':_0x55ecfe[_0x877c('0x54')]['id']}});});}})[_0x877c('0x26')](respondWithResult(_0x482392,null))[_0x877c('0x47')](handleError(_0x482392,null));}; \ No newline at end of file +var _0xba09=['index','map','Interval','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','addInterval','IntervalId','getIntervals','hasOwnProperty','nolimit','addIntervals','findOne','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','Intervals','error','stack','name','send'];(function(_0x3b07db,_0x4da958){var _0x585ee1=function(_0x5df07f){while(--_0x5df07f){_0x3b07db['push'](_0x3b07db['shift']());}};_0x585ee1(++_0x4da958);}(_0xba09,0x90));var _0x9ba0=function(_0x2dc577,_0x4eb9d4){_0x2dc577=_0x2dc577-0x0;var _0x2dbdd6=_0xba09[_0x2dc577];return _0x2dbdd6;};'use strict';var emlformat=require(_0x9ba0('0x0'));var rimraf=require(_0x9ba0('0x1'));var zipdir=require(_0x9ba0('0x2'));var jsonpatch=require(_0x9ba0('0x3'));var rp=require(_0x9ba0('0x4'));var moment=require(_0x9ba0('0x5'));var BPromise=require(_0x9ba0('0x6'));var Mustache=require(_0x9ba0('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9ba0('0x8'));var ejs=require(_0x9ba0('0x9'));var fs=require('fs');var fs_extra=require(_0x9ba0('0xa'));var _=require(_0x9ba0('0xb'));var squel=require(_0x9ba0('0xc'));var crypto=require(_0x9ba0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9ba0('0xe'));var toCsv=require(_0x9ba0('0x8'));var querystring=require(_0x9ba0('0xf'));var Papa=require(_0x9ba0('0x10'));var Redis=require(_0x9ba0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9ba0('0x12'));var as=require(_0x9ba0('0x13'));var hardwareService=require(_0x9ba0('0x14'));var logger=require('../../config/logger')(_0x9ba0('0x15'));var utils=require(_0x9ba0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9ba0('0x17'));var db=require(_0x9ba0('0x18'))['db'];var extensions=require(_0x9ba0('0x19'));function respondWithStatusCode(_0x347663,_0x5663bd){_0x5663bd=_0x5663bd||0xcc;return function(_0x1a9d77){if(_0x1a9d77){return _0x347663[_0x9ba0('0x1a')](_0x5663bd);}return _0x347663[_0x9ba0('0x1b')](_0x5663bd)[_0x9ba0('0x1c')]();};}function respondWithResult(_0x595e8c,_0x1e3075){_0x1e3075=_0x1e3075||0xc8;return function(_0x1388dc){if(_0x1388dc){return _0x595e8c[_0x9ba0('0x1b')](_0x1e3075)[_0x9ba0('0x1d')](_0x1388dc);}};}function respondWithFilteredResult(_0x29e992,_0x414f5c){return function(_0x485844){if(_0x485844){var _0x1c2164=typeof _0x414f5c[_0x9ba0('0x1e')]===_0x9ba0('0x1f')&&typeof _0x414f5c[_0x9ba0('0x20')]==='undefined';var _0x14f75b=_0x485844[_0x9ba0('0x21')];var _0x564f03=_0x1c2164?0x0:_0x414f5c[_0x9ba0('0x1e')];var _0x2389c5=_0x1c2164?_0x485844[_0x9ba0('0x21')]:_0x414f5c['offset']+_0x414f5c[_0x9ba0('0x20')];var _0x3af19c;if(_0x2389c5>=_0x14f75b){_0x2389c5=_0x14f75b;_0x3af19c=0xc8;}else{_0x3af19c=0xce;}_0x29e992[_0x9ba0('0x1b')](_0x3af19c);return _0x29e992['set'](_0x9ba0('0x22'),_0x564f03+'-'+_0x2389c5+'/'+_0x14f75b)[_0x9ba0('0x1d')](_0x485844);}return null;};}function patchUpdates(_0xc12e00){return function(_0x2aa629){try{jsonpatch[_0x9ba0('0x23')](_0x2aa629,_0xc12e00,!![]);}catch(_0x4e260f){return BPromise[_0x9ba0('0x24')](_0x4e260f);}return _0x2aa629[_0x9ba0('0x25')]();};}function saveUpdates(_0x11d4a8,_0x2c6ffe){return function(_0x1551ec){if(_0x1551ec){return _0x1551ec[_0x9ba0('0x26')](_0x11d4a8)['then'](function(_0x5ddc83){return _0x5ddc83;});}return null;};}function removeEntity(_0x3a9377,_0x29fb67){return function(_0x32cd5f){if(_0x32cd5f){return _0x32cd5f['destroy']()[_0x9ba0('0x27')](function(){var _0x12734e=_0x32cd5f[_0x9ba0('0x28')]({'plain':!![]});var _0x111a8a=_0x9ba0('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x111a8a,'resourceId':_0x12734e['id']}})['then'](function(){return _0x32cd5f;});})['then'](function(){_0x3a9377['status'](0xcc)[_0x9ba0('0x1c')]();});}};}function handleEntityNotFound(_0x5b7305,_0x3487d8){return function(_0x10ae1f){if(!_0x10ae1f){_0x5b7305['sendStatus'](0x194);}return _0x10ae1f;};}function handleError(_0x19e291,_0x2bf23e){_0x2bf23e=_0x2bf23e||0x1f4;return function(_0x589f1b){logger[_0x9ba0('0x2a')](_0x589f1b[_0x9ba0('0x2b')]);if(_0x589f1b[_0x9ba0('0x2c')]){delete _0x589f1b[_0x9ba0('0x2c')];}_0x19e291[_0x9ba0('0x1b')](_0x2bf23e)[_0x9ba0('0x2d')](_0x589f1b);};}exports[_0x9ba0('0x2e')]=function(_0x366997,_0x5e82d2){var _0x2e7152={},_0x37deed={},_0x1c0ae6={'count':0x0,'rows':[]};var _0x3c4738=_[_0x9ba0('0x2f')](db[_0x9ba0('0x30')][_0x9ba0('0x31')],function(_0xb06890){return{'name':_0xb06890['fieldName'],'type':_0xb06890[_0x9ba0('0x32')]['key']};});_0x37deed[_0x9ba0('0x33')]=_[_0x9ba0('0x2f')](_0x3c4738,_0x9ba0('0x2c'));_0x37deed[_0x9ba0('0x34')]=_[_0x9ba0('0x35')](_0x366997[_0x9ba0('0x34')]);_0x37deed[_0x9ba0('0x36')]=_[_0x9ba0('0x37')](_0x37deed['model'],_0x37deed['query']);_0x2e7152[_0x9ba0('0x38')]=_['intersection'](_0x37deed[_0x9ba0('0x33')],qs[_0x9ba0('0x39')](_0x366997[_0x9ba0('0x34')][_0x9ba0('0x39')]));_0x2e7152[_0x9ba0('0x38')]=_0x2e7152[_0x9ba0('0x38')][_0x9ba0('0x3a')]?_0x2e7152[_0x9ba0('0x38')]:_0x37deed[_0x9ba0('0x33')];if(!_0x366997[_0x9ba0('0x34')]['hasOwnProperty']('nolimit')){_0x2e7152[_0x9ba0('0x20')]=qs[_0x9ba0('0x20')](_0x366997[_0x9ba0('0x34')][_0x9ba0('0x20')]);_0x2e7152[_0x9ba0('0x1e')]=qs[_0x9ba0('0x1e')](_0x366997[_0x9ba0('0x34')]['offset']);}_0x2e7152[_0x9ba0('0x3b')]=qs['sort'](_0x366997[_0x9ba0('0x34')][_0x9ba0('0x3c')]);_0x2e7152[_0x9ba0('0x3d')]=qs[_0x9ba0('0x36')](_[_0x9ba0('0x3e')](_0x366997['query'],_0x37deed[_0x9ba0('0x36')]),_0x3c4738);if(_0x366997[_0x9ba0('0x34')]['filter']){_0x2e7152[_0x9ba0('0x3d')]=_[_0x9ba0('0x3f')](_0x2e7152[_0x9ba0('0x3d')],{'$or':_[_0x9ba0('0x2f')](_0x3c4738,function(_0x20291f){if(_0x20291f['type']!==_0x9ba0('0x40')){var _0x11568b={};_0x11568b[_0x20291f[_0x9ba0('0x2c')]]={'$like':'%'+_0x366997[_0x9ba0('0x34')][_0x9ba0('0x41')]+'%'};return _0x11568b;}})});}_0x2e7152=_[_0x9ba0('0x3f')]({},_0x2e7152,_0x366997[_0x9ba0('0x42')]);var _0x5e4a0a={'where':_0x2e7152[_0x9ba0('0x3d')]};return db[_0x9ba0('0x30')]['count'](_0x5e4a0a)[_0x9ba0('0x27')](function(_0x2cdc5b){_0x1c0ae6[_0x9ba0('0x21')]=_0x2cdc5b;if(_0x366997['query'][_0x9ba0('0x43')]){_0x2e7152[_0x9ba0('0x44')]=[{'all':!![]}];}return db[_0x9ba0('0x30')][_0x9ba0('0x45')](_0x2e7152);})['then'](function(_0x1a3ea2){_0x1c0ae6[_0x9ba0('0x46')]=_0x1a3ea2;return _0x1c0ae6;})[_0x9ba0('0x27')](respondWithFilteredResult(_0x5e82d2,_0x2e7152))[_0x9ba0('0x47')](handleError(_0x5e82d2,null));};exports[_0x9ba0('0x48')]=function(_0x3ed050,_0x17863f){var _0x328e18={'raw':!![],'where':{'id':_0x3ed050[_0x9ba0('0x49')]['id']}},_0x44a31e={};_0x44a31e[_0x9ba0('0x33')]=_[_0x9ba0('0x35')](db[_0x9ba0('0x30')][_0x9ba0('0x31')]);_0x44a31e[_0x9ba0('0x34')]=_[_0x9ba0('0x35')](_0x3ed050[_0x9ba0('0x34')]);_0x44a31e[_0x9ba0('0x36')]=_['intersection'](_0x44a31e[_0x9ba0('0x33')],_0x44a31e[_0x9ba0('0x34')]);_0x328e18['attributes']=_[_0x9ba0('0x37')](_0x44a31e['model'],qs['fields'](_0x3ed050[_0x9ba0('0x34')]['fields']));_0x328e18[_0x9ba0('0x38')]=_0x328e18['attributes'][_0x9ba0('0x3a')]?_0x328e18[_0x9ba0('0x38')]:_0x44a31e[_0x9ba0('0x33')];if(_0x3ed050[_0x9ba0('0x34')]['includeAll']){_0x328e18[_0x9ba0('0x44')]=[{'all':!![]}];}_0x328e18=_[_0x9ba0('0x3f')]({},_0x328e18,_0x3ed050[_0x9ba0('0x42')]);return db[_0x9ba0('0x30')][_0x9ba0('0x4a')](_0x328e18)[_0x9ba0('0x27')](handleEntityNotFound(_0x17863f,null))[_0x9ba0('0x27')](respondWithResult(_0x17863f,null))['catch'](handleError(_0x17863f,null));};exports['create']=function(_0x8033f,_0x1a1e54){return db['Interval'][_0x9ba0('0x4b')](_0x8033f['body'],{})['then'](function(_0x2acd47){var _0x406829=_0x8033f[_0x9ba0('0x4c')][_0x9ba0('0x28')]({'plain':!![]});if(!_0x406829)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x406829[_0x9ba0('0x4d')]===_0x9ba0('0x4c')){var _0x28114b=_0x2acd47[_0x9ba0('0x28')]({'plain':!![]});var _0x540d8d=_0x9ba0('0x29');return db[_0x9ba0('0x4e')]['find']({'where':{'name':_0x540d8d,'userProfileId':_0x406829[_0x9ba0('0x4f')]},'raw':!![]})['then'](function(_0x4b358b){if(_0x4b358b&&_0x4b358b[_0x9ba0('0x50')]===0x0){return db[_0x9ba0('0x51')][_0x9ba0('0x4b')]({'name':_0x28114b[_0x9ba0('0x2c')],'resourceId':_0x28114b['id'],'type':_0x4b358b[_0x9ba0('0x2c')],'sectionId':_0x4b358b['id']},{})['then'](function(){return _0x2acd47;});}else{return _0x2acd47;}})[_0x9ba0('0x47')](function(_0x775b20){logger[_0x9ba0('0x2a')](_0x9ba0('0x52'),_0x775b20);throw _0x775b20;});}return _0x2acd47;})[_0x9ba0('0x27')](respondWithResult(_0x1a1e54,0xc9))[_0x9ba0('0x47')](handleError(_0x1a1e54,null));};exports[_0x9ba0('0x26')]=function(_0x29b5c5,_0xed214b){if(_0x29b5c5[_0x9ba0('0x53')]['id']){delete _0x29b5c5[_0x9ba0('0x53')]['id'];}return db[_0x9ba0('0x30')][_0x9ba0('0x4a')]({'where':{'id':_0x29b5c5[_0x9ba0('0x49')]['id']}})['then'](handleEntityNotFound(_0xed214b,null))['then'](saveUpdates(_0x29b5c5[_0x9ba0('0x53')],null))[_0x9ba0('0x27')](respondWithResult(_0xed214b,null))[_0x9ba0('0x47')](handleError(_0xed214b,null));};exports[_0x9ba0('0x54')]=function(_0x5eec93,_0x2f827d){return db[_0x9ba0('0x30')][_0x9ba0('0x4a')]({'where':{'id':_0x5eec93[_0x9ba0('0x49')]['id']}})[_0x9ba0('0x27')](handleEntityNotFound(_0x2f827d,null))['then'](removeEntity(_0x2f827d,null))[_0x9ba0('0x47')](handleError(_0x2f827d,null));};exports[_0x9ba0('0x55')]=function(_0xa8f9c9,_0x2aa1fa,_0x1807be){if(_0xa8f9c9[_0x9ba0('0x53')]['id']){delete _0xa8f9c9[_0x9ba0('0x53')]['id'];}return db[_0x9ba0('0x30')][_0x9ba0('0x4a')]({'where':{'id':_0xa8f9c9[_0x9ba0('0x49')]['id']}})[_0x9ba0('0x27')](handleEntityNotFound(_0x2aa1fa,null))['then'](function(_0x210a71){if(_0x210a71){_0xa8f9c9['body'][_0x9ba0('0x56')]=_0x210a71['id'];return db['Interval']['create'](_0xa8f9c9['body']);}})[_0x9ba0('0x27')](respondWithResult(_0x2aa1fa,null))[_0x9ba0('0x47')](handleError(_0x2aa1fa,null));};exports[_0x9ba0('0x57')]=function(_0x129a2c,_0x3f2ca3,_0x4a1a40){var _0x5a5418={};var _0x1d18ef={};var _0x2c22e7;var _0x403170;return db['Interval']['findOne']({'where':{'id':_0x129a2c[_0x9ba0('0x49')]['id']}})[_0x9ba0('0x27')](handleEntityNotFound(_0x3f2ca3,null))['then'](function(_0x2da212){if(_0x2da212){_0x2c22e7=_0x2da212;_0x1d18ef[_0x9ba0('0x33')]=_[_0x9ba0('0x35')](db[_0x9ba0('0x30')][_0x9ba0('0x31')]);_0x1d18ef[_0x9ba0('0x34')]=_['keys'](_0x129a2c[_0x9ba0('0x34')]);_0x1d18ef[_0x9ba0('0x36')]=_[_0x9ba0('0x37')](_0x1d18ef['model'],_0x1d18ef[_0x9ba0('0x34')]);_0x5a5418[_0x9ba0('0x38')]=_[_0x9ba0('0x37')](_0x1d18ef[_0x9ba0('0x33')],qs[_0x9ba0('0x39')](_0x129a2c[_0x9ba0('0x34')]['fields']));_0x5a5418[_0x9ba0('0x38')]=_0x5a5418[_0x9ba0('0x38')][_0x9ba0('0x3a')]?_0x5a5418[_0x9ba0('0x38')]:_0x1d18ef['model'];_0x5a5418['order']=qs[_0x9ba0('0x3c')](_0x129a2c['query'][_0x9ba0('0x3c')]);_0x5a5418[_0x9ba0('0x3d')]=qs[_0x9ba0('0x36')](_[_0x9ba0('0x3e')](_0x129a2c[_0x9ba0('0x34')],_0x1d18ef[_0x9ba0('0x36')]));if(_0x129a2c[_0x9ba0('0x34')][_0x9ba0('0x41')]){_0x5a5418[_0x9ba0('0x3d')]=_['merge'](_0x5a5418[_0x9ba0('0x3d')],{'$or':_[_0x9ba0('0x2f')](_0x5a5418[_0x9ba0('0x38')],function(_0x2968ab){var _0x53539f={};_0x53539f[_0x2968ab]={'$like':'%'+_0x129a2c['query'][_0x9ba0('0x41')]+'%'};return _0x53539f;})});}_0x5a5418=_[_0x9ba0('0x3f')]({},_0x5a5418,_0x129a2c['options']);return _0x2c22e7[_0x9ba0('0x57')](_0x5a5418);}})[_0x9ba0('0x27')](function(_0x5e9c30){if(_0x5e9c30){_0x403170=_0x5e9c30[_0x9ba0('0x3a')];if(!_0x129a2c[_0x9ba0('0x34')][_0x9ba0('0x58')](_0x9ba0('0x59'))){_0x5a5418[_0x9ba0('0x20')]=qs[_0x9ba0('0x20')](_0x129a2c[_0x9ba0('0x34')][_0x9ba0('0x20')]);_0x5a5418[_0x9ba0('0x1e')]=qs[_0x9ba0('0x1e')](_0x129a2c['query'][_0x9ba0('0x1e')]);}return _0x2c22e7['getIntervals'](_0x5a5418);}})[_0x9ba0('0x27')](function(_0x4c9724){if(_0x4c9724){return _0x4c9724?{'count':_0x403170,'rows':_0x4c9724}:null;}})['then'](respondWithResult(_0x3f2ca3,null))['catch'](handleError(_0x3f2ca3,null));};exports[_0x9ba0('0x5a')]=function(_0x53ec0f,_0x285088,_0x29ff76){return db[_0x9ba0('0x30')][_0x9ba0('0x5b')]({'where':{'id':_0x53ec0f[_0x9ba0('0x49')]['id']}})[_0x9ba0('0x27')](handleEntityNotFound(_0x285088,null))[_0x9ba0('0x27')](function(_0x16762f){if(_0x16762f){return db[_0x9ba0('0x5c')][_0x9ba0('0x5d')](function(_0x3a1130){return db['Interval'][_0x9ba0('0x54')]({'where':{'IntervalId':_0x53ec0f[_0x9ba0('0x49')]['id']},'transaction':_0x3a1130})[_0x9ba0('0x27')](function(_0x462044){var _0x122daf=_[_0x9ba0('0x2f')](_0x53ec0f['body'],function(_0x287fb5){delete _0x287fb5['id'];_0x287fb5[_0x9ba0('0x56')]=_0x53ec0f[_0x9ba0('0x49')]['id'];return _0x287fb5;});return db[_0x9ba0('0x30')][_0x9ba0('0x5e')](_0x122daf,{'transaction':_0x3a1130});});})['then'](function(){return db[_0x9ba0('0x30')][_0x9ba0('0x45')]({'where':{'IntervalId':_0x53ec0f[_0x9ba0('0x49')]['id']}});});}})[_0x9ba0('0x27')](respondWithResult(_0x285088,null))[_0x9ba0('0x47')](handleError(_0x285088,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 12d870b..9b166f2 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 _0xebf7=['define','Interval','rewrite','interval','map','ifTime','then','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xebf7,0x14c));var _0x7ebf=function(_0x2a811b,_0x5125e4){_0x2a811b=_0x2a811b-0x0;var _0x58a8c1=_0xebf7[_0x2a811b];return _0x58a8c1;};'use strict';var attributes=require(_0x7ebf('0x0'));var extensions=require(_0x7ebf('0x1'));var iftime=require(_0x7ebf('0x2'))[_0x7ebf('0x3')];module['exports']=function(_0x35053b){return _0x35053b[_0x7ebf('0x4')](_0x7ebf('0x5'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x543dde){extensions['rewrite'](_0x35053b,_0x543dde);},'afterBulkCreate':function(_0x2d2582,_0x272764,_0x2a6c3d){_0x2a6c3d();extensions[_0x7ebf('0x6')](_0x35053b,_0x2d2582[0x0]);},'afterUpdate':function(_0x19b7a4){extensions[_0x7ebf('0x6')](_0x35053b,_0x19b7a4);},'afterDestroy':function(_0x394aa8){extensions[_0x7ebf('0x6')](_0x35053b,_0x394aa8);}},'instanceMethods':{'ifTime':function(_0x86c739=undefined,_0x4a8ba8=new Date()){if(typeof this[_0x7ebf('0x7')]==='string'){return iftime(this[_0x7ebf('0x7')],_0x86c739,_0x4a8ba8);}else{return this['getIntervals']()['then'](function(_0x1edb3d){return Promise['all'](_0x1edb3d[_0x7ebf('0x8')](function(_0x21c4b5){return _0x21c4b5[_0x7ebf('0x9')](_0x86c739,_0x4a8ba8);}));})[_0x7ebf('0xa')](function(_0x3b79a3){return _0x3b79a3[_0x7ebf('0xb')](function(_0x289834,_0x134dc1){return _0x289834||_0x134dc1;},![]);});}}}});}; \ No newline at end of file +var _0xb5e3=['then','all','ifTime','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','Interval','tools_intervals','rewrite','interval','string','getIntervals'];(function(_0x41391c,_0x5d24f9){var _0x5242cc=function(_0x1274ad){while(--_0x1274ad){_0x41391c['push'](_0x41391c['shift']());}};_0x5242cc(++_0x5d24f9);}(_0xb5e3,0x1d1));var _0x3b5e=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0xb5e3[_0x5519a9];return _0x32f2cc;};'use strict';var attributes=require(_0x3b5e('0x0'));var extensions=require(_0x3b5e('0x1'));var iftime=require(_0x3b5e('0x2'))[_0x3b5e('0x3')];module[_0x3b5e('0x4')]=function(_0x24e029){return _0x24e029['define'](_0x3b5e('0x5'),attributes,{'tableName':_0x3b5e('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x338731){extensions[_0x3b5e('0x7')](_0x24e029,_0x338731);},'afterBulkCreate':function(_0x5abb07,_0x44545f,_0x7f79d){_0x7f79d();extensions[_0x3b5e('0x7')](_0x24e029,_0x5abb07[0x0]);},'afterUpdate':function(_0x352a8a){extensions[_0x3b5e('0x7')](_0x24e029,_0x352a8a);},'afterDestroy':function(_0x179898){extensions['rewrite'](_0x24e029,_0x179898);}},'instanceMethods':{'ifTime':function(_0x3adb34=undefined,_0x5cd416=new Date()){if(typeof this[_0x3b5e('0x8')]===_0x3b5e('0x9')){return iftime(this[_0x3b5e('0x8')],_0x3adb34,_0x5cd416);}else{return this[_0x3b5e('0xa')]()[_0x3b5e('0xb')](function(_0x3cf1c3){return Promise[_0x3b5e('0xc')](_0x3cf1c3['map'](function(_0x50c18e){return _0x50c18e[_0x3b5e('0xd')](_0x3adb34,_0x5cd416);}));})[_0x3b5e('0xb')](function(_0x35da2c){return _0x35da2c['reduce'](function(_0x2c7282,_0x10dcba){return _0x2c7282||_0x10dcba;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 17b550a..cd83feb 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 _0x4b14=['length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','resolve','catch','util','../../mysqldb','iftime','../../config/logger','rpc','GetInterval','Interval','options','raw','where','attributes','include','map','model','debug','stringify','error','message','find','then','info','ShowInterval','findAll','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','string','intervals','timezone'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0x4b14,0x84));var _0x44b1=function(_0x1298a1,_0x1780e3){_0x1298a1=_0x1298a1-0x0;var _0x5a85ef=_0x4b14[_0x1298a1];return _0x5a85ef;};'use strict';var _=require('lodash');var util=require(_0x44b1('0x0'));var db=require(_0x44b1('0x1'))['db'];var iftime=require('../../utils/iftime')[_0x44b1('0x2')];var logger=require(_0x44b1('0x3'))(_0x44b1('0x4'));exports[_0x44b1('0x5')]=function(_0x386442){var _0x10807e=this;return new Promise(function(_0x1d8f86,_0x2edf90){return db[_0x44b1('0x6')]['findAll']({'raw':_0x386442['options']?_0x386442[_0x44b1('0x7')][_0x44b1('0x8')]===undefined?!![]:![]:!![],'where':_0x386442[_0x44b1('0x7')]?_0x386442[_0x44b1('0x7')][_0x44b1('0x9')]||null:null,'attributes':_0x386442['options']?_0x386442['options'][_0x44b1('0xa')]||null:null,'limit':_0x386442[_0x44b1('0x7')]?_0x386442[_0x44b1('0x7')]['limit']||null:null,'include':_0x386442[_0x44b1('0x7')]?_0x386442[_0x44b1('0x7')][_0x44b1('0xb')]?_[_0x44b1('0xc')](_0x386442[_0x44b1('0x7')][_0x44b1('0xb')],function(_0x1170cc){return{'model':db[_0x1170cc['model']],'as':_0x1170cc['as'],'attributes':_0x1170cc[_0x44b1('0xa')],'include':_0x1170cc[_0x44b1('0xb')]?_[_0x44b1('0xc')](_0x1170cc['include'],function(_0x58fc5a){return{'model':db[_0x58fc5a[_0x44b1('0xd')]],'as':_0x58fc5a['as'],'attributes':_0x58fc5a[_0x44b1('0xa')],'include':_0x58fc5a[_0x44b1('0xb')]?_[_0x44b1('0xc')](_0x58fc5a['include'],function(_0x4f84d4){return{'model':db[_0x4f84d4[_0x44b1('0xd')]],'as':_0x4f84d4['as'],'attributes':_0x4f84d4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x391c5f){logger['info'](_0x44b1('0x5'),_0x386442);logger[_0x44b1('0xe')]('GetInterval',_0x386442,JSON[_0x44b1('0xf')](_0x391c5f));_0x1d8f86(_0x391c5f);})['catch'](function(_0x31d120){logger[_0x44b1('0x10')](_0x44b1('0x5'),_0x31d120[_0x44b1('0x11')],_0x386442);_0x2edf90(_0x10807e['error'](0x1f4,_0x31d120[_0x44b1('0x11')]));});});};exports['ShowInterval']=function(_0x16201b){var _0x174011=this;return new Promise(function(_0x5fb300,_0x4fea9a){return db[_0x44b1('0x6')][_0x44b1('0x12')]({'raw':_0x16201b[_0x44b1('0x7')]?_0x16201b[_0x44b1('0x7')][_0x44b1('0x8')]===undefined?!![]:![]:!![],'where':_0x16201b[_0x44b1('0x7')]?_0x16201b[_0x44b1('0x7')]['where']||null:null,'attributes':_0x16201b[_0x44b1('0x7')]?_0x16201b['options']['attributes']||null:null,'include':_0x16201b[_0x44b1('0x7')]?_0x16201b[_0x44b1('0x7')]['include']?_['map'](_0x16201b[_0x44b1('0x7')][_0x44b1('0xb')],function(_0x12fb91){return{'model':db[_0x12fb91[_0x44b1('0xd')]],'as':_0x12fb91['as'],'attributes':_0x12fb91[_0x44b1('0xa')],'include':_0x12fb91['include']?_[_0x44b1('0xc')](_0x12fb91[_0x44b1('0xb')],function(_0xc1fc05){return{'model':db[_0xc1fc05[_0x44b1('0xd')]],'as':_0xc1fc05['as'],'attributes':_0xc1fc05[_0x44b1('0xa')],'include':_0xc1fc05['include']?_[_0x44b1('0xc')](_0xc1fc05[_0x44b1('0xb')],function(_0xed92f8){return{'model':db[_0xed92f8[_0x44b1('0xd')]],'as':_0xed92f8['as'],'attributes':_0xed92f8[_0x44b1('0xa')]};}):[]};}):[]};}):[]:[]})[_0x44b1('0x13')](function(_0x33372e){logger[_0x44b1('0x14')](_0x44b1('0x15'),_0x16201b);logger[_0x44b1('0xe')](_0x44b1('0x15'),_0x16201b,JSON[_0x44b1('0xf')](_0x33372e));_0x5fb300(_0x33372e);})['catch'](function(_0x4a7e9b){logger[_0x44b1('0x10')](_0x44b1('0x15'),_0x4a7e9b[_0x44b1('0x11')],_0x16201b);_0x4fea9a(_0x174011[_0x44b1('0x10')](0x1f4,_0x4a7e9b['message']));});});};function checkArrayOfIntervals(_0x2747b2,_0x43a351){var _0x5bbd97=[];return db['Interval'][_0x44b1('0x16')]({'where':{'id':_0x2747b2}})['then'](function(_0x1e81df){_0x5bbd97=_0x1e81df;return Promise['all'](_0x5bbd97[_0x44b1('0xc')](function(_0x1b07a3){return _0x1b07a3[_0x44b1('0x17')](_0x43a351);}));})[_0x44b1('0x13')](function(_0x3deb49){var _0x52c9b8=_0x3deb49[_0x44b1('0x18')](function(_0x468a62,_0x278e37){return _0x468a62||_0x278e37;},![]);logger[_0x44b1('0x14')](util[_0x44b1('0x19')](_0x44b1('0x1a'),_0x5bbd97[_0x44b1('0xc')](function(_0x54881e){return _0x54881e[_0x44b1('0x1b')];})[_0x44b1('0x1c')](',\x20'),_0x5bbd97['map'](function(_0x3a6810){return _0x3a6810['id'];})[_0x44b1('0x1c')](',\x20')));return _0x52c9b8;});}function checkSingleInterval(_0x8d1c37,_0x66d77c){return db[_0x44b1('0x6')]['findById'](_0x8d1c37)[_0x44b1('0x13')](function(_0x3f9838){if(_0x3f9838){logger[_0x44b1('0x14')](util[_0x44b1('0x19')](_0x44b1('0x1d'),_0x3f9838[_0x44b1('0x1b')],_0x3f9838['id']));return _0x3f9838[_0x44b1('0x17')](_0x66d77c);}});}exports[_0x44b1('0x1e')]=function(_0x5d6bd6){var _0x48e904=_0x5d6bd6[_0x44b1('0x1f')];var _0x474730=Array[_0x44b1('0x20')](_0x5d6bd6['intervals'])?_0x5d6bd6['intervals']:typeof _0x5d6bd6['intervals']===_0x44b1('0x21')?[_0x5d6bd6[_0x44b1('0x22')]]:[];var _0x116111=_0x5d6bd6[_0x44b1('0x23')]||undefined;var _0x3cafe9=![];if(_0x474730[_0x44b1('0x24')]){logger['info'](util[_0x44b1('0x19')](_0x44b1('0x25'),_0x474730[_0x44b1('0x1c')](';\x20')));}if(_0x116111){logger[_0x44b1('0x14')](util[_0x44b1('0x19')](_0x44b1('0x26'),_0x116111));}logger['debug']('Iftime',_0x3cafe9);logger[_0x44b1('0x27')](_0x44b1('0x1e'),_0x5d6bd6);return Promise[_0x44b1('0x28')]()[_0x44b1('0x13')](function(){if(Array[_0x44b1('0x20')](_0x48e904)){return checkArrayOfIntervals(_0x48e904,_0x116111);}else if(_0x48e904){return checkSingleInterval(_0x48e904,_0x116111);}})['then'](function(_0x1df68e){var _0x138b1a=_0x474730[_0x44b1('0x18')](function(_0x18db47,_0x4c0647){return _0x18db47||iftime(_0x4c0647,_0x116111);},![]);_0x3cafe9=_0x1df68e||_0x138b1a;return _0x3cafe9;})[_0x44b1('0x29')](function(_0x238670){logger[_0x44b1('0x10')]('IntervalIftime',_0x5d6bd6,_0x238670);throw this[_0x44b1('0x10')](0x1f4,_0x238670['message']);});}; \ No newline at end of file +var _0x5988=['../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','model','map','then','info','debug','stringify','error','message','ShowInterval','find','all','ifTime','reduce','format','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','isArray','intervals','string','timezone','length','Iftime','silly','resolve','catch','lodash','util','../../utils/iftime','iftime'];(function(_0x2a1077,_0x34901b){var _0x40b180=function(_0xe3dc65){while(--_0xe3dc65){_0x2a1077['push'](_0x2a1077['shift']());}};_0x40b180(++_0x34901b);}(_0x5988,0xce));var _0x8598=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x5988[_0x186376];return _0x2dbdd9;};'use strict';var _=require(_0x8598('0x0'));var util=require(_0x8598('0x1'));var db=require('../../mysqldb')['db'];var iftime=require(_0x8598('0x2'))[_0x8598('0x3')];var logger=require(_0x8598('0x4'))(_0x8598('0x5'));exports[_0x8598('0x6')]=function(_0x2ed841){var _0x56eee6=this;return new Promise(function(_0x336848,_0x41d4d2){return db[_0x8598('0x7')][_0x8598('0x8')]({'raw':_0x2ed841[_0x8598('0x9')]?_0x2ed841[_0x8598('0x9')][_0x8598('0xa')]===undefined?!![]:![]:!![],'where':_0x2ed841[_0x8598('0x9')]?_0x2ed841[_0x8598('0x9')][_0x8598('0xb')]||null:null,'attributes':_0x2ed841['options']?_0x2ed841[_0x8598('0x9')][_0x8598('0xc')]||null:null,'limit':_0x2ed841[_0x8598('0x9')]?_0x2ed841[_0x8598('0x9')][_0x8598('0xd')]||null:null,'include':_0x2ed841[_0x8598('0x9')]?_0x2ed841['options'][_0x8598('0xe')]?_['map'](_0x2ed841[_0x8598('0x9')][_0x8598('0xe')],function(_0x819cf8){return{'model':db[_0x819cf8['model']],'as':_0x819cf8['as'],'attributes':_0x819cf8['attributes'],'include':_0x819cf8[_0x8598('0xe')]?_['map'](_0x819cf8[_0x8598('0xe')],function(_0x4048bf){return{'model':db[_0x4048bf[_0x8598('0xf')]],'as':_0x4048bf['as'],'attributes':_0x4048bf[_0x8598('0xc')],'include':_0x4048bf['include']?_[_0x8598('0x10')](_0x4048bf[_0x8598('0xe')],function(_0x2c93d7){return{'model':db[_0x2c93d7['model']],'as':_0x2c93d7['as'],'attributes':_0x2c93d7[_0x8598('0xc')]};}):[]};}):[]};}):[]:[]})[_0x8598('0x11')](function(_0x5e6c81){logger[_0x8598('0x12')](_0x8598('0x6'),_0x2ed841);logger[_0x8598('0x13')](_0x8598('0x6'),_0x2ed841,JSON[_0x8598('0x14')](_0x5e6c81));_0x336848(_0x5e6c81);})['catch'](function(_0x3a8b29){logger[_0x8598('0x15')]('GetInterval',_0x3a8b29[_0x8598('0x16')],_0x2ed841);_0x41d4d2(_0x56eee6[_0x8598('0x15')](0x1f4,_0x3a8b29[_0x8598('0x16')]));});});};exports[_0x8598('0x17')]=function(_0x5557f0){var _0x363c08=this;return new Promise(function(_0xb49ecd,_0x1319b0){return db['Interval'][_0x8598('0x18')]({'raw':_0x5557f0['options']?_0x5557f0['options']['raw']===undefined?!![]:![]:!![],'where':_0x5557f0[_0x8598('0x9')]?_0x5557f0[_0x8598('0x9')][_0x8598('0xb')]||null:null,'attributes':_0x5557f0[_0x8598('0x9')]?_0x5557f0[_0x8598('0x9')][_0x8598('0xc')]||null:null,'include':_0x5557f0[_0x8598('0x9')]?_0x5557f0[_0x8598('0x9')][_0x8598('0xe')]?_[_0x8598('0x10')](_0x5557f0['options']['include'],function(_0x140912){return{'model':db[_0x140912[_0x8598('0xf')]],'as':_0x140912['as'],'attributes':_0x140912['attributes'],'include':_0x140912[_0x8598('0xe')]?_[_0x8598('0x10')](_0x140912[_0x8598('0xe')],function(_0x438941){return{'model':db[_0x438941[_0x8598('0xf')]],'as':_0x438941['as'],'attributes':_0x438941[_0x8598('0xc')],'include':_0x438941[_0x8598('0xe')]?_[_0x8598('0x10')](_0x438941[_0x8598('0xe')],function(_0x3fb3f3){return{'model':db[_0x3fb3f3[_0x8598('0xf')]],'as':_0x3fb3f3['as'],'attributes':_0x3fb3f3[_0x8598('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28fedd){logger['info'](_0x8598('0x17'),_0x5557f0);logger[_0x8598('0x13')](_0x8598('0x17'),_0x5557f0,JSON[_0x8598('0x14')](_0x28fedd));_0xb49ecd(_0x28fedd);})['catch'](function(_0x57da5b){logger[_0x8598('0x15')]('ShowInterval',_0x57da5b[_0x8598('0x16')],_0x5557f0);_0x1319b0(_0x363c08[_0x8598('0x15')](0x1f4,_0x57da5b[_0x8598('0x16')]));});});};function checkArrayOfIntervals(_0x4bd78e,_0x193e41){var _0x16640f=[];return db[_0x8598('0x7')][_0x8598('0x8')]({'where':{'id':_0x4bd78e}})[_0x8598('0x11')](function(_0x4a317d){_0x16640f=_0x4a317d;return Promise[_0x8598('0x19')](_0x16640f[_0x8598('0x10')](function(_0x562229){return _0x562229[_0x8598('0x1a')](_0x193e41);}));})[_0x8598('0x11')](function(_0xcaa4e5){var _0x128076=_0xcaa4e5[_0x8598('0x1b')](function(_0x236c5d,_0xad551c){return _0x236c5d||_0xad551c;},![]);logger[_0x8598('0x12')](util[_0x8598('0x1c')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x16640f['map'](function(_0x3c9fd0){return _0x3c9fd0[_0x8598('0x1d')];})[_0x8598('0x1e')](',\x20'),_0x16640f[_0x8598('0x10')](function(_0x1f2221){return _0x1f2221['id'];})[_0x8598('0x1e')](',\x20')));return _0x128076;});}function checkSingleInterval(_0x3614de,_0x59fed3){return db[_0x8598('0x7')]['findById'](_0x3614de)[_0x8598('0x11')](function(_0x44fda7){if(_0x44fda7){logger[_0x8598('0x12')](util[_0x8598('0x1c')](_0x8598('0x1f'),_0x44fda7[_0x8598('0x1d')],_0x44fda7['id']));return _0x44fda7['ifTime'](_0x59fed3);}});}exports[_0x8598('0x20')]=function(_0x14be44){var _0x51398a=_0x14be44['intervalIds'];var _0x322252=Array[_0x8598('0x21')](_0x14be44[_0x8598('0x22')])?_0x14be44[_0x8598('0x22')]:typeof _0x14be44[_0x8598('0x22')]===_0x8598('0x23')?[_0x14be44[_0x8598('0x22')]]:[];var _0x4c63be=_0x14be44[_0x8598('0x24')]||undefined;var _0x13ddc5=![];if(_0x322252[_0x8598('0x25')]){logger[_0x8598('0x12')](util[_0x8598('0x1c')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x322252['join'](';\x20')));}if(_0x4c63be){logger[_0x8598('0x12')](util['format']('IntervalIftime:\x20timezone\x20=\x20%s',_0x4c63be));}logger[_0x8598('0x13')](_0x8598('0x26'),_0x13ddc5);logger[_0x8598('0x27')]('IntervalIftime',_0x14be44);return Promise[_0x8598('0x28')]()[_0x8598('0x11')](function(){if(Array[_0x8598('0x21')](_0x51398a)){return checkArrayOfIntervals(_0x51398a,_0x4c63be);}else if(_0x51398a){return checkSingleInterval(_0x51398a,_0x4c63be);}})[_0x8598('0x11')](function(_0x28629f){var _0x312177=_0x322252[_0x8598('0x1b')](function(_0x5d0e9f,_0x4dde8c){return _0x5d0e9f||iftime(_0x4dde8c,_0x4c63be);},![]);_0x13ddc5=_0x28629f||_0x312177;return _0x13ddc5;})[_0x8598('0x29')](function(_0x123295){logger['error'](_0x8598('0x20'),_0x14be44,_0x123295);throw this[_0x8598('0x15')](0x1f4,_0x123295['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 50d1a85..5e20a77 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 _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b6a01,_0x386039){_0x4b6a01=_0x4b6a01-0x0;var _0xc374a3=_0xb10b[_0x4b6a01];return _0xc374a3;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x0b0e,0x187));var _0xe0b0=function(_0x463697,_0xccfdc4){_0x463697=_0x463697-0x0;var _0x33cfe1=_0x0b0e[_0x463697];return _0x33cfe1;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 3557ac6..e275dfa 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 _0x3072=['customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','base64','request','setEncoding','utf8','end','status','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','body','headers','x-forwarded-for','remoteAddress','connection','socket','bluebird','https','../../config/logger','api','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','description','stringify','fields','customfield_11500','customfield_11501','customfield_11502','newToken','customfield_11503','customfield_11504','reason'];(function(_0x19072f,_0x5f59de){var _0x2c9ea6=function(_0x4b8c2b){while(--_0x4b8c2b){_0x19072f['push'](_0x19072f['shift']());}};_0x2c9ea6(++_0x5f59de);}(_0x3072,0x10c));var _0x2307=function(_0x25c609,_0x350804){_0x25c609=_0x25c609-0x0;var _0xc01df=_0x3072[_0x25c609];return _0xc01df;};'use strict';var BPromise=require(_0x2307('0x0'));var https=require(_0x2307('0x1'));var logger=require(_0x2307('0x2'))(_0x2307('0x3'));var USERNAME='support';var PASSWORD=_0x2307('0x4');function openIssue(_0x1a53d1,_0x52c8ab){var _0x4110b1={'fields':{'project':{'key':_0x1a53d1['key']||_0x2307('0x5')},'summary':(_0x1a53d1[_0x2307('0x6')]||_0x2307('0x7'))+_0x2307('0x8')+_0x1a53d1['ip'],'description':_0x1a53d1[_0x2307('0x9')]||JSON[_0x2307('0xa')](_0x1a53d1),'issuetype':{'name':_0x1a53d1['issuetype']||'Bug'}}};_0x4110b1[_0x2307('0xb')][_0x2307('0xc')]=_0x1a53d1['email'];_0x4110b1[_0x2307('0xb')][_0x2307('0xd')]=_0x1a53d1['oldToken'];_0x4110b1[_0x2307('0xb')][_0x2307('0xe')]=_0x1a53d1[_0x2307('0xf')];_0x4110b1['fields'][_0x2307('0x10')]=_0x1a53d1['name'];_0x4110b1[_0x2307('0xb')][_0x2307('0x11')]=_0x1a53d1[_0x2307('0x12')];_0x4110b1[_0x2307('0xb')][_0x2307('0x13')]=_0x1a53d1['ip'];var _0x4d3487={'host':_0x2307('0x14'),'port':0x1bb,'path':_0x2307('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x2307('0x16'),'Authorization':_0x2307('0x17')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x2307('0x18'))}};var _0x579e46=JSON['stringify'](_0x4110b1);var _0x3d77c0=https[_0x2307('0x19')](_0x4d3487,function(_0x35d25f){_0x35d25f[_0x2307('0x1a')](_0x2307('0x1b'));var _0x41beca='';_0x35d25f['on']('data',function(_0x57001b){_0x41beca+=_0x57001b;});_0x35d25f['on'](_0x2307('0x1c'),function(){if(_0x52c8ab){return _0x52c8ab[_0x2307('0x1d')](_0x35d25f['statusCode'])[_0x2307('0x1e')](JSON['parse'](_0x41beca));}});});_0x3d77c0['on'](_0x2307('0x1f'),function(_0x7c5c2f){if(_0x52c8ab){return _0x52c8ab[_0x2307('0x1d')](0x1f4)[_0x2307('0x1e')]({'errors':[{'message':_0x2307('0x20'),'type':'api.jira'}]});}});_0x3d77c0[_0x2307('0x21')](_0x579e46);_0x3d77c0[_0x2307('0x1c')]();}exports[_0x2307('0x22')]=openIssue;exports['send']=function(_0x53b369,_0x3f20c7){_0x53b369[_0x2307('0x23')]['ip']=_0x53b369[_0x2307('0x24')][_0x2307('0x25')]||_0x53b369['connection'][_0x2307('0x26')]||_0x53b369['socket'][_0x2307('0x26')]||_0x53b369[_0x2307('0x27')][_0x2307('0x28')][_0x2307('0x26')];return openIssue(_0x53b369[_0x2307('0x23')],_0x3f20c7);}; \ No newline at end of file +var _0x895b=['issuetype','Bug','fields','customfield_11500','oldToken','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','toString','base64','request','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','connection','remoteAddress','socket','bluebird','https','api','3eAmWpBVP0','\x20from\x20','stringify'];(function(_0x2ebae1,_0x58acde){var _0x26eebb=function(_0x2b0c09){while(--_0x2b0c09){_0x2ebae1['push'](_0x2ebae1['shift']());}};_0x26eebb(++_0x58acde);}(_0x895b,0x16c));var _0xb895=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x895b[_0x3b380d];return _0x54502b;};'use strict';var BPromise=require(_0xb895('0x0'));var https=require(_0xb895('0x1'));var logger=require('../../config/logger')(_0xb895('0x2'));var USERNAME='support';var PASSWORD=_0xb895('0x3');function openIssue(_0x22a9e2,_0xf0c95f){var _0x2c2bf6={'fields':{'project':{'key':_0x22a9e2['key']||'MOTGUI'},'summary':(_0x22a9e2['summary']||'Report')+_0xb895('0x4')+_0x22a9e2['ip'],'description':_0x22a9e2['description']||JSON[_0xb895('0x5')](_0x22a9e2),'issuetype':{'name':_0x22a9e2[_0xb895('0x6')]||_0xb895('0x7')}}};_0x2c2bf6[_0xb895('0x8')][_0xb895('0x9')]=_0x22a9e2['email'];_0x2c2bf6[_0xb895('0x8')]['customfield_11501']=_0x22a9e2[_0xb895('0xa')];_0x2c2bf6[_0xb895('0x8')][_0xb895('0xb')]=_0x22a9e2[_0xb895('0xc')];_0x2c2bf6[_0xb895('0x8')][_0xb895('0xd')]=_0x22a9e2[_0xb895('0xe')];_0x2c2bf6['fields']['customfield_11504']=_0x22a9e2[_0xb895('0xf')];_0x2c2bf6[_0xb895('0x8')][_0xb895('0x10')]=_0x22a9e2['ip'];var _0x20a942={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xb895('0x11')](_0xb895('0x12'))}};var _0x1fe599=JSON['stringify'](_0x2c2bf6);var _0x5b31a8=https[_0xb895('0x13')](_0x20a942,function(_0x35df8c){_0x35df8c['setEncoding'](_0xb895('0x14'));var _0x5c422a='';_0x35df8c['on'](_0xb895('0x15'),function(_0x1b4c57){_0x5c422a+=_0x1b4c57;});_0x35df8c['on'](_0xb895('0x16'),function(){if(_0xf0c95f){return _0xf0c95f[_0xb895('0x17')](_0x35df8c[_0xb895('0x18')])[_0xb895('0x19')](JSON[_0xb895('0x1a')](_0x5c422a));}});});_0x5b31a8['on'](_0xb895('0x1b'),function(_0x4a1772){if(_0xf0c95f){return _0xf0c95f[_0xb895('0x17')](0x1f4)[_0xb895('0x19')]({'errors':[{'message':_0xb895('0x1c'),'type':'api.jira'}]});}});_0x5b31a8[_0xb895('0x1d')](_0x1fe599);_0x5b31a8[_0xb895('0x16')]();}exports[_0xb895('0x1e')]=openIssue;exports[_0xb895('0x1f')]=function(_0x12a309,_0x33bd8b){_0x12a309[_0xb895('0x20')]['ip']=_0x12a309[_0xb895('0x21')]['x-forwarded-for']||_0x12a309[_0xb895('0x22')]['remoteAddress']||_0x12a309['socket'][_0xb895('0x23')]||_0x12a309[_0xb895('0x22')][_0xb895('0x24')][_0xb895('0x23')];return openIssue(_0x12a309['body'],_0x33bd8b);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 14b450d..6ac5eb2 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 _0xb58b=['get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./jscriptyAnswerReport.controller'];(function(_0x26111f,_0x43bce2){var _0x54c75a=function(_0x589a0a){while(--_0x589a0a){_0x26111f['push'](_0x26111f['shift']());}};_0x54c75a(++_0x43bce2);}(_0xb58b,0x1f1));var _0xbb58=function(_0x54153b,_0x452448){_0x54153b=_0x54153b-0x0;var _0x2a3ea6=_0xb58b[_0x54153b];return _0x2a3ea6;};'use strict';var multer=require('multer');var util=require(_0xbb58('0x0'));var path=require(_0xbb58('0x1'));var timeout=require(_0xbb58('0x2'));var express=require('express');var router=express[_0xbb58('0x3')]();var fs_extra=require(_0xbb58('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbb58('0x5'));var config=require('../../config/environment');var controller=require(_0xbb58('0x6'));router[_0xbb58('0x7')]('/',auth[_0xbb58('0x8')](),controller['index']);router[_0xbb58('0x7')](_0xbb58('0x9'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xa')]);router[_0xbb58('0x7')](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xc')]);router[_0xbb58('0xd')]('/',auth[_0xbb58('0x8')](),controller[_0xbb58('0xe')]);router['put'](_0xbb58('0xb'),auth['isAuthenticated'](),controller[_0xbb58('0xf')]);router[_0xbb58('0x10')](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller['destroy']);module[_0xbb58('0x11')]=router; \ No newline at end of file +var _0x70e0=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','describe','get','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x558c79,_0x29ebdc){var _0x163eb8=function(_0x59088){while(--_0x59088){_0x558c79['push'](_0x558c79['shift']());}};_0x163eb8(++_0x29ebdc);}(_0x70e0,0x17b));var _0x070e=function(_0x2cd17d,_0x2bfcb8){_0x2cd17d=_0x2cd17d-0x0;var _0xa2e15a=_0x70e0[_0x2cd17d];return _0xa2e15a;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x070e('0xe')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x11')]);module[_0x070e('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 3eca32f..9d855dd 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(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x7a54,0x106));var _0x47a5=function(_0x4d8035,_0x2d863c){_0x4d8035=_0x4d8035-0x0;var _0x25adaa=_0x7a54[_0x4d8035];return _0x25adaa;};'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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7a54,0x106));var _0x47a5=function(_0x34c510,_0x21e367){_0x34c510=_0x34c510-0x0;var _0xa1fbf4=_0x7a54[_0x34c510];return _0xa1fbf4;};'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 cba2e59..14540e4 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 _0x093a=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','JscriptyAnswerReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x26af0b,_0x2128b2){var _0x8a888f=function(_0x4447a2){while(--_0x4447a2){_0x26af0b['push'](_0x26af0b['shift']());}};_0x8a888f(++_0x2128b2);}(_0x093a,0x16a));var _0xa093=function(_0x51c52b,_0x147712){_0x51c52b=_0x51c52b-0x0;var _0x581ce3=_0x093a[_0x51c52b];return _0x581ce3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa093('0x0'));var zipdir=require(_0xa093('0x1'));var jsonpatch=require(_0xa093('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa093('0x3'));var Mustache=require(_0xa093('0x4'));var util=require(_0xa093('0x5'));var path=require(_0xa093('0x6'));var sox=require(_0xa093('0x7'));var csv=require(_0xa093('0x8'));var ejs=require(_0xa093('0x9'));var fs=require('fs');var fs_extra=require(_0xa093('0xa'));var _=require(_0xa093('0xb'));var squel=require(_0xa093('0xc'));var crypto=require(_0xa093('0xd'));var jsforce=require(_0xa093('0xe'));var deskjs=require(_0xa093('0xf'));var toCsv=require(_0xa093('0x8'));var querystring=require(_0xa093('0x10'));var Papa=require(_0xa093('0x11'));var Redis=require(_0xa093('0x12'));var authService=require(_0xa093('0x13'));var qs=require(_0xa093('0x14'));var as=require(_0xa093('0x15'));var hardwareService=require(_0xa093('0x16'));var logger=require('../../config/logger')(_0xa093('0x17'));var utils=require(_0xa093('0x18'));var config=require(_0xa093('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa093('0x1a'))['db'];function respondWithStatusCode(_0x37b045,_0x306405){_0x306405=_0x306405||0xcc;return function(_0x33b118){if(_0x33b118){return _0x37b045[_0xa093('0x1b')](_0x306405);}return _0x37b045[_0xa093('0x1c')](_0x306405)[_0xa093('0x1d')]();};}function respondWithResult(_0x5b7b2c,_0x108037){_0x108037=_0x108037||0xc8;return function(_0x56fc96){if(_0x56fc96){return _0x5b7b2c[_0xa093('0x1c')](_0x108037)[_0xa093('0x1e')](_0x56fc96);}};}function respondWithFilteredResult(_0x45005f,_0x2f8e67){return function(_0x8245d8){if(_0x8245d8){var _0x26ac40=typeof _0x2f8e67[_0xa093('0x1f')]===_0xa093('0x20')&&typeof _0x2f8e67['limit']===_0xa093('0x20');var _0x226d1e=_0x8245d8[_0xa093('0x21')];var _0x30782c=_0x26ac40?0x0:_0x2f8e67[_0xa093('0x1f')];var _0x3b63db=_0x26ac40?_0x8245d8[_0xa093('0x21')]:_0x2f8e67['offset']+_0x2f8e67[_0xa093('0x22')];var _0x4bcb2a;if(_0x3b63db>=_0x226d1e){_0x3b63db=_0x226d1e;_0x4bcb2a=0xc8;}else{_0x4bcb2a=0xce;}_0x45005f[_0xa093('0x1c')](_0x4bcb2a);return _0x45005f['set'](_0xa093('0x23'),_0x30782c+'-'+_0x3b63db+'/'+_0x226d1e)[_0xa093('0x1e')](_0x8245d8);}return null;};}function patchUpdates(_0x4b1a16){return function(_0x3841c8){try{jsonpatch[_0xa093('0x24')](_0x3841c8,_0x4b1a16,!![]);}catch(_0x93f81a){return BPromise[_0xa093('0x25')](_0x93f81a);}return _0x3841c8[_0xa093('0x26')]();};}function saveUpdates(_0x4b61c2,_0x2fa9ca){return function(_0x57125e){if(_0x57125e){return _0x57125e[_0xa093('0x27')](_0x4b61c2)['then'](function(_0x38d68a){return _0x38d68a;});}return null;};}function removeEntity(_0x329847,_0x2e909d){return function(_0x3aeb7f){if(_0x3aeb7f){return _0x3aeb7f[_0xa093('0x28')]()[_0xa093('0x29')](function(){_0x329847[_0xa093('0x1c')](0xcc)[_0xa093('0x1d')]();});}};}function handleEntityNotFound(_0x302f21,_0x536311){return function(_0xd20fd){if(!_0xd20fd){_0x302f21[_0xa093('0x1b')](0x194);}return _0xd20fd;};}function handleError(_0x1f9506,_0x36fd8f){_0x36fd8f=_0x36fd8f||0x1f4;return function(_0x31909b){logger[_0xa093('0x2a')](_0x31909b[_0xa093('0x2b')]);if(_0x31909b[_0xa093('0x2c')]){delete _0x31909b[_0xa093('0x2c')];}_0x1f9506[_0xa093('0x1c')](_0x36fd8f)['send'](_0x31909b);};}exports[_0xa093('0x2d')]=function(_0x1b9148,_0x2d0e05){var _0x238904={},_0xdae8ec={},_0x4cc949={'count':0x0,'rows':[]};var _0x507f20=_[_0xa093('0x2e')](db[_0xa093('0x2f')][_0xa093('0x30')],function(_0x1bfe1a){return{'name':_0x1bfe1a['fieldName'],'type':_0x1bfe1a['type']['key']};});_0xdae8ec[_0xa093('0x31')]=_['map'](_0x507f20,_0xa093('0x2c'));_0xdae8ec[_0xa093('0x32')]=_[_0xa093('0x33')](_0x1b9148['query']);_0xdae8ec[_0xa093('0x34')]=_[_0xa093('0x35')](_0xdae8ec[_0xa093('0x31')],_0xdae8ec[_0xa093('0x32')]);_0x238904[_0xa093('0x36')]=_[_0xa093('0x35')](_0xdae8ec[_0xa093('0x31')],qs[_0xa093('0x37')](_0x1b9148[_0xa093('0x32')][_0xa093('0x37')]));_0x238904[_0xa093('0x36')]=_0x238904[_0xa093('0x36')]['length']?_0x238904[_0xa093('0x36')]:_0xdae8ec['model'];if(!_0x1b9148[_0xa093('0x32')][_0xa093('0x38')](_0xa093('0x39'))){_0x238904[_0xa093('0x22')]=qs['limit'](_0x1b9148[_0xa093('0x32')]['limit']);_0x238904[_0xa093('0x1f')]=qs[_0xa093('0x1f')](_0x1b9148[_0xa093('0x32')][_0xa093('0x1f')]);}_0x238904[_0xa093('0x3a')]=qs['sort'](_0x1b9148[_0xa093('0x32')]['sort']);_0x238904[_0xa093('0x3b')]=qs['filters'](_['pick'](_0x1b9148[_0xa093('0x32')],_0xdae8ec[_0xa093('0x34')]),_0x507f20);if(_0x1b9148['query'][_0xa093('0x3c')]){_0x238904[_0xa093('0x3b')]=_['merge'](_0x238904[_0xa093('0x3b')],{'$or':_['map'](_0x507f20,function(_0x158a7b){if(_0x158a7b[_0xa093('0x3d')]!==_0xa093('0x3e')){var _0x4acb9b={};_0x4acb9b[_0x158a7b['name']]={'$like':'%'+_0x1b9148[_0xa093('0x32')][_0xa093('0x3c')]+'%'};return _0x4acb9b;}})});}_0x238904=_[_0xa093('0x3f')]({},_0x238904,_0x1b9148[_0xa093('0x40')]);var _0x425cdf={'where':_0x238904[_0xa093('0x3b')]};return db[_0xa093('0x2f')][_0xa093('0x21')](_0x425cdf)['then'](function(_0xe3e89b){_0x4cc949['count']=_0xe3e89b;if(_0x1b9148[_0xa093('0x32')][_0xa093('0x41')]){_0x238904[_0xa093('0x42')]=[{'all':!![]}];}return db[_0xa093('0x2f')][_0xa093('0x43')](_0x238904);})['then'](function(_0x2f5f07){_0x4cc949[_0xa093('0x44')]=_0x2f5f07;return _0x4cc949;})['then'](respondWithFilteredResult(_0x2d0e05,_0x238904))[_0xa093('0x45')](handleError(_0x2d0e05,null));};exports[_0xa093('0x46')]=function(_0x1f73eb,_0x3303da){var _0x58c10e={'raw':!![],'where':{'id':_0x1f73eb[_0xa093('0x47')]['id']}},_0x4205f8={};_0x4205f8[_0xa093('0x31')]=_[_0xa093('0x33')](db[_0xa093('0x2f')]['rawAttributes']);_0x4205f8[_0xa093('0x32')]=_[_0xa093('0x33')](_0x1f73eb[_0xa093('0x32')]);_0x4205f8[_0xa093('0x34')]=_['intersection'](_0x4205f8[_0xa093('0x31')],_0x4205f8[_0xa093('0x32')]);_0x58c10e[_0xa093('0x36')]=_[_0xa093('0x35')](_0x4205f8[_0xa093('0x31')],qs[_0xa093('0x37')](_0x1f73eb[_0xa093('0x32')][_0xa093('0x37')]));_0x58c10e[_0xa093('0x36')]=_0x58c10e[_0xa093('0x36')]['length']?_0x58c10e['attributes']:_0x4205f8[_0xa093('0x31')];if(_0x1f73eb[_0xa093('0x32')][_0xa093('0x41')]){_0x58c10e[_0xa093('0x42')]=[{'all':!![]}];}_0x58c10e=_[_0xa093('0x3f')]({},_0x58c10e,_0x1f73eb[_0xa093('0x40')]);return db[_0xa093('0x2f')][_0xa093('0x48')](_0x58c10e)[_0xa093('0x29')](handleEntityNotFound(_0x3303da,null))[_0xa093('0x29')](respondWithResult(_0x3303da,null))[_0xa093('0x45')](handleError(_0x3303da,null));};exports[_0xa093('0x49')]=function(_0x436c5c,_0x295c21){return db[_0xa093('0x2f')]['create'](_0x436c5c['body'],{})['then'](respondWithResult(_0x295c21,0xc9))[_0xa093('0x45')](handleError(_0x295c21,null));};exports[_0xa093('0x27')]=function(_0x36fb5a,_0x2fefaf){if(_0x36fb5a[_0xa093('0x4a')]['id']){delete _0x36fb5a[_0xa093('0x4a')]['id'];}return db[_0xa093('0x2f')][_0xa093('0x48')]({'where':{'id':_0x36fb5a['params']['id']}})[_0xa093('0x29')](handleEntityNotFound(_0x2fefaf,null))[_0xa093('0x29')](saveUpdates(_0x36fb5a[_0xa093('0x4a')],null))['then'](respondWithResult(_0x2fefaf,null))[_0xa093('0x45')](handleError(_0x2fefaf,null));};exports['destroy']=function(_0x5e567f,_0x21b83f){return db[_0xa093('0x2f')]['find']({'where':{'id':_0x5e567f[_0xa093('0x47')]['id']}})['then'](handleEntityNotFound(_0x21b83f,null))[_0xa093('0x29')](removeEntity(_0x21b83f,null))[_0xa093('0x45')](handleError(_0x21b83f,null));};exports[_0xa093('0x4b')]=function(_0xd88868,_0x142ef0){return db[_0xa093('0x2f')][_0xa093('0x4b')]()[_0xa093('0x29')](respondWithResult(_0x142ef0,null))[_0xa093('0x45')](handleError(_0x142ef0,null));}; \ No newline at end of file +var _0x539d=['squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','filters','attributes','intersection','fields','query','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptyAnswerReport','include','findAll','rows','catch','show','includeAll','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash'];(function(_0x36c270,_0x2569ff){var _0x276c73=function(_0x27ea41){while(--_0x27ea41){_0x36c270['push'](_0x36c270['shift']());}};_0x276c73(++_0x2569ff);}(_0x539d,0x17b));var _0xd539=function(_0x137da3,_0xa6277a){_0x137da3=_0x137da3-0x0;var _0x1ac46c=_0x539d[_0x137da3];return _0x1ac46c;};'use strict';var emlformat=require(_0xd539('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd539('0x1'));var jsonpatch=require(_0xd539('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd539('0x3'));var Mustache=require(_0xd539('0x4'));var util=require(_0xd539('0x5'));var path=require(_0xd539('0x6'));var sox=require(_0xd539('0x7'));var csv=require('to-csv');var ejs=require(_0xd539('0x8'));var fs=require('fs');var fs_extra=require(_0xd539('0x9'));var _=require(_0xd539('0xa'));var squel=require(_0xd539('0xb'));var crypto=require(_0xd539('0xc'));var jsforce=require(_0xd539('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd539('0xe'));var querystring=require(_0xd539('0xf'));var Papa=require(_0xd539('0x10'));var Redis=require(_0xd539('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd539('0x12'));var hardwareService=require(_0xd539('0x13'));var logger=require(_0xd539('0x14'))(_0xd539('0x15'));var utils=require(_0xd539('0x16'));var config=require(_0xd539('0x17'));var licenseUtil=require(_0xd539('0x18'));var db=require(_0xd539('0x19'))['db'];function respondWithStatusCode(_0x5209f2,_0x17cbc0){_0x17cbc0=_0x17cbc0||0xcc;return function(_0x1a4645){if(_0x1a4645){return _0x5209f2[_0xd539('0x1a')](_0x17cbc0);}return _0x5209f2[_0xd539('0x1b')](_0x17cbc0)[_0xd539('0x1c')]();};}function respondWithResult(_0xac445e,_0x54706f){_0x54706f=_0x54706f||0xc8;return function(_0x278f49){if(_0x278f49){return _0xac445e[_0xd539('0x1b')](_0x54706f)[_0xd539('0x1d')](_0x278f49);}};}function respondWithFilteredResult(_0x3f402e,_0x23bce1){return function(_0x7b2b41){if(_0x7b2b41){var _0x30aea1=typeof _0x23bce1[_0xd539('0x1e')]===_0xd539('0x1f')&&typeof _0x23bce1[_0xd539('0x20')]===_0xd539('0x1f');var _0x54d8ff=_0x7b2b41[_0xd539('0x21')];var _0x41fb1e=_0x30aea1?0x0:_0x23bce1[_0xd539('0x1e')];var _0x99327a=_0x30aea1?_0x7b2b41[_0xd539('0x21')]:_0x23bce1[_0xd539('0x1e')]+_0x23bce1[_0xd539('0x20')];var _0x1714cf;if(_0x99327a>=_0x54d8ff){_0x99327a=_0x54d8ff;_0x1714cf=0xc8;}else{_0x1714cf=0xce;}_0x3f402e['status'](_0x1714cf);return _0x3f402e['set'](_0xd539('0x22'),_0x41fb1e+'-'+_0x99327a+'/'+_0x54d8ff)[_0xd539('0x1d')](_0x7b2b41);}return null;};}function patchUpdates(_0x3edf97){return function(_0xad186e){try{jsonpatch['apply'](_0xad186e,_0x3edf97,!![]);}catch(_0x91917b){return BPromise[_0xd539('0x23')](_0x91917b);}return _0xad186e[_0xd539('0x24')]();};}function saveUpdates(_0x259dde,_0x11c993){return function(_0x13445e){if(_0x13445e){return _0x13445e[_0xd539('0x25')](_0x259dde)[_0xd539('0x26')](function(_0x349610){return _0x349610;});}return null;};}function removeEntity(_0x56c100,_0x28d376){return function(_0x57789d){if(_0x57789d){return _0x57789d[_0xd539('0x27')]()['then'](function(){_0x56c100['status'](0xcc)[_0xd539('0x1c')]();});}};}function handleEntityNotFound(_0xfd3352,_0x1280c2){return function(_0xc1789e){if(!_0xc1789e){_0xfd3352['sendStatus'](0x194);}return _0xc1789e;};}function handleError(_0x39cef1,_0x495161){_0x495161=_0x495161||0x1f4;return function(_0x1343de){logger[_0xd539('0x28')](_0x1343de[_0xd539('0x29')]);if(_0x1343de[_0xd539('0x2a')]){delete _0x1343de['name'];}_0x39cef1['status'](_0x495161)[_0xd539('0x2b')](_0x1343de);};}exports[_0xd539('0x2c')]=function(_0x4f717b,_0x54b57a){var _0x575b63={},_0xe17d1c={},_0x406710={'count':0x0,'rows':[]};var _0x66b2ab=_[_0xd539('0x2d')](db['JscriptyAnswerReport'][_0xd539('0x2e')],function(_0x2662fe){return{'name':_0x2662fe['fieldName'],'type':_0x2662fe[_0xd539('0x2f')][_0xd539('0x30')]};});_0xe17d1c[_0xd539('0x31')]=_[_0xd539('0x2d')](_0x66b2ab,_0xd539('0x2a'));_0xe17d1c['query']=_[_0xd539('0x32')](_0x4f717b['query']);_0xe17d1c[_0xd539('0x33')]=_['intersection'](_0xe17d1c[_0xd539('0x31')],_0xe17d1c['query']);_0x575b63[_0xd539('0x34')]=_[_0xd539('0x35')](_0xe17d1c[_0xd539('0x31')],qs[_0xd539('0x36')](_0x4f717b[_0xd539('0x37')][_0xd539('0x36')]));_0x575b63[_0xd539('0x34')]=_0x575b63[_0xd539('0x34')][_0xd539('0x38')]?_0x575b63[_0xd539('0x34')]:_0xe17d1c[_0xd539('0x31')];if(!_0x4f717b['query'][_0xd539('0x39')]('nolimit')){_0x575b63[_0xd539('0x20')]=qs[_0xd539('0x20')](_0x4f717b['query'][_0xd539('0x20')]);_0x575b63[_0xd539('0x1e')]=qs['offset'](_0x4f717b['query'][_0xd539('0x1e')]);}_0x575b63[_0xd539('0x3a')]=qs[_0xd539('0x3b')](_0x4f717b[_0xd539('0x37')]['sort']);_0x575b63[_0xd539('0x3c')]=qs[_0xd539('0x33')](_[_0xd539('0x3d')](_0x4f717b[_0xd539('0x37')],_0xe17d1c['filters']),_0x66b2ab);if(_0x4f717b[_0xd539('0x37')][_0xd539('0x3e')]){_0x575b63[_0xd539('0x3c')]=_[_0xd539('0x3f')](_0x575b63[_0xd539('0x3c')],{'$or':_[_0xd539('0x2d')](_0x66b2ab,function(_0x4b5059){if(_0x4b5059['type']!==_0xd539('0x40')){var _0x46eb3f={};_0x46eb3f[_0x4b5059[_0xd539('0x2a')]]={'$like':'%'+_0x4f717b[_0xd539('0x37')]['filter']+'%'};return _0x46eb3f;}})});}_0x575b63=_[_0xd539('0x3f')]({},_0x575b63,_0x4f717b[_0xd539('0x41')]);var _0x14175f={'where':_0x575b63['where']};return db[_0xd539('0x42')]['count'](_0x14175f)[_0xd539('0x26')](function(_0x4b44cf){_0x406710[_0xd539('0x21')]=_0x4b44cf;if(_0x4f717b['query']['includeAll']){_0x575b63[_0xd539('0x43')]=[{'all':!![]}];}return db[_0xd539('0x42')][_0xd539('0x44')](_0x575b63);})[_0xd539('0x26')](function(_0x1917c4){_0x406710[_0xd539('0x45')]=_0x1917c4;return _0x406710;})['then'](respondWithFilteredResult(_0x54b57a,_0x575b63))[_0xd539('0x46')](handleError(_0x54b57a,null));};exports[_0xd539('0x47')]=function(_0x24d43,_0x5d1d2c){var _0x3e9320={'raw':!![],'where':{'id':_0x24d43['params']['id']}},_0x53ea3f={};_0x53ea3f[_0xd539('0x31')]=_[_0xd539('0x32')](db[_0xd539('0x42')][_0xd539('0x2e')]);_0x53ea3f['query']=_[_0xd539('0x32')](_0x24d43[_0xd539('0x37')]);_0x53ea3f[_0xd539('0x33')]=_[_0xd539('0x35')](_0x53ea3f['model'],_0x53ea3f[_0xd539('0x37')]);_0x3e9320[_0xd539('0x34')]=_['intersection'](_0x53ea3f[_0xd539('0x31')],qs[_0xd539('0x36')](_0x24d43[_0xd539('0x37')][_0xd539('0x36')]));_0x3e9320['attributes']=_0x3e9320[_0xd539('0x34')][_0xd539('0x38')]?_0x3e9320[_0xd539('0x34')]:_0x53ea3f[_0xd539('0x31')];if(_0x24d43[_0xd539('0x37')][_0xd539('0x48')]){_0x3e9320[_0xd539('0x43')]=[{'all':!![]}];}_0x3e9320=_[_0xd539('0x3f')]({},_0x3e9320,_0x24d43[_0xd539('0x41')]);return db[_0xd539('0x42')]['find'](_0x3e9320)[_0xd539('0x26')](handleEntityNotFound(_0x5d1d2c,null))[_0xd539('0x26')](respondWithResult(_0x5d1d2c,null))[_0xd539('0x46')](handleError(_0x5d1d2c,null));};exports[_0xd539('0x49')]=function(_0x4f72f7,_0x3c5e1a){return db[_0xd539('0x42')][_0xd539('0x49')](_0x4f72f7[_0xd539('0x4a')],{})[_0xd539('0x26')](respondWithResult(_0x3c5e1a,0xc9))[_0xd539('0x46')](handleError(_0x3c5e1a,null));};exports[_0xd539('0x25')]=function(_0x5e1051,_0x2e47ed){if(_0x5e1051[_0xd539('0x4a')]['id']){delete _0x5e1051[_0xd539('0x4a')]['id'];}return db[_0xd539('0x42')][_0xd539('0x4b')]({'where':{'id':_0x5e1051[_0xd539('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2e47ed,null))[_0xd539('0x26')](saveUpdates(_0x5e1051[_0xd539('0x4a')],null))['then'](respondWithResult(_0x2e47ed,null))['catch'](handleError(_0x2e47ed,null));};exports[_0xd539('0x27')]=function(_0x735b36,_0x5caf42){return db[_0xd539('0x42')][_0xd539('0x4b')]({'where':{'id':_0x735b36[_0xd539('0x4c')]['id']}})[_0xd539('0x26')](handleEntityNotFound(_0x5caf42,null))['then'](removeEntity(_0x5caf42,null))[_0xd539('0x46')](handleError(_0x5caf42,null));};exports[_0xd539('0x4d')]=function(_0x2965df,_0x2b794c){return db['JscriptyAnswerReport'][_0xd539('0x4d')]()[_0xd539('0x26')](respondWithResult(_0x2b794c,null))[_0xd539('0x46')](handleError(_0x2b794c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index e966f90..998513e 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 _0x3ec9=['exports','define','JscriptyAnswerReport','report_jscripty_answers','api','moment','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0xe3051a,_0x39aed2){var _0x46ffca=function(_0x135386){while(--_0x135386){_0xe3051a['push'](_0xe3051a['shift']());}};_0x46ffca(++_0x39aed2);}(_0x3ec9,0x144));var _0x93ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ec9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x93ec('0x0'));var moment=require(_0x93ec('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x93ec('0x2'));var rimraf=require(_0x93ec('0x3'));var config=require(_0x93ec('0x4'));var attributes=require(_0x93ec('0x5'));module[_0x93ec('0x6')]=function(_0x5372f3,_0x4a25ae){return _0x5372f3[_0x93ec('0x7')](_0x93ec('0x8'),attributes,{'tableName':_0x93ec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a39=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','lodash','util','../../config/logger','api'];(function(_0x5d9f94,_0x2ffbad){var _0xfb3575=function(_0x4e463b){while(--_0x4e463b){_0x5d9f94['push'](_0x5d9f94['shift']());}};_0xfb3575(++_0x2ffbad);}(_0x9a39,0x100));var _0x99a3=function(_0xc43438,_0x4c9c47){_0xc43438=_0xc43438-0x0;var _0x36d5fd=_0x9a39[_0xc43438];return _0x36d5fd;};'use strict';var _=require(_0x99a3('0x0'));var util=require(_0x99a3('0x1'));var logger=require(_0x99a3('0x2'))(_0x99a3('0x3'));var moment=require(_0x99a3('0x4'));var BPromise=require(_0x99a3('0x5'));var rp=require(_0x99a3('0x6'));var fs=require('fs');var path=require(_0x99a3('0x7'));var rimraf=require(_0x99a3('0x8'));var config=require(_0x99a3('0x9'));var attributes=require(_0x99a3('0xa'));module[_0x99a3('0xb')]=function(_0xdbdb0d,_0x596233){return _0xdbdb0d['define'](_0x99a3('0xc'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index ab5c99c..cdec591 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 _0x85e6=['message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x85e6,0x1a5));var _0x685e=function(_0x453290,_0x3976a1){_0x453290=_0x453290-0x0;var _0x50bafc=_0x85e6[_0x453290];return _0x50bafc;};'use strict';var _=require(_0x685e('0x0'));var util=require(_0x685e('0x1'));var moment=require('moment');var BPromise=require(_0x685e('0x2'));var rs=require(_0x685e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x685e('0x4'))['db'];var utils=require(_0x685e('0x5'));var logger=require(_0x685e('0x6'))('rpc');var config=require(_0x685e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x685e('0x8')][_0x685e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cde2c,_0x55e0de,_0x2c3767){return new BPromise(function(_0x31543f,_0x3a3035){return client[_0x685e('0xa')](_0x3cde2c,_0x2c3767)[_0x685e('0xb')](function(_0x53c03f){logger[_0x685e('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x55e0de,_0x685e('0xd'));logger['debug'](_0x685e('0xe'),_0x55e0de,_0x685e('0xd'),JSON[_0x685e('0xf')](_0x53c03f));if(_0x53c03f[_0x685e('0x10')]){if(_0x53c03f[_0x685e('0x10')][_0x685e('0x11')]===0x1f4){logger[_0x685e('0x10')](_0x685e('0x12'),_0x55e0de,_0x53c03f[_0x685e('0x10')][_0x685e('0x13')]);return _0x3a3035(_0x53c03f[_0x685e('0x10')][_0x685e('0x13')]);}logger[_0x685e('0x10')](_0x685e('0x12'),_0x55e0de,_0x53c03f[_0x685e('0x10')][_0x685e('0x13')]);return _0x31543f(_0x53c03f['error'][_0x685e('0x13')]);}else{logger[_0x685e('0xc')](_0x685e('0x12'),_0x55e0de,_0x685e('0xd'));_0x31543f(_0x53c03f[_0x685e('0x14')]['message']);}})[_0x685e('0x15')](function(_0x250181){logger[_0x685e('0x10')](_0x685e('0x12'),_0x55e0de,_0x250181);_0x3a3035(_0x250181);});});} \ No newline at end of file +var _0xb255=['request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xb255,0x190));var _0x5b25=function(_0x1ceb07,_0x405a36){_0x1ceb07=_0x1ceb07-0x0;var _0x5e8906=_0xb255[_0x1ceb07];return _0x5e8906;};'use strict';var _=require('lodash');var util=require(_0x5b25('0x0'));var moment=require('moment');var BPromise=require(_0x5b25('0x1'));var rs=require(_0x5b25('0x2'));var fs=require('fs');var Redis=require(_0x5b25('0x3'));var db=require(_0x5b25('0x4'))['db'];var utils=require(_0x5b25('0x5'));var logger=require(_0x5b25('0x6'))(_0x5b25('0x7'));var config=require(_0x5b25('0x8'));var jayson=require(_0x5b25('0x9'));var client=jayson[_0x5b25('0xa')][_0x5b25('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f7663,_0x447fff,_0x5ddf3e){return new BPromise(function(_0x3e1530,_0x468594){return client['request'](_0x3f7663,_0x5ddf3e)[_0x5b25('0xc')](function(_0x1c9671){logger['info'](_0x5b25('0xd'),_0x447fff,_0x5b25('0xe'));logger[_0x5b25('0xf')](_0x5b25('0x10'),_0x447fff,'request\x20sent',JSON[_0x5b25('0x11')](_0x1c9671));if(_0x1c9671['error']){if(_0x1c9671[_0x5b25('0x12')]['code']===0x1f4){logger['error'](_0x5b25('0xd'),_0x447fff,_0x1c9671[_0x5b25('0x12')][_0x5b25('0x13')]);return _0x468594(_0x1c9671[_0x5b25('0x12')][_0x5b25('0x13')]);}logger[_0x5b25('0x12')](_0x5b25('0xd'),_0x447fff,_0x1c9671[_0x5b25('0x12')][_0x5b25('0x13')]);return _0x3e1530(_0x1c9671['error'][_0x5b25('0x13')]);}else{logger[_0x5b25('0x14')](_0x5b25('0xd'),_0x447fff,_0x5b25('0xe'));_0x3e1530(_0x1c9671[_0x5b25('0x15')][_0x5b25('0x13')]);}})[_0x5b25('0x16')](function(_0x46a6d1){logger[_0x5b25('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x447fff,_0x46a6d1);_0x468594(_0x46a6d1);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 8aa76f1..68adf5c 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 _0x8f8f=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id/sessions','/:id/answers','getAnswers','30s','getSummary','post','create','/:id/clone','clone','put','update','delete','/:id','destroy','exports','multer','path'];(function(_0x1596f6,_0x3ab1d2){var _0x33210b=function(_0x48278){while(--_0x48278){_0x1596f6['push'](_0x1596f6['shift']());}};_0x33210b(++_0x3ab1d2);}(_0x8f8f,0x66));var _0xf8f8=function(_0x5247ec,_0x5740ed){_0x5247ec=_0x5247ec-0x0;var _0xd10633=_0x8f8f[_0x5247ec];return _0xd10633;};'use strict';var multer=require(_0xf8f8('0x0'));var util=require('util');var path=require(_0xf8f8('0x1'));var timeout=require(_0xf8f8('0x2'));var express=require(_0xf8f8('0x3'));var router=express['Router']();var fs_extra=require(_0xf8f8('0x4'));var auth=require(_0xf8f8('0x5'));var interaction=require(_0xf8f8('0x6'));var config=require('../../config/environment');var controller=require(_0xf8f8('0x7'));router[_0xf8f8('0x8')]('/',auth[_0xf8f8('0x9')](),controller[_0xf8f8('0xa')]);router[_0xf8f8('0x8')]('/:id',auth[_0xf8f8('0x9')](),controller['show']);router[_0xf8f8('0x8')](_0xf8f8('0xb'),auth[_0xf8f8('0x9')](),controller['getSessions']);router[_0xf8f8('0x8')](_0xf8f8('0xc'),auth['isAuthenticated'](),controller[_0xf8f8('0xd')]);router[_0xf8f8('0x8')]('/:id/summary',auth[_0xf8f8('0x9')](),timeout(_0xf8f8('0xe')),controller[_0xf8f8('0xf')]);router[_0xf8f8('0x10')]('/',auth[_0xf8f8('0x9')](),controller[_0xf8f8('0x11')]);router['post'](_0xf8f8('0x12'),auth[_0xf8f8('0x9')](),controller[_0xf8f8('0x13')]);router[_0xf8f8('0x14')]('/:id',auth[_0xf8f8('0x9')](),controller[_0xf8f8('0x15')]);router[_0xf8f8('0x16')](_0xf8f8('0x17'),auth['isAuthenticated'](),controller[_0xf8f8('0x18')]);module[_0xf8f8('0x19')]=router; \ No newline at end of file +var _0xc3f0=['getSummary','create','post','/:id/clone','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s'];(function(_0x3846b8,_0x18f230){var _0x3c3e98=function(_0x2b7537){while(--_0x2b7537){_0x3846b8['push'](_0x3846b8['shift']());}};_0x3c3e98(++_0x18f230);}(_0xc3f0,0x19c));var _0x0c3f=function(_0x18dc4c,_0x218e38){_0x18dc4c=_0x18dc4c-0x0;var _0x1ed9da=_0xc3f0[_0x18dc4c];return _0x1ed9da;};'use strict';var multer=require(_0x0c3f('0x0'));var util=require(_0x0c3f('0x1'));var path=require('path');var timeout=require(_0x0c3f('0x2'));var express=require(_0x0c3f('0x3'));var router=express[_0x0c3f('0x4')]();var fs_extra=require(_0x0c3f('0x5'));var auth=require(_0x0c3f('0x6'));var interaction=require(_0x0c3f('0x7'));var config=require(_0x0c3f('0x8'));var controller=require(_0x0c3f('0x9'));router[_0x0c3f('0xa')]('/',auth[_0x0c3f('0xb')](),controller[_0x0c3f('0xc')]);router[_0x0c3f('0xa')](_0x0c3f('0xd'),auth[_0x0c3f('0xb')](),controller[_0x0c3f('0xe')]);router[_0x0c3f('0xa')](_0x0c3f('0xf'),auth[_0x0c3f('0xb')](),controller['getSessions']);router['get'](_0x0c3f('0x10'),auth[_0x0c3f('0xb')](),controller[_0x0c3f('0x11')]);router['get'](_0x0c3f('0x12'),auth['isAuthenticated'](),timeout(_0x0c3f('0x13')),controller[_0x0c3f('0x14')]);router['post']('/',auth[_0x0c3f('0xb')](),controller[_0x0c3f('0x15')]);router[_0x0c3f('0x16')](_0x0c3f('0x17'),auth[_0x0c3f('0xb')](),controller['clone']);router['put']('/:id',auth[_0x0c3f('0xb')](),controller[_0x0c3f('0x18')]);router[_0x0c3f('0x19')](_0x0c3f('0xd'),auth[_0x0c3f('0xb')](),controller[_0x0c3f('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 1fda280..cf12136 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 _0x5662=['util','exports','STRING','TEXT','isObjectLike','setDataValue','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','name','BOOLEAN','sequelize','lodash'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5662,0x1d2));var _0x2566=function(_0x1030e8,_0x56bc59){_0x1030e8=_0x1030e8-0x0;var _0x151325=_0x5662[_0x1030e8];return _0x151325;};'use strict';var Sequelize=require(_0x2566('0x0'));var _=require(_0x2566('0x1'));var util=require(_0x2566('0x2'));module[_0x2566('0x3')]={'name':{'type':Sequelize[_0x2566('0x4')],'unique':'name'},'description':{'type':Sequelize[_0x2566('0x4')]},'formData':{'type':Sequelize[_0x2566('0x5')]('long'),'set':function(_0x4bc868){if(_[_0x2566('0x6')](_0x4bc868)){this[_0x2566('0x7')]('formData',JSON['stringify'](_0x4bc868));}else if(_['isString'](_0x4bc868)){this[_0x2566('0x7')]('formData',_0x4bc868);}else{this[_0x2566('0x7')](_0x2566('0x8'),util['format'](_0x2566('0x9'),this['getDataValue'](_0x2566('0xa'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x2566('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x2566('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0x3738=['STRING','name','isObjectLike','setDataValue','isString','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','util','exports'];(function(_0x4c3bae,_0x52722f){var _0x42aaca=function(_0xf68c55){while(--_0xf68c55){_0x4c3bae['push'](_0x4c3bae['shift']());}};_0x42aaca(++_0x52722f);}(_0x3738,0x142));var _0x8373=function(_0x5a8af0,_0x1d82c1){_0x5a8af0=_0x5a8af0-0x0;var _0x1badd6=_0x3738[_0x5a8af0];return _0x1badd6;};'use strict';var Sequelize=require(_0x8373('0x0'));var _=require('lodash');var util=require(_0x8373('0x1'));module[_0x8373('0x2')]={'name':{'type':Sequelize[_0x8373('0x3')],'unique':_0x8373('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x27354b){if(_[_0x8373('0x5')](_0x27354b)){this[_0x8373('0x6')]('formData',JSON['stringify'](_0x27354b));}else if(_[_0x8373('0x7')](_0x27354b)){this[_0x8373('0x6')]('formData',_0x27354b);}else{this[_0x8373('0x6')](_0x8373('0x8'),util['format'](_0x8373('0x9'),this['getDataValue'](_0x8373('0x4'))||'',this[_0x8373('0xa')](_0x8373('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x8373('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 459c88c..c72b67f 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 _0xc931=['rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','getSessions','findOne','order','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','toString','indexOf','replace','startTime','starttime','parse','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','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','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','index','JscriptyProject','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc931,0x19c));var _0x1c93=function(_0x58ba47,_0x5e4443){_0x58ba47=_0x58ba47-0x0;var _0x401a97=_0xc931[_0x58ba47];return _0x401a97;};'use strict';var emlformat=require(_0x1c93('0x0'));var rimraf=require(_0x1c93('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c93('0x2'));var rp=require(_0x1c93('0x3'));var moment=require(_0x1c93('0x4'));var BPromise=require(_0x1c93('0x5'));var Mustache=require(_0x1c93('0x6'));var util=require(_0x1c93('0x7'));var path=require(_0x1c93('0x8'));var sox=require(_0x1c93('0x9'));var csv=require(_0x1c93('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c93('0xb'));var _=require(_0x1c93('0xc'));var squel=require(_0x1c93('0xd'));var crypto=require('crypto');var jsforce=require(_0x1c93('0xe'));var deskjs=require(_0x1c93('0xf'));var toCsv=require(_0x1c93('0xa'));var querystring=require(_0x1c93('0x10'));var Papa=require(_0x1c93('0x11'));var Redis=require(_0x1c93('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1c93('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1c93('0x14'));var config=require(_0x1c93('0x15'));var licenseUtil=require(_0x1c93('0x16'));var db=require(_0x1c93('0x17'))['db'];function respondWithStatusCode(_0x5e32f6,_0xf1627){_0xf1627=_0xf1627||0xcc;return function(_0x17c1e5){if(_0x17c1e5){return _0x5e32f6[_0x1c93('0x18')](_0xf1627);}return _0x5e32f6['status'](_0xf1627)[_0x1c93('0x19')]();};}function respondWithResult(_0x348304,_0x3e9baa){_0x3e9baa=_0x3e9baa||0xc8;return function(_0x3ed773){if(_0x3ed773){return _0x348304[_0x1c93('0x1a')](_0x3e9baa)[_0x1c93('0x1b')](_0x3ed773);}};}function respondWithFilteredResult(_0x16063d,_0x5be810){return function(_0x5b6da3){if(_0x5b6da3){var _0x2f6f2c=typeof _0x5be810[_0x1c93('0x1c')]===_0x1c93('0x1d')&&typeof _0x5be810[_0x1c93('0x1e')]==='undefined';var _0x47907c=_0x5b6da3[_0x1c93('0x1f')];var _0x185286=_0x2f6f2c?0x0:_0x5be810[_0x1c93('0x1c')];var _0x173af4=_0x2f6f2c?_0x5b6da3[_0x1c93('0x1f')]:_0x5be810[_0x1c93('0x1c')]+_0x5be810['limit'];var _0x5baf98;if(_0x173af4>=_0x47907c){_0x173af4=_0x47907c;_0x5baf98=0xc8;}else{_0x5baf98=0xce;}_0x16063d['status'](_0x5baf98);return _0x16063d['set'](_0x1c93('0x20'),_0x185286+'-'+_0x173af4+'/'+_0x47907c)[_0x1c93('0x1b')](_0x5b6da3);}return null;};}function patchUpdates(_0x1bddf9){return function(_0x43f789){try{jsonpatch[_0x1c93('0x21')](_0x43f789,_0x1bddf9,!![]);}catch(_0x2343c3){return BPromise[_0x1c93('0x22')](_0x2343c3);}return _0x43f789[_0x1c93('0x23')]();};}function saveUpdates(_0x14b99b,_0x26c4b2){return function(_0x41db55){if(_0x41db55){return _0x41db55[_0x1c93('0x24')](_0x14b99b)[_0x1c93('0x25')](function(_0x114a1f){return _0x114a1f;});}return null;};}function removeEntity(_0x3a4f57,_0x4bfa0b){return function(_0x41f807){if(_0x41f807){return _0x41f807[_0x1c93('0x26')]()['then'](function(){var _0x18f1ce=_0x41f807[_0x1c93('0x27')]({'plain':!![]});var _0x331885=_0x1c93('0x28');return db[_0x1c93('0x29')][_0x1c93('0x26')]({'where':{'type':_0x331885,'resourceId':_0x18f1ce['id']}})[_0x1c93('0x25')](function(){return _0x41f807;});})[_0x1c93('0x25')](function(){_0x3a4f57[_0x1c93('0x1a')](0xcc)[_0x1c93('0x19')]();});}};}function handleEntityNotFound(_0x58bf08,_0x252ac2){return function(_0x5ca28a){if(!_0x5ca28a){_0x58bf08[_0x1c93('0x18')](0x194);}return _0x5ca28a;};}function handleError(_0x125496,_0x2483f2){_0x2483f2=_0x2483f2||0x1f4;return function(_0x32e0b4){logger[_0x1c93('0x2a')](_0x32e0b4[_0x1c93('0x2b')]);if(_0x32e0b4[_0x1c93('0x2c')]){delete _0x32e0b4['name'];}_0x125496['status'](_0x2483f2)[_0x1c93('0x2d')](_0x32e0b4);};}exports[_0x1c93('0x2e')]=function(_0xb04747,_0x75c42d){var _0x14577e={},_0x400288={},_0x24f573={'count':0x0,'rows':[]};var _0x44f1ad=_['map'](db[_0x1c93('0x2f')][_0x1c93('0x30')],function(_0x49228e){return{'name':_0x49228e[_0x1c93('0x31')],'type':_0x49228e[_0x1c93('0x32')][_0x1c93('0x33')]};});_0x400288['model']=_[_0x1c93('0x34')](_0x44f1ad,_0x1c93('0x2c'));_0x400288[_0x1c93('0x35')]=_[_0x1c93('0x36')](_0xb04747[_0x1c93('0x35')]);_0x400288[_0x1c93('0x37')]=_[_0x1c93('0x38')](_0x400288[_0x1c93('0x39')],_0x400288[_0x1c93('0x35')]);_0x14577e['attributes']=_[_0x1c93('0x38')](_0x400288[_0x1c93('0x39')],qs[_0x1c93('0x3a')](_0xb04747[_0x1c93('0x35')][_0x1c93('0x3a')]));_0x14577e['attributes']=_0x14577e['attributes'][_0x1c93('0x3b')]?_0x14577e[_0x1c93('0x3c')]:_0x400288['model'];if(!_0xb04747[_0x1c93('0x35')][_0x1c93('0x3d')](_0x1c93('0x3e'))){_0x14577e[_0x1c93('0x1e')]=qs[_0x1c93('0x1e')](_0xb04747[_0x1c93('0x35')][_0x1c93('0x1e')]);_0x14577e[_0x1c93('0x1c')]=qs[_0x1c93('0x1c')](_0xb04747['query'][_0x1c93('0x1c')]);}_0x14577e['order']=qs[_0x1c93('0x3f')](_0xb04747[_0x1c93('0x35')]['sort']);_0x14577e[_0x1c93('0x40')]=qs[_0x1c93('0x37')](_[_0x1c93('0x41')](_0xb04747[_0x1c93('0x35')],_0x400288[_0x1c93('0x37')]),_0x44f1ad);if(_0xb04747[_0x1c93('0x35')][_0x1c93('0x42')]){_0x14577e[_0x1c93('0x40')]=_[_0x1c93('0x43')](_0x14577e[_0x1c93('0x40')],{'$or':_[_0x1c93('0x34')](_0x44f1ad,function(_0x3d80d9){if(_0x3d80d9[_0x1c93('0x32')]!=='VIRTUAL'){var _0x2bc381={};_0x2bc381[_0x3d80d9['name']]={'$like':'%'+_0xb04747[_0x1c93('0x35')][_0x1c93('0x42')]+'%'};return _0x2bc381;}})});}_0x14577e=_[_0x1c93('0x43')]({},_0x14577e,_0xb04747[_0x1c93('0x44')]);var _0x1c2f1e={'where':_0x14577e[_0x1c93('0x40')]};return db[_0x1c93('0x2f')][_0x1c93('0x1f')](_0x1c2f1e)[_0x1c93('0x25')](function(_0x1b3344){_0x24f573[_0x1c93('0x1f')]=_0x1b3344;if(_0xb04747[_0x1c93('0x35')][_0x1c93('0x45')]){_0x14577e[_0x1c93('0x46')]=[{'all':!![]}];}return db[_0x1c93('0x2f')][_0x1c93('0x47')](_0x14577e);})[_0x1c93('0x25')](function(_0x3ceb51){_0x24f573[_0x1c93('0x48')]=_0x3ceb51;return _0x24f573;})[_0x1c93('0x25')](respondWithFilteredResult(_0x75c42d,_0x14577e))[_0x1c93('0x49')](handleError(_0x75c42d,null));};exports[_0x1c93('0x4a')]=function(_0x50e242,_0x13ccd2){var _0x3e772c={'raw':![],'where':{'id':_0x50e242[_0x1c93('0x4b')]['id']}},_0x25fa62={};_0x25fa62[_0x1c93('0x39')]=_[_0x1c93('0x36')](db[_0x1c93('0x2f')][_0x1c93('0x30')]);_0x25fa62[_0x1c93('0x35')]=_[_0x1c93('0x36')](_0x50e242['query']);_0x25fa62[_0x1c93('0x37')]=_[_0x1c93('0x38')](_0x25fa62[_0x1c93('0x39')],_0x25fa62['query']);_0x3e772c[_0x1c93('0x3c')]=_[_0x1c93('0x38')](_0x25fa62[_0x1c93('0x39')],qs[_0x1c93('0x3a')](_0x50e242['query']['fields']));_0x3e772c[_0x1c93('0x3c')]=_0x3e772c[_0x1c93('0x3c')]['length']?_0x3e772c[_0x1c93('0x3c')]:_0x25fa62[_0x1c93('0x39')];if(_0x50e242[_0x1c93('0x35')][_0x1c93('0x45')]){_0x3e772c[_0x1c93('0x46')]=[{'all':!![]}];}_0x3e772c=_[_0x1c93('0x43')]({},_0x3e772c,_0x50e242[_0x1c93('0x44')]);return db[_0x1c93('0x2f')][_0x1c93('0x4c')](_0x3e772c)[_0x1c93('0x25')](handleEntityNotFound(_0x13ccd2,null))[_0x1c93('0x25')](respondWithResult(_0x13ccd2,null))['catch'](handleError(_0x13ccd2,null));};exports[_0x1c93('0x4d')]=function(_0x17a960,_0x3d30ec){return db[_0x1c93('0x2f')][_0x1c93('0x4d')](_0x17a960['body'],{})[_0x1c93('0x25')](function(_0x3bf257){var _0x1acc32=_0x17a960[_0x1c93('0x4e')]['get']({'plain':!![]});if(!_0x1acc32)throw new Error(_0x1c93('0x4f'));if(_0x1acc32[_0x1c93('0x50')]===_0x1c93('0x4e')){var _0x1588bf=_0x3bf257['get']({'plain':!![]});var _0x333a41=_0x1c93('0x28');return db[_0x1c93('0x51')][_0x1c93('0x4c')]({'where':{'name':_0x333a41,'userProfileId':_0x1acc32['userProfileId']},'raw':!![]})[_0x1c93('0x25')](function(_0x31a129){if(_0x31a129&&_0x31a129[_0x1c93('0x52')]===0x0){return db[_0x1c93('0x29')][_0x1c93('0x4d')]({'name':_0x1588bf[_0x1c93('0x2c')],'resourceId':_0x1588bf['id'],'type':_0x31a129[_0x1c93('0x2c')],'sectionId':_0x31a129['id']},{})[_0x1c93('0x25')](function(){return _0x3bf257;});}else{return _0x3bf257;}})[_0x1c93('0x49')](function(_0x476247){logger[_0x1c93('0x2a')](_0x1c93('0x53'),_0x476247);throw _0x476247;});}return _0x3bf257;})['then'](respondWithResult(_0x3d30ec,0xc9))['catch'](handleError(_0x3d30ec,null));};exports[_0x1c93('0x54')]=function(_0x36a138,_0x383e5a){var _0xb8fe10={'where':{'id':_0x36a138[_0x1c93('0x4b')]['id']}},_0x480b18={};_0x480b18['model']=_['keys'](db[_0x1c93('0x2f')][_0x1c93('0x30')]);_0xb8fe10[_0x1c93('0x3c')]=_[_0x1c93('0x38')](_0x480b18['model'],qs[_0x1c93('0x3a')](_0x36a138[_0x1c93('0x35')]['fields']));_0xb8fe10[_0x1c93('0x3c')]=_0xb8fe10['attributes'][_0x1c93('0x3b')]?_0xb8fe10['attributes']:_0x480b18[_0x1c93('0x39')];if(_0x36a138[_0x1c93('0x35')][_0x1c93('0x45')]){_0xb8fe10[_0x1c93('0x46')]=[{'all':!![]}];}_0xb8fe10=_[_0x1c93('0x43')]({},_0xb8fe10,_0x36a138[_0x1c93('0x44')]);return db[_0x1c93('0x2f')][_0x1c93('0x4c')](_0xb8fe10)[_0x1c93('0x25')](handleEntityNotFound(_0x383e5a,null))[_0x1c93('0x25')](function(_0x5e45cd){if(_0x5e45cd){var _0x343b75=_0x5e45cd[_0x1c93('0x27')]({'plain':!![]});_0x343b75=qs[_0x1c93('0x55')](_0x343b75,['id',_0x1c93('0x56'),_0x1c93('0x57')]);_0x36a138[_0x1c93('0x58')]=_[_0x1c93('0x55')](_0x36a138[_0x1c93('0x58')],['id',_0x1c93('0x56'),_0x1c93('0x57')]);return db[_0x1c93('0x2f')]['create'](_[_0x1c93('0x43')](_0x343b75,_0x36a138[_0x1c93('0x58')]),{'include':_0x36a138['query'][_0x1c93('0x45')]?[{'all':!![]}]:undefined})[_0x1c93('0x25')](function(_0x5b7d59){var _0x257cef=_0x36a138[_0x1c93('0x4e')][_0x1c93('0x27')]({'plain':!![]});if(!_0x257cef)throw new Error(_0x1c93('0x4f'));if(_0x257cef['role']===_0x1c93('0x4e')){var _0x4b8b8e=_0x5b7d59[_0x1c93('0x27')]({'plain':!![]});var _0x5d9b2e=_0x1c93('0x28');return db[_0x1c93('0x51')][_0x1c93('0x4c')]({'where':{'name':_0x5d9b2e,'userProfileId':_0x257cef['userProfileId']},'raw':!![]})[_0x1c93('0x25')](function(_0x3cdd49){if(_0x3cdd49&&_0x3cdd49[_0x1c93('0x52')]===0x0){return db[_0x1c93('0x29')][_0x1c93('0x4d')]({'name':_0x4b8b8e[_0x1c93('0x2c')],'resourceId':_0x4b8b8e['id'],'type':_0x3cdd49['name'],'sectionId':_0x3cdd49['id']},{})[_0x1c93('0x25')](function(){return _0x5b7d59;});}else{return _0x5b7d59;}})[_0x1c93('0x49')](function(_0x136eee){logger[_0x1c93('0x2a')](_0x1c93('0x53'),_0x136eee);throw _0x136eee;});}return _0x5b7d59;});}})[_0x1c93('0x25')](respondWithResult(_0x383e5a,0xc9))[_0x1c93('0x49')](handleError(_0x383e5a,null));};exports[_0x1c93('0x24')]=function(_0x553333,_0x36c393){if(_0x553333[_0x1c93('0x58')]['id']){delete _0x553333[_0x1c93('0x58')]['id'];}return db['JscriptyProject'][_0x1c93('0x4c')]({'where':{'id':_0x553333['params']['id']}})[_0x1c93('0x25')](handleEntityNotFound(_0x36c393,null))[_0x1c93('0x25')](saveUpdates(_0x553333[_0x1c93('0x58')],null))[_0x1c93('0x25')](respondWithResult(_0x36c393,null))[_0x1c93('0x49')](handleError(_0x36c393,null));};exports[_0x1c93('0x26')]=function(_0x72f8e5,_0x5375b1){return db[_0x1c93('0x2f')][_0x1c93('0x4c')]({'where':{'id':_0x72f8e5[_0x1c93('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5375b1,null))['then'](removeEntity(_0x5375b1,null))[_0x1c93('0x49')](handleError(_0x5375b1,null));};exports[_0x1c93('0x59')]=function(_0x10efe3,_0x2205ba,_0x4099f6){var _0x54f89a={'raw':!![],'where':{}};var _0x20707c={};var _0x39035d={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x1c93('0x5a')]({'where':{'id':_0x10efe3[_0x1c93('0x4b')]['id']}})[_0x1c93('0x25')](handleEntityNotFound(_0x2205ba,null))[_0x1c93('0x25')](function(_0x14e532){if(_0x14e532){_0x20707c[_0x1c93('0x39')]=_['keys'](db['JscriptySessionReport']['rawAttributes']);_0x20707c[_0x1c93('0x35')]=_[_0x1c93('0x36')](_0x10efe3[_0x1c93('0x35')]);_0x20707c['filters']=_[_0x1c93('0x38')](_0x20707c['model'],_0x20707c[_0x1c93('0x35')]);_0x54f89a[_0x1c93('0x3c')]=_[_0x1c93('0x38')](_0x20707c[_0x1c93('0x39')],qs[_0x1c93('0x3a')](_0x10efe3['query'][_0x1c93('0x3a')]));_0x54f89a[_0x1c93('0x3c')]=_0x54f89a[_0x1c93('0x3c')][_0x1c93('0x3b')]?_0x54f89a['attributes']:_0x20707c['model'];if(!_0x10efe3[_0x1c93('0x35')][_0x1c93('0x3d')](_0x1c93('0x3e'))){_0x54f89a['limit']=qs[_0x1c93('0x1e')](_0x10efe3[_0x1c93('0x35')][_0x1c93('0x1e')]);_0x54f89a['offset']=qs[_0x1c93('0x1c')](_0x10efe3[_0x1c93('0x35')][_0x1c93('0x1c')]);}_0x54f89a[_0x1c93('0x5b')]=qs[_0x1c93('0x3f')](_0x10efe3[_0x1c93('0x35')][_0x1c93('0x3f')]);_0x54f89a[_0x1c93('0x40')]=qs[_0x1c93('0x37')](_['pick'](_0x10efe3[_0x1c93('0x35')],_0x20707c[_0x1c93('0x37')]));_0x54f89a['where'][_0x1c93('0x5c')]=_0x14e532['id'];if(_0x10efe3['query'][_0x1c93('0x42')]){_0x54f89a[_0x1c93('0x40')]=_[_0x1c93('0x43')](_0x54f89a[_0x1c93('0x40')],{'$or':_[_0x1c93('0x34')](_0x54f89a[_0x1c93('0x3c')],function(_0x47c092){var _0x39800c={};_0x39800c[_0x47c092]={'$like':'%'+_0x10efe3[_0x1c93('0x35')]['filter']+'%'};return _0x39800c;})});}_0x54f89a=_[_0x1c93('0x43')]({},_0x54f89a,_0x10efe3[_0x1c93('0x44')]);return db[_0x1c93('0x5d')][_0x1c93('0x1f')]({'where':_0x54f89a['where']})[_0x1c93('0x25')](function(_0x3d92a7){_0x39035d[_0x1c93('0x1f')]=_0x3d92a7;if(_0x10efe3[_0x1c93('0x35')][_0x1c93('0x45')]){_0x54f89a[_0x1c93('0x46')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x1c93('0x47')](_0x54f89a);})[_0x1c93('0x25')](function(_0x5f521e){_0x39035d[_0x1c93('0x48')]=_0x5f521e;return _0x39035d;});}})[_0x1c93('0x25')](respondWithFilteredResult(_0x2205ba,_0x54f89a))[_0x1c93('0x49')](handleError(_0x2205ba,null));};exports[_0x1c93('0x5e')]=function(_0x4a863e,_0x1092f6,_0x1e4516){var _0x1b3097={'raw':!![],'where':{}};var _0x36987b={};var _0x1557a0={'count':0x0,'rows':[]};return db[_0x1c93('0x2f')][_0x1c93('0x5a')]({'where':{'id':_0x4a863e[_0x1c93('0x4b')]['id']}})[_0x1c93('0x25')](handleEntityNotFound(_0x1092f6,null))[_0x1c93('0x25')](function(_0x468f69){if(_0x468f69){_0x36987b[_0x1c93('0x39')]=_[_0x1c93('0x36')](db[_0x1c93('0x5f')][_0x1c93('0x30')]);_0x36987b[_0x1c93('0x35')]=_[_0x1c93('0x36')](_0x4a863e['query']);_0x36987b[_0x1c93('0x37')]=_[_0x1c93('0x38')](_0x36987b['model'],_0x36987b[_0x1c93('0x35')]);_0x1b3097[_0x1c93('0x3c')]=_[_0x1c93('0x38')](_0x36987b[_0x1c93('0x39')],qs['fields'](_0x4a863e['query'][_0x1c93('0x3a')]));_0x1b3097['attributes']=_0x1b3097[_0x1c93('0x3c')]['length']?_0x1b3097['attributes']:_0x36987b['model'];if(!_0x4a863e['query'][_0x1c93('0x3d')](_0x1c93('0x3e'))){_0x1b3097[_0x1c93('0x1e')]=qs[_0x1c93('0x1e')](_0x4a863e['query'][_0x1c93('0x1e')]);_0x1b3097['offset']=qs[_0x1c93('0x1c')](_0x4a863e[_0x1c93('0x35')][_0x1c93('0x1c')]);}_0x1b3097[_0x1c93('0x5b')]=qs[_0x1c93('0x3f')](_0x4a863e['query'][_0x1c93('0x3f')]);_0x1b3097['where']=qs['filters'](_[_0x1c93('0x41')](_0x4a863e[_0x1c93('0x35')],_0x36987b[_0x1c93('0x37')]));_0x1b3097[_0x1c93('0x40')][_0x1c93('0x5c')]=_0x468f69['id'];if(_0x4a863e[_0x1c93('0x35')][_0x1c93('0x42')]){_0x1b3097['where']=_[_0x1c93('0x43')](_0x1b3097[_0x1c93('0x40')],{'$or':_[_0x1c93('0x34')](_0x1b3097[_0x1c93('0x3c')],function(_0x3d57f2){var _0x17ba08={};_0x17ba08[_0x3d57f2]={'$like':'%'+_0x4a863e[_0x1c93('0x35')][_0x1c93('0x42')]+'%'};return _0x17ba08;})});}_0x1b3097=_['merge']({},_0x1b3097,_0x4a863e[_0x1c93('0x44')]);return db[_0x1c93('0x5f')]['count']({'where':_0x1b3097[_0x1c93('0x40')]})['then'](function(_0x2e8c55){_0x1557a0[_0x1c93('0x1f')]=_0x2e8c55;if(_0x4a863e[_0x1c93('0x35')][_0x1c93('0x45')]){_0x1b3097[_0x1c93('0x46')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x1b3097);})[_0x1c93('0x25')](function(_0x4f2f8e){_0x1557a0[_0x1c93('0x48')]=_0x4f2f8e;return _0x1557a0;});}})[_0x1c93('0x25')](respondWithFilteredResult(_0x1092f6,_0x1b3097))[_0x1c93('0x49')](handleError(_0x1092f6,null));};function char(_0x4e85e0){return _0x1c93('0x60')===typeof _0x4e85e0?String['fromCharCode'][_0x1c93('0x21')](null,arguments):_0x4e85e0;}function needsEncapsulation(_0x6095b8){return!!_0x6095b8&&(_0x6095b8[_0x1c93('0x61')]()[_0x1c93('0x62')](char(0xd))>=0x0||_0x6095b8[_0x1c93('0x61')]()[_0x1c93('0x62')](char(0xa))>=0x0||_0x6095b8['toString']()['indexOf'](char(0x2c))>=0x0||_0x6095b8[_0x1c93('0x61')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0xee1fe1){var _0x389010=char(0x22),_0x465827='\x5c'+char(0x22),_0x58db39=_0xee1fe1[_0x1c93('0x61')]()[_0x1c93('0x63')](new RegExp(_0x389010,'g'),_0x465827);return _0x389010+_0x58db39+_0x389010;}exports['getSummary']=function(_0x21e2ad,_0x41eddd,_0x3dbd55){var _0x563d1e,_0xe8c5d6;var _0x16af50={'where':{'ProjectId':_0x21e2ad[_0x1c93('0x4b')]['id']}};if(_0x21e2ad[_0x1c93('0x35')][_0x1c93('0x64')]){_0x16af50[_0x1c93('0x40')][_0x1c93('0x65')]=JSON[_0x1c93('0x66')](_0x21e2ad[_0x1c93('0x35')][_0x1c93('0x64')]);}return db[_0x1c93('0x5d')][_0x1c93('0x47')](_0x16af50)['then'](handleEntityNotFound(_0x41eddd,null))[_0x1c93('0x25')](function(_0x2584c9){if(_0x2584c9){_0x563d1e=_0x2584c9;return db['JscriptyQuestionReport'][_0x1c93('0x47')]({'where':{'SessionId':{'$in':_[_0x1c93('0x34')](_0x563d1e,'id')},'ProjectId':_0x21e2ad[_0x1c93('0x4b')]['id']},'order':'-createdAt'});}})[_0x1c93('0x25')](handleEntityNotFound(_0x41eddd,null))['then'](function(_0x18997b){if(_0x18997b){_0xe8c5d6=_0x18997b;var _0x33a719={};for(var _0x1d5e21=0x0,_0x2ba516=_0xe8c5d6[_0x1c93('0x3b')];_0x1d5e21<_0x2ba516;_0x1d5e21++){if(!_0x33a719[_0x1c93('0x3d')](_0xe8c5d6[_0x1d5e21]['questionId'])){_0x33a719[_0xe8c5d6[_0x1d5e21][_0x1c93('0x67')]]=needsEncapsulation(_0xe8c5d6[_0x1d5e21][_0x1c93('0x68')])?encapsulate(_0xe8c5d6[_0x1d5e21]['question']):_0xe8c5d6[_0x1d5e21][_0x1c93('0x68')];}}var _0x381f77=[],_0x369f1c={};for(var _0x319a59=0x0,_0x58442e=_0x563d1e[_0x1c93('0x3b')];_0x319a59<_0x58442e;_0x319a59++){_0x369f1c={'ProjectId':_0x21e2ad[_0x1c93('0x4b')]['id'],'SessionId':_0x563d1e[_0x319a59]['id'],'StartTime':moment(_0x563d1e[_0x319a59][_0x1c93('0x65')])[_0x1c93('0x69')](_0x1c93('0x6a'))};for(var _0x29a31d=0x0,_0x4d96af=_0xe8c5d6['length'];_0x29a31d<_0x4d96af;_0x29a31d++){if(_0xe8c5d6[_0x29a31d][_0x1c93('0x6b')]==_0x563d1e[_0x319a59]['id']&&_0x33a719[_0x1c93('0x3d')](_0xe8c5d6[_0x29a31d]['questionId'])){_0x369f1c[_0x33a719[_0xe8c5d6[_0x29a31d][_0x1c93('0x67')]]]=_0xe8c5d6[_0x29a31d][_0x1c93('0x6c')];}}for(var _0x1639ea in _0x33a719){if(!_0x369f1c['hasOwnProperty'](_0x33a719[_0x1639ea])){_0x369f1c[_0x33a719[_0x1639ea]]=null;}}_0x381f77[_0x1c93('0x6d')](_0x369f1c);}return _0x381f77;}})[_0x1c93('0x25')](function(_0xd61d67){if(!_[_0x1c93('0x6e')](_0xd61d67)){var _0x4eda0a=toCsv(_0xd61d67);var _0x1bb735=Date[_0x1c93('0x6f')]();fs[_0x1c93('0x70')](util[_0x1c93('0x69')](_0x1c93('0x71'),_0x21e2ad['params']['id'],_0x1bb735),_0x4eda0a);_0x41eddd[_0x1c93('0x72')](_0x1c93('0x73'),_0x1c93('0x74')+util[_0x1c93('0x69')](_0x1c93('0x75'),_0x21e2ad[_0x1c93('0x4b')]['id'],_0x1bb735));_0x41eddd[_0x1c93('0x72')](_0x1c93('0x76'),_0x1c93('0x77'));return _0x41eddd[_0x1c93('0x78')](util['format'](_0x1c93('0x71'),_0x21e2ad[_0x1c93('0x4b')]['id'],_0x1bb735));}else{return _0x41eddd[_0x1c93('0x18')](0xcc);}})[_0x1c93('0x49')](handleError(_0x41eddd,null));}; \ No newline at end of file +var _0x5630=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','rows','catch','show','params','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','omit','createdAt','updatedAt','update','getSessions','JscriptySessionReport','ProjectId','findAll','findOne','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','destroy','Projects','UserProfileResource','stack','name','send','map','JscriptyProject','rawAttributes','fieldName','type','key','model'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x5630,0xc3));var _0x0563=function(_0x339d79,_0x16fe8c){_0x339d79=_0x339d79-0x0;var _0x2774ce=_0x5630[_0x339d79];return _0x2774ce;};'use strict';var emlformat=require(_0x0563('0x0'));var rimraf=require(_0x0563('0x1'));var zipdir=require(_0x0563('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0563('0x3'));var Mustache=require(_0x0563('0x4'));var util=require(_0x0563('0x5'));var path=require(_0x0563('0x6'));var sox=require(_0x0563('0x7'));var csv=require(_0x0563('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0563('0x9'));var squel=require(_0x0563('0xa'));var crypto=require(_0x0563('0xb'));var jsforce=require(_0x0563('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0563('0x8'));var querystring=require(_0x0563('0xd'));var Papa=require(_0x0563('0xe'));var Redis=require(_0x0563('0xf'));var authService=require(_0x0563('0x10'));var qs=require(_0x0563('0x11'));var as=require(_0x0563('0x12'));var hardwareService=require(_0x0563('0x13'));var logger=require('../../config/logger')(_0x0563('0x14'));var utils=require(_0x0563('0x15'));var config=require(_0x0563('0x16'));var licenseUtil=require(_0x0563('0x17'));var db=require(_0x0563('0x18'))['db'];function respondWithStatusCode(_0x392701,_0x64b05){_0x64b05=_0x64b05||0xcc;return function(_0x427755){if(_0x427755){return _0x392701[_0x0563('0x19')](_0x64b05);}return _0x392701[_0x0563('0x1a')](_0x64b05)[_0x0563('0x1b')]();};}function respondWithResult(_0x7b3d53,_0x4b700c){_0x4b700c=_0x4b700c||0xc8;return function(_0x3c145d){if(_0x3c145d){return _0x7b3d53[_0x0563('0x1a')](_0x4b700c)[_0x0563('0x1c')](_0x3c145d);}};}function respondWithFilteredResult(_0xf37ae7,_0x538810){return function(_0x5a7a71){if(_0x5a7a71){var _0x2f85c1=typeof _0x538810['offset']===_0x0563('0x1d')&&typeof _0x538810[_0x0563('0x1e')]==='undefined';var _0x2b172d=_0x5a7a71['count'];var _0x3c808d=_0x2f85c1?0x0:_0x538810[_0x0563('0x1f')];var _0x9a7a42=_0x2f85c1?_0x5a7a71[_0x0563('0x20')]:_0x538810['offset']+_0x538810[_0x0563('0x1e')];var _0x2ab6ef;if(_0x9a7a42>=_0x2b172d){_0x9a7a42=_0x2b172d;_0x2ab6ef=0xc8;}else{_0x2ab6ef=0xce;}_0xf37ae7[_0x0563('0x1a')](_0x2ab6ef);return _0xf37ae7[_0x0563('0x21')](_0x0563('0x22'),_0x3c808d+'-'+_0x9a7a42+'/'+_0x2b172d)['json'](_0x5a7a71);}return null;};}function patchUpdates(_0x530d4b){return function(_0x4b303d){try{jsonpatch[_0x0563('0x23')](_0x4b303d,_0x530d4b,!![]);}catch(_0x35c163){return BPromise[_0x0563('0x24')](_0x35c163);}return _0x4b303d[_0x0563('0x25')]();};}function saveUpdates(_0x43e1ac,_0x35c920){return function(_0x483531){if(_0x483531){return _0x483531['update'](_0x43e1ac)['then'](function(_0x550a7c){return _0x550a7c;});}return null;};}function removeEntity(_0x4db09e,_0x511017){return function(_0x275d04){if(_0x275d04){return _0x275d04[_0x0563('0x26')]()['then'](function(){var _0x5f04bd=_0x275d04['get']({'plain':!![]});var _0x70ddac=_0x0563('0x27');return db[_0x0563('0x28')][_0x0563('0x26')]({'where':{'type':_0x70ddac,'resourceId':_0x5f04bd['id']}})['then'](function(){return _0x275d04;});})['then'](function(){_0x4db09e[_0x0563('0x1a')](0xcc)[_0x0563('0x1b')]();});}};}function handleEntityNotFound(_0x5449c5,_0x2075b0){return function(_0x3c5af1){if(!_0x3c5af1){_0x5449c5[_0x0563('0x19')](0x194);}return _0x3c5af1;};}function handleError(_0x1ca005,_0x14ee62){_0x14ee62=_0x14ee62||0x1f4;return function(_0x2944ea){logger['error'](_0x2944ea[_0x0563('0x29')]);if(_0x2944ea[_0x0563('0x2a')]){delete _0x2944ea['name'];}_0x1ca005['status'](_0x14ee62)[_0x0563('0x2b')](_0x2944ea);};}exports['index']=function(_0x623d24,_0x394ef4){var _0x3e692a={},_0x2196ff={},_0x11cf5a={'count':0x0,'rows':[]};var _0x1ed1b7=_[_0x0563('0x2c')](db[_0x0563('0x2d')][_0x0563('0x2e')],function(_0x33835f){return{'name':_0x33835f[_0x0563('0x2f')],'type':_0x33835f[_0x0563('0x30')][_0x0563('0x31')]};});_0x2196ff[_0x0563('0x32')]=_[_0x0563('0x2c')](_0x1ed1b7,'name');_0x2196ff[_0x0563('0x33')]=_['keys'](_0x623d24['query']);_0x2196ff[_0x0563('0x34')]=_[_0x0563('0x35')](_0x2196ff['model'],_0x2196ff[_0x0563('0x33')]);_0x3e692a[_0x0563('0x36')]=_[_0x0563('0x35')](_0x2196ff[_0x0563('0x32')],qs[_0x0563('0x37')](_0x623d24['query'][_0x0563('0x37')]));_0x3e692a['attributes']=_0x3e692a[_0x0563('0x36')][_0x0563('0x38')]?_0x3e692a[_0x0563('0x36')]:_0x2196ff[_0x0563('0x32')];if(!_0x623d24[_0x0563('0x33')][_0x0563('0x39')](_0x0563('0x3a'))){_0x3e692a[_0x0563('0x1e')]=qs[_0x0563('0x1e')](_0x623d24[_0x0563('0x33')]['limit']);_0x3e692a[_0x0563('0x1f')]=qs[_0x0563('0x1f')](_0x623d24[_0x0563('0x33')]['offset']);}_0x3e692a[_0x0563('0x3b')]=qs['sort'](_0x623d24[_0x0563('0x33')][_0x0563('0x3c')]);_0x3e692a[_0x0563('0x3d')]=qs[_0x0563('0x34')](_[_0x0563('0x3e')](_0x623d24[_0x0563('0x33')],_0x2196ff['filters']),_0x1ed1b7);if(_0x623d24[_0x0563('0x33')][_0x0563('0x3f')]){_0x3e692a[_0x0563('0x3d')]=_[_0x0563('0x40')](_0x3e692a[_0x0563('0x3d')],{'$or':_[_0x0563('0x2c')](_0x1ed1b7,function(_0x11e2a6){if(_0x11e2a6[_0x0563('0x30')]!==_0x0563('0x41')){var _0xd70ca2={};_0xd70ca2[_0x11e2a6[_0x0563('0x2a')]]={'$like':'%'+_0x623d24[_0x0563('0x33')][_0x0563('0x3f')]+'%'};return _0xd70ca2;}})});}_0x3e692a=_[_0x0563('0x40')]({},_0x3e692a,_0x623d24[_0x0563('0x42')]);var _0xf899c2={'where':_0x3e692a[_0x0563('0x3d')]};return db[_0x0563('0x2d')]['count'](_0xf899c2)[_0x0563('0x43')](function(_0x5c95a8){_0x11cf5a[_0x0563('0x20')]=_0x5c95a8;if(_0x623d24[_0x0563('0x33')][_0x0563('0x44')]){_0x3e692a[_0x0563('0x45')]=[{'all':!![]}];}return db[_0x0563('0x2d')]['findAll'](_0x3e692a);})[_0x0563('0x43')](function(_0x28e082){_0x11cf5a[_0x0563('0x46')]=_0x28e082;return _0x11cf5a;})['then'](respondWithFilteredResult(_0x394ef4,_0x3e692a))[_0x0563('0x47')](handleError(_0x394ef4,null));};exports[_0x0563('0x48')]=function(_0x57b3f3,_0xa1715d){var _0x454dec={'raw':![],'where':{'id':_0x57b3f3[_0x0563('0x49')]['id']}},_0x29381d={};_0x29381d[_0x0563('0x32')]=_[_0x0563('0x4a')](db[_0x0563('0x2d')]['rawAttributes']);_0x29381d[_0x0563('0x33')]=_[_0x0563('0x4a')](_0x57b3f3[_0x0563('0x33')]);_0x29381d[_0x0563('0x34')]=_[_0x0563('0x35')](_0x29381d[_0x0563('0x32')],_0x29381d['query']);_0x454dec['attributes']=_['intersection'](_0x29381d['model'],qs[_0x0563('0x37')](_0x57b3f3[_0x0563('0x33')][_0x0563('0x37')]));_0x454dec[_0x0563('0x36')]=_0x454dec['attributes'][_0x0563('0x38')]?_0x454dec[_0x0563('0x36')]:_0x29381d[_0x0563('0x32')];if(_0x57b3f3['query']['includeAll']){_0x454dec[_0x0563('0x45')]=[{'all':!![]}];}_0x454dec=_['merge']({},_0x454dec,_0x57b3f3['options']);return db[_0x0563('0x2d')]['find'](_0x454dec)[_0x0563('0x43')](handleEntityNotFound(_0xa1715d,null))[_0x0563('0x43')](respondWithResult(_0xa1715d,null))[_0x0563('0x47')](handleError(_0xa1715d,null));};exports[_0x0563('0x4b')]=function(_0x3bdcfe,_0x2559c1){return db[_0x0563('0x2d')]['create'](_0x3bdcfe[_0x0563('0x4c')],{})['then'](function(_0x19bed1){var _0x587776=_0x3bdcfe[_0x0563('0x4d')][_0x0563('0x4e')]({'plain':!![]});if(!_0x587776)throw new Error(_0x0563('0x4f'));if(_0x587776[_0x0563('0x50')]==='user'){var _0x4d733f=_0x19bed1['get']({'plain':!![]});var _0x67e2cb=_0x0563('0x27');return db[_0x0563('0x51')]['find']({'where':{'name':_0x67e2cb,'userProfileId':_0x587776[_0x0563('0x52')]},'raw':!![]})[_0x0563('0x43')](function(_0x856711){if(_0x856711&&_0x856711[_0x0563('0x53')]===0x0){return db[_0x0563('0x28')]['create']({'name':_0x4d733f['name'],'resourceId':_0x4d733f['id'],'type':_0x856711[_0x0563('0x2a')],'sectionId':_0x856711['id']},{})[_0x0563('0x43')](function(){return _0x19bed1;});}else{return _0x19bed1;}})[_0x0563('0x47')](function(_0x54d79b){logger[_0x0563('0x54')](_0x0563('0x55'),_0x54d79b);throw _0x54d79b;});}return _0x19bed1;})[_0x0563('0x43')](respondWithResult(_0x2559c1,0xc9))[_0x0563('0x47')](handleError(_0x2559c1,null));};exports['clone']=function(_0x3e8ba9,_0x484912){var _0x33e474={'where':{'id':_0x3e8ba9[_0x0563('0x49')]['id']}},_0x50c6f2={};_0x50c6f2['model']=_[_0x0563('0x4a')](db[_0x0563('0x2d')]['rawAttributes']);_0x33e474['attributes']=_['intersection'](_0x50c6f2[_0x0563('0x32')],qs[_0x0563('0x37')](_0x3e8ba9['query'][_0x0563('0x37')]));_0x33e474[_0x0563('0x36')]=_0x33e474[_0x0563('0x36')][_0x0563('0x38')]?_0x33e474[_0x0563('0x36')]:_0x50c6f2[_0x0563('0x32')];if(_0x3e8ba9[_0x0563('0x33')]['includeAll']){_0x33e474[_0x0563('0x45')]=[{'all':!![]}];}_0x33e474=_[_0x0563('0x40')]({},_0x33e474,_0x3e8ba9['options']);return db[_0x0563('0x2d')][_0x0563('0x56')](_0x33e474)[_0x0563('0x43')](handleEntityNotFound(_0x484912,null))[_0x0563('0x43')](function(_0x1b9192){if(_0x1b9192){var _0x33f4b2=_0x1b9192['get']({'plain':!![]});_0x33f4b2=qs[_0x0563('0x57')](_0x33f4b2,['id',_0x0563('0x58'),_0x0563('0x59')]);_0x3e8ba9[_0x0563('0x4c')]=_['omit'](_0x3e8ba9['body'],['id',_0x0563('0x58'),_0x0563('0x59')]);return db['JscriptyProject'][_0x0563('0x4b')](_[_0x0563('0x40')](_0x33f4b2,_0x3e8ba9[_0x0563('0x4c')]),{'include':_0x3e8ba9['query'][_0x0563('0x44')]?[{'all':!![]}]:undefined})[_0x0563('0x43')](function(_0x208909){var _0x5df899=_0x3e8ba9['user']['get']({'plain':!![]});if(!_0x5df899)throw new Error(_0x0563('0x4f'));if(_0x5df899[_0x0563('0x50')]===_0x0563('0x4d')){var _0xfd3fa1=_0x208909[_0x0563('0x4e')]({'plain':!![]});var _0x4203d5=_0x0563('0x27');return db[_0x0563('0x51')][_0x0563('0x56')]({'where':{'name':_0x4203d5,'userProfileId':_0x5df899['userProfileId']},'raw':!![]})[_0x0563('0x43')](function(_0x530b96){if(_0x530b96&&_0x530b96[_0x0563('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0xfd3fa1[_0x0563('0x2a')],'resourceId':_0xfd3fa1['id'],'type':_0x530b96[_0x0563('0x2a')],'sectionId':_0x530b96['id']},{})[_0x0563('0x43')](function(){return _0x208909;});}else{return _0x208909;}})[_0x0563('0x47')](function(_0x93a714){logger[_0x0563('0x54')](_0x0563('0x55'),_0x93a714);throw _0x93a714;});}return _0x208909;});}})[_0x0563('0x43')](respondWithResult(_0x484912,0xc9))[_0x0563('0x47')](handleError(_0x484912,null));};exports[_0x0563('0x5a')]=function(_0x29fabd,_0x1653b2){if(_0x29fabd[_0x0563('0x4c')]['id']){delete _0x29fabd[_0x0563('0x4c')]['id'];}return db[_0x0563('0x2d')][_0x0563('0x56')]({'where':{'id':_0x29fabd[_0x0563('0x49')]['id']}})[_0x0563('0x43')](handleEntityNotFound(_0x1653b2,null))['then'](saveUpdates(_0x29fabd[_0x0563('0x4c')],null))[_0x0563('0x43')](respondWithResult(_0x1653b2,null))[_0x0563('0x47')](handleError(_0x1653b2,null));};exports[_0x0563('0x26')]=function(_0x239c8d,_0x234f41){return db[_0x0563('0x2d')]['find']({'where':{'id':_0x239c8d[_0x0563('0x49')]['id']}})[_0x0563('0x43')](handleEntityNotFound(_0x234f41,null))['then'](removeEntity(_0x234f41,null))['catch'](handleError(_0x234f41,null));};exports[_0x0563('0x5b')]=function(_0x4644a6,_0x517345,_0x5cdc5c){var _0xa9b2d4={'raw':!![],'where':{}};var _0x1c7301={};var _0x5018f4={'count':0x0,'rows':[]};return db[_0x0563('0x2d')]['findOne']({'where':{'id':_0x4644a6[_0x0563('0x49')]['id']}})['then'](handleEntityNotFound(_0x517345,null))[_0x0563('0x43')](function(_0x5f1f59){if(_0x5f1f59){_0x1c7301[_0x0563('0x32')]=_['keys'](db[_0x0563('0x5c')]['rawAttributes']);_0x1c7301['query']=_[_0x0563('0x4a')](_0x4644a6[_0x0563('0x33')]);_0x1c7301[_0x0563('0x34')]=_[_0x0563('0x35')](_0x1c7301['model'],_0x1c7301[_0x0563('0x33')]);_0xa9b2d4[_0x0563('0x36')]=_[_0x0563('0x35')](_0x1c7301['model'],qs[_0x0563('0x37')](_0x4644a6['query'][_0x0563('0x37')]));_0xa9b2d4['attributes']=_0xa9b2d4['attributes'][_0x0563('0x38')]?_0xa9b2d4[_0x0563('0x36')]:_0x1c7301[_0x0563('0x32')];if(!_0x4644a6[_0x0563('0x33')]['hasOwnProperty'](_0x0563('0x3a'))){_0xa9b2d4['limit']=qs[_0x0563('0x1e')](_0x4644a6[_0x0563('0x33')][_0x0563('0x1e')]);_0xa9b2d4[_0x0563('0x1f')]=qs[_0x0563('0x1f')](_0x4644a6['query']['offset']);}_0xa9b2d4[_0x0563('0x3b')]=qs[_0x0563('0x3c')](_0x4644a6[_0x0563('0x33')]['sort']);_0xa9b2d4['where']=qs[_0x0563('0x34')](_[_0x0563('0x3e')](_0x4644a6[_0x0563('0x33')],_0x1c7301[_0x0563('0x34')]));_0xa9b2d4['where'][_0x0563('0x5d')]=_0x5f1f59['id'];if(_0x4644a6[_0x0563('0x33')][_0x0563('0x3f')]){_0xa9b2d4['where']=_[_0x0563('0x40')](_0xa9b2d4[_0x0563('0x3d')],{'$or':_[_0x0563('0x2c')](_0xa9b2d4['attributes'],function(_0x590c83){var _0x5a2014={};_0x5a2014[_0x590c83]={'$like':'%'+_0x4644a6[_0x0563('0x33')][_0x0563('0x3f')]+'%'};return _0x5a2014;})});}_0xa9b2d4=_['merge']({},_0xa9b2d4,_0x4644a6[_0x0563('0x42')]);return db[_0x0563('0x5c')][_0x0563('0x20')]({'where':_0xa9b2d4['where']})[_0x0563('0x43')](function(_0x80384a){_0x5018f4['count']=_0x80384a;if(_0x4644a6[_0x0563('0x33')]['includeAll']){_0xa9b2d4[_0x0563('0x45')]=[{'all':!![]}];}return db[_0x0563('0x5c')][_0x0563('0x5e')](_0xa9b2d4);})[_0x0563('0x43')](function(_0x5e26d0){_0x5018f4[_0x0563('0x46')]=_0x5e26d0;return _0x5018f4;});}})['then'](respondWithFilteredResult(_0x517345,_0xa9b2d4))[_0x0563('0x47')](handleError(_0x517345,null));};exports['getAnswers']=function(_0x1847d8,_0x40f2e8,_0x2bd782){var _0x375026={'raw':!![],'where':{}};var _0xe4a492={};var _0x1a013e={'count':0x0,'rows':[]};return db[_0x0563('0x2d')][_0x0563('0x5f')]({'where':{'id':_0x1847d8[_0x0563('0x49')]['id']}})['then'](handleEntityNotFound(_0x40f2e8,null))[_0x0563('0x43')](function(_0x340fb6){if(_0x340fb6){_0xe4a492['model']=_[_0x0563('0x4a')](db[_0x0563('0x60')][_0x0563('0x2e')]);_0xe4a492[_0x0563('0x33')]=_[_0x0563('0x4a')](_0x1847d8[_0x0563('0x33')]);_0xe4a492[_0x0563('0x34')]=_[_0x0563('0x35')](_0xe4a492[_0x0563('0x32')],_0xe4a492[_0x0563('0x33')]);_0x375026[_0x0563('0x36')]=_['intersection'](_0xe4a492[_0x0563('0x32')],qs[_0x0563('0x37')](_0x1847d8[_0x0563('0x33')]['fields']));_0x375026['attributes']=_0x375026['attributes'][_0x0563('0x38')]?_0x375026[_0x0563('0x36')]:_0xe4a492['model'];if(!_0x1847d8[_0x0563('0x33')][_0x0563('0x39')](_0x0563('0x3a'))){_0x375026[_0x0563('0x1e')]=qs['limit'](_0x1847d8[_0x0563('0x33')][_0x0563('0x1e')]);_0x375026[_0x0563('0x1f')]=qs[_0x0563('0x1f')](_0x1847d8[_0x0563('0x33')][_0x0563('0x1f')]);}_0x375026[_0x0563('0x3b')]=qs[_0x0563('0x3c')](_0x1847d8[_0x0563('0x33')]['sort']);_0x375026['where']=qs[_0x0563('0x34')](_[_0x0563('0x3e')](_0x1847d8[_0x0563('0x33')],_0xe4a492[_0x0563('0x34')]));_0x375026['where'][_0x0563('0x5d')]=_0x340fb6['id'];if(_0x1847d8['query']['filter']){_0x375026[_0x0563('0x3d')]=_[_0x0563('0x40')](_0x375026[_0x0563('0x3d')],{'$or':_['map'](_0x375026['attributes'],function(_0x56823a){var _0x1d373d={};_0x1d373d[_0x56823a]={'$like':'%'+_0x1847d8[_0x0563('0x33')]['filter']+'%'};return _0x1d373d;})});}_0x375026=_['merge']({},_0x375026,_0x1847d8['options']);return db[_0x0563('0x60')]['count']({'where':_0x375026[_0x0563('0x3d')]})[_0x0563('0x43')](function(_0x928ae8){_0x1a013e[_0x0563('0x20')]=_0x928ae8;if(_0x1847d8[_0x0563('0x33')][_0x0563('0x44')]){_0x375026[_0x0563('0x45')]=[{'all':!![]}];}return db[_0x0563('0x60')][_0x0563('0x5e')](_0x375026);})[_0x0563('0x43')](function(_0x55244d){_0x1a013e[_0x0563('0x46')]=_0x55244d;return _0x1a013e;});}})[_0x0563('0x43')](respondWithFilteredResult(_0x40f2e8,_0x375026))['catch'](handleError(_0x40f2e8,null));};function char(_0x49b003){return _0x0563('0x61')===typeof _0x49b003?String[_0x0563('0x62')][_0x0563('0x23')](null,arguments):_0x49b003;}function needsEncapsulation(_0x4b65cc){return!!_0x4b65cc&&(_0x4b65cc[_0x0563('0x63')]()[_0x0563('0x64')](char(0xd))>=0x0||_0x4b65cc[_0x0563('0x63')]()[_0x0563('0x64')](char(0xa))>=0x0||_0x4b65cc['toString']()[_0x0563('0x64')](char(0x2c))>=0x0||_0x4b65cc[_0x0563('0x63')]()[_0x0563('0x64')](char(0x22))>=0x0);}function encapsulate(_0x5ed109){var _0xad95eb=char(0x22),_0x5ef255='\x5c'+char(0x22),_0x33a495=_0x5ed109['toString']()[_0x0563('0x65')](new RegExp(_0xad95eb,'g'),_0x5ef255);return _0xad95eb+_0x33a495+_0xad95eb;}exports[_0x0563('0x66')]=function(_0x4c6a47,_0xb52328,_0x29f621){var _0x5efb1a,_0x3d5efb;var _0x1d8e84={'where':{'ProjectId':_0x4c6a47[_0x0563('0x49')]['id']}};if(_0x4c6a47[_0x0563('0x33')][_0x0563('0x67')]){_0x1d8e84['where'][_0x0563('0x68')]=JSON[_0x0563('0x69')](_0x4c6a47[_0x0563('0x33')][_0x0563('0x67')]);}return db['JscriptySessionReport']['findAll'](_0x1d8e84)['then'](handleEntityNotFound(_0xb52328,null))['then'](function(_0x98a459){if(_0x98a459){_0x5efb1a=_0x98a459;return db[_0x0563('0x6a')][_0x0563('0x5e')]({'where':{'SessionId':{'$in':_[_0x0563('0x2c')](_0x5efb1a,'id')},'ProjectId':_0x4c6a47['params']['id']},'order':_0x0563('0x6b')});}})[_0x0563('0x43')](handleEntityNotFound(_0xb52328,null))[_0x0563('0x43')](function(_0x8b2b21){if(_0x8b2b21){_0x3d5efb=_0x8b2b21;var _0x5552af={};for(var _0x72340c=0x0,_0x1549b4=_0x3d5efb[_0x0563('0x38')];_0x72340c<_0x1549b4;_0x72340c++){if(!_0x5552af[_0x0563('0x39')](_0x3d5efb[_0x72340c][_0x0563('0x6c')])){_0x5552af[_0x3d5efb[_0x72340c][_0x0563('0x6c')]]=needsEncapsulation(_0x3d5efb[_0x72340c]['question'])?encapsulate(_0x3d5efb[_0x72340c][_0x0563('0x6d')]):_0x3d5efb[_0x72340c][_0x0563('0x6d')];}}var _0x203b32=[],_0x3524be={};for(var _0x5bd1dd=0x0,_0xef0e9b=_0x5efb1a['length'];_0x5bd1dd<_0xef0e9b;_0x5bd1dd++){_0x3524be={'ProjectId':_0x4c6a47['params']['id'],'SessionId':_0x5efb1a[_0x5bd1dd]['id'],'StartTime':moment(_0x5efb1a[_0x5bd1dd][_0x0563('0x68')])[_0x0563('0x6e')](_0x0563('0x6f'))};for(var _0x1b902c=0x0,_0x482603=_0x3d5efb[_0x0563('0x38')];_0x1b902c<_0x482603;_0x1b902c++){if(_0x3d5efb[_0x1b902c]['SessionId']==_0x5efb1a[_0x5bd1dd]['id']&&_0x5552af[_0x0563('0x39')](_0x3d5efb[_0x1b902c][_0x0563('0x6c')])){_0x3524be[_0x5552af[_0x3d5efb[_0x1b902c][_0x0563('0x6c')]]]=_0x3d5efb[_0x1b902c][_0x0563('0x70')];}}for(var _0x101972 in _0x5552af){if(!_0x3524be['hasOwnProperty'](_0x5552af[_0x101972])){_0x3524be[_0x5552af[_0x101972]]=null;}}_0x203b32[_0x0563('0x71')](_0x3524be);}return _0x203b32;}})[_0x0563('0x43')](function(_0x1090f4){if(!_[_0x0563('0x72')](_0x1090f4)){var _0x15932d=toCsv(_0x1090f4);var _0x5c0bc2=Date[_0x0563('0x73')]();fs['writeFileSync'](util[_0x0563('0x6e')](_0x0563('0x74'),_0x4c6a47[_0x0563('0x49')]['id'],_0x5c0bc2),_0x15932d);_0xb52328[_0x0563('0x75')](_0x0563('0x76'),_0x0563('0x77')+util[_0x0563('0x6e')](_0x0563('0x78'),_0x4c6a47[_0x0563('0x49')]['id'],_0x5c0bc2));_0xb52328[_0x0563('0x75')](_0x0563('0x79'),'text/csv');return _0xb52328[_0x0563('0x7a')](util[_0x0563('0x6e')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4c6a47[_0x0563('0x49')]['id'],_0x5c0bc2));}else{return _0xb52328[_0x0563('0x19')](0xcc);}})[_0x0563('0x47')](handleError(_0xb52328,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 86d3302..07ceebe 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 _0xd0bb=['JscriptyProject','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x247a26,_0x32d4e9){var _0x17ad3b=function(_0x1d4507){while(--_0x1d4507){_0x247a26['push'](_0x247a26['shift']());}};_0x17ad3b(++_0x32d4e9);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x5acbef,_0x36b414){_0x5acbef=_0x5acbef-0x0;var _0x5e9742=_0xd0bb[_0x5acbef];return _0x5e9742;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var logger=require(_0xbd0b('0x2'))('api');var moment=require(_0xbd0b('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd0b('0x4'));var fs=require('fs');var path=require(_0xbd0b('0x5'));var rimraf=require('rimraf');var config=require(_0xbd0b('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0xbd0b('0x7')]=function(_0x1b2499,_0x158b5c){return _0x1b2499[_0xbd0b('0x8')](_0xbd0b('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f90=['rimraf','./jscriptyProject.attributes','exports','define','lodash','util','../../config/logger','api','moment','path'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x7f90,0xf4));var _0x07f9=function(_0x2598ea,_0x4cf20a){_0x2598ea=_0x2598ea-0x0;var _0x1fcee5=_0x7f90[_0x2598ea];return _0x1fcee5;};'use strict';var _=require(_0x07f9('0x0'));var util=require(_0x07f9('0x1'));var logger=require(_0x07f9('0x2'))(_0x07f9('0x3'));var moment=require(_0x07f9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x07f9('0x5'));var rimraf=require(_0x07f9('0x6'));var config=require('../../config/environment');var attributes=require(_0x07f9('0x7'));module[_0x07f9('0x8')]=function(_0x46f86e,_0x449544){return _0x46f86e[_0x07f9('0x9')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index a8a42a2..120ca5b 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(_0x11924c,_0x93b2d4){var _0x1d7688=function(_0x54f403){while(--_0x54f403){_0x11924c['push'](_0x11924c['shift']());}};_0x1d7688(++_0x93b2d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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','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(_0x1405ba,_0x52dbda){var _0x214c69=function(_0x4af0fe){while(--_0x4af0fe){_0x1405ba['push'](_0x1405ba['shift']());}};_0x214c69(++_0x52dbda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 00bc67c..332e127 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 _0x249c=['index','get','/describe','/:id','show','post','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','isAuthenticated'];(function(_0x337907,_0xe9bc5b){var _0x5cb91c=function(_0xbb438e){while(--_0xbb438e){_0x337907['push'](_0x337907['shift']());}};_0x5cb91c(++_0xe9bc5b);}(_0x249c,0x74));var _0xc249=function(_0x34df4a,_0x209d10){_0x34df4a=_0x34df4a-0x0;var _0x145c69=_0x249c[_0x34df4a];return _0x145c69;};'use strict';var multer=require(_0xc249('0x0'));var util=require(_0xc249('0x1'));var path=require(_0xc249('0x2'));var timeout=require('connect-timeout');var express=require(_0xc249('0x3'));var router=express[_0xc249('0x4')]();var fs_extra=require(_0xc249('0x5'));var auth=require(_0xc249('0x6'));var interaction=require(_0xc249('0x7'));var config=require('../../config/environment');var controller=require(_0xc249('0x8'));router['get']('/',auth[_0xc249('0x9')](),controller[_0xc249('0xa')]);router[_0xc249('0xb')](_0xc249('0xc'),auth[_0xc249('0x9')](),controller['describe']);router['get'](_0xc249('0xd'),auth['isAuthenticated'](),controller[_0xc249('0xe')]);router[_0xc249('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc249('0xd'),auth[_0xc249('0x9')](),controller[_0xc249('0x10')]);router[_0xc249('0x11')]('/:id',auth[_0xc249('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbb78=['get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller'];(function(_0x4ef55f,_0x53be37){var _0x16dedd=function(_0x7d1642){while(--_0x7d1642){_0x4ef55f['push'](_0x4ef55f['shift']());}};_0x16dedd(++_0x53be37);}(_0xbb78,0xd6));var _0x8bb7=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xbb78[_0x334841];return _0x5beb4b;};'use strict';var multer=require('multer');var util=require(_0x8bb7('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8bb7('0x1')]();var fs_extra=require(_0x8bb7('0x2'));var auth=require(_0x8bb7('0x3'));var interaction=require(_0x8bb7('0x4'));var config=require('../../config/environment');var controller=require(_0x8bb7('0x5'));router[_0x8bb7('0x6')]('/',auth['isAuthenticated'](),controller[_0x8bb7('0x7')]);router[_0x8bb7('0x6')](_0x8bb7('0x8'),auth[_0x8bb7('0x9')](),controller[_0x8bb7('0xa')]);router[_0x8bb7('0x6')]('/:id',auth[_0x8bb7('0x9')](),controller[_0x8bb7('0xb')]);router[_0x8bb7('0xc')]('/',auth[_0x8bb7('0x9')](),controller[_0x8bb7('0xd')]);router[_0x8bb7('0xe')](_0x8bb7('0xf'),auth['isAuthenticated'](),controller[_0x8bb7('0x10')]);router[_0x8bb7('0x11')](_0x8bb7('0xf'),auth['isAuthenticated'](),controller[_0x8bb7('0x12')]);module[_0x8bb7('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 677dfa4..4fc6045 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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0xeb28cf,_0x48f18f){_0xeb28cf=_0xeb28cf-0x0;var _0x52a502=_0x7a54[_0xeb28cf];return _0x52a502;};'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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7a54,0x106));var _0x47a5=function(_0x3e6181,_0x32a01a){_0x3e6181=_0x3e6181-0x0;var _0xf94686=_0x7a54[_0x3e6181];return _0xf94686;};'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 bf383af..ed77083 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 _0xc047=['includeAll','findAll','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','fieldName','type','model','query','filters','intersection','fields','attributes','order','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x31c19c,_0xbe4b70){var _0x1a87f7=function(_0x23cf92){while(--_0x23cf92){_0x31c19c['push'](_0x31c19c['shift']());}};_0x1a87f7(++_0xbe4b70);}(_0xc047,0xe8));var _0x7c04=function(_0x313a3f,_0x15f023){_0x313a3f=_0x313a3f-0x0;var _0x2db500=_0xc047[_0x313a3f];return _0x2db500;};'use strict';var emlformat=require(_0x7c04('0x0'));var rimraf=require(_0x7c04('0x1'));var zipdir=require(_0x7c04('0x2'));var jsonpatch=require(_0x7c04('0x3'));var rp=require(_0x7c04('0x4'));var moment=require(_0x7c04('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7c04('0x6'));var util=require(_0x7c04('0x7'));var path=require(_0x7c04('0x8'));var sox=require('sox');var csv=require(_0x7c04('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c04('0xa'));var _=require(_0x7c04('0xb'));var squel=require(_0x7c04('0xc'));var crypto=require(_0x7c04('0xd'));var jsforce=require(_0x7c04('0xe'));var deskjs=require(_0x7c04('0xf'));var toCsv=require(_0x7c04('0x9'));var querystring=require(_0x7c04('0x10'));var Papa=require(_0x7c04('0x11'));var Redis=require(_0x7c04('0x12'));var authService=require(_0x7c04('0x13'));var qs=require(_0x7c04('0x14'));var as=require(_0x7c04('0x15'));var hardwareService=require(_0x7c04('0x16'));var logger=require('../../config/logger')(_0x7c04('0x17'));var utils=require('../../config/utils');var config=require(_0x7c04('0x18'));var licenseUtil=require(_0x7c04('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17b40f,_0xd8f63f){_0xd8f63f=_0xd8f63f||0xcc;return function(_0x42b195){if(_0x42b195){return _0x17b40f[_0x7c04('0x1a')](_0xd8f63f);}return _0x17b40f[_0x7c04('0x1b')](_0xd8f63f)[_0x7c04('0x1c')]();};}function respondWithResult(_0x65a9df,_0x468ffa){_0x468ffa=_0x468ffa||0xc8;return function(_0x17f5a9){if(_0x17f5a9){return _0x65a9df[_0x7c04('0x1b')](_0x468ffa)[_0x7c04('0x1d')](_0x17f5a9);}};}function respondWithFilteredResult(_0x58a088,_0x469219){return function(_0x484c53){if(_0x484c53){var _0x161349=typeof _0x469219['offset']===_0x7c04('0x1e')&&typeof _0x469219[_0x7c04('0x1f')]===_0x7c04('0x1e');var _0x1edca1=_0x484c53[_0x7c04('0x20')];var _0x3b6ec7=_0x161349?0x0:_0x469219[_0x7c04('0x21')];var _0x4d8fa2=_0x161349?_0x484c53[_0x7c04('0x20')]:_0x469219[_0x7c04('0x21')]+_0x469219[_0x7c04('0x1f')];var _0x52d0d4;if(_0x4d8fa2>=_0x1edca1){_0x4d8fa2=_0x1edca1;_0x52d0d4=0xc8;}else{_0x52d0d4=0xce;}_0x58a088[_0x7c04('0x1b')](_0x52d0d4);return _0x58a088[_0x7c04('0x22')](_0x7c04('0x23'),_0x3b6ec7+'-'+_0x4d8fa2+'/'+_0x1edca1)[_0x7c04('0x1d')](_0x484c53);}return null;};}function patchUpdates(_0x17ceab){return function(_0x3235f9){try{jsonpatch[_0x7c04('0x24')](_0x3235f9,_0x17ceab,!![]);}catch(_0x2112c7){return BPromise['reject'](_0x2112c7);}return _0x3235f9[_0x7c04('0x25')]();};}function saveUpdates(_0x38b501,_0x10e78e){return function(_0x4f6068){if(_0x4f6068){return _0x4f6068[_0x7c04('0x26')](_0x38b501)[_0x7c04('0x27')](function(_0x29f8aa){return _0x29f8aa;});}return null;};}function removeEntity(_0x128a1a,_0x1c2d0c){return function(_0x159eeb){if(_0x159eeb){return _0x159eeb[_0x7c04('0x28')]()['then'](function(){_0x128a1a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43a6ae,_0x3cb1a2){return function(_0x1522bd){if(!_0x1522bd){_0x43a6ae['sendStatus'](0x194);}return _0x1522bd;};}function handleError(_0x9849a,_0xcd19a6){_0xcd19a6=_0xcd19a6||0x1f4;return function(_0x136430){logger[_0x7c04('0x29')](_0x136430[_0x7c04('0x2a')]);if(_0x136430[_0x7c04('0x2b')]){delete _0x136430[_0x7c04('0x2b')];}_0x9849a['status'](_0xcd19a6)[_0x7c04('0x2c')](_0x136430);};}exports[_0x7c04('0x2d')]=function(_0x37bd31,_0x656054){var _0x22f8ba={},_0x25809b={},_0x4d328f={'count':0x0,'rows':[]};var _0x488e38=_[_0x7c04('0x2e')](db[_0x7c04('0x2f')]['rawAttributes'],function(_0x1d91dd){return{'name':_0x1d91dd[_0x7c04('0x30')],'type':_0x1d91dd[_0x7c04('0x31')]['key']};});_0x25809b[_0x7c04('0x32')]=_[_0x7c04('0x2e')](_0x488e38,'name');_0x25809b[_0x7c04('0x33')]=_['keys'](_0x37bd31[_0x7c04('0x33')]);_0x25809b[_0x7c04('0x34')]=_[_0x7c04('0x35')](_0x25809b[_0x7c04('0x32')],_0x25809b[_0x7c04('0x33')]);_0x22f8ba['attributes']=_['intersection'](_0x25809b[_0x7c04('0x32')],qs[_0x7c04('0x36')](_0x37bd31['query'][_0x7c04('0x36')]));_0x22f8ba['attributes']=_0x22f8ba[_0x7c04('0x37')]['length']?_0x22f8ba[_0x7c04('0x37')]:_0x25809b[_0x7c04('0x32')];if(!_0x37bd31[_0x7c04('0x33')]['hasOwnProperty']('nolimit')){_0x22f8ba['limit']=qs[_0x7c04('0x1f')](_0x37bd31[_0x7c04('0x33')][_0x7c04('0x1f')]);_0x22f8ba[_0x7c04('0x21')]=qs[_0x7c04('0x21')](_0x37bd31[_0x7c04('0x33')]['offset']);}_0x22f8ba[_0x7c04('0x38')]=qs[_0x7c04('0x39')](_0x37bd31['query'][_0x7c04('0x39')]);_0x22f8ba[_0x7c04('0x3a')]=qs[_0x7c04('0x34')](_[_0x7c04('0x3b')](_0x37bd31[_0x7c04('0x33')],_0x25809b['filters']),_0x488e38);if(_0x37bd31['query'][_0x7c04('0x3c')]){_0x22f8ba[_0x7c04('0x3a')]=_['merge'](_0x22f8ba[_0x7c04('0x3a')],{'$or':_[_0x7c04('0x2e')](_0x488e38,function(_0x31087f){if(_0x31087f['type']!==_0x7c04('0x3d')){var _0x16fd06={};_0x16fd06[_0x31087f[_0x7c04('0x2b')]]={'$like':'%'+_0x37bd31[_0x7c04('0x33')]['filter']+'%'};return _0x16fd06;}})});}_0x22f8ba=_[_0x7c04('0x3e')]({},_0x22f8ba,_0x37bd31[_0x7c04('0x3f')]);var _0x441507={'where':_0x22f8ba['where']};return db[_0x7c04('0x2f')][_0x7c04('0x20')](_0x441507)['then'](function(_0x2fe4b9){_0x4d328f[_0x7c04('0x20')]=_0x2fe4b9;if(_0x37bd31[_0x7c04('0x33')][_0x7c04('0x40')]){_0x22f8ba['include']=[{'all':!![]}];}return db[_0x7c04('0x2f')][_0x7c04('0x41')](_0x22f8ba);})['then'](function(_0xfe3aec){_0x4d328f['rows']=_0xfe3aec;return _0x4d328f;})[_0x7c04('0x27')](respondWithFilteredResult(_0x656054,_0x22f8ba))[_0x7c04('0x42')](handleError(_0x656054,null));};exports[_0x7c04('0x43')]=function(_0xf74853,_0x3da1a8){var _0x116212={'raw':!![],'where':{'id':_0xf74853[_0x7c04('0x44')]['id']}},_0x4e1d2f={};_0x4e1d2f['model']=_[_0x7c04('0x45')](db['JscriptyQuestionReport']['rawAttributes']);_0x4e1d2f['query']=_[_0x7c04('0x45')](_0xf74853['query']);_0x4e1d2f[_0x7c04('0x34')]=_[_0x7c04('0x35')](_0x4e1d2f[_0x7c04('0x32')],_0x4e1d2f[_0x7c04('0x33')]);_0x116212[_0x7c04('0x37')]=_['intersection'](_0x4e1d2f[_0x7c04('0x32')],qs['fields'](_0xf74853[_0x7c04('0x33')][_0x7c04('0x36')]));_0x116212[_0x7c04('0x37')]=_0x116212[_0x7c04('0x37')]['length']?_0x116212[_0x7c04('0x37')]:_0x4e1d2f[_0x7c04('0x32')];if(_0xf74853[_0x7c04('0x33')]['includeAll']){_0x116212['include']=[{'all':!![]}];}_0x116212=_[_0x7c04('0x3e')]({},_0x116212,_0xf74853['options']);return db[_0x7c04('0x2f')][_0x7c04('0x46')](_0x116212)[_0x7c04('0x27')](handleEntityNotFound(_0x3da1a8,null))[_0x7c04('0x27')](respondWithResult(_0x3da1a8,null))[_0x7c04('0x42')](handleError(_0x3da1a8,null));};exports[_0x7c04('0x47')]=function(_0x4be3a0,_0x5594ea){return db[_0x7c04('0x2f')][_0x7c04('0x47')](_0x4be3a0[_0x7c04('0x48')],{})[_0x7c04('0x27')](respondWithResult(_0x5594ea,0xc9))[_0x7c04('0x42')](handleError(_0x5594ea,null));};exports[_0x7c04('0x26')]=function(_0x110347,_0x27daa9){if(_0x110347[_0x7c04('0x48')]['id']){delete _0x110347['body']['id'];}return db['JscriptyQuestionReport'][_0x7c04('0x46')]({'where':{'id':_0x110347[_0x7c04('0x44')]['id']}})[_0x7c04('0x27')](handleEntityNotFound(_0x27daa9,null))[_0x7c04('0x27')](saveUpdates(_0x110347[_0x7c04('0x48')],null))['then'](respondWithResult(_0x27daa9,null))[_0x7c04('0x42')](handleError(_0x27daa9,null));};exports['destroy']=function(_0x12aee8,_0x3148e5){return db[_0x7c04('0x2f')][_0x7c04('0x46')]({'where':{'id':_0x12aee8[_0x7c04('0x44')]['id']}})[_0x7c04('0x27')](handleEntityNotFound(_0x3148e5,null))[_0x7c04('0x27')](removeEntity(_0x3148e5,null))[_0x7c04('0x42')](handleError(_0x3148e5,null));};exports['describe']=function(_0x23d1b1,_0xda0e83){return db['JscriptyQuestionReport'][_0x7c04('0x49')]()[_0x7c04('0x27')](respondWithResult(_0xda0e83,null))[_0x7c04('0x42')](handleError(_0xda0e83,null));}; \ No newline at end of file +var _0xafaf=['type','model','map','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xafaf,0xad));var _0xfafa=function(_0x5d6b1c,_0x137621){_0x5d6b1c=_0x5d6b1c-0x0;var _0xa68806=_0xafaf[_0x5d6b1c];return _0xa68806;};'use strict';var emlformat=require(_0xfafa('0x0'));var rimraf=require(_0xfafa('0x1'));var zipdir=require(_0xfafa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfafa('0x3'));var util=require(_0xfafa('0x4'));var path=require(_0xfafa('0x5'));var sox=require(_0xfafa('0x6'));var csv=require(_0xfafa('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfafa('0x8'));var squel=require(_0xfafa('0x9'));var crypto=require(_0xfafa('0xa'));var jsforce=require(_0xfafa('0xb'));var deskjs=require(_0xfafa('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfafa('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfafa('0xe'));var qs=require(_0xfafa('0xf'));var as=require(_0xfafa('0x10'));var hardwareService=require(_0xfafa('0x11'));var logger=require('../../config/logger')(_0xfafa('0x12'));var utils=require(_0xfafa('0x13'));var config=require(_0xfafa('0x14'));var licenseUtil=require(_0xfafa('0x15'));var db=require(_0xfafa('0x16'))['db'];function respondWithStatusCode(_0x485139,_0x464e41){_0x464e41=_0x464e41||0xcc;return function(_0x2a3984){if(_0x2a3984){return _0x485139[_0xfafa('0x17')](_0x464e41);}return _0x485139[_0xfafa('0x18')](_0x464e41)[_0xfafa('0x19')]();};}function respondWithResult(_0x5307cb,_0x2988e5){_0x2988e5=_0x2988e5||0xc8;return function(_0xc7c3c6){if(_0xc7c3c6){return _0x5307cb[_0xfafa('0x18')](_0x2988e5)['json'](_0xc7c3c6);}};}function respondWithFilteredResult(_0x5033a2,_0x2d789d){return function(_0x24fc33){if(_0x24fc33){var _0x6547f2=typeof _0x2d789d[_0xfafa('0x1a')]===_0xfafa('0x1b')&&typeof _0x2d789d[_0xfafa('0x1c')]===_0xfafa('0x1b');var _0x5d477f=_0x24fc33['count'];var _0x26b60c=_0x6547f2?0x0:_0x2d789d[_0xfafa('0x1a')];var _0x42bdde=_0x6547f2?_0x24fc33[_0xfafa('0x1d')]:_0x2d789d['offset']+_0x2d789d[_0xfafa('0x1c')];var _0x34b03d;if(_0x42bdde>=_0x5d477f){_0x42bdde=_0x5d477f;_0x34b03d=0xc8;}else{_0x34b03d=0xce;}_0x5033a2[_0xfafa('0x18')](_0x34b03d);return _0x5033a2[_0xfafa('0x1e')](_0xfafa('0x1f'),_0x26b60c+'-'+_0x42bdde+'/'+_0x5d477f)[_0xfafa('0x20')](_0x24fc33);}return null;};}function patchUpdates(_0x5d6dbf){return function(_0x3141a2){try{jsonpatch[_0xfafa('0x21')](_0x3141a2,_0x5d6dbf,!![]);}catch(_0x3628e2){return BPromise[_0xfafa('0x22')](_0x3628e2);}return _0x3141a2[_0xfafa('0x23')]();};}function saveUpdates(_0x157e6c,_0x5236d7){return function(_0xc74150){if(_0xc74150){return _0xc74150[_0xfafa('0x24')](_0x157e6c)[_0xfafa('0x25')](function(_0x1a6153){return _0x1a6153;});}return null;};}function removeEntity(_0x3ad3eb,_0x1fa6ec){return function(_0x1ccea0){if(_0x1ccea0){return _0x1ccea0[_0xfafa('0x26')]()[_0xfafa('0x25')](function(){_0x3ad3eb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x555f82,_0x438740){return function(_0x698442){if(!_0x698442){_0x555f82['sendStatus'](0x194);}return _0x698442;};}function handleError(_0x51093e,_0x1c5a9c){_0x1c5a9c=_0x1c5a9c||0x1f4;return function(_0x44429f){logger['error'](_0x44429f[_0xfafa('0x27')]);if(_0x44429f[_0xfafa('0x28')]){delete _0x44429f['name'];}_0x51093e['status'](_0x1c5a9c)[_0xfafa('0x29')](_0x44429f);};}exports[_0xfafa('0x2a')]=function(_0x212f96,_0x508f90){var _0x8ad7ea={},_0x20965f={},_0x549cee={'count':0x0,'rows':[]};var _0x559d40=_['map'](db[_0xfafa('0x2b')][_0xfafa('0x2c')],function(_0x42b536){return{'name':_0x42b536[_0xfafa('0x2d')],'type':_0x42b536[_0xfafa('0x2e')]['key']};});_0x20965f[_0xfafa('0x2f')]=_[_0xfafa('0x30')](_0x559d40,'name');_0x20965f['query']=_[_0xfafa('0x31')](_0x212f96[_0xfafa('0x32')]);_0x20965f[_0xfafa('0x33')]=_[_0xfafa('0x34')](_0x20965f[_0xfafa('0x2f')],_0x20965f[_0xfafa('0x32')]);_0x8ad7ea[_0xfafa('0x35')]=_[_0xfafa('0x34')](_0x20965f[_0xfafa('0x2f')],qs[_0xfafa('0x36')](_0x212f96[_0xfafa('0x32')]['fields']));_0x8ad7ea[_0xfafa('0x35')]=_0x8ad7ea['attributes'][_0xfafa('0x37')]?_0x8ad7ea[_0xfafa('0x35')]:_0x20965f[_0xfafa('0x2f')];if(!_0x212f96[_0xfafa('0x32')]['hasOwnProperty']('nolimit')){_0x8ad7ea[_0xfafa('0x1c')]=qs[_0xfafa('0x1c')](_0x212f96['query']['limit']);_0x8ad7ea['offset']=qs[_0xfafa('0x1a')](_0x212f96['query'][_0xfafa('0x1a')]);}_0x8ad7ea['order']=qs[_0xfafa('0x38')](_0x212f96[_0xfafa('0x32')][_0xfafa('0x38')]);_0x8ad7ea[_0xfafa('0x39')]=qs[_0xfafa('0x33')](_[_0xfafa('0x3a')](_0x212f96[_0xfafa('0x32')],_0x20965f[_0xfafa('0x33')]),_0x559d40);if(_0x212f96[_0xfafa('0x32')]['filter']){_0x8ad7ea['where']=_[_0xfafa('0x3b')](_0x8ad7ea[_0xfafa('0x39')],{'$or':_[_0xfafa('0x30')](_0x559d40,function(_0x55f4a9){if(_0x55f4a9[_0xfafa('0x2e')]!==_0xfafa('0x3c')){var _0x21c74f={};_0x21c74f[_0x55f4a9['name']]={'$like':'%'+_0x212f96[_0xfafa('0x32')][_0xfafa('0x3d')]+'%'};return _0x21c74f;}})});}_0x8ad7ea=_[_0xfafa('0x3b')]({},_0x8ad7ea,_0x212f96[_0xfafa('0x3e')]);var _0x2478b5={'where':_0x8ad7ea[_0xfafa('0x39')]};return db[_0xfafa('0x2b')]['count'](_0x2478b5)[_0xfafa('0x25')](function(_0x816d){_0x549cee[_0xfafa('0x1d')]=_0x816d;if(_0x212f96[_0xfafa('0x32')][_0xfafa('0x3f')]){_0x8ad7ea[_0xfafa('0x40')]=[{'all':!![]}];}return db[_0xfafa('0x2b')]['findAll'](_0x8ad7ea);})['then'](function(_0x163b5b){_0x549cee[_0xfafa('0x41')]=_0x163b5b;return _0x549cee;})[_0xfafa('0x25')](respondWithFilteredResult(_0x508f90,_0x8ad7ea))[_0xfafa('0x42')](handleError(_0x508f90,null));};exports[_0xfafa('0x43')]=function(_0x10e6ae,_0x12ee43){var _0x5fcad={'raw':!![],'where':{'id':_0x10e6ae['params']['id']}},_0x260e1c={};_0x260e1c[_0xfafa('0x2f')]=_[_0xfafa('0x31')](db[_0xfafa('0x2b')][_0xfafa('0x2c')]);_0x260e1c[_0xfafa('0x32')]=_['keys'](_0x10e6ae[_0xfafa('0x32')]);_0x260e1c[_0xfafa('0x33')]=_['intersection'](_0x260e1c[_0xfafa('0x2f')],_0x260e1c[_0xfafa('0x32')]);_0x5fcad[_0xfafa('0x35')]=_['intersection'](_0x260e1c[_0xfafa('0x2f')],qs[_0xfafa('0x36')](_0x10e6ae[_0xfafa('0x32')]['fields']));_0x5fcad[_0xfafa('0x35')]=_0x5fcad['attributes'][_0xfafa('0x37')]?_0x5fcad['attributes']:_0x260e1c[_0xfafa('0x2f')];if(_0x10e6ae['query']['includeAll']){_0x5fcad['include']=[{'all':!![]}];}_0x5fcad=_[_0xfafa('0x3b')]({},_0x5fcad,_0x10e6ae[_0xfafa('0x3e')]);return db['JscriptyQuestionReport'][_0xfafa('0x44')](_0x5fcad)['then'](handleEntityNotFound(_0x12ee43,null))[_0xfafa('0x25')](respondWithResult(_0x12ee43,null))[_0xfafa('0x42')](handleError(_0x12ee43,null));};exports[_0xfafa('0x45')]=function(_0x6980f5,_0x213484){return db['JscriptyQuestionReport'][_0xfafa('0x45')](_0x6980f5[_0xfafa('0x46')],{})[_0xfafa('0x25')](respondWithResult(_0x213484,0xc9))[_0xfafa('0x42')](handleError(_0x213484,null));};exports[_0xfafa('0x24')]=function(_0x2dd204,_0x1c8145){if(_0x2dd204[_0xfafa('0x46')]['id']){delete _0x2dd204[_0xfafa('0x46')]['id'];}return db['JscriptyQuestionReport'][_0xfafa('0x44')]({'where':{'id':_0x2dd204[_0xfafa('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c8145,null))['then'](saveUpdates(_0x2dd204[_0xfafa('0x46')],null))[_0xfafa('0x25')](respondWithResult(_0x1c8145,null))['catch'](handleError(_0x1c8145,null));};exports['destroy']=function(_0xa22c7e,_0x240f6c){return db[_0xfafa('0x2b')][_0xfafa('0x44')]({'where':{'id':_0xa22c7e[_0xfafa('0x47')]['id']}})[_0xfafa('0x25')](handleEntityNotFound(_0x240f6c,null))[_0xfafa('0x25')](removeEntity(_0x240f6c,null))[_0xfafa('0x42')](handleError(_0x240f6c,null));};exports[_0xfafa('0x48')]=function(_0x1642a5,_0x3c0b27){return db['JscriptyQuestionReport'][_0xfafa('0x48')]()['then'](respondWithResult(_0x3c0b27,null))[_0xfafa('0x42')](handleError(_0x3c0b27,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 2a71b81..5825354 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 _0x5d1b=['rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','path'];(function(_0x39cb88,_0x2c77c5){var _0x18880c=function(_0x22c5a5){while(--_0x22c5a5){_0x39cb88['push'](_0x39cb88['shift']());}};_0x18880c(++_0x2c77c5);}(_0x5d1b,0x7e));var _0xb5d1=function(_0xbb6185,_0x98d595){_0xbb6185=_0xbb6185-0x0;var _0x435d96=_0x5d1b[_0xbb6185];return _0x435d96;};'use strict';var _=require(_0xb5d1('0x0'));var util=require(_0xb5d1('0x1'));var logger=require(_0xb5d1('0x2'))(_0xb5d1('0x3'));var moment=require(_0xb5d1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5d1('0x5'));var rimraf=require(_0xb5d1('0x6'));var config=require('../../config/environment');var attributes=require(_0xb5d1('0x7'));module[_0xb5d1('0x8')]=function(_0x165fbc,_0x26bc57){return _0x165fbc[_0xb5d1('0x9')](_0xb5d1('0xa'),attributes,{'tableName':_0xb5d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4ee=['request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc4ee,0x19a));var _0xec4e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4ee[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xec4e('0x0'));var util=require(_0xec4e('0x1'));var logger=require(_0xec4e('0x2'))(_0xec4e('0x3'));var moment=require(_0xec4e('0x4'));var BPromise=require(_0xec4e('0x5'));var rp=require(_0xec4e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec4e('0x7'));var config=require(_0xec4e('0x8'));var attributes=require(_0xec4e('0x9'));module[_0xec4e('0xa')]=function(_0x479e2f,_0x3d6e91){return _0x479e2f['define'](_0xec4e('0xb'),attributes,{'tableName':_0xec4e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 3a32f72..8cadbfd 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 _0x10fd=['JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x18ff75,_0x59469e){var _0x571f9b=function(_0x18a04b){while(--_0x18a04b){_0x18ff75['push'](_0x18ff75['shift']());}};_0x571f9b(++_0x59469e);}(_0x10fd,0x180));var _0xd10f=function(_0x824626,_0x590cd4){_0x824626=_0x824626-0x0;var _0x7247cb=_0x10fd[_0x824626];return _0x7247cb;};'use strict';var _=require(_0xd10f('0x0'));var util=require(_0xd10f('0x1'));var moment=require(_0xd10f('0x2'));var BPromise=require(_0xd10f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd10f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd10f('0x5'))(_0xd10f('0x6'));var config=require('../../config/environment');var jayson=require(_0xd10f('0x7'));var client=jayson[_0xd10f('0x8')][_0xd10f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e04a9,_0x2c7e2f,_0x170d90){return new BPromise(function(_0x29025d,_0x2832c5){return client[_0xd10f('0xa')](_0x4e04a9,_0x170d90)[_0xd10f('0xb')](function(_0x13d6a6){logger['info'](_0xd10f('0xc'),_0x2c7e2f,_0xd10f('0xd'));logger[_0xd10f('0xe')](_0xd10f('0xf'),_0x2c7e2f,_0xd10f('0xd'),JSON['stringify'](_0x13d6a6));if(_0x13d6a6['error']){if(_0x13d6a6[_0xd10f('0x10')][_0xd10f('0x11')]===0x1f4){logger[_0xd10f('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2c7e2f,_0x13d6a6[_0xd10f('0x10')]['message']);return _0x2832c5(_0x13d6a6[_0xd10f('0x10')]['message']);}logger[_0xd10f('0x10')](_0xd10f('0xc'),_0x2c7e2f,_0x13d6a6[_0xd10f('0x10')][_0xd10f('0x12')]);return _0x29025d(_0x13d6a6['error'][_0xd10f('0x12')]);}else{logger[_0xd10f('0x13')](_0xd10f('0xc'),_0x2c7e2f,_0xd10f('0xd'));_0x29025d(_0x13d6a6[_0xd10f('0x14')][_0xd10f('0x12')]);}})[_0xd10f('0x15')](function(_0x5ad47f){logger['error'](_0xd10f('0xc'),_0x2c7e2f,_0x5ad47f);_0x2832c5(_0x5ad47f);});});} \ No newline at end of file +var _0xecea=['request\x20sent','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info'];(function(_0x3a2e7c,_0x48cf83){var _0x1d5e29=function(_0x268e9a){while(--_0x268e9a){_0x3a2e7c['push'](_0x3a2e7c['shift']());}};_0x1d5e29(++_0x48cf83);}(_0xecea,0xce));var _0xaece=function(_0xc5b8cd,_0x2d5417){_0xc5b8cd=_0xc5b8cd-0x0;var _0x4b9c3c=_0xecea[_0xc5b8cd];return _0x4b9c3c;};'use strict';var _=require(_0xaece('0x0'));var util=require(_0xaece('0x1'));var moment=require(_0xaece('0x2'));var BPromise=require(_0xaece('0x3'));var rs=require(_0xaece('0x4'));var fs=require('fs');var Redis=require(_0xaece('0x5'));var db=require(_0xaece('0x6'))['db'];var utils=require(_0xaece('0x7'));var logger=require('../../config/logger')(_0xaece('0x8'));var config=require(_0xaece('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaece('0xa')][_0xaece('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c44c2,_0x132b3d,_0x440cd2){return new BPromise(function(_0x1c3491,_0x3ea1a7){return client[_0xaece('0xc')](_0x3c44c2,_0x440cd2)['then'](function(_0x1493b0){logger[_0xaece('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x132b3d,_0xaece('0xe'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x132b3d,_0xaece('0xe'),JSON[_0xaece('0xf')](_0x1493b0));if(_0x1493b0['error']){if(_0x1493b0[_0xaece('0x10')]['code']===0x1f4){logger[_0xaece('0x10')](_0xaece('0x11'),_0x132b3d,_0x1493b0[_0xaece('0x10')][_0xaece('0x12')]);return _0x3ea1a7(_0x1493b0['error'][_0xaece('0x12')]);}logger[_0xaece('0x10')](_0xaece('0x11'),_0x132b3d,_0x1493b0[_0xaece('0x10')][_0xaece('0x12')]);return _0x1c3491(_0x1493b0['error']['message']);}else{logger['info'](_0xaece('0x11'),_0x132b3d,_0xaece('0xe'));_0x1c3491(_0x1493b0['result'][_0xaece('0x12')]);}})[_0xaece('0x13')](function(_0x488823){logger[_0xaece('0x10')](_0xaece('0x11'),_0x132b3d,_0x488823);_0x3ea1a7(_0x488823);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index a71eac4..5c5486d 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 _0xb240=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','show','/:id/questions','getQuestions'];(function(_0x22f82f,_0x5bbe0c){var _0x160ef9=function(_0x36c0c5){while(--_0x36c0c5){_0x22f82f['push'](_0x22f82f['shift']());}};_0x160ef9(++_0x5bbe0c);}(_0xb240,0x84));var _0x0b24=function(_0x26afab,_0x1ba471){_0x26afab=_0x26afab-0x0;var _0x32a36f=_0xb240[_0x26afab];return _0x32a36f;};'use strict';var multer=require(_0x0b24('0x0'));var util=require(_0x0b24('0x1'));var path=require(_0x0b24('0x2'));var timeout=require(_0x0b24('0x3'));var express=require('express');var router=express[_0x0b24('0x4')]();var fs_extra=require(_0x0b24('0x5'));var auth=require(_0x0b24('0x6'));var interaction=require(_0x0b24('0x7'));var config=require(_0x0b24('0x8'));var controller=require(_0x0b24('0x9'));router[_0x0b24('0xa')]('/',auth[_0x0b24('0xb')](),controller[_0x0b24('0xc')]);router[_0x0b24('0xa')]('/describe',auth[_0x0b24('0xb')](),controller[_0x0b24('0xd')]);router[_0x0b24('0xa')](_0x0b24('0xe'),auth[_0x0b24('0xb')](),controller[_0x0b24('0xf')]);router[_0x0b24('0xa')](_0x0b24('0x10'),auth[_0x0b24('0xb')](),controller[_0x0b24('0x11')]);router[_0x0b24('0x12')]('/',auth[_0x0b24('0xb')](),controller[_0x0b24('0x13')]);router[_0x0b24('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x0b24('0x15')]);router[_0x0b24('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x0b24('0x17')]);module[_0x0b24('0x18')]=router; \ No newline at end of file +var _0x19e7=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','post','create','delete','destroy','exports','multer'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x19e7,0xfb));var _0x719e=function(_0x18e74c,_0xbbf1c7){_0x18e74c=_0x18e74c-0x0;var _0x35ae0e=_0x19e7[_0x18e74c];return _0x35ae0e;};'use strict';var multer=require(_0x719e('0x0'));var util=require('util');var path=require(_0x719e('0x1'));var timeout=require('connect-timeout');var express=require(_0x719e('0x2'));var router=express[_0x719e('0x3')]();var fs_extra=require(_0x719e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x719e('0x5'));var config=require(_0x719e('0x6'));var controller=require(_0x719e('0x7'));router[_0x719e('0x8')]('/',auth[_0x719e('0x9')](),controller[_0x719e('0xa')]);router['get'](_0x719e('0xb'),auth[_0x719e('0x9')](),controller[_0x719e('0xc')]);router[_0x719e('0x8')](_0x719e('0xd'),auth['isAuthenticated'](),controller[_0x719e('0xe')]);router[_0x719e('0x8')](_0x719e('0xf'),auth[_0x719e('0x9')](),controller['getQuestions']);router[_0x719e('0x10')]('/',auth['isAuthenticated'](),controller[_0x719e('0x11')]);router['put'](_0x719e('0xd'),auth[_0x719e('0x9')](),controller['update']);router[_0x719e('0x12')]('/:id',auth[_0x719e('0x9')](),controller[_0x719e('0x13')]);module[_0x719e('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index a67642f..b66be64 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 _0x3d74=['BOOLEAN','moment','sequelize','exports','DATE','starttime','endtime','STRING'];(function(_0x5bbd5e,_0x149754){var _0x9b678c=function(_0x3b2bd1){while(--_0x3b2bd1){_0x5bbd5e['push'](_0x5bbd5e['shift']());}};_0x9b678c(++_0x149754);}(_0x3d74,0x149));var _0x43d7=function(_0x1d0f4f,_0x402963){_0x1d0f4f=_0x1d0f4f-0x0;var _0x47645b=_0x3d74[_0x1d0f4f];return _0x47645b;};'use strict';var moment=require(_0x43d7('0x0'));var Sequelize=require(_0x43d7('0x1'));module[_0x43d7('0x2')]={'starttime':{'type':Sequelize[_0x43d7('0x3')],'set':function(_0x1606e7){this['setDataValue'](_0x43d7('0x4'),_0x1606e7);this['setDataValue'](_0x43d7('0x5'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x43d7('0x3')]},'membername':{'type':Sequelize[_0x43d7('0x6')]},'projectname':{'type':Sequelize[_0x43d7('0x6')]},'queue':{'type':Sequelize[_0x43d7('0x6')]},'uniqueid':{'type':Sequelize[_0x43d7('0x6')]},'calleridname':{'type':Sequelize[_0x43d7('0x6')]},'calleridnum':{'type':Sequelize[_0x43d7('0x6')]},'completed':{'type':Sequelize[_0x43d7('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xed35=['YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','DATE','setDataValue','endtime'];(function(_0xb8aa3d,_0xad08f6){var _0x180207=function(_0x906b00){while(--_0x906b00){_0xb8aa3d['push'](_0xb8aa3d['shift']());}};_0x180207(++_0xad08f6);}(_0xed35,0xaa));var _0x5ed3=function(_0xf1a4c1,_0x4f0a7d){_0xf1a4c1=_0xf1a4c1-0x0;var _0x2fc187=_0xed35[_0xf1a4c1];return _0x2fc187;};'use strict';var moment=require(_0x5ed3('0x0'));var Sequelize=require(_0x5ed3('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x5ed3('0x2')],'set':function(_0x1a798b){this['setDataValue']('starttime',_0x1a798b);this[_0x5ed3('0x3')](_0x5ed3('0x4'),moment()['format'](_0x5ed3('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x5ed3('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5ed3('0x6')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5ed3('0x6')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 25aa1d4..944712b 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 _0x634a=['../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','end','name','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','describe','getQuestions','JscriptyQuestionReport','length','nolimit','order','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x634a,0x11f));var _0xa634=function(_0x49854b,_0x32700f){_0x49854b=_0x49854b-0x0;var _0x4dcccf=_0x634a[_0x49854b];return _0x4dcccf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa634('0x0'));var zipdir=require(_0xa634('0x1'));var jsonpatch=require(_0xa634('0x2'));var rp=require('request-promise');var moment=require(_0xa634('0x3'));var BPromise=require(_0xa634('0x4'));var Mustache=require(_0xa634('0x5'));var util=require(_0xa634('0x6'));var path=require(_0xa634('0x7'));var sox=require('sox');var csv=require(_0xa634('0x8'));var ejs=require(_0xa634('0x9'));var fs=require('fs');var fs_extra=require(_0xa634('0xa'));var _=require(_0xa634('0xb'));var squel=require(_0xa634('0xc'));var crypto=require(_0xa634('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa634('0xe'));var toCsv=require(_0xa634('0x8'));var querystring=require(_0xa634('0xf'));var Papa=require(_0xa634('0x10'));var Redis=require(_0xa634('0x11'));var authService=require(_0xa634('0x12'));var qs=require(_0xa634('0x13'));var as=require(_0xa634('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa634('0x15'))(_0xa634('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa634('0x17'));var db=require(_0xa634('0x18'))['db'];function respondWithStatusCode(_0x197660,_0x10a18a){_0x10a18a=_0x10a18a||0xcc;return function(_0x45bc07){if(_0x45bc07){return _0x197660[_0xa634('0x19')](_0x10a18a);}return _0x197660[_0xa634('0x1a')](_0x10a18a)['end']();};}function respondWithResult(_0x9e8486,_0x5745dd){_0x5745dd=_0x5745dd||0xc8;return function(_0x1b8491){if(_0x1b8491){return _0x9e8486[_0xa634('0x1a')](_0x5745dd)[_0xa634('0x1b')](_0x1b8491);}};}function respondWithFilteredResult(_0x4d848a,_0x7a7ad4){return function(_0xfd5ac4){if(_0xfd5ac4){var _0x4eb59a=typeof _0x7a7ad4[_0xa634('0x1c')]===_0xa634('0x1d')&&typeof _0x7a7ad4[_0xa634('0x1e')]==='undefined';var _0x37dbf3=_0xfd5ac4['count'];var _0x5202af=_0x4eb59a?0x0:_0x7a7ad4[_0xa634('0x1c')];var _0x32a698=_0x4eb59a?_0xfd5ac4[_0xa634('0x1f')]:_0x7a7ad4[_0xa634('0x1c')]+_0x7a7ad4['limit'];var _0x584ab1;if(_0x32a698>=_0x37dbf3){_0x32a698=_0x37dbf3;_0x584ab1=0xc8;}else{_0x584ab1=0xce;}_0x4d848a[_0xa634('0x1a')](_0x584ab1);return _0x4d848a[_0xa634('0x20')](_0xa634('0x21'),_0x5202af+'-'+_0x32a698+'/'+_0x37dbf3)[_0xa634('0x1b')](_0xfd5ac4);}return null;};}function patchUpdates(_0x42c5ad){return function(_0x4e4fdf){try{jsonpatch[_0xa634('0x22')](_0x4e4fdf,_0x42c5ad,!![]);}catch(_0x34ddaf){return BPromise[_0xa634('0x23')](_0x34ddaf);}return _0x4e4fdf['save']();};}function saveUpdates(_0x5a716c,_0x3aadbd){return function(_0x4e47a0){if(_0x4e47a0){return _0x4e47a0['update'](_0x5a716c)[_0xa634('0x24')](function(_0x5cf83e){return _0x5cf83e;});}return null;};}function removeEntity(_0x412bc5,_0x85b59d){return function(_0x1fc849){if(_0x1fc849){return _0x1fc849['destroy']()[_0xa634('0x24')](function(){_0x412bc5['status'](0xcc)[_0xa634('0x25')]();});}};}function handleEntityNotFound(_0x55889e,_0x2b0621){return function(_0xb06195){if(!_0xb06195){_0x55889e['sendStatus'](0x194);}return _0xb06195;};}function handleError(_0x1c4d7f,_0x576c4e){_0x576c4e=_0x576c4e||0x1f4;return function(_0x33a404){logger['error'](_0x33a404['stack']);if(_0x33a404[_0xa634('0x26')]){delete _0x33a404[_0xa634('0x26')];}_0x1c4d7f[_0xa634('0x1a')](_0x576c4e)['send'](_0x33a404);};}exports[_0xa634('0x27')]=function(_0x53bc67,_0x58e5e){var _0x225db3={},_0x460fce={},_0x1b9eca={'count':0x0,'rows':[]};var _0x25e85d=_[_0xa634('0x28')](db[_0xa634('0x29')][_0xa634('0x2a')],function(_0x132557){return{'name':_0x132557[_0xa634('0x2b')],'type':_0x132557[_0xa634('0x2c')][_0xa634('0x2d')]};});_0x460fce['model']=_[_0xa634('0x28')](_0x25e85d,_0xa634('0x26'));_0x460fce[_0xa634('0x2e')]=_[_0xa634('0x2f')](_0x53bc67[_0xa634('0x2e')]);_0x460fce[_0xa634('0x30')]=_[_0xa634('0x31')](_0x460fce[_0xa634('0x32')],_0x460fce[_0xa634('0x2e')]);_0x225db3['attributes']=_[_0xa634('0x31')](_0x460fce[_0xa634('0x32')],qs[_0xa634('0x33')](_0x53bc67['query'][_0xa634('0x33')]));_0x225db3['attributes']=_0x225db3[_0xa634('0x34')]['length']?_0x225db3['attributes']:_0x460fce[_0xa634('0x32')];if(!_0x53bc67[_0xa634('0x2e')][_0xa634('0x35')]('nolimit')){_0x225db3[_0xa634('0x1e')]=qs[_0xa634('0x1e')](_0x53bc67[_0xa634('0x2e')][_0xa634('0x1e')]);_0x225db3['offset']=qs[_0xa634('0x1c')](_0x53bc67[_0xa634('0x2e')][_0xa634('0x1c')]);}_0x225db3['order']=qs['sort'](_0x53bc67[_0xa634('0x2e')][_0xa634('0x36')]);_0x225db3[_0xa634('0x37')]=qs[_0xa634('0x30')](_[_0xa634('0x38')](_0x53bc67[_0xa634('0x2e')],_0x460fce[_0xa634('0x30')]),_0x25e85d);if(_0x53bc67['query'][_0xa634('0x39')]){_0x225db3[_0xa634('0x37')]=_[_0xa634('0x3a')](_0x225db3[_0xa634('0x37')],{'$or':_[_0xa634('0x28')](_0x25e85d,function(_0x57d264){if(_0x57d264[_0xa634('0x2c')]!==_0xa634('0x3b')){var _0x1b8887={};_0x1b8887[_0x57d264[_0xa634('0x26')]]={'$like':'%'+_0x53bc67[_0xa634('0x2e')][_0xa634('0x39')]+'%'};return _0x1b8887;}})});}_0x225db3=_[_0xa634('0x3a')]({},_0x225db3,_0x53bc67[_0xa634('0x3c')]);var _0x267c82={'where':_0x225db3['where']};return db['JscriptySessionReport']['count'](_0x267c82)[_0xa634('0x24')](function(_0x11159f){_0x1b9eca[_0xa634('0x1f')]=_0x11159f;if(_0x53bc67[_0xa634('0x2e')][_0xa634('0x3d')]){_0x225db3[_0xa634('0x3e')]=[{'all':!![]}];}return db[_0xa634('0x29')][_0xa634('0x3f')](_0x225db3);})[_0xa634('0x24')](function(_0x4f4b5a){_0x1b9eca['rows']=_0x4f4b5a;return _0x1b9eca;})['then'](respondWithFilteredResult(_0x58e5e,_0x225db3))[_0xa634('0x40')](handleError(_0x58e5e,null));};exports[_0xa634('0x41')]=function(_0x2522e6,_0x455a27){var _0x291b76={'raw':!![],'where':{'id':_0x2522e6[_0xa634('0x42')]['id']}},_0x5b0037={};_0x5b0037[_0xa634('0x32')]=_[_0xa634('0x2f')](db[_0xa634('0x29')][_0xa634('0x2a')]);_0x5b0037[_0xa634('0x2e')]=_['keys'](_0x2522e6[_0xa634('0x2e')]);_0x5b0037['filters']=_['intersection'](_0x5b0037[_0xa634('0x32')],_0x5b0037['query']);_0x291b76[_0xa634('0x34')]=_[_0xa634('0x31')](_0x5b0037[_0xa634('0x32')],qs[_0xa634('0x33')](_0x2522e6[_0xa634('0x2e')]['fields']));_0x291b76[_0xa634('0x34')]=_0x291b76['attributes']['length']?_0x291b76[_0xa634('0x34')]:_0x5b0037[_0xa634('0x32')];if(_0x2522e6[_0xa634('0x2e')][_0xa634('0x3d')]){_0x291b76[_0xa634('0x3e')]=[{'all':!![]}];}_0x291b76=_['merge']({},_0x291b76,_0x2522e6[_0xa634('0x3c')]);return db[_0xa634('0x29')][_0xa634('0x43')](_0x291b76)[_0xa634('0x24')](handleEntityNotFound(_0x455a27,null))[_0xa634('0x24')](respondWithResult(_0x455a27,null))[_0xa634('0x40')](handleError(_0x455a27,null));};exports[_0xa634('0x44')]=function(_0x2afc46,_0x26ec1c){return db[_0xa634('0x29')]['create'](_0x2afc46[_0xa634('0x45')],{})[_0xa634('0x24')](respondWithResult(_0x26ec1c,0xc9))['catch'](handleError(_0x26ec1c,null));};exports['update']=function(_0x3c648f,_0x1a19b8){if(_0x3c648f[_0xa634('0x45')]['id']){delete _0x3c648f[_0xa634('0x45')]['id'];}return db[_0xa634('0x29')][_0xa634('0x43')]({'where':{'id':_0x3c648f[_0xa634('0x42')]['id']}})[_0xa634('0x24')](handleEntityNotFound(_0x1a19b8,null))['then'](saveUpdates(_0x3c648f['body'],null))[_0xa634('0x24')](respondWithResult(_0x1a19b8,null))[_0xa634('0x40')](handleError(_0x1a19b8,null));};exports[_0xa634('0x46')]=function(_0x935120,_0x1a04f5){return db[_0xa634('0x29')][_0xa634('0x43')]({'where':{'id':_0x935120[_0xa634('0x42')]['id']}})[_0xa634('0x24')](handleEntityNotFound(_0x1a04f5,null))[_0xa634('0x24')](removeEntity(_0x1a04f5,null))[_0xa634('0x40')](handleError(_0x1a04f5,null));};exports[_0xa634('0x47')]=function(_0x2d70c5,_0x585354){return db[_0xa634('0x29')]['describe']()[_0xa634('0x24')](respondWithResult(_0x585354,null))[_0xa634('0x40')](handleError(_0x585354,null));};exports[_0xa634('0x48')]=function(_0x17b457,_0x4bc75e,_0x3c8eb2){var _0xf14feb={'raw':!![],'where':{}};var _0xe725af={};var _0x56a218={'count':0x0,'rows':[]};return db[_0xa634('0x29')]['findOne']({'where':{'id':_0x17b457['params']['id']}})['then'](handleEntityNotFound(_0x4bc75e,null))[_0xa634('0x24')](function(_0x525e02){if(_0x525e02){_0xe725af['model']=_[_0xa634('0x2f')](db[_0xa634('0x49')]['rawAttributes']);_0xe725af[_0xa634('0x2e')]=_[_0xa634('0x2f')](_0x17b457[_0xa634('0x2e')]);_0xe725af[_0xa634('0x30')]=_[_0xa634('0x31')](_0xe725af[_0xa634('0x32')],_0xe725af[_0xa634('0x2e')]);_0xf14feb[_0xa634('0x34')]=_[_0xa634('0x31')](_0xe725af[_0xa634('0x32')],qs['fields'](_0x17b457[_0xa634('0x2e')][_0xa634('0x33')]));_0xf14feb['attributes']=_0xf14feb['attributes'][_0xa634('0x4a')]?_0xf14feb[_0xa634('0x34')]:_0xe725af[_0xa634('0x32')];if(!_0x17b457[_0xa634('0x2e')][_0xa634('0x35')](_0xa634('0x4b'))){_0xf14feb[_0xa634('0x1e')]=qs['limit'](_0x17b457[_0xa634('0x2e')][_0xa634('0x1e')]);_0xf14feb[_0xa634('0x1c')]=qs[_0xa634('0x1c')](_0x17b457[_0xa634('0x2e')][_0xa634('0x1c')]);}_0xf14feb[_0xa634('0x4c')]=qs[_0xa634('0x36')](_0x17b457[_0xa634('0x2e')]['sort']);_0xf14feb[_0xa634('0x37')]=qs[_0xa634('0x30')](_[_0xa634('0x38')](_0x17b457[_0xa634('0x2e')],_0xe725af[_0xa634('0x30')]));_0xf14feb['where']['SessionId']=_0x525e02['id'];if(_0x17b457[_0xa634('0x2e')][_0xa634('0x39')]){_0xf14feb[_0xa634('0x37')]=_[_0xa634('0x3a')](_0xf14feb[_0xa634('0x37')],{'$or':_['map'](_0xf14feb[_0xa634('0x34')],function(_0x537c1d){var _0x54a1e4={};_0x54a1e4[_0x537c1d]={'$like':'%'+_0x17b457[_0xa634('0x2e')][_0xa634('0x39')]+'%'};return _0x54a1e4;})});}_0xf14feb=_[_0xa634('0x3a')]({},_0xf14feb,_0x17b457[_0xa634('0x3c')]);return db[_0xa634('0x49')][_0xa634('0x1f')]({'where':_0xf14feb[_0xa634('0x37')]})[_0xa634('0x24')](function(_0x545ad5){_0x56a218[_0xa634('0x1f')]=_0x545ad5;if(_0x17b457[_0xa634('0x2e')]['includeAll']){_0xf14feb[_0xa634('0x3e')]=[{'all':!![]}];}return db[_0xa634('0x49')]['findAll'](_0xf14feb);})['then'](function(_0x4a916e){_0x56a218['rows']=_0x4a916e;return _0x56a218;});}})[_0xa634('0x24')](respondWithFilteredResult(_0x4bc75e,_0xf14feb))[_0xa634('0x40')](handleError(_0x4bc75e,null));}; \ No newline at end of file +var _0x7343=['findAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','map','JscriptySessionReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','include','catch','show','params','merge','create','body','find','describe','findOne','JscriptyQuestionReport','pick','options'];(function(_0x5d81ea,_0x4595e3){var _0x3f20d4=function(_0x3dd267){while(--_0x3dd267){_0x5d81ea['push'](_0x5d81ea['shift']());}};_0x3f20d4(++_0x4595e3);}(_0x7343,0xa1));var _0x3734=function(_0x3f6511,_0x424c61){_0x3f6511=_0x3f6511-0x0;var _0x1e6b63=_0x7343[_0x3f6511];return _0x1e6b63;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3734('0x0'));var jsonpatch=require(_0x3734('0x1'));var rp=require(_0x3734('0x2'));var moment=require(_0x3734('0x3'));var BPromise=require(_0x3734('0x4'));var Mustache=require('mustache');var util=require(_0x3734('0x5'));var path=require('path');var sox=require(_0x3734('0x6'));var csv=require(_0x3734('0x7'));var ejs=require(_0x3734('0x8'));var fs=require('fs');var fs_extra=require(_0x3734('0x9'));var _=require(_0x3734('0xa'));var squel=require(_0x3734('0xb'));var crypto=require(_0x3734('0xc'));var jsforce=require(_0x3734('0xd'));var deskjs=require(_0x3734('0xe'));var toCsv=require(_0x3734('0x7'));var querystring=require('querystring');var Papa=require(_0x3734('0xf'));var Redis=require('ioredis');var authService=require(_0x3734('0x10'));var qs=require(_0x3734('0x11'));var as=require(_0x3734('0x12'));var hardwareService=require(_0x3734('0x13'));var logger=require(_0x3734('0x14'))('api');var utils=require(_0x3734('0x15'));var config=require(_0x3734('0x16'));var licenseUtil=require(_0x3734('0x17'));var db=require(_0x3734('0x18'))['db'];function respondWithStatusCode(_0x54e3fd,_0x4f2fb5){_0x4f2fb5=_0x4f2fb5||0xcc;return function(_0x2e9218){if(_0x2e9218){return _0x54e3fd[_0x3734('0x19')](_0x4f2fb5);}return _0x54e3fd[_0x3734('0x1a')](_0x4f2fb5)[_0x3734('0x1b')]();};}function respondWithResult(_0x1792c0,_0x1a64d5){_0x1a64d5=_0x1a64d5||0xc8;return function(_0x33862a){if(_0x33862a){return _0x1792c0[_0x3734('0x1a')](_0x1a64d5)['json'](_0x33862a);}};}function respondWithFilteredResult(_0x4374ad,_0x8b1842){return function(_0x431443){if(_0x431443){var _0x59434d=typeof _0x8b1842[_0x3734('0x1c')]==='undefined'&&typeof _0x8b1842[_0x3734('0x1d')]===_0x3734('0x1e');var _0x3e6b6a=_0x431443[_0x3734('0x1f')];var _0x5c8515=_0x59434d?0x0:_0x8b1842[_0x3734('0x1c')];var _0x9b4d68=_0x59434d?_0x431443[_0x3734('0x1f')]:_0x8b1842[_0x3734('0x1c')]+_0x8b1842[_0x3734('0x1d')];var _0x16824d;if(_0x9b4d68>=_0x3e6b6a){_0x9b4d68=_0x3e6b6a;_0x16824d=0xc8;}else{_0x16824d=0xce;}_0x4374ad[_0x3734('0x1a')](_0x16824d);return _0x4374ad[_0x3734('0x20')](_0x3734('0x21'),_0x5c8515+'-'+_0x9b4d68+'/'+_0x3e6b6a)[_0x3734('0x22')](_0x431443);}return null;};}function patchUpdates(_0x22f77b){return function(_0x9c6b21){try{jsonpatch[_0x3734('0x23')](_0x9c6b21,_0x22f77b,!![]);}catch(_0x413c80){return BPromise[_0x3734('0x24')](_0x413c80);}return _0x9c6b21[_0x3734('0x25')]();};}function saveUpdates(_0x54c119,_0x37afbb){return function(_0x116c97){if(_0x116c97){return _0x116c97[_0x3734('0x26')](_0x54c119)[_0x3734('0x27')](function(_0x4d933c){return _0x4d933c;});}return null;};}function removeEntity(_0x6b7ad7,_0x54e142){return function(_0x4741c5){if(_0x4741c5){return _0x4741c5[_0x3734('0x28')]()[_0x3734('0x27')](function(){_0x6b7ad7[_0x3734('0x1a')](0xcc)[_0x3734('0x1b')]();});}};}function handleEntityNotFound(_0x20eba8,_0x1814e6){return function(_0x5bdb2a){if(!_0x5bdb2a){_0x20eba8[_0x3734('0x19')](0x194);}return _0x5bdb2a;};}function handleError(_0x18f157,_0x232065){_0x232065=_0x232065||0x1f4;return function(_0x10f33d){logger[_0x3734('0x29')](_0x10f33d['stack']);if(_0x10f33d[_0x3734('0x2a')]){delete _0x10f33d['name'];}_0x18f157['status'](_0x232065)['send'](_0x10f33d);};}exports[_0x3734('0x2b')]=function(_0x59a7de,_0x4cde92){var _0x532770={},_0x4fec52={},_0x169c0d={'count':0x0,'rows':[]};var _0x2c5cf2=_[_0x3734('0x2c')](db[_0x3734('0x2d')][_0x3734('0x2e')],function(_0x198bcf){return{'name':_0x198bcf[_0x3734('0x2f')],'type':_0x198bcf['type'][_0x3734('0x30')]};});_0x4fec52['model']=_[_0x3734('0x2c')](_0x2c5cf2,'name');_0x4fec52[_0x3734('0x31')]=_[_0x3734('0x32')](_0x59a7de[_0x3734('0x31')]);_0x4fec52[_0x3734('0x33')]=_[_0x3734('0x34')](_0x4fec52[_0x3734('0x35')],_0x4fec52[_0x3734('0x31')]);_0x532770['attributes']=_['intersection'](_0x4fec52[_0x3734('0x35')],qs[_0x3734('0x36')](_0x59a7de[_0x3734('0x31')][_0x3734('0x36')]));_0x532770['attributes']=_0x532770[_0x3734('0x37')][_0x3734('0x38')]?_0x532770[_0x3734('0x37')]:_0x4fec52['model'];if(!_0x59a7de[_0x3734('0x31')][_0x3734('0x39')](_0x3734('0x3a'))){_0x532770[_0x3734('0x1d')]=qs[_0x3734('0x1d')](_0x59a7de[_0x3734('0x31')]['limit']);_0x532770[_0x3734('0x1c')]=qs[_0x3734('0x1c')](_0x59a7de[_0x3734('0x31')][_0x3734('0x1c')]);}_0x532770[_0x3734('0x3b')]=qs[_0x3734('0x3c')](_0x59a7de['query'][_0x3734('0x3c')]);_0x532770[_0x3734('0x3d')]=qs[_0x3734('0x33')](_['pick'](_0x59a7de['query'],_0x4fec52[_0x3734('0x33')]),_0x2c5cf2);if(_0x59a7de[_0x3734('0x31')][_0x3734('0x3e')]){_0x532770[_0x3734('0x3d')]=_['merge'](_0x532770[_0x3734('0x3d')],{'$or':_[_0x3734('0x2c')](_0x2c5cf2,function(_0x276ae3){if(_0x276ae3[_0x3734('0x3f')]!==_0x3734('0x40')){var _0x53562b={};_0x53562b[_0x276ae3[_0x3734('0x2a')]]={'$like':'%'+_0x59a7de['query']['filter']+'%'};return _0x53562b;}})});}_0x532770=_['merge']({},_0x532770,_0x59a7de['options']);var _0x491d79={'where':_0x532770[_0x3734('0x3d')]};return db[_0x3734('0x2d')]['count'](_0x491d79)[_0x3734('0x27')](function(_0x164861){_0x169c0d['count']=_0x164861;if(_0x59a7de[_0x3734('0x31')][_0x3734('0x41')]){_0x532770[_0x3734('0x42')]=[{'all':!![]}];}return db[_0x3734('0x2d')]['findAll'](_0x532770);})[_0x3734('0x27')](function(_0x486cfb){_0x169c0d['rows']=_0x486cfb;return _0x169c0d;})[_0x3734('0x27')](respondWithFilteredResult(_0x4cde92,_0x532770))[_0x3734('0x43')](handleError(_0x4cde92,null));};exports[_0x3734('0x44')]=function(_0x2d5b83,_0x487198){var _0x4b4227={'raw':!![],'where':{'id':_0x2d5b83[_0x3734('0x45')]['id']}},_0x38f92d={};_0x38f92d['model']=_[_0x3734('0x32')](db[_0x3734('0x2d')][_0x3734('0x2e')]);_0x38f92d[_0x3734('0x31')]=_[_0x3734('0x32')](_0x2d5b83[_0x3734('0x31')]);_0x38f92d[_0x3734('0x33')]=_['intersection'](_0x38f92d[_0x3734('0x35')],_0x38f92d[_0x3734('0x31')]);_0x4b4227['attributes']=_[_0x3734('0x34')](_0x38f92d['model'],qs[_0x3734('0x36')](_0x2d5b83[_0x3734('0x31')][_0x3734('0x36')]));_0x4b4227[_0x3734('0x37')]=_0x4b4227[_0x3734('0x37')]['length']?_0x4b4227[_0x3734('0x37')]:_0x38f92d[_0x3734('0x35')];if(_0x2d5b83[_0x3734('0x31')]['includeAll']){_0x4b4227['include']=[{'all':!![]}];}_0x4b4227=_[_0x3734('0x46')]({},_0x4b4227,_0x2d5b83['options']);return db['JscriptySessionReport']['find'](_0x4b4227)[_0x3734('0x27')](handleEntityNotFound(_0x487198,null))['then'](respondWithResult(_0x487198,null))['catch'](handleError(_0x487198,null));};exports[_0x3734('0x47')]=function(_0x3ec44b,_0x44e557){return db[_0x3734('0x2d')][_0x3734('0x47')](_0x3ec44b[_0x3734('0x48')],{})[_0x3734('0x27')](respondWithResult(_0x44e557,0xc9))[_0x3734('0x43')](handleError(_0x44e557,null));};exports['update']=function(_0xd68298,_0x6718ee){if(_0xd68298[_0x3734('0x48')]['id']){delete _0xd68298[_0x3734('0x48')]['id'];}return db['JscriptySessionReport'][_0x3734('0x49')]({'where':{'id':_0xd68298[_0x3734('0x45')]['id']}})[_0x3734('0x27')](handleEntityNotFound(_0x6718ee,null))[_0x3734('0x27')](saveUpdates(_0xd68298[_0x3734('0x48')],null))[_0x3734('0x27')](respondWithResult(_0x6718ee,null))['catch'](handleError(_0x6718ee,null));};exports[_0x3734('0x28')]=function(_0x9d6dc4,_0x14a819){return db[_0x3734('0x2d')][_0x3734('0x49')]({'where':{'id':_0x9d6dc4[_0x3734('0x45')]['id']}})['then'](handleEntityNotFound(_0x14a819,null))[_0x3734('0x27')](removeEntity(_0x14a819,null))['catch'](handleError(_0x14a819,null));};exports['describe']=function(_0x4b7e65,_0x22c9c8){return db[_0x3734('0x2d')][_0x3734('0x4a')]()[_0x3734('0x27')](respondWithResult(_0x22c9c8,null))[_0x3734('0x43')](handleError(_0x22c9c8,null));};exports['getQuestions']=function(_0x199872,_0x8d158a,_0x4cf338){var _0x7183dc={'raw':!![],'where':{}};var _0x1fd743={};var _0x189668={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x3734('0x4b')]({'where':{'id':_0x199872[_0x3734('0x45')]['id']}})['then'](handleEntityNotFound(_0x8d158a,null))[_0x3734('0x27')](function(_0x35240b){if(_0x35240b){_0x1fd743[_0x3734('0x35')]=_[_0x3734('0x32')](db[_0x3734('0x4c')][_0x3734('0x2e')]);_0x1fd743['query']=_['keys'](_0x199872[_0x3734('0x31')]);_0x1fd743['filters']=_[_0x3734('0x34')](_0x1fd743[_0x3734('0x35')],_0x1fd743[_0x3734('0x31')]);_0x7183dc[_0x3734('0x37')]=_['intersection'](_0x1fd743[_0x3734('0x35')],qs[_0x3734('0x36')](_0x199872[_0x3734('0x31')]['fields']));_0x7183dc[_0x3734('0x37')]=_0x7183dc[_0x3734('0x37')][_0x3734('0x38')]?_0x7183dc['attributes']:_0x1fd743[_0x3734('0x35')];if(!_0x199872[_0x3734('0x31')]['hasOwnProperty'](_0x3734('0x3a'))){_0x7183dc[_0x3734('0x1d')]=qs['limit'](_0x199872[_0x3734('0x31')][_0x3734('0x1d')]);_0x7183dc[_0x3734('0x1c')]=qs[_0x3734('0x1c')](_0x199872[_0x3734('0x31')][_0x3734('0x1c')]);}_0x7183dc[_0x3734('0x3b')]=qs['sort'](_0x199872[_0x3734('0x31')]['sort']);_0x7183dc[_0x3734('0x3d')]=qs[_0x3734('0x33')](_[_0x3734('0x4d')](_0x199872[_0x3734('0x31')],_0x1fd743['filters']));_0x7183dc[_0x3734('0x3d')]['SessionId']=_0x35240b['id'];if(_0x199872['query']['filter']){_0x7183dc['where']=_['merge'](_0x7183dc['where'],{'$or':_['map'](_0x7183dc[_0x3734('0x37')],function(_0x4a9912){var _0x964e8a={};_0x964e8a[_0x4a9912]={'$like':'%'+_0x199872[_0x3734('0x31')][_0x3734('0x3e')]+'%'};return _0x964e8a;})});}_0x7183dc=_['merge']({},_0x7183dc,_0x199872[_0x3734('0x4e')]);return db[_0x3734('0x4c')]['count']({'where':_0x7183dc[_0x3734('0x3d')]})['then'](function(_0x395fbe){_0x189668['count']=_0x395fbe;if(_0x199872[_0x3734('0x31')][_0x3734('0x41')]){_0x7183dc['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x3734('0x4f')](_0x7183dc);})[_0x3734('0x27')](function(_0x427b02){_0x189668['rows']=_0x427b02;return _0x189668;});}})[_0x3734('0x27')](respondWithFilteredResult(_0x8d158a,_0x7183dc))[_0x3734('0x43')](handleError(_0x8d158a,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 2b0143b..4b205f3 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 _0x2eb2=['moment','bluebird','request-promise','rimraf','exports','define','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger','api'];(function(_0x533064,_0x84cbbd){var _0xa16d1a=function(_0x3b3bb0){while(--_0x3b3bb0){_0x533064['push'](_0x533064['shift']());}};_0xa16d1a(++_0x84cbbd);}(_0x2eb2,0x19f));var _0x22eb=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x2eb2[_0x25bea7];return _0x175952;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x22eb('0x7')]=function(_0x10e116,_0x35dd5b){return _0x10e116[_0x22eb('0x8')](_0x22eb('0x9'),attributes,{'tableName':_0x22eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb138=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x410976,_0x978343){var _0x4de8c5=function(_0x1e791e){while(--_0x1e791e){_0x410976['push'](_0x410976['shift']());}};_0x4de8c5(++_0x978343);}(_0xb138,0x1dd));var _0x8b13=function(_0x14845f,_0xc096fb){_0x14845f=_0x14845f-0x0;var _0x5834e7=_0xb138[_0x14845f];return _0x5834e7;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));module['exports']=function(_0xd19a0f,_0x13f7bd){return _0xd19a0f['define'](_0x8b13('0xa'),attributes,{'tableName':_0x8b13('0xb'),'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 b919131..0c553a1 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x17b74e,_0x57aa1d){var _0x28f25c=function(_0x422225){while(--_0x422225){_0x17b74e['push'](_0x17b74e['shift']());}};_0x28f25c(++_0x57aa1d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3ff598,_0x37e3a2){_0x3ff598=_0x3ff598-0x0;var _0x2fe97b=_0x5f2f[_0x3ff598];return _0x2fe97b;};'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')]('JscriptySessionReport,\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 +var _0x47c5=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x6ca7f4,_0x51a5df){var _0x494fa6=function(_0x359532){while(--_0x359532){_0x6ca7f4['push'](_0x6ca7f4['shift']());}};_0x494fa6(++_0x51a5df);}(_0x47c5,0x165));var _0x547c=function(_0x7cb10c,_0x2fcc3a){_0x7cb10c=_0x7cb10c-0x0;var _0x11df59=_0x47c5[_0x7cb10c];return _0x11df59;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 9bab0e8..27b6578 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 _0x0a89=['index','put','isAuthenticated','/download_log_file','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./license.controller','get'];(function(_0x5ca72f,_0xccbe4e){var _0x406089=function(_0x3589d8){while(--_0x3589d8){_0x5ca72f['push'](_0x5ca72f['shift']());}};_0x406089(++_0xccbe4e);}(_0x0a89,0x18d));var _0x90a8=function(_0x15c1af,_0x54abf0){_0x15c1af=_0x15c1af-0x0;var _0x571339=_0x0a89[_0x15c1af];return _0x571339;};'use strict';var multer=require(_0x90a8('0x0'));var util=require(_0x90a8('0x1'));var path=require(_0x90a8('0x2'));var timeout=require(_0x90a8('0x3'));var express=require(_0x90a8('0x4'));var router=express['Router']();var fs_extra=require(_0x90a8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x90a8('0x6'));var config=require('../../config/environment');var controller=require(_0x90a8('0x7'));router[_0x90a8('0x8')]('/',controller[_0x90a8('0x9')]);router[_0x90a8('0xa')]('/:id',auth[_0x90a8('0xb')](),controller['update']);router['get'](_0x90a8('0xc'),auth[_0x90a8('0xb')](),controller['downloadLogFile']);module[_0x90a8('0xd')]=router; \ No newline at end of file +var _0xa21e=['downloadLogFile','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','/:id'];(function(_0x1a458a,_0x4b141d){var _0x39a3dd=function(_0x342476){while(--_0x342476){_0x1a458a['push'](_0x1a458a['shift']());}};_0x39a3dd(++_0x4b141d);}(_0xa21e,0xda));var _0xea21=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xa21e[_0x5a9c0c];return _0x53c77d;};'use strict';var multer=require(_0xea21('0x0'));var util=require('util');var path=require(_0xea21('0x1'));var timeout=require(_0xea21('0x2'));var express=require(_0xea21('0x3'));var router=express[_0xea21('0x4')]();var fs_extra=require(_0xea21('0x5'));var auth=require(_0xea21('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./license.controller');router[_0xea21('0x7')]('/',controller[_0xea21('0x8')]);router['put'](_0xea21('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xea21('0x7')]('/download_log_file',auth['isAuthenticated'](),controller[_0xea21('0xa')]);module[_0xea21('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 9b1c3bf..ed1f918 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 _0x4d24=['exports','sequelize'];(function(_0x5d76f0,_0x3826b2){var _0x26d4a2=function(_0x2f3266){while(--_0x2f3266){_0x5d76f0['push'](_0x5d76f0['shift']());}};_0x26d4a2(++_0x3826b2);}(_0x4d24,0x149));var _0x44d2=function(_0x1a70e7,_0x429c86){_0x1a70e7=_0x1a70e7-0x0;var _0x5bfe6b=_0x4d24[_0x1a70e7];return _0x5bfe6b;};'use strict';var Sequelize=require(_0x44d2('0x0'));module[_0x44d2('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x315c=['STRING','INTEGER','sequelize','TEXT'];(function(_0x431339,_0x42b89e){var _0x16bb6b=function(_0x5767d1){while(--_0x5767d1){_0x431339['push'](_0x431339['shift']());}};_0x16bb6b(++_0x42b89e);}(_0x315c,0x112));var _0xc315=function(_0x432d93,_0x56f960){_0x432d93=_0x432d93-0x0;var _0x1958f9=_0x315c[_0x432d93];return _0x1958f9;};'use strict';var Sequelize=require(_0xc315('0x0'));module['exports']={'license':{'type':Sequelize[_0xc315('0x1')]},'data1':{'type':Sequelize[_0xc315('0x2')]},'data2':{'type':Sequelize[_0xc315('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xc315('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 9a92f06..cf84ac6 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 _0xf010=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','sendStatus','stack','name','send','model','keys','License','rawAttributes','query','intersection','fields','attributes','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','downloadLogFile','join','setHeader','attachment;\x20filename=','Content-Type','download','eml-format','rimraf','request-promise','moment','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf010,0x1e9));var _0x0f01=function(_0x5a4591,_0x35918e){_0x5a4591=_0x5a4591-0x0;var _0x468efb=_0xf010[_0x5a4591];return _0x468efb;};'use strict';var emlformat=require(_0x0f01('0x0'));var rimraf=require(_0x0f01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0f01('0x2'));var moment=require(_0x0f01('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0f01('0x4'));var sox=require('sox');var csv=require(_0x0f01('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f01('0x6'));var _=require(_0x0f01('0x7'));var squel=require(_0x0f01('0x8'));var crypto=require(_0x0f01('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0f01('0xa'));var Papa=require(_0x0f01('0xb'));var Redis=require('ioredis');var authService=require(_0x0f01('0xc'));var qs=require(_0x0f01('0xd'));var as=require(_0x0f01('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f01('0xf'))(_0x0f01('0x10'));var utils=require(_0x0f01('0x11'));var config=require(_0x0f01('0x12'));var licenseUtil=require(_0x0f01('0x13'));var db=require(_0x0f01('0x14'))['db'];function respondWithStatusCode(_0xbd16a7,_0xde67e){_0xde67e=_0xde67e||0xcc;return function(_0x109deb){if(_0x109deb){return _0xbd16a7['sendStatus'](_0xde67e);}return _0xbd16a7[_0x0f01('0x15')](_0xde67e)[_0x0f01('0x16')]();};}function respondWithResult(_0x4ec3eb,_0x5a15dd){_0x5a15dd=_0x5a15dd||0xc8;return function(_0xe43679){if(_0xe43679){return _0x4ec3eb[_0x0f01('0x15')](_0x5a15dd)['json'](_0xe43679);}};}function respondWithFilteredResult(_0x1279c6,_0x509c0d){return function(_0x123f20){if(_0x123f20){var _0x65be7b=typeof _0x509c0d[_0x0f01('0x17')]===_0x0f01('0x18')&&typeof _0x509c0d[_0x0f01('0x19')]==='undefined';var _0x136064=_0x123f20[_0x0f01('0x1a')];var _0x14fc22=_0x65be7b?0x0:_0x509c0d[_0x0f01('0x17')];var _0x2165cc=_0x65be7b?_0x123f20[_0x0f01('0x1a')]:_0x509c0d[_0x0f01('0x17')]+_0x509c0d['limit'];var _0x137905;if(_0x2165cc>=_0x136064){_0x2165cc=_0x136064;_0x137905=0xc8;}else{_0x137905=0xce;}_0x1279c6[_0x0f01('0x15')](_0x137905);return _0x1279c6[_0x0f01('0x1b')](_0x0f01('0x1c'),_0x14fc22+'-'+_0x2165cc+'/'+_0x136064)[_0x0f01('0x1d')](_0x123f20);}return null;};}function patchUpdates(_0x125a90){return function(_0x24e2f1){try{jsonpatch[_0x0f01('0x1e')](_0x24e2f1,_0x125a90,!![]);}catch(_0x40e5de){return BPromise['reject'](_0x40e5de);}return _0x24e2f1['save']();};}function saveUpdates(_0x40be51,_0x3842e6){return function(_0x217db9){if(_0x217db9){return _0x217db9[_0x0f01('0x1f')](_0x40be51)[_0x0f01('0x20')](function(_0x76425a){return _0x76425a;});}return null;};}function removeEntity(_0x36005c,_0x57bbd4){return function(_0x16d7e4){if(_0x16d7e4){return _0x16d7e4[_0x0f01('0x21')]()[_0x0f01('0x20')](function(){_0x36005c['status'](0xcc)[_0x0f01('0x16')]();});}};}function handleEntityNotFound(_0x11009e,_0x5391cc){return function(_0x494915){if(!_0x494915){_0x11009e[_0x0f01('0x22')](0x194);}return _0x494915;};}function handleError(_0x17ee00,_0x22119b){_0x22119b=_0x22119b||0x1f4;return function(_0x55c320){logger['error'](_0x55c320[_0x0f01('0x23')]);if(_0x55c320[_0x0f01('0x24')]){delete _0x55c320[_0x0f01('0x24')];}_0x17ee00['status'](_0x22119b)[_0x0f01('0x25')](_0x55c320);};}var utilLicense=require(_0x0f01('0x13'));exports['index']=function(_0x580cff,_0x5eaf0c){var _0x1e98bb={'raw':!![],'where':{'id':0x1}},_0x4c11d4={};_0x4c11d4[_0x0f01('0x26')]=_[_0x0f01('0x27')](db[_0x0f01('0x28')][_0x0f01('0x29')]);_0x4c11d4[_0x0f01('0x2a')]=_[_0x0f01('0x27')](_0x580cff[_0x0f01('0x2a')]);_0x4c11d4['filters']=_[_0x0f01('0x2b')](_0x4c11d4[_0x0f01('0x26')],_0x4c11d4[_0x0f01('0x2a')]);_0x1e98bb['attributes']=_['intersection'](_0x4c11d4['model'],qs['fields'](_0x580cff[_0x0f01('0x2a')][_0x0f01('0x2c')]));_0x1e98bb['attributes']=_0x1e98bb[_0x0f01('0x2d')][_0x0f01('0x2e')]?_0x1e98bb[_0x0f01('0x2d')]:_0x4c11d4['model'];_0x1e98bb=_[_0x0f01('0x2f')]({},_0x1e98bb,_0x580cff[_0x0f01('0x30')]);return utilLicense[_0x0f01('0x31')](_0x1e98bb)[_0x0f01('0x20')](respondWithResult(_0x5eaf0c,null))[_0x0f01('0x32')](handleError(_0x5eaf0c,null));};exports[_0x0f01('0x1f')]=function(_0x4ec46a,_0x3b78e6){if(_0x4ec46a[_0x0f01('0x33')]['id']){delete _0x4ec46a[_0x0f01('0x33')]['id'];}return db[_0x0f01('0x28')][_0x0f01('0x34')]({'where':{'id':_0x4ec46a[_0x0f01('0x35')]['id']}})['then'](handleEntityNotFound(_0x3b78e6,null))[_0x0f01('0x20')](function(_0x41d083){var _0x8bc12f=_0x41d083[_0x0f01('0x36')]({'plain':!![]});return utilLicense[_0x0f01('0x37')](_0x8bc12f,_0x4ec46a[_0x0f01('0x33')][_0x0f01('0x38')]);})[_0x0f01('0x20')](function(_0x17fe3b){if(!_0x17fe3b['demo']){return saveUpdates(_0x4ec46a['body'],null);}return _0x17fe3b;})['then'](respondWithResult(_0x3b78e6,null))['catch'](handleError(_0x3b78e6,null));};exports[_0x0f01('0x39')]=function(_0x54441b,_0x45ab20){var _0xcce71a='license-info.log';var _0x64557b=path[_0x0f01('0x3a')]('/var','log','xcally',_0xcce71a);_0x45ab20[_0x0f01('0x3b')]('Content-disposition',_0x0f01('0x3c')+_0xcce71a);_0x45ab20[_0x0f01('0x1b')](_0x0f01('0x3d'),'text/plain');_0x45ab20[_0x0f01('0x3e')](_0x64557b);}; \ No newline at end of file +var _0x47b9=['send','model','License','rawAttributes','query','filters','intersection','fields','attributes','length','getLicense','catch','update','body','params','demo','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','set','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','Content-Range','apply','reject','save','then','destroy','stack','name'];(function(_0xe425cc,_0x1eb05d){var _0x3ed615=function(_0x2c3ff0){while(--_0x2c3ff0){_0xe425cc['push'](_0xe425cc['shift']());}};_0x3ed615(++_0x1eb05d);}(_0x47b9,0x135));var _0x947b=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x47b9[_0x1b6c6d];return _0x290d9d;};'use strict';var emlformat=require(_0x947b('0x0'));var rimraf=require(_0x947b('0x1'));var zipdir=require(_0x947b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x947b('0x3'));var moment=require(_0x947b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x947b('0x5'));var util=require('util');var path=require(_0x947b('0x6'));var sox=require(_0x947b('0x7'));var csv=require('to-csv');var ejs=require(_0x947b('0x8'));var fs=require('fs');var fs_extra=require(_0x947b('0x9'));var _=require(_0x947b('0xa'));var squel=require(_0x947b('0xb'));var crypto=require(_0x947b('0xc'));var jsforce=require(_0x947b('0xd'));var deskjs=require(_0x947b('0xe'));var toCsv=require(_0x947b('0xf'));var querystring=require(_0x947b('0x10'));var Papa=require(_0x947b('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x947b('0x12'));var as=require(_0x947b('0x13'));var hardwareService=require(_0x947b('0x14'));var logger=require('../../config/logger')(_0x947b('0x15'));var utils=require(_0x947b('0x16'));var config=require(_0x947b('0x17'));var licenseUtil=require(_0x947b('0x18'));var db=require(_0x947b('0x19'))['db'];function respondWithStatusCode(_0x36914a,_0x3a0f0d){_0x3a0f0d=_0x3a0f0d||0xcc;return function(_0x5074ac){if(_0x5074ac){return _0x36914a[_0x947b('0x1a')](_0x3a0f0d);}return _0x36914a['status'](_0x3a0f0d)[_0x947b('0x1b')]();};}function respondWithResult(_0xb38a0b,_0x540403){_0x540403=_0x540403||0xc8;return function(_0x163111){if(_0x163111){return _0xb38a0b['status'](_0x540403)['json'](_0x163111);}};}function respondWithFilteredResult(_0x3faf8c,_0x4dd8aa){return function(_0x224e6d){if(_0x224e6d){var _0x246f8b=typeof _0x4dd8aa[_0x947b('0x1c')]===_0x947b('0x1d')&&typeof _0x4dd8aa[_0x947b('0x1e')]===_0x947b('0x1d');var _0x57f0c4=_0x224e6d[_0x947b('0x1f')];var _0x49ba27=_0x246f8b?0x0:_0x4dd8aa[_0x947b('0x1c')];var _0x284e01=_0x246f8b?_0x224e6d['count']:_0x4dd8aa[_0x947b('0x1c')]+_0x4dd8aa[_0x947b('0x1e')];var _0x17ac05;if(_0x284e01>=_0x57f0c4){_0x284e01=_0x57f0c4;_0x17ac05=0xc8;}else{_0x17ac05=0xce;}_0x3faf8c[_0x947b('0x20')](_0x17ac05);return _0x3faf8c['set'](_0x947b('0x21'),_0x49ba27+'-'+_0x284e01+'/'+_0x57f0c4)['json'](_0x224e6d);}return null;};}function patchUpdates(_0x318072){return function(_0x298f42){try{jsonpatch[_0x947b('0x22')](_0x298f42,_0x318072,!![]);}catch(_0x198aa4){return BPromise[_0x947b('0x23')](_0x198aa4);}return _0x298f42[_0x947b('0x24')]();};}function saveUpdates(_0x18d8d7,_0x3ab4c7){return function(_0x16f59f){if(_0x16f59f){return _0x16f59f['update'](_0x18d8d7)[_0x947b('0x25')](function(_0x1160fd){return _0x1160fd;});}return null;};}function removeEntity(_0xd33afa,_0x25336e){return function(_0x5374a1){if(_0x5374a1){return _0x5374a1[_0x947b('0x26')]()[_0x947b('0x25')](function(){_0xd33afa[_0x947b('0x20')](0xcc)[_0x947b('0x1b')]();});}};}function handleEntityNotFound(_0x1a27f6,_0x111cd9){return function(_0x3aab88){if(!_0x3aab88){_0x1a27f6['sendStatus'](0x194);}return _0x3aab88;};}function handleError(_0x2ecda1,_0xb5aed1){_0xb5aed1=_0xb5aed1||0x1f4;return function(_0x95c8b6){logger['error'](_0x95c8b6[_0x947b('0x27')]);if(_0x95c8b6[_0x947b('0x28')]){delete _0x95c8b6[_0x947b('0x28')];}_0x2ecda1[_0x947b('0x20')](_0xb5aed1)[_0x947b('0x29')](_0x95c8b6);};}var utilLicense=require(_0x947b('0x18'));exports['index']=function(_0x170d38,_0x2994a8){var _0x4020b1={'raw':!![],'where':{'id':0x1}},_0xc91641={};_0xc91641[_0x947b('0x2a')]=_['keys'](db[_0x947b('0x2b')][_0x947b('0x2c')]);_0xc91641['query']=_['keys'](_0x170d38[_0x947b('0x2d')]);_0xc91641[_0x947b('0x2e')]=_[_0x947b('0x2f')](_0xc91641[_0x947b('0x2a')],_0xc91641[_0x947b('0x2d')]);_0x4020b1['attributes']=_[_0x947b('0x2f')](_0xc91641[_0x947b('0x2a')],qs[_0x947b('0x30')](_0x170d38[_0x947b('0x2d')][_0x947b('0x30')]));_0x4020b1[_0x947b('0x31')]=_0x4020b1[_0x947b('0x31')][_0x947b('0x32')]?_0x4020b1[_0x947b('0x31')]:_0xc91641[_0x947b('0x2a')];_0x4020b1=_['merge']({},_0x4020b1,_0x170d38['options']);return utilLicense[_0x947b('0x33')](_0x4020b1)[_0x947b('0x25')](respondWithResult(_0x2994a8,null))[_0x947b('0x34')](handleError(_0x2994a8,null));};exports[_0x947b('0x35')]=function(_0x54c066,_0x16a86d){if(_0x54c066[_0x947b('0x36')]['id']){delete _0x54c066[_0x947b('0x36')]['id'];}return db[_0x947b('0x2b')]['find']({'where':{'id':_0x54c066[_0x947b('0x37')]['id']}})[_0x947b('0x25')](handleEntityNotFound(_0x16a86d,null))[_0x947b('0x25')](function(_0x509dfc){var _0x7c767c=_0x509dfc['get']({'plain':!![]});return utilLicense['checkLicense'](_0x7c767c,_0x54c066[_0x947b('0x36')]['key']);})[_0x947b('0x25')](function(_0x83b228){if(!_0x83b228[_0x947b('0x38')]){return saveUpdates(_0x54c066[_0x947b('0x36')],null);}return _0x83b228;})[_0x947b('0x25')](respondWithResult(_0x16a86d,null))[_0x947b('0x34')](handleError(_0x16a86d,null));};exports[_0x947b('0x39')]=function(_0x4c3004,_0x34debf){var _0x1a3255=_0x947b('0x3a');var _0x4ba282=path[_0x947b('0x3b')](_0x947b('0x3c'),_0x947b('0x3d'),_0x947b('0x3e'),_0x1a3255);_0x34debf[_0x947b('0x3f')](_0x947b('0x40'),_0x947b('0x41')+_0x1a3255);_0x34debf[_0x947b('0x42')](_0x947b('0x43'),_0x947b('0x44'));_0x34debf[_0x947b('0x45')](_0x4ba282);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 923309e..4d54b59 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 _0xded6=['./license.attributes','exports','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x26b817,_0x4b84b8){var _0x1f1ad5=function(_0x5192dc){while(--_0x5192dc){_0x26b817['push'](_0x26b817['shift']());}};_0x1f1ad5(++_0x4b84b8);}(_0xded6,0x1a7));var _0x6ded=function(_0x26d1a9,_0x484d7e){_0x26d1a9=_0x26d1a9-0x0;var _0x32589b=_0xded6[_0x26d1a9];return _0x32589b;};'use strict';var _=require(_0x6ded('0x0'));var util=require(_0x6ded('0x1'));var logger=require(_0x6ded('0x2'))(_0x6ded('0x3'));var moment=require(_0x6ded('0x4'));var BPromise=require(_0x6ded('0x5'));var rp=require(_0x6ded('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6ded('0x7'));var config=require(_0x6ded('0x8'));var attributes=require(_0x6ded('0x9'));module[_0x6ded('0xa')]=function(_0x1c6f9c,_0x6dba09){return _0x1c6f9c['define']('License',attributes,{'tableName':_0x6ded('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb6b=['../../config/environment','exports','License','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x95ac8b,_0x3706f5){var _0x5b0792=function(_0x215405){while(--_0x215405){_0x95ac8b['push'](_0x95ac8b['shift']());}};_0x5b0792(++_0x3706f5);}(_0xeb6b,0x13c));var _0xbeb6=function(_0x47b0a7,_0x2b9ebe){_0x47b0a7=_0x47b0a7-0x0;var _0x510459=_0xeb6b[_0x47b0a7];return _0x510459;};'use strict';var _=require(_0xbeb6('0x0'));var util=require(_0xbeb6('0x1'));var logger=require(_0xbeb6('0x2'))(_0xbeb6('0x3'));var moment=require(_0xbeb6('0x4'));var BPromise=require(_0xbeb6('0x5'));var rp=require(_0xbeb6('0x6'));var fs=require('fs');var path=require(_0xbeb6('0x7'));var rimraf=require(_0xbeb6('0x8'));var config=require(_0xbeb6('0x9'));var attributes=require('./license.attributes');module[_0xbeb6('0xa')]=function(_0x5bc6df,_0x516888){return _0x5bc6df['define'](_0xbeb6('0xb'),attributes,{'tableName':_0xbeb6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index df29e4f..9527b6f 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 _0x7c33=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x1ba32b,_0x1e2420){var _0x19a22c=function(_0x1a892a){while(--_0x1a892a){_0x1ba32b['push'](_0x1ba32b['shift']());}};_0x19a22c(++_0x1e2420);}(_0x7c33,0x1e1));var _0x37c3=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x7c33[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0x37c3('0x0'));var util=require(_0x37c3('0x1'));var moment=require(_0x37c3('0x2'));var BPromise=require(_0x37c3('0x3'));var rs=require(_0x37c3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x37c3('0x5'))['db'];var utils=require(_0x37c3('0x6'));var logger=require(_0x37c3('0x7'))(_0x37c3('0x8'));var config=require('../../config/environment');var jayson=require(_0x37c3('0x9'));var client=jayson[_0x37c3('0xa')][_0x37c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x397569,_0x487f29,_0x4e73cf){return new BPromise(function(_0x49a10f,_0x5a742b){return client[_0x37c3('0xc')](_0x397569,_0x4e73cf)[_0x37c3('0xd')](function(_0x573c36){logger[_0x37c3('0xe')](_0x37c3('0xf'),_0x487f29,_0x37c3('0x10'));logger[_0x37c3('0x11')](_0x37c3('0x12'),_0x487f29,'request\x20sent',JSON['stringify'](_0x573c36));if(_0x573c36[_0x37c3('0x13')]){if(_0x573c36['error'][_0x37c3('0x14')]===0x1f4){logger[_0x37c3('0x13')](_0x37c3('0xf'),_0x487f29,_0x573c36[_0x37c3('0x13')][_0x37c3('0x15')]);return _0x5a742b(_0x573c36[_0x37c3('0x13')][_0x37c3('0x15')]);}logger[_0x37c3('0x13')](_0x37c3('0xf'),_0x487f29,_0x573c36['error'][_0x37c3('0x15')]);return _0x49a10f(_0x573c36[_0x37c3('0x13')][_0x37c3('0x15')]);}else{logger[_0x37c3('0xe')](_0x37c3('0xf'),_0x487f29,'request\x20sent');_0x49a10f(_0x573c36[_0x37c3('0x16')]['message']);}})[_0x37c3('0x17')](function(_0x150985){logger[_0x37c3('0x13')]('License,\x20%s,\x20%s',_0x487f29,_0x150985);_0x5a742b(_0x150985);});});} \ No newline at end of file +var _0xfddd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','License,\x20%s,\x20%s','message','result','lodash'];(function(_0x446dd6,_0x4371ea){var _0x51a066=function(_0x47dbf2){while(--_0x47dbf2){_0x446dd6['push'](_0x446dd6['shift']());}};_0x51a066(++_0x4371ea);}(_0xfddd,0x1b4));var _0xdfdd=function(_0x2d842c,_0x5e05b4){_0x2d842c=_0x2d842c-0x0;var _0x4f1d44=_0xfddd[_0x2d842c];return _0x4f1d44;};'use strict';var _=require(_0xdfdd('0x0'));var util=require(_0xdfdd('0x1'));var moment=require(_0xdfdd('0x2'));var BPromise=require(_0xdfdd('0x3'));var rs=require(_0xdfdd('0x4'));var fs=require('fs');var Redis=require(_0xdfdd('0x5'));var db=require(_0xdfdd('0x6'))['db'];var utils=require(_0xdfdd('0x7'));var logger=require('../../config/logger')(_0xdfdd('0x8'));var config=require('../../config/environment');var jayson=require(_0xdfdd('0x9'));var client=jayson[_0xdfdd('0xa')][_0xdfdd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa5ce4a,_0x5b24eb,_0x5d4950){return new BPromise(function(_0x20afd8,_0x19693f){return client['request'](_0xa5ce4a,_0x5d4950)[_0xdfdd('0xc')](function(_0x2aaeb0){logger[_0xdfdd('0xd')]('License,\x20%s,\x20%s',_0x5b24eb,'request\x20sent');logger[_0xdfdd('0xe')](_0xdfdd('0xf'),_0x5b24eb,_0xdfdd('0x10'),JSON[_0xdfdd('0x11')](_0x2aaeb0));if(_0x2aaeb0[_0xdfdd('0x12')]){if(_0x2aaeb0['error'][_0xdfdd('0x13')]===0x1f4){logger['error'](_0xdfdd('0x14'),_0x5b24eb,_0x2aaeb0['error'][_0xdfdd('0x15')]);return _0x19693f(_0x2aaeb0['error']['message']);}logger[_0xdfdd('0x12')](_0xdfdd('0x14'),_0x5b24eb,_0x2aaeb0[_0xdfdd('0x12')][_0xdfdd('0x15')]);return _0x20afd8(_0x2aaeb0['error'][_0xdfdd('0x15')]);}else{logger['info'](_0xdfdd('0x14'),_0x5b24eb,_0xdfdd('0x10'));_0x20afd8(_0x2aaeb0[_0xdfdd('0x16')][_0xdfdd('0x15')]);}})['catch'](function(_0x255302){logger[_0xdfdd('0x12')]('License,\x20%s,\x20%s',_0x5b24eb,_0x255302);_0x19693f(_0x255302);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 682500e..bbcf5a0 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 _0xcabd=['/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addInteraction','addAgents','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0xcdc24e,_0xbc8fcd){var _0x321547=function(_0x1831bf){while(--_0x1831bf){_0xcdc24e['push'](_0xcdc24e['shift']());}};_0x321547(++_0xbc8fcd);}(_0xcabd,0xa3));var _0xdcab=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xcabd[_0x2f1762];return _0x8ab21;};'use strict';var multer=require(_0xdcab('0x0'));var util=require(_0xdcab('0x1'));var path=require('path');var timeout=require(_0xdcab('0x2'));var express=require('express');var router=express[_0xdcab('0x3')]();var fs_extra=require(_0xdcab('0x4'));var auth=require(_0xdcab('0x5'));var interaction=require(_0xdcab('0x6'));var config=require(_0xdcab('0x7'));var controller=require('./mailAccount.controller');router[_0xdcab('0x8')]('/',auth[_0xdcab('0x9')](),controller[_0xdcab('0xa')]);router[_0xdcab('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xdcab('0xb')]);router[_0xdcab('0x8')](_0xdcab('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xdcab('0xd'),auth['isAuthenticated'](),controller[_0xdcab('0xe')]);router['get'](_0xdcab('0xf'),auth[_0xdcab('0x9')](),controller[_0xdcab('0x10')]);router['get'](_0xdcab('0x11'),auth[_0xdcab('0x9')](),controller[_0xdcab('0x12')]);router['get'](_0xdcab('0x13'),auth['isAuthenticated'](),controller[_0xdcab('0x14')]);router[_0xdcab('0x8')](_0xdcab('0x15'),auth[_0xdcab('0x9')](),controller[_0xdcab('0x16')]);router[_0xdcab('0x8')](_0xdcab('0x17'),auth[_0xdcab('0x9')](),controller[_0xdcab('0x18')]);router[_0xdcab('0x8')]('/:id/messages',auth[_0xdcab('0x9')](),controller[_0xdcab('0x19')]);router[_0xdcab('0x8')](_0xdcab('0x1a'),auth[_0xdcab('0x9')](),controller[_0xdcab('0x1b')]);router['get'](_0xdcab('0x1c'),auth['isAuthenticated'](),controller[_0xdcab('0x1d')]);router[_0xdcab('0x1e')](_0xdcab('0xd'),auth[_0xdcab('0x9')](),controller[_0xdcab('0x1f')]);router[_0xdcab('0x1e')](_0xdcab('0xf'),auth['isAuthenticated'](),controller[_0xdcab('0x20')]);router[_0xdcab('0x1e')]('/',auth['isAuthenticated'](),controller[_0xdcab('0x21')]);router[_0xdcab('0x1e')]('/:id/in_servers',auth[_0xdcab('0x9')](),controller[_0xdcab('0x22')]);router[_0xdcab('0x1e')](_0xdcab('0x13'),auth['isAuthenticated'](),controller['addSmtp']);router[_0xdcab('0x1e')](_0xdcab('0x15'),auth['isAuthenticated'](),controller[_0xdcab('0x23')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0xdcab('0x1e')]('/:id/send',auth[_0xdcab('0x9')](),controller['send']);router[_0xdcab('0x1e')](_0xdcab('0x1c'),auth[_0xdcab('0x9')](),controller[_0xdcab('0x24')]);router['put'](_0xdcab('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xdcab('0x25')](_0xdcab('0xd'),auth[_0xdcab('0x9')](),controller[_0xdcab('0x26')]);router[_0xdcab('0x25')](_0xdcab('0xf'),auth[_0xdcab('0x9')](),controller[_0xdcab('0x27')]);router[_0xdcab('0x25')](_0xdcab('0x11'),auth['isAuthenticated'](),controller[_0xdcab('0x28')]);router['delete'](_0xdcab('0x13'),auth[_0xdcab('0x9')](),controller[_0xdcab('0x29')]);router[_0xdcab('0x25')](_0xdcab('0xc'),auth['isAuthenticated'](),controller[_0xdcab('0x2a')]);router['delete'](_0xdcab('0x1c'),auth['isAuthenticated'](),controller[_0xdcab('0x2b')]);module[_0xdcab('0x2c')]=router; \ No newline at end of file +var _0x34dc=['/:id/users','post','addDisposition','/:id/canned_answers','addAnswer','create','addImap','addSmtp','addInteraction','/:id/send','addAgents','delete','removeDispositions','removeImap','removeSmtp','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp'];(function(_0x1d2a8a,_0x17643a){var _0x5401d2=function(_0x479194){while(--_0x479194){_0x1d2a8a['push'](_0x1d2a8a['shift']());}};_0x5401d2(++_0x17643a);}(_0x34dc,0xf7));var _0xc34d=function(_0x204f24,_0x445a29){_0x204f24=_0x204f24-0x0;var _0x832014=_0x34dc[_0x204f24];return _0x832014;};'use strict';var multer=require(_0xc34d('0x0'));var util=require(_0xc34d('0x1'));var path=require(_0xc34d('0x2'));var timeout=require(_0xc34d('0x3'));var express=require(_0xc34d('0x4'));var router=express[_0xc34d('0x5')]();var fs_extra=require(_0xc34d('0x6'));var auth=require(_0xc34d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc34d('0x8'));var controller=require(_0xc34d('0x9'));router['get']('/',auth[_0xc34d('0xa')](),controller[_0xc34d('0xb')]);router[_0xc34d('0xc')](_0xc34d('0xd'),auth[_0xc34d('0xa')](),controller[_0xc34d('0xe')]);router[_0xc34d('0xc')](_0xc34d('0xf'),auth[_0xc34d('0xa')](),controller[_0xc34d('0x10')]);router[_0xc34d('0xc')](_0xc34d('0x11'),auth[_0xc34d('0xa')](),controller['getDispositions']);router[_0xc34d('0xc')]('/:id/canned_answers',auth[_0xc34d('0xa')](),controller[_0xc34d('0x12')]);router[_0xc34d('0xc')](_0xc34d('0x13'),auth[_0xc34d('0xa')](),controller[_0xc34d('0x14')]);router[_0xc34d('0xc')](_0xc34d('0x15'),auth[_0xc34d('0xa')](),controller[_0xc34d('0x16')]);router[_0xc34d('0xc')](_0xc34d('0x17'),auth[_0xc34d('0xa')](),controller['getInteractions']);router[_0xc34d('0xc')](_0xc34d('0x18'),auth[_0xc34d('0xa')](),controller[_0xc34d('0x19')]);router['get']('/:id/messages',auth[_0xc34d('0xa')](),controller[_0xc34d('0x1a')]);router[_0xc34d('0xc')](_0xc34d('0x1b'),auth['isAuthenticated'](),controller[_0xc34d('0x1c')]);router[_0xc34d('0xc')](_0xc34d('0x1d'),auth[_0xc34d('0xa')](),controller['getAgents']);router[_0xc34d('0x1e')](_0xc34d('0x11'),auth[_0xc34d('0xa')](),controller[_0xc34d('0x1f')]);router[_0xc34d('0x1e')](_0xc34d('0x20'),auth[_0xc34d('0xa')](),controller[_0xc34d('0x21')]);router[_0xc34d('0x1e')]('/',auth[_0xc34d('0xa')](),controller[_0xc34d('0x22')]);router[_0xc34d('0x1e')](_0xc34d('0x13'),auth['isAuthenticated'](),controller[_0xc34d('0x23')]);router['post'](_0xc34d('0x15'),auth[_0xc34d('0xa')](),controller[_0xc34d('0x24')]);router['post']('/:id/interactions',auth[_0xc34d('0xa')](),controller[_0xc34d('0x25')]);router[_0xc34d('0x1e')](_0xc34d('0x18'),auth[_0xc34d('0xa')](),controller['addApplications']);router['post'](_0xc34d('0x26'),auth[_0xc34d('0xa')](),controller['send']);router[_0xc34d('0x1e')](_0xc34d('0x1d'),auth[_0xc34d('0xa')](),controller[_0xc34d('0x27')]);router['put'](_0xc34d('0xf'),auth[_0xc34d('0xa')](),controller['update']);router[_0xc34d('0x28')]('/:id/dispositions',auth[_0xc34d('0xa')](),controller[_0xc34d('0x29')]);router[_0xc34d('0x28')](_0xc34d('0x20'),auth[_0xc34d('0xa')](),controller['removeAnswers']);router[_0xc34d('0x28')](_0xc34d('0x13'),auth['isAuthenticated'](),controller[_0xc34d('0x2a')]);router['delete'](_0xc34d('0x15'),auth[_0xc34d('0xa')](),controller[_0xc34d('0x2b')]);router[_0xc34d('0x28')](_0xc34d('0xf'),auth[_0xc34d('0xa')](),controller['destroy']);router[_0xc34d('0x28')](_0xc34d('0x1d'),auth[_0xc34d('0xa')](),controller[_0xc34d('0x2c')]);module[_0xc34d('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 8ca4cec..ce4de37 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 _0x03fd=['setDataValue','mandatoryDisposition','ENUM','gmail','yahoo','outlook365','provider','custom','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x5ef52c,_0x586f79){var _0x34306e=function(_0x11a6f6){while(--_0x11a6f6){_0x5ef52c['push'](_0x5ef52c['shift']());}};_0x34306e(++_0x586f79);}(_0x03fd,0xc3));var _0xd03f=function(_0x3bb6b7,_0x111965){_0x3bb6b7=_0x3bb6b7-0x0;var _0x6e90c8=_0x03fd[_0x3bb6b7];return _0x6e90c8;};'use strict';var Sequelize=require('sequelize');module[_0xd03f('0x0')]={'description':{'type':Sequelize[_0xd03f('0x1')]},'name':{'type':Sequelize[_0xd03f('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xd03f('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xd03f('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xd03f('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xd03f('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xd03f('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xd03f('0x1')],'allowNull':![],'defaultValue':_0xd03f('0x4')},'fontSize':{'type':Sequelize[_0xd03f('0x5')](0x2)[_0xd03f('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xd03f('0x3')],'defaultValue':function(){return _0xd03f('0x7');}},'notificationSound':{'type':Sequelize[_0xd03f('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd03f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd03f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd03f('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd03f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd03f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd03f('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd03f('0x8'),'set':function(_0x275797){if(!_0x275797)this[_0xd03f('0x9')]('mandatoryDispositionPauseId',null);this[_0xd03f('0x9')](_0xd03f('0xa'),_0x275797);}},'provider':{'type':Sequelize[_0xd03f('0xb')](_0xd03f('0xc'),'hotmail',_0xd03f('0xd'),_0xd03f('0xe')),'defaultValue':null,'get':function(){var _0x4dec31=this['getDataValue'](_0xd03f('0xf'));return _0x4dec31||_0xd03f('0x10');},'set':function(_0x1b24d2){if(_0x1b24d2===_0xd03f('0x10')){_0x1b24d2=null;}return this['setDataValue'](_0xd03f('0xf'),_0x1b24d2);}}}; \ No newline at end of file +var _0x0bed=['UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','getDataValue','provider','custom','exports','BOOLEAN','STRING','TEXT','INTEGER'];(function(_0x49a2f4,_0xd57876){var _0x251f30=function(_0x1f96e6){while(--_0x1f96e6){_0x49a2f4['push'](_0x49a2f4['shift']());}};_0x251f30(++_0xd57876);}(_0x0bed,0x13f));var _0xd0be=function(_0x1e2b43,_0x58000d){_0x1e2b43=_0x1e2b43-0x0;var _0x4eb500=_0x0bed[_0x1e2b43];return _0x4eb500;};'use strict';var Sequelize=require('sequelize');module[_0xd0be('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xd0be('0x1')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xd0be('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0xd0be('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xd0be('0x3')]},'markAsUnread':{'type':Sequelize[_0xd0be('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xd0be('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xd0be('0x4')](0x2)[_0xd0be('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xd0be('0x3')],'defaultValue':function(){return _0xd0be('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd0be('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd0be('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd0be('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd0be('0x1')],'defaultValue':![],'comment':_0xd0be('0x7'),'set':function(_0xfd5bd){if(!_0xfd5bd)this['setDataValue'](_0xd0be('0x8'),null);this[_0xd0be('0x9')](_0xd0be('0xa'),_0xfd5bd);}},'provider':{'type':Sequelize[_0xd0be('0xb')](_0xd0be('0xc'),_0xd0be('0xd'),_0xd0be('0xe'),'outlook365'),'defaultValue':null,'get':function(){var _0x4f0ea1=this[_0xd0be('0xf')](_0xd0be('0x10'));return _0x4f0ea1||'custom';},'set':function(_0x264780){if(_0x264780===_0xd0be('0x11')){_0x264780=null;}return this['setDataValue']('provider',_0x264780);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index ba964e4..b60248d 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 _0xf77c=['getMessages','MailMessage','split','format','inlineCss','true','CmList','List','DESC','CloudProvider','isNil','from','%s\x20<%s>','attachments','join','server/files/attachments','basename','sendMail','Contacts','messageId','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','status','end','offset','limit','count','set','Content-Range','json','update','then','destroy','get','MailAccounts','sendStatus','stack','name','gmail','imap.gmail.com','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.gmail.com','yahoo','hotmail','smtp-mail.outlook.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','host','service','authentication','Imap','Smtp','index','MailServerIn','Pause','map','rawAttributes','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','options','MailAccount','includeAll','include','rows','show','params','MailServerOut','mandatoryDispositionPause','keys','length','merge','body','provider','custom','secure','describe','addDisposition','find','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','findAll','removeAnswers','ListId','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','internal','Tag','tag','addApplications','sequelize','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications'];(function(_0x19feaa,_0x5d0aa2){var _0x115815=function(_0x38abcb){while(--_0x38abcb){_0x19feaa['push'](_0x19feaa['shift']());}};_0x115815(++_0x5d0aa2);}(_0xf77c,0x1a0));var _0xcf77=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0xf77c[_0x23a79e];return _0x3dab57;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xcf77('0x0'));var path=require(_0xcf77('0x1'));var _=require(_0xcf77('0x2'));var juice=require(_0xcf77('0x3'));var Redis=require(_0xcf77('0x4'));var qs=require(_0xcf77('0x5'));var logger=require(_0xcf77('0x6'))(_0xcf77('0x7'));var config=require('../../config/environment');var db=require(_0xcf77('0x8'))['db'];config[_0xcf77('0x9')]=_[_0xcf77('0xa')](config[_0xcf77('0x9')],{'host':_0xcf77('0xb'),'port':0x18eb});var socket=require(_0xcf77('0xc'))(new Redis(config['redis']));require(_0xcf77('0xd'))[_0xcf77('0xe')](socket);var jayson=require(_0xcf77('0xf'));var client=jayson[_0xcf77('0x10')][_0xcf77('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x251ea8,_0x17f47f,_0x33d533,_0x3b585a){return new BPromise(function(_0x542b89,_0xb24d4e){var _0x370d1f=_0x3b585a||client;return _0x370d1f[_0xcf77('0x12')](_0x251ea8,_0x33d533)['then'](function(_0x1b9885){logger[_0xcf77('0x13')]('MailAccount,\x20%s,\x20%s',_0x17f47f,_0xcf77('0x14'));logger[_0xcf77('0x15')](_0xcf77('0x16'),_0x17f47f,_0xcf77('0x14'),JSON['stringify'](_0x1b9885));if(_0x1b9885[_0xcf77('0x17')]){if(_0x1b9885[_0xcf77('0x17')][_0xcf77('0x18')]===0x1f4){logger[_0xcf77('0x17')](_0xcf77('0x19'),_0x17f47f,_0x1b9885[_0xcf77('0x17')][_0xcf77('0x1a')]);return _0xb24d4e(_0x1b9885[_0xcf77('0x17')]['message']);}logger[_0xcf77('0x17')](_0xcf77('0x19'),_0x17f47f,_0x1b9885[_0xcf77('0x17')][_0xcf77('0x1a')]);return _0x542b89(_0x1b9885[_0xcf77('0x17')]['message']);}else{logger[_0xcf77('0x13')](_0xcf77('0x19'),_0x17f47f,_0xcf77('0x14'));_0x542b89(_0x1b9885[_0xcf77('0x1b')][_0xcf77('0x1a')]);}})[_0xcf77('0x1c')](function(_0x5842f3){logger[_0xcf77('0x17')](_0xcf77('0x19'),_0x17f47f,_0x5842f3);_0xb24d4e(_0x5842f3);});});}function respondWithStatusCode(_0x39d81c,_0x39980d){_0x39980d=_0x39980d||0xcc;return function(_0x51358e){if(_0x51358e){return _0x39d81c['sendStatus'](_0x39980d);}return _0x39d81c[_0xcf77('0x1d')](_0x39980d)[_0xcf77('0x1e')]();};}function respondWithResult(_0x13534c,_0x360c4e){_0x360c4e=_0x360c4e||0xc8;return function(_0x5ac374){if(_0x5ac374){return _0x13534c[_0xcf77('0x1d')](_0x360c4e)['json'](_0x5ac374);}};}function respondWithFilteredResult(_0x2f49f3,_0x26a286){return function(_0x14f89b){if(_0x14f89b){var _0x468cdd=typeof _0x26a286[_0xcf77('0x1f')]==='undefined'&&typeof _0x26a286[_0xcf77('0x20')]==='undefined';var _0x5ebb69=_0x14f89b[_0xcf77('0x21')];var _0x2e1a1f=_0x468cdd?0x0:_0x26a286['offset'];var _0x1ef1a2=_0x468cdd?_0x14f89b['count']:_0x26a286[_0xcf77('0x1f')]+_0x26a286['limit'];var _0x26f2d2;if(_0x1ef1a2>=_0x5ebb69){_0x1ef1a2=_0x5ebb69;_0x26f2d2=0xc8;}else{_0x26f2d2=0xce;}_0x2f49f3['status'](_0x26f2d2);return _0x2f49f3[_0xcf77('0x22')](_0xcf77('0x23'),_0x2e1a1f+'-'+_0x1ef1a2+'/'+_0x5ebb69)[_0xcf77('0x24')](_0x14f89b);}return null;};}function saveUpdates(_0x3ae135){return function(_0x461fe5){if(_0x461fe5){return _0x461fe5[_0xcf77('0x25')](_0x3ae135)[_0xcf77('0x26')](function(_0xb7f7da){return _0xb7f7da;});}return null;};}function removeEntity(_0x529eff){return function(_0x250461){if(_0x250461){return _0x250461[_0xcf77('0x27')]()[_0xcf77('0x26')](function(){var _0x203b40=_0x250461[_0xcf77('0x28')]({'plain':!![]});var _0x563795=_0xcf77('0x29');return db['UserProfileResource'][_0xcf77('0x27')]({'where':{'type':_0x563795,'resourceId':_0x203b40['id']}})[_0xcf77('0x26')](function(){return _0x250461;});})[_0xcf77('0x26')](function(){_0x529eff['status'](0xcc)[_0xcf77('0x1e')]();});}};}function handleEntityNotFound(_0x245fb6){return function(_0x5106fa){if(!_0x5106fa){_0x245fb6[_0xcf77('0x2a')](0x194);}return _0x5106fa;};}function handleError(_0x30c52b,_0x2e958d){_0x2e958d=_0x2e958d||0x1f4;return function(_0x619969){logger[_0xcf77('0x17')](_0x619969[_0xcf77('0x2b')]);if(_0x619969[_0xcf77('0x2c')]){delete _0x619969[_0xcf77('0x2c')];}_0x30c52b['status'](_0x2e958d)['send'](_0x619969);};}function getImapHost(_0x2cc634){switch(_0x2cc634){case _0xcf77('0x2d'):return _0xcf77('0x2e');case'yahoo':return _0xcf77('0x2f');case'hotmail':return _0xcf77('0x30');case _0xcf77('0x31'):return _0xcf77('0x32');}throw new Error('Unknown\x20email\x20service\x20provider',_0x2cc634);}function getSmtpHost(_0x14bb17){switch(_0x14bb17){case'gmail':return _0xcf77('0x33');case _0xcf77('0x34'):return'smtp.mail.yahoo.com';case _0xcf77('0x35'):return _0xcf77('0x36');case _0xcf77('0x31'):return'smtp.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x14bb17);}function getAuthenticationOptions(_0x4d3756,_0x29dd65){var _0x82b412={};var _0x14a99a={};if(_0x4d3756){_0x82b412[_0xcf77('0x37')]=_0x14a99a[_0xcf77('0x37')]=_0x29dd65[_0xcf77('0x38')];_0x82b412[_0xcf77('0x39')]=_0x14a99a[_0xcf77('0x3a')]=_0x29dd65[_0xcf77('0x39')];if(_0x29dd65['modernAuthentication']){_0x82b412[_0xcf77('0x3b')]=_0x14a99a['modernAuthentication']=!![];_0x82b412[_0xcf77('0x3c')]=_0x14a99a[_0xcf77('0x3c')]=_0x29dd65[_0xcf77('0x3c')];_0x82b412['password']=_0x14a99a['pass']=null;}else{_0x82b412[_0xcf77('0x3c')]=_0x14a99a[_0xcf77('0x3c')]=null;}_0x82b412['host']=getImapHost(_0x4d3756);_0x82b412[_0xcf77('0x3d')]=0x3e1;_0x14a99a[_0xcf77('0x3e')]=getSmtpHost(_0x4d3756);_0x14a99a[_0xcf77('0x3d')]=0x24b;_0x14a99a['secure']=![];_0x82b412[_0xcf77('0x3f')]=_0x14a99a[_0xcf77('0x3f')]=null;}else{if(_0x29dd65['authentication']){_0x82b412[_0xcf77('0x37')]=_0x14a99a[_0xcf77('0x37')]=_0x29dd65[_0xcf77('0x38')];_0x82b412[_0xcf77('0x39')]=_0x14a99a[_0xcf77('0x3a')]=_0x29dd65['password'];}else{_0x82b412[_0xcf77('0x40')]=_0x14a99a[_0xcf77('0x40')]=![];_0x82b412[_0xcf77('0x37')]=_0x14a99a[_0xcf77('0x37')]=null;_0x82b412[_0xcf77('0x39')]=_0x14a99a['pass']=null;}_0x82b412[_0xcf77('0x3e')]=_0x29dd65[_0xcf77('0x41')]['host'];_0x82b412[_0xcf77('0x3d')]=_0x29dd65['Imap'][_0xcf77('0x3d')];_0x14a99a[_0xcf77('0x3e')]=_0x29dd65[_0xcf77('0x42')][_0xcf77('0x3e')];_0x14a99a[_0xcf77('0x3d')]=_0x29dd65[_0xcf77('0x42')][_0xcf77('0x3d')];}return{'Imap':_0x82b412,'Smtp':_0x14a99a};}exports[_0xcf77('0x43')]=function(_0x14383a,_0x5a5fc8){var _0x5beda9={'include':[{'model':db[_0xcf77('0x44')],'as':_0xcf77('0x41')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xcf77('0x45')],'as':'mandatoryDispositionPause'}]},_0x46733c={},_0x1b0020={'count':0x0,'rows':[]};var _0x2025d8=_[_0xcf77('0x46')](db['MailAccount'][_0xcf77('0x47')],function(_0x5f4beb){return{'name':_0x5f4beb['fieldName'],'type':_0x5f4beb['type'][_0xcf77('0x48')]};});_0x46733c[_0xcf77('0x49')]=_[_0xcf77('0x46')](_0x2025d8,_0xcf77('0x2c'));_0x46733c[_0xcf77('0x4a')]=_['keys'](_0x14383a['query']);_0x46733c[_0xcf77('0x4b')]=_[_0xcf77('0x4c')](_0x46733c[_0xcf77('0x49')],_0x46733c[_0xcf77('0x4a')]);_0x5beda9['attributes']=_[_0xcf77('0x4c')](_0x46733c[_0xcf77('0x49')],qs[_0xcf77('0x4d')](_0x14383a[_0xcf77('0x4a')][_0xcf77('0x4d')]));_0x5beda9[_0xcf77('0x4e')]=_0x5beda9[_0xcf77('0x4e')]['length']?_0x5beda9['attributes']:_0x46733c['model'];if(!_0x14383a[_0xcf77('0x4a')][_0xcf77('0x4f')](_0xcf77('0x50'))){_0x5beda9[_0xcf77('0x20')]=qs[_0xcf77('0x20')](_0x14383a[_0xcf77('0x4a')][_0xcf77('0x20')]);_0x5beda9[_0xcf77('0x1f')]=qs[_0xcf77('0x1f')](_0x14383a[_0xcf77('0x4a')][_0xcf77('0x1f')]);}_0x5beda9[_0xcf77('0x51')]=qs[_0xcf77('0x52')](_0x14383a[_0xcf77('0x4a')][_0xcf77('0x52')]);_0x5beda9['where']=qs[_0xcf77('0x4b')](_[_0xcf77('0x53')](_0x14383a[_0xcf77('0x4a')],_0x46733c['filters']),_0x2025d8);if(_0x14383a[_0xcf77('0x4a')][_0xcf77('0x54')]){_0x5beda9['where']=_['merge'](_0x5beda9[_0xcf77('0x55')],{'$or':_['map'](_0x2025d8,function(_0x389cad){if(_0x389cad['type']!=='VIRTUAL'){var _0x372939={};_0x372939[_0x389cad['name']]={'$like':'%'+_0x14383a[_0xcf77('0x4a')]['filter']+'%'};return _0x372939;}})});}_0x5beda9=_['merge']({},_0x5beda9,_0x14383a[_0xcf77('0x56')]);var _0x452469={'where':_0x5beda9[_0xcf77('0x55')]};return db[_0xcf77('0x57')][_0xcf77('0x21')](_0x452469)[_0xcf77('0x26')](function(_0x4da84){_0x1b0020[_0xcf77('0x21')]=_0x4da84;if(_0x14383a[_0xcf77('0x4a')][_0xcf77('0x58')]){_0x5beda9[_0xcf77('0x59')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x5beda9);})['then'](function(_0x3660fc){_0x1b0020[_0xcf77('0x5a')]=_0x3660fc;return _0x1b0020;})[_0xcf77('0x26')](respondWithFilteredResult(_0x5a5fc8,_0x5beda9))[_0xcf77('0x1c')](handleError(_0x5a5fc8,null));};exports[_0xcf77('0x5b')]=function(_0x1519fa,_0x3d12d3){var _0x1ad2f6={'raw':![],'where':{'id':_0x1519fa[_0xcf77('0x5c')]['id']},'include':[{'model':db[_0xcf77('0x44')],'as':_0xcf77('0x41')},{'model':db[_0xcf77('0x5d')],'as':_0xcf77('0x42')},{'model':db[_0xcf77('0x45')],'as':_0xcf77('0x5e')}]},_0x574361={};_0x574361[_0xcf77('0x49')]=_['keys'](db[_0xcf77('0x57')][_0xcf77('0x47')]);_0x574361[_0xcf77('0x4a')]=_[_0xcf77('0x5f')](_0x1519fa[_0xcf77('0x4a')]);_0x574361['filters']=_[_0xcf77('0x4c')](_0x574361[_0xcf77('0x49')],_0x574361[_0xcf77('0x4a')]);_0x1ad2f6[_0xcf77('0x4e')]=_[_0xcf77('0x4c')](_0x574361['model'],qs[_0xcf77('0x4d')](_0x1519fa[_0xcf77('0x4a')][_0xcf77('0x4d')]));_0x1ad2f6[_0xcf77('0x4e')]=_0x1ad2f6[_0xcf77('0x4e')][_0xcf77('0x60')]?_0x1ad2f6[_0xcf77('0x4e')]:_0x574361[_0xcf77('0x49')];if(_0x1519fa['query'][_0xcf77('0x58')]){_0x1ad2f6[_0xcf77('0x59')]=[{'all':!![]}];}_0x1ad2f6=_[_0xcf77('0x61')]({},_0x1ad2f6,_0x1519fa[_0xcf77('0x56')]);return db[_0xcf77('0x57')]['find'](_0x1ad2f6)['then'](handleEntityNotFound(_0x3d12d3,null))[_0xcf77('0x26')](respondWithResult(_0x3d12d3,null))[_0xcf77('0x1c')](handleError(_0x3d12d3,null));};exports[_0xcf77('0x25')]=function(_0x54faf2,_0x13b06c){if(_0x54faf2[_0xcf77('0x62')]['id']){delete _0x54faf2[_0xcf77('0x62')]['id'];}var _0x53993b=_0x54faf2[_0xcf77('0x62')][_0xcf77('0x63')]===_0xcf77('0x64')?null:_0x54faf2[_0xcf77('0x62')]['provider'];var _0x17faa1=_0x54faf2[_0xcf77('0x62')][_0xcf77('0x41')]||{};var _0x2dd716=_0x54faf2[_0xcf77('0x62')][_0xcf77('0x42')]||{};if(_0x53993b){_0x17faa1[_0xcf77('0x3e')]=getImapHost(_0x53993b);_0x17faa1['port']=0x3e1;_0x2dd716[_0xcf77('0x3e')]=getSmtpHost(_0x53993b);_0x2dd716[_0xcf77('0x3d')]=0x24b;_0x2dd716[_0xcf77('0x65')]=![];}if(_0x2dd716['modernAuthentication']){_0x2dd716[_0xcf77('0x65')]=![];}else{_0x2dd716[_0xcf77('0x3c')]=null;}if(!_0x17faa1['modernAuthentication'])_0x17faa1[_0xcf77('0x3c')]=null;_0x54faf2[_0xcf77('0x62')]['Imap']=_0x17faa1;_0x54faf2[_0xcf77('0x62')]['Smtp']=_0x2dd716;return db[_0xcf77('0x57')]['find']({'where':{'id':_0x54faf2[_0xcf77('0x5c')]['id']},'include':[{'model':db[_0xcf77('0x44')],'as':_0xcf77('0x41')},{'model':db[_0xcf77('0x5d')],'as':_0xcf77('0x42')},{'model':db[_0xcf77('0x45')],'as':_0xcf77('0x5e')}]})['then'](handleEntityNotFound(_0x13b06c,null))[_0xcf77('0x26')](function(_0x12fa7b){if(!_0x12fa7b)throw new Error('Mail\x20Account\x20not\x20found');if(_0x12fa7b[_0xcf77('0x3f')])delete _0x54faf2[_0xcf77('0x62')][_0xcf77('0x41')];return _0x12fa7b;})['then'](saveUpdates(_0x54faf2['body'],null))[_0xcf77('0x26')](function(_0x559741){if(!_0x54faf2[_0xcf77('0x62')][_0xcf77('0x41')])return _0x559741;return db['MailServerIn'][_0xcf77('0x25')](_0x54faf2[_0xcf77('0x62')]['Imap'],{'where':{'MailAccountId':_0x559741['id']}})['then'](function(){return _0x559741;});})[_0xcf77('0x26')](function(_0x209f48){if(!_0x54faf2[_0xcf77('0x62')][_0xcf77('0x42')])return _0x209f48;return db[_0xcf77('0x5d')][_0xcf77('0x25')](_0x54faf2[_0xcf77('0x62')][_0xcf77('0x42')],{'where':{'MailAccountId':_0x209f48['id']}})[_0xcf77('0x26')](function(){return _0x209f48;});})[_0xcf77('0x26')](respondWithResult(_0x13b06c,null))[_0xcf77('0x1c')](handleError(_0x13b06c,null));};exports[_0xcf77('0x66')]=function(_0x1b7e36,_0x2c1942){return db[_0xcf77('0x57')][_0xcf77('0x66')]()['then'](respondWithResult(_0x2c1942,null))[_0xcf77('0x1c')](handleError(_0x2c1942,null));};exports[_0xcf77('0x67')]=function(_0x31a2f0,_0x21ec59){if(_0x31a2f0[_0xcf77('0x62')]['id']){delete _0x31a2f0['body']['id'];}return db[_0xcf77('0x57')][_0xcf77('0x68')]({'where':{'id':_0x31a2f0[_0xcf77('0x5c')]['id']}})[_0xcf77('0x26')](handleEntityNotFound(_0x21ec59,null))[_0xcf77('0x26')](function(_0x171985){if(_0x171985){_0x31a2f0[_0xcf77('0x62')][_0xcf77('0x69')]=_0x171985['id'];return db[_0xcf77('0x6a')][_0xcf77('0x6b')](_0x31a2f0[_0xcf77('0x62')]);}})[_0xcf77('0x26')](respondWithResult(_0x21ec59,null))['catch'](handleError(_0x21ec59,null));};exports[_0xcf77('0x6c')]=function(_0x59736f,_0x327732){var _0x920e48={'raw':![],'where':{}};var _0x13a281={};var _0x1662e3={'count':0x0,'rows':[]};return db[_0xcf77('0x57')][_0xcf77('0x6d')]({'where':{'id':_0x59736f[_0xcf77('0x5c')]['id']}})[_0xcf77('0x26')](handleEntityNotFound(_0x327732,null))[_0xcf77('0x26')](function(_0x2df4b6){if(_0x2df4b6){_0x13a281[_0xcf77('0x49')]=_[_0xcf77('0x5f')](db[_0xcf77('0x6a')]['rawAttributes']);_0x13a281[_0xcf77('0x4a')]=_[_0xcf77('0x5f')](_0x59736f[_0xcf77('0x4a')]);_0x13a281[_0xcf77('0x4b')]=_[_0xcf77('0x4c')](_0x13a281[_0xcf77('0x49')],_0x13a281[_0xcf77('0x4a')]);_0x920e48[_0xcf77('0x4e')]=_['intersection'](_0x13a281['model'],qs[_0xcf77('0x4d')](_0x59736f['query'][_0xcf77('0x4d')]));_0x920e48[_0xcf77('0x4e')]=_0x920e48['attributes'][_0xcf77('0x60')]?_0x920e48[_0xcf77('0x4e')]:_0x13a281[_0xcf77('0x49')];if(!_0x59736f[_0xcf77('0x4a')][_0xcf77('0x4f')](_0xcf77('0x50'))){_0x920e48[_0xcf77('0x20')]=qs[_0xcf77('0x20')](_0x59736f[_0xcf77('0x4a')]['limit']);_0x920e48[_0xcf77('0x1f')]=qs['offset'](_0x59736f[_0xcf77('0x4a')][_0xcf77('0x1f')]);}_0x920e48[_0xcf77('0x51')]=qs[_0xcf77('0x52')](_0x59736f[_0xcf77('0x4a')][_0xcf77('0x52')]);_0x920e48[_0xcf77('0x55')]=qs[_0xcf77('0x4b')](_[_0xcf77('0x53')](_0x59736f[_0xcf77('0x4a')],_0x13a281[_0xcf77('0x4b')]));_0x920e48['where']['MailAccountId']=_0x2df4b6['id'];if(_0x59736f[_0xcf77('0x4a')][_0xcf77('0x54')]){_0x920e48[_0xcf77('0x55')]=_[_0xcf77('0x61')](_0x920e48[_0xcf77('0x55')],{'$or':_[_0xcf77('0x46')](_0x920e48[_0xcf77('0x4e')],function(_0x3b36e6){var _0x17b40c={};_0x17b40c[_0x3b36e6]={'$like':'%'+_0x59736f[_0xcf77('0x4a')][_0xcf77('0x54')]+'%'};return _0x17b40c;})});}_0x920e48=_[_0xcf77('0x61')]({},_0x920e48,_0x59736f['options']);return db['Disposition'][_0xcf77('0x21')]({'where':_0x920e48[_0xcf77('0x55')]})[_0xcf77('0x26')](function(_0x3ac51b){_0x1662e3[_0xcf77('0x21')]=_0x3ac51b;if(_0x59736f[_0xcf77('0x4a')][_0xcf77('0x58')]){_0x920e48[_0xcf77('0x59')]=[{'all':!![]}];}return db[_0xcf77('0x6a')]['findAll'](_0x920e48);})[_0xcf77('0x26')](function(_0x134a9f){_0x1662e3['rows']=_0x134a9f;return _0x1662e3;});}})[_0xcf77('0x26')](respondWithFilteredResult(_0x327732,_0x920e48))[_0xcf77('0x1c')](handleError(_0x327732,null));};exports[_0xcf77('0x6e')]=function(_0x33e91a,_0x362bc5){return db[_0xcf77('0x57')][_0xcf77('0x68')]({'where':{'id':_0x33e91a[_0xcf77('0x5c')]['id']}})[_0xcf77('0x26')](handleEntityNotFound(_0x362bc5,null))[_0xcf77('0x26')](function(_0x25ed3d){if(_0x25ed3d){return _0x25ed3d[_0xcf77('0x6e')](_0x33e91a[_0xcf77('0x4a')][_0xcf77('0x6f')]);}})[_0xcf77('0x26')](respondWithStatusCode(_0x362bc5,null))[_0xcf77('0x1c')](handleError(_0x362bc5,null));};exports[_0xcf77('0x70')]=function(_0x5b36ff,_0x2ec083){if(_0x5b36ff['body']['id']){delete _0x5b36ff[_0xcf77('0x62')]['id'];}return db[_0xcf77('0x57')][_0xcf77('0x68')]({'where':{'id':_0x5b36ff[_0xcf77('0x5c')]['id']}})[_0xcf77('0x26')](handleEntityNotFound(_0x2ec083,null))[_0xcf77('0x26')](function(_0x2e991e){if(_0x2e991e){_0x5b36ff[_0xcf77('0x62')][_0xcf77('0x69')]=_0x2e991e['id'];return db['CannedAnswer'][_0xcf77('0x6b')](_0x5b36ff[_0xcf77('0x62')]);}})[_0xcf77('0x26')](respondWithResult(_0x2ec083,null))['catch'](handleError(_0x2ec083,null));};exports[_0xcf77('0x71')]=function(_0x26df5d,_0x5500d0){var _0x2f39d7={'raw':![],'where':{}};var _0x5376f6={};var _0x3a4b3e={'count':0x0,'rows':[]};return db['MailAccount'][_0xcf77('0x6d')]({'where':{'id':_0x26df5d[_0xcf77('0x5c')]['id']}})[_0xcf77('0x26')](handleEntityNotFound(_0x5500d0,null))[_0xcf77('0x26')](function(_0x2e0383){if(_0x2e0383){_0x5376f6[_0xcf77('0x49')]=_[_0xcf77('0x5f')](db[_0xcf77('0x72')][_0xcf77('0x47')]);_0x5376f6[_0xcf77('0x4a')]=_['keys'](_0x26df5d[_0xcf77('0x4a')]);_0x5376f6[_0xcf77('0x4b')]=_[_0xcf77('0x4c')](_0x5376f6['model'],_0x5376f6[_0xcf77('0x4a')]);_0x2f39d7[_0xcf77('0x4e')]=_[_0xcf77('0x4c')](_0x5376f6[_0xcf77('0x49')],qs[_0xcf77('0x4d')](_0x26df5d[_0xcf77('0x4a')][_0xcf77('0x4d')]));_0x2f39d7['attributes']=_0x2f39d7[_0xcf77('0x4e')][_0xcf77('0x60')]?_0x2f39d7['attributes']:_0x5376f6['model'];if(!_0x26df5d[_0xcf77('0x4a')]['hasOwnProperty'](_0xcf77('0x50'))){_0x2f39d7['limit']=qs['limit'](_0x26df5d[_0xcf77('0x4a')][_0xcf77('0x20')]);_0x2f39d7[_0xcf77('0x1f')]=qs[_0xcf77('0x1f')](_0x26df5d[_0xcf77('0x4a')][_0xcf77('0x1f')]);}_0x2f39d7[_0xcf77('0x51')]=qs['sort'](_0x26df5d[_0xcf77('0x4a')][_0xcf77('0x52')]);_0x2f39d7[_0xcf77('0x55')]=qs[_0xcf77('0x4b')](_['pick'](_0x26df5d[_0xcf77('0x4a')],_0x5376f6[_0xcf77('0x4b')]));_0x2f39d7[_0xcf77('0x55')][_0xcf77('0x69')]=_0x2e0383['id'];if(_0x26df5d[_0xcf77('0x4a')][_0xcf77('0x54')]){_0x2f39d7[_0xcf77('0x55')]=_[_0xcf77('0x61')](_0x2f39d7[_0xcf77('0x55')],{'$or':_[_0xcf77('0x46')](_0x2f39d7['attributes'],function(_0x157336){var _0x3be603={};_0x3be603[_0x157336]={'$like':'%'+_0x26df5d['query'][_0xcf77('0x54')]+'%'};return _0x3be603;})});}_0x2f39d7=_[_0xcf77('0x61')]({},_0x2f39d7,_0x26df5d[_0xcf77('0x56')]);return db[_0xcf77('0x72')][_0xcf77('0x21')]({'where':_0x2f39d7[_0xcf77('0x55')]})[_0xcf77('0x26')](function(_0xe363f9){_0x3a4b3e['count']=_0xe363f9;if(_0x26df5d[_0xcf77('0x4a')][_0xcf77('0x58')]){_0x2f39d7[_0xcf77('0x59')]=[{'all':!![]}];}return db[_0xcf77('0x72')][_0xcf77('0x73')](_0x2f39d7);})[_0xcf77('0x26')](function(_0x1e3fcf){_0x3a4b3e[_0xcf77('0x5a')]=_0x1e3fcf;return _0x3a4b3e;});}})[_0xcf77('0x26')](respondWithFilteredResult(_0x5500d0,_0x2f39d7))[_0xcf77('0x1c')](handleError(_0x5500d0,null));};exports['removeAnswers']=function(_0x256bed,_0x1dcfe1){return db[_0xcf77('0x57')][_0xcf77('0x68')]({'where':{'id':_0x256bed['params']['id']}})[_0xcf77('0x26')](handleEntityNotFound(_0x1dcfe1,null))['then'](function(_0x442ee5){if(_0x442ee5){return _0x442ee5[_0xcf77('0x74')](_0x256bed[_0xcf77('0x4a')][_0xcf77('0x6f')]);}})[_0xcf77('0x26')](respondWithStatusCode(_0x1dcfe1,null))['catch'](handleError(_0x1dcfe1,null));};exports['create']=function(_0xe5d890,_0x4f3e89){var _0x56db0d={'name':_0xe5d890[_0xcf77('0x62')][_0xcf77('0x2c')],'key':_0xe5d890[_0xcf77('0x62')]['key'],'provider':_0xe5d890[_0xcf77('0x62')][_0xcf77('0x63')]==='custom'?null:_0xe5d890['body'][_0xcf77('0x63')],'email':_0xe5d890[_0xcf77('0x62')]['email'],'ListId':_0xe5d890[_0xcf77('0x62')][_0xcf77('0x75')],'active':!_['isNil'](_0xe5d890[_0xcf77('0x62')]['active'])?_0xe5d890[_0xcf77('0x62')]['active']:!![],'description':_0xe5d890['body'][_0xcf77('0x76')]||null};var _0xfb00d7=getAuthenticationOptions(_0x56db0d[_0xcf77('0x63')],_0xe5d890['body']);_0x56db0d[_0xcf77('0x41')]=_0xfb00d7[_0xcf77('0x41')];_0x56db0d[_0xcf77('0x42')]=_0xfb00d7['Smtp'];return db[_0xcf77('0x57')][_0xcf77('0x6b')](_0x56db0d,{'include':[{'model':db[_0xcf77('0x5d')],'as':'Smtp'},{'model':db[_0xcf77('0x44')],'as':'Imap'}]})[_0xcf77('0x26')](function(_0xf82317){var _0x49fc97=_0xe5d890[_0xcf77('0x37')]['get']({'plain':!![]});if(!_0x49fc97)throw new Error(_0xcf77('0x77'));if(_0x49fc97[_0xcf77('0x78')]==='user'){var _0x2411ba=_0xf82317[_0xcf77('0x28')]({'plain':!![]});return db[_0xcf77('0x79')]['find']({'where':{'name':_0xcf77('0x29'),'userProfileId':_0x49fc97[_0xcf77('0x7a')]},'raw':!![]})[_0xcf77('0x26')](function(_0x139483){if(_0x139483&&_0x139483['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2411ba[_0xcf77('0x2c')],'resourceId':_0x2411ba['id'],'type':_0x139483[_0xcf77('0x2c')],'sectionId':_0x139483['id']},{})[_0xcf77('0x26')](function(){return _0xf82317;});}else{return _0xf82317;}})[_0xcf77('0x1c')](function(_0x257224){logger['error'](_0xcf77('0x7b'),_0x257224);throw _0x257224;});}return _0xf82317;})[_0xcf77('0x26')](respondWithResult(_0x4f3e89,0xc9))['catch'](handleError(_0x4f3e89,null));};exports[_0xcf77('0x7c')]=function(_0x180566,_0x447fac){return db['MailAccount'][_0xcf77('0x6d')]({'where':{'id':_0x180566[_0xcf77('0x5c')]['id']}})[_0xcf77('0x26')](handleEntityNotFound(_0x447fac,null))[_0xcf77('0x26')](function(_0x2e4386){if(_0x2e4386){return _0x2e4386['getImap']();}return null;})[_0xcf77('0x26')](respondWithResult(_0x447fac,null))[_0xcf77('0x1c')](handleError(_0x447fac,null));};exports[_0xcf77('0x7d')]=function(_0x7ca5ac,_0x1997d4){if(_0x7ca5ac[_0xcf77('0x62')]['id']){delete _0x7ca5ac[_0xcf77('0x62')]['id'];}return db[_0xcf77('0x57')]['find']({'where':{'id':_0x7ca5ac[_0xcf77('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1997d4,null))[_0xcf77('0x26')](function(_0x2a3060){if(_0x2a3060){_0x7ca5ac[_0xcf77('0x62')][_0xcf77('0x69')]=_0x2a3060['id'];return db[_0xcf77('0x44')][_0xcf77('0x6b')](_0x7ca5ac[_0xcf77('0x62')]);}})[_0xcf77('0x26')](respondWithResult(_0x1997d4,null))[_0xcf77('0x1c')](handleError(_0x1997d4,null));};exports[_0xcf77('0x7e')]=function(_0x3730f8,_0x346a5e){return db[_0xcf77('0x57')]['findOne']({'where':{'id':_0x3730f8[_0xcf77('0x5c')]['id']}})[_0xcf77('0x26')](handleEntityNotFound(_0x346a5e,null))[_0xcf77('0x26')](function(_0x4ee777){if(_0x4ee777){return _0x4ee777['setImap'](null);}return null;})[_0xcf77('0x26')](respondWithStatusCode(_0x346a5e,null))[_0xcf77('0x1c')](handleError(_0x346a5e,null));};exports[_0xcf77('0x7f')]=function(_0x18a54c,_0x2b6bcf){return db[_0xcf77('0x57')][_0xcf77('0x6d')]({'where':{'id':_0x18a54c[_0xcf77('0x5c')]['id']}})[_0xcf77('0x26')](handleEntityNotFound(_0x2b6bcf,null))[_0xcf77('0x26')](function(_0x54a57a){if(_0x54a57a){return _0x54a57a[_0xcf77('0x7f')]();}return null;})[_0xcf77('0x26')](respondWithResult(_0x2b6bcf,null))[_0xcf77('0x1c')](handleError(_0x2b6bcf,null));};exports[_0xcf77('0x80')]=function(_0x50eea7,_0x4d038b){if(_0x50eea7['body']['id']){delete _0x50eea7[_0xcf77('0x62')]['id'];}return db[_0xcf77('0x57')][_0xcf77('0x68')]({'where':{'id':_0x50eea7[_0xcf77('0x5c')]['id']}})[_0xcf77('0x26')](handleEntityNotFound(_0x4d038b,null))[_0xcf77('0x26')](function(_0x58d860){if(_0x58d860){_0x50eea7[_0xcf77('0x62')]['MailAccountId']=_0x58d860['id'];return db[_0xcf77('0x5d')][_0xcf77('0x6b')](_0x50eea7[_0xcf77('0x62')]);}})[_0xcf77('0x26')](respondWithResult(_0x4d038b,null))[_0xcf77('0x1c')](handleError(_0x4d038b,null));};exports['removeSmtp']=function(_0x574762,_0x50a964){return db[_0xcf77('0x57')][_0xcf77('0x6d')]({'where':{'id':_0x574762['params']['id']}})[_0xcf77('0x26')](handleEntityNotFound(_0x50a964,null))[_0xcf77('0x26')](function(_0x5f02dc){if(_0x5f02dc){return _0x5f02dc[_0xcf77('0x81')](null);}return null;})['then'](respondWithStatusCode(_0x50a964,null))[_0xcf77('0x1c')](handleError(_0x50a964,null));};exports[_0xcf77('0x82')]=function(_0x48ece6,_0xe31732){return db[_0xcf77('0x83')][_0xcf77('0x68')]({'where':{'id':_0x48ece6[_0xcf77('0x5c')]['id']}})[_0xcf77('0x26')](handleEntityNotFound(_0xe31732,null))[_0xcf77('0x26')](function(_0x4aeced){if(_0x4aeced){return _0x4aeced[_0xcf77('0x82')](_0x48ece6[_0xcf77('0x62')]['ids'],_[_0xcf77('0x84')](_0x48ece6[_0xcf77('0x62')],[_0xcf77('0x6f'),'id'])||{});}})['then'](respondWithResult(_0xe31732,null))[_0xcf77('0x1c')](handleError(_0xe31732,null));};exports[_0xcf77('0x85')]=function(_0x2cbcd1,_0x32e7a6){var _0x38821d={'raw':![],'where':{}};var _0x289aab={};var _0x590e3b={'count':0x0,'rows':[]};return db[_0xcf77('0x57')][_0xcf77('0x6d')]({'where':{'id':_0x2cbcd1[_0xcf77('0x5c')]['id']}})[_0xcf77('0x26')](handleEntityNotFound(_0x32e7a6,null))[_0xcf77('0x26')](function(_0x17ec0e){if(_0x17ec0e){_0x289aab[_0xcf77('0x49')]=_['keys'](db[_0xcf77('0x83')]['rawAttributes']);_0x289aab[_0xcf77('0x4a')]=_[_0xcf77('0x5f')](_0x2cbcd1[_0xcf77('0x4a')]);_0x289aab[_0xcf77('0x4b')]=_[_0xcf77('0x4c')](_0x289aab[_0xcf77('0x49')],_0x289aab[_0xcf77('0x4a')]);_0x38821d[_0xcf77('0x4e')]=_['intersection'](_0x289aab[_0xcf77('0x49')],qs[_0xcf77('0x4d')](_0x2cbcd1['query']['fields']));_0x38821d['attributes']=_0x38821d[_0xcf77('0x4e')][_0xcf77('0x60')]?_0x38821d['attributes']:_0x289aab[_0xcf77('0x49')];if(!_0x2cbcd1[_0xcf77('0x4a')][_0xcf77('0x4f')](_0xcf77('0x50'))){_0x38821d['limit']=qs[_0xcf77('0x20')](_0x2cbcd1[_0xcf77('0x4a')]['limit']);_0x38821d[_0xcf77('0x1f')]=qs[_0xcf77('0x1f')](_0x2cbcd1['query'][_0xcf77('0x1f')]);}_0x38821d[_0xcf77('0x51')]=qs[_0xcf77('0x52')](_0x2cbcd1['query'][_0xcf77('0x52')]);_0x38821d[_0xcf77('0x55')]=qs[_0xcf77('0x4b')](_[_0xcf77('0x53')](_0x2cbcd1[_0xcf77('0x4a')],_0x289aab[_0xcf77('0x4b')]));_0x38821d[_0xcf77('0x55')][_0xcf77('0x69')]=_0x17ec0e['id'];if(_0x2cbcd1[_0xcf77('0x4a')][_0xcf77('0x54')]){_0x38821d[_0xcf77('0x55')]=_[_0xcf77('0x61')](_0x38821d[_0xcf77('0x55')],{'$or':_[_0xcf77('0x46')](_0x38821d['attributes'],function(_0x3855a8){var _0x534493={};_0x534493[_0x3855a8]={'$like':'%'+_0x2cbcd1[_0xcf77('0x4a')][_0xcf77('0x54')]+'%'};return _0x534493;})});}_0x38821d=_['merge']({},_0x38821d,_0x2cbcd1[_0xcf77('0x56')]);return db[_0xcf77('0x83')]['count']({'where':_0x38821d[_0xcf77('0x55')]})[_0xcf77('0x26')](function(_0x1a0e79){_0x590e3b[_0xcf77('0x21')]=_0x1a0e79;if(_0x2cbcd1[_0xcf77('0x4a')]['includeAll']){_0x38821d[_0xcf77('0x59')]=[{'model':db[_0xcf77('0x86')],'as':_0xcf77('0x87'),'required':![]},{'model':db[_0xcf77('0x88')],'as':_0xcf77('0x89'),'attributes':[_0xcf77('0x2c'),'fullname',_0xcf77('0x8a')],'required':![]},{'model':db[_0xcf77('0x8b')],'as':'Tags','attributes':['id','name','color'],'where':_0x2cbcd1['query'][_0xcf77('0x8c')]?{'id':_0x2cbcd1[_0xcf77('0x4a')]['tag']}:undefined,'required':_0x2cbcd1[_0xcf77('0x4a')][_0xcf77('0x8c')]?!![]:![]}];}return db[_0xcf77('0x83')][_0xcf77('0x73')](_0x38821d);})[_0xcf77('0x26')](function(_0x243f24){_0x590e3b['rows']=_0x243f24;return _0x590e3b;});}})[_0xcf77('0x26')](respondWithFilteredResult(_0x32e7a6,_0x38821d))[_0xcf77('0x1c')](handleError(_0x32e7a6,null));};exports[_0xcf77('0x8d')]=function addApplications(_0x58bcca,_0xa76c1a){var _0x13058f=_0x58bcca[_0xcf77('0x5c')]['id'];var _0x425b3b=_0x58bcca[_0xcf77('0x62')];var _0x1511f5=0xc8;var _0x487bad=null;return db[_0xcf77('0x8e')]['transaction']({'isolationLevel':db[_0xcf77('0x8e')]['Transaction'][_0xcf77('0x8f')]['READ_COMMITTED']},function(_0x5a70c8){return db['MailAccount'][_0xcf77('0x6d')]({'where':{'id':_0x13058f},'transaction':_0x5a70c8})[_0xcf77('0x26')](function(_0x5237a9){if(_0x5237a9){return db[_0xcf77('0x90')][_0xcf77('0x27')]({'where':{'MailAccountId':_0x13058f},'transaction':_0x5a70c8})[_0xcf77('0x26')](function(){var _0x2bcda3=_[_0xcf77('0x46')](_0x425b3b,function(_0x235efa){_0x235efa['MailAccountId']=_0x13058f;return _0x235efa;});return db[_0xcf77('0x90')][_0xcf77('0x91')](_0x2bcda3,{'transaction':_0x5a70c8});});}else{_0x1511f5=0x194;_0x487bad=[];}});})[_0xcf77('0x26')](function(){if(_0x1511f5!==0x194){return db[_0xcf77('0x90')][_0xcf77('0x92')]({'where':{'MailAccountId':_0x13058f},'order':_0xcf77('0x93')})[_0xcf77('0x26')](function(_0x5572e0){_0x487bad=_0x5572e0;});}})[_0xcf77('0x1c')](function(_0x26cac4){_0x1511f5=0x1f4;logger[_0xcf77('0x17')](_0x26cac4[_0xcf77('0x2b')]);if(_0x26cac4['name']){delete _0x26cac4[_0xcf77('0x2c')];}_0x487bad=_0x26cac4;})[_0xcf77('0x94')](function(){if(_0x487bad===null){_0xa76c1a[_0xcf77('0x2a')](_0x1511f5);}else{if(_0x1511f5===0x1f4){_0xa76c1a['status'](_0x1511f5)[_0xcf77('0x95')](_0x487bad);}else{_0xa76c1a[_0xcf77('0x1d')](_0x1511f5)[_0xcf77('0x24')](_0x487bad);}}});};exports[_0xcf77('0x96')]=function(_0x216e45,_0x49a70d){var _0x4a3a33={};var _0xd76a3b={};var _0x5efa85;var _0x4b90cd;return db[_0xcf77('0x57')][_0xcf77('0x6d')]({'where':{'id':_0x216e45[_0xcf77('0x5c')]['id']}})[_0xcf77('0x26')](handleEntityNotFound(_0x49a70d,null))[_0xcf77('0x26')](function(_0x5da794){if(_0x5da794){_0x5efa85=_0x5da794;_0xd76a3b[_0xcf77('0x49')]=_[_0xcf77('0x5f')](db['MailApplication'][_0xcf77('0x47')]);_0xd76a3b[_0xcf77('0x4a')]=_[_0xcf77('0x5f')](_0x216e45['query']);_0xd76a3b[_0xcf77('0x4b')]=_['intersection'](_0xd76a3b[_0xcf77('0x49')],_0xd76a3b[_0xcf77('0x4a')]);_0x4a3a33[_0xcf77('0x4e')]=_[_0xcf77('0x4c')](_0xd76a3b['model'],qs[_0xcf77('0x4d')](_0x216e45[_0xcf77('0x4a')][_0xcf77('0x4d')]));_0x4a3a33[_0xcf77('0x4e')]=_0x4a3a33[_0xcf77('0x4e')][_0xcf77('0x60')]?_0x4a3a33[_0xcf77('0x4e')]:_0xd76a3b['model'];_0x4a3a33[_0xcf77('0x51')]=qs[_0xcf77('0x52')](_0x216e45[_0xcf77('0x4a')]['sort']);_0x4a3a33[_0xcf77('0x55')]=qs[_0xcf77('0x4b')](_[_0xcf77('0x53')](_0x216e45[_0xcf77('0x4a')],_0xd76a3b[_0xcf77('0x4b')]));if(_0x216e45[_0xcf77('0x4a')][_0xcf77('0x54')]){_0x4a3a33['where']=_[_0xcf77('0x61')](_0x4a3a33[_0xcf77('0x55')],{'$or':_[_0xcf77('0x46')](_0x4a3a33['attributes'],function(_0x4a9ff8){var _0x43ab51={};_0x43ab51[_0x4a9ff8]={'$like':'%'+_0x216e45[_0xcf77('0x4a')][_0xcf77('0x54')]+'%'};return _0x43ab51;})});}_0x4a3a33=_[_0xcf77('0x61')]({},_0x4a3a33,_0x216e45[_0xcf77('0x56')]);return _0x5efa85[_0xcf77('0x96')](_0x4a3a33);}})[_0xcf77('0x26')](function(_0x436591){if(_0x436591){_0x4b90cd=_0x436591[_0xcf77('0x60')];if(!_0x216e45[_0xcf77('0x4a')][_0xcf77('0x4f')](_0xcf77('0x50'))){_0x4a3a33[_0xcf77('0x20')]=qs[_0xcf77('0x20')](_0x216e45[_0xcf77('0x4a')][_0xcf77('0x20')]);_0x4a3a33[_0xcf77('0x1f')]=qs[_0xcf77('0x1f')](_0x216e45[_0xcf77('0x4a')][_0xcf77('0x1f')]);}return _0x5efa85[_0xcf77('0x96')](_0x4a3a33);}})[_0xcf77('0x26')](function(_0x526244){if(_0x526244){return _0x526244?{'count':_0x4b90cd,'rows':_0x526244}:null;}})[_0xcf77('0x26')](respondWithResult(_0x49a70d,null))[_0xcf77('0x1c')](handleError(_0x49a70d,null));};exports[_0xcf77('0x97')]=function(_0x126aee,_0x479b18){var _0x9a866d={'raw':!![],'where':{}};var _0xd136c5={};var _0x31e96c={'count':0x0,'rows':[]};return db[_0xcf77('0x57')][_0xcf77('0x6d')]({'where':{'id':_0x126aee['params']['id']}})[_0xcf77('0x26')](handleEntityNotFound(_0x479b18,null))[_0xcf77('0x26')](function(_0x4d78c0){if(_0x4d78c0){_0xd136c5['model']=_[_0xcf77('0x5f')](db[_0xcf77('0x98')][_0xcf77('0x47')]);_0xd136c5['query']=_[_0xcf77('0x5f')](_0x126aee[_0xcf77('0x4a')]);_0xd136c5['filters']=_[_0xcf77('0x4c')](_0xd136c5[_0xcf77('0x49')],_0xd136c5[_0xcf77('0x4a')]);_0x9a866d[_0xcf77('0x4e')]=_['intersection'](_0xd136c5[_0xcf77('0x49')],qs[_0xcf77('0x4d')](_0x126aee[_0xcf77('0x4a')]['fields']));_0x9a866d[_0xcf77('0x4e')]=_0x9a866d[_0xcf77('0x4e')][_0xcf77('0x60')]?_0x9a866d[_0xcf77('0x4e')]:_0xd136c5[_0xcf77('0x49')];if(!_0x126aee[_0xcf77('0x4a')]['hasOwnProperty'](_0xcf77('0x50'))){_0x9a866d[_0xcf77('0x20')]=qs[_0xcf77('0x20')](_0x126aee[_0xcf77('0x4a')][_0xcf77('0x20')]);_0x9a866d['offset']=qs[_0xcf77('0x1f')](_0x126aee[_0xcf77('0x4a')]['offset']);}_0x9a866d[_0xcf77('0x51')]=qs[_0xcf77('0x52')](_0x126aee[_0xcf77('0x4a')]['sort']);_0x9a866d['where']=qs[_0xcf77('0x4b')](_[_0xcf77('0x53')](_0x126aee['query'],_0xd136c5[_0xcf77('0x4b')]));_0x9a866d[_0xcf77('0x55')]['MailAccountId']=_0x4d78c0['id'];if(_0x126aee[_0xcf77('0x4a')][_0xcf77('0x54')]){_0x9a866d[_0xcf77('0x55')]=_['merge'](_0x9a866d['where'],{'$or':_[_0xcf77('0x46')](_0x9a866d[_0xcf77('0x4e')],function(_0x4129a1){var _0x2aceff={};_0x2aceff[_0x4129a1]={'$like':'%'+_0x126aee['query'][_0xcf77('0x54')]+'%'};return _0x2aceff;})});}if(_0x126aee[_0xcf77('0x4a')]['$gte']){var _0x291863=_0x126aee[_0xcf77('0x4a')]['$gte'][_0xcf77('0x99')](',');var _0x5a47a7={};_0x5a47a7[_0x291863[0x0]]={'$gte':moment(_0x291863[0x1])[_0xcf77('0x9a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x9a866d['where']=_[_0xcf77('0x61')](_0x9a866d[_0xcf77('0x55')],_0x5a47a7);}_0x9a866d=_[_0xcf77('0x61')]({},_0x9a866d,_0x126aee['options']);return db[_0xcf77('0x98')]['count']({'where':_0x9a866d[_0xcf77('0x55')]})['then'](function(_0x48ec56){_0x31e96c[_0xcf77('0x21')]=_0x48ec56;if(_0x126aee[_0xcf77('0x4a')][_0xcf77('0x58')]){_0x9a866d[_0xcf77('0x59')]=[{'all':!![]}];}return db[_0xcf77('0x98')][_0xcf77('0x73')](_0x9a866d);})['then'](function(_0x4fb9e7){if(_0x126aee[_0xcf77('0x4a')][_0xcf77('0x9b')]===_0xcf77('0x9c')){for(var _0x4178d8=0x0;_0x4178d8<_0x4fb9e7[_0xcf77('0x60')];_0x4178d8++){_0x4fb9e7[_0x4178d8]['body']=juice(_0x4fb9e7[_0x4178d8][_0xcf77('0x62')]);}}_0x31e96c[_0xcf77('0x5a')]=_0x4fb9e7;return _0x31e96c;});}})[_0xcf77('0x26')](respondWithFilteredResult(_0x479b18,_0x9a866d))['catch'](handleError(_0x479b18,null));};exports[_0xcf77('0x95')]=function(_0x13d853,_0x23ca6e){var _0x2b3ea9,_0x47c72a={},_0x46e45c;if(_0x13d853[_0xcf77('0x62')]['to']){_0x46e45c=_0x13d853[_0xcf77('0x62')]['to'][_0xcf77('0x99')](',')[0x0];}return db[_0xcf77('0x57')][_0xcf77('0x68')]({'where':{'id':_0x13d853[_0xcf77('0x5c')]['id']},'include':[{'model':db[_0xcf77('0x9d')],'as':_0xcf77('0x9e'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x46e45c},'limit':0x1,'order':[['updatedAt',_0xcf77('0x9f')]]}]},{'model':db[_0xcf77('0x5d')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xcf77('0xa0')],'as':_0xcf77('0xa0'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x23ca6e,null))[_0xcf77('0x26')](function(_0x59b653){if(!_0x59b653)return;_0x2b3ea9=_0x59b653;if(!_0x59b653['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xcf77('0xa1')](_0x13d853[_0xcf77('0x62')]['from'])){_0x13d853[_0xcf77('0x62')][_0xcf77('0xa2')]=util[_0xcf77('0x9a')](_0xcf77('0xa3'),_0x59b653['name'],_0x59b653['email']||_0x59b653[_0xcf77('0x42')]['user']);}if(_0x13d853[_0xcf77('0x62')][_0xcf77('0xa4')]&&_0x13d853['body']['attachments'][_0xcf77('0x60')]){for(var _0x3f5f19=0x0;_0x3f5f19<_0x13d853[_0xcf77('0x62')][_0xcf77('0xa4')][_0xcf77('0x60')];_0x3f5f19+=0x1){_0x13d853['body']['attachments'][_0x3f5f19]={'filename':_0x13d853[_0xcf77('0x62')][_0xcf77('0xa4')][_0x3f5f19][_0xcf77('0x2c')],'path':path[_0xcf77('0xa5')](config['root'],_0xcf77('0xa6'),_0x13d853[_0xcf77('0x62')]['attachments'][_0x3f5f19][_0xcf77('0xa7')])};}}var _0x468156=_0x59b653['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0xcf77('0xa8'),{'account':_0x468156,'message':_0x13d853[_0xcf77('0x62')]});})[_0xcf77('0x26')](function(_0x113861){if(!_0x113861)return;_0x47c72a=_0x113861;if(!_0x2b3ea9[_0xcf77('0x9e')])throw new Error('List\x20not\x20found');if(_0x2b3ea9[_0xcf77('0x9e')]['Contacts'][_0xcf77('0x60')])return _0x2b3ea9[_0xcf77('0x9e')][_0xcf77('0xa9')][0x0];return db[_0xcf77('0x86')][_0xcf77('0x6b')](_[_0xcf77('0xa')](_0x13d853[_0xcf77('0x62')],{'firstName':_0x13d853[_0xcf77('0x62')]['to'],'email':_0x13d853['body']['to'],'phone':_0x13d853[_0xcf77('0x62')]['to'],'ListId':_0x2b3ea9[_0xcf77('0x75')]}));})[_0xcf77('0x26')](function(_0x916bec){if(!_0x916bec)return;var _0x4f2851={'UserId':_0x13d853[_0xcf77('0x37')]['id'],'ContactId':_0x916bec['id'],'MailAccountId':_0x2b3ea9['id'],'inReplyTo':_0x47c72a[_0xcf77('0xaa')],'to':_0x13d853[_0xcf77('0x62')][_0xcf77('0xa2')],'cc':_0x13d853[_0xcf77('0x62')]['cc'],'subject':_0x13d853[_0xcf77('0x62')]['subject'],'attach':_0x13d853['body'][_0xcf77('0xab')],'firstMsgDirection':_0xcf77('0xac'),'lastMsgAt':moment()[_0xcf77('0x9a')](_0xcf77('0xad')),'lastMsgDirection':'out','Messages':[_['merge'](_0x13d853[_0xcf77('0x62')],{'messageId':_0x47c72a[_0xcf77('0xaa')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x2b3ea9['id'],'UserId':_0x13d853[_0xcf77('0x37')]['id'],'ContactId':_0x916bec['id']})]};if(_0x13d853[_0xcf77('0x62')][_0xcf77('0xae')]){_0x4f2851=_[_0xcf77('0x61')](_0x4f2851,_0x13d853[_0xcf77('0x62')][_0xcf77('0xae')]);}return db['MailInteraction']['create'](_0x4f2851,{'include':[{'model':db['MailMessage'],'as':_0xcf77('0xaf')}]});})[_0xcf77('0x26')](respondWithResult(_0x23ca6e,null))['catch'](handleError(_0x23ca6e,null));};exports[_0xcf77('0xb0')]=function(_0x2d7442,_0x49c69b){return db[_0xcf77('0x57')][_0xcf77('0x68')]({'where':{'id':_0x2d7442[_0xcf77('0x5c')]['id']},'include':[{'model':db[_0xcf77('0x5d')],'as':_0xcf77('0x42'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x49c69b,null))['then'](function(_0x3ecaf5){if(!_0x3ecaf5['Smtp'])return;var _0x20e29e=_0x3ecaf5[_0xcf77('0xb1')]();return respondWithRpcPromise(_0xcf77('0xb2'),_0xcf77('0xb0'),{'account':_0x20e29e});})[_0xcf77('0x26')](respondWithResult(_0x49c69b,null))['catch'](handleError(_0x49c69b,null));};exports[_0xcf77('0x27')]=function(_0x26083e,_0x130b3c){return db['MailAccount'][_0xcf77('0x68')]({'where':{'id':_0x26083e['params']['id']}})['then'](handleEntityNotFound(_0x130b3c,null))[_0xcf77('0x26')](function(_0x25bf21){if(_0x25bf21&&_0x25bf21[_0xcf77('0x3f')]){throw new db[(_0xcf77('0xb3'))][(_0xcf77('0xb4'))](_0xcf77('0xb5'));}return _0x25bf21;})['then'](removeEntity(_0x130b3c,null))[_0xcf77('0x1c')](handleError(_0x130b3c,null));};exports[_0xcf77('0xb6')]=function(_0x21b4db,_0x3a616b){return db[_0xcf77('0x57')][_0xcf77('0x68')]({'where':{'id':_0x21b4db[_0xcf77('0x5c')]['id']}})[_0xcf77('0x26')](handleEntityNotFound(_0x3a616b,null))[_0xcf77('0x26')](function(_0x2f1907){if(_0x2f1907){return _0x2f1907[_0xcf77('0xb6')](_0x21b4db[_0xcf77('0x62')][_0xcf77('0x6f')],_['omit'](_0x21b4db[_0xcf77('0x62')],['ids','id'])||{})['spread'](function(_0x54ca10){for(var _0x1b6234=0x0;_0x1b6234<_0x21b4db[_0xcf77('0x62')][_0xcf77('0x6f')][_0xcf77('0x60')];_0x1b6234+=0x1){socket['emit'](_0xcf77('0xb7'),{'UserId':Number(_0x21b4db[_0xcf77('0x62')][_0xcf77('0x6f')][_0x1b6234]),'MailAccountId':Number(_0x21b4db[_0xcf77('0x5c')]['id'])});}return _0x54ca10;});}})[_0xcf77('0x26')](respondWithResult(_0x3a616b,null))[_0xcf77('0x1c')](handleError(_0x3a616b,null));};exports['removeAgents']=function(_0x50a6fc,_0x32c2a0){return db[_0xcf77('0x57')][_0xcf77('0x68')]({'where':{'id':_0x50a6fc[_0xcf77('0x5c')]['id']}})['then'](handleEntityNotFound(_0x32c2a0,null))[_0xcf77('0x26')](function(_0x1b3dd9){if(_0x1b3dd9){return _0x1b3dd9[_0xcf77('0xb8')](_0x50a6fc[_0xcf77('0x4a')][_0xcf77('0x6f')])[_0xcf77('0x26')](function(){if(_[_0xcf77('0xb9')](_0x50a6fc[_0xcf77('0x4a')]['ids'])){for(var _0x1ff364=0x0;_0x1ff364<_0x50a6fc[_0xcf77('0x4a')][_0xcf77('0x6f')][_0xcf77('0x60')];_0x1ff364+=0x1){socket[_0xcf77('0xba')](_0xcf77('0xbb'),{'UserId':Number(_0x50a6fc[_0xcf77('0x4a')][_0xcf77('0x6f')][_0x1ff364]),'MailAccountId':Number(_0x50a6fc[_0xcf77('0x5c')]['id'])});}}else{socket[_0xcf77('0xba')](_0xcf77('0xbb'),{'UserId':Number(_0x50a6fc[_0xcf77('0x4a')][_0xcf77('0x6f')]),'MailAccountId':Number(_0x50a6fc[_0xcf77('0x5c')]['id'])});}});}})[_0xcf77('0x26')](respondWithStatusCode(_0x32c2a0,null))[_0xcf77('0x1c')](handleError(_0x32c2a0,null));};exports[_0xcf77('0xbc')]=function(_0x48e515,_0x59ede7){var _0x7346a9={};var _0x547515={};var _0x1c08bc;var _0x252b9b;return db[_0xcf77('0x57')][_0xcf77('0x6d')]({'where':{'id':_0x48e515[_0xcf77('0x5c')]['id']}})[_0xcf77('0x26')](handleEntityNotFound(_0x59ede7,null))[_0xcf77('0x26')](function(_0x4b0b6f){if(_0x4b0b6f){_0x1c08bc=_0x4b0b6f;_0x547515[_0xcf77('0x49')]=_[_0xcf77('0x5f')](db[_0xcf77('0x88')]['rawAttributes']);_0x547515['query']=_[_0xcf77('0x5f')](_0x48e515[_0xcf77('0x4a')]);_0x547515['filters']=_[_0xcf77('0x4c')](_0x547515[_0xcf77('0x49')],_0x547515[_0xcf77('0x4a')]);_0x7346a9[_0xcf77('0x4e')]=_['intersection'](_0x547515[_0xcf77('0x49')],qs[_0xcf77('0x4d')](_0x48e515[_0xcf77('0x4a')][_0xcf77('0x4d')]));_0x7346a9['attributes']=_0x7346a9['attributes'][_0xcf77('0x60')]?_0x7346a9[_0xcf77('0x4e')]:_0x547515['model'];_0x7346a9['order']=qs[_0xcf77('0x52')](_0x48e515[_0xcf77('0x4a')]['sort']);_0x7346a9[_0xcf77('0x55')]=qs[_0xcf77('0x4b')](_[_0xcf77('0x53')](_0x48e515[_0xcf77('0x4a')],_0x547515[_0xcf77('0x4b')]));if(_0x48e515[_0xcf77('0x4a')][_0xcf77('0x54')]){_0x7346a9['where']=_[_0xcf77('0x61')](_0x7346a9[_0xcf77('0x55')],{'$or':_[_0xcf77('0x46')](_0x7346a9[_0xcf77('0x4e')],function(_0x3931ee){var _0x59bf75={};_0x59bf75[_0x3931ee]={'$like':'%'+_0x48e515[_0xcf77('0x4a')]['filter']+'%'};return _0x59bf75;})});}_0x7346a9=_[_0xcf77('0x61')]({},_0x7346a9,_0x48e515[_0xcf77('0x56')]);return _0x1c08bc['getAgents'](_0x7346a9);}})[_0xcf77('0x26')](function(_0x3273b1){if(_0x3273b1){_0x252b9b=_0x3273b1[_0xcf77('0x60')];if(!_0x48e515[_0xcf77('0x4a')]['hasOwnProperty'](_0xcf77('0x50'))){_0x7346a9[_0xcf77('0x20')]=qs[_0xcf77('0x20')](_0x48e515[_0xcf77('0x4a')][_0xcf77('0x20')]);_0x7346a9[_0xcf77('0x1f')]=qs[_0xcf77('0x1f')](_0x48e515[_0xcf77('0x4a')]['offset']);}return _0x1c08bc['getAgents'](_0x7346a9);}})[_0xcf77('0x26')](function(_0x4be482){if(_0x4be482){return _0x4be482?{'count':_0x252b9b,'rows':_0x4be482}:null;}})[_0xcf77('0x26')](respondWithResult(_0x59ede7,null))[_0xcf77('0x1c')](handleError(_0x59ede7,null));}; \ No newline at end of file +var _0xbb9f=['DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','Contacts','defaults','subject','attach','out','messageId','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','undefined','limit','set','json','then','destroy','MailAccounts','UserProfileResource','sendStatus','stack','name','gmail','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','modernAuthentication','CloudProviderId','pass','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','Pause','map','MailAccount','fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','MailServerOut','mandatoryDispositionPause','length','find','update','body','provider','custom','describe','addDisposition','MailAccountId','create','Disposition','rawAttributes','hasOwnProperty','pick','options','count','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','finally','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','CmList','List','updatedAt'];(function(_0x54d37c,_0x4f2092){var _0x58c129=function(_0x4c9737){while(--_0x4c9737){_0x54d37c['push'](_0x54d37c['shift']());}};_0x58c129(++_0x4f2092);}(_0xbb9f,0xec));var _0xfbb9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb9f[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xfbb9('0x0'));var BPromise=require(_0xfbb9('0x1'));var util=require(_0xfbb9('0x2'));var path=require('path');var _=require(_0xfbb9('0x3'));var juice=require('juice');var Redis=require(_0xfbb9('0x4'));var qs=require(_0xfbb9('0x5'));var logger=require(_0xfbb9('0x6'))(_0xfbb9('0x7'));var config=require(_0xfbb9('0x8'));var db=require(_0xfbb9('0x9'))['db'];config[_0xfbb9('0xa')]=_['defaults'](config[_0xfbb9('0xa')],{'host':_0xfbb9('0xb'),'port':0x18eb});var socket=require(_0xfbb9('0xc'))(new Redis(config[_0xfbb9('0xa')]));require(_0xfbb9('0xd'))['register'](socket);var jayson=require(_0xfbb9('0xe'));var client=jayson[_0xfbb9('0xf')][_0xfbb9('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x2d81f4,_0x274fd3,_0x13b1db,_0x19d433){return new BPromise(function(_0x521a56,_0x460bd2){var _0x44c43a=_0x19d433||client;return _0x44c43a['request'](_0x2d81f4,_0x13b1db)['then'](function(_0x47a52a){logger[_0xfbb9('0x11')](_0xfbb9('0x12'),_0x274fd3,_0xfbb9('0x13'));logger[_0xfbb9('0x14')](_0xfbb9('0x15'),_0x274fd3,_0xfbb9('0x13'),JSON[_0xfbb9('0x16')](_0x47a52a));if(_0x47a52a['error']){if(_0x47a52a[_0xfbb9('0x17')][_0xfbb9('0x18')]===0x1f4){logger[_0xfbb9('0x17')](_0xfbb9('0x12'),_0x274fd3,_0x47a52a[_0xfbb9('0x17')][_0xfbb9('0x19')]);return _0x460bd2(_0x47a52a['error'][_0xfbb9('0x19')]);}logger[_0xfbb9('0x17')](_0xfbb9('0x12'),_0x274fd3,_0x47a52a[_0xfbb9('0x17')]['message']);return _0x521a56(_0x47a52a[_0xfbb9('0x17')][_0xfbb9('0x19')]);}else{logger[_0xfbb9('0x11')]('MailAccount,\x20%s,\x20%s',_0x274fd3,'request\x20sent');_0x521a56(_0x47a52a[_0xfbb9('0x1a')][_0xfbb9('0x19')]);}})[_0xfbb9('0x1b')](function(_0x3a2b8a){logger['error'](_0xfbb9('0x12'),_0x274fd3,_0x3a2b8a);_0x460bd2(_0x3a2b8a);});});}function respondWithStatusCode(_0xe3266e,_0x3de31d){_0x3de31d=_0x3de31d||0xcc;return function(_0x36e353){if(_0x36e353){return _0xe3266e['sendStatus'](_0x3de31d);}return _0xe3266e[_0xfbb9('0x1c')](_0x3de31d)[_0xfbb9('0x1d')]();};}function respondWithResult(_0x2944d5,_0x33459a){_0x33459a=_0x33459a||0xc8;return function(_0x1ac490){if(_0x1ac490){return _0x2944d5[_0xfbb9('0x1c')](_0x33459a)['json'](_0x1ac490);}};}function respondWithFilteredResult(_0x511c5c,_0x40db76){return function(_0x2b2d10){if(_0x2b2d10){var _0xd99a5b=typeof _0x40db76[_0xfbb9('0x1e')]===_0xfbb9('0x1f')&&typeof _0x40db76[_0xfbb9('0x20')]===_0xfbb9('0x1f');var _0x5ae9fa=_0x2b2d10['count'];var _0x58cff5=_0xd99a5b?0x0:_0x40db76[_0xfbb9('0x1e')];var _0xe94484=_0xd99a5b?_0x2b2d10['count']:_0x40db76[_0xfbb9('0x1e')]+_0x40db76[_0xfbb9('0x20')];var _0x4bf224;if(_0xe94484>=_0x5ae9fa){_0xe94484=_0x5ae9fa;_0x4bf224=0xc8;}else{_0x4bf224=0xce;}_0x511c5c[_0xfbb9('0x1c')](_0x4bf224);return _0x511c5c[_0xfbb9('0x21')]('Content-Range',_0x58cff5+'-'+_0xe94484+'/'+_0x5ae9fa)[_0xfbb9('0x22')](_0x2b2d10);}return null;};}function saveUpdates(_0x2f862d){return function(_0xdf6ad2){if(_0xdf6ad2){return _0xdf6ad2['update'](_0x2f862d)[_0xfbb9('0x23')](function(_0x492cfd){return _0x492cfd;});}return null;};}function removeEntity(_0xd2930d){return function(_0x366300){if(_0x366300){return _0x366300[_0xfbb9('0x24')]()['then'](function(){var _0x3fa27e=_0x366300['get']({'plain':!![]});var _0x2fe0fc=_0xfbb9('0x25');return db[_0xfbb9('0x26')]['destroy']({'where':{'type':_0x2fe0fc,'resourceId':_0x3fa27e['id']}})['then'](function(){return _0x366300;});})[_0xfbb9('0x23')](function(){_0xd2930d[_0xfbb9('0x1c')](0xcc)[_0xfbb9('0x1d')]();});}};}function handleEntityNotFound(_0x5101cf){return function(_0x2a8596){if(!_0x2a8596){_0x5101cf[_0xfbb9('0x27')](0x194);}return _0x2a8596;};}function handleError(_0x35a5a6,_0x45cab3){_0x45cab3=_0x45cab3||0x1f4;return function(_0x3169f2){logger[_0xfbb9('0x17')](_0x3169f2[_0xfbb9('0x28')]);if(_0x3169f2['name']){delete _0x3169f2[_0xfbb9('0x29')];}_0x35a5a6[_0xfbb9('0x1c')](_0x45cab3)['send'](_0x3169f2);};}function getImapHost(_0x28cdd6){switch(_0x28cdd6){case _0xfbb9('0x2a'):return'imap.gmail.com';case _0xfbb9('0x2b'):return _0xfbb9('0x2c');case _0xfbb9('0x2d'):return'imap-mail.outlook.com';case _0xfbb9('0x2e'):return _0xfbb9('0x2f');}throw new Error(_0xfbb9('0x30'),_0x28cdd6);}function getSmtpHost(_0x200cc5){switch(_0x200cc5){case _0xfbb9('0x2a'):return'smtp.gmail.com';case'yahoo':return _0xfbb9('0x31');case _0xfbb9('0x2d'):return _0xfbb9('0x32');case _0xfbb9('0x2e'):return _0xfbb9('0x33');}throw new Error('Unknown\x20email\x20service\x20provider',_0x200cc5);}function getAuthenticationOptions(_0x224127,_0x2c14f2){var _0x40c295={};var _0x49fb8c={};if(_0x224127){_0x40c295[_0xfbb9('0x34')]=_0x49fb8c[_0xfbb9('0x34')]=_0x2c14f2[_0xfbb9('0x35')];_0x40c295[_0xfbb9('0x36')]=_0x49fb8c['pass']=_0x2c14f2[_0xfbb9('0x36')];if(_0x2c14f2[_0xfbb9('0x37')]){_0x40c295[_0xfbb9('0x37')]=_0x49fb8c[_0xfbb9('0x37')]=!![];_0x40c295['CloudProviderId']=_0x49fb8c[_0xfbb9('0x38')]=_0x2c14f2['CloudProviderId'];_0x40c295[_0xfbb9('0x36')]=_0x49fb8c[_0xfbb9('0x39')]=null;}else{_0x40c295[_0xfbb9('0x38')]=_0x49fb8c[_0xfbb9('0x38')]=null;}_0x40c295[_0xfbb9('0x3a')]=getImapHost(_0x224127);_0x40c295[_0xfbb9('0x3b')]=0x3e1;_0x49fb8c[_0xfbb9('0x3a')]=getSmtpHost(_0x224127);_0x49fb8c[_0xfbb9('0x3b')]=0x24b;_0x49fb8c[_0xfbb9('0x3c')]=![];_0x40c295[_0xfbb9('0x3d')]=_0x49fb8c[_0xfbb9('0x3d')]=null;}else{if(_0x2c14f2[_0xfbb9('0x3e')]){_0x40c295[_0xfbb9('0x34')]=_0x49fb8c[_0xfbb9('0x34')]=_0x2c14f2[_0xfbb9('0x35')];_0x40c295['password']=_0x49fb8c[_0xfbb9('0x39')]=_0x2c14f2[_0xfbb9('0x36')];}else{_0x40c295['authentication']=_0x49fb8c['authentication']=![];_0x40c295[_0xfbb9('0x34')]=_0x49fb8c[_0xfbb9('0x34')]=null;_0x40c295[_0xfbb9('0x36')]=_0x49fb8c[_0xfbb9('0x39')]=null;}_0x40c295[_0xfbb9('0x3a')]=_0x2c14f2['Imap'][_0xfbb9('0x3a')];_0x40c295[_0xfbb9('0x3b')]=_0x2c14f2[_0xfbb9('0x3f')]['port'];_0x49fb8c['host']=_0x2c14f2[_0xfbb9('0x40')]['host'];_0x49fb8c[_0xfbb9('0x3b')]=_0x2c14f2[_0xfbb9('0x40')][_0xfbb9('0x3b')];}return{'Imap':_0x40c295,'Smtp':_0x49fb8c};}exports[_0xfbb9('0x41')]=function(_0x45054f,_0x5b6921){var _0x45c2c5={'include':[{'model':db[_0xfbb9('0x42')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xfbb9('0x40')},{'model':db[_0xfbb9('0x43')],'as':'mandatoryDispositionPause'}]},_0x26fdfa={},_0x1a4956={'count':0x0,'rows':[]};var _0x43efed=_[_0xfbb9('0x44')](db[_0xfbb9('0x45')]['rawAttributes'],function(_0x1b3faa){return{'name':_0x1b3faa[_0xfbb9('0x46')],'type':_0x1b3faa[_0xfbb9('0x47')]['key']};});_0x26fdfa[_0xfbb9('0x48')]=_[_0xfbb9('0x44')](_0x43efed,_0xfbb9('0x29'));_0x26fdfa[_0xfbb9('0x49')]=_[_0xfbb9('0x4a')](_0x45054f[_0xfbb9('0x49')]);_0x26fdfa[_0xfbb9('0x4b')]=_[_0xfbb9('0x4c')](_0x26fdfa[_0xfbb9('0x48')],_0x26fdfa[_0xfbb9('0x49')]);_0x45c2c5['attributes']=_[_0xfbb9('0x4c')](_0x26fdfa[_0xfbb9('0x48')],qs[_0xfbb9('0x4d')](_0x45054f[_0xfbb9('0x49')][_0xfbb9('0x4d')]));_0x45c2c5[_0xfbb9('0x4e')]=_0x45c2c5[_0xfbb9('0x4e')]['length']?_0x45c2c5[_0xfbb9('0x4e')]:_0x26fdfa[_0xfbb9('0x48')];if(!_0x45054f['query']['hasOwnProperty'](_0xfbb9('0x4f'))){_0x45c2c5[_0xfbb9('0x20')]=qs[_0xfbb9('0x20')](_0x45054f['query'][_0xfbb9('0x20')]);_0x45c2c5['offset']=qs[_0xfbb9('0x1e')](_0x45054f['query'][_0xfbb9('0x1e')]);}_0x45c2c5[_0xfbb9('0x50')]=qs[_0xfbb9('0x51')](_0x45054f[_0xfbb9('0x49')]['sort']);_0x45c2c5[_0xfbb9('0x52')]=qs['filters'](_['pick'](_0x45054f[_0xfbb9('0x49')],_0x26fdfa[_0xfbb9('0x4b')]),_0x43efed);if(_0x45054f[_0xfbb9('0x49')][_0xfbb9('0x53')]){_0x45c2c5['where']=_[_0xfbb9('0x54')](_0x45c2c5[_0xfbb9('0x52')],{'$or':_[_0xfbb9('0x44')](_0x43efed,function(_0x33a594){if(_0x33a594[_0xfbb9('0x47')]!==_0xfbb9('0x55')){var _0x2bec01={};_0x2bec01[_0x33a594[_0xfbb9('0x29')]]={'$like':'%'+_0x45054f[_0xfbb9('0x49')][_0xfbb9('0x53')]+'%'};return _0x2bec01;}})});}_0x45c2c5=_[_0xfbb9('0x54')]({},_0x45c2c5,_0x45054f['options']);var _0x27ee65={'where':_0x45c2c5['where']};return db[_0xfbb9('0x45')]['count'](_0x27ee65)[_0xfbb9('0x23')](function(_0x20e983){_0x1a4956['count']=_0x20e983;if(_0x45054f[_0xfbb9('0x49')][_0xfbb9('0x56')]){_0x45c2c5[_0xfbb9('0x57')]=[{'all':!![]}];}return db[_0xfbb9('0x45')][_0xfbb9('0x58')](_0x45c2c5);})[_0xfbb9('0x23')](function(_0x563052){_0x1a4956[_0xfbb9('0x59')]=_0x563052;return _0x1a4956;})['then'](respondWithFilteredResult(_0x5b6921,_0x45c2c5))[_0xfbb9('0x1b')](handleError(_0x5b6921,null));};exports[_0xfbb9('0x5a')]=function(_0x506804,_0x111403){var _0x21cc1f={'raw':![],'where':{'id':_0x506804[_0xfbb9('0x5b')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xfbb9('0x3f')},{'model':db[_0xfbb9('0x5c')],'as':_0xfbb9('0x40')},{'model':db[_0xfbb9('0x43')],'as':_0xfbb9('0x5d')}]},_0x20739d={};_0x20739d[_0xfbb9('0x48')]=_[_0xfbb9('0x4a')](db[_0xfbb9('0x45')]['rawAttributes']);_0x20739d['query']=_[_0xfbb9('0x4a')](_0x506804[_0xfbb9('0x49')]);_0x20739d[_0xfbb9('0x4b')]=_[_0xfbb9('0x4c')](_0x20739d[_0xfbb9('0x48')],_0x20739d['query']);_0x21cc1f[_0xfbb9('0x4e')]=_[_0xfbb9('0x4c')](_0x20739d[_0xfbb9('0x48')],qs[_0xfbb9('0x4d')](_0x506804[_0xfbb9('0x49')]['fields']));_0x21cc1f['attributes']=_0x21cc1f['attributes'][_0xfbb9('0x5e')]?_0x21cc1f[_0xfbb9('0x4e')]:_0x20739d[_0xfbb9('0x48')];if(_0x506804['query'][_0xfbb9('0x56')]){_0x21cc1f[_0xfbb9('0x57')]=[{'all':!![]}];}_0x21cc1f=_['merge']({},_0x21cc1f,_0x506804['options']);return db[_0xfbb9('0x45')][_0xfbb9('0x5f')](_0x21cc1f)[_0xfbb9('0x23')](handleEntityNotFound(_0x111403,null))[_0xfbb9('0x23')](respondWithResult(_0x111403,null))[_0xfbb9('0x1b')](handleError(_0x111403,null));};exports[_0xfbb9('0x60')]=function(_0x550994,_0x476f63){if(_0x550994[_0xfbb9('0x61')]['id']){delete _0x550994[_0xfbb9('0x61')]['id'];}var _0x4b49d2=_0x550994['body'][_0xfbb9('0x62')]===_0xfbb9('0x63')?null:_0x550994[_0xfbb9('0x61')][_0xfbb9('0x62')];var _0x19ca8f=_0x550994[_0xfbb9('0x61')][_0xfbb9('0x3f')]||{};var _0x19ce70=_0x550994['body'][_0xfbb9('0x40')]||{};if(_0x4b49d2){_0x19ca8f[_0xfbb9('0x3a')]=getImapHost(_0x4b49d2);_0x19ca8f[_0xfbb9('0x3b')]=0x3e1;_0x19ce70[_0xfbb9('0x3a')]=getSmtpHost(_0x4b49d2);_0x19ce70['port']=0x24b;_0x19ce70[_0xfbb9('0x3c')]=![];}if(_0x19ce70[_0xfbb9('0x37')]){_0x19ce70[_0xfbb9('0x3c')]=![];}else{_0x19ce70[_0xfbb9('0x38')]=null;}if(!_0x19ca8f[_0xfbb9('0x37')])_0x19ca8f[_0xfbb9('0x38')]=null;_0x550994[_0xfbb9('0x61')]['Imap']=_0x19ca8f;_0x550994[_0xfbb9('0x61')]['Smtp']=_0x19ce70;return db[_0xfbb9('0x45')]['find']({'where':{'id':_0x550994[_0xfbb9('0x5b')]['id']},'include':[{'model':db[_0xfbb9('0x42')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xfbb9('0x40')},{'model':db['Pause'],'as':_0xfbb9('0x5d')}]})['then'](handleEntityNotFound(_0x476f63,null))[_0xfbb9('0x23')](function(_0x5b1471){if(!_0x5b1471)throw new Error('Mail\x20Account\x20not\x20found');if(_0x5b1471['service'])delete _0x550994[_0xfbb9('0x61')][_0xfbb9('0x3f')];return _0x5b1471;})[_0xfbb9('0x23')](saveUpdates(_0x550994['body'],null))[_0xfbb9('0x23')](function(_0x13a8c8){if(!_0x550994[_0xfbb9('0x61')][_0xfbb9('0x3f')])return _0x13a8c8;return db[_0xfbb9('0x42')]['update'](_0x550994[_0xfbb9('0x61')][_0xfbb9('0x3f')],{'where':{'MailAccountId':_0x13a8c8['id']}})[_0xfbb9('0x23')](function(){return _0x13a8c8;});})['then'](function(_0x56bc0a){if(!_0x550994[_0xfbb9('0x61')][_0xfbb9('0x40')])return _0x56bc0a;return db[_0xfbb9('0x5c')]['update'](_0x550994['body'][_0xfbb9('0x40')],{'where':{'MailAccountId':_0x56bc0a['id']}})['then'](function(){return _0x56bc0a;});})['then'](respondWithResult(_0x476f63,null))[_0xfbb9('0x1b')](handleError(_0x476f63,null));};exports[_0xfbb9('0x64')]=function(_0x2e58d9,_0x4da77e){return db[_0xfbb9('0x45')]['describe']()[_0xfbb9('0x23')](respondWithResult(_0x4da77e,null))['catch'](handleError(_0x4da77e,null));};exports[_0xfbb9('0x65')]=function(_0x2d00e4,_0x5f5501){if(_0x2d00e4[_0xfbb9('0x61')]['id']){delete _0x2d00e4['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x2d00e4[_0xfbb9('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5f5501,null))[_0xfbb9('0x23')](function(_0x2d9808){if(_0x2d9808){_0x2d00e4[_0xfbb9('0x61')][_0xfbb9('0x66')]=_0x2d9808['id'];return db['Disposition'][_0xfbb9('0x67')](_0x2d00e4[_0xfbb9('0x61')]);}})[_0xfbb9('0x23')](respondWithResult(_0x5f5501,null))[_0xfbb9('0x1b')](handleError(_0x5f5501,null));};exports['getDispositions']=function(_0x25851e,_0x43135f){var _0x31960e={'raw':![],'where':{}};var _0x536d5e={};var _0x1a1222={'count':0x0,'rows':[]};return db[_0xfbb9('0x45')]['findOne']({'where':{'id':_0x25851e[_0xfbb9('0x5b')]['id']}})[_0xfbb9('0x23')](handleEntityNotFound(_0x43135f,null))[_0xfbb9('0x23')](function(_0x88ee5c){if(_0x88ee5c){_0x536d5e[_0xfbb9('0x48')]=_[_0xfbb9('0x4a')](db[_0xfbb9('0x68')][_0xfbb9('0x69')]);_0x536d5e['query']=_['keys'](_0x25851e['query']);_0x536d5e['filters']=_[_0xfbb9('0x4c')](_0x536d5e[_0xfbb9('0x48')],_0x536d5e['query']);_0x31960e[_0xfbb9('0x4e')]=_['intersection'](_0x536d5e[_0xfbb9('0x48')],qs['fields'](_0x25851e[_0xfbb9('0x49')][_0xfbb9('0x4d')]));_0x31960e['attributes']=_0x31960e[_0xfbb9('0x4e')][_0xfbb9('0x5e')]?_0x31960e['attributes']:_0x536d5e[_0xfbb9('0x48')];if(!_0x25851e[_0xfbb9('0x49')][_0xfbb9('0x6a')](_0xfbb9('0x4f'))){_0x31960e[_0xfbb9('0x20')]=qs[_0xfbb9('0x20')](_0x25851e[_0xfbb9('0x49')][_0xfbb9('0x20')]);_0x31960e[_0xfbb9('0x1e')]=qs['offset'](_0x25851e[_0xfbb9('0x49')][_0xfbb9('0x1e')]);}_0x31960e[_0xfbb9('0x50')]=qs['sort'](_0x25851e[_0xfbb9('0x49')]['sort']);_0x31960e['where']=qs['filters'](_[_0xfbb9('0x6b')](_0x25851e['query'],_0x536d5e[_0xfbb9('0x4b')]));_0x31960e[_0xfbb9('0x52')][_0xfbb9('0x66')]=_0x88ee5c['id'];if(_0x25851e[_0xfbb9('0x49')][_0xfbb9('0x53')]){_0x31960e['where']=_['merge'](_0x31960e[_0xfbb9('0x52')],{'$or':_[_0xfbb9('0x44')](_0x31960e[_0xfbb9('0x4e')],function(_0x5d6760){var _0x4ca5fd={};_0x4ca5fd[_0x5d6760]={'$like':'%'+_0x25851e[_0xfbb9('0x49')][_0xfbb9('0x53')]+'%'};return _0x4ca5fd;})});}_0x31960e=_[_0xfbb9('0x54')]({},_0x31960e,_0x25851e[_0xfbb9('0x6c')]);return db[_0xfbb9('0x68')][_0xfbb9('0x6d')]({'where':_0x31960e['where']})[_0xfbb9('0x23')](function(_0x230c8d){_0x1a1222[_0xfbb9('0x6d')]=_0x230c8d;if(_0x25851e[_0xfbb9('0x49')][_0xfbb9('0x56')]){_0x31960e['include']=[{'all':!![]}];}return db[_0xfbb9('0x68')]['findAll'](_0x31960e);})[_0xfbb9('0x23')](function(_0x1a1cf1){_0x1a1222['rows']=_0x1a1cf1;return _0x1a1222;});}})[_0xfbb9('0x23')](respondWithFilteredResult(_0x43135f,_0x31960e))[_0xfbb9('0x1b')](handleError(_0x43135f,null));};exports[_0xfbb9('0x6e')]=function(_0x527cae,_0x181f50){return db[_0xfbb9('0x45')]['find']({'where':{'id':_0x527cae[_0xfbb9('0x5b')]['id']}})[_0xfbb9('0x23')](handleEntityNotFound(_0x181f50,null))[_0xfbb9('0x23')](function(_0xcedc0){if(_0xcedc0){return _0xcedc0['removeDispositions'](_0x527cae[_0xfbb9('0x49')][_0xfbb9('0x6f')]);}})[_0xfbb9('0x23')](respondWithStatusCode(_0x181f50,null))[_0xfbb9('0x1b')](handleError(_0x181f50,null));};exports[_0xfbb9('0x70')]=function(_0x4e8cad,_0x5da617){if(_0x4e8cad['body']['id']){delete _0x4e8cad[_0xfbb9('0x61')]['id'];}return db[_0xfbb9('0x45')]['find']({'where':{'id':_0x4e8cad['params']['id']}})[_0xfbb9('0x23')](handleEntityNotFound(_0x5da617,null))[_0xfbb9('0x23')](function(_0x2d2991){if(_0x2d2991){_0x4e8cad['body'][_0xfbb9('0x66')]=_0x2d2991['id'];return db[_0xfbb9('0x71')][_0xfbb9('0x67')](_0x4e8cad[_0xfbb9('0x61')]);}})[_0xfbb9('0x23')](respondWithResult(_0x5da617,null))[_0xfbb9('0x1b')](handleError(_0x5da617,null));};exports[_0xfbb9('0x72')]=function(_0x437517,_0x47fbb3){var _0xd48dc2={'raw':![],'where':{}};var _0x206c5a={};var _0x6fef3f={'count':0x0,'rows':[]};return db[_0xfbb9('0x45')][_0xfbb9('0x73')]({'where':{'id':_0x437517['params']['id']}})[_0xfbb9('0x23')](handleEntityNotFound(_0x47fbb3,null))[_0xfbb9('0x23')](function(_0x36949f){if(_0x36949f){_0x206c5a[_0xfbb9('0x48')]=_[_0xfbb9('0x4a')](db[_0xfbb9('0x71')][_0xfbb9('0x69')]);_0x206c5a['query']=_[_0xfbb9('0x4a')](_0x437517['query']);_0x206c5a['filters']=_[_0xfbb9('0x4c')](_0x206c5a['model'],_0x206c5a['query']);_0xd48dc2[_0xfbb9('0x4e')]=_[_0xfbb9('0x4c')](_0x206c5a[_0xfbb9('0x48')],qs['fields'](_0x437517[_0xfbb9('0x49')][_0xfbb9('0x4d')]));_0xd48dc2[_0xfbb9('0x4e')]=_0xd48dc2['attributes'][_0xfbb9('0x5e')]?_0xd48dc2[_0xfbb9('0x4e')]:_0x206c5a[_0xfbb9('0x48')];if(!_0x437517[_0xfbb9('0x49')][_0xfbb9('0x6a')]('nolimit')){_0xd48dc2['limit']=qs['limit'](_0x437517[_0xfbb9('0x49')]['limit']);_0xd48dc2[_0xfbb9('0x1e')]=qs[_0xfbb9('0x1e')](_0x437517[_0xfbb9('0x49')][_0xfbb9('0x1e')]);}_0xd48dc2[_0xfbb9('0x50')]=qs[_0xfbb9('0x51')](_0x437517[_0xfbb9('0x49')][_0xfbb9('0x51')]);_0xd48dc2[_0xfbb9('0x52')]=qs[_0xfbb9('0x4b')](_[_0xfbb9('0x6b')](_0x437517[_0xfbb9('0x49')],_0x206c5a[_0xfbb9('0x4b')]));_0xd48dc2[_0xfbb9('0x52')]['MailAccountId']=_0x36949f['id'];if(_0x437517[_0xfbb9('0x49')][_0xfbb9('0x53')]){_0xd48dc2[_0xfbb9('0x52')]=_['merge'](_0xd48dc2[_0xfbb9('0x52')],{'$or':_[_0xfbb9('0x44')](_0xd48dc2[_0xfbb9('0x4e')],function(_0x555bc1){var _0x3cf0aa={};_0x3cf0aa[_0x555bc1]={'$like':'%'+_0x437517['query']['filter']+'%'};return _0x3cf0aa;})});}_0xd48dc2=_[_0xfbb9('0x54')]({},_0xd48dc2,_0x437517[_0xfbb9('0x6c')]);return db[_0xfbb9('0x71')][_0xfbb9('0x6d')]({'where':_0xd48dc2['where']})[_0xfbb9('0x23')](function(_0x593f9c){_0x6fef3f[_0xfbb9('0x6d')]=_0x593f9c;if(_0x437517[_0xfbb9('0x49')][_0xfbb9('0x56')]){_0xd48dc2[_0xfbb9('0x57')]=[{'all':!![]}];}return db[_0xfbb9('0x71')]['findAll'](_0xd48dc2);})[_0xfbb9('0x23')](function(_0x1ba0a4){_0x6fef3f['rows']=_0x1ba0a4;return _0x6fef3f;});}})['then'](respondWithFilteredResult(_0x47fbb3,_0xd48dc2))['catch'](handleError(_0x47fbb3,null));};exports[_0xfbb9('0x74')]=function(_0x35c527,_0x5a203d){return db[_0xfbb9('0x45')]['find']({'where':{'id':_0x35c527[_0xfbb9('0x5b')]['id']}})[_0xfbb9('0x23')](handleEntityNotFound(_0x5a203d,null))[_0xfbb9('0x23')](function(_0x32ca1e){if(_0x32ca1e){return _0x32ca1e['removeAnswers'](_0x35c527[_0xfbb9('0x49')][_0xfbb9('0x6f')]);}})[_0xfbb9('0x23')](respondWithStatusCode(_0x5a203d,null))[_0xfbb9('0x1b')](handleError(_0x5a203d,null));};exports[_0xfbb9('0x67')]=function(_0x128ac5,_0x2f3014){var _0x6e1fb5={'name':_0x128ac5[_0xfbb9('0x61')][_0xfbb9('0x29')],'key':_0x128ac5[_0xfbb9('0x61')]['key'],'provider':_0x128ac5[_0xfbb9('0x61')][_0xfbb9('0x62')]===_0xfbb9('0x63')?null:_0x128ac5[_0xfbb9('0x61')][_0xfbb9('0x62')],'email':_0x128ac5['body'][_0xfbb9('0x75')],'ListId':_0x128ac5[_0xfbb9('0x61')][_0xfbb9('0x76')],'active':!_[_0xfbb9('0x77')](_0x128ac5['body'][_0xfbb9('0x78')])?_0x128ac5[_0xfbb9('0x61')][_0xfbb9('0x78')]:!![],'description':_0x128ac5[_0xfbb9('0x61')][_0xfbb9('0x79')]||null};var _0x314a4e=getAuthenticationOptions(_0x6e1fb5['provider'],_0x128ac5[_0xfbb9('0x61')]);_0x6e1fb5[_0xfbb9('0x3f')]=_0x314a4e[_0xfbb9('0x3f')];_0x6e1fb5[_0xfbb9('0x40')]=_0x314a4e[_0xfbb9('0x40')];return db['MailAccount'][_0xfbb9('0x67')](_0x6e1fb5,{'include':[{'model':db[_0xfbb9('0x5c')],'as':_0xfbb9('0x40')},{'model':db[_0xfbb9('0x42')],'as':_0xfbb9('0x3f')}]})[_0xfbb9('0x23')](function(_0x13952e){var _0x10a4bd=_0x128ac5[_0xfbb9('0x34')]['get']({'plain':!![]});if(!_0x10a4bd)throw new Error(_0xfbb9('0x7a'));if(_0x10a4bd[_0xfbb9('0x7b')]===_0xfbb9('0x34')){var _0x4a21ac=_0x13952e[_0xfbb9('0x7c')]({'plain':!![]});return db[_0xfbb9('0x7d')][_0xfbb9('0x5f')]({'where':{'name':_0xfbb9('0x25'),'userProfileId':_0x10a4bd[_0xfbb9('0x7e')]},'raw':!![]})[_0xfbb9('0x23')](function(_0xe7b6c8){if(_0xe7b6c8&&_0xe7b6c8['autoAssociation']===0x0){return db[_0xfbb9('0x26')][_0xfbb9('0x67')]({'name':_0x4a21ac[_0xfbb9('0x29')],'resourceId':_0x4a21ac['id'],'type':_0xe7b6c8['name'],'sectionId':_0xe7b6c8['id']},{})[_0xfbb9('0x23')](function(){return _0x13952e;});}else{return _0x13952e;}})[_0xfbb9('0x1b')](function(_0x544f7d){logger[_0xfbb9('0x17')](_0xfbb9('0x7f'),_0x544f7d);throw _0x544f7d;});}return _0x13952e;})[_0xfbb9('0x23')](respondWithResult(_0x2f3014,0xc9))[_0xfbb9('0x1b')](handleError(_0x2f3014,null));};exports[_0xfbb9('0x80')]=function(_0x2ddab1,_0x1fe7dd){return db[_0xfbb9('0x45')][_0xfbb9('0x73')]({'where':{'id':_0x2ddab1[_0xfbb9('0x5b')]['id']}})[_0xfbb9('0x23')](handleEntityNotFound(_0x1fe7dd,null))[_0xfbb9('0x23')](function(_0x32e429){if(_0x32e429){return _0x32e429['getImap']();}return null;})[_0xfbb9('0x23')](respondWithResult(_0x1fe7dd,null))[_0xfbb9('0x1b')](handleError(_0x1fe7dd,null));};exports[_0xfbb9('0x81')]=function(_0x452ce6,_0x4b547e){if(_0x452ce6[_0xfbb9('0x61')]['id']){delete _0x452ce6[_0xfbb9('0x61')]['id'];}return db[_0xfbb9('0x45')][_0xfbb9('0x5f')]({'where':{'id':_0x452ce6[_0xfbb9('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4b547e,null))[_0xfbb9('0x23')](function(_0xe203a1){if(_0xe203a1){_0x452ce6[_0xfbb9('0x61')]['MailAccountId']=_0xe203a1['id'];return db['MailServerIn'][_0xfbb9('0x67')](_0x452ce6[_0xfbb9('0x61')]);}})[_0xfbb9('0x23')](respondWithResult(_0x4b547e,null))[_0xfbb9('0x1b')](handleError(_0x4b547e,null));};exports[_0xfbb9('0x82')]=function(_0xf5ce60,_0x4b0406){return db[_0xfbb9('0x45')]['findOne']({'where':{'id':_0xf5ce60[_0xfbb9('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4b0406,null))['then'](function(_0x1b4eec){if(_0x1b4eec){return _0x1b4eec[_0xfbb9('0x83')](null);}return null;})['then'](respondWithStatusCode(_0x4b0406,null))['catch'](handleError(_0x4b0406,null));};exports[_0xfbb9('0x84')]=function(_0x4871b4,_0x36d906){return db[_0xfbb9('0x45')][_0xfbb9('0x73')]({'where':{'id':_0x4871b4[_0xfbb9('0x5b')]['id']}})[_0xfbb9('0x23')](handleEntityNotFound(_0x36d906,null))[_0xfbb9('0x23')](function(_0xf1784c){if(_0xf1784c){return _0xf1784c[_0xfbb9('0x84')]();}return null;})[_0xfbb9('0x23')](respondWithResult(_0x36d906,null))[_0xfbb9('0x1b')](handleError(_0x36d906,null));};exports['addSmtp']=function(_0x210223,_0x4c60b1){if(_0x210223[_0xfbb9('0x61')]['id']){delete _0x210223[_0xfbb9('0x61')]['id'];}return db['MailAccount'][_0xfbb9('0x5f')]({'where':{'id':_0x210223[_0xfbb9('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4c60b1,null))[_0xfbb9('0x23')](function(_0x2d8e3e){if(_0x2d8e3e){_0x210223['body'][_0xfbb9('0x66')]=_0x2d8e3e['id'];return db['MailServerOut']['create'](_0x210223[_0xfbb9('0x61')]);}})['then'](respondWithResult(_0x4c60b1,null))[_0xfbb9('0x1b')](handleError(_0x4c60b1,null));};exports[_0xfbb9('0x85')]=function(_0x1eb2a0,_0x2cc263){return db[_0xfbb9('0x45')][_0xfbb9('0x73')]({'where':{'id':_0x1eb2a0[_0xfbb9('0x5b')]['id']}})[_0xfbb9('0x23')](handleEntityNotFound(_0x2cc263,null))[_0xfbb9('0x23')](function(_0x9d0505){if(_0x9d0505){return _0x9d0505[_0xfbb9('0x86')](null);}return null;})[_0xfbb9('0x23')](respondWithStatusCode(_0x2cc263,null))[_0xfbb9('0x1b')](handleError(_0x2cc263,null));};exports[_0xfbb9('0x87')]=function(_0xd03404,_0x4a1a1b){return db[_0xfbb9('0x88')]['find']({'where':{'id':_0xd03404[_0xfbb9('0x5b')]['id']}})[_0xfbb9('0x23')](handleEntityNotFound(_0x4a1a1b,null))[_0xfbb9('0x23')](function(_0x1b87f1){if(_0x1b87f1){return _0x1b87f1[_0xfbb9('0x87')](_0xd03404[_0xfbb9('0x61')]['ids'],_[_0xfbb9('0x89')](_0xd03404['body'],['ids','id'])||{});}})[_0xfbb9('0x23')](respondWithResult(_0x4a1a1b,null))[_0xfbb9('0x1b')](handleError(_0x4a1a1b,null));};exports['getInteractions']=function(_0x3a0e60,_0x495cc9){var _0x27a399={'raw':![],'where':{}};var _0x5a26c0={};var _0x149af0={'count':0x0,'rows':[]};return db[_0xfbb9('0x45')][_0xfbb9('0x73')]({'where':{'id':_0x3a0e60[_0xfbb9('0x5b')]['id']}})['then'](handleEntityNotFound(_0x495cc9,null))[_0xfbb9('0x23')](function(_0x2ef758){if(_0x2ef758){_0x5a26c0[_0xfbb9('0x48')]=_[_0xfbb9('0x4a')](db[_0xfbb9('0x88')][_0xfbb9('0x69')]);_0x5a26c0['query']=_[_0xfbb9('0x4a')](_0x3a0e60['query']);_0x5a26c0['filters']=_[_0xfbb9('0x4c')](_0x5a26c0[_0xfbb9('0x48')],_0x5a26c0[_0xfbb9('0x49')]);_0x27a399[_0xfbb9('0x4e')]=_[_0xfbb9('0x4c')](_0x5a26c0[_0xfbb9('0x48')],qs[_0xfbb9('0x4d')](_0x3a0e60['query']['fields']));_0x27a399[_0xfbb9('0x4e')]=_0x27a399['attributes'][_0xfbb9('0x5e')]?_0x27a399[_0xfbb9('0x4e')]:_0x5a26c0[_0xfbb9('0x48')];if(!_0x3a0e60[_0xfbb9('0x49')][_0xfbb9('0x6a')](_0xfbb9('0x4f'))){_0x27a399['limit']=qs['limit'](_0x3a0e60[_0xfbb9('0x49')]['limit']);_0x27a399[_0xfbb9('0x1e')]=qs[_0xfbb9('0x1e')](_0x3a0e60['query'][_0xfbb9('0x1e')]);}_0x27a399[_0xfbb9('0x50')]=qs[_0xfbb9('0x51')](_0x3a0e60[_0xfbb9('0x49')][_0xfbb9('0x51')]);_0x27a399[_0xfbb9('0x52')]=qs[_0xfbb9('0x4b')](_[_0xfbb9('0x6b')](_0x3a0e60[_0xfbb9('0x49')],_0x5a26c0[_0xfbb9('0x4b')]));_0x27a399[_0xfbb9('0x52')]['MailAccountId']=_0x2ef758['id'];if(_0x3a0e60[_0xfbb9('0x49')][_0xfbb9('0x53')]){_0x27a399[_0xfbb9('0x52')]=_['merge'](_0x27a399[_0xfbb9('0x52')],{'$or':_['map'](_0x27a399[_0xfbb9('0x4e')],function(_0x2887a7){var _0x3def61={};_0x3def61[_0x2887a7]={'$like':'%'+_0x3a0e60[_0xfbb9('0x49')][_0xfbb9('0x53')]+'%'};return _0x3def61;})});}_0x27a399=_[_0xfbb9('0x54')]({},_0x27a399,_0x3a0e60[_0xfbb9('0x6c')]);return db[_0xfbb9('0x88')][_0xfbb9('0x6d')]({'where':_0x27a399[_0xfbb9('0x52')]})[_0xfbb9('0x23')](function(_0x1e95eb){_0x149af0[_0xfbb9('0x6d')]=_0x1e95eb;if(_0x3a0e60[_0xfbb9('0x49')]['includeAll']){_0x27a399[_0xfbb9('0x57')]=[{'model':db[_0xfbb9('0x8a')],'as':_0xfbb9('0x8b'),'required':![]},{'model':db[_0xfbb9('0x8c')],'as':_0xfbb9('0x8d'),'attributes':[_0xfbb9('0x29'),_0xfbb9('0x8e'),_0xfbb9('0x8f')],'required':![]},{'model':db[_0xfbb9('0x90')],'as':_0xfbb9('0x91'),'attributes':['id','name',_0xfbb9('0x92')],'where':_0x3a0e60['query'][_0xfbb9('0x93')]?{'id':_0x3a0e60[_0xfbb9('0x49')][_0xfbb9('0x93')]}:undefined,'required':_0x3a0e60['query'][_0xfbb9('0x93')]?!![]:![]}];}return db['MailInteraction'][_0xfbb9('0x58')](_0x27a399);})[_0xfbb9('0x23')](function(_0x34339c){_0x149af0[_0xfbb9('0x59')]=_0x34339c;return _0x149af0;});}})[_0xfbb9('0x23')](respondWithFilteredResult(_0x495cc9,_0x27a399))[_0xfbb9('0x1b')](handleError(_0x495cc9,null));};exports[_0xfbb9('0x94')]=function addApplications(_0x1907ef,_0x23d979){var _0x31313d=_0x1907ef[_0xfbb9('0x5b')]['id'];var _0x3d839e=_0x1907ef[_0xfbb9('0x61')];var _0x1fe0ee=0xc8;var _0x4cde23=null;return db['sequelize'][_0xfbb9('0x95')]({'isolationLevel':db['sequelize'][_0xfbb9('0x96')][_0xfbb9('0x97')][_0xfbb9('0x98')]},function(_0x51e564){return db[_0xfbb9('0x45')]['findOne']({'where':{'id':_0x31313d},'transaction':_0x51e564})[_0xfbb9('0x23')](function(_0x27a03c){if(_0x27a03c){return db[_0xfbb9('0x99')][_0xfbb9('0x24')]({'where':{'MailAccountId':_0x31313d},'transaction':_0x51e564})[_0xfbb9('0x23')](function(){var _0x1264f5=_[_0xfbb9('0x44')](_0x3d839e,function(_0x5b8fa9){_0x5b8fa9[_0xfbb9('0x66')]=_0x31313d;return _0x5b8fa9;});return db[_0xfbb9('0x99')]['bulkCreate'](_0x1264f5,{'transaction':_0x51e564});});}else{_0x1fe0ee=0x194;_0x4cde23=[];}});})[_0xfbb9('0x23')](function(){if(_0x1fe0ee!==0x194){return db[_0xfbb9('0x99')][_0xfbb9('0x9a')]({'where':{'MailAccountId':_0x31313d},'order':'priority'})['then'](function(_0x593b1f){_0x4cde23=_0x593b1f;});}})['catch'](function(_0x20514e){_0x1fe0ee=0x1f4;logger[_0xfbb9('0x17')](_0x20514e[_0xfbb9('0x28')]);if(_0x20514e['name']){delete _0x20514e['name'];}_0x4cde23=_0x20514e;})[_0xfbb9('0x9b')](function(){if(_0x4cde23===null){_0x23d979['sendStatus'](_0x1fe0ee);}else{if(_0x1fe0ee===0x1f4){_0x23d979['status'](_0x1fe0ee)['send'](_0x4cde23);}else{_0x23d979['status'](_0x1fe0ee)[_0xfbb9('0x22')](_0x4cde23);}}});};exports[_0xfbb9('0x9c')]=function(_0x5430f4,_0xf4f8ab){var _0x4709fb={};var _0x24478a={};var _0x58b483;var _0x55c4ef;return db[_0xfbb9('0x45')][_0xfbb9('0x73')]({'where':{'id':_0x5430f4[_0xfbb9('0x5b')]['id']}})['then'](handleEntityNotFound(_0xf4f8ab,null))[_0xfbb9('0x23')](function(_0x3b95e0){if(_0x3b95e0){_0x58b483=_0x3b95e0;_0x24478a['model']=_[_0xfbb9('0x4a')](db[_0xfbb9('0x99')]['rawAttributes']);_0x24478a[_0xfbb9('0x49')]=_[_0xfbb9('0x4a')](_0x5430f4[_0xfbb9('0x49')]);_0x24478a['filters']=_[_0xfbb9('0x4c')](_0x24478a['model'],_0x24478a[_0xfbb9('0x49')]);_0x4709fb['attributes']=_[_0xfbb9('0x4c')](_0x24478a[_0xfbb9('0x48')],qs[_0xfbb9('0x4d')](_0x5430f4['query']['fields']));_0x4709fb['attributes']=_0x4709fb[_0xfbb9('0x4e')][_0xfbb9('0x5e')]?_0x4709fb[_0xfbb9('0x4e')]:_0x24478a[_0xfbb9('0x48')];_0x4709fb[_0xfbb9('0x50')]=qs[_0xfbb9('0x51')](_0x5430f4[_0xfbb9('0x49')][_0xfbb9('0x51')]);_0x4709fb[_0xfbb9('0x52')]=qs[_0xfbb9('0x4b')](_['pick'](_0x5430f4['query'],_0x24478a['filters']));if(_0x5430f4[_0xfbb9('0x49')][_0xfbb9('0x53')]){_0x4709fb[_0xfbb9('0x52')]=_[_0xfbb9('0x54')](_0x4709fb[_0xfbb9('0x52')],{'$or':_[_0xfbb9('0x44')](_0x4709fb['attributes'],function(_0x5e5e71){var _0x3e072a={};_0x3e072a[_0x5e5e71]={'$like':'%'+_0x5430f4['query'][_0xfbb9('0x53')]+'%'};return _0x3e072a;})});}_0x4709fb=_[_0xfbb9('0x54')]({},_0x4709fb,_0x5430f4['options']);return _0x58b483[_0xfbb9('0x9c')](_0x4709fb);}})[_0xfbb9('0x23')](function(_0x5ae59d){if(_0x5ae59d){_0x55c4ef=_0x5ae59d[_0xfbb9('0x5e')];if(!_0x5430f4[_0xfbb9('0x49')][_0xfbb9('0x6a')]('nolimit')){_0x4709fb[_0xfbb9('0x20')]=qs[_0xfbb9('0x20')](_0x5430f4[_0xfbb9('0x49')]['limit']);_0x4709fb['offset']=qs[_0xfbb9('0x1e')](_0x5430f4[_0xfbb9('0x49')][_0xfbb9('0x1e')]);}return _0x58b483['getApplications'](_0x4709fb);}})[_0xfbb9('0x23')](function(_0x3b4a3e){if(_0x3b4a3e){return _0x3b4a3e?{'count':_0x55c4ef,'rows':_0x3b4a3e}:null;}})[_0xfbb9('0x23')](respondWithResult(_0xf4f8ab,null))[_0xfbb9('0x1b')](handleError(_0xf4f8ab,null));};exports[_0xfbb9('0x9d')]=function(_0x2eaa2d,_0x90094e){var _0x2dbb4f={'raw':!![],'where':{}};var _0x5319cc={};var _0x38ca39={'count':0x0,'rows':[]};return db[_0xfbb9('0x45')][_0xfbb9('0x73')]({'where':{'id':_0x2eaa2d[_0xfbb9('0x5b')]['id']}})[_0xfbb9('0x23')](handleEntityNotFound(_0x90094e,null))[_0xfbb9('0x23')](function(_0x3eb6a1){if(_0x3eb6a1){_0x5319cc[_0xfbb9('0x48')]=_[_0xfbb9('0x4a')](db[_0xfbb9('0x9e')][_0xfbb9('0x69')]);_0x5319cc['query']=_[_0xfbb9('0x4a')](_0x2eaa2d[_0xfbb9('0x49')]);_0x5319cc[_0xfbb9('0x4b')]=_[_0xfbb9('0x4c')](_0x5319cc['model'],_0x5319cc[_0xfbb9('0x49')]);_0x2dbb4f[_0xfbb9('0x4e')]=_[_0xfbb9('0x4c')](_0x5319cc['model'],qs[_0xfbb9('0x4d')](_0x2eaa2d[_0xfbb9('0x49')][_0xfbb9('0x4d')]));_0x2dbb4f[_0xfbb9('0x4e')]=_0x2dbb4f[_0xfbb9('0x4e')][_0xfbb9('0x5e')]?_0x2dbb4f[_0xfbb9('0x4e')]:_0x5319cc[_0xfbb9('0x48')];if(!_0x2eaa2d[_0xfbb9('0x49')][_0xfbb9('0x6a')]('nolimit')){_0x2dbb4f[_0xfbb9('0x20')]=qs[_0xfbb9('0x20')](_0x2eaa2d['query'][_0xfbb9('0x20')]);_0x2dbb4f['offset']=qs[_0xfbb9('0x1e')](_0x2eaa2d[_0xfbb9('0x49')][_0xfbb9('0x1e')]);}_0x2dbb4f[_0xfbb9('0x50')]=qs['sort'](_0x2eaa2d[_0xfbb9('0x49')][_0xfbb9('0x51')]);_0x2dbb4f['where']=qs['filters'](_[_0xfbb9('0x6b')](_0x2eaa2d['query'],_0x5319cc['filters']));_0x2dbb4f[_0xfbb9('0x52')][_0xfbb9('0x66')]=_0x3eb6a1['id'];if(_0x2eaa2d[_0xfbb9('0x49')][_0xfbb9('0x53')]){_0x2dbb4f[_0xfbb9('0x52')]=_[_0xfbb9('0x54')](_0x2dbb4f[_0xfbb9('0x52')],{'$or':_[_0xfbb9('0x44')](_0x2dbb4f[_0xfbb9('0x4e')],function(_0xd44d82){var _0x4b0ceb={};_0x4b0ceb[_0xd44d82]={'$like':'%'+_0x2eaa2d[_0xfbb9('0x49')][_0xfbb9('0x53')]+'%'};return _0x4b0ceb;})});}if(_0x2eaa2d['query'][_0xfbb9('0x9f')]){var _0xa9eebd=_0x2eaa2d[_0xfbb9('0x49')][_0xfbb9('0x9f')]['split'](',');var _0x38502d={};_0x38502d[_0xa9eebd[0x0]]={'$gte':moment(_0xa9eebd[0x1])[_0xfbb9('0xa0')](_0xfbb9('0xa1'))};_0x2dbb4f['where']=_[_0xfbb9('0x54')](_0x2dbb4f['where'],_0x38502d);}_0x2dbb4f=_[_0xfbb9('0x54')]({},_0x2dbb4f,_0x2eaa2d[_0xfbb9('0x6c')]);return db[_0xfbb9('0x9e')][_0xfbb9('0x6d')]({'where':_0x2dbb4f[_0xfbb9('0x52')]})['then'](function(_0x3d1b31){_0x38ca39[_0xfbb9('0x6d')]=_0x3d1b31;if(_0x2eaa2d[_0xfbb9('0x49')][_0xfbb9('0x56')]){_0x2dbb4f['include']=[{'all':!![]}];}return db[_0xfbb9('0x9e')]['findAll'](_0x2dbb4f);})[_0xfbb9('0x23')](function(_0x839d6e){if(_0x2eaa2d[_0xfbb9('0x49')][_0xfbb9('0xa2')]===_0xfbb9('0xa3')){for(var _0x254e32=0x0;_0x254e32<_0x839d6e[_0xfbb9('0x5e')];_0x254e32++){_0x839d6e[_0x254e32][_0xfbb9('0x61')]=juice(_0x839d6e[_0x254e32][_0xfbb9('0x61')]);}}_0x38ca39[_0xfbb9('0x59')]=_0x839d6e;return _0x38ca39;});}})[_0xfbb9('0x23')](respondWithFilteredResult(_0x90094e,_0x2dbb4f))[_0xfbb9('0x1b')](handleError(_0x90094e,null));};exports['send']=function(_0x7e455e,_0x508f00){var _0x4d65ac,_0x30e679={},_0x5d46f2;if(_0x7e455e['body']['to']){_0x5d46f2=_0x7e455e[_0xfbb9('0x61')]['to'][_0xfbb9('0xa4')](',')[0x0];}return db[_0xfbb9('0x45')][_0xfbb9('0x5f')]({'where':{'id':_0x7e455e['params']['id']},'include':[{'model':db[_0xfbb9('0xa5')],'as':_0xfbb9('0xa6'),'include':[{'model':db[_0xfbb9('0x8a')],'as':'Contacts','where':{'email':_0x5d46f2},'limit':0x1,'order':[[_0xfbb9('0xa7'),_0xfbb9('0xa8')]]}]},{'model':db['MailServerOut'],'as':_0xfbb9('0x40'),'raw':!![],'include':[{'model':db[_0xfbb9('0xa9')],'as':_0xfbb9('0xa9'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x508f00,null))[_0xfbb9('0x23')](function(_0x166276){if(!_0x166276)return;_0x4d65ac=_0x166276;if(!_0x166276[_0xfbb9('0x40')])throw new Error(_0xfbb9('0xaa'));if(_[_0xfbb9('0x77')](_0x7e455e[_0xfbb9('0x61')][_0xfbb9('0xab')])){_0x7e455e['body']['from']=util['format'](_0xfbb9('0xac'),_0x166276[_0xfbb9('0x29')],_0x166276[_0xfbb9('0x75')]||_0x166276[_0xfbb9('0x40')][_0xfbb9('0x34')]);}if(_0x7e455e[_0xfbb9('0x61')][_0xfbb9('0xad')]&&_0x7e455e[_0xfbb9('0x61')][_0xfbb9('0xad')][_0xfbb9('0x5e')]){for(var _0x3d0b0e=0x0;_0x3d0b0e<_0x7e455e[_0xfbb9('0x61')][_0xfbb9('0xad')][_0xfbb9('0x5e')];_0x3d0b0e+=0x1){_0x7e455e[_0xfbb9('0x61')][_0xfbb9('0xad')][_0x3d0b0e]={'filename':_0x7e455e[_0xfbb9('0x61')][_0xfbb9('0xad')][_0x3d0b0e][_0xfbb9('0x29')],'path':path[_0xfbb9('0xae')](config[_0xfbb9('0xaf')],_0xfbb9('0xb0'),_0x7e455e['body'][_0xfbb9('0xad')][_0x3d0b0e][_0xfbb9('0xb1')])};}}var _0x220d6b=_0x166276[_0xfbb9('0xb2')]();return respondWithRpcPromise(_0xfbb9('0xb3'),_0xfbb9('0xb4'),{'account':_0x220d6b,'message':_0x7e455e[_0xfbb9('0x61')]});})['then'](function(_0x589c94){if(!_0x589c94)return;_0x30e679=_0x589c94;if(!_0x4d65ac[_0xfbb9('0xa6')])throw new Error(_0xfbb9('0xb5'));if(_0x4d65ac[_0xfbb9('0xa6')]['Contacts'][_0xfbb9('0x5e')])return _0x4d65ac[_0xfbb9('0xa6')][_0xfbb9('0xb6')][0x0];return db[_0xfbb9('0x8a')][_0xfbb9('0x67')](_[_0xfbb9('0xb7')](_0x7e455e[_0xfbb9('0x61')],{'firstName':_0x7e455e[_0xfbb9('0x61')]['to'],'email':_0x7e455e[_0xfbb9('0x61')]['to'],'phone':_0x7e455e[_0xfbb9('0x61')]['to'],'ListId':_0x4d65ac['ListId']}));})['then'](function(_0x13bf34){if(!_0x13bf34)return;var _0x3161e6={'UserId':_0x7e455e[_0xfbb9('0x34')]['id'],'ContactId':_0x13bf34['id'],'MailAccountId':_0x4d65ac['id'],'inReplyTo':_0x30e679['messageId'],'to':_0x7e455e['body'][_0xfbb9('0xab')],'cc':_0x7e455e[_0xfbb9('0x61')]['cc'],'subject':_0x7e455e[_0xfbb9('0x61')][_0xfbb9('0xb8')],'attach':_0x7e455e[_0xfbb9('0x61')][_0xfbb9('0xb9')],'firstMsgDirection':_0xfbb9('0xba'),'lastMsgAt':moment()[_0xfbb9('0xa0')](_0xfbb9('0xa1')),'lastMsgDirection':_0xfbb9('0xba'),'Messages':[_[_0xfbb9('0x54')](_0x7e455e[_0xfbb9('0x61')],{'messageId':_0x30e679[_0xfbb9('0xbb')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x4d65ac['id'],'UserId':_0x7e455e[_0xfbb9('0x34')]['id'],'ContactId':_0x13bf34['id']})]};if(_0x7e455e['body'][_0xfbb9('0xbc')]){_0x3161e6=_[_0xfbb9('0x54')](_0x3161e6,_0x7e455e[_0xfbb9('0x61')]['Interaction']);}return db['MailInteraction']['create'](_0x3161e6,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0xfbb9('0x23')](respondWithResult(_0x508f00,null))[_0xfbb9('0x1b')](handleError(_0x508f00,null));};exports[_0xfbb9('0xbd')]=function(_0x38a81e,_0xb6c06e){return db[_0xfbb9('0x45')][_0xfbb9('0x5f')]({'where':{'id':_0x38a81e[_0xfbb9('0x5b')]['id']},'include':[{'model':db[_0xfbb9('0x5c')],'as':_0xfbb9('0x40'),'raw':!![],'include':[{'model':db[_0xfbb9('0xa9')],'as':_0xfbb9('0xa9'),'raw':!![]}]}]})[_0xfbb9('0x23')](handleEntityNotFound(_0xb6c06e,null))[_0xfbb9('0x23')](function(_0x2fe54d){if(!_0x2fe54d['Smtp'])return;var _0x3d3321=_0x2fe54d[_0xfbb9('0xb2')]();return respondWithRpcPromise(_0xfbb9('0xbe'),_0xfbb9('0xbd'),{'account':_0x3d3321});})[_0xfbb9('0x23')](respondWithResult(_0xb6c06e,null))['catch'](handleError(_0xb6c06e,null));};exports[_0xfbb9('0x24')]=function(_0x337f80,_0x36759b){return db[_0xfbb9('0x45')][_0xfbb9('0x5f')]({'where':{'id':_0x337f80[_0xfbb9('0x5b')]['id']}})[_0xfbb9('0x23')](handleEntityNotFound(_0x36759b,null))[_0xfbb9('0x23')](function(_0x3b7cac){if(_0x3b7cac&&_0x3b7cac[_0xfbb9('0x3d')]){throw new db[(_0xfbb9('0xbf'))][(_0xfbb9('0xc0'))](_0xfbb9('0xc1'));}return _0x3b7cac;})[_0xfbb9('0x23')](removeEntity(_0x36759b,null))[_0xfbb9('0x1b')](handleError(_0x36759b,null));};exports[_0xfbb9('0xc2')]=function(_0x27a713,_0x2efb6b){return db[_0xfbb9('0x45')]['find']({'where':{'id':_0x27a713[_0xfbb9('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2efb6b,null))[_0xfbb9('0x23')](function(_0x3cffe9){if(_0x3cffe9){return _0x3cffe9[_0xfbb9('0xc2')](_0x27a713['body'][_0xfbb9('0x6f')],_[_0xfbb9('0x89')](_0x27a713[_0xfbb9('0x61')],[_0xfbb9('0x6f'),'id'])||{})[_0xfbb9('0xc3')](function(_0x3a9585){for(var _0x20cee5=0x0;_0x20cee5<_0x27a713['body']['ids'][_0xfbb9('0x5e')];_0x20cee5+=0x1){socket['emit'](_0xfbb9('0xc4'),{'UserId':Number(_0x27a713['body'][_0xfbb9('0x6f')][_0x20cee5]),'MailAccountId':Number(_0x27a713[_0xfbb9('0x5b')]['id'])});}return _0x3a9585;});}})[_0xfbb9('0x23')](respondWithResult(_0x2efb6b,null))['catch'](handleError(_0x2efb6b,null));};exports[_0xfbb9('0xc5')]=function(_0x28955c,_0x224c0c){return db[_0xfbb9('0x45')][_0xfbb9('0x5f')]({'where':{'id':_0x28955c[_0xfbb9('0x5b')]['id']}})[_0xfbb9('0x23')](handleEntityNotFound(_0x224c0c,null))[_0xfbb9('0x23')](function(_0x2fb18d){if(_0x2fb18d){return _0x2fb18d[_0xfbb9('0xc5')](_0x28955c[_0xfbb9('0x49')][_0xfbb9('0x6f')])[_0xfbb9('0x23')](function(){if(_[_0xfbb9('0xc6')](_0x28955c[_0xfbb9('0x49')][_0xfbb9('0x6f')])){for(var _0x2478eb=0x0;_0x2478eb<_0x28955c[_0xfbb9('0x49')][_0xfbb9('0x6f')][_0xfbb9('0x5e')];_0x2478eb+=0x1){socket[_0xfbb9('0xc7')](_0xfbb9('0xc8'),{'UserId':Number(_0x28955c['query'][_0xfbb9('0x6f')][_0x2478eb]),'MailAccountId':Number(_0x28955c[_0xfbb9('0x5b')]['id'])});}}else{socket[_0xfbb9('0xc7')](_0xfbb9('0xc8'),{'UserId':Number(_0x28955c['query'][_0xfbb9('0x6f')]),'MailAccountId':Number(_0x28955c[_0xfbb9('0x5b')]['id'])});}});}})[_0xfbb9('0x23')](respondWithStatusCode(_0x224c0c,null))[_0xfbb9('0x1b')](handleError(_0x224c0c,null));};exports[_0xfbb9('0xc9')]=function(_0x187927,_0x34044d){var _0x33439={};var _0x5b14d9={};var _0x243c74;var _0x4bc9ea;return db['MailAccount'][_0xfbb9('0x73')]({'where':{'id':_0x187927['params']['id']}})[_0xfbb9('0x23')](handleEntityNotFound(_0x34044d,null))['then'](function(_0x4481a2){if(_0x4481a2){_0x243c74=_0x4481a2;_0x5b14d9['model']=_[_0xfbb9('0x4a')](db['User'][_0xfbb9('0x69')]);_0x5b14d9[_0xfbb9('0x49')]=_[_0xfbb9('0x4a')](_0x187927['query']);_0x5b14d9[_0xfbb9('0x4b')]=_[_0xfbb9('0x4c')](_0x5b14d9['model'],_0x5b14d9[_0xfbb9('0x49')]);_0x33439[_0xfbb9('0x4e')]=_[_0xfbb9('0x4c')](_0x5b14d9[_0xfbb9('0x48')],qs[_0xfbb9('0x4d')](_0x187927[_0xfbb9('0x49')][_0xfbb9('0x4d')]));_0x33439['attributes']=_0x33439[_0xfbb9('0x4e')][_0xfbb9('0x5e')]?_0x33439[_0xfbb9('0x4e')]:_0x5b14d9[_0xfbb9('0x48')];_0x33439[_0xfbb9('0x50')]=qs[_0xfbb9('0x51')](_0x187927[_0xfbb9('0x49')][_0xfbb9('0x51')]);_0x33439[_0xfbb9('0x52')]=qs[_0xfbb9('0x4b')](_[_0xfbb9('0x6b')](_0x187927[_0xfbb9('0x49')],_0x5b14d9[_0xfbb9('0x4b')]));if(_0x187927[_0xfbb9('0x49')]['filter']){_0x33439[_0xfbb9('0x52')]=_[_0xfbb9('0x54')](_0x33439[_0xfbb9('0x52')],{'$or':_['map'](_0x33439[_0xfbb9('0x4e')],function(_0x2eb4ff){var _0xedf3ea={};_0xedf3ea[_0x2eb4ff]={'$like':'%'+_0x187927['query'][_0xfbb9('0x53')]+'%'};return _0xedf3ea;})});}_0x33439=_[_0xfbb9('0x54')]({},_0x33439,_0x187927['options']);return _0x243c74[_0xfbb9('0xc9')](_0x33439);}})[_0xfbb9('0x23')](function(_0x1740b2){if(_0x1740b2){_0x4bc9ea=_0x1740b2[_0xfbb9('0x5e')];if(!_0x187927['query'][_0xfbb9('0x6a')](_0xfbb9('0x4f'))){_0x33439[_0xfbb9('0x20')]=qs[_0xfbb9('0x20')](_0x187927[_0xfbb9('0x49')][_0xfbb9('0x20')]);_0x33439[_0xfbb9('0x1e')]=qs[_0xfbb9('0x1e')](_0x187927[_0xfbb9('0x49')][_0xfbb9('0x1e')]);}return _0x243c74[_0xfbb9('0xc9')](_0x33439);}})[_0xfbb9('0x23')](function(_0x4da13d){if(_0x4da13d){return _0x4da13d?{'count':_0x4bc9ea,'rows':_0x4da13d}:null;}})[_0xfbb9('0x23')](respondWithResult(_0x34044d,null))[_0xfbb9('0x1b')](handleError(_0x34044d,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index d724cc4..61c4f26 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 _0xca83=['exports','events','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1c5950,_0x49e128){var _0x2b720a=function(_0x4454f1){while(--_0x4454f1){_0x1c5950['push'](_0x1c5950['shift']());}};_0x2b720a(++_0x49e128);}(_0xca83,0x99));var _0x3ca8=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xca83[_0x1cc8fe];return _0x230054;};'use strict';var EventEmitter=require(_0x3ca8('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x3ca8('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3ca8('0x2')](0x0);var events={'afterCreate':_0x3ca8('0x3'),'afterUpdate':_0x3ca8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x37f7a8){return function(_0x51a29c,_0x1b29d8,_0x11e82f){MailAccountEvents['emit'](_0x37f7a8+':'+_0x51a29c['id'],_0x51a29c);MailAccountEvents[_0x3ca8('0x5')](_0x37f7a8,_0x51a29c);_0x11e82f(null);};}for(var e in events){if(events[_0x3ca8('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x3ca8('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x7add=['events','../../mysqldb','MailAccount','save','update','hasOwnProperty'];(function(_0x56a2c2,_0x52c048){var _0x3cff55=function(_0xd42208){while(--_0xd42208){_0x56a2c2['push'](_0x56a2c2['shift']());}};_0x3cff55(++_0x52c048);}(_0x7add,0x72));var _0xd7ad=function(_0x2ee318,_0x27eaa5){_0x2ee318=_0x2ee318-0x0;var _0x49f1a4=_0x7add[_0x2ee318];return _0x49f1a4;};'use strict';var EventEmitter=require(_0xd7ad('0x0'));var MailAccount=require(_0xd7ad('0x1'))['db'][_0xd7ad('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd7ad('0x3'),'afterUpdate':_0xd7ad('0x4'),'afterDestroy':'remove'};function emitEvent(_0x45a446){return function(_0x5bb43f,_0x212036,_0x99c5bd){MailAccountEvents['emit'](_0x45a446+':'+_0x5bb43f['id'],_0x5bb43f);MailAccountEvents['emit'](_0x45a446,_0x5bb43f);_0x99c5bd(null);};}for(var e in events){if(events[_0xd7ad('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index c904f33..d6514f5 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 _0x29a9=['data5','pass','./mailAccount.attributes','define','MailAccount','mail_accounts','provider','service','host','Smtp','port','secure','authentication','CloudProvider','auth','user'];(function(_0x46e8e3,_0x2278b){var _0x3e1efd=function(_0x530e5c){while(--_0x530e5c){_0x46e8e3['push'](_0x46e8e3['shift']());}};_0x3e1efd(++_0x2278b);}(_0x29a9,0x172));var _0x929a=function(_0x3d8ba1,_0x5ba1fd){_0x3d8ba1=_0x3d8ba1-0x0;var _0x87804e=_0x29a9[_0x3d8ba1];return _0x87804e;};'use strict';var attributes=require(_0x929a('0x0'));module['exports']=function(_0x3c1205){return _0x3c1205[_0x929a('0x1')](_0x929a('0x2'),attributes,{'tableName':_0x929a('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4eeaf5=this;var _0x290dd7={'id':_0x4eeaf5['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4eeaf5[_0x929a('0x4')]!=='custom'){_0x290dd7[_0x929a('0x5')]=_0x4eeaf5[_0x929a('0x4')];}else{_0x290dd7[_0x929a('0x6')]=_0x4eeaf5[_0x929a('0x7')][_0x929a('0x6')];_0x290dd7['port']=_0x4eeaf5[_0x929a('0x7')][_0x929a('0x8')];_0x290dd7[_0x929a('0x9')]=_0x4eeaf5[_0x929a('0x7')][_0x929a('0x9')];}if(_0x4eeaf5[_0x929a('0x7')][_0x929a('0xa')]){if(_0x4eeaf5['Smtp']['modernAuthentication']){if(!_0x4eeaf5['Smtp'][_0x929a('0xb')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x290dd7[_0x929a('0xc')]={'type':'OAuth2','user':_0x4eeaf5[_0x929a('0x7')][_0x929a('0xd')],'accessToken':_0x4eeaf5[_0x929a('0x7')]['CloudProvider'][_0x929a('0xe')]};}else{_0x290dd7[_0x929a('0xc')]={'user':_0x4eeaf5[_0x929a('0x7')]['user'],'pass':_0x4eeaf5[_0x929a('0x7')][_0x929a('0xf')]};}}return _0x290dd7;}}});}; \ No newline at end of file +var _0x0340=['pass','./mailAccount.attributes','exports','define','mail_accounts','custom','service','Smtp','host','port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5'];(function(_0x26f4a4,_0xeb0dc6){var _0x437404=function(_0x173ca5){while(--_0x173ca5){_0x26f4a4['push'](_0x26f4a4['shift']());}};_0x437404(++_0xeb0dc6);}(_0x0340,0xbc));var _0x0034=function(_0x3821c8,_0x5ec164){_0x3821c8=_0x3821c8-0x0;var _0xe7cf77=_0x0340[_0x3821c8];return _0xe7cf77;};'use strict';var attributes=require(_0x0034('0x0'));module[_0x0034('0x1')]=function(_0x2aa286){return _0x2aa286[_0x0034('0x2')]('MailAccount',attributes,{'tableName':_0x0034('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x38309a=this;var _0x3ed262={'id':_0x38309a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x38309a['provider']!==_0x0034('0x4')){_0x3ed262[_0x0034('0x5')]=_0x38309a['provider'];}else{_0x3ed262['host']=_0x38309a[_0x0034('0x6')][_0x0034('0x7')];_0x3ed262[_0x0034('0x8')]=_0x38309a[_0x0034('0x6')]['port'];_0x3ed262[_0x0034('0x9')]=_0x38309a[_0x0034('0x6')]['secure'];}if(_0x38309a[_0x0034('0x6')]['authentication']){if(_0x38309a[_0x0034('0x6')][_0x0034('0xa')]){if(!_0x38309a[_0x0034('0x6')][_0x0034('0xb')])throw new Error(_0x0034('0xc'));_0x3ed262['auth']={'type':_0x0034('0xd'),'user':_0x38309a['Smtp'][_0x0034('0xe')],'accessToken':_0x38309a['Smtp']['CloudProvider'][_0x0034('0xf')]};}else{_0x3ed262['auth']={'user':_0x38309a[_0x0034('0x6')]['user'],'pass':_0x38309a[_0x0034('0x6')][_0x0034('0x10')]};}}return _0x3ed262;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 8675f94..8abda0a 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 _0xcd59=['request\x20sent','stringify','error','code','message','result','catch','MailAccount','options','raw','where','attributes','limit','map','include','model','then','GetMailAccount','debug','ShowMailAccount','smtp','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','isNil','from','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','find','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','applications','list','orderBy','priority','autoclose','push','*,*,*,*','Applications','length','ListId','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','spread','update','format','interaction','create','attachments','originTo','originCc','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','User','unshift','agent','name','waitForTheAssignedAgent','MailQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s'];(function(_0xb3ca23,_0xbe9314){var _0x5b8cb6=function(_0x1b89ef){while(--_0x1b89ef){_0xb3ca23['push'](_0xb3ca23['shift']());}};_0x5b8cb6(++_0xbe9314);}(_0xcd59,0x14b));var _0x9cd5=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0xcd59[_0x4a599b];return _0x2d53d3;};'use strict';var _=require(_0x9cd5('0x0'));var moment=require(_0x9cd5('0x1'));var BPromise=require(_0x9cd5('0x2'));var rs=require(_0x9cd5('0x3'));var Redis=require(_0x9cd5('0x4'));var db=require(_0x9cd5('0x5'))['db'];var logger=require('../../config/logger')(_0x9cd5('0x6'));var config=require(_0x9cd5('0x7'));var jayson=require(_0x9cd5('0x8'));var client=jayson[_0x9cd5('0x9')][_0x9cd5('0xa')]({'port':0x232c});config[_0x9cd5('0xb')]=_[_0x9cd5('0xc')](config[_0x9cd5('0xb')],{'host':_0x9cd5('0xd'),'port':0x18eb});var socket=require(_0x9cd5('0xe'))(new Redis(config['redis']));require(_0x9cd5('0xf'))[_0x9cd5('0x10')](socket);function respondWithRpcPromise(_0x37b97f,_0x23e524,_0x162cb0){return new BPromise(function(_0x4099d0,_0x46bbca){return client[_0x9cd5('0x11')](_0x37b97f,_0x162cb0)['then'](function(_0x1c5b71){logger[_0x9cd5('0x12')](_0x9cd5('0x13'),_0x23e524,_0x9cd5('0x14'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x23e524,_0x9cd5('0x14'),JSON[_0x9cd5('0x15')](_0x1c5b71));if(_0x1c5b71[_0x9cd5('0x16')]){if(_0x1c5b71[_0x9cd5('0x16')][_0x9cd5('0x17')]===0x1f4){logger[_0x9cd5('0x16')]('MailAccount,\x20%s,\x20%s',_0x23e524,_0x1c5b71[_0x9cd5('0x16')][_0x9cd5('0x18')]);return _0x46bbca(_0x1c5b71[_0x9cd5('0x16')]['message']);}logger['error']('MailAccount,\x20%s,\x20%s',_0x23e524,_0x1c5b71[_0x9cd5('0x16')][_0x9cd5('0x18')]);return _0x4099d0(_0x1c5b71['error'][_0x9cd5('0x18')]);}else{logger[_0x9cd5('0x12')](_0x9cd5('0x13'),_0x23e524,'request\x20sent');_0x4099d0(_0x1c5b71[_0x9cd5('0x19')][_0x9cd5('0x18')]);}})[_0x9cd5('0x1a')](function(_0x3a6f01){logger[_0x9cd5('0x16')](_0x9cd5('0x13'),_0x23e524,_0x3a6f01);_0x46bbca(_0x3a6f01);});});}exports['GetMailAccount']=function(_0x37ea13){var _0x18346f=this;return new Promise(function(_0x3661b0,_0xb97394){return db[_0x9cd5('0x1b')]['findAll']({'raw':_0x37ea13[_0x9cd5('0x1c')]?_0x37ea13[_0x9cd5('0x1c')][_0x9cd5('0x1d')]===undefined?!![]:![]:!![],'where':_0x37ea13[_0x9cd5('0x1c')]?_0x37ea13[_0x9cd5('0x1c')][_0x9cd5('0x1e')]||null:null,'attributes':_0x37ea13[_0x9cd5('0x1c')]?_0x37ea13[_0x9cd5('0x1c')][_0x9cd5('0x1f')]||null:null,'limit':_0x37ea13['options']?_0x37ea13[_0x9cd5('0x1c')][_0x9cd5('0x20')]||null:null,'include':_0x37ea13[_0x9cd5('0x1c')]?_0x37ea13[_0x9cd5('0x1c')]['include']?_[_0x9cd5('0x21')](_0x37ea13[_0x9cd5('0x1c')][_0x9cd5('0x22')],function(_0xe36f86){return{'model':db[_0xe36f86[_0x9cd5('0x23')]],'as':_0xe36f86['as'],'attributes':_0xe36f86[_0x9cd5('0x1f')],'include':_0xe36f86[_0x9cd5('0x22')]?_['map'](_0xe36f86[_0x9cd5('0x22')],function(_0x64a1c4){return{'model':db[_0x64a1c4[_0x9cd5('0x23')]],'as':_0x64a1c4['as'],'attributes':_0x64a1c4['attributes'],'include':_0x64a1c4['include']?_[_0x9cd5('0x21')](_0x64a1c4['include'],function(_0x52ef5d){return{'model':db[_0x52ef5d[_0x9cd5('0x23')]],'as':_0x52ef5d['as'],'attributes':_0x52ef5d[_0x9cd5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9cd5('0x24')](function(_0x5184b9){logger[_0x9cd5('0x12')](_0x9cd5('0x25'),_0x37ea13);logger[_0x9cd5('0x26')](_0x9cd5('0x25'),_0x37ea13,JSON[_0x9cd5('0x15')](_0x5184b9));_0x3661b0(_0x5184b9);})[_0x9cd5('0x1a')](function(_0x1dbddc){logger[_0x9cd5('0x16')](_0x9cd5('0x25'),_0x1dbddc[_0x9cd5('0x18')],_0x37ea13);_0xb97394(_0x18346f[_0x9cd5('0x16')](0x1f4,_0x1dbddc[_0x9cd5('0x18')]));});});};exports[_0x9cd5('0x27')]=function(_0x21354a){var _0x48af8c=this;return new Promise(function(_0x135dec,_0x2a6a34){return db['MailAccount']['find']({'raw':_0x21354a[_0x9cd5('0x1c')]?_0x21354a[_0x9cd5('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x21354a[_0x9cd5('0x1c')]?_0x21354a['options']['where']||null:null,'attributes':_0x21354a[_0x9cd5('0x1c')]?_0x21354a[_0x9cd5('0x1c')][_0x9cd5('0x1f')]||null:null,'include':_0x21354a[_0x9cd5('0x1c')]?_0x21354a['options'][_0x9cd5('0x22')]?_[_0x9cd5('0x21')](_0x21354a[_0x9cd5('0x1c')]['include'],function(_0x201a54){return{'model':db[_0x201a54[_0x9cd5('0x23')]],'as':_0x201a54['as'],'attributes':_0x201a54[_0x9cd5('0x1f')],'include':_0x201a54[_0x9cd5('0x22')]?_[_0x9cd5('0x21')](_0x201a54[_0x9cd5('0x22')],function(_0x320508){return{'model':db[_0x320508[_0x9cd5('0x23')]],'as':_0x320508['as'],'attributes':_0x320508[_0x9cd5('0x1f')],'include':_0x320508[_0x9cd5('0x22')]?_[_0x9cd5('0x21')](_0x320508['include'],function(_0x32e253){return{'model':db[_0x32e253['model']],'as':_0x32e253['as'],'attributes':_0x32e253['attributes']};}):[]};}):[]};}):[]:[]})[_0x9cd5('0x24')](function(_0x3cf5e9){if(_0x21354a[_0x9cd5('0x1c')][_0x9cd5('0x28')]===!![])_0x3cf5e9['setDataValue'](_0x9cd5('0x29'),_0x3cf5e9[_0x9cd5('0x2a')]());logger[_0x9cd5('0x12')](_0x9cd5('0x27'),_0x21354a);logger['debug'](_0x9cd5('0x27'),_0x21354a,JSON[_0x9cd5('0x15')](_0x3cf5e9));_0x135dec(_0x3cf5e9);})[_0x9cd5('0x1a')](function(_0x211cea){logger[_0x9cd5('0x16')](_0x9cd5('0x27'),_0x211cea['message'],_0x21354a);_0x2a6a34(_0x48af8c[_0x9cd5('0x16')](0x1f4,_0x211cea[_0x9cd5('0x18')]));});});};exports[_0x9cd5('0x2b')]=function(_0x4153b2){var _0x3fe472=this;return new Promise(function(_0x4182bd,_0x12d604){var _0x1ee8a4={'body':_0x4153b2[_0x9cd5('0x2c')],'channel':_0x9cd5('0x2d')};var _0xe11308=_[_0x9cd5('0x2e')](_[_0x9cd5('0x2f')](db[_0x9cd5('0x30')][_0x9cd5('0x31')]),[_0x9cd5('0x32'),_0x9cd5('0x33'),_0x9cd5('0x34'),'ListId']);var _0x13d4b8=![];if(_0x4153b2['body']['id']){delete _0x4153b2[_0x9cd5('0x2c')]['id'];}if(_[_0x9cd5('0x35')](_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x36')])){return _0x12d604(_0x3fe472[_0x9cd5('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x9cd5('0x35')](_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x2c')])||_0x4153b2['body'][_0x9cd5('0x2c')]===''){return _0x12d604(_0x3fe472[_0x9cd5('0x16')](0x1f4,_0x9cd5('0x37')));}if(_[_0x9cd5('0x35')](_0x4153b2['body'][_0x9cd5('0x38')])){return _0x12d604(_0x3fe472[_0x9cd5('0x16')](0x1f4,_0x9cd5('0x39')+_0xe11308));}if(!_[_0x9cd5('0x3a')](_0xe11308,_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x38')])){return _0x12d604(_0x3fe472[_0x9cd5('0x16')](0x1f4,_0x9cd5('0x3b')+_0xe11308));}var _0x1e06be={};_0x1e06be[_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x38')]]=_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x36')];return db[_0x9cd5('0x1b')][_0x9cd5('0x3c')]({'where':{'id':_0x4153b2[_0x9cd5('0x3d')]['id']},'include':[{'model':db[_0x9cd5('0x3e')],'as':_0x9cd5('0x3f'),'include':[{'model':db['CmContact'],'as':_0x9cd5('0x40'),'where':_0x1e06be,'limit':0x1,'order':[[_0x9cd5('0x33'),_0x9cd5('0x41')]]}]},{'model':db[_0x9cd5('0x42')],'as':'Applications'},{'model':db[_0x9cd5('0x43')],'as':_0x9cd5('0x44'),'include':[{'model':db['CloudProvider'],'as':_0x9cd5('0x45')}]}]})[_0x9cd5('0x24')](function(_0x152b17){if(_0x152b17&&_0x152b17[_0x9cd5('0x3f')]){var _0x16afe8=_0x152b17[_0x9cd5('0x46')]({'plain':!![]});_0x1ee8a4[_0x9cd5('0x3d')]=_[_0x9cd5('0x47')](_0x16afe8,['Applications','List']);_0x1ee8a4[_0x9cd5('0x3d')][_0x9cd5('0x29')]=_0x152b17[_0x9cd5('0x2a')]();_0x1ee8a4[_0x9cd5('0x48')]=_0x16afe8['Applications'];_0x1ee8a4[_0x9cd5('0x49')]=_0x16afe8['List'];_0x1ee8a4['applications']=_[_0x9cd5('0x4a')](_0x1ee8a4[_0x9cd5('0x48')],[_0x9cd5('0x4b')],['asc']);if(_0x1ee8a4[_0x9cd5('0x3d')]&&_0x1ee8a4[_0x9cd5('0x3d')][_0x9cd5('0x4c')]){_0x1ee8a4[_0x9cd5('0x48')][_0x9cd5('0x4d')]({'id':0x0,'priority':_0x1ee8a4[_0x9cd5('0x48')]['length']+0x1,'app':'close','appdata':_0x9cd5('0x4c'),'interval':_0x9cd5('0x4e')});}if(_0x1ee8a4[_0x9cd5('0x3d')][_0x9cd5('0x4f')]){delete _0x1ee8a4[_0x9cd5('0x3d')]['Applications'];}if(_0x1ee8a4['account']['List']){delete _0x1ee8a4['account'][_0x9cd5('0x3f')];}if(_0x16afe8[_0x9cd5('0x3f')][_0x9cd5('0x40')][_0x9cd5('0x50')]){return _0x16afe8[_0x9cd5('0x3f')][_0x9cd5('0x40')][0x0];}var _0x27e27c=_[_0x9cd5('0xc')](_0x4153b2[_0x9cd5('0x2c')],{'firstName':_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x36')],'ListId':_0x16afe8[_0x9cd5('0x51')]});_0x27e27c[_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x38')]]=_0x4153b2['body'][_0x9cd5('0x36')];return db[_0x9cd5('0x30')]['create'](_0x27e27c);}else{throw new Error(_0x9cd5('0x52'));}})[_0x9cd5('0x24')](function(_0xf73845){_0x1ee8a4[_0x9cd5('0x53')]=_0xf73845;if(_0xf73845){if(!_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x18')][_0x9cd5('0x54')]){_0x4153b2['body']['message'][_0x9cd5('0x54')]=rs[_0x9cd5('0x55')]()+'\x20'+_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x18')][_0x9cd5('0x36')];}var _0x464e60={'ContactId':_0xf73845['id'],'MailAccountId':_0x4153b2[_0x9cd5('0x3d')]['id'],'inReplyTo':_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x18')][_0x9cd5('0x54')],'to':_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x18')][_0x9cd5('0x36')],'cc':_0x4153b2[_0x9cd5('0x2c')]['message']['cc'],'subject':_0x4153b2['body'][_0x9cd5('0x18')][_0x9cd5('0x56')],'attach':_0x4153b2[_0x9cd5('0x2c')]['message'][_0x9cd5('0x57')],'lastMsgAt':moment()['format'](_0x9cd5('0x58')),'lastMsgDirection':'in'};return db[_0x9cd5('0x59')][_0x9cd5('0x3c')]({'where':{'closed':![],'MailAccountId':_0x4153b2['account']['id']},'include':[{'model':db[_0x9cd5('0x5a')],'as':_0x9cd5('0x5b'),'attributes':[_0x9cd5('0x54')],'where':{'messageId':_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x18')]['inReplyTo']}}]})[_0x9cd5('0x24')](function(_0x4d7c56){if(_0x4d7c56){return[_0x4d7c56,![]];}return db[_0x9cd5('0x59')]['create'](_0x464e60)[_0x9cd5('0x24')](function(_0x431cb7){return[_0x431cb7,!![]];});});}else{throw new Error(_0x9cd5('0x5c'));}})[_0x9cd5('0x5d')](function(_0x50c6fb,_0x19ea60){if(_0x50c6fb){_0x13d4b8=_0x19ea60;if(!_0x19ea60){return _0x50c6fb[_0x9cd5('0x5e')]({'inReplyTo':_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x18')]['messageId'],'to':_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x18')]['from'],'cc':_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x18')]['cc'],'subject':_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x18')][_0x9cd5('0x56')],'attach':_0x50c6fb['attach']?_0x50c6fb[_0x9cd5('0x57')]:_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x18')][_0x9cd5('0x57')],'substatus':null,'substatusAt':moment()[_0x9cd5('0x5f')](_0x9cd5('0x58')),'lastMsgAt':moment()[_0x9cd5('0x5f')](_0x9cd5('0x58')),'lastMsgDirection':'in'});}else{return _0x50c6fb;}}})[_0x9cd5('0x24')](function(_0x5d0599){_0x1ee8a4[_0x9cd5('0x60')]=_0x5d0599[_0x9cd5('0x46')]({'plain':!![]});_0x1ee8a4['interaction']['created']=_0x13d4b8;return db[_0x9cd5('0x5a')][_0x9cd5('0x61')]({'body':_0x4153b2['body']['body'],'MailAccountId':_0x4153b2[_0x9cd5('0x3d')]['id'],'MailInteractionId':_0x5d0599['id'],'direction':'in','ContactId':_0x1ee8a4[_0x9cd5('0x53')]['id'],'messageId':_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x18')]['messageId'],'from':_0x4153b2['body'][_0x9cd5('0x18')][_0x9cd5('0x36')],'to':_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x18')]['to'],'cc':_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x18')]['cc'],'subject':_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x18')][_0x9cd5('0x56')],'attach':_0x4153b2['body'][_0x9cd5('0x18')]['attach'],'Attachments':_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x18')][_0x9cd5('0x62')],'originTo':_0x4153b2[_0x9cd5('0x2c')]['message'][_0x9cd5('0x63')],'originCc':_0x4153b2['body'][_0x9cd5('0x18')][_0x9cd5('0x64')],'bcc':_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x18')]['bcc'],'ChatWebsiteId':_0x4153b2[_0x9cd5('0x2c')][_0x9cd5('0x18')]['ChatWebsiteId']||null,'originChannel':_0x4153b2[_0x9cd5('0x2c')]['message'][_0x9cd5('0x65')]||'Email','ChatOfflineMessageId':_0x4153b2['body'][_0x9cd5('0x18')][_0x9cd5('0x66')]||null},{'include':[{'model':db[_0x9cd5('0x67')],'as':_0x9cd5('0x68')}]});})[_0x9cd5('0x24')](function(_0x35299b){_0x1ee8a4['message']=_0x35299b;if(!_0x1ee8a4[_0x9cd5('0x60')][_0x9cd5('0x69')]){return;}return db[_0x9cd5('0x6a')]['find']({'attributes':['id','name'],'where':{'id':_0x1ee8a4[_0x9cd5('0x60')][_0x9cd5('0x69')]}});})[_0x9cd5('0x24')](function(_0x323ff3){if(_0x323ff3){_0x1ee8a4[_0x9cd5('0x48')][_0x9cd5('0x6b')]({'id':0x0,'priority':0x0,'app':_0x9cd5('0x6c'),'appdata':_0x323ff3[_0x9cd5('0x6d')]+','+(_0x1ee8a4[_0x9cd5('0x3d')][_0x9cd5('0x6e')]||0xa),'interval':'*,*,*,*'});}if(!_0x1ee8a4[_0x9cd5('0x60')]['queueId']){return;}return db[_0x9cd5('0x6f')][_0x9cd5('0x3c')]({'attributes':['id',_0x9cd5('0x6d')],'where':{'id':_0x1ee8a4['interaction'][_0x9cd5('0x70')]}});})['then'](function(_0x4cb8d4){if(_0x4cb8d4){_0x1ee8a4[_0x9cd5('0x48')][_0x9cd5('0x6b')]({'id':0x0,'priority':0x1,'app':_0x9cd5('0x71'),'appdata':_0x4cb8d4[_0x9cd5('0x6d')]+','+(_0x1ee8a4[_0x9cd5('0x3d')][_0x9cd5('0x72')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x9cd5('0x73'),_0x9cd5('0x74'),_0x1ee8a4);})[_0x9cd5('0x24')](function(_0x4540ad){_0x4182bd(_0x4540ad);})['catch'](function(_0x439640){_0x12d604(_0x3fe472[_0x9cd5('0x16')](0x1f4,_0x439640[_0x9cd5('0x18')]));});});}; \ 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(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x5b300d,_0x48ed26){_0x5b300d=_0x5b300d-0x0;var _0x59ee22=_0xbd51[_0x5b300d];return _0x59ee22;};'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 792c97c..359ccd6 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 _0xccc8=['update','emit','removeListener','register','length','mailAccount:','./mailAccount.events','remove'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xccc8,0x66));var _0x8ccc=function(_0xbaeba7,_0x578dfa){_0xbaeba7=_0xbaeba7-0x0;var _0x4b42e7=_0xccc8[_0xbaeba7];return _0x4b42e7;};'use strict';var MailAccountEvents=require(_0x8ccc('0x0'));var events=['save',_0x8ccc('0x1'),_0x8ccc('0x2')];function createListener(_0xaec1d7,_0x5a503c){return function(_0x5101c1){_0x5a503c[_0x8ccc('0x3')](_0xaec1d7,_0x5101c1);};}function removeListener(_0x55958c,_0xaf9792){return function(){MailAccountEvents[_0x8ccc('0x4')](_0x55958c,_0xaf9792);};}exports[_0x8ccc('0x5')]=function(_0x305340){for(var _0x4f8de5=0x0,_0x609b23=events[_0x8ccc('0x6')];_0x4f8de5<_0x609b23;_0x4f8de5++){var _0x42b2db=events[_0x4f8de5];var _0x5444ad=createListener(_0x8ccc('0x7')+_0x42b2db,_0x305340);MailAccountEvents['on'](_0x42b2db,_0x5444ad);}}; \ No newline at end of file +var _0xabad=['./mailAccount.events','remove','update','emit','removeListener','register','length','mailAccount:'];(function(_0x4e1ab2,_0x1db250){var _0x1ffe6a=function(_0x2a556c){while(--_0x2a556c){_0x4e1ab2['push'](_0x4e1ab2['shift']());}};_0x1ffe6a(++_0x1db250);}(_0xabad,0x150));var _0xdaba=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0xabad[_0x2b8077];return _0x308091;};'use strict';var MailAccountEvents=require(_0xdaba('0x0'));var events=['save',_0xdaba('0x1'),_0xdaba('0x2')];function createListener(_0x434276,_0x58ca1f){return function(_0x297f75){_0x58ca1f[_0xdaba('0x3')](_0x434276,_0x297f75);};}function removeListener(_0x4ce3ba,_0x2f84cc){return function(){MailAccountEvents[_0xdaba('0x4')](_0x4ce3ba,_0x2f84cc);};}exports[_0xdaba('0x5')]=function(_0x387d02){for(var _0x20fd9f=0x0,_0x23ae0f=events[_0xdaba('0x6')];_0x20fd9f<_0x23ae0f;_0x20fd9f++){var _0x352a74=events[_0x20fd9f];var _0x5214dc=createListener(_0xdaba('0x7')+_0x352a74,_0x387d02);MailAccountEvents['on'](_0x352a74,_0x5214dc);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index c47b336..994f18e 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 _0x0478=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x0478,0x79));var _0x8047=function(_0x51b28f,_0x20f46c){_0x51b28f=_0x51b28f-0x0;var _0x2c3885=_0x0478[_0x51b28f];return _0x2c3885;};'use strict';var multer=require(_0x8047('0x0'));var util=require(_0x8047('0x1'));var path=require(_0x8047('0x2'));var timeout=require(_0x8047('0x3'));var express=require(_0x8047('0x4'));var router=express[_0x8047('0x5')]();var fs_extra=require(_0x8047('0x6'));var auth=require(_0x8047('0x7'));var interaction=require(_0x8047('0x8'));var config=require(_0x8047('0x9'));var controller=require('./mailApplication.controller');router[_0x8047('0xa')](_0x8047('0xb'),auth[_0x8047('0xc')](),controller[_0x8047('0xd')]);router[_0x8047('0xe')](_0x8047('0xb'),auth[_0x8047('0xc')](),controller['update']);router['delete'](_0x8047('0xb'),auth[_0x8047('0xc')](),controller[_0x8047('0xf')]);module[_0x8047('0x10')]=router; \ No newline at end of file +var _0xcaf1=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./mailApplication.controller','isAuthenticated','put','/:id','update'];(function(_0xe182dc,_0x143af4){var _0x527a62=function(_0x3393aa){while(--_0x3393aa){_0xe182dc['push'](_0xe182dc['shift']());}};_0x527a62(++_0x143af4);}(_0xcaf1,0x64));var _0x1caf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcaf1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1caf('0x0'));var util=require(_0x1caf('0x1'));var path=require(_0x1caf('0x2'));var timeout=require('connect-timeout');var express=require(_0x1caf('0x3'));var router=express[_0x1caf('0x4')]();var fs_extra=require(_0x1caf('0x5'));var auth=require(_0x1caf('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1caf('0x7'));router['get']('/:id',auth[_0x1caf('0x8')](),controller['show']);router[_0x1caf('0x9')](_0x1caf('0xa'),auth[_0x1caf('0x8')](),controller[_0x1caf('0xb')]);router['delete']('/:id',auth[_0x1caf('0x8')](),controller[_0x1caf('0xc')]);module[_0x1caf('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 88071c6..4b2e175 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 _0x2773=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0x2cda58,_0x6cc104){var _0x21ab5e=function(_0x3ddb27){while(--_0x3ddb27){_0x2cda58['push'](_0x2cda58['shift']());}};_0x21ab5e(++_0x6cc104);}(_0x2773,0xf4));var _0x3277=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2773[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x3277('0x0'));module[_0x3277('0x1')]={'priority':{'type':Sequelize[_0x3277('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3277('0x3')],'allowNull':![],'defaultValue':_0x3277('0x4')},'appdata':{'type':Sequelize[_0x3277('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3277('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2a22=['noop','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x2ca3d8,_0xf83cb8){var _0x2639d9=function(_0x5ee2bc){while(--_0x5ee2bc){_0x2ca3d8['push'](_0x2ca3d8['shift']());}};_0x2639d9(++_0xf83cb8);}(_0x2a22,0xb1));var _0x22a2=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x2a22[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0x22a2('0x0'));module[_0x22a2('0x1')]={'priority':{'type':Sequelize[_0x22a2('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x22a2('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x22a2('0x4')]},'interval':{'type':Sequelize[_0x22a2('0x4')],'defaultValue':_0x22a2('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index dcacb83..f3ead22 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 _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0xf3347c,_0x6c015a){var _0x19c86f=function(_0x3b1859){while(--_0x3b1859){_0xf3347c['push'](_0xf3347c['shift']());}};_0x19c86f(++_0x6c015a);}(_0xf4eb,0xec));var _0xbf4e=function(_0x49ba45,_0x2a9241){_0x49ba45=_0x49ba45-0x0;var _0x4b9496=_0xf4eb[_0x49ba45];return _0x4b9496;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0xc07e77,_0x131f5f){var _0x8a489e=function(_0x3cc02a){while(--_0x3cc02a){_0xc07e77['push'](_0xc07e77['shift']());}};_0x8a489e(++_0x131f5f);}(_0x70e0,0x17b));var _0x070e=function(_0x579113,_0x27fdcd){_0x579113=_0x579113-0x0;var _0x388d43=_0x70e0[_0x579113];return _0x388d43;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 1595e55..65146e2 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 _0x663b=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','mail_applications'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x663b,0x168));var _0xb663=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x663b[_0xcd0918];return _0x250704;};'use strict';var _=require(_0xb663('0x0'));var util=require(_0xb663('0x1'));var logger=require(_0xb663('0x2'))(_0xb663('0x3'));var moment=require('moment');var BPromise=require(_0xb663('0x4'));var rp=require(_0xb663('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb663('0x6'));var config=require(_0xb663('0x7'));var attributes=require(_0xb663('0x8'));module[_0xb663('0x9')]=function(_0x3884bc,_0x3f7dcb){return _0x3884bc[_0xb663('0xa')]('MailApplication',attributes,{'tableName':_0xb663('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xffbe=['mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./mailApplication.attributes','define','MailApplication'];(function(_0x514bd1,_0x25ea3e){var _0x58a281=function(_0x25567a){while(--_0x25567a){_0x514bd1['push'](_0x514bd1['shift']());}};_0x58a281(++_0x25ea3e);}(_0xffbe,0x92));var _0xeffb=function(_0x38e616,_0x29acab){_0x38e616=_0x38e616-0x0;var _0xcad0fd=_0xffbe[_0x38e616];return _0xcad0fd;};'use strict';var _=require(_0xeffb('0x0'));var util=require(_0xeffb('0x1'));var logger=require('../../config/logger')(_0xeffb('0x2'));var moment=require(_0xeffb('0x3'));var BPromise=require(_0xeffb('0x4'));var rp=require(_0xeffb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeffb('0x6'));var attributes=require(_0xeffb('0x7'));module['exports']=function(_0x2249ae,_0x39a837){return _0x2249ae[_0xeffb('0x8')](_0xeffb('0x9'),attributes,{'tableName':_0xeffb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeffb('0xb'),'collate':_0xeffb('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index bbe2b55..b6bc7db 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 _0xb634=['where','limit','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','MailApplication,\x20%s,\x20%s','message','result','UpdateMailApplication','MailApplication','update','body','options','raw'];(function(_0x142015,_0x41797c){var _0x3a74c6=function(_0x4ca21c){while(--_0x4ca21c){_0x142015['push'](_0x142015['shift']());}};_0x3a74c6(++_0x41797c);}(_0xb634,0x1c3));var _0x4b63=function(_0x3859fd,_0x459d93){_0x3859fd=_0x3859fd-0x0;var _0x5d22c1=_0xb634[_0x3859fd];return _0x5d22c1;};'use strict';var _=require(_0x4b63('0x0'));var util=require(_0x4b63('0x1'));var moment=require('moment');var BPromise=require(_0x4b63('0x2'));var rs=require(_0x4b63('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b63('0x4'))['db'];var utils=require(_0x4b63('0x5'));var logger=require(_0x4b63('0x6'))(_0x4b63('0x7'));var config=require(_0x4b63('0x8'));var jayson=require(_0x4b63('0x9'));var client=jayson[_0x4b63('0xa')][_0x4b63('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c2e17,_0xde5b8d,_0xca0386){return new BPromise(function(_0x5725fd,_0x524c5c){return client[_0x4b63('0xc')](_0x2c2e17,_0xca0386)[_0x4b63('0xd')](function(_0x321a4c){logger[_0x4b63('0xe')]('MailApplication,\x20%s,\x20%s',_0xde5b8d,_0x4b63('0xf'));logger[_0x4b63('0x10')](_0x4b63('0x11'),_0xde5b8d,_0x4b63('0xf'),JSON[_0x4b63('0x12')](_0x321a4c));if(_0x321a4c[_0x4b63('0x13')]){if(_0x321a4c[_0x4b63('0x13')]['code']===0x1f4){logger['error'](_0x4b63('0x14'),_0xde5b8d,_0x321a4c[_0x4b63('0x13')][_0x4b63('0x15')]);return _0x524c5c(_0x321a4c['error']['message']);}logger[_0x4b63('0x13')](_0x4b63('0x14'),_0xde5b8d,_0x321a4c[_0x4b63('0x13')][_0x4b63('0x15')]);return _0x5725fd(_0x321a4c[_0x4b63('0x13')][_0x4b63('0x15')]);}else{logger[_0x4b63('0xe')](_0x4b63('0x14'),_0xde5b8d,_0x4b63('0xf'));_0x5725fd(_0x321a4c[_0x4b63('0x16')][_0x4b63('0x15')]);}})['catch'](function(_0x432969){logger[_0x4b63('0x13')](_0x4b63('0x14'),_0xde5b8d,_0x432969);_0x524c5c(_0x432969);});});}exports[_0x4b63('0x17')]=function(_0x3663d3){var _0x12afb2=this;return new Promise(function(_0x289a15,_0x2efd40){return db[_0x4b63('0x18')][_0x4b63('0x19')](_0x3663d3[_0x4b63('0x1a')],{'raw':_0x3663d3[_0x4b63('0x1b')]?_0x3663d3[_0x4b63('0x1b')][_0x4b63('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3663d3[_0x4b63('0x1b')]?_0x3663d3[_0x4b63('0x1b')][_0x4b63('0x1d')]||null:null,'attributes':_0x3663d3[_0x4b63('0x1b')]?_0x3663d3[_0x4b63('0x1b')]['attributes']||null:null,'limit':_0x3663d3['options']?_0x3663d3[_0x4b63('0x1b')][_0x4b63('0x1e')]||null:null})[_0x4b63('0xd')](function(_0x57f827){logger['info'](_0x4b63('0x17'),_0x3663d3);logger[_0x4b63('0x10')](_0x4b63('0x17'),_0x3663d3,JSON[_0x4b63('0x12')](_0x57f827));_0x289a15(_0x57f827);})[_0x4b63('0x1f')](function(_0x8c9346){logger[_0x4b63('0x13')](_0x4b63('0x17'),_0x8c9346[_0x4b63('0x15')],_0x3663d3);_0x2efd40(_0x12afb2[_0x4b63('0x13')](0x1f4,_0x8c9346[_0x4b63('0x15')]));});});}; \ No newline at end of file +var _0x1e8a=['code','message','info','result','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x1e8a,0x1b0));var _0xa1e8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1e8a[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xa1e8('0x0'));var util=require(_0xa1e8('0x1'));var moment=require('moment');var BPromise=require(_0xa1e8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa1e8('0x3'));var db=require(_0xa1e8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1e8('0x5'))(_0xa1e8('0x6'));var config=require(_0xa1e8('0x7'));var jayson=require(_0xa1e8('0x8'));var client=jayson[_0xa1e8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a2b4d,_0x1d057e,_0x146f63){return new BPromise(function(_0xf4acf4,_0x5cddff){return client[_0xa1e8('0xa')](_0x3a2b4d,_0x146f63)[_0xa1e8('0xb')](function(_0x2b5cb8){logger['info'](_0xa1e8('0xc'),_0x1d057e,_0xa1e8('0xd'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x1d057e,_0xa1e8('0xd'),JSON[_0xa1e8('0xe')](_0x2b5cb8));if(_0x2b5cb8[_0xa1e8('0xf')]){if(_0x2b5cb8[_0xa1e8('0xf')][_0xa1e8('0x10')]===0x1f4){logger[_0xa1e8('0xf')](_0xa1e8('0xc'),_0x1d057e,_0x2b5cb8[_0xa1e8('0xf')]['message']);return _0x5cddff(_0x2b5cb8[_0xa1e8('0xf')]['message']);}logger['error'](_0xa1e8('0xc'),_0x1d057e,_0x2b5cb8['error'][_0xa1e8('0x11')]);return _0xf4acf4(_0x2b5cb8[_0xa1e8('0xf')][_0xa1e8('0x11')]);}else{logger[_0xa1e8('0x12')](_0xa1e8('0xc'),_0x1d057e,_0xa1e8('0xd'));_0xf4acf4(_0x2b5cb8[_0xa1e8('0x13')]['message']);}})['catch'](function(_0x511b86){logger[_0xa1e8('0xf')](_0xa1e8('0xc'),_0x1d057e,_0x511b86);_0x5cddff(_0x511b86);});});}exports[_0xa1e8('0x14')]=function(_0x4833f6){var _0x277c0a=this;return new Promise(function(_0x9f93e2,_0x78f346){return db[_0xa1e8('0x15')]['update'](_0x4833f6[_0xa1e8('0x16')],{'raw':_0x4833f6[_0xa1e8('0x17')]?_0x4833f6[_0xa1e8('0x17')][_0xa1e8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4833f6[_0xa1e8('0x17')]?_0x4833f6['options'][_0xa1e8('0x19')]||null:null,'attributes':_0x4833f6['options']?_0x4833f6[_0xa1e8('0x17')][_0xa1e8('0x1a')]||null:null,'limit':_0x4833f6[_0xa1e8('0x17')]?_0x4833f6['options']['limit']||null:null})[_0xa1e8('0xb')](function(_0x3dd1a6){logger[_0xa1e8('0x12')](_0xa1e8('0x14'),_0x4833f6);logger[_0xa1e8('0x1b')](_0xa1e8('0x14'),_0x4833f6,JSON[_0xa1e8('0xe')](_0x3dd1a6));_0x9f93e2(_0x3dd1a6);})['catch'](function(_0xbad041){logger[_0xa1e8('0xf')](_0xa1e8('0x14'),_0xbad041[_0xa1e8('0x11')],_0x4833f6);_0x78f346(_0x277c0a[_0xa1e8('0xf')](0x1f4,_0xbad041[_0xa1e8('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 34b9238..affedaf 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 _0x099b=['describe','/:id','show','getMessages','/:id/download','post','create','/:id/messages','addMessage','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe'];(function(_0x2a9f68,_0xf21767){var _0x33da5f=function(_0x140625){while(--_0x140625){_0x2a9f68['push'](_0x2a9f68['shift']());}};_0x33da5f(++_0xf21767);}(_0x099b,0x121));var _0xb099=function(_0x45dedf,_0x3d9371){_0x45dedf=_0x45dedf-0x0;var _0x4fd35d=_0x099b[_0x45dedf];return _0x4fd35d;};'use strict';var express=require(_0xb099('0x0'));var router=express[_0xb099('0x1')]();var auth=require(_0xb099('0x2'));var interaction=require(_0xb099('0x3'));var controller=require(_0xb099('0x4'));router[_0xb099('0x5')]('/',auth[_0xb099('0x6')](),controller['index']);router[_0xb099('0x5')](_0xb099('0x7'),auth[_0xb099('0x6')](),controller[_0xb099('0x8')]);router[_0xb099('0x5')](_0xb099('0x9'),auth[_0xb099('0x6')](),controller[_0xb099('0xa')]);router[_0xb099('0x5')]('/:id/messages',auth[_0xb099('0x6')](),controller[_0xb099('0xb')]);router[_0xb099('0x5')](_0xb099('0xc'),auth[_0xb099('0x6')](),controller['download']);router[_0xb099('0xd')]('/',auth['isAuthenticated'](),controller[_0xb099('0xe')]);router[_0xb099('0xd')](_0xb099('0xf'),auth[_0xb099('0x6')](),controller[_0xb099('0x10')]);router[_0xb099('0xd')](_0xb099('0x11'),auth[_0xb099('0x6')](),interaction[_0xb099('0x12')](_0xb099('0x13'),'mailinteraction:addtags'),controller[_0xb099('0x14')]);router[_0xb099('0x15')](_0xb099('0x9'),auth[_0xb099('0x6')](),interaction[_0xb099('0x12')](_0xb099('0x13'),_0xb099('0x16')),controller[_0xb099('0x17')]);router[_0xb099('0x18')](_0xb099('0x9'),auth[_0xb099('0x6')](),interaction[_0xb099('0x12')](_0xb099('0x13'),_0xb099('0x19')),controller['destroy']);router['delete'](_0xb099('0x11'),auth[_0xb099('0x6')](),controller['removeTags']);module[_0xb099('0x1a')]=router; \ No newline at end of file +var _0x6695=['update','mailinteraction:destroy','destroy','delete','removeTags','exports','express','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','/:id','mailinteraction:update'];(function(_0x383cc3,_0x1b1b57){var _0x3ffc9c=function(_0x33b8ef){while(--_0x33b8ef){_0x383cc3['push'](_0x383cc3['shift']());}};_0x3ffc9c(++_0x1b1b57);}(_0x6695,0xae));var _0x5669=function(_0x2abe8b,_0x2abf08){_0x2abe8b=_0x2abe8b-0x0;var _0x57e970=_0x6695[_0x2abe8b];return _0x57e970;};'use strict';var express=require(_0x5669('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5669('0x1'));var controller=require(_0x5669('0x2'));router[_0x5669('0x3')]('/',auth[_0x5669('0x4')](),controller[_0x5669('0x5')]);router[_0x5669('0x3')](_0x5669('0x6'),auth[_0x5669('0x4')](),controller[_0x5669('0x7')]);router[_0x5669('0x3')]('/:id',auth[_0x5669('0x4')](),controller[_0x5669('0x8')]);router[_0x5669('0x3')](_0x5669('0x9'),auth['isAuthenticated'](),controller[_0x5669('0xa')]);router[_0x5669('0x3')]('/:id/download',auth[_0x5669('0x4')](),controller[_0x5669('0xb')]);router[_0x5669('0xc')]('/',auth[_0x5669('0x4')](),controller[_0x5669('0xd')]);router[_0x5669('0xc')](_0x5669('0x9'),auth[_0x5669('0x4')](),controller[_0x5669('0xe')]);router[_0x5669('0xc')](_0x5669('0xf'),auth[_0x5669('0x4')](),interaction[_0x5669('0x10')](_0x5669('0x11'),_0x5669('0x12')),controller[_0x5669('0x13')]);router['put'](_0x5669('0x14'),auth['isAuthenticated'](),interaction[_0x5669('0x10')](_0x5669('0x11'),_0x5669('0x15')),controller[_0x5669('0x16')]);router['delete'](_0x5669('0x14'),auth['isAuthenticated'](),interaction[_0x5669('0x10')](_0x5669('0x11'),_0x5669('0x17')),controller[_0x5669('0x18')]);router[_0x5669('0x19')](_0x5669('0xf'),auth[_0x5669('0x4')](),controller[_0x5669('0x1a')]);module[_0x5669('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 06d1392..fe262d1 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 _0x0057=['ENUM','out','exports','DATE','STRING','TEXT','long','BOOLEAN'];(function(_0x4c181e,_0x4b8a6b){var _0xdafcb9=function(_0x5c26d0){while(--_0x5c26d0){_0x4c181e['push'](_0x4c181e['shift']());}};_0xdafcb9(++_0x4b8a6b);}(_0x0057,0x142));var _0x7005=function(_0x56ee15,_0x1effd1){_0x56ee15=_0x56ee15-0x0;var _0x94991f=_0x0057[_0x56ee15];return _0x94991f;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0x7005('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7005('0x1')]},'disposition':{'type':Sequelize[_0x7005('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7005('0x2')]},'note':{'type':Sequelize[_0x7005('0x2')]},'inReplyTo':{'type':Sequelize[_0x7005('0x2')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x7005('0x3')](_0x7005('0x4'))},'subject':{'type':Sequelize[_0x7005('0x3')]()},'attach':{'type':Sequelize[_0x7005('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x7005('0x1')]},'substatus':{'type':Sequelize[_0x7005('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x7005('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x7005('0x6')]('in',_0x7005('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7005('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7005('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0b7c=['DATE','STRING','long','ENUM','out','INTEGER','sequelize','iconv','exports','BOOLEAN'];(function(_0x5b41ff,_0x3391d9){var _0x34898a=function(_0x247c9b){while(--_0x247c9b){_0x5b41ff['push'](_0x5b41ff['shift']());}};_0x34898a(++_0x3391d9);}(_0x0b7c,0xce));var _0xc0b7=function(_0x5c846d,_0x5c02ce){_0x5c846d=_0x5c846d-0x0;var _0xd064e4=_0x0b7c[_0x5c846d];return _0xd064e4;};'use strict';var Sequelize=require(_0xc0b7('0x0'));var iconv=require(_0xc0b7('0x1'));module[_0xc0b7('0x2')]={'closed':{'type':Sequelize[_0xc0b7('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc0b7('0x4')]},'disposition':{'type':Sequelize[_0xc0b7('0x5')]},'secondDisposition':{'type':Sequelize[_0xc0b7('0x5')]},'thirdDisposition':{'type':Sequelize[_0xc0b7('0x5')]},'note':{'type':Sequelize[_0xc0b7('0x5')]},'inReplyTo':{'type':Sequelize[_0xc0b7('0x5')](0x1fe)},'to':{'type':Sequelize[_0xc0b7('0x5')]},'cc':{'type':Sequelize['TEXT'](_0xc0b7('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xc0b7('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xc0b7('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xc0b7('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc0b7('0x7')]('in',_0xc0b7('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc0b7('0x7')]('in',_0xc0b7('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc0b7('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc0b7('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 180215f..a02abbd 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 _0xdb80=['download','unix','join','server','tmp','files','attachments','transcript-%d-%s.zip','Attachment','Messages','bcc','subject','createdAt','get','mkdirSync','each','from','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','basename','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','juice','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','then','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','findAll','mail','user','catch','show','params','model','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','update','destroy','describe','addMessage','ids','omit','getMessages','findOne','keys','MailMessage','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','addTags','spread','Tag','color','mailInteractionTags:save','removeTags'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xdb80,0x177));var _0x0db8=function(_0x281054,_0x389bf2){_0x281054=_0x281054-0x0;var _0x261907=_0xdb80[_0x281054];return _0x261907;};'use strict';var emlformat=require(_0x0db8('0x0'));var rimraf=require(_0x0db8('0x1'));var zipdir=require(_0x0db8('0x2'));var moment=require(_0x0db8('0x3'));var BPromise=require(_0x0db8('0x4'));var util=require(_0x0db8('0x5'));var path=require(_0x0db8('0x6'));var fs=require('fs');var _=require('lodash');var juice=require(_0x0db8('0x7'));var Redis=require('ioredis');var interaction=require(_0x0db8('0x8'));var qs=require(_0x0db8('0x9'));var logger=require(_0x0db8('0xa'))(_0x0db8('0xb'));var config=require(_0x0db8('0xc'));var db=require(_0x0db8('0xd'))['db'];var htmlEntities=require(_0x0db8('0xe'));config[_0x0db8('0xf')]=_[_0x0db8('0x10')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0db8('0x11'))(new Redis(config[_0x0db8('0xf')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x5001fa,_0x19c9cc){_0x19c9cc=_0x19c9cc||0xcc;return function(_0xb8657e){if(_0xb8657e){return _0x5001fa[_0x0db8('0x12')](_0x19c9cc);}return _0x5001fa[_0x0db8('0x13')](_0x19c9cc)[_0x0db8('0x14')]();};}function respondWithResult(_0x593040,_0x45e7fc){_0x45e7fc=_0x45e7fc||0xc8;return function(_0x5e9053){if(_0x5e9053){return _0x593040[_0x0db8('0x13')](_0x45e7fc)['json'](_0x5e9053);}};}function respondWithFilteredResult(_0x23733e,_0x1292e5){return function(_0x511977){if(_0x511977){var _0xd7fb69=typeof _0x1292e5[_0x0db8('0x15')]===_0x0db8('0x16')&&typeof _0x1292e5[_0x0db8('0x17')]===_0x0db8('0x16');var _0x4e1081=_0x511977[_0x0db8('0x18')];var _0x2b77de=_0xd7fb69?0x0:_0x1292e5[_0x0db8('0x15')];var _0x464f1d=_0xd7fb69?_0x511977[_0x0db8('0x18')]:_0x1292e5[_0x0db8('0x15')]+_0x1292e5[_0x0db8('0x17')];var _0x32b352;if(_0x464f1d>=_0x4e1081){_0x464f1d=_0x4e1081;_0x32b352=0xc8;}else{_0x32b352=0xce;}_0x23733e[_0x0db8('0x13')](_0x32b352);return _0x23733e[_0x0db8('0x19')](_0x0db8('0x1a'),_0x2b77de+'-'+_0x464f1d+'/'+_0x4e1081)[_0x0db8('0x1b')](_0x511977);}return null;};}function saveUpdates(_0x4206de){return function(_0x494102){if(_0x494102){return _0x494102['update'](_0x4206de)[_0x0db8('0x1c')](function(_0x239d4c){return _0x239d4c;});}return null;};}function removeEntity(_0x1de68c){return function(_0x28347d){if(_0x28347d){return _0x28347d['destroy']()[_0x0db8('0x1c')](function(){_0x1de68c[_0x0db8('0x13')](0xcc)[_0x0db8('0x14')]();});}};}function handleEntityNotFound(_0x27c41e){return function(_0x1f21ed){if(!_0x1f21ed){_0x27c41e[_0x0db8('0x12')](0x194);}return _0x1f21ed;};}function handleError(_0x5a85b4,_0x16e314){_0x16e314=_0x16e314||0x1f4;return function(_0x3b629f){logger['error'](_0x3b629f[_0x0db8('0x1d')]);if(_0x3b629f[_0x0db8('0x1e')]){delete _0x3b629f[_0x0db8('0x1e')];}_0x5a85b4['status'](_0x16e314)[_0x0db8('0x1f')](_0x3b629f);};}exports[_0x0db8('0x20')]=function(_0x201296,_0x336ab5){var _0x1a4ed7={};var _0x169d4d=_[_0x0db8('0x21')](db[_0x0db8('0x22')][_0x0db8('0x23')],function(_0x22c2ad){return{'name':_0x22c2ad[_0x0db8('0x24')],'type':_0x22c2ad[_0x0db8('0x25')][_0x0db8('0x26')]};});_0x1a4ed7=qs['getOptions'](_0x169d4d,_0x201296);return interaction[_0x0db8('0x27')](_0x0db8('0x28'),_0x201296['query'],_0x201296[_0x0db8('0x29')],_0x1a4ed7,_0x169d4d)[_0x0db8('0x1c')](respondWithFilteredResult(_0x336ab5,_0x1a4ed7))[_0x0db8('0x2a')](handleError(_0x336ab5,null));};exports[_0x0db8('0x2b')]=function(_0x38b78b,_0x3f8a23){var _0x2ad101={'raw':![],'where':{'id':_0x38b78b[_0x0db8('0x2c')]['id']}},_0x4ed867={};_0x4ed867[_0x0db8('0x2d')]=_['keys'](db[_0x0db8('0x22')][_0x0db8('0x23')]);_0x4ed867[_0x0db8('0x2e')]=_['keys'](_0x38b78b[_0x0db8('0x2e')]);_0x4ed867[_0x0db8('0x2f')]=_['intersection'](_0x4ed867[_0x0db8('0x2d')],_0x4ed867['query']);_0x2ad101[_0x0db8('0x30')]=_[_0x0db8('0x31')](_0x4ed867[_0x0db8('0x2d')],qs['fields'](_0x38b78b[_0x0db8('0x2e')][_0x0db8('0x32')]));_0x2ad101['attributes']=_0x2ad101[_0x0db8('0x30')][_0x0db8('0x33')]?_0x2ad101['attributes']:_0x4ed867[_0x0db8('0x2d')];if(_0x38b78b[_0x0db8('0x2e')][_0x0db8('0x34')]){_0x2ad101[_0x0db8('0x35')]=[{'all':!![]}];}_0x2ad101=_[_0x0db8('0x36')]({},_0x2ad101,_0x38b78b[_0x0db8('0x37')]);return db[_0x0db8('0x22')][_0x0db8('0x38')](_0x2ad101)[_0x0db8('0x1c')](handleEntityNotFound(_0x3f8a23,null))[_0x0db8('0x1c')](respondWithResult(_0x3f8a23,null))[_0x0db8('0x2a')](handleError(_0x3f8a23,null));};exports[_0x0db8('0x39')]=function(_0x4b7eed,_0x20ff2c){return db[_0x0db8('0x22')]['create'](_0x4b7eed[_0x0db8('0x3a')],{})[_0x0db8('0x1c')](respondWithResult(_0x20ff2c,0xc9))[_0x0db8('0x2a')](handleError(_0x20ff2c,null));};exports[_0x0db8('0x3b')]=function(_0x4c4c7f,_0x35eb36){if(_0x4c4c7f[_0x0db8('0x3a')]['id']){delete _0x4c4c7f[_0x0db8('0x3a')]['id'];}return db[_0x0db8('0x22')]['find']({'where':{'id':_0x4c4c7f[_0x0db8('0x2c')]['id']}})[_0x0db8('0x1c')](handleEntityNotFound(_0x35eb36,null))[_0x0db8('0x1c')](saveUpdates(_0x4c4c7f['body'],null))[_0x0db8('0x1c')](respondWithResult(_0x35eb36,null))['catch'](handleError(_0x35eb36,null));};exports[_0x0db8('0x3c')]=function(_0x4e4036,_0x16d5f2){return db['MailInteraction'][_0x0db8('0x38')]({'where':{'id':_0x4e4036[_0x0db8('0x2c')]['id']}})['then'](handleEntityNotFound(_0x16d5f2,null))[_0x0db8('0x1c')](removeEntity(_0x16d5f2,null))[_0x0db8('0x2a')](handleError(_0x16d5f2,null));};exports['describe']=function(_0x34c788,_0x247190){return db['MailInteraction'][_0x0db8('0x3d')]()['then'](respondWithResult(_0x247190,null))[_0x0db8('0x2a')](handleError(_0x247190,null));};exports[_0x0db8('0x3e')]=function(_0x17adf7,_0xb7f3b9){return db['MailMessage'][_0x0db8('0x38')]({'where':{'id':_0x17adf7[_0x0db8('0x2c')]['id']}})[_0x0db8('0x1c')](handleEntityNotFound(_0xb7f3b9,null))[_0x0db8('0x1c')](function(_0x32c4c4){if(_0x32c4c4){return _0x32c4c4[_0x0db8('0x3e')](_0x17adf7[_0x0db8('0x3a')][_0x0db8('0x3f')],_[_0x0db8('0x40')](_0x17adf7[_0x0db8('0x3a')],[_0x0db8('0x3f'),'id'])||{});}})[_0x0db8('0x1c')](respondWithResult(_0xb7f3b9,null))[_0x0db8('0x2a')](handleError(_0xb7f3b9,null));};exports[_0x0db8('0x41')]=function(_0x15d1cc,_0x3dab80){var _0x1145bf={'raw':![],'where':{}};var _0x5dc8a0={};var _0x53994b={'count':0x0,'rows':[]};return db['MailInteraction'][_0x0db8('0x42')]({'where':{'id':_0x15d1cc[_0x0db8('0x2c')]['id']}})[_0x0db8('0x1c')](handleEntityNotFound(_0x3dab80,null))[_0x0db8('0x1c')](function(_0x5a0d39){if(_0x5a0d39){_0x5dc8a0[_0x0db8('0x2d')]=_[_0x0db8('0x43')](db[_0x0db8('0x44')][_0x0db8('0x23')]);_0x5dc8a0['query']=_[_0x0db8('0x43')](_0x15d1cc[_0x0db8('0x2e')]);_0x5dc8a0['filters']=_[_0x0db8('0x31')](_0x5dc8a0['model'],_0x5dc8a0[_0x0db8('0x2e')]);_0x1145bf[_0x0db8('0x30')]=_[_0x0db8('0x31')](_0x5dc8a0[_0x0db8('0x2d')],qs[_0x0db8('0x32')](_0x15d1cc[_0x0db8('0x2e')][_0x0db8('0x32')]));_0x1145bf[_0x0db8('0x30')]=_0x1145bf[_0x0db8('0x30')][_0x0db8('0x33')]?_0x1145bf[_0x0db8('0x30')]:_0x5dc8a0[_0x0db8('0x2d')];if(!_0x15d1cc[_0x0db8('0x2e')][_0x0db8('0x45')](_0x0db8('0x46'))){_0x1145bf[_0x0db8('0x17')]=qs[_0x0db8('0x17')](_0x15d1cc[_0x0db8('0x2e')][_0x0db8('0x17')]);_0x1145bf[_0x0db8('0x15')]=qs[_0x0db8('0x15')](_0x15d1cc[_0x0db8('0x2e')][_0x0db8('0x15')]);}_0x1145bf[_0x0db8('0x47')]=qs[_0x0db8('0x48')](_0x15d1cc[_0x0db8('0x2e')][_0x0db8('0x48')]);_0x1145bf[_0x0db8('0x49')]=qs[_0x0db8('0x2f')](_[_0x0db8('0x4a')](_0x15d1cc[_0x0db8('0x2e')],_0x5dc8a0[_0x0db8('0x2f')]));_0x1145bf[_0x0db8('0x49')][_0x0db8('0x4b')]=_0x5a0d39['id'];if(_0x15d1cc['query'][_0x0db8('0x4c')]){_0x1145bf[_0x0db8('0x49')]=_['merge'](_0x1145bf[_0x0db8('0x49')],{'$or':_['map'](_0x1145bf['attributes'],function(_0x2cb204){var _0x4a69df={};_0x4a69df[_0x2cb204]={'$like':'%'+_0x15d1cc[_0x0db8('0x2e')][_0x0db8('0x4c')]+'%'};return _0x4a69df;})});}if(_0x15d1cc[_0x0db8('0x2e')]['$gte']){var _0x11dbd3=_0x15d1cc[_0x0db8('0x2e')][_0x0db8('0x4d')][_0x0db8('0x4e')](',');var _0x4599cb={};_0x4599cb[_0x11dbd3[0x0]]={'$gte':moment(_0x11dbd3[0x1])[_0x0db8('0x4f')](_0x0db8('0x50'))};_0x1145bf[_0x0db8('0x49')]=_[_0x0db8('0x36')](_0x1145bf[_0x0db8('0x49')],_0x4599cb);}_0x1145bf=_[_0x0db8('0x36')]({},_0x1145bf,_0x15d1cc[_0x0db8('0x37')]);return db[_0x0db8('0x44')][_0x0db8('0x18')]({'where':_0x1145bf[_0x0db8('0x49')]})['then'](function(_0x44ac99){_0x53994b['count']=_0x44ac99;if(_0x15d1cc[_0x0db8('0x2e')]['includeAll']){_0x1145bf['include']=[{'all':!![]}];}return db[_0x0db8('0x44')][_0x0db8('0x27')](_0x1145bf);})[_0x0db8('0x1c')](function(_0x1cabe7){if(_0x15d1cc['query'][_0x0db8('0x51')]===_0x0db8('0x52')){for(var _0x569e71=0x0;_0x569e71<_0x1cabe7[_0x0db8('0x33')];_0x569e71++){_0x1cabe7[_0x569e71][_0x0db8('0x3a')]=juice(_0x1cabe7[_0x569e71]['body']);}}_0x53994b['rows']=_0x1cabe7;return _0x53994b;});}})[_0x0db8('0x1c')](respondWithFilteredResult(_0x3dab80,_0x1145bf))[_0x0db8('0x2a')](handleError(_0x3dab80,null));};exports[_0x0db8('0x53')]=function(_0x2a3d94,_0x1dbfc6){return db[_0x0db8('0x22')][_0x0db8('0x38')]({'where':{'id':_0x2a3d94[_0x0db8('0x2c')]['id']}})[_0x0db8('0x1c')](handleEntityNotFound(_0x1dbfc6,null))[_0x0db8('0x1c')](function(_0x281e27){if(_0x281e27){return _0x281e27['setTags'](_0x2a3d94[_0x0db8('0x3a')][_0x0db8('0x3f')],_[_0x0db8('0x40')](_0x2a3d94[_0x0db8('0x3a')],[_0x0db8('0x3f'),'id'])||{})[_0x0db8('0x54')](function(){return db[_0x0db8('0x55')][_0x0db8('0x27')]({'attributes':['id',_0x0db8('0x1e'),_0x0db8('0x56')],'where':{'id':_0x2a3d94[_0x0db8('0x3a')]['ids']}});})[_0x0db8('0x1c')](function(_0x50ffc2){socket['emit'](_0x0db8('0x57'),{'id':Number(_0x2a3d94[_0x0db8('0x2c')]['id']),'tags':_0x50ffc2||[]});return{'id':Number(_0x2a3d94[_0x0db8('0x2c')]['id']),'tags':_0x50ffc2||[]};});}})['then'](respondWithResult(_0x1dbfc6,null))[_0x0db8('0x2a')](handleError(_0x1dbfc6,null));};exports[_0x0db8('0x58')]=function(_0x3d7e3b,_0x25efd1){return db['MailInteraction'][_0x0db8('0x38')]({'where':{'id':_0x3d7e3b[_0x0db8('0x2c')]['id']}})[_0x0db8('0x1c')](handleEntityNotFound(_0x25efd1,null))[_0x0db8('0x1c')](function(_0x5b18d5){if(_0x5b18d5){return _0x5b18d5[_0x0db8('0x58')](_0x3d7e3b['query'][_0x0db8('0x3f')]);}})[_0x0db8('0x1c')](respondWithStatusCode(_0x25efd1,null))['catch'](handleError(_0x25efd1,null));};exports[_0x0db8('0x59')]=function(_0x258dd4,_0x52ed6d){var _0x272bbe=moment()[_0x0db8('0x5a')]()['toString']();var _0xef5d54=path[_0x0db8('0x5b')](config['root'],_0x0db8('0x5c'),'files',_0x0db8('0x5d'));var _0x24d1a9=path[_0x0db8('0x5b')](config['root'],_0x0db8('0x5c'),_0x0db8('0x5e'),_0x0db8('0x5f'));var _0x228637=path[_0x0db8('0x5b')](_0xef5d54,_0x272bbe);var _0x499f27=util[_0x0db8('0x4f')](_0x0db8('0x60'),_0x258dd4['params']['id'],_0x272bbe);var _0x43a123=path[_0x0db8('0x5b')](_0xef5d54,_0x499f27);var _0xf8c489=[];if(_0x258dd4[_0x0db8('0x2e')][_0x0db8('0x5f')]){_0xf8c489['push']({'model':db[_0x0db8('0x61')],'as':'Attachments','raw':!![]});}var _0x19d9dd=[{'model':db[_0x0db8('0x44')],'as':_0x0db8('0x62'),'attributes':['id',_0x0db8('0x3a'),'from','to','cc',_0x0db8('0x63'),_0x0db8('0x64'),_0x0db8('0x65')],'where':{'secret':![]},'order':qs[_0x0db8('0x48')]('id'),'include':_0xf8c489}];return db[_0x0db8('0x22')][_0x0db8('0x38')]({'where':{'id':_0x258dd4[_0x0db8('0x2c')]['id']},'include':_0x19d9dd})[_0x0db8('0x1c')](handleEntityNotFound(_0x52ed6d,null))[_0x0db8('0x1c')](function(_0x4f343e){if(_0x4f343e&&_0x4f343e[_0x0db8('0x62')]){var _0x56b9c5=_0x4f343e[_0x0db8('0x66')]({'plain':!![]});fs[_0x0db8('0x67')](_0x228637);return BPromise[_0x0db8('0x68')](_0x56b9c5[_0x0db8('0x62')],function(_0x28ee02,_0x4840b1){var _0x140b32={'from':_0x28ee02[_0x0db8('0x69')],'to':_0x28ee02['to']||_0x0db8('0x6a'),'subject':_0x28ee02[_0x0db8('0x64')],'html':htmlEntities[_0x0db8('0x6b')](_0x28ee02['body']),'headers':{'Date':moment(_0x28ee02[_0x0db8('0x65')])['format'](_0x0db8('0x6c'))},'attachments':[]};if(_0x28ee02['cc']){_0x140b32[_0x0db8('0x6d')]['Cc']=_0x28ee02['cc'];}if(_0x28ee02[_0x0db8('0x63')]){_0x140b32[_0x0db8('0x6d')]['Bcc']=_0x28ee02['bcc'];}return new BPromise(function(_0x385898,_0xf26b0d){if(_0x28ee02[_0x0db8('0x6e')]){for(var _0x277ee1=0x0;_0x277ee1<_0x28ee02[_0x0db8('0x6e')][_0x0db8('0x33')];_0x277ee1++){var _0x164d21=_0x28ee02['Attachments'][_0x277ee1];var _0x6cd1b1=path[_0x0db8('0x5b')](_0x24d1a9,_0x164d21[_0x0db8('0x6f')]);if(fs['existsSync'](_0x6cd1b1)){_0x140b32['attachments']['push']({'name':_0x164d21[_0x0db8('0x1e')],'contentType':_0x164d21['type'],'data':fs[_0x0db8('0x70')](_0x6cd1b1)});}}}emlformat['build'](_0x140b32,function(_0x958bce,_0x36ada3){if(_0x958bce)return _0xf26b0d(_0x958bce);fs[_0x0db8('0x71')](path[_0x0db8('0x5b')](_0x228637,util[_0x0db8('0x4f')](_0x0db8('0x72'),_0x4840b1)),_0x36ada3);return _0x385898(_0x36ada3);});});})[_0x0db8('0x1c')](function(){return new BPromise(function(_0x2ca242,_0x4bf8b6){zipdir(_0x228637,{'saveTo':_0x43a123},function(_0x3a4a8b,_0x4bbe52){if(_0x3a4a8b)return _0x4bf8b6(_0x3a4a8b);return _0x2ca242(_0x4bbe52);});})['then'](function(){return new BPromise(function(_0x1b51a5,_0x2f5086){rimraf(_0x228637,function(_0x9c7a77){if(_0x9c7a77)_0x2f5086(_0x9c7a77);return _0x1b51a5();});});})['then'](function(){return _0x52ed6d[_0x0db8('0x59')](_0x43a123,_0x499f27,function(_0xbc9ca2){if(!_0xbc9ca2)fs[_0x0db8('0x73')](_0x43a123);});});});}else{return _0x52ed6d['sendStatus'](0xc8);}})[_0x0db8('0x2a')](handleError(_0x52ed6d,null));}; \ No newline at end of file +var _0x723f=['sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','update','then','error','stack','name','send','MailInteraction','rawAttributes','fieldName','key','getOptions','mail','query','user','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','find','create','body','describe','addMessage','omit','ids','findOne','MailMessage','nolimit','sort','where','pick','MailInteractionId','map','$gte','split','format','inlineCss','true','rows','addTags','setTags','spread','Tag','findAll','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','join','attachments','transcript-%d-%s.zip','Attachment','Attachments','from','bcc','subject','Messages','get','mkdirSync','each','missing.recipient@your.company.com','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','basename','push','type','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x5d9cb5,_0x38c2f0){var _0x45be03=function(_0x479389){while(--_0x479389){_0x5d9cb5['push'](_0x5d9cb5['shift']());}};_0x45be03(++_0x38c2f0);}(_0x723f,0x143));var _0xf723=function(_0x3e9167,_0x4b3390){_0x3e9167=_0x3e9167-0x0;var _0x37c6ca=_0x723f[_0x3e9167];return _0x37c6ca;};'use strict';var emlformat=require(_0xf723('0x0'));var rimraf=require(_0xf723('0x1'));var zipdir=require(_0xf723('0x2'));var moment=require(_0xf723('0x3'));var BPromise=require(_0xf723('0x4'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xf723('0x5'));var juice=require(_0xf723('0x6'));var Redis=require(_0xf723('0x7'));var interaction=require(_0xf723('0x8'));var qs=require(_0xf723('0x9'));var logger=require('../../config/logger')(_0xf723('0xa'));var config=require(_0xf723('0xb'));var db=require(_0xf723('0xc'))['db'];var htmlEntities=require(_0xf723('0xd'));config[_0xf723('0xe')]=_[_0xf723('0xf')](config[_0xf723('0xe')],{'host':_0xf723('0x10'),'port':0x18eb});var socket=require(_0xf723('0x11'))(new Redis(config[_0xf723('0xe')]));require('./mailInteraction.socket')[_0xf723('0x12')](socket);function respondWithStatusCode(_0x1a3072,_0xf304de){_0xf304de=_0xf304de||0xcc;return function(_0x5b0f33){if(_0x5b0f33){return _0x1a3072[_0xf723('0x13')](_0xf304de);}return _0x1a3072['status'](_0xf304de)[_0xf723('0x14')]();};}function respondWithResult(_0x3ff169,_0x3fba){_0x3fba=_0x3fba||0xc8;return function(_0x3df777){if(_0x3df777){return _0x3ff169[_0xf723('0x15')](_0x3fba)[_0xf723('0x16')](_0x3df777);}};}function respondWithFilteredResult(_0x39e7d9,_0x3e8447){return function(_0x39a745){if(_0x39a745){var _0x1eae7d=typeof _0x3e8447['offset']===_0xf723('0x17')&&typeof _0x3e8447[_0xf723('0x18')]===_0xf723('0x17');var _0x52ee16=_0x39a745[_0xf723('0x19')];var _0x3e6ac1=_0x1eae7d?0x0:_0x3e8447['offset'];var _0x3b2cd0=_0x1eae7d?_0x39a745[_0xf723('0x19')]:_0x3e8447[_0xf723('0x1a')]+_0x3e8447[_0xf723('0x18')];var _0x32d77a;if(_0x3b2cd0>=_0x52ee16){_0x3b2cd0=_0x52ee16;_0x32d77a=0xc8;}else{_0x32d77a=0xce;}_0x39e7d9[_0xf723('0x15')](_0x32d77a);return _0x39e7d9['set'](_0xf723('0x1b'),_0x3e6ac1+'-'+_0x3b2cd0+'/'+_0x52ee16)['json'](_0x39a745);}return null;};}function saveUpdates(_0x123b71){return function(_0x587493){if(_0x587493){return _0x587493[_0xf723('0x1c')](_0x123b71)[_0xf723('0x1d')](function(_0x20d6ce){return _0x20d6ce;});}return null;};}function removeEntity(_0x49f854){return function(_0x3969b8){if(_0x3969b8){return _0x3969b8['destroy']()['then'](function(){_0x49f854[_0xf723('0x15')](0xcc)[_0xf723('0x14')]();});}};}function handleEntityNotFound(_0x11b105){return function(_0x185cb9){if(!_0x185cb9){_0x11b105['sendStatus'](0x194);}return _0x185cb9;};}function handleError(_0x197838,_0x3bf0e8){_0x3bf0e8=_0x3bf0e8||0x1f4;return function(_0x44b4a3){logger[_0xf723('0x1e')](_0x44b4a3[_0xf723('0x1f')]);if(_0x44b4a3[_0xf723('0x20')]){delete _0x44b4a3['name'];}_0x197838[_0xf723('0x15')](_0x3bf0e8)[_0xf723('0x21')](_0x44b4a3);};}exports['index']=function(_0x528440,_0x46e622){var _0x3b0a96={};var _0x10e0d9=_['map'](db[_0xf723('0x22')][_0xf723('0x23')],function(_0x24ca7c){return{'name':_0x24ca7c[_0xf723('0x24')],'type':_0x24ca7c['type'][_0xf723('0x25')]};});_0x3b0a96=qs[_0xf723('0x26')](_0x10e0d9,_0x528440);return interaction['findAll'](_0xf723('0x27'),_0x528440[_0xf723('0x28')],_0x528440[_0xf723('0x29')],_0x3b0a96,_0x10e0d9)[_0xf723('0x1d')](respondWithFilteredResult(_0x46e622,_0x3b0a96))[_0xf723('0x2a')](handleError(_0x46e622,null));};exports[_0xf723('0x2b')]=function(_0x554d27,_0x126b79){var _0x3243b={'raw':![],'where':{'id':_0x554d27[_0xf723('0x2c')]['id']}},_0xbef536={};_0xbef536[_0xf723('0x2d')]=_[_0xf723('0x2e')](db[_0xf723('0x22')][_0xf723('0x23')]);_0xbef536['query']=_[_0xf723('0x2e')](_0x554d27[_0xf723('0x28')]);_0xbef536[_0xf723('0x2f')]=_[_0xf723('0x30')](_0xbef536[_0xf723('0x2d')],_0xbef536[_0xf723('0x28')]);_0x3243b['attributes']=_[_0xf723('0x30')](_0xbef536[_0xf723('0x2d')],qs[_0xf723('0x31')](_0x554d27[_0xf723('0x28')]['fields']));_0x3243b[_0xf723('0x32')]=_0x3243b[_0xf723('0x32')][_0xf723('0x33')]?_0x3243b[_0xf723('0x32')]:_0xbef536[_0xf723('0x2d')];if(_0x554d27[_0xf723('0x28')][_0xf723('0x34')]){_0x3243b['include']=[{'all':!![]}];}_0x3243b=_[_0xf723('0x35')]({},_0x3243b,_0x554d27['options']);return db['MailInteraction'][_0xf723('0x36')](_0x3243b)[_0xf723('0x1d')](handleEntityNotFound(_0x126b79,null))['then'](respondWithResult(_0x126b79,null))[_0xf723('0x2a')](handleError(_0x126b79,null));};exports['create']=function(_0xf71d69,_0x6b02bb){return db[_0xf723('0x22')][_0xf723('0x37')](_0xf71d69[_0xf723('0x38')],{})[_0xf723('0x1d')](respondWithResult(_0x6b02bb,0xc9))[_0xf723('0x2a')](handleError(_0x6b02bb,null));};exports[_0xf723('0x1c')]=function(_0xa7c828,_0x24f62e){if(_0xa7c828['body']['id']){delete _0xa7c828[_0xf723('0x38')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0xa7c828[_0xf723('0x2c')]['id']}})[_0xf723('0x1d')](handleEntityNotFound(_0x24f62e,null))[_0xf723('0x1d')](saveUpdates(_0xa7c828['body'],null))[_0xf723('0x1d')](respondWithResult(_0x24f62e,null))['catch'](handleError(_0x24f62e,null));};exports['destroy']=function(_0x143233,_0x158382){return db[_0xf723('0x22')]['find']({'where':{'id':_0x143233[_0xf723('0x2c')]['id']}})['then'](handleEntityNotFound(_0x158382,null))['then'](removeEntity(_0x158382,null))[_0xf723('0x2a')](handleError(_0x158382,null));};exports[_0xf723('0x39')]=function(_0x53fd08,_0x45e5d6){return db[_0xf723('0x22')][_0xf723('0x39')]()[_0xf723('0x1d')](respondWithResult(_0x45e5d6,null))[_0xf723('0x2a')](handleError(_0x45e5d6,null));};exports[_0xf723('0x3a')]=function(_0x49c86f,_0x32d315){return db['MailMessage']['find']({'where':{'id':_0x49c86f[_0xf723('0x2c')]['id']}})[_0xf723('0x1d')](handleEntityNotFound(_0x32d315,null))['then'](function(_0x36ad99){if(_0x36ad99){return _0x36ad99[_0xf723('0x3a')](_0x49c86f[_0xf723('0x38')]['ids'],_[_0xf723('0x3b')](_0x49c86f[_0xf723('0x38')],[_0xf723('0x3c'),'id'])||{});}})[_0xf723('0x1d')](respondWithResult(_0x32d315,null))[_0xf723('0x2a')](handleError(_0x32d315,null));};exports['getMessages']=function(_0x4fe486,_0x3bf887){var _0x304754={'raw':![],'where':{}};var _0x5b8fdd={};var _0x5d182d={'count':0x0,'rows':[]};return db[_0xf723('0x22')][_0xf723('0x3d')]({'where':{'id':_0x4fe486[_0xf723('0x2c')]['id']}})[_0xf723('0x1d')](handleEntityNotFound(_0x3bf887,null))[_0xf723('0x1d')](function(_0x50dd24){if(_0x50dd24){_0x5b8fdd[_0xf723('0x2d')]=_[_0xf723('0x2e')](db[_0xf723('0x3e')]['rawAttributes']);_0x5b8fdd[_0xf723('0x28')]=_[_0xf723('0x2e')](_0x4fe486[_0xf723('0x28')]);_0x5b8fdd[_0xf723('0x2f')]=_['intersection'](_0x5b8fdd[_0xf723('0x2d')],_0x5b8fdd[_0xf723('0x28')]);_0x304754['attributes']=_['intersection'](_0x5b8fdd[_0xf723('0x2d')],qs['fields'](_0x4fe486[_0xf723('0x28')][_0xf723('0x31')]));_0x304754[_0xf723('0x32')]=_0x304754['attributes'][_0xf723('0x33')]?_0x304754[_0xf723('0x32')]:_0x5b8fdd[_0xf723('0x2d')];if(!_0x4fe486[_0xf723('0x28')]['hasOwnProperty'](_0xf723('0x3f'))){_0x304754[_0xf723('0x18')]=qs[_0xf723('0x18')](_0x4fe486[_0xf723('0x28')][_0xf723('0x18')]);_0x304754[_0xf723('0x1a')]=qs[_0xf723('0x1a')](_0x4fe486['query'][_0xf723('0x1a')]);}_0x304754['order']=qs[_0xf723('0x40')](_0x4fe486[_0xf723('0x28')][_0xf723('0x40')]);_0x304754[_0xf723('0x41')]=qs[_0xf723('0x2f')](_[_0xf723('0x42')](_0x4fe486['query'],_0x5b8fdd[_0xf723('0x2f')]));_0x304754[_0xf723('0x41')][_0xf723('0x43')]=_0x50dd24['id'];if(_0x4fe486[_0xf723('0x28')]['filter']){_0x304754[_0xf723('0x41')]=_[_0xf723('0x35')](_0x304754[_0xf723('0x41')],{'$or':_[_0xf723('0x44')](_0x304754[_0xf723('0x32')],function(_0x392936){var _0x3df4f6={};_0x3df4f6[_0x392936]={'$like':'%'+_0x4fe486[_0xf723('0x28')]['filter']+'%'};return _0x3df4f6;})});}if(_0x4fe486['query'][_0xf723('0x45')]){var _0x442d1c=_0x4fe486[_0xf723('0x28')][_0xf723('0x45')][_0xf723('0x46')](',');var _0x5dd905={};_0x5dd905[_0x442d1c[0x0]]={'$gte':moment(_0x442d1c[0x1])[_0xf723('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x304754[_0xf723('0x41')]=_[_0xf723('0x35')](_0x304754[_0xf723('0x41')],_0x5dd905);}_0x304754=_['merge']({},_0x304754,_0x4fe486['options']);return db['MailMessage'][_0xf723('0x19')]({'where':_0x304754[_0xf723('0x41')]})['then'](function(_0x5bd3f3){_0x5d182d[_0xf723('0x19')]=_0x5bd3f3;if(_0x4fe486[_0xf723('0x28')][_0xf723('0x34')]){_0x304754['include']=[{'all':!![]}];}return db[_0xf723('0x3e')]['findAll'](_0x304754);})['then'](function(_0x22fa68){if(_0x4fe486[_0xf723('0x28')][_0xf723('0x48')]===_0xf723('0x49')){for(var _0x34686c=0x0;_0x34686c<_0x22fa68[_0xf723('0x33')];_0x34686c++){_0x22fa68[_0x34686c]['body']=juice(_0x22fa68[_0x34686c]['body']);}}_0x5d182d[_0xf723('0x4a')]=_0x22fa68;return _0x5d182d;});}})['then'](respondWithFilteredResult(_0x3bf887,_0x304754))['catch'](handleError(_0x3bf887,null));};exports[_0xf723('0x4b')]=function(_0x35f6b9,_0x1e40fb){return db[_0xf723('0x22')]['find']({'where':{'id':_0x35f6b9[_0xf723('0x2c')]['id']}})[_0xf723('0x1d')](handleEntityNotFound(_0x1e40fb,null))[_0xf723('0x1d')](function(_0x59ae50){if(_0x59ae50){return _0x59ae50[_0xf723('0x4c')](_0x35f6b9[_0xf723('0x38')][_0xf723('0x3c')],_[_0xf723('0x3b')](_0x35f6b9[_0xf723('0x38')],['ids','id'])||{})[_0xf723('0x4d')](function(){return db[_0xf723('0x4e')][_0xf723('0x4f')]({'attributes':['id',_0xf723('0x20'),_0xf723('0x50')],'where':{'id':_0x35f6b9[_0xf723('0x38')][_0xf723('0x3c')]}});})[_0xf723('0x1d')](function(_0x265de9){socket[_0xf723('0x51')](_0xf723('0x52'),{'id':Number(_0x35f6b9[_0xf723('0x2c')]['id']),'tags':_0x265de9||[]});return{'id':Number(_0x35f6b9[_0xf723('0x2c')]['id']),'tags':_0x265de9||[]};});}})[_0xf723('0x1d')](respondWithResult(_0x1e40fb,null))[_0xf723('0x2a')](handleError(_0x1e40fb,null));};exports[_0xf723('0x53')]=function(_0x227bf4,_0x57e96e){return db[_0xf723('0x22')][_0xf723('0x36')]({'where':{'id':_0x227bf4[_0xf723('0x2c')]['id']}})[_0xf723('0x1d')](handleEntityNotFound(_0x57e96e,null))[_0xf723('0x1d')](function(_0x378144){if(_0x378144){return _0x378144[_0xf723('0x53')](_0x227bf4[_0xf723('0x28')]['ids']);}})[_0xf723('0x1d')](respondWithStatusCode(_0x57e96e,null))[_0xf723('0x2a')](handleError(_0x57e96e,null));};exports[_0xf723('0x54')]=function(_0x282408,_0x26a0e2){var _0x5e44bf=moment()[_0xf723('0x55')]()[_0xf723('0x56')]();var _0x59d614=path['join'](config['root'],_0xf723('0x57'),_0xf723('0x58'),_0xf723('0x59'));var _0x31126c=path[_0xf723('0x5a')](config['root'],_0xf723('0x57'),_0xf723('0x58'),_0xf723('0x5b'));var _0x5e8111=path[_0xf723('0x5a')](_0x59d614,_0x5e44bf);var _0x5ba731=util[_0xf723('0x47')](_0xf723('0x5c'),_0x282408['params']['id'],_0x5e44bf);var _0x12443f=path[_0xf723('0x5a')](_0x59d614,_0x5ba731);var _0x24ffb6=[];if(_0x282408[_0xf723('0x28')][_0xf723('0x5b')]){_0x24ffb6['push']({'model':db[_0xf723('0x5d')],'as':_0xf723('0x5e'),'raw':!![]});}var _0x49cbca=[{'model':db[_0xf723('0x3e')],'as':'Messages','attributes':['id',_0xf723('0x38'),_0xf723('0x5f'),'to','cc',_0xf723('0x60'),_0xf723('0x61'),'createdAt'],'where':{'secret':![]},'order':qs[_0xf723('0x40')]('id'),'include':_0x24ffb6}];return db[_0xf723('0x22')][_0xf723('0x36')]({'where':{'id':_0x282408[_0xf723('0x2c')]['id']},'include':_0x49cbca})[_0xf723('0x1d')](handleEntityNotFound(_0x26a0e2,null))[_0xf723('0x1d')](function(_0x58245a){if(_0x58245a&&_0x58245a[_0xf723('0x62')]){var _0x64e065=_0x58245a[_0xf723('0x63')]({'plain':!![]});fs[_0xf723('0x64')](_0x5e8111);return BPromise[_0xf723('0x65')](_0x64e065[_0xf723('0x62')],function(_0x262e61,_0x40f326){var _0x4b77b5={'from':_0x262e61[_0xf723('0x5f')],'to':_0x262e61['to']||_0xf723('0x66'),'subject':_0x262e61['subject'],'html':htmlEntities[_0xf723('0x67')](_0x262e61[_0xf723('0x38')]),'headers':{'Date':moment(_0x262e61[_0xf723('0x68')])[_0xf723('0x47')](_0xf723('0x69'))},'attachments':[]};if(_0x262e61['cc']){_0x4b77b5['headers']['Cc']=_0x262e61['cc'];}if(_0x262e61[_0xf723('0x60')]){_0x4b77b5['headers'][_0xf723('0x6a')]=_0x262e61['bcc'];}return new BPromise(function(_0x490e3a,_0x162059){if(_0x262e61[_0xf723('0x5e')]){for(var _0x5f9a09=0x0;_0x5f9a09<_0x262e61['Attachments']['length'];_0x5f9a09++){var _0x5b680b=_0x262e61['Attachments'][_0x5f9a09];var _0xf1c751=path[_0xf723('0x5a')](_0x31126c,_0x5b680b[_0xf723('0x6b')]);if(fs['existsSync'](_0xf1c751)){_0x4b77b5[_0xf723('0x5b')][_0xf723('0x6c')]({'name':_0x5b680b[_0xf723('0x20')],'contentType':_0x5b680b[_0xf723('0x6d')],'data':fs['readFileSync'](_0xf1c751)});}}}emlformat[_0xf723('0x6e')](_0x4b77b5,function(_0x14ec8d,_0x181c2c){if(_0x14ec8d)return _0x162059(_0x14ec8d);fs[_0xf723('0x6f')](path[_0xf723('0x5a')](_0x5e8111,util[_0xf723('0x47')](_0xf723('0x70'),_0x40f326)),_0x181c2c);return _0x490e3a(_0x181c2c);});});})[_0xf723('0x1d')](function(){return new BPromise(function(_0x4f214f,_0x574c65){zipdir(_0x5e8111,{'saveTo':_0x12443f},function(_0x2b47ab,_0x429437){if(_0x2b47ab)return _0x574c65(_0x2b47ab);return _0x4f214f(_0x429437);});})[_0xf723('0x1d')](function(){return new BPromise(function(_0x1a62fc,_0x4cd8c0){rimraf(_0x5e8111,function(_0x2f5dcd){if(_0x2f5dcd)_0x4cd8c0(_0x2f5dcd);return _0x1a62fc();});});})[_0xf723('0x1d')](function(){return _0x26a0e2[_0xf723('0x54')](_0x12443f,_0x5ba731,function(_0x13ec85){if(!_0x13ec85)fs[_0xf723('0x71')](_0x12443f);});});});}else{return _0x26a0e2['sendStatus'](0xc8);}})[_0xf723('0x2a')](handleError(_0x26a0e2,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 8cabd53..0026f49 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 _0x965f=['../../mysqldb','MailInteraction','MailMessage','save','update','remove','setDataValue','Users','map','findAll','then','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x312f13,_0x2cfb6b){var _0x4beb36=function(_0xf4dbe7){while(--_0xf4dbe7){_0x312f13['push'](_0x312f13['shift']());}};_0x4beb36(++_0x2cfb6b);}(_0x965f,0x6b));var _0xf965=function(_0x14da21,_0x55815d){_0x14da21=_0x14da21-0x0;var _0x35e757=_0x965f[_0x14da21];return _0x35e757;};'use strict';var EventEmitter=require(_0xf965('0x0'));var MailInteraction=require(_0xf965('0x1'))['db'][_0xf965('0x2')];var MailMessage=require(_0xf965('0x1'))['db'][_0xf965('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf965('0x4'),'afterUpdate':_0xf965('0x5'),'afterDestroy':_0xf965('0x6')};function emitEvent(_0xd4daa){return function(_0x163e40,_0x5a8a78,_0x161890){_0x163e40['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1dd4aa){_0x163e40[_0xf965('0x7')](_0xf965('0x8'),_0x1dd4aa[_0xf965('0x9')](function(_0x377668){return{'id':_0x377668['id']};}));return MailMessage[_0xf965('0xa')]({'where':{'MailInteractionId':_0x163e40['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf965('0xb')](function(_0x156f8e){_0x163e40[_0xf965('0x7')]('unreadMessages',_0x156f8e[_0xf965('0xc')]);MailInteractionEvents[_0xf965('0xd')](_0xd4daa+':'+_0x163e40['id'],_0x163e40);MailInteractionEvents[_0xf965('0xd')](_0xd4daa,_0x163e40);_0x161890(null);})[_0xf965('0xe')](_0x161890(null));};}for(var e in events){if(events[_0xf965('0xf')](e)){var event=events[e];MailInteraction[_0xf965('0x10')](e,emitEvent(event));}}module[_0xf965('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0x4c03=['hook','exports','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch'];(function(_0x2206a6,_0x21bd4b){var _0x3d7c45=function(_0x4bcda1){while(--_0x4bcda1){_0x2206a6['push'](_0x2206a6['shift']());}};_0x3d7c45(++_0x21bd4b);}(_0x4c03,0x189));var _0x34c0=function(_0x2bbd36,_0x3bfce6){_0x2bbd36=_0x2bbd36-0x0;var _0x4b65ed=_0x4c03[_0x2bbd36];return _0x4b65ed;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x34c0('0x0'))['db']['MailInteraction'];var MailMessage=require(_0x34c0('0x0'))['db'][_0x34c0('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x34c0('0x2')](0x0);var events={'afterCreate':_0x34c0('0x3'),'afterUpdate':_0x34c0('0x4'),'afterDestroy':_0x34c0('0x5')};function emitEvent(_0x57e7c9){return function(_0x23182b,_0x15585f,_0x38d29b){_0x23182b[_0x34c0('0x6')]({'attributes':['id'],'raw':!![]})[_0x34c0('0x7')](function(_0xe75a1){_0x23182b[_0x34c0('0x8')](_0x34c0('0x9'),_0xe75a1[_0x34c0('0xa')](function(_0x326336){return{'id':_0x326336['id']};}));return MailMessage[_0x34c0('0xb')]({'where':{'MailInteractionId':_0x23182b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x34c0('0x7')](function(_0x2a88b7){_0x23182b[_0x34c0('0x8')]('unreadMessages',_0x2a88b7[_0x34c0('0xc')]);MailInteractionEvents[_0x34c0('0xd')](_0x57e7c9+':'+_0x23182b['id'],_0x23182b);MailInteractionEvents['emit'](_0x57e7c9,_0x23182b);_0x38d29b(null);})[_0x34c0('0xe')](_0x38d29b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x34c0('0xf')](e,emitEvent(event));}}module[_0x34c0('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 1f7518b..a803595 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 _0xaeb7=['closed','closedAt','get','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3cdbcd,_0x1f8930){var _0x12b687=function(_0xfc9063){while(--_0xfc9063){_0x3cdbcd['push'](_0x3cdbcd['shift']());}};_0x12b687(++_0x1f8930);}(_0xaeb7,0x8f));var _0x7aeb=function(_0x1aaa29,_0xcc57e8){_0x1aaa29=_0x1aaa29-0x0;var _0x4f32d4=_0xaeb7[_0x1aaa29];return _0x4f32d4;};'use strict';var _=require(_0x7aeb('0x0'));var util=require(_0x7aeb('0x1'));var logger=require(_0x7aeb('0x2'))(_0x7aeb('0x3'));var moment=require(_0x7aeb('0x4'));var BPromise=require(_0x7aeb('0x5'));var rp=require(_0x7aeb('0x6'));var fs=require('fs');var path=require(_0x7aeb('0x7'));var rimraf=require(_0x7aeb('0x8'));var config=require(_0x7aeb('0x9'));var attributes=require(_0x7aeb('0xa'));module['exports']=function(_0xfe8a59,_0x398bcd){return _0xfe8a59[_0x7aeb('0xb')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x7aeb('0xc'),'fields':[_0x7aeb('0xd'),'to'],'type':_0x7aeb('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4e9672,_0x455c96,_0x188238){if(_0x4e9672[_0x7aeb('0xf')]){_0x4e9672[_0x7aeb('0x10')]=moment()[_0x7aeb('0x11')](_0x7aeb('0x12'));}if(_0x4e9672[_0x7aeb('0x13')]){_0x4e9672[_0x7aeb('0x14')]=moment()[_0x7aeb('0x11')](_0x7aeb('0x12'));}_0x188238(null,_0x455c96);},'beforeUpdate':function(_0x48e235,_0x422951,_0x12acee){if(_0x48e235['changed'](_0x7aeb('0xf'))){_0x48e235[_0x7aeb('0x10')]=_0x48e235['substatus']?moment()['format'](_0x7aeb('0x12')):null;}if(_0x48e235['changed']('closed')){_0x48e235[_0x7aeb('0x14')]=moment()[_0x7aeb('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x48e235[_0x7aeb('0xf')]=null;_0x48e235[_0x7aeb('0x10')]=null;}_0x12acee(null,_0x48e235);},'afterUpdate':function(_0x46f031,_0x1a8d5b,_0xd0f14b){var _0x37da7a=_0xfe8a59['models'];var _0x25b741=_0x46f031[_0x7aeb('0x15')]({'plain':!![]});if(_0x25b741[_0x7aeb('0x13')]){return _0x37da7a[_0x7aeb('0x16')][_0x7aeb('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x25b741['id']}})[_0x7aeb('0x18')](function(){_0xd0f14b();})['catch'](function(_0x2c3bea){_0xd0f14b(_0x2c3bea);});}else{_0xd0f14b();}}},'charset':_0x7aeb('0x19'),'collate':_0x7aeb('0x1a')});}; \ No newline at end of file +var _0x19b0=['format','changed','models','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt'];(function(_0x4a84d3,_0x1b1a36){var _0x375c4f=function(_0x23cc26){while(--_0x23cc26){_0x4a84d3['push'](_0x4a84d3['shift']());}};_0x375c4f(++_0x1b1a36);}(_0x19b0,0xb7));var _0x019b=function(_0x15a812,_0x4855c7){_0x15a812=_0x15a812-0x0;var _0x17aef5=_0x19b0[_0x15a812];return _0x17aef5;};'use strict';var _=require(_0x019b('0x0'));var util=require('util');var logger=require(_0x019b('0x1'))(_0x019b('0x2'));var moment=require(_0x019b('0x3'));var BPromise=require(_0x019b('0x4'));var rp=require(_0x019b('0x5'));var fs=require('fs');var path=require(_0x019b('0x6'));var rimraf=require(_0x019b('0x7'));var config=require(_0x019b('0x8'));var attributes=require(_0x019b('0x9'));module[_0x019b('0xa')]=function(_0x4497eb,_0x1531af){return _0x4497eb[_0x019b('0xb')](_0x019b('0xc'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x019b('0xd'),'fields':[_0x019b('0xe'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1c490d,_0x4bae05,_0xfb3e3b){if(_0x1c490d[_0x019b('0xf')]){_0x1c490d[_0x019b('0x10')]=moment()['format'](_0x019b('0x11'));}if(_0x1c490d[_0x019b('0x12')]){_0x1c490d[_0x019b('0x13')]=moment()[_0x019b('0x14')]('YYYY-MM-DD\x20HH:mm:ss');}_0xfb3e3b(null,_0x4bae05);},'beforeUpdate':function(_0x2dbbea,_0x58c16a,_0x408413){if(_0x2dbbea[_0x019b('0x15')](_0x019b('0xf'))){_0x2dbbea['substatusAt']=_0x2dbbea[_0x019b('0xf')]?moment()['format'](_0x019b('0x11')):null;}if(_0x2dbbea[_0x019b('0x15')]('closed')){_0x2dbbea[_0x019b('0x13')]=moment()[_0x019b('0x14')](_0x019b('0x11'));_0x2dbbea[_0x019b('0xf')]=null;_0x2dbbea['substatusAt']=null;}_0x408413(null,_0x2dbbea);},'afterUpdate':function(_0xc0b226,_0x1eb85b,_0x53fbaa){var _0x30fd78=_0x4497eb[_0x019b('0x16')];var _0x596562=_0xc0b226['get']({'plain':!![]});if(_0x596562['closed']){return _0x30fd78[_0x019b('0x17')][_0x019b('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x596562['id']}})[_0x019b('0x19')](function(){_0x53fbaa();})[_0x019b('0x1a')](function(_0x481530){_0x53fbaa(_0x481530);});}else{_0x53fbaa();}}},'charset':_0x019b('0x1b'),'collate':_0x019b('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 82624ab..19f0c6b 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 _0x433f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailInteraction','MailInteraction','update','body','options','where','attributes','limit','AddTagsToMailInteraction','addTags','omit','ids','spread','AddTags','catch','util','moment'];(function(_0x1aae75,_0x258954){var _0x3d3dda=function(_0x462d62){while(--_0x462d62){_0x1aae75['push'](_0x1aae75['shift']());}};_0x3d3dda(++_0x258954);}(_0x433f,0x1b6));var _0xf433=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x433f[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0xf433('0x0'));var moment=require(_0xf433('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf433('0x2'));var db=require(_0xf433('0x3'))['db'];var utils=require(_0xf433('0x4'));var logger=require(_0xf433('0x5'))('rpc');var config=require(_0xf433('0x6'));var jayson=require(_0xf433('0x7'));var client=jayson['client'][_0xf433('0x8')]({'port':0x232a});config[_0xf433('0x9')]=_['defaults'](config[_0xf433('0x9')],{'host':_0xf433('0xa'),'port':0x18eb});var socket=require(_0xf433('0xb'))(new Redis(config[_0xf433('0x9')]));require('./mailInteraction.socket')[_0xf433('0xc')](socket);function respondWithRpcPromise(_0x26c137,_0x5c5e9a,_0x22199f){return new BPromise(function(_0x20c2e7,_0x4a2b7b){return client[_0xf433('0xd')](_0x26c137,_0x22199f)[_0xf433('0xe')](function(_0x3d4d90){logger[_0xf433('0xf')](_0xf433('0x10'),_0x5c5e9a,_0xf433('0x11'));logger[_0xf433('0x12')](_0xf433('0x13'),_0x5c5e9a,_0xf433('0x11'),JSON[_0xf433('0x14')](_0x3d4d90));if(_0x3d4d90[_0xf433('0x15')]){if(_0x3d4d90[_0xf433('0x15')][_0xf433('0x16')]===0x1f4){logger['error'](_0xf433('0x10'),_0x5c5e9a,_0x3d4d90[_0xf433('0x15')]['message']);return _0x4a2b7b(_0x3d4d90[_0xf433('0x15')][_0xf433('0x17')]);}logger['error'](_0xf433('0x10'),_0x5c5e9a,_0x3d4d90['error'][_0xf433('0x17')]);return _0x20c2e7(_0x3d4d90[_0xf433('0x15')]['message']);}else{logger[_0xf433('0xf')]('MailInteraction,\x20%s,\x20%s',_0x5c5e9a,'request\x20sent');_0x20c2e7(_0x3d4d90[_0xf433('0x18')]['message']);}})['catch'](function(_0x3c7b1a){logger[_0xf433('0x15')]('MailInteraction,\x20%s,\x20%s',_0x5c5e9a,_0x3c7b1a);_0x4a2b7b(_0x3c7b1a);});});}exports[_0xf433('0x19')]=function(_0x374f38){var _0x7ba08d=this;return new Promise(function(_0xc84060,_0x437ef2){return db[_0xf433('0x1a')][_0xf433('0x1b')](_0x374f38[_0xf433('0x1c')],{'raw':_0x374f38[_0xf433('0x1d')]?_0x374f38[_0xf433('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x374f38[_0xf433('0x1d')]?_0x374f38[_0xf433('0x1d')][_0xf433('0x1e')]||null:null,'attributes':_0x374f38[_0xf433('0x1d')]?_0x374f38[_0xf433('0x1d')][_0xf433('0x1f')]||null:null,'limit':_0x374f38[_0xf433('0x1d')]?_0x374f38[_0xf433('0x1d')][_0xf433('0x20')]||null:null})[_0xf433('0xe')](function(_0x15b9cd){logger['info'](_0xf433('0x19'),_0x374f38);logger[_0xf433('0x12')](_0xf433('0x19'),_0x374f38,JSON['stringify'](_0x15b9cd));_0xc84060(_0x15b9cd);})['catch'](function(_0x5d22b1){logger[_0xf433('0x15')](_0xf433('0x19'),_0x5d22b1[_0xf433('0x17')],_0x374f38);_0x437ef2(_0x7ba08d['error'](0x1f4,_0x5d22b1[_0xf433('0x17')]));});});};exports[_0xf433('0x21')]=function(_0x3d0115){return new Promise(function(_0x3fef77,_0x3edbd0){return db[_0xf433('0x1a')]['find']({'where':_0x3d0115[_0xf433('0x1d')]?_0x3d0115['options']['where']||null:null})[_0xf433('0xe')](function(_0x1633df){if(_0x1633df){return _0x1633df[_0xf433('0x22')](_0x3d0115[_0xf433('0x1c')]['ids'],_[_0xf433('0x23')](_0x3d0115[_0xf433('0x1c')],[_0xf433('0x24'),'id'])||{});}})[_0xf433('0x25')](function(_0x32cb54){logger[_0xf433('0xf')](_0xf433('0x26'),_0x3d0115);logger['debug']('AddTags',_0x3d0115,JSON['stringify'](_0x32cb54));_0x3fef77(_0x32cb54);})[_0xf433('0x27')](function(_0x51af08){logger[_0xf433('0x15')](_0xf433('0x26'),_0x51af08[_0xf433('0x17')],_0x3d0115);_0x3edbd0(_this[_0xf433('0x15')](0x1f4,_0x51af08[_0xf433('0x17')]));});});}; \ No newline at end of file +var _0x6a0b=['stringify','error','code','message','info','catch','MailInteraction','body','options','where','attributes','UpdateMailInteraction','AddTagsToMailInteraction','find','ids','omit','spread','AddTags','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x538818,_0x3f3fc2){var _0x39c360=function(_0x533bfe){while(--_0x533bfe){_0x538818['push'](_0x538818['shift']());}};_0x39c360(++_0x3f3fc2);}(_0x6a0b,0xf6));var _0xb6a0=function(_0x5b0293,_0x1f5a31){_0x5b0293=_0x5b0293-0x0;var _0x9ee921=_0x6a0b[_0x5b0293];return _0x9ee921;};'use strict';var _=require(_0xb6a0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb6a0('0x1'));var rs=require(_0xb6a0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6a0('0x3'))['db'];var utils=require(_0xb6a0('0x4'));var logger=require(_0xb6a0('0x5'))(_0xb6a0('0x6'));var config=require(_0xb6a0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb6a0('0x8')][_0xb6a0('0x9')]({'port':0x232a});config[_0xb6a0('0xa')]=_[_0xb6a0('0xb')](config[_0xb6a0('0xa')],{'host':_0xb6a0('0xc'),'port':0x18eb});var socket=require(_0xb6a0('0xd'))(new Redis(config[_0xb6a0('0xa')]));require(_0xb6a0('0xe'))['register'](socket);function respondWithRpcPromise(_0x490a5e,_0x5cf7a2,_0x4cb12b){return new BPromise(function(_0x5e093b,_0x3d6d0e){return client['request'](_0x490a5e,_0x4cb12b)[_0xb6a0('0xf')](function(_0x1df08c){logger['info'](_0xb6a0('0x10'),_0x5cf7a2,_0xb6a0('0x11'));logger[_0xb6a0('0x12')](_0xb6a0('0x13'),_0x5cf7a2,_0xb6a0('0x11'),JSON[_0xb6a0('0x14')](_0x1df08c));if(_0x1df08c[_0xb6a0('0x15')]){if(_0x1df08c[_0xb6a0('0x15')][_0xb6a0('0x16')]===0x1f4){logger[_0xb6a0('0x15')]('MailInteraction,\x20%s,\x20%s',_0x5cf7a2,_0x1df08c[_0xb6a0('0x15')][_0xb6a0('0x17')]);return _0x3d6d0e(_0x1df08c[_0xb6a0('0x15')][_0xb6a0('0x17')]);}logger[_0xb6a0('0x15')](_0xb6a0('0x10'),_0x5cf7a2,_0x1df08c[_0xb6a0('0x15')][_0xb6a0('0x17')]);return _0x5e093b(_0x1df08c[_0xb6a0('0x15')]['message']);}else{logger[_0xb6a0('0x18')](_0xb6a0('0x10'),_0x5cf7a2,_0xb6a0('0x11'));_0x5e093b(_0x1df08c['result'][_0xb6a0('0x17')]);}})[_0xb6a0('0x19')](function(_0x1708e4){logger[_0xb6a0('0x15')](_0xb6a0('0x10'),_0x5cf7a2,_0x1708e4);_0x3d6d0e(_0x1708e4);});});}exports['UpdateMailInteraction']=function(_0x5117b1){var _0x265a8b=this;return new Promise(function(_0x430ced,_0x47b1d0){return db[_0xb6a0('0x1a')]['update'](_0x5117b1[_0xb6a0('0x1b')],{'raw':_0x5117b1[_0xb6a0('0x1c')]?_0x5117b1[_0xb6a0('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5117b1[_0xb6a0('0x1c')]?_0x5117b1[_0xb6a0('0x1c')][_0xb6a0('0x1d')]||null:null,'attributes':_0x5117b1['options']?_0x5117b1[_0xb6a0('0x1c')][_0xb6a0('0x1e')]||null:null,'limit':_0x5117b1['options']?_0x5117b1[_0xb6a0('0x1c')]['limit']||null:null})['then'](function(_0xa40d72){logger['info'](_0xb6a0('0x1f'),_0x5117b1);logger[_0xb6a0('0x12')](_0xb6a0('0x1f'),_0x5117b1,JSON[_0xb6a0('0x14')](_0xa40d72));_0x430ced(_0xa40d72);})[_0xb6a0('0x19')](function(_0x27bb68){logger[_0xb6a0('0x15')]('UpdateMailInteraction',_0x27bb68[_0xb6a0('0x17')],_0x5117b1);_0x47b1d0(_0x265a8b[_0xb6a0('0x15')](0x1f4,_0x27bb68[_0xb6a0('0x17')]));});});};exports[_0xb6a0('0x20')]=function(_0x2cbcd3){return new Promise(function(_0x58d25e,_0x28f593){return db['MailInteraction'][_0xb6a0('0x21')]({'where':_0x2cbcd3[_0xb6a0('0x1c')]?_0x2cbcd3[_0xb6a0('0x1c')][_0xb6a0('0x1d')]||null:null})[_0xb6a0('0xf')](function(_0x440375){if(_0x440375){return _0x440375['addTags'](_0x2cbcd3['body'][_0xb6a0('0x22')],_[_0xb6a0('0x23')](_0x2cbcd3[_0xb6a0('0x1b')],[_0xb6a0('0x22'),'id'])||{});}})[_0xb6a0('0x24')](function(_0x5c4bb4){logger['info'](_0xb6a0('0x25'),_0x2cbcd3);logger[_0xb6a0('0x12')](_0xb6a0('0x25'),_0x2cbcd3,JSON[_0xb6a0('0x14')](_0x5c4bb4));_0x58d25e(_0x5c4bb4);})['catch'](function(_0x4bb109){logger[_0xb6a0('0x15')](_0xb6a0('0x25'),_0x4bb109[_0xb6a0('0x17')],_0x2cbcd3);_0x28f593(_this[_0xb6a0('0x15')](0x1f4,_0x4bb109[_0xb6a0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 470dedf..65a9c85 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 _0x0194=['length','save','update','removeListener','register'];(function(_0x4fdd64,_0x4ec5d4){var _0x1e9ae1=function(_0x60bf04){while(--_0x60bf04){_0x4fdd64['push'](_0x4fdd64['shift']());}};_0x1e9ae1(++_0x4ec5d4);}(_0x0194,0x1a5));var _0x4019=function(_0x287605,_0x1fbcf8){_0x287605=_0x287605-0x0;var _0x325658=_0x0194[_0x287605];return _0x325658;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x4019('0x0'),'remove',_0x4019('0x1')];function createListener(_0x3803f3,_0x6867a3){return function(_0x5e09a5){_0x6867a3['emit'](_0x3803f3,_0x5e09a5);};}function removeListener(_0x4a20f8,_0x1ea51e){return function(){MailInteractionEvents[_0x4019('0x2')](_0x4a20f8,_0x1ea51e);};}exports[_0x4019('0x3')]=function(_0xd7b48f){for(var _0x38c379=0x0,_0xbcccd3=events[_0x4019('0x4')];_0x38c379<_0xbcccd3;_0x38c379++){var _0x559b00=events[_0x38c379];var _0x546772=createListener('mailInteraction:'+_0x559b00,_0xd7b48f);MailInteractionEvents['on'](_0x559b00,_0x546772);}}; \ No newline at end of file +var _0x9e7d=['emit','register','length','./mailInteraction.events','save','remove','update'];(function(_0x4cb166,_0x4cec63){var _0x314389=function(_0x345b6b){while(--_0x345b6b){_0x4cb166['push'](_0x4cb166['shift']());}};_0x314389(++_0x4cec63);}(_0x9e7d,0x122));var _0xd9e7=function(_0x39665a,_0xc729df){_0x39665a=_0x39665a-0x0;var _0x173185=_0x9e7d[_0x39665a];return _0x173185;};'use strict';var MailInteractionEvents=require(_0xd9e7('0x0'));var events=[_0xd9e7('0x1'),_0xd9e7('0x2'),_0xd9e7('0x3')];function createListener(_0x1b77b7,_0x39ad76){return function(_0x7758de){_0x39ad76[_0xd9e7('0x4')](_0x1b77b7,_0x7758de);};}function removeListener(_0x4563c9,_0x25fc4e){return function(){MailInteractionEvents['removeListener'](_0x4563c9,_0x25fc4e);};}exports[_0xd9e7('0x5')]=function(_0x425c7b){for(var _0x2d92d4=0x0,_0x5b763d=events[_0xd9e7('0x6')];_0x2d92d4<_0x5b763d;_0x2d92d4++){var _0x4ce0ec=events[_0x2d92d4];var _0x37ed1f=createListener('mailInteraction:'+_0x4ce0ec,_0x425c7b);MailInteractionEvents['on'](_0x4ce0ec,_0x37ed1f);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index caad1b5..e410cc4 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 _0x803f=['describe','exports','Router','../../components/auth/service','./mailInteractionHasTag.controller','get','/describe'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x803f,0x144));var _0xf803=function(_0x15f211,_0x49c7b3){_0x15f211=_0x15f211-0x0;var _0x120bfa=_0x803f[_0x15f211];return _0x120bfa;};'use strict';var express=require('express');var router=express[_0xf803('0x0')]();var auth=require(_0xf803('0x1'));var controller=require(_0xf803('0x2'));router[_0xf803('0x3')](_0xf803('0x4'),auth['isAuthenticated'](),controller[_0xf803('0x5')]);module[_0xf803('0x6')]=router; \ No newline at end of file +var _0x6462=['Router','../../components/auth/service','./mailInteractionHasTag.controller','/describe','isAuthenticated','describe','exports','express'];(function(_0xb37e53,_0x320cda){var _0x48ce78=function(_0x47c046){while(--_0x47c046){_0xb37e53['push'](_0xb37e53['shift']());}};_0x48ce78(++_0x320cda);}(_0x6462,0x11f));var _0x2646=function(_0x17b3f5,_0x221410){_0x17b3f5=_0x17b3f5-0x0;var _0x1ca43f=_0x6462[_0x17b3f5];return _0x1ca43f;};'use strict';var express=require(_0x2646('0x0'));var router=express[_0x2646('0x1')]();var auth=require(_0x2646('0x2'));var controller=require(_0x2646('0x3'));router['get'](_0x2646('0x4'),auth[_0x2646('0x5')](),controller[_0x2646('0x6')]);module[_0x2646('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 7b01c5b..db15249 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(_0x2893a1,_0x3c4d83){var _0x17d8cf=function(_0x266ea8){while(--_0x266ea8){_0x2893a1['push'](_0x2893a1['shift']());}};_0x17d8cf(++_0x3c4d83);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x4a7d33,_0x10af50){var _0x118cc9=function(_0x4f9157){while(--_0x4f9157){_0x4a7d33['push'](_0x4a7d33['shift']());}};_0x118cc9(++_0x10af50);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 285ca2d..c47c8b1 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 _0x2d75=['INTEGER'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2d75,0xca));var _0x52d7=function(_0x4132d1,_0x41fbbd){_0x4132d1=_0x4132d1-0x0;var _0x27d9cb=_0x2d75[_0x4132d1];return _0x27d9cb;};'use strict';var Sequelize=require('sequelize');module['exports']={'MailInteractionId':{'type':Sequelize[_0x52d7('0x0')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x52d7('0x0')],'defaultValue':null}}; \ No newline at end of file +var _0x6c92=['exports','INTEGER','sequelize'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x6c92,0x122));var _0x26c9=function(_0x543724,_0x306e86){_0x543724=_0x543724-0x0;var _0x246e23=_0x6c92[_0x543724];return _0x246e23;};'use strict';var Sequelize=require(_0x26c9('0x0'));module[_0x26c9('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x26c9('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 e7989f9..948d1ee 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 _0xeedf=['./mailInteractionHasTag','exports','MailInteractionHasTag'];(function(_0x51b19c,_0x325ef4){var _0x1d8fdc=function(_0x1e9917){while(--_0x1e9917){_0x51b19c['push'](_0x51b19c['shift']());}};_0x1d8fdc(++_0x325ef4);}(_0xeedf,0x12c));var _0xfeed=function(_0x5c9955,_0x315373){_0x5c9955=_0x5c9955-0x0;var _0x544084=_0xeedf[_0x5c9955];return _0x544084;};'use strict';var attributes=require(_0xfeed('0x0'));module[_0xfeed('0x1')]=function(_0x195e7b){return _0x195e7b['define'](_0xfeed('0x2'),attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8969=['exports','define','MailInteractionHasTag','mail_interaction_has_tags','./mailInteractionHasTag'];(function(_0x489618,_0x233987){var _0x3d34b8=function(_0xe4ffd0){while(--_0xe4ffd0){_0x489618['push'](_0x489618['shift']());}};_0x3d34b8(++_0x233987);}(_0x8969,0x10d));var _0x9896=function(_0x1b0d80,_0x595e9e){_0x1b0d80=_0x1b0d80-0x0;var _0x480c88=_0x8969[_0x1b0d80];return _0x480c88;};'use strict';var attributes=require(_0x9896('0x0'));module[_0x9896('0x1')]=function(_0xf9614d){return _0xf9614d[_0x9896('0x2')](_0x9896('0x3'),attributes,{'tableName':_0x9896('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index b93aa0b..bc86597 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 _0x73bd=['/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','index','get','/describe','isAuthenticated','describe','show','download','post','mail','mailmessage:create','put','/:id/accept','accept','/:id/reject','reject'];(function(_0x4a5246,_0x4c8890){var _0x55eaba=function(_0x2369e7){while(--_0x2369e7){_0x4a5246['push'](_0x4a5246['shift']());}};_0x55eaba(++_0x4c8890);}(_0x73bd,0x6b));var _0xd73b=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x73bd[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xd73b('0x0'));var util=require('util');var path=require(_0xd73b('0x1'));var timeout=require(_0xd73b('0x2'));var express=require(_0xd73b('0x3'));var router=express[_0xd73b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd73b('0x5'));var interaction=require(_0xd73b('0x6'));var config=require('../../config/environment');var controller=require(_0xd73b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd73b('0x8')]);router[_0xd73b('0x9')](_0xd73b('0xa'),auth[_0xd73b('0xb')](),controller[_0xd73b('0xc')]);router[_0xd73b('0x9')]('/:id',auth[_0xd73b('0xb')](),controller[_0xd73b('0xd')]);router['get']('/:id/download',auth[_0xd73b('0xb')](),controller[_0xd73b('0xe')]);router[_0xd73b('0xf')]('/',auth[_0xd73b('0xb')](),interaction['tracked'](_0xd73b('0x10'),_0xd73b('0x11')),controller['create']);router[_0xd73b('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd73b('0x12')](_0xd73b('0x13'),auth[_0xd73b('0xb')](),controller[_0xd73b('0x14')]);router[_0xd73b('0x12')](_0xd73b('0x15'),auth[_0xd73b('0xb')](),controller[_0xd73b('0x16')]);router['delete'](_0xd73b('0x17'),auth[_0xd73b('0xb')](),controller[_0xd73b('0x18')]);module[_0xd73b('0x19')]=router; \ No newline at end of file +var _0x5cd8=['index','/describe','/:id','show','/:id/download','download','post','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated'];(function(_0x8c3a83,_0x1bd8fe){var _0x359cd1=function(_0x492c4b){while(--_0x492c4b){_0x8c3a83['push'](_0x8c3a83['shift']());}};_0x359cd1(++_0x1bd8fe);}(_0x5cd8,0x1d2));var _0x85cd=function(_0x57334e,_0x2b822a){_0x57334e=_0x57334e-0x0;var _0x450ed9=_0x5cd8[_0x57334e];return _0x450ed9;};'use strict';var multer=require(_0x85cd('0x0'));var util=require('util');var path=require(_0x85cd('0x1'));var timeout=require(_0x85cd('0x2'));var express=require(_0x85cd('0x3'));var router=express[_0x85cd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x85cd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x85cd('0x6'));var controller=require(_0x85cd('0x7'));router[_0x85cd('0x8')]('/',auth[_0x85cd('0x9')](),controller[_0x85cd('0xa')]);router['get'](_0x85cd('0xb'),auth[_0x85cd('0x9')](),controller['describe']);router[_0x85cd('0x8')](_0x85cd('0xc'),auth[_0x85cd('0x9')](),controller[_0x85cd('0xd')]);router[_0x85cd('0x8')](_0x85cd('0xe'),auth[_0x85cd('0x9')](),controller[_0x85cd('0xf')]);router[_0x85cd('0x10')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x85cd('0x11'),_0x85cd('0x12')),controller[_0x85cd('0x13')]);router[_0x85cd('0x14')]('/:id',auth[_0x85cd('0x9')](),controller[_0x85cd('0x15')]);router[_0x85cd('0x14')](_0x85cd('0x16'),auth[_0x85cd('0x9')](),controller[_0x85cd('0x17')]);router[_0x85cd('0x14')](_0x85cd('0x18'),auth['isAuthenticated'](),controller[_0x85cd('0x19')]);router[_0x85cd('0x1a')](_0x85cd('0xc'),auth[_0x85cd('0x9')](),controller[_0x85cd('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 1faae6b..4a49d4c 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 _0x249d=['STRING','long','INTEGER','DATE','Email','Chat','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x18427d,_0x243953){var _0x2d6688=function(_0x58e685){while(--_0x58e685){_0x18427d['push'](_0x18427d['shift']());}};_0x2d6688(++_0x243953);}(_0x249d,0x126));var _0xd249=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x249d[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xd249('0x0')]={'body':{'type':Sequelize[_0xd249('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xd249('0x1')](_0xd249('0x2'))},'read':{'type':Sequelize[_0xd249('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd249('0x4')]('in',_0xd249('0x5')),'defaultValue':_0xd249('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xd249('0x6')]},'to':{'type':Sequelize[_0xd249('0x1')](_0xd249('0x7'))},'cc':{'type':Sequelize['TEXT'](_0xd249('0x7'))},'bcc':{'type':Sequelize['TEXT'](_0xd249('0x7'))},'subject':{'type':Sequelize[_0xd249('0x1')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xd249('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xd249('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xd249('0x9')]},'originTo':{'type':Sequelize[_0xd249('0x1')](_0xd249('0x7'))},'originCc':{'type':Sequelize['TEXT'](_0xd249('0x7'))},'originChannel':{'type':Sequelize[_0xd249('0x4')](_0xd249('0xa'),_0xd249('0xb')),'defaultValue':_0xd249('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x9c4a=['medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN','Email','Chat','lodash','TEXT','long'];(function(_0x5448a9,_0x4764da){var _0x1924af=function(_0x34f9bf){while(--_0x34f9bf){_0x5448a9['push'](_0x5448a9['shift']());}};_0x1924af(++_0x4764da);}(_0x9c4a,0x1dd));var _0xa9c4=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0x9c4a[_0x3203a1];return _0x24215e;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa9c4('0x0'));module['exports']={'body':{'type':Sequelize[_0xa9c4('0x1')](_0xa9c4('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xa9c4('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa9c4('0x4')]('in',_0xa9c4('0x5')),'defaultValue':_0xa9c4('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa9c4('0x6')](0x1fe)},'from':{'type':Sequelize[_0xa9c4('0x6')]},'to':{'type':Sequelize[_0xa9c4('0x1')](_0xa9c4('0x2'))},'cc':{'type':Sequelize[_0xa9c4('0x1')](_0xa9c4('0x2'))},'bcc':{'type':Sequelize[_0xa9c4('0x1')](_0xa9c4('0x2'))},'subject':{'type':Sequelize[_0xa9c4('0x1')]},'sentAt':{'type':Sequelize[_0xa9c4('0x7')]},'attach':{'type':Sequelize[_0xa9c4('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa9c4('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa9c4('0x7')]},'originTo':{'type':Sequelize[_0xa9c4('0x1')]('long')},'originCc':{'type':Sequelize[_0xa9c4('0x1')](_0xa9c4('0x2'))},'originChannel':{'type':Sequelize[_0xa9c4('0x4')](_0xa9c4('0xa'),_0xa9c4('0xb')),'defaultValue':_0xa9c4('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 2bc0a75..b56273b 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 _0xc6fc=['sendStatus','stack','name','send','index','MailMessage','rawAttributes','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','keys','find','body','describe','create','out','secret','split','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','join','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','user','agent','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','fullname','manual','channel','motionChannel','fromString','EventManager','get','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','RejectMessage','rejectMessage','User','internal','interface','SIP/%s','event','reject','rejectmessage','toString','root','server','tmp','files','message-%s.eml','from','bcc','subject','Attachment','Attachments','decode','createdAt','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','moment','util','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','json','offset','undefined','limit','count','set','Content-Range','update','destroy','status','end'];(function(_0x54b354,_0x1b3c82){var _0x4d7235=function(_0xd8dd2a){while(--_0xd8dd2a){_0x54b354['push'](_0x54b354['shift']());}};_0x4d7235(++_0x1b3c82);}(_0xc6fc,0x11a));var _0xcc6f=function(_0x9c3c56,_0x169b56){_0x9c3c56=_0x9c3c56-0x0;var _0x2dd782=_0xc6fc[_0x9c3c56];return _0x2dd782;};'use strict';var emlformat=require('eml-format');var moment=require(_0xcc6f('0x0'));var BPromise=require('bluebird');var util=require(_0xcc6f('0x1'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0xcc6f('0x2'));var htmlToText=require(_0xcc6f('0x3'));var qs=require(_0xcc6f('0x4'));var logger=require(_0xcc6f('0x5'))(_0xcc6f('0x6'));var interaction_log=require(_0xcc6f('0x5'))(_0xcc6f('0x7'));var config=require(_0xcc6f('0x8'));var db=require('../../mysqldb')['db'];config[_0xcc6f('0x9')]=_[_0xcc6f('0xa')](config[_0xcc6f('0x9')],{'host':_0xcc6f('0xb'),'port':0x18eb});var socket=require(_0xcc6f('0xc'))(new Redis(config['redis']));var htmlEntities=require(_0xcc6f('0xd'));require(_0xcc6f('0xe'))[_0xcc6f('0xf')](socket);var jayson=require(_0xcc6f('0x10'));var client=jayson[_0xcc6f('0x11')][_0xcc6f('0x12')]({'port':0x232c});var client9003=jayson[_0xcc6f('0x11')][_0xcc6f('0x12')]({'port':0x232b});var client9002=jayson[_0xcc6f('0x11')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a5872,_0x119131,_0x3db3ed,_0x1436e8){return new BPromise(function(_0x56f69c,_0x375d5d){var _0x20a405=_0x1436e8||client;return _0x20a405[_0xcc6f('0x13')](_0x3a5872,_0x3db3ed)[_0xcc6f('0x14')](function(_0x591f53){logger['info'](_0xcc6f('0x15'),_0x119131,_0xcc6f('0x16'));logger[_0xcc6f('0x17')](_0xcc6f('0x18'),_0x119131,_0xcc6f('0x16'),JSON['stringify'](_0x591f53));if(_0x591f53[_0xcc6f('0x19')]){if(_0x591f53[_0xcc6f('0x19')][_0xcc6f('0x1a')]===0x1f4){logger[_0xcc6f('0x19')](_0xcc6f('0x15'),_0x119131,_0x591f53[_0xcc6f('0x19')]['message']);return _0x375d5d(_0x591f53[_0xcc6f('0x19')]['message']);}logger[_0xcc6f('0x19')](_0xcc6f('0x15'),_0x119131,_0x591f53['error'][_0xcc6f('0x1b')]);return _0x56f69c(_0x591f53[_0xcc6f('0x19')]['message']);}else{logger[_0xcc6f('0x1c')](_0xcc6f('0x15'),_0x119131,_0xcc6f('0x16'));_0x56f69c(_0x591f53[_0xcc6f('0x1d')][_0xcc6f('0x1b')]);}})[_0xcc6f('0x1e')](function(_0x57c8ab){logger[_0xcc6f('0x19')](_0xcc6f('0x15'),_0x119131,_0x57c8ab);_0x375d5d(_0x57c8ab);});});}function respondWithResult(_0xab599f,_0x25f5eb){_0x25f5eb=_0x25f5eb||0xc8;return function(_0x22a1f7){if(_0x22a1f7){return _0xab599f['status'](_0x25f5eb)[_0xcc6f('0x1f')](_0x22a1f7);}};}function respondWithFilteredResult(_0xf3ef75,_0xb03ab9){return function(_0x2ff94b){if(_0x2ff94b){var _0x146133=typeof _0xb03ab9[_0xcc6f('0x20')]===_0xcc6f('0x21')&&typeof _0xb03ab9[_0xcc6f('0x22')]==='undefined';var _0x129f35=_0x2ff94b[_0xcc6f('0x23')];var _0x5e6f43=_0x146133?0x0:_0xb03ab9[_0xcc6f('0x20')];var _0x51881e=_0x146133?_0x2ff94b[_0xcc6f('0x23')]:_0xb03ab9['offset']+_0xb03ab9[_0xcc6f('0x22')];var _0x53bc7c;if(_0x51881e>=_0x129f35){_0x51881e=_0x129f35;_0x53bc7c=0xc8;}else{_0x53bc7c=0xce;}_0xf3ef75['status'](_0x53bc7c);return _0xf3ef75[_0xcc6f('0x24')](_0xcc6f('0x25'),_0x5e6f43+'-'+_0x51881e+'/'+_0x129f35)['json'](_0x2ff94b);}return null;};}function saveUpdates(_0x4a81e8){return function(_0x34482f){if(_0x34482f){return _0x34482f[_0xcc6f('0x26')](_0x4a81e8)[_0xcc6f('0x14')](function(_0x41d9b4){return _0x41d9b4;});}return null;};}function removeEntity(_0x214368){return function(_0x24d535){if(_0x24d535){return _0x24d535[_0xcc6f('0x27')]()[_0xcc6f('0x14')](function(){_0x214368[_0xcc6f('0x28')](0xcc)[_0xcc6f('0x29')]();});}};}function handleEntityNotFound(_0x4cd3ee){return function(_0x22aac7){if(!_0x22aac7){_0x4cd3ee[_0xcc6f('0x2a')](0x194);}return _0x22aac7;};}function handleError(_0x2bef5a,_0x34c0a3){_0x34c0a3=_0x34c0a3||0x1f4;return function(_0x6791e){logger[_0xcc6f('0x19')](_0x6791e[_0xcc6f('0x2b')]);if(_0x6791e[_0xcc6f('0x2c')]){delete _0x6791e['name'];}_0x2bef5a[_0xcc6f('0x28')](_0x34c0a3)[_0xcc6f('0x2d')](_0x6791e);};}exports[_0xcc6f('0x2e')]=function(_0x48375e,_0x54e9d2){var _0x2a3ec={},_0x19cd4d={},_0x5c2c9e={'count':0x0,'rows':[]};var _0x2ed168=_['map'](db[_0xcc6f('0x2f')][_0xcc6f('0x30')],function(_0xc2c2c6){return{'name':_0xc2c2c6['fieldName'],'type':_0xc2c2c6[_0xcc6f('0x31')][_0xcc6f('0x32')]};});_0x19cd4d[_0xcc6f('0x33')]=_[_0xcc6f('0x34')](_0x2ed168,_0xcc6f('0x2c'));_0x19cd4d[_0xcc6f('0x35')]=_['keys'](_0x48375e[_0xcc6f('0x35')]);_0x19cd4d['filters']=_['intersection'](_0x19cd4d[_0xcc6f('0x33')],_0x19cd4d[_0xcc6f('0x35')]);_0x2a3ec[_0xcc6f('0x36')]=_[_0xcc6f('0x37')](_0x19cd4d['model'],qs[_0xcc6f('0x38')](_0x48375e[_0xcc6f('0x35')][_0xcc6f('0x38')]));_0x2a3ec['attributes']=_0x2a3ec[_0xcc6f('0x36')][_0xcc6f('0x39')]?_0x2a3ec[_0xcc6f('0x36')]:_0x19cd4d['model'];if(!_0x48375e[_0xcc6f('0x35')][_0xcc6f('0x3a')]('nolimit')){_0x2a3ec['limit']=qs[_0xcc6f('0x22')](_0x48375e[_0xcc6f('0x35')][_0xcc6f('0x22')]);_0x2a3ec[_0xcc6f('0x20')]=qs[_0xcc6f('0x20')](_0x48375e[_0xcc6f('0x35')]['offset']);}_0x2a3ec[_0xcc6f('0x3b')]=qs['sort'](_0x48375e[_0xcc6f('0x35')][_0xcc6f('0x3c')]);_0x2a3ec[_0xcc6f('0x3d')]=qs[_0xcc6f('0x3e')](_[_0xcc6f('0x3f')](_0x48375e[_0xcc6f('0x35')],_0x19cd4d[_0xcc6f('0x3e')]),_0x2ed168);if(_0x48375e[_0xcc6f('0x35')][_0xcc6f('0x40')]){_0x2a3ec['where']=_[_0xcc6f('0x41')](_0x2a3ec[_0xcc6f('0x3d')],{'$or':_[_0xcc6f('0x34')](_0x2ed168,function(_0x5ed44f){if(_0x5ed44f[_0xcc6f('0x31')]!==_0xcc6f('0x42')){var _0x398fc0={};_0x398fc0[_0x5ed44f[_0xcc6f('0x2c')]]={'$like':'%'+_0x48375e[_0xcc6f('0x35')]['filter']+'%'};return _0x398fc0;}})});}_0x2a3ec=_[_0xcc6f('0x41')]({},_0x2a3ec,_0x48375e[_0xcc6f('0x43')]);var _0x442876={'where':_0x2a3ec['where']};return db['MailMessage'][_0xcc6f('0x23')](_0x442876)[_0xcc6f('0x14')](function(_0x31b74e){_0x5c2c9e[_0xcc6f('0x23')]=_0x31b74e;if(_0x48375e[_0xcc6f('0x35')][_0xcc6f('0x44')]){_0x2a3ec[_0xcc6f('0x45')]=[{'all':!![]}];}return db[_0xcc6f('0x2f')]['findAll'](_0x2a3ec);})[_0xcc6f('0x14')](function(_0x5ac85b){_0x5c2c9e[_0xcc6f('0x46')]=_0x5ac85b;return _0x5c2c9e;})[_0xcc6f('0x14')](respondWithFilteredResult(_0x54e9d2,_0x2a3ec))[_0xcc6f('0x1e')](handleError(_0x54e9d2,null));};exports['show']=function(_0x2cc485,_0xba2df1){var _0x4a6648={'raw':!![],'where':{'id':_0x2cc485[_0xcc6f('0x47')]['id']}},_0x28c8e5={};_0x28c8e5[_0xcc6f('0x33')]=_[_0xcc6f('0x48')](db[_0xcc6f('0x2f')][_0xcc6f('0x30')]);_0x28c8e5['query']=_['keys'](_0x2cc485[_0xcc6f('0x35')]);_0x28c8e5[_0xcc6f('0x3e')]=_[_0xcc6f('0x37')](_0x28c8e5[_0xcc6f('0x33')],_0x28c8e5[_0xcc6f('0x35')]);_0x4a6648[_0xcc6f('0x36')]=_[_0xcc6f('0x37')](_0x28c8e5[_0xcc6f('0x33')],qs[_0xcc6f('0x38')](_0x2cc485[_0xcc6f('0x35')][_0xcc6f('0x38')]));_0x4a6648[_0xcc6f('0x36')]=_0x4a6648[_0xcc6f('0x36')]['length']?_0x4a6648[_0xcc6f('0x36')]:_0x28c8e5[_0xcc6f('0x33')];if(_0x2cc485['query'][_0xcc6f('0x44')]){_0x4a6648[_0xcc6f('0x45')]=[{'all':!![]}];}_0x4a6648=_[_0xcc6f('0x41')]({},_0x4a6648,_0x2cc485[_0xcc6f('0x43')]);return db['MailMessage'][_0xcc6f('0x49')](_0x4a6648)[_0xcc6f('0x14')](handleEntityNotFound(_0xba2df1,null))[_0xcc6f('0x14')](respondWithResult(_0xba2df1,null))[_0xcc6f('0x1e')](handleError(_0xba2df1,null));};exports['update']=function(_0x372b96,_0x190b75){if(_0x372b96[_0xcc6f('0x4a')]['id']){delete _0x372b96[_0xcc6f('0x4a')]['id'];}return db[_0xcc6f('0x2f')][_0xcc6f('0x49')]({'where':{'id':_0x372b96[_0xcc6f('0x47')]['id']}})[_0xcc6f('0x14')](handleEntityNotFound(_0x190b75,null))[_0xcc6f('0x14')](saveUpdates(_0x372b96[_0xcc6f('0x4a')],null))[_0xcc6f('0x14')](respondWithResult(_0x190b75,null))['catch'](handleError(_0x190b75,null));};exports[_0xcc6f('0x27')]=function(_0x4430dd,_0x2fc563){return db[_0xcc6f('0x2f')][_0xcc6f('0x49')]({'where':{'id':_0x4430dd['params']['id']}})['then'](handleEntityNotFound(_0x2fc563,null))['then'](removeEntity(_0x2fc563,null))[_0xcc6f('0x1e')](handleError(_0x2fc563,null));};exports[_0xcc6f('0x4b')]=function(_0x535815,_0x4726cd){return db[_0xcc6f('0x2f')][_0xcc6f('0x4b')]()['then'](respondWithResult(_0x4726cd,null))[_0xcc6f('0x1e')](handleError(_0x4726cd,null));};exports['create']=function(_0x2a8f05,_0x565ff3){return db['MailMessage'][_0xcc6f('0x4c')](_0x2a8f05[_0xcc6f('0x4a')])[_0xcc6f('0x14')](function(_0x3cfb5b){if(_0x3cfb5b){if(_0x3cfb5b['direction']===_0xcc6f('0x4d')&&!_0x3cfb5b[_0xcc6f('0x4e')]){var _0x11af42,_0x540887,_0x4b006f;if(_0x2a8f05[_0xcc6f('0x4a')]['to']){_0x540887=_0x2a8f05['body']['to'][_0xcc6f('0x4f')](',')[0x0];}return db[_0xcc6f('0x50')]['findOne']({'where':{'id':_0x3cfb5b[_0xcc6f('0x51')]},'include':[{'model':db[_0xcc6f('0x52')],'as':_0xcc6f('0x53'),'include':[{'model':db[_0xcc6f('0x54')],'as':_0xcc6f('0x55'),'where':{'email':_0x540887},'limit':0x1,'order':[[_0xcc6f('0x56'),'DESC']]}]},{'model':db[_0xcc6f('0x57')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xcc6f('0x58')],'as':_0xcc6f('0x58'),'raw':!![]}]}]})['then'](function(_0x382ba5){_0x11af42=_0x382ba5;if(!_0x11af42||!_0x11af42[_0xcc6f('0x59')])return;var _0x41ad15=_0x11af42[_0xcc6f('0x5a')]();if(_0x2a8f05[_0xcc6f('0x4a')][_0xcc6f('0x5b')]&&_0x2a8f05[_0xcc6f('0x4a')][_0xcc6f('0x5b')][_0xcc6f('0x39')]){for(var _0x468fef=0x0;_0x468fef<_0x2a8f05[_0xcc6f('0x4a')][_0xcc6f('0x5b')][_0xcc6f('0x39')];_0x468fef+=0x1){_0x2a8f05[_0xcc6f('0x4a')][_0xcc6f('0x5b')][_0x468fef]={'filename':_0x2a8f05['body'][_0xcc6f('0x5b')][_0x468fef]['name'],'path':path[_0xcc6f('0x5c')](config['root'],_0xcc6f('0x5d'),_0x2a8f05[_0xcc6f('0x4a')][_0xcc6f('0x5b')][_0x468fef][_0xcc6f('0x5e')])};}}_0x4b006f={'account':_0x41ad15,'message':_0x2a8f05['body']};return;})[_0xcc6f('0x14')](function(){if(_0x11af42[_0xcc6f('0x53')]){if(_0x11af42['List'][_0xcc6f('0x55')][_0xcc6f('0x39')]){return _0x11af42[_0xcc6f('0x53')][_0xcc6f('0x55')][0x0];}else{return db[_0xcc6f('0x54')][_0xcc6f('0x4c')](_[_0xcc6f('0xa')](_0x2a8f05[_0xcc6f('0x4a')],{'firstName':_0x2a8f05[_0xcc6f('0x4a')]['to'],'email':_0x2a8f05[_0xcc6f('0x4a')]['to'],'phone':_0x2a8f05[_0xcc6f('0x4a')]['to'],'ListId':_0x11af42[_0xcc6f('0x5f')]}));}}else{throw new Error(_0xcc6f('0x60'));}})[_0xcc6f('0x14')](function(){if(_0x4b006f){return respondWithRpcPromise(_0xcc6f('0x61'),_0xcc6f('0x62'),_0x4b006f,client9003)['then'](function(_0x298a1f){return _0x3cfb5b[_0xcc6f('0x26')]({'read':!![],'messageId':_0x298a1f[_0xcc6f('0x63')],'sentAt':moment()[_0xcc6f('0x64')](_0xcc6f('0x65'))});})[_0xcc6f('0x1e')](function(_0x2a6353){logger[_0xcc6f('0x19')]('%s',JSON['stringify'](_0x2a6353));return _0x3cfb5b;});}return _0x3cfb5b;});}return _0x3cfb5b;}})[_0xcc6f('0x14')](respondWithResult(_0x565ff3,0xc9))[_0xcc6f('0x1e')](handleError(_0x565ff3,null));};exports[_0xcc6f('0x66')]=function(_0xfa239a,_0x280ccd){var _0x25ad97={'agent':{},'channel':_0xcc6f('0x67')};if(_0xfa239a[_0xcc6f('0x4a')]['id']){delete _0xfa239a['body']['id'];}_0xfa239a[_0xcc6f('0x4a')][_0xcc6f('0x68')]=!![];_0xfa239a[_0xcc6f('0x4a')]['readAt']=moment()[_0xcc6f('0x64')](_0xcc6f('0x65'));_0xfa239a[_0xcc6f('0x4a')][_0xcc6f('0x69')]=_0xfa239a['body'][_0xcc6f('0x69')]||_0xfa239a[_0xcc6f('0x6a')]['id'];_0x25ad97[_0xcc6f('0x6b')]['id']=_0xfa239a[_0xcc6f('0x4a')]['UserId'];return db[_0xcc6f('0x2f')][_0xcc6f('0x49')]({'where':{'id':_0xfa239a[_0xcc6f('0x47')]['id'],'UserId':null}})[_0xcc6f('0x14')](handleEntityNotFound(_0x280ccd,null))[_0xcc6f('0x14')](saveUpdates(_0xfa239a[_0xcc6f('0x4a')],null))[_0xcc6f('0x14')](function(_0x378871){if(_0x378871){_0x25ad97[_0xcc6f('0x1b')]=_0x378871['get']({'plain':!![]});return db['MailInteraction'][_0xcc6f('0x49')]({'where':{'id':_0x378871[_0xcc6f('0x6c')]}});}return null;})['then'](handleEntityNotFound(_0x280ccd,null))[_0xcc6f('0x14')](function(_0x460263){if(_0x460263){return _0x460263[_0xcc6f('0x26')]({'UserId':_0xfa239a['body'][_0xcc6f('0x69')],'read1stAt':_[_0xcc6f('0x6d')](_0x460263[_0xcc6f('0x6e')])?moment()['format'](_0xcc6f('0x65')):undefined});}return null;})['then'](function(_0x199d76){if(_0x199d76){_0x25ad97[_0xcc6f('0x6f')]=_0x199d76['get']({'plain':!![]});interaction_log[_0xcc6f('0x1c')](_0xcc6f('0x70'),_0xfa239a[_0xcc6f('0x6a')]['id'],_0xfa239a[_0xcc6f('0x6a')][_0xcc6f('0x2c')],_0xfa239a['user']['role'],_0x25ad97[_0xcc6f('0x6f')]['id'],_0xfa239a['body']?JSON['stringify'](_0xfa239a[_0xcc6f('0x4a')]):_0xcc6f('0x71'));return respondWithRpcPromise(_0xcc6f('0x72'),_0xcc6f('0x73'),_0x25ad97);}return null;})[_0xcc6f('0x14')](function(_0x2bb275){var _0x15f287=_0xcc6f('0x74')+_0x2bb275[_0xcc6f('0x1b')]['ContactId'];return db['sequelize'][_0xcc6f('0x35')](_0x15f287,{'type':db[_0xcc6f('0x75')][_0xcc6f('0x76')][_0xcc6f('0x77')],'raw':!![]})[_0xcc6f('0x14')](function(_0x4f9f58){return _0x4f9f58;});})[_0xcc6f('0x14')](function(_0x562c63){if(_0x562c63){_0x25ad97['message'][_0xcc6f('0x78')]=_0x562c63[0x0];if(!_0xfa239a[_0xcc6f('0x4a')][_0xcc6f('0x69')])return;return db['User'][_0xcc6f('0x49')]({'where':{'id':_0xfa239a[_0xcc6f('0x4a')][_0xcc6f('0x69')],'role':_0xcc6f('0x6b')},'attributes':['id',_0xcc6f('0x2c'),_0xcc6f('0x79'),'email','internal'],'raw':!![]});}return null;})[_0xcc6f('0x14')](function(_0x518b9b){if(!_0x518b9b)return null;_0x25ad97[_0xcc6f('0x1b')]['agent']=_0x518b9b;return _0x25ad97;})[_0xcc6f('0x14')](function(_0x240799){if(_0x240799){if(_0xfa239a[_0xcc6f('0x4a')][_0xcc6f('0x7a')]){_0x25ad97['message']['interface']=util[_0xcc6f('0x64')]('SIP/%s',_0xfa239a[_0xcc6f('0x6a')]['name']);_0x25ad97['message']['channel']=_0x25ad97[_0xcc6f('0x7b')];_0x25ad97[_0xcc6f('0x1b')][_0xcc6f('0x7c')]=_0x25ad97[_0xcc6f('0x7b')];_0x25ad97[_0xcc6f('0x1b')]['event']=_0xcc6f('0x66');_0x25ad97[_0xcc6f('0x1b')][_0xcc6f('0x4a')]=htmlToText[_0xcc6f('0x7d')](_0x25ad97[_0xcc6f('0x1b')][_0xcc6f('0x4a')]);return respondWithRpcPromise(_0xcc6f('0x7e'),_0xcc6f('0x7e'),{'event':'acceptmessage','message':_0x25ad97['message']},client9002)['then'](function(){return _0x25ad97;});}return _0x25ad97;}return null;})['then'](respondWithResult(_0x280ccd,null))[_0xcc6f('0x1e')](handleError(_0x280ccd,null));};exports['reject']=function(_0x410e1e,_0x16cbe1){var _0x491a6d={'agent':{},'channel':'mail'};if(_0x410e1e['body']['id']){delete _0x410e1e[_0xcc6f('0x4a')]['id'];}_0x410e1e[_0xcc6f('0x4a')][_0xcc6f('0x69')]=_0x410e1e[_0xcc6f('0x4a')]['UserId']||_0x410e1e[_0xcc6f('0x6a')]['id'];_0x491a6d[_0xcc6f('0x6b')]['id']=_0x410e1e['body'][_0xcc6f('0x69')];return db['MailMessage'][_0xcc6f('0x49')]({'where':{'id':_0x410e1e[_0xcc6f('0x47')]['id'],'UserId':null}})[_0xcc6f('0x14')](handleEntityNotFound(_0x16cbe1,null))['then'](function(_0x4ffeea){if(_0x4ffeea){_0x491a6d[_0xcc6f('0x1b')]=_0x4ffeea[_0xcc6f('0x7f')]({'plain':!![]});return db[_0xcc6f('0x80')][_0xcc6f('0x49')]({'where':{'id':_0x4ffeea['MailInteractionId']}});}return null;})[_0xcc6f('0x14')](handleEntityNotFound(_0x16cbe1,null))[_0xcc6f('0x14')](function(_0x352a5a){if(_0x352a5a){_0x491a6d[_0xcc6f('0x6f')]=_0x352a5a[_0xcc6f('0x7f')]({'plain':!![]});interaction_log[_0xcc6f('0x1c')](_0xcc6f('0x81'),_0x410e1e[_0xcc6f('0x6a')]['id'],_0x410e1e[_0xcc6f('0x6a')][_0xcc6f('0x2c')],_0x410e1e[_0xcc6f('0x6a')][_0xcc6f('0x82')],_0x491a6d[_0xcc6f('0x6f')]['id'],_0x410e1e[_0xcc6f('0x4a')]?JSON[_0xcc6f('0x83')](_0x410e1e[_0xcc6f('0x4a')]):_0xcc6f('0x71'));return respondWithRpcPromise(_0xcc6f('0x84'),_0xcc6f('0x85'),_0x491a6d);}return null;})[_0xcc6f('0x14')](function(_0x537fc2){var _0x392793=_0xcc6f('0x74')+_0x537fc2[_0xcc6f('0x1b')]['ContactId'];return db['sequelize'][_0xcc6f('0x35')](_0x392793,{'type':db[_0xcc6f('0x75')][_0xcc6f('0x76')][_0xcc6f('0x77')],'raw':!![]})[_0xcc6f('0x14')](function(_0x5bbff2){return _0x5bbff2;});})[_0xcc6f('0x14')](function(_0x635ccb){if(_0x635ccb){_0x491a6d[_0xcc6f('0x1b')][_0xcc6f('0x78')]=_0x635ccb[0x0];if(!_0x410e1e[_0xcc6f('0x4a')][_0xcc6f('0x69')])return;return db[_0xcc6f('0x86')][_0xcc6f('0x49')]({'where':{'id':_0x410e1e[_0xcc6f('0x4a')]['UserId'],'role':'agent'},'attributes':['id',_0xcc6f('0x2c'),'fullname','email',_0xcc6f('0x87')],'raw':!![]});}return null;})[_0xcc6f('0x14')](function(_0x23177a){if(!_0x23177a)return null;_0x491a6d[_0xcc6f('0x1b')]['agent']=_0x23177a;return _0x491a6d;})['then'](function(_0x40f096){if(_0x40f096){_0x40f096['message'][_0xcc6f('0x88')]=util['format'](_0xcc6f('0x89'),_0x410e1e[_0xcc6f('0x6a')][_0xcc6f('0x2c')]);_0x40f096['message'][_0xcc6f('0x7b')]=_0x491a6d[_0xcc6f('0x7b')];_0x40f096[_0xcc6f('0x1b')]['motionChannel']=_0x491a6d[_0xcc6f('0x7b')];_0x40f096[_0xcc6f('0x1b')][_0xcc6f('0x8a')]=_0xcc6f('0x8b');_0x40f096[_0xcc6f('0x1b')][_0xcc6f('0x4a')]=htmlToText['fromString'](_0x491a6d[_0xcc6f('0x1b')]['body']);respondWithRpcPromise('EventManager',_0xcc6f('0x7e'),{'event':_0xcc6f('0x8c'),'message':_0x40f096[_0xcc6f('0x1b')]},client9002);return _0x491a6d;}return null;})['then'](respondWithResult(_0x16cbe1,null))[_0xcc6f('0x1e')](handleError(_0x16cbe1,null));};exports['download']=function(_0x297f5b,_0x2e4eaf){var _0x2dea9b=moment()['unix']()[_0xcc6f('0x8d')]();var _0x30940f=path[_0xcc6f('0x5c')](config[_0xcc6f('0x8e')],_0xcc6f('0x8f'),'files',_0xcc6f('0x90'));var _0x2e9850=path[_0xcc6f('0x5c')](config[_0xcc6f('0x8e')],'server',_0xcc6f('0x91'),'attachments');var _0x11c4a0=util[_0xcc6f('0x64')](_0xcc6f('0x92'),_0x2dea9b);return db[_0xcc6f('0x2f')][_0xcc6f('0x49')]({'where':{'id':_0x297f5b[_0xcc6f('0x47')]['id']},'attributes':['id',_0xcc6f('0x4a'),_0xcc6f('0x93'),'to','cc',_0xcc6f('0x94'),_0xcc6f('0x95'),'createdAt'],'include':_0x297f5b[_0xcc6f('0x35')][_0xcc6f('0x5b')]?[{'model':db[_0xcc6f('0x96')],'as':_0xcc6f('0x97')}]:undefined})[_0xcc6f('0x14')](handleEntityNotFound(_0x2e4eaf,null))['then'](function(_0x48deed){if(_0x48deed){var _0x32940e=_0x48deed;var _0x54b862={'from':_0x32940e['from'],'to':_0x32940e['to'],'subject':_0x32940e[_0xcc6f('0x95')],'html':htmlEntities[_0xcc6f('0x98')](_0x32940e[_0xcc6f('0x4a')]),'headers':{'Date':moment(_0x32940e[_0xcc6f('0x99')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x48deed['cc']){_0x54b862[_0xcc6f('0x9a')]['Cc']=_0x48deed['cc'];}if(_0x48deed['bcc']){_0x54b862[_0xcc6f('0x9a')][_0xcc6f('0x9b')]=_0x48deed['bcc'];}return new BPromise(function(_0x4c8a39,_0x3466c2){if(_0x48deed[_0xcc6f('0x97')]){for(var _0x2459bd=0x0;_0x2459bd<_0x48deed['Attachments'][_0xcc6f('0x39')];_0x2459bd++){var _0x51e1e2=_0x48deed[_0xcc6f('0x97')][_0x2459bd];var _0x50f6a6=path['join'](_0x2e9850,_0x51e1e2[_0xcc6f('0x5e')]);if(fs[_0xcc6f('0x9c')](_0x50f6a6)){_0x54b862[_0xcc6f('0x5b')][_0xcc6f('0x9d')]({'name':_0x51e1e2[_0xcc6f('0x2c')],'contentType':_0x51e1e2[_0xcc6f('0x31')],'data':fs[_0xcc6f('0x9e')](_0x50f6a6)});}}}emlformat[_0xcc6f('0x9f')](_0x54b862,function(_0x1c4320,_0x3d8931){if(_0x1c4320)return _0x3466c2(_0x1c4320);fs[_0xcc6f('0xa0')](path[_0xcc6f('0x5c')](_0x30940f,_0x11c4a0),_0x3d8931);return _0x4c8a39(_0x3d8931);});});}})[_0xcc6f('0x14')](function(_0x50437f){if(_0x50437f){return _0x2e4eaf['download'](path[_0xcc6f('0x5c')](_0x30940f,_0x11c4a0),_0x11c4a0,function(_0x2b5e31){if(!_0x2b5e31)fs[_0xcc6f('0xa1')](path[_0xcc6f('0x5c')](_0x30940f,_0x11c4a0));});}})[_0xcc6f('0x1e')](handleError(_0x2e4eaf,null));}; \ No newline at end of file +var _0x196b=['fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','update','body','find','describe','create','direction','out','secret','split','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','CloudProvider','Smtp','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','format','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','get','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','fromString','EventManager','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','QueryTypes','contact','fullname','rejectmessage','toString','join','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','writeFileSync','download','eml-format','moment','util','ioredis','html-to-text','../../components/parsers/qs','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','limit','count','Content-Range','destroy','end','sendStatus','stack','name','map','MailMessage','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes'];(function(_0x4984ec,_0x30d794){var _0x32b374=function(_0x240d75){while(--_0x240d75){_0x4984ec['push'](_0x4984ec['shift']());}};_0x32b374(++_0x30d794);}(_0x196b,0x19d));var _0xb196=function(_0x4550e3,_0x1148a5){_0x4550e3=_0x4550e3-0x0;var _0x1809f0=_0x196b[_0x4550e3];return _0x1809f0;};'use strict';var emlformat=require(_0xb196('0x0'));var moment=require(_0xb196('0x1'));var BPromise=require('bluebird');var util=require(_0xb196('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0xb196('0x3'));var htmlToText=require(_0xb196('0x4'));var qs=require(_0xb196('0x5'));var logger=require('../../config/logger')('api');var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0xb196('0x6'));var db=require(_0xb196('0x7'))['db'];config['redis']=_[_0xb196('0x8')](config[_0xb196('0x9')],{'host':_0xb196('0xa'),'port':0x18eb});var socket=require(_0xb196('0xb'))(new Redis(config[_0xb196('0x9')]));var htmlEntities=require(_0xb196('0xc'));require(_0xb196('0xd'))[_0xb196('0xe')](socket);var jayson=require(_0xb196('0xf'));var client=jayson[_0xb196('0x10')]['http']({'port':0x232c});var client9003=jayson[_0xb196('0x10')][_0xb196('0x11')]({'port':0x232b});var client9002=jayson[_0xb196('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b5f90,_0x47a133,_0x490bf3,_0x38e307){return new BPromise(function(_0x643cd2,_0x7ffa5d){var _0x3190f4=_0x38e307||client;return _0x3190f4[_0xb196('0x12')](_0x4b5f90,_0x490bf3)[_0xb196('0x13')](function(_0x551a7a){logger[_0xb196('0x14')](_0xb196('0x15'),_0x47a133,'request\x20sent');logger[_0xb196('0x16')](_0xb196('0x17'),_0x47a133,'request\x20sent',JSON[_0xb196('0x18')](_0x551a7a));if(_0x551a7a[_0xb196('0x19')]){if(_0x551a7a['error'][_0xb196('0x1a')]===0x1f4){logger[_0xb196('0x19')]('MailMessage,\x20%s,\x20%s',_0x47a133,_0x551a7a[_0xb196('0x19')][_0xb196('0x1b')]);return _0x7ffa5d(_0x551a7a[_0xb196('0x19')][_0xb196('0x1b')]);}logger[_0xb196('0x19')](_0xb196('0x15'),_0x47a133,_0x551a7a[_0xb196('0x19')][_0xb196('0x1b')]);return _0x643cd2(_0x551a7a['error'][_0xb196('0x1b')]);}else{logger['info'](_0xb196('0x15'),_0x47a133,'request\x20sent');_0x643cd2(_0x551a7a[_0xb196('0x1c')][_0xb196('0x1b')]);}})[_0xb196('0x1d')](function(_0x42191b){logger[_0xb196('0x19')](_0xb196('0x15'),_0x47a133,_0x42191b);_0x7ffa5d(_0x42191b);});});}function respondWithResult(_0x46c06b,_0x1e2b8e){_0x1e2b8e=_0x1e2b8e||0xc8;return function(_0xb0f67c){if(_0xb0f67c){return _0x46c06b[_0xb196('0x1e')](_0x1e2b8e)[_0xb196('0x1f')](_0xb0f67c);}};}function respondWithFilteredResult(_0x45332c,_0x4d3526){return function(_0x111635){if(_0x111635){var _0x547346=typeof _0x4d3526[_0xb196('0x20')]==='undefined'&&typeof _0x4d3526[_0xb196('0x21')]==='undefined';var _0x289a27=_0x111635[_0xb196('0x22')];var _0x3de198=_0x547346?0x0:_0x4d3526[_0xb196('0x20')];var _0x4c366c=_0x547346?_0x111635[_0xb196('0x22')]:_0x4d3526[_0xb196('0x20')]+_0x4d3526['limit'];var _0x4e3827;if(_0x4c366c>=_0x289a27){_0x4c366c=_0x289a27;_0x4e3827=0xc8;}else{_0x4e3827=0xce;}_0x45332c[_0xb196('0x1e')](_0x4e3827);return _0x45332c['set'](_0xb196('0x23'),_0x3de198+'-'+_0x4c366c+'/'+_0x289a27)[_0xb196('0x1f')](_0x111635);}return null;};}function saveUpdates(_0x5fae30){return function(_0x13f2aa){if(_0x13f2aa){return _0x13f2aa['update'](_0x5fae30)[_0xb196('0x13')](function(_0x5b5f7c){return _0x5b5f7c;});}return null;};}function removeEntity(_0xd88461){return function(_0x5ae031){if(_0x5ae031){return _0x5ae031[_0xb196('0x24')]()[_0xb196('0x13')](function(){_0xd88461[_0xb196('0x1e')](0xcc)[_0xb196('0x25')]();});}};}function handleEntityNotFound(_0x518cb2){return function(_0x3b307d){if(!_0x3b307d){_0x518cb2[_0xb196('0x26')](0x194);}return _0x3b307d;};}function handleError(_0x595a2c,_0xf1cb0d){_0xf1cb0d=_0xf1cb0d||0x1f4;return function(_0x2895c2){logger[_0xb196('0x19')](_0x2895c2[_0xb196('0x27')]);if(_0x2895c2['name']){delete _0x2895c2[_0xb196('0x28')];}_0x595a2c['status'](_0xf1cb0d)['send'](_0x2895c2);};}exports['index']=function(_0x5e3c77,_0x55fb2f){var _0x12f6a3={},_0x173652={},_0xcd6f27={'count':0x0,'rows':[]};var _0x36d835=_[_0xb196('0x29')](db[_0xb196('0x2a')][_0xb196('0x2b')],function(_0x39f2d0){return{'name':_0x39f2d0[_0xb196('0x2c')],'type':_0x39f2d0[_0xb196('0x2d')]['key']};});_0x173652['model']=_[_0xb196('0x29')](_0x36d835,'name');_0x173652[_0xb196('0x2e')]=_[_0xb196('0x2f')](_0x5e3c77['query']);_0x173652[_0xb196('0x30')]=_[_0xb196('0x31')](_0x173652[_0xb196('0x32')],_0x173652[_0xb196('0x2e')]);_0x12f6a3[_0xb196('0x33')]=_[_0xb196('0x31')](_0x173652[_0xb196('0x32')],qs[_0xb196('0x34')](_0x5e3c77[_0xb196('0x2e')][_0xb196('0x34')]));_0x12f6a3['attributes']=_0x12f6a3['attributes'][_0xb196('0x35')]?_0x12f6a3['attributes']:_0x173652['model'];if(!_0x5e3c77[_0xb196('0x2e')][_0xb196('0x36')](_0xb196('0x37'))){_0x12f6a3[_0xb196('0x21')]=qs['limit'](_0x5e3c77['query'][_0xb196('0x21')]);_0x12f6a3['offset']=qs['offset'](_0x5e3c77['query'][_0xb196('0x20')]);}_0x12f6a3['order']=qs['sort'](_0x5e3c77[_0xb196('0x2e')][_0xb196('0x38')]);_0x12f6a3[_0xb196('0x39')]=qs[_0xb196('0x30')](_['pick'](_0x5e3c77[_0xb196('0x2e')],_0x173652['filters']),_0x36d835);if(_0x5e3c77[_0xb196('0x2e')][_0xb196('0x3a')]){_0x12f6a3['where']=_[_0xb196('0x3b')](_0x12f6a3[_0xb196('0x39')],{'$or':_[_0xb196('0x29')](_0x36d835,function(_0x499ed0){if(_0x499ed0[_0xb196('0x2d')]!=='VIRTUAL'){var _0x38227c={};_0x38227c[_0x499ed0[_0xb196('0x28')]]={'$like':'%'+_0x5e3c77[_0xb196('0x2e')][_0xb196('0x3a')]+'%'};return _0x38227c;}})});}_0x12f6a3=_[_0xb196('0x3b')]({},_0x12f6a3,_0x5e3c77[_0xb196('0x3c')]);var _0x557556={'where':_0x12f6a3[_0xb196('0x39')]};return db[_0xb196('0x2a')][_0xb196('0x22')](_0x557556)[_0xb196('0x13')](function(_0x2014ea){_0xcd6f27[_0xb196('0x22')]=_0x2014ea;if(_0x5e3c77[_0xb196('0x2e')][_0xb196('0x3d')]){_0x12f6a3[_0xb196('0x3e')]=[{'all':!![]}];}return db[_0xb196('0x2a')][_0xb196('0x3f')](_0x12f6a3);})[_0xb196('0x13')](function(_0x5b62b7){_0xcd6f27[_0xb196('0x40')]=_0x5b62b7;return _0xcd6f27;})[_0xb196('0x13')](respondWithFilteredResult(_0x55fb2f,_0x12f6a3))[_0xb196('0x1d')](handleError(_0x55fb2f,null));};exports[_0xb196('0x41')]=function(_0x107afe,_0x1da9c5){var _0x4948cc={'raw':!![],'where':{'id':_0x107afe[_0xb196('0x42')]['id']}},_0x56d16a={};_0x56d16a[_0xb196('0x32')]=_[_0xb196('0x2f')](db[_0xb196('0x2a')]['rawAttributes']);_0x56d16a[_0xb196('0x2e')]=_[_0xb196('0x2f')](_0x107afe['query']);_0x56d16a[_0xb196('0x30')]=_['intersection'](_0x56d16a[_0xb196('0x32')],_0x56d16a[_0xb196('0x2e')]);_0x4948cc['attributes']=_['intersection'](_0x56d16a[_0xb196('0x32')],qs[_0xb196('0x34')](_0x107afe[_0xb196('0x2e')][_0xb196('0x34')]));_0x4948cc['attributes']=_0x4948cc[_0xb196('0x33')][_0xb196('0x35')]?_0x4948cc[_0xb196('0x33')]:_0x56d16a[_0xb196('0x32')];if(_0x107afe[_0xb196('0x2e')]['includeAll']){_0x4948cc[_0xb196('0x3e')]=[{'all':!![]}];}_0x4948cc=_[_0xb196('0x3b')]({},_0x4948cc,_0x107afe['options']);return db['MailMessage']['find'](_0x4948cc)[_0xb196('0x13')](handleEntityNotFound(_0x1da9c5,null))[_0xb196('0x13')](respondWithResult(_0x1da9c5,null))[_0xb196('0x1d')](handleError(_0x1da9c5,null));};exports[_0xb196('0x43')]=function(_0x4c9c2f,_0x56d90d){if(_0x4c9c2f[_0xb196('0x44')]['id']){delete _0x4c9c2f[_0xb196('0x44')]['id'];}return db[_0xb196('0x2a')][_0xb196('0x45')]({'where':{'id':_0x4c9c2f[_0xb196('0x42')]['id']}})['then'](handleEntityNotFound(_0x56d90d,null))['then'](saveUpdates(_0x4c9c2f[_0xb196('0x44')],null))['then'](respondWithResult(_0x56d90d,null))[_0xb196('0x1d')](handleError(_0x56d90d,null));};exports[_0xb196('0x24')]=function(_0x4ba47b,_0x447d67){return db['MailMessage']['find']({'where':{'id':_0x4ba47b[_0xb196('0x42')]['id']}})[_0xb196('0x13')](handleEntityNotFound(_0x447d67,null))['then'](removeEntity(_0x447d67,null))[_0xb196('0x1d')](handleError(_0x447d67,null));};exports[_0xb196('0x46')]=function(_0x3877c2,_0x5d8b9e){return db[_0xb196('0x2a')]['describe']()[_0xb196('0x13')](respondWithResult(_0x5d8b9e,null))[_0xb196('0x1d')](handleError(_0x5d8b9e,null));};exports[_0xb196('0x47')]=function(_0x127679,_0x240dc7){return db['MailMessage'][_0xb196('0x47')](_0x127679[_0xb196('0x44')])[_0xb196('0x13')](function(_0x42bbbb){if(_0x42bbbb){if(_0x42bbbb[_0xb196('0x48')]===_0xb196('0x49')&&!_0x42bbbb[_0xb196('0x4a')]){var _0x45cc61,_0x4a9cdb,_0x4437e8;if(_0x127679[_0xb196('0x44')]['to']){_0x4a9cdb=_0x127679['body']['to'][_0xb196('0x4b')](',')[0x0];}return db['MailAccount'][_0xb196('0x4c')]({'where':{'id':_0x42bbbb[_0xb196('0x4d')]},'include':[{'model':db[_0xb196('0x4e')],'as':_0xb196('0x4f'),'include':[{'model':db[_0xb196('0x50')],'as':_0xb196('0x51'),'where':{'email':_0x4a9cdb},'limit':0x1,'order':[[_0xb196('0x52'),'DESC']]}]},{'model':db[_0xb196('0x53')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xb196('0x54')],'as':_0xb196('0x54'),'raw':!![]}]}]})[_0xb196('0x13')](function(_0x382c02){_0x45cc61=_0x382c02;if(!_0x45cc61||!_0x45cc61[_0xb196('0x55')])return;var _0x4faa04=_0x45cc61['getSmtpOptions']();if(_0x127679[_0xb196('0x44')]['attachments']&&_0x127679[_0xb196('0x44')][_0xb196('0x56')]['length']){for(var _0x2ab067=0x0;_0x2ab067<_0x127679[_0xb196('0x44')]['attachments'][_0xb196('0x35')];_0x2ab067+=0x1){_0x127679[_0xb196('0x44')][_0xb196('0x56')][_0x2ab067]={'filename':_0x127679[_0xb196('0x44')][_0xb196('0x56')][_0x2ab067][_0xb196('0x28')],'path':path['join'](config[_0xb196('0x57')],_0xb196('0x58'),_0x127679[_0xb196('0x44')]['attachments'][_0x2ab067][_0xb196('0x59')])};}}_0x4437e8={'account':_0x4faa04,'message':_0x127679[_0xb196('0x44')]};return;})[_0xb196('0x13')](function(){if(_0x45cc61['List']){if(_0x45cc61['List'][_0xb196('0x51')][_0xb196('0x35')]){return _0x45cc61[_0xb196('0x4f')][_0xb196('0x51')][0x0];}else{return db[_0xb196('0x50')]['create'](_[_0xb196('0x8')](_0x127679['body'],{'firstName':_0x127679[_0xb196('0x44')]['to'],'email':_0x127679[_0xb196('0x44')]['to'],'phone':_0x127679[_0xb196('0x44')]['to'],'ListId':_0x45cc61[_0xb196('0x5a')]}));}}else{throw new Error(_0xb196('0x5b'));}})[_0xb196('0x13')](function(){if(_0x4437e8){return respondWithRpcPromise(_0xb196('0x5c'),_0xb196('0x5d'),_0x4437e8,client9003)[_0xb196('0x13')](function(_0x2fc822){return _0x42bbbb['update']({'read':!![],'messageId':_0x2fc822['messageId'],'sentAt':moment()[_0xb196('0x5e')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xb196('0x1d')](function(_0x4e8989){logger['error']('%s',JSON[_0xb196('0x18')](_0x4e8989));return _0x42bbbb;});}return _0x42bbbb;});}return _0x42bbbb;}})['then'](respondWithResult(_0x240dc7,0xc9))['catch'](handleError(_0x240dc7,null));};exports['accept']=function(_0x38b23a,_0x28845b){var _0x48ab35={'agent':{},'channel':'mail'};if(_0x38b23a[_0xb196('0x44')]['id']){delete _0x38b23a['body']['id'];}_0x38b23a[_0xb196('0x44')][_0xb196('0x5f')]=!![];_0x38b23a[_0xb196('0x44')]['readAt']=moment()[_0xb196('0x5e')](_0xb196('0x60'));_0x38b23a[_0xb196('0x44')][_0xb196('0x61')]=_0x38b23a[_0xb196('0x44')][_0xb196('0x61')]||_0x38b23a[_0xb196('0x62')]['id'];_0x48ab35[_0xb196('0x63')]['id']=_0x38b23a[_0xb196('0x44')][_0xb196('0x61')];return db['MailMessage'][_0xb196('0x45')]({'where':{'id':_0x38b23a[_0xb196('0x42')]['id'],'UserId':null}})[_0xb196('0x13')](handleEntityNotFound(_0x28845b,null))['then'](saveUpdates(_0x38b23a['body'],null))['then'](function(_0x9a27cd){if(_0x9a27cd){_0x48ab35[_0xb196('0x1b')]=_0x9a27cd['get']({'plain':!![]});return db[_0xb196('0x64')][_0xb196('0x45')]({'where':{'id':_0x9a27cd[_0xb196('0x65')]}});}return null;})[_0xb196('0x13')](handleEntityNotFound(_0x28845b,null))[_0xb196('0x13')](function(_0x11b67a){if(_0x11b67a){return _0x11b67a[_0xb196('0x43')]({'UserId':_0x38b23a[_0xb196('0x44')][_0xb196('0x61')],'read1stAt':_[_0xb196('0x66')](_0x11b67a[_0xb196('0x67')])?moment()[_0xb196('0x5e')](_0xb196('0x60')):undefined});}return null;})['then'](function(_0x296b8e){if(_0x296b8e){_0x48ab35[_0xb196('0x68')]=_0x296b8e[_0xb196('0x69')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x38b23a[_0xb196('0x62')]['id'],_0x38b23a['user'][_0xb196('0x28')],_0x38b23a['user'][_0xb196('0x6a')],_0x48ab35['interaction']['id'],_0x38b23a[_0xb196('0x44')]?JSON[_0xb196('0x18')](_0x38b23a['body']):_0xb196('0x6b'));return respondWithRpcPromise(_0xb196('0x6c'),_0xb196('0x6d'),_0x48ab35);}return null;})[_0xb196('0x13')](function(_0x106e13){var _0x13d6e5=_0xb196('0x6e')+_0x106e13[_0xb196('0x1b')][_0xb196('0x6f')];return db[_0xb196('0x70')]['query'](_0x13d6e5,{'type':db[_0xb196('0x71')]['QueryTypes'][_0xb196('0x72')],'raw':!![]})[_0xb196('0x13')](function(_0x4b3904){return _0x4b3904;});})[_0xb196('0x13')](function(_0x1e4640){if(_0x1e4640){_0x48ab35[_0xb196('0x1b')]['contact']=_0x1e4640[0x0];if(!_0x38b23a[_0xb196('0x44')]['UserId'])return;return db[_0xb196('0x73')][_0xb196('0x45')]({'where':{'id':_0x38b23a['body'][_0xb196('0x61')],'role':_0xb196('0x63')},'attributes':['id',_0xb196('0x28'),'fullname',_0xb196('0x74'),_0xb196('0x75')],'raw':!![]});}return null;})[_0xb196('0x13')](function(_0x47a2ae){if(!_0x47a2ae)return null;_0x48ab35[_0xb196('0x1b')][_0xb196('0x63')]=_0x47a2ae;return _0x48ab35;})['then'](function(_0x3543aa){if(_0x3543aa){if(_0x38b23a[_0xb196('0x44')][_0xb196('0x76')]){_0x48ab35['message'][_0xb196('0x77')]=util[_0xb196('0x5e')](_0xb196('0x78'),_0x38b23a[_0xb196('0x62')][_0xb196('0x28')]);_0x48ab35['message'][_0xb196('0x79')]=_0x48ab35['channel'];_0x48ab35[_0xb196('0x1b')][_0xb196('0x7a')]=_0x48ab35[_0xb196('0x79')];_0x48ab35[_0xb196('0x1b')][_0xb196('0x7b')]=_0xb196('0x7c');_0x48ab35[_0xb196('0x1b')][_0xb196('0x44')]=htmlToText[_0xb196('0x7d')](_0x48ab35['message']['body']);return respondWithRpcPromise('EventManager',_0xb196('0x7e'),{'event':_0xb196('0x7f'),'message':_0x48ab35[_0xb196('0x1b')]},client9002)[_0xb196('0x13')](function(){return _0x48ab35;});}return _0x48ab35;}return null;})[_0xb196('0x13')](respondWithResult(_0x28845b,null))['catch'](handleError(_0x28845b,null));};exports[_0xb196('0x80')]=function(_0x4d49ba,_0x2f963d){var _0x3f2f3a={'agent':{},'channel':_0xb196('0x81')};if(_0x4d49ba['body']['id']){delete _0x4d49ba[_0xb196('0x44')]['id'];}_0x4d49ba['body']['UserId']=_0x4d49ba['body']['UserId']||_0x4d49ba[_0xb196('0x62')]['id'];_0x3f2f3a[_0xb196('0x63')]['id']=_0x4d49ba[_0xb196('0x44')][_0xb196('0x61')];return db[_0xb196('0x2a')][_0xb196('0x45')]({'where':{'id':_0x4d49ba[_0xb196('0x42')]['id'],'UserId':null}})[_0xb196('0x13')](handleEntityNotFound(_0x2f963d,null))[_0xb196('0x13')](function(_0x383b53){if(_0x383b53){_0x3f2f3a[_0xb196('0x1b')]=_0x383b53[_0xb196('0x69')]({'plain':!![]});return db[_0xb196('0x64')]['find']({'where':{'id':_0x383b53[_0xb196('0x65')]}});}return null;})[_0xb196('0x13')](handleEntityNotFound(_0x2f963d,null))['then'](function(_0x961d74){if(_0x961d74){_0x3f2f3a['interaction']=_0x961d74[_0xb196('0x69')]({'plain':!![]});interaction_log[_0xb196('0x14')](_0xb196('0x82'),_0x4d49ba[_0xb196('0x62')]['id'],_0x4d49ba[_0xb196('0x62')]['name'],_0x4d49ba['user'][_0xb196('0x6a')],_0x3f2f3a[_0xb196('0x68')]['id'],_0x4d49ba[_0xb196('0x44')]?JSON['stringify'](_0x4d49ba[_0xb196('0x44')]):_0xb196('0x6b'));return respondWithRpcPromise(_0xb196('0x83'),'rejectMessage',_0x3f2f3a);}return null;})[_0xb196('0x13')](function(_0x2a7acf){var _0x47ae09=_0xb196('0x6e')+_0x2a7acf[_0xb196('0x1b')][_0xb196('0x6f')];return db[_0xb196('0x70')][_0xb196('0x2e')](_0x47ae09,{'type':db['Sequelize'][_0xb196('0x84')][_0xb196('0x72')],'raw':!![]})[_0xb196('0x13')](function(_0x18a316){return _0x18a316;});})[_0xb196('0x13')](function(_0x3e70ad){if(_0x3e70ad){_0x3f2f3a[_0xb196('0x1b')][_0xb196('0x85')]=_0x3e70ad[0x0];if(!_0x4d49ba[_0xb196('0x44')][_0xb196('0x61')])return;return db[_0xb196('0x73')][_0xb196('0x45')]({'where':{'id':_0x4d49ba['body'][_0xb196('0x61')],'role':_0xb196('0x63')},'attributes':['id',_0xb196('0x28'),_0xb196('0x86'),_0xb196('0x74'),_0xb196('0x75')],'raw':!![]});}return null;})['then'](function(_0x46c016){if(!_0x46c016)return null;_0x3f2f3a['message']['agent']=_0x46c016;return _0x3f2f3a;})['then'](function(_0x32cae3){if(_0x32cae3){_0x32cae3[_0xb196('0x1b')][_0xb196('0x77')]=util[_0xb196('0x5e')](_0xb196('0x78'),_0x4d49ba[_0xb196('0x62')][_0xb196('0x28')]);_0x32cae3['message']['channel']=_0x3f2f3a['channel'];_0x32cae3[_0xb196('0x1b')]['motionChannel']=_0x3f2f3a[_0xb196('0x79')];_0x32cae3[_0xb196('0x1b')]['event']=_0xb196('0x80');_0x32cae3[_0xb196('0x1b')]['body']=htmlToText[_0xb196('0x7d')](_0x3f2f3a[_0xb196('0x1b')]['body']);respondWithRpcPromise(_0xb196('0x7e'),_0xb196('0x7e'),{'event':_0xb196('0x87'),'message':_0x32cae3[_0xb196('0x1b')]},client9002);return _0x3f2f3a;}return null;})[_0xb196('0x13')](respondWithResult(_0x2f963d,null))['catch'](handleError(_0x2f963d,null));};exports['download']=function(_0x5223c7,_0x4affb2){var _0x2aad4f=moment()['unix']()[_0xb196('0x88')]();var _0x16c70b=path[_0xb196('0x89')](config['root'],_0xb196('0x8a'),_0xb196('0x8b'),_0xb196('0x8c'));var _0x1d7944=path[_0xb196('0x89')](config[_0xb196('0x57')],_0xb196('0x8a'),_0xb196('0x8b'),_0xb196('0x56'));var _0xf29a45=util[_0xb196('0x5e')](_0xb196('0x8d'),_0x2aad4f);return db[_0xb196('0x2a')][_0xb196('0x45')]({'where':{'id':_0x5223c7[_0xb196('0x42')]['id']},'attributes':['id',_0xb196('0x44'),_0xb196('0x8e'),'to','cc',_0xb196('0x8f'),_0xb196('0x90'),_0xb196('0x91')],'include':_0x5223c7['query']['attachments']?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x4affb2,null))[_0xb196('0x13')](function(_0x5d0b0f){if(_0x5d0b0f){var _0x1f45c2=_0x5d0b0f;var _0x95843d={'from':_0x1f45c2[_0xb196('0x8e')],'to':_0x1f45c2['to'],'subject':_0x1f45c2['subject'],'html':htmlEntities[_0xb196('0x92')](_0x1f45c2[_0xb196('0x44')]),'headers':{'Date':moment(_0x1f45c2[_0xb196('0x91')])['format'](_0xb196('0x93'))},'attachments':[]};if(_0x5d0b0f['cc']){_0x95843d[_0xb196('0x94')]['Cc']=_0x5d0b0f['cc'];}if(_0x5d0b0f[_0xb196('0x8f')]){_0x95843d[_0xb196('0x94')][_0xb196('0x95')]=_0x5d0b0f[_0xb196('0x8f')];}return new BPromise(function(_0x1d0a75,_0x41fd75){if(_0x5d0b0f['Attachments']){for(var _0x932c45=0x0;_0x932c45<_0x5d0b0f['Attachments']['length'];_0x932c45++){var _0x1524e5=_0x5d0b0f['Attachments'][_0x932c45];var _0x4896c7=path[_0xb196('0x89')](_0x1d7944,_0x1524e5[_0xb196('0x59')]);if(fs[_0xb196('0x96')](_0x4896c7)){_0x95843d[_0xb196('0x56')][_0xb196('0x97')]({'name':_0x1524e5[_0xb196('0x28')],'contentType':_0x1524e5[_0xb196('0x2d')],'data':fs[_0xb196('0x98')](_0x4896c7)});}}}emlformat['build'](_0x95843d,function(_0x490c1d,_0x254dfe){if(_0x490c1d)return _0x41fd75(_0x490c1d);fs[_0xb196('0x99')](path[_0xb196('0x89')](_0x16c70b,_0xf29a45),_0x254dfe);return _0x1d0a75(_0x254dfe);});});}})[_0xb196('0x13')](function(_0x3848de){if(_0x3848de){return _0x4affb2[_0xb196('0x9a')](path[_0xb196('0x89')](_0x16c70b,_0xf29a45),_0xf29a45,function(_0x10238f){if(!_0x10238f)fs['unlinkSync'](path[_0xb196('0x89')](_0x16c70b,_0xf29a45));});}})[_0xb196('0x1d')](handleError(_0x4affb2,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 705d180..676c378 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 _0xfbea=['update','remove','emit','hook','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x31bdd0,_0x2d2571){var _0x246911=function(_0x3e4537){while(--_0x3e4537){_0x31bdd0['push'](_0x31bdd0['shift']());}};_0x246911(++_0x2d2571);}(_0xfbea,0x1ab));var _0xafbe=function(_0x423a50,_0x270505){_0x423a50=_0x423a50-0x0;var _0x1a8529=_0xfbea[_0x423a50];return _0x1a8529;};'use strict';var EventEmitter=require(_0xafbe('0x0'));var MailMessage=require(_0xafbe('0x1'))['db'][_0xafbe('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xafbe('0x3')](0x0);var events={'afterCreate':_0xafbe('0x4'),'afterUpdate':_0xafbe('0x5'),'afterDestroy':_0xafbe('0x6')};function emitEvent(_0x19f48d){return function(_0x1777e6,_0x2937c1,_0x26481c){MailMessageEvents[_0xafbe('0x7')](_0x19f48d+':'+_0x1777e6['id'],_0x1777e6);MailMessageEvents[_0xafbe('0x7')](_0x19f48d,_0x1777e6);_0x26481c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xafbe('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xdefa=['hasOwnProperty','hook','events','../../mysqldb','MailMessage','setMaxListeners','save','emit'];(function(_0x46fe6a,_0x58ff06){var _0x58cb14=function(_0x217dc0){while(--_0x217dc0){_0x46fe6a['push'](_0x46fe6a['shift']());}};_0x58cb14(++_0x58ff06);}(_0xdefa,0xfa));var _0xadef=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdefa[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xadef('0x0'));var MailMessage=require(_0xadef('0x1'))['db'][_0xadef('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xadef('0x3')](0x0);var events={'afterCreate':_0xadef('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4ce7c3){return function(_0x97d280,_0x294607,_0x5dbe11){MailMessageEvents[_0xadef('0x5')](_0x4ce7c3+':'+_0x97d280['id'],_0x97d280);MailMessageEvents[_0xadef('0x5')](_0x4ce7c3,_0x97d280);_0x5dbe11(null);};}for(var e in events){if(events[_0xadef('0x6')](e)){var event=events[e];MailMessage[_0xadef('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index c1a4b5a..6a9ca55 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 _0xaf05=['createdAt','error','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./mailMessage.attributes','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','fromString','body','models','direction','toLowerCase','out','isNil','MailInteraction','findOne','MailInteractionId','then','update'];(function(_0x27c244,_0x199693){var _0x34d7f0=function(_0xd4f919){while(--_0xd4f919){_0x27c244['push'](_0x27c244['shift']());}};_0x34d7f0(++_0x199693);}(_0xaf05,0x7b));var _0x5af0=function(_0x57748e,_0x458650){_0x57748e=_0x57748e-0x0;var _0x140b95=_0xaf05[_0x57748e];return _0x140b95;};'use strict';var _=require(_0x5af0('0x0'));var util=require(_0x5af0('0x1'));var logger=require('../../config/logger')(_0x5af0('0x2'));var moment=require(_0x5af0('0x3'));var BPromise=require(_0x5af0('0x4'));var rp=require(_0x5af0('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x5af0('0x6'));var rimraf=require(_0x5af0('0x7'));var config=require('../../config/environment');var attributes=require(_0x5af0('0x8'));module['exports']=function(_0x19b65b,_0x5ef7a7){return _0x19b65b[_0x5af0('0x9')]('MailMessage',attributes,{'tableName':_0x5af0('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x5af0('0xb')]},{'name':_0x5af0('0xc'),'fields':[_0x5af0('0xd'),_0x5af0('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4d41cf,_0xefa67a,_0x1a2fe5){if(_0x4d41cf['body']){_0x4d41cf[_0x5af0('0xd')]=htmlToText[_0x5af0('0xf')](_0x4d41cf[_0x5af0('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1a2fe5(null,_0xefa67a);},'afterCreate':function(_0x5d2f22,_0x3d2ca7,_0x1cf99c){var _0x43205d=_0x19b65b[_0x5af0('0x11')];var _0x5ccc93=_0x5d2f22['get']({'plain':!![]});if(_0x5ccc93[_0x5af0('0x12')][_0x5af0('0x13')]()==='in'||_0x5ccc93[_0x5af0('0x12')]['toLowerCase']()===_0x5af0('0x14')&&!_0x5ccc93['secret']&&!_[_0x5af0('0x15')](_0x5ccc93['UserId'])){_0x43205d[_0x5af0('0x16')][_0x5af0('0x17')]({'where':{'id':_0x5ccc93[_0x5af0('0x18')]}})[_0x5af0('0x19')](function(_0x5181a1){if(_0x5181a1){_0x5181a1[_0x5af0('0x1a')]({'lastMsgAt':_0x5ccc93[_0x5af0('0x1b')],'lastMsgDirection':_0x5ccc93[_0x5af0('0x12')][_0x5af0('0x13')]()});}})['catch'](function(_0x4fa4e8){console[_0x5af0('0x1c')](_0x4fa4e8);});}_0x1cf99c();}},'charset':'utf8mb4','collate':_0x5af0('0x1d')});}; \ No newline at end of file +var _0x0663=['moment','request-promise','html-to-text','path','rimraf','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','FULLTEXT','body','plainBody','fromString','models','direction','toLowerCase','secret','isNil','MailInteraction','findOne','MailInteractionId','createdAt','error','utf8mb4','util'];(function(_0x319268,_0x26a823){var _0x495e1c=function(_0x52b918){while(--_0x52b918){_0x319268['push'](_0x319268['shift']());}};_0x495e1c(++_0x26a823);}(_0x0663,0x1ca));var _0x3066=function(_0x14afc6,_0x5d4fc8){_0x14afc6=_0x14afc6-0x0;var _0x51a04c=_0x0663[_0x14afc6];return _0x51a04c;};'use strict';var _=require('lodash');var util=require(_0x3066('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3066('0x1'));var BPromise=require('bluebird');var rp=require(_0x3066('0x2'));var htmlToText=require(_0x3066('0x3'));var fs=require('fs');var path=require(_0x3066('0x4'));var rimraf=require(_0x3066('0x5'));var config=require('../../config/environment');var attributes=require(_0x3066('0x6'));module[_0x3066('0x7')]=function(_0x214580,_0xffecaa){return _0x214580['define'](_0x3066('0x8'),attributes,{'tableName':_0x3066('0x9'),'paranoid':![],'indexes':[{'name':_0x3066('0xa'),'fields':[_0x3066('0xa')]},{'name':_0x3066('0xb'),'fields':['plainBody','subject'],'type':_0x3066('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5d46ef,_0x13e9a8,_0x4932d9){if(_0x5d46ef[_0x3066('0xd')]){_0x5d46ef[_0x3066('0xe')]=htmlToText[_0x3066('0xf')](_0x5d46ef[_0x3066('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4932d9(null,_0x13e9a8);},'afterCreate':function(_0x51008f,_0x81f061,_0x54c056){var _0xa3e8dc=_0x214580[_0x3066('0x10')];var _0x289a1c=_0x51008f['get']({'plain':!![]});if(_0x289a1c[_0x3066('0x11')][_0x3066('0x12')]()==='in'||_0x289a1c[_0x3066('0x11')][_0x3066('0x12')]()==='out'&&!_0x289a1c[_0x3066('0x13')]&&!_[_0x3066('0x14')](_0x289a1c['UserId'])){_0xa3e8dc[_0x3066('0x15')][_0x3066('0x16')]({'where':{'id':_0x289a1c[_0x3066('0x17')]}})['then'](function(_0x23d5fb){if(_0x23d5fb){_0x23d5fb['update']({'lastMsgAt':_0x289a1c[_0x3066('0x18')],'lastMsgDirection':_0x289a1c[_0x3066('0x11')][_0x3066('0x12')]()});}})['catch'](function(_0xc4b9ea){console[_0x3066('0x19')](_0xc4b9ea);});}_0x54c056();}},'charset':_0x3066('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index e16ff28..d694e8b 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 _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','body'];(function(_0x53abe2,_0xf37010){var _0x4cdfb9=function(_0x560b38){while(--_0x560b38){_0x53abe2['push'](_0x53abe2['shift']());}};_0x4cdfb9(++_0xf37010);}(_0xb10b,0x12a));var _0xbb10=function(_0x257841,_0x389b4d){_0x257841=_0x257841-0x0;var _0x1b87ed=_0xb10b[_0x257841];return _0x1b87ed;};'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});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('MailMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('MailMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file +var _0xa30a=['then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','MailMessage','create','body','options','raw','CreateMailMessage','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./mailMessage.socket','register'];(function(_0x3ff2f9,_0x544ba1){var _0x3b0913=function(_0x554288){while(--_0x554288){_0x3ff2f9['push'](_0x3ff2f9['shift']());}};_0x3b0913(++_0x544ba1);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x3'));var fs=require('fs');var Redis=require(_0xaa30('0x4'));var db=require(_0xaa30('0x5'))['db'];var utils=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));var config=require(_0xaa30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa30('0xa')]['http']({'port':0x232a});config[_0xaa30('0xb')]=_[_0xaa30('0xc')](config[_0xaa30('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa30('0xd'))(new Redis(config[_0xaa30('0xb')]));require(_0xaa30('0xe'))[_0xaa30('0xf')](socket);function respondWithRpcPromise(_0x14a6a6,_0x45419f,_0x56f686){return new BPromise(function(_0x5afbf5,_0x12a8ce){return client['request'](_0x14a6a6,_0x56f686)[_0xaa30('0x10')](function(_0x1a5681){logger[_0xaa30('0x11')](_0xaa30('0x12'),_0x45419f,'request\x20sent');logger[_0xaa30('0x13')](_0xaa30('0x14'),_0x45419f,_0xaa30('0x15'),JSON['stringify'](_0x1a5681));if(_0x1a5681[_0xaa30('0x16')]){if(_0x1a5681[_0xaa30('0x16')][_0xaa30('0x17')]===0x1f4){logger[_0xaa30('0x16')](_0xaa30('0x12'),_0x45419f,_0x1a5681[_0xaa30('0x16')][_0xaa30('0x18')]);return _0x12a8ce(_0x1a5681[_0xaa30('0x16')][_0xaa30('0x18')]);}logger[_0xaa30('0x16')]('MailMessage,\x20%s,\x20%s',_0x45419f,_0x1a5681[_0xaa30('0x16')]['message']);return _0x5afbf5(_0x1a5681['error'][_0xaa30('0x18')]);}else{logger[_0xaa30('0x11')](_0xaa30('0x12'),_0x45419f,'request\x20sent');_0x5afbf5(_0x1a5681['result']['message']);}})[_0xaa30('0x19')](function(_0x4acdfa){logger[_0xaa30('0x16')](_0xaa30('0x12'),_0x45419f,_0x4acdfa);_0x12a8ce(_0x4acdfa);});});}exports['CreateMailMessage']=function(_0x4e29f9){var _0x520abb=this;return new Promise(function(_0x3cbf92,_0x3e4f1d){return db[_0xaa30('0x1a')][_0xaa30('0x1b')](_0x4e29f9[_0xaa30('0x1c')],{'raw':_0x4e29f9['options']?_0x4e29f9[_0xaa30('0x1d')][_0xaa30('0x1e')]===undefined?!![]:![]:!![]})[_0xaa30('0x10')](function(_0x2d9e35){logger[_0xaa30('0x11')]('CreateMailMessage',_0x4e29f9);logger[_0xaa30('0x13')](_0xaa30('0x1f'),_0x4e29f9,JSON[_0xaa30('0x20')](_0x2d9e35));_0x3cbf92(_0x2d9e35);})[_0xaa30('0x19')](function(_0x57d1ca){logger[_0xaa30('0x16')](_0xaa30('0x1f'),_0x57d1ca[_0xaa30('0x18')],_0x4e29f9);_0x3e4f1d(_0x520abb[_0xaa30('0x16')](0x1f4,_0x57d1ca[_0xaa30('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 7a2b8ab..df8585a 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 _0x01fe=['./mailMessage.events','remove','update','emit','register','length'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x01fe,0x102));var _0xe01f=function(_0x577019,_0x2fa1c4){_0x577019=_0x577019-0x0;var _0x4c9223=_0x01fe[_0x577019];return _0x4c9223;};'use strict';var MailMessageEvents=require(_0xe01f('0x0'));var events=['save',_0xe01f('0x1'),_0xe01f('0x2')];function createListener(_0x4a9e90,_0x577c82){return function(_0x15f6ba){_0x577c82[_0xe01f('0x3')](_0x4a9e90,_0x15f6ba);};}function removeListener(_0x9505fa,_0x92b885){return function(){MailMessageEvents['removeListener'](_0x9505fa,_0x92b885);};}exports[_0xe01f('0x4')]=function(_0x574969){for(var _0x3effc4=0x0,_0x3b754f=events[_0xe01f('0x5')];_0x3effc4<_0x3b754f;_0x3effc4++){var _0x40376f=events[_0x3effc4];var _0x377881=createListener('mailMessage:'+_0x40376f,_0x574969);MailMessageEvents['on'](_0x40376f,_0x377881);}}; \ No newline at end of file +var _0xb268=['removeListener','register','mailMessage:','./mailMessage.events','save','remove','update'];(function(_0x5d909f,_0x19eab0){var _0x25d108=function(_0x39af7d){while(--_0x39af7d){_0x5d909f['push'](_0x5d909f['shift']());}};_0x25d108(++_0x19eab0);}(_0xb268,0x114));var _0x8b26=function(_0x12a1a4,_0xb94cfd){_0x12a1a4=_0x12a1a4-0x0;var _0x2cdcc6=_0xb268[_0x12a1a4];return _0x2cdcc6;};'use strict';var MailMessageEvents=require(_0x8b26('0x0'));var events=[_0x8b26('0x1'),_0x8b26('0x2'),_0x8b26('0x3')];function createListener(_0x26abf3,_0x30064c){return function(_0x48b88c){_0x30064c['emit'](_0x26abf3,_0x48b88c);};}function removeListener(_0x2fdc64,_0x1667f7){return function(){MailMessageEvents[_0x8b26('0x4')](_0x2fdc64,_0x1667f7);};}exports[_0x8b26('0x5')]=function(_0x2b0249){for(var _0x4fb7d6=0x0,_0x3b7c98=events['length'];_0x4fb7d6<_0x3b7c98;_0x4fb7d6++){var _0x4cca57=events[_0x4fb7d6];var _0x321391=createListener(_0x8b26('0x6')+_0x4cca57,_0x2b0249);MailMessageEvents['on'](_0x4cca57,_0x321391);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index ba15a3b..5185bf1 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 _0x1fb3=['./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x599a8d,_0x213819){var _0x4cd246=function(_0x401be3){while(--_0x401be3){_0x599a8d['push'](_0x599a8d['shift']());}};_0x4cd246(++_0x213819);}(_0x1fb3,0xfe));var _0x31fb=function(_0x666cc6,_0x53441b){_0x666cc6=_0x666cc6-0x0;var _0x4e6d1d=_0x1fb3[_0x666cc6];return _0x4e6d1d;};'use strict';var multer=require(_0x31fb('0x0'));var util=require(_0x31fb('0x1'));var path=require(_0x31fb('0x2'));var timeout=require(_0x31fb('0x3'));var express=require(_0x31fb('0x4'));var router=express[_0x31fb('0x5')]();var fs_extra=require(_0x31fb('0x6'));var auth=require(_0x31fb('0x7'));var interaction=require(_0x31fb('0x8'));var config=require(_0x31fb('0x9'));var controller=require(_0x31fb('0xa'));router[_0x31fb('0xb')]('/',auth[_0x31fb('0xc')](),controller[_0x31fb('0xd')]);router['get'](_0x31fb('0xe'),auth[_0x31fb('0xc')](),controller[_0x31fb('0xf')]);router['get'](_0x31fb('0x10'),auth[_0x31fb('0xc')](),controller[_0x31fb('0x11')]);router[_0x31fb('0xb')](_0x31fb('0x12'),auth[_0x31fb('0xc')](),controller[_0x31fb('0x13')]);router[_0x31fb('0xb')](_0x31fb('0x14'),auth[_0x31fb('0xc')](),controller[_0x31fb('0x15')]);router[_0x31fb('0xb')](_0x31fb('0x16'),auth['isAuthenticated'](),controller[_0x31fb('0x17')]);router['post']('/',auth[_0x31fb('0xc')](),controller[_0x31fb('0x18')]);router[_0x31fb('0x19')]('/:id/teams',auth[_0x31fb('0xc')](),controller['addTeams']);router['post']('/:id/users',auth[_0x31fb('0xc')](),controller['addAgents']);router[_0x31fb('0x1a')](_0x31fb('0x10'),auth['isAuthenticated'](),controller[_0x31fb('0x1b')]);router['delete'](_0x31fb('0x10'),auth['isAuthenticated'](),controller[_0x31fb('0x1c')]);router[_0x31fb('0x1d')](_0x31fb('0x14'),auth[_0x31fb('0xc')](),controller[_0x31fb('0x1e')]);router[_0x31fb('0x1d')](_0x31fb('0x16'),auth['isAuthenticated'](),controller[_0x31fb('0x1f')]);module[_0x31fb('0x20')]=router; \ No newline at end of file +var _0xf0ec=['get','describe','/:id','show','/:id/members','isAuthenticated','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller'];(function(_0x47f62c,_0x259624){var _0x20bf41=function(_0x273d5d){while(--_0x273d5d){_0x47f62c['push'](_0x47f62c['shift']());}};_0x20bf41(++_0x259624);}(_0xf0ec,0x1e3));var _0xcf0e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xf0ec[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0xcf0e('0x0'));var util=require(_0xcf0e('0x1'));var path=require(_0xcf0e('0x2'));var timeout=require(_0xcf0e('0x3'));var express=require(_0xcf0e('0x4'));var router=express[_0xcf0e('0x5')]();var fs_extra=require(_0xcf0e('0x6'));var auth=require(_0xcf0e('0x7'));var interaction=require(_0xcf0e('0x8'));var config=require('../../config/environment');var controller=require(_0xcf0e('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xcf0e('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xcf0e('0xb')]);router[_0xcf0e('0xa')](_0xcf0e('0xc'),auth['isAuthenticated'](),controller[_0xcf0e('0xd')]);router['get'](_0xcf0e('0xe'),auth[_0xcf0e('0xf')](),controller['getMembers']);router[_0xcf0e('0xa')](_0xcf0e('0x10'),auth[_0xcf0e('0xf')](),controller[_0xcf0e('0x11')]);router['get'](_0xcf0e('0x12'),auth[_0xcf0e('0xf')](),controller[_0xcf0e('0x13')]);router[_0xcf0e('0x14')]('/',auth[_0xcf0e('0xf')](),controller[_0xcf0e('0x15')]);router['post'](_0xcf0e('0x10'),auth[_0xcf0e('0xf')](),controller[_0xcf0e('0x16')]);router[_0xcf0e('0x14')](_0xcf0e('0x12'),auth[_0xcf0e('0xf')](),controller['addAgents']);router[_0xcf0e('0x17')](_0xcf0e('0xc'),auth[_0xcf0e('0xf')](),controller[_0xcf0e('0x18')]);router[_0xcf0e('0x19')](_0xcf0e('0xc'),auth[_0xcf0e('0xf')](),controller[_0xcf0e('0x1a')]);router[_0xcf0e('0x19')](_0xcf0e('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0xcf0e('0x12'),auth[_0xcf0e('0xf')](),controller[_0xcf0e('0x1b')]);module[_0xcf0e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 1bf70bf..740f1de 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 _0xc2d5=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x3aeaf4,_0x4a5b9a){var _0x4549ec=function(_0x2fca02){while(--_0x2fca02){_0x3aeaf4['push'](_0x3aeaf4['shift']());}};_0x4549ec(++_0x4a5b9a);}(_0xc2d5,0xdc));var _0x5c2d=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0xc2d5[_0x4d674b];return _0x535a1f;};'use strict';var Sequelize=require(_0x5c2d('0x0'));module['exports']={'name':{'type':Sequelize[_0x5c2d('0x1')],'unique':_0x5c2d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5c2d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5c2d('0x4')](_0x5c2d('0x5'),_0x5c2d('0x6'),_0x5c2d('0x7'))}}; \ No newline at end of file +var _0x437c=['beepall','roundrobin','sequelize','STRING','ENUM','rrmemory'];(function(_0x551826,_0x1f0659){var _0x24067d=function(_0x2878fd){while(--_0x2878fd){_0x551826['push'](_0x551826['shift']());}};_0x24067d(++_0x1f0659);}(_0x437c,0x1e2));var _0xc437=function(_0xecbe7,_0x884096){_0xecbe7=_0xecbe7-0x0;var _0x1007eb=_0x437c[_0xecbe7];return _0x1007eb;};'use strict';var Sequelize=require(_0xc437('0x0'));module['exports']={'name':{'type':Sequelize[_0xc437('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc437('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc437('0x2')](_0xc437('0x3'),_0xc437('0x4'),_0xc437('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 9b723af..c8e2eba 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 _0x2074=['length','merge','options','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','UserMailQueue','hasOwnProperty','limit','order','sort','pick','MailQueueId','filter','findAndCountAll','agent','createdAt','rows','%s/%s','SIP','mailPause','updatedAt','getTeams','findOne','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','Team','select','field','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','omit','spread','isArray','getAgents','bluebird','util','squel','ioredis','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','offset','undefined','count','set','json','update','then','destroy','MailQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','catch','show','model','keys','MailQueue','filters','intersection','fields','attributes'];(function(_0x50223d,_0x3d647f){var _0x1296a9=function(_0x425431){while(--_0x425431){_0x50223d['push'](_0x50223d['shift']());}};_0x1296a9(++_0x3d647f);}(_0x2074,0x143));var _0x4207=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x2074[_0x1cc8fe];return _0x230054;};'use strict';var BPromise=require(_0x4207('0x0'));var util=require(_0x4207('0x1'));var _=require('lodash');var squel=require(_0x4207('0x2'));var Redis=require(_0x4207('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x4207('0x4'));var db=require(_0x4207('0x5'))['db'];config[_0x4207('0x6')]=_[_0x4207('0x7')](config['redis'],{'host':_0x4207('0x8'),'port':0x18eb});var socket=require(_0x4207('0x9'))(new Redis(config[_0x4207('0x6')]));require(_0x4207('0xa'))[_0x4207('0xb')](socket);function respondWithStatusCode(_0x4c0b91,_0x9984d7){_0x9984d7=_0x9984d7||0xcc;return function(_0x1bbd00){if(_0x1bbd00){return _0x4c0b91[_0x4207('0xc')](_0x9984d7);}return _0x4c0b91[_0x4207('0xd')](_0x9984d7)[_0x4207('0xe')]();};}function respondWithResult(_0x1616e5,_0x13ebcc){_0x13ebcc=_0x13ebcc||0xc8;return function(_0x1d9f70){if(_0x1d9f70){return _0x1616e5['status'](_0x13ebcc)['json'](_0x1d9f70);}};}function respondWithFilteredResult(_0x45a035,_0x57a13d){return function(_0x2ee387){if(_0x2ee387){var _0x2cfab9=typeof _0x57a13d[_0x4207('0xf')]===_0x4207('0x10')&&typeof _0x57a13d['limit']==='undefined';var _0x8a8e1b=_0x2ee387[_0x4207('0x11')];var _0x3a33d8=_0x2cfab9?0x0:_0x57a13d['offset'];var _0x3ec17f=_0x2cfab9?_0x2ee387[_0x4207('0x11')]:_0x57a13d[_0x4207('0xf')]+_0x57a13d['limit'];var _0x5e91dd;if(_0x3ec17f>=_0x8a8e1b){_0x3ec17f=_0x8a8e1b;_0x5e91dd=0xc8;}else{_0x5e91dd=0xce;}_0x45a035[_0x4207('0xd')](_0x5e91dd);return _0x45a035[_0x4207('0x12')]('Content-Range',_0x3a33d8+'-'+_0x3ec17f+'/'+_0x8a8e1b)[_0x4207('0x13')](_0x2ee387);}return null;};}function saveUpdates(_0x14763e){return function(_0x13a8a6){if(_0x13a8a6){return _0x13a8a6[_0x4207('0x14')](_0x14763e)[_0x4207('0x15')](function(_0x3fe7a6){return _0x3fe7a6;});}return null;};}function removeEntity(_0x5bef86){return function(_0x49d6a5){if(_0x49d6a5){return _0x49d6a5[_0x4207('0x16')]()[_0x4207('0x15')](function(){var _0x5b7bcc=_0x49d6a5['get']({'plain':!![]});var _0x4130b9=_0x4207('0x17');return db[_0x4207('0x18')]['destroy']({'where':{'type':_0x4130b9,'resourceId':_0x5b7bcc['id']}})['then'](function(){return _0x49d6a5;});})[_0x4207('0x15')](function(){_0x5bef86[_0x4207('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b7448){return function(_0x3d65){if(!_0x3d65){_0x5b7448[_0x4207('0xc')](0x194);}return _0x3d65;};}function handleError(_0x5967fc,_0x3d8223){_0x3d8223=_0x3d8223||0x1f4;return function(_0x5adf5a){logger[_0x4207('0x19')](_0x5adf5a[_0x4207('0x1a')]);if(_0x5adf5a[_0x4207('0x1b')]){delete _0x5adf5a[_0x4207('0x1b')];}_0x5967fc[_0x4207('0xd')](_0x3d8223)[_0x4207('0x1c')](_0x5adf5a);};}exports[_0x4207('0x1d')]=function(_0x1f6718,_0x3059fe){var _0x11442e={};var _0x2c2102={'count':0x0,'rows':[]};var _0x19715c=_[_0x4207('0x1e')](db['MailQueue'][_0x4207('0x1f')],function(_0x22ed60){return{'name':_0x22ed60[_0x4207('0x20')],'type':_0x22ed60[_0x4207('0x21')][_0x4207('0x22')]};});_0x11442e=qs[_0x4207('0x23')](_0x19715c,_0x1f6718);var _0x5870fd={'where':_0x11442e[_0x4207('0x24')]};return db['MailQueue']['count'](_0x5870fd)[_0x4207('0x15')](function(_0x1f44bd){_0x2c2102['count']=_0x1f44bd;_0x11442e[_0x4207('0x25')]=qs[_0x4207('0x25')](_0x1f6718[_0x4207('0x26')]);return db['MailQueue'][_0x4207('0x27')](_0x11442e);})[_0x4207('0x15')](function(_0x4df158){_0x2c2102['rows']=_0x4df158;return _0x2c2102;})['then'](respondWithFilteredResult(_0x3059fe,_0x11442e))[_0x4207('0x28')](handleError(_0x3059fe,null));};exports[_0x4207('0x29')]=function(_0xa5458b,_0x20e911){var _0x5ef8f0={'raw':!![],'where':{'id':_0xa5458b['params']['id']}},_0x3d5b3c={};_0x3d5b3c[_0x4207('0x2a')]=_[_0x4207('0x2b')](db[_0x4207('0x2c')][_0x4207('0x1f')]);_0x3d5b3c['query']=_[_0x4207('0x2b')](_0xa5458b[_0x4207('0x26')]);_0x3d5b3c[_0x4207('0x2d')]=_[_0x4207('0x2e')](_0x3d5b3c[_0x4207('0x2a')],_0x3d5b3c[_0x4207('0x26')]);_0x5ef8f0['attributes']=_[_0x4207('0x2e')](_0x3d5b3c[_0x4207('0x2a')],qs[_0x4207('0x2f')](_0xa5458b[_0x4207('0x26')][_0x4207('0x2f')]));_0x5ef8f0[_0x4207('0x30')]=_0x5ef8f0[_0x4207('0x30')][_0x4207('0x31')]?_0x5ef8f0[_0x4207('0x30')]:_0x3d5b3c['model'];if(_0xa5458b[_0x4207('0x26')]['includeAll']){_0x5ef8f0[_0x4207('0x25')]=[{'all':!![]}];}_0x5ef8f0=_[_0x4207('0x32')]({},_0x5ef8f0,_0xa5458b[_0x4207('0x33')]);return db['MailQueue'][_0x4207('0x34')](_0x5ef8f0)[_0x4207('0x15')](handleEntityNotFound(_0x20e911,null))[_0x4207('0x15')](respondWithResult(_0x20e911,null))[_0x4207('0x28')](handleError(_0x20e911,null));};exports[_0x4207('0x35')]=function(_0x14f94d,_0x1c92e4){return db[_0x4207('0x2c')][_0x4207('0x35')](_0x14f94d[_0x4207('0x36')],{})['then'](function(_0x25134e){var _0x45dc19=_0x14f94d[_0x4207('0x37')]['get']({'plain':!![]});if(!_0x45dc19)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45dc19['role']===_0x4207('0x37')){var _0x5847d0=_0x25134e[_0x4207('0x38')]({'plain':!![]});var _0x3d725a=_0x4207('0x17');return db[_0x4207('0x39')][_0x4207('0x34')]({'where':{'name':_0x3d725a,'userProfileId':_0x45dc19[_0x4207('0x3a')]},'raw':!![]})[_0x4207('0x15')](function(_0x4798bc){if(_0x4798bc&&_0x4798bc[_0x4207('0x3b')]===0x0){return db[_0x4207('0x18')][_0x4207('0x35')]({'name':_0x5847d0[_0x4207('0x1b')],'resourceId':_0x5847d0['id'],'type':_0x4798bc[_0x4207('0x1b')],'sectionId':_0x4798bc['id']},{})[_0x4207('0x15')](function(){return _0x25134e;});}else{return _0x25134e;}})[_0x4207('0x28')](function(_0x2dcb79){logger[_0x4207('0x19')](_0x4207('0x3c'),_0x2dcb79);throw _0x2dcb79;});}return _0x25134e;})['then'](respondWithResult(_0x1c92e4,0xc9))['catch'](handleError(_0x1c92e4,null));};exports[_0x4207('0x14')]=function(_0xb24adf,_0x58b699){if(_0xb24adf[_0x4207('0x36')]['id']){delete _0xb24adf[_0x4207('0x36')]['id'];}return db[_0x4207('0x2c')][_0x4207('0x34')]({'where':{'id':_0xb24adf['params']['id']}})[_0x4207('0x15')](handleEntityNotFound(_0x58b699,null))[_0x4207('0x15')](saveUpdates(_0xb24adf[_0x4207('0x36')],null))[_0x4207('0x15')](respondWithResult(_0x58b699,null))[_0x4207('0x28')](handleError(_0x58b699,null));};exports[_0x4207('0x16')]=function(_0x2ec27a,_0xb0ad45){return db[_0x4207('0x2c')][_0x4207('0x34')]({'where':{'id':_0x2ec27a[_0x4207('0x3d')]['id']}})[_0x4207('0x15')](handleEntityNotFound(_0xb0ad45,null))[_0x4207('0x15')](removeEntity(_0xb0ad45,null))[_0x4207('0x28')](handleError(_0xb0ad45,null));};exports[_0x4207('0x3e')]=function(_0x2f3a91,_0x406032){return db[_0x4207('0x2c')]['describe']()[_0x4207('0x15')](respondWithResult(_0x406032,null))[_0x4207('0x28')](handleError(_0x406032,null));};exports[_0x4207('0x3f')]=function(_0x1dc823,_0x3a2190){var _0x4b3f63={'raw':!![],'where':{}},_0x1bfd22={},_0x39b16f;return db[_0x4207('0x2c')]['findOne']({'where':{'id':_0x1dc823['params']['id']}})['then'](handleEntityNotFound(_0x3a2190,null))[_0x4207('0x15')](function(_0x4f2902){if(_0x4f2902){_0x39b16f=_0x4f2902['get']({'plain':!![]});_0x1bfd22[_0x4207('0x2a')]=_[_0x4207('0x2b')](db[_0x4207('0x40')][_0x4207('0x1f')]);_0x1bfd22[_0x4207('0x26')]=_[_0x4207('0x2b')](_0x1dc823['query']);_0x1bfd22[_0x4207('0x2d')]=_[_0x4207('0x2e')](_0x1bfd22['model'],_0x1bfd22[_0x4207('0x26')]);_0x4b3f63[_0x4207('0x30')]=_[_0x4207('0x2e')](_0x1bfd22[_0x4207('0x2a')],qs[_0x4207('0x2f')](_0x1dc823[_0x4207('0x26')][_0x4207('0x2f')]));_0x4b3f63[_0x4207('0x30')]=_0x4b3f63[_0x4207('0x30')][_0x4207('0x31')]?_0x4b3f63[_0x4207('0x30')]:_0x1bfd22[_0x4207('0x2a')];if(!_0x1dc823[_0x4207('0x26')][_0x4207('0x41')]('nolimit')){_0x4b3f63['limit']=qs[_0x4207('0x42')](_0x1dc823['query']['limit']);_0x4b3f63['offset']=qs['offset'](_0x1dc823[_0x4207('0x26')]['offset']);}_0x4b3f63[_0x4207('0x43')]=qs[_0x4207('0x44')](_0x1dc823['query'][_0x4207('0x44')]);_0x4b3f63[_0x4207('0x24')]=qs['filters'](_[_0x4207('0x45')](_0x1dc823[_0x4207('0x26')],_0x1bfd22[_0x4207('0x2d')]));_0x4b3f63[_0x4207('0x24')][_0x4207('0x46')]=_0x4f2902['id'];if(_0x1dc823[_0x4207('0x26')][_0x4207('0x47')]){_0x4b3f63['where']=_[_0x4207('0x32')](_0x4b3f63[_0x4207('0x24')],{'$or':_[_0x4207('0x1e')](_0x4b3f63['attributes'],function(_0x2abf0f){var _0x4fd599={};_0x4fd599[_0x2abf0f]={'$like':'%'+_0x1dc823[_0x4207('0x26')]['filter']+'%'};return _0x4fd599;})});}_0x4b3f63=_[_0x4207('0x32')]({},_0x4b3f63,_0x1dc823[_0x4207('0x33')]);return db[_0x4207('0x40')][_0x4207('0x27')](_0x4b3f63);}})['then'](function(_0x3bfe53){if(_0x3bfe53){return db['User'][_0x4207('0x48')]({'where':{'id':_[_0x4207('0x1e')](_0x3bfe53,'UserId'),'role':_0x4207('0x49')},'attributes':['id','name','mailPause','updatedAt',_0x4207('0x4a')]});}})[_0x4207('0x15')](function(_0x5371e8){if(_0x5371e8){return{'count':_0x5371e8[_0x4207('0x11')],'rows':_['map'](_0x5371e8[_0x4207('0x4b')],function(_0x2afa44){return{'membername':_0x2afa44['name'],'UserId':_0x2afa44['id'],'queue_name':_0x39b16f['name'],'MailQueueId':_0x39b16f['id'],'interface':util['format'](_0x4207('0x4c'),_0x4207('0x4d'),_0x2afa44['name']),'penalty':0x0,'paused':_0x2afa44[_0x4207('0x4e')],'createdAt':_0x2afa44[_0x4207('0x4a')],'updatedAt':_0x2afa44[_0x4207('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3a2190,_0x4b3f63))[_0x4207('0x28')](handleError(_0x3a2190,null));};exports[_0x4207('0x50')]=function(_0x4c7b37,_0x50a377){var _0x207b03={};var _0x2d3c4b={};var _0x8385d;var _0x4fca42;return db[_0x4207('0x2c')][_0x4207('0x51')]({'where':{'id':_0x4c7b37[_0x4207('0x3d')]['id']}})[_0x4207('0x15')](handleEntityNotFound(_0x50a377,null))[_0x4207('0x15')](function(_0x3b31fd){if(_0x3b31fd){_0x8385d=_0x3b31fd;_0x2d3c4b[_0x4207('0x2a')]=_['keys'](db['Team'][_0x4207('0x1f')]);_0x2d3c4b[_0x4207('0x26')]=_[_0x4207('0x2b')](_0x4c7b37[_0x4207('0x26')]);_0x2d3c4b[_0x4207('0x2d')]=_['intersection'](_0x2d3c4b[_0x4207('0x2a')],_0x2d3c4b['query']);_0x207b03[_0x4207('0x30')]=_[_0x4207('0x2e')](_0x2d3c4b[_0x4207('0x2a')],qs[_0x4207('0x2f')](_0x4c7b37['query'][_0x4207('0x2f')]));_0x207b03[_0x4207('0x30')]=_0x207b03[_0x4207('0x30')][_0x4207('0x31')]?_0x207b03[_0x4207('0x30')]:_0x2d3c4b['model'];_0x207b03[_0x4207('0x43')]=qs['sort'](_0x4c7b37['query'][_0x4207('0x44')]);_0x207b03['where']=qs[_0x4207('0x2d')](_['pick'](_0x4c7b37[_0x4207('0x26')],_0x2d3c4b[_0x4207('0x2d')]));if(_0x4c7b37[_0x4207('0x26')][_0x4207('0x47')]){_0x207b03['where']=_[_0x4207('0x32')](_0x207b03[_0x4207('0x24')],{'$or':_[_0x4207('0x1e')](_0x207b03[_0x4207('0x30')],function(_0x27a2ea){var _0xe2d0a9={};_0xe2d0a9[_0x27a2ea]={'$like':'%'+_0x4c7b37[_0x4207('0x26')][_0x4207('0x47')]+'%'};return _0xe2d0a9;})});}_0x207b03=_['merge']({},_0x207b03,_0x4c7b37[_0x4207('0x33')]);return _0x8385d[_0x4207('0x50')](_0x207b03);}})['then'](function(_0x2176e8){if(_0x2176e8){_0x4fca42=_0x2176e8[_0x4207('0x31')];if(!_0x4c7b37['query'][_0x4207('0x41')]('nolimit')){_0x207b03[_0x4207('0x42')]=qs[_0x4207('0x42')](_0x4c7b37[_0x4207('0x26')][_0x4207('0x42')]);_0x207b03[_0x4207('0xf')]=qs[_0x4207('0xf')](_0x4c7b37['query']['offset']);}return _0x8385d[_0x4207('0x50')](_0x207b03);}})[_0x4207('0x15')](function(_0x3651d0){if(_0x3651d0){return _0x3651d0?{'count':_0x4fca42,'rows':_0x3651d0}:null;}})[_0x4207('0x15')](respondWithResult(_0x50a377,null))[_0x4207('0x28')](handleError(_0x50a377,null));};exports[_0x4207('0x52')]=function(_0x5635f8,_0x96ace1){var _0x5142de=_0x5635f8['body'][_0x4207('0x53')];return db['Team'][_0x4207('0x27')]({'where':{'id':_0x5142de},'attributes':['id'],'include':[{'model':db[_0x4207('0x54')],'as':_0x4207('0x55'),'attributes':['id',_0x4207('0x1b'),_0x4207('0x56'),_0x4207('0x57'),_0x4207('0x58')],'raw':!![]}]})['then'](function(_0x4aac3d){if(_0x4aac3d){var _0x3f8d58=_[_0x4207('0x59')](_0x4aac3d,function(_0x5408c0){var _0x239cc3=_0x5408c0['get']({'plain':!![]});return _0x239cc3[_0x4207('0x55')];});return db[_0x4207('0x2c')]['find']({'where':{'id':_0x5635f8[_0x4207('0x3d')]['id']}})['then'](function(_0x266401){return db[_0x4207('0x5a')][_0x4207('0x5b')](function(_0x37855d){return _0x266401[_0x4207('0x52')](_0x5142de,{'transaction':_0x37855d})[_0x4207('0x15')](function(){return BPromise[_0x4207('0x5c')](_0x3f8d58,function(_0x1c7f09){return db['UserMailQueue'][_0x4207('0x5d')]({'where':{'UserId':_0x1c7f09['id'],'MailQueueId':_0x5635f8[_0x4207('0x3d')]['id']},'transaction':_0x37855d});});})[_0x4207('0x15')](function(){_0x3f8d58[_0x4207('0x5e')](function(_0x4680bc){socket[_0x4207('0x5f')](_0x4207('0x60'),{'UserId':_0x4680bc['id'],'MailQueueId':_0x266401['id']});});});});});}})['then'](respondWithStatusCode(_0x96ace1,null))[_0x4207('0x28')](handleError(_0x96ace1,null));};exports[_0x4207('0x61')]=function(_0x57ca53,_0x5dcec5){return db[_0x4207('0x62')][_0x4207('0x27')]({'where':{'id':_0x57ca53[_0x4207('0x26')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4207('0x55'),'attributes':['id'],'raw':!![]}]})[_0x4207('0x15')](handleEntityNotFound(_0x5dcec5,null))[_0x4207('0x15')](function(_0x3397fc){var _0x235c63=_[_0x4207('0x1e')](_0x3397fc,'id');var _0x583f16=[];var _0x480750=[];var _0x133da4=squel[_0x4207('0x63')]();_0x133da4[_0x4207('0x64')]('tq.TeamId')['from'](_0x4207('0x65'),'tq')[_0x4207('0x66')](_0x4207('0x67'),'ut',_0x4207('0x68'))[_0x4207('0x24')](_0x4207('0x69'),_0x57ca53[_0x4207('0x3d')]['id']);for(var _0x2fdad1=0x0;_0x2fdad1<_0x3397fc[_0x4207('0x31')];_0x2fdad1+=0x1){let _0xf9ac55=_0x3397fc[_0x2fdad1];for(var _0x1e8210=0x0;_0x1e8210<_0xf9ac55['Agents']['length'];_0x1e8210+=0x1){let _0x18125f=_0xf9ac55[_0x4207('0x55')][_0x1e8210];var _0x3ae183=_0x133da4[_0x4207('0x6a')]();_0x3ae183[_0x4207('0x24')]('ut.UserId\x20=\x20?',_0x18125f['id']);_0x480750[_0x4207('0x6b')](db[_0x4207('0x5a')]['query'](_0x3ae183[_0x4207('0x6c')](),{'type':db['sequelize'][_0x4207('0x6d')][_0x4207('0x6e')]})['then'](function(_0xab2936){if(_0xab2936[_0x4207('0x31')]===0x1){return _0x18125f['id'];}else{var _0x44597f=_[_0x4207('0x6f')](_[_0x4207('0x1e')](_0xab2936,_0x4207('0x70')),function(_0xf625b4){return _['includes'](_0x235c63,_0xf625b4);});if(_0x44597f){return _0x18125f['id'];}}}));}}return BPromise[_0x4207('0x71')](_0x480750)[_0x4207('0x15')](function(_0x1aa4ec){_0x583f16=_(_0x583f16)[_0x4207('0x72')](_0x1aa4ec)[_0x4207('0x73')]()[_0x4207('0x74')]();return db['MailQueue'][_0x4207('0x34')]({'where':{'id':_0x57ca53[_0x4207('0x3d')]['id']}})[_0x4207('0x15')](function(_0x2f7bc2){return db[_0x4207('0x5a')][_0x4207('0x5b')](function(_0x127bd9){return _0x2f7bc2[_0x4207('0x61')](_0x57ca53[_0x4207('0x26')][_0x4207('0x53')],{'transaction':_0x127bd9})[_0x4207('0x15')](function(){if(!_[_0x4207('0x75')](_0x583f16)){return _0x2f7bc2[_0x4207('0x76')](_0x583f16,{'transaction':_0x127bd9});}})['then'](function(){_0x583f16[_0x4207('0x5e')](function(_0x10fb1d){socket[_0x4207('0x5f')](_0x4207('0x77'),{'UserId':_0x10fb1d,'MailQueueId':_0x2f7bc2['id']});});});});});});})[_0x4207('0x15')](respondWithStatusCode(_0x5dcec5,null))[_0x4207('0x28')](handleError(_0x5dcec5,null));};exports['addAgents']=function(_0x13e3cf,_0x4b16f7){return db[_0x4207('0x2c')][_0x4207('0x34')]({'where':{'id':_0x13e3cf[_0x4207('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4b16f7,null))[_0x4207('0x15')](function(_0x1d51cd){if(_0x1d51cd){return _0x1d51cd['addAgents'](_0x13e3cf['body'][_0x4207('0x53')],_[_0x4207('0x78')](_0x13e3cf[_0x4207('0x36')],[_0x4207('0x53'),'id'])||{})[_0x4207('0x79')](function(_0xbd2937){for(var _0x459b81=0x0;_0x459b81<_0x13e3cf[_0x4207('0x36')][_0x4207('0x53')]['length'];_0x459b81+=0x1){socket[_0x4207('0x5f')](_0x4207('0x60'),{'UserId':Number(_0x13e3cf[_0x4207('0x36')][_0x4207('0x53')][_0x459b81]),'MailQueueId':Number(_0x13e3cf[_0x4207('0x3d')]['id'])});}return _0xbd2937;});}})[_0x4207('0x15')](respondWithResult(_0x4b16f7,null))[_0x4207('0x28')](handleError(_0x4b16f7,null));};exports[_0x4207('0x76')]=function(_0x19d0b4,_0x1affde){return db[_0x4207('0x2c')]['find']({'where':{'id':_0x19d0b4['params']['id']}})[_0x4207('0x15')](handleEntityNotFound(_0x1affde,null))['then'](function(_0x5ab0b0){if(_0x5ab0b0){return _0x5ab0b0['removeAgents'](_0x19d0b4['query'][_0x4207('0x53')])[_0x4207('0x15')](function(){if(_[_0x4207('0x7a')](_0x19d0b4[_0x4207('0x26')][_0x4207('0x53')])){for(var _0x1c69b3=0x0;_0x1c69b3<_0x19d0b4[_0x4207('0x26')]['ids'][_0x4207('0x31')];_0x1c69b3+=0x1){socket[_0x4207('0x5f')](_0x4207('0x77'),{'UserId':Number(_0x19d0b4[_0x4207('0x26')][_0x4207('0x53')][_0x1c69b3]),'MailQueueId':Number(_0x19d0b4['params']['id'])});}}else{socket['emit'](_0x4207('0x77'),{'UserId':Number(_0x19d0b4[_0x4207('0x26')][_0x4207('0x53')]),'MailQueueId':Number(_0x19d0b4[_0x4207('0x3d')]['id'])});}});}})[_0x4207('0x15')](respondWithStatusCode(_0x1affde,null))['catch'](handleError(_0x1affde,null));};exports[_0x4207('0x7b')]=function(_0x403edb,_0x5ca35d){var _0x52b74f={};var _0x2c6f9a={};var _0x5946ff;var _0x1c4c33;return db['MailQueue'][_0x4207('0x51')]({'where':{'id':_0x403edb[_0x4207('0x3d')]['id']}})[_0x4207('0x15')](handleEntityNotFound(_0x5ca35d,null))[_0x4207('0x15')](function(_0x204c2c){if(_0x204c2c){_0x5946ff=_0x204c2c;_0x2c6f9a[_0x4207('0x2a')]=_[_0x4207('0x2b')](db['User']['rawAttributes']);_0x2c6f9a[_0x4207('0x26')]=_[_0x4207('0x2b')](_0x403edb[_0x4207('0x26')]);_0x2c6f9a['filters']=_[_0x4207('0x2e')](_0x2c6f9a[_0x4207('0x2a')],_0x2c6f9a[_0x4207('0x26')]);_0x52b74f[_0x4207('0x30')]=_[_0x4207('0x2e')](_0x2c6f9a[_0x4207('0x2a')],qs[_0x4207('0x2f')](_0x403edb[_0x4207('0x26')][_0x4207('0x2f')]));_0x52b74f[_0x4207('0x30')]=_0x52b74f[_0x4207('0x30')][_0x4207('0x31')]?_0x52b74f[_0x4207('0x30')]:_0x2c6f9a[_0x4207('0x2a')];_0x52b74f['order']=qs['sort'](_0x403edb['query'][_0x4207('0x44')]);_0x52b74f['where']=qs['filters'](_['pick'](_0x403edb['query'],_0x2c6f9a[_0x4207('0x2d')]));if(_0x403edb[_0x4207('0x26')][_0x4207('0x47')]){_0x52b74f[_0x4207('0x24')]=_['merge'](_0x52b74f[_0x4207('0x24')],{'$or':_['map'](_0x52b74f[_0x4207('0x30')],function(_0x14b3ea){var _0x2898e9={};_0x2898e9[_0x14b3ea]={'$like':'%'+_0x403edb[_0x4207('0x26')][_0x4207('0x47')]+'%'};return _0x2898e9;})});}_0x52b74f=_[_0x4207('0x32')]({},_0x52b74f,_0x403edb[_0x4207('0x33')]);return _0x5946ff['getAgents'](_0x52b74f);}})[_0x4207('0x15')](function(_0x2bc2a8){if(_0x2bc2a8){_0x1c4c33=_0x2bc2a8['length'];if(!_0x403edb[_0x4207('0x26')][_0x4207('0x41')]('nolimit')){_0x52b74f[_0x4207('0x42')]=qs[_0x4207('0x42')](_0x403edb['query']['limit']);_0x52b74f[_0x4207('0xf')]=qs[_0x4207('0xf')](_0x403edb[_0x4207('0x26')]['offset']);}return _0x5946ff[_0x4207('0x7b')](_0x52b74f);}})['then'](function(_0x40989b){if(_0x40989b){return _0x40989b?{'count':_0x1c4c33,'rows':_0x40989b}:null;}})[_0x4207('0x15')](respondWithResult(_0x5ca35d,null))[_0x4207('0x28')](handleError(_0x5ca35d,null));}; \ No newline at end of file +var _0xbfdb=['sort','pick','filter','options','User','UserId','updatedAt','createdAt','rows','format','%s/%s','SIP','mailPause','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','ids','select','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','redis','./mailQueue.socket','sendStatus','status','json','offset','undefined','limit','count','set','update','then','get','MailQueues','destroy','end','error','stack','name','send','index','map','MailQueue','fieldName','key','getOptions','where','include','catch','show','params','keys','rawAttributes','query','intersection','model','attributes','fields','includeAll','merge','create','body','user','role','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','findOne','UserMailQueue','filters','length','hasOwnProperty','nolimit','order'];(function(_0x6a005f,_0x2f2f67){var _0x507069=function(_0x2e49d5){while(--_0x2e49d5){_0x6a005f['push'](_0x6a005f['shift']());}};_0x507069(++_0x2f2f67);}(_0xbfdb,0xae));var _0xbbfd=function(_0x47cad4,_0x5871c9){_0x47cad4=_0x47cad4-0x0;var _0x39c10d=_0xbfdb[_0x47cad4];return _0x39c10d;};'use strict';var BPromise=require('bluebird');var util=require(_0xbbfd('0x0'));var _=require(_0xbbfd('0x1'));var squel=require(_0xbbfd('0x2'));var Redis=require(_0xbbfd('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xbbfd('0x4'))(_0xbbfd('0x5'));var config=require(_0xbbfd('0x6'));var db=require(_0xbbfd('0x7'))['db'];config['redis']=_[_0xbbfd('0x8')](config['redis'],{'host':_0xbbfd('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbbfd('0xa')]));require(_0xbbfd('0xb'))['register'](socket);function respondWithStatusCode(_0x43ed6c,_0x180332){_0x180332=_0x180332||0xcc;return function(_0x3d4e69){if(_0x3d4e69){return _0x43ed6c[_0xbbfd('0xc')](_0x180332);}return _0x43ed6c[_0xbbfd('0xd')](_0x180332)['end']();};}function respondWithResult(_0x50c8ac,_0x3aab01){_0x3aab01=_0x3aab01||0xc8;return function(_0x2c2094){if(_0x2c2094){return _0x50c8ac['status'](_0x3aab01)[_0xbbfd('0xe')](_0x2c2094);}};}function respondWithFilteredResult(_0x182d74,_0x2d8ebf){return function(_0x222ac7){if(_0x222ac7){var _0x2b3916=typeof _0x2d8ebf[_0xbbfd('0xf')]===_0xbbfd('0x10')&&typeof _0x2d8ebf[_0xbbfd('0x11')]==='undefined';var _0x478d5a=_0x222ac7[_0xbbfd('0x12')];var _0x344b34=_0x2b3916?0x0:_0x2d8ebf[_0xbbfd('0xf')];var _0x2eef34=_0x2b3916?_0x222ac7[_0xbbfd('0x12')]:_0x2d8ebf[_0xbbfd('0xf')]+_0x2d8ebf[_0xbbfd('0x11')];var _0xc8572;if(_0x2eef34>=_0x478d5a){_0x2eef34=_0x478d5a;_0xc8572=0xc8;}else{_0xc8572=0xce;}_0x182d74[_0xbbfd('0xd')](_0xc8572);return _0x182d74[_0xbbfd('0x13')]('Content-Range',_0x344b34+'-'+_0x2eef34+'/'+_0x478d5a)[_0xbbfd('0xe')](_0x222ac7);}return null;};}function saveUpdates(_0x379ca9){return function(_0x14dcae){if(_0x14dcae){return _0x14dcae[_0xbbfd('0x14')](_0x379ca9)[_0xbbfd('0x15')](function(_0xaa11d5){return _0xaa11d5;});}return null;};}function removeEntity(_0x4ff203){return function(_0x2b3025){if(_0x2b3025){return _0x2b3025['destroy']()[_0xbbfd('0x15')](function(){var _0x17e80a=_0x2b3025[_0xbbfd('0x16')]({'plain':!![]});var _0x4da96b=_0xbbfd('0x17');return db['UserProfileResource'][_0xbbfd('0x18')]({'where':{'type':_0x4da96b,'resourceId':_0x17e80a['id']}})[_0xbbfd('0x15')](function(){return _0x2b3025;});})[_0xbbfd('0x15')](function(){_0x4ff203[_0xbbfd('0xd')](0xcc)[_0xbbfd('0x19')]();});}};}function handleEntityNotFound(_0x259939){return function(_0x52813e){if(!_0x52813e){_0x259939[_0xbbfd('0xc')](0x194);}return _0x52813e;};}function handleError(_0x347c3e,_0x569cf2){_0x569cf2=_0x569cf2||0x1f4;return function(_0x25e654){logger[_0xbbfd('0x1a')](_0x25e654[_0xbbfd('0x1b')]);if(_0x25e654['name']){delete _0x25e654[_0xbbfd('0x1c')];}_0x347c3e[_0xbbfd('0xd')](_0x569cf2)[_0xbbfd('0x1d')](_0x25e654);};}exports[_0xbbfd('0x1e')]=function(_0x1ccf0c,_0x130dd1){var _0xc35247={};var _0x240804={'count':0x0,'rows':[]};var _0x3be269=_[_0xbbfd('0x1f')](db[_0xbbfd('0x20')]['rawAttributes'],function(_0xf1fa6e){return{'name':_0xf1fa6e[_0xbbfd('0x21')],'type':_0xf1fa6e['type'][_0xbbfd('0x22')]};});_0xc35247=qs[_0xbbfd('0x23')](_0x3be269,_0x1ccf0c);var _0x28c42c={'where':_0xc35247[_0xbbfd('0x24')]};return db['MailQueue']['count'](_0x28c42c)[_0xbbfd('0x15')](function(_0x4453c8){_0x240804[_0xbbfd('0x12')]=_0x4453c8;_0xc35247['include']=qs[_0xbbfd('0x25')](_0x1ccf0c['query']);return db[_0xbbfd('0x20')]['findAll'](_0xc35247);})[_0xbbfd('0x15')](function(_0x309f66){_0x240804['rows']=_0x309f66;return _0x240804;})[_0xbbfd('0x15')](respondWithFilteredResult(_0x130dd1,_0xc35247))[_0xbbfd('0x26')](handleError(_0x130dd1,null));};exports[_0xbbfd('0x27')]=function(_0x4bf568,_0x584b35){var _0x513ef9={'raw':!![],'where':{'id':_0x4bf568[_0xbbfd('0x28')]['id']}},_0x470c53={};_0x470c53['model']=_[_0xbbfd('0x29')](db['MailQueue'][_0xbbfd('0x2a')]);_0x470c53['query']=_[_0xbbfd('0x29')](_0x4bf568[_0xbbfd('0x2b')]);_0x470c53['filters']=_[_0xbbfd('0x2c')](_0x470c53[_0xbbfd('0x2d')],_0x470c53['query']);_0x513ef9[_0xbbfd('0x2e')]=_[_0xbbfd('0x2c')](_0x470c53[_0xbbfd('0x2d')],qs[_0xbbfd('0x2f')](_0x4bf568[_0xbbfd('0x2b')][_0xbbfd('0x2f')]));_0x513ef9[_0xbbfd('0x2e')]=_0x513ef9[_0xbbfd('0x2e')]['length']?_0x513ef9[_0xbbfd('0x2e')]:_0x470c53[_0xbbfd('0x2d')];if(_0x4bf568['query'][_0xbbfd('0x30')]){_0x513ef9['include']=[{'all':!![]}];}_0x513ef9=_[_0xbbfd('0x31')]({},_0x513ef9,_0x4bf568['options']);return db[_0xbbfd('0x20')]['find'](_0x513ef9)['then'](handleEntityNotFound(_0x584b35,null))['then'](respondWithResult(_0x584b35,null))[_0xbbfd('0x26')](handleError(_0x584b35,null));};exports[_0xbbfd('0x32')]=function(_0x127d94,_0x3d35ef){return db[_0xbbfd('0x20')]['create'](_0x127d94[_0xbbfd('0x33')],{})[_0xbbfd('0x15')](function(_0x1c5cf3){var _0x17db2c=_0x127d94[_0xbbfd('0x34')][_0xbbfd('0x16')]({'plain':!![]});if(!_0x17db2c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17db2c[_0xbbfd('0x35')]===_0xbbfd('0x34')){var _0x4723ef=_0x1c5cf3[_0xbbfd('0x16')]({'plain':!![]});var _0x305751=_0xbbfd('0x17');return db['UserProfileSection']['find']({'where':{'name':_0x305751,'userProfileId':_0x17db2c['userProfileId']},'raw':!![]})[_0xbbfd('0x15')](function(_0x24b6a8){if(_0x24b6a8&&_0x24b6a8['autoAssociation']===0x0){return db[_0xbbfd('0x36')][_0xbbfd('0x32')]({'name':_0x4723ef[_0xbbfd('0x1c')],'resourceId':_0x4723ef['id'],'type':_0x24b6a8['name'],'sectionId':_0x24b6a8['id']},{})[_0xbbfd('0x15')](function(){return _0x1c5cf3;});}else{return _0x1c5cf3;}})[_0xbbfd('0x26')](function(_0x373082){logger[_0xbbfd('0x1a')](_0xbbfd('0x37'),_0x373082);throw _0x373082;});}return _0x1c5cf3;})[_0xbbfd('0x15')](respondWithResult(_0x3d35ef,0xc9))['catch'](handleError(_0x3d35ef,null));};exports[_0xbbfd('0x14')]=function(_0x449af4,_0x4fa2e8){if(_0x449af4[_0xbbfd('0x33')]['id']){delete _0x449af4['body']['id'];}return db[_0xbbfd('0x20')][_0xbbfd('0x38')]({'where':{'id':_0x449af4['params']['id']}})[_0xbbfd('0x15')](handleEntityNotFound(_0x4fa2e8,null))[_0xbbfd('0x15')](saveUpdates(_0x449af4[_0xbbfd('0x33')],null))['then'](respondWithResult(_0x4fa2e8,null))[_0xbbfd('0x26')](handleError(_0x4fa2e8,null));};exports[_0xbbfd('0x18')]=function(_0x33a42d,_0x4ece22){return db[_0xbbfd('0x20')]['find']({'where':{'id':_0x33a42d['params']['id']}})[_0xbbfd('0x15')](handleEntityNotFound(_0x4ece22,null))[_0xbbfd('0x15')](removeEntity(_0x4ece22,null))[_0xbbfd('0x26')](handleError(_0x4ece22,null));};exports[_0xbbfd('0x39')]=function(_0x5c86bb,_0x18d79f){return db[_0xbbfd('0x20')][_0xbbfd('0x39')]()['then'](respondWithResult(_0x18d79f,null))['catch'](handleError(_0x18d79f,null));};exports[_0xbbfd('0x3a')]=function(_0x86bd5e,_0x2e3947){var _0x58987b={'raw':!![],'where':{}},_0x17b943={},_0x1935bb;return db[_0xbbfd('0x20')][_0xbbfd('0x3b')]({'where':{'id':_0x86bd5e[_0xbbfd('0x28')]['id']}})['then'](handleEntityNotFound(_0x2e3947,null))['then'](function(_0x1e278e){if(_0x1e278e){_0x1935bb=_0x1e278e['get']({'plain':!![]});_0x17b943[_0xbbfd('0x2d')]=_[_0xbbfd('0x29')](db[_0xbbfd('0x3c')][_0xbbfd('0x2a')]);_0x17b943[_0xbbfd('0x2b')]=_['keys'](_0x86bd5e[_0xbbfd('0x2b')]);_0x17b943[_0xbbfd('0x3d')]=_['intersection'](_0x17b943[_0xbbfd('0x2d')],_0x17b943[_0xbbfd('0x2b')]);_0x58987b[_0xbbfd('0x2e')]=_[_0xbbfd('0x2c')](_0x17b943[_0xbbfd('0x2d')],qs[_0xbbfd('0x2f')](_0x86bd5e[_0xbbfd('0x2b')][_0xbbfd('0x2f')]));_0x58987b['attributes']=_0x58987b[_0xbbfd('0x2e')][_0xbbfd('0x3e')]?_0x58987b['attributes']:_0x17b943[_0xbbfd('0x2d')];if(!_0x86bd5e[_0xbbfd('0x2b')][_0xbbfd('0x3f')](_0xbbfd('0x40'))){_0x58987b[_0xbbfd('0x11')]=qs[_0xbbfd('0x11')](_0x86bd5e[_0xbbfd('0x2b')][_0xbbfd('0x11')]);_0x58987b[_0xbbfd('0xf')]=qs[_0xbbfd('0xf')](_0x86bd5e[_0xbbfd('0x2b')]['offset']);}_0x58987b[_0xbbfd('0x41')]=qs[_0xbbfd('0x42')](_0x86bd5e[_0xbbfd('0x2b')][_0xbbfd('0x42')]);_0x58987b[_0xbbfd('0x24')]=qs['filters'](_[_0xbbfd('0x43')](_0x86bd5e[_0xbbfd('0x2b')],_0x17b943[_0xbbfd('0x3d')]));_0x58987b[_0xbbfd('0x24')]['MailQueueId']=_0x1e278e['id'];if(_0x86bd5e[_0xbbfd('0x2b')][_0xbbfd('0x44')]){_0x58987b[_0xbbfd('0x24')]=_[_0xbbfd('0x31')](_0x58987b[_0xbbfd('0x24')],{'$or':_[_0xbbfd('0x1f')](_0x58987b[_0xbbfd('0x2e')],function(_0x35884c){var _0x19d8cb={};_0x19d8cb[_0x35884c]={'$like':'%'+_0x86bd5e[_0xbbfd('0x2b')][_0xbbfd('0x44')]+'%'};return _0x19d8cb;})});}_0x58987b=_['merge']({},_0x58987b,_0x86bd5e[_0xbbfd('0x45')]);return db[_0xbbfd('0x3c')]['findAll'](_0x58987b);}})['then'](function(_0x9f83f4){if(_0x9f83f4){return db[_0xbbfd('0x46')]['findAndCountAll']({'where':{'id':_['map'](_0x9f83f4,_0xbbfd('0x47')),'role':'agent'},'attributes':['id',_0xbbfd('0x1c'),'mailPause',_0xbbfd('0x48'),_0xbbfd('0x49')]});}})[_0xbbfd('0x15')](function(_0xba4bc8){if(_0xba4bc8){return{'count':_0xba4bc8['count'],'rows':_[_0xbbfd('0x1f')](_0xba4bc8[_0xbbfd('0x4a')],function(_0x1fecb1){return{'membername':_0x1fecb1[_0xbbfd('0x1c')],'UserId':_0x1fecb1['id'],'queue_name':_0x1935bb[_0xbbfd('0x1c')],'MailQueueId':_0x1935bb['id'],'interface':util[_0xbbfd('0x4b')](_0xbbfd('0x4c'),_0xbbfd('0x4d'),_0x1fecb1['name']),'penalty':0x0,'paused':_0x1fecb1[_0xbbfd('0x4e')],'createdAt':_0x1fecb1['createdAt'],'updatedAt':_0x1fecb1[_0xbbfd('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbbfd('0x15')](respondWithFilteredResult(_0x2e3947,_0x58987b))[_0xbbfd('0x26')](handleError(_0x2e3947,null));};exports[_0xbbfd('0x4f')]=function(_0x4f2313,_0x4ce0b6){var _0x143b28={};var _0xb338e4={};var _0x2e38a6;var _0x235862;return db[_0xbbfd('0x20')][_0xbbfd('0x3b')]({'where':{'id':_0x4f2313[_0xbbfd('0x28')]['id']}})['then'](handleEntityNotFound(_0x4ce0b6,null))['then'](function(_0x6bd5ca){if(_0x6bd5ca){_0x2e38a6=_0x6bd5ca;_0xb338e4[_0xbbfd('0x2d')]=_[_0xbbfd('0x29')](db[_0xbbfd('0x50')]['rawAttributes']);_0xb338e4[_0xbbfd('0x2b')]=_[_0xbbfd('0x29')](_0x4f2313[_0xbbfd('0x2b')]);_0xb338e4[_0xbbfd('0x3d')]=_['intersection'](_0xb338e4['model'],_0xb338e4['query']);_0x143b28[_0xbbfd('0x2e')]=_[_0xbbfd('0x2c')](_0xb338e4[_0xbbfd('0x2d')],qs['fields'](_0x4f2313[_0xbbfd('0x2b')][_0xbbfd('0x2f')]));_0x143b28[_0xbbfd('0x2e')]=_0x143b28['attributes'][_0xbbfd('0x3e')]?_0x143b28[_0xbbfd('0x2e')]:_0xb338e4[_0xbbfd('0x2d')];_0x143b28['order']=qs[_0xbbfd('0x42')](_0x4f2313[_0xbbfd('0x2b')][_0xbbfd('0x42')]);_0x143b28[_0xbbfd('0x24')]=qs[_0xbbfd('0x3d')](_[_0xbbfd('0x43')](_0x4f2313['query'],_0xb338e4[_0xbbfd('0x3d')]));if(_0x4f2313['query'][_0xbbfd('0x44')]){_0x143b28[_0xbbfd('0x24')]=_[_0xbbfd('0x31')](_0x143b28[_0xbbfd('0x24')],{'$or':_[_0xbbfd('0x1f')](_0x143b28[_0xbbfd('0x2e')],function(_0x5dcc82){var _0xe15bf4={};_0xe15bf4[_0x5dcc82]={'$like':'%'+_0x4f2313[_0xbbfd('0x2b')][_0xbbfd('0x44')]+'%'};return _0xe15bf4;})});}_0x143b28=_[_0xbbfd('0x31')]({},_0x143b28,_0x4f2313[_0xbbfd('0x45')]);return _0x2e38a6[_0xbbfd('0x4f')](_0x143b28);}})[_0xbbfd('0x15')](function(_0x3ad8ed){if(_0x3ad8ed){_0x235862=_0x3ad8ed[_0xbbfd('0x3e')];if(!_0x4f2313['query'][_0xbbfd('0x3f')](_0xbbfd('0x40'))){_0x143b28[_0xbbfd('0x11')]=qs['limit'](_0x4f2313[_0xbbfd('0x2b')]['limit']);_0x143b28[_0xbbfd('0xf')]=qs[_0xbbfd('0xf')](_0x4f2313[_0xbbfd('0x2b')]['offset']);}return _0x2e38a6[_0xbbfd('0x4f')](_0x143b28);}})['then'](function(_0x2c680d){if(_0x2c680d){return _0x2c680d?{'count':_0x235862,'rows':_0x2c680d}:null;}})['then'](respondWithResult(_0x4ce0b6,null))[_0xbbfd('0x26')](handleError(_0x4ce0b6,null));};exports[_0xbbfd('0x51')]=function(_0x57b781,_0xe27b10){var _0x4a386f=_0x57b781[_0xbbfd('0x33')]['ids'];return db[_0xbbfd('0x50')]['findAll']({'where':{'id':_0x4a386f},'attributes':['id'],'include':[{'model':db[_0xbbfd('0x46')],'as':_0xbbfd('0x52'),'attributes':['id',_0xbbfd('0x1c'),_0xbbfd('0x53'),_0xbbfd('0x54'),_0xbbfd('0x55')],'raw':!![]}]})['then'](function(_0x10b6cf){if(_0x10b6cf){var _0x16fda8=_[_0xbbfd('0x56')](_0x10b6cf,function(_0x5ab4fb){var _0x2a0b58=_0x5ab4fb[_0xbbfd('0x16')]({'plain':!![]});return _0x2a0b58[_0xbbfd('0x52')];});return db[_0xbbfd('0x20')][_0xbbfd('0x38')]({'where':{'id':_0x57b781[_0xbbfd('0x28')]['id']}})[_0xbbfd('0x15')](function(_0x526812){return db[_0xbbfd('0x57')][_0xbbfd('0x58')](function(_0x327d34){return _0x526812['addTeams'](_0x4a386f,{'transaction':_0x327d34})[_0xbbfd('0x15')](function(){return BPromise[_0xbbfd('0x59')](_0x16fda8,function(_0x174fbf){return db[_0xbbfd('0x3c')][_0xbbfd('0x5a')]({'where':{'UserId':_0x174fbf['id'],'MailQueueId':_0x57b781[_0xbbfd('0x28')]['id']},'transaction':_0x327d34});});})[_0xbbfd('0x15')](function(){_0x16fda8['forEach'](function(_0x3d98d6){socket[_0xbbfd('0x5b')](_0xbbfd('0x5c'),{'UserId':_0x3d98d6['id'],'MailQueueId':_0x526812['id']});});});});});}})[_0xbbfd('0x15')](respondWithStatusCode(_0xe27b10,null))[_0xbbfd('0x26')](handleError(_0xe27b10,null));};exports['removeTeams']=function(_0x5d6ccb,_0x29f8d4){return db[_0xbbfd('0x50')]['findAll']({'where':{'id':_0x5d6ccb['query'][_0xbbfd('0x5d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbbfd('0x52'),'attributes':['id'],'raw':!![]}]})[_0xbbfd('0x15')](handleEntityNotFound(_0x29f8d4,null))[_0xbbfd('0x15')](function(_0x31a1d1){var _0x5e63fa=_['map'](_0x31a1d1,'id');var _0x518c67=[];var _0x43f653=[];var _0x55a21c=squel[_0xbbfd('0x5e')]();_0x55a21c['field'](_0xbbfd('0x5f'))[_0xbbfd('0x60')]('team_has_mail_queues','tq')[_0xbbfd('0x61')]('user_has_teams','ut',_0xbbfd('0x62'))[_0xbbfd('0x24')](_0xbbfd('0x63'),_0x5d6ccb[_0xbbfd('0x28')]['id']);for(var _0x145a26=0x0;_0x145a26<_0x31a1d1[_0xbbfd('0x3e')];_0x145a26+=0x1){let _0x18ece5=_0x31a1d1[_0x145a26];for(var _0x59488e=0x0;_0x59488e<_0x18ece5[_0xbbfd('0x52')][_0xbbfd('0x3e')];_0x59488e+=0x1){let _0x36a6f2=_0x18ece5['Agents'][_0x59488e];var _0x19f609=_0x55a21c['clone']();_0x19f609[_0xbbfd('0x24')](_0xbbfd('0x64'),_0x36a6f2['id']);_0x43f653['push'](db[_0xbbfd('0x57')][_0xbbfd('0x2b')](_0x19f609[_0xbbfd('0x65')](),{'type':db[_0xbbfd('0x57')][_0xbbfd('0x66')][_0xbbfd('0x67')]})['then'](function(_0x20139a){if(_0x20139a[_0xbbfd('0x3e')]===0x1){return _0x36a6f2['id'];}else{var _0x3725fc=_[_0xbbfd('0x68')](_[_0xbbfd('0x1f')](_0x20139a,_0xbbfd('0x69')),function(_0x347784){return _[_0xbbfd('0x6a')](_0x5e63fa,_0x347784);});if(_0x3725fc){return _0x36a6f2['id'];}}}));}}return BPromise['all'](_0x43f653)[_0xbbfd('0x15')](function(_0xc71ec1){_0x518c67=_(_0x518c67)[_0xbbfd('0x6b')](_0xc71ec1)[_0xbbfd('0x6c')]()[_0xbbfd('0x6d')]();return db[_0xbbfd('0x20')][_0xbbfd('0x38')]({'where':{'id':_0x5d6ccb[_0xbbfd('0x28')]['id']}})[_0xbbfd('0x15')](function(_0x4d9cb5){return db['sequelize'][_0xbbfd('0x58')](function(_0x21abc5){return _0x4d9cb5[_0xbbfd('0x6e')](_0x5d6ccb[_0xbbfd('0x2b')][_0xbbfd('0x5d')],{'transaction':_0x21abc5})['then'](function(){if(!_[_0xbbfd('0x6f')](_0x518c67)){return _0x4d9cb5[_0xbbfd('0x70')](_0x518c67,{'transaction':_0x21abc5});}})[_0xbbfd('0x15')](function(){_0x518c67[_0xbbfd('0x71')](function(_0xea240){socket[_0xbbfd('0x5b')](_0xbbfd('0x72'),{'UserId':_0xea240,'MailQueueId':_0x4d9cb5['id']});});});});});});})['then'](respondWithStatusCode(_0x29f8d4,null))[_0xbbfd('0x26')](handleError(_0x29f8d4,null));};exports[_0xbbfd('0x73')]=function(_0x500f0f,_0x3c5820){return db[_0xbbfd('0x20')][_0xbbfd('0x38')]({'where':{'id':_0x500f0f['params']['id']}})[_0xbbfd('0x15')](handleEntityNotFound(_0x3c5820,null))[_0xbbfd('0x15')](function(_0x4bb15b){if(_0x4bb15b){return _0x4bb15b[_0xbbfd('0x73')](_0x500f0f['body']['ids'],_[_0xbbfd('0x74')](_0x500f0f[_0xbbfd('0x33')],[_0xbbfd('0x5d'),'id'])||{})[_0xbbfd('0x75')](function(_0x416b3f){for(var _0x31e906=0x0;_0x31e906<_0x500f0f[_0xbbfd('0x33')][_0xbbfd('0x5d')]['length'];_0x31e906+=0x1){socket[_0xbbfd('0x5b')](_0xbbfd('0x5c'),{'UserId':Number(_0x500f0f[_0xbbfd('0x33')]['ids'][_0x31e906]),'MailQueueId':Number(_0x500f0f[_0xbbfd('0x28')]['id'])});}return _0x416b3f;});}})[_0xbbfd('0x15')](respondWithResult(_0x3c5820,null))['catch'](handleError(_0x3c5820,null));};exports[_0xbbfd('0x70')]=function(_0x15f3a8,_0x5993bc){return db[_0xbbfd('0x20')][_0xbbfd('0x38')]({'where':{'id':_0x15f3a8[_0xbbfd('0x28')]['id']}})[_0xbbfd('0x15')](handleEntityNotFound(_0x5993bc,null))[_0xbbfd('0x15')](function(_0x4a5fe7){if(_0x4a5fe7){return _0x4a5fe7[_0xbbfd('0x70')](_0x15f3a8[_0xbbfd('0x2b')][_0xbbfd('0x5d')])[_0xbbfd('0x15')](function(){if(_[_0xbbfd('0x76')](_0x15f3a8['query']['ids'])){for(var _0x532350=0x0;_0x532350<_0x15f3a8[_0xbbfd('0x2b')][_0xbbfd('0x5d')][_0xbbfd('0x3e')];_0x532350+=0x1){socket[_0xbbfd('0x5b')](_0xbbfd('0x72'),{'UserId':Number(_0x15f3a8[_0xbbfd('0x2b')][_0xbbfd('0x5d')][_0x532350]),'MailQueueId':Number(_0x15f3a8[_0xbbfd('0x28')]['id'])});}}else{socket[_0xbbfd('0x5b')](_0xbbfd('0x72'),{'UserId':Number(_0x15f3a8[_0xbbfd('0x2b')]['ids']),'MailQueueId':Number(_0x15f3a8['params']['id'])});}});}})[_0xbbfd('0x15')](respondWithStatusCode(_0x5993bc,null))[_0xbbfd('0x26')](handleError(_0x5993bc,null));};exports[_0xbbfd('0x77')]=function(_0x46afe1,_0x26df44){var _0x594e1a={};var _0xdac6fb={};var _0x4fd717;var _0x3571b2;return db[_0xbbfd('0x20')]['findOne']({'where':{'id':_0x46afe1[_0xbbfd('0x28')]['id']}})['then'](handleEntityNotFound(_0x26df44,null))[_0xbbfd('0x15')](function(_0xb97b26){if(_0xb97b26){_0x4fd717=_0xb97b26;_0xdac6fb[_0xbbfd('0x2d')]=_[_0xbbfd('0x29')](db[_0xbbfd('0x46')][_0xbbfd('0x2a')]);_0xdac6fb[_0xbbfd('0x2b')]=_[_0xbbfd('0x29')](_0x46afe1[_0xbbfd('0x2b')]);_0xdac6fb['filters']=_[_0xbbfd('0x2c')](_0xdac6fb[_0xbbfd('0x2d')],_0xdac6fb['query']);_0x594e1a[_0xbbfd('0x2e')]=_['intersection'](_0xdac6fb[_0xbbfd('0x2d')],qs[_0xbbfd('0x2f')](_0x46afe1[_0xbbfd('0x2b')][_0xbbfd('0x2f')]));_0x594e1a[_0xbbfd('0x2e')]=_0x594e1a[_0xbbfd('0x2e')][_0xbbfd('0x3e')]?_0x594e1a[_0xbbfd('0x2e')]:_0xdac6fb[_0xbbfd('0x2d')];_0x594e1a[_0xbbfd('0x41')]=qs[_0xbbfd('0x42')](_0x46afe1[_0xbbfd('0x2b')]['sort']);_0x594e1a['where']=qs[_0xbbfd('0x3d')](_[_0xbbfd('0x43')](_0x46afe1[_0xbbfd('0x2b')],_0xdac6fb[_0xbbfd('0x3d')]));if(_0x46afe1[_0xbbfd('0x2b')]['filter']){_0x594e1a[_0xbbfd('0x24')]=_[_0xbbfd('0x31')](_0x594e1a[_0xbbfd('0x24')],{'$or':_['map'](_0x594e1a['attributes'],function(_0x1b656d){var _0x1341f0={};_0x1341f0[_0x1b656d]={'$like':'%'+_0x46afe1[_0xbbfd('0x2b')][_0xbbfd('0x44')]+'%'};return _0x1341f0;})});}_0x594e1a=_[_0xbbfd('0x31')]({},_0x594e1a,_0x46afe1[_0xbbfd('0x45')]);return _0x4fd717[_0xbbfd('0x77')](_0x594e1a);}})['then'](function(_0x225ac9){if(_0x225ac9){_0x3571b2=_0x225ac9[_0xbbfd('0x3e')];if(!_0x46afe1[_0xbbfd('0x2b')][_0xbbfd('0x3f')](_0xbbfd('0x40'))){_0x594e1a['limit']=qs['limit'](_0x46afe1[_0xbbfd('0x2b')]['limit']);_0x594e1a[_0xbbfd('0xf')]=qs['offset'](_0x46afe1[_0xbbfd('0x2b')][_0xbbfd('0xf')]);}return _0x4fd717[_0xbbfd('0x77')](_0x594e1a);}})[_0xbbfd('0x15')](function(_0x161e48){if(_0x161e48){return _0x161e48?{'count':_0x3571b2,'rows':_0x161e48}:null;}})['then'](respondWithResult(_0x26df44,null))[_0xbbfd('0x26')](handleError(_0x26df44,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index a5b3c42..84f7883 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 _0xf7a3=['events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','exports'];(function(_0x5c8f73,_0x37a3dd){var _0x3fbdb5=function(_0x24622f){while(--_0x24622f){_0x5c8f73['push'](_0x5c8f73['shift']());}};_0x3fbdb5(++_0x37a3dd);}(_0xf7a3,0x7e));var _0x3f7a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xf7a3[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require(_0x3f7a('0x0'));var MailQueue=require(_0x3f7a('0x1'))['db'][_0x3f7a('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3f7a('0x3')](0x0);var events={'afterCreate':_0x3f7a('0x4'),'afterUpdate':_0x3f7a('0x5'),'afterDestroy':_0x3f7a('0x6')};function emitEvent(_0x4ea60d){return function(_0x3e3960,_0x337db1,_0x43df19){MailQueueEvents[_0x3f7a('0x7')](_0x4ea60d+':'+_0x3e3960['id'],_0x3e3960);MailQueueEvents[_0x3f7a('0x7')](_0x4ea60d,_0x3e3960);_0x43df19(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x3f7a('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xdbac=['emit','hook','exports','../../mysqldb','save','update','remove'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xdbac,0x1ca));var _0xcdba=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xdbac[_0x16b9ed];return _0x66b1f8;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xcdba('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcdba('0x1'),'afterUpdate':_0xcdba('0x2'),'afterDestroy':_0xcdba('0x3')};function emitEvent(_0x4d515c){return function(_0x53c560,_0xebe5f,_0x360038){MailQueueEvents[_0xcdba('0x4')](_0x4d515c+':'+_0x53c560['id'],_0x53c560);MailQueueEvents[_0xcdba('0x4')](_0x4d515c,_0x53c560);_0x360038(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xcdba('0x5')](e,emitEvent(event));}}module[_0xcdba('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index c6f0277..a4b383b 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 _0x67ad=['request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x1b6bc8,_0x552fb2){var _0x416f3a=function(_0x1f7241){while(--_0x1f7241){_0x1b6bc8['push'](_0x1b6bc8['shift']());}};_0x416f3a(++_0x552fb2);}(_0x67ad,0x70));var _0xd67a=function(_0x446b0a,_0x58bea6){_0x446b0a=_0x446b0a-0x0;var _0x5af9f2=_0x67ad[_0x446b0a];return _0x5af9f2;};'use strict';var _=require(_0xd67a('0x0'));var util=require(_0xd67a('0x1'));var logger=require(_0xd67a('0x2'))(_0xd67a('0x3'));var moment=require('moment');var BPromise=require(_0xd67a('0x4'));var rp=require(_0xd67a('0x5'));var fs=require('fs');var path=require(_0xd67a('0x6'));var rimraf=require(_0xd67a('0x7'));var config=require(_0xd67a('0x8'));var attributes=require(_0xd67a('0x9'));module[_0xd67a('0xa')]=function(_0x127d5c,_0xe5c9af){return _0x127d5c['define'](_0xd67a('0xb'),attributes,{'tableName':_0xd67a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x958a=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash'];(function(_0x2d9289,_0x3c0472){var _0x5c73b5=function(_0xe8618f){while(--_0xe8618f){_0x2d9289['push'](_0x2d9289['shift']());}};_0x5c73b5(++_0x3c0472);}(_0x958a,0xc2));var _0xa958=function(_0x167208,_0xc0edb7){_0x167208=_0x167208-0x0;var _0xef30d6=_0x958a[_0x167208];return _0xef30d6;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var logger=require(_0xa958('0x2'))(_0xa958('0x3'));var moment=require('moment');var BPromise=require(_0xa958('0x4'));var rp=require(_0xa958('0x5'));var fs=require('fs');var path=require(_0xa958('0x6'));var rimraf=require('rimraf');var config=require(_0xa958('0x7'));var attributes=require(_0xa958('0x8'));module[_0xa958('0x9')]=function(_0x228a0d,_0x341bd4){return _0x228a0d[_0xa958('0xa')](_0xa958('0xb'),attributes,{'tableName':_0xa958('0xc'),'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 288c8de..fd617b0 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 _0xa19c=['stringify','error','code','message','result','catch','GetMailQueue','MailQueue','options','raw','attributes','limit','include','map','model','ShowMailQueue','find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2ec9cf,_0x3bc1ac){var _0x53d682=function(_0x59e2fe){while(--_0x59e2fe){_0x2ec9cf['push'](_0x2ec9cf['shift']());}};_0x53d682(++_0x3bc1ac);}(_0xa19c,0x114));var _0xca19=function(_0x496fa2,_0x437e47){_0x496fa2=_0x496fa2-0x0;var _0x22ce22=_0xa19c[_0x496fa2];return _0x22ce22;};'use strict';var _=require(_0xca19('0x0'));var util=require(_0xca19('0x1'));var moment=require('moment');var BPromise=require(_0xca19('0x2'));var rs=require(_0xca19('0x3'));var fs=require('fs');var Redis=require(_0xca19('0x4'));var db=require(_0xca19('0x5'))['db'];var utils=require(_0xca19('0x6'));var logger=require(_0xca19('0x7'))(_0xca19('0x8'));var config=require(_0xca19('0x9'));var jayson=require(_0xca19('0xa'));var client=jayson[_0xca19('0xb')][_0xca19('0xc')]({'port':0x232a});config[_0xca19('0xd')]=_[_0xca19('0xe')](config[_0xca19('0xd')],{'host':_0xca19('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca19('0xd')]));require(_0xca19('0x10'))[_0xca19('0x11')](socket);function respondWithRpcPromise(_0xb4b315,_0x5d3576,_0x4d7836){return new BPromise(function(_0x2842fc,_0x49bad4){return client[_0xca19('0x12')](_0xb4b315,_0x4d7836)[_0xca19('0x13')](function(_0x48e12a){logger[_0xca19('0x14')](_0xca19('0x15'),_0x5d3576,_0xca19('0x16'));logger[_0xca19('0x17')](_0xca19('0x18'),_0x5d3576,_0xca19('0x16'),JSON[_0xca19('0x19')](_0x48e12a));if(_0x48e12a[_0xca19('0x1a')]){if(_0x48e12a[_0xca19('0x1a')][_0xca19('0x1b')]===0x1f4){logger[_0xca19('0x1a')](_0xca19('0x15'),_0x5d3576,_0x48e12a[_0xca19('0x1a')][_0xca19('0x1c')]);return _0x49bad4(_0x48e12a[_0xca19('0x1a')][_0xca19('0x1c')]);}logger[_0xca19('0x1a')](_0xca19('0x15'),_0x5d3576,_0x48e12a[_0xca19('0x1a')][_0xca19('0x1c')]);return _0x2842fc(_0x48e12a[_0xca19('0x1a')][_0xca19('0x1c')]);}else{logger['info'](_0xca19('0x15'),_0x5d3576,'request\x20sent');_0x2842fc(_0x48e12a[_0xca19('0x1d')][_0xca19('0x1c')]);}})[_0xca19('0x1e')](function(_0x1be2a5){logger[_0xca19('0x1a')](_0xca19('0x15'),_0x5d3576,_0x1be2a5);_0x49bad4(_0x1be2a5);});});}exports[_0xca19('0x1f')]=function(_0x5097ea){var _0x3cd3df=this;return new Promise(function(_0x5a405e,_0x2b2b76){return db[_0xca19('0x20')]['findAll']({'raw':_0x5097ea['options']?_0x5097ea[_0xca19('0x21')][_0xca19('0x22')]===undefined?!![]:![]:!![],'where':_0x5097ea[_0xca19('0x21')]?_0x5097ea['options']['where']||null:null,'attributes':_0x5097ea[_0xca19('0x21')]?_0x5097ea[_0xca19('0x21')][_0xca19('0x23')]||null:null,'limit':_0x5097ea[_0xca19('0x21')]?_0x5097ea[_0xca19('0x21')][_0xca19('0x24')]||null:null,'include':_0x5097ea[_0xca19('0x21')]?_0x5097ea[_0xca19('0x21')][_0xca19('0x25')]?_[_0xca19('0x26')](_0x5097ea[_0xca19('0x21')][_0xca19('0x25')],function(_0x513009){return{'model':db[_0x513009[_0xca19('0x27')]],'as':_0x513009['as'],'attributes':_0x513009[_0xca19('0x23')],'include':_0x513009[_0xca19('0x25')]?_[_0xca19('0x26')](_0x513009[_0xca19('0x25')],function(_0x32884c){return{'model':db[_0x32884c[_0xca19('0x27')]],'as':_0x32884c['as'],'attributes':_0x32884c[_0xca19('0x23')],'include':_0x32884c[_0xca19('0x25')]?_[_0xca19('0x26')](_0x32884c[_0xca19('0x25')],function(_0x450c2c){return{'model':db[_0x450c2c[_0xca19('0x27')]],'as':_0x450c2c['as'],'attributes':_0x450c2c['attributes']};}):[]};}):[]};}):[]:[]})[_0xca19('0x13')](function(_0x151c7f){logger['info'](_0xca19('0x1f'),_0x5097ea);logger[_0xca19('0x17')](_0xca19('0x1f'),_0x5097ea,JSON[_0xca19('0x19')](_0x151c7f));_0x5a405e(_0x151c7f);})[_0xca19('0x1e')](function(_0x335b39){logger[_0xca19('0x1a')](_0xca19('0x1f'),_0x335b39['message'],_0x5097ea);_0x2b2b76(_0x3cd3df[_0xca19('0x1a')](0x1f4,_0x335b39[_0xca19('0x1c')]));});});};exports[_0xca19('0x28')]=function(_0x20199f){var _0x33b1fb=this;return new Promise(function(_0x3247fb,_0x3c51f7){return db[_0xca19('0x20')][_0xca19('0x29')]({'raw':_0x20199f[_0xca19('0x21')]?_0x20199f[_0xca19('0x21')][_0xca19('0x22')]===undefined?!![]:![]:!![],'where':_0x20199f['options']?_0x20199f[_0xca19('0x21')][_0xca19('0x2a')]||null:null,'attributes':_0x20199f[_0xca19('0x21')]?_0x20199f['options']['attributes']||null:null,'include':_0x20199f['options']?_0x20199f['options'][_0xca19('0x25')]?_[_0xca19('0x26')](_0x20199f[_0xca19('0x21')][_0xca19('0x25')],function(_0x36b0fd){return{'model':db[_0x36b0fd['model']],'as':_0x36b0fd['as'],'attributes':_0x36b0fd[_0xca19('0x23')],'include':_0x36b0fd[_0xca19('0x25')]?_[_0xca19('0x26')](_0x36b0fd[_0xca19('0x25')],function(_0x25a8c6){return{'model':db[_0x25a8c6[_0xca19('0x27')]],'as':_0x25a8c6['as'],'attributes':_0x25a8c6[_0xca19('0x23')],'include':_0x25a8c6['include']?_[_0xca19('0x26')](_0x25a8c6[_0xca19('0x25')],function(_0x5bd676){return{'model':db[_0x5bd676[_0xca19('0x27')]],'as':_0x5bd676['as'],'attributes':_0x5bd676['attributes']};}):[]};}):[]};}):[]:[]})[_0xca19('0x13')](function(_0x21922e){logger['info'](_0xca19('0x28'),_0x20199f);logger[_0xca19('0x17')](_0xca19('0x28'),_0x20199f,JSON['stringify'](_0x21922e));_0x3247fb(_0x21922e);})['catch'](function(_0x318e8a){logger[_0xca19('0x1a')](_0xca19('0x28'),_0x318e8a['message'],_0x20199f);_0x3c51f7(_0x33b1fb[_0xca19('0x1a')](0x1f4,_0x318e8a[_0xca19('0x1c')]));});});}; \ No newline at end of file +var _0x0a35=['where','attributes','include','map','model','then','stringify','ShowMailQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./mailQueue.socket','register','request','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue','findAll','options'];(function(_0xad6cc9,_0x39b819){var _0x11c210=function(_0x24a516){while(--_0x24a516){_0xad6cc9['push'](_0xad6cc9['shift']());}};_0x11c210(++_0x39b819);}(_0x0a35,0xe1));var _0x50a3=function(_0x23c262,_0x74765a){_0x23c262=_0x23c262-0x0;var _0x9b913f=_0x0a35[_0x23c262];return _0x9b913f;};'use strict';var _=require(_0x50a3('0x0'));var util=require(_0x50a3('0x1'));var moment=require(_0x50a3('0x2'));var BPromise=require(_0x50a3('0x3'));var rs=require(_0x50a3('0x4'));var fs=require('fs');var Redis=require(_0x50a3('0x5'));var db=require(_0x50a3('0x6'))['db'];var utils=require(_0x50a3('0x7'));var logger=require(_0x50a3('0x8'))('rpc');var config=require(_0x50a3('0x9'));var jayson=require(_0x50a3('0xa'));var client=jayson[_0x50a3('0xb')][_0x50a3('0xc')]({'port':0x232a});config['redis']=_[_0x50a3('0xd')](config[_0x50a3('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x50a3('0xf'))(new Redis(config[_0x50a3('0xe')]));require(_0x50a3('0x10'))[_0x50a3('0x11')](socket);function respondWithRpcPromise(_0x166474,_0x557506,_0x2b91e9){return new BPromise(function(_0x3a526d,_0x3b2114){return client[_0x50a3('0x12')](_0x166474,_0x2b91e9)['then'](function(_0x4c7fe5){logger[_0x50a3('0x13')]('MailQueue,\x20%s,\x20%s',_0x557506,_0x50a3('0x14'));logger[_0x50a3('0x15')](_0x50a3('0x16'),_0x557506,_0x50a3('0x14'),JSON['stringify'](_0x4c7fe5));if(_0x4c7fe5['error']){if(_0x4c7fe5[_0x50a3('0x17')][_0x50a3('0x18')]===0x1f4){logger[_0x50a3('0x17')](_0x50a3('0x19'),_0x557506,_0x4c7fe5[_0x50a3('0x17')]['message']);return _0x3b2114(_0x4c7fe5[_0x50a3('0x17')][_0x50a3('0x1a')]);}logger['error'](_0x50a3('0x19'),_0x557506,_0x4c7fe5['error'][_0x50a3('0x1a')]);return _0x3a526d(_0x4c7fe5[_0x50a3('0x17')][_0x50a3('0x1a')]);}else{logger[_0x50a3('0x13')](_0x50a3('0x19'),_0x557506,_0x50a3('0x14'));_0x3a526d(_0x4c7fe5[_0x50a3('0x1b')][_0x50a3('0x1a')]);}})[_0x50a3('0x1c')](function(_0x29e369){logger[_0x50a3('0x17')]('MailQueue,\x20%s,\x20%s',_0x557506,_0x29e369);_0x3b2114(_0x29e369);});});}exports[_0x50a3('0x1d')]=function(_0x4435c9){var _0xc3e4b2=this;return new Promise(function(_0x27a69f,_0x55a60f){return db[_0x50a3('0x1e')][_0x50a3('0x1f')]({'raw':_0x4435c9[_0x50a3('0x20')]?_0x4435c9[_0x50a3('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x4435c9[_0x50a3('0x20')]?_0x4435c9['options'][_0x50a3('0x21')]||null:null,'attributes':_0x4435c9[_0x50a3('0x20')]?_0x4435c9[_0x50a3('0x20')][_0x50a3('0x22')]||null:null,'limit':_0x4435c9[_0x50a3('0x20')]?_0x4435c9[_0x50a3('0x20')]['limit']||null:null,'include':_0x4435c9[_0x50a3('0x20')]?_0x4435c9[_0x50a3('0x20')][_0x50a3('0x23')]?_[_0x50a3('0x24')](_0x4435c9[_0x50a3('0x20')][_0x50a3('0x23')],function(_0x4ad97e){return{'model':db[_0x4ad97e[_0x50a3('0x25')]],'as':_0x4ad97e['as'],'attributes':_0x4ad97e[_0x50a3('0x22')],'include':_0x4ad97e[_0x50a3('0x23')]?_['map'](_0x4ad97e['include'],function(_0x2136d0){return{'model':db[_0x2136d0[_0x50a3('0x25')]],'as':_0x2136d0['as'],'attributes':_0x2136d0['attributes'],'include':_0x2136d0['include']?_[_0x50a3('0x24')](_0x2136d0[_0x50a3('0x23')],function(_0x5a08b6){return{'model':db[_0x5a08b6['model']],'as':_0x5a08b6['as'],'attributes':_0x5a08b6[_0x50a3('0x22')]};}):[]};}):[]};}):[]:[]})[_0x50a3('0x26')](function(_0x125c86){logger[_0x50a3('0x13')](_0x50a3('0x1d'),_0x4435c9);logger[_0x50a3('0x15')]('GetMailQueue',_0x4435c9,JSON[_0x50a3('0x27')](_0x125c86));_0x27a69f(_0x125c86);})[_0x50a3('0x1c')](function(_0x3b77a3){logger['error'](_0x50a3('0x1d'),_0x3b77a3['message'],_0x4435c9);_0x55a60f(_0xc3e4b2[_0x50a3('0x17')](0x1f4,_0x3b77a3[_0x50a3('0x1a')]));});});};exports[_0x50a3('0x28')]=function(_0x5c51db){var _0x291821=this;return new Promise(function(_0x4df7fc,_0x4d6480){return db[_0x50a3('0x1e')][_0x50a3('0x29')]({'raw':_0x5c51db[_0x50a3('0x20')]?_0x5c51db[_0x50a3('0x20')][_0x50a3('0x2a')]===undefined?!![]:![]:!![],'where':_0x5c51db[_0x50a3('0x20')]?_0x5c51db[_0x50a3('0x20')][_0x50a3('0x21')]||null:null,'attributes':_0x5c51db[_0x50a3('0x20')]?_0x5c51db[_0x50a3('0x20')][_0x50a3('0x22')]||null:null,'include':_0x5c51db[_0x50a3('0x20')]?_0x5c51db[_0x50a3('0x20')][_0x50a3('0x23')]?_[_0x50a3('0x24')](_0x5c51db[_0x50a3('0x20')][_0x50a3('0x23')],function(_0x538926){return{'model':db[_0x538926[_0x50a3('0x25')]],'as':_0x538926['as'],'attributes':_0x538926['attributes'],'include':_0x538926[_0x50a3('0x23')]?_[_0x50a3('0x24')](_0x538926[_0x50a3('0x23')],function(_0x4e748f){return{'model':db[_0x4e748f[_0x50a3('0x25')]],'as':_0x4e748f['as'],'attributes':_0x4e748f[_0x50a3('0x22')],'include':_0x4e748f[_0x50a3('0x23')]?_[_0x50a3('0x24')](_0x4e748f[_0x50a3('0x23')],function(_0x3b5287){return{'model':db[_0x3b5287['model']],'as':_0x3b5287['as'],'attributes':_0x3b5287['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x165b32){logger[_0x50a3('0x13')](_0x50a3('0x28'),_0x5c51db);logger[_0x50a3('0x15')]('ShowMailQueue',_0x5c51db,JSON[_0x50a3('0x27')](_0x165b32));_0x4df7fc(_0x165b32);})[_0x50a3('0x1c')](function(_0x3418a3){logger['error'](_0x50a3('0x28'),_0x3418a3[_0x50a3('0x1a')],_0x5c51db);_0x4d6480(_0x291821[_0x50a3('0x17')](0x1f4,_0x3418a3[_0x50a3('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 36b5a06..625d062 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 _0x5cba=['save','remove','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x1954d3,_0x2e44b6){var _0xb38918=function(_0x5bc0c6){while(--_0x5bc0c6){_0x1954d3['push'](_0x1954d3['shift']());}};_0xb38918(++_0x2e44b6);}(_0x5cba,0x1cd));var _0xa5cb=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x5cba[_0x8c43de];return _0xa6591b;};'use strict';var MailQueueEvents=require(_0xa5cb('0x0'));var events=[_0xa5cb('0x1'),_0xa5cb('0x2'),'update'];function createListener(_0x401b35,_0x10afd7){return function(_0x2170fb){_0x10afd7['emit'](_0x401b35,_0x2170fb);};}function removeListener(_0x56d0a7,_0xda24c){return function(){MailQueueEvents[_0xa5cb('0x3')](_0x56d0a7,_0xda24c);};}exports[_0xa5cb('0x4')]=function(_0x50d450){for(var _0x162446=0x0,_0xce273d=events[_0xa5cb('0x5')];_0x162446<_0xce273d;_0x162446++){var _0x359c49=events[_0x162446];var _0x73b227=createListener(_0xa5cb('0x6')+_0x359c49,_0x50d450);MailQueueEvents['on'](_0x359c49,_0x73b227);}}; \ No newline at end of file +var _0xb72a=['remove','update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','save'];(function(_0x3be7ff,_0x12e714){var _0x186721=function(_0x2bc9e1){while(--_0x2bc9e1){_0x3be7ff['push'](_0x3be7ff['shift']());}};_0x186721(++_0x12e714);}(_0xb72a,0x8e));var _0xab72=function(_0x884556,_0x1e657b){_0x884556=_0x884556-0x0;var _0x59493b=_0xb72a[_0x884556];return _0x59493b;};'use strict';var MailQueueEvents=require(_0xab72('0x0'));var events=[_0xab72('0x1'),_0xab72('0x2'),_0xab72('0x3')];function createListener(_0x1b6cf4,_0xef353f){return function(_0x1e79aa){_0xef353f[_0xab72('0x4')](_0x1b6cf4,_0x1e79aa);};}function removeListener(_0x20a52e,_0x504700){return function(){MailQueueEvents[_0xab72('0x5')](_0x20a52e,_0x504700);};}exports[_0xab72('0x6')]=function(_0x368134){for(var _0x2d03ca=0x0,_0x514253=events[_0xab72('0x7')];_0x2d03ca<_0x514253;_0x2d03ca++){var _0x4ca00b=events[_0x2d03ca];var _0x5204fb=createListener(_0xab72('0x8')+_0x4ca00b,_0x368134);MailQueueEvents['on'](_0x4ca00b,_0x5204fb);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 6046e77..3370b06 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 _0x1ccd=['/describe','describe','/:id','post','create','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0x1ccd,0xed));var _0xd1cc=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0x1ccd[_0x1d70db];return _0x3060c6;};'use strict';var multer=require('multer');var util=require(_0xd1cc('0x0'));var path=require(_0xd1cc('0x1'));var timeout=require(_0xd1cc('0x2'));var express=require('express');var router=express[_0xd1cc('0x3')]();var fs_extra=require(_0xd1cc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd1cc('0x5'));var config=require('../../config/environment');var controller=require(_0xd1cc('0x6'));router[_0xd1cc('0x7')]('/',auth[_0xd1cc('0x8')](),controller[_0xd1cc('0x9')]);router['get'](_0xd1cc('0xa'),auth[_0xd1cc('0x8')](),controller[_0xd1cc('0xb')]);router[_0xd1cc('0x7')](_0xd1cc('0xc'),auth[_0xd1cc('0x8')](),controller['show']);router[_0xd1cc('0xd')]('/',auth['isAuthenticated'](),controller[_0xd1cc('0xe')]);router['put'](_0xd1cc('0xc'),auth[_0xd1cc('0x8')](),controller[_0xd1cc('0xf')]);router[_0xd1cc('0x10')](_0xd1cc('0xc'),auth[_0xd1cc('0x8')](),controller[_0xd1cc('0x11')]);module[_0xd1cc('0x12')]=router; \ No newline at end of file +var _0x2424=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports'];(function(_0x22d655,_0x3941dd){var _0x257739=function(_0x98136e){while(--_0x98136e){_0x22d655['push'](_0x22d655['shift']());}};_0x257739(++_0x3941dd);}(_0x2424,0xd1));var _0x4242=function(_0x18b280,_0x217036){_0x18b280=_0x18b280-0x0;var _0x250f2b=_0x2424[_0x18b280];return _0x250f2b;};'use strict';var multer=require(_0x4242('0x0'));var util=require('util');var path=require(_0x4242('0x1'));var timeout=require(_0x4242('0x2'));var express=require(_0x4242('0x3'));var router=express['Router']();var fs_extra=require(_0x4242('0x4'));var auth=require(_0x4242('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0x4242('0x6')]('/',auth['isAuthenticated'](),controller[_0x4242('0x7')]);router[_0x4242('0x6')](_0x4242('0x8'),auth[_0x4242('0x9')](),controller[_0x4242('0xa')]);router[_0x4242('0x6')](_0x4242('0xb'),auth[_0x4242('0x9')](),controller[_0x4242('0xc')]);router[_0x4242('0xd')]('/',auth[_0x4242('0x9')](),controller[_0x4242('0xe')]);router[_0x4242('0xf')](_0x4242('0xb'),auth['isAuthenticated'](),controller[_0x4242('0x10')]);router[_0x4242('0x11')]('/:id',auth[_0x4242('0x9')](),controller['destroy']);module[_0x4242('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 613c545..f01165c 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 _0x36aa=['sequelize','exports','STRING','DATE'];(function(_0x4593e2,_0x4de5f0){var _0x8c7ce2=function(_0x116450){while(--_0x116450){_0x4593e2['push'](_0x4593e2['shift']());}};_0x8c7ce2(++_0x4de5f0);}(_0x36aa,0x1b8));var _0xa36a=function(_0x38ff51,_0x1a9766){_0x38ff51=_0x38ff51-0x0;var _0x1309e2=_0x36aa[_0x38ff51];return _0x1309e2;};'use strict';var moment=require('moment');var Sequelize=require(_0xa36a('0x0'));module[_0xa36a('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa36a('0x2')]},'joinAt':{'type':Sequelize[_0xa36a('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa36a('0x3')]},'exitAt':{'type':Sequelize[_0xa36a('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xce39=['exports','STRING','DATE','moment','sequelize'];(function(_0x22afc2,_0x127672){var _0x345d9c=function(_0x1fd07f){while(--_0x1fd07f){_0x22afc2['push'](_0x22afc2['shift']());}};_0x345d9c(++_0x127672);}(_0xce39,0x198));var _0x9ce3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xce39[_0x2641f9];return _0x585741;};'use strict';var moment=require(_0x9ce3('0x0'));var Sequelize=require(_0x9ce3('0x1'));module[_0x9ce3('0x2')]={'uniqueid':{'type':Sequelize[_0x9ce3('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9ce3('0x4')]},'leaveAt':{'type':Sequelize[_0x9ce3('0x4')]},'acceptAt':{'type':Sequelize[_0x9ce3('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x9ce3('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 8c9a3b2..63a87e7 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 _0x66fa=['end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','MailQueueReport','findAll','rows','catch','merge','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x66fa,0x117));var _0xa66f=function(_0x1ce1d5,_0x3cbecd){_0x1ce1d5=_0x1ce1d5-0x0;var _0x48e249=_0x66fa[_0x1ce1d5];return _0x48e249;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){_0x5cbd82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed98b9,_0x598942){return function(_0x3a3e4f){if(!_0x3a3e4f){_0xed98b9[_0xa66f('0x24')](0x194);}return _0x3a3e4f;};}function handleError(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0x1f4;return function(_0x4683c7){logger[_0xa66f('0x25')](_0x4683c7[_0xa66f('0x26')]);if(_0x4683c7[_0xa66f('0x27')]){delete _0x4683c7[_0xa66f('0x27')];}_0x384164[_0xa66f('0x16')](_0x57da7f)[_0xa66f('0x28')](_0x4683c7);};}exports[_0xa66f('0x29')]=function(_0x20ee67,_0x117d03){var _0x45f71c={},_0x63650b={},_0x42b966={'count':0x0,'rows':[]};var _0xeeb22e=_['map'](db['MailQueueReport'][_0xa66f('0x2a')],function(_0x27ceae){return{'name':_0x27ceae['fieldName'],'type':_0x27ceae[_0xa66f('0x2b')][_0xa66f('0x2c')]};});_0x63650b['model']=_[_0xa66f('0x2d')](_0xeeb22e,_0xa66f('0x27'));_0x63650b[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x20ee67[_0xa66f('0x2e')]);_0x63650b['filters']=_[_0xa66f('0x30')](_0x63650b['model'],_0x63650b[_0xa66f('0x2e')]);_0x45f71c[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x63650b['model'],qs[_0xa66f('0x32')](_0x20ee67[_0xa66f('0x2e')]['fields']));_0x45f71c[_0xa66f('0x31')]=_0x45f71c[_0xa66f('0x31')][_0xa66f('0x33')]?_0x45f71c[_0xa66f('0x31')]:_0x63650b[_0xa66f('0x34')];if(!_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x35')](_0xa66f('0x36'))){_0x45f71c[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x20ee67['query'][_0xa66f('0x19')]);_0x45f71c['offset']=qs[_0xa66f('0x1b')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x1b')]);}_0x45f71c[_0xa66f('0x37')]=qs[_0xa66f('0x38')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x38')]);_0x45f71c[_0xa66f('0x39')]=qs['filters'](_[_0xa66f('0x3a')](_0x20ee67['query'],_0x63650b[_0xa66f('0x3b')]),_0xeeb22e);if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3c')]){_0x45f71c['where']=_['merge'](_0x45f71c[_0xa66f('0x39')],{'$or':_[_0xa66f('0x2d')](_0xeeb22e,function(_0x20b07e){if(_0x20b07e[_0xa66f('0x2b')]!==_0xa66f('0x3d')){var _0x581dca={};_0x581dca[_0x20b07e['name']]={'$like':'%'+_0x20ee67['query'][_0xa66f('0x3c')]+'%'};return _0x581dca;}})});}_0x45f71c=_['merge']({},_0x45f71c,_0x20ee67['options']);var _0x5bf856={'where':_0x45f71c[_0xa66f('0x39')]};return db['MailQueueReport'][_0xa66f('0x1a')](_0x5bf856)[_0xa66f('0x22')](function(_0x23a546){_0x42b966[_0xa66f('0x1a')]=_0x23a546;if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x45f71c[_0xa66f('0x3f')]=[{'all':!![]}];}return db[_0xa66f('0x40')][_0xa66f('0x41')](_0x45f71c);})[_0xa66f('0x22')](function(_0x3a7929){_0x42b966[_0xa66f('0x42')]=_0x3a7929;return _0x42b966;})[_0xa66f('0x22')](respondWithFilteredResult(_0x117d03,_0x45f71c))[_0xa66f('0x43')](handleError(_0x117d03,null));};exports['show']=function(_0x36037c,_0x25c2cb){var _0x58c1f2={'raw':!![],'where':{'id':_0x36037c['params']['id']}},_0x248587={};_0x248587[_0xa66f('0x34')]=_[_0xa66f('0x2f')](db['MailQueueReport'][_0xa66f('0x2a')]);_0x248587[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x36037c['query']);_0x248587[_0xa66f('0x3b')]=_['intersection'](_0x248587[_0xa66f('0x34')],_0x248587[_0xa66f('0x2e')]);_0x58c1f2[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x248587[_0xa66f('0x34')],qs[_0xa66f('0x32')](_0x36037c[_0xa66f('0x2e')]['fields']));_0x58c1f2[_0xa66f('0x31')]=_0x58c1f2[_0xa66f('0x31')][_0xa66f('0x33')]?_0x58c1f2[_0xa66f('0x31')]:_0x248587[_0xa66f('0x34')];if(_0x36037c['query']['includeAll']){_0x58c1f2[_0xa66f('0x3f')]=[{'all':!![]}];}_0x58c1f2=_[_0xa66f('0x44')]({},_0x58c1f2,_0x36037c[_0xa66f('0x45')]);return db[_0xa66f('0x40')][_0xa66f('0x46')](_0x58c1f2)[_0xa66f('0x22')](handleEntityNotFound(_0x25c2cb,null))['then'](respondWithResult(_0x25c2cb,null))[_0xa66f('0x43')](handleError(_0x25c2cb,null));};exports[_0xa66f('0x47')]=function(_0x3f9cdd,_0x5651e9){return db['MailQueueReport'][_0xa66f('0x47')](_0x3f9cdd[_0xa66f('0x48')],{})[_0xa66f('0x22')](respondWithResult(_0x5651e9,0xc9))['catch'](handleError(_0x5651e9,null));};exports['update']=function(_0x52054e,_0x19e7ce){if(_0x52054e[_0xa66f('0x48')]['id']){delete _0x52054e[_0xa66f('0x48')]['id'];}return db[_0xa66f('0x40')][_0xa66f('0x46')]({'where':{'id':_0x52054e[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x19e7ce,null))[_0xa66f('0x22')](saveUpdates(_0x52054e['body'],null))[_0xa66f('0x22')](respondWithResult(_0x19e7ce,null))[_0xa66f('0x43')](handleError(_0x19e7ce,null));};exports[_0xa66f('0x23')]=function(_0x393755,_0x11597b){return db[_0xa66f('0x40')]['find']({'where':{'id':_0x393755[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x11597b,null))[_0xa66f('0x22')](removeEntity(_0x11597b,null))[_0xa66f('0x43')](handleError(_0x11597b,null));};exports[_0xa66f('0x4a')]=function(_0x5d77d1,_0x389b9a){return db['MailQueueReport'][_0xa66f('0x4a')]()['then'](respondWithResult(_0x389b9a,null))['catch'](handleError(_0x389b9a,null));}; \ No newline at end of file +var _0x3a6d=['keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','where','type','options','includeAll','rows','catch','params','rawAttributes','merge','find','create','body','update','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','save','then','error','stack','name','send','index','map','MailQueueReport','fieldName','key','query'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3a6d,0x143));var _0xd3a6=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3a6d[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0xd3a6('0x0'));var rimraf=require(_0xd3a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3a6('0x2'));var rp=require(_0xd3a6('0x3'));var moment=require(_0xd3a6('0x4'));var BPromise=require(_0xd3a6('0x5'));var Mustache=require(_0xd3a6('0x6'));var util=require('util');var path=require(_0xd3a6('0x7'));var sox=require(_0xd3a6('0x8'));var csv=require(_0xd3a6('0x9'));var ejs=require(_0xd3a6('0xa'));var fs=require('fs');var fs_extra=require(_0xd3a6('0xb'));var _=require(_0xd3a6('0xc'));var squel=require('squel');var crypto=require(_0xd3a6('0xd'));var jsforce=require(_0xd3a6('0xe'));var deskjs=require(_0xd3a6('0xf'));var toCsv=require(_0xd3a6('0x9'));var querystring=require(_0xd3a6('0x10'));var Papa=require(_0xd3a6('0x11'));var Redis=require(_0xd3a6('0x12'));var authService=require(_0xd3a6('0x13'));var qs=require(_0xd3a6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3a6('0x15'));var logger=require(_0xd3a6('0x16'))(_0xd3a6('0x17'));var utils=require(_0xd3a6('0x18'));var config=require(_0xd3a6('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b0467,_0x1c6ad7){_0x1c6ad7=_0x1c6ad7||0xcc;return function(_0x671004){if(_0x671004){return _0x4b0467[_0xd3a6('0x1a')](_0x1c6ad7);}return _0x4b0467[_0xd3a6('0x1b')](_0x1c6ad7)[_0xd3a6('0x1c')]();};}function respondWithResult(_0x2911a0,_0xa56452){_0xa56452=_0xa56452||0xc8;return function(_0x4e67fb){if(_0x4e67fb){return _0x2911a0[_0xd3a6('0x1b')](_0xa56452)[_0xd3a6('0x1d')](_0x4e67fb);}};}function respondWithFilteredResult(_0x171a8f,_0x500a37){return function(_0x3c2399){if(_0x3c2399){var _0x305b61=typeof _0x500a37[_0xd3a6('0x1e')]==='undefined'&&typeof _0x500a37[_0xd3a6('0x1f')]==='undefined';var _0x518b6d=_0x3c2399[_0xd3a6('0x20')];var _0x8d1286=_0x305b61?0x0:_0x500a37[_0xd3a6('0x1e')];var _0xbe58b4=_0x305b61?_0x3c2399[_0xd3a6('0x20')]:_0x500a37[_0xd3a6('0x1e')]+_0x500a37[_0xd3a6('0x1f')];var _0x4ec27c;if(_0xbe58b4>=_0x518b6d){_0xbe58b4=_0x518b6d;_0x4ec27c=0xc8;}else{_0x4ec27c=0xce;}_0x171a8f[_0xd3a6('0x1b')](_0x4ec27c);return _0x171a8f['set'](_0xd3a6('0x21'),_0x8d1286+'-'+_0xbe58b4+'/'+_0x518b6d)[_0xd3a6('0x1d')](_0x3c2399);}return null;};}function patchUpdates(_0x12f2c1){return function(_0x20a34e){try{jsonpatch[_0xd3a6('0x22')](_0x20a34e,_0x12f2c1,!![]);}catch(_0x6ecd88){return BPromise['reject'](_0x6ecd88);}return _0x20a34e[_0xd3a6('0x23')]();};}function saveUpdates(_0x422f5c,_0x57cf15){return function(_0x543a6a){if(_0x543a6a){return _0x543a6a['update'](_0x422f5c)['then'](function(_0x5c9075){return _0x5c9075;});}return null;};}function removeEntity(_0x98a12a,_0x400982){return function(_0x3d0b28){if(_0x3d0b28){return _0x3d0b28['destroy']()[_0xd3a6('0x24')](function(){_0x98a12a['status'](0xcc)[_0xd3a6('0x1c')]();});}};}function handleEntityNotFound(_0x16afc8,_0x429079){return function(_0x4f6130){if(!_0x4f6130){_0x16afc8[_0xd3a6('0x1a')](0x194);}return _0x4f6130;};}function handleError(_0x3bc8d1,_0x1b09ac){_0x1b09ac=_0x1b09ac||0x1f4;return function(_0x219e32){logger[_0xd3a6('0x25')](_0x219e32[_0xd3a6('0x26')]);if(_0x219e32['name']){delete _0x219e32[_0xd3a6('0x27')];}_0x3bc8d1[_0xd3a6('0x1b')](_0x1b09ac)[_0xd3a6('0x28')](_0x219e32);};}exports[_0xd3a6('0x29')]=function(_0x30abc2,_0x45c628){var _0x5c2186={},_0x535bd4={},_0x1f4859={'count':0x0,'rows':[]};var _0x210aa1=_[_0xd3a6('0x2a')](db[_0xd3a6('0x2b')]['rawAttributes'],function(_0x3de3bb){return{'name':_0x3de3bb[_0xd3a6('0x2c')],'type':_0x3de3bb['type'][_0xd3a6('0x2d')]};});_0x535bd4['model']=_[_0xd3a6('0x2a')](_0x210aa1,_0xd3a6('0x27'));_0x535bd4[_0xd3a6('0x2e')]=_[_0xd3a6('0x2f')](_0x30abc2[_0xd3a6('0x2e')]);_0x535bd4[_0xd3a6('0x30')]=_[_0xd3a6('0x31')](_0x535bd4['model'],_0x535bd4['query']);_0x5c2186[_0xd3a6('0x32')]=_[_0xd3a6('0x31')](_0x535bd4[_0xd3a6('0x33')],qs['fields'](_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x34')]));_0x5c2186[_0xd3a6('0x32')]=_0x5c2186[_0xd3a6('0x32')][_0xd3a6('0x35')]?_0x5c2186[_0xd3a6('0x32')]:_0x535bd4[_0xd3a6('0x33')];if(!_0x30abc2[_0xd3a6('0x2e')]['hasOwnProperty'](_0xd3a6('0x36'))){_0x5c2186[_0xd3a6('0x1f')]=qs[_0xd3a6('0x1f')](_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x1f')]);_0x5c2186[_0xd3a6('0x1e')]=qs['offset'](_0x30abc2[_0xd3a6('0x2e')]['offset']);}_0x5c2186[_0xd3a6('0x37')]=qs[_0xd3a6('0x38')](_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x38')]);_0x5c2186['where']=qs['filters'](_[_0xd3a6('0x39')](_0x30abc2[_0xd3a6('0x2e')],_0x535bd4[_0xd3a6('0x30')]),_0x210aa1);if(_0x30abc2['query'][_0xd3a6('0x3a')]){_0x5c2186[_0xd3a6('0x3b')]=_['merge'](_0x5c2186[_0xd3a6('0x3b')],{'$or':_['map'](_0x210aa1,function(_0x1e695a){if(_0x1e695a[_0xd3a6('0x3c')]!=='VIRTUAL'){var _0x219ba5={};_0x219ba5[_0x1e695a['name']]={'$like':'%'+_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x3a')]+'%'};return _0x219ba5;}})});}_0x5c2186=_['merge']({},_0x5c2186,_0x30abc2[_0xd3a6('0x3d')]);var _0xfcef03={'where':_0x5c2186[_0xd3a6('0x3b')]};return db[_0xd3a6('0x2b')]['count'](_0xfcef03)[_0xd3a6('0x24')](function(_0x324dbd){_0x1f4859[_0xd3a6('0x20')]=_0x324dbd;if(_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x3e')]){_0x5c2186['include']=[{'all':!![]}];}return db[_0xd3a6('0x2b')]['findAll'](_0x5c2186);})[_0xd3a6('0x24')](function(_0x1bc18a){_0x1f4859[_0xd3a6('0x3f')]=_0x1bc18a;return _0x1f4859;})['then'](respondWithFilteredResult(_0x45c628,_0x5c2186))[_0xd3a6('0x40')](handleError(_0x45c628,null));};exports['show']=function(_0x23aa99,_0x4cbf76){var _0x448213={'raw':!![],'where':{'id':_0x23aa99[_0xd3a6('0x41')]['id']}},_0x629153={};_0x629153[_0xd3a6('0x33')]=_[_0xd3a6('0x2f')](db[_0xd3a6('0x2b')][_0xd3a6('0x42')]);_0x629153['query']=_[_0xd3a6('0x2f')](_0x23aa99[_0xd3a6('0x2e')]);_0x629153[_0xd3a6('0x30')]=_[_0xd3a6('0x31')](_0x629153['model'],_0x629153[_0xd3a6('0x2e')]);_0x448213[_0xd3a6('0x32')]=_[_0xd3a6('0x31')](_0x629153[_0xd3a6('0x33')],qs[_0xd3a6('0x34')](_0x23aa99[_0xd3a6('0x2e')][_0xd3a6('0x34')]));_0x448213[_0xd3a6('0x32')]=_0x448213['attributes'][_0xd3a6('0x35')]?_0x448213[_0xd3a6('0x32')]:_0x629153[_0xd3a6('0x33')];if(_0x23aa99[_0xd3a6('0x2e')][_0xd3a6('0x3e')]){_0x448213['include']=[{'all':!![]}];}_0x448213=_[_0xd3a6('0x43')]({},_0x448213,_0x23aa99[_0xd3a6('0x3d')]);return db[_0xd3a6('0x2b')][_0xd3a6('0x44')](_0x448213)[_0xd3a6('0x24')](handleEntityNotFound(_0x4cbf76,null))[_0xd3a6('0x24')](respondWithResult(_0x4cbf76,null))[_0xd3a6('0x40')](handleError(_0x4cbf76,null));};exports[_0xd3a6('0x45')]=function(_0x4ac576,_0x7828c2){return db['MailQueueReport'][_0xd3a6('0x45')](_0x4ac576[_0xd3a6('0x46')],{})['then'](respondWithResult(_0x7828c2,0xc9))[_0xd3a6('0x40')](handleError(_0x7828c2,null));};exports[_0xd3a6('0x47')]=function(_0x3cf99a,_0x375067){if(_0x3cf99a[_0xd3a6('0x46')]['id']){delete _0x3cf99a[_0xd3a6('0x46')]['id'];}return db[_0xd3a6('0x2b')][_0xd3a6('0x44')]({'where':{'id':_0x3cf99a[_0xd3a6('0x41')]['id']}})[_0xd3a6('0x24')](handleEntityNotFound(_0x375067,null))['then'](saveUpdates(_0x3cf99a[_0xd3a6('0x46')],null))[_0xd3a6('0x24')](respondWithResult(_0x375067,null))[_0xd3a6('0x40')](handleError(_0x375067,null));};exports[_0xd3a6('0x48')]=function(_0x26bd65,_0x225393){return db[_0xd3a6('0x2b')][_0xd3a6('0x44')]({'where':{'id':_0x26bd65[_0xd3a6('0x41')]['id']}})[_0xd3a6('0x24')](handleEntityNotFound(_0x225393,null))['then'](removeEntity(_0x225393,null))[_0xd3a6('0x40')](handleError(_0x225393,null));};exports[_0xd3a6('0x49')]=function(_0x618b72,_0x4995b7){return db[_0xd3a6('0x2b')]['describe']()['then'](respondWithResult(_0x4995b7,null))['catch'](handleError(_0x4995b7,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 9228199..02c14ae 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 _0x557b=['uniqueid','../../config/logger','api','moment','bluebird','request-promise','rimraf','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue'];(function(_0x569962,_0x547d2e){var _0x3ee12f=function(_0x539988){while(--_0x539988){_0x569962['push'](_0x569962['shift']());}};_0x3ee12f(++_0x547d2e);}(_0x557b,0x1b9));var _0xb557=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x557b[_0x298ed3];return _0x5aad28;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb557('0x0'))(_0xb557('0x1'));var moment=require(_0xb557('0x2'));var BPromise=require(_0xb557('0x3'));var rp=require(_0xb557('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb557('0x5'));var config=require('../../config/environment');var attributes=require(_0xb557('0x6'));module['exports']=function(_0x574b4e,_0x5c6bff){return _0x574b4e[_0xb557('0x7')](_0xb557('0x8'),attributes,{'tableName':_0xb557('0x9'),'paranoid':![],'indexes':[{'name':_0xb557('0xa'),'fields':[_0xb557('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x241a=['./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0x241a,0x13d));var _0xa241=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x241a[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0xa241('0x0'));var util=require('util');var logger=require(_0xa241('0x1'))(_0xa241('0x2'));var moment=require(_0xa241('0x3'));var BPromise=require(_0xa241('0x4'));var rp=require(_0xa241('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa241('0x6'));var attributes=require(_0xa241('0x7'));module[_0xa241('0x8')]=function(_0x2ce6d7,_0xb9e036){return _0x2ce6d7['define'](_0xa241('0x9'),attributes,{'tableName':_0xa241('0xa'),'paranoid':![],'indexes':[{'name':_0xa241('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 261224b..0eda4b0 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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0xfc5bf5,_0x3fdb1f){var _0x3851aa=function(_0xe4a6c1){while(--_0xe4a6c1){_0xfc5bf5['push'](_0xfc5bf5['shift']());}};_0x3851aa(++_0x3fdb1f);}(_0x7a54,0x106));var _0x47a5=function(_0x30964c,_0x18feb8){_0x30964c=_0x30964c-0x0;var _0x5cf40=_0x7a54[_0x30964c];return _0x5cf40;};'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')]('MailQueueReport,\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['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ 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(_0x7a4349,_0x567101){var _0x44fecc=function(_0x265082){while(--_0x265082){_0x7a4349['push'](_0x7a4349['shift']());}};_0x44fecc(++_0x567101);}(_0x5f2f,0x73));var _0xf5f2=function(_0x139455,_0x1f8eab){_0x139455=_0x139455-0x0;var _0x379746=_0x5f2f[_0x139455];return _0x379746;};'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 f44b645..88d1a6e 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4bc6bc,_0x4519bd){var _0x54bf9e=function(_0x203ae4){while(--_0x203ae4){_0x4bc6bc['push'](_0x4bc6bc['shift']());}};_0x54bf9e(++_0x4519bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x38299a,_0x37f140){var _0x3dfd80=function(_0x2149d6){while(--_0x2149d6){_0x38299a['push'](_0x38299a['shift']());}};_0x3dfd80(++_0x37f140);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index e45f0bc..2bebf04 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 _0x6984=['STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x168e20,_0x4c132a){var _0x5c1732=function(_0x537a8d){while(--_0x537a8d){_0x168e20['push'](_0x168e20['shift']());}};_0x5c1732(++_0x4c132a);}(_0x6984,0x103));var _0x4698=function(_0x40da4c,_0x24acd4){_0x40da4c=_0x40da4c-0x0;var _0x115577=_0x6984[_0x40da4c];return _0x115577;};'use strict';var Sequelize=require(_0x4698('0x0'));module['exports']={'description':{'type':Sequelize[_0x4698('0x1')]},'host':{'type':Sequelize[_0x4698('0x1')]},'authentication':{'type':Sequelize[_0x4698('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x4698('0x1')]},'password':{'type':Sequelize[_0x4698('0x1')]},'port':{'type':Sequelize[_0x4698('0x3')]},'tls':{'type':Sequelize[_0x4698('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4698('0x1')],'defaultValue':_0x4698('0x4')},'connTimeout':{'type':Sequelize[_0x4698('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4698('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x4698('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x72d7=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x1f562f,_0x5d190b){var _0x47a874=function(_0x20d111){while(--_0x20d111){_0x1f562f['push'](_0x1f562f['shift']());}};_0x47a874(++_0x5d190b);}(_0x72d7,0x81));var _0x772d=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x72d7[_0x13ea00];return _0x1f7347;};'use strict';var Sequelize=require(_0x772d('0x0'));module['exports']={'description':{'type':Sequelize[_0x772d('0x1')]},'host':{'type':Sequelize[_0x772d('0x1')]},'authentication':{'type':Sequelize[_0x772d('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x772d('0x1')]},'password':{'type':Sequelize[_0x772d('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x772d('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x772d('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x772d('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x772d('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index e7fabfd..ed808fd 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 _0xc051=['moment','request-promise','path','rimraf','../../config/environment','exports','MailServerIn','mail_servers_in','../../config/logger','api'];(function(_0x5ac6f3,_0x42d31f){var _0x58ef8e=function(_0x5e8d88){while(--_0x5e8d88){_0x5ac6f3['push'](_0x5ac6f3['shift']());}};_0x58ef8e(++_0x42d31f);}(_0xc051,0xc6));var _0x1c05=function(_0x3c6f0e,_0x53fea4){_0x3c6f0e=_0x3c6f0e-0x0;var _0x1b11e7=_0xc051[_0x3c6f0e];return _0x1b11e7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1c05('0x0'))(_0x1c05('0x1'));var moment=require(_0x1c05('0x2'));var BPromise=require('bluebird');var rp=require(_0x1c05('0x3'));var fs=require('fs');var path=require(_0x1c05('0x4'));var rimraf=require(_0x1c05('0x5'));var config=require(_0x1c05('0x6'));var attributes=require('./mailServerIn.attributes');module[_0x1c05('0x7')]=function(_0x6cf8ef,_0x4fd6af){return _0x6cf8ef['define'](_0x1c05('0x8'),attributes,{'tableName':_0x1c05('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5924=['path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','moment','bluebird','request-promise'];(function(_0x29ca10,_0x592b1c){var _0x4b0ee1=function(_0x504f42){while(--_0x504f42){_0x29ca10['push'](_0x29ca10['shift']());}};_0x4b0ee1(++_0x592b1c);}(_0x5924,0x7d));var _0x4592=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x5924[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x4592('0x0'));var util=require(_0x4592('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4592('0x2'));var BPromise=require(_0x4592('0x3'));var rp=require(_0x4592('0x4'));var fs=require('fs');var path=require(_0x4592('0x5'));var rimraf=require(_0x4592('0x6'));var config=require(_0x4592('0x7'));var attributes=require(_0x4592('0x8'));module[_0x4592('0x9')]=function(_0xec5797,_0x1024ee){return _0xec5797[_0x4592('0xa')](_0x4592('0xb'),attributes,{'tableName':_0x4592('0xc'),'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 61ffff9..19a1c32 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 _0x51ac=['result','catch','MailServerIn','findAll','options','where','attributes','include','map','model','GetMailServerIn','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message'];(function(_0x4150ff,_0x1fb505){var _0x10fa8d=function(_0x563b62){while(--_0x563b62){_0x4150ff['push'](_0x4150ff['shift']());}};_0x10fa8d(++_0x1fb505);}(_0x51ac,0x6c));var _0xc51a=function(_0x4df9bc,_0x5ecd12){_0x4df9bc=_0x4df9bc-0x0;var _0x558ad2=_0x51ac[_0x4df9bc];return _0x558ad2;};'use strict';var _=require(_0xc51a('0x0'));var util=require(_0xc51a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc51a('0x2'));var fs=require('fs');var Redis=require(_0xc51a('0x3'));var db=require(_0xc51a('0x4'))['db'];var utils=require(_0xc51a('0x5'));var logger=require(_0xc51a('0x6'))(_0xc51a('0x7'));var config=require('../../config/environment');var jayson=require(_0xc51a('0x8'));var client=jayson['client'][_0xc51a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x454aca,_0x5badbd,_0x561d20){return new BPromise(function(_0x2cda37,_0x1598bf){return client[_0xc51a('0xa')](_0x454aca,_0x561d20)[_0xc51a('0xb')](function(_0x62cce1){logger[_0xc51a('0xc')]('MailServerIn,\x20%s,\x20%s',_0x5badbd,_0xc51a('0xd'));logger['debug'](_0xc51a('0xe'),_0x5badbd,_0xc51a('0xd'),JSON[_0xc51a('0xf')](_0x62cce1));if(_0x62cce1[_0xc51a('0x10')]){if(_0x62cce1[_0xc51a('0x10')][_0xc51a('0x11')]===0x1f4){logger[_0xc51a('0x10')](_0xc51a('0x12'),_0x5badbd,_0x62cce1[_0xc51a('0x10')][_0xc51a('0x13')]);return _0x1598bf(_0x62cce1[_0xc51a('0x10')][_0xc51a('0x13')]);}logger['error'](_0xc51a('0x12'),_0x5badbd,_0x62cce1['error'][_0xc51a('0x13')]);return _0x2cda37(_0x62cce1[_0xc51a('0x10')]['message']);}else{logger[_0xc51a('0xc')]('MailServerIn,\x20%s,\x20%s',_0x5badbd,_0xc51a('0xd'));_0x2cda37(_0x62cce1[_0xc51a('0x14')][_0xc51a('0x13')]);}})[_0xc51a('0x15')](function(_0x2ea6b0){logger[_0xc51a('0x10')]('MailServerIn,\x20%s,\x20%s',_0x5badbd,_0x2ea6b0);_0x1598bf(_0x2ea6b0);});});}exports['GetMailServerIn']=function(_0xbd57bb){var _0x260af1=this;return new Promise(function(_0x12e68d,_0x15a9f0){return db[_0xc51a('0x16')][_0xc51a('0x17')]({'raw':_0xbd57bb[_0xc51a('0x18')]?_0xbd57bb[_0xc51a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xbd57bb[_0xc51a('0x18')]?_0xbd57bb[_0xc51a('0x18')][_0xc51a('0x19')]||null:null,'attributes':_0xbd57bb[_0xc51a('0x18')]?_0xbd57bb[_0xc51a('0x18')][_0xc51a('0x1a')]||null:null,'limit':_0xbd57bb['options']?_0xbd57bb['options']['limit']||null:null,'include':_0xbd57bb[_0xc51a('0x18')]?_0xbd57bb['options'][_0xc51a('0x1b')]?_[_0xc51a('0x1c')](_0xbd57bb[_0xc51a('0x18')][_0xc51a('0x1b')],function(_0x36e429){return{'model':db[_0x36e429[_0xc51a('0x1d')]],'as':_0x36e429['as'],'attributes':_0x36e429[_0xc51a('0x1a')],'include':_0x36e429[_0xc51a('0x1b')]?_[_0xc51a('0x1c')](_0x36e429[_0xc51a('0x1b')],function(_0xe7e910){return{'model':db[_0xe7e910[_0xc51a('0x1d')]],'as':_0xe7e910['as'],'attributes':_0xe7e910[_0xc51a('0x1a')],'include':_0xe7e910[_0xc51a('0x1b')]?_[_0xc51a('0x1c')](_0xe7e910[_0xc51a('0x1b')],function(_0x5003ea){return{'model':db[_0x5003ea[_0xc51a('0x1d')]],'as':_0x5003ea['as'],'attributes':_0x5003ea[_0xc51a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc51a('0xb')](function(_0x38f219){logger[_0xc51a('0xc')](_0xc51a('0x1e'),_0xbd57bb);logger[_0xc51a('0x1f')]('GetMailServerIn',_0xbd57bb,JSON[_0xc51a('0xf')](_0x38f219));_0x12e68d(_0x38f219);})['catch'](function(_0x276fa4){logger[_0xc51a('0x10')]('GetMailServerIn',_0x276fa4[_0xc51a('0x13')],_0xbd57bb);_0x15a9f0(_0x260af1[_0xc51a('0x10')](0x1f4,_0x276fa4[_0xc51a('0x13')]));});});}; \ No newline at end of file +var _0x2917=['../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetMailServerIn','findAll','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x4b8bce,_0x234f0c){var _0x338e75=function(_0x340584){while(--_0x340584){_0x4b8bce['push'](_0x4b8bce['shift']());}};_0x338e75(++_0x234f0c);}(_0x2917,0x142));var _0x7291=function(_0x3cf5a3,_0x5a4492){_0x3cf5a3=_0x3cf5a3-0x0;var _0x39ba2d=_0x2917[_0x3cf5a3];return _0x39ba2d;};'use strict';var _=require(_0x7291('0x0'));var util=require(_0x7291('0x1'));var moment=require(_0x7291('0x2'));var BPromise=require(_0x7291('0x3'));var rs=require(_0x7291('0x4'));var fs=require('fs');var Redis=require(_0x7291('0x5'));var db=require(_0x7291('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7291('0x7'));var config=require(_0x7291('0x8'));var jayson=require(_0x7291('0x9'));var client=jayson[_0x7291('0xa')][_0x7291('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x237997,_0x4609af,_0x1f0fd8){return new BPromise(function(_0x452fc5,_0xb013b3){return client[_0x7291('0xc')](_0x237997,_0x1f0fd8)[_0x7291('0xd')](function(_0x27f037){logger[_0x7291('0xe')](_0x7291('0xf'),_0x4609af,'request\x20sent');logger[_0x7291('0x10')](_0x7291('0x11'),_0x4609af,_0x7291('0x12'),JSON[_0x7291('0x13')](_0x27f037));if(_0x27f037[_0x7291('0x14')]){if(_0x27f037[_0x7291('0x14')]['code']===0x1f4){logger['error'](_0x7291('0xf'),_0x4609af,_0x27f037[_0x7291('0x14')][_0x7291('0x15')]);return _0xb013b3(_0x27f037[_0x7291('0x14')][_0x7291('0x15')]);}logger[_0x7291('0x14')](_0x7291('0xf'),_0x4609af,_0x27f037['error'][_0x7291('0x15')]);return _0x452fc5(_0x27f037[_0x7291('0x14')][_0x7291('0x15')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x4609af,_0x7291('0x12'));_0x452fc5(_0x27f037[_0x7291('0x16')][_0x7291('0x15')]);}})[_0x7291('0x17')](function(_0x427602){logger[_0x7291('0x14')]('MailServerIn,\x20%s,\x20%s',_0x4609af,_0x427602);_0xb013b3(_0x427602);});});}exports[_0x7291('0x18')]=function(_0x1680d2){var _0x9c2228=this;return new Promise(function(_0x4264ed,_0x1634c1){return db['MailServerIn'][_0x7291('0x19')]({'raw':_0x1680d2['options']?_0x1680d2[_0x7291('0x1a')][_0x7291('0x1b')]===undefined?!![]:![]:!![],'where':_0x1680d2[_0x7291('0x1a')]?_0x1680d2['options'][_0x7291('0x1c')]||null:null,'attributes':_0x1680d2['options']?_0x1680d2[_0x7291('0x1a')][_0x7291('0x1d')]||null:null,'limit':_0x1680d2['options']?_0x1680d2['options']['limit']||null:null,'include':_0x1680d2[_0x7291('0x1a')]?_0x1680d2['options'][_0x7291('0x1e')]?_[_0x7291('0x1f')](_0x1680d2['options'][_0x7291('0x1e')],function(_0x5c5970){return{'model':db[_0x5c5970[_0x7291('0x20')]],'as':_0x5c5970['as'],'attributes':_0x5c5970[_0x7291('0x1d')],'include':_0x5c5970['include']?_[_0x7291('0x1f')](_0x5c5970[_0x7291('0x1e')],function(_0x32169c){return{'model':db[_0x32169c[_0x7291('0x20')]],'as':_0x32169c['as'],'attributes':_0x32169c[_0x7291('0x1d')],'include':_0x32169c[_0x7291('0x1e')]?_[_0x7291('0x1f')](_0x32169c[_0x7291('0x1e')],function(_0x3fd1d2){return{'model':db[_0x3fd1d2['model']],'as':_0x3fd1d2['as'],'attributes':_0x3fd1d2[_0x7291('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7291('0xd')](function(_0x4e2efa){logger[_0x7291('0xe')](_0x7291('0x18'),_0x1680d2);logger['debug'](_0x7291('0x18'),_0x1680d2,JSON[_0x7291('0x13')](_0x4e2efa));_0x4264ed(_0x4e2efa);})['catch'](function(_0x31207c){logger[_0x7291('0x14')](_0x7291('0x18'),_0x31207c['message'],_0x1680d2);_0x1634c1(_0x9c2228[_0x7291('0x14')](0x1f4,_0x31207c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 795cc01..5e12086 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(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x7a54,0x106));var _0x47a5=function(_0x1bd932,_0x4db894){_0x1bd932=_0x1bd932-0x0;var _0x16a483=_0x7a54[_0x1bd932];return _0x16a483;};'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(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x7a54,0x106));var _0x47a5=function(_0x35a414,_0x5bee83){_0x35a414=_0x35a414-0x0;var _0x26b8f2=_0x7a54[_0x35a414];return _0x26b8f2;};'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 3a407b5..70fe9ab 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 _0x065e=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0xdacc0d,_0x107213){var _0x103f1f=function(_0x3a7944){while(--_0x3a7944){_0xdacc0d['push'](_0xdacc0d['shift']());}};_0x103f1f(++_0x107213);}(_0x065e,0x1a7));var _0xe065=function(_0x3c9ca0,_0x4ac698){_0x3c9ca0=_0x3c9ca0-0x0;var _0x22dcb6=_0x065e[_0x3c9ca0];return _0x22dcb6;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xe065('0x1')]},'pass':{'type':Sequelize[_0xe065('0x1')]},'port':{'type':Sequelize[_0xe065('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xe065('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xe065('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9ffd=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x1da2ac,_0xa39d62){var _0x3a3e64=function(_0x1a4b75){while(--_0x1a4b75){_0x1da2ac['push'](_0x1da2ac['shift']());}};_0x3a3e64(++_0xa39d62);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x160c45,_0x157a67){_0x160c45=_0x160c45-0x0;var _0x59bc36=_0x9ffd[_0x160c45];return _0x59bc36;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'description':{'type':Sequelize[_0xd9ff('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xd9ff('0x2')]},'pass':{'type':Sequelize[_0xd9ff('0x2')]},'port':{'type':Sequelize[_0xd9ff('0x3')]},'secure':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index bcd426c..b542f6c 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 _0x555c=['intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','MailServerOut','includeAll','rows','catch','show','params','find','create','body','update','destroy','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','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','filters','query'];(function(_0x37d25c,_0x56cd0f){var _0x47f2a4=function(_0x770c53){while(--_0x770c53){_0x37d25c['push'](_0x37d25c['shift']());}};_0x47f2a4(++_0x56cd0f);}(_0x555c,0xb0));var _0xc555=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x555c[_0xdc37a1];return _0x99b4fe;};'use strict';var emlformat=require(_0xc555('0x0'));var rimraf=require(_0xc555('0x1'));var zipdir=require(_0xc555('0x2'));var jsonpatch=require(_0xc555('0x3'));var rp=require(_0xc555('0x4'));var moment=require(_0xc555('0x5'));var BPromise=require(_0xc555('0x6'));var Mustache=require(_0xc555('0x7'));var util=require(_0xc555('0x8'));var path=require('path');var sox=require(_0xc555('0x9'));var csv=require(_0xc555('0xa'));var ejs=require(_0xc555('0xb'));var fs=require('fs');var fs_extra=require(_0xc555('0xc'));var _=require(_0xc555('0xd'));var squel=require(_0xc555('0xe'));var crypto=require(_0xc555('0xf'));var jsforce=require(_0xc555('0x10'));var deskjs=require(_0xc555('0x11'));var toCsv=require(_0xc555('0xa'));var querystring=require(_0xc555('0x12'));var Papa=require('papaparse');var Redis=require(_0xc555('0x13'));var authService=require(_0xc555('0x14'));var qs=require(_0xc555('0x15'));var as=require(_0xc555('0x16'));var hardwareService=require(_0xc555('0x17'));var logger=require(_0xc555('0x18'))('api');var utils=require(_0xc555('0x19'));var config=require(_0xc555('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x155b34,_0x4116b8){_0x4116b8=_0x4116b8||0xcc;return function(_0xbcf359){if(_0xbcf359){return _0x155b34[_0xc555('0x1b')](_0x4116b8);}return _0x155b34['status'](_0x4116b8)['end']();};}function respondWithResult(_0x5b1be9,_0x475b2a){_0x475b2a=_0x475b2a||0xc8;return function(_0x28c7d0){if(_0x28c7d0){return _0x5b1be9[_0xc555('0x1c')](_0x475b2a)[_0xc555('0x1d')](_0x28c7d0);}};}function respondWithFilteredResult(_0x3d5be4,_0x2ca8a8){return function(_0x41fc1e){if(_0x41fc1e){var _0x1f557c=typeof _0x2ca8a8[_0xc555('0x1e')]===_0xc555('0x1f')&&typeof _0x2ca8a8[_0xc555('0x20')]==='undefined';var _0x904905=_0x41fc1e[_0xc555('0x21')];var _0x101b69=_0x1f557c?0x0:_0x2ca8a8[_0xc555('0x1e')];var _0x1aff5a=_0x1f557c?_0x41fc1e['count']:_0x2ca8a8[_0xc555('0x1e')]+_0x2ca8a8[_0xc555('0x20')];var _0x52d57c;if(_0x1aff5a>=_0x904905){_0x1aff5a=_0x904905;_0x52d57c=0xc8;}else{_0x52d57c=0xce;}_0x3d5be4[_0xc555('0x1c')](_0x52d57c);return _0x3d5be4['set'](_0xc555('0x22'),_0x101b69+'-'+_0x1aff5a+'/'+_0x904905)[_0xc555('0x1d')](_0x41fc1e);}return null;};}function patchUpdates(_0x5089f5){return function(_0x457f7d){try{jsonpatch['apply'](_0x457f7d,_0x5089f5,!![]);}catch(_0x939dad){return BPromise[_0xc555('0x23')](_0x939dad);}return _0x457f7d[_0xc555('0x24')]();};}function saveUpdates(_0x1ddea3,_0x54dda9){return function(_0x1cfa3e){if(_0x1cfa3e){return _0x1cfa3e['update'](_0x1ddea3)[_0xc555('0x25')](function(_0x4a94c5){return _0x4a94c5;});}return null;};}function removeEntity(_0x2f38f2,_0x3d837d){return function(_0x3b5371){if(_0x3b5371){return _0x3b5371['destroy']()[_0xc555('0x25')](function(){_0x2f38f2[_0xc555('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52effe,_0x21d6cc){return function(_0x5eb906){if(!_0x5eb906){_0x52effe[_0xc555('0x1b')](0x194);}return _0x5eb906;};}function handleError(_0x3569aa,_0x343d14){_0x343d14=_0x343d14||0x1f4;return function(_0x2d80f2){logger[_0xc555('0x26')](_0x2d80f2[_0xc555('0x27')]);if(_0x2d80f2[_0xc555('0x28')]){delete _0x2d80f2[_0xc555('0x28')];}_0x3569aa[_0xc555('0x1c')](_0x343d14)[_0xc555('0x29')](_0x2d80f2);};}exports[_0xc555('0x2a')]=function(_0x4bab8d,_0xa87444){var _0x425b40={},_0x511772={},_0x4d6e76={'count':0x0,'rows':[]};var _0x28b028=_['map'](db['MailServerOut'][_0xc555('0x2b')],function(_0x2ea74e){return{'name':_0x2ea74e[_0xc555('0x2c')],'type':_0x2ea74e[_0xc555('0x2d')][_0xc555('0x2e')]};});_0x511772[_0xc555('0x2f')]=_[_0xc555('0x30')](_0x28b028,_0xc555('0x28'));_0x511772['query']=_[_0xc555('0x31')](_0x4bab8d['query']);_0x511772[_0xc555('0x32')]=_['intersection'](_0x511772[_0xc555('0x2f')],_0x511772[_0xc555('0x33')]);_0x425b40['attributes']=_[_0xc555('0x34')](_0x511772['model'],qs[_0xc555('0x35')](_0x4bab8d[_0xc555('0x33')][_0xc555('0x35')]));_0x425b40['attributes']=_0x425b40['attributes'][_0xc555('0x36')]?_0x425b40[_0xc555('0x37')]:_0x511772[_0xc555('0x2f')];if(!_0x4bab8d[_0xc555('0x33')][_0xc555('0x38')](_0xc555('0x39'))){_0x425b40['limit']=qs[_0xc555('0x20')](_0x4bab8d[_0xc555('0x33')][_0xc555('0x20')]);_0x425b40[_0xc555('0x1e')]=qs[_0xc555('0x1e')](_0x4bab8d[_0xc555('0x33')][_0xc555('0x1e')]);}_0x425b40[_0xc555('0x3a')]=qs[_0xc555('0x3b')](_0x4bab8d['query'][_0xc555('0x3b')]);_0x425b40[_0xc555('0x3c')]=qs[_0xc555('0x32')](_['pick'](_0x4bab8d[_0xc555('0x33')],_0x511772['filters']),_0x28b028);if(_0x4bab8d[_0xc555('0x33')][_0xc555('0x3d')]){_0x425b40[_0xc555('0x3c')]=_[_0xc555('0x3e')](_0x425b40[_0xc555('0x3c')],{'$or':_[_0xc555('0x30')](_0x28b028,function(_0x249db7){if(_0x249db7[_0xc555('0x2d')]!==_0xc555('0x3f')){var _0x570f34={};_0x570f34[_0x249db7['name']]={'$like':'%'+_0x4bab8d[_0xc555('0x33')][_0xc555('0x3d')]+'%'};return _0x570f34;}})});}_0x425b40=_['merge']({},_0x425b40,_0x4bab8d[_0xc555('0x40')]);var _0x3b6602={'where':_0x425b40[_0xc555('0x3c')]};return db[_0xc555('0x41')][_0xc555('0x21')](_0x3b6602)[_0xc555('0x25')](function(_0x546e08){_0x4d6e76[_0xc555('0x21')]=_0x546e08;if(_0x4bab8d['query'][_0xc555('0x42')]){_0x425b40['include']=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x425b40);})[_0xc555('0x25')](function(_0x9d6540){_0x4d6e76[_0xc555('0x43')]=_0x9d6540;return _0x4d6e76;})[_0xc555('0x25')](respondWithFilteredResult(_0xa87444,_0x425b40))[_0xc555('0x44')](handleError(_0xa87444,null));};exports[_0xc555('0x45')]=function(_0x5ba468,_0xfba1a2){var _0x2b2514={'raw':!![],'where':{'id':_0x5ba468[_0xc555('0x46')]['id']}},_0x30d61d={};_0x30d61d[_0xc555('0x2f')]=_[_0xc555('0x31')](db[_0xc555('0x41')]['rawAttributes']);_0x30d61d[_0xc555('0x33')]=_[_0xc555('0x31')](_0x5ba468[_0xc555('0x33')]);_0x30d61d['filters']=_['intersection'](_0x30d61d['model'],_0x30d61d['query']);_0x2b2514[_0xc555('0x37')]=_[_0xc555('0x34')](_0x30d61d[_0xc555('0x2f')],qs[_0xc555('0x35')](_0x5ba468[_0xc555('0x33')][_0xc555('0x35')]));_0x2b2514[_0xc555('0x37')]=_0x2b2514[_0xc555('0x37')][_0xc555('0x36')]?_0x2b2514[_0xc555('0x37')]:_0x30d61d['model'];if(_0x5ba468['query']['includeAll']){_0x2b2514['include']=[{'all':!![]}];}_0x2b2514=_['merge']({},_0x2b2514,_0x5ba468[_0xc555('0x40')]);return db[_0xc555('0x41')][_0xc555('0x47')](_0x2b2514)['then'](handleEntityNotFound(_0xfba1a2,null))[_0xc555('0x25')](respondWithResult(_0xfba1a2,null))[_0xc555('0x44')](handleError(_0xfba1a2,null));};exports['create']=function(_0x23bba5,_0x1a27b6){return db[_0xc555('0x41')][_0xc555('0x48')](_0x23bba5[_0xc555('0x49')],{})[_0xc555('0x25')](respondWithResult(_0x1a27b6,0xc9))[_0xc555('0x44')](handleError(_0x1a27b6,null));};exports[_0xc555('0x4a')]=function(_0x3c4913,_0x1e177f){if(_0x3c4913[_0xc555('0x49')]['id']){delete _0x3c4913['body']['id'];}return db[_0xc555('0x41')][_0xc555('0x47')]({'where':{'id':_0x3c4913[_0xc555('0x46')]['id']}})[_0xc555('0x25')](handleEntityNotFound(_0x1e177f,null))[_0xc555('0x25')](saveUpdates(_0x3c4913[_0xc555('0x49')],null))[_0xc555('0x25')](respondWithResult(_0x1e177f,null))[_0xc555('0x44')](handleError(_0x1e177f,null));};exports[_0xc555('0x4b')]=function(_0x5b4d83,_0x41d74f){return db[_0xc555('0x41')][_0xc555('0x47')]({'where':{'id':_0x5b4d83[_0xc555('0x46')]['id']}})[_0xc555('0x25')](handleEntityNotFound(_0x41d74f,null))['then'](removeEntity(_0x41d74f,null))[_0xc555('0x44')](handleError(_0x41d74f,null));}; \ No newline at end of file +var _0xfe85=['type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','create','body','params','find','rimraf','fast-json-patch','request-promise','bluebird','path','lodash','squel','crypto','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','stack','name','index','map','MailServerOut','rawAttributes'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0xfe85,0x1db));var _0x5fe8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe85[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5fe8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5fe8('0x1'));var rp=require(_0x5fe8('0x2'));var moment=require('moment');var BPromise=require(_0x5fe8('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5fe8('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5fe8('0x5'));var squel=require(_0x5fe8('0x6'));var crypto=require(_0x5fe8('0x7'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5fe8('0x8'));var querystring=require('querystring');var Papa=require(_0x5fe8('0x9'));var Redis=require('ioredis');var authService=require(_0x5fe8('0xa'));var qs=require(_0x5fe8('0xb'));var as=require(_0x5fe8('0xc'));var hardwareService=require(_0x5fe8('0xd'));var logger=require(_0x5fe8('0xe'))(_0x5fe8('0xf'));var utils=require(_0x5fe8('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x277def,_0x65d81f){_0x65d81f=_0x65d81f||0xcc;return function(_0x66ffd6){if(_0x66ffd6){return _0x277def[_0x5fe8('0x11')](_0x65d81f);}return _0x277def[_0x5fe8('0x12')](_0x65d81f)[_0x5fe8('0x13')]();};}function respondWithResult(_0x338869,_0x5698c2){_0x5698c2=_0x5698c2||0xc8;return function(_0xfa90c3){if(_0xfa90c3){return _0x338869[_0x5fe8('0x12')](_0x5698c2)[_0x5fe8('0x14')](_0xfa90c3);}};}function respondWithFilteredResult(_0x3bdf95,_0x5f4038){return function(_0x5927ba){if(_0x5927ba){var _0x34624c=typeof _0x5f4038['offset']===_0x5fe8('0x15')&&typeof _0x5f4038[_0x5fe8('0x16')]==='undefined';var _0x4e1fe9=_0x5927ba[_0x5fe8('0x17')];var _0x220c7d=_0x34624c?0x0:_0x5f4038[_0x5fe8('0x18')];var _0x16e756=_0x34624c?_0x5927ba['count']:_0x5f4038['offset']+_0x5f4038['limit'];var _0x3fbf02;if(_0x16e756>=_0x4e1fe9){_0x16e756=_0x4e1fe9;_0x3fbf02=0xc8;}else{_0x3fbf02=0xce;}_0x3bdf95['status'](_0x3fbf02);return _0x3bdf95['set'](_0x5fe8('0x19'),_0x220c7d+'-'+_0x16e756+'/'+_0x4e1fe9)['json'](_0x5927ba);}return null;};}function patchUpdates(_0x328b03){return function(_0x265714){try{jsonpatch['apply'](_0x265714,_0x328b03,!![]);}catch(_0x484215){return BPromise[_0x5fe8('0x1a')](_0x484215);}return _0x265714[_0x5fe8('0x1b')]();};}function saveUpdates(_0x4266e1,_0x5a55f8){return function(_0x47777a){if(_0x47777a){return _0x47777a[_0x5fe8('0x1c')](_0x4266e1)[_0x5fe8('0x1d')](function(_0x31b648){return _0x31b648;});}return null;};}function removeEntity(_0x1e6c71,_0x194731){return function(_0x3d2ad2){if(_0x3d2ad2){return _0x3d2ad2[_0x5fe8('0x1e')]()['then'](function(){_0x1e6c71[_0x5fe8('0x12')](0xcc)[_0x5fe8('0x13')]();});}};}function handleEntityNotFound(_0x2da709,_0x274024){return function(_0x3297fe){if(!_0x3297fe){_0x2da709[_0x5fe8('0x11')](0x194);}return _0x3297fe;};}function handleError(_0x3417d0,_0xadbb5f){_0xadbb5f=_0xadbb5f||0x1f4;return function(_0x3999a7){logger['error'](_0x3999a7[_0x5fe8('0x1f')]);if(_0x3999a7[_0x5fe8('0x20')]){delete _0x3999a7['name'];}_0x3417d0[_0x5fe8('0x12')](_0xadbb5f)['send'](_0x3999a7);};}exports[_0x5fe8('0x21')]=function(_0x3f1ef7,_0x48b642){var _0x4daf05={},_0x3a1288={},_0x466a72={'count':0x0,'rows':[]};var _0x1d49f6=_[_0x5fe8('0x22')](db[_0x5fe8('0x23')][_0x5fe8('0x24')],function(_0x4ee109){return{'name':_0x4ee109['fieldName'],'type':_0x4ee109[_0x5fe8('0x25')][_0x5fe8('0x26')]};});_0x3a1288['model']=_[_0x5fe8('0x22')](_0x1d49f6,'name');_0x3a1288['query']=_['keys'](_0x3f1ef7[_0x5fe8('0x27')]);_0x3a1288[_0x5fe8('0x28')]=_[_0x5fe8('0x29')](_0x3a1288[_0x5fe8('0x2a')],_0x3a1288[_0x5fe8('0x27')]);_0x4daf05[_0x5fe8('0x2b')]=_['intersection'](_0x3a1288[_0x5fe8('0x2a')],qs[_0x5fe8('0x2c')](_0x3f1ef7[_0x5fe8('0x27')][_0x5fe8('0x2c')]));_0x4daf05[_0x5fe8('0x2b')]=_0x4daf05[_0x5fe8('0x2b')][_0x5fe8('0x2d')]?_0x4daf05[_0x5fe8('0x2b')]:_0x3a1288[_0x5fe8('0x2a')];if(!_0x3f1ef7['query'][_0x5fe8('0x2e')](_0x5fe8('0x2f'))){_0x4daf05[_0x5fe8('0x16')]=qs['limit'](_0x3f1ef7['query'][_0x5fe8('0x16')]);_0x4daf05[_0x5fe8('0x18')]=qs[_0x5fe8('0x18')](_0x3f1ef7[_0x5fe8('0x27')]['offset']);}_0x4daf05[_0x5fe8('0x30')]=qs['sort'](_0x3f1ef7[_0x5fe8('0x27')][_0x5fe8('0x31')]);_0x4daf05[_0x5fe8('0x32')]=qs['filters'](_['pick'](_0x3f1ef7['query'],_0x3a1288[_0x5fe8('0x28')]),_0x1d49f6);if(_0x3f1ef7['query']['filter']){_0x4daf05[_0x5fe8('0x32')]=_[_0x5fe8('0x33')](_0x4daf05['where'],{'$or':_[_0x5fe8('0x22')](_0x1d49f6,function(_0xc3a212){if(_0xc3a212['type']!==_0x5fe8('0x34')){var _0x19a555={};_0x19a555[_0xc3a212[_0x5fe8('0x20')]]={'$like':'%'+_0x3f1ef7['query']['filter']+'%'};return _0x19a555;}})});}_0x4daf05=_[_0x5fe8('0x33')]({},_0x4daf05,_0x3f1ef7[_0x5fe8('0x35')]);var _0x48553b={'where':_0x4daf05[_0x5fe8('0x32')]};return db[_0x5fe8('0x23')][_0x5fe8('0x17')](_0x48553b)[_0x5fe8('0x1d')](function(_0x7c915f){_0x466a72[_0x5fe8('0x17')]=_0x7c915f;if(_0x3f1ef7[_0x5fe8('0x27')][_0x5fe8('0x36')]){_0x4daf05['include']=[{'all':!![]}];}return db[_0x5fe8('0x23')][_0x5fe8('0x37')](_0x4daf05);})[_0x5fe8('0x1d')](function(_0x451959){_0x466a72[_0x5fe8('0x38')]=_0x451959;return _0x466a72;})[_0x5fe8('0x1d')](respondWithFilteredResult(_0x48b642,_0x4daf05))[_0x5fe8('0x39')](handleError(_0x48b642,null));};exports[_0x5fe8('0x3a')]=function(_0xc215d5,_0x211223){var _0x28575a={'raw':!![],'where':{'id':_0xc215d5['params']['id']}},_0x7d5bdc={};_0x7d5bdc[_0x5fe8('0x2a')]=_[_0x5fe8('0x3b')](db[_0x5fe8('0x23')][_0x5fe8('0x24')]);_0x7d5bdc[_0x5fe8('0x27')]=_['keys'](_0xc215d5['query']);_0x7d5bdc[_0x5fe8('0x28')]=_[_0x5fe8('0x29')](_0x7d5bdc['model'],_0x7d5bdc['query']);_0x28575a[_0x5fe8('0x2b')]=_[_0x5fe8('0x29')](_0x7d5bdc[_0x5fe8('0x2a')],qs['fields'](_0xc215d5[_0x5fe8('0x27')]['fields']));_0x28575a[_0x5fe8('0x2b')]=_0x28575a[_0x5fe8('0x2b')]['length']?_0x28575a[_0x5fe8('0x2b')]:_0x7d5bdc['model'];if(_0xc215d5[_0x5fe8('0x27')][_0x5fe8('0x36')]){_0x28575a['include']=[{'all':!![]}];}_0x28575a=_['merge']({},_0x28575a,_0xc215d5[_0x5fe8('0x35')]);return db[_0x5fe8('0x23')]['find'](_0x28575a)[_0x5fe8('0x1d')](handleEntityNotFound(_0x211223,null))['then'](respondWithResult(_0x211223,null))[_0x5fe8('0x39')](handleError(_0x211223,null));};exports[_0x5fe8('0x3c')]=function(_0x140842,_0x1847c3){return db[_0x5fe8('0x23')][_0x5fe8('0x3c')](_0x140842['body'],{})[_0x5fe8('0x1d')](respondWithResult(_0x1847c3,0xc9))[_0x5fe8('0x39')](handleError(_0x1847c3,null));};exports[_0x5fe8('0x1c')]=function(_0x3b31ea,_0x3be097){if(_0x3b31ea[_0x5fe8('0x3d')]['id']){delete _0x3b31ea[_0x5fe8('0x3d')]['id'];}return db[_0x5fe8('0x23')]['find']({'where':{'id':_0x3b31ea[_0x5fe8('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3be097,null))[_0x5fe8('0x1d')](saveUpdates(_0x3b31ea['body'],null))['then'](respondWithResult(_0x3be097,null))[_0x5fe8('0x39')](handleError(_0x3be097,null));};exports[_0x5fe8('0x1e')]=function(_0x3af53a,_0x32e2df){return db[_0x5fe8('0x23')][_0x5fe8('0x3f')]({'where':{'id':_0x3af53a[_0x5fe8('0x3e')]['id']}})[_0x5fe8('0x1d')](handleEntityNotFound(_0x32e2df,null))['then'](removeEntity(_0x32e2df,null))[_0x5fe8('0x39')](handleError(_0x32e2df,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index b73c9f8..b1ab43f 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 _0x38ac=['api','moment','path','rimraf','../../config/environment','exports','define','MailServerOut','lodash','../../config/logger'];(function(_0x73ae39,_0x2e0a7b){var _0x2bc71e=function(_0x274df9){while(--_0x274df9){_0x73ae39['push'](_0x73ae39['shift']());}};_0x2bc71e(++_0x2e0a7b);}(_0x38ac,0x1b6));var _0xc38a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x38ac[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc38a('0x0'));var util=require('util');var logger=require(_0xc38a('0x1'))(_0xc38a('0x2'));var moment=require(_0xc38a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc38a('0x4'));var rimraf=require(_0xc38a('0x5'));var config=require(_0xc38a('0x6'));var attributes=require('./mailServerOut.attributes');module[_0xc38a('0x7')]=function(_0x428037,_0xfb6a7){return _0x428037[_0xc38a('0x8')](_0xc38a('0x9'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93a7=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xe027bc,_0x57e791){var _0x8ca4c1=function(_0x88fa03){while(--_0x88fa03){_0xe027bc['push'](_0xe027bc['shift']());}};_0x8ca4c1(++_0x57e791);}(_0x93a7,0x1bd));var _0x793a=function(_0x39c545,_0x4cb3b3){_0x39c545=_0x39c545-0x0;var _0x19e742=_0x93a7[_0x39c545];return _0x19e742;};'use strict';var _=require(_0x793a('0x0'));var util=require('util');var logger=require(_0x793a('0x1'))('api');var moment=require(_0x793a('0x2'));var BPromise=require(_0x793a('0x3'));var rp=require(_0x793a('0x4'));var fs=require('fs');var path=require(_0x793a('0x5'));var rimraf=require(_0x793a('0x6'));var config=require(_0x793a('0x7'));var attributes=require(_0x793a('0x8'));module[_0x793a('0x9')]=function(_0x503beb,_0xe1c672){return _0x503beb[_0x793a('0xa')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 9ec605d..f2a4d6a 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(_0x2e561f,_0x1b1660){var _0x4160ea=function(_0x1fa2ca){while(--_0x1fa2ca){_0x2e561f['push'](_0x2e561f['shift']());}};_0x4160ea(++_0x1b1660);}(_0x2ef3,0xba));var _0x32ef=function(_0x1058e2,_0x27ccf6){_0x1058e2=_0x1058e2-0x0;var _0x488124=_0x2ef3[_0x1058e2];return _0x488124;};'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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xd43e1d,_0x26a204){var _0x5c7332=function(_0x266a00){while(--_0x266a00){_0xd43e1d['push'](_0xd43e1d['shift']());}};_0x5c7332(++_0x26a204);}(_0xadb5,0xad));var _0x5adb=function(_0x8076d1,_0x5cdd95){_0x8076d1=_0x8076d1-0x0;var _0x44f4da=_0xadb5[_0x8076d1];return _0x44f4da;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index dd5ad0e..e45f8df 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 _0xaa28=['post','create','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0x10720d,_0x4d2655){var _0x49b2ed=function(_0x24d4d0){while(--_0x24d4d0){_0x10720d['push'](_0x10720d['shift']());}};_0x49b2ed(++_0x4d2655);}(_0xaa28,0x1bb));var _0x8aa2=function(_0x143565,_0x54d887){_0x143565=_0x143565-0x0;var _0x4dc1d9=_0xaa28[_0x143565];return _0x4dc1d9;};'use strict';var multer=require(_0x8aa2('0x0'));var util=require(_0x8aa2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8aa2('0x2'));var router=express[_0x8aa2('0x3')]();var fs_extra=require(_0x8aa2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8aa2('0x5'));var config=require(_0x8aa2('0x6'));var controller=require(_0x8aa2('0x7'));router[_0x8aa2('0x8')]('/',auth[_0x8aa2('0x9')](),controller['index']);router[_0x8aa2('0x8')](_0x8aa2('0xa'),auth[_0x8aa2('0x9')](),controller['describe']);router[_0x8aa2('0x8')](_0x8aa2('0xb'),auth[_0x8aa2('0x9')](),controller[_0x8aa2('0xc')]);router[_0x8aa2('0xd')]('/',auth[_0x8aa2('0x9')](),controller[_0x8aa2('0xe')]);router['put']('/:id',auth[_0x8aa2('0x9')](),controller[_0x8aa2('0xf')]);router[_0x8aa2('0x10')](_0x8aa2('0xb'),auth[_0x8aa2('0x9')](),controller[_0x8aa2('0x11')]);module[_0x8aa2('0x12')]=router; \ No newline at end of file +var _0xa42a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','/describe','describe','get','/:id','post','create','put','delete','exports','express','Router','fs-extra'];(function(_0x1528bd,_0x1877c0){var _0x487532=function(_0x14a137){while(--_0x14a137){_0x1528bd['push'](_0x1528bd['shift']());}};_0x487532(++_0x1877c0);}(_0xa42a,0x1d1));var _0xaa42=function(_0x4c4b2f,_0x3aeef6){_0x4c4b2f=_0x4c4b2f-0x0;var _0x4cc593=_0xa42a[_0x4c4b2f];return _0x4cc593;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaa42('0x0'));var router=express[_0xaa42('0x1')]();var fs_extra=require(_0xaa42('0x2'));var auth=require(_0xaa42('0x3'));var interaction=require(_0xaa42('0x4'));var config=require(_0xaa42('0x5'));var controller=require(_0xaa42('0x6'));router['get']('/',auth[_0xaa42('0x7')](),controller[_0xaa42('0x8')]);router['get'](_0xaa42('0x9'),auth['isAuthenticated'](),controller[_0xaa42('0xa')]);router[_0xaa42('0xb')](_0xaa42('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xaa42('0xd')]('/',auth[_0xaa42('0x7')](),controller[_0xaa42('0xe')]);router[_0xaa42('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xaa42('0x10')](_0xaa42('0xc'),auth[_0xaa42('0x7')](),controller['destroy']);module[_0xaa42('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 404c984..03479de 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 _0xc359=['name','STRING','exports'];(function(_0x4ad4da,_0x50a67e){var _0x1f17a5=function(_0x19478f){while(--_0x19478f){_0x4ad4da['push'](_0x4ad4da['shift']());}};_0x1f17a5(++_0x50a67e);}(_0xc359,0x1d9));var _0x9c35=function(_0x58803c,_0x4a34df){_0x58803c=_0x58803c-0x0;var _0xf95b9b=_0xc359[_0x58803c];return _0xf95b9b;};'use strict';var Sequelize=require('sequelize');module[_0x9c35('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9c35('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9c35('0x2')]}}; \ No newline at end of file +var _0xc949=['name','sequelize','STRING'];(function(_0xa20507,_0x194ad9){var _0x2b0948=function(_0x574175){while(--_0x574175){_0xa20507['push'](_0xa20507['shift']());}};_0x2b0948(++_0x194ad9);}(_0xc949,0x181));var _0x9c94=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xc949[_0x1e3c16];return _0x47a0c9;};'use strict';var Sequelize=require(_0x9c94('0x0'));module['exports']={'name':{'type':Sequelize[_0x9c94('0x1')],'unique':_0x9c94('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9c94('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index f149295..dd23eb8 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 _0xc649=['set','Content-Range','reject','then','destroy','name','map','MailSubstatus','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x8c72ca,_0x4f8490){var _0x2af0cd=function(_0x3952d9){while(--_0x3952d9){_0x8c72ca['push'](_0x8c72ca['shift']());}};_0x2af0cd(++_0x4f8490);}(_0xc649,0x1ca));var _0x9c64=function(_0x2c31d2,_0x42bdcf){_0x2c31d2=_0x2c31d2-0x0;var _0x468291=_0xc649[_0x2c31d2];return _0x468291;};'use strict';var emlformat=require(_0x9c64('0x0'));var rimraf=require(_0x9c64('0x1'));var zipdir=require(_0x9c64('0x2'));var jsonpatch=require(_0x9c64('0x3'));var rp=require(_0x9c64('0x4'));var moment=require(_0x9c64('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9c64('0x6'));var util=require(_0x9c64('0x7'));var path=require(_0x9c64('0x8'));var sox=require(_0x9c64('0x9'));var csv=require(_0x9c64('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c64('0xb'));var _=require(_0x9c64('0xc'));var squel=require('squel');var crypto=require(_0x9c64('0xd'));var jsforce=require(_0x9c64('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9c64('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9c64('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9c64('0x10'));var as=require(_0x9c64('0x11'));var hardwareService=require(_0x9c64('0x12'));var logger=require(_0x9c64('0x13'))(_0x9c64('0x14'));var utils=require(_0x9c64('0x15'));var config=require(_0x9c64('0x16'));var licenseUtil=require(_0x9c64('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x71c15a,_0x1043ae){_0x1043ae=_0x1043ae||0xcc;return function(_0xd5e4d5){if(_0xd5e4d5){return _0x71c15a[_0x9c64('0x18')](_0x1043ae);}return _0x71c15a[_0x9c64('0x19')](_0x1043ae)[_0x9c64('0x1a')]();};}function respondWithResult(_0x44d391,_0x3d9e61){_0x3d9e61=_0x3d9e61||0xc8;return function(_0x1aa898){if(_0x1aa898){return _0x44d391[_0x9c64('0x19')](_0x3d9e61)[_0x9c64('0x1b')](_0x1aa898);}};}function respondWithFilteredResult(_0xcbe5ec,_0x6c59b7){return function(_0x4fe5bf){if(_0x4fe5bf){var _0x39a034=typeof _0x6c59b7[_0x9c64('0x1c')]===_0x9c64('0x1d')&&typeof _0x6c59b7[_0x9c64('0x1e')]===_0x9c64('0x1d');var _0x262eb9=_0x4fe5bf[_0x9c64('0x1f')];var _0xea39bf=_0x39a034?0x0:_0x6c59b7[_0x9c64('0x1c')];var _0x37cb9f=_0x39a034?_0x4fe5bf[_0x9c64('0x1f')]:_0x6c59b7['offset']+_0x6c59b7[_0x9c64('0x1e')];var _0x27266a;if(_0x37cb9f>=_0x262eb9){_0x37cb9f=_0x262eb9;_0x27266a=0xc8;}else{_0x27266a=0xce;}_0xcbe5ec[_0x9c64('0x19')](_0x27266a);return _0xcbe5ec[_0x9c64('0x20')](_0x9c64('0x21'),_0xea39bf+'-'+_0x37cb9f+'/'+_0x262eb9)['json'](_0x4fe5bf);}return null;};}function patchUpdates(_0x3a3518){return function(_0x55e357){try{jsonpatch['apply'](_0x55e357,_0x3a3518,!![]);}catch(_0x1bc5dd){return BPromise[_0x9c64('0x22')](_0x1bc5dd);}return _0x55e357['save']();};}function saveUpdates(_0x2c29e4,_0x2c2edf){return function(_0x37d856){if(_0x37d856){return _0x37d856['update'](_0x2c29e4)[_0x9c64('0x23')](function(_0x4415c7){return _0x4415c7;});}return null;};}function removeEntity(_0x605f12,_0x21a970){return function(_0x48106f){if(_0x48106f){return _0x48106f[_0x9c64('0x24')]()[_0x9c64('0x23')](function(){_0x605f12[_0x9c64('0x19')](0xcc)[_0x9c64('0x1a')]();});}};}function handleEntityNotFound(_0x53ee75,_0x5c9ac9){return function(_0x48f1da){if(!_0x48f1da){_0x53ee75['sendStatus'](0x194);}return _0x48f1da;};}function handleError(_0x21b72e,_0x5d2b20){_0x5d2b20=_0x5d2b20||0x1f4;return function(_0x53a451){logger['error'](_0x53a451['stack']);if(_0x53a451[_0x9c64('0x25')]){delete _0x53a451[_0x9c64('0x25')];}_0x21b72e['status'](_0x5d2b20)['send'](_0x53a451);};}exports['index']=function(_0x530e51,_0xd1440b){var _0x4c087a={},_0x346771={},_0x3fb272={'count':0x0,'rows':[]};var _0x17c9b6=_[_0x9c64('0x26')](db[_0x9c64('0x27')][_0x9c64('0x28')],function(_0x398311){return{'name':_0x398311[_0x9c64('0x29')],'type':_0x398311[_0x9c64('0x2a')]['key']};});_0x346771[_0x9c64('0x2b')]=_[_0x9c64('0x26')](_0x17c9b6,_0x9c64('0x25'));_0x346771[_0x9c64('0x2c')]=_[_0x9c64('0x2d')](_0x530e51[_0x9c64('0x2c')]);_0x346771[_0x9c64('0x2e')]=_[_0x9c64('0x2f')](_0x346771[_0x9c64('0x2b')],_0x346771[_0x9c64('0x2c')]);_0x4c087a['attributes']=_['intersection'](_0x346771[_0x9c64('0x2b')],qs[_0x9c64('0x30')](_0x530e51[_0x9c64('0x2c')][_0x9c64('0x30')]));_0x4c087a[_0x9c64('0x31')]=_0x4c087a[_0x9c64('0x31')][_0x9c64('0x32')]?_0x4c087a[_0x9c64('0x31')]:_0x346771[_0x9c64('0x2b')];if(!_0x530e51[_0x9c64('0x2c')][_0x9c64('0x33')](_0x9c64('0x34'))){_0x4c087a['limit']=qs[_0x9c64('0x1e')](_0x530e51[_0x9c64('0x2c')][_0x9c64('0x1e')]);_0x4c087a[_0x9c64('0x1c')]=qs[_0x9c64('0x1c')](_0x530e51[_0x9c64('0x2c')][_0x9c64('0x1c')]);}_0x4c087a[_0x9c64('0x35')]=qs['sort'](_0x530e51['query'][_0x9c64('0x36')]);_0x4c087a['where']=qs[_0x9c64('0x2e')](_[_0x9c64('0x37')](_0x530e51[_0x9c64('0x2c')],_0x346771[_0x9c64('0x2e')]),_0x17c9b6);if(_0x530e51[_0x9c64('0x2c')][_0x9c64('0x38')]){_0x4c087a[_0x9c64('0x39')]=_[_0x9c64('0x3a')](_0x4c087a[_0x9c64('0x39')],{'$or':_[_0x9c64('0x26')](_0x17c9b6,function(_0x1a4b0b){if(_0x1a4b0b[_0x9c64('0x2a')]!=='VIRTUAL'){var _0x5de775={};_0x5de775[_0x1a4b0b[_0x9c64('0x25')]]={'$like':'%'+_0x530e51[_0x9c64('0x2c')][_0x9c64('0x38')]+'%'};return _0x5de775;}})});}_0x4c087a=_[_0x9c64('0x3a')]({},_0x4c087a,_0x530e51[_0x9c64('0x3b')]);var _0xfb4a2d={'where':_0x4c087a['where']};return db[_0x9c64('0x27')][_0x9c64('0x1f')](_0xfb4a2d)[_0x9c64('0x23')](function(_0x58c77d){_0x3fb272[_0x9c64('0x1f')]=_0x58c77d;if(_0x530e51[_0x9c64('0x2c')][_0x9c64('0x3c')]){_0x4c087a[_0x9c64('0x3d')]=[{'all':!![]}];}return db['MailSubstatus'][_0x9c64('0x3e')](_0x4c087a);})[_0x9c64('0x23')](function(_0x1be54e){_0x3fb272[_0x9c64('0x3f')]=_0x1be54e;return _0x3fb272;})[_0x9c64('0x23')](respondWithFilteredResult(_0xd1440b,_0x4c087a))[_0x9c64('0x40')](handleError(_0xd1440b,null));};exports[_0x9c64('0x41')]=function(_0x15b862,_0x24ba3e){var _0x21b761={'raw':!![],'where':{'id':_0x15b862[_0x9c64('0x42')]['id']}},_0x218806={};_0x218806[_0x9c64('0x2b')]=_['keys'](db[_0x9c64('0x27')][_0x9c64('0x28')]);_0x218806[_0x9c64('0x2c')]=_['keys'](_0x15b862[_0x9c64('0x2c')]);_0x218806[_0x9c64('0x2e')]=_[_0x9c64('0x2f')](_0x218806['model'],_0x218806[_0x9c64('0x2c')]);_0x21b761[_0x9c64('0x31')]=_[_0x9c64('0x2f')](_0x218806[_0x9c64('0x2b')],qs[_0x9c64('0x30')](_0x15b862['query'][_0x9c64('0x30')]));_0x21b761[_0x9c64('0x31')]=_0x21b761['attributes']['length']?_0x21b761[_0x9c64('0x31')]:_0x218806[_0x9c64('0x2b')];if(_0x15b862[_0x9c64('0x2c')]['includeAll']){_0x21b761[_0x9c64('0x3d')]=[{'all':!![]}];}_0x21b761=_[_0x9c64('0x3a')]({},_0x21b761,_0x15b862[_0x9c64('0x3b')]);return db['MailSubstatus'][_0x9c64('0x43')](_0x21b761)[_0x9c64('0x23')](handleEntityNotFound(_0x24ba3e,null))[_0x9c64('0x23')](respondWithResult(_0x24ba3e,null))[_0x9c64('0x40')](handleError(_0x24ba3e,null));};exports['create']=function(_0x9d2b49,_0x9987aa){return db[_0x9c64('0x27')]['create'](_0x9d2b49['body'],{})[_0x9c64('0x23')](respondWithResult(_0x9987aa,0xc9))['catch'](handleError(_0x9987aa,null));};exports['update']=function(_0xd34cd5,_0xc62d8b){if(_0xd34cd5[_0x9c64('0x44')]['id']){delete _0xd34cd5['body']['id'];}return db['MailSubstatus'][_0x9c64('0x43')]({'where':{'id':_0xd34cd5['params']['id']}})[_0x9c64('0x23')](handleEntityNotFound(_0xc62d8b,null))['then'](saveUpdates(_0xd34cd5[_0x9c64('0x44')],null))[_0x9c64('0x23')](respondWithResult(_0xc62d8b,null))[_0x9c64('0x40')](handleError(_0xc62d8b,null));};exports[_0x9c64('0x24')]=function(_0x431022,_0x355d14){return db[_0x9c64('0x27')][_0x9c64('0x43')]({'where':{'id':_0x431022['params']['id']}})['then'](handleEntityNotFound(_0x355d14,null))[_0x9c64('0x23')](removeEntity(_0x355d14,null))[_0x9c64('0x40')](handleError(_0x355d14,null));};exports[_0x9c64('0x45')]=function(_0x17885b,_0x3fb3ec){return db['MailSubstatus'][_0x9c64('0x45')]()[_0x9c64('0x23')](respondWithResult(_0x3fb3ec,null))[_0x9c64('0x40')](handleError(_0x3fb3ec,null));}; \ No newline at end of file +var _0x1f44=['ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','include','create','body','find','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x1f44,0x19c));var _0x41f4=function(_0x587887,_0x49e3b4){_0x587887=_0x587887-0x0;var _0x40474d=_0x1f44[_0x587887];return _0x40474d;};'use strict';var emlformat=require(_0x41f4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x41f4('0x1'));var rp=require(_0x41f4('0x2'));var moment=require(_0x41f4('0x3'));var BPromise=require(_0x41f4('0x4'));var Mustache=require(_0x41f4('0x5'));var util=require(_0x41f4('0x6'));var path=require(_0x41f4('0x7'));var sox=require('sox');var csv=require(_0x41f4('0x8'));var ejs=require(_0x41f4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x41f4('0xa'));var squel=require(_0x41f4('0xb'));var crypto=require(_0x41f4('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x41f4('0xd'));var Papa=require('papaparse');var Redis=require(_0x41f4('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x41f4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x41f4('0x10'));var logger=require('../../config/logger')(_0x41f4('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x41f4('0x12'));var db=require(_0x41f4('0x13'))['db'];function respondWithStatusCode(_0x50d549,_0x377ead){_0x377ead=_0x377ead||0xcc;return function(_0x2bbc4a){if(_0x2bbc4a){return _0x50d549['sendStatus'](_0x377ead);}return _0x50d549['status'](_0x377ead)[_0x41f4('0x14')]();};}function respondWithResult(_0x82200a,_0x1bbfe5){_0x1bbfe5=_0x1bbfe5||0xc8;return function(_0x1c0a96){if(_0x1c0a96){return _0x82200a[_0x41f4('0x15')](_0x1bbfe5)[_0x41f4('0x16')](_0x1c0a96);}};}function respondWithFilteredResult(_0x8b9bf4,_0x58d248){return function(_0x4d7246){if(_0x4d7246){var _0x1cc953=typeof _0x58d248[_0x41f4('0x17')]===_0x41f4('0x18')&&typeof _0x58d248['limit']===_0x41f4('0x18');var _0x1b5d6e=_0x4d7246['count'];var _0x1257d1=_0x1cc953?0x0:_0x58d248[_0x41f4('0x17')];var _0x428d40=_0x1cc953?_0x4d7246[_0x41f4('0x19')]:_0x58d248[_0x41f4('0x17')]+_0x58d248['limit'];var _0x40f592;if(_0x428d40>=_0x1b5d6e){_0x428d40=_0x1b5d6e;_0x40f592=0xc8;}else{_0x40f592=0xce;}_0x8b9bf4[_0x41f4('0x15')](_0x40f592);return _0x8b9bf4[_0x41f4('0x1a')]('Content-Range',_0x1257d1+'-'+_0x428d40+'/'+_0x1b5d6e)[_0x41f4('0x16')](_0x4d7246);}return null;};}function patchUpdates(_0x1c0c4f){return function(_0x547054){try{jsonpatch[_0x41f4('0x1b')](_0x547054,_0x1c0c4f,!![]);}catch(_0x4765eb){return BPromise[_0x41f4('0x1c')](_0x4765eb);}return _0x547054[_0x41f4('0x1d')]();};}function saveUpdates(_0x18c0a1,_0xdc4230){return function(_0x43960f){if(_0x43960f){return _0x43960f[_0x41f4('0x1e')](_0x18c0a1)[_0x41f4('0x1f')](function(_0x58edbb){return _0x58edbb;});}return null;};}function removeEntity(_0x865733,_0x21c35b){return function(_0x13b8ff){if(_0x13b8ff){return _0x13b8ff[_0x41f4('0x20')]()[_0x41f4('0x1f')](function(){_0x865733[_0x41f4('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30c7af,_0x3f2d4c){return function(_0x3d04ed){if(!_0x3d04ed){_0x30c7af['sendStatus'](0x194);}return _0x3d04ed;};}function handleError(_0x5a6a74,_0x48714c){_0x48714c=_0x48714c||0x1f4;return function(_0x108999){logger[_0x41f4('0x21')](_0x108999[_0x41f4('0x22')]);if(_0x108999[_0x41f4('0x23')]){delete _0x108999[_0x41f4('0x23')];}_0x5a6a74[_0x41f4('0x15')](_0x48714c)[_0x41f4('0x24')](_0x108999);};}exports[_0x41f4('0x25')]=function(_0x33c581,_0x4bacf1){var _0x24353d={},_0x46e841={},_0x4119b2={'count':0x0,'rows':[]};var _0x25838f=_[_0x41f4('0x26')](db[_0x41f4('0x27')][_0x41f4('0x28')],function(_0x38cd56){return{'name':_0x38cd56[_0x41f4('0x29')],'type':_0x38cd56[_0x41f4('0x2a')][_0x41f4('0x2b')]};});_0x46e841[_0x41f4('0x2c')]=_[_0x41f4('0x26')](_0x25838f,_0x41f4('0x23'));_0x46e841['query']=_[_0x41f4('0x2d')](_0x33c581[_0x41f4('0x2e')]);_0x46e841[_0x41f4('0x2f')]=_[_0x41f4('0x30')](_0x46e841[_0x41f4('0x2c')],_0x46e841['query']);_0x24353d['attributes']=_[_0x41f4('0x30')](_0x46e841[_0x41f4('0x2c')],qs[_0x41f4('0x31')](_0x33c581['query']['fields']));_0x24353d[_0x41f4('0x32')]=_0x24353d[_0x41f4('0x32')][_0x41f4('0x33')]?_0x24353d[_0x41f4('0x32')]:_0x46e841[_0x41f4('0x2c')];if(!_0x33c581[_0x41f4('0x2e')]['hasOwnProperty']('nolimit')){_0x24353d[_0x41f4('0x34')]=qs[_0x41f4('0x34')](_0x33c581['query']['limit']);_0x24353d['offset']=qs[_0x41f4('0x17')](_0x33c581[_0x41f4('0x2e')][_0x41f4('0x17')]);}_0x24353d[_0x41f4('0x35')]=qs[_0x41f4('0x36')](_0x33c581[_0x41f4('0x2e')][_0x41f4('0x36')]);_0x24353d['where']=qs[_0x41f4('0x2f')](_[_0x41f4('0x37')](_0x33c581[_0x41f4('0x2e')],_0x46e841[_0x41f4('0x2f')]),_0x25838f);if(_0x33c581[_0x41f4('0x2e')][_0x41f4('0x38')]){_0x24353d[_0x41f4('0x39')]=_[_0x41f4('0x3a')](_0x24353d[_0x41f4('0x39')],{'$or':_[_0x41f4('0x26')](_0x25838f,function(_0x11668f){if(_0x11668f[_0x41f4('0x2a')]!==_0x41f4('0x3b')){var _0x53d086={};_0x53d086[_0x11668f[_0x41f4('0x23')]]={'$like':'%'+_0x33c581[_0x41f4('0x2e')][_0x41f4('0x38')]+'%'};return _0x53d086;}})});}_0x24353d=_['merge']({},_0x24353d,_0x33c581[_0x41f4('0x3c')]);var _0x42e27a={'where':_0x24353d[_0x41f4('0x39')]};return db[_0x41f4('0x27')][_0x41f4('0x19')](_0x42e27a)[_0x41f4('0x1f')](function(_0x2655c6){_0x4119b2['count']=_0x2655c6;if(_0x33c581[_0x41f4('0x2e')][_0x41f4('0x3d')]){_0x24353d['include']=[{'all':!![]}];}return db[_0x41f4('0x27')][_0x41f4('0x3e')](_0x24353d);})[_0x41f4('0x1f')](function(_0x5d4e0a){_0x4119b2['rows']=_0x5d4e0a;return _0x4119b2;})[_0x41f4('0x1f')](respondWithFilteredResult(_0x4bacf1,_0x24353d))[_0x41f4('0x3f')](handleError(_0x4bacf1,null));};exports[_0x41f4('0x40')]=function(_0x14d084,_0x41e4fb){var _0xdbab5={'raw':!![],'where':{'id':_0x14d084['params']['id']}},_0x66671b={};_0x66671b['model']=_[_0x41f4('0x2d')](db[_0x41f4('0x27')][_0x41f4('0x28')]);_0x66671b[_0x41f4('0x2e')]=_[_0x41f4('0x2d')](_0x14d084[_0x41f4('0x2e')]);_0x66671b[_0x41f4('0x2f')]=_['intersection'](_0x66671b[_0x41f4('0x2c')],_0x66671b[_0x41f4('0x2e')]);_0xdbab5[_0x41f4('0x32')]=_[_0x41f4('0x30')](_0x66671b['model'],qs[_0x41f4('0x31')](_0x14d084[_0x41f4('0x2e')]['fields']));_0xdbab5[_0x41f4('0x32')]=_0xdbab5[_0x41f4('0x32')][_0x41f4('0x33')]?_0xdbab5['attributes']:_0x66671b['model'];if(_0x14d084[_0x41f4('0x2e')][_0x41f4('0x3d')]){_0xdbab5[_0x41f4('0x41')]=[{'all':!![]}];}_0xdbab5=_[_0x41f4('0x3a')]({},_0xdbab5,_0x14d084[_0x41f4('0x3c')]);return db[_0x41f4('0x27')]['find'](_0xdbab5)[_0x41f4('0x1f')](handleEntityNotFound(_0x41e4fb,null))[_0x41f4('0x1f')](respondWithResult(_0x41e4fb,null))[_0x41f4('0x3f')](handleError(_0x41e4fb,null));};exports[_0x41f4('0x42')]=function(_0x147327,_0x533ae3){return db[_0x41f4('0x27')]['create'](_0x147327[_0x41f4('0x43')],{})[_0x41f4('0x1f')](respondWithResult(_0x533ae3,0xc9))['catch'](handleError(_0x533ae3,null));};exports[_0x41f4('0x1e')]=function(_0x11f272,_0x4c96db){if(_0x11f272[_0x41f4('0x43')]['id']){delete _0x11f272[_0x41f4('0x43')]['id'];}return db[_0x41f4('0x27')][_0x41f4('0x44')]({'where':{'id':_0x11f272[_0x41f4('0x45')]['id']}})[_0x41f4('0x1f')](handleEntityNotFound(_0x4c96db,null))[_0x41f4('0x1f')](saveUpdates(_0x11f272[_0x41f4('0x43')],null))[_0x41f4('0x1f')](respondWithResult(_0x4c96db,null))[_0x41f4('0x3f')](handleError(_0x4c96db,null));};exports[_0x41f4('0x20')]=function(_0x4b023,_0x4c9544){return db[_0x41f4('0x27')][_0x41f4('0x44')]({'where':{'id':_0x4b023[_0x41f4('0x45')]['id']}})['then'](handleEntityNotFound(_0x4c9544,null))[_0x41f4('0x1f')](removeEntity(_0x4c9544,null))[_0x41f4('0x3f')](handleError(_0x4c9544,null));};exports[_0x41f4('0x46')]=function(_0xada0a2,_0x2d41f4){return db['MailSubstatus'][_0x41f4('0x46')]()[_0x41f4('0x1f')](respondWithResult(_0x2d41f4,null))[_0x41f4('0x3f')](handleError(_0x2d41f4,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index a697393..07011b1 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 _0x609a=['hook','events','MailSubstatus','setMaxListeners','emit','hasOwnProperty'];(function(_0x36645a,_0xd563ad){var _0x2093eb=function(_0x2679f8){while(--_0x2679f8){_0x36645a['push'](_0x36645a['shift']());}};_0x2093eb(++_0xd563ad);}(_0x609a,0xfd));var _0xa609=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x609a[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0xa609('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xa609('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xa609('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x63687a){return function(_0x13b5a4,_0x4b8ca5,_0xe431f7){MailSubstatusEvents[_0xa609('0x3')](_0x63687a+':'+_0x13b5a4['id'],_0x13b5a4);MailSubstatusEvents[_0xa609('0x3')](_0x63687a,_0x13b5a4);_0xe431f7(null);};}for(var e in events){if(events[_0xa609('0x4')](e)){var event=events[e];MailSubstatus[_0xa609('0x5')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x613e=['MailSubstatus','setMaxListeners','emit','hook','exports','events','../../mysqldb'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x613e,0xc2));var _0xe613=function(_0x391fd2,_0x5c0f9d){_0x391fd2=_0x391fd2-0x0;var _0x15ea0b=_0x613e[_0x391fd2];return _0x15ea0b;};'use strict';var EventEmitter=require(_0xe613('0x0'));var MailSubstatus=require(_0xe613('0x1'))['db'][_0xe613('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xe613('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x48ef0a){return function(_0x411b89,_0x425aea,_0x5b881b){MailSubstatusEvents[_0xe613('0x4')](_0x48ef0a+':'+_0x411b89['id'],_0x411b89);MailSubstatusEvents[_0xe613('0x4')](_0x48ef0a,_0x411b89);_0x5b881b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xe613('0x5')](e,emitEvent(event));}}module[_0xe613('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 9c2a550..ccacf9b 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 _0xc292=['define','MailSubstatus','Condition','update','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','models'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xc292,0x153));var _0x2c29=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xc292[_0x35da42];return _0x370035;};'use strict';var attributes=require(_0x2c29('0x0'));module['exports']=function(_0x42649f){var _0x135229=_0x42649f[_0x2c29('0x1')];return _0x42649f[_0x2c29('0x2')](_0x2c29('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4781b4,_0x257978,_0x506921){return _0x135229[_0x2c29('0x4')][_0x2c29('0x5')]({'value':_0x4781b4[_0x2c29('0x6')]},{'where':{'field':_0x2c29('0x7'),'value':_0x4781b4[_0x2c29('0x8')][_0x2c29('0x6')]}})[_0x2c29('0x9')](function(){_0x506921();})[_0x2c29('0xa')](function(_0x5dfa96){_0x506921(_0x5dfa96);});}}});}; \ No newline at end of file +var _0x2ac7=['Condition','name','then','catch','exports','models','define','MailSubstatus','mail_substatuses'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2ac7,0x1bd));var _0x72ac=function(_0x231875,_0xca17cc){_0x231875=_0x231875-0x0;var _0x24b213=_0x2ac7[_0x231875];return _0x24b213;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x72ac('0x0')]=function(_0x501032){var _0x4997a0=_0x501032[_0x72ac('0x1')];return _0x501032[_0x72ac('0x2')](_0x72ac('0x3'),attributes,{'tableName':_0x72ac('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x16dc00,_0x78119f,_0xa208d){return _0x4997a0[_0x72ac('0x5')]['update']({'value':_0x16dc00[_0x72ac('0x6')]},{'where':{'field':'mailSubstatus','value':_0x16dc00['_previousDataValues'][_0x72ac('0x6')]}})[_0x72ac('0x7')](function(){_0xa208d();})[_0x72ac('0x8')](function(_0xba4f80){_0xa208d(_0xba4f80);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 0fbf525..40a734f 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 _0x3399=['debug','error','code','message','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent'];(function(_0x5759e0,_0x31984b){var _0x1a64cd=function(_0x586c59){while(--_0x586c59){_0x5759e0['push'](_0x5759e0['shift']());}};_0x1a64cd(++_0x31984b);}(_0x3399,0x194));var _0x9339=function(_0x44f8ba,_0xda289){_0x44f8ba=_0x44f8ba-0x0;var _0x23243f=_0x3399[_0x44f8ba];return _0x23243f;};'use strict';var _=require('lodash');var util=require(_0x9339('0x0'));var moment=require(_0x9339('0x1'));var BPromise=require(_0x9339('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9339('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9339('0x4'))(_0x9339('0x5'));var config=require(_0x9339('0x6'));var jayson=require(_0x9339('0x7'));var client=jayson[_0x9339('0x8')][_0x9339('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x554c98,_0x42bc16,_0x9a0323){return new BPromise(function(_0x49c190,_0x55b8a1){return client[_0x9339('0xa')](_0x554c98,_0x9a0323)['then'](function(_0x4d2ef0){logger[_0x9339('0xb')](_0x9339('0xc'),_0x42bc16,_0x9339('0xd'));logger[_0x9339('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x42bc16,'request\x20sent',JSON['stringify'](_0x4d2ef0));if(_0x4d2ef0['error']){if(_0x4d2ef0[_0x9339('0xf')][_0x9339('0x10')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x42bc16,_0x4d2ef0['error'][_0x9339('0x11')]);return _0x55b8a1(_0x4d2ef0[_0x9339('0xf')][_0x9339('0x11')]);}logger[_0x9339('0xf')](_0x9339('0xc'),_0x42bc16,_0x4d2ef0[_0x9339('0xf')][_0x9339('0x11')]);return _0x49c190(_0x4d2ef0[_0x9339('0xf')][_0x9339('0x11')]);}else{logger[_0x9339('0xb')](_0x9339('0xc'),_0x42bc16,_0x9339('0xd'));_0x49c190(_0x4d2ef0['result'][_0x9339('0x11')]);}})[_0x9339('0x12')](function(_0x8dca7b){logger[_0x9339('0xf')](_0x9339('0xc'),_0x42bc16,_0x8dca7b);_0x55b8a1(_0x8dca7b);});});} \ No newline at end of file +var _0x3eab=['../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailSubstatus,\x20%s,\x20%s','lodash','moment','../../config/utils','../../config/logger','rpc'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3eab,0x127));var _0xb3ea=function(_0x5a419b,_0x2c2734){_0x5a419b=_0x5a419b-0x0;var _0xa0453a=_0x3eab[_0x5a419b];return _0xa0453a;};'use strict';var _=require(_0xb3ea('0x0'));var util=require('util');var moment=require(_0xb3ea('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb3ea('0x2'));var logger=require(_0xb3ea('0x3'))(_0xb3ea('0x4'));var config=require(_0xb3ea('0x5'));var jayson=require(_0xb3ea('0x6'));var client=jayson[_0xb3ea('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcc4be3,_0x383b12,_0x1bdd02){return new BPromise(function(_0x2b6e5a,_0x4d0303){return client['request'](_0xcc4be3,_0x1bdd02)[_0xb3ea('0x8')](function(_0x312ada){logger[_0xb3ea('0x9')]('MailSubstatus,\x20%s,\x20%s',_0x383b12,_0xb3ea('0xa'));logger[_0xb3ea('0xb')](_0xb3ea('0xc'),_0x383b12,_0xb3ea('0xa'),JSON[_0xb3ea('0xd')](_0x312ada));if(_0x312ada['error']){if(_0x312ada[_0xb3ea('0xe')][_0xb3ea('0xf')]===0x1f4){logger[_0xb3ea('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x383b12,_0x312ada[_0xb3ea('0xe')][_0xb3ea('0x10')]);return _0x4d0303(_0x312ada[_0xb3ea('0xe')][_0xb3ea('0x10')]);}logger[_0xb3ea('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x383b12,_0x312ada[_0xb3ea('0xe')]['message']);return _0x2b6e5a(_0x312ada[_0xb3ea('0xe')][_0xb3ea('0x10')]);}else{logger[_0xb3ea('0x9')]('MailSubstatus,\x20%s,\x20%s',_0x383b12,_0xb3ea('0xa'));_0x2b6e5a(_0x312ada[_0xb3ea('0x11')][_0xb3ea('0x10')]);}})[_0xb3ea('0x12')](function(_0x1e6d05){logger['error'](_0xb3ea('0x13'),_0x383b12,_0x1e6d05);_0x4d0303(_0x1e6d05);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 8a6a9f8..466b79b 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 _0xf724=['delete','connect-timeout','Router','fs-extra','../../config/environment','./mailTransferReport.controller','get','/describe','/:id','isAuthenticated','post','create','put','update'];(function(_0x13a8cc,_0x45b4fc){var _0x31b53c=function(_0x3ea73b){while(--_0x3ea73b){_0x13a8cc['push'](_0x13a8cc['shift']());}};_0x31b53c(++_0x45b4fc);}(_0xf724,0x71));var _0x4f72=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0xf724[_0x34325b];return _0x3da348;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4f72('0x0'));var express=require('express');var router=express[_0x4f72('0x1')]();var fs_extra=require(_0x4f72('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4f72('0x3'));var controller=require(_0x4f72('0x4'));router[_0x4f72('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4f72('0x5')](_0x4f72('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0x4f72('0x5')](_0x4f72('0x7'),auth[_0x4f72('0x8')](),controller['show']);router[_0x4f72('0x9')]('/',auth['isAuthenticated'](),controller[_0x4f72('0xa')]);router[_0x4f72('0xb')]('/:id',auth[_0x4f72('0x8')](),controller[_0x4f72('0xc')]);router[_0x4f72('0xd')]('/:id',auth[_0x4f72('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbeac=['put','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index','get','/describe','describe','/:id','isAuthenticated','show','post','create'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0xbeac,0xca));var _0xcbea=function(_0x26d29b,_0x55947a){_0x26d29b=_0x26d29b-0x0;var _0x47e26f=_0xbeac[_0x26d29b];return _0x47e26f;};'use strict';var multer=require(_0xcbea('0x0'));var util=require(_0xcbea('0x1'));var path=require(_0xcbea('0x2'));var timeout=require(_0xcbea('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcbea('0x4'));var auth=require(_0xcbea('0x5'));var interaction=require(_0xcbea('0x6'));var config=require(_0xcbea('0x7'));var controller=require(_0xcbea('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xcbea('0x9')]);router[_0xcbea('0xa')](_0xcbea('0xb'),auth['isAuthenticated'](),controller[_0xcbea('0xc')]);router[_0xcbea('0xa')](_0xcbea('0xd'),auth[_0xcbea('0xe')](),controller[_0xcbea('0xf')]);router[_0xcbea('0x10')]('/',auth[_0xcbea('0xe')](),controller[_0xcbea('0x11')]);router[_0xcbea('0x12')](_0xcbea('0xd'),auth[_0xcbea('0xe')](),controller['update']);router['delete'](_0xcbea('0xd'),auth[_0xcbea('0xe')](),controller['destroy']);module[_0xcbea('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 4430532..652f6ff 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x593716,_0x1ad3db){var _0x2429eb=function(_0xeadde7){while(--_0xeadde7){_0x593716['push'](_0x593716['shift']());}};_0x2429eb(++_0x1ad3db);}(_0xedd9,0xfc));var _0x9edd=function(_0x4648ff,_0x582172){_0x4648ff=_0x4648ff-0x0;var _0x26070b=_0xedd9[_0x4648ff];return _0x26070b;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x47b610,_0xaed662){var _0x7badf3=function(_0x58cf78){while(--_0x58cf78){_0x47b610['push'](_0x47b610['shift']());}};_0x7badf3(++_0xaed662);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x55c485,_0x3fe77e){_0x55c485=_0x55c485-0x0;var _0x6bb521=_0xf3cd[_0x55c485];return _0x6bb521;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 4ef5897..ee27f75 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 _0xe55a=['then','destroy','error','stack','name','send','index','map','MailTransferReport','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','create','body','update','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save'];(function(_0x346b4f,_0x168e9e){var _0x3c9325=function(_0x45b626){while(--_0x45b626){_0x346b4f['push'](_0x346b4f['shift']());}};_0x3c9325(++_0x168e9e);}(_0xe55a,0xf7));var _0xae55=function(_0x548003,_0x19cd0e){_0x548003=_0x548003-0x0;var _0x459a44=_0xe55a[_0x548003];return _0x459a44;};'use strict';var emlformat=require(_0xae55('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xae55('0x1'));var rp=require('request-promise');var moment=require(_0xae55('0x2'));var BPromise=require(_0xae55('0x3'));var Mustache=require(_0xae55('0x4'));var util=require(_0xae55('0x5'));var path=require(_0xae55('0x6'));var sox=require('sox');var csv=require(_0xae55('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae55('0x8'));var _=require(_0xae55('0x9'));var squel=require('squel');var crypto=require(_0xae55('0xa'));var jsforce=require(_0xae55('0xb'));var deskjs=require(_0xae55('0xc'));var toCsv=require(_0xae55('0x7'));var querystring=require(_0xae55('0xd'));var Papa=require(_0xae55('0xe'));var Redis=require('ioredis');var authService=require(_0xae55('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xae55('0x10'));var hardwareService=require(_0xae55('0x11'));var logger=require(_0xae55('0x12'))(_0xae55('0x13'));var utils=require(_0xae55('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xae55('0x15'))['db'];function respondWithStatusCode(_0x13270b,_0x3105ea){_0x3105ea=_0x3105ea||0xcc;return function(_0x41ec60){if(_0x41ec60){return _0x13270b[_0xae55('0x16')](_0x3105ea);}return _0x13270b[_0xae55('0x17')](_0x3105ea)[_0xae55('0x18')]();};}function respondWithResult(_0x5ac3a7,_0x3195b3){_0x3195b3=_0x3195b3||0xc8;return function(_0x1afeb5){if(_0x1afeb5){return _0x5ac3a7[_0xae55('0x17')](_0x3195b3)['json'](_0x1afeb5);}};}function respondWithFilteredResult(_0x1e3fee,_0x37d496){return function(_0x339ab4){if(_0x339ab4){var _0x20dbc0=typeof _0x37d496[_0xae55('0x19')]===_0xae55('0x1a')&&typeof _0x37d496[_0xae55('0x1b')]==='undefined';var _0x5b6957=_0x339ab4['count'];var _0x16bc34=_0x20dbc0?0x0:_0x37d496[_0xae55('0x19')];var _0x1f131a=_0x20dbc0?_0x339ab4[_0xae55('0x1c')]:_0x37d496[_0xae55('0x19')]+_0x37d496[_0xae55('0x1b')];var _0x296998;if(_0x1f131a>=_0x5b6957){_0x1f131a=_0x5b6957;_0x296998=0xc8;}else{_0x296998=0xce;}_0x1e3fee['status'](_0x296998);return _0x1e3fee['set']('Content-Range',_0x16bc34+'-'+_0x1f131a+'/'+_0x5b6957)[_0xae55('0x1d')](_0x339ab4);}return null;};}function patchUpdates(_0x34a2d8){return function(_0x272646){try{jsonpatch[_0xae55('0x1e')](_0x272646,_0x34a2d8,!![]);}catch(_0x25c4ef){return BPromise[_0xae55('0x1f')](_0x25c4ef);}return _0x272646[_0xae55('0x20')]();};}function saveUpdates(_0x3f2ad5,_0x133dbe){return function(_0x603e4a){if(_0x603e4a){return _0x603e4a['update'](_0x3f2ad5)[_0xae55('0x21')](function(_0x248a62){return _0x248a62;});}return null;};}function removeEntity(_0x1c63e3,_0x2c254c){return function(_0x10ba6b){if(_0x10ba6b){return _0x10ba6b[_0xae55('0x22')]()[_0xae55('0x21')](function(){_0x1c63e3[_0xae55('0x17')](0xcc)[_0xae55('0x18')]();});}};}function handleEntityNotFound(_0x152350,_0x25b90){return function(_0x1ca1af){if(!_0x1ca1af){_0x152350[_0xae55('0x16')](0x194);}return _0x1ca1af;};}function handleError(_0x26823d,_0xafb663){_0xafb663=_0xafb663||0x1f4;return function(_0x407f62){logger[_0xae55('0x23')](_0x407f62[_0xae55('0x24')]);if(_0x407f62[_0xae55('0x25')]){delete _0x407f62[_0xae55('0x25')];}_0x26823d[_0xae55('0x17')](_0xafb663)[_0xae55('0x26')](_0x407f62);};}exports[_0xae55('0x27')]=function(_0x77867f,_0x31804b){var _0x557dca={},_0x14293f={},_0x498426={'count':0x0,'rows':[]};var _0x41dc6e=_[_0xae55('0x28')](db[_0xae55('0x29')]['rawAttributes'],function(_0x1a0abc){return{'name':_0x1a0abc[_0xae55('0x2a')],'type':_0x1a0abc[_0xae55('0x2b')][_0xae55('0x2c')]};});_0x14293f[_0xae55('0x2d')]=_[_0xae55('0x28')](_0x41dc6e,_0xae55('0x25'));_0x14293f[_0xae55('0x2e')]=_[_0xae55('0x2f')](_0x77867f[_0xae55('0x2e')]);_0x14293f['filters']=_[_0xae55('0x30')](_0x14293f[_0xae55('0x2d')],_0x14293f['query']);_0x557dca['attributes']=_['intersection'](_0x14293f[_0xae55('0x2d')],qs[_0xae55('0x31')](_0x77867f[_0xae55('0x2e')][_0xae55('0x31')]));_0x557dca[_0xae55('0x32')]=_0x557dca[_0xae55('0x32')]['length']?_0x557dca[_0xae55('0x32')]:_0x14293f['model'];if(!_0x77867f['query'][_0xae55('0x33')]('nolimit')){_0x557dca[_0xae55('0x1b')]=qs['limit'](_0x77867f[_0xae55('0x2e')][_0xae55('0x1b')]);_0x557dca['offset']=qs[_0xae55('0x19')](_0x77867f[_0xae55('0x2e')]['offset']);}_0x557dca['order']=qs[_0xae55('0x34')](_0x77867f[_0xae55('0x2e')][_0xae55('0x34')]);_0x557dca[_0xae55('0x35')]=qs[_0xae55('0x36')](_[_0xae55('0x37')](_0x77867f[_0xae55('0x2e')],_0x14293f['filters']),_0x41dc6e);if(_0x77867f['query'][_0xae55('0x38')]){_0x557dca['where']=_[_0xae55('0x39')](_0x557dca['where'],{'$or':_[_0xae55('0x28')](_0x41dc6e,function(_0x34a16b){if(_0x34a16b[_0xae55('0x2b')]!==_0xae55('0x3a')){var _0xe5cc28={};_0xe5cc28[_0x34a16b[_0xae55('0x25')]]={'$like':'%'+_0x77867f[_0xae55('0x2e')][_0xae55('0x38')]+'%'};return _0xe5cc28;}})});}_0x557dca=_['merge']({},_0x557dca,_0x77867f[_0xae55('0x3b')]);var _0x38503e={'where':_0x557dca[_0xae55('0x35')]};return db[_0xae55('0x29')]['count'](_0x38503e)[_0xae55('0x21')](function(_0x102144){_0x498426[_0xae55('0x1c')]=_0x102144;if(_0x77867f[_0xae55('0x2e')][_0xae55('0x3c')]){_0x557dca[_0xae55('0x3d')]=[{'all':!![]}];}return db[_0xae55('0x29')][_0xae55('0x3e')](_0x557dca);})[_0xae55('0x21')](function(_0x2e990f){_0x498426[_0xae55('0x3f')]=_0x2e990f;return _0x498426;})[_0xae55('0x21')](respondWithFilteredResult(_0x31804b,_0x557dca))[_0xae55('0x40')](handleError(_0x31804b,null));};exports['show']=function(_0x5c6034,_0x2b0bbf){var _0x5c4631={'raw':!![],'where':{'id':_0x5c6034[_0xae55('0x41')]['id']}},_0x4ce41e={};_0x4ce41e['model']=_[_0xae55('0x2f')](db[_0xae55('0x29')]['rawAttributes']);_0x4ce41e[_0xae55('0x2e')]=_[_0xae55('0x2f')](_0x5c6034[_0xae55('0x2e')]);_0x4ce41e[_0xae55('0x36')]=_[_0xae55('0x30')](_0x4ce41e[_0xae55('0x2d')],_0x4ce41e['query']);_0x5c4631[_0xae55('0x32')]=_[_0xae55('0x30')](_0x4ce41e[_0xae55('0x2d')],qs[_0xae55('0x31')](_0x5c6034[_0xae55('0x2e')]['fields']));_0x5c4631[_0xae55('0x32')]=_0x5c4631[_0xae55('0x32')][_0xae55('0x42')]?_0x5c4631[_0xae55('0x32')]:_0x4ce41e[_0xae55('0x2d')];if(_0x5c6034[_0xae55('0x2e')][_0xae55('0x3c')]){_0x5c4631[_0xae55('0x3d')]=[{'all':!![]}];}_0x5c4631=_['merge']({},_0x5c4631,_0x5c6034['options']);return db[_0xae55('0x29')]['find'](_0x5c4631)[_0xae55('0x21')](handleEntityNotFound(_0x2b0bbf,null))[_0xae55('0x21')](respondWithResult(_0x2b0bbf,null))[_0xae55('0x40')](handleError(_0x2b0bbf,null));};exports[_0xae55('0x43')]=function(_0x26faa5,_0x1d9a0d){return db['MailTransferReport'][_0xae55('0x43')](_0x26faa5[_0xae55('0x44')],{})[_0xae55('0x21')](respondWithResult(_0x1d9a0d,0xc9))[_0xae55('0x40')](handleError(_0x1d9a0d,null));};exports[_0xae55('0x45')]=function(_0x330d97,_0x2929d8){if(_0x330d97[_0xae55('0x44')]['id']){delete _0x330d97[_0xae55('0x44')]['id'];}return db[_0xae55('0x29')]['find']({'where':{'id':_0x330d97[_0xae55('0x41')]['id']}})[_0xae55('0x21')](handleEntityNotFound(_0x2929d8,null))[_0xae55('0x21')](saveUpdates(_0x330d97[_0xae55('0x44')],null))[_0xae55('0x21')](respondWithResult(_0x2929d8,null))['catch'](handleError(_0x2929d8,null));};exports[_0xae55('0x22')]=function(_0x388538,_0x50aae5){return db[_0xae55('0x29')]['find']({'where':{'id':_0x388538[_0xae55('0x41')]['id']}})['then'](handleEntityNotFound(_0x50aae5,null))[_0xae55('0x21')](removeEntity(_0x50aae5,null))[_0xae55('0x40')](handleError(_0x50aae5,null));};exports['describe']=function(_0x582b1b,_0x2a89aa){return db[_0xae55('0x29')]['describe']()['then'](respondWithResult(_0x2a89aa,null))['catch'](handleError(_0x2a89aa,null));}; \ No newline at end of file +var _0x2eb1=['fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','MailTransferReport','rawAttributes','fieldName','model','query','attributes','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','includeAll','include','rows','show','params','keys','intersection','fields','length','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs'];(function(_0x219bd5,_0xd0b275){var _0x53f722=function(_0x1fbf63){while(--_0x1fbf63){_0x219bd5['push'](_0x219bd5['shift']());}};_0x53f722(++_0xd0b275);}(_0x2eb1,0x163));var _0x12eb=function(_0x5daeac,_0x510b4a){_0x5daeac=_0x5daeac-0x0;var _0x4981cc=_0x2eb1[_0x5daeac];return _0x4981cc;};'use strict';var emlformat=require(_0x12eb('0x0'));var rimraf=require(_0x12eb('0x1'));var zipdir=require(_0x12eb('0x2'));var jsonpatch=require(_0x12eb('0x3'));var rp=require(_0x12eb('0x4'));var moment=require(_0x12eb('0x5'));var BPromise=require(_0x12eb('0x6'));var Mustache=require('mustache');var util=require(_0x12eb('0x7'));var path=require('path');var sox=require(_0x12eb('0x8'));var csv=require('to-csv');var ejs=require(_0x12eb('0x9'));var fs=require('fs');var fs_extra=require(_0x12eb('0xa'));var _=require(_0x12eb('0xb'));var squel=require(_0x12eb('0xc'));var crypto=require('crypto');var jsforce=require(_0x12eb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x12eb('0xe'));var querystring=require(_0x12eb('0xf'));var Papa=require(_0x12eb('0x10'));var Redis=require('ioredis');var authService=require(_0x12eb('0x11'));var qs=require(_0x12eb('0x12'));var as=require(_0x12eb('0x13'));var hardwareService=require(_0x12eb('0x14'));var logger=require('../../config/logger')(_0x12eb('0x15'));var utils=require('../../config/utils');var config=require(_0x12eb('0x16'));var licenseUtil=require(_0x12eb('0x17'));var db=require(_0x12eb('0x18'))['db'];function respondWithStatusCode(_0x4415fa,_0x2c7d27){_0x2c7d27=_0x2c7d27||0xcc;return function(_0x3d6832){if(_0x3d6832){return _0x4415fa[_0x12eb('0x19')](_0x2c7d27);}return _0x4415fa[_0x12eb('0x1a')](_0x2c7d27)[_0x12eb('0x1b')]();};}function respondWithResult(_0x1b8477,_0x1c7c56){_0x1c7c56=_0x1c7c56||0xc8;return function(_0x30797d){if(_0x30797d){return _0x1b8477[_0x12eb('0x1a')](_0x1c7c56)[_0x12eb('0x1c')](_0x30797d);}};}function respondWithFilteredResult(_0xe06506,_0x43eacd){return function(_0x3d1ff7){if(_0x3d1ff7){var _0x938570=typeof _0x43eacd[_0x12eb('0x1d')]===_0x12eb('0x1e')&&typeof _0x43eacd[_0x12eb('0x1f')]===_0x12eb('0x1e');var _0x338e14=_0x3d1ff7[_0x12eb('0x20')];var _0xac85f4=_0x938570?0x0:_0x43eacd[_0x12eb('0x1d')];var _0x243f2d=_0x938570?_0x3d1ff7[_0x12eb('0x20')]:_0x43eacd[_0x12eb('0x1d')]+_0x43eacd[_0x12eb('0x1f')];var _0x295cd2;if(_0x243f2d>=_0x338e14){_0x243f2d=_0x338e14;_0x295cd2=0xc8;}else{_0x295cd2=0xce;}_0xe06506[_0x12eb('0x1a')](_0x295cd2);return _0xe06506[_0x12eb('0x21')](_0x12eb('0x22'),_0xac85f4+'-'+_0x243f2d+'/'+_0x338e14)['json'](_0x3d1ff7);}return null;};}function patchUpdates(_0x1ebbdf){return function(_0x1afa99){try{jsonpatch[_0x12eb('0x23')](_0x1afa99,_0x1ebbdf,!![]);}catch(_0x19421c){return BPromise[_0x12eb('0x24')](_0x19421c);}return _0x1afa99['save']();};}function saveUpdates(_0x597f0b,_0x4d81e7){return function(_0x5ea9a7){if(_0x5ea9a7){return _0x5ea9a7[_0x12eb('0x25')](_0x597f0b)[_0x12eb('0x26')](function(_0x491f6c){return _0x491f6c;});}return null;};}function removeEntity(_0x6db43f,_0x516cab){return function(_0x4057cc){if(_0x4057cc){return _0x4057cc[_0x12eb('0x27')]()[_0x12eb('0x26')](function(){_0x6db43f[_0x12eb('0x1a')](0xcc)[_0x12eb('0x1b')]();});}};}function handleEntityNotFound(_0xa8999f,_0x15633d){return function(_0x4059e3){if(!_0x4059e3){_0xa8999f[_0x12eb('0x19')](0x194);}return _0x4059e3;};}function handleError(_0x374ffc,_0x2eeea9){_0x2eeea9=_0x2eeea9||0x1f4;return function(_0x6bf7ca){logger['error'](_0x6bf7ca[_0x12eb('0x28')]);if(_0x6bf7ca['name']){delete _0x6bf7ca[_0x12eb('0x29')];}_0x374ffc[_0x12eb('0x1a')](_0x2eeea9)[_0x12eb('0x2a')](_0x6bf7ca);};}exports['index']=function(_0x56018d,_0x3bed84){var _0xca62ba={},_0x4d25aa={},_0x59f737={'count':0x0,'rows':[]};var _0x27f076=_[_0x12eb('0x2b')](db[_0x12eb('0x2c')][_0x12eb('0x2d')],function(_0x4c6ca0){return{'name':_0x4c6ca0[_0x12eb('0x2e')],'type':_0x4c6ca0['type']['key']};});_0x4d25aa[_0x12eb('0x2f')]=_[_0x12eb('0x2b')](_0x27f076,_0x12eb('0x29'));_0x4d25aa[_0x12eb('0x30')]=_['keys'](_0x56018d[_0x12eb('0x30')]);_0x4d25aa['filters']=_['intersection'](_0x4d25aa[_0x12eb('0x2f')],_0x4d25aa['query']);_0xca62ba[_0x12eb('0x31')]=_['intersection'](_0x4d25aa[_0x12eb('0x2f')],qs['fields'](_0x56018d[_0x12eb('0x30')]['fields']));_0xca62ba[_0x12eb('0x31')]=_0xca62ba['attributes']['length']?_0xca62ba[_0x12eb('0x31')]:_0x4d25aa[_0x12eb('0x2f')];if(!_0x56018d[_0x12eb('0x30')][_0x12eb('0x32')]('nolimit')){_0xca62ba[_0x12eb('0x1f')]=qs['limit'](_0x56018d['query'][_0x12eb('0x1f')]);_0xca62ba[_0x12eb('0x1d')]=qs[_0x12eb('0x1d')](_0x56018d['query'][_0x12eb('0x1d')]);}_0xca62ba[_0x12eb('0x33')]=qs[_0x12eb('0x34')](_0x56018d[_0x12eb('0x30')]['sort']);_0xca62ba['where']=qs[_0x12eb('0x35')](_[_0x12eb('0x36')](_0x56018d[_0x12eb('0x30')],_0x4d25aa[_0x12eb('0x35')]),_0x27f076);if(_0x56018d[_0x12eb('0x30')][_0x12eb('0x37')]){_0xca62ba[_0x12eb('0x38')]=_['merge'](_0xca62ba[_0x12eb('0x38')],{'$or':_[_0x12eb('0x2b')](_0x27f076,function(_0x535e1e){if(_0x535e1e['type']!==_0x12eb('0x39')){var _0x5c487c={};_0x5c487c[_0x535e1e[_0x12eb('0x29')]]={'$like':'%'+_0x56018d[_0x12eb('0x30')][_0x12eb('0x37')]+'%'};return _0x5c487c;}})});}_0xca62ba=_[_0x12eb('0x3a')]({},_0xca62ba,_0x56018d['options']);var _0x54a42e={'where':_0xca62ba['where']};return db[_0x12eb('0x2c')][_0x12eb('0x20')](_0x54a42e)[_0x12eb('0x26')](function(_0x24093e){_0x59f737[_0x12eb('0x20')]=_0x24093e;if(_0x56018d['query'][_0x12eb('0x3b')]){_0xca62ba[_0x12eb('0x3c')]=[{'all':!![]}];}return db[_0x12eb('0x2c')]['findAll'](_0xca62ba);})['then'](function(_0x391856){_0x59f737[_0x12eb('0x3d')]=_0x391856;return _0x59f737;})[_0x12eb('0x26')](respondWithFilteredResult(_0x3bed84,_0xca62ba))['catch'](handleError(_0x3bed84,null));};exports[_0x12eb('0x3e')]=function(_0x5503ee,_0x164a30){var _0xb6784e={'raw':!![],'where':{'id':_0x5503ee[_0x12eb('0x3f')]['id']}},_0x212844={};_0x212844[_0x12eb('0x2f')]=_[_0x12eb('0x40')](db[_0x12eb('0x2c')][_0x12eb('0x2d')]);_0x212844['query']=_[_0x12eb('0x40')](_0x5503ee[_0x12eb('0x30')]);_0x212844[_0x12eb('0x35')]=_[_0x12eb('0x41')](_0x212844[_0x12eb('0x2f')],_0x212844[_0x12eb('0x30')]);_0xb6784e[_0x12eb('0x31')]=_[_0x12eb('0x41')](_0x212844[_0x12eb('0x2f')],qs[_0x12eb('0x42')](_0x5503ee[_0x12eb('0x30')][_0x12eb('0x42')]));_0xb6784e[_0x12eb('0x31')]=_0xb6784e[_0x12eb('0x31')][_0x12eb('0x43')]?_0xb6784e['attributes']:_0x212844['model'];if(_0x5503ee['query']['includeAll']){_0xb6784e[_0x12eb('0x3c')]=[{'all':!![]}];}_0xb6784e=_[_0x12eb('0x3a')]({},_0xb6784e,_0x5503ee['options']);return db[_0x12eb('0x2c')][_0x12eb('0x44')](_0xb6784e)[_0x12eb('0x26')](handleEntityNotFound(_0x164a30,null))['then'](respondWithResult(_0x164a30,null))['catch'](handleError(_0x164a30,null));};exports[_0x12eb('0x45')]=function(_0xcd144c,_0xf590f1){return db[_0x12eb('0x2c')][_0x12eb('0x45')](_0xcd144c[_0x12eb('0x46')],{})['then'](respondWithResult(_0xf590f1,0xc9))['catch'](handleError(_0xf590f1,null));};exports[_0x12eb('0x25')]=function(_0x186575,_0x64a0cd){if(_0x186575[_0x12eb('0x46')]['id']){delete _0x186575[_0x12eb('0x46')]['id'];}return db[_0x12eb('0x2c')][_0x12eb('0x44')]({'where':{'id':_0x186575[_0x12eb('0x3f')]['id']}})[_0x12eb('0x26')](handleEntityNotFound(_0x64a0cd,null))[_0x12eb('0x26')](saveUpdates(_0x186575[_0x12eb('0x46')],null))[_0x12eb('0x26')](respondWithResult(_0x64a0cd,null))[_0x12eb('0x47')](handleError(_0x64a0cd,null));};exports['destroy']=function(_0x3fff0b,_0x46e3eb){return db[_0x12eb('0x2c')][_0x12eb('0x44')]({'where':{'id':_0x3fff0b[_0x12eb('0x3f')]['id']}})[_0x12eb('0x26')](handleEntityNotFound(_0x46e3eb,null))[_0x12eb('0x26')](removeEntity(_0x46e3eb,null))[_0x12eb('0x47')](handleError(_0x46e3eb,null));};exports[_0x12eb('0x48')]=function(_0x577c37,_0x42b31a){return db['MailTransferReport'][_0x12eb('0x48')]()['then'](respondWithResult(_0x42b31a,null))[_0x12eb('0x47')](handleError(_0x42b31a,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 74511e6..797edad 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 _0x7764=['moment','bluebird','request-promise','path','rimraf','../../config/environment','MailTransferReport','report_mail_transfer','lodash','util','../../config/logger','api'];(function(_0x22cc16,_0x1f4fa2){var _0x399b70=function(_0x34d464){while(--_0x34d464){_0x22cc16['push'](_0x22cc16['shift']());}};_0x399b70(++_0x1f4fa2);}(_0x7764,0xa4));var _0x4776=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0x7764[_0x52f1e6];return _0x21f104;};'use strict';var _=require(_0x4776('0x0'));var util=require(_0x4776('0x1'));var logger=require(_0x4776('0x2'))(_0x4776('0x3'));var moment=require(_0x4776('0x4'));var BPromise=require(_0x4776('0x5'));var rp=require(_0x4776('0x6'));var fs=require('fs');var path=require(_0x4776('0x7'));var rimraf=require(_0x4776('0x8'));var config=require(_0x4776('0x9'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0xc431bf,_0x3eff9c){return _0xc431bf['define'](_0x4776('0xa'),attributes,{'tableName':_0x4776('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc7a4=['path','rimraf','../../config/environment','exports','define','MailTransferReport','uniqueid','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x571597,_0x1b1038){var _0x50e812=function(_0x36083e){while(--_0x36083e){_0x571597['push'](_0x571597['shift']());}};_0x50e812(++_0x1b1038);}(_0xc7a4,0x8b));var _0x4c7a=function(_0x2cfb34,_0x3449d1){_0x2cfb34=_0x2cfb34-0x0;var _0x4716dd=_0xc7a4[_0x2cfb34];return _0x4716dd;};'use strict';var _=require(_0x4c7a('0x0'));var util=require(_0x4c7a('0x1'));var logger=require(_0x4c7a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4c7a('0x3'));var rp=require(_0x4c7a('0x4'));var fs=require('fs');var path=require(_0x4c7a('0x5'));var rimraf=require(_0x4c7a('0x6'));var config=require(_0x4c7a('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0x4c7a('0x8')]=function(_0x15e6ed,_0x351507){return _0x15e6ed[_0x4c7a('0x9')](_0x4c7a('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x4c7a('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index c782056..f110814 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 _0x4ba8=['../../config/environment','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4ba8,0x12f));var _0x84ba=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4ba8[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x84ba('0x0'));var moment=require(_0x84ba('0x1'));var BPromise=require(_0x84ba('0x2'));var rs=require(_0x84ba('0x3'));var fs=require('fs');var Redis=require(_0x84ba('0x4'));var db=require(_0x84ba('0x5'))['db'];var utils=require(_0x84ba('0x6'));var logger=require(_0x84ba('0x7'))(_0x84ba('0x8'));var config=require(_0x84ba('0x9'));var jayson=require(_0x84ba('0xa'));var client=jayson[_0x84ba('0xb')][_0x84ba('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2705a1,_0x11aaba,_0x236f20){return new BPromise(function(_0xb796af,_0x65ceba){return client[_0x84ba('0xd')](_0x2705a1,_0x236f20)['then'](function(_0x39329d){logger[_0x84ba('0xe')](_0x84ba('0xf'),_0x11aaba,_0x84ba('0x10'));logger[_0x84ba('0x11')](_0x84ba('0x12'),_0x11aaba,_0x84ba('0x10'),JSON[_0x84ba('0x13')](_0x39329d));if(_0x39329d[_0x84ba('0x14')]){if(_0x39329d[_0x84ba('0x14')][_0x84ba('0x15')]===0x1f4){logger[_0x84ba('0x14')](_0x84ba('0xf'),_0x11aaba,_0x39329d['error'][_0x84ba('0x16')]);return _0x65ceba(_0x39329d[_0x84ba('0x14')][_0x84ba('0x16')]);}logger['error'](_0x84ba('0xf'),_0x11aaba,_0x39329d[_0x84ba('0x14')][_0x84ba('0x16')]);return _0xb796af(_0x39329d[_0x84ba('0x14')][_0x84ba('0x16')]);}else{logger[_0x84ba('0xe')](_0x84ba('0xf'),_0x11aaba,_0x84ba('0x10'));_0xb796af(_0x39329d[_0x84ba('0x17')][_0x84ba('0x16')]);}})['catch'](function(_0x287213){logger[_0x84ba('0x14')](_0x84ba('0xf'),_0x11aaba,_0x287213);_0x65ceba(_0x287213);});});} \ No newline at end of file +var _0xbade=['../../config/logger','rpc','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x9bec1c,_0x5d262a){var _0x1c3432=function(_0x4e62f8){while(--_0x4e62f8){_0x9bec1c['push'](_0x9bec1c['shift']());}};_0x1c3432(++_0x5d262a);}(_0xbade,0xd0));var _0xebad=function(_0x4cd21c,_0x35fa45){_0x4cd21c=_0x4cd21c-0x0;var _0x5d8e5e=_0xbade[_0x4cd21c];return _0x5d8e5e;};'use strict';var _=require(_0xebad('0x0'));var util=require(_0xebad('0x1'));var moment=require(_0xebad('0x2'));var BPromise=require(_0xebad('0x3'));var rs=require(_0xebad('0x4'));var fs=require('fs');var Redis=require(_0xebad('0x5'));var db=require(_0xebad('0x6'))['db'];var utils=require(_0xebad('0x7'));var logger=require(_0xebad('0x8'))(_0xebad('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xebad('0xa')][_0xebad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3384a2,_0x59fa26,_0xdc4bd8){return new BPromise(function(_0x38f267,_0x27492e){return client[_0xebad('0xc')](_0x3384a2,_0xdc4bd8)['then'](function(_0x1b9e01){logger[_0xebad('0xd')](_0xebad('0xe'),_0x59fa26,_0xebad('0xf'));logger[_0xebad('0x10')](_0xebad('0x11'),_0x59fa26,_0xebad('0xf'),JSON[_0xebad('0x12')](_0x1b9e01));if(_0x1b9e01[_0xebad('0x13')]){if(_0x1b9e01[_0xebad('0x13')][_0xebad('0x14')]===0x1f4){logger[_0xebad('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x59fa26,_0x1b9e01[_0xebad('0x13')][_0xebad('0x15')]);return _0x27492e(_0x1b9e01[_0xebad('0x13')][_0xebad('0x15')]);}logger[_0xebad('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x59fa26,_0x1b9e01[_0xebad('0x13')][_0xebad('0x15')]);return _0x38f267(_0x1b9e01[_0xebad('0x13')][_0xebad('0x15')]);}else{logger['info'](_0xebad('0xe'),_0x59fa26,_0xebad('0xf'));_0x38f267(_0x1b9e01[_0xebad('0x16')][_0xebad('0x15')]);}})[_0xebad('0x17')](function(_0x17a97){logger[_0xebad('0x13')](_0xebad('0xe'),_0x59fa26,_0x17a97);_0x27492e(_0x17a97);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 072db20..4fded67 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 _0x60f3=['isAuthenticated','index','/describe','show','post','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x35dcfb,_0x3361df){var _0x4334c3=function(_0xa761aa){while(--_0xa761aa){_0x35dcfb['push'](_0x35dcfb['shift']());}};_0x4334c3(++_0x3361df);}(_0x60f3,0x1ad));var _0x360f=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x60f3[_0x34325b];return _0x3da348;};'use strict';var multer=require(_0x360f('0x0'));var util=require('util');var path=require(_0x360f('0x1'));var timeout=require(_0x360f('0x2'));var express=require('express');var router=express[_0x360f('0x3')]();var fs_extra=require(_0x360f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x360f('0x5'));var config=require(_0x360f('0x6'));var controller=require('./memberReport.controller');router[_0x360f('0x7')]('/',auth[_0x360f('0x8')](),controller[_0x360f('0x9')]);router[_0x360f('0x7')](_0x360f('0xa'),auth[_0x360f('0x8')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x360f('0xb')]);router[_0x360f('0xc')]('/',auth[_0x360f('0x8')](),controller[_0x360f('0xd')]);router[_0x360f('0xe')](_0x360f('0xf'),auth[_0x360f('0x8')](),controller[_0x360f('0x10')]);router['delete'](_0x360f('0xf'),auth[_0x360f('0x8')](),controller[_0x360f('0x11')]);module[_0x360f('0x12')]=router; \ No newline at end of file +var _0x09fe=['show','post','create','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','./memberReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09fe,0x15e));var _0xe09f=function(_0xcf458f,_0x15bebb){_0xcf458f=_0xcf458f-0x0;var _0x1ac455=_0x09fe[_0xcf458f];return _0x1ac455;};'use strict';var multer=require(_0xe09f('0x0'));var util=require(_0xe09f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe09f('0x2'));var router=express[_0xe09f('0x3')]();var fs_extra=require(_0xe09f('0x4'));var auth=require(_0xe09f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe09f('0x6'));router[_0xe09f('0x7')]('/',auth[_0xe09f('0x8')](),controller[_0xe09f('0x9')]);router['get'](_0xe09f('0xa'),auth[_0xe09f('0x8')](),controller['describe']);router['get']('/:id',auth[_0xe09f('0x8')](),controller[_0xe09f('0xb')]);router[_0xe09f('0xc')]('/',auth[_0xe09f('0x8')](),controller[_0xe09f('0xd')]);router['put'](_0xe09f('0xe'),auth[_0xe09f('0x8')](),controller[_0xe09f('0xf')]);router[_0xe09f('0x10')](_0xe09f('0xe'),auth[_0xe09f('0x8')](),controller[_0xe09f('0x11')]);module[_0xe09f('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 2b2fcc6..069c44b 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 _0xd0ed=['INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x4f431d,_0xd51a3b){var _0x4f31e1=function(_0x1c688d){while(--_0x1c688d){_0x4f431d['push'](_0x4f431d['shift']());}};_0x4f31e1(++_0xd51a3b);}(_0xd0ed,0x18a));var _0xdd0e=function(_0x5edcd9,_0x21c127){_0x5edcd9=_0x5edcd9-0x0;var _0x2ff058=_0xd0ed[_0x5edcd9];return _0x2ff058;};'use strict';var Sequelize=require(_0xdd0e('0x0'));var moment=require(_0xdd0e('0x1'));module[_0xdd0e('0x2')]={'channel':{'type':Sequelize[_0xdd0e('0x3')]},'membername':{'type':Sequelize[_0xdd0e('0x3')]},'interface':{'type':Sequelize[_0xdd0e('0x3')]},'type':{'type':Sequelize[_0xdd0e('0x3')],'defaultValue':_0xdd0e('0x4'),'comment':_0xdd0e('0x5')},'duration':{'type':Sequelize[_0xdd0e('0x6')]},'enterAt':{'type':Sequelize[_0xdd0e('0x7')]},'exitAt':{'type':Sequelize[_0xdd0e('0x7')],'set':function(_0xa1d0e3){var _0x32a3f6=moment(_0xa1d0e3);var _0x113c99=moment(this[_0xdd0e('0x8')](_0xdd0e('0x9')));var _0x52ce76=_0x32a3f6[_0xdd0e('0xa')](_0x113c99,_0xdd0e('0xb'));this['setDataValue']('exitAt',_0xa1d0e3);this[_0xdd0e('0xc')]('duration',_0x52ce76>=0x0?_0x52ce76:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xdd0e('0x3')],'comment':_0xdd0e('0xd')},'data3':{'type':Sequelize[_0xdd0e('0x3')],'comment':_0xdd0e('0xe')},'data4':{'type':Sequelize[_0xdd0e('0x3')],'comment':_0xdd0e('0xf')},'data5':{'type':Sequelize[_0xdd0e('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xdd0e('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xdd0e('0x3')]}}; \ No newline at end of file +var _0xe70e=['talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','DATE','enterAt','diff','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe70e,0x11a));var _0xee70=function(_0x3ce32f,_0x144a67){_0x3ce32f=_0x3ce32f-0x0;var _0x568bc0=_0xe70e[_0x3ce32f];return _0x568bc0;};'use strict';var Sequelize=require(_0xee70('0x0'));var moment=require(_0xee70('0x1'));module[_0xee70('0x2')]={'channel':{'type':Sequelize[_0xee70('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xee70('0x3')]},'type':{'type':Sequelize[_0xee70('0x3')],'defaultValue':_0xee70('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xee70('0x5')]},'exitAt':{'type':Sequelize[_0xee70('0x5')],'set':function(_0x1d229c){var _0x2250ee=moment(_0x1d229c);var _0x6716be=moment(this['getDataValue'](_0xee70('0x6')));var _0x30efc4=_0x2250ee[_0xee70('0x7')](_0x6716be,'seconds');this[_0xee70('0x8')]('exitAt',_0x1d229c);this[_0xee70('0x8')](_0xee70('0x9'),_0x30efc4>=0x0?_0x30efc4:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xee70('0xa')},'data2':{'type':Sequelize[_0xee70('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0xee70('0xb')},'data4':{'type':Sequelize[_0xee70('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0xee70('0xc')},'role':{'type':Sequelize[_0xee70('0x3')]},'internal':{'type':Sequelize[_0xee70('0xd')]},'uniqueid':{'type':Sequelize[_0xee70('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 4b5da6e..1edf2e5 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(_0x41c8ab,_0x2fc2d1){var _0x35820c=function(_0x3d13e3){while(--_0x3d13e3){_0x41c8ab['push'](_0x41c8ab['shift']());}};_0x35820c(++_0x2fc2d1);}(_0x3e74,0x175));var _0x43e7=function(_0x4a3e68,_0x2b63fa){_0x4a3e68=_0x4a3e68-0x0;var _0x3f1bb0=_0x3e74[_0x4a3e68];return _0x3f1bb0;};'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 _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x2769ee,_0x1cd801){var _0x36431d=function(_0x33499a){while(--_0x33499a){_0x2769ee['push'](_0x2769ee['shift']());}};_0x36431d(++_0x1cd801);}(_0x008c,0x188));var _0xc008=function(_0xc831c6,_0x542b00){_0xc831c6=_0xc831c6-0x0;var _0x5063a7=_0x008c[_0xc831c6];return _0x5063a7;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index b0a5550..3f091d1 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 _0x9d2f=['path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4328fc,_0x6a1aa2){var _0xbcbe50=function(_0x1d89fa){while(--_0x1d89fa){_0x4328fc['push'](_0x4328fc['shift']());}};_0xbcbe50(++_0x6a1aa2);}(_0x9d2f,0x14a));var _0xf9d2=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x9d2f[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0xf9d2('0x0'));var util=require(_0xf9d2('0x1'));var logger=require(_0xf9d2('0x2'))(_0xf9d2('0x3'));var moment=require('moment');var BPromise=require(_0xf9d2('0x4'));var rp=require(_0xf9d2('0x5'));var fs=require('fs');var path=require(_0xf9d2('0x6'));var rimraf=require(_0xf9d2('0x7'));var config=require(_0xf9d2('0x8'));var attributes=require(_0xf9d2('0x9'));module['exports']=function(_0x3761dc,_0xa28f8d){return _0x3761dc[_0xf9d2('0xa')](_0xf9d2('0xb'),attributes,{'tableName':_0xf9d2('0xc'),'paranoid':![],'indexes':[{'name':_0xf9d2('0xd'),'fields':[_0xf9d2('0xe'),_0xf9d2('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd74=['membername_interface','interface','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member'];(function(_0xaf0836,_0x36fa48){var _0x719bd2=function(_0x2f7fcf){while(--_0x2f7fcf){_0xaf0836['push'](_0xaf0836['shift']());}};_0x719bd2(++_0x36fa48);}(_0xfd74,0x1f1));var _0x4fd7=function(_0x441563,_0x1d4a28){_0x441563=_0x441563-0x0;var _0x2369ec=_0xfd74[_0x441563];return _0x2369ec;};'use strict';var _=require('lodash');var util=require(_0x4fd7('0x0'));var logger=require(_0x4fd7('0x1'))(_0x4fd7('0x2'));var moment=require(_0x4fd7('0x3'));var BPromise=require(_0x4fd7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fd7('0x5'));var rimraf=require(_0x4fd7('0x6'));var config=require(_0x4fd7('0x7'));var attributes=require(_0x4fd7('0x8'));module[_0x4fd7('0x9')]=function(_0x1bcfd1,_0x5cc3c1){return _0x1bcfd1[_0x4fd7('0xa')](_0x4fd7('0xb'),attributes,{'tableName':_0x4fd7('0xc'),'paranoid':![],'indexes':[{'name':_0x4fd7('0xd'),'fields':['membername',_0x4fd7('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 0f84187..9d5562f 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 _0x6dac=['client','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','limit','include','map','model','attributes','create','body','CreateMemberReport','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1f6156,_0x41931c){var _0x3d7a78=function(_0x53777b){while(--_0x53777b){_0x1f6156['push'](_0x1f6156['shift']());}};_0x3d7a78(++_0x41931c);}(_0x6dac,0x16e));var _0xc6da=function(_0x57e326,_0x4b5d50){_0x57e326=_0x57e326-0x0;var _0x3b2c4f=_0x6dac[_0x57e326];return _0x3b2c4f;};'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});function respondWithRpcPromise(_0x1ebd11,_0x1abd90,_0x5a0d8d){return new BPromise(function(_0x3047d3,_0x2bfaa6){return client[_0xc6da('0xd')](_0x1ebd11,_0x5a0d8d)[_0xc6da('0xe')](function(_0x39a8d8){logger[_0xc6da('0xf')]('MemberReport,\x20%s,\x20%s',_0x1abd90,_0xc6da('0x10'));logger[_0xc6da('0x11')](_0xc6da('0x12'),_0x1abd90,_0xc6da('0x10'),JSON[_0xc6da('0x13')](_0x39a8d8));if(_0x39a8d8[_0xc6da('0x14')]){if(_0x39a8d8[_0xc6da('0x14')][_0xc6da('0x15')]===0x1f4){logger[_0xc6da('0x14')](_0xc6da('0x16'),_0x1abd90,_0x39a8d8[_0xc6da('0x14')][_0xc6da('0x17')]);return _0x2bfaa6(_0x39a8d8[_0xc6da('0x14')]['message']);}logger[_0xc6da('0x14')](_0xc6da('0x16'),_0x1abd90,_0x39a8d8[_0xc6da('0x14')][_0xc6da('0x17')]);return _0x3047d3(_0x39a8d8[_0xc6da('0x14')][_0xc6da('0x17')]);}else{logger['info'](_0xc6da('0x16'),_0x1abd90,_0xc6da('0x10'));_0x3047d3(_0x39a8d8[_0xc6da('0x18')][_0xc6da('0x17')]);}})[_0xc6da('0x19')](function(_0x5463a1){logger[_0xc6da('0x14')]('MemberReport,\x20%s,\x20%s',_0x1abd90,_0x5463a1);_0x2bfaa6(_0x5463a1);});});}exports[_0xc6da('0x1a')]=function(_0x2a63cc){var _0xac1042=this;return new Promise(function(_0x25737d,_0x4b08f1){return db[_0xc6da('0x1b')][_0xc6da('0x1c')]({'raw':_0x2a63cc[_0xc6da('0x1d')]?_0x2a63cc[_0xc6da('0x1d')][_0xc6da('0x1e')]===undefined?!![]:![]:!![],'where':_0x2a63cc[_0xc6da('0x1d')]?_0x2a63cc[_0xc6da('0x1d')][_0xc6da('0x1f')]||null:null,'attributes':_0x2a63cc[_0xc6da('0x1d')]?_0x2a63cc[_0xc6da('0x1d')]['attributes']||null:null,'limit':_0x2a63cc[_0xc6da('0x1d')]?_0x2a63cc[_0xc6da('0x1d')][_0xc6da('0x20')]||null:null,'include':_0x2a63cc[_0xc6da('0x1d')]?_0x2a63cc['options'][_0xc6da('0x21')]?_[_0xc6da('0x22')](_0x2a63cc['options'][_0xc6da('0x21')],function(_0x3b180c){return{'model':db[_0x3b180c[_0xc6da('0x23')]],'as':_0x3b180c['as'],'attributes':_0x3b180c[_0xc6da('0x24')],'include':_0x3b180c['include']?_[_0xc6da('0x22')](_0x3b180c[_0xc6da('0x21')],function(_0x55c059){return{'model':db[_0x55c059[_0xc6da('0x23')]],'as':_0x55c059['as'],'attributes':_0x55c059[_0xc6da('0x24')],'include':_0x55c059[_0xc6da('0x21')]?_['map'](_0x55c059['include'],function(_0x1ded21){return{'model':db[_0x1ded21[_0xc6da('0x23')]],'as':_0x1ded21['as'],'attributes':_0x1ded21['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5228a4){logger['info'](_0xc6da('0x1a'),_0x2a63cc);logger[_0xc6da('0x11')](_0xc6da('0x1a'),_0x2a63cc,JSON['stringify'](_0x5228a4));_0x25737d(_0x5228a4);})[_0xc6da('0x19')](function(_0xda1aef){logger[_0xc6da('0x14')](_0xc6da('0x1a'),_0xda1aef['message'],_0x2a63cc);_0x4b08f1(_0xac1042['error'](0x1f4,_0xda1aef[_0xc6da('0x17')]));});});};exports['CreateMemberReport']=function(_0x2d77db){var _0xff5a50=this;return new Promise(function(_0xf62f79,_0x5782d4){return db[_0xc6da('0x1b')][_0xc6da('0x25')](_0x2d77db[_0xc6da('0x26')],{'raw':_0x2d77db[_0xc6da('0x1d')]?_0x2d77db[_0xc6da('0x1d')][_0xc6da('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x4f8c81){logger[_0xc6da('0xf')](_0xc6da('0x27'),_0x2d77db);logger['debug']('CreateMemberReport',_0x2d77db,JSON[_0xc6da('0x13')](_0x4f8c81));_0xf62f79(_0x4f8c81);})[_0xc6da('0x19')](function(_0x4660f1){logger[_0xc6da('0x14')](_0xc6da('0x27'),_0x4660f1[_0xc6da('0x17')],_0x2d77db);_0x5782d4(_0xff5a50[_0xc6da('0x14')](0x1f4,_0x4660f1[_0xc6da('0x17')]));});});};exports[_0xc6da('0x28')]=function(_0xc6f8ca){var _0x1063fc=this;return new Promise(function(_0x417776,_0x3c0d37){return db['MemberReport'][_0xc6da('0x29')](_0xc6f8ca['body'],{'raw':_0xc6f8ca[_0xc6da('0x1d')]?_0xc6f8ca[_0xc6da('0x1d')][_0xc6da('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc6f8ca['options']?_0xc6f8ca[_0xc6da('0x1d')][_0xc6da('0x1f')]||null:null,'attributes':_0xc6f8ca[_0xc6da('0x1d')]?_0xc6f8ca['options'][_0xc6da('0x24')]||null:null,'limit':_0xc6f8ca['options']?_0xc6f8ca[_0xc6da('0x1d')]['limit']||null:null})[_0xc6da('0xe')](function(_0x3526e7){logger[_0xc6da('0xf')]('UpdateMemberReport',_0xc6f8ca);logger['debug'](_0xc6da('0x28'),_0xc6f8ca,JSON['stringify'](_0x3526e7));_0x417776(_0x3526e7);})['catch'](function(_0x376c58){logger[_0xc6da('0x14')](_0xc6da('0x28'),_0x376c58[_0xc6da('0x17')],_0xc6f8ca);_0x3c0d37(_0x1063fc[_0xc6da('0x14')](0x1f4,_0x376c58[_0xc6da('0x17')]));});});}; \ No newline at end of file +var _0x624c=['request','then','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetMemberReport','MemberReport','options','raw','where','attributes','limit','map','include','model','CreateMemberReport','create','body','debug','UpdateMemberReport','update','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x31e302,_0x7e7d2c){var _0x440789=function(_0x4f5c8a){while(--_0x4f5c8a){_0x31e302['push'](_0x31e302['shift']());}};_0x440789(++_0x7e7d2c);}(_0x624c,0x1ee));var _0xc624=function(_0x24201a,_0x3ed184){_0x24201a=_0x24201a-0x0;var _0x36a6b9=_0x624c[_0x24201a];return _0x36a6b9;};'use strict';var _=require('lodash');var util=require(_0xc624('0x0'));var moment=require(_0xc624('0x1'));var BPromise=require(_0xc624('0x2'));var rs=require(_0xc624('0x3'));var fs=require('fs');var Redis=require(_0xc624('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc624('0x5'));var logger=require('../../config/logger')(_0xc624('0x6'));var config=require('../../config/environment');var jayson=require(_0xc624('0x7'));var client=jayson[_0xc624('0x8')][_0xc624('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x222b60,_0x195296,_0x6cd772){return new BPromise(function(_0x2ba147,_0x4beebb){return client[_0xc624('0xa')](_0x222b60,_0x6cd772)[_0xc624('0xb')](function(_0x424940){logger['info'](_0xc624('0xc'),_0x195296,_0xc624('0xd'));logger['debug'](_0xc624('0xe'),_0x195296,_0xc624('0xd'),JSON[_0xc624('0xf')](_0x424940));if(_0x424940[_0xc624('0x10')]){if(_0x424940[_0xc624('0x10')]['code']===0x1f4){logger[_0xc624('0x10')](_0xc624('0xc'),_0x195296,_0x424940[_0xc624('0x10')][_0xc624('0x11')]);return _0x4beebb(_0x424940['error']['message']);}logger['error'](_0xc624('0xc'),_0x195296,_0x424940['error'][_0xc624('0x11')]);return _0x2ba147(_0x424940[_0xc624('0x10')][_0xc624('0x11')]);}else{logger[_0xc624('0x12')](_0xc624('0xc'),_0x195296,_0xc624('0xd'));_0x2ba147(_0x424940['result'][_0xc624('0x11')]);}})[_0xc624('0x13')](function(_0x27660b){logger['error'](_0xc624('0xc'),_0x195296,_0x27660b);_0x4beebb(_0x27660b);});});}exports[_0xc624('0x14')]=function(_0x5e263a){var _0x151671=this;return new Promise(function(_0x170a4,_0x4d0ece){return db[_0xc624('0x15')]['findAll']({'raw':_0x5e263a['options']?_0x5e263a[_0xc624('0x16')][_0xc624('0x17')]===undefined?!![]:![]:!![],'where':_0x5e263a[_0xc624('0x16')]?_0x5e263a[_0xc624('0x16')][_0xc624('0x18')]||null:null,'attributes':_0x5e263a['options']?_0x5e263a[_0xc624('0x16')][_0xc624('0x19')]||null:null,'limit':_0x5e263a[_0xc624('0x16')]?_0x5e263a['options'][_0xc624('0x1a')]||null:null,'include':_0x5e263a['options']?_0x5e263a[_0xc624('0x16')]['include']?_[_0xc624('0x1b')](_0x5e263a[_0xc624('0x16')][_0xc624('0x1c')],function(_0x4b1812){return{'model':db[_0x4b1812['model']],'as':_0x4b1812['as'],'attributes':_0x4b1812[_0xc624('0x19')],'include':_0x4b1812[_0xc624('0x1c')]?_[_0xc624('0x1b')](_0x4b1812[_0xc624('0x1c')],function(_0x3b0dca){return{'model':db[_0x3b0dca[_0xc624('0x1d')]],'as':_0x3b0dca['as'],'attributes':_0x3b0dca[_0xc624('0x19')],'include':_0x3b0dca[_0xc624('0x1c')]?_[_0xc624('0x1b')](_0x3b0dca[_0xc624('0x1c')],function(_0x489a04){return{'model':db[_0x489a04[_0xc624('0x1d')]],'as':_0x489a04['as'],'attributes':_0x489a04[_0xc624('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc624('0xb')](function(_0x19e607){logger[_0xc624('0x12')]('GetMemberReport',_0x5e263a);logger['debug']('GetMemberReport',_0x5e263a,JSON[_0xc624('0xf')](_0x19e607));_0x170a4(_0x19e607);})['catch'](function(_0x429e1d){logger[_0xc624('0x10')](_0xc624('0x14'),_0x429e1d['message'],_0x5e263a);_0x4d0ece(_0x151671[_0xc624('0x10')](0x1f4,_0x429e1d[_0xc624('0x11')]));});});};exports[_0xc624('0x1e')]=function(_0x3b8eb7){var _0x4482af=this;return new Promise(function(_0x5cfecb,_0x50448b){return db['MemberReport'][_0xc624('0x1f')](_0x3b8eb7[_0xc624('0x20')],{'raw':_0x3b8eb7[_0xc624('0x16')]?_0x3b8eb7[_0xc624('0x16')][_0xc624('0x17')]===undefined?!![]:![]:!![]})[_0xc624('0xb')](function(_0x1a86e5){logger['info'](_0xc624('0x1e'),_0x3b8eb7);logger[_0xc624('0x21')](_0xc624('0x1e'),_0x3b8eb7,JSON[_0xc624('0xf')](_0x1a86e5));_0x5cfecb(_0x1a86e5);})[_0xc624('0x13')](function(_0x3eb175){logger[_0xc624('0x10')](_0xc624('0x1e'),_0x3eb175[_0xc624('0x11')],_0x3b8eb7);_0x50448b(_0x4482af['error'](0x1f4,_0x3eb175['message']));});});};exports[_0xc624('0x22')]=function(_0x3174d2){var _0x1eb824=this;return new Promise(function(_0x43958b,_0x3c281b){return db[_0xc624('0x15')][_0xc624('0x23')](_0x3174d2[_0xc624('0x20')],{'raw':_0x3174d2[_0xc624('0x16')]?_0x3174d2[_0xc624('0x16')][_0xc624('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3174d2['options']?_0x3174d2[_0xc624('0x16')]['where']||null:null,'attributes':_0x3174d2['options']?_0x3174d2[_0xc624('0x16')][_0xc624('0x19')]||null:null,'limit':_0x3174d2[_0xc624('0x16')]?_0x3174d2['options']['limit']||null:null})[_0xc624('0xb')](function(_0x5f7f3a){logger[_0xc624('0x12')]('UpdateMemberReport',_0x3174d2);logger['debug'](_0xc624('0x22'),_0x3174d2,JSON['stringify'](_0x5f7f3a));_0x43958b(_0x5f7f3a);})[_0xc624('0x13')](function(_0x41fbb3){logger['error'](_0xc624('0x22'),_0x41fbb3['message'],_0x3174d2);_0x3c281b(_0x1eb824['error'](0x1f4,_0x41fbb3[_0xc624('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index e151a5c..41d6917 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 _0xb68a=['exports','multer','util','path','express','Router','../../config/environment','get','index'];(function(_0x3f509f,_0x50a74e){var _0x448dbb=function(_0x463b56){while(--_0x463b56){_0x3f509f['push'](_0x3f509f['shift']());}};_0x448dbb(++_0x50a74e);}(_0xb68a,0x1a8));var _0xab68=function(_0x1fab69,_0x279ffd){_0x1fab69=_0x1fab69-0x0;var _0x1d8b67=_0xb68a[_0x1fab69];return _0x1d8b67;};'use strict';var multer=require(_0xab68('0x0'));var util=require(_0xab68('0x1'));var path=require(_0xab68('0x2'));var timeout=require('connect-timeout');var express=require(_0xab68('0x3'));var router=express[_0xab68('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xab68('0x5'));var controller=require('./migration.controller');router[_0xab68('0x6')]('/',controller[_0xab68('0x7')]);module[_0xab68('0x8')]=router; \ No newline at end of file +var _0xf483=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','exports','util'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xf483,0xf2));var _0x3f48=function(_0x1b02eb,_0x52f6a5){_0x1b02eb=_0x1b02eb-0x0;var _0x101aa6=_0xf483[_0x1b02eb];return _0x101aa6;};'use strict';var multer=require('multer');var util=require(_0x3f48('0x0'));var path=require('path');var timeout=require(_0x3f48('0x1'));var express=require(_0x3f48('0x2'));var router=express[_0x3f48('0x3')]();var fs_extra=require(_0x3f48('0x4'));var auth=require(_0x3f48('0x5'));var interaction=require(_0x3f48('0x6'));var config=require('../../config/environment');var controller=require('./migration.controller');router['get']('/',controller[_0x3f48('0x7')]);module[_0x3f48('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 89d102b..4c8b653 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 _0x21b5=['sequelize'];(function(_0x4e9274,_0x49576e){var _0x8b474c=function(_0x204cca){while(--_0x204cca){_0x4e9274['push'](_0x4e9274['shift']());}};_0x8b474c(++_0x49576e);}(_0x21b5,0x141));var _0x521b=function(_0x28d80b,_0x151137){_0x28d80b=_0x28d80b-0x0;var _0x4b9c92=_0x21b5[_0x28d80b];return _0x4b9c92;};'use strict';var Sequelize=require(_0x521b('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0x67a9=['sequelize','exports','STRING'];(function(_0x876984,_0x3c464b){var _0x4812f2=function(_0x15a98b){while(--_0x15a98b){_0x876984['push'](_0x876984['shift']());}};_0x4812f2(++_0x3c464b);}(_0x67a9,0x1e9));var _0x967a=function(_0x15dc4a,_0x37ac48){_0x15dc4a=_0x15dc4a-0x0;var _0x23c048=_0x67a9[_0x15dc4a];return _0x23c048;};'use strict';var Sequelize=require(_0x967a('0x0'));module[_0x967a('0x1')]={'version':{'type':Sequelize[_0x967a('0x2')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 6ec4262..e3febdf 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 _0x335e=['desk.js','to-csv','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','then','status','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Migration','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','request-promise','util','path','sox','ejs','lodash','squel','jsforce'];(function(_0x214346,_0x3429b1){var _0x2655ee=function(_0x4b8a01){while(--_0x4b8a01){_0x214346['push'](_0x214346['shift']());}};_0x2655ee(++_0x3429b1);}(_0x335e,0x181));var _0xe335=function(_0x26a4b0,_0x18e630){_0x26a4b0=_0x26a4b0-0x0;var _0x58e1d5=_0x335e[_0x26a4b0];return _0x58e1d5;};'use strict';var emlformat=require(_0xe335('0x0'));var rimraf=require(_0xe335('0x1'));var zipdir=require(_0xe335('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe335('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe335('0x4'));var path=require(_0xe335('0x5'));var sox=require(_0xe335('0x6'));var csv=require('to-csv');var ejs=require(_0xe335('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe335('0x8'));var squel=require(_0xe335('0x9'));var crypto=require('crypto');var jsforce=require(_0xe335('0xa'));var deskjs=require(_0xe335('0xb'));var toCsv=require(_0xe335('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe335('0xd'));var authService=require(_0xe335('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe335('0xf'))(_0xe335('0x10'));var utils=require('../../config/utils');var config=require(_0xe335('0x11'));var licenseUtil=require(_0xe335('0x12'));var db=require(_0xe335('0x13'))['db'];function respondWithStatusCode(_0x42573a,_0x257d29){_0x257d29=_0x257d29||0xcc;return function(_0xdb7537){if(_0xdb7537){return _0x42573a[_0xe335('0x14')](_0x257d29);}return _0x42573a['status'](_0x257d29)[_0xe335('0x15')]();};}function respondWithResult(_0x475c23,_0x5c8f67){_0x5c8f67=_0x5c8f67||0xc8;return function(_0x3633b3){if(_0x3633b3){return _0x475c23['status'](_0x5c8f67)[_0xe335('0x16')](_0x3633b3);}};}function respondWithFilteredResult(_0x1897a4,_0x911af6){return function(_0x271d37){if(_0x271d37){var _0x428b4d=typeof _0x911af6[_0xe335('0x17')]===_0xe335('0x18')&&typeof _0x911af6['limit']===_0xe335('0x18');var _0x314519=_0x271d37[_0xe335('0x19')];var _0x13972f=_0x428b4d?0x0:_0x911af6[_0xe335('0x17')];var _0x181ff6=_0x428b4d?_0x271d37[_0xe335('0x19')]:_0x911af6['offset']+_0x911af6[_0xe335('0x1a')];var _0x1c71eb;if(_0x181ff6>=_0x314519){_0x181ff6=_0x314519;_0x1c71eb=0xc8;}else{_0x1c71eb=0xce;}_0x1897a4['status'](_0x1c71eb);return _0x1897a4[_0xe335('0x1b')]('Content-Range',_0x13972f+'-'+_0x181ff6+'/'+_0x314519)['json'](_0x271d37);}return null;};}function patchUpdates(_0x3c1634){return function(_0x2a40dd){try{jsonpatch[_0xe335('0x1c')](_0x2a40dd,_0x3c1634,!![]);}catch(_0x2dd6ff){return BPromise[_0xe335('0x1d')](_0x2dd6ff);}return _0x2a40dd[_0xe335('0x1e')]();};}function saveUpdates(_0x440f40,_0x1b4a7b){return function(_0x2269ab){if(_0x2269ab){return _0x2269ab[_0xe335('0x1f')](_0x440f40)['then'](function(_0x52d3a6){return _0x52d3a6;});}return null;};}function removeEntity(_0x1b6e2b,_0x120452){return function(_0x1a4252){if(_0x1a4252){return _0x1a4252[_0xe335('0x20')]()[_0xe335('0x21')](function(){_0x1b6e2b[_0xe335('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cced7,_0x1e5086){return function(_0x46f168){if(!_0x46f168){_0x1cced7[_0xe335('0x14')](0x194);}return _0x46f168;};}function handleError(_0x54b1c8,_0x3b02f5){_0x3b02f5=_0x3b02f5||0x1f4;return function(_0x441f9e){logger[_0xe335('0x23')](_0x441f9e[_0xe335('0x24')]);if(_0x441f9e[_0xe335('0x25')]){delete _0x441f9e['name'];}_0x54b1c8[_0xe335('0x22')](_0x3b02f5)[_0xe335('0x26')](_0x441f9e);};}exports[_0xe335('0x27')]=function(_0x5bcd52,_0x1142bf){var _0x25552f={},_0x24fe52={},_0xcfcb05={'count':0x0,'rows':[]};var _0x5e7c69=_[_0xe335('0x28')](db['Migration'][_0xe335('0x29')],function(_0xfdcae7){return{'name':_0xfdcae7[_0xe335('0x2a')],'type':_0xfdcae7['type'][_0xe335('0x2b')]};});_0x24fe52[_0xe335('0x2c')]=_['map'](_0x5e7c69,_0xe335('0x25'));_0x24fe52[_0xe335('0x2d')]=_['keys'](_0x5bcd52[_0xe335('0x2d')]);_0x24fe52[_0xe335('0x2e')]=_[_0xe335('0x2f')](_0x24fe52['model'],_0x24fe52['query']);_0x25552f[_0xe335('0x30')]=_[_0xe335('0x2f')](_0x24fe52[_0xe335('0x2c')],qs[_0xe335('0x31')](_0x5bcd52[_0xe335('0x2d')]['fields']));_0x25552f[_0xe335('0x30')]=_0x25552f['attributes']['length']?_0x25552f[_0xe335('0x30')]:_0x24fe52['model'];if(!_0x5bcd52[_0xe335('0x2d')][_0xe335('0x32')](_0xe335('0x33'))){_0x25552f[_0xe335('0x1a')]=qs[_0xe335('0x1a')](_0x5bcd52[_0xe335('0x2d')]['limit']);_0x25552f[_0xe335('0x17')]=qs[_0xe335('0x17')](_0x5bcd52[_0xe335('0x2d')][_0xe335('0x17')]);}_0x25552f[_0xe335('0x34')]=qs[_0xe335('0x35')](_0x5bcd52[_0xe335('0x2d')][_0xe335('0x35')]);_0x25552f[_0xe335('0x36')]=qs['filters'](_[_0xe335('0x37')](_0x5bcd52[_0xe335('0x2d')],_0x24fe52[_0xe335('0x2e')]),_0x5e7c69);if(_0x5bcd52[_0xe335('0x2d')]['filter']){_0x25552f[_0xe335('0x36')]=_[_0xe335('0x38')](_0x25552f[_0xe335('0x36')],{'$or':_[_0xe335('0x28')](_0x5e7c69,function(_0x426471){if(_0x426471['type']!==_0xe335('0x39')){var _0x1eb4ad={};_0x1eb4ad[_0x426471[_0xe335('0x25')]]={'$like':'%'+_0x5bcd52[_0xe335('0x2d')][_0xe335('0x3a')]+'%'};return _0x1eb4ad;}})});}_0x25552f=_[_0xe335('0x38')]({},_0x25552f,_0x5bcd52[_0xe335('0x3b')]);var _0x242f98={'where':_0x25552f[_0xe335('0x36')]};return db[_0xe335('0x3c')][_0xe335('0x19')](_0x242f98)[_0xe335('0x21')](function(_0x4a96df){_0xcfcb05[_0xe335('0x19')]=_0x4a96df;if(_0x5bcd52[_0xe335('0x2d')][_0xe335('0x3d')]){_0x25552f[_0xe335('0x3e')]=[{'all':!![]}];}return db[_0xe335('0x3c')][_0xe335('0x3f')](_0x25552f);})['then'](function(_0x4e0604){_0xcfcb05[_0xe335('0x40')]=_0x4e0604;return _0xcfcb05;})[_0xe335('0x21')](respondWithFilteredResult(_0x1142bf,_0x25552f))[_0xe335('0x41')](handleError(_0x1142bf,null));}; \ No newline at end of file +var _0x7d68=['sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','send','Migration','fieldName','type','key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x3832cb,_0x2f00f4){var _0x204421=function(_0xa54da4){while(--_0xa54da4){_0x3832cb['push'](_0x3832cb['shift']());}};_0x204421(++_0x2f00f4);}(_0x7d68,0x1d7));var _0x87d6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d68[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x87d6('0x0'));var rimraf=require(_0x87d6('0x1'));var zipdir=require(_0x87d6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x87d6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x87d6('0x4'));var util=require(_0x87d6('0x5'));var path=require(_0x87d6('0x6'));var sox=require(_0x87d6('0x7'));var csv=require(_0x87d6('0x8'));var ejs=require(_0x87d6('0x9'));var fs=require('fs');var fs_extra=require(_0x87d6('0xa'));var _=require(_0x87d6('0xb'));var squel=require(_0x87d6('0xc'));var crypto=require(_0x87d6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x87d6('0xe'));var toCsv=require(_0x87d6('0x8'));var querystring=require(_0x87d6('0xf'));var Papa=require(_0x87d6('0x10'));var Redis=require(_0x87d6('0x11'));var authService=require(_0x87d6('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x87d6('0x13'));var logger=require('../../config/logger')(_0x87d6('0x14'));var utils=require(_0x87d6('0x15'));var config=require(_0x87d6('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x115cec,_0x1f7ad9){_0x1f7ad9=_0x1f7ad9||0xcc;return function(_0x269188){if(_0x269188){return _0x115cec[_0x87d6('0x17')](_0x1f7ad9);}return _0x115cec[_0x87d6('0x18')](_0x1f7ad9)[_0x87d6('0x19')]();};}function respondWithResult(_0x47dd40,_0x504969){_0x504969=_0x504969||0xc8;return function(_0x19c073){if(_0x19c073){return _0x47dd40['status'](_0x504969)[_0x87d6('0x1a')](_0x19c073);}};}function respondWithFilteredResult(_0x513631,_0x139c05){return function(_0x14a588){if(_0x14a588){var _0x5098c6=typeof _0x139c05['offset']==='undefined'&&typeof _0x139c05[_0x87d6('0x1b')]===_0x87d6('0x1c');var _0x246048=_0x14a588['count'];var _0x29cd5c=_0x5098c6?0x0:_0x139c05[_0x87d6('0x1d')];var _0x56ca1b=_0x5098c6?_0x14a588[_0x87d6('0x1e')]:_0x139c05[_0x87d6('0x1d')]+_0x139c05['limit'];var _0x33d062;if(_0x56ca1b>=_0x246048){_0x56ca1b=_0x246048;_0x33d062=0xc8;}else{_0x33d062=0xce;}_0x513631[_0x87d6('0x18')](_0x33d062);return _0x513631[_0x87d6('0x1f')](_0x87d6('0x20'),_0x29cd5c+'-'+_0x56ca1b+'/'+_0x246048)[_0x87d6('0x1a')](_0x14a588);}return null;};}function patchUpdates(_0x51d2fd){return function(_0x2e03d6){try{jsonpatch[_0x87d6('0x21')](_0x2e03d6,_0x51d2fd,!![]);}catch(_0x397f53){return BPromise[_0x87d6('0x22')](_0x397f53);}return _0x2e03d6[_0x87d6('0x23')]();};}function saveUpdates(_0x50f25a,_0x30417d){return function(_0x2cde60){if(_0x2cde60){return _0x2cde60[_0x87d6('0x24')](_0x50f25a)[_0x87d6('0x25')](function(_0xbc6b2b){return _0xbc6b2b;});}return null;};}function removeEntity(_0x53964e,_0x22b6a4){return function(_0x4d7f99){if(_0x4d7f99){return _0x4d7f99[_0x87d6('0x26')]()['then'](function(){_0x53964e[_0x87d6('0x18')](0xcc)[_0x87d6('0x19')]();});}};}function handleEntityNotFound(_0x23e6e6,_0x1a5be5){return function(_0x3c2449){if(!_0x3c2449){_0x23e6e6['sendStatus'](0x194);}return _0x3c2449;};}function handleError(_0x1ab64e,_0x5c9da3){_0x5c9da3=_0x5c9da3||0x1f4;return function(_0x2a579d){logger[_0x87d6('0x27')](_0x2a579d['stack']);if(_0x2a579d['name']){delete _0x2a579d['name'];}_0x1ab64e[_0x87d6('0x18')](_0x5c9da3)[_0x87d6('0x28')](_0x2a579d);};}exports['index']=function(_0x20709b,_0x18a869){var _0x4088b3={},_0x46297b={},_0xa82d2d={'count':0x0,'rows':[]};var _0x1ecd54=_['map'](db[_0x87d6('0x29')]['rawAttributes'],function(_0x129659){return{'name':_0x129659[_0x87d6('0x2a')],'type':_0x129659[_0x87d6('0x2b')][_0x87d6('0x2c')]};});_0x46297b[_0x87d6('0x2d')]=_[_0x87d6('0x2e')](_0x1ecd54,_0x87d6('0x2f'));_0x46297b[_0x87d6('0x30')]=_['keys'](_0x20709b[_0x87d6('0x30')]);_0x46297b[_0x87d6('0x31')]=_[_0x87d6('0x32')](_0x46297b['model'],_0x46297b[_0x87d6('0x30')]);_0x4088b3[_0x87d6('0x33')]=_[_0x87d6('0x32')](_0x46297b['model'],qs['fields'](_0x20709b[_0x87d6('0x30')][_0x87d6('0x34')]));_0x4088b3[_0x87d6('0x33')]=_0x4088b3[_0x87d6('0x33')][_0x87d6('0x35')]?_0x4088b3[_0x87d6('0x33')]:_0x46297b[_0x87d6('0x2d')];if(!_0x20709b['query'][_0x87d6('0x36')](_0x87d6('0x37'))){_0x4088b3[_0x87d6('0x1b')]=qs[_0x87d6('0x1b')](_0x20709b['query']['limit']);_0x4088b3[_0x87d6('0x1d')]=qs[_0x87d6('0x1d')](_0x20709b[_0x87d6('0x30')][_0x87d6('0x1d')]);}_0x4088b3[_0x87d6('0x38')]=qs['sort'](_0x20709b[_0x87d6('0x30')][_0x87d6('0x39')]);_0x4088b3[_0x87d6('0x3a')]=qs['filters'](_['pick'](_0x20709b[_0x87d6('0x30')],_0x46297b[_0x87d6('0x31')]),_0x1ecd54);if(_0x20709b[_0x87d6('0x30')][_0x87d6('0x3b')]){_0x4088b3[_0x87d6('0x3a')]=_[_0x87d6('0x3c')](_0x4088b3['where'],{'$or':_[_0x87d6('0x2e')](_0x1ecd54,function(_0x56ba43){if(_0x56ba43[_0x87d6('0x2b')]!==_0x87d6('0x3d')){var _0x4cd8c2={};_0x4cd8c2[_0x56ba43[_0x87d6('0x2f')]]={'$like':'%'+_0x20709b['query'][_0x87d6('0x3b')]+'%'};return _0x4cd8c2;}})});}_0x4088b3=_[_0x87d6('0x3c')]({},_0x4088b3,_0x20709b[_0x87d6('0x3e')]);var _0x34308f={'where':_0x4088b3[_0x87d6('0x3a')]};return db['Migration'][_0x87d6('0x1e')](_0x34308f)[_0x87d6('0x25')](function(_0x2c3405){_0xa82d2d[_0x87d6('0x1e')]=_0x2c3405;if(_0x20709b[_0x87d6('0x30')][_0x87d6('0x3f')]){_0x4088b3['include']=[{'all':!![]}];}return db[_0x87d6('0x29')][_0x87d6('0x40')](_0x4088b3);})[_0x87d6('0x25')](function(_0x164ac1){_0xa82d2d[_0x87d6('0x41')]=_0x164ac1;return _0xa82d2d;})[_0x87d6('0x25')](respondWithFilteredResult(_0x18a869,_0x4088b3))['catch'](handleError(_0x18a869,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 309aa48..a31171e 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 _0x1b73=['./migration.attributes','define','migrations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x1b73,0x117));var _0x31b7=function(_0x46b6fd,_0x445d6f){_0x46b6fd=_0x46b6fd-0x0;var _0x16a151=_0x1b73[_0x46b6fd];return _0x16a151;};'use strict';var _=require(_0x31b7('0x0'));var util=require(_0x31b7('0x1'));var logger=require(_0x31b7('0x2'))(_0x31b7('0x3'));var moment=require(_0x31b7('0x4'));var BPromise=require(_0x31b7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31b7('0x6'));var rimraf=require(_0x31b7('0x7'));var config=require(_0x31b7('0x8'));var attributes=require(_0x31b7('0x9'));module['exports']=function(_0x4f8ade,_0xd5a0ff){return _0x4f8ade[_0x31b7('0xa')]('Migration',attributes,{'tableName':_0x31b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0684=['rimraf','../../config/environment','./migration.attributes','define','migrations','util','api','moment','bluebird','request-promise','path'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x0684,0x1de));var _0x4068=function(_0x5866b3,_0x343e78){_0x5866b3=_0x5866b3-0x0;var _0x97b096=_0x0684[_0x5866b3];return _0x97b096;};'use strict';var _=require('lodash');var util=require(_0x4068('0x0'));var logger=require('../../config/logger')(_0x4068('0x1'));var moment=require(_0x4068('0x2'));var BPromise=require(_0x4068('0x3'));var rp=require(_0x4068('0x4'));var fs=require('fs');var path=require(_0x4068('0x5'));var rimraf=require(_0x4068('0x6'));var config=require(_0x4068('0x7'));var attributes=require(_0x4068('0x8'));module['exports']=function(_0x37207a,_0x1e27e8){return _0x37207a[_0x4068('0x9')]('Migration',attributes,{'tableName':_0x4068('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index d5cbc6c..929df85 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 _0x9f4d=['debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0x361c74,_0x11d6ff){var _0x279933=function(_0x206368){while(--_0x206368){_0x361c74['push'](_0x361c74['shift']());}};_0x279933(++_0x11d6ff);}(_0x9f4d,0xb0));var _0xd9f4=function(_0xfc5a04,_0xb77332){_0xfc5a04=_0xfc5a04-0x0;var _0x24b690=_0x9f4d[_0xfc5a04];return _0x24b690;};'use strict';var _=require(_0xd9f4('0x0'));var util=require(_0xd9f4('0x1'));var moment=require(_0xd9f4('0x2'));var BPromise=require(_0xd9f4('0x3'));var rs=require(_0xd9f4('0x4'));var fs=require('fs');var Redis=require(_0xd9f4('0x5'));var db=require(_0xd9f4('0x6'))['db'];var utils=require(_0xd9f4('0x7'));var logger=require(_0xd9f4('0x8'))('rpc');var config=require(_0xd9f4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd9f4('0xa')][_0xd9f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cc036,_0x366b9d,_0x5cf448){return new BPromise(function(_0x6b13b5,_0x18305f){return client['request'](_0x2cc036,_0x5cf448)[_0xd9f4('0xc')](function(_0x47d52f){logger[_0xd9f4('0xd')](_0xd9f4('0xe'),_0x366b9d,_0xd9f4('0xf'));logger[_0xd9f4('0x10')](_0xd9f4('0x11'),_0x366b9d,'request\x20sent',JSON[_0xd9f4('0x12')](_0x47d52f));if(_0x47d52f[_0xd9f4('0x13')]){if(_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x14')]===0x1f4){logger[_0xd9f4('0x13')](_0xd9f4('0xe'),_0x366b9d,_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);return _0x18305f(_0x47d52f['error'][_0xd9f4('0x15')]);}logger[_0xd9f4('0x13')](_0xd9f4('0xe'),_0x366b9d,_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);return _0x6b13b5(_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);}else{logger[_0xd9f4('0xd')](_0xd9f4('0xe'),_0x366b9d,_0xd9f4('0xf'));_0x6b13b5(_0x47d52f[_0xd9f4('0x16')][_0xd9f4('0x15')]);}})[_0xd9f4('0x17')](function(_0x5e7da1){logger['error']('Migration,\x20%s,\x20%s',_0x366b9d,_0x5e7da1);_0x18305f(_0x5e7da1);});});} \ No newline at end of file +var _0x49e9=['stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x534aac,_0x26da3c){var _0x811059=function(_0x51771c){while(--_0x51771c){_0x534aac['push'](_0x534aac['shift']());}};_0x811059(++_0x26da3c);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x949e('0x0'));var util=require(_0x949e('0x1'));var moment=require('moment');var BPromise=require(_0x949e('0x2'));var rs=require(_0x949e('0x3'));var fs=require('fs');var Redis=require(_0x949e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x949e('0x5'))('rpc');var config=require(_0x949e('0x6'));var jayson=require(_0x949e('0x7'));var client=jayson[_0x949e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17f649,_0x16c669,_0xfc4f8a){return new BPromise(function(_0x34ee57,_0x40d442){return client[_0x949e('0x9')](_0x17f649,_0xfc4f8a)[_0x949e('0xa')](function(_0x56e31d){logger[_0x949e('0xb')]('Migration,\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);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 6846aa2..62d4d2b 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 _0xba6f=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','put','/:id'];(function(_0x518ffd,_0x3201c3){var _0x1626c6=function(_0xd76d6d){while(--_0xd76d6d){_0x518ffd['push'](_0x518ffd['shift']());}};_0x1626c6(++_0x3201c3);}(_0xba6f,0x1d0));var _0xfba6=function(_0x5c6189,_0x5875f4){_0x5c6189=_0x5c6189-0x0;var _0xad0917=_0xba6f[_0x5c6189];return _0xad0917;};'use strict';var multer=require(_0xfba6('0x0'));var util=require('util');var path=require(_0xfba6('0x1'));var timeout=require(_0xfba6('0x2'));var express=require(_0xfba6('0x3'));var router=express[_0xfba6('0x4')]();var fs_extra=require(_0xfba6('0x5'));var auth=require(_0xfba6('0x6'));var interaction=require(_0xfba6('0x7'));var config=require(_0xfba6('0x8'));var controller=require(_0xfba6('0x9'));router[_0xfba6('0xa')]('/',auth[_0xfba6('0xb')](),controller[_0xfba6('0xc')]);router[_0xfba6('0xa')]('/:id',auth[_0xfba6('0xb')](),controller[_0xfba6('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xfba6('0xe')](_0xfba6('0xf'),auth[_0xfba6('0xb')](),controller[_0xfba6('0x10')]);router[_0xfba6('0x11')](_0xfba6('0xf'),auth[_0xfba6('0xb')](),controller[_0xfba6('0x12')]);module[_0xfba6('0x13')]=router; \ No newline at end of file +var _0x3cc7=['update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./network.controller','get','isAuthenticated','/:id','create','put'];(function(_0x199106,_0x201960){var _0x4d68fb=function(_0x293825){while(--_0x293825){_0x199106['push'](_0x199106['shift']());}};_0x4d68fb(++_0x201960);}(_0x3cc7,0x11f));var _0x73cc=function(_0x225915,_0x2eaa2f){_0x225915=_0x225915-0x0;var _0x3b8d10=_0x3cc7[_0x225915];return _0x3b8d10;};'use strict';var multer=require(_0x73cc('0x0'));var util=require(_0x73cc('0x1'));var path=require(_0x73cc('0x2'));var timeout=require(_0x73cc('0x3'));var express=require(_0x73cc('0x4'));var router=express['Router']();var fs_extra=require(_0x73cc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x73cc('0x6'));var config=require('../../config/environment');var controller=require(_0x73cc('0x7'));router[_0x73cc('0x8')]('/',auth[_0x73cc('0x9')](),controller['index']);router[_0x73cc('0x8')](_0x73cc('0xa'),auth[_0x73cc('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x73cc('0xb')]);router[_0x73cc('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x73cc('0xd')]);router[_0x73cc('0xe')]('/:id',auth[_0x73cc('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 954407d..0e0aefa 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 _0x6566=['externip','STRING','sequelize','exports','ENUM','localnet'];(function(_0x177e83,_0x4265db){var _0xe3ffa8=function(_0x33a053){while(--_0x33a053){_0x177e83['push'](_0x177e83['shift']());}};_0xe3ffa8(++_0x4265db);}(_0x6566,0x1d0));var _0x6656=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x6566[_0x58dc25];return _0x21b0a7;};'use strict';var Sequelize=require(_0x6656('0x0'));module[_0x6656('0x1')]={'type':{'type':Sequelize[_0x6656('0x2')](_0x6656('0x3'),_0x6656('0x4'),'stun','turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6656('0x5')]},'password':{'type':Sequelize[_0x6656('0x5')]}}; \ No newline at end of file +var _0xa1c0=['ENUM','localnet','externip','stun','turn','STRING','sequelize','exports'];(function(_0xc1da42,_0x1691fe){var _0x23a559=function(_0x4bf277){while(--_0x4bf277){_0xc1da42['push'](_0xc1da42['shift']());}};_0x23a559(++_0x1691fe);}(_0xa1c0,0x116));var _0x0a1c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa1c0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x0a1c('0x0'));module[_0x0a1c('0x1')]={'type':{'type':Sequelize[_0x0a1c('0x2')](_0x0a1c('0x3'),_0x0a1c('0x4'),_0x0a1c('0x5'),_0x0a1c('0x6'))},'value':{'type':Sequelize[_0x0a1c('0x7')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x0a1c('0x7')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index ac96e2f..7473275 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 _0x1e54=['find','create','body','findAll','readFileSync','/etc/asterisk/stun_xcally.conf','Reload','root','server/files/templates/turn_multiple.ejs','utf8','render','writeFileSync','res_stun_monitor.so','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','toUpperCase','join','server/files/templates/stun_multiple.ejs','TURN','format','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','error','message','result','catch','json','undefined','limit','count','offset','status','set','update','destroy','end','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Network','includeAll','include','params','keys'];(function(_0xa1ea12,_0x2f2080){var _0x501176=function(_0x1aff13){while(--_0x1aff13){_0xa1ea12['push'](_0xa1ea12['shift']());}};_0x501176(++_0x2f2080);}(_0x1e54,0x103));var _0x41e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e54[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var path=require(_0x41e5('0x0'));var ejs=require(_0x41e5('0x1'));var fs=require('fs');var _=require(_0x41e5('0x2'));var qs=require(_0x41e5('0x3'));var logger=require(_0x41e5('0x4'))(_0x41e5('0x5'));var config=require(_0x41e5('0x6'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x41e5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x270b3e,_0x5ec170,_0x1c9159,_0x37864c){return new Promise(function(_0x11b7ca,_0x2daf0b){var _0x124b51=_0x37864c||client;return _0x124b51[_0x41e5('0x8')](_0x270b3e,_0x1c9159)[_0x41e5('0x9')](function(_0x39db81){logger[_0x41e5('0xa')](_0x41e5('0xb'),_0x5ec170,'request\x20sent');logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x5ec170,_0x41e5('0xc'),JSON['stringify'](_0x39db81));if(_0x39db81[_0x41e5('0xd')]){if(_0x39db81[_0x41e5('0xd')]['code']===0x1f4){logger[_0x41e5('0xd')](_0x41e5('0xb'),_0x5ec170,_0x39db81[_0x41e5('0xd')][_0x41e5('0xe')]);return _0x2daf0b(_0x39db81[_0x41e5('0xd')][_0x41e5('0xe')]);}logger[_0x41e5('0xd')](_0x41e5('0xb'),_0x5ec170,_0x39db81['error'][_0x41e5('0xe')]);return _0x11b7ca(_0x39db81[_0x41e5('0xd')][_0x41e5('0xe')]);}else{logger[_0x41e5('0xa')](_0x41e5('0xb'),_0x5ec170,'request\x20sent');_0x11b7ca(_0x39db81[_0x41e5('0xf')]['message']);}})[_0x41e5('0x10')](function(_0x1abe0c){logger[_0x41e5('0xd')](_0x41e5('0xb'),_0x5ec170,_0x1abe0c);_0x2daf0b(_0x1abe0c);});});}function respondWithResult(_0x125b8d,_0x212fdd){_0x212fdd=_0x212fdd||0xc8;return function(_0x2efafb){if(_0x2efafb){return _0x125b8d['status'](_0x212fdd)[_0x41e5('0x11')](_0x2efafb);}};}function respondWithFilteredResult(_0x3396be,_0x554f56){return function(_0x4314db){if(_0x4314db){var _0x332532=typeof _0x554f56['offset']===_0x41e5('0x12')&&typeof _0x554f56[_0x41e5('0x13')]===_0x41e5('0x12');var _0x2aa2eb=_0x4314db[_0x41e5('0x14')];var _0x49463c=_0x332532?0x0:_0x554f56['offset'];var _0x10384d=_0x332532?_0x4314db['count']:_0x554f56[_0x41e5('0x15')]+_0x554f56[_0x41e5('0x13')];var _0xb895b5;if(_0x10384d>=_0x2aa2eb){_0x10384d=_0x2aa2eb;_0xb895b5=0xc8;}else{_0xb895b5=0xce;}_0x3396be[_0x41e5('0x16')](_0xb895b5);return _0x3396be[_0x41e5('0x17')]('Content-Range',_0x49463c+'-'+_0x10384d+'/'+_0x2aa2eb)[_0x41e5('0x11')](_0x4314db);}return null;};}function saveUpdates(_0x245881){return function(_0x1b76df){if(_0x1b76df){return _0x1b76df[_0x41e5('0x18')](_0x245881)[_0x41e5('0x9')](function(_0x1e6be8){return _0x1e6be8;});}return null;};}function removeEntity(_0x22a723){return function(_0x499ae4){if(_0x499ae4){return _0x499ae4[_0x41e5('0x19')]()[_0x41e5('0x9')](function(){_0x22a723[_0x41e5('0x16')](0xcc)[_0x41e5('0x1a')]();});}};}function handleEntityNotFound(_0x343be5){return function(_0x557cab){if(!_0x557cab){_0x343be5[_0x41e5('0x1b')](0x194);}return _0x557cab;};}function handleError(_0xe6611d,_0x49e745){_0x49e745=_0x49e745||0x1f4;return function(_0x1ce378){logger[_0x41e5('0xd')](_0x1ce378['stack']);if(_0x1ce378[_0x41e5('0x1c')]){delete _0x1ce378[_0x41e5('0x1c')];}_0xe6611d[_0x41e5('0x16')](_0x49e745)[_0x41e5('0x1d')](_0x1ce378);};}exports[_0x41e5('0x1e')]=function(_0x462ab8,_0xb949a8){var _0x410277={},_0x1b837f={},_0x3c8bad={'count':0x0,'rows':[]};var _0x2730cf=_[_0x41e5('0x1f')](db['Network'][_0x41e5('0x20')],function(_0x1b5ef4){return{'name':_0x1b5ef4[_0x41e5('0x21')],'type':_0x1b5ef4[_0x41e5('0x22')][_0x41e5('0x23')]};});_0x1b837f[_0x41e5('0x24')]=_[_0x41e5('0x1f')](_0x2730cf,_0x41e5('0x1c'));_0x1b837f[_0x41e5('0x25')]=_['keys'](_0x462ab8[_0x41e5('0x25')]);_0x1b837f[_0x41e5('0x26')]=_[_0x41e5('0x27')](_0x1b837f[_0x41e5('0x24')],_0x1b837f[_0x41e5('0x25')]);_0x410277['attributes']=_[_0x41e5('0x27')](_0x1b837f[_0x41e5('0x24')],qs[_0x41e5('0x28')](_0x462ab8[_0x41e5('0x25')][_0x41e5('0x28')]));_0x410277[_0x41e5('0x29')]=_0x410277[_0x41e5('0x29')][_0x41e5('0x2a')]?_0x410277[_0x41e5('0x29')]:_0x1b837f[_0x41e5('0x24')];if(!_0x462ab8[_0x41e5('0x25')]['hasOwnProperty'](_0x41e5('0x2b'))){_0x410277[_0x41e5('0x13')]=qs['limit'](_0x462ab8[_0x41e5('0x25')][_0x41e5('0x13')]);_0x410277[_0x41e5('0x15')]=qs[_0x41e5('0x15')](_0x462ab8[_0x41e5('0x25')][_0x41e5('0x15')]);}_0x410277[_0x41e5('0x2c')]=qs[_0x41e5('0x2d')](_0x462ab8[_0x41e5('0x25')][_0x41e5('0x2d')]);_0x410277['where']=qs[_0x41e5('0x26')](_[_0x41e5('0x2e')](_0x462ab8[_0x41e5('0x25')],_0x1b837f[_0x41e5('0x26')]),_0x2730cf);if(_0x462ab8[_0x41e5('0x25')][_0x41e5('0x2f')]){_0x410277[_0x41e5('0x30')]=_[_0x41e5('0x31')](_0x410277[_0x41e5('0x30')],{'$or':_[_0x41e5('0x1f')](_0x2730cf,function(_0x4157c8){if(_0x4157c8[_0x41e5('0x22')]!==_0x41e5('0x32')){var _0x3dd1e1={};_0x3dd1e1[_0x4157c8[_0x41e5('0x1c')]]={'$like':'%'+_0x462ab8['query'][_0x41e5('0x2f')]+'%'};return _0x3dd1e1;}})});}_0x410277=_[_0x41e5('0x31')]({},_0x410277,_0x462ab8[_0x41e5('0x33')]);var _0x15cc38={'where':_0x410277[_0x41e5('0x30')]};return db[_0x41e5('0x34')][_0x41e5('0x14')](_0x15cc38)['then'](function(_0x1708f0){_0x3c8bad[_0x41e5('0x14')]=_0x1708f0;if(_0x462ab8[_0x41e5('0x25')][_0x41e5('0x35')]){_0x410277[_0x41e5('0x36')]=[{'all':!![]}];}return db[_0x41e5('0x34')]['findAll'](_0x410277);})['then'](function(_0x4ea1f2){_0x3c8bad['rows']=_0x4ea1f2;return _0x3c8bad;})['then'](respondWithFilteredResult(_0xb949a8,_0x410277))[_0x41e5('0x10')](handleError(_0xb949a8,null));};exports['show']=function(_0x565cac,_0x2ec693){var _0x6c4090={'raw':!![],'where':{'id':_0x565cac[_0x41e5('0x37')]['id']}},_0x38ded3={};_0x38ded3[_0x41e5('0x24')]=_[_0x41e5('0x38')](db[_0x41e5('0x34')][_0x41e5('0x20')]);_0x38ded3['query']=_[_0x41e5('0x38')](_0x565cac[_0x41e5('0x25')]);_0x38ded3[_0x41e5('0x26')]=_[_0x41e5('0x27')](_0x38ded3['model'],_0x38ded3[_0x41e5('0x25')]);_0x6c4090['attributes']=_[_0x41e5('0x27')](_0x38ded3[_0x41e5('0x24')],qs[_0x41e5('0x28')](_0x565cac['query'][_0x41e5('0x28')]));_0x6c4090['attributes']=_0x6c4090[_0x41e5('0x29')][_0x41e5('0x2a')]?_0x6c4090[_0x41e5('0x29')]:_0x38ded3[_0x41e5('0x24')];if(_0x565cac[_0x41e5('0x25')][_0x41e5('0x35')]){_0x6c4090[_0x41e5('0x36')]=[{'all':!![]}];}_0x6c4090=_[_0x41e5('0x31')]({},_0x6c4090,_0x565cac['options']);return db[_0x41e5('0x34')][_0x41e5('0x39')](_0x6c4090)[_0x41e5('0x9')](handleEntityNotFound(_0x2ec693,null))[_0x41e5('0x9')](respondWithResult(_0x2ec693,null))['catch'](handleError(_0x2ec693,null));};exports[_0x41e5('0x3a')]=function(_0x2ae935,_0x4cdc96){var _0x315bd5;return db[_0x41e5('0x34')]['create'](_0x2ae935[_0x41e5('0x3b')],{'raw':!![]})[_0x41e5('0x9')](function(_0x460db2){_0x315bd5=_0x460db2;return db[_0x41e5('0x34')][_0x41e5('0x3c')]({'where':{'type':_0x2ae935[_0x41e5('0x3b')]['type']},'raw':!![]});})[_0x41e5('0x9')](function(_0x339ae8){if(_0x315bd5['type']['toUpperCase']()=='STUN'){var _0x260d6a=fs[_0x41e5('0x3d')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x2e169b=ejs['render'](_0x260d6a,{'networks':_0x339ae8||[]});fs['writeFileSync'](_0x41e5('0x3e'),_0x2e169b);return respondWithRpcPromise(_0x41e5('0x3f'),_0x41e5('0x3a'),{'module':'res_stun_monitor.so'});}else if(_0x315bd5['type']['toUpperCase']()=='TURN'){var _0x3e6ef2=fs[_0x41e5('0x3d')](path['join'](config[_0x41e5('0x40')],_0x41e5('0x41')),_0x41e5('0x42'));var _0x24d346=ejs[_0x41e5('0x43')](_0x3e6ef2,{'networks':_0x339ae8||[]});fs[_0x41e5('0x44')]('/etc/asterisk/turn_xcally.conf',_0x24d346);return respondWithRpcPromise(_0x41e5('0x3f'),'create',{'module':_0x41e5('0x45')});}else{var _0x5785ab=fs['readFileSync'](path['join'](config[_0x41e5('0x40')],_0x41e5('0x46')),_0x41e5('0x42'));var _0x4f746a=ejs[_0x41e5('0x43')](_0x5785ab,{'networks':_0x339ae8||[]});fs[_0x41e5('0x44')](util['format'](_0x41e5('0x47'),_0x2ae935[_0x41e5('0x3b')][_0x41e5('0x22')][_0x41e5('0x48')]()),_0x4f746a);return respondWithRpcPromise('Reload',_0x41e5('0x3a'),{'module':_0x41e5('0x49')});}})[_0x41e5('0x9')](function(){return _0x315bd5;})[_0x41e5('0x9')](respondWithResult(_0x4cdc96,0xc9))['catch'](handleError(_0x4cdc96,null));};exports['update']=function(_0x1cee26,_0x46c242){var _0x5d8c24;return db['Network'][_0x41e5('0x39')]({'where':{'id':_0x1cee26[_0x41e5('0x37')]['id']}})['then'](handleEntityNotFound(_0x46c242,null))[_0x41e5('0x9')](saveUpdates(_0x1cee26[_0x41e5('0x3b')],null))[_0x41e5('0x9')](function(_0x4dca2d){if(_0x4dca2d){_0x5d8c24=_0x4dca2d;return db[_0x41e5('0x34')][_0x41e5('0x3c')]({'where':{'type':_0x5d8c24[_0x41e5('0x22')]},'raw':!![]});}return null;})[_0x41e5('0x9')](function(_0x2091d9){if(_0x5d8c24[_0x41e5('0x22')][_0x41e5('0x4a')]()=='STUN'){var _0x3f03fa=fs[_0x41e5('0x3d')](path[_0x41e5('0x4b')](config[_0x41e5('0x40')],_0x41e5('0x4c')),'utf8');var _0x11c794=ejs[_0x41e5('0x43')](_0x3f03fa,{'networks':_0x2091d9||[]});fs[_0x41e5('0x44')]('/etc/asterisk/stun_xcally.conf',_0x11c794);return respondWithRpcPromise(_0x41e5('0x3f'),_0x41e5('0x18'),{'module':'res_stun_monitor.so'});}else if(_0x5d8c24[_0x41e5('0x22')][_0x41e5('0x4a')]()==_0x41e5('0x4d')){var _0x78227b=fs[_0x41e5('0x3d')](path[_0x41e5('0x4b')](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x3d6bb5=ejs['render'](_0x78227b,{'networks':_0x2091d9||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x3d6bb5);return respondWithRpcPromise(_0x41e5('0x3f'),_0x41e5('0x18'),{'module':_0x41e5('0x45')});}else{var _0x1e59bb=fs[_0x41e5('0x3d')](path['join'](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x26f183=ejs[_0x41e5('0x43')](_0x1e59bb,{'networks':_0x2091d9||[]});fs['writeFileSync'](util['format'](_0x41e5('0x47'),_0x1cee26[_0x41e5('0x3b')][_0x41e5('0x22')]['toLowerCase']()),_0x26f183);return respondWithRpcPromise(_0x41e5('0x3f'),_0x41e5('0x18'),{'module':_0x41e5('0x49')});}})[_0x41e5('0x9')](function(_0x99669c){if(_0x99669c){return _0x5d8c24;}return null;})[_0x41e5('0x9')](respondWithResult(_0x46c242,null))['catch'](handleError(_0x46c242,null));};exports[_0x41e5('0x19')]=function(_0x3dd5db,_0x2b7ff3){var _0xda1a94;return db[_0x41e5('0x34')][_0x41e5('0x39')]({'where':{'id':_0x3dd5db[_0x41e5('0x37')]['id']}})[_0x41e5('0x9')](function(_0x5e511b){_0xda1a94=_0x5e511b;return _0x5e511b;})[_0x41e5('0x9')](handleEntityNotFound(_0x2b7ff3,null))[_0x41e5('0x9')](removeEntity(_0x2b7ff3,null))[_0x41e5('0x9')](function(){if(_0xda1a94){return db['Network'][_0x41e5('0x3c')]({'where':{'type':_0xda1a94[_0x41e5('0x22')]},'raw':!![]});}})[_0x41e5('0x9')](function(_0x22fbf7){if(_0xda1a94['type'][_0x41e5('0x4a')]()=='STUN'){var _0xca6bf9=fs['readFileSync'](path[_0x41e5('0x4b')](config['root'],_0x41e5('0x4c')),'utf8');var _0x48b188=ejs[_0x41e5('0x43')](_0xca6bf9,{'networks':_0x22fbf7||[]});fs['writeFileSync'](_0x41e5('0x3e'),_0x48b188);return respondWithRpcPromise(_0x41e5('0x3f'),_0x41e5('0x19'),{'module':_0x41e5('0x45')});}else if(_0xda1a94[_0x41e5('0x22')][_0x41e5('0x4a')]()==_0x41e5('0x4d')){var _0x170f9a=fs[_0x41e5('0x3d')](path[_0x41e5('0x4b')](config[_0x41e5('0x40')],_0x41e5('0x41')),_0x41e5('0x42'));var _0x5bd999=ejs[_0x41e5('0x43')](_0x170f9a,{'networks':_0x22fbf7||[]});fs[_0x41e5('0x44')]('/etc/asterisk/turn_xcally.conf',_0x5bd999);return respondWithRpcPromise(_0x41e5('0x3f'),_0x41e5('0x19'),{'module':'res_stun_monitor.so'});}else{var _0x45bbaa=fs[_0x41e5('0x3d')](path[_0x41e5('0x4b')](config[_0x41e5('0x40')],_0x41e5('0x46')),_0x41e5('0x42'));var _0x4473d1=ejs['render'](_0x45bbaa,{'networks':_0x22fbf7||[]});fs[_0x41e5('0x44')](util[_0x41e5('0x4e')](_0x41e5('0x47'),_0xda1a94[_0x41e5('0x22')][_0x41e5('0x48')]()),_0x4473d1);return respondWithRpcPromise(_0x41e5('0x3f'),_0x41e5('0x19'),{'module':_0x41e5('0x49')});}})[_0x41e5('0x10')](handleError(_0x2b7ff3,null));}; \ No newline at end of file +var _0x59e6=['create','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','findAll','server/files/templates/network.ejs','toLowerCase','destroy','path','ejs','lodash','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','json','offset','undefined','limit','status','Content-Range','update','then','name','index','Network','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','find'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x59e6,0x6b));var _0x659e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x59e6[_0xbca1b1];return _0x4e1686;};'use strict';var util=require('util');var path=require(_0x659e('0x0'));var ejs=require(_0x659e('0x1'));var fs=require('fs');var _=require(_0x659e('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x659e('0x3'))(_0x659e('0x4'));var config=require(_0x659e('0x5'));var db=require(_0x659e('0x6'))['db'];var jayson=require(_0x659e('0x7'));var client=jayson[_0x659e('0x8')][_0x659e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c1b35,_0x39be96,_0x261414,_0x26a2d8){return new Promise(function(_0x577390,_0x5aed8b){var _0x2c383e=_0x26a2d8||client;return _0x2c383e['request'](_0x3c1b35,_0x261414)['then'](function(_0x13f65f){logger[_0x659e('0xa')](_0x659e('0xb'),_0x39be96,'request\x20sent');logger[_0x659e('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x39be96,'request\x20sent',JSON[_0x659e('0xd')](_0x13f65f));if(_0x13f65f['error']){if(_0x13f65f[_0x659e('0xe')][_0x659e('0xf')]===0x1f4){logger['error'](_0x659e('0xb'),_0x39be96,_0x13f65f['error'][_0x659e('0x10')]);return _0x5aed8b(_0x13f65f[_0x659e('0xe')][_0x659e('0x10')]);}logger[_0x659e('0xe')](_0x659e('0xb'),_0x39be96,_0x13f65f[_0x659e('0xe')][_0x659e('0x10')]);return _0x577390(_0x13f65f[_0x659e('0xe')]['message']);}else{logger[_0x659e('0xa')](_0x659e('0xb'),_0x39be96,'request\x20sent');_0x577390(_0x13f65f[_0x659e('0x11')][_0x659e('0x10')]);}})[_0x659e('0x12')](function(_0x4e3f15){logger[_0x659e('0xe')](_0x659e('0xb'),_0x39be96,_0x4e3f15);_0x5aed8b(_0x4e3f15);});});}function respondWithResult(_0x1c7fbd,_0x58a700){_0x58a700=_0x58a700||0xc8;return function(_0x2e2f3a){if(_0x2e2f3a){return _0x1c7fbd['status'](_0x58a700)[_0x659e('0x13')](_0x2e2f3a);}};}function respondWithFilteredResult(_0x52db91,_0x3f883e){return function(_0x5b68e9){if(_0x5b68e9){var _0x486d13=typeof _0x3f883e[_0x659e('0x14')]===_0x659e('0x15')&&typeof _0x3f883e['limit']==='undefined';var _0x4bf14e=_0x5b68e9['count'];var _0x3d0e14=_0x486d13?0x0:_0x3f883e[_0x659e('0x14')];var _0x813d25=_0x486d13?_0x5b68e9['count']:_0x3f883e[_0x659e('0x14')]+_0x3f883e[_0x659e('0x16')];var _0x2c0d8c;if(_0x813d25>=_0x4bf14e){_0x813d25=_0x4bf14e;_0x2c0d8c=0xc8;}else{_0x2c0d8c=0xce;}_0x52db91[_0x659e('0x17')](_0x2c0d8c);return _0x52db91['set'](_0x659e('0x18'),_0x3d0e14+'-'+_0x813d25+'/'+_0x4bf14e)[_0x659e('0x13')](_0x5b68e9);}return null;};}function saveUpdates(_0x4ad06a){return function(_0xafe7dd){if(_0xafe7dd){return _0xafe7dd[_0x659e('0x19')](_0x4ad06a)['then'](function(_0x1a9c80){return _0x1a9c80;});}return null;};}function removeEntity(_0x3312c6){return function(_0x47049c){if(_0x47049c){return _0x47049c['destroy']()[_0x659e('0x1a')](function(){_0x3312c6[_0x659e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x174ef9){return function(_0x46bd35){if(!_0x46bd35){_0x174ef9['sendStatus'](0x194);}return _0x46bd35;};}function handleError(_0x25351a,_0x45b9af){_0x45b9af=_0x45b9af||0x1f4;return function(_0x48ec5f){logger[_0x659e('0xe')](_0x48ec5f['stack']);if(_0x48ec5f[_0x659e('0x1b')]){delete _0x48ec5f[_0x659e('0x1b')];}_0x25351a[_0x659e('0x17')](_0x45b9af)['send'](_0x48ec5f);};}exports[_0x659e('0x1c')]=function(_0x2ef4b1,_0xbf3eaf){var _0x59708b={},_0x4c65ed={},_0x4357b1={'count':0x0,'rows':[]};var _0x3c66a6=_['map'](db[_0x659e('0x1d')][_0x659e('0x1e')],function(_0x33ea3e){return{'name':_0x33ea3e[_0x659e('0x1f')],'type':_0x33ea3e[_0x659e('0x20')][_0x659e('0x21')]};});_0x4c65ed[_0x659e('0x22')]=_[_0x659e('0x23')](_0x3c66a6,_0x659e('0x1b'));_0x4c65ed[_0x659e('0x24')]=_[_0x659e('0x25')](_0x2ef4b1[_0x659e('0x24')]);_0x4c65ed['filters']=_[_0x659e('0x26')](_0x4c65ed[_0x659e('0x22')],_0x4c65ed[_0x659e('0x24')]);_0x59708b['attributes']=_[_0x659e('0x26')](_0x4c65ed[_0x659e('0x22')],qs[_0x659e('0x27')](_0x2ef4b1[_0x659e('0x24')][_0x659e('0x27')]));_0x59708b[_0x659e('0x28')]=_0x59708b[_0x659e('0x28')][_0x659e('0x29')]?_0x59708b['attributes']:_0x4c65ed[_0x659e('0x22')];if(!_0x2ef4b1[_0x659e('0x24')][_0x659e('0x2a')](_0x659e('0x2b'))){_0x59708b['limit']=qs['limit'](_0x2ef4b1[_0x659e('0x24')]['limit']);_0x59708b[_0x659e('0x14')]=qs[_0x659e('0x14')](_0x2ef4b1['query'][_0x659e('0x14')]);}_0x59708b[_0x659e('0x2c')]=qs[_0x659e('0x2d')](_0x2ef4b1[_0x659e('0x24')]['sort']);_0x59708b[_0x659e('0x2e')]=qs[_0x659e('0x2f')](_[_0x659e('0x30')](_0x2ef4b1[_0x659e('0x24')],_0x4c65ed[_0x659e('0x2f')]),_0x3c66a6);if(_0x2ef4b1[_0x659e('0x24')][_0x659e('0x31')]){_0x59708b[_0x659e('0x2e')]=_[_0x659e('0x32')](_0x59708b[_0x659e('0x2e')],{'$or':_[_0x659e('0x23')](_0x3c66a6,function(_0x412219){if(_0x412219['type']!==_0x659e('0x33')){var _0x4aa287={};_0x4aa287[_0x412219[_0x659e('0x1b')]]={'$like':'%'+_0x2ef4b1['query'][_0x659e('0x31')]+'%'};return _0x4aa287;}})});}_0x59708b=_[_0x659e('0x32')]({},_0x59708b,_0x2ef4b1[_0x659e('0x34')]);var _0x4e1de2={'where':_0x59708b[_0x659e('0x2e')]};return db[_0x659e('0x1d')][_0x659e('0x35')](_0x4e1de2)['then'](function(_0x5387ba){_0x4357b1[_0x659e('0x35')]=_0x5387ba;if(_0x2ef4b1['query'][_0x659e('0x36')]){_0x59708b[_0x659e('0x37')]=[{'all':!![]}];}return db[_0x659e('0x1d')]['findAll'](_0x59708b);})[_0x659e('0x1a')](function(_0x49feed){_0x4357b1[_0x659e('0x38')]=_0x49feed;return _0x4357b1;})[_0x659e('0x1a')](respondWithFilteredResult(_0xbf3eaf,_0x59708b))[_0x659e('0x12')](handleError(_0xbf3eaf,null));};exports[_0x659e('0x39')]=function(_0x45b24c,_0x4c8e0a){var _0x15e397={'raw':!![],'where':{'id':_0x45b24c['params']['id']}},_0x28b06b={};_0x28b06b[_0x659e('0x22')]=_[_0x659e('0x25')](db['Network'][_0x659e('0x1e')]);_0x28b06b[_0x659e('0x24')]=_[_0x659e('0x25')](_0x45b24c['query']);_0x28b06b[_0x659e('0x2f')]=_[_0x659e('0x26')](_0x28b06b[_0x659e('0x22')],_0x28b06b[_0x659e('0x24')]);_0x15e397['attributes']=_[_0x659e('0x26')](_0x28b06b[_0x659e('0x22')],qs[_0x659e('0x27')](_0x45b24c[_0x659e('0x24')][_0x659e('0x27')]));_0x15e397['attributes']=_0x15e397['attributes'][_0x659e('0x29')]?_0x15e397['attributes']:_0x28b06b[_0x659e('0x22')];if(_0x45b24c[_0x659e('0x24')][_0x659e('0x36')]){_0x15e397[_0x659e('0x37')]=[{'all':!![]}];}_0x15e397=_[_0x659e('0x32')]({},_0x15e397,_0x45b24c[_0x659e('0x34')]);return db[_0x659e('0x1d')][_0x659e('0x3a')](_0x15e397)['then'](handleEntityNotFound(_0x4c8e0a,null))['then'](respondWithResult(_0x4c8e0a,null))['catch'](handleError(_0x4c8e0a,null));};exports['create']=function(_0x590eef,_0x202064){var _0x3c0a85;return db[_0x659e('0x1d')][_0x659e('0x3b')](_0x590eef[_0x659e('0x3c')],{'raw':!![]})[_0x659e('0x1a')](function(_0x1fe00f){_0x3c0a85=_0x1fe00f;return db['Network']['findAll']({'where':{'type':_0x590eef[_0x659e('0x3c')]['type']},'raw':!![]});})[_0x659e('0x1a')](function(_0x5b558b){if(_0x3c0a85['type']['toUpperCase']()==_0x659e('0x3d')){var _0x1942f0=fs[_0x659e('0x3e')](path[_0x659e('0x3f')](config[_0x659e('0x40')],_0x659e('0x41')),_0x659e('0x42'));var _0x112f9d=ejs[_0x659e('0x43')](_0x1942f0,{'networks':_0x5b558b||[]});fs[_0x659e('0x44')](_0x659e('0x45'),_0x112f9d);return respondWithRpcPromise(_0x659e('0x46'),'create',{'module':'res_stun_monitor.so'});}else if(_0x3c0a85[_0x659e('0x20')][_0x659e('0x47')]()==_0x659e('0x48')){var _0x4eeeb3=fs[_0x659e('0x3e')](path[_0x659e('0x3f')](config[_0x659e('0x40')],_0x659e('0x49')),'utf8');var _0x34d1a2=ejs[_0x659e('0x43')](_0x4eeeb3,{'networks':_0x5b558b||[]});fs['writeFileSync'](_0x659e('0x4a'),_0x34d1a2);return respondWithRpcPromise(_0x659e('0x46'),_0x659e('0x3b'),{'module':_0x659e('0x4b')});}else{var _0x5d4bb9=fs[_0x659e('0x3e')](path[_0x659e('0x3f')](config[_0x659e('0x40')],'server/files/templates/network.ejs'),_0x659e('0x42'));var _0xfef444=ejs[_0x659e('0x43')](_0x5d4bb9,{'networks':_0x5b558b||[]});fs[_0x659e('0x44')](util[_0x659e('0x4c')](_0x659e('0x4d'),_0x590eef[_0x659e('0x3c')][_0x659e('0x20')]['toLowerCase']()),_0xfef444);return respondWithRpcPromise(_0x659e('0x46'),_0x659e('0x3b'),{'module':_0x659e('0x4e')});}})[_0x659e('0x1a')](function(){return _0x3c0a85;})[_0x659e('0x1a')](respondWithResult(_0x202064,0xc9))[_0x659e('0x12')](handleError(_0x202064,null));};exports['update']=function(_0xf98e2f,_0x57d8e9){var _0x4cca97;return db['Network']['find']({'where':{'id':_0xf98e2f['params']['id']}})[_0x659e('0x1a')](handleEntityNotFound(_0x57d8e9,null))[_0x659e('0x1a')](saveUpdates(_0xf98e2f[_0x659e('0x3c')],null))[_0x659e('0x1a')](function(_0x464cd4){if(_0x464cd4){_0x4cca97=_0x464cd4;return db[_0x659e('0x1d')][_0x659e('0x4f')]({'where':{'type':_0x4cca97[_0x659e('0x20')]},'raw':!![]});}return null;})[_0x659e('0x1a')](function(_0x1ea55c){if(_0x4cca97[_0x659e('0x20')][_0x659e('0x47')]()=='STUN'){var _0x265f2d=fs[_0x659e('0x3e')](path['join'](config[_0x659e('0x40')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x4f3abc=ejs[_0x659e('0x43')](_0x265f2d,{'networks':_0x1ea55c||[]});fs[_0x659e('0x44')](_0x659e('0x45'),_0x4f3abc);return respondWithRpcPromise(_0x659e('0x46'),_0x659e('0x19'),{'module':_0x659e('0x4b')});}else if(_0x4cca97[_0x659e('0x20')]['toUpperCase']()=='TURN'){var _0x54b3a0=fs[_0x659e('0x3e')](path[_0x659e('0x3f')](config[_0x659e('0x40')],_0x659e('0x49')),'utf8');var _0x2237ce=ejs[_0x659e('0x43')](_0x54b3a0,{'networks':_0x1ea55c||[]});fs[_0x659e('0x44')](_0x659e('0x4a'),_0x2237ce);return respondWithRpcPromise('Reload','update',{'module':'res_stun_monitor.so'});}else{var _0x9eaf7d=fs[_0x659e('0x3e')](path[_0x659e('0x3f')](config['root'],_0x659e('0x50')),_0x659e('0x42'));var _0x2751dc=ejs[_0x659e('0x43')](_0x9eaf7d,{'networks':_0x1ea55c||[]});fs[_0x659e('0x44')](util[_0x659e('0x4c')](_0x659e('0x4d'),_0xf98e2f[_0x659e('0x3c')]['type'][_0x659e('0x51')]()),_0x2751dc);return respondWithRpcPromise('Reload',_0x659e('0x19'),{'module':_0x659e('0x4e')});}})[_0x659e('0x1a')](function(_0x4236e3){if(_0x4236e3){return _0x4cca97;}return null;})[_0x659e('0x1a')](respondWithResult(_0x57d8e9,null))['catch'](handleError(_0x57d8e9,null));};exports[_0x659e('0x52')]=function(_0x327519,_0x5b69ef){var _0x19a3e0;return db[_0x659e('0x1d')][_0x659e('0x3a')]({'where':{'id':_0x327519['params']['id']}})[_0x659e('0x1a')](function(_0x1ac1bc){_0x19a3e0=_0x1ac1bc;return _0x1ac1bc;})['then'](handleEntityNotFound(_0x5b69ef,null))['then'](removeEntity(_0x5b69ef,null))['then'](function(){if(_0x19a3e0){return db['Network'][_0x659e('0x4f')]({'where':{'type':_0x19a3e0[_0x659e('0x20')]},'raw':!![]});}})['then'](function(_0x5e5d3c){if(_0x19a3e0[_0x659e('0x20')][_0x659e('0x47')]()==_0x659e('0x3d')){var _0x112f5f=fs[_0x659e('0x3e')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x1c36e5=ejs['render'](_0x112f5f,{'networks':_0x5e5d3c||[]});fs[_0x659e('0x44')](_0x659e('0x45'),_0x1c36e5);return respondWithRpcPromise(_0x659e('0x46'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x19a3e0[_0x659e('0x20')][_0x659e('0x47')]()==_0x659e('0x48')){var _0x19cf37=fs[_0x659e('0x3e')](path['join'](config[_0x659e('0x40')],_0x659e('0x49')),_0x659e('0x42'));var _0x1736e5=ejs['render'](_0x19cf37,{'networks':_0x5e5d3c||[]});fs['writeFileSync'](_0x659e('0x4a'),_0x1736e5);return respondWithRpcPromise('Reload','destroy',{'module':_0x659e('0x4b')});}else{var _0x2429d7=fs['readFileSync'](path[_0x659e('0x3f')](config[_0x659e('0x40')],_0x659e('0x50')),_0x659e('0x42'));var _0x1ef285=ejs[_0x659e('0x43')](_0x2429d7,{'networks':_0x5e5d3c||[]});fs['writeFileSync'](util[_0x659e('0x4c')](_0x659e('0x4d'),_0x19a3e0['type'][_0x659e('0x51')]()),_0x1ef285);return respondWithRpcPromise(_0x659e('0x46'),_0x659e('0x52'),{'module':'chan_sip.so'});}})[_0x659e('0x12')](handleError(_0x5b69ef,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 22f8fb1..5efb51e 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 _0xe706=['request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1e6e06,_0xff225){var _0x46491f=function(_0x27d961){while(--_0x27d961){_0x1e6e06['push'](_0x1e6e06['shift']());}};_0x46491f(++_0xff225);}(_0xe706,0xa3));var _0x6e70=function(_0x1fe809,_0x433222){_0x1fe809=_0x1fe809-0x0;var _0x59c58c=_0xe706[_0x1fe809];return _0x59c58c;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f68=['Network','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x1deb72,_0x3f6338){var _0x18bbdf=function(_0x1b4b9b){while(--_0x1b4b9b){_0x1deb72['push'](_0x1deb72['shift']());}};_0x18bbdf(++_0x3f6338);}(_0x2f68,0x9a));var _0x82f6=function(_0x2000c2,_0x43c890){_0x2000c2=_0x2000c2-0x0;var _0x2a6d32=_0x2f68[_0x2000c2];return _0x2a6d32;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var logger=require(_0x82f6('0x1'))(_0x82f6('0x2'));var moment=require(_0x82f6('0x3'));var BPromise=require('bluebird');var rp=require(_0x82f6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82f6('0x5'));var config=require(_0x82f6('0x6'));var attributes=require('./network.attributes');module[_0x82f6('0x7')]=function(_0x2c4302,_0x542737){return _0x2c4302['define'](_0x82f6('0x8'),attributes,{'tableName':'network','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 44c8707..81ccb35 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x55ef4a,_0x443d6b){var _0x20cb70=function(_0x12aa9c){while(--_0x12aa9c){_0x55ef4a['push'](_0x55ef4a['shift']());}};_0x20cb70(++_0x443d6b);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x4c5ab6,_0x334438){_0x4c5ab6=_0x4c5ab6-0x0;var _0x5b5f67=_0x7a54[_0x4c5ab6];return _0x5b5f67;};'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 3d4e577..ae1abbf 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 _0x627e=['destroy','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','delete'];(function(_0x1d52eb,_0x80e912){var _0x226ee0=function(_0x239de1){while(--_0x239de1){_0x1d52eb['push'](_0x1d52eb['shift']());}};_0x226ee0(++_0x80e912);}(_0x627e,0x14a));var _0xe627=function(_0xa61bd3,_0x3661b2){_0xa61bd3=_0xa61bd3-0x0;var _0x5b46b3=_0x627e[_0xa61bd3];return _0x5b46b3;};'use strict';var multer=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var path=require(_0xe627('0x2'));var timeout=require(_0xe627('0x3'));var express=require(_0xe627('0x4'));var router=express['Router']();var fs_extra=require(_0xe627('0x5'));var auth=require(_0xe627('0x6'));var interaction=require(_0xe627('0x7'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0xe627('0x8')](),controller[_0xe627('0x9')]);router[_0xe627('0xa')](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0xc')]);router['get'](_0xe627('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe627('0xa')](_0xe627('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xe627('0xa')](_0xe627('0xf'),auth[_0xe627('0x8')](),controller[_0xe627('0x10')]);router[_0xe627('0xa')](_0xe627('0x11'),auth[_0xe627('0x8')](),controller[_0xe627('0x12')]);router[_0xe627('0xa')]('/:id/interactions',auth[_0xe627('0x8')](),controller[_0xe627('0x13')]);router[_0xe627('0xa')]('/:id/users',auth[_0xe627('0x8')](),controller[_0xe627('0x14')]);router[_0xe627('0x15')]('/',auth[_0xe627('0x8')](),controller[_0xe627('0x16')]);router[_0xe627('0x15')](_0xe627('0xe'),auth['isAuthenticated'](),controller[_0xe627('0x17')]);router[_0xe627('0x15')](_0xe627('0xf'),auth[_0xe627('0x8')](),controller[_0xe627('0x18')]);router[_0xe627('0x15')](_0xe627('0x19'),controller[_0xe627('0x1a')]);router['post'](_0xe627('0x11'),auth['isAuthenticated'](),controller[_0xe627('0x1b')]);router['post']('/:id/users',auth[_0xe627('0x8')](),controller['addAgents']);router[_0xe627('0x15')](_0xe627('0x1c'),auth['isAuthenticated'](),controller['send']);router['put'](_0xe627('0xd'),auth[_0xe627('0x8')](),controller['update']);router[_0xe627('0x1d')](_0xe627('0xd'),auth['isAuthenticated'](),controller[_0xe627('0x1e')]);router[_0xe627('0x1d')]('/:id/dispositions',auth[_0xe627('0x8')](),controller[_0xe627('0x1f')]);router[_0xe627('0x1d')]('/:id/canned_answers',auth[_0xe627('0x8')](),controller[_0xe627('0x20')]);router[_0xe627('0x1d')](_0xe627('0x21'),auth['isAuthenticated'](),controller[_0xe627('0x22')]);module[_0xe627('0x23')]=router; \ No newline at end of file +var _0x627e=['destroy','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','delete'];(function(_0x5b84a7,_0x4cd919){var _0x584c8f=function(_0x4e5e01){while(--_0x4e5e01){_0x5b84a7['push'](_0x5b84a7['shift']());}};_0x584c8f(++_0x4cd919);}(_0x627e,0x14a));var _0xe627=function(_0x561ae7,_0x539925){_0x561ae7=_0x561ae7-0x0;var _0x1ab6ab=_0x627e[_0x561ae7];return _0x1ab6ab;};'use strict';var multer=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var path=require(_0xe627('0x2'));var timeout=require(_0xe627('0x3'));var express=require(_0xe627('0x4'));var router=express['Router']();var fs_extra=require(_0xe627('0x5'));var auth=require(_0xe627('0x6'));var interaction=require(_0xe627('0x7'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0xe627('0x8')](),controller[_0xe627('0x9')]);router[_0xe627('0xa')](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0xc')]);router['get'](_0xe627('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe627('0xa')](_0xe627('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xe627('0xa')](_0xe627('0xf'),auth[_0xe627('0x8')](),controller[_0xe627('0x10')]);router[_0xe627('0xa')](_0xe627('0x11'),auth[_0xe627('0x8')](),controller[_0xe627('0x12')]);router[_0xe627('0xa')]('/:id/interactions',auth[_0xe627('0x8')](),controller[_0xe627('0x13')]);router[_0xe627('0xa')]('/:id/users',auth[_0xe627('0x8')](),controller[_0xe627('0x14')]);router[_0xe627('0x15')]('/',auth[_0xe627('0x8')](),controller[_0xe627('0x16')]);router[_0xe627('0x15')](_0xe627('0xe'),auth['isAuthenticated'](),controller[_0xe627('0x17')]);router[_0xe627('0x15')](_0xe627('0xf'),auth[_0xe627('0x8')](),controller[_0xe627('0x18')]);router[_0xe627('0x15')](_0xe627('0x19'),controller[_0xe627('0x1a')]);router['post'](_0xe627('0x11'),auth['isAuthenticated'](),controller[_0xe627('0x1b')]);router['post']('/:id/users',auth[_0xe627('0x8')](),controller['addAgents']);router[_0xe627('0x15')](_0xe627('0x1c'),auth['isAuthenticated'](),controller['send']);router['put'](_0xe627('0xd'),auth[_0xe627('0x8')](),controller['update']);router[_0xe627('0x1d')](_0xe627('0xd'),auth['isAuthenticated'](),controller[_0xe627('0x1e')]);router[_0xe627('0x1d')]('/:id/dispositions',auth[_0xe627('0x8')](),controller[_0xe627('0x1f')]);router[_0xe627('0x1d')]('/:id/canned_answers',auth[_0xe627('0x8')](),controller[_0xe627('0x20')]);router[_0xe627('0x1d')](_0xe627('0x21'),auth['isAuthenticated'](),controller[_0xe627('0x22')]);module[_0xe627('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 04a2f19..5698501 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 _0x5754=['mandatoryDisposition','sequelize','randomstring','name','STRING','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(_0x1e2774,_0x3e6159){var _0x35879b=function(_0x3a57fd){while(--_0x3a57fd){_0x1e2774['push'](_0x1e2774['shift']());}};_0x35879b(++_0x3e6159);}(_0x5754,0xc1));var _0x4575=function(_0x19f005,_0x5de2b0){_0x19f005=_0x19f005-0x0;var _0x4d3454=_0x5754[_0x19f005];return _0x4d3454;};'use strict';var Sequelize=require(_0x4575('0x0'));var rs=require(_0x4575('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x4575('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x4575('0x3')]},'token':{'type':Sequelize[_0x4575('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4575('0x4');}},'notificationSound':{'type':Sequelize[_0x4575('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4575('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4575('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x4575('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4575('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x4575('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x4575('0x5')],'defaultValue':![],'comment':_0x4575('0x8'),'set':function(_0x316b35){if(!_0x316b35)this[_0x4575('0x9')](_0x4575('0xa'),null);this[_0x4575('0x9')](_0x4575('0xb'),_0x316b35);}}}; \ No newline at end of file +var _0x7f0f=['exports','STRING','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring'];(function(_0x3c2b77,_0x1c5087){var _0x2c3bf6=function(_0xd6bd5d){while(--_0xd6bd5d){_0x3c2b77['push'](_0x3c2b77['shift']());}};_0x2c3bf6(++_0x1c5087);}(_0x7f0f,0x1e2));var _0xf7f0=function(_0x13089c,_0x3c6390){_0x13089c=_0x13089c-0x0;var _0x4af4fe=_0x7f0f[_0x13089c];return _0x4af4fe;};'use strict';var Sequelize=require(_0xf7f0('0x0'));var rs=require(_0xf7f0('0x1'));module[_0xf7f0('0x2')]={'name':{'type':Sequelize[_0xf7f0('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xf7f0('0x3')],'defaultValue':function(){return rs[_0xf7f0('0x4')]();}},'replyUri':{'type':Sequelize[_0xf7f0('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xf7f0('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf7f0('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf7f0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf7f0('0x3')]},'queueTransfer':{'type':Sequelize[_0xf7f0('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf7f0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf7f0('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf7f0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf7f0('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xf7f0('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xf7f0('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2468c4){if(!_0x2468c4)this['setDataValue'](_0xf7f0('0x9'),null);this['setDataValue'](_0xf7f0('0xa'),_0x2468c4);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 55281b9..35cca33 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 _0x483f=['addDisposition','OpenchannelAccountId','Disposition','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','ContactId','messageId','interaction','created','autoclose','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','push','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','UserProfileResource','destroy','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','VIRTUAL','options','where','includeAll','findAll','rows','params','include','merge','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','describe'];(function(_0x5300b6,_0x4a5846){var _0x58980e=function(_0x1bdee5){while(--_0x1bdee5){_0x5300b6['push'](_0x5300b6['shift']());}};_0x58980e(++_0x4a5846);}(_0x483f,0x11c));var _0xf483=function(_0x5c2096,_0x4d217b){_0x5c2096=_0x5c2096-0x0;var _0xaa653c=_0x483f[_0x5c2096];return _0xaa653c;};'use strict';var emlformat=require(_0xf483('0x0'));var rimraf=require(_0xf483('0x1'));var zipdir=require(_0xf483('0x2'));var jsonpatch=require(_0xf483('0x3'));var rp=require(_0xf483('0x4'));var moment=require(_0xf483('0x5'));var BPromise=require(_0xf483('0x6'));var Mustache=require(_0xf483('0x7'));var util=require(_0xf483('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf483('0x9'));var fs=require('fs');var fs_extra=require(_0xf483('0xa'));var _=require(_0xf483('0xb'));var squel=require(_0xf483('0xc'));var crypto=require(_0xf483('0xd'));var jsforce=require(_0xf483('0xe'));var deskjs=require(_0xf483('0xf'));var toCsv=require(_0xf483('0x10'));var querystring=require('querystring');var Papa=require(_0xf483('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf483('0x12'));var as=require(_0xf483('0x13'));var hardwareService=require(_0xf483('0x14'));var logger=require(_0xf483('0x15'))('api');var utils=require(_0xf483('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf483('0x17'));var db=require(_0xf483('0x18'))['db'];config['redis']=_[_0xf483('0x19')](config[_0xf483('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf483('0x1a')]));require(_0xf483('0x1b'))[_0xf483('0x1c')](socket);var jayson=require(_0xf483('0x1d'));var client=jayson[_0xf483('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xf483('0x1e')][_0xf483('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x48ee49,_0x14811d,_0x325472,_0x209bf0){return new BPromise(function(_0xaaab8f,_0xc1c541){var _0x355f6a=_0x209bf0||client;return _0x355f6a[_0xf483('0x20')](_0x48ee49,_0x325472)[_0xf483('0x21')](function(_0x4a2b19){logger[_0xf483('0x22')](_0xf483('0x23'),_0x14811d,_0xf483('0x24'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x14811d,_0xf483('0x24'),JSON[_0xf483('0x25')](_0x4a2b19));if(_0x4a2b19[_0xf483('0x26')]){if(_0x4a2b19['error'][_0xf483('0x27')]===0x1f4){logger[_0xf483('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x14811d,_0x4a2b19[_0xf483('0x26')]['message']);return _0xc1c541(_0x4a2b19[_0xf483('0x26')]['message']);}logger[_0xf483('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x14811d,_0x4a2b19[_0xf483('0x26')][_0xf483('0x28')]);return _0xaaab8f(_0x4a2b19[_0xf483('0x26')][_0xf483('0x28')]);}else{logger[_0xf483('0x22')](_0xf483('0x23'),_0x14811d,_0xf483('0x24'));_0xaaab8f(_0x4a2b19['result'][_0xf483('0x28')]);}})[_0xf483('0x29')](function(_0x50932d){logger[_0xf483('0x26')](_0xf483('0x23'),_0x14811d,_0x50932d);_0xc1c541(_0x50932d);});});}function respondWithStatusCode(_0x514811,_0x2188ff){_0x2188ff=_0x2188ff||0xcc;return function(_0xfb138e){if(_0xfb138e){return _0x514811['sendStatus'](_0x2188ff);}return _0x514811[_0xf483('0x2a')](_0x2188ff)[_0xf483('0x2b')]();};}function respondWithResult(_0x2ac32d,_0x49147f){_0x49147f=_0x49147f||0xc8;return function(_0x1c6000){if(_0x1c6000){return _0x2ac32d['status'](_0x49147f)[_0xf483('0x2c')](_0x1c6000);}};}function respondWithFilteredResult(_0x202eab,_0x38d1eb){return function(_0x2c00d6){if(_0x2c00d6){var _0x2afaf6=typeof _0x38d1eb['offset']===_0xf483('0x2d')&&typeof _0x38d1eb[_0xf483('0x2e')]===_0xf483('0x2d');var _0x40c76f=_0x2c00d6[_0xf483('0x2f')];var _0x12498b=_0x2afaf6?0x0:_0x38d1eb[_0xf483('0x30')];var _0x2ed65b=_0x2afaf6?_0x2c00d6[_0xf483('0x2f')]:_0x38d1eb[_0xf483('0x30')]+_0x38d1eb[_0xf483('0x2e')];var _0x2f369f;if(_0x2ed65b>=_0x40c76f){_0x2ed65b=_0x40c76f;_0x2f369f=0xc8;}else{_0x2f369f=0xce;}_0x202eab[_0xf483('0x2a')](_0x2f369f);return _0x202eab['set'](_0xf483('0x31'),_0x12498b+'-'+_0x2ed65b+'/'+_0x40c76f)[_0xf483('0x2c')](_0x2c00d6);}return null;};}function patchUpdates(_0x397b60){return function(_0x18711a){try{jsonpatch[_0xf483('0x32')](_0x18711a,_0x397b60,!![]);}catch(_0x32bc2a){return BPromise['reject'](_0x32bc2a);}return _0x18711a[_0xf483('0x33')]();};}function saveUpdates(_0x493866,_0x280aca){return function(_0x3f6471){if(_0x3f6471){return _0x3f6471[_0xf483('0x34')](_0x493866)[_0xf483('0x21')](function(_0x5b6edb){return _0x5b6edb;});}return null;};}function removeEntity(_0x573bd3,_0x5e594e){return function(_0x277c3f){if(_0x277c3f){return _0x277c3f['destroy']()[_0xf483('0x21')](function(){var _0x2e3444=_0x277c3f['get']({'plain':!![]});var _0x57879a='OpenchannelAccounts';return db[_0xf483('0x35')][_0xf483('0x36')]({'where':{'type':_0x57879a,'resourceId':_0x2e3444['id']}})[_0xf483('0x21')](function(){return _0x277c3f;});})[_0xf483('0x21')](function(){_0x573bd3[_0xf483('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1118c6,_0x56ad00){return function(_0x53c3d9){if(!_0x53c3d9){_0x1118c6[_0xf483('0x37')](0x194);}return _0x53c3d9;};}function handleError(_0x1a71dc,_0x4a8f45){_0x4a8f45=_0x4a8f45||0x1f4;return function(_0x58c5dd){logger[_0xf483('0x26')](_0x58c5dd[_0xf483('0x38')]);if(_0x58c5dd[_0xf483('0x39')]){delete _0x58c5dd['name'];}_0x1a71dc['status'](_0x4a8f45)[_0xf483('0x3a')](_0x58c5dd);};}exports[_0xf483('0x3b')]=function(_0x364502,_0x28649b){var _0xd834da={'include':[{'model':db[_0xf483('0x3c')],'as':_0xf483('0x3d')}]},_0x5d1432={},_0x1044e9={'count':0x0,'rows':[]};var _0x42fd62=_['map'](db[_0xf483('0x3e')][_0xf483('0x3f')],function(_0xa5e99d){return{'name':_0xa5e99d[_0xf483('0x40')],'type':_0xa5e99d[_0xf483('0x41')][_0xf483('0x42')]};});_0x5d1432[_0xf483('0x43')]=_[_0xf483('0x44')](_0x42fd62,_0xf483('0x39'));_0x5d1432['query']=_[_0xf483('0x45')](_0x364502[_0xf483('0x46')]);_0x5d1432[_0xf483('0x47')]=_[_0xf483('0x48')](_0x5d1432[_0xf483('0x43')],_0x5d1432[_0xf483('0x46')]);_0xd834da[_0xf483('0x49')]=_[_0xf483('0x48')](_0x5d1432[_0xf483('0x43')],qs['fields'](_0x364502[_0xf483('0x46')][_0xf483('0x4a')]));_0xd834da['attributes']=_0xd834da[_0xf483('0x49')][_0xf483('0x4b')]?_0xd834da[_0xf483('0x49')]:_0x5d1432[_0xf483('0x43')];if(!_0x364502[_0xf483('0x46')]['hasOwnProperty'](_0xf483('0x4c'))){_0xd834da[_0xf483('0x2e')]=qs['limit'](_0x364502[_0xf483('0x46')]['limit']);_0xd834da[_0xf483('0x30')]=qs[_0xf483('0x30')](_0x364502[_0xf483('0x46')]['offset']);}_0xd834da[_0xf483('0x4d')]=qs['sort'](_0x364502['query'][_0xf483('0x4e')]);_0xd834da['where']=qs[_0xf483('0x47')](_[_0xf483('0x4f')](_0x364502[_0xf483('0x46')],_0x5d1432[_0xf483('0x47')]),_0x42fd62);if(_0x364502[_0xf483('0x46')][_0xf483('0x50')]){_0xd834da['where']=_['merge'](_0xd834da['where'],{'$or':_[_0xf483('0x44')](_0x42fd62,function(_0x447953){if(_0x447953[_0xf483('0x41')]!==_0xf483('0x51')){var _0x53a42b={};_0x53a42b[_0x447953[_0xf483('0x39')]]={'$like':'%'+_0x364502[_0xf483('0x46')][_0xf483('0x50')]+'%'};return _0x53a42b;}})});}_0xd834da=_['merge']({},_0xd834da,_0x364502[_0xf483('0x52')]);var _0x588f53={'where':_0xd834da[_0xf483('0x53')]};return db[_0xf483('0x3e')][_0xf483('0x2f')](_0x588f53)[_0xf483('0x21')](function(_0x2da7d0){_0x1044e9[_0xf483('0x2f')]=_0x2da7d0;if(_0x364502[_0xf483('0x46')][_0xf483('0x54')]){_0xd834da['include']=[{'all':!![]}];}return db[_0xf483('0x3e')][_0xf483('0x55')](_0xd834da);})[_0xf483('0x21')](function(_0x11b1b6){_0x1044e9[_0xf483('0x56')]=_0x11b1b6;return _0x1044e9;})[_0xf483('0x21')](respondWithFilteredResult(_0x28649b,_0xd834da))[_0xf483('0x29')](handleError(_0x28649b,null));};exports['show']=function(_0x18712c,_0x5ae641){var _0x326e0a={'raw':![],'where':{'id':_0x18712c[_0xf483('0x57')]['id']},'include':[{'model':db[_0xf483('0x3c')],'as':_0xf483('0x3d')}]},_0x599c1d={};_0x599c1d[_0xf483('0x43')]=_[_0xf483('0x45')](db['OpenchannelAccount'][_0xf483('0x3f')]);_0x599c1d['query']=_[_0xf483('0x45')](_0x18712c['query']);_0x599c1d['filters']=_['intersection'](_0x599c1d[_0xf483('0x43')],_0x599c1d[_0xf483('0x46')]);_0x326e0a['attributes']=_['intersection'](_0x599c1d[_0xf483('0x43')],qs[_0xf483('0x4a')](_0x18712c['query'][_0xf483('0x4a')]));_0x326e0a[_0xf483('0x49')]=_0x326e0a[_0xf483('0x49')]['length']?_0x326e0a[_0xf483('0x49')]:_0x599c1d[_0xf483('0x43')];if(_0x18712c[_0xf483('0x46')][_0xf483('0x54')]){_0x326e0a[_0xf483('0x58')]=[{'all':!![]}];}_0x326e0a=_[_0xf483('0x59')]({},_0x326e0a,_0x18712c['options']);return db['OpenchannelAccount'][_0xf483('0x5a')](_0x326e0a)['then'](handleEntityNotFound(_0x5ae641,null))[_0xf483('0x21')](respondWithResult(_0x5ae641,null))[_0xf483('0x29')](handleError(_0x5ae641,null));};exports[_0xf483('0x5b')]=function(_0x57bf0b,_0x1265eb){return db[_0xf483('0x3e')][_0xf483('0x5b')](_0x57bf0b[_0xf483('0x5c')],{})['then'](function(_0x56af15){var _0x1bdea3=_0x57bf0b[_0xf483('0x5d')][_0xf483('0x5e')]({'plain':!![]});if(!_0x1bdea3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bdea3[_0xf483('0x5f')]===_0xf483('0x5d')){var _0x4df340=_0x56af15[_0xf483('0x5e')]({'plain':!![]});var _0x5784e0='OpenchannelAccounts';return db[_0xf483('0x60')][_0xf483('0x5a')]({'where':{'name':_0x5784e0,'userProfileId':_0x1bdea3[_0xf483('0x61')]},'raw':!![]})[_0xf483('0x21')](function(_0x597c3c){if(_0x597c3c&&_0x597c3c[_0xf483('0x62')]===0x0){return db[_0xf483('0x35')][_0xf483('0x5b')]({'name':_0x4df340[_0xf483('0x39')],'resourceId':_0x4df340['id'],'type':_0x597c3c[_0xf483('0x39')],'sectionId':_0x597c3c['id']},{})['then'](function(){return _0x56af15;});}else{return _0x56af15;}})[_0xf483('0x29')](function(_0x3d3647){logger[_0xf483('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d3647);throw _0x3d3647;});}return _0x56af15;})['then'](respondWithResult(_0x1265eb,0xc9))[_0xf483('0x29')](handleError(_0x1265eb,null));};exports['update']=function(_0x22af15,_0x4d0754){if(_0x22af15['body']['id']){delete _0x22af15[_0xf483('0x5c')]['id'];}return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x22af15[_0xf483('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xf483('0x21')](handleEntityNotFound(_0x4d0754,null))[_0xf483('0x21')](saveUpdates(_0x22af15['body'],null))[_0xf483('0x21')](respondWithResult(_0x4d0754,null))['catch'](handleError(_0x4d0754,null));};exports[_0xf483('0x36')]=function(_0x5256f6,_0x34efd1){return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x5256f6[_0xf483('0x57')]['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x34efd1,null))[_0xf483('0x21')](removeEntity(_0x34efd1,null))[_0xf483('0x29')](handleError(_0x34efd1,null));};exports[_0xf483('0x63')]=function(_0x5140f8,_0x2e0b5c){return db['OpenchannelAccount']['describe']()[_0xf483('0x21')](respondWithResult(_0x2e0b5c,null))[_0xf483('0x29')](handleError(_0x2e0b5c,null));};exports[_0xf483('0x64')]=function(_0x4fcf38,_0x4d7b3a,_0xbb1a0d){if(_0x4fcf38[_0xf483('0x5c')]['id']){delete _0x4fcf38[_0xf483('0x5c')]['id'];}return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x4fcf38['params']['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x4d7b3a,null))[_0xf483('0x21')](function(_0x46fe47){if(_0x46fe47){_0x4fcf38['body'][_0xf483('0x65')]=_0x46fe47['id'];return db[_0xf483('0x66')][_0xf483('0x5b')](_0x4fcf38[_0xf483('0x5c')]);}})[_0xf483('0x21')](respondWithResult(_0x4d7b3a,null))[_0xf483('0x29')](handleError(_0x4d7b3a,null));};exports['getDispositions']=function(_0x4abf56,_0xaaffdd,_0x294ffa){var _0x55a5de={'raw':![],'where':{}};var _0x8f2281={};var _0x1bebd9={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xf483('0x67')]({'where':{'id':_0x4abf56['params']['id']}})[_0xf483('0x21')](handleEntityNotFound(_0xaaffdd,null))['then'](function(_0x47b886){if(_0x47b886){_0x8f2281[_0xf483('0x43')]=_[_0xf483('0x45')](db[_0xf483('0x66')][_0xf483('0x3f')]);_0x8f2281[_0xf483('0x46')]=_[_0xf483('0x45')](_0x4abf56[_0xf483('0x46')]);_0x8f2281[_0xf483('0x47')]=_[_0xf483('0x48')](_0x8f2281[_0xf483('0x43')],_0x8f2281[_0xf483('0x46')]);_0x55a5de[_0xf483('0x49')]=_[_0xf483('0x48')](_0x8f2281[_0xf483('0x43')],qs[_0xf483('0x4a')](_0x4abf56[_0xf483('0x46')][_0xf483('0x4a')]));_0x55a5de['attributes']=_0x55a5de[_0xf483('0x49')][_0xf483('0x4b')]?_0x55a5de[_0xf483('0x49')]:_0x8f2281[_0xf483('0x43')];if(!_0x4abf56[_0xf483('0x46')][_0xf483('0x68')](_0xf483('0x4c'))){_0x55a5de['limit']=qs[_0xf483('0x2e')](_0x4abf56['query'][_0xf483('0x2e')]);_0x55a5de[_0xf483('0x30')]=qs[_0xf483('0x30')](_0x4abf56[_0xf483('0x46')]['offset']);}_0x55a5de[_0xf483('0x4d')]=qs[_0xf483('0x4e')](_0x4abf56[_0xf483('0x46')][_0xf483('0x4e')]);_0x55a5de[_0xf483('0x53')]=qs['filters'](_[_0xf483('0x4f')](_0x4abf56['query'],_0x8f2281[_0xf483('0x47')]));_0x55a5de['where'][_0xf483('0x65')]=_0x47b886['id'];if(_0x4abf56[_0xf483('0x46')]['filter']){_0x55a5de[_0xf483('0x53')]=_[_0xf483('0x59')](_0x55a5de[_0xf483('0x53')],{'$or':_[_0xf483('0x44')](_0x55a5de[_0xf483('0x49')],function(_0x4e96ce){var _0x4d691c={};_0x4d691c[_0x4e96ce]={'$like':'%'+_0x4abf56['query'][_0xf483('0x50')]+'%'};return _0x4d691c;})});}_0x55a5de=_[_0xf483('0x59')]({},_0x55a5de,_0x4abf56[_0xf483('0x52')]);return db[_0xf483('0x66')][_0xf483('0x2f')]({'where':_0x55a5de[_0xf483('0x53')]})[_0xf483('0x21')](function(_0x357ed1){_0x1bebd9[_0xf483('0x2f')]=_0x357ed1;if(_0x4abf56[_0xf483('0x46')][_0xf483('0x54')]){_0x55a5de['include']=[{'all':!![]}];}return db[_0xf483('0x66')]['findAll'](_0x55a5de);})[_0xf483('0x21')](function(_0x3545b8){_0x1bebd9[_0xf483('0x56')]=_0x3545b8;return _0x1bebd9;});}})[_0xf483('0x21')](respondWithFilteredResult(_0xaaffdd,_0x55a5de))['catch'](handleError(_0xaaffdd,null));};exports['removeDispositions']=function(_0x8b7a73,_0x358b51,_0x2830bb){return db[_0xf483('0x3e')]['find']({'where':{'id':_0x8b7a73[_0xf483('0x57')]['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x358b51,null))[_0xf483('0x21')](function(_0x1357fc){if(_0x1357fc){return _0x1357fc[_0xf483('0x69')](_0x8b7a73[_0xf483('0x46')][_0xf483('0x6a')]);}})[_0xf483('0x21')](respondWithStatusCode(_0x358b51,null))[_0xf483('0x29')](handleError(_0x358b51,null));};exports[_0xf483('0x6b')]=function(_0x3a2da2,_0x45142f,_0x5260b6){if(_0x3a2da2['body']['id']){delete _0x3a2da2['body']['id'];}return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x3a2da2[_0xf483('0x57')]['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x45142f,null))['then'](function(_0x497e1d){if(_0x497e1d){_0x3a2da2[_0xf483('0x5c')][_0xf483('0x65')]=_0x497e1d['id'];return db[_0xf483('0x6c')][_0xf483('0x5b')](_0x3a2da2[_0xf483('0x5c')]);}})[_0xf483('0x21')](respondWithResult(_0x45142f,null))[_0xf483('0x29')](handleError(_0x45142f,null));};exports['getAnswers']=function(_0x46bf77,_0x3590a9,_0x3a350d){var _0x25d9ee={'raw':![],'where':{}};var _0x13d70b={};var _0x4bbf7a={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xf483('0x67')]({'where':{'id':_0x46bf77['params']['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x3590a9,null))[_0xf483('0x21')](function(_0x20ab3e){if(_0x20ab3e){_0x13d70b[_0xf483('0x43')]=_[_0xf483('0x45')](db[_0xf483('0x6c')][_0xf483('0x3f')]);_0x13d70b['query']=_[_0xf483('0x45')](_0x46bf77[_0xf483('0x46')]);_0x13d70b[_0xf483('0x47')]=_['intersection'](_0x13d70b[_0xf483('0x43')],_0x13d70b['query']);_0x25d9ee['attributes']=_[_0xf483('0x48')](_0x13d70b['model'],qs[_0xf483('0x4a')](_0x46bf77[_0xf483('0x46')]['fields']));_0x25d9ee[_0xf483('0x49')]=_0x25d9ee[_0xf483('0x49')][_0xf483('0x4b')]?_0x25d9ee[_0xf483('0x49')]:_0x13d70b['model'];if(!_0x46bf77[_0xf483('0x46')]['hasOwnProperty'](_0xf483('0x4c'))){_0x25d9ee['limit']=qs['limit'](_0x46bf77[_0xf483('0x46')]['limit']);_0x25d9ee[_0xf483('0x30')]=qs['offset'](_0x46bf77[_0xf483('0x46')][_0xf483('0x30')]);}_0x25d9ee[_0xf483('0x4d')]=qs[_0xf483('0x4e')](_0x46bf77[_0xf483('0x46')][_0xf483('0x4e')]);_0x25d9ee[_0xf483('0x53')]=qs['filters'](_[_0xf483('0x4f')](_0x46bf77['query'],_0x13d70b[_0xf483('0x47')]));_0x25d9ee['where'][_0xf483('0x65')]=_0x20ab3e['id'];if(_0x46bf77['query'][_0xf483('0x50')]){_0x25d9ee[_0xf483('0x53')]=_[_0xf483('0x59')](_0x25d9ee[_0xf483('0x53')],{'$or':_['map'](_0x25d9ee[_0xf483('0x49')],function(_0x8e6ee4){var _0x102293={};_0x102293[_0x8e6ee4]={'$like':'%'+_0x46bf77[_0xf483('0x46')][_0xf483('0x50')]+'%'};return _0x102293;})});}_0x25d9ee=_[_0xf483('0x59')]({},_0x25d9ee,_0x46bf77[_0xf483('0x52')]);return db['CannedAnswer'][_0xf483('0x2f')]({'where':_0x25d9ee[_0xf483('0x53')]})[_0xf483('0x21')](function(_0x13ee77){_0x4bbf7a[_0xf483('0x2f')]=_0x13ee77;if(_0x46bf77[_0xf483('0x46')][_0xf483('0x54')]){_0x25d9ee[_0xf483('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf483('0x55')](_0x25d9ee);})['then'](function(_0x50ec3b){_0x4bbf7a['rows']=_0x50ec3b;return _0x4bbf7a;});}})['then'](respondWithFilteredResult(_0x3590a9,_0x25d9ee))['catch'](handleError(_0x3590a9,null));};exports[_0xf483('0x6d')]=function(_0x56a60b,_0x26d567,_0x5f568e){return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x56a60b[_0xf483('0x57')]['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x26d567,null))['then'](function(_0x227278){if(_0x227278){return _0x227278[_0xf483('0x6d')](_0x56a60b['query'][_0xf483('0x6a')]);}})[_0xf483('0x21')](respondWithStatusCode(_0x26d567,null))[_0xf483('0x29')](handleError(_0x26d567,null));};exports[_0xf483('0x6e')]=function(_0x5c1e07,_0x509a47,_0x57a2c4){var _0x5e6b42={'body':_0x5c1e07['body'],'channel':_0xf483('0x6f')};var _0x5ba4af=[];var _0x4b964b=[];var _0x2e8034={};var _0x3800a7=![];return db[_0xf483('0x70')][_0xf483('0x63')]()[_0xf483('0x21')](function(_0x435881){if(!_0x435881){throw new db[(_0xf483('0x71'))]['ValidationError'](_0xf483('0x72'));}_0x5ba4af=_[_0xf483('0x73')](_[_0xf483('0x45')](_0x435881),[_0xf483('0x74'),_0xf483('0x75')]);_0x4b964b=_['difference'](_[_0xf483('0x45')](_0x435881),['createdAt','updatedAt',_0xf483('0x76'),_0xf483('0x77')]);if(_0x5c1e07[_0xf483('0x5c')]['id']){delete _0x5c1e07[_0xf483('0x5c')]['id'];}if(_['isNil'](_0x5c1e07[_0xf483('0x5c')]['from'])){throw new db['Sequelize']['ValidationError'](_0xf483('0x78'));}if(_[_0xf483('0x79')](_0x5c1e07['body']['body'])||_0x5c1e07[_0xf483('0x5c')]['body']===''){throw new db[(_0xf483('0x71'))][(_0xf483('0x7a'))](_0xf483('0x7b'));}if(_[_0xf483('0x79')](_0x5c1e07[_0xf483('0x5c')]['mapKey'])){throw new db[(_0xf483('0x71'))][(_0xf483('0x7a'))](_0xf483('0x7c')+_0x4b964b);}if(!_[_0xf483('0x7d')](_0x4b964b,_0x5c1e07[_0xf483('0x5c')][_0xf483('0x7e')])){throw new db[(_0xf483('0x71'))][(_0xf483('0x7a'))](_0xf483('0x7f')+_0x4b964b);}_0x2e8034[_0x5c1e07[_0xf483('0x5c')][_0xf483('0x7e')]]=_0x5c1e07[_0xf483('0x5c')][_0xf483('0x80')];})[_0xf483('0x21')](function(){return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x5c1e07[_0xf483('0x57')]['id']},'include':[{'model':db[_0xf483('0x81')],'as':_0xf483('0x82'),'include':[{'model':db['CmContact'],'as':_0xf483('0x83'),'where':_0x2e8034,'limit':0x1,'order':[[_0xf483('0x75'),_0xf483('0x84')]]}]},{'model':db[_0xf483('0x85')],'as':_0xf483('0x86')}]});})[_0xf483('0x21')](handleEntityNotFound(_0x509a47,null))['then'](function(_0x25afda){if(_0x25afda&&_0x25afda[_0xf483('0x82')]){_0x5e6b42[_0xf483('0x87')]=_0x25afda;_0x5e6b42[_0xf483('0x88')]=_0x25afda[_0xf483('0x86')];_0x5e6b42[_0xf483('0x89')]=_0x25afda[_0xf483('0x82')];_0x5e6b42[_0xf483('0x88')]=_['orderBy'](_0x5e6b42[_0xf483('0x88')],[_0xf483('0x8a')],[_0xf483('0x8b')]);if(_0x5e6b42['account'][_0xf483('0x86')]){delete _0x5e6b42['account']['Applications'];}if(_0x5e6b42['account'][_0xf483('0x82')]&&_0x5e6b42[_0xf483('0x87')][_0xf483('0x82')][_0xf483('0x83')][_0xf483('0x4b')]){return _0x5e6b42['account'][_0xf483('0x82')][_0xf483('0x83')][0x0];}var _0x310ec6=_['defaults'](_0x5c1e07[_0xf483('0x5c')],{'firstName':_0x5c1e07[_0xf483('0x5c')][_0xf483('0x80')],'ListId':_0x25afda[_0xf483('0x77')]});_0x310ec6[_0x5c1e07[_0xf483('0x5c')][_0xf483('0x7e')]]=_0x5c1e07[_0xf483('0x5c')][_0xf483('0x80')];return db[_0xf483('0x70')][_0xf483('0x5b')](_0x310ec6,{'fields':_0x5ba4af,'raw':!![]});}})[_0xf483('0x21')](handleEntityNotFound(_0x509a47,null))[_0xf483('0x21')](function(_0x3ef26d){_0x5e6b42[_0xf483('0x8c')]=_0x3ef26d;if(_0x3ef26d){var _0x3e1b97={'ContactId':_0x3ef26d['id'],'OpenchannelAccountId':_0x5c1e07[_0xf483('0x57')]['id'],'from':(_0x3ef26d[_0xf483('0x8d')]||'')+'\x20'+(_0x3ef26d[_0xf483('0x8e')]||'')};var _0x127594={'OpenchannelAccountId':_0x5c1e07[_0xf483('0x57')]['id'],'closed':![]};if(_0x5c1e07[_0xf483('0x5c')]['threadId']){_0x127594[_0xf483('0x8f')]=_0x5c1e07[_0xf483('0x5c')]['threadId'];return db[_0xf483('0x90')][_0xf483('0x5a')]({'where':_0x127594})[_0xf483('0x21')](function(_0xf564f1){if(_0xf564f1){return[_0xf564f1,![]];}_0x3e1b97['threadId']=_0x5c1e07['body'][_0xf483('0x8f')];_0x3e1b97['externalUrl']=_0x5c1e07[_0xf483('0x5c')]['externalUrl'];return db[_0xf483('0x90')][_0xf483('0x5b')](_0x3e1b97)[_0xf483('0x21')](function(_0x4339b0){return[_0x4339b0,!![]];});});}else{_0x127594[_0xf483('0x8f')]=null;}_0x127594[_0xf483('0x91')]=_0x3ef26d['id'];return db['OpenchannelInteraction'][_0xf483('0x5a')]({'where':_0x127594})[_0xf483('0x21')](function(_0x3dec20){if(_0x3dec20){return[_0x3dec20,![]];}return db[_0xf483('0x90')][_0xf483('0x5b')](_0x3e1b97)[_0xf483('0x21')](function(_0x52c775){return[_0x52c775,!![]];});});}})['spread'](function(_0x4df7b2,_0x1caf13){if(_0x4df7b2){_0x3800a7=_0x1caf13;if(!_0x1caf13){var _0x95f359={'from':(_0x5e6b42[_0xf483('0x8c')][_0xf483('0x8d')]||'')+'\x20'+(_0x5e6b42[_0xf483('0x8c')][_0xf483('0x8e')]||'')};if(_0x5c1e07[_0xf483('0x5c')][_0xf483('0x8f')]&&_0x5c1e07[_0xf483('0x5c')][_0xf483('0x92')]&&_0x5c1e07[_0xf483('0x5c')][_0xf483('0x8f')]!=_0x5c1e07[_0xf483('0x5c')][_0xf483('0x92')]){_0x95f359[_0xf483('0x8f')]=_0x5c1e07[_0xf483('0x5c')][_0xf483('0x92')];}return _0x4df7b2[_0xf483('0x34')](_0x95f359);}else{return _0x4df7b2;}}})['then'](function(_0x21f9e3){_0x5e6b42[_0xf483('0x93')]=_0x21f9e3['get']({'plain':!![]});_0x5e6b42['interaction'][_0xf483('0x94')]=_0x3800a7;if(_0x5e6b42['interaction'][_0xf483('0x94')]){if(_0x5e6b42[_0xf483('0x87')][_0xf483('0x95')]){_0x5e6b42[_0xf483('0x88')]['push']({'id':0x0,'priority':_0x5e6b42['applications'][_0xf483('0x4b')]+0x1,'app':_0xf483('0x96'),'appdata':'unmanaged','interval':_0xf483('0x97')});}}return db[_0xf483('0x98')]['create']({'body':_0x5c1e07[_0xf483('0x5c')]['body'],'OpenchannelAccountId':_0x5c1e07['params']['id'],'OpenchannelInteractionId':_0x21f9e3['id'],'direction':'in','ContactId':_0x5e6b42[_0xf483('0x8c')]['id'],'AttachmentId':_0x5c1e07[_0xf483('0x5c')][_0xf483('0x99')]});})[_0xf483('0x21')](function(_0x57bb82){_0x5e6b42[_0xf483('0x28')]=_0x57bb82;if(!_0x5e6b42[_0xf483('0x93')][_0xf483('0x9a')])return;return db[_0xf483('0x9b')][_0xf483('0x5a')]({'attributes':['id',_0xf483('0x39')],'where':{'id':_0x5e6b42['interaction'][_0xf483('0x9a')]}});})[_0xf483('0x21')](function(_0x54b3f5){if(_0x54b3f5){_0x5e6b42['applications'][_0xf483('0x9c')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x54b3f5[_0xf483('0x39')]+','+(_0x5e6b42[_0xf483('0x87')][_0xf483('0x9d')]||0xa),'interval':_0xf483('0x97')});}if(!_0x5e6b42[_0xf483('0x93')][_0xf483('0x9e')])return;return db['OpenchannelQueue']['find']({'attributes':['id',_0xf483('0x39')],'where':{'id':_0x5e6b42[_0xf483('0x93')]['queueId']}});})[_0xf483('0x21')](function(_0x568a9a){if(_0x568a9a){_0x5e6b42[_0xf483('0x88')][_0xf483('0x9c')]({'id':0x0,'priority':0x1,'app':_0xf483('0x9f'),'appdata':_0x568a9a['name']+','+(_0x5e6b42[_0xf483('0x87')][_0xf483('0xa0')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xf483('0xa1'),_0xf483('0xa2'),_0x5e6b42);})[_0xf483('0x21')](function(_0x25d0c8){respondWithRpcPromise('EventManager',_0xf483('0xa3'),{'event':_0xf483('0x6e'),'message':_0x25d0c8},client9002);return _0x25d0c8;})[_0xf483('0x21')](respondWithResult(_0x509a47,null))[_0xf483('0x29')](handleError(_0x509a47,null));};exports['addApplications']=function(_0x4a554d,_0x33764f){var _0x4a2fc1=_0x4a554d['params']['id'];var _0x492993=_0x4a554d['body'];var _0x243f38=0xc8;var _0x541732=null;return db[_0xf483('0xa4')][_0xf483('0xa5')]({'isolationLevel':db[_0xf483('0xa4')][_0xf483('0xa6')][_0xf483('0xa7')][_0xf483('0xa8')]},function(_0x4383f0){return db[_0xf483('0x3e')][_0xf483('0x67')]({'where':{'id':_0x4a2fc1},'transaction':_0x4383f0})[_0xf483('0x21')](function(_0x564809){if(_0x564809){return db[_0xf483('0x85')][_0xf483('0x36')]({'where':{'OpenchannelAccountId':_0x4a2fc1},'transaction':_0x4383f0})[_0xf483('0x21')](function(){var _0x5b646f=_[_0xf483('0x44')](_0x492993,function(_0x3c50c7){_0x3c50c7[_0xf483('0x65')]=_0x4a2fc1;return _0x3c50c7;});return db[_0xf483('0x85')][_0xf483('0xa9')](_0x5b646f,{'transaction':_0x4383f0});});}else{_0x243f38=0x194;_0x541732=[];}});})[_0xf483('0x21')](function(){if(_0x243f38!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x4a2fc1},'order':_0xf483('0x8a')})[_0xf483('0x21')](function(_0x53386d){_0x541732=_0x53386d;});}})['catch'](function(_0x5d429e){_0x243f38=0x1f4;logger[_0xf483('0x26')](_0x5d429e[_0xf483('0x38')]);if(_0x5d429e['name']){delete _0x5d429e['name'];}_0x541732=_0x5d429e;})[_0xf483('0xaa')](function(){if(_0x541732===null){_0x33764f[_0xf483('0x37')](_0x243f38);}else{if(_0x243f38===0x1f4){_0x33764f[_0xf483('0x2a')](_0x243f38)['send'](_0x541732);}else{_0x33764f['status'](_0x243f38)[_0xf483('0x2c')](_0x541732);}}});};exports['getApplications']=function(_0x4942aa,_0x522691,_0x5db014){var _0x86ec2f={};var _0x167c7d={};var _0x1c9768;var _0x40421b;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4942aa['params']['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x522691,null))[_0xf483('0x21')](function(_0x5371fe){if(_0x5371fe){_0x1c9768=_0x5371fe;_0x167c7d['model']=_['keys'](db[_0xf483('0x85')][_0xf483('0x3f')]);_0x167c7d[_0xf483('0x46')]=_['keys'](_0x4942aa[_0xf483('0x46')]);_0x167c7d[_0xf483('0x47')]=_[_0xf483('0x48')](_0x167c7d[_0xf483('0x43')],_0x167c7d['query']);_0x86ec2f[_0xf483('0x49')]=_['intersection'](_0x167c7d[_0xf483('0x43')],qs[_0xf483('0x4a')](_0x4942aa[_0xf483('0x46')][_0xf483('0x4a')]));_0x86ec2f[_0xf483('0x49')]=_0x86ec2f['attributes'][_0xf483('0x4b')]?_0x86ec2f['attributes']:_0x167c7d[_0xf483('0x43')];_0x86ec2f[_0xf483('0x4d')]=qs[_0xf483('0x4e')](_0x4942aa['query']['sort']);_0x86ec2f[_0xf483('0x53')]=qs['filters'](_[_0xf483('0x4f')](_0x4942aa['query'],_0x167c7d['filters']));if(_0x4942aa['query']['filter']){_0x86ec2f[_0xf483('0x53')]=_['merge'](_0x86ec2f[_0xf483('0x53')],{'$or':_['map'](_0x86ec2f[_0xf483('0x49')],function(_0x4b1605){var _0x17d3c6={};_0x17d3c6[_0x4b1605]={'$like':'%'+_0x4942aa[_0xf483('0x46')]['filter']+'%'};return _0x17d3c6;})});}_0x86ec2f=_['merge']({},_0x86ec2f,_0x4942aa['options']);return _0x1c9768[_0xf483('0xab')](_0x86ec2f);}})['then'](function(_0x49a0f2){if(_0x49a0f2){_0x40421b=_0x49a0f2[_0xf483('0x4b')];if(!_0x4942aa[_0xf483('0x46')][_0xf483('0x68')]('nolimit')){_0x86ec2f[_0xf483('0x2e')]=qs[_0xf483('0x2e')](_0x4942aa[_0xf483('0x46')]['limit']);_0x86ec2f['offset']=qs[_0xf483('0x30')](_0x4942aa[_0xf483('0x46')]['offset']);}return _0x1c9768[_0xf483('0xab')](_0x86ec2f);}})[_0xf483('0x21')](function(_0x4fe717){if(_0x4fe717){return _0x4fe717?{'count':_0x40421b,'rows':_0x4fe717}:null;}})['then'](respondWithResult(_0x522691,null))[_0xf483('0x29')](handleError(_0x522691,null));};exports[_0xf483('0xac')]=function(_0x365c76,_0x46052d,_0x7433e3){var _0x263b8a={'raw':![],'where':{}};var _0x25f6d0={};var _0xf5c069={'count':0x0,'rows':[]};return db[_0xf483('0x3e')][_0xf483('0x67')]({'where':{'id':_0x365c76[_0xf483('0x57')]['id']}})[_0xf483('0x21')](handleEntityNotFound(_0x46052d,null))[_0xf483('0x21')](function(_0x420eac){if(_0x420eac){_0x25f6d0[_0xf483('0x43')]=_['keys'](db[_0xf483('0x90')]['rawAttributes']);_0x25f6d0[_0xf483('0x46')]=_[_0xf483('0x45')](_0x365c76[_0xf483('0x46')]);_0x25f6d0[_0xf483('0x47')]=_[_0xf483('0x48')](_0x25f6d0['model'],_0x25f6d0[_0xf483('0x46')]);_0x263b8a[_0xf483('0x49')]=_['intersection'](_0x25f6d0[_0xf483('0x43')],qs[_0xf483('0x4a')](_0x365c76['query']['fields']));_0x263b8a[_0xf483('0x49')]=_0x263b8a['attributes'][_0xf483('0x4b')]?_0x263b8a[_0xf483('0x49')]:_0x25f6d0[_0xf483('0x43')];if(!_0x365c76['query'][_0xf483('0x68')](_0xf483('0x4c'))){_0x263b8a[_0xf483('0x2e')]=qs[_0xf483('0x2e')](_0x365c76['query'][_0xf483('0x2e')]);_0x263b8a[_0xf483('0x30')]=qs['offset'](_0x365c76[_0xf483('0x46')][_0xf483('0x30')]);}_0x263b8a[_0xf483('0x4d')]=qs[_0xf483('0x4e')](_0x365c76[_0xf483('0x46')]['sort']);_0x263b8a['where']=qs['filters'](_[_0xf483('0x4f')](_0x365c76['query'],_0x25f6d0[_0xf483('0x47')]));_0x263b8a['where']['OpenchannelAccountId']=_0x420eac['id'];if(_0x365c76[_0xf483('0x46')]['filter']){_0x263b8a[_0xf483('0x53')]=_[_0xf483('0x59')](_0x263b8a[_0xf483('0x53')],{'$or':_[_0xf483('0x44')](_0x263b8a[_0xf483('0x49')],function(_0x374d32){var _0x17186e={};_0x17186e[_0x374d32]={'$like':'%'+_0x365c76[_0xf483('0x46')][_0xf483('0x50')]+'%'};return _0x17186e;})});}_0x263b8a=_[_0xf483('0x59')]({},_0x263b8a,_0x365c76[_0xf483('0x52')]);return db[_0xf483('0x90')][_0xf483('0x2f')]({'where':_0x263b8a['where']})[_0xf483('0x21')](function(_0x3410d7){_0xf5c069[_0xf483('0x2f')]=_0x3410d7;if(_0x365c76['query'][_0xf483('0x54')]){_0x263b8a[_0xf483('0x58')]=[{'model':db[_0xf483('0x70')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xf483('0xad'),'attributes':[_0xf483('0x39'),_0xf483('0xae'),_0xf483('0xaf')],'required':![]},{'model':db[_0xf483('0xb0')],'as':_0xf483('0xb1'),'attributes':['id',_0xf483('0x39'),'color'],'where':_0x365c76['query'][_0xf483('0xb2')]?{'id':_0x365c76[_0xf483('0x46')]['tag']}:undefined,'required':_0x365c76[_0xf483('0x46')][_0xf483('0xb2')]?!![]:![]}];}return db[_0xf483('0x90')]['findAll'](_0x263b8a);})[_0xf483('0x21')](function(_0x138050){_0xf5c069[_0xf483('0x56')]=_0x138050;return _0xf5c069;});}})[_0xf483('0x21')](respondWithFilteredResult(_0x46052d,_0x263b8a))[_0xf483('0x29')](handleError(_0x46052d,null));};exports[_0xf483('0xb3')]=function(_0x197578,_0x40a5e4,_0x88c5d7){return db[_0xf483('0x3e')][_0xf483('0x5a')]({'where':{'id':_0x197578[_0xf483('0x57')]['id']}})['then'](handleEntityNotFound(_0x40a5e4,null))['then'](function(_0x5bb8bb){if(_0x5bb8bb){return _0x5bb8bb[_0xf483('0xb3')](_0x197578[_0xf483('0x5c')]['ids'],_[_0xf483('0xb4')](_0x197578[_0xf483('0x5c')],['ids','id'])||{})[_0xf483('0xb5')](function(_0x632141){for(var _0x281c3d=0x0;_0x281c3d<_0x197578[_0xf483('0x5c')][_0xf483('0x6a')][_0xf483('0x4b')];_0x281c3d+=0x1){socket[_0xf483('0xb6')](_0xf483('0xb7'),{'UserId':Number(_0x197578[_0xf483('0x5c')][_0xf483('0x6a')][_0x281c3d]),'OpenchannelAccountId':Number(_0x197578[_0xf483('0x57')]['id'])});}return _0x632141;});}})['then'](respondWithResult(_0x40a5e4,null))[_0xf483('0x29')](handleError(_0x40a5e4,null));};exports[_0xf483('0xb8')]=function(_0x352bed,_0x34e661,_0x2ff6f0){return db['OpenchannelAccount']['find']({'where':{'id':_0x352bed[_0xf483('0x57')]['id']}})['then'](handleEntityNotFound(_0x34e661,null))['then'](function(_0x2ea619){if(_0x2ea619){return _0x2ea619[_0xf483('0xb8')](_0x352bed['query']['ids'])[_0xf483('0x21')](function(){if(_[_0xf483('0xb9')](_0x352bed['query'][_0xf483('0x6a')])){for(var _0x4287fd=0x0;_0x4287fd<_0x352bed['query'][_0xf483('0x6a')][_0xf483('0x4b')];_0x4287fd+=0x1){socket[_0xf483('0xb6')]('userOpenchannelAccount:remove',{'UserId':Number(_0x352bed['query'][_0xf483('0x6a')][_0x4287fd]),'OpenchannelAccountId':Number(_0x352bed[_0xf483('0x57')]['id'])});}}else{socket['emit'](_0xf483('0xba'),{'UserId':Number(_0x352bed['query']['ids']),'OpenchannelAccountId':Number(_0x352bed[_0xf483('0x57')]['id'])});}});}})[_0xf483('0x21')](respondWithStatusCode(_0x34e661,null))[_0xf483('0x29')](handleError(_0x34e661,null));};exports['getAgents']=function(_0x22207a,_0xe1bf97,_0x40629e){var _0x5aa00a={};var _0x409b34={};var _0x6d31d2;var _0xfb1d14;return db[_0xf483('0x3e')][_0xf483('0x67')]({'where':{'id':_0x22207a[_0xf483('0x57')]['id']}})[_0xf483('0x21')](handleEntityNotFound(_0xe1bf97,null))[_0xf483('0x21')](function(_0x1d7851){if(_0x1d7851){_0x6d31d2=_0x1d7851;_0x409b34[_0xf483('0x43')]=_[_0xf483('0x45')](db[_0xf483('0x9b')][_0xf483('0x3f')]);_0x409b34[_0xf483('0x46')]=_[_0xf483('0x45')](_0x22207a['query']);_0x409b34[_0xf483('0x47')]=_['intersection'](_0x409b34[_0xf483('0x43')],_0x409b34[_0xf483('0x46')]);_0x5aa00a[_0xf483('0x49')]=_[_0xf483('0x48')](_0x409b34[_0xf483('0x43')],qs[_0xf483('0x4a')](_0x22207a['query']['fields']));_0x5aa00a[_0xf483('0x49')]=_0x5aa00a[_0xf483('0x49')][_0xf483('0x4b')]?_0x5aa00a[_0xf483('0x49')]:_0x409b34['model'];_0x5aa00a['order']=qs[_0xf483('0x4e')](_0x22207a[_0xf483('0x46')][_0xf483('0x4e')]);_0x5aa00a[_0xf483('0x53')]=qs['filters'](_[_0xf483('0x4f')](_0x22207a[_0xf483('0x46')],_0x409b34['filters']));if(_0x22207a[_0xf483('0x46')][_0xf483('0x50')]){_0x5aa00a['where']=_['merge'](_0x5aa00a[_0xf483('0x53')],{'$or':_[_0xf483('0x44')](_0x5aa00a[_0xf483('0x49')],function(_0x3fb89b){var _0x3d86da={};_0x3d86da[_0x3fb89b]={'$like':'%'+_0x22207a[_0xf483('0x46')][_0xf483('0x50')]+'%'};return _0x3d86da;})});}_0x5aa00a=_[_0xf483('0x59')]({},_0x5aa00a,_0x22207a['options']);return _0x6d31d2[_0xf483('0xbb')](_0x5aa00a);}})[_0xf483('0x21')](function(_0x3f65bc){if(_0x3f65bc){_0xfb1d14=_0x3f65bc['length'];if(!_0x22207a[_0xf483('0x46')][_0xf483('0x68')](_0xf483('0x4c'))){_0x5aa00a[_0xf483('0x2e')]=qs[_0xf483('0x2e')](_0x22207a[_0xf483('0x46')][_0xf483('0x2e')]);_0x5aa00a['offset']=qs['offset'](_0x22207a[_0xf483('0x46')]['offset']);}return _0x6d31d2[_0xf483('0xbb')](_0x5aa00a);}})['then'](function(_0x2f0ab6){if(_0x2f0ab6){return _0x2f0ab6?{'count':_0xfb1d14,'rows':_0x2f0ab6}:null;}})['then'](respondWithResult(_0xe1bf97,null))[_0xf483('0x29')](handleError(_0xe1bf97,null));};exports['send']=function(_0x2739b0,_0x3929a2,_0x3b836d){var _0x20a11b,_0x3c9ed6,_0x58e269;if(_['isNil'](_0x2739b0['body'][_0xf483('0x5c')])||_0x2739b0[_0xf483('0x5c')][_0xf483('0x5c')]===''){throw new db[(_0xf483('0x71'))][(_0xf483('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf483('0x79')](_0x2739b0['body']['to'])){}_0x20a11b=_0x2739b0[_0xf483('0x5c')]['to'];return db[_0xf483('0x3e')][_0xf483('0x67')]({'where':{'id':_0x2739b0['params']['id']}})['then'](handleEntityNotFound(_0x3929a2,null))['then'](function(_0xf9f144){if(_0xf9f144){return db['OpenchannelAccount'][_0xf483('0x5a')]({'where':{'id':_0xf9f144['id']},'include':[{'model':db[_0xf483('0x81')],'as':'List','include':[{'model':db[_0xf483('0x70')],'as':_0xf483('0x83'),'where':{[_0xf9f144[_0xf483('0x7e')]]:_0x20a11b},'limit':0x1,'order':[[_0xf483('0x75'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x3929a2,null))[_0xf483('0x21')](function(_0x4aeb82){if(_0x4aeb82&&_0x4aeb82[_0xf483('0x82')]){_0x3c9ed6=_0x4aeb82[_0xf483('0x5e')]({'plain':!![]});if(_0x3c9ed6[_0xf483('0x82')]&&_0x3c9ed6['List'][_0xf483('0x83')][_0xf483('0x4b')]){return _0x3c9ed6['List'][_0xf483('0x83')][0x0];}return db[_0xf483('0x70')]['create'](_['defaults'](_0x2739b0['body'],{'firstName':_0x20a11b,[_0x4aeb82[_0xf483('0x7e')]]:_0x20a11b,'phone':_0x20a11b,'ListId':_0x3c9ed6[_0xf483('0x77')]}));}})[_0xf483('0x21')](handleEntityNotFound(_0x3929a2,null))[_0xf483('0x21')](function(_0x37d356){if(_0x37d356){_0x58e269=_0x37d356;return db[_0xf483('0x90')][_0xf483('0x5a')]({'where':{'ContactId':_0x58e269['id'],'closed':![],'OpenchannelAccountId':_0x3c9ed6['id']}})[_0xf483('0x21')](function(_0xdb86c4){if(_0xdb86c4){return[_0xdb86c4,![]];}return db[_0xf483('0x90')][_0xf483('0x5b')]({'UserId':_0x2739b0['user']['id'],'ContactId':_0x58e269['id'],'OpenchannelAccountId':_0x3c9ed6['id'],'lastMsgDirection':_0xf483('0xbc'),'firstMsgDirection':_0xf483('0xbc'),'Messages':[_[_0xf483('0x59')](_0x2739b0[_0xf483('0x5c')],{'read':![],'body':_0x2739b0[_0xf483('0x5c')][_0xf483('0x5c')],'OpenchannelAccountId':_0x3c9ed6['id'],'UserId':_0x2739b0[_0xf483('0x5d')]['id'],'ContactId':_0x58e269['id']})]},{'include':[{'model':db[_0xf483('0x98')],'as':'Messages'}]})[_0xf483('0x21')](function(_0xec881d){return[_0xec881d,!![]];});});}})[_0xf483('0xb5')](function(_0x2a061c,_0x18480e){if(_0x18480e){return _0x2a061c;}return db['OpenchannelMessage']['create'](_[_0xf483('0x59')](_0x2739b0[_0xf483('0x5c')],{'read':![],'body':_0x2739b0[_0xf483('0x5c')][_0xf483('0x5c')],'OpenchannelAccountId':_0x3c9ed6['id'],'OpenchannelInteractionId':_0x2a061c['id'],'UserId':_0x2739b0[_0xf483('0x5d')]['id'],'ContactId':_0x58e269['id']}))[_0xf483('0x21')](function(_0x284d81){_0x2a061c['dataValues'][_0xf483('0xbd')]=[];_0x2a061c['dataValues'][_0xf483('0xbd')][_0xf483('0xbe')](_0x284d81[_0xf483('0xbf')]);return _0x2a061c;});});}})['then'](respondWithResult(_0x3929a2,null))[_0xf483('0x29')](handleError(_0x3929a2,null));}; \ No newline at end of file +var _0xed20=['omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','code','error','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','save','then','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','OpenchannelAccount','includeAll','include','findAll','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','update','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','notify','openchannel','ValidationError','difference','createdAt','updatedAt','ListId','isNil','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','queueId','OpenchannelQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','User','Owner','fullname','internal','Tag','Tags','color','tag','rows','addAgents'];(function(_0x1ebce7,_0x586af3){var _0x2c032b=function(_0x421d08){while(--_0x421d08){_0x1ebce7['push'](_0x1ebce7['shift']());}};_0x2c032b(++_0x586af3);}(_0xed20,0xce));var _0x0ed2=function(_0x2766c0,_0x3c9535){_0x2766c0=_0x2766c0-0x0;var _0x5e33b8=_0xed20[_0x2766c0];return _0x5e33b8;};'use strict';var emlformat=require(_0x0ed2('0x0'));var rimraf=require(_0x0ed2('0x1'));var zipdir=require(_0x0ed2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ed2('0x3'));var moment=require(_0x0ed2('0x4'));var BPromise=require(_0x0ed2('0x5'));var Mustache=require(_0x0ed2('0x6'));var util=require(_0x0ed2('0x7'));var path=require(_0x0ed2('0x8'));var sox=require('sox');var csv=require(_0x0ed2('0x9'));var ejs=require(_0x0ed2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ed2('0xb'));var squel=require(_0x0ed2('0xc'));var crypto=require(_0x0ed2('0xd'));var jsforce=require(_0x0ed2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0ed2('0x9'));var querystring=require(_0x0ed2('0xf'));var Papa=require(_0x0ed2('0x10'));var Redis=require(_0x0ed2('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0ed2('0x12'));var hardwareService=require(_0x0ed2('0x13'));var logger=require(_0x0ed2('0x14'))(_0x0ed2('0x15'));var utils=require(_0x0ed2('0x16'));var config=require(_0x0ed2('0x17'));var licenseUtil=require(_0x0ed2('0x18'));var db=require(_0x0ed2('0x19'))['db'];config[_0x0ed2('0x1a')]=_[_0x0ed2('0x1b')](config[_0x0ed2('0x1a')],{'host':_0x0ed2('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0ed2('0x1a')]));require(_0x0ed2('0x1d'))[_0x0ed2('0x1e')](socket);var jayson=require(_0x0ed2('0x1f'));var client=jayson[_0x0ed2('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x0ed2('0x20')][_0x0ed2('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x350995,_0x5101f2,_0x41bea7,_0x565cc7){return new BPromise(function(_0x225e4a,_0x12a54d){var _0xc0f621=_0x565cc7||client;return _0xc0f621['request'](_0x350995,_0x41bea7)['then'](function(_0x90b88e){logger[_0x0ed2('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x5101f2,_0x0ed2('0x23'));logger['debug'](_0x0ed2('0x24'),_0x5101f2,_0x0ed2('0x23'),JSON['stringify'](_0x90b88e));if(_0x90b88e['error']){if(_0x90b88e['error'][_0x0ed2('0x25')]===0x1f4){logger[_0x0ed2('0x26')](_0x0ed2('0x27'),_0x5101f2,_0x90b88e[_0x0ed2('0x26')][_0x0ed2('0x28')]);return _0x12a54d(_0x90b88e[_0x0ed2('0x26')][_0x0ed2('0x28')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x5101f2,_0x90b88e[_0x0ed2('0x26')][_0x0ed2('0x28')]);return _0x225e4a(_0x90b88e[_0x0ed2('0x26')][_0x0ed2('0x28')]);}else{logger[_0x0ed2('0x22')](_0x0ed2('0x27'),_0x5101f2,_0x0ed2('0x23'));_0x225e4a(_0x90b88e[_0x0ed2('0x29')]['message']);}})[_0x0ed2('0x2a')](function(_0x24983e){logger[_0x0ed2('0x26')](_0x0ed2('0x27'),_0x5101f2,_0x24983e);_0x12a54d(_0x24983e);});});}function respondWithStatusCode(_0x466b49,_0x5bb903){_0x5bb903=_0x5bb903||0xcc;return function(_0x14c0e6){if(_0x14c0e6){return _0x466b49[_0x0ed2('0x2b')](_0x5bb903);}return _0x466b49[_0x0ed2('0x2c')](_0x5bb903)[_0x0ed2('0x2d')]();};}function respondWithResult(_0x2faa62,_0xe5cacc){_0xe5cacc=_0xe5cacc||0xc8;return function(_0x194380){if(_0x194380){return _0x2faa62[_0x0ed2('0x2c')](_0xe5cacc)[_0x0ed2('0x2e')](_0x194380);}};}function respondWithFilteredResult(_0x1e6efe,_0x597c6e){return function(_0x3bc558){if(_0x3bc558){var _0x5e9d4d=typeof _0x597c6e['offset']===_0x0ed2('0x2f')&&typeof _0x597c6e[_0x0ed2('0x30')]===_0x0ed2('0x2f');var _0x236c7a=_0x3bc558[_0x0ed2('0x31')];var _0xc0c69a=_0x5e9d4d?0x0:_0x597c6e['offset'];var _0x5d8394=_0x5e9d4d?_0x3bc558['count']:_0x597c6e[_0x0ed2('0x32')]+_0x597c6e[_0x0ed2('0x30')];var _0x41543f;if(_0x5d8394>=_0x236c7a){_0x5d8394=_0x236c7a;_0x41543f=0xc8;}else{_0x41543f=0xce;}_0x1e6efe[_0x0ed2('0x2c')](_0x41543f);return _0x1e6efe['set'](_0x0ed2('0x33'),_0xc0c69a+'-'+_0x5d8394+'/'+_0x236c7a)['json'](_0x3bc558);}return null;};}function patchUpdates(_0x43eb53){return function(_0x793700){try{jsonpatch['apply'](_0x793700,_0x43eb53,!![]);}catch(_0x1fdfb2){return BPromise['reject'](_0x1fdfb2);}return _0x793700[_0x0ed2('0x34')]();};}function saveUpdates(_0x541793,_0x1ddff5){return function(_0x3bdf05){if(_0x3bdf05){return _0x3bdf05['update'](_0x541793)[_0x0ed2('0x35')](function(_0x67087a){return _0x67087a;});}return null;};}function removeEntity(_0x4f942a,_0x360205){return function(_0x375dcb){if(_0x375dcb){return _0x375dcb[_0x0ed2('0x36')]()[_0x0ed2('0x35')](function(){var _0x146f13=_0x375dcb[_0x0ed2('0x37')]({'plain':!![]});var _0x3fb9a8=_0x0ed2('0x38');return db[_0x0ed2('0x39')][_0x0ed2('0x36')]({'where':{'type':_0x3fb9a8,'resourceId':_0x146f13['id']}})[_0x0ed2('0x35')](function(){return _0x375dcb;});})[_0x0ed2('0x35')](function(){_0x4f942a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11bb54,_0x5b022a){return function(_0x39c8f3){if(!_0x39c8f3){_0x11bb54[_0x0ed2('0x2b')](0x194);}return _0x39c8f3;};}function handleError(_0x23526d,_0x1a6553){_0x1a6553=_0x1a6553||0x1f4;return function(_0x344661){logger['error'](_0x344661[_0x0ed2('0x3a')]);if(_0x344661[_0x0ed2('0x3b')]){delete _0x344661[_0x0ed2('0x3b')];}_0x23526d[_0x0ed2('0x2c')](_0x1a6553)[_0x0ed2('0x3c')](_0x344661);};}exports[_0x0ed2('0x3d')]=function(_0x33f001,_0x5b9c67){var _0x53c4eb={'include':[{'model':db[_0x0ed2('0x3e')],'as':_0x0ed2('0x3f')}]},_0x582bf4={},_0x2b7099={'count':0x0,'rows':[]};var _0x5606d7=_[_0x0ed2('0x40')](db['OpenchannelAccount'][_0x0ed2('0x41')],function(_0x3aaba6){return{'name':_0x3aaba6[_0x0ed2('0x42')],'type':_0x3aaba6[_0x0ed2('0x43')][_0x0ed2('0x44')]};});_0x582bf4[_0x0ed2('0x45')]=_[_0x0ed2('0x40')](_0x5606d7,'name');_0x582bf4['query']=_[_0x0ed2('0x46')](_0x33f001['query']);_0x582bf4[_0x0ed2('0x47')]=_[_0x0ed2('0x48')](_0x582bf4['model'],_0x582bf4[_0x0ed2('0x49')]);_0x53c4eb[_0x0ed2('0x4a')]=_['intersection'](_0x582bf4[_0x0ed2('0x45')],qs[_0x0ed2('0x4b')](_0x33f001['query'][_0x0ed2('0x4b')]));_0x53c4eb['attributes']=_0x53c4eb[_0x0ed2('0x4a')][_0x0ed2('0x4c')]?_0x53c4eb[_0x0ed2('0x4a')]:_0x582bf4['model'];if(!_0x33f001['query'][_0x0ed2('0x4d')](_0x0ed2('0x4e'))){_0x53c4eb[_0x0ed2('0x30')]=qs[_0x0ed2('0x30')](_0x33f001['query']['limit']);_0x53c4eb[_0x0ed2('0x32')]=qs['offset'](_0x33f001[_0x0ed2('0x49')][_0x0ed2('0x32')]);}_0x53c4eb[_0x0ed2('0x4f')]=qs[_0x0ed2('0x50')](_0x33f001[_0x0ed2('0x49')]['sort']);_0x53c4eb[_0x0ed2('0x51')]=qs[_0x0ed2('0x47')](_['pick'](_0x33f001[_0x0ed2('0x49')],_0x582bf4['filters']),_0x5606d7);if(_0x33f001['query'][_0x0ed2('0x52')]){_0x53c4eb[_0x0ed2('0x51')]=_[_0x0ed2('0x53')](_0x53c4eb[_0x0ed2('0x51')],{'$or':_[_0x0ed2('0x40')](_0x5606d7,function(_0x56ee63){if(_0x56ee63['type']!==_0x0ed2('0x54')){var _0xa9d87b={};_0xa9d87b[_0x56ee63[_0x0ed2('0x3b')]]={'$like':'%'+_0x33f001[_0x0ed2('0x49')][_0x0ed2('0x52')]+'%'};return _0xa9d87b;}})});}_0x53c4eb=_[_0x0ed2('0x53')]({},_0x53c4eb,_0x33f001[_0x0ed2('0x55')]);var _0x6b3269={'where':_0x53c4eb[_0x0ed2('0x51')]};return db[_0x0ed2('0x56')][_0x0ed2('0x31')](_0x6b3269)[_0x0ed2('0x35')](function(_0x42b808){_0x2b7099[_0x0ed2('0x31')]=_0x42b808;if(_0x33f001[_0x0ed2('0x49')][_0x0ed2('0x57')]){_0x53c4eb[_0x0ed2('0x58')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x0ed2('0x59')](_0x53c4eb);})[_0x0ed2('0x35')](function(_0x204460){_0x2b7099['rows']=_0x204460;return _0x2b7099;})[_0x0ed2('0x35')](respondWithFilteredResult(_0x5b9c67,_0x53c4eb))['catch'](handleError(_0x5b9c67,null));};exports[_0x0ed2('0x5a')]=function(_0x4df275,_0x3114d8){var _0x19ced0={'raw':![],'where':{'id':_0x4df275[_0x0ed2('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1e44c8={};_0x1e44c8[_0x0ed2('0x45')]=_['keys'](db[_0x0ed2('0x56')][_0x0ed2('0x41')]);_0x1e44c8[_0x0ed2('0x49')]=_['keys'](_0x4df275[_0x0ed2('0x49')]);_0x1e44c8['filters']=_[_0x0ed2('0x48')](_0x1e44c8[_0x0ed2('0x45')],_0x1e44c8[_0x0ed2('0x49')]);_0x19ced0[_0x0ed2('0x4a')]=_[_0x0ed2('0x48')](_0x1e44c8[_0x0ed2('0x45')],qs[_0x0ed2('0x4b')](_0x4df275[_0x0ed2('0x49')]['fields']));_0x19ced0[_0x0ed2('0x4a')]=_0x19ced0[_0x0ed2('0x4a')][_0x0ed2('0x4c')]?_0x19ced0[_0x0ed2('0x4a')]:_0x1e44c8[_0x0ed2('0x45')];if(_0x4df275[_0x0ed2('0x49')][_0x0ed2('0x57')]){_0x19ced0[_0x0ed2('0x58')]=[{'all':!![]}];}_0x19ced0=_[_0x0ed2('0x53')]({},_0x19ced0,_0x4df275[_0x0ed2('0x55')]);return db['OpenchannelAccount'][_0x0ed2('0x5c')](_0x19ced0)[_0x0ed2('0x35')](handleEntityNotFound(_0x3114d8,null))[_0x0ed2('0x35')](respondWithResult(_0x3114d8,null))[_0x0ed2('0x2a')](handleError(_0x3114d8,null));};exports[_0x0ed2('0x5d')]=function(_0x20f990,_0x3489cf){return db[_0x0ed2('0x56')][_0x0ed2('0x5d')](_0x20f990[_0x0ed2('0x5e')],{})[_0x0ed2('0x35')](function(_0x4e8794){var _0x18a0e7=_0x20f990['user']['get']({'plain':!![]});if(!_0x18a0e7)throw new Error(_0x0ed2('0x5f'));if(_0x18a0e7['role']===_0x0ed2('0x60')){var _0x46b804=_0x4e8794['get']({'plain':!![]});var _0x37c599='OpenchannelAccounts';return db[_0x0ed2('0x61')][_0x0ed2('0x5c')]({'where':{'name':_0x37c599,'userProfileId':_0x18a0e7[_0x0ed2('0x62')]},'raw':!![]})[_0x0ed2('0x35')](function(_0x3c1854){if(_0x3c1854&&_0x3c1854[_0x0ed2('0x63')]===0x0){return db['UserProfileResource'][_0x0ed2('0x5d')]({'name':_0x46b804[_0x0ed2('0x3b')],'resourceId':_0x46b804['id'],'type':_0x3c1854['name'],'sectionId':_0x3c1854['id']},{})[_0x0ed2('0x35')](function(){return _0x4e8794;});}else{return _0x4e8794;}})[_0x0ed2('0x2a')](function(_0x21628f){logger[_0x0ed2('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21628f);throw _0x21628f;});}return _0x4e8794;})[_0x0ed2('0x35')](respondWithResult(_0x3489cf,0xc9))['catch'](handleError(_0x3489cf,null));};exports[_0x0ed2('0x64')]=function(_0x4b4f0e,_0x2f2ec2){if(_0x4b4f0e[_0x0ed2('0x5e')]['id']){delete _0x4b4f0e['body']['id'];}return db[_0x0ed2('0x56')][_0x0ed2('0x5c')]({'where':{'id':_0x4b4f0e[_0x0ed2('0x5b')]['id']},'include':[{'model':db[_0x0ed2('0x3e')],'as':_0x0ed2('0x3f')}]})[_0x0ed2('0x35')](handleEntityNotFound(_0x2f2ec2,null))[_0x0ed2('0x35')](saveUpdates(_0x4b4f0e[_0x0ed2('0x5e')],null))[_0x0ed2('0x35')](respondWithResult(_0x2f2ec2,null))[_0x0ed2('0x2a')](handleError(_0x2f2ec2,null));};exports[_0x0ed2('0x36')]=function(_0x526a8a,_0x525330){return db['OpenchannelAccount'][_0x0ed2('0x5c')]({'where':{'id':_0x526a8a[_0x0ed2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x525330,null))[_0x0ed2('0x35')](removeEntity(_0x525330,null))[_0x0ed2('0x2a')](handleError(_0x525330,null));};exports[_0x0ed2('0x65')]=function(_0x422dba,_0x1745a6){return db['OpenchannelAccount']['describe']()[_0x0ed2('0x35')](respondWithResult(_0x1745a6,null))[_0x0ed2('0x2a')](handleError(_0x1745a6,null));};exports['addDisposition']=function(_0x154691,_0x4dbfdd,_0x563456){if(_0x154691[_0x0ed2('0x5e')]['id']){delete _0x154691[_0x0ed2('0x5e')]['id'];}return db[_0x0ed2('0x56')]['find']({'where':{'id':_0x154691[_0x0ed2('0x5b')]['id']}})[_0x0ed2('0x35')](handleEntityNotFound(_0x4dbfdd,null))[_0x0ed2('0x35')](function(_0x5526bb){if(_0x5526bb){_0x154691['body'][_0x0ed2('0x66')]=_0x5526bb['id'];return db[_0x0ed2('0x67')][_0x0ed2('0x5d')](_0x154691[_0x0ed2('0x5e')]);}})[_0x0ed2('0x35')](respondWithResult(_0x4dbfdd,null))['catch'](handleError(_0x4dbfdd,null));};exports[_0x0ed2('0x68')]=function(_0x542e9c,_0x4144b9,_0x185f86){var _0x5a18b8={'raw':![],'where':{}};var _0xff65dd={};var _0x1d22b8={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x0ed2('0x69')]({'where':{'id':_0x542e9c[_0x0ed2('0x5b')]['id']}})[_0x0ed2('0x35')](handleEntityNotFound(_0x4144b9,null))[_0x0ed2('0x35')](function(_0x4c166b){if(_0x4c166b){_0xff65dd['model']=_[_0x0ed2('0x46')](db[_0x0ed2('0x67')]['rawAttributes']);_0xff65dd['query']=_['keys'](_0x542e9c['query']);_0xff65dd[_0x0ed2('0x47')]=_[_0x0ed2('0x48')](_0xff65dd[_0x0ed2('0x45')],_0xff65dd[_0x0ed2('0x49')]);_0x5a18b8[_0x0ed2('0x4a')]=_[_0x0ed2('0x48')](_0xff65dd[_0x0ed2('0x45')],qs['fields'](_0x542e9c[_0x0ed2('0x49')]['fields']));_0x5a18b8['attributes']=_0x5a18b8[_0x0ed2('0x4a')][_0x0ed2('0x4c')]?_0x5a18b8['attributes']:_0xff65dd[_0x0ed2('0x45')];if(!_0x542e9c[_0x0ed2('0x49')][_0x0ed2('0x4d')](_0x0ed2('0x4e'))){_0x5a18b8['limit']=qs[_0x0ed2('0x30')](_0x542e9c[_0x0ed2('0x49')][_0x0ed2('0x30')]);_0x5a18b8[_0x0ed2('0x32')]=qs[_0x0ed2('0x32')](_0x542e9c[_0x0ed2('0x49')][_0x0ed2('0x32')]);}_0x5a18b8[_0x0ed2('0x4f')]=qs[_0x0ed2('0x50')](_0x542e9c[_0x0ed2('0x49')][_0x0ed2('0x50')]);_0x5a18b8[_0x0ed2('0x51')]=qs[_0x0ed2('0x47')](_['pick'](_0x542e9c[_0x0ed2('0x49')],_0xff65dd[_0x0ed2('0x47')]));_0x5a18b8[_0x0ed2('0x51')][_0x0ed2('0x66')]=_0x4c166b['id'];if(_0x542e9c['query'][_0x0ed2('0x52')]){_0x5a18b8[_0x0ed2('0x51')]=_[_0x0ed2('0x53')](_0x5a18b8[_0x0ed2('0x51')],{'$or':_[_0x0ed2('0x40')](_0x5a18b8[_0x0ed2('0x4a')],function(_0x5d0d65){var _0x403417={};_0x403417[_0x5d0d65]={'$like':'%'+_0x542e9c['query']['filter']+'%'};return _0x403417;})});}_0x5a18b8=_[_0x0ed2('0x53')]({},_0x5a18b8,_0x542e9c[_0x0ed2('0x55')]);return db[_0x0ed2('0x67')][_0x0ed2('0x31')]({'where':_0x5a18b8[_0x0ed2('0x51')]})[_0x0ed2('0x35')](function(_0x4b9052){_0x1d22b8[_0x0ed2('0x31')]=_0x4b9052;if(_0x542e9c['query']['includeAll']){_0x5a18b8['include']=[{'all':!![]}];}return db['Disposition'][_0x0ed2('0x59')](_0x5a18b8);})[_0x0ed2('0x35')](function(_0x589c01){_0x1d22b8['rows']=_0x589c01;return _0x1d22b8;});}})[_0x0ed2('0x35')](respondWithFilteredResult(_0x4144b9,_0x5a18b8))['catch'](handleError(_0x4144b9,null));};exports[_0x0ed2('0x6a')]=function(_0x1b4eb6,_0x478ffa,_0x2100bc){return db[_0x0ed2('0x56')][_0x0ed2('0x5c')]({'where':{'id':_0x1b4eb6[_0x0ed2('0x5b')]['id']}})[_0x0ed2('0x35')](handleEntityNotFound(_0x478ffa,null))[_0x0ed2('0x35')](function(_0x4cd219){if(_0x4cd219){return _0x4cd219['removeDispositions'](_0x1b4eb6['query'][_0x0ed2('0x6b')]);}})[_0x0ed2('0x35')](respondWithStatusCode(_0x478ffa,null))[_0x0ed2('0x2a')](handleError(_0x478ffa,null));};exports[_0x0ed2('0x6c')]=function(_0x287675,_0x964d49,_0x2e35e5){if(_0x287675[_0x0ed2('0x5e')]['id']){delete _0x287675[_0x0ed2('0x5e')]['id'];}return db['OpenchannelAccount'][_0x0ed2('0x5c')]({'where':{'id':_0x287675[_0x0ed2('0x5b')]['id']}})[_0x0ed2('0x35')](handleEntityNotFound(_0x964d49,null))[_0x0ed2('0x35')](function(_0x34de3c){if(_0x34de3c){_0x287675[_0x0ed2('0x5e')][_0x0ed2('0x66')]=_0x34de3c['id'];return db[_0x0ed2('0x6d')][_0x0ed2('0x5d')](_0x287675['body']);}})[_0x0ed2('0x35')](respondWithResult(_0x964d49,null))[_0x0ed2('0x2a')](handleError(_0x964d49,null));};exports[_0x0ed2('0x6e')]=function(_0x58fbd,_0x3356f8,_0x588e70){var _0x2722d0={'raw':![],'where':{}};var _0x2c7329={};var _0x3dff8e={'count':0x0,'rows':[]};return db[_0x0ed2('0x56')][_0x0ed2('0x69')]({'where':{'id':_0x58fbd[_0x0ed2('0x5b')]['id']}})[_0x0ed2('0x35')](handleEntityNotFound(_0x3356f8,null))[_0x0ed2('0x35')](function(_0x4d4b79){if(_0x4d4b79){_0x2c7329[_0x0ed2('0x45')]=_[_0x0ed2('0x46')](db['CannedAnswer'][_0x0ed2('0x41')]);_0x2c7329[_0x0ed2('0x49')]=_['keys'](_0x58fbd[_0x0ed2('0x49')]);_0x2c7329['filters']=_[_0x0ed2('0x48')](_0x2c7329[_0x0ed2('0x45')],_0x2c7329[_0x0ed2('0x49')]);_0x2722d0[_0x0ed2('0x4a')]=_[_0x0ed2('0x48')](_0x2c7329[_0x0ed2('0x45')],qs[_0x0ed2('0x4b')](_0x58fbd[_0x0ed2('0x49')][_0x0ed2('0x4b')]));_0x2722d0[_0x0ed2('0x4a')]=_0x2722d0['attributes'][_0x0ed2('0x4c')]?_0x2722d0[_0x0ed2('0x4a')]:_0x2c7329[_0x0ed2('0x45')];if(!_0x58fbd[_0x0ed2('0x49')][_0x0ed2('0x4d')](_0x0ed2('0x4e'))){_0x2722d0[_0x0ed2('0x30')]=qs[_0x0ed2('0x30')](_0x58fbd[_0x0ed2('0x49')][_0x0ed2('0x30')]);_0x2722d0[_0x0ed2('0x32')]=qs[_0x0ed2('0x32')](_0x58fbd[_0x0ed2('0x49')][_0x0ed2('0x32')]);}_0x2722d0['order']=qs['sort'](_0x58fbd[_0x0ed2('0x49')][_0x0ed2('0x50')]);_0x2722d0[_0x0ed2('0x51')]=qs[_0x0ed2('0x47')](_[_0x0ed2('0x6f')](_0x58fbd[_0x0ed2('0x49')],_0x2c7329[_0x0ed2('0x47')]));_0x2722d0[_0x0ed2('0x51')][_0x0ed2('0x66')]=_0x4d4b79['id'];if(_0x58fbd['query']['filter']){_0x2722d0[_0x0ed2('0x51')]=_[_0x0ed2('0x53')](_0x2722d0[_0x0ed2('0x51')],{'$or':_[_0x0ed2('0x40')](_0x2722d0[_0x0ed2('0x4a')],function(_0x1154f1){var _0x2eb468={};_0x2eb468[_0x1154f1]={'$like':'%'+_0x58fbd[_0x0ed2('0x49')][_0x0ed2('0x52')]+'%'};return _0x2eb468;})});}_0x2722d0=_['merge']({},_0x2722d0,_0x58fbd['options']);return db[_0x0ed2('0x6d')]['count']({'where':_0x2722d0[_0x0ed2('0x51')]})[_0x0ed2('0x35')](function(_0x52c74c){_0x3dff8e[_0x0ed2('0x31')]=_0x52c74c;if(_0x58fbd['query'][_0x0ed2('0x57')]){_0x2722d0[_0x0ed2('0x58')]=[{'all':!![]}];}return db[_0x0ed2('0x6d')][_0x0ed2('0x59')](_0x2722d0);})[_0x0ed2('0x35')](function(_0x42f521){_0x3dff8e['rows']=_0x42f521;return _0x3dff8e;});}})['then'](respondWithFilteredResult(_0x3356f8,_0x2722d0))[_0x0ed2('0x2a')](handleError(_0x3356f8,null));};exports[_0x0ed2('0x70')]=function(_0x58b79b,_0x331e18,_0x5bd2b3){return db[_0x0ed2('0x56')][_0x0ed2('0x5c')]({'where':{'id':_0x58b79b[_0x0ed2('0x5b')]['id']}})[_0x0ed2('0x35')](handleEntityNotFound(_0x331e18,null))[_0x0ed2('0x35')](function(_0x5174aa){if(_0x5174aa){return _0x5174aa[_0x0ed2('0x70')](_0x58b79b[_0x0ed2('0x49')][_0x0ed2('0x6b')]);}})[_0x0ed2('0x35')](respondWithStatusCode(_0x331e18,null))[_0x0ed2('0x2a')](handleError(_0x331e18,null));};exports[_0x0ed2('0x71')]=function(_0x336eee,_0x3ab046,_0x1bdb15){var _0x432af6={'body':_0x336eee[_0x0ed2('0x5e')],'channel':_0x0ed2('0x72')};var _0x31defb=[];var _0x4c6ee1=[];var _0x2e9dca={};var _0x5ebdd2=![];return db['CmContact'][_0x0ed2('0x65')]()[_0x0ed2('0x35')](function(_0x933ce3){if(!_0x933ce3){throw new db['Sequelize'][(_0x0ed2('0x73'))]('no\x20available\x20attributes');}_0x31defb=_[_0x0ed2('0x74')](_[_0x0ed2('0x46')](_0x933ce3),['createdAt','updatedAt']);_0x4c6ee1=_['difference'](_[_0x0ed2('0x46')](_0x933ce3),[_0x0ed2('0x75'),_0x0ed2('0x76'),'CompanyId',_0x0ed2('0x77')]);if(_0x336eee[_0x0ed2('0x5e')]['id']){delete _0x336eee[_0x0ed2('0x5e')]['id'];}if(_[_0x0ed2('0x78')](_0x336eee[_0x0ed2('0x5e')][_0x0ed2('0x79')])){throw new db['Sequelize'][(_0x0ed2('0x73'))]('from\x20is\x20mandatory');}if(_[_0x0ed2('0x78')](_0x336eee[_0x0ed2('0x5e')][_0x0ed2('0x5e')])||_0x336eee[_0x0ed2('0x5e')]['body']===''){throw new db[(_0x0ed2('0x7a'))][(_0x0ed2('0x73'))](_0x0ed2('0x7b'));}if(_[_0x0ed2('0x78')](_0x336eee['body']['mapKey'])){throw new db[(_0x0ed2('0x7a'))]['ValidationError'](_0x0ed2('0x7c')+_0x4c6ee1);}if(!_['includes'](_0x4c6ee1,_0x336eee['body'][_0x0ed2('0x7d')])){throw new db[(_0x0ed2('0x7a'))][(_0x0ed2('0x73'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4c6ee1);}_0x2e9dca[_0x336eee[_0x0ed2('0x5e')][_0x0ed2('0x7d')]]=_0x336eee['body'][_0x0ed2('0x79')];})[_0x0ed2('0x35')](function(){return db[_0x0ed2('0x56')]['find']({'where':{'id':_0x336eee[_0x0ed2('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0x0ed2('0x7e'),'include':[{'model':db[_0x0ed2('0x7f')],'as':_0x0ed2('0x80'),'where':_0x2e9dca,'limit':0x1,'order':[[_0x0ed2('0x76'),_0x0ed2('0x81')]]}]},{'model':db[_0x0ed2('0x82')],'as':_0x0ed2('0x83')}]});})[_0x0ed2('0x35')](handleEntityNotFound(_0x3ab046,null))[_0x0ed2('0x35')](function(_0xcc77d6){if(_0xcc77d6&&_0xcc77d6['List']){_0x432af6[_0x0ed2('0x84')]=_0xcc77d6;_0x432af6[_0x0ed2('0x85')]=_0xcc77d6['Applications'];_0x432af6[_0x0ed2('0x86')]=_0xcc77d6[_0x0ed2('0x7e')];_0x432af6['applications']=_[_0x0ed2('0x87')](_0x432af6['applications'],[_0x0ed2('0x88')],['asc']);if(_0x432af6[_0x0ed2('0x84')][_0x0ed2('0x83')]){delete _0x432af6[_0x0ed2('0x84')]['Applications'];}if(_0x432af6[_0x0ed2('0x84')]['List']&&_0x432af6[_0x0ed2('0x84')]['List']['Contacts'][_0x0ed2('0x4c')]){return _0x432af6[_0x0ed2('0x84')][_0x0ed2('0x7e')][_0x0ed2('0x80')][0x0];}var _0x476ad0=_[_0x0ed2('0x1b')](_0x336eee[_0x0ed2('0x5e')],{'firstName':_0x336eee[_0x0ed2('0x5e')][_0x0ed2('0x79')],'ListId':_0xcc77d6[_0x0ed2('0x77')]});_0x476ad0[_0x336eee[_0x0ed2('0x5e')]['mapKey']]=_0x336eee[_0x0ed2('0x5e')][_0x0ed2('0x79')];return db['CmContact'][_0x0ed2('0x5d')](_0x476ad0,{'fields':_0x31defb,'raw':!![]});}})[_0x0ed2('0x35')](handleEntityNotFound(_0x3ab046,null))[_0x0ed2('0x35')](function(_0x3f5f11){_0x432af6[_0x0ed2('0x89')]=_0x3f5f11;if(_0x3f5f11){var _0x6c23b={'ContactId':_0x3f5f11['id'],'OpenchannelAccountId':_0x336eee[_0x0ed2('0x5b')]['id'],'from':(_0x3f5f11[_0x0ed2('0x8a')]||'')+'\x20'+(_0x3f5f11['lastName']||'')};var _0xa33d5c={'OpenchannelAccountId':_0x336eee[_0x0ed2('0x5b')]['id'],'closed':![]};if(_0x336eee[_0x0ed2('0x5e')][_0x0ed2('0x8b')]){_0xa33d5c['threadId']=_0x336eee['body'][_0x0ed2('0x8b')];return db[_0x0ed2('0x8c')][_0x0ed2('0x5c')]({'where':_0xa33d5c})[_0x0ed2('0x35')](function(_0x5e1311){if(_0x5e1311){return[_0x5e1311,![]];}_0x6c23b[_0x0ed2('0x8b')]=_0x336eee[_0x0ed2('0x5e')][_0x0ed2('0x8b')];_0x6c23b[_0x0ed2('0x8d')]=_0x336eee['body'][_0x0ed2('0x8d')];return db[_0x0ed2('0x8c')][_0x0ed2('0x5d')](_0x6c23b)[_0x0ed2('0x35')](function(_0x1a9b90){return[_0x1a9b90,!![]];});});}else{_0xa33d5c[_0x0ed2('0x8b')]=null;}_0xa33d5c[_0x0ed2('0x8e')]=_0x3f5f11['id'];return db[_0x0ed2('0x8c')][_0x0ed2('0x5c')]({'where':_0xa33d5c})[_0x0ed2('0x35')](function(_0x20f4cb){if(_0x20f4cb){return[_0x20f4cb,![]];}return db[_0x0ed2('0x8c')]['create'](_0x6c23b)[_0x0ed2('0x35')](function(_0x1b500f){return[_0x1b500f,!![]];});});}})[_0x0ed2('0x8f')](function(_0x988a82,_0x5c197f){if(_0x988a82){_0x5ebdd2=_0x5c197f;if(!_0x5c197f){var _0x3a3271={'from':(_0x432af6[_0x0ed2('0x89')][_0x0ed2('0x8a')]||'')+'\x20'+(_0x432af6['contact'][_0x0ed2('0x90')]||'')};if(_0x336eee[_0x0ed2('0x5e')][_0x0ed2('0x8b')]&&_0x336eee[_0x0ed2('0x5e')][_0x0ed2('0x91')]&&_0x336eee[_0x0ed2('0x5e')][_0x0ed2('0x8b')]!=_0x336eee[_0x0ed2('0x5e')][_0x0ed2('0x91')]){_0x3a3271[_0x0ed2('0x8b')]=_0x336eee[_0x0ed2('0x5e')]['messageId'];}return _0x988a82[_0x0ed2('0x64')](_0x3a3271);}else{return _0x988a82;}}})[_0x0ed2('0x35')](function(_0x3329c3){_0x432af6[_0x0ed2('0x92')]=_0x3329c3[_0x0ed2('0x37')]({'plain':!![]});_0x432af6[_0x0ed2('0x92')][_0x0ed2('0x93')]=_0x5ebdd2;if(_0x432af6[_0x0ed2('0x92')][_0x0ed2('0x93')]){if(_0x432af6[_0x0ed2('0x84')][_0x0ed2('0x94')]){_0x432af6[_0x0ed2('0x85')][_0x0ed2('0x95')]({'id':0x0,'priority':_0x432af6[_0x0ed2('0x85')][_0x0ed2('0x4c')]+0x1,'app':_0x0ed2('0x96'),'appdata':_0x0ed2('0x97'),'interval':_0x0ed2('0x98')});}}return db[_0x0ed2('0x99')]['create']({'body':_0x336eee[_0x0ed2('0x5e')][_0x0ed2('0x5e')],'OpenchannelAccountId':_0x336eee[_0x0ed2('0x5b')]['id'],'OpenchannelInteractionId':_0x3329c3['id'],'direction':'in','ContactId':_0x432af6[_0x0ed2('0x89')]['id'],'AttachmentId':_0x336eee[_0x0ed2('0x5e')][_0x0ed2('0x9a')]});})[_0x0ed2('0x35')](function(_0x4b80c8){_0x432af6[_0x0ed2('0x28')]=_0x4b80c8;if(!_0x432af6[_0x0ed2('0x92')][_0x0ed2('0x9b')])return;return db['User']['find']({'attributes':['id',_0x0ed2('0x3b')],'where':{'id':_0x432af6[_0x0ed2('0x92')][_0x0ed2('0x9b')]}});})[_0x0ed2('0x35')](function(_0x3460d5){if(_0x3460d5){_0x432af6[_0x0ed2('0x85')][_0x0ed2('0x9c')]({'id':0x0,'priority':0x0,'app':_0x0ed2('0x9d'),'appdata':_0x3460d5[_0x0ed2('0x3b')]+','+(_0x432af6[_0x0ed2('0x84')]['waitForTheAssignedAgent']||0xa),'interval':_0x0ed2('0x98')});}if(!_0x432af6[_0x0ed2('0x92')][_0x0ed2('0x9e')])return;return db[_0x0ed2('0x9f')][_0x0ed2('0x5c')]({'attributes':['id',_0x0ed2('0x3b')],'where':{'id':_0x432af6['interaction'][_0x0ed2('0x9e')]}});})['then'](function(_0x479756){if(_0x479756){_0x432af6[_0x0ed2('0x85')][_0x0ed2('0x9c')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x479756[_0x0ed2('0x3b')]+','+(_0x432af6['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x0ed2('0x98')});}return respondWithRpcPromise(_0x0ed2('0xa0'),_0x0ed2('0xa1'),_0x432af6);})[_0x0ed2('0x35')](function(_0x165b64){respondWithRpcPromise(_0x0ed2('0xa2'),_0x0ed2('0xa2'),{'event':_0x0ed2('0x71'),'message':_0x165b64},client9002);return _0x165b64;})[_0x0ed2('0x35')](respondWithResult(_0x3ab046,null))[_0x0ed2('0x2a')](handleError(_0x3ab046,null));};exports[_0x0ed2('0xa3')]=function(_0x53edb2,_0x4a7403){var _0x578e85=_0x53edb2['params']['id'];var _0x251ffb=_0x53edb2[_0x0ed2('0x5e')];var _0x2df54a=0xc8;var _0x4ced79=null;return db[_0x0ed2('0xa4')][_0x0ed2('0xa5')]({'isolationLevel':db[_0x0ed2('0xa4')][_0x0ed2('0xa6')][_0x0ed2('0xa7')][_0x0ed2('0xa8')]},function(_0x14f1b3){return db[_0x0ed2('0x56')][_0x0ed2('0x69')]({'where':{'id':_0x578e85},'transaction':_0x14f1b3})[_0x0ed2('0x35')](function(_0x2e2fa4){if(_0x2e2fa4){return db[_0x0ed2('0x82')][_0x0ed2('0x36')]({'where':{'OpenchannelAccountId':_0x578e85},'transaction':_0x14f1b3})[_0x0ed2('0x35')](function(){var _0x439f4f=_[_0x0ed2('0x40')](_0x251ffb,function(_0x1f20c1){_0x1f20c1[_0x0ed2('0x66')]=_0x578e85;return _0x1f20c1;});return db[_0x0ed2('0x82')][_0x0ed2('0xa9')](_0x439f4f,{'transaction':_0x14f1b3});});}else{_0x2df54a=0x194;_0x4ced79=[];}});})[_0x0ed2('0x35')](function(){if(_0x2df54a!==0x194){return db[_0x0ed2('0x82')][_0x0ed2('0xaa')]({'where':{'OpenchannelAccountId':_0x578e85},'order':'priority'})[_0x0ed2('0x35')](function(_0x218b68){_0x4ced79=_0x218b68;});}})[_0x0ed2('0x2a')](function(_0x2aaad3){_0x2df54a=0x1f4;logger[_0x0ed2('0x26')](_0x2aaad3[_0x0ed2('0x3a')]);if(_0x2aaad3[_0x0ed2('0x3b')]){delete _0x2aaad3[_0x0ed2('0x3b')];}_0x4ced79=_0x2aaad3;})[_0x0ed2('0xab')](function(){if(_0x4ced79===null){_0x4a7403[_0x0ed2('0x2b')](_0x2df54a);}else{if(_0x2df54a===0x1f4){_0x4a7403[_0x0ed2('0x2c')](_0x2df54a)['send'](_0x4ced79);}else{_0x4a7403[_0x0ed2('0x2c')](_0x2df54a)['json'](_0x4ced79);}}});};exports[_0x0ed2('0xac')]=function(_0x2bb51e,_0x14d29d,_0x3375b3){var _0x398401={};var _0x1a300f={};var _0x1a23b2;var _0x5a01cb;return db[_0x0ed2('0x56')]['findOne']({'where':{'id':_0x2bb51e[_0x0ed2('0x5b')]['id']}})[_0x0ed2('0x35')](handleEntityNotFound(_0x14d29d,null))[_0x0ed2('0x35')](function(_0x205fa6){if(_0x205fa6){_0x1a23b2=_0x205fa6;_0x1a300f[_0x0ed2('0x45')]=_[_0x0ed2('0x46')](db[_0x0ed2('0x82')][_0x0ed2('0x41')]);_0x1a300f[_0x0ed2('0x49')]=_[_0x0ed2('0x46')](_0x2bb51e[_0x0ed2('0x49')]);_0x1a300f[_0x0ed2('0x47')]=_[_0x0ed2('0x48')](_0x1a300f['model'],_0x1a300f[_0x0ed2('0x49')]);_0x398401[_0x0ed2('0x4a')]=_[_0x0ed2('0x48')](_0x1a300f[_0x0ed2('0x45')],qs[_0x0ed2('0x4b')](_0x2bb51e[_0x0ed2('0x49')][_0x0ed2('0x4b')]));_0x398401[_0x0ed2('0x4a')]=_0x398401[_0x0ed2('0x4a')][_0x0ed2('0x4c')]?_0x398401['attributes']:_0x1a300f['model'];_0x398401['order']=qs[_0x0ed2('0x50')](_0x2bb51e[_0x0ed2('0x49')][_0x0ed2('0x50')]);_0x398401['where']=qs[_0x0ed2('0x47')](_[_0x0ed2('0x6f')](_0x2bb51e[_0x0ed2('0x49')],_0x1a300f['filters']));if(_0x2bb51e[_0x0ed2('0x49')][_0x0ed2('0x52')]){_0x398401[_0x0ed2('0x51')]=_[_0x0ed2('0x53')](_0x398401[_0x0ed2('0x51')],{'$or':_['map'](_0x398401['attributes'],function(_0x120ee8){var _0x448318={};_0x448318[_0x120ee8]={'$like':'%'+_0x2bb51e[_0x0ed2('0x49')][_0x0ed2('0x52')]+'%'};return _0x448318;})});}_0x398401=_[_0x0ed2('0x53')]({},_0x398401,_0x2bb51e[_0x0ed2('0x55')]);return _0x1a23b2[_0x0ed2('0xac')](_0x398401);}})[_0x0ed2('0x35')](function(_0x327564){if(_0x327564){_0x5a01cb=_0x327564['length'];if(!_0x2bb51e[_0x0ed2('0x49')][_0x0ed2('0x4d')]('nolimit')){_0x398401['limit']=qs[_0x0ed2('0x30')](_0x2bb51e[_0x0ed2('0x49')]['limit']);_0x398401[_0x0ed2('0x32')]=qs['offset'](_0x2bb51e['query'][_0x0ed2('0x32')]);}return _0x1a23b2[_0x0ed2('0xac')](_0x398401);}})[_0x0ed2('0x35')](function(_0x5990aa){if(_0x5990aa){return _0x5990aa?{'count':_0x5a01cb,'rows':_0x5990aa}:null;}})[_0x0ed2('0x35')](respondWithResult(_0x14d29d,null))[_0x0ed2('0x2a')](handleError(_0x14d29d,null));};exports[_0x0ed2('0xad')]=function(_0x33cc56,_0x82e8e9,_0x535d83){var _0x584457={'raw':![],'where':{}};var _0x1f199c={};var _0x404d0b={'count':0x0,'rows':[]};return db[_0x0ed2('0x56')][_0x0ed2('0x69')]({'where':{'id':_0x33cc56[_0x0ed2('0x5b')]['id']}})[_0x0ed2('0x35')](handleEntityNotFound(_0x82e8e9,null))[_0x0ed2('0x35')](function(_0x9eef7){if(_0x9eef7){_0x1f199c[_0x0ed2('0x45')]=_[_0x0ed2('0x46')](db[_0x0ed2('0x8c')][_0x0ed2('0x41')]);_0x1f199c['query']=_['keys'](_0x33cc56[_0x0ed2('0x49')]);_0x1f199c[_0x0ed2('0x47')]=_[_0x0ed2('0x48')](_0x1f199c['model'],_0x1f199c[_0x0ed2('0x49')]);_0x584457[_0x0ed2('0x4a')]=_[_0x0ed2('0x48')](_0x1f199c[_0x0ed2('0x45')],qs[_0x0ed2('0x4b')](_0x33cc56[_0x0ed2('0x49')]['fields']));_0x584457[_0x0ed2('0x4a')]=_0x584457[_0x0ed2('0x4a')][_0x0ed2('0x4c')]?_0x584457[_0x0ed2('0x4a')]:_0x1f199c[_0x0ed2('0x45')];if(!_0x33cc56['query']['hasOwnProperty'](_0x0ed2('0x4e'))){_0x584457['limit']=qs[_0x0ed2('0x30')](_0x33cc56['query'][_0x0ed2('0x30')]);_0x584457[_0x0ed2('0x32')]=qs[_0x0ed2('0x32')](_0x33cc56[_0x0ed2('0x49')][_0x0ed2('0x32')]);}_0x584457[_0x0ed2('0x4f')]=qs[_0x0ed2('0x50')](_0x33cc56[_0x0ed2('0x49')][_0x0ed2('0x50')]);_0x584457[_0x0ed2('0x51')]=qs['filters'](_[_0x0ed2('0x6f')](_0x33cc56[_0x0ed2('0x49')],_0x1f199c['filters']));_0x584457[_0x0ed2('0x51')][_0x0ed2('0x66')]=_0x9eef7['id'];if(_0x33cc56['query']['filter']){_0x584457['where']=_[_0x0ed2('0x53')](_0x584457[_0x0ed2('0x51')],{'$or':_[_0x0ed2('0x40')](_0x584457[_0x0ed2('0x4a')],function(_0x50cb66){var _0x57a1a7={};_0x57a1a7[_0x50cb66]={'$like':'%'+_0x33cc56[_0x0ed2('0x49')][_0x0ed2('0x52')]+'%'};return _0x57a1a7;})});}_0x584457=_[_0x0ed2('0x53')]({},_0x584457,_0x33cc56[_0x0ed2('0x55')]);return db[_0x0ed2('0x8c')][_0x0ed2('0x31')]({'where':_0x584457[_0x0ed2('0x51')]})['then'](function(_0x58f36d){_0x404d0b[_0x0ed2('0x31')]=_0x58f36d;if(_0x33cc56[_0x0ed2('0x49')][_0x0ed2('0x57')]){_0x584457[_0x0ed2('0x58')]=[{'model':db[_0x0ed2('0x7f')],'as':'Contact','required':![]},{'model':db[_0x0ed2('0xae')],'as':_0x0ed2('0xaf'),'attributes':['name',_0x0ed2('0xb0'),_0x0ed2('0xb1')],'required':![]},{'model':db[_0x0ed2('0xb2')],'as':_0x0ed2('0xb3'),'attributes':['id',_0x0ed2('0x3b'),_0x0ed2('0xb4')],'where':_0x33cc56['query']['tag']?{'id':_0x33cc56[_0x0ed2('0x49')][_0x0ed2('0xb5')]}:undefined,'required':_0x33cc56['query'][_0x0ed2('0xb5')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x584457);})[_0x0ed2('0x35')](function(_0x219a54){_0x404d0b[_0x0ed2('0xb6')]=_0x219a54;return _0x404d0b;});}})[_0x0ed2('0x35')](respondWithFilteredResult(_0x82e8e9,_0x584457))[_0x0ed2('0x2a')](handleError(_0x82e8e9,null));};exports[_0x0ed2('0xb7')]=function(_0x12bb08,_0x39c64b,_0x4522d0){return db[_0x0ed2('0x56')]['find']({'where':{'id':_0x12bb08[_0x0ed2('0x5b')]['id']}})[_0x0ed2('0x35')](handleEntityNotFound(_0x39c64b,null))[_0x0ed2('0x35')](function(_0x1a7ec7){if(_0x1a7ec7){return _0x1a7ec7[_0x0ed2('0xb7')](_0x12bb08[_0x0ed2('0x5e')]['ids'],_[_0x0ed2('0xb8')](_0x12bb08['body'],[_0x0ed2('0x6b'),'id'])||{})[_0x0ed2('0x8f')](function(_0x187767){for(var _0x40247d=0x0;_0x40247d<_0x12bb08[_0x0ed2('0x5e')][_0x0ed2('0x6b')][_0x0ed2('0x4c')];_0x40247d+=0x1){socket[_0x0ed2('0xb9')](_0x0ed2('0xba'),{'UserId':Number(_0x12bb08[_0x0ed2('0x5e')][_0x0ed2('0x6b')][_0x40247d]),'OpenchannelAccountId':Number(_0x12bb08['params']['id'])});}return _0x187767;});}})[_0x0ed2('0x35')](respondWithResult(_0x39c64b,null))['catch'](handleError(_0x39c64b,null));};exports[_0x0ed2('0xbb')]=function(_0x58eaf1,_0x530eca,_0x3b512a){return db[_0x0ed2('0x56')][_0x0ed2('0x5c')]({'where':{'id':_0x58eaf1[_0x0ed2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x530eca,null))['then'](function(_0x138a22){if(_0x138a22){return _0x138a22[_0x0ed2('0xbb')](_0x58eaf1['query'][_0x0ed2('0x6b')])[_0x0ed2('0x35')](function(){if(_[_0x0ed2('0xbc')](_0x58eaf1[_0x0ed2('0x49')][_0x0ed2('0x6b')])){for(var _0x3a87a4=0x0;_0x3a87a4<_0x58eaf1[_0x0ed2('0x49')][_0x0ed2('0x6b')][_0x0ed2('0x4c')];_0x3a87a4+=0x1){socket[_0x0ed2('0xb9')](_0x0ed2('0xbd'),{'UserId':Number(_0x58eaf1[_0x0ed2('0x49')][_0x0ed2('0x6b')][_0x3a87a4]),'OpenchannelAccountId':Number(_0x58eaf1['params']['id'])});}}else{socket[_0x0ed2('0xb9')](_0x0ed2('0xbd'),{'UserId':Number(_0x58eaf1[_0x0ed2('0x49')]['ids']),'OpenchannelAccountId':Number(_0x58eaf1[_0x0ed2('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x530eca,null))['catch'](handleError(_0x530eca,null));};exports['getAgents']=function(_0x41ab3b,_0x1a8490,_0x29ca5f){var _0x171f50={};var _0x342316={};var _0x32ca17;var _0x239fbf;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x41ab3b[_0x0ed2('0x5b')]['id']}})[_0x0ed2('0x35')](handleEntityNotFound(_0x1a8490,null))['then'](function(_0x776941){if(_0x776941){_0x32ca17=_0x776941;_0x342316[_0x0ed2('0x45')]=_[_0x0ed2('0x46')](db[_0x0ed2('0xae')]['rawAttributes']);_0x342316[_0x0ed2('0x49')]=_[_0x0ed2('0x46')](_0x41ab3b[_0x0ed2('0x49')]);_0x342316[_0x0ed2('0x47')]=_[_0x0ed2('0x48')](_0x342316[_0x0ed2('0x45')],_0x342316[_0x0ed2('0x49')]);_0x171f50['attributes']=_['intersection'](_0x342316[_0x0ed2('0x45')],qs[_0x0ed2('0x4b')](_0x41ab3b[_0x0ed2('0x49')][_0x0ed2('0x4b')]));_0x171f50[_0x0ed2('0x4a')]=_0x171f50[_0x0ed2('0x4a')][_0x0ed2('0x4c')]?_0x171f50[_0x0ed2('0x4a')]:_0x342316[_0x0ed2('0x45')];_0x171f50['order']=qs['sort'](_0x41ab3b[_0x0ed2('0x49')]['sort']);_0x171f50[_0x0ed2('0x51')]=qs[_0x0ed2('0x47')](_[_0x0ed2('0x6f')](_0x41ab3b[_0x0ed2('0x49')],_0x342316[_0x0ed2('0x47')]));if(_0x41ab3b['query']['filter']){_0x171f50[_0x0ed2('0x51')]=_[_0x0ed2('0x53')](_0x171f50[_0x0ed2('0x51')],{'$or':_['map'](_0x171f50['attributes'],function(_0x4ec0c4){var _0x397c1d={};_0x397c1d[_0x4ec0c4]={'$like':'%'+_0x41ab3b[_0x0ed2('0x49')][_0x0ed2('0x52')]+'%'};return _0x397c1d;})});}_0x171f50=_[_0x0ed2('0x53')]({},_0x171f50,_0x41ab3b[_0x0ed2('0x55')]);return _0x32ca17[_0x0ed2('0xbe')](_0x171f50);}})[_0x0ed2('0x35')](function(_0x4da816){if(_0x4da816){_0x239fbf=_0x4da816[_0x0ed2('0x4c')];if(!_0x41ab3b[_0x0ed2('0x49')]['hasOwnProperty'](_0x0ed2('0x4e'))){_0x171f50[_0x0ed2('0x30')]=qs[_0x0ed2('0x30')](_0x41ab3b[_0x0ed2('0x49')][_0x0ed2('0x30')]);_0x171f50[_0x0ed2('0x32')]=qs[_0x0ed2('0x32')](_0x41ab3b[_0x0ed2('0x49')][_0x0ed2('0x32')]);}return _0x32ca17[_0x0ed2('0xbe')](_0x171f50);}})['then'](function(_0x248e81){if(_0x248e81){return _0x248e81?{'count':_0x239fbf,'rows':_0x248e81}:null;}})[_0x0ed2('0x35')](respondWithResult(_0x1a8490,null))['catch'](handleError(_0x1a8490,null));};exports[_0x0ed2('0x3c')]=function(_0x10bc08,_0x1e4bf0,_0x4a36a8){var _0x3d5795,_0x3c9dbe,_0x13737b;if(_[_0x0ed2('0x78')](_0x10bc08[_0x0ed2('0x5e')][_0x0ed2('0x5e')])||_0x10bc08[_0x0ed2('0x5e')][_0x0ed2('0x5e')]===''){throw new db[(_0x0ed2('0x7a'))][(_0x0ed2('0x73'))](_0x0ed2('0x7b'));}if(_['isNil'](_0x10bc08['body']['to'])){}_0x3d5795=_0x10bc08[_0x0ed2('0x5e')]['to'];return db[_0x0ed2('0x56')][_0x0ed2('0x69')]({'where':{'id':_0x10bc08[_0x0ed2('0x5b')]['id']}})[_0x0ed2('0x35')](handleEntityNotFound(_0x1e4bf0,null))['then'](function(_0x442945){if(_0x442945){return db[_0x0ed2('0x56')]['find']({'where':{'id':_0x442945['id']},'include':[{'model':db[_0x0ed2('0xbf')],'as':'List','include':[{'model':db[_0x0ed2('0x7f')],'as':_0x0ed2('0x80'),'where':{[_0x442945[_0x0ed2('0x7d')]]:_0x3d5795},'limit':0x1,'order':[[_0x0ed2('0x76'),_0x0ed2('0x81')]]}]}]})[_0x0ed2('0x35')](handleEntityNotFound(_0x1e4bf0,null))[_0x0ed2('0x35')](function(_0x2cecfe){if(_0x2cecfe&&_0x2cecfe[_0x0ed2('0x7e')]){_0x3c9dbe=_0x2cecfe[_0x0ed2('0x37')]({'plain':!![]});if(_0x3c9dbe[_0x0ed2('0x7e')]&&_0x3c9dbe[_0x0ed2('0x7e')][_0x0ed2('0x80')][_0x0ed2('0x4c')]){return _0x3c9dbe['List']['Contacts'][0x0];}return db[_0x0ed2('0x7f')]['create'](_['defaults'](_0x10bc08[_0x0ed2('0x5e')],{'firstName':_0x3d5795,[_0x2cecfe[_0x0ed2('0x7d')]]:_0x3d5795,'phone':_0x3d5795,'ListId':_0x3c9dbe[_0x0ed2('0x77')]}));}})[_0x0ed2('0x35')](handleEntityNotFound(_0x1e4bf0,null))[_0x0ed2('0x35')](function(_0x369fda){if(_0x369fda){_0x13737b=_0x369fda;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x13737b['id'],'closed':![],'OpenchannelAccountId':_0x3c9dbe['id']}})['then'](function(_0x3071ed){if(_0x3071ed){return[_0x3071ed,![]];}return db[_0x0ed2('0x8c')][_0x0ed2('0x5d')]({'UserId':_0x10bc08[_0x0ed2('0x60')]['id'],'ContactId':_0x13737b['id'],'OpenchannelAccountId':_0x3c9dbe['id'],'lastMsgDirection':'out','firstMsgDirection':_0x0ed2('0xc0'),'Messages':[_[_0x0ed2('0x53')](_0x10bc08[_0x0ed2('0x5e')],{'read':![],'body':_0x10bc08[_0x0ed2('0x5e')][_0x0ed2('0x5e')],'OpenchannelAccountId':_0x3c9dbe['id'],'UserId':_0x10bc08['user']['id'],'ContactId':_0x13737b['id']})]},{'include':[{'model':db[_0x0ed2('0x99')],'as':_0x0ed2('0xc1')}]})['then'](function(_0x3eabce){return[_0x3eabce,!![]];});});}})[_0x0ed2('0x8f')](function(_0x37912b,_0x37e965){if(_0x37e965){return _0x37912b;}return db[_0x0ed2('0x99')][_0x0ed2('0x5d')](_[_0x0ed2('0x53')](_0x10bc08[_0x0ed2('0x5e')],{'read':![],'body':_0x10bc08[_0x0ed2('0x5e')][_0x0ed2('0x5e')],'OpenchannelAccountId':_0x3c9dbe['id'],'OpenchannelInteractionId':_0x37912b['id'],'UserId':_0x10bc08[_0x0ed2('0x60')]['id'],'ContactId':_0x13737b['id']}))[_0x0ed2('0x35')](function(_0x32bd11){_0x37912b[_0x0ed2('0xc2')][_0x0ed2('0xc1')]=[];_0x37912b['dataValues'][_0x0ed2('0xc1')][_0x0ed2('0x95')](_0x32bd11[_0x0ed2('0xc2')]);return _0x37912b;});});}})[_0x0ed2('0x35')](respondWithResult(_0x1e4bf0,null))[_0x0ed2('0x2a')](handleError(_0x1e4bf0,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 002a59a..d3781ba 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 _0x668b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0x668b,0x140));var _0xb668=function(_0x4ad0f7,_0x1920b0){_0x4ad0f7=_0x4ad0f7-0x0;var _0x30f5c8=_0x668b[_0x4ad0f7];return _0x30f5c8;};'use strict';var EventEmitter=require(_0xb668('0x0'));var OpenchannelAccount=require(_0xb668('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb668('0x2')](0x0);var events={'afterCreate':_0xb668('0x3'),'afterUpdate':'update','afterDestroy':_0xb668('0x4')};function emitEvent(_0x5e2e83){return function(_0x2fab11,_0x4092a6,_0x2960f5){OpenchannelAccountEvents['emit'](_0x5e2e83+':'+_0x2fab11['id'],_0x2fab11);OpenchannelAccountEvents[_0xb668('0x5')](_0x5e2e83,_0x2fab11);_0x2960f5(null);};}for(var e in events){if(events[_0xb668('0x6')](e)){var event=events[e];OpenchannelAccount[_0xb668('0x7')](e,emitEvent(event));}}module[_0xb668('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x878f=['hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x444198,_0x52be8a){var _0x5036c2=function(_0x2efcb3){while(--_0x2efcb3){_0x444198['push'](_0x444198['shift']());}};_0x5036c2(++_0x52be8a);}(_0x878f,0x173));var _0xf878=function(_0x5f4a0f,_0x55471f){_0x5f4a0f=_0x5f4a0f-0x0;var _0x358fd5=_0x878f[_0x5f4a0f];return _0x358fd5;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xf878('0x0'))['db'][_0xf878('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf878('0x2')](0x0);var events={'afterCreate':_0xf878('0x3'),'afterUpdate':_0xf878('0x4'),'afterDestroy':_0xf878('0x5')};function emitEvent(_0x9e6783){return function(_0x45a37b,_0x240b48,_0xcf1927){OpenchannelAccountEvents[_0xf878('0x6')](_0x9e6783+':'+_0x45a37b['id'],_0x45a37b);OpenchannelAccountEvents['emit'](_0x9e6783,_0x45a37b);_0xcf1927(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xf878('0x7')](e,emitEvent(event));}}module[_0xf878('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index d9222fb..d843f75 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(_0xce28b1,_0x557f9b){var _0x33e94d=function(_0x267ed3){while(--_0x267ed3){_0xce28b1['push'](_0xce28b1['shift']());}};_0x33e94d(++_0x557f9b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x162af5,_0x389ba7){var _0xb0563a=function(_0x333ed0){while(--_0x333ed0){_0x162af5['push'](_0x162af5['shift']());}};_0xb0563a(++_0x389ba7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 c404761..ed68698 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 _0x63a5=['debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x7e6fd2,_0x4c1a2c){var _0x380f5e=function(_0x5c808d){while(--_0x5c808d){_0x7e6fd2['push'](_0x7e6fd2['shift']());}};_0x380f5e(++_0x4c1a2c);}(_0x63a5,0x18e));var _0x563a=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x63a5[_0x20a558];return _0x53d3f7;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var moment=require(_0x563a('0x2'));var BPromise=require('bluebird');var rs=require(_0x563a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x563a('0x4'))['db'];var utils=require(_0x563a('0x5'));var logger=require(_0x563a('0x6'))(_0x563a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x563a('0x8')]['http']({'port':0x232a});config[_0x563a('0x9')]=_[_0x563a('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x563a('0xb'))(new Redis(config[_0x563a('0x9')]));require(_0x563a('0xc'))[_0x563a('0xd')](socket);function respondWithRpcPromise(_0x255922,_0xa61ffa,_0xd1b480){return new BPromise(function(_0x381fab,_0x3e97a8){return client[_0x563a('0xe')](_0x255922,_0xd1b480)[_0x563a('0xf')](function(_0x2361dd){logger[_0x563a('0x10')](_0x563a('0x11'),_0xa61ffa,'request\x20sent');logger[_0x563a('0x12')](_0x563a('0x13'),_0xa61ffa,_0x563a('0x14'),JSON[_0x563a('0x15')](_0x2361dd));if(_0x2361dd[_0x563a('0x16')]){if(_0x2361dd[_0x563a('0x16')]['code']===0x1f4){logger[_0x563a('0x16')](_0x563a('0x11'),_0xa61ffa,_0x2361dd[_0x563a('0x16')][_0x563a('0x17')]);return _0x3e97a8(_0x2361dd['error']['message']);}logger[_0x563a('0x16')](_0x563a('0x11'),_0xa61ffa,_0x2361dd['error'][_0x563a('0x17')]);return _0x381fab(_0x2361dd[_0x563a('0x16')][_0x563a('0x17')]);}else{logger[_0x563a('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0xa61ffa,'request\x20sent');_0x381fab(_0x2361dd[_0x563a('0x18')][_0x563a('0x17')]);}})[_0x563a('0x19')](function(_0x526a51){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0xa61ffa,_0x526a51);_0x3e97a8(_0x526a51);});});} \ No newline at end of file +var _0xa74f=['info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','then'];(function(_0x33cd3e,_0x73e3ba){var _0x2d7c11=function(_0x15c002){while(--_0x15c002){_0x33cd3e['push'](_0x33cd3e['shift']());}};_0x2d7c11(++_0x73e3ba);}(_0xa74f,0x9a));var _0xfa74=function(_0x591a90,_0x5525b0){_0x591a90=_0x591a90-0x0;var _0x551587=_0xa74f[_0x591a90];return _0x551587;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa74('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa74('0x1'));var db=require(_0xfa74('0x2'))['db'];var utils=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('rpc');var config=require(_0xfa74('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa74('0x6')]({'port':0x232a});config[_0xfa74('0x7')]=_[_0xfa74('0x8')](config[_0xfa74('0x7')],{'host':_0xfa74('0x9'),'port':0x18eb});var socket=require(_0xfa74('0xa'))(new Redis(config['redis']));require(_0xfa74('0xb'))[_0xfa74('0xc')](socket);function respondWithRpcPromise(_0x355e37,_0x2a405e,_0x4d118c){return new BPromise(function(_0x46117e,_0x4f8891){return client['request'](_0x355e37,_0x4d118c)[_0xfa74('0xd')](function(_0x1d919d){logger[_0xfa74('0xe')](_0xfa74('0xf'),_0x2a405e,'request\x20sent');logger[_0xfa74('0x10')](_0xfa74('0x11'),_0x2a405e,_0xfa74('0x12'),JSON[_0xfa74('0x13')](_0x1d919d));if(_0x1d919d['error']){if(_0x1d919d[_0xfa74('0x14')][_0xfa74('0x15')]===0x1f4){logger[_0xfa74('0x14')](_0xfa74('0xf'),_0x2a405e,_0x1d919d[_0xfa74('0x14')]['message']);return _0x4f8891(_0x1d919d[_0xfa74('0x14')][_0xfa74('0x16')]);}logger[_0xfa74('0x14')](_0xfa74('0xf'),_0x2a405e,_0x1d919d[_0xfa74('0x14')][_0xfa74('0x16')]);return _0x46117e(_0x1d919d[_0xfa74('0x14')]['message']);}else{logger[_0xfa74('0xe')](_0xfa74('0xf'),_0x2a405e,'request\x20sent');_0x46117e(_0x1d919d['result'][_0xfa74('0x16')]);}})[_0xfa74('0x17')](function(_0xb8fe6b){logger['error'](_0xfa74('0xf'),_0x2a405e,_0xb8fe6b);_0x4f8891(_0xb8fe6b);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 09d4e64..d415ef7 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 _0xed8a=['save','remove','update','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x5a2d3f,_0x27b04e){var _0x5c65d8=function(_0x2d1965){while(--_0x2d1965){_0x5a2d3f['push'](_0x5a2d3f['shift']());}};_0x5c65d8(++_0x27b04e);}(_0xed8a,0xc5));var _0xaed8=function(_0x1c15ba,_0x3ab347){_0x1c15ba=_0x1c15ba-0x0;var _0x32c0e8=_0xed8a[_0x1c15ba];return _0x32c0e8;};'use strict';var OpenchannelAccountEvents=require(_0xaed8('0x0'));var events=[_0xaed8('0x1'),_0xaed8('0x2'),_0xaed8('0x3')];function createListener(_0x568d05,_0x395bb7){return function(_0x3888ee){_0x395bb7['emit'](_0x568d05,_0x3888ee);};}function removeListener(_0x35da54,_0x2b330f){return function(){OpenchannelAccountEvents['removeListener'](_0x35da54,_0x2b330f);};}exports['register']=function(_0x347ca1){for(var _0x7e6c5e=0x0,_0x3db036=events[_0xaed8('0x4')];_0x7e6c5e<_0x3db036;_0x7e6c5e++){var _0x291304=events[_0x7e6c5e];var _0x42bc11=createListener(_0xaed8('0x5')+_0x291304,_0x347ca1);OpenchannelAccountEvents['on'](_0x291304,_0x42bc11);}}; \ No newline at end of file +var _0xf109=['remove','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf109,0xce));var _0x9f10=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xf109[_0xaa1b3e];return _0x454d7d;};'use strict';var OpenchannelAccountEvents=require(_0x9f10('0x0'));var events=[_0x9f10('0x1'),_0x9f10('0x2'),'update'];function createListener(_0x5b381d,_0x4cbc7a){return function(_0x3659ce){_0x4cbc7a[_0x9f10('0x3')](_0x5b381d,_0x3659ce);};}function removeListener(_0x74d0ee,_0x26f01c){return function(){OpenchannelAccountEvents[_0x9f10('0x4')](_0x74d0ee,_0x26f01c);};}exports[_0x9f10('0x5')]=function(_0x408fe8){for(var _0xd3137b=0x0,_0x227a29=events[_0x9f10('0x6')];_0xd3137b<_0x227a29;_0xd3137b++){var _0x3fd82f=events[_0xd3137b];var _0x5c8719=createListener(_0x9f10('0x7')+_0x3fd82f,_0x408fe8);OpenchannelAccountEvents['on'](_0x3fd82f,_0x5c8719);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index baf15a6..9df581e 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 _0xdf73=['isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get'];(function(_0x1b3254,_0x310a7f){var _0x388744=function(_0x7d2228){while(--_0x7d2228){_0x1b3254['push'](_0x1b3254['shift']());}};_0x388744(++_0x310a7f);}(_0xdf73,0x1b9));var _0x3df7=function(_0x369242,_0x1cc52b){_0x369242=_0x369242-0x0;var _0x350d25=_0xdf73[_0x369242];return _0x350d25;};'use strict';var multer=require(_0x3df7('0x0'));var util=require('util');var path=require(_0x3df7('0x1'));var timeout=require(_0x3df7('0x2'));var express=require(_0x3df7('0x3'));var router=express[_0x3df7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3df7('0x5'));var config=require(_0x3df7('0x6'));var controller=require(_0x3df7('0x7'));router[_0x3df7('0x8')]('/',auth[_0x3df7('0x9')](),controller['index']);router['get'](_0x3df7('0xa'),auth[_0x3df7('0x9')](),controller[_0x3df7('0xb')]);router[_0x3df7('0xc')]('/',auth[_0x3df7('0x9')](),controller[_0x3df7('0xd')]);router[_0x3df7('0xe')](_0x3df7('0xa'),auth['isAuthenticated'](),controller[_0x3df7('0xf')]);router['delete'](_0x3df7('0xa'),auth[_0x3df7('0x9')](),controller[_0x3df7('0x10')]);module[_0x3df7('0x11')]=router; \ No newline at end of file +var _0x4aa8=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete','exports','path'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x4aa8,0xdc));var _0x84aa=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x4aa8[_0x369151];return _0x4292d5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x84aa('0x0'));var timeout=require(_0x84aa('0x1'));var express=require('express');var router=express[_0x84aa('0x2')]();var fs_extra=require(_0x84aa('0x3'));var auth=require(_0x84aa('0x4'));var interaction=require(_0x84aa('0x5'));var config=require('../../config/environment');var controller=require(_0x84aa('0x6'));router[_0x84aa('0x7')]('/',auth['isAuthenticated'](),controller[_0x84aa('0x8')]);router[_0x84aa('0x7')]('/:id',auth[_0x84aa('0x9')](),controller[_0x84aa('0xa')]);router[_0x84aa('0xb')]('/',auth['isAuthenticated'](),controller[_0x84aa('0xc')]);router['put'](_0x84aa('0xd'),auth[_0x84aa('0x9')](),controller[_0x84aa('0xe')]);router[_0x84aa('0xf')](_0x84aa('0xd'),auth[_0x84aa('0x9')](),controller['destroy']);module[_0x84aa('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 3ff515e..0ce1aae 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 _0xae9c=['STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x1db415,_0x3d973c){var _0x5e1f45=function(_0x2f8871){while(--_0x2f8871){_0x1db415['push'](_0x1db415['shift']());}};_0x5e1f45(++_0x3d973c);}(_0xae9c,0xda));var _0xcae9=function(_0x40a61d,_0x1713a8){_0x40a61d=_0x40a61d-0x0;var _0x76bf96=_0xae9c[_0x40a61d];return _0x76bf96;};'use strict';var Sequelize=require(_0xcae9('0x0'));module[_0xcae9('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xcae9('0x2')],'allowNull':![],'defaultValue':_0xcae9('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xcae9('0x2')]},'interval':{'type':Sequelize[_0xcae9('0x2')],'defaultValue':_0xcae9('0x4')}}; \ No newline at end of file +var _0xa750=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x4e07c6,_0x5d8c10){var _0x37023e=function(_0x339588){while(--_0x339588){_0x4e07c6['push'](_0x4e07c6['shift']());}};_0x37023e(++_0x5d8c10);}(_0xa750,0x135));var _0x0a75=function(_0x1bdb9a,_0x589533){_0x1bdb9a=_0x1bdb9a-0x0;var _0x2d24fc=_0xa750[_0x1bdb9a];return _0x2d24fc;};'use strict';var Sequelize=require(_0x0a75('0x0'));module[_0x0a75('0x1')]={'priority':{'type':Sequelize[_0x0a75('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0a75('0x3')],'allowNull':![],'defaultValue':_0x0a75('0x4')},'appdata':{'type':Sequelize[_0x0a75('0x5')]()},'description':{'type':Sequelize[_0x0a75('0x3')]},'interval':{'type':Sequelize[_0x0a75('0x3')],'defaultValue':_0x0a75('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 9552362..392788a 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 _0xa988=['fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','body','eml-format','rimraf','zip-dir','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes'];(function(_0x340c13,_0x595d66){var _0x5a7d96=function(_0x250118){while(--_0x250118){_0x340c13['push'](_0x340c13['shift']());}};_0x5a7d96(++_0x595d66);}(_0xa988,0x198));var _0x8a98=function(_0x3fdc15,_0x28e3b4){_0x3fdc15=_0x3fdc15-0x0;var _0x2ecab8=_0xa988[_0x3fdc15];return _0x2ecab8;};'use strict';var emlformat=require(_0x8a98('0x0'));var rimraf=require(_0x8a98('0x1'));var zipdir=require(_0x8a98('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8a98('0x3'));var Mustache=require(_0x8a98('0x4'));var util=require(_0x8a98('0x5'));var path=require('path');var sox=require(_0x8a98('0x6'));var csv=require('to-csv');var ejs=require(_0x8a98('0x7'));var fs=require('fs');var fs_extra=require(_0x8a98('0x8'));var _=require(_0x8a98('0x9'));var squel=require(_0x8a98('0xa'));var crypto=require(_0x8a98('0xb'));var jsforce=require(_0x8a98('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8a98('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8a98('0xe'));var authService=require(_0x8a98('0xf'));var qs=require(_0x8a98('0x10'));var as=require(_0x8a98('0x11'));var hardwareService=require(_0x8a98('0x12'));var logger=require(_0x8a98('0x13'))(_0x8a98('0x14'));var utils=require(_0x8a98('0x15'));var config=require(_0x8a98('0x16'));var licenseUtil=require(_0x8a98('0x17'));var db=require(_0x8a98('0x18'))['db'];function respondWithStatusCode(_0x53d067,_0x16003f){_0x16003f=_0x16003f||0xcc;return function(_0x262473){if(_0x262473){return _0x53d067[_0x8a98('0x19')](_0x16003f);}return _0x53d067['status'](_0x16003f)[_0x8a98('0x1a')]();};}function respondWithResult(_0x133352,_0x5ac1d7){_0x5ac1d7=_0x5ac1d7||0xc8;return function(_0x27e520){if(_0x27e520){return _0x133352[_0x8a98('0x1b')](_0x5ac1d7)[_0x8a98('0x1c')](_0x27e520);}};}function respondWithFilteredResult(_0x30a898,_0x2cbf64){return function(_0x4cd1ec){if(_0x4cd1ec){var _0x91691a=typeof _0x2cbf64[_0x8a98('0x1d')]===_0x8a98('0x1e')&&typeof _0x2cbf64[_0x8a98('0x1f')]===_0x8a98('0x1e');var _0x2d3b19=_0x4cd1ec[_0x8a98('0x20')];var _0x2b6db5=_0x91691a?0x0:_0x2cbf64[_0x8a98('0x1d')];var _0x19884f=_0x91691a?_0x4cd1ec['count']:_0x2cbf64[_0x8a98('0x1d')]+_0x2cbf64[_0x8a98('0x1f')];var _0x9d8204;if(_0x19884f>=_0x2d3b19){_0x19884f=_0x2d3b19;_0x9d8204=0xc8;}else{_0x9d8204=0xce;}_0x30a898[_0x8a98('0x1b')](_0x9d8204);return _0x30a898[_0x8a98('0x21')](_0x8a98('0x22'),_0x2b6db5+'-'+_0x19884f+'/'+_0x2d3b19)['json'](_0x4cd1ec);}return null;};}function patchUpdates(_0x2e8959){return function(_0x2bc068){try{jsonpatch[_0x8a98('0x23')](_0x2bc068,_0x2e8959,!![]);}catch(_0x58bc76){return BPromise['reject'](_0x58bc76);}return _0x2bc068[_0x8a98('0x24')]();};}function saveUpdates(_0x3aaacf,_0x5cad81){return function(_0x85c9a2){if(_0x85c9a2){return _0x85c9a2[_0x8a98('0x25')](_0x3aaacf)[_0x8a98('0x26')](function(_0x25e7cb){return _0x25e7cb;});}return null;};}function removeEntity(_0x1bddfd,_0x52e3fc){return function(_0x196656){if(_0x196656){return _0x196656[_0x8a98('0x27')]()[_0x8a98('0x26')](function(){_0x1bddfd[_0x8a98('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47f69e,_0x3519e6){return function(_0x339c1b){if(!_0x339c1b){_0x47f69e[_0x8a98('0x19')](0x194);}return _0x339c1b;};}function handleError(_0x49717f,_0x1efe94){_0x1efe94=_0x1efe94||0x1f4;return function(_0x13ee40){logger[_0x8a98('0x28')](_0x13ee40[_0x8a98('0x29')]);if(_0x13ee40[_0x8a98('0x2a')]){delete _0x13ee40[_0x8a98('0x2a')];}_0x49717f[_0x8a98('0x1b')](_0x1efe94)[_0x8a98('0x2b')](_0x13ee40);};}exports[_0x8a98('0x2c')]=function(_0x5eac85,_0x2340ad){var _0x2dabc1={},_0x4403db={},_0x33b098={'count':0x0,'rows':[]};var _0x29f888=_[_0x8a98('0x2d')](db[_0x8a98('0x2e')][_0x8a98('0x2f')],function(_0x34a583){return{'name':_0x34a583[_0x8a98('0x30')],'type':_0x34a583[_0x8a98('0x31')]['key']};});_0x4403db[_0x8a98('0x32')]=_[_0x8a98('0x2d')](_0x29f888,_0x8a98('0x2a'));_0x4403db[_0x8a98('0x33')]=_[_0x8a98('0x34')](_0x5eac85['query']);_0x4403db[_0x8a98('0x35')]=_[_0x8a98('0x36')](_0x4403db[_0x8a98('0x32')],_0x4403db[_0x8a98('0x33')]);_0x2dabc1[_0x8a98('0x37')]=_[_0x8a98('0x36')](_0x4403db[_0x8a98('0x32')],qs[_0x8a98('0x38')](_0x5eac85[_0x8a98('0x33')][_0x8a98('0x38')]));_0x2dabc1[_0x8a98('0x37')]=_0x2dabc1[_0x8a98('0x37')][_0x8a98('0x39')]?_0x2dabc1[_0x8a98('0x37')]:_0x4403db[_0x8a98('0x32')];if(!_0x5eac85[_0x8a98('0x33')][_0x8a98('0x3a')](_0x8a98('0x3b'))){_0x2dabc1[_0x8a98('0x1f')]=qs[_0x8a98('0x1f')](_0x5eac85[_0x8a98('0x33')]['limit']);_0x2dabc1['offset']=qs[_0x8a98('0x1d')](_0x5eac85[_0x8a98('0x33')]['offset']);}_0x2dabc1['order']=qs[_0x8a98('0x3c')](_0x5eac85[_0x8a98('0x33')]['sort']);_0x2dabc1[_0x8a98('0x3d')]=qs[_0x8a98('0x35')](_[_0x8a98('0x3e')](_0x5eac85[_0x8a98('0x33')],_0x4403db[_0x8a98('0x35')]),_0x29f888);if(_0x5eac85[_0x8a98('0x33')]['filter']){_0x2dabc1[_0x8a98('0x3d')]=_[_0x8a98('0x3f')](_0x2dabc1[_0x8a98('0x3d')],{'$or':_[_0x8a98('0x2d')](_0x29f888,function(_0x415b40){if(_0x415b40['type']!==_0x8a98('0x40')){var _0x5d3166={};_0x5d3166[_0x415b40[_0x8a98('0x2a')]]={'$like':'%'+_0x5eac85[_0x8a98('0x33')][_0x8a98('0x41')]+'%'};return _0x5d3166;}})});}_0x2dabc1=_[_0x8a98('0x3f')]({},_0x2dabc1,_0x5eac85[_0x8a98('0x42')]);var _0x2ab9f3={'where':_0x2dabc1[_0x8a98('0x3d')]};return db['OpenchannelApplication'][_0x8a98('0x20')](_0x2ab9f3)[_0x8a98('0x26')](function(_0xf88bd1){_0x33b098[_0x8a98('0x20')]=_0xf88bd1;if(_0x5eac85[_0x8a98('0x33')][_0x8a98('0x43')]){_0x2dabc1[_0x8a98('0x44')]=[{'all':!![]}];}return db[_0x8a98('0x2e')][_0x8a98('0x45')](_0x2dabc1);})[_0x8a98('0x26')](function(_0x370f86){_0x33b098[_0x8a98('0x46')]=_0x370f86;return _0x33b098;})[_0x8a98('0x26')](respondWithFilteredResult(_0x2340ad,_0x2dabc1))[_0x8a98('0x47')](handleError(_0x2340ad,null));};exports[_0x8a98('0x48')]=function(_0x13ec99,_0x19544a){var _0x363bc9={'raw':!![],'where':{'id':_0x13ec99[_0x8a98('0x49')]['id']}},_0x111756={};_0x111756[_0x8a98('0x32')]=_[_0x8a98('0x34')](db[_0x8a98('0x2e')][_0x8a98('0x2f')]);_0x111756[_0x8a98('0x33')]=_[_0x8a98('0x34')](_0x13ec99[_0x8a98('0x33')]);_0x111756[_0x8a98('0x35')]=_['intersection'](_0x111756[_0x8a98('0x32')],_0x111756[_0x8a98('0x33')]);_0x363bc9['attributes']=_['intersection'](_0x111756['model'],qs[_0x8a98('0x38')](_0x13ec99['query'][_0x8a98('0x38')]));_0x363bc9[_0x8a98('0x37')]=_0x363bc9[_0x8a98('0x37')][_0x8a98('0x39')]?_0x363bc9[_0x8a98('0x37')]:_0x111756[_0x8a98('0x32')];if(_0x13ec99['query'][_0x8a98('0x43')]){_0x363bc9[_0x8a98('0x44')]=[{'all':!![]}];}_0x363bc9=_[_0x8a98('0x3f')]({},_0x363bc9,_0x13ec99[_0x8a98('0x42')]);return db[_0x8a98('0x2e')][_0x8a98('0x4a')](_0x363bc9)[_0x8a98('0x26')](handleEntityNotFound(_0x19544a,null))['then'](respondWithResult(_0x19544a,null))[_0x8a98('0x47')](handleError(_0x19544a,null));};exports['create']=function(_0x32f2a9,_0x4ebd86){return db[_0x8a98('0x2e')]['create'](_0x32f2a9[_0x8a98('0x4b')],{})[_0x8a98('0x26')](respondWithResult(_0x4ebd86,0xc9))['catch'](handleError(_0x4ebd86,null));};exports['update']=function(_0x29f60b,_0x59a89f){if(_0x29f60b['body']['id']){delete _0x29f60b[_0x8a98('0x4b')]['id'];}return db[_0x8a98('0x2e')]['find']({'where':{'id':_0x29f60b['params']['id']}})['then'](handleEntityNotFound(_0x59a89f,null))[_0x8a98('0x26')](saveUpdates(_0x29f60b['body'],null))[_0x8a98('0x26')](respondWithResult(_0x59a89f,null))['catch'](handleError(_0x59a89f,null));};exports[_0x8a98('0x27')]=function(_0x18d0ed,_0x56f25b){return db[_0x8a98('0x2e')][_0x8a98('0x4a')]({'where':{'id':_0x18d0ed['params']['id']}})['then'](handleEntityNotFound(_0x56f25b,null))[_0x8a98('0x26')](removeEntity(_0x56f25b,null))[_0x8a98('0x47')](handleError(_0x56f25b,null));}; \ No newline at end of file +var _0xcbe5=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce'];(function(_0x326bf1,_0x2cd17b){var _0x183ff8=function(_0x4db6b3){while(--_0x4db6b3){_0x326bf1['push'](_0x326bf1['shift']());}};_0x183ff8(++_0x2cd17b);}(_0xcbe5,0x168));var _0x5cbe=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xcbe5[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0x5cbe('0x0'));var rimraf=require(_0x5cbe('0x1'));var zipdir=require(_0x5cbe('0x2'));var jsonpatch=require(_0x5cbe('0x3'));var rp=require(_0x5cbe('0x4'));var moment=require(_0x5cbe('0x5'));var BPromise=require(_0x5cbe('0x6'));var Mustache=require(_0x5cbe('0x7'));var util=require(_0x5cbe('0x8'));var path=require('path');var sox=require(_0x5cbe('0x9'));var csv=require(_0x5cbe('0xa'));var ejs=require(_0x5cbe('0xb'));var fs=require('fs');var fs_extra=require(_0x5cbe('0xc'));var _=require(_0x5cbe('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5cbe('0xe'));var deskjs=require(_0x5cbe('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5cbe('0x10'));var Papa=require('papaparse');var Redis=require(_0x5cbe('0x11'));var authService=require(_0x5cbe('0x12'));var qs=require(_0x5cbe('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5cbe('0x14'))('api');var utils=require(_0x5cbe('0x15'));var config=require(_0x5cbe('0x16'));var licenseUtil=require(_0x5cbe('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41a690,_0x1b6761){_0x1b6761=_0x1b6761||0xcc;return function(_0x1e0dc5){if(_0x1e0dc5){return _0x41a690[_0x5cbe('0x18')](_0x1b6761);}return _0x41a690[_0x5cbe('0x19')](_0x1b6761)[_0x5cbe('0x1a')]();};}function respondWithResult(_0x5c436f,_0x2f28fc){_0x2f28fc=_0x2f28fc||0xc8;return function(_0x257f60){if(_0x257f60){return _0x5c436f[_0x5cbe('0x19')](_0x2f28fc)[_0x5cbe('0x1b')](_0x257f60);}};}function respondWithFilteredResult(_0x8740c8,_0x1f0680){return function(_0x2dcc71){if(_0x2dcc71){var _0x44d7db=typeof _0x1f0680[_0x5cbe('0x1c')]===_0x5cbe('0x1d')&&typeof _0x1f0680[_0x5cbe('0x1e')]==='undefined';var _0x5b5866=_0x2dcc71['count'];var _0x50de88=_0x44d7db?0x0:_0x1f0680[_0x5cbe('0x1c')];var _0x545ade=_0x44d7db?_0x2dcc71[_0x5cbe('0x1f')]:_0x1f0680['offset']+_0x1f0680[_0x5cbe('0x1e')];var _0xf5ad2;if(_0x545ade>=_0x5b5866){_0x545ade=_0x5b5866;_0xf5ad2=0xc8;}else{_0xf5ad2=0xce;}_0x8740c8['status'](_0xf5ad2);return _0x8740c8[_0x5cbe('0x20')](_0x5cbe('0x21'),_0x50de88+'-'+_0x545ade+'/'+_0x5b5866)[_0x5cbe('0x1b')](_0x2dcc71);}return null;};}function patchUpdates(_0x3bf094){return function(_0x1355f5){try{jsonpatch[_0x5cbe('0x22')](_0x1355f5,_0x3bf094,!![]);}catch(_0x2e0f62){return BPromise[_0x5cbe('0x23')](_0x2e0f62);}return _0x1355f5[_0x5cbe('0x24')]();};}function saveUpdates(_0x49ba4d,_0x284c51){return function(_0x1b85fe){if(_0x1b85fe){return _0x1b85fe[_0x5cbe('0x25')](_0x49ba4d)[_0x5cbe('0x26')](function(_0x46ca97){return _0x46ca97;});}return null;};}function removeEntity(_0x45a5e7,_0x36b056){return function(_0x51cd8f){if(_0x51cd8f){return _0x51cd8f['destroy']()[_0x5cbe('0x26')](function(){_0x45a5e7[_0x5cbe('0x19')](0xcc)[_0x5cbe('0x1a')]();});}};}function handleEntityNotFound(_0x32765b,_0x2afaeb){return function(_0x3bf60d){if(!_0x3bf60d){_0x32765b[_0x5cbe('0x18')](0x194);}return _0x3bf60d;};}function handleError(_0x3d1240,_0x2f8269){_0x2f8269=_0x2f8269||0x1f4;return function(_0x3e9aca){logger[_0x5cbe('0x27')](_0x3e9aca['stack']);if(_0x3e9aca[_0x5cbe('0x28')]){delete _0x3e9aca[_0x5cbe('0x28')];}_0x3d1240[_0x5cbe('0x19')](_0x2f8269)[_0x5cbe('0x29')](_0x3e9aca);};}exports[_0x5cbe('0x2a')]=function(_0x2d14e4,_0x2086a5){var _0x33535c={},_0x390161={},_0x1df089={'count':0x0,'rows':[]};var _0x4a6816=_['map'](db[_0x5cbe('0x2b')][_0x5cbe('0x2c')],function(_0x5bed20){return{'name':_0x5bed20[_0x5cbe('0x2d')],'type':_0x5bed20[_0x5cbe('0x2e')][_0x5cbe('0x2f')]};});_0x390161[_0x5cbe('0x30')]=_[_0x5cbe('0x31')](_0x4a6816,'name');_0x390161[_0x5cbe('0x32')]=_[_0x5cbe('0x33')](_0x2d14e4[_0x5cbe('0x32')]);_0x390161['filters']=_[_0x5cbe('0x34')](_0x390161['model'],_0x390161[_0x5cbe('0x32')]);_0x33535c[_0x5cbe('0x35')]=_[_0x5cbe('0x34')](_0x390161[_0x5cbe('0x30')],qs['fields'](_0x2d14e4['query'][_0x5cbe('0x36')]));_0x33535c['attributes']=_0x33535c['attributes']['length']?_0x33535c['attributes']:_0x390161[_0x5cbe('0x30')];if(!_0x2d14e4[_0x5cbe('0x32')]['hasOwnProperty']('nolimit')){_0x33535c['limit']=qs['limit'](_0x2d14e4[_0x5cbe('0x32')]['limit']);_0x33535c[_0x5cbe('0x1c')]=qs['offset'](_0x2d14e4['query'][_0x5cbe('0x1c')]);}_0x33535c[_0x5cbe('0x37')]=qs['sort'](_0x2d14e4[_0x5cbe('0x32')][_0x5cbe('0x38')]);_0x33535c[_0x5cbe('0x39')]=qs['filters'](_[_0x5cbe('0x3a')](_0x2d14e4[_0x5cbe('0x32')],_0x390161[_0x5cbe('0x3b')]),_0x4a6816);if(_0x2d14e4[_0x5cbe('0x32')][_0x5cbe('0x3c')]){_0x33535c[_0x5cbe('0x39')]=_['merge'](_0x33535c[_0x5cbe('0x39')],{'$or':_[_0x5cbe('0x31')](_0x4a6816,function(_0x330ae9){if(_0x330ae9[_0x5cbe('0x2e')]!=='VIRTUAL'){var _0x34fe17={};_0x34fe17[_0x330ae9[_0x5cbe('0x28')]]={'$like':'%'+_0x2d14e4[_0x5cbe('0x32')][_0x5cbe('0x3c')]+'%'};return _0x34fe17;}})});}_0x33535c=_[_0x5cbe('0x3d')]({},_0x33535c,_0x2d14e4[_0x5cbe('0x3e')]);var _0x32bc3d={'where':_0x33535c[_0x5cbe('0x39')]};return db[_0x5cbe('0x2b')]['count'](_0x32bc3d)['then'](function(_0x132ce4){_0x1df089[_0x5cbe('0x1f')]=_0x132ce4;if(_0x2d14e4['query'][_0x5cbe('0x3f')]){_0x33535c[_0x5cbe('0x40')]=[{'all':!![]}];}return db[_0x5cbe('0x2b')][_0x5cbe('0x41')](_0x33535c);})[_0x5cbe('0x26')](function(_0x28a71a){_0x1df089[_0x5cbe('0x42')]=_0x28a71a;return _0x1df089;})[_0x5cbe('0x26')](respondWithFilteredResult(_0x2086a5,_0x33535c))[_0x5cbe('0x43')](handleError(_0x2086a5,null));};exports[_0x5cbe('0x44')]=function(_0x37a9bd,_0x7fc467){var _0x14f3f9={'raw':!![],'where':{'id':_0x37a9bd[_0x5cbe('0x45')]['id']}},_0x3ff218={};_0x3ff218[_0x5cbe('0x30')]=_[_0x5cbe('0x33')](db[_0x5cbe('0x2b')][_0x5cbe('0x2c')]);_0x3ff218[_0x5cbe('0x32')]=_[_0x5cbe('0x33')](_0x37a9bd[_0x5cbe('0x32')]);_0x3ff218[_0x5cbe('0x3b')]=_[_0x5cbe('0x34')](_0x3ff218[_0x5cbe('0x30')],_0x3ff218[_0x5cbe('0x32')]);_0x14f3f9[_0x5cbe('0x35')]=_[_0x5cbe('0x34')](_0x3ff218[_0x5cbe('0x30')],qs[_0x5cbe('0x36')](_0x37a9bd['query']['fields']));_0x14f3f9[_0x5cbe('0x35')]=_0x14f3f9[_0x5cbe('0x35')][_0x5cbe('0x46')]?_0x14f3f9[_0x5cbe('0x35')]:_0x3ff218[_0x5cbe('0x30')];if(_0x37a9bd[_0x5cbe('0x32')][_0x5cbe('0x3f')]){_0x14f3f9['include']=[{'all':!![]}];}_0x14f3f9=_[_0x5cbe('0x3d')]({},_0x14f3f9,_0x37a9bd[_0x5cbe('0x3e')]);return db[_0x5cbe('0x2b')]['find'](_0x14f3f9)[_0x5cbe('0x26')](handleEntityNotFound(_0x7fc467,null))[_0x5cbe('0x26')](respondWithResult(_0x7fc467,null))[_0x5cbe('0x43')](handleError(_0x7fc467,null));};exports[_0x5cbe('0x47')]=function(_0x1e46ed,_0x26733e){return db[_0x5cbe('0x2b')][_0x5cbe('0x47')](_0x1e46ed[_0x5cbe('0x48')],{})[_0x5cbe('0x26')](respondWithResult(_0x26733e,0xc9))[_0x5cbe('0x43')](handleError(_0x26733e,null));};exports[_0x5cbe('0x25')]=function(_0x78be6,_0x28414f){if(_0x78be6[_0x5cbe('0x48')]['id']){delete _0x78be6[_0x5cbe('0x48')]['id'];}return db[_0x5cbe('0x2b')]['find']({'where':{'id':_0x78be6[_0x5cbe('0x45')]['id']}})[_0x5cbe('0x26')](handleEntityNotFound(_0x28414f,null))['then'](saveUpdates(_0x78be6[_0x5cbe('0x48')],null))[_0x5cbe('0x26')](respondWithResult(_0x28414f,null))[_0x5cbe('0x43')](handleError(_0x28414f,null));};exports[_0x5cbe('0x49')]=function(_0x3ccf07,_0x5d02b8){return db[_0x5cbe('0x2b')][_0x5cbe('0x4a')]({'where':{'id':_0x3ccf07[_0x5cbe('0x45')]['id']}})[_0x5cbe('0x26')](handleEntityNotFound(_0x5d02b8,null))[_0x5cbe('0x26')](removeEntity(_0x5d02b8,null))[_0x5cbe('0x43')](handleError(_0x5d02b8,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 8f560a2..a80012a 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 _0x849e=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','lodash','../../config/logger','api','moment'];(function(_0x321df4,_0x3efec5){var _0x50d06c=function(_0x3ac0f4){while(--_0x3ac0f4){_0x321df4['push'](_0x321df4['shift']());}};_0x50d06c(++_0x3efec5);}(_0x849e,0x127));var _0xe849=function(_0x4251fc,_0x45a6be){_0x4251fc=_0x4251fc-0x0;var _0x43f5b0=_0x849e[_0x4251fc];return _0x43f5b0;};'use strict';var _=require(_0xe849('0x0'));var util=require('util');var logger=require(_0xe849('0x1'))(_0xe849('0x2'));var moment=require(_0xe849('0x3'));var BPromise=require(_0xe849('0x4'));var rp=require(_0xe849('0x5'));var fs=require('fs');var path=require(_0xe849('0x6'));var rimraf=require(_0xe849('0x7'));var config=require(_0xe849('0x8'));var attributes=require(_0xe849('0x9'));module[_0xe849('0xa')]=function(_0x42e977,_0x49c318){return _0x42e977[_0xe849('0xb')]('OpenchannelApplication',attributes,{'tableName':_0xe849('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x970c=['lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','utf8mb4'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x970c,0x18c));var _0xc970=function(_0x26ae5f,_0x48bb36){_0x26ae5f=_0x26ae5f-0x0;var _0x105824=_0x970c[_0x26ae5f];return _0x105824;};'use strict';var _=require(_0xc970('0x0'));var util=require(_0xc970('0x1'));var logger=require(_0xc970('0x2'))('api');var moment=require(_0xc970('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc970('0x4'));var rimraf=require(_0xc970('0x5'));var config=require(_0xc970('0x6'));var attributes=require(_0xc970('0x7'));module[_0xc970('0x8')]=function(_0x694d9a,_0x2bd7d3){return _0x694d9a['define'](_0xc970('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc970('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 90be476..777f0ca 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 _0x41a8=['OpenchannelApplication','update','options','raw','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0x129bab,_0x13fc75){var _0x39f8ee=function(_0x14852a){while(--_0x14852a){_0x129bab['push'](_0x129bab['shift']());}};_0x39f8ee(++_0x13fc75);}(_0x41a8,0x1aa));var _0x841a=function(_0x1b2c4e,_0x418ad2){_0x1b2c4e=_0x1b2c4e-0x0;var _0x48bb84=_0x41a8[_0x1b2c4e];return _0x48bb84;};'use strict';var _=require('lodash');var util=require(_0x841a('0x0'));var moment=require(_0x841a('0x1'));var BPromise=require(_0x841a('0x2'));var rs=require(_0x841a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x841a('0x4'))['db'];var utils=require(_0x841a('0x5'));var logger=require('../../config/logger')(_0x841a('0x6'));var config=require(_0x841a('0x7'));var jayson=require(_0x841a('0x8'));var client=jayson[_0x841a('0x9')][_0x841a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fd14a,_0x1cef68,_0x3fb4f8){return new BPromise(function(_0x56af99,_0x1de4ea){return client[_0x841a('0xb')](_0x3fd14a,_0x3fb4f8)[_0x841a('0xc')](function(_0xcc5838){logger[_0x841a('0xd')](_0x841a('0xe'),_0x1cef68,_0x841a('0xf'));logger[_0x841a('0x10')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x1cef68,_0x841a('0xf'),JSON[_0x841a('0x11')](_0xcc5838));if(_0xcc5838[_0x841a('0x12')]){if(_0xcc5838[_0x841a('0x12')][_0x841a('0x13')]===0x1f4){logger[_0x841a('0x12')](_0x841a('0xe'),_0x1cef68,_0xcc5838[_0x841a('0x12')][_0x841a('0x14')]);return _0x1de4ea(_0xcc5838['error'][_0x841a('0x14')]);}logger[_0x841a('0x12')](_0x841a('0xe'),_0x1cef68,_0xcc5838[_0x841a('0x12')]['message']);return _0x56af99(_0xcc5838[_0x841a('0x12')]['message']);}else{logger[_0x841a('0xd')](_0x841a('0xe'),_0x1cef68,_0x841a('0xf'));_0x56af99(_0xcc5838[_0x841a('0x15')][_0x841a('0x14')]);}})[_0x841a('0x16')](function(_0x2d9ad3){logger['error'](_0x841a('0xe'),_0x1cef68,_0x2d9ad3);_0x1de4ea(_0x2d9ad3);});});}exports[_0x841a('0x17')]=function(_0x20018f){var _0x522e59=this;return new Promise(function(_0xfec195,_0x8c144c){return db[_0x841a('0x18')][_0x841a('0x19')](_0x20018f['body'],{'raw':_0x20018f[_0x841a('0x1a')]?_0x20018f['options'][_0x841a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20018f[_0x841a('0x1a')]?_0x20018f[_0x841a('0x1a')]['where']||null:null,'attributes':_0x20018f[_0x841a('0x1a')]?_0x20018f[_0x841a('0x1a')][_0x841a('0x1c')]||null:null,'limit':_0x20018f[_0x841a('0x1a')]?_0x20018f[_0x841a('0x1a')][_0x841a('0x1d')]||null:null})[_0x841a('0xc')](function(_0x11f408){logger[_0x841a('0xd')](_0x841a('0x17'),_0x20018f);logger[_0x841a('0x10')]('UpdateOpenchannelApplication',_0x20018f,JSON[_0x841a('0x11')](_0x11f408));_0xfec195(_0x11f408);})[_0x841a('0x16')](function(_0xe333ce){logger[_0x841a('0x12')]('UpdateOpenchannelApplication',_0xe333ce['message'],_0x20018f);_0x8c144c(_0x522e59[_0x841a('0x12')](0x1f4,_0xe333ce[_0x841a('0x14')]));});});}; \ No newline at end of file +var _0xfb10=['randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','debug','stringify','lodash','util','bluebird'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xfb10,0x1cd));var _0x0fb1=function(_0x2be5cd,_0xd9ea0d){_0x2be5cd=_0x2be5cd-0x0;var _0x48e55b=_0xfb10[_0x2be5cd];return _0x48e55b;};'use strict';var _=require(_0x0fb1('0x0'));var util=require(_0x0fb1('0x1'));var moment=require('moment');var BPromise=require(_0x0fb1('0x2'));var rs=require(_0x0fb1('0x3'));var fs=require('fs');var Redis=require(_0x0fb1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fb1('0x5'));var logger=require('../../config/logger')(_0x0fb1('0x6'));var config=require('../../config/environment');var jayson=require(_0x0fb1('0x7'));var client=jayson[_0x0fb1('0x8')][_0x0fb1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34eddb,_0x5f478a,_0x57b788){return new BPromise(function(_0x807752,_0x32f93f){return client[_0x0fb1('0xa')](_0x34eddb,_0x57b788)[_0x0fb1('0xb')](function(_0x197d2e){logger['info'](_0x0fb1('0xc'),_0x5f478a,_0x0fb1('0xd'));logger['debug'](_0x0fb1('0xe'),_0x5f478a,_0x0fb1('0xd'),JSON['stringify'](_0x197d2e));if(_0x197d2e[_0x0fb1('0xf')]){if(_0x197d2e['error']['code']===0x1f4){logger[_0x0fb1('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x5f478a,_0x197d2e['error'][_0x0fb1('0x10')]);return _0x32f93f(_0x197d2e[_0x0fb1('0xf')][_0x0fb1('0x10')]);}logger[_0x0fb1('0xf')](_0x0fb1('0xc'),_0x5f478a,_0x197d2e[_0x0fb1('0xf')][_0x0fb1('0x10')]);return _0x807752(_0x197d2e[_0x0fb1('0xf')][_0x0fb1('0x10')]);}else{logger[_0x0fb1('0x11')](_0x0fb1('0xc'),_0x5f478a,'request\x20sent');_0x807752(_0x197d2e[_0x0fb1('0x12')][_0x0fb1('0x10')]);}})[_0x0fb1('0x13')](function(_0x442074){logger[_0x0fb1('0xf')](_0x0fb1('0xc'),_0x5f478a,_0x442074);_0x32f93f(_0x442074);});});}exports[_0x0fb1('0x14')]=function(_0x60b62d){var _0x45b96e=this;return new Promise(function(_0x56fb5a,_0x2e8c6d){return db[_0x0fb1('0x15')][_0x0fb1('0x16')](_0x60b62d[_0x0fb1('0x17')],{'raw':_0x60b62d['options']?_0x60b62d[_0x0fb1('0x18')][_0x0fb1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x60b62d['options']?_0x60b62d[_0x0fb1('0x18')][_0x0fb1('0x1a')]||null:null,'attributes':_0x60b62d[_0x0fb1('0x18')]?_0x60b62d[_0x0fb1('0x18')]['attributes']||null:null,'limit':_0x60b62d[_0x0fb1('0x18')]?_0x60b62d['options']['limit']||null:null})[_0x0fb1('0xb')](function(_0x1195ba){logger['info']('UpdateOpenchannelApplication',_0x60b62d);logger[_0x0fb1('0x1b')](_0x0fb1('0x14'),_0x60b62d,JSON[_0x0fb1('0x1c')](_0x1195ba));_0x56fb5a(_0x1195ba);})['catch'](function(_0x55c006){logger[_0x0fb1('0xf')](_0x0fb1('0x14'),_0x55c006[_0x0fb1('0x10')],_0x60b62d);_0x2e8c6d(_0x45b96e[_0x0fb1('0xf')](0x1f4,_0x55c006['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index ab5ec30..b3bbab0 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 _0x7e3d=['post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download'];(function(_0x424dc4,_0x19063a){var _0x44d0b9=function(_0x16a107){while(--_0x16a107){_0x424dc4['push'](_0x424dc4['shift']());}};_0x44d0b9(++_0x19063a);}(_0x7e3d,0x190));var _0xd7e3=function(_0x238002,_0x539794){_0x238002=_0x238002-0x0;var _0x5743cd=_0x7e3d[_0x238002];return _0x5743cd;};'use strict';var multer=require(_0xd7e3('0x0'));var util=require('util');var path=require(_0xd7e3('0x1'));var timeout=require(_0xd7e3('0x2'));var express=require(_0xd7e3('0x3'));var router=express[_0xd7e3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd7e3('0x5'));var interaction=require(_0xd7e3('0x6'));var config=require(_0xd7e3('0x7'));var controller=require(_0xd7e3('0x8'));router[_0xd7e3('0x9')]('/',auth[_0xd7e3('0xa')](),controller[_0xd7e3('0xb')]);router['get'](_0xd7e3('0xc'),auth[_0xd7e3('0xa')](),controller[_0xd7e3('0xd')]);router[_0xd7e3('0x9')](_0xd7e3('0xe'),auth['isAuthenticated'](),controller[_0xd7e3('0xf')]);router[_0xd7e3('0x9')](_0xd7e3('0x10'),auth[_0xd7e3('0xa')](),controller[_0xd7e3('0x11')]);router[_0xd7e3('0x9')](_0xd7e3('0x12'),auth[_0xd7e3('0xa')](),controller[_0xd7e3('0x13')]);router[_0xd7e3('0x14')]('/',auth['isAuthenticated'](),controller[_0xd7e3('0x15')]);router[_0xd7e3('0x14')](_0xd7e3('0x10'),auth[_0xd7e3('0xa')](),controller[_0xd7e3('0x16')]);router[_0xd7e3('0x14')](_0xd7e3('0x17'),auth['isAuthenticated'](),interaction[_0xd7e3('0x18')](_0xd7e3('0x19'),_0xd7e3('0x1a')),controller['addTags']);router[_0xd7e3('0x1b')](_0xd7e3('0xe'),auth[_0xd7e3('0xa')](),interaction[_0xd7e3('0x18')](_0xd7e3('0x19'),_0xd7e3('0x1c')),controller[_0xd7e3('0x1d')]);router[_0xd7e3('0x1e')](_0xd7e3('0xe'),auth[_0xd7e3('0xa')](),interaction['tracked'](_0xd7e3('0x19'),_0xd7e3('0x1f')),controller[_0xd7e3('0x20')]);router[_0xd7e3('0x1e')](_0xd7e3('0x17'),auth[_0xd7e3('0xa')](),controller[_0xd7e3('0x21')]);module[_0xd7e3('0x22')]=router; \ No newline at end of file +var _0x7e14=['isAuthenticated','index','/:id','/:id/download','download','post','create','addMessage','/:id/tags','openchannel','addTags','put','tracked','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','removeTags','multer','connect-timeout','express','Router','../../components/interaction/service','./openchannelInteraction.controller','get'];(function(_0x19589d,_0xf2a350){var _0xd0d884=function(_0x54223b){while(--_0x54223b){_0x19589d['push'](_0x19589d['shift']());}};_0xd0d884(++_0xf2a350);}(_0x7e14,0x76));var _0x47e1=function(_0x298b2a,_0x4a0efb){_0x298b2a=_0x298b2a-0x0;var _0x53363b=_0x7e14[_0x298b2a];return _0x53363b;};'use strict';var multer=require(_0x47e1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x47e1('0x1'));var express=require(_0x47e1('0x2'));var router=express[_0x47e1('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x47e1('0x4'));var config=require('../../config/environment');var controller=require(_0x47e1('0x5'));router[_0x47e1('0x6')]('/',auth[_0x47e1('0x7')](),controller[_0x47e1('0x8')]);router[_0x47e1('0x6')]('/describe',auth[_0x47e1('0x7')](),controller['describe']);router['get'](_0x47e1('0x9'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/messages',auth[_0x47e1('0x7')](),controller['getMessages']);router[_0x47e1('0x6')](_0x47e1('0xa'),auth[_0x47e1('0x7')](),controller[_0x47e1('0xb')]);router[_0x47e1('0xc')]('/',auth[_0x47e1('0x7')](),controller[_0x47e1('0xd')]);router[_0x47e1('0xc')]('/:id/messages',auth[_0x47e1('0x7')](),controller[_0x47e1('0xe')]);router['post'](_0x47e1('0xf'),auth[_0x47e1('0x7')](),interaction['tracked'](_0x47e1('0x10'),'openchannelinteraction:addtags'),controller[_0x47e1('0x11')]);router[_0x47e1('0x12')]('/:id',auth[_0x47e1('0x7')](),interaction[_0x47e1('0x13')]('openchannel',_0x47e1('0x14')),controller['update']);router[_0x47e1('0x15')](_0x47e1('0x9'),auth['isAuthenticated'](),interaction['tracked'](_0x47e1('0x10'),_0x47e1('0x16')),controller[_0x47e1('0x17')]);router[_0x47e1('0x15')](_0x47e1('0xf'),auth['isAuthenticated'](),controller[_0x47e1('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 1baab62..cefdefc 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 _0x3192=['ENUM','out','INTEGER','BOOLEAN','DATE','STRING'];(function(_0x4ea809,_0x5416a6){var _0x31be45=function(_0x347d68){while(--_0x347d68){_0x4ea809['push'](_0x4ea809['shift']());}};_0x31be45(++_0x5416a6);}(_0x3192,0x147));var _0x2319=function(_0xe34486,_0x2c0bd4){_0xe34486=_0xe34486-0x0;var _0x133e1c=_0x3192[_0xe34486];return _0x133e1c;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x2319('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2319('0x1')]},'disposition':{'type':Sequelize[_0x2319('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2319('0x2')]},'read1stAt':{'type':Sequelize[_0x2319('0x1')]},'threadId':{'type':Sequelize[_0x2319('0x2')]},'externalUrl':{'type':Sequelize[_0x2319('0x2')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x2319('0x3')]('in',_0x2319('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x2319('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2319('0x5')]}}; \ No newline at end of file +var _0x7529=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize','exports'];(function(_0xc7b031,_0x2f2935){var _0x60c5c8=function(_0x1a7671){while(--_0x1a7671){_0xc7b031['push'](_0xc7b031['shift']());}};_0x60c5c8(++_0x2f2935);}(_0x7529,0x1c6));var _0x9752=function(_0x41784f,_0x232bf7){_0x41784f=_0x41784f-0x0;var _0x1c79a0=_0x7529[_0x41784f];return _0x1c79a0;};'use strict';var Sequelize=require(_0x9752('0x0'));module[_0x9752('0x1')]={'closed':{'type':Sequelize[_0x9752('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9752('0x3')]},'disposition':{'type':Sequelize[_0x9752('0x4')]},'secondDisposition':{'type':Sequelize[_0x9752('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9752('0x4')]},'read1stAt':{'type':Sequelize[_0x9752('0x3')]},'threadId':{'type':Sequelize[_0x9752('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x9752('0x5')]('in',_0x9752('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x9752('0x5')]('in',_0x9752('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x9752('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x9752('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9752('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index f80fe0f..05c627f 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 _0x4f2f=['find','create','body','describe','OpenchannelMessage','omit','ids','findOne','hasOwnProperty','nolimit','order','sort','where','OpenchannelInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','unix','toString','root','files','tmp','attachments','join','transcript-%d-%s.zip','push','fullname','CmContact','Contact','firstName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','get','Openchannel','Owner','N.A.','closed','closedAt','threadId','Private','basename','pipe','createWriteStream','out','User','System','lastName','value','server','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','sendStatus','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./openchannelInteraction.socket','register','end','status','offset','limit','undefined','count','update','destroy','then','error','stack','name','index','map','type','key','getOptions','findAll','openchannel','query','user','catch','show','from','params','model','keys','OpenchannelInteraction','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options'];(function(_0x478a19,_0x2ff359){var _0x7fd2fa=function(_0x2aeb50){while(--_0x2aeb50){_0x478a19['push'](_0x478a19['shift']());}};_0x7fd2fa(++_0x2ff359);}(_0x4f2f,0x1cb));var _0xf4f2=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x4f2f[_0x424a9a];return _0xa7831c;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xf4f2('0x0'));var util=require(_0xf4f2('0x1'));var path=require('path');var ejs=require(_0xf4f2('0x2'));var fs=require('fs');var _=require(_0xf4f2('0x3'));var Redis=require(_0xf4f2('0x4'));var interaction=require(_0xf4f2('0x5'));var qs=require(_0xf4f2('0x6'));var pdf=require(_0xf4f2('0x7'));var logger=require(_0xf4f2('0x8'))(_0xf4f2('0x9'));var config=require(_0xf4f2('0xa'));var db=require(_0xf4f2('0xb'))['db'];config[_0xf4f2('0xc')]=_['defaults'](config[_0xf4f2('0xc')],{'host':_0xf4f2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf4f2('0xc')]));require(_0xf4f2('0xe'))[_0xf4f2('0xf')](socket);function respondWithStatusCode(_0x1ac39b,_0x50d034){_0x50d034=_0x50d034||0xcc;return function(_0x57413a){if(_0x57413a){return _0x1ac39b['sendStatus'](_0x50d034);}return _0x1ac39b['status'](_0x50d034)[_0xf4f2('0x10')]();};}function respondWithResult(_0x22be18,_0x4da0b7){_0x4da0b7=_0x4da0b7||0xc8;return function(_0x24070f){if(_0x24070f){return _0x22be18[_0xf4f2('0x11')](_0x4da0b7)['json'](_0x24070f);}};}function respondWithFilteredResult(_0x3398c7,_0x551b1c){return function(_0x181f28){if(_0x181f28){var _0x1eec5c=typeof _0x551b1c[_0xf4f2('0x12')]==='undefined'&&typeof _0x551b1c[_0xf4f2('0x13')]===_0xf4f2('0x14');var _0x3ada76=_0x181f28[_0xf4f2('0x15')];var _0x53a476=_0x1eec5c?0x0:_0x551b1c[_0xf4f2('0x12')];var _0x29caef=_0x1eec5c?_0x181f28[_0xf4f2('0x15')]:_0x551b1c[_0xf4f2('0x12')]+_0x551b1c[_0xf4f2('0x13')];var _0x545b43;if(_0x29caef>=_0x3ada76){_0x29caef=_0x3ada76;_0x545b43=0xc8;}else{_0x545b43=0xce;}_0x3398c7[_0xf4f2('0x11')](_0x545b43);return _0x3398c7['set']('Content-Range',_0x53a476+'-'+_0x29caef+'/'+_0x3ada76)['json'](_0x181f28);}return null;};}function saveUpdates(_0x51d50c){return function(_0x496f92){if(_0x496f92){return _0x496f92[_0xf4f2('0x16')](_0x51d50c)['then'](function(_0x35a84e){return _0x35a84e;});}return null;};}function removeEntity(_0xfcc2c2){return function(_0x28d76d){if(_0x28d76d){return _0x28d76d[_0xf4f2('0x17')]()[_0xf4f2('0x18')](function(){_0xfcc2c2['status'](0xcc)[_0xf4f2('0x10')]();});}};}function handleEntityNotFound(_0x28becf){return function(_0x387734){if(!_0x387734){_0x28becf['sendStatus'](0x194);}return _0x387734;};}function handleError(_0x2cdd10,_0x40ce3a){_0x40ce3a=_0x40ce3a||0x1f4;return function(_0x1d822f){logger[_0xf4f2('0x19')](_0x1d822f[_0xf4f2('0x1a')]);if(_0x1d822f['name']){delete _0x1d822f[_0xf4f2('0x1b')];}_0x2cdd10[_0xf4f2('0x11')](_0x40ce3a)['send'](_0x1d822f);};}exports[_0xf4f2('0x1c')]=function(_0x4d36dc,_0x1b77b3){var _0x4aac67={};var _0x31a6c9=_[_0xf4f2('0x1d')](db['OpenchannelInteraction']['rawAttributes'],function(_0x1baf92){return{'name':_0x1baf92['fieldName'],'type':_0x1baf92[_0xf4f2('0x1e')][_0xf4f2('0x1f')]};});_0x4aac67=qs[_0xf4f2('0x20')](_0x31a6c9,_0x4d36dc);return interaction[_0xf4f2('0x21')](_0xf4f2('0x22'),_0x4d36dc[_0xf4f2('0x23')],_0x4d36dc[_0xf4f2('0x24')],_0x4aac67,_0x31a6c9)[_0xf4f2('0x18')](respondWithFilteredResult(_0x1b77b3,_0x4aac67))[_0xf4f2('0x25')](handleError(_0x1b77b3,null));};exports[_0xf4f2('0x26')]=function(_0x5b3dfc,_0x5a2b8b){var _0x174510={};if(_0x5b3dfc[_0xf4f2('0x23')]['type']&&_0x5b3dfc[_0xf4f2('0x23')]['type']===_0xf4f2('0x27')){_0x174510['from']=_0x5b3dfc['params']['id'];}else{_0x174510['id']=_0x5b3dfc[_0xf4f2('0x28')]['id'];}var _0x1c66b2={'raw':![],'where':_0x174510},_0x1decc4={};_0x1decc4[_0xf4f2('0x29')]=_[_0xf4f2('0x2a')](db[_0xf4f2('0x2b')][_0xf4f2('0x2c')]);_0x1decc4[_0xf4f2('0x23')]=_[_0xf4f2('0x2a')](_0x5b3dfc['query']);_0x1decc4[_0xf4f2('0x2d')]=_[_0xf4f2('0x2e')](_0x1decc4[_0xf4f2('0x29')],_0x1decc4['query']);_0x1c66b2[_0xf4f2('0x2f')]=_[_0xf4f2('0x2e')](_0x1decc4[_0xf4f2('0x29')],qs[_0xf4f2('0x30')](_0x5b3dfc['query'][_0xf4f2('0x30')]));_0x1c66b2[_0xf4f2('0x2f')]=_0x1c66b2[_0xf4f2('0x2f')][_0xf4f2('0x31')]?_0x1c66b2[_0xf4f2('0x2f')]:_0x1decc4[_0xf4f2('0x29')];if(_0x5b3dfc[_0xf4f2('0x23')][_0xf4f2('0x32')]){_0x1c66b2['include']=[{'all':!![]}];}_0x1c66b2=_[_0xf4f2('0x33')]({},_0x1c66b2,_0x5b3dfc[_0xf4f2('0x34')]);return db[_0xf4f2('0x2b')][_0xf4f2('0x35')](_0x1c66b2)[_0xf4f2('0x18')](handleEntityNotFound(_0x5a2b8b,null))[_0xf4f2('0x18')](respondWithResult(_0x5a2b8b,null))[_0xf4f2('0x25')](handleError(_0x5a2b8b,null));};exports['create']=function(_0x498e0e,_0x38a410){return db[_0xf4f2('0x2b')][_0xf4f2('0x36')](_0x498e0e[_0xf4f2('0x37')],{})['then'](respondWithResult(_0x38a410,0xc9))[_0xf4f2('0x25')](handleError(_0x38a410,null));};exports[_0xf4f2('0x16')]=function(_0x578845,_0x2b0f81){if(_0x578845[_0xf4f2('0x37')]['id']){delete _0x578845[_0xf4f2('0x37')]['id'];}return db[_0xf4f2('0x2b')][_0xf4f2('0x35')]({'where':{'id':_0x578845[_0xf4f2('0x28')]['id']}})[_0xf4f2('0x18')](handleEntityNotFound(_0x2b0f81,null))[_0xf4f2('0x18')](saveUpdates(_0x578845[_0xf4f2('0x37')],null))['then'](respondWithResult(_0x2b0f81,null))[_0xf4f2('0x25')](handleError(_0x2b0f81,null));};exports[_0xf4f2('0x17')]=function(_0x5ad25b,_0x50cd6a){return db['OpenchannelInteraction']['find']({'where':{'id':_0x5ad25b[_0xf4f2('0x28')]['id']}})[_0xf4f2('0x18')](handleEntityNotFound(_0x50cd6a,null))['then'](removeEntity(_0x50cd6a,null))['catch'](handleError(_0x50cd6a,null));};exports[_0xf4f2('0x38')]=function(_0x25deaa,_0x31ee6d){return db['OpenchannelInteraction'][_0xf4f2('0x38')]()[_0xf4f2('0x18')](respondWithResult(_0x31ee6d,null))[_0xf4f2('0x25')](handleError(_0x31ee6d,null));};exports['addMessage']=function(_0x462577,_0x58a08b){return db[_0xf4f2('0x39')][_0xf4f2('0x35')]({'where':{'id':_0x462577[_0xf4f2('0x28')]['id']}})[_0xf4f2('0x18')](handleEntityNotFound(_0x58a08b,null))[_0xf4f2('0x18')](function(_0x5d44be){if(_0x5d44be){return _0x5d44be['addMessage'](_0x462577[_0xf4f2('0x37')]['ids'],_[_0xf4f2('0x3a')](_0x462577[_0xf4f2('0x37')],[_0xf4f2('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x58a08b,null))['catch'](handleError(_0x58a08b,null));};exports['getMessages']=function(_0x20ec2d,_0xb95acf){var _0x1b9a6f={'raw':![],'where':{}};var _0x467b6f={};var _0x13bddf={'count':0x0,'rows':[]};return db[_0xf4f2('0x2b')][_0xf4f2('0x3c')]({'where':{'id':_0x20ec2d[_0xf4f2('0x28')]['id']}})['then'](handleEntityNotFound(_0xb95acf,null))[_0xf4f2('0x18')](function(_0x159c94){if(_0x159c94){_0x467b6f[_0xf4f2('0x29')]=_[_0xf4f2('0x2a')](db[_0xf4f2('0x39')][_0xf4f2('0x2c')]);_0x467b6f[_0xf4f2('0x23')]=_['keys'](_0x20ec2d['query']);_0x467b6f['filters']=_[_0xf4f2('0x2e')](_0x467b6f[_0xf4f2('0x29')],_0x467b6f[_0xf4f2('0x23')]);_0x1b9a6f[_0xf4f2('0x2f')]=_[_0xf4f2('0x2e')](_0x467b6f['model'],qs[_0xf4f2('0x30')](_0x20ec2d[_0xf4f2('0x23')][_0xf4f2('0x30')]));_0x1b9a6f[_0xf4f2('0x2f')]=_0x1b9a6f[_0xf4f2('0x2f')][_0xf4f2('0x31')]?_0x1b9a6f[_0xf4f2('0x2f')]:_0x467b6f[_0xf4f2('0x29')];if(!_0x20ec2d[_0xf4f2('0x23')][_0xf4f2('0x3d')](_0xf4f2('0x3e'))){_0x1b9a6f[_0xf4f2('0x13')]=qs[_0xf4f2('0x13')](_0x20ec2d['query'][_0xf4f2('0x13')]);_0x1b9a6f[_0xf4f2('0x12')]=qs['offset'](_0x20ec2d[_0xf4f2('0x23')][_0xf4f2('0x12')]);}_0x1b9a6f[_0xf4f2('0x3f')]=qs[_0xf4f2('0x40')](_0x20ec2d[_0xf4f2('0x23')][_0xf4f2('0x40')]);_0x1b9a6f[_0xf4f2('0x41')]=qs[_0xf4f2('0x2d')](_['pick'](_0x20ec2d['query'],_0x467b6f[_0xf4f2('0x2d')]));_0x1b9a6f[_0xf4f2('0x41')][_0xf4f2('0x42')]=_0x159c94['id'];if(_0x20ec2d[_0xf4f2('0x23')][_0xf4f2('0x43')]){_0x1b9a6f[_0xf4f2('0x41')]=_[_0xf4f2('0x33')](_0x1b9a6f[_0xf4f2('0x41')],{'$or':_[_0xf4f2('0x1d')](_0x1b9a6f[_0xf4f2('0x2f')],function(_0x5a62b4){var _0x27ca5d={};_0x27ca5d[_0x5a62b4]={'$like':'%'+_0x20ec2d[_0xf4f2('0x23')][_0xf4f2('0x43')]+'%'};return _0x27ca5d;})});}if(_0x20ec2d[_0xf4f2('0x23')][_0xf4f2('0x44')]){var _0x3571e8=_0x20ec2d['query'][_0xf4f2('0x44')]['split'](',');var _0x361e94={};_0x361e94[_0x3571e8[0x0]]={'$gte':moment(_0x3571e8[0x1])[_0xf4f2('0x45')](_0xf4f2('0x46'))};_0x1b9a6f[_0xf4f2('0x41')]=_['merge'](_0x1b9a6f['where'],_0x361e94);}_0x1b9a6f=_[_0xf4f2('0x33')]({},_0x1b9a6f,_0x20ec2d[_0xf4f2('0x34')]);return db[_0xf4f2('0x39')][_0xf4f2('0x15')]({'where':_0x1b9a6f[_0xf4f2('0x41')]})[_0xf4f2('0x18')](function(_0x1e63e3){_0x13bddf[_0xf4f2('0x15')]=_0x1e63e3;if(_0x20ec2d[_0xf4f2('0x23')][_0xf4f2('0x32')]){_0x1b9a6f[_0xf4f2('0x47')]=[{'all':!![]}];}return db[_0xf4f2('0x39')][_0xf4f2('0x21')](_0x1b9a6f);})['then'](function(_0x4a791b){_0x13bddf[_0xf4f2('0x48')]=_0x4a791b;return _0x13bddf;});}})[_0xf4f2('0x18')](respondWithFilteredResult(_0xb95acf,_0x1b9a6f))['catch'](handleError(_0xb95acf,null));};exports[_0xf4f2('0x49')]=function(_0x5ce35e,_0x1862b6){return db[_0xf4f2('0x2b')]['find']({'where':{'id':_0x5ce35e[_0xf4f2('0x28')]['id']}})['then'](handleEntityNotFound(_0x1862b6,null))[_0xf4f2('0x18')](function(_0x574402){if(_0x574402){return _0x574402[_0xf4f2('0x4a')](_0x5ce35e[_0xf4f2('0x37')][_0xf4f2('0x3b')],_[_0xf4f2('0x3a')](_0x5ce35e[_0xf4f2('0x37')],[_0xf4f2('0x3b'),'id'])||{})[_0xf4f2('0x4b')](function(){return db[_0xf4f2('0x4c')][_0xf4f2('0x21')]({'attributes':['id',_0xf4f2('0x1b'),_0xf4f2('0x4d')],'where':{'id':_0x5ce35e[_0xf4f2('0x37')][_0xf4f2('0x3b')]}});})[_0xf4f2('0x18')](function(_0x7b7363){socket[_0xf4f2('0x4e')](_0xf4f2('0x4f'),{'id':Number(_0x5ce35e['params']['id']),'tags':_0x7b7363||[]});return{'id':Number(_0x5ce35e[_0xf4f2('0x28')]['id']),'tags':_0x7b7363||[]};});}})[_0xf4f2('0x18')](respondWithResult(_0x1862b6,null))[_0xf4f2('0x25')](handleError(_0x1862b6,null));};exports[_0xf4f2('0x50')]=function(_0x38cd3c,_0x150e8c){return db[_0xf4f2('0x2b')]['find']({'where':{'id':_0x38cd3c[_0xf4f2('0x28')]['id']}})['then'](handleEntityNotFound(_0x150e8c,null))[_0xf4f2('0x18')](function(_0x5b3c71){if(_0x5b3c71){return _0x5b3c71['removeTags'](_0x38cd3c[_0xf4f2('0x23')][_0xf4f2('0x3b')]);}})[_0xf4f2('0x18')](respondWithStatusCode(_0x150e8c,null))[_0xf4f2('0x25')](handleError(_0x150e8c,null));};exports['download']=function(_0x4bd6a7,_0x454786){var _0x306f15=moment()[_0xf4f2('0x51')]()[_0xf4f2('0x52')]();var _0x4e7616=path['join'](config[_0xf4f2('0x53')],'server',_0xf4f2('0x54'),_0xf4f2('0x55'));var _0x131cef=path['join'](config[_0xf4f2('0x53')],'server',_0xf4f2('0x54'),_0xf4f2('0x56'));var _0x1f04a0=path[_0xf4f2('0x57')](_0x4e7616,_0x306f15);var _0x4fc8c3=util['format'](_0xf4f2('0x58'),_0x4bd6a7[_0xf4f2('0x28')]['id'],_0x306f15);var _0x12cb32=path[_0xf4f2('0x57')](_0x4e7616,_0x4fc8c3);var _0xb71e0f=[];_0xb71e0f[_0xf4f2('0x59')]({'model':db['User'],'as':'User','attributes':['id',_0xf4f2('0x5a')],'raw':!![]});_0xb71e0f[_0xf4f2('0x59')]({'model':db[_0xf4f2('0x5b')],'as':_0xf4f2('0x5c'),'attributes':['id',_0xf4f2('0x5d'),'lastName'],'raw':!![]});if(_0x4bd6a7['query'][_0xf4f2('0x56')]){_0xb71e0f[_0xf4f2('0x59')]({'model':db[_0xf4f2('0x5e')],'as':'Attachment','raw':!![]});}var _0x22e248=[{'model':db['OpenchannelMessage'],'as':_0xf4f2('0x5f'),'attributes':['id',_0xf4f2('0x37'),_0xf4f2('0x60'),_0xf4f2('0x61'),_0xf4f2('0x62'),_0xf4f2('0x63')],'include':_0xb71e0f}];_0x22e248[_0xf4f2('0x59')]({'model':db[_0xf4f2('0x64')],'as':_0xf4f2('0x65'),'attributes':['id',_0xf4f2('0x1b')]});_0x22e248['push']({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db['OpenchannelInteraction'][_0xf4f2('0x35')]({'where':{'id':_0x4bd6a7['params']['id']},'include':_0x22e248})['then'](handleEntityNotFound(_0x454786,null))['then'](function(_0x1b867d){if(_0x1b867d){var _0x233316=_0x1b867d[_0xf4f2('0x66')]({'plain':!![]});fs['mkdirSync'](_0x1f04a0);var _0xb5b376={'channel':_0xf4f2('0x67'),'account':_0x233316[_0xf4f2('0x65')]['name'],'agent':_0x233316[_0xf4f2('0x68')]?_0x233316[_0xf4f2('0x68')][_0xf4f2('0x5a')]:_0xf4f2('0x69'),'createdAt':moment(_0x233316[_0xf4f2('0x60')])[_0xf4f2('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf4f2('0x52')](),'closedAt':_0x233316[_0xf4f2('0x6a')]?moment(_0x233316[_0xf4f2('0x6b')])[_0xf4f2('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf4f2('0x52')]():'','disposition':_0x233316['disposition'],'visibility':_0x233316[_0xf4f2('0x6c')]?'Public':_0xf4f2('0x6d'),'messages':_(_0x233316[_0xf4f2('0x5f')])[_0xf4f2('0x43')]({'secret':![]})[_0xf4f2('0x1d')](function(_0x5cf73a){if(_0x5cf73a[_0xf4f2('0x5e')]){var _0x305c42=path[_0xf4f2('0x57')](_0x131cef,_0x5cf73a[_0xf4f2('0x5e')][_0xf4f2('0x6e')]);if(fs['existsSync'](_0x305c42)){fs['createReadStream'](_0x305c42)[_0xf4f2('0x6f')](fs[_0xf4f2('0x70')](path[_0xf4f2('0x57')](_0x1f04a0,_0x5cf73a['Attachment'][_0xf4f2('0x6e')])));}}return{'date':moment(_0x5cf73a[_0xf4f2('0x60')])['format'](_0xf4f2('0x46'))[_0xf4f2('0x52')](),'sender':_0x5cf73a[_0xf4f2('0x61')]===_0xf4f2('0x71')?_0x5cf73a[_0xf4f2('0x72')]?_0x5cf73a[_0xf4f2('0x72')]['fullname']:_0xf4f2('0x73'):_0x5cf73a[_0xf4f2('0x5c')][_0xf4f2('0x5d')]+(_0x5cf73a[_0xf4f2('0x5c')][_0xf4f2('0x74')]?'\x20'+_0x5cf73a['Contact'][_0xf4f2('0x74')]:''),'body':_0x5cf73a['Attachment']?_0x5cf73a[_0xf4f2('0x5e')]['basename']:_0x5cf73a[_0xf4f2('0x37')],'direction':_0x5cf73a[_0xf4f2('0x61')]===_0xf4f2('0x71')?'A':'C','secret':_0x5cf73a['secret'],'read':_0x5cf73a[_0xf4f2('0x63')],'attachment':_0x5cf73a[_0xf4f2('0x5e')]};})[_0xf4f2('0x75')]()};return ejs['renderFile'](path[_0xf4f2('0x57')](config[_0xf4f2('0x53')],_0xf4f2('0x76'),_0xf4f2('0x77'),_0xf4f2('0x78')),{'interaction':_0xb5b376})[_0xf4f2('0x18')](function(_0x59571a){var _0x8d5cda=path[_0xf4f2('0x57')](_0x1f04a0,_0xf4f2('0x79')+_0x233316['id']+'-'+_0x306f15+_0xf4f2('0x7a'));var _0x25065c={'path':_0x8d5cda,'channel':_0xf4f2('0x67'),'interactionId':_0x233316['id']};return pdf[_0xf4f2('0x7b')](_0x59571a,_0x25065c);})[_0xf4f2('0x18')](function(){return new Promise(function(_0x2f1d24,_0x2d5db6){zipdir(_0x1f04a0,{'saveTo':_0x12cb32},function(_0x43121a,_0x425cbf){if(_0x43121a)return _0x2d5db6(_0x43121a);return _0x2f1d24(_0x425cbf);});})['then'](function(){return new Promise(function(_0x493e97,_0x521517){rimraf(_0x1f04a0,function(_0x1637c8){if(_0x1637c8)_0x521517(_0x1637c8);return _0x493e97();});});})['then'](function(){return _0x454786[_0xf4f2('0x7c')](_0x12cb32,_0x4fc8c3,function(_0x285796){if(_0x285796){logger[_0xf4f2('0x19')](_0xf4f2('0x7d'),_0x285796);}else{fs[_0xf4f2('0x7e')](_0x12cb32);}});});});}else{return _0x454786[_0xf4f2('0x7f')](0xc8);}})[_0xf4f2('0x25')](handleError(_0x454786,null));}; \ No newline at end of file +var _0x8177=['status','end','offset','undefined','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','query','catch','show','from','params','model','OpenchannelInteraction','keys','filters','intersection','attributes','fields','length','include','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','findOne','hasOwnProperty','sort','where','pick','filter','$gte','split','format','count','includeAll','omit','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','files','join','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','Attachment','createdAt','direction','secret','read','Account','Owner','get','mkdirSync','Openchannel','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','toString','disposition','threadId','Public','Private','Messages','basename','existsSync','pipe','createWriteStream','System','lastName','renderFile','views','transcript-','.pdf','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../mysqldb','defaults','redis','./openchannelInteraction.socket','register','sendStatus'];(function(_0x477ba5,_0x117285){var _0x473ef0=function(_0x480156){while(--_0x480156){_0x477ba5['push'](_0x477ba5['shift']());}};_0x473ef0(++_0x117285);}(_0x8177,0x1d5));var _0x7817=function(_0x45ef45,_0x33430a){_0x45ef45=_0x45ef45-0x0;var _0x1981e9=_0x8177[_0x45ef45];return _0x1981e9;};'use strict';var rimraf=require(_0x7817('0x0'));var zipdir=require(_0x7817('0x1'));var moment=require(_0x7817('0x2'));var util=require(_0x7817('0x3'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7817('0x4'));var Redis=require('ioredis');var interaction=require(_0x7817('0x5'));var qs=require(_0x7817('0x6'));var pdf=require(_0x7817('0x7'));var logger=require('../../config/logger')(_0x7817('0x8'));var config=require('../../config/environment');var db=require(_0x7817('0x9'))['db'];config['redis']=_[_0x7817('0xa')](config[_0x7817('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7817('0xb')]));require(_0x7817('0xc'))[_0x7817('0xd')](socket);function respondWithStatusCode(_0x11a284,_0x7edf82){_0x7edf82=_0x7edf82||0xcc;return function(_0x3697a1){if(_0x3697a1){return _0x11a284[_0x7817('0xe')](_0x7edf82);}return _0x11a284[_0x7817('0xf')](_0x7edf82)[_0x7817('0x10')]();};}function respondWithResult(_0x564534,_0x35b2e5){_0x35b2e5=_0x35b2e5||0xc8;return function(_0x1fd155){if(_0x1fd155){return _0x564534[_0x7817('0xf')](_0x35b2e5)['json'](_0x1fd155);}};}function respondWithFilteredResult(_0x24df3c,_0x5c52d6){return function(_0x2b3e4b){if(_0x2b3e4b){var _0x184448=typeof _0x5c52d6[_0x7817('0x11')]===_0x7817('0x12')&&typeof _0x5c52d6[_0x7817('0x13')]===_0x7817('0x12');var _0x1fc5a1=_0x2b3e4b['count'];var _0x4ccd09=_0x184448?0x0:_0x5c52d6[_0x7817('0x11')];var _0x13db50=_0x184448?_0x2b3e4b['count']:_0x5c52d6[_0x7817('0x11')]+_0x5c52d6[_0x7817('0x13')];var _0x3a524a;if(_0x13db50>=_0x1fc5a1){_0x13db50=_0x1fc5a1;_0x3a524a=0xc8;}else{_0x3a524a=0xce;}_0x24df3c[_0x7817('0xf')](_0x3a524a);return _0x24df3c[_0x7817('0x14')](_0x7817('0x15'),_0x4ccd09+'-'+_0x13db50+'/'+_0x1fc5a1)['json'](_0x2b3e4b);}return null;};}function saveUpdates(_0x396c0a){return function(_0x1ca51c){if(_0x1ca51c){return _0x1ca51c[_0x7817('0x16')](_0x396c0a)[_0x7817('0x17')](function(_0x3cc40f){return _0x3cc40f;});}return null;};}function removeEntity(_0x4473c1){return function(_0x37281d){if(_0x37281d){return _0x37281d[_0x7817('0x18')]()[_0x7817('0x17')](function(){_0x4473c1[_0x7817('0xf')](0xcc)[_0x7817('0x10')]();});}};}function handleEntityNotFound(_0x436c1b){return function(_0x35cbb0){if(!_0x35cbb0){_0x436c1b[_0x7817('0xe')](0x194);}return _0x35cbb0;};}function handleError(_0x531920,_0x161033){_0x161033=_0x161033||0x1f4;return function(_0x2b4f44){logger[_0x7817('0x19')](_0x2b4f44[_0x7817('0x1a')]);if(_0x2b4f44[_0x7817('0x1b')]){delete _0x2b4f44[_0x7817('0x1b')];}_0x531920[_0x7817('0xf')](_0x161033)[_0x7817('0x1c')](_0x2b4f44);};}exports[_0x7817('0x1d')]=function(_0x1b6a0f,_0x2a282d){var _0x34eb84={};var _0x191e7d=_[_0x7817('0x1e')](db['OpenchannelInteraction'][_0x7817('0x1f')],function(_0x37d760){return{'name':_0x37d760[_0x7817('0x20')],'type':_0x37d760[_0x7817('0x21')][_0x7817('0x22')]};});_0x34eb84=qs[_0x7817('0x23')](_0x191e7d,_0x1b6a0f);return interaction[_0x7817('0x24')]('openchannel',_0x1b6a0f[_0x7817('0x25')],_0x1b6a0f['user'],_0x34eb84,_0x191e7d)['then'](respondWithFilteredResult(_0x2a282d,_0x34eb84))[_0x7817('0x26')](handleError(_0x2a282d,null));};exports[_0x7817('0x27')]=function(_0x49b0c5,_0xc4ae35){var _0x639239={};if(_0x49b0c5[_0x7817('0x25')][_0x7817('0x21')]&&_0x49b0c5[_0x7817('0x25')][_0x7817('0x21')]===_0x7817('0x28')){_0x639239[_0x7817('0x28')]=_0x49b0c5[_0x7817('0x29')]['id'];}else{_0x639239['id']=_0x49b0c5[_0x7817('0x29')]['id'];}var _0xd9b34b={'raw':![],'where':_0x639239},_0x40237e={};_0x40237e[_0x7817('0x2a')]=_['keys'](db[_0x7817('0x2b')][_0x7817('0x1f')]);_0x40237e[_0x7817('0x25')]=_[_0x7817('0x2c')](_0x49b0c5[_0x7817('0x25')]);_0x40237e[_0x7817('0x2d')]=_[_0x7817('0x2e')](_0x40237e[_0x7817('0x2a')],_0x40237e[_0x7817('0x25')]);_0xd9b34b[_0x7817('0x2f')]=_['intersection'](_0x40237e[_0x7817('0x2a')],qs[_0x7817('0x30')](_0x49b0c5[_0x7817('0x25')]['fields']));_0xd9b34b[_0x7817('0x2f')]=_0xd9b34b[_0x7817('0x2f')][_0x7817('0x31')]?_0xd9b34b[_0x7817('0x2f')]:_0x40237e[_0x7817('0x2a')];if(_0x49b0c5['query']['includeAll']){_0xd9b34b[_0x7817('0x32')]=[{'all':!![]}];}_0xd9b34b=_[_0x7817('0x33')]({},_0xd9b34b,_0x49b0c5[_0x7817('0x34')]);return db[_0x7817('0x2b')][_0x7817('0x35')](_0xd9b34b)[_0x7817('0x17')](handleEntityNotFound(_0xc4ae35,null))[_0x7817('0x17')](respondWithResult(_0xc4ae35,null))[_0x7817('0x26')](handleError(_0xc4ae35,null));};exports[_0x7817('0x36')]=function(_0x58f5fe,_0x3b0627){return db[_0x7817('0x2b')][_0x7817('0x36')](_0x58f5fe[_0x7817('0x37')],{})[_0x7817('0x17')](respondWithResult(_0x3b0627,0xc9))[_0x7817('0x26')](handleError(_0x3b0627,null));};exports[_0x7817('0x16')]=function(_0x952ec,_0x562dcb){if(_0x952ec[_0x7817('0x37')]['id']){delete _0x952ec['body']['id'];}return db[_0x7817('0x2b')][_0x7817('0x35')]({'where':{'id':_0x952ec['params']['id']}})[_0x7817('0x17')](handleEntityNotFound(_0x562dcb,null))['then'](saveUpdates(_0x952ec[_0x7817('0x37')],null))[_0x7817('0x17')](respondWithResult(_0x562dcb,null))[_0x7817('0x26')](handleError(_0x562dcb,null));};exports[_0x7817('0x18')]=function(_0xa94f6f,_0x4e0ddb){return db['OpenchannelInteraction']['find']({'where':{'id':_0xa94f6f[_0x7817('0x29')]['id']}})[_0x7817('0x17')](handleEntityNotFound(_0x4e0ddb,null))['then'](removeEntity(_0x4e0ddb,null))[_0x7817('0x26')](handleError(_0x4e0ddb,null));};exports[_0x7817('0x38')]=function(_0x49cd9a,_0x4e8300){return db[_0x7817('0x2b')][_0x7817('0x38')]()[_0x7817('0x17')](respondWithResult(_0x4e8300,null))[_0x7817('0x26')](handleError(_0x4e8300,null));};exports[_0x7817('0x39')]=function(_0x178168,_0x448d31){return db[_0x7817('0x3a')][_0x7817('0x35')]({'where':{'id':_0x178168[_0x7817('0x29')]['id']}})[_0x7817('0x17')](handleEntityNotFound(_0x448d31,null))[_0x7817('0x17')](function(_0x3a3c08){if(_0x3a3c08){return _0x3a3c08['addMessage'](_0x178168[_0x7817('0x37')][_0x7817('0x3b')],_['omit'](_0x178168[_0x7817('0x37')],['ids','id'])||{});}})[_0x7817('0x17')](respondWithResult(_0x448d31,null))[_0x7817('0x26')](handleError(_0x448d31,null));};exports['getMessages']=function(_0x5aae17,_0x45d451){var _0x5efb8f={'raw':![],'where':{}};var _0xb2313e={};var _0x1054e2={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x7817('0x3c')]({'where':{'id':_0x5aae17[_0x7817('0x29')]['id']}})[_0x7817('0x17')](handleEntityNotFound(_0x45d451,null))[_0x7817('0x17')](function(_0x44a814){if(_0x44a814){_0xb2313e[_0x7817('0x2a')]=_[_0x7817('0x2c')](db['OpenchannelMessage']['rawAttributes']);_0xb2313e[_0x7817('0x25')]=_['keys'](_0x5aae17[_0x7817('0x25')]);_0xb2313e[_0x7817('0x2d')]=_['intersection'](_0xb2313e[_0x7817('0x2a')],_0xb2313e[_0x7817('0x25')]);_0x5efb8f['attributes']=_[_0x7817('0x2e')](_0xb2313e[_0x7817('0x2a')],qs[_0x7817('0x30')](_0x5aae17[_0x7817('0x25')][_0x7817('0x30')]));_0x5efb8f[_0x7817('0x2f')]=_0x5efb8f[_0x7817('0x2f')][_0x7817('0x31')]?_0x5efb8f['attributes']:_0xb2313e[_0x7817('0x2a')];if(!_0x5aae17['query'][_0x7817('0x3d')]('nolimit')){_0x5efb8f['limit']=qs[_0x7817('0x13')](_0x5aae17[_0x7817('0x25')][_0x7817('0x13')]);_0x5efb8f[_0x7817('0x11')]=qs[_0x7817('0x11')](_0x5aae17[_0x7817('0x25')][_0x7817('0x11')]);}_0x5efb8f['order']=qs[_0x7817('0x3e')](_0x5aae17['query'][_0x7817('0x3e')]);_0x5efb8f[_0x7817('0x3f')]=qs['filters'](_[_0x7817('0x40')](_0x5aae17[_0x7817('0x25')],_0xb2313e[_0x7817('0x2d')]));_0x5efb8f[_0x7817('0x3f')]['OpenchannelInteractionId']=_0x44a814['id'];if(_0x5aae17['query']['filter']){_0x5efb8f[_0x7817('0x3f')]=_['merge'](_0x5efb8f[_0x7817('0x3f')],{'$or':_[_0x7817('0x1e')](_0x5efb8f['attributes'],function(_0x46788f){var _0x1154b4={};_0x1154b4[_0x46788f]={'$like':'%'+_0x5aae17[_0x7817('0x25')][_0x7817('0x41')]+'%'};return _0x1154b4;})});}if(_0x5aae17['query'][_0x7817('0x42')]){var _0x50ea79=_0x5aae17[_0x7817('0x25')][_0x7817('0x42')][_0x7817('0x43')](',');var _0x21c618={};_0x21c618[_0x50ea79[0x0]]={'$gte':moment(_0x50ea79[0x1])[_0x7817('0x44')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5efb8f[_0x7817('0x3f')]=_['merge'](_0x5efb8f[_0x7817('0x3f')],_0x21c618);}_0x5efb8f=_['merge']({},_0x5efb8f,_0x5aae17[_0x7817('0x34')]);return db[_0x7817('0x3a')][_0x7817('0x45')]({'where':_0x5efb8f[_0x7817('0x3f')]})[_0x7817('0x17')](function(_0x1a4864){_0x1054e2[_0x7817('0x45')]=_0x1a4864;if(_0x5aae17['query'][_0x7817('0x46')]){_0x5efb8f[_0x7817('0x32')]=[{'all':!![]}];}return db[_0x7817('0x3a')][_0x7817('0x24')](_0x5efb8f);})['then'](function(_0x4534df){_0x1054e2['rows']=_0x4534df;return _0x1054e2;});}})['then'](respondWithFilteredResult(_0x45d451,_0x5efb8f))[_0x7817('0x26')](handleError(_0x45d451,null));};exports['addTags']=function(_0xd08e1a,_0x4fed9b){return db[_0x7817('0x2b')][_0x7817('0x35')]({'where':{'id':_0xd08e1a['params']['id']}})['then'](handleEntityNotFound(_0x4fed9b,null))[_0x7817('0x17')](function(_0x31ad77){if(_0x31ad77){return _0x31ad77['setTags'](_0xd08e1a['body']['ids'],_[_0x7817('0x47')](_0xd08e1a['body'],['ids','id'])||{})['spread'](function(){return db[_0x7817('0x48')][_0x7817('0x24')]({'attributes':['id',_0x7817('0x1b'),_0x7817('0x49')],'where':{'id':_0xd08e1a['body'][_0x7817('0x3b')]}});})[_0x7817('0x17')](function(_0x16a1cc){socket[_0x7817('0x4a')](_0x7817('0x4b'),{'id':Number(_0xd08e1a[_0x7817('0x29')]['id']),'tags':_0x16a1cc||[]});return{'id':Number(_0xd08e1a[_0x7817('0x29')]['id']),'tags':_0x16a1cc||[]};});}})[_0x7817('0x17')](respondWithResult(_0x4fed9b,null))[_0x7817('0x26')](handleError(_0x4fed9b,null));};exports[_0x7817('0x4c')]=function(_0x158790,_0x340bb4){return db[_0x7817('0x2b')]['find']({'where':{'id':_0x158790['params']['id']}})['then'](handleEntityNotFound(_0x340bb4,null))['then'](function(_0x292a33){if(_0x292a33){return _0x292a33['removeTags'](_0x158790['query'][_0x7817('0x3b')]);}})[_0x7817('0x17')](respondWithStatusCode(_0x340bb4,null))[_0x7817('0x26')](handleError(_0x340bb4,null));};exports[_0x7817('0x4d')]=function(_0x52a8ab,_0x19207e){var _0xb796d=moment()[_0x7817('0x4e')]()['toString']();var _0x31b493=path['join'](config[_0x7817('0x4f')],_0x7817('0x50'),_0x7817('0x51'),'tmp');var _0x5a5614=path[_0x7817('0x52')](config[_0x7817('0x4f')],_0x7817('0x50'),_0x7817('0x51'),_0x7817('0x53'));var _0x2ba6c9=path[_0x7817('0x52')](_0x31b493,_0xb796d);var _0x8ebfb6=util[_0x7817('0x44')](_0x7817('0x54'),_0x52a8ab[_0x7817('0x29')]['id'],_0xb796d);var _0x171b0f=path['join'](_0x31b493,_0x8ebfb6);var _0x3a2b59=[];_0x3a2b59[_0x7817('0x55')]({'model':db['User'],'as':_0x7817('0x56'),'attributes':['id',_0x7817('0x57')],'raw':!![]});_0x3a2b59[_0x7817('0x55')]({'model':db['CmContact'],'as':_0x7817('0x58'),'attributes':['id',_0x7817('0x59'),'lastName'],'raw':!![]});if(_0x52a8ab[_0x7817('0x25')]['attachments']){_0x3a2b59['push']({'model':db[_0x7817('0x5a')],'as':_0x7817('0x5a'),'raw':!![]});}var _0x3d397b=[{'model':db[_0x7817('0x3a')],'as':'Messages','attributes':['id',_0x7817('0x37'),_0x7817('0x5b'),_0x7817('0x5c'),_0x7817('0x5d'),_0x7817('0x5e')],'include':_0x3a2b59}];_0x3d397b['push']({'model':db['OpenchannelAccount'],'as':_0x7817('0x5f'),'attributes':['id',_0x7817('0x1b')]});_0x3d397b[_0x7817('0x55')]({'model':db[_0x7817('0x56')],'as':_0x7817('0x60'),'attributes':['id',_0x7817('0x57')]});return db['OpenchannelInteraction'][_0x7817('0x35')]({'where':{'id':_0x52a8ab[_0x7817('0x29')]['id']},'include':_0x3d397b})['then'](handleEntityNotFound(_0x19207e,null))[_0x7817('0x17')](function(_0x5c1c88){if(_0x5c1c88){var _0x4ebeb1=_0x5c1c88[_0x7817('0x61')]({'plain':!![]});fs[_0x7817('0x62')](_0x2ba6c9);var _0x2a3d95={'channel':_0x7817('0x63'),'account':_0x4ebeb1[_0x7817('0x5f')][_0x7817('0x1b')],'agent':_0x4ebeb1[_0x7817('0x60')]?_0x4ebeb1['Owner']['fullname']:'N.A.','createdAt':moment(_0x4ebeb1[_0x7817('0x5b')])[_0x7817('0x44')](_0x7817('0x64'))['toString'](),'closedAt':_0x4ebeb1[_0x7817('0x65')]?moment(_0x4ebeb1[_0x7817('0x66')])[_0x7817('0x44')](_0x7817('0x64'))[_0x7817('0x67')]():'','disposition':_0x4ebeb1[_0x7817('0x68')],'visibility':_0x4ebeb1[_0x7817('0x69')]?_0x7817('0x6a'):_0x7817('0x6b'),'messages':_(_0x4ebeb1[_0x7817('0x6c')])['filter']({'secret':![]})[_0x7817('0x1e')](function(_0x2361d5){if(_0x2361d5[_0x7817('0x5a')]){var _0x17d3cd=path['join'](_0x5a5614,_0x2361d5['Attachment'][_0x7817('0x6d')]);if(fs[_0x7817('0x6e')](_0x17d3cd)){fs['createReadStream'](_0x17d3cd)[_0x7817('0x6f')](fs[_0x7817('0x70')](path[_0x7817('0x52')](_0x2ba6c9,_0x2361d5[_0x7817('0x5a')][_0x7817('0x6d')])));}}return{'date':moment(_0x2361d5['createdAt'])['format'](_0x7817('0x64'))['toString'](),'sender':_0x2361d5[_0x7817('0x5c')]==='out'?_0x2361d5[_0x7817('0x56')]?_0x2361d5[_0x7817('0x56')][_0x7817('0x57')]:_0x7817('0x71'):_0x2361d5[_0x7817('0x58')][_0x7817('0x59')]+(_0x2361d5[_0x7817('0x58')][_0x7817('0x72')]?'\x20'+_0x2361d5[_0x7817('0x58')][_0x7817('0x72')]:''),'body':_0x2361d5['Attachment']?_0x2361d5[_0x7817('0x5a')][_0x7817('0x6d')]:_0x2361d5[_0x7817('0x37')],'direction':_0x2361d5[_0x7817('0x5c')]==='out'?'A':'C','secret':_0x2361d5['secret'],'read':_0x2361d5[_0x7817('0x5e')],'attachment':_0x2361d5[_0x7817('0x5a')]};})['value']()};return ejs[_0x7817('0x73')](path[_0x7817('0x52')](config[_0x7817('0x4f')],'server',_0x7817('0x74'),'downloadInteraction.ejs'),{'interaction':_0x2a3d95})[_0x7817('0x17')](function(_0x2cb4ab){var _0x3c357d=path[_0x7817('0x52')](_0x2ba6c9,_0x7817('0x75')+_0x4ebeb1['id']+'-'+_0xb796d+_0x7817('0x76'));var _0x10a943={'path':_0x3c357d,'channel':_0x7817('0x63'),'interactionId':_0x4ebeb1['id']};return pdf['createPdfFromHTML'](_0x2cb4ab,_0x10a943);})[_0x7817('0x17')](function(){return new Promise(function(_0x494aba,_0x60fd64){zipdir(_0x2ba6c9,{'saveTo':_0x171b0f},function(_0x1fbe22,_0x1bb381){if(_0x1fbe22)return _0x60fd64(_0x1fbe22);return _0x494aba(_0x1bb381);});})[_0x7817('0x17')](function(){return new Promise(function(_0x35a0d3,_0x3474ed){rimraf(_0x2ba6c9,function(_0x32ebc2){if(_0x32ebc2)_0x3474ed(_0x32ebc2);return _0x35a0d3();});});})[_0x7817('0x17')](function(){return _0x19207e['download'](_0x171b0f,_0x8ebfb6,function(_0x4a5c6d){if(_0x4a5c6d){logger[_0x7817('0x19')](_0x7817('0x77'),_0x4a5c6d);}else{fs[_0x7817('0x78')](_0x171b0f);}});});});}else{return _0x19207e[_0x7817('0xe')](0xc8);}})[_0x7817('0x26')](handleError(_0x19207e,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 3e7ea39..986bb1b 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 _0xce79=['map','setDataValue','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','Users'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xce79,0xa7));var _0x9ce7=function(_0x43c8b8,_0x5e8934){_0x43c8b8=_0x43c8b8-0x0;var _0x413be3=_0xce79[_0x43c8b8];return _0x413be3;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x9ce7('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db'][_0x9ce7('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x9ce7('0x2')](0x0);var events={'afterCreate':_0x9ce7('0x3'),'afterUpdate':_0x9ce7('0x4'),'afterDestroy':_0x9ce7('0x5')};function emitEvent(_0x52100f){return function(_0x4971d5,_0x411307,_0x4b0769){_0x4971d5[_0x9ce7('0x6')]({'attributes':['id'],'raw':!![]})[_0x9ce7('0x7')](function(_0x45b243){_0x4971d5['setDataValue'](_0x9ce7('0x8'),_0x45b243[_0x9ce7('0x9')](function(_0x2c6bb6){return{'id':_0x2c6bb6['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x4971d5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x134cf8){_0x4971d5[_0x9ce7('0xa')](_0x9ce7('0xb'),_0x134cf8['length']);OpenchannelInteractionEvents[_0x9ce7('0xc')](_0x52100f+':'+_0x4971d5['id'],_0x4971d5);OpenchannelInteractionEvents[_0x9ce7('0xc')](_0x52100f,_0x4971d5);_0x4b0769(null);})[_0x9ce7('0xd')](_0x4b0769(null));};}for(var e in events){if(events[_0x9ce7('0xe')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x9ce7('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x691d=['update','remove','Users','map','then','setDataValue','length','emit','catch','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save'];(function(_0x3ed83a,_0x383052){var _0x1f94b5=function(_0xa2163d){while(--_0xa2163d){_0x3ed83a['push'](_0x3ed83a['shift']());}};_0x1f94b5(++_0x383052);}(_0x691d,0xb5));var _0xd691=function(_0x50abc4,_0x558d64){_0x50abc4=_0x50abc4-0x0;var _0x5a745d=_0x691d[_0x50abc4];return _0x5a745d;};'use strict';var EventEmitter=require(_0xd691('0x0'));var OpenchannelInteraction=require(_0xd691('0x1'))['db'][_0xd691('0x2')];var OpenchannelMessage=require(_0xd691('0x1'))['db'][_0xd691('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xd691('0x4')](0x0);var events={'afterCreate':_0xd691('0x5'),'afterUpdate':_0xd691('0x6'),'afterDestroy':_0xd691('0x7')};function emitEvent(_0x52b943){return function(_0x5a21e3,_0x33c512,_0x382fbe){_0x5a21e3['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x9b0444){_0x5a21e3['setDataValue'](_0xd691('0x8'),_0x9b0444[_0xd691('0x9')](function(_0x1f94f3){return{'id':_0x1f94f3['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x5a21e3['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd691('0xa')](function(_0x60fa90){_0x5a21e3[_0xd691('0xb')]('unreadMessages',_0x60fa90[_0xd691('0xc')]);OpenchannelInteractionEvents[_0xd691('0xd')](_0x52b943+':'+_0x5a21e3['id'],_0x5a21e3);OpenchannelInteractionEvents[_0xd691('0xd')](_0x52b943,_0x5a21e3);_0x382fbe(null);})[_0xd691('0xe')](_0x382fbe(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xd691('0xf')](e,emitEvent(event));}}module[_0xd691('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 2a26acf..eec8d45 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 _0x363e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api'];(function(_0x5bc86a,_0x34ec05){var _0x38c209=function(_0x560647){while(--_0x560647){_0x5bc86a['push'](_0x5bc86a['shift']());}};_0x38c209(++_0x34ec05);}(_0x363e,0x179));var _0xe363=function(_0x520399,_0x12c113){_0x520399=_0x520399-0x0;var _0x2f4aee=_0x363e[_0x520399];return _0x2f4aee;};'use strict';var _=require(_0xe363('0x0'));var util=require(_0xe363('0x1'));var logger=require('../../config/logger')(_0xe363('0x2'));var moment=require(_0xe363('0x3'));var BPromise=require(_0xe363('0x4'));var rp=require(_0xe363('0x5'));var fs=require('fs');var path=require(_0xe363('0x6'));var rimraf=require(_0xe363('0x7'));var config=require(_0xe363('0x8'));var attributes=require(_0xe363('0x9'));module[_0xe363('0xa')]=function(_0x1834ca,_0x8953cc){return _0x1834ca['define'](_0xe363('0xb'),attributes,{'tableName':_0xe363('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe363('0xd'),'collate':_0xe363('0xe'),'hooks':{'beforeUpdate':function(_0x515185,_0x24255d,_0x308de7){if(_0x515185[_0xe363('0xf')](_0xe363('0x10'))){_0x515185[_0xe363('0x11')]=moment()[_0xe363('0x12')](_0xe363('0x13'));}_0x308de7(null,_0x515185);}}});}; \ No newline at end of file +var _0x2824=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci'];(function(_0x222688,_0x46c5eb){var _0x437433=function(_0x29958c){while(--_0x29958c){_0x222688['push'](_0x222688['shift']());}};_0x437433(++_0x46c5eb);}(_0x2824,0xbf));var _0x4282=function(_0x277c52,_0x3b21c6){_0x277c52=_0x277c52-0x0;var _0xf3082a=_0x2824[_0x277c52];return _0xf3082a;};'use strict';var _=require(_0x4282('0x0'));var util=require('util');var logger=require(_0x4282('0x1'))(_0x4282('0x2'));var moment=require(_0x4282('0x3'));var BPromise=require(_0x4282('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4282('0x5'));var rimraf=require(_0x4282('0x6'));var config=require(_0x4282('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0x4282('0x8')]=function(_0x4ae448,_0x56b1bd){return _0x4ae448[_0x4282('0x9')](_0x4282('0xa'),attributes,{'tableName':_0x4282('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4282('0xc'),'hooks':{'beforeUpdate':function(_0x18f9a9,_0x3e46e2,_0x40ab68){if(_0x18f9a9[_0x4282('0xd')](_0x4282('0xe'))){_0x18f9a9[_0x4282('0xf')]=moment()['format'](_0x4282('0x10'));}_0x40ab68(null,_0x18f9a9);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 79ee2c0..7b82fbe 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 _0xd390=['debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelInteraction,\x20%s,\x20%s','message','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','raw','options','where','limit','AddTagsToOpenchannelInteraction','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info'];(function(_0x1d079c,_0x3e4023){var _0x558027=function(_0xa652e7){while(--_0xa652e7){_0x1d079c['push'](_0x1d079c['shift']());}};_0x558027(++_0x3e4023);}(_0xd390,0x17c));var _0x0d39=function(_0x1194d5,_0x404287){_0x1194d5=_0x1194d5-0x0;var _0x71d946=_0xd390[_0x1194d5];return _0x71d946;};'use strict';var _=require(_0x0d39('0x0'));var util=require(_0x0d39('0x1'));var moment=require(_0x0d39('0x2'));var BPromise=require(_0x0d39('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d39('0x4'));var db=require(_0x0d39('0x5'))['db'];var utils=require(_0x0d39('0x6'));var logger=require(_0x0d39('0x7'))(_0x0d39('0x8'));var config=require(_0x0d39('0x9'));var jayson=require(_0x0d39('0xa'));var client=jayson['client'][_0x0d39('0xb')]({'port':0x232a});config['redis']=_[_0x0d39('0xc')](config[_0x0d39('0xd')],{'host':_0x0d39('0xe'),'port':0x18eb});var socket=require(_0x0d39('0xf'))(new Redis(config[_0x0d39('0xd')]));require(_0x0d39('0x10'))[_0x0d39('0x11')](socket);function respondWithRpcPromise(_0x21c3e3,_0x7eedd7,_0x3ae00b){return new BPromise(function(_0x53f58d,_0x5677a3){return client['request'](_0x21c3e3,_0x3ae00b)[_0x0d39('0x12')](function(_0x58ccd4){logger[_0x0d39('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x7eedd7,'request\x20sent');logger[_0x0d39('0x14')](_0x0d39('0x15'),_0x7eedd7,_0x0d39('0x16'),JSON[_0x0d39('0x17')](_0x58ccd4));if(_0x58ccd4[_0x0d39('0x18')]){if(_0x58ccd4[_0x0d39('0x18')]['code']===0x1f4){logger[_0x0d39('0x18')](_0x0d39('0x19'),_0x7eedd7,_0x58ccd4[_0x0d39('0x18')][_0x0d39('0x1a')]);return _0x5677a3(_0x58ccd4['error']['message']);}logger['error'](_0x0d39('0x19'),_0x7eedd7,_0x58ccd4['error'][_0x0d39('0x1a')]);return _0x53f58d(_0x58ccd4[_0x0d39('0x18')][_0x0d39('0x1a')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x7eedd7,_0x0d39('0x16'));_0x53f58d(_0x58ccd4['result'][_0x0d39('0x1a')]);}})['catch'](function(_0x4f89d7){logger['error'](_0x0d39('0x19'),_0x7eedd7,_0x4f89d7);_0x5677a3(_0x4f89d7);});});}exports[_0x0d39('0x1b')]=function(_0x30ddf9){var _0x3d116a=this;return new Promise(function(_0x37ccb4,_0x5125a9){return db[_0x0d39('0x1c')][_0x0d39('0x1d')](_0x30ddf9[_0x0d39('0x1e')],{'raw':_0x30ddf9['options']?_0x30ddf9['options'][_0x0d39('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30ddf9['options']?_0x30ddf9[_0x0d39('0x20')][_0x0d39('0x21')]||null:null,'attributes':_0x30ddf9[_0x0d39('0x20')]?_0x30ddf9[_0x0d39('0x20')]['attributes']||null:null,'limit':_0x30ddf9['options']?_0x30ddf9[_0x0d39('0x20')][_0x0d39('0x22')]||null:null})[_0x0d39('0x12')](function(_0x42d3a7){logger[_0x0d39('0x13')](_0x0d39('0x1b'),_0x30ddf9);logger[_0x0d39('0x14')](_0x0d39('0x1b'),_0x30ddf9,JSON[_0x0d39('0x17')](_0x42d3a7));_0x37ccb4(_0x42d3a7);})['catch'](function(_0x3a4216){logger[_0x0d39('0x18')](_0x0d39('0x1b'),_0x3a4216['message'],_0x30ddf9);_0x5125a9(_0x3d116a['error'](0x1f4,_0x3a4216[_0x0d39('0x1a')]));});});};exports[_0x0d39('0x23')]=function(_0x473c4e){return new Promise(function(_0x25747d,_0x4a39a4){return db[_0x0d39('0x1c')]['find']({'where':_0x473c4e[_0x0d39('0x20')]?_0x473c4e[_0x0d39('0x20')][_0x0d39('0x21')]||null:null})['then'](function(_0x44edea){if(_0x44edea){return _0x44edea[_0x0d39('0x24')](_0x473c4e[_0x0d39('0x1e')][_0x0d39('0x25')],_['omit'](_0x473c4e['body'],[_0x0d39('0x25'),'id'])||{});}})[_0x0d39('0x26')](function(_0xdd1ad6){logger[_0x0d39('0x13')](_0x0d39('0x27'),_0x473c4e);logger[_0x0d39('0x14')](_0x0d39('0x27'),_0x473c4e,JSON[_0x0d39('0x17')](_0xdd1ad6));_0x25747d(_0xdd1ad6);})['catch'](function(_0x2cd02){logger[_0x0d39('0x18')](_0x0d39('0x27'),_0x2cd02[_0x0d39('0x1a')],_0x473c4e);_0x4a39a4(_this['error'](0x1f4,_0x2cd02['message']));});});}; \ No newline at end of file +var _0xd01f=['raw','attributes','limit','stringify','catch','AddTagsToOpenchannelInteraction','find','where','addTags','ids','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options'];(function(_0x5f0670,_0x53e2f3){var _0x49b9f0=function(_0x5426c8){while(--_0x5426c8){_0x5f0670['push'](_0x5f0670['shift']());}};_0x49b9f0(++_0x53e2f3);}(_0xd01f,0xdd));var _0xfd01=function(_0x2d241f,_0x44dc9f){_0x2d241f=_0x2d241f-0x0;var _0x19dc0f=_0xd01f[_0x2d241f];return _0x19dc0f;};'use strict';var _=require(_0xfd01('0x0'));var util=require(_0xfd01('0x1'));var moment=require('moment');var BPromise=require(_0xfd01('0x2'));var rs=require(_0xfd01('0x3'));var fs=require('fs');var Redis=require(_0xfd01('0x4'));var db=require(_0xfd01('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd01('0x6'))(_0xfd01('0x7'));var config=require(_0xfd01('0x8'));var jayson=require(_0xfd01('0x9'));var client=jayson['client'][_0xfd01('0xa')]({'port':0x232a});config['redis']=_[_0xfd01('0xb')](config[_0xfd01('0xc')],{'host':_0xfd01('0xd'),'port':0x18eb});var socket=require(_0xfd01('0xe'))(new Redis(config[_0xfd01('0xc')]));require(_0xfd01('0xf'))[_0xfd01('0x10')](socket);function respondWithRpcPromise(_0x3fb971,_0x3418b4,_0x2d522d){return new BPromise(function(_0x38cbee,_0x1f8e4c){return client[_0xfd01('0x11')](_0x3fb971,_0x2d522d)[_0xfd01('0x12')](function(_0x499ce7){logger[_0xfd01('0x13')](_0xfd01('0x14'),_0x3418b4,_0xfd01('0x15'));logger[_0xfd01('0x16')](_0xfd01('0x17'),_0x3418b4,_0xfd01('0x15'),JSON['stringify'](_0x499ce7));if(_0x499ce7[_0xfd01('0x18')]){if(_0x499ce7[_0xfd01('0x18')][_0xfd01('0x19')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x3418b4,_0x499ce7['error'][_0xfd01('0x1a')]);return _0x1f8e4c(_0x499ce7[_0xfd01('0x18')][_0xfd01('0x1a')]);}logger[_0xfd01('0x18')](_0xfd01('0x14'),_0x3418b4,_0x499ce7['error'][_0xfd01('0x1a')]);return _0x38cbee(_0x499ce7['error'][_0xfd01('0x1a')]);}else{logger[_0xfd01('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3418b4,_0xfd01('0x15'));_0x38cbee(_0x499ce7['result'][_0xfd01('0x1a')]);}})['catch'](function(_0x1d6613){logger[_0xfd01('0x18')](_0xfd01('0x14'),_0x3418b4,_0x1d6613);_0x1f8e4c(_0x1d6613);});});}exports[_0xfd01('0x1b')]=function(_0x4d3ed4){var _0x1c2835=this;return new Promise(function(_0x499c6b,_0x46d2e2){return db[_0xfd01('0x1c')]['update'](_0x4d3ed4[_0xfd01('0x1d')],{'raw':_0x4d3ed4[_0xfd01('0x1e')]?_0x4d3ed4[_0xfd01('0x1e')][_0xfd01('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d3ed4[_0xfd01('0x1e')]?_0x4d3ed4[_0xfd01('0x1e')]['where']||null:null,'attributes':_0x4d3ed4[_0xfd01('0x1e')]?_0x4d3ed4[_0xfd01('0x1e')][_0xfd01('0x20')]||null:null,'limit':_0x4d3ed4[_0xfd01('0x1e')]?_0x4d3ed4['options'][_0xfd01('0x21')]||null:null})[_0xfd01('0x12')](function(_0x3d9065){logger[_0xfd01('0x13')]('UpdateOpenchannelInteraction',_0x4d3ed4);logger[_0xfd01('0x16')](_0xfd01('0x1b'),_0x4d3ed4,JSON[_0xfd01('0x22')](_0x3d9065));_0x499c6b(_0x3d9065);})[_0xfd01('0x23')](function(_0x178944){logger[_0xfd01('0x18')]('UpdateOpenchannelInteraction',_0x178944[_0xfd01('0x1a')],_0x4d3ed4);_0x46d2e2(_0x1c2835[_0xfd01('0x18')](0x1f4,_0x178944[_0xfd01('0x1a')]));});});};exports[_0xfd01('0x24')]=function(_0x1485fe){return new Promise(function(_0x4f1124,_0x2d7115){return db[_0xfd01('0x1c')][_0xfd01('0x25')]({'where':_0x1485fe[_0xfd01('0x1e')]?_0x1485fe[_0xfd01('0x1e')][_0xfd01('0x26')]||null:null})['then'](function(_0x32382b){if(_0x32382b){return _0x32382b[_0xfd01('0x27')](_0x1485fe[_0xfd01('0x1d')]['ids'],_['omit'](_0x1485fe[_0xfd01('0x1d')],[_0xfd01('0x28'),'id'])||{});}})['spread'](function(_0x285945){logger['info'](_0xfd01('0x29'),_0x1485fe);logger[_0xfd01('0x16')](_0xfd01('0x29'),_0x1485fe,JSON[_0xfd01('0x22')](_0x285945));_0x4f1124(_0x285945);})['catch'](function(_0x15a97d){logger['error'](_0xfd01('0x29'),_0x15a97d['message'],_0x1485fe);_0x2d7115(_this['error'](0x1f4,_0x15a97d[_0xfd01('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 9dbe931..6474c7b 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 _0x00a3=['emit','removeListener','openchannelInteraction:','./openchannelInteraction.events','save','remove','update'];(function(_0xa732cd,_0x202f77){var _0x2f7a1f=function(_0x40fd48){while(--_0x40fd48){_0xa732cd['push'](_0xa732cd['shift']());}};_0x2f7a1f(++_0x202f77);}(_0x00a3,0x106));var _0x300a=function(_0x1d3ccc,_0x487002){_0x1d3ccc=_0x1d3ccc-0x0;var _0x59872a=_0x00a3[_0x1d3ccc];return _0x59872a;};'use strict';var OpenchannelInteractionEvents=require(_0x300a('0x0'));var events=[_0x300a('0x1'),_0x300a('0x2'),_0x300a('0x3')];function createListener(_0x405055,_0x421e41){return function(_0x2cf66d){_0x421e41[_0x300a('0x4')](_0x405055,_0x2cf66d);};}function removeListener(_0x4b4c6e,_0x49c6cc){return function(){OpenchannelInteractionEvents[_0x300a('0x5')](_0x4b4c6e,_0x49c6cc);};}exports['register']=function(_0x4c1dac){for(var _0x7a7ce2=0x0,_0x2fdba3=events['length'];_0x7a7ce2<_0x2fdba3;_0x7a7ce2++){var _0x40a618=events[_0x7a7ce2];var _0x2213ff=createListener(_0x300a('0x6')+_0x40a618,_0x4c1dac);OpenchannelInteractionEvents['on'](_0x40a618,_0x2213ff);}}; \ No newline at end of file +var _0x305a=['remove','update','emit','removeListener','length','openchannelInteraction:','save'];(function(_0x11c46d,_0x44d648){var _0x52a0a9=function(_0x11a949){while(--_0x11a949){_0x11c46d['push'](_0x11c46d['shift']());}};_0x52a0a9(++_0x44d648);}(_0x305a,0x164));var _0xa305=function(_0x3147a8,_0x5db07b){_0x3147a8=_0x3147a8-0x0;var _0x7aec87=_0x305a[_0x3147a8];return _0x7aec87;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xa305('0x0'),_0xa305('0x1'),_0xa305('0x2')];function createListener(_0xa4b17f,_0x21370c){return function(_0x3105dd){_0x21370c[_0xa305('0x3')](_0xa4b17f,_0x3105dd);};}function removeListener(_0x4f1328,_0x2738fe){return function(){OpenchannelInteractionEvents[_0xa305('0x4')](_0x4f1328,_0x2738fe);};}exports['register']=function(_0x321965){for(var _0x2006c7=0x0,_0x3c1038=events[_0xa305('0x5')];_0x2006c7<_0x3c1038;_0x2006c7++){var _0x122b04=events[_0x2006c7];var _0x56b1db=createListener(_0xa305('0x6')+_0x122b04,_0x321965);OpenchannelInteractionEvents['on'](_0x122b04,_0x56b1db);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 24ce8c1..b0fb912 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x4bbc40,_0x22a5cf){var _0x4d71a8=function(_0x2f7e49){while(--_0x2f7e49){_0x4bbc40['push'](_0x4bbc40['shift']());}};_0x4d71a8(++_0x22a5cf);}(_0xedd9,0xfc));var _0x9edd=function(_0x2c321f,_0x306b6d){_0x2c321f=_0x2c321f-0x0;var _0x341b61=_0xedd9[_0x2c321f];return _0x341b61;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x1cb3ed,_0x1bf133){var _0x415bff=function(_0x1e830){while(--_0x1e830){_0x1cb3ed['push'](_0x1cb3ed['shift']());}};_0x415bff(++_0x1bf133);}(_0xedd9,0xfc));var _0x9edd=function(_0x29020f,_0x34b92a){_0x29020f=_0x29020f-0x0;var _0x2cf5fa=_0xedd9[_0x29020f];return _0x2cf5fa;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index e97dd2e..7c56e6a 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 _0x7033=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0xe50e1,_0x30bf72){var _0x441f9a=function(_0x40ac92){while(--_0x40ac92){_0xe50e1['push'](_0xe50e1['shift']());}};_0x441f9a(++_0x30bf72);}(_0x7033,0x19e));var _0x3703=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x7033[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0x3703('0x0'));module[_0x3703('0x1')]={'body':{'type':Sequelize[_0x3703('0x2')](_0x3703('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x3703('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3703('0x5')]('in',_0x3703('0x6')),'defaultValue':_0x3703('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x3703('0x7')]},'providerName':{'type':Sequelize[_0x3703('0x8')]},'providerResponse':{'type':Sequelize[_0x3703('0x2')]}}; \ No newline at end of file +var _0x4dd3=['exports','TEXT','BOOLEAN','out','DATE','sequelize'];(function(_0x541d0a,_0xc28c6b){var _0x3477e9=function(_0x2589ab){while(--_0x2589ab){_0x541d0a['push'](_0x541d0a['shift']());}};_0x3477e9(++_0xc28c6b);}(_0x4dd3,0xf5));var _0x34dd=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0x4dd3[_0x1b5aea];return _0x51cae9;};'use strict';var Sequelize=require(_0x34dd('0x0'));module[_0x34dd('0x1')]={'body':{'type':Sequelize[_0x34dd('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x34dd('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x34dd('0x4')),'defaultValue':_0x34dd('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x34dd('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x34dd('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 545ab36..e457d4e 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 _0xda5b=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','includeAll','include','findAll','show','options','find','catch','create','body','params','describe','../../config/logger','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','channel','motionChannel','EventManager','openchannel-interactions','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','event','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','message','info','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName'];(function(_0x2111bc,_0x2d65d5){var _0x1ff93b=function(_0x2cfb28){while(--_0x2cfb28){_0x2111bc['push'](_0x2111bc['shift']());}};_0x1ff93b(++_0x2d65d5);}(_0xda5b,0xc8));var _0xbda5=function(_0xba4220,_0x5217a7){_0xba4220=_0xba4220-0x0;var _0x4cdb9d=_0xda5b[_0xba4220];return _0x4cdb9d;};'use strict';var emlformat=require(_0xbda5('0x0'));var rimraf=require(_0xbda5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbda5('0x2'));var rp=require(_0xbda5('0x3'));var moment=require('moment');var BPromise=require(_0xbda5('0x4'));var Mustache=require('mustache');var util=require(_0xbda5('0x5'));var path=require(_0xbda5('0x6'));var sox=require(_0xbda5('0x7'));var csv=require(_0xbda5('0x8'));var ejs=require(_0xbda5('0x9'));var fs=require('fs');var fs_extra=require(_0xbda5('0xa'));var _=require(_0xbda5('0xb'));var squel=require(_0xbda5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbda5('0xd'));var toCsv=require(_0xbda5('0x8'));var querystring=require('querystring');var Papa=require(_0xbda5('0xe'));var Redis=require('ioredis');var authService=require(_0xbda5('0xf'));var qs=require(_0xbda5('0x10'));var as=require(_0xbda5('0x11'));var hardwareService=require(_0xbda5('0x12'));var logger=require('../../config/logger')(_0xbda5('0x13'));var utils=require(_0xbda5('0x14'));var config=require(_0xbda5('0x15'));var licenseUtil=require(_0xbda5('0x16'));var db=require(_0xbda5('0x17'))['db'];config[_0xbda5('0x18')]=_[_0xbda5('0x19')](config[_0xbda5('0x18')],{'host':_0xbda5('0x1a'),'port':0x18eb});var socket=require(_0xbda5('0x1b'))(new Redis(config[_0xbda5('0x18')]));require(_0xbda5('0x1c'))[_0xbda5('0x1d')](socket);var jayson=require(_0xbda5('0x1e'));var client=jayson[_0xbda5('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xbda5('0x1f')][_0xbda5('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5357a7,_0x374186,_0x2e5d70,_0x5ef727){return new BPromise(function(_0x237755,_0x11828d){var _0x214584=_0x5ef727||client;return _0x214584[_0xbda5('0x21')](_0x5357a7,_0x2e5d70)[_0xbda5('0x22')](function(_0x4cd02c){logger['info'](_0xbda5('0x23'),_0x374186,_0xbda5('0x24'));logger[_0xbda5('0x25')](_0xbda5('0x26'),_0x374186,_0xbda5('0x24'),JSON['stringify'](_0x4cd02c));if(_0x4cd02c[_0xbda5('0x27')]){if(_0x4cd02c[_0xbda5('0x27')]['code']===0x1f4){logger[_0xbda5('0x27')](_0xbda5('0x23'),_0x374186,_0x4cd02c['error'][_0xbda5('0x28')]);return _0x11828d(_0x4cd02c[_0xbda5('0x27')][_0xbda5('0x28')]);}logger['error'](_0xbda5('0x23'),_0x374186,_0x4cd02c[_0xbda5('0x27')]['message']);return _0x237755(_0x4cd02c['error']['message']);}else{logger[_0xbda5('0x29')](_0xbda5('0x23'),_0x374186,'request\x20sent');_0x237755(_0x4cd02c['result']['message']);}})['catch'](function(_0x56649d){logger[_0xbda5('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x374186,_0x56649d);_0x11828d(_0x56649d);});});}function respondWithStatusCode(_0x2a8cc9,_0x1203fe){_0x1203fe=_0x1203fe||0xcc;return function(_0x4dd91e){if(_0x4dd91e){return _0x2a8cc9[_0xbda5('0x2a')](_0x1203fe);}return _0x2a8cc9[_0xbda5('0x2b')](_0x1203fe)[_0xbda5('0x2c')]();};}function respondWithResult(_0x2dc568,_0x213f99){_0x213f99=_0x213f99||0xc8;return function(_0x2af686){if(_0x2af686){return _0x2dc568[_0xbda5('0x2b')](_0x213f99)['json'](_0x2af686);}};}function respondWithFilteredResult(_0x1ef716,_0x4bb53a){return function(_0x14aba7){if(_0x14aba7){var _0x240261=typeof _0x4bb53a[_0xbda5('0x2d')]==='undefined'&&typeof _0x4bb53a[_0xbda5('0x2e')]===_0xbda5('0x2f');var _0x439a40=_0x14aba7['count'];var _0x14cce6=_0x240261?0x0:_0x4bb53a[_0xbda5('0x2d')];var _0x3c441b=_0x240261?_0x14aba7[_0xbda5('0x30')]:_0x4bb53a['offset']+_0x4bb53a[_0xbda5('0x2e')];var _0x4ce8d0;if(_0x3c441b>=_0x439a40){_0x3c441b=_0x439a40;_0x4ce8d0=0xc8;}else{_0x4ce8d0=0xce;}_0x1ef716[_0xbda5('0x2b')](_0x4ce8d0);return _0x1ef716[_0xbda5('0x31')]('Content-Range',_0x14cce6+'-'+_0x3c441b+'/'+_0x439a40)[_0xbda5('0x32')](_0x14aba7);}return null;};}function patchUpdates(_0x1c6b5a){return function(_0x432406){try{jsonpatch[_0xbda5('0x33')](_0x432406,_0x1c6b5a,!![]);}catch(_0xf4a43c){return BPromise[_0xbda5('0x34')](_0xf4a43c);}return _0x432406[_0xbda5('0x35')]();};}function saveUpdates(_0x392f27,_0x475924){return function(_0x3da087){if(_0x3da087){return _0x3da087[_0xbda5('0x36')](_0x392f27)[_0xbda5('0x22')](function(_0x884aa1){return _0x884aa1;});}return null;};}function removeEntity(_0x1ec28c,_0x46e641){return function(_0x5215e7){if(_0x5215e7){return _0x5215e7[_0xbda5('0x37')]()[_0xbda5('0x22')](function(){_0x1ec28c[_0xbda5('0x2b')](0xcc)[_0xbda5('0x2c')]();});}};}function handleEntityNotFound(_0x149f8a,_0x2440e1){return function(_0x1cf0f7){if(!_0x1cf0f7){_0x149f8a[_0xbda5('0x2a')](0x194);}return _0x1cf0f7;};}function handleError(_0x1146d0,_0x53491b){_0x53491b=_0x53491b||0x1f4;return function(_0xad70bb){logger[_0xbda5('0x27')](_0xad70bb[_0xbda5('0x38')]);if(_0xad70bb[_0xbda5('0x39')]){delete _0xad70bb[_0xbda5('0x39')];}_0x1146d0[_0xbda5('0x2b')](_0x53491b)[_0xbda5('0x3a')](_0xad70bb);};}exports[_0xbda5('0x3b')]=function(_0x3c6e1d,_0x18be27){var _0x5a6a9c={},_0x3f023c={},_0x4f3642={'count':0x0,'rows':[]};var _0x18d8f3=_[_0xbda5('0x3c')](db[_0xbda5('0x3d')][_0xbda5('0x3e')],function(_0x27912e){return{'name':_0x27912e[_0xbda5('0x3f')],'type':_0x27912e['type']['key']};});_0x3f023c[_0xbda5('0x40')]=_[_0xbda5('0x3c')](_0x18d8f3,_0xbda5('0x39'));_0x3f023c[_0xbda5('0x41')]=_[_0xbda5('0x42')](_0x3c6e1d[_0xbda5('0x41')]);_0x3f023c[_0xbda5('0x43')]=_[_0xbda5('0x44')](_0x3f023c[_0xbda5('0x40')],_0x3f023c[_0xbda5('0x41')]);_0x5a6a9c[_0xbda5('0x45')]=_['intersection'](_0x3f023c[_0xbda5('0x40')],qs[_0xbda5('0x46')](_0x3c6e1d[_0xbda5('0x41')][_0xbda5('0x46')]));_0x5a6a9c[_0xbda5('0x45')]=_0x5a6a9c[_0xbda5('0x45')][_0xbda5('0x47')]?_0x5a6a9c['attributes']:_0x3f023c[_0xbda5('0x40')];if(!_0x3c6e1d[_0xbda5('0x41')][_0xbda5('0x48')](_0xbda5('0x49'))){_0x5a6a9c[_0xbda5('0x2e')]=qs[_0xbda5('0x2e')](_0x3c6e1d[_0xbda5('0x41')]['limit']);_0x5a6a9c['offset']=qs[_0xbda5('0x2d')](_0x3c6e1d[_0xbda5('0x41')]['offset']);}_0x5a6a9c[_0xbda5('0x4a')]=qs[_0xbda5('0x4b')](_0x3c6e1d[_0xbda5('0x41')]['sort']);_0x5a6a9c[_0xbda5('0x4c')]=qs[_0xbda5('0x43')](_['pick'](_0x3c6e1d['query'],_0x3f023c[_0xbda5('0x43')]),_0x18d8f3);if(_0x3c6e1d[_0xbda5('0x41')][_0xbda5('0x4d')]){_0x5a6a9c[_0xbda5('0x4c')]=_['merge'](_0x5a6a9c[_0xbda5('0x4c')],{'$or':_['map'](_0x18d8f3,function(_0x377336){if(_0x377336[_0xbda5('0x4e')]!==_0xbda5('0x4f')){var _0xd6355c={};_0xd6355c[_0x377336[_0xbda5('0x39')]]={'$like':'%'+_0x3c6e1d[_0xbda5('0x41')][_0xbda5('0x4d')]+'%'};return _0xd6355c;}})});}_0x5a6a9c=_[_0xbda5('0x50')]({},_0x5a6a9c,_0x3c6e1d['options']);var _0x28d391={'where':_0x5a6a9c[_0xbda5('0x4c')]};return db[_0xbda5('0x3d')][_0xbda5('0x30')](_0x28d391)[_0xbda5('0x22')](function(_0x53123f){_0x4f3642[_0xbda5('0x30')]=_0x53123f;if(_0x3c6e1d[_0xbda5('0x41')][_0xbda5('0x51')]){_0x5a6a9c[_0xbda5('0x52')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xbda5('0x53')](_0x5a6a9c);})[_0xbda5('0x22')](function(_0x9b97bd){_0x4f3642['rows']=_0x9b97bd;return _0x4f3642;})[_0xbda5('0x22')](respondWithFilteredResult(_0x18be27,_0x5a6a9c))['catch'](handleError(_0x18be27,null));};exports[_0xbda5('0x54')]=function(_0x4ab261,_0x4fb24d){var _0x18614f={'raw':!![],'where':{'id':_0x4ab261['params']['id']}},_0x4e2ad9={};_0x4e2ad9[_0xbda5('0x40')]=_['keys'](db[_0xbda5('0x3d')]['rawAttributes']);_0x4e2ad9[_0xbda5('0x41')]=_[_0xbda5('0x42')](_0x4ab261[_0xbda5('0x41')]);_0x4e2ad9[_0xbda5('0x43')]=_[_0xbda5('0x44')](_0x4e2ad9[_0xbda5('0x40')],_0x4e2ad9[_0xbda5('0x41')]);_0x18614f[_0xbda5('0x45')]=_['intersection'](_0x4e2ad9[_0xbda5('0x40')],qs[_0xbda5('0x46')](_0x4ab261[_0xbda5('0x41')][_0xbda5('0x46')]));_0x18614f[_0xbda5('0x45')]=_0x18614f[_0xbda5('0x45')][_0xbda5('0x47')]?_0x18614f[_0xbda5('0x45')]:_0x4e2ad9[_0xbda5('0x40')];if(_0x4ab261[_0xbda5('0x41')][_0xbda5('0x51')]){_0x18614f[_0xbda5('0x52')]=[{'all':!![]}];}_0x18614f=_[_0xbda5('0x50')]({},_0x18614f,_0x4ab261[_0xbda5('0x55')]);return db['OpenchannelMessage'][_0xbda5('0x56')](_0x18614f)[_0xbda5('0x22')](handleEntityNotFound(_0x4fb24d,null))[_0xbda5('0x22')](respondWithResult(_0x4fb24d,null))[_0xbda5('0x57')](handleError(_0x4fb24d,null));};exports[_0xbda5('0x58')]=function(_0x498f55,_0x2d8695){return db[_0xbda5('0x3d')][_0xbda5('0x58')](_0x498f55[_0xbda5('0x59')],{})[_0xbda5('0x22')](respondWithResult(_0x2d8695,0xc9))[_0xbda5('0x57')](handleError(_0x2d8695,null));};exports[_0xbda5('0x36')]=function(_0x3f2200,_0x18409d){if(_0x3f2200[_0xbda5('0x59')]['id']){delete _0x3f2200[_0xbda5('0x59')]['id'];}return db['OpenchannelMessage'][_0xbda5('0x56')]({'where':{'id':_0x3f2200[_0xbda5('0x5a')]['id']}})['then'](handleEntityNotFound(_0x18409d,null))[_0xbda5('0x22')](saveUpdates(_0x3f2200[_0xbda5('0x59')],null))[_0xbda5('0x22')](respondWithResult(_0x18409d,null))[_0xbda5('0x57')](handleError(_0x18409d,null));};exports[_0xbda5('0x37')]=function(_0xbbfe06,_0x3b1dc8){return db[_0xbda5('0x3d')][_0xbda5('0x56')]({'where':{'id':_0xbbfe06[_0xbda5('0x5a')]['id']}})[_0xbda5('0x22')](handleEntityNotFound(_0x3b1dc8,null))[_0xbda5('0x22')](removeEntity(_0x3b1dc8,null))[_0xbda5('0x57')](handleError(_0x3b1dc8,null));};exports['describe']=function(_0x18bf2d,_0x40efb4){return db['OpenchannelMessage'][_0xbda5('0x5b')]()[_0xbda5('0x22')](respondWithResult(_0x40efb4,null))[_0xbda5('0x57')](handleError(_0x40efb4,null));};var interaction_log=require(_0xbda5('0x5c'))('openchannel-interactions');exports[_0xbda5('0x5d')]=function(_0x226299,_0x4d37f7,_0x9790b0){var _0x1096dc={'agent':{},'channel':'openchannel'};if(_0x226299[_0xbda5('0x59')]['id']){delete _0x226299[_0xbda5('0x59')]['id'];}_0x226299[_0xbda5('0x59')]['read']=!![];_0x226299[_0xbda5('0x59')][_0xbda5('0x5e')]=moment()[_0xbda5('0x5f')](_0xbda5('0x60'));_0x226299[_0xbda5('0x59')][_0xbda5('0x61')]=_0x226299[_0xbda5('0x59')][_0xbda5('0x61')]||_0x226299[_0xbda5('0x62')]['id'];_0x1096dc[_0xbda5('0x63')]['id']=_0x226299[_0xbda5('0x59')]['UserId'];return db['OpenchannelMessage'][_0xbda5('0x56')]({'where':{'id':_0x226299[_0xbda5('0x5a')]['id'],'UserId':null}})[_0xbda5('0x22')](handleEntityNotFound(_0x4d37f7,null))['then'](saveUpdates(_0x226299[_0xbda5('0x59')],null))['then'](function(_0x296cc8){if(_0x296cc8){_0x1096dc[_0xbda5('0x28')]=_0x296cc8['get']({'plain':!![]});return db[_0xbda5('0x64')][_0xbda5('0x56')]({'where':{'id':_0x296cc8[_0xbda5('0x65')]}});}return null;})[_0xbda5('0x22')](handleEntityNotFound(_0x4d37f7,null))['then'](function(_0x1026ef){if(_0x1026ef){return _0x1026ef['update']({'UserId':_0x226299[_0xbda5('0x59')][_0xbda5('0x61')],'read1stAt':_[_0xbda5('0x66')](_0x1026ef[_0xbda5('0x67')])?moment()[_0xbda5('0x5f')](_0xbda5('0x60')):undefined});}return null;})[_0xbda5('0x22')](function(_0x4c8745){if(_0x4c8745){_0x1096dc['interaction']=_0x4c8745[_0xbda5('0x68')]({'plain':!![]});interaction_log[_0xbda5('0x29')](_0xbda5('0x69'),_0x226299[_0xbda5('0x62')]['id'],_0x226299[_0xbda5('0x62')]['name'],_0x226299[_0xbda5('0x62')][_0xbda5('0x6a')],_0x1096dc[_0xbda5('0x6b')]['id'],_0x226299[_0xbda5('0x59')]?JSON[_0xbda5('0x6c')](_0x226299[_0xbda5('0x59')]):_0xbda5('0x6d'));return respondWithRpcPromise(_0xbda5('0x6e'),'acceptMessage',_0x1096dc);}return null;})[_0xbda5('0x22')](function(_0x7b8b60){var _0x21438f=_0xbda5('0x6f')+_0x7b8b60['message']['ContactId'];return db[_0xbda5('0x70')][_0xbda5('0x41')](_0x21438f,{'type':db[_0xbda5('0x71')][_0xbda5('0x72')][_0xbda5('0x73')],'raw':!![]})['then'](function(_0xf13e4f){return _0xf13e4f;});})[_0xbda5('0x22')](function(_0x5d7643){if(_0x5d7643){_0x1096dc[_0xbda5('0x28')][_0xbda5('0x74')]=_0x5d7643[0x0];if(!_0x226299[_0xbda5('0x59')][_0xbda5('0x61')])return;return db[_0xbda5('0x75')][_0xbda5('0x56')]({'where':{'id':_0x226299[_0xbda5('0x59')][_0xbda5('0x61')],'role':_0xbda5('0x63')},'attributes':['id',_0xbda5('0x39'),_0xbda5('0x76'),_0xbda5('0x77'),_0xbda5('0x78')],'raw':!![]});}return null;})[_0xbda5('0x22')](function(_0x5180cd){if(!_0x5180cd)return null;_0x1096dc[_0xbda5('0x28')][_0xbda5('0x63')]=_0x5180cd;return _0x1096dc;})[_0xbda5('0x22')](function(_0x13dc3){if(_0x13dc3){if(_0x226299[_0xbda5('0x59')]['manual']){_0x1096dc[_0xbda5('0x28')][_0xbda5('0x79')]=util[_0xbda5('0x5f')]('SIP/%s',_0x226299[_0xbda5('0x62')][_0xbda5('0x39')]);_0x1096dc[_0xbda5('0x28')][_0xbda5('0x7a')]=_0x1096dc[_0xbda5('0x7a')];_0x1096dc['message'][_0xbda5('0x7b')]=_0x1096dc[_0xbda5('0x7a')];_0x1096dc[_0xbda5('0x28')]['event']='accept';return respondWithRpcPromise(_0xbda5('0x7c'),'EventManager',{'event':'acceptmessage','message':_0x1096dc[_0xbda5('0x28')]},client9002)[_0xbda5('0x22')](function(){return _0x1096dc;});}return _0x1096dc;}return null;})['then'](respondWithResult(_0x4d37f7,null))['catch'](handleError(_0x4d37f7,null));};var interaction_log=require(_0xbda5('0x5c'))(_0xbda5('0x7d'));exports[_0xbda5('0x34')]=function(_0x2065d6,_0x209d1c,_0x44d608){var _0x48f0ea={'agent':{},'channel':_0xbda5('0x7e')};if(_0x2065d6['body']['id']){delete _0x2065d6[_0xbda5('0x59')]['id'];}_0x2065d6[_0xbda5('0x59')]['UserId']=_0x2065d6[_0xbda5('0x59')][_0xbda5('0x61')]||_0x2065d6['user']['id'];_0x48f0ea['agent']['id']=_0x2065d6['body'][_0xbda5('0x61')];return db[_0xbda5('0x3d')][_0xbda5('0x56')]({'where':{'id':_0x2065d6[_0xbda5('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x209d1c,null))['then'](function(_0x51ab34){if(_0x51ab34){_0x48f0ea[_0xbda5('0x28')]=_0x51ab34[_0xbda5('0x68')]({'plain':!![]});return db[_0xbda5('0x64')][_0xbda5('0x56')]({'where':{'id':_0x51ab34[_0xbda5('0x65')]}});}return null;})[_0xbda5('0x22')](handleEntityNotFound(_0x209d1c,null))[_0xbda5('0x22')](function(_0x5ef83d){if(_0x5ef83d){_0x48f0ea[_0xbda5('0x6b')]=_0x5ef83d[_0xbda5('0x68')]({'plain':!![]});interaction_log[_0xbda5('0x29')](_0xbda5('0x7f'),_0x2065d6[_0xbda5('0x62')]['id'],_0x2065d6['user'][_0xbda5('0x39')],_0x2065d6['user']['role'],_0x48f0ea[_0xbda5('0x6b')]['id'],_0x2065d6[_0xbda5('0x59')]?JSON['stringify'](_0x2065d6[_0xbda5('0x59')]):_0xbda5('0x6d'));return respondWithRpcPromise('RejectMessage',_0xbda5('0x80'),_0x48f0ea);}return null;})['then'](function(_0x1d0e86){var _0x4b952c=_0xbda5('0x6f')+_0x1d0e86[_0xbda5('0x28')][_0xbda5('0x81')];return db[_0xbda5('0x70')][_0xbda5('0x41')](_0x4b952c,{'type':db['Sequelize'][_0xbda5('0x72')]['SELECT'],'raw':!![]})[_0xbda5('0x22')](function(_0x1208b4){return _0x1208b4;});})[_0xbda5('0x22')](function(_0x139506){if(_0x139506){_0x48f0ea['message'][_0xbda5('0x74')]=_0x139506[0x0];if(!_0x2065d6[_0xbda5('0x59')]['UserId'])return;return db['User'][_0xbda5('0x56')]({'where':{'id':_0x2065d6[_0xbda5('0x59')][_0xbda5('0x61')],'role':_0xbda5('0x63')},'attributes':['id',_0xbda5('0x39'),_0xbda5('0x76'),_0xbda5('0x77'),'internal'],'raw':!![]});}return null;})[_0xbda5('0x22')](function(_0x4cd835){if(!_0x4cd835)return null;_0x48f0ea[_0xbda5('0x28')][_0xbda5('0x63')]=_0x4cd835;return _0x48f0ea;})[_0xbda5('0x22')](function(_0x5481e3){if(_0x5481e3){_0x5481e3[_0xbda5('0x28')][_0xbda5('0x79')]=util[_0xbda5('0x5f')]('SIP/%s',_0x2065d6[_0xbda5('0x62')][_0xbda5('0x39')]);_0x5481e3[_0xbda5('0x28')][_0xbda5('0x7a')]=_0x48f0ea[_0xbda5('0x7a')];_0x5481e3['message']['motionChannel']=_0x48f0ea[_0xbda5('0x7a')];_0x5481e3[_0xbda5('0x28')][_0xbda5('0x82')]=_0xbda5('0x34');respondWithRpcPromise('EventManager','EventManager',{'event':_0xbda5('0x83'),'message':_0x5481e3[_0xbda5('0x28')]},client9002);return _0x48f0ea;}return null;})[_0xbda5('0x22')](respondWithResult(_0x209d1c,null))[_0xbda5('0x57')](handleError(_0x209d1c,null));}; \ No newline at end of file +var _0x6e66=['interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','interface','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','reject','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','internal','SIP/%s','rejectmessage','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','http','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','save','update','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','filter','VIRTUAL','options','includeAll','rows','show','params','include','merge','create','body','find','destroy','describe','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','format','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role'];(function(_0x2ffb70,_0x21490b){var _0x42c8de=function(_0x5817f3){while(--_0x5817f3){_0x2ffb70['push'](_0x2ffb70['shift']());}};_0x42c8de(++_0x21490b);}(_0x6e66,0x9d));var _0x66e6=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x6e66[_0x58dc25];return _0x21b0a7;};'use strict';var emlformat=require(_0x66e6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x66e6('0x1'));var rp=require(_0x66e6('0x2'));var moment=require(_0x66e6('0x3'));var BPromise=require(_0x66e6('0x4'));var Mustache=require(_0x66e6('0x5'));var util=require(_0x66e6('0x6'));var path=require(_0x66e6('0x7'));var sox=require(_0x66e6('0x8'));var csv=require('to-csv');var ejs=require(_0x66e6('0x9'));var fs=require('fs');var fs_extra=require(_0x66e6('0xa'));var _=require(_0x66e6('0xb'));var squel=require(_0x66e6('0xc'));var crypto=require('crypto');var jsforce=require(_0x66e6('0xd'));var deskjs=require(_0x66e6('0xe'));var toCsv=require(_0x66e6('0xf'));var querystring=require(_0x66e6('0x10'));var Papa=require('papaparse');var Redis=require(_0x66e6('0x11'));var authService=require(_0x66e6('0x12'));var qs=require(_0x66e6('0x13'));var as=require(_0x66e6('0x14'));var hardwareService=require(_0x66e6('0x15'));var logger=require(_0x66e6('0x16'))(_0x66e6('0x17'));var utils=require(_0x66e6('0x18'));var config=require(_0x66e6('0x19'));var licenseUtil=require(_0x66e6('0x1a'));var db=require('../../mysqldb')['db'];config[_0x66e6('0x1b')]=_['defaults'](config[_0x66e6('0x1b')],{'host':_0x66e6('0x1c'),'port':0x18eb});var socket=require(_0x66e6('0x1d'))(new Redis(config[_0x66e6('0x1b')]));require(_0x66e6('0x1e'))['register'](socket);var jayson=require(_0x66e6('0x1f'));var client=jayson['client'][_0x66e6('0x20')]({'port':0x232c});var client9002=jayson[_0x66e6('0x21')][_0x66e6('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3b77ca,_0x157777,_0x24491f,_0x14b855){return new BPromise(function(_0x2b93d0,_0x396c29){var _0x417d26=_0x14b855||client;return _0x417d26[_0x66e6('0x22')](_0x3b77ca,_0x24491f)[_0x66e6('0x23')](function(_0x668525){logger[_0x66e6('0x24')](_0x66e6('0x25'),_0x157777,_0x66e6('0x26'));logger[_0x66e6('0x27')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x157777,'request\x20sent',JSON[_0x66e6('0x28')](_0x668525));if(_0x668525[_0x66e6('0x29')]){if(_0x668525[_0x66e6('0x29')][_0x66e6('0x2a')]===0x1f4){logger[_0x66e6('0x29')](_0x66e6('0x25'),_0x157777,_0x668525['error'][_0x66e6('0x2b')]);return _0x396c29(_0x668525[_0x66e6('0x29')][_0x66e6('0x2b')]);}logger[_0x66e6('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x157777,_0x668525[_0x66e6('0x29')]['message']);return _0x2b93d0(_0x668525[_0x66e6('0x29')][_0x66e6('0x2b')]);}else{logger[_0x66e6('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x157777,_0x66e6('0x26'));_0x2b93d0(_0x668525[_0x66e6('0x2c')][_0x66e6('0x2b')]);}})[_0x66e6('0x2d')](function(_0x38ca21){logger['error'](_0x66e6('0x25'),_0x157777,_0x38ca21);_0x396c29(_0x38ca21);});});}function respondWithStatusCode(_0x12abcb,_0x52584c){_0x52584c=_0x52584c||0xcc;return function(_0x5de7c3){if(_0x5de7c3){return _0x12abcb[_0x66e6('0x2e')](_0x52584c);}return _0x12abcb[_0x66e6('0x2f')](_0x52584c)[_0x66e6('0x30')]();};}function respondWithResult(_0x740298,_0x3cd3f1){_0x3cd3f1=_0x3cd3f1||0xc8;return function(_0x1a0496){if(_0x1a0496){return _0x740298[_0x66e6('0x2f')](_0x3cd3f1)['json'](_0x1a0496);}};}function respondWithFilteredResult(_0x584a31,_0x4646e4){return function(_0x2af6a4){if(_0x2af6a4){var _0x64b0cc=typeof _0x4646e4[_0x66e6('0x31')]===_0x66e6('0x32')&&typeof _0x4646e4[_0x66e6('0x33')]===_0x66e6('0x32');var _0x477bfc=_0x2af6a4['count'];var _0x30dbc7=_0x64b0cc?0x0:_0x4646e4[_0x66e6('0x31')];var _0x2620f8=_0x64b0cc?_0x2af6a4['count']:_0x4646e4[_0x66e6('0x31')]+_0x4646e4[_0x66e6('0x33')];var _0x5f4fef;if(_0x2620f8>=_0x477bfc){_0x2620f8=_0x477bfc;_0x5f4fef=0xc8;}else{_0x5f4fef=0xce;}_0x584a31[_0x66e6('0x2f')](_0x5f4fef);return _0x584a31[_0x66e6('0x34')](_0x66e6('0x35'),_0x30dbc7+'-'+_0x2620f8+'/'+_0x477bfc)[_0x66e6('0x36')](_0x2af6a4);}return null;};}function patchUpdates(_0x5ecbe3){return function(_0x5b5e9d){try{jsonpatch['apply'](_0x5b5e9d,_0x5ecbe3,!![]);}catch(_0x9bde7e){return BPromise['reject'](_0x9bde7e);}return _0x5b5e9d[_0x66e6('0x37')]();};}function saveUpdates(_0x4584ba,_0x2c3e5a){return function(_0x3803a2){if(_0x3803a2){return _0x3803a2[_0x66e6('0x38')](_0x4584ba)[_0x66e6('0x23')](function(_0x22d8f0){return _0x22d8f0;});}return null;};}function removeEntity(_0x38c6cb,_0x52868e){return function(_0x49bb96){if(_0x49bb96){return _0x49bb96['destroy']()[_0x66e6('0x23')](function(){_0x38c6cb[_0x66e6('0x2f')](0xcc)[_0x66e6('0x30')]();});}};}function handleEntityNotFound(_0x5ea586,_0x46cc4b){return function(_0x5dd0ac){if(!_0x5dd0ac){_0x5ea586[_0x66e6('0x2e')](0x194);}return _0x5dd0ac;};}function handleError(_0xb3fd84,_0x413350){_0x413350=_0x413350||0x1f4;return function(_0x41ac60){logger[_0x66e6('0x29')](_0x41ac60[_0x66e6('0x39')]);if(_0x41ac60[_0x66e6('0x3a')]){delete _0x41ac60['name'];}_0xb3fd84[_0x66e6('0x2f')](_0x413350)[_0x66e6('0x3b')](_0x41ac60);};}exports['index']=function(_0x1b3149,_0x560afc){var _0x1addab={},_0x1b21d3={},_0x16811b={'count':0x0,'rows':[]};var _0x4eb6cd=_[_0x66e6('0x3c')](db[_0x66e6('0x3d')][_0x66e6('0x3e')],function(_0x229388){return{'name':_0x229388[_0x66e6('0x3f')],'type':_0x229388[_0x66e6('0x40')]['key']};});_0x1b21d3[_0x66e6('0x41')]=_[_0x66e6('0x3c')](_0x4eb6cd,_0x66e6('0x3a'));_0x1b21d3[_0x66e6('0x42')]=_[_0x66e6('0x43')](_0x1b3149[_0x66e6('0x42')]);_0x1b21d3['filters']=_['intersection'](_0x1b21d3['model'],_0x1b21d3[_0x66e6('0x42')]);_0x1addab['attributes']=_[_0x66e6('0x44')](_0x1b21d3[_0x66e6('0x41')],qs[_0x66e6('0x45')](_0x1b3149['query'][_0x66e6('0x45')]));_0x1addab[_0x66e6('0x46')]=_0x1addab[_0x66e6('0x46')][_0x66e6('0x47')]?_0x1addab[_0x66e6('0x46')]:_0x1b21d3[_0x66e6('0x41')];if(!_0x1b3149[_0x66e6('0x42')][_0x66e6('0x48')]('nolimit')){_0x1addab[_0x66e6('0x33')]=qs[_0x66e6('0x33')](_0x1b3149[_0x66e6('0x42')][_0x66e6('0x33')]);_0x1addab['offset']=qs[_0x66e6('0x31')](_0x1b3149[_0x66e6('0x42')]['offset']);}_0x1addab['order']=qs['sort'](_0x1b3149[_0x66e6('0x42')][_0x66e6('0x49')]);_0x1addab[_0x66e6('0x4a')]=qs['filters'](_['pick'](_0x1b3149[_0x66e6('0x42')],_0x1b21d3[_0x66e6('0x4b')]),_0x4eb6cd);if(_0x1b3149[_0x66e6('0x42')][_0x66e6('0x4c')]){_0x1addab[_0x66e6('0x4a')]=_['merge'](_0x1addab[_0x66e6('0x4a')],{'$or':_[_0x66e6('0x3c')](_0x4eb6cd,function(_0x586e82){if(_0x586e82[_0x66e6('0x40')]!==_0x66e6('0x4d')){var _0x6eaa39={};_0x6eaa39[_0x586e82[_0x66e6('0x3a')]]={'$like':'%'+_0x1b3149[_0x66e6('0x42')][_0x66e6('0x4c')]+'%'};return _0x6eaa39;}})});}_0x1addab=_['merge']({},_0x1addab,_0x1b3149[_0x66e6('0x4e')]);var _0x57a769={'where':_0x1addab[_0x66e6('0x4a')]};return db['OpenchannelMessage']['count'](_0x57a769)[_0x66e6('0x23')](function(_0x1f92ce){_0x16811b['count']=_0x1f92ce;if(_0x1b3149[_0x66e6('0x42')][_0x66e6('0x4f')]){_0x1addab['include']=[{'all':!![]}];}return db[_0x66e6('0x3d')]['findAll'](_0x1addab);})[_0x66e6('0x23')](function(_0x17467f){_0x16811b[_0x66e6('0x50')]=_0x17467f;return _0x16811b;})[_0x66e6('0x23')](respondWithFilteredResult(_0x560afc,_0x1addab))[_0x66e6('0x2d')](handleError(_0x560afc,null));};exports[_0x66e6('0x51')]=function(_0x2be132,_0x14faa8){var _0x437d81={'raw':!![],'where':{'id':_0x2be132[_0x66e6('0x52')]['id']}},_0x168a25={};_0x168a25[_0x66e6('0x41')]=_[_0x66e6('0x43')](db[_0x66e6('0x3d')][_0x66e6('0x3e')]);_0x168a25[_0x66e6('0x42')]=_[_0x66e6('0x43')](_0x2be132['query']);_0x168a25[_0x66e6('0x4b')]=_[_0x66e6('0x44')](_0x168a25[_0x66e6('0x41')],_0x168a25[_0x66e6('0x42')]);_0x437d81[_0x66e6('0x46')]=_[_0x66e6('0x44')](_0x168a25[_0x66e6('0x41')],qs['fields'](_0x2be132[_0x66e6('0x42')][_0x66e6('0x45')]));_0x437d81['attributes']=_0x437d81['attributes'][_0x66e6('0x47')]?_0x437d81[_0x66e6('0x46')]:_0x168a25[_0x66e6('0x41')];if(_0x2be132[_0x66e6('0x42')][_0x66e6('0x4f')]){_0x437d81[_0x66e6('0x53')]=[{'all':!![]}];}_0x437d81=_[_0x66e6('0x54')]({},_0x437d81,_0x2be132[_0x66e6('0x4e')]);return db[_0x66e6('0x3d')]['find'](_0x437d81)[_0x66e6('0x23')](handleEntityNotFound(_0x14faa8,null))['then'](respondWithResult(_0x14faa8,null))['catch'](handleError(_0x14faa8,null));};exports[_0x66e6('0x55')]=function(_0x146c26,_0x29effa){return db[_0x66e6('0x3d')][_0x66e6('0x55')](_0x146c26[_0x66e6('0x56')],{})[_0x66e6('0x23')](respondWithResult(_0x29effa,0xc9))[_0x66e6('0x2d')](handleError(_0x29effa,null));};exports[_0x66e6('0x38')]=function(_0x1db38c,_0x3086d2){if(_0x1db38c[_0x66e6('0x56')]['id']){delete _0x1db38c[_0x66e6('0x56')]['id'];}return db['OpenchannelMessage'][_0x66e6('0x57')]({'where':{'id':_0x1db38c[_0x66e6('0x52')]['id']}})[_0x66e6('0x23')](handleEntityNotFound(_0x3086d2,null))[_0x66e6('0x23')](saveUpdates(_0x1db38c[_0x66e6('0x56')],null))['then'](respondWithResult(_0x3086d2,null))[_0x66e6('0x2d')](handleError(_0x3086d2,null));};exports[_0x66e6('0x58')]=function(_0x1e2ce1,_0x50f54c){return db[_0x66e6('0x3d')][_0x66e6('0x57')]({'where':{'id':_0x1e2ce1[_0x66e6('0x52')]['id']}})[_0x66e6('0x23')](handleEntityNotFound(_0x50f54c,null))['then'](removeEntity(_0x50f54c,null))[_0x66e6('0x2d')](handleError(_0x50f54c,null));};exports['describe']=function(_0x1ae5c5,_0x528163){return db['OpenchannelMessage'][_0x66e6('0x59')]()[_0x66e6('0x23')](respondWithResult(_0x528163,null))[_0x66e6('0x2d')](handleError(_0x528163,null));};var interaction_log=require(_0x66e6('0x16'))('openchannel-interactions');exports['accept']=function(_0x56784b,_0x3ac85c,_0x3bbe78){var _0x1f9069={'agent':{},'channel':'openchannel'};if(_0x56784b[_0x66e6('0x56')]['id']){delete _0x56784b[_0x66e6('0x56')]['id'];}_0x56784b['body']['read']=!![];_0x56784b['body']['readAt']=moment()['format'](_0x66e6('0x5a'));_0x56784b[_0x66e6('0x56')]['UserId']=_0x56784b['body']['UserId']||_0x56784b[_0x66e6('0x5b')]['id'];_0x1f9069[_0x66e6('0x5c')]['id']=_0x56784b['body'][_0x66e6('0x5d')];return db[_0x66e6('0x3d')][_0x66e6('0x57')]({'where':{'id':_0x56784b[_0x66e6('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3ac85c,null))[_0x66e6('0x23')](saveUpdates(_0x56784b[_0x66e6('0x56')],null))[_0x66e6('0x23')](function(_0x34e33c){if(_0x34e33c){_0x1f9069[_0x66e6('0x2b')]=_0x34e33c[_0x66e6('0x5e')]({'plain':!![]});return db[_0x66e6('0x5f')][_0x66e6('0x57')]({'where':{'id':_0x34e33c[_0x66e6('0x60')]}});}return null;})[_0x66e6('0x23')](handleEntityNotFound(_0x3ac85c,null))['then'](function(_0x412690){if(_0x412690){return _0x412690['update']({'UserId':_0x56784b[_0x66e6('0x56')][_0x66e6('0x5d')],'read1stAt':_['isNil'](_0x412690[_0x66e6('0x61')])?moment()[_0x66e6('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x66e6('0x23')](function(_0x1e4e63){if(_0x1e4e63){_0x1f9069['interaction']=_0x1e4e63[_0x66e6('0x5e')]({'plain':!![]});interaction_log[_0x66e6('0x24')](_0x66e6('0x63'),_0x56784b['user']['id'],_0x56784b['user']['name'],_0x56784b[_0x66e6('0x5b')][_0x66e6('0x64')],_0x1f9069[_0x66e6('0x65')]['id'],_0x56784b[_0x66e6('0x56')]?JSON[_0x66e6('0x28')](_0x56784b['body']):_0x66e6('0x66'));return respondWithRpcPromise(_0x66e6('0x67'),_0x66e6('0x68'),_0x1f9069);}return null;})[_0x66e6('0x23')](function(_0x3c54b7){var _0x5e3256=_0x66e6('0x69')+_0x3c54b7[_0x66e6('0x2b')][_0x66e6('0x6a')];return db['sequelize'][_0x66e6('0x42')](_0x5e3256,{'type':db[_0x66e6('0x6b')][_0x66e6('0x6c')][_0x66e6('0x6d')],'raw':!![]})[_0x66e6('0x23')](function(_0x4f46b3){return _0x4f46b3;});})['then'](function(_0x2f53f9){if(_0x2f53f9){_0x1f9069[_0x66e6('0x2b')][_0x66e6('0x6e')]=_0x2f53f9[0x0];if(!_0x56784b['body'][_0x66e6('0x5d')])return;return db['User'][_0x66e6('0x57')]({'where':{'id':_0x56784b[_0x66e6('0x56')][_0x66e6('0x5d')],'role':_0x66e6('0x5c')},'attributes':['id',_0x66e6('0x3a'),_0x66e6('0x6f'),_0x66e6('0x70'),'internal'],'raw':!![]});}return null;})[_0x66e6('0x23')](function(_0x212ed2){if(!_0x212ed2)return null;_0x1f9069['message'][_0x66e6('0x5c')]=_0x212ed2;return _0x1f9069;})[_0x66e6('0x23')](function(_0x1f3f55){if(_0x1f3f55){if(_0x56784b[_0x66e6('0x56')]['manual']){_0x1f9069[_0x66e6('0x2b')][_0x66e6('0x71')]=util['format']('SIP/%s',_0x56784b[_0x66e6('0x5b')][_0x66e6('0x3a')]);_0x1f9069[_0x66e6('0x2b')][_0x66e6('0x72')]=_0x1f9069['channel'];_0x1f9069[_0x66e6('0x2b')][_0x66e6('0x73')]=_0x1f9069[_0x66e6('0x72')];_0x1f9069[_0x66e6('0x2b')][_0x66e6('0x74')]='accept';return respondWithRpcPromise(_0x66e6('0x75'),'EventManager',{'event':_0x66e6('0x76'),'message':_0x1f9069[_0x66e6('0x2b')]},client9002)[_0x66e6('0x23')](function(){return _0x1f9069;});}return _0x1f9069;}return null;})[_0x66e6('0x23')](respondWithResult(_0x3ac85c,null))[_0x66e6('0x2d')](handleError(_0x3ac85c,null));};var interaction_log=require(_0x66e6('0x16'))(_0x66e6('0x77'));exports[_0x66e6('0x78')]=function(_0x3ebc66,_0x19ea66,_0x3e7c2c){var _0x3376a9={'agent':{},'channel':_0x66e6('0x79')};if(_0x3ebc66[_0x66e6('0x56')]['id']){delete _0x3ebc66[_0x66e6('0x56')]['id'];}_0x3ebc66[_0x66e6('0x56')]['UserId']=_0x3ebc66[_0x66e6('0x56')][_0x66e6('0x5d')]||_0x3ebc66[_0x66e6('0x5b')]['id'];_0x3376a9[_0x66e6('0x5c')]['id']=_0x3ebc66['body'][_0x66e6('0x5d')];return db[_0x66e6('0x3d')]['find']({'where':{'id':_0x3ebc66[_0x66e6('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x19ea66,null))[_0x66e6('0x23')](function(_0x5bc317){if(_0x5bc317){_0x3376a9[_0x66e6('0x2b')]=_0x5bc317[_0x66e6('0x5e')]({'plain':!![]});return db[_0x66e6('0x5f')][_0x66e6('0x57')]({'where':{'id':_0x5bc317[_0x66e6('0x60')]}});}return null;})[_0x66e6('0x23')](handleEntityNotFound(_0x19ea66,null))[_0x66e6('0x23')](function(_0x318e54){if(_0x318e54){_0x3376a9[_0x66e6('0x65')]=_0x318e54[_0x66e6('0x5e')]({'plain':!![]});interaction_log['info'](_0x66e6('0x7a'),_0x3ebc66['user']['id'],_0x3ebc66[_0x66e6('0x5b')]['name'],_0x3ebc66['user'][_0x66e6('0x64')],_0x3376a9['interaction']['id'],_0x3ebc66[_0x66e6('0x56')]?JSON['stringify'](_0x3ebc66[_0x66e6('0x56')]):_0x66e6('0x66'));return respondWithRpcPromise(_0x66e6('0x7b'),_0x66e6('0x7c'),_0x3376a9);}return null;})[_0x66e6('0x23')](function(_0x1fa9bc){var _0x20adcf=_0x66e6('0x69')+_0x1fa9bc[_0x66e6('0x2b')][_0x66e6('0x6a')];return db[_0x66e6('0x7d')][_0x66e6('0x42')](_0x20adcf,{'type':db[_0x66e6('0x6b')]['QueryTypes'][_0x66e6('0x6d')],'raw':!![]})['then'](function(_0x347221){return _0x347221;});})[_0x66e6('0x23')](function(_0x4c3595){if(_0x4c3595){_0x3376a9[_0x66e6('0x2b')]['contact']=_0x4c3595[0x0];if(!_0x3ebc66[_0x66e6('0x56')][_0x66e6('0x5d')])return;return db['User'][_0x66e6('0x57')]({'where':{'id':_0x3ebc66['body'][_0x66e6('0x5d')],'role':_0x66e6('0x5c')},'attributes':['id',_0x66e6('0x3a'),_0x66e6('0x6f'),_0x66e6('0x70'),_0x66e6('0x7e')],'raw':!![]});}return null;})[_0x66e6('0x23')](function(_0x5b8766){if(!_0x5b8766)return null;_0x3376a9['message']['agent']=_0x5b8766;return _0x3376a9;})[_0x66e6('0x23')](function(_0x10cb1e){if(_0x10cb1e){_0x10cb1e[_0x66e6('0x2b')][_0x66e6('0x71')]=util[_0x66e6('0x62')](_0x66e6('0x7f'),_0x3ebc66['user'][_0x66e6('0x3a')]);_0x10cb1e[_0x66e6('0x2b')][_0x66e6('0x72')]=_0x3376a9[_0x66e6('0x72')];_0x10cb1e['message'][_0x66e6('0x73')]=_0x3376a9[_0x66e6('0x72')];_0x10cb1e[_0x66e6('0x2b')][_0x66e6('0x74')]=_0x66e6('0x78');respondWithRpcPromise(_0x66e6('0x75'),_0x66e6('0x75'),{'event':_0x66e6('0x80'),'message':_0x10cb1e[_0x66e6('0x2b')]},client9002);return _0x3376a9;}return null;})[_0x66e6('0x23')](respondWithResult(_0x19ea66,null))[_0x66e6('0x2d')](handleError(_0x19ea66,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index cf6bc6c..807318a 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 _0xc6ef=['hasOwnProperty','hook','exports','events','OpenchannelMessage','save','remove','emit'];(function(_0x400cdb,_0x190069){var _0x2e860e=function(_0x36f1ca){while(--_0x36f1ca){_0x400cdb['push'](_0x400cdb['shift']());}};_0x2e860e(++_0x190069);}(_0xc6ef,0x193));var _0xfc6e=function(_0x93154a,_0x1c8b9e){_0x93154a=_0x93154a-0x0;var _0x45e518=_0xc6ef[_0x93154a];return _0x45e518;};'use strict';var EventEmitter=require(_0xfc6e('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xfc6e('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfc6e('0x2'),'afterUpdate':'update','afterDestroy':_0xfc6e('0x3')};function emitEvent(_0x1d4c95){return function(_0x5a8ca2,_0x55b842,_0x40de17){OpenchannelMessageEvents[_0xfc6e('0x4')](_0x1d4c95+':'+_0x5a8ca2['id'],_0x5a8ca2);OpenchannelMessageEvents[_0xfc6e('0x4')](_0x1d4c95,_0x5a8ca2);_0x40de17(null);};}for(var e in events){if(events[_0xfc6e('0x5')](e)){var event=events[e];OpenchannelMessage[_0xfc6e('0x6')](e,emitEvent(event));}}module[_0xfc6e('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xb3eb=['update','emit','exports','events','setMaxListeners','save'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xb3eb,0x87));var _0xbb3e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb3eb[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xbb3e('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xbb3e('0x1')](0x0);var events={'afterCreate':_0xbb3e('0x2'),'afterUpdate':_0xbb3e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5beeb1){return function(_0x467252,_0x14b924,_0x250617){OpenchannelMessageEvents[_0xbb3e('0x4')](_0x5beeb1+':'+_0x467252['id'],_0x467252);OpenchannelMessageEvents['emit'](_0x5beeb1,_0x467252);_0x250617(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xbb3e('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 8a697b8..5c096b8 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 _0x081a=['omit','POST','GET','OpenchannelMessage,\x20%s,\x20%s','threadId','Interaction','finally','utf8mb4','util','../../config/logger','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','isNil','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','catch','error','out','secret','describe','OpenchannelAccount','Interactions','Contact','keys','replyUri','info','afterCreate','format','length'];(function(_0x150974,_0x5a245d){var _0x2b149b=function(_0x238997){while(--_0x238997){_0x150974['push'](_0x150974['shift']());}};_0x2b149b(++_0x5a245d);}(_0x081a,0x194));var _0xa081=function(_0x112022,_0x117f45){_0x112022=_0x112022-0x0;var _0x40c214=_0x081a[_0x112022];return _0x40c214;};'use strict';var _=require('lodash');var util=require(_0xa081('0x0'));var logger=require(_0xa081('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa081('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa081('0x3'));var config=require(_0xa081('0x4'));var attributes=require(_0xa081('0x5'));module[_0xa081('0x6')]=function(_0x391b5e,_0x1f667a){return _0x391b5e[_0xa081('0x7')](_0xa081('0x8'),attributes,{'tableName':_0xa081('0x9'),'paranoid':![],'indexes':[{'name':_0xa081('0xa'),'fields':[_0xa081('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10f515,_0x2567ee,_0x40b5cd){var _0x293be4=_0x391b5e[_0xa081('0xc')];var _0x5ec2b5=_0x10f515[_0xa081('0xd')]({'plain':!![]});if(_0x5ec2b5[_0xa081('0xe')]['toLowerCase']()==='in'||_0x5ec2b5['direction'][_0xa081('0xf')]()==='out'&&!_0x5ec2b5['secret']&&!_[_0xa081('0x10')](_0x5ec2b5['UserId'])){_0x293be4[_0xa081('0x11')]['findOne']({'where':{'id':_0x5ec2b5[_0xa081('0x12')]}})[_0xa081('0x13')](function(_0x48439f){if(_0x48439f){_0x48439f[_0xa081('0x14')]({'lastMsgAt':_0x5ec2b5[_0xa081('0x15')],'lastMsgDirection':_0x5ec2b5[_0xa081('0xe')]['toLowerCase']()});}})[_0xa081('0x16')](function(_0x50ccac){console[_0xa081('0x17')](_0x50ccac);});}if(_0x5ec2b5[_0xa081('0xe')]===_0xa081('0x18')&&!_0x5ec2b5[_0xa081('0x19')]){var _0x3276d4;_0x293be4['CmContact'][_0xa081('0x1a')]()[_0xa081('0x13')](function(_0x3b18fd){return _0x293be4[_0xa081('0x1b')]['find']({'where':{'id':_0x5ec2b5['OpenchannelAccountId']},'include':[{'model':_0x293be4[_0xa081('0x11')],'as':_0xa081('0x1c'),'where':{'id':_0x5ec2b5['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x293be4['CmContact'],'as':_0xa081('0x1d'),'attributes':_[_0xa081('0x1e')](_0x3b18fd)}]}]});})[_0xa081('0x13')](function(_0x3340de){_0x3276d4=_0x3340de['get']({'plain':!![]});if(_0x3276d4&&_0x3276d4[_0xa081('0x1f')]){logger[_0xa081('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0xa081('0x21'),util[_0xa081('0x22')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x5ec2b5['id'],_0x3276d4[_0xa081('0x1f')]));if(_0x3276d4[_0xa081('0x1c')]&&_0x3276d4[_0xa081('0x1c')][_0xa081('0x23')]){_0x5ec2b5['Interaction']=_[_0xa081('0x24')](_0x3276d4[_0xa081('0x1c')][0x0],_0xa081('0x1d'));_0x5ec2b5[_0xa081('0x1d')]=_0x3276d4[_0xa081('0x1c')][0x0][_0xa081('0x1d')];}var _0x2567ee={'method':_0xa081('0x25'),'uri':encodeURI(_0x3276d4[_0xa081('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2567ee['method']){case _0xa081('0x26'):_0x2567ee['qs']=_0x5ec2b5;break;case'POST':_0x2567ee['body']=_0x5ec2b5;break;}return rp(_0x2567ee)[_0xa081('0x13')](function(_0x342026){logger[_0xa081('0x20')](_0xa081('0x27'),_0xa081('0x21'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x5ec2b5['id'],_0x3276d4[_0xa081('0x1f')]));if(_0x342026[_0xa081('0xb')][_0xa081('0x28')]&&_0x342026[_0xa081('0xb')]['threadId']!=_0x5ec2b5[_0xa081('0x29')][_0xa081('0x28')]){return _0x293be4[_0xa081('0x11')]['update']({'threadId':_0x342026[_0xa081('0xb')][_0xa081('0x28')]},{'where':{'id':_0x5ec2b5[_0xa081('0x29')]['id']}});}else{return;}})[_0xa081('0x13')](function(){return _0x10f515['update']({'read':!![]});})[_0xa081('0x16')](function(_0x2f8c95){logger[_0xa081('0x17')](_0xa081('0x27'),_0xa081('0x21'),util['inspect'](_0x2f8c95,{'showHidden':![],'depth':null}));_0x40b5cd();});}else{_0x40b5cd();}})[_0xa081('0x2a')](function(){_0x40b5cd();});}else{_0x40b5cd();}}},'charset':_0xa081('0x2b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdd1c=['bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','omit','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','body','threadId','Interaction','inspect','finally','utf8mb4','lodash','../../config/logger','api','moment'];(function(_0x11aecd,_0x4bbeaf){var _0x40bfef=function(_0x2ff63a){while(--_0x2ff63a){_0x11aecd['push'](_0x11aecd['shift']());}};_0x40bfef(++_0x4bbeaf);}(_0xdd1c,0x168));var _0xcdd1=function(_0x1bf301,_0xda5c4c){_0x1bf301=_0x1bf301-0x0;var _0x51c947=_0xdd1c[_0x1bf301];return _0x51c947;};'use strict';var _=require(_0xcdd1('0x0'));var util=require('util');var logger=require(_0xcdd1('0x1'))(_0xcdd1('0x2'));var moment=require(_0xcdd1('0x3'));var BPromise=require(_0xcdd1('0x4'));var rp=require(_0xcdd1('0x5'));var fs=require('fs');var path=require(_0xcdd1('0x6'));var rimraf=require(_0xcdd1('0x7'));var config=require('../../config/environment');var attributes=require(_0xcdd1('0x8'));module[_0xcdd1('0x9')]=function(_0x325b23,_0x1bb0db){return _0x325b23[_0xcdd1('0xa')](_0xcdd1('0xb'),attributes,{'tableName':_0xcdd1('0xc'),'paranoid':![],'indexes':[{'name':_0xcdd1('0xd'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x24fcd2,_0x2327a7,_0x336860){var _0x363abc=_0x325b23['models'];var _0x29ff54=_0x24fcd2[_0xcdd1('0xe')]({'plain':!![]});if(_0x29ff54[_0xcdd1('0xf')][_0xcdd1('0x10')]()==='in'||_0x29ff54[_0xcdd1('0xf')]['toLowerCase']()===_0xcdd1('0x11')&&!_0x29ff54[_0xcdd1('0x12')]&&!_[_0xcdd1('0x13')](_0x29ff54[_0xcdd1('0x14')])){_0x363abc[_0xcdd1('0x15')]['findOne']({'where':{'id':_0x29ff54[_0xcdd1('0x16')]}})[_0xcdd1('0x17')](function(_0x1cc2d0){if(_0x1cc2d0){_0x1cc2d0[_0xcdd1('0x18')]({'lastMsgAt':_0x29ff54['createdAt'],'lastMsgDirection':_0x29ff54[_0xcdd1('0xf')]['toLowerCase']()});}})[_0xcdd1('0x19')](function(_0x2ed96f){console[_0xcdd1('0x1a')](_0x2ed96f);});}if(_0x29ff54[_0xcdd1('0xf')]===_0xcdd1('0x11')&&!_0x29ff54[_0xcdd1('0x12')]){var _0x1835f5;_0x363abc[_0xcdd1('0x1b')][_0xcdd1('0x1c')]()[_0xcdd1('0x17')](function(_0x38f4c3){return _0x363abc[_0xcdd1('0x1d')][_0xcdd1('0x1e')]({'where':{'id':_0x29ff54[_0xcdd1('0x1f')]},'include':[{'model':_0x363abc[_0xcdd1('0x15')],'as':'Interactions','where':{'id':_0x29ff54[_0xcdd1('0x16')]},'limit':0x1,'include':[{'model':_0x363abc[_0xcdd1('0x1b')],'as':_0xcdd1('0x20'),'attributes':_['keys'](_0x38f4c3)}]}]});})[_0xcdd1('0x17')](function(_0x1d2d27){_0x1835f5=_0x1d2d27[_0xcdd1('0xe')]({'plain':!![]});if(_0x1835f5&&_0x1835f5[_0xcdd1('0x21')]){logger[_0xcdd1('0x22')](_0xcdd1('0x23'),_0xcdd1('0x24'),util[_0xcdd1('0x25')](_0xcdd1('0x26'),_0x29ff54['id'],_0x1835f5[_0xcdd1('0x21')]));if(_0x1835f5['Interactions']&&_0x1835f5[_0xcdd1('0x27')][_0xcdd1('0x28')]){_0x29ff54['Interaction']=_[_0xcdd1('0x29')](_0x1835f5[_0xcdd1('0x27')][0x0],_0xcdd1('0x20'));_0x29ff54[_0xcdd1('0x20')]=_0x1835f5['Interactions'][0x0][_0xcdd1('0x20')];}var _0x2327a7={'method':_0xcdd1('0x2a'),'uri':encodeURI(_0x1835f5['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2327a7[_0xcdd1('0x2b')]){case _0xcdd1('0x2c'):_0x2327a7['qs']=_0x29ff54;break;case'POST':_0x2327a7['body']=_0x29ff54;break;}return rp(_0x2327a7)[_0xcdd1('0x17')](function(_0x421b4a){logger[_0xcdd1('0x22')](_0xcdd1('0x23'),'afterCreate',util[_0xcdd1('0x25')](_0xcdd1('0x2d'),_0x29ff54['id'],_0x1835f5[_0xcdd1('0x21')]));if(_0x421b4a[_0xcdd1('0x2e')][_0xcdd1('0x2f')]&&_0x421b4a[_0xcdd1('0x2e')][_0xcdd1('0x2f')]!=_0x29ff54['Interaction'][_0xcdd1('0x2f')]){return _0x363abc['OpenchannelInteraction'][_0xcdd1('0x18')]({'threadId':_0x421b4a[_0xcdd1('0x2e')][_0xcdd1('0x2f')]},{'where':{'id':_0x29ff54[_0xcdd1('0x30')]['id']}});}else{return;}})['then'](function(){return _0x24fcd2[_0xcdd1('0x18')]({'read':!![]});})[_0xcdd1('0x19')](function(_0x41a7ff){logger[_0xcdd1('0x1a')]('OpenchannelMessage,\x20%s,\x20%s',_0xcdd1('0x24'),util[_0xcdd1('0x31')](_0x41a7ff,{'showHidden':![],'depth':null}));_0x336860();});}else{_0x336860();}})[_0xcdd1('0x32')](function(){_0x336860();});}else{_0x336860();}}},'charset':_0xcdd1('0x33'),'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 e472063..36c7a37 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x45e323,_0x58621e){var _0x38f1c0=function(_0x38071b){while(--_0x38071b){_0x45e323['push'](_0x45e323['shift']());}};_0x38f1c0(++_0x58621e);}(_0x1261,0x144));var _0x1126=function(_0x162ee0,_0x291661){_0x162ee0=_0x162ee0-0x0;var _0x48fc5e=_0x1261[_0x162ee0];return _0x48fc5e;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x182475,_0x59cc18){var _0x1a2ef6=function(_0x4e4f2e){while(--_0x4e4f2e){_0x182475['push'](_0x182475['shift']());}};_0x1a2ef6(++_0x59cc18);}(_0x1261,0x144));var _0x1126=function(_0xb6ea0a,_0x483190){_0xb6ea0a=_0xb6ea0a-0x0;var _0x397ff4=_0x1261[_0xb6ea0a];return _0x397ff4;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 268d5bd..0dfd6b1 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 _0xbda9=['openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x17ec7e,_0x95af77){var _0x343283=function(_0x472a22){while(--_0x472a22){_0x17ec7e['push'](_0x17ec7e['shift']());}};_0x343283(++_0x95af77);}(_0xbda9,0x101));var _0x9bda=function(_0x37752c,_0x20d239){_0x37752c=_0x37752c-0x0;var _0x41b47f=_0xbda9[_0x37752c];return _0x41b47f;};'use strict';var OpenchannelMessageEvents=require(_0x9bda('0x0'));var events=[_0x9bda('0x1'),_0x9bda('0x2'),_0x9bda('0x3')];function createListener(_0x31930d,_0x14ae0f){return function(_0x29f172){_0x14ae0f[_0x9bda('0x4')](_0x31930d,_0x29f172);};}function removeListener(_0x146cd0,_0x5eae39){return function(){OpenchannelMessageEvents[_0x9bda('0x5')](_0x146cd0,_0x5eae39);};}exports[_0x9bda('0x6')]=function(_0x26544e){for(var _0x4d2979=0x0,_0xaf199d=events['length'];_0x4d2979<_0xaf199d;_0x4d2979++){var _0x5c2623=events[_0x4d2979];var _0x1f0a0d=createListener(_0x9bda('0x7')+_0x5c2623,_0x26544e);OpenchannelMessageEvents['on'](_0x5c2623,_0x1f0a0d);}}; \ No newline at end of file +var _0x1c74=['emit','removeListener','register','openchannelMessage:','save','update'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1c74,0xac));var _0x41c7=function(_0x5cacc6,_0x4ab8a9){_0x5cacc6=_0x5cacc6-0x0;var _0x2ba4c7=_0x1c74[_0x5cacc6];return _0x2ba4c7;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x41c7('0x0'),'remove',_0x41c7('0x1')];function createListener(_0x435fa5,_0x2c7f00){return function(_0x4e3738){_0x2c7f00[_0x41c7('0x2')](_0x435fa5,_0x4e3738);};}function removeListener(_0x6a4c6f,_0x31b921){return function(){OpenchannelMessageEvents[_0x41c7('0x3')](_0x6a4c6f,_0x31b921);};}exports[_0x41c7('0x4')]=function(_0x24435f){for(var _0x22d9cb=0x0,_0x39f21f=events['length'];_0x22d9cb<_0x39f21f;_0x22d9cb++){var _0x54a5d5=events[_0x22d9cb];var _0x4baa4f=createListener(_0x41c7('0x5')+_0x54a5d5,_0x24435f);OpenchannelMessageEvents['on'](_0x54a5d5,_0x4baa4f);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index a3564e1..a61b0ae 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 _0x7b20=['delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','put','update'];(function(_0x1b5ae7,_0x61fb72){var _0xde4819=function(_0x50bd11){while(--_0x50bd11){_0x1b5ae7['push'](_0x1b5ae7['shift']());}};_0xde4819(++_0x61fb72);}(_0x7b20,0xf7));var _0x07b2=function(_0x22e77d,_0x5c431c){_0x22e77d=_0x22e77d-0x0;var _0x42e75e=_0x7b20[_0x22e77d];return _0x42e75e;};'use strict';var multer=require(_0x07b2('0x0'));var util=require(_0x07b2('0x1'));var path=require('path');var timeout=require(_0x07b2('0x2'));var express=require(_0x07b2('0x3'));var router=express[_0x07b2('0x4')]();var fs_extra=require(_0x07b2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x07b2('0x6'));var config=require('../../config/environment');var controller=require(_0x07b2('0x7'));router[_0x07b2('0x8')]('/',auth[_0x07b2('0x9')](),controller[_0x07b2('0xa')]);router[_0x07b2('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x07b2('0xb')]);router[_0x07b2('0x8')](_0x07b2('0xc'),auth[_0x07b2('0x9')](),controller[_0x07b2('0xd')]);router['get'](_0x07b2('0xe'),auth[_0x07b2('0x9')](),controller[_0x07b2('0xf')]);router['get'](_0x07b2('0x10'),auth[_0x07b2('0x9')](),controller['getTeams']);router['get'](_0x07b2('0x11'),auth[_0x07b2('0x9')](),controller[_0x07b2('0x12')]);router[_0x07b2('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x07b2('0x13')]('/:id/teams',auth[_0x07b2('0x9')](),controller[_0x07b2('0x14')]);router['post'](_0x07b2('0x11'),auth[_0x07b2('0x9')](),controller['addAgents']);router[_0x07b2('0x15')](_0x07b2('0xc'),auth[_0x07b2('0x9')](),controller[_0x07b2('0x16')]);router[_0x07b2('0x17')](_0x07b2('0xc'),auth[_0x07b2('0x9')](),controller['destroy']);router[_0x07b2('0x17')](_0x07b2('0x10'),auth[_0x07b2('0x9')](),controller[_0x07b2('0x18')]);router[_0x07b2('0x17')](_0x07b2('0x11'),auth[_0x07b2('0x9')](),controller[_0x07b2('0x19')]);module[_0x07b2('0x1a')]=router; \ No newline at end of file +var _0x839a=['/:id/members','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x839a,0x179));var _0xa839=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x839a[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa839('0x0'));var express=require(_0xa839('0x1'));var router=express[_0xa839('0x2')]();var fs_extra=require(_0xa839('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa839('0x4'));var controller=require(_0xa839('0x5'));router[_0xa839('0x6')]('/',auth[_0xa839('0x7')](),controller[_0xa839('0x8')]);router[_0xa839('0x6')](_0xa839('0x9'),auth[_0xa839('0x7')](),controller[_0xa839('0xa')]);router[_0xa839('0x6')](_0xa839('0xb'),auth[_0xa839('0x7')](),controller[_0xa839('0xc')]);router['get'](_0xa839('0xd'),auth[_0xa839('0x7')](),controller['getMembers']);router['get']('/:id/teams',auth[_0xa839('0x7')](),controller['getTeams']);router[_0xa839('0x6')](_0xa839('0xe'),auth['isAuthenticated'](),controller['getAgents']);router[_0xa839('0xf')]('/',auth['isAuthenticated'](),controller[_0xa839('0x10')]);router[_0xa839('0xf')](_0xa839('0x11'),auth[_0xa839('0x7')](),controller[_0xa839('0x12')]);router[_0xa839('0xf')](_0xa839('0xe'),auth[_0xa839('0x7')](),controller[_0xa839('0x13')]);router[_0xa839('0x14')](_0xa839('0xb'),auth[_0xa839('0x7')](),controller[_0xa839('0x15')]);router[_0xa839('0x16')](_0xa839('0xb'),auth['isAuthenticated'](),controller[_0xa839('0x17')]);router[_0xa839('0x16')](_0xa839('0x11'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xa839('0x16')](_0xa839('0xe'),auth['isAuthenticated'](),controller[_0xa839('0x18')]);module[_0xa839('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 4b2bee8..614b740 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 _0x37f2=['STRING','name','INTEGER','rrmemory','beepall','sequelize'];(function(_0x2e867a,_0x2fa5a7){var _0x285886=function(_0x42c737){while(--_0x42c737){_0x2e867a['push'](_0x2e867a['shift']());}};_0x285886(++_0x2fa5a7);}(_0x37f2,0x13d));var _0x237f=function(_0x12b961,_0x230462){_0x12b961=_0x12b961-0x0;var _0x3583d7=_0x37f2[_0x12b961];return _0x3583d7;};'use strict';var Sequelize=require(_0x237f('0x0'));module['exports']={'name':{'type':Sequelize[_0x237f('0x1')],'unique':_0x237f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x237f('0x1')]},'timeout':{'type':Sequelize[_0x237f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x237f('0x4'),_0x237f('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x02d5=['exports','STRING','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x2493a8,_0x5a240d){var _0x2b06c9=function(_0x198d3c){while(--_0x198d3c){_0x2493a8['push'](_0x2493a8['shift']());}};_0x2b06c9(++_0x5a240d);}(_0x02d5,0x68));var _0x502d=function(_0x552fce,_0x3f24bc){_0x552fce=_0x552fce-0x0;var _0x3e27a2=_0x02d5[_0x552fce];return _0x3e27a2;};'use strict';var Sequelize=require(_0x502d('0x0'));module[_0x502d('0x1')]={'name':{'type':Sequelize[_0x502d('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x502d('0x2')]},'timeout':{'type':Sequelize[_0x502d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x502d('0x4')]('rrmemory',_0x502d('0x5'),_0x502d('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 93b4be2..ecadc45 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 _0x4195=['OpenchannelQueueId\x20=\x20?','clone','toString','includes','union','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','userOpenchannelQueue:save','isArray','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','then','get','OpenchannelQueues','UserProfileResource','stack','name','send','OpenchannelQueue','rawAttributes','fieldName','type','getOptions','where','include','query','findAll','params','model','keys','filters','attributes','fields','length','merge','options','find','create','body','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','findOne','UserOpenchannelQueue','intersection','hasOwnProperty','order','sort','OpenchannelQueueId','filter','map','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','%s/%s','SIP','getTeams','pick','nolimit','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','Team','field','tq.TeamId','from','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId'];(function(_0x2753e7,_0x2ca3c1){var _0x154298=function(_0x2a485d){while(--_0x2a485d){_0x2753e7['push'](_0x2753e7['shift']());}};_0x154298(++_0x2ca3c1);}(_0x4195,0xec));var _0x5419=function(_0xf915a7,_0x3c5104){_0xf915a7=_0xf915a7-0x0;var _0x714195=_0x4195[_0xf915a7];return _0x714195;};'use strict';var BPromise=require(_0x5419('0x0'));var util=require('util');var _=require(_0x5419('0x1'));var squel=require('squel');var Redis=require(_0x5419('0x2'));var qs=require(_0x5419('0x3'));var logger=require(_0x5419('0x4'))(_0x5419('0x5'));var config=require(_0x5419('0x6'));var db=require(_0x5419('0x7'))['db'];config[_0x5419('0x8')]=_[_0x5419('0x9')](config[_0x5419('0x8')],{'host':_0x5419('0xa'),'port':0x18eb});var socket=require(_0x5419('0xb'))(new Redis(config['redis']));require(_0x5419('0xc'))[_0x5419('0xd')](socket);function respondWithStatusCode(_0x53b7c4,_0x1b2964){_0x1b2964=_0x1b2964||0xcc;return function(_0x28302a){if(_0x28302a){return _0x53b7c4[_0x5419('0xe')](_0x1b2964);}return _0x53b7c4['status'](_0x1b2964)[_0x5419('0xf')]();};}function respondWithResult(_0x3e9538,_0x1a8d96){_0x1a8d96=_0x1a8d96||0xc8;return function(_0x1be9e4){if(_0x1be9e4){return _0x3e9538[_0x5419('0x10')](_0x1a8d96)['json'](_0x1be9e4);}};}function respondWithFilteredResult(_0x580fc4,_0x1f077a){return function(_0x1838e7){if(_0x1838e7){var _0x25ee98=typeof _0x1f077a['offset']===_0x5419('0x11')&&typeof _0x1f077a[_0x5419('0x12')]===_0x5419('0x11');var _0xa00e57=_0x1838e7[_0x5419('0x13')];var _0x3f265b=_0x25ee98?0x0:_0x1f077a[_0x5419('0x14')];var _0xb9a566=_0x25ee98?_0x1838e7['count']:_0x1f077a[_0x5419('0x14')]+_0x1f077a[_0x5419('0x12')];var _0x6e7f11;if(_0xb9a566>=_0xa00e57){_0xb9a566=_0xa00e57;_0x6e7f11=0xc8;}else{_0x6e7f11=0xce;}_0x580fc4['status'](_0x6e7f11);return _0x580fc4[_0x5419('0x15')](_0x5419('0x16'),_0x3f265b+'-'+_0xb9a566+'/'+_0xa00e57)[_0x5419('0x17')](_0x1838e7);}return null;};}function saveUpdates(_0x187bb0){return function(_0x2b3123){if(_0x2b3123){return _0x2b3123['update'](_0x187bb0)[_0x5419('0x18')](function(_0x59a579){return _0x59a579;});}return null;};}function removeEntity(_0x49b781){return function(_0x3c70f3){if(_0x3c70f3){return _0x3c70f3['destroy']()[_0x5419('0x18')](function(){var _0x358b20=_0x3c70f3[_0x5419('0x19')]({'plain':!![]});var _0x2f4be1=_0x5419('0x1a');return db[_0x5419('0x1b')]['destroy']({'where':{'type':_0x2f4be1,'resourceId':_0x358b20['id']}})[_0x5419('0x18')](function(){return _0x3c70f3;});})[_0x5419('0x18')](function(){_0x49b781[_0x5419('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x391d84){return function(_0x54bb28){if(!_0x54bb28){_0x391d84[_0x5419('0xe')](0x194);}return _0x54bb28;};}function handleError(_0x5c894a,_0x44403e){_0x44403e=_0x44403e||0x1f4;return function(_0x2ccd4e){logger['error'](_0x2ccd4e[_0x5419('0x1c')]);if(_0x2ccd4e[_0x5419('0x1d')]){delete _0x2ccd4e[_0x5419('0x1d')];}_0x5c894a[_0x5419('0x10')](_0x44403e)[_0x5419('0x1e')](_0x2ccd4e);};}exports['index']=function(_0x17df8d,_0x5d77ac){var _0x4f0b96={};var _0x249fc7={'count':0x0,'rows':[]};var _0x4bd540=_['map'](db[_0x5419('0x1f')][_0x5419('0x20')],function(_0x3042c5){return{'name':_0x3042c5[_0x5419('0x21')],'type':_0x3042c5[_0x5419('0x22')]['key']};});_0x4f0b96=qs[_0x5419('0x23')](_0x4bd540,_0x17df8d);var _0x3e9009={'where':_0x4f0b96[_0x5419('0x24')]};return db[_0x5419('0x1f')]['count'](_0x3e9009)['then'](function(_0x2fb53c){_0x249fc7['count']=_0x2fb53c;_0x4f0b96[_0x5419('0x25')]=qs[_0x5419('0x25')](_0x17df8d[_0x5419('0x26')]);return db['OpenchannelQueue'][_0x5419('0x27')](_0x4f0b96);})['then'](function(_0x6c88bd){_0x249fc7['rows']=_0x6c88bd;return _0x249fc7;})[_0x5419('0x18')](respondWithFilteredResult(_0x5d77ac,_0x4f0b96))['catch'](handleError(_0x5d77ac,null));};exports['show']=function(_0x35681e,_0x2cf973){var _0x572c1d={'raw':!![],'where':{'id':_0x35681e[_0x5419('0x28')]['id']}},_0x40b10b={};_0x40b10b[_0x5419('0x29')]=_[_0x5419('0x2a')](db['OpenchannelQueue']['rawAttributes']);_0x40b10b[_0x5419('0x26')]=_['keys'](_0x35681e[_0x5419('0x26')]);_0x40b10b[_0x5419('0x2b')]=_['intersection'](_0x40b10b['model'],_0x40b10b[_0x5419('0x26')]);_0x572c1d[_0x5419('0x2c')]=_['intersection'](_0x40b10b[_0x5419('0x29')],qs[_0x5419('0x2d')](_0x35681e[_0x5419('0x26')][_0x5419('0x2d')]));_0x572c1d[_0x5419('0x2c')]=_0x572c1d[_0x5419('0x2c')][_0x5419('0x2e')]?_0x572c1d['attributes']:_0x40b10b['model'];if(_0x35681e['query']['includeAll']){_0x572c1d[_0x5419('0x25')]=[{'all':!![]}];}_0x572c1d=_[_0x5419('0x2f')]({},_0x572c1d,_0x35681e[_0x5419('0x30')]);return db['OpenchannelQueue'][_0x5419('0x31')](_0x572c1d)[_0x5419('0x18')](handleEntityNotFound(_0x2cf973,null))['then'](respondWithResult(_0x2cf973,null))['catch'](handleError(_0x2cf973,null));};exports[_0x5419('0x32')]=function(_0x918cf8,_0x509756){return db[_0x5419('0x1f')][_0x5419('0x32')](_0x918cf8[_0x5419('0x33')],{})[_0x5419('0x18')](function(_0x400fca){var _0x208a4f=_0x918cf8[_0x5419('0x34')][_0x5419('0x19')]({'plain':!![]});if(!_0x208a4f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x208a4f['role']==='user'){var _0x52808f=_0x400fca[_0x5419('0x19')]({'plain':!![]});var _0x380bf7=_0x5419('0x1a');return db['UserProfileSection']['find']({'where':{'name':_0x380bf7,'userProfileId':_0x208a4f[_0x5419('0x35')]},'raw':!![]})['then'](function(_0x1bebc5){if(_0x1bebc5&&_0x1bebc5[_0x5419('0x36')]===0x0){return db[_0x5419('0x1b')]['create']({'name':_0x52808f[_0x5419('0x1d')],'resourceId':_0x52808f['id'],'type':_0x1bebc5[_0x5419('0x1d')],'sectionId':_0x1bebc5['id']},{})[_0x5419('0x18')](function(){return _0x400fca;});}else{return _0x400fca;}})['catch'](function(_0x184351){logger[_0x5419('0x37')](_0x5419('0x38'),_0x184351);throw _0x184351;});}return _0x400fca;})['then'](respondWithResult(_0x509756,0xc9))[_0x5419('0x39')](handleError(_0x509756,null));};exports['update']=function(_0x113503,_0x31a6fd){if(_0x113503[_0x5419('0x33')]['id']){delete _0x113503[_0x5419('0x33')]['id'];}return db[_0x5419('0x1f')][_0x5419('0x31')]({'where':{'id':_0x113503[_0x5419('0x28')]['id']}})[_0x5419('0x18')](handleEntityNotFound(_0x31a6fd,null))['then'](saveUpdates(_0x113503[_0x5419('0x33')],null))[_0x5419('0x18')](respondWithResult(_0x31a6fd,null))[_0x5419('0x39')](handleError(_0x31a6fd,null));};exports['destroy']=function(_0x235887,_0xf52455){return db['OpenchannelQueue'][_0x5419('0x31')]({'where':{'id':_0x235887[_0x5419('0x28')]['id']}})[_0x5419('0x18')](handleEntityNotFound(_0xf52455,null))[_0x5419('0x18')](removeEntity(_0xf52455,null))[_0x5419('0x39')](handleError(_0xf52455,null));};exports['describe']=function(_0x5badb4,_0x39f820){return db[_0x5419('0x1f')]['describe']()[_0x5419('0x18')](respondWithResult(_0x39f820,null))[_0x5419('0x39')](handleError(_0x39f820,null));};exports['getMembers']=function(_0x23a1c8,_0xd5c41b){var _0x5379f4={'raw':!![],'where':{}},_0x266158={},_0x20c7fc;return db[_0x5419('0x1f')][_0x5419('0x3a')]({'where':{'id':_0x23a1c8['params']['id']}})[_0x5419('0x18')](handleEntityNotFound(_0xd5c41b,null))[_0x5419('0x18')](function(_0x4bedc5){if(_0x4bedc5){_0x20c7fc=_0x4bedc5['get']({'plain':!![]});_0x266158[_0x5419('0x29')]=_[_0x5419('0x2a')](db[_0x5419('0x3b')][_0x5419('0x20')]);_0x266158[_0x5419('0x26')]=_['keys'](_0x23a1c8[_0x5419('0x26')]);_0x266158[_0x5419('0x2b')]=_[_0x5419('0x3c')](_0x266158[_0x5419('0x29')],_0x266158[_0x5419('0x26')]);_0x5379f4[_0x5419('0x2c')]=_[_0x5419('0x3c')](_0x266158['model'],qs[_0x5419('0x2d')](_0x23a1c8[_0x5419('0x26')][_0x5419('0x2d')]));_0x5379f4[_0x5419('0x2c')]=_0x5379f4[_0x5419('0x2c')][_0x5419('0x2e')]?_0x5379f4[_0x5419('0x2c')]:_0x266158[_0x5419('0x29')];if(!_0x23a1c8[_0x5419('0x26')][_0x5419('0x3d')]('nolimit')){_0x5379f4[_0x5419('0x12')]=qs['limit'](_0x23a1c8['query'][_0x5419('0x12')]);_0x5379f4[_0x5419('0x14')]=qs[_0x5419('0x14')](_0x23a1c8['query'][_0x5419('0x14')]);}_0x5379f4[_0x5419('0x3e')]=qs[_0x5419('0x3f')](_0x23a1c8[_0x5419('0x26')][_0x5419('0x3f')]);_0x5379f4['where']=qs[_0x5419('0x2b')](_['pick'](_0x23a1c8[_0x5419('0x26')],_0x266158[_0x5419('0x2b')]));_0x5379f4['where'][_0x5419('0x40')]=_0x4bedc5['id'];if(_0x23a1c8[_0x5419('0x26')][_0x5419('0x41')]){_0x5379f4[_0x5419('0x24')]=_[_0x5419('0x2f')](_0x5379f4['where'],{'$or':_[_0x5419('0x42')](_0x5379f4[_0x5419('0x2c')],function(_0x49cc8b){var _0x53dd9c={};_0x53dd9c[_0x49cc8b]={'$like':'%'+_0x23a1c8[_0x5419('0x26')][_0x5419('0x41')]+'%'};return _0x53dd9c;})});}_0x5379f4=_[_0x5419('0x2f')]({},_0x5379f4,_0x23a1c8['options']);return db[_0x5419('0x3b')][_0x5419('0x27')](_0x5379f4);}})[_0x5419('0x18')](function(_0x43a761){if(_0x43a761){return db[_0x5419('0x43')][_0x5419('0x44')]({'where':{'id':_[_0x5419('0x42')](_0x43a761,_0x5419('0x45')),'role':_0x5419('0x46')},'attributes':['id',_0x5419('0x1d'),_0x5419('0x47'),'updatedAt',_0x5419('0x48')]});}})[_0x5419('0x18')](function(_0x326870){if(_0x326870){return{'count':_0x326870['count'],'rows':_[_0x5419('0x42')](_0x326870['rows'],function(_0x39f118){return{'membername':_0x39f118[_0x5419('0x1d')],'UserId':_0x39f118['id'],'queue_name':_0x20c7fc['name'],'OpenchannelQueueId':_0x20c7fc['id'],'interface':util[_0x5419('0x49')](_0x5419('0x4a'),_0x5419('0x4b'),_0x39f118[_0x5419('0x1d')]),'penalty':0x0,'paused':_0x39f118[_0x5419('0x47')],'createdAt':_0x39f118[_0x5419('0x48')],'updatedAt':_0x39f118['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xd5c41b,_0x5379f4))['catch'](handleError(_0xd5c41b,null));};exports[_0x5419('0x4c')]=function(_0x20e0a6,_0x2a1a98){var _0x7d1161={};var _0x4a9709={};var _0x511cfc;var _0x190b38;return db[_0x5419('0x1f')][_0x5419('0x3a')]({'where':{'id':_0x20e0a6[_0x5419('0x28')]['id']}})[_0x5419('0x18')](handleEntityNotFound(_0x2a1a98,null))[_0x5419('0x18')](function(_0x277f1f){if(_0x277f1f){_0x511cfc=_0x277f1f;_0x4a9709[_0x5419('0x29')]=_[_0x5419('0x2a')](db['Team'][_0x5419('0x20')]);_0x4a9709['query']=_[_0x5419('0x2a')](_0x20e0a6[_0x5419('0x26')]);_0x4a9709['filters']=_['intersection'](_0x4a9709['model'],_0x4a9709['query']);_0x7d1161[_0x5419('0x2c')]=_[_0x5419('0x3c')](_0x4a9709['model'],qs['fields'](_0x20e0a6[_0x5419('0x26')][_0x5419('0x2d')]));_0x7d1161[_0x5419('0x2c')]=_0x7d1161[_0x5419('0x2c')]['length']?_0x7d1161[_0x5419('0x2c')]:_0x4a9709[_0x5419('0x29')];_0x7d1161[_0x5419('0x3e')]=qs['sort'](_0x20e0a6[_0x5419('0x26')][_0x5419('0x3f')]);_0x7d1161[_0x5419('0x24')]=qs['filters'](_[_0x5419('0x4d')](_0x20e0a6['query'],_0x4a9709[_0x5419('0x2b')]));if(_0x20e0a6[_0x5419('0x26')][_0x5419('0x41')]){_0x7d1161[_0x5419('0x24')]=_[_0x5419('0x2f')](_0x7d1161[_0x5419('0x24')],{'$or':_[_0x5419('0x42')](_0x7d1161['attributes'],function(_0x5e0e14){var _0x3497b3={};_0x3497b3[_0x5e0e14]={'$like':'%'+_0x20e0a6['query'][_0x5419('0x41')]+'%'};return _0x3497b3;})});}_0x7d1161=_['merge']({},_0x7d1161,_0x20e0a6[_0x5419('0x30')]);return _0x511cfc['getTeams'](_0x7d1161);}})[_0x5419('0x18')](function(_0x3044c5){if(_0x3044c5){_0x190b38=_0x3044c5['length'];if(!_0x20e0a6[_0x5419('0x26')][_0x5419('0x3d')](_0x5419('0x4e'))){_0x7d1161['limit']=qs['limit'](_0x20e0a6['query']['limit']);_0x7d1161[_0x5419('0x14')]=qs[_0x5419('0x14')](_0x20e0a6[_0x5419('0x26')][_0x5419('0x14')]);}return _0x511cfc[_0x5419('0x4c')](_0x7d1161);}})['then'](function(_0xc2e0fe){if(_0xc2e0fe){return _0xc2e0fe?{'count':_0x190b38,'rows':_0xc2e0fe}:null;}})['then'](respondWithResult(_0x2a1a98,null))['catch'](handleError(_0x2a1a98,null));};exports[_0x5419('0x4f')]=function(_0x280f15,_0x401c05){var _0x3b9374=_0x280f15[_0x5419('0x33')][_0x5419('0x50')];return db['Team'][_0x5419('0x27')]({'where':{'id':_0x3b9374},'attributes':['id'],'include':[{'model':db[_0x5419('0x43')],'as':_0x5419('0x51'),'attributes':['id',_0x5419('0x1d'),'online',_0x5419('0x52'),_0x5419('0x53')],'raw':!![]}]})[_0x5419('0x18')](function(_0x1c2c21){if(_0x1c2c21){var _0x5d4950=_[_0x5419('0x54')](_0x1c2c21,function(_0x75d19d){var _0x478297=_0x75d19d[_0x5419('0x19')]({'plain':!![]});return _0x478297['Agents'];});return db[_0x5419('0x1f')][_0x5419('0x31')]({'where':{'id':_0x280f15[_0x5419('0x28')]['id']}})[_0x5419('0x18')](function(_0x263d40){return db[_0x5419('0x55')][_0x5419('0x56')](function(_0x43c3c3){return _0x263d40[_0x5419('0x4f')](_0x3b9374,{'transaction':_0x43c3c3})[_0x5419('0x18')](function(){return BPromise[_0x5419('0x57')](_0x5d4950,function(_0x3eee8b){return db[_0x5419('0x3b')][_0x5419('0x58')]({'where':{'UserId':_0x3eee8b['id'],'OpenchannelQueueId':_0x280f15[_0x5419('0x28')]['id']},'transaction':_0x43c3c3});});})[_0x5419('0x18')](function(){_0x5d4950[_0x5419('0x59')](function(_0xe87601){socket[_0x5419('0x5a')]('userOpenchannelQueue:save',{'UserId':_0xe87601['id'],'OpenchannelQueueId':_0x263d40['id']});});});});});}})[_0x5419('0x18')](respondWithStatusCode(_0x401c05,null))[_0x5419('0x39')](handleError(_0x401c05,null));};exports['removeTeams']=function(_0x53dbff,_0x3e2de3){return db[_0x5419('0x5b')][_0x5419('0x27')]({'where':{'id':_0x53dbff['query'][_0x5419('0x50')]},'attributes':['id'],'include':[{'model':db[_0x5419('0x43')],'as':_0x5419('0x51'),'attributes':['id'],'raw':!![]}]})[_0x5419('0x18')](handleEntityNotFound(_0x3e2de3,null))[_0x5419('0x18')](function(_0x420d82){var _0xb99843=_['map'](_0x420d82,'id');var _0x147052=[];var _0x5faceb=[];var _0x204fbf=squel['select']();_0x204fbf[_0x5419('0x5c')](_0x5419('0x5d'))[_0x5419('0x5e')](_0x5419('0x5f'),'tq')['join']('user_has_teams','ut',_0x5419('0x60'))[_0x5419('0x24')](_0x5419('0x61'),_0x53dbff[_0x5419('0x28')]['id']);for(var _0x3481d8=0x0;_0x3481d8<_0x420d82[_0x5419('0x2e')];_0x3481d8+=0x1){let _0xb49d1=_0x420d82[_0x3481d8];for(var _0xb9584b=0x0;_0xb9584b<_0xb49d1[_0x5419('0x51')][_0x5419('0x2e')];_0xb9584b+=0x1){let _0x1468d4=_0xb49d1[_0x5419('0x51')][_0xb9584b];var _0x342717=_0x204fbf[_0x5419('0x62')]();_0x342717[_0x5419('0x24')]('ut.UserId\x20=\x20?',_0x1468d4['id']);_0x5faceb['push'](db['sequelize']['query'](_0x342717[_0x5419('0x63')](),{'type':db[_0x5419('0x55')]['QueryTypes']['SELECT']})[_0x5419('0x18')](function(_0x3bc115){if(_0x3bc115[_0x5419('0x2e')]===0x1){return _0x1468d4['id'];}else{var _0x2786de=_['every'](_['map'](_0x3bc115,'TeamId'),function(_0x585320){return _[_0x5419('0x64')](_0xb99843,_0x585320);});if(_0x2786de){return _0x1468d4['id'];}}}));}}return BPromise['all'](_0x5faceb)[_0x5419('0x18')](function(_0x1a4653){_0x147052=_(_0x147052)[_0x5419('0x65')](_0x1a4653)['compact']()[_0x5419('0x66')]();return db[_0x5419('0x1f')]['find']({'where':{'id':_0x53dbff['params']['id']}})[_0x5419('0x18')](function(_0x26648a){return db[_0x5419('0x55')][_0x5419('0x56')](function(_0x1bb7bb){return _0x26648a[_0x5419('0x67')](_0x53dbff['query'][_0x5419('0x50')],{'transaction':_0x1bb7bb})[_0x5419('0x18')](function(){if(!_[_0x5419('0x68')](_0x147052)){return _0x26648a[_0x5419('0x69')](_0x147052,{'transaction':_0x1bb7bb});}})[_0x5419('0x18')](function(){_0x147052['forEach'](function(_0x549210){socket[_0x5419('0x5a')](_0x5419('0x6a'),{'UserId':_0x549210,'OpenchannelQueueId':_0x26648a['id']});});});});});});})[_0x5419('0x18')](respondWithStatusCode(_0x3e2de3,null))['catch'](handleError(_0x3e2de3,null));};exports[_0x5419('0x6b')]=function(_0xc630fe,_0x3b248f){return db[_0x5419('0x1f')][_0x5419('0x31')]({'where':{'id':_0xc630fe[_0x5419('0x28')]['id']}})[_0x5419('0x18')](handleEntityNotFound(_0x3b248f,null))[_0x5419('0x18')](function(_0x5c708d){if(_0x5c708d){return _0x5c708d[_0x5419('0x6b')](_0xc630fe[_0x5419('0x33')][_0x5419('0x50')],_['omit'](_0xc630fe['body'],[_0x5419('0x50'),'id'])||{})['spread'](function(_0x51a165){for(var _0x11f741=0x0;_0x11f741<_0xc630fe[_0x5419('0x33')][_0x5419('0x50')][_0x5419('0x2e')];_0x11f741+=0x1){socket[_0x5419('0x5a')](_0x5419('0x6c'),{'UserId':Number(_0xc630fe['body']['ids'][_0x11f741]),'OpenchannelQueueId':Number(_0xc630fe[_0x5419('0x28')]['id'])});}return _0x51a165;});}})[_0x5419('0x18')](respondWithResult(_0x3b248f,null))['catch'](handleError(_0x3b248f,null));};exports[_0x5419('0x69')]=function(_0x4db88b,_0x515268){return db[_0x5419('0x1f')][_0x5419('0x31')]({'where':{'id':_0x4db88b['params']['id']}})[_0x5419('0x18')](handleEntityNotFound(_0x515268,null))[_0x5419('0x18')](function(_0x1d755b){if(_0x1d755b){return _0x1d755b[_0x5419('0x69')](_0x4db88b['query']['ids'])[_0x5419('0x18')](function(){if(_[_0x5419('0x6d')](_0x4db88b['query'][_0x5419('0x50')])){for(var _0x60d5ae=0x0;_0x60d5ae<_0x4db88b[_0x5419('0x26')][_0x5419('0x50')][_0x5419('0x2e')];_0x60d5ae+=0x1){socket[_0x5419('0x5a')]('userOpenchannelQueue:remove',{'UserId':Number(_0x4db88b[_0x5419('0x26')]['ids'][_0x60d5ae]),'OpenchannelQueueId':Number(_0x4db88b['params']['id'])});}}else{socket[_0x5419('0x5a')]('userOpenchannelQueue:remove',{'UserId':Number(_0x4db88b[_0x5419('0x26')][_0x5419('0x50')]),'OpenchannelQueueId':Number(_0x4db88b[_0x5419('0x28')]['id'])});}});}})[_0x5419('0x18')](respondWithStatusCode(_0x515268,null))[_0x5419('0x39')](handleError(_0x515268,null));};exports[_0x5419('0x6e')]=function(_0x382288,_0x490aa2){var _0x275e77={};var _0x193ae9={};var _0x1b7384;var _0x402dd7;return db[_0x5419('0x1f')][_0x5419('0x3a')]({'where':{'id':_0x382288[_0x5419('0x28')]['id']}})[_0x5419('0x18')](handleEntityNotFound(_0x490aa2,null))[_0x5419('0x18')](function(_0x2b8fcc){if(_0x2b8fcc){_0x1b7384=_0x2b8fcc;_0x193ae9[_0x5419('0x29')]=_[_0x5419('0x2a')](db['User'][_0x5419('0x20')]);_0x193ae9[_0x5419('0x26')]=_[_0x5419('0x2a')](_0x382288[_0x5419('0x26')]);_0x193ae9[_0x5419('0x2b')]=_[_0x5419('0x3c')](_0x193ae9[_0x5419('0x29')],_0x193ae9['query']);_0x275e77[_0x5419('0x2c')]=_['intersection'](_0x193ae9['model'],qs[_0x5419('0x2d')](_0x382288[_0x5419('0x26')][_0x5419('0x2d')]));_0x275e77['attributes']=_0x275e77[_0x5419('0x2c')][_0x5419('0x2e')]?_0x275e77[_0x5419('0x2c')]:_0x193ae9[_0x5419('0x29')];_0x275e77[_0x5419('0x3e')]=qs[_0x5419('0x3f')](_0x382288['query'][_0x5419('0x3f')]);_0x275e77[_0x5419('0x24')]=qs['filters'](_[_0x5419('0x4d')](_0x382288[_0x5419('0x26')],_0x193ae9[_0x5419('0x2b')]));if(_0x382288[_0x5419('0x26')][_0x5419('0x41')]){_0x275e77[_0x5419('0x24')]=_[_0x5419('0x2f')](_0x275e77[_0x5419('0x24')],{'$or':_['map'](_0x275e77[_0x5419('0x2c')],function(_0x1a9b96){var _0x1e50b4={};_0x1e50b4[_0x1a9b96]={'$like':'%'+_0x382288['query'][_0x5419('0x41')]+'%'};return _0x1e50b4;})});}_0x275e77=_[_0x5419('0x2f')]({},_0x275e77,_0x382288[_0x5419('0x30')]);return _0x1b7384[_0x5419('0x6e')](_0x275e77);}})[_0x5419('0x18')](function(_0x3e8024){if(_0x3e8024){_0x402dd7=_0x3e8024[_0x5419('0x2e')];if(!_0x382288[_0x5419('0x26')]['hasOwnProperty']('nolimit')){_0x275e77[_0x5419('0x12')]=qs['limit'](_0x382288['query'][_0x5419('0x12')]);_0x275e77['offset']=qs['offset'](_0x382288[_0x5419('0x26')][_0x5419('0x14')]);}return _0x1b7384[_0x5419('0x6e')](_0x275e77);}})[_0x5419('0x18')](function(_0x5b7af0){if(_0x5b7af0){return _0x5b7af0?{'count':_0x402dd7,'rows':_0x5b7af0}:null;}})[_0x5419('0x18')](respondWithResult(_0x490aa2,null))[_0x5419('0x39')](handleError(_0x490aa2,null));}; \ No newline at end of file +var _0xee6c=['count','limit','set','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','end','error','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','type','where','include','query','findAll','rows','catch','params','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','pick','filter','findAndCountAll','agent','updatedAt','map','%s/%s','SIP','openchannelPause','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','field','tq.TeamId','from','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','includes','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','userOpenchannelQueue:save','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','offset','undefined'];(function(_0x58af4d,_0x40118a){var _0x2475b0=function(_0x4b1bf6){while(--_0x4b1bf6){_0x58af4d['push'](_0x58af4d['shift']());}};_0x2475b0(++_0x40118a);}(_0xee6c,0xdf));var _0xcee6=function(_0x1e455d,_0xa06cd6){_0x1e455d=_0x1e455d-0x0;var _0x34f257=_0xee6c[_0x1e455d];return _0x34f257;};'use strict';var BPromise=require(_0xcee6('0x0'));var util=require(_0xcee6('0x1'));var _=require(_0xcee6('0x2'));var squel=require(_0xcee6('0x3'));var Redis=require(_0xcee6('0x4'));var qs=require(_0xcee6('0x5'));var logger=require('../../config/logger')(_0xcee6('0x6'));var config=require(_0xcee6('0x7'));var db=require('../../mysqldb')['db'];config[_0xcee6('0x8')]=_[_0xcee6('0x9')](config['redis'],{'host':_0xcee6('0xa'),'port':0x18eb});var socket=require(_0xcee6('0xb'))(new Redis(config[_0xcee6('0x8')]));require(_0xcee6('0xc'))[_0xcee6('0xd')](socket);function respondWithStatusCode(_0x398910,_0x532ce3){_0x532ce3=_0x532ce3||0xcc;return function(_0x4dcafe){if(_0x4dcafe){return _0x398910[_0xcee6('0xe')](_0x532ce3);}return _0x398910[_0xcee6('0xf')](_0x532ce3)['end']();};}function respondWithResult(_0x222262,_0x44b355){_0x44b355=_0x44b355||0xc8;return function(_0x2b4351){if(_0x2b4351){return _0x222262[_0xcee6('0xf')](_0x44b355)[_0xcee6('0x10')](_0x2b4351);}};}function respondWithFilteredResult(_0x2ee787,_0xdb29ca){return function(_0x548f85){if(_0x548f85){var _0x137fe3=typeof _0xdb29ca[_0xcee6('0x11')]===_0xcee6('0x12')&&typeof _0xdb29ca['limit']===_0xcee6('0x12');var _0x24bafa=_0x548f85[_0xcee6('0x13')];var _0x17e9ba=_0x137fe3?0x0:_0xdb29ca[_0xcee6('0x11')];var _0x250b6f=_0x137fe3?_0x548f85[_0xcee6('0x13')]:_0xdb29ca[_0xcee6('0x11')]+_0xdb29ca[_0xcee6('0x14')];var _0x148df7;if(_0x250b6f>=_0x24bafa){_0x250b6f=_0x24bafa;_0x148df7=0xc8;}else{_0x148df7=0xce;}_0x2ee787[_0xcee6('0xf')](_0x148df7);return _0x2ee787[_0xcee6('0x15')](_0xcee6('0x16'),_0x17e9ba+'-'+_0x250b6f+'/'+_0x24bafa)[_0xcee6('0x10')](_0x548f85);}return null;};}function saveUpdates(_0x349a37){return function(_0x2285a1){if(_0x2285a1){return _0x2285a1[_0xcee6('0x17')](_0x349a37)[_0xcee6('0x18')](function(_0x4450a0){return _0x4450a0;});}return null;};}function removeEntity(_0x3f3559){return function(_0x4b5e4e){if(_0x4b5e4e){return _0x4b5e4e[_0xcee6('0x19')]()[_0xcee6('0x18')](function(){var _0x4d1726=_0x4b5e4e[_0xcee6('0x1a')]({'plain':!![]});var _0x591d7f=_0xcee6('0x1b');return db[_0xcee6('0x1c')][_0xcee6('0x19')]({'where':{'type':_0x591d7f,'resourceId':_0x4d1726['id']}})['then'](function(){return _0x4b5e4e;});})[_0xcee6('0x18')](function(){_0x3f3559[_0xcee6('0xf')](0xcc)[_0xcee6('0x1d')]();});}};}function handleEntityNotFound(_0x172f0e){return function(_0x595816){if(!_0x595816){_0x172f0e[_0xcee6('0xe')](0x194);}return _0x595816;};}function handleError(_0xe6a8e3,_0x1d40d1){_0x1d40d1=_0x1d40d1||0x1f4;return function(_0x232fc7){logger[_0xcee6('0x1e')](_0x232fc7[_0xcee6('0x1f')]);if(_0x232fc7[_0xcee6('0x20')]){delete _0x232fc7[_0xcee6('0x20')];}_0xe6a8e3[_0xcee6('0xf')](_0x1d40d1)[_0xcee6('0x21')](_0x232fc7);};}exports[_0xcee6('0x22')]=function(_0x2e12e4,_0x4c4fdc){var _0x46f3a3={};var _0x18fa97={'count':0x0,'rows':[]};var _0x5851f6=_['map'](db[_0xcee6('0x23')][_0xcee6('0x24')],function(_0x48dd05){return{'name':_0x48dd05[_0xcee6('0x25')],'type':_0x48dd05[_0xcee6('0x26')]['key']};});_0x46f3a3=qs['getOptions'](_0x5851f6,_0x2e12e4);var _0x2120ea={'where':_0x46f3a3[_0xcee6('0x27')]};return db[_0xcee6('0x23')][_0xcee6('0x13')](_0x2120ea)[_0xcee6('0x18')](function(_0x2487b2){_0x18fa97[_0xcee6('0x13')]=_0x2487b2;_0x46f3a3['include']=qs[_0xcee6('0x28')](_0x2e12e4[_0xcee6('0x29')]);return db[_0xcee6('0x23')][_0xcee6('0x2a')](_0x46f3a3);})[_0xcee6('0x18')](function(_0x19821a){_0x18fa97[_0xcee6('0x2b')]=_0x19821a;return _0x18fa97;})[_0xcee6('0x18')](respondWithFilteredResult(_0x4c4fdc,_0x46f3a3))[_0xcee6('0x2c')](handleError(_0x4c4fdc,null));};exports['show']=function(_0x46a084,_0x5041e6){var _0xddfb07={'raw':!![],'where':{'id':_0x46a084[_0xcee6('0x2d')]['id']}},_0x6b72fd={};_0x6b72fd[_0xcee6('0x2e')]=_[_0xcee6('0x2f')](db[_0xcee6('0x23')]['rawAttributes']);_0x6b72fd[_0xcee6('0x29')]=_['keys'](_0x46a084[_0xcee6('0x29')]);_0x6b72fd[_0xcee6('0x30')]=_[_0xcee6('0x31')](_0x6b72fd[_0xcee6('0x2e')],_0x6b72fd['query']);_0xddfb07['attributes']=_[_0xcee6('0x31')](_0x6b72fd['model'],qs[_0xcee6('0x32')](_0x46a084['query'][_0xcee6('0x32')]));_0xddfb07[_0xcee6('0x33')]=_0xddfb07[_0xcee6('0x33')][_0xcee6('0x34')]?_0xddfb07[_0xcee6('0x33')]:_0x6b72fd[_0xcee6('0x2e')];if(_0x46a084[_0xcee6('0x29')][_0xcee6('0x35')]){_0xddfb07[_0xcee6('0x28')]=[{'all':!![]}];}_0xddfb07=_[_0xcee6('0x36')]({},_0xddfb07,_0x46a084[_0xcee6('0x37')]);return db[_0xcee6('0x23')][_0xcee6('0x38')](_0xddfb07)[_0xcee6('0x18')](handleEntityNotFound(_0x5041e6,null))[_0xcee6('0x18')](respondWithResult(_0x5041e6,null))[_0xcee6('0x2c')](handleError(_0x5041e6,null));};exports[_0xcee6('0x39')]=function(_0x239803,_0xbc03b1){return db[_0xcee6('0x23')][_0xcee6('0x39')](_0x239803['body'],{})[_0xcee6('0x18')](function(_0x50ffa9){var _0x9aa947=_0x239803['user'][_0xcee6('0x1a')]({'plain':!![]});if(!_0x9aa947)throw new Error(_0xcee6('0x3a'));if(_0x9aa947[_0xcee6('0x3b')]===_0xcee6('0x3c')){var _0xf732f8=_0x50ffa9[_0xcee6('0x1a')]({'plain':!![]});var _0x452cac=_0xcee6('0x1b');return db[_0xcee6('0x3d')][_0xcee6('0x38')]({'where':{'name':_0x452cac,'userProfileId':_0x9aa947[_0xcee6('0x3e')]},'raw':!![]})[_0xcee6('0x18')](function(_0x212408){if(_0x212408&&_0x212408[_0xcee6('0x3f')]===0x0){return db[_0xcee6('0x1c')][_0xcee6('0x39')]({'name':_0xf732f8[_0xcee6('0x20')],'resourceId':_0xf732f8['id'],'type':_0x212408[_0xcee6('0x20')],'sectionId':_0x212408['id']},{})[_0xcee6('0x18')](function(){return _0x50ffa9;});}else{return _0x50ffa9;}})[_0xcee6('0x2c')](function(_0x21ff6b){logger['error'](_0xcee6('0x40'),_0x21ff6b);throw _0x21ff6b;});}return _0x50ffa9;})['then'](respondWithResult(_0xbc03b1,0xc9))[_0xcee6('0x2c')](handleError(_0xbc03b1,null));};exports[_0xcee6('0x17')]=function(_0x32ef72,_0x1b58e8){if(_0x32ef72[_0xcee6('0x41')]['id']){delete _0x32ef72[_0xcee6('0x41')]['id'];}return db[_0xcee6('0x23')][_0xcee6('0x38')]({'where':{'id':_0x32ef72[_0xcee6('0x2d')]['id']}})[_0xcee6('0x18')](handleEntityNotFound(_0x1b58e8,null))['then'](saveUpdates(_0x32ef72[_0xcee6('0x41')],null))[_0xcee6('0x18')](respondWithResult(_0x1b58e8,null))[_0xcee6('0x2c')](handleError(_0x1b58e8,null));};exports[_0xcee6('0x19')]=function(_0xcbc98c,_0x36396f){return db[_0xcee6('0x23')][_0xcee6('0x38')]({'where':{'id':_0xcbc98c[_0xcee6('0x2d')]['id']}})[_0xcee6('0x18')](handleEntityNotFound(_0x36396f,null))['then'](removeEntity(_0x36396f,null))[_0xcee6('0x2c')](handleError(_0x36396f,null));};exports[_0xcee6('0x42')]=function(_0x367b9e,_0x2f5c34){return db[_0xcee6('0x23')][_0xcee6('0x42')]()[_0xcee6('0x18')](respondWithResult(_0x2f5c34,null))[_0xcee6('0x2c')](handleError(_0x2f5c34,null));};exports[_0xcee6('0x43')]=function(_0xb52337,_0x39f1b4){var _0x1bf76b={'raw':!![],'where':{}},_0x13eeaf={},_0x56489d;return db['OpenchannelQueue'][_0xcee6('0x44')]({'where':{'id':_0xb52337[_0xcee6('0x2d')]['id']}})[_0xcee6('0x18')](handleEntityNotFound(_0x39f1b4,null))[_0xcee6('0x18')](function(_0x13dde3){if(_0x13dde3){_0x56489d=_0x13dde3[_0xcee6('0x1a')]({'plain':!![]});_0x13eeaf[_0xcee6('0x2e')]=_[_0xcee6('0x2f')](db[_0xcee6('0x45')][_0xcee6('0x24')]);_0x13eeaf[_0xcee6('0x29')]=_[_0xcee6('0x2f')](_0xb52337['query']);_0x13eeaf[_0xcee6('0x30')]=_['intersection'](_0x13eeaf['model'],_0x13eeaf['query']);_0x1bf76b[_0xcee6('0x33')]=_[_0xcee6('0x31')](_0x13eeaf[_0xcee6('0x2e')],qs[_0xcee6('0x32')](_0xb52337[_0xcee6('0x29')][_0xcee6('0x32')]));_0x1bf76b[_0xcee6('0x33')]=_0x1bf76b[_0xcee6('0x33')][_0xcee6('0x34')]?_0x1bf76b['attributes']:_0x13eeaf[_0xcee6('0x2e')];if(!_0xb52337[_0xcee6('0x29')][_0xcee6('0x46')](_0xcee6('0x47'))){_0x1bf76b[_0xcee6('0x14')]=qs['limit'](_0xb52337['query'][_0xcee6('0x14')]);_0x1bf76b[_0xcee6('0x11')]=qs[_0xcee6('0x11')](_0xb52337[_0xcee6('0x29')][_0xcee6('0x11')]);}_0x1bf76b[_0xcee6('0x48')]=qs[_0xcee6('0x49')](_0xb52337[_0xcee6('0x29')][_0xcee6('0x49')]);_0x1bf76b[_0xcee6('0x27')]=qs[_0xcee6('0x30')](_[_0xcee6('0x4a')](_0xb52337[_0xcee6('0x29')],_0x13eeaf[_0xcee6('0x30')]));_0x1bf76b[_0xcee6('0x27')]['OpenchannelQueueId']=_0x13dde3['id'];if(_0xb52337[_0xcee6('0x29')][_0xcee6('0x4b')]){_0x1bf76b['where']=_['merge'](_0x1bf76b[_0xcee6('0x27')],{'$or':_['map'](_0x1bf76b['attributes'],function(_0x59a31a){var _0x251de3={};_0x251de3[_0x59a31a]={'$like':'%'+_0xb52337[_0xcee6('0x29')][_0xcee6('0x4b')]+'%'};return _0x251de3;})});}_0x1bf76b=_[_0xcee6('0x36')]({},_0x1bf76b,_0xb52337['options']);return db[_0xcee6('0x45')][_0xcee6('0x2a')](_0x1bf76b);}})[_0xcee6('0x18')](function(_0x390bfc){if(_0x390bfc){return db['User'][_0xcee6('0x4c')]({'where':{'id':_['map'](_0x390bfc,'UserId'),'role':_0xcee6('0x4d')},'attributes':['id','name','openchannelPause',_0xcee6('0x4e'),'createdAt']});}})[_0xcee6('0x18')](function(_0x426980){if(_0x426980){return{'count':_0x426980[_0xcee6('0x13')],'rows':_[_0xcee6('0x4f')](_0x426980[_0xcee6('0x2b')],function(_0x279f38){return{'membername':_0x279f38[_0xcee6('0x20')],'UserId':_0x279f38['id'],'queue_name':_0x56489d['name'],'OpenchannelQueueId':_0x56489d['id'],'interface':util['format'](_0xcee6('0x50'),_0xcee6('0x51'),_0x279f38[_0xcee6('0x20')]),'penalty':0x0,'paused':_0x279f38[_0xcee6('0x52')],'createdAt':_0x279f38[_0xcee6('0x53')],'updatedAt':_0x279f38[_0xcee6('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcee6('0x18')](respondWithFilteredResult(_0x39f1b4,_0x1bf76b))['catch'](handleError(_0x39f1b4,null));};exports[_0xcee6('0x54')]=function(_0x2b9419,_0x15a7f2){var _0x39cd1a={};var _0x5c7920={};var _0x44ed3f;var _0x1d5791;return db[_0xcee6('0x23')][_0xcee6('0x44')]({'where':{'id':_0x2b9419[_0xcee6('0x2d')]['id']}})[_0xcee6('0x18')](handleEntityNotFound(_0x15a7f2,null))['then'](function(_0xe17d21){if(_0xe17d21){_0x44ed3f=_0xe17d21;_0x5c7920['model']=_[_0xcee6('0x2f')](db[_0xcee6('0x55')][_0xcee6('0x24')]);_0x5c7920[_0xcee6('0x29')]=_[_0xcee6('0x2f')](_0x2b9419[_0xcee6('0x29')]);_0x5c7920['filters']=_[_0xcee6('0x31')](_0x5c7920[_0xcee6('0x2e')],_0x5c7920[_0xcee6('0x29')]);_0x39cd1a[_0xcee6('0x33')]=_['intersection'](_0x5c7920['model'],qs['fields'](_0x2b9419['query'][_0xcee6('0x32')]));_0x39cd1a[_0xcee6('0x33')]=_0x39cd1a[_0xcee6('0x33')][_0xcee6('0x34')]?_0x39cd1a['attributes']:_0x5c7920[_0xcee6('0x2e')];_0x39cd1a[_0xcee6('0x48')]=qs['sort'](_0x2b9419[_0xcee6('0x29')][_0xcee6('0x49')]);_0x39cd1a[_0xcee6('0x27')]=qs[_0xcee6('0x30')](_['pick'](_0x2b9419['query'],_0x5c7920[_0xcee6('0x30')]));if(_0x2b9419[_0xcee6('0x29')][_0xcee6('0x4b')]){_0x39cd1a[_0xcee6('0x27')]=_[_0xcee6('0x36')](_0x39cd1a[_0xcee6('0x27')],{'$or':_[_0xcee6('0x4f')](_0x39cd1a[_0xcee6('0x33')],function(_0x142c57){var _0x54188c={};_0x54188c[_0x142c57]={'$like':'%'+_0x2b9419[_0xcee6('0x29')][_0xcee6('0x4b')]+'%'};return _0x54188c;})});}_0x39cd1a=_['merge']({},_0x39cd1a,_0x2b9419['options']);return _0x44ed3f[_0xcee6('0x54')](_0x39cd1a);}})[_0xcee6('0x18')](function(_0x1c0ebb){if(_0x1c0ebb){_0x1d5791=_0x1c0ebb['length'];if(!_0x2b9419[_0xcee6('0x29')][_0xcee6('0x46')]('nolimit')){_0x39cd1a[_0xcee6('0x14')]=qs[_0xcee6('0x14')](_0x2b9419[_0xcee6('0x29')][_0xcee6('0x14')]);_0x39cd1a[_0xcee6('0x11')]=qs[_0xcee6('0x11')](_0x2b9419[_0xcee6('0x29')][_0xcee6('0x11')]);}return _0x44ed3f['getTeams'](_0x39cd1a);}})['then'](function(_0x491c90){if(_0x491c90){return _0x491c90?{'count':_0x1d5791,'rows':_0x491c90}:null;}})[_0xcee6('0x18')](respondWithResult(_0x15a7f2,null))[_0xcee6('0x2c')](handleError(_0x15a7f2,null));};exports[_0xcee6('0x56')]=function(_0x91fdc0,_0x257fe9){var _0x48d9c2=_0x91fdc0[_0xcee6('0x41')][_0xcee6('0x57')];return db[_0xcee6('0x55')][_0xcee6('0x2a')]({'where':{'id':_0x48d9c2},'attributes':['id'],'include':[{'model':db[_0xcee6('0x58')],'as':_0xcee6('0x59'),'attributes':['id',_0xcee6('0x20'),_0xcee6('0x5a'),_0xcee6('0x5b'),_0xcee6('0x5c')],'raw':!![]}]})['then'](function(_0x56f7b4){if(_0x56f7b4){var _0x4a53ec=_[_0xcee6('0x5d')](_0x56f7b4,function(_0x5a3a70){var _0x35ef40=_0x5a3a70['get']({'plain':!![]});return _0x35ef40[_0xcee6('0x59')];});return db[_0xcee6('0x23')][_0xcee6('0x38')]({'where':{'id':_0x91fdc0[_0xcee6('0x2d')]['id']}})[_0xcee6('0x18')](function(_0x593253){return db[_0xcee6('0x5e')][_0xcee6('0x5f')](function(_0x16422d){return _0x593253[_0xcee6('0x56')](_0x48d9c2,{'transaction':_0x16422d})['then'](function(){return BPromise[_0xcee6('0x60')](_0x4a53ec,function(_0x5aef2d){return db[_0xcee6('0x45')][_0xcee6('0x61')]({'where':{'UserId':_0x5aef2d['id'],'OpenchannelQueueId':_0x91fdc0['params']['id']},'transaction':_0x16422d});});})['then'](function(){_0x4a53ec[_0xcee6('0x62')](function(_0x1be054){socket[_0xcee6('0x63')]('userOpenchannelQueue:save',{'UserId':_0x1be054['id'],'OpenchannelQueueId':_0x593253['id']});});});});});}})[_0xcee6('0x18')](respondWithStatusCode(_0x257fe9,null))[_0xcee6('0x2c')](handleError(_0x257fe9,null));};exports[_0xcee6('0x64')]=function(_0x2b4062,_0x3ed094){return db[_0xcee6('0x55')]['findAll']({'where':{'id':_0x2b4062[_0xcee6('0x29')][_0xcee6('0x57')]},'attributes':['id'],'include':[{'model':db[_0xcee6('0x58')],'as':_0xcee6('0x59'),'attributes':['id'],'raw':!![]}]})[_0xcee6('0x18')](handleEntityNotFound(_0x3ed094,null))[_0xcee6('0x18')](function(_0x454b28){var _0x2002ca=_['map'](_0x454b28,'id');var _0x20638=[];var _0x366aff=[];var _0x36eca8=squel['select']();_0x36eca8[_0xcee6('0x65')](_0xcee6('0x66'))[_0xcee6('0x67')]('team_has_openchannel_queues','tq')[_0xcee6('0x68')](_0xcee6('0x69'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xcee6('0x27')](_0xcee6('0x6a'),_0x2b4062[_0xcee6('0x2d')]['id']);for(var _0x38f63c=0x0;_0x38f63c<_0x454b28[_0xcee6('0x34')];_0x38f63c+=0x1){let _0x56c002=_0x454b28[_0x38f63c];for(var _0x53aca4=0x0;_0x53aca4<_0x56c002[_0xcee6('0x59')][_0xcee6('0x34')];_0x53aca4+=0x1){let _0x15596f=_0x56c002[_0xcee6('0x59')][_0x53aca4];var _0x319bb3=_0x36eca8[_0xcee6('0x6b')]();_0x319bb3['where']('ut.UserId\x20=\x20?',_0x15596f['id']);_0x366aff[_0xcee6('0x6c')](db[_0xcee6('0x5e')][_0xcee6('0x29')](_0x319bb3[_0xcee6('0x6d')](),{'type':db['sequelize'][_0xcee6('0x6e')]['SELECT']})[_0xcee6('0x18')](function(_0x48c986){if(_0x48c986['length']===0x1){return _0x15596f['id'];}else{var _0x1ae909=_[_0xcee6('0x6f')](_['map'](_0x48c986,'TeamId'),function(_0x574556){return _[_0xcee6('0x70')](_0x2002ca,_0x574556);});if(_0x1ae909){return _0x15596f['id'];}}}));}}return BPromise['all'](_0x366aff)[_0xcee6('0x18')](function(_0x4315c8){_0x20638=_(_0x20638)['union'](_0x4315c8)[_0xcee6('0x71')]()[_0xcee6('0x72')]();return db[_0xcee6('0x23')]['find']({'where':{'id':_0x2b4062[_0xcee6('0x2d')]['id']}})[_0xcee6('0x18')](function(_0x686cc5){return db[_0xcee6('0x5e')]['transaction'](function(_0x16c2d7){return _0x686cc5[_0xcee6('0x64')](_0x2b4062['query'][_0xcee6('0x57')],{'transaction':_0x16c2d7})[_0xcee6('0x18')](function(){if(!_[_0xcee6('0x73')](_0x20638)){return _0x686cc5[_0xcee6('0x74')](_0x20638,{'transaction':_0x16c2d7});}})[_0xcee6('0x18')](function(){_0x20638['forEach'](function(_0x42b137){socket[_0xcee6('0x63')](_0xcee6('0x75'),{'UserId':_0x42b137,'OpenchannelQueueId':_0x686cc5['id']});});});});});});})[_0xcee6('0x18')](respondWithStatusCode(_0x3ed094,null))[_0xcee6('0x2c')](handleError(_0x3ed094,null));};exports[_0xcee6('0x76')]=function(_0x2b00f7,_0x2c8ee3){return db[_0xcee6('0x23')][_0xcee6('0x38')]({'where':{'id':_0x2b00f7[_0xcee6('0x2d')]['id']}})[_0xcee6('0x18')](handleEntityNotFound(_0x2c8ee3,null))[_0xcee6('0x18')](function(_0x312645){if(_0x312645){return _0x312645[_0xcee6('0x76')](_0x2b00f7[_0xcee6('0x41')][_0xcee6('0x57')],_['omit'](_0x2b00f7['body'],[_0xcee6('0x57'),'id'])||{})[_0xcee6('0x77')](function(_0x18fb9c){for(var _0x338d90=0x0;_0x338d90<_0x2b00f7[_0xcee6('0x41')][_0xcee6('0x57')]['length'];_0x338d90+=0x1){socket[_0xcee6('0x63')](_0xcee6('0x78'),{'UserId':Number(_0x2b00f7[_0xcee6('0x41')]['ids'][_0x338d90]),'OpenchannelQueueId':Number(_0x2b00f7[_0xcee6('0x2d')]['id'])});}return _0x18fb9c;});}})[_0xcee6('0x18')](respondWithResult(_0x2c8ee3,null))[_0xcee6('0x2c')](handleError(_0x2c8ee3,null));};exports[_0xcee6('0x74')]=function(_0x3bb429,_0x3f407d){return db[_0xcee6('0x23')][_0xcee6('0x38')]({'where':{'id':_0x3bb429[_0xcee6('0x2d')]['id']}})['then'](handleEntityNotFound(_0x3f407d,null))[_0xcee6('0x18')](function(_0x1ab7c8){if(_0x1ab7c8){return _0x1ab7c8[_0xcee6('0x74')](_0x3bb429[_0xcee6('0x29')][_0xcee6('0x57')])[_0xcee6('0x18')](function(){if(_['isArray'](_0x3bb429[_0xcee6('0x29')][_0xcee6('0x57')])){for(var _0x14faf2=0x0;_0x14faf2<_0x3bb429[_0xcee6('0x29')][_0xcee6('0x57')]['length'];_0x14faf2+=0x1){socket['emit'](_0xcee6('0x75'),{'UserId':Number(_0x3bb429['query'][_0xcee6('0x57')][_0x14faf2]),'OpenchannelQueueId':Number(_0x3bb429[_0xcee6('0x2d')]['id'])});}}else{socket[_0xcee6('0x63')]('userOpenchannelQueue:remove',{'UserId':Number(_0x3bb429[_0xcee6('0x29')][_0xcee6('0x57')]),'OpenchannelQueueId':Number(_0x3bb429[_0xcee6('0x2d')]['id'])});}});}})[_0xcee6('0x18')](respondWithStatusCode(_0x3f407d,null))[_0xcee6('0x2c')](handleError(_0x3f407d,null));};exports['getAgents']=function(_0x173355,_0xd851a3){var _0x4d6884={};var _0x4d97f9={};var _0x191ac6;var _0x960b66;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x173355[_0xcee6('0x2d')]['id']}})[_0xcee6('0x18')](handleEntityNotFound(_0xd851a3,null))[_0xcee6('0x18')](function(_0x3a9b8e){if(_0x3a9b8e){_0x191ac6=_0x3a9b8e;_0x4d97f9[_0xcee6('0x2e')]=_[_0xcee6('0x2f')](db[_0xcee6('0x58')][_0xcee6('0x24')]);_0x4d97f9[_0xcee6('0x29')]=_[_0xcee6('0x2f')](_0x173355[_0xcee6('0x29')]);_0x4d97f9[_0xcee6('0x30')]=_[_0xcee6('0x31')](_0x4d97f9[_0xcee6('0x2e')],_0x4d97f9[_0xcee6('0x29')]);_0x4d6884[_0xcee6('0x33')]=_[_0xcee6('0x31')](_0x4d97f9[_0xcee6('0x2e')],qs[_0xcee6('0x32')](_0x173355[_0xcee6('0x29')][_0xcee6('0x32')]));_0x4d6884[_0xcee6('0x33')]=_0x4d6884[_0xcee6('0x33')]['length']?_0x4d6884[_0xcee6('0x33')]:_0x4d97f9[_0xcee6('0x2e')];_0x4d6884[_0xcee6('0x48')]=qs[_0xcee6('0x49')](_0x173355[_0xcee6('0x29')][_0xcee6('0x49')]);_0x4d6884['where']=qs[_0xcee6('0x30')](_['pick'](_0x173355[_0xcee6('0x29')],_0x4d97f9[_0xcee6('0x30')]));if(_0x173355[_0xcee6('0x29')][_0xcee6('0x4b')]){_0x4d6884[_0xcee6('0x27')]=_['merge'](_0x4d6884[_0xcee6('0x27')],{'$or':_[_0xcee6('0x4f')](_0x4d6884[_0xcee6('0x33')],function(_0x4657c7){var _0x550209={};_0x550209[_0x4657c7]={'$like':'%'+_0x173355[_0xcee6('0x29')][_0xcee6('0x4b')]+'%'};return _0x550209;})});}_0x4d6884=_[_0xcee6('0x36')]({},_0x4d6884,_0x173355[_0xcee6('0x37')]);return _0x191ac6['getAgents'](_0x4d6884);}})['then'](function(_0x54d65c){if(_0x54d65c){_0x960b66=_0x54d65c[_0xcee6('0x34')];if(!_0x173355[_0xcee6('0x29')][_0xcee6('0x46')](_0xcee6('0x47'))){_0x4d6884[_0xcee6('0x14')]=qs[_0xcee6('0x14')](_0x173355['query'][_0xcee6('0x14')]);_0x4d6884[_0xcee6('0x11')]=qs[_0xcee6('0x11')](_0x173355[_0xcee6('0x29')][_0xcee6('0x11')]);}return _0x191ac6['getAgents'](_0x4d6884);}})['then'](function(_0x460be4){if(_0x460be4){return _0x460be4?{'count':_0x960b66,'rows':_0x460be4}:null;}})[_0xcee6('0x18')](respondWithResult(_0xd851a3,null))[_0xcee6('0x2c')](handleError(_0xd851a3,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 6e77ed9..f604574 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 _0x42a0=['OpenchannelQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x187e24,_0x393e15){var _0x39b658=function(_0x386c91){while(--_0x386c91){_0x187e24['push'](_0x187e24['shift']());}};_0x39b658(++_0x393e15);}(_0x42a0,0x1dc));var _0x042a=function(_0x3ffd9e,_0xa74035){_0x3ffd9e=_0x3ffd9e-0x0;var _0x4c5665=_0x42a0[_0x3ffd9e];return _0x4c5665;};'use strict';var EventEmitter=require(_0x042a('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x042a('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x042a('0x2')](0x0);var events={'afterCreate':_0x042a('0x3'),'afterUpdate':_0x042a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1096b3){return function(_0x385588,_0x3f7423,_0x701cc8){OpenchannelQueueEvents[_0x042a('0x5')](_0x1096b3+':'+_0x385588['id'],_0x385588);OpenchannelQueueEvents[_0x042a('0x5')](_0x1096b3,_0x385588);_0x701cc8(null);};}for(var e in events){if(events[_0x042a('0x6')](e)){var event=events[e];OpenchannelQueue[_0x042a('0x7')](e,emitEvent(event));}}module[_0x042a('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xd454=['update','remove','emit','hasOwnProperty','hook','events','OpenchannelQueue','setMaxListeners'];(function(_0x131325,_0x1ad665){var _0x224fc4=function(_0x4637aa){while(--_0x4637aa){_0x131325['push'](_0x131325['shift']());}};_0x224fc4(++_0x1ad665);}(_0xd454,0xf5));var _0x4d45=function(_0x1c473a,_0x4e3400){_0x1c473a=_0x1c473a-0x0;var _0x35c316=_0xd454[_0x1c473a];return _0x35c316;};'use strict';var EventEmitter=require(_0x4d45('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x4d45('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x4d45('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4d45('0x3'),'afterDestroy':_0x4d45('0x4')};function emitEvent(_0x34b62b){return function(_0x4ada3b,_0x40e595,_0x5c75b9){OpenchannelQueueEvents[_0x4d45('0x5')](_0x34b62b+':'+_0x4ada3b['id'],_0x4ada3b);OpenchannelQueueEvents[_0x4d45('0x5')](_0x34b62b,_0x4ada3b);_0x5c75b9(null);};}for(var e in events){if(events[_0x4d45('0x6')](e)){var event=events[e];OpenchannelQueue[_0x4d45('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 1c2d951..5ef4eae 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 _0xcd1c=['path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','bluebird','request-promise'];(function(_0x37f43e,_0x1ce9e5){var _0x404ca0=function(_0x4e80c1){while(--_0x4e80c1){_0x37f43e['push'](_0x37f43e['shift']());}};_0x404ca0(++_0x1ce9e5);}(_0xcd1c,0xe5));var _0xccd1=function(_0x1f1ea4,_0x495aa7){_0x1f1ea4=_0x1f1ea4-0x0;var _0x425a84=_0xcd1c[_0x1f1ea4];return _0x425a84;};'use strict';var _=require('lodash');var util=require(_0xccd1('0x0'));var logger=require(_0xccd1('0x1'))(_0xccd1('0x2'));var moment=require('moment');var BPromise=require(_0xccd1('0x3'));var rp=require(_0xccd1('0x4'));var fs=require('fs');var path=require(_0xccd1('0x5'));var rimraf=require(_0xccd1('0x6'));var config=require(_0xccd1('0x7'));var attributes=require(_0xccd1('0x8'));module[_0xccd1('0x9')]=function(_0x1b1edb,_0x494849){return _0x1b1edb[_0xccd1('0xa')](_0xccd1('0xb'),attributes,{'tableName':_0xccd1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebd7=['bluebird','path','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api'];(function(_0x54cae6,_0x2c36d5){var _0x3e1003=function(_0x4cb9f0){while(--_0x4cb9f0){_0x54cae6['push'](_0x54cae6['shift']());}};_0x3e1003(++_0x2c36d5);}(_0xebd7,0x1b5));var _0x7ebd=function(_0x344501,_0x31cfb2){_0x344501=_0x344501-0x0;var _0x318075=_0xebd7[_0x344501];return _0x318075;};'use strict';var _=require('lodash');var util=require(_0x7ebd('0x0'));var logger=require(_0x7ebd('0x1'))(_0x7ebd('0x2'));var moment=require('moment');var BPromise=require(_0x7ebd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ebd('0x4'));var rimraf=require('rimraf');var config=require(_0x7ebd('0x5'));var attributes=require(_0x7ebd('0x6'));module[_0x7ebd('0x7')]=function(_0x33c31d,_0x4c1272){return _0x33c31d[_0x7ebd('0x8')](_0x7ebd('0x9'),attributes,{'tableName':_0x7ebd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index af985f9..aaf0af4 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 _0x1aaf=['options','raw','attributes','include','map','model','find','where','ShowOpenchannelQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll'];(function(_0x5b3a89,_0x1aa200){var _0x3ce1d8=function(_0x4a2abd){while(--_0x4a2abd){_0x5b3a89['push'](_0x5b3a89['shift']());}};_0x3ce1d8(++_0x1aa200);}(_0x1aaf,0x87));var _0xf1aa=function(_0x5d2b44,_0x29d69a){_0x5d2b44=_0x5d2b44-0x0;var _0x5acb9a=_0x1aaf[_0x5d2b44];return _0x5acb9a;};'use strict';var _=require(_0xf1aa('0x0'));var util=require(_0xf1aa('0x1'));var moment=require('moment');var BPromise=require(_0xf1aa('0x2'));var rs=require(_0xf1aa('0x3'));var fs=require('fs');var Redis=require(_0xf1aa('0x4'));var db=require(_0xf1aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf1aa('0x6'))(_0xf1aa('0x7'));var config=require(_0xf1aa('0x8'));var jayson=require(_0xf1aa('0x9'));var client=jayson[_0xf1aa('0xa')][_0xf1aa('0xb')]({'port':0x232a});config[_0xf1aa('0xc')]=_[_0xf1aa('0xd')](config[_0xf1aa('0xc')],{'host':_0xf1aa('0xe'),'port':0x18eb});var socket=require(_0xf1aa('0xf'))(new Redis(config[_0xf1aa('0xc')]));require(_0xf1aa('0x10'))[_0xf1aa('0x11')](socket);function respondWithRpcPromise(_0x1f3ae1,_0xa9b058,_0x53918d){return new BPromise(function(_0x5bc9cf,_0x4a8e71){return client[_0xf1aa('0x12')](_0x1f3ae1,_0x53918d)[_0xf1aa('0x13')](function(_0x3cd192){logger[_0xf1aa('0x14')](_0xf1aa('0x15'),_0xa9b058,_0xf1aa('0x16'));logger[_0xf1aa('0x17')](_0xf1aa('0x18'),_0xa9b058,_0xf1aa('0x16'),JSON[_0xf1aa('0x19')](_0x3cd192));if(_0x3cd192['error']){if(_0x3cd192[_0xf1aa('0x1a')][_0xf1aa('0x1b')]===0x1f4){logger[_0xf1aa('0x1a')](_0xf1aa('0x15'),_0xa9b058,_0x3cd192[_0xf1aa('0x1a')][_0xf1aa('0x1c')]);return _0x4a8e71(_0x3cd192[_0xf1aa('0x1a')][_0xf1aa('0x1c')]);}logger[_0xf1aa('0x1a')](_0xf1aa('0x15'),_0xa9b058,_0x3cd192['error'][_0xf1aa('0x1c')]);return _0x5bc9cf(_0x3cd192['error'][_0xf1aa('0x1c')]);}else{logger[_0xf1aa('0x14')](_0xf1aa('0x15'),_0xa9b058,'request\x20sent');_0x5bc9cf(_0x3cd192['result'][_0xf1aa('0x1c')]);}})[_0xf1aa('0x1d')](function(_0x3332d9){logger[_0xf1aa('0x1a')]('OpenchannelQueue,\x20%s,\x20%s',_0xa9b058,_0x3332d9);_0x4a8e71(_0x3332d9);});});}exports[_0xf1aa('0x1e')]=function(_0x15e85d){var _0x2cf966=this;return new Promise(function(_0x1e0374,_0x851018){return db[_0xf1aa('0x1f')][_0xf1aa('0x20')]({'raw':_0x15e85d['options']?_0x15e85d[_0xf1aa('0x21')][_0xf1aa('0x22')]===undefined?!![]:![]:!![],'where':_0x15e85d[_0xf1aa('0x21')]?_0x15e85d[_0xf1aa('0x21')]['where']||null:null,'attributes':_0x15e85d[_0xf1aa('0x21')]?_0x15e85d[_0xf1aa('0x21')][_0xf1aa('0x23')]||null:null,'limit':_0x15e85d[_0xf1aa('0x21')]?_0x15e85d[_0xf1aa('0x21')]['limit']||null:null,'include':_0x15e85d[_0xf1aa('0x21')]?_0x15e85d[_0xf1aa('0x21')][_0xf1aa('0x24')]?_[_0xf1aa('0x25')](_0x15e85d['options']['include'],function(_0x43980e){return{'model':db[_0x43980e[_0xf1aa('0x26')]],'as':_0x43980e['as'],'attributes':_0x43980e['attributes'],'include':_0x43980e[_0xf1aa('0x24')]?_[_0xf1aa('0x25')](_0x43980e[_0xf1aa('0x24')],function(_0x8e0051){return{'model':db[_0x8e0051['model']],'as':_0x8e0051['as'],'attributes':_0x8e0051[_0xf1aa('0x23')],'include':_0x8e0051[_0xf1aa('0x24')]?_[_0xf1aa('0x25')](_0x8e0051[_0xf1aa('0x24')],function(_0x183150){return{'model':db[_0x183150[_0xf1aa('0x26')]],'as':_0x183150['as'],'attributes':_0x183150[_0xf1aa('0x23')]};}):[]};}):[]};}):[]:[]})[_0xf1aa('0x13')](function(_0x2f52ae){logger[_0xf1aa('0x14')](_0xf1aa('0x1e'),_0x15e85d);logger[_0xf1aa('0x17')](_0xf1aa('0x1e'),_0x15e85d,JSON[_0xf1aa('0x19')](_0x2f52ae));_0x1e0374(_0x2f52ae);})['catch'](function(_0x459c2e){logger[_0xf1aa('0x1a')](_0xf1aa('0x1e'),_0x459c2e['message'],_0x15e85d);_0x851018(_0x2cf966['error'](0x1f4,_0x459c2e[_0xf1aa('0x1c')]));});});};exports['ShowOpenchannelQueue']=function(_0x2f3292){var _0x4aafc4=this;return new Promise(function(_0x4128a9,_0x271f6a){return db[_0xf1aa('0x1f')][_0xf1aa('0x27')]({'raw':_0x2f3292[_0xf1aa('0x21')]?_0x2f3292[_0xf1aa('0x21')][_0xf1aa('0x22')]===undefined?!![]:![]:!![],'where':_0x2f3292[_0xf1aa('0x21')]?_0x2f3292[_0xf1aa('0x21')][_0xf1aa('0x28')]||null:null,'attributes':_0x2f3292['options']?_0x2f3292[_0xf1aa('0x21')]['attributes']||null:null,'include':_0x2f3292['options']?_0x2f3292['options'][_0xf1aa('0x24')]?_[_0xf1aa('0x25')](_0x2f3292['options'][_0xf1aa('0x24')],function(_0x30c373){return{'model':db[_0x30c373['model']],'as':_0x30c373['as'],'attributes':_0x30c373['attributes'],'include':_0x30c373[_0xf1aa('0x24')]?_['map'](_0x30c373[_0xf1aa('0x24')],function(_0x462dd2){return{'model':db[_0x462dd2['model']],'as':_0x462dd2['as'],'attributes':_0x462dd2[_0xf1aa('0x23')],'include':_0x462dd2[_0xf1aa('0x24')]?_[_0xf1aa('0x25')](_0x462dd2[_0xf1aa('0x24')],function(_0xa0b500){return{'model':db[_0xa0b500[_0xf1aa('0x26')]],'as':_0xa0b500['as'],'attributes':_0xa0b500[_0xf1aa('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x315fed){logger[_0xf1aa('0x14')](_0xf1aa('0x29'),_0x2f3292);logger[_0xf1aa('0x17')](_0xf1aa('0x29'),_0x2f3292,JSON['stringify'](_0x315fed));_0x4128a9(_0x315fed);})[_0xf1aa('0x1d')](function(_0x2b0f30){logger[_0xf1aa('0x1a')](_0xf1aa('0x29'),_0x2b0f30['message'],_0x2f3292);_0x271f6a(_0x4aafc4[_0xf1aa('0x1a')](0x1f4,_0x2b0f30[_0xf1aa('0x1c')]));});});}; \ No newline at end of file +var _0x0447=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','catch','OpenchannelQueue','findAll','options','raw','map','include','model','attributes','GetOpenchannelQueue','ShowOpenchannelQueue','where'];(function(_0x543fd2,_0x57a649){var _0x137a02=function(_0x417b63){while(--_0x417b63){_0x543fd2['push'](_0x543fd2['shift']());}};_0x137a02(++_0x57a649);}(_0x0447,0x168));var _0x7044=function(_0x4bb94b,_0x50628a){_0x4bb94b=_0x4bb94b-0x0;var _0x36dcc6=_0x0447[_0x4bb94b];return _0x36dcc6;};'use strict';var _=require(_0x7044('0x0'));var util=require('util');var moment=require(_0x7044('0x1'));var BPromise=require('bluebird');var rs=require(_0x7044('0x2'));var fs=require('fs');var Redis=require(_0x7044('0x3'));var db=require(_0x7044('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7044('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7044('0x6')]({'port':0x232a});config[_0x7044('0x7')]=_[_0x7044('0x8')](config[_0x7044('0x7')],{'host':_0x7044('0x9'),'port':0x18eb});var socket=require(_0x7044('0xa'))(new Redis(config[_0x7044('0x7')]));require(_0x7044('0xb'))['register'](socket);function respondWithRpcPromise(_0x3335cb,_0x4a3184,_0x253075){return new BPromise(function(_0x3d5eef,_0x92b08b){return client[_0x7044('0xc')](_0x3335cb,_0x253075)[_0x7044('0xd')](function(_0x22d7b5){logger[_0x7044('0xe')]('OpenchannelQueue,\x20%s,\x20%s',_0x4a3184,'request\x20sent');logger[_0x7044('0xf')](_0x7044('0x10'),_0x4a3184,_0x7044('0x11'),JSON[_0x7044('0x12')](_0x22d7b5));if(_0x22d7b5[_0x7044('0x13')]){if(_0x22d7b5[_0x7044('0x13')][_0x7044('0x14')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x4a3184,_0x22d7b5['error'][_0x7044('0x15')]);return _0x92b08b(_0x22d7b5['error'][_0x7044('0x15')]);}logger[_0x7044('0x13')](_0x7044('0x16'),_0x4a3184,_0x22d7b5[_0x7044('0x13')]['message']);return _0x3d5eef(_0x22d7b5['error'][_0x7044('0x15')]);}else{logger[_0x7044('0xe')]('OpenchannelQueue,\x20%s,\x20%s',_0x4a3184,_0x7044('0x11'));_0x3d5eef(_0x22d7b5[_0x7044('0x17')][_0x7044('0x15')]);}})[_0x7044('0x18')](function(_0x2a0516){logger[_0x7044('0x13')](_0x7044('0x16'),_0x4a3184,_0x2a0516);_0x92b08b(_0x2a0516);});});}exports['GetOpenchannelQueue']=function(_0x54fa6e){var _0x6a2e6a=this;return new Promise(function(_0xfc7e37,_0x2ac746){return db[_0x7044('0x19')][_0x7044('0x1a')]({'raw':_0x54fa6e[_0x7044('0x1b')]?_0x54fa6e[_0x7044('0x1b')][_0x7044('0x1c')]===undefined?!![]:![]:!![],'where':_0x54fa6e[_0x7044('0x1b')]?_0x54fa6e[_0x7044('0x1b')]['where']||null:null,'attributes':_0x54fa6e[_0x7044('0x1b')]?_0x54fa6e[_0x7044('0x1b')]['attributes']||null:null,'limit':_0x54fa6e[_0x7044('0x1b')]?_0x54fa6e[_0x7044('0x1b')]['limit']||null:null,'include':_0x54fa6e[_0x7044('0x1b')]?_0x54fa6e[_0x7044('0x1b')]['include']?_[_0x7044('0x1d')](_0x54fa6e['options'][_0x7044('0x1e')],function(_0x31754e){return{'model':db[_0x31754e[_0x7044('0x1f')]],'as':_0x31754e['as'],'attributes':_0x31754e[_0x7044('0x20')],'include':_0x31754e[_0x7044('0x1e')]?_[_0x7044('0x1d')](_0x31754e[_0x7044('0x1e')],function(_0x308449){return{'model':db[_0x308449[_0x7044('0x1f')]],'as':_0x308449['as'],'attributes':_0x308449[_0x7044('0x20')],'include':_0x308449[_0x7044('0x1e')]?_[_0x7044('0x1d')](_0x308449[_0x7044('0x1e')],function(_0x4dc7e0){return{'model':db[_0x4dc7e0['model']],'as':_0x4dc7e0['as'],'attributes':_0x4dc7e0[_0x7044('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7044('0xd')](function(_0x637ad9){logger['info'](_0x7044('0x21'),_0x54fa6e);logger[_0x7044('0xf')](_0x7044('0x21'),_0x54fa6e,JSON['stringify'](_0x637ad9));_0xfc7e37(_0x637ad9);})[_0x7044('0x18')](function(_0x41feca){logger[_0x7044('0x13')](_0x7044('0x21'),_0x41feca['message'],_0x54fa6e);_0x2ac746(_0x6a2e6a[_0x7044('0x13')](0x1f4,_0x41feca[_0x7044('0x15')]));});});};exports[_0x7044('0x22')]=function(_0x9c3d27){var _0x3f0fc0=this;return new Promise(function(_0x4358ff,_0x3c51da){return db[_0x7044('0x19')]['find']({'raw':_0x9c3d27['options']?_0x9c3d27[_0x7044('0x1b')][_0x7044('0x1c')]===undefined?!![]:![]:!![],'where':_0x9c3d27[_0x7044('0x1b')]?_0x9c3d27[_0x7044('0x1b')][_0x7044('0x23')]||null:null,'attributes':_0x9c3d27[_0x7044('0x1b')]?_0x9c3d27[_0x7044('0x1b')]['attributes']||null:null,'include':_0x9c3d27[_0x7044('0x1b')]?_0x9c3d27['options'][_0x7044('0x1e')]?_['map'](_0x9c3d27[_0x7044('0x1b')][_0x7044('0x1e')],function(_0x7f2875){return{'model':db[_0x7f2875['model']],'as':_0x7f2875['as'],'attributes':_0x7f2875[_0x7044('0x20')],'include':_0x7f2875[_0x7044('0x1e')]?_['map'](_0x7f2875['include'],function(_0x4f498c){return{'model':db[_0x4f498c[_0x7044('0x1f')]],'as':_0x4f498c['as'],'attributes':_0x4f498c['attributes'],'include':_0x4f498c[_0x7044('0x1e')]?_[_0x7044('0x1d')](_0x4f498c['include'],function(_0x1a4d44){return{'model':db[_0x1a4d44['model']],'as':_0x1a4d44['as'],'attributes':_0x1a4d44['attributes']};}):[]};}):[]};}):[]:[]})[_0x7044('0xd')](function(_0x25f550){logger[_0x7044('0xe')](_0x7044('0x22'),_0x9c3d27);logger[_0x7044('0xf')]('ShowOpenchannelQueue',_0x9c3d27,JSON[_0x7044('0x12')](_0x25f550));_0x4358ff(_0x25f550);})[_0x7044('0x18')](function(_0x2cb5a7){logger[_0x7044('0x13')]('ShowOpenchannelQueue',_0x2cb5a7[_0x7044('0x15')],_0x9c3d27);_0x3c51da(_0x3f0fc0['error'](0x1f4,_0x2cb5a7[_0x7044('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 7f6a306..2f4f699 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 _0x0f04=['removeListener','length','./openchannelQueue.events','save','update'];(function(_0x552b0c,_0x34d91f){var _0x5ca7d6=function(_0x2d8834){while(--_0x2d8834){_0x552b0c['push'](_0x552b0c['shift']());}};_0x5ca7d6(++_0x34d91f);}(_0x0f04,0x160));var _0x40f0=function(_0x5e7ad8,_0x1dafd0){_0x5e7ad8=_0x5e7ad8-0x0;var _0x3688b7=_0x0f04[_0x5e7ad8];return _0x3688b7;};'use strict';var OpenchannelQueueEvents=require(_0x40f0('0x0'));var events=[_0x40f0('0x1'),'remove',_0x40f0('0x2')];function createListener(_0x402567,_0x379be4){return function(_0x4207d6){_0x379be4['emit'](_0x402567,_0x4207d6);};}function removeListener(_0x4ec133,_0x2bb305){return function(){OpenchannelQueueEvents[_0x40f0('0x3')](_0x4ec133,_0x2bb305);};}exports['register']=function(_0x3ae6a4){for(var _0x237b44=0x0,_0x1468a9=events[_0x40f0('0x4')];_0x237b44<_0x1468a9;_0x237b44++){var _0x2aa696=events[_0x237b44];var _0xf8cef9=createListener('openchannelQueue:'+_0x2aa696,_0x3ae6a4);OpenchannelQueueEvents['on'](_0x2aa696,_0xf8cef9);}}; \ No newline at end of file +var _0x4465=['update','emit','removeListener','register','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x25804d,_0x5d9004){var _0x1884c7=function(_0x12a14a){while(--_0x12a14a){_0x25804d['push'](_0x25804d['shift']());}};_0x1884c7(++_0x5d9004);}(_0x4465,0x1ed));var _0x5446=function(_0x134e8c,_0x585790){_0x134e8c=_0x134e8c-0x0;var _0x5f1c16=_0x4465[_0x134e8c];return _0x5f1c16;};'use strict';var OpenchannelQueueEvents=require(_0x5446('0x0'));var events=[_0x5446('0x1'),_0x5446('0x2'),_0x5446('0x3')];function createListener(_0x48314b,_0x3f3250){return function(_0x1fa3d1){_0x3f3250[_0x5446('0x4')](_0x48314b,_0x1fa3d1);};}function removeListener(_0x3ffcfa,_0x319ac5){return function(){OpenchannelQueueEvents[_0x5446('0x5')](_0x3ffcfa,_0x319ac5);};}exports[_0x5446('0x6')]=function(_0x59eefe){for(var _0x381be7=0x0,_0x409490=events['length'];_0x381be7<_0x409490;_0x381be7++){var _0x5abfa3=events[_0x381be7];var _0x2b03f4=createListener(_0x5446('0x7')+_0x5abfa3,_0x59eefe);OpenchannelQueueEvents['on'](_0x5abfa3,_0x2b03f4);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 32eac32..b95125a 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 _0xc4d5=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','util'];(function(_0x540ba2,_0x5efe70){var _0x3ac47e=function(_0x3dfcbe){while(--_0x3dfcbe){_0x540ba2['push'](_0x540ba2['shift']());}};_0x3ac47e(++_0x5efe70);}(_0xc4d5,0x76));var _0x5c4d=function(_0x2652ef,_0x234230){_0x2652ef=_0x2652ef-0x0;var _0x2db578=_0xc4d5[_0x2652ef];return _0x2db578;};'use strict';var multer=require('multer');var util=require(_0x5c4d('0x0'));var path=require(_0x5c4d('0x1'));var timeout=require('connect-timeout');var express=require(_0x5c4d('0x2'));var router=express['Router']();var fs_extra=require(_0x5c4d('0x3'));var auth=require(_0x5c4d('0x4'));var interaction=require(_0x5c4d('0x5'));var config=require(_0x5c4d('0x6'));var controller=require('./openchannelQueueReport.controller');router[_0x5c4d('0x7')]('/',auth[_0x5c4d('0x8')](),controller['index']);router[_0x5c4d('0x7')]('/describe',auth[_0x5c4d('0x8')](),controller['describe']);router[_0x5c4d('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x5c4d('0x9')]);router[_0x5c4d('0xa')]('/',auth[_0x5c4d('0x8')](),controller[_0x5c4d('0xb')]);router['put'](_0x5c4d('0xc'),auth['isAuthenticated'](),controller[_0x5c4d('0xd')]);router[_0x5c4d('0xe')](_0x5c4d('0xc'),auth[_0x5c4d('0x8')](),controller[_0x5c4d('0xf')]);module[_0x5c4d('0x10')]=router; \ No newline at end of file +var _0xfe11=['Router','../../components/auth/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x3d79ab,_0x503c7f){var _0x491bce=function(_0x569e59){while(--_0x569e59){_0x3d79ab['push'](_0x3d79ab['shift']());}};_0x491bce(++_0x503c7f);}(_0xfe11,0xd7));var _0x1fe1=function(_0x45ca1f,_0x2341c9){_0x45ca1f=_0x45ca1f-0x0;var _0x11b2ce=_0xfe11[_0x45ca1f];return _0x11b2ce;};'use strict';var multer=require(_0x1fe1('0x0'));var util=require(_0x1fe1('0x1'));var path=require(_0x1fe1('0x2'));var timeout=require(_0x1fe1('0x3'));var express=require(_0x1fe1('0x4'));var router=express[_0x1fe1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1fe1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1fe1('0x7'));router[_0x1fe1('0x8')]('/',auth[_0x1fe1('0x9')](),controller[_0x1fe1('0xa')]);router[_0x1fe1('0x8')](_0x1fe1('0xb'),auth[_0x1fe1('0x9')](),controller[_0x1fe1('0xc')]);router[_0x1fe1('0x8')](_0x1fe1('0xd'),auth[_0x1fe1('0x9')](),controller[_0x1fe1('0xe')]);router['post']('/',auth[_0x1fe1('0x9')](),controller[_0x1fe1('0xf')]);router[_0x1fe1('0x10')](_0x1fe1('0xd'),auth['isAuthenticated'](),controller[_0x1fe1('0x11')]);router[_0x1fe1('0x12')](_0x1fe1('0xd'),auth['isAuthenticated'](),controller[_0x1fe1('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 0714d5e..e39a3d4 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 _0xffb7=['moment','sequelize','STRING','DATE'];(function(_0x2f17e4,_0x1d4bc3){var _0x397e3a=function(_0xfefbaa){while(--_0xfefbaa){_0x2f17e4['push'](_0x2f17e4['shift']());}};_0x397e3a(++_0x1d4bc3);}(_0xffb7,0x1d8));var _0x7ffb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xffb7[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x7ffb('0x0'));var Sequelize=require(_0x7ffb('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x7ffb('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7ffb('0x2')]},'joinAt':{'type':Sequelize[_0x7ffb('0x3')]},'leaveAt':{'type':Sequelize[_0x7ffb('0x3')]},'acceptAt':{'type':Sequelize[_0x7ffb('0x3')]},'exitAt':{'type':Sequelize[_0x7ffb('0x3')]},'reason':{'type':Sequelize[_0x7ffb('0x2')]}}; \ No newline at end of file +var _0x65b8=['sequelize','exports','STRING','DATE','moment'];(function(_0x2dae90,_0x406878){var _0x196909=function(_0x425b9b){while(--_0x425b9b){_0x2dae90['push'](_0x2dae90['shift']());}};_0x196909(++_0x406878);}(_0x65b8,0x1c1));var _0x865b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x65b8[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x865b('0x0'));var Sequelize=require(_0x865b('0x1'));module[_0x865b('0x2')]={'uniqueid':{'type':Sequelize[_0x865b('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x865b('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x865b('0x4')]},'reason':{'type':Sequelize[_0x865b('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index a6cda6a..eedd1ba 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 _0x9125=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','destroy','then','stack','name','send','index','OpenchannelQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9125,0x1b2));var _0x5912=function(_0xb953a,_0x3d230e){_0xb953a=_0xb953a-0x0;var _0x27ea69=_0x9125[_0xb953a];return _0x27ea69;};'use strict';var emlformat=require(_0x5912('0x0'));var rimraf=require(_0x5912('0x1'));var zipdir=require(_0x5912('0x2'));var jsonpatch=require(_0x5912('0x3'));var rp=require(_0x5912('0x4'));var moment=require(_0x5912('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5912('0x6'));var path=require(_0x5912('0x7'));var sox=require(_0x5912('0x8'));var csv=require('to-csv');var ejs=require(_0x5912('0x9'));var fs=require('fs');var fs_extra=require(_0x5912('0xa'));var _=require(_0x5912('0xb'));var squel=require(_0x5912('0xc'));var crypto=require(_0x5912('0xd'));var jsforce=require(_0x5912('0xe'));var deskjs=require(_0x5912('0xf'));var toCsv=require(_0x5912('0x10'));var querystring=require(_0x5912('0x11'));var Papa=require(_0x5912('0x12'));var Redis=require(_0x5912('0x13'));var authService=require(_0x5912('0x14'));var qs=require(_0x5912('0x15'));var as=require(_0x5912('0x16'));var hardwareService=require(_0x5912('0x17'));var logger=require(_0x5912('0x18'))(_0x5912('0x19'));var utils=require(_0x5912('0x1a'));var config=require(_0x5912('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eec80,_0x2f5c47){_0x2f5c47=_0x2f5c47||0xcc;return function(_0x31a54d){if(_0x31a54d){return _0x3eec80[_0x5912('0x1c')](_0x2f5c47);}return _0x3eec80[_0x5912('0x1d')](_0x2f5c47)[_0x5912('0x1e')]();};}function respondWithResult(_0x11a59c,_0x3073b6){_0x3073b6=_0x3073b6||0xc8;return function(_0x3907c0){if(_0x3907c0){return _0x11a59c[_0x5912('0x1d')](_0x3073b6)[_0x5912('0x1f')](_0x3907c0);}};}function respondWithFilteredResult(_0x3d6457,_0x444b60){return function(_0xa27e58){if(_0xa27e58){var _0x1c0939=typeof _0x444b60[_0x5912('0x20')]==='undefined'&&typeof _0x444b60[_0x5912('0x21')]==='undefined';var _0x173bce=_0xa27e58[_0x5912('0x22')];var _0x5aa815=_0x1c0939?0x0:_0x444b60['offset'];var _0x1d9bc4=_0x1c0939?_0xa27e58[_0x5912('0x22')]:_0x444b60[_0x5912('0x20')]+_0x444b60[_0x5912('0x21')];var _0x4361b3;if(_0x1d9bc4>=_0x173bce){_0x1d9bc4=_0x173bce;_0x4361b3=0xc8;}else{_0x4361b3=0xce;}_0x3d6457[_0x5912('0x1d')](_0x4361b3);return _0x3d6457['set'](_0x5912('0x23'),_0x5aa815+'-'+_0x1d9bc4+'/'+_0x173bce)[_0x5912('0x1f')](_0xa27e58);}return null;};}function patchUpdates(_0x54c8ac){return function(_0x59e451){try{jsonpatch['apply'](_0x59e451,_0x54c8ac,!![]);}catch(_0x38a397){return BPromise[_0x5912('0x24')](_0x38a397);}return _0x59e451[_0x5912('0x25')]();};}function saveUpdates(_0xd5fe4d,_0x20fdf6){return function(_0x190519){if(_0x190519){return _0x190519['update'](_0xd5fe4d)['then'](function(_0x57531d){return _0x57531d;});}return null;};}function removeEntity(_0x3a417a,_0x7ca313){return function(_0x422db5){if(_0x422db5){return _0x422db5[_0x5912('0x26')]()[_0x5912('0x27')](function(){_0x3a417a[_0x5912('0x1d')](0xcc)[_0x5912('0x1e')]();});}};}function handleEntityNotFound(_0x3ea2ce,_0x341602){return function(_0x552824){if(!_0x552824){_0x3ea2ce[_0x5912('0x1c')](0x194);}return _0x552824;};}function handleError(_0x412dc8,_0x23ef1a){_0x23ef1a=_0x23ef1a||0x1f4;return function(_0x59082d){logger['error'](_0x59082d[_0x5912('0x28')]);if(_0x59082d[_0x5912('0x29')]){delete _0x59082d['name'];}_0x412dc8[_0x5912('0x1d')](_0x23ef1a)[_0x5912('0x2a')](_0x59082d);};}exports[_0x5912('0x2b')]=function(_0x7b85b4,_0x5ad5f8){var _0x40f8e9={},_0x3ca46e={},_0x129a74={'count':0x0,'rows':[]};var _0x112577=_['map'](db[_0x5912('0x2c')][_0x5912('0x2d')],function(_0x293d9a){return{'name':_0x293d9a['fieldName'],'type':_0x293d9a[_0x5912('0x2e')][_0x5912('0x2f')]};});_0x3ca46e[_0x5912('0x30')]=_['map'](_0x112577,_0x5912('0x29'));_0x3ca46e[_0x5912('0x31')]=_[_0x5912('0x32')](_0x7b85b4[_0x5912('0x31')]);_0x3ca46e[_0x5912('0x33')]=_[_0x5912('0x34')](_0x3ca46e[_0x5912('0x30')],_0x3ca46e[_0x5912('0x31')]);_0x40f8e9['attributes']=_[_0x5912('0x34')](_0x3ca46e[_0x5912('0x30')],qs[_0x5912('0x35')](_0x7b85b4[_0x5912('0x31')]['fields']));_0x40f8e9['attributes']=_0x40f8e9[_0x5912('0x36')]['length']?_0x40f8e9['attributes']:_0x3ca46e[_0x5912('0x30')];if(!_0x7b85b4[_0x5912('0x31')]['hasOwnProperty'](_0x5912('0x37'))){_0x40f8e9['limit']=qs[_0x5912('0x21')](_0x7b85b4['query']['limit']);_0x40f8e9[_0x5912('0x20')]=qs[_0x5912('0x20')](_0x7b85b4[_0x5912('0x31')][_0x5912('0x20')]);}_0x40f8e9[_0x5912('0x38')]=qs[_0x5912('0x39')](_0x7b85b4[_0x5912('0x31')]['sort']);_0x40f8e9[_0x5912('0x3a')]=qs[_0x5912('0x33')](_['pick'](_0x7b85b4[_0x5912('0x31')],_0x3ca46e['filters']),_0x112577);if(_0x7b85b4[_0x5912('0x31')][_0x5912('0x3b')]){_0x40f8e9[_0x5912('0x3a')]=_[_0x5912('0x3c')](_0x40f8e9[_0x5912('0x3a')],{'$or':_[_0x5912('0x3d')](_0x112577,function(_0xf9d5dd){if(_0xf9d5dd[_0x5912('0x2e')]!=='VIRTUAL'){var _0x492471={};_0x492471[_0xf9d5dd[_0x5912('0x29')]]={'$like':'%'+_0x7b85b4[_0x5912('0x31')]['filter']+'%'};return _0x492471;}})});}_0x40f8e9=_[_0x5912('0x3c')]({},_0x40f8e9,_0x7b85b4[_0x5912('0x3e')]);var _0x476efe={'where':_0x40f8e9[_0x5912('0x3a')]};return db[_0x5912('0x2c')][_0x5912('0x22')](_0x476efe)['then'](function(_0x4a6f35){_0x129a74[_0x5912('0x22')]=_0x4a6f35;if(_0x7b85b4[_0x5912('0x31')][_0x5912('0x3f')]){_0x40f8e9[_0x5912('0x40')]=[{'all':!![]}];}return db[_0x5912('0x2c')][_0x5912('0x41')](_0x40f8e9);})[_0x5912('0x27')](function(_0x522424){_0x129a74[_0x5912('0x42')]=_0x522424;return _0x129a74;})['then'](respondWithFilteredResult(_0x5ad5f8,_0x40f8e9))[_0x5912('0x43')](handleError(_0x5ad5f8,null));};exports[_0x5912('0x44')]=function(_0x4d2892,_0x378e71){var _0x29ecb0={'raw':!![],'where':{'id':_0x4d2892[_0x5912('0x45')]['id']}},_0x26cc6d={};_0x26cc6d['model']=_['keys'](db[_0x5912('0x2c')][_0x5912('0x2d')]);_0x26cc6d[_0x5912('0x31')]=_['keys'](_0x4d2892[_0x5912('0x31')]);_0x26cc6d[_0x5912('0x33')]=_[_0x5912('0x34')](_0x26cc6d['model'],_0x26cc6d[_0x5912('0x31')]);_0x29ecb0[_0x5912('0x36')]=_[_0x5912('0x34')](_0x26cc6d[_0x5912('0x30')],qs[_0x5912('0x35')](_0x4d2892['query'][_0x5912('0x35')]));_0x29ecb0[_0x5912('0x36')]=_0x29ecb0[_0x5912('0x36')][_0x5912('0x46')]?_0x29ecb0[_0x5912('0x36')]:_0x26cc6d['model'];if(_0x4d2892[_0x5912('0x31')][_0x5912('0x3f')]){_0x29ecb0[_0x5912('0x40')]=[{'all':!![]}];}_0x29ecb0=_['merge']({},_0x29ecb0,_0x4d2892[_0x5912('0x3e')]);return db[_0x5912('0x2c')][_0x5912('0x47')](_0x29ecb0)[_0x5912('0x27')](handleEntityNotFound(_0x378e71,null))[_0x5912('0x27')](respondWithResult(_0x378e71,null))[_0x5912('0x43')](handleError(_0x378e71,null));};exports[_0x5912('0x48')]=function(_0x29a8b3,_0x133b95){return db[_0x5912('0x2c')][_0x5912('0x48')](_0x29a8b3[_0x5912('0x49')],{})[_0x5912('0x27')](respondWithResult(_0x133b95,0xc9))[_0x5912('0x43')](handleError(_0x133b95,null));};exports[_0x5912('0x4a')]=function(_0xe210aa,_0x453434){if(_0xe210aa[_0x5912('0x49')]['id']){delete _0xe210aa['body']['id'];}return db[_0x5912('0x2c')][_0x5912('0x47')]({'where':{'id':_0xe210aa[_0x5912('0x45')]['id']}})[_0x5912('0x27')](handleEntityNotFound(_0x453434,null))[_0x5912('0x27')](saveUpdates(_0xe210aa[_0x5912('0x49')],null))[_0x5912('0x27')](respondWithResult(_0x453434,null))[_0x5912('0x43')](handleError(_0x453434,null));};exports[_0x5912('0x26')]=function(_0x44fd5a,_0x370245){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x44fd5a[_0x5912('0x45')]['id']}})[_0x5912('0x27')](handleEntityNotFound(_0x370245,null))[_0x5912('0x27')](removeEntity(_0x370245,null))[_0x5912('0x43')](handleError(_0x370245,null));};exports['describe']=function(_0x110e72,_0x344f77){return db[_0x5912('0x2c')]['describe']()[_0x5912('0x27')](respondWithResult(_0x344f77,null))[_0x5912('0x43')](handleError(_0x344f77,null));}; \ No newline at end of file +var _0xdfce=['merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0xdfce,0x18f));var _0xedfc=function(_0x14bb56,_0x685b5c){_0x14bb56=_0x14bb56-0x0;var _0x18c9f8=_0xdfce[_0x14bb56];return _0x18c9f8;};'use strict';var emlformat=require(_0xedfc('0x0'));var rimraf=require(_0xedfc('0x1'));var zipdir=require(_0xedfc('0x2'));var jsonpatch=require(_0xedfc('0x3'));var rp=require('request-promise');var moment=require(_0xedfc('0x4'));var BPromise=require(_0xedfc('0x5'));var Mustache=require(_0xedfc('0x6'));var util=require(_0xedfc('0x7'));var path=require(_0xedfc('0x8'));var sox=require(_0xedfc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xedfc('0xa'));var squel=require(_0xedfc('0xb'));var crypto=require(_0xedfc('0xc'));var jsforce=require(_0xedfc('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xedfc('0xe'));var Papa=require('papaparse');var Redis=require(_0xedfc('0xf'));var authService=require(_0xedfc('0x10'));var qs=require(_0xedfc('0x11'));var as=require(_0xedfc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xedfc('0x13'))(_0xedfc('0x14'));var utils=require(_0xedfc('0x15'));var config=require(_0xedfc('0x16'));var licenseUtil=require(_0xedfc('0x17'));var db=require(_0xedfc('0x18'))['db'];function respondWithStatusCode(_0x4b2756,_0xae5590){_0xae5590=_0xae5590||0xcc;return function(_0x8b5898){if(_0x8b5898){return _0x4b2756['sendStatus'](_0xae5590);}return _0x4b2756[_0xedfc('0x19')](_0xae5590)['end']();};}function respondWithResult(_0x174e3f,_0x188a42){_0x188a42=_0x188a42||0xc8;return function(_0x546379){if(_0x546379){return _0x174e3f[_0xedfc('0x19')](_0x188a42)[_0xedfc('0x1a')](_0x546379);}};}function respondWithFilteredResult(_0x780393,_0x4d7d97){return function(_0xbb5300){if(_0xbb5300){var _0x149b70=typeof _0x4d7d97[_0xedfc('0x1b')]==='undefined'&&typeof _0x4d7d97['limit']===_0xedfc('0x1c');var _0x5cca34=_0xbb5300[_0xedfc('0x1d')];var _0x1e5b8c=_0x149b70?0x0:_0x4d7d97[_0xedfc('0x1b')];var _0x3ca956=_0x149b70?_0xbb5300[_0xedfc('0x1d')]:_0x4d7d97[_0xedfc('0x1b')]+_0x4d7d97[_0xedfc('0x1e')];var _0x586541;if(_0x3ca956>=_0x5cca34){_0x3ca956=_0x5cca34;_0x586541=0xc8;}else{_0x586541=0xce;}_0x780393['status'](_0x586541);return _0x780393[_0xedfc('0x1f')]('Content-Range',_0x1e5b8c+'-'+_0x3ca956+'/'+_0x5cca34)[_0xedfc('0x1a')](_0xbb5300);}return null;};}function patchUpdates(_0x14652f){return function(_0x9e11bf){try{jsonpatch[_0xedfc('0x20')](_0x9e11bf,_0x14652f,!![]);}catch(_0x326a49){return BPromise['reject'](_0x326a49);}return _0x9e11bf[_0xedfc('0x21')]();};}function saveUpdates(_0x28ed4a,_0x317734){return function(_0x1f723d){if(_0x1f723d){return _0x1f723d[_0xedfc('0x22')](_0x28ed4a)[_0xedfc('0x23')](function(_0x5b3c24){return _0x5b3c24;});}return null;};}function removeEntity(_0x3401b1,_0x4779f8){return function(_0x330ea3){if(_0x330ea3){return _0x330ea3[_0xedfc('0x24')]()[_0xedfc('0x23')](function(){_0x3401b1[_0xedfc('0x19')](0xcc)[_0xedfc('0x25')]();});}};}function handleEntityNotFound(_0x5b1d65,_0x1869f3){return function(_0x107472){if(!_0x107472){_0x5b1d65[_0xedfc('0x26')](0x194);}return _0x107472;};}function handleError(_0x535c63,_0x1a0f74){_0x1a0f74=_0x1a0f74||0x1f4;return function(_0x3598bc){logger[_0xedfc('0x27')](_0x3598bc[_0xedfc('0x28')]);if(_0x3598bc['name']){delete _0x3598bc[_0xedfc('0x29')];}_0x535c63[_0xedfc('0x19')](_0x1a0f74)[_0xedfc('0x2a')](_0x3598bc);};}exports[_0xedfc('0x2b')]=function(_0x3d0027,_0x8d9d54){var _0x427dfe={},_0x4fa379={},_0x2106dd={'count':0x0,'rows':[]};var _0x57ffaf=_[_0xedfc('0x2c')](db[_0xedfc('0x2d')]['rawAttributes'],function(_0x539ad6){return{'name':_0x539ad6[_0xedfc('0x2e')],'type':_0x539ad6[_0xedfc('0x2f')][_0xedfc('0x30')]};});_0x4fa379[_0xedfc('0x31')]=_['map'](_0x57ffaf,'name');_0x4fa379[_0xedfc('0x32')]=_[_0xedfc('0x33')](_0x3d0027[_0xedfc('0x32')]);_0x4fa379['filters']=_[_0xedfc('0x34')](_0x4fa379[_0xedfc('0x31')],_0x4fa379[_0xedfc('0x32')]);_0x427dfe[_0xedfc('0x35')]=_[_0xedfc('0x34')](_0x4fa379[_0xedfc('0x31')],qs[_0xedfc('0x36')](_0x3d0027[_0xedfc('0x32')][_0xedfc('0x36')]));_0x427dfe[_0xedfc('0x35')]=_0x427dfe[_0xedfc('0x35')][_0xedfc('0x37')]?_0x427dfe[_0xedfc('0x35')]:_0x4fa379['model'];if(!_0x3d0027[_0xedfc('0x32')][_0xedfc('0x38')](_0xedfc('0x39'))){_0x427dfe[_0xedfc('0x1e')]=qs[_0xedfc('0x1e')](_0x3d0027[_0xedfc('0x32')]['limit']);_0x427dfe['offset']=qs[_0xedfc('0x1b')](_0x3d0027[_0xedfc('0x32')]['offset']);}_0x427dfe[_0xedfc('0x3a')]=qs[_0xedfc('0x3b')](_0x3d0027[_0xedfc('0x32')]['sort']);_0x427dfe['where']=qs[_0xedfc('0x3c')](_[_0xedfc('0x3d')](_0x3d0027[_0xedfc('0x32')],_0x4fa379[_0xedfc('0x3c')]),_0x57ffaf);if(_0x3d0027[_0xedfc('0x32')][_0xedfc('0x3e')]){_0x427dfe['where']=_[_0xedfc('0x3f')](_0x427dfe['where'],{'$or':_[_0xedfc('0x2c')](_0x57ffaf,function(_0x384a6b){if(_0x384a6b[_0xedfc('0x2f')]!==_0xedfc('0x40')){var _0x3a609e={};_0x3a609e[_0x384a6b['name']]={'$like':'%'+_0x3d0027[_0xedfc('0x32')][_0xedfc('0x3e')]+'%'};return _0x3a609e;}})});}_0x427dfe=_[_0xedfc('0x3f')]({},_0x427dfe,_0x3d0027['options']);var _0xe19a42={'where':_0x427dfe['where']};return db[_0xedfc('0x2d')]['count'](_0xe19a42)[_0xedfc('0x23')](function(_0x3c85bd){_0x2106dd[_0xedfc('0x1d')]=_0x3c85bd;if(_0x3d0027[_0xedfc('0x32')][_0xedfc('0x41')]){_0x427dfe['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xedfc('0x42')](_0x427dfe);})['then'](function(_0x3f2d09){_0x2106dd[_0xedfc('0x43')]=_0x3f2d09;return _0x2106dd;})[_0xedfc('0x23')](respondWithFilteredResult(_0x8d9d54,_0x427dfe))[_0xedfc('0x44')](handleError(_0x8d9d54,null));};exports[_0xedfc('0x45')]=function(_0x41c287,_0x57b556){var _0x4d4523={'raw':!![],'where':{'id':_0x41c287[_0xedfc('0x46')]['id']}},_0x4c1030={};_0x4c1030[_0xedfc('0x31')]=_[_0xedfc('0x33')](db['OpenchannelQueueReport']['rawAttributes']);_0x4c1030[_0xedfc('0x32')]=_[_0xedfc('0x33')](_0x41c287[_0xedfc('0x32')]);_0x4c1030[_0xedfc('0x3c')]=_['intersection'](_0x4c1030[_0xedfc('0x31')],_0x4c1030['query']);_0x4d4523[_0xedfc('0x35')]=_[_0xedfc('0x34')](_0x4c1030['model'],qs[_0xedfc('0x36')](_0x41c287[_0xedfc('0x32')][_0xedfc('0x36')]));_0x4d4523['attributes']=_0x4d4523['attributes'][_0xedfc('0x37')]?_0x4d4523[_0xedfc('0x35')]:_0x4c1030[_0xedfc('0x31')];if(_0x41c287[_0xedfc('0x32')][_0xedfc('0x41')]){_0x4d4523[_0xedfc('0x47')]=[{'all':!![]}];}_0x4d4523=_[_0xedfc('0x3f')]({},_0x4d4523,_0x41c287[_0xedfc('0x48')]);return db[_0xedfc('0x2d')][_0xedfc('0x49')](_0x4d4523)[_0xedfc('0x23')](handleEntityNotFound(_0x57b556,null))[_0xedfc('0x23')](respondWithResult(_0x57b556,null))[_0xedfc('0x44')](handleError(_0x57b556,null));};exports[_0xedfc('0x4a')]=function(_0x1afdb2,_0x5071fe){return db[_0xedfc('0x2d')]['create'](_0x1afdb2[_0xedfc('0x4b')],{})['then'](respondWithResult(_0x5071fe,0xc9))[_0xedfc('0x44')](handleError(_0x5071fe,null));};exports[_0xedfc('0x22')]=function(_0x1d20e8,_0x690220){if(_0x1d20e8[_0xedfc('0x4b')]['id']){delete _0x1d20e8['body']['id'];}return db[_0xedfc('0x2d')][_0xedfc('0x49')]({'where':{'id':_0x1d20e8['params']['id']}})[_0xedfc('0x23')](handleEntityNotFound(_0x690220,null))['then'](saveUpdates(_0x1d20e8[_0xedfc('0x4b')],null))[_0xedfc('0x23')](respondWithResult(_0x690220,null))[_0xedfc('0x44')](handleError(_0x690220,null));};exports[_0xedfc('0x24')]=function(_0xd1d1f2,_0x3090c1){return db['OpenchannelQueueReport'][_0xedfc('0x49')]({'where':{'id':_0xd1d1f2[_0xedfc('0x46')]['id']}})[_0xedfc('0x23')](handleEntityNotFound(_0x3090c1,null))[_0xedfc('0x23')](removeEntity(_0x3090c1,null))[_0xedfc('0x44')](handleError(_0x3090c1,null));};exports['describe']=function(_0x51193c,_0x2ba0af){return db[_0xedfc('0x2d')][_0xedfc('0x4c')]()[_0xedfc('0x23')](respondWithResult(_0x2ba0af,null))[_0xedfc('0x44')](handleError(_0x2ba0af,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 2e7c7c7..35fbb6e 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(_0x3a552f,_0x3a5af7){var _0x1163de=function(_0x51e531){while(--_0x51e531){_0x3a552f['push'](_0x3a552f['shift']());}};_0x1163de(++_0x3a5af7);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'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 _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x158838,_0x5775f3){var _0xdcf68a=function(_0x5cba32){while(--_0x5cba32){_0x158838['push'](_0x158838['shift']());}};_0xdcf68a(++_0x5775f3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc4aa[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 5fb5d14..835a190 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 _0x4fad=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','update','attributes','limit','then','UpdateOpenchannelQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1d8a15,_0x4acbca){var _0x17b14b=function(_0x52c9e9){while(--_0x52c9e9){_0x1d8a15['push'](_0x1d8a15['shift']());}};_0x17b14b(++_0x4acbca);}(_0x4fad,0xcb));var _0xd4fa=function(_0x331383,_0x3101fa){_0x331383=_0x331383-0x0;var _0x194337=_0x4fad[_0x331383];return _0x194337;};'use strict';var _=require(_0xd4fa('0x0'));var util=require(_0xd4fa('0x1'));var moment=require(_0xd4fa('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4fa('0x3'));var fs=require('fs');var Redis=require(_0xd4fa('0x4'));var db=require(_0xd4fa('0x5'))['db'];var utils=require(_0xd4fa('0x6'));var logger=require(_0xd4fa('0x7'))(_0xd4fa('0x8'));var config=require(_0xd4fa('0x9'));var jayson=require(_0xd4fa('0xa'));var client=jayson['client'][_0xd4fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52b426,_0x2b9f6a,_0x19a910){return new BPromise(function(_0x155c09,_0x3fff99){return client[_0xd4fa('0xc')](_0x52b426,_0x19a910)['then'](function(_0x26a894){logger[_0xd4fa('0xd')](_0xd4fa('0xe'),_0x2b9f6a,'request\x20sent');logger[_0xd4fa('0xf')](_0xd4fa('0x10'),_0x2b9f6a,_0xd4fa('0x11'),JSON[_0xd4fa('0x12')](_0x26a894));if(_0x26a894['error']){if(_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x14')]===0x1f4){logger[_0xd4fa('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2b9f6a,_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x15')]);return _0x3fff99(_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x15')]);}logger[_0xd4fa('0x13')](_0xd4fa('0xe'),_0x2b9f6a,_0x26a894['error'][_0xd4fa('0x15')]);return _0x155c09(_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x15')]);}else{logger[_0xd4fa('0xd')](_0xd4fa('0xe'),_0x2b9f6a,_0xd4fa('0x11'));_0x155c09(_0x26a894[_0xd4fa('0x16')]['message']);}})[_0xd4fa('0x17')](function(_0x3a3b8c){logger[_0xd4fa('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2b9f6a,_0x3a3b8c);_0x3fff99(_0x3a3b8c);});});}exports['CreateOpenchannelQueueReport']=function(_0x1faa0b){var _0x5601d6=this;return new Promise(function(_0x5df190,_0x1f9be1){return db[_0xd4fa('0x18')][_0xd4fa('0x19')](_0x1faa0b[_0xd4fa('0x1a')],{'raw':_0x1faa0b['options']?_0x1faa0b[_0xd4fa('0x1b')][_0xd4fa('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0xbf7dcf){logger['info']('CreateOpenchannelQueueReport',_0x1faa0b);logger[_0xd4fa('0xf')](_0xd4fa('0x1d'),_0x1faa0b,JSON[_0xd4fa('0x12')](_0xbf7dcf));_0x5df190(_0xbf7dcf);})[_0xd4fa('0x17')](function(_0x586af0){logger[_0xd4fa('0x13')](_0xd4fa('0x1d'),_0x586af0[_0xd4fa('0x15')],_0x1faa0b);_0x1f9be1(_0x5601d6[_0xd4fa('0x13')](0x1f4,_0x586af0[_0xd4fa('0x15')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2a9d07){var _0x14ea6e=this;return new Promise(function(_0x4c5836,_0x162459){return db[_0xd4fa('0x18')][_0xd4fa('0x1e')](_0x2a9d07[_0xd4fa('0x1a')],{'raw':_0x2a9d07[_0xd4fa('0x1b')]?_0x2a9d07[_0xd4fa('0x1b')][_0xd4fa('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a9d07[_0xd4fa('0x1b')]?_0x2a9d07[_0xd4fa('0x1b')]['where']||null:null,'attributes':_0x2a9d07[_0xd4fa('0x1b')]?_0x2a9d07['options'][_0xd4fa('0x1f')]||null:null,'limit':_0x2a9d07[_0xd4fa('0x1b')]?_0x2a9d07['options'][_0xd4fa('0x20')]||null:null})[_0xd4fa('0x21')](function(_0x1b16ba){logger['info'](_0xd4fa('0x22'),_0x2a9d07);logger[_0xd4fa('0xf')]('UpdateOpenchannelQueueReport',_0x2a9d07,JSON[_0xd4fa('0x12')](_0x1b16ba));_0x4c5836(_0x1b16ba);})[_0xd4fa('0x17')](function(_0x5455a2){logger[_0xd4fa('0x13')](_0xd4fa('0x22'),_0x5455a2[_0xd4fa('0x15')],_0x2a9d07);_0x162459(_0x14ea6e[_0xd4fa('0x13')](0x1f4,_0x5455a2[_0xd4fa('0x15')]));});});}; \ No newline at end of file +var _0xaa5e=['UpdateOpenchannelQueueReport','update','body','attributes','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','OpenchannelQueueReport','create','options','raw','CreateOpenchannelQueueReport','debug','catch'];(function(_0x52731d,_0x395daa){var _0x27f059=function(_0xe04ce8){while(--_0xe04ce8){_0x52731d['push'](_0x52731d['shift']());}};_0x27f059(++_0x395daa);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x3efa25,_0x227ac3){_0x3efa25=_0x3efa25-0x0;var _0x1212cf=_0xaa5e[_0x3efa25];return _0x1212cf;};'use strict';var _=require(_0xeaa5('0x0'));var util=require(_0xeaa5('0x1'));var moment=require('moment');var BPromise=require(_0xeaa5('0x2'));var rs=require(_0xeaa5('0x3'));var fs=require('fs');var Redis=require(_0xeaa5('0x4'));var db=require(_0xeaa5('0x5'))['db'];var utils=require(_0xeaa5('0x6'));var logger=require('../../config/logger')(_0xeaa5('0x7'));var config=require(_0xeaa5('0x8'));var jayson=require(_0xeaa5('0x9'));var client=jayson[_0xeaa5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d405e,_0x2f9041,_0x2c9696){return new BPromise(function(_0x50cb62,_0x2e35c3){return client[_0xeaa5('0xb')](_0x4d405e,_0x2c9696)['then'](function(_0x2e9ca6){logger['info'](_0xeaa5('0xc'),_0x2f9041,_0xeaa5('0xd'));logger['debug'](_0xeaa5('0xe'),_0x2f9041,_0xeaa5('0xd'),JSON[_0xeaa5('0xf')](_0x2e9ca6));if(_0x2e9ca6[_0xeaa5('0x10')]){if(_0x2e9ca6[_0xeaa5('0x10')][_0xeaa5('0x11')]===0x1f4){logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x2e9ca6[_0xeaa5('0x10')]['message']);return _0x2e35c3(_0x2e9ca6[_0xeaa5('0x10')][_0xeaa5('0x12')]);}logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x2e9ca6[_0xeaa5('0x10')]['message']);return _0x50cb62(_0x2e9ca6[_0xeaa5('0x10')]['message']);}else{logger[_0xeaa5('0x13')](_0xeaa5('0xc'),_0x2f9041,_0xeaa5('0xd'));_0x50cb62(_0x2e9ca6['result'][_0xeaa5('0x12')]);}})['catch'](function(_0x44e4b4){logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x44e4b4);_0x2e35c3(_0x44e4b4);});});}exports['CreateOpenchannelQueueReport']=function(_0x1877a6){var _0x50256a=this;return new Promise(function(_0x222da7,_0x85fb44){return db[_0xeaa5('0x14')][_0xeaa5('0x15')](_0x1877a6['body'],{'raw':_0x1877a6[_0xeaa5('0x16')]?_0x1877a6[_0xeaa5('0x16')][_0xeaa5('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x11ace2){logger[_0xeaa5('0x13')](_0xeaa5('0x18'),_0x1877a6);logger[_0xeaa5('0x19')](_0xeaa5('0x18'),_0x1877a6,JSON['stringify'](_0x11ace2));_0x222da7(_0x11ace2);})[_0xeaa5('0x1a')](function(_0x5f2d83){logger[_0xeaa5('0x10')](_0xeaa5('0x18'),_0x5f2d83[_0xeaa5('0x12')],_0x1877a6);_0x85fb44(_0x50256a[_0xeaa5('0x10')](0x1f4,_0x5f2d83[_0xeaa5('0x12')]));});});};exports[_0xeaa5('0x1b')]=function(_0x355dbd){var _0xee844c=this;return new Promise(function(_0xebce8c,_0x2c4003){return db[_0xeaa5('0x14')][_0xeaa5('0x1c')](_0x355dbd[_0xeaa5('0x1d')],{'raw':_0x355dbd[_0xeaa5('0x16')]?_0x355dbd[_0xeaa5('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x355dbd[_0xeaa5('0x16')]?_0x355dbd[_0xeaa5('0x16')]['where']||null:null,'attributes':_0x355dbd[_0xeaa5('0x16')]?_0x355dbd[_0xeaa5('0x16')][_0xeaa5('0x1e')]||null:null,'limit':_0x355dbd[_0xeaa5('0x16')]?_0x355dbd[_0xeaa5('0x16')]['limit']||null:null})[_0xeaa5('0x1f')](function(_0x592fe1){logger[_0xeaa5('0x13')](_0xeaa5('0x1b'),_0x355dbd);logger[_0xeaa5('0x19')](_0xeaa5('0x1b'),_0x355dbd,JSON[_0xeaa5('0xf')](_0x592fe1));_0xebce8c(_0x592fe1);})[_0xeaa5('0x1a')](function(_0x5121b6){logger[_0xeaa5('0x10')](_0xeaa5('0x1b'),_0x5121b6['message'],_0x355dbd);_0x2c4003(_0xee844c[_0xeaa5('0x10')](0x1f4,_0x5121b6['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 153443f..ecd35da 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 _0x8359=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x420c95,_0x1052e9){var _0x25bf8c=function(_0x310982){while(--_0x310982){_0x420c95['push'](_0x420c95['shift']());}};_0x25bf8c(++_0x1052e9);}(_0x8359,0x1f0));var _0x9835=function(_0x470f24,_0x2436a9){_0x470f24=_0x470f24-0x0;var _0x2c6fc8=_0x8359[_0x470f24];return _0x2c6fc8;};'use strict';var multer=require('multer');var util=require(_0x9835('0x0'));var path=require(_0x9835('0x1'));var timeout=require(_0x9835('0x2'));var express=require('express');var router=express[_0x9835('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9835('0x4'));var interaction=require(_0x9835('0x5'));var config=require(_0x9835('0x6'));var controller=require('./openchannelTransferReport.controller');router[_0x9835('0x7')]('/',auth[_0x9835('0x8')](),controller[_0x9835('0x9')]);router['get'](_0x9835('0xa'),auth[_0x9835('0x8')](),controller['describe']);router[_0x9835('0x7')](_0x9835('0xb'),auth[_0x9835('0x8')](),controller[_0x9835('0xc')]);router[_0x9835('0xd')]('/',auth[_0x9835('0x8')](),controller[_0x9835('0xe')]);router[_0x9835('0xf')](_0x9835('0xb'),auth[_0x9835('0x8')](),controller[_0x9835('0x10')]);router[_0x9835('0x11')](_0x9835('0xb'),auth[_0x9835('0x8')](),controller[_0x9835('0x12')]);module[_0x9835('0x13')]=router; \ No newline at end of file +var _0x1b68=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy'];(function(_0x5e3e9a,_0x10f36c){var _0x1034f4=function(_0x455493){while(--_0x455493){_0x5e3e9a['push'](_0x5e3e9a['shift']());}};_0x1034f4(++_0x10f36c);}(_0x1b68,0x165));var _0x81b6=function(_0x5f2089,_0x442ed3){_0x5f2089=_0x5f2089-0x0;var _0x4c433b=_0x1b68[_0x5f2089];return _0x4c433b;};'use strict';var multer=require(_0x81b6('0x0'));var util=require('util');var path=require(_0x81b6('0x1'));var timeout=require(_0x81b6('0x2'));var express=require(_0x81b6('0x3'));var router=express[_0x81b6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x81b6('0x5'));var interaction=require(_0x81b6('0x6'));var config=require(_0x81b6('0x7'));var controller=require(_0x81b6('0x8'));router[_0x81b6('0x9')]('/',auth[_0x81b6('0xa')](),controller[_0x81b6('0xb')]);router['get'](_0x81b6('0xc'),auth[_0x81b6('0xa')](),controller[_0x81b6('0xd')]);router[_0x81b6('0x9')](_0x81b6('0xe'),auth[_0x81b6('0xa')](),controller[_0x81b6('0xf')]);router[_0x81b6('0x10')]('/',auth[_0x81b6('0xa')](),controller[_0x81b6('0x11')]);router[_0x81b6('0x12')](_0x81b6('0xe'),auth[_0x81b6('0xa')](),controller['update']);router[_0x81b6('0x13')](_0x81b6('0xe'),auth['isAuthenticated'](),controller[_0x81b6('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 6599fe3..7a68f7a 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(_0x1bb619,_0x7dcf7f){var _0x29ed0d=function(_0x4a223f){while(--_0x4a223f){_0x1bb619['push'](_0x1bb619['shift']());}};_0x29ed0d(++_0x7dcf7f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0xcb91[_0x269ee8];return _0x4d98bd;};'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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x50ef85,_0x10b0a5){var _0x352a69=function(_0x23a289){while(--_0x23a289){_0x50ef85['push'](_0x50ef85['shift']());}};_0x352a69(++_0x10b0a5);}(_0xe706,0xa3));var _0x6e70=function(_0x3f9584,_0x5ab12c){_0x3f9584=_0x3f9584-0x0;var _0x9d54c=_0xe706[_0x3f9584];return _0x9d54c;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 25de28f..9dd1bda 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 _0x7429=['OpenchannelTransferReport','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','findAll','rows','catch','show','params','includeAll','options','find','create','body','destroy','describe','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','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','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','index','map'];(function(_0x2b5b9e,_0x3dc761){var _0x1c39c7=function(_0x136f8c){while(--_0x136f8c){_0x2b5b9e['push'](_0x2b5b9e['shift']());}};_0x1c39c7(++_0x3dc761);}(_0x7429,0xec));var _0x9742=function(_0x295c49,_0x9cf29e){_0x295c49=_0x295c49-0x0;var _0x2baf96=_0x7429[_0x295c49];return _0x2baf96;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9742('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9742('0x1'));var rp=require(_0x9742('0x2'));var moment=require(_0x9742('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9742('0x4'));var path=require(_0x9742('0x5'));var sox=require('sox');var csv=require(_0x9742('0x6'));var ejs=require(_0x9742('0x7'));var fs=require('fs');var fs_extra=require(_0x9742('0x8'));var _=require(_0x9742('0x9'));var squel=require(_0x9742('0xa'));var crypto=require(_0x9742('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9742('0xc'));var Redis=require(_0x9742('0xd'));var authService=require(_0x9742('0xe'));var qs=require(_0x9742('0xf'));var as=require(_0x9742('0x10'));var hardwareService=require(_0x9742('0x11'));var logger=require(_0x9742('0x12'))(_0x9742('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9742('0x14'));var db=require(_0x9742('0x15'))['db'];function respondWithStatusCode(_0x496b6b,_0x2e7c74){_0x2e7c74=_0x2e7c74||0xcc;return function(_0x334d00){if(_0x334d00){return _0x496b6b[_0x9742('0x16')](_0x2e7c74);}return _0x496b6b[_0x9742('0x17')](_0x2e7c74)[_0x9742('0x18')]();};}function respondWithResult(_0x29ef59,_0x2450e8){_0x2450e8=_0x2450e8||0xc8;return function(_0x5b7d4d){if(_0x5b7d4d){return _0x29ef59[_0x9742('0x17')](_0x2450e8)[_0x9742('0x19')](_0x5b7d4d);}};}function respondWithFilteredResult(_0x48a327,_0x5aae70){return function(_0x58a1ba){if(_0x58a1ba){var _0x49212f=typeof _0x5aae70['offset']==='undefined'&&typeof _0x5aae70[_0x9742('0x1a')]==='undefined';var _0x10ce75=_0x58a1ba[_0x9742('0x1b')];var _0x36ea20=_0x49212f?0x0:_0x5aae70['offset'];var _0x5a004e=_0x49212f?_0x58a1ba['count']:_0x5aae70[_0x9742('0x1c')]+_0x5aae70[_0x9742('0x1a')];var _0x17af46;if(_0x5a004e>=_0x10ce75){_0x5a004e=_0x10ce75;_0x17af46=0xc8;}else{_0x17af46=0xce;}_0x48a327[_0x9742('0x17')](_0x17af46);return _0x48a327[_0x9742('0x1d')](_0x9742('0x1e'),_0x36ea20+'-'+_0x5a004e+'/'+_0x10ce75)['json'](_0x58a1ba);}return null;};}function patchUpdates(_0x12a6cf){return function(_0x5a8ada){try{jsonpatch[_0x9742('0x1f')](_0x5a8ada,_0x12a6cf,!![]);}catch(_0x142d52){return BPromise['reject'](_0x142d52);}return _0x5a8ada[_0x9742('0x20')]();};}function saveUpdates(_0x5b7967,_0x10632f){return function(_0x13594a){if(_0x13594a){return _0x13594a[_0x9742('0x21')](_0x5b7967)[_0x9742('0x22')](function(_0x5e1741){return _0x5e1741;});}return null;};}function removeEntity(_0x10467b,_0x298e67){return function(_0x516e47){if(_0x516e47){return _0x516e47['destroy']()['then'](function(){_0x10467b['status'](0xcc)[_0x9742('0x18')]();});}};}function handleEntityNotFound(_0x5c571a,_0xf42508){return function(_0xdcb4e){if(!_0xdcb4e){_0x5c571a[_0x9742('0x16')](0x194);}return _0xdcb4e;};}function handleError(_0x5a1615,_0x4f9359){_0x4f9359=_0x4f9359||0x1f4;return function(_0x84f27d){logger[_0x9742('0x23')](_0x84f27d[_0x9742('0x24')]);if(_0x84f27d[_0x9742('0x25')]){delete _0x84f27d[_0x9742('0x25')];}_0x5a1615[_0x9742('0x17')](_0x4f9359)['send'](_0x84f27d);};}exports[_0x9742('0x26')]=function(_0x419827,_0x4aa376){var _0x34c31c={},_0x2050a0={},_0x30d5c9={'count':0x0,'rows':[]};var _0x43c0c7=_[_0x9742('0x27')](db[_0x9742('0x28')]['rawAttributes'],function(_0x4fb8e4){return{'name':_0x4fb8e4['fieldName'],'type':_0x4fb8e4[_0x9742('0x29')]['key']};});_0x2050a0[_0x9742('0x2a')]=_[_0x9742('0x27')](_0x43c0c7,'name');_0x2050a0[_0x9742('0x2b')]=_[_0x9742('0x2c')](_0x419827['query']);_0x2050a0[_0x9742('0x2d')]=_['intersection'](_0x2050a0[_0x9742('0x2a')],_0x2050a0[_0x9742('0x2b')]);_0x34c31c[_0x9742('0x2e')]=_[_0x9742('0x2f')](_0x2050a0[_0x9742('0x2a')],qs[_0x9742('0x30')](_0x419827[_0x9742('0x2b')][_0x9742('0x30')]));_0x34c31c['attributes']=_0x34c31c[_0x9742('0x2e')][_0x9742('0x31')]?_0x34c31c['attributes']:_0x2050a0[_0x9742('0x2a')];if(!_0x419827['query'][_0x9742('0x32')](_0x9742('0x33'))){_0x34c31c[_0x9742('0x1a')]=qs[_0x9742('0x1a')](_0x419827['query'][_0x9742('0x1a')]);_0x34c31c['offset']=qs[_0x9742('0x1c')](_0x419827[_0x9742('0x2b')][_0x9742('0x1c')]);}_0x34c31c['order']=qs[_0x9742('0x34')](_0x419827[_0x9742('0x2b')][_0x9742('0x34')]);_0x34c31c[_0x9742('0x35')]=qs[_0x9742('0x2d')](_['pick'](_0x419827[_0x9742('0x2b')],_0x2050a0[_0x9742('0x2d')]),_0x43c0c7);if(_0x419827[_0x9742('0x2b')][_0x9742('0x36')]){_0x34c31c[_0x9742('0x35')]=_[_0x9742('0x37')](_0x34c31c[_0x9742('0x35')],{'$or':_[_0x9742('0x27')](_0x43c0c7,function(_0x7f283c){if(_0x7f283c['type']!==_0x9742('0x38')){var _0x43edb7={};_0x43edb7[_0x7f283c[_0x9742('0x25')]]={'$like':'%'+_0x419827['query']['filter']+'%'};return _0x43edb7;}})});}_0x34c31c=_[_0x9742('0x37')]({},_0x34c31c,_0x419827['options']);var _0x34dbad={'where':_0x34c31c['where']};return db[_0x9742('0x28')][_0x9742('0x1b')](_0x34dbad)[_0x9742('0x22')](function(_0x1cb4d9){_0x30d5c9['count']=_0x1cb4d9;if(_0x419827[_0x9742('0x2b')]['includeAll']){_0x34c31c['include']=[{'all':!![]}];}return db[_0x9742('0x28')][_0x9742('0x39')](_0x34c31c);})[_0x9742('0x22')](function(_0x22f4f0){_0x30d5c9[_0x9742('0x3a')]=_0x22f4f0;return _0x30d5c9;})[_0x9742('0x22')](respondWithFilteredResult(_0x4aa376,_0x34c31c))[_0x9742('0x3b')](handleError(_0x4aa376,null));};exports[_0x9742('0x3c')]=function(_0x3dff1a,_0x1beb5c){var _0x226ae5={'raw':!![],'where':{'id':_0x3dff1a[_0x9742('0x3d')]['id']}},_0x45ed0b={};_0x45ed0b[_0x9742('0x2a')]=_[_0x9742('0x2c')](db[_0x9742('0x28')]['rawAttributes']);_0x45ed0b[_0x9742('0x2b')]=_[_0x9742('0x2c')](_0x3dff1a[_0x9742('0x2b')]);_0x45ed0b['filters']=_['intersection'](_0x45ed0b[_0x9742('0x2a')],_0x45ed0b[_0x9742('0x2b')]);_0x226ae5[_0x9742('0x2e')]=_[_0x9742('0x2f')](_0x45ed0b[_0x9742('0x2a')],qs[_0x9742('0x30')](_0x3dff1a['query'][_0x9742('0x30')]));_0x226ae5[_0x9742('0x2e')]=_0x226ae5[_0x9742('0x2e')][_0x9742('0x31')]?_0x226ae5[_0x9742('0x2e')]:_0x45ed0b[_0x9742('0x2a')];if(_0x3dff1a['query'][_0x9742('0x3e')]){_0x226ae5['include']=[{'all':!![]}];}_0x226ae5=_[_0x9742('0x37')]({},_0x226ae5,_0x3dff1a[_0x9742('0x3f')]);return db['OpenchannelTransferReport'][_0x9742('0x40')](_0x226ae5)['then'](handleEntityNotFound(_0x1beb5c,null))[_0x9742('0x22')](respondWithResult(_0x1beb5c,null))[_0x9742('0x3b')](handleError(_0x1beb5c,null));};exports[_0x9742('0x41')]=function(_0x437e96,_0x1c194b){return db[_0x9742('0x28')][_0x9742('0x41')](_0x437e96[_0x9742('0x42')],{})[_0x9742('0x22')](respondWithResult(_0x1c194b,0xc9))[_0x9742('0x3b')](handleError(_0x1c194b,null));};exports[_0x9742('0x21')]=function(_0x1c8c01,_0x2f6072){if(_0x1c8c01[_0x9742('0x42')]['id']){delete _0x1c8c01['body']['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x1c8c01[_0x9742('0x3d')]['id']}})[_0x9742('0x22')](handleEntityNotFound(_0x2f6072,null))[_0x9742('0x22')](saveUpdates(_0x1c8c01[_0x9742('0x42')],null))[_0x9742('0x22')](respondWithResult(_0x2f6072,null))[_0x9742('0x3b')](handleError(_0x2f6072,null));};exports[_0x9742('0x43')]=function(_0x573e50,_0x4ea913){return db['OpenchannelTransferReport'][_0x9742('0x40')]({'where':{'id':_0x573e50[_0x9742('0x3d')]['id']}})[_0x9742('0x22')](handleEntityNotFound(_0x4ea913,null))[_0x9742('0x22')](removeEntity(_0x4ea913,null))[_0x9742('0x3b')](handleError(_0x4ea913,null));};exports[_0x9742('0x44')]=function(_0x3edd78,_0x31eaed){return db['OpenchannelTransferReport'][_0x9742('0x44')]()[_0x9742('0x22')](respondWithResult(_0x31eaed,null))[_0x9742('0x3b')](handleError(_0x31eaed,null));}; \ No newline at end of file +var _0x0036=['save','update','then','error','stack','name','send','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','OpenchannelTransferReport','includeAll','include','findAll','show','params','fields','find','catch','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','reject'];(function(_0x208d46,_0x3721ee){var _0x498f19=function(_0x49f911){while(--_0x49f911){_0x208d46['push'](_0x208d46['shift']());}};_0x498f19(++_0x3721ee);}(_0x0036,0xb7));var _0x6003=function(_0x40f339,_0x130882){_0x40f339=_0x40f339-0x0;var _0x48a594=_0x0036[_0x40f339];return _0x48a594;};'use strict';var emlformat=require(_0x6003('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6003('0x1'));var jsonpatch=require(_0x6003('0x2'));var rp=require(_0x6003('0x3'));var moment=require('moment');var BPromise=require(_0x6003('0x4'));var Mustache=require(_0x6003('0x5'));var util=require('util');var path=require(_0x6003('0x6'));var sox=require(_0x6003('0x7'));var csv=require(_0x6003('0x8'));var ejs=require(_0x6003('0x9'));var fs=require('fs');var fs_extra=require(_0x6003('0xa'));var _=require('lodash');var squel=require(_0x6003('0xb'));var crypto=require(_0x6003('0xc'));var jsforce=require(_0x6003('0xd'));var deskjs=require(_0x6003('0xe'));var toCsv=require(_0x6003('0x8'));var querystring=require(_0x6003('0xf'));var Papa=require(_0x6003('0x10'));var Redis=require('ioredis');var authService=require(_0x6003('0x11'));var qs=require(_0x6003('0x12'));var as=require(_0x6003('0x13'));var hardwareService=require(_0x6003('0x14'));var logger=require(_0x6003('0x15'))('api');var utils=require(_0x6003('0x16'));var config=require(_0x6003('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6003('0x18'))['db'];function respondWithStatusCode(_0x13d4cb,_0x62bdfe){_0x62bdfe=_0x62bdfe||0xcc;return function(_0x284b90){if(_0x284b90){return _0x13d4cb[_0x6003('0x19')](_0x62bdfe);}return _0x13d4cb[_0x6003('0x1a')](_0x62bdfe)[_0x6003('0x1b')]();};}function respondWithResult(_0x5bac63,_0x2b6e4a){_0x2b6e4a=_0x2b6e4a||0xc8;return function(_0x31f76d){if(_0x31f76d){return _0x5bac63['status'](_0x2b6e4a)[_0x6003('0x1c')](_0x31f76d);}};}function respondWithFilteredResult(_0x9f05,_0x4f39ca){return function(_0x44d5c8){if(_0x44d5c8){var _0x35a30b=typeof _0x4f39ca[_0x6003('0x1d')]===_0x6003('0x1e')&&typeof _0x4f39ca['limit']===_0x6003('0x1e');var _0x3858a7=_0x44d5c8[_0x6003('0x1f')];var _0x51ba9e=_0x35a30b?0x0:_0x4f39ca[_0x6003('0x1d')];var _0x2d0c5a=_0x35a30b?_0x44d5c8['count']:_0x4f39ca['offset']+_0x4f39ca['limit'];var _0x94e740;if(_0x2d0c5a>=_0x3858a7){_0x2d0c5a=_0x3858a7;_0x94e740=0xc8;}else{_0x94e740=0xce;}_0x9f05[_0x6003('0x1a')](_0x94e740);return _0x9f05['set']('Content-Range',_0x51ba9e+'-'+_0x2d0c5a+'/'+_0x3858a7)[_0x6003('0x1c')](_0x44d5c8);}return null;};}function patchUpdates(_0x253621){return function(_0xe1f484){try{jsonpatch['apply'](_0xe1f484,_0x253621,!![]);}catch(_0x4b680a){return BPromise[_0x6003('0x20')](_0x4b680a);}return _0xe1f484[_0x6003('0x21')]();};}function saveUpdates(_0x208e43,_0x3682b9){return function(_0x123e9b){if(_0x123e9b){return _0x123e9b[_0x6003('0x22')](_0x208e43)[_0x6003('0x23')](function(_0x345f97){return _0x345f97;});}return null;};}function removeEntity(_0x4cf0f9,_0x37c375){return function(_0x13514a){if(_0x13514a){return _0x13514a['destroy']()['then'](function(){_0x4cf0f9[_0x6003('0x1a')](0xcc)[_0x6003('0x1b')]();});}};}function handleEntityNotFound(_0x28770c,_0x2ef127){return function(_0x182a5f){if(!_0x182a5f){_0x28770c[_0x6003('0x19')](0x194);}return _0x182a5f;};}function handleError(_0x4ec1bd,_0x43c05e){_0x43c05e=_0x43c05e||0x1f4;return function(_0xab47e4){logger[_0x6003('0x24')](_0xab47e4[_0x6003('0x25')]);if(_0xab47e4[_0x6003('0x26')]){delete _0xab47e4[_0x6003('0x26')];}_0x4ec1bd['status'](_0x43c05e)[_0x6003('0x27')](_0xab47e4);};}exports[_0x6003('0x28')]=function(_0x12f3c5,_0x2e6eb9){var _0xe5bd49={},_0x51fcd7={},_0x175ec1={'count':0x0,'rows':[]};var _0x1ed2d1=_['map'](db['OpenchannelTransferReport'][_0x6003('0x29')],function(_0x1af323){return{'name':_0x1af323['fieldName'],'type':_0x1af323[_0x6003('0x2a')][_0x6003('0x2b')]};});_0x51fcd7[_0x6003('0x2c')]=_['map'](_0x1ed2d1,_0x6003('0x26'));_0x51fcd7[_0x6003('0x2d')]=_[_0x6003('0x2e')](_0x12f3c5[_0x6003('0x2d')]);_0x51fcd7[_0x6003('0x2f')]=_[_0x6003('0x30')](_0x51fcd7[_0x6003('0x2c')],_0x51fcd7['query']);_0xe5bd49[_0x6003('0x31')]=_['intersection'](_0x51fcd7[_0x6003('0x2c')],qs['fields'](_0x12f3c5[_0x6003('0x2d')]['fields']));_0xe5bd49[_0x6003('0x31')]=_0xe5bd49[_0x6003('0x31')]['length']?_0xe5bd49[_0x6003('0x31')]:_0x51fcd7[_0x6003('0x2c')];if(!_0x12f3c5[_0x6003('0x2d')][_0x6003('0x32')](_0x6003('0x33'))){_0xe5bd49['limit']=qs[_0x6003('0x34')](_0x12f3c5[_0x6003('0x2d')]['limit']);_0xe5bd49[_0x6003('0x1d')]=qs['offset'](_0x12f3c5['query']['offset']);}_0xe5bd49[_0x6003('0x35')]=qs[_0x6003('0x36')](_0x12f3c5['query']['sort']);_0xe5bd49[_0x6003('0x37')]=qs[_0x6003('0x2f')](_['pick'](_0x12f3c5[_0x6003('0x2d')],_0x51fcd7[_0x6003('0x2f')]),_0x1ed2d1);if(_0x12f3c5['query'][_0x6003('0x38')]){_0xe5bd49[_0x6003('0x37')]=_[_0x6003('0x39')](_0xe5bd49['where'],{'$or':_['map'](_0x1ed2d1,function(_0x55a6f5){if(_0x55a6f5[_0x6003('0x2a')]!==_0x6003('0x3a')){var _0x260961={};_0x260961[_0x55a6f5[_0x6003('0x26')]]={'$like':'%'+_0x12f3c5[_0x6003('0x2d')][_0x6003('0x38')]+'%'};return _0x260961;}})});}_0xe5bd49=_['merge']({},_0xe5bd49,_0x12f3c5['options']);var _0x342763={'where':_0xe5bd49[_0x6003('0x37')]};return db[_0x6003('0x3b')]['count'](_0x342763)['then'](function(_0x1cfd67){_0x175ec1[_0x6003('0x1f')]=_0x1cfd67;if(_0x12f3c5[_0x6003('0x2d')][_0x6003('0x3c')]){_0xe5bd49[_0x6003('0x3d')]=[{'all':!![]}];}return db[_0x6003('0x3b')][_0x6003('0x3e')](_0xe5bd49);})['then'](function(_0x373765){_0x175ec1['rows']=_0x373765;return _0x175ec1;})[_0x6003('0x23')](respondWithFilteredResult(_0x2e6eb9,_0xe5bd49))['catch'](handleError(_0x2e6eb9,null));};exports[_0x6003('0x3f')]=function(_0x56b741,_0x26ada6){var _0x38f51a={'raw':!![],'where':{'id':_0x56b741[_0x6003('0x40')]['id']}},_0x14efbf={};_0x14efbf[_0x6003('0x2c')]=_[_0x6003('0x2e')](db[_0x6003('0x3b')][_0x6003('0x29')]);_0x14efbf[_0x6003('0x2d')]=_[_0x6003('0x2e')](_0x56b741[_0x6003('0x2d')]);_0x14efbf[_0x6003('0x2f')]=_['intersection'](_0x14efbf[_0x6003('0x2c')],_0x14efbf[_0x6003('0x2d')]);_0x38f51a[_0x6003('0x31')]=_[_0x6003('0x30')](_0x14efbf['model'],qs[_0x6003('0x41')](_0x56b741[_0x6003('0x2d')][_0x6003('0x41')]));_0x38f51a[_0x6003('0x31')]=_0x38f51a['attributes']['length']?_0x38f51a[_0x6003('0x31')]:_0x14efbf['model'];if(_0x56b741[_0x6003('0x2d')]['includeAll']){_0x38f51a[_0x6003('0x3d')]=[{'all':!![]}];}_0x38f51a=_[_0x6003('0x39')]({},_0x38f51a,_0x56b741['options']);return db[_0x6003('0x3b')][_0x6003('0x42')](_0x38f51a)[_0x6003('0x23')](handleEntityNotFound(_0x26ada6,null))['then'](respondWithResult(_0x26ada6,null))[_0x6003('0x43')](handleError(_0x26ada6,null));};exports[_0x6003('0x44')]=function(_0x27e164,_0x3fe56a){return db['OpenchannelTransferReport'][_0x6003('0x44')](_0x27e164['body'],{})[_0x6003('0x23')](respondWithResult(_0x3fe56a,0xc9))[_0x6003('0x43')](handleError(_0x3fe56a,null));};exports[_0x6003('0x22')]=function(_0x13b589,_0x504d66){if(_0x13b589[_0x6003('0x45')]['id']){delete _0x13b589['body']['id'];}return db[_0x6003('0x3b')][_0x6003('0x42')]({'where':{'id':_0x13b589['params']['id']}})['then'](handleEntityNotFound(_0x504d66,null))[_0x6003('0x23')](saveUpdates(_0x13b589['body'],null))[_0x6003('0x23')](respondWithResult(_0x504d66,null))['catch'](handleError(_0x504d66,null));};exports[_0x6003('0x46')]=function(_0x4626f2,_0x252255){return db[_0x6003('0x3b')]['find']({'where':{'id':_0x4626f2[_0x6003('0x40')]['id']}})[_0x6003('0x23')](handleEntityNotFound(_0x252255,null))[_0x6003('0x23')](removeEntity(_0x252255,null))[_0x6003('0x43')](handleError(_0x252255,null));};exports[_0x6003('0x47')]=function(_0x5bd3c7,_0x52fd95){return db[_0x6003('0x3b')][_0x6003('0x47')]()[_0x6003('0x23')](respondWithResult(_0x52fd95,null))[_0x6003('0x43')](handleError(_0x52fd95,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index a2774a4..8b18de0 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 _0xddbc=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1e1bda,_0x3e07e8){var _0x5d7517=function(_0x59588c){while(--_0x59588c){_0x1e1bda['push'](_0x1e1bda['shift']());}};_0x5d7517(++_0x3e07e8);}(_0xddbc,0xd7));var _0xcddb=function(_0x3025b3,_0x4f43c2){_0x3025b3=_0x3025b3-0x0;var _0x1296e2=_0xddbc[_0x3025b3];return _0x1296e2;};'use strict';var _=require(_0xcddb('0x0'));var util=require(_0xcddb('0x1'));var logger=require(_0xcddb('0x2'))(_0xcddb('0x3'));var moment=require(_0xcddb('0x4'));var BPromise=require('bluebird');var rp=require(_0xcddb('0x5'));var fs=require('fs');var path=require(_0xcddb('0x6'));var rimraf=require(_0xcddb('0x7'));var config=require(_0xcddb('0x8'));var attributes=require(_0xcddb('0x9'));module['exports']=function(_0x8c15ba,_0x157969){return _0x8c15ba['define'](_0xcddb('0xa'),attributes,{'tableName':_0xcddb('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xcddb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d5c=['request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api','bluebird'];(function(_0x10dc64,_0x11bb29){var _0x9cf98d=function(_0x558d71){while(--_0x558d71){_0x10dc64['push'](_0x10dc64['shift']());}};_0x9cf98d(++_0x11bb29);}(_0x1d5c,0xa5));var _0xc1d5=function(_0x2abeee,_0x1d7879){_0x2abeee=_0x2abeee-0x0;var _0x17929b=_0x1d5c[_0x2abeee];return _0x17929b;};'use strict';var _=require('lodash');var util=require(_0xc1d5('0x0'));var logger=require(_0xc1d5('0x1'))(_0xc1d5('0x2'));var moment=require('moment');var BPromise=require(_0xc1d5('0x3'));var rp=require(_0xc1d5('0x4'));var fs=require('fs');var path=require(_0xc1d5('0x5'));var rimraf=require(_0xc1d5('0x6'));var config=require(_0xc1d5('0x7'));var attributes=require(_0xc1d5('0x8'));module[_0xc1d5('0x9')]=function(_0x146f8e,_0x51e087){return _0x146f8e['define'](_0xc1d5('0xa'),attributes,{'tableName':_0xc1d5('0xb'),'paranoid':![],'indexes':[{'name':_0xc1d5('0xc'),'fields':[_0xc1d5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index c9592b6..b361861 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 _0x815b=['randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x815b,0xb4));var _0xb815=function(_0x3a3b5b,_0xf04fa6){_0x3a3b5b=_0x3a3b5b-0x0;var _0x1b2db7=_0x815b[_0x3a3b5b];return _0x1b2db7;};'use strict';var _=require(_0xb815('0x0'));var util=require(_0xb815('0x1'));var moment=require(_0xb815('0x2'));var BPromise=require(_0xb815('0x3'));var rs=require(_0xb815('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb815('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb815('0x6'));var config=require(_0xb815('0x7'));var jayson=require(_0xb815('0x8'));var client=jayson['client'][_0xb815('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f7a40,_0x4930f6,_0xeba45d){return new BPromise(function(_0x479b09,_0x4d0873){return client[_0xb815('0xa')](_0x3f7a40,_0xeba45d)[_0xb815('0xb')](function(_0x3f8c27){logger[_0xb815('0xc')](_0xb815('0xd'),_0x4930f6,_0xb815('0xe'));logger[_0xb815('0xf')](_0xb815('0x10'),_0x4930f6,'request\x20sent',JSON[_0xb815('0x11')](_0x3f8c27));if(_0x3f8c27[_0xb815('0x12')]){if(_0x3f8c27[_0xb815('0x12')][_0xb815('0x13')]===0x1f4){logger[_0xb815('0x12')](_0xb815('0xd'),_0x4930f6,_0x3f8c27[_0xb815('0x12')]['message']);return _0x4d0873(_0x3f8c27['error'][_0xb815('0x14')]);}logger[_0xb815('0x12')](_0xb815('0xd'),_0x4930f6,_0x3f8c27[_0xb815('0x12')][_0xb815('0x14')]);return _0x479b09(_0x3f8c27[_0xb815('0x12')][_0xb815('0x14')]);}else{logger[_0xb815('0xc')](_0xb815('0xd'),_0x4930f6,_0xb815('0xe'));_0x479b09(_0x3f8c27[_0xb815('0x15')][_0xb815('0x14')]);}})[_0xb815('0x16')](function(_0x52d8dd){logger['error'](_0xb815('0xd'),_0x4930f6,_0x52d8dd);_0x4d0873(_0x52d8dd);});});} \ No newline at end of file +var _0xfd20=['result','catch','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message'];(function(_0xa811a,_0x22bc32){var _0x473f83=function(_0x1ad651){while(--_0x1ad651){_0xa811a['push'](_0xa811a['shift']());}};_0x473f83(++_0x22bc32);}(_0xfd20,0x66));var _0x0fd2=function(_0x3aac36,_0x287fe1){_0x3aac36=_0x3aac36-0x0;var _0x519fe0=_0xfd20[_0x3aac36];return _0x519fe0;};'use strict';var _=require('lodash');var util=require(_0x0fd2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0fd2('0x1'));var fs=require('fs');var Redis=require(_0x0fd2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fd2('0x3'));var logger=require('../../config/logger')(_0x0fd2('0x4'));var config=require(_0x0fd2('0x5'));var jayson=require(_0x0fd2('0x6'));var client=jayson[_0x0fd2('0x7')][_0x0fd2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d114c,_0x55467b,_0x32d460){return new BPromise(function(_0x15ba86,_0x24d6f4){return client[_0x0fd2('0x9')](_0x4d114c,_0x32d460)[_0x0fd2('0xa')](function(_0x195948){logger[_0x0fd2('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x55467b,_0x0fd2('0xc'));logger[_0x0fd2('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x55467b,_0x0fd2('0xc'),JSON['stringify'](_0x195948));if(_0x195948[_0x0fd2('0xe')]){if(_0x195948[_0x0fd2('0xe')][_0x0fd2('0xf')]===0x1f4){logger[_0x0fd2('0xe')](_0x0fd2('0x10'),_0x55467b,_0x195948[_0x0fd2('0xe')][_0x0fd2('0x11')]);return _0x24d6f4(_0x195948[_0x0fd2('0xe')]['message']);}logger['error'](_0x0fd2('0x10'),_0x55467b,_0x195948[_0x0fd2('0xe')][_0x0fd2('0x11')]);return _0x15ba86(_0x195948[_0x0fd2('0xe')]['message']);}else{logger[_0x0fd2('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x55467b,'request\x20sent');_0x15ba86(_0x195948[_0x0fd2('0x12')]['message']);}})[_0x0fd2('0x13')](function(_0x55e070){logger[_0x0fd2('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x55467b,_0x55e070);_0x24d6f4(_0x55e070);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 6cfb326..1378b7d 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 _0xed47=['put','update','delete','isAuthenticated','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','/:id','show','create'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0xed47,0x15c));var _0x7ed4=function(_0x20e5d4,_0x4ae460){_0x20e5d4=_0x20e5d4-0x0;var _0x54d52a=_0xed47[_0x20e5d4];return _0x54d52a;};'use strict';var multer=require(_0x7ed4('0x0'));var util=require(_0x7ed4('0x1'));var path=require('path');var timeout=require(_0x7ed4('0x2'));var express=require(_0x7ed4('0x3'));var router=express[_0x7ed4('0x4')]();var fs_extra=require(_0x7ed4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7ed4('0x6'));var config=require(_0x7ed4('0x7'));var controller=require(_0x7ed4('0x8'));router[_0x7ed4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7ed4('0x9')](_0x7ed4('0xa'),auth['isAuthenticated'](),controller[_0x7ed4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7ed4('0xc')]);router[_0x7ed4('0xd')](_0x7ed4('0xa'),auth['isAuthenticated'](),controller[_0x7ed4('0xe')]);router[_0x7ed4('0xf')](_0x7ed4('0xa'),auth[_0x7ed4('0x10')](),controller[_0x7ed4('0x11')]);module[_0x7ed4('0x12')]=router; \ No newline at end of file +var _0x35a9=['../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x4b9179,_0x38d2c1){var _0x1fb322=function(_0x1573af){while(--_0x1573af){_0x4b9179['push'](_0x4b9179['shift']());}};_0x1fb322(++_0x38d2c1);}(_0x35a9,0x73));var _0x935a=function(_0x3196ce,_0x3b2624){_0x3196ce=_0x3196ce-0x0;var _0xb219f1=_0x35a9[_0x3196ce];return _0xb219f1;};'use strict';var multer=require('multer');var util=require(_0x935a('0x0'));var path=require(_0x935a('0x1'));var timeout=require(_0x935a('0x2'));var express=require(_0x935a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x935a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x935a('0x5'));var controller=require(_0x935a('0x6'));router[_0x935a('0x7')]('/',auth[_0x935a('0x8')](),controller[_0x935a('0x9')]);router[_0x935a('0x7')](_0x935a('0xa'),auth[_0x935a('0x8')](),controller['show']);router[_0x935a('0xb')]('/',auth[_0x935a('0x8')](),controller[_0x935a('0xc')]);router[_0x935a('0xd')](_0x935a('0xa'),auth['isAuthenticated'](),controller[_0x935a('0xe')]);router[_0x935a('0xf')](_0x935a('0xa'),auth['isAuthenticated'](),controller[_0x935a('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 30e12d5..26fe16e 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 _0x8c5d=['STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8c5d,0x66));var _0xd8c5=function(_0x4bc21e,_0x54a1a){_0x4bc21e=_0x4bc21e-0x0;var _0x110e93=_0x8c5d[_0x4bc21e];return _0x110e93;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xd8c5('0x0')]}}; \ No newline at end of file +var _0x5bcb=['STRING','sequelize','name'];(function(_0x37d8ae,_0x17e484){var _0x4de500=function(_0x538a36){while(--_0x538a36){_0x37d8ae['push'](_0x37d8ae['shift']());}};_0x4de500(++_0x17e484);}(_0x5bcb,0xb2));var _0xb5bc=function(_0x16ff14,_0x12999d){_0x16ff14=_0x16ff14-0x0;var _0x5c4c9e=_0x5bcb[_0x16ff14];return _0x5c4c9e;};'use strict';var Sequelize=require(_0xb5bc('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb5bc('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xb5bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index d6467e6..af20e31 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 _0xfd3b=['limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Pauses','UserProfileResource','then','sendStatus','error','name','send','index','map','Pause','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','status','end','offset','undefined'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xfd3b,0x147));var _0xbfd3=function(_0x385b71,_0x2ae587){_0x385b71=_0x385b71-0x0;var _0x72ac1d=_0xfd3b[_0x385b71];return _0x72ac1d;};'use strict';var emlformat=require(_0xbfd3('0x0'));var rimraf=require(_0xbfd3('0x1'));var zipdir=require(_0xbfd3('0x2'));var jsonpatch=require(_0xbfd3('0x3'));var rp=require(_0xbfd3('0x4'));var moment=require(_0xbfd3('0x5'));var BPromise=require(_0xbfd3('0x6'));var Mustache=require(_0xbfd3('0x7'));var util=require(_0xbfd3('0x8'));var path=require(_0xbfd3('0x9'));var sox=require('sox');var csv=require(_0xbfd3('0xa'));var ejs=require(_0xbfd3('0xb'));var fs=require('fs');var fs_extra=require(_0xbfd3('0xc'));var _=require(_0xbfd3('0xd'));var squel=require(_0xbfd3('0xe'));var crypto=require(_0xbfd3('0xf'));var jsforce=require(_0xbfd3('0x10'));var deskjs=require(_0xbfd3('0x11'));var toCsv=require(_0xbfd3('0xa'));var querystring=require(_0xbfd3('0x12'));var Papa=require(_0xbfd3('0x13'));var Redis=require(_0xbfd3('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xbfd3('0x15'));var as=require(_0xbfd3('0x16'));var hardwareService=require(_0xbfd3('0x17'));var logger=require(_0xbfd3('0x18'))(_0xbfd3('0x19'));var utils=require(_0xbfd3('0x1a'));var config=require(_0xbfd3('0x1b'));var licenseUtil=require(_0xbfd3('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x496426,_0x138adc){_0x138adc=_0x138adc||0xcc;return function(_0x560dc4){if(_0x560dc4){return _0x496426['sendStatus'](_0x138adc);}return _0x496426[_0xbfd3('0x1d')](_0x138adc)[_0xbfd3('0x1e')]();};}function respondWithResult(_0xeaf6a5,_0x4956d8){_0x4956d8=_0x4956d8||0xc8;return function(_0x260821){if(_0x260821){return _0xeaf6a5['status'](_0x4956d8)['json'](_0x260821);}};}function respondWithFilteredResult(_0x49ab9b,_0x1030bf){return function(_0x55e383){if(_0x55e383){var _0x39a1f1=typeof _0x1030bf[_0xbfd3('0x1f')]===_0xbfd3('0x20')&&typeof _0x1030bf[_0xbfd3('0x21')]===_0xbfd3('0x20');var _0xbb18f4=_0x55e383[_0xbfd3('0x22')];var _0x46d05c=_0x39a1f1?0x0:_0x1030bf[_0xbfd3('0x1f')];var _0x251678=_0x39a1f1?_0x55e383[_0xbfd3('0x22')]:_0x1030bf['offset']+_0x1030bf['limit'];var _0x4df81d;if(_0x251678>=_0xbb18f4){_0x251678=_0xbb18f4;_0x4df81d=0xc8;}else{_0x4df81d=0xce;}_0x49ab9b[_0xbfd3('0x1d')](_0x4df81d);return _0x49ab9b[_0xbfd3('0x23')](_0xbfd3('0x24'),_0x46d05c+'-'+_0x251678+'/'+_0xbb18f4)[_0xbfd3('0x25')](_0x55e383);}return null;};}function patchUpdates(_0x5df906){return function(_0x50e738){try{jsonpatch[_0xbfd3('0x26')](_0x50e738,_0x5df906,!![]);}catch(_0x1a534f){return BPromise[_0xbfd3('0x27')](_0x1a534f);}return _0x50e738[_0xbfd3('0x28')]();};}function saveUpdates(_0x354a36,_0x590eae){return function(_0x11bc3a){if(_0x11bc3a){return _0x11bc3a[_0xbfd3('0x29')](_0x354a36)['then'](function(_0x2e5d26){return _0x2e5d26;});}return null;};}function removeEntity(_0x203f72,_0x309986){return function(_0x4d4576){if(_0x4d4576){return _0x4d4576[_0xbfd3('0x2a')]()['then'](function(){var _0x25b4ae=_0x4d4576[_0xbfd3('0x2b')]({'plain':!![]});var _0x2439c2=_0xbfd3('0x2c');return db[_0xbfd3('0x2d')]['destroy']({'where':{'type':_0x2439c2,'resourceId':_0x25b4ae['id']}})[_0xbfd3('0x2e')](function(){return _0x4d4576;});})[_0xbfd3('0x2e')](function(){_0x203f72[_0xbfd3('0x1d')](0xcc)[_0xbfd3('0x1e')]();});}};}function handleEntityNotFound(_0x2489e5,_0xbaf44e){return function(_0x26efa9){if(!_0x26efa9){_0x2489e5[_0xbfd3('0x2f')](0x194);}return _0x26efa9;};}function handleError(_0x59769d,_0x4723d4){_0x4723d4=_0x4723d4||0x1f4;return function(_0x3d06){logger[_0xbfd3('0x30')](_0x3d06['stack']);if(_0x3d06[_0xbfd3('0x31')]){delete _0x3d06[_0xbfd3('0x31')];}_0x59769d[_0xbfd3('0x1d')](_0x4723d4)[_0xbfd3('0x32')](_0x3d06);};}exports[_0xbfd3('0x33')]=function(_0x264f85,_0x4aff34){var _0x5f4af5={},_0x151e21={},_0x2059f5={'count':0x0,'rows':[]};var _0x4ceab8=_[_0xbfd3('0x34')](db[_0xbfd3('0x35')][_0xbfd3('0x36')],function(_0x2afcba){return{'name':_0x2afcba[_0xbfd3('0x37')],'type':_0x2afcba[_0xbfd3('0x38')][_0xbfd3('0x39')]};});_0x151e21['model']=_['map'](_0x4ceab8,_0xbfd3('0x31'));_0x151e21[_0xbfd3('0x3a')]=_[_0xbfd3('0x3b')](_0x264f85['query']);_0x151e21[_0xbfd3('0x3c')]=_[_0xbfd3('0x3d')](_0x151e21[_0xbfd3('0x3e')],_0x151e21[_0xbfd3('0x3a')]);_0x5f4af5[_0xbfd3('0x3f')]=_[_0xbfd3('0x3d')](_0x151e21[_0xbfd3('0x3e')],qs['fields'](_0x264f85['query'][_0xbfd3('0x40')]));_0x5f4af5[_0xbfd3('0x3f')]=_0x5f4af5[_0xbfd3('0x3f')][_0xbfd3('0x41')]?_0x5f4af5[_0xbfd3('0x3f')]:_0x151e21[_0xbfd3('0x3e')];if(!_0x264f85[_0xbfd3('0x3a')]['hasOwnProperty'](_0xbfd3('0x42'))){_0x5f4af5[_0xbfd3('0x21')]=qs[_0xbfd3('0x21')](_0x264f85['query'][_0xbfd3('0x21')]);_0x5f4af5[_0xbfd3('0x1f')]=qs['offset'](_0x264f85[_0xbfd3('0x3a')][_0xbfd3('0x1f')]);}_0x5f4af5[_0xbfd3('0x43')]=qs[_0xbfd3('0x44')](_0x264f85['query'][_0xbfd3('0x44')]);_0x5f4af5[_0xbfd3('0x45')]=qs[_0xbfd3('0x3c')](_[_0xbfd3('0x46')](_0x264f85[_0xbfd3('0x3a')],_0x151e21[_0xbfd3('0x3c')]),_0x4ceab8);if(_0x264f85['query'][_0xbfd3('0x47')]){_0x5f4af5[_0xbfd3('0x45')]=_[_0xbfd3('0x48')](_0x5f4af5[_0xbfd3('0x45')],{'$or':_[_0xbfd3('0x34')](_0x4ceab8,function(_0x27e7c9){if(_0x27e7c9[_0xbfd3('0x38')]!==_0xbfd3('0x49')){var _0x74e8a1={};_0x74e8a1[_0x27e7c9[_0xbfd3('0x31')]]={'$like':'%'+_0x264f85[_0xbfd3('0x3a')]['filter']+'%'};return _0x74e8a1;}})});}_0x5f4af5=_[_0xbfd3('0x48')]({},_0x5f4af5,_0x264f85[_0xbfd3('0x4a')]);var _0x2cdf7a={'where':_0x5f4af5[_0xbfd3('0x45')]};return db[_0xbfd3('0x35')]['count'](_0x2cdf7a)['then'](function(_0x3a5aef){_0x2059f5['count']=_0x3a5aef;if(_0x264f85[_0xbfd3('0x3a')]['includeAll']){_0x5f4af5['include']=[{'all':!![]}];}return db[_0xbfd3('0x35')][_0xbfd3('0x4b')](_0x5f4af5);})[_0xbfd3('0x2e')](function(_0x20b4e9){_0x2059f5[_0xbfd3('0x4c')]=_0x20b4e9;return _0x2059f5;})['then'](respondWithFilteredResult(_0x4aff34,_0x5f4af5))[_0xbfd3('0x4d')](handleError(_0x4aff34,null));};exports[_0xbfd3('0x4e')]=function(_0xd3a6f0,_0x140bca){var _0x35c675={'raw':!![],'where':{'id':_0xd3a6f0[_0xbfd3('0x4f')]['id']}},_0x4faea3={};_0x4faea3['model']=_['keys'](db[_0xbfd3('0x35')][_0xbfd3('0x36')]);_0x4faea3[_0xbfd3('0x3a')]=_[_0xbfd3('0x3b')](_0xd3a6f0[_0xbfd3('0x3a')]);_0x4faea3[_0xbfd3('0x3c')]=_[_0xbfd3('0x3d')](_0x4faea3[_0xbfd3('0x3e')],_0x4faea3[_0xbfd3('0x3a')]);_0x35c675['attributes']=_[_0xbfd3('0x3d')](_0x4faea3['model'],qs[_0xbfd3('0x40')](_0xd3a6f0[_0xbfd3('0x3a')][_0xbfd3('0x40')]));_0x35c675['attributes']=_0x35c675['attributes'][_0xbfd3('0x41')]?_0x35c675[_0xbfd3('0x3f')]:_0x4faea3[_0xbfd3('0x3e')];if(_0xd3a6f0[_0xbfd3('0x3a')][_0xbfd3('0x50')]){_0x35c675[_0xbfd3('0x51')]=[{'all':!![]}];}_0x35c675=_['merge']({},_0x35c675,_0xd3a6f0[_0xbfd3('0x4a')]);return db[_0xbfd3('0x35')][_0xbfd3('0x52')](_0x35c675)[_0xbfd3('0x2e')](handleEntityNotFound(_0x140bca,null))[_0xbfd3('0x2e')](respondWithResult(_0x140bca,null))[_0xbfd3('0x4d')](handleError(_0x140bca,null));};exports[_0xbfd3('0x53')]=function(_0x2cab45,_0x46e893){return db[_0xbfd3('0x35')][_0xbfd3('0x53')](_0x2cab45[_0xbfd3('0x54')],{})[_0xbfd3('0x2e')](function(_0x323f76){var _0x5821be=_0x2cab45[_0xbfd3('0x55')][_0xbfd3('0x2b')]({'plain':!![]});if(!_0x5821be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5821be['role']===_0xbfd3('0x55')){var _0x1c354e=_0x323f76[_0xbfd3('0x2b')]({'plain':!![]});var _0x20741f=_0xbfd3('0x2c');return db[_0xbfd3('0x56')][_0xbfd3('0x52')]({'where':{'name':_0x20741f,'userProfileId':_0x5821be[_0xbfd3('0x57')]},'raw':!![]})[_0xbfd3('0x2e')](function(_0x38549c){if(_0x38549c&&_0x38549c[_0xbfd3('0x58')]===0x0){return db['UserProfileResource'][_0xbfd3('0x53')]({'name':_0x1c354e['name'],'resourceId':_0x1c354e['id'],'type':_0x38549c[_0xbfd3('0x31')],'sectionId':_0x38549c['id']},{})[_0xbfd3('0x2e')](function(){return _0x323f76;});}else{return _0x323f76;}})['catch'](function(_0x5c0cc6){logger[_0xbfd3('0x30')](_0xbfd3('0x59'),_0x5c0cc6);throw _0x5c0cc6;});}return _0x323f76;})[_0xbfd3('0x2e')](respondWithResult(_0x46e893,0xc9))['catch'](handleError(_0x46e893,null));};exports['update']=function(_0x4b3624,_0x3d66e8){if(_0x4b3624[_0xbfd3('0x54')]['id']){delete _0x4b3624['body']['id'];}return db[_0xbfd3('0x35')][_0xbfd3('0x52')]({'where':{'id':_0x4b3624[_0xbfd3('0x4f')]['id']}})[_0xbfd3('0x2e')](handleEntityNotFound(_0x3d66e8,null))['then'](saveUpdates(_0x4b3624[_0xbfd3('0x54')],null))['then'](respondWithResult(_0x3d66e8,null))[_0xbfd3('0x4d')](handleError(_0x3d66e8,null));};exports[_0xbfd3('0x2a')]=function(_0x39d6ac,_0xfc8225){return db[_0xbfd3('0x35')][_0xbfd3('0x52')]({'where':{'id':_0x39d6ac['params']['id']}})['then'](handleEntityNotFound(_0xfc8225,null))[_0xbfd3('0x2e')](removeEntity(_0xfc8225,null))['catch'](handleError(_0xfc8225,null));}; \ No newline at end of file +var _0xefa5=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','get','UserProfileResource','error','name','send','map','Pause','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','keys','rawAttributes','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user'];(function(_0x102376,_0x16c6a2){var _0x29bc9c=function(_0x5fe5b1){while(--_0x5fe5b1){_0x102376['push'](_0x102376['shift']());}};_0x29bc9c(++_0x16c6a2);}(_0xefa5,0xaa));var _0x5efa=function(_0x11ea14,_0x5bddf5){_0x11ea14=_0x11ea14-0x0;var _0x5286f8=_0xefa5[_0x11ea14];return _0x5286f8;};'use strict';var emlformat=require(_0x5efa('0x0'));var rimraf=require(_0x5efa('0x1'));var zipdir=require(_0x5efa('0x2'));var jsonpatch=require(_0x5efa('0x3'));var rp=require(_0x5efa('0x4'));var moment=require(_0x5efa('0x5'));var BPromise=require(_0x5efa('0x6'));var Mustache=require(_0x5efa('0x7'));var util=require(_0x5efa('0x8'));var path=require(_0x5efa('0x9'));var sox=require(_0x5efa('0xa'));var csv=require(_0x5efa('0xb'));var ejs=require(_0x5efa('0xc'));var fs=require('fs');var fs_extra=require(_0x5efa('0xd'));var _=require(_0x5efa('0xe'));var squel=require(_0x5efa('0xf'));var crypto=require('crypto');var jsforce=require(_0x5efa('0x10'));var deskjs=require(_0x5efa('0x11'));var toCsv=require(_0x5efa('0xb'));var querystring=require(_0x5efa('0x12'));var Papa=require('papaparse');var Redis=require(_0x5efa('0x13'));var authService=require(_0x5efa('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5efa('0x15'))(_0x5efa('0x16'));var utils=require(_0x5efa('0x17'));var config=require(_0x5efa('0x18'));var licenseUtil=require(_0x5efa('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43f839,_0x551f15){_0x551f15=_0x551f15||0xcc;return function(_0x5e1b1a){if(_0x5e1b1a){return _0x43f839[_0x5efa('0x1a')](_0x551f15);}return _0x43f839[_0x5efa('0x1b')](_0x551f15)[_0x5efa('0x1c')]();};}function respondWithResult(_0x488819,_0x2fb8fe){_0x2fb8fe=_0x2fb8fe||0xc8;return function(_0x555ead){if(_0x555ead){return _0x488819['status'](_0x2fb8fe)[_0x5efa('0x1d')](_0x555ead);}};}function respondWithFilteredResult(_0x525cf6,_0x15bf02){return function(_0x1d3367){if(_0x1d3367){var _0x65b0af=typeof _0x15bf02[_0x5efa('0x1e')]===_0x5efa('0x1f')&&typeof _0x15bf02['limit']===_0x5efa('0x1f');var _0x2859b7=_0x1d3367[_0x5efa('0x20')];var _0x35d737=_0x65b0af?0x0:_0x15bf02['offset'];var _0x4c62b5=_0x65b0af?_0x1d3367[_0x5efa('0x20')]:_0x15bf02['offset']+_0x15bf02[_0x5efa('0x21')];var _0xe7619f;if(_0x4c62b5>=_0x2859b7){_0x4c62b5=_0x2859b7;_0xe7619f=0xc8;}else{_0xe7619f=0xce;}_0x525cf6[_0x5efa('0x1b')](_0xe7619f);return _0x525cf6[_0x5efa('0x22')]('Content-Range',_0x35d737+'-'+_0x4c62b5+'/'+_0x2859b7)['json'](_0x1d3367);}return null;};}function patchUpdates(_0x2cde65){return function(_0x2bcd75){try{jsonpatch[_0x5efa('0x23')](_0x2bcd75,_0x2cde65,!![]);}catch(_0x105f56){return BPromise[_0x5efa('0x24')](_0x105f56);}return _0x2bcd75[_0x5efa('0x25')]();};}function saveUpdates(_0x3e3002,_0x5e9104){return function(_0x2d04c5){if(_0x2d04c5){return _0x2d04c5['update'](_0x3e3002)[_0x5efa('0x26')](function(_0x1e3960){return _0x1e3960;});}return null;};}function removeEntity(_0x496658,_0x396e9d){return function(_0x32be30){if(_0x32be30){return _0x32be30[_0x5efa('0x27')]()[_0x5efa('0x26')](function(){var _0x5a7d16=_0x32be30[_0x5efa('0x28')]({'plain':!![]});var _0x2fb03c='Pauses';return db[_0x5efa('0x29')][_0x5efa('0x27')]({'where':{'type':_0x2fb03c,'resourceId':_0x5a7d16['id']}})[_0x5efa('0x26')](function(){return _0x32be30;});})[_0x5efa('0x26')](function(){_0x496658[_0x5efa('0x1b')](0xcc)[_0x5efa('0x1c')]();});}};}function handleEntityNotFound(_0x21aa58,_0x23e439){return function(_0x4d75d7){if(!_0x4d75d7){_0x21aa58[_0x5efa('0x1a')](0x194);}return _0x4d75d7;};}function handleError(_0xa223b1,_0x5318ec){_0x5318ec=_0x5318ec||0x1f4;return function(_0x38761e){logger[_0x5efa('0x2a')](_0x38761e['stack']);if(_0x38761e[_0x5efa('0x2b')]){delete _0x38761e['name'];}_0xa223b1[_0x5efa('0x1b')](_0x5318ec)[_0x5efa('0x2c')](_0x38761e);};}exports['index']=function(_0x2417ef,_0x1b5841){var _0x2dad48={},_0x438f85={},_0x4ba0cb={'count':0x0,'rows':[]};var _0x53f240=_[_0x5efa('0x2d')](db[_0x5efa('0x2e')]['rawAttributes'],function(_0x1020d7){return{'name':_0x1020d7[_0x5efa('0x2f')],'type':_0x1020d7[_0x5efa('0x30')][_0x5efa('0x31')]};});_0x438f85[_0x5efa('0x32')]=_['map'](_0x53f240,_0x5efa('0x2b'));_0x438f85[_0x5efa('0x33')]=_['keys'](_0x2417ef[_0x5efa('0x33')]);_0x438f85[_0x5efa('0x34')]=_['intersection'](_0x438f85[_0x5efa('0x32')],_0x438f85[_0x5efa('0x33')]);_0x2dad48[_0x5efa('0x35')]=_[_0x5efa('0x36')](_0x438f85['model'],qs[_0x5efa('0x37')](_0x2417ef[_0x5efa('0x33')]['fields']));_0x2dad48[_0x5efa('0x35')]=_0x2dad48[_0x5efa('0x35')]['length']?_0x2dad48[_0x5efa('0x35')]:_0x438f85[_0x5efa('0x32')];if(!_0x2417ef['query'][_0x5efa('0x38')](_0x5efa('0x39'))){_0x2dad48[_0x5efa('0x21')]=qs[_0x5efa('0x21')](_0x2417ef[_0x5efa('0x33')][_0x5efa('0x21')]);_0x2dad48[_0x5efa('0x1e')]=qs[_0x5efa('0x1e')](_0x2417ef[_0x5efa('0x33')][_0x5efa('0x1e')]);}_0x2dad48[_0x5efa('0x3a')]=qs[_0x5efa('0x3b')](_0x2417ef[_0x5efa('0x33')][_0x5efa('0x3b')]);_0x2dad48[_0x5efa('0x3c')]=qs[_0x5efa('0x34')](_['pick'](_0x2417ef[_0x5efa('0x33')],_0x438f85[_0x5efa('0x34')]),_0x53f240);if(_0x2417ef[_0x5efa('0x33')][_0x5efa('0x3d')]){_0x2dad48[_0x5efa('0x3c')]=_[_0x5efa('0x3e')](_0x2dad48['where'],{'$or':_[_0x5efa('0x2d')](_0x53f240,function(_0x595155){if(_0x595155[_0x5efa('0x30')]!==_0x5efa('0x3f')){var _0x81fe06={};_0x81fe06[_0x595155[_0x5efa('0x2b')]]={'$like':'%'+_0x2417ef[_0x5efa('0x33')][_0x5efa('0x3d')]+'%'};return _0x81fe06;}})});}_0x2dad48=_['merge']({},_0x2dad48,_0x2417ef['options']);var _0x21d696={'where':_0x2dad48[_0x5efa('0x3c')]};return db[_0x5efa('0x2e')][_0x5efa('0x20')](_0x21d696)[_0x5efa('0x26')](function(_0x35aa90){_0x4ba0cb[_0x5efa('0x20')]=_0x35aa90;if(_0x2417ef[_0x5efa('0x33')][_0x5efa('0x40')]){_0x2dad48[_0x5efa('0x41')]=[{'all':!![]}];}return db[_0x5efa('0x2e')][_0x5efa('0x42')](_0x2dad48);})[_0x5efa('0x26')](function(_0xa53dae){_0x4ba0cb[_0x5efa('0x43')]=_0xa53dae;return _0x4ba0cb;})['then'](respondWithFilteredResult(_0x1b5841,_0x2dad48))['catch'](handleError(_0x1b5841,null));};exports['show']=function(_0x194426,_0x353a1a){var _0x514c67={'raw':!![],'where':{'id':_0x194426[_0x5efa('0x44')]['id']}},_0x70c38a={};_0x70c38a[_0x5efa('0x32')]=_[_0x5efa('0x45')](db[_0x5efa('0x2e')][_0x5efa('0x46')]);_0x70c38a[_0x5efa('0x33')]=_[_0x5efa('0x45')](_0x194426[_0x5efa('0x33')]);_0x70c38a[_0x5efa('0x34')]=_[_0x5efa('0x36')](_0x70c38a[_0x5efa('0x32')],_0x70c38a[_0x5efa('0x33')]);_0x514c67[_0x5efa('0x35')]=_[_0x5efa('0x36')](_0x70c38a[_0x5efa('0x32')],qs[_0x5efa('0x37')](_0x194426[_0x5efa('0x33')][_0x5efa('0x37')]));_0x514c67[_0x5efa('0x35')]=_0x514c67['attributes']['length']?_0x514c67[_0x5efa('0x35')]:_0x70c38a[_0x5efa('0x32')];if(_0x194426[_0x5efa('0x33')][_0x5efa('0x40')]){_0x514c67['include']=[{'all':!![]}];}_0x514c67=_[_0x5efa('0x3e')]({},_0x514c67,_0x194426[_0x5efa('0x47')]);return db[_0x5efa('0x2e')][_0x5efa('0x48')](_0x514c67)[_0x5efa('0x26')](handleEntityNotFound(_0x353a1a,null))[_0x5efa('0x26')](respondWithResult(_0x353a1a,null))[_0x5efa('0x49')](handleError(_0x353a1a,null));};exports[_0x5efa('0x4a')]=function(_0x1d5ddc,_0xf50ee){return db[_0x5efa('0x2e')][_0x5efa('0x4a')](_0x1d5ddc[_0x5efa('0x4b')],{})['then'](function(_0x5b0f27){var _0xa91e1=_0x1d5ddc['user'][_0x5efa('0x28')]({'plain':!![]});if(!_0xa91e1)throw new Error(_0x5efa('0x4c'));if(_0xa91e1[_0x5efa('0x4d')]===_0x5efa('0x4e')){var _0x309d4b=_0x5b0f27[_0x5efa('0x28')]({'plain':!![]});var _0xa22fb4='Pauses';return db['UserProfileSection'][_0x5efa('0x48')]({'where':{'name':_0xa22fb4,'userProfileId':_0xa91e1[_0x5efa('0x4f')]},'raw':!![]})[_0x5efa('0x26')](function(_0x2d2234){if(_0x2d2234&&_0x2d2234[_0x5efa('0x50')]===0x0){return db['UserProfileResource'][_0x5efa('0x4a')]({'name':_0x309d4b[_0x5efa('0x2b')],'resourceId':_0x309d4b['id'],'type':_0x2d2234[_0x5efa('0x2b')],'sectionId':_0x2d2234['id']},{})[_0x5efa('0x26')](function(){return _0x5b0f27;});}else{return _0x5b0f27;}})['catch'](function(_0xb62664){logger[_0x5efa('0x2a')](_0x5efa('0x51'),_0xb62664);throw _0xb62664;});}return _0x5b0f27;})['then'](respondWithResult(_0xf50ee,0xc9))['catch'](handleError(_0xf50ee,null));};exports[_0x5efa('0x52')]=function(_0x155135,_0xd33994){if(_0x155135[_0x5efa('0x4b')]['id']){delete _0x155135[_0x5efa('0x4b')]['id'];}return db['Pause']['find']({'where':{'id':_0x155135[_0x5efa('0x44')]['id']}})[_0x5efa('0x26')](handleEntityNotFound(_0xd33994,null))[_0x5efa('0x26')](saveUpdates(_0x155135[_0x5efa('0x4b')],null))[_0x5efa('0x26')](respondWithResult(_0xd33994,null))[_0x5efa('0x49')](handleError(_0xd33994,null));};exports[_0x5efa('0x27')]=function(_0x4af93c,_0x15a70c){return db['Pause']['find']({'where':{'id':_0x4af93c[_0x5efa('0x44')]['id']}})[_0x5efa('0x26')](handleEntityNotFound(_0x15a70c,null))[_0x5efa('0x26')](removeEntity(_0x15a70c,null))[_0x5efa('0x49')](handleError(_0x15a70c,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 7ac6756..59976b5 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 _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','Pause','tools_pauses','lodash','util'];(function(_0x387ce0,_0x433436){var _0x26ad0f=function(_0x61a68b){while(--_0x61a68b){_0x387ce0['push'](_0x387ce0['shift']());}};_0x26ad0f(++_0x433436);}(_0x5fab,0x177));var _0xb5fa=function(_0x1e7aff,_0x1c843b){_0x1e7aff=_0x1e7aff-0x0;var _0x2a16bf=_0x5fab[_0x1e7aff];return _0x2a16bf;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x516459,_0x350668){var _0x270241=function(_0x49eca4){while(--_0x49eca4){_0x516459['push'](_0x516459['shift']());}};_0x270241(++_0x350668);}(_0xf494,0x1c6));var _0x4f49=function(_0x4e8236,_0x2b2720){_0x4e8236=_0x4e8236-0x0;var _0x3f5e47=_0xf494[_0x4e8236];return _0x3f5e47;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('Pause',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 4a80edb..da909f5 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x5b0fca,_0x2c5005){var _0x415677=function(_0x38f4d7){while(--_0x38f4d7){_0x5b0fca['push'](_0x5b0fca['shift']());}};_0x415677(++_0x2c5005);}(_0xb10b,0x12a));var _0xbb10=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0xb10b[_0x382e89];return _0x3a1318;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x16ab6a,_0x9d67a7){var _0x5da477=function(_0x878ab7){while(--_0x878ab7){_0x16ab6a['push'](_0x16ab6a['shift']());}};_0x5da477(++_0x9d67a7);}(_0xb10b,0x12a));var _0xbb10=function(_0x4503f6,_0x3babaf){_0x4503f6=_0x4503f6-0x0;var _0x2277d1=_0xb10b[_0x4503f6];return _0x2277d1;};'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 8f9e2b1..9825d87 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 _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(_0x1d128e,_0x2c87de){var _0x3d5236=function(_0x2374ff){while(--_0x2374ff){_0x1d128e['push'](_0x1d128e['shift']());}};_0x3d5236(++_0x2c87de);}(_0xd2ea,0x15f));var _0xad2e=function(_0x47ffce,_0x187178){_0x47ffce=_0x47ffce-0x0;var _0xfeabd7=_0xd2ea[_0x47ffce];return _0xfeabd7;};'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 +var _0x4bc3=['single','file','webhookPost','put','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','/:id','show','/:id/download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post'];(function(_0x1a3306,_0x2ca33a){var _0x520694=function(_0x5318cc){while(--_0x5318cc){_0x1a3306['push'](_0x1a3306['shift']());}};_0x520694(++_0x2ca33a);}(_0x4bc3,0x16e));var _0x34bc=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x4bc3[_0x2d34d6];return _0x1d3d12;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var fs_extra=require(_0x34bc('0x4'));var auth=require(_0x34bc('0x5'));var interaction=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var controller=require(_0x34bc('0x8'));router[_0x34bc('0x9')]('/',auth[_0x34bc('0xa')](),controller['index']);router[_0x34bc('0x9')]('/webhook',controller['webhookGet']);router[_0x34bc('0x9')](_0x34bc('0xb'),auth[_0x34bc('0xa')](),controller[_0x34bc('0xc')]);router[_0x34bc('0x9')](_0x34bc('0xd'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x34bc('0xe')]({'destination':function(_0x33025c,_0x2a35f3,_0x5a608a){_0x5a608a(null,path[_0x34bc('0xf')](config['root'],_0x34bc('0x10')));},'filename':function(_0x124b87,_0x164fb2,_0x536ebd){_0x164fb2[_0x34bc('0x11')]=_0x164fb2['originalname'][_0x34bc('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x536ebd(null,util[_0x34bc('0x13')](_0x34bc('0x14'),path['basename'](_0x164fb2['originalname'],path[_0x34bc('0x15')](_0x164fb2['originalname'])),Date[_0x34bc('0x16')](),path[_0x34bc('0x15')](_0x164fb2[_0x34bc('0x11')])));}})});router[_0x34bc('0x17')]('/',upload[_0x34bc('0x18')](_0x34bc('0x19')),controller['upload']);router['post']('/webhook',controller[_0x34bc('0x1a')]);router[_0x34bc('0x1b')](_0x34bc('0xb'),auth[_0x34bc('0xa')](),controller['update']);router[_0x34bc('0x1c')](_0x34bc('0xb'),auth['isAuthenticated'](),controller[_0x34bc('0x1c')]);module[_0x34bc('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 98e78b5..d1b35d2 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 _0xcb94=['agentOnly','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xcb94,0x154));var _0x4cb9=function(_0x273f87,_0x4fff7f){_0x273f87=_0x273f87-0x0;var _0x597680=_0xcb94[_0x273f87];return _0x597680;};'use strict';var Sequelize=require(_0x4cb9('0x0'));module[_0x4cb9('0x1')]={'name':{'type':Sequelize[_0x4cb9('0x2')]},'type':{'type':Sequelize[_0x4cb9('0x3')](_0x4cb9('0x4'),_0x4cb9('0x5'))},'description':{'type':Sequelize[_0x4cb9('0x6')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x4cb9('0x7')},'active':{'type':Sequelize[_0x4cb9('0x8')],'defaultValue':0x0,'comment':_0x4cb9('0x9')},'sidebar':{'type':Sequelize[_0x4cb9('0x3')](_0x4cb9('0xa'),_0x4cb9('0xb'),'always','never'),'defaultValue':'always','comment':_0x4cb9('0xc')},'icon':{'type':Sequelize[_0x4cb9('0x2')]},'adminUrl':{'type':Sequelize[_0x4cb9('0x2')]},'agentUrl':{'type':Sequelize[_0x4cb9('0x2')]},'scriptName':{'type':Sequelize[_0x4cb9('0x2')]},'scriptPath':{'type':Sequelize[_0x4cb9('0x2')]}}; \ No newline at end of file +var _0x0688=['exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','always'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0x0688,0x183));var _0x8068=function(_0x1f96cb,_0x1849fb){_0x1f96cb=_0x1f96cb-0x0;var _0x3e2215=_0x0688[_0x1f96cb];return _0x3e2215;};'use strict';var Sequelize=require('sequelize');module[_0x8068('0x0')]={'name':{'type':Sequelize[_0x8068('0x1')]},'type':{'type':Sequelize[_0x8068('0x2')](_0x8068('0x3'),'script')},'description':{'type':Sequelize[_0x8068('0x4')]},'version':{'type':Sequelize[_0x8068('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0x8068('0x5')},'active':{'type':Sequelize[_0x8068('0x6')],'defaultValue':0x0,'comment':_0x8068('0x7')},'sidebar':{'type':Sequelize[_0x8068('0x2')]('adminOnly','agentOnly',_0x8068('0x8'),'never'),'defaultValue':_0x8068('0x8'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x8068('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x8068('0x1')]},'scriptPath':{'type':Sequelize[_0x8068('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index e7862ea..f7887ec 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 _0xb971=['api','../../config/license/util','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','Plugins','UserProfileResource','destroy','end','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','download','join','root','server/files/plugins','format','basename','zip','warning','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','dirname','node_modules/**/*','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','encoding','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4c460f,_0x2e2e97){var _0x453910=function(_0x4ea918){while(--_0x4ea918){_0x4c460f['push'](_0x4c460f['shift']());}};_0x453910(++_0x2e2e97);}(_0xb971,0x13d));var _0x1b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb971[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1b97('0x0'));var rimraf=require(_0x1b97('0x1'));var zipdir=require(_0x1b97('0x2'));var jsonpatch=require(_0x1b97('0x3'));var rp=require(_0x1b97('0x4'));var moment=require(_0x1b97('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b97('0x6'));var path=require(_0x1b97('0x7'));var sox=require(_0x1b97('0x8'));var csv=require(_0x1b97('0x9'));var ejs=require(_0x1b97('0xa'));var fs=require('fs');var fs_extra=require(_0x1b97('0xb'));var _=require(_0x1b97('0xc'));var squel=require(_0x1b97('0xd'));var crypto=require(_0x1b97('0xe'));var jsforce=require(_0x1b97('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1b97('0x9'));var querystring=require('querystring');var Papa=require(_0x1b97('0x10'));var extract=require(_0x1b97('0x11'));var rimraf=require(_0x1b97('0x1'));var archiver=require(_0x1b97('0x12'));var Redis=require(_0x1b97('0x13'));var authService=require(_0x1b97('0x14'));var qs=require(_0x1b97('0x15'));var as=require(_0x1b97('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1b97('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1b97('0x18'));var db=require('../../mysqldb')['db'];config[_0x1b97('0x19')]=_[_0x1b97('0x1a')](config[_0x1b97('0x19')],{'host':_0x1b97('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./plugin.socket')[_0x1b97('0x1c')](socket);function respondWithStatusCode(_0x30c298,_0x3e3743){_0x3e3743=_0x3e3743||0xcc;return function(_0x5e7e4c){if(_0x5e7e4c){return _0x30c298[_0x1b97('0x1d')](_0x3e3743);}return _0x30c298['status'](_0x3e3743)['end']();};}function respondWithResult(_0x2d3a4e,_0x2322c9){_0x2322c9=_0x2322c9||0xc8;return function(_0x286726){if(_0x286726){return _0x2d3a4e[_0x1b97('0x1e')](_0x2322c9)[_0x1b97('0x1f')](_0x286726);}};}function respondWithFilteredResult(_0x16604f,_0x136f4c){return function(_0x430f45){if(_0x430f45){var _0x1028f8=typeof _0x136f4c[_0x1b97('0x20')]===_0x1b97('0x21')&&typeof _0x136f4c[_0x1b97('0x22')]==='undefined';var _0x4af110=_0x430f45[_0x1b97('0x23')];var _0xa8c172=_0x1028f8?0x0:_0x136f4c[_0x1b97('0x20')];var _0x594f95=_0x1028f8?_0x430f45['count']:_0x136f4c[_0x1b97('0x20')]+_0x136f4c[_0x1b97('0x22')];var _0x1bcb0a;if(_0x594f95>=_0x4af110){_0x594f95=_0x4af110;_0x1bcb0a=0xc8;}else{_0x1bcb0a=0xce;}_0x16604f[_0x1b97('0x1e')](_0x1bcb0a);return _0x16604f[_0x1b97('0x24')](_0x1b97('0x25'),_0xa8c172+'-'+_0x594f95+'/'+_0x4af110)[_0x1b97('0x1f')](_0x430f45);}return null;};}function patchUpdates(_0x18dccf){return function(_0x2d0c79){try{jsonpatch[_0x1b97('0x26')](_0x2d0c79,_0x18dccf,!![]);}catch(_0x2bfc2e){return BPromise['reject'](_0x2bfc2e);}return _0x2d0c79[_0x1b97('0x27')]();};}function saveUpdates(_0x2be9ff,_0xe48e37){return function(_0xcf7216){if(_0xcf7216){return _0xcf7216[_0x1b97('0x28')](_0x2be9ff)[_0x1b97('0x29')](function(_0x4b164a){return _0x4b164a;});}return null;};}function removeEntity(_0x17e705,_0x20071a){return function(_0x3782d3){if(_0x3782d3){return _0x3782d3['destroy']()[_0x1b97('0x29')](function(){var _0x106757=_0x3782d3[_0x1b97('0x2a')]({'plain':!![]});var _0x5c3da3=_0x1b97('0x2b');return db[_0x1b97('0x2c')][_0x1b97('0x2d')]({'where':{'type':_0x5c3da3,'resourceId':_0x106757['id']}})[_0x1b97('0x29')](function(){return _0x3782d3;});})[_0x1b97('0x29')](function(){_0x17e705['status'](0xcc)[_0x1b97('0x2e')]();});}};}function handleEntityNotFound(_0x21e1b0,_0x798377){return function(_0x36a466){if(!_0x36a466){_0x21e1b0['sendStatus'](0x194);}return _0x36a466;};}function handleError(_0x2cd03d,_0x5af47){_0x5af47=_0x5af47||0x1f4;return function(_0x10ff3f){logger[_0x1b97('0x2f')](_0x10ff3f[_0x1b97('0x30')]);if(_0x10ff3f[_0x1b97('0x31')]){delete _0x10ff3f['name'];}_0x2cd03d[_0x1b97('0x1e')](_0x5af47)[_0x1b97('0x32')](_0x10ff3f);};}exports[_0x1b97('0x33')]=function(_0x256a11,_0x324826){var _0x47e17f={},_0x46b49a={},_0x23ecd2={'count':0x0,'rows':[]};var _0xb514a9=_[_0x1b97('0x34')](db[_0x1b97('0x35')][_0x1b97('0x36')],function(_0x5cf71f){return{'name':_0x5cf71f[_0x1b97('0x37')],'type':_0x5cf71f[_0x1b97('0x38')][_0x1b97('0x39')]};});_0x46b49a[_0x1b97('0x3a')]=_[_0x1b97('0x34')](_0xb514a9,_0x1b97('0x31'));_0x46b49a[_0x1b97('0x3b')]=_[_0x1b97('0x3c')](_0x256a11['query']);_0x46b49a[_0x1b97('0x3d')]=_[_0x1b97('0x3e')](_0x46b49a['model'],_0x46b49a[_0x1b97('0x3b')]);_0x47e17f[_0x1b97('0x3f')]=_[_0x1b97('0x3e')](_0x46b49a[_0x1b97('0x3a')],qs[_0x1b97('0x40')](_0x256a11[_0x1b97('0x3b')]['fields']));_0x47e17f[_0x1b97('0x3f')]=_0x47e17f[_0x1b97('0x3f')][_0x1b97('0x41')]?_0x47e17f[_0x1b97('0x3f')]:_0x46b49a[_0x1b97('0x3a')];if(!_0x256a11[_0x1b97('0x3b')][_0x1b97('0x42')](_0x1b97('0x43'))){_0x47e17f[_0x1b97('0x22')]=qs[_0x1b97('0x22')](_0x256a11['query'][_0x1b97('0x22')]);_0x47e17f[_0x1b97('0x20')]=qs[_0x1b97('0x20')](_0x256a11[_0x1b97('0x3b')][_0x1b97('0x20')]);}_0x47e17f[_0x1b97('0x44')]=qs[_0x1b97('0x45')](_0x256a11['query'][_0x1b97('0x45')]);_0x47e17f[_0x1b97('0x46')]=qs[_0x1b97('0x3d')](_[_0x1b97('0x47')](_0x256a11[_0x1b97('0x3b')],_0x46b49a['filters']),_0xb514a9);if(_0x256a11[_0x1b97('0x3b')]['filter']){_0x47e17f[_0x1b97('0x46')]=_[_0x1b97('0x48')](_0x47e17f[_0x1b97('0x46')],{'$or':_[_0x1b97('0x34')](_0xb514a9,function(_0x411c94){if(_0x411c94[_0x1b97('0x38')]!==_0x1b97('0x49')){var _0x2a7e43={};_0x2a7e43[_0x411c94[_0x1b97('0x31')]]={'$like':'%'+_0x256a11[_0x1b97('0x3b')][_0x1b97('0x4a')]+'%'};return _0x2a7e43;}})});}_0x47e17f=_[_0x1b97('0x48')]({},_0x47e17f,_0x256a11[_0x1b97('0x4b')]);var _0x48e8b2={'where':_0x47e17f[_0x1b97('0x46')]};return db[_0x1b97('0x35')][_0x1b97('0x23')](_0x48e8b2)[_0x1b97('0x29')](function(_0x180551){_0x23ecd2[_0x1b97('0x23')]=_0x180551;if(_0x256a11[_0x1b97('0x3b')]['includeAll']){_0x47e17f[_0x1b97('0x4c')]=[{'all':!![]}];}return db[_0x1b97('0x35')][_0x1b97('0x4d')](_0x47e17f);})[_0x1b97('0x29')](function(_0x41c6f4){_0x23ecd2[_0x1b97('0x4e')]=_0x41c6f4;return _0x23ecd2;})[_0x1b97('0x29')](respondWithFilteredResult(_0x324826,_0x47e17f))[_0x1b97('0x4f')](handleError(_0x324826,null));};exports[_0x1b97('0x50')]=function(_0x558912,_0x436c65){var _0x53f13e={'raw':!![],'where':{'id':_0x558912[_0x1b97('0x51')]['id']}},_0x477cbe={};_0x477cbe[_0x1b97('0x3a')]=_[_0x1b97('0x3c')](db[_0x1b97('0x35')][_0x1b97('0x36')]);_0x477cbe['query']=_['keys'](_0x558912[_0x1b97('0x3b')]);_0x477cbe['filters']=_['intersection'](_0x477cbe[_0x1b97('0x3a')],_0x477cbe[_0x1b97('0x3b')]);_0x53f13e[_0x1b97('0x3f')]=_['intersection'](_0x477cbe[_0x1b97('0x3a')],qs['fields'](_0x558912[_0x1b97('0x3b')][_0x1b97('0x40')]));_0x53f13e['attributes']=_0x53f13e['attributes'][_0x1b97('0x41')]?_0x53f13e[_0x1b97('0x3f')]:_0x477cbe[_0x1b97('0x3a')];if(_0x558912['query'][_0x1b97('0x52')]){_0x53f13e['include']=[{'all':!![]}];}_0x53f13e=_[_0x1b97('0x48')]({},_0x53f13e,_0x558912[_0x1b97('0x4b')]);return db['Plugin'][_0x1b97('0x53')](_0x53f13e)[_0x1b97('0x29')](handleEntityNotFound(_0x436c65,null))['then'](respondWithResult(_0x436c65,null))[_0x1b97('0x4f')](handleError(_0x436c65,null));};exports[_0x1b97('0x54')]=function(_0x40fc25,_0x5d78ae,_0x4fe6e7){return db[_0x1b97('0x35')][_0x1b97('0x53')]({'where':{'id':_0x40fc25[_0x1b97('0x51')]['id']},'attributes':['name',_0x1b97('0x7')],'raw':!![]})[_0x1b97('0x29')](handleEntityNotFound(_0x5d78ae,null))[_0x1b97('0x29')](function(_0x5552de){if(_0x5552de){var _0x3d83fb=path[_0x1b97('0x55')](config[_0x1b97('0x56')],_0x1b97('0x57'),util[_0x1b97('0x58')]('%s.zip',path[_0x1b97('0x59')](_0x5552de['path'])));var _0x360c6c=fs['createWriteStream'](_0x3d83fb);var _0x4e28ed=archiver(_0x1b97('0x5a'),{'zlib':{'level':0x9}});_0x4e28ed['on'](_0x1b97('0x5b'),function(_0x2dc582){if(_0x2dc582['code']===_0x1b97('0x5c')){logger[_0x1b97('0x2f')](_0x2dc582);}else{throw new db['Sequelize'][(_0x1b97('0x5d'))](_0x1b97('0x5e'));}});_0x4e28ed['on'](_0x1b97('0x2f'),function(_0x592817){throw new db[(_0x1b97('0x5f'))][(_0x1b97('0x5d'))](_0x1b97('0x5e'));});_0x4e28ed[_0x1b97('0x60')](_0x360c6c);_0x4e28ed[_0x1b97('0x61')](_0x1b97('0x62'),{'cwd':path['join'](config[_0x1b97('0x56')],_0x1b97('0x57'),path[_0x1b97('0x63')](_0x5552de[_0x1b97('0x7')])),'ignore':[path[_0x1b97('0x55')](path[_0x1b97('0x59')](_0x5552de['path']),_0x1b97('0x64')),path[_0x1b97('0x55')](path[_0x1b97('0x59')](_0x5552de[_0x1b97('0x7')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x360c6c['on'](_0x1b97('0x65'),function(){if(!fs[_0x1b97('0x66')](_0x3d83fb)){throw new db[(_0x1b97('0x5f'))]['Error']('Plugin\x20not\x20found');}return _0x5d78ae['download'](_0x3d83fb,util[_0x1b97('0x58')]('%s.zip',path[_0x1b97('0x59')](_0x5552de[_0x1b97('0x7')])),function(_0x1ef0b4){if(_0x1ef0b4){throw new db[(_0x1b97('0x5f'))]['Error'](_0x1b97('0x67'));}fs[_0x1b97('0x68')](_0x3d83fb);logger[_0x1b97('0x69')](_0x1b97('0x6a'));logger[_0x1b97('0x69')](_0x1b97('0x6b'));});});}return null;})[_0x1b97('0x4f')](handleError(_0x5d78ae,null));};exports['upload']=function(_0x28d27f,_0x3d4d7e,_0x5f1694){var _0x548175=path[_0x1b97('0x59')](_0x28d27f[_0x1b97('0x6c')][_0x1b97('0x6d')],path[_0x1b97('0x6e')](_0x28d27f[_0x1b97('0x6c')]['filename']));var _0x2ef212=path['join'](config[_0x1b97('0x56')],'server/files/plugins',_0x28d27f[_0x1b97('0x6c')][_0x1b97('0x6d')]);var _0x18941e=path[_0x1b97('0x55')](config['root'],_0x1b97('0x57'),_0x548175);logger['info'](_0x1b97('0x6f'),_0x2ef212);logger[_0x1b97('0x69')](_0x1b97('0x70'),_0x18941e);try{fs[_0x1b97('0x71')](_0x2ef212,parseInt(_0x1b97('0x72'),0x8));extract(_0x2ef212,{'dir':_0x18941e},function(_0x1f5114){if(_0x1f5114){logger[_0x1b97('0x2f')](_0x1f5114);handleError(_0x1f5114,!![]);};var _0x2e1f12=fs[_0x1b97('0x73')](_0x18941e);if(_0x2e1f12['length']>0x1){removeReferences(_0x2ef212,_0x18941e);logger[_0x1b97('0x2f')](_0x1b97('0x74'));return _0x5f1694(new Error(_0x1b97('0x74')));}var _0x1dc578=fs['lstatSync'](path[_0x1b97('0x55')](_0x18941e,_0x2e1f12[0x0]));if(_0x1dc578[_0x1b97('0x75')]()){removeReferences(_0x2ef212,_0x18941e);logger[_0x1b97('0x2f')](_0x1b97('0x74'));return _0x5f1694(new Error('Invalid\x20plugin\x20structure'));}if(_0x1dc578[_0x1b97('0x76')]()){var _0x2bdd95=fs[_0x1b97('0x73')](path[_0x1b97('0x55')](_0x18941e,_0x2e1f12[0x0]));if(_0x2bdd95[_0x1b97('0x41')]===0x0){removeReferences(_0x2ef212,_0x18941e);logger[_0x1b97('0x2f')](_0x1b97('0x74'));return _0x5f1694(new Error(_0x1b97('0x74')));}var _0x5b149f=_0x2bdd95['some'](function(_0x7d8fc0){return _0x7d8fc0===_0x1b97('0x77');});if(!_0x5b149f){return _0x5f1694(new Error(_0x1b97('0x78')));}var _0x42b93c=fs[_0x1b97('0x79')](path[_0x1b97('0x55')](_0x18941e,_0x2e1f12[0x0],_0x1b97('0x77')));var _0x2b13d8=JSON[_0x1b97('0x7a')](_0x42b93c);if(_0x1b97('0x21')==typeof _0x2b13d8[_0x1b97('0x31')]){return _0x5f1694(new Error(_0x1b97('0x7b')));}if(_0x1b97('0x21')==typeof _0x2b13d8['type']){return _0x5f1694(new Error(_0x1b97('0x7c')));}if('undefined'==typeof _0x2b13d8[_0x1b97('0x7d')]){return _0x5f1694(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x2b13d8['parameters']){return _0x5f1694(new Error(_0x1b97('0x7e')));}if(_0x2b13d8['type']===_0x1b97('0x7f')){if('undefined'==typeof _0x2b13d8[_0x1b97('0x80')]['views']){return _0x5f1694(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x1b97('0x21')==typeof _0x2b13d8[_0x1b97('0x80')][_0x1b97('0x81')][_0x1b97('0x82')]&&_0x1b97('0x21')==typeof _0x2b13d8['parameters'][_0x1b97('0x81')]['agent']){return _0x5f1694(new Error(_0x1b97('0x83')));}}else if(_0x2b13d8['type']===_0x1b97('0x84')){if(_0x1b97('0x21')==typeof _0x2b13d8[_0x1b97('0x80')][_0x1b97('0x85')]){return _0x5f1694(new Error(_0x1b97('0x86')));}if(_0x1b97('0x21')==typeof _0x2b13d8[_0x1b97('0x80')][_0x1b97('0x87')]){return _0x5f1694(new Error(_0x1b97('0x88')));}}else{return _0x5f1694(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x5ade5e=_0x2b13d8[_0x1b97('0x31')];var _0x33c37f=_0x2b13d8[_0x1b97('0x89')];var _0x22ed02=_0x2b13d8[_0x1b97('0x38')];var _0x47dbd6=_0x2b13d8[_0x1b97('0x8a')]?_0x2b13d8[_0x1b97('0x8a')]:_0x1b97('0x8b');var _0x6502e9=_0x2b13d8['icon']?_0x2b13d8[_0x1b97('0x8c')]:'icon-apps';var _0x335524='';var _0x26683b='';var _0x5a3588='';var _0x4a0557='';var _0x5ad6ac=_0x2b13d8['version'];if(_0x22ed02===_0x1b97('0x7f')){if(_0x1b97('0x21')!=typeof _0x2b13d8[_0x1b97('0x80')][_0x1b97('0x81')][_0x1b97('0x82')]){var _0x3ec7da=_0x2b13d8[_0x1b97('0x80')][_0x1b97('0x81')][_0x1b97('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x1b97('0x8d')](_0x3ec7da)){_0x335524=path[_0x1b97('0x55')]('plugins',_0x548175,_0x2e1f12[0x0],_0x3ec7da);}else{_0x335524=_0x3ec7da;}}else{logger[_0x1b97('0x69')](_0x1b97('0x8e'));}if(_0x1b97('0x21')!=typeof _0x2b13d8[_0x1b97('0x80')]['views'][_0x1b97('0x8f')]){var _0x158d6c=_0x2b13d8[_0x1b97('0x80')][_0x1b97('0x81')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x1b97('0x8d')](_0x158d6c)){_0x26683b=path[_0x1b97('0x55')](_0x1b97('0x90'),_0x548175,_0x2e1f12[0x0],_0x158d6c);}else{_0x26683b=_0x158d6c;}}else{logger[_0x1b97('0x69')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x22ed02===_0x1b97('0x84')){_0x5a3588=_0x2b13d8[_0x1b97('0x80')]['scriptName'];_0x4a0557=_0x2b13d8[_0x1b97('0x80')]['scriptPath'];if(_0x1b97('0x21')!=typeof _0x2b13d8[_0x1b97('0x80')][_0x1b97('0x81')]){if('undefined'!=typeof _0x2b13d8[_0x1b97('0x80')]['views'][_0x1b97('0x82')]){var _0x3ec7da=_0x2b13d8[_0x1b97('0x80')][_0x1b97('0x81')][_0x1b97('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3ec7da)){_0x335524=path['join'](_0x1b97('0x90'),_0x548175,_0x2e1f12[0x0],_0x3ec7da);}else{_0x335524=_0x3ec7da;}}if(_0x1b97('0x21')!=typeof _0x2b13d8[_0x1b97('0x80')][_0x1b97('0x81')][_0x1b97('0x8f')]){var _0x158d6c=_0x2b13d8[_0x1b97('0x80')][_0x1b97('0x81')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x1b97('0x8d')](_0x158d6c)){_0x26683b=path['join']('plugins',_0x548175,_0x2e1f12[0x0],_0x158d6c);}else{_0x26683b=_0x158d6c;}}}}var _0x367ee8={'name':_0x5ade5e,'description':_0x33c37f,'path':path[_0x1b97('0x55')](_0x548175,_0x2e1f12[0x0]),'type':_0x22ed02,'sidebar':_0x47dbd6,'icon':_0x6502e9,'adminUrl':_0x335524,'agentUrl':_0x26683b,'scriptName':_0x5a3588,'scriptPath':_0x4a0557,'version':_0x5ad6ac};removeReferences(_0x2ef212,null);return db[_0x1b97('0x35')][_0x1b97('0x91')](_0x367ee8)[_0x1b97('0x29')](function(_0x8662a4){var _0x4a1ba0={'role':_0x28d27f[_0x1b97('0x92')]['role'],'userProfileId':_0x28d27f[_0x1b97('0x92')][_0x1b97('0x93')]};if(!_0x4a1ba0)throw new Error(_0x1b97('0x94'));if(_0x4a1ba0[_0x1b97('0x95')]===_0x1b97('0x96')){var _0x109bc8=_0x8662a4[_0x1b97('0x2a')]({'plain':!![]});return db[_0x1b97('0x97')][_0x1b97('0x53')]({'where':{'name':_0x1b97('0x2b'),'userProfileId':_0x4a1ba0[_0x1b97('0x93')]},'raw':!![]})['then'](function(_0x196dfb){if(_0x196dfb&&_0x196dfb['autoAssociation']===0x0){return db[_0x1b97('0x2c')]['create']({'name':_0x109bc8[_0x1b97('0x31')],'resourceId':_0x109bc8['id'],'type':_0x196dfb['name'],'sectionId':_0x196dfb['id']},{})[_0x1b97('0x29')](function(){return _0x8662a4;});}else{return _0x8662a4;}})[_0x1b97('0x4f')](function(_0x5b70c9){logger['error'](_0x1b97('0x98'),_0x5b70c9);throw _0x5b70c9;});}return _0x8662a4;})[_0x1b97('0x29')](respondWithResult(_0x3d4d7e,null))[_0x1b97('0x4f')](handleError(_0x3d4d7e,null));}});}catch(_0x13b194){_0x3d4d7e[_0x1b97('0x1e')](0x1f4)['send'](_0x13b194);}};function removeReferences(_0x32cb9f,_0x494f77){try{if(_0x32cb9f){fs['unlinkSync'](_0x32cb9f);logger[_0x1b97('0x69')]('Zip\x20archive\x20removed');}if(_0x494f77){rimraf(_0x494f77,function(){});logger['info'](_0x1b97('0x99'));}}catch(_0x4864e8){logger[_0x1b97('0x2f')](_0x4864e8);}}exports[_0x1b97('0x28')]=function(_0x1726e3,_0x343fd9,_0x434eda){return db[_0x1b97('0x35')][_0x1b97('0x53')]({'where':{'id':_0x1726e3[_0x1b97('0x51')]['id']}})[_0x1b97('0x29')](handleEntityNotFound(_0x343fd9,null))[_0x1b97('0x29')](saveUpdates(_0x1726e3[_0x1b97('0x92')],null))[_0x1b97('0x29')](respondWithResult(_0x343fd9,null))[_0x1b97('0x4f')](handleError(_0x343fd9,null));};exports[_0x1b97('0x9a')]=function(_0x16d13e,_0x35acf8,_0x25a58d){return db['Plugin'][_0x1b97('0x53')]({'where':{'id':_0x16d13e[_0x1b97('0x51')]['id']}})[_0x1b97('0x29')](function(_0x1e596d){if(_0x1e596d){return _0x1e596d[_0x1b97('0x2d')]();}})[_0x1b97('0x29')](function(_0x5e721b){rimraf(path[_0x1b97('0x55')](config[_0x1b97('0x56')],_0x1b97('0x57'),path[_0x1b97('0x63')](_0x5e721b[_0x1b97('0x7')])),function(){});return _0x5e721b;})['then'](handleEntityNotFound(_0x35acf8,null))[_0x1b97('0x29')](respondWithStatusCode(_0x35acf8,null))[_0x1b97('0x4f')](handleError(_0x35acf8,null));};exports[_0x1b97('0x9b')]=function(_0x3e4d43,_0xdd44aa,_0xd00784){return BPromise[_0x1b97('0x9c')]()['then'](function(){if(!_0x3e4d43['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3e4d43['query'][_0x1b97('0x9d')]){throw new Error(_0x1b97('0x9e'));}var _0x444fc3=_0x3e4d43[_0x1b97('0x3b')][_0x1b97('0x9f')]?_0x3e4d43[_0x1b97('0x3b')][_0x1b97('0x9f')]+':'+_0x3e4d43[_0x1b97('0x3b')][_0x1b97('0x9d')]:_0x1b97('0xa0')+_0x3e4d43[_0x1b97('0x3b')][_0x1b97('0x9d')];var _0x4d0f21=_0x3e4d43[_0x1b97('0x3b')][_0x1b97('0x1f')]?_0x3e4d43['query'][_0x1b97('0x1f')]:!![];var _0x70ed3a=_0x3e4d43[_0x1b97('0x3b')]['encoding']?_0x3e4d43[_0x1b97('0x3b')]['encoding']:null;var _0x112bd7={'method':_0x3e4d43[_0x1b97('0xa1')],'uri':util[_0x1b97('0x58')]('%s%s',_0x444fc3,_0x3e4d43[_0x1b97('0x3b')]['path']),'json':_0x4d0f21,'resolveWithFullResponse':!![],'encoding':_0x70ed3a,'qs':_0x3e4d43[_0x1b97('0x3b')]};if(_0x3e4d43[_0x1b97('0xa2')]){_0x112bd7[_0x1b97('0xa2')]=_0x3e4d43[_0x1b97('0xa2')];if(_0x112bd7[_0x1b97('0xa2')][_0x1b97('0xa3')]){delete _0x112bd7[_0x1b97('0xa2')][_0x1b97('0xa3')];}}if(_0x112bd7[_0x1b97('0xa2')]['content-type']){delete _0x112bd7[_0x1b97('0xa2')][_0x1b97('0xa4')];}return rp(_0x112bd7);})[_0x1b97('0x29')](function(_0x453010){if(_0x453010){_0xdd44aa['set'](_0x453010[_0x1b97('0xa2')]);logger[_0x1b97('0x69')](_0x453010[_0x1b97('0x92')]);if(_[_0x1b97('0xa5')](_0x3e4d43[_0x1b97('0x3b')]['path'],_0x1b97('0x54'))&&_0x453010[_0x1b97('0xa6')]==0x1f4){return _0xdd44aa[_0x1b97('0x1d')](_0x453010[_0x1b97('0xa6')]);}else{return _0xdd44aa[_0x1b97('0x1e')](_0x453010[_0x1b97('0xa6')])['send'](_0x453010[_0x1b97('0x92')]);}}else{return _0xdd44aa[_0x1b97('0x1d')](0xc8);}})[_0x1b97('0x4f')](handleError(_0xdd44aa,null));};exports[_0x1b97('0xa7')]=function(_0x4bde33,_0x19daab,_0x3d1402){return BPromise[_0x1b97('0x9c')]()['then'](function(){if(!_0x4bde33[_0x1b97('0x3b')][_0x1b97('0x7')]){throw new Error(_0x1b97('0xa8'));}if(!_0x4bde33[_0x1b97('0x3b')][_0x1b97('0x9d')]){throw new Error(_0x1b97('0x9e'));}var _0x21e6be=_0x4bde33[_0x1b97('0x3b')][_0x1b97('0x9f')]?_0x4bde33['query'][_0x1b97('0x9f')]+':'+_0x4bde33[_0x1b97('0x3b')][_0x1b97('0x9d')]:_0x1b97('0xa0')+_0x4bde33[_0x1b97('0x3b')][_0x1b97('0x9d')];var _0x261f25=_0x4bde33[_0x1b97('0x3b')]['json']?_0x4bde33['query'][_0x1b97('0x1f')]:!![];var _0x3bf3c3=_0x4bde33['query'][_0x1b97('0xa9')]?_0x4bde33[_0x1b97('0x3b')]['encoding']:null;var _0x3a20b9={'method':_0x4bde33[_0x1b97('0xa1')],'uri':util[_0x1b97('0x58')]('%s%s',_0x21e6be,_0x4bde33[_0x1b97('0x3b')][_0x1b97('0x7')]),'json':_0x261f25,'resolveWithFullResponse':!![],'encoding':_0x3bf3c3,'body':_0x4bde33[_0x1b97('0x92')]};if(_0x4bde33[_0x1b97('0xa2')]){_0x3a20b9[_0x1b97('0xa2')]=_0x4bde33[_0x1b97('0xa2')];if(_0x3a20b9['headers'][_0x1b97('0xa3')]){delete _0x3a20b9['headers']['content-length'];}}if(_0x3a20b9[_0x1b97('0xa2')]['content-type']){delete _0x3a20b9[_0x1b97('0xa2')]['content-type'];}return rp(_0x3a20b9);})['then'](function(_0x4cd272){if(_0x4cd272){_0x19daab[_0x1b97('0x24')](_0x4cd272['headers']);logger[_0x1b97('0x69')](_0x4cd272[_0x1b97('0x92')]);return _0x19daab[_0x1b97('0x1e')](_0x4cd272['statusCode'])[_0x1b97('0x32')](_0x4cd272[_0x1b97('0x92')]);}else{return _0x19daab['sendStatus'](0xc8);}})[_0x1b97('0x4f')](handleError(_0x19daab,null));}; \ No newline at end of file +var _0x4e8f=['Content-Range','apply','update','destroy','then','get','Plugins','UserProfileResource','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','download','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','root','dirname','node_modules/**/*','existsSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','extname','file','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','html','test','Warning:\x20agent\x20view\x20not\x20specified','script','plugins','create','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','body','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','statusCode','webhookPost','content-type','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','extract-zip','rimraf','../../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','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x4e4608,_0x22fd78){var _0xa044ef=function(_0x34da5d){while(--_0x34da5d){_0x4e4608['push'](_0x4e4608['shift']());}};_0xa044ef(++_0x22fd78);}(_0x4e8f,0x1d4));var _0xf4e8=function(_0x4d10a4,_0x1354e3){_0x4d10a4=_0x4d10a4-0x0;var _0x59b7b0=_0x4e8f[_0x4d10a4];return _0x59b7b0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf4e8('0x0'));var jsonpatch=require(_0xf4e8('0x1'));var rp=require(_0xf4e8('0x2'));var moment=require(_0xf4e8('0x3'));var BPromise=require(_0xf4e8('0x4'));var Mustache=require(_0xf4e8('0x5'));var util=require(_0xf4e8('0x6'));var path=require(_0xf4e8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf4e8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf4e8('0x9'));var squel=require(_0xf4e8('0xa'));var crypto=require(_0xf4e8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf4e8('0xc'));var toCsv=require(_0xf4e8('0xd'));var querystring=require(_0xf4e8('0xe'));var Papa=require(_0xf4e8('0xf'));var extract=require(_0xf4e8('0x10'));var rimraf=require(_0xf4e8('0x11'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf4e8('0x12'));var as=require(_0xf4e8('0x13'));var hardwareService=require(_0xf4e8('0x14'));var logger=require(_0xf4e8('0x15'))(_0xf4e8('0x16'));var utils=require(_0xf4e8('0x17'));var config=require(_0xf4e8('0x18'));var licenseUtil=require(_0xf4e8('0x19'));var db=require(_0xf4e8('0x1a'))['db'];config[_0xf4e8('0x1b')]=_[_0xf4e8('0x1c')](config[_0xf4e8('0x1b')],{'host':_0xf4e8('0x1d'),'port':0x18eb});var socket=require(_0xf4e8('0x1e'))(new Redis(config['redis']));require(_0xf4e8('0x1f'))[_0xf4e8('0x20')](socket);function respondWithStatusCode(_0x2bc409,_0xa53dd7){_0xa53dd7=_0xa53dd7||0xcc;return function(_0x10683c){if(_0x10683c){return _0x2bc409[_0xf4e8('0x21')](_0xa53dd7);}return _0x2bc409[_0xf4e8('0x22')](_0xa53dd7)[_0xf4e8('0x23')]();};}function respondWithResult(_0x53142,_0x4536f7){_0x4536f7=_0x4536f7||0xc8;return function(_0x341695){if(_0x341695){return _0x53142[_0xf4e8('0x22')](_0x4536f7)[_0xf4e8('0x24')](_0x341695);}};}function respondWithFilteredResult(_0x16cead,_0x5179de){return function(_0x1d64db){if(_0x1d64db){var _0x5c8e89=typeof _0x5179de[_0xf4e8('0x25')]===_0xf4e8('0x26')&&typeof _0x5179de[_0xf4e8('0x27')]===_0xf4e8('0x26');var _0x2919aa=_0x1d64db[_0xf4e8('0x28')];var _0x5cc1fc=_0x5c8e89?0x0:_0x5179de[_0xf4e8('0x25')];var _0x22e65a=_0x5c8e89?_0x1d64db['count']:_0x5179de['offset']+_0x5179de['limit'];var _0x4ac7df;if(_0x22e65a>=_0x2919aa){_0x22e65a=_0x2919aa;_0x4ac7df=0xc8;}else{_0x4ac7df=0xce;}_0x16cead[_0xf4e8('0x22')](_0x4ac7df);return _0x16cead[_0xf4e8('0x29')](_0xf4e8('0x2a'),_0x5cc1fc+'-'+_0x22e65a+'/'+_0x2919aa)[_0xf4e8('0x24')](_0x1d64db);}return null;};}function patchUpdates(_0x30ecee){return function(_0x3dacb1){try{jsonpatch[_0xf4e8('0x2b')](_0x3dacb1,_0x30ecee,!![]);}catch(_0x1d4c8c){return BPromise['reject'](_0x1d4c8c);}return _0x3dacb1['save']();};}function saveUpdates(_0x3eb188,_0x288a30){return function(_0xd1d4f0){if(_0xd1d4f0){return _0xd1d4f0[_0xf4e8('0x2c')](_0x3eb188)['then'](function(_0x4fb72e){return _0x4fb72e;});}return null;};}function removeEntity(_0x3a35c7,_0x1ae7a9){return function(_0x1dcf1a){if(_0x1dcf1a){return _0x1dcf1a[_0xf4e8('0x2d')]()[_0xf4e8('0x2e')](function(){var _0x16caee=_0x1dcf1a[_0xf4e8('0x2f')]({'plain':!![]});var _0x187bfe=_0xf4e8('0x30');return db[_0xf4e8('0x31')][_0xf4e8('0x2d')]({'where':{'type':_0x187bfe,'resourceId':_0x16caee['id']}})['then'](function(){return _0x1dcf1a;});})[_0xf4e8('0x2e')](function(){_0x3a35c7[_0xf4e8('0x22')](0xcc)[_0xf4e8('0x23')]();});}};}function handleEntityNotFound(_0x1ec54c,_0x3f8cc9){return function(_0x3b0053){if(!_0x3b0053){_0x1ec54c[_0xf4e8('0x21')](0x194);}return _0x3b0053;};}function handleError(_0x279b67,_0x506377){_0x506377=_0x506377||0x1f4;return function(_0x38c92b){logger['error'](_0x38c92b[_0xf4e8('0x32')]);if(_0x38c92b[_0xf4e8('0x33')]){delete _0x38c92b['name'];}_0x279b67[_0xf4e8('0x22')](_0x506377)[_0xf4e8('0x34')](_0x38c92b);};}exports[_0xf4e8('0x35')]=function(_0x29496b,_0xc137bc){var _0x4c95ef={},_0x286823={},_0x3e0f60={'count':0x0,'rows':[]};var _0x1e4f8f=_[_0xf4e8('0x36')](db[_0xf4e8('0x37')][_0xf4e8('0x38')],function(_0x1ff290){return{'name':_0x1ff290[_0xf4e8('0x39')],'type':_0x1ff290[_0xf4e8('0x3a')][_0xf4e8('0x3b')]};});_0x286823[_0xf4e8('0x3c')]=_[_0xf4e8('0x36')](_0x1e4f8f,_0xf4e8('0x33'));_0x286823[_0xf4e8('0x3d')]=_['keys'](_0x29496b[_0xf4e8('0x3d')]);_0x286823[_0xf4e8('0x3e')]=_[_0xf4e8('0x3f')](_0x286823[_0xf4e8('0x3c')],_0x286823['query']);_0x4c95ef[_0xf4e8('0x40')]=_['intersection'](_0x286823['model'],qs[_0xf4e8('0x41')](_0x29496b[_0xf4e8('0x3d')][_0xf4e8('0x41')]));_0x4c95ef[_0xf4e8('0x40')]=_0x4c95ef['attributes'][_0xf4e8('0x42')]?_0x4c95ef['attributes']:_0x286823[_0xf4e8('0x3c')];if(!_0x29496b['query'][_0xf4e8('0x43')](_0xf4e8('0x44'))){_0x4c95ef[_0xf4e8('0x27')]=qs['limit'](_0x29496b[_0xf4e8('0x3d')][_0xf4e8('0x27')]);_0x4c95ef[_0xf4e8('0x25')]=qs[_0xf4e8('0x25')](_0x29496b[_0xf4e8('0x3d')][_0xf4e8('0x25')]);}_0x4c95ef[_0xf4e8('0x45')]=qs[_0xf4e8('0x46')](_0x29496b[_0xf4e8('0x3d')][_0xf4e8('0x46')]);_0x4c95ef[_0xf4e8('0x47')]=qs[_0xf4e8('0x3e')](_[_0xf4e8('0x48')](_0x29496b['query'],_0x286823[_0xf4e8('0x3e')]),_0x1e4f8f);if(_0x29496b[_0xf4e8('0x3d')][_0xf4e8('0x49')]){_0x4c95ef[_0xf4e8('0x47')]=_[_0xf4e8('0x4a')](_0x4c95ef['where'],{'$or':_[_0xf4e8('0x36')](_0x1e4f8f,function(_0x48006e){if(_0x48006e['type']!=='VIRTUAL'){var _0x453f58={};_0x453f58[_0x48006e[_0xf4e8('0x33')]]={'$like':'%'+_0x29496b[_0xf4e8('0x3d')][_0xf4e8('0x49')]+'%'};return _0x453f58;}})});}_0x4c95ef=_['merge']({},_0x4c95ef,_0x29496b[_0xf4e8('0x4b')]);var _0x1cbec6={'where':_0x4c95ef[_0xf4e8('0x47')]};return db['Plugin'][_0xf4e8('0x28')](_0x1cbec6)['then'](function(_0x45094c){_0x3e0f60[_0xf4e8('0x28')]=_0x45094c;if(_0x29496b['query'][_0xf4e8('0x4c')]){_0x4c95ef[_0xf4e8('0x4d')]=[{'all':!![]}];}return db[_0xf4e8('0x37')][_0xf4e8('0x4e')](_0x4c95ef);})[_0xf4e8('0x2e')](function(_0x4c16c0){_0x3e0f60[_0xf4e8('0x4f')]=_0x4c16c0;return _0x3e0f60;})[_0xf4e8('0x2e')](respondWithFilteredResult(_0xc137bc,_0x4c95ef))[_0xf4e8('0x50')](handleError(_0xc137bc,null));};exports[_0xf4e8('0x51')]=function(_0x342fce,_0x19080d){var _0x1b3e26={'raw':!![],'where':{'id':_0x342fce[_0xf4e8('0x52')]['id']}},_0x496f07={};_0x496f07['model']=_[_0xf4e8('0x53')](db[_0xf4e8('0x37')]['rawAttributes']);_0x496f07[_0xf4e8('0x3d')]=_[_0xf4e8('0x53')](_0x342fce['query']);_0x496f07['filters']=_['intersection'](_0x496f07[_0xf4e8('0x3c')],_0x496f07[_0xf4e8('0x3d')]);_0x1b3e26[_0xf4e8('0x40')]=_[_0xf4e8('0x3f')](_0x496f07['model'],qs[_0xf4e8('0x41')](_0x342fce[_0xf4e8('0x3d')]['fields']));_0x1b3e26['attributes']=_0x1b3e26[_0xf4e8('0x40')][_0xf4e8('0x42')]?_0x1b3e26[_0xf4e8('0x40')]:_0x496f07[_0xf4e8('0x3c')];if(_0x342fce[_0xf4e8('0x3d')][_0xf4e8('0x4c')]){_0x1b3e26[_0xf4e8('0x4d')]=[{'all':!![]}];}_0x1b3e26=_[_0xf4e8('0x4a')]({},_0x1b3e26,_0x342fce[_0xf4e8('0x4b')]);return db[_0xf4e8('0x37')][_0xf4e8('0x54')](_0x1b3e26)[_0xf4e8('0x2e')](handleEntityNotFound(_0x19080d,null))['then'](respondWithResult(_0x19080d,null))['catch'](handleError(_0x19080d,null));};exports[_0xf4e8('0x55')]=function(_0x40ebca,_0x50d284,_0x300864){return db['Plugin']['find']({'where':{'id':_0x40ebca['params']['id']},'attributes':[_0xf4e8('0x33'),'path'],'raw':!![]})['then'](handleEntityNotFound(_0x50d284,null))[_0xf4e8('0x2e')](function(_0x377603){if(_0x377603){var _0x37d71b=path[_0xf4e8('0x56')](config['root'],_0xf4e8('0x57'),util[_0xf4e8('0x58')](_0xf4e8('0x59'),path[_0xf4e8('0x5a')](_0x377603['path'])));var _0x12a37c=fs[_0xf4e8('0x5b')](_0x37d71b);var _0x8a0c03=archiver(_0xf4e8('0x5c'),{'zlib':{'level':0x9}});_0x8a0c03['on'](_0xf4e8('0x5d'),function(_0x4166d7){if(_0x4166d7[_0xf4e8('0x5e')]===_0xf4e8('0x5f')){logger[_0xf4e8('0x60')](_0x4166d7);}else{throw new db[(_0xf4e8('0x61'))][(_0xf4e8('0x62'))](_0xf4e8('0x63'));}});_0x8a0c03['on'](_0xf4e8('0x60'),function(_0x1e262c){throw new db[(_0xf4e8('0x61'))][(_0xf4e8('0x62'))](_0xf4e8('0x63'));});_0x8a0c03['pipe'](_0x12a37c);_0x8a0c03['glob'](_0xf4e8('0x64'),{'cwd':path['join'](config[_0xf4e8('0x65')],'server/files/plugins',path[_0xf4e8('0x66')](_0x377603[_0xf4e8('0x7')])),'ignore':[path[_0xf4e8('0x56')](path['basename'](_0x377603['path']),_0xf4e8('0x67')),path[_0xf4e8('0x56')](path['basename'](_0x377603[_0xf4e8('0x7')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x12a37c['on']('close',function(){if(!fs[_0xf4e8('0x68')](_0x37d71b)){throw new db['Sequelize'][(_0xf4e8('0x62'))]('Plugin\x20not\x20found');}return _0x50d284[_0xf4e8('0x55')](_0x37d71b,util[_0xf4e8('0x58')](_0xf4e8('0x59'),path[_0xf4e8('0x5a')](_0x377603[_0xf4e8('0x7')])),function(_0xdd40f8){if(_0xdd40f8){throw new db[(_0xf4e8('0x61'))][(_0xf4e8('0x62'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x37d71b);logger[_0xf4e8('0x69')](_0xf4e8('0x6a'));logger[_0xf4e8('0x69')](_0xf4e8('0x6b'));});});}return null;})[_0xf4e8('0x50')](handleError(_0x50d284,null));};exports[_0xf4e8('0x6c')]=function(_0x342c8d,_0x3d126c,_0x561865){var _0x396c87=path[_0xf4e8('0x5a')](_0x342c8d['file']['filename'],path[_0xf4e8('0x6d')](_0x342c8d['file']['filename']));var _0x171e4a=path[_0xf4e8('0x56')](config[_0xf4e8('0x65')],_0xf4e8('0x57'),_0x342c8d[_0xf4e8('0x6e')][_0xf4e8('0x6f')]);var _0x327a78=path[_0xf4e8('0x56')](config[_0xf4e8('0x65')],_0xf4e8('0x57'),_0x396c87);logger[_0xf4e8('0x69')]('Plugin\x20upload\x20filepath:\x20%s',_0x171e4a);logger[_0xf4e8('0x69')](_0xf4e8('0x70'),_0x327a78);try{fs[_0xf4e8('0x71')](_0x171e4a,parseInt(_0xf4e8('0x72'),0x8));extract(_0x171e4a,{'dir':_0x327a78},function(_0x120848){if(_0x120848){logger[_0xf4e8('0x60')](_0x120848);handleError(_0x120848,!![]);};var _0x449e2b=fs[_0xf4e8('0x73')](_0x327a78);if(_0x449e2b[_0xf4e8('0x42')]>0x1){removeReferences(_0x171e4a,_0x327a78);logger[_0xf4e8('0x60')](_0xf4e8('0x74'));return _0x561865(new Error(_0xf4e8('0x74')));}var _0x5b4db7=fs[_0xf4e8('0x75')](path[_0xf4e8('0x56')](_0x327a78,_0x449e2b[0x0]));if(_0x5b4db7[_0xf4e8('0x76')]()){removeReferences(_0x171e4a,_0x327a78);logger[_0xf4e8('0x60')](_0xf4e8('0x74'));return _0x561865(new Error(_0xf4e8('0x74')));}if(_0x5b4db7['isDirectory']()){var _0x5e4ee4=fs[_0xf4e8('0x73')](path[_0xf4e8('0x56')](_0x327a78,_0x449e2b[0x0]));if(_0x5e4ee4[_0xf4e8('0x42')]===0x0){removeReferences(_0x171e4a,_0x327a78);logger[_0xf4e8('0x60')]('Invalid\x20plugin\x20structure');return _0x561865(new Error(_0xf4e8('0x74')));}var _0xf13b13=_0x5e4ee4[_0xf4e8('0x77')](function(_0x7c0789){return _0x7c0789===_0xf4e8('0x78');});if(!_0xf13b13){return _0x561865(new Error('Plugin\x20manifest\x20missing'));}var _0x134b4f=fs['readFileSync'](path['join'](_0x327a78,_0x449e2b[0x0],_0xf4e8('0x78')));var _0x324cc5=JSON[_0xf4e8('0x79')](_0x134b4f);if(_0xf4e8('0x26')==typeof _0x324cc5[_0xf4e8('0x33')]){return _0x561865(new Error(_0xf4e8('0x7a')));}if(_0xf4e8('0x26')==typeof _0x324cc5['type']){return _0x561865(new Error(_0xf4e8('0x7b')));}if('undefined'==typeof _0x324cc5[_0xf4e8('0x7c')]){return _0x561865(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xf4e8('0x26')==typeof _0x324cc5[_0xf4e8('0x7d')]){return _0x561865(new Error(_0xf4e8('0x7e')));}if(_0x324cc5[_0xf4e8('0x3a')]==='html'){if(_0xf4e8('0x26')==typeof _0x324cc5[_0xf4e8('0x7d')]['views']){return _0x561865(new Error(_0xf4e8('0x7f')));}if(_0xf4e8('0x26')==typeof _0x324cc5[_0xf4e8('0x7d')][_0xf4e8('0x80')][_0xf4e8('0x81')]&&_0xf4e8('0x26')==typeof _0x324cc5[_0xf4e8('0x7d')]['views'][_0xf4e8('0x82')]){return _0x561865(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x324cc5[_0xf4e8('0x3a')]==='script'){if(_0xf4e8('0x26')==typeof _0x324cc5[_0xf4e8('0x7d')][_0xf4e8('0x83')]){return _0x561865(new Error(_0xf4e8('0x84')));}if(_0xf4e8('0x26')==typeof _0x324cc5[_0xf4e8('0x7d')][_0xf4e8('0x85')]){return _0x561865(new Error(_0xf4e8('0x86')));}}else{return _0x561865(new Error(_0xf4e8('0x87')));}var _0x290610=_0x324cc5['name'];var _0x16e6d=_0x324cc5[_0xf4e8('0x88')];var _0x201984=_0x324cc5[_0xf4e8('0x3a')];var _0x522b48=_0x324cc5[_0xf4e8('0x89')]?_0x324cc5[_0xf4e8('0x89')]:'always';var _0x2952d2=_0x324cc5[_0xf4e8('0x8a')]?_0x324cc5[_0xf4e8('0x8a')]:_0xf4e8('0x8b');var _0x33a40f='';var _0x33f728='';var _0x18c9af='';var _0x1ad158='';var _0x2c867a=_0x324cc5['version'];if(_0x201984===_0xf4e8('0x8c')){if('undefined'!=typeof _0x324cc5[_0xf4e8('0x7d')][_0xf4e8('0x80')]['admin']){var _0x188408=_0x324cc5[_0xf4e8('0x7d')][_0xf4e8('0x80')][_0xf4e8('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xf4e8('0x8d')](_0x188408)){_0x33a40f=path[_0xf4e8('0x56')]('plugins',_0x396c87,_0x449e2b[0x0],_0x188408);}else{_0x33a40f=_0x188408;}}else{logger[_0xf4e8('0x69')]('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x324cc5[_0xf4e8('0x7d')][_0xf4e8('0x80')][_0xf4e8('0x82')]){var _0x58aa23=_0x324cc5[_0xf4e8('0x7d')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0xf4e8('0x8d')](_0x58aa23)){_0x33f728=path['join']('plugins',_0x396c87,_0x449e2b[0x0],_0x58aa23);}else{_0x33f728=_0x58aa23;}}else{logger[_0xf4e8('0x69')](_0xf4e8('0x8e'));}}else if(_0x201984===_0xf4e8('0x8f')){_0x18c9af=_0x324cc5[_0xf4e8('0x7d')][_0xf4e8('0x83')];_0x1ad158=_0x324cc5['parameters'][_0xf4e8('0x85')];if(_0xf4e8('0x26')!=typeof _0x324cc5[_0xf4e8('0x7d')]['views']){if('undefined'!=typeof _0x324cc5[_0xf4e8('0x7d')]['views']['admin']){var _0x188408=_0x324cc5[_0xf4e8('0x7d')][_0xf4e8('0x80')][_0xf4e8('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xf4e8('0x8d')](_0x188408)){_0x33a40f=path[_0xf4e8('0x56')](_0xf4e8('0x90'),_0x396c87,_0x449e2b[0x0],_0x188408);}else{_0x33a40f=_0x188408;}}if(_0xf4e8('0x26')!=typeof _0x324cc5[_0xf4e8('0x7d')]['views'][_0xf4e8('0x82')]){var _0x58aa23=_0x324cc5['parameters'][_0xf4e8('0x80')][_0xf4e8('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xf4e8('0x8d')](_0x58aa23)){_0x33f728=path[_0xf4e8('0x56')]('plugins',_0x396c87,_0x449e2b[0x0],_0x58aa23);}else{_0x33f728=_0x58aa23;}}}}var _0xf1093b={'name':_0x290610,'description':_0x16e6d,'path':path[_0xf4e8('0x56')](_0x396c87,_0x449e2b[0x0]),'type':_0x201984,'sidebar':_0x522b48,'icon':_0x2952d2,'adminUrl':_0x33a40f,'agentUrl':_0x33f728,'scriptName':_0x18c9af,'scriptPath':_0x1ad158,'version':_0x2c867a};removeReferences(_0x171e4a,null);return db[_0xf4e8('0x37')][_0xf4e8('0x91')](_0xf1093b)[_0xf4e8('0x2e')](function(_0x5ba128){var _0x16e5a7={'role':_0x342c8d['body']['role'],'userProfileId':_0x342c8d['body'][_0xf4e8('0x92')]};if(!_0x16e5a7)throw new Error(_0xf4e8('0x93'));if(_0x16e5a7['role']===_0xf4e8('0x94')){var _0x37fbab=_0x5ba128['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xf4e8('0x30'),'userProfileId':_0x16e5a7[_0xf4e8('0x92')]},'raw':!![]})[_0xf4e8('0x2e')](function(_0x546726){if(_0x546726&&_0x546726['autoAssociation']===0x0){return db[_0xf4e8('0x31')][_0xf4e8('0x91')]({'name':_0x37fbab['name'],'resourceId':_0x37fbab['id'],'type':_0x546726[_0xf4e8('0x33')],'sectionId':_0x546726['id']},{})[_0xf4e8('0x2e')](function(){return _0x5ba128;});}else{return _0x5ba128;}})['catch'](function(_0x4a82cb){logger[_0xf4e8('0x60')](_0xf4e8('0x95'),_0x4a82cb);throw _0x4a82cb;});}return _0x5ba128;})[_0xf4e8('0x2e')](respondWithResult(_0x3d126c,null))['catch'](handleError(_0x3d126c,null));}});}catch(_0x339988){_0x3d126c[_0xf4e8('0x22')](0x1f4)[_0xf4e8('0x34')](_0x339988);}};function removeReferences(_0x5b3071,_0x18d5b9){try{if(_0x5b3071){fs[_0xf4e8('0x96')](_0x5b3071);logger[_0xf4e8('0x69')](_0xf4e8('0x97'));}if(_0x18d5b9){rimraf(_0x18d5b9,function(){});logger[_0xf4e8('0x69')](_0xf4e8('0x98'));}}catch(_0x268469){logger[_0xf4e8('0x60')](_0x268469);}}exports[_0xf4e8('0x2c')]=function(_0x1f6462,_0x12c88e,_0x1a5fcd){return db[_0xf4e8('0x37')][_0xf4e8('0x54')]({'where':{'id':_0x1f6462[_0xf4e8('0x52')]['id']}})[_0xf4e8('0x2e')](handleEntityNotFound(_0x12c88e,null))['then'](saveUpdates(_0x1f6462[_0xf4e8('0x99')],null))[_0xf4e8('0x2e')](respondWithResult(_0x12c88e,null))[_0xf4e8('0x50')](handleError(_0x12c88e,null));};exports[_0xf4e8('0x9a')]=function(_0x505cc7,_0x2b7a0b,_0x4b0114){return db[_0xf4e8('0x37')][_0xf4e8('0x54')]({'where':{'id':_0x505cc7[_0xf4e8('0x52')]['id']}})['then'](function(_0x35b25e){if(_0x35b25e){return _0x35b25e[_0xf4e8('0x2d')]();}})[_0xf4e8('0x2e')](function(_0x40ccf7){rimraf(path[_0xf4e8('0x56')](config[_0xf4e8('0x65')],_0xf4e8('0x57'),path[_0xf4e8('0x66')](_0x40ccf7[_0xf4e8('0x7')])),function(){});return _0x40ccf7;})[_0xf4e8('0x2e')](handleEntityNotFound(_0x2b7a0b,null))[_0xf4e8('0x2e')](respondWithStatusCode(_0x2b7a0b,null))['catch'](handleError(_0x2b7a0b,null));};exports[_0xf4e8('0x9b')]=function(_0x1d7be7,_0x3417d9,_0x5ba220){return BPromise[_0xf4e8('0x9c')]()[_0xf4e8('0x2e')](function(){if(!_0x1d7be7[_0xf4e8('0x3d')]['path']){throw new Error(_0xf4e8('0x9d'));}if(!_0x1d7be7[_0xf4e8('0x3d')][_0xf4e8('0x9e')]){throw new Error(_0xf4e8('0x9f'));}var _0x14926b=_0x1d7be7[_0xf4e8('0x3d')][_0xf4e8('0xa0')]?_0x1d7be7[_0xf4e8('0x3d')]['hostname']+':'+_0x1d7be7[_0xf4e8('0x3d')][_0xf4e8('0x9e')]:_0xf4e8('0xa1')+_0x1d7be7[_0xf4e8('0x3d')][_0xf4e8('0x9e')];var _0x3e38b6=_0x1d7be7[_0xf4e8('0x3d')]['json']?_0x1d7be7['query'][_0xf4e8('0x24')]:!![];var _0x36c84b=_0x1d7be7[_0xf4e8('0x3d')][_0xf4e8('0xa2')]?_0x1d7be7[_0xf4e8('0x3d')][_0xf4e8('0xa2')]:null;var _0xe6497c={'method':_0x1d7be7[_0xf4e8('0xa3')],'uri':util[_0xf4e8('0x58')](_0xf4e8('0xa4'),_0x14926b,_0x1d7be7[_0xf4e8('0x3d')][_0xf4e8('0x7')]),'json':_0x3e38b6,'resolveWithFullResponse':!![],'encoding':_0x36c84b,'qs':_0x1d7be7['query']};if(_0x1d7be7[_0xf4e8('0xa5')]){_0xe6497c[_0xf4e8('0xa5')]=_0x1d7be7[_0xf4e8('0xa5')];if(_0xe6497c['headers'][_0xf4e8('0xa6')]){delete _0xe6497c[_0xf4e8('0xa5')][_0xf4e8('0xa6')];}}if(_0xe6497c[_0xf4e8('0xa5')]['content-type']){delete _0xe6497c[_0xf4e8('0xa5')]['content-type'];}return rp(_0xe6497c);})[_0xf4e8('0x2e')](function(_0x1e31c7){if(_0x1e31c7){_0x3417d9['set'](_0x1e31c7['headers']);logger['info'](_0x1e31c7[_0xf4e8('0x99')]);if(_['endsWith'](_0x1d7be7[_0xf4e8('0x3d')][_0xf4e8('0x7')],_0xf4e8('0x55'))&&_0x1e31c7[_0xf4e8('0xa7')]==0x1f4){return _0x3417d9['sendStatus'](_0x1e31c7[_0xf4e8('0xa7')]);}else{return _0x3417d9[_0xf4e8('0x22')](_0x1e31c7[_0xf4e8('0xa7')])[_0xf4e8('0x34')](_0x1e31c7[_0xf4e8('0x99')]);}}else{return _0x3417d9['sendStatus'](0xc8);}})[_0xf4e8('0x50')](handleError(_0x3417d9,null));};exports[_0xf4e8('0xa8')]=function(_0x340f88,_0x161d28,_0x514902){return BPromise[_0xf4e8('0x9c')]()['then'](function(){if(!_0x340f88[_0xf4e8('0x3d')][_0xf4e8('0x7')]){throw new Error(_0xf4e8('0x9d'));}if(!_0x340f88[_0xf4e8('0x3d')]['port']){throw new Error(_0xf4e8('0x9f'));}var _0x6791ff=_0x340f88[_0xf4e8('0x3d')][_0xf4e8('0xa0')]?_0x340f88[_0xf4e8('0x3d')][_0xf4e8('0xa0')]+':'+_0x340f88[_0xf4e8('0x3d')][_0xf4e8('0x9e')]:'http://localhost:'+_0x340f88['query'][_0xf4e8('0x9e')];var _0x2edc27=_0x340f88['query'][_0xf4e8('0x24')]?_0x340f88[_0xf4e8('0x3d')][_0xf4e8('0x24')]:!![];var _0x251f6a=_0x340f88[_0xf4e8('0x3d')][_0xf4e8('0xa2')]?_0x340f88[_0xf4e8('0x3d')][_0xf4e8('0xa2')]:null;var _0x34097e={'method':_0x340f88[_0xf4e8('0xa3')],'uri':util[_0xf4e8('0x58')](_0xf4e8('0xa4'),_0x6791ff,_0x340f88[_0xf4e8('0x3d')]['path']),'json':_0x2edc27,'resolveWithFullResponse':!![],'encoding':_0x251f6a,'body':_0x340f88[_0xf4e8('0x99')]};if(_0x340f88['headers']){_0x34097e['headers']=_0x340f88[_0xf4e8('0xa5')];if(_0x34097e[_0xf4e8('0xa5')][_0xf4e8('0xa6')]){delete _0x34097e[_0xf4e8('0xa5')]['content-length'];}}if(_0x34097e[_0xf4e8('0xa5')][_0xf4e8('0xa9')]){delete _0x34097e[_0xf4e8('0xa5')][_0xf4e8('0xa9')];}return rp(_0x34097e);})['then'](function(_0x46b54c){if(_0x46b54c){_0x161d28[_0xf4e8('0x29')](_0x46b54c[_0xf4e8('0xa5')]);logger[_0xf4e8('0x69')](_0x46b54c[_0xf4e8('0x99')]);return _0x161d28[_0xf4e8('0x22')](_0x46b54c[_0xf4e8('0xa7')])[_0xf4e8('0x34')](_0x46b54c[_0xf4e8('0x99')]);}else{return _0x161d28['sendStatus'](0xc8);}})['catch'](handleError(_0x161d28,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index a342c4d..3bf7dca 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 _0x29af=['update','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','save'];(function(_0x8a2ad9,_0x1e1ccf){var _0x384b31=function(_0x1e6d9a){while(--_0x1e6d9a){_0x8a2ad9['push'](_0x8a2ad9['shift']());}};_0x384b31(++_0x1e1ccf);}(_0x29af,0x134));var _0xf29a=function(_0x5c790b,_0x1c6e09){_0x5c790b=_0x5c790b-0x0;var _0x1e3bad=_0x29af[_0x5c790b];return _0x1e3bad;};'use strict';var EventEmitter=require(_0xf29a('0x0'));var Plugin=require(_0xf29a('0x1'))['db'][_0xf29a('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf29a('0x3'),'afterUpdate':_0xf29a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x40ab34){return function(_0x505d15,_0x37e156,_0xf7f92e){PluginEvents['emit'](_0x40ab34+':'+_0x505d15['id'],_0x505d15);PluginEvents['emit'](_0x40ab34,_0x505d15);_0xf7f92e(null);};}for(var e in events){if(events[_0xf29a('0x5')](e)){var event=events[e];Plugin[_0xf29a('0x6')](e,emitEvent(event));}}module[_0xf29a('0x7')]=PluginEvents; \ No newline at end of file +var _0xe944=['events','setMaxListeners','remove','emit','hook','exports'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xe944,0x174));var _0x4e94=function(_0x52d430,_0x9a490b){_0x52d430=_0x52d430-0x0;var _0x171b9a=_0xe944[_0x52d430];return _0x171b9a;};'use strict';var EventEmitter=require(_0x4e94('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x4e94('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4e94('0x2')};function emitEvent(_0x4d19d3){return function(_0x4edb6f,_0x10029f,_0xe47674){PluginEvents[_0x4e94('0x3')](_0x4d19d3+':'+_0x4edb6f['id'],_0x4edb6f);PluginEvents[_0x4e94('0x3')](_0x4d19d3,_0x4edb6f);_0xe47674(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x4e94('0x4')](e,emitEvent(event));}}module[_0x4e94('0x5')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index f2d9104..fbad9d5 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 _0xee74=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','util'];(function(_0x4be053,_0x3a3e7c){var _0x2248db=function(_0x52938f){while(--_0x52938f){_0x4be053['push'](_0x4be053['shift']());}};_0x2248db(++_0x3a3e7c);}(_0xee74,0x1eb));var _0x4ee7=function(_0x2edea9,_0x469002){_0x2edea9=_0x2edea9-0x0;var _0x1bc108=_0xee74[_0x2edea9];return _0x1bc108;};'use strict';var _=require('lodash');var util=require(_0x4ee7('0x0'));var logger=require(_0x4ee7('0x1'))(_0x4ee7('0x2'));var moment=require(_0x4ee7('0x3'));var BPromise=require(_0x4ee7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ee7('0x5'));var rimraf=require(_0x4ee7('0x6'));var config=require(_0x4ee7('0x7'));var attributes=require(_0x4ee7('0x8'));module['exports']=function(_0x209edb,_0x3c2846){return _0x209edb[_0x4ee7('0x9')](_0x4ee7('0xa'),attributes,{'tableName':_0x4ee7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3ef=['rimraf','../../config/environment','define','Plugin','plugins','lodash','api','moment','request-promise','path'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xf3ef,0x18b));var _0xff3e=function(_0x22ee53,_0x551665){_0x22ee53=_0x22ee53-0x0;var _0x2aae96=_0xf3ef[_0x22ee53];return _0x2aae96;};'use strict';var _=require(_0xff3e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xff3e('0x1'));var moment=require(_0xff3e('0x2'));var BPromise=require('bluebird');var rp=require(_0xff3e('0x3'));var fs=require('fs');var path=require(_0xff3e('0x4'));var rimraf=require(_0xff3e('0x5'));var config=require(_0xff3e('0x6'));var attributes=require('./plugin.attributes');module['exports']=function(_0x5b8a2d,_0x2821a3){return _0x5b8a2d[_0xff3e('0x7')](_0xff3e('0x8'),attributes,{'tableName':_0xff3e('0x9'),'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 c8d5ff6..89f5d66 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 _0xad00=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreatePlugin','Plugin','body','options','raw','stringify','lodash','util','moment'];(function(_0x2428b0,_0x5c2f9d){var _0xfeb360=function(_0x2ff210){while(--_0x2ff210){_0x2428b0['push'](_0x2428b0['shift']());}};_0xfeb360(++_0x5c2f9d);}(_0xad00,0x195));var _0x0ad0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xad00[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0ad0('0x0'));var util=require(_0x0ad0('0x1'));var moment=require(_0x0ad0('0x2'));var BPromise=require(_0x0ad0('0x3'));var rs=require(_0x0ad0('0x4'));var fs=require('fs');var Redis=require(_0x0ad0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ad0('0x6'));var logger=require(_0x0ad0('0x7'))(_0x0ad0('0x8'));var config=require('../../config/environment');var jayson=require(_0x0ad0('0x9'));var client=jayson[_0x0ad0('0xa')][_0x0ad0('0xb')]({'port':0x232a});config[_0x0ad0('0xc')]=_[_0x0ad0('0xd')](config[_0x0ad0('0xc')],{'host':_0x0ad0('0xe'),'port':0x18eb});var socket=require(_0x0ad0('0xf'))(new Redis(config[_0x0ad0('0xc')]));require(_0x0ad0('0x10'))['register'](socket);function respondWithRpcPromise(_0x2f95aa,_0x3afab0,_0x51e030){return new BPromise(function(_0x1ce023,_0x329d96){return client[_0x0ad0('0x11')](_0x2f95aa,_0x51e030)[_0x0ad0('0x12')](function(_0x266615){logger[_0x0ad0('0x13')](_0x0ad0('0x14'),_0x3afab0,_0x0ad0('0x15'));logger[_0x0ad0('0x16')](_0x0ad0('0x17'),_0x3afab0,'request\x20sent',JSON['stringify'](_0x266615));if(_0x266615[_0x0ad0('0x18')]){if(_0x266615[_0x0ad0('0x18')][_0x0ad0('0x19')]===0x1f4){logger[_0x0ad0('0x18')](_0x0ad0('0x14'),_0x3afab0,_0x266615['error'][_0x0ad0('0x1a')]);return _0x329d96(_0x266615[_0x0ad0('0x18')]['message']);}logger[_0x0ad0('0x18')]('Plugin,\x20%s,\x20%s',_0x3afab0,_0x266615['error'][_0x0ad0('0x1a')]);return _0x1ce023(_0x266615[_0x0ad0('0x18')][_0x0ad0('0x1a')]);}else{logger[_0x0ad0('0x13')](_0x0ad0('0x14'),_0x3afab0,_0x0ad0('0x15'));_0x1ce023(_0x266615['result']['message']);}})[_0x0ad0('0x1b')](function(_0x405977){logger[_0x0ad0('0x18')](_0x0ad0('0x14'),_0x3afab0,_0x405977);_0x329d96(_0x405977);});});}exports[_0x0ad0('0x1c')]=function(_0x1a5f70){var _0x17de58=this;return new Promise(function(_0x14743a,_0x11a8ce){return db[_0x0ad0('0x1d')]['create'](_0x1a5f70[_0x0ad0('0x1e')],{'raw':_0x1a5f70['options']?_0x1a5f70[_0x0ad0('0x1f')][_0x0ad0('0x20')]===undefined?!![]:![]:!![]})[_0x0ad0('0x12')](function(_0x545dd0){logger[_0x0ad0('0x13')]('CreatePlugin',_0x1a5f70);logger[_0x0ad0('0x16')](_0x0ad0('0x1c'),_0x1a5f70,JSON[_0x0ad0('0x21')](_0x545dd0));_0x14743a(_0x545dd0);})[_0x0ad0('0x1b')](function(_0x25a6da){logger['error']('CreatePlugin',_0x25a6da[_0x0ad0('0x1a')],_0x1a5f70);_0x11a8ce(_0x17de58[_0x0ad0('0x18')](0x1f4,_0x25a6da[_0x0ad0('0x1a')]));});});}; \ No newline at end of file +var _0x7f97=['request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','body','options','raw','debug','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s'];(function(_0xd32b55,_0x1b2696){var _0x5b86fd=function(_0x3a667a){while(--_0x3a667a){_0xd32b55['push'](_0xd32b55['shift']());}};_0x5b86fd(++_0x1b2696);}(_0x7f97,0x157));var _0x77f9=function(_0x36bccc,_0x2790f5){_0x36bccc=_0x36bccc-0x0;var _0x5a83bd=_0x7f97[_0x36bccc];return _0x5a83bd;};'use strict';var _=require('lodash');var util=require(_0x77f9('0x0'));var moment=require(_0x77f9('0x1'));var BPromise=require('bluebird');var rs=require(_0x77f9('0x2'));var fs=require('fs');var Redis=require(_0x77f9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x77f9('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x77f9('0x5'));var jayson=require(_0x77f9('0x6'));var client=jayson['client'][_0x77f9('0x7')]({'port':0x232a});config[_0x77f9('0x8')]=_[_0x77f9('0x9')](config[_0x77f9('0x8')],{'host':_0x77f9('0xa'),'port':0x18eb});var socket=require(_0x77f9('0xb'))(new Redis(config[_0x77f9('0x8')]));require(_0x77f9('0xc'))[_0x77f9('0xd')](socket);function respondWithRpcPromise(_0x36f9b9,_0x4b73a7,_0x2590cd){return new BPromise(function(_0x1542fa,_0x353032){return client['request'](_0x36f9b9,_0x2590cd)[_0x77f9('0xe')](function(_0x22e2a2){logger[_0x77f9('0xf')](_0x77f9('0x10'),_0x4b73a7,_0x77f9('0x11'));logger['debug'](_0x77f9('0x12'),_0x4b73a7,_0x77f9('0x11'),JSON[_0x77f9('0x13')](_0x22e2a2));if(_0x22e2a2[_0x77f9('0x14')]){if(_0x22e2a2['error'][_0x77f9('0x15')]===0x1f4){logger[_0x77f9('0x14')]('Plugin,\x20%s,\x20%s',_0x4b73a7,_0x22e2a2[_0x77f9('0x14')][_0x77f9('0x16')]);return _0x353032(_0x22e2a2[_0x77f9('0x14')][_0x77f9('0x16')]);}logger[_0x77f9('0x14')](_0x77f9('0x10'),_0x4b73a7,_0x22e2a2[_0x77f9('0x14')][_0x77f9('0x16')]);return _0x1542fa(_0x22e2a2[_0x77f9('0x14')][_0x77f9('0x16')]);}else{logger[_0x77f9('0xf')](_0x77f9('0x10'),_0x4b73a7,_0x77f9('0x11'));_0x1542fa(_0x22e2a2[_0x77f9('0x17')][_0x77f9('0x16')]);}})[_0x77f9('0x18')](function(_0x44e268){logger[_0x77f9('0x14')](_0x77f9('0x10'),_0x4b73a7,_0x44e268);_0x353032(_0x44e268);});});}exports[_0x77f9('0x19')]=function(_0x25b251){var _0x45dbc3=this;return new Promise(function(_0x47b0e8,_0x4a9150){return db['Plugin']['create'](_0x25b251[_0x77f9('0x1a')],{'raw':_0x25b251['options']?_0x25b251[_0x77f9('0x1b')][_0x77f9('0x1c')]===undefined?!![]:![]:!![]})[_0x77f9('0xe')](function(_0x3ec0e0){logger[_0x77f9('0xf')](_0x77f9('0x19'),_0x25b251);logger[_0x77f9('0x1d')](_0x77f9('0x19'),_0x25b251,JSON[_0x77f9('0x13')](_0x3ec0e0));_0x47b0e8(_0x3ec0e0);})[_0x77f9('0x18')](function(_0x1b512e){logger['error']('CreatePlugin',_0x1b512e[_0x77f9('0x16')],_0x25b251);_0x4a9150(_0x45dbc3[_0x77f9('0x14')](0x1f4,_0x1b512e[_0x77f9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 2bef363..5273dca 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 _0x5403=['register','length','plugin:','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x55fa03,_0xcb96c2){var _0x2cd7cd=function(_0x56611f){while(--_0x56611f){_0x55fa03['push'](_0x55fa03['shift']());}};_0x2cd7cd(++_0xcb96c2);}(_0x5403,0xf6));var _0x3540=function(_0x38b4d1,_0x2f33f6){_0x38b4d1=_0x38b4d1-0x0;var _0x40dfba=_0x5403[_0x38b4d1];return _0x40dfba;};'use strict';var PluginEvents=require(_0x3540('0x0'));var events=[_0x3540('0x1'),_0x3540('0x2'),_0x3540('0x3')];function createListener(_0x4773f3,_0x1629f1){return function(_0x2755e0){_0x1629f1[_0x3540('0x4')](_0x4773f3,_0x2755e0);};}function removeListener(_0x54b495,_0x6a94a7){return function(){PluginEvents[_0x3540('0x5')](_0x54b495,_0x6a94a7);};}exports[_0x3540('0x6')]=function(_0xaf556){for(var _0x5944e4=0x0,_0x44664e=events[_0x3540('0x7')];_0x5944e4<_0x44664e;_0x5944e4++){var _0x39d76b=events[_0x5944e4];var _0x4319e0=createListener(_0x3540('0x8')+_0x39d76b,_0xaf556);PluginEvents['on'](_0x39d76b,_0x4319e0);}}; \ No newline at end of file +var _0xfd3e=['remove','update','emit','removeListener','length','./plugin.events','save'];(function(_0x543a11,_0x1fd623){var _0x8c8c90=function(_0x599732){while(--_0x599732){_0x543a11['push'](_0x543a11['shift']());}};_0x8c8c90(++_0x1fd623);}(_0xfd3e,0x1d3));var _0xefd3=function(_0x45586f,_0x113385){_0x45586f=_0x45586f-0x0;var _0x328b29=_0xfd3e[_0x45586f];return _0x328b29;};'use strict';var PluginEvents=require(_0xefd3('0x0'));var events=[_0xefd3('0x1'),_0xefd3('0x2'),_0xefd3('0x3')];function createListener(_0x2b5f2c,_0x99ab19){return function(_0x82786a){_0x99ab19[_0xefd3('0x4')](_0x2b5f2c,_0x82786a);};}function removeListener(_0x38a801,_0x49d92a){return function(){PluginEvents[_0xefd3('0x5')](_0x38a801,_0x49d92a);};}exports['register']=function(_0x46f45d){for(var _0x247fd3=0x0,_0x2dc42a=events[_0xefd3('0x6')];_0x247fd3<_0x2dc42a;_0x247fd3++){var _0x28ba31=events[_0x247fd3];var _0x53ebff=createListener('plugin:'+_0x28ba31,_0x46f45d);PluginEvents['on'](_0x28ba31,_0x53ebff);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index b8321d1..164ba8d 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(_0x175602,_0x2300d7){var _0x4a0c2f=function(_0x36ddd9){while(--_0x36ddd9){_0x175602['push'](_0x175602['shift']());}};_0x4a0c2f(++_0x2300d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x367eb3,_0x1da777){var _0x13d9c4=function(_0x4af613){while(--_0x4af613){_0x367eb3['push'](_0x367eb3['shift']());}};_0x13d9c4(++_0x1da777);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 2a5a64a..a31c27a 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 _0x750a=['restart','stop','Unknown\x20status','delete','Unknown\x20id','../../config/pm2','path','child_process','exec','bluebird','sendStatus','status','json','stack','name','send','npm\x20install','info','error','index','list','then','reject','express','length','describe','params','body','../../files/plugins','chdir','start','dump','catch','Missing\x20name\x20and/or\x20path','update'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x750a,0x140));var _0xa750=function(_0x48b454,_0xafeae){_0x48b454=_0x48b454-0x0;var _0x521cb4=_0x750a[_0x48b454];return _0x521cb4;};'use strict';var _=require('lodash');var pm2=require(_0xa750('0x0'));var logger=require('../../config/logger')('api');var path=require(_0xa750('0x1'));var exec=require(_0xa750('0x2'))[_0xa750('0x3')];var BPromise=require(_0xa750('0x4'));function handleEntityNotFound(_0x457cae,_0x43d704){return function(_0x562911){if(!_0x562911){_0x457cae[_0xa750('0x5')](0x194);;}return _0x562911;};}function respondWithResult(_0x10b4d9,_0x2497df){_0x2497df=_0x2497df||0xc8;return function(_0x197299){if(_0x197299){return _0x10b4d9[_0xa750('0x6')](_0x2497df)[_0xa750('0x7')](_0x197299);}return null;};}function handleError(_0x47a4dd,_0x53f2cb){_0x53f2cb=_0x53f2cb||0x1f4;return function(_0x2678ff){logger['error'](_0x2678ff[_0xa750('0x8')]);if(_0x2678ff[_0xa750('0x9')]){delete _0x2678ff['name'];}_0x47a4dd[_0xa750('0x6')](_0x53f2cb)[_0xa750('0xa')](_0x2678ff);};}function execChildProcess(){return new BPromise(function(_0x5870f0,_0x5aca9c){exec(_0xa750('0xb'),function(_0x4b19a1,_0x174fd0,_0x5adaae){logger['info'](_0x174fd0);logger[_0xa750('0xc')](_0x5adaae);if(_0x4b19a1){logger[_0xa750('0xd')](_0x4b19a1);return _0x5aca9c(_0x4b19a1);}return _0x5870f0(_0x174fd0);});});}exports[_0xa750('0xe')]=function(_0x567c51,_0x2f670f){return pm2[_0xa750('0xf')]()[_0xa750('0x10')](function(_0x24e48a){if(_0x24e48a){var _0xa66181=_[_0xa750('0x11')](_0x24e48a,function(_0x5806ed){return _0x5806ed[_0xa750('0x9')]===_0xa750('0x12')||_0x5806ed[_0xa750('0x9')]==='motion2';});return{'rows':_0xa66181,'count':_0xa66181[_0xa750('0x13')]};}return null;})[_0xa750('0x10')](respondWithResult(_0x2f670f,null))['catch'](handleError(_0x2f670f,null));};exports['show']=function(_0x321eb2,_0x5b1e6b){return pm2[_0xa750('0x14')](_0x321eb2[_0xa750('0x15')]['id'])['then'](respondWithResult(_0x5b1e6b,null))[_0xa750('0x10')](handleEntityNotFound(_0x5b1e6b,null))['catch'](handleError(_0x5b1e6b,null));};exports['create']=function(_0x25e335,_0x5d0935){if(_0x25e335[_0xa750('0x16')]['name']&&_0x25e335[_0xa750('0x16')]['script']){var _0x3dc7f1=path['join'](__dirname,_0xa750('0x17'),_0x25e335['body']['script']);var _0xaa9d3e=process['cwd']();process[_0xa750('0x18')](path['dirname'](_0x3dc7f1));return execChildProcess()['then'](function(_0x5b433d){process['chdir'](_0xaa9d3e);return pm2[_0xa750('0x19')]({'name':_0x25e335[_0xa750('0x16')][_0xa750('0x9')],'script':_0x3dc7f1});})[_0xa750('0x10')](function(_0x1b80a5){pm2[_0xa750('0x1a')]();return _0x1b80a5[0x0];})[_0xa750('0x10')](respondWithResult(_0x5d0935,0xc9))[_0xa750('0x1b')](handleError(_0x5d0935,null));}else{return _0x5d0935[_0xa750('0x6')](0x1f4)[_0xa750('0xa')]({'message':_0xa750('0x1c')});}};exports[_0xa750('0x1d')]=function(_0x31ea63,_0x3f7d6d){if(_0x31ea63[_0xa750('0x16')]['id']){delete _0x31ea63['body']['id'];}var _0x3d3923={'online':_0xa750('0x1e'),'stopped':_0xa750('0x1f')};if(_0x3d3923['hasOwnProperty'](_0x31ea63[_0xa750('0x16')][_0xa750('0x6')])){return pm2[_0x3d3923[_0x31ea63[_0xa750('0x16')][_0xa750('0x6')]]](_0x31ea63['params']['id'])[_0xa750('0x10')](respondWithResult(_0x3f7d6d,0xc8))[_0xa750('0x1b')](handleError(_0x3f7d6d,null));}else{return _0x3f7d6d[_0xa750('0x6')](0x1f4)[_0xa750('0xa')]({'message':_0xa750('0x20')});}};exports['destroy']=function(_0x46cc11,_0x4c2c9e){if(_0x46cc11[_0xa750('0x16')]['id']){delete _0x46cc11[_0xa750('0x16')]['id'];}if(_0x46cc11['params']['id']){return pm2[_0xa750('0x21')](_0x46cc11[_0xa750('0x15')]['id'])[_0xa750('0x10')](function(_0x314f88){pm2[_0xa750('0x1a')]();return _0x314f88[0x0];})[_0xa750('0x10')](respondWithResult(_0x4c2c9e,null))[_0xa750('0x1b')](handleError(_0x4c2c9e,null));}else{return _0x4c2c9e[_0xa750('0x6')](0x1f4)['send']({'message':_0xa750('0x22')});}}; \ No newline at end of file +var _0xaa88=['../../config/pm2','../../config/logger','api','child_process','exec','bluebird','status','json','error','stack','name','send','info','list','express','motion2','length','then','catch','show','describe','create','body','script','join','../../files/plugins','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xaa88,0x137));var _0x8aa8=function(_0x12c280,_0x51dd07){_0x12c280=_0x12c280-0x0;var _0x3638d3=_0xaa88[_0x12c280];return _0x3638d3;};'use strict';var _=require(_0x8aa8('0x0'));var pm2=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var path=require('path');var exec=require(_0x8aa8('0x4'))[_0x8aa8('0x5')];var BPromise=require(_0x8aa8('0x6'));function handleEntityNotFound(_0x3b2c88,_0x3e3b70){return function(_0x350e8b){if(!_0x350e8b){_0x3b2c88['sendStatus'](0x194);;}return _0x350e8b;};}function respondWithResult(_0x5bda0d,_0x460042){_0x460042=_0x460042||0xc8;return function(_0x5264ff){if(_0x5264ff){return _0x5bda0d[_0x8aa8('0x7')](_0x460042)[_0x8aa8('0x8')](_0x5264ff);}return null;};}function handleError(_0x27c08d,_0x40826f){_0x40826f=_0x40826f||0x1f4;return function(_0x4adfb9){logger[_0x8aa8('0x9')](_0x4adfb9[_0x8aa8('0xa')]);if(_0x4adfb9[_0x8aa8('0xb')]){delete _0x4adfb9['name'];}_0x27c08d[_0x8aa8('0x7')](_0x40826f)[_0x8aa8('0xc')](_0x4adfb9);};}function execChildProcess(){return new BPromise(function(_0x357e05,_0x33cc5c){exec('npm\x20install',function(_0x3f8100,_0x30c114,_0x50787d){logger[_0x8aa8('0xd')](_0x30c114);logger[_0x8aa8('0xd')](_0x50787d);if(_0x3f8100){logger[_0x8aa8('0x9')](_0x3f8100);return _0x33cc5c(_0x3f8100);}return _0x357e05(_0x30c114);});});}exports['index']=function(_0x3b9f74,_0x179e33){return pm2[_0x8aa8('0xe')]()['then'](function(_0x391642){if(_0x391642){var _0x4af534=_['reject'](_0x391642,function(_0x433e95){return _0x433e95[_0x8aa8('0xb')]===_0x8aa8('0xf')||_0x433e95[_0x8aa8('0xb')]===_0x8aa8('0x10');});return{'rows':_0x4af534,'count':_0x4af534[_0x8aa8('0x11')]};}return null;})[_0x8aa8('0x12')](respondWithResult(_0x179e33,null))[_0x8aa8('0x13')](handleError(_0x179e33,null));};exports[_0x8aa8('0x14')]=function(_0x4e8ce3,_0x4843f5){return pm2[_0x8aa8('0x15')](_0x4e8ce3['params']['id'])['then'](respondWithResult(_0x4843f5,null))[_0x8aa8('0x12')](handleEntityNotFound(_0x4843f5,null))['catch'](handleError(_0x4843f5,null));};exports[_0x8aa8('0x16')]=function(_0x41092b,_0x2a9f56){if(_0x41092b[_0x8aa8('0x17')]['name']&&_0x41092b[_0x8aa8('0x17')][_0x8aa8('0x18')]){var _0x2825fd=path[_0x8aa8('0x19')](__dirname,_0x8aa8('0x1a'),_0x41092b[_0x8aa8('0x17')]['script']);var _0x26cf63=process['cwd']();process[_0x8aa8('0x1b')](path['dirname'](_0x2825fd));return execChildProcess()[_0x8aa8('0x12')](function(_0x557e4e){process[_0x8aa8('0x1b')](_0x26cf63);return pm2[_0x8aa8('0x1c')]({'name':_0x41092b[_0x8aa8('0x17')]['name'],'script':_0x2825fd});})[_0x8aa8('0x12')](function(_0xe978ab){pm2[_0x8aa8('0x1d')]();return _0xe978ab[0x0];})['then'](respondWithResult(_0x2a9f56,0xc9))['catch'](handleError(_0x2a9f56,null));}else{return _0x2a9f56[_0x8aa8('0x7')](0x1f4)[_0x8aa8('0xc')]({'message':_0x8aa8('0x1e')});}};exports[_0x8aa8('0x1f')]=function(_0x24143e,_0x4a8212){if(_0x24143e[_0x8aa8('0x17')]['id']){delete _0x24143e['body']['id'];}var _0x2a0ff2={'online':_0x8aa8('0x20'),'stopped':_0x8aa8('0x21')};if(_0x2a0ff2['hasOwnProperty'](_0x24143e['body'][_0x8aa8('0x7')])){return pm2[_0x2a0ff2[_0x24143e['body'][_0x8aa8('0x7')]]](_0x24143e[_0x8aa8('0x22')]['id'])[_0x8aa8('0x12')](respondWithResult(_0x4a8212,0xc8))[_0x8aa8('0x13')](handleError(_0x4a8212,null));}else{return _0x4a8212[_0x8aa8('0x7')](0x1f4)['send']({'message':_0x8aa8('0x23')});}};exports[_0x8aa8('0x24')]=function(_0x4b67f5,_0x99f74e){if(_0x4b67f5[_0x8aa8('0x17')]['id']){delete _0x4b67f5[_0x8aa8('0x17')]['id'];}if(_0x4b67f5['params']['id']){return pm2[_0x8aa8('0x25')](_0x4b67f5[_0x8aa8('0x22')]['id'])[_0x8aa8('0x12')](function(_0x423b02){pm2[_0x8aa8('0x1d')]();return _0x423b02[0x0];})[_0x8aa8('0x12')](respondWithResult(_0x99f74e,null))[_0x8aa8('0x13')](handleError(_0x99f74e,null));}else{return _0x99f74e[_0x8aa8('0x7')](0x1f4)[_0x8aa8('0xc')]({'message':_0x8aa8('0x26')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 9d1b0ef..e74a224 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 _0x7e24=['get','/agents','isAuthenticated','getAgents','/queues','getQueues','exports','express','./realtime.controller'];(function(_0xcc9893,_0x53434c){var _0x34d13c=function(_0x514064){while(--_0x514064){_0xcc9893['push'](_0xcc9893['shift']());}};_0x34d13c(++_0x53434c);}(_0x7e24,0x115));var _0x47e2=function(_0x2d2a10,_0x537374){_0x2d2a10=_0x2d2a10-0x0;var _0x2234be=_0x7e24[_0x2d2a10];return _0x2234be;};'use strict';var express=require(_0x47e2('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x47e2('0x1'));router[_0x47e2('0x2')](_0x47e2('0x3'),auth[_0x47e2('0x4')](),controller[_0x47e2('0x5')]);router[_0x47e2('0x2')](_0x47e2('0x6'),auth[_0x47e2('0x4')](),controller[_0x47e2('0x7')]);module[_0x47e2('0x8')]=router; \ No newline at end of file +var _0xb90e=['../../components/auth/service','./realtime.controller','get','isAuthenticated','/queues','exports','express','Router'];(function(_0x2ac089,_0x535c56){var _0x379229=function(_0x410107){while(--_0x410107){_0x2ac089['push'](_0x2ac089['shift']());}};_0x379229(++_0x535c56);}(_0xb90e,0x14e));var _0xeb90=function(_0x49be68,_0x5be605){_0x49be68=_0x49be68-0x0;var _0x364f32=_0xb90e[_0x49be68];return _0x364f32;};'use strict';var express=require(_0xeb90('0x0'));var router=express[_0xeb90('0x1')]();var auth=require(_0xeb90('0x2'));var controller=require(_0xeb90('0x3'));router[_0xeb90('0x4')]('/agents',auth[_0xeb90('0x5')](),controller['getAgents']);router['get'](_0xeb90('0x6'),auth[_0xeb90('0x5')](),controller['getQueues']);module[_0xeb90('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index b6672da..60a384b 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 _0xb964=['filter','getResources','findAndCountAll','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','APIBadRequestError','../../errors/api','handleError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','join','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','fieldName','type','key','getOptions','raw','push','sequelize','literal','FIELD(id,','order','forEach','Pause','where','merge','user','role','userProfileId','Agents','online','extraQueryConditions','assign','omit','UserProfile','find','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','resolve','startCase','Queue','rawAttributes','fields','name','outbound','dialMethod','QueueCampaigns','Queues'];(function(_0xde0f41,_0x13fd4f){var _0x3c1fbf=function(_0x7d298f){while(--_0x7d298f){_0xde0f41['push'](_0xde0f41['shift']());}};_0x3c1fbf(++_0x13fd4f);}(_0xb964,0x11b));var _0x4b96=function(_0x21e2d1,_0x448e85){_0x21e2d1=_0x21e2d1-0x0;var _0x37f2e1=_0xb964[_0x21e2d1];return _0x37f2e1;};'use strict';var _=require(_0x4b96('0x0'));var util=require(_0x4b96('0x1'));var rta=require(_0x4b96('0x2'));var rtq=require(_0x4b96('0x3'));var qs=require(_0x4b96('0x4'));var utils=require(_0x4b96('0x5'));var db=require(_0x4b96('0x6'))['db'];var APIBadRequestError=require('../../errors/api')[_0x4b96('0x7')];var APIHandleError=require(_0x4b96('0x8'))[_0x4b96('0x9')];function respondWithFilteredResult(_0x27c287,_0xe74ab6){return function(_0x4c7a80){if(_0x4c7a80){var _0x499d42=typeof _0xe74ab6[_0x4b96('0xa')]===_0x4b96('0xb')&&typeof _0xe74ab6[_0x4b96('0xc')]===_0x4b96('0xb');var _0x3acbb8=_0x4c7a80[_0x4b96('0xd')];var _0x5acf5c=_0x499d42?0x0:_0xe74ab6['offset'];var _0x4f5afb=_0x499d42?_0x4c7a80[_0x4b96('0xd')]:_0xe74ab6[_0x4b96('0xa')]+_0xe74ab6[_0x4b96('0xc')];var _0x4ca6ba;if(_0x4f5afb>=_0x3acbb8){_0x4f5afb=_0x3acbb8;_0x4ca6ba=0xc8;}else{_0x4ca6ba=0xce;}_0x27c287[_0x4b96('0xe')](_0x4ca6ba);return _0x27c287[_0x4b96('0xf')](_0x4b96('0x10'),_0x5acf5c+'-'+_0x4f5afb+'/'+_0x3acbb8)[_0x4b96('0x11')](_0x4c7a80);}return null;};}exports[_0x4b96('0x12')]=function(_0x3f8c51,_0x2c6f37){var _0x32b7be={'count':0x0,'rows':[]};var _0x5c7293={};var _0x33afdc;var _0x512b3d=utils[_0x4b96('0x13')]();var _0x533be3;var _0x474691;var _0x4a05fd=_0x3f8c51[_0x4b96('0x14')][_0x4b96('0x15')];var _0x448847=_0x3f8c51['query'][_0x4b96('0x16')];var _0x555d5b=_0x3f8c51[_0x4b96('0x14')][_0x4b96('0x17')];var _0x83f7c9=_0x448847===_0x4b96('0x18')||_0x448847===_0x4b96('0x19')?!![]:![];var _0x4dc4ed=[];var _0x371b5c;var _0x37dbca;Promise['resolve']()[_0x4b96('0x1a')](function(){if(_0x3f8c51['query'][_0x4b96('0x1b')]){if(!utils[_0x4b96('0x1c')](_0x3f8c51[_0x4b96('0x14')][_0x4b96('0x1b')])){throw new APIBadRequestError(util[_0x4b96('0x1d')](_0x4b96('0x1e'),_0x3f8c51[_0x4b96('0x14')]['channel']));}_0x33afdc=_0x3f8c51['query'][_0x4b96('0x1b')][_0x4b96('0x1f')]();}if(!_0x3f8c51[_0x4b96('0x14')][_0x4b96('0x20')]||!_0x3f8c51[_0x4b96('0x14')][_0x4b96('0x20')][_0x4b96('0x21')](_0x4b96('0x22'))){_0x3f8c51[_0x4b96('0x14')][_0x4b96('0x20')]=rta[_0x4b96('0x23')](_0x3f8c51['query'][_0x4b96('0x20')]);return;}var _0x4ab4b5=rta[_0x4b96('0x24')](_0x3f8c51[_0x4b96('0x14')]['sort']);_0x3f8c51[_0x4b96('0x14')][_0x4b96('0x20')]=_0x4ab4b5['fields'][_0x4b96('0x25')](',');_0x371b5c=_0x4ab4b5['order'];})[_0x4b96('0x1a')](function(){if(!_0x4a05fd){return[];}return rta[_0x4b96('0x26')](_0x4a05fd,_0x33afdc);})[_0x4b96('0x1a')](function(_0x1c1850){_0x4dc4ed=_0x1c1850;return rta[_0x4b96('0x27')]();})[_0x4b96('0x1a')](function(_0x80f3ea){_0x474691=_0x80f3ea[_0x4b96('0x28')];if((!_0x448847||_0x83f7c9)&&!_0x371b5c){return _0x4dc4ed;}if(_0x371b5c&&!_0x448847){return rta[_0x4b96('0x29')](_0x474691,_0x4dc4ed,_0x371b5c);}else{return rta[_0x4b96('0x2a')](_0x474691,_0x4dc4ed,_0x448847);}})[_0x4b96('0x1a')](function(_0xdff4d3){_0x4dc4ed=_0xdff4d3;var _0x53aa4d=![];if(_0x4dc4ed['length']===0x0){if(_0x4a05fd||_0x448847){_0x53aa4d=!![];}if(_0x83f7c9){_0x53aa4d=![];}}if(_0x53aa4d){return _0x32b7be;}var _0x1f3b97=_[_0x4b96('0x2b')](db[_0x4b96('0x2c')]['rawAttributes'],function(_0x1a5883){return{'name':_0x1a5883[_0x4b96('0x2d')],'type':_0x1a5883[_0x4b96('0x2e')][_0x4b96('0x2f')]};});_0x3f8c51[_0x4b96('0x14')]['role']='agent';_0x5c7293=qs[_0x4b96('0x30')](_0x1f3b97,_0x3f8c51);_0x5c7293[_0x4b96('0x31')]=!![];var _0x2b1fe4=[];if(_0x4dc4ed['length']>0x0){_0x2b1fe4[_0x4b96('0x32')]({'id':{'$in':_0x4dc4ed}});if(_0x371b5c&&!_0x448847){_0x37dbca=[db[_0x4b96('0x33')][_0x4b96('0x34')](_0x4b96('0x35')+_0x4dc4ed+')')];_0x5c7293[_0x4b96('0x36')]=_0x37dbca;}}if(_0x83f7c9){_0x512b3d[_0x4b96('0x37')](function(_0x4d17f4){var _0x337ffc=!![];if(_0x448847===_0x4b96('0x19')&&_0x33afdc!==_0x4d17f4){_0x337ffc=![];}_0x2b1fe4[_0x4b96('0x32')]({[_0x4d17f4+_0x4b96('0x38')]:_0x337ffc});});if(_0x555d5b){_0x2b1fe4['push']({'pauseType':_0x555d5b});}}else if(_0x448847){_0x512b3d[_0x4b96('0x37')](function(_0x655c61){_0x2b1fe4['push']({[_0x655c61+_0x4b96('0x38')]:![]});});}_0x5c7293[_0x4b96('0x39')]=_[_0x4b96('0x3a')](_0x5c7293[_0x4b96('0x39')],{'$and':_0x2b1fe4});if(_0x3f8c51[_0x4b96('0x3b')][_0x4b96('0x3c')]===_0x4b96('0x3b')){var _0x434259={'params':{'id':_0x3f8c51[_0x4b96('0x3b')][_0x4b96('0x3d')]},'query':{'section':_0x4b96('0x3e'),'role':'agent','raw':!![],'ids':_0x4dc4ed,'customSorting':_0x37dbca}};if(_0x3f8c51[_0x4b96('0x14')][_0x4b96('0x3f')]){_0x434259['query'][_0x4b96('0x3f')]=!![];}if(_0x83f7c9){_0x434259[_0x4b96('0x14')][_0x4b96('0x40')]=_0x2b1fe4;}_0x434259[_0x4b96('0x14')]=Object[_0x4b96('0x41')](_0x434259[_0x4b96('0x14')],_[_0x4b96('0x42')](_0x3f8c51[_0x4b96('0x14')],'id'));return db[_0x4b96('0x43')]['getResources'](_0x434259);}return db[_0x4b96('0x2c')]['findAndCountAll'](_0x5c7293);})[_0x4b96('0x1a')](function(_0x48b8b1){_0x32b7be['count']=_0x48b8b1[_0x4b96('0xd')];_0x533be3=_0x48b8b1[_0x4b96('0x28')];return _0x533be3[_0x4b96('0x2b')](function(_0x1a0125){var _0x2b547f=_[_0x4b96('0x44')](_0x474691,['id',_0x1a0125['id']]);if(_0x2b547f){var _0x59e3aa=rta['filterAgentAttributes'](_0x2b547f);_[_0x4b96('0x3a')](_0x1a0125,_0x59e3aa);}_0x1a0125[_0x4b96('0x22')]=rta[_0x4b96('0x45')](_0x1a0125);if(_0x1a0125[_0x4b96('0x22')]['includes'](_0x4b96('0x18'))){_0x512b3d[_0x4b96('0x37')](function(_0x5e8e67){if(_0x1a0125[_0x5e8e67+_0x4b96('0x38')]){if(_0x5e8e67===_0x4b96('0x46')){if(_0x1a0125[_0x4b96('0x47')]!==_0x4b96('0x48')){_0x1a0125[_0x4b96('0x47')]=_0x4b96('0x18');}}else{_0x1a0125[_0x5e8e67+_0x4b96('0x49')]=_0x4b96('0x18');}}});}return _0x1a0125;});})['then'](function(_0x23044d){if(!_0x371b5c||_0x37dbca){return _0x23044d;}return rta[_0x4b96('0x4a')](_0x23044d,_0x371b5c);})[_0x4b96('0x1a')](function(_0x182d6a){var _0x59215a=rta[_0x4b96('0x4b')]();_0x32b7be[_0x4b96('0x28')]=_0x182d6a['map'](function(_0x43f106){return _[_0x4b96('0x4c')](_0x43f106,_0x59215a);});return _0x32b7be;})[_0x4b96('0x1a')](respondWithFilteredResult(_0x2c6f37,_0x5c7293))[_0x4b96('0x4d')](APIHandleError(_0x2c6f37));};exports[_0x4b96('0x4e')]=function(_0x184f9b,_0x49cf86){var _0x598556={'count':0x0,'rows':[]};var _0x2af6e8={};var _0x44193b;var _0x44cd25;var _0x179493;Promise[_0x4b96('0x4f')]()[_0x4b96('0x1a')](function(){if(_0x184f9b[_0x4b96('0x14')][_0x4b96('0x1b')]){if(!utils[_0x4b96('0x1c')](_0x184f9b[_0x4b96('0x14')][_0x4b96('0x1b')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x184f9b[_0x4b96('0x14')][_0x4b96('0x1b')]));}_0x44193b=_0x184f9b[_0x4b96('0x14')][_0x4b96('0x1b')]['toLowerCase']();}var _0x158a67=_[_0x4b96('0x50')](_0x44193b)+_0x4b96('0x51');var _0x23faca=_[_0x4b96('0x2b')](db[_0x158a67][_0x4b96('0x52')],function(_0x1a2e4a){return{'name':_0x1a2e4a[_0x4b96('0x2d')],'type':_0x1a2e4a[_0x4b96('0x2e')][_0x4b96('0x2f')]};});if(!_0x184f9b['query'][_0x4b96('0x53')]){var _0x473fd6=['id',_0x4b96('0x54')];if(_0x44193b===_0x4b96('0x46')){_0x473fd6[_0x4b96('0x32')](_0x4b96('0x2e'));if(_0x184f9b[_0x4b96('0x14')][_0x4b96('0x2e')]===_0x4b96('0x55')){_0x473fd6[_0x4b96('0x32')](['dialActive',_0x4b96('0x56')]);}}_0x184f9b['query'][_0x4b96('0x53')]=_0x473fd6[_0x4b96('0x25')](',');}_0x2af6e8=qs[_0x4b96('0x30')](_0x23faca,_0x184f9b);if(_0x184f9b[_0x4b96('0x3b')][_0x4b96('0x3c')]===_0x4b96('0x3b')){var _0xb1508c={'params':{'id':_0x184f9b[_0x4b96('0x3b')][_0x4b96('0x3d')]},'query':{'section':_0x44193b===_0x4b96('0x46')&&_0x184f9b['query'][_0x4b96('0x2e')]==='outbound'?_0x4b96('0x57'):_[_0x4b96('0x50')](_0x44193b)+_0x4b96('0x58'),'type':_0x184f9b[_0x4b96('0x14')]['type'],'nolimit':!![],'sort':_0x4b96('0x54'),'filter':_0x184f9b[_0x4b96('0x14')][_0x4b96('0x59')]}};_0xb1508c[_0x4b96('0x14')]=Object[_0x4b96('0x41')](_0xb1508c[_0x4b96('0x14')],_0x184f9b[_0x4b96('0x14')]);delete _0xb1508c['query']['id'];return db[_0x4b96('0x43')][_0x4b96('0x5a')](_0xb1508c);}return db[_0x158a67][_0x4b96('0x5b')](_0x2af6e8);})[_0x4b96('0x1a')](function(_0x51a520){_0x598556[_0x4b96('0xd')]=_0x51a520['count'];_0x44cd25=_0x51a520['rows'];return rtq['getRealtimeQueues'](_0x184f9b,_0x44193b);})[_0x4b96('0x1a')](function(_0x5794da){_0x179493=_0x5794da['rows'];return rtq[_0x4b96('0x5c')](_0x44cd25,_0x179493,_0x44193b,_0x184f9b[_0x4b96('0x14')]['type']);})[_0x4b96('0x1a')](function(_0x4b11bc){_0x598556[_0x4b96('0x28')]=_0x4b11bc;return _0x598556;})['then'](respondWithFilteredResult(_0x49cf86,_0x2af6e8))['catch'](APIHandleError(_0x49cf86));}; \ No newline at end of file +var _0x5bcd=['Queues','filter','UserProfile','findAndCountAll','getRealtimeQueues','initializeQueues','util','../../components/realtime/queues','../../config/utils','../../errors/api','APIBadRequestError','handleError','undefined','limit','count','offset','status','set','Content-Range','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','pause','then','channel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','fieldName','type','key','role','agent','getOptions','raw','push','forEach','*pause','Pause','where','user','userProfileId','Agents','online','extraQueryConditions','assign','omit','getResources','find','filterAgentAttributes','merge','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','resolve','isValidChannel','format','startCase','Queue','rawAttributes','fields','name','outbound','dialMethod','QueueCampaigns'];(function(_0x57fd48,_0x1245ad){var _0x1efd64=function(_0x5d01db){while(--_0x5d01db){_0x57fd48['push'](_0x57fd48['shift']());}};_0x1efd64(++_0x1245ad);}(_0x5bcd,0x162));var _0xd5bc=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x5bcd[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require('lodash');var util=require(_0xd5bc('0x0'));var rta=require('../../components/realtime/agents');var rtq=require(_0xd5bc('0x1'));var qs=require('../../components/parsers/qs');var utils=require(_0xd5bc('0x2'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0xd5bc('0x3'))[_0xd5bc('0x4')];var APIHandleError=require(_0xd5bc('0x3'))[_0xd5bc('0x5')];function respondWithFilteredResult(_0x4c68ec,_0x4310e3){return function(_0x4a13ea){if(_0x4a13ea){var _0x599936=typeof _0x4310e3['offset']===_0xd5bc('0x6')&&typeof _0x4310e3[_0xd5bc('0x7')]===_0xd5bc('0x6');var _0x42793e=_0x4a13ea[_0xd5bc('0x8')];var _0x44e3d2=_0x599936?0x0:_0x4310e3[_0xd5bc('0x9')];var _0xc2973b=_0x599936?_0x4a13ea[_0xd5bc('0x8')]:_0x4310e3[_0xd5bc('0x9')]+_0x4310e3[_0xd5bc('0x7')];var _0x1fafb2;if(_0xc2973b>=_0x42793e){_0xc2973b=_0x42793e;_0x1fafb2=0xc8;}else{_0x1fafb2=0xce;}_0x4c68ec[_0xd5bc('0xa')](_0x1fafb2);return _0x4c68ec[_0xd5bc('0xb')](_0xd5bc('0xc'),_0x44e3d2+'-'+_0xc2973b+'/'+_0x42793e)[_0xd5bc('0xd')](_0x4a13ea);}return null;};}exports[_0xd5bc('0xe')]=function(_0x5b8dcf,_0x1dfd91){var _0x396136={'count':0x0,'rows':[]};var _0x1bf8db={};var _0xb6932d;var _0x177ded=utils[_0xd5bc('0xf')]();var _0x40960b;var _0x33e3ca;var _0x2a63ca=_0x5b8dcf['query']['globalQueueFilter'];var _0x2e7faa=_0x5b8dcf[_0xd5bc('0x10')][_0xd5bc('0x11')];var _0x1debc6=_0x5b8dcf[_0xd5bc('0x10')][_0xd5bc('0x12')];var _0x196be5=_0x2e7faa===_0xd5bc('0x13')||_0x2e7faa==='*pause'?!![]:![];var _0x13a5ae=[];var _0x4ee380;var _0x39cec1;Promise['resolve']()[_0xd5bc('0x14')](function(){if(_0x5b8dcf[_0xd5bc('0x10')][_0xd5bc('0x15')]){if(!utils['isValidChannel'](_0x5b8dcf[_0xd5bc('0x10')][_0xd5bc('0x15')])){throw new APIBadRequestError(util['format'](_0xd5bc('0x16'),_0x5b8dcf[_0xd5bc('0x10')][_0xd5bc('0x15')]));}_0xb6932d=_0x5b8dcf['query'][_0xd5bc('0x15')][_0xd5bc('0x17')]();}if(!_0x5b8dcf[_0xd5bc('0x10')][_0xd5bc('0x18')]||!_0x5b8dcf[_0xd5bc('0x10')][_0xd5bc('0x18')][_0xd5bc('0x19')](_0xd5bc('0x1a'))){_0x5b8dcf['query'][_0xd5bc('0x18')]=rta[_0xd5bc('0x1b')](_0x5b8dcf[_0xd5bc('0x10')][_0xd5bc('0x18')]);return;}var _0x2f8d4c=rta[_0xd5bc('0x1c')](_0x5b8dcf[_0xd5bc('0x10')]['sort']);_0x5b8dcf['query'][_0xd5bc('0x18')]=_0x2f8d4c['fields'][_0xd5bc('0x1d')](',');_0x4ee380=_0x2f8d4c[_0xd5bc('0x1e')];})[_0xd5bc('0x14')](function(){if(!_0x2a63ca){return[];}return rta[_0xd5bc('0x1f')](_0x2a63ca,_0xb6932d);})[_0xd5bc('0x14')](function(_0x2ab8df){_0x13a5ae=_0x2ab8df;return rta[_0xd5bc('0x20')]();})['then'](function(_0x3858b3){_0x33e3ca=_0x3858b3[_0xd5bc('0x21')];if((!_0x2e7faa||_0x196be5)&&!_0x4ee380){return _0x13a5ae;}if(_0x4ee380&&!_0x2e7faa){return rta[_0xd5bc('0x22')](_0x33e3ca,_0x13a5ae,_0x4ee380);}else{return rta[_0xd5bc('0x23')](_0x33e3ca,_0x13a5ae,_0x2e7faa);}})[_0xd5bc('0x14')](function(_0x355dcb){_0x13a5ae=_0x355dcb;var _0x2ab967=![];if(_0x13a5ae['length']===0x0){if(_0x2a63ca||_0x2e7faa){_0x2ab967=!![];}if(_0x196be5){_0x2ab967=![];}}if(_0x2ab967){return _0x396136;}var _0x148dbf=_[_0xd5bc('0x24')](db['User']['rawAttributes'],function(_0xccd92){return{'name':_0xccd92[_0xd5bc('0x25')],'type':_0xccd92[_0xd5bc('0x26')][_0xd5bc('0x27')]};});_0x5b8dcf[_0xd5bc('0x10')][_0xd5bc('0x28')]=_0xd5bc('0x29');_0x1bf8db=qs[_0xd5bc('0x2a')](_0x148dbf,_0x5b8dcf);_0x1bf8db[_0xd5bc('0x2b')]=!![];var _0x499855=[];if(_0x13a5ae['length']>0x0){_0x499855[_0xd5bc('0x2c')]({'id':{'$in':_0x13a5ae}});if(_0x4ee380&&!_0x2e7faa){_0x39cec1=[db['sequelize']['literal']('FIELD(id,'+_0x13a5ae+')')];_0x1bf8db[_0xd5bc('0x1e')]=_0x39cec1;}}if(_0x196be5){_0x177ded[_0xd5bc('0x2d')](function(_0x3c71a3){var _0x5d8378=!![];if(_0x2e7faa===_0xd5bc('0x2e')&&_0xb6932d!==_0x3c71a3){_0x5d8378=![];}_0x499855[_0xd5bc('0x2c')]({[_0x3c71a3+_0xd5bc('0x2f')]:_0x5d8378});});if(_0x1debc6){_0x499855[_0xd5bc('0x2c')]({'pauseType':_0x1debc6});}}else if(_0x2e7faa){_0x177ded['forEach'](function(_0x24762b){_0x499855['push']({[_0x24762b+'Pause']:![]});});}_0x1bf8db[_0xd5bc('0x30')]=_['merge'](_0x1bf8db['where'],{'$and':_0x499855});if(_0x5b8dcf[_0xd5bc('0x31')][_0xd5bc('0x28')]===_0xd5bc('0x31')){var _0x12d66a={'params':{'id':_0x5b8dcf[_0xd5bc('0x31')][_0xd5bc('0x32')]},'query':{'section':_0xd5bc('0x33'),'role':_0xd5bc('0x29'),'raw':!![],'ids':_0x13a5ae,'customSorting':_0x39cec1}};if(_0x5b8dcf['query'][_0xd5bc('0x34')]){_0x12d66a[_0xd5bc('0x10')][_0xd5bc('0x34')]=!![];}if(_0x196be5){_0x12d66a[_0xd5bc('0x10')][_0xd5bc('0x35')]=_0x499855;}_0x12d66a[_0xd5bc('0x10')]=Object[_0xd5bc('0x36')](_0x12d66a[_0xd5bc('0x10')],_[_0xd5bc('0x37')](_0x5b8dcf[_0xd5bc('0x10')],'id'));return db['UserProfile'][_0xd5bc('0x38')](_0x12d66a);}return db['User']['findAndCountAll'](_0x1bf8db);})[_0xd5bc('0x14')](function(_0x3401d0){_0x396136[_0xd5bc('0x8')]=_0x3401d0[_0xd5bc('0x8')];_0x40960b=_0x3401d0[_0xd5bc('0x21')];return _0x40960b[_0xd5bc('0x24')](function(_0x1423b2){var _0x4ba5c0=_[_0xd5bc('0x39')](_0x33e3ca,['id',_0x1423b2['id']]);if(_0x4ba5c0){var _0x42001e=rta[_0xd5bc('0x3a')](_0x4ba5c0);_[_0xd5bc('0x3b')](_0x1423b2,_0x42001e);}_0x1423b2[_0xd5bc('0x1a')]=rta[_0xd5bc('0x3c')](_0x1423b2);if(_0x1423b2[_0xd5bc('0x1a')]['includes'](_0xd5bc('0x13'))){_0x177ded[_0xd5bc('0x2d')](function(_0x45f684){if(_0x1423b2[_0x45f684+_0xd5bc('0x2f')]){if(_0x45f684===_0xd5bc('0x3d')){if(_0x1423b2[_0xd5bc('0x3e')]!==_0xd5bc('0x3f')){_0x1423b2['voiceStatus']=_0xd5bc('0x13');}}else{_0x1423b2[_0x45f684+_0xd5bc('0x40')]=_0xd5bc('0x13');}}});}return _0x1423b2;});})['then'](function(_0x2775f9){if(!_0x4ee380||_0x39cec1){return _0x2775f9;}return rta[_0xd5bc('0x41')](_0x2775f9,_0x4ee380);})[_0xd5bc('0x14')](function(_0x20293f){var _0x36f45e=rta[_0xd5bc('0x42')]();_0x396136[_0xd5bc('0x21')]=_0x20293f[_0xd5bc('0x24')](function(_0x46e612){return _[_0xd5bc('0x43')](_0x46e612,_0x36f45e);});return _0x396136;})['then'](respondWithFilteredResult(_0x1dfd91,_0x1bf8db))[_0xd5bc('0x44')](APIHandleError(_0x1dfd91));};exports[_0xd5bc('0x45')]=function(_0xc12df,_0x5709aa){var _0x490bb4={'count':0x0,'rows':[]};var _0x1b6142={};var _0x56e7e8;var _0x410073;var _0x1fa6fe;Promise[_0xd5bc('0x46')]()[_0xd5bc('0x14')](function(){if(_0xc12df[_0xd5bc('0x10')][_0xd5bc('0x15')]){if(!utils[_0xd5bc('0x47')](_0xc12df[_0xd5bc('0x10')][_0xd5bc('0x15')])){throw new APIBadRequestError(util[_0xd5bc('0x48')](_0xd5bc('0x16'),_0xc12df[_0xd5bc('0x10')][_0xd5bc('0x15')]));}_0x56e7e8=_0xc12df[_0xd5bc('0x10')][_0xd5bc('0x15')]['toLowerCase']();}var _0x265832=_[_0xd5bc('0x49')](_0x56e7e8)+_0xd5bc('0x4a');var _0x41865c=_[_0xd5bc('0x24')](db[_0x265832][_0xd5bc('0x4b')],function(_0x577384){return{'name':_0x577384[_0xd5bc('0x25')],'type':_0x577384[_0xd5bc('0x26')][_0xd5bc('0x27')]};});if(!_0xc12df[_0xd5bc('0x10')][_0xd5bc('0x4c')]){var _0x50edd9=['id',_0xd5bc('0x4d')];if(_0x56e7e8===_0xd5bc('0x3d')){_0x50edd9['push'](_0xd5bc('0x26'));if(_0xc12df[_0xd5bc('0x10')][_0xd5bc('0x26')]===_0xd5bc('0x4e')){_0x50edd9[_0xd5bc('0x2c')](['dialActive',_0xd5bc('0x4f')]);}}_0xc12df[_0xd5bc('0x10')][_0xd5bc('0x4c')]=_0x50edd9[_0xd5bc('0x1d')](',');}_0x1b6142=qs['getOptions'](_0x41865c,_0xc12df);if(_0xc12df[_0xd5bc('0x31')][_0xd5bc('0x28')]===_0xd5bc('0x31')){var _0x28117d={'params':{'id':_0xc12df['user'][_0xd5bc('0x32')]},'query':{'section':_0x56e7e8===_0xd5bc('0x3d')&&_0xc12df[_0xd5bc('0x10')]['type']===_0xd5bc('0x4e')?_0xd5bc('0x50'):_['startCase'](_0x56e7e8)+_0xd5bc('0x51'),'type':_0xc12df['query']['type'],'nolimit':!![],'sort':'name','filter':_0xc12df[_0xd5bc('0x10')][_0xd5bc('0x52')]}};_0x28117d[_0xd5bc('0x10')]=Object[_0xd5bc('0x36')](_0x28117d[_0xd5bc('0x10')],_0xc12df[_0xd5bc('0x10')]);delete _0x28117d[_0xd5bc('0x10')]['id'];return db[_0xd5bc('0x53')][_0xd5bc('0x38')](_0x28117d);}return db[_0x265832][_0xd5bc('0x54')](_0x1b6142);})[_0xd5bc('0x14')](function(_0x3bcb24){_0x490bb4[_0xd5bc('0x8')]=_0x3bcb24[_0xd5bc('0x8')];_0x410073=_0x3bcb24[_0xd5bc('0x21')];return rtq[_0xd5bc('0x55')](_0xc12df,_0x56e7e8);})[_0xd5bc('0x14')](function(_0x57bf4d){_0x1fa6fe=_0x57bf4d[_0xd5bc('0x21')];return rtq[_0xd5bc('0x56')](_0x410073,_0x1fa6fe,_0x56e7e8,_0xc12df[_0xd5bc('0x10')][_0xd5bc('0x26')]);})[_0xd5bc('0x14')](function(_0x5c1119){_0x490bb4['rows']=_0x5c1119;return _0x490bb4;})[_0xd5bc('0x14')](respondWithFilteredResult(_0x5709aa,_0x1b6142))[_0xd5bc('0x44')](APIHandleError(_0x5709aa));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index d41bf5b..16150aa 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(_0x15b8b7,_0x37ddd6){var _0x21a6d0=function(_0x3031db){while(--_0x3031db){_0x15b8b7['push'](_0x15b8b7['shift']());}};_0x21a6d0(++_0x37ddd6);}(_0xedd9,0xfc));var _0x9edd=function(_0x6fb0e2,_0x262fef){_0x6fb0e2=_0x6fb0e2-0x0;var _0x493d40=_0xedd9[_0x6fb0e2];return _0x493d40;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5d4a23,_0x28a6c8){var _0x41a46a=function(_0x537322){while(--_0x537322){_0x5d4a23['push'](_0x5d4a23['shift']());}};_0x41a46a(++_0x28a6c8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 5bd455d..837b414 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 _0x9b8e=['sequelize','INTEGER','STRING','DATE'];(function(_0x28509b,_0x5831ff){var _0x1e0b6=function(_0x37d8a2){while(--_0x37d8a2){_0x28509b['push'](_0x28509b['shift']());}};_0x1e0b6(++_0x5831ff);}(_0x9b8e,0x158));var _0xe9b8=function(_0x52162c,_0x2153f4){_0x52162c=_0x52162c-0x0;var _0x1a8ac6=_0x9b8e[_0x52162c];return _0x1a8ac6;};'use strict';var Sequelize=require(_0xe9b8('0x0'));module['exports']={'state':{'type':Sequelize[_0xe9b8('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xe9b8('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe9b8('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xe9b8('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xe9b8('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xe9b8('0x2')]}}; \ No newline at end of file +var _0x72a2=['DATE','exports','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x72a2,0x161));var _0x272a=function(_0x15d6f4,_0x109d68){_0x15d6f4=_0x15d6f4-0x0;var _0x2998e9=_0x72a2[_0x15d6f4];return _0x2998e9;};'use strict';var Sequelize=require('sequelize');module[_0x272a('0x0')]={'state':{'type':Sequelize[_0x272a('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x272a('0x2')]},'scheduledat':{'type':Sequelize[_0x272a('0x3')]},'uniqueid':{'type':Sequelize[_0x272a('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x272a('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x272a('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index a7cc332..4e308fa 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 _0x6f35=['moment','bluebird','request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','util','../../config/logger','api'];(function(_0x9dd53b,_0x5cee84){var _0x45fd16=function(_0x13dd53){while(--_0x13dd53){_0x9dd53b['push'](_0x9dd53b['shift']());}};_0x45fd16(++_0x5cee84);}(_0x6f35,0x97));var _0x56f3=function(_0x2e36c0,_0x82bd7d){_0x2e36c0=_0x2e36c0-0x0;var _0x372c8a=_0x6f35[_0x2e36c0];return _0x372c8a;};'use strict';var _=require('lodash');var util=require(_0x56f3('0x0'));var logger=require(_0x56f3('0x1'))(_0x56f3('0x2'));var moment=require(_0x56f3('0x3'));var BPromise=require(_0x56f3('0x4'));var rp=require(_0x56f3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x56f3('0x6'));var config=require(_0x56f3('0x7'));var attributes=require(_0x56f3('0x8'));module[_0x56f3('0x9')]=function(_0x578f44,_0x551a26){return _0x578f44['define'](_0x56f3('0xa'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd364=['ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x550887,_0x78a800){var _0x298dcb=function(_0x5d5326){while(--_0x5d5326){_0x550887['push'](_0x550887['shift']());}};_0x298dcb(++_0x78a800);}(_0xd364,0x80));var _0x4d36=function(_0x25921f,_0x2f8703){_0x25921f=_0x25921f-0x0;var _0x5e532a=_0xd364[_0x25921f];return _0x5e532a;};'use strict';var _=require(_0x4d36('0x0'));var util=require(_0x4d36('0x1'));var logger=require(_0x4d36('0x2'))(_0x4d36('0x3'));var moment=require(_0x4d36('0x4'));var BPromise=require(_0x4d36('0x5'));var rp=require(_0x4d36('0x6'));var fs=require('fs');var path=require(_0x4d36('0x7'));var rimraf=require(_0x4d36('0x8'));var config=require(_0x4d36('0x9'));var attributes=require('./reportAgentPreview.attributes');module[_0x4d36('0xa')]=function(_0xbeba30,_0x500f1f){return _0xbeba30[_0x4d36('0xb')](_0x4d36('0xc'),attributes,{'tableName':_0x4d36('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index c60dd3c..7f17fb2 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 _0x3fb1=['CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x3f5935,_0x5b735b){var _0x40b202=function(_0x1c7add){while(--_0x1c7add){_0x3f5935['push'](_0x3f5935['shift']());}};_0x40b202(++_0x5b735b);}(_0x3fb1,0x17f));var _0x13fb=function(_0x42e828,_0x4447bb){_0x42e828=_0x42e828-0x0;var _0x91122b=_0x3fb1[_0x42e828];return _0x91122b;};'use strict';var _=require(_0x13fb('0x0'));var util=require(_0x13fb('0x1'));var moment=require(_0x13fb('0x2'));var BPromise=require(_0x13fb('0x3'));var rs=require(_0x13fb('0x4'));var fs=require('fs');var Redis=require(_0x13fb('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x13fb('0x6'))(_0x13fb('0x7'));var config=require(_0x13fb('0x8'));var jayson=require(_0x13fb('0x9'));var client=jayson[_0x13fb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5389a1,_0x5a1800,_0x9490cc){return new BPromise(function(_0x417dd4,_0x587944){return client[_0x13fb('0xb')](_0x5389a1,_0x9490cc)[_0x13fb('0xc')](function(_0x378347){logger[_0x13fb('0xd')](_0x13fb('0xe'),_0x5a1800,'request\x20sent');logger['debug'](_0x13fb('0xf'),_0x5a1800,_0x13fb('0x10'),JSON[_0x13fb('0x11')](_0x378347));if(_0x378347[_0x13fb('0x12')]){if(_0x378347[_0x13fb('0x12')][_0x13fb('0x13')]===0x1f4){logger[_0x13fb('0x12')](_0x13fb('0xe'),_0x5a1800,_0x378347['error'][_0x13fb('0x14')]);return _0x587944(_0x378347[_0x13fb('0x12')][_0x13fb('0x14')]);}logger[_0x13fb('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x5a1800,_0x378347['error'][_0x13fb('0x14')]);return _0x417dd4(_0x378347[_0x13fb('0x12')]['message']);}else{logger[_0x13fb('0xd')](_0x13fb('0xe'),_0x5a1800,'request\x20sent');_0x417dd4(_0x378347[_0x13fb('0x15')][_0x13fb('0x14')]);}})[_0x13fb('0x16')](function(_0x5986a5){logger[_0x13fb('0x12')](_0x13fb('0xe'),_0x5a1800,_0x5986a5);_0x587944(_0x5986a5);});});}exports[_0x13fb('0x17')]=function(_0xb13498){var _0x51f72b=this;return new Promise(function(_0x46dc04,_0x1755e3){return db[_0x13fb('0x18')][_0x13fb('0x19')](_0xb13498[_0x13fb('0x1a')],{'raw':_0xb13498[_0x13fb('0x1b')]?_0xb13498[_0x13fb('0x1b')][_0x13fb('0x1c')]===undefined?!![]:![]:!![]})[_0x13fb('0xc')](function(_0x5f057a){logger['info']('CreateReportAgentPreview',_0xb13498);logger['debug'](_0x13fb('0x17'),_0xb13498,JSON['stringify'](_0x5f057a));_0x46dc04(_0x5f057a);})[_0x13fb('0x16')](function(_0x114521){logger[_0x13fb('0x12')](_0x13fb('0x17'),_0x114521[_0x13fb('0x14')],_0xb13498);_0x1755e3(_0x51f72b[_0x13fb('0x12')](0x1f4,_0x114521['message']));});});}; \ No newline at end of file +var _0x7ebd=['ReportAgentPreview','create','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview'];(function(_0x448540,_0x206505){var _0x320e8d=function(_0x38e2ae){while(--_0x38e2ae){_0x448540['push'](_0x448540['shift']());}};_0x320e8d(++_0x206505);}(_0x7ebd,0x8f));var _0xd7eb=function(_0x47d80b,_0x34211f){_0x47d80b=_0x47d80b-0x0;var _0x456256=_0x7ebd[_0x47d80b];return _0x456256;};'use strict';var _=require(_0xd7eb('0x0'));var util=require(_0xd7eb('0x1'));var moment=require(_0xd7eb('0x2'));var BPromise=require(_0xd7eb('0x3'));var rs=require(_0xd7eb('0x4'));var fs=require('fs');var Redis=require(_0xd7eb('0x5'));var db=require(_0xd7eb('0x6'))['db'];var utils=require(_0xd7eb('0x7'));var logger=require('../../config/logger')(_0xd7eb('0x8'));var config=require(_0xd7eb('0x9'));var jayson=require(_0xd7eb('0xa'));var client=jayson['client'][_0xd7eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b4bbb,_0x9ba55d,_0x5c11a1){return new BPromise(function(_0x2014bf,_0x43fe27){return client['request'](_0x3b4bbb,_0x5c11a1)[_0xd7eb('0xc')](function(_0x4793f2){logger[_0xd7eb('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x9ba55d,_0xd7eb('0xe'));logger[_0xd7eb('0xf')](_0xd7eb('0x10'),_0x9ba55d,_0xd7eb('0xe'),JSON[_0xd7eb('0x11')](_0x4793f2));if(_0x4793f2[_0xd7eb('0x12')]){if(_0x4793f2[_0xd7eb('0x12')][_0xd7eb('0x13')]===0x1f4){logger[_0xd7eb('0x12')](_0xd7eb('0x14'),_0x9ba55d,_0x4793f2[_0xd7eb('0x12')][_0xd7eb('0x15')]);return _0x43fe27(_0x4793f2[_0xd7eb('0x12')][_0xd7eb('0x15')]);}logger[_0xd7eb('0x12')](_0xd7eb('0x14'),_0x9ba55d,_0x4793f2[_0xd7eb('0x12')][_0xd7eb('0x15')]);return _0x2014bf(_0x4793f2[_0xd7eb('0x12')][_0xd7eb('0x15')]);}else{logger[_0xd7eb('0xd')](_0xd7eb('0x14'),_0x9ba55d,_0xd7eb('0xe'));_0x2014bf(_0x4793f2[_0xd7eb('0x16')][_0xd7eb('0x15')]);}})[_0xd7eb('0x17')](function(_0x4b95f3){logger['error'](_0xd7eb('0x14'),_0x9ba55d,_0x4b95f3);_0x43fe27(_0x4b95f3);});});}exports[_0xd7eb('0x18')]=function(_0x42b24f){var _0x4e9b32=this;return new Promise(function(_0x5a1c8e,_0x4f0f03){return db[_0xd7eb('0x19')][_0xd7eb('0x1a')](_0x42b24f['body'],{'raw':_0x42b24f['options']?_0x42b24f[_0xd7eb('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xd7eb('0xc')](function(_0x3f5ae4){logger[_0xd7eb('0xd')](_0xd7eb('0x18'),_0x42b24f);logger[_0xd7eb('0xf')]('CreateReportAgentPreview',_0x42b24f,JSON[_0xd7eb('0x11')](_0x3f5ae4));_0x5a1c8e(_0x3f5ae4);})['catch'](function(_0x2b546e){logger[_0xd7eb('0x12')](_0xd7eb('0x18'),_0x2b546e['message'],_0x42b24f);_0x4f0f03(_0x4e9b32[_0xd7eb('0x12')](0x1f4,_0x2b546e['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index bc63c4b..6e7b97a 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 _0x5f38=['showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','path','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','chatQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','queueNotify','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id'];(function(_0x146a23,_0x3b96f2){var _0x2f20b0=function(_0x76bee4){while(--_0x76bee4){_0x146a23['push'](_0x146a23['shift']());}};_0x2f20b0(++_0x3b96f2);}(_0x5f38,0x1f0));var _0x85f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f38[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x85f3('0x0'));var util=require('util');var path=require(_0x85f3('0x1'));var express=require(_0x85f3('0x2'));var router=express[_0x85f3('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x85f3('0x4'));router[_0x85f3('0x5')](_0x85f3('0x6'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x8')]);router[_0x85f3('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x85f3('0x9')]);router[_0x85f3('0x5')](_0x85f3('0xa'),auth[_0x85f3('0x7')](),controller[_0x85f3('0xb')]);router[_0x85f3('0x5')](_0x85f3('0xc'),auth['isAuthenticated'](),controller['voiceQueues']);router['get']('/chat/queues',auth[_0x85f3('0x7')](),controller[_0x85f3('0xd')]);router[_0x85f3('0x5')]('/mail/queues',auth[_0x85f3('0x7')](),controller['mailQueues']);router[_0x85f3('0x5')](_0x85f3('0xe'),auth[_0x85f3('0x7')](),controller['mailAccounts']);router[_0x85f3('0x5')](_0x85f3('0xf'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x10')]);router[_0x85f3('0x5')](_0x85f3('0x11'),auth['isAuthenticated'](),controller[_0x85f3('0x12')]);router[_0x85f3('0x5')]('/whatsapp/queues',auth[_0x85f3('0x7')](),controller[_0x85f3('0x13')]);router[_0x85f3('0x5')](_0x85f3('0x14'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x15')]);router[_0x85f3('0x5')](_0x85f3('0x16'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x17')]);router[_0x85f3('0x5')](_0x85f3('0x18'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x19')]);router[_0x85f3('0x5')](_0x85f3('0x1a'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x1b')]);router[_0x85f3('0x5')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x85f3('0x1c')]);router[_0x85f3('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x85f3('0x7')](),controller['voiceQueuesChannelRedirect']);router['get'](_0x85f3('0x1d'),auth['isAuthenticated'](),controller[_0x85f3('0x1e')]);router[_0x85f3('0x1f')](_0x85f3('0x1d'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x20')]);router[_0x85f3('0x5')](_0x85f3('0x21'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x22')]);router[_0x85f3('0x5')](_0x85f3('0x23'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x24')]);router[_0x85f3('0x5')](_0x85f3('0x25'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x26')]);router[_0x85f3('0x1f')](_0x85f3('0x27'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x28')]);router[_0x85f3('0x5')](_0x85f3('0x29'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x2a')]);router[_0x85f3('0x5')](_0x85f3('0x2b'),auth[_0x85f3('0x7')](),controller['trunks']);router[_0x85f3('0x5')](_0x85f3('0x2c'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x2d')]);router['get']('/fax/accounts',auth['isAuthenticated'](),controller[_0x85f3('0x2e')]);router['get'](_0x85f3('0x2f'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x30')]);router['get'](_0x85f3('0x31'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x32')]);router['get']('/openchannel/queues/waitinginteractions',auth[_0x85f3('0x7')](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0x85f3('0x33'),auth['isAuthenticated'](),controller[_0x85f3('0x34')]);router[_0x85f3('0x5')](_0x85f3('0x35'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x36')]);router[_0x85f3('0x5')](_0x85f3('0x37'),auth[_0x85f3('0x7')](),controller['whatsappQueuesWaitingInteractions']);router[_0x85f3('0x5')]('/fax/queues/waitinginteractions',auth[_0x85f3('0x7')](),controller[_0x85f3('0x38')]);router[_0x85f3('0x39')](_0x85f3('0x3a'),auth[_0x85f3('0x7')](),controller['queueNotify'](_0x85f3('0x3b')));router['get'](_0x85f3('0x3c'),auth['isAuthenticated'](),controller[_0x85f3('0x3d')]);router['post']('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0x85f3('0x3e')](_0x85f3('0x3f')));router[_0x85f3('0x5')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0x85f3('0x40')]);router[_0x85f3('0x39')](_0x85f3('0x41'),auth['isAuthenticated'](),controller[_0x85f3('0x3e')](_0x85f3('0x42')));router[_0x85f3('0x5')](_0x85f3('0x43'),auth['isAuthenticated'](),controller[_0x85f3('0x44')]);router[_0x85f3('0x39')](_0x85f3('0x45'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x3e')](_0x85f3('0x46')));router['get'](_0x85f3('0x47'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x48')]);router['post'](_0x85f3('0x49'),auth['isAuthenticated'](),controller[_0x85f3('0x3e')](_0x85f3('0x4a')));router[_0x85f3('0x39')]('/whatsapp/queues/:id/notify',auth[_0x85f3('0x7')](),controller[_0x85f3('0x3e')]('whatsapp'));router[_0x85f3('0x5')](_0x85f3('0x4b'),auth['isAuthenticated'](),controller[_0x85f3('0x4c')]);router[_0x85f3('0x5')](_0x85f3('0x4d'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x4e')]);router[_0x85f3('0x39')](_0x85f3('0x4f'),auth[_0x85f3('0x7')](),controller[_0x85f3('0x50')]);module[_0x85f3('0x51')]=router; \ No newline at end of file +var _0x0a68=['/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/chat/queues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelRedirect'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x0a68,0xd2));var _0x80a6=function(_0x1f01fc,_0x374ccb){_0x1f01fc=_0x1f01fc-0x0;var _0x246fca=_0x0a68[_0x1f01fc];return _0x246fca;};'use strict';var multer=require(_0x80a6('0x0'));var util=require(_0x80a6('0x1'));var path=require('path');var express=require(_0x80a6('0x2'));var router=express[_0x80a6('0x3')]();var auth=require(_0x80a6('0x4'));var controller=require(_0x80a6('0x5'));router[_0x80a6('0x6')](_0x80a6('0x7'),auth[_0x80a6('0x8')](),controller[_0x80a6('0x9')]);router['get'](_0x80a6('0xa'),auth[_0x80a6('0x8')](),controller[_0x80a6('0xb')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x80a6('0x8')](),controller[_0x80a6('0xc')]);router['get']('/voice/queues',auth[_0x80a6('0x8')](),controller['voiceQueues']);router[_0x80a6('0x6')](_0x80a6('0xd'),auth[_0x80a6('0x8')](),controller['chatQueues']);router[_0x80a6('0x6')](_0x80a6('0xe'),auth[_0x80a6('0x8')](),controller[_0x80a6('0xf')]);router['get']('/mail/accounts',auth['isAuthenticated'](),controller[_0x80a6('0x10')]);router[_0x80a6('0x6')](_0x80a6('0x11'),auth['isAuthenticated'](),controller[_0x80a6('0x12')]);router['get'](_0x80a6('0x13'),auth[_0x80a6('0x8')](),controller[_0x80a6('0x14')]);router[_0x80a6('0x6')]('/whatsapp/queues',auth[_0x80a6('0x8')](),controller[_0x80a6('0x15')]);router[_0x80a6('0x6')](_0x80a6('0x16'),auth[_0x80a6('0x8')](),controller[_0x80a6('0x17')]);router['get'](_0x80a6('0x18'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0x80a6('0x6')](_0x80a6('0x19'),auth[_0x80a6('0x8')](),controller[_0x80a6('0x1a')]);router['get'](_0x80a6('0x1b'),auth[_0x80a6('0x8')](),controller['voiceQueuesChannel']);router[_0x80a6('0x6')](_0x80a6('0x1c'),auth[_0x80a6('0x8')](),controller['voiceQueuesChannelHangup']);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x80a6('0x8')](),controller[_0x80a6('0x1d')]);router['get'](_0x80a6('0x1e'),auth[_0x80a6('0x8')](),controller['showVoiceQueues']);router[_0x80a6('0x1f')](_0x80a6('0x1e'),auth[_0x80a6('0x8')](),controller[_0x80a6('0x20')]);router[_0x80a6('0x6')](_0x80a6('0x21'),auth[_0x80a6('0x8')](),controller[_0x80a6('0x22')]);router[_0x80a6('0x6')](_0x80a6('0x23'),auth[_0x80a6('0x8')](),controller[_0x80a6('0x24')]);router[_0x80a6('0x6')](_0x80a6('0x25'),auth['isAuthenticated'](),controller[_0x80a6('0x26')]);router[_0x80a6('0x1f')]('/agents/:id/capacity',auth[_0x80a6('0x8')](),controller['agentCapacity']);router[_0x80a6('0x6')](_0x80a6('0x27'),auth[_0x80a6('0x8')](),controller[_0x80a6('0x28')]);router[_0x80a6('0x6')](_0x80a6('0x29'),auth[_0x80a6('0x8')](),controller[_0x80a6('0x2a')]);router[_0x80a6('0x6')]('/campaigns',auth['isAuthenticated'](),controller[_0x80a6('0x2b')]);router[_0x80a6('0x6')](_0x80a6('0x2c'),auth[_0x80a6('0x8')](),controller['faxAccounts']);router[_0x80a6('0x6')](_0x80a6('0x2d'),auth[_0x80a6('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x80a6('0x6')](_0x80a6('0x2e'),auth['isAuthenticated'](),controller[_0x80a6('0x2f')]);router[_0x80a6('0x6')](_0x80a6('0x30'),auth[_0x80a6('0x8')](),controller[_0x80a6('0x31')]);router['get'](_0x80a6('0x32'),auth['isAuthenticated'](),controller[_0x80a6('0x33')]);router[_0x80a6('0x6')](_0x80a6('0x34'),auth[_0x80a6('0x8')](),controller[_0x80a6('0x35')]);router['get'](_0x80a6('0x36'),auth[_0x80a6('0x8')](),controller[_0x80a6('0x37')]);router['get'](_0x80a6('0x38'),auth[_0x80a6('0x8')](),controller[_0x80a6('0x39')]);router[_0x80a6('0x3a')](_0x80a6('0x3b'),auth[_0x80a6('0x8')](),controller[_0x80a6('0x3c')](_0x80a6('0x3d')));router[_0x80a6('0x6')](_0x80a6('0x3e'),auth[_0x80a6('0x8')](),controller[_0x80a6('0x3f')]);router[_0x80a6('0x3a')](_0x80a6('0x40'),auth[_0x80a6('0x8')](),controller[_0x80a6('0x3c')](_0x80a6('0x41')));router[_0x80a6('0x6')]('/chat/queues/:id',auth[_0x80a6('0x8')](),controller[_0x80a6('0x42')]);router['post'](_0x80a6('0x43'),auth[_0x80a6('0x8')](),controller['queueNotify'](_0x80a6('0x44')));router[_0x80a6('0x6')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x80a6('0x45')]);router[_0x80a6('0x3a')]('/openchannel/queues/:id/notify',auth[_0x80a6('0x8')](),controller[_0x80a6('0x3c')](_0x80a6('0x46')));router[_0x80a6('0x6')](_0x80a6('0x47'),auth['isAuthenticated'](),controller[_0x80a6('0x48')]);router[_0x80a6('0x3a')](_0x80a6('0x49'),auth[_0x80a6('0x8')](),controller[_0x80a6('0x3c')]('sms'));router['post'](_0x80a6('0x4a'),auth[_0x80a6('0x8')](),controller[_0x80a6('0x3c')](_0x80a6('0x4b')));router['get'](_0x80a6('0x4c'),auth[_0x80a6('0x8')](),controller['showSmsQueues']);router[_0x80a6('0x6')]('/whatsapp/queues/:id',auth[_0x80a6('0x8')](),controller['showWhatsappQueues']);router[_0x80a6('0x3a')](_0x80a6('0x4d'),auth['isAuthenticated'](),controller[_0x80a6('0x4e')]);module[_0x80a6('0x4f')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 04a6beb..4103d34 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x2341a8,_0x1939f9){var _0x47c318=function(_0x196e7f){while(--_0x196e7f){_0x2341a8['push'](_0x2341a8['shift']());}};_0x47c318(++_0x1939f9);}(_0xe706,0xa3));var _0x6e70=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0xe706[_0x102ff9];return _0x24fa97;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file +var _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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 a5ee337..32a4a17 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 _0xf04b=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','put','update','delete'];(function(_0x3981b8,_0x1b8138){var _0x553999=function(_0x2b0ca7){while(--_0x2b0ca7){_0x3981b8['push'](_0x3981b8['shift']());}};_0x553999(++_0x1b8138);}(_0xf04b,0x1d0));var _0xbf04=function(_0x153b75,_0x41aa39){_0x153b75=_0x153b75-0x0;var _0x38163d=_0xf04b[_0x153b75];return _0x38163d;};'use strict';var multer=require(_0xbf04('0x0'));var util=require(_0xbf04('0x1'));var path=require(_0xbf04('0x2'));var timeout=require(_0xbf04('0x3'));var express=require(_0xbf04('0x4'));var router=express[_0xbf04('0x5')]();var fs_extra=require(_0xbf04('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbf04('0x7'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0xbf04('0x8')]('/',auth[_0xbf04('0x9')](),controller[_0xbf04('0xa')]);router[_0xbf04('0x8')](_0xbf04('0xb'),auth[_0xbf04('0x9')](),controller[_0xbf04('0xc')]);router[_0xbf04('0x8')](_0xbf04('0xd'),auth[_0xbf04('0x9')](),controller[_0xbf04('0xe')]);router[_0xbf04('0xf')]('/',auth[_0xbf04('0x9')](),controller[_0xbf04('0x10')]);router[_0xbf04('0x11')](_0xbf04('0xb'),auth[_0xbf04('0x9')](),controller[_0xbf04('0x12')]);router[_0xbf04('0x13')](_0xbf04('0xb'),auth[_0xbf04('0x9')](),controller[_0xbf04('0x14')]);module[_0xbf04('0x15')]=router; \ No newline at end of file +var _0x186a=['show','/:id/run','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x186a,0x171));var _0xa186=function(_0x29468e,_0x18c839){_0x29468e=_0x29468e-0x0;var _0x5afbfc=_0x186a[_0x29468e];return _0x5afbfc;};'use strict';var multer=require(_0xa186('0x0'));var util=require(_0xa186('0x1'));var path=require(_0xa186('0x2'));var timeout=require(_0xa186('0x3'));var express=require('express');var router=express[_0xa186('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa186('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa186('0x6'));var controller=require(_0xa186('0x7'));router[_0xa186('0x8')]('/',auth[_0xa186('0x9')](),controller['index']);router[_0xa186('0x8')](_0xa186('0xa'),auth['isAuthenticated'](),controller[_0xa186('0xb')]);router[_0xa186('0x8')](_0xa186('0xc'),auth['isAuthenticated'](),controller['run']);router[_0xa186('0xd')]('/',auth[_0xa186('0x9')](),controller[_0xa186('0xe')]);router[_0xa186('0xf')](_0xa186('0xa'),auth[_0xa186('0x9')](),controller[_0xa186('0x10')]);router[_0xa186('0x11')](_0xa186('0xa'),auth[_0xa186('0x9')](),controller['destroy']);module[_0xa186('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 42cfd6b..e711e43 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 _0x50a2=['quarters','hours','days','csv','pdf','xlsx','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years'];(function(_0x3e6346,_0x2293fa){var _0x2a1511=function(_0x19ed91){while(--_0x19ed91){_0x3e6346['push'](_0x3e6346['shift']());}};_0x2a1511(++_0x2293fa);}(_0x50a2,0x91));var _0x250a=function(_0x3be196,_0x24fa0a){_0x3be196=_0x3be196-0x0;var _0x2538ae=_0x50a2[_0x3be196];return _0x2538ae;};'use strict';var Sequelize=require('sequelize');module[_0x250a('0x0')]={'name':{'type':Sequelize[_0x250a('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x250a('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x250a('0x3')},'startAt':{'type':Sequelize[_0x250a('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x250a('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x250a('0x6')](_0x250a('0x7'),_0x250a('0x8'),'months','weeks','days',_0x250a('0x9'),'minutes'),'allowNull':![],'defaultValue':_0x250a('0xa')},'output':{'type':Sequelize['ENUM'](_0x250a('0xb'),_0x250a('0xc'),_0x250a('0xd')),'allowNull':![],'defaultValue':_0x250a('0xb')},'type':{'type':Sequelize[_0x250a('0x6')](_0x250a('0xe'),_0x250a('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x250a('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x250a('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x250a('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x250a('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xccc1=['DATE','INTEGER','quarters','days','hours','minutes','ENUM','pdf','csv','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xccc1,0x1b5));var _0x1ccc=function(_0x4b6c5d,_0x3cbbdf){_0x4b6c5d=_0x4b6c5d-0x0;var _0x4e4d47=_0xccc1[_0x4b6c5d];return _0x4e4d47;};'use strict';var Sequelize=require(_0x1ccc('0x0'));module[_0x1ccc('0x1')]={'name':{'type':Sequelize[_0x1ccc('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1ccc('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x1ccc('0x2')],'allowNull':![],'defaultValue':_0x1ccc('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x1ccc('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x1ccc('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0x1ccc('0x7'),'months','weeks',_0x1ccc('0x8'),_0x1ccc('0x9'),_0x1ccc('0xa')),'allowNull':![],'defaultValue':_0x1ccc('0x8')},'output':{'type':Sequelize[_0x1ccc('0xb')]('csv',_0x1ccc('0xc'),'xlsx'),'allowNull':![],'defaultValue':_0x1ccc('0xd')},'type':{'type':Sequelize['ENUM'](_0x1ccc('0xe'),_0x1ccc('0xf')),'allowNull':![],'defaultValue':_0x1ccc('0xe')},'sendMail':{'type':Sequelize[_0x1ccc('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x1ccc('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x1ccc('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x1ccc('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 321148d..1948dd3 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 _0x15d6=['map','Schedule','rawAttributes','type','key','keys','filters','intersection','model','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','eml-format','rimraf','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','Scheduler','UserProfileResource','sendStatus','stack','name','send','index'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x15d6,0xd9));var _0x615d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x15d6[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x615d('0x0'));var rimraf=require(_0x615d('0x1'));var zipdir=require(_0x615d('0x2'));var jsonpatch=require(_0x615d('0x3'));var rp=require(_0x615d('0x4'));var moment=require(_0x615d('0x5'));var BPromise=require(_0x615d('0x6'));var Mustache=require(_0x615d('0x7'));var util=require(_0x615d('0x8'));var path=require(_0x615d('0x9'));var sox=require('sox');var csv=require(_0x615d('0xa'));var ejs=require(_0x615d('0xb'));var fs=require('fs');var fs_extra=require(_0x615d('0xc'));var _=require('lodash');var squel=require(_0x615d('0xd'));var crypto=require(_0x615d('0xe'));var jsforce=require(_0x615d('0xf'));var deskjs=require(_0x615d('0x10'));var toCsv=require(_0x615d('0xa'));var querystring=require(_0x615d('0x11'));var Papa=require(_0x615d('0x12'));var Redis=require(_0x615d('0x13'));var authService=require(_0x615d('0x14'));var qs=require(_0x615d('0x15'));var as=require(_0x615d('0x16'));var hardwareService=require(_0x615d('0x17'));var logger=require(_0x615d('0x18'))(_0x615d('0x19'));var utils=require(_0x615d('0x1a'));var config=require(_0x615d('0x1b'));var licenseUtil=require(_0x615d('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f27f2,_0x3c6566){_0x3c6566=_0x3c6566||0xcc;return function(_0x155086){if(_0x155086){return _0x2f27f2['sendStatus'](_0x3c6566);}return _0x2f27f2[_0x615d('0x1d')](_0x3c6566)[_0x615d('0x1e')]();};}function respondWithResult(_0x529b6a,_0x37d211){_0x37d211=_0x37d211||0xc8;return function(_0x1af670){if(_0x1af670){return _0x529b6a[_0x615d('0x1d')](_0x37d211)['json'](_0x1af670);}};}function respondWithFilteredResult(_0x5b35ac,_0x3e753e){return function(_0x1c5acb){if(_0x1c5acb){var _0x2afb77=typeof _0x3e753e[_0x615d('0x1f')]===_0x615d('0x20')&&typeof _0x3e753e[_0x615d('0x21')]===_0x615d('0x20');var _0x215e39=_0x1c5acb['count'];var _0x2add64=_0x2afb77?0x0:_0x3e753e[_0x615d('0x1f')];var _0x342618=_0x2afb77?_0x1c5acb['count']:_0x3e753e[_0x615d('0x1f')]+_0x3e753e[_0x615d('0x21')];var _0x40d771;if(_0x342618>=_0x215e39){_0x342618=_0x215e39;_0x40d771=0xc8;}else{_0x40d771=0xce;}_0x5b35ac[_0x615d('0x1d')](_0x40d771);return _0x5b35ac[_0x615d('0x22')](_0x615d('0x23'),_0x2add64+'-'+_0x342618+'/'+_0x215e39)[_0x615d('0x24')](_0x1c5acb);}return null;};}function patchUpdates(_0x1fb3a9){return function(_0x3398b5){try{jsonpatch[_0x615d('0x25')](_0x3398b5,_0x1fb3a9,!![]);}catch(_0x1cbfbc){return BPromise[_0x615d('0x26')](_0x1cbfbc);}return _0x3398b5[_0x615d('0x27')]();};}function saveUpdates(_0x2be4df,_0x4ac15f){return function(_0x3a0f2c){if(_0x3a0f2c){return _0x3a0f2c[_0x615d('0x28')](_0x2be4df)[_0x615d('0x29')](function(_0x2484ea){return _0x2484ea;});}return null;};}function removeEntity(_0xe85801,_0x4fecf8){return function(_0x2875b2){if(_0x2875b2){return _0x2875b2[_0x615d('0x2a')]()['then'](function(){var _0x5b091b=_0x2875b2['get']({'plain':!![]});var _0x26ab78=_0x615d('0x2b');return db[_0x615d('0x2c')]['destroy']({'where':{'type':_0x26ab78,'resourceId':_0x5b091b['id']}})['then'](function(){return _0x2875b2;});})[_0x615d('0x29')](function(){_0xe85801['status'](0xcc)[_0x615d('0x1e')]();});}};}function handleEntityNotFound(_0x183225,_0x40c0a0){return function(_0x27bc82){if(!_0x27bc82){_0x183225[_0x615d('0x2d')](0x194);}return _0x27bc82;};}function handleError(_0x3e9366,_0x57e7e9){_0x57e7e9=_0x57e7e9||0x1f4;return function(_0x3d7e55){logger['error'](_0x3d7e55[_0x615d('0x2e')]);if(_0x3d7e55['name']){delete _0x3d7e55[_0x615d('0x2f')];}_0x3e9366[_0x615d('0x1d')](_0x57e7e9)[_0x615d('0x30')](_0x3d7e55);};}exports[_0x615d('0x31')]=function(_0x4efdf9,_0x535746){var _0x1792cc={},_0x57446f={},_0x33f343={'count':0x0,'rows':[]};var _0x37cd7b=_[_0x615d('0x32')](db[_0x615d('0x33')][_0x615d('0x34')],function(_0x281f54){return{'name':_0x281f54['fieldName'],'type':_0x281f54[_0x615d('0x35')][_0x615d('0x36')]};});_0x57446f['model']=_[_0x615d('0x32')](_0x37cd7b,_0x615d('0x2f'));_0x57446f['query']=_[_0x615d('0x37')](_0x4efdf9['query']);_0x57446f[_0x615d('0x38')]=_[_0x615d('0x39')](_0x57446f[_0x615d('0x3a')],_0x57446f[_0x615d('0x3b')]);_0x1792cc[_0x615d('0x3c')]=_['intersection'](_0x57446f[_0x615d('0x3a')],qs['fields'](_0x4efdf9[_0x615d('0x3b')][_0x615d('0x3d')]));_0x1792cc[_0x615d('0x3c')]=_0x1792cc['attributes']['length']?_0x1792cc[_0x615d('0x3c')]:_0x57446f[_0x615d('0x3a')];if(!_0x4efdf9['query']['hasOwnProperty'](_0x615d('0x3e'))){_0x1792cc['limit']=qs[_0x615d('0x21')](_0x4efdf9[_0x615d('0x3b')][_0x615d('0x21')]);_0x1792cc['offset']=qs[_0x615d('0x1f')](_0x4efdf9['query'][_0x615d('0x1f')]);}_0x1792cc[_0x615d('0x3f')]=qs[_0x615d('0x40')](_0x4efdf9[_0x615d('0x3b')]['sort']);_0x1792cc[_0x615d('0x41')]=qs[_0x615d('0x38')](_[_0x615d('0x42')](_0x4efdf9[_0x615d('0x3b')],_0x57446f[_0x615d('0x38')]),_0x37cd7b);if(_0x4efdf9[_0x615d('0x3b')][_0x615d('0x43')]){_0x1792cc[_0x615d('0x41')]=_[_0x615d('0x44')](_0x1792cc[_0x615d('0x41')],{'$or':_['map'](_0x37cd7b,function(_0x5245fa){if(_0x5245fa[_0x615d('0x35')]!==_0x615d('0x45')){var _0x179a85={};_0x179a85[_0x5245fa[_0x615d('0x2f')]]={'$like':'%'+_0x4efdf9[_0x615d('0x3b')][_0x615d('0x43')]+'%'};return _0x179a85;}})});}_0x1792cc=_[_0x615d('0x44')]({},_0x1792cc,_0x4efdf9[_0x615d('0x46')]);var _0x1bd9b4={'where':_0x1792cc[_0x615d('0x41')]};return db[_0x615d('0x33')]['count'](_0x1bd9b4)[_0x615d('0x29')](function(_0x2470b4){_0x33f343['count']=_0x2470b4;if(_0x4efdf9['query'][_0x615d('0x47')]){_0x1792cc[_0x615d('0x48')]=[{'all':!![]}];}return db[_0x615d('0x33')][_0x615d('0x49')](_0x1792cc);})[_0x615d('0x29')](function(_0x3eb222){_0x33f343['rows']=_0x3eb222;return _0x33f343;})['then'](respondWithFilteredResult(_0x535746,_0x1792cc))[_0x615d('0x4a')](handleError(_0x535746,null));};exports[_0x615d('0x4b')]=function(_0x3e8ee0,_0x89521){var _0x3a8be7={'raw':![],'where':{'id':_0x3e8ee0[_0x615d('0x4c')]['id']}},_0x358b53={};_0x358b53[_0x615d('0x3a')]=_[_0x615d('0x37')](db['Schedule']['rawAttributes']);_0x358b53[_0x615d('0x3b')]=_[_0x615d('0x37')](_0x3e8ee0[_0x615d('0x3b')]);_0x358b53[_0x615d('0x38')]=_[_0x615d('0x39')](_0x358b53['model'],_0x358b53[_0x615d('0x3b')]);_0x3a8be7[_0x615d('0x3c')]=_['intersection'](_0x358b53['model'],qs[_0x615d('0x3d')](_0x3e8ee0[_0x615d('0x3b')][_0x615d('0x3d')]));_0x3a8be7['attributes']=_0x3a8be7[_0x615d('0x3c')][_0x615d('0x4d')]?_0x3a8be7[_0x615d('0x3c')]:_0x358b53['model'];if(_0x3e8ee0[_0x615d('0x3b')][_0x615d('0x47')]){_0x3a8be7['include']=[{'all':!![]}];}_0x3a8be7=_[_0x615d('0x44')]({},_0x3a8be7,_0x3e8ee0['options']);return db['Schedule'][_0x615d('0x4e')](_0x3a8be7)['then'](handleEntityNotFound(_0x89521,null))['then'](respondWithResult(_0x89521,null))['catch'](handleError(_0x89521,null));};exports[_0x615d('0x4f')]=function(_0x19ca35,_0x3122dc){return db[_0x615d('0x33')]['create'](_0x19ca35[_0x615d('0x50')],{})[_0x615d('0x29')](function(_0x232afe){var _0x460e9c=_0x19ca35['user'][_0x615d('0x51')]({'plain':!![]});if(!_0x460e9c)throw new Error(_0x615d('0x52'));if(_0x460e9c['role']===_0x615d('0x53')){var _0x4d9534=_0x232afe[_0x615d('0x51')]({'plain':!![]});var _0x25a0bd=_0x615d('0x2b');return db[_0x615d('0x54')][_0x615d('0x4e')]({'where':{'name':_0x25a0bd,'userProfileId':_0x460e9c[_0x615d('0x55')]},'raw':!![]})[_0x615d('0x29')](function(_0x3b4bf4){if(_0x3b4bf4&&_0x3b4bf4['autoAssociation']===0x0){return db[_0x615d('0x2c')][_0x615d('0x4f')]({'name':_0x4d9534['name'],'resourceId':_0x4d9534['id'],'type':_0x3b4bf4['name'],'sectionId':_0x3b4bf4['id']},{})[_0x615d('0x29')](function(){return _0x232afe;});}else{return _0x232afe;}})[_0x615d('0x4a')](function(_0x56fb0b){logger[_0x615d('0x56')](_0x615d('0x57'),_0x56fb0b);throw _0x56fb0b;});}return _0x232afe;})[_0x615d('0x29')](respondWithResult(_0x3122dc,0xc9))[_0x615d('0x4a')](handleError(_0x3122dc,null));};exports[_0x615d('0x28')]=function(_0x144a39,_0x32b455){if(_0x144a39['body']['id']){delete _0x144a39[_0x615d('0x50')]['id'];}return db[_0x615d('0x33')][_0x615d('0x4e')]({'where':{'id':_0x144a39[_0x615d('0x4c')]['id']}})[_0x615d('0x29')](handleEntityNotFound(_0x32b455,null))['then'](saveUpdates(_0x144a39['body'],null))['then'](respondWithResult(_0x32b455,null))['catch'](handleError(_0x32b455,null));};exports[_0x615d('0x2a')]=function(_0x56a8ff,_0x3590b8){return db[_0x615d('0x33')][_0x615d('0x4e')]({'where':{'id':_0x56a8ff[_0x615d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3590b8,null))[_0x615d('0x29')](removeEntity(_0x3590b8,null))[_0x615d('0x4a')](handleError(_0x3590b8,null));};exports[_0x615d('0x58')]=function(_0x31539b,_0x117a8f,_0x53ae22){var _0x46d4ed=require('../../config/schedule');return db[_0x615d('0x33')]['find']({'where':{'id':_0x31539b['params']['id']},'raw':!![]})[_0x615d('0x29')](handleEntityNotFound(_0x117a8f,null))[_0x615d('0x29')](function(){_0x46d4ed[_0x615d('0x58')](_0x31539b[_0x615d('0x4c')]['id']);})[_0x615d('0x29')](respondWithStatusCode(_0x117a8f,null))[_0x615d('0x4a')](handleError(_0x117a8f,null));}; \ No newline at end of file +var _0x147c=['bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','reject','update','then','Scheduler','UserProfileResource','stack','name','send','index','Schedule','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','map','type','VIRTUAL','count','includeAll','include','rows','catch','show','params','options','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x22d12d,_0x100416){var _0x2b213c=function(_0x27293b){while(--_0x27293b){_0x22d12d['push'](_0x22d12d['shift']());}};_0x2b213c(++_0x100416);}(_0x147c,0x1ce));var _0xc147=function(_0x22e101,_0x412840){_0x22e101=_0x22e101-0x0;var _0xa51f61=_0x147c[_0x22e101];return _0xa51f61;};'use strict';var emlformat=require(_0xc147('0x0'));var rimraf=require(_0xc147('0x1'));var zipdir=require(_0xc147('0x2'));var jsonpatch=require(_0xc147('0x3'));var rp=require(_0xc147('0x4'));var moment=require(_0xc147('0x5'));var BPromise=require(_0xc147('0x6'));var Mustache=require(_0xc147('0x7'));var util=require(_0xc147('0x8'));var path=require('path');var sox=require(_0xc147('0x9'));var csv=require('to-csv');var ejs=require(_0xc147('0xa'));var fs=require('fs');var fs_extra=require(_0xc147('0xb'));var _=require('lodash');var squel=require(_0xc147('0xc'));var crypto=require(_0xc147('0xd'));var jsforce=require(_0xc147('0xe'));var deskjs=require(_0xc147('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc147('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc147('0x11'));var qs=require(_0xc147('0x12'));var as=require(_0xc147('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc147('0x14'));var config=require(_0xc147('0x15'));var licenseUtil=require(_0xc147('0x16'));var db=require(_0xc147('0x17'))['db'];function respondWithStatusCode(_0x5b3611,_0x15295a){_0x15295a=_0x15295a||0xcc;return function(_0x3e32ba){if(_0x3e32ba){return _0x5b3611[_0xc147('0x18')](_0x15295a);}return _0x5b3611[_0xc147('0x19')](_0x15295a)[_0xc147('0x1a')]();};}function respondWithResult(_0x3ce557,_0x504b3f){_0x504b3f=_0x504b3f||0xc8;return function(_0x16051d){if(_0x16051d){return _0x3ce557[_0xc147('0x19')](_0x504b3f)[_0xc147('0x1b')](_0x16051d);}};}function respondWithFilteredResult(_0x20c2d3,_0xd70ffb){return function(_0x2a165d){if(_0x2a165d){var _0x4f32e6=typeof _0xd70ffb[_0xc147('0x1c')]===_0xc147('0x1d')&&typeof _0xd70ffb['limit']===_0xc147('0x1d');var _0x474df7=_0x2a165d['count'];var _0x72e899=_0x4f32e6?0x0:_0xd70ffb[_0xc147('0x1c')];var _0xf955ce=_0x4f32e6?_0x2a165d['count']:_0xd70ffb[_0xc147('0x1c')]+_0xd70ffb[_0xc147('0x1e')];var _0x39262f;if(_0xf955ce>=_0x474df7){_0xf955ce=_0x474df7;_0x39262f=0xc8;}else{_0x39262f=0xce;}_0x20c2d3[_0xc147('0x19')](_0x39262f);return _0x20c2d3['set'](_0xc147('0x1f'),_0x72e899+'-'+_0xf955ce+'/'+_0x474df7)[_0xc147('0x1b')](_0x2a165d);}return null;};}function patchUpdates(_0x4b7902){return function(_0xda117b){try{jsonpatch['apply'](_0xda117b,_0x4b7902,!![]);}catch(_0x69fe77){return BPromise[_0xc147('0x20')](_0x69fe77);}return _0xda117b['save']();};}function saveUpdates(_0x35152d,_0x29448a){return function(_0x2a3f82){if(_0x2a3f82){return _0x2a3f82[_0xc147('0x21')](_0x35152d)['then'](function(_0x6cf90b){return _0x6cf90b;});}return null;};}function removeEntity(_0x4324a6,_0x5f2dcf){return function(_0x3b7c00){if(_0x3b7c00){return _0x3b7c00['destroy']()[_0xc147('0x22')](function(){var _0x33388d=_0x3b7c00['get']({'plain':!![]});var _0x1fe5ec=_0xc147('0x23');return db[_0xc147('0x24')]['destroy']({'where':{'type':_0x1fe5ec,'resourceId':_0x33388d['id']}})[_0xc147('0x22')](function(){return _0x3b7c00;});})['then'](function(){_0x4324a6[_0xc147('0x19')](0xcc)[_0xc147('0x1a')]();});}};}function handleEntityNotFound(_0x386507,_0xeb6ae2){return function(_0x1aaf60){if(!_0x1aaf60){_0x386507['sendStatus'](0x194);}return _0x1aaf60;};}function handleError(_0x35fedf,_0x423efa){_0x423efa=_0x423efa||0x1f4;return function(_0x1c49ac){logger['error'](_0x1c49ac[_0xc147('0x25')]);if(_0x1c49ac['name']){delete _0x1c49ac[_0xc147('0x26')];}_0x35fedf['status'](_0x423efa)[_0xc147('0x27')](_0x1c49ac);};}exports[_0xc147('0x28')]=function(_0x5d3b62,_0x5d51d5){var _0x3cb458={},_0x372cb6={},_0x2716c0={'count':0x0,'rows':[]};var _0x23d11c=_['map'](db[_0xc147('0x29')]['rawAttributes'],function(_0x34fa92){return{'name':_0x34fa92[_0xc147('0x2a')],'type':_0x34fa92['type']['key']};});_0x372cb6[_0xc147('0x2b')]=_['map'](_0x23d11c,_0xc147('0x26'));_0x372cb6[_0xc147('0x2c')]=_[_0xc147('0x2d')](_0x5d3b62['query']);_0x372cb6[_0xc147('0x2e')]=_['intersection'](_0x372cb6[_0xc147('0x2b')],_0x372cb6['query']);_0x3cb458['attributes']=_[_0xc147('0x2f')](_0x372cb6['model'],qs[_0xc147('0x30')](_0x5d3b62['query']['fields']));_0x3cb458[_0xc147('0x31')]=_0x3cb458[_0xc147('0x31')][_0xc147('0x32')]?_0x3cb458[_0xc147('0x31')]:_0x372cb6[_0xc147('0x2b')];if(!_0x5d3b62['query']['hasOwnProperty'](_0xc147('0x33'))){_0x3cb458['limit']=qs[_0xc147('0x1e')](_0x5d3b62['query'][_0xc147('0x1e')]);_0x3cb458['offset']=qs[_0xc147('0x1c')](_0x5d3b62[_0xc147('0x2c')][_0xc147('0x1c')]);}_0x3cb458[_0xc147('0x34')]=qs[_0xc147('0x35')](_0x5d3b62[_0xc147('0x2c')][_0xc147('0x35')]);_0x3cb458['where']=qs[_0xc147('0x2e')](_[_0xc147('0x36')](_0x5d3b62['query'],_0x372cb6[_0xc147('0x2e')]),_0x23d11c);if(_0x5d3b62[_0xc147('0x2c')][_0xc147('0x37')]){_0x3cb458['where']=_[_0xc147('0x38')](_0x3cb458[_0xc147('0x39')],{'$or':_[_0xc147('0x3a')](_0x23d11c,function(_0x2024de){if(_0x2024de[_0xc147('0x3b')]!==_0xc147('0x3c')){var _0x5466dc={};_0x5466dc[_0x2024de[_0xc147('0x26')]]={'$like':'%'+_0x5d3b62[_0xc147('0x2c')][_0xc147('0x37')]+'%'};return _0x5466dc;}})});}_0x3cb458=_[_0xc147('0x38')]({},_0x3cb458,_0x5d3b62['options']);var _0x251111={'where':_0x3cb458[_0xc147('0x39')]};return db[_0xc147('0x29')][_0xc147('0x3d')](_0x251111)[_0xc147('0x22')](function(_0x4aba0d){_0x2716c0[_0xc147('0x3d')]=_0x4aba0d;if(_0x5d3b62['query'][_0xc147('0x3e')]){_0x3cb458[_0xc147('0x3f')]=[{'all':!![]}];}return db[_0xc147('0x29')]['findAll'](_0x3cb458);})[_0xc147('0x22')](function(_0x4ac5a4){_0x2716c0[_0xc147('0x40')]=_0x4ac5a4;return _0x2716c0;})[_0xc147('0x22')](respondWithFilteredResult(_0x5d51d5,_0x3cb458))[_0xc147('0x41')](handleError(_0x5d51d5,null));};exports[_0xc147('0x42')]=function(_0x314d72,_0x28c4a8){var _0x4ee5cf={'raw':![],'where':{'id':_0x314d72[_0xc147('0x43')]['id']}},_0x4beef0={};_0x4beef0[_0xc147('0x2b')]=_[_0xc147('0x2d')](db[_0xc147('0x29')]['rawAttributes']);_0x4beef0[_0xc147('0x2c')]=_['keys'](_0x314d72[_0xc147('0x2c')]);_0x4beef0['filters']=_['intersection'](_0x4beef0[_0xc147('0x2b')],_0x4beef0[_0xc147('0x2c')]);_0x4ee5cf['attributes']=_[_0xc147('0x2f')](_0x4beef0[_0xc147('0x2b')],qs['fields'](_0x314d72[_0xc147('0x2c')][_0xc147('0x30')]));_0x4ee5cf[_0xc147('0x31')]=_0x4ee5cf['attributes'][_0xc147('0x32')]?_0x4ee5cf[_0xc147('0x31')]:_0x4beef0['model'];if(_0x314d72[_0xc147('0x2c')][_0xc147('0x3e')]){_0x4ee5cf[_0xc147('0x3f')]=[{'all':!![]}];}_0x4ee5cf=_['merge']({},_0x4ee5cf,_0x314d72[_0xc147('0x44')]);return db[_0xc147('0x29')][_0xc147('0x45')](_0x4ee5cf)[_0xc147('0x22')](handleEntityNotFound(_0x28c4a8,null))[_0xc147('0x22')](respondWithResult(_0x28c4a8,null))['catch'](handleError(_0x28c4a8,null));};exports[_0xc147('0x46')]=function(_0x18e985,_0x33e7e9){return db[_0xc147('0x29')][_0xc147('0x46')](_0x18e985[_0xc147('0x47')],{})['then'](function(_0x278858){var _0x27d141=_0x18e985[_0xc147('0x48')]['get']({'plain':!![]});if(!_0x27d141)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27d141['role']==='user'){var _0x1d3530=_0x278858['get']({'plain':!![]});var _0x307afa=_0xc147('0x23');return db[_0xc147('0x49')][_0xc147('0x45')]({'where':{'name':_0x307afa,'userProfileId':_0x27d141['userProfileId']},'raw':!![]})[_0xc147('0x22')](function(_0x322ac7){if(_0x322ac7&&_0x322ac7[_0xc147('0x4a')]===0x0){return db[_0xc147('0x24')][_0xc147('0x46')]({'name':_0x1d3530[_0xc147('0x26')],'resourceId':_0x1d3530['id'],'type':_0x322ac7[_0xc147('0x26')],'sectionId':_0x322ac7['id']},{})[_0xc147('0x22')](function(){return _0x278858;});}else{return _0x278858;}})['catch'](function(_0x1f6617){logger['error'](_0xc147('0x4b'),_0x1f6617);throw _0x1f6617;});}return _0x278858;})[_0xc147('0x22')](respondWithResult(_0x33e7e9,0xc9))['catch'](handleError(_0x33e7e9,null));};exports[_0xc147('0x21')]=function(_0x163cfd,_0x3786f3){if(_0x163cfd[_0xc147('0x47')]['id']){delete _0x163cfd[_0xc147('0x47')]['id'];}return db[_0xc147('0x29')][_0xc147('0x45')]({'where':{'id':_0x163cfd['params']['id']}})[_0xc147('0x22')](handleEntityNotFound(_0x3786f3,null))['then'](saveUpdates(_0x163cfd[_0xc147('0x47')],null))['then'](respondWithResult(_0x3786f3,null))[_0xc147('0x41')](handleError(_0x3786f3,null));};exports['destroy']=function(_0x55f1c6,_0xd0cca7){return db[_0xc147('0x29')][_0xc147('0x45')]({'where':{'id':_0x55f1c6[_0xc147('0x43')]['id']}})[_0xc147('0x22')](handleEntityNotFound(_0xd0cca7,null))[_0xc147('0x22')](removeEntity(_0xd0cca7,null))['catch'](handleError(_0xd0cca7,null));};exports['run']=function(_0x49cb25,_0x233264,_0x5f0560){var _0x190598=require(_0xc147('0x4c'));return db[_0xc147('0x29')][_0xc147('0x45')]({'where':{'id':_0x49cb25[_0xc147('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x233264,null))['then'](function(){_0x190598[_0xc147('0x4d')](_0x49cb25[_0xc147('0x43')]['id']);})[_0xc147('0x22')](respondWithStatusCode(_0x233264,null))[_0xc147('0x41')](handleError(_0x233264,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index f4fccc2..70f45e3 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 _0x257d=['path','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','../../config/logger','api','moment','request-promise'];(function(_0x3bba47,_0x29a236){var _0x555eea=function(_0x19a8e8){while(--_0x19a8e8){_0x3bba47['push'](_0x3bba47['shift']());}};_0x555eea(++_0x29a236);}(_0x257d,0x14b));var _0xd257=function(_0x41b0d7,_0x4c66f7){_0x41b0d7=_0x41b0d7-0x0;var _0x60f60f=_0x257d[_0x41b0d7];return _0x60f60f;};'use strict';var _=require(_0xd257('0x0'));var util=require('util');var logger=require(_0xd257('0x1'))(_0xd257('0x2'));var moment=require(_0xd257('0x3'));var BPromise=require('bluebird');var rp=require(_0xd257('0x4'));var fs=require('fs');var path=require(_0xd257('0x5'));var rimraf=require('rimraf');var config=require(_0xd257('0x6'));var attributes=require(_0xd257('0x7'));module[_0xd257('0x8')]=function(_0x425bd2,_0xf38390){return _0x425bd2[_0xd257('0x9')](_0xd257('0xa'),attributes,{'tableName':_0xd257('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e10=['exports','define','tools_schedules','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./schedule.attributes'];(function(_0x2e7a43,_0x3b3df4){var _0x52e9e1=function(_0x2c08cf){while(--_0x2c08cf){_0x2e7a43['push'](_0x2e7a43['shift']());}};_0x52e9e1(++_0x3b3df4);}(_0x6e10,0xd3));var _0x06e1=function(_0x4841be,_0x37f5bb){_0x4841be=_0x4841be-0x0;var _0x2dab66=_0x6e10[_0x4841be];return _0x2dab66;};'use strict';var _=require(_0x06e1('0x0'));var util=require(_0x06e1('0x1'));var logger=require(_0x06e1('0x2'))(_0x06e1('0x3'));var moment=require(_0x06e1('0x4'));var BPromise=require('bluebird');var rp=require(_0x06e1('0x5'));var fs=require('fs');var path=require(_0x06e1('0x6'));var rimraf=require(_0x06e1('0x7'));var config=require(_0x06e1('0x8'));var attributes=require(_0x06e1('0x9'));module[_0x06e1('0xa')]=function(_0x11fbdd,_0x5e296f){return _0x11fbdd[_0x06e1('0xb')]('Schedule',attributes,{'tableName':_0x06e1('0xc'),'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 5798b6e..6635dbf 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 _0x864e=['../../config/environment','jayson/promise','client','http','request','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Schedule,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x864e,0x16e));var _0xe864=function(_0x345b0d,_0x5d5bae){_0x345b0d=_0x345b0d-0x0;var _0x1e8c58=_0x864e[_0x345b0d];return _0x1e8c58;};'use strict';var _=require(_0xe864('0x0'));var util=require(_0xe864('0x1'));var moment=require(_0xe864('0x2'));var BPromise=require(_0xe864('0x3'));var rs=require(_0xe864('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe864('0x5'))['db'];var utils=require(_0xe864('0x6'));var logger=require(_0xe864('0x7'))(_0xe864('0x8'));var config=require(_0xe864('0x9'));var jayson=require(_0xe864('0xa'));var client=jayson[_0xe864('0xb')][_0xe864('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x324fed,_0x123cde,_0x189089){return new BPromise(function(_0x114f71,_0x402fb0){return client[_0xe864('0xd')](_0x324fed,_0x189089)['then'](function(_0x364800){logger['info']('Schedule,\x20%s,\x20%s',_0x123cde,'request\x20sent');logger[_0xe864('0xe')](_0xe864('0xf'),_0x123cde,_0xe864('0x10'),JSON[_0xe864('0x11')](_0x364800));if(_0x364800[_0xe864('0x12')]){if(_0x364800['error'][_0xe864('0x13')]===0x1f4){logger[_0xe864('0x12')](_0xe864('0x14'),_0x123cde,_0x364800[_0xe864('0x12')][_0xe864('0x15')]);return _0x402fb0(_0x364800[_0xe864('0x12')][_0xe864('0x15')]);}logger[_0xe864('0x12')](_0xe864('0x14'),_0x123cde,_0x364800[_0xe864('0x12')][_0xe864('0x15')]);return _0x114f71(_0x364800[_0xe864('0x12')][_0xe864('0x15')]);}else{logger[_0xe864('0x16')](_0xe864('0x14'),_0x123cde,'request\x20sent');_0x114f71(_0x364800[_0xe864('0x17')][_0xe864('0x15')]);}})[_0xe864('0x18')](function(_0x20a665){logger[_0xe864('0x12')](_0xe864('0x14'),_0x123cde,_0x20a665);_0x402fb0(_0x20a665);});});} \ No newline at end of file +var _0xceb3=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2c4b09,_0x421fb5){var _0x3dce8a=function(_0x10c74a){while(--_0x10c74a){_0x2c4b09['push'](_0x2c4b09['shift']());}};_0x3dce8a(++_0x421fb5);}(_0xceb3,0xfc));var _0x3ceb=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xceb3[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0x3ceb('0x0'));var util=require('util');var moment=require(_0x3ceb('0x1'));var BPromise=require(_0x3ceb('0x2'));var rs=require(_0x3ceb('0x3'));var fs=require('fs');var Redis=require(_0x3ceb('0x4'));var db=require(_0x3ceb('0x5'))['db'];var utils=require(_0x3ceb('0x6'));var logger=require(_0x3ceb('0x7'))(_0x3ceb('0x8'));var config=require(_0x3ceb('0x9'));var jayson=require(_0x3ceb('0xa'));var client=jayson[_0x3ceb('0xb')][_0x3ceb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x519a13,_0x27c46c,_0xc63b27){return new BPromise(function(_0x1efa28,_0x1634dc){return client[_0x3ceb('0xd')](_0x519a13,_0xc63b27)['then'](function(_0x89dbcd){logger[_0x3ceb('0xe')](_0x3ceb('0xf'),_0x27c46c,_0x3ceb('0x10'));logger[_0x3ceb('0x11')](_0x3ceb('0x12'),_0x27c46c,_0x3ceb('0x10'),JSON[_0x3ceb('0x13')](_0x89dbcd));if(_0x89dbcd['error']){if(_0x89dbcd[_0x3ceb('0x14')][_0x3ceb('0x15')]===0x1f4){logger['error'](_0x3ceb('0xf'),_0x27c46c,_0x89dbcd['error'][_0x3ceb('0x16')]);return _0x1634dc(_0x89dbcd[_0x3ceb('0x14')][_0x3ceb('0x16')]);}logger['error'](_0x3ceb('0xf'),_0x27c46c,_0x89dbcd['error'][_0x3ceb('0x16')]);return _0x1efa28(_0x89dbcd['error'][_0x3ceb('0x16')]);}else{logger[_0x3ceb('0xe')](_0x3ceb('0xf'),_0x27c46c,_0x3ceb('0x10'));_0x1efa28(_0x89dbcd[_0x3ceb('0x17')]['message']);}})[_0x3ceb('0x18')](function(_0x1adea2){logger[_0x3ceb('0x14')]('Schedule,\x20%s,\x20%s',_0x27c46c,_0x1adea2);_0x1634dc(_0x1adea2);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index c95607d..d3a312c 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 _0x7b6e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','isAuthenticated','/:id','/:id/download','download','post','put','update','destroy','exports','util','path','express','fs-extra'];(function(_0x20fc5f,_0x30f4b6){var _0x51c076=function(_0x3689f4){while(--_0x3689f4){_0x20fc5f['push'](_0x20fc5f['shift']());}};_0x51c076(++_0x30f4b6);}(_0x7b6e,0x18c));var _0xe7b6=function(_0x4f708f,_0x19857c){_0x4f708f=_0x4f708f-0x0;var _0xc14ea8=_0x7b6e[_0x4f708f];return _0xc14ea8;};'use strict';var multer=require('multer');var util=require(_0xe7b6('0x0'));var path=require(_0xe7b6('0x1'));var timeout=require('connect-timeout');var express=require(_0xe7b6('0x2'));var router=express['Router']();var fs_extra=require(_0xe7b6('0x3'));var auth=require(_0xe7b6('0x4'));var interaction=require(_0xe7b6('0x5'));var config=require(_0xe7b6('0x6'));var controller=require(_0xe7b6('0x7'));router[_0xe7b6('0x8')]('/',auth['isAuthenticated'](),controller[_0xe7b6('0x9')]);router[_0xe7b6('0x8')](_0xe7b6('0xa'),auth[_0xe7b6('0xb')](),controller['describe']);router[_0xe7b6('0x8')](_0xe7b6('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xe7b6('0x8')](_0xe7b6('0xd'),auth['isAuthenticated'](),controller[_0xe7b6('0xe')]);router[_0xe7b6('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe7b6('0x10')](_0xe7b6('0xc'),auth['isAuthenticated'](),controller[_0xe7b6('0x11')]);router['delete'](_0xe7b6('0xc'),auth[_0xe7b6('0xb')](),controller[_0xe7b6('0x12')]);module[_0xe7b6('0x13')]=router; \ No newline at end of file +var _0x9db8=['destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','/:id','create','put','update','delete'];(function(_0x2b2007,_0x50e30e){var _0x33cc8f=function(_0x1dea8b){while(--_0x1dea8b){_0x2b2007['push'](_0x2b2007['shift']());}};_0x33cc8f(++_0x50e30e);}(_0x9db8,0x157));var _0x89db=function(_0x4ce64a,_0x20363e){_0x4ce64a=_0x4ce64a-0x0;var _0xea198=_0x9db8[_0x4ce64a];return _0xea198;};'use strict';var multer=require(_0x89db('0x0'));var util=require('util');var path=require(_0x89db('0x1'));var timeout=require(_0x89db('0x2'));var express=require(_0x89db('0x3'));var router=express[_0x89db('0x4')]();var fs_extra=require(_0x89db('0x5'));var auth=require(_0x89db('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x89db('0x7'));var controller=require(_0x89db('0x8'));router[_0x89db('0x9')]('/',auth[_0x89db('0xa')](),controller['index']);router[_0x89db('0x9')](_0x89db('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x89db('0x9')](_0x89db('0xc'),auth[_0x89db('0xa')](),controller['show']);router[_0x89db('0x9')]('/:id/download',auth[_0x89db('0xa')](),controller['download']);router['post']('/',auth[_0x89db('0xa')](),controller[_0x89db('0xd')]);router[_0x89db('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x89db('0xf')]);router[_0x89db('0x10')](_0x89db('0xc'),auth['isAuthenticated'](),controller[_0x89db('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 23bd3a3..3976a6e 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 _0x6d0c=['duration','DATE','getDataValue','toString','format','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt'];(function(_0x5082f6,_0x25b56c){var _0xbe305b=function(_0x4f0005){while(--_0x4f0005){_0x5082f6['push'](_0x5082f6['shift']());}};_0xbe305b(++_0x25b56c);}(_0x6d0c,0x8c));var _0xc6d0=function(_0x46ace8,_0x233c78){_0x46ace8=_0x46ace8-0x0;var _0x1604ef=_0x6d0c[_0x46ace8];return _0x1604ef;};'use strict';var Sequelize=require(_0xc6d0('0x0'));var moment=require(_0xc6d0('0x1'));var path=require(_0xc6d0('0x2'));var config=require(_0xc6d0('0x3'));module[_0xc6d0('0x4')]={'format':{'type':Sequelize[_0xc6d0('0x5')],'get':function(){return this['getDataValue'](_0xc6d0('0x6'))?path['extname'](this['getDataValue'](_0xc6d0('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xc6d0('0x7')],'set':function(_0x40ba33){var _0xf1bb4f=_0x40ba33[_0xc6d0('0x8')](/\\/g,'/');this[_0xc6d0('0x9')](_0xc6d0('0x6'),_0xf1bb4f);}},'rating':{'type':Sequelize[_0xc6d0('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xc6d0('0xa')],'set':function(_0x1452b5){this[_0xc6d0('0x9')](_0xc6d0('0xb'),moment()[_0xc6d0('0xc')](_0x1452b5,'ms'));this[_0xc6d0('0x9')](_0xc6d0('0xd'),moment());this[_0xc6d0('0x9')](_0xc6d0('0xe'),_0x1452b5);}},'startedAt':{'type':Sequelize[_0xc6d0('0xf')],'get':function(){return moment(this[_0xc6d0('0x10')](_0xc6d0('0xb')))['format']('MM-DD-YYYY\x20HH:mm')[_0xc6d0('0x11')]();}},'closedAt':{'type':Sequelize[_0xc6d0('0xf')],'get':function(){return moment(this['getDataValue'](_0xc6d0('0xd')))[_0xc6d0('0x12')](_0xc6d0('0x13'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xc6d0('0x10')](_0xc6d0('0x14')))[_0xc6d0('0x12')]('MM-DD-YYYY\x20HH:mm')[_0xc6d0('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xc6d0('0x10')](_0xc6d0('0x15')))[_0xc6d0('0x12')](_0xc6d0('0x13'))[_0xc6d0('0x11')]();}}}; \ No newline at end of file +var _0x48ac=['format','MM-DD-YYYY\x20HH:mm','toString','createdAt','moment','../../config/environment','exports','VIRTUAL','value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE'];(function(_0x41240d,_0x2ba004){var _0xac5e0a=function(_0x27cae7){while(--_0x27cae7){_0x41240d['push'](_0x41240d['shift']());}};_0xac5e0a(++_0x2ba004);}(_0x48ac,0xe0));var _0xc48a=function(_0x3571b7,_0x149d23){_0x3571b7=_0x3571b7-0x0;var _0x1ea6c1=_0x48ac[_0x3571b7];return _0x1ea6c1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc48a('0x0'));var path=require('path');var config=require(_0xc48a('0x1'));module[_0xc48a('0x2')]={'format':{'type':Sequelize[_0xc48a('0x3')],'get':function(){return this['getDataValue'](_0xc48a('0x4'))?path[_0xc48a('0x5')](this[_0xc48a('0x6')](_0xc48a('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xc48a('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x5df462){var _0x5cffd4=_0x5df462[_0xc48a('0x8')](/\\/g,'/');this[_0xc48a('0x9')](_0xc48a('0x4'),_0x5cffd4);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xc48a('0xa')],'set':function(_0x43461a){this[_0xc48a('0x9')](_0xc48a('0xb'),moment()[_0xc48a('0xc')](_0x43461a,'ms'));this[_0xc48a('0x9')](_0xc48a('0xd'),moment());this[_0xc48a('0x9')](_0xc48a('0xe'),_0x43461a);}},'startedAt':{'type':Sequelize[_0xc48a('0xf')],'get':function(){return moment(this[_0xc48a('0x6')]('startedAt'))[_0xc48a('0x10')](_0xc48a('0x11'))[_0xc48a('0x12')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xc48a('0x6')](_0xc48a('0xd')))['format'](_0xc48a('0x11'))[_0xc48a('0x12')]();}},'createdAt':{'type':Sequelize[_0xc48a('0xf')],'get':function(){return moment(this['getDataValue'](_0xc48a('0x13')))[_0xc48a('0x10')](_0xc48a('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0xc48a('0xf')],'get':function(){return moment(this[_0xc48a('0x6')]('updatedAt'))['format'](_0xc48a('0x11'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 0728c9a..f7451a9 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 _0x6aa7=['fieldName','type','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','find','catch','create','body','duration','createdAt','closedAt','params','describe','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','secrets','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','download','message','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','rawAttributes'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6aa7,0x178));var _0x76aa=function(_0x2ea79a,_0x17e5f7){_0x2ea79a=_0x2ea79a-0x0;var _0x674291=_0x6aa7[_0x2ea79a];return _0x674291;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x19')](_0x5df49c);}return _0x112c39[_0x76aa('0x1a')](_0x5df49c)[_0x76aa('0x1b')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x1a')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=typeof _0x319bf1['offset']===_0x76aa('0x1c')&&typeof _0x319bf1['limit']===_0x76aa('0x1c');var _0x413cf6=_0x5cf594[_0x76aa('0x1d')];var _0x21c16d=_0x2111c7?0x0:_0x319bf1[_0x76aa('0x1e')];var _0x3ead3f=_0x2111c7?_0x5cf594['count']:_0x319bf1['offset']+_0x319bf1[_0x76aa('0x1f')];var _0x454dd3;if(_0x3ead3f>=_0x413cf6){_0x3ead3f=_0x413cf6;_0x454dd3=0xc8;}else{_0x454dd3=0xce;}_0x180d92[_0x76aa('0x1a')](_0x454dd3);return _0x180d92[_0x76aa('0x20')](_0x76aa('0x21'),_0x21c16d+'-'+_0x3ead3f+'/'+_0x413cf6)[_0x76aa('0x22')](_0x5cf594);}return null;};}function patchUpdates(_0x19af92){return function(_0x2eaf48){try{jsonpatch[_0x76aa('0x23')](_0x2eaf48,_0x19af92,!![]);}catch(_0x5990c1){return BPromise[_0x76aa('0x24')](_0x5990c1);}return _0x2eaf48[_0x76aa('0x25')]();};}function saveUpdates(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x26')](_0x338a6b)[_0x76aa('0x27')](function(_0x2bd2c6){return _0x2bd2c6;});}return null;};}function removeEntity(_0x29c50c,_0xc1044c){return function(_0x3cd039){if(_0x3cd039){return _0x3cd039[_0x76aa('0x28')]()[_0x76aa('0x27')](function(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x26b75e,_0x3599a9){return function(_0x4ef9b0){if(!_0x4ef9b0){_0x26b75e[_0x76aa('0x19')](0x194);}return _0x4ef9b0;};}function handleError(_0x1d6d15,_0x25c614){_0x25c614=_0x25c614||0x1f4;return function(_0x2e7ab4){logger[_0x76aa('0x29')](_0x2e7ab4[_0x76aa('0x2a')]);if(_0x2e7ab4[_0x76aa('0x2b')]){delete _0x2e7ab4[_0x76aa('0x2b')];}_0x1d6d15[_0x76aa('0x1a')](_0x25c614)[_0x76aa('0x2c')](_0x2e7ab4);};}exports['index']=function(_0x3fcb7f,_0x5a8030){var _0x994550={},_0x365ff8={},_0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x2d')](db[_0x76aa('0x2e')][_0x76aa('0x2f')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x30')],'type':_0x3827ec[_0x76aa('0x31')]['key']};});_0x365ff8[_0x76aa('0x32')]=_[_0x76aa('0x33')](_[_0x76aa('0x2d')](_0x1e90b9,_0x76aa('0x2b')),[_0x76aa('0x34')]);_0x365ff8[_0x76aa('0x35')]=_[_0x76aa('0x36')](_0x3fcb7f['query']);_0x365ff8[_0x76aa('0x37')]=_[_0x76aa('0x38')](_0x365ff8['model'],_0x365ff8[_0x76aa('0x35')]);_0x994550['attributes']=_[_0x76aa('0x38')](_0x365ff8['model'],qs[_0x76aa('0x39')](_0x3fcb7f['query']['fields']));_0x994550[_0x76aa('0x3a')]=_0x994550[_0x76aa('0x3a')][_0x76aa('0x3b')]?_0x994550[_0x76aa('0x3a')]:_0x365ff8['model'];if(!_0x3fcb7f['query'][_0x76aa('0x3c')](_0x76aa('0x3d'))){_0x994550[_0x76aa('0x1f')]=qs[_0x76aa('0x1f')](_0x3fcb7f[_0x76aa('0x35')]['limit']);_0x994550[_0x76aa('0x1e')]=qs['offset'](_0x3fcb7f['query'][_0x76aa('0x1e')]);}_0x994550[_0x76aa('0x3e')]=qs[_0x76aa('0x3f')](_0x3fcb7f[_0x76aa('0x35')]['sort']);_0x994550[_0x76aa('0x40')]=qs[_0x76aa('0x37')](_[_0x76aa('0x41')](_0x3fcb7f['query'],_0x365ff8[_0x76aa('0x37')]),_0x1e90b9);if(_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x42')]){_0x994550[_0x76aa('0x40')]=_[_0x76aa('0x43')](_0x994550[_0x76aa('0x40')],{'$or':_[_0x76aa('0x2d')](_0x1e90b9,function(_0x307d67){if(_0x307d67[_0x76aa('0x31')]!=='VIRTUAL'){var _0x1525cb={};_0x1525cb[_0x307d67[_0x76aa('0x2b')]]={'$like':'%'+_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x42')]+'%'};return _0x1525cb;}})});}_0x994550=_[_0x76aa('0x43')]({},_0x994550,_0x3fcb7f[_0x76aa('0x44')]);var _0x572fdb={'where':_0x994550['where']};return db[_0x76aa('0x2e')][_0x76aa('0x1d')](_0x572fdb)[_0x76aa('0x27')](function(_0x365612){_0x2dec94['count']=_0x365612;if(_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x45')]){_0x994550[_0x76aa('0x46')]=[{'all':!![]}];}return db[_0x76aa('0x2e')][_0x76aa('0x47')](_0x994550);})['then'](function(_0x13dafe){_0x2dec94['rows']=_0x13dafe;return _0x2dec94;})[_0x76aa('0x27')](respondWithFilteredResult(_0x5a8030,_0x994550))['catch'](handleError(_0x5a8030,null));};exports['show']=function(_0x4f7f3a,_0x144f0a){var _0x541594={'raw':![],'where':{'id':_0x4f7f3a['params']['id']}},_0x5cf314={};_0x5cf314[_0x76aa('0x32')]=_[_0x76aa('0x36')](db[_0x76aa('0x2e')][_0x76aa('0x2f')]);_0x5cf314[_0x76aa('0x35')]=_['keys'](_0x4f7f3a[_0x76aa('0x35')]);_0x5cf314[_0x76aa('0x37')]=_[_0x76aa('0x38')](_0x5cf314[_0x76aa('0x32')],_0x5cf314[_0x76aa('0x35')]);_0x541594['attributes']=_[_0x76aa('0x38')](_0x5cf314[_0x76aa('0x32')],qs['fields'](_0x4f7f3a[_0x76aa('0x35')]['fields']));_0x541594[_0x76aa('0x3a')]=_0x541594[_0x76aa('0x3a')][_0x76aa('0x3b')]?_0x541594[_0x76aa('0x3a')]:_0x5cf314[_0x76aa('0x32')];if(_0x4f7f3a[_0x76aa('0x35')][_0x76aa('0x45')]){_0x541594[_0x76aa('0x46')]=[{'all':!![]}];}_0x541594=_[_0x76aa('0x43')]({},_0x541594,_0x4f7f3a[_0x76aa('0x44')]);return db['ScreenRecording'][_0x76aa('0x48')](_0x541594)['then'](handleEntityNotFound(_0x144f0a,null))[_0x76aa('0x27')](respondWithResult(_0x144f0a,null))[_0x76aa('0x49')](handleError(_0x144f0a,null));};exports[_0x76aa('0x4a')]=function(_0x156d4e,_0x5ca721){return db['ScreenRecording'][_0x76aa('0x4a')](_0x156d4e['body'],{})[_0x76aa('0x27')](respondWithResult(_0x5ca721,0xc9))[_0x76aa('0x49')](handleError(_0x5ca721,null));};exports[_0x76aa('0x26')]=function(_0x2e5633,_0x30c577){if(_0x2e5633[_0x76aa('0x4b')]['id']){delete _0x2e5633['body']['id'];}delete _0x2e5633['body'][_0x76aa('0x4c')];delete _0x2e5633[_0x76aa('0x4b')][_0x76aa('0x4d')];delete _0x2e5633[_0x76aa('0x4b')][_0x76aa('0x4e')];delete _0x2e5633[_0x76aa('0x4b')]['value'];return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':{'id':_0x2e5633[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x30c577,null))[_0x76aa('0x27')](saveUpdates(_0x2e5633['body'],null))[_0x76aa('0x27')](respondWithResult(_0x30c577,null))['catch'](handleError(_0x30c577,null));};exports[_0x76aa('0x50')]=function(_0x4449c1,_0x3c63e5){return db[_0x76aa('0x2e')][_0x76aa('0x50')]()[_0x76aa('0x27')](respondWithResult(_0x3c63e5,null))[_0x76aa('0x49')](handleError(_0x3c63e5,null));};exports['download']=function(_0x186654,_0x5eeaa5,_0x3ee32){var _0x311bd5=require(_0x76aa('0x51'));var _0x53be10=![];var _0x3fa7ec={};if(_0x186654[_0x76aa('0x35')][_0x76aa('0x31')]&&_0x186654['query'][_0x76aa('0x31')]===_0x76aa('0x52')){_0x3fa7ec[_0x76aa('0x52')]=_0x186654[_0x76aa('0x4f')]['id'];}else{_0x3fa7ec['id']=_0x186654['params']['id'];}return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':_0x3fa7ec,'attributes':['id',_0x76aa('0x53')],'raw':!![]})[_0x76aa('0x27')](handleEntityNotFound(_0x5eeaa5,null))[_0x76aa('0x27')](function(_0xf7732){if(_0xf7732){var _0x4e6c09=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0xf7732[_0x76aa('0x53')]);var _0x3967f3=util[_0x76aa('0x34')](_0x76aa('0x57'),_0x4e6c09);if(fs['existsSync'](_0x3967f3)){_0x53be10=!![];return _0x311bd5['decryptFile'](_0x3967f3,_0x4e6c09,config[_0x76aa('0x58')][_0x76aa('0x59')])['then'](function(){return _0xf7732;});}return _0xf7732;}})[_0x76aa('0x27')](function(_0x1e6f3c){if(_0x1e6f3c){var _0x4f832d=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0x1e6f3c[_0x76aa('0x53')]);if(!fs[_0x76aa('0x5a')](_0x4f832d)){throw new db[(_0x76aa('0x5b'))][(_0x76aa('0x5c'))](_0x76aa('0x5d'));}if(_0x1e6f3c[_0x76aa('0x5e')]){return _0x5eeaa5['download'](_0x4f832d,_0x1e6f3c[_0x76aa('0x5e')]+path['extname'](_0x4f832d),function(){if(_0x53be10){fs[_0x76aa('0x5f')](_0x4f832d);}});}else{return _0x5eeaa5[_0x76aa('0x60')](_0x4f832d,function(_0x2fef92){if(_0x53be10){fs[_0x76aa('0x5f')](_0x4f832d);}});}}})[_0x76aa('0x49')](function(_0x260ad2){if(_0x260ad2[_0x76aa('0x61')]===_0x76aa('0x5d')){_0x5eeaa5[_0x76aa('0x1a')](0x194)['send'](_0x76aa('0x62'));}else{return handleError(_0x5eeaa5,null);}});};exports[_0x76aa('0x28')]=function(_0x5c542b,_0xe5957d){return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':{'id':_0x5c542b[_0x76aa('0x4f')]['id']}})[_0x76aa('0x27')](function(_0x5546b6){if(_[_0x76aa('0x63')](_0x5546b6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5546b6;})[_0x76aa('0x27')](function(_0x35881c){var _0x3e97f8=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0x35881c[_0x76aa('0x53')]);logger['info'](_0x76aa('0x64'),_0x3e97f8);if(!_[_0x76aa('0x63')](_0x35881c['value'])&&fs['existsSync'](_0x3e97f8)){logger[_0x76aa('0x65')](_0x76aa('0x66')+_0x3e97f8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x76aa('0x67')](_0x3e97f8);}_0x3e97f8=_0x3e97f8+_0x76aa('0x68');if(!_[_0x76aa('0x63')](_0x35881c['value'])&&fs[_0x76aa('0x5a')](_0x3e97f8)){logger['info'](_0x76aa('0x66')+_0x3e97f8+_0x76aa('0x69'));fs[_0x76aa('0x67')](_0x3e97f8);}return _0x35881c;})[_0x76aa('0x27')](function(_0x55ca84){if(!_0x55ca84)throw new InternalError();return _0x55ca84['destroy']();})[_0x76aa('0x27')](function(){_0xe5957d['status'](0xcc)[_0x76aa('0x1b')]();})[_0x76aa('0x49')](handleError(_0xe5957d,null));}; \ No newline at end of file +var _0x4b84=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','show','params','find','catch','create','body','duration','createdAt','closedAt','value','download','uniqueid','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','join','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','send','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','rawAttributes','fieldName','type','key','model','differenceBy','map','format'];(function(_0x53d867,_0x2e5c16){var _0x35c41d=function(_0x56cb31){while(--_0x56cb31){_0x53d867['push'](_0x53d867['shift']());}};_0x35c41d(++_0x2e5c16);}(_0x4b84,0x1cc));var _0x44b8=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0x4b84[_0x496333];return _0x44256e;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=typeof _0x1722da['offset']==='undefined'&&typeof _0x1722da[_0x44b8('0x17')]==='undefined';var _0x28ef36=_0x41ab46[_0x44b8('0x18')];var _0x55e258=_0x5e52f2?0x0:_0x1722da[_0x44b8('0x19')];var _0xe3de8f=_0x5e52f2?_0x41ab46['count']:_0x1722da[_0x44b8('0x19')]+_0x1722da[_0x44b8('0x17')];var _0x4b600f;if(_0xe3de8f>=_0x28ef36){_0xe3de8f=_0x28ef36;_0x4b600f=0xc8;}else{_0x4b600f=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x4b600f);return _0x2af0ad[_0x44b8('0x1a')](_0x44b8('0x1b'),_0x55e258+'-'+_0xe3de8f+'/'+_0x28ef36)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x102ef9){return function(_0x369c09){try{jsonpatch[_0x44b8('0x1c')](_0x369c09,_0x102ef9,!![]);}catch(_0x9b0536){return BPromise[_0x44b8('0x1d')](_0x9b0536);}return _0x369c09[_0x44b8('0x1e')]();};}function saveUpdates(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1f')](_0x1d642b)[_0x44b8('0x20')](function(_0x416b34){return _0x416b34;});}return null;};}function removeEntity(_0x1418db,_0x305a5c){return function(_0x51a34a){if(_0x51a34a){return _0x51a34a[_0x44b8('0x21')]()['then'](function(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x25a0c1,_0x47689e){return function(_0x230a3d){if(!_0x230a3d){_0x25a0c1['sendStatus'](0x194);}return _0x230a3d;};}function handleError(_0x474f01,_0x502acf){_0x502acf=_0x502acf||0x1f4;return function(_0x41d673){logger[_0x44b8('0x22')](_0x41d673['stack']);if(_0x41d673[_0x44b8('0x23')]){delete _0x41d673[_0x44b8('0x23')];}_0x474f01[_0x44b8('0x14')](_0x502acf)['send'](_0x41d673);};}exports[_0x44b8('0x24')]=function(_0x242342,_0x53d9c7){var _0x2e0174={},_0x4a182d={},_0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['ScreenRecording'][_0x44b8('0x25')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x26')],'type':_0x29b18d[_0x44b8('0x27')][_0x44b8('0x28')]};});_0x4a182d[_0x44b8('0x29')]=_[_0x44b8('0x2a')](_[_0x44b8('0x2b')](_0x5a544c,_0x44b8('0x23')),[_0x44b8('0x2c')]);_0x4a182d[_0x44b8('0x2d')]=_[_0x44b8('0x2e')](_0x242342[_0x44b8('0x2d')]);_0x4a182d['filters']=_[_0x44b8('0x2f')](_0x4a182d['model'],_0x4a182d[_0x44b8('0x2d')]);_0x2e0174[_0x44b8('0x30')]=_[_0x44b8('0x2f')](_0x4a182d[_0x44b8('0x29')],qs[_0x44b8('0x31')](_0x242342['query'][_0x44b8('0x31')]));_0x2e0174[_0x44b8('0x30')]=_0x2e0174[_0x44b8('0x30')][_0x44b8('0x32')]?_0x2e0174[_0x44b8('0x30')]:_0x4a182d['model'];if(!_0x242342[_0x44b8('0x2d')][_0x44b8('0x33')](_0x44b8('0x34'))){_0x2e0174[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x17')]);_0x2e0174[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x19')]);}_0x2e0174[_0x44b8('0x35')]=qs[_0x44b8('0x36')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x36')]);_0x2e0174[_0x44b8('0x37')]=qs[_0x44b8('0x38')](_[_0x44b8('0x39')](_0x242342[_0x44b8('0x2d')],_0x4a182d[_0x44b8('0x38')]),_0x5a544c);if(_0x242342[_0x44b8('0x2d')][_0x44b8('0x3a')]){_0x2e0174['where']=_[_0x44b8('0x3b')](_0x2e0174[_0x44b8('0x37')],{'$or':_['map'](_0x5a544c,function(_0x25688b){if(_0x25688b[_0x44b8('0x27')]!==_0x44b8('0x3c')){var _0x332c2b={};_0x332c2b[_0x25688b['name']]={'$like':'%'+_0x242342[_0x44b8('0x2d')][_0x44b8('0x3a')]+'%'};return _0x332c2b;}})});}_0x2e0174=_[_0x44b8('0x3b')]({},_0x2e0174,_0x242342[_0x44b8('0x3d')]);var _0x9cb2a={'where':_0x2e0174[_0x44b8('0x37')]};return db[_0x44b8('0x3e')][_0x44b8('0x18')](_0x9cb2a)[_0x44b8('0x20')](function(_0x3d1be1){_0xfb0028[_0x44b8('0x18')]=_0x3d1be1;if(_0x242342[_0x44b8('0x2d')][_0x44b8('0x3f')]){_0x2e0174[_0x44b8('0x40')]=[{'all':!![]}];}return db[_0x44b8('0x3e')][_0x44b8('0x41')](_0x2e0174);})['then'](function(_0x12a0a4){_0xfb0028[_0x44b8('0x42')]=_0x12a0a4;return _0xfb0028;})[_0x44b8('0x20')](respondWithFilteredResult(_0x53d9c7,_0x2e0174))['catch'](handleError(_0x53d9c7,null));};exports[_0x44b8('0x43')]=function(_0x1054c5,_0x229cc9){var _0x585a16={'raw':![],'where':{'id':_0x1054c5[_0x44b8('0x44')]['id']}},_0xbad4bb={};_0xbad4bb[_0x44b8('0x29')]=_[_0x44b8('0x2e')](db[_0x44b8('0x3e')]['rawAttributes']);_0xbad4bb['query']=_[_0x44b8('0x2e')](_0x1054c5[_0x44b8('0x2d')]);_0xbad4bb[_0x44b8('0x38')]=_[_0x44b8('0x2f')](_0xbad4bb[_0x44b8('0x29')],_0xbad4bb[_0x44b8('0x2d')]);_0x585a16[_0x44b8('0x30')]=_[_0x44b8('0x2f')](_0xbad4bb[_0x44b8('0x29')],qs[_0x44b8('0x31')](_0x1054c5[_0x44b8('0x2d')][_0x44b8('0x31')]));_0x585a16[_0x44b8('0x30')]=_0x585a16[_0x44b8('0x30')][_0x44b8('0x32')]?_0x585a16[_0x44b8('0x30')]:_0xbad4bb[_0x44b8('0x29')];if(_0x1054c5[_0x44b8('0x2d')][_0x44b8('0x3f')]){_0x585a16['include']=[{'all':!![]}];}_0x585a16=_['merge']({},_0x585a16,_0x1054c5[_0x44b8('0x3d')]);return db[_0x44b8('0x3e')][_0x44b8('0x45')](_0x585a16)[_0x44b8('0x20')](handleEntityNotFound(_0x229cc9,null))[_0x44b8('0x20')](respondWithResult(_0x229cc9,null))[_0x44b8('0x46')](handleError(_0x229cc9,null));};exports[_0x44b8('0x47')]=function(_0x4fe73f,_0x156070){return db['ScreenRecording'][_0x44b8('0x47')](_0x4fe73f[_0x44b8('0x48')],{})[_0x44b8('0x20')](respondWithResult(_0x156070,0xc9))[_0x44b8('0x46')](handleError(_0x156070,null));};exports[_0x44b8('0x1f')]=function(_0x35ca19,_0x491600){if(_0x35ca19[_0x44b8('0x48')]['id']){delete _0x35ca19[_0x44b8('0x48')]['id'];}delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x49')];delete _0x35ca19['body'][_0x44b8('0x4a')];delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x4b')];delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x4c')];return db[_0x44b8('0x3e')]['find']({'where':{'id':_0x35ca19[_0x44b8('0x44')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x491600,null))[_0x44b8('0x20')](saveUpdates(_0x35ca19[_0x44b8('0x48')],null))[_0x44b8('0x20')](respondWithResult(_0x491600,null))['catch'](handleError(_0x491600,null));};exports['describe']=function(_0x2516fc,_0x4eb344){return db[_0x44b8('0x3e')]['describe']()[_0x44b8('0x20')](respondWithResult(_0x4eb344,null))[_0x44b8('0x46')](handleError(_0x4eb344,null));};exports[_0x44b8('0x4d')]=function(_0x15f4c6,_0x2fa6b4,_0x32f588){var _0xdc67e8=require('../../components/encryptor');var _0x3ad278=![];var _0x37b2c2={};if(_0x15f4c6[_0x44b8('0x2d')]['type']&&_0x15f4c6[_0x44b8('0x2d')][_0x44b8('0x27')]===_0x44b8('0x4e')){_0x37b2c2[_0x44b8('0x4e')]=_0x15f4c6['params']['id'];}else{_0x37b2c2['id']=_0x15f4c6[_0x44b8('0x44')]['id'];}return db[_0x44b8('0x3e')]['find']({'where':_0x37b2c2,'attributes':['id',_0x44b8('0x4c')],'raw':!![]})[_0x44b8('0x20')](handleEntityNotFound(_0x2fa6b4,null))[_0x44b8('0x20')](function(_0x3df6aa){if(_0x3df6aa){var _0xe86e34=path['join'](config['root'],_0x44b8('0x4f'),_0x3df6aa[_0x44b8('0x4c')]);var _0xa30834=util[_0x44b8('0x2c')](_0x44b8('0x50'),_0xe86e34);if(fs[_0x44b8('0x51')](_0xa30834)){_0x3ad278=!![];return _0xdc67e8[_0x44b8('0x52')](_0xa30834,_0xe86e34,config[_0x44b8('0x53')][_0x44b8('0x54')])[_0x44b8('0x20')](function(){return _0x3df6aa;});}return _0x3df6aa;}})[_0x44b8('0x20')](function(_0x3f7576){if(_0x3f7576){var _0x5af3e6=path[_0x44b8('0x55')](config[_0x44b8('0x56')],_0x44b8('0x4f'),_0x3f7576[_0x44b8('0x4c')]);if(!fs[_0x44b8('0x51')](_0x5af3e6)){throw new db[(_0x44b8('0x57'))][(_0x44b8('0x58'))](_0x44b8('0x59'));}if(_0x3f7576[_0x44b8('0x5a')]){return _0x2fa6b4[_0x44b8('0x4d')](_0x5af3e6,_0x3f7576[_0x44b8('0x5a')]+path[_0x44b8('0x5b')](_0x5af3e6),function(){if(_0x3ad278){fs[_0x44b8('0x5c')](_0x5af3e6);}});}else{return _0x2fa6b4[_0x44b8('0x4d')](_0x5af3e6,function(_0x2250bb){if(_0x3ad278){fs[_0x44b8('0x5c')](_0x5af3e6);}});}}})[_0x44b8('0x46')](function(_0x20e563){if(_0x20e563['message']===_0x44b8('0x59')){_0x2fa6b4[_0x44b8('0x14')](0x194)[_0x44b8('0x5d')](_0x44b8('0x5e'));}else{return handleError(_0x2fa6b4,null);}});};exports[_0x44b8('0x21')]=function(_0x29ed5d,_0x2ecf65){return db['ScreenRecording'][_0x44b8('0x45')]({'where':{'id':_0x29ed5d[_0x44b8('0x44')]['id']}})['then'](function(_0x2a95f6){if(_[_0x44b8('0x5f')](_0x2a95f6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2a95f6;})[_0x44b8('0x20')](function(_0x454fe6){var _0x370618=path['join'](config[_0x44b8('0x56')],'server/files/screen_recordings',_0x454fe6[_0x44b8('0x4c')]);logger['info'](_0x44b8('0x60'),_0x370618);if(!_[_0x44b8('0x5f')](_0x454fe6[_0x44b8('0x4c')])&&fs[_0x44b8('0x51')](_0x370618)){logger[_0x44b8('0x61')](_0x44b8('0x62')+_0x370618+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x44b8('0x63')](_0x370618);}_0x370618=_0x370618+'.cypher';if(!_[_0x44b8('0x5f')](_0x454fe6[_0x44b8('0x4c')])&&fs['existsSync'](_0x370618)){logger[_0x44b8('0x61')](_0x44b8('0x62')+_0x370618+_0x44b8('0x64'));fs[_0x44b8('0x63')](_0x370618);}return _0x454fe6;})[_0x44b8('0x20')](function(_0x3774fe){if(!_0x3774fe)throw new InternalError();return _0x3774fe[_0x44b8('0x21')]();})[_0x44b8('0x20')](function(){_0x2ecf65[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();})[_0x44b8('0x46')](handleError(_0x2ecf65,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 5e7f3ca..4e37586 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 _0xbf10=['interactionid','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','exports','define','ScreenRecording'];(function(_0xa4ef5d,_0x32043e){var _0x29d103=function(_0x147138){while(--_0x147138){_0xa4ef5d['push'](_0xa4ef5d['shift']());}};_0x29d103(++_0x32043e);}(_0xbf10,0xe8));var _0x0bf1=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xbf10[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0bf1('0x0'));var util=require(_0x0bf1('0x1'));var logger=require(_0x0bf1('0x2'))('api');var moment=require(_0x0bf1('0x3'));var BPromise=require('bluebird');var rp=require(_0x0bf1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0bf1('0x5'));var config=require(_0x0bf1('0x6'));var attributes=require('./screenRecording.attributes');module[_0x0bf1('0x7')]=function(_0x3261de,_0x3cb457){return _0x3261de[_0x0bf1('0x8')](_0x0bf1('0x9'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x0bf1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf4b1=['screen_recordings','interactionid','../../config/logger','api','moment','request-promise','rimraf','./screenRecording.attributes','exports'];(function(_0x4e4dbe,_0x337920){var _0x776b1d=function(_0x48698a){while(--_0x48698a){_0x4e4dbe['push'](_0x4e4dbe['shift']());}};_0x776b1d(++_0x337920);}(_0xf4b1,0x1cd));var _0x1f4b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf4b1[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f4b('0x0'))(_0x1f4b('0x1'));var moment=require(_0x1f4b('0x2'));var BPromise=require('bluebird');var rp=require(_0x1f4b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f4b('0x4'));var config=require('../../config/environment');var attributes=require(_0x1f4b('0x5'));module[_0x1f4b('0x6')]=function(_0x44812a,_0x31ffe2){return _0x44812a['define']('ScreenRecording',attributes,{'tableName':_0x1f4b('0x7'),'paranoid':![],'indexes':[{'name':_0x1f4b('0x8'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index c65c447..7a9a505 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 _0x542e=['lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','http','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x542e,0x85));var _0xe542=function(_0x402861,_0xd760fe){_0x402861=_0x402861-0x0;var _0x120aff=_0x542e[_0x402861];return _0x120aff;};'use strict';var _=require(_0xe542('0x0'));var util=require(_0xe542('0x1'));var moment=require('moment');var BPromise=require(_0xe542('0x2'));var rs=require(_0xe542('0x3'));var fs=require('fs');var Redis=require(_0xe542('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe542('0x5'))(_0xe542('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe542('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f8630,_0x1d3bf0,_0x1f8ca2){return new BPromise(function(_0x114f05,_0x4158aa){return client[_0xe542('0x8')](_0x4f8630,_0x1f8ca2)[_0xe542('0x9')](function(_0xbe6690){logger[_0xe542('0xa')](_0xe542('0xb'),_0x1d3bf0,'request\x20sent');logger[_0xe542('0xc')](_0xe542('0xd'),_0x1d3bf0,_0xe542('0xe'),JSON[_0xe542('0xf')](_0xbe6690));if(_0xbe6690['error']){if(_0xbe6690[_0xe542('0x10')]['code']===0x1f4){logger['error'](_0xe542('0xb'),_0x1d3bf0,_0xbe6690['error'][_0xe542('0x11')]);return _0x4158aa(_0xbe6690['error']['message']);}logger[_0xe542('0x10')](_0xe542('0xb'),_0x1d3bf0,_0xbe6690['error'][_0xe542('0x11')]);return _0x114f05(_0xbe6690[_0xe542('0x10')][_0xe542('0x11')]);}else{logger[_0xe542('0xa')](_0xe542('0xb'),_0x1d3bf0,_0xe542('0xe'));_0x114f05(_0xbe6690[_0xe542('0x12')][_0xe542('0x11')]);}})['catch'](function(_0x18d9e8){logger[_0xe542('0x10')](_0xe542('0xb'),_0x1d3bf0,_0x18d9e8);_0x4158aa(_0x18d9e8);});});} \ No newline at end of file +var _0x8ba1=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8ba1,0x182));var _0x18ba=function(_0x4f4774,_0x3e39d2){_0x4f4774=_0x4f4774-0x0;var _0x2a8ace=_0x8ba1[_0x4f4774];return _0x2a8ace;};'use strict';var _=require(_0x18ba('0x0'));var util=require('util');var moment=require(_0x18ba('0x1'));var BPromise=require(_0x18ba('0x2'));var rs=require(_0x18ba('0x3'));var fs=require('fs');var Redis=require(_0x18ba('0x4'));var db=require(_0x18ba('0x5'))['db'];var utils=require(_0x18ba('0x6'));var logger=require(_0x18ba('0x7'))(_0x18ba('0x8'));var config=require(_0x18ba('0x9'));var jayson=require(_0x18ba('0xa'));var client=jayson['client'][_0x18ba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x215f0e,_0x3e3bd1,_0x282391){return new BPromise(function(_0x132971,_0x347830){return client['request'](_0x215f0e,_0x282391)[_0x18ba('0xc')](function(_0x551f8d){logger[_0x18ba('0xd')](_0x18ba('0xe'),_0x3e3bd1,'request\x20sent');logger[_0x18ba('0xf')](_0x18ba('0x10'),_0x3e3bd1,_0x18ba('0x11'),JSON[_0x18ba('0x12')](_0x551f8d));if(_0x551f8d['error']){if(_0x551f8d[_0x18ba('0x13')][_0x18ba('0x14')]===0x1f4){logger[_0x18ba('0x13')](_0x18ba('0xe'),_0x3e3bd1,_0x551f8d[_0x18ba('0x13')][_0x18ba('0x15')]);return _0x347830(_0x551f8d[_0x18ba('0x13')][_0x18ba('0x15')]);}logger['error'](_0x18ba('0xe'),_0x3e3bd1,_0x551f8d[_0x18ba('0x13')][_0x18ba('0x15')]);return _0x132971(_0x551f8d[_0x18ba('0x13')]['message']);}else{logger['info'](_0x18ba('0xe'),_0x3e3bd1,_0x18ba('0x11'));_0x132971(_0x551f8d[_0x18ba('0x16')][_0x18ba('0x15')]);}})[_0x18ba('0x17')](function(_0x26a892){logger[_0x18ba('0x13')](_0x18ba('0xe'),_0x3e3bd1,_0x26a892);_0x347830(_0x26a892);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 9952545..29a4bdb 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 _0x6058=['/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','extname','originalname','post','/:id/logo','single','file','addLogo','%s%s','logologin','addPreferred','favicon','addFavicon','/:id','isAuthenticated','update','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','index','get','/now','getDate','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred'];(function(_0x4c1d49,_0x5ecfc1){var _0x389663=function(_0x3dfbf4){while(--_0x3dfbf4){_0x4c1d49['push'](_0x4c1d49['shift']());}};_0x389663(++_0x5ecfc1);}(_0x6058,0x188));var _0x8605=function(_0x5751e6,_0x125e5e){_0x5751e6=_0x5751e6-0x0;var _0x4199e4=_0x6058[_0x5751e6];return _0x4199e4;};'use strict';var multer=require(_0x8605('0x0'));var util=require(_0x8605('0x1'));var path=require(_0x8605('0x2'));var timeout=require('connect-timeout');var express=require(_0x8605('0x3'));var router=express['Router']();var fs_extra=require(_0x8605('0x4'));var auth=require(_0x8605('0x5'));var interaction=require(_0x8605('0x6'));var config=require(_0x8605('0x7'));var controller=require(_0x8605('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x8605('0x9')]);router[_0x8605('0xa')](_0x8605('0xb'),controller[_0x8605('0xc')]);router[_0x8605('0xa')]('/:id',controller['show']);router[_0x8605('0xa')]('/:id/logo',controller['getLogo']);router[_0x8605('0xa')](_0x8605('0xd'),controller[_0x8605('0xe')]);router[_0x8605('0xa')](_0x8605('0xf'),controller[_0x8605('0x10')]);router[_0x8605('0xa')](_0x8605('0x11'),controller['getPreferred']);router[_0x8605('0xa')](_0x8605('0x12'),controller[_0x8605('0x13')]);var upload=multer({'storage':multer[_0x8605('0x14')]({'destination':function(_0x392871,_0x1235a7,_0x5c1064){_0x5c1064(null,path[_0x8605('0x15')](config[_0x8605('0x16')],_0x8605('0x17')));},'filename':function(_0x114de2,_0x24a6a7,_0x3bf376){_0x3bf376(null,util[_0x8605('0x18')]('%s%s','logo',path[_0x8605('0x19')](_0x24a6a7[_0x8605('0x1a')])));}})});router[_0x8605('0x1b')](_0x8605('0x1c'),upload[_0x8605('0x1d')](_0x8605('0x1e')),controller[_0x8605('0x1f')]);var upload=multer({'storage':multer[_0x8605('0x14')]({'destination':function(_0x28c188,_0x59de4d,_0x274777){_0x274777(null,path[_0x8605('0x15')](config[_0x8605('0x16')],_0x8605('0x17')));},'filename':function(_0x414358,_0x50f1e4,_0xbdf07a){_0xbdf07a(null,util[_0x8605('0x18')](_0x8605('0x20'),_0x8605('0x21'),path[_0x8605('0x19')](_0x50f1e4[_0x8605('0x1a')])));}})});router[_0x8605('0x1b')](_0x8605('0xd'),upload[_0x8605('0x1d')](_0x8605('0x1e')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x8605('0x14')]({'destination':function(_0x2f318d,_0x112cd6,_0x45e5f2){_0x45e5f2(null,path[_0x8605('0x15')](config[_0x8605('0x16')],_0x8605('0x17')));},'filename':function(_0x21fce0,_0x362e6d,_0x1ec48e){_0x1ec48e(null,util[_0x8605('0x18')](_0x8605('0x20'),'preferred',path[_0x8605('0x19')](_0x362e6d[_0x8605('0x1a')])));}})});router[_0x8605('0x1b')]('/:id/preferred',upload[_0x8605('0x1d')]('file'),controller[_0x8605('0x22')]);var upload=multer({'storage':multer[_0x8605('0x14')]({'destination':function(_0x813bc3,_0x2c4009,_0x267121){_0x267121(null,path['join'](config[_0x8605('0x16')],'server/files/images/logos/'));},'filename':function(_0x4331ad,_0x163d1e,_0x2be66){_0x2be66(null,util[_0x8605('0x18')]('%s%s',_0x8605('0x23'),path['extname'](_0x163d1e['originalname'])));}})});router[_0x8605('0x1b')](_0x8605('0x12'),upload[_0x8605('0x1d')](_0x8605('0x1e')),controller[_0x8605('0x24')]);router['put'](_0x8605('0x25'),auth[_0x8605('0x26')](),controller[_0x8605('0x27')]);module[_0x8605('0x28')]=router; \ No newline at end of file +var _0x33bf=['favicon','post','addFavicon','update','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','get','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','extname','originalname','single','file','diskStorage','server/files/images/logos/','%s%s','addLogoLogin','format','preferred'];(function(_0x3a86a7,_0x12ade0){var _0x19b1b6=function(_0x2af9d0){while(--_0x2af9d0){_0x3a86a7['push'](_0x3a86a7['shift']());}};_0x19b1b6(++_0x12ade0);}(_0x33bf,0x1e5));var _0xf33b=function(_0x1d1963,_0x32cc0e){_0x1d1963=_0x1d1963-0x0;var _0x3f58bb=_0x33bf[_0x1d1963];return _0x3f58bb;};'use strict';var multer=require(_0xf33b('0x0'));var util=require(_0xf33b('0x1'));var path=require(_0xf33b('0x2'));var timeout=require('connect-timeout');var express=require(_0xf33b('0x3'));var router=express['Router']();var fs_extra=require(_0xf33b('0x4'));var auth=require(_0xf33b('0x5'));var interaction=require(_0xf33b('0x6'));var config=require(_0xf33b('0x7'));var controller=require(_0xf33b('0x8'));router['get']('/',auth[_0xf33b('0x9')](),controller['index']);router[_0xf33b('0xa')]('/now',controller[_0xf33b('0xb')]);router[_0xf33b('0xa')](_0xf33b('0xc'),controller[_0xf33b('0xd')]);router[_0xf33b('0xa')](_0xf33b('0xe'),controller[_0xf33b('0xf')]);router[_0xf33b('0xa')](_0xf33b('0x10'),controller[_0xf33b('0x11')]);router['get']('/:id/gdpr',controller[_0xf33b('0x12')]);router['get'](_0xf33b('0x13'),controller[_0xf33b('0x14')]);router[_0xf33b('0xa')](_0xf33b('0x15'),controller[_0xf33b('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5a9031,_0x3e496b,_0x3d7c0b){_0x3d7c0b(null,path[_0xf33b('0x17')](config[_0xf33b('0x18')],'server/files/images/logos/'));},'filename':function(_0x2f3f2e,_0x24406a,_0x2ceb79){_0x2ceb79(null,util['format']('%s%s','logo',path[_0xf33b('0x19')](_0x24406a[_0xf33b('0x1a')])));}})});router['post']('/:id/logo',upload[_0xf33b('0x1b')](_0xf33b('0x1c')),controller['addLogo']);var upload=multer({'storage':multer[_0xf33b('0x1d')]({'destination':function(_0x247179,_0x16395d,_0x125e61){_0x125e61(null,path[_0xf33b('0x17')](config[_0xf33b('0x18')],_0xf33b('0x1e')));},'filename':function(_0x3fa46b,_0x44a465,_0x1c372c){_0x1c372c(null,util['format'](_0xf33b('0x1f'),'logologin',path[_0xf33b('0x19')](_0x44a465[_0xf33b('0x1a')])));}})});router['post'](_0xf33b('0x10'),upload[_0xf33b('0x1b')](_0xf33b('0x1c')),controller[_0xf33b('0x20')]);var upload=multer({'storage':multer[_0xf33b('0x1d')]({'destination':function(_0x38cb23,_0x50e655,_0x1f4b7e){_0x1f4b7e(null,path['join'](config['root'],_0xf33b('0x1e')));},'filename':function(_0x51fee1,_0x1dc559,_0xfd86b4){_0xfd86b4(null,util[_0xf33b('0x21')](_0xf33b('0x1f'),_0xf33b('0x22'),path[_0xf33b('0x19')](_0x1dc559[_0xf33b('0x1a')])));}})});router['post'](_0xf33b('0x13'),upload[_0xf33b('0x1b')](_0xf33b('0x1c')),controller['addPreferred']);var upload=multer({'storage':multer[_0xf33b('0x1d')]({'destination':function(_0x50220b,_0x109c2a,_0xce3689){_0xce3689(null,path[_0xf33b('0x17')](config[_0xf33b('0x18')],_0xf33b('0x1e')));},'filename':function(_0x5e7fb9,_0x553644,_0x1581b0){_0x1581b0(null,util[_0xf33b('0x21')](_0xf33b('0x1f'),_0xf33b('0x23'),path[_0xf33b('0x19')](_0x553644[_0xf33b('0x1a')])));}})});router[_0xf33b('0x24')]('/:id/favicon',upload[_0xf33b('0x1b')](_0xf33b('0x1c')),controller[_0xf33b('0x25')]);router['put'](_0xf33b('0xc'),auth[_0xf33b('0x9')](),controller[_0xf33b('0x26')]);module[_0xf33b('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 305de09..8c08769 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 _0x9d47=['INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','min_internal'];(function(_0x182b44,_0x44b0e8){var _0x907d85=function(_0xe0307e){while(--_0xe0307e){_0x182b44['push'](_0x182b44['shift']());}};_0x907d85(++_0x44b0e8);}(_0x9d47,0x1ca));var _0x79d4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9d47[_0xdea41a];return _0x15d0d8;};'use strict';var Sequelize=require(_0x79d4('0x0'));module['exports']={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x79d4('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x79d4('0x2')](0xb),'unique':_0x79d4('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x79d4('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x79d4('0x4')],'defaultValue':_0x79d4('0x5')},'logo':{'type':Sequelize[_0x79d4('0x4')]},'defaultLogo':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x79d4('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x79d4('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x79d4('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x79d4('0x4')]},'pageTitle':{'type':Sequelize[_0x79d4('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x79d4('0x4')],'defaultValue':_0x79d4('0x7')},'enableEmailPreview':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x79d4('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x79d4('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x79d4('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x79d4('0x8')},'chatTimeout':{'type':Sequelize[_0x79d4('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x79d4('0x4')]},'defaultPreferred':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x79d4('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x79d4('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x79d4('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x79d4('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x79d4('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x79d4('0x2')]},'transcribeRegion':{'type':Sequelize[_0x79d4('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x79d4('0x2')]},'sentimentRegion':{'type':Sequelize[_0x79d4('0x4')]},'language':{'type':Sequelize[_0x79d4('0x4')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x79d4('0x2')](0x2)[_0x79d4('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x79d4('0x2')](0x2)[_0x79d4('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x79d4('0x2')](0x2)[_0x79d4('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x79d4('0x2')](0x2)[_0x79d4('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x79d4('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x79d4('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x79d4('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x79d4('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x79d4('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xb18c=['exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','sequelize'];(function(_0x310ca4,_0x195e91){var _0x303c6f=function(_0x53dbf2){while(--_0x53dbf2){_0x310ca4['push'](_0x310ca4['shift']());}};_0x303c6f(++_0x195e91);}(_0xb18c,0x171));var _0xcb18=function(_0x56990c,_0x1d6122){_0x56990c=_0x56990c-0x0;var _0x4905a2=_0xb18c[_0x56990c];return _0x4905a2;};'use strict';var Sequelize=require(_0xcb18('0x0'));module[_0xcb18('0x1')]={'min_internal':{'type':Sequelize[_0xcb18('0x2')](0xb),'unique':_0xcb18('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0xcb18('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xcb18('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xcb18('0x5')],'defaultValue':_0xcb18('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xcb18('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xcb18('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xcb18('0x5')]},'turnaddr':{'type':Sequelize[_0xcb18('0x5')]},'turnusername':{'type':Sequelize[_0xcb18('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xcb18('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xcb18('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xcb18('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xcb18('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xcb18('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xcb18('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xcb18('0x5')],'defaultValue':_0xcb18('0x8')},'chatTimeout':{'type':Sequelize[_0xcb18('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xcb18('0x5')]},'defaultPreferred':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xcb18('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xcb18('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xcb18('0x5')]},'defaultFavicon':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xcb18('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xcb18('0x2')]},'transcribeRegion':{'type':Sequelize[_0xcb18('0x5')]},'sentiment':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xcb18('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xcb18('0x5')]},'bucket':{'type':Sequelize[_0xcb18('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xcb18('0x2')](0x2)[_0xcb18('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xcb18('0x2')](0x2)[_0xcb18('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xcb18('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0xcb18('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xcb18('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xcb18('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xcb18('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0xcb18('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xcb18('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0xcb18('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 b2ef73a..ce2235b 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 _0xdb94=['request','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send','map','Setting','rawAttributes','fieldName','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','findAll','rows','show','params','intersection','include','find','body','addLogo','file','filename','logo','addLogoLogin','getLogo','server/files/images/logos','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','getLicense','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','custom','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','http'];(function(_0x574a32,_0x4b9abf){var _0x3c1730=function(_0x112aa4){while(--_0x112aa4){_0x574a32['push'](_0x574a32['shift']());}};_0x3c1730(++_0x4b9abf);}(_0xdb94,0xe5));var _0x4db9=function(_0x79db35,_0x16e5f2){_0x79db35=_0x79db35-0x0;var _0x2337b4=_0xdb94[_0x79db35];return _0x2337b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4db9('0x0'));var zipdir=require(_0x4db9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4db9('0x2'));var moment=require(_0x4db9('0x3'));var BPromise=require(_0x4db9('0x4'));var Mustache=require(_0x4db9('0x5'));var util=require(_0x4db9('0x6'));var path=require('path');var sox=require(_0x4db9('0x7'));var csv=require('to-csv');var ejs=require(_0x4db9('0x8'));var fs=require('fs');var fs_extra=require(_0x4db9('0x9'));var _=require(_0x4db9('0xa'));var squel=require(_0x4db9('0xb'));var crypto=require(_0x4db9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4db9('0xd'));var toCsv=require(_0x4db9('0xe'));var querystring=require(_0x4db9('0xf'));var Papa=require(_0x4db9('0x10'));var Redis=require(_0x4db9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4db9('0x12'));var as=require(_0x4db9('0x13'));var hardwareService=require(_0x4db9('0x14'));var logger=require(_0x4db9('0x15'))(_0x4db9('0x16'));var utils=require(_0x4db9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4db9('0x18'));var db=require(_0x4db9('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x4db9('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3ac147,_0x34ec92,_0x4d4046,_0x1a93be){return new BPromise(function(_0x3dde55,_0x2018d2){var _0x1ea47d=_0x1a93be||client;return _0x1ea47d[_0x4db9('0x1b')](_0x3ac147,_0x4d4046)['then'](function(_0x1b1062){logger[_0x4db9('0x1c')]('Setting,\x20%s,\x20%s',_0x34ec92,_0x4db9('0x1d'));logger[_0x4db9('0x1e')](_0x4db9('0x1f'),_0x34ec92,'request\x20sent',JSON[_0x4db9('0x20')](_0x1b1062));if(_0x1b1062[_0x4db9('0x21')]){if(_0x1b1062['error']['code']===0x1f4){logger['error'](_0x4db9('0x22'),_0x34ec92,_0x1b1062[_0x4db9('0x21')]['message']);return _0x2018d2(_0x1b1062[_0x4db9('0x21')][_0x4db9('0x23')]);}logger[_0x4db9('0x21')](_0x4db9('0x22'),_0x34ec92,_0x1b1062[_0x4db9('0x21')][_0x4db9('0x23')]);return _0x3dde55(_0x1b1062[_0x4db9('0x21')][_0x4db9('0x23')]);}else{logger[_0x4db9('0x1c')](_0x4db9('0x22'),_0x34ec92,_0x4db9('0x1d'));_0x3dde55(_0x1b1062[_0x4db9('0x24')]['message']);}})[_0x4db9('0x25')](function(_0x2917bd){logger['error'](_0x4db9('0x22'),_0x34ec92,_0x2917bd);_0x2018d2(_0x2917bd);});});}function respondWithStatusCode(_0x3f4931,_0x4419af){_0x4419af=_0x4419af||0xcc;return function(_0x402898){if(_0x402898){return _0x3f4931['sendStatus'](_0x4419af);}return _0x3f4931[_0x4db9('0x26')](_0x4419af)['end']();};}function respondWithResult(_0x1cf805,_0x1c82b6){_0x1c82b6=_0x1c82b6||0xc8;return function(_0x135aa7){if(_0x135aa7){return _0x1cf805[_0x4db9('0x26')](_0x1c82b6)[_0x4db9('0x27')](_0x135aa7);}};}function respondWithFilteredResult(_0x622db6,_0x47464d){return function(_0x5e7d29){if(_0x5e7d29){var _0x5f59be=typeof _0x47464d[_0x4db9('0x28')]==='undefined'&&typeof _0x47464d[_0x4db9('0x29')]===_0x4db9('0x2a');var _0x38d5e2=_0x5e7d29[_0x4db9('0x2b')];var _0x384df5=_0x5f59be?0x0:_0x47464d[_0x4db9('0x28')];var _0x1d0dc2=_0x5f59be?_0x5e7d29[_0x4db9('0x2b')]:_0x47464d['offset']+_0x47464d[_0x4db9('0x29')];var _0x57c1af;if(_0x1d0dc2>=_0x38d5e2){_0x1d0dc2=_0x38d5e2;_0x57c1af=0xc8;}else{_0x57c1af=0xce;}_0x622db6[_0x4db9('0x26')](_0x57c1af);return _0x622db6[_0x4db9('0x2c')](_0x4db9('0x2d'),_0x384df5+'-'+_0x1d0dc2+'/'+_0x38d5e2)[_0x4db9('0x27')](_0x5e7d29);}return null;};}function patchUpdates(_0x341bc5){return function(_0x4b6130){try{jsonpatch[_0x4db9('0x2e')](_0x4b6130,_0x341bc5,!![]);}catch(_0x7ef35){return BPromise[_0x4db9('0x2f')](_0x7ef35);}return _0x4b6130[_0x4db9('0x30')]();};}function saveUpdates(_0x5a16e4,_0x553d07){return function(_0x15841b){if(_0x15841b){return _0x15841b[_0x4db9('0x31')](_0x5a16e4)['then'](function(_0x5e93aa){return _0x5e93aa;});}return null;};}function removeEntity(_0x3783f2,_0x50a75e){return function(_0x4c2449){if(_0x4c2449){return _0x4c2449[_0x4db9('0x32')]()[_0x4db9('0x33')](function(){_0x3783f2['status'](0xcc)[_0x4db9('0x34')]();});}};}function handleEntityNotFound(_0x11e27e,_0x11d881){return function(_0x28f48c){if(!_0x28f48c){_0x11e27e['sendStatus'](0x194);}return _0x28f48c;};}function handleError(_0x444d84,_0x4f3594){_0x4f3594=_0x4f3594||0x1f4;return function(_0x4c1dc0){logger['error'](_0x4c1dc0[_0x4db9('0x35')]);if(_0x4c1dc0[_0x4db9('0x36')]){delete _0x4c1dc0['name'];}_0x444d84[_0x4db9('0x26')](_0x4f3594)[_0x4db9('0x37')](_0x4c1dc0);};}exports['index']=function(_0x4c57c6,_0x5d1f4d){var _0x2c28fa={},_0x52613e={},_0x29dc69={'count':0x0,'rows':[]};var _0x52711a=_[_0x4db9('0x38')](db[_0x4db9('0x39')][_0x4db9('0x3a')],function(_0x10ccbc){return{'name':_0x10ccbc[_0x4db9('0x3b')],'type':_0x10ccbc['type'][_0x4db9('0x3c')]};});_0x52613e['model']=_[_0x4db9('0x38')](_0x52711a,_0x4db9('0x36'));_0x52613e[_0x4db9('0x3d')]=_[_0x4db9('0x3e')](_0x4c57c6[_0x4db9('0x3d')]);_0x52613e[_0x4db9('0x3f')]=_['intersection'](_0x52613e[_0x4db9('0x40')],_0x52613e[_0x4db9('0x3d')]);_0x2c28fa['attributes']=_['intersection'](_0x52613e[_0x4db9('0x40')],qs[_0x4db9('0x41')](_0x4c57c6[_0x4db9('0x3d')][_0x4db9('0x41')]));_0x2c28fa[_0x4db9('0x42')]=_0x2c28fa[_0x4db9('0x42')][_0x4db9('0x43')]?_0x2c28fa[_0x4db9('0x42')]:_0x52613e[_0x4db9('0x40')];if(!_0x4c57c6[_0x4db9('0x3d')][_0x4db9('0x44')](_0x4db9('0x45'))){_0x2c28fa['limit']=qs[_0x4db9('0x29')](_0x4c57c6[_0x4db9('0x3d')][_0x4db9('0x29')]);_0x2c28fa[_0x4db9('0x28')]=qs['offset'](_0x4c57c6['query'][_0x4db9('0x28')]);}_0x2c28fa[_0x4db9('0x46')]=qs[_0x4db9('0x47')](_0x4c57c6['query'][_0x4db9('0x47')]);_0x2c28fa['where']=qs[_0x4db9('0x3f')](_[_0x4db9('0x48')](_0x4c57c6[_0x4db9('0x3d')],_0x52613e[_0x4db9('0x3f')]),_0x52711a);if(_0x4c57c6[_0x4db9('0x3d')]['filter']){_0x2c28fa[_0x4db9('0x49')]=_[_0x4db9('0x4a')](_0x2c28fa[_0x4db9('0x49')],{'$or':_[_0x4db9('0x38')](_0x52711a,function(_0x36480a){if(_0x36480a['type']!==_0x4db9('0x4b')){var _0x366077={};_0x366077[_0x36480a[_0x4db9('0x36')]]={'$like':'%'+_0x4c57c6[_0x4db9('0x3d')][_0x4db9('0x4c')]+'%'};return _0x366077;}})});}_0x2c28fa=_[_0x4db9('0x4a')]({},_0x2c28fa,_0x4c57c6[_0x4db9('0x4d')]);var _0x1f5664={'where':_0x2c28fa[_0x4db9('0x49')]};return db['Setting'][_0x4db9('0x2b')](_0x1f5664)['then'](function(_0x53f3bb){_0x29dc69[_0x4db9('0x2b')]=_0x53f3bb;if(_0x4c57c6[_0x4db9('0x3d')]['includeAll']){_0x2c28fa['include']=[{'all':!![]}];}return db[_0x4db9('0x39')][_0x4db9('0x4e')](_0x2c28fa);})[_0x4db9('0x33')](function(_0x7f0aac){_0x29dc69[_0x4db9('0x4f')]=_0x7f0aac;return _0x29dc69;})[_0x4db9('0x33')](respondWithFilteredResult(_0x5d1f4d,_0x2c28fa))[_0x4db9('0x25')](handleError(_0x5d1f4d,null));};exports[_0x4db9('0x50')]=function(_0x17ea04,_0x16c695){var _0x43312c={'raw':![],'where':{'id':_0x17ea04[_0x4db9('0x51')]['id']}},_0x5495de={};_0x5495de[_0x4db9('0x40')]=_['keys'](db[_0x4db9('0x39')]['rawAttributes']);_0x5495de[_0x4db9('0x3d')]=_[_0x4db9('0x3e')](_0x17ea04[_0x4db9('0x3d')]);_0x5495de[_0x4db9('0x3f')]=_[_0x4db9('0x52')](_0x5495de[_0x4db9('0x40')],_0x5495de[_0x4db9('0x3d')]);_0x43312c[_0x4db9('0x42')]=_[_0x4db9('0x52')](_0x5495de[_0x4db9('0x40')],qs[_0x4db9('0x41')](_0x17ea04[_0x4db9('0x3d')][_0x4db9('0x41')]));_0x43312c['attributes']=_0x43312c['attributes']['length']?_0x43312c[_0x4db9('0x42')]:_0x5495de['model'];if(_0x17ea04[_0x4db9('0x3d')]['includeAll']){_0x43312c[_0x4db9('0x53')]=[{'all':!![]}];}_0x43312c=_[_0x4db9('0x4a')]({},_0x43312c,_0x17ea04['options']);return db['Setting'][_0x4db9('0x54')](_0x43312c)[_0x4db9('0x33')](handleEntityNotFound(_0x16c695,null))[_0x4db9('0x33')](respondWithResult(_0x16c695,null))[_0x4db9('0x25')](handleError(_0x16c695,null));};exports[_0x4db9('0x31')]=function(_0x4120d1,_0x1a563f){if(_0x4120d1[_0x4db9('0x55')]['id']){delete _0x4120d1['body']['id'];}return db[_0x4db9('0x39')][_0x4db9('0x54')]({'where':{'id':_0x4120d1[_0x4db9('0x51')]['id']}})[_0x4db9('0x33')](handleEntityNotFound(_0x1a563f,null))[_0x4db9('0x33')](saveUpdates(_0x4120d1['body'],null))[_0x4db9('0x33')](respondWithResult(_0x1a563f,null))[_0x4db9('0x25')](handleError(_0x1a563f,null));};exports[_0x4db9('0x56')]=function(_0x4edb19,_0x3aeff4,_0x305e4c){if(_0x4edb19[_0x4db9('0x57')]&&_0x4edb19['file'][_0x4db9('0x58')]){_0x4edb19['body'][_0x4db9('0x59')]=_0x4edb19[_0x4db9('0x57')][_0x4db9('0x58')];}return db['Setting'][_0x4db9('0x54')]({'where':{'id':_0x4edb19[_0x4db9('0x51')]['id']}})['then'](handleEntityNotFound(_0x3aeff4,null))[_0x4db9('0x33')](saveUpdates(_0x4edb19[_0x4db9('0x55')],null))[_0x4db9('0x33')](respondWithResult(_0x3aeff4,null))[_0x4db9('0x25')](handleError(_0x3aeff4,null));};exports[_0x4db9('0x5a')]=function(_0x12d4c9,_0x3b9297,_0x44465a){if(_0x12d4c9['file']&&_0x12d4c9[_0x4db9('0x57')][_0x4db9('0x58')]){_0x12d4c9[_0x4db9('0x55')]['loginLogo']=_0x12d4c9[_0x4db9('0x57')][_0x4db9('0x58')];}return db[_0x4db9('0x39')][_0x4db9('0x54')]({'where':{'id':_0x12d4c9['params']['id']}})[_0x4db9('0x33')](handleEntityNotFound(_0x3b9297,null))[_0x4db9('0x33')](saveUpdates(_0x12d4c9[_0x4db9('0x55')],null))[_0x4db9('0x33')](respondWithResult(_0x3b9297,null))[_0x4db9('0x25')](handleError(_0x3b9297,null));};var utilLicense=require(_0x4db9('0x18'));exports[_0x4db9('0x5b')]=function(_0x41fd1e,_0x54abdd,_0xb753f1){var _0x15e8f4=_0x4db9('0x5c');var _0x5e7bd1={'custom':![]};return utilLicense['getLicense']()[_0x4db9('0x33')](function(_0x3ba3e0){if(_0x3ba3e0){_0x5e7bd1=_0x3ba3e0;}return db['Setting'][_0x4db9('0x54')]({'where':{'id':_0x41fd1e['params']['id']},'attributes':[_0x4db9('0x59'),_0x4db9('0x5d'),_0x4db9('0x5e'),_0x4db9('0x5f'),_0x4db9('0x60'),_0x4db9('0x61'),_0x4db9('0x62'),_0x4db9('0x63')],'raw':!![]});})['then'](handleEntityNotFound(_0x54abdd,null))[_0x4db9('0x33')](function(_0xc1b476){if(_0xc1b476){var _0x13671a=_0xc1b476[_0x4db9('0x59')]&&fs[_0x4db9('0x64')](path[_0x4db9('0x65')](config[_0x4db9('0x66')],_0x15e8f4,_[_0x4db9('0x67')](_0xc1b476['logo'])))?path[_0x4db9('0x65')](config['root'],_0x15e8f4,_['toLower'](_0xc1b476['logo'])):path[_0x4db9('0x65')](config[_0x4db9('0x66')],_0x15e8f4,_[_0x4db9('0x67')](_0x4db9('0x68')));var _0x3c76ac=_0x4db9('0x69')+_[_0x4db9('0x6a')](_0x4db9('0x59'));if(_0xc1b476[_0x3c76ac]||!_0x5e7bd1['custom']){_0x13671a=path['join'](config['root'],_0x15e8f4,_['toLower'](_0x4db9('0x68')));}if(!fs[_0x4db9('0x64')](_0x13671a)){throw new db[(_0x4db9('0x6b'))][(_0x4db9('0x6c'))](_[_0x4db9('0x6a')](_0x4db9('0x59'))+_0x4db9('0x6d'));}return _0x54abdd[_0x4db9('0x6e')](_0x13671a);}})['catch'](handleError(_0x54abdd,null));};var utilLicense=require(_0x4db9('0x18'));exports[_0x4db9('0x6f')]=function(_0x35f8d3,_0x496625,_0xc97eb8){var _0x553182='server/files/images/logos';var _0x5d6829={'custom':![]};return utilLicense['getLicense']()[_0x4db9('0x33')](function(_0x433e4f){if(_0x433e4f){_0x5d6829=_0x433e4f;}return db['Setting'][_0x4db9('0x54')]({'where':{'id':_0x35f8d3[_0x4db9('0x51')]['id']},'attributes':[_0x4db9('0x59'),_0x4db9('0x5d'),_0x4db9('0x5e'),'favicon','defaultLogo','defaultLoginLogo',_0x4db9('0x62'),'defaultFavicon'],'raw':!![]});})[_0x4db9('0x33')](handleEntityNotFound(_0x496625,null))['then'](function(_0x3bc13f){if(_0x3bc13f){var _0x13fa02=_0x3bc13f[_0x4db9('0x5d')]&&fs['existsSync'](path[_0x4db9('0x65')](config['root'],_0x553182,_['toLower'](_0x3bc13f[_0x4db9('0x5d')])))?path[_0x4db9('0x65')](config[_0x4db9('0x66')],_0x553182,_['toLower'](_0x3bc13f[_0x4db9('0x5d')])):path['join'](config['root'],_0x553182,_[_0x4db9('0x67')](_0x4db9('0x70')));var _0xce08c1=_0x4db9('0x69')+_[_0x4db9('0x6a')](_0x4db9('0x5d'));if(_0x3bc13f[_0xce08c1]||!_0x5d6829['custom']){_0x13fa02=path[_0x4db9('0x65')](config[_0x4db9('0x66')],_0x553182,_[_0x4db9('0x67')](_0x4db9('0x70')));}if(!fs['existsSync'](_0x13fa02)){throw new db[(_0x4db9('0x6b'))][(_0x4db9('0x6c'))](_['upperFirst'](_0x4db9('0x5d'))+_0x4db9('0x6d'));}return _0x496625['download'](_0x13fa02);}})[_0x4db9('0x25')](handleError(_0x496625,null));};exports[_0x4db9('0x71')]=function(_0x43e13b,_0xe62afd){return db['Setting'][_0x4db9('0x54')]({'where':{'id':_0x43e13b['params']['id']},'attributes':[_0x4db9('0x72')]})[_0x4db9('0x33')](respondWithResult(_0xe62afd,null))[_0x4db9('0x25')](handleError(_0xe62afd,null));};exports[_0x4db9('0x73')]=function(_0x5df6c2,_0x4a7ab6,_0x2d4c76){if(_0x5df6c2[_0x4db9('0x57')]&&_0x5df6c2[_0x4db9('0x57')][_0x4db9('0x58')]){_0x5df6c2[_0x4db9('0x55')][_0x4db9('0x5e')]=_0x5df6c2[_0x4db9('0x57')]['filename'];}return db[_0x4db9('0x39')][_0x4db9('0x54')]({'where':{'id':_0x5df6c2[_0x4db9('0x51')]['id']}})[_0x4db9('0x33')](handleEntityNotFound(_0x4a7ab6,null))['then'](saveUpdates(_0x5df6c2[_0x4db9('0x55')],null))[_0x4db9('0x33')](respondWithResult(_0x4a7ab6,null))[_0x4db9('0x25')](handleError(_0x4a7ab6,null));};var utilLicense=require(_0x4db9('0x18'));exports[_0x4db9('0x74')]=function(_0x1fdba1,_0x2b1c59,_0x3ef4cc){var _0x1a95cd=_0x4db9('0x5c');var _0x208e20={'custom':![]};return utilLicense[_0x4db9('0x75')]()[_0x4db9('0x33')](function(_0x44cf38){if(_0x44cf38){_0x208e20=_0x44cf38;}return db[_0x4db9('0x39')]['find']({'where':{'id':_0x1fdba1[_0x4db9('0x51')]['id']},'attributes':[_0x4db9('0x59'),_0x4db9('0x5d'),'preferred','favicon',_0x4db9('0x60'),'defaultLoginLogo',_0x4db9('0x62'),'defaultFavicon'],'raw':!![]});})[_0x4db9('0x33')](handleEntityNotFound(_0x2b1c59,null))['then'](function(_0x497997){if(_0x497997){var _0x5778f4=_0x497997['preferred']&&fs[_0x4db9('0x64')](path[_0x4db9('0x65')](config[_0x4db9('0x66')],_0x1a95cd,_['toLower'](_0x497997[_0x4db9('0x5e')])))?path['join'](config[_0x4db9('0x66')],_0x1a95cd,_['toLower'](_0x497997['preferred'])):path[_0x4db9('0x65')](config[_0x4db9('0x66')],_0x1a95cd,_['toLower']('default_preferred.png'));var _0x48ddaa=_0x4db9('0x69')+_[_0x4db9('0x6a')](_0x4db9('0x5e'));if(_0x497997[_0x48ddaa]||!_0x208e20['custom']||!_0x208e20[_0x4db9('0x5e')]){_0x5778f4=path[_0x4db9('0x65')](config[_0x4db9('0x66')],_0x1a95cd,_['toLower'](_0x4db9('0x76')));}if(!fs[_0x4db9('0x64')](_0x5778f4)){throw new db[(_0x4db9('0x6b'))][(_0x4db9('0x6c'))](_[_0x4db9('0x6a')](_0x4db9('0x5e'))+_0x4db9('0x6d'));}return _0x2b1c59['download'](_0x5778f4);}})['catch'](handleError(_0x2b1c59,null));};exports[_0x4db9('0x77')]=function(_0x4181cd,_0x26a99f,_0x2da6d3){if(_0x4181cd[_0x4db9('0x57')]&&_0x4181cd[_0x4db9('0x57')][_0x4db9('0x58')]){_0x4181cd[_0x4db9('0x55')]['favicon']=_0x4181cd[_0x4db9('0x57')][_0x4db9('0x58')];}return db[_0x4db9('0x39')][_0x4db9('0x54')]({'where':{'id':_0x4181cd[_0x4db9('0x51')]['id']}})['then'](handleEntityNotFound(_0x26a99f,null))['then'](saveUpdates(_0x4181cd[_0x4db9('0x55')],null))[_0x4db9('0x33')](respondWithResult(_0x26a99f,null))['catch'](handleError(_0x26a99f,null));};var utilLicense=require(_0x4db9('0x18'));exports[_0x4db9('0x78')]=function(_0x7a8f57,_0x248655,_0x535d89){var _0x458d5e=_0x4db9('0x5c');var _0x38ced2={'custom':![]};return utilLicense['getLicense']()[_0x4db9('0x33')](function(_0xf5a97a){if(_0xf5a97a){_0x38ced2=_0xf5a97a;}return db[_0x4db9('0x39')][_0x4db9('0x54')]({'where':{'id':_0x7a8f57[_0x4db9('0x51')]['id']},'attributes':['logo','loginLogo',_0x4db9('0x5e'),_0x4db9('0x5f'),'defaultLogo',_0x4db9('0x61'),_0x4db9('0x62'),_0x4db9('0x63')],'raw':!![]});})[_0x4db9('0x33')](handleEntityNotFound(_0x248655,null))[_0x4db9('0x33')](function(_0x129b9f){if(_0x129b9f){var _0x3650dd=_0x129b9f[_0x4db9('0x5f')]&&fs[_0x4db9('0x64')](path[_0x4db9('0x65')](config[_0x4db9('0x66')],_0x458d5e,_[_0x4db9('0x67')](_0x129b9f[_0x4db9('0x5f')])))?path['join'](config[_0x4db9('0x66')],_0x458d5e,_['toLower'](_0x129b9f[_0x4db9('0x5f')])):path[_0x4db9('0x65')](config[_0x4db9('0x66')],_0x458d5e,_[_0x4db9('0x67')](_0x4db9('0x79')));var _0x4703b2=_0x4db9('0x69')+_[_0x4db9('0x6a')](_0x4db9('0x5f'));if(_0x129b9f[_0x4703b2]||!_0x38ced2[_0x4db9('0x7a')]){_0x3650dd=path[_0x4db9('0x65')](config[_0x4db9('0x66')],_0x458d5e,_['toLower']('default_favicon.ico'));}if(!fs['existsSync'](_0x3650dd)){throw new db[(_0x4db9('0x6b'))][(_0x4db9('0x6c'))](_[_0x4db9('0x6a')](_0x4db9('0x5f'))+_0x4db9('0x6d'));}return _0x248655[_0x4db9('0x6e')](_0x3650dd);}})['catch'](handleError(_0x248655,null));};exports[_0x4db9('0x7b')]=function(_0x13978b,_0x4df32e){var _0x1b8eaa={'offset':moment()[_0x4db9('0x7c')]()};_0x1b8eaa[_0x4db9('0x7d')]=moment()[_0x4db9('0x7c')](_0x1b8eaa[_0x4db9('0x28')])[_0x4db9('0x7e')](_0x4db9('0x7f'));return _0x4df32e['status'](0xc8)['send'](_0x1b8eaa);}; \ No newline at end of file +var _0xe407=['join','toLower','default_logo.svg','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','preferred','defaultFavicon','default_loginLogo.svg','default','gdpr','securePassword','getPreferred','default_preferred.png','ValidationError','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','apply','save','update','destroy','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Setting','count','includeAll','include','findAll','rows','show','params','find','body','addLogo','file','filename','addLogoLogin','loginLogo','../../config/license/util','server/files/images/logos','getLicense','logo','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','root'];(function(_0x2849c8,_0xfc6011){var _0x4cbd52=function(_0x1fb49b){while(--_0x1fb49b){_0x2849c8['push'](_0x2849c8['shift']());}};_0x4cbd52(++_0xfc6011);}(_0xe407,0x181));var _0x7e40=function(_0x565459,_0x1c2242){_0x565459=_0x565459-0x0;var _0xfbb8e3=_0xe407[_0x565459];return _0xfbb8e3;};'use strict';var emlformat=require(_0x7e40('0x0'));var rimraf=require(_0x7e40('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7e40('0x2'));var moment=require(_0x7e40('0x3'));var BPromise=require(_0x7e40('0x4'));var Mustache=require(_0x7e40('0x5'));var util=require('util');var path=require(_0x7e40('0x6'));var sox=require(_0x7e40('0x7'));var csv=require('to-csv');var ejs=require(_0x7e40('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e40('0x9'));var squel=require(_0x7e40('0xa'));var crypto=require(_0x7e40('0xb'));var jsforce=require(_0x7e40('0xc'));var deskjs=require(_0x7e40('0xd'));var toCsv=require(_0x7e40('0xe'));var querystring=require('querystring');var Papa=require(_0x7e40('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7e40('0x10'));var hardwareService=require(_0x7e40('0x11'));var logger=require(_0x7e40('0x12'))(_0x7e40('0x13'));var utils=require(_0x7e40('0x14'));var config=require(_0x7e40('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x106f54,_0x607008,_0x2d9a38,_0x3a3587){return new BPromise(function(_0x9c0b9d,_0x25505b){var _0x16b69b=_0x3a3587||client;return _0x16b69b[_0x7e40('0x16')](_0x106f54,_0x2d9a38)[_0x7e40('0x17')](function(_0x4f841d){logger[_0x7e40('0x18')](_0x7e40('0x19'),_0x607008,_0x7e40('0x1a'));logger[_0x7e40('0x1b')](_0x7e40('0x1c'),_0x607008,_0x7e40('0x1a'),JSON[_0x7e40('0x1d')](_0x4f841d));if(_0x4f841d[_0x7e40('0x1e')]){if(_0x4f841d[_0x7e40('0x1e')]['code']===0x1f4){logger[_0x7e40('0x1e')](_0x7e40('0x19'),_0x607008,_0x4f841d[_0x7e40('0x1e')][_0x7e40('0x1f')]);return _0x25505b(_0x4f841d['error']['message']);}logger[_0x7e40('0x1e')](_0x7e40('0x19'),_0x607008,_0x4f841d[_0x7e40('0x1e')][_0x7e40('0x1f')]);return _0x9c0b9d(_0x4f841d[_0x7e40('0x1e')][_0x7e40('0x1f')]);}else{logger[_0x7e40('0x18')](_0x7e40('0x19'),_0x607008,'request\x20sent');_0x9c0b9d(_0x4f841d[_0x7e40('0x20')][_0x7e40('0x1f')]);}})[_0x7e40('0x21')](function(_0x454e8f){logger[_0x7e40('0x1e')](_0x7e40('0x19'),_0x607008,_0x454e8f);_0x25505b(_0x454e8f);});});}function respondWithStatusCode(_0x4896d8,_0x50aeac){_0x50aeac=_0x50aeac||0xcc;return function(_0x23a112){if(_0x23a112){return _0x4896d8[_0x7e40('0x22')](_0x50aeac);}return _0x4896d8['status'](_0x50aeac)[_0x7e40('0x23')]();};}function respondWithResult(_0x53cd87,_0x1b61f6){_0x1b61f6=_0x1b61f6||0xc8;return function(_0x3e904a){if(_0x3e904a){return _0x53cd87[_0x7e40('0x24')](_0x1b61f6)[_0x7e40('0x25')](_0x3e904a);}};}function respondWithFilteredResult(_0x31d661,_0x1d2da5){return function(_0x512448){if(_0x512448){var _0x141af=typeof _0x1d2da5['offset']===_0x7e40('0x26')&&typeof _0x1d2da5[_0x7e40('0x27')]===_0x7e40('0x26');var _0x3e20aa=_0x512448['count'];var _0x48e6a7=_0x141af?0x0:_0x1d2da5[_0x7e40('0x28')];var _0x452bec=_0x141af?_0x512448['count']:_0x1d2da5[_0x7e40('0x28')]+_0x1d2da5['limit'];var _0x3d8773;if(_0x452bec>=_0x3e20aa){_0x452bec=_0x3e20aa;_0x3d8773=0xc8;}else{_0x3d8773=0xce;}_0x31d661['status'](_0x3d8773);return _0x31d661[_0x7e40('0x29')](_0x7e40('0x2a'),_0x48e6a7+'-'+_0x452bec+'/'+_0x3e20aa)[_0x7e40('0x25')](_0x512448);}return null;};}function patchUpdates(_0x3b9b25){return function(_0x295c4f){try{jsonpatch[_0x7e40('0x2b')](_0x295c4f,_0x3b9b25,!![]);}catch(_0x2f6bda){return BPromise['reject'](_0x2f6bda);}return _0x295c4f[_0x7e40('0x2c')]();};}function saveUpdates(_0x4a594c,_0x45bcb3){return function(_0x3378d7){if(_0x3378d7){return _0x3378d7[_0x7e40('0x2d')](_0x4a594c)[_0x7e40('0x17')](function(_0x1de70d){return _0x1de70d;});}return null;};}function removeEntity(_0x3c5d3b,_0x4fad1d){return function(_0x5c67a3){if(_0x5c67a3){return _0x5c67a3[_0x7e40('0x2e')]()[_0x7e40('0x17')](function(){_0x3c5d3b[_0x7e40('0x24')](0xcc)[_0x7e40('0x23')]();});}};}function handleEntityNotFound(_0x458d47,_0x10b54a){return function(_0x56d4ee){if(!_0x56d4ee){_0x458d47['sendStatus'](0x194);}return _0x56d4ee;};}function handleError(_0x594bfe,_0x55e08c){_0x55e08c=_0x55e08c||0x1f4;return function(_0x302b1c){logger[_0x7e40('0x1e')](_0x302b1c['stack']);if(_0x302b1c[_0x7e40('0x2f')]){delete _0x302b1c['name'];}_0x594bfe['status'](_0x55e08c)[_0x7e40('0x30')](_0x302b1c);};}exports['index']=function(_0x45bdc6,_0x23f73b){var _0x26baf8={},_0x11de82={},_0x2e5aca={'count':0x0,'rows':[]};var _0x3802b0=_[_0x7e40('0x31')](db['Setting'][_0x7e40('0x32')],function(_0x3dff94){return{'name':_0x3dff94['fieldName'],'type':_0x3dff94[_0x7e40('0x33')][_0x7e40('0x34')]};});_0x11de82[_0x7e40('0x35')]=_['map'](_0x3802b0,_0x7e40('0x2f'));_0x11de82[_0x7e40('0x36')]=_[_0x7e40('0x37')](_0x45bdc6[_0x7e40('0x36')]);_0x11de82[_0x7e40('0x38')]=_[_0x7e40('0x39')](_0x11de82[_0x7e40('0x35')],_0x11de82[_0x7e40('0x36')]);_0x26baf8[_0x7e40('0x3a')]=_['intersection'](_0x11de82[_0x7e40('0x35')],qs[_0x7e40('0x3b')](_0x45bdc6[_0x7e40('0x36')][_0x7e40('0x3b')]));_0x26baf8[_0x7e40('0x3a')]=_0x26baf8[_0x7e40('0x3a')][_0x7e40('0x3c')]?_0x26baf8['attributes']:_0x11de82[_0x7e40('0x35')];if(!_0x45bdc6[_0x7e40('0x36')][_0x7e40('0x3d')](_0x7e40('0x3e'))){_0x26baf8[_0x7e40('0x27')]=qs[_0x7e40('0x27')](_0x45bdc6[_0x7e40('0x36')]['limit']);_0x26baf8['offset']=qs[_0x7e40('0x28')](_0x45bdc6[_0x7e40('0x36')][_0x7e40('0x28')]);}_0x26baf8['order']=qs[_0x7e40('0x3f')](_0x45bdc6['query']['sort']);_0x26baf8[_0x7e40('0x40')]=qs['filters'](_[_0x7e40('0x41')](_0x45bdc6[_0x7e40('0x36')],_0x11de82[_0x7e40('0x38')]),_0x3802b0);if(_0x45bdc6['query'][_0x7e40('0x42')]){_0x26baf8['where']=_[_0x7e40('0x43')](_0x26baf8['where'],{'$or':_['map'](_0x3802b0,function(_0x1566f4){if(_0x1566f4[_0x7e40('0x33')]!==_0x7e40('0x44')){var _0x396dc2={};_0x396dc2[_0x1566f4[_0x7e40('0x2f')]]={'$like':'%'+_0x45bdc6[_0x7e40('0x36')][_0x7e40('0x42')]+'%'};return _0x396dc2;}})});}_0x26baf8=_['merge']({},_0x26baf8,_0x45bdc6[_0x7e40('0x45')]);var _0x3f52ef={'where':_0x26baf8[_0x7e40('0x40')]};return db[_0x7e40('0x46')][_0x7e40('0x47')](_0x3f52ef)[_0x7e40('0x17')](function(_0x4df671){_0x2e5aca[_0x7e40('0x47')]=_0x4df671;if(_0x45bdc6[_0x7e40('0x36')][_0x7e40('0x48')]){_0x26baf8[_0x7e40('0x49')]=[{'all':!![]}];}return db[_0x7e40('0x46')][_0x7e40('0x4a')](_0x26baf8);})[_0x7e40('0x17')](function(_0x152d4b){_0x2e5aca[_0x7e40('0x4b')]=_0x152d4b;return _0x2e5aca;})['then'](respondWithFilteredResult(_0x23f73b,_0x26baf8))[_0x7e40('0x21')](handleError(_0x23f73b,null));};exports[_0x7e40('0x4c')]=function(_0x22d49b,_0x38cea0){var _0x4c59de={'raw':![],'where':{'id':_0x22d49b[_0x7e40('0x4d')]['id']}},_0x147e2d={};_0x147e2d[_0x7e40('0x35')]=_[_0x7e40('0x37')](db[_0x7e40('0x46')][_0x7e40('0x32')]);_0x147e2d[_0x7e40('0x36')]=_[_0x7e40('0x37')](_0x22d49b[_0x7e40('0x36')]);_0x147e2d[_0x7e40('0x38')]=_[_0x7e40('0x39')](_0x147e2d[_0x7e40('0x35')],_0x147e2d[_0x7e40('0x36')]);_0x4c59de[_0x7e40('0x3a')]=_[_0x7e40('0x39')](_0x147e2d[_0x7e40('0x35')],qs[_0x7e40('0x3b')](_0x22d49b[_0x7e40('0x36')][_0x7e40('0x3b')]));_0x4c59de[_0x7e40('0x3a')]=_0x4c59de[_0x7e40('0x3a')]['length']?_0x4c59de[_0x7e40('0x3a')]:_0x147e2d[_0x7e40('0x35')];if(_0x22d49b['query'][_0x7e40('0x48')]){_0x4c59de[_0x7e40('0x49')]=[{'all':!![]}];}_0x4c59de=_[_0x7e40('0x43')]({},_0x4c59de,_0x22d49b[_0x7e40('0x45')]);return db[_0x7e40('0x46')][_0x7e40('0x4e')](_0x4c59de)['then'](handleEntityNotFound(_0x38cea0,null))['then'](respondWithResult(_0x38cea0,null))[_0x7e40('0x21')](handleError(_0x38cea0,null));};exports[_0x7e40('0x2d')]=function(_0xf940f2,_0x28606e){if(_0xf940f2[_0x7e40('0x4f')]['id']){delete _0xf940f2[_0x7e40('0x4f')]['id'];}return db[_0x7e40('0x46')][_0x7e40('0x4e')]({'where':{'id':_0xf940f2[_0x7e40('0x4d')]['id']}})['then'](handleEntityNotFound(_0x28606e,null))[_0x7e40('0x17')](saveUpdates(_0xf940f2[_0x7e40('0x4f')],null))[_0x7e40('0x17')](respondWithResult(_0x28606e,null))[_0x7e40('0x21')](handleError(_0x28606e,null));};exports[_0x7e40('0x50')]=function(_0x12ec43,_0x206378,_0xea7a5d){if(_0x12ec43['file']&&_0x12ec43[_0x7e40('0x51')][_0x7e40('0x52')]){_0x12ec43[_0x7e40('0x4f')]['logo']=_0x12ec43[_0x7e40('0x51')][_0x7e40('0x52')];}return db[_0x7e40('0x46')]['find']({'where':{'id':_0x12ec43[_0x7e40('0x4d')]['id']}})[_0x7e40('0x17')](handleEntityNotFound(_0x206378,null))[_0x7e40('0x17')](saveUpdates(_0x12ec43['body'],null))[_0x7e40('0x17')](respondWithResult(_0x206378,null))['catch'](handleError(_0x206378,null));};exports[_0x7e40('0x53')]=function(_0x1ec3c0,_0x3e15bb,_0x1e7b6a){if(_0x1ec3c0[_0x7e40('0x51')]&&_0x1ec3c0[_0x7e40('0x51')][_0x7e40('0x52')]){_0x1ec3c0[_0x7e40('0x4f')][_0x7e40('0x54')]=_0x1ec3c0[_0x7e40('0x51')][_0x7e40('0x52')];}return db['Setting']['find']({'where':{'id':_0x1ec3c0[_0x7e40('0x4d')]['id']}})[_0x7e40('0x17')](handleEntityNotFound(_0x3e15bb,null))[_0x7e40('0x17')](saveUpdates(_0x1ec3c0[_0x7e40('0x4f')],null))['then'](respondWithResult(_0x3e15bb,null))[_0x7e40('0x21')](handleError(_0x3e15bb,null));};var utilLicense=require(_0x7e40('0x55'));exports['getLogo']=function(_0x2c3d5a,_0x1f849a,_0x184964){var _0x1347d4=_0x7e40('0x56');var _0x22c6f2={'custom':![]};return utilLicense[_0x7e40('0x57')]()[_0x7e40('0x17')](function(_0x1869fe){if(_0x1869fe){_0x22c6f2=_0x1869fe;}return db[_0x7e40('0x46')][_0x7e40('0x4e')]({'where':{'id':_0x2c3d5a['params']['id']},'attributes':[_0x7e40('0x58'),_0x7e40('0x54'),'preferred',_0x7e40('0x59'),_0x7e40('0x5a'),_0x7e40('0x5b'),_0x7e40('0x5c'),'defaultFavicon'],'raw':!![]});})[_0x7e40('0x17')](handleEntityNotFound(_0x1f849a,null))[_0x7e40('0x17')](function(_0x3e5f1b){if(_0x3e5f1b){var _0x222c98=_0x3e5f1b[_0x7e40('0x58')]&&fs[_0x7e40('0x5d')](path['join'](config[_0x7e40('0x5e')],_0x1347d4,_['toLower'](_0x3e5f1b['logo'])))?path[_0x7e40('0x5f')](config[_0x7e40('0x5e')],_0x1347d4,_[_0x7e40('0x60')](_0x3e5f1b[_0x7e40('0x58')])):path[_0x7e40('0x5f')](config['root'],_0x1347d4,_['toLower'](_0x7e40('0x61')));var _0x2dc7e3='default'+_[_0x7e40('0x62')](_0x7e40('0x58'));if(_0x3e5f1b[_0x2dc7e3]||!_0x22c6f2[_0x7e40('0x63')]){_0x222c98=path[_0x7e40('0x5f')](config[_0x7e40('0x5e')],_0x1347d4,_[_0x7e40('0x60')]('default_logo.svg'));}if(!fs['existsSync'](_0x222c98)){throw new db[(_0x7e40('0x64'))]['ValidationError'](_['upperFirst']('logo')+_0x7e40('0x65'));}return _0x1f849a[_0x7e40('0x66')](_0x222c98);}})['catch'](handleError(_0x1f849a,null));};var utilLicense=require(_0x7e40('0x55'));exports[_0x7e40('0x67')]=function(_0x45aa49,_0x3fc0e0,_0x300888){var _0x9f8e39='server/files/images/logos';var _0x135d47={'custom':![]};return utilLicense[_0x7e40('0x57')]()[_0x7e40('0x17')](function(_0x1a5683){if(_0x1a5683){_0x135d47=_0x1a5683;}return db['Setting'][_0x7e40('0x4e')]({'where':{'id':_0x45aa49[_0x7e40('0x4d')]['id']},'attributes':[_0x7e40('0x58'),_0x7e40('0x54'),_0x7e40('0x68'),_0x7e40('0x59'),_0x7e40('0x5a'),'defaultLoginLogo',_0x7e40('0x5c'),_0x7e40('0x69')],'raw':!![]});})['then'](handleEntityNotFound(_0x3fc0e0,null))['then'](function(_0x79870e){if(_0x79870e){var _0x2e0f45=_0x79870e[_0x7e40('0x54')]&&fs[_0x7e40('0x5d')](path[_0x7e40('0x5f')](config[_0x7e40('0x5e')],_0x9f8e39,_[_0x7e40('0x60')](_0x79870e[_0x7e40('0x54')])))?path[_0x7e40('0x5f')](config[_0x7e40('0x5e')],_0x9f8e39,_[_0x7e40('0x60')](_0x79870e[_0x7e40('0x54')])):path['join'](config[_0x7e40('0x5e')],_0x9f8e39,_[_0x7e40('0x60')](_0x7e40('0x6a')));var _0x497bf1=_0x7e40('0x6b')+_['upperFirst'](_0x7e40('0x54'));if(_0x79870e[_0x497bf1]||!_0x135d47['custom']){_0x2e0f45=path[_0x7e40('0x5f')](config[_0x7e40('0x5e')],_0x9f8e39,_[_0x7e40('0x60')](_0x7e40('0x6a')));}if(!fs[_0x7e40('0x5d')](_0x2e0f45)){throw new db[(_0x7e40('0x64'))]['ValidationError'](_['upperFirst'](_0x7e40('0x54'))+_0x7e40('0x65'));}return _0x3fc0e0[_0x7e40('0x66')](_0x2e0f45);}})[_0x7e40('0x21')](handleError(_0x3fc0e0,null));};exports[_0x7e40('0x6c')]=function(_0x3a5f56,_0x26e565){return db[_0x7e40('0x46')][_0x7e40('0x4e')]({'where':{'id':_0x3a5f56[_0x7e40('0x4d')]['id']},'attributes':[_0x7e40('0x6d')]})[_0x7e40('0x17')](respondWithResult(_0x26e565,null))[_0x7e40('0x21')](handleError(_0x26e565,null));};exports['addPreferred']=function(_0x441ae4,_0x571234,_0x14f639){if(_0x441ae4[_0x7e40('0x51')]&&_0x441ae4[_0x7e40('0x51')][_0x7e40('0x52')]){_0x441ae4['body'][_0x7e40('0x68')]=_0x441ae4[_0x7e40('0x51')]['filename'];}return db[_0x7e40('0x46')][_0x7e40('0x4e')]({'where':{'id':_0x441ae4[_0x7e40('0x4d')]['id']}})[_0x7e40('0x17')](handleEntityNotFound(_0x571234,null))[_0x7e40('0x17')](saveUpdates(_0x441ae4['body'],null))[_0x7e40('0x17')](respondWithResult(_0x571234,null))[_0x7e40('0x21')](handleError(_0x571234,null));};var utilLicense=require(_0x7e40('0x55'));exports[_0x7e40('0x6e')]=function(_0x981f57,_0x2ce530,_0x1d4837){var _0x187f4e='server/files/images/logos';var _0x397692={'custom':![]};return utilLicense[_0x7e40('0x57')]()[_0x7e40('0x17')](function(_0x32b0ae){if(_0x32b0ae){_0x397692=_0x32b0ae;}return db[_0x7e40('0x46')]['find']({'where':{'id':_0x981f57[_0x7e40('0x4d')]['id']},'attributes':[_0x7e40('0x58'),_0x7e40('0x54'),_0x7e40('0x68'),_0x7e40('0x59'),_0x7e40('0x5a'),_0x7e40('0x5b'),_0x7e40('0x5c'),_0x7e40('0x69')],'raw':!![]});})[_0x7e40('0x17')](handleEntityNotFound(_0x2ce530,null))[_0x7e40('0x17')](function(_0x5f178e){if(_0x5f178e){var _0x5c967c=_0x5f178e['preferred']&&fs['existsSync'](path[_0x7e40('0x5f')](config[_0x7e40('0x5e')],_0x187f4e,_[_0x7e40('0x60')](_0x5f178e['preferred'])))?path[_0x7e40('0x5f')](config[_0x7e40('0x5e')],_0x187f4e,_['toLower'](_0x5f178e[_0x7e40('0x68')])):path['join'](config[_0x7e40('0x5e')],_0x187f4e,_[_0x7e40('0x60')](_0x7e40('0x6f')));var _0x1e21bf=_0x7e40('0x6b')+_[_0x7e40('0x62')](_0x7e40('0x68'));if(_0x5f178e[_0x1e21bf]||!_0x397692['custom']||!_0x397692[_0x7e40('0x68')]){_0x5c967c=path[_0x7e40('0x5f')](config['root'],_0x187f4e,_['toLower'](_0x7e40('0x6f')));}if(!fs['existsSync'](_0x5c967c)){throw new db[(_0x7e40('0x64'))][(_0x7e40('0x70'))](_['upperFirst'](_0x7e40('0x68'))+_0x7e40('0x65'));}return _0x2ce530['download'](_0x5c967c);}})['catch'](handleError(_0x2ce530,null));};exports['addFavicon']=function(_0x17d2b5,_0x494b3e,_0x490ced){if(_0x17d2b5[_0x7e40('0x51')]&&_0x17d2b5[_0x7e40('0x51')][_0x7e40('0x52')]){_0x17d2b5[_0x7e40('0x4f')][_0x7e40('0x59')]=_0x17d2b5[_0x7e40('0x51')][_0x7e40('0x52')];}return db[_0x7e40('0x46')][_0x7e40('0x4e')]({'where':{'id':_0x17d2b5[_0x7e40('0x4d')]['id']}})[_0x7e40('0x17')](handleEntityNotFound(_0x494b3e,null))[_0x7e40('0x17')](saveUpdates(_0x17d2b5[_0x7e40('0x4f')],null))[_0x7e40('0x17')](respondWithResult(_0x494b3e,null))[_0x7e40('0x21')](handleError(_0x494b3e,null));};var utilLicense=require(_0x7e40('0x55'));exports[_0x7e40('0x71')]=function(_0x399969,_0x161223,_0x21ae5b){var _0x1119bd=_0x7e40('0x56');var _0xfcb736={'custom':![]};return utilLicense['getLicense']()[_0x7e40('0x17')](function(_0x9d2d9b){if(_0x9d2d9b){_0xfcb736=_0x9d2d9b;}return db['Setting']['find']({'where':{'id':_0x399969[_0x7e40('0x4d')]['id']},'attributes':[_0x7e40('0x58'),_0x7e40('0x54'),'preferred',_0x7e40('0x59'),_0x7e40('0x5a'),_0x7e40('0x5b'),_0x7e40('0x5c'),'defaultFavicon'],'raw':!![]});})[_0x7e40('0x17')](handleEntityNotFound(_0x161223,null))[_0x7e40('0x17')](function(_0xcb480c){if(_0xcb480c){var _0x4f831d=_0xcb480c[_0x7e40('0x59')]&&fs[_0x7e40('0x5d')](path['join'](config[_0x7e40('0x5e')],_0x1119bd,_[_0x7e40('0x60')](_0xcb480c['favicon'])))?path[_0x7e40('0x5f')](config[_0x7e40('0x5e')],_0x1119bd,_['toLower'](_0xcb480c['favicon'])):path[_0x7e40('0x5f')](config[_0x7e40('0x5e')],_0x1119bd,_[_0x7e40('0x60')](_0x7e40('0x72')));var _0x59443c='default'+_[_0x7e40('0x62')](_0x7e40('0x59'));if(_0xcb480c[_0x59443c]||!_0xfcb736[_0x7e40('0x63')]){_0x4f831d=path['join'](config[_0x7e40('0x5e')],_0x1119bd,_[_0x7e40('0x60')](_0x7e40('0x72')));}if(!fs[_0x7e40('0x5d')](_0x4f831d)){throw new db[(_0x7e40('0x64'))][(_0x7e40('0x70'))](_[_0x7e40('0x62')](_0x7e40('0x59'))+'\x20not\x20found');}return _0x161223[_0x7e40('0x66')](_0x4f831d);}})[_0x7e40('0x21')](handleError(_0x161223,null));};exports[_0x7e40('0x73')]=function(_0x3559b6,_0x495157){var _0x19b7ee={'offset':moment()[_0x7e40('0x74')]()};_0x19b7ee[_0x7e40('0x75')]=moment()[_0x7e40('0x74')](_0x19b7ee['offset'])[_0x7e40('0x76')](_0x7e40('0x77'));return _0x495157[_0x7e40('0x24')](0xc8)['send'](_0x19b7ee);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index c1bd18d..05a5407 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x385f70,_0x3475a0){var _0x59057f=function(_0x5a0769){while(--_0x5a0769){_0x385f70['push'](_0x385f70['shift']());}};_0x59057f(++_0x3475a0);}(_0x3e74,0x175));var _0x43e7=function(_0x43726e,_0x5bc93a){_0x43726e=_0x43726e-0x0;var _0x3d228a=_0x3e74[_0x43726e];return _0x3d228a;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x18e824,_0x21c96c){var _0x45c696=function(_0x2042b4){while(--_0x2042b4){_0x18e824['push'](_0x18e824['shift']());}};_0x45c696(++_0x21c96c);}(_0xedd9,0xfc));var _0x9edd=function(_0x1a5c97,_0x47162e){_0x1a5c97=_0x1a5c97-0x0;var _0x9493dc=_0xedd9[_0x1a5c97];return _0x9493dc;};'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 148beec..812d836 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 _0x222d=['request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','ShowSetting','Setting','find','options','raw','where','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x2605dd,_0x3845a7){var _0x2d11bc=function(_0x4f3db8){while(--_0x4f3db8){_0x2605dd['push'](_0x2605dd['shift']());}};_0x2d11bc(++_0x3845a7);}(_0x222d,0x78));var _0xd222=function(_0xf48984,_0x498a55){_0xf48984=_0xf48984-0x0;var _0x458ee9=_0x222d[_0xf48984];return _0x458ee9;};'use strict';var _=require(_0xd222('0x0'));var util=require(_0xd222('0x1'));var moment=require(_0xd222('0x2'));var BPromise=require(_0xd222('0x3'));var rs=require(_0xd222('0x4'));var fs=require('fs');var Redis=require(_0xd222('0x5'));var db=require(_0xd222('0x6'))['db'];var utils=require(_0xd222('0x7'));var logger=require(_0xd222('0x8'))(_0xd222('0x9'));var config=require(_0xd222('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd222('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2130a2,_0x5264a1,_0x26988a){return new BPromise(function(_0x8657f5,_0x2b6e71){return client[_0xd222('0xc')](_0x2130a2,_0x26988a)[_0xd222('0xd')](function(_0x1a0e63){logger[_0xd222('0xe')](_0xd222('0xf'),_0x5264a1,_0xd222('0x10'));logger[_0xd222('0x11')]('Setting,\x20%s,\x20%s,\x20%s',_0x5264a1,_0xd222('0x10'),JSON[_0xd222('0x12')](_0x1a0e63));if(_0x1a0e63['error']){if(_0x1a0e63[_0xd222('0x13')][_0xd222('0x14')]===0x1f4){logger[_0xd222('0x13')](_0xd222('0xf'),_0x5264a1,_0x1a0e63[_0xd222('0x13')][_0xd222('0x15')]);return _0x2b6e71(_0x1a0e63['error'][_0xd222('0x15')]);}logger['error'](_0xd222('0xf'),_0x5264a1,_0x1a0e63[_0xd222('0x13')][_0xd222('0x15')]);return _0x8657f5(_0x1a0e63['error'][_0xd222('0x15')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x5264a1,_0xd222('0x10'));_0x8657f5(_0x1a0e63['result'][_0xd222('0x15')]);}})[_0xd222('0x16')](function(_0x2c9cd5){logger['error'](_0xd222('0xf'),_0x5264a1,_0x2c9cd5);_0x2b6e71(_0x2c9cd5);});});}exports[_0xd222('0x17')]=function(_0x24b09f){var _0x33f297=this;return new Promise(function(_0x4eec06,_0x4fe1ae){return db[_0xd222('0x18')][_0xd222('0x19')]({'raw':_0x24b09f[_0xd222('0x1a')]?_0x24b09f[_0xd222('0x1a')][_0xd222('0x1b')]===undefined?!![]:![]:!![],'where':_0x24b09f[_0xd222('0x1a')]?_0x24b09f[_0xd222('0x1a')][_0xd222('0x1c')]||null:null,'attributes':_0x24b09f['options']?_0x24b09f['options']['attributes']||null:null,'include':_0x24b09f[_0xd222('0x1a')]?_0x24b09f['options'][_0xd222('0x1d')]?_[_0xd222('0x1e')](_0x24b09f[_0xd222('0x1a')]['include'],function(_0x188b76){return{'model':db[_0x188b76[_0xd222('0x1f')]],'as':_0x188b76['as'],'attributes':_0x188b76['attributes'],'include':_0x188b76[_0xd222('0x1d')]?_[_0xd222('0x1e')](_0x188b76[_0xd222('0x1d')],function(_0x984c7f){return{'model':db[_0x984c7f[_0xd222('0x1f')]],'as':_0x984c7f['as'],'attributes':_0x984c7f[_0xd222('0x20')],'include':_0x984c7f[_0xd222('0x1d')]?_[_0xd222('0x1e')](_0x984c7f[_0xd222('0x1d')],function(_0x5e7002){return{'model':db[_0x5e7002[_0xd222('0x1f')]],'as':_0x5e7002['as'],'attributes':_0x5e7002[_0xd222('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd222('0xd')](function(_0x9a500a){logger['info'](_0xd222('0x17'),_0x24b09f);logger[_0xd222('0x11')](_0xd222('0x17'),_0x24b09f,JSON['stringify'](_0x9a500a));_0x4eec06(_0x9a500a);})[_0xd222('0x16')](function(_0x24e5b9){logger[_0xd222('0x13')](_0xd222('0x17'),_0x24e5b9['message'],_0x24b09f);_0x4fe1ae(_0x33f297[_0xd222('0x13')](0x1f4,_0x24e5b9[_0xd222('0x15')]));});});}; \ No newline at end of file +var _0x168b=['../../config/environment','request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Setting,\x20%s,\x20%s','info','result','catch','find','options','raw','where','attributes','include','map','model','ShowSetting','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x168b,0x161));var _0xb168=function(_0x18c20a,_0x4f7002){_0x18c20a=_0x18c20a-0x0;var _0x1a9ebd=_0x168b[_0x18c20a];return _0x1a9ebd;};'use strict';var _=require(_0xb168('0x0'));var util=require(_0xb168('0x1'));var moment=require('moment');var BPromise=require(_0xb168('0x2'));var rs=require(_0xb168('0x3'));var fs=require('fs');var Redis=require(_0xb168('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb168('0x5'))(_0xb168('0x6'));var config=require(_0xb168('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d22f7,_0x5d396f,_0x44d92b){return new BPromise(function(_0x2f88d8,_0x39ce1e){return client[_0xb168('0x8')](_0x3d22f7,_0x44d92b)[_0xb168('0x9')](function(_0x5d81b7){logger['info']('Setting,\x20%s,\x20%s',_0x5d396f,_0xb168('0xa'));logger[_0xb168('0xb')](_0xb168('0xc'),_0x5d396f,'request\x20sent',JSON[_0xb168('0xd')](_0x5d81b7));if(_0x5d81b7[_0xb168('0xe')]){if(_0x5d81b7[_0xb168('0xe')][_0xb168('0xf')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x5d396f,_0x5d81b7['error'][_0xb168('0x10')]);return _0x39ce1e(_0x5d81b7[_0xb168('0xe')][_0xb168('0x10')]);}logger[_0xb168('0xe')](_0xb168('0x11'),_0x5d396f,_0x5d81b7[_0xb168('0xe')][_0xb168('0x10')]);return _0x2f88d8(_0x5d81b7['error'][_0xb168('0x10')]);}else{logger[_0xb168('0x12')](_0xb168('0x11'),_0x5d396f,_0xb168('0xa'));_0x2f88d8(_0x5d81b7[_0xb168('0x13')]['message']);}})[_0xb168('0x14')](function(_0xd460dd){logger[_0xb168('0xe')](_0xb168('0x11'),_0x5d396f,_0xd460dd);_0x39ce1e(_0xd460dd);});});}exports['ShowSetting']=function(_0x3be252){var _0x5c1e75=this;return new Promise(function(_0x209e21,_0x5e1d){return db['Setting'][_0xb168('0x15')]({'raw':_0x3be252[_0xb168('0x16')]?_0x3be252[_0xb168('0x16')][_0xb168('0x17')]===undefined?!![]:![]:!![],'where':_0x3be252['options']?_0x3be252[_0xb168('0x16')][_0xb168('0x18')]||null:null,'attributes':_0x3be252[_0xb168('0x16')]?_0x3be252['options'][_0xb168('0x19')]||null:null,'include':_0x3be252[_0xb168('0x16')]?_0x3be252[_0xb168('0x16')][_0xb168('0x1a')]?_[_0xb168('0x1b')](_0x3be252[_0xb168('0x16')]['include'],function(_0x9c7c69){return{'model':db[_0x9c7c69[_0xb168('0x1c')]],'as':_0x9c7c69['as'],'attributes':_0x9c7c69['attributes'],'include':_0x9c7c69[_0xb168('0x1a')]?_[_0xb168('0x1b')](_0x9c7c69[_0xb168('0x1a')],function(_0x7ef12c){return{'model':db[_0x7ef12c[_0xb168('0x1c')]],'as':_0x7ef12c['as'],'attributes':_0x7ef12c[_0xb168('0x19')],'include':_0x7ef12c[_0xb168('0x1a')]?_['map'](_0x7ef12c['include'],function(_0x3dc1bb){return{'model':db[_0x3dc1bb[_0xb168('0x1c')]],'as':_0x3dc1bb['as'],'attributes':_0x3dc1bb[_0xb168('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb168('0x9')](function(_0x93394a){logger[_0xb168('0x12')](_0xb168('0x1d'),_0x3be252);logger[_0xb168('0xb')](_0xb168('0x1d'),_0x3be252,JSON[_0xb168('0xd')](_0x93394a));_0x209e21(_0x93394a);})[_0xb168('0x14')](function(_0x9cc7c3){logger[_0xb168('0xe')](_0xb168('0x1d'),_0x9cc7c3[_0xb168('0x10')],_0x3be252);_0x5e1d(_0x5c1e75[_0xb168('0xe')](0x1f4,_0x9cc7c3[_0xb168('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index a5d6fca..3c449a8 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(_0x56c04f,_0x25c86d){var _0x2d1911=function(_0x35b9cd){while(--_0x35b9cd){_0x56c04f['push'](_0x56c04f['shift']());}};_0x2d1911(++_0x25c86d);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',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(_0x3fe30d,_0x469e48){var _0x37b3e1=function(_0x5f1a27){while(--_0x5f1a27){_0x3fe30d['push'](_0x3fe30d['shift']());}};_0x37b3e1(++_0x469e48);}(_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',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 af3db21..3084ccc 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 _0x69c2=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','twilio','skebby','clicksend','clickatell','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x346480,_0x28e3b1){var _0x2dfa25=function(_0x115f08){while(--_0x115f08){_0x346480['push'](_0x346480['shift']());}};_0x2dfa25(++_0x28e3b1);}(_0x69c2,0xc0));var _0x269c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x69c2[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x269c('0x0'));var rs=require(_0x269c('0x1'));module['exports']={'name':{'type':Sequelize[_0x269c('0x2')],'unique':_0x269c('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x269c('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x269c('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x269c('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x269c('0x2')]},'type':{'type':Sequelize['ENUM'](_0x269c('0x4'),_0x269c('0x5'),'connectel',_0x269c('0x6'),'plivo',_0x269c('0x7'),'bandwidth',_0x269c('0x8'),'infobip',_0x269c('0x9'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x269c('0x2')]},'authToken':{'type':Sequelize[_0x269c('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x269c('0x2')]},'password':{'type':Sequelize[_0x269c('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x269c('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x269c('0xa')],'defaultValue':![]},'description':{'type':Sequelize[_0x269c('0x2')]},'notificationTemplate':{'type':Sequelize[_0x269c('0xb')],'defaultValue':function(){return _0x269c('0xc');}},'notificationSound':{'type':Sequelize[_0x269c('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x269c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x269c('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x269c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x269c('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x269c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x269c('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x269c('0xd')],'comment':_0x269c('0xe')},'mandatoryDisposition':{'type':Sequelize[_0x269c('0xa')],'defaultValue':![],'comment':_0x269c('0xf'),'set':function(_0x197498){if(!_0x197498)this[_0x269c('0x10')](_0x269c('0x11'),null);this[_0x269c('0x10')](_0x269c('0x12'),_0x197498);}}}; \ No newline at end of file +var _0x9c64=['randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x516dc5,_0x4bb815){var _0x9677ae=function(_0xa5488f){while(--_0xa5488f){_0x516dc5['push'](_0x516dc5['shift']());}};_0x9677ae(++_0x4bb815);}(_0x9c64,0x137));var _0x49c6=function(_0x4d48b0,_0x2d5a39){_0x4d48b0=_0x4d48b0-0x0;var _0x4a09a2=_0x9c64[_0x4d48b0];return _0x4a09a2;};'use strict';var Sequelize=require(_0x49c6('0x0'));var rs=require(_0x49c6('0x1'));module[_0x49c6('0x2')]={'name':{'type':Sequelize[_0x49c6('0x3')],'unique':_0x49c6('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x49c6('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x49c6('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x49c6('0x3')],'defaultValue':function(){return rs[_0x49c6('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x49c6('0x6')](_0x49c6('0x7'),_0x49c6('0x8'),'connectel',_0x49c6('0x9'),_0x49c6('0xa'),_0x49c6('0xb'),_0x49c6('0xc'),_0x49c6('0xd'),_0x49c6('0xe'),_0x49c6('0xf'))},'accountSid':{'type':Sequelize[_0x49c6('0x3')]},'authId':{'type':Sequelize[_0x49c6('0x3')]},'authToken':{'type':Sequelize[_0x49c6('0x3')]},'smsMethod':{'type':Sequelize[_0x49c6('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x49c6('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x49c6('0x3')]},'applicationId':{'type':Sequelize[_0x49c6('0x3')]},'accountId':{'type':Sequelize[_0x49c6('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x49c6('0x10')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x49c6('0x11')],'defaultValue':function(){return _0x49c6('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x49c6('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x49c6('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x49c6('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x49c6('0x13')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x49c6('0x14'),'set':function(_0xcc60d){if(!_0xcc60d)this[_0x49c6('0x15')](_0x49c6('0x16'),null);this[_0x49c6('0x15')](_0x49c6('0x17'),_0xcc60d);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index fd7be06..7875920 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 _0xd41b=['Body','messageId','MessageSid','skebby','from','sender','clicksend','message_id','plivo','Text','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','bandwidth','intelepeer','refid','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','CmContact','Contacts','DESC','list','omit','contact','spread','interaction','autoclose','applications','close','*,*,*,*','created','ContactId','AttachmentId','User','UserId','unshift','agent','queueId','queue','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','set','Content-Type','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','stack','getApplications','getInteractions','SmsInteraction','Contact','Owner','fullname','Tag','Tags','tag','List','out','SmsMessage','Messages','dataValues','inspect','skebby_dispatch_id','connectel','requestid','status_code','groupName','DELIVERED','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','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','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','client','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','get','destroy','name','send','index','Pause','map','SmsAccount','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','mandatoryDispositionPause','describe','SmsAccountId','getDispositions','findOne','Disposition','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','Applications','account','orderBy','priority','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','From'];(function(_0x77e628,_0x16174d){var _0x145d41=function(_0x435e82){while(--_0x435e82){_0x77e628['push'](_0x77e628['shift']());}};_0x145d41(++_0x16174d);}(_0xd41b,0x154));var _0xbd41=function(_0x4afb80,_0x4c2bdc){_0x4afb80=_0x4afb80-0x0;var _0x3efcf1=_0xd41b[_0x4afb80];return _0x3efcf1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd41('0x0'));var zipdir=require(_0xbd41('0x1'));var jsonpatch=require(_0xbd41('0x2'));var rp=require(_0xbd41('0x3'));var moment=require('moment');var BPromise=require(_0xbd41('0x4'));var Mustache=require(_0xbd41('0x5'));var util=require(_0xbd41('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbd41('0x7'));var ejs=require(_0xbd41('0x8'));var fs=require('fs');var fs_extra=require(_0xbd41('0x9'));var _=require(_0xbd41('0xa'));var squel=require(_0xbd41('0xb'));var crypto=require(_0xbd41('0xc'));var jsforce=require(_0xbd41('0xd'));var deskjs=require(_0xbd41('0xe'));var toCsv=require(_0xbd41('0x7'));var querystring=require(_0xbd41('0xf'));var Papa=require(_0xbd41('0x10'));var Redis=require(_0xbd41('0x11'));var authService=require(_0xbd41('0x12'));var qs=require(_0xbd41('0x13'));var as=require(_0xbd41('0x14'));var hardwareService=require(_0xbd41('0x15'));var logger=require(_0xbd41('0x16'))(_0xbd41('0x17'));var utils=require(_0xbd41('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xbd41('0x19'));var db=require(_0xbd41('0x1a'))['db'];config[_0xbd41('0x1b')]=_[_0xbd41('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbd41('0x1d'))(new Redis(config[_0xbd41('0x1b')]));require('./smsAccount.socket')[_0xbd41('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbd41('0x1f')][_0xbd41('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x2e2cea,_0x1f574f,_0x95e1d7,_0xaf4262){return new BPromise(function(_0x4a49dd,_0x34b2e3){var _0x228e95=_0xaf4262||client;return _0x228e95[_0xbd41('0x21')](_0x2e2cea,_0x95e1d7)[_0xbd41('0x22')](function(_0x1645af){logger['info'](_0xbd41('0x23'),_0x1f574f,_0xbd41('0x24'));logger[_0xbd41('0x25')](_0xbd41('0x26'),_0x1f574f,_0xbd41('0x24'),JSON[_0xbd41('0x27')](_0x1645af));if(_0x1645af[_0xbd41('0x28')]){if(_0x1645af['error'][_0xbd41('0x29')]===0x1f4){logger[_0xbd41('0x28')](_0xbd41('0x23'),_0x1f574f,_0x1645af['error'][_0xbd41('0x2a')]);return _0x34b2e3(_0x1645af['error'][_0xbd41('0x2a')]);}logger[_0xbd41('0x28')](_0xbd41('0x23'),_0x1f574f,_0x1645af[_0xbd41('0x28')][_0xbd41('0x2a')]);return _0x4a49dd(_0x1645af[_0xbd41('0x28')][_0xbd41('0x2a')]);}else{logger[_0xbd41('0x2b')]('SmsAccount,\x20%s,\x20%s',_0x1f574f,_0xbd41('0x24'));_0x4a49dd(_0x1645af[_0xbd41('0x2c')][_0xbd41('0x2a')]);}})[_0xbd41('0x2d')](function(_0x350cee){logger[_0xbd41('0x28')](_0xbd41('0x23'),_0x1f574f,_0x350cee);_0x34b2e3(_0x350cee);});});}function respondWithStatusCode(_0x43da68,_0x16cea6){_0x16cea6=_0x16cea6||0xcc;return function(_0x5245fd){if(_0x5245fd){return _0x43da68['sendStatus'](_0x16cea6);}return _0x43da68[_0xbd41('0x2e')](_0x16cea6)[_0xbd41('0x2f')]();};}function respondWithResult(_0x15d6a0,_0x3715b4){_0x3715b4=_0x3715b4||0xc8;return function(_0x40322a){if(_0x40322a){return _0x15d6a0[_0xbd41('0x2e')](_0x3715b4)['json'](_0x40322a);}};}function respondWithFilteredResult(_0x19a154,_0x3790b6){return function(_0x2a5dd4){if(_0x2a5dd4){var _0x5b7646=typeof _0x3790b6['offset']===_0xbd41('0x30')&&typeof _0x3790b6[_0xbd41('0x31')]===_0xbd41('0x30');var _0x5166c6=_0x2a5dd4[_0xbd41('0x32')];var _0x4db6b9=_0x5b7646?0x0:_0x3790b6[_0xbd41('0x33')];var _0x45f6c7=_0x5b7646?_0x2a5dd4[_0xbd41('0x32')]:_0x3790b6[_0xbd41('0x33')]+_0x3790b6['limit'];var _0x1df1da;if(_0x45f6c7>=_0x5166c6){_0x45f6c7=_0x5166c6;_0x1df1da=0xc8;}else{_0x1df1da=0xce;}_0x19a154[_0xbd41('0x2e')](_0x1df1da);return _0x19a154['set'](_0xbd41('0x34'),_0x4db6b9+'-'+_0x45f6c7+'/'+_0x5166c6)[_0xbd41('0x35')](_0x2a5dd4);}return null;};}function patchUpdates(_0x1a7b9a){return function(_0x1762b2){try{jsonpatch[_0xbd41('0x36')](_0x1762b2,_0x1a7b9a,!![]);}catch(_0x292620){return BPromise[_0xbd41('0x37')](_0x292620);}return _0x1762b2[_0xbd41('0x38')]();};}function saveUpdates(_0x4cd174,_0x4aaea1){return function(_0x5baf32){if(_0x5baf32){return _0x5baf32[_0xbd41('0x39')](_0x4cd174)['then'](function(_0x333276){return _0x333276;});}return null;};}function removeEntity(_0x455bef,_0xc359dd){return function(_0x49b293){if(_0x49b293){return _0x49b293['destroy']()[_0xbd41('0x22')](function(){var _0xc297c2=_0x49b293[_0xbd41('0x3a')]({'plain':!![]});var _0x92317='SmsAccounts';return db['UserProfileResource'][_0xbd41('0x3b')]({'where':{'type':_0x92317,'resourceId':_0xc297c2['id']}})[_0xbd41('0x22')](function(){return _0x49b293;});})['then'](function(){_0x455bef[_0xbd41('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18188b,_0x40f477){return function(_0x239077){if(!_0x239077){_0x18188b['sendStatus'](0x194);}return _0x239077;};}function handleError(_0x57544c,_0x33fd97){_0x33fd97=_0x33fd97||0x1f4;return function(_0x3904c2){logger[_0xbd41('0x28')](_0x3904c2['stack']);if(_0x3904c2['name']){delete _0x3904c2[_0xbd41('0x3c')];}_0x57544c[_0xbd41('0x2e')](_0x33fd97)[_0xbd41('0x3d')](_0x3904c2);};}exports[_0xbd41('0x3e')]=function(_0x722454,_0x2975a7){var _0x2ec2e6={'include':[{'model':db[_0xbd41('0x3f')],'as':'mandatoryDispositionPause'}]},_0x749978={},_0x143bc8={'count':0x0,'rows':[]};var _0x29e019=_[_0xbd41('0x40')](db[_0xbd41('0x41')]['rawAttributes'],function(_0x40a1ba){return{'name':_0x40a1ba['fieldName'],'type':_0x40a1ba[_0xbd41('0x42')][_0xbd41('0x43')]};});_0x749978[_0xbd41('0x44')]=_[_0xbd41('0x40')](_0x29e019,_0xbd41('0x3c'));_0x749978[_0xbd41('0x45')]=_['keys'](_0x722454[_0xbd41('0x45')]);_0x749978[_0xbd41('0x46')]=_[_0xbd41('0x47')](_0x749978[_0xbd41('0x44')],_0x749978[_0xbd41('0x45')]);_0x2ec2e6[_0xbd41('0x48')]=_[_0xbd41('0x47')](_0x749978[_0xbd41('0x44')],qs[_0xbd41('0x49')](_0x722454[_0xbd41('0x45')][_0xbd41('0x49')]));_0x2ec2e6['attributes']=_0x2ec2e6['attributes'][_0xbd41('0x4a')]?_0x2ec2e6[_0xbd41('0x48')]:_0x749978[_0xbd41('0x44')];if(!_0x722454[_0xbd41('0x45')]['hasOwnProperty'](_0xbd41('0x4b'))){_0x2ec2e6[_0xbd41('0x31')]=qs['limit'](_0x722454[_0xbd41('0x45')][_0xbd41('0x31')]);_0x2ec2e6[_0xbd41('0x33')]=qs[_0xbd41('0x33')](_0x722454[_0xbd41('0x45')][_0xbd41('0x33')]);}_0x2ec2e6[_0xbd41('0x4c')]=qs[_0xbd41('0x4d')](_0x722454[_0xbd41('0x45')]['sort']);_0x2ec2e6[_0xbd41('0x4e')]=qs['filters'](_[_0xbd41('0x4f')](_0x722454['query'],_0x749978[_0xbd41('0x46')]),_0x29e019);if(_0x722454['query'][_0xbd41('0x50')]){_0x2ec2e6['where']=_['merge'](_0x2ec2e6[_0xbd41('0x4e')],{'$or':_[_0xbd41('0x40')](_0x29e019,function(_0x16a0a5){if(_0x16a0a5[_0xbd41('0x42')]!==_0xbd41('0x51')){var _0x3d61ca={};_0x3d61ca[_0x16a0a5[_0xbd41('0x3c')]]={'$like':'%'+_0x722454[_0xbd41('0x45')][_0xbd41('0x50')]+'%'};return _0x3d61ca;}})});}_0x2ec2e6=_[_0xbd41('0x52')]({},_0x2ec2e6,_0x722454[_0xbd41('0x53')]);var _0x61598d={'where':_0x2ec2e6[_0xbd41('0x4e')]};return db[_0xbd41('0x41')][_0xbd41('0x32')](_0x61598d)[_0xbd41('0x22')](function(_0x16b96b){_0x143bc8[_0xbd41('0x32')]=_0x16b96b;if(_0x722454[_0xbd41('0x45')]['includeAll']){_0x2ec2e6[_0xbd41('0x54')]=[{'all':!![]}];}return db[_0xbd41('0x41')][_0xbd41('0x55')](_0x2ec2e6);})[_0xbd41('0x22')](function(_0x3e603e){_0x143bc8[_0xbd41('0x56')]=_0x3e603e;return _0x143bc8;})[_0xbd41('0x22')](respondWithFilteredResult(_0x2975a7,_0x2ec2e6))['catch'](handleError(_0x2975a7,null));};exports[_0xbd41('0x57')]=function(_0x8f4b3d,_0x1720c5){var _0x505aff={'raw':![],'where':{'id':_0x8f4b3d[_0xbd41('0x58')]['id']},'include':[{'model':db[_0xbd41('0x3f')],'as':'mandatoryDispositionPause'}]},_0xc9b501={};_0xc9b501[_0xbd41('0x44')]=_[_0xbd41('0x59')](db[_0xbd41('0x41')][_0xbd41('0x5a')]);_0xc9b501[_0xbd41('0x45')]=_[_0xbd41('0x59')](_0x8f4b3d[_0xbd41('0x45')]);_0xc9b501[_0xbd41('0x46')]=_[_0xbd41('0x47')](_0xc9b501[_0xbd41('0x44')],_0xc9b501[_0xbd41('0x45')]);_0x505aff[_0xbd41('0x48')]=_[_0xbd41('0x47')](_0xc9b501[_0xbd41('0x44')],qs[_0xbd41('0x49')](_0x8f4b3d[_0xbd41('0x45')][_0xbd41('0x49')]));_0x505aff['attributes']=_0x505aff[_0xbd41('0x48')][_0xbd41('0x4a')]?_0x505aff[_0xbd41('0x48')]:_0xc9b501[_0xbd41('0x44')];if(_0x8f4b3d['query'][_0xbd41('0x5b')]){_0x505aff['include']=[{'all':!![]}];}_0x505aff=_[_0xbd41('0x52')]({},_0x505aff,_0x8f4b3d[_0xbd41('0x53')]);return db['SmsAccount'][_0xbd41('0x5c')](_0x505aff)[_0xbd41('0x22')](handleEntityNotFound(_0x1720c5,null))[_0xbd41('0x22')](respondWithResult(_0x1720c5,null))[_0xbd41('0x2d')](handleError(_0x1720c5,null));};exports[_0xbd41('0x5d')]=function(_0x53d760,_0x5515ce){return db[_0xbd41('0x41')][_0xbd41('0x5d')](_0x53d760['body'],{})['then'](function(_0x562fde){var _0x320b8b=_0x53d760['user'][_0xbd41('0x3a')]({'plain':!![]});if(!_0x320b8b)throw new Error(_0xbd41('0x5e'));if(_0x320b8b['role']===_0xbd41('0x5f')){var _0x4218d7=_0x562fde[_0xbd41('0x3a')]({'plain':!![]});var _0x955084=_0xbd41('0x60');return db[_0xbd41('0x61')]['find']({'where':{'name':_0x955084,'userProfileId':_0x320b8b[_0xbd41('0x62')]},'raw':!![]})[_0xbd41('0x22')](function(_0xcb1d63){if(_0xcb1d63&&_0xcb1d63[_0xbd41('0x63')]===0x0){return db[_0xbd41('0x64')]['create']({'name':_0x4218d7['name'],'resourceId':_0x4218d7['id'],'type':_0xcb1d63[_0xbd41('0x3c')],'sectionId':_0xcb1d63['id']},{})['then'](function(){return _0x562fde;});}else{return _0x562fde;}})[_0xbd41('0x2d')](function(_0x204c6f){logger[_0xbd41('0x28')](_0xbd41('0x65'),_0x204c6f);throw _0x204c6f;});}return _0x562fde;})[_0xbd41('0x22')](respondWithResult(_0x5515ce,0xc9))[_0xbd41('0x2d')](handleError(_0x5515ce,null));};exports[_0xbd41('0x39')]=function(_0x48a33,_0x53badf){if(_0x48a33[_0xbd41('0x66')]['id']){delete _0x48a33['body']['id'];}return db[_0xbd41('0x41')]['find']({'where':{'id':_0x48a33[_0xbd41('0x58')]['id']},'include':[{'model':db[_0xbd41('0x3f')],'as':_0xbd41('0x67')}]})['then'](handleEntityNotFound(_0x53badf,null))[_0xbd41('0x22')](saveUpdates(_0x48a33['body'],null))[_0xbd41('0x22')](respondWithResult(_0x53badf,null))['catch'](handleError(_0x53badf,null));};exports[_0xbd41('0x3b')]=function(_0x4c0401,_0x4c543e){return db[_0xbd41('0x41')][_0xbd41('0x5c')]({'where':{'id':_0x4c0401['params']['id']}})['then'](handleEntityNotFound(_0x4c543e,null))[_0xbd41('0x22')](removeEntity(_0x4c543e,null))[_0xbd41('0x2d')](handleError(_0x4c543e,null));};exports[_0xbd41('0x68')]=function(_0x3fbb1e,_0x146d71){return db[_0xbd41('0x41')][_0xbd41('0x68')]()['then'](respondWithResult(_0x146d71,null))[_0xbd41('0x2d')](handleError(_0x146d71,null));};exports['addDisposition']=function(_0x107966,_0x500162,_0x3d522e){if(_0x107966[_0xbd41('0x66')]['id']){delete _0x107966[_0xbd41('0x66')]['id'];}return db[_0xbd41('0x41')]['find']({'where':{'id':_0x107966['params']['id']}})['then'](handleEntityNotFound(_0x500162,null))['then'](function(_0x26829d){if(_0x26829d){_0x107966[_0xbd41('0x66')][_0xbd41('0x69')]=_0x26829d['id'];return db['Disposition'][_0xbd41('0x5d')](_0x107966['body']);}})[_0xbd41('0x22')](respondWithResult(_0x500162,null))[_0xbd41('0x2d')](handleError(_0x500162,null));};exports[_0xbd41('0x6a')]=function(_0x32fcb2,_0x204d9c,_0x5bca52){var _0x5d63d6={'raw':![],'where':{}};var _0x1f539f={};var _0x5dd2e6={'count':0x0,'rows':[]};return db[_0xbd41('0x41')][_0xbd41('0x6b')]({'where':{'id':_0x32fcb2[_0xbd41('0x58')]['id']}})['then'](handleEntityNotFound(_0x204d9c,null))[_0xbd41('0x22')](function(_0x2de8be){if(_0x2de8be){_0x1f539f[_0xbd41('0x44')]=_['keys'](db[_0xbd41('0x6c')][_0xbd41('0x5a')]);_0x1f539f[_0xbd41('0x45')]=_[_0xbd41('0x59')](_0x32fcb2['query']);_0x1f539f[_0xbd41('0x46')]=_['intersection'](_0x1f539f[_0xbd41('0x44')],_0x1f539f[_0xbd41('0x45')]);_0x5d63d6[_0xbd41('0x48')]=_[_0xbd41('0x47')](_0x1f539f[_0xbd41('0x44')],qs[_0xbd41('0x49')](_0x32fcb2[_0xbd41('0x45')][_0xbd41('0x49')]));_0x5d63d6[_0xbd41('0x48')]=_0x5d63d6[_0xbd41('0x48')][_0xbd41('0x4a')]?_0x5d63d6[_0xbd41('0x48')]:_0x1f539f['model'];if(!_0x32fcb2[_0xbd41('0x45')][_0xbd41('0x6d')]('nolimit')){_0x5d63d6[_0xbd41('0x31')]=qs['limit'](_0x32fcb2['query']['limit']);_0x5d63d6['offset']=qs[_0xbd41('0x33')](_0x32fcb2[_0xbd41('0x45')][_0xbd41('0x33')]);}_0x5d63d6[_0xbd41('0x4c')]=qs[_0xbd41('0x4d')](_0x32fcb2[_0xbd41('0x45')][_0xbd41('0x4d')]);_0x5d63d6['where']=qs[_0xbd41('0x46')](_[_0xbd41('0x4f')](_0x32fcb2[_0xbd41('0x45')],_0x1f539f['filters']));_0x5d63d6[_0xbd41('0x4e')]['SmsAccountId']=_0x2de8be['id'];if(_0x32fcb2['query'][_0xbd41('0x50')]){_0x5d63d6['where']=_['merge'](_0x5d63d6[_0xbd41('0x4e')],{'$or':_['map'](_0x5d63d6['attributes'],function(_0x5457c6){var _0x2f5a07={};_0x2f5a07[_0x5457c6]={'$like':'%'+_0x32fcb2[_0xbd41('0x45')]['filter']+'%'};return _0x2f5a07;})});}_0x5d63d6=_[_0xbd41('0x52')]({},_0x5d63d6,_0x32fcb2[_0xbd41('0x53')]);return db[_0xbd41('0x6c')][_0xbd41('0x32')]({'where':_0x5d63d6[_0xbd41('0x4e')]})[_0xbd41('0x22')](function(_0x4e7b2c){_0x5dd2e6['count']=_0x4e7b2c;if(_0x32fcb2['query'][_0xbd41('0x5b')]){_0x5d63d6[_0xbd41('0x54')]=[{'all':!![]}];}return db['Disposition'][_0xbd41('0x55')](_0x5d63d6);})[_0xbd41('0x22')](function(_0x4a52cd){_0x5dd2e6[_0xbd41('0x56')]=_0x4a52cd;return _0x5dd2e6;});}})[_0xbd41('0x22')](respondWithFilteredResult(_0x204d9c,_0x5d63d6))[_0xbd41('0x2d')](handleError(_0x204d9c,null));};exports[_0xbd41('0x6e')]=function(_0x4a459d,_0x227ce1,_0x52947b){return db[_0xbd41('0x41')][_0xbd41('0x5c')]({'where':{'id':_0x4a459d[_0xbd41('0x58')]['id']}})[_0xbd41('0x22')](handleEntityNotFound(_0x227ce1,null))['then'](function(_0x575435){if(_0x575435){return _0x575435[_0xbd41('0x6e')](_0x4a459d[_0xbd41('0x45')][_0xbd41('0x6f')]);}})[_0xbd41('0x22')](respondWithStatusCode(_0x227ce1,null))[_0xbd41('0x2d')](handleError(_0x227ce1,null));};exports[_0xbd41('0x70')]=function(_0x473908,_0x299b55,_0x278a13){if(_0x473908[_0xbd41('0x66')]['id']){delete _0x473908['body']['id'];}return db[_0xbd41('0x41')][_0xbd41('0x5c')]({'where':{'id':_0x473908['params']['id']}})[_0xbd41('0x22')](handleEntityNotFound(_0x299b55,null))[_0xbd41('0x22')](function(_0x15aa92){if(_0x15aa92){_0x473908[_0xbd41('0x66')][_0xbd41('0x69')]=_0x15aa92['id'];return db[_0xbd41('0x71')][_0xbd41('0x5d')](_0x473908[_0xbd41('0x66')]);}})[_0xbd41('0x22')](respondWithResult(_0x299b55,null))[_0xbd41('0x2d')](handleError(_0x299b55,null));};exports[_0xbd41('0x72')]=function(_0x4f21c5,_0x9a59b5,_0xc0ce08){var _0x2c5e8f={'raw':![],'where':{}};var _0x1a1d56={};var _0x37f2bc={'count':0x0,'rows':[]};return db[_0xbd41('0x41')]['findOne']({'where':{'id':_0x4f21c5[_0xbd41('0x58')]['id']}})[_0xbd41('0x22')](handleEntityNotFound(_0x9a59b5,null))[_0xbd41('0x22')](function(_0x53a663){if(_0x53a663){_0x1a1d56[_0xbd41('0x44')]=_[_0xbd41('0x59')](db['CannedAnswer']['rawAttributes']);_0x1a1d56[_0xbd41('0x45')]=_[_0xbd41('0x59')](_0x4f21c5[_0xbd41('0x45')]);_0x1a1d56[_0xbd41('0x46')]=_['intersection'](_0x1a1d56[_0xbd41('0x44')],_0x1a1d56[_0xbd41('0x45')]);_0x2c5e8f['attributes']=_[_0xbd41('0x47')](_0x1a1d56[_0xbd41('0x44')],qs[_0xbd41('0x49')](_0x4f21c5[_0xbd41('0x45')][_0xbd41('0x49')]));_0x2c5e8f[_0xbd41('0x48')]=_0x2c5e8f['attributes']['length']?_0x2c5e8f[_0xbd41('0x48')]:_0x1a1d56['model'];if(!_0x4f21c5[_0xbd41('0x45')]['hasOwnProperty']('nolimit')){_0x2c5e8f[_0xbd41('0x31')]=qs[_0xbd41('0x31')](_0x4f21c5['query'][_0xbd41('0x31')]);_0x2c5e8f[_0xbd41('0x33')]=qs[_0xbd41('0x33')](_0x4f21c5['query'][_0xbd41('0x33')]);}_0x2c5e8f['order']=qs['sort'](_0x4f21c5[_0xbd41('0x45')][_0xbd41('0x4d')]);_0x2c5e8f['where']=qs['filters'](_[_0xbd41('0x4f')](_0x4f21c5[_0xbd41('0x45')],_0x1a1d56[_0xbd41('0x46')]));_0x2c5e8f['where'][_0xbd41('0x69')]=_0x53a663['id'];if(_0x4f21c5[_0xbd41('0x45')][_0xbd41('0x50')]){_0x2c5e8f[_0xbd41('0x4e')]=_[_0xbd41('0x52')](_0x2c5e8f[_0xbd41('0x4e')],{'$or':_[_0xbd41('0x40')](_0x2c5e8f[_0xbd41('0x48')],function(_0x39a012){var _0xfa5382={};_0xfa5382[_0x39a012]={'$like':'%'+_0x4f21c5[_0xbd41('0x45')]['filter']+'%'};return _0xfa5382;})});}_0x2c5e8f=_[_0xbd41('0x52')]({},_0x2c5e8f,_0x4f21c5['options']);return db['CannedAnswer'][_0xbd41('0x32')]({'where':_0x2c5e8f[_0xbd41('0x4e')]})[_0xbd41('0x22')](function(_0x4afc52){_0x37f2bc[_0xbd41('0x32')]=_0x4afc52;if(_0x4f21c5[_0xbd41('0x45')][_0xbd41('0x5b')]){_0x2c5e8f[_0xbd41('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0xbd41('0x55')](_0x2c5e8f);})['then'](function(_0x759815){_0x37f2bc[_0xbd41('0x56')]=_0x759815;return _0x37f2bc;});}})['then'](respondWithFilteredResult(_0x9a59b5,_0x2c5e8f))[_0xbd41('0x2d')](handleError(_0x9a59b5,null));};exports[_0xbd41('0x73')]=function(_0x565609,_0x32f55c,_0xc82e41){return db[_0xbd41('0x41')][_0xbd41('0x5c')]({'where':{'id':_0x565609[_0xbd41('0x58')]['id']}})[_0xbd41('0x22')](handleEntityNotFound(_0x32f55c,null))[_0xbd41('0x22')](function(_0x4e1e4a){if(_0x4e1e4a){return _0x4e1e4a[_0xbd41('0x73')](_0x565609['query']['ids']);}})['then'](respondWithStatusCode(_0x32f55c,null))[_0xbd41('0x2d')](handleError(_0x32f55c,null));};exports[_0xbd41('0x74')]=function(_0x79faeb,_0x40b7cd,_0x3b9dea){var _0x6a696b={'channel':'sms'};var _0x5b8cf6=[];var _0x93cec4=[];var _0x3f4b77={};return db[_0xbd41('0x41')][_0xbd41('0x5c')]({'where':{'id':_0x79faeb[_0xbd41('0x58')]['id']},'include':[{'model':db[_0xbd41('0x75')],'as':_0xbd41('0x76')}]})[_0xbd41('0x22')](handleEntityNotFound(_0x40b7cd,null))[_0xbd41('0x22')](function(_0x25a640){_0x6a696b[_0xbd41('0x77')]=_0x25a640;_0x6a696b['applications']=_[_0xbd41('0x78')](_0x25a640['Applications'],[_0xbd41('0x79')],['asc']);if(_0x6a696b[_0xbd41('0x77')][_0xbd41('0x76')]){delete _0x6a696b['account'][_0xbd41('0x76')];}return db['CmContact']['describe']();})[_0xbd41('0x22')](function(_0x59c7b9){if(!_0x59c7b9){throw new db[(_0xbd41('0x7a'))][(_0xbd41('0x7b'))](_0xbd41('0x7c'));}_0x5b8cf6=_['difference'](_[_0xbd41('0x59')](_0x59c7b9),[_0xbd41('0x7d'),_0xbd41('0x7e')]);_0x93cec4=_[_0xbd41('0x7f')](_[_0xbd41('0x59')](_0x59c7b9),['createdAt',_0xbd41('0x7e'),_0xbd41('0x80'),_0xbd41('0x81')]);_0x6a696b[_0xbd41('0x66')]={'mapKey':_0xbd41('0x82')};if(_0x6a696b[_0xbd41('0x77')][_0xbd41('0x42')]){switch(_0x6a696b[_0xbd41('0x77')][_0xbd41('0x42')]){case'twilio':_0x6a696b['body']['from']=_0x79faeb[_0xbd41('0x66')][_0xbd41('0x83')];_0x6a696b['body']['body']=_0x79faeb['body'][_0xbd41('0x84')];_0x6a696b[_0xbd41('0x66')][_0xbd41('0x85')]=_0x79faeb[_0xbd41('0x66')][_0xbd41('0x86')];break;case _0xbd41('0x87'):_0x6a696b['body'][_0xbd41('0x88')]='+'+_0x79faeb[_0xbd41('0x66')][_0xbd41('0x89')];_0x6a696b[_0xbd41('0x66')][_0xbd41('0x66')]=_0x79faeb['body']['text'];break;case'connectel':_0x6a696b[_0xbd41('0x66')][_0xbd41('0x88')]=_0x79faeb['body'][_0xbd41('0x88')];_0x6a696b[_0xbd41('0x66')][_0xbd41('0x66')]=_0x79faeb['body'][_0xbd41('0x2a')];break;case _0xbd41('0x8a'):_0x6a696b['body'][_0xbd41('0x88')]=_0x79faeb[_0xbd41('0x66')]['from'];_0x6a696b[_0xbd41('0x66')][_0xbd41('0x66')]=_0x79faeb[_0xbd41('0x66')]['body'];_0x6a696b[_0xbd41('0x66')][_0xbd41('0x85')]=_0x79faeb[_0xbd41('0x66')][_0xbd41('0x8b')];break;case _0xbd41('0x8c'):_0x6a696b[_0xbd41('0x66')][_0xbd41('0x88')]=_0x79faeb[_0xbd41('0x66')][_0xbd41('0x83')];_0x6a696b['body'][_0xbd41('0x66')]=_0x79faeb['body'][_0xbd41('0x8d')];_0x6a696b[_0xbd41('0x66')]['messageId']=_0x79faeb['body']['MessageUUID'];break;case _0xbd41('0x8e'):_0x6a696b[_0xbd41('0x66')]['from']='+'+_0x79faeb['body']['results'][0x0][_0xbd41('0x88')];_0x6a696b['body'][_0xbd41('0x66')]=_0x79faeb[_0xbd41('0x66')][_0xbd41('0x8f')][0x0]['text'];_0x6a696b[_0xbd41('0x66')][_0xbd41('0x85')]=_0x79faeb[_0xbd41('0x66')][_0xbd41('0x8f')][0x0][_0xbd41('0x85')];break;case _0xbd41('0x90'):_0x6a696b[_0xbd41('0x66')][_0xbd41('0x88')]=_0x79faeb[_0xbd41('0x66')][_0xbd41('0x91')];_0x6a696b['body']['body']=_0x79faeb[_0xbd41('0x66')][_0xbd41('0x92')][_0xbd41('0x2a')];break;case _0xbd41('0x93'):_0x6a696b[_0xbd41('0x66')][_0xbd41('0x88')]=_0x79faeb[_0xbd41('0x66')][_0xbd41('0x94')];_0x6a696b['body'][_0xbd41('0x66')]=_0x79faeb[_0xbd41('0x66')][_0xbd41('0x95')];_0x6a696b[_0xbd41('0x66')][_0xbd41('0x85')]=_0x79faeb[_0xbd41('0x66')][_0xbd41('0x96')];break;case _0xbd41('0x97'):_0x6a696b[_0xbd41('0x66')]['messageId']=_0x79faeb[_0xbd41('0x66')][0x0][_0xbd41('0x2a')]['id'];_0x6a696b[_0xbd41('0x66')][_0xbd41('0x88')]=_0x79faeb['body'][0x0][_0xbd41('0x2a')][_0xbd41('0x88')];_0x6a696b[_0xbd41('0x66')]['body']=_0x79faeb[_0xbd41('0x66')][0x0][_0xbd41('0x2a')][_0xbd41('0x95')];break;case _0xbd41('0x98'):_0x6a696b['body'][_0xbd41('0x88')]=_0x79faeb[_0xbd41('0x66')][_0xbd41('0x88')];_0x6a696b[_0xbd41('0x66')]['body']=_0x79faeb[_0xbd41('0x66')][_0xbd41('0x2a')];_0x6a696b[_0xbd41('0x66')][_0xbd41('0x85')]=_0x79faeb[_0xbd41('0x66')][_0xbd41('0x99')];break;}}if(_0x6a696b[_0xbd41('0x66')]['id']){delete _0x6a696b['body']['id'];}if(_[_0xbd41('0x9a')](_0x6a696b['body'][_0xbd41('0x88')])){throw new db[(_0xbd41('0x7a'))]['ValidationError'](_0xbd41('0x9b'));}if(_[_0xbd41('0x9a')](_0x6a696b['body'][_0xbd41('0x66')])||_0x6a696b[_0xbd41('0x66')][_0xbd41('0x66')]===''){throw new db[(_0xbd41('0x7a'))][(_0xbd41('0x7b'))](_0xbd41('0x9c'));}if(_[_0xbd41('0x9a')](_0x6a696b[_0xbd41('0x66')][_0xbd41('0x9d')])){throw new db['Sequelize'][(_0xbd41('0x7b'))](_0xbd41('0x9e')+_0x93cec4);}if(!_[_0xbd41('0x9f')](_0x93cec4,_0x6a696b['body'][_0xbd41('0x9d')])){throw new db[(_0xbd41('0x7a'))][(_0xbd41('0x7b'))](_0xbd41('0xa0')+_0x93cec4);}_0x3f4b77[_0x6a696b[_0xbd41('0x66')][_0xbd41('0x9d')]]=_0x6a696b[_0xbd41('0x66')]['from'];return db[_0xbd41('0xa1')]['find']({'where':{'id':_0x6a696b[_0xbd41('0x77')]['ListId']},'include':[{'model':db[_0xbd41('0xa2')],'as':_0xbd41('0xa3'),'where':_0x3f4b77,'limit':0x1,'order':[['updatedAt',_0xbd41('0xa4')]]}]});})[_0xbd41('0x22')](handleEntityNotFound(_0x40b7cd,null))[_0xbd41('0x22')](function(_0x37c96){if(_0x37c96){_0x6a696b[_0xbd41('0xa5')]=_[_0xbd41('0xa6')](_0x37c96,['Contacts']);if(_0x37c96[_0xbd41('0xa3')][_0xbd41('0x4a')]){return _0x37c96[_0xbd41('0xa3')][0x0];}var _0x35affa=_[_0xbd41('0x1c')](_0x6a696b[_0xbd41('0x66')],{'firstName':_0x6a696b[_0xbd41('0x66')][_0xbd41('0x88')],'ListId':_0x37c96['id']});_0x35affa[_0x6a696b[_0xbd41('0x66')][_0xbd41('0x9d')]]=_0x6a696b['body'][_0xbd41('0x88')];return db[_0xbd41('0xa2')]['create'](_0x35affa,{'fields':_0x5b8cf6,'raw':!![]});}})[_0xbd41('0x22')](handleEntityNotFound(_0x40b7cd,null))[_0xbd41('0x22')](function(_0x9e2141){if(_0x9e2141){_0x6a696b[_0xbd41('0xa7')]=_0x9e2141;var _0xaaf69c={'ContactId':_0x9e2141['id'],'phone':_0x6a696b[_0xbd41('0x66')]['from'],'SmsAccountId':_0x79faeb[_0xbd41('0x58')]['id']};var _0x4a8a61={'ContactId':_0x9e2141['id'],'SmsAccountId':_0x79faeb[_0xbd41('0x58')]['id'],'closed':![]};return db['SmsInteraction'][_0xbd41('0x5c')]({'where':_0x4a8a61})[_0xbd41('0x22')](function(_0x22ef3d){if(_0x22ef3d){return[_0x22ef3d,![]];}return db['SmsInteraction'][_0xbd41('0x5d')](_0xaaf69c)['then'](function(_0x8d0c3a){return[_0x8d0c3a,!![]];});});}})[_0xbd41('0xa8')](function(_0x3c631b,_0x4211d4){_0x6a696b[_0xbd41('0xa9')]=_0x3c631b[_0xbd41('0x3a')]({'plain':!![]});_0x6a696b[_0xbd41('0xa9')]['created']=![];if(_0x4211d4){if(_0x6a696b[_0xbd41('0x77')][_0xbd41('0xaa')]){_0x6a696b[_0xbd41('0xab')]['push']({'id':0x0,'priority':_0x6a696b[_0xbd41('0xab')][_0xbd41('0x4a')]+0x1,'app':_0xbd41('0xac'),'appdata':'unmanaged','interval':_0xbd41('0xad')});}_0x6a696b[_0xbd41('0xa9')][_0xbd41('0xae')]=!![];}return db['SmsMessage']['create']({'phone':_0x6a696b[_0xbd41('0x66')]['from'],'messageId':_0x6a696b['body']['messageId'],'body':_0x6a696b[_0xbd41('0x66')]['body'],'SmsAccountId':_0x79faeb['params']['id'],'SmsInteractionId':_0x3c631b['id'],'direction':'in','ContactId':_0x3c631b[_0xbd41('0xaf')],'AttachmentId':_0x6a696b['body'][_0xbd41('0xb0')]});})[_0xbd41('0x22')](function(_0x21bdda){_0x6a696b[_0xbd41('0x2a')]=_0x21bdda;if(!_0x6a696b[_0xbd41('0xa9')]['UserId'])return;return db[_0xbd41('0xb1')][_0xbd41('0x5c')]({'attributes':['id',_0xbd41('0x3c')],'where':{'id':_0x6a696b[_0xbd41('0xa9')][_0xbd41('0xb2')]}});})['then'](function(_0x18f180){if(_0x18f180){_0x6a696b[_0xbd41('0xab')][_0xbd41('0xb3')]({'id':0x0,'priority':0x0,'app':_0xbd41('0xb4'),'appdata':_0x18f180[_0xbd41('0x3c')]+','+(_0x6a696b['account']['waitForTheAssignedAgent']||0xa),'interval':_0xbd41('0xad')});}if(!_0x6a696b[_0xbd41('0xa9')][_0xbd41('0xb5')])return;return db['SmsQueue'][_0xbd41('0x5c')]({'attributes':['id',_0xbd41('0x3c')],'where':{'id':_0x6a696b['interaction'][_0xbd41('0xb5')]}});})[_0xbd41('0x22')](function(_0x37e987){if(_0x37e987){_0x6a696b[_0xbd41('0xab')][_0xbd41('0xb3')]({'id':0x0,'priority':0x1,'app':_0xbd41('0xb6'),'appdata':_0x37e987[_0xbd41('0x3c')]+','+(_0x6a696b['account']['waitForTheAssignedQueue']||0x12c),'interval':_0xbd41('0xad')});}return respondWithRpcPromise(_0xbd41('0xb7'),_0xbd41('0xb8'),_0x6a696b);})[_0xbd41('0x22')](function(_0x170dec){if(_0x170dec){var _0x299527=0xc8;var _0xbd91a0=_0xbd41('0xb9');logger[_0xbd41('0x2b')](_0xbd41('0x26'),_0xbd91a0,_0x299527,'entity\x20found');logger['debug'](_0xbd41('0xba'),_0xbd91a0,_0x299527,_0xbd41('0xbb'),JSON[_0xbd41('0x27')](_0x170dec));if(_0x6a696b[_0xbd41('0x77')][_0xbd41('0x42')]===_0xbd41('0xbc')){return _0x40b7cd[_0xbd41('0x2e')](_0x299527)[_0xbd41('0xbd')](_0xbd41('0xbe'),'text/xml')[_0xbd41('0x3d')](_0xbd41('0xbf'));}else{return _0x40b7cd[_0xbd41('0x2e')](_0x299527)['json'](_0x170dec);}}})[_0xbd41('0x2d')](handleError(_0x40b7cd,null));};exports[_0xbd41('0xc0')]=function(_0x2e2b48,_0x318345){var _0x2f4cff=_0x2e2b48[_0xbd41('0x58')]['id'];var _0x38caa4=_0x2e2b48['body'];var _0x59496c=0xc8;var _0x373eb4=null;return db[_0xbd41('0xc1')]['transaction']({'isolationLevel':db[_0xbd41('0xc1')][_0xbd41('0xc2')][_0xbd41('0xc3')]['READ_COMMITTED']},function(_0x3c2724){return db[_0xbd41('0x41')][_0xbd41('0x6b')]({'where':{'id':_0x2f4cff},'transaction':_0x3c2724})[_0xbd41('0x22')](function(_0x52226b){if(_0x52226b){return db[_0xbd41('0x75')][_0xbd41('0x3b')]({'where':{'SmsAccountId':_0x2f4cff},'transaction':_0x3c2724})[_0xbd41('0x22')](function(){var _0x1d692e=_[_0xbd41('0x40')](_0x38caa4,function(_0x270eff){_0x270eff[_0xbd41('0x69')]=_0x2f4cff;return _0x270eff;});return db[_0xbd41('0x75')][_0xbd41('0xc4')](_0x1d692e,{'transaction':_0x3c2724});});}else{_0x59496c=0x194;_0x373eb4=[];}});})[_0xbd41('0x22')](function(){if(_0x59496c!==0x194){return db[_0xbd41('0x75')][_0xbd41('0xc5')]({'where':{'SmsAccountId':_0x2f4cff},'order':'priority'})['then'](function(_0x588674){_0x373eb4=_0x588674;});}})[_0xbd41('0x2d')](function(_0x49855c){_0x59496c=0x1f4;logger[_0xbd41('0x28')](_0x49855c[_0xbd41('0xc6')]);if(_0x49855c[_0xbd41('0x3c')]){delete _0x49855c['name'];}_0x373eb4=_0x49855c;})['finally'](function(){if(_0x373eb4===null){_0x318345['sendStatus'](_0x59496c);}else{if(_0x59496c===0x1f4){_0x318345[_0xbd41('0x2e')](_0x59496c)[_0xbd41('0x3d')](_0x373eb4);}else{_0x318345[_0xbd41('0x2e')](_0x59496c)[_0xbd41('0x35')](_0x373eb4);}}});};exports[_0xbd41('0xc7')]=function(_0x1db5ba,_0x10a6bc,_0x23b71d){var _0x29d858={};var _0x25c342={};var _0xdf9d8f;var _0x303ca5;return db[_0xbd41('0x41')][_0xbd41('0x6b')]({'where':{'id':_0x1db5ba[_0xbd41('0x58')]['id']}})[_0xbd41('0x22')](handleEntityNotFound(_0x10a6bc,null))[_0xbd41('0x22')](function(_0x62f4b6){if(_0x62f4b6){_0xdf9d8f=_0x62f4b6;_0x25c342['model']=_[_0xbd41('0x59')](db[_0xbd41('0x75')][_0xbd41('0x5a')]);_0x25c342['query']=_[_0xbd41('0x59')](_0x1db5ba[_0xbd41('0x45')]);_0x25c342['filters']=_['intersection'](_0x25c342['model'],_0x25c342[_0xbd41('0x45')]);_0x29d858[_0xbd41('0x48')]=_[_0xbd41('0x47')](_0x25c342[_0xbd41('0x44')],qs[_0xbd41('0x49')](_0x1db5ba[_0xbd41('0x45')]['fields']));_0x29d858[_0xbd41('0x48')]=_0x29d858['attributes']['length']?_0x29d858[_0xbd41('0x48')]:_0x25c342['model'];_0x29d858[_0xbd41('0x4c')]=qs['sort'](_0x1db5ba[_0xbd41('0x45')][_0xbd41('0x4d')]);_0x29d858[_0xbd41('0x4e')]=qs['filters'](_[_0xbd41('0x4f')](_0x1db5ba[_0xbd41('0x45')],_0x25c342['filters']));if(_0x1db5ba[_0xbd41('0x45')][_0xbd41('0x50')]){_0x29d858['where']=_['merge'](_0x29d858[_0xbd41('0x4e')],{'$or':_['map'](_0x29d858[_0xbd41('0x48')],function(_0x512582){var _0x4dce0e={};_0x4dce0e[_0x512582]={'$like':'%'+_0x1db5ba['query'][_0xbd41('0x50')]+'%'};return _0x4dce0e;})});}_0x29d858=_[_0xbd41('0x52')]({},_0x29d858,_0x1db5ba['options']);return _0xdf9d8f['getApplications'](_0x29d858);}})['then'](function(_0x413b6a){if(_0x413b6a){_0x303ca5=_0x413b6a[_0xbd41('0x4a')];if(!_0x1db5ba[_0xbd41('0x45')]['hasOwnProperty']('nolimit')){_0x29d858[_0xbd41('0x31')]=qs[_0xbd41('0x31')](_0x1db5ba[_0xbd41('0x45')]['limit']);_0x29d858[_0xbd41('0x33')]=qs['offset'](_0x1db5ba[_0xbd41('0x45')]['offset']);}return _0xdf9d8f[_0xbd41('0xc7')](_0x29d858);}})[_0xbd41('0x22')](function(_0x3fe5cd){if(_0x3fe5cd){return _0x3fe5cd?{'count':_0x303ca5,'rows':_0x3fe5cd}:null;}})[_0xbd41('0x22')](respondWithResult(_0x10a6bc,null))[_0xbd41('0x2d')](handleError(_0x10a6bc,null));};exports[_0xbd41('0xc8')]=function(_0x805dd1,_0x3a33e8,_0x5abe8f){var _0x17aec4={'raw':![],'where':{}};var _0x114ca4={};var _0x2ab654={'count':0x0,'rows':[]};return db[_0xbd41('0x41')]['findOne']({'where':{'id':_0x805dd1[_0xbd41('0x58')]['id']}})[_0xbd41('0x22')](handleEntityNotFound(_0x3a33e8,null))[_0xbd41('0x22')](function(_0x3c2b){if(_0x3c2b){_0x114ca4[_0xbd41('0x44')]=_[_0xbd41('0x59')](db['SmsInteraction'][_0xbd41('0x5a')]);_0x114ca4['query']=_[_0xbd41('0x59')](_0x805dd1[_0xbd41('0x45')]);_0x114ca4[_0xbd41('0x46')]=_['intersection'](_0x114ca4['model'],_0x114ca4[_0xbd41('0x45')]);_0x17aec4[_0xbd41('0x48')]=_['intersection'](_0x114ca4[_0xbd41('0x44')],qs[_0xbd41('0x49')](_0x805dd1[_0xbd41('0x45')][_0xbd41('0x49')]));_0x17aec4['attributes']=_0x17aec4['attributes'][_0xbd41('0x4a')]?_0x17aec4[_0xbd41('0x48')]:_0x114ca4[_0xbd41('0x44')];if(!_0x805dd1['query'][_0xbd41('0x6d')](_0xbd41('0x4b'))){_0x17aec4[_0xbd41('0x31')]=qs[_0xbd41('0x31')](_0x805dd1[_0xbd41('0x45')][_0xbd41('0x31')]);_0x17aec4[_0xbd41('0x33')]=qs[_0xbd41('0x33')](_0x805dd1['query']['offset']);}_0x17aec4[_0xbd41('0x4c')]=qs[_0xbd41('0x4d')](_0x805dd1['query']['sort']);_0x17aec4['where']=qs['filters'](_[_0xbd41('0x4f')](_0x805dd1[_0xbd41('0x45')],_0x114ca4[_0xbd41('0x46')]));_0x17aec4[_0xbd41('0x4e')][_0xbd41('0x69')]=_0x3c2b['id'];if(_0x805dd1['query']['filter']){_0x17aec4[_0xbd41('0x4e')]=_[_0xbd41('0x52')](_0x17aec4[_0xbd41('0x4e')],{'$or':_['map'](_0x17aec4['attributes'],function(_0x2b9b26){var _0x39c05d={};_0x39c05d[_0x2b9b26]={'$like':'%'+_0x805dd1[_0xbd41('0x45')][_0xbd41('0x50')]+'%'};return _0x39c05d;})});}_0x17aec4=_['merge']({},_0x17aec4,_0x805dd1['options']);return db[_0xbd41('0xc9')][_0xbd41('0x32')]({'where':_0x17aec4['where']})[_0xbd41('0x22')](function(_0x5db53c){_0x2ab654[_0xbd41('0x32')]=_0x5db53c;if(_0x805dd1['query'][_0xbd41('0x5b')]){_0x17aec4[_0xbd41('0x54')]=[{'model':db['CmContact'],'as':_0xbd41('0xca'),'required':![]},{'model':db[_0xbd41('0xb1')],'as':_0xbd41('0xcb'),'attributes':[_0xbd41('0x3c'),_0xbd41('0xcc'),'internal'],'required':![]},{'model':db[_0xbd41('0xcd')],'as':_0xbd41('0xce'),'attributes':['id','name','color'],'where':_0x805dd1[_0xbd41('0x45')][_0xbd41('0xcf')]?{'id':_0x805dd1['query'][_0xbd41('0xcf')]}:undefined,'required':_0x805dd1[_0xbd41('0x45')]['tag']?!![]:![]}];}return db[_0xbd41('0xc9')][_0xbd41('0x55')](_0x17aec4);})[_0xbd41('0x22')](function(_0x45455b){_0x2ab654['rows']=_0x45455b;return _0x2ab654;});}})[_0xbd41('0x22')](respondWithFilteredResult(_0x3a33e8,_0x17aec4))[_0xbd41('0x2d')](handleError(_0x3a33e8,null));};exports['send']=function(_0x37613f,_0x4a3c81,_0xc3b592){var _0x38ba7a,_0x4c1c3c,_0x4c2ebe;if(_[_0xbd41('0x9a')](_0x37613f[_0xbd41('0x66')]['body'])||_0x37613f['body'][_0xbd41('0x66')]===''){throw new db[(_0xbd41('0x7a'))][(_0xbd41('0x7b'))](_0xbd41('0x9c'));}if(_[_0xbd41('0x9a')](_0x37613f['body']['to'])){throw new db['Sequelize']['ValidationError']('to\x20is\x20mandatory');}_0x38ba7a=_0x37613f['body']['to'];return db[_0xbd41('0x41')][_0xbd41('0x5c')]({'where':{'id':_0x37613f[_0xbd41('0x58')]['id']},'include':[{'model':db[_0xbd41('0xa1')],'as':'List','include':[{'model':db[_0xbd41('0xa2')],'as':_0xbd41('0xa3'),'where':{'mobile':_0x38ba7a},'limit':0x1,'order':[[_0xbd41('0x7e'),'DESC']]}]}]})[_0xbd41('0x22')](handleEntityNotFound(_0x4a3c81,null))[_0xbd41('0x22')](function(_0x4c8cc7){if(_0x4c8cc7&&_0x4c8cc7[_0xbd41('0xd0')]){_0x4c1c3c=_0x4c8cc7[_0xbd41('0x3a')]({'plain':!![]});if(_0x4c1c3c[_0xbd41('0xd0')]&&_0x4c1c3c['List'][_0xbd41('0xa3')][_0xbd41('0x4a')]){return _0x4c1c3c[_0xbd41('0xd0')][_0xbd41('0xa3')][0x0];}return db[_0xbd41('0xa2')]['create'](_[_0xbd41('0x1c')](_0x37613f['body'],{'firstName':_0x38ba7a,'mobile':_0x38ba7a,'phone':_0x38ba7a,'ListId':_0x4c1c3c[_0xbd41('0x81')]}));}})[_0xbd41('0x22')](handleEntityNotFound(_0x4a3c81,null))[_0xbd41('0x22')](function(_0x4921bd){if(_0x4921bd){_0x4c2ebe=_0x4921bd;return db[_0xbd41('0xc9')][_0xbd41('0x5c')]({'where':{'ContactId':_0x4c2ebe['id'],'closed':![],'SmsAccountId':_0x4c1c3c['id']}})[_0xbd41('0x22')](function(_0x171ee1){if(_0x171ee1){return[_0x171ee1,![]];}return db[_0xbd41('0xc9')][_0xbd41('0x5d')]({'UserId':_0x37613f['user']['id'],'ContactId':_0x4c2ebe['id'],'SmsAccountId':_0x4c1c3c['id'],'phone':_0x38ba7a,'firstMsgDirection':_0xbd41('0xd1'),'Messages':[_[_0xbd41('0x52')](_0x37613f[_0xbd41('0x66')],{'read':![],'body':_0x37613f['body'][_0xbd41('0x66')],'phone':_0x38ba7a,'SmsAccountId':_0x4c1c3c['id'],'UserId':_0x37613f[_0xbd41('0x5f')]['id'],'ContactId':_0x4c2ebe['id']})]},{'include':[{'model':db[_0xbd41('0xd2')],'as':_0xbd41('0xd3')}]})['then'](function(_0xaa7e29){return[_0xaa7e29,!![]];});});}})[_0xbd41('0xa8')](function(_0x507d3e,_0x23de05){if(_0x23de05){return _0x507d3e;}return db[_0xbd41('0xd2')][_0xbd41('0x5d')](_[_0xbd41('0x52')](_0x37613f['body'],{'read':![],'body':_0x37613f[_0xbd41('0x66')]['body'],'phone':_0x38ba7a,'SmsAccountId':_0x4c1c3c['id'],'SmsInteractionId':_0x507d3e['id'],'UserId':_0x37613f[_0xbd41('0x5f')]['id'],'ContactId':_0x4c2ebe['id']}))[_0xbd41('0x22')](function(_0x58d2c1){_0x507d3e[_0xbd41('0xd4')][_0xbd41('0xd3')]=[];_0x507d3e['dataValues'][_0xbd41('0xd3')]['push'](_0x58d2c1[_0xbd41('0xd4')]);return _0x507d3e;});})[_0xbd41('0x22')](respondWithResult(_0x4a3c81,null))[_0xbd41('0x2d')](handleError(_0x4a3c81,null));};exports[_0xbd41('0x2e')]=function(_0x3129c2,_0x183595,_0x5e8a97){if(_0x3129c2[_0xbd41('0x66')]['id']){delete _0x3129c2['body']['id'];}var _0x1c2c0b,_0x27595c,_0x3fffd6;return db[_0xbd41('0x41')][_0xbd41('0x5c')]({'where':{'id':_0x3129c2[_0xbd41('0x58')]['id']}})[_0xbd41('0x22')](handleEntityNotFound(_0x183595,null))[_0xbd41('0x22')](function(_0x510c7a){if(_0x510c7a){_0x3fffd6=_0x510c7a;logger[_0xbd41('0x25')](_0xbd41('0x26'),_0xbd41('0x2e'),'received\x20delivery\x20report\x20from',_0x510c7a['type'],util[_0xbd41('0xd5')](_0x3129c2[_0xbd41('0x66')],{'showHidden':![],'depth':null}));switch(_0x510c7a[_0xbd41('0x42')]){case _0xbd41('0x87'):if(_0x3129c2[_0xbd41('0x66')][_0xbd41('0xd6')]&&_0x3129c2['body']['status']){_0x27595c=_0x3129c2[_0xbd41('0x66')][_0xbd41('0x2e')];return db[_0xbd41('0xd2')]['find']({'where':{'messageId':_0x3129c2['body'][_0xbd41('0xd6')]}});}break;case _0xbd41('0xd7'):if(_0x3129c2[_0xbd41('0x66')]['requestid']&&_0x3129c2[_0xbd41('0x66')]['statusInt']){_0x27595c=_0x3129c2[_0xbd41('0x66')]['statusInt'];return db[_0xbd41('0xd2')][_0xbd41('0x5c')]({'where':{'messageId':_0x3129c2['body'][_0xbd41('0xd8')]}});}break;case _0xbd41('0x8a'):if(_0x3129c2['body']['message_id']&&_0x3129c2[_0xbd41('0x66')][_0xbd41('0xd9')]){_0x27595c=_0x3129c2[_0xbd41('0x66')]['status_code'];return db['SmsMessage'][_0xbd41('0x5c')]({'where':{'messageId':_0x3129c2[_0xbd41('0x66')]['message_id']}});}break;case _0xbd41('0x8e'):var _0x2427ca=_0x3129c2[_0xbd41('0x66')][_0xbd41('0x8f')][0x0];if(_0x2427ca[_0xbd41('0x85')]&&_0x2427ca['status'][_0xbd41('0xda')]===_0xbd41('0xdb')){_0x27595c=_0x2427ca[_0xbd41('0x2e')][_0xbd41('0xda')];return db[_0xbd41('0xd2')][_0xbd41('0x5c')]({'where':{'messageId':_0x2427ca['messageId']}});}break;case _0xbd41('0x93'):if(_0x3129c2[_0xbd41('0x66')][_0xbd41('0x85')]&&_0x3129c2[_0xbd41('0x66')]['status']){_0x27595c=_0x3129c2['body'][_0xbd41('0x2e')];return db['SmsMessage'][_0xbd41('0x5c')]({'where':{'messageId':_0x3129c2[_0xbd41('0x66')][_0xbd41('0x85')]}});}break;case'bandwidth':if(_0x3129c2['body'][0x0][_0xbd41('0x2a')]['id']){_0x27595c=_0x3129c2[_0xbd41('0x66')][0x0][_0xbd41('0x42')];return db[_0xbd41('0xd2')][_0xbd41('0x5c')]({'where':{'messageId':_0x3129c2[_0xbd41('0x66')][0x0][_0xbd41('0x2a')]['id']}});}break;case _0xbd41('0x98'):if(_0x3129c2[_0xbd41('0x66')]['redif']&&_0x3129c2[_0xbd41('0x66')][_0xbd41('0x2e')]){_0x27595c=_0x3129c2[_0xbd41('0x66')][_0xbd41('0x2e')];return db[_0xbd41('0xd2')][_0xbd41('0x5c')]({'where':{'messageId':_0x3129c2[_0xbd41('0x66')][_0xbd41('0xdc')]}});}break;}}})[_0xbd41('0x22')](handleEntityNotFound(_0x183595,null))[_0xbd41('0x22')](function(_0x14445b){if(_0x14445b){_0x1c2c0b=_0x14445b;switch(_0x3fffd6[_0xbd41('0x42')]){case _0xbd41('0x87'):if(_0x27595c===_0xbd41('0xdb')){return _0x1c2c0b[_0xbd41('0x39')]({'read':!![]});}else{logger[_0xbd41('0x28')](_0xbd41('0x26'),_0xbd41('0x2e'),_0xbd41('0x87'),util[_0xbd41('0xd5')](_0x3129c2[_0xbd41('0x66')],{'showHidden':![],'depth':null}));}break;case _0xbd41('0xd7'):if(_0x27595c==='1'){return _0x1c2c0b[_0xbd41('0x39')]({'read':!![]});}else{logger[_0xbd41('0x28')](_0xbd41('0x26'),'status',_0xbd41('0x87'),util['inspect'](_0x3129c2[_0xbd41('0x66')],{'showHidden':![],'depth':null}));}break;case _0xbd41('0x8a'):if(!_0x3129c2[_0xbd41('0x66')]['error_code']&&_0x27595c>=0xc8&&_0x27595c<=0xce){return _0x1c2c0b[_0xbd41('0x39')]({'read':!![]});}else{logger[_0xbd41('0x28')](_0xbd41('0x26'),_0xbd41('0x2e'),_0xbd41('0x8a'),util[_0xbd41('0xd5')](_0x3129c2[_0xbd41('0x66')],{'showHidden':![],'depth':null}));}break;case _0xbd41('0x8e'):var _0x2185c8=_0x3129c2[_0xbd41('0x66')][_0xbd41('0x8f')][0x0];if(_0x2185c8[_0xbd41('0x2e')][_0xbd41('0xda')]===_0xbd41('0xdb')){return _0x1c2c0b[_0xbd41('0x39')]({'read':!![]});}else{logger['error'](_0xbd41('0x26'),_0xbd41('0x2e'),_0xbd41('0x8e'),util['inspect'](_0x3129c2['body'],{'showHidden':![],'depth':null}));}break;case _0xbd41('0x93'):if(_0x27595c==_0xbd41('0xdd')||_0x27595c==_0xbd41('0xde')){return _0x1c2c0b['update']({'read':!![]});}else{logger[_0xbd41('0x28')](_0xbd41('0x26'),_0xbd41('0x2e'),'clickatell',util[_0xbd41('0xd5')](_0x3129c2[_0xbd41('0x66')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x27595c=='message-delivered'){return _0x1c2c0b['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xbd41('0x97'),util[_0xbd41('0xd5')](_0x3129c2[_0xbd41('0x66')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x27595c===_0xbd41('0xdf')||_0x27595c===_0xbd41('0xe0')){return _0x1c2c0b[_0xbd41('0x39')]({'read':!![]});}else{logger[_0xbd41('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','intelepeer',util[_0xbd41('0xd5')](_0x3129c2[_0xbd41('0x66')],{'showHidden':![],'depth':null}));}break;}return _0x1c2c0b;}})[_0xbd41('0x22')](respondWithResult(_0x183595,null))[_0xbd41('0x2d')](handleError(_0x183595,null));};exports[_0xbd41('0xe1')]=function(_0x620d42,_0x438487,_0x59431c){var _0x59d2a6,_0x5b63a7,_0x1aa59e;return db['SmsAccount'][_0xbd41('0x5c')]({'where':{'id':_0x620d42[_0xbd41('0x58')]['id']}})[_0xbd41('0x22')](handleEntityNotFound(_0x438487,null))['then'](function(_0x4cad80){if(_0x4cad80){_0x1aa59e=_0x4cad80;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbd41('0x2e'),_0xbd41('0xe2'),_0x4cad80[_0xbd41('0x42')],util['inspect'](_0x620d42[_0xbd41('0x45')],{'showHidden':![],'depth':null}));switch(_0x4cad80['type']){case _0xbd41('0x90'):if(_0x620d42['query'][_0xbd41('0xe3')]&&_0x620d42[_0xbd41('0x45')][_0xbd41('0xe4')]){_0x5b63a7=_0x620d42[_0xbd41('0x45')][_0xbd41('0xe4')];return db[_0xbd41('0xd2')][_0xbd41('0x5c')]({'where':{'messageId':_0x620d42[_0xbd41('0x45')][_0xbd41('0xe3')]}});}break;}}})[_0xbd41('0x22')](handleEntityNotFound(_0x438487,null))[_0xbd41('0x22')](function(_0x792efc){if(_0x792efc){_0x59d2a6=_0x792efc;switch(_0x1aa59e[_0xbd41('0x42')]){case'csc':if(_0x5b63a7==='2'||_0x5b63a7==='6'){return _0x59d2a6[_0xbd41('0x39')]({'read':!![]});}else{logger[_0xbd41('0x28')](_0xbd41('0x26'),'status',_0xbd41('0x90'),util[_0xbd41('0xd5')](_0x620d42[_0xbd41('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x59d2a6;}})[_0xbd41('0x22')](respondWithResult(_0x438487,null))[_0xbd41('0x2d')](handleError(_0x438487,null));};exports[_0xbd41('0xe5')]=function(_0x55e541,_0x52684a,_0x2d8cd4){return db['SmsAccount'][_0xbd41('0x5c')]({'where':{'id':_0x55e541['params']['id']}})[_0xbd41('0x22')](handleEntityNotFound(_0x52684a,null))[_0xbd41('0x22')](function(_0x5f118b){if(_0x5f118b){return _0x5f118b[_0xbd41('0xe5')](_0x55e541[_0xbd41('0x66')]['ids'],_['omit'](_0x55e541['body'],[_0xbd41('0x6f'),'id'])||{})[_0xbd41('0xa8')](function(_0x5594a3){for(var _0x399997=0x0;_0x399997<_0x55e541[_0xbd41('0x66')][_0xbd41('0x6f')][_0xbd41('0x4a')];_0x399997+=0x1){socket[_0xbd41('0xe6')](_0xbd41('0xe7'),{'UserId':Number(_0x55e541['body'][_0xbd41('0x6f')][_0x399997]),'SmsAccountId':Number(_0x55e541[_0xbd41('0x58')]['id'])});}return _0x5594a3;});}})[_0xbd41('0x22')](respondWithResult(_0x52684a,null))[_0xbd41('0x2d')](handleError(_0x52684a,null));};exports[_0xbd41('0xe8')]=function(_0x1903cc,_0x11d19,_0x2ece26){return db[_0xbd41('0x41')][_0xbd41('0x5c')]({'where':{'id':_0x1903cc['params']['id']}})[_0xbd41('0x22')](handleEntityNotFound(_0x11d19,null))['then'](function(_0xcce7d9){if(_0xcce7d9){return _0xcce7d9['removeAgents'](_0x1903cc['query']['ids'])[_0xbd41('0x22')](function(){if(_[_0xbd41('0xe9')](_0x1903cc[_0xbd41('0x45')][_0xbd41('0x6f')])){for(var _0x500343=0x0;_0x500343<_0x1903cc[_0xbd41('0x45')][_0xbd41('0x6f')][_0xbd41('0x4a')];_0x500343+=0x1){socket['emit'](_0xbd41('0xea'),{'UserId':Number(_0x1903cc[_0xbd41('0x45')][_0xbd41('0x6f')][_0x500343]),'SmsAccountId':Number(_0x1903cc['params']['id'])});}}else{socket['emit'](_0xbd41('0xea'),{'UserId':Number(_0x1903cc['query']['ids']),'SmsAccountId':Number(_0x1903cc[_0xbd41('0x58')]['id'])});}});}})[_0xbd41('0x22')](respondWithStatusCode(_0x11d19,null))[_0xbd41('0x2d')](handleError(_0x11d19,null));};exports[_0xbd41('0xeb')]=function(_0x10e099,_0x4a1b7c,_0xcb616a){var _0x82c951={};var _0x35eb0c={};var _0x3df509;var _0x42fba7;return db[_0xbd41('0x41')][_0xbd41('0x6b')]({'where':{'id':_0x10e099[_0xbd41('0x58')]['id']}})[_0xbd41('0x22')](handleEntityNotFound(_0x4a1b7c,null))[_0xbd41('0x22')](function(_0x480e0c){if(_0x480e0c){_0x3df509=_0x480e0c;_0x35eb0c[_0xbd41('0x44')]=_[_0xbd41('0x59')](db['User'][_0xbd41('0x5a')]);_0x35eb0c[_0xbd41('0x45')]=_[_0xbd41('0x59')](_0x10e099[_0xbd41('0x45')]);_0x35eb0c[_0xbd41('0x46')]=_[_0xbd41('0x47')](_0x35eb0c[_0xbd41('0x44')],_0x35eb0c[_0xbd41('0x45')]);_0x82c951[_0xbd41('0x48')]=_[_0xbd41('0x47')](_0x35eb0c[_0xbd41('0x44')],qs[_0xbd41('0x49')](_0x10e099[_0xbd41('0x45')]['fields']));_0x82c951[_0xbd41('0x48')]=_0x82c951[_0xbd41('0x48')]['length']?_0x82c951['attributes']:_0x35eb0c[_0xbd41('0x44')];_0x82c951['order']=qs['sort'](_0x10e099['query'][_0xbd41('0x4d')]);_0x82c951[_0xbd41('0x4e')]=qs['filters'](_[_0xbd41('0x4f')](_0x10e099['query'],_0x35eb0c['filters']));if(_0x10e099[_0xbd41('0x45')][_0xbd41('0x50')]){_0x82c951['where']=_[_0xbd41('0x52')](_0x82c951[_0xbd41('0x4e')],{'$or':_['map'](_0x82c951[_0xbd41('0x48')],function(_0x1d8a01){var _0x2d0897={};_0x2d0897[_0x1d8a01]={'$like':'%'+_0x10e099['query'][_0xbd41('0x50')]+'%'};return _0x2d0897;})});}_0x82c951=_[_0xbd41('0x52')]({},_0x82c951,_0x10e099[_0xbd41('0x53')]);return _0x3df509[_0xbd41('0xeb')](_0x82c951);}})['then'](function(_0x554aa5){if(_0x554aa5){_0x42fba7=_0x554aa5['length'];if(!_0x10e099[_0xbd41('0x45')][_0xbd41('0x6d')](_0xbd41('0x4b'))){_0x82c951[_0xbd41('0x31')]=qs['limit'](_0x10e099[_0xbd41('0x45')][_0xbd41('0x31')]);_0x82c951[_0xbd41('0x33')]=qs[_0xbd41('0x33')](_0x10e099[_0xbd41('0x45')][_0xbd41('0x33')]);}return _0x3df509[_0xbd41('0xeb')](_0x82c951);}})[_0xbd41('0x22')](function(_0x422a24){if(_0x422a24){return _0x422a24?{'count':_0x42fba7,'rows':_0x422a24}:null;}})[_0xbd41('0x22')](respondWithResult(_0x4a1b7c,null))[_0xbd41('0x2d')](handleError(_0x4a1b7c,null));}; \ No newline at end of file +var _0x439d=['findAll','rows','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','SmsAccountId','findOne','Disposition','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','Body','MessageSid','skebby','sender','text','connectel','clicksend','messageId','message_id','From','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','SmsQueue','queue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','stack','finally','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','push','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../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','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsAccount,\x20%s,\x20%s','message','result','catch','status','limit','count','offset','set','json','apply','reject','save','update','get','UserProfileResource','end','sendStatus','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include'];(function(_0x1f0091,_0x4025cb){var _0x58864c=function(_0x240b9a){while(--_0x240b9a){_0x1f0091['push'](_0x1f0091['shift']());}};_0x58864c(++_0x4025cb);}(_0x439d,0x17b));var _0xd439=function(_0x4cfa2e,_0x5752b5){_0x4cfa2e=_0x4cfa2e-0x0;var _0x279b50=_0x439d[_0x4cfa2e];return _0x279b50;};'use strict';var emlformat=require(_0xd439('0x0'));var rimraf=require(_0xd439('0x1'));var zipdir=require(_0xd439('0x2'));var jsonpatch=require(_0xd439('0x3'));var rp=require(_0xd439('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd439('0x5'));var csv=require(_0xd439('0x6'));var ejs=require(_0xd439('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd439('0x8'));var squel=require(_0xd439('0x9'));var crypto=require(_0xd439('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd439('0x6'));var querystring=require(_0xd439('0xb'));var Papa=require(_0xd439('0xc'));var Redis=require('ioredis');var authService=require(_0xd439('0xd'));var qs=require(_0xd439('0xe'));var as=require(_0xd439('0xf'));var hardwareService=require(_0xd439('0x10'));var logger=require(_0xd439('0x11'))(_0xd439('0x12'));var utils=require('../../config/utils');var config=require(_0xd439('0x13'));var licenseUtil=require(_0xd439('0x14'));var db=require(_0xd439('0x15'))['db'];config[_0xd439('0x16')]=_[_0xd439('0x17')](config[_0xd439('0x16')],{'host':_0xd439('0x18'),'port':0x18eb});var socket=require(_0xd439('0x19'))(new Redis(config[_0xd439('0x16')]));require('./smsAccount.socket')[_0xd439('0x1a')](socket);var jayson=require(_0xd439('0x1b'));var client=jayson[_0xd439('0x1c')][_0xd439('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x484789,_0x1b8d88,_0x46c833,_0x3c271c){return new BPromise(function(_0x5e291c,_0x420986){var _0x6e7ec6=_0x3c271c||client;return _0x6e7ec6[_0xd439('0x1e')](_0x484789,_0x46c833)[_0xd439('0x1f')](function(_0x4c70b0){logger[_0xd439('0x20')]('SmsAccount,\x20%s,\x20%s',_0x1b8d88,_0xd439('0x21'));logger[_0xd439('0x22')](_0xd439('0x23'),_0x1b8d88,'request\x20sent',JSON[_0xd439('0x24')](_0x4c70b0));if(_0x4c70b0['error']){if(_0x4c70b0['error'][_0xd439('0x25')]===0x1f4){logger[_0xd439('0x26')](_0xd439('0x27'),_0x1b8d88,_0x4c70b0[_0xd439('0x26')]['message']);return _0x420986(_0x4c70b0['error'][_0xd439('0x28')]);}logger[_0xd439('0x26')]('SmsAccount,\x20%s,\x20%s',_0x1b8d88,_0x4c70b0[_0xd439('0x26')][_0xd439('0x28')]);return _0x5e291c(_0x4c70b0[_0xd439('0x26')][_0xd439('0x28')]);}else{logger[_0xd439('0x20')]('SmsAccount,\x20%s,\x20%s',_0x1b8d88,_0xd439('0x21'));_0x5e291c(_0x4c70b0[_0xd439('0x29')]['message']);}})[_0xd439('0x2a')](function(_0x3780ff){logger[_0xd439('0x26')](_0xd439('0x27'),_0x1b8d88,_0x3780ff);_0x420986(_0x3780ff);});});}function respondWithStatusCode(_0x29346c,_0x595603){_0x595603=_0x595603||0xcc;return function(_0x3ce9f7){if(_0x3ce9f7){return _0x29346c['sendStatus'](_0x595603);}return _0x29346c[_0xd439('0x2b')](_0x595603)['end']();};}function respondWithResult(_0x4f9f0f,_0x372ef7){_0x372ef7=_0x372ef7||0xc8;return function(_0x351e67){if(_0x351e67){return _0x4f9f0f[_0xd439('0x2b')](_0x372ef7)['json'](_0x351e67);}};}function respondWithFilteredResult(_0xbf589e,_0x3fd1bd){return function(_0x243b4e){if(_0x243b4e){var _0x5cfa7a=typeof _0x3fd1bd['offset']==='undefined'&&typeof _0x3fd1bd[_0xd439('0x2c')]==='undefined';var _0x4347a1=_0x243b4e[_0xd439('0x2d')];var _0x15d9aa=_0x5cfa7a?0x0:_0x3fd1bd[_0xd439('0x2e')];var _0x30db66=_0x5cfa7a?_0x243b4e[_0xd439('0x2d')]:_0x3fd1bd[_0xd439('0x2e')]+_0x3fd1bd[_0xd439('0x2c')];var _0x3b63a0;if(_0x30db66>=_0x4347a1){_0x30db66=_0x4347a1;_0x3b63a0=0xc8;}else{_0x3b63a0=0xce;}_0xbf589e['status'](_0x3b63a0);return _0xbf589e[_0xd439('0x2f')]('Content-Range',_0x15d9aa+'-'+_0x30db66+'/'+_0x4347a1)[_0xd439('0x30')](_0x243b4e);}return null;};}function patchUpdates(_0x277eeb){return function(_0x3059e7){try{jsonpatch[_0xd439('0x31')](_0x3059e7,_0x277eeb,!![]);}catch(_0x570623){return BPromise[_0xd439('0x32')](_0x570623);}return _0x3059e7[_0xd439('0x33')]();};}function saveUpdates(_0x276c0f,_0x589238){return function(_0x12efdb){if(_0x12efdb){return _0x12efdb[_0xd439('0x34')](_0x276c0f)[_0xd439('0x1f')](function(_0xe29afe){return _0xe29afe;});}return null;};}function removeEntity(_0x192215,_0x5dbffb){return function(_0x4b9cd6){if(_0x4b9cd6){return _0x4b9cd6['destroy']()['then'](function(){var _0x26b67f=_0x4b9cd6[_0xd439('0x35')]({'plain':!![]});var _0x61fda9='SmsAccounts';return db[_0xd439('0x36')]['destroy']({'where':{'type':_0x61fda9,'resourceId':_0x26b67f['id']}})[_0xd439('0x1f')](function(){return _0x4b9cd6;});})[_0xd439('0x1f')](function(){_0x192215[_0xd439('0x2b')](0xcc)[_0xd439('0x37')]();});}};}function handleEntityNotFound(_0x4c5606,_0x56acdb){return function(_0x18b321){if(!_0x18b321){_0x4c5606[_0xd439('0x38')](0x194);}return _0x18b321;};}function handleError(_0x325a0f,_0x203d04){_0x203d04=_0x203d04||0x1f4;return function(_0x2fe31b){logger[_0xd439('0x26')](_0x2fe31b['stack']);if(_0x2fe31b['name']){delete _0x2fe31b['name'];}_0x325a0f['status'](_0x203d04)[_0xd439('0x39')](_0x2fe31b);};}exports[_0xd439('0x3a')]=function(_0x5ab337,_0x3b0335){var _0x2053e4={'include':[{'model':db[_0xd439('0x3b')],'as':_0xd439('0x3c')}]},_0x57c9a3={},_0xc74a9a={'count':0x0,'rows':[]};var _0x54a7b8=_[_0xd439('0x3d')](db[_0xd439('0x3e')][_0xd439('0x3f')],function(_0x34f8df){return{'name':_0x34f8df[_0xd439('0x40')],'type':_0x34f8df[_0xd439('0x41')][_0xd439('0x42')]};});_0x57c9a3[_0xd439('0x43')]=_[_0xd439('0x3d')](_0x54a7b8,_0xd439('0x44'));_0x57c9a3[_0xd439('0x45')]=_[_0xd439('0x46')](_0x5ab337[_0xd439('0x45')]);_0x57c9a3[_0xd439('0x47')]=_['intersection'](_0x57c9a3[_0xd439('0x43')],_0x57c9a3[_0xd439('0x45')]);_0x2053e4[_0xd439('0x48')]=_[_0xd439('0x49')](_0x57c9a3[_0xd439('0x43')],qs[_0xd439('0x4a')](_0x5ab337['query'][_0xd439('0x4a')]));_0x2053e4[_0xd439('0x48')]=_0x2053e4[_0xd439('0x48')][_0xd439('0x4b')]?_0x2053e4[_0xd439('0x48')]:_0x57c9a3[_0xd439('0x43')];if(!_0x5ab337[_0xd439('0x45')][_0xd439('0x4c')](_0xd439('0x4d'))){_0x2053e4[_0xd439('0x2c')]=qs[_0xd439('0x2c')](_0x5ab337[_0xd439('0x45')][_0xd439('0x2c')]);_0x2053e4[_0xd439('0x2e')]=qs[_0xd439('0x2e')](_0x5ab337[_0xd439('0x45')][_0xd439('0x2e')]);}_0x2053e4[_0xd439('0x4e')]=qs[_0xd439('0x4f')](_0x5ab337[_0xd439('0x45')]['sort']);_0x2053e4['where']=qs['filters'](_[_0xd439('0x50')](_0x5ab337[_0xd439('0x45')],_0x57c9a3['filters']),_0x54a7b8);if(_0x5ab337['query']['filter']){_0x2053e4[_0xd439('0x51')]=_[_0xd439('0x52')](_0x2053e4[_0xd439('0x51')],{'$or':_[_0xd439('0x3d')](_0x54a7b8,function(_0x3e4c13){if(_0x3e4c13[_0xd439('0x41')]!==_0xd439('0x53')){var _0x2c183f={};_0x2c183f[_0x3e4c13[_0xd439('0x44')]]={'$like':'%'+_0x5ab337[_0xd439('0x45')][_0xd439('0x54')]+'%'};return _0x2c183f;}})});}_0x2053e4=_[_0xd439('0x52')]({},_0x2053e4,_0x5ab337['options']);var _0x40d997={'where':_0x2053e4[_0xd439('0x51')]};return db[_0xd439('0x3e')]['count'](_0x40d997)[_0xd439('0x1f')](function(_0x4b6d9b){_0xc74a9a[_0xd439('0x2d')]=_0x4b6d9b;if(_0x5ab337[_0xd439('0x45')][_0xd439('0x55')]){_0x2053e4[_0xd439('0x56')]=[{'all':!![]}];}return db['SmsAccount'][_0xd439('0x57')](_0x2053e4);})['then'](function(_0xd1fa32){_0xc74a9a[_0xd439('0x58')]=_0xd1fa32;return _0xc74a9a;})[_0xd439('0x1f')](respondWithFilteredResult(_0x3b0335,_0x2053e4))[_0xd439('0x2a')](handleError(_0x3b0335,null));};exports['show']=function(_0x33bd8d,_0x152b63){var _0x2a6032={'raw':![],'where':{'id':_0x33bd8d['params']['id']},'include':[{'model':db[_0xd439('0x3b')],'as':_0xd439('0x3c')}]},_0x2a1de0={};_0x2a1de0['model']=_[_0xd439('0x46')](db[_0xd439('0x3e')][_0xd439('0x3f')]);_0x2a1de0[_0xd439('0x45')]=_[_0xd439('0x46')](_0x33bd8d[_0xd439('0x45')]);_0x2a1de0[_0xd439('0x47')]=_[_0xd439('0x49')](_0x2a1de0[_0xd439('0x43')],_0x2a1de0['query']);_0x2a6032[_0xd439('0x48')]=_[_0xd439('0x49')](_0x2a1de0[_0xd439('0x43')],qs[_0xd439('0x4a')](_0x33bd8d[_0xd439('0x45')][_0xd439('0x4a')]));_0x2a6032['attributes']=_0x2a6032[_0xd439('0x48')][_0xd439('0x4b')]?_0x2a6032['attributes']:_0x2a1de0[_0xd439('0x43')];if(_0x33bd8d[_0xd439('0x45')][_0xd439('0x55')]){_0x2a6032['include']=[{'all':!![]}];}_0x2a6032=_[_0xd439('0x52')]({},_0x2a6032,_0x33bd8d[_0xd439('0x59')]);return db[_0xd439('0x3e')][_0xd439('0x5a')](_0x2a6032)[_0xd439('0x1f')](handleEntityNotFound(_0x152b63,null))['then'](respondWithResult(_0x152b63,null))[_0xd439('0x2a')](handleError(_0x152b63,null));};exports[_0xd439('0x5b')]=function(_0x574df0,_0x31ab59){return db[_0xd439('0x3e')][_0xd439('0x5b')](_0x574df0[_0xd439('0x5c')],{})[_0xd439('0x1f')](function(_0x2efbe0){var _0x57e2f1=_0x574df0[_0xd439('0x5d')][_0xd439('0x35')]({'plain':!![]});if(!_0x57e2f1)throw new Error(_0xd439('0x5e'));if(_0x57e2f1[_0xd439('0x5f')]===_0xd439('0x5d')){var _0x11199d=_0x2efbe0[_0xd439('0x35')]({'plain':!![]});var _0x44f049=_0xd439('0x60');return db['UserProfileSection'][_0xd439('0x5a')]({'where':{'name':_0x44f049,'userProfileId':_0x57e2f1[_0xd439('0x61')]},'raw':!![]})[_0xd439('0x1f')](function(_0x4d5f24){if(_0x4d5f24&&_0x4d5f24[_0xd439('0x62')]===0x0){return db[_0xd439('0x36')][_0xd439('0x5b')]({'name':_0x11199d[_0xd439('0x44')],'resourceId':_0x11199d['id'],'type':_0x4d5f24[_0xd439('0x44')],'sectionId':_0x4d5f24['id']},{})[_0xd439('0x1f')](function(){return _0x2efbe0;});}else{return _0x2efbe0;}})[_0xd439('0x2a')](function(_0x63eb6c){logger['error'](_0xd439('0x63'),_0x63eb6c);throw _0x63eb6c;});}return _0x2efbe0;})['then'](respondWithResult(_0x31ab59,0xc9))[_0xd439('0x2a')](handleError(_0x31ab59,null));};exports[_0xd439('0x34')]=function(_0x5bcec5,_0x41eb8d){if(_0x5bcec5[_0xd439('0x5c')]['id']){delete _0x5bcec5[_0xd439('0x5c')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x5bcec5[_0xd439('0x64')]['id']},'include':[{'model':db[_0xd439('0x3b')],'as':_0xd439('0x3c')}]})[_0xd439('0x1f')](handleEntityNotFound(_0x41eb8d,null))[_0xd439('0x1f')](saveUpdates(_0x5bcec5[_0xd439('0x5c')],null))[_0xd439('0x1f')](respondWithResult(_0x41eb8d,null))[_0xd439('0x2a')](handleError(_0x41eb8d,null));};exports[_0xd439('0x65')]=function(_0x3671ea,_0x4ff8f9){return db[_0xd439('0x3e')][_0xd439('0x5a')]({'where':{'id':_0x3671ea['params']['id']}})[_0xd439('0x1f')](handleEntityNotFound(_0x4ff8f9,null))['then'](removeEntity(_0x4ff8f9,null))[_0xd439('0x2a')](handleError(_0x4ff8f9,null));};exports[_0xd439('0x66')]=function(_0x319f65,_0x5c0edb){return db[_0xd439('0x3e')][_0xd439('0x66')]()[_0xd439('0x1f')](respondWithResult(_0x5c0edb,null))[_0xd439('0x2a')](handleError(_0x5c0edb,null));};exports['addDisposition']=function(_0x3a19e6,_0x4936b1,_0x46f096){if(_0x3a19e6['body']['id']){delete _0x3a19e6[_0xd439('0x5c')]['id'];}return db[_0xd439('0x3e')][_0xd439('0x5a')]({'where':{'id':_0x3a19e6[_0xd439('0x64')]['id']}})[_0xd439('0x1f')](handleEntityNotFound(_0x4936b1,null))[_0xd439('0x1f')](function(_0x1c6c94){if(_0x1c6c94){_0x3a19e6[_0xd439('0x5c')][_0xd439('0x67')]=_0x1c6c94['id'];return db['Disposition'][_0xd439('0x5b')](_0x3a19e6[_0xd439('0x5c')]);}})['then'](respondWithResult(_0x4936b1,null))['catch'](handleError(_0x4936b1,null));};exports['getDispositions']=function(_0x1fd3e5,_0xfa6ec4,_0x279b4c){var _0x234862={'raw':![],'where':{}};var _0x45e7fd={};var _0x169750={'count':0x0,'rows':[]};return db[_0xd439('0x3e')][_0xd439('0x68')]({'where':{'id':_0x1fd3e5[_0xd439('0x64')]['id']}})[_0xd439('0x1f')](handleEntityNotFound(_0xfa6ec4,null))['then'](function(_0x187c93){if(_0x187c93){_0x45e7fd[_0xd439('0x43')]=_[_0xd439('0x46')](db[_0xd439('0x69')]['rawAttributes']);_0x45e7fd[_0xd439('0x45')]=_[_0xd439('0x46')](_0x1fd3e5[_0xd439('0x45')]);_0x45e7fd[_0xd439('0x47')]=_[_0xd439('0x49')](_0x45e7fd[_0xd439('0x43')],_0x45e7fd[_0xd439('0x45')]);_0x234862[_0xd439('0x48')]=_[_0xd439('0x49')](_0x45e7fd[_0xd439('0x43')],qs[_0xd439('0x4a')](_0x1fd3e5[_0xd439('0x45')][_0xd439('0x4a')]));_0x234862[_0xd439('0x48')]=_0x234862[_0xd439('0x48')][_0xd439('0x4b')]?_0x234862[_0xd439('0x48')]:_0x45e7fd[_0xd439('0x43')];if(!_0x1fd3e5[_0xd439('0x45')][_0xd439('0x4c')](_0xd439('0x4d'))){_0x234862[_0xd439('0x2c')]=qs[_0xd439('0x2c')](_0x1fd3e5['query']['limit']);_0x234862[_0xd439('0x2e')]=qs[_0xd439('0x2e')](_0x1fd3e5[_0xd439('0x45')][_0xd439('0x2e')]);}_0x234862[_0xd439('0x4e')]=qs[_0xd439('0x4f')](_0x1fd3e5[_0xd439('0x45')][_0xd439('0x4f')]);_0x234862['where']=qs[_0xd439('0x47')](_[_0xd439('0x50')](_0x1fd3e5['query'],_0x45e7fd[_0xd439('0x47')]));_0x234862['where'][_0xd439('0x67')]=_0x187c93['id'];if(_0x1fd3e5['query'][_0xd439('0x54')]){_0x234862[_0xd439('0x51')]=_[_0xd439('0x52')](_0x234862['where'],{'$or':_[_0xd439('0x3d')](_0x234862[_0xd439('0x48')],function(_0x20fe3b){var _0x10ec38={};_0x10ec38[_0x20fe3b]={'$like':'%'+_0x1fd3e5[_0xd439('0x45')][_0xd439('0x54')]+'%'};return _0x10ec38;})});}_0x234862=_[_0xd439('0x52')]({},_0x234862,_0x1fd3e5[_0xd439('0x59')]);return db[_0xd439('0x69')][_0xd439('0x2d')]({'where':_0x234862[_0xd439('0x51')]})['then'](function(_0x45e269){_0x169750[_0xd439('0x2d')]=_0x45e269;if(_0x1fd3e5['query'][_0xd439('0x55')]){_0x234862[_0xd439('0x56')]=[{'all':!![]}];}return db[_0xd439('0x69')]['findAll'](_0x234862);})['then'](function(_0x377494){_0x169750[_0xd439('0x58')]=_0x377494;return _0x169750;});}})[_0xd439('0x1f')](respondWithFilteredResult(_0xfa6ec4,_0x234862))[_0xd439('0x2a')](handleError(_0xfa6ec4,null));};exports['removeDispositions']=function(_0x3a9c58,_0x9de6a7,_0x14532e){return db[_0xd439('0x3e')]['find']({'where':{'id':_0x3a9c58['params']['id']}})[_0xd439('0x1f')](handleEntityNotFound(_0x9de6a7,null))[_0xd439('0x1f')](function(_0x47658e){if(_0x47658e){return _0x47658e[_0xd439('0x6a')](_0x3a9c58[_0xd439('0x45')][_0xd439('0x6b')]);}})[_0xd439('0x1f')](respondWithStatusCode(_0x9de6a7,null))[_0xd439('0x2a')](handleError(_0x9de6a7,null));};exports[_0xd439('0x6c')]=function(_0x522814,_0x4b72c0,_0x268746){if(_0x522814[_0xd439('0x5c')]['id']){delete _0x522814[_0xd439('0x5c')]['id'];}return db['SmsAccount'][_0xd439('0x5a')]({'where':{'id':_0x522814[_0xd439('0x64')]['id']}})[_0xd439('0x1f')](handleEntityNotFound(_0x4b72c0,null))[_0xd439('0x1f')](function(_0x3dd22d){if(_0x3dd22d){_0x522814[_0xd439('0x5c')][_0xd439('0x67')]=_0x3dd22d['id'];return db['CannedAnswer'][_0xd439('0x5b')](_0x522814['body']);}})[_0xd439('0x1f')](respondWithResult(_0x4b72c0,null))['catch'](handleError(_0x4b72c0,null));};exports[_0xd439('0x6d')]=function(_0x38053c,_0x1b7dfd,_0x4b3eb2){var _0x4bbe15={'raw':![],'where':{}};var _0x531a27={};var _0x2385e0={'count':0x0,'rows':[]};return db[_0xd439('0x3e')][_0xd439('0x68')]({'where':{'id':_0x38053c[_0xd439('0x64')]['id']}})[_0xd439('0x1f')](handleEntityNotFound(_0x1b7dfd,null))[_0xd439('0x1f')](function(_0x4fdfdf){if(_0x4fdfdf){_0x531a27[_0xd439('0x43')]=_[_0xd439('0x46')](db[_0xd439('0x6e')][_0xd439('0x3f')]);_0x531a27['query']=_[_0xd439('0x46')](_0x38053c[_0xd439('0x45')]);_0x531a27[_0xd439('0x47')]=_[_0xd439('0x49')](_0x531a27[_0xd439('0x43')],_0x531a27['query']);_0x4bbe15['attributes']=_[_0xd439('0x49')](_0x531a27[_0xd439('0x43')],qs[_0xd439('0x4a')](_0x38053c[_0xd439('0x45')]['fields']));_0x4bbe15['attributes']=_0x4bbe15[_0xd439('0x48')][_0xd439('0x4b')]?_0x4bbe15['attributes']:_0x531a27['model'];if(!_0x38053c[_0xd439('0x45')][_0xd439('0x4c')]('nolimit')){_0x4bbe15['limit']=qs['limit'](_0x38053c[_0xd439('0x45')]['limit']);_0x4bbe15[_0xd439('0x2e')]=qs[_0xd439('0x2e')](_0x38053c[_0xd439('0x45')][_0xd439('0x2e')]);}_0x4bbe15['order']=qs[_0xd439('0x4f')](_0x38053c['query'][_0xd439('0x4f')]);_0x4bbe15[_0xd439('0x51')]=qs[_0xd439('0x47')](_[_0xd439('0x50')](_0x38053c[_0xd439('0x45')],_0x531a27[_0xd439('0x47')]));_0x4bbe15[_0xd439('0x51')][_0xd439('0x67')]=_0x4fdfdf['id'];if(_0x38053c[_0xd439('0x45')]['filter']){_0x4bbe15[_0xd439('0x51')]=_[_0xd439('0x52')](_0x4bbe15[_0xd439('0x51')],{'$or':_[_0xd439('0x3d')](_0x4bbe15[_0xd439('0x48')],function(_0x42c092){var _0x5dad6d={};_0x5dad6d[_0x42c092]={'$like':'%'+_0x38053c[_0xd439('0x45')]['filter']+'%'};return _0x5dad6d;})});}_0x4bbe15=_[_0xd439('0x52')]({},_0x4bbe15,_0x38053c[_0xd439('0x59')]);return db[_0xd439('0x6e')][_0xd439('0x2d')]({'where':_0x4bbe15[_0xd439('0x51')]})[_0xd439('0x1f')](function(_0x5a8f63){_0x2385e0[_0xd439('0x2d')]=_0x5a8f63;if(_0x38053c[_0xd439('0x45')]['includeAll']){_0x4bbe15[_0xd439('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd439('0x57')](_0x4bbe15);})[_0xd439('0x1f')](function(_0x64a975){_0x2385e0[_0xd439('0x58')]=_0x64a975;return _0x2385e0;});}})[_0xd439('0x1f')](respondWithFilteredResult(_0x1b7dfd,_0x4bbe15))[_0xd439('0x2a')](handleError(_0x1b7dfd,null));};exports[_0xd439('0x6f')]=function(_0x3be6db,_0xfe1e6e,_0x49fd01){return db[_0xd439('0x3e')][_0xd439('0x5a')]({'where':{'id':_0x3be6db[_0xd439('0x64')]['id']}})[_0xd439('0x1f')](handleEntityNotFound(_0xfe1e6e,null))[_0xd439('0x1f')](function(_0x323c0e){if(_0x323c0e){return _0x323c0e[_0xd439('0x6f')](_0x3be6db[_0xd439('0x45')][_0xd439('0x6b')]);}})['then'](respondWithStatusCode(_0xfe1e6e,null))[_0xd439('0x2a')](handleError(_0xfe1e6e,null));};exports['notify']=function(_0x1c8da0,_0x4c317e,_0x53de07){var _0x5369e4={'channel':_0xd439('0x70')};var _0x42f2a2=[];var _0x5d026c=[];var _0x501ecf={};return db['SmsAccount'][_0xd439('0x5a')]({'where':{'id':_0x1c8da0[_0xd439('0x64')]['id']},'include':[{'model':db[_0xd439('0x71')],'as':_0xd439('0x72')}]})[_0xd439('0x1f')](handleEntityNotFound(_0x4c317e,null))['then'](function(_0x244e16){_0x5369e4[_0xd439('0x73')]=_0x244e16;_0x5369e4[_0xd439('0x74')]=_[_0xd439('0x75')](_0x244e16[_0xd439('0x72')],['priority'],['asc']);if(_0x5369e4[_0xd439('0x73')][_0xd439('0x72')]){delete _0x5369e4[_0xd439('0x73')][_0xd439('0x72')];}return db[_0xd439('0x76')][_0xd439('0x66')]();})[_0xd439('0x1f')](function(_0x62884c){if(!_0x62884c){throw new db[(_0xd439('0x77'))][(_0xd439('0x78'))](_0xd439('0x79'));}_0x42f2a2=_[_0xd439('0x7a')](_['keys'](_0x62884c),[_0xd439('0x7b'),'updatedAt']);_0x5d026c=_[_0xd439('0x7a')](_[_0xd439('0x46')](_0x62884c),[_0xd439('0x7b'),_0xd439('0x7c'),_0xd439('0x7d'),'ListId']);_0x5369e4['body']={'mapKey':'mobile'};if(_0x5369e4[_0xd439('0x73')]['type']){switch(_0x5369e4[_0xd439('0x73')][_0xd439('0x41')]){case'twilio':_0x5369e4['body'][_0xd439('0x7e')]=_0x1c8da0['body']['From'];_0x5369e4['body'][_0xd439('0x5c')]=_0x1c8da0[_0xd439('0x5c')][_0xd439('0x7f')];_0x5369e4[_0xd439('0x5c')]['messageId']=_0x1c8da0[_0xd439('0x5c')][_0xd439('0x80')];break;case _0xd439('0x81'):_0x5369e4[_0xd439('0x5c')][_0xd439('0x7e')]='+'+_0x1c8da0[_0xd439('0x5c')][_0xd439('0x82')];_0x5369e4['body'][_0xd439('0x5c')]=_0x1c8da0[_0xd439('0x5c')][_0xd439('0x83')];break;case _0xd439('0x84'):_0x5369e4['body'][_0xd439('0x7e')]=_0x1c8da0[_0xd439('0x5c')]['from'];_0x5369e4[_0xd439('0x5c')][_0xd439('0x5c')]=_0x1c8da0[_0xd439('0x5c')][_0xd439('0x28')];break;case _0xd439('0x85'):_0x5369e4[_0xd439('0x5c')]['from']=_0x1c8da0[_0xd439('0x5c')][_0xd439('0x7e')];_0x5369e4['body']['body']=_0x1c8da0['body'][_0xd439('0x5c')];_0x5369e4[_0xd439('0x5c')][_0xd439('0x86')]=_0x1c8da0[_0xd439('0x5c')][_0xd439('0x87')];break;case'plivo':_0x5369e4[_0xd439('0x5c')][_0xd439('0x7e')]=_0x1c8da0['body'][_0xd439('0x88')];_0x5369e4[_0xd439('0x5c')][_0xd439('0x5c')]=_0x1c8da0[_0xd439('0x5c')][_0xd439('0x89')];_0x5369e4[_0xd439('0x5c')][_0xd439('0x86')]=_0x1c8da0[_0xd439('0x5c')][_0xd439('0x8a')];break;case _0xd439('0x8b'):_0x5369e4[_0xd439('0x5c')]['from']='+'+_0x1c8da0['body']['results'][0x0][_0xd439('0x7e')];_0x5369e4[_0xd439('0x5c')][_0xd439('0x5c')]=_0x1c8da0[_0xd439('0x5c')][_0xd439('0x8c')][0x0][_0xd439('0x83')];_0x5369e4[_0xd439('0x5c')][_0xd439('0x86')]=_0x1c8da0['body'][_0xd439('0x8c')][0x0][_0xd439('0x86')];break;case _0xd439('0x8d'):_0x5369e4[_0xd439('0x5c')][_0xd439('0x7e')]=_0x1c8da0[_0xd439('0x5c')]['originatingAddress'];_0x5369e4[_0xd439('0x5c')]['body']=_0x1c8da0[_0xd439('0x5c')][_0xd439('0x8e')][_0xd439('0x28')];break;case _0xd439('0x8f'):_0x5369e4['body'][_0xd439('0x7e')]=_0x1c8da0['body'][_0xd439('0x90')];_0x5369e4[_0xd439('0x5c')][_0xd439('0x5c')]=_0x1c8da0[_0xd439('0x5c')][_0xd439('0x83')];_0x5369e4[_0xd439('0x5c')][_0xd439('0x86')]=_0x1c8da0[_0xd439('0x5c')][_0xd439('0x91')];break;case _0xd439('0x92'):_0x5369e4[_0xd439('0x5c')]['messageId']=_0x1c8da0[_0xd439('0x5c')][0x0]['message']['id'];_0x5369e4['body'][_0xd439('0x7e')]=_0x1c8da0[_0xd439('0x5c')][0x0][_0xd439('0x28')][_0xd439('0x7e')];_0x5369e4[_0xd439('0x5c')][_0xd439('0x5c')]=_0x1c8da0['body'][0x0][_0xd439('0x28')][_0xd439('0x83')];break;case _0xd439('0x93'):_0x5369e4[_0xd439('0x5c')][_0xd439('0x7e')]=_0x1c8da0[_0xd439('0x5c')]['from'];_0x5369e4['body'][_0xd439('0x5c')]=_0x1c8da0[_0xd439('0x5c')][_0xd439('0x28')];_0x5369e4[_0xd439('0x5c')][_0xd439('0x86')]=_0x1c8da0['body'][_0xd439('0x94')];break;}}if(_0x5369e4['body']['id']){delete _0x5369e4[_0xd439('0x5c')]['id'];}if(_['isNil'](_0x5369e4[_0xd439('0x5c')][_0xd439('0x7e')])){throw new db[(_0xd439('0x77'))][(_0xd439('0x78'))]('from\x20is\x20mandatory');}if(_[_0xd439('0x95')](_0x5369e4[_0xd439('0x5c')]['body'])||_0x5369e4[_0xd439('0x5c')][_0xd439('0x5c')]===''){throw new db['Sequelize']['ValidationError'](_0xd439('0x96'));}if(_[_0xd439('0x95')](_0x5369e4[_0xd439('0x5c')][_0xd439('0x97')])){throw new db[(_0xd439('0x77'))][(_0xd439('0x78'))](_0xd439('0x98')+_0x5d026c);}if(!_[_0xd439('0x99')](_0x5d026c,_0x5369e4[_0xd439('0x5c')]['mapKey'])){throw new db[(_0xd439('0x77'))]['ValidationError'](_0xd439('0x9a')+_0x5d026c);}_0x501ecf[_0x5369e4[_0xd439('0x5c')]['mapKey']]=_0x5369e4[_0xd439('0x5c')][_0xd439('0x7e')];return db[_0xd439('0x9b')][_0xd439('0x5a')]({'where':{'id':_0x5369e4[_0xd439('0x73')][_0xd439('0x9c')]},'include':[{'model':db[_0xd439('0x76')],'as':_0xd439('0x9d'),'where':_0x501ecf,'limit':0x1,'order':[[_0xd439('0x7c'),_0xd439('0x9e')]]}]});})[_0xd439('0x1f')](handleEntityNotFound(_0x4c317e,null))[_0xd439('0x1f')](function(_0x57c41d){if(_0x57c41d){_0x5369e4[_0xd439('0x9f')]=_[_0xd439('0xa0')](_0x57c41d,[_0xd439('0x9d')]);if(_0x57c41d[_0xd439('0x9d')][_0xd439('0x4b')]){return _0x57c41d[_0xd439('0x9d')][0x0];}var _0x5c408a=_['defaults'](_0x5369e4[_0xd439('0x5c')],{'firstName':_0x5369e4[_0xd439('0x5c')][_0xd439('0x7e')],'ListId':_0x57c41d['id']});_0x5c408a[_0x5369e4[_0xd439('0x5c')][_0xd439('0x97')]]=_0x5369e4['body'][_0xd439('0x7e')];return db[_0xd439('0x76')][_0xd439('0x5b')](_0x5c408a,{'fields':_0x42f2a2,'raw':!![]});}})['then'](handleEntityNotFound(_0x4c317e,null))[_0xd439('0x1f')](function(_0x2a2bbb){if(_0x2a2bbb){_0x5369e4[_0xd439('0xa1')]=_0x2a2bbb;var _0x11004e={'ContactId':_0x2a2bbb['id'],'phone':_0x5369e4[_0xd439('0x5c')][_0xd439('0x7e')],'SmsAccountId':_0x1c8da0[_0xd439('0x64')]['id']};var _0x5ca056={'ContactId':_0x2a2bbb['id'],'SmsAccountId':_0x1c8da0['params']['id'],'closed':![]};return db[_0xd439('0xa2')][_0xd439('0x5a')]({'where':_0x5ca056})['then'](function(_0x3d7148){if(_0x3d7148){return[_0x3d7148,![]];}return db[_0xd439('0xa2')]['create'](_0x11004e)[_0xd439('0x1f')](function(_0x84c887){return[_0x84c887,!![]];});});}})[_0xd439('0xa3')](function(_0x2075c0,_0x4dc11a){_0x5369e4[_0xd439('0xa4')]=_0x2075c0[_0xd439('0x35')]({'plain':!![]});_0x5369e4[_0xd439('0xa4')][_0xd439('0xa5')]=![];if(_0x4dc11a){if(_0x5369e4['account'][_0xd439('0xa6')]){_0x5369e4['applications']['push']({'id':0x0,'priority':_0x5369e4[_0xd439('0x74')][_0xd439('0x4b')]+0x1,'app':'close','appdata':_0xd439('0xa7'),'interval':'*,*,*,*'});}_0x5369e4[_0xd439('0xa4')]['created']=!![];}return db[_0xd439('0xa8')][_0xd439('0x5b')]({'phone':_0x5369e4[_0xd439('0x5c')][_0xd439('0x7e')],'messageId':_0x5369e4[_0xd439('0x5c')][_0xd439('0x86')],'body':_0x5369e4[_0xd439('0x5c')]['body'],'SmsAccountId':_0x1c8da0[_0xd439('0x64')]['id'],'SmsInteractionId':_0x2075c0['id'],'direction':'in','ContactId':_0x2075c0[_0xd439('0xa9')],'AttachmentId':_0x5369e4[_0xd439('0x5c')][_0xd439('0xaa')]});})['then'](function(_0xc157f5){_0x5369e4['message']=_0xc157f5;if(!_0x5369e4[_0xd439('0xa4')][_0xd439('0xab')])return;return db[_0xd439('0xac')][_0xd439('0x5a')]({'attributes':['id',_0xd439('0x44')],'where':{'id':_0x5369e4[_0xd439('0xa4')][_0xd439('0xab')]}});})[_0xd439('0x1f')](function(_0x1fdc3c){if(_0x1fdc3c){_0x5369e4['applications'][_0xd439('0xad')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1fdc3c[_0xd439('0x44')]+','+(_0x5369e4[_0xd439('0x73')][_0xd439('0xae')]||0xa),'interval':_0xd439('0xaf')});}if(!_0x5369e4[_0xd439('0xa4')][_0xd439('0xb0')])return;return db[_0xd439('0xb1')][_0xd439('0x5a')]({'attributes':['id',_0xd439('0x44')],'where':{'id':_0x5369e4[_0xd439('0xa4')][_0xd439('0xb0')]}});})['then'](function(_0x4af189){if(_0x4af189){_0x5369e4['applications'][_0xd439('0xad')]({'id':0x0,'priority':0x1,'app':_0xd439('0xb2'),'appdata':_0x4af189[_0xd439('0x44')]+','+(_0x5369e4[_0xd439('0x73')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd439('0xb3'),_0xd439('0xb4'),_0x5369e4);})[_0xd439('0x1f')](function(_0xb3cfea){if(_0xb3cfea){var _0xa248e8=0xc8;var _0x21dd32=_0xd439('0xb5');logger[_0xd439('0x20')](_0xd439('0x23'),_0x21dd32,_0xa248e8,_0xd439('0xb6'));logger[_0xd439('0x22')](_0xd439('0xb7'),_0x21dd32,_0xa248e8,_0xd439('0xb6'),JSON[_0xd439('0x24')](_0xb3cfea));if(_0x5369e4[_0xd439('0x73')]['type']==='twilio'){return _0x4c317e[_0xd439('0x2b')](_0xa248e8)[_0xd439('0x2f')]('Content-Type',_0xd439('0xb8'))[_0xd439('0x39')](_0xd439('0xb9'));}else{return _0x4c317e[_0xd439('0x2b')](_0xa248e8)[_0xd439('0x30')](_0xb3cfea);}}})[_0xd439('0x2a')](handleError(_0x4c317e,null));};exports[_0xd439('0xba')]=function(_0x4fd0da,_0x2e161e){var _0x3ad9a5=_0x4fd0da[_0xd439('0x64')]['id'];var _0x5d9046=_0x4fd0da[_0xd439('0x5c')];var _0x4ccd8d=0xc8;var _0xf06056=null;return db[_0xd439('0xbb')][_0xd439('0xbc')]({'isolationLevel':db['sequelize']['Transaction'][_0xd439('0xbd')][_0xd439('0xbe')]},function(_0x56cd21){return db[_0xd439('0x3e')][_0xd439('0x68')]({'where':{'id':_0x3ad9a5},'transaction':_0x56cd21})[_0xd439('0x1f')](function(_0x37866c){if(_0x37866c){return db[_0xd439('0x71')][_0xd439('0x65')]({'where':{'SmsAccountId':_0x3ad9a5},'transaction':_0x56cd21})[_0xd439('0x1f')](function(){var _0x5b6d6b=_[_0xd439('0x3d')](_0x5d9046,function(_0x2ca7cc){_0x2ca7cc[_0xd439('0x67')]=_0x3ad9a5;return _0x2ca7cc;});return db[_0xd439('0x71')]['bulkCreate'](_0x5b6d6b,{'transaction':_0x56cd21});});}else{_0x4ccd8d=0x194;_0xf06056=[];}});})['then'](function(){if(_0x4ccd8d!==0x194){return db[_0xd439('0x71')]['findAndCountAll']({'where':{'SmsAccountId':_0x3ad9a5},'order':'priority'})[_0xd439('0x1f')](function(_0x17282d){_0xf06056=_0x17282d;});}})['catch'](function(_0x397840){_0x4ccd8d=0x1f4;logger[_0xd439('0x26')](_0x397840[_0xd439('0xbf')]);if(_0x397840[_0xd439('0x44')]){delete _0x397840['name'];}_0xf06056=_0x397840;})[_0xd439('0xc0')](function(){if(_0xf06056===null){_0x2e161e[_0xd439('0x38')](_0x4ccd8d);}else{if(_0x4ccd8d===0x1f4){_0x2e161e[_0xd439('0x2b')](_0x4ccd8d)[_0xd439('0x39')](_0xf06056);}else{_0x2e161e[_0xd439('0x2b')](_0x4ccd8d)[_0xd439('0x30')](_0xf06056);}}});};exports[_0xd439('0xc1')]=function(_0x280266,_0x1c46ee,_0x5ef62e){var _0x2228b1={};var _0x16baa5={};var _0x5d5203;var _0x3ea8df;return db[_0xd439('0x3e')][_0xd439('0x68')]({'where':{'id':_0x280266['params']['id']}})[_0xd439('0x1f')](handleEntityNotFound(_0x1c46ee,null))[_0xd439('0x1f')](function(_0x1cf320){if(_0x1cf320){_0x5d5203=_0x1cf320;_0x16baa5[_0xd439('0x43')]=_[_0xd439('0x46')](db[_0xd439('0x71')][_0xd439('0x3f')]);_0x16baa5[_0xd439('0x45')]=_['keys'](_0x280266[_0xd439('0x45')]);_0x16baa5[_0xd439('0x47')]=_[_0xd439('0x49')](_0x16baa5[_0xd439('0x43')],_0x16baa5['query']);_0x2228b1[_0xd439('0x48')]=_[_0xd439('0x49')](_0x16baa5[_0xd439('0x43')],qs[_0xd439('0x4a')](_0x280266[_0xd439('0x45')][_0xd439('0x4a')]));_0x2228b1[_0xd439('0x48')]=_0x2228b1[_0xd439('0x48')][_0xd439('0x4b')]?_0x2228b1[_0xd439('0x48')]:_0x16baa5[_0xd439('0x43')];_0x2228b1[_0xd439('0x4e')]=qs['sort'](_0x280266[_0xd439('0x45')][_0xd439('0x4f')]);_0x2228b1[_0xd439('0x51')]=qs[_0xd439('0x47')](_[_0xd439('0x50')](_0x280266[_0xd439('0x45')],_0x16baa5[_0xd439('0x47')]));if(_0x280266[_0xd439('0x45')][_0xd439('0x54')]){_0x2228b1[_0xd439('0x51')]=_['merge'](_0x2228b1[_0xd439('0x51')],{'$or':_[_0xd439('0x3d')](_0x2228b1[_0xd439('0x48')],function(_0x14067c){var _0x594354={};_0x594354[_0x14067c]={'$like':'%'+_0x280266[_0xd439('0x45')][_0xd439('0x54')]+'%'};return _0x594354;})});}_0x2228b1=_['merge']({},_0x2228b1,_0x280266['options']);return _0x5d5203[_0xd439('0xc1')](_0x2228b1);}})[_0xd439('0x1f')](function(_0x432238){if(_0x432238){_0x3ea8df=_0x432238['length'];if(!_0x280266[_0xd439('0x45')]['hasOwnProperty'](_0xd439('0x4d'))){_0x2228b1[_0xd439('0x2c')]=qs[_0xd439('0x2c')](_0x280266['query'][_0xd439('0x2c')]);_0x2228b1[_0xd439('0x2e')]=qs['offset'](_0x280266['query'][_0xd439('0x2e')]);}return _0x5d5203[_0xd439('0xc1')](_0x2228b1);}})[_0xd439('0x1f')](function(_0x52bcc5){if(_0x52bcc5){return _0x52bcc5?{'count':_0x3ea8df,'rows':_0x52bcc5}:null;}})[_0xd439('0x1f')](respondWithResult(_0x1c46ee,null))['catch'](handleError(_0x1c46ee,null));};exports['getInteractions']=function(_0x10d027,_0x5da8c8,_0xf0fe76){var _0x9a8e4e={'raw':![],'where':{}};var _0x5a2d3e={};var _0x2a4ca6={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x10d027['params']['id']}})[_0xd439('0x1f')](handleEntityNotFound(_0x5da8c8,null))[_0xd439('0x1f')](function(_0x43ba03){if(_0x43ba03){_0x5a2d3e[_0xd439('0x43')]=_[_0xd439('0x46')](db[_0xd439('0xa2')][_0xd439('0x3f')]);_0x5a2d3e['query']=_['keys'](_0x10d027[_0xd439('0x45')]);_0x5a2d3e[_0xd439('0x47')]=_[_0xd439('0x49')](_0x5a2d3e[_0xd439('0x43')],_0x5a2d3e[_0xd439('0x45')]);_0x9a8e4e['attributes']=_[_0xd439('0x49')](_0x5a2d3e['model'],qs['fields'](_0x10d027[_0xd439('0x45')][_0xd439('0x4a')]));_0x9a8e4e[_0xd439('0x48')]=_0x9a8e4e[_0xd439('0x48')][_0xd439('0x4b')]?_0x9a8e4e[_0xd439('0x48')]:_0x5a2d3e['model'];if(!_0x10d027[_0xd439('0x45')][_0xd439('0x4c')]('nolimit')){_0x9a8e4e[_0xd439('0x2c')]=qs[_0xd439('0x2c')](_0x10d027[_0xd439('0x45')][_0xd439('0x2c')]);_0x9a8e4e[_0xd439('0x2e')]=qs['offset'](_0x10d027['query'][_0xd439('0x2e')]);}_0x9a8e4e[_0xd439('0x4e')]=qs[_0xd439('0x4f')](_0x10d027[_0xd439('0x45')]['sort']);_0x9a8e4e[_0xd439('0x51')]=qs['filters'](_['pick'](_0x10d027[_0xd439('0x45')],_0x5a2d3e['filters']));_0x9a8e4e[_0xd439('0x51')][_0xd439('0x67')]=_0x43ba03['id'];if(_0x10d027[_0xd439('0x45')][_0xd439('0x54')]){_0x9a8e4e[_0xd439('0x51')]=_['merge'](_0x9a8e4e['where'],{'$or':_[_0xd439('0x3d')](_0x9a8e4e['attributes'],function(_0x245c30){var _0x531653={};_0x531653[_0x245c30]={'$like':'%'+_0x10d027['query']['filter']+'%'};return _0x531653;})});}_0x9a8e4e=_[_0xd439('0x52')]({},_0x9a8e4e,_0x10d027[_0xd439('0x59')]);return db[_0xd439('0xa2')][_0xd439('0x2d')]({'where':_0x9a8e4e[_0xd439('0x51')]})[_0xd439('0x1f')](function(_0x503bac){_0x2a4ca6[_0xd439('0x2d')]=_0x503bac;if(_0x10d027[_0xd439('0x45')][_0xd439('0x55')]){_0x9a8e4e[_0xd439('0x56')]=[{'model':db[_0xd439('0x76')],'as':_0xd439('0xc2'),'required':![]},{'model':db['User'],'as':_0xd439('0xc3'),'attributes':[_0xd439('0x44'),_0xd439('0xc4'),_0xd439('0xc5')],'required':![]},{'model':db[_0xd439('0xc6')],'as':_0xd439('0xc7'),'attributes':['id',_0xd439('0x44'),_0xd439('0xc8')],'where':_0x10d027[_0xd439('0x45')][_0xd439('0xc9')]?{'id':_0x10d027['query']['tag']}:undefined,'required':_0x10d027[_0xd439('0x45')][_0xd439('0xc9')]?!![]:![]}];}return db[_0xd439('0xa2')][_0xd439('0x57')](_0x9a8e4e);})['then'](function(_0x1f24df){_0x2a4ca6[_0xd439('0x58')]=_0x1f24df;return _0x2a4ca6;});}})[_0xd439('0x1f')](respondWithFilteredResult(_0x5da8c8,_0x9a8e4e))['catch'](handleError(_0x5da8c8,null));};exports['send']=function(_0x57e5af,_0x570133,_0x48b6db){var _0x31cd8a,_0x28cbbc,_0x33c698;if(_[_0xd439('0x95')](_0x57e5af['body']['body'])||_0x57e5af[_0xd439('0x5c')][_0xd439('0x5c')]===''){throw new db[(_0xd439('0x77'))]['ValidationError'](_0xd439('0x96'));}if(_[_0xd439('0x95')](_0x57e5af[_0xd439('0x5c')]['to'])){throw new db['Sequelize'][(_0xd439('0x78'))](_0xd439('0xca'));}_0x31cd8a=_0x57e5af['body']['to'];return db[_0xd439('0x3e')][_0xd439('0x5a')]({'where':{'id':_0x57e5af[_0xd439('0x64')]['id']},'include':[{'model':db[_0xd439('0x9b')],'as':_0xd439('0xcb'),'include':[{'model':db[_0xd439('0x76')],'as':'Contacts','where':{'mobile':_0x31cd8a},'limit':0x1,'order':[[_0xd439('0x7c'),_0xd439('0x9e')]]}]}]})[_0xd439('0x1f')](handleEntityNotFound(_0x570133,null))[_0xd439('0x1f')](function(_0x4fbb10){if(_0x4fbb10&&_0x4fbb10[_0xd439('0xcb')]){_0x28cbbc=_0x4fbb10[_0xd439('0x35')]({'plain':!![]});if(_0x28cbbc[_0xd439('0xcb')]&&_0x28cbbc[_0xd439('0xcb')][_0xd439('0x9d')]['length']){return _0x28cbbc[_0xd439('0xcb')][_0xd439('0x9d')][0x0];}return db[_0xd439('0x76')][_0xd439('0x5b')](_[_0xd439('0x17')](_0x57e5af['body'],{'firstName':_0x31cd8a,'mobile':_0x31cd8a,'phone':_0x31cd8a,'ListId':_0x28cbbc[_0xd439('0x9c')]}));}})['then'](handleEntityNotFound(_0x570133,null))[_0xd439('0x1f')](function(_0x2bda66){if(_0x2bda66){_0x33c698=_0x2bda66;return db[_0xd439('0xa2')][_0xd439('0x5a')]({'where':{'ContactId':_0x33c698['id'],'closed':![],'SmsAccountId':_0x28cbbc['id']}})[_0xd439('0x1f')](function(_0x5a647b){if(_0x5a647b){return[_0x5a647b,![]];}return db['SmsInteraction']['create']({'UserId':_0x57e5af[_0xd439('0x5d')]['id'],'ContactId':_0x33c698['id'],'SmsAccountId':_0x28cbbc['id'],'phone':_0x31cd8a,'firstMsgDirection':_0xd439('0xcc'),'Messages':[_['merge'](_0x57e5af[_0xd439('0x5c')],{'read':![],'body':_0x57e5af[_0xd439('0x5c')][_0xd439('0x5c')],'phone':_0x31cd8a,'SmsAccountId':_0x28cbbc['id'],'UserId':_0x57e5af[_0xd439('0x5d')]['id'],'ContactId':_0x33c698['id']})]},{'include':[{'model':db[_0xd439('0xa8')],'as':_0xd439('0xcd')}]})[_0xd439('0x1f')](function(_0x534f7d){return[_0x534f7d,!![]];});});}})[_0xd439('0xa3')](function(_0x4749a7,_0x27fbea){if(_0x27fbea){return _0x4749a7;}return db[_0xd439('0xa8')]['create'](_[_0xd439('0x52')](_0x57e5af[_0xd439('0x5c')],{'read':![],'body':_0x57e5af[_0xd439('0x5c')][_0xd439('0x5c')],'phone':_0x31cd8a,'SmsAccountId':_0x28cbbc['id'],'SmsInteractionId':_0x4749a7['id'],'UserId':_0x57e5af['user']['id'],'ContactId':_0x33c698['id']}))[_0xd439('0x1f')](function(_0x47448a){_0x4749a7[_0xd439('0xce')][_0xd439('0xcd')]=[];_0x4749a7[_0xd439('0xce')]['Messages'][_0xd439('0xcf')](_0x47448a[_0xd439('0xce')]);return _0x4749a7;});})['then'](respondWithResult(_0x570133,null))[_0xd439('0x2a')](handleError(_0x570133,null));};exports[_0xd439('0x2b')]=function(_0x2b9dc0,_0x2d73f1,_0x19e57e){if(_0x2b9dc0[_0xd439('0x5c')]['id']){delete _0x2b9dc0[_0xd439('0x5c')]['id'];}var _0x4d052b,_0x2d75d8,_0x32f50f;return db[_0xd439('0x3e')]['find']({'where':{'id':_0x2b9dc0['params']['id']}})[_0xd439('0x1f')](handleEntityNotFound(_0x2d73f1,null))[_0xd439('0x1f')](function(_0x3127f5){if(_0x3127f5){_0x32f50f=_0x3127f5;logger[_0xd439('0x22')](_0xd439('0x23'),'status',_0xd439('0xd0'),_0x3127f5['type'],util['inspect'](_0x2b9dc0[_0xd439('0x5c')],{'showHidden':![],'depth':null}));switch(_0x3127f5[_0xd439('0x41')]){case _0xd439('0x81'):if(_0x2b9dc0['body'][_0xd439('0xd1')]&&_0x2b9dc0[_0xd439('0x5c')]['status']){_0x2d75d8=_0x2b9dc0[_0xd439('0x5c')]['status'];return db[_0xd439('0xa8')][_0xd439('0x5a')]({'where':{'messageId':_0x2b9dc0[_0xd439('0x5c')][_0xd439('0xd1')]}});}break;case _0xd439('0x84'):if(_0x2b9dc0[_0xd439('0x5c')][_0xd439('0xd2')]&&_0x2b9dc0[_0xd439('0x5c')][_0xd439('0xd3')]){_0x2d75d8=_0x2b9dc0[_0xd439('0x5c')][_0xd439('0xd3')];return db[_0xd439('0xa8')][_0xd439('0x5a')]({'where':{'messageId':_0x2b9dc0[_0xd439('0x5c')][_0xd439('0xd2')]}});}break;case _0xd439('0x85'):if(_0x2b9dc0[_0xd439('0x5c')][_0xd439('0x87')]&&_0x2b9dc0['body'][_0xd439('0xd4')]){_0x2d75d8=_0x2b9dc0[_0xd439('0x5c')][_0xd439('0xd4')];return db[_0xd439('0xa8')][_0xd439('0x5a')]({'where':{'messageId':_0x2b9dc0['body'][_0xd439('0x87')]}});}break;case _0xd439('0x8b'):var _0x2d32b2=_0x2b9dc0[_0xd439('0x5c')][_0xd439('0x8c')][0x0];if(_0x2d32b2[_0xd439('0x86')]&&_0x2d32b2[_0xd439('0x2b')][_0xd439('0xd5')]===_0xd439('0xd6')){_0x2d75d8=_0x2d32b2[_0xd439('0x2b')][_0xd439('0xd5')];return db[_0xd439('0xa8')][_0xd439('0x5a')]({'where':{'messageId':_0x2d32b2['messageId']}});}break;case _0xd439('0x8f'):if(_0x2b9dc0[_0xd439('0x5c')][_0xd439('0x86')]&&_0x2b9dc0['body'][_0xd439('0x2b')]){_0x2d75d8=_0x2b9dc0['body']['status'];return db[_0xd439('0xa8')][_0xd439('0x5a')]({'where':{'messageId':_0x2b9dc0['body'][_0xd439('0x86')]}});}break;case _0xd439('0x92'):if(_0x2b9dc0[_0xd439('0x5c')][0x0][_0xd439('0x28')]['id']){_0x2d75d8=_0x2b9dc0['body'][0x0][_0xd439('0x41')];return db[_0xd439('0xa8')][_0xd439('0x5a')]({'where':{'messageId':_0x2b9dc0[_0xd439('0x5c')][0x0][_0xd439('0x28')]['id']}});}break;case'intelepeer':if(_0x2b9dc0['body'][_0xd439('0xd7')]&&_0x2b9dc0[_0xd439('0x5c')]['status']){_0x2d75d8=_0x2b9dc0[_0xd439('0x5c')]['status'];return db['SmsMessage'][_0xd439('0x5a')]({'where':{'messageId':_0x2b9dc0[_0xd439('0x5c')][_0xd439('0xd7')]}});}break;}}})[_0xd439('0x1f')](handleEntityNotFound(_0x2d73f1,null))[_0xd439('0x1f')](function(_0x3c1f31){if(_0x3c1f31){_0x4d052b=_0x3c1f31;switch(_0x32f50f[_0xd439('0x41')]){case _0xd439('0x81'):if(_0x2d75d8===_0xd439('0xd6')){return _0x4d052b[_0xd439('0x34')]({'read':!![]});}else{logger[_0xd439('0x26')](_0xd439('0x23'),_0xd439('0x2b'),_0xd439('0x81'),util[_0xd439('0xd8')](_0x2b9dc0[_0xd439('0x5c')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x2d75d8==='1'){return _0x4d052b[_0xd439('0x34')]({'read':!![]});}else{logger[_0xd439('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xd439('0x81'),util[_0xd439('0xd8')](_0x2b9dc0[_0xd439('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xd439('0x85'):if(!_0x2b9dc0['body'][_0xd439('0xd9')]&&_0x2d75d8>=0xc8&&_0x2d75d8<=0xce){return _0x4d052b[_0xd439('0x34')]({'read':!![]});}else{logger[_0xd439('0x26')](_0xd439('0x23'),_0xd439('0x2b'),'clicksend',util[_0xd439('0xd8')](_0x2b9dc0[_0xd439('0x5c')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3f5fed=_0x2b9dc0['body'][_0xd439('0x8c')][0x0];if(_0x3f5fed[_0xd439('0x2b')][_0xd439('0xd5')]==='DELIVERED'){return _0x4d052b['update']({'read':!![]});}else{logger[_0xd439('0x26')](_0xd439('0x23'),_0xd439('0x2b'),_0xd439('0x8b'),util[_0xd439('0xd8')](_0x2b9dc0[_0xd439('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xd439('0x8f'):if(_0x2d75d8==_0xd439('0xda')||_0x2d75d8==_0xd439('0xdb')){return _0x4d052b['update']({'read':!![]});}else{logger[_0xd439('0x26')](_0xd439('0x23'),'status',_0xd439('0x8f'),util[_0xd439('0xd8')](_0x2b9dc0[_0xd439('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xd439('0x92'):if(_0x2d75d8==_0xd439('0xdc')){return _0x4d052b[_0xd439('0x34')]({'read':!![]});}else{logger['error'](_0xd439('0x23'),'status',_0xd439('0x92'),util['inspect'](_0x2b9dc0[_0xd439('0x5c')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x2d75d8===_0xd439('0xdd')||_0x2d75d8===_0xd439('0xde')){return _0x4d052b['update']({'read':!![]});}else{logger[_0xd439('0x26')](_0xd439('0x23'),_0xd439('0x2b'),_0xd439('0x93'),util['inspect'](_0x2b9dc0[_0xd439('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x4d052b;}})['then'](respondWithResult(_0x2d73f1,null))['catch'](handleError(_0x2d73f1,null));};exports[_0xd439('0xdf')]=function(_0x5bb700,_0x187b38,_0x7acc9d){var _0x32e261,_0x382abc,_0xfbed99;return db[_0xd439('0x3e')]['find']({'where':{'id':_0x5bb700[_0xd439('0x64')]['id']}})[_0xd439('0x1f')](handleEntityNotFound(_0x187b38,null))[_0xd439('0x1f')](function(_0x3ab81e){if(_0x3ab81e){_0xfbed99=_0x3ab81e;logger[_0xd439('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd439('0x2b'),'received\x20delivery\x20report\x20from',_0x3ab81e['type'],util['inspect'](_0x5bb700[_0xd439('0x45')],{'showHidden':![],'depth':null}));switch(_0x3ab81e[_0xd439('0x41')]){case _0xd439('0x8d'):if(_0x5bb700[_0xd439('0x45')][_0xd439('0xe0')]&&_0x5bb700[_0xd439('0x45')][_0xd439('0xe1')]){_0x382abc=_0x5bb700['query'][_0xd439('0xe1')];return db[_0xd439('0xa8')][_0xd439('0x5a')]({'where':{'messageId':_0x5bb700[_0xd439('0x45')][_0xd439('0xe0')]}});}break;}}})['then'](handleEntityNotFound(_0x187b38,null))[_0xd439('0x1f')](function(_0x43c03f){if(_0x43c03f){_0x32e261=_0x43c03f;switch(_0xfbed99[_0xd439('0x41')]){case _0xd439('0x8d'):if(_0x382abc==='2'||_0x382abc==='6'){return _0x32e261['update']({'read':!![]});}else{logger[_0xd439('0x26')](_0xd439('0x23'),_0xd439('0x2b'),_0xd439('0x8d'),util[_0xd439('0xd8')](_0x5bb700['query'],{'showHidden':![],'depth':null}));};break;}return _0x32e261;}})[_0xd439('0x1f')](respondWithResult(_0x187b38,null))['catch'](handleError(_0x187b38,null));};exports[_0xd439('0xe2')]=function(_0x5dd42f,_0x2c8254,_0x34c752){return db[_0xd439('0x3e')][_0xd439('0x5a')]({'where':{'id':_0x5dd42f[_0xd439('0x64')]['id']}})['then'](handleEntityNotFound(_0x2c8254,null))['then'](function(_0x4689a0){if(_0x4689a0){return _0x4689a0[_0xd439('0xe2')](_0x5dd42f[_0xd439('0x5c')][_0xd439('0x6b')],_[_0xd439('0xa0')](_0x5dd42f[_0xd439('0x5c')],[_0xd439('0x6b'),'id'])||{})[_0xd439('0xa3')](function(_0x5d1061){for(var _0x1c2b95=0x0;_0x1c2b95<_0x5dd42f[_0xd439('0x5c')]['ids'][_0xd439('0x4b')];_0x1c2b95+=0x1){socket[_0xd439('0xe3')](_0xd439('0xe4'),{'UserId':Number(_0x5dd42f[_0xd439('0x5c')][_0xd439('0x6b')][_0x1c2b95]),'SmsAccountId':Number(_0x5dd42f[_0xd439('0x64')]['id'])});}return _0x5d1061;});}})[_0xd439('0x1f')](respondWithResult(_0x2c8254,null))[_0xd439('0x2a')](handleError(_0x2c8254,null));};exports[_0xd439('0xe5')]=function(_0xb8b9b7,_0x531d73,_0xfa0f6a){return db[_0xd439('0x3e')][_0xd439('0x5a')]({'where':{'id':_0xb8b9b7['params']['id']}})[_0xd439('0x1f')](handleEntityNotFound(_0x531d73,null))[_0xd439('0x1f')](function(_0x54c8bd){if(_0x54c8bd){return _0x54c8bd[_0xd439('0xe5')](_0xb8b9b7[_0xd439('0x45')][_0xd439('0x6b')])[_0xd439('0x1f')](function(){if(_[_0xd439('0xe6')](_0xb8b9b7[_0xd439('0x45')][_0xd439('0x6b')])){for(var _0x32737e=0x0;_0x32737e<_0xb8b9b7[_0xd439('0x45')]['ids'][_0xd439('0x4b')];_0x32737e+=0x1){socket['emit'](_0xd439('0xe7'),{'UserId':Number(_0xb8b9b7[_0xd439('0x45')][_0xd439('0x6b')][_0x32737e]),'SmsAccountId':Number(_0xb8b9b7[_0xd439('0x64')]['id'])});}}else{socket[_0xd439('0xe3')](_0xd439('0xe7'),{'UserId':Number(_0xb8b9b7[_0xd439('0x45')][_0xd439('0x6b')]),'SmsAccountId':Number(_0xb8b9b7[_0xd439('0x64')]['id'])});}});}})['then'](respondWithStatusCode(_0x531d73,null))[_0xd439('0x2a')](handleError(_0x531d73,null));};exports[_0xd439('0xe8')]=function(_0x5306bc,_0x22708d,_0xa2857c){var _0x1931f6={};var _0x16cc61={};var _0x376fd8;var _0x2e59e9;return db[_0xd439('0x3e')][_0xd439('0x68')]({'where':{'id':_0x5306bc[_0xd439('0x64')]['id']}})[_0xd439('0x1f')](handleEntityNotFound(_0x22708d,null))[_0xd439('0x1f')](function(_0x5eede4){if(_0x5eede4){_0x376fd8=_0x5eede4;_0x16cc61['model']=_[_0xd439('0x46')](db[_0xd439('0xac')][_0xd439('0x3f')]);_0x16cc61['query']=_['keys'](_0x5306bc[_0xd439('0x45')]);_0x16cc61[_0xd439('0x47')]=_[_0xd439('0x49')](_0x16cc61[_0xd439('0x43')],_0x16cc61[_0xd439('0x45')]);_0x1931f6[_0xd439('0x48')]=_['intersection'](_0x16cc61[_0xd439('0x43')],qs[_0xd439('0x4a')](_0x5306bc[_0xd439('0x45')][_0xd439('0x4a')]));_0x1931f6[_0xd439('0x48')]=_0x1931f6[_0xd439('0x48')][_0xd439('0x4b')]?_0x1931f6[_0xd439('0x48')]:_0x16cc61[_0xd439('0x43')];_0x1931f6[_0xd439('0x4e')]=qs[_0xd439('0x4f')](_0x5306bc[_0xd439('0x45')][_0xd439('0x4f')]);_0x1931f6[_0xd439('0x51')]=qs[_0xd439('0x47')](_[_0xd439('0x50')](_0x5306bc[_0xd439('0x45')],_0x16cc61[_0xd439('0x47')]));if(_0x5306bc[_0xd439('0x45')][_0xd439('0x54')]){_0x1931f6[_0xd439('0x51')]=_[_0xd439('0x52')](_0x1931f6[_0xd439('0x51')],{'$or':_[_0xd439('0x3d')](_0x1931f6['attributes'],function(_0x33fedf){var _0x44a709={};_0x44a709[_0x33fedf]={'$like':'%'+_0x5306bc[_0xd439('0x45')][_0xd439('0x54')]+'%'};return _0x44a709;})});}_0x1931f6=_[_0xd439('0x52')]({},_0x1931f6,_0x5306bc[_0xd439('0x59')]);return _0x376fd8[_0xd439('0xe8')](_0x1931f6);}})[_0xd439('0x1f')](function(_0x32ec0d){if(_0x32ec0d){_0x2e59e9=_0x32ec0d[_0xd439('0x4b')];if(!_0x5306bc[_0xd439('0x45')]['hasOwnProperty']('nolimit')){_0x1931f6[_0xd439('0x2c')]=qs[_0xd439('0x2c')](_0x5306bc[_0xd439('0x45')]['limit']);_0x1931f6[_0xd439('0x2e')]=qs[_0xd439('0x2e')](_0x5306bc[_0xd439('0x45')][_0xd439('0x2e')]);}return _0x376fd8[_0xd439('0xe8')](_0x1931f6);}})[_0xd439('0x1f')](function(_0x36e8b9){if(_0x36e8b9){return _0x36e8b9?{'count':_0x2e59e9,'rows':_0x36e8b9}:null;}})['then'](respondWithResult(_0x22708d,null))['catch'](handleError(_0x22708d,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 1f7ddc2..2697ea7 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 _0x49b3=['emit','hook','exports','events','SmsAccount','setMaxListeners','update'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x49b3,0x168));var _0x349b=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x49b3[_0x618414];return _0x21c19a;};'use strict';var EventEmitter=require(_0x349b('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x349b('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x349b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x349b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3eeba3){return function(_0x24b3df,_0x50915f,_0x37cfa8){SmsAccountEvents[_0x349b('0x4')](_0x3eeba3+':'+_0x24b3df['id'],_0x24b3df);SmsAccountEvents['emit'](_0x3eeba3,_0x24b3df);_0x37cfa8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x349b('0x5')](e,emitEvent(event));}}module[_0x349b('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0x9898=['update','remove','emit','hasOwnProperty','hook','exports','events','SmsAccount','setMaxListeners','save'];(function(_0x58c118,_0x3ab570){var _0x45c95e=function(_0x3006f7){while(--_0x3006f7){_0x58c118['push'](_0x58c118['shift']());}};_0x45c95e(++_0x3ab570);}(_0x9898,0x10a));var _0x8989=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0x9898[_0x2a2166];return _0x3bcf50;};'use strict';var EventEmitter=require(_0x8989('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x8989('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8989('0x2')](0x0);var events={'afterCreate':_0x8989('0x3'),'afterUpdate':_0x8989('0x4'),'afterDestroy':_0x8989('0x5')};function emitEvent(_0x5460bb){return function(_0x159b86,_0x55fb8d,_0x1271b7){SmsAccountEvents['emit'](_0x5460bb+':'+_0x159b86['id'],_0x159b86);SmsAccountEvents[_0x8989('0x6')](_0x5460bb,_0x159b86);_0x1271b7(null);};}for(var e in events){if(events[_0x8989('0x7')](e)){var event=events[e];SmsAccount[_0x8989('0x8')](e,emitEvent(event));}}module[_0x8989('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 1d8a226..326a7e2 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 _0x97b2=['bluebird','path','rimraf','./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x1946c0,_0x310260){var _0x8efdf3=function(_0x14661b){while(--_0x14661b){_0x1946c0['push'](_0x1946c0['shift']());}};_0x8efdf3(++_0x310260);}(_0x97b2,0x1b7));var _0x297b=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x97b2[_0x386c3e];return _0x4b8e13;};'use strict';var _=require(_0x297b('0x0'));var util=require(_0x297b('0x1'));var logger=require(_0x297b('0x2'))(_0x297b('0x3'));var moment=require(_0x297b('0x4'));var BPromise=require(_0x297b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x297b('0x6'));var rimraf=require(_0x297b('0x7'));var config=require('../../config/environment');var attributes=require(_0x297b('0x8'));module[_0x297b('0x9')]=function(_0x5ef74e,_0x596f9c){return _0x5ef74e['define'](_0x297b('0xa'),attributes,{'tableName':_0x297b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67da=['request-promise','path','rimraf','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x55969b,_0x1ebe62){var _0x3d7fc1=function(_0x5f2dbe){while(--_0x5f2dbe){_0x55969b['push'](_0x55969b['shift']());}};_0x3d7fc1(++_0x1ebe62);}(_0x67da,0x1e9));var _0xa67d=function(_0x37dc6d,_0x174d82){_0x37dc6d=_0x37dc6d-0x0;var _0x218c6a=_0x67da[_0x37dc6d];return _0x218c6a;};'use strict';var _=require(_0xa67d('0x0'));var util=require('util');var logger=require(_0xa67d('0x1'))(_0xa67d('0x2'));var moment=require(_0xa67d('0x3'));var BPromise=require(_0xa67d('0x4'));var rp=require(_0xa67d('0x5'));var fs=require('fs');var path=require(_0xa67d('0x6'));var rimraf=require(_0xa67d('0x7'));var config=require('../../config/environment');var attributes=require(_0xa67d('0x8'));module[_0xa67d('0x9')]=function(_0x37c9f4,_0x3320e3){return _0x37c9f4[_0xa67d('0xa')](_0xa67d('0xb'),attributes,{'tableName':_0xa67d('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 c18a1cd..4f3c581 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 _0xeb15=['attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','find','options','where'];(function(_0x2cacdd,_0x1403ea){var _0x4df475=function(_0xe09e3d){while(--_0xe09e3d){_0x2cacdd['push'](_0x2cacdd['shift']());}};_0x4df475(++_0x1403ea);}(_0xeb15,0x73));var _0x5eb1=function(_0x5e2a0f,_0x447ab4){_0x5e2a0f=_0x5e2a0f-0x0;var _0x3e8c10=_0xeb15[_0x5e2a0f];return _0x3e8c10;};'use strict';var _=require(_0x5eb1('0x0'));var util=require(_0x5eb1('0x1'));var moment=require(_0x5eb1('0x2'));var BPromise=require(_0x5eb1('0x3'));var rs=require(_0x5eb1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5eb1('0x5'));var logger=require(_0x5eb1('0x6'))(_0x5eb1('0x7'));var config=require(_0x5eb1('0x8'));var jayson=require(_0x5eb1('0x9'));var client=jayson[_0x5eb1('0xa')][_0x5eb1('0xb')]({'port':0x232a});config[_0x5eb1('0xc')]=_[_0x5eb1('0xd')](config[_0x5eb1('0xc')],{'host':_0x5eb1('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5eb1('0xc')]));require('./smsAccount.socket')[_0x5eb1('0xf')](socket);function respondWithRpcPromise(_0x5e52d8,_0xe6445,_0x2235e6){return new BPromise(function(_0x325276,_0x710317){return client[_0x5eb1('0x10')](_0x5e52d8,_0x2235e6)[_0x5eb1('0x11')](function(_0xea359a){logger[_0x5eb1('0x12')]('SmsAccount,\x20%s,\x20%s',_0xe6445,_0x5eb1('0x13'));logger[_0x5eb1('0x14')](_0x5eb1('0x15'),_0xe6445,_0x5eb1('0x13'),JSON[_0x5eb1('0x16')](_0xea359a));if(_0xea359a['error']){if(_0xea359a[_0x5eb1('0x17')][_0x5eb1('0x18')]===0x1f4){logger['error'](_0x5eb1('0x19'),_0xe6445,_0xea359a['error']['message']);return _0x710317(_0xea359a[_0x5eb1('0x17')][_0x5eb1('0x1a')]);}logger[_0x5eb1('0x17')](_0x5eb1('0x19'),_0xe6445,_0xea359a[_0x5eb1('0x17')]['message']);return _0x325276(_0xea359a[_0x5eb1('0x17')]['message']);}else{logger['info'](_0x5eb1('0x19'),_0xe6445,_0x5eb1('0x13'));_0x325276(_0xea359a[_0x5eb1('0x1b')][_0x5eb1('0x1a')]);}})[_0x5eb1('0x1c')](function(_0x3317e0){logger[_0x5eb1('0x17')]('SmsAccount,\x20%s,\x20%s',_0xe6445,_0x3317e0);_0x710317(_0x3317e0);});});}exports[_0x5eb1('0x1d')]=function(_0x4d46b2){var _0x56a97c=this;return new Promise(function(_0xb9403b,_0x245a07){return db['SmsAccount'][_0x5eb1('0x1e')]({'raw':_0x4d46b2['options']?_0x4d46b2[_0x5eb1('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x4d46b2[_0x5eb1('0x1f')]?_0x4d46b2[_0x5eb1('0x1f')][_0x5eb1('0x20')]||null:null,'attributes':_0x4d46b2['options']?_0x4d46b2[_0x5eb1('0x1f')][_0x5eb1('0x21')]||null:null,'include':_0x4d46b2[_0x5eb1('0x1f')]?_0x4d46b2[_0x5eb1('0x1f')][_0x5eb1('0x22')]?_[_0x5eb1('0x23')](_0x4d46b2[_0x5eb1('0x1f')][_0x5eb1('0x22')],function(_0x4c44e5){return{'model':db[_0x4c44e5['model']],'as':_0x4c44e5['as'],'attributes':_0x4c44e5[_0x5eb1('0x21')],'include':_0x4c44e5[_0x5eb1('0x22')]?_[_0x5eb1('0x23')](_0x4c44e5['include'],function(_0x59d9d8){return{'model':db[_0x59d9d8[_0x5eb1('0x24')]],'as':_0x59d9d8['as'],'attributes':_0x59d9d8[_0x5eb1('0x21')],'include':_0x59d9d8[_0x5eb1('0x22')]?_['map'](_0x59d9d8[_0x5eb1('0x22')],function(_0x2d0cb1){return{'model':db[_0x2d0cb1[_0x5eb1('0x24')]],'as':_0x2d0cb1['as'],'attributes':_0x2d0cb1['attributes']};}):[]};}):[]};}):[]:[]})[_0x5eb1('0x11')](function(_0x863aed){logger['info'](_0x5eb1('0x1d'),_0x4d46b2);logger['debug'](_0x5eb1('0x1d'),_0x4d46b2,JSON[_0x5eb1('0x16')](_0x863aed));_0xb9403b(_0x863aed);})[_0x5eb1('0x1c')](function(_0x57f80a){logger[_0x5eb1('0x17')]('ShowSmsAccount',_0x57f80a[_0x5eb1('0x1a')],_0x4d46b2);_0x245a07(_0x56a97c[_0x5eb1('0x17')](0x1f4,_0x57f80a[_0x5eb1('0x1a')]));});});}; \ No newline at end of file +var _0x16c9=['info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','SmsAccount','find','options','raw','where','attributes','include','map','model','ShowSmsAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then'];(function(_0x201dbc,_0x59427a){var _0x44000=function(_0x80b10a){while(--_0x80b10a){_0x201dbc['push'](_0x201dbc['shift']());}};_0x44000(++_0x59427a);}(_0x16c9,0x89));var _0x916c=function(_0x4a4804,_0x3ff17c){_0x4a4804=_0x4a4804-0x0;var _0xfadc3b=_0x16c9[_0x4a4804];return _0xfadc3b;};'use strict';var _=require(_0x916c('0x0'));var util=require(_0x916c('0x1'));var moment=require(_0x916c('0x2'));var BPromise=require('bluebird');var rs=require(_0x916c('0x3'));var fs=require('fs');var Redis=require(_0x916c('0x4'));var db=require(_0x916c('0x5'))['db'];var utils=require(_0x916c('0x6'));var logger=require(_0x916c('0x7'))(_0x916c('0x8'));var config=require(_0x916c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x916c('0xa')]['http']({'port':0x232a});config[_0x916c('0xb')]=_[_0x916c('0xc')](config[_0x916c('0xb')],{'host':_0x916c('0xd'),'port':0x18eb});var socket=require(_0x916c('0xe'))(new Redis(config[_0x916c('0xb')]));require(_0x916c('0xf'))[_0x916c('0x10')](socket);function respondWithRpcPromise(_0x4e61bc,_0x7b1dd2,_0xf08630){return new BPromise(function(_0x3b64ac,_0x89dcb5){return client[_0x916c('0x11')](_0x4e61bc,_0xf08630)[_0x916c('0x12')](function(_0x252073){logger[_0x916c('0x13')](_0x916c('0x14'),_0x7b1dd2,'request\x20sent');logger[_0x916c('0x15')](_0x916c('0x16'),_0x7b1dd2,_0x916c('0x17'),JSON[_0x916c('0x18')](_0x252073));if(_0x252073[_0x916c('0x19')]){if(_0x252073[_0x916c('0x19')]['code']===0x1f4){logger[_0x916c('0x19')](_0x916c('0x14'),_0x7b1dd2,_0x252073[_0x916c('0x19')]['message']);return _0x89dcb5(_0x252073[_0x916c('0x19')][_0x916c('0x1a')]);}logger[_0x916c('0x19')]('SmsAccount,\x20%s,\x20%s',_0x7b1dd2,_0x252073[_0x916c('0x19')][_0x916c('0x1a')]);return _0x3b64ac(_0x252073[_0x916c('0x19')]['message']);}else{logger['info'](_0x916c('0x14'),_0x7b1dd2,_0x916c('0x17'));_0x3b64ac(_0x252073[_0x916c('0x1b')][_0x916c('0x1a')]);}})[_0x916c('0x1c')](function(_0x15b987){logger[_0x916c('0x19')]('SmsAccount,\x20%s,\x20%s',_0x7b1dd2,_0x15b987);_0x89dcb5(_0x15b987);});});}exports['ShowSmsAccount']=function(_0xdaf8a6){var _0x4eb2cd=this;return new Promise(function(_0x168f78,_0x3fe2a6){return db[_0x916c('0x1d')][_0x916c('0x1e')]({'raw':_0xdaf8a6[_0x916c('0x1f')]?_0xdaf8a6[_0x916c('0x1f')][_0x916c('0x20')]===undefined?!![]:![]:!![],'where':_0xdaf8a6[_0x916c('0x1f')]?_0xdaf8a6['options'][_0x916c('0x21')]||null:null,'attributes':_0xdaf8a6[_0x916c('0x1f')]?_0xdaf8a6[_0x916c('0x1f')][_0x916c('0x22')]||null:null,'include':_0xdaf8a6[_0x916c('0x1f')]?_0xdaf8a6[_0x916c('0x1f')][_0x916c('0x23')]?_[_0x916c('0x24')](_0xdaf8a6['options'][_0x916c('0x23')],function(_0xa7ef4){return{'model':db[_0xa7ef4[_0x916c('0x25')]],'as':_0xa7ef4['as'],'attributes':_0xa7ef4[_0x916c('0x22')],'include':_0xa7ef4[_0x916c('0x23')]?_[_0x916c('0x24')](_0xa7ef4[_0x916c('0x23')],function(_0x5dc9f8){return{'model':db[_0x5dc9f8['model']],'as':_0x5dc9f8['as'],'attributes':_0x5dc9f8[_0x916c('0x22')],'include':_0x5dc9f8[_0x916c('0x23')]?_[_0x916c('0x24')](_0x5dc9f8[_0x916c('0x23')],function(_0x10a553){return{'model':db[_0x10a553[_0x916c('0x25')]],'as':_0x10a553['as'],'attributes':_0x10a553[_0x916c('0x22')]};}):[]};}):[]};}):[]:[]})[_0x916c('0x12')](function(_0x2b838e){logger['info'](_0x916c('0x26'),_0xdaf8a6);logger[_0x916c('0x15')](_0x916c('0x26'),_0xdaf8a6,JSON[_0x916c('0x18')](_0x2b838e));_0x168f78(_0x2b838e);})[_0x916c('0x1c')](function(_0x3b970a){logger[_0x916c('0x19')](_0x916c('0x26'),_0x3b970a['message'],_0xdaf8a6);_0x3fe2a6(_0x4eb2cd[_0x916c('0x19')](0x1f4,_0x3b970a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 4c700c9..252529e 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 d600e8f..646f82f 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x3041ce,_0x382f98){var _0x68a7f9=function(_0x3acbfa){while(--_0x3acbfa){_0x3041ce['push'](_0x3041ce['shift']());}};_0x68a7f9(++_0x382f98);}(_0x3e74,0x175));var _0x43e7=function(_0x1e79cf,_0x5a73b8){_0x1e79cf=_0x1e79cf-0x0;var _0x38af6f=_0x3e74[_0x1e79cf];return _0x38af6f;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x2f0599,_0x5873db){var _0xd1dfd4=function(_0x4dd49f){while(--_0x4dd49f){_0x2f0599['push'](_0x2f0599['shift']());}};_0xd1dfd4(++_0x5873db);}(_0x55ca,0x126));var _0xa55c=function(_0x190417,_0x54dc0d){_0x190417=_0x190417-0x0;var _0x110e9c=_0x55ca[_0x190417];return _0x110e9c;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 0a2a5fb..f32d3e6 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 _0x47c2=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x2f25ec,_0x4ae9a1){var _0x4f79b4=function(_0x26ba81){while(--_0x26ba81){_0x2f25ec['push'](_0x2f25ec['shift']());}};_0x4f79b4(++_0x4ae9a1);}(_0x47c2,0xf3));var _0x247c=function(_0x485e9c,_0x4ea55c){_0x485e9c=_0x485e9c-0x0;var _0x40e47d=_0x47c2[_0x485e9c];return _0x40e47d;};'use strict';var Sequelize=require(_0x247c('0x0'));module[_0x247c('0x1')]={'priority':{'type':Sequelize[_0x247c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x247c('0x3')],'allowNull':![],'defaultValue':_0x247c('0x4')},'appdata':{'type':Sequelize[_0x247c('0x5')]()},'description':{'type':Sequelize[_0x247c('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x67b8=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x2920e6,_0x3ba824){var _0x128546=function(_0x5691bb){while(--_0x5691bb){_0x2920e6['push'](_0x2920e6['shift']());}};_0x128546(++_0x3ba824);}(_0x67b8,0x74));var _0x867b=function(_0x461043,_0x13988c){_0x461043=_0x461043-0x0;var _0x5d9218=_0x67b8[_0x461043];return _0x5d9218;};'use strict';var Sequelize=require(_0x867b('0x0'));module[_0x867b('0x1')]={'priority':{'type':Sequelize[_0x867b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x867b('0x3')],'allowNull':![],'defaultValue':_0x867b('0x4')},'appdata':{'type':Sequelize[_0x867b('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x867b('0x3')],'defaultValue':_0x867b('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 3f082f6..cbfce5b 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 _0xf4b8=['body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','limit','offset','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','VIRTUAL','merge','options','where','SmsApplication','includeAll','include','findAll','rows','catch','show','params','find','create'];(function(_0x572363,_0x10a1c8){var _0x1e9abe=function(_0x512f00){while(--_0x512f00){_0x572363['push'](_0x572363['shift']());}};_0x1e9abe(++_0x10a1c8);}(_0xf4b8,0x139));var _0x8f4b=function(_0x4c8d23,_0xfc20c6){_0x4c8d23=_0x4c8d23-0x0;var _0x2954fd=_0xf4b8[_0x4c8d23];return _0x2954fd;};'use strict';var emlformat=require(_0x8f4b('0x0'));var rimraf=require(_0x8f4b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f4b('0x2'));var rp=require(_0x8f4b('0x3'));var moment=require('moment');var BPromise=require(_0x8f4b('0x4'));var Mustache=require(_0x8f4b('0x5'));var util=require(_0x8f4b('0x6'));var path=require(_0x8f4b('0x7'));var sox=require(_0x8f4b('0x8'));var csv=require(_0x8f4b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f4b('0xa'));var _=require(_0x8f4b('0xb'));var squel=require(_0x8f4b('0xc'));var crypto=require(_0x8f4b('0xd'));var jsforce=require(_0x8f4b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8f4b('0x9'));var querystring=require(_0x8f4b('0xf'));var Papa=require(_0x8f4b('0x10'));var Redis=require(_0x8f4b('0x11'));var authService=require(_0x8f4b('0x12'));var qs=require(_0x8f4b('0x13'));var as=require(_0x8f4b('0x14'));var hardwareService=require(_0x8f4b('0x15'));var logger=require(_0x8f4b('0x16'))(_0x8f4b('0x17'));var utils=require(_0x8f4b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8f4b('0x19'));var db=require(_0x8f4b('0x1a'))['db'];function respondWithStatusCode(_0x156ac9,_0x5a6b3c){_0x5a6b3c=_0x5a6b3c||0xcc;return function(_0x19baa1){if(_0x19baa1){return _0x156ac9['sendStatus'](_0x5a6b3c);}return _0x156ac9[_0x8f4b('0x1b')](_0x5a6b3c)[_0x8f4b('0x1c')]();};}function respondWithResult(_0x2e7ad2,_0x2eed28){_0x2eed28=_0x2eed28||0xc8;return function(_0x2228b5){if(_0x2228b5){return _0x2e7ad2['status'](_0x2eed28)['json'](_0x2228b5);}};}function respondWithFilteredResult(_0x1cdeea,_0x616214){return function(_0x8e68c3){if(_0x8e68c3){var _0x1090a8=typeof _0x616214['offset']===_0x8f4b('0x1d')&&typeof _0x616214[_0x8f4b('0x1e')]===_0x8f4b('0x1d');var _0x1f9cd3=_0x8e68c3['count'];var _0x7ccc69=_0x1090a8?0x0:_0x616214[_0x8f4b('0x1f')];var _0x2a0433=_0x1090a8?_0x8e68c3[_0x8f4b('0x20')]:_0x616214[_0x8f4b('0x1f')]+_0x616214['limit'];var _0x58bf91;if(_0x2a0433>=_0x1f9cd3){_0x2a0433=_0x1f9cd3;_0x58bf91=0xc8;}else{_0x58bf91=0xce;}_0x1cdeea[_0x8f4b('0x1b')](_0x58bf91);return _0x1cdeea[_0x8f4b('0x21')]('Content-Range',_0x7ccc69+'-'+_0x2a0433+'/'+_0x1f9cd3)['json'](_0x8e68c3);}return null;};}function patchUpdates(_0x59fbe0){return function(_0x52e2c8){try{jsonpatch[_0x8f4b('0x22')](_0x52e2c8,_0x59fbe0,!![]);}catch(_0x5b50c7){return BPromise[_0x8f4b('0x23')](_0x5b50c7);}return _0x52e2c8[_0x8f4b('0x24')]();};}function saveUpdates(_0x2b2d75,_0x56068c){return function(_0x21a5b3){if(_0x21a5b3){return _0x21a5b3[_0x8f4b('0x25')](_0x2b2d75)[_0x8f4b('0x26')](function(_0x391de2){return _0x391de2;});}return null;};}function removeEntity(_0x48b3fe,_0x2dceeb){return function(_0x20d339){if(_0x20d339){return _0x20d339[_0x8f4b('0x27')]()[_0x8f4b('0x26')](function(){_0x48b3fe['status'](0xcc)[_0x8f4b('0x1c')]();});}};}function handleEntityNotFound(_0x363c1e,_0x489c38){return function(_0x5d6db7){if(!_0x5d6db7){_0x363c1e[_0x8f4b('0x28')](0x194);}return _0x5d6db7;};}function handleError(_0x4655ff,_0x1ae312){_0x1ae312=_0x1ae312||0x1f4;return function(_0x5904b6){logger[_0x8f4b('0x29')](_0x5904b6[_0x8f4b('0x2a')]);if(_0x5904b6[_0x8f4b('0x2b')]){delete _0x5904b6[_0x8f4b('0x2b')];}_0x4655ff[_0x8f4b('0x1b')](_0x1ae312)[_0x8f4b('0x2c')](_0x5904b6);};}exports['index']=function(_0x492ebc,_0x3262b3){var _0x71c5c8={},_0x20c4d3={},_0x3cfd1d={'count':0x0,'rows':[]};var _0x15dadf=_[_0x8f4b('0x2d')](db['SmsApplication'][_0x8f4b('0x2e')],function(_0x24388b){return{'name':_0x24388b[_0x8f4b('0x2f')],'type':_0x24388b[_0x8f4b('0x30')][_0x8f4b('0x31')]};});_0x20c4d3['model']=_[_0x8f4b('0x2d')](_0x15dadf,_0x8f4b('0x2b'));_0x20c4d3['query']=_[_0x8f4b('0x32')](_0x492ebc[_0x8f4b('0x33')]);_0x20c4d3[_0x8f4b('0x34')]=_[_0x8f4b('0x35')](_0x20c4d3[_0x8f4b('0x36')],_0x20c4d3[_0x8f4b('0x33')]);_0x71c5c8[_0x8f4b('0x37')]=_[_0x8f4b('0x35')](_0x20c4d3[_0x8f4b('0x36')],qs[_0x8f4b('0x38')](_0x492ebc[_0x8f4b('0x33')]['fields']));_0x71c5c8[_0x8f4b('0x37')]=_0x71c5c8[_0x8f4b('0x37')][_0x8f4b('0x39')]?_0x71c5c8[_0x8f4b('0x37')]:_0x20c4d3[_0x8f4b('0x36')];if(!_0x492ebc[_0x8f4b('0x33')]['hasOwnProperty'](_0x8f4b('0x3a'))){_0x71c5c8[_0x8f4b('0x1e')]=qs['limit'](_0x492ebc['query']['limit']);_0x71c5c8[_0x8f4b('0x1f')]=qs[_0x8f4b('0x1f')](_0x492ebc[_0x8f4b('0x33')][_0x8f4b('0x1f')]);}_0x71c5c8[_0x8f4b('0x3b')]=qs[_0x8f4b('0x3c')](_0x492ebc['query']['sort']);_0x71c5c8['where']=qs[_0x8f4b('0x34')](_[_0x8f4b('0x3d')](_0x492ebc['query'],_0x20c4d3[_0x8f4b('0x34')]),_0x15dadf);if(_0x492ebc[_0x8f4b('0x33')][_0x8f4b('0x3e')]){_0x71c5c8['where']=_['merge'](_0x71c5c8['where'],{'$or':_[_0x8f4b('0x2d')](_0x15dadf,function(_0x1b4daf){if(_0x1b4daf['type']!==_0x8f4b('0x3f')){var _0x2eff50={};_0x2eff50[_0x1b4daf[_0x8f4b('0x2b')]]={'$like':'%'+_0x492ebc[_0x8f4b('0x33')][_0x8f4b('0x3e')]+'%'};return _0x2eff50;}})});}_0x71c5c8=_[_0x8f4b('0x40')]({},_0x71c5c8,_0x492ebc[_0x8f4b('0x41')]);var _0xfdd9f3={'where':_0x71c5c8[_0x8f4b('0x42')]};return db[_0x8f4b('0x43')][_0x8f4b('0x20')](_0xfdd9f3)[_0x8f4b('0x26')](function(_0x41175a){_0x3cfd1d[_0x8f4b('0x20')]=_0x41175a;if(_0x492ebc['query'][_0x8f4b('0x44')]){_0x71c5c8[_0x8f4b('0x45')]=[{'all':!![]}];}return db[_0x8f4b('0x43')][_0x8f4b('0x46')](_0x71c5c8);})[_0x8f4b('0x26')](function(_0x1f1522){_0x3cfd1d[_0x8f4b('0x47')]=_0x1f1522;return _0x3cfd1d;})[_0x8f4b('0x26')](respondWithFilteredResult(_0x3262b3,_0x71c5c8))[_0x8f4b('0x48')](handleError(_0x3262b3,null));};exports[_0x8f4b('0x49')]=function(_0x4e6a9e,_0x4ca06b){var _0x25880f={'raw':!![],'where':{'id':_0x4e6a9e[_0x8f4b('0x4a')]['id']}},_0x40fa11={};_0x40fa11['model']=_[_0x8f4b('0x32')](db[_0x8f4b('0x43')][_0x8f4b('0x2e')]);_0x40fa11[_0x8f4b('0x33')]=_[_0x8f4b('0x32')](_0x4e6a9e[_0x8f4b('0x33')]);_0x40fa11['filters']=_[_0x8f4b('0x35')](_0x40fa11[_0x8f4b('0x36')],_0x40fa11[_0x8f4b('0x33')]);_0x25880f[_0x8f4b('0x37')]=_['intersection'](_0x40fa11[_0x8f4b('0x36')],qs[_0x8f4b('0x38')](_0x4e6a9e[_0x8f4b('0x33')][_0x8f4b('0x38')]));_0x25880f[_0x8f4b('0x37')]=_0x25880f[_0x8f4b('0x37')]['length']?_0x25880f['attributes']:_0x40fa11['model'];if(_0x4e6a9e[_0x8f4b('0x33')][_0x8f4b('0x44')]){_0x25880f['include']=[{'all':!![]}];}_0x25880f=_[_0x8f4b('0x40')]({},_0x25880f,_0x4e6a9e[_0x8f4b('0x41')]);return db[_0x8f4b('0x43')][_0x8f4b('0x4b')](_0x25880f)[_0x8f4b('0x26')](handleEntityNotFound(_0x4ca06b,null))[_0x8f4b('0x26')](respondWithResult(_0x4ca06b,null))[_0x8f4b('0x48')](handleError(_0x4ca06b,null));};exports[_0x8f4b('0x4c')]=function(_0x4ce83e,_0x4b4e0f){return db[_0x8f4b('0x43')][_0x8f4b('0x4c')](_0x4ce83e[_0x8f4b('0x4d')],{})[_0x8f4b('0x26')](respondWithResult(_0x4b4e0f,0xc9))[_0x8f4b('0x48')](handleError(_0x4b4e0f,null));};exports[_0x8f4b('0x25')]=function(_0x7c810,_0x216eb3){if(_0x7c810['body']['id']){delete _0x7c810['body']['id'];}return db['SmsApplication'][_0x8f4b('0x4b')]({'where':{'id':_0x7c810[_0x8f4b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x216eb3,null))[_0x8f4b('0x26')](saveUpdates(_0x7c810['body'],null))['then'](respondWithResult(_0x216eb3,null))[_0x8f4b('0x48')](handleError(_0x216eb3,null));};exports['destroy']=function(_0x1a3397,_0x5425d6){return db[_0x8f4b('0x43')][_0x8f4b('0x4b')]({'where':{'id':_0x1a3397[_0x8f4b('0x4a')]['id']}})[_0x8f4b('0x26')](handleEntityNotFound(_0x5425d6,null))[_0x8f4b('0x26')](removeEntity(_0x5425d6,null))[_0x8f4b('0x48')](handleError(_0x5425d6,null));}; \ No newline at end of file +var _0xbb93=['pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x239dba,_0x309e95){var _0x1ceb11=function(_0x14efe6){while(--_0x14efe6){_0x239dba['push'](_0x239dba['shift']());}};_0x1ceb11(++_0x309e95);}(_0xbb93,0x188));var _0x3bb9=function(_0x764c6f,_0xf1d61){_0x764c6f=_0x764c6f-0x0;var _0x39893d=_0xbb93[_0x764c6f];return _0x39893d;};'use strict';var emlformat=require(_0x3bb9('0x0'));var rimraf=require(_0x3bb9('0x1'));var zipdir=require(_0x3bb9('0x2'));var jsonpatch=require(_0x3bb9('0x3'));var rp=require(_0x3bb9('0x4'));var moment=require(_0x3bb9('0x5'));var BPromise=require(_0x3bb9('0x6'));var Mustache=require(_0x3bb9('0x7'));var util=require(_0x3bb9('0x8'));var path=require(_0x3bb9('0x9'));var sox=require(_0x3bb9('0xa'));var csv=require(_0x3bb9('0xb'));var ejs=require(_0x3bb9('0xc'));var fs=require('fs');var fs_extra=require(_0x3bb9('0xd'));var _=require(_0x3bb9('0xe'));var squel=require('squel');var crypto=require(_0x3bb9('0xf'));var jsforce=require(_0x3bb9('0x10'));var deskjs=require(_0x3bb9('0x11'));var toCsv=require(_0x3bb9('0xb'));var querystring=require(_0x3bb9('0x12'));var Papa=require(_0x3bb9('0x13'));var Redis=require(_0x3bb9('0x14'));var authService=require(_0x3bb9('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x3bb9('0x16'));var hardwareService=require(_0x3bb9('0x17'));var logger=require(_0x3bb9('0x18'))('api');var utils=require(_0x3bb9('0x19'));var config=require(_0x3bb9('0x1a'));var licenseUtil=require(_0x3bb9('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e1665,_0x4f7c7a){_0x4f7c7a=_0x4f7c7a||0xcc;return function(_0x28c1d9){if(_0x28c1d9){return _0x2e1665[_0x3bb9('0x1c')](_0x4f7c7a);}return _0x2e1665['status'](_0x4f7c7a)['end']();};}function respondWithResult(_0x59a60d,_0x405fdf){_0x405fdf=_0x405fdf||0xc8;return function(_0x34f954){if(_0x34f954){return _0x59a60d[_0x3bb9('0x1d')](_0x405fdf)[_0x3bb9('0x1e')](_0x34f954);}};}function respondWithFilteredResult(_0x1141fa,_0x5a6274){return function(_0xe5c4a4){if(_0xe5c4a4){var _0x2fee08=typeof _0x5a6274[_0x3bb9('0x1f')]===_0x3bb9('0x20')&&typeof _0x5a6274[_0x3bb9('0x21')]===_0x3bb9('0x20');var _0x207aab=_0xe5c4a4[_0x3bb9('0x22')];var _0x1521db=_0x2fee08?0x0:_0x5a6274[_0x3bb9('0x1f')];var _0x1264f8=_0x2fee08?_0xe5c4a4[_0x3bb9('0x22')]:_0x5a6274['offset']+_0x5a6274[_0x3bb9('0x21')];var _0x3f551b;if(_0x1264f8>=_0x207aab){_0x1264f8=_0x207aab;_0x3f551b=0xc8;}else{_0x3f551b=0xce;}_0x1141fa[_0x3bb9('0x1d')](_0x3f551b);return _0x1141fa[_0x3bb9('0x23')]('Content-Range',_0x1521db+'-'+_0x1264f8+'/'+_0x207aab)['json'](_0xe5c4a4);}return null;};}function patchUpdates(_0x5079b2){return function(_0x46d7a1){try{jsonpatch[_0x3bb9('0x24')](_0x46d7a1,_0x5079b2,!![]);}catch(_0x59e876){return BPromise[_0x3bb9('0x25')](_0x59e876);}return _0x46d7a1[_0x3bb9('0x26')]();};}function saveUpdates(_0x2bed95,_0x15f56a){return function(_0x336bd7){if(_0x336bd7){return _0x336bd7[_0x3bb9('0x27')](_0x2bed95)['then'](function(_0x5dda00){return _0x5dda00;});}return null;};}function removeEntity(_0x2bc777,_0x5e5d9b){return function(_0x579a9a){if(_0x579a9a){return _0x579a9a[_0x3bb9('0x28')]()[_0x3bb9('0x29')](function(){_0x2bc777[_0x3bb9('0x1d')](0xcc)[_0x3bb9('0x2a')]();});}};}function handleEntityNotFound(_0x1a0b1f,_0x18bd24){return function(_0x38f240){if(!_0x38f240){_0x1a0b1f[_0x3bb9('0x1c')](0x194);}return _0x38f240;};}function handleError(_0x23564c,_0x2ffc53){_0x2ffc53=_0x2ffc53||0x1f4;return function(_0x59365e){logger['error'](_0x59365e['stack']);if(_0x59365e[_0x3bb9('0x2b')]){delete _0x59365e[_0x3bb9('0x2b')];}_0x23564c[_0x3bb9('0x1d')](_0x2ffc53)[_0x3bb9('0x2c')](_0x59365e);};}exports[_0x3bb9('0x2d')]=function(_0x4d9991,_0x18cc7d){var _0xe89644={},_0x5654cf={},_0x1125be={'count':0x0,'rows':[]};var _0x437ddd=_[_0x3bb9('0x2e')](db[_0x3bb9('0x2f')][_0x3bb9('0x30')],function(_0x1fc0cb){return{'name':_0x1fc0cb[_0x3bb9('0x31')],'type':_0x1fc0cb[_0x3bb9('0x32')][_0x3bb9('0x33')]};});_0x5654cf[_0x3bb9('0x34')]=_[_0x3bb9('0x2e')](_0x437ddd,_0x3bb9('0x2b'));_0x5654cf[_0x3bb9('0x35')]=_[_0x3bb9('0x36')](_0x4d9991[_0x3bb9('0x35')]);_0x5654cf[_0x3bb9('0x37')]=_[_0x3bb9('0x38')](_0x5654cf[_0x3bb9('0x34')],_0x5654cf[_0x3bb9('0x35')]);_0xe89644[_0x3bb9('0x39')]=_[_0x3bb9('0x38')](_0x5654cf['model'],qs['fields'](_0x4d9991['query'][_0x3bb9('0x3a')]));_0xe89644[_0x3bb9('0x39')]=_0xe89644['attributes'][_0x3bb9('0x3b')]?_0xe89644['attributes']:_0x5654cf[_0x3bb9('0x34')];if(!_0x4d9991['query'][_0x3bb9('0x3c')](_0x3bb9('0x3d'))){_0xe89644[_0x3bb9('0x21')]=qs[_0x3bb9('0x21')](_0x4d9991[_0x3bb9('0x35')]['limit']);_0xe89644[_0x3bb9('0x1f')]=qs[_0x3bb9('0x1f')](_0x4d9991['query'][_0x3bb9('0x1f')]);}_0xe89644['order']=qs[_0x3bb9('0x3e')](_0x4d9991[_0x3bb9('0x35')][_0x3bb9('0x3e')]);_0xe89644[_0x3bb9('0x3f')]=qs[_0x3bb9('0x37')](_[_0x3bb9('0x40')](_0x4d9991[_0x3bb9('0x35')],_0x5654cf[_0x3bb9('0x37')]),_0x437ddd);if(_0x4d9991[_0x3bb9('0x35')][_0x3bb9('0x41')]){_0xe89644['where']=_[_0x3bb9('0x42')](_0xe89644['where'],{'$or':_[_0x3bb9('0x2e')](_0x437ddd,function(_0x3a1d6a){if(_0x3a1d6a['type']!==_0x3bb9('0x43')){var _0x31ddbd={};_0x31ddbd[_0x3a1d6a[_0x3bb9('0x2b')]]={'$like':'%'+_0x4d9991[_0x3bb9('0x35')]['filter']+'%'};return _0x31ddbd;}})});}_0xe89644=_[_0x3bb9('0x42')]({},_0xe89644,_0x4d9991['options']);var _0x102df6={'where':_0xe89644[_0x3bb9('0x3f')]};return db['SmsApplication']['count'](_0x102df6)[_0x3bb9('0x29')](function(_0x7c2910){_0x1125be[_0x3bb9('0x22')]=_0x7c2910;if(_0x4d9991[_0x3bb9('0x35')]['includeAll']){_0xe89644[_0x3bb9('0x44')]=[{'all':!![]}];}return db[_0x3bb9('0x2f')][_0x3bb9('0x45')](_0xe89644);})[_0x3bb9('0x29')](function(_0x2b14bc){_0x1125be[_0x3bb9('0x46')]=_0x2b14bc;return _0x1125be;})[_0x3bb9('0x29')](respondWithFilteredResult(_0x18cc7d,_0xe89644))[_0x3bb9('0x47')](handleError(_0x18cc7d,null));};exports[_0x3bb9('0x48')]=function(_0x4ee73f,_0x45520b){var _0x1c624a={'raw':!![],'where':{'id':_0x4ee73f[_0x3bb9('0x49')]['id']}},_0x52dfa8={};_0x52dfa8['model']=_[_0x3bb9('0x36')](db[_0x3bb9('0x2f')]['rawAttributes']);_0x52dfa8[_0x3bb9('0x35')]=_[_0x3bb9('0x36')](_0x4ee73f[_0x3bb9('0x35')]);_0x52dfa8[_0x3bb9('0x37')]=_[_0x3bb9('0x38')](_0x52dfa8[_0x3bb9('0x34')],_0x52dfa8[_0x3bb9('0x35')]);_0x1c624a[_0x3bb9('0x39')]=_[_0x3bb9('0x38')](_0x52dfa8[_0x3bb9('0x34')],qs[_0x3bb9('0x3a')](_0x4ee73f[_0x3bb9('0x35')]['fields']));_0x1c624a[_0x3bb9('0x39')]=_0x1c624a[_0x3bb9('0x39')][_0x3bb9('0x3b')]?_0x1c624a[_0x3bb9('0x39')]:_0x52dfa8[_0x3bb9('0x34')];if(_0x4ee73f[_0x3bb9('0x35')]['includeAll']){_0x1c624a[_0x3bb9('0x44')]=[{'all':!![]}];}_0x1c624a=_['merge']({},_0x1c624a,_0x4ee73f['options']);return db[_0x3bb9('0x2f')][_0x3bb9('0x4a')](_0x1c624a)[_0x3bb9('0x29')](handleEntityNotFound(_0x45520b,null))[_0x3bb9('0x29')](respondWithResult(_0x45520b,null))[_0x3bb9('0x47')](handleError(_0x45520b,null));};exports['create']=function(_0x11eb34,_0x2e30b6){return db['SmsApplication']['create'](_0x11eb34[_0x3bb9('0x4b')],{})[_0x3bb9('0x29')](respondWithResult(_0x2e30b6,0xc9))['catch'](handleError(_0x2e30b6,null));};exports[_0x3bb9('0x27')]=function(_0x400a48,_0x3bce17){if(_0x400a48[_0x3bb9('0x4b')]['id']){delete _0x400a48[_0x3bb9('0x4b')]['id'];}return db[_0x3bb9('0x2f')][_0x3bb9('0x4a')]({'where':{'id':_0x400a48[_0x3bb9('0x49')]['id']}})['then'](handleEntityNotFound(_0x3bce17,null))[_0x3bb9('0x29')](saveUpdates(_0x400a48[_0x3bb9('0x4b')],null))[_0x3bb9('0x29')](respondWithResult(_0x3bce17,null))[_0x3bb9('0x47')](handleError(_0x3bce17,null));};exports['destroy']=function(_0x5ed24d,_0x8a22d5){return db[_0x3bb9('0x2f')][_0x3bb9('0x4a')]({'where':{'id':_0x5ed24d[_0x3bb9('0x49')]['id']}})[_0x3bb9('0x29')](handleEntityNotFound(_0x8a22d5,null))[_0x3bb9('0x29')](removeEntity(_0x8a22d5,null))['catch'](handleError(_0x8a22d5,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 4b950ab..8c1c173 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 _0xb27d=['./smsApplication.attributes','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x34ea76,_0x4cf22f){var _0x20a688=function(_0x5c6595){while(--_0x5c6595){_0x34ea76['push'](_0x34ea76['shift']());}};_0x20a688(++_0x4cf22f);}(_0xb27d,0xe5));var _0xdb27=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xb27d[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xdb27('0x0'));var util=require(_0xdb27('0x1'));var logger=require(_0xdb27('0x2'))(_0xdb27('0x3'));var moment=require('moment');var BPromise=require(_0xdb27('0x4'));var rp=require(_0xdb27('0x5'));var fs=require('fs');var path=require(_0xdb27('0x6'));var rimraf=require(_0xdb27('0x7'));var config=require(_0xdb27('0x8'));var attributes=require(_0xdb27('0x9'));module['exports']=function(_0x4ce81b,_0x98c60){return _0x4ce81b['define'](_0xdb27('0xa'),attributes,{'tableName':_0xdb27('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdb27('0xc'),'collate':_0xdb27('0xd')});}; \ No newline at end of file +var _0x609b=['define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports'];(function(_0xb77dd4,_0x371dd8){var _0x29db3c=function(_0x37f493){while(--_0x37f493){_0xb77dd4['push'](_0xb77dd4['shift']());}};_0x29db3c(++_0x371dd8);}(_0x609b,0x1b7));var _0xb609=function(_0x59a505,_0x2d801c){_0x59a505=_0x59a505-0x0;var _0x585cf9=_0x609b[_0x59a505];return _0x585cf9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb609('0x0'))(_0xb609('0x1'));var moment=require(_0xb609('0x2'));var BPromise=require('bluebird');var rp=require(_0xb609('0x3'));var fs=require('fs');var path=require(_0xb609('0x4'));var rimraf=require(_0xb609('0x5'));var config=require(_0xb609('0x6'));var attributes=require(_0xb609('0x7'));module[_0xb609('0x8')]=function(_0x5b358a,_0x1e610d){return _0x5b358a[_0xb609('0x9')](_0xb609('0xa'),attributes,{'tableName':_0xb609('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb609('0xc'),'collate':_0xb609('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 8d70f21..baf041c 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 _0x1241=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x34986e,_0xded19){var _0x3956f3=function(_0x23aa1d){while(--_0x23aa1d){_0x34986e['push'](_0x34986e['shift']());}};_0x3956f3(++_0xded19);}(_0x1241,0xb4));var _0x1124=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1241[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1124('0x0'));var util=require('util');var moment=require(_0x1124('0x1'));var BPromise=require(_0x1124('0x2'));var rs=require(_0x1124('0x3'));var fs=require('fs');var Redis=require(_0x1124('0x4'));var db=require(_0x1124('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1124('0x6'))(_0x1124('0x7'));var config=require(_0x1124('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1124('0x9')][_0x1124('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45200c,_0x3fe52a,_0x52b076){return new BPromise(function(_0x57a179,_0x4cecf6){return client[_0x1124('0xb')](_0x45200c,_0x52b076)['then'](function(_0x159c1c){logger[_0x1124('0xc')](_0x1124('0xd'),_0x3fe52a,_0x1124('0xe'));logger[_0x1124('0xf')](_0x1124('0x10'),_0x3fe52a,'request\x20sent',JSON[_0x1124('0x11')](_0x159c1c));if(_0x159c1c['error']){if(_0x159c1c['error']['code']===0x1f4){logger[_0x1124('0x12')]('SmsApplication,\x20%s,\x20%s',_0x3fe52a,_0x159c1c['error'][_0x1124('0x13')]);return _0x4cecf6(_0x159c1c[_0x1124('0x12')][_0x1124('0x13')]);}logger['error'](_0x1124('0xd'),_0x3fe52a,_0x159c1c[_0x1124('0x12')][_0x1124('0x13')]);return _0x57a179(_0x159c1c[_0x1124('0x12')]['message']);}else{logger[_0x1124('0xc')](_0x1124('0xd'),_0x3fe52a,_0x1124('0xe'));_0x57a179(_0x159c1c[_0x1124('0x14')][_0x1124('0x13')]);}})[_0x1124('0x15')](function(_0x356c4a){logger[_0x1124('0x12')](_0x1124('0xd'),_0x3fe52a,_0x356c4a);_0x4cecf6(_0x356c4a);});});} \ No newline at end of file +var _0x235b=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info'];(function(_0x88723,_0x2decad){var _0x111eff=function(_0x4f1c1c){while(--_0x4f1c1c){_0x88723['push'](_0x88723['shift']());}};_0x111eff(++_0x2decad);}(_0x235b,0x1ed));var _0xb235=function(_0x22cb34,_0x116622){_0x22cb34=_0x22cb34-0x0;var _0x592d3c=_0x235b[_0x22cb34];return _0x592d3c;};'use strict';var _=require(_0xb235('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb235('0x1'));var rs=require(_0xb235('0x2'));var fs=require('fs');var Redis=require(_0xb235('0x3'));var db=require(_0xb235('0x4'))['db'];var utils=require(_0xb235('0x5'));var logger=require(_0xb235('0x6'))('rpc');var config=require(_0xb235('0x7'));var jayson=require(_0xb235('0x8'));var client=jayson[_0xb235('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12d0ae,_0x44559a,_0x2affe8){return new BPromise(function(_0x436d63,_0x3241b4){return client['request'](_0x12d0ae,_0x2affe8)['then'](function(_0xecf759){logger[_0xb235('0xa')](_0xb235('0xb'),_0x44559a,_0xb235('0xc'));logger[_0xb235('0xd')](_0xb235('0xe'),_0x44559a,_0xb235('0xc'),JSON[_0xb235('0xf')](_0xecf759));if(_0xecf759['error']){if(_0xecf759[_0xb235('0x10')][_0xb235('0x11')]===0x1f4){logger[_0xb235('0x10')]('SmsApplication,\x20%s,\x20%s',_0x44559a,_0xecf759[_0xb235('0x10')]['message']);return _0x3241b4(_0xecf759[_0xb235('0x10')][_0xb235('0x12')]);}logger[_0xb235('0x10')](_0xb235('0xb'),_0x44559a,_0xecf759[_0xb235('0x10')][_0xb235('0x12')]);return _0x436d63(_0xecf759[_0xb235('0x10')]['message']);}else{logger[_0xb235('0xa')](_0xb235('0xb'),_0x44559a,_0xb235('0xc'));_0x436d63(_0xecf759[_0xb235('0x13')][_0xb235('0x12')]);}})[_0xb235('0x14')](function(_0x16f044){logger[_0xb235('0x10')](_0xb235('0xb'),_0x44559a,_0x16f044);_0x3241b4(_0x16f044);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index dcba9c1..04ab118 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 _0x4213=['download','post','create','/:id/messages','addMessage','/:id/tags','tracked','smsinteraction:addtags','put','smsinteraction:update','update','sms','smsinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x4213,0x77));var _0x3421=function(_0x36ad44,_0x390c18){_0x36ad44=_0x36ad44-0x0;var _0x5bb132=_0x4213[_0x36ad44];return _0x5bb132;};'use strict';var multer=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var timeout=require(_0x3421('0x3'));var express=require(_0x3421('0x4'));var router=express[_0x3421('0x5')]();var fs_extra=require(_0x3421('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3421('0x7'));var config=require('../../config/environment');var controller=require(_0x3421('0x8'));router[_0x3421('0x9')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0xb')]);router['get'](_0x3421('0xc'),auth[_0x3421('0xa')](),controller[_0x3421('0xd')]);router[_0x3421('0x9')](_0x3421('0xe'),auth['isAuthenticated'](),controller[_0x3421('0xf')]);router['get']('/:id/messages',auth[_0x3421('0xa')](),controller['getMessages']);router[_0x3421('0x9')](_0x3421('0x10'),auth[_0x3421('0xa')](),controller[_0x3421('0x11')]);router[_0x3421('0x12')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0x13')]);router['post'](_0x3421('0x14'),auth[_0x3421('0xa')](),controller[_0x3421('0x15')]);router[_0x3421('0x12')](_0x3421('0x16'),auth[_0x3421('0xa')](),interaction[_0x3421('0x17')]('sms',_0x3421('0x18')),controller['addTags']);router[_0x3421('0x19')](_0x3421('0xe'),auth['isAuthenticated'](),interaction[_0x3421('0x17')]('sms',_0x3421('0x1a')),controller[_0x3421('0x1b')]);router['delete'](_0x3421('0xe'),auth[_0x3421('0xa')](),interaction[_0x3421('0x17')](_0x3421('0x1c'),_0x3421('0x1d')),controller[_0x3421('0x1e')]);router[_0x3421('0x1f')](_0x3421('0x16'),auth[_0x3421('0xa')](),controller[_0x3421('0x20')]);module[_0x3421('0x21')]=router; \ No newline at end of file +var _0x9ffd=['sms','smsinteraction:addtags','put','smsinteraction:update','delete','tracked','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','getMessages','/:id/download','download','post','create','addMessage','/:id/tags'];(function(_0x1aa981,_0x45eb1a){var _0x332fd6=function(_0x4f155c){while(--_0x4f155c){_0x1aa981['push'](_0x1aa981['shift']());}};_0x332fd6(++_0x45eb1a);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x55f918,_0x3f878c){_0x55f918=_0x55f918-0x0;var _0x127816=_0x9ffd[_0x55f918];return _0x127816;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0xb')](_0xd9ff('0x10'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0x12')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router['post']('/:id/messages',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x14')]);router[_0xd9ff('0x12')](_0xd9ff('0x15'),auth[_0xd9ff('0x9')](),interaction['tracked'](_0xd9ff('0x16'),_0xd9ff('0x17')),controller['addTags']);router[_0xd9ff('0x18')]('/:id',auth['isAuthenticated'](),interaction['tracked']('sms',_0xd9ff('0x19')),controller['update']);router[_0xd9ff('0x1a')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),interaction[_0xd9ff('0x1b')](_0xd9ff('0x16'),_0xd9ff('0x1c')),controller[_0xd9ff('0x1d')]);router[_0xd9ff('0x1a')](_0xd9ff('0x15'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x1e')]);module[_0xd9ff('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 1683afb..d90d6d7 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 _0x93e9=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x33a213,_0x555d8f){var _0x18dd85=function(_0x13915d){while(--_0x13915d){_0x33a213['push'](_0x33a213['shift']());}};_0x18dd85(++_0x555d8f);}(_0x93e9,0xcc));var _0x993e=function(_0x183d0f,_0x4c1044){_0x183d0f=_0x183d0f-0x0;var _0x5434dd=_0x93e9[_0x183d0f];return _0x5434dd;};'use strict';var Sequelize=require(_0x993e('0x0'));var moment=require(_0x993e('0x1'));module[_0x993e('0x2')]={'closed':{'type':Sequelize[_0x993e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x993e('0x4')]},'disposition':{'type':Sequelize[_0x993e('0x5')]},'secondDisposition':{'type':Sequelize[_0x993e('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x993e('0x5')]},'read1stAt':{'type':Sequelize[_0x993e('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x993e('0x6')]('in',_0x993e('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x993e('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x993e('0x6')]('in',_0x993e('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x993e('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x57ca=['moment','exports','DATE','STRING','ENUM','out','BOOLEAN','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x57ca,0x108));var _0xa57c=function(_0x41d319,_0x43b8fc){_0x41d319=_0x41d319-0x0;var _0x466f55=_0x57ca[_0x41d319];return _0x466f55;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa57c('0x0'));module[_0xa57c('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa57c('0x2')]},'disposition':{'type':Sequelize[_0xa57c('0x3')]},'secondDisposition':{'type':Sequelize[_0xa57c('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa57c('0x3')]},'note':{'type':Sequelize[_0xa57c('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xa57c('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xa57c('0x4')]('in',_0xa57c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa57c('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa57c('0x4')]('in',_0xa57c('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa57c('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa57c('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 3b515c7..2c85dc1 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 _0xa412=['zip-dir','moment','util','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','limit','undefined','count','Content-Range','update','then','destroy','end','error','stack','name','send','fieldName','type','findAll','sms','query','user','catch','show','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','include','merge','options','SmsInteraction','find','create','body','describe','addMessage','SmsMessage','ids','hasOwnProperty','order','sort','pick','where','SmsInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','setTags','Tag','color','emit','smsInteractionTags:save','download','unix','toString','join','root','server','files','format','transcript-%d-%s.zip','push','User','CmContact','lastName','Messages','direction','secret','read','Account','Owner','fullname','get','Sms','N.A.','createdAt','closed','closedAt','out','System','Contact','value','views','transcript-','.pdf','createPdfFromHTML','err','rimraf'];(function(_0x58e7bf,_0x3aea08){var _0x2f0ee4=function(_0x24c0be){while(--_0x24c0be){_0x58e7bf['push'](_0x58e7bf['shift']());}};_0x2f0ee4(++_0x3aea08);}(_0xa412,0x1c3));var _0x2a41=function(_0x947eae,_0x27d2be){_0x947eae=_0x947eae-0x0;var _0xb7cd23=_0xa412[_0x947eae];return _0xb7cd23;};'use strict';var rimraf=require(_0x2a41('0x0'));var zipdir=require(_0x2a41('0x1'));var moment=require(_0x2a41('0x2'));var BPromise=require('bluebird');var util=require(_0x2a41('0x3'));var path=require('path');var ejs=require(_0x2a41('0x4'));var fs=require('fs');var _=require(_0x2a41('0x5'));var Redis=require(_0x2a41('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x2a41('0x7'));var pdf=require(_0x2a41('0x8'));var logger=require(_0x2a41('0x9'))(_0x2a41('0xa'));var config=require(_0x2a41('0xb'));var db=require(_0x2a41('0xc'))['db'];config['redis']=_['defaults'](config[_0x2a41('0xd')],{'host':_0x2a41('0xe'),'port':0x18eb});var socket=require(_0x2a41('0xf'))(new Redis(config[_0x2a41('0xd')]));require(_0x2a41('0x10'))[_0x2a41('0x11')](socket);function respondWithStatusCode(_0x3e39bf,_0x43a877){_0x43a877=_0x43a877||0xcc;return function(_0x58852c){if(_0x58852c){return _0x3e39bf[_0x2a41('0x12')](_0x43a877);}return _0x3e39bf[_0x2a41('0x13')](_0x43a877)['end']();};}function respondWithResult(_0x4f8145,_0x1fb97b){_0x1fb97b=_0x1fb97b||0xc8;return function(_0x35569b){if(_0x35569b){return _0x4f8145[_0x2a41('0x13')](_0x1fb97b)[_0x2a41('0x14')](_0x35569b);}};}function respondWithFilteredResult(_0x31c3e2,_0x40f7ae){return function(_0x2b5080){if(_0x2b5080){var _0x1382a4=typeof _0x40f7ae[_0x2a41('0x15')]==='undefined'&&typeof _0x40f7ae[_0x2a41('0x16')]===_0x2a41('0x17');var _0xa4cf17=_0x2b5080['count'];var _0x355eb8=_0x1382a4?0x0:_0x40f7ae[_0x2a41('0x15')];var _0x597879=_0x1382a4?_0x2b5080[_0x2a41('0x18')]:_0x40f7ae[_0x2a41('0x15')]+_0x40f7ae['limit'];var _0x1cdb26;if(_0x597879>=_0xa4cf17){_0x597879=_0xa4cf17;_0x1cdb26=0xc8;}else{_0x1cdb26=0xce;}_0x31c3e2['status'](_0x1cdb26);return _0x31c3e2['set'](_0x2a41('0x19'),_0x355eb8+'-'+_0x597879+'/'+_0xa4cf17)[_0x2a41('0x14')](_0x2b5080);}return null;};}function saveUpdates(_0x12eedc){return function(_0x31ca76){if(_0x31ca76){return _0x31ca76[_0x2a41('0x1a')](_0x12eedc)[_0x2a41('0x1b')](function(_0x29b86e){return _0x29b86e;});}return null;};}function removeEntity(_0x31d771){return function(_0x2e8725){if(_0x2e8725){return _0x2e8725[_0x2a41('0x1c')]()[_0x2a41('0x1b')](function(){_0x31d771[_0x2a41('0x13')](0xcc)[_0x2a41('0x1d')]();});}};}function handleEntityNotFound(_0x4ad959){return function(_0x447819){if(!_0x447819){_0x4ad959[_0x2a41('0x12')](0x194);}return _0x447819;};}function handleError(_0x8454e1,_0x1e4da0){_0x1e4da0=_0x1e4da0||0x1f4;return function(_0x171630){logger[_0x2a41('0x1e')](_0x171630[_0x2a41('0x1f')]);if(_0x171630[_0x2a41('0x20')]){delete _0x171630[_0x2a41('0x20')];}_0x8454e1[_0x2a41('0x13')](_0x1e4da0)[_0x2a41('0x21')](_0x171630);};}exports['index']=function(_0x23c703,_0x5c80be){var _0x49295c={};var _0x2f3153=_['map'](db['SmsInteraction']['rawAttributes'],function(_0x119db9){return{'name':_0x119db9[_0x2a41('0x22')],'type':_0x119db9[_0x2a41('0x23')]['key']};});_0x49295c=qs['getOptions'](_0x2f3153,_0x23c703);return interaction[_0x2a41('0x24')](_0x2a41('0x25'),_0x23c703[_0x2a41('0x26')],_0x23c703[_0x2a41('0x27')],_0x49295c,_0x2f3153)['then'](respondWithFilteredResult(_0x5c80be,_0x49295c))[_0x2a41('0x28')](handleError(_0x5c80be,null));};exports[_0x2a41('0x29')]=function(_0x54a254,_0x1a4ff3){var _0x2253d2={'raw':![],'where':{'id':_0x54a254[_0x2a41('0x2a')]['id']}},_0x1fdbe5={};_0x1fdbe5[_0x2a41('0x2b')]=_[_0x2a41('0x2c')](db['SmsInteraction'][_0x2a41('0x2d')]);_0x1fdbe5['query']=_[_0x2a41('0x2c')](_0x54a254['query']);_0x1fdbe5[_0x2a41('0x2e')]=_[_0x2a41('0x2f')](_0x1fdbe5[_0x2a41('0x2b')],_0x1fdbe5[_0x2a41('0x26')]);_0x2253d2[_0x2a41('0x30')]=_[_0x2a41('0x2f')](_0x1fdbe5[_0x2a41('0x2b')],qs[_0x2a41('0x31')](_0x54a254[_0x2a41('0x26')][_0x2a41('0x31')]));_0x2253d2[_0x2a41('0x30')]=_0x2253d2['attributes'][_0x2a41('0x32')]?_0x2253d2['attributes']:_0x1fdbe5['model'];if(_0x54a254[_0x2a41('0x26')]['includeAll']){_0x2253d2[_0x2a41('0x33')]=[{'all':!![]}];}_0x2253d2=_[_0x2a41('0x34')]({},_0x2253d2,_0x54a254[_0x2a41('0x35')]);return db[_0x2a41('0x36')][_0x2a41('0x37')](_0x2253d2)['then'](handleEntityNotFound(_0x1a4ff3,null))[_0x2a41('0x1b')](respondWithResult(_0x1a4ff3,null))[_0x2a41('0x28')](handleError(_0x1a4ff3,null));};exports['create']=function(_0x2c7cb4,_0x58ef93){return db[_0x2a41('0x36')][_0x2a41('0x38')](_0x2c7cb4[_0x2a41('0x39')],{})[_0x2a41('0x1b')](respondWithResult(_0x58ef93,0xc9))[_0x2a41('0x28')](handleError(_0x58ef93,null));};exports[_0x2a41('0x1a')]=function(_0x80d29f,_0x42064e){if(_0x80d29f[_0x2a41('0x39')]['id']){delete _0x80d29f[_0x2a41('0x39')]['id'];}return db[_0x2a41('0x36')]['find']({'where':{'id':_0x80d29f[_0x2a41('0x2a')]['id']}})[_0x2a41('0x1b')](handleEntityNotFound(_0x42064e,null))[_0x2a41('0x1b')](saveUpdates(_0x80d29f[_0x2a41('0x39')],null))[_0x2a41('0x1b')](respondWithResult(_0x42064e,null))['catch'](handleError(_0x42064e,null));};exports[_0x2a41('0x1c')]=function(_0x16cdd6,_0x3c07ae){return db[_0x2a41('0x36')][_0x2a41('0x37')]({'where':{'id':_0x16cdd6['params']['id']}})['then'](handleEntityNotFound(_0x3c07ae,null))[_0x2a41('0x1b')](removeEntity(_0x3c07ae,null))['catch'](handleError(_0x3c07ae,null));};exports[_0x2a41('0x3a')]=function(_0x5a837a,_0x43a143){return db[_0x2a41('0x36')][_0x2a41('0x3a')]()[_0x2a41('0x1b')](respondWithResult(_0x43a143,null))['catch'](handleError(_0x43a143,null));};exports[_0x2a41('0x3b')]=function(_0x5d43b0,_0x4579d5){return db[_0x2a41('0x3c')][_0x2a41('0x37')]({'where':{'id':_0x5d43b0[_0x2a41('0x2a')]['id']}})[_0x2a41('0x1b')](handleEntityNotFound(_0x4579d5,null))['then'](function(_0x32be1f){if(_0x32be1f){return _0x32be1f['addMessage'](_0x5d43b0[_0x2a41('0x39')][_0x2a41('0x3d')],_['omit'](_0x5d43b0[_0x2a41('0x39')],[_0x2a41('0x3d'),'id'])||{});}})[_0x2a41('0x1b')](respondWithResult(_0x4579d5,null))[_0x2a41('0x28')](handleError(_0x4579d5,null));};exports['getMessages']=function(_0x4de2c0,_0xd2c6aa){var _0x54e246={'raw':![],'where':{}};var _0x5bf499={};var _0x209d7a={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x4de2c0['params']['id']}})[_0x2a41('0x1b')](handleEntityNotFound(_0xd2c6aa,null))[_0x2a41('0x1b')](function(_0x2d8045){if(_0x2d8045){_0x5bf499[_0x2a41('0x2b')]=_[_0x2a41('0x2c')](db[_0x2a41('0x3c')][_0x2a41('0x2d')]);_0x5bf499['query']=_[_0x2a41('0x2c')](_0x4de2c0[_0x2a41('0x26')]);_0x5bf499[_0x2a41('0x2e')]=_['intersection'](_0x5bf499['model'],_0x5bf499['query']);_0x54e246[_0x2a41('0x30')]=_[_0x2a41('0x2f')](_0x5bf499[_0x2a41('0x2b')],qs[_0x2a41('0x31')](_0x4de2c0['query']['fields']));_0x54e246[_0x2a41('0x30')]=_0x54e246[_0x2a41('0x30')][_0x2a41('0x32')]?_0x54e246[_0x2a41('0x30')]:_0x5bf499['model'];if(!_0x4de2c0['query'][_0x2a41('0x3e')]('nolimit')){_0x54e246[_0x2a41('0x16')]=qs[_0x2a41('0x16')](_0x4de2c0[_0x2a41('0x26')]['limit']);_0x54e246['offset']=qs[_0x2a41('0x15')](_0x4de2c0[_0x2a41('0x26')][_0x2a41('0x15')]);}_0x54e246[_0x2a41('0x3f')]=qs['sort'](_0x4de2c0['query'][_0x2a41('0x40')]);_0x54e246['where']=qs['filters'](_[_0x2a41('0x41')](_0x4de2c0[_0x2a41('0x26')],_0x5bf499[_0x2a41('0x2e')]));_0x54e246[_0x2a41('0x42')][_0x2a41('0x43')]=_0x2d8045['id'];if(_0x4de2c0['query'][_0x2a41('0x44')]){_0x54e246['where']=_['merge'](_0x54e246['where'],{'$or':_['map'](_0x54e246[_0x2a41('0x30')],function(_0x2e6ce7){var _0xfc1f96={};_0xfc1f96[_0x2e6ce7]={'$like':'%'+_0x4de2c0[_0x2a41('0x26')]['filter']+'%'};return _0xfc1f96;})});}if(_0x4de2c0[_0x2a41('0x26')][_0x2a41('0x45')]){var _0x23ace9=_0x4de2c0[_0x2a41('0x26')][_0x2a41('0x45')]['split'](',');var _0x231ab5={};_0x231ab5[_0x23ace9[0x0]]={'$gte':moment(_0x23ace9[0x1])['format'](_0x2a41('0x46'))};_0x54e246['where']=_['merge'](_0x54e246['where'],_0x231ab5);}_0x54e246=_[_0x2a41('0x34')]({},_0x54e246,_0x4de2c0[_0x2a41('0x35')]);return db[_0x2a41('0x3c')]['count']({'where':_0x54e246[_0x2a41('0x42')]})[_0x2a41('0x1b')](function(_0x1f7f02){_0x209d7a[_0x2a41('0x18')]=_0x1f7f02;if(_0x4de2c0['query'][_0x2a41('0x47')]){_0x54e246[_0x2a41('0x33')]=[{'all':!![]}];}return db[_0x2a41('0x3c')]['findAll'](_0x54e246);})['then'](function(_0x2c98ee){_0x209d7a[_0x2a41('0x48')]=_0x2c98ee;return _0x209d7a;});}})[_0x2a41('0x1b')](respondWithFilteredResult(_0xd2c6aa,_0x54e246))[_0x2a41('0x28')](handleError(_0xd2c6aa,null));};exports['addTags']=function(_0x1b3a4f,_0x9733d3){return db[_0x2a41('0x36')][_0x2a41('0x37')]({'where':{'id':_0x1b3a4f['params']['id']}})['then'](handleEntityNotFound(_0x9733d3,null))[_0x2a41('0x1b')](function(_0xe54f74){if(_0xe54f74){return _0xe54f74[_0x2a41('0x49')](_0x1b3a4f[_0x2a41('0x39')][_0x2a41('0x3d')],_['omit'](_0x1b3a4f[_0x2a41('0x39')],['ids','id'])||{})['spread'](function(){return db[_0x2a41('0x4a')][_0x2a41('0x24')]({'attributes':['id',_0x2a41('0x20'),_0x2a41('0x4b')],'where':{'id':_0x1b3a4f[_0x2a41('0x39')]['ids']}});})['then'](function(_0x81334d){socket[_0x2a41('0x4c')](_0x2a41('0x4d'),{'id':Number(_0x1b3a4f['params']['id']),'tags':_0x81334d||[]});return{'id':Number(_0x1b3a4f[_0x2a41('0x2a')]['id']),'tags':_0x81334d||[]};});}})[_0x2a41('0x1b')](respondWithResult(_0x9733d3,null))['catch'](handleError(_0x9733d3,null));};exports['removeTags']=function(_0x351040,_0x1caa7a){return db[_0x2a41('0x36')][_0x2a41('0x37')]({'where':{'id':_0x351040[_0x2a41('0x2a')]['id']}})[_0x2a41('0x1b')](handleEntityNotFound(_0x1caa7a,null))[_0x2a41('0x1b')](function(_0x3fb990){if(_0x3fb990){return _0x3fb990['removeTags'](_0x351040[_0x2a41('0x26')][_0x2a41('0x3d')]);}})[_0x2a41('0x1b')](respondWithStatusCode(_0x1caa7a,null))['catch'](handleError(_0x1caa7a,null));};exports[_0x2a41('0x4e')]=function(_0x5c90eb,_0x27cc8b){var _0x1ae315=moment()[_0x2a41('0x4f')]()[_0x2a41('0x50')]();var _0x2b34e5=path[_0x2a41('0x51')](config[_0x2a41('0x52')],_0x2a41('0x53'),_0x2a41('0x54'),'tmp');var _0x53f3ba=path[_0x2a41('0x51')](_0x2b34e5,_0x1ae315);var _0x1d022a=util[_0x2a41('0x55')](_0x2a41('0x56'),_0x5c90eb[_0x2a41('0x2a')]['id'],_0x1ae315);var _0x42f4e5=path[_0x2a41('0x51')](_0x2b34e5,_0x1d022a);var _0x497c75=[];_0x497c75[_0x2a41('0x57')]({'model':db[_0x2a41('0x58')],'as':_0x2a41('0x58'),'attributes':['id','fullname'],'raw':!![]});_0x497c75[_0x2a41('0x57')]({'model':db[_0x2a41('0x59')],'as':'Contact','attributes':['id','firstName',_0x2a41('0x5a')],'raw':!![]});var _0x5ae5cd=[{'model':db[_0x2a41('0x3c')],'as':_0x2a41('0x5b'),'attributes':['id',_0x2a41('0x39'),'createdAt',_0x2a41('0x5c'),_0x2a41('0x5d'),_0x2a41('0x5e')],'include':_0x497c75}];_0x5ae5cd[_0x2a41('0x57')]({'model':db['SmsAccount'],'as':_0x2a41('0x5f'),'attributes':['id','name']});_0x5ae5cd[_0x2a41('0x57')]({'model':db[_0x2a41('0x58')],'as':_0x2a41('0x60'),'attributes':['id',_0x2a41('0x61')]});return db[_0x2a41('0x36')][_0x2a41('0x37')]({'where':{'id':_0x5c90eb[_0x2a41('0x2a')]['id']},'include':_0x5ae5cd})['then'](handleEntityNotFound(_0x27cc8b,null))[_0x2a41('0x1b')](function(_0x5df1ef){if(_0x5df1ef){var _0x5567a7=_0x5df1ef[_0x2a41('0x62')]({'plain':!![]});fs['mkdirSync'](_0x53f3ba);var _0x2d9415={'channel':_0x2a41('0x63'),'account':_0x5567a7['Account']['name'],'agent':_0x5567a7[_0x2a41('0x60')]?_0x5567a7[_0x2a41('0x60')]['fullname']:_0x2a41('0x64'),'createdAt':moment(_0x5567a7[_0x2a41('0x65')])[_0x2a41('0x55')](_0x2a41('0x46'))['toString'](),'closedAt':_0x5567a7[_0x2a41('0x66')]?moment(_0x5567a7[_0x2a41('0x67')])[_0x2a41('0x55')](_0x2a41('0x46'))[_0x2a41('0x50')]():'','disposition':_0x5567a7['disposition'],'messages':_(_0x5567a7[_0x2a41('0x5b')])['filter']({'secret':![]})['map'](function(_0x161ae2){return{'date':moment(_0x161ae2[_0x2a41('0x65')])[_0x2a41('0x55')](_0x2a41('0x46'))['toString'](),'sender':_0x161ae2['direction']===_0x2a41('0x68')?_0x161ae2[_0x2a41('0x58')]?_0x161ae2[_0x2a41('0x58')][_0x2a41('0x61')]:_0x2a41('0x69'):_0x161ae2['Contact']['firstName']+(_0x161ae2[_0x2a41('0x6a')][_0x2a41('0x5a')]?'\x20'+_0x161ae2[_0x2a41('0x6a')]['lastName']:''),'body':_0x161ae2[_0x2a41('0x39')],'direction':_0x161ae2['direction']===_0x2a41('0x68')?'A':'C','secret':_0x161ae2[_0x2a41('0x5d')],'read':_0x161ae2['read']};})[_0x2a41('0x6b')]()};return ejs['renderFile'](path[_0x2a41('0x51')](config[_0x2a41('0x52')],_0x2a41('0x53'),_0x2a41('0x6c'),'downloadInteraction.ejs'),{'interaction':_0x2d9415})[_0x2a41('0x1b')](function(_0x3688f2){var _0x4f73fc=path[_0x2a41('0x51')](_0x53f3ba,_0x2a41('0x6d')+_0x5567a7['id']+'-'+_0x1ae315+_0x2a41('0x6e'));var _0x10d138={'path':_0x4f73fc,'channel':_0x2a41('0x63'),'interactionId':_0x5567a7['id']};return pdf[_0x2a41('0x6f')](_0x3688f2,_0x10d138);})['then'](function(){return new BPromise(function(_0x343bc4,_0x451e21){zipdir(_0x53f3ba,{'saveTo':_0x42f4e5},function(_0x273a6c,_0xc3049c){if(_0x273a6c)return _0x451e21(_0x273a6c);return _0x343bc4(_0xc3049c);});})[_0x2a41('0x1b')](function(){return new BPromise(function(_0x60bce9,_0x166b1d){rimraf(_0x53f3ba,function(_0x5e3d8b){if(_0x5e3d8b)_0x166b1d(_0x5e3d8b);return _0x60bce9();});});})['then'](function(){return _0x27cc8b[_0x2a41('0x4e')](_0x42f4e5,_0x1d022a,function(_0x215012){if(_0x215012){console['log'](_0x2a41('0x70'),_0x215012);}else{fs['unlinkSync'](_0x42f4e5);}});});});}else{return _0x27cc8b[_0x2a41('0x12')](0xc8);}})['catch'](handleError(_0x27cc8b,null));}; \ No newline at end of file +var _0x9a16=['findAll','sms','query','user','catch','show','model','SmsInteraction','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','params','find','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','removeTags','unix','join','root','files','tmp','transcript-%d-%s.zip','User','fullname','push','CmContact','firstName','lastName','direction','secret','read','SmsAccount','Account','get','mkdirSync','Sms','Owner','createdAt','toString','disposition','Messages','filter','out','System','Contact','renderFile','server','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','zip-dir','bluebird','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','update','destroy','then','end','error','stack','name','index','map','rawAttributes','fieldName','key','getOptions'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0x9a16,0xcd));var _0x69a1=function(_0x5d2d6d,_0x3ac276){_0x5d2d6d=_0x5d2d6d-0x0;var _0x10d67b=_0x9a16[_0x5d2d6d];return _0x10d67b;};'use strict';var rimraf=require(_0x69a1('0x0'));var zipdir=require(_0x69a1('0x1'));var moment=require('moment');var BPromise=require(_0x69a1('0x2'));var util=require(_0x69a1('0x3'));var path=require(_0x69a1('0x4'));var ejs=require(_0x69a1('0x5'));var fs=require('fs');var _=require(_0x69a1('0x6'));var Redis=require('ioredis');var interaction=require(_0x69a1('0x7'));var qs=require(_0x69a1('0x8'));var pdf=require(_0x69a1('0x9'));var logger=require(_0x69a1('0xa'))(_0x69a1('0xb'));var config=require(_0x69a1('0xc'));var db=require(_0x69a1('0xd'))['db'];config[_0x69a1('0xe')]=_[_0x69a1('0xf')](config['redis'],{'host':_0x69a1('0x10'),'port':0x18eb});var socket=require(_0x69a1('0x11'))(new Redis(config[_0x69a1('0xe')]));require('./smsInteraction.socket')[_0x69a1('0x12')](socket);function respondWithStatusCode(_0x466cb4,_0x551f2d){_0x551f2d=_0x551f2d||0xcc;return function(_0x229da1){if(_0x229da1){return _0x466cb4[_0x69a1('0x13')](_0x551f2d);}return _0x466cb4[_0x69a1('0x14')](_0x551f2d)['end']();};}function respondWithResult(_0x4a7e20,_0x314de7){_0x314de7=_0x314de7||0xc8;return function(_0x5da634){if(_0x5da634){return _0x4a7e20[_0x69a1('0x14')](_0x314de7)[_0x69a1('0x15')](_0x5da634);}};}function respondWithFilteredResult(_0x81faa2,_0x4dc183){return function(_0x5f1c15){if(_0x5f1c15){var _0x203663=typeof _0x4dc183[_0x69a1('0x16')]===_0x69a1('0x17')&&typeof _0x4dc183[_0x69a1('0x18')]===_0x69a1('0x17');var _0x218240=_0x5f1c15['count'];var _0x14b4ef=_0x203663?0x0:_0x4dc183['offset'];var _0x1089e3=_0x203663?_0x5f1c15[_0x69a1('0x19')]:_0x4dc183[_0x69a1('0x16')]+_0x4dc183['limit'];var _0x1d203f;if(_0x1089e3>=_0x218240){_0x1089e3=_0x218240;_0x1d203f=0xc8;}else{_0x1d203f=0xce;}_0x81faa2[_0x69a1('0x14')](_0x1d203f);return _0x81faa2['set']('Content-Range',_0x14b4ef+'-'+_0x1089e3+'/'+_0x218240)[_0x69a1('0x15')](_0x5f1c15);}return null;};}function saveUpdates(_0x531c1f){return function(_0x54b12e){if(_0x54b12e){return _0x54b12e[_0x69a1('0x1a')](_0x531c1f)['then'](function(_0x1c9e37){return _0x1c9e37;});}return null;};}function removeEntity(_0x5349ac){return function(_0x265bda){if(_0x265bda){return _0x265bda[_0x69a1('0x1b')]()[_0x69a1('0x1c')](function(){_0x5349ac[_0x69a1('0x14')](0xcc)[_0x69a1('0x1d')]();});}};}function handleEntityNotFound(_0x4c75ae){return function(_0xce292f){if(!_0xce292f){_0x4c75ae[_0x69a1('0x13')](0x194);}return _0xce292f;};}function handleError(_0x547bbb,_0x42c04f){_0x42c04f=_0x42c04f||0x1f4;return function(_0x25f63f){logger[_0x69a1('0x1e')](_0x25f63f[_0x69a1('0x1f')]);if(_0x25f63f[_0x69a1('0x20')]){delete _0x25f63f['name'];}_0x547bbb[_0x69a1('0x14')](_0x42c04f)['send'](_0x25f63f);};}exports[_0x69a1('0x21')]=function(_0x5a24f8,_0x45c5bd){var _0x15bf0e={};var _0x271df8=_[_0x69a1('0x22')](db['SmsInteraction'][_0x69a1('0x23')],function(_0x5c6b08){return{'name':_0x5c6b08[_0x69a1('0x24')],'type':_0x5c6b08['type'][_0x69a1('0x25')]};});_0x15bf0e=qs[_0x69a1('0x26')](_0x271df8,_0x5a24f8);return interaction[_0x69a1('0x27')](_0x69a1('0x28'),_0x5a24f8[_0x69a1('0x29')],_0x5a24f8[_0x69a1('0x2a')],_0x15bf0e,_0x271df8)['then'](respondWithFilteredResult(_0x45c5bd,_0x15bf0e))[_0x69a1('0x2b')](handleError(_0x45c5bd,null));};exports[_0x69a1('0x2c')]=function(_0x5b0b7a,_0x14aced){var _0x3b8020={'raw':![],'where':{'id':_0x5b0b7a['params']['id']}},_0xf268f7={};_0xf268f7[_0x69a1('0x2d')]=_['keys'](db[_0x69a1('0x2e')][_0x69a1('0x23')]);_0xf268f7[_0x69a1('0x29')]=_[_0x69a1('0x2f')](_0x5b0b7a[_0x69a1('0x29')]);_0xf268f7[_0x69a1('0x30')]=_[_0x69a1('0x31')](_0xf268f7[_0x69a1('0x2d')],_0xf268f7[_0x69a1('0x29')]);_0x3b8020[_0x69a1('0x32')]=_[_0x69a1('0x31')](_0xf268f7[_0x69a1('0x2d')],qs['fields'](_0x5b0b7a[_0x69a1('0x29')][_0x69a1('0x33')]));_0x3b8020[_0x69a1('0x32')]=_0x3b8020[_0x69a1('0x32')][_0x69a1('0x34')]?_0x3b8020[_0x69a1('0x32')]:_0xf268f7['model'];if(_0x5b0b7a['query'][_0x69a1('0x35')]){_0x3b8020[_0x69a1('0x36')]=[{'all':!![]}];}_0x3b8020=_[_0x69a1('0x37')]({},_0x3b8020,_0x5b0b7a[_0x69a1('0x38')]);return db['SmsInteraction']['find'](_0x3b8020)[_0x69a1('0x1c')](handleEntityNotFound(_0x14aced,null))['then'](respondWithResult(_0x14aced,null))[_0x69a1('0x2b')](handleError(_0x14aced,null));};exports['create']=function(_0x2d4843,_0xe829d5){return db[_0x69a1('0x2e')][_0x69a1('0x39')](_0x2d4843['body'],{})[_0x69a1('0x1c')](respondWithResult(_0xe829d5,0xc9))[_0x69a1('0x2b')](handleError(_0xe829d5,null));};exports[_0x69a1('0x1a')]=function(_0x22e03c,_0x3f4e0a){if(_0x22e03c[_0x69a1('0x3a')]['id']){delete _0x22e03c['body']['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x22e03c[_0x69a1('0x3b')]['id']}})[_0x69a1('0x1c')](handleEntityNotFound(_0x3f4e0a,null))[_0x69a1('0x1c')](saveUpdates(_0x22e03c[_0x69a1('0x3a')],null))['then'](respondWithResult(_0x3f4e0a,null))['catch'](handleError(_0x3f4e0a,null));};exports['destroy']=function(_0x2b6b1a,_0x4f308c){return db['SmsInteraction'][_0x69a1('0x3c')]({'where':{'id':_0x2b6b1a[_0x69a1('0x3b')]['id']}})[_0x69a1('0x1c')](handleEntityNotFound(_0x4f308c,null))[_0x69a1('0x1c')](removeEntity(_0x4f308c,null))['catch'](handleError(_0x4f308c,null));};exports[_0x69a1('0x3d')]=function(_0x52a867,_0x299bd5){return db['SmsInteraction'][_0x69a1('0x3d')]()[_0x69a1('0x1c')](respondWithResult(_0x299bd5,null))[_0x69a1('0x2b')](handleError(_0x299bd5,null));};exports[_0x69a1('0x3e')]=function(_0x46eff5,_0x26c94d){return db[_0x69a1('0x3f')][_0x69a1('0x3c')]({'where':{'id':_0x46eff5[_0x69a1('0x3b')]['id']}})['then'](handleEntityNotFound(_0x26c94d,null))[_0x69a1('0x1c')](function(_0x580f3e){if(_0x580f3e){return _0x580f3e[_0x69a1('0x3e')](_0x46eff5['body'][_0x69a1('0x40')],_[_0x69a1('0x41')](_0x46eff5[_0x69a1('0x3a')],[_0x69a1('0x40'),'id'])||{});}})[_0x69a1('0x1c')](respondWithResult(_0x26c94d,null))[_0x69a1('0x2b')](handleError(_0x26c94d,null));};exports[_0x69a1('0x42')]=function(_0x2f4bcd,_0x26f368){var _0x3ccc30={'raw':![],'where':{}};var _0x1eb4d0={};var _0x156061={'count':0x0,'rows':[]};return db[_0x69a1('0x2e')][_0x69a1('0x43')]({'where':{'id':_0x2f4bcd[_0x69a1('0x3b')]['id']}})['then'](handleEntityNotFound(_0x26f368,null))['then'](function(_0x55c29d){if(_0x55c29d){_0x1eb4d0[_0x69a1('0x2d')]=_[_0x69a1('0x2f')](db[_0x69a1('0x3f')]['rawAttributes']);_0x1eb4d0[_0x69a1('0x29')]=_[_0x69a1('0x2f')](_0x2f4bcd['query']);_0x1eb4d0[_0x69a1('0x30')]=_['intersection'](_0x1eb4d0['model'],_0x1eb4d0[_0x69a1('0x29')]);_0x3ccc30[_0x69a1('0x32')]=_[_0x69a1('0x31')](_0x1eb4d0[_0x69a1('0x2d')],qs['fields'](_0x2f4bcd[_0x69a1('0x29')][_0x69a1('0x33')]));_0x3ccc30[_0x69a1('0x32')]=_0x3ccc30[_0x69a1('0x32')][_0x69a1('0x34')]?_0x3ccc30['attributes']:_0x1eb4d0[_0x69a1('0x2d')];if(!_0x2f4bcd['query'][_0x69a1('0x44')](_0x69a1('0x45'))){_0x3ccc30['limit']=qs[_0x69a1('0x18')](_0x2f4bcd['query'][_0x69a1('0x18')]);_0x3ccc30[_0x69a1('0x16')]=qs[_0x69a1('0x16')](_0x2f4bcd['query'][_0x69a1('0x16')]);}_0x3ccc30[_0x69a1('0x46')]=qs['sort'](_0x2f4bcd[_0x69a1('0x29')][_0x69a1('0x47')]);_0x3ccc30[_0x69a1('0x48')]=qs[_0x69a1('0x30')](_[_0x69a1('0x49')](_0x2f4bcd[_0x69a1('0x29')],_0x1eb4d0[_0x69a1('0x30')]));_0x3ccc30[_0x69a1('0x48')][_0x69a1('0x4a')]=_0x55c29d['id'];if(_0x2f4bcd[_0x69a1('0x29')]['filter']){_0x3ccc30[_0x69a1('0x48')]=_[_0x69a1('0x37')](_0x3ccc30['where'],{'$or':_[_0x69a1('0x22')](_0x3ccc30[_0x69a1('0x32')],function(_0x4f63d8){var _0x39b00c={};_0x39b00c[_0x4f63d8]={'$like':'%'+_0x2f4bcd[_0x69a1('0x29')]['filter']+'%'};return _0x39b00c;})});}if(_0x2f4bcd[_0x69a1('0x29')]['$gte']){var _0x5c1e40=_0x2f4bcd[_0x69a1('0x29')][_0x69a1('0x4b')]['split'](',');var _0x14a376={};_0x14a376[_0x5c1e40[0x0]]={'$gte':moment(_0x5c1e40[0x1])[_0x69a1('0x4c')](_0x69a1('0x4d'))};_0x3ccc30['where']=_[_0x69a1('0x37')](_0x3ccc30[_0x69a1('0x48')],_0x14a376);}_0x3ccc30=_[_0x69a1('0x37')]({},_0x3ccc30,_0x2f4bcd['options']);return db[_0x69a1('0x3f')][_0x69a1('0x19')]({'where':_0x3ccc30[_0x69a1('0x48')]})[_0x69a1('0x1c')](function(_0x245bb4){_0x156061[_0x69a1('0x19')]=_0x245bb4;if(_0x2f4bcd[_0x69a1('0x29')][_0x69a1('0x35')]){_0x3ccc30[_0x69a1('0x36')]=[{'all':!![]}];}return db[_0x69a1('0x3f')][_0x69a1('0x27')](_0x3ccc30);})['then'](function(_0x480a77){_0x156061[_0x69a1('0x4e')]=_0x480a77;return _0x156061;});}})[_0x69a1('0x1c')](respondWithFilteredResult(_0x26f368,_0x3ccc30))['catch'](handleError(_0x26f368,null));};exports[_0x69a1('0x4f')]=function(_0x55caa5,_0x446847){return db[_0x69a1('0x2e')]['find']({'where':{'id':_0x55caa5[_0x69a1('0x3b')]['id']}})[_0x69a1('0x1c')](handleEntityNotFound(_0x446847,null))[_0x69a1('0x1c')](function(_0x3d71fb){if(_0x3d71fb){return _0x3d71fb[_0x69a1('0x50')](_0x55caa5[_0x69a1('0x3a')][_0x69a1('0x40')],_[_0x69a1('0x41')](_0x55caa5[_0x69a1('0x3a')],[_0x69a1('0x40'),'id'])||{})[_0x69a1('0x51')](function(){return db[_0x69a1('0x52')][_0x69a1('0x27')]({'attributes':['id',_0x69a1('0x20'),_0x69a1('0x53')],'where':{'id':_0x55caa5[_0x69a1('0x3a')][_0x69a1('0x40')]}});})[_0x69a1('0x1c')](function(_0x5a9401){socket['emit']('smsInteractionTags:save',{'id':Number(_0x55caa5[_0x69a1('0x3b')]['id']),'tags':_0x5a9401||[]});return{'id':Number(_0x55caa5['params']['id']),'tags':_0x5a9401||[]};});}})['then'](respondWithResult(_0x446847,null))[_0x69a1('0x2b')](handleError(_0x446847,null));};exports['removeTags']=function(_0x59544f,_0x4aede9){return db['SmsInteraction'][_0x69a1('0x3c')]({'where':{'id':_0x59544f[_0x69a1('0x3b')]['id']}})['then'](handleEntityNotFound(_0x4aede9,null))['then'](function(_0x3a223e){if(_0x3a223e){return _0x3a223e[_0x69a1('0x54')](_0x59544f['query'][_0x69a1('0x40')]);}})[_0x69a1('0x1c')](respondWithStatusCode(_0x4aede9,null))[_0x69a1('0x2b')](handleError(_0x4aede9,null));};exports['download']=function(_0xed89a8,_0x34ac5d){var _0x22d3f9=moment()[_0x69a1('0x55')]()['toString']();var _0x612d14=path[_0x69a1('0x56')](config[_0x69a1('0x57')],'server',_0x69a1('0x58'),_0x69a1('0x59'));var _0x575b76=path[_0x69a1('0x56')](_0x612d14,_0x22d3f9);var _0x517ed0=util['format'](_0x69a1('0x5a'),_0xed89a8[_0x69a1('0x3b')]['id'],_0x22d3f9);var _0x3fa2b2=path[_0x69a1('0x56')](_0x612d14,_0x517ed0);var _0x582c48=[];_0x582c48['push']({'model':db[_0x69a1('0x5b')],'as':_0x69a1('0x5b'),'attributes':['id',_0x69a1('0x5c')],'raw':!![]});_0x582c48[_0x69a1('0x5d')]({'model':db[_0x69a1('0x5e')],'as':'Contact','attributes':['id',_0x69a1('0x5f'),_0x69a1('0x60')],'raw':!![]});var _0x2a9afc=[{'model':db[_0x69a1('0x3f')],'as':'Messages','attributes':['id','body','createdAt',_0x69a1('0x61'),_0x69a1('0x62'),_0x69a1('0x63')],'include':_0x582c48}];_0x2a9afc[_0x69a1('0x5d')]({'model':db[_0x69a1('0x64')],'as':_0x69a1('0x65'),'attributes':['id','name']});_0x2a9afc[_0x69a1('0x5d')]({'model':db['User'],'as':'Owner','attributes':['id',_0x69a1('0x5c')]});return db[_0x69a1('0x2e')][_0x69a1('0x3c')]({'where':{'id':_0xed89a8[_0x69a1('0x3b')]['id']},'include':_0x2a9afc})[_0x69a1('0x1c')](handleEntityNotFound(_0x34ac5d,null))[_0x69a1('0x1c')](function(_0x1f106b){if(_0x1f106b){var _0x2ef7b5=_0x1f106b[_0x69a1('0x66')]({'plain':!![]});fs[_0x69a1('0x67')](_0x575b76);var _0x1e8142={'channel':_0x69a1('0x68'),'account':_0x2ef7b5[_0x69a1('0x65')][_0x69a1('0x20')],'agent':_0x2ef7b5[_0x69a1('0x69')]?_0x2ef7b5['Owner'][_0x69a1('0x5c')]:'N.A.','createdAt':moment(_0x2ef7b5[_0x69a1('0x6a')])[_0x69a1('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0x69a1('0x6b')](),'closedAt':_0x2ef7b5['closed']?moment(_0x2ef7b5['closedAt'])[_0x69a1('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0x69a1('0x6b')]():'','disposition':_0x2ef7b5[_0x69a1('0x6c')],'messages':_(_0x2ef7b5[_0x69a1('0x6d')])[_0x69a1('0x6e')]({'secret':![]})['map'](function(_0x443869){return{'date':moment(_0x443869[_0x69a1('0x6a')])[_0x69a1('0x4c')](_0x69a1('0x4d'))[_0x69a1('0x6b')](),'sender':_0x443869['direction']===_0x69a1('0x6f')?_0x443869[_0x69a1('0x5b')]?_0x443869[_0x69a1('0x5b')][_0x69a1('0x5c')]:_0x69a1('0x70'):_0x443869[_0x69a1('0x71')]['firstName']+(_0x443869[_0x69a1('0x71')][_0x69a1('0x60')]?'\x20'+_0x443869['Contact'][_0x69a1('0x60')]:''),'body':_0x443869['body'],'direction':_0x443869[_0x69a1('0x61')]===_0x69a1('0x6f')?'A':'C','secret':_0x443869[_0x69a1('0x62')],'read':_0x443869[_0x69a1('0x63')]};})['value']()};return ejs[_0x69a1('0x72')](path['join'](config['root'],_0x69a1('0x73'),_0x69a1('0x74'),_0x69a1('0x75')),{'interaction':_0x1e8142})[_0x69a1('0x1c')](function(_0x1de1c0){var _0x4985f=path[_0x69a1('0x56')](_0x575b76,_0x69a1('0x76')+_0x2ef7b5['id']+'-'+_0x22d3f9+_0x69a1('0x77'));var _0x411894={'path':_0x4985f,'channel':_0x69a1('0x68'),'interactionId':_0x2ef7b5['id']};return pdf[_0x69a1('0x78')](_0x1de1c0,_0x411894);})[_0x69a1('0x1c')](function(){return new BPromise(function(_0x485659,_0x540afc){zipdir(_0x575b76,{'saveTo':_0x3fa2b2},function(_0x254679,_0x541c5d){if(_0x254679)return _0x540afc(_0x254679);return _0x485659(_0x541c5d);});})[_0x69a1('0x1c')](function(){return new BPromise(function(_0x42a4c7,_0xd8a454){rimraf(_0x575b76,function(_0x157de3){if(_0x157de3)_0xd8a454(_0x157de3);return _0x42a4c7();});});})[_0x69a1('0x1c')](function(){return _0x34ac5d['download'](_0x3fa2b2,_0x517ed0,function(_0x58c4e3){if(_0x58c4e3){console['log'](_0x69a1('0x79'),_0x58c4e3);}else{fs['unlinkSync'](_0x3fa2b2);}});});});}else{return _0x34ac5d[_0x69a1('0x13')](0xc8);}})['catch'](handleError(_0x34ac5d,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 8ddc0b5..d447d47 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 _0x1399=['setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','Users','findAll'];(function(_0x274482,_0x11c45b){var _0x20a5b7=function(_0x574478){while(--_0x574478){_0x274482['push'](_0x274482['shift']());}};_0x20a5b7(++_0x11c45b);}(_0x1399,0x16c));var _0x9139=function(_0x3a6d3e,_0x4f0ac5){_0x3a6d3e=_0x3a6d3e-0x0;var _0x735896=_0x1399[_0x3a6d3e];return _0x735896;};'use strict';var EventEmitter=require(_0x9139('0x0'));var SmsInteraction=require(_0x9139('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x9139('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x9139('0x2')](0x0);var events={'afterCreate':_0x9139('0x3'),'afterUpdate':_0x9139('0x4'),'afterDestroy':_0x9139('0x5')};function emitEvent(_0x251798){return function(_0x2acb38,_0x5ac80b,_0x54af2d){_0x2acb38[_0x9139('0x6')]({'attributes':['id'],'raw':!![]})[_0x9139('0x7')](function(_0x4d5d1e){_0x2acb38['setDataValue'](_0x9139('0x8'),_0x4d5d1e['map'](function(_0x504ced){return{'id':_0x504ced['id']};}));return SmsMessage[_0x9139('0x9')]({'where':{'SmsInteractionId':_0x2acb38['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9139('0x7')](function(_0x4830cd){_0x2acb38[_0x9139('0xa')](_0x9139('0xb'),_0x4830cd['length']);SmsInteractionEvents['emit'](_0x251798+':'+_0x2acb38['id'],_0x2acb38);SmsInteractionEvents[_0x9139('0xc')](_0x251798,_0x2acb38);_0x54af2d(null);})[_0x9139('0xd')](_0x54af2d(null));};}for(var e in events){if(events[_0x9139('0xe')](e)){var event=events[e];SmsInteraction[_0x9139('0xf')](e,emitEvent(event));}}module[_0x9139('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0x8952=['Users','map','findAll','unreadMessages','catch','hasOwnProperty','hook','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','update','remove','getUsers','setDataValue'];(function(_0x3ceecb,_0xfab64){var _0x996264=function(_0x36d22a){while(--_0x36d22a){_0x3ceecb['push'](_0x3ceecb['shift']());}};_0x996264(++_0xfab64);}(_0x8952,0x17e));var _0x2895=function(_0x53ec97,_0x5caf27){_0x53ec97=_0x53ec97-0x0;var _0x3a078b=_0x8952[_0x53ec97];return _0x3a078b;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x2895('0x0'))['db'][_0x2895('0x1')];var SmsMessage=require(_0x2895('0x0'))['db'][_0x2895('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x2895('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2895('0x4'),'afterDestroy':_0x2895('0x5')};function emitEvent(_0x1f69f6){return function(_0x5b28c6,_0x32429c,_0x73c245){_0x5b28c6[_0x2895('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x526c32){_0x5b28c6[_0x2895('0x7')](_0x2895('0x8'),_0x526c32[_0x2895('0x9')](function(_0x294446){return{'id':_0x294446['id']};}));return SmsMessage[_0x2895('0xa')]({'where':{'SmsInteractionId':_0x5b28c6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x14fb67){_0x5b28c6['setDataValue'](_0x2895('0xb'),_0x14fb67['length']);SmsInteractionEvents['emit'](_0x1f69f6+':'+_0x5b28c6['id'],_0x5b28c6);SmsInteractionEvents['emit'](_0x1f69f6,_0x5b28c6);_0x73c245(null);})[_0x2895('0xc')](_0x73c245(null));};}for(var e in events){if(events[_0x2895('0xd')](e)){var event=events[e];SmsInteraction[_0x2895('0xe')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 73db1bc..974e326 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 _0x362e=['format','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','closedAt'];(function(_0x3ec501,_0x1d035a){var _0x5a3037=function(_0x383d66){while(--_0x383d66){_0x3ec501['push'](_0x3ec501['shift']());}};_0x5a3037(++_0x1d035a);}(_0x362e,0x100));var _0xe362=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x362e[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xe362('0x0'));var util=require(_0xe362('0x1'));var logger=require(_0xe362('0x2'))(_0xe362('0x3'));var moment=require(_0xe362('0x4'));var BPromise=require(_0xe362('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe362('0x6'));var rimraf=require(_0xe362('0x7'));var config=require(_0xe362('0x8'));var attributes=require(_0xe362('0x9'));module[_0xe362('0xa')]=function(_0x46a747,_0x2ae59e){return _0x46a747[_0xe362('0xb')](_0xe362('0xc'),attributes,{'tableName':_0xe362('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49bb4d,_0x5c2ce,_0x4de42c){if(_0x49bb4d['changed'](_0xe362('0xe'))){_0x49bb4d[_0xe362('0xf')]=moment()[_0xe362('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4de42c(null,_0x49bb4d);}}});}; \ No newline at end of file +var _0x9df8=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','path','exports','define','SmsInteraction','changed','closed','closedAt','format'];(function(_0x54a424,_0x5dc39c){var _0x52c682=function(_0x2b46e3){while(--_0x2b46e3){_0x54a424['push'](_0x54a424['shift']());}};_0x52c682(++_0x5dc39c);}(_0x9df8,0xd3));var _0x89df=function(_0x28bf7e,_0x2f4fd2){_0x28bf7e=_0x28bf7e-0x0;var _0x4d55bc=_0x9df8[_0x28bf7e];return _0x4d55bc;};'use strict';var _=require(_0x89df('0x0'));var util=require(_0x89df('0x1'));var logger=require(_0x89df('0x2'))(_0x89df('0x3'));var moment=require('moment');var BPromise=require(_0x89df('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x89df('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0x89df('0x6')]=function(_0x2a3954,_0x410c1e){return _0x2a3954[_0x89df('0x7')](_0x89df('0x8'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x319573,_0x2957d2,_0x524abf){if(_0x319573[_0x89df('0x9')](_0x89df('0xa'))){_0x319573[_0x89df('0xb')]=moment()[_0x89df('0xc')](_0x89df('0xd'));}_0x524abf(null,_0x319573);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 07b66d0..bda5f64 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 _0x1b64=['raw','where','attributes','limit','AddTagsToSmsInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','options'];(function(_0x55e1d1,_0x3c9376){var _0x1165db=function(_0x5b0120){while(--_0x5b0120){_0x55e1d1['push'](_0x55e1d1['shift']());}};_0x1165db(++_0x3c9376);}(_0x1b64,0x1ae));var _0x41b6=function(_0x28c258,_0x380331){_0x28c258=_0x28c258-0x0;var _0x205bcf=_0x1b64[_0x28c258];return _0x205bcf;};'use strict';var _=require(_0x41b6('0x0'));var util=require(_0x41b6('0x1'));var moment=require(_0x41b6('0x2'));var BPromise=require(_0x41b6('0x3'));var rs=require(_0x41b6('0x4'));var fs=require('fs');var Redis=require(_0x41b6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x41b6('0x6'));var logger=require('../../config/logger')(_0x41b6('0x7'));var config=require(_0x41b6('0x8'));var jayson=require(_0x41b6('0x9'));var client=jayson[_0x41b6('0xa')][_0x41b6('0xb')]({'port':0x232a});config['redis']=_[_0x41b6('0xc')](config[_0x41b6('0xd')],{'host':_0x41b6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x41b6('0xd')]));require(_0x41b6('0xf'))[_0x41b6('0x10')](socket);function respondWithRpcPromise(_0x322235,_0x5a1260,_0x380b6a){return new BPromise(function(_0x28948c,_0x264419){return client['request'](_0x322235,_0x380b6a)[_0x41b6('0x11')](function(_0x83e8b){logger[_0x41b6('0x12')](_0x41b6('0x13'),_0x5a1260,_0x41b6('0x14'));logger[_0x41b6('0x15')](_0x41b6('0x16'),_0x5a1260,'request\x20sent',JSON[_0x41b6('0x17')](_0x83e8b));if(_0x83e8b['error']){if(_0x83e8b[_0x41b6('0x18')]['code']===0x1f4){logger[_0x41b6('0x18')](_0x41b6('0x13'),_0x5a1260,_0x83e8b['error']['message']);return _0x264419(_0x83e8b[_0x41b6('0x18')][_0x41b6('0x19')]);}logger[_0x41b6('0x18')](_0x41b6('0x13'),_0x5a1260,_0x83e8b[_0x41b6('0x18')][_0x41b6('0x19')]);return _0x28948c(_0x83e8b[_0x41b6('0x18')]['message']);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x5a1260,'request\x20sent');_0x28948c(_0x83e8b['result'][_0x41b6('0x19')]);}})[_0x41b6('0x1a')](function(_0x49f7f0){logger[_0x41b6('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x5a1260,_0x49f7f0);_0x264419(_0x49f7f0);});});}exports[_0x41b6('0x1b')]=function(_0x3a1bb0){var _0x4f9625=this;return new Promise(function(_0x3079c7,_0x11a0ef){return db[_0x41b6('0x1c')][_0x41b6('0x1d')](_0x3a1bb0[_0x41b6('0x1e')],{'raw':_0x3a1bb0[_0x41b6('0x1f')]?_0x3a1bb0[_0x41b6('0x1f')][_0x41b6('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a1bb0[_0x41b6('0x1f')]?_0x3a1bb0['options'][_0x41b6('0x21')]||null:null,'attributes':_0x3a1bb0['options']?_0x3a1bb0[_0x41b6('0x1f')][_0x41b6('0x22')]||null:null,'limit':_0x3a1bb0[_0x41b6('0x1f')]?_0x3a1bb0['options'][_0x41b6('0x23')]||null:null})[_0x41b6('0x11')](function(_0x57cff1){logger[_0x41b6('0x12')](_0x41b6('0x1b'),_0x3a1bb0);logger[_0x41b6('0x15')](_0x41b6('0x1b'),_0x3a1bb0,JSON[_0x41b6('0x17')](_0x57cff1));_0x3079c7(_0x57cff1);})['catch'](function(_0x2bf3d7){logger[_0x41b6('0x18')](_0x41b6('0x1b'),_0x2bf3d7['message'],_0x3a1bb0);_0x11a0ef(_0x4f9625[_0x41b6('0x18')](0x1f4,_0x2bf3d7['message']));});});};exports[_0x41b6('0x24')]=function(_0x41d72a){return new Promise(function(_0x29a471,_0x30fa86){return db['SmsInteraction'][_0x41b6('0x25')]({'where':_0x41d72a[_0x41b6('0x1f')]?_0x41d72a['options']['where']||null:null})[_0x41b6('0x11')](function(_0x445cae){if(_0x445cae){return _0x445cae['addTags'](_0x41d72a[_0x41b6('0x1e')][_0x41b6('0x26')],_[_0x41b6('0x27')](_0x41d72a[_0x41b6('0x1e')],[_0x41b6('0x26'),'id'])||{});}})[_0x41b6('0x28')](function(_0x2b3eb6){logger[_0x41b6('0x12')](_0x41b6('0x29'),_0x41d72a);logger['debug'](_0x41b6('0x29'),_0x41d72a,JSON[_0x41b6('0x17')](_0x2b3eb6));_0x29a471(_0x2b3eb6);})[_0x41b6('0x1a')](function(_0x4ba80a){logger[_0x41b6('0x18')]('AddTags',_0x4ba80a[_0x41b6('0x19')],_0x41d72a);_0x30fa86(_this[_0x41b6('0x18')](0x1f4,_0x4ba80a[_0x41b6('0x19')]));});});}; \ No newline at end of file +var _0x9f1d=['options','raw','attributes','limit','then','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./smsInteraction.socket','request','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','catch','UpdateSmsInteraction','SmsInteraction','update'];(function(_0x573cbf,_0x37ad1a){var _0x37754f=function(_0x279a7a){while(--_0x279a7a){_0x573cbf['push'](_0x573cbf['shift']());}};_0x37754f(++_0x37ad1a);}(_0x9f1d,0x17d));var _0xd9f1=function(_0x28b894,_0x1f9180){_0x28b894=_0x28b894-0x0;var _0x9fa2e5=_0x9f1d[_0x28b894];return _0x9fa2e5;};'use strict';var _=require(_0xd9f1('0x0'));var util=require(_0xd9f1('0x1'));var moment=require(_0xd9f1('0x2'));var BPromise=require(_0xd9f1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9f1('0x4'));var db=require(_0xd9f1('0x5'))['db'];var utils=require(_0xd9f1('0x6'));var logger=require(_0xd9f1('0x7'))(_0xd9f1('0x8'));var config=require(_0xd9f1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd9f1('0xa')][_0xd9f1('0xb')]({'port':0x232a});config[_0xd9f1('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd9f1('0xd'))(new Redis(config[_0xd9f1('0xc')]));require(_0xd9f1('0xe'))['register'](socket);function respondWithRpcPromise(_0x77ffdb,_0x616a1e,_0x20f3d6){return new BPromise(function(_0x1c0621,_0x126ff7){return client[_0xd9f1('0xf')](_0x77ffdb,_0x20f3d6)['then'](function(_0x512db4){logger[_0xd9f1('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x616a1e,_0xd9f1('0x11'));logger[_0xd9f1('0x12')](_0xd9f1('0x13'),_0x616a1e,_0xd9f1('0x11'),JSON[_0xd9f1('0x14')](_0x512db4));if(_0x512db4[_0xd9f1('0x15')]){if(_0x512db4[_0xd9f1('0x15')][_0xd9f1('0x16')]===0x1f4){logger[_0xd9f1('0x15')](_0xd9f1('0x17'),_0x616a1e,_0x512db4[_0xd9f1('0x15')][_0xd9f1('0x18')]);return _0x126ff7(_0x512db4[_0xd9f1('0x15')][_0xd9f1('0x18')]);}logger[_0xd9f1('0x15')](_0xd9f1('0x17'),_0x616a1e,_0x512db4[_0xd9f1('0x15')][_0xd9f1('0x18')]);return _0x1c0621(_0x512db4[_0xd9f1('0x15')][_0xd9f1('0x18')]);}else{logger[_0xd9f1('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x616a1e,_0xd9f1('0x11'));_0x1c0621(_0x512db4['result'][_0xd9f1('0x18')]);}})[_0xd9f1('0x19')](function(_0x301170){logger[_0xd9f1('0x15')](_0xd9f1('0x17'),_0x616a1e,_0x301170);_0x126ff7(_0x301170);});});}exports[_0xd9f1('0x1a')]=function(_0x7b525){var _0x114736=this;return new Promise(function(_0x13561e,_0x3dff12){return db[_0xd9f1('0x1b')][_0xd9f1('0x1c')](_0x7b525['body'],{'raw':_0x7b525[_0xd9f1('0x1d')]?_0x7b525['options'][_0xd9f1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7b525[_0xd9f1('0x1d')]?_0x7b525[_0xd9f1('0x1d')]['where']||null:null,'attributes':_0x7b525[_0xd9f1('0x1d')]?_0x7b525[_0xd9f1('0x1d')][_0xd9f1('0x1f')]||null:null,'limit':_0x7b525[_0xd9f1('0x1d')]?_0x7b525['options'][_0xd9f1('0x20')]||null:null})[_0xd9f1('0x21')](function(_0x3dc638){logger[_0xd9f1('0x10')]('UpdateSmsInteraction',_0x7b525);logger[_0xd9f1('0x12')](_0xd9f1('0x1a'),_0x7b525,JSON[_0xd9f1('0x14')](_0x3dc638));_0x13561e(_0x3dc638);})[_0xd9f1('0x19')](function(_0xc0500c){logger[_0xd9f1('0x15')]('UpdateSmsInteraction',_0xc0500c[_0xd9f1('0x18')],_0x7b525);_0x3dff12(_0x114736[_0xd9f1('0x15')](0x1f4,_0xc0500c[_0xd9f1('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x1d9af1){return new Promise(function(_0x44f8b5,_0x2eef82){return db['SmsInteraction'][_0xd9f1('0x22')]({'where':_0x1d9af1[_0xd9f1('0x1d')]?_0x1d9af1[_0xd9f1('0x1d')]['where']||null:null})[_0xd9f1('0x21')](function(_0x49b422){if(_0x49b422){return _0x49b422[_0xd9f1('0x23')](_0x1d9af1[_0xd9f1('0x24')][_0xd9f1('0x25')],_[_0xd9f1('0x26')](_0x1d9af1[_0xd9f1('0x24')],[_0xd9f1('0x25'),'id'])||{});}})[_0xd9f1('0x27')](function(_0x53ba60){logger[_0xd9f1('0x10')](_0xd9f1('0x28'),_0x1d9af1);logger[_0xd9f1('0x12')](_0xd9f1('0x28'),_0x1d9af1,JSON[_0xd9f1('0x14')](_0x53ba60));_0x44f8b5(_0x53ba60);})[_0xd9f1('0x19')](function(_0x35260e){logger[_0xd9f1('0x15')](_0xd9f1('0x28'),_0x35260e[_0xd9f1('0x18')],_0x1d9af1);_0x2eef82(_this['error'](0x1f4,_0x35260e[_0xd9f1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index c02057e..00d58a1 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 _0x5348=['update','removeListener','register','./smsInteraction.events','save','remove'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5348,0x1dd));var _0x8534=function(_0x3d3545,_0x6b0e73){_0x3d3545=_0x3d3545-0x0;var _0x50d7d9=_0x5348[_0x3d3545];return _0x50d7d9;};'use strict';var SmsInteractionEvents=require(_0x8534('0x0'));var events=[_0x8534('0x1'),_0x8534('0x2'),_0x8534('0x3')];function createListener(_0x4c404b,_0x444d6d){return function(_0xab540d){_0x444d6d['emit'](_0x4c404b,_0xab540d);};}function removeListener(_0x3a951f,_0x4491be){return function(){SmsInteractionEvents[_0x8534('0x4')](_0x3a951f,_0x4491be);};}exports[_0x8534('0x5')]=function(_0x4fa4a1){for(var _0x561fe8=0x0,_0x4d0564=events['length'];_0x561fe8<_0x4d0564;_0x561fe8++){var _0x3abf85=events[_0x561fe8];var _0x3c3b4c=createListener('smsInteraction:'+_0x3abf85,_0x4fa4a1);SmsInteractionEvents['on'](_0x3abf85,_0x3c3b4c);}}; \ No newline at end of file +var _0x2ab0=['smsInteraction:','./smsInteraction.events','save','emit','removeListener','register','length'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x2ab0,0x7f));var _0x02ab=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x2ab0[_0x20c9b2];return _0x2c6030;};'use strict';var SmsInteractionEvents=require(_0x02ab('0x0'));var events=[_0x02ab('0x1'),'remove','update'];function createListener(_0x4a4066,_0x3d9c0c){return function(_0x237479){_0x3d9c0c[_0x02ab('0x2')](_0x4a4066,_0x237479);};}function removeListener(_0x2414d9,_0x4683fc){return function(){SmsInteractionEvents[_0x02ab('0x3')](_0x2414d9,_0x4683fc);};}exports[_0x02ab('0x4')]=function(_0x4e8b0c){for(var _0x2642e8=0x0,_0x4764e1=events[_0x02ab('0x5')];_0x2642e8<_0x4764e1;_0x2642e8++){var _0x376b28=events[_0x2642e8];var _0x3d0bbc=createListener(_0x02ab('0x6')+_0x376b28,_0x4e8b0c);SmsInteractionEvents['on'](_0x376b28,_0x3d0bbc);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 2543a36..a4993b5 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 _0x3958=['./smsMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','tracked','sms','smsmessage:create','create','post','/:id/status','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x56571f,_0x50efdc){var _0x13f605=function(_0xd5dcea){while(--_0xd5dcea){_0x56571f['push'](_0x56571f['shift']());}};_0x13f605(++_0x50efdc);}(_0x3958,0xe0));var _0x8395=function(_0x45d06e,_0x3e8515){_0x45d06e=_0x45d06e-0x0;var _0x30b96a=_0x3958[_0x45d06e];return _0x30b96a;};'use strict';var multer=require(_0x8395('0x0'));var util=require(_0x8395('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8395('0x2'));var router=express[_0x8395('0x3')]();var fs_extra=require(_0x8395('0x4'));var auth=require(_0x8395('0x5'));var interaction=require(_0x8395('0x6'));var config=require(_0x8395('0x7'));var controller=require(_0x8395('0x8'));router['get']('/',auth[_0x8395('0x9')](),controller[_0x8395('0xa')]);router[_0x8395('0xb')](_0x8395('0xc'),auth[_0x8395('0x9')](),controller[_0x8395('0xd')]);router[_0x8395('0xb')](_0x8395('0xe'),auth[_0x8395('0x9')](),controller[_0x8395('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x8395('0x10')](_0x8395('0x11'),_0x8395('0x12')),controller[_0x8395('0x13')]);router[_0x8395('0x14')](_0x8395('0x15'),controller['status']);router[_0x8395('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8395('0x16')](_0x8395('0x17'),auth[_0x8395('0x9')](),controller[_0x8395('0x18')]);router[_0x8395('0x16')](_0x8395('0x19'),auth[_0x8395('0x9')](),controller[_0x8395('0x1a')]);router[_0x8395('0x1b')](_0x8395('0xe'),auth[_0x8395('0x9')](),controller['destroy']);module[_0x8395('0x1c')]=router; \ No newline at end of file +var _0x4a65=['reject','/:id','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','show','tracked','sms','smsmessage:create','create','post','/:id/status','status','put','accept','/:id/reject'];(function(_0x33e652,_0x340c23){var _0x1cdd2b=function(_0x5b4615){while(--_0x5b4615){_0x33e652['push'](_0x33e652['shift']());}};_0x1cdd2b(++_0x340c23);}(_0x4a65,0x16f));var _0x54a6=function(_0x167ac6,_0x226e6f){_0x167ac6=_0x167ac6-0x0;var _0x416b20=_0x4a65[_0x167ac6];return _0x416b20;};'use strict';var multer=require('multer');var util=require(_0x54a6('0x0'));var path=require(_0x54a6('0x1'));var timeout=require(_0x54a6('0x2'));var express=require(_0x54a6('0x3'));var router=express[_0x54a6('0x4')]();var fs_extra=require(_0x54a6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x54a6('0x6'));var config=require(_0x54a6('0x7'));var controller=require(_0x54a6('0x8'));router[_0x54a6('0x9')]('/',auth[_0x54a6('0xa')](),controller[_0x54a6('0xb')]);router[_0x54a6('0x9')](_0x54a6('0xc'),auth[_0x54a6('0xa')](),controller[_0x54a6('0xd')]);router[_0x54a6('0x9')]('/:id',auth[_0x54a6('0xa')](),controller[_0x54a6('0xe')]);router['post']('/',auth[_0x54a6('0xa')](),interaction[_0x54a6('0xf')](_0x54a6('0x10'),_0x54a6('0x11')),controller[_0x54a6('0x12')]);router[_0x54a6('0x13')](_0x54a6('0x14'),controller[_0x54a6('0x15')]);router[_0x54a6('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x54a6('0x16')]('/:id/accept',auth['isAuthenticated'](),controller[_0x54a6('0x17')]);router['put'](_0x54a6('0x18'),auth['isAuthenticated'](),controller[_0x54a6('0x19')]);router['delete'](_0x54a6('0x1a'),auth[_0x54a6('0xa')](),controller[_0x54a6('0x1b')]);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 e09f765..47b2374 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 _0x2eec=['exports','TEXT','medium','BOOLEAN','out','STRING','sequelize'];(function(_0x3abca8,_0x3247c3){var _0x3d63c0=function(_0x669c3c){while(--_0x669c3c){_0x3abca8['push'](_0x3abca8['shift']());}};_0x3d63c0(++_0x3247c3);}(_0x2eec,0xe6));var _0xc2ee=function(_0x436afd,_0x39bd18){_0x436afd=_0x436afd-0x0;var _0x32f562=_0x2eec[_0x436afd];return _0x32f562;};'use strict';var Sequelize=require(_0xc2ee('0x0'));module[_0xc2ee('0x1')]={'body':{'type':Sequelize[_0xc2ee('0x2')](_0xc2ee('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc2ee('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xc2ee('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc2ee('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xc2ee('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc2ee('0x6')]},'providerResponse':{'type':Sequelize[_0xc2ee('0x2')]}}; \ No newline at end of file +var _0x0c2b=['sequelize','exports','BOOLEAN','out','STRING','DATE','TEXT'];(function(_0x38ffb5,_0x3bd1b0){var _0x31095c=function(_0x534097){while(--_0x534097){_0x38ffb5['push'](_0x38ffb5['shift']());}};_0x31095c(++_0x3bd1b0);}(_0x0c2b,0x134));var _0xb0c2=function(_0x3a5e9f,_0x33a0bd){_0x3a5e9f=_0x3a5e9f-0x0;var _0x420caa=_0x0c2b[_0x3a5e9f];return _0x420caa;};'use strict';var Sequelize=require(_0xb0c2('0x0'));module[_0xb0c2('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb0c2('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb0c2('0x3')),'defaultValue':_0xb0c2('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb0c2('0x4')](0xbe)},'phone':{'type':Sequelize[_0xb0c2('0x4')]},'readAt':{'type':Sequelize[_0xb0c2('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb0c2('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index edc7629..7eee8fd 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 _0xa1a4=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','client','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','stack','send','index','SmsMessage','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','name','merge','includeAll','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','destroy','describe','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteractionId','isNil','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','Sequelize','SELECT','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms-interactions','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','contact','internal','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','eml-format','fast-json-patch','request-promise','moment','bluebird'];(function(_0x29e144,_0x140c41){var _0x1fdf01=function(_0x3f432b){while(--_0x3f432b){_0x29e144['push'](_0x29e144['shift']());}};_0x1fdf01(++_0x140c41);}(_0xa1a4,0x11f));var _0x4a1a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa1a4[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x4a1a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4a1a('0x1'));var rp=require(_0x4a1a('0x2'));var moment=require(_0x4a1a('0x3'));var BPromise=require(_0x4a1a('0x4'));var Mustache=require(_0x4a1a('0x5'));var util=require(_0x4a1a('0x6'));var path=require(_0x4a1a('0x7'));var sox=require(_0x4a1a('0x8'));var csv=require(_0x4a1a('0x9'));var ejs=require(_0x4a1a('0xa'));var fs=require('fs');var fs_extra=require(_0x4a1a('0xb'));var _=require(_0x4a1a('0xc'));var squel=require('squel');var crypto=require(_0x4a1a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4a1a('0xe'));var toCsv=require(_0x4a1a('0x9'));var querystring=require(_0x4a1a('0xf'));var Papa=require(_0x4a1a('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(_0x4a1a('0x11'));var logger=require(_0x4a1a('0x12'))(_0x4a1a('0x13'));var utils=require(_0x4a1a('0x14'));var config=require(_0x4a1a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4a1a('0x16'))['db'];config[_0x4a1a('0x17')]=_[_0x4a1a('0x18')](config[_0x4a1a('0x17')],{'host':_0x4a1a('0x19'),'port':0x18eb});var socket=require(_0x4a1a('0x1a'))(new Redis(config['redis']));require(_0x4a1a('0x1b'))[_0x4a1a('0x1c')](socket);var jayson=require(_0x4a1a('0x1d'));var client=jayson['client'][_0x4a1a('0x1e')]({'port':0x232c});var client9002=jayson[_0x4a1a('0x1f')][_0x4a1a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x58e61d,_0x340178,_0x361f09,_0x3f0b50){return new BPromise(function(_0x36c55d,_0x108604){var _0x3b6788=_0x3f0b50||client;return _0x3b6788['request'](_0x58e61d,_0x361f09)[_0x4a1a('0x20')](function(_0xad38b0){logger['info'](_0x4a1a('0x21'),_0x340178,_0x4a1a('0x22'));logger[_0x4a1a('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x340178,_0x4a1a('0x22'),JSON[_0x4a1a('0x24')](_0xad38b0));if(_0xad38b0[_0x4a1a('0x25')]){if(_0xad38b0[_0x4a1a('0x25')]['code']===0x1f4){logger[_0x4a1a('0x25')](_0x4a1a('0x21'),_0x340178,_0xad38b0['error'][_0x4a1a('0x26')]);return _0x108604(_0xad38b0['error']['message']);}logger[_0x4a1a('0x25')](_0x4a1a('0x21'),_0x340178,_0xad38b0['error']['message']);return _0x36c55d(_0xad38b0[_0x4a1a('0x25')][_0x4a1a('0x26')]);}else{logger[_0x4a1a('0x27')](_0x4a1a('0x21'),_0x340178,_0x4a1a('0x22'));_0x36c55d(_0xad38b0['result'][_0x4a1a('0x26')]);}})['catch'](function(_0x3c40d5){logger[_0x4a1a('0x25')]('SmsMessage,\x20%s,\x20%s',_0x340178,_0x3c40d5);_0x108604(_0x3c40d5);});});}function respondWithStatusCode(_0x3475f3,_0x3e7404){_0x3e7404=_0x3e7404||0xcc;return function(_0x8afce0){if(_0x8afce0){return _0x3475f3['sendStatus'](_0x3e7404);}return _0x3475f3['status'](_0x3e7404)[_0x4a1a('0x28')]();};}function respondWithResult(_0x3a3dde,_0x4eb689){_0x4eb689=_0x4eb689||0xc8;return function(_0x116ff4){if(_0x116ff4){return _0x3a3dde[_0x4a1a('0x29')](_0x4eb689)[_0x4a1a('0x2a')](_0x116ff4);}};}function respondWithFilteredResult(_0x45a39f,_0x347571){return function(_0x158118){if(_0x158118){var _0x44bec7=typeof _0x347571[_0x4a1a('0x2b')]==='undefined'&&typeof _0x347571[_0x4a1a('0x2c')]===_0x4a1a('0x2d');var _0x1e1999=_0x158118[_0x4a1a('0x2e')];var _0x2a5b49=_0x44bec7?0x0:_0x347571[_0x4a1a('0x2b')];var _0x56e27f=_0x44bec7?_0x158118['count']:_0x347571[_0x4a1a('0x2b')]+_0x347571[_0x4a1a('0x2c')];var _0x54aba2;if(_0x56e27f>=_0x1e1999){_0x56e27f=_0x1e1999;_0x54aba2=0xc8;}else{_0x54aba2=0xce;}_0x45a39f['status'](_0x54aba2);return _0x45a39f[_0x4a1a('0x2f')](_0x4a1a('0x30'),_0x2a5b49+'-'+_0x56e27f+'/'+_0x1e1999)[_0x4a1a('0x2a')](_0x158118);}return null;};}function patchUpdates(_0x326243){return function(_0x3f7086){try{jsonpatch['apply'](_0x3f7086,_0x326243,!![]);}catch(_0x3918af){return BPromise[_0x4a1a('0x31')](_0x3918af);}return _0x3f7086[_0x4a1a('0x32')]();};}function saveUpdates(_0x18fd2c,_0x181a75){return function(_0x1ed6f5){if(_0x1ed6f5){return _0x1ed6f5[_0x4a1a('0x33')](_0x18fd2c)[_0x4a1a('0x20')](function(_0x498fed){return _0x498fed;});}return null;};}function removeEntity(_0x10d498,_0x3a535a){return function(_0x35cefa){if(_0x35cefa){return _0x35cefa['destroy']()['then'](function(){_0x10d498[_0x4a1a('0x29')](0xcc)[_0x4a1a('0x28')]();});}};}function handleEntityNotFound(_0x43b000,_0xf2f8e7){return function(_0x423fcb){if(!_0x423fcb){_0x43b000['sendStatus'](0x194);}return _0x423fcb;};}function handleError(_0x18fd8f,_0x531ba0){_0x531ba0=_0x531ba0||0x1f4;return function(_0x521d1c){logger[_0x4a1a('0x25')](_0x521d1c[_0x4a1a('0x34')]);if(_0x521d1c['name']){delete _0x521d1c['name'];}_0x18fd8f[_0x4a1a('0x29')](_0x531ba0)[_0x4a1a('0x35')](_0x521d1c);};}exports[_0x4a1a('0x36')]=function(_0x31b200,_0xeebbbe){var _0x5180db={},_0x30c50e={},_0x52de99={'count':0x0,'rows':[]};var _0x21c8b5=_['map'](db[_0x4a1a('0x37')]['rawAttributes'],function(_0x42d896){return{'name':_0x42d896[_0x4a1a('0x38')],'type':_0x42d896[_0x4a1a('0x39')]['key']};});_0x30c50e[_0x4a1a('0x3a')]=_[_0x4a1a('0x3b')](_0x21c8b5,'name');_0x30c50e[_0x4a1a('0x3c')]=_[_0x4a1a('0x3d')](_0x31b200[_0x4a1a('0x3c')]);_0x30c50e[_0x4a1a('0x3e')]=_[_0x4a1a('0x3f')](_0x30c50e[_0x4a1a('0x3a')],_0x30c50e[_0x4a1a('0x3c')]);_0x5180db[_0x4a1a('0x40')]=_[_0x4a1a('0x3f')](_0x30c50e[_0x4a1a('0x3a')],qs['fields'](_0x31b200[_0x4a1a('0x3c')][_0x4a1a('0x41')]));_0x5180db[_0x4a1a('0x40')]=_0x5180db[_0x4a1a('0x40')][_0x4a1a('0x42')]?_0x5180db['attributes']:_0x30c50e[_0x4a1a('0x3a')];if(!_0x31b200[_0x4a1a('0x3c')][_0x4a1a('0x43')](_0x4a1a('0x44'))){_0x5180db[_0x4a1a('0x2c')]=qs['limit'](_0x31b200['query'][_0x4a1a('0x2c')]);_0x5180db[_0x4a1a('0x2b')]=qs[_0x4a1a('0x2b')](_0x31b200[_0x4a1a('0x3c')][_0x4a1a('0x2b')]);}_0x5180db[_0x4a1a('0x45')]=qs[_0x4a1a('0x46')](_0x31b200[_0x4a1a('0x3c')][_0x4a1a('0x46')]);_0x5180db[_0x4a1a('0x47')]=qs['filters'](_[_0x4a1a('0x48')](_0x31b200[_0x4a1a('0x3c')],_0x30c50e['filters']),_0x21c8b5);if(_0x31b200[_0x4a1a('0x3c')][_0x4a1a('0x49')]){_0x5180db[_0x4a1a('0x47')]=_['merge'](_0x5180db[_0x4a1a('0x47')],{'$or':_[_0x4a1a('0x3b')](_0x21c8b5,function(_0x54722d){if(_0x54722d[_0x4a1a('0x39')]!==_0x4a1a('0x4a')){var _0x6b5764={};_0x6b5764[_0x54722d[_0x4a1a('0x4b')]]={'$like':'%'+_0x31b200[_0x4a1a('0x3c')]['filter']+'%'};return _0x6b5764;}})});}_0x5180db=_[_0x4a1a('0x4c')]({},_0x5180db,_0x31b200['options']);var _0xe25195={'where':_0x5180db['where']};return db[_0x4a1a('0x37')]['count'](_0xe25195)[_0x4a1a('0x20')](function(_0x2491ab){_0x52de99[_0x4a1a('0x2e')]=_0x2491ab;if(_0x31b200[_0x4a1a('0x3c')][_0x4a1a('0x4d')]){_0x5180db['include']=[{'all':!![]}];}return db['SmsMessage'][_0x4a1a('0x4e')](_0x5180db);})[_0x4a1a('0x20')](function(_0x18babe){_0x52de99[_0x4a1a('0x4f')]=_0x18babe;return _0x52de99;})['then'](respondWithFilteredResult(_0xeebbbe,_0x5180db))['catch'](handleError(_0xeebbbe,null));};exports[_0x4a1a('0x50')]=function(_0x355edc,_0x3ef262){var _0x2ab743={'raw':!![],'where':{'id':_0x355edc[_0x4a1a('0x51')]['id']}},_0x5addba={};_0x5addba[_0x4a1a('0x3a')]=_[_0x4a1a('0x3d')](db[_0x4a1a('0x37')][_0x4a1a('0x52')]);_0x5addba[_0x4a1a('0x3c')]=_[_0x4a1a('0x3d')](_0x355edc['query']);_0x5addba[_0x4a1a('0x3e')]=_[_0x4a1a('0x3f')](_0x5addba[_0x4a1a('0x3a')],_0x5addba[_0x4a1a('0x3c')]);_0x2ab743['attributes']=_[_0x4a1a('0x3f')](_0x5addba[_0x4a1a('0x3a')],qs[_0x4a1a('0x41')](_0x355edc['query'][_0x4a1a('0x41')]));_0x2ab743[_0x4a1a('0x40')]=_0x2ab743['attributes'][_0x4a1a('0x42')]?_0x2ab743[_0x4a1a('0x40')]:_0x5addba['model'];if(_0x355edc['query'][_0x4a1a('0x4d')]){_0x2ab743['include']=[{'all':!![]}];}_0x2ab743=_['merge']({},_0x2ab743,_0x355edc[_0x4a1a('0x53')]);return db['SmsMessage'][_0x4a1a('0x54')](_0x2ab743)[_0x4a1a('0x20')](handleEntityNotFound(_0x3ef262,null))[_0x4a1a('0x20')](respondWithResult(_0x3ef262,null))[_0x4a1a('0x55')](handleError(_0x3ef262,null));};exports['create']=function(_0x244988,_0x108d9f){return db['SmsMessage'][_0x4a1a('0x56')](_0x244988[_0x4a1a('0x57')],{})['then'](respondWithResult(_0x108d9f,0xc9))[_0x4a1a('0x55')](handleError(_0x108d9f,null));};exports[_0x4a1a('0x33')]=function(_0x19f61e,_0x800a2a){if(_0x19f61e['body']['id']){delete _0x19f61e[_0x4a1a('0x57')]['id'];}return db['SmsMessage'][_0x4a1a('0x54')]({'where':{'id':_0x19f61e[_0x4a1a('0x51')]['id']}})[_0x4a1a('0x20')](handleEntityNotFound(_0x800a2a,null))['then'](saveUpdates(_0x19f61e[_0x4a1a('0x57')],null))[_0x4a1a('0x20')](respondWithResult(_0x800a2a,null))[_0x4a1a('0x55')](handleError(_0x800a2a,null));};exports[_0x4a1a('0x58')]=function(_0x576188,_0x5be9e0){return db[_0x4a1a('0x37')][_0x4a1a('0x54')]({'where':{'id':_0x576188['params']['id']}})[_0x4a1a('0x20')](handleEntityNotFound(_0x5be9e0,null))['then'](removeEntity(_0x5be9e0,null))[_0x4a1a('0x55')](handleError(_0x5be9e0,null));};exports[_0x4a1a('0x59')]=function(_0x41a669,_0xe96ac8){return db[_0x4a1a('0x37')][_0x4a1a('0x59')]()[_0x4a1a('0x20')](respondWithResult(_0xe96ac8,null))['catch'](handleError(_0xe96ac8,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0x4a1a('0x5a')]=function(_0x5948f0,_0x53dc0e,_0x7ce9db){var _0x2e364a={'agent':{},'channel':'sms'};if(_0x5948f0[_0x4a1a('0x57')]['id']){delete _0x5948f0['body']['id'];}_0x5948f0[_0x4a1a('0x57')]['read']=!![];_0x5948f0[_0x4a1a('0x57')][_0x4a1a('0x5b')]=moment()[_0x4a1a('0x5c')](_0x4a1a('0x5d'));_0x5948f0['body'][_0x4a1a('0x5e')]=_0x5948f0[_0x4a1a('0x57')][_0x4a1a('0x5e')]||_0x5948f0[_0x4a1a('0x5f')]['id'];_0x2e364a[_0x4a1a('0x60')]['id']=_0x5948f0[_0x4a1a('0x57')][_0x4a1a('0x5e')];return db['SmsMessage'][_0x4a1a('0x54')]({'where':{'id':_0x5948f0[_0x4a1a('0x51')]['id'],'UserId':null}})[_0x4a1a('0x20')](handleEntityNotFound(_0x53dc0e,null))['then'](saveUpdates(_0x5948f0[_0x4a1a('0x57')],null))[_0x4a1a('0x20')](function(_0x2047fe){if(_0x2047fe){_0x2e364a[_0x4a1a('0x26')]=_0x2047fe['get']({'plain':!![]});return db['SmsInteraction'][_0x4a1a('0x54')]({'where':{'id':_0x2047fe[_0x4a1a('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x53dc0e,null))[_0x4a1a('0x20')](function(_0x3322e5){if(_0x3322e5){return _0x3322e5['update']({'UserId':_0x5948f0['body'][_0x4a1a('0x5e')],'read1stAt':_[_0x4a1a('0x62')](_0x3322e5[_0x4a1a('0x63')])?moment()['format'](_0x4a1a('0x5d')):undefined});}return null;})[_0x4a1a('0x20')](function(_0x22baf5){if(_0x22baf5){_0x2e364a[_0x4a1a('0x64')]=_0x22baf5[_0x4a1a('0x65')]({'plain':!![]});interaction_log[_0x4a1a('0x27')](_0x4a1a('0x66'),_0x5948f0[_0x4a1a('0x5f')]['id'],_0x5948f0[_0x4a1a('0x5f')][_0x4a1a('0x4b')],_0x5948f0[_0x4a1a('0x5f')][_0x4a1a('0x67')],_0x2e364a[_0x4a1a('0x64')]['id'],_0x5948f0['body']?JSON[_0x4a1a('0x24')](_0x5948f0['body']):_0x4a1a('0x68'));return respondWithRpcPromise(_0x4a1a('0x69'),_0x4a1a('0x6a'),_0x2e364a);}return null;})[_0x4a1a('0x20')](function(_0x1cc152){var _0x438fd0=_0x4a1a('0x6b')+_0x1cc152[_0x4a1a('0x26')][_0x4a1a('0x6c')];return db[_0x4a1a('0x6d')][_0x4a1a('0x3c')](_0x438fd0,{'type':db[_0x4a1a('0x6e')]['QueryTypes'][_0x4a1a('0x6f')],'raw':!![]})['then'](function(_0x5c5f82){return _0x5c5f82;});})[_0x4a1a('0x20')](function(_0x1d9471){if(_0x1d9471){_0x2e364a[_0x4a1a('0x26')]['contact']=_0x1d9471[0x0];if(!_0x5948f0[_0x4a1a('0x57')][_0x4a1a('0x5e')])return;return db[_0x4a1a('0x70')][_0x4a1a('0x54')]({'where':{'id':_0x5948f0[_0x4a1a('0x57')][_0x4a1a('0x5e')],'role':_0x4a1a('0x60')},'attributes':['id',_0x4a1a('0x4b'),_0x4a1a('0x71'),_0x4a1a('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x1f01fd){if(!_0x1f01fd)return null;_0x2e364a[_0x4a1a('0x26')][_0x4a1a('0x60')]=_0x1f01fd;return _0x2e364a;})[_0x4a1a('0x20')](function(_0x3f56b0){if(_0x3f56b0){if(_0x5948f0[_0x4a1a('0x57')][_0x4a1a('0x73')]){_0x2e364a['message'][_0x4a1a('0x74')]=util[_0x4a1a('0x5c')](_0x4a1a('0x75'),_0x5948f0[_0x4a1a('0x5f')][_0x4a1a('0x4b')]);_0x2e364a[_0x4a1a('0x26')][_0x4a1a('0x76')]=_0x2e364a['channel'];_0x2e364a[_0x4a1a('0x26')][_0x4a1a('0x77')]=_0x2e364a[_0x4a1a('0x76')];_0x2e364a[_0x4a1a('0x26')][_0x4a1a('0x78')]=_0x4a1a('0x5a');return respondWithRpcPromise(_0x4a1a('0x79'),_0x4a1a('0x79'),{'event':_0x4a1a('0x7a'),'message':_0x2e364a['message']},client9002)[_0x4a1a('0x20')](function(){return _0x2e364a;});}return _0x2e364a;}return null;})['then'](respondWithResult(_0x53dc0e,null))['catch'](handleError(_0x53dc0e,null));};var interaction_log=require(_0x4a1a('0x12'))(_0x4a1a('0x7b'));exports[_0x4a1a('0x31')]=function(_0x2a7e2f,_0x2b9f1d,_0x2a4546){var _0x47655f={'agent':{},'channel':'sms'};if(_0x2a7e2f[_0x4a1a('0x57')]['id']){delete _0x2a7e2f[_0x4a1a('0x57')]['id'];}_0x2a7e2f['body'][_0x4a1a('0x5e')]=_0x2a7e2f[_0x4a1a('0x57')][_0x4a1a('0x5e')]||_0x2a7e2f[_0x4a1a('0x5f')]['id'];_0x47655f[_0x4a1a('0x60')]['id']=_0x2a7e2f[_0x4a1a('0x57')]['UserId'];return db[_0x4a1a('0x37')][_0x4a1a('0x54')]({'where':{'id':_0x2a7e2f[_0x4a1a('0x51')]['id'],'UserId':null}})[_0x4a1a('0x20')](handleEntityNotFound(_0x2b9f1d,null))['then'](function(_0x58d740){if(_0x58d740){_0x47655f[_0x4a1a('0x26')]=_0x58d740[_0x4a1a('0x65')]({'plain':!![]});return db[_0x4a1a('0x7c')][_0x4a1a('0x54')]({'where':{'id':_0x58d740[_0x4a1a('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x2b9f1d,null))[_0x4a1a('0x20')](function(_0x44cd3c){if(_0x44cd3c){_0x47655f['interaction']=_0x44cd3c['get']({'plain':!![]});interaction_log[_0x4a1a('0x27')](_0x4a1a('0x7d'),_0x2a7e2f['user']['id'],_0x2a7e2f['user'][_0x4a1a('0x4b')],_0x2a7e2f['user'][_0x4a1a('0x67')],_0x47655f[_0x4a1a('0x64')]['id'],_0x2a7e2f[_0x4a1a('0x57')]?JSON['stringify'](_0x2a7e2f['body']):'null');return respondWithRpcPromise('RejectMessage',_0x4a1a('0x7e'),_0x47655f);}return null;})[_0x4a1a('0x20')](function(_0x1c7880){var _0x1f63c0=_0x4a1a('0x6b')+_0x1c7880[_0x4a1a('0x26')]['ContactId'];return db['sequelize'][_0x4a1a('0x3c')](_0x1f63c0,{'type':db[_0x4a1a('0x6e')]['QueryTypes'][_0x4a1a('0x6f')],'raw':!![]})[_0x4a1a('0x20')](function(_0x59b88f){return _0x59b88f;});})[_0x4a1a('0x20')](function(_0x159837){if(_0x159837){_0x47655f['message'][_0x4a1a('0x7f')]=_0x159837[0x0];if(!_0x2a7e2f[_0x4a1a('0x57')]['UserId'])return;return db[_0x4a1a('0x70')][_0x4a1a('0x54')]({'where':{'id':_0x2a7e2f['body'][_0x4a1a('0x5e')],'role':_0x4a1a('0x60')},'attributes':['id',_0x4a1a('0x4b'),_0x4a1a('0x71'),_0x4a1a('0x72'),_0x4a1a('0x80')],'raw':!![]});}return null;})[_0x4a1a('0x20')](function(_0x598cff){if(!_0x598cff)return null;_0x47655f['message'][_0x4a1a('0x60')]=_0x598cff;return _0x47655f;})['then'](function(_0x25eb5f){if(_0x25eb5f){_0x25eb5f[_0x4a1a('0x26')][_0x4a1a('0x74')]=util['format']('SIP/%s',_0x2a7e2f[_0x4a1a('0x5f')][_0x4a1a('0x4b')]);_0x25eb5f[_0x4a1a('0x26')][_0x4a1a('0x76')]=_0x47655f[_0x4a1a('0x76')];_0x25eb5f[_0x4a1a('0x26')]['motionChannel']=_0x47655f[_0x4a1a('0x76')];_0x25eb5f[_0x4a1a('0x26')][_0x4a1a('0x78')]=_0x4a1a('0x31');respondWithRpcPromise(_0x4a1a('0x79'),_0x4a1a('0x79'),{'event':_0x4a1a('0x81'),'message':_0x25eb5f['message']},client9002);return _0x47655f;}return null;})[_0x4a1a('0x20')](respondWithResult(_0x2b9f1d,null))[_0x4a1a('0x55')](handleError(_0x2b9f1d,null));};exports[_0x4a1a('0x29')]=function(_0x434a12,_0x5335f4,_0x3908b1){if(_0x434a12[_0x4a1a('0x57')]['id']){delete _0x434a12[_0x4a1a('0x57')]['id'];}var _0x4a5fdc;return db[_0x4a1a('0x37')][_0x4a1a('0x54')]({'where':{'id':_0x434a12[_0x4a1a('0x51')]['id']}})[_0x4a1a('0x20')](handleEntityNotFound(_0x5335f4,null))[_0x4a1a('0x20')](function(_0x2446dc){if(_0x2446dc){_0x4a5fdc=_0x2446dc;return db[_0x4a1a('0x82')][_0x4a1a('0x54')]({'where':{'id':_0x2446dc[_0x4a1a('0x83')]}});}})[_0x4a1a('0x20')](handleEntityNotFound(_0x5335f4,null))[_0x4a1a('0x20')](function(_0x577258){if(_0x577258){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4a1a('0x29'),_0x4a1a('0x84'),_0x577258[_0x4a1a('0x39')],util['inspect'](_0x434a12['body'],{'showHidden':![],'depth':null}));switch(_0x577258['type']){case _0x4a1a('0x85'):if(_0x434a12[_0x4a1a('0x57')][_0x4a1a('0x86')]&&_0x434a12[_0x4a1a('0x57')][_0x4a1a('0x86')]===_0x4a5fdc[_0x4a1a('0x87')]){return _0x4a5fdc[_0x4a1a('0x33')]({'read':!![]});}else{logger[_0x4a1a('0x25')](_0x4a1a('0x88'),_0x4a1a('0x29'),_0x4a1a('0x85'),util[_0x4a1a('0x89')](_0x434a12[_0x4a1a('0x57')],{'showHidden':![],'depth':null}));}break;case _0x4a1a('0x8a'):if(_0x434a12[_0x4a1a('0x57')][_0x4a1a('0x8b')]&&_0x434a12[_0x4a1a('0x57')]['MessageUUID']===_0x4a5fdc[_0x4a1a('0x87')]&&_[_0x4a1a('0x8c')]([_0x4a1a('0x8d'),_0x4a1a('0x8e')],_0x434a12['body'][_0x4a1a('0x8f')])>=0x0){return _0x4a5fdc[_0x4a1a('0x33')]({'read':!![]});}else{logger[_0x4a1a('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4a1a('0x29'),_0x4a1a('0x90'),util[_0x4a1a('0x89')](_0x434a12[_0x4a1a('0x57')],{'showHidden':![],'depth':null}));}break;case _0x4a1a('0x91'):var _0x5340ee=_0x434a12[_0x4a1a('0x57')]['results'][0x0];if(_0x5340ee[_0x4a1a('0x29')]['groupName']==='DELIVERED'){return _0x4a5fdc[_0x4a1a('0x33')]({'read':!![]});}else{logger[_0x4a1a('0x25')](_0x4a1a('0x88'),_0x4a1a('0x29'),_0x4a1a('0x91'),util[_0x4a1a('0x89')](_0x434a12[_0x4a1a('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x4a5fdc;}})[_0x4a1a('0x20')](respondWithResult(_0x5335f4,null))[_0x4a1a('0x55')](handleError(_0x5335f4,null));}; \ No newline at end of file +var _0xde9f=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','SmsMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','find','create','body','describe','sms-interactions','sms','read','readAt','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','manual','SIP/%s','channel','event','EventManager','acceptmessage','RejectMessage','rejectMessage','ContactId','User','interface','rejectmessage','debug','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','Status','plivio','infobip','results','DELIVERED','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xde9f,0x118));var _0xfde9=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0xde9f[_0x561f25];return _0x150e4c;};'use strict';var emlformat=require(_0xfde9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfde9('0x1'));var rp=require(_0xfde9('0x2'));var moment=require('moment');var BPromise=require(_0xfde9('0x3'));var Mustache=require(_0xfde9('0x4'));var util=require('util');var path=require(_0xfde9('0x5'));var sox=require(_0xfde9('0x6'));var csv=require(_0xfde9('0x7'));var ejs=require(_0xfde9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfde9('0x9'));var crypto=require(_0xfde9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfde9('0xb'));var toCsv=require(_0xfde9('0x7'));var querystring=require(_0xfde9('0xc'));var Papa=require(_0xfde9('0xd'));var Redis=require(_0xfde9('0xe'));var authService=require(_0xfde9('0xf'));var qs=require(_0xfde9('0x10'));var as=require(_0xfde9('0x11'));var hardwareService=require(_0xfde9('0x12'));var logger=require(_0xfde9('0x13'))(_0xfde9('0x14'));var utils=require(_0xfde9('0x15'));var config=require(_0xfde9('0x16'));var licenseUtil=require(_0xfde9('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xfde9('0x18')](config[_0xfde9('0x19')],{'host':_0xfde9('0x1a'),'port':0x18eb});var socket=require(_0xfde9('0x1b'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xfde9('0x1c')](socket);var jayson=require(_0xfde9('0x1d'));var client=jayson[_0xfde9('0x1e')][_0xfde9('0x1f')]({'port':0x232c});var client9002=jayson[_0xfde9('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x454068,_0x310b90,_0x1ed070,_0x5ebd40){return new BPromise(function(_0x31b1c7,_0x6a5413){var _0x1a42ef=_0x5ebd40||client;return _0x1a42ef['request'](_0x454068,_0x1ed070)['then'](function(_0x5eb89e){logger['info'](_0xfde9('0x20'),_0x310b90,_0xfde9('0x21'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x310b90,_0xfde9('0x21'),JSON[_0xfde9('0x22')](_0x5eb89e));if(_0x5eb89e[_0xfde9('0x23')]){if(_0x5eb89e[_0xfde9('0x23')][_0xfde9('0x24')]===0x1f4){logger[_0xfde9('0x23')](_0xfde9('0x20'),_0x310b90,_0x5eb89e[_0xfde9('0x23')][_0xfde9('0x25')]);return _0x6a5413(_0x5eb89e[_0xfde9('0x23')][_0xfde9('0x25')]);}logger[_0xfde9('0x23')]('SmsMessage,\x20%s,\x20%s',_0x310b90,_0x5eb89e[_0xfde9('0x23')]['message']);return _0x31b1c7(_0x5eb89e[_0xfde9('0x23')][_0xfde9('0x25')]);}else{logger[_0xfde9('0x26')]('SmsMessage,\x20%s,\x20%s',_0x310b90,_0xfde9('0x21'));_0x31b1c7(_0x5eb89e[_0xfde9('0x27')]['message']);}})[_0xfde9('0x28')](function(_0x1c4864){logger[_0xfde9('0x23')](_0xfde9('0x20'),_0x310b90,_0x1c4864);_0x6a5413(_0x1c4864);});});}function respondWithStatusCode(_0x36967c,_0x37ad02){_0x37ad02=_0x37ad02||0xcc;return function(_0x1f2e12){if(_0x1f2e12){return _0x36967c[_0xfde9('0x29')](_0x37ad02);}return _0x36967c[_0xfde9('0x2a')](_0x37ad02)[_0xfde9('0x2b')]();};}function respondWithResult(_0x3b5ea5,_0x4205f6){_0x4205f6=_0x4205f6||0xc8;return function(_0x457402){if(_0x457402){return _0x3b5ea5[_0xfde9('0x2a')](_0x4205f6)[_0xfde9('0x2c')](_0x457402);}};}function respondWithFilteredResult(_0x1514f8,_0x4b7956){return function(_0x5cbf71){if(_0x5cbf71){var _0x26aaf4=typeof _0x4b7956[_0xfde9('0x2d')]==='undefined'&&typeof _0x4b7956[_0xfde9('0x2e')]===_0xfde9('0x2f');var _0x1651e0=_0x5cbf71[_0xfde9('0x30')];var _0x3c8c48=_0x26aaf4?0x0:_0x4b7956['offset'];var _0x375b0d=_0x26aaf4?_0x5cbf71[_0xfde9('0x30')]:_0x4b7956['offset']+_0x4b7956[_0xfde9('0x2e')];var _0x25b046;if(_0x375b0d>=_0x1651e0){_0x375b0d=_0x1651e0;_0x25b046=0xc8;}else{_0x25b046=0xce;}_0x1514f8[_0xfde9('0x2a')](_0x25b046);return _0x1514f8[_0xfde9('0x31')](_0xfde9('0x32'),_0x3c8c48+'-'+_0x375b0d+'/'+_0x1651e0)['json'](_0x5cbf71);}return null;};}function patchUpdates(_0x24df4b){return function(_0x569f62){try{jsonpatch[_0xfde9('0x33')](_0x569f62,_0x24df4b,!![]);}catch(_0x58d003){return BPromise[_0xfde9('0x34')](_0x58d003);}return _0x569f62['save']();};}function saveUpdates(_0xae5008,_0x486c41){return function(_0x13cde6){if(_0x13cde6){return _0x13cde6[_0xfde9('0x35')](_0xae5008)[_0xfde9('0x36')](function(_0x27ad23){return _0x27ad23;});}return null;};}function removeEntity(_0xdf5264,_0x30b457){return function(_0x2cbfcb){if(_0x2cbfcb){return _0x2cbfcb[_0xfde9('0x37')]()[_0xfde9('0x36')](function(){_0xdf5264[_0xfde9('0x2a')](0xcc)[_0xfde9('0x2b')]();});}};}function handleEntityNotFound(_0x5310cf,_0x117565){return function(_0x223949){if(!_0x223949){_0x5310cf[_0xfde9('0x29')](0x194);}return _0x223949;};}function handleError(_0x304323,_0x4f6b6e){_0x4f6b6e=_0x4f6b6e||0x1f4;return function(_0x3cd49c){logger[_0xfde9('0x23')](_0x3cd49c[_0xfde9('0x38')]);if(_0x3cd49c[_0xfde9('0x39')]){delete _0x3cd49c[_0xfde9('0x39')];}_0x304323[_0xfde9('0x2a')](_0x4f6b6e)['send'](_0x3cd49c);};}exports[_0xfde9('0x3a')]=function(_0x4f96a5,_0x380d26){var _0x1c57df={},_0xbd5dd8={},_0x5bd53a={'count':0x0,'rows':[]};var _0xe47e34=_[_0xfde9('0x3b')](db[_0xfde9('0x3c')][_0xfde9('0x3d')],function(_0x22e2dc){return{'name':_0x22e2dc[_0xfde9('0x3e')],'type':_0x22e2dc[_0xfde9('0x3f')][_0xfde9('0x40')]};});_0xbd5dd8['model']=_[_0xfde9('0x3b')](_0xe47e34,_0xfde9('0x39'));_0xbd5dd8[_0xfde9('0x41')]=_[_0xfde9('0x42')](_0x4f96a5[_0xfde9('0x41')]);_0xbd5dd8['filters']=_[_0xfde9('0x43')](_0xbd5dd8[_0xfde9('0x44')],_0xbd5dd8['query']);_0x1c57df[_0xfde9('0x45')]=_[_0xfde9('0x43')](_0xbd5dd8[_0xfde9('0x44')],qs['fields'](_0x4f96a5['query']['fields']));_0x1c57df[_0xfde9('0x45')]=_0x1c57df[_0xfde9('0x45')][_0xfde9('0x46')]?_0x1c57df[_0xfde9('0x45')]:_0xbd5dd8[_0xfde9('0x44')];if(!_0x4f96a5[_0xfde9('0x41')][_0xfde9('0x47')](_0xfde9('0x48'))){_0x1c57df[_0xfde9('0x2e')]=qs[_0xfde9('0x2e')](_0x4f96a5[_0xfde9('0x41')][_0xfde9('0x2e')]);_0x1c57df['offset']=qs['offset'](_0x4f96a5['query']['offset']);}_0x1c57df[_0xfde9('0x49')]=qs[_0xfde9('0x4a')](_0x4f96a5[_0xfde9('0x41')][_0xfde9('0x4a')]);_0x1c57df[_0xfde9('0x4b')]=qs[_0xfde9('0x4c')](_[_0xfde9('0x4d')](_0x4f96a5[_0xfde9('0x41')],_0xbd5dd8[_0xfde9('0x4c')]),_0xe47e34);if(_0x4f96a5[_0xfde9('0x41')][_0xfde9('0x4e')]){_0x1c57df[_0xfde9('0x4b')]=_[_0xfde9('0x4f')](_0x1c57df[_0xfde9('0x4b')],{'$or':_[_0xfde9('0x3b')](_0xe47e34,function(_0x2294e1){if(_0x2294e1[_0xfde9('0x3f')]!==_0xfde9('0x50')){var _0x394936={};_0x394936[_0x2294e1['name']]={'$like':'%'+_0x4f96a5[_0xfde9('0x41')][_0xfde9('0x4e')]+'%'};return _0x394936;}})});}_0x1c57df=_[_0xfde9('0x4f')]({},_0x1c57df,_0x4f96a5[_0xfde9('0x51')]);var _0x72cf29={'where':_0x1c57df[_0xfde9('0x4b')]};return db['SmsMessage'][_0xfde9('0x30')](_0x72cf29)['then'](function(_0x182929){_0x5bd53a['count']=_0x182929;if(_0x4f96a5[_0xfde9('0x41')][_0xfde9('0x52')]){_0x1c57df[_0xfde9('0x53')]=[{'all':!![]}];}return db[_0xfde9('0x3c')][_0xfde9('0x54')](_0x1c57df);})['then'](function(_0x1c9140){_0x5bd53a[_0xfde9('0x55')]=_0x1c9140;return _0x5bd53a;})[_0xfde9('0x36')](respondWithFilteredResult(_0x380d26,_0x1c57df))[_0xfde9('0x28')](handleError(_0x380d26,null));};exports[_0xfde9('0x56')]=function(_0x3379a0,_0x1a678c){var _0xb6b795={'raw':!![],'where':{'id':_0x3379a0[_0xfde9('0x57')]['id']}},_0x76df85={};_0x76df85[_0xfde9('0x44')]=_['keys'](db[_0xfde9('0x3c')][_0xfde9('0x3d')]);_0x76df85[_0xfde9('0x41')]=_[_0xfde9('0x42')](_0x3379a0[_0xfde9('0x41')]);_0x76df85[_0xfde9('0x4c')]=_[_0xfde9('0x43')](_0x76df85[_0xfde9('0x44')],_0x76df85[_0xfde9('0x41')]);_0xb6b795[_0xfde9('0x45')]=_[_0xfde9('0x43')](_0x76df85[_0xfde9('0x44')],qs[_0xfde9('0x58')](_0x3379a0['query'][_0xfde9('0x58')]));_0xb6b795['attributes']=_0xb6b795['attributes'][_0xfde9('0x46')]?_0xb6b795[_0xfde9('0x45')]:_0x76df85[_0xfde9('0x44')];if(_0x3379a0[_0xfde9('0x41')]['includeAll']){_0xb6b795[_0xfde9('0x53')]=[{'all':!![]}];}_0xb6b795=_[_0xfde9('0x4f')]({},_0xb6b795,_0x3379a0[_0xfde9('0x51')]);return db[_0xfde9('0x3c')][_0xfde9('0x59')](_0xb6b795)['then'](handleEntityNotFound(_0x1a678c,null))[_0xfde9('0x36')](respondWithResult(_0x1a678c,null))[_0xfde9('0x28')](handleError(_0x1a678c,null));};exports[_0xfde9('0x5a')]=function(_0x1662ed,_0x5663cc){return db[_0xfde9('0x3c')]['create'](_0x1662ed[_0xfde9('0x5b')],{})[_0xfde9('0x36')](respondWithResult(_0x5663cc,0xc9))[_0xfde9('0x28')](handleError(_0x5663cc,null));};exports[_0xfde9('0x35')]=function(_0x9c4abd,_0x45f3da){if(_0x9c4abd[_0xfde9('0x5b')]['id']){delete _0x9c4abd[_0xfde9('0x5b')]['id'];}return db[_0xfde9('0x3c')][_0xfde9('0x59')]({'where':{'id':_0x9c4abd[_0xfde9('0x57')]['id']}})[_0xfde9('0x36')](handleEntityNotFound(_0x45f3da,null))[_0xfde9('0x36')](saveUpdates(_0x9c4abd['body'],null))[_0xfde9('0x36')](respondWithResult(_0x45f3da,null))[_0xfde9('0x28')](handleError(_0x45f3da,null));};exports['destroy']=function(_0x1aa1c1,_0x208be8){return db[_0xfde9('0x3c')][_0xfde9('0x59')]({'where':{'id':_0x1aa1c1[_0xfde9('0x57')]['id']}})[_0xfde9('0x36')](handleEntityNotFound(_0x208be8,null))[_0xfde9('0x36')](removeEntity(_0x208be8,null))[_0xfde9('0x28')](handleError(_0x208be8,null));};exports[_0xfde9('0x5c')]=function(_0x4dd622,_0x23404e){return db['SmsMessage'][_0xfde9('0x5c')]()[_0xfde9('0x36')](respondWithResult(_0x23404e,null))['catch'](handleError(_0x23404e,null));};var interaction_log=require(_0xfde9('0x13'))(_0xfde9('0x5d'));exports['accept']=function(_0x35f65e,_0x25342c,_0x4d8fdc){var _0x2efa60={'agent':{},'channel':_0xfde9('0x5e')};if(_0x35f65e[_0xfde9('0x5b')]['id']){delete _0x35f65e['body']['id'];}_0x35f65e[_0xfde9('0x5b')][_0xfde9('0x5f')]=!![];_0x35f65e[_0xfde9('0x5b')][_0xfde9('0x60')]=moment()[_0xfde9('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x35f65e[_0xfde9('0x5b')][_0xfde9('0x62')]=_0x35f65e['body']['UserId']||_0x35f65e[_0xfde9('0x63')]['id'];_0x2efa60[_0xfde9('0x64')]['id']=_0x35f65e[_0xfde9('0x5b')][_0xfde9('0x62')];return db[_0xfde9('0x3c')][_0xfde9('0x59')]({'where':{'id':_0x35f65e['params']['id'],'UserId':null}})[_0xfde9('0x36')](handleEntityNotFound(_0x25342c,null))[_0xfde9('0x36')](saveUpdates(_0x35f65e[_0xfde9('0x5b')],null))[_0xfde9('0x36')](function(_0x49ec58){if(_0x49ec58){_0x2efa60['message']=_0x49ec58[_0xfde9('0x65')]({'plain':!![]});return db[_0xfde9('0x66')]['find']({'where':{'id':_0x49ec58[_0xfde9('0x67')]}});}return null;})[_0xfde9('0x36')](handleEntityNotFound(_0x25342c,null))['then'](function(_0x3944f1){if(_0x3944f1){return _0x3944f1[_0xfde9('0x35')]({'UserId':_0x35f65e[_0xfde9('0x5b')][_0xfde9('0x62')],'read1stAt':_[_0xfde9('0x68')](_0x3944f1[_0xfde9('0x69')])?moment()[_0xfde9('0x61')](_0xfde9('0x6a')):undefined});}return null;})['then'](function(_0x36c66a){if(_0x36c66a){_0x2efa60['interaction']=_0x36c66a['get']({'plain':!![]});interaction_log[_0xfde9('0x26')](_0xfde9('0x6b'),_0x35f65e[_0xfde9('0x63')]['id'],_0x35f65e[_0xfde9('0x63')]['name'],_0x35f65e[_0xfde9('0x63')][_0xfde9('0x6c')],_0x2efa60[_0xfde9('0x6d')]['id'],_0x35f65e[_0xfde9('0x5b')]?JSON[_0xfde9('0x22')](_0x35f65e['body']):_0xfde9('0x6e'));return respondWithRpcPromise(_0xfde9('0x6f'),_0xfde9('0x70'),_0x2efa60);}return null;})[_0xfde9('0x36')](function(_0x566b97){var _0x1a1bb0=_0xfde9('0x71')+_0x566b97[_0xfde9('0x25')]['ContactId'];return db[_0xfde9('0x72')][_0xfde9('0x41')](_0x1a1bb0,{'type':db[_0xfde9('0x73')][_0xfde9('0x74')][_0xfde9('0x75')],'raw':!![]})['then'](function(_0x22fa77){return _0x22fa77;});})[_0xfde9('0x36')](function(_0x418dc2){if(_0x418dc2){_0x2efa60['message'][_0xfde9('0x76')]=_0x418dc2[0x0];if(!_0x35f65e[_0xfde9('0x5b')]['UserId'])return;return db['User']['find']({'where':{'id':_0x35f65e[_0xfde9('0x5b')][_0xfde9('0x62')],'role':'agent'},'attributes':['id','name',_0xfde9('0x77'),_0xfde9('0x78'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4347c2){if(!_0x4347c2)return null;_0x2efa60[_0xfde9('0x25')][_0xfde9('0x64')]=_0x4347c2;return _0x2efa60;})['then'](function(_0x1dc2cb){if(_0x1dc2cb){if(_0x35f65e[_0xfde9('0x5b')][_0xfde9('0x79')]){_0x2efa60['message']['interface']=util['format'](_0xfde9('0x7a'),_0x35f65e[_0xfde9('0x63')]['name']);_0x2efa60[_0xfde9('0x25')][_0xfde9('0x7b')]=_0x2efa60['channel'];_0x2efa60[_0xfde9('0x25')]['motionChannel']=_0x2efa60[_0xfde9('0x7b')];_0x2efa60['message'][_0xfde9('0x7c')]='accept';return respondWithRpcPromise(_0xfde9('0x7d'),_0xfde9('0x7d'),{'event':_0xfde9('0x7e'),'message':_0x2efa60[_0xfde9('0x25')]},client9002)[_0xfde9('0x36')](function(){return _0x2efa60;});}return _0x2efa60;}return null;})[_0xfde9('0x36')](respondWithResult(_0x25342c,null))[_0xfde9('0x28')](handleError(_0x25342c,null));};var interaction_log=require(_0xfde9('0x13'))(_0xfde9('0x5d'));exports['reject']=function(_0x885296,_0x1f485c,_0x75364a){var _0x368ce5={'agent':{},'channel':_0xfde9('0x5e')};if(_0x885296[_0xfde9('0x5b')]['id']){delete _0x885296[_0xfde9('0x5b')]['id'];}_0x885296[_0xfde9('0x5b')][_0xfde9('0x62')]=_0x885296[_0xfde9('0x5b')][_0xfde9('0x62')]||_0x885296['user']['id'];_0x368ce5[_0xfde9('0x64')]['id']=_0x885296[_0xfde9('0x5b')][_0xfde9('0x62')];return db[_0xfde9('0x3c')][_0xfde9('0x59')]({'where':{'id':_0x885296[_0xfde9('0x57')]['id'],'UserId':null}})[_0xfde9('0x36')](handleEntityNotFound(_0x1f485c,null))[_0xfde9('0x36')](function(_0xff80b){if(_0xff80b){_0x368ce5[_0xfde9('0x25')]=_0xff80b['get']({'plain':!![]});return db[_0xfde9('0x66')][_0xfde9('0x59')]({'where':{'id':_0xff80b[_0xfde9('0x67')]}});}return null;})[_0xfde9('0x36')](handleEntityNotFound(_0x1f485c,null))['then'](function(_0x3fcdb0){if(_0x3fcdb0){_0x368ce5['interaction']=_0x3fcdb0[_0xfde9('0x65')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x885296[_0xfde9('0x63')]['id'],_0x885296['user'][_0xfde9('0x39')],_0x885296[_0xfde9('0x63')][_0xfde9('0x6c')],_0x368ce5[_0xfde9('0x6d')]['id'],_0x885296[_0xfde9('0x5b')]?JSON['stringify'](_0x885296[_0xfde9('0x5b')]):'null');return respondWithRpcPromise(_0xfde9('0x7f'),_0xfde9('0x80'),_0x368ce5);}return null;})[_0xfde9('0x36')](function(_0x598e66){var _0x9cb510=_0xfde9('0x71')+_0x598e66[_0xfde9('0x25')][_0xfde9('0x81')];return db['sequelize'][_0xfde9('0x41')](_0x9cb510,{'type':db[_0xfde9('0x73')][_0xfde9('0x74')]['SELECT'],'raw':!![]})[_0xfde9('0x36')](function(_0x48dce7){return _0x48dce7;});})[_0xfde9('0x36')](function(_0x217701){if(_0x217701){_0x368ce5[_0xfde9('0x25')][_0xfde9('0x76')]=_0x217701[0x0];if(!_0x885296['body'][_0xfde9('0x62')])return;return db[_0xfde9('0x82')][_0xfde9('0x59')]({'where':{'id':_0x885296[_0xfde9('0x5b')][_0xfde9('0x62')],'role':_0xfde9('0x64')},'attributes':['id',_0xfde9('0x39'),_0xfde9('0x77'),_0xfde9('0x78'),'internal'],'raw':!![]});}return null;})[_0xfde9('0x36')](function(_0xf5ef10){if(!_0xf5ef10)return null;_0x368ce5[_0xfde9('0x25')][_0xfde9('0x64')]=_0xf5ef10;return _0x368ce5;})[_0xfde9('0x36')](function(_0xb9718f){if(_0xb9718f){_0xb9718f['message'][_0xfde9('0x83')]=util[_0xfde9('0x61')](_0xfde9('0x7a'),_0x885296[_0xfde9('0x63')][_0xfde9('0x39')]);_0xb9718f['message'][_0xfde9('0x7b')]=_0x368ce5[_0xfde9('0x7b')];_0xb9718f[_0xfde9('0x25')]['motionChannel']=_0x368ce5[_0xfde9('0x7b')];_0xb9718f['message'][_0xfde9('0x7c')]=_0xfde9('0x34');respondWithRpcPromise(_0xfde9('0x7d'),_0xfde9('0x7d'),{'event':_0xfde9('0x84'),'message':_0xb9718f[_0xfde9('0x25')]},client9002);return _0x368ce5;}return null;})[_0xfde9('0x36')](respondWithResult(_0x1f485c,null))[_0xfde9('0x28')](handleError(_0x1f485c,null));};exports['status']=function(_0x57e3f3,_0x41cdbb,_0x5585e3){if(_0x57e3f3['body']['id']){delete _0x57e3f3['body']['id'];}var _0x491cb5;return db[_0xfde9('0x3c')][_0xfde9('0x59')]({'where':{'id':_0x57e3f3['params']['id']}})[_0xfde9('0x36')](handleEntityNotFound(_0x41cdbb,null))[_0xfde9('0x36')](function(_0x4648b3){if(_0x4648b3){_0x491cb5=_0x4648b3;return db['SmsAccount']['find']({'where':{'id':_0x4648b3['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x41cdbb,null))[_0xfde9('0x36')](function(_0x4d6f0e){if(_0x4d6f0e){logger[_0xfde9('0x85')](_0xfde9('0x86'),_0xfde9('0x2a'),_0xfde9('0x87'),_0x4d6f0e['type'],util[_0xfde9('0x88')](_0x57e3f3[_0xfde9('0x5b')],{'showHidden':![],'depth':null}));switch(_0x4d6f0e[_0xfde9('0x3f')]){case _0xfde9('0x89'):if(_0x57e3f3[_0xfde9('0x5b')][_0xfde9('0x8a')]&&_0x57e3f3[_0xfde9('0x5b')][_0xfde9('0x8a')]===_0x491cb5[_0xfde9('0x8b')]){return _0x491cb5[_0xfde9('0x35')]({'read':!![]});}else{logger['error'](_0xfde9('0x8c'),'status',_0xfde9('0x89'),util['inspect'](_0x57e3f3[_0xfde9('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xfde9('0x8d'):if(_0x57e3f3[_0xfde9('0x5b')]['MessageUUID']&&_0x57e3f3[_0xfde9('0x5b')][_0xfde9('0x8e')]===_0x491cb5['messageId']&&_['indexOf']([_0xfde9('0x8f'),'delivered'],_0x57e3f3[_0xfde9('0x5b')][_0xfde9('0x90')])>=0x0){return _0x491cb5[_0xfde9('0x35')]({'read':!![]});}else{logger[_0xfde9('0x23')](_0xfde9('0x8c'),'status',_0xfde9('0x91'),util[_0xfde9('0x88')](_0x57e3f3[_0xfde9('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xfde9('0x92'):var _0x5eb0be=_0x57e3f3[_0xfde9('0x5b')][_0xfde9('0x93')][0x0];if(_0x5eb0be['status']['groupName']===_0xfde9('0x94')){return _0x491cb5[_0xfde9('0x35')]({'read':!![]});}else{logger[_0xfde9('0x23')](_0xfde9('0x8c'),_0xfde9('0x2a'),_0xfde9('0x92'),util[_0xfde9('0x88')](_0x57e3f3[_0xfde9('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x491cb5;}})[_0xfde9('0x36')](respondWithResult(_0x41cdbb,null))[_0xfde9('0x28')](handleError(_0x41cdbb,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index d7b1c22..bfcaa32 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 _0x284c=['../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x284c,0xef));var _0xc284=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x284c[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require(_0xc284('0x0'));var SmsMessage=require(_0xc284('0x1'))['db'][_0xc284('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xc284('0x3')](0x0);var events={'afterCreate':_0xc284('0x4'),'afterUpdate':_0xc284('0x5'),'afterDestroy':_0xc284('0x6')};function emitEvent(_0x45ffc9){return function(_0x1f4d4b,_0x3b01fb,_0x935fd3){SmsMessageEvents[_0xc284('0x7')](_0x45ffc9+':'+_0x1f4d4b['id'],_0x1f4d4b);SmsMessageEvents[_0xc284('0x7')](_0x45ffc9,_0x1f4d4b);_0x935fd3(null);};}for(var e in events){if(events[_0xc284('0x8')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xc284('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x1db3=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x411ed9,_0x49132d){var _0x8ec24d=function(_0xc2d01){while(--_0xc2d01){_0x411ed9['push'](_0x411ed9['shift']());}};_0x8ec24d(++_0x49132d);}(_0x1db3,0x1bc));var _0x31db=function(_0x56d7ff,_0x2ee348){_0x56d7ff=_0x56d7ff-0x0;var _0x2a12b4=_0x1db3[_0x56d7ff];return _0x2a12b4;};'use strict';var EventEmitter=require(_0x31db('0x0'));var SmsMessage=require(_0x31db('0x1'))['db'][_0x31db('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x31db('0x3')](0x0);var events={'afterCreate':_0x31db('0x4'),'afterUpdate':_0x31db('0x5'),'afterDestroy':_0x31db('0x6')};function emitEvent(_0x41e304){return function(_0x38f0e0,_0x3e7174,_0x535a3c){SmsMessageEvents[_0x31db('0x7')](_0x41e304+':'+_0x38f0e0['id'],_0x38f0e0);SmsMessageEvents[_0x31db('0x7')](_0x41e304,_0x38f0e0);_0x535a3c(null);};}for(var e in events){if(events[_0x31db('0x8')](e)){var event=events[e];SmsMessage[_0x31db('0x9')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 65aea01..29d1d16 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 _0x1647=['SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','%s:%s','format','toString','base64','http_code','queued_count','head','data','message_id','clickSend','plivo','senderString','/api/sms/messages/','token','authId','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','sort','length','createHash','digest','signature=','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','update','createdAt','catch','error','SmsAccount','find','type','twilio','accountSid','authToken','phone','messages','create','remote','/status?token=','sid'];(function(_0x1c2d81,_0x16af91){var _0x914a9e=function(_0x514617){while(--_0x514617){_0x1c2d81['push'](_0x1c2d81['shift']());}};_0x914a9e(++_0x16af91);}(_0x1647,0xd6));var _0x7164=function(_0x5b39de,_0xb49479){_0x5b39de=_0x5b39de-0x0;var _0x71099=_0x1647[_0x5b39de];return _0x71099;};'use strict';var _=require(_0x7164('0x0'));var util=require(_0x7164('0x1'));var logger=require(_0x7164('0x2'))(_0x7164('0x3'));var moment=require('moment');var BPromise=require(_0x7164('0x4'));var rp=require(_0x7164('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7164('0x6'));var config=require(_0x7164('0x7'));var attributes=require(_0x7164('0x8'));module[_0x7164('0x9')]=function(_0x3d7792,_0xdd1d9a){return _0x3d7792[_0x7164('0xa')](_0x7164('0xb'),attributes,{'tableName':_0x7164('0xc'),'paranoid':![],'indexes':[{'name':_0x7164('0xd'),'fields':[_0x7164('0xd')]},{'name':_0x7164('0xe'),'fields':[_0x7164('0xf')],'type':_0x7164('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32ec0b,_0x419ad2,_0x5aea03){var _0x3ed2c2=_0x3d7792[_0x7164('0x11')];var _0xf9c332=_0x32ec0b[_0x7164('0x12')]({'plain':!![]});if(_0xf9c332[_0x7164('0x13')][_0x7164('0x14')]()==='in'||_0xf9c332[_0x7164('0x13')][_0x7164('0x14')]()===_0x7164('0x15')&&!_0xf9c332[_0x7164('0x16')]&&!_[_0x7164('0x17')](_0xf9c332[_0x7164('0x18')])&&!_['isNil'](_0xf9c332[_0x7164('0x19')])){_0x3ed2c2[_0x7164('0x1a')]['findOne']({'where':{'id':_0xf9c332[_0x7164('0x19')]}})[_0x7164('0x1b')](function(_0x2b8359){if(_0x2b8359){_0x2b8359[_0x7164('0x1c')]({'lastMsgAt':_0xf9c332[_0x7164('0x1d')],'lastMsgDirection':_0xf9c332['direction'][_0x7164('0x14')]()});}})[_0x7164('0x1e')](function(_0x4c5061){console[_0x7164('0x1f')](_0x4c5061);});}if(_0xf9c332[_0x7164('0x13')]===_0x7164('0x15')&&!_0xf9c332[_0x7164('0x16')]){var _0x122a6b;_0x3ed2c2[_0x7164('0x20')][_0x7164('0x21')]({'where':{'id':_0xf9c332['SmsAccountId']},'raw':!![]})['then'](function(_0x4e98e){_0x122a6b=_0x4e98e;if(_0x122a6b&&_0x122a6b[_0x7164('0x22')]){switch(_0x122a6b['type']){case _0x7164('0x23'):var _0x212808=require(_0x7164('0x23'));if(_0x122a6b[_0x7164('0x24')]&&_0x122a6b[_0x7164('0x25')]&&_0x122a6b[_0x7164('0x26')]){var _0x5204f2=new _0x212808(_0x122a6b[_0x7164('0x24')],_0x122a6b[_0x7164('0x25')]);_0x5204f2[_0x7164('0x27')][_0x7164('0x28')]({'body':_0xf9c332['body'],'to':_0xf9c332[_0x7164('0x26')],'from':_0x122a6b[_0x7164('0x26')],'statusCallback':_0x122a6b[_0x7164('0x29')]+'/api/sms/messages/'+_0xf9c332['id']+_0x7164('0x2a')+_0x122a6b['token']})[_0x7164('0x1b')](function(_0x21c593){if(_0x21c593['sid']){return _0x32ec0b[_0x7164('0x1c')]({'messageId':_0x21c593[_0x7164('0x2b')]});}})[_0x7164('0x1e')](function(_0x1cc254){logger[_0x7164('0x1f')](_0x7164('0x2c'),'afterCreate',_0x7164('0x23'),util[_0x7164('0x2d')](_0x1cc254,{'showHidden':![],'depth':null}));});}else{logger[_0x7164('0x1f')](_0x7164('0x2c'),_0x7164('0x2e'),_0x7164('0x23'),_0x7164('0x2f'));}break;case _0x7164('0x30'):var _0x2ab42e='https://api.skebby.it/API/v1.0/REST/';if(_0x122a6b[_0x7164('0x31')]&&_0x122a6b[_0x7164('0x32')]){var _0x2e5ecb={'recipient':[_0xf9c332['phone']],'message':_0xf9c332[_0x7164('0xf')],'message_type':_0x122a6b[_0x7164('0x33')]};if(_0x122a6b['smsMethod']&&_0x122a6b[_0x7164('0x33')]!=='SI'){_0x2e5ecb[_0x7164('0x34')]=_0x122a6b[_0x7164('0x26')];}var _0x2054bc={'url':_0x2ab42e+_0x7164('0x35')+_0x122a6b[_0x7164('0x31')]+_0x7164('0x36')+_0x122a6b['password'],'method':_0x7164('0x37')};rp(_0x2054bc)[_0x7164('0x1b')](function(_0x27ae5d){var _0x4d4fbb=_0x27ae5d[_0x7164('0x38')](';');var _0x31f80b={'user_key':_0x4d4fbb[0x0],'session_key':_0x4d4fbb[0x1]};_0x2054bc={'url':_0x2ab42e+_0x7164('0x39'),'method':_0x7164('0x3a'),'headers':{'user_key':_0x31f80b[_0x7164('0x3b')],'Session_key':_0x31f80b[_0x7164('0x3c')]},'json':!![],'body':_0x2e5ecb};return rp(_0x2054bc);})[_0x7164('0x1b')](function(_0xe96adb){if(_0xe96adb[_0x7164('0x3d')]>=0x1){var _0x19b3e7={'messageId':_0xe96adb['internal_order_id']};if(_0x122a6b[_0x7164('0x33')]!=='GP'||!_0x122a6b[_0x7164('0x3e')]){_0x19b3e7[_0x7164('0x3f')]=!![];}return _0x32ec0b[_0x7164('0x1c')](_0x19b3e7);}else{return logger[_0x7164('0x1f')](_0x7164('0x2c'),_0x7164('0x2e'),_0x7164('0x30'),util['inspect'](_0xe96adb,{'showHidden':![],'depth':null}));}})[_0x7164('0x1e')](function(_0x5d5d12){return logger[_0x7164('0x1f')](_0x7164('0x2c'),'afterCreate',_0x7164('0x30'),util[_0x7164('0x2d')](_0x5d5d12,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7164('0x2c'),'afterCreate',_0x7164('0x30'),_0x7164('0x40'));}break;case'connectel':if(_0x122a6b[_0x7164('0x25')]){var _0x43f555={'recipient':_0xf9c332[_0x7164('0x26')],'message':_0xf9c332[_0x7164('0xf')],'sender':_0x122a6b['senderString']||_0x122a6b[_0x7164('0x26')],'authorization':_0x122a6b[_0x7164('0x25')]};var _0x419ad2={'method':_0x7164('0x3a'),'uri':_0x7164('0x41'),'body':_0x43f555,'json':!![]};rp(_0x419ad2)['then'](function(_0x4949c3){var _0x65f333={'messageId':_0x4949c3[_0x7164('0x42')]};if(!_0x122a6b[_0x7164('0x3e')]){_0x65f333[_0x7164('0x3f')]=!![];}return _0x32ec0b[_0x7164('0x1c')](_0x65f333);})[_0x7164('0x1e')](function(_0x3ab019){logger[_0x7164('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7164('0x2e'),_0x7164('0x43'),util[_0x7164('0x2d')](_0x3ab019,{'showHidden':![],'depth':null}));});}else{logger[_0x7164('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7164('0x2e'),'connectel',_0x7164('0x44'));}break;case'clicksend':if(_0x122a6b['username']&&_0x122a6b['password']){var _0x43f555={'messages':[{'source':_0x7164('0x45'),'to':_0xf9c332[_0x7164('0x26')],'body':_0xf9c332[_0x7164('0xf')],'from':_0x122a6b['senderString']||_0x122a6b['phone']}]};var _0x352e5c=util['format'](_0x7164('0x46'),_0x122a6b[_0x7164('0x31')],_0x122a6b[_0x7164('0x32')]);var _0x419ad2={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x43f555,'headers':{'Authorization':util[_0x7164('0x47')]('Basic\x20%s',new Buffer(_0x352e5c)[_0x7164('0x48')](_0x7164('0x49')))},'json':!![]};rp(_0x419ad2)['then'](function(_0x932142){if(_0x932142[_0x7164('0x4a')]>=0xc8&&_0x932142['http_code']<=0xce){if(_0x932142['data']&&_0x932142['data'][_0x7164('0x4b')]>0x0){var _0x5e2efd=_[_0x7164('0x4c')](_0x932142[_0x7164('0x4d')][_0x7164('0x27')]);var _0x525411={'messageId':_0x5e2efd[_0x7164('0x4e')]};if(!_0x122a6b['deliveryReport']){_0x525411[_0x7164('0x3f')]=!![];}return _0x32ec0b[_0x7164('0x1c')](_0x525411);}else{logger[_0x7164('0x1f')](_0x7164('0x2c'),_0x7164('0x2e'),_0x7164('0x4f'),util[_0x7164('0x2d')](_0x932142,{'showHidden':![],'depth':null}));}}else{logger[_0x7164('0x1f')](_0x7164('0x2c'),'afterCreate',_0x7164('0x4f'),util[_0x7164('0x2d')](_0x932142,{'showHidden':![],'depth':null}));}})[_0x7164('0x1e')](function(_0x44a563){logger[_0x7164('0x1f')](_0x7164('0x2c'),'afterCreate','clickSend',util['inspect'](_0x44a563,{'showHidden':![],'depth':null}));});}else{logger[_0x7164('0x1f')](_0x7164('0x2c'),_0x7164('0x2e'),_0x7164('0x4f'),_0x7164('0x40'));}break;case _0x7164('0x50'):if(_0x122a6b['authId']&&_0x122a6b[_0x7164('0x25')]){var _0x43f555={'dst':_0xf9c332[_0x7164('0x26')],'text':_0xf9c332[_0x7164('0xf')],'src':_0x122a6b[_0x7164('0x51')]||_0x122a6b[_0x7164('0x26')],'url':_0x122a6b[_0x7164('0x29')]+_0x7164('0x52')+_0xf9c332['id']+_0x7164('0x2a')+_0x122a6b[_0x7164('0x53')]};var _0x352e5c=util[_0x7164('0x47')](_0x7164('0x46'),_0x122a6b[_0x7164('0x54')],_0x122a6b[_0x7164('0x25')]);var _0x419ad2={'method':_0x7164('0x3a'),'uri':util[_0x7164('0x47')]('https://api.plivo.com/v1/Account/%s/Message/',_0x122a6b['authId']),'body':_0x43f555,'headers':{'Authorization':util['format'](_0x7164('0x55'),new Buffer(_0x352e5c)[_0x7164('0x48')](_0x7164('0x49')))},'json':!![]};rp(_0x419ad2)['then'](function(_0x32ce9d){var _0x1c852e={'messageId':_0x32ce9d[_0x7164('0x56')][0x0]};return _0x32ec0b[_0x7164('0x1c')](_0x1c852e);})[_0x7164('0x1e')](function(_0x41de12){logger[_0x7164('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7164('0x2e'),'plivo',util[_0x7164('0x2d')](_0x41de12,{'showHidden':![],'depth':null}));});}else{logger[_0x7164('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7164('0x2e'),_0x7164('0x50'),_0x7164('0x57'));}break;case _0x7164('0x58'):if(_0x122a6b['username']&&_0x122a6b[_0x7164('0x32')]){if(_0x122a6b[_0x7164('0x59')]){var _0x5a5005={'method':'POST','uri':_0x122a6b[_0x7164('0x59')]+_0x7164('0x5a'),'body':{'username':_0x122a6b[_0x7164('0x31')],'password':_0x122a6b['password']},'json':!![]};return rp(_0x5a5005)[_0x7164('0x1b')](function(_0x25aa2e){var _0x5b20ce={'method':_0x7164('0x3a'),'uri':_0x122a6b['baseUrl']+_0x7164('0x5b'),'body':{'messages':[{'from':_0x122a6b[_0x7164('0x26')],'destinations':[{'to':_0xf9c332[_0x7164('0x26')]}],'text':_0xf9c332[_0x7164('0xf')],'notifyUrl':_0x122a6b[_0x7164('0x29')]+_0x7164('0x52')+_0xf9c332['id']+'/status?token='+_0x122a6b[_0x7164('0x53')],'notifyContentType':'application/json','callbackData':_0x122a6b[_0x7164('0x26')]+';'+_0xf9c332[_0x7164('0xf')]}]},'headers':{'Authorization':_0x7164('0x5c')+_0x25aa2e[_0x7164('0x53')]},'json':!![]};return rp(_0x5b20ce)[_0x7164('0x1b')](function(_0x55468b){if(_0x55468b['messages']){var _0x41a814={'messageId':_0x55468b['messages'][0x0][_0x7164('0xd')]};if(!_0x122a6b[_0x7164('0x3e')]){_0x41a814[_0x7164('0x3f')]=!![];}return _0x32ec0b[_0x7164('0x1c')](_0x41a814);}else{return logger[_0x7164('0x1f')](_0x7164('0x2c'),_0x7164('0x2e'),_0x7164('0x58'),util[_0x7164('0x2d')](_0x55468b,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x5a0fb8){return logger[_0x7164('0x1f')](_0x7164('0x2c'),_0x7164('0x2e'),_0x7164('0x58'),util[_0x7164('0x2d')](_0x5a0fb8,{'showHidden':![],'depth':null}));});}else{logger[_0x7164('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',_0x7164('0x5d'));}}else{logger[_0x7164('0x1f')](_0x7164('0x2c'),_0x7164('0x2e'),_0x7164('0x58'),_0x7164('0x40'));}break;case _0x7164('0x5e'):var _0x37dcbc=require('crypto');if(_0x122a6b[_0x7164('0x5f')]){var _0x448a6d={};_0x448a6d[_0x7164('0x60')]=_0x122a6b[_0x7164('0x31')];_0x448a6d['phone']=_0xf9c332[_0x7164('0x26')];_0x448a6d[_0x7164('0x34')]=_0x122a6b[_0x7164('0x26')];_0x448a6d[_0x7164('0x61')]=_0xf9c332['body'];_0x448a6d[_0x7164('0x62')]=+new Date();var _0x971d02='';var _0x11ba8b='';var _0x1d7740=Object['keys'](_0x448a6d);_0x1d7740[_0x7164('0x63')]();for(var _0x5c96af=0x0;_0x5c96af<_0x1d7740[_0x7164('0x64')];_0x5c96af++){if(_0x971d02!=''){_0x971d02+='&';}_0x971d02+=_0x1d7740[_0x5c96af]+'='+encodeURIComponent(_0x448a6d[_0x1d7740[_0x5c96af]]);_0x11ba8b+=_0x448a6d[_0x1d7740[_0x5c96af]];}_0x11ba8b+=_0x122a6b[_0x7164('0x5f')];_0x11ba8b=_0x37dcbc[_0x7164('0x65')]('md5')[_0x7164('0x1c')](_0x11ba8b)[_0x7164('0x66')]('hex');if(_0x971d02!==''){_0x971d02+='&';}_0x971d02+=_0x7164('0x67')+_0x11ba8b;var _0x2054bc={'method':_0x7164('0x37'),'uri':_0x122a6b[_0x7164('0x59')]+'/external/get/send.php?'+_0x971d02,'json':!![]};return rp(_0x2054bc)[_0x7164('0x1b')](function(_0x31a4ba){var _0x649269=Object[_0x7164('0x68')](_0x31a4ba);if(_0x31a4ba[_0x649269[0x0]]['error']&&parseInt(_0x31a4ba[_0x649269[0x0]][_0x7164('0x1f')])===0x0){var _0x430d90={'messageId':_0x31a4ba[_0x649269[0x0]][_0x7164('0x69')]};if(!_0x122a6b['deliveryReport']){_0x430d90[_0x7164('0x3f')]=!![];}return _0x32ec0b[_0x7164('0x1c')](_0x430d90);}else{return logger[_0x7164('0x1f')](_0x7164('0x2c'),_0x7164('0x2e'),_0x7164('0x5e'),util[_0x7164('0x2d')](_0x31a4ba[_0x7164('0x1f')],{'showHidden':![],'depth':null}));}})[_0x7164('0x1e')](function(_0x1ce464){return logger[_0x7164('0x1f')](_0x7164('0x2c'),_0x7164('0x2e'),_0x7164('0x5e'),util['inspect'](_0x1ce464,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7164('0x2c'),_0x7164('0x2e'),_0x7164('0x5e'),_0x7164('0x6a'));}break;case _0x7164('0x6b'):if(_0x122a6b[_0x7164('0x5f')]){var _0x2282e0={'method':_0x7164('0x3a'),'uri':_0x7164('0x6c'),'headers':{'Authorization':_0x122a6b[_0x7164('0x5f')]},'body':{'content':_0xf9c332[_0x7164('0xf')],'to':[_0xf9c332[_0x7164('0x26')]],'from':_0x122a6b[_0x7164('0x26')],'binary':![],'clientMessageId':_0x7164('0x6d'),'charset':_0x7164('0x6e')},'json':!![]};rp(_0x2282e0)[_0x7164('0x1b')](function(_0x5e99e9){if(!_0x5e99e9[_0x7164('0x1f')]){var _0x49ebfe={'messageId':_0x5e99e9['messages'][0x0][_0x7164('0x6f')]};if(!_0x122a6b[_0x7164('0x3e')]){_0x49ebfe[_0x7164('0x3f')]=!![];}return _0x32ec0b[_0x7164('0x1c')](_0x49ebfe);}else{return logger[_0x7164('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7164('0x2e'),'clickatell',util['inspect'](_0x5e99e9['error'],{'showHidden':![],'depth':null}));}})[_0x7164('0x1e')](function(_0x49ca4e){return logger[_0x7164('0x1f')](_0x7164('0x2c'),_0x7164('0x2e'),_0x7164('0x6b'),util[_0x7164('0x2d')](_0x49ca4e,{'showHidden':![],'depth':null}));});}else{logger[_0x7164('0x1f')](_0x7164('0x2c'),'afterCreate',_0x7164('0x6b'),'Missing\x20parameters:\x20apiKey');}break;case _0x7164('0x70'):if(_0x122a6b['username']&&_0x122a6b[_0x7164('0x32')]){var _0x352e5c=util[_0x7164('0x47')](_0x7164('0x46'),_0x122a6b[_0x7164('0x31')],_0x122a6b['password']);var _0x419ad2={'method':_0x7164('0x3a'),'uri':_0x7164('0x71')+_0x122a6b[_0x7164('0x72')]+_0x7164('0x73'),'body':{'to':[_0xf9c332['phone']],'text':_0xf9c332[_0x7164('0xf')],'from':_0x122a6b[_0x7164('0x26')],'applicationId':_0x122a6b[_0x7164('0x74')]},'headers':{'Authorization':util[_0x7164('0x47')]('Basic\x20%s',new Buffer(_0x352e5c)[_0x7164('0x48')]('base64'))},'json':!![]};rp(_0x419ad2)[_0x7164('0x1b')](function(_0xccf218){if(_0xccf218['id']){var _0x51e3f1={'messageId':_0xccf218['id']};return _0x32ec0b[_0x7164('0x1c')](_0x51e3f1);}else{logger[_0x7164('0x1f')](_0x7164('0x2c'),_0x7164('0x2e'),_0x7164('0x70'),util[_0x7164('0x2d')](_0xccf218,{'showHidden':![],'depth':null}));}})['catch'](function(_0x292167){logger[_0x7164('0x1f')](_0x7164('0x2c'),_0x7164('0x2e'),_0x7164('0x70'),util[_0x7164('0x2d')](_0x292167,{'showHidden':![],'depth':null}));});}else{logger[_0x7164('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7164('0x2e'),_0x7164('0x70'),_0x7164('0x40'));}break;case _0x7164('0x75'):if(_0x122a6b[_0x7164('0x5f')]){var _0x220034={};var _0x2054bc={'method':_0x7164('0x3a'),'uri':_0x7164('0x76'),'headers':{'Authorization':_0x7164('0x77')+_0x122a6b[_0x7164('0x5f')],'Content-Type':_0x7164('0x78')},'body':{'from':_0x122a6b[_0x7164('0x26')],'to':_0xf9c332['phone'],'text':_0xf9c332[_0x7164('0xf')]},'json':!![]};return rp(_0x2054bc)['then'](function(_0x439df1){if(_0x439df1[_0x7164('0x79')]==0xca){_0x220034[_0x7164('0x7a')]=_0x439df1;var _0x1a2944={'method':_0x7164('0x3a'),'uri':_0x7164('0x7b'),'headers':{'Authorization':_0x7164('0x77')+_0x122a6b[_0x7164('0x5f')],'Content-Type':_0x7164('0x78')},'body':{'refid':_0x220034[_0x7164('0x7a')]['refid']},'json':!![]};return rp(_0x1a2944)[_0x7164('0x1b')](function(_0x312160){_0x220034[_0x7164('0x7c')]=_0x312160;var _0x1e9be2={'messageId':_0x220034[_0x7164('0x7a')][_0x7164('0x7d')],'read':!![]};return _0x32ec0b[_0x7164('0x1c')](_0x1e9be2);});}else{return logger['error'](_0x7164('0x2c'),_0x7164('0x2e'),'intelepeer',util[_0x7164('0x2d')](_0x439df1,{'showHidden':![],'depth':null}));}})[_0x7164('0x1e')](function(_0x542787){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7164('0x2e'),_0x7164('0x75'),util['inspect'](_0x542787,{'showHidden':![],'depth':null}));});}else{return logger[_0x7164('0x1f')](_0x7164('0x2c'),_0x7164('0x2e'),'intelepeer',_0x7164('0x7e'));}break;}}})['finally'](function(){_0x5aea03();});}else{_0x5aea03();}}},'charset':_0x7164('0x7f'),'collate':_0x7164('0x80')});}; \ No newline at end of file +var _0xcd1a=['https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','split','POST','user_key','session_key','total_sent','internal_order_id','read','afterCreate','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','%s:%s','format','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','remote','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','timestamp','keys','length','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','csc','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','intelepeer'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xcd1a,0x8e));var _0xacd1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xcd1a[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xacd1('0x0'));var util=require(_0xacd1('0x1'));var logger=require(_0xacd1('0x2'))('api');var moment=require(_0xacd1('0x3'));var BPromise=require(_0xacd1('0x4'));var rp=require(_0xacd1('0x5'));var fs=require('fs');var path=require(_0xacd1('0x6'));var rimraf=require(_0xacd1('0x7'));var config=require(_0xacd1('0x8'));var attributes=require(_0xacd1('0x9'));module[_0xacd1('0xa')]=function(_0x861082,_0x5e7c06){return _0x861082['define'](_0xacd1('0xb'),attributes,{'tableName':_0xacd1('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xacd1('0xd')]},{'name':_0xacd1('0xe'),'fields':['body'],'type':_0xacd1('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x336394,_0x41895a,_0x3843de){var _0x1916b8=_0x861082[_0xacd1('0x10')];var _0x4bc366=_0x336394[_0xacd1('0x11')]({'plain':!![]});if(_0x4bc366['direction']['toLowerCase']()==='in'||_0x4bc366[_0xacd1('0x12')][_0xacd1('0x13')]()===_0xacd1('0x14')&&!_0x4bc366['secret']&&!_['isNil'](_0x4bc366[_0xacd1('0x15')])&&!_[_0xacd1('0x16')](_0x4bc366[_0xacd1('0x17')])){_0x1916b8[_0xacd1('0x18')][_0xacd1('0x19')]({'where':{'id':_0x4bc366['SmsInteractionId']}})[_0xacd1('0x1a')](function(_0x53d16d){if(_0x53d16d){_0x53d16d[_0xacd1('0x1b')]({'lastMsgAt':_0x4bc366[_0xacd1('0x1c')],'lastMsgDirection':_0x4bc366[_0xacd1('0x12')][_0xacd1('0x13')]()});}})[_0xacd1('0x1d')](function(_0x3443bc){console['error'](_0x3443bc);});}if(_0x4bc366[_0xacd1('0x12')]===_0xacd1('0x14')&&!_0x4bc366['secret']){var _0x5aa657;_0x1916b8[_0xacd1('0x1e')][_0xacd1('0x1f')]({'where':{'id':_0x4bc366[_0xacd1('0x20')]},'raw':!![]})[_0xacd1('0x1a')](function(_0x4c0cce){_0x5aa657=_0x4c0cce;if(_0x5aa657&&_0x5aa657[_0xacd1('0x21')]){switch(_0x5aa657['type']){case _0xacd1('0x22'):var _0x598f21=require('twilio');if(_0x5aa657[_0xacd1('0x23')]&&_0x5aa657[_0xacd1('0x24')]&&_0x5aa657[_0xacd1('0x25')]){var _0x529b1c=new _0x598f21(_0x5aa657['accountSid'],_0x5aa657[_0xacd1('0x24')]);_0x529b1c[_0xacd1('0x26')][_0xacd1('0x27')]({'body':_0x4bc366[_0xacd1('0x28')],'to':_0x4bc366[_0xacd1('0x25')],'from':_0x5aa657[_0xacd1('0x25')],'statusCallback':_0x5aa657['remote']+_0xacd1('0x29')+_0x4bc366['id']+_0xacd1('0x2a')+_0x5aa657[_0xacd1('0x2b')]})['then'](function(_0x1a2616){if(_0x1a2616[_0xacd1('0x2c')]){return _0x336394[_0xacd1('0x1b')]({'messageId':_0x1a2616[_0xacd1('0x2c')]});}})['catch'](function(_0x41be0d){logger[_0xacd1('0x2d')](_0xacd1('0x2e'),'afterCreate','twilio',util[_0xacd1('0x2f')](_0x41be0d,{'showHidden':![],'depth':null}));});}else{logger[_0xacd1('0x2d')](_0xacd1('0x2e'),'afterCreate',_0xacd1('0x22'),_0xacd1('0x30'));}break;case'skebby':var _0x2f7713=_0xacd1('0x31');if(_0x5aa657[_0xacd1('0x32')]&&_0x5aa657[_0xacd1('0x33')]){var _0x3f58d0={'recipient':[_0x4bc366['phone']],'message':_0x4bc366[_0xacd1('0x28')],'message_type':_0x5aa657[_0xacd1('0x34')]};if(_0x5aa657[_0xacd1('0x34')]&&_0x5aa657['smsMethod']!=='SI'){_0x3f58d0[_0xacd1('0x35')]=_0x5aa657[_0xacd1('0x25')];}var _0x3a3e76={'url':_0x2f7713+'login?username='+_0x5aa657['username']+_0xacd1('0x36')+_0x5aa657[_0xacd1('0x33')],'method':'GET'};rp(_0x3a3e76)[_0xacd1('0x1a')](function(_0x536b62){var _0xb33f5=_0x536b62[_0xacd1('0x37')](';');var _0xa1390c={'user_key':_0xb33f5[0x0],'session_key':_0xb33f5[0x1]};_0x3a3e76={'url':_0x2f7713+'sms','method':_0xacd1('0x38'),'headers':{'user_key':_0xa1390c[_0xacd1('0x39')],'Session_key':_0xa1390c[_0xacd1('0x3a')]},'json':!![],'body':_0x3f58d0};return rp(_0x3a3e76);})[_0xacd1('0x1a')](function(_0x2d0ed5){if(_0x2d0ed5[_0xacd1('0x3b')]>=0x1){var _0x5b2b0c={'messageId':_0x2d0ed5[_0xacd1('0x3c')]};if(_0x5aa657[_0xacd1('0x34')]!=='GP'||!_0x5aa657['deliveryReport']){_0x5b2b0c[_0xacd1('0x3d')]=!![];}return _0x336394['update'](_0x5b2b0c);}else{return logger[_0xacd1('0x2d')](_0xacd1('0x2e'),_0xacd1('0x3e'),_0xacd1('0x3f'),util[_0xacd1('0x2f')](_0x2d0ed5,{'showHidden':![],'depth':null}));}})[_0xacd1('0x1d')](function(_0x4f5553){return logger[_0xacd1('0x2d')](_0xacd1('0x2e'),_0xacd1('0x3e'),_0xacd1('0x3f'),util[_0xacd1('0x2f')](_0x4f5553,{'showHidden':![],'depth':null}));});}else{logger[_0xacd1('0x2d')](_0xacd1('0x2e'),_0xacd1('0x3e'),_0xacd1('0x3f'),_0xacd1('0x40'));}break;case _0xacd1('0x41'):if(_0x5aa657[_0xacd1('0x24')]){var _0x25df6e={'recipient':_0x4bc366['phone'],'message':_0x4bc366[_0xacd1('0x28')],'sender':_0x5aa657[_0xacd1('0x42')]||_0x5aa657['phone'],'authorization':_0x5aa657[_0xacd1('0x24')]};var _0x41895a={'method':_0xacd1('0x38'),'uri':_0xacd1('0x43'),'body':_0x25df6e,'json':!![]};rp(_0x41895a)[_0xacd1('0x1a')](function(_0x4f38f9){var _0x55e0ac={'messageId':_0x4f38f9[_0xacd1('0x44')]};if(!_0x5aa657[_0xacd1('0x45')]){_0x55e0ac[_0xacd1('0x3d')]=!![];}return _0x336394[_0xacd1('0x1b')](_0x55e0ac);})[_0xacd1('0x1d')](function(_0x1c68c8){logger[_0xacd1('0x2d')](_0xacd1('0x2e'),'afterCreate',_0xacd1('0x41'),util[_0xacd1('0x2f')](_0x1c68c8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xacd1('0x2e'),_0xacd1('0x3e'),'connectel',_0xacd1('0x46'));}break;case _0xacd1('0x47'):if(_0x5aa657[_0xacd1('0x32')]&&_0x5aa657[_0xacd1('0x33')]){var _0x25df6e={'messages':[{'source':'xCALLY\x20Motion','to':_0x4bc366[_0xacd1('0x25')],'body':_0x4bc366[_0xacd1('0x28')],'from':_0x5aa657[_0xacd1('0x42')]||_0x5aa657[_0xacd1('0x25')]}]};var _0x4651eb=util['format'](_0xacd1('0x48'),_0x5aa657[_0xacd1('0x32')],_0x5aa657[_0xacd1('0x33')]);var _0x41895a={'method':_0xacd1('0x38'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x25df6e,'headers':{'Authorization':util[_0xacd1('0x49')](_0xacd1('0x4a'),new Buffer(_0x4651eb)[_0xacd1('0x4b')](_0xacd1('0x4c')))},'json':!![]};rp(_0x41895a)[_0xacd1('0x1a')](function(_0x11a509){if(_0x11a509[_0xacd1('0x4d')]>=0xc8&&_0x11a509[_0xacd1('0x4d')]<=0xce){if(_0x11a509['data']&&_0x11a509[_0xacd1('0x4e')][_0xacd1('0x4f')]>0x0){var _0x3dfc85=_[_0xacd1('0x50')](_0x11a509[_0xacd1('0x4e')][_0xacd1('0x26')]);var _0x2e2673={'messageId':_0x3dfc85[_0xacd1('0x51')]};if(!_0x5aa657['deliveryReport']){_0x2e2673['read']=!![];}return _0x336394[_0xacd1('0x1b')](_0x2e2673);}else{logger['error'](_0xacd1('0x2e'),_0xacd1('0x3e'),_0xacd1('0x52'),util[_0xacd1('0x2f')](_0x11a509,{'showHidden':![],'depth':null}));}}else{logger[_0xacd1('0x2d')](_0xacd1('0x2e'),_0xacd1('0x3e'),_0xacd1('0x52'),util[_0xacd1('0x2f')](_0x11a509,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4e283e){logger[_0xacd1('0x2d')](_0xacd1('0x2e'),_0xacd1('0x3e'),_0xacd1('0x52'),util[_0xacd1('0x2f')](_0x4e283e,{'showHidden':![],'depth':null}));});}else{logger[_0xacd1('0x2d')](_0xacd1('0x2e'),'afterCreate','clickSend',_0xacd1('0x40'));}break;case _0xacd1('0x53'):if(_0x5aa657[_0xacd1('0x54')]&&_0x5aa657['authToken']){var _0x25df6e={'dst':_0x4bc366[_0xacd1('0x25')],'text':_0x4bc366['body'],'src':_0x5aa657[_0xacd1('0x42')]||_0x5aa657[_0xacd1('0x25')],'url':_0x5aa657[_0xacd1('0x55')]+_0xacd1('0x29')+_0x4bc366['id']+_0xacd1('0x2a')+_0x5aa657[_0xacd1('0x2b')]};var _0x4651eb=util[_0xacd1('0x49')]('%s:%s',_0x5aa657[_0xacd1('0x54')],_0x5aa657[_0xacd1('0x24')]);var _0x41895a={'method':_0xacd1('0x38'),'uri':util['format'](_0xacd1('0x56'),_0x5aa657[_0xacd1('0x54')]),'body':_0x25df6e,'headers':{'Authorization':util[_0xacd1('0x49')](_0xacd1('0x4a'),new Buffer(_0x4651eb)[_0xacd1('0x4b')](_0xacd1('0x4c')))},'json':!![]};rp(_0x41895a)['then'](function(_0x3d4b1f){var _0x24f15b={'messageId':_0x3d4b1f['message_uuid'][0x0]};return _0x336394['update'](_0x24f15b);})[_0xacd1('0x1d')](function(_0x2b7055){logger[_0xacd1('0x2d')](_0xacd1('0x2e'),_0xacd1('0x3e'),'plivo',util[_0xacd1('0x2f')](_0x2b7055,{'showHidden':![],'depth':null}));});}else{logger[_0xacd1('0x2d')](_0xacd1('0x2e'),_0xacd1('0x3e'),_0xacd1('0x53'),_0xacd1('0x57'));}break;case _0xacd1('0x58'):if(_0x5aa657[_0xacd1('0x32')]&&_0x5aa657['password']){if(_0x5aa657[_0xacd1('0x59')]){var _0x430443={'method':_0xacd1('0x38'),'uri':_0x5aa657[_0xacd1('0x59')]+_0xacd1('0x5a'),'body':{'username':_0x5aa657['username'],'password':_0x5aa657['password']},'json':!![]};return rp(_0x430443)[_0xacd1('0x1a')](function(_0x251b2d){var _0x320208={'method':'POST','uri':_0x5aa657[_0xacd1('0x59')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x5aa657['phone'],'destinations':[{'to':_0x4bc366['phone']}],'text':_0x4bc366[_0xacd1('0x28')],'notifyUrl':_0x5aa657[_0xacd1('0x55')]+_0xacd1('0x29')+_0x4bc366['id']+'/status?token='+_0x5aa657[_0xacd1('0x2b')],'notifyContentType':_0xacd1('0x5b'),'callbackData':_0x5aa657[_0xacd1('0x25')]+';'+_0x4bc366[_0xacd1('0x28')]}]},'headers':{'Authorization':_0xacd1('0x5c')+_0x251b2d[_0xacd1('0x2b')]},'json':!![]};return rp(_0x320208)[_0xacd1('0x1a')](function(_0x1b3017){if(_0x1b3017[_0xacd1('0x26')]){var _0x31f375={'messageId':_0x1b3017[_0xacd1('0x26')][0x0][_0xacd1('0xd')]};if(!_0x5aa657['deliveryReport']){_0x31f375[_0xacd1('0x3d')]=!![];}return _0x336394[_0xacd1('0x1b')](_0x31f375);}else{return logger['error'](_0xacd1('0x2e'),'afterCreate',_0xacd1('0x58'),util[_0xacd1('0x2f')](_0x1b3017,{'showHidden':![],'depth':null}));}});})[_0xacd1('0x1d')](function(_0xc074c){return logger[_0xacd1('0x2d')](_0xacd1('0x2e'),_0xacd1('0x3e'),'infobip',util[_0xacd1('0x2f')](_0xc074c,{'showHidden':![],'depth':null}));});}else{logger[_0xacd1('0x2d')](_0xacd1('0x2e'),_0xacd1('0x3e'),'infobip',_0xacd1('0x5d'));}}else{logger[_0xacd1('0x2d')](_0xacd1('0x2e'),_0xacd1('0x3e'),_0xacd1('0x58'),_0xacd1('0x40'));}break;case'csc':var _0x3a7d62=require(_0xacd1('0x5e'));if(_0x5aa657[_0xacd1('0x5f')]){var _0x52ce5b={};_0x52ce5b[_0xacd1('0x60')]=_0x5aa657[_0xacd1('0x32')];_0x52ce5b[_0xacd1('0x25')]=_0x4bc366[_0xacd1('0x25')];_0x52ce5b[_0xacd1('0x35')]=_0x5aa657[_0xacd1('0x25')];_0x52ce5b[_0xacd1('0x61')]=_0x4bc366[_0xacd1('0x28')];_0x52ce5b[_0xacd1('0x62')]=+new Date();var _0x513f64='';var _0x557653='';var _0x3d394e=Object[_0xacd1('0x63')](_0x52ce5b);_0x3d394e['sort']();for(var _0x22a23e=0x0;_0x22a23e<_0x3d394e[_0xacd1('0x64')];_0x22a23e++){if(_0x513f64!=''){_0x513f64+='&';}_0x513f64+=_0x3d394e[_0x22a23e]+'='+encodeURIComponent(_0x52ce5b[_0x3d394e[_0x22a23e]]);_0x557653+=_0x52ce5b[_0x3d394e[_0x22a23e]];}_0x557653+=_0x5aa657['apiKey'];_0x557653=_0x3a7d62[_0xacd1('0x65')](_0xacd1('0x66'))[_0xacd1('0x1b')](_0x557653)[_0xacd1('0x67')](_0xacd1('0x68'));if(_0x513f64!==''){_0x513f64+='&';}_0x513f64+=_0xacd1('0x69')+_0x557653;var _0x3a3e76={'method':_0xacd1('0x6a'),'uri':_0x5aa657[_0xacd1('0x59')]+_0xacd1('0x6b')+_0x513f64,'json':!![]};return rp(_0x3a3e76)[_0xacd1('0x1a')](function(_0x3ebc80){var _0x323fe0=Object[_0xacd1('0x63')](_0x3ebc80);if(_0x3ebc80[_0x323fe0[0x0]][_0xacd1('0x2d')]&&parseInt(_0x3ebc80[_0x323fe0[0x0]][_0xacd1('0x2d')])===0x0){var _0x49f271={'messageId':_0x3ebc80[_0x323fe0[0x0]]['id_sms']};if(!_0x5aa657[_0xacd1('0x45')]){_0x49f271[_0xacd1('0x3d')]=!![];}return _0x336394[_0xacd1('0x1b')](_0x49f271);}else{return logger[_0xacd1('0x2d')](_0xacd1('0x2e'),_0xacd1('0x3e'),'csc',util[_0xacd1('0x2f')](_0x3ebc80[_0xacd1('0x2d')],{'showHidden':![],'depth':null}));}})[_0xacd1('0x1d')](function(_0x3f8ae8){return logger[_0xacd1('0x2d')](_0xacd1('0x2e'),'afterCreate','csc',util['inspect'](_0x3f8ae8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xacd1('0x2e'),_0xacd1('0x3e'),_0xacd1('0x6c'),'Missing\x20parameters:\x20apiKey');}break;case _0xacd1('0x6d'):if(_0x5aa657['apiKey']){var _0x1ebb0c={'method':_0xacd1('0x38'),'uri':_0xacd1('0x6e'),'headers':{'Authorization':_0x5aa657[_0xacd1('0x5f')]},'body':{'content':_0x4bc366['body'],'to':[_0x4bc366['phone']],'from':_0x5aa657[_0xacd1('0x25')],'binary':![],'clientMessageId':_0xacd1('0x6f'),'charset':_0xacd1('0x70')},'json':!![]};rp(_0x1ebb0c)[_0xacd1('0x1a')](function(_0x5d98b2){if(!_0x5d98b2['error']){var _0xfe6d45={'messageId':_0x5d98b2[_0xacd1('0x26')][0x0][_0xacd1('0x71')]};if(!_0x5aa657['deliveryReport']){_0xfe6d45[_0xacd1('0x3d')]=!![];}return _0x336394['update'](_0xfe6d45);}else{return logger[_0xacd1('0x2d')](_0xacd1('0x2e'),_0xacd1('0x3e'),'clickatell',util[_0xacd1('0x2f')](_0x5d98b2[_0xacd1('0x2d')],{'showHidden':![],'depth':null}));}})[_0xacd1('0x1d')](function(_0x365914){return logger['error'](_0xacd1('0x2e'),'afterCreate',_0xacd1('0x6d'),util['inspect'](_0x365914,{'showHidden':![],'depth':null}));});}else{logger[_0xacd1('0x2d')](_0xacd1('0x2e'),_0xacd1('0x3e'),_0xacd1('0x6d'),_0xacd1('0x72'));}break;case _0xacd1('0x73'):if(_0x5aa657[_0xacd1('0x32')]&&_0x5aa657[_0xacd1('0x33')]){var _0x4651eb=util['format']('%s:%s',_0x5aa657[_0xacd1('0x32')],_0x5aa657['password']);var _0x41895a={'method':_0xacd1('0x38'),'uri':_0xacd1('0x74')+_0x5aa657['accountId']+_0xacd1('0x75'),'body':{'to':[_0x4bc366[_0xacd1('0x25')]],'text':_0x4bc366[_0xacd1('0x28')],'from':_0x5aa657[_0xacd1('0x25')],'applicationId':_0x5aa657[_0xacd1('0x76')]},'headers':{'Authorization':util[_0xacd1('0x49')]('Basic\x20%s',new Buffer(_0x4651eb)['toString']('base64'))},'json':!![]};rp(_0x41895a)[_0xacd1('0x1a')](function(_0x4c735c){if(_0x4c735c['id']){var _0x2515a2={'messageId':_0x4c735c['id']};return _0x336394[_0xacd1('0x1b')](_0x2515a2);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xacd1('0x3e'),_0xacd1('0x73'),util[_0xacd1('0x2f')](_0x4c735c,{'showHidden':![],'depth':null}));}})[_0xacd1('0x1d')](function(_0x5d4f07){logger['error'](_0xacd1('0x2e'),_0xacd1('0x3e'),'bandwidth',util[_0xacd1('0x2f')](_0x5d4f07,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xacd1('0x2e'),_0xacd1('0x3e'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0xacd1('0x77'):if(_0x5aa657[_0xacd1('0x5f')]){var _0x4ba91a={};var _0x3a3e76={'method':_0xacd1('0x38'),'uri':_0xacd1('0x78'),'headers':{'Authorization':_0xacd1('0x79')+_0x5aa657['apiKey'],'Content-Type':_0xacd1('0x5b')},'body':{'from':_0x5aa657[_0xacd1('0x25')],'to':_0x4bc366[_0xacd1('0x25')],'text':_0x4bc366[_0xacd1('0x28')]},'json':!![]};return rp(_0x3a3e76)[_0xacd1('0x1a')](function(_0x6a9b88){if(_0x6a9b88[_0xacd1('0x7a')]==0xca){_0x4ba91a[_0xacd1('0x7b')]=_0x6a9b88;var _0xab106e={'method':_0xacd1('0x38'),'uri':_0xacd1('0x7c'),'headers':{'Authorization':_0xacd1('0x79')+_0x5aa657[_0xacd1('0x5f')],'Content-Type':'application/json'},'body':{'refid':_0x4ba91a[_0xacd1('0x7b')][_0xacd1('0x7d')]},'json':!![]};return rp(_0xab106e)['then'](function(_0x4a23d4){_0x4ba91a[_0xacd1('0x7e')]=_0x4a23d4;var _0x2b178a={'messageId':_0x4ba91a[_0xacd1('0x7b')][_0xacd1('0x7d')],'read':!![]};return _0x336394[_0xacd1('0x1b')](_0x2b178a);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xacd1('0x3e'),_0xacd1('0x77'),util[_0xacd1('0x2f')](_0x6a9b88,{'showHidden':![],'depth':null}));}})[_0xacd1('0x1d')](function(_0x140d57){return logger['error'](_0xacd1('0x2e'),_0xacd1('0x3e'),_0xacd1('0x77'),util[_0xacd1('0x2f')](_0x140d57,{'showHidden':![],'depth':null}));});}else{return logger[_0xacd1('0x2d')](_0xacd1('0x2e'),'afterCreate','intelepeer',_0xacd1('0x7f'));}break;}}})[_0xacd1('0x80')](function(){_0x3843de();});}else{_0x3843de();}}},'charset':_0xacd1('0x81'),'collate':_0xacd1('0x82')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index d8a69cf..feab9ab 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 _0x7cf4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsMessage,\x20%s,\x20%s','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','stringify','lodash','bluebird','randomstring'];(function(_0x1584db,_0x554e73){var _0x491e0c=function(_0x321c89){while(--_0x321c89){_0x1584db['push'](_0x1584db['shift']());}};_0x491e0c(++_0x554e73);}(_0x7cf4,0x1d9));var _0x47cf=function(_0x177b11,_0x2f0992){_0x177b11=_0x177b11-0x0;var _0x4f709f=_0x7cf4[_0x177b11];return _0x4f709f;};'use strict';var _=require(_0x47cf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x47cf('0x1'));var rs=require(_0x47cf('0x2'));var fs=require('fs');var Redis=require(_0x47cf('0x3'));var db=require(_0x47cf('0x4'))['db'];var utils=require(_0x47cf('0x5'));var logger=require(_0x47cf('0x6'))(_0x47cf('0x7'));var config=require(_0x47cf('0x8'));var jayson=require(_0x47cf('0x9'));var client=jayson[_0x47cf('0xa')]['http']({'port':0x232a});config['redis']=_[_0x47cf('0xb')](config[_0x47cf('0xc')],{'host':_0x47cf('0xd'),'port':0x18eb});var socket=require(_0x47cf('0xe'))(new Redis(config['redis']));require(_0x47cf('0xf'))['register'](socket);function respondWithRpcPromise(_0x2c8810,_0x274a52,_0x34b63a){return new BPromise(function(_0x2119f5,_0x16a0f5){return client[_0x47cf('0x10')](_0x2c8810,_0x34b63a)[_0x47cf('0x11')](function(_0x1112f6){logger[_0x47cf('0x12')]('SmsMessage,\x20%s,\x20%s',_0x274a52,'request\x20sent');logger[_0x47cf('0x13')](_0x47cf('0x14'),_0x274a52,_0x47cf('0x15'),JSON['stringify'](_0x1112f6));if(_0x1112f6[_0x47cf('0x16')]){if(_0x1112f6[_0x47cf('0x16')][_0x47cf('0x17')]===0x1f4){logger[_0x47cf('0x16')](_0x47cf('0x18'),_0x274a52,_0x1112f6[_0x47cf('0x16')][_0x47cf('0x19')]);return _0x16a0f5(_0x1112f6['error'][_0x47cf('0x19')]);}logger[_0x47cf('0x16')](_0x47cf('0x18'),_0x274a52,_0x1112f6[_0x47cf('0x16')][_0x47cf('0x19')]);return _0x2119f5(_0x1112f6[_0x47cf('0x16')][_0x47cf('0x19')]);}else{logger['info'](_0x47cf('0x18'),_0x274a52,_0x47cf('0x15'));_0x2119f5(_0x1112f6['result'][_0x47cf('0x19')]);}})[_0x47cf('0x1a')](function(_0x4c357b){logger[_0x47cf('0x16')](_0x47cf('0x18'),_0x274a52,_0x4c357b);_0x16a0f5(_0x4c357b);});});}exports[_0x47cf('0x1b')]=function(_0x24a5d1){var _0x2cb66d=this;return new Promise(function(_0x150804,_0x1a9f35){return db[_0x47cf('0x1c')][_0x47cf('0x1d')](_0x24a5d1[_0x47cf('0x1e')],{'raw':_0x24a5d1[_0x47cf('0x1f')]?_0x24a5d1[_0x47cf('0x1f')][_0x47cf('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x442b72){logger[_0x47cf('0x12')]('CreateSmsMessage',_0x24a5d1);logger[_0x47cf('0x13')](_0x47cf('0x1b'),_0x24a5d1,JSON[_0x47cf('0x21')](_0x442b72));_0x150804(_0x442b72);})['catch'](function(_0x130f0a){logger[_0x47cf('0x16')](_0x47cf('0x1b'),_0x130f0a[_0x47cf('0x19')],_0x24a5d1);_0x1a9f35(_0x2cb66d[_0x47cf('0x16')](0x1f4,_0x130f0a[_0x47cf('0x19')]));});});}; \ No newline at end of file +var _0x4e9d=['SmsMessage,\x20%s,\x20%s','message','catch','CreateSmsMessage','SmsMessage','create','body','raw','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','stringify','error','code'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x4e9d,0xbd));var _0xd4e9=function(_0x5dbd4b,_0x2fb8fe){_0x5dbd4b=_0x5dbd4b-0x0;var _0x5d2723=_0x4e9d[_0x5dbd4b];return _0x5d2723;};'use strict';var _=require(_0xd4e9('0x0'));var util=require(_0xd4e9('0x1'));var moment=require('moment');var BPromise=require(_0xd4e9('0x2'));var rs=require(_0xd4e9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4e9('0x4'))['db'];var utils=require(_0xd4e9('0x5'));var logger=require(_0xd4e9('0x6'))('rpc');var config=require(_0xd4e9('0x7'));var jayson=require(_0xd4e9('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xd4e9('0x9')](config[_0xd4e9('0xa')],{'host':_0xd4e9('0xb'),'port':0x18eb});var socket=require(_0xd4e9('0xc'))(new Redis(config[_0xd4e9('0xa')]));require('./smsMessage.socket')[_0xd4e9('0xd')](socket);function respondWithRpcPromise(_0x5a2b37,_0x1bbbf1,_0x37e849){return new BPromise(function(_0x110977,_0x270a3a){return client[_0xd4e9('0xe')](_0x5a2b37,_0x37e849)['then'](function(_0x516f26){logger[_0xd4e9('0xf')]('SmsMessage,\x20%s,\x20%s',_0x1bbbf1,_0xd4e9('0x10'));logger[_0xd4e9('0x11')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1bbbf1,_0xd4e9('0x10'),JSON[_0xd4e9('0x12')](_0x516f26));if(_0x516f26[_0xd4e9('0x13')]){if(_0x516f26['error'][_0xd4e9('0x14')]===0x1f4){logger['error'](_0xd4e9('0x15'),_0x1bbbf1,_0x516f26[_0xd4e9('0x13')][_0xd4e9('0x16')]);return _0x270a3a(_0x516f26[_0xd4e9('0x13')][_0xd4e9('0x16')]);}logger[_0xd4e9('0x13')](_0xd4e9('0x15'),_0x1bbbf1,_0x516f26[_0xd4e9('0x13')]['message']);return _0x110977(_0x516f26[_0xd4e9('0x13')][_0xd4e9('0x16')]);}else{logger['info'](_0xd4e9('0x15'),_0x1bbbf1,_0xd4e9('0x10'));_0x110977(_0x516f26['result']['message']);}})[_0xd4e9('0x17')](function(_0x596c51){logger['error'](_0xd4e9('0x15'),_0x1bbbf1,_0x596c51);_0x270a3a(_0x596c51);});});}exports[_0xd4e9('0x18')]=function(_0x391e21){var _0x675d5=this;return new Promise(function(_0x6c68a5,_0x247d00){return db[_0xd4e9('0x19')][_0xd4e9('0x1a')](_0x391e21[_0xd4e9('0x1b')],{'raw':_0x391e21['options']?_0x391e21['options'][_0xd4e9('0x1c')]===undefined?!![]:![]:!![]})[_0xd4e9('0x1d')](function(_0x3f062a){logger[_0xd4e9('0xf')](_0xd4e9('0x18'),_0x391e21);logger[_0xd4e9('0x11')](_0xd4e9('0x18'),_0x391e21,JSON[_0xd4e9('0x12')](_0x3f062a));_0x6c68a5(_0x3f062a);})['catch'](function(_0x56bb23){logger[_0xd4e9('0x13')](_0xd4e9('0x18'),_0x56bb23['message'],_0x391e21);_0x247d00(_0x675d5['error'](0x1f4,_0x56bb23[_0xd4e9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 27f46cf..a649d2c 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 _0x28e8=['update','emit','removeListener','length','smsMessage:','./smsMessage.events','save','remove'];(function(_0x38610e,_0x1ddc5d){var _0x407ab4=function(_0x2a8b3c){while(--_0x2a8b3c){_0x38610e['push'](_0x38610e['shift']());}};_0x407ab4(++_0x1ddc5d);}(_0x28e8,0x1ad));var _0x828e=function(_0x10086f,_0x570f1d){_0x10086f=_0x10086f-0x0;var _0x59739e=_0x28e8[_0x10086f];return _0x59739e;};'use strict';var SmsMessageEvents=require(_0x828e('0x0'));var events=[_0x828e('0x1'),_0x828e('0x2'),_0x828e('0x3')];function createListener(_0xafed0b,_0x52d775){return function(_0x401a8a){_0x52d775[_0x828e('0x4')](_0xafed0b,_0x401a8a);};}function removeListener(_0x4ae2fa,_0x5eeef7){return function(){SmsMessageEvents[_0x828e('0x5')](_0x4ae2fa,_0x5eeef7);};}exports['register']=function(_0x31f2cc){for(var _0x5d5252=0x0,_0x64a04b=events[_0x828e('0x6')];_0x5d5252<_0x64a04b;_0x5d5252++){var _0x37b23e=events[_0x5d5252];var _0x57c08a=createListener(_0x828e('0x7')+_0x37b23e,_0x31f2cc);SmsMessageEvents['on'](_0x37b23e,_0x57c08a);}}; \ No newline at end of file +var _0xdc38=['removeListener','register','length','smsMessage:','./smsMessage.events','save','remove','update','emit'];(function(_0x5ed5e4,_0x15d7fc){var _0xcc956a=function(_0x53130a){while(--_0x53130a){_0x5ed5e4['push'](_0x5ed5e4['shift']());}};_0xcc956a(++_0x15d7fc);}(_0xdc38,0xe5));var _0x8dc3=function(_0x908782,_0x49951b){_0x908782=_0x908782-0x0;var _0x2e5323=_0xdc38[_0x908782];return _0x2e5323;};'use strict';var SmsMessageEvents=require(_0x8dc3('0x0'));var events=[_0x8dc3('0x1'),_0x8dc3('0x2'),_0x8dc3('0x3')];function createListener(_0x4c4613,_0x52c085){return function(_0x4e7858){_0x52c085[_0x8dc3('0x4')](_0x4c4613,_0x4e7858);};}function removeListener(_0x3c7645,_0x3f2755){return function(){SmsMessageEvents[_0x8dc3('0x5')](_0x3c7645,_0x3f2755);};}exports[_0x8dc3('0x6')]=function(_0x2b8f34){for(var _0x5e000c=0x0,_0x2b61be=events[_0x8dc3('0x7')];_0x5e000c<_0x2b61be;_0x5e000c++){var _0x34684b=events[_0x5e000c];var _0x2fb494=createListener(_0x8dc3('0x8')+_0x34684b,_0x2b8f34);SmsMessageEvents['on'](_0x34684b,_0x2fb494);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 216009e..6eee688 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 _0x0f84=['/:id/teams','/:id/users','getAgents','post','create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers'];(function(_0xef95ae,_0x554378){var _0x2a9d87=function(_0x221b94){while(--_0x221b94){_0xef95ae['push'](_0xef95ae['shift']());}};_0x2a9d87(++_0x554378);}(_0x0f84,0x1e8));var _0x40f8=function(_0x5494cd,_0x5a570a){_0x5494cd=_0x5494cd-0x0;var _0x102184=_0x0f84[_0x5494cd];return _0x102184;};'use strict';var multer=require(_0x40f8('0x0'));var util=require(_0x40f8('0x1'));var path=require(_0x40f8('0x2'));var timeout=require('connect-timeout');var express=require(_0x40f8('0x3'));var router=express[_0x40f8('0x4')]();var fs_extra=require(_0x40f8('0x5'));var auth=require(_0x40f8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x40f8('0x7'));var controller=require(_0x40f8('0x8'));router[_0x40f8('0x9')]('/',auth[_0x40f8('0xa')](),controller[_0x40f8('0xb')]);router['get'](_0x40f8('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x40f8('0x9')](_0x40f8('0xd'),auth[_0x40f8('0xa')](),controller['show']);router['get'](_0x40f8('0xe'),auth[_0x40f8('0xa')](),controller[_0x40f8('0xf')]);router[_0x40f8('0x9')](_0x40f8('0x10'),auth[_0x40f8('0xa')](),controller['getTeams']);router['get'](_0x40f8('0x11'),auth[_0x40f8('0xa')](),controller[_0x40f8('0x12')]);router[_0x40f8('0x13')]('/',auth[_0x40f8('0xa')](),controller[_0x40f8('0x14')]);router[_0x40f8('0x13')](_0x40f8('0x10'),auth[_0x40f8('0xa')](),controller['addTeams']);router[_0x40f8('0x13')](_0x40f8('0x11'),auth[_0x40f8('0xa')](),controller[_0x40f8('0x15')]);router[_0x40f8('0x16')](_0x40f8('0xd'),auth[_0x40f8('0xa')](),controller['update']);router[_0x40f8('0x17')](_0x40f8('0xd'),auth[_0x40f8('0xa')](),controller[_0x40f8('0x18')]);router['delete'](_0x40f8('0x10'),auth[_0x40f8('0xa')](),controller[_0x40f8('0x19')]);router[_0x40f8('0x17')](_0x40f8('0x11'),auth[_0x40f8('0xa')](),controller[_0x40f8('0x1a')]);module[_0x40f8('0x1b')]=router; \ No newline at end of file +var _0x124e=['multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x576f08,_0xe56cd6){var _0x18f39d=function(_0x9980b3){while(--_0x9980b3){_0x576f08['push'](_0x576f08['shift']());}};_0x18f39d(++_0xe56cd6);}(_0x124e,0x1b2));var _0xe124=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0x124e[_0x2b91c5];return _0xbd5531;};'use strict';var multer=require(_0xe124('0x0'));var util=require(_0xe124('0x1'));var path=require(_0xe124('0x2'));var timeout=require('connect-timeout');var express=require(_0xe124('0x3'));var router=express[_0xe124('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe124('0x5'));var config=require(_0xe124('0x6'));var controller=require(_0xe124('0x7'));router[_0xe124('0x8')]('/',auth[_0xe124('0x9')](),controller[_0xe124('0xa')]);router[_0xe124('0x8')](_0xe124('0xb'),auth[_0xe124('0x9')](),controller['describe']);router[_0xe124('0x8')](_0xe124('0xc'),auth[_0xe124('0x9')](),controller[_0xe124('0xd')]);router[_0xe124('0x8')](_0xe124('0xe'),auth['isAuthenticated'](),controller[_0xe124('0xf')]);router[_0xe124('0x8')](_0xe124('0x10'),auth[_0xe124('0x9')](),controller[_0xe124('0x11')]);router[_0xe124('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xe124('0x12')]);router[_0xe124('0x13')]('/',auth[_0xe124('0x9')](),controller[_0xe124('0x14')]);router[_0xe124('0x13')](_0xe124('0x10'),auth[_0xe124('0x9')](),controller[_0xe124('0x15')]);router[_0xe124('0x13')](_0xe124('0x16'),auth[_0xe124('0x9')](),controller[_0xe124('0x17')]);router[_0xe124('0x18')](_0xe124('0xc'),auth[_0xe124('0x9')](),controller[_0xe124('0x19')]);router[_0xe124('0x1a')](_0xe124('0xc'),auth['isAuthenticated'](),controller[_0xe124('0x1b')]);router['delete'](_0xe124('0x10'),auth[_0xe124('0x9')](),controller[_0xe124('0x1c')]);router['delete'](_0xe124('0x16'),auth[_0xe124('0x9')](),controller[_0xe124('0x1d')]);module[_0xe124('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 5100d21..665e7c5 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 _0x3481=['name','INTEGER','ENUM','rrmemory','beepall','exports','STRING'];(function(_0x5e5e9d,_0x632b2c){var _0x109d77=function(_0x36c68b){while(--_0x36c68b){_0x5e5e9d['push'](_0x5e5e9d['shift']());}};_0x109d77(++_0x632b2c);}(_0x3481,0x171));var _0x1348=function(_0x581e18,_0x56fd73){_0x581e18=_0x581e18-0x0;var _0x466a99=_0x3481[_0x581e18];return _0x466a99;};'use strict';var Sequelize=require('sequelize');module[_0x1348('0x0')]={'name':{'type':Sequelize[_0x1348('0x1')],'unique':_0x1348('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1348('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1348('0x4')](_0x1348('0x5'),_0x1348('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xaf7c=['STRING','name','INTEGER','ENUM','exports'];(function(_0x516434,_0x10b9fc){var _0x441fdd=function(_0x2ff948){while(--_0x2ff948){_0x516434['push'](_0x516434['shift']());}};_0x441fdd(++_0x10b9fc);}(_0xaf7c,0x1a3));var _0xcaf7=function(_0x53eeac,_0x1babff){_0x53eeac=_0x53eeac-0x0;var _0x41dddf=_0xaf7c[_0x53eeac];return _0x41dddf;};'use strict';var Sequelize=require('sequelize');module[_0xcaf7('0x0')]={'name':{'type':Sequelize[_0xcaf7('0x1')],'unique':_0xcaf7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcaf7('0x1')]},'timeout':{'type':Sequelize[_0xcaf7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcaf7('0x4')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index a84a608..e359650 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 _0x7a54=['transaction','addTeams','each','findOrCreate','userSmsQueue:save','removeTeams','Team','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','QueryTypes','SELECT','every','includes','all','compact','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','emit','removeAgents','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','then','get','SmsQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','SmsQueue','include','rows','catch','show','params','model','query','intersection','fields','attributes','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','limit','order','sort','filters','pick','filter','User','UserId','createdAt','format','%s/%s','smsPause','getTeams','keys','nolimit','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize'];(function(_0x54f243,_0x3e498b){var _0x803508=function(_0x39817a){while(--_0x39817a){_0x54f243['push'](_0x54f243['shift']());}};_0x803508(++_0x3e498b);}(_0x7a54,0x106));var _0x47a5=function(_0x23682a,_0xc1f3cd){_0x23682a=_0x23682a-0x0;var _0xd09fad=_0x7a54[_0x23682a];return _0xd09fad;};'use strict';var BPromise=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var squel=require('squel');var Redis=require(_0x47a5('0x3'));var qs=require(_0x47a5('0x4'));var logger=require('../../config/logger')(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var db=require(_0x47a5('0x7'))['db'];config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));require(_0x47a5('0xb'))['register'](socket);function respondWithStatusCode(_0x194fb0,_0x5077f3){_0x5077f3=_0x5077f3||0xcc;return function(_0x5d90b3){if(_0x5d90b3){return _0x194fb0['sendStatus'](_0x5077f3);}return _0x194fb0[_0x47a5('0xc')](_0x5077f3)[_0x47a5('0xd')]();};}function respondWithResult(_0x5e31dd,_0x2eb0dd){_0x2eb0dd=_0x2eb0dd||0xc8;return function(_0x49e844){if(_0x49e844){return _0x5e31dd['status'](_0x2eb0dd)[_0x47a5('0xe')](_0x49e844);}};}function respondWithFilteredResult(_0x69e4d4,_0x2f399b){return function(_0x250fad){if(_0x250fad){var _0xd612dd=typeof _0x2f399b[_0x47a5('0xf')]===_0x47a5('0x10')&&typeof _0x2f399b['limit']===_0x47a5('0x10');var _0x221b54=_0x250fad[_0x47a5('0x11')];var _0x711793=_0xd612dd?0x0:_0x2f399b[_0x47a5('0xf')];var _0x620ee9=_0xd612dd?_0x250fad[_0x47a5('0x11')]:_0x2f399b[_0x47a5('0xf')]+_0x2f399b['limit'];var _0x362359;if(_0x620ee9>=_0x221b54){_0x620ee9=_0x221b54;_0x362359=0xc8;}else{_0x362359=0xce;}_0x69e4d4[_0x47a5('0xc')](_0x362359);return _0x69e4d4[_0x47a5('0x12')](_0x47a5('0x13'),_0x711793+'-'+_0x620ee9+'/'+_0x221b54)[_0x47a5('0xe')](_0x250fad);}return null;};}function saveUpdates(_0x574af6){return function(_0x549de3){if(_0x549de3){return _0x549de3[_0x47a5('0x14')](_0x574af6)['then'](function(_0x5247fd){return _0x5247fd;});}return null;};}function removeEntity(_0x423a81){return function(_0xaf70a6){if(_0xaf70a6){return _0xaf70a6[_0x47a5('0x15')]()[_0x47a5('0x16')](function(){var _0x477b1d=_0xaf70a6[_0x47a5('0x17')]({'plain':!![]});var _0x2763d6=_0x47a5('0x18');return db[_0x47a5('0x19')]['destroy']({'where':{'type':_0x2763d6,'resourceId':_0x477b1d['id']}})[_0x47a5('0x16')](function(){return _0xaf70a6;});})[_0x47a5('0x16')](function(){_0x423a81['status'](0xcc)[_0x47a5('0xd')]();});}};}function handleEntityNotFound(_0x1f03f7){return function(_0x36874d){if(!_0x36874d){_0x1f03f7['sendStatus'](0x194);}return _0x36874d;};}function handleError(_0xb8ae6c,_0x2f142b){_0x2f142b=_0x2f142b||0x1f4;return function(_0x23db32){logger[_0x47a5('0x1a')](_0x23db32['stack']);if(_0x23db32[_0x47a5('0x1b')]){delete _0x23db32[_0x47a5('0x1b')];}_0xb8ae6c['status'](_0x2f142b)[_0x47a5('0x1c')](_0x23db32);};}exports[_0x47a5('0x1d')]=function(_0x4437f1,_0x129ce5){var _0x3abd6a={};var _0x50bf17={'count':0x0,'rows':[]};var _0x53078a=_[_0x47a5('0x1e')](db['SmsQueue'][_0x47a5('0x1f')],function(_0x5b6c4e){return{'name':_0x5b6c4e[_0x47a5('0x20')],'type':_0x5b6c4e[_0x47a5('0x21')][_0x47a5('0x22')]};});_0x3abd6a=qs[_0x47a5('0x23')](_0x53078a,_0x4437f1);var _0x21f296={'where':_0x3abd6a[_0x47a5('0x24')]};return db[_0x47a5('0x25')][_0x47a5('0x11')](_0x21f296)[_0x47a5('0x16')](function(_0x361bfa){_0x50bf17[_0x47a5('0x11')]=_0x361bfa;_0x3abd6a[_0x47a5('0x26')]=qs[_0x47a5('0x26')](_0x4437f1['query']);return db[_0x47a5('0x25')]['findAll'](_0x3abd6a);})[_0x47a5('0x16')](function(_0x9ac908){_0x50bf17[_0x47a5('0x27')]=_0x9ac908;return _0x50bf17;})['then'](respondWithFilteredResult(_0x129ce5,_0x3abd6a))[_0x47a5('0x28')](handleError(_0x129ce5,null));};exports[_0x47a5('0x29')]=function(_0x39b50b,_0x1f1c68){var _0x51cc81={'raw':!![],'where':{'id':_0x39b50b[_0x47a5('0x2a')]['id']}},_0x50d875={};_0x50d875[_0x47a5('0x2b')]=_['keys'](db['SmsQueue'][_0x47a5('0x1f')]);_0x50d875[_0x47a5('0x2c')]=_['keys'](_0x39b50b[_0x47a5('0x2c')]);_0x50d875['filters']=_[_0x47a5('0x2d')](_0x50d875[_0x47a5('0x2b')],_0x50d875['query']);_0x51cc81['attributes']=_[_0x47a5('0x2d')](_0x50d875['model'],qs[_0x47a5('0x2e')](_0x39b50b[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x51cc81['attributes']=_0x51cc81[_0x47a5('0x2f')]['length']?_0x51cc81['attributes']:_0x50d875[_0x47a5('0x2b')];if(_0x39b50b['query'][_0x47a5('0x30')]){_0x51cc81['include']=[{'all':!![]}];}_0x51cc81=_[_0x47a5('0x31')]({},_0x51cc81,_0x39b50b[_0x47a5('0x32')]);return db[_0x47a5('0x25')][_0x47a5('0x33')](_0x51cc81)[_0x47a5('0x16')](handleEntityNotFound(_0x1f1c68,null))[_0x47a5('0x16')](respondWithResult(_0x1f1c68,null))[_0x47a5('0x28')](handleError(_0x1f1c68,null));};exports[_0x47a5('0x34')]=function(_0x1a0d23,_0x4caed5){return db[_0x47a5('0x25')][_0x47a5('0x34')](_0x1a0d23['body'],{})[_0x47a5('0x16')](function(_0x2bf53d){var _0x1d4348=_0x1a0d23['user'][_0x47a5('0x17')]({'plain':!![]});if(!_0x1d4348)throw new Error(_0x47a5('0x35'));if(_0x1d4348['role']===_0x47a5('0x36')){var _0x19218a=_0x2bf53d['get']({'plain':!![]});var _0x55c5eb='SmsQueues';return db[_0x47a5('0x37')]['find']({'where':{'name':_0x55c5eb,'userProfileId':_0x1d4348[_0x47a5('0x38')]},'raw':!![]})[_0x47a5('0x16')](function(_0x301a85){if(_0x301a85&&_0x301a85[_0x47a5('0x39')]===0x0){return db[_0x47a5('0x19')][_0x47a5('0x34')]({'name':_0x19218a[_0x47a5('0x1b')],'resourceId':_0x19218a['id'],'type':_0x301a85[_0x47a5('0x1b')],'sectionId':_0x301a85['id']},{})[_0x47a5('0x16')](function(){return _0x2bf53d;});}else{return _0x2bf53d;}})[_0x47a5('0x28')](function(_0x280500){logger[_0x47a5('0x1a')](_0x47a5('0x3a'),_0x280500);throw _0x280500;});}return _0x2bf53d;})['then'](respondWithResult(_0x4caed5,0xc9))[_0x47a5('0x28')](handleError(_0x4caed5,null));};exports[_0x47a5('0x14')]=function(_0x331474,_0x23bd8d){if(_0x331474['body']['id']){delete _0x331474[_0x47a5('0x3b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x331474['params']['id']}})['then'](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x16')](saveUpdates(_0x331474['body'],null))[_0x47a5('0x16')](respondWithResult(_0x23bd8d,null))[_0x47a5('0x28')](handleError(_0x23bd8d,null));};exports[_0x47a5('0x15')]=function(_0x494526,_0x3805fd){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x494526['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3805fd,null))['then'](removeEntity(_0x3805fd,null))[_0x47a5('0x28')](handleError(_0x3805fd,null));};exports[_0x47a5('0x3c')]=function(_0x188614,_0xd75ca3){return db[_0x47a5('0x25')][_0x47a5('0x3c')]()[_0x47a5('0x16')](respondWithResult(_0xd75ca3,null))[_0x47a5('0x28')](handleError(_0xd75ca3,null));};exports[_0x47a5('0x3d')]=function(_0x162fa0,_0x24ecb1){var _0x3c3ebf={'raw':!![],'where':{}},_0xe28d76={},_0x3574d4;return db[_0x47a5('0x25')][_0x47a5('0x3e')]({'where':{'id':_0x162fa0['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x24ecb1,null))[_0x47a5('0x16')](function(_0x49eab1){if(_0x49eab1){_0x3574d4=_0x49eab1['get']({'plain':!![]});_0xe28d76[_0x47a5('0x2b')]=_['keys'](db[_0x47a5('0x3f')][_0x47a5('0x1f')]);_0xe28d76['query']=_['keys'](_0x162fa0[_0x47a5('0x2c')]);_0xe28d76['filters']=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],_0xe28d76[_0x47a5('0x2c')]);_0x3c3ebf[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x162fa0['query']['fields']));_0x3c3ebf[_0x47a5('0x2f')]=_0x3c3ebf[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x3c3ebf[_0x47a5('0x2f')]:_0xe28d76[_0x47a5('0x2b')];if(!_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x41')]('nolimit')){_0x3c3ebf[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x162fa0[_0x47a5('0x2c')]['limit']);_0x3c3ebf[_0x47a5('0xf')]=qs['offset'](_0x162fa0[_0x47a5('0x2c')][_0x47a5('0xf')]);}_0x3c3ebf[_0x47a5('0x43')]=qs[_0x47a5('0x44')](_0x162fa0['query'][_0x47a5('0x44')]);_0x3c3ebf[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_[_0x47a5('0x46')](_0x162fa0[_0x47a5('0x2c')],_0xe28d76[_0x47a5('0x45')]));_0x3c3ebf[_0x47a5('0x24')]['SmsQueueId']=_0x49eab1['id'];if(_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x3c3ebf[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x3c3ebf[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x3c3ebf['attributes'],function(_0x1ad6a9){var _0x245a15={};_0x245a15[_0x1ad6a9]={'$like':'%'+_0x162fa0[_0x47a5('0x2c')]['filter']+'%'};return _0x245a15;})});}_0x3c3ebf=_[_0x47a5('0x31')]({},_0x3c3ebf,_0x162fa0[_0x47a5('0x32')]);return db[_0x47a5('0x3f')]['findAll'](_0x3c3ebf);}})['then'](function(_0x274e38){if(_0x274e38){return db[_0x47a5('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x274e38,_0x47a5('0x49')),'role':'agent'},'attributes':['id',_0x47a5('0x1b'),'smsPause','updatedAt',_0x47a5('0x4a')]});}})[_0x47a5('0x16')](function(_0x53eedf){if(_0x53eedf){return{'count':_0x53eedf[_0x47a5('0x11')],'rows':_[_0x47a5('0x1e')](_0x53eedf['rows'],function(_0x5b6127){return{'membername':_0x5b6127[_0x47a5('0x1b')],'UserId':_0x5b6127['id'],'queue_name':_0x3574d4[_0x47a5('0x1b')],'SmsQueueId':_0x3574d4['id'],'interface':util[_0x47a5('0x4b')](_0x47a5('0x4c'),'SIP',_0x5b6127[_0x47a5('0x1b')]),'penalty':0x0,'paused':_0x5b6127[_0x47a5('0x4d')],'createdAt':_0x5b6127[_0x47a5('0x4a')],'updatedAt':_0x5b6127['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x47a5('0x16')](respondWithFilteredResult(_0x24ecb1,_0x3c3ebf))['catch'](handleError(_0x24ecb1,null));};exports[_0x47a5('0x4e')]=function(_0x470da6,_0x943a15){var _0x1c485b={};var _0x3603b7={};var _0x4966af;var _0x144af9;return db['SmsQueue']['findOne']({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))[_0x47a5('0x16')](function(_0x6cd4ea){if(_0x6cd4ea){_0x4966af=_0x6cd4ea;_0x3603b7[_0x47a5('0x2b')]=_['keys'](db['Team'][_0x47a5('0x1f')]);_0x3603b7[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x470da6[_0x47a5('0x2c')]);_0x3603b7[_0x47a5('0x45')]=_['intersection'](_0x3603b7[_0x47a5('0x2b')],_0x3603b7['query']);_0x1c485b[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0x3603b7['model'],qs[_0x47a5('0x2e')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x1c485b[_0x47a5('0x2f')]=_0x1c485b[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x1c485b[_0x47a5('0x2f')]:_0x3603b7[_0x47a5('0x2b')];_0x1c485b['order']=qs[_0x47a5('0x44')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x44')]);_0x1c485b[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x470da6[_0x47a5('0x2c')],_0x3603b7[_0x47a5('0x45')]));if(_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x1c485b[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x1c485b[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x1c485b[_0x47a5('0x2f')],function(_0x44cb90){var _0x1d56f3={};_0x1d56f3[_0x44cb90]={'$like':'%'+_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x1d56f3;})});}_0x1c485b=_[_0x47a5('0x31')]({},_0x1c485b,_0x470da6[_0x47a5('0x32')]);return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x284fb8){if(_0x284fb8){_0x144af9=_0x284fb8[_0x47a5('0x40')];if(!_0x470da6['query'][_0x47a5('0x41')](_0x47a5('0x50'))){_0x1c485b[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x470da6['query'][_0x47a5('0x42')]);_0x1c485b['offset']=qs[_0x47a5('0xf')](_0x470da6['query'][_0x47a5('0xf')]);}return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x2f27c3){if(_0x2f27c3){return _0x2f27c3?{'count':_0x144af9,'rows':_0x2f27c3}:null;}})[_0x47a5('0x16')](respondWithResult(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports['addTeams']=function(_0x4b8084,_0x4164a3){var _0x2b1303=_0x4b8084[_0x47a5('0x3b')][_0x47a5('0x51')];return db['Team'][_0x47a5('0x52')]({'where':{'id':_0x2b1303},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id',_0x47a5('0x1b'),_0x47a5('0x54'),_0x47a5('0x55'),_0x47a5('0x56')],'raw':!![]}]})[_0x47a5('0x16')](function(_0x4618a0){if(_0x4618a0){var _0xc69a68=_[_0x47a5('0x57')](_0x4618a0,function(_0x463e5e){var _0x49d3dc=_0x463e5e[_0x47a5('0x17')]({'plain':!![]});return _0x49d3dc['Agents'];});return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x4b8084[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x40e584){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x448981){return _0x40e584[_0x47a5('0x5a')](_0x2b1303,{'transaction':_0x448981})[_0x47a5('0x16')](function(){return BPromise[_0x47a5('0x5b')](_0xc69a68,function(_0x1f07ac){return db[_0x47a5('0x3f')][_0x47a5('0x5c')]({'where':{'UserId':_0x1f07ac['id'],'SmsQueueId':_0x4b8084[_0x47a5('0x2a')]['id']},'transaction':_0x448981});});})['then'](function(){_0xc69a68['forEach'](function(_0x5ccc89){socket['emit'](_0x47a5('0x5d'),{'UserId':_0x5ccc89['id'],'SmsQueueId':_0x40e584['id']});});});});});}})[_0x47a5('0x16')](respondWithStatusCode(_0x4164a3,null))['catch'](handleError(_0x4164a3,null));};exports[_0x47a5('0x5e')]=function(_0x44dda2,_0x1baa5a){return db[_0x47a5('0x5f')][_0x47a5('0x52')]({'where':{'id':_0x44dda2[_0x47a5('0x2c')][_0x47a5('0x51')]},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id'],'raw':!![]}]})[_0x47a5('0x16')](handleEntityNotFound(_0x1baa5a,null))[_0x47a5('0x16')](function(_0x5e5f16){var _0x18fa31=_[_0x47a5('0x1e')](_0x5e5f16,'id');var _0x420671=[];var _0x4f35ff=[];var _0x340846=squel[_0x47a5('0x60')]();_0x340846[_0x47a5('0x61')]('tq.TeamId')[_0x47a5('0x62')]('team_has_sms_queues','tq')['join'](_0x47a5('0x63'),'ut',_0x47a5('0x64'))[_0x47a5('0x24')](_0x47a5('0x65'),_0x44dda2[_0x47a5('0x2a')]['id']);for(var _0xea50f3=0x0;_0xea50f3<_0x5e5f16['length'];_0xea50f3+=0x1){let _0x592322=_0x5e5f16[_0xea50f3];for(var _0x3e0dbd=0x0;_0x3e0dbd<_0x592322['Agents'][_0x47a5('0x40')];_0x3e0dbd+=0x1){let _0x3fffd1=_0x592322[_0x47a5('0x53')][_0x3e0dbd];var _0xb16bdd=_0x340846['clone']();_0xb16bdd[_0x47a5('0x24')]('ut.UserId\x20=\x20?',_0x3fffd1['id']);_0x4f35ff['push'](db[_0x47a5('0x58')][_0x47a5('0x2c')](_0xb16bdd['toString'](),{'type':db[_0x47a5('0x58')][_0x47a5('0x66')][_0x47a5('0x67')]})['then'](function(_0x280372){if(_0x280372['length']===0x1){return _0x3fffd1['id'];}else{var _0x2307da=_[_0x47a5('0x68')](_[_0x47a5('0x1e')](_0x280372,'TeamId'),function(_0x2e0af1){return _[_0x47a5('0x69')](_0x18fa31,_0x2e0af1);});if(_0x2307da){return _0x3fffd1['id'];}}}));}}return BPromise[_0x47a5('0x6a')](_0x4f35ff)['then'](function(_0x3525e7){_0x420671=_(_0x420671)['union'](_0x3525e7)[_0x47a5('0x6b')]()['value']();return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x44dda2[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x51738b){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x23c393){return _0x51738b[_0x47a5('0x5e')](_0x44dda2[_0x47a5('0x2c')]['ids'],{'transaction':_0x23c393})['then'](function(){if(!_[_0x47a5('0x6c')](_0x420671)){return _0x51738b['removeAgents'](_0x420671,{'transaction':_0x23c393});}})[_0x47a5('0x16')](function(){_0x420671[_0x47a5('0x6d')](function(_0x216402){socket['emit'](_0x47a5('0x6e'),{'UserId':_0x216402,'SmsQueueId':_0x51738b['id']});});});});});});})[_0x47a5('0x16')](respondWithStatusCode(_0x1baa5a,null))['catch'](handleError(_0x1baa5a,null));};exports[_0x47a5('0x6f')]=function(_0x8a9dea,_0x19acfa){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x8a9dea['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x19acfa,null))[_0x47a5('0x16')](function(_0x48e7f3){if(_0x48e7f3){return _0x48e7f3[_0x47a5('0x6f')](_0x8a9dea[_0x47a5('0x3b')]['ids'],_[_0x47a5('0x70')](_0x8a9dea[_0x47a5('0x3b')],[_0x47a5('0x51'),'id'])||{})['spread'](function(_0x3f2ad9){for(var _0x59b4a5=0x0;_0x59b4a5<_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x47a5('0x40')];_0x59b4a5+=0x1){socket[_0x47a5('0x71')]('userSmsQueue:save',{'UserId':Number(_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x59b4a5]),'SmsQueueId':Number(_0x8a9dea[_0x47a5('0x2a')]['id'])});}return _0x3f2ad9;});}})[_0x47a5('0x16')](respondWithResult(_0x19acfa,null))[_0x47a5('0x28')](handleError(_0x19acfa,null));};exports[_0x47a5('0x72')]=function(_0x49b76a,_0x3eb5c1){return db['SmsQueue']['find']({'where':{'id':_0x49b76a[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3eb5c1,null))[_0x47a5('0x16')](function(_0x96fb22){if(_0x96fb22){return _0x96fb22[_0x47a5('0x72')](_0x49b76a['query'][_0x47a5('0x51')])[_0x47a5('0x16')](function(){if(_[_0x47a5('0x73')](_0x49b76a[_0x47a5('0x2c')]['ids'])){for(var _0x240db9=0x0;_0x240db9<_0x49b76a['query'][_0x47a5('0x51')][_0x47a5('0x40')];_0x240db9+=0x1){socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a[_0x47a5('0x2c')][_0x47a5('0x51')][_0x240db9]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}}else{socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a['query'][_0x47a5('0x51')]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3eb5c1,null))[_0x47a5('0x28')](handleError(_0x3eb5c1,null));};exports[_0x47a5('0x74')]=function(_0x6d6a5,_0x5b85cd){var _0x4bf1f5={};var _0x126bb1={};var _0x3d7371;var _0x47fbb6;return db['SmsQueue'][_0x47a5('0x3e')]({'where':{'id':_0x6d6a5[_0x47a5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x16')](function(_0x269ff6){if(_0x269ff6){_0x3d7371=_0x269ff6;_0x126bb1['model']=_[_0x47a5('0x4f')](db[_0x47a5('0x48')][_0x47a5('0x1f')]);_0x126bb1[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x6d6a5[_0x47a5('0x2c')]);_0x126bb1['filters']=_['intersection'](_0x126bb1['model'],_0x126bb1[_0x47a5('0x2c')]);_0x4bf1f5[_0x47a5('0x2f')]=_['intersection'](_0x126bb1[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x4bf1f5[_0x47a5('0x2f')]=_0x4bf1f5['attributes'][_0x47a5('0x40')]?_0x4bf1f5['attributes']:_0x126bb1['model'];_0x4bf1f5['order']=qs[_0x47a5('0x44')](_0x6d6a5['query'][_0x47a5('0x44')]);_0x4bf1f5[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x6d6a5[_0x47a5('0x2c')],_0x126bb1[_0x47a5('0x45')]));if(_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x4bf1f5[_0x47a5('0x24')]=_['merge'](_0x4bf1f5[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x4bf1f5['attributes'],function(_0x42ba59){var _0x419870={};_0x419870[_0x42ba59]={'$like':'%'+_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x419870;})});}_0x4bf1f5=_[_0x47a5('0x31')]({},_0x4bf1f5,_0x6d6a5[_0x47a5('0x32')]);return _0x3d7371['getAgents'](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x2e418d){if(_0x2e418d){_0x47fbb6=_0x2e418d['length'];if(!_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x41')](_0x47a5('0x50'))){_0x4bf1f5[_0x47a5('0x42')]=qs['limit'](_0x6d6a5['query']['limit']);_0x4bf1f5['offset']=qs[_0x47a5('0xf')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0xf')]);}return _0x3d7371[_0x47a5('0x74')](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x6bc37b){if(_0x6bc37b){return _0x6bc37b?{'count':_0x47fbb6,'rows':_0x6bc37b}:null;}})[_0x47a5('0x16')](respondWithResult(_0x5b85cd,null))[_0x47a5('0x28')](handleError(_0x5b85cd,null));}; \ No newline at end of file +var _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x0b0e,0x187));var _0xe0b0=function(_0x397f37,_0x3cf86d){_0x397f37=_0x397f37-0x0;var _0x31cae6=_0x0b0e[_0x397f37];return _0x31cae6;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 1d42747..f44345c 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 _0x254d=['SmsQueue','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x4da370,_0x5b7190){var _0xf87893=function(_0xf3efb6){while(--_0xf3efb6){_0x4da370['push'](_0x4da370['shift']());}};_0xf87893(++_0x5b7190);}(_0x254d,0xbc));var _0xd254=function(_0x128bef,_0xc7a0af){_0x128bef=_0x128bef-0x0;var _0x1ba862=_0x254d[_0x128bef];return _0x1ba862;};'use strict';var EventEmitter=require(_0xd254('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xd254('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd254('0x2')](0x0);var events={'afterCreate':_0xd254('0x3'),'afterUpdate':_0xd254('0x4'),'afterDestroy':_0xd254('0x5')};function emitEvent(_0x397846){return function(_0x3a20f9,_0x102df3,_0x149009){SmsQueueEvents[_0xd254('0x6')](_0x397846+':'+_0x3a20f9['id'],_0x3a20f9);SmsQueueEvents[_0xd254('0x6')](_0x397846,_0x3a20f9);_0x149009(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xd254('0x7')](e,emitEvent(event));}}module[_0xd254('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x7976=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','SmsQueue'];(function(_0x3c9f45,_0x80b642){var _0x4b6e1a=function(_0x267b3b){while(--_0x267b3b){_0x3c9f45['push'](_0x3c9f45['shift']());}};_0x4b6e1a(++_0x80b642);}(_0x7976,0x1cd));var _0x6797=function(_0x40644d,_0x4ed061){_0x40644d=_0x40644d-0x0;var _0x5630aa=_0x7976[_0x40644d];return _0x5630aa;};'use strict';var EventEmitter=require(_0x6797('0x0'));var SmsQueue=require(_0x6797('0x1'))['db'][_0x6797('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6797('0x3'),'afterUpdate':_0x6797('0x4'),'afterDestroy':'remove'};function emitEvent(_0x75c61d){return function(_0xef8725,_0x5422c7,_0x537d63){SmsQueueEvents[_0x6797('0x5')](_0x75c61d+':'+_0xef8725['id'],_0xef8725);SmsQueueEvents[_0x6797('0x5')](_0x75c61d,_0xef8725);_0x537d63(null);};}for(var e in events){if(events[_0x6797('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x6797('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 295b552..3f1463b 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 _0x9890=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues'];(function(_0x146a97,_0x2d8483){var _0x259d5c=function(_0x3ca436){while(--_0x3ca436){_0x146a97['push'](_0x146a97['shift']());}};_0x259d5c(++_0x2d8483);}(_0x9890,0x104));var _0x0989=function(_0x4c2d7b,_0x37e367){_0x4c2d7b=_0x4c2d7b-0x0;var _0x2302c7=_0x9890[_0x4c2d7b];return _0x2302c7;};'use strict';var _=require(_0x0989('0x0'));var util=require('util');var logger=require(_0x0989('0x1'))(_0x0989('0x2'));var moment=require(_0x0989('0x3'));var BPromise=require(_0x0989('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0989('0x5'));var rimraf=require(_0x0989('0x6'));var config=require(_0x0989('0x7'));var attributes=require(_0x0989('0x8'));module[_0x0989('0x9')]=function(_0x262f23,_0x18c73){return _0x262f23[_0x0989('0xa')](_0x0989('0xb'),attributes,{'tableName':_0x0989('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad01=['./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xad01,0x155));var _0x1ad0=function(_0x411585,_0x5d2e60){_0x411585=_0x411585-0x0;var _0x53d869=_0xad01[_0x411585];return _0x53d869;};'use strict';var _=require(_0x1ad0('0x0'));var util=require(_0x1ad0('0x1'));var logger=require('../../config/logger')(_0x1ad0('0x2'));var moment=require(_0x1ad0('0x3'));var BPromise=require(_0x1ad0('0x4'));var rp=require(_0x1ad0('0x5'));var fs=require('fs');var path=require(_0x1ad0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1ad0('0x7'));module[_0x1ad0('0x8')]=function(_0x414618,_0x261e3b){return _0x414618[_0x1ad0('0x9')](_0x1ad0('0xa'),attributes,{'tableName':_0x1ad0('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 9aff7a7..f0df9c1 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 _0xa174=['SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','register','request','then','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue'];(function(_0x3b111a,_0x89f72e){var _0x569483=function(_0x5418aa){while(--_0x5418aa){_0x3b111a['push'](_0x3b111a['shift']());}};_0x569483(++_0x89f72e);}(_0xa174,0x1df));var _0x4a17=function(_0x5a6ab3,_0x2ae54e){_0x5a6ab3=_0x5a6ab3-0x0;var _0x1961a3=_0xa174[_0x5a6ab3];return _0x1961a3;};'use strict';var _=require('lodash');var util=require(_0x4a17('0x0'));var moment=require(_0x4a17('0x1'));var BPromise=require(_0x4a17('0x2'));var rs=require(_0x4a17('0x3'));var fs=require('fs');var Redis=require(_0x4a17('0x4'));var db=require(_0x4a17('0x5'))['db'];var utils=require(_0x4a17('0x6'));var logger=require(_0x4a17('0x7'))('rpc');var config=require(_0x4a17('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4a17('0x9')][_0x4a17('0xa')]({'port':0x232a});config['redis']=_[_0x4a17('0xb')](config[_0x4a17('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a17('0xc')]));require('./smsQueue.socket')[_0x4a17('0xd')](socket);function respondWithRpcPromise(_0x36f7c4,_0x256060,_0x571f01){return new BPromise(function(_0x7cd21b,_0x13a475){return client[_0x4a17('0xe')](_0x36f7c4,_0x571f01)[_0x4a17('0xf')](function(_0x49ce3d){logger[_0x4a17('0x10')]('SmsQueue,\x20%s,\x20%s',_0x256060,'request\x20sent');logger[_0x4a17('0x11')](_0x4a17('0x12'),_0x256060,_0x4a17('0x13'),JSON[_0x4a17('0x14')](_0x49ce3d));if(_0x49ce3d['error']){if(_0x49ce3d[_0x4a17('0x15')][_0x4a17('0x16')]===0x1f4){logger['error'](_0x4a17('0x17'),_0x256060,_0x49ce3d[_0x4a17('0x15')][_0x4a17('0x18')]);return _0x13a475(_0x49ce3d['error'][_0x4a17('0x18')]);}logger[_0x4a17('0x15')](_0x4a17('0x17'),_0x256060,_0x49ce3d['error'][_0x4a17('0x18')]);return _0x7cd21b(_0x49ce3d[_0x4a17('0x15')][_0x4a17('0x18')]);}else{logger[_0x4a17('0x10')]('SmsQueue,\x20%s,\x20%s',_0x256060,_0x4a17('0x13'));_0x7cd21b(_0x49ce3d[_0x4a17('0x19')][_0x4a17('0x18')]);}})[_0x4a17('0x1a')](function(_0x1e8902){logger[_0x4a17('0x15')](_0x4a17('0x17'),_0x256060,_0x1e8902);_0x13a475(_0x1e8902);});});}exports[_0x4a17('0x1b')]=function(_0xbc91d5){var _0x2a5be4=this;return new Promise(function(_0xcc16d4,_0x333e11){return db[_0x4a17('0x1c')][_0x4a17('0x1d')]({'raw':_0xbc91d5[_0x4a17('0x1e')]?_0xbc91d5[_0x4a17('0x1e')][_0x4a17('0x1f')]===undefined?!![]:![]:!![],'where':_0xbc91d5[_0x4a17('0x1e')]?_0xbc91d5[_0x4a17('0x1e')][_0x4a17('0x20')]||null:null,'attributes':_0xbc91d5[_0x4a17('0x1e')]?_0xbc91d5[_0x4a17('0x1e')][_0x4a17('0x21')]||null:null,'limit':_0xbc91d5[_0x4a17('0x1e')]?_0xbc91d5[_0x4a17('0x1e')][_0x4a17('0x22')]||null:null,'include':_0xbc91d5['options']?_0xbc91d5[_0x4a17('0x1e')][_0x4a17('0x23')]?_[_0x4a17('0x24')](_0xbc91d5[_0x4a17('0x1e')]['include'],function(_0x5b6fff){return{'model':db[_0x5b6fff[_0x4a17('0x25')]],'as':_0x5b6fff['as'],'attributes':_0x5b6fff[_0x4a17('0x21')],'include':_0x5b6fff[_0x4a17('0x23')]?_[_0x4a17('0x24')](_0x5b6fff[_0x4a17('0x23')],function(_0x4632b0){return{'model':db[_0x4632b0[_0x4a17('0x25')]],'as':_0x4632b0['as'],'attributes':_0x4632b0['attributes'],'include':_0x4632b0[_0x4a17('0x23')]?_[_0x4a17('0x24')](_0x4632b0[_0x4a17('0x23')],function(_0x226a93){return{'model':db[_0x226a93[_0x4a17('0x25')]],'as':_0x226a93['as'],'attributes':_0x226a93['attributes']};}):[]};}):[]};}):[]:[]})[_0x4a17('0xf')](function(_0x1d6dfa){logger[_0x4a17('0x10')](_0x4a17('0x1b'),_0xbc91d5);logger[_0x4a17('0x11')](_0x4a17('0x1b'),_0xbc91d5,JSON[_0x4a17('0x14')](_0x1d6dfa));_0xcc16d4(_0x1d6dfa);})[_0x4a17('0x1a')](function(_0xf79a67){logger[_0x4a17('0x15')](_0x4a17('0x1b'),_0xf79a67[_0x4a17('0x18')],_0xbc91d5);_0x333e11(_0x2a5be4[_0x4a17('0x15')](0x1f4,_0xf79a67[_0x4a17('0x18')]));});});};exports[_0x4a17('0x26')]=function(_0xecc773){var _0x215d19=this;return new Promise(function(_0x590f56,_0x548ca3){return db['SmsQueue']['find']({'raw':_0xecc773[_0x4a17('0x1e')]?_0xecc773['options'][_0x4a17('0x1f')]===undefined?!![]:![]:!![],'where':_0xecc773[_0x4a17('0x1e')]?_0xecc773['options'][_0x4a17('0x20')]||null:null,'attributes':_0xecc773[_0x4a17('0x1e')]?_0xecc773['options']['attributes']||null:null,'include':_0xecc773['options']?_0xecc773[_0x4a17('0x1e')][_0x4a17('0x23')]?_[_0x4a17('0x24')](_0xecc773[_0x4a17('0x1e')]['include'],function(_0x471e11){return{'model':db[_0x471e11[_0x4a17('0x25')]],'as':_0x471e11['as'],'attributes':_0x471e11['attributes'],'include':_0x471e11[_0x4a17('0x23')]?_[_0x4a17('0x24')](_0x471e11[_0x4a17('0x23')],function(_0x40714d){return{'model':db[_0x40714d[_0x4a17('0x25')]],'as':_0x40714d['as'],'attributes':_0x40714d[_0x4a17('0x21')],'include':_0x40714d[_0x4a17('0x23')]?_['map'](_0x40714d[_0x4a17('0x23')],function(_0x30eb41){return{'model':db[_0x30eb41[_0x4a17('0x25')]],'as':_0x30eb41['as'],'attributes':_0x30eb41[_0x4a17('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4a17('0xf')](function(_0x5affe9){logger['info']('ShowSmsQueue',_0xecc773);logger[_0x4a17('0x11')]('ShowSmsQueue',_0xecc773,JSON['stringify'](_0x5affe9));_0x590f56(_0x5affe9);})[_0x4a17('0x1a')](function(_0x4499c0){logger[_0x4a17('0x15')](_0x4a17('0x26'),_0x4499c0['message'],_0xecc773);_0x548ca3(_0x215d19[_0x4a17('0x15')](0x1f4,_0x4499c0['message']));});});}; \ No newline at end of file +var _0x979d=['include','model','attributes','map','then','ShowSmsQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','request','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','limit'];(function(_0x5e96ee,_0x4a8378){var _0x4e1744=function(_0x48a512){while(--_0x48a512){_0x5e96ee['push'](_0x5e96ee['shift']());}};_0x4e1744(++_0x4a8378);}(_0x979d,0xaf));var _0xd979=function(_0x75f3a6,_0xd9fe3){_0x75f3a6=_0x75f3a6-0x0;var _0x11adf6=_0x979d[_0x75f3a6];return _0x11adf6;};'use strict';var _=require('lodash');var util=require(_0xd979('0x0'));var moment=require(_0xd979('0x1'));var BPromise=require(_0xd979('0x2'));var rs=require(_0xd979('0x3'));var fs=require('fs');var Redis=require(_0xd979('0x4'));var db=require(_0xd979('0x5'))['db'];var utils=require(_0xd979('0x6'));var logger=require('../../config/logger')(_0xd979('0x7'));var config=require(_0xd979('0x8'));var jayson=require(_0xd979('0x9'));var client=jayson[_0xd979('0xa')][_0xd979('0xb')]({'port':0x232a});config[_0xd979('0xc')]=_[_0xd979('0xd')](config[_0xd979('0xc')],{'host':_0xd979('0xe'),'port':0x18eb});var socket=require(_0xd979('0xf'))(new Redis(config[_0xd979('0xc')]));require(_0xd979('0x10'))['register'](socket);function respondWithRpcPromise(_0xd35ebd,_0x2e9675,_0x4fda0d){return new BPromise(function(_0x429980,_0x1e9e78){return client[_0xd979('0x11')](_0xd35ebd,_0x4fda0d)['then'](function(_0x546d1a){logger['info'](_0xd979('0x12'),_0x2e9675,_0xd979('0x13'));logger[_0xd979('0x14')](_0xd979('0x15'),_0x2e9675,'request\x20sent',JSON[_0xd979('0x16')](_0x546d1a));if(_0x546d1a[_0xd979('0x17')]){if(_0x546d1a[_0xd979('0x17')]['code']===0x1f4){logger[_0xd979('0x17')](_0xd979('0x12'),_0x2e9675,_0x546d1a[_0xd979('0x17')][_0xd979('0x18')]);return _0x1e9e78(_0x546d1a[_0xd979('0x17')][_0xd979('0x18')]);}logger[_0xd979('0x17')](_0xd979('0x12'),_0x2e9675,_0x546d1a[_0xd979('0x17')][_0xd979('0x18')]);return _0x429980(_0x546d1a[_0xd979('0x17')][_0xd979('0x18')]);}else{logger[_0xd979('0x19')]('SmsQueue,\x20%s,\x20%s',_0x2e9675,_0xd979('0x13'));_0x429980(_0x546d1a[_0xd979('0x1a')]['message']);}})[_0xd979('0x1b')](function(_0x1df35c){logger[_0xd979('0x17')]('SmsQueue,\x20%s,\x20%s',_0x2e9675,_0x1df35c);_0x1e9e78(_0x1df35c);});});}exports[_0xd979('0x1c')]=function(_0x5f55d5){var _0x5c9c00=this;return new Promise(function(_0x1c4dc9,_0x16d812){return db[_0xd979('0x1d')][_0xd979('0x1e')]({'raw':_0x5f55d5[_0xd979('0x1f')]?_0x5f55d5[_0xd979('0x1f')][_0xd979('0x20')]===undefined?!![]:![]:!![],'where':_0x5f55d5[_0xd979('0x1f')]?_0x5f55d5[_0xd979('0x1f')][_0xd979('0x21')]||null:null,'attributes':_0x5f55d5[_0xd979('0x1f')]?_0x5f55d5[_0xd979('0x1f')]['attributes']||null:null,'limit':_0x5f55d5['options']?_0x5f55d5['options'][_0xd979('0x22')]||null:null,'include':_0x5f55d5[_0xd979('0x1f')]?_0x5f55d5[_0xd979('0x1f')][_0xd979('0x23')]?_['map'](_0x5f55d5['options']['include'],function(_0x4a22cc){return{'model':db[_0x4a22cc[_0xd979('0x24')]],'as':_0x4a22cc['as'],'attributes':_0x4a22cc[_0xd979('0x25')],'include':_0x4a22cc[_0xd979('0x23')]?_[_0xd979('0x26')](_0x4a22cc[_0xd979('0x23')],function(_0x577af1){return{'model':db[_0x577af1[_0xd979('0x24')]],'as':_0x577af1['as'],'attributes':_0x577af1[_0xd979('0x25')],'include':_0x577af1[_0xd979('0x23')]?_[_0xd979('0x26')](_0x577af1[_0xd979('0x23')],function(_0xef85cb){return{'model':db[_0xef85cb['model']],'as':_0xef85cb['as'],'attributes':_0xef85cb[_0xd979('0x25')]};}):[]};}):[]};}):[]:[]})[_0xd979('0x27')](function(_0xdce654){logger[_0xd979('0x19')]('GetSmsQueue',_0x5f55d5);logger[_0xd979('0x14')](_0xd979('0x1c'),_0x5f55d5,JSON[_0xd979('0x16')](_0xdce654));_0x1c4dc9(_0xdce654);})['catch'](function(_0x1bcdb3){logger[_0xd979('0x17')](_0xd979('0x1c'),_0x1bcdb3[_0xd979('0x18')],_0x5f55d5);_0x16d812(_0x5c9c00[_0xd979('0x17')](0x1f4,_0x1bcdb3[_0xd979('0x18')]));});});};exports[_0xd979('0x28')]=function(_0x2375eb){var _0x346568=this;return new Promise(function(_0x3bc069,_0x62d2c){return db[_0xd979('0x1d')][_0xd979('0x29')]({'raw':_0x2375eb[_0xd979('0x1f')]?_0x2375eb[_0xd979('0x1f')][_0xd979('0x20')]===undefined?!![]:![]:!![],'where':_0x2375eb['options']?_0x2375eb[_0xd979('0x1f')]['where']||null:null,'attributes':_0x2375eb[_0xd979('0x1f')]?_0x2375eb['options'][_0xd979('0x25')]||null:null,'include':_0x2375eb[_0xd979('0x1f')]?_0x2375eb[_0xd979('0x1f')][_0xd979('0x23')]?_['map'](_0x2375eb['options']['include'],function(_0x363bb2){return{'model':db[_0x363bb2[_0xd979('0x24')]],'as':_0x363bb2['as'],'attributes':_0x363bb2[_0xd979('0x25')],'include':_0x363bb2[_0xd979('0x23')]?_[_0xd979('0x26')](_0x363bb2[_0xd979('0x23')],function(_0x19382f){return{'model':db[_0x19382f[_0xd979('0x24')]],'as':_0x19382f['as'],'attributes':_0x19382f[_0xd979('0x25')],'include':_0x19382f[_0xd979('0x23')]?_[_0xd979('0x26')](_0x19382f[_0xd979('0x23')],function(_0x2489c0){return{'model':db[_0x2489c0[_0xd979('0x24')]],'as':_0x2489c0['as'],'attributes':_0x2489c0['attributes']};}):[]};}):[]};}):[]:[]})[_0xd979('0x27')](function(_0xcbb6dd){logger['info'](_0xd979('0x28'),_0x2375eb);logger[_0xd979('0x14')](_0xd979('0x28'),_0x2375eb,JSON[_0xd979('0x16')](_0xcbb6dd));_0x3bc069(_0xcbb6dd);})['catch'](function(_0x46f454){logger[_0xd979('0x17')](_0xd979('0x28'),_0x46f454[_0xd979('0x18')],_0x2375eb);_0x62d2c(_0x346568[_0xd979('0x17')](0x1f4,_0x46f454[_0xd979('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 50a3e98..9888263 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 _0xbdac=['save','update','emit','removeListener','register','length','./smsQueue.events'];(function(_0x52aa80,_0x1973af){var _0x4fdb07=function(_0x56afa7){while(--_0x56afa7){_0x52aa80['push'](_0x52aa80['shift']());}};_0x4fdb07(++_0x1973af);}(_0xbdac,0xc3));var _0xcbda=function(_0x33b275,_0x3a3a33){_0x33b275=_0x33b275-0x0;var _0x4fa071=_0xbdac[_0x33b275];return _0x4fa071;};'use strict';var SmsQueueEvents=require(_0xcbda('0x0'));var events=[_0xcbda('0x1'),'remove',_0xcbda('0x2')];function createListener(_0x127f81,_0x5b4856){return function(_0x35b37e){_0x5b4856[_0xcbda('0x3')](_0x127f81,_0x35b37e);};}function removeListener(_0x3249b6,_0x33ff10){return function(){SmsQueueEvents[_0xcbda('0x4')](_0x3249b6,_0x33ff10);};}exports[_0xcbda('0x5')]=function(_0x3be09f){for(var _0x383642=0x0,_0x2849b6=events[_0xcbda('0x6')];_0x383642<_0x2849b6;_0x383642++){var _0x58feaf=events[_0x383642];var _0x1642d6=createListener('smsQueue:'+_0x58feaf,_0x3be09f);SmsQueueEvents['on'](_0x58feaf,_0x1642d6);}}; \ No newline at end of file +var _0xb432=['smsQueue:','./smsQueue.events','save','update','emit','removeListener','register'];(function(_0x485362,_0x4cca7d){var _0x5d76fa=function(_0x456fb0){while(--_0x456fb0){_0x485362['push'](_0x485362['shift']());}};_0x5d76fa(++_0x4cca7d);}(_0xb432,0x10b));var _0x2b43=function(_0x1c6170,_0x2ee8da){_0x1c6170=_0x1c6170-0x0;var _0x23a03f=_0xb432[_0x1c6170];return _0x23a03f;};'use strict';var SmsQueueEvents=require(_0x2b43('0x0'));var events=[_0x2b43('0x1'),'remove',_0x2b43('0x2')];function createListener(_0x25c1f1,_0x362bf0){return function(_0x2214d4){_0x362bf0[_0x2b43('0x3')](_0x25c1f1,_0x2214d4);};}function removeListener(_0xb8c062,_0x25b3f8){return function(){SmsQueueEvents[_0x2b43('0x4')](_0xb8c062,_0x25b3f8);};}exports[_0x2b43('0x5')]=function(_0x253d33){for(var _0x23dab6=0x0,_0x2a24fa=events['length'];_0x23dab6<_0x2a24fa;_0x23dab6++){var _0x55f06d=events[_0x23dab6];var _0x5cc755=createListener(_0x2b43('0x6')+_0x55f06d,_0x253d33);SmsQueueEvents['on'](_0x55f06d,_0x5cc755);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index ea2cf35..4137fbf 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 _0x3051=['describe','/:id','post','create','put','update','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0xb94cbf,_0x15dd63){var _0x70e545=function(_0x2a8682){while(--_0x2a8682){_0xb94cbf['push'](_0xb94cbf['shift']());}};_0x70e545(++_0x15dd63);}(_0x3051,0x85));var _0x1305=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3051[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1305('0x0'));var express=require(_0x1305('0x1'));var router=express[_0x1305('0x2')]();var fs_extra=require(_0x1305('0x3'));var auth=require(_0x1305('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1305('0x5'));var controller=require(_0x1305('0x6'));router[_0x1305('0x7')]('/',auth[_0x1305('0x8')](),controller[_0x1305('0x9')]);router[_0x1305('0x7')](_0x1305('0xa'),auth[_0x1305('0x8')](),controller[_0x1305('0xb')]);router[_0x1305('0x7')](_0x1305('0xc'),auth[_0x1305('0x8')](),controller['show']);router[_0x1305('0xd')]('/',auth[_0x1305('0x8')](),controller[_0x1305('0xe')]);router[_0x1305('0xf')]('/:id',auth[_0x1305('0x8')](),controller[_0x1305('0x10')]);router['delete'](_0x1305('0xc'),auth[_0x1305('0x8')](),controller['destroy']);module[_0x1305('0x11')]=router; \ No newline at end of file +var _0x0dee=['../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','get','/describe','post','create','put','update','delete','/:id','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x0dee,0xf7));var _0xe0de=function(_0x528943,_0x3850fd){_0x528943=_0x528943-0x0;var _0x3e5af0=_0x0dee[_0x528943];return _0x3e5af0;};'use strict';var multer=require(_0xe0de('0x0'));var util=require(_0xe0de('0x1'));var path=require('path');var timeout=require(_0xe0de('0x2'));var express=require('express');var router=express[_0xe0de('0x3')]();var fs_extra=require(_0xe0de('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe0de('0x5'));var config=require(_0xe0de('0x6'));var controller=require(_0xe0de('0x7'));router['get']('/',auth[_0xe0de('0x8')](),controller['index']);router[_0xe0de('0x9')](_0xe0de('0xa'),auth[_0xe0de('0x8')](),controller['describe']);router[_0xe0de('0x9')]('/:id',auth[_0xe0de('0x8')](),controller['show']);router[_0xe0de('0xb')]('/',auth[_0xe0de('0x8')](),controller[_0xe0de('0xc')]);router[_0xe0de('0xd')]('/:id',auth[_0xe0de('0x8')](),controller[_0xe0de('0xe')]);router[_0xe0de('0xf')](_0xe0de('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xe0de('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index bc15c8b..bc22d4d 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 _0xad76=['STRING','DATE','moment'];(function(_0x45076d,_0x4fd37e){var _0x3aa6db=function(_0x22ac1d){while(--_0x22ac1d){_0x45076d['push'](_0x45076d['shift']());}};_0x3aa6db(++_0x4fd37e);}(_0xad76,0x17c));var _0x6ad7=function(_0x510657,_0x581154){_0x510657=_0x510657-0x0;var _0x53d5e2=_0xad76[_0x510657];return _0x53d5e2;};'use strict';var moment=require(_0x6ad7('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x6ad7('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6ad7('0x2')]},'acceptAt':{'type':Sequelize[_0x6ad7('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb2d8=['DATE','STRING'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xb2d8,0xd7));var _0x8b2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2d8[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x8b2d('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0x8b2d('0x0')]},'joinAt':{'type':Sequelize[_0x8b2d('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8b2d('0x1')]},'exitAt':{'type':Sequelize[_0x8b2d('0x1')]},'reason':{'type':Sequelize[_0x8b2d('0x0')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 46170f5..5ac823e 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 _0x1ca7=['ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x1ca7,0x18a));var _0x71ca=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x1ca7[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x71ca('0x0'));var rimraf=require(_0x71ca('0x1'));var zipdir=require(_0x71ca('0x2'));var jsonpatch=require(_0x71ca('0x3'));var rp=require(_0x71ca('0x4'));var moment=require(_0x71ca('0x5'));var BPromise=require(_0x71ca('0x6'));var Mustache=require(_0x71ca('0x7'));var util=require(_0x71ca('0x8'));var path=require(_0x71ca('0x9'));var sox=require(_0x71ca('0xa'));var csv=require('to-csv');var ejs=require(_0x71ca('0xb'));var fs=require('fs');var fs_extra=require(_0x71ca('0xc'));var _=require(_0x71ca('0xd'));var squel=require(_0x71ca('0xe'));var crypto=require(_0x71ca('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x71ca('0x10'));var toCsv=require(_0x71ca('0x11'));var querystring=require(_0x71ca('0x12'));var Papa=require(_0x71ca('0x13'));var Redis=require(_0x71ca('0x14'));var authService=require(_0x71ca('0x15'));var qs=require(_0x71ca('0x16'));var as=require(_0x71ca('0x17'));var hardwareService=require(_0x71ca('0x18'));var logger=require(_0x71ca('0x19'))(_0x71ca('0x1a'));var utils=require(_0x71ca('0x1b'));var config=require(_0x71ca('0x1c'));var licenseUtil=require(_0x71ca('0x1d'));var db=require(_0x71ca('0x1e'))['db'];function respondWithStatusCode(_0x58b889,_0x4fdee7){_0x4fdee7=_0x4fdee7||0xcc;return function(_0x4c18c9){if(_0x4c18c9){return _0x58b889['sendStatus'](_0x4fdee7);}return _0x58b889['status'](_0x4fdee7)[_0x71ca('0x1f')]();};}function respondWithResult(_0x4108c5,_0x59c4fa){_0x59c4fa=_0x59c4fa||0xc8;return function(_0x2ef928){if(_0x2ef928){return _0x4108c5[_0x71ca('0x20')](_0x59c4fa)[_0x71ca('0x21')](_0x2ef928);}};}function respondWithFilteredResult(_0x4ce15f,_0x466775){return function(_0x19b2fd){if(_0x19b2fd){var _0x353d46=typeof _0x466775[_0x71ca('0x22')]===_0x71ca('0x23')&&typeof _0x466775['limit']===_0x71ca('0x23');var _0xbc5977=_0x19b2fd[_0x71ca('0x24')];var _0x4fd8d6=_0x353d46?0x0:_0x466775[_0x71ca('0x22')];var _0x247b32=_0x353d46?_0x19b2fd[_0x71ca('0x24')]:_0x466775[_0x71ca('0x22')]+_0x466775['limit'];var _0x28fbda;if(_0x247b32>=_0xbc5977){_0x247b32=_0xbc5977;_0x28fbda=0xc8;}else{_0x28fbda=0xce;}_0x4ce15f[_0x71ca('0x20')](_0x28fbda);return _0x4ce15f[_0x71ca('0x25')](_0x71ca('0x26'),_0x4fd8d6+'-'+_0x247b32+'/'+_0xbc5977)['json'](_0x19b2fd);}return null;};}function patchUpdates(_0x38e576){return function(_0x61aa55){try{jsonpatch['apply'](_0x61aa55,_0x38e576,!![]);}catch(_0x10978a){return BPromise[_0x71ca('0x27')](_0x10978a);}return _0x61aa55[_0x71ca('0x28')]();};}function saveUpdates(_0xc4af1c,_0x4c407d){return function(_0x1afe29){if(_0x1afe29){return _0x1afe29[_0x71ca('0x29')](_0xc4af1c)[_0x71ca('0x2a')](function(_0x326782){return _0x326782;});}return null;};}function removeEntity(_0xe3f006,_0x56d5ce){return function(_0x99d3a0){if(_0x99d3a0){return _0x99d3a0['destroy']()['then'](function(){_0xe3f006[_0x71ca('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x391545,_0x373758){return function(_0x4fef2e){if(!_0x4fef2e){_0x391545[_0x71ca('0x2b')](0x194);}return _0x4fef2e;};}function handleError(_0x37f79b,_0x80e079){_0x80e079=_0x80e079||0x1f4;return function(_0x244aca){logger[_0x71ca('0x2c')](_0x244aca[_0x71ca('0x2d')]);if(_0x244aca[_0x71ca('0x2e')]){delete _0x244aca[_0x71ca('0x2e')];}_0x37f79b['status'](_0x80e079)[_0x71ca('0x2f')](_0x244aca);};}exports[_0x71ca('0x30')]=function(_0x40224d,_0x1bf7ac){var _0x4a0476={},_0x468609={},_0xe3c633={'count':0x0,'rows':[]};var _0x4a551e=_[_0x71ca('0x31')](db[_0x71ca('0x32')][_0x71ca('0x33')],function(_0x46c05f){return{'name':_0x46c05f['fieldName'],'type':_0x46c05f[_0x71ca('0x34')][_0x71ca('0x35')]};});_0x468609[_0x71ca('0x36')]=_['map'](_0x4a551e,_0x71ca('0x2e'));_0x468609[_0x71ca('0x37')]=_[_0x71ca('0x38')](_0x40224d[_0x71ca('0x37')]);_0x468609[_0x71ca('0x39')]=_[_0x71ca('0x3a')](_0x468609['model'],_0x468609['query']);_0x4a0476[_0x71ca('0x3b')]=_[_0x71ca('0x3a')](_0x468609[_0x71ca('0x36')],qs[_0x71ca('0x3c')](_0x40224d[_0x71ca('0x37')][_0x71ca('0x3c')]));_0x4a0476['attributes']=_0x4a0476[_0x71ca('0x3b')][_0x71ca('0x3d')]?_0x4a0476[_0x71ca('0x3b')]:_0x468609[_0x71ca('0x36')];if(!_0x40224d['query'][_0x71ca('0x3e')]('nolimit')){_0x4a0476[_0x71ca('0x3f')]=qs['limit'](_0x40224d['query']['limit']);_0x4a0476[_0x71ca('0x22')]=qs['offset'](_0x40224d['query'][_0x71ca('0x22')]);}_0x4a0476[_0x71ca('0x40')]=qs[_0x71ca('0x41')](_0x40224d['query'][_0x71ca('0x41')]);_0x4a0476[_0x71ca('0x42')]=qs[_0x71ca('0x39')](_['pick'](_0x40224d[_0x71ca('0x37')],_0x468609[_0x71ca('0x39')]),_0x4a551e);if(_0x40224d[_0x71ca('0x37')][_0x71ca('0x43')]){_0x4a0476[_0x71ca('0x42')]=_['merge'](_0x4a0476[_0x71ca('0x42')],{'$or':_[_0x71ca('0x31')](_0x4a551e,function(_0x7e3bf5){if(_0x7e3bf5['type']!=='VIRTUAL'){var _0x2045d5={};_0x2045d5[_0x7e3bf5[_0x71ca('0x2e')]]={'$like':'%'+_0x40224d[_0x71ca('0x37')]['filter']+'%'};return _0x2045d5;}})});}_0x4a0476=_[_0x71ca('0x44')]({},_0x4a0476,_0x40224d[_0x71ca('0x45')]);var _0x5ce146={'where':_0x4a0476[_0x71ca('0x42')]};return db['SmsQueueReport'][_0x71ca('0x24')](_0x5ce146)[_0x71ca('0x2a')](function(_0x34b781){_0xe3c633[_0x71ca('0x24')]=_0x34b781;if(_0x40224d[_0x71ca('0x37')][_0x71ca('0x46')]){_0x4a0476[_0x71ca('0x47')]=[{'all':!![]}];}return db[_0x71ca('0x32')]['findAll'](_0x4a0476);})[_0x71ca('0x2a')](function(_0x25ac31){_0xe3c633[_0x71ca('0x48')]=_0x25ac31;return _0xe3c633;})[_0x71ca('0x2a')](respondWithFilteredResult(_0x1bf7ac,_0x4a0476))[_0x71ca('0x49')](handleError(_0x1bf7ac,null));};exports[_0x71ca('0x4a')]=function(_0x5c66fc,_0x571c0d){var _0x21375b={'raw':!![],'where':{'id':_0x5c66fc[_0x71ca('0x4b')]['id']}},_0x16de1f={};_0x16de1f[_0x71ca('0x36')]=_[_0x71ca('0x38')](db[_0x71ca('0x32')][_0x71ca('0x33')]);_0x16de1f[_0x71ca('0x37')]=_[_0x71ca('0x38')](_0x5c66fc['query']);_0x16de1f[_0x71ca('0x39')]=_[_0x71ca('0x3a')](_0x16de1f[_0x71ca('0x36')],_0x16de1f[_0x71ca('0x37')]);_0x21375b[_0x71ca('0x3b')]=_[_0x71ca('0x3a')](_0x16de1f[_0x71ca('0x36')],qs[_0x71ca('0x3c')](_0x5c66fc['query'][_0x71ca('0x3c')]));_0x21375b['attributes']=_0x21375b['attributes'][_0x71ca('0x3d')]?_0x21375b[_0x71ca('0x3b')]:_0x16de1f[_0x71ca('0x36')];if(_0x5c66fc['query']['includeAll']){_0x21375b['include']=[{'all':!![]}];}_0x21375b=_['merge']({},_0x21375b,_0x5c66fc[_0x71ca('0x45')]);return db['SmsQueueReport'][_0x71ca('0x4c')](_0x21375b)[_0x71ca('0x2a')](handleEntityNotFound(_0x571c0d,null))[_0x71ca('0x2a')](respondWithResult(_0x571c0d,null))['catch'](handleError(_0x571c0d,null));};exports[_0x71ca('0x4d')]=function(_0x47bcc2,_0x48855c){return db[_0x71ca('0x32')]['create'](_0x47bcc2[_0x71ca('0x4e')],{})['then'](respondWithResult(_0x48855c,0xc9))[_0x71ca('0x49')](handleError(_0x48855c,null));};exports['update']=function(_0x2a5f01,_0x826e09){if(_0x2a5f01[_0x71ca('0x4e')]['id']){delete _0x2a5f01[_0x71ca('0x4e')]['id'];}return db[_0x71ca('0x32')][_0x71ca('0x4c')]({'where':{'id':_0x2a5f01[_0x71ca('0x4b')]['id']}})[_0x71ca('0x2a')](handleEntityNotFound(_0x826e09,null))[_0x71ca('0x2a')](saveUpdates(_0x2a5f01['body'],null))[_0x71ca('0x2a')](respondWithResult(_0x826e09,null))[_0x71ca('0x49')](handleError(_0x826e09,null));};exports[_0x71ca('0x4f')]=function(_0x5e8a16,_0xb0ae52){return db[_0x71ca('0x32')][_0x71ca('0x4c')]({'where':{'id':_0x5e8a16[_0x71ca('0x4b')]['id']}})[_0x71ca('0x2a')](handleEntityNotFound(_0xb0ae52,null))[_0x71ca('0x2a')](removeEntity(_0xb0ae52,null))[_0x71ca('0x49')](handleError(_0xb0ae52,null));};exports[_0x71ca('0x50')]=function(_0x332217,_0x54c5a2){return db[_0x71ca('0x32')][_0x71ca('0x50')]()[_0x71ca('0x2a')](respondWithResult(_0x54c5a2,null))[_0x71ca('0x49')](handleError(_0x54c5a2,null));}; \ No newline at end of file +var _0xe959=['../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','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','../../components/auth/service'];(function(_0x1d4663,_0x58a0d4){var _0x33b55d=function(_0x1fbdfd){while(--_0x1fbdfd){_0x1d4663['push'](_0x1d4663['shift']());}};_0x33b55d(++_0x58a0d4);}(_0xe959,0x83));var _0x9e95=function(_0x3bed68,_0x29117a){_0x3bed68=_0x3bed68-0x0;var _0x542c60=_0xe959[_0x3bed68];return _0x542c60;};'use strict';var emlformat=require(_0x9e95('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e95('0x1'));var jsonpatch=require(_0x9e95('0x2'));var rp=require(_0x9e95('0x3'));var moment=require(_0x9e95('0x4'));var BPromise=require(_0x9e95('0x5'));var Mustache=require(_0x9e95('0x6'));var util=require(_0x9e95('0x7'));var path=require('path');var sox=require(_0x9e95('0x8'));var csv=require(_0x9e95('0x9'));var ejs=require(_0x9e95('0xa'));var fs=require('fs');var fs_extra=require(_0x9e95('0xb'));var _=require(_0x9e95('0xc'));var squel=require(_0x9e95('0xd'));var crypto=require(_0x9e95('0xe'));var jsforce=require(_0x9e95('0xf'));var deskjs=require(_0x9e95('0x10'));var toCsv=require(_0x9e95('0x9'));var querystring=require(_0x9e95('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9e95('0x12'));var qs=require(_0x9e95('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e95('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9e95('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9e95('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3221d6,_0x2c6161){_0x2c6161=_0x2c6161||0xcc;return function(_0x4b6076){if(_0x4b6076){return _0x3221d6[_0x9e95('0x17')](_0x2c6161);}return _0x3221d6[_0x9e95('0x18')](_0x2c6161)['end']();};}function respondWithResult(_0x508442,_0x4f587b){_0x4f587b=_0x4f587b||0xc8;return function(_0x575639){if(_0x575639){return _0x508442['status'](_0x4f587b)['json'](_0x575639);}};}function respondWithFilteredResult(_0x4d8a48,_0x940060){return function(_0x50251e){if(_0x50251e){var _0x38a9c7=typeof _0x940060[_0x9e95('0x19')]===_0x9e95('0x1a')&&typeof _0x940060[_0x9e95('0x1b')]===_0x9e95('0x1a');var _0x4f99bd=_0x50251e[_0x9e95('0x1c')];var _0x2e9614=_0x38a9c7?0x0:_0x940060[_0x9e95('0x19')];var _0x458207=_0x38a9c7?_0x50251e[_0x9e95('0x1c')]:_0x940060['offset']+_0x940060[_0x9e95('0x1b')];var _0x1ea7cf;if(_0x458207>=_0x4f99bd){_0x458207=_0x4f99bd;_0x1ea7cf=0xc8;}else{_0x1ea7cf=0xce;}_0x4d8a48[_0x9e95('0x18')](_0x1ea7cf);return _0x4d8a48[_0x9e95('0x1d')](_0x9e95('0x1e'),_0x2e9614+'-'+_0x458207+'/'+_0x4f99bd)['json'](_0x50251e);}return null;};}function patchUpdates(_0x3db726){return function(_0x288354){try{jsonpatch[_0x9e95('0x1f')](_0x288354,_0x3db726,!![]);}catch(_0x582988){return BPromise['reject'](_0x582988);}return _0x288354[_0x9e95('0x20')]();};}function saveUpdates(_0xb89f49,_0x5d61b5){return function(_0x341609){if(_0x341609){return _0x341609[_0x9e95('0x21')](_0xb89f49)['then'](function(_0x152ecb){return _0x152ecb;});}return null;};}function removeEntity(_0x1c03b2,_0xb26caa){return function(_0x13aa06){if(_0x13aa06){return _0x13aa06[_0x9e95('0x22')]()[_0x9e95('0x23')](function(){_0x1c03b2[_0x9e95('0x18')](0xcc)[_0x9e95('0x24')]();});}};}function handleEntityNotFound(_0x143ae9,_0x29c0b7){return function(_0x5976fe){if(!_0x5976fe){_0x143ae9[_0x9e95('0x17')](0x194);}return _0x5976fe;};}function handleError(_0x52c8c8,_0x4119db){_0x4119db=_0x4119db||0x1f4;return function(_0x358d5a){logger[_0x9e95('0x25')](_0x358d5a[_0x9e95('0x26')]);if(_0x358d5a[_0x9e95('0x27')]){delete _0x358d5a['name'];}_0x52c8c8[_0x9e95('0x18')](_0x4119db)[_0x9e95('0x28')](_0x358d5a);};}exports[_0x9e95('0x29')]=function(_0x3bdfaf,_0x2a2a9e){var _0x40779b={},_0x134f75={},_0x17b47d={'count':0x0,'rows':[]};var _0x578fda=_['map'](db[_0x9e95('0x2a')][_0x9e95('0x2b')],function(_0x197092){return{'name':_0x197092[_0x9e95('0x2c')],'type':_0x197092[_0x9e95('0x2d')]['key']};});_0x134f75[_0x9e95('0x2e')]=_[_0x9e95('0x2f')](_0x578fda,_0x9e95('0x27'));_0x134f75[_0x9e95('0x30')]=_['keys'](_0x3bdfaf[_0x9e95('0x30')]);_0x134f75[_0x9e95('0x31')]=_[_0x9e95('0x32')](_0x134f75[_0x9e95('0x2e')],_0x134f75[_0x9e95('0x30')]);_0x40779b['attributes']=_[_0x9e95('0x32')](_0x134f75['model'],qs[_0x9e95('0x33')](_0x3bdfaf[_0x9e95('0x30')]['fields']));_0x40779b[_0x9e95('0x34')]=_0x40779b[_0x9e95('0x34')][_0x9e95('0x35')]?_0x40779b[_0x9e95('0x34')]:_0x134f75['model'];if(!_0x3bdfaf[_0x9e95('0x30')][_0x9e95('0x36')](_0x9e95('0x37'))){_0x40779b[_0x9e95('0x1b')]=qs[_0x9e95('0x1b')](_0x3bdfaf[_0x9e95('0x30')][_0x9e95('0x1b')]);_0x40779b[_0x9e95('0x19')]=qs[_0x9e95('0x19')](_0x3bdfaf[_0x9e95('0x30')]['offset']);}_0x40779b['order']=qs[_0x9e95('0x38')](_0x3bdfaf['query'][_0x9e95('0x38')]);_0x40779b[_0x9e95('0x39')]=qs[_0x9e95('0x31')](_[_0x9e95('0x3a')](_0x3bdfaf['query'],_0x134f75[_0x9e95('0x31')]),_0x578fda);if(_0x3bdfaf[_0x9e95('0x30')]['filter']){_0x40779b[_0x9e95('0x39')]=_[_0x9e95('0x3b')](_0x40779b[_0x9e95('0x39')],{'$or':_[_0x9e95('0x2f')](_0x578fda,function(_0x1ed77e){if(_0x1ed77e[_0x9e95('0x2d')]!==_0x9e95('0x3c')){var _0x41e764={};_0x41e764[_0x1ed77e[_0x9e95('0x27')]]={'$like':'%'+_0x3bdfaf['query'][_0x9e95('0x3d')]+'%'};return _0x41e764;}})});}_0x40779b=_[_0x9e95('0x3b')]({},_0x40779b,_0x3bdfaf[_0x9e95('0x3e')]);var _0x2cb84b={'where':_0x40779b['where']};return db[_0x9e95('0x2a')][_0x9e95('0x1c')](_0x2cb84b)[_0x9e95('0x23')](function(_0x54508a){_0x17b47d[_0x9e95('0x1c')]=_0x54508a;if(_0x3bdfaf[_0x9e95('0x30')][_0x9e95('0x3f')]){_0x40779b[_0x9e95('0x40')]=[{'all':!![]}];}return db[_0x9e95('0x2a')][_0x9e95('0x41')](_0x40779b);})[_0x9e95('0x23')](function(_0x10ea06){_0x17b47d[_0x9e95('0x42')]=_0x10ea06;return _0x17b47d;})['then'](respondWithFilteredResult(_0x2a2a9e,_0x40779b))[_0x9e95('0x43')](handleError(_0x2a2a9e,null));};exports[_0x9e95('0x44')]=function(_0x2ecb02,_0x367a12){var _0x55f955={'raw':!![],'where':{'id':_0x2ecb02[_0x9e95('0x45')]['id']}},_0xa000f3={};_0xa000f3['model']=_[_0x9e95('0x46')](db[_0x9e95('0x2a')][_0x9e95('0x2b')]);_0xa000f3['query']=_[_0x9e95('0x46')](_0x2ecb02[_0x9e95('0x30')]);_0xa000f3[_0x9e95('0x31')]=_[_0x9e95('0x32')](_0xa000f3[_0x9e95('0x2e')],_0xa000f3[_0x9e95('0x30')]);_0x55f955[_0x9e95('0x34')]=_[_0x9e95('0x32')](_0xa000f3[_0x9e95('0x2e')],qs[_0x9e95('0x33')](_0x2ecb02['query'][_0x9e95('0x33')]));_0x55f955['attributes']=_0x55f955[_0x9e95('0x34')][_0x9e95('0x35')]?_0x55f955[_0x9e95('0x34')]:_0xa000f3[_0x9e95('0x2e')];if(_0x2ecb02['query']['includeAll']){_0x55f955[_0x9e95('0x40')]=[{'all':!![]}];}_0x55f955=_[_0x9e95('0x3b')]({},_0x55f955,_0x2ecb02[_0x9e95('0x3e')]);return db[_0x9e95('0x2a')][_0x9e95('0x47')](_0x55f955)[_0x9e95('0x23')](handleEntityNotFound(_0x367a12,null))[_0x9e95('0x23')](respondWithResult(_0x367a12,null))[_0x9e95('0x43')](handleError(_0x367a12,null));};exports[_0x9e95('0x48')]=function(_0x45ee6f,_0xb42ac8){return db['SmsQueueReport'][_0x9e95('0x48')](_0x45ee6f[_0x9e95('0x49')],{})[_0x9e95('0x23')](respondWithResult(_0xb42ac8,0xc9))[_0x9e95('0x43')](handleError(_0xb42ac8,null));};exports['update']=function(_0x5c770d,_0x1beb83){if(_0x5c770d[_0x9e95('0x49')]['id']){delete _0x5c770d[_0x9e95('0x49')]['id'];}return db[_0x9e95('0x2a')][_0x9e95('0x47')]({'where':{'id':_0x5c770d[_0x9e95('0x45')]['id']}})[_0x9e95('0x23')](handleEntityNotFound(_0x1beb83,null))[_0x9e95('0x23')](saveUpdates(_0x5c770d['body'],null))[_0x9e95('0x23')](respondWithResult(_0x1beb83,null))['catch'](handleError(_0x1beb83,null));};exports[_0x9e95('0x22')]=function(_0x29a5d9,_0x2a5baa){return db[_0x9e95('0x2a')]['find']({'where':{'id':_0x29a5d9['params']['id']}})[_0x9e95('0x23')](handleEntityNotFound(_0x2a5baa,null))[_0x9e95('0x23')](removeEntity(_0x2a5baa,null))[_0x9e95('0x43')](handleError(_0x2a5baa,null));};exports[_0x9e95('0x4a')]=function(_0x132d84,_0x25b07a){return db[_0x9e95('0x2a')][_0x9e95('0x4a')]()[_0x9e95('0x23')](respondWithResult(_0x25b07a,null))[_0x9e95('0x43')](handleError(_0x25b07a,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 63081a3..0675191 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 _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x433d70,_0x286ab1){var _0x273a07=function(_0x1cab32){while(--_0x1cab32){_0x433d70['push'](_0x433d70['shift']());}};_0x273a07(++_0x286ab1);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x2fe8e1,_0x3552bf){var _0x89bd52=function(_0x357bfc){while(--_0x357bfc){_0x2fe8e1['push'](_0x2fe8e1['shift']());}};_0x89bd52(++_0x3552bf);}(_0xe706,0xa3));var _0x6e70=function(_0xa8f24a,_0x48d7d3){_0xa8f24a=_0xa8f24a-0x0;var _0x3a1471=_0xe706[_0xa8f24a];return _0x3a1471;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 80cbe5a..2311a3f 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 _0x8702=['CreateSmsQueueReport','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../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','error','code','message','result','catch','body','options','raw'];(function(_0x3ce4d9,_0x207722){var _0x1db13f=function(_0x3ff77d){while(--_0x3ff77d){_0x3ce4d9['push'](_0x3ce4d9['shift']());}};_0x1db13f(++_0x207722);}(_0x8702,0x1ab));var _0x2870=function(_0xe8b5cf,_0x818996){_0xe8b5cf=_0xe8b5cf-0x0;var _0x3640d4=_0x8702[_0xe8b5cf];return _0x3640d4;};'use strict';var _=require(_0x2870('0x0'));var util=require(_0x2870('0x1'));var moment=require(_0x2870('0x2'));var BPromise=require(_0x2870('0x3'));var rs=require(_0x2870('0x4'));var fs=require('fs');var Redis=require(_0x2870('0x5'));var db=require(_0x2870('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2870('0x7'))('rpc');var config=require(_0x2870('0x8'));var jayson=require(_0x2870('0x9'));var client=jayson[_0x2870('0xa')][_0x2870('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23ec1a,_0x517ceb,_0x3faf0d){return new BPromise(function(_0x5106a2,_0x5afd1c){return client[_0x2870('0xc')](_0x23ec1a,_0x3faf0d)[_0x2870('0xd')](function(_0x452ae5){logger[_0x2870('0xe')](_0x2870('0xf'),_0x517ceb,_0x2870('0x10'));logger[_0x2870('0x11')](_0x2870('0x12'),_0x517ceb,'request\x20sent',JSON[_0x2870('0x13')](_0x452ae5));if(_0x452ae5[_0x2870('0x14')]){if(_0x452ae5[_0x2870('0x14')][_0x2870('0x15')]===0x1f4){logger[_0x2870('0x14')](_0x2870('0xf'),_0x517ceb,_0x452ae5[_0x2870('0x14')][_0x2870('0x16')]);return _0x5afd1c(_0x452ae5[_0x2870('0x14')]['message']);}logger[_0x2870('0x14')](_0x2870('0xf'),_0x517ceb,_0x452ae5[_0x2870('0x14')][_0x2870('0x16')]);return _0x5106a2(_0x452ae5[_0x2870('0x14')][_0x2870('0x16')]);}else{logger['info'](_0x2870('0xf'),_0x517ceb,_0x2870('0x10'));_0x5106a2(_0x452ae5[_0x2870('0x17')]['message']);}})[_0x2870('0x18')](function(_0x13adfa){logger[_0x2870('0x14')](_0x2870('0xf'),_0x517ceb,_0x13adfa);_0x5afd1c(_0x13adfa);});});}exports['CreateSmsQueueReport']=function(_0x494408){var _0x1099e8=this;return new Promise(function(_0x43c8bf,_0x1878c1){return db['SmsQueueReport']['create'](_0x494408[_0x2870('0x19')],{'raw':_0x494408[_0x2870('0x1a')]?_0x494408[_0x2870('0x1a')][_0x2870('0x1b')]===undefined?!![]:![]:!![]})[_0x2870('0xd')](function(_0x1cb32e){logger['info'](_0x2870('0x1c'),_0x494408);logger[_0x2870('0x11')](_0x2870('0x1c'),_0x494408,JSON[_0x2870('0x13')](_0x1cb32e));_0x43c8bf(_0x1cb32e);})[_0x2870('0x18')](function(_0x183618){logger['error']('CreateSmsQueueReport',_0x183618['message'],_0x494408);_0x1878c1(_0x1099e8[_0x2870('0x14')](0x1f4,_0x183618[_0x2870('0x16')]));});});};exports[_0x2870('0x1d')]=function(_0x11fc74){var _0xadf72c=this;return new Promise(function(_0x1c6553,_0x4201fa){return db[_0x2870('0x1e')][_0x2870('0x1f')](_0x11fc74[_0x2870('0x19')],{'raw':_0x11fc74[_0x2870('0x1a')]?_0x11fc74[_0x2870('0x1a')][_0x2870('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11fc74[_0x2870('0x1a')]?_0x11fc74[_0x2870('0x1a')][_0x2870('0x20')]||null:null,'attributes':_0x11fc74['options']?_0x11fc74[_0x2870('0x1a')][_0x2870('0x21')]||null:null,'limit':_0x11fc74['options']?_0x11fc74[_0x2870('0x1a')][_0x2870('0x22')]||null:null})['then'](function(_0x3c4673){logger[_0x2870('0xe')]('UpdateSmsQueueReport',_0x11fc74);logger[_0x2870('0x11')](_0x2870('0x1d'),_0x11fc74,JSON[_0x2870('0x13')](_0x3c4673));_0x1c6553(_0x3c4673);})['catch'](function(_0x230ff9){logger[_0x2870('0x14')]('UpdateSmsQueueReport',_0x230ff9['message'],_0x11fc74);_0x4201fa(_0xadf72c['error'](0x1f4,_0x230ff9['message']));});});}; \ No newline at end of file +var _0x50a3=['debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','update','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4b3c3a,_0x47c8b2){var _0x238417=function(_0x437243){while(--_0x437243){_0x4b3c3a['push'](_0x4b3c3a['shift']());}};_0x238417(++_0x47c8b2);}(_0x50a3,0x100));var _0x350a=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0x50a3[_0xb66df];return _0x42a702;};'use strict';var _=require(_0x350a('0x0'));var util=require(_0x350a('0x1'));var moment=require(_0x350a('0x2'));var BPromise=require(_0x350a('0x3'));var rs=require(_0x350a('0x4'));var fs=require('fs');var Redis=require(_0x350a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x350a('0x6'));var logger=require('../../config/logger')(_0x350a('0x7'));var config=require(_0x350a('0x8'));var jayson=require(_0x350a('0x9'));var client=jayson[_0x350a('0xa')][_0x350a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1597e2,_0x4f9cc9,_0x49b7ec){return new BPromise(function(_0x55288b,_0x207bc0){return client[_0x350a('0xc')](_0x1597e2,_0x49b7ec)[_0x350a('0xd')](function(_0x56fd1c){logger['info'](_0x350a('0xe'),_0x4f9cc9,_0x350a('0xf'));logger[_0x350a('0x10')](_0x350a('0x11'),_0x4f9cc9,_0x350a('0xf'),JSON[_0x350a('0x12')](_0x56fd1c));if(_0x56fd1c[_0x350a('0x13')]){if(_0x56fd1c[_0x350a('0x13')][_0x350a('0x14')]===0x1f4){logger['error'](_0x350a('0xe'),_0x4f9cc9,_0x56fd1c[_0x350a('0x13')][_0x350a('0x15')]);return _0x207bc0(_0x56fd1c[_0x350a('0x13')]['message']);}logger[_0x350a('0x13')](_0x350a('0xe'),_0x4f9cc9,_0x56fd1c[_0x350a('0x13')][_0x350a('0x15')]);return _0x55288b(_0x56fd1c[_0x350a('0x13')][_0x350a('0x15')]);}else{logger[_0x350a('0x16')]('SmsQueueReport,\x20%s,\x20%s',_0x4f9cc9,_0x350a('0xf'));_0x55288b(_0x56fd1c[_0x350a('0x17')][_0x350a('0x15')]);}})[_0x350a('0x18')](function(_0x441f98){logger[_0x350a('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x4f9cc9,_0x441f98);_0x207bc0(_0x441f98);});});}exports[_0x350a('0x19')]=function(_0x217932){var _0x1bfacf=this;return new Promise(function(_0x15e1f7,_0x22fb2d){return db[_0x350a('0x1a')][_0x350a('0x1b')](_0x217932[_0x350a('0x1c')],{'raw':_0x217932[_0x350a('0x1d')]?_0x217932[_0x350a('0x1d')][_0x350a('0x1e')]===undefined?!![]:![]:!![]})[_0x350a('0xd')](function(_0xe14732){logger[_0x350a('0x16')](_0x350a('0x19'),_0x217932);logger[_0x350a('0x10')](_0x350a('0x19'),_0x217932,JSON[_0x350a('0x12')](_0xe14732));_0x15e1f7(_0xe14732);})[_0x350a('0x18')](function(_0x1a1b87){logger[_0x350a('0x13')](_0x350a('0x19'),_0x1a1b87[_0x350a('0x15')],_0x217932);_0x22fb2d(_0x1bfacf[_0x350a('0x13')](0x1f4,_0x1a1b87['message']));});});};exports[_0x350a('0x1f')]=function(_0x175e4e){var _0x1cde87=this;return new Promise(function(_0x3838af,_0x3a54d9){return db[_0x350a('0x1a')][_0x350a('0x20')](_0x175e4e[_0x350a('0x1c')],{'raw':_0x175e4e[_0x350a('0x1d')]?_0x175e4e[_0x350a('0x1d')][_0x350a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x175e4e[_0x350a('0x1d')]?_0x175e4e[_0x350a('0x1d')]['where']||null:null,'attributes':_0x175e4e['options']?_0x175e4e[_0x350a('0x1d')][_0x350a('0x21')]||null:null,'limit':_0x175e4e[_0x350a('0x1d')]?_0x175e4e[_0x350a('0x1d')]['limit']||null:null})[_0x350a('0xd')](function(_0x65ea9d){logger[_0x350a('0x16')](_0x350a('0x1f'),_0x175e4e);logger['debug'](_0x350a('0x1f'),_0x175e4e,JSON[_0x350a('0x12')](_0x65ea9d));_0x3838af(_0x65ea9d);})['catch'](function(_0x311b3b){logger['error'](_0x350a('0x1f'),_0x311b3b['message'],_0x175e4e);_0x3a54d9(_0x1cde87[_0x350a('0x13')](0x1f4,_0x311b3b[_0x350a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index c76c4be..aa821b8 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 _0xdbf5=['show','post','put','update','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x1044e5,_0x498e01){var _0x5ad0dd=function(_0x458548){while(--_0x458548){_0x1044e5['push'](_0x1044e5['shift']());}};_0x5ad0dd(++_0x498e01);}(_0xdbf5,0x18c));var _0x5dbf=function(_0xd3070c,_0xa42bcb){_0xd3070c=_0xd3070c-0x0;var _0x516684=_0xdbf5[_0xd3070c];return _0x516684;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var fs_extra=require(_0x5dbf('0x3'));var auth=require(_0x5dbf('0x4'));var interaction=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var controller=require(_0x5dbf('0x7'));router[_0x5dbf('0x8')]('/',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xa')]);router[_0x5dbf('0x8')](_0x5dbf('0xb'),auth[_0x5dbf('0x9')](),controller['describe']);router[_0x5dbf('0x8')]('/:id',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xc')]);router[_0x5dbf('0xd')]('/',auth[_0x5dbf('0x9')](),controller['create']);router[_0x5dbf('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5dbf('0xf')]);router['delete']('/:id',auth[_0x5dbf('0x9')](),controller['destroy']);module[_0x5dbf('0x10')]=router; \ No newline at end of file +var _0xe0ae=['exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','index','get','/describe','isAuthenticated','show','post','put','/:id','update'];(function(_0x3c81e2,_0x6bd0d6){var _0x537291=function(_0x2b32ab){while(--_0x2b32ab){_0x3c81e2['push'](_0x3c81e2['shift']());}};_0x537291(++_0x6bd0d6);}(_0xe0ae,0xa1));var _0xee0a=function(_0x429948,_0x1a6851){_0x429948=_0x429948-0x0;var _0x35d5d1=_0xe0ae[_0x429948];return _0x35d5d1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee0a('0x0'));var timeout=require(_0xee0a('0x1'));var express=require('express');var router=express[_0xee0a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xee0a('0x3'));var interaction=require(_0xee0a('0x4'));var config=require('../../config/environment');var controller=require(_0xee0a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xee0a('0x6')]);router[_0xee0a('0x7')](_0xee0a('0x8'),auth[_0xee0a('0x9')](),controller['describe']);router[_0xee0a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xee0a('0xa')]);router[_0xee0a('0xb')]('/',auth[_0xee0a('0x9')](),controller['create']);router[_0xee0a('0xc')](_0xee0a('0xd'),auth['isAuthenticated'](),controller[_0xee0a('0xe')]);router['delete'](_0xee0a('0xd'),auth[_0xee0a('0x9')](),controller['destroy']);module[_0xee0a('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 9323a70..f90a931 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x54af62,_0x57d561){var _0x132b1f=function(_0x433c54){while(--_0x433c54){_0x54af62['push'](_0x54af62['shift']());}};_0x132b1f(++_0x57d561);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1e66b2,_0x583850){_0x1e66b2=_0x1e66b2-0x0;var _0x4fd90b=_0xf4eb[_0x1e66b2];return _0x4fd90b;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x6362d0,_0x5400b4){var _0x19bbce=function(_0x5f2bd5){while(--_0x5f2bd5){_0x6362d0['push'](_0x6362d0['shift']());}};_0x19bbce(++_0x5400b4);}(_0x34e8,0x12c));var _0x834e=function(_0x5317eb,_0x3d3387){_0x5317eb=_0x5317eb-0x0;var _0x104613=_0x34e8[_0x5317eb];return _0x104613;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index c97d2ba..8cb30d6 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 _0xc6c4=['SmsTransferReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xc6c4,0x6f));var _0x4c6c=function(_0x38493a,_0x3b22d7){_0x38493a=_0x38493a-0x0;var _0x1abafc=_0xc6c4[_0x38493a];return _0x1abafc;};'use strict';var emlformat=require(_0x4c6c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4c6c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c6c('0x2'));var moment=require(_0x4c6c('0x3'));var BPromise=require(_0x4c6c('0x4'));var Mustache=require(_0x4c6c('0x5'));var util=require(_0x4c6c('0x6'));var path=require(_0x4c6c('0x7'));var sox=require(_0x4c6c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c6c('0x9'));var _=require(_0x4c6c('0xa'));var squel=require(_0x4c6c('0xb'));var crypto=require('crypto');var jsforce=require(_0x4c6c('0xc'));var deskjs=require(_0x4c6c('0xd'));var toCsv=require(_0x4c6c('0xe'));var querystring=require(_0x4c6c('0xf'));var Papa=require(_0x4c6c('0x10'));var Redis=require(_0x4c6c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4c6c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4c6c('0x13'));var logger=require(_0x4c6c('0x14'))(_0x4c6c('0x15'));var utils=require(_0x4c6c('0x16'));var config=require(_0x4c6c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4c6c('0x18'))['db'];function respondWithStatusCode(_0x4b8ac5,_0x182097){_0x182097=_0x182097||0xcc;return function(_0x51de21){if(_0x51de21){return _0x4b8ac5[_0x4c6c('0x19')](_0x182097);}return _0x4b8ac5[_0x4c6c('0x1a')](_0x182097)[_0x4c6c('0x1b')]();};}function respondWithResult(_0x1547d2,_0x1e1262){_0x1e1262=_0x1e1262||0xc8;return function(_0x1efac7){if(_0x1efac7){return _0x1547d2[_0x4c6c('0x1a')](_0x1e1262)[_0x4c6c('0x1c')](_0x1efac7);}};}function respondWithFilteredResult(_0x5bbcde,_0x833f8e){return function(_0x445cc6){if(_0x445cc6){var _0x48c7fa=typeof _0x833f8e['offset']===_0x4c6c('0x1d')&&typeof _0x833f8e['limit']===_0x4c6c('0x1d');var _0x115b2c=_0x445cc6[_0x4c6c('0x1e')];var _0x159126=_0x48c7fa?0x0:_0x833f8e['offset'];var _0x3008ea=_0x48c7fa?_0x445cc6[_0x4c6c('0x1e')]:_0x833f8e[_0x4c6c('0x1f')]+_0x833f8e[_0x4c6c('0x20')];var _0x43454e;if(_0x3008ea>=_0x115b2c){_0x3008ea=_0x115b2c;_0x43454e=0xc8;}else{_0x43454e=0xce;}_0x5bbcde['status'](_0x43454e);return _0x5bbcde[_0x4c6c('0x21')](_0x4c6c('0x22'),_0x159126+'-'+_0x3008ea+'/'+_0x115b2c)[_0x4c6c('0x1c')](_0x445cc6);}return null;};}function patchUpdates(_0x272c74){return function(_0x4cbd65){try{jsonpatch[_0x4c6c('0x23')](_0x4cbd65,_0x272c74,!![]);}catch(_0x452979){return BPromise[_0x4c6c('0x24')](_0x452979);}return _0x4cbd65[_0x4c6c('0x25')]();};}function saveUpdates(_0x20882f,_0x22cdcb){return function(_0x543160){if(_0x543160){return _0x543160[_0x4c6c('0x26')](_0x20882f)[_0x4c6c('0x27')](function(_0x3fd211){return _0x3fd211;});}return null;};}function removeEntity(_0x157196,_0x12bf33){return function(_0x3971b1){if(_0x3971b1){return _0x3971b1[_0x4c6c('0x28')]()[_0x4c6c('0x27')](function(){_0x157196[_0x4c6c('0x1a')](0xcc)[_0x4c6c('0x1b')]();});}};}function handleEntityNotFound(_0x2b218f,_0x243bce){return function(_0x551924){if(!_0x551924){_0x2b218f[_0x4c6c('0x19')](0x194);}return _0x551924;};}function handleError(_0x1f46b7,_0x2b81e5){_0x2b81e5=_0x2b81e5||0x1f4;return function(_0x4a055c){logger[_0x4c6c('0x29')](_0x4a055c[_0x4c6c('0x2a')]);if(_0x4a055c[_0x4c6c('0x2b')]){delete _0x4a055c[_0x4c6c('0x2b')];}_0x1f46b7[_0x4c6c('0x1a')](_0x2b81e5)[_0x4c6c('0x2c')](_0x4a055c);};}exports[_0x4c6c('0x2d')]=function(_0x6a9e44,_0x49dd91){var _0x34ea5c={},_0x43b90f={},_0x437c20={'count':0x0,'rows':[]};var _0x591a0c=_[_0x4c6c('0x2e')](db[_0x4c6c('0x2f')][_0x4c6c('0x30')],function(_0x1df409){return{'name':_0x1df409[_0x4c6c('0x31')],'type':_0x1df409['type'][_0x4c6c('0x32')]};});_0x43b90f[_0x4c6c('0x33')]=_[_0x4c6c('0x2e')](_0x591a0c,_0x4c6c('0x2b'));_0x43b90f['query']=_[_0x4c6c('0x34')](_0x6a9e44[_0x4c6c('0x35')]);_0x43b90f[_0x4c6c('0x36')]=_[_0x4c6c('0x37')](_0x43b90f['model'],_0x43b90f[_0x4c6c('0x35')]);_0x34ea5c['attributes']=_[_0x4c6c('0x37')](_0x43b90f[_0x4c6c('0x33')],qs[_0x4c6c('0x38')](_0x6a9e44['query'][_0x4c6c('0x38')]));_0x34ea5c[_0x4c6c('0x39')]=_0x34ea5c[_0x4c6c('0x39')]['length']?_0x34ea5c[_0x4c6c('0x39')]:_0x43b90f[_0x4c6c('0x33')];if(!_0x6a9e44[_0x4c6c('0x35')][_0x4c6c('0x3a')](_0x4c6c('0x3b'))){_0x34ea5c[_0x4c6c('0x20')]=qs[_0x4c6c('0x20')](_0x6a9e44[_0x4c6c('0x35')]['limit']);_0x34ea5c[_0x4c6c('0x1f')]=qs[_0x4c6c('0x1f')](_0x6a9e44[_0x4c6c('0x35')][_0x4c6c('0x1f')]);}_0x34ea5c[_0x4c6c('0x3c')]=qs[_0x4c6c('0x3d')](_0x6a9e44['query'][_0x4c6c('0x3d')]);_0x34ea5c['where']=qs['filters'](_[_0x4c6c('0x3e')](_0x6a9e44[_0x4c6c('0x35')],_0x43b90f[_0x4c6c('0x36')]),_0x591a0c);if(_0x6a9e44[_0x4c6c('0x35')][_0x4c6c('0x3f')]){_0x34ea5c[_0x4c6c('0x40')]=_['merge'](_0x34ea5c[_0x4c6c('0x40')],{'$or':_[_0x4c6c('0x2e')](_0x591a0c,function(_0x5c540e){if(_0x5c540e[_0x4c6c('0x41')]!==_0x4c6c('0x42')){var _0x5053d3={};_0x5053d3[_0x5c540e['name']]={'$like':'%'+_0x6a9e44[_0x4c6c('0x35')][_0x4c6c('0x3f')]+'%'};return _0x5053d3;}})});}_0x34ea5c=_[_0x4c6c('0x43')]({},_0x34ea5c,_0x6a9e44['options']);var _0x165b0a={'where':_0x34ea5c['where']};return db[_0x4c6c('0x2f')][_0x4c6c('0x1e')](_0x165b0a)['then'](function(_0x567004){_0x437c20[_0x4c6c('0x1e')]=_0x567004;if(_0x6a9e44[_0x4c6c('0x35')][_0x4c6c('0x44')]){_0x34ea5c[_0x4c6c('0x45')]=[{'all':!![]}];}return db[_0x4c6c('0x2f')][_0x4c6c('0x46')](_0x34ea5c);})[_0x4c6c('0x27')](function(_0x769fa7){_0x437c20[_0x4c6c('0x47')]=_0x769fa7;return _0x437c20;})['then'](respondWithFilteredResult(_0x49dd91,_0x34ea5c))[_0x4c6c('0x48')](handleError(_0x49dd91,null));};exports['show']=function(_0x13daa7,_0x47dcda){var _0x1d1874={'raw':!![],'where':{'id':_0x13daa7[_0x4c6c('0x49')]['id']}},_0x15ffe0={};_0x15ffe0[_0x4c6c('0x33')]=_[_0x4c6c('0x34')](db['SmsTransferReport'][_0x4c6c('0x30')]);_0x15ffe0[_0x4c6c('0x35')]=_[_0x4c6c('0x34')](_0x13daa7[_0x4c6c('0x35')]);_0x15ffe0['filters']=_[_0x4c6c('0x37')](_0x15ffe0[_0x4c6c('0x33')],_0x15ffe0[_0x4c6c('0x35')]);_0x1d1874[_0x4c6c('0x39')]=_['intersection'](_0x15ffe0['model'],qs['fields'](_0x13daa7['query'][_0x4c6c('0x38')]));_0x1d1874['attributes']=_0x1d1874['attributes'][_0x4c6c('0x4a')]?_0x1d1874[_0x4c6c('0x39')]:_0x15ffe0[_0x4c6c('0x33')];if(_0x13daa7[_0x4c6c('0x35')][_0x4c6c('0x44')]){_0x1d1874['include']=[{'all':!![]}];}_0x1d1874=_[_0x4c6c('0x43')]({},_0x1d1874,_0x13daa7['options']);return db[_0x4c6c('0x2f')][_0x4c6c('0x4b')](_0x1d1874)[_0x4c6c('0x27')](handleEntityNotFound(_0x47dcda,null))[_0x4c6c('0x27')](respondWithResult(_0x47dcda,null))[_0x4c6c('0x48')](handleError(_0x47dcda,null));};exports[_0x4c6c('0x4c')]=function(_0x55b213,_0x1c198c){return db[_0x4c6c('0x2f')]['create'](_0x55b213[_0x4c6c('0x4d')],{})['then'](respondWithResult(_0x1c198c,0xc9))['catch'](handleError(_0x1c198c,null));};exports['update']=function(_0x53161c,_0xbf678c){if(_0x53161c['body']['id']){delete _0x53161c['body']['id'];}return db['SmsTransferReport'][_0x4c6c('0x4b')]({'where':{'id':_0x53161c[_0x4c6c('0x49')]['id']}})[_0x4c6c('0x27')](handleEntityNotFound(_0xbf678c,null))[_0x4c6c('0x27')](saveUpdates(_0x53161c[_0x4c6c('0x4d')],null))[_0x4c6c('0x27')](respondWithResult(_0xbf678c,null))[_0x4c6c('0x48')](handleError(_0xbf678c,null));};exports['destroy']=function(_0x391477,_0x520236){return db['SmsTransferReport'][_0x4c6c('0x4b')]({'where':{'id':_0x391477[_0x4c6c('0x49')]['id']}})[_0x4c6c('0x27')](handleEntityNotFound(_0x520236,null))[_0x4c6c('0x27')](removeEntity(_0x520236,null))[_0x4c6c('0x48')](handleError(_0x520236,null));};exports[_0x4c6c('0x4e')]=function(_0x5292d3,_0x5a380e){return db['SmsTransferReport'][_0x4c6c('0x4e')]()[_0x4c6c('0x27')](respondWithResult(_0x5a380e,null))[_0x4c6c('0x48')](handleError(_0x5a380e,null));}; \ No newline at end of file +var _0x4c25=['bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','set','apply','update','then','destroy','error','stack','name','send','SmsTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','includeAll','include','findAll','rows','params','options','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x3425d0,_0x5da895){var _0x286d9c=function(_0x538fdb){while(--_0x538fdb){_0x3425d0['push'](_0x3425d0['shift']());}};_0x286d9c(++_0x5da895);}(_0x4c25,0x19f));var _0x54c2=function(_0x337a10,_0x5191c7){_0x337a10=_0x337a10-0x0;var _0x575f98=_0x4c25[_0x337a10];return _0x575f98;};'use strict';var emlformat=require(_0x54c2('0x0'));var rimraf=require(_0x54c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x54c2('0x2'));var rp=require(_0x54c2('0x3'));var moment=require(_0x54c2('0x4'));var BPromise=require(_0x54c2('0x5'));var Mustache=require(_0x54c2('0x6'));var util=require(_0x54c2('0x7'));var path=require('path');var sox=require(_0x54c2('0x8'));var csv=require(_0x54c2('0x9'));var ejs=require(_0x54c2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x54c2('0xb'));var squel=require(_0x54c2('0xc'));var crypto=require('crypto');var jsforce=require(_0x54c2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x54c2('0x9'));var querystring=require(_0x54c2('0xe'));var Papa=require('papaparse');var Redis=require(_0x54c2('0xf'));var authService=require(_0x54c2('0x10'));var qs=require(_0x54c2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x54c2('0x12'));var logger=require(_0x54c2('0x13'))(_0x54c2('0x14'));var utils=require('../../config/utils');var config=require(_0x54c2('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x384861,_0x3abe58){_0x3abe58=_0x3abe58||0xcc;return function(_0x3e5d5e){if(_0x3e5d5e){return _0x384861[_0x54c2('0x16')](_0x3abe58);}return _0x384861[_0x54c2('0x17')](_0x3abe58)['end']();};}function respondWithResult(_0x1f04df,_0x453541){_0x453541=_0x453541||0xc8;return function(_0x2d4df6){if(_0x2d4df6){return _0x1f04df[_0x54c2('0x17')](_0x453541)[_0x54c2('0x18')](_0x2d4df6);}};}function respondWithFilteredResult(_0x118f6f,_0x13d0ca){return function(_0xddc71e){if(_0xddc71e){var _0x2988a2=typeof _0x13d0ca['offset']===_0x54c2('0x19')&&typeof _0x13d0ca[_0x54c2('0x1a')]==='undefined';var _0x32eb15=_0xddc71e[_0x54c2('0x1b')];var _0x12dc50=_0x2988a2?0x0:_0x13d0ca[_0x54c2('0x1c')];var _0x154730=_0x2988a2?_0xddc71e[_0x54c2('0x1b')]:_0x13d0ca[_0x54c2('0x1c')]+_0x13d0ca[_0x54c2('0x1a')];var _0x1b6cbb;if(_0x154730>=_0x32eb15){_0x154730=_0x32eb15;_0x1b6cbb=0xc8;}else{_0x1b6cbb=0xce;}_0x118f6f[_0x54c2('0x17')](_0x1b6cbb);return _0x118f6f[_0x54c2('0x1d')]('Content-Range',_0x12dc50+'-'+_0x154730+'/'+_0x32eb15)['json'](_0xddc71e);}return null;};}function patchUpdates(_0x3cd7df){return function(_0x417e30){try{jsonpatch[_0x54c2('0x1e')](_0x417e30,_0x3cd7df,!![]);}catch(_0x1eec11){return BPromise['reject'](_0x1eec11);}return _0x417e30['save']();};}function saveUpdates(_0x25cf60,_0x36088b){return function(_0x51473e){if(_0x51473e){return _0x51473e[_0x54c2('0x1f')](_0x25cf60)[_0x54c2('0x20')](function(_0x5d1fe7){return _0x5d1fe7;});}return null;};}function removeEntity(_0x204b97,_0x4fce30){return function(_0x2b4317){if(_0x2b4317){return _0x2b4317[_0x54c2('0x21')]()[_0x54c2('0x20')](function(){_0x204b97['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31361a,_0x1ba9f9){return function(_0x27bfb7){if(!_0x27bfb7){_0x31361a[_0x54c2('0x16')](0x194);}return _0x27bfb7;};}function handleError(_0x455e2b,_0x34463a){_0x34463a=_0x34463a||0x1f4;return function(_0x29ed2f){logger[_0x54c2('0x22')](_0x29ed2f[_0x54c2('0x23')]);if(_0x29ed2f[_0x54c2('0x24')]){delete _0x29ed2f[_0x54c2('0x24')];}_0x455e2b[_0x54c2('0x17')](_0x34463a)[_0x54c2('0x25')](_0x29ed2f);};}exports['index']=function(_0x506185,_0x4bc67a){var _0x41f32b={},_0x22e683={},_0x518046={'count':0x0,'rows':[]};var _0xfda38=_['map'](db[_0x54c2('0x26')][_0x54c2('0x27')],function(_0x194ade){return{'name':_0x194ade[_0x54c2('0x28')],'type':_0x194ade[_0x54c2('0x29')][_0x54c2('0x2a')]};});_0x22e683[_0x54c2('0x2b')]=_[_0x54c2('0x2c')](_0xfda38,'name');_0x22e683[_0x54c2('0x2d')]=_[_0x54c2('0x2e')](_0x506185[_0x54c2('0x2d')]);_0x22e683['filters']=_[_0x54c2('0x2f')](_0x22e683['model'],_0x22e683[_0x54c2('0x2d')]);_0x41f32b[_0x54c2('0x30')]=_[_0x54c2('0x2f')](_0x22e683[_0x54c2('0x2b')],qs[_0x54c2('0x31')](_0x506185['query']['fields']));_0x41f32b[_0x54c2('0x30')]=_0x41f32b[_0x54c2('0x30')][_0x54c2('0x32')]?_0x41f32b[_0x54c2('0x30')]:_0x22e683[_0x54c2('0x2b')];if(!_0x506185[_0x54c2('0x2d')][_0x54c2('0x33')](_0x54c2('0x34'))){_0x41f32b[_0x54c2('0x1a')]=qs[_0x54c2('0x1a')](_0x506185['query'][_0x54c2('0x1a')]);_0x41f32b['offset']=qs[_0x54c2('0x1c')](_0x506185['query'][_0x54c2('0x1c')]);}_0x41f32b['order']=qs[_0x54c2('0x35')](_0x506185['query'][_0x54c2('0x35')]);_0x41f32b[_0x54c2('0x36')]=qs['filters'](_[_0x54c2('0x37')](_0x506185[_0x54c2('0x2d')],_0x22e683[_0x54c2('0x38')]),_0xfda38);if(_0x506185['query'][_0x54c2('0x39')]){_0x41f32b['where']=_[_0x54c2('0x3a')](_0x41f32b[_0x54c2('0x36')],{'$or':_[_0x54c2('0x2c')](_0xfda38,function(_0x51d4a9){if(_0x51d4a9[_0x54c2('0x29')]!=='VIRTUAL'){var _0x4b6a71={};_0x4b6a71[_0x51d4a9[_0x54c2('0x24')]]={'$like':'%'+_0x506185[_0x54c2('0x2d')]['filter']+'%'};return _0x4b6a71;}})});}_0x41f32b=_[_0x54c2('0x3a')]({},_0x41f32b,_0x506185['options']);var _0x3a19f7={'where':_0x41f32b['where']};return db[_0x54c2('0x26')][_0x54c2('0x1b')](_0x3a19f7)['then'](function(_0x5ad0ba){_0x518046[_0x54c2('0x1b')]=_0x5ad0ba;if(_0x506185[_0x54c2('0x2d')][_0x54c2('0x3b')]){_0x41f32b[_0x54c2('0x3c')]=[{'all':!![]}];}return db[_0x54c2('0x26')][_0x54c2('0x3d')](_0x41f32b);})[_0x54c2('0x20')](function(_0x39eb0a){_0x518046[_0x54c2('0x3e')]=_0x39eb0a;return _0x518046;})['then'](respondWithFilteredResult(_0x4bc67a,_0x41f32b))['catch'](handleError(_0x4bc67a,null));};exports['show']=function(_0x1bc2fc,_0x1bb2c6){var _0x18d488={'raw':!![],'where':{'id':_0x1bc2fc[_0x54c2('0x3f')]['id']}},_0x3f73c1={};_0x3f73c1[_0x54c2('0x2b')]=_[_0x54c2('0x2e')](db[_0x54c2('0x26')]['rawAttributes']);_0x3f73c1['query']=_[_0x54c2('0x2e')](_0x1bc2fc[_0x54c2('0x2d')]);_0x3f73c1[_0x54c2('0x38')]=_[_0x54c2('0x2f')](_0x3f73c1[_0x54c2('0x2b')],_0x3f73c1['query']);_0x18d488[_0x54c2('0x30')]=_['intersection'](_0x3f73c1['model'],qs[_0x54c2('0x31')](_0x1bc2fc[_0x54c2('0x2d')][_0x54c2('0x31')]));_0x18d488['attributes']=_0x18d488[_0x54c2('0x30')][_0x54c2('0x32')]?_0x18d488[_0x54c2('0x30')]:_0x3f73c1[_0x54c2('0x2b')];if(_0x1bc2fc[_0x54c2('0x2d')][_0x54c2('0x3b')]){_0x18d488['include']=[{'all':!![]}];}_0x18d488=_[_0x54c2('0x3a')]({},_0x18d488,_0x1bc2fc[_0x54c2('0x40')]);return db[_0x54c2('0x26')][_0x54c2('0x41')](_0x18d488)[_0x54c2('0x20')](handleEntityNotFound(_0x1bb2c6,null))['then'](respondWithResult(_0x1bb2c6,null))[_0x54c2('0x42')](handleError(_0x1bb2c6,null));};exports[_0x54c2('0x43')]=function(_0xd924fd,_0x561d8a){return db['SmsTransferReport'][_0x54c2('0x43')](_0xd924fd['body'],{})['then'](respondWithResult(_0x561d8a,0xc9))[_0x54c2('0x42')](handleError(_0x561d8a,null));};exports[_0x54c2('0x1f')]=function(_0x350c26,_0x2ba6bd){if(_0x350c26[_0x54c2('0x44')]['id']){delete _0x350c26['body']['id'];}return db[_0x54c2('0x26')][_0x54c2('0x41')]({'where':{'id':_0x350c26[_0x54c2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2ba6bd,null))[_0x54c2('0x20')](saveUpdates(_0x350c26[_0x54c2('0x44')],null))[_0x54c2('0x20')](respondWithResult(_0x2ba6bd,null))['catch'](handleError(_0x2ba6bd,null));};exports[_0x54c2('0x21')]=function(_0x56ef17,_0x2e85cf){return db[_0x54c2('0x26')][_0x54c2('0x41')]({'where':{'id':_0x56ef17[_0x54c2('0x3f')]['id']}})[_0x54c2('0x20')](handleEntityNotFound(_0x2e85cf,null))['then'](removeEntity(_0x2e85cf,null))[_0x54c2('0x42')](handleError(_0x2e85cf,null));};exports[_0x54c2('0x45')]=function(_0x44d49f,_0x189355){return db[_0x54c2('0x26')][_0x54c2('0x45')]()[_0x54c2('0x20')](respondWithResult(_0x189355,null))[_0x54c2('0x42')](handleError(_0x189355,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 33907c7..03729d1 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 _0x58f4=['exports','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes'];(function(_0xdc9114,_0x16058f){var _0x433412=function(_0x33207b){while(--_0x33207b){_0xdc9114['push'](_0xdc9114['shift']());}};_0x433412(++_0x16058f);}(_0x58f4,0x1b2));var _0x458f=function(_0x329b86,_0x5c28d2){_0x329b86=_0x329b86-0x0;var _0x3371dc=_0x58f4[_0x329b86];return _0x3371dc;};'use strict';var _=require('lodash');var util=require(_0x458f('0x0'));var logger=require(_0x458f('0x1'))(_0x458f('0x2'));var moment=require(_0x458f('0x3'));var BPromise=require(_0x458f('0x4'));var rp=require(_0x458f('0x5'));var fs=require('fs');var path=require(_0x458f('0x6'));var rimraf=require(_0x458f('0x7'));var config=require(_0x458f('0x8'));var attributes=require(_0x458f('0x9'));module[_0x458f('0xa')]=function(_0x103d54,_0x5a1908){return _0x103d54['define']('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x458f('0xb'),'fields':[_0x458f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x929c=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','SmsTransferReport'];(function(_0x499fd1,_0x1d2c06){var _0x325f5d=function(_0x5ca238){while(--_0x5ca238){_0x499fd1['push'](_0x499fd1['shift']());}};_0x325f5d(++_0x1d2c06);}(_0x929c,0x79));var _0xc929=function(_0x4809f9,_0x280a9f){_0x4809f9=_0x4809f9-0x0;var _0x1db3f7=_0x929c[_0x4809f9];return _0x1db3f7;};'use strict';var _=require(_0xc929('0x0'));var util=require(_0xc929('0x1'));var logger=require(_0xc929('0x2'))(_0xc929('0x3'));var moment=require(_0xc929('0x4'));var BPromise=require(_0xc929('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc929('0x6'));var rimraf=require(_0xc929('0x7'));var config=require(_0xc929('0x8'));var attributes=require(_0xc929('0x9'));module['exports']=function(_0x2b8023,_0x2421df){return _0x2b8023['define'](_0xc929('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc929('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 5031a8c..a30013f 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 _0x1738=['SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','SmsTransferReport,\x20%s,\x20%s'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x1738,0x1bc));var _0x8173=function(_0x2cb896,_0x4fcb68){_0x2cb896=_0x2cb896-0x0;var _0x1305d0=_0x1738[_0x2cb896];return _0x1305d0;};'use strict';var _=require(_0x8173('0x0'));var util=require(_0x8173('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8173('0x2'));var fs=require('fs');var Redis=require(_0x8173('0x3'));var db=require(_0x8173('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8173('0x5'));var config=require(_0x8173('0x6'));var jayson=require(_0x8173('0x7'));var client=jayson[_0x8173('0x8')][_0x8173('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x438550,_0x3e4c85,_0x234f2d){return new BPromise(function(_0x13a621,_0x3e37b1){return client['request'](_0x438550,_0x234f2d)['then'](function(_0x1b787d){logger[_0x8173('0xa')](_0x8173('0xb'),_0x3e4c85,'request\x20sent');logger['debug'](_0x8173('0xc'),_0x3e4c85,_0x8173('0xd'),JSON[_0x8173('0xe')](_0x1b787d));if(_0x1b787d[_0x8173('0xf')]){if(_0x1b787d[_0x8173('0xf')]['code']===0x1f4){logger[_0x8173('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x3e4c85,_0x1b787d[_0x8173('0xf')][_0x8173('0x10')]);return _0x3e37b1(_0x1b787d[_0x8173('0xf')][_0x8173('0x10')]);}logger[_0x8173('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x3e4c85,_0x1b787d[_0x8173('0xf')][_0x8173('0x10')]);return _0x13a621(_0x1b787d[_0x8173('0xf')]['message']);}else{logger['info'](_0x8173('0xb'),_0x3e4c85,_0x8173('0xd'));_0x13a621(_0x1b787d[_0x8173('0x11')]['message']);}})[_0x8173('0x12')](function(_0x114b42){logger['error'](_0x8173('0xb'),_0x3e4c85,_0x114b42);_0x3e37b1(_0x114b42);});});} \ No newline at end of file +var _0x9f75=['debug','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x18a71b,_0x32a00e){var _0x1644e9=function(_0x23b5d7){while(--_0x23b5d7){_0x18a71b['push'](_0x18a71b['shift']());}};_0x1644e9(++_0x32a00e);}(_0x9f75,0x15a));var _0x59f7=function(_0x3815e1,_0x3809c1){_0x3815e1=_0x3815e1-0x0;var _0x37ae96=_0x9f75[_0x3815e1];return _0x37ae96;};'use strict';var _=require(_0x59f7('0x0'));var util=require('util');var moment=require(_0x59f7('0x1'));var BPromise=require(_0x59f7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59f7('0x3'))['db'];var utils=require(_0x59f7('0x4'));var logger=require(_0x59f7('0x5'))(_0x59f7('0x6'));var config=require('../../config/environment');var jayson=require(_0x59f7('0x7'));var client=jayson[_0x59f7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5483bc,_0xeb6d1e,_0x15903b){return new BPromise(function(_0x3bf8e1,_0x21e3e5){return client[_0x59f7('0x9')](_0x5483bc,_0x15903b)[_0x59f7('0xa')](function(_0x553357){logger[_0x59f7('0xb')](_0x59f7('0xc'),_0xeb6d1e,_0x59f7('0xd'));logger[_0x59f7('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0xeb6d1e,_0x59f7('0xd'),JSON['stringify'](_0x553357));if(_0x553357[_0x59f7('0xf')]){if(_0x553357['error'][_0x59f7('0x10')]===0x1f4){logger[_0x59f7('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0xeb6d1e,_0x553357['error'][_0x59f7('0x11')]);return _0x21e3e5(_0x553357[_0x59f7('0xf')][_0x59f7('0x11')]);}logger[_0x59f7('0xf')](_0x59f7('0xc'),_0xeb6d1e,_0x553357[_0x59f7('0xf')]['message']);return _0x3bf8e1(_0x553357['error']['message']);}else{logger[_0x59f7('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0xeb6d1e,_0x59f7('0xd'));_0x3bf8e1(_0x553357[_0x59f7('0x12')][_0x59f7('0x11')]);}})[_0x59f7('0x13')](function(_0x34a5d7){logger[_0x59f7('0xf')](_0x59f7('0xc'),_0xeb6d1e,_0x34a5d7);_0x21e3e5(_0x34a5d7);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 801e020..82535d5 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 _0x2aa9=['/:id/download','diskStorage','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','create','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','isAuthenticated','get','/:id','show'];(function(_0x4b3074,_0xf2a5f2){var _0x514107=function(_0x482fce){while(--_0x482fce){_0x4b3074['push'](_0x4b3074['shift']());}};_0x514107(++_0xf2a5f2);}(_0x2aa9,0x188));var _0x92aa=function(_0x238cbc,_0x41e15e){_0x238cbc=_0x238cbc-0x0;var _0x30069a=_0x2aa9[_0x238cbc];return _0x30069a;};'use strict';var multer=require(_0x92aa('0x0'));var util=require(_0x92aa('0x1'));var path=require(_0x92aa('0x2'));var timeout=require(_0x92aa('0x3'));var express=require(_0x92aa('0x4'));var router=express['Router']();var fs_extra=require(_0x92aa('0x5'));var auth=require(_0x92aa('0x6'));var interaction=require(_0x92aa('0x7'));var config=require('../../config/environment');var controller=require(_0x92aa('0x8'));router['get']('/',auth[_0x92aa('0x9')](),controller['index']);router[_0x92aa('0xa')](_0x92aa('0xb'),auth[_0x92aa('0x9')](),controller[_0x92aa('0xc')]);router[_0x92aa('0xa')](_0x92aa('0xd'),auth[_0x92aa('0x9')](),controller['download']);var upload=multer({'storage':multer[_0x92aa('0xe')]({'destination':function(_0x5c536e,_0xd5bf12,_0x3ea874){_0x3ea874(null,path['join'](config['root'],'server/files/sounds/original/'));},'filename':function(_0x301dde,_0xb2b038,_0x287efe){_0xb2b038[_0x92aa('0xf')]=_0xb2b038[_0x92aa('0xf')][_0x92aa('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x287efe(null,util[_0x92aa('0x11')](_0x92aa('0x12'),path[_0x92aa('0x13')](_0xb2b038[_0x92aa('0xf')],path[_0x92aa('0x14')](_0xb2b038['originalname'])),Date[_0x92aa('0x15')](),path[_0x92aa('0x14')](_0xb2b038[_0x92aa('0xf')])));}})});router[_0x92aa('0x16')]('/',upload[_0x92aa('0x17')]('file'),controller[_0x92aa('0x18')]);router['put']('/:id',auth[_0x92aa('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x92aa('0x19')]);module[_0x92aa('0x1a')]=router; \ No newline at end of file +var _0x71a3=['create','put','update','delete','/:id','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','show','download','diskStorage','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','extname','post','single','file'];(function(_0x4ab271,_0x4b3a27){var _0x5b5ba1=function(_0x198fa9){while(--_0x198fa9){_0x4ab271['push'](_0x4ab271['shift']());}};_0x5b5ba1(++_0x4b3a27);}(_0x71a3,0x85));var _0x371a=function(_0x190349,_0x5b508e){_0x190349=_0x190349-0x0;var _0x1a236c=_0x71a3[_0x190349];return _0x1a236c;};'use strict';var multer=require('multer');var util=require(_0x371a('0x0'));var path=require(_0x371a('0x1'));var timeout=require(_0x371a('0x2'));var express=require(_0x371a('0x3'));var router=express[_0x371a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x371a('0x5'));var interaction=require(_0x371a('0x6'));var config=require(_0x371a('0x7'));var controller=require(_0x371a('0x8'));router[_0x371a('0x9')]('/',auth[_0x371a('0xa')](),controller[_0x371a('0xb')]);router[_0x371a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x371a('0xc')]);router[_0x371a('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x371a('0xd')]);var upload=multer({'storage':multer[_0x371a('0xe')]({'destination':function(_0x3cedae,_0x3df823,_0x35f064){_0x35f064(null,path[_0x371a('0xf')](config['root'],_0x371a('0x10')));},'filename':function(_0x1b0a55,_0x36533b,_0x3e64ba){_0x36533b[_0x371a('0x11')]=_0x36533b['originalname'][_0x371a('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3e64ba(null,util[_0x371a('0x13')](_0x371a('0x14'),path[_0x371a('0x15')](_0x36533b[_0x371a('0x11')],path['extname'](_0x36533b[_0x371a('0x11')])),Date[_0x371a('0x16')](),path[_0x371a('0x17')](_0x36533b[_0x371a('0x11')])));}})});router[_0x371a('0x18')]('/',upload[_0x371a('0x19')](_0x371a('0x1a')),controller[_0x371a('0x1b')]);router[_0x371a('0x1c')]('/:id',auth[_0x371a('0xa')](),controller[_0x371a('0x1d')]);router[_0x371a('0x1e')](_0x371a('0x1f'),auth['isAuthenticated'](),controller[_0x371a('0x1e')]);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 ade7994..97e080e 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 _0x3f74=['INTEGER','sequelize','exports','STRING','name','BIGINT','FLOAT'];(function(_0x32c661,_0x146b3f){var _0x30cc63=function(_0x2ead73){while(--_0x2ead73){_0x32c661['push'](_0x32c661['shift']());}};_0x30cc63(++_0x146b3f);}(_0x3f74,0x127));var _0x43f7=function(_0x10d64d,_0x56ee83){_0x10d64d=_0x10d64d-0x0;var _0x15b39c=_0x3f74[_0x10d64d];return _0x15b39c;};'use strict';var Sequelize=require(_0x43f7('0x0'));module[_0x43f7('0x1')]={'name':{'type':Sequelize[_0x43f7('0x2')],'unique':_0x43f7('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x43f7('0x2')]},'display_name':{'type':Sequelize[_0x43f7('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x43f7('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x43f7('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x43f7('0x2')]},'converted_duration':{'type':Sequelize[_0x43f7('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x43f7('0x4')]},'converted_channelCount':{'type':Sequelize[_0x43f7('0x6')]},'converted_bitRate':{'type':Sequelize[_0x43f7('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x43f7('0x6')]}}; \ No newline at end of file +var _0x2fd0=['sequelize','exports','name','STRING','FLOAT','INTEGER','BIGINT'];(function(_0x2f5b69,_0x485533){var _0x228acc=function(_0x554d6d){while(--_0x554d6d){_0x2f5b69['push'](_0x2f5b69['shift']());}};_0x228acc(++_0x485533);}(_0x2fd0,0x1b2));var _0x02fd=function(_0x256e32,_0x4013bc){_0x256e32=_0x256e32-0x0;var _0x464070=_0x2fd0[_0x256e32];return _0x464070;};'use strict';var Sequelize=require(_0x02fd('0x0'));module[_0x02fd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x02fd('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x02fd('0x3')]},'display_name':{'type':Sequelize[_0x02fd('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0x02fd('0x3')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x02fd('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x02fd('0x5')]},'original_bitRate':{'type':Sequelize[_0x02fd('0x6')]},'original_sampleRate':{'type':Sequelize[_0x02fd('0x5')]},'converted_format':{'type':Sequelize[_0x02fd('0x3')]},'converted_duration':{'type':Sequelize[_0x02fd('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x02fd('0x6')]},'converted_channelCount':{'type':Sequelize[_0x02fd('0x5')]},'converted_bitRate':{'type':Sequelize[_0x02fd('0x6')]},'converted_sampleRate':{'type':Sequelize[_0x02fd('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index aca7111..201b7f0 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 _0x1b86=['original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','sampleCount','converted_channelCount','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','server/files/sounds/original','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','save','update','destroy','UserProfileResource','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','Sound','includeAll','include','rows','catch','params','options','find','download','save_name','converted_format','existsSync','join','root','Sequelize','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','filename','extname','substring','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','error','unlinkSync','src','original_duration','duration'];(function(_0x14f457,_0x540565){var _0x51056d=function(_0x906c18){while(--_0x906c18){_0x14f457['push'](_0x14f457['shift']());}};_0x51056d(++_0x540565);}(_0x1b86,0x114));var _0x61b8=function(_0x37fa0d,_0x1f6ef2){_0x37fa0d=_0x37fa0d-0x0;var _0x1c9b3c=_0x1b86[_0x37fa0d];return _0x1c9b3c;};'use strict';var emlformat=require(_0x61b8('0x0'));var rimraf=require(_0x61b8('0x1'));var zipdir=require(_0x61b8('0x2'));var jsonpatch=require(_0x61b8('0x3'));var rp=require(_0x61b8('0x4'));var moment=require(_0x61b8('0x5'));var BPromise=require(_0x61b8('0x6'));var Mustache=require(_0x61b8('0x7'));var util=require(_0x61b8('0x8'));var path=require(_0x61b8('0x9'));var sox=require(_0x61b8('0xa'));var csv=require(_0x61b8('0xb'));var ejs=require(_0x61b8('0xc'));var fs=require('fs');var fs_extra=require(_0x61b8('0xd'));var _=require(_0x61b8('0xe'));var squel=require(_0x61b8('0xf'));var crypto=require(_0x61b8('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x61b8('0x11'));var toCsv=require('to-csv');var querystring=require(_0x61b8('0x12'));var Papa=require(_0x61b8('0x13'));var Redis=require(_0x61b8('0x14'));var authService=require(_0x61b8('0x15'));var qs=require(_0x61b8('0x16'));var as=require(_0x61b8('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61b8('0x18'))(_0x61b8('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x61b8('0x1a'));var db=require(_0x61b8('0x1b'))['db'];function respondWithStatusCode(_0x2834c7,_0x1aa0c6){_0x1aa0c6=_0x1aa0c6||0xcc;return function(_0x1b4f84){if(_0x1b4f84){return _0x2834c7['sendStatus'](_0x1aa0c6);}return _0x2834c7['status'](_0x1aa0c6)[_0x61b8('0x1c')]();};}function respondWithResult(_0x3e96ff,_0x56d118){_0x56d118=_0x56d118||0xc8;return function(_0x479aef){if(_0x479aef){return _0x3e96ff['status'](_0x56d118)['json'](_0x479aef);}};}function respondWithFilteredResult(_0x592eb6,_0x1b6abe){return function(_0x2e3394){if(_0x2e3394){var _0x574816=typeof _0x1b6abe[_0x61b8('0x1d')]===_0x61b8('0x1e')&&typeof _0x1b6abe['limit']===_0x61b8('0x1e');var _0x473cc9=_0x2e3394[_0x61b8('0x1f')];var _0x1f2064=_0x574816?0x0:_0x1b6abe[_0x61b8('0x1d')];var _0x5daf02=_0x574816?_0x2e3394['count']:_0x1b6abe['offset']+_0x1b6abe[_0x61b8('0x20')];var _0x48995a;if(_0x5daf02>=_0x473cc9){_0x5daf02=_0x473cc9;_0x48995a=0xc8;}else{_0x48995a=0xce;}_0x592eb6[_0x61b8('0x21')](_0x48995a);return _0x592eb6[_0x61b8('0x22')](_0x61b8('0x23'),_0x1f2064+'-'+_0x5daf02+'/'+_0x473cc9)[_0x61b8('0x24')](_0x2e3394);}return null;};}function patchUpdates(_0x3b9278){return function(_0x2cd26c){try{jsonpatch[_0x61b8('0x25')](_0x2cd26c,_0x3b9278,!![]);}catch(_0x3e3fd4){return BPromise['reject'](_0x3e3fd4);}return _0x2cd26c[_0x61b8('0x26')]();};}function saveUpdates(_0x3aed2b,_0x52594c){return function(_0x151045){if(_0x151045){return _0x151045[_0x61b8('0x27')](_0x3aed2b)['then'](function(_0x1476a8){return _0x1476a8;});}return null;};}function removeEntity(_0x3d61e9,_0x54756d){return function(_0x39ab93){if(_0x39ab93){return _0x39ab93[_0x61b8('0x28')]()['then'](function(){var _0x16ff4d=_0x39ab93['get']({'plain':!![]});var _0x268876='Sounds';return db[_0x61b8('0x29')]['destroy']({'where':{'type':_0x268876,'resourceId':_0x16ff4d['id']}})['then'](function(){return _0x39ab93;});})[_0x61b8('0x2a')](function(){_0x3d61e9[_0x61b8('0x21')](0xcc)[_0x61b8('0x1c')]();});}};}function handleEntityNotFound(_0x124b33,_0x2fad40){return function(_0x2f54e3){if(!_0x2f54e3){_0x124b33['sendStatus'](0x194);}return _0x2f54e3;};}function handleError(_0x400660,_0x122d2f){_0x122d2f=_0x122d2f||0x1f4;return function(_0x9df041){logger['error'](_0x9df041[_0x61b8('0x2b')]);if(_0x9df041[_0x61b8('0x2c')]){delete _0x9df041['name'];}_0x400660[_0x61b8('0x21')](_0x122d2f)[_0x61b8('0x2d')](_0x9df041);};}exports[_0x61b8('0x2e')]=function(_0x57fecf,_0x3d08e0){var _0x1d26e2={},_0x5eb055={},_0x5c6752={'count':0x0,'rows':[]};var _0x276029=_[_0x61b8('0x2f')](db['Sound'][_0x61b8('0x30')],function(_0x1c0923){return{'name':_0x1c0923[_0x61b8('0x31')],'type':_0x1c0923[_0x61b8('0x32')][_0x61b8('0x33')]};});_0x5eb055['model']=_['map'](_0x276029,'name');_0x5eb055[_0x61b8('0x34')]=_[_0x61b8('0x35')](_0x57fecf[_0x61b8('0x34')]);_0x5eb055['filters']=_['intersection'](_0x5eb055[_0x61b8('0x36')],_0x5eb055[_0x61b8('0x34')]);_0x1d26e2[_0x61b8('0x37')]=_[_0x61b8('0x38')](_0x5eb055[_0x61b8('0x36')],qs[_0x61b8('0x39')](_0x57fecf[_0x61b8('0x34')][_0x61b8('0x39')]));_0x1d26e2[_0x61b8('0x37')]=_0x1d26e2[_0x61b8('0x37')][_0x61b8('0x3a')]?_0x1d26e2[_0x61b8('0x37')]:_0x5eb055[_0x61b8('0x36')];if(!_0x57fecf[_0x61b8('0x34')]['hasOwnProperty'](_0x61b8('0x3b'))){_0x1d26e2[_0x61b8('0x20')]=qs['limit'](_0x57fecf['query'][_0x61b8('0x20')]);_0x1d26e2[_0x61b8('0x1d')]=qs[_0x61b8('0x1d')](_0x57fecf[_0x61b8('0x34')]['offset']);}_0x1d26e2[_0x61b8('0x3c')]=qs[_0x61b8('0x3d')](_0x57fecf[_0x61b8('0x34')]['sort']);_0x1d26e2[_0x61b8('0x3e')]=qs[_0x61b8('0x3f')](_['pick'](_0x57fecf['query'],_0x5eb055['filters']),_0x276029);if(_0x57fecf[_0x61b8('0x34')][_0x61b8('0x40')]){_0x1d26e2[_0x61b8('0x3e')]=_[_0x61b8('0x41')](_0x1d26e2[_0x61b8('0x3e')],{'$or':_[_0x61b8('0x2f')](_0x276029,function(_0x528d42){if(_0x528d42['type']!==_0x61b8('0x42')){var _0x445cc6={};_0x445cc6[_0x528d42[_0x61b8('0x2c')]]={'$like':'%'+_0x57fecf[_0x61b8('0x34')]['filter']+'%'};return _0x445cc6;}})});}_0x1d26e2=_[_0x61b8('0x41')]({},_0x1d26e2,_0x57fecf['options']);var _0x971bb2={'where':_0x1d26e2[_0x61b8('0x3e')]};return db[_0x61b8('0x43')][_0x61b8('0x1f')](_0x971bb2)['then'](function(_0x4885e1){_0x5c6752[_0x61b8('0x1f')]=_0x4885e1;if(_0x57fecf[_0x61b8('0x34')][_0x61b8('0x44')]){_0x1d26e2[_0x61b8('0x45')]=[{'all':!![]}];}return db[_0x61b8('0x43')]['findAll'](_0x1d26e2);})[_0x61b8('0x2a')](function(_0xc3c88b){_0x5c6752[_0x61b8('0x46')]=_0xc3c88b;return _0x5c6752;})[_0x61b8('0x2a')](respondWithFilteredResult(_0x3d08e0,_0x1d26e2))[_0x61b8('0x47')](handleError(_0x3d08e0,null));};exports['show']=function(_0x5ed2d4,_0x4e2653){var _0x8df0a9={'raw':!![],'where':{'id':_0x5ed2d4[_0x61b8('0x48')]['id']}},_0x485e40={};_0x485e40['model']=_[_0x61b8('0x35')](db[_0x61b8('0x43')][_0x61b8('0x30')]);_0x485e40['query']=_[_0x61b8('0x35')](_0x5ed2d4[_0x61b8('0x34')]);_0x485e40[_0x61b8('0x3f')]=_[_0x61b8('0x38')](_0x485e40[_0x61b8('0x36')],_0x485e40[_0x61b8('0x34')]);_0x8df0a9[_0x61b8('0x37')]=_[_0x61b8('0x38')](_0x485e40[_0x61b8('0x36')],qs['fields'](_0x5ed2d4[_0x61b8('0x34')][_0x61b8('0x39')]));_0x8df0a9[_0x61b8('0x37')]=_0x8df0a9[_0x61b8('0x37')][_0x61b8('0x3a')]?_0x8df0a9['attributes']:_0x485e40[_0x61b8('0x36')];if(_0x5ed2d4[_0x61b8('0x34')][_0x61b8('0x44')]){_0x8df0a9[_0x61b8('0x45')]=[{'all':!![]}];}_0x8df0a9=_['merge']({},_0x8df0a9,_0x5ed2d4[_0x61b8('0x49')]);return db[_0x61b8('0x43')][_0x61b8('0x4a')](_0x8df0a9)[_0x61b8('0x2a')](handleEntityNotFound(_0x4e2653,null))[_0x61b8('0x2a')](respondWithResult(_0x4e2653,null))[_0x61b8('0x47')](handleError(_0x4e2653,null));};exports[_0x61b8('0x4b')]=function(_0x49ef38,_0x38ce5d,_0x37370e){return db[_0x61b8('0x43')][_0x61b8('0x4a')]({'where':{'id':_0x49ef38[_0x61b8('0x48')]['id']},'attributes':[_0x61b8('0x2c'),_0x61b8('0x4c'),_0x61b8('0x4d')],'raw':!![]})[_0x61b8('0x2a')](handleEntityNotFound(_0x38ce5d,null))['then'](function(_0x16d04b){if(_0x16d04b){if(!fs[_0x61b8('0x4e')](path[_0x61b8('0x4f')](config[_0x61b8('0x50')],'server/files/sounds/converted',_0x16d04b[_0x61b8('0x4c')]+'.'+_0x16d04b[_0x61b8('0x4d')]))){throw new db[(_0x61b8('0x51'))]['ValidationError'](_0x61b8('0x52'));}return _0x38ce5d['download'](path[_0x61b8('0x4f')](config[_0x61b8('0x50')],_0x61b8('0x53'),util[_0x61b8('0x54')](_0x61b8('0x55'),_0x16d04b[_0x61b8('0x4c')],_0x16d04b[_0x61b8('0x4d')])),util[_0x61b8('0x54')](_0x61b8('0x55'),_0x16d04b[_0x61b8('0x2c')],_0x16d04b[_0x61b8('0x4d')]));}return null;})[_0x61b8('0x47')](handleError(_0x38ce5d,null));};exports[_0x61b8('0x56')]=function(_0x21e45a,_0x1984e6,_0x2c6700){var _0x233199={'name':path[_0x61b8('0x57')](_0x21e45a[_0x61b8('0x58')][_0x61b8('0x59')],path['extname'](_0x21e45a[_0x61b8('0x58')][_0x61b8('0x59')])),'save_name':path[_0x61b8('0x57')](_0x21e45a['file'][_0x61b8('0x5a')],path[_0x61b8('0x5b')](_0x21e45a[_0x61b8('0x58')][_0x61b8('0x5a')])),'original_format':path['extname'](_0x21e45a['file'][_0x61b8('0x59')])[_0x61b8('0x5c')](0x1),'converted_format':'wav'};var _0x45cc75=path[_0x61b8('0x4f')](config[_0x61b8('0x50')],'server/files/sounds/original',_0x21e45a[_0x61b8('0x58')][_0x61b8('0x5a')]);var _0x4224d3=path[_0x61b8('0x4f')](config['root'],_0x61b8('0x53'),util[_0x61b8('0x54')](_0x61b8('0x55'),path['basename'](_0x21e45a['file'][_0x61b8('0x5a')],path[_0x61b8('0x5b')](_0x21e45a[_0x61b8('0x58')][_0x61b8('0x5a')])),_0x233199[_0x61b8('0x4d')]));logger[_0x61b8('0x5d')](_0x61b8('0x5e'),_0x45cc75);logger['info'](_0x61b8('0x5f'),_0x4224d3);try{fs[_0x61b8('0x60')](_0x45cc75,parseInt(_0x61b8('0x61'),0x8));var _0x5528d0=sox[_0x61b8('0x62')](_0x45cc75,_0x4224d3,{'sampleRate':0x1f40,'format':_0x61b8('0x63'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5528d0['on'](_0x61b8('0x64'),function(_0x1c2785){fs[_0x61b8('0x65')](_0x45cc75);_0x1984e6['status'](0x1f4)[_0x61b8('0x2d')](_0x1c2785);});_0x5528d0['on'](_0x61b8('0x66'),function(_0x2bb99e){_0x233199[_0x61b8('0x67')]=isNaN(_0x2bb99e['duration'])?null:_0x2bb99e[_0x61b8('0x68')]*0x3e8;_0x233199['original_sampleCount']=isNaN(_0x2bb99e['sampleCount'])?null:_0x2bb99e['sampleCount'];_0x233199[_0x61b8('0x69')]=isNaN(_0x2bb99e[_0x61b8('0x6a')])?null:_0x2bb99e[_0x61b8('0x6a')];_0x233199[_0x61b8('0x6b')]=isNaN(_0x2bb99e[_0x61b8('0x6c')])?null:_0x2bb99e[_0x61b8('0x6c')];_0x233199[_0x61b8('0x6d')]=isNaN(_0x2bb99e[_0x61b8('0x6e')])?null:_0x2bb99e[_0x61b8('0x6e')];});_0x5528d0['on'](_0x61b8('0x6f'),function(_0x24cbf6){_0x233199['converted_duration']=isNaN(_0x24cbf6[_0x61b8('0x68')])?null:_0x24cbf6[_0x61b8('0x68')]*0x3e8;_0x233199['converted_sampleCount']=isNaN(_0x24cbf6[_0x61b8('0x70')])?null:_0x24cbf6[_0x61b8('0x70')];_0x233199[_0x61b8('0x71')]=isNaN(_0x24cbf6['channelCount'])?null:_0x24cbf6[_0x61b8('0x6a')];_0x233199['converted_bitRate']=isNaN(_0x24cbf6[_0x61b8('0x6c')])?null:_0x24cbf6['bitRate'];_0x233199[_0x61b8('0x72')]=isNaN(_0x24cbf6[_0x61b8('0x6e')])?null:_0x24cbf6[_0x61b8('0x6e')];});_0x5528d0['on']('end',function(){fs['chmodSync'](_0x4224d3,parseInt(_0x61b8('0x61'),0x8));return db[_0x61b8('0x43')]['create'](_0x233199)[_0x61b8('0x2a')](function(_0x131d66){var _0x19a568={'role':_0x21e45a[_0x61b8('0x73')][_0x61b8('0x74')],'userProfileId':_0x21e45a[_0x61b8('0x73')][_0x61b8('0x75')]};if(!_0x19a568)throw new Error(_0x61b8('0x76'));if(_0x19a568[_0x61b8('0x74')]==='user'){var _0x31c782=_0x131d66[_0x61b8('0x77')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x61b8('0x78'),'userProfileId':_0x19a568[_0x61b8('0x75')]},'raw':!![]})['then'](function(_0x11c3fb){if(_0x11c3fb&&_0x11c3fb[_0x61b8('0x79')]===0x0){return db[_0x61b8('0x29')][_0x61b8('0x56')]({'name':_0x31c782[_0x61b8('0x2c')],'resourceId':_0x31c782['id'],'type':_0x11c3fb['name'],'sectionId':_0x11c3fb['id']},{})[_0x61b8('0x2a')](function(){return _0x131d66;});}else{return _0x131d66;}})[_0x61b8('0x47')](function(_0x1170b6){logger[_0x61b8('0x64')](_0x61b8('0x7a'),_0x1170b6);throw _0x1170b6;});}return _0x131d66;})[_0x61b8('0x2a')](respondWithResult(_0x1984e6,null))[_0x61b8('0x47')](handleError(_0x1984e6,null));});_0x5528d0[_0x61b8('0x7b')]();}catch(_0x33d6e5){_0x1984e6['status'](0x1f4)[_0x61b8('0x2d')](_0x33d6e5);}};exports[_0x61b8('0x27')]=function(_0xc9d89d,_0x10d19c,_0x33ab3c){return db[_0x61b8('0x43')][_0x61b8('0x4a')]({'where':{'id':_0xc9d89d[_0x61b8('0x48')]['id']}})[_0x61b8('0x2a')](handleEntityNotFound(_0x10d19c,null))[_0x61b8('0x2a')](saveUpdates(_[_0x61b8('0x7c')](_0xc9d89d[_0x61b8('0x73')],['name',_0x61b8('0x7d')]),null))[_0x61b8('0x2a')](respondWithResult(_0x10d19c,null))['catch'](handleError(_0x10d19c,null));};exports['delete']=function(_0x1f3d35,_0x5f0369,_0x1a3dbe){return db[_0x61b8('0x43')][_0x61b8('0x4a')]({'where':{'id':_0x1f3d35[_0x61b8('0x48')]['id']}})[_0x61b8('0x2a')](function(_0x2394c1){if(_0x2394c1){return _0x2394c1['destroy']();}})[_0x61b8('0x2a')](function(_0xa2307e){var _0x18f61b=path['join'](config['root'],_0x61b8('0x7e'),util[_0x61b8('0x54')](_0x61b8('0x55'),_0xa2307e[_0x61b8('0x4c')],_0xa2307e['original_format']));var _0x1b1d7b=path[_0x61b8('0x4f')](config[_0x61b8('0x50')],_0x61b8('0x53'),util[_0x61b8('0x54')](_0x61b8('0x55'),_0xa2307e[_0x61b8('0x4c')],_0xa2307e[_0x61b8('0x4d')]));fs['unlinkSync'](_0x18f61b);fs['unlinkSync'](_0x1b1d7b);return _0xa2307e;})[_0x61b8('0x2a')](function(_0x4b7e0e){if(_0x4b7e0e){return _0x5f0369[_0x61b8('0x21')](0xcc)['end']();}})[_0x61b8('0x2a')](handleEntityNotFound(_0x5f0369,null))[_0x61b8('0x47')](handleError(_0x5f0369,null));}; \ No newline at end of file +var _0x6c4e=['original_bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','bitRate','converted_sampleRate','body','role','userProfileId','UserProfileSection','start','server/files/sounds/original','original_format','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','end','error','stack','name','send','index','Sound','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','keys','fields','include','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','format','create','basename','originalname','extname','file','filename','substring','wav','%s.%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount'];(function(_0x11a8d3,_0x35f4e0){var _0x4bfa4f=function(_0x3d2f07){while(--_0x3d2f07){_0x11a8d3['push'](_0x11a8d3['shift']());}};_0x4bfa4f(++_0x35f4e0);}(_0x6c4e,0x8d));var _0xe6c4=function(_0xcf764b,_0x446377){_0xcf764b=_0xcf764b-0x0;var _0x400040=_0x6c4e[_0xcf764b];return _0x400040;};'use strict';var emlformat=require(_0xe6c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe6c4('0x1'));var jsonpatch=require(_0xe6c4('0x2'));var rp=require(_0xe6c4('0x3'));var moment=require(_0xe6c4('0x4'));var BPromise=require(_0xe6c4('0x5'));var Mustache=require(_0xe6c4('0x6'));var util=require('util');var path=require(_0xe6c4('0x7'));var sox=require(_0xe6c4('0x8'));var csv=require(_0xe6c4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe6c4('0xa'));var _=require(_0xe6c4('0xb'));var squel=require(_0xe6c4('0xc'));var crypto=require('crypto');var jsforce=require(_0xe6c4('0xd'));var deskjs=require(_0xe6c4('0xe'));var toCsv=require(_0xe6c4('0x9'));var querystring=require(_0xe6c4('0xf'));var Papa=require(_0xe6c4('0x10'));var Redis=require(_0xe6c4('0x11'));var authService=require(_0xe6c4('0x12'));var qs=require(_0xe6c4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe6c4('0x14'));var utils=require(_0xe6c4('0x15'));var config=require(_0xe6c4('0x16'));var licenseUtil=require(_0xe6c4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x268071,_0x4c3b53){_0x4c3b53=_0x4c3b53||0xcc;return function(_0x3dccdd){if(_0x3dccdd){return _0x268071[_0xe6c4('0x18')](_0x4c3b53);}return _0x268071[_0xe6c4('0x19')](_0x4c3b53)['end']();};}function respondWithResult(_0xd878df,_0x816d35){_0x816d35=_0x816d35||0xc8;return function(_0x5f0f36){if(_0x5f0f36){return _0xd878df[_0xe6c4('0x19')](_0x816d35)[_0xe6c4('0x1a')](_0x5f0f36);}};}function respondWithFilteredResult(_0x5028f4,_0x5dcdc6){return function(_0x4d62db){if(_0x4d62db){var _0x5a83ac=typeof _0x5dcdc6[_0xe6c4('0x1b')]==='undefined'&&typeof _0x5dcdc6[_0xe6c4('0x1c')]===_0xe6c4('0x1d');var _0x43ecc4=_0x4d62db['count'];var _0x5cf62d=_0x5a83ac?0x0:_0x5dcdc6[_0xe6c4('0x1b')];var _0x163cb3=_0x5a83ac?_0x4d62db[_0xe6c4('0x1e')]:_0x5dcdc6[_0xe6c4('0x1b')]+_0x5dcdc6[_0xe6c4('0x1c')];var _0x1d99a5;if(_0x163cb3>=_0x43ecc4){_0x163cb3=_0x43ecc4;_0x1d99a5=0xc8;}else{_0x1d99a5=0xce;}_0x5028f4[_0xe6c4('0x19')](_0x1d99a5);return _0x5028f4[_0xe6c4('0x1f')](_0xe6c4('0x20'),_0x5cf62d+'-'+_0x163cb3+'/'+_0x43ecc4)[_0xe6c4('0x1a')](_0x4d62db);}return null;};}function patchUpdates(_0x26b280){return function(_0x28eaff){try{jsonpatch[_0xe6c4('0x21')](_0x28eaff,_0x26b280,!![]);}catch(_0x5b5816){return BPromise[_0xe6c4('0x22')](_0x5b5816);}return _0x28eaff[_0xe6c4('0x23')]();};}function saveUpdates(_0x54f15d,_0x4fa7a4){return function(_0x4a71aa){if(_0x4a71aa){return _0x4a71aa[_0xe6c4('0x24')](_0x54f15d)[_0xe6c4('0x25')](function(_0x4be801){return _0x4be801;});}return null;};}function removeEntity(_0x3d0cd6,_0x232596){return function(_0x300cb8){if(_0x300cb8){return _0x300cb8[_0xe6c4('0x26')]()[_0xe6c4('0x25')](function(){var _0x3a7435=_0x300cb8[_0xe6c4('0x27')]({'plain':!![]});var _0x595eee=_0xe6c4('0x28');return db[_0xe6c4('0x29')][_0xe6c4('0x26')]({'where':{'type':_0x595eee,'resourceId':_0x3a7435['id']}})[_0xe6c4('0x25')](function(){return _0x300cb8;});})[_0xe6c4('0x25')](function(){_0x3d0cd6[_0xe6c4('0x19')](0xcc)[_0xe6c4('0x2a')]();});}};}function handleEntityNotFound(_0x4fa2ea,_0x4a2942){return function(_0x59d22e){if(!_0x59d22e){_0x4fa2ea['sendStatus'](0x194);}return _0x59d22e;};}function handleError(_0x181bb5,_0x4a8227){_0x4a8227=_0x4a8227||0x1f4;return function(_0xc06194){logger[_0xe6c4('0x2b')](_0xc06194[_0xe6c4('0x2c')]);if(_0xc06194[_0xe6c4('0x2d')]){delete _0xc06194[_0xe6c4('0x2d')];}_0x181bb5[_0xe6c4('0x19')](_0x4a8227)[_0xe6c4('0x2e')](_0xc06194);};}exports[_0xe6c4('0x2f')]=function(_0x51c47b,_0x5f3268){var _0xea77e0={},_0x1a94db={},_0x45569f={'count':0x0,'rows':[]};var _0x2bbfa8=_['map'](db[_0xe6c4('0x30')][_0xe6c4('0x31')],function(_0x383832){return{'name':_0x383832[_0xe6c4('0x32')],'type':_0x383832[_0xe6c4('0x33')]['key']};});_0x1a94db[_0xe6c4('0x34')]=_[_0xe6c4('0x35')](_0x2bbfa8,_0xe6c4('0x2d'));_0x1a94db['query']=_['keys'](_0x51c47b[_0xe6c4('0x36')]);_0x1a94db[_0xe6c4('0x37')]=_[_0xe6c4('0x38')](_0x1a94db['model'],_0x1a94db[_0xe6c4('0x36')]);_0xea77e0['attributes']=_[_0xe6c4('0x38')](_0x1a94db[_0xe6c4('0x34')],qs['fields'](_0x51c47b[_0xe6c4('0x36')]['fields']));_0xea77e0[_0xe6c4('0x39')]=_0xea77e0['attributes'][_0xe6c4('0x3a')]?_0xea77e0[_0xe6c4('0x39')]:_0x1a94db[_0xe6c4('0x34')];if(!_0x51c47b[_0xe6c4('0x36')][_0xe6c4('0x3b')](_0xe6c4('0x3c'))){_0xea77e0[_0xe6c4('0x1c')]=qs[_0xe6c4('0x1c')](_0x51c47b[_0xe6c4('0x36')]['limit']);_0xea77e0[_0xe6c4('0x1b')]=qs[_0xe6c4('0x1b')](_0x51c47b[_0xe6c4('0x36')][_0xe6c4('0x1b')]);}_0xea77e0[_0xe6c4('0x3d')]=qs[_0xe6c4('0x3e')](_0x51c47b[_0xe6c4('0x36')][_0xe6c4('0x3e')]);_0xea77e0[_0xe6c4('0x3f')]=qs[_0xe6c4('0x37')](_[_0xe6c4('0x40')](_0x51c47b[_0xe6c4('0x36')],_0x1a94db[_0xe6c4('0x37')]),_0x2bbfa8);if(_0x51c47b[_0xe6c4('0x36')]['filter']){_0xea77e0[_0xe6c4('0x3f')]=_[_0xe6c4('0x41')](_0xea77e0['where'],{'$or':_['map'](_0x2bbfa8,function(_0x486c1e){if(_0x486c1e[_0xe6c4('0x33')]!==_0xe6c4('0x42')){var _0x38d4d7={};_0x38d4d7[_0x486c1e[_0xe6c4('0x2d')]]={'$like':'%'+_0x51c47b[_0xe6c4('0x36')][_0xe6c4('0x43')]+'%'};return _0x38d4d7;}})});}_0xea77e0=_['merge']({},_0xea77e0,_0x51c47b[_0xe6c4('0x44')]);var _0x4b38cd={'where':_0xea77e0[_0xe6c4('0x3f')]};return db[_0xe6c4('0x30')][_0xe6c4('0x1e')](_0x4b38cd)[_0xe6c4('0x25')](function(_0x3d3acd){_0x45569f[_0xe6c4('0x1e')]=_0x3d3acd;if(_0x51c47b['query'][_0xe6c4('0x45')]){_0xea77e0['include']=[{'all':!![]}];}return db['Sound']['findAll'](_0xea77e0);})[_0xe6c4('0x25')](function(_0x307b68){_0x45569f[_0xe6c4('0x46')]=_0x307b68;return _0x45569f;})[_0xe6c4('0x25')](respondWithFilteredResult(_0x5f3268,_0xea77e0))[_0xe6c4('0x47')](handleError(_0x5f3268,null));};exports[_0xe6c4('0x48')]=function(_0x411b78,_0x54512e){var _0x44568e={'raw':!![],'where':{'id':_0x411b78[_0xe6c4('0x49')]['id']}},_0x2c80f4={};_0x2c80f4[_0xe6c4('0x34')]=_[_0xe6c4('0x4a')](db['Sound'][_0xe6c4('0x31')]);_0x2c80f4[_0xe6c4('0x36')]=_[_0xe6c4('0x4a')](_0x411b78['query']);_0x2c80f4[_0xe6c4('0x37')]=_[_0xe6c4('0x38')](_0x2c80f4['model'],_0x2c80f4['query']);_0x44568e[_0xe6c4('0x39')]=_[_0xe6c4('0x38')](_0x2c80f4[_0xe6c4('0x34')],qs['fields'](_0x411b78[_0xe6c4('0x36')][_0xe6c4('0x4b')]));_0x44568e[_0xe6c4('0x39')]=_0x44568e[_0xe6c4('0x39')][_0xe6c4('0x3a')]?_0x44568e[_0xe6c4('0x39')]:_0x2c80f4[_0xe6c4('0x34')];if(_0x411b78[_0xe6c4('0x36')][_0xe6c4('0x45')]){_0x44568e[_0xe6c4('0x4c')]=[{'all':!![]}];}_0x44568e=_[_0xe6c4('0x41')]({},_0x44568e,_0x411b78[_0xe6c4('0x44')]);return db[_0xe6c4('0x30')][_0xe6c4('0x4d')](_0x44568e)[_0xe6c4('0x25')](handleEntityNotFound(_0x54512e,null))[_0xe6c4('0x25')](respondWithResult(_0x54512e,null))[_0xe6c4('0x47')](handleError(_0x54512e,null));};exports[_0xe6c4('0x4e')]=function(_0xc3a5fc,_0x269178,_0x1a30e2){return db['Sound'][_0xe6c4('0x4d')]({'where':{'id':_0xc3a5fc['params']['id']},'attributes':[_0xe6c4('0x2d'),_0xe6c4('0x4f'),_0xe6c4('0x50')],'raw':!![]})[_0xe6c4('0x25')](handleEntityNotFound(_0x269178,null))[_0xe6c4('0x25')](function(_0x1f8ea7){if(_0x1f8ea7){if(!fs[_0xe6c4('0x51')](path[_0xe6c4('0x52')](config[_0xe6c4('0x53')],_0xe6c4('0x54'),_0x1f8ea7[_0xe6c4('0x4f')]+'.'+_0x1f8ea7[_0xe6c4('0x50')]))){throw new db[(_0xe6c4('0x55'))][(_0xe6c4('0x56'))]('Sound\x20not\x20found');}return _0x269178[_0xe6c4('0x4e')](path[_0xe6c4('0x52')](config[_0xe6c4('0x53')],'server/files/sounds/converted',util[_0xe6c4('0x57')]('%s.%s',_0x1f8ea7[_0xe6c4('0x4f')],_0x1f8ea7[_0xe6c4('0x50')])),util[_0xe6c4('0x57')]('%s.%s',_0x1f8ea7[_0xe6c4('0x2d')],_0x1f8ea7[_0xe6c4('0x50')]));}return null;})[_0xe6c4('0x47')](handleError(_0x269178,null));};exports[_0xe6c4('0x58')]=function(_0x41ef57,_0x186562,_0x680797){var _0xb149ca={'name':path[_0xe6c4('0x59')](_0x41ef57['file'][_0xe6c4('0x5a')],path[_0xe6c4('0x5b')](_0x41ef57[_0xe6c4('0x5c')][_0xe6c4('0x5a')])),'save_name':path[_0xe6c4('0x59')](_0x41ef57[_0xe6c4('0x5c')][_0xe6c4('0x5d')],path[_0xe6c4('0x5b')](_0x41ef57[_0xe6c4('0x5c')]['filename'])),'original_format':path[_0xe6c4('0x5b')](_0x41ef57[_0xe6c4('0x5c')]['originalname'])[_0xe6c4('0x5e')](0x1),'converted_format':_0xe6c4('0x5f')};var _0x300320=path[_0xe6c4('0x52')](config['root'],'server/files/sounds/original',_0x41ef57[_0xe6c4('0x5c')]['filename']);var _0x3fd727=path['join'](config['root'],_0xe6c4('0x54'),util[_0xe6c4('0x57')](_0xe6c4('0x60'),path[_0xe6c4('0x59')](_0x41ef57['file']['filename'],path['extname'](_0x41ef57['file'][_0xe6c4('0x5d')])),_0xb149ca[_0xe6c4('0x50')]));logger[_0xe6c4('0x61')]('Sound\x20upload\x20filepath:\x20%s',_0x300320);logger['info'](_0xe6c4('0x62'),_0x3fd727);try{fs[_0xe6c4('0x63')](_0x300320,parseInt(_0xe6c4('0x64'),0x8));var _0xee1863=sox[_0xe6c4('0x65')](_0x300320,_0x3fd727,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xee1863['on'](_0xe6c4('0x2b'),function(_0xce374a){fs[_0xe6c4('0x66')](_0x300320);_0x186562[_0xe6c4('0x19')](0x1f4)[_0xe6c4('0x2e')](_0xce374a);});_0xee1863['on']('src',function(_0xeae137){_0xb149ca[_0xe6c4('0x67')]=isNaN(_0xeae137['duration'])?null:_0xeae137[_0xe6c4('0x68')]*0x3e8;_0xb149ca[_0xe6c4('0x69')]=isNaN(_0xeae137[_0xe6c4('0x6a')])?null:_0xeae137[_0xe6c4('0x6a')];_0xb149ca[_0xe6c4('0x6b')]=isNaN(_0xeae137[_0xe6c4('0x6c')])?null:_0xeae137['channelCount'];_0xb149ca[_0xe6c4('0x6d')]=isNaN(_0xeae137['bitRate'])?null:_0xeae137['bitRate'];_0xb149ca[_0xe6c4('0x6e')]=isNaN(_0xeae137[_0xe6c4('0x6f')])?null:_0xeae137[_0xe6c4('0x6f')];});_0xee1863['on']('dest',function(_0x15a583){_0xb149ca[_0xe6c4('0x70')]=isNaN(_0x15a583[_0xe6c4('0x68')])?null:_0x15a583[_0xe6c4('0x68')]*0x3e8;_0xb149ca[_0xe6c4('0x71')]=isNaN(_0x15a583[_0xe6c4('0x6a')])?null:_0x15a583['sampleCount'];_0xb149ca[_0xe6c4('0x72')]=isNaN(_0x15a583['channelCount'])?null:_0x15a583['channelCount'];_0xb149ca[_0xe6c4('0x73')]=isNaN(_0x15a583['bitRate'])?null:_0x15a583[_0xe6c4('0x74')];_0xb149ca[_0xe6c4('0x75')]=isNaN(_0x15a583['sampleRate'])?null:_0x15a583['sampleRate'];});_0xee1863['on'](_0xe6c4('0x2a'),function(){fs[_0xe6c4('0x63')](_0x3fd727,parseInt(_0xe6c4('0x64'),0x8));return db[_0xe6c4('0x30')][_0xe6c4('0x58')](_0xb149ca)[_0xe6c4('0x25')](function(_0x137fb6){var _0xf0a30f={'role':_0x41ef57[_0xe6c4('0x76')][_0xe6c4('0x77')],'userProfileId':_0x41ef57[_0xe6c4('0x76')][_0xe6c4('0x78')]};if(!_0xf0a30f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf0a30f['role']==='user'){var _0xc3a13e=_0x137fb6['get']({'plain':!![]});return db[_0xe6c4('0x79')][_0xe6c4('0x4d')]({'where':{'name':_0xe6c4('0x28'),'userProfileId':_0xf0a30f[_0xe6c4('0x78')]},'raw':!![]})[_0xe6c4('0x25')](function(_0x2b3b7f){if(_0x2b3b7f&&_0x2b3b7f['autoAssociation']===0x0){return db[_0xe6c4('0x29')]['create']({'name':_0xc3a13e[_0xe6c4('0x2d')],'resourceId':_0xc3a13e['id'],'type':_0x2b3b7f[_0xe6c4('0x2d')],'sectionId':_0x2b3b7f['id']},{})['then'](function(){return _0x137fb6;});}else{return _0x137fb6;}})['catch'](function(_0x1776c6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1776c6);throw _0x1776c6;});}return _0x137fb6;})[_0xe6c4('0x25')](respondWithResult(_0x186562,null))['catch'](handleError(_0x186562,null));});_0xee1863[_0xe6c4('0x7a')]();}catch(_0x3cbcd0){_0x186562['status'](0x1f4)[_0xe6c4('0x2e')](_0x3cbcd0);}};exports['update']=function(_0x2ac495,_0x5c6c66,_0x1cff84){return db[_0xe6c4('0x30')][_0xe6c4('0x4d')]({'where':{'id':_0x2ac495[_0xe6c4('0x49')]['id']}})[_0xe6c4('0x25')](handleEntityNotFound(_0x5c6c66,null))[_0xe6c4('0x25')](saveUpdates(_['pick'](_0x2ac495['body'],[_0xe6c4('0x2d'),'description']),null))[_0xe6c4('0x25')](respondWithResult(_0x5c6c66,null))[_0xe6c4('0x47')](handleError(_0x5c6c66,null));};exports['delete']=function(_0x35d010,_0x187573,_0x139dd6){return db[_0xe6c4('0x30')][_0xe6c4('0x4d')]({'where':{'id':_0x35d010[_0xe6c4('0x49')]['id']}})[_0xe6c4('0x25')](function(_0x555e5d){if(_0x555e5d){return _0x555e5d[_0xe6c4('0x26')]();}})['then'](function(_0x2d6dd8){var _0x4fe0f9=path[_0xe6c4('0x52')](config['root'],_0xe6c4('0x7b'),util[_0xe6c4('0x57')](_0xe6c4('0x60'),_0x2d6dd8[_0xe6c4('0x4f')],_0x2d6dd8[_0xe6c4('0x7c')]));var _0xca3644=path[_0xe6c4('0x52')](config['root'],'server/files/sounds/converted',util['format'](_0xe6c4('0x60'),_0x2d6dd8[_0xe6c4('0x4f')],_0x2d6dd8[_0xe6c4('0x50')]));fs[_0xe6c4('0x66')](_0x4fe0f9);fs[_0xe6c4('0x66')](_0xca3644);return _0x2d6dd8;})['then'](function(_0x3e3bea){if(_0x3e3bea){return _0x187573[_0xe6c4('0x19')](0xcc)[_0xe6c4('0x2a')]();}})[_0xe6c4('0x25')](handleEntityNotFound(_0x187573,null))[_0xe6c4('0x47')](handleError(_0x187573,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 20654ab..bb1574b 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 _0x6974=['exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6974,0x15d));var _0x4697=function(_0x5421ac,_0x406c77){_0x5421ac=_0x5421ac-0x0;var _0x3b67a4=_0x6974[_0x5421ac];return _0x3b67a4;};'use strict';var _=require(_0x4697('0x0'));var util=require(_0x4697('0x1'));var logger=require(_0x4697('0x2'))(_0x4697('0x3'));var moment=require(_0x4697('0x4'));var BPromise=require(_0x4697('0x5'));var rp=require(_0x4697('0x6'));var fs=require('fs');var path=require(_0x4697('0x7'));var rimraf=require(_0x4697('0x8'));var config=require(_0x4697('0x9'));var attributes=require(_0x4697('0xa'));module[_0x4697('0xb')]=function(_0x1bf9a9,_0x557c3a){return _0x1bf9a9[_0x4697('0xc')](_0x4697('0xd'),attributes,{'tableName':_0x4697('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['moment','bluebird','path','rimraf','../../config/environment','exports','define','Sound','tools_sounds','lodash','api'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x0295,0x1a0));var _0x5029=function(_0x20a791,_0x49718f){_0x20a791=_0x20a791-0x0;var _0xe0f198=_0x0295[_0x20a791];return _0xe0f198;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require(_0x5029('0x2'));var BPromise=require(_0x5029('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5029('0x4'));var rimraf=require(_0x5029('0x5'));var config=require(_0x5029('0x6'));var attributes=require('./sound.attributes');module[_0x5029('0x7')]=function(_0x5d81ac,_0x298559){return _0x5d81ac[_0x5029('0x8')](_0x5029('0x9'),attributes,{'tableName':_0x5029('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index fd9fdd1..b1883f6 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 _0x4dfe=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','find','options','raw','where','map','include','model','attributes','debug','lodash','util','bluebird'];(function(_0x3128fe,_0x5cc089){var _0x40af01=function(_0x4af77b){while(--_0x4af77b){_0x3128fe['push'](_0x3128fe['shift']());}};_0x40af01(++_0x5cc089);}(_0x4dfe,0x85));var _0xe4df=function(_0x4fea0d,_0x44716c){_0x4fea0d=_0x4fea0d-0x0;var _0x134505=_0x4dfe[_0x4fea0d];return _0x134505;};'use strict';var _=require(_0xe4df('0x0'));var util=require(_0xe4df('0x1'));var moment=require('moment');var BPromise=require(_0xe4df('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4df('0x3'));var db=require(_0xe4df('0x4'))['db'];var utils=require(_0xe4df('0x5'));var logger=require(_0xe4df('0x6'))('rpc');var config=require(_0xe4df('0x7'));var jayson=require(_0xe4df('0x8'));var client=jayson[_0xe4df('0x9')][_0xe4df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1314fe,_0x415418,_0x1c5800){return new BPromise(function(_0x4e1162,_0xc42e0f){return client[_0xe4df('0xb')](_0x1314fe,_0x1c5800)[_0xe4df('0xc')](function(_0xc01209){logger[_0xe4df('0xd')]('Sound,\x20%s,\x20%s',_0x415418,_0xe4df('0xe'));logger['debug'](_0xe4df('0xf'),_0x415418,_0xe4df('0xe'),JSON[_0xe4df('0x10')](_0xc01209));if(_0xc01209['error']){if(_0xc01209[_0xe4df('0x11')][_0xe4df('0x12')]===0x1f4){logger[_0xe4df('0x11')](_0xe4df('0x13'),_0x415418,_0xc01209[_0xe4df('0x11')][_0xe4df('0x14')]);return _0xc42e0f(_0xc01209['error'][_0xe4df('0x14')]);}logger['error'](_0xe4df('0x13'),_0x415418,_0xc01209['error'][_0xe4df('0x14')]);return _0x4e1162(_0xc01209[_0xe4df('0x11')][_0xe4df('0x14')]);}else{logger[_0xe4df('0xd')](_0xe4df('0x13'),_0x415418,_0xe4df('0xe'));_0x4e1162(_0xc01209[_0xe4df('0x15')]['message']);}})[_0xe4df('0x16')](function(_0x442604){logger[_0xe4df('0x11')](_0xe4df('0x13'),_0x415418,_0x442604);_0xc42e0f(_0x442604);});});}exports[_0xe4df('0x17')]=function(_0xfe8916){var _0x47f559=this;return new Promise(function(_0x121154,_0x4d614d){return db[_0xe4df('0x18')][_0xe4df('0x19')]({'raw':_0xfe8916[_0xe4df('0x1a')]?_0xfe8916[_0xe4df('0x1a')][_0xe4df('0x1b')]===undefined?!![]:![]:!![],'where':_0xfe8916[_0xe4df('0x1a')]?_0xfe8916[_0xe4df('0x1a')][_0xe4df('0x1c')]||null:null,'attributes':_0xfe8916['options']?_0xfe8916[_0xe4df('0x1a')]['attributes']||null:null,'include':_0xfe8916['options']?_0xfe8916['options']['include']?_[_0xe4df('0x1d')](_0xfe8916[_0xe4df('0x1a')][_0xe4df('0x1e')],function(_0x5d8e28){return{'model':db[_0x5d8e28[_0xe4df('0x1f')]],'as':_0x5d8e28['as'],'attributes':_0x5d8e28[_0xe4df('0x20')],'include':_0x5d8e28[_0xe4df('0x1e')]?_[_0xe4df('0x1d')](_0x5d8e28[_0xe4df('0x1e')],function(_0xb9249c){return{'model':db[_0xb9249c[_0xe4df('0x1f')]],'as':_0xb9249c['as'],'attributes':_0xb9249c['attributes'],'include':_0xb9249c[_0xe4df('0x1e')]?_[_0xe4df('0x1d')](_0xb9249c[_0xe4df('0x1e')],function(_0x4f36c6){return{'model':db[_0x4f36c6['model']],'as':_0x4f36c6['as'],'attributes':_0x4f36c6[_0xe4df('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe4df('0xc')](function(_0x1e766a){logger[_0xe4df('0xd')](_0xe4df('0x17'),_0xfe8916);logger[_0xe4df('0x21')](_0xe4df('0x17'),_0xfe8916,JSON['stringify'](_0x1e766a));_0x121154(_0x1e766a);})[_0xe4df('0x16')](function(_0x3a79c1){logger[_0xe4df('0x11')](_0xe4df('0x17'),_0x3a79c1[_0xe4df('0x14')],_0xfe8916);_0x4d614d(_0x47f559[_0xe4df('0x11')](0x1f4,_0x3a79c1[_0xe4df('0x14')]));});});}; \ No newline at end of file +var _0x3943=['ShowSound','Sound','find','options','raw','where','attributes','include','map','model','info','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','result'];(function(_0x57caf0,_0x1fe145){var _0x65d871=function(_0x56a92){while(--_0x56a92){_0x57caf0['push'](_0x57caf0['shift']());}};_0x65d871(++_0x1fe145);}(_0x3943,0xb0));var _0x3394=function(_0x4f05a8,_0x5a5b0f){_0x4f05a8=_0x4f05a8-0x0;var _0x23f853=_0x3943[_0x4f05a8];return _0x23f853;};'use strict';var _=require(_0x3394('0x0'));var util=require(_0x3394('0x1'));var moment=require(_0x3394('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3394('0x3'));var db=require(_0x3394('0x4'))['db'];var utils=require(_0x3394('0x5'));var logger=require(_0x3394('0x6'))(_0x3394('0x7'));var config=require('../../config/environment');var jayson=require(_0x3394('0x8'));var client=jayson[_0x3394('0x9')][_0x3394('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d8a4d,_0x2b581c,_0x173d87){return new BPromise(function(_0x342167,_0x269d99){return client[_0x3394('0xb')](_0x2d8a4d,_0x173d87)[_0x3394('0xc')](function(_0x595e4b){logger['info']('Sound,\x20%s,\x20%s',_0x2b581c,_0x3394('0xd'));logger[_0x3394('0xe')](_0x3394('0xf'),_0x2b581c,_0x3394('0xd'),JSON[_0x3394('0x10')](_0x595e4b));if(_0x595e4b[_0x3394('0x11')]){if(_0x595e4b['error'][_0x3394('0x12')]===0x1f4){logger[_0x3394('0x11')](_0x3394('0x13'),_0x2b581c,_0x595e4b[_0x3394('0x11')]['message']);return _0x269d99(_0x595e4b['error'][_0x3394('0x14')]);}logger[_0x3394('0x11')](_0x3394('0x13'),_0x2b581c,_0x595e4b[_0x3394('0x11')][_0x3394('0x14')]);return _0x342167(_0x595e4b[_0x3394('0x11')][_0x3394('0x14')]);}else{logger['info'](_0x3394('0x13'),_0x2b581c,'request\x20sent');_0x342167(_0x595e4b[_0x3394('0x15')]['message']);}})['catch'](function(_0x3a1c9c){logger['error'](_0x3394('0x13'),_0x2b581c,_0x3a1c9c);_0x269d99(_0x3a1c9c);});});}exports[_0x3394('0x16')]=function(_0x3162f2){var _0x40cd3b=this;return new Promise(function(_0x2c8128,_0x41e1c0){return db[_0x3394('0x17')][_0x3394('0x18')]({'raw':_0x3162f2[_0x3394('0x19')]?_0x3162f2[_0x3394('0x19')][_0x3394('0x1a')]===undefined?!![]:![]:!![],'where':_0x3162f2[_0x3394('0x19')]?_0x3162f2[_0x3394('0x19')][_0x3394('0x1b')]||null:null,'attributes':_0x3162f2[_0x3394('0x19')]?_0x3162f2[_0x3394('0x19')][_0x3394('0x1c')]||null:null,'include':_0x3162f2[_0x3394('0x19')]?_0x3162f2[_0x3394('0x19')][_0x3394('0x1d')]?_[_0x3394('0x1e')](_0x3162f2[_0x3394('0x19')][_0x3394('0x1d')],function(_0x35e2dc){return{'model':db[_0x35e2dc[_0x3394('0x1f')]],'as':_0x35e2dc['as'],'attributes':_0x35e2dc[_0x3394('0x1c')],'include':_0x35e2dc['include']?_[_0x3394('0x1e')](_0x35e2dc[_0x3394('0x1d')],function(_0x54eb59){return{'model':db[_0x54eb59[_0x3394('0x1f')]],'as':_0x54eb59['as'],'attributes':_0x54eb59[_0x3394('0x1c')],'include':_0x54eb59[_0x3394('0x1d')]?_[_0x3394('0x1e')](_0x54eb59[_0x3394('0x1d')],function(_0x143ad1){return{'model':db[_0x143ad1[_0x3394('0x1f')]],'as':_0x143ad1['as'],'attributes':_0x143ad1['attributes']};}):[]};}):[]};}):[]:[]})[_0x3394('0xc')](function(_0x529ecf){logger[_0x3394('0x20')](_0x3394('0x16'),_0x3162f2);logger[_0x3394('0xe')](_0x3394('0x16'),_0x3162f2,JSON[_0x3394('0x10')](_0x529ecf));_0x2c8128(_0x529ecf);})['catch'](function(_0x36d942){logger[_0x3394('0x11')](_0x3394('0x16'),_0x36d942['message'],_0x3162f2);_0x41e1c0(_0x40cd3b[_0x3394('0x11')](0x1f4,_0x36d942['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index e43223c..7106825 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 _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x8ad3d4,_0x48873d){var _0x5d04ff=function(_0x216138){while(--_0x216138){_0x8ad3d4['push'](_0x8ad3d4['shift']());}};_0x5d04ff(++_0x48873d);}(_0x14a0,0x8e));var _0x014a=function(_0x4bbe00,_0x1d2f14){_0x4bbe00=_0x4bbe00-0x0;var _0x3999d2=_0x14a0[_0x4bbe00];return _0x3999d2;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x51979a,_0x491f31){var _0x4148da=function(_0x182418){while(--_0x182418){_0x51979a['push'](_0x51979a['shift']());}};_0x4148da(++_0x491f31);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xb7e7[_0xc67528];return _0x38e26d;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 7aa974b..5ab1c7c 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 _0x774d=['ENUM','out','STRING','TEXT'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x774d,0xd6));var _0xd774=function(_0x4ce1c9,_0xd576e8){_0x4ce1c9=_0x4ce1c9-0x0;var _0x48b19f=_0x774d[_0x4ce1c9];return _0x48b19f;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xd774('0x0')]},'body':{'type':Sequelize[_0xd774('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xd774('0x2')]('in',_0xd774('0x3')),'defaultValue':_0xd774('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0xd774('0x0')]},'providerResponse':{'type':Sequelize[_0xd774('0x1')]}}; \ No newline at end of file +var _0x21e6=['sequelize','STRING','TEXT','medium','ENUM','out'];(function(_0x3eb2bb,_0x84b81d){var _0x4e38d6=function(_0x7a21b1){while(--_0x7a21b1){_0x3eb2bb['push'](_0x3eb2bb['shift']());}};_0x4e38d6(++_0x84b81d);}(_0x21e6,0x114));var _0x621e=function(_0x317725,_0x1bd734){_0x317725=_0x317725-0x0;var _0x1e08cb=_0x21e6[_0x317725];return _0x1e08cb;};'use strict';var Sequelize=require(_0x621e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x621e('0x1')]},'body':{'type':Sequelize[_0x621e('0x2')](_0x621e('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x621e('0x4')]('in','out'),'defaultValue':_0x621e('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x621e('0x1')]},'providerResponse':{'type':Sequelize[_0x621e('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 3bf624e..a1e1fb7 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 _0xeef8=['update','then','error','stack','index','map','SquareMessage','rawAttributes','fieldName','key','model','name','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','show','params','length','body','destroy','find','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save'];(function(_0x10be58,_0x41cdad){var _0x14deb3=function(_0x2a5121){while(--_0x2a5121){_0x10be58['push'](_0x10be58['shift']());}};_0x14deb3(++_0x41cdad);}(_0xeef8,0x197));var _0x8eef=function(_0x174e9a,_0x265163){_0x174e9a=_0x174e9a-0x0;var _0x505302=_0xeef8[_0x174e9a];return _0x505302;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8eef('0x0'));var zipdir=require(_0x8eef('0x1'));var jsonpatch=require(_0x8eef('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8eef('0x3'));var util=require(_0x8eef('0x4'));var path=require(_0x8eef('0x5'));var sox=require(_0x8eef('0x6'));var csv=require(_0x8eef('0x7'));var ejs=require(_0x8eef('0x8'));var fs=require('fs');var fs_extra=require(_0x8eef('0x9'));var _=require(_0x8eef('0xa'));var squel=require(_0x8eef('0xb'));var crypto=require(_0x8eef('0xc'));var jsforce=require(_0x8eef('0xd'));var deskjs=require(_0x8eef('0xe'));var toCsv=require(_0x8eef('0x7'));var querystring=require(_0x8eef('0xf'));var Papa=require(_0x8eef('0x10'));var Redis=require(_0x8eef('0x11'));var authService=require(_0x8eef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8eef('0x13'));var logger=require(_0x8eef('0x14'))('api');var utils=require(_0x8eef('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8eef('0x16'));var db=require(_0x8eef('0x17'))['db'];function respondWithStatusCode(_0x523e87,_0x55a0a3){_0x55a0a3=_0x55a0a3||0xcc;return function(_0x28a4c9){if(_0x28a4c9){return _0x523e87[_0x8eef('0x18')](_0x55a0a3);}return _0x523e87[_0x8eef('0x19')](_0x55a0a3)[_0x8eef('0x1a')]();};}function respondWithResult(_0x898bd,_0x4f27f9){_0x4f27f9=_0x4f27f9||0xc8;return function(_0x435194){if(_0x435194){return _0x898bd[_0x8eef('0x19')](_0x4f27f9)[_0x8eef('0x1b')](_0x435194);}};}function respondWithFilteredResult(_0x3b7e02,_0x5d7bbb){return function(_0x1846c){if(_0x1846c){var _0x51e789=typeof _0x5d7bbb[_0x8eef('0x1c')]===_0x8eef('0x1d')&&typeof _0x5d7bbb['limit']===_0x8eef('0x1d');var _0x489bdb=_0x1846c['count'];var _0x5d9188=_0x51e789?0x0:_0x5d7bbb[_0x8eef('0x1c')];var _0x330e5f=_0x51e789?_0x1846c[_0x8eef('0x1e')]:_0x5d7bbb[_0x8eef('0x1c')]+_0x5d7bbb[_0x8eef('0x1f')];var _0x48537a;if(_0x330e5f>=_0x489bdb){_0x330e5f=_0x489bdb;_0x48537a=0xc8;}else{_0x48537a=0xce;}_0x3b7e02[_0x8eef('0x19')](_0x48537a);return _0x3b7e02[_0x8eef('0x20')](_0x8eef('0x21'),_0x5d9188+'-'+_0x330e5f+'/'+_0x489bdb)['json'](_0x1846c);}return null;};}function patchUpdates(_0x14a043){return function(_0x3eca18){try{jsonpatch[_0x8eef('0x22')](_0x3eca18,_0x14a043,!![]);}catch(_0x10ee5d){return BPromise[_0x8eef('0x23')](_0x10ee5d);}return _0x3eca18[_0x8eef('0x24')]();};}function saveUpdates(_0x1ef739,_0x2d31ba){return function(_0x534f9c){if(_0x534f9c){return _0x534f9c[_0x8eef('0x25')](_0x1ef739)['then'](function(_0x4cc9bc){return _0x4cc9bc;});}return null;};}function removeEntity(_0xf3fd6a,_0x4a0f4f){return function(_0x1dca68){if(_0x1dca68){return _0x1dca68['destroy']()[_0x8eef('0x26')](function(){_0xf3fd6a[_0x8eef('0x19')](0xcc)[_0x8eef('0x1a')]();});}};}function handleEntityNotFound(_0x4dd541,_0x4a9c7f){return function(_0x347d23){if(!_0x347d23){_0x4dd541[_0x8eef('0x18')](0x194);}return _0x347d23;};}function handleError(_0x493d28,_0x46be8e){_0x46be8e=_0x46be8e||0x1f4;return function(_0x31b2a5){logger[_0x8eef('0x27')](_0x31b2a5[_0x8eef('0x28')]);if(_0x31b2a5['name']){delete _0x31b2a5['name'];}_0x493d28['status'](_0x46be8e)['send'](_0x31b2a5);};}exports[_0x8eef('0x29')]=function(_0x2aa7e1,_0x3b323d){var _0x14d283={},_0x5daeec={},_0x4b5efa={'count':0x0,'rows':[]};var _0x401e73=_[_0x8eef('0x2a')](db[_0x8eef('0x2b')][_0x8eef('0x2c')],function(_0x19fd38){return{'name':_0x19fd38[_0x8eef('0x2d')],'type':_0x19fd38['type'][_0x8eef('0x2e')]};});_0x5daeec[_0x8eef('0x2f')]=_[_0x8eef('0x2a')](_0x401e73,_0x8eef('0x30'));_0x5daeec['query']=_[_0x8eef('0x31')](_0x2aa7e1['query']);_0x5daeec[_0x8eef('0x32')]=_[_0x8eef('0x33')](_0x5daeec[_0x8eef('0x2f')],_0x5daeec['query']);_0x14d283[_0x8eef('0x34')]=_[_0x8eef('0x33')](_0x5daeec[_0x8eef('0x2f')],qs[_0x8eef('0x35')](_0x2aa7e1[_0x8eef('0x36')]['fields']));_0x14d283[_0x8eef('0x34')]=_0x14d283['attributes']['length']?_0x14d283['attributes']:_0x5daeec[_0x8eef('0x2f')];if(!_0x2aa7e1[_0x8eef('0x36')][_0x8eef('0x37')](_0x8eef('0x38'))){_0x14d283[_0x8eef('0x1f')]=qs[_0x8eef('0x1f')](_0x2aa7e1['query'][_0x8eef('0x1f')]);_0x14d283[_0x8eef('0x1c')]=qs[_0x8eef('0x1c')](_0x2aa7e1[_0x8eef('0x36')]['offset']);}_0x14d283['order']=qs[_0x8eef('0x39')](_0x2aa7e1[_0x8eef('0x36')][_0x8eef('0x39')]);_0x14d283[_0x8eef('0x3a')]=qs[_0x8eef('0x32')](_[_0x8eef('0x3b')](_0x2aa7e1[_0x8eef('0x36')],_0x5daeec[_0x8eef('0x32')]),_0x401e73);if(_0x2aa7e1[_0x8eef('0x36')][_0x8eef('0x3c')]){_0x14d283['where']=_[_0x8eef('0x3d')](_0x14d283[_0x8eef('0x3a')],{'$or':_['map'](_0x401e73,function(_0x227e89){if(_0x227e89[_0x8eef('0x3e')]!==_0x8eef('0x3f')){var _0x53497d={};_0x53497d[_0x227e89[_0x8eef('0x30')]]={'$like':'%'+_0x2aa7e1[_0x8eef('0x36')]['filter']+'%'};return _0x53497d;}})});}_0x14d283=_[_0x8eef('0x3d')]({},_0x14d283,_0x2aa7e1[_0x8eef('0x40')]);var _0x47758d={'where':_0x14d283[_0x8eef('0x3a')]};return db[_0x8eef('0x2b')]['count'](_0x47758d)['then'](function(_0x511ad0){_0x4b5efa[_0x8eef('0x1e')]=_0x511ad0;if(_0x2aa7e1[_0x8eef('0x36')]['includeAll']){_0x14d283[_0x8eef('0x41')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x14d283);})[_0x8eef('0x26')](function(_0x48a874){_0x4b5efa[_0x8eef('0x42')]=_0x48a874;return _0x4b5efa;})[_0x8eef('0x26')](respondWithFilteredResult(_0x3b323d,_0x14d283))[_0x8eef('0x43')](handleError(_0x3b323d,null));};exports[_0x8eef('0x44')]=function(_0x2ea734,_0x2ceb5c){var _0x312ec9={'raw':!![],'where':{'id':_0x2ea734[_0x8eef('0x45')]['id']}},_0x3b1290={};_0x3b1290[_0x8eef('0x2f')]=_[_0x8eef('0x31')](db[_0x8eef('0x2b')]['rawAttributes']);_0x3b1290[_0x8eef('0x36')]=_[_0x8eef('0x31')](_0x2ea734[_0x8eef('0x36')]);_0x3b1290['filters']=_[_0x8eef('0x33')](_0x3b1290[_0x8eef('0x2f')],_0x3b1290[_0x8eef('0x36')]);_0x312ec9[_0x8eef('0x34')]=_[_0x8eef('0x33')](_0x3b1290[_0x8eef('0x2f')],qs['fields'](_0x2ea734['query'][_0x8eef('0x35')]));_0x312ec9[_0x8eef('0x34')]=_0x312ec9[_0x8eef('0x34')][_0x8eef('0x46')]?_0x312ec9[_0x8eef('0x34')]:_0x3b1290['model'];if(_0x2ea734[_0x8eef('0x36')]['includeAll']){_0x312ec9[_0x8eef('0x41')]=[{'all':!![]}];}_0x312ec9=_[_0x8eef('0x3d')]({},_0x312ec9,_0x2ea734['options']);return db[_0x8eef('0x2b')]['find'](_0x312ec9)[_0x8eef('0x26')](handleEntityNotFound(_0x2ceb5c,null))[_0x8eef('0x26')](respondWithResult(_0x2ceb5c,null))['catch'](handleError(_0x2ceb5c,null));};exports['create']=function(_0x533568,_0x5bae6a){return db[_0x8eef('0x2b')]['create'](_0x533568[_0x8eef('0x47')],{})[_0x8eef('0x26')](respondWithResult(_0x5bae6a,0xc9))[_0x8eef('0x43')](handleError(_0x5bae6a,null));};exports['update']=function(_0x20ecb7,_0x4fbcf4){if(_0x20ecb7[_0x8eef('0x47')]['id']){delete _0x20ecb7[_0x8eef('0x47')]['id'];}return db[_0x8eef('0x2b')]['find']({'where':{'id':_0x20ecb7[_0x8eef('0x45')]['id']}})[_0x8eef('0x26')](handleEntityNotFound(_0x4fbcf4,null))[_0x8eef('0x26')](saveUpdates(_0x20ecb7['body'],null))[_0x8eef('0x26')](respondWithResult(_0x4fbcf4,null))[_0x8eef('0x43')](handleError(_0x4fbcf4,null));};exports[_0x8eef('0x48')]=function(_0x1d588a,_0x1bed4f){return db[_0x8eef('0x2b')][_0x8eef('0x49')]({'where':{'id':_0x1d588a[_0x8eef('0x45')]['id']}})[_0x8eef('0x26')](handleEntityNotFound(_0x1bed4f,null))['then'](removeEntity(_0x1bed4f,null))['catch'](handleError(_0x1bed4f,null));}; \ No newline at end of file +var _0x2b7e=['path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','SquareMessage','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','length','include','create','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x227cce,_0x46477b){var _0x339dfb=function(_0x43ef09){while(--_0x43ef09){_0x227cce['push'](_0x227cce['shift']());}};_0x339dfb(++_0x46477b);}(_0x2b7e,0xe1));var _0xe2b7=function(_0x5e08e5,_0x2b2620){_0x5e08e5=_0x5e08e5-0x0;var _0x49d315=_0x2b7e[_0x5e08e5];return _0x49d315;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe2b7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe2b7('0x1'));var rp=require(_0xe2b7('0x2'));var moment=require(_0xe2b7('0x3'));var BPromise=require(_0xe2b7('0x4'));var Mustache=require('mustache');var util=require(_0xe2b7('0x5'));var path=require(_0xe2b7('0x6'));var sox=require(_0xe2b7('0x7'));var csv=require('to-csv');var ejs=require(_0xe2b7('0x8'));var fs=require('fs');var fs_extra=require(_0xe2b7('0x9'));var _=require(_0xe2b7('0xa'));var squel=require(_0xe2b7('0xb'));var crypto=require(_0xe2b7('0xc'));var jsforce=require(_0xe2b7('0xd'));var deskjs=require(_0xe2b7('0xe'));var toCsv=require(_0xe2b7('0xf'));var querystring=require(_0xe2b7('0x10'));var Papa=require(_0xe2b7('0x11'));var Redis=require('ioredis');var authService=require(_0xe2b7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe2b7('0x13'));var hardwareService=require(_0xe2b7('0x14'));var logger=require(_0xe2b7('0x15'))(_0xe2b7('0x16'));var utils=require(_0xe2b7('0x17'));var config=require(_0xe2b7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe2b7('0x19'))['db'];function respondWithStatusCode(_0x56cfa1,_0x50ae52){_0x50ae52=_0x50ae52||0xcc;return function(_0x43e8cc){if(_0x43e8cc){return _0x56cfa1[_0xe2b7('0x1a')](_0x50ae52);}return _0x56cfa1[_0xe2b7('0x1b')](_0x50ae52)[_0xe2b7('0x1c')]();};}function respondWithResult(_0x1ac2cf,_0x10e1a6){_0x10e1a6=_0x10e1a6||0xc8;return function(_0xbe52dd){if(_0xbe52dd){return _0x1ac2cf[_0xe2b7('0x1b')](_0x10e1a6)[_0xe2b7('0x1d')](_0xbe52dd);}};}function respondWithFilteredResult(_0x4ce593,_0x23531e){return function(_0x66c62e){if(_0x66c62e){var _0x4b4002=typeof _0x23531e['offset']===_0xe2b7('0x1e')&&typeof _0x23531e[_0xe2b7('0x1f')]===_0xe2b7('0x1e');var _0x240add=_0x66c62e[_0xe2b7('0x20')];var _0x480b75=_0x4b4002?0x0:_0x23531e[_0xe2b7('0x21')];var _0x41610c=_0x4b4002?_0x66c62e['count']:_0x23531e[_0xe2b7('0x21')]+_0x23531e[_0xe2b7('0x1f')];var _0x2c084c;if(_0x41610c>=_0x240add){_0x41610c=_0x240add;_0x2c084c=0xc8;}else{_0x2c084c=0xce;}_0x4ce593[_0xe2b7('0x1b')](_0x2c084c);return _0x4ce593[_0xe2b7('0x22')](_0xe2b7('0x23'),_0x480b75+'-'+_0x41610c+'/'+_0x240add)['json'](_0x66c62e);}return null;};}function patchUpdates(_0x190094){return function(_0x32f810){try{jsonpatch[_0xe2b7('0x24')](_0x32f810,_0x190094,!![]);}catch(_0x227fec){return BPromise[_0xe2b7('0x25')](_0x227fec);}return _0x32f810[_0xe2b7('0x26')]();};}function saveUpdates(_0x47d176,_0x48f328){return function(_0x522f6d){if(_0x522f6d){return _0x522f6d[_0xe2b7('0x27')](_0x47d176)[_0xe2b7('0x28')](function(_0x52447c){return _0x52447c;});}return null;};}function removeEntity(_0x1a16e0,_0x11b05e){return function(_0x250bb0){if(_0x250bb0){return _0x250bb0[_0xe2b7('0x29')]()[_0xe2b7('0x28')](function(){_0x1a16e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4970d2,_0x5f57e0){return function(_0x18e16e){if(!_0x18e16e){_0x4970d2[_0xe2b7('0x1a')](0x194);}return _0x18e16e;};}function handleError(_0x4538d1,_0x2a9dea){_0x2a9dea=_0x2a9dea||0x1f4;return function(_0x4af045){logger[_0xe2b7('0x2a')](_0x4af045[_0xe2b7('0x2b')]);if(_0x4af045[_0xe2b7('0x2c')]){delete _0x4af045[_0xe2b7('0x2c')];}_0x4538d1[_0xe2b7('0x1b')](_0x2a9dea)['send'](_0x4af045);};}exports['index']=function(_0x2a3175,_0xcbc4c7){var _0x5f0a07={},_0x1ab691={},_0x56f7c9={'count':0x0,'rows':[]};var _0x32956f=_['map'](db[_0xe2b7('0x2d')]['rawAttributes'],function(_0x429ada){return{'name':_0x429ada[_0xe2b7('0x2e')],'type':_0x429ada[_0xe2b7('0x2f')]['key']};});_0x1ab691['model']=_[_0xe2b7('0x30')](_0x32956f,_0xe2b7('0x2c'));_0x1ab691[_0xe2b7('0x31')]=_[_0xe2b7('0x32')](_0x2a3175[_0xe2b7('0x31')]);_0x1ab691[_0xe2b7('0x33')]=_[_0xe2b7('0x34')](_0x1ab691[_0xe2b7('0x35')],_0x1ab691['query']);_0x5f0a07[_0xe2b7('0x36')]=_[_0xe2b7('0x34')](_0x1ab691[_0xe2b7('0x35')],qs[_0xe2b7('0x37')](_0x2a3175[_0xe2b7('0x31')][_0xe2b7('0x37')]));_0x5f0a07[_0xe2b7('0x36')]=_0x5f0a07['attributes']['length']?_0x5f0a07['attributes']:_0x1ab691['model'];if(!_0x2a3175[_0xe2b7('0x31')][_0xe2b7('0x38')](_0xe2b7('0x39'))){_0x5f0a07[_0xe2b7('0x1f')]=qs[_0xe2b7('0x1f')](_0x2a3175[_0xe2b7('0x31')][_0xe2b7('0x1f')]);_0x5f0a07[_0xe2b7('0x21')]=qs['offset'](_0x2a3175[_0xe2b7('0x31')][_0xe2b7('0x21')]);}_0x5f0a07[_0xe2b7('0x3a')]=qs[_0xe2b7('0x3b')](_0x2a3175[_0xe2b7('0x31')][_0xe2b7('0x3b')]);_0x5f0a07[_0xe2b7('0x3c')]=qs[_0xe2b7('0x33')](_[_0xe2b7('0x3d')](_0x2a3175[_0xe2b7('0x31')],_0x1ab691[_0xe2b7('0x33')]),_0x32956f);if(_0x2a3175[_0xe2b7('0x31')][_0xe2b7('0x3e')]){_0x5f0a07['where']=_[_0xe2b7('0x3f')](_0x5f0a07[_0xe2b7('0x3c')],{'$or':_[_0xe2b7('0x30')](_0x32956f,function(_0x341513){if(_0x341513[_0xe2b7('0x2f')]!==_0xe2b7('0x40')){var _0x1282fa={};_0x1282fa[_0x341513[_0xe2b7('0x2c')]]={'$like':'%'+_0x2a3175[_0xe2b7('0x31')][_0xe2b7('0x3e')]+'%'};return _0x1282fa;}})});}_0x5f0a07=_[_0xe2b7('0x3f')]({},_0x5f0a07,_0x2a3175[_0xe2b7('0x41')]);var _0x1ffd7f={'where':_0x5f0a07[_0xe2b7('0x3c')]};return db[_0xe2b7('0x2d')]['count'](_0x1ffd7f)['then'](function(_0x5c4560){_0x56f7c9['count']=_0x5c4560;if(_0x2a3175[_0xe2b7('0x31')][_0xe2b7('0x42')]){_0x5f0a07['include']=[{'all':!![]}];}return db['SquareMessage'][_0xe2b7('0x43')](_0x5f0a07);})[_0xe2b7('0x28')](function(_0x4c2812){_0x56f7c9[_0xe2b7('0x44')]=_0x4c2812;return _0x56f7c9;})[_0xe2b7('0x28')](respondWithFilteredResult(_0xcbc4c7,_0x5f0a07))[_0xe2b7('0x45')](handleError(_0xcbc4c7,null));};exports['show']=function(_0x37cd5f,_0x18b08b){var _0x5005ca={'raw':!![],'where':{'id':_0x37cd5f[_0xe2b7('0x46')]['id']}},_0x3e264a={};_0x3e264a[_0xe2b7('0x35')]=_['keys'](db[_0xe2b7('0x2d')][_0xe2b7('0x47')]);_0x3e264a[_0xe2b7('0x31')]=_[_0xe2b7('0x32')](_0x37cd5f[_0xe2b7('0x31')]);_0x3e264a[_0xe2b7('0x33')]=_['intersection'](_0x3e264a['model'],_0x3e264a[_0xe2b7('0x31')]);_0x5005ca[_0xe2b7('0x36')]=_['intersection'](_0x3e264a[_0xe2b7('0x35')],qs[_0xe2b7('0x37')](_0x37cd5f[_0xe2b7('0x31')]['fields']));_0x5005ca[_0xe2b7('0x36')]=_0x5005ca['attributes'][_0xe2b7('0x48')]?_0x5005ca[_0xe2b7('0x36')]:_0x3e264a[_0xe2b7('0x35')];if(_0x37cd5f[_0xe2b7('0x31')][_0xe2b7('0x42')]){_0x5005ca[_0xe2b7('0x49')]=[{'all':!![]}];}_0x5005ca=_[_0xe2b7('0x3f')]({},_0x5005ca,_0x37cd5f['options']);return db[_0xe2b7('0x2d')]['find'](_0x5005ca)[_0xe2b7('0x28')](handleEntityNotFound(_0x18b08b,null))[_0xe2b7('0x28')](respondWithResult(_0x18b08b,null))[_0xe2b7('0x45')](handleError(_0x18b08b,null));};exports[_0xe2b7('0x4a')]=function(_0x5beca5,_0x28590c){return db[_0xe2b7('0x2d')][_0xe2b7('0x4a')](_0x5beca5[_0xe2b7('0x4b')],{})[_0xe2b7('0x28')](respondWithResult(_0x28590c,0xc9))[_0xe2b7('0x45')](handleError(_0x28590c,null));};exports[_0xe2b7('0x27')]=function(_0x38fd2c,_0x3223c5){if(_0x38fd2c['body']['id']){delete _0x38fd2c[_0xe2b7('0x4b')]['id'];}return db['SquareMessage'][_0xe2b7('0x4c')]({'where':{'id':_0x38fd2c[_0xe2b7('0x46')]['id']}})[_0xe2b7('0x28')](handleEntityNotFound(_0x3223c5,null))['then'](saveUpdates(_0x38fd2c['body'],null))[_0xe2b7('0x28')](respondWithResult(_0x3223c5,null))['catch'](handleError(_0x3223c5,null));};exports[_0xe2b7('0x29')]=function(_0x5d97a0,_0x112228){return db['SquareMessage'][_0xe2b7('0x4c')]({'where':{'id':_0x5d97a0[_0xe2b7('0x46')]['id']}})[_0xe2b7('0x28')](handleEntityNotFound(_0x112228,null))['then'](removeEntity(_0x112228,null))[_0xe2b7('0x45')](handleError(_0x112228,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 4687006..3d6c9f8 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 _0x0275=['path','rimraf','../../config/environment','./squareMessage.attributes','square_messages','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x351453,_0x34718d){var _0x37be69=function(_0x585cb9){while(--_0x585cb9){_0x351453['push'](_0x351453['shift']());}};_0x37be69(++_0x34718d);}(_0x0275,0x91));var _0x5027=function(_0xbb313d,_0x2107d4){_0xbb313d=_0xbb313d-0x0;var _0x1ccd3c=_0x0275[_0xbb313d];return _0x1ccd3c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5027('0x0'))(_0x5027('0x1'));var moment=require(_0x5027('0x2'));var BPromise=require(_0x5027('0x3'));var rp=require(_0x5027('0x4'));var fs=require('fs');var path=require(_0x5027('0x5'));var rimraf=require(_0x5027('0x6'));var config=require(_0x5027('0x7'));var attributes=require(_0x5027('0x8'));module['exports']=function(_0x4415b4,_0x4eda63){return _0x4415b4['define']('SquareMessage',attributes,{'tableName':_0x5027('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68ba=['exports','define','SquareMessage','util','api','bluebird','rimraf','../../config/environment','./squareMessage.attributes'];(function(_0x2b4d81,_0x1ae448){var _0xb01f40=function(_0x598d64){while(--_0x598d64){_0x2b4d81['push'](_0x2b4d81['shift']());}};_0xb01f40(++_0x1ae448);}(_0x68ba,0xc0));var _0xa68b=function(_0x5d6e35,_0x4d1ac0){_0x5d6e35=_0x5d6e35-0x0;var _0x5d7ada=_0x68ba[_0x5d6e35];return _0x5d7ada;};'use strict';var _=require('lodash');var util=require(_0xa68b('0x0'));var logger=require('../../config/logger')(_0xa68b('0x1'));var moment=require('moment');var BPromise=require(_0xa68b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa68b('0x3'));var config=require(_0xa68b('0x4'));var attributes=require(_0xa68b('0x5'));module[_0xa68b('0x6')]=function(_0xda01ac,_0x2d0b80){return _0xda01ac[_0xa68b('0x7')](_0xa68b('0x8'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 7e7d5b1..8f38f0f 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 _0x8fed=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','util','moment','bluebird','randomstring'];(function(_0x2c97a9,_0xd6a400){var _0x26b5aa=function(_0x3c5cf7){while(--_0x3c5cf7){_0x2c97a9['push'](_0x2c97a9['shift']());}};_0x26b5aa(++_0xd6a400);}(_0x8fed,0x168));var _0xd8fe=function(_0x4da538,_0x25bc82){_0x4da538=_0x4da538-0x0;var _0x4c23a5=_0x8fed[_0x4da538];return _0x4c23a5;};'use strict';var _=require('lodash');var util=require(_0xd8fe('0x0'));var moment=require(_0xd8fe('0x1'));var BPromise=require(_0xd8fe('0x2'));var rs=require(_0xd8fe('0x3'));var fs=require('fs');var Redis=require(_0xd8fe('0x4'));var db=require(_0xd8fe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd8fe('0x6'))(_0xd8fe('0x7'));var config=require(_0xd8fe('0x8'));var jayson=require(_0xd8fe('0x9'));var client=jayson['client'][_0xd8fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc13c99,_0x4ebea9,_0x53c520){return new BPromise(function(_0x2183cf,_0x28ab1d){return client['request'](_0xc13c99,_0x53c520)['then'](function(_0x1f1aeb){logger[_0xd8fe('0xb')](_0xd8fe('0xc'),_0x4ebea9,_0xd8fe('0xd'));logger[_0xd8fe('0xe')](_0xd8fe('0xf'),_0x4ebea9,_0xd8fe('0xd'),JSON[_0xd8fe('0x10')](_0x1f1aeb));if(_0x1f1aeb[_0xd8fe('0x11')]){if(_0x1f1aeb['error']['code']===0x1f4){logger[_0xd8fe('0x11')](_0xd8fe('0xc'),_0x4ebea9,_0x1f1aeb[_0xd8fe('0x11')]['message']);return _0x28ab1d(_0x1f1aeb[_0xd8fe('0x11')][_0xd8fe('0x12')]);}logger[_0xd8fe('0x11')](_0xd8fe('0xc'),_0x4ebea9,_0x1f1aeb[_0xd8fe('0x11')][_0xd8fe('0x12')]);return _0x2183cf(_0x1f1aeb[_0xd8fe('0x11')][_0xd8fe('0x12')]);}else{logger['info'](_0xd8fe('0xc'),_0x4ebea9,'request\x20sent');_0x2183cf(_0x1f1aeb[_0xd8fe('0x13')][_0xd8fe('0x12')]);}})[_0xd8fe('0x14')](function(_0x2ce46e){logger[_0xd8fe('0x11')](_0xd8fe('0xc'),_0x4ebea9,_0x2ce46e);_0x28ab1d(_0x2ce46e);});});}exports['CreateSquareMessage']=function(_0x4a74b6){var _0x2c9cca=this;return new Promise(function(_0x4f1c5d,_0x1aef15){return db[_0xd8fe('0x15')][_0xd8fe('0x16')](_0x4a74b6[_0xd8fe('0x17')],{'raw':_0x4a74b6[_0xd8fe('0x18')]?_0x4a74b6[_0xd8fe('0x18')][_0xd8fe('0x19')]===undefined?!![]:![]:!![]})[_0xd8fe('0x1a')](function(_0x1105eb){logger[_0xd8fe('0xb')](_0xd8fe('0x1b'),_0x4a74b6);logger[_0xd8fe('0xe')]('CreateSquareMessage',_0x4a74b6,JSON[_0xd8fe('0x10')](_0x1105eb));_0x4f1c5d(_0x1105eb);})[_0xd8fe('0x14')](function(_0x868733){logger[_0xd8fe('0x11')](_0xd8fe('0x1b'),_0x868733[_0xd8fe('0x12')],_0x4a74b6);_0x1aef15(_0x2c9cca['error'](0x1f4,_0x868733[_0xd8fe('0x12')]));});});}; \ No newline at end of file +var _0x3f71=['catch','CreateSquareMessage','SquareMessage','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SquareMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result'];(function(_0x1f511c,_0x5d4dc8){var _0x528093=function(_0x16134a){while(--_0x16134a){_0x1f511c['push'](_0x1f511c['shift']());}};_0x528093(++_0x5d4dc8);}(_0x3f71,0x181));var _0x13f7=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x3f71[_0x4d07cc];return _0x42de3b;};'use strict';var _=require(_0x13f7('0x0'));var util=require(_0x13f7('0x1'));var moment=require(_0x13f7('0x2'));var BPromise=require(_0x13f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x13f7('0x5'));var logger=require(_0x13f7('0x6'))(_0x13f7('0x7'));var config=require(_0x13f7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x13f7('0x9')][_0x13f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bbef9,_0x4ca762,_0x192ec0){return new BPromise(function(_0x3df86d,_0x54de13){return client['request'](_0x3bbef9,_0x192ec0)[_0x13f7('0xb')](function(_0x328b9d){logger[_0x13f7('0xc')](_0x13f7('0xd'),_0x4ca762,'request\x20sent');logger[_0x13f7('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x4ca762,_0x13f7('0xf'),JSON['stringify'](_0x328b9d));if(_0x328b9d['error']){if(_0x328b9d[_0x13f7('0x10')][_0x13f7('0x11')]===0x1f4){logger[_0x13f7('0x10')](_0x13f7('0xd'),_0x4ca762,_0x328b9d['error'][_0x13f7('0x12')]);return _0x54de13(_0x328b9d[_0x13f7('0x10')][_0x13f7('0x12')]);}logger[_0x13f7('0x10')](_0x13f7('0xd'),_0x4ca762,_0x328b9d['error'][_0x13f7('0x12')]);return _0x3df86d(_0x328b9d['error'][_0x13f7('0x12')]);}else{logger['info'](_0x13f7('0xd'),_0x4ca762,_0x13f7('0xf'));_0x3df86d(_0x328b9d[_0x13f7('0x13')][_0x13f7('0x12')]);}})[_0x13f7('0x14')](function(_0x14324c){logger[_0x13f7('0x10')]('SquareMessage,\x20%s,\x20%s',_0x4ca762,_0x14324c);_0x54de13(_0x14324c);});});}exports[_0x13f7('0x15')]=function(_0x18d078){var _0x3c94a8=this;return new Promise(function(_0xb8e6e8,_0x9da25c){return db[_0x13f7('0x16')]['create'](_0x18d078[_0x13f7('0x17')],{'raw':_0x18d078[_0x13f7('0x18')]?_0x18d078[_0x13f7('0x18')][_0x13f7('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x539c6d){logger['info'](_0x13f7('0x15'),_0x18d078);logger['debug'](_0x13f7('0x15'),_0x18d078,JSON[_0x13f7('0x1a')](_0x539c6d));_0xb8e6e8(_0x539c6d);})[_0x13f7('0x14')](function(_0x4da2f9){logger[_0x13f7('0x10')](_0x13f7('0x15'),_0x4da2f9[_0x13f7('0x12')],_0x18d078);_0x9da25c(_0x3c94a8[_0x13f7('0x10')](0x1f4,_0x4da2f9[_0x13f7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 94e624b..ead37cc 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 _0xbf02=['test','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test'];(function(_0x5ce9bd,_0x4730bc){var _0x2d0162=function(_0x40e94f){while(--_0x40e94f){_0x5ce9bd['push'](_0x5ce9bd['shift']());}};_0x2d0162(++_0x4730bc);}(_0xbf02,0x123));var _0x2bf0=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xbf02[_0x1b6186];return _0x186121;};'use strict';var multer=require(_0x2bf0('0x0'));var util=require(_0x2bf0('0x1'));var path=require('path');var timeout=require(_0x2bf0('0x2'));var express=require(_0x2bf0('0x3'));var router=express[_0x2bf0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2bf0('0x5'));var config=require(_0x2bf0('0x6'));var controller=require(_0x2bf0('0x7'));router[_0x2bf0('0x8')]('/',auth[_0x2bf0('0x9')](),controller[_0x2bf0('0xa')]);router[_0x2bf0('0x8')](_0x2bf0('0xb'),auth[_0x2bf0('0x9')](),controller['show']);router[_0x2bf0('0x8')](_0x2bf0('0xc'),auth['isAuthenticated'](),timeout('15s'),controller[_0x2bf0('0xd')]);router['post']('/',auth[_0x2bf0('0x9')](),controller[_0x2bf0('0xe')]);router[_0x2bf0('0xf')](_0x2bf0('0xb'),auth[_0x2bf0('0x9')](),controller[_0x2bf0('0x10')]);router[_0x2bf0('0x11')](_0x2bf0('0xb'),auth[_0x2bf0('0x9')](),controller[_0x2bf0('0x12')]);module['exports']=router; \ No newline at end of file +var _0x6175=['fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','put','delete','exports','multer','path','express'];(function(_0x18d9fc,_0x1f5eb3){var _0x191f05=function(_0x14bb2f){while(--_0x14bb2f){_0x18d9fc['push'](_0x18d9fc['shift']());}};_0x191f05(++_0x1f5eb3);}(_0x6175,0x13d));var _0x5617=function(_0x169494,_0x2f772a){_0x169494=_0x169494-0x0;var _0x2d9b31=_0x6175[_0x169494];return _0x2d9b31;};'use strict';var multer=require(_0x5617('0x0'));var util=require('util');var path=require(_0x5617('0x1'));var timeout=require('connect-timeout');var express=require(_0x5617('0x2'));var router=express['Router']();var fs_extra=require(_0x5617('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5617('0x4'));var config=require(_0x5617('0x5'));var controller=require(_0x5617('0x6'));router[_0x5617('0x7')]('/',auth[_0x5617('0x8')](),controller[_0x5617('0x9')]);router[_0x5617('0x7')](_0x5617('0xa'),auth['isAuthenticated'](),controller[_0x5617('0xb')]);router[_0x5617('0x7')](_0x5617('0xc'),auth[_0x5617('0x8')](),timeout(_0x5617('0xd')),controller[_0x5617('0xe')]);router[_0x5617('0xf')]('/',auth[_0x5617('0x8')](),controller[_0x5617('0x10')]);router[_0x5617('0x11')](_0x5617('0xa'),auth[_0x5617('0x8')](),controller['update']);router[_0x5617('0x12')](_0x5617('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x5617('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 12cd918..ec2c018 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 _0xa514=['STRING','name','sequelize','exports'];(function(_0x3442a5,_0x15ca65){var _0x238f0f=function(_0x26c964){while(--_0x26c964){_0x3442a5['push'](_0x3442a5['shift']());}};_0x238f0f(++_0x15ca65);}(_0xa514,0xea));var _0x4a51=function(_0x47fc06,_0xf4f6d){_0x47fc06=_0x47fc06-0x0;var _0x7d0a53=_0xa514[_0x47fc06];return _0x7d0a53;};'use strict';var Sequelize=require(_0x4a51('0x0'));module[_0x4a51('0x1')]={'name':{'type':Sequelize[_0x4a51('0x2')],'unique':_0x4a51('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4a51('0x2')]}}; \ No newline at end of file +var _0xa32a=['STRING','exports'];(function(_0x47c9f9,_0x43bc44){var _0x110922=function(_0x3a9831){while(--_0x3a9831){_0x47c9f9['push'](_0x47c9f9['shift']());}};_0x110922(++_0x43bc44);}(_0xa32a,0xa5));var _0xaa32=function(_0x52f159,_0x419d8a){_0x52f159=_0x52f159-0x0;var _0x156799=_0xa32a[_0x52f159];return _0x156799;};'use strict';var Sequelize=require('sequelize');module[_0xaa32('0x0')]={'name':{'type':Sequelize[_0xaa32('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xaa32('0x1')]},'description':{'type':Sequelize[_0xaa32('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index edb1e96..8d5ca1c 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 _0x2672=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','Content-Range','json','apply','reject','save','update','destroy','then','get','ODBC','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','count','include','findAll','rows','show','params','includeAll','options','find','catch','create','body'];(function(_0xd1be1a,_0x4418fc){var _0x1f4dd9=function(_0x67ac27){while(--_0x67ac27){_0xd1be1a['push'](_0xd1be1a['shift']());}};_0x1f4dd9(++_0x4418fc);}(_0x2672,0xbd));var _0x2267=function(_0x87eb11,_0x214dfe){_0x87eb11=_0x87eb11-0x0;var _0x3588fe=_0x2672[_0x87eb11];return _0x3588fe;};'use strict';var emlformat=require(_0x2267('0x0'));var rimraf=require(_0x2267('0x1'));var zipdir=require(_0x2267('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2267('0x3'));var Mustache=require(_0x2267('0x4'));var util=require(_0x2267('0x5'));var path=require('path');var sox=require(_0x2267('0x6'));var csv=require(_0x2267('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2267('0x8'));var _=require('lodash');var squel=require(_0x2267('0x9'));var crypto=require(_0x2267('0xa'));var jsforce=require(_0x2267('0xb'));var deskjs=require(_0x2267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2267('0xd'));var Papa=require(_0x2267('0xe'));var Redis=require(_0x2267('0xf'));var authService=require(_0x2267('0x10'));var qs=require(_0x2267('0x11'));var as=require(_0x2267('0x12'));var hardwareService=require(_0x2267('0x13'));var logger=require('../../config/logger')(_0x2267('0x14'));var utils=require(_0x2267('0x15'));var config=require(_0x2267('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2267('0x17'))['db'];function respondWithStatusCode(_0x1b75ef,_0x3e6b86){_0x3e6b86=_0x3e6b86||0xcc;return function(_0x39a112){if(_0x39a112){return _0x1b75ef['sendStatus'](_0x3e6b86);}return _0x1b75ef[_0x2267('0x18')](_0x3e6b86)[_0x2267('0x19')]();};}function respondWithResult(_0xba5a2f,_0xe64ab1){_0xe64ab1=_0xe64ab1||0xc8;return function(_0x5c8f38){if(_0x5c8f38){return _0xba5a2f['status'](_0xe64ab1)['json'](_0x5c8f38);}};}function respondWithFilteredResult(_0x239b65,_0xf39b6a){return function(_0x18dd36){if(_0x18dd36){var _0x51f335=typeof _0xf39b6a[_0x2267('0x1a')]===_0x2267('0x1b')&&typeof _0xf39b6a[_0x2267('0x1c')]===_0x2267('0x1b');var _0x5b7824=_0x18dd36['count'];var _0x402945=_0x51f335?0x0:_0xf39b6a[_0x2267('0x1a')];var _0x5cd279=_0x51f335?_0x18dd36['count']:_0xf39b6a[_0x2267('0x1a')]+_0xf39b6a[_0x2267('0x1c')];var _0x5d0a1b;if(_0x5cd279>=_0x5b7824){_0x5cd279=_0x5b7824;_0x5d0a1b=0xc8;}else{_0x5d0a1b=0xce;}_0x239b65['status'](_0x5d0a1b);return _0x239b65['set'](_0x2267('0x1d'),_0x402945+'-'+_0x5cd279+'/'+_0x5b7824)[_0x2267('0x1e')](_0x18dd36);}return null;};}function patchUpdates(_0x2ac0b1){return function(_0x39e735){try{jsonpatch[_0x2267('0x1f')](_0x39e735,_0x2ac0b1,!![]);}catch(_0x60c6b1){return BPromise[_0x2267('0x20')](_0x60c6b1);}return _0x39e735[_0x2267('0x21')]();};}function saveUpdates(_0x28c9b5,_0x3768e4){return function(_0x2ea406){if(_0x2ea406){return _0x2ea406[_0x2267('0x22')](_0x28c9b5)['then'](function(_0x13b05d){return _0x13b05d;});}return null;};}function removeEntity(_0x76fffb,_0x2392cd){return function(_0x3d56c){if(_0x3d56c){return _0x3d56c[_0x2267('0x23')]()[_0x2267('0x24')](function(){var _0x6aa9bd=_0x3d56c[_0x2267('0x25')]({'plain':!![]});var _0x1bf7f9=_0x2267('0x26');return db[_0x2267('0x27')][_0x2267('0x23')]({'where':{'type':_0x1bf7f9,'resourceId':_0x6aa9bd['id']}})['then'](function(){return _0x3d56c;});})[_0x2267('0x24')](function(){_0x76fffb[_0x2267('0x18')](0xcc)[_0x2267('0x19')]();});}};}function handleEntityNotFound(_0x1abc53,_0x4ca783){return function(_0x9f280d){if(!_0x9f280d){_0x1abc53['sendStatus'](0x194);}return _0x9f280d;};}function handleError(_0x2692a8,_0x31dce5){_0x31dce5=_0x31dce5||0x1f4;return function(_0x269473){logger[_0x2267('0x28')](_0x269473[_0x2267('0x29')]);if(_0x269473[_0x2267('0x2a')]){delete _0x269473[_0x2267('0x2a')];}_0x2692a8[_0x2267('0x18')](_0x31dce5)[_0x2267('0x2b')](_0x269473);};}exports[_0x2267('0x2c')]=function(_0x50ca20,_0x4c1638){var _0x1868a3={},_0x2e4d19={},_0xe4af16={'count':0x0,'rows':[]};var _0x26ae5d=_[_0x2267('0x2d')](db[_0x2267('0x2e')][_0x2267('0x2f')],function(_0x353cf6){return{'name':_0x353cf6[_0x2267('0x30')],'type':_0x353cf6[_0x2267('0x31')][_0x2267('0x32')]};});_0x2e4d19['model']=_[_0x2267('0x2d')](_0x26ae5d,'name');_0x2e4d19[_0x2267('0x33')]=_[_0x2267('0x34')](_0x50ca20['query']);_0x2e4d19[_0x2267('0x35')]=_[_0x2267('0x36')](_0x2e4d19[_0x2267('0x37')],_0x2e4d19[_0x2267('0x33')]);_0x1868a3[_0x2267('0x38')]=_[_0x2267('0x36')](_0x2e4d19[_0x2267('0x37')],qs[_0x2267('0x39')](_0x50ca20[_0x2267('0x33')]['fields']));_0x1868a3['attributes']=_0x1868a3['attributes'][_0x2267('0x3a')]?_0x1868a3[_0x2267('0x38')]:_0x2e4d19[_0x2267('0x37')];if(!_0x50ca20[_0x2267('0x33')][_0x2267('0x3b')]('nolimit')){_0x1868a3['limit']=qs['limit'](_0x50ca20[_0x2267('0x33')][_0x2267('0x1c')]);_0x1868a3[_0x2267('0x1a')]=qs[_0x2267('0x1a')](_0x50ca20[_0x2267('0x33')][_0x2267('0x1a')]);}_0x1868a3[_0x2267('0x3c')]=qs[_0x2267('0x3d')](_0x50ca20[_0x2267('0x33')][_0x2267('0x3d')]);_0x1868a3[_0x2267('0x3e')]=qs['filters'](_[_0x2267('0x3f')](_0x50ca20[_0x2267('0x33')],_0x2e4d19[_0x2267('0x35')]),_0x26ae5d);if(_0x50ca20[_0x2267('0x33')]['filter']){_0x1868a3[_0x2267('0x3e')]=_[_0x2267('0x40')](_0x1868a3['where'],{'$or':_[_0x2267('0x2d')](_0x26ae5d,function(_0x574fd0){if(_0x574fd0['type']!=='VIRTUAL'){var _0x5ef8ac={};_0x5ef8ac[_0x574fd0[_0x2267('0x2a')]]={'$like':'%'+_0x50ca20['query'][_0x2267('0x41')]+'%'};return _0x5ef8ac;}})});}_0x1868a3=_['merge']({},_0x1868a3,_0x50ca20['options']);var _0x399ae7={'where':_0x1868a3['where']};return db[_0x2267('0x2e')][_0x2267('0x42')](_0x399ae7)['then'](function(_0xdcc466){_0xe4af16[_0x2267('0x42')]=_0xdcc466;if(_0x50ca20[_0x2267('0x33')]['includeAll']){_0x1868a3[_0x2267('0x43')]=[{'all':!![]}];}return db[_0x2267('0x2e')][_0x2267('0x44')](_0x1868a3);})[_0x2267('0x24')](function(_0x25b7b2){_0xe4af16[_0x2267('0x45')]=_0x25b7b2;return _0xe4af16;})[_0x2267('0x24')](respondWithFilteredResult(_0x4c1638,_0x1868a3))['catch'](handleError(_0x4c1638,null));};exports[_0x2267('0x46')]=function(_0x37a967,_0x213350){var _0x36af34={'raw':!![],'where':{'id':_0x37a967[_0x2267('0x47')]['id']}},_0x49126e={};_0x49126e[_0x2267('0x37')]=_[_0x2267('0x34')](db[_0x2267('0x2e')][_0x2267('0x2f')]);_0x49126e['query']=_[_0x2267('0x34')](_0x37a967[_0x2267('0x33')]);_0x49126e[_0x2267('0x35')]=_[_0x2267('0x36')](_0x49126e['model'],_0x49126e[_0x2267('0x33')]);_0x36af34[_0x2267('0x38')]=_[_0x2267('0x36')](_0x49126e['model'],qs[_0x2267('0x39')](_0x37a967[_0x2267('0x33')][_0x2267('0x39')]));_0x36af34[_0x2267('0x38')]=_0x36af34[_0x2267('0x38')][_0x2267('0x3a')]?_0x36af34[_0x2267('0x38')]:_0x49126e[_0x2267('0x37')];if(_0x37a967[_0x2267('0x33')][_0x2267('0x48')]){_0x36af34[_0x2267('0x43')]=[{'all':!![]}];}_0x36af34=_[_0x2267('0x40')]({},_0x36af34,_0x37a967[_0x2267('0x49')]);return db[_0x2267('0x2e')][_0x2267('0x4a')](_0x36af34)['then'](handleEntityNotFound(_0x213350,null))[_0x2267('0x24')](respondWithResult(_0x213350,null))[_0x2267('0x4b')](handleError(_0x213350,null));};exports[_0x2267('0x4c')]=function(_0x39baa7,_0x1d56cf){return db[_0x2267('0x2e')]['create'](_0x39baa7[_0x2267('0x4d')],{})['then'](function(_0x2a2d27){var _0x146362=_0x39baa7[_0x2267('0x4e')][_0x2267('0x25')]({'plain':!![]});if(!_0x146362)throw new Error(_0x2267('0x4f'));if(_0x146362[_0x2267('0x50')]==='user'){var _0xac7fd5=_0x2a2d27[_0x2267('0x25')]({'plain':!![]});var _0x564306=_0x2267('0x26');return db[_0x2267('0x51')][_0x2267('0x4a')]({'where':{'name':_0x564306,'userProfileId':_0x146362[_0x2267('0x52')]},'raw':!![]})[_0x2267('0x24')](function(_0x2e4096){if(_0x2e4096&&_0x2e4096['autoAssociation']===0x0){return db[_0x2267('0x27')][_0x2267('0x4c')]({'name':_0xac7fd5[_0x2267('0x2a')],'resourceId':_0xac7fd5['id'],'type':_0x2e4096['name'],'sectionId':_0x2e4096['id']},{})[_0x2267('0x24')](function(){return _0x2a2d27;});}else{return _0x2a2d27;}})['catch'](function(_0x392e95){logger['error'](_0x2267('0x53'),_0x392e95);throw _0x392e95;});}return _0x2a2d27;})[_0x2267('0x24')](respondWithResult(_0x1d56cf,0xc9))[_0x2267('0x4b')](handleError(_0x1d56cf,null));};exports[_0x2267('0x22')]=function(_0xe1a505,_0x353401){if(_0xe1a505['body']['id']){delete _0xe1a505['body']['id'];}return db[_0x2267('0x2e')][_0x2267('0x4a')]({'where':{'id':_0xe1a505[_0x2267('0x47')]['id']}})['then'](handleEntityNotFound(_0x353401,null))[_0x2267('0x24')](saveUpdates(_0xe1a505[_0x2267('0x4d')],null))[_0x2267('0x24')](respondWithResult(_0x353401,null))[_0x2267('0x4b')](handleError(_0x353401,null));};exports[_0x2267('0x23')]=function(_0x17922e,_0x457a34){return db[_0x2267('0x2e')][_0x2267('0x4a')]({'where':{'id':_0x17922e[_0x2267('0x47')]['id']}})[_0x2267('0x24')](handleEntityNotFound(_0x457a34,null))[_0x2267('0x24')](removeEntity(_0x457a34,null))[_0x2267('0x4b')](handleError(_0x457a34,null));};exports[_0x2267('0x54')]=function(_0x164cc8,_0xd414cd,_0x1ff344){var _0x1b9e96;return db[_0x2267('0x2e')][_0x2267('0x4a')]({'where':{'id':_0x164cc8[_0x2267('0x47')]['id']},'attributes':['id',_0x2267('0x55')]})[_0x2267('0x24')](handleEntityNotFound(_0xd414cd,null))['then'](function(_0x19550b){if(_0x19550b){var _0x12fc93=require(_0x2267('0x56'))();_0x12fc93[_0x2267('0x57')](_0x19550b[_0x2267('0x55')]);_0x12fc93[_0x2267('0x58')]();return _0x19550b;}})[_0x2267('0x24')](respondWithResult(_0xd414cd,null))[_0x2267('0x4b')](handleError(_0xd414cd,null));}; \ No newline at end of file +var _0xf3db=['destroy','get','ODBC','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then'];(function(_0x56ba92,_0xb3c986){var _0x8fe94d=function(_0x23b21c){while(--_0x23b21c){_0x56ba92['push'](_0x56ba92['shift']());}};_0x8fe94d(++_0xb3c986);}(_0xf3db,0x134));var _0xbf3d=function(_0xbd9ed3,_0x39ca7e){_0xbd9ed3=_0xbd9ed3-0x0;var _0x17851a=_0xf3db[_0xbd9ed3];return _0x17851a;};'use strict';var emlformat=require(_0xbf3d('0x0'));var rimraf=require(_0xbf3d('0x1'));var zipdir=require(_0xbf3d('0x2'));var jsonpatch=require(_0xbf3d('0x3'));var rp=require('request-promise');var moment=require(_0xbf3d('0x4'));var BPromise=require(_0xbf3d('0x5'));var Mustache=require('mustache');var util=require(_0xbf3d('0x6'));var path=require(_0xbf3d('0x7'));var sox=require(_0xbf3d('0x8'));var csv=require(_0xbf3d('0x9'));var ejs=require(_0xbf3d('0xa'));var fs=require('fs');var fs_extra=require(_0xbf3d('0xb'));var _=require(_0xbf3d('0xc'));var squel=require(_0xbf3d('0xd'));var crypto=require(_0xbf3d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbf3d('0xf'));var toCsv=require(_0xbf3d('0x9'));var querystring=require(_0xbf3d('0x10'));var Papa=require('papaparse');var Redis=require(_0xbf3d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbf3d('0x12'));var as=require(_0xbf3d('0x13'));var hardwareService=require(_0xbf3d('0x14'));var logger=require(_0xbf3d('0x15'))(_0xbf3d('0x16'));var utils=require(_0xbf3d('0x17'));var config=require(_0xbf3d('0x18'));var licenseUtil=require(_0xbf3d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x585a23,_0x1722ea){_0x1722ea=_0x1722ea||0xcc;return function(_0x46a338){if(_0x46a338){return _0x585a23[_0xbf3d('0x1a')](_0x1722ea);}return _0x585a23[_0xbf3d('0x1b')](_0x1722ea)[_0xbf3d('0x1c')]();};}function respondWithResult(_0x4b7fed,_0xa2694a){_0xa2694a=_0xa2694a||0xc8;return function(_0x480521){if(_0x480521){return _0x4b7fed['status'](_0xa2694a)['json'](_0x480521);}};}function respondWithFilteredResult(_0x25ee5d,_0x3491f0){return function(_0x4df67a){if(_0x4df67a){var _0x28d338=typeof _0x3491f0[_0xbf3d('0x1d')]===_0xbf3d('0x1e')&&typeof _0x3491f0['limit']==='undefined';var _0x123a4c=_0x4df67a['count'];var _0x1b2039=_0x28d338?0x0:_0x3491f0['offset'];var _0x4cc4f8=_0x28d338?_0x4df67a[_0xbf3d('0x1f')]:_0x3491f0[_0xbf3d('0x1d')]+_0x3491f0[_0xbf3d('0x20')];var _0x57798b;if(_0x4cc4f8>=_0x123a4c){_0x4cc4f8=_0x123a4c;_0x57798b=0xc8;}else{_0x57798b=0xce;}_0x25ee5d[_0xbf3d('0x1b')](_0x57798b);return _0x25ee5d[_0xbf3d('0x21')]('Content-Range',_0x1b2039+'-'+_0x4cc4f8+'/'+_0x123a4c)[_0xbf3d('0x22')](_0x4df67a);}return null;};}function patchUpdates(_0x296e11){return function(_0x52015c){try{jsonpatch[_0xbf3d('0x23')](_0x52015c,_0x296e11,!![]);}catch(_0xd01675){return BPromise[_0xbf3d('0x24')](_0xd01675);}return _0x52015c[_0xbf3d('0x25')]();};}function saveUpdates(_0x23d981,_0x5429c9){return function(_0x324354){if(_0x324354){return _0x324354[_0xbf3d('0x26')](_0x23d981)[_0xbf3d('0x27')](function(_0x1b1ce9){return _0x1b1ce9;});}return null;};}function removeEntity(_0x3e60e6,_0x4d253c){return function(_0x37b00a){if(_0x37b00a){return _0x37b00a[_0xbf3d('0x28')]()[_0xbf3d('0x27')](function(){var _0x22b0ec=_0x37b00a[_0xbf3d('0x29')]({'plain':!![]});var _0x2d0cb4=_0xbf3d('0x2a');return db['UserProfileResource'][_0xbf3d('0x28')]({'where':{'type':_0x2d0cb4,'resourceId':_0x22b0ec['id']}})[_0xbf3d('0x27')](function(){return _0x37b00a;});})[_0xbf3d('0x27')](function(){_0x3e60e6['status'](0xcc)[_0xbf3d('0x1c')]();});}};}function handleEntityNotFound(_0x4e25dc,_0x2eb74b){return function(_0x148638){if(!_0x148638){_0x4e25dc[_0xbf3d('0x1a')](0x194);}return _0x148638;};}function handleError(_0x41e28a,_0x5b0b56){_0x5b0b56=_0x5b0b56||0x1f4;return function(_0xcece91){logger[_0xbf3d('0x2b')](_0xcece91[_0xbf3d('0x2c')]);if(_0xcece91[_0xbf3d('0x2d')]){delete _0xcece91[_0xbf3d('0x2d')];}_0x41e28a[_0xbf3d('0x1b')](_0x5b0b56)['send'](_0xcece91);};}exports[_0xbf3d('0x2e')]=function(_0x535594,_0x336579){var _0x44e65d={},_0x1a86f6={},_0x2c24e7={'count':0x0,'rows':[]};var _0x151464=_[_0xbf3d('0x2f')](db[_0xbf3d('0x30')][_0xbf3d('0x31')],function(_0x1468ed){return{'name':_0x1468ed[_0xbf3d('0x32')],'type':_0x1468ed[_0xbf3d('0x33')][_0xbf3d('0x34')]};});_0x1a86f6[_0xbf3d('0x35')]=_['map'](_0x151464,'name');_0x1a86f6[_0xbf3d('0x36')]=_['keys'](_0x535594[_0xbf3d('0x36')]);_0x1a86f6['filters']=_[_0xbf3d('0x37')](_0x1a86f6[_0xbf3d('0x35')],_0x1a86f6[_0xbf3d('0x36')]);_0x44e65d[_0xbf3d('0x38')]=_[_0xbf3d('0x37')](_0x1a86f6[_0xbf3d('0x35')],qs['fields'](_0x535594[_0xbf3d('0x36')][_0xbf3d('0x39')]));_0x44e65d[_0xbf3d('0x38')]=_0x44e65d[_0xbf3d('0x38')][_0xbf3d('0x3a')]?_0x44e65d[_0xbf3d('0x38')]:_0x1a86f6['model'];if(!_0x535594[_0xbf3d('0x36')][_0xbf3d('0x3b')](_0xbf3d('0x3c'))){_0x44e65d['limit']=qs[_0xbf3d('0x20')](_0x535594[_0xbf3d('0x36')][_0xbf3d('0x20')]);_0x44e65d['offset']=qs['offset'](_0x535594['query']['offset']);}_0x44e65d['order']=qs['sort'](_0x535594[_0xbf3d('0x36')]['sort']);_0x44e65d[_0xbf3d('0x3d')]=qs['filters'](_['pick'](_0x535594['query'],_0x1a86f6['filters']),_0x151464);if(_0x535594[_0xbf3d('0x36')][_0xbf3d('0x3e')]){_0x44e65d['where']=_['merge'](_0x44e65d['where'],{'$or':_[_0xbf3d('0x2f')](_0x151464,function(_0x1be813){if(_0x1be813[_0xbf3d('0x33')]!=='VIRTUAL'){var _0x1eaf69={};_0x1eaf69[_0x1be813[_0xbf3d('0x2d')]]={'$like':'%'+_0x535594[_0xbf3d('0x36')][_0xbf3d('0x3e')]+'%'};return _0x1eaf69;}})});}_0x44e65d=_[_0xbf3d('0x3f')]({},_0x44e65d,_0x535594['options']);var _0x40b65b={'where':_0x44e65d[_0xbf3d('0x3d')]};return db[_0xbf3d('0x30')][_0xbf3d('0x1f')](_0x40b65b)[_0xbf3d('0x27')](function(_0x59dffb){_0x2c24e7[_0xbf3d('0x1f')]=_0x59dffb;if(_0x535594[_0xbf3d('0x36')][_0xbf3d('0x40')]){_0x44e65d[_0xbf3d('0x41')]=[{'all':!![]}];}return db[_0xbf3d('0x30')][_0xbf3d('0x42')](_0x44e65d);})[_0xbf3d('0x27')](function(_0x14f9ea){_0x2c24e7[_0xbf3d('0x43')]=_0x14f9ea;return _0x2c24e7;})[_0xbf3d('0x27')](respondWithFilteredResult(_0x336579,_0x44e65d))[_0xbf3d('0x44')](handleError(_0x336579,null));};exports[_0xbf3d('0x45')]=function(_0x56291d,_0x46c087){var _0xe10962={'raw':!![],'where':{'id':_0x56291d[_0xbf3d('0x46')]['id']}},_0x13df81={};_0x13df81[_0xbf3d('0x35')]=_[_0xbf3d('0x47')](db[_0xbf3d('0x30')]['rawAttributes']);_0x13df81[_0xbf3d('0x36')]=_['keys'](_0x56291d[_0xbf3d('0x36')]);_0x13df81['filters']=_[_0xbf3d('0x37')](_0x13df81[_0xbf3d('0x35')],_0x13df81['query']);_0xe10962[_0xbf3d('0x38')]=_[_0xbf3d('0x37')](_0x13df81[_0xbf3d('0x35')],qs[_0xbf3d('0x39')](_0x56291d['query'][_0xbf3d('0x39')]));_0xe10962[_0xbf3d('0x38')]=_0xe10962[_0xbf3d('0x38')][_0xbf3d('0x3a')]?_0xe10962['attributes']:_0x13df81[_0xbf3d('0x35')];if(_0x56291d[_0xbf3d('0x36')][_0xbf3d('0x40')]){_0xe10962[_0xbf3d('0x41')]=[{'all':!![]}];}_0xe10962=_[_0xbf3d('0x3f')]({},_0xe10962,_0x56291d['options']);return db[_0xbf3d('0x30')][_0xbf3d('0x48')](_0xe10962)[_0xbf3d('0x27')](handleEntityNotFound(_0x46c087,null))[_0xbf3d('0x27')](respondWithResult(_0x46c087,null))[_0xbf3d('0x44')](handleError(_0x46c087,null));};exports[_0xbf3d('0x49')]=function(_0x24a586,_0x102a9b){return db['SquareOdbc'][_0xbf3d('0x49')](_0x24a586['body'],{})[_0xbf3d('0x27')](function(_0x7eaf6f){var _0x1b2b5f=_0x24a586[_0xbf3d('0x4a')][_0xbf3d('0x29')]({'plain':!![]});if(!_0x1b2b5f)throw new Error(_0xbf3d('0x4b'));if(_0x1b2b5f[_0xbf3d('0x4c')]===_0xbf3d('0x4a')){var _0x58880b=_0x7eaf6f[_0xbf3d('0x29')]({'plain':!![]});var _0x25fdfe='ODBC';return db['UserProfileSection'][_0xbf3d('0x48')]({'where':{'name':_0x25fdfe,'userProfileId':_0x1b2b5f[_0xbf3d('0x4d')]},'raw':!![]})['then'](function(_0x35f196){if(_0x35f196&&_0x35f196[_0xbf3d('0x4e')]===0x0){return db[_0xbf3d('0x4f')][_0xbf3d('0x49')]({'name':_0x58880b['name'],'resourceId':_0x58880b['id'],'type':_0x35f196[_0xbf3d('0x2d')],'sectionId':_0x35f196['id']},{})[_0xbf3d('0x27')](function(){return _0x7eaf6f;});}else{return _0x7eaf6f;}})['catch'](function(_0x31a84e){logger[_0xbf3d('0x2b')](_0xbf3d('0x50'),_0x31a84e);throw _0x31a84e;});}return _0x7eaf6f;})['then'](respondWithResult(_0x102a9b,0xc9))[_0xbf3d('0x44')](handleError(_0x102a9b,null));};exports['update']=function(_0x44c08a,_0x3dd078){if(_0x44c08a[_0xbf3d('0x51')]['id']){delete _0x44c08a[_0xbf3d('0x51')]['id'];}return db[_0xbf3d('0x30')][_0xbf3d('0x48')]({'where':{'id':_0x44c08a[_0xbf3d('0x46')]['id']}})[_0xbf3d('0x27')](handleEntityNotFound(_0x3dd078,null))[_0xbf3d('0x27')](saveUpdates(_0x44c08a['body'],null))[_0xbf3d('0x27')](respondWithResult(_0x3dd078,null))[_0xbf3d('0x44')](handleError(_0x3dd078,null));};exports['destroy']=function(_0x5d580d,_0x1fd78f){return db['SquareOdbc'][_0xbf3d('0x48')]({'where':{'id':_0x5d580d['params']['id']}})[_0xbf3d('0x27')](handleEntityNotFound(_0x1fd78f,null))['then'](removeEntity(_0x1fd78f,null))[_0xbf3d('0x44')](handleError(_0x1fd78f,null));};exports[_0xbf3d('0x52')]=function(_0x5c73ca,_0x57d71e,_0x3583db){var _0x372de2;return db[_0xbf3d('0x30')][_0xbf3d('0x48')]({'where':{'id':_0x5c73ca[_0xbf3d('0x46')]['id']},'attributes':['id',_0xbf3d('0x53')]})[_0xbf3d('0x27')](handleEntityNotFound(_0x57d71e,null))['then'](function(_0x109bca){if(_0x109bca){var _0x24faff=require(_0xbf3d('0x54'))();_0x24faff[_0xbf3d('0x55')](_0x109bca[_0xbf3d('0x53')]);_0x24faff[_0xbf3d('0x56')]();return _0x109bca;}})[_0xbf3d('0x27')](respondWithResult(_0x57d71e,null))['catch'](handleError(_0x57d71e,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 29eb55f..95d37f8 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 _0x3b6a=['path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','api','moment','bluebird'];(function(_0x368669,_0x3f9b35){var _0x3e6789=function(_0x9268a6){while(--_0x9268a6){_0x368669['push'](_0x368669['shift']());}};_0x3e6789(++_0x3f9b35);}(_0x3b6a,0x19f));var _0xa3b6=function(_0x17474a,_0xd1a49c){_0x17474a=_0x17474a-0x0;var _0x3a5495=_0x3b6a[_0x17474a];return _0x3a5495;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa3b6('0x0'));var moment=require(_0xa3b6('0x1'));var BPromise=require(_0xa3b6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3b6('0x3'));var rimraf=require(_0xa3b6('0x4'));var config=require(_0xa3b6('0x5'));var attributes=require(_0xa3b6('0x6'));module[_0xa3b6('0x7')]=function(_0x5130f8,_0xa6bb1b){return _0x5130f8[_0xa3b6('0x8')](_0xa3b6('0x9'),attributes,{'tableName':_0xa3b6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd75=['request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','../../config/logger','moment','bluebird'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xfd75,0x168));var _0x5fd7=function(_0x59a2a0,_0x487aaa){_0x59a2a0=_0x59a2a0-0x0;var _0x10e546=_0xfd75[_0x59a2a0];return _0x10e546;};'use strict';var _=require(_0x5fd7('0x0'));var util=require('util');var logger=require(_0x5fd7('0x1'))('api');var moment=require(_0x5fd7('0x2'));var BPromise=require(_0x5fd7('0x3'));var rp=require(_0x5fd7('0x4'));var fs=require('fs');var path=require(_0x5fd7('0x5'));var rimraf=require(_0x5fd7('0x6'));var config=require(_0x5fd7('0x7'));var attributes=require(_0x5fd7('0x8'));module[_0x5fd7('0x9')]=function(_0x283311,_0x54e32e){return _0x283311[_0x5fd7('0xa')](_0x5fd7('0xb'),attributes,{'tableName':_0x5fd7('0xc'),'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 d3fad33..5339139 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 _0x6083=['request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s'];(function(_0x17c0ff,_0x520afa){var _0x164bcb=function(_0x4251f6){while(--_0x4251f6){_0x17c0ff['push'](_0x17c0ff['shift']());}};_0x164bcb(++_0x520afa);}(_0x6083,0x121));var _0x3608=function(_0x4d16c6,_0x27b31a){_0x4d16c6=_0x4d16c6-0x0;var _0x1a589a=_0x6083[_0x4d16c6];return _0x1a589a;};'use strict';var _=require(_0x3608('0x0'));var util=require(_0x3608('0x1'));var moment=require(_0x3608('0x2'));var BPromise=require(_0x3608('0x3'));var rs=require(_0x3608('0x4'));var fs=require('fs');var Redis=require(_0x3608('0x5'));var db=require(_0x3608('0x6'))['db'];var utils=require(_0x3608('0x7'));var logger=require(_0x3608('0x8'))(_0x3608('0x9'));var config=require(_0x3608('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3608('0xb')][_0x3608('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c9311,_0x5f531b,_0x3036c4){return new BPromise(function(_0x3c0a28,_0xeda0c6){return client[_0x3608('0xd')](_0x4c9311,_0x3036c4)[_0x3608('0xe')](function(_0x5967d1){logger[_0x3608('0xf')](_0x3608('0x10'),_0x5f531b,_0x3608('0x11'));logger[_0x3608('0x12')](_0x3608('0x13'),_0x5f531b,_0x3608('0x11'),JSON['stringify'](_0x5967d1));if(_0x5967d1['error']){if(_0x5967d1[_0x3608('0x14')][_0x3608('0x15')]===0x1f4){logger[_0x3608('0x14')](_0x3608('0x10'),_0x5f531b,_0x5967d1[_0x3608('0x14')][_0x3608('0x16')]);return _0xeda0c6(_0x5967d1[_0x3608('0x14')]['message']);}logger[_0x3608('0x14')](_0x3608('0x10'),_0x5f531b,_0x5967d1[_0x3608('0x14')][_0x3608('0x16')]);return _0x3c0a28(_0x5967d1[_0x3608('0x14')]['message']);}else{logger['info'](_0x3608('0x10'),_0x5f531b,_0x3608('0x11'));_0x3c0a28(_0x5967d1[_0x3608('0x17')]['message']);}})[_0x3608('0x18')](function(_0x10771d){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x5f531b,_0x10771d);_0xeda0c6(_0x10771d);});});}exports[_0x3608('0x19')]=function(_0x319c6d){var _0x12e7dc=this;return new Promise(function(_0x1b27d1,_0x32c803){return db[_0x3608('0x1a')][_0x3608('0x1b')]({'raw':_0x319c6d[_0x3608('0x1c')]?_0x319c6d[_0x3608('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x319c6d[_0x3608('0x1c')]?_0x319c6d['options'][_0x3608('0x1d')]||null:null,'attributes':_0x319c6d[_0x3608('0x1c')]?_0x319c6d[_0x3608('0x1c')][_0x3608('0x1e')]||null:null,'include':_0x319c6d['options']?_0x319c6d[_0x3608('0x1c')]['include']?_[_0x3608('0x1f')](_0x319c6d['options'][_0x3608('0x20')],function(_0x4416ee){return{'model':db[_0x4416ee['model']],'as':_0x4416ee['as'],'attributes':_0x4416ee[_0x3608('0x1e')],'include':_0x4416ee[_0x3608('0x20')]?_[_0x3608('0x1f')](_0x4416ee[_0x3608('0x20')],function(_0x3d2d5b){return{'model':db[_0x3d2d5b[_0x3608('0x21')]],'as':_0x3d2d5b['as'],'attributes':_0x3d2d5b[_0x3608('0x1e')],'include':_0x3d2d5b[_0x3608('0x20')]?_[_0x3608('0x1f')](_0x3d2d5b[_0x3608('0x20')],function(_0x320d78){return{'model':db[_0x320d78['model']],'as':_0x320d78['as'],'attributes':_0x320d78[_0x3608('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3608('0xe')](function(_0x5bbfb6){logger[_0x3608('0xf')]('ShowSquareOdbc',_0x319c6d);logger[_0x3608('0x12')](_0x3608('0x19'),_0x319c6d,JSON['stringify'](_0x5bbfb6));_0x1b27d1(_0x5bbfb6);})[_0x3608('0x18')](function(_0x22eb0c){logger[_0x3608('0x14')]('ShowSquareOdbc',_0x22eb0c['message'],_0x319c6d);_0x32c803(_0x12e7dc[_0x3608('0x14')](0x1f4,_0x22eb0c[_0x3608('0x16')]));});});}; \ No newline at end of file +var _0xcceb=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','include','map','model','then','lodash'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xcceb,0x11f));var _0xbcce=function(_0x3f25b2,_0x412bd4){_0x3f25b2=_0x3f25b2-0x0;var _0xd8caeb=_0xcceb[_0x3f25b2];return _0xd8caeb;};'use strict';var _=require(_0xbcce('0x0'));var util=require('util');var moment=require(_0xbcce('0x1'));var BPromise=require(_0xbcce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbcce('0x3'));var db=require(_0xbcce('0x4'))['db'];var utils=require(_0xbcce('0x5'));var logger=require('../../config/logger')(_0xbcce('0x6'));var config=require(_0xbcce('0x7'));var jayson=require(_0xbcce('0x8'));var client=jayson[_0xbcce('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x341977,_0x24fa1d,_0x10bcc2){return new BPromise(function(_0x33ca2b,_0x58ee2b){return client[_0xbcce('0xa')](_0x341977,_0x10bcc2)['then'](function(_0x29aadc){logger[_0xbcce('0xb')](_0xbcce('0xc'),_0x24fa1d,'request\x20sent');logger[_0xbcce('0xd')](_0xbcce('0xe'),_0x24fa1d,'request\x20sent',JSON[_0xbcce('0xf')](_0x29aadc));if(_0x29aadc[_0xbcce('0x10')]){if(_0x29aadc[_0xbcce('0x10')][_0xbcce('0x11')]===0x1f4){logger['error'](_0xbcce('0xc'),_0x24fa1d,_0x29aadc[_0xbcce('0x10')]['message']);return _0x58ee2b(_0x29aadc[_0xbcce('0x10')][_0xbcce('0x12')]);}logger[_0xbcce('0x10')](_0xbcce('0xc'),_0x24fa1d,_0x29aadc[_0xbcce('0x10')][_0xbcce('0x12')]);return _0x33ca2b(_0x29aadc['error']['message']);}else{logger[_0xbcce('0xb')](_0xbcce('0xc'),_0x24fa1d,_0xbcce('0x13'));_0x33ca2b(_0x29aadc[_0xbcce('0x14')]['message']);}})[_0xbcce('0x15')](function(_0x4139c5){logger[_0xbcce('0x10')](_0xbcce('0xc'),_0x24fa1d,_0x4139c5);_0x58ee2b(_0x4139c5);});});}exports[_0xbcce('0x16')]=function(_0x57d726){var _0x57190e=this;return new Promise(function(_0x3b6393,_0x206e96){return db[_0xbcce('0x17')]['find']({'raw':_0x57d726[_0xbcce('0x18')]?_0x57d726[_0xbcce('0x18')][_0xbcce('0x19')]===undefined?!![]:![]:!![],'where':_0x57d726['options']?_0x57d726[_0xbcce('0x18')][_0xbcce('0x1a')]||null:null,'attributes':_0x57d726[_0xbcce('0x18')]?_0x57d726[_0xbcce('0x18')][_0xbcce('0x1b')]||null:null,'include':_0x57d726[_0xbcce('0x18')]?_0x57d726['options'][_0xbcce('0x1c')]?_[_0xbcce('0x1d')](_0x57d726[_0xbcce('0x18')][_0xbcce('0x1c')],function(_0x2feb71){return{'model':db[_0x2feb71['model']],'as':_0x2feb71['as'],'attributes':_0x2feb71['attributes'],'include':_0x2feb71['include']?_[_0xbcce('0x1d')](_0x2feb71['include'],function(_0x253f83){return{'model':db[_0x253f83['model']],'as':_0x253f83['as'],'attributes':_0x253f83[_0xbcce('0x1b')],'include':_0x253f83[_0xbcce('0x1c')]?_[_0xbcce('0x1d')](_0x253f83[_0xbcce('0x1c')],function(_0x333ef9){return{'model':db[_0x333ef9[_0xbcce('0x1e')]],'as':_0x333ef9['as'],'attributes':_0x333ef9[_0xbcce('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbcce('0x1f')](function(_0x5d1928){logger['info'](_0xbcce('0x16'),_0x57d726);logger[_0xbcce('0xd')](_0xbcce('0x16'),_0x57d726,JSON[_0xbcce('0xf')](_0x5d1928));_0x3b6393(_0x5d1928);})[_0xbcce('0x15')](function(_0x2ef5ce){logger['error'](_0xbcce('0x16'),_0x2ef5ce[_0xbcce('0x12')],_0x57d726);_0x206e96(_0x57190e[_0xbcce('0x10')](0x1f4,_0x2ef5ce[_0xbcce('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 7c0a2ed..cb2a09a 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 _0x28b6=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','index','get','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x28b6,0xe1));var _0x628b=function(_0x30463e,_0x47ec53){_0x30463e=_0x30463e-0x0;var _0x347eda=_0x28b6[_0x30463e];return _0x347eda;};'use strict';var multer=require(_0x628b('0x0'));var util=require(_0x628b('0x1'));var path=require(_0x628b('0x2'));var timeout=require(_0x628b('0x3'));var express=require(_0x628b('0x4'));var router=express['Router']();var fs_extra=require(_0x628b('0x5'));var auth=require(_0x628b('0x6'));var interaction=require(_0x628b('0x7'));var config=require('../../config/environment');var controller=require(_0x628b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x628b('0x9')]);router[_0x628b('0xa')](_0x628b('0xb'),auth[_0x628b('0xc')](),controller['show']);router[_0x628b('0xd')]('/',auth[_0x628b('0xc')](),controller[_0x628b('0xe')]);router[_0x628b('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x628b('0x10')](_0x628b('0xb'),auth['isAuthenticated'](),controller[_0x628b('0x11')]);module[_0x628b('0x12')]=router; \ No newline at end of file +var _0x4494=['../../components/auth/service','../../config/environment','./squareProject.controller','get','index','/:id','isAuthenticated','show','post','put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0x4494,0x67));var _0x4449=function(_0x301434,_0x3eeb48){_0x301434=_0x301434-0x0;var _0x4bb9c7=_0x4494[_0x301434];return _0x4bb9c7;};'use strict';var multer=require('multer');var util=require(_0x4449('0x0'));var path=require(_0x4449('0x1'));var timeout=require(_0x4449('0x2'));var express=require('express');var router=express[_0x4449('0x3')]();var fs_extra=require(_0x4449('0x4'));var auth=require(_0x4449('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4449('0x6'));var controller=require(_0x4449('0x7'));router[_0x4449('0x8')]('/',auth['isAuthenticated'](),controller[_0x4449('0x9')]);router['get'](_0x4449('0xa'),auth[_0x4449('0xb')](),controller[_0x4449('0xc')]);router[_0x4449('0xd')]('/',auth[_0x4449('0xb')](),controller['create']);router[_0x4449('0xe')]('/:id',auth[_0x4449('0xb')](),controller['update']);router[_0x4449('0xf')](_0x4449('0xa'),auth['isAuthenticated'](),controller[_0x4449('0x10')]);module[_0x4449('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index f4c7a12..8514cf6 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 _0xecc5=['sequelize','exports','STRING','name','TEXT','BLOB','long','preproduction','getDataValue','utf8','production','toString','DATE'];(function(_0x19f137,_0x69a6c5){var _0x13021f=function(_0x53e2c5){while(--_0x53e2c5){_0x19f137['push'](_0x19f137['shift']());}};_0x13021f(++_0x69a6c5);}(_0xecc5,0x16c));var _0x5ecc=function(_0x462a7a,_0x47a964){_0x462a7a=_0x462a7a-0x0;var _0x4c9781=_0xecc5[_0x462a7a];return _0x4c9781;};'use strict';var Sequelize=require(_0x5ecc('0x0'));module[_0x5ecc('0x1')]={'name':{'type':Sequelize[_0x5ecc('0x2')],'unique':_0x5ecc('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5ecc('0x2')]},'notes':{'type':Sequelize[_0x5ecc('0x4')]},'preproduction':{'type':Sequelize[_0x5ecc('0x5')](_0x5ecc('0x6')),'get':function(){if(this['getDataValue'](_0x5ecc('0x7'))){return this[_0x5ecc('0x8')](_0x5ecc('0x7'))['toString'](_0x5ecc('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x5ecc('0x6')),'get':function(){if(this[_0x5ecc('0x8')](_0x5ecc('0xa'))){return this[_0x5ecc('0x8')]('production')[_0x5ecc('0xb')]('utf8');}}},'savedAt':{'type':Sequelize[_0x5ecc('0xc')]},'publishedAt':{'type':Sequelize[_0x5ecc('0xc')]}}; \ No newline at end of file +var _0x4eb8=['BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','name','TEXT'];(function(_0x5bdb14,_0x4f87c1){var _0x5b3d71=function(_0x3c27a6){while(--_0x3c27a6){_0x5bdb14['push'](_0x5bdb14['shift']());}};_0x5b3d71(++_0x4f87c1);}(_0x4eb8,0x1b5));var _0x84eb=function(_0x4e1217,_0x45a98a){_0x4e1217=_0x4e1217-0x0;var _0x1ecdce=_0x4eb8[_0x4e1217];return _0x1ecdce;};'use strict';var Sequelize=require(_0x84eb('0x0'));module[_0x84eb('0x1')]={'name':{'type':Sequelize[_0x84eb('0x2')],'unique':_0x84eb('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x84eb('0x4')]},'preproduction':{'type':Sequelize[_0x84eb('0x5')](_0x84eb('0x6')),'get':function(){if(this[_0x84eb('0x7')](_0x84eb('0x8'))){return this[_0x84eb('0x7')](_0x84eb('0x8'))[_0x84eb('0x9')](_0x84eb('0xa'));}}},'production':{'type':Sequelize['BLOB'](_0x84eb('0x6')),'get':function(){if(this[_0x84eb('0x7')](_0x84eb('0xb'))){return this[_0x84eb('0x7')](_0x84eb('0xb'))[_0x84eb('0x9')](_0x84eb('0xa'));}}},'savedAt':{'type':Sequelize[_0x84eb('0xc')]},'publishedAt':{'type':Sequelize[_0x84eb('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index b86c0f4..a21e2d8 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 _0x8612=['localhost','socket.io-emitter','register','status','offset','undefined','limit','count','set','json','destroy','then','get','SquareProjects','UserProfileResource','stringify','end','error','stack','name','index','map','SquareProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','user','role','UserProfileSection','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','publish','agi','production','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults'];(function(_0x3f48ad,_0x2e7026){var _0x4d5d7a=function(_0x926da2){while(--_0x926da2){_0x3f48ad['push'](_0x3f48ad['shift']());}};_0x4d5d7a(++_0x2e7026);}(_0x8612,0x80));var _0x2861=function(_0x418282,_0x5a1817){_0x418282=_0x418282-0x0;var _0x576771=_0x8612[_0x418282];return _0x576771;};'use strict';var _=require('lodash');var Redis=require(_0x2861('0x0'));var qs=require(_0x2861('0x1'));var logger=require(_0x2861('0x2'))(_0x2861('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x2861('0x4')]=_[_0x2861('0x5')](config['redis'],{'host':_0x2861('0x6'),'port':0x18eb});var socket=require(_0x2861('0x7'))(new Redis(config[_0x2861('0x4')]));require('./squareProject.socket')[_0x2861('0x8')](socket);function respondWithResult(_0x36c7cd,_0x141df2){_0x141df2=_0x141df2||0xc8;return function(_0x43e16b){if(_0x43e16b){return _0x36c7cd[_0x2861('0x9')](_0x141df2)['json'](_0x43e16b);}};}function respondWithFilteredResult(_0x3fe7d5,_0x218fff){return function(_0x311280){if(_0x311280){var _0x35b418=typeof _0x218fff[_0x2861('0xa')]===_0x2861('0xb')&&typeof _0x218fff[_0x2861('0xc')]===_0x2861('0xb');var _0x13b274=_0x311280[_0x2861('0xd')];var _0x3acdcb=_0x35b418?0x0:_0x218fff[_0x2861('0xa')];var _0x2ed743=_0x35b418?_0x311280[_0x2861('0xd')]:_0x218fff[_0x2861('0xa')]+_0x218fff['limit'];var _0x4a4f7a;if(_0x2ed743>=_0x13b274){_0x2ed743=_0x13b274;_0x4a4f7a=0xc8;}else{_0x4a4f7a=0xce;}_0x3fe7d5['status'](_0x4a4f7a);return _0x3fe7d5[_0x2861('0xe')]('Content-Range',_0x3acdcb+'-'+_0x2ed743+'/'+_0x13b274)[_0x2861('0xf')](_0x311280);}return null;};}function saveUpdates(_0x44ffc6){return function(_0x124df0){if(_0x124df0){return _0x124df0['update'](_0x44ffc6)['then'](function(_0x4223df){return _0x4223df;});}return null;};}function removeEntity(_0x4051c2){return function(_0x31d886){if(_0x31d886){return _0x31d886[_0x2861('0x10')]()[_0x2861('0x11')](function(){var _0x12cc7d=_0x31d886[_0x2861('0x12')]({'plain':!![]});var _0x3c8638=_0x2861('0x13');return db[_0x2861('0x14')][_0x2861('0x10')]({'where':{'type':_0x3c8638,'resourceId':_0x12cc7d['id']}})[_0x2861('0x11')](function(){return _0x31d886;});})[_0x2861('0x11')](function(){var _0x4e41ed=new Redis(config[_0x2861('0x4')]);_0x4e41ed['publish']('agi',JSON[_0x2861('0x15')]({'id':_0x31d886['id'],'deleted':!![]}));})[_0x2861('0x11')](function(){_0x4051c2[_0x2861('0x9')](0xcc)[_0x2861('0x16')]();});}};}function handleEntityNotFound(_0x2091a7){return function(_0x195521){if(!_0x195521){_0x2091a7['sendStatus'](0x194);}return _0x195521;};}function handleError(_0x17dcc4,_0x5051bc){_0x5051bc=_0x5051bc||0x1f4;return function(_0x4384e0){logger[_0x2861('0x17')](_0x4384e0[_0x2861('0x18')]);if(_0x4384e0['name']){delete _0x4384e0[_0x2861('0x19')];}_0x17dcc4[_0x2861('0x9')](_0x5051bc)['send'](_0x4384e0);};}exports[_0x2861('0x1a')]=function(_0x3acf32,_0x3d76c7){var _0x359364={},_0xbf6ff1={},_0x4bb9bc={'count':0x0,'rows':[]};var _0x40f956=_[_0x2861('0x1b')](db[_0x2861('0x1c')][_0x2861('0x1d')],function(_0x413812){return{'name':_0x413812[_0x2861('0x1e')],'type':_0x413812[_0x2861('0x1f')][_0x2861('0x20')]};});_0xbf6ff1['model']=_[_0x2861('0x1b')](_0x40f956,_0x2861('0x19'));_0xbf6ff1[_0x2861('0x21')]=_[_0x2861('0x22')](_0x3acf32[_0x2861('0x21')]);_0xbf6ff1[_0x2861('0x23')]=_[_0x2861('0x24')](_0xbf6ff1[_0x2861('0x25')],_0xbf6ff1[_0x2861('0x21')]);_0x359364[_0x2861('0x26')]=_[_0x2861('0x24')](_0xbf6ff1[_0x2861('0x25')],qs[_0x2861('0x27')](_0x3acf32[_0x2861('0x21')]['fields']));_0x359364['attributes']=_0x359364[_0x2861('0x26')]['length']?_0x359364[_0x2861('0x26')]:_0xbf6ff1['model'];if(!_0x3acf32[_0x2861('0x21')][_0x2861('0x28')]('nolimit')){_0x359364[_0x2861('0xc')]=qs['limit'](_0x3acf32[_0x2861('0x21')][_0x2861('0xc')]);_0x359364[_0x2861('0xa')]=qs[_0x2861('0xa')](_0x3acf32[_0x2861('0x21')][_0x2861('0xa')]);}_0x359364['order']=qs[_0x2861('0x29')](_0x3acf32[_0x2861('0x21')][_0x2861('0x29')]);_0x359364[_0x2861('0x2a')]=qs[_0x2861('0x23')](_[_0x2861('0x2b')](_0x3acf32['query'],_0xbf6ff1[_0x2861('0x23')]),_0x40f956);if(_0x3acf32['query'][_0x2861('0x2c')]){_0x359364[_0x2861('0x2a')]=_[_0x2861('0x2d')](_0x359364[_0x2861('0x2a')],{'$or':_[_0x2861('0x1b')](_0x40f956,function(_0x5d524d){if(_0x5d524d['type']!==_0x2861('0x2e')){var _0x4bfd05={};_0x4bfd05[_0x5d524d[_0x2861('0x19')]]={'$like':'%'+_0x3acf32[_0x2861('0x21')]['filter']+'%'};return _0x4bfd05;}})});}_0x359364=_[_0x2861('0x2d')]({},_0x359364,_0x3acf32[_0x2861('0x2f')]);var _0x163eaf={'where':_0x359364[_0x2861('0x2a')]};return db['SquareProject']['count'](_0x163eaf)[_0x2861('0x11')](function(_0x522d0d){_0x4bb9bc[_0x2861('0xd')]=_0x522d0d;if(_0x3acf32[_0x2861('0x21')][_0x2861('0x30')]){_0x359364['include']=[{'all':!![]}];}return db['SquareProject'][_0x2861('0x31')](_0x359364);})[_0x2861('0x11')](function(_0x470a5a){_0x4bb9bc[_0x2861('0x32')]=_0x470a5a;return _0x4bb9bc;})[_0x2861('0x11')](respondWithFilteredResult(_0x3d76c7,_0x359364))[_0x2861('0x33')](handleError(_0x3d76c7,null));};exports['show']=function(_0x4eff86,_0x442752){var _0x5a5f20={'raw':![],'where':{'id':_0x4eff86[_0x2861('0x34')]['id']}},_0x3d60fb={};_0x3d60fb[_0x2861('0x25')]=_[_0x2861('0x22')](db[_0x2861('0x1c')][_0x2861('0x1d')]);_0x3d60fb['query']=_['keys'](_0x4eff86['query']);_0x3d60fb[_0x2861('0x23')]=_[_0x2861('0x24')](_0x3d60fb[_0x2861('0x25')],_0x3d60fb[_0x2861('0x21')]);_0x5a5f20[_0x2861('0x26')]=_['intersection'](_0x3d60fb['model'],qs[_0x2861('0x27')](_0x4eff86[_0x2861('0x21')][_0x2861('0x27')]));_0x5a5f20[_0x2861('0x26')]=_0x5a5f20[_0x2861('0x26')][_0x2861('0x35')]?_0x5a5f20[_0x2861('0x26')]:_0x3d60fb['model'];if(_0x4eff86['query']['includeAll']){_0x5a5f20[_0x2861('0x36')]=[{'all':!![]}];}_0x5a5f20=_['merge']({},_0x5a5f20,_0x4eff86[_0x2861('0x2f')]);return db['SquareProject']['find'](_0x5a5f20)[_0x2861('0x11')](handleEntityNotFound(_0x442752,null))[_0x2861('0x11')](respondWithResult(_0x442752,null))[_0x2861('0x33')](handleError(_0x442752,null));};exports['create']=function(_0x29089f,_0xcd6fc){return db[_0x2861('0x1c')]['create'](_0x29089f['body'],{})[_0x2861('0x11')](function(_0x57dac3){var _0x1bb5c2=_0x29089f[_0x2861('0x37')][_0x2861('0x12')]({'plain':!![]});if(!_0x1bb5c2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bb5c2[_0x2861('0x38')]===_0x2861('0x37')){var _0x4e30d3=_0x57dac3[_0x2861('0x12')]({'plain':!![]});var _0x559aa3=_0x2861('0x13');return db[_0x2861('0x39')][_0x2861('0x3a')]({'where':{'name':_0x559aa3,'userProfileId':_0x1bb5c2['userProfileId']},'raw':!![]})['then'](function(_0x340c52){if(_0x340c52&&_0x340c52[_0x2861('0x3b')]===0x0){return db[_0x2861('0x14')][_0x2861('0x3c')]({'name':_0x4e30d3[_0x2861('0x19')],'resourceId':_0x4e30d3['id'],'type':_0x340c52['name'],'sectionId':_0x340c52['id']},{})[_0x2861('0x11')](function(){return _0x57dac3;});}else{return _0x57dac3;}})[_0x2861('0x33')](function(_0x832ee2){logger[_0x2861('0x17')](_0x2861('0x3d'),_0x832ee2);throw _0x832ee2;});}return _0x57dac3;})[_0x2861('0x11')](respondWithResult(_0xcd6fc,0xc9))[_0x2861('0x33')](handleError(_0xcd6fc,null));};exports[_0x2861('0x3e')]=function(_0x30a1ec,_0x483bb6){if(_0x30a1ec[_0x2861('0x3f')]['id']){delete _0x30a1ec['body']['id'];}return db['SquareProject']['find']({'where':{'id':_0x30a1ec[_0x2861('0x34')]['id']}})['then'](handleEntityNotFound(_0x483bb6,null))[_0x2861('0x11')](saveUpdates(_0x30a1ec[_0x2861('0x3f')],null))[_0x2861('0x11')](function(_0x266b5c){if(!_0x266b5c)return;var _0x3667b8=_0x266b5c[_0x2861('0x12')]({'plain':!![]});return _0x3667b8;})[_0x2861('0x11')](function(_0x3e0826){var _0x54c761=new Redis(config[_0x2861('0x4')]);_0x54c761[_0x2861('0x40')](_0x2861('0x41'),JSON[_0x2861('0x15')](_[_0x2861('0x2b')](_0x3e0826,['id',_0x2861('0x19'),_0x2861('0x42')])));return _0x3e0826;})[_0x2861('0x11')](respondWithResult(_0x483bb6,null))[_0x2861('0x33')](handleError(_0x483bb6,null));};exports[_0x2861('0x10')]=function(_0x55d59e,_0x346221){return db[_0x2861('0x1c')][_0x2861('0x3a')]({'where':{'id':_0x55d59e['params']['id']}})[_0x2861('0x11')](handleEntityNotFound(_0x346221,null))['then'](removeEntity(_0x346221,null))[_0x2861('0x33')](handleError(_0x346221,null));}; \ No newline at end of file +var _0x4a5e=['sort','where','pick','filter','merge','VIRTUAL','options','SquareProject','includeAll','findAll','catch','params','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','SquareProjects','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','publish','agi','destroy','ioredis','../../components/parsers/qs','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','count','Content-Range','update','then','get','UserProfileResource','stringify','end','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x4595d8,_0x3f1960){var _0x5ddba8=function(_0x5df888){while(--_0x5df888){_0x4595d8['push'](_0x4595d8['shift']());}};_0x5ddba8(++_0x3f1960);}(_0x4a5e,0x11e));var _0xe4a5=function(_0x38767a,_0x530907){_0x38767a=_0x38767a-0x0;var _0x377de8=_0x4a5e[_0x38767a];return _0x377de8;};'use strict';var _=require('lodash');var Redis=require(_0xe4a5('0x0'));var qs=require(_0xe4a5('0x1'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xe4a5('0x2')],{'host':_0xe4a5('0x3'),'port':0x18eb});var socket=require(_0xe4a5('0x4'))(new Redis(config[_0xe4a5('0x2')]));require(_0xe4a5('0x5'))[_0xe4a5('0x6')](socket);function respondWithResult(_0x160fac,_0x42070d){_0x42070d=_0x42070d||0xc8;return function(_0x3939d2){if(_0x3939d2){return _0x160fac[_0xe4a5('0x7')](_0x42070d)[_0xe4a5('0x8')](_0x3939d2);}};}function respondWithFilteredResult(_0x563b85,_0x26c98){return function(_0x58ce51){if(_0x58ce51){var _0x911a0c=typeof _0x26c98[_0xe4a5('0x9')]==='undefined'&&typeof _0x26c98['limit']==='undefined';var _0x2edae8=_0x58ce51[_0xe4a5('0xa')];var _0x421e63=_0x911a0c?0x0:_0x26c98[_0xe4a5('0x9')];var _0x145c1b=_0x911a0c?_0x58ce51['count']:_0x26c98[_0xe4a5('0x9')]+_0x26c98['limit'];var _0x14ef5a;if(_0x145c1b>=_0x2edae8){_0x145c1b=_0x2edae8;_0x14ef5a=0xc8;}else{_0x14ef5a=0xce;}_0x563b85[_0xe4a5('0x7')](_0x14ef5a);return _0x563b85['set'](_0xe4a5('0xb'),_0x421e63+'-'+_0x145c1b+'/'+_0x2edae8)[_0xe4a5('0x8')](_0x58ce51);}return null;};}function saveUpdates(_0x184796){return function(_0x4907c2){if(_0x4907c2){return _0x4907c2[_0xe4a5('0xc')](_0x184796)['then'](function(_0x405721){return _0x405721;});}return null;};}function removeEntity(_0xeddcac){return function(_0x480170){if(_0x480170){return _0x480170['destroy']()[_0xe4a5('0xd')](function(){var _0x19be30=_0x480170[_0xe4a5('0xe')]({'plain':!![]});var _0x562e5='SquareProjects';return db[_0xe4a5('0xf')]['destroy']({'where':{'type':_0x562e5,'resourceId':_0x19be30['id']}})['then'](function(){return _0x480170;});})[_0xe4a5('0xd')](function(){var _0x4aeac6=new Redis(config[_0xe4a5('0x2')]);_0x4aeac6['publish']('agi',JSON[_0xe4a5('0x10')]({'id':_0x480170['id'],'deleted':!![]}));})[_0xe4a5('0xd')](function(){_0xeddcac[_0xe4a5('0x7')](0xcc)[_0xe4a5('0x11')]();});}};}function handleEntityNotFound(_0x432366){return function(_0x1b8465){if(!_0x1b8465){_0x432366['sendStatus'](0x194);}return _0x1b8465;};}function handleError(_0x2ec94c,_0x4b167e){_0x4b167e=_0x4b167e||0x1f4;return function(_0x3dc0f9){logger['error'](_0x3dc0f9[_0xe4a5('0x12')]);if(_0x3dc0f9[_0xe4a5('0x13')]){delete _0x3dc0f9['name'];}_0x2ec94c['status'](_0x4b167e)[_0xe4a5('0x14')](_0x3dc0f9);};}exports[_0xe4a5('0x15')]=function(_0x522380,_0x22ec5e){var _0x5a131e={},_0x201850={},_0x317daf={'count':0x0,'rows':[]};var _0x4ce4fc=_['map'](db['SquareProject'][_0xe4a5('0x16')],function(_0x5564a3){return{'name':_0x5564a3[_0xe4a5('0x17')],'type':_0x5564a3[_0xe4a5('0x18')][_0xe4a5('0x19')]};});_0x201850[_0xe4a5('0x1a')]=_[_0xe4a5('0x1b')](_0x4ce4fc,_0xe4a5('0x13'));_0x201850[_0xe4a5('0x1c')]=_[_0xe4a5('0x1d')](_0x522380[_0xe4a5('0x1c')]);_0x201850[_0xe4a5('0x1e')]=_[_0xe4a5('0x1f')](_0x201850[_0xe4a5('0x1a')],_0x201850[_0xe4a5('0x1c')]);_0x5a131e[_0xe4a5('0x20')]=_['intersection'](_0x201850[_0xe4a5('0x1a')],qs[_0xe4a5('0x21')](_0x522380[_0xe4a5('0x1c')]['fields']));_0x5a131e[_0xe4a5('0x20')]=_0x5a131e[_0xe4a5('0x20')][_0xe4a5('0x22')]?_0x5a131e[_0xe4a5('0x20')]:_0x201850[_0xe4a5('0x1a')];if(!_0x522380['query'][_0xe4a5('0x23')](_0xe4a5('0x24'))){_0x5a131e['limit']=qs['limit'](_0x522380[_0xe4a5('0x1c')][_0xe4a5('0x25')]);_0x5a131e['offset']=qs[_0xe4a5('0x9')](_0x522380[_0xe4a5('0x1c')]['offset']);}_0x5a131e[_0xe4a5('0x26')]=qs[_0xe4a5('0x27')](_0x522380[_0xe4a5('0x1c')][_0xe4a5('0x27')]);_0x5a131e[_0xe4a5('0x28')]=qs[_0xe4a5('0x1e')](_[_0xe4a5('0x29')](_0x522380['query'],_0x201850[_0xe4a5('0x1e')]),_0x4ce4fc);if(_0x522380[_0xe4a5('0x1c')][_0xe4a5('0x2a')]){_0x5a131e[_0xe4a5('0x28')]=_[_0xe4a5('0x2b')](_0x5a131e[_0xe4a5('0x28')],{'$or':_[_0xe4a5('0x1b')](_0x4ce4fc,function(_0x21303b){if(_0x21303b[_0xe4a5('0x18')]!==_0xe4a5('0x2c')){var _0x2735dc={};_0x2735dc[_0x21303b[_0xe4a5('0x13')]]={'$like':'%'+_0x522380['query'][_0xe4a5('0x2a')]+'%'};return _0x2735dc;}})});}_0x5a131e=_[_0xe4a5('0x2b')]({},_0x5a131e,_0x522380[_0xe4a5('0x2d')]);var _0x49b60e={'where':_0x5a131e[_0xe4a5('0x28')]};return db[_0xe4a5('0x2e')][_0xe4a5('0xa')](_0x49b60e)[_0xe4a5('0xd')](function(_0x269db4){_0x317daf['count']=_0x269db4;if(_0x522380['query'][_0xe4a5('0x2f')]){_0x5a131e['include']=[{'all':!![]}];}return db[_0xe4a5('0x2e')][_0xe4a5('0x30')](_0x5a131e);})[_0xe4a5('0xd')](function(_0x2187c7){_0x317daf['rows']=_0x2187c7;return _0x317daf;})[_0xe4a5('0xd')](respondWithFilteredResult(_0x22ec5e,_0x5a131e))[_0xe4a5('0x31')](handleError(_0x22ec5e,null));};exports['show']=function(_0x31a2ec,_0x4b691b){var _0x32b80a={'raw':![],'where':{'id':_0x31a2ec[_0xe4a5('0x32')]['id']}},_0x5128cc={};_0x5128cc[_0xe4a5('0x1a')]=_['keys'](db[_0xe4a5('0x2e')]['rawAttributes']);_0x5128cc[_0xe4a5('0x1c')]=_['keys'](_0x31a2ec[_0xe4a5('0x1c')]);_0x5128cc['filters']=_['intersection'](_0x5128cc['model'],_0x5128cc[_0xe4a5('0x1c')]);_0x32b80a['attributes']=_[_0xe4a5('0x1f')](_0x5128cc[_0xe4a5('0x1a')],qs[_0xe4a5('0x21')](_0x31a2ec[_0xe4a5('0x1c')]['fields']));_0x32b80a[_0xe4a5('0x20')]=_0x32b80a[_0xe4a5('0x20')][_0xe4a5('0x22')]?_0x32b80a[_0xe4a5('0x20')]:_0x5128cc[_0xe4a5('0x1a')];if(_0x31a2ec[_0xe4a5('0x1c')]['includeAll']){_0x32b80a[_0xe4a5('0x33')]=[{'all':!![]}];}_0x32b80a=_['merge']({},_0x32b80a,_0x31a2ec['options']);return db['SquareProject'][_0xe4a5('0x34')](_0x32b80a)[_0xe4a5('0xd')](handleEntityNotFound(_0x4b691b,null))[_0xe4a5('0xd')](respondWithResult(_0x4b691b,null))[_0xe4a5('0x31')](handleError(_0x4b691b,null));};exports[_0xe4a5('0x35')]=function(_0x53af68,_0xafe4f6){return db[_0xe4a5('0x2e')][_0xe4a5('0x35')](_0x53af68['body'],{})[_0xe4a5('0xd')](function(_0x4bb400){var _0x44648b=_0x53af68['user'][_0xe4a5('0xe')]({'plain':!![]});if(!_0x44648b)throw new Error(_0xe4a5('0x36'));if(_0x44648b['role']===_0xe4a5('0x37')){var _0x16f954=_0x4bb400['get']({'plain':!![]});var _0x38e28a=_0xe4a5('0x38');return db['UserProfileSection'][_0xe4a5('0x34')]({'where':{'name':_0x38e28a,'userProfileId':_0x44648b[_0xe4a5('0x39')]},'raw':!![]})['then'](function(_0x18c4ac){if(_0x18c4ac&&_0x18c4ac[_0xe4a5('0x3a')]===0x0){return db['UserProfileResource']['create']({'name':_0x16f954[_0xe4a5('0x13')],'resourceId':_0x16f954['id'],'type':_0x18c4ac['name'],'sectionId':_0x18c4ac['id']},{})[_0xe4a5('0xd')](function(){return _0x4bb400;});}else{return _0x4bb400;}})[_0xe4a5('0x31')](function(_0x2056e6){logger[_0xe4a5('0x3b')](_0xe4a5('0x3c'),_0x2056e6);throw _0x2056e6;});}return _0x4bb400;})[_0xe4a5('0xd')](respondWithResult(_0xafe4f6,0xc9))[_0xe4a5('0x31')](handleError(_0xafe4f6,null));};exports[_0xe4a5('0xc')]=function(_0x45f394,_0x53ed87){if(_0x45f394[_0xe4a5('0x3d')]['id']){delete _0x45f394[_0xe4a5('0x3d')]['id'];}return db[_0xe4a5('0x2e')][_0xe4a5('0x34')]({'where':{'id':_0x45f394[_0xe4a5('0x32')]['id']}})[_0xe4a5('0xd')](handleEntityNotFound(_0x53ed87,null))[_0xe4a5('0xd')](saveUpdates(_0x45f394['body'],null))['then'](function(_0x1d75e8){if(!_0x1d75e8)return;var _0x7bcbbb=_0x1d75e8[_0xe4a5('0xe')]({'plain':!![]});return _0x7bcbbb;})[_0xe4a5('0xd')](function(_0x92d020){var _0x1531e9=new Redis(config['redis']);_0x1531e9[_0xe4a5('0x3e')](_0xe4a5('0x3f'),JSON['stringify'](_[_0xe4a5('0x29')](_0x92d020,['id',_0xe4a5('0x13'),'production'])));return _0x92d020;})[_0xe4a5('0xd')](respondWithResult(_0x53ed87,null))[_0xe4a5('0x31')](handleError(_0x53ed87,null));};exports[_0xe4a5('0x40')]=function(_0x31024d,_0x5556a6){return db[_0xe4a5('0x2e')][_0xe4a5('0x34')]({'where':{'id':_0x31024d[_0xe4a5('0x32')]['id']}})[_0xe4a5('0xd')](handleEntityNotFound(_0x5556a6,null))[_0xe4a5('0xd')](removeEntity(_0x5556a6,null))[_0xe4a5('0x31')](handleError(_0x5556a6,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 930e2cd..12e39a4 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 _0xfd41=['exports','SquareProject','setMaxListeners','save','update','remove','hasOwnProperty','hook'];(function(_0x3e40bd,_0x161288){var _0xad9a6f=function(_0x427b46){while(--_0x427b46){_0x3e40bd['push'](_0x3e40bd['shift']());}};_0xad9a6f(++_0x161288);}(_0xfd41,0x69));var _0x1fd4=function(_0x128450,_0x5869ba){_0x128450=_0x128450-0x0;var _0x4d80ed=_0xfd41[_0x128450];return _0x4d80ed;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0x1fd4('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x1fd4('0x1')](0x0);var events={'afterCreate':_0x1fd4('0x2'),'afterUpdate':_0x1fd4('0x3'),'afterDestroy':_0x1fd4('0x4')};function emitEvent(_0x191f18){return function(_0x334604,_0x8cdfba,_0x9a4eb0){SquareProjectEvents['emit'](_0x191f18+':'+_0x334604['id'],_0x334604);SquareProjectEvents['emit'](_0x191f18,_0x334604);_0x9a4eb0(null);};}for(var e in events){if(events[_0x1fd4('0x5')](e)){var event=events[e];SquareProject[_0x1fd4('0x6')](e,emitEvent(event));}}module[_0x1fd4('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xd4e3=['events','../../mysqldb','setMaxListeners','save','update','hasOwnProperty','hook','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd4e3,0x1a8));var _0x3d4e=function(_0x110ea8,_0xacb6fa){_0x110ea8=_0x110ea8-0x0;var _0x4073cf=_0xd4e3[_0x110ea8];return _0x4073cf;};'use strict';var EventEmitter=require(_0x3d4e('0x0'));var SquareProject=require(_0x3d4e('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x3d4e('0x2')](0x0);var events={'afterCreate':_0x3d4e('0x3'),'afterUpdate':_0x3d4e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x32210f){return function(_0x5d9a98,_0x56fae6,_0x33c31b){SquareProjectEvents['emit'](_0x32210f+':'+_0x5d9a98['id'],_0x5d9a98);SquareProjectEvents['emit'](_0x32210f,_0x5d9a98);_0x33c31b(null);};}for(var e in events){if(events[_0x3d4e('0x5')](e)){var event=events[e];SquareProject[_0x3d4e('0x6')](e,emitEvent(event));}}module[_0x3d4e('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 9390ca4..f479492 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 _0x5464=['publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','preproduction','savedAt','format','changed'];(function(_0x55643e,_0x5b54c3){var _0x3f8158=function(_0x80c551){while(--_0x80c551){_0x55643e['push'](_0x55643e['shift']());}};_0x3f8158(++_0x5b54c3);}(_0x5464,0xb6));var _0x4546=function(_0x1387d9,_0x216813){_0x1387d9=_0x1387d9-0x0;var _0x2fcbb8=_0x5464[_0x1387d9];return _0x2fcbb8;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var logger=require(_0x4546('0x2'))(_0x4546('0x3'));var moment=require(_0x4546('0x4'));var BPromise=require('bluebird');var rp=require(_0x4546('0x5'));var fs=require('fs');var path=require(_0x4546('0x6'));var rimraf=require('rimraf');var config=require(_0x4546('0x7'));var attributes=require(_0x4546('0x8'));module['exports']=function(_0x20ee15,_0x56de53){return _0x20ee15[_0x4546('0x9')](_0x4546('0xa'),attributes,{'tableName':_0x4546('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x580c9b,_0x143e97,_0x2bddb1){if(_0x580c9b['changed'](_0x4546('0xc'))){_0x580c9b[_0x4546('0xd')]=moment()[_0x4546('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x580c9b[_0x4546('0xf')]('production')){_0x580c9b[_0x4546('0x10')]=moment()['format'](_0x4546('0x11'));}_0x2bddb1(null,_0x580c9b);}}});}; \ No newline at end of file +var _0x16ea=['changed','preproduction','savedAt','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','square_projects'];(function(_0x46d79c,_0x42e4c9){var _0x3f6c21=function(_0x310281){while(--_0x310281){_0x46d79c['push'](_0x46d79c['shift']());}};_0x3f6c21(++_0x42e4c9);}(_0x16ea,0x78));var _0xa16e=function(_0x1216ed,_0x10ad9b){_0x1216ed=_0x1216ed-0x0;var _0x204b2e=_0x16ea[_0x1216ed];return _0x204b2e;};'use strict';var _=require('lodash');var util=require(_0xa16e('0x0'));var logger=require(_0xa16e('0x1'))(_0xa16e('0x2'));var moment=require(_0xa16e('0x3'));var BPromise=require(_0xa16e('0x4'));var rp=require(_0xa16e('0x5'));var fs=require('fs');var path=require(_0xa16e('0x6'));var rimraf=require(_0xa16e('0x7'));var config=require(_0xa16e('0x8'));var attributes=require(_0xa16e('0x9'));module[_0xa16e('0xa')]=function(_0xe84d74,_0x3db5d8){return _0xe84d74[_0xa16e('0xb')]('SquareProject',attributes,{'tableName':_0xa16e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x48bf67,_0x5b6503,_0x40f95c){if(_0x48bf67[_0xa16e('0xd')](_0xa16e('0xe'))){_0x48bf67[_0xa16e('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x48bf67[_0xa16e('0xd')]('production')){_0x48bf67[_0xa16e('0x10')]=moment()[_0xa16e('0x11')](_0xa16e('0x12'));}_0x40f95c(null,_0x48bf67);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 582b92b..7cf35bf 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 _0x3ed8=['findAll','options','raw','where','attributes','limit','include','map','info','GetSquareProjects','debug','stringify','catch','error','message','SquareProject','model','then','ShowSquareProject','lodash','ioredis','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket'];(function(_0x396353,_0x2d935c){var _0x16f18c=function(_0x3d04b7){while(--_0x3d04b7){_0x396353['push'](_0x396353['shift']());}};_0x16f18c(++_0x2d935c);}(_0x3ed8,0x1b7));var _0x83ed=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x3ed8[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0x83ed('0x0'));var Redis=require(_0x83ed('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x83ed('0x2'));var config=require(_0x83ed('0x3'));config[_0x83ed('0x4')]=_[_0x83ed('0x5')](config[_0x83ed('0x4')],{'host':_0x83ed('0x6'),'port':0x18eb});var socket=require(_0x83ed('0x7'))(new Redis(config[_0x83ed('0x4')]));require(_0x83ed('0x8'))['register'](socket);exports['GetSquareProjects']=function(_0x593bc7){var _0x28c0eb=this;return new Promise(function(_0x1990c1,_0x1d2913){return db['SquareProject'][_0x83ed('0x9')]({'raw':_0x593bc7['options']?_0x593bc7[_0x83ed('0xa')][_0x83ed('0xb')]===undefined?!![]:![]:!![],'where':_0x593bc7[_0x83ed('0xa')]?_0x593bc7[_0x83ed('0xa')][_0x83ed('0xc')]||null:null,'attributes':_0x593bc7[_0x83ed('0xa')]?_0x593bc7[_0x83ed('0xa')][_0x83ed('0xd')]||null:null,'limit':_0x593bc7[_0x83ed('0xa')]?_0x593bc7[_0x83ed('0xa')][_0x83ed('0xe')]||null:null,'include':_0x593bc7[_0x83ed('0xa')]?_0x593bc7[_0x83ed('0xa')][_0x83ed('0xf')]?_[_0x83ed('0x10')](_0x593bc7[_0x83ed('0xa')][_0x83ed('0xf')],function(_0x13cc67){return{'model':db[_0x13cc67['model']],'as':_0x13cc67['as'],'attributes':_0x13cc67[_0x83ed('0xd')],'include':_0x13cc67[_0x83ed('0xf')]?_[_0x83ed('0x10')](_0x13cc67['include'],function(_0x4d423b){return{'model':db[_0x4d423b['model']],'as':_0x4d423b['as'],'attributes':_0x4d423b[_0x83ed('0xd')],'include':_0x4d423b[_0x83ed('0xf')]?_[_0x83ed('0x10')](_0x4d423b['include'],function(_0x2e8012){return{'model':db[_0x2e8012['model']],'as':_0x2e8012['as'],'attributes':_0x2e8012[_0x83ed('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xafdc30){logger[_0x83ed('0x11')](_0x83ed('0x12'),_0x593bc7);logger[_0x83ed('0x13')](_0x83ed('0x12'),_0x593bc7,JSON[_0x83ed('0x14')](_0xafdc30));_0x1990c1(_0xafdc30);})[_0x83ed('0x15')](function(_0x9f5f2c){logger[_0x83ed('0x16')](_0x83ed('0x12'),_0x9f5f2c['message'],_0x593bc7);_0x1d2913(_0x28c0eb['error'](0x1f4,_0x9f5f2c[_0x83ed('0x17')]));});});};exports['ShowSquareProject']=function(_0x5d261c){var _0xf30a0b=this;return new Promise(function(_0x7492f2,_0x17a535){return db[_0x83ed('0x18')]['find']({'raw':_0x5d261c['options']?_0x5d261c[_0x83ed('0xa')][_0x83ed('0xb')]===undefined?!![]:![]:!![],'where':_0x5d261c[_0x83ed('0xa')]?_0x5d261c[_0x83ed('0xa')][_0x83ed('0xc')]||null:null,'attributes':_0x5d261c[_0x83ed('0xa')]?_0x5d261c[_0x83ed('0xa')][_0x83ed('0xd')]||null:null,'include':_0x5d261c[_0x83ed('0xa')]?_0x5d261c[_0x83ed('0xa')][_0x83ed('0xf')]?_[_0x83ed('0x10')](_0x5d261c['options'][_0x83ed('0xf')],function(_0x34bd15){return{'model':db[_0x34bd15[_0x83ed('0x19')]],'as':_0x34bd15['as'],'attributes':_0x34bd15['attributes'],'include':_0x34bd15[_0x83ed('0xf')]?_['map'](_0x34bd15[_0x83ed('0xf')],function(_0x56cc3c){return{'model':db[_0x56cc3c[_0x83ed('0x19')]],'as':_0x56cc3c['as'],'attributes':_0x56cc3c[_0x83ed('0xd')],'include':_0x56cc3c[_0x83ed('0xf')]?_[_0x83ed('0x10')](_0x56cc3c['include'],function(_0x45fac5){return{'model':db[_0x45fac5[_0x83ed('0x19')]],'as':_0x45fac5['as'],'attributes':_0x45fac5[_0x83ed('0xd')]};}):[]};}):[]};}):[]:[]})[_0x83ed('0x1a')](function(_0x20f58e){logger['info'](_0x83ed('0x1b'),_0x5d261c);logger['debug'](_0x83ed('0x1b'),_0x5d261c,JSON['stringify'](_0x20f58e));_0x7492f2(_0x20f58e);})['catch'](function(_0x576bc9){logger[_0x83ed('0x16')](_0x83ed('0x1b'),_0x576bc9['message'],_0x5d261c);_0x17a535(_0xf30a0b['error'](0x1f4,_0x576bc9[_0x83ed('0x17')]));});});}; \ No newline at end of file +var _0xd52b=['findAll','options','raw','where','attributes','include','map','model','info','debug','catch','error','message','ShowSquareProject','find','stringify','lodash','ioredis','../../mysqldb','../../config/logger','rpc','redis','defaults','localhost','./squareProject.socket','register','GetSquareProjects','SquareProject'];(function(_0x56dc8c,_0x1b15ca){var _0x166838=function(_0x30257a){while(--_0x30257a){_0x56dc8c['push'](_0x56dc8c['shift']());}};_0x166838(++_0x1b15ca);}(_0xd52b,0x1d0));var _0xbd52=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xd52b[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xbd52('0x0'));var Redis=require(_0xbd52('0x1'));var db=require(_0xbd52('0x2'))['db'];var logger=require(_0xbd52('0x3'))(_0xbd52('0x4'));var config=require('../../config/environment');config[_0xbd52('0x5')]=_[_0xbd52('0x6')](config['redis'],{'host':_0xbd52('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd52('0x5')]));require(_0xbd52('0x8'))[_0xbd52('0x9')](socket);exports[_0xbd52('0xa')]=function(_0x3cfb1e){var _0x334d46=this;return new Promise(function(_0x3c3e79,_0x1c84ec){return db[_0xbd52('0xb')][_0xbd52('0xc')]({'raw':_0x3cfb1e[_0xbd52('0xd')]?_0x3cfb1e[_0xbd52('0xd')][_0xbd52('0xe')]===undefined?!![]:![]:!![],'where':_0x3cfb1e[_0xbd52('0xd')]?_0x3cfb1e['options'][_0xbd52('0xf')]||null:null,'attributes':_0x3cfb1e['options']?_0x3cfb1e[_0xbd52('0xd')][_0xbd52('0x10')]||null:null,'limit':_0x3cfb1e[_0xbd52('0xd')]?_0x3cfb1e['options']['limit']||null:null,'include':_0x3cfb1e['options']?_0x3cfb1e[_0xbd52('0xd')][_0xbd52('0x11')]?_[_0xbd52('0x12')](_0x3cfb1e[_0xbd52('0xd')][_0xbd52('0x11')],function(_0x26cb86){return{'model':db[_0x26cb86[_0xbd52('0x13')]],'as':_0x26cb86['as'],'attributes':_0x26cb86[_0xbd52('0x10')],'include':_0x26cb86[_0xbd52('0x11')]?_[_0xbd52('0x12')](_0x26cb86[_0xbd52('0x11')],function(_0x57ce05){return{'model':db[_0x57ce05[_0xbd52('0x13')]],'as':_0x57ce05['as'],'attributes':_0x57ce05[_0xbd52('0x10')],'include':_0x57ce05['include']?_[_0xbd52('0x12')](_0x57ce05[_0xbd52('0x11')],function(_0x5d611f){return{'model':db[_0x5d611f[_0xbd52('0x13')]],'as':_0x5d611f['as'],'attributes':_0x5d611f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x492571){logger[_0xbd52('0x14')](_0xbd52('0xa'),_0x3cfb1e);logger[_0xbd52('0x15')](_0xbd52('0xa'),_0x3cfb1e,JSON['stringify'](_0x492571));_0x3c3e79(_0x492571);})[_0xbd52('0x16')](function(_0x28124c){logger[_0xbd52('0x17')]('GetSquareProjects',_0x28124c[_0xbd52('0x18')],_0x3cfb1e);_0x1c84ec(_0x334d46[_0xbd52('0x17')](0x1f4,_0x28124c[_0xbd52('0x18')]));});});};exports[_0xbd52('0x19')]=function(_0x526e48){var _0x97a444=this;return new Promise(function(_0xa4ea86,_0x225764){return db[_0xbd52('0xb')][_0xbd52('0x1a')]({'raw':_0x526e48[_0xbd52('0xd')]?_0x526e48['options']['raw']===undefined?!![]:![]:!![],'where':_0x526e48[_0xbd52('0xd')]?_0x526e48['options'][_0xbd52('0xf')]||null:null,'attributes':_0x526e48[_0xbd52('0xd')]?_0x526e48[_0xbd52('0xd')][_0xbd52('0x10')]||null:null,'include':_0x526e48['options']?_0x526e48[_0xbd52('0xd')][_0xbd52('0x11')]?_[_0xbd52('0x12')](_0x526e48[_0xbd52('0xd')][_0xbd52('0x11')],function(_0xa7a2c8){return{'model':db[_0xa7a2c8[_0xbd52('0x13')]],'as':_0xa7a2c8['as'],'attributes':_0xa7a2c8[_0xbd52('0x10')],'include':_0xa7a2c8['include']?_[_0xbd52('0x12')](_0xa7a2c8[_0xbd52('0x11')],function(_0x1627a7){return{'model':db[_0x1627a7[_0xbd52('0x13')]],'as':_0x1627a7['as'],'attributes':_0x1627a7[_0xbd52('0x10')],'include':_0x1627a7[_0xbd52('0x11')]?_[_0xbd52('0x12')](_0x1627a7[_0xbd52('0x11')],function(_0x5e23bb){return{'model':db[_0x5e23bb['model']],'as':_0x5e23bb['as'],'attributes':_0x5e23bb[_0xbd52('0x10')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56ad92){logger['info'](_0xbd52('0x19'),_0x526e48);logger[_0xbd52('0x15')](_0xbd52('0x19'),_0x526e48,JSON[_0xbd52('0x1b')](_0x56ad92));_0xa4ea86(_0x56ad92);})['catch'](function(_0x14b12d){logger[_0xbd52('0x17')](_0xbd52('0x19'),_0x14b12d['message'],_0x526e48);_0x225764(_0x97a444['error'](0x1f4,_0x14b12d[_0xbd52('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 9d5983f..f26d149 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 _0xf6ca=['update','emit','removeListener','register','length','squareProject:','save'];(function(_0x1c3185,_0x5d64f6){var _0x244d08=function(_0x433fb8){while(--_0x433fb8){_0x1c3185['push'](_0x1c3185['shift']());}};_0x244d08(++_0x5d64f6);}(_0xf6ca,0x110));var _0xaf6c=function(_0x543656,_0xd5c4bb){_0x543656=_0x543656-0x0;var _0xb5e12b=_0xf6ca[_0x543656];return _0xb5e12b;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xaf6c('0x0'),'remove',_0xaf6c('0x1')];function createListener(_0x594041,_0x216459){return function(_0x54787b){_0x216459[_0xaf6c('0x2')](_0x594041,_0x54787b);};}function removeListener(_0x58be3f,_0x3c3a7f){return function(){SquareProjectEvents[_0xaf6c('0x3')](_0x58be3f,_0x3c3a7f);};}exports[_0xaf6c('0x4')]=function(_0x4d4bda){for(var _0x30d902=0x0,_0xe5a064=events[_0xaf6c('0x5')];_0x30d902<_0xe5a064;_0x30d902++){var _0x49c800=events[_0x30d902];var _0x5900ff=createListener(_0xaf6c('0x6')+_0x49c800,_0x4d4bda);SquareProjectEvents['on'](_0x49c800,_0x5900ff);}}; \ No newline at end of file +var _0xb5f4=['update','emit','removeListener','register','squareProject:','save'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb5f4,0xe9));var _0x4b5f=function(_0x553ca9,_0xf5b35f){_0x553ca9=_0x553ca9-0x0;var _0x289b05=_0xb5f4[_0x553ca9];return _0x289b05;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x4b5f('0x0'),'remove',_0x4b5f('0x1')];function createListener(_0x49ffa0,_0x4c102d){return function(_0x46a9d9){_0x4c102d[_0x4b5f('0x2')](_0x49ffa0,_0x46a9d9);};}function removeListener(_0x1b570b,_0x101f59){return function(){SquareProjectEvents[_0x4b5f('0x3')](_0x1b570b,_0x101f59);};}exports[_0x4b5f('0x4')]=function(_0x1d3b49){for(var _0x3fdc71=0x0,_0x146d18=events['length'];_0x3fdc71<_0x146d18;_0x3fdc71++){var _0x14ce37=events[_0x3fdc71];var _0x36d382=createListener(_0x4b5f('0x5')+_0x14ce37,_0x1d3b49);SquareProjectEvents['on'](_0x14ce37,_0x36d382);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index b7dc1e0..f80dda1 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(_0x1d1c7a,_0x2bd1e0){var _0x7bfb9=function(_0xa0c993){while(--_0xa0c993){_0x1d1c7a['push'](_0x1d1c7a['shift']());}};_0x7bfb9(++_0x2bd1e0);}(_0x4975,0x86));var _0x5497=function(_0x5be546,_0x591ad6){_0x5be546=_0x5be546-0x0;var _0x4aefb6=_0x4975[_0x5be546];return _0x4aefb6;};'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 _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x240aa3,_0x44e8c5){var _0x100f60=function(_0xa1fa09){while(--_0xa1fa09){_0x240aa3['push'](_0x240aa3['shift']());}};_0x100f60(++_0x44e8c5);}(_0xabce,0x103));var _0xeabc=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xabce[_0x363ef8];return _0x148822;};'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('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index e3c49a2..56320e5 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 _0x8d0e=['exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize'];(function(_0x2f55e8,_0x4e9ffe){var _0x299dd9=function(_0x3fae61){while(--_0x3fae61){_0x2f55e8['push'](_0x2f55e8['shift']());}};_0x299dd9(++_0x4e9ffe);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x754cda,_0x275dd4){_0x754cda=_0x754cda-0x0;var _0x37f5e6=_0x8d0e[_0x754cda];return _0x37f5e6;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'uniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'callerid':{'type':Sequelize[_0xe8d0('0x2')]},'calleridname':{'type':Sequelize[_0xe8d0('0x2')]},'context':{'type':Sequelize[_0xe8d0('0x2')]},'extension':{'type':Sequelize[_0xe8d0('0x2')]},'priority':{'type':Sequelize[_0xe8d0('0x2')]},'accountcode':{'type':Sequelize[_0xe8d0('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xe8d0('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xe8d0('0x2')]},'format':{'type':Sequelize[_0xe8d0('0x3')],'get':function(){var _0x469d37='';var _0xcc03d0=this[_0xe8d0('0x4')](_0xe8d0('0x5'));if(_0xcc03d0){_0x469d37=_0xcc03d0[_0xe8d0('0x6')](_0xcc03d0[_0xe8d0('0x7')]('.'));}return _0x469d37;}}}; \ No newline at end of file +var _0xda19=['getDataValue','exports','STRING','VIRTUAL'];(function(_0x3f7598,_0x212e37){var _0x51fb16=function(_0x4a5c0b){while(--_0x4a5c0b){_0x3f7598['push'](_0x3f7598['shift']());}};_0x51fb16(++_0x212e37);}(_0xda19,0xd5));var _0x9da1=function(_0xb4836,_0x3208ec){_0xb4836=_0xb4836-0x0;var _0x5bdb4f=_0xda19[_0xb4836];return _0x5bdb4f;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'uniqueid':{'type':Sequelize[_0x9da1('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9da1('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x9da1('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9da1('0x1')]},'dnid':{'type':Sequelize[_0x9da1('0x1')]},'projectName':{'type':Sequelize[_0x9da1('0x1')]},'saveName':{'type':Sequelize[_0x9da1('0x1')]},'filename':{'type':Sequelize[_0x9da1('0x1')]},'savePath':{'type':Sequelize[_0x9da1('0x1')]},'format':{'type':Sequelize[_0x9da1('0x2')],'get':function(){var _0x2c3cdd='';var _0x1c24e6=this[_0x9da1('0x3')]('savePath');if(_0x1c24e6){_0x2c3cdd=_0x1c24e6['substring'](_0x1c24e6['lastIndexOf']('.'));}return _0x2c3cdd;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index eb87aa0..1d0ef09 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 _0x59bc=['findAll','rows','catch','show','rawAttributes','include','create','body','find','params','download','uniqueid','savePath','filename','format','existsSync','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x59bc,0xdf));var _0xc59b=function(_0x55dd36,_0x31f1e2){_0x55dd36=_0x55dd36-0x0;var _0x4d3c5c=_0x59bc[_0x55dd36];return _0x4d3c5c;};'use strict';var emlformat=require(_0xc59b('0x0'));var rimraf=require(_0xc59b('0x1'));var zipdir=require(_0xc59b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc59b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc59b('0x4'));var util=require(_0xc59b('0x5'));var path=require('path');var sox=require(_0xc59b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc59b('0x7'));var squel=require(_0xc59b('0x8'));var crypto=require(_0xc59b('0x9'));var jsforce=require(_0xc59b('0xa'));var deskjs=require(_0xc59b('0xb'));var toCsv=require(_0xc59b('0xc'));var querystring=require(_0xc59b('0xd'));var Papa=require(_0xc59b('0xe'));var Redis=require(_0xc59b('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc59b('0x10'));var hardwareService=require(_0xc59b('0x11'));var logger=require(_0xc59b('0x12'))(_0xc59b('0x13'));var utils=require(_0xc59b('0x14'));var config=require(_0xc59b('0x15'));var licenseUtil=require(_0xc59b('0x16'));var db=require(_0xc59b('0x17'))['db'];function respondWithStatusCode(_0x418723,_0x103781){_0x103781=_0x103781||0xcc;return function(_0x3c70d4){if(_0x3c70d4){return _0x418723[_0xc59b('0x18')](_0x103781);}return _0x418723[_0xc59b('0x19')](_0x103781)[_0xc59b('0x1a')]();};}function respondWithResult(_0x9b3b4b,_0x19d8e5){_0x19d8e5=_0x19d8e5||0xc8;return function(_0x470c7c){if(_0x470c7c){return _0x9b3b4b[_0xc59b('0x19')](_0x19d8e5)['json'](_0x470c7c);}};}function respondWithFilteredResult(_0x36bb8c,_0x5c6b46){return function(_0x14234d){if(_0x14234d){var _0xbcd025=typeof _0x5c6b46[_0xc59b('0x1b')]===_0xc59b('0x1c')&&typeof _0x5c6b46[_0xc59b('0x1d')]==='undefined';var _0x4c73a4=_0x14234d['count'];var _0x4f47f9=_0xbcd025?0x0:_0x5c6b46['offset'];var _0x34794d=_0xbcd025?_0x14234d[_0xc59b('0x1e')]:_0x5c6b46['offset']+_0x5c6b46[_0xc59b('0x1d')];var _0x375cff;if(_0x34794d>=_0x4c73a4){_0x34794d=_0x4c73a4;_0x375cff=0xc8;}else{_0x375cff=0xce;}_0x36bb8c['status'](_0x375cff);return _0x36bb8c['set'](_0xc59b('0x1f'),_0x4f47f9+'-'+_0x34794d+'/'+_0x4c73a4)[_0xc59b('0x20')](_0x14234d);}return null;};}function patchUpdates(_0x20b2bc){return function(_0x527b74){try{jsonpatch[_0xc59b('0x21')](_0x527b74,_0x20b2bc,!![]);}catch(_0x413d4c){return BPromise[_0xc59b('0x22')](_0x413d4c);}return _0x527b74[_0xc59b('0x23')]();};}function saveUpdates(_0x33c271,_0x10106c){return function(_0x4812aa){if(_0x4812aa){return _0x4812aa[_0xc59b('0x24')](_0x33c271)[_0xc59b('0x25')](function(_0x5e6ce7){return _0x5e6ce7;});}return null;};}function removeEntity(_0x3a25a0,_0x4fdea3){return function(_0x254ab6){if(_0x254ab6){return _0x254ab6['destroy']()['then'](function(){_0x3a25a0[_0xc59b('0x19')](0xcc)[_0xc59b('0x1a')]();});}};}function handleEntityNotFound(_0x140d33,_0x515f00){return function(_0x38c4e3){if(!_0x38c4e3){_0x140d33[_0xc59b('0x18')](0x194);}return _0x38c4e3;};}function handleError(_0x1a6998,_0x2c2945){_0x2c2945=_0x2c2945||0x1f4;return function(_0x14ae5a){logger['error'](_0x14ae5a[_0xc59b('0x26')]);if(_0x14ae5a[_0xc59b('0x27')]){delete _0x14ae5a[_0xc59b('0x27')];}_0x1a6998[_0xc59b('0x19')](_0x2c2945)[_0xc59b('0x28')](_0x14ae5a);};}exports[_0xc59b('0x29')]=function(_0x54c9fa,_0x2cbf4f){var _0x3ef37e={},_0xbbc54a={},_0x575393={'count':0x0,'rows':[]};var _0x30ac8f=_['map'](db['SquareRecording']['rawAttributes'],function(_0x30bcdf){return{'name':_0x30bcdf[_0xc59b('0x2a')],'type':_0x30bcdf[_0xc59b('0x2b')][_0xc59b('0x2c')]};});_0xbbc54a[_0xc59b('0x2d')]=_[_0xc59b('0x2e')](_0x30ac8f,_0xc59b('0x27'));_0xbbc54a[_0xc59b('0x2f')]=_['keys'](_0x54c9fa['query']);_0xbbc54a[_0xc59b('0x30')]=_[_0xc59b('0x31')](_0xbbc54a[_0xc59b('0x2d')],_0xbbc54a[_0xc59b('0x2f')]);_0x3ef37e[_0xc59b('0x32')]=_['intersection'](_0xbbc54a['model'],qs[_0xc59b('0x33')](_0x54c9fa[_0xc59b('0x2f')][_0xc59b('0x33')]));_0x3ef37e['attributes']=_0x3ef37e[_0xc59b('0x32')][_0xc59b('0x34')]?_0x3ef37e['attributes']:_0xbbc54a[_0xc59b('0x2d')];if(!_0x54c9fa['query'][_0xc59b('0x35')](_0xc59b('0x36'))){_0x3ef37e[_0xc59b('0x1d')]=qs[_0xc59b('0x1d')](_0x54c9fa[_0xc59b('0x2f')][_0xc59b('0x1d')]);_0x3ef37e['offset']=qs[_0xc59b('0x1b')](_0x54c9fa[_0xc59b('0x2f')][_0xc59b('0x1b')]);}_0x3ef37e[_0xc59b('0x37')]=qs[_0xc59b('0x38')](_0x54c9fa[_0xc59b('0x2f')][_0xc59b('0x38')]);_0x3ef37e[_0xc59b('0x39')]=qs[_0xc59b('0x30')](_[_0xc59b('0x3a')](_0x54c9fa['query'],_0xbbc54a[_0xc59b('0x30')]),_0x30ac8f);if(_0x54c9fa[_0xc59b('0x2f')][_0xc59b('0x3b')]){_0x3ef37e[_0xc59b('0x39')]=_[_0xc59b('0x3c')](_0x3ef37e[_0xc59b('0x39')],{'$or':_[_0xc59b('0x2e')](_0x30ac8f,function(_0x19adb1){if(_0x19adb1['type']!==_0xc59b('0x3d')){var _0x394e33={};_0x394e33[_0x19adb1[_0xc59b('0x27')]]={'$like':'%'+_0x54c9fa[_0xc59b('0x2f')]['filter']+'%'};return _0x394e33;}})});}_0x3ef37e=_[_0xc59b('0x3c')]({},_0x3ef37e,_0x54c9fa[_0xc59b('0x3e')]);var _0xfbe23e={'where':_0x3ef37e['where']};return db[_0xc59b('0x3f')][_0xc59b('0x1e')](_0xfbe23e)[_0xc59b('0x25')](function(_0x583cd9){_0x575393['count']=_0x583cd9;if(_0x54c9fa['query'][_0xc59b('0x40')]){_0x3ef37e['include']=[{'all':!![]}];}return db[_0xc59b('0x3f')][_0xc59b('0x41')](_0x3ef37e);})[_0xc59b('0x25')](function(_0x568dfd){_0x575393[_0xc59b('0x42')]=_0x568dfd;return _0x575393;})[_0xc59b('0x25')](respondWithFilteredResult(_0x2cbf4f,_0x3ef37e))[_0xc59b('0x43')](handleError(_0x2cbf4f,null));};exports[_0xc59b('0x44')]=function(_0x1e99bb,_0x33e9bd){var _0x16fe06={'raw':!![],'where':{'id':_0x1e99bb['params']['id']}},_0x97e6f4={};_0x97e6f4[_0xc59b('0x2d')]=_['keys'](db['SquareRecording'][_0xc59b('0x45')]);_0x97e6f4['query']=_['keys'](_0x1e99bb['query']);_0x97e6f4[_0xc59b('0x30')]=_['intersection'](_0x97e6f4['model'],_0x97e6f4[_0xc59b('0x2f')]);_0x16fe06[_0xc59b('0x32')]=_[_0xc59b('0x31')](_0x97e6f4[_0xc59b('0x2d')],qs['fields'](_0x1e99bb[_0xc59b('0x2f')][_0xc59b('0x33')]));_0x16fe06[_0xc59b('0x32')]=_0x16fe06[_0xc59b('0x32')][_0xc59b('0x34')]?_0x16fe06['attributes']:_0x97e6f4['model'];if(_0x1e99bb[_0xc59b('0x2f')][_0xc59b('0x40')]){_0x16fe06[_0xc59b('0x46')]=[{'all':!![]}];}_0x16fe06=_[_0xc59b('0x3c')]({},_0x16fe06,_0x1e99bb['options']);return db[_0xc59b('0x3f')]['find'](_0x16fe06)['then'](handleEntityNotFound(_0x33e9bd,null))[_0xc59b('0x25')](respondWithResult(_0x33e9bd,null))[_0xc59b('0x43')](handleError(_0x33e9bd,null));};exports[_0xc59b('0x47')]=function(_0xb494,_0x251257){return db[_0xc59b('0x3f')][_0xc59b('0x47')](_0xb494[_0xc59b('0x48')],{})[_0xc59b('0x25')](respondWithResult(_0x251257,0xc9))[_0xc59b('0x43')](handleError(_0x251257,null));};exports['update']=function(_0x201c67,_0x278546){if(_0x201c67['body']['id']){delete _0x201c67[_0xc59b('0x48')]['id'];}return db[_0xc59b('0x3f')][_0xc59b('0x49')]({'where':{'id':_0x201c67[_0xc59b('0x4a')]['id']}})[_0xc59b('0x25')](handleEntityNotFound(_0x278546,null))[_0xc59b('0x25')](saveUpdates(_0x201c67[_0xc59b('0x48')],null))[_0xc59b('0x25')](respondWithResult(_0x278546,null))[_0xc59b('0x43')](handleError(_0x278546,null));};exports[_0xc59b('0x4b')]=function(_0x492000,_0x3e8fca,_0x2e9bcb){var _0x3e1f16=require('../../components/encryptor');var _0x7a1c3e=![];var _0x26f8b6={};if(_0x492000[_0xc59b('0x2f')][_0xc59b('0x2b')]&&_0x492000[_0xc59b('0x2f')][_0xc59b('0x2b')]===_0xc59b('0x4c')){_0x26f8b6['uniqueid']=_0x492000['params']['id'];}else{_0x26f8b6['id']=_0x492000[_0xc59b('0x4a')]['id'];}return db['SquareRecording'][_0xc59b('0x49')]({'where':_0x26f8b6,'attributes':['id',_0xc59b('0x4d'),_0xc59b('0x4e')],'raw':!![]})[_0xc59b('0x25')](handleEntityNotFound(_0x3e8fca,null))[_0xc59b('0x25')](function(_0x3a5e34){if(_0x3a5e34){var _0x3088cc=_0x3a5e34['savePath'];var _0x429420=util[_0xc59b('0x4f')]('%s.cypher',_0x3088cc);if(fs[_0xc59b('0x50')](_0x429420)){_0x7a1c3e=!![];return _0x3e1f16['decryptFile'](_0x429420,_0x3088cc,config['secrets'][_0xc59b('0x51')])[_0xc59b('0x25')](function(){return _0x3a5e34;});}return _0x3a5e34;}})[_0xc59b('0x25')](function(_0x52ed70){if(_0x52ed70){var _0x59028b=_0x52ed70[_0xc59b('0x4d')];if(!fs[_0xc59b('0x50')](_0x59028b)){throw new db[(_0xc59b('0x52'))][(_0xc59b('0x53'))](_0xc59b('0x54'));}if(_0x52ed70[_0xc59b('0x4e')]){return _0x3e8fca[_0xc59b('0x4b')](_0x59028b,_0x52ed70[_0xc59b('0x4e')]+path[_0xc59b('0x55')](_0x59028b),function(){if(_0x7a1c3e){fs['unlink'](_0x59028b);}});}else{return _0x3e8fca[_0xc59b('0x4b')](_0x59028b,function(_0x5e1ffa){if(_0x7a1c3e){fs[_0xc59b('0x56')](_0x59028b);}});}}})[_0xc59b('0x43')](function(_0x2cae1d){if(_0x2cae1d[_0xc59b('0x57')]===_0xc59b('0x54')){_0x3e8fca[_0xc59b('0x19')](0x194)[_0xc59b('0x28')](_0xc59b('0x58'));}else{return handleError(_0x3e8fca,null);}});};exports[_0xc59b('0x59')]=function(_0x34d9de,_0x4bbf0a){return db[_0xc59b('0x3f')][_0xc59b('0x49')]({'where':{'id':_0x34d9de[_0xc59b('0x4a')]['id']}})[_0xc59b('0x25')](function(_0x21f512){if(_[_0xc59b('0x5a')](_0x21f512)){throw new ReferenceError(_0xc59b('0x5b'));}return _0x21f512;})[_0xc59b('0x25')](function(_0x195a21){var _0xc018b7=_0x195a21[_0xc59b('0x4d')];logger[_0xc59b('0x5c')]('cancellazione\x20fisica\x20documento\x20%s',_0xc018b7);if(!_['isNil'](_0x195a21['savePath'])&&fs[_0xc59b('0x50')](_0xc018b7)){logger[_0xc59b('0x5c')](_0xc59b('0x5d')+_0xc018b7+_0xc59b('0x5e'));fs[_0xc59b('0x5f')](_0xc018b7);}_0xc018b7=_0xc018b7+'.cypher';if(!_[_0xc59b('0x5a')](_0x195a21[_0xc59b('0x4d')])&&fs[_0xc59b('0x50')](_0xc018b7)){logger['info'](_0xc59b('0x5d')+_0xc018b7+_0xc59b('0x5e'));fs[_0xc59b('0x5f')](_0xc018b7);}return _0x195a21;})[_0xc59b('0x25')](function(_0x4672de){if(!_0x4672de)throw new InternalError();return _0x4672de[_0xc59b('0x59')]();})[_0xc59b('0x25')](function(){_0x4bbf0a[_0xc59b('0x19')](0xcc)[_0xc59b('0x1a')]();})[_0xc59b('0x43')](handleError(_0x4bbf0a,null));}; \ No newline at end of file +var _0x0322=['unlink','message','SquareRecording\x20not\x20found','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','moment','util','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','SquareRecording','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','create','update','body','../../components/encryptor','uniqueid','savePath','format','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','download','filename','extname'];(function(_0x16ea64,_0x279b55){var _0x10d4ce=function(_0x2cd80b){while(--_0x2cd80b){_0x16ea64['push'](_0x16ea64['shift']());}};_0x10d4ce(++_0x279b55);}(_0x0322,0xcb));var _0x2032=function(_0xea2757,_0x394521){_0xea2757=_0xea2757-0x0;var _0x3ed656=_0x0322[_0xea2757];return _0x3ed656;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2032('0x0'));var zipdir=require(_0x2032('0x1'));var jsonpatch=require(_0x2032('0x2'));var rp=require('request-promise');var moment=require(_0x2032('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2032('0x4'));var path=require('path');var sox=require(_0x2032('0x5'));var csv=require('to-csv');var ejs=require(_0x2032('0x6'));var fs=require('fs');var fs_extra=require(_0x2032('0x7'));var _=require(_0x2032('0x8'));var squel=require('squel');var crypto=require(_0x2032('0x9'));var jsforce=require(_0x2032('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2032('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2032('0xc'));var authService=require(_0x2032('0xd'));var qs=require(_0x2032('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2032('0xf'));var logger=require(_0x2032('0x10'))('api');var utils=require(_0x2032('0x11'));var config=require(_0x2032('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7e7fc2,_0x2ec053){_0x2ec053=_0x2ec053||0xcc;return function(_0x2d2972){if(_0x2d2972){return _0x7e7fc2[_0x2032('0x13')](_0x2ec053);}return _0x7e7fc2[_0x2032('0x14')](_0x2ec053)[_0x2032('0x15')]();};}function respondWithResult(_0x18c9c4,_0x10eadf){_0x10eadf=_0x10eadf||0xc8;return function(_0x29735e){if(_0x29735e){return _0x18c9c4[_0x2032('0x14')](_0x10eadf)[_0x2032('0x16')](_0x29735e);}};}function respondWithFilteredResult(_0x2463c4,_0x57d348){return function(_0x3c7c5a){if(_0x3c7c5a){var _0xa343ab=typeof _0x57d348[_0x2032('0x17')]===_0x2032('0x18')&&typeof _0x57d348['limit']==='undefined';var _0x556e2b=_0x3c7c5a['count'];var _0x527f91=_0xa343ab?0x0:_0x57d348['offset'];var _0x3d14a4=_0xa343ab?_0x3c7c5a['count']:_0x57d348[_0x2032('0x17')]+_0x57d348[_0x2032('0x19')];var _0x1fc809;if(_0x3d14a4>=_0x556e2b){_0x3d14a4=_0x556e2b;_0x1fc809=0xc8;}else{_0x1fc809=0xce;}_0x2463c4[_0x2032('0x14')](_0x1fc809);return _0x2463c4[_0x2032('0x1a')](_0x2032('0x1b'),_0x527f91+'-'+_0x3d14a4+'/'+_0x556e2b)['json'](_0x3c7c5a);}return null;};}function patchUpdates(_0x35926a){return function(_0x25359f){try{jsonpatch[_0x2032('0x1c')](_0x25359f,_0x35926a,!![]);}catch(_0x478784){return BPromise[_0x2032('0x1d')](_0x478784);}return _0x25359f[_0x2032('0x1e')]();};}function saveUpdates(_0x4b4863,_0x434307){return function(_0x3b0544){if(_0x3b0544){return _0x3b0544['update'](_0x4b4863)[_0x2032('0x1f')](function(_0x46c811){return _0x46c811;});}return null;};}function removeEntity(_0x5d0f7d,_0x5812e2){return function(_0x3918e1){if(_0x3918e1){return _0x3918e1[_0x2032('0x20')]()[_0x2032('0x1f')](function(){_0x5d0f7d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24de6e,_0xa6de76){return function(_0x21ce16){if(!_0x21ce16){_0x24de6e[_0x2032('0x13')](0x194);}return _0x21ce16;};}function handleError(_0x2425bd,_0x571771){_0x571771=_0x571771||0x1f4;return function(_0x32b39b){logger[_0x2032('0x21')](_0x32b39b[_0x2032('0x22')]);if(_0x32b39b[_0x2032('0x23')]){delete _0x32b39b['name'];}_0x2425bd[_0x2032('0x14')](_0x571771)[_0x2032('0x24')](_0x32b39b);};}exports[_0x2032('0x25')]=function(_0x29f860,_0x115e43){var _0x5b49b8={},_0x149c4c={},_0x150442={'count':0x0,'rows':[]};var _0x95a5d7=_['map'](db[_0x2032('0x26')][_0x2032('0x27')],function(_0x620d64){return{'name':_0x620d64[_0x2032('0x28')],'type':_0x620d64['type'][_0x2032('0x29')]};});_0x149c4c[_0x2032('0x2a')]=_[_0x2032('0x2b')](_0x95a5d7,_0x2032('0x23'));_0x149c4c[_0x2032('0x2c')]=_[_0x2032('0x2d')](_0x29f860[_0x2032('0x2c')]);_0x149c4c['filters']=_[_0x2032('0x2e')](_0x149c4c[_0x2032('0x2a')],_0x149c4c['query']);_0x5b49b8['attributes']=_[_0x2032('0x2e')](_0x149c4c[_0x2032('0x2a')],qs['fields'](_0x29f860[_0x2032('0x2c')][_0x2032('0x2f')]));_0x5b49b8[_0x2032('0x30')]=_0x5b49b8[_0x2032('0x30')][_0x2032('0x31')]?_0x5b49b8[_0x2032('0x30')]:_0x149c4c[_0x2032('0x2a')];if(!_0x29f860[_0x2032('0x2c')][_0x2032('0x32')](_0x2032('0x33'))){_0x5b49b8[_0x2032('0x19')]=qs['limit'](_0x29f860['query'][_0x2032('0x19')]);_0x5b49b8[_0x2032('0x17')]=qs[_0x2032('0x17')](_0x29f860[_0x2032('0x2c')]['offset']);}_0x5b49b8[_0x2032('0x34')]=qs[_0x2032('0x35')](_0x29f860[_0x2032('0x2c')][_0x2032('0x35')]);_0x5b49b8[_0x2032('0x36')]=qs[_0x2032('0x37')](_['pick'](_0x29f860['query'],_0x149c4c[_0x2032('0x37')]),_0x95a5d7);if(_0x29f860[_0x2032('0x2c')][_0x2032('0x38')]){_0x5b49b8[_0x2032('0x36')]=_[_0x2032('0x39')](_0x5b49b8[_0x2032('0x36')],{'$or':_[_0x2032('0x2b')](_0x95a5d7,function(_0x2cb967){if(_0x2cb967[_0x2032('0x3a')]!==_0x2032('0x3b')){var _0xa13e13={};_0xa13e13[_0x2cb967[_0x2032('0x23')]]={'$like':'%'+_0x29f860[_0x2032('0x2c')]['filter']+'%'};return _0xa13e13;}})});}_0x5b49b8=_[_0x2032('0x39')]({},_0x5b49b8,_0x29f860[_0x2032('0x3c')]);var _0x364d07={'where':_0x5b49b8[_0x2032('0x36')]};return db[_0x2032('0x26')][_0x2032('0x3d')](_0x364d07)[_0x2032('0x1f')](function(_0x3e3a37){_0x150442['count']=_0x3e3a37;if(_0x29f860[_0x2032('0x2c')][_0x2032('0x3e')]){_0x5b49b8[_0x2032('0x3f')]=[{'all':!![]}];}return db['SquareRecording'][_0x2032('0x40')](_0x5b49b8);})[_0x2032('0x1f')](function(_0x29cd2a){_0x150442['rows']=_0x29cd2a;return _0x150442;})[_0x2032('0x1f')](respondWithFilteredResult(_0x115e43,_0x5b49b8))[_0x2032('0x41')](handleError(_0x115e43,null));};exports[_0x2032('0x42')]=function(_0x2171a6,_0x142e8a){var _0x2c4700={'raw':!![],'where':{'id':_0x2171a6[_0x2032('0x43')]['id']}},_0x18365f={};_0x18365f[_0x2032('0x2a')]=_['keys'](db[_0x2032('0x26')][_0x2032('0x27')]);_0x18365f[_0x2032('0x2c')]=_[_0x2032('0x2d')](_0x2171a6[_0x2032('0x2c')]);_0x18365f[_0x2032('0x37')]=_[_0x2032('0x2e')](_0x18365f[_0x2032('0x2a')],_0x18365f['query']);_0x2c4700['attributes']=_[_0x2032('0x2e')](_0x18365f[_0x2032('0x2a')],qs[_0x2032('0x2f')](_0x2171a6[_0x2032('0x2c')][_0x2032('0x2f')]));_0x2c4700['attributes']=_0x2c4700[_0x2032('0x30')]['length']?_0x2c4700[_0x2032('0x30')]:_0x18365f[_0x2032('0x2a')];if(_0x2171a6[_0x2032('0x2c')][_0x2032('0x3e')]){_0x2c4700[_0x2032('0x3f')]=[{'all':!![]}];}_0x2c4700=_[_0x2032('0x39')]({},_0x2c4700,_0x2171a6[_0x2032('0x3c')]);return db['SquareRecording'][_0x2032('0x44')](_0x2c4700)[_0x2032('0x1f')](handleEntityNotFound(_0x142e8a,null))[_0x2032('0x1f')](respondWithResult(_0x142e8a,null))[_0x2032('0x41')](handleError(_0x142e8a,null));};exports[_0x2032('0x45')]=function(_0x216542,_0x13270f){return db['SquareRecording'][_0x2032('0x45')](_0x216542['body'],{})[_0x2032('0x1f')](respondWithResult(_0x13270f,0xc9))['catch'](handleError(_0x13270f,null));};exports[_0x2032('0x46')]=function(_0x175a5f,_0x2e1c5c){if(_0x175a5f[_0x2032('0x47')]['id']){delete _0x175a5f[_0x2032('0x47')]['id'];}return db[_0x2032('0x26')]['find']({'where':{'id':_0x175a5f['params']['id']}})[_0x2032('0x1f')](handleEntityNotFound(_0x2e1c5c,null))[_0x2032('0x1f')](saveUpdates(_0x175a5f['body'],null))['then'](respondWithResult(_0x2e1c5c,null))['catch'](handleError(_0x2e1c5c,null));};exports['download']=function(_0x4c4c9d,_0x4bcfe1,_0xa3c864){var _0x433766=require(_0x2032('0x48'));var _0x257091=![];var _0x194f22={};if(_0x4c4c9d[_0x2032('0x2c')][_0x2032('0x3a')]&&_0x4c4c9d['query'][_0x2032('0x3a')]===_0x2032('0x49')){_0x194f22[_0x2032('0x49')]=_0x4c4c9d[_0x2032('0x43')]['id'];}else{_0x194f22['id']=_0x4c4c9d[_0x2032('0x43')]['id'];}return db[_0x2032('0x26')][_0x2032('0x44')]({'where':_0x194f22,'attributes':['id',_0x2032('0x4a'),'filename'],'raw':!![]})[_0x2032('0x1f')](handleEntityNotFound(_0x4bcfe1,null))['then'](function(_0x2afe71){if(_0x2afe71){var _0x4a8918=_0x2afe71[_0x2032('0x4a')];var _0x371b08=util[_0x2032('0x4b')]('%s.cypher',_0x4a8918);if(fs[_0x2032('0x4c')](_0x371b08)){_0x257091=!![];return _0x433766[_0x2032('0x4d')](_0x371b08,_0x4a8918,config[_0x2032('0x4e')][_0x2032('0x4f')])['then'](function(){return _0x2afe71;});}return _0x2afe71;}})[_0x2032('0x1f')](function(_0x2025ed){if(_0x2025ed){var _0x3b68bc=_0x2025ed['savePath'];if(!fs['existsSync'](_0x3b68bc)){throw new db[(_0x2032('0x50'))][(_0x2032('0x51'))]('SquareRecording\x20not\x20found');}if(_0x2025ed['filename']){return _0x4bcfe1[_0x2032('0x52')](_0x3b68bc,_0x2025ed[_0x2032('0x53')]+path[_0x2032('0x54')](_0x3b68bc),function(){if(_0x257091){fs['unlink'](_0x3b68bc);}});}else{return _0x4bcfe1[_0x2032('0x52')](_0x3b68bc,function(_0x227488){if(_0x257091){fs[_0x2032('0x55')](_0x3b68bc);}});}}})['catch'](function(_0x3e379d){if(_0x3e379d[_0x2032('0x56')]===_0x2032('0x57')){_0x4bcfe1[_0x2032('0x14')](0x194)[_0x2032('0x24')](_0x2032('0x58'));}else{return handleError(_0x4bcfe1,null);}});};exports[_0x2032('0x20')]=function(_0x2f157b,_0x81a77c){return db[_0x2032('0x26')][_0x2032('0x44')]({'where':{'id':_0x2f157b['params']['id']}})[_0x2032('0x1f')](function(_0x3e2ebf){if(_['isNil'](_0x3e2ebf)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3e2ebf;})[_0x2032('0x1f')](function(_0x51e991){var _0x58df3d=_0x51e991[_0x2032('0x4a')];logger[_0x2032('0x59')](_0x2032('0x5a'),_0x58df3d);if(!_[_0x2032('0x5b')](_0x51e991[_0x2032('0x4a')])&&fs[_0x2032('0x4c')](_0x58df3d)){logger[_0x2032('0x59')](_0x2032('0x5c')+_0x58df3d+_0x2032('0x5d'));fs[_0x2032('0x5e')](_0x58df3d);}_0x58df3d=_0x58df3d+_0x2032('0x5f');if(!_[_0x2032('0x5b')](_0x51e991[_0x2032('0x4a')])&&fs[_0x2032('0x4c')](_0x58df3d)){logger[_0x2032('0x59')](_0x2032('0x5c')+_0x58df3d+_0x2032('0x5d'));fs[_0x2032('0x5e')](_0x58df3d);}return _0x51e991;})['then'](function(_0x9b4be7){if(!_0x9b4be7)throw new InternalError();return _0x9b4be7['destroy']();})[_0x2032('0x1f')](function(){_0x81a77c[_0x2032('0x14')](0xcc)[_0x2032('0x15')]();})['catch'](handleError(_0x81a77c,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 43d8baf..33fdae7 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 _0xe1c4=['SquareRecording','square_recordings','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','define'];(function(_0x5cb6df,_0x10b143){var _0x4565ba=function(_0x325540){while(--_0x325540){_0x5cb6df['push'](_0x5cb6df['shift']());}};_0x4565ba(++_0x10b143);}(_0xe1c4,0x1ec));var _0x4e1c=function(_0x14510c,_0x3f66f0){_0x14510c=_0x14510c-0x0;var _0x31c5f8=_0xe1c4[_0x14510c];return _0x31c5f8;};'use strict';var _=require(_0x4e1c('0x0'));var util=require(_0x4e1c('0x1'));var logger=require(_0x4e1c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4e1c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e1c('0x4'));var rimraf=require(_0x4e1c('0x5'));var config=require(_0x4e1c('0x6'));var attributes=require('./squareRecording.attributes');module['exports']=function(_0x7af82a,_0x119617){return _0x7af82a[_0x4e1c('0x7')](_0x4e1c('0x8'),attributes,{'tableName':_0x4e1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6132=['SquareRecording','square_recordings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./squareRecording.attributes','define'];(function(_0x53aecd,_0x3d159f){var _0x13992c=function(_0x17ebc5){while(--_0x17ebc5){_0x53aecd['push'](_0x53aecd['shift']());}};_0x13992c(++_0x3d159f);}(_0x6132,0x13a));var _0x2613=function(_0x232aea,_0x20cbbe){_0x232aea=_0x232aea-0x0;var _0x46cf31=_0x6132[_0x232aea];return _0x46cf31;};'use strict';var _=require(_0x2613('0x0'));var util=require(_0x2613('0x1'));var logger=require(_0x2613('0x2'))(_0x2613('0x3'));var moment=require('moment');var BPromise=require(_0x2613('0x4'));var rp=require(_0x2613('0x5'));var fs=require('fs');var path=require(_0x2613('0x6'));var rimraf=require(_0x2613('0x7'));var config=require('../../config/environment');var attributes=require(_0x2613('0x8'));module['exports']=function(_0x59240d,_0x30cac4){return _0x59240d[_0x2613('0x9')](_0x2613('0xa'),attributes,{'tableName':_0x2613('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index c6fee15..b4382b1 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 _0x76c4=['../../config/environment','jayson/promise','http','request','info','SquareRecording,\x20%s,\x20%s','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateSquareRecording','SquareRecording','create','body','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4b7440,_0x8e753b){var _0x238342=function(_0x6733bc){while(--_0x6733bc){_0x4b7440['push'](_0x4b7440['shift']());}};_0x238342(++_0x8e753b);}(_0x76c4,0x147));var _0x476c=function(_0x277bd3,_0x3136e5){_0x277bd3=_0x277bd3-0x0;var _0x6f0954=_0x76c4[_0x277bd3];return _0x6f0954;};'use strict';var _=require(_0x476c('0x0'));var util=require(_0x476c('0x1'));var moment=require(_0x476c('0x2'));var BPromise=require(_0x476c('0x3'));var rs=require(_0x476c('0x4'));var fs=require('fs');var Redis=require(_0x476c('0x5'));var db=require(_0x476c('0x6'))['db'];var utils=require(_0x476c('0x7'));var logger=require(_0x476c('0x8'))('rpc');var config=require(_0x476c('0x9'));var jayson=require(_0x476c('0xa'));var client=jayson['client'][_0x476c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33ce5d,_0x5644b7,_0x23a07f){return new BPromise(function(_0x253720,_0x5e1f00){return client[_0x476c('0xc')](_0x33ce5d,_0x23a07f)['then'](function(_0x35c5f8){logger[_0x476c('0xd')](_0x476c('0xe'),_0x5644b7,'request\x20sent');logger['debug'](_0x476c('0xf'),_0x5644b7,'request\x20sent',JSON[_0x476c('0x10')](_0x35c5f8));if(_0x35c5f8[_0x476c('0x11')]){if(_0x35c5f8[_0x476c('0x11')][_0x476c('0x12')]===0x1f4){logger['error'](_0x476c('0xe'),_0x5644b7,_0x35c5f8[_0x476c('0x11')][_0x476c('0x13')]);return _0x5e1f00(_0x35c5f8[_0x476c('0x11')]['message']);}logger[_0x476c('0x11')](_0x476c('0xe'),_0x5644b7,_0x35c5f8[_0x476c('0x11')][_0x476c('0x13')]);return _0x253720(_0x35c5f8[_0x476c('0x11')][_0x476c('0x13')]);}else{logger[_0x476c('0xd')](_0x476c('0xe'),_0x5644b7,_0x476c('0x14'));_0x253720(_0x35c5f8[_0x476c('0x15')][_0x476c('0x13')]);}})[_0x476c('0x16')](function(_0x4ea509){logger[_0x476c('0x11')]('SquareRecording,\x20%s,\x20%s',_0x5644b7,_0x4ea509);_0x5e1f00(_0x4ea509);});});}exports[_0x476c('0x17')]=function(_0x19bc62){var _0x11279e=this;return new Promise(function(_0x7f92b7,_0x1fff3c){return db[_0x476c('0x18')][_0x476c('0x19')](_0x19bc62[_0x476c('0x1a')],{'raw':_0x19bc62['options']?_0x19bc62['options'][_0x476c('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4de135){logger[_0x476c('0xd')](_0x476c('0x17'),_0x19bc62);logger['debug'](_0x476c('0x17'),_0x19bc62,JSON[_0x476c('0x10')](_0x4de135));_0x7f92b7(_0x4de135);})[_0x476c('0x16')](function(_0x44c307){logger[_0x476c('0x11')](_0x476c('0x17'),_0x44c307['message'],_0x19bc62);_0x1fff3c(_0x11279e[_0x476c('0x11')](0x1f4,_0x44c307[_0x476c('0x13')]));});});}; \ No newline at end of file +var _0xec3b=['raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','body','options'];(function(_0x685346,_0x3ef2e5){var _0x52e15b=function(_0x4435da){while(--_0x4435da){_0x685346['push'](_0x685346['shift']());}};_0x52e15b(++_0x3ef2e5);}(_0xec3b,0x12d));var _0xbec3=function(_0x5c8c8,_0x4e464b){_0x5c8c8=_0x5c8c8-0x0;var _0x59d058=_0xec3b[_0x5c8c8];return _0x59d058;};'use strict';var _=require(_0xbec3('0x0'));var util=require(_0xbec3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbec3('0x2'));var fs=require('fs');var Redis=require(_0xbec3('0x3'));var db=require(_0xbec3('0x4'))['db'];var utils=require(_0xbec3('0x5'));var logger=require('../../config/logger')(_0xbec3('0x6'));var config=require('../../config/environment');var jayson=require(_0xbec3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x541145,_0x5804cd,_0x4aae36){return new BPromise(function(_0x57fcbb,_0x240a89){return client[_0xbec3('0x8')](_0x541145,_0x4aae36)[_0xbec3('0x9')](function(_0x51e90d){logger[_0xbec3('0xa')](_0xbec3('0xb'),_0x5804cd,_0xbec3('0xc'));logger['debug'](_0xbec3('0xd'),_0x5804cd,_0xbec3('0xc'),JSON[_0xbec3('0xe')](_0x51e90d));if(_0x51e90d[_0xbec3('0xf')]){if(_0x51e90d[_0xbec3('0xf')][_0xbec3('0x10')]===0x1f4){logger[_0xbec3('0xf')](_0xbec3('0xb'),_0x5804cd,_0x51e90d[_0xbec3('0xf')][_0xbec3('0x11')]);return _0x240a89(_0x51e90d[_0xbec3('0xf')][_0xbec3('0x11')]);}logger[_0xbec3('0xf')]('SquareRecording,\x20%s,\x20%s',_0x5804cd,_0x51e90d[_0xbec3('0xf')]['message']);return _0x57fcbb(_0x51e90d[_0xbec3('0xf')][_0xbec3('0x11')]);}else{logger[_0xbec3('0xa')](_0xbec3('0xb'),_0x5804cd,_0xbec3('0xc'));_0x57fcbb(_0x51e90d[_0xbec3('0x12')][_0xbec3('0x11')]);}})[_0xbec3('0x13')](function(_0xedb20d){logger[_0xbec3('0xf')](_0xbec3('0xb'),_0x5804cd,_0xedb20d);_0x240a89(_0xedb20d);});});}exports[_0xbec3('0x14')]=function(_0x1a2fb8){var _0x136654=this;return new Promise(function(_0x2cb4e4,_0x251c7c){return db[_0xbec3('0x15')]['create'](_0x1a2fb8[_0xbec3('0x16')],{'raw':_0x1a2fb8[_0xbec3('0x17')]?_0x1a2fb8['options'][_0xbec3('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x37b860){logger[_0xbec3('0xa')](_0xbec3('0x14'),_0x1a2fb8);logger['debug'](_0xbec3('0x14'),_0x1a2fb8,JSON[_0xbec3('0xe')](_0x37b860));_0x2cb4e4(_0x37b860);})[_0xbec3('0x13')](function(_0x1a0eb2){logger[_0xbec3('0xf')](_0xbec3('0x14'),_0x1a0eb2[_0xbec3('0x11')],_0x1a2fb8);_0x251c7c(_0x136654[_0xbec3('0xf')](0x1f4,_0x1a0eb2[_0xbec3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index f74b783..ff51238 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x507410,_0x359cd2){var _0x549493=function(_0x39857b){while(--_0x39857b){_0x507410['push'](_0x507410['shift']());}};_0x549493(++_0x359cd2);}(_0xe706,0xa3));var _0x6e70=function(_0x28104d,_0x1ddce1){_0x28104d=_0x28104d-0x0;var _0xca609b=_0xe706[_0x28104d];return _0xca609b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x121a7b,_0x4b3510){var _0x385b07=function(_0x47f7cf){while(--_0x47f7cf){_0x121a7b['push'](_0x121a7b['shift']());}};_0x385b07(++_0x4b3510);}(_0xb10b,0x12a));var _0xbb10=function(_0x241b4b,_0x206d5a){_0x241b4b=_0x241b4b-0x0;var _0x2220d0=_0xb10b[_0x241b4b];return _0x2220d0;};'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/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 7db7100..cc205fc 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 _0xa34e=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x1bbae0,_0x3dbe2f){var _0x2630e4=function(_0x27d56b){while(--_0x27d56b){_0x1bbae0['push'](_0x1bbae0['shift']());}};_0x2630e4(++_0x3dbe2f);}(_0xa34e,0xf6));var _0xea34=function(_0x4f27f8,_0x3ce31f){_0x4f27f8=_0x4f27f8-0x0;var _0x2d469b=_0xa34e[_0x4f27f8];return _0x2d469b;};'use strict';var Sequelize=require(_0xea34('0x0'));module[_0xea34('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xea34('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xea34('0x2')]},'language':{'type':Sequelize[_0xea34('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xea34('0x2')]},'callerid':{'type':Sequelize[_0xea34('0x2')]},'calleridname':{'type':Sequelize[_0xea34('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xea34('0x2')]},'callingtns':{'type':Sequelize[_0xea34('0x2')]},'dnid':{'type':Sequelize[_0xea34('0x2')]},'rdnis':{'type':Sequelize[_0xea34('0x2')]},'context':{'type':Sequelize[_0xea34('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xea34('0x2')]},'enhanced':{'type':Sequelize[_0xea34('0x2')]},'accountcode':{'type':Sequelize[_0xea34('0x2')]},'threadid':{'type':Sequelize[_0xea34('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xea34('0x3')]},'leaveAt':{'type':Sequelize[_0xea34('0x3')]},'bot':{'type':Sequelize[_0xea34('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x4964=['exports','STRING','DATE'];(function(_0x6c5ba6,_0x15e897){var _0x39c8fa=function(_0x202f61){while(--_0x202f61){_0x6c5ba6['push'](_0x6c5ba6['shift']());}};_0x39c8fa(++_0x15e897);}(_0x4964,0x8a));var _0x4496=function(_0x2737ad,_0x4dede6){_0x2737ad=_0x2737ad-0x0;var _0x11a8e5=_0x4964[_0x2737ad];return _0x11a8e5;};'use strict';var Sequelize=require('sequelize');module[_0x4496('0x0')]={'network':{'type':Sequelize[_0x4496('0x1')]},'network_script':{'type':Sequelize[_0x4496('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4496('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x4496('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4496('0x1')]},'callingpres':{'type':Sequelize[_0x4496('0x1')]},'callingani2':{'type':Sequelize[_0x4496('0x1')]},'callington':{'type':Sequelize[_0x4496('0x1')]},'callingtns':{'type':Sequelize[_0x4496('0x1')]},'dnid':{'type':Sequelize[_0x4496('0x1')]},'rdnis':{'type':Sequelize[_0x4496('0x1')]},'context':{'type':Sequelize[_0x4496('0x1')]},'extension':{'type':Sequelize[_0x4496('0x1')]},'priority':{'type':Sequelize[_0x4496('0x1')]},'enhanced':{'type':Sequelize[_0x4496('0x1')]},'accountcode':{'type':Sequelize[_0x4496('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x4496('0x1')]},'joinAt':{'type':Sequelize[_0x4496('0x2')]},'leaveAt':{'type':Sequelize[_0x4496('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 5a73a18..0d2732b 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 _0xdb0b=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','include','SquareReport','rows','catch','includeAll','find','create','body','update','params','describe','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x161ac3,_0x142e49){var _0x3bb837=function(_0x269c7c){while(--_0x269c7c){_0x161ac3['push'](_0x161ac3['shift']());}};_0x3bb837(++_0x142e49);}(_0xdb0b,0x10d));var _0xbdb0=function(_0x3b4009,_0x2a21b9){_0x3b4009=_0x3b4009-0x0;var _0x22ed56=_0xdb0b[_0x3b4009];return _0x22ed56;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbdb0('0x0'));var jsonpatch=require(_0xbdb0('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbdb0('0x2'));var Mustache=require(_0xbdb0('0x3'));var util=require(_0xbdb0('0x4'));var path=require('path');var sox=require(_0xbdb0('0x5'));var csv=require(_0xbdb0('0x6'));var ejs=require(_0xbdb0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbdb0('0x8'));var squel=require(_0xbdb0('0x9'));var crypto=require('crypto');var jsforce=require(_0xbdb0('0xa'));var deskjs=require(_0xbdb0('0xb'));var toCsv=require(_0xbdb0('0x6'));var querystring=require(_0xbdb0('0xc'));var Papa=require(_0xbdb0('0xd'));var Redis=require('ioredis');var authService=require(_0xbdb0('0xe'));var qs=require(_0xbdb0('0xf'));var as=require(_0xbdb0('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbdb0('0x11'));var utils=require(_0xbdb0('0x12'));var config=require(_0xbdb0('0x13'));var licenseUtil=require(_0xbdb0('0x14'));var db=require(_0xbdb0('0x15'))['db'];function respondWithStatusCode(_0xdffdd9,_0x222684){_0x222684=_0x222684||0xcc;return function(_0x164918){if(_0x164918){return _0xdffdd9[_0xbdb0('0x16')](_0x222684);}return _0xdffdd9['status'](_0x222684)[_0xbdb0('0x17')]();};}function respondWithResult(_0x21f65e,_0x36abdf){_0x36abdf=_0x36abdf||0xc8;return function(_0x1a6ed4){if(_0x1a6ed4){return _0x21f65e['status'](_0x36abdf)[_0xbdb0('0x18')](_0x1a6ed4);}};}function respondWithFilteredResult(_0x4f8e5b,_0x31632b){return function(_0x3588c2){if(_0x3588c2){var _0x479948=typeof _0x31632b[_0xbdb0('0x19')]===_0xbdb0('0x1a')&&typeof _0x31632b['limit']===_0xbdb0('0x1a');var _0x3a063e=_0x3588c2[_0xbdb0('0x1b')];var _0x921a35=_0x479948?0x0:_0x31632b['offset'];var _0x43a2b3=_0x479948?_0x3588c2[_0xbdb0('0x1b')]:_0x31632b[_0xbdb0('0x19')]+_0x31632b[_0xbdb0('0x1c')];var _0x529565;if(_0x43a2b3>=_0x3a063e){_0x43a2b3=_0x3a063e;_0x529565=0xc8;}else{_0x529565=0xce;}_0x4f8e5b[_0xbdb0('0x1d')](_0x529565);return _0x4f8e5b[_0xbdb0('0x1e')](_0xbdb0('0x1f'),_0x921a35+'-'+_0x43a2b3+'/'+_0x3a063e)[_0xbdb0('0x18')](_0x3588c2);}return null;};}function patchUpdates(_0x56861e){return function(_0x3fc04c){try{jsonpatch[_0xbdb0('0x20')](_0x3fc04c,_0x56861e,!![]);}catch(_0x11b676){return BPromise[_0xbdb0('0x21')](_0x11b676);}return _0x3fc04c['save']();};}function saveUpdates(_0x579a85,_0x345860){return function(_0x50e4a3){if(_0x50e4a3){return _0x50e4a3['update'](_0x579a85)['then'](function(_0x5d3bcc){return _0x5d3bcc;});}return null;};}function removeEntity(_0x5d0620,_0x2255a5){return function(_0x3fe69d){if(_0x3fe69d){return _0x3fe69d[_0xbdb0('0x22')]()[_0xbdb0('0x23')](function(){_0x5d0620[_0xbdb0('0x1d')](0xcc)[_0xbdb0('0x17')]();});}};}function handleEntityNotFound(_0x54345a,_0x4369c6){return function(_0x987ebe){if(!_0x987ebe){_0x54345a[_0xbdb0('0x16')](0x194);}return _0x987ebe;};}function handleError(_0x4a4380,_0x2c3241){_0x2c3241=_0x2c3241||0x1f4;return function(_0x50fd47){logger[_0xbdb0('0x24')](_0x50fd47[_0xbdb0('0x25')]);if(_0x50fd47[_0xbdb0('0x26')]){delete _0x50fd47[_0xbdb0('0x26')];}_0x4a4380[_0xbdb0('0x1d')](_0x2c3241)[_0xbdb0('0x27')](_0x50fd47);};}exports['index']=function(_0x5d25f5,_0x2f8845){var _0xfcfdec={},_0x5b1761={},_0x110b7c={'count':0x0,'rows':[]};var _0x5ae470=_[_0xbdb0('0x28')](db['SquareReport'][_0xbdb0('0x29')],function(_0x312c97){return{'name':_0x312c97[_0xbdb0('0x2a')],'type':_0x312c97[_0xbdb0('0x2b')][_0xbdb0('0x2c')]};});_0x5b1761[_0xbdb0('0x2d')]=_[_0xbdb0('0x28')](_0x5ae470,_0xbdb0('0x26'));_0x5b1761['query']=_[_0xbdb0('0x2e')](_0x5d25f5[_0xbdb0('0x2f')]);_0x5b1761[_0xbdb0('0x30')]=_[_0xbdb0('0x31')](_0x5b1761[_0xbdb0('0x2d')],_0x5b1761['query']);_0xfcfdec[_0xbdb0('0x32')]=_[_0xbdb0('0x31')](_0x5b1761[_0xbdb0('0x2d')],qs['fields'](_0x5d25f5[_0xbdb0('0x2f')][_0xbdb0('0x33')]));_0xfcfdec['attributes']=_0xfcfdec[_0xbdb0('0x32')][_0xbdb0('0x34')]?_0xfcfdec[_0xbdb0('0x32')]:_0x5b1761[_0xbdb0('0x2d')];if(!_0x5d25f5[_0xbdb0('0x2f')][_0xbdb0('0x35')]('nolimit')){_0xfcfdec[_0xbdb0('0x1c')]=qs[_0xbdb0('0x1c')](_0x5d25f5[_0xbdb0('0x2f')]['limit']);_0xfcfdec[_0xbdb0('0x19')]=qs[_0xbdb0('0x19')](_0x5d25f5[_0xbdb0('0x2f')][_0xbdb0('0x19')]);}_0xfcfdec[_0xbdb0('0x36')]=qs[_0xbdb0('0x37')](_0x5d25f5[_0xbdb0('0x2f')][_0xbdb0('0x37')]);_0xfcfdec[_0xbdb0('0x38')]=qs[_0xbdb0('0x30')](_['pick'](_0x5d25f5['query'],_0x5b1761[_0xbdb0('0x30')]),_0x5ae470);if(_0x5d25f5['query'][_0xbdb0('0x39')]){_0xfcfdec[_0xbdb0('0x38')]=_['merge'](_0xfcfdec[_0xbdb0('0x38')],{'$or':_[_0xbdb0('0x28')](_0x5ae470,function(_0x5b0716){if(_0x5b0716[_0xbdb0('0x2b')]!==_0xbdb0('0x3a')){var _0x15bb9b={};_0x15bb9b[_0x5b0716['name']]={'$like':'%'+_0x5d25f5['query'][_0xbdb0('0x39')]+'%'};return _0x15bb9b;}})});}_0xfcfdec=_[_0xbdb0('0x3b')]({},_0xfcfdec,_0x5d25f5[_0xbdb0('0x3c')]);var _0x2a4baa={'where':_0xfcfdec[_0xbdb0('0x38')]};return db['SquareReport'][_0xbdb0('0x1b')](_0x2a4baa)[_0xbdb0('0x23')](function(_0x2cd0be){_0x110b7c['count']=_0x2cd0be;if(_0x5d25f5[_0xbdb0('0x2f')]['includeAll']){_0xfcfdec[_0xbdb0('0x3d')]=[{'all':!![]}];}return db[_0xbdb0('0x3e')]['findAll'](_0xfcfdec);})[_0xbdb0('0x23')](function(_0x8f6afd){_0x110b7c[_0xbdb0('0x3f')]=_0x8f6afd;return _0x110b7c;})[_0xbdb0('0x23')](respondWithFilteredResult(_0x2f8845,_0xfcfdec))[_0xbdb0('0x40')](handleError(_0x2f8845,null));};exports['show']=function(_0xf7d615,_0x2b03b8){var _0x4ce1ba={'raw':!![],'where':{'id':_0xf7d615['params']['id']}},_0x1144ed={};_0x1144ed[_0xbdb0('0x2d')]=_[_0xbdb0('0x2e')](db[_0xbdb0('0x3e')]['rawAttributes']);_0x1144ed[_0xbdb0('0x2f')]=_[_0xbdb0('0x2e')](_0xf7d615['query']);_0x1144ed[_0xbdb0('0x30')]=_['intersection'](_0x1144ed[_0xbdb0('0x2d')],_0x1144ed[_0xbdb0('0x2f')]);_0x4ce1ba['attributes']=_[_0xbdb0('0x31')](_0x1144ed['model'],qs[_0xbdb0('0x33')](_0xf7d615['query'][_0xbdb0('0x33')]));_0x4ce1ba[_0xbdb0('0x32')]=_0x4ce1ba[_0xbdb0('0x32')][_0xbdb0('0x34')]?_0x4ce1ba[_0xbdb0('0x32')]:_0x1144ed[_0xbdb0('0x2d')];if(_0xf7d615[_0xbdb0('0x2f')][_0xbdb0('0x41')]){_0x4ce1ba[_0xbdb0('0x3d')]=[{'all':!![]}];}_0x4ce1ba=_[_0xbdb0('0x3b')]({},_0x4ce1ba,_0xf7d615['options']);return db[_0xbdb0('0x3e')][_0xbdb0('0x42')](_0x4ce1ba)[_0xbdb0('0x23')](handleEntityNotFound(_0x2b03b8,null))['then'](respondWithResult(_0x2b03b8,null))[_0xbdb0('0x40')](handleError(_0x2b03b8,null));};exports[_0xbdb0('0x43')]=function(_0x1c9eda,_0x75c660){return db[_0xbdb0('0x3e')][_0xbdb0('0x43')](_0x1c9eda[_0xbdb0('0x44')],{})[_0xbdb0('0x23')](respondWithResult(_0x75c660,0xc9))[_0xbdb0('0x40')](handleError(_0x75c660,null));};exports[_0xbdb0('0x45')]=function(_0x3956fb,_0x4e0a4b){if(_0x3956fb[_0xbdb0('0x44')]['id']){delete _0x3956fb[_0xbdb0('0x44')]['id'];}return db[_0xbdb0('0x3e')][_0xbdb0('0x42')]({'where':{'id':_0x3956fb[_0xbdb0('0x46')]['id']}})[_0xbdb0('0x23')](handleEntityNotFound(_0x4e0a4b,null))[_0xbdb0('0x23')](saveUpdates(_0x3956fb[_0xbdb0('0x44')],null))[_0xbdb0('0x23')](respondWithResult(_0x4e0a4b,null))['catch'](handleError(_0x4e0a4b,null));};exports[_0xbdb0('0x22')]=function(_0x372ceb,_0x401239){return db[_0xbdb0('0x3e')][_0xbdb0('0x42')]({'where':{'id':_0x372ceb['params']['id']}})[_0xbdb0('0x23')](handleEntityNotFound(_0x401239,null))[_0xbdb0('0x23')](removeEntity(_0x401239,null))[_0xbdb0('0x40')](handleError(_0x401239,null));};exports[_0xbdb0('0x47')]=function(_0x1ef001,_0x50b0a7){return db[_0xbdb0('0x3e')]['describe']()[_0xbdb0('0x23')](respondWithResult(_0x50b0a7,null))[_0xbdb0('0x40')](handleError(_0x50b0a7,null));}; \ No newline at end of file +var _0x8179=['update','then','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','keys','fields','create','body','find','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject'];(function(_0x6d046,_0xb7095a){var _0xe88ffd=function(_0x2172c5){while(--_0x2172c5){_0x6d046['push'](_0x6d046['shift']());}};_0xe88ffd(++_0xb7095a);}(_0x8179,0x16f));var _0x9817=function(_0x260594,_0x43c9d1){_0x260594=_0x260594-0x0;var _0x266e31=_0x8179[_0x260594];return _0x266e31;};'use strict';var emlformat=require(_0x9817('0x0'));var rimraf=require(_0x9817('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9817('0x2'));var rp=require(_0x9817('0x3'));var moment=require(_0x9817('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9817('0x5'));var util=require(_0x9817('0x6'));var path=require(_0x9817('0x7'));var sox=require(_0x9817('0x8'));var csv=require(_0x9817('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9817('0xa'));var crypto=require(_0x9817('0xb'));var jsforce=require(_0x9817('0xc'));var deskjs=require(_0x9817('0xd'));var toCsv=require(_0x9817('0x9'));var querystring=require(_0x9817('0xe'));var Papa=require(_0x9817('0xf'));var Redis=require(_0x9817('0x10'));var authService=require(_0x9817('0x11'));var qs=require(_0x9817('0x12'));var as=require(_0x9817('0x13'));var hardwareService=require(_0x9817('0x14'));var logger=require(_0x9817('0x15'))(_0x9817('0x16'));var utils=require(_0x9817('0x17'));var config=require(_0x9817('0x18'));var licenseUtil=require(_0x9817('0x19'));var db=require(_0x9817('0x1a'))['db'];function respondWithStatusCode(_0x3eeebd,_0x4fdc26){_0x4fdc26=_0x4fdc26||0xcc;return function(_0x4256a1){if(_0x4256a1){return _0x3eeebd[_0x9817('0x1b')](_0x4fdc26);}return _0x3eeebd[_0x9817('0x1c')](_0x4fdc26)[_0x9817('0x1d')]();};}function respondWithResult(_0x445af0,_0x1f3d07){_0x1f3d07=_0x1f3d07||0xc8;return function(_0x35138e){if(_0x35138e){return _0x445af0['status'](_0x1f3d07)[_0x9817('0x1e')](_0x35138e);}};}function respondWithFilteredResult(_0x353561,_0xdc3057){return function(_0x413f4e){if(_0x413f4e){var _0x3cc0e0=typeof _0xdc3057[_0x9817('0x1f')]===_0x9817('0x20')&&typeof _0xdc3057[_0x9817('0x21')]==='undefined';var _0x39a1db=_0x413f4e[_0x9817('0x22')];var _0x1540e2=_0x3cc0e0?0x0:_0xdc3057['offset'];var _0x370723=_0x3cc0e0?_0x413f4e[_0x9817('0x22')]:_0xdc3057[_0x9817('0x1f')]+_0xdc3057[_0x9817('0x21')];var _0x3c9603;if(_0x370723>=_0x39a1db){_0x370723=_0x39a1db;_0x3c9603=0xc8;}else{_0x3c9603=0xce;}_0x353561[_0x9817('0x1c')](_0x3c9603);return _0x353561[_0x9817('0x23')](_0x9817('0x24'),_0x1540e2+'-'+_0x370723+'/'+_0x39a1db)[_0x9817('0x1e')](_0x413f4e);}return null;};}function patchUpdates(_0x36226b){return function(_0x5f46d2){try{jsonpatch['apply'](_0x5f46d2,_0x36226b,!![]);}catch(_0x467296){return BPromise[_0x9817('0x25')](_0x467296);}return _0x5f46d2['save']();};}function saveUpdates(_0x1903b8,_0xf46a52){return function(_0x109579){if(_0x109579){return _0x109579[_0x9817('0x26')](_0x1903b8)[_0x9817('0x27')](function(_0x44b8e7){return _0x44b8e7;});}return null;};}function removeEntity(_0x2caf9a,_0x597b1a){return function(_0x4b976e){if(_0x4b976e){return _0x4b976e['destroy']()[_0x9817('0x27')](function(){_0x2caf9a[_0x9817('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x214c97,_0x2bba27){return function(_0x4fa695){if(!_0x4fa695){_0x214c97['sendStatus'](0x194);}return _0x4fa695;};}function handleError(_0x1f00ed,_0x5deba6){_0x5deba6=_0x5deba6||0x1f4;return function(_0x175ac1){logger[_0x9817('0x28')](_0x175ac1[_0x9817('0x29')]);if(_0x175ac1[_0x9817('0x2a')]){delete _0x175ac1[_0x9817('0x2a')];}_0x1f00ed['status'](_0x5deba6)[_0x9817('0x2b')](_0x175ac1);};}exports[_0x9817('0x2c')]=function(_0xf60f2e,_0x1f464c){var _0x5c7c87={},_0x33c50c={},_0x2bf500={'count':0x0,'rows':[]};var _0x1cf98d=_[_0x9817('0x2d')](db[_0x9817('0x2e')][_0x9817('0x2f')],function(_0x100e58){return{'name':_0x100e58[_0x9817('0x30')],'type':_0x100e58[_0x9817('0x31')][_0x9817('0x32')]};});_0x33c50c[_0x9817('0x33')]=_[_0x9817('0x2d')](_0x1cf98d,_0x9817('0x2a'));_0x33c50c[_0x9817('0x34')]=_['keys'](_0xf60f2e[_0x9817('0x34')]);_0x33c50c[_0x9817('0x35')]=_[_0x9817('0x36')](_0x33c50c['model'],_0x33c50c[_0x9817('0x34')]);_0x5c7c87[_0x9817('0x37')]=_[_0x9817('0x36')](_0x33c50c['model'],qs['fields'](_0xf60f2e['query']['fields']));_0x5c7c87['attributes']=_0x5c7c87[_0x9817('0x37')][_0x9817('0x38')]?_0x5c7c87[_0x9817('0x37')]:_0x33c50c['model'];if(!_0xf60f2e[_0x9817('0x34')][_0x9817('0x39')](_0x9817('0x3a'))){_0x5c7c87[_0x9817('0x21')]=qs[_0x9817('0x21')](_0xf60f2e['query']['limit']);_0x5c7c87[_0x9817('0x1f')]=qs[_0x9817('0x1f')](_0xf60f2e['query'][_0x9817('0x1f')]);}_0x5c7c87[_0x9817('0x3b')]=qs[_0x9817('0x3c')](_0xf60f2e[_0x9817('0x34')][_0x9817('0x3c')]);_0x5c7c87['where']=qs[_0x9817('0x35')](_[_0x9817('0x3d')](_0xf60f2e[_0x9817('0x34')],_0x33c50c['filters']),_0x1cf98d);if(_0xf60f2e[_0x9817('0x34')][_0x9817('0x3e')]){_0x5c7c87['where']=_[_0x9817('0x3f')](_0x5c7c87['where'],{'$or':_[_0x9817('0x2d')](_0x1cf98d,function(_0x11c946){if(_0x11c946[_0x9817('0x31')]!==_0x9817('0x40')){var _0x794826={};_0x794826[_0x11c946[_0x9817('0x2a')]]={'$like':'%'+_0xf60f2e[_0x9817('0x34')]['filter']+'%'};return _0x794826;}})});}_0x5c7c87=_['merge']({},_0x5c7c87,_0xf60f2e[_0x9817('0x41')]);var _0x4541a3={'where':_0x5c7c87[_0x9817('0x42')]};return db[_0x9817('0x2e')][_0x9817('0x22')](_0x4541a3)['then'](function(_0x1fb28c){_0x2bf500[_0x9817('0x22')]=_0x1fb28c;if(_0xf60f2e[_0x9817('0x34')][_0x9817('0x43')]){_0x5c7c87[_0x9817('0x44')]=[{'all':!![]}];}return db[_0x9817('0x2e')][_0x9817('0x45')](_0x5c7c87);})[_0x9817('0x27')](function(_0xcc7598){_0x2bf500[_0x9817('0x46')]=_0xcc7598;return _0x2bf500;})[_0x9817('0x27')](respondWithFilteredResult(_0x1f464c,_0x5c7c87))[_0x9817('0x47')](handleError(_0x1f464c,null));};exports[_0x9817('0x48')]=function(_0x2aacfb,_0x46c8bc){var _0x522ef2={'raw':!![],'where':{'id':_0x2aacfb[_0x9817('0x49')]['id']}},_0x39daf0={};_0x39daf0['model']=_[_0x9817('0x4a')](db[_0x9817('0x2e')][_0x9817('0x2f')]);_0x39daf0[_0x9817('0x34')]=_[_0x9817('0x4a')](_0x2aacfb[_0x9817('0x34')]);_0x39daf0[_0x9817('0x35')]=_['intersection'](_0x39daf0[_0x9817('0x33')],_0x39daf0[_0x9817('0x34')]);_0x522ef2[_0x9817('0x37')]=_[_0x9817('0x36')](_0x39daf0[_0x9817('0x33')],qs[_0x9817('0x4b')](_0x2aacfb[_0x9817('0x34')]['fields']));_0x522ef2[_0x9817('0x37')]=_0x522ef2['attributes']['length']?_0x522ef2[_0x9817('0x37')]:_0x39daf0[_0x9817('0x33')];if(_0x2aacfb['query']['includeAll']){_0x522ef2['include']=[{'all':!![]}];}_0x522ef2=_[_0x9817('0x3f')]({},_0x522ef2,_0x2aacfb[_0x9817('0x41')]);return db['SquareReport']['find'](_0x522ef2)[_0x9817('0x27')](handleEntityNotFound(_0x46c8bc,null))[_0x9817('0x27')](respondWithResult(_0x46c8bc,null))[_0x9817('0x47')](handleError(_0x46c8bc,null));};exports[_0x9817('0x4c')]=function(_0x3d7aa4,_0x198edf){return db[_0x9817('0x2e')][_0x9817('0x4c')](_0x3d7aa4['body'],{})[_0x9817('0x27')](respondWithResult(_0x198edf,0xc9))[_0x9817('0x47')](handleError(_0x198edf,null));};exports['update']=function(_0x4a2fbb,_0x4f3baa){if(_0x4a2fbb[_0x9817('0x4d')]['id']){delete _0x4a2fbb['body']['id'];}return db[_0x9817('0x2e')][_0x9817('0x4e')]({'where':{'id':_0x4a2fbb['params']['id']}})[_0x9817('0x27')](handleEntityNotFound(_0x4f3baa,null))[_0x9817('0x27')](saveUpdates(_0x4a2fbb[_0x9817('0x4d')],null))[_0x9817('0x27')](respondWithResult(_0x4f3baa,null))[_0x9817('0x47')](handleError(_0x4f3baa,null));};exports[_0x9817('0x4f')]=function(_0x241835,_0x56df44){return db[_0x9817('0x2e')][_0x9817('0x4e')]({'where':{'id':_0x241835[_0x9817('0x49')]['id']}})[_0x9817('0x27')](handleEntityNotFound(_0x56df44,null))['then'](removeEntity(_0x56df44,null))['catch'](handleError(_0x56df44,null));};exports[_0x9817('0x50')]=function(_0x54dbde,_0x1f120d){return db[_0x9817('0x2e')]['describe']()['then'](respondWithResult(_0x1f120d,null))['catch'](handleError(_0x1f120d,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 83c0ea2..70901ea 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 _0xd786=['../../config/environment','define','SquareReport','uid_pname','project_name','leaveAt','../../config/logger','api','request-promise','rimraf'];(function(_0xeb7db3,_0x2644f9){var _0x40be47=function(_0x17240f){while(--_0x17240f){_0xeb7db3['push'](_0xeb7db3['shift']());}};_0x40be47(++_0x2644f9);}(_0xd786,0xc4));var _0x6d78=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xd786[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6d78('0x0'))(_0x6d78('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6d78('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6d78('0x3'));var config=require(_0x6d78('0x4'));var attributes=require('./squareReport.attributes');module['exports']=function(_0x5fd4c5,_0x56e216){return _0x5fd4c5[_0x6d78('0x5')](_0x6d78('0x6'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x6d78('0x7'),'fields':['uniqueid',_0x6d78('0x8')]},{'name':_0x6d78('0x9'),'fields':[_0x6d78('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f98=['./squareReport.attributes','SquareReport','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0x5f98,0x1d9));var _0x85f9=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x5f98[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0x85f9('0x0'));var util=require(_0x85f9('0x1'));var logger=require(_0x85f9('0x2'))(_0x85f9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x85f9('0x4'));var fs=require('fs');var path=require(_0x85f9('0x5'));var rimraf=require(_0x85f9('0x6'));var config=require('../../config/environment');var attributes=require(_0x85f9('0x7'));module['exports']=function(_0x2ca212,_0x54eee1){return _0x2ca212['define'](_0x85f9('0x8'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x85f9('0x9'),_0x85f9('0xa')]},{'name':_0x85f9('0xb'),'fields':[_0x85f9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 241a11d..05ce76c 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 _0x7805=['raw','where','attributes','limit','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareReport','SquareReport','create','body','options','UpdateSquareReport','update'];(function(_0xae921d,_0x5ea9b1){var _0x11e0d9=function(_0x3cdc67){while(--_0x3cdc67){_0xae921d['push'](_0xae921d['shift']());}};_0x11e0d9(++_0x5ea9b1);}(_0x7805,0x1f4));var _0x5780=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x7805[_0x47e549];return _0x251374;};'use strict';var _=require('lodash');var util=require(_0x5780('0x0'));var moment=require(_0x5780('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5780('0x2'));var db=require(_0x5780('0x3'))['db'];var utils=require(_0x5780('0x4'));var logger=require('../../config/logger')(_0x5780('0x5'));var config=require(_0x5780('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5780('0x7')][_0x5780('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x524732,_0x594ea2,_0x33d095){return new BPromise(function(_0x477175,_0x3e181e){return client['request'](_0x524732,_0x33d095)[_0x5780('0x9')](function(_0x5f18b7){logger[_0x5780('0xa')](_0x5780('0xb'),_0x594ea2,_0x5780('0xc'));logger[_0x5780('0xd')](_0x5780('0xe'),_0x594ea2,_0x5780('0xc'),JSON[_0x5780('0xf')](_0x5f18b7));if(_0x5f18b7[_0x5780('0x10')]){if(_0x5f18b7['error'][_0x5780('0x11')]===0x1f4){logger[_0x5780('0x10')](_0x5780('0xb'),_0x594ea2,_0x5f18b7[_0x5780('0x10')][_0x5780('0x12')]);return _0x3e181e(_0x5f18b7[_0x5780('0x10')][_0x5780('0x12')]);}logger['error'](_0x5780('0xb'),_0x594ea2,_0x5f18b7[_0x5780('0x10')][_0x5780('0x12')]);return _0x477175(_0x5f18b7[_0x5780('0x10')][_0x5780('0x12')]);}else{logger[_0x5780('0xa')](_0x5780('0xb'),_0x594ea2,'request\x20sent');_0x477175(_0x5f18b7['result'][_0x5780('0x12')]);}})[_0x5780('0x13')](function(_0x1883e0){logger[_0x5780('0x10')](_0x5780('0xb'),_0x594ea2,_0x1883e0);_0x3e181e(_0x1883e0);});});}exports[_0x5780('0x14')]=function(_0x3d11c4){var _0x50e2bc=this;return new Promise(function(_0x282f9c,_0x4e078a){return db[_0x5780('0x15')][_0x5780('0x16')](_0x3d11c4[_0x5780('0x17')],{'raw':_0x3d11c4['options']?_0x3d11c4[_0x5780('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x5780('0x9')](function(_0x20db2c){logger['info'](_0x5780('0x14'),_0x3d11c4);logger[_0x5780('0xd')](_0x5780('0x14'),_0x3d11c4,JSON[_0x5780('0xf')](_0x20db2c));_0x282f9c(_0x20db2c);})[_0x5780('0x13')](function(_0x4ab712){logger['error'](_0x5780('0x14'),_0x4ab712[_0x5780('0x12')],_0x3d11c4);_0x4e078a(_0x50e2bc[_0x5780('0x10')](0x1f4,_0x4ab712[_0x5780('0x12')]));});});};exports[_0x5780('0x19')]=function(_0x52d105){var _0x23027a=this;return new Promise(function(_0x2027ef,_0x1c360b){return db[_0x5780('0x15')][_0x5780('0x1a')](_0x52d105[_0x5780('0x17')],{'raw':_0x52d105[_0x5780('0x18')]?_0x52d105['options'][_0x5780('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52d105[_0x5780('0x18')]?_0x52d105['options'][_0x5780('0x1c')]||null:null,'attributes':_0x52d105['options']?_0x52d105[_0x5780('0x18')][_0x5780('0x1d')]||null:null,'limit':_0x52d105[_0x5780('0x18')]?_0x52d105[_0x5780('0x18')][_0x5780('0x1e')]||null:null})[_0x5780('0x9')](function(_0x139155){logger[_0x5780('0xa')](_0x5780('0x19'),_0x52d105);logger['debug'](_0x5780('0x19'),_0x52d105,JSON[_0x5780('0xf')](_0x139155));_0x2027ef(_0x139155);})[_0x5780('0x13')](function(_0x3a7893){logger[_0x5780('0x10')](_0x5780('0x19'),_0x3a7893[_0x5780('0x12')],_0x52d105);_0x1c360b(_0x23027a[_0x5780('0x10')](0x1f4,_0x3a7893[_0x5780('0x12')]));});});}; \ No newline at end of file +var _0x40fc=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','where','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x5dee66,_0x3cae3a){var _0x1e5745=function(_0x37d7e8){while(--_0x37d7e8){_0x5dee66['push'](_0x5dee66['shift']());}};_0x1e5745(++_0x3cae3a);}(_0x40fc,0x9a));var _0xc40f=function(_0x22d655,_0x3941dd){_0x22d655=_0x22d655-0x0;var _0x257739=_0x40fc[_0x22d655];return _0x257739;};'use strict';var _=require(_0xc40f('0x0'));var util=require(_0xc40f('0x1'));var moment=require(_0xc40f('0x2'));var BPromise=require(_0xc40f('0x3'));var rs=require(_0xc40f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc40f('0x5'));var logger=require(_0xc40f('0x6'))(_0xc40f('0x7'));var config=require(_0xc40f('0x8'));var jayson=require(_0xc40f('0x9'));var client=jayson[_0xc40f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc592b2,_0x4b3520,_0x30c382){return new BPromise(function(_0x57d3f9,_0xd485e0){return client[_0xc40f('0xb')](_0xc592b2,_0x30c382)[_0xc40f('0xc')](function(_0x2541bc){logger[_0xc40f('0xd')](_0xc40f('0xe'),_0x4b3520,_0xc40f('0xf'));logger[_0xc40f('0x10')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x4b3520,'request\x20sent',JSON[_0xc40f('0x11')](_0x2541bc));if(_0x2541bc['error']){if(_0x2541bc[_0xc40f('0x12')][_0xc40f('0x13')]===0x1f4){logger[_0xc40f('0x12')](_0xc40f('0xe'),_0x4b3520,_0x2541bc[_0xc40f('0x12')][_0xc40f('0x14')]);return _0xd485e0(_0x2541bc[_0xc40f('0x12')][_0xc40f('0x14')]);}logger[_0xc40f('0x12')](_0xc40f('0xe'),_0x4b3520,_0x2541bc[_0xc40f('0x12')][_0xc40f('0x14')]);return _0x57d3f9(_0x2541bc[_0xc40f('0x12')]['message']);}else{logger[_0xc40f('0xd')](_0xc40f('0xe'),_0x4b3520,_0xc40f('0xf'));_0x57d3f9(_0x2541bc[_0xc40f('0x15')][_0xc40f('0x14')]);}})[_0xc40f('0x16')](function(_0x53b9ff){logger[_0xc40f('0x12')]('SquareReport,\x20%s,\x20%s',_0x4b3520,_0x53b9ff);_0xd485e0(_0x53b9ff);});});}exports[_0xc40f('0x17')]=function(_0x215b30){var _0xa6fedd=this;return new Promise(function(_0x4fc08d,_0x2ec39d){return db[_0xc40f('0x18')][_0xc40f('0x19')](_0x215b30[_0xc40f('0x1a')],{'raw':_0x215b30['options']?_0x215b30[_0xc40f('0x1b')][_0xc40f('0x1c')]===undefined?!![]:![]:!![]})[_0xc40f('0xc')](function(_0x223cfb){logger['info'](_0xc40f('0x17'),_0x215b30);logger['debug'](_0xc40f('0x17'),_0x215b30,JSON[_0xc40f('0x11')](_0x223cfb));_0x4fc08d(_0x223cfb);})['catch'](function(_0x112276){logger['error'](_0xc40f('0x17'),_0x112276[_0xc40f('0x14')],_0x215b30);_0x2ec39d(_0xa6fedd['error'](0x1f4,_0x112276['message']));});});};exports[_0xc40f('0x1d')]=function(_0x43fa44){var _0x9dfb97=this;return new Promise(function(_0xf113e4,_0x8cb0f6){return db[_0xc40f('0x18')][_0xc40f('0x1e')](_0x43fa44[_0xc40f('0x1a')],{'raw':_0x43fa44['options']?_0x43fa44[_0xc40f('0x1b')][_0xc40f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43fa44[_0xc40f('0x1b')]?_0x43fa44[_0xc40f('0x1b')][_0xc40f('0x1f')]||null:null,'attributes':_0x43fa44[_0xc40f('0x1b')]?_0x43fa44[_0xc40f('0x1b')]['attributes']||null:null,'limit':_0x43fa44[_0xc40f('0x1b')]?_0x43fa44[_0xc40f('0x1b')]['limit']||null:null})['then'](function(_0x2c70e7){logger[_0xc40f('0xd')](_0xc40f('0x1d'),_0x43fa44);logger[_0xc40f('0x10')]('UpdateSquareReport',_0x43fa44,JSON[_0xc40f('0x11')](_0x2c70e7));_0xf113e4(_0x2c70e7);})[_0xc40f('0x16')](function(_0xf171aa){logger[_0xc40f('0x12')]('UpdateSquareReport',_0xf171aa[_0xc40f('0x14')],_0x43fa44);_0x8cb0f6(_0x9dfb97[_0xc40f('0x12')](0x1f4,_0xf171aa['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 667a2b5..1361a26 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 _0xac41=['/describe','isAuthenticated','describe','show','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get'];(function(_0x47ae1f,_0x328d68){var _0x2a0233=function(_0x53dd41){while(--_0x53dd41){_0x47ae1f['push'](_0x47ae1f['shift']());}};_0x2a0233(++_0x328d68);}(_0xac41,0xaa));var _0x1ac4=function(_0x1b19fe,_0x334742){_0x1b19fe=_0x1b19fe-0x0;var _0x2357fb=_0xac41[_0x1b19fe];return _0x2357fb;};'use strict';var multer=require(_0x1ac4('0x0'));var util=require(_0x1ac4('0x1'));var path=require(_0x1ac4('0x2'));var timeout=require(_0x1ac4('0x3'));var express=require('express');var router=express[_0x1ac4('0x4')]();var fs_extra=require(_0x1ac4('0x5'));var auth=require(_0x1ac4('0x6'));var interaction=require(_0x1ac4('0x7'));var config=require('../../config/environment');var controller=require(_0x1ac4('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1ac4('0x9')](_0x1ac4('0xa'),auth[_0x1ac4('0xb')](),controller[_0x1ac4('0xc')]);router[_0x1ac4('0x9')]('/:id',auth[_0x1ac4('0xb')](),controller[_0x1ac4('0xd')]);router['post']('/',auth[_0x1ac4('0xb')](),controller[_0x1ac4('0xe')]);router['put'](_0x1ac4('0xf'),auth['isAuthenticated'](),controller[_0x1ac4('0x10')]);router[_0x1ac4('0x11')](_0x1ac4('0xf'),auth['isAuthenticated'](),controller[_0x1ac4('0x12')]);module[_0x1ac4('0x13')]=router; \ No newline at end of file +var _0x3f51=['put','/:id','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','/describe','describe','show','post'];(function(_0x5a3e69,_0x346f71){var _0x27073b=function(_0x36283e){while(--_0x36283e){_0x5a3e69['push'](_0x5a3e69['shift']());}};_0x27073b(++_0x346f71);}(_0x3f51,0x15b));var _0x13f5=function(_0x4ef372,_0x10d0be){_0x4ef372=_0x4ef372-0x0;var _0x225a4d=_0x3f51[_0x4ef372];return _0x225a4d;};'use strict';var multer=require('multer');var util=require(_0x13f5('0x0'));var path=require(_0x13f5('0x1'));var timeout=require(_0x13f5('0x2'));var express=require('express');var router=express[_0x13f5('0x3')]();var fs_extra=require(_0x13f5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x13f5('0x5'));var config=require('../../config/environment');var controller=require(_0x13f5('0x6'));router[_0x13f5('0x7')]('/',auth[_0x13f5('0x8')](),controller['index']);router[_0x13f5('0x7')](_0x13f5('0x9'),auth[_0x13f5('0x8')](),controller[_0x13f5('0xa')]);router[_0x13f5('0x7')]('/:id',auth[_0x13f5('0x8')](),controller[_0x13f5('0xb')]);router[_0x13f5('0xc')]('/',auth[_0x13f5('0x8')](),controller['create']);router[_0x13f5('0xd')](_0x13f5('0xe'),auth[_0x13f5('0x8')](),controller[_0x13f5('0xf')]);router[_0x13f5('0x10')]('/:id',auth[_0x13f5('0x8')](),controller[_0x13f5('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 8267bd9..17d8e44 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 _0xd447=['TEXT','exports','STRING'];(function(_0x158b34,_0x2a8fb1){var _0x2f5449=function(_0x58de0a){while(--_0x58de0a){_0x158b34['push'](_0x158b34['shift']());}};_0x2f5449(++_0x2a8fb1);}(_0xd447,0xbe));var _0x7d44=function(_0x2a4e75,_0x143c37){_0x2a4e75=_0x2a4e75-0x0;var _0x1f9014=_0xd447[_0x2a4e75];return _0x1f9014;};'use strict';var Sequelize=require('sequelize');module[_0x7d44('0x0')]={'uniqueid':{'type':Sequelize[_0x7d44('0x1')]},'node':{'type':Sequelize[_0x7d44('0x1')]},'application':{'type':Sequelize[_0x7d44('0x1')]},'data':{'type':Sequelize[_0x7d44('0x2')]},'project_name':{'type':Sequelize[_0x7d44('0x1')]},'callerid':{'type':Sequelize[_0x7d44('0x1')]}}; \ No newline at end of file +var _0x5830=['exports','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5830,0x84));var _0x0583=function(_0x1f00ac,_0x2dca5a){_0x1f00ac=_0x1f00ac-0x0;var _0x5565c7=_0x5830[_0x1f00ac];return _0x5565c7;};'use strict';var Sequelize=require('sequelize');module[_0x0583('0x0')]={'uniqueid':{'type':Sequelize[_0x0583('0x1')]},'node':{'type':Sequelize[_0x0583('0x1')]},'application':{'type':Sequelize[_0x0583('0x1')]},'data':{'type':Sequelize[_0x0583('0x2')]},'project_name':{'type':Sequelize[_0x0583('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 45c628c..a0e2dfb 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 _0x2887=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x2887,0x12a));var _0x7288=function(_0x3c25d7,_0x50ebd0){_0x3c25d7=_0x3c25d7-0x0;var _0xd8d3a6=_0x2887[_0x3c25d7];return _0xd8d3a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7288('0x0'));var zipdir=require(_0x7288('0x1'));var jsonpatch=require(_0x7288('0x2'));var rp=require(_0x7288('0x3'));var moment=require(_0x7288('0x4'));var BPromise=require(_0x7288('0x5'));var Mustache=require('mustache');var util=require(_0x7288('0x6'));var path=require(_0x7288('0x7'));var sox=require(_0x7288('0x8'));var csv=require(_0x7288('0x9'));var ejs=require(_0x7288('0xa'));var fs=require('fs');var fs_extra=require(_0x7288('0xb'));var _=require(_0x7288('0xc'));var squel=require(_0x7288('0xd'));var crypto=require('crypto');var jsforce=require(_0x7288('0xe'));var deskjs=require(_0x7288('0xf'));var toCsv=require(_0x7288('0x9'));var querystring=require(_0x7288('0x10'));var Papa=require(_0x7288('0x11'));var Redis=require(_0x7288('0x12'));var authService=require(_0x7288('0x13'));var qs=require(_0x7288('0x14'));var as=require(_0x7288('0x15'));var hardwareService=require(_0x7288('0x16'));var logger=require(_0x7288('0x17'))('api');var utils=require(_0x7288('0x18'));var config=require(_0x7288('0x19'));var licenseUtil=require(_0x7288('0x1a'));var db=require(_0x7288('0x1b'))['db'];function respondWithStatusCode(_0x4f9e04,_0x35fada){_0x35fada=_0x35fada||0xcc;return function(_0x4aa8b9){if(_0x4aa8b9){return _0x4f9e04[_0x7288('0x1c')](_0x35fada);}return _0x4f9e04[_0x7288('0x1d')](_0x35fada)[_0x7288('0x1e')]();};}function respondWithResult(_0x45a5bd,_0x1bbc55){_0x1bbc55=_0x1bbc55||0xc8;return function(_0x34dc75){if(_0x34dc75){return _0x45a5bd[_0x7288('0x1d')](_0x1bbc55)[_0x7288('0x1f')](_0x34dc75);}};}function respondWithFilteredResult(_0x4d567c,_0x509a7f){return function(_0x598051){if(_0x598051){var _0x49253e=typeof _0x509a7f[_0x7288('0x20')]===_0x7288('0x21')&&typeof _0x509a7f['limit']===_0x7288('0x21');var _0x57552e=_0x598051[_0x7288('0x22')];var _0x2e11be=_0x49253e?0x0:_0x509a7f[_0x7288('0x20')];var _0x2c01f5=_0x49253e?_0x598051[_0x7288('0x22')]:_0x509a7f[_0x7288('0x20')]+_0x509a7f[_0x7288('0x23')];var _0x2b8a0e;if(_0x2c01f5>=_0x57552e){_0x2c01f5=_0x57552e;_0x2b8a0e=0xc8;}else{_0x2b8a0e=0xce;}_0x4d567c[_0x7288('0x1d')](_0x2b8a0e);return _0x4d567c[_0x7288('0x24')](_0x7288('0x25'),_0x2e11be+'-'+_0x2c01f5+'/'+_0x57552e)[_0x7288('0x1f')](_0x598051);}return null;};}function patchUpdates(_0x4a43ac){return function(_0xb94e32){try{jsonpatch[_0x7288('0x26')](_0xb94e32,_0x4a43ac,!![]);}catch(_0x2f8437){return BPromise[_0x7288('0x27')](_0x2f8437);}return _0xb94e32[_0x7288('0x28')]();};}function saveUpdates(_0x3e42a7,_0x4dcb4d){return function(_0x3f9703){if(_0x3f9703){return _0x3f9703[_0x7288('0x29')](_0x3e42a7)[_0x7288('0x2a')](function(_0x2bdcf1){return _0x2bdcf1;});}return null;};}function removeEntity(_0x2a273b,_0x3fc3db){return function(_0x363b9a){if(_0x363b9a){return _0x363b9a[_0x7288('0x2b')]()[_0x7288('0x2a')](function(){_0x2a273b[_0x7288('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5453f4,_0xa4c0c3){return function(_0x2f4d3e){if(!_0x2f4d3e){_0x5453f4[_0x7288('0x1c')](0x194);}return _0x2f4d3e;};}function handleError(_0x47b759,_0x47adc9){_0x47adc9=_0x47adc9||0x1f4;return function(_0x2b0867){logger[_0x7288('0x2c')](_0x2b0867[_0x7288('0x2d')]);if(_0x2b0867['name']){delete _0x2b0867[_0x7288('0x2e')];}_0x47b759[_0x7288('0x1d')](_0x47adc9)[_0x7288('0x2f')](_0x2b0867);};}exports[_0x7288('0x30')]=function(_0x5ca8a5,_0x4fd914){var _0x1786a8={},_0x365043={},_0x4be858={'count':0x0,'rows':[]};var _0x39161f=_[_0x7288('0x31')](db[_0x7288('0x32')][_0x7288('0x33')],function(_0x11f645){return{'name':_0x11f645[_0x7288('0x34')],'type':_0x11f645['type'][_0x7288('0x35')]};});_0x365043[_0x7288('0x36')]=_[_0x7288('0x31')](_0x39161f,_0x7288('0x2e'));_0x365043['query']=_[_0x7288('0x37')](_0x5ca8a5[_0x7288('0x38')]);_0x365043[_0x7288('0x39')]=_[_0x7288('0x3a')](_0x365043[_0x7288('0x36')],_0x365043['query']);_0x1786a8['attributes']=_[_0x7288('0x3a')](_0x365043[_0x7288('0x36')],qs['fields'](_0x5ca8a5[_0x7288('0x38')][_0x7288('0x3b')]));_0x1786a8['attributes']=_0x1786a8[_0x7288('0x3c')][_0x7288('0x3d')]?_0x1786a8[_0x7288('0x3c')]:_0x365043[_0x7288('0x36')];if(!_0x5ca8a5[_0x7288('0x38')]['hasOwnProperty'](_0x7288('0x3e'))){_0x1786a8[_0x7288('0x23')]=qs[_0x7288('0x23')](_0x5ca8a5['query'][_0x7288('0x23')]);_0x1786a8[_0x7288('0x20')]=qs[_0x7288('0x20')](_0x5ca8a5[_0x7288('0x38')]['offset']);}_0x1786a8[_0x7288('0x3f')]=qs[_0x7288('0x40')](_0x5ca8a5['query'][_0x7288('0x40')]);_0x1786a8[_0x7288('0x41')]=qs[_0x7288('0x39')](_[_0x7288('0x42')](_0x5ca8a5['query'],_0x365043['filters']),_0x39161f);if(_0x5ca8a5[_0x7288('0x38')][_0x7288('0x43')]){_0x1786a8[_0x7288('0x41')]=_[_0x7288('0x44')](_0x1786a8['where'],{'$or':_[_0x7288('0x31')](_0x39161f,function(_0x58d1a3){if(_0x58d1a3[_0x7288('0x45')]!==_0x7288('0x46')){var _0x552d35={};_0x552d35[_0x58d1a3['name']]={'$like':'%'+_0x5ca8a5[_0x7288('0x38')][_0x7288('0x43')]+'%'};return _0x552d35;}})});}_0x1786a8=_['merge']({},_0x1786a8,_0x5ca8a5['options']);var _0x5ee27b={'where':_0x1786a8[_0x7288('0x41')]};return db[_0x7288('0x32')][_0x7288('0x22')](_0x5ee27b)[_0x7288('0x2a')](function(_0x3fbeca){_0x4be858[_0x7288('0x22')]=_0x3fbeca;if(_0x5ca8a5[_0x7288('0x38')][_0x7288('0x47')]){_0x1786a8[_0x7288('0x48')]=[{'all':!![]}];}return db[_0x7288('0x32')]['findAll'](_0x1786a8);})[_0x7288('0x2a')](function(_0x29c791){_0x4be858[_0x7288('0x49')]=_0x29c791;return _0x4be858;})[_0x7288('0x2a')](respondWithFilteredResult(_0x4fd914,_0x1786a8))[_0x7288('0x4a')](handleError(_0x4fd914,null));};exports[_0x7288('0x4b')]=function(_0x379c76,_0x552fbe){var _0x32dddf={'raw':!![],'where':{'id':_0x379c76[_0x7288('0x4c')]['id']}},_0xf6f78={};_0xf6f78['model']=_['keys'](db[_0x7288('0x32')][_0x7288('0x33')]);_0xf6f78['query']=_[_0x7288('0x37')](_0x379c76[_0x7288('0x38')]);_0xf6f78['filters']=_['intersection'](_0xf6f78[_0x7288('0x36')],_0xf6f78['query']);_0x32dddf[_0x7288('0x3c')]=_[_0x7288('0x3a')](_0xf6f78[_0x7288('0x36')],qs[_0x7288('0x3b')](_0x379c76['query'][_0x7288('0x3b')]));_0x32dddf['attributes']=_0x32dddf[_0x7288('0x3c')][_0x7288('0x3d')]?_0x32dddf[_0x7288('0x3c')]:_0xf6f78['model'];if(_0x379c76[_0x7288('0x38')]['includeAll']){_0x32dddf[_0x7288('0x48')]=[{'all':!![]}];}_0x32dddf=_[_0x7288('0x44')]({},_0x32dddf,_0x379c76[_0x7288('0x4d')]);return db[_0x7288('0x32')][_0x7288('0x4e')](_0x32dddf)[_0x7288('0x2a')](handleEntityNotFound(_0x552fbe,null))[_0x7288('0x2a')](respondWithResult(_0x552fbe,null))['catch'](handleError(_0x552fbe,null));};exports[_0x7288('0x4f')]=function(_0x10c175,_0x447b1f){return db['SquareDetailsReport'][_0x7288('0x4f')](_0x10c175[_0x7288('0x50')],{})[_0x7288('0x2a')](respondWithResult(_0x447b1f,0xc9))[_0x7288('0x4a')](handleError(_0x447b1f,null));};exports[_0x7288('0x29')]=function(_0x134349,_0xa46e72){if(_0x134349[_0x7288('0x50')]['id']){delete _0x134349['body']['id'];}return db[_0x7288('0x32')][_0x7288('0x4e')]({'where':{'id':_0x134349[_0x7288('0x4c')]['id']}})[_0x7288('0x2a')](handleEntityNotFound(_0xa46e72,null))['then'](saveUpdates(_0x134349[_0x7288('0x50')],null))['then'](respondWithResult(_0xa46e72,null))[_0x7288('0x4a')](handleError(_0xa46e72,null));};exports[_0x7288('0x2b')]=function(_0x2ba4ca,_0xa0be8f){return db[_0x7288('0x32')]['find']({'where':{'id':_0x2ba4ca[_0x7288('0x4c')]['id']}})[_0x7288('0x2a')](handleEntityNotFound(_0xa0be8f,null))[_0x7288('0x2a')](removeEntity(_0xa0be8f,null))['catch'](handleError(_0xa0be8f,null));};exports['describe']=function(_0x3bd286,_0x2a5f6b){return db['SquareDetailsReport']['describe']()[_0x7288('0x2a')](respondWithResult(_0x2a5f6b,null))[_0x7288('0x4a')](handleError(_0x2a5f6b,null));}; \ No newline at end of file +var _0x194f=['error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','rows','catch','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x194f,0x188));var _0xf194=function(_0x4821f3,_0x26e4c3){_0x4821f3=_0x4821f3-0x0;var _0x6127ba=_0x194f[_0x4821f3];return _0x6127ba;};'use strict';var emlformat=require(_0xf194('0x0'));var rimraf=require(_0xf194('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf194('0x2'));var rp=require(_0xf194('0x3'));var moment=require(_0xf194('0x4'));var BPromise=require(_0xf194('0x5'));var Mustache=require(_0xf194('0x6'));var util=require(_0xf194('0x7'));var path=require(_0xf194('0x8'));var sox=require(_0xf194('0x9'));var csv=require(_0xf194('0xa'));var ejs=require(_0xf194('0xb'));var fs=require('fs');var fs_extra=require(_0xf194('0xc'));var _=require('lodash');var squel=require(_0xf194('0xd'));var crypto=require('crypto');var jsforce=require(_0xf194('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf194('0xa'));var querystring=require(_0xf194('0xf'));var Papa=require(_0xf194('0x10'));var Redis=require(_0xf194('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf194('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf194('0x13'));var utils=require(_0xf194('0x14'));var config=require(_0xf194('0x15'));var licenseUtil=require(_0xf194('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x139d2d,_0x5f2c7e){_0x5f2c7e=_0x5f2c7e||0xcc;return function(_0x5efa3f){if(_0x5efa3f){return _0x139d2d[_0xf194('0x17')](_0x5f2c7e);}return _0x139d2d[_0xf194('0x18')](_0x5f2c7e)[_0xf194('0x19')]();};}function respondWithResult(_0x5b5258,_0x499f96){_0x499f96=_0x499f96||0xc8;return function(_0x443c61){if(_0x443c61){return _0x5b5258[_0xf194('0x18')](_0x499f96)[_0xf194('0x1a')](_0x443c61);}};}function respondWithFilteredResult(_0x2733b8,_0x46d74b){return function(_0x47dace){if(_0x47dace){var _0x322043=typeof _0x46d74b[_0xf194('0x1b')]===_0xf194('0x1c')&&typeof _0x46d74b[_0xf194('0x1d')]===_0xf194('0x1c');var _0x5a0c87=_0x47dace[_0xf194('0x1e')];var _0x8c925f=_0x322043?0x0:_0x46d74b[_0xf194('0x1b')];var _0x2f80b4=_0x322043?_0x47dace[_0xf194('0x1e')]:_0x46d74b['offset']+_0x46d74b[_0xf194('0x1d')];var _0x21fe7a;if(_0x2f80b4>=_0x5a0c87){_0x2f80b4=_0x5a0c87;_0x21fe7a=0xc8;}else{_0x21fe7a=0xce;}_0x2733b8[_0xf194('0x18')](_0x21fe7a);return _0x2733b8['set']('Content-Range',_0x8c925f+'-'+_0x2f80b4+'/'+_0x5a0c87)['json'](_0x47dace);}return null;};}function patchUpdates(_0x59d79f){return function(_0x3bc651){try{jsonpatch[_0xf194('0x1f')](_0x3bc651,_0x59d79f,!![]);}catch(_0x467b78){return BPromise['reject'](_0x467b78);}return _0x3bc651[_0xf194('0x20')]();};}function saveUpdates(_0x5b23fd,_0x4ce6cb){return function(_0x47b56a){if(_0x47b56a){return _0x47b56a['update'](_0x5b23fd)['then'](function(_0x51b31f){return _0x51b31f;});}return null;};}function removeEntity(_0x57fb15,_0x45de26){return function(_0x41c06b){if(_0x41c06b){return _0x41c06b[_0xf194('0x21')]()['then'](function(){_0x57fb15[_0xf194('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x373b10,_0x2b2928){return function(_0x33d30b){if(!_0x33d30b){_0x373b10['sendStatus'](0x194);}return _0x33d30b;};}function handleError(_0x2dc9ca,_0x3af56c){_0x3af56c=_0x3af56c||0x1f4;return function(_0x4e3052){logger[_0xf194('0x22')](_0x4e3052['stack']);if(_0x4e3052[_0xf194('0x23')]){delete _0x4e3052[_0xf194('0x23')];}_0x2dc9ca[_0xf194('0x18')](_0x3af56c)[_0xf194('0x24')](_0x4e3052);};}exports[_0xf194('0x25')]=function(_0x2eb04d,_0x935a5c){var _0x4e8923={},_0x57eb71={},_0x4dde0d={'count':0x0,'rows':[]};var _0x5eaef0=_[_0xf194('0x26')](db[_0xf194('0x27')][_0xf194('0x28')],function(_0x8cf876){return{'name':_0x8cf876[_0xf194('0x29')],'type':_0x8cf876[_0xf194('0x2a')][_0xf194('0x2b')]};});_0x57eb71[_0xf194('0x2c')]=_['map'](_0x5eaef0,_0xf194('0x23'));_0x57eb71[_0xf194('0x2d')]=_[_0xf194('0x2e')](_0x2eb04d[_0xf194('0x2d')]);_0x57eb71[_0xf194('0x2f')]=_[_0xf194('0x30')](_0x57eb71[_0xf194('0x2c')],_0x57eb71[_0xf194('0x2d')]);_0x4e8923[_0xf194('0x31')]=_['intersection'](_0x57eb71[_0xf194('0x2c')],qs[_0xf194('0x32')](_0x2eb04d[_0xf194('0x2d')][_0xf194('0x32')]));_0x4e8923['attributes']=_0x4e8923[_0xf194('0x31')][_0xf194('0x33')]?_0x4e8923['attributes']:_0x57eb71['model'];if(!_0x2eb04d[_0xf194('0x2d')][_0xf194('0x34')](_0xf194('0x35'))){_0x4e8923[_0xf194('0x1d')]=qs[_0xf194('0x1d')](_0x2eb04d[_0xf194('0x2d')]['limit']);_0x4e8923[_0xf194('0x1b')]=qs['offset'](_0x2eb04d['query']['offset']);}_0x4e8923[_0xf194('0x36')]=qs['sort'](_0x2eb04d[_0xf194('0x2d')][_0xf194('0x37')]);_0x4e8923[_0xf194('0x38')]=qs[_0xf194('0x2f')](_['pick'](_0x2eb04d['query'],_0x57eb71[_0xf194('0x2f')]),_0x5eaef0);if(_0x2eb04d[_0xf194('0x2d')][_0xf194('0x39')]){_0x4e8923[_0xf194('0x38')]=_[_0xf194('0x3a')](_0x4e8923[_0xf194('0x38')],{'$or':_[_0xf194('0x26')](_0x5eaef0,function(_0x16979b){if(_0x16979b['type']!==_0xf194('0x3b')){var _0x48c460={};_0x48c460[_0x16979b[_0xf194('0x23')]]={'$like':'%'+_0x2eb04d['query'][_0xf194('0x39')]+'%'};return _0x48c460;}})});}_0x4e8923=_['merge']({},_0x4e8923,_0x2eb04d[_0xf194('0x3c')]);var _0x4c06b0={'where':_0x4e8923[_0xf194('0x38')]};return db[_0xf194('0x27')]['count'](_0x4c06b0)[_0xf194('0x3d')](function(_0x23a597){_0x4dde0d[_0xf194('0x1e')]=_0x23a597;if(_0x2eb04d['query'][_0xf194('0x3e')]){_0x4e8923[_0xf194('0x3f')]=[{'all':!![]}];}return db[_0xf194('0x27')]['findAll'](_0x4e8923);})[_0xf194('0x3d')](function(_0x5971e6){_0x4dde0d[_0xf194('0x40')]=_0x5971e6;return _0x4dde0d;})[_0xf194('0x3d')](respondWithFilteredResult(_0x935a5c,_0x4e8923))[_0xf194('0x41')](handleError(_0x935a5c,null));};exports['show']=function(_0x39a027,_0x2c8d8c){var _0x9c3c2a={'raw':!![],'where':{'id':_0x39a027[_0xf194('0x42')]['id']}},_0x3e4807={};_0x3e4807['model']=_[_0xf194('0x2e')](db['SquareDetailsReport']['rawAttributes']);_0x3e4807[_0xf194('0x2d')]=_[_0xf194('0x2e')](_0x39a027[_0xf194('0x2d')]);_0x3e4807[_0xf194('0x2f')]=_['intersection'](_0x3e4807[_0xf194('0x2c')],_0x3e4807[_0xf194('0x2d')]);_0x9c3c2a[_0xf194('0x31')]=_[_0xf194('0x30')](_0x3e4807[_0xf194('0x2c')],qs['fields'](_0x39a027['query']['fields']));_0x9c3c2a['attributes']=_0x9c3c2a[_0xf194('0x31')][_0xf194('0x33')]?_0x9c3c2a[_0xf194('0x31')]:_0x3e4807['model'];if(_0x39a027[_0xf194('0x2d')][_0xf194('0x3e')]){_0x9c3c2a[_0xf194('0x3f')]=[{'all':!![]}];}_0x9c3c2a=_[_0xf194('0x3a')]({},_0x9c3c2a,_0x39a027[_0xf194('0x3c')]);return db[_0xf194('0x27')][_0xf194('0x43')](_0x9c3c2a)[_0xf194('0x3d')](handleEntityNotFound(_0x2c8d8c,null))[_0xf194('0x3d')](respondWithResult(_0x2c8d8c,null))[_0xf194('0x41')](handleError(_0x2c8d8c,null));};exports[_0xf194('0x44')]=function(_0x4239d4,_0xa15d50){return db[_0xf194('0x27')][_0xf194('0x44')](_0x4239d4['body'],{})[_0xf194('0x3d')](respondWithResult(_0xa15d50,0xc9))[_0xf194('0x41')](handleError(_0xa15d50,null));};exports['update']=function(_0x34b521,_0x5de3b0){if(_0x34b521[_0xf194('0x45')]['id']){delete _0x34b521[_0xf194('0x45')]['id'];}return db[_0xf194('0x27')][_0xf194('0x43')]({'where':{'id':_0x34b521['params']['id']}})['then'](handleEntityNotFound(_0x5de3b0,null))['then'](saveUpdates(_0x34b521[_0xf194('0x45')],null))[_0xf194('0x3d')](respondWithResult(_0x5de3b0,null))[_0xf194('0x41')](handleError(_0x5de3b0,null));};exports[_0xf194('0x21')]=function(_0x50fd3a,_0x55dbfc){return db[_0xf194('0x27')][_0xf194('0x43')]({'where':{'id':_0x50fd3a[_0xf194('0x42')]['id']}})[_0xf194('0x3d')](handleEntityNotFound(_0x55dbfc,null))['then'](removeEntity(_0x55dbfc,null))['catch'](handleError(_0x55dbfc,null));};exports[_0xf194('0x46')]=function(_0x4e3e65,_0x397444){return db[_0xf194('0x27')][_0xf194('0x46')]()[_0xf194('0x3d')](respondWithResult(_0x397444,null))[_0xf194('0x41')](handleError(_0x397444,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 80bf399..10f73cd 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 _0x5af9=['rimraf','../../config/environment','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x769676,_0x3a4f32){var _0xcf8b55=function(_0x4c89ae){while(--_0x4c89ae){_0x769676['push'](_0x769676['shift']());}};_0xcf8b55(++_0x3a4f32);}(_0x5af9,0x1ea));var _0x95af=function(_0x57f8c0,_0x136cf6){_0x57f8c0=_0x57f8c0-0x0;var _0x117f08=_0x5af9[_0x57f8c0];return _0x117f08;};'use strict';var _=require('lodash');var util=require(_0x95af('0x0'));var logger=require(_0x95af('0x1'))(_0x95af('0x2'));var moment=require('moment');var BPromise=require(_0x95af('0x3'));var rp=require(_0x95af('0x4'));var fs=require('fs');var path=require(_0x95af('0x5'));var rimraf=require(_0x95af('0x6'));var config=require(_0x95af('0x7'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0xb3649e,_0x5d1a87){return _0xb3649e['define']('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0303=['../../config/environment','./squareReportDetail.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5d52f5,_0x6060b){var _0x12cfaa=function(_0x2112a8){while(--_0x2112a8){_0x5d52f5['push'](_0x5d52f5['shift']());}};_0x12cfaa(++_0x6060b);}(_0x0303,0x160));var _0x3030=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x0303[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x3030('0x0'));var util=require(_0x3030('0x1'));var logger=require(_0x3030('0x2'))(_0x3030('0x3'));var moment=require(_0x3030('0x4'));var BPromise=require(_0x3030('0x5'));var rp=require(_0x3030('0x6'));var fs=require('fs');var path=require(_0x3030('0x7'));var rimraf=require('rimraf');var config=require(_0x3030('0x8'));var attributes=require(_0x3030('0x9'));module[_0x3030('0xa')]=function(_0x4fb4d6,_0x42ab48){return _0x4fb4d6[_0x3030('0xb')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','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 fa32f12..048b492 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 _0x160f=['../../config/environment','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1cf42b,_0x49e989){var _0x5edfd9=function(_0xe1b37c){while(--_0xe1b37c){_0x1cf42b['push'](_0x1cf42b['shift']());}};_0x5edfd9(++_0x49e989);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49fe49,_0x59440e,_0x41e909){return new BPromise(function(_0x5b76c8,_0x4bf890){return client['request'](_0x49fe49,_0x41e909)[_0xf160('0xc')](function(_0x90608){logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,'request\x20sent');logger['debug'](_0xf160('0xf'),_0x59440e,_0xf160('0x10'),JSON[_0xf160('0x11')](_0x90608));if(_0x90608['error']){if(_0x90608[_0xf160('0x12')][_0xf160('0x13')]===0x1f4){logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')]['message']);return _0x4bf890(_0x90608[_0xf160('0x12')]['message']);}logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')][_0xf160('0x14')]);return _0x5b76c8(_0x90608[_0xf160('0x12')][_0xf160('0x14')]);}else{logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,_0xf160('0x10'));_0x5b76c8(_0x90608['result'][_0xf160('0x14')]);}})[_0xf160('0x15')](function(_0x8699a0){logger[_0xf160('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x59440e,_0x8699a0);_0x4bf890(_0x8699a0);});});}exports[_0xf160('0x16')]=function(_0x4b8185){var _0x5388c7=this;return new Promise(function(_0x1cf6ba,_0x1e0c78){return db[_0xf160('0x17')][_0xf160('0x18')](_0x4b8185[_0xf160('0x19')],{'raw':_0x4b8185[_0xf160('0x1a')]?_0x4b8185[_0xf160('0x1a')][_0xf160('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x40ccf0){logger[_0xf160('0xd')](_0xf160('0x16'),_0x4b8185);logger['debug'](_0xf160('0x16'),_0x4b8185,JSON[_0xf160('0x11')](_0x40ccf0));_0x1cf6ba(_0x40ccf0);})[_0xf160('0x15')](function(_0x36d0cb){logger[_0xf160('0x12')](_0xf160('0x16'),_0x36d0cb[_0xf160('0x14')],_0x4b8185);_0x1e0c78(_0x5388c7['error'](0x1f4,_0x36d0cb[_0xf160('0x14')]));});});}; \ No newline at end of file +var _0xe511=['options','raw','then','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareDetailsReport','SquareDetailsReport','body'];(function(_0xda6ad1,_0x5f09e3){var _0xedc3a5=function(_0x5459d7){while(--_0x5459d7){_0xda6ad1['push'](_0xda6ad1['shift']());}};_0xedc3a5(++_0x5f09e3);}(_0xe511,0x16f));var _0x1e51=function(_0x45e064,_0x411c6a){_0x45e064=_0x45e064-0x0;var _0x1c1ee4=_0xe511[_0x45e064];return _0x1c1ee4;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var moment=require('moment');var BPromise=require(_0x1e51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e51('0x3'));var db=require(_0x1e51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e51('0x5'))(_0x1e51('0x6'));var config=require(_0x1e51('0x7'));var jayson=require(_0x1e51('0x8'));var client=jayson['client'][_0x1e51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21ed6b,_0x5c4590,_0x4fa2ba){return new BPromise(function(_0x394ad8,_0x133021){return client['request'](_0x21ed6b,_0x4fa2ba)['then'](function(_0x658941){logger[_0x1e51('0xa')](_0x1e51('0xb'),_0x5c4590,_0x1e51('0xc'));logger[_0x1e51('0xd')](_0x1e51('0xe'),_0x5c4590,'request\x20sent',JSON[_0x1e51('0xf')](_0x658941));if(_0x658941[_0x1e51('0x10')]){if(_0x658941[_0x1e51('0x10')][_0x1e51('0x11')]===0x1f4){logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941['error'][_0x1e51('0x12')]);return _0x133021(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);return _0x394ad8(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}else{logger[_0x1e51('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x5c4590,_0x1e51('0xc'));_0x394ad8(_0x658941[_0x1e51('0x13')][_0x1e51('0x12')]);}})['catch'](function(_0xa3b410){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x5c4590,_0xa3b410);_0x133021(_0xa3b410);});});}exports[_0x1e51('0x14')]=function(_0x27dcad){var _0x40ae4c=this;return new Promise(function(_0x4785a5,_0x4d1aae){return db[_0x1e51('0x15')]['create'](_0x27dcad[_0x1e51('0x16')],{'raw':_0x27dcad['options']?_0x27dcad[_0x1e51('0x17')][_0x1e51('0x18')]===undefined?!![]:![]:!![]})[_0x1e51('0x19')](function(_0x183a95){logger['info']('CreateSquareDetailsReport',_0x27dcad);logger['debug']('CreateSquareDetailsReport',_0x27dcad,JSON[_0x1e51('0xf')](_0x183a95));_0x4785a5(_0x183a95);})['catch'](function(_0x3f7340){logger[_0x1e51('0x10')](_0x1e51('0x14'),_0x3f7340[_0x1e51('0x12')],_0x27dcad);_0x4d1aae(_0x40ae4c[_0x1e51('0x10')](0x1f4,_0x3f7340[_0x1e51('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 0fdacd6..2e7caf4 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 _0xe868=['./system.controller','get','index','/process/:pid/kill','isAuthenticated','../../components/auth/service'];(function(_0x3e9543,_0x576616){var _0x1ae117=function(_0x3c9ced){while(--_0x3c9ced){_0x3e9543['push'](_0x3e9543['shift']());}};_0x1ae117(++_0x576616);}(_0xe868,0x12b));var _0x8e86=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe868[_0x20a584];return _0x4b41a8;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x8e86('0x0'));var controller=require(_0x8e86('0x1'));router[_0x8e86('0x2')]('/',auth['isAuthenticated'](),controller[_0x8e86('0x3')]);router[_0x8e86('0x2')](_0x8e86('0x4'),auth[_0x8e86('0x5')](),controller['killProcess']);module['exports']=router; \ No newline at end of file +var _0xbc79=['Router','../../components/auth/service','./system.controller','isAuthenticated','index','get','/process/:pid/kill','killProcess'];(function(_0x557de3,_0x576d35){var _0x3344e2=function(_0x1d60dd){while(--_0x1d60dd){_0x557de3['push'](_0x557de3['shift']());}};_0x3344e2(++_0x576d35);}(_0xbc79,0x190));var _0x9bc7=function(_0x95bc9d,_0x322ef3){_0x95bc9d=_0x95bc9d-0x0;var _0x1db979=_0xbc79[_0x95bc9d];return _0x1db979;};'use strict';var express=require('express');var router=express[_0x9bc7('0x0')]();var auth=require(_0x9bc7('0x1'));var controller=require(_0x9bc7('0x2'));router['get']('/',auth[_0x9bc7('0x3')](),controller[_0x9bc7('0x4')]);router[_0x9bc7('0x5')](_0x9bc7('0x6'),auth['isAuthenticated'](),controller[_0x9bc7('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 26e30e0..12aef82 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 _0xd92c=['Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','getAllData','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT'];(function(_0x2484e6,_0x2cbe6c){var _0x20efaf=function(_0x15499e){while(--_0x15499e){_0x2484e6['push'](_0x2484e6['shift']());}};_0x20efaf(++_0x2cbe6c);}(_0xd92c,0x69));var _0xcd92=function(_0x5a0496,_0x2c8c2c){_0x5a0496=_0x5a0496-0x0;var _0x5b0d3d=_0xd92c[_0x5a0496];return _0x5b0d3d;};'use strict';var info=require(_0xcd92('0x0'));var exec=require(_0xcd92('0x1'))[_0xcd92('0x2')];var logger=require('../../config/logger')(_0xcd92('0x3'));var util=require(_0xcd92('0x4'));var BPromise=require(_0xcd92('0x5'));var _=require(_0xcd92('0x6'));function handleError(_0x52b4a8,_0x452447,_0x1860d8){_0x452447=_0x452447||0x1f4;return function(_0x497b14){logger['error'](_0xcd92('0x7'),_0x1860d8,_0x452447,util[_0xcd92('0x8')](_0x497b14,{'showHidden':![],'depth':null}));delete _0x497b14['name'];_0x52b4a8[_0xcd92('0x9')](_0x452447)[_0xcd92('0xa')](_0x497b14);};}exports[_0xcd92('0xb')]=function(_0x1419e7,_0x109d48){return info[_0xcd92('0xc')]()[_0xcd92('0xd')](function(_0x17f93c){return _0x109d48['status'](0xc8)[_0xcd92('0xe')](_0x17f93c);})[_0xcd92('0xf')](function(_0x573877){return _0x109d48['status'](0x1f4)['json'](_0x573877);});};exports[_0xcd92('0x10')]=function(_0x382375,_0x7653b6){var _0x1aa813=['components/import/cm'];return new BPromise(function(_0x18185f,_0x203764){return exec(util[_0xcd92('0x11')](_0xcd92('0x12'),_0x382375[_0xcd92('0x13')][_0xcd92('0x14')]),function(_0x32cacf,_0x43ee97,_0x52a7aa){if(_0x32cacf){return _0x203764(_0x32cacf);}return _0x18185f(_0x43ee97);});})[_0xcd92('0xd')](function(_0x5a82be){var _0x4c2df8=![];var _0xd58ced=_0x5a82be[_0xcd92('0x15')](/\n/);for(var _0x43fc62=0x0,_0x43fb50=_0x1aa813['length'];_0x43fc62<_0x43fb50,_0x4c2df8===![];_0x43fc62+=0x1){if(_0x5a82be['indexOf'](_0x1aa813[_0x43fc62])>=0x0){_0x4c2df8=!![];}}if(!_0x4c2df8){throw new Error(util[_0xcd92('0x11')](_0xcd92('0x16'),_0x382375[_0xcd92('0x13')][_0xcd92('0x14')]));}process[_0xcd92('0x17')](_0x382375[_0xcd92('0x13')]['pid'],_0xcd92('0x18'));return _0x7653b6[_0xcd92('0x9')](0xc8)[_0xcd92('0xe')]({'message':util['format'](_0xcd92('0x19'),_0x382375[_0xcd92('0x13')][_0xcd92('0x14')])});})[_0xcd92('0xf')](handleError(_0x7653b6,null,_0xcd92('0x10')));}; \ No newline at end of file +var _0x2f05=['indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','index','getAllData','status','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length'];(function(_0x44a7f0,_0x34a384){var _0x4e6461=function(_0x28fe5b){while(--_0x28fe5b){_0x44a7f0['push'](_0x44a7f0['shift']());}};_0x4e6461(++_0x34a384);}(_0x2f05,0x1b4));var _0x52f0=function(_0x5495cc,_0x3ead4d){_0x5495cc=_0x5495cc-0x0;var _0x137dec=_0x2f05[_0x5495cc];return _0x137dec;};'use strict';var info=require(_0x52f0('0x0'));var exec=require(_0x52f0('0x1'))[_0x52f0('0x2')];var logger=require('../../config/logger')(_0x52f0('0x3'));var util=require(_0x52f0('0x4'));var BPromise=require(_0x52f0('0x5'));var _=require(_0x52f0('0x6'));function handleError(_0x13d888,_0x57feee,_0x25e5ea){_0x57feee=_0x57feee||0x1f4;return function(_0x5a5803){logger[_0x52f0('0x7')](_0x52f0('0x8'),_0x25e5ea,_0x57feee,util['inspect'](_0x5a5803,{'showHidden':![],'depth':null}));delete _0x5a5803['name'];_0x13d888['status'](_0x57feee)['send'](_0x5a5803);};}exports[_0x52f0('0x9')]=function(_0xe312da,_0x1c9685){return info[_0x52f0('0xa')]()['then'](function(_0x463ef0){return _0x1c9685[_0x52f0('0xb')](0xc8)[_0x52f0('0xc')](_0x463ef0);})[_0x52f0('0xd')](function(_0x292884){return _0x1c9685['status'](0x1f4)['json'](_0x292884);});};exports[_0x52f0('0xe')]=function(_0x450cd5,_0x1f384e){var _0x216ff7=['components/import/cm'];return new BPromise(function(_0x40ebc5,_0x93cdbe){return exec(util[_0x52f0('0xf')](_0x52f0('0x10'),_0x450cd5[_0x52f0('0x11')][_0x52f0('0x12')]),function(_0x2cd79d,_0x39df77,_0x36a78d){if(_0x2cd79d){return _0x93cdbe(_0x2cd79d);}return _0x40ebc5(_0x39df77);});})['then'](function(_0x2ebb8d){var _0x8d6104=![];var _0x3dc089=_0x2ebb8d['split'](/\n/);for(var _0x3f6c59=0x0,_0x1deebe=_0x216ff7[_0x52f0('0x13')];_0x3f6c59<_0x1deebe,_0x8d6104===![];_0x3f6c59+=0x1){if(_0x2ebb8d[_0x52f0('0x14')](_0x216ff7[_0x3f6c59])>=0x0){_0x8d6104=!![];}}if(!_0x8d6104){throw new Error(util[_0x52f0('0xf')](_0x52f0('0x15'),_0x450cd5[_0x52f0('0x11')]['pid']));}process[_0x52f0('0x16')](_0x450cd5[_0x52f0('0x11')][_0x52f0('0x12')],'SIGINT');return _0x1f384e[_0x52f0('0xb')](0xc8)[_0x52f0('0xc')]({'message':util[_0x52f0('0xf')](_0x52f0('0x17'),_0x450cd5['params'][_0x52f0('0x12')])});})[_0x52f0('0xd')](handleError(_0x1f384e,null,_0x52f0('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 31433a6..7bdf646 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 _0x4522=['../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','path','connect-timeout','express','fs-extra'];(function(_0x5341a0,_0x15fe41){var _0x5cecaf=function(_0x5728b0){while(--_0x5728b0){_0x5341a0['push'](_0x5341a0['shift']());}};_0x5cecaf(++_0x15fe41);}(_0x4522,0x1a0));var _0x2452=function(_0xcbeeb,_0x3035e2){_0xcbeeb=_0xcbeeb-0x0;var _0x4dc3c9=_0x4522[_0xcbeeb];return _0x4dc3c9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2452('0x0'));var timeout=require(_0x2452('0x1'));var express=require(_0x2452('0x2'));var router=express['Router']();var fs_extra=require(_0x2452('0x3'));var auth=require(_0x2452('0x4'));var interaction=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var controller=require(_0x2452('0x7'));router[_0x2452('0x8')]('/',auth[_0x2452('0x9')](),controller[_0x2452('0xa')]);router[_0x2452('0x8')](_0x2452('0xb'),auth[_0x2452('0x9')](),controller[_0x2452('0xc')]);router[_0x2452('0x8')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2452('0xf')]);router['put']('/:id',auth[_0x2452('0x9')](),controller[_0x2452('0x10')]);router[_0x2452('0x11')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0x12')]);module[_0x2452('0x13')]=router; \ No newline at end of file +var _0xf3cd=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update'];(function(_0x4c9399,_0x318a2f){var _0xab0d9b=function(_0x583458){while(--_0x583458){_0x4c9399['push'](_0x4c9399['shift']());}};_0xab0d9b(++_0x318a2f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x54dcad,_0x554f46){_0x54dcad=_0x54dcad-0x0;var _0x537c56=_0xf3cd[_0x54dcad];return _0x537c56;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdf3c('0x6'));var interaction=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var controller=require('./tag.controller');router[_0xdf3c('0x9')]('/',auth[_0xdf3c('0xa')](),controller[_0xdf3c('0xb')]);router[_0xdf3c('0x9')](_0xdf3c('0xc'),auth[_0xdf3c('0xa')](),controller['describe']);router[_0xdf3c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0xe')]('/',auth['isAuthenticated'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x10')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller[_0xdf3c('0x12')]);router[_0xdf3c('0x13')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller['destroy']);module[_0xdf3c('0x14')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index b0ac995..c38c339 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 _0x12c9=['STRING','sequelize'];(function(_0xd8faec,_0x530c8e){var _0x38f309=function(_0x569912){while(--_0x569912){_0xd8faec['push'](_0xd8faec['shift']());}};_0x38f309(++_0x530c8e);}(_0x12c9,0x9f));var _0x912c=function(_0x1ed268,_0x4a8d17){_0x1ed268=_0x1ed268-0x0;var _0xd12213=_0x12c9[_0x1ed268];return _0xd12213;};'use strict';var Sequelize=require(_0x912c('0x0'));module['exports']={'name':{'type':Sequelize[_0x912c('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x912c('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x912c('0x1')]}}; \ No newline at end of file +var _0xaf60=['STRING','#0091EA','sequelize','exports'];(function(_0x3794a0,_0x1a9cfc){var _0x5bdaba=function(_0x14a764){while(--_0x14a764){_0x3794a0['push'](_0x3794a0['shift']());}};_0x5bdaba(++_0x1a9cfc);}(_0xaf60,0x82));var _0x0af6=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xaf60[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x0af6('0x0'));module[_0x0af6('0x1')]={'name':{'type':Sequelize[_0x0af6('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x0af6('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 0faf1f0..f4739db 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 _0x9e0c=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','rimraf','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','reject','save','update','then','Tags','destroy','stack','name','send','index','map','Tag','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','rawAttributes','keys','length','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource'];(function(_0x2cece8,_0x2be951){var _0x6613e7=function(_0x25394f){while(--_0x25394f){_0x2cece8['push'](_0x2cece8['shift']());}};_0x6613e7(++_0x2be951);}(_0x9e0c,0xfc));var _0xc9e0=function(_0x21335e,_0x4e6a46){_0x21335e=_0x21335e-0x0;var _0x445bad=_0x9e0c[_0x21335e];return _0x445bad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc9e0('0x0'));var zipdir=require(_0xc9e0('0x1'));var jsonpatch=require(_0xc9e0('0x2'));var rp=require(_0xc9e0('0x3'));var moment=require(_0xc9e0('0x4'));var BPromise=require(_0xc9e0('0x5'));var Mustache=require(_0xc9e0('0x6'));var util=require(_0xc9e0('0x7'));var path=require('path');var sox=require(_0xc9e0('0x8'));var csv=require(_0xc9e0('0x9'));var ejs=require(_0xc9e0('0xa'));var fs=require('fs');var fs_extra=require(_0xc9e0('0xb'));var _=require(_0xc9e0('0xc'));var squel=require(_0xc9e0('0xd'));var crypto=require(_0xc9e0('0xe'));var jsforce=require(_0xc9e0('0xf'));var deskjs=require(_0xc9e0('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc9e0('0x11'));var Papa=require(_0xc9e0('0x12'));var Redis=require(_0xc9e0('0x13'));var authService=require(_0xc9e0('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc9e0('0x15'));var utils=require(_0xc9e0('0x16'));var config=require(_0xc9e0('0x17'));var licenseUtil=require(_0xc9e0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c9b6e,_0x48591d){_0x48591d=_0x48591d||0xcc;return function(_0x23c6b2){if(_0x23c6b2){return _0x4c9b6e[_0xc9e0('0x19')](_0x48591d);}return _0x4c9b6e[_0xc9e0('0x1a')](_0x48591d)[_0xc9e0('0x1b')]();};}function respondWithResult(_0x40bda8,_0x6a30b7){_0x6a30b7=_0x6a30b7||0xc8;return function(_0x50f586){if(_0x50f586){return _0x40bda8[_0xc9e0('0x1a')](_0x6a30b7)[_0xc9e0('0x1c')](_0x50f586);}};}function respondWithFilteredResult(_0x3654f4,_0x1ed94f){return function(_0x1d8f6f){if(_0x1d8f6f){var _0x3cc4ed=typeof _0x1ed94f['offset']===_0xc9e0('0x1d')&&typeof _0x1ed94f['limit']===_0xc9e0('0x1d');var _0x1074ec=_0x1d8f6f[_0xc9e0('0x1e')];var _0x566853=_0x3cc4ed?0x0:_0x1ed94f[_0xc9e0('0x1f')];var _0x5bbb33=_0x3cc4ed?_0x1d8f6f[_0xc9e0('0x1e')]:_0x1ed94f[_0xc9e0('0x1f')]+_0x1ed94f[_0xc9e0('0x20')];var _0x51f25b;if(_0x5bbb33>=_0x1074ec){_0x5bbb33=_0x1074ec;_0x51f25b=0xc8;}else{_0x51f25b=0xce;}_0x3654f4['status'](_0x51f25b);return _0x3654f4['set'](_0xc9e0('0x21'),_0x566853+'-'+_0x5bbb33+'/'+_0x1074ec)[_0xc9e0('0x1c')](_0x1d8f6f);}return null;};}function patchUpdates(_0x438c13){return function(_0x3e0a78){try{jsonpatch['apply'](_0x3e0a78,_0x438c13,!![]);}catch(_0x17cf26){return BPromise[_0xc9e0('0x22')](_0x17cf26);}return _0x3e0a78[_0xc9e0('0x23')]();};}function saveUpdates(_0x5c0a71,_0x35e3ab){return function(_0x3ffab4){if(_0x3ffab4){return _0x3ffab4[_0xc9e0('0x24')](_0x5c0a71)[_0xc9e0('0x25')](function(_0x54d316){return _0x54d316;});}return null;};}function removeEntity(_0x218eae,_0x5ca4ec){return function(_0x283c58){if(_0x283c58){return _0x283c58['destroy']()[_0xc9e0('0x25')](function(){var _0x3526ad=_0x283c58['get']({'plain':!![]});var _0xecde3f=_0xc9e0('0x26');return db['UserProfileResource'][_0xc9e0('0x27')]({'where':{'type':_0xecde3f,'resourceId':_0x3526ad['id']}})[_0xc9e0('0x25')](function(){return _0x283c58;});})[_0xc9e0('0x25')](function(){_0x218eae[_0xc9e0('0x1a')](0xcc)[_0xc9e0('0x1b')]();});}};}function handleEntityNotFound(_0x21c551,_0x9bcd90){return function(_0x434deb){if(!_0x434deb){_0x21c551[_0xc9e0('0x19')](0x194);}return _0x434deb;};}function handleError(_0x273e0e,_0x22873e){_0x22873e=_0x22873e||0x1f4;return function(_0xe92a10){logger['error'](_0xe92a10[_0xc9e0('0x28')]);if(_0xe92a10[_0xc9e0('0x29')]){delete _0xe92a10['name'];}_0x273e0e[_0xc9e0('0x1a')](_0x22873e)[_0xc9e0('0x2a')](_0xe92a10);};}exports[_0xc9e0('0x2b')]=function(_0x444cff,_0x3da5ba){var _0x569fea={},_0xde2241={},_0x43342e={'count':0x0,'rows':[]};var _0x48586a=_[_0xc9e0('0x2c')](db[_0xc9e0('0x2d')]['rawAttributes'],function(_0x503fe9){return{'name':_0x503fe9[_0xc9e0('0x2e')],'type':_0x503fe9['type'][_0xc9e0('0x2f')]};});_0xde2241[_0xc9e0('0x30')]=_[_0xc9e0('0x2c')](_0x48586a,'name');_0xde2241[_0xc9e0('0x31')]=_['keys'](_0x444cff[_0xc9e0('0x31')]);_0xde2241['filters']=_[_0xc9e0('0x32')](_0xde2241[_0xc9e0('0x30')],_0xde2241[_0xc9e0('0x31')]);_0x569fea[_0xc9e0('0x33')]=_[_0xc9e0('0x32')](_0xde2241['model'],qs[_0xc9e0('0x34')](_0x444cff['query'][_0xc9e0('0x34')]));_0x569fea['attributes']=_0x569fea[_0xc9e0('0x33')]['length']?_0x569fea[_0xc9e0('0x33')]:_0xde2241[_0xc9e0('0x30')];if(!_0x444cff[_0xc9e0('0x31')][_0xc9e0('0x35')]('nolimit')){_0x569fea[_0xc9e0('0x20')]=qs[_0xc9e0('0x20')](_0x444cff[_0xc9e0('0x31')]['limit']);_0x569fea[_0xc9e0('0x1f')]=qs['offset'](_0x444cff['query'][_0xc9e0('0x1f')]);}_0x569fea['order']=qs['sort'](_0x444cff[_0xc9e0('0x31')][_0xc9e0('0x36')]);_0x569fea[_0xc9e0('0x37')]=qs[_0xc9e0('0x38')](_[_0xc9e0('0x39')](_0x444cff['query'],_0xde2241['filters']),_0x48586a);if(_0x444cff['query'][_0xc9e0('0x3a')]){_0x569fea[_0xc9e0('0x37')]=_[_0xc9e0('0x3b')](_0x569fea['where'],{'$or':_[_0xc9e0('0x2c')](_0x48586a,function(_0x226a24){if(_0x226a24[_0xc9e0('0x3c')]!=='VIRTUAL'){var _0xa5ba43={};_0xa5ba43[_0x226a24[_0xc9e0('0x29')]]={'$like':'%'+_0x444cff['query'][_0xc9e0('0x3a')]+'%'};return _0xa5ba43;}})});}_0x569fea=_[_0xc9e0('0x3b')]({},_0x569fea,_0x444cff[_0xc9e0('0x3d')]);var _0x23a8df={'where':_0x569fea[_0xc9e0('0x37')]};return db[_0xc9e0('0x2d')][_0xc9e0('0x1e')](_0x23a8df)[_0xc9e0('0x25')](function(_0xae1e27){_0x43342e[_0xc9e0('0x1e')]=_0xae1e27;if(_0x444cff['query'][_0xc9e0('0x3e')]){_0x569fea[_0xc9e0('0x3f')]=[{'all':!![]}];}return db['Tag'][_0xc9e0('0x40')](_0x569fea);})[_0xc9e0('0x25')](function(_0x753f6c){_0x43342e['rows']=_0x753f6c;return _0x43342e;})[_0xc9e0('0x25')](respondWithFilteredResult(_0x3da5ba,_0x569fea))[_0xc9e0('0x41')](handleError(_0x3da5ba,null));};exports[_0xc9e0('0x42')]=function(_0x3f99ed,_0x1fd7c5){var _0x1a75ed={'raw':!![],'where':{'id':_0x3f99ed['params']['id']}},_0x18b9d0={};_0x18b9d0[_0xc9e0('0x30')]=_['keys'](db[_0xc9e0('0x2d')][_0xc9e0('0x43')]);_0x18b9d0[_0xc9e0('0x31')]=_[_0xc9e0('0x44')](_0x3f99ed[_0xc9e0('0x31')]);_0x18b9d0[_0xc9e0('0x38')]=_[_0xc9e0('0x32')](_0x18b9d0[_0xc9e0('0x30')],_0x18b9d0[_0xc9e0('0x31')]);_0x1a75ed['attributes']=_[_0xc9e0('0x32')](_0x18b9d0[_0xc9e0('0x30')],qs['fields'](_0x3f99ed[_0xc9e0('0x31')][_0xc9e0('0x34')]));_0x1a75ed[_0xc9e0('0x33')]=_0x1a75ed[_0xc9e0('0x33')][_0xc9e0('0x45')]?_0x1a75ed['attributes']:_0x18b9d0['model'];if(_0x3f99ed['query'][_0xc9e0('0x3e')]){_0x1a75ed[_0xc9e0('0x3f')]=[{'all':!![]}];}_0x1a75ed=_['merge']({},_0x1a75ed,_0x3f99ed[_0xc9e0('0x3d')]);return db['Tag'][_0xc9e0('0x46')](_0x1a75ed)[_0xc9e0('0x25')](handleEntityNotFound(_0x1fd7c5,null))[_0xc9e0('0x25')](respondWithResult(_0x1fd7c5,null))[_0xc9e0('0x41')](handleError(_0x1fd7c5,null));};exports['create']=function(_0x45c78d,_0x3e7f05){return db[_0xc9e0('0x2d')]['create'](_0x45c78d[_0xc9e0('0x47')],{})['then'](function(_0x365359){var _0xfd9e95=_0x45c78d[_0xc9e0('0x48')][_0xc9e0('0x49')]({'plain':!![]});if(!_0xfd9e95)throw new Error(_0xc9e0('0x4a'));if(_0xfd9e95[_0xc9e0('0x4b')]===_0xc9e0('0x48')){var _0x4094e3=_0x365359[_0xc9e0('0x49')]({'plain':!![]});var _0x5d8892=_0xc9e0('0x26');return db[_0xc9e0('0x4c')][_0xc9e0('0x46')]({'where':{'name':_0x5d8892,'userProfileId':_0xfd9e95[_0xc9e0('0x4d')]},'raw':!![]})['then'](function(_0x37f815){if(_0x37f815&&_0x37f815[_0xc9e0('0x4e')]===0x0){return db[_0xc9e0('0x4f')]['create']({'name':_0x4094e3[_0xc9e0('0x29')],'resourceId':_0x4094e3['id'],'type':_0x37f815[_0xc9e0('0x29')],'sectionId':_0x37f815['id']},{})[_0xc9e0('0x25')](function(){return _0x365359;});}else{return _0x365359;}})['catch'](function(_0x23ba68){logger['error'](_0xc9e0('0x50'),_0x23ba68);throw _0x23ba68;});}return _0x365359;})[_0xc9e0('0x25')](respondWithResult(_0x3e7f05,0xc9))[_0xc9e0('0x41')](handleError(_0x3e7f05,null));};exports['update']=function(_0x224e3e,_0x2ca798){if(_0x224e3e[_0xc9e0('0x47')]['id']){delete _0x224e3e[_0xc9e0('0x47')]['id'];}return db[_0xc9e0('0x2d')][_0xc9e0('0x46')]({'where':{'id':_0x224e3e[_0xc9e0('0x51')]['id']}})[_0xc9e0('0x25')](handleEntityNotFound(_0x2ca798,null))['then'](saveUpdates(_0x224e3e[_0xc9e0('0x47')],null))[_0xc9e0('0x25')](respondWithResult(_0x2ca798,null))[_0xc9e0('0x41')](handleError(_0x2ca798,null));};exports[_0xc9e0('0x27')]=function(_0xdf5486,_0x111b6a){return db[_0xc9e0('0x2d')][_0xc9e0('0x46')]({'where':{'id':_0xdf5486['params']['id']}})[_0xc9e0('0x25')](handleEntityNotFound(_0x111b6a,null))['then'](removeEntity(_0x111b6a,null))[_0xc9e0('0x41')](handleError(_0x111b6a,null));};exports[_0xc9e0('0x52')]=function(_0x16fa60,_0x4bb523){return db[_0xc9e0('0x2d')]['describe']()[_0xc9e0('0x25')](respondWithResult(_0x4bb523,null))[_0xc9e0('0x41')](handleError(_0x4bb523,null));}; \ No newline at end of file +var _0x3a20=['../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','json','apply','reject','then','destroy','Tags','UserProfileResource','end','stack','name','send','Tag','key','map','keys','query','intersection','model','attributes','fields','nolimit','order','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','eml-format','rimraf','zip-dir','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x3d1da0,_0x397e58){var _0x5b2cac=function(_0x4f4925){while(--_0x4f4925){_0x3d1da0['push'](_0x3d1da0['shift']());}};_0x5b2cac(++_0x397e58);}(_0x3a20,0x126));var _0x03a2=function(_0x169a0b,_0x4f4574){_0x169a0b=_0x169a0b-0x0;var _0x8ce8e1=_0x3a20[_0x169a0b];return _0x8ce8e1;};'use strict';var emlformat=require(_0x03a2('0x0'));var rimraf=require(_0x03a2('0x1'));var zipdir=require(_0x03a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03a2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x03a2('0x4'));var sox=require(_0x03a2('0x5'));var csv=require(_0x03a2('0x6'));var ejs=require(_0x03a2('0x7'));var fs=require('fs');var fs_extra=require(_0x03a2('0x8'));var _=require(_0x03a2('0x9'));var squel=require(_0x03a2('0xa'));var crypto=require('crypto');var jsforce=require(_0x03a2('0xb'));var deskjs=require(_0x03a2('0xc'));var toCsv=require(_0x03a2('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x03a2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x03a2('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x03a2('0xf'))(_0x03a2('0x10'));var utils=require(_0x03a2('0x11'));var config=require(_0x03a2('0x12'));var licenseUtil=require(_0x03a2('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a518a,_0x145474){_0x145474=_0x145474||0xcc;return function(_0x302425){if(_0x302425){return _0x2a518a[_0x03a2('0x14')](_0x145474);}return _0x2a518a[_0x03a2('0x15')](_0x145474)['end']();};}function respondWithResult(_0x13f4f8,_0x19b628){_0x19b628=_0x19b628||0xc8;return function(_0x23bdde){if(_0x23bdde){return _0x13f4f8[_0x03a2('0x15')](_0x19b628)['json'](_0x23bdde);}};}function respondWithFilteredResult(_0xac980d,_0x3ea322){return function(_0x4396d3){if(_0x4396d3){var _0x4479d3=typeof _0x3ea322[_0x03a2('0x16')]===_0x03a2('0x17')&&typeof _0x3ea322[_0x03a2('0x18')]===_0x03a2('0x17');var _0x55b6c7=_0x4396d3[_0x03a2('0x19')];var _0x10ef1d=_0x4479d3?0x0:_0x3ea322['offset'];var _0x24fa66=_0x4479d3?_0x4396d3[_0x03a2('0x19')]:_0x3ea322['offset']+_0x3ea322[_0x03a2('0x18')];var _0xd66e97;if(_0x24fa66>=_0x55b6c7){_0x24fa66=_0x55b6c7;_0xd66e97=0xc8;}else{_0xd66e97=0xce;}_0xac980d[_0x03a2('0x15')](_0xd66e97);return _0xac980d['set']('Content-Range',_0x10ef1d+'-'+_0x24fa66+'/'+_0x55b6c7)[_0x03a2('0x1a')](_0x4396d3);}return null;};}function patchUpdates(_0x9f1fcb){return function(_0xb7e979){try{jsonpatch[_0x03a2('0x1b')](_0xb7e979,_0x9f1fcb,!![]);}catch(_0xde28cf){return BPromise[_0x03a2('0x1c')](_0xde28cf);}return _0xb7e979['save']();};}function saveUpdates(_0x402f4c,_0x1add73){return function(_0x53036e){if(_0x53036e){return _0x53036e['update'](_0x402f4c)[_0x03a2('0x1d')](function(_0x2bd7b3){return _0x2bd7b3;});}return null;};}function removeEntity(_0x3dcc68,_0x19be18){return function(_0x753e16){if(_0x753e16){return _0x753e16[_0x03a2('0x1e')]()[_0x03a2('0x1d')](function(){var _0x4f3b7b=_0x753e16['get']({'plain':!![]});var _0x35283a=_0x03a2('0x1f');return db[_0x03a2('0x20')][_0x03a2('0x1e')]({'where':{'type':_0x35283a,'resourceId':_0x4f3b7b['id']}})[_0x03a2('0x1d')](function(){return _0x753e16;});})[_0x03a2('0x1d')](function(){_0x3dcc68[_0x03a2('0x15')](0xcc)[_0x03a2('0x21')]();});}};}function handleEntityNotFound(_0x429d82,_0xefce62){return function(_0x39b348){if(!_0x39b348){_0x429d82['sendStatus'](0x194);}return _0x39b348;};}function handleError(_0x54e18d,_0x5350ef){_0x5350ef=_0x5350ef||0x1f4;return function(_0x5bb4f0){logger['error'](_0x5bb4f0[_0x03a2('0x22')]);if(_0x5bb4f0[_0x03a2('0x23')]){delete _0x5bb4f0['name'];}_0x54e18d['status'](_0x5350ef)[_0x03a2('0x24')](_0x5bb4f0);};}exports['index']=function(_0x64a039,_0x2368cb){var _0x5911f4={},_0x317383={},_0x109f64={'count':0x0,'rows':[]};var _0x1bd3c7=_['map'](db[_0x03a2('0x25')]['rawAttributes'],function(_0x18b0a5){return{'name':_0x18b0a5['fieldName'],'type':_0x18b0a5['type'][_0x03a2('0x26')]};});_0x317383['model']=_[_0x03a2('0x27')](_0x1bd3c7,_0x03a2('0x23'));_0x317383['query']=_[_0x03a2('0x28')](_0x64a039[_0x03a2('0x29')]);_0x317383['filters']=_[_0x03a2('0x2a')](_0x317383[_0x03a2('0x2b')],_0x317383['query']);_0x5911f4[_0x03a2('0x2c')]=_[_0x03a2('0x2a')](_0x317383['model'],qs[_0x03a2('0x2d')](_0x64a039[_0x03a2('0x29')]['fields']));_0x5911f4['attributes']=_0x5911f4[_0x03a2('0x2c')]['length']?_0x5911f4[_0x03a2('0x2c')]:_0x317383[_0x03a2('0x2b')];if(!_0x64a039[_0x03a2('0x29')]['hasOwnProperty'](_0x03a2('0x2e'))){_0x5911f4[_0x03a2('0x18')]=qs[_0x03a2('0x18')](_0x64a039[_0x03a2('0x29')][_0x03a2('0x18')]);_0x5911f4['offset']=qs[_0x03a2('0x16')](_0x64a039[_0x03a2('0x29')][_0x03a2('0x16')]);}_0x5911f4[_0x03a2('0x2f')]=qs['sort'](_0x64a039[_0x03a2('0x29')]['sort']);_0x5911f4[_0x03a2('0x30')]=qs[_0x03a2('0x31')](_[_0x03a2('0x32')](_0x64a039[_0x03a2('0x29')],_0x317383[_0x03a2('0x31')]),_0x1bd3c7);if(_0x64a039[_0x03a2('0x29')][_0x03a2('0x33')]){_0x5911f4[_0x03a2('0x30')]=_[_0x03a2('0x34')](_0x5911f4[_0x03a2('0x30')],{'$or':_[_0x03a2('0x27')](_0x1bd3c7,function(_0x561a27){if(_0x561a27[_0x03a2('0x35')]!==_0x03a2('0x36')){var _0x194003={};_0x194003[_0x561a27['name']]={'$like':'%'+_0x64a039[_0x03a2('0x29')][_0x03a2('0x33')]+'%'};return _0x194003;}})});}_0x5911f4=_[_0x03a2('0x34')]({},_0x5911f4,_0x64a039[_0x03a2('0x37')]);var _0x5b2c94={'where':_0x5911f4[_0x03a2('0x30')]};return db[_0x03a2('0x25')][_0x03a2('0x19')](_0x5b2c94)['then'](function(_0x2cf1c1){_0x109f64[_0x03a2('0x19')]=_0x2cf1c1;if(_0x64a039[_0x03a2('0x29')][_0x03a2('0x38')]){_0x5911f4[_0x03a2('0x39')]=[{'all':!![]}];}return db[_0x03a2('0x25')][_0x03a2('0x3a')](_0x5911f4);})[_0x03a2('0x1d')](function(_0x1e85ec){_0x109f64[_0x03a2('0x3b')]=_0x1e85ec;return _0x109f64;})[_0x03a2('0x1d')](respondWithFilteredResult(_0x2368cb,_0x5911f4))[_0x03a2('0x3c')](handleError(_0x2368cb,null));};exports[_0x03a2('0x3d')]=function(_0x26bbfe,_0x40d895){var _0x18b1f4={'raw':!![],'where':{'id':_0x26bbfe[_0x03a2('0x3e')]['id']}},_0x5883a3={};_0x5883a3[_0x03a2('0x2b')]=_['keys'](db[_0x03a2('0x25')][_0x03a2('0x3f')]);_0x5883a3[_0x03a2('0x29')]=_[_0x03a2('0x28')](_0x26bbfe[_0x03a2('0x29')]);_0x5883a3[_0x03a2('0x31')]=_[_0x03a2('0x2a')](_0x5883a3[_0x03a2('0x2b')],_0x5883a3[_0x03a2('0x29')]);_0x18b1f4[_0x03a2('0x2c')]=_[_0x03a2('0x2a')](_0x5883a3['model'],qs['fields'](_0x26bbfe['query'][_0x03a2('0x2d')]));_0x18b1f4[_0x03a2('0x2c')]=_0x18b1f4[_0x03a2('0x2c')][_0x03a2('0x40')]?_0x18b1f4[_0x03a2('0x2c')]:_0x5883a3['model'];if(_0x26bbfe[_0x03a2('0x29')][_0x03a2('0x38')]){_0x18b1f4['include']=[{'all':!![]}];}_0x18b1f4=_[_0x03a2('0x34')]({},_0x18b1f4,_0x26bbfe[_0x03a2('0x37')]);return db[_0x03a2('0x25')]['find'](_0x18b1f4)[_0x03a2('0x1d')](handleEntityNotFound(_0x40d895,null))[_0x03a2('0x1d')](respondWithResult(_0x40d895,null))[_0x03a2('0x3c')](handleError(_0x40d895,null));};exports[_0x03a2('0x41')]=function(_0x2509de,_0xc9e52b){return db['Tag'][_0x03a2('0x41')](_0x2509de['body'],{})[_0x03a2('0x1d')](function(_0x332a56){var _0x5b8a6c=_0x2509de[_0x03a2('0x42')][_0x03a2('0x43')]({'plain':!![]});if(!_0x5b8a6c)throw new Error(_0x03a2('0x44'));if(_0x5b8a6c[_0x03a2('0x45')]===_0x03a2('0x42')){var _0x4b1d8a=_0x332a56[_0x03a2('0x43')]({'plain':!![]});var _0x40a80c=_0x03a2('0x1f');return db[_0x03a2('0x46')][_0x03a2('0x47')]({'where':{'name':_0x40a80c,'userProfileId':_0x5b8a6c[_0x03a2('0x48')]},'raw':!![]})[_0x03a2('0x1d')](function(_0x496b1f){if(_0x496b1f&&_0x496b1f[_0x03a2('0x49')]===0x0){return db[_0x03a2('0x20')][_0x03a2('0x41')]({'name':_0x4b1d8a[_0x03a2('0x23')],'resourceId':_0x4b1d8a['id'],'type':_0x496b1f[_0x03a2('0x23')],'sectionId':_0x496b1f['id']},{})[_0x03a2('0x1d')](function(){return _0x332a56;});}else{return _0x332a56;}})[_0x03a2('0x3c')](function(_0xcb27b2){logger['error'](_0x03a2('0x4a'),_0xcb27b2);throw _0xcb27b2;});}return _0x332a56;})[_0x03a2('0x1d')](respondWithResult(_0xc9e52b,0xc9))[_0x03a2('0x3c')](handleError(_0xc9e52b,null));};exports[_0x03a2('0x4b')]=function(_0x4773f8,_0x27ff7b){if(_0x4773f8[_0x03a2('0x4c')]['id']){delete _0x4773f8[_0x03a2('0x4c')]['id'];}return db['Tag'][_0x03a2('0x47')]({'where':{'id':_0x4773f8['params']['id']}})[_0x03a2('0x1d')](handleEntityNotFound(_0x27ff7b,null))[_0x03a2('0x1d')](saveUpdates(_0x4773f8['body'],null))[_0x03a2('0x1d')](respondWithResult(_0x27ff7b,null))[_0x03a2('0x3c')](handleError(_0x27ff7b,null));};exports['destroy']=function(_0xbe21a4,_0x1c2d13){return db['Tag'][_0x03a2('0x47')]({'where':{'id':_0xbe21a4[_0x03a2('0x3e')]['id']}})[_0x03a2('0x1d')](handleEntityNotFound(_0x1c2d13,null))[_0x03a2('0x1d')](removeEntity(_0x1c2d13,null))[_0x03a2('0x3c')](handleError(_0x1c2d13,null));};exports[_0x03a2('0x4d')]=function(_0x220d7d,_0x1cb57b){return db[_0x03a2('0x25')][_0x03a2('0x4d')]()[_0x03a2('0x1d')](respondWithResult(_0x1cb57b,null))['catch'](handleError(_0x1cb57b,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 12d9d7b..71a97d7 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 _0x1edf=['../../config/logger','moment','bluebird','rimraf','./tag.attributes','exports','define','Tag','tools_tags','util'];(function(_0x538b3a,_0x38bda7){var _0x1874ea=function(_0x4e95ef){while(--_0x4e95ef){_0x538b3a['push'](_0x538b3a['shift']());}};_0x1874ea(++_0x38bda7);}(_0x1edf,0x81));var _0xf1ed=function(_0x5bea9b,_0x50d27a){_0x5bea9b=_0x5bea9b-0x0;var _0x29c21c=_0x1edf[_0x5bea9b];return _0x29c21c;};'use strict';var _=require('lodash');var util=require(_0xf1ed('0x0'));var logger=require(_0xf1ed('0x1'))('api');var moment=require(_0xf1ed('0x2'));var BPromise=require(_0xf1ed('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf1ed('0x4'));var config=require('../../config/environment');var attributes=require(_0xf1ed('0x5'));module[_0xf1ed('0x6')]=function(_0x84c859,_0xe7afec){return _0x84c859[_0xf1ed('0x7')](_0xf1ed('0x8'),attributes,{'tableName':_0xf1ed('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9107=['bluebird','request-promise','path','exports','Tag','lodash','moment'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x9107,0x1e8));var _0x7910=function(_0x17d050,_0x28e6d8){_0x17d050=_0x17d050-0x0;var _0x56351d=_0x9107[_0x17d050];return _0x56351d;};'use strict';var _=require(_0x7910('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7910('0x1'));var BPromise=require(_0x7910('0x2'));var rp=require(_0x7910('0x3'));var fs=require('fs');var path=require(_0x7910('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x7910('0x5')]=function(_0x380066,_0x364112){return _0x380066['define'](_0x7910('0x6'),attributes,{'tableName':'tools_tags','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 2c54e07..b1dcc08 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 _0x0eaa=['http','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x187cda,_0x2e27e8){var _0x1a066d=function(_0x605cce){while(--_0x605cce){_0x187cda['push'](_0x187cda['shift']());}};_0x1a066d(++_0x2e27e8);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x582ab9,_0x5f08b6){_0x582ab9=_0x582ab9-0x0;var _0x3732d3=_0x0eaa[_0x582ab9];return _0x3732d3;};'use strict';var _=require(_0xa0ea('0x0'));var util=require(_0xa0ea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa0ea('0x2'));var fs=require('fs');var Redis=require(_0xa0ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0ea('0x4'));var logger=require(_0xa0ea('0x5'))(_0xa0ea('0x6'));var config=require(_0xa0ea('0x7'));var jayson=require(_0xa0ea('0x8'));var client=jayson['client'][_0xa0ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x521881,_0x4b8856,_0x361178){return new BPromise(function(_0x8632a1,_0x5b2adc){return client['request'](_0x521881,_0x361178)[_0xa0ea('0xa')](function(_0x2746f2){logger[_0xa0ea('0xb')](_0xa0ea('0xc'),_0x4b8856,_0xa0ea('0xd'));logger['debug'](_0xa0ea('0xe'),_0x4b8856,_0xa0ea('0xd'),JSON[_0xa0ea('0xf')](_0x2746f2));if(_0x2746f2[_0xa0ea('0x10')]){if(_0x2746f2['error'][_0xa0ea('0x11')]===0x1f4){logger[_0xa0ea('0x10')](_0xa0ea('0xc'),_0x4b8856,_0x2746f2[_0xa0ea('0x10')][_0xa0ea('0x12')]);return _0x5b2adc(_0x2746f2['error'][_0xa0ea('0x12')]);}logger[_0xa0ea('0x10')]('Tag,\x20%s,\x20%s',_0x4b8856,_0x2746f2[_0xa0ea('0x10')][_0xa0ea('0x12')]);return _0x8632a1(_0x2746f2[_0xa0ea('0x10')][_0xa0ea('0x12')]);}else{logger['info'](_0xa0ea('0xc'),_0x4b8856,_0xa0ea('0xd'));_0x8632a1(_0x2746f2[_0xa0ea('0x13')][_0xa0ea('0x12')]);}})[_0xa0ea('0x14')](function(_0x34b94c){logger[_0xa0ea('0x10')](_0xa0ea('0xc'),_0x4b8856,_0x34b94c);_0x5b2adc(_0x34b94c);});});} \ No newline at end of file +var _0x1b73=['debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1b73,0x1d5));var _0x31b7=function(_0x318783,_0x39b785){_0x318783=_0x318783-0x0;var _0x492b94=_0x1b73[_0x318783];return _0x492b94;};'use strict';var _=require('lodash');var util=require(_0x31b7('0x0'));var moment=require(_0x31b7('0x1'));var BPromise=require(_0x31b7('0x2'));var rs=require(_0x31b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31b7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x31b7('0x5'))(_0x31b7('0x6'));var config=require('../../config/environment');var jayson=require(_0x31b7('0x7'));var client=jayson[_0x31b7('0x8')][_0x31b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x502838,_0x445dbe,_0x1a730f){return new BPromise(function(_0x86ef8e,_0x19b92a){return client[_0x31b7('0xa')](_0x502838,_0x1a730f)[_0x31b7('0xb')](function(_0x3d2b41){logger['info'](_0x31b7('0xc'),_0x445dbe,_0x31b7('0xd'));logger[_0x31b7('0xe')](_0x31b7('0xf'),_0x445dbe,_0x31b7('0xd'),JSON[_0x31b7('0x10')](_0x3d2b41));if(_0x3d2b41[_0x31b7('0x11')]){if(_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x12')]===0x1f4){logger[_0x31b7('0x11')]('Tag,\x20%s,\x20%s',_0x445dbe,_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);return _0x19b92a(_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);}logger[_0x31b7('0x11')](_0x31b7('0xc'),_0x445dbe,_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);return _0x86ef8e(_0x3d2b41[_0x31b7('0x11')]['message']);}else{logger[_0x31b7('0x14')]('Tag,\x20%s,\x20%s',_0x445dbe,_0x31b7('0xd'));_0x86ef8e(_0x3d2b41[_0x31b7('0x15')]['message']);}})[_0x31b7('0x16')](function(_0x3c71ae){logger[_0x31b7('0x11')](_0x31b7('0xc'),_0x445dbe,_0x3c71ae);_0x19b92a(_0x3c71ae);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 354ea8d..b277541 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(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 69c74b2..2c45282 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','sequelize','STRING'];(function(_0x1bbb44,_0x9aea6e){var _0x3979f9=function(_0x1f91f4){while(--_0x1f91f4){_0x1bbb44['push'](_0x1bbb44['shift']());}};_0x3979f9(++_0x9aea6e);}(_0xb10b,0x12a));var _0xbb10=function(_0x4991d6,_0x348deb){_0x4991d6=_0x4991d6-0x0;var _0x50faf7=_0xb10b[_0x4991d6];return _0x50faf7;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x3c17cc,_0x33b4e8){var _0x112b10=function(_0x3146e0){while(--_0x3146e0){_0x3c17cc['push'](_0x3c17cc['shift']());}};_0x112b10(++_0x33b4e8);}(_0xb10b,0x12a));var _0xbb10=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0xb10b[_0x316c42];return _0x2b38f7;};'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 6778e59..39eaf7b 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 _0x0520=['nolimit','sort','filters','filter','where','merge','options','includeAll','include','rows','catch','show','params','keys','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','transaction','sequelize','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','end','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','pick','Queues','addQueues','isValidChannel','add','ids','removeQueues','remove','isArray','Voice','Fax','Openchannel','Whatsapp','penalty','User','findOrCreate','emit','Queue:save','QueueId','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','TeamVoiceQueue','all','addAgents','spread','removeAgents','Chat','Mail','Queue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./team.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','send','index','map','Team','rawAttributes','fieldName','type','key','name','query','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0x0520,0x1a4));var _0x0052=function(_0x49a49a,_0x16e7f9){_0x49a49a=_0x49a49a-0x0;var _0x9877ff=_0x0520[_0x49a49a];return _0x9877ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0052('0x0'));var zipdir=require(_0x0052('0x1'));var jsonpatch=require(_0x0052('0x2'));var rp=require(_0x0052('0x3'));var moment=require(_0x0052('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0052('0x5'));var util=require(_0x0052('0x6'));var path=require(_0x0052('0x7'));var sox=require(_0x0052('0x8'));var csv=require(_0x0052('0x9'));var ejs=require(_0x0052('0xa'));var fs=require('fs');var fs_extra=require(_0x0052('0xb'));var _=require(_0x0052('0xc'));var squel=require(_0x0052('0xd'));var crypto=require(_0x0052('0xe'));var jsforce=require(_0x0052('0xf'));var deskjs=require(_0x0052('0x10'));var toCsv=require(_0x0052('0x9'));var querystring=require('querystring');var Papa=require(_0x0052('0x11'));var Redis=require(_0x0052('0x12'));var authService=require(_0x0052('0x13'));var qs=require(_0x0052('0x14'));var as=require(_0x0052('0x15'));var hardwareService=require(_0x0052('0x16'));var logger=require(_0x0052('0x17'))(_0x0052('0x18'));var utils=require('../../config/utils');var config=require(_0x0052('0x19'));var licenseUtil=require(_0x0052('0x1a'));var db=require(_0x0052('0x1b'))['db'];config[_0x0052('0x1c')]=_['defaults'](config[_0x0052('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x0052('0x1d'))(new Redis(config[_0x0052('0x1c')]));require(_0x0052('0x1e'))[_0x0052('0x1f')](socket);function respondWithStatusCode(_0x4eeb71,_0x97157d){_0x97157d=_0x97157d||0xcc;return function(_0x38f6bd){if(_0x38f6bd){return _0x4eeb71['sendStatus'](_0x97157d);}return _0x4eeb71['status'](_0x97157d)['end']();};}function respondWithResult(_0x4ed929,_0x231d9d){_0x231d9d=_0x231d9d||0xc8;return function(_0x1405bd){if(_0x1405bd){return _0x4ed929[_0x0052('0x20')](_0x231d9d)[_0x0052('0x21')](_0x1405bd);}};}function respondWithFilteredResult(_0x357cd0,_0x293b1d){return function(_0x88846a){if(_0x88846a){var _0x2db0ca=typeof _0x293b1d[_0x0052('0x22')]==='undefined'&&typeof _0x293b1d[_0x0052('0x23')]===_0x0052('0x24');var _0x185a42=_0x88846a[_0x0052('0x25')];var _0x3b2e30=_0x2db0ca?0x0:_0x293b1d[_0x0052('0x22')];var _0x3bc8e9=_0x2db0ca?_0x88846a[_0x0052('0x25')]:_0x293b1d[_0x0052('0x22')]+_0x293b1d[_0x0052('0x23')];var _0x2828e6;if(_0x3bc8e9>=_0x185a42){_0x3bc8e9=_0x185a42;_0x2828e6=0xc8;}else{_0x2828e6=0xce;}_0x357cd0[_0x0052('0x20')](_0x2828e6);return _0x357cd0[_0x0052('0x26')](_0x0052('0x27'),_0x3b2e30+'-'+_0x3bc8e9+'/'+_0x185a42)[_0x0052('0x21')](_0x88846a);}return null;};}function patchUpdates(_0x5078a3){return function(_0x37a109){try{jsonpatch[_0x0052('0x28')](_0x37a109,_0x5078a3,!![]);}catch(_0x3f49a7){return BPromise[_0x0052('0x29')](_0x3f49a7);}return _0x37a109[_0x0052('0x2a')]();};}function saveUpdates(_0x5ea6a9,_0x189d35){return function(_0x5dc667){if(_0x5dc667){return _0x5dc667[_0x0052('0x2b')](_0x5ea6a9)[_0x0052('0x2c')](function(_0x10d2dd){return _0x10d2dd;});}return null;};}function handleEntityNotFound(_0x5969da,_0x3391d2){return function(_0xc5be45){if(!_0xc5be45){_0x5969da[_0x0052('0x2d')](0x194);}return _0xc5be45;};}function handleError(_0x3f2f38,_0x795924){_0x795924=_0x795924||0x1f4;return function(_0x55612e){logger[_0x0052('0x2e')](_0x55612e['stack']);if(_0x55612e['name']){delete _0x55612e['name'];}_0x3f2f38[_0x0052('0x20')](_0x795924)[_0x0052('0x2f')](_0x55612e);};}exports[_0x0052('0x30')]=function(_0xee064b,_0x469610){var _0x5e56ce={},_0x33509e={},_0x55d2e1={'count':0x0,'rows':[]};var _0x274cb5=_[_0x0052('0x31')](db[_0x0052('0x32')][_0x0052('0x33')],function(_0x41fe49){return{'name':_0x41fe49[_0x0052('0x34')],'type':_0x41fe49[_0x0052('0x35')][_0x0052('0x36')]};});_0x33509e['model']=_[_0x0052('0x31')](_0x274cb5,_0x0052('0x37'));_0x33509e[_0x0052('0x38')]=_['keys'](_0xee064b[_0x0052('0x38')]);_0x33509e['filters']=_[_0x0052('0x39')](_0x33509e[_0x0052('0x3a')],_0x33509e[_0x0052('0x38')]);_0x5e56ce['attributes']=_['intersection'](_0x33509e[_0x0052('0x3a')],qs[_0x0052('0x3b')](_0xee064b['query']['fields']));_0x5e56ce[_0x0052('0x3c')]=_0x5e56ce[_0x0052('0x3c')][_0x0052('0x3d')]?_0x5e56ce[_0x0052('0x3c')]:_0x33509e['model'];if(!_0xee064b[_0x0052('0x38')][_0x0052('0x3e')](_0x0052('0x3f'))){_0x5e56ce['limit']=qs[_0x0052('0x23')](_0xee064b[_0x0052('0x38')][_0x0052('0x23')]);_0x5e56ce[_0x0052('0x22')]=qs[_0x0052('0x22')](_0xee064b[_0x0052('0x38')][_0x0052('0x22')]);}_0x5e56ce['order']=qs['sort'](_0xee064b['query'][_0x0052('0x40')]);_0x5e56ce['where']=qs[_0x0052('0x41')](_['pick'](_0xee064b[_0x0052('0x38')],_0x33509e['filters']),_0x274cb5);if(_0xee064b['query'][_0x0052('0x42')]){_0x5e56ce[_0x0052('0x43')]=_[_0x0052('0x44')](_0x5e56ce[_0x0052('0x43')],{'$or':_[_0x0052('0x31')](_0x274cb5,function(_0x190925){if(_0x190925[_0x0052('0x35')]!=='VIRTUAL'){var _0xda2f03={};_0xda2f03[_0x190925['name']]={'$like':'%'+_0xee064b[_0x0052('0x38')][_0x0052('0x42')]+'%'};return _0xda2f03;}})});}_0x5e56ce=_[_0x0052('0x44')]({},_0x5e56ce,_0xee064b[_0x0052('0x45')]);var _0x212386={'where':_0x5e56ce[_0x0052('0x43')]};return db[_0x0052('0x32')][_0x0052('0x25')](_0x212386)[_0x0052('0x2c')](function(_0x405de0){_0x55d2e1[_0x0052('0x25')]=_0x405de0;if(_0xee064b[_0x0052('0x38')][_0x0052('0x46')]){_0x5e56ce[_0x0052('0x47')]=[{'all':!![]}];}return db['Team']['findAll'](_0x5e56ce);})[_0x0052('0x2c')](function(_0x7a4978){_0x55d2e1[_0x0052('0x48')]=_0x7a4978;return _0x55d2e1;})[_0x0052('0x2c')](respondWithFilteredResult(_0x469610,_0x5e56ce))[_0x0052('0x49')](handleError(_0x469610,null));};exports[_0x0052('0x4a')]=function(_0x139a3b,_0x58bbb5){var _0x227b78={'raw':![],'where':{'id':_0x139a3b[_0x0052('0x4b')]['id']}},_0x362872={};_0x362872['model']=_['keys'](db[_0x0052('0x32')][_0x0052('0x33')]);_0x362872[_0x0052('0x38')]=_[_0x0052('0x4c')](_0x139a3b[_0x0052('0x38')]);_0x362872[_0x0052('0x41')]=_[_0x0052('0x39')](_0x362872['model'],_0x362872[_0x0052('0x38')]);_0x227b78[_0x0052('0x3c')]=_['intersection'](_0x362872[_0x0052('0x3a')],qs[_0x0052('0x3b')](_0x139a3b['query']['fields']));_0x227b78[_0x0052('0x3c')]=_0x227b78['attributes'][_0x0052('0x3d')]?_0x227b78[_0x0052('0x3c')]:_0x362872[_0x0052('0x3a')];if(_0x139a3b[_0x0052('0x38')][_0x0052('0x46')]){_0x227b78[_0x0052('0x47')]=[{'all':!![]}];}_0x227b78=_[_0x0052('0x44')]({},_0x227b78,_0x139a3b[_0x0052('0x45')]);return db['Team'][_0x0052('0x4d')](_0x227b78)[_0x0052('0x2c')](handleEntityNotFound(_0x58bbb5,null))['then'](respondWithResult(_0x58bbb5,null))[_0x0052('0x49')](handleError(_0x58bbb5,null));};exports['create']=function(_0x4940f0,_0x5c3151){return db[_0x0052('0x32')]['create'](_0x4940f0[_0x0052('0x4e')],{})[_0x0052('0x2c')](function(_0x42fd61){var _0x2c599b=_0x4940f0[_0x0052('0x4f')][_0x0052('0x50')]({'plain':!![]});if(!_0x2c599b)throw new Error(_0x0052('0x51'));if(_0x2c599b[_0x0052('0x52')]===_0x0052('0x4f')){var _0x112126=_0x42fd61[_0x0052('0x50')]({'plain':!![]});var _0x4fdeab=_0x0052('0x53');return db[_0x0052('0x54')][_0x0052('0x4d')]({'where':{'name':_0x4fdeab,'userProfileId':_0x2c599b[_0x0052('0x55')]},'raw':!![]})[_0x0052('0x2c')](function(_0x353105){if(_0x353105&&_0x353105['autoAssociation']===0x0){return db['UserProfileResource'][_0x0052('0x56')]({'name':_0x112126[_0x0052('0x37')],'resourceId':_0x112126['id'],'type':_0x353105['name'],'sectionId':_0x353105['id']},{})[_0x0052('0x2c')](function(){return _0x42fd61;});}else{return _0x42fd61;}})[_0x0052('0x49')](function(_0x599f2a){logger[_0x0052('0x2e')](_0x0052('0x57'),_0x599f2a);throw _0x599f2a;});}return _0x42fd61;})[_0x0052('0x2c')](respondWithResult(_0x5c3151,0xc9))[_0x0052('0x49')](handleError(_0x5c3151,null));};exports[_0x0052('0x2b')]=function(_0x543f28,_0x33e63e){if(_0x543f28[_0x0052('0x4e')]['id']){delete _0x543f28['body']['id'];}return db[_0x0052('0x32')][_0x0052('0x4d')]({'where':{'id':_0x543f28[_0x0052('0x4b')]['id']}})[_0x0052('0x2c')](handleEntityNotFound(_0x33e63e,null))['then'](saveUpdates(_0x543f28['body'],null))[_0x0052('0x2c')](respondWithResult(_0x33e63e,null))[_0x0052('0x49')](handleError(_0x33e63e,null));};exports[_0x0052('0x58')]=function(_0x110632,_0x1a4fea){var _0x561d87=_0x110632[_0x0052('0x4b')]['id'];var _0x83f2b2=[];return db['sequelize'][_0x0052('0x59')](function(_0x4d3672){var _0x33e03d='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x561d87;return db[_0x0052('0x5a')][_0x0052('0x38')](_0x33e03d,{'type':db[_0x0052('0x5b')]['QueryTypes'][_0x0052('0x5c')],'raw':!![],'transaction':_0x4d3672})['then'](function(_0x4e8d26){_0x83f2b2=_[_0x0052('0x31')](_0x4e8d26,function(_0x548995){return Number(_0x548995[_0x0052('0x5d')]);});})[_0x0052('0x2c')](function(){var _0x2eedc3=_0x0052('0x5e')+_0x561d87;return db['sequelize'][_0x0052('0x38')](_0x2eedc3,{'type':db['Sequelize']['QueryTypes'][_0x0052('0x5c')],'raw':!![],'transaction':_0x4d3672});})[_0x0052('0x2c')](function(_0x4c54ec){var _0x19a909=_[_0x0052('0x31')](_0x4c54ec,function(_0x35f00e){return Number(_0x35f00e['VoiceQueueId']);});return db[_0x0052('0x5f')][_0x0052('0x58')]({'where':{'UserId':{'$in':_0x83f2b2},'VoiceQueueId':{'$in':_0x19a909}},'transaction':_0x4d3672});})['then'](function(){var _0x104d91=_0x0052('0x60')+_0x561d87;return db[_0x0052('0x5a')]['query'](_0x104d91,{'type':db[_0x0052('0x5b')][_0x0052('0x61')][_0x0052('0x5c')],'raw':!![],'transaction':_0x4d3672});})[_0x0052('0x2c')](function(_0x27d132){var _0x1475d0=_['map'](_0x27d132,function(_0xabeff9){return Number(_0xabeff9[_0x0052('0x62')]);});return db['UserMailQueue'][_0x0052('0x58')]({'where':{'UserId':{'$in':_0x83f2b2},'MailQueueId':{'$in':_0x1475d0}},'transaction':_0x4d3672});})['then'](function(){var _0x4c8209=_0x0052('0x63')+_0x561d87;return db[_0x0052('0x5a')][_0x0052('0x38')](_0x4c8209,{'type':db[_0x0052('0x5b')][_0x0052('0x61')][_0x0052('0x5c')],'raw':!![],'transaction':_0x4d3672});})[_0x0052('0x2c')](function(_0x12f139){var _0x91e89d=_[_0x0052('0x31')](_0x12f139,function(_0x100479){return Number(_0x100479[_0x0052('0x64')]);});return db[_0x0052('0x65')][_0x0052('0x58')]({'where':{'UserId':{'$in':_0x83f2b2},'SmsQueueId':{'$in':_0x91e89d}},'transaction':_0x4d3672});})[_0x0052('0x2c')](function(){var _0x30ecb9=_0x0052('0x66')+_0x561d87;return db[_0x0052('0x5a')][_0x0052('0x38')](_0x30ecb9,{'type':db[_0x0052('0x5b')]['QueryTypes'][_0x0052('0x5c')],'raw':!![],'transaction':_0x4d3672});})[_0x0052('0x2c')](function(_0x4372c4){var _0x20a2dc=_[_0x0052('0x31')](_0x4372c4,function(_0x251450){return Number(_0x251450[_0x0052('0x67')]);});return db[_0x0052('0x68')][_0x0052('0x58')]({'where':{'UserId':{'$in':_0x83f2b2},'ChatQueueId':{'$in':_0x20a2dc}},'transaction':_0x4d3672});})[_0x0052('0x2c')](function(){var _0x39df00=_0x0052('0x69')+_0x561d87;return db[_0x0052('0x5a')][_0x0052('0x38')](_0x39df00,{'type':db[_0x0052('0x5b')][_0x0052('0x61')][_0x0052('0x5c')],'raw':!![],'transaction':_0x4d3672});})[_0x0052('0x2c')](function(_0x5912d8){var _0x271e65=_[_0x0052('0x31')](_0x5912d8,function(_0x18ab53){return Number(_0x18ab53[_0x0052('0x6a')]);});return db[_0x0052('0x6b')][_0x0052('0x58')]({'where':{'UserId':{'$in':_0x83f2b2},'FaxQueueId':{'$in':_0x271e65}},'transaction':_0x4d3672});})[_0x0052('0x2c')](function(){var _0x1ea6f3=_0x0052('0x6c')+_0x561d87;return db[_0x0052('0x5a')][_0x0052('0x38')](_0x1ea6f3,{'type':db[_0x0052('0x5b')][_0x0052('0x61')][_0x0052('0x5c')],'raw':!![],'transaction':_0x4d3672});})[_0x0052('0x2c')](function(_0x161c27){var _0x16d4e6=_[_0x0052('0x31')](_0x161c27,function(_0x21d781){return Number(_0x21d781['OpenchannelQueueId']);});return db['UserOpenchannelQueue'][_0x0052('0x58')]({'where':{'UserId':{'$in':_0x83f2b2},'OpenchannelQueueId':{'$in':_0x16d4e6}},'transaction':_0x4d3672});})[_0x0052('0x2c')](function(){var _0xcb1ff4=_0x0052('0x6d')+_0x561d87;return db[_0x0052('0x5a')]['query'](_0xcb1ff4,{'type':db[_0x0052('0x5b')][_0x0052('0x61')]['SELECT'],'raw':!![],'transaction':_0x4d3672});})[_0x0052('0x2c')](function(_0x445f5f){var _0x2684f2=_[_0x0052('0x31')](_0x445f5f,function(_0x531737){return Number(_0x531737[_0x0052('0x6e')]);});return db[_0x0052('0x6f')][_0x0052('0x58')]({'where':{'UserId':{'$in':_0x83f2b2},'WhatsappQueueId':{'$in':_0x2684f2}},'transaction':_0x4d3672});})[_0x0052('0x2c')](function(){return db[_0x0052('0x70')][_0x0052('0x4d')]({'where':{'TeamId':_0x561d87}});})[_0x0052('0x2c')](function(_0x10a4cc){if(_0x10a4cc===null){return;}return db[_0x0052('0x71')][_0x0052('0x58')]({'where':{'UserId':{'$in':_0x83f2b2},'VoicePrefixId':_0x10a4cc[_0x0052('0x72')]},'transaction':_0x4d3672});})['then'](function(){return db[_0x0052('0x32')]['destroy']({'where':{'id':_0x561d87},'cascade':!![],'transaction':_0x4d3672});})[_0x0052('0x2c')](function(_0x5e5e24){if(_0x5e5e24===0x0){_0x1a4fea[_0x0052('0x2d')](0x194);}else{return db[_0x0052('0x73')][_0x0052('0x58')]({'where':{'type':'Teams','resourceId':_0x561d87},'cascade':!![],'transaction':_0x4d3672})[_0x0052('0x2c')](function(){_0x1a4fea[_0x0052('0x20')](0xcc)[_0x0052('0x74')]();});}})[_0x0052('0x49')](function(_0x24123d){_0x1a4fea[_0x0052('0x20')](0x1f4)[_0x0052('0x2f')](_0x24123d);});});};exports[_0x0052('0x75')]=function(_0x4ab919,_0x2b1f0f,_0x5d7109){return db[_0x0052('0x32')][_0x0052('0x76')]({'where':{'id':_0x4ab919[_0x0052('0x4b')]['id']}})[_0x0052('0x2c')](handleEntityNotFound(_0x2b1f0f,null))[_0x0052('0x2c')](function(_0x10a7f2){if(!_0x4ab919['query'][_0x0052('0x77')]||!utils['isValidChannel'](_0x4ab919['query'][_0x0052('0x77')])){throw new db[(_0x0052('0x5b'))][(_0x0052('0x78'))](_0x0052('0x79'));}var _0x5bcb35={};var _0x1b4342={};_0x1b4342[_0x0052('0x3a')]=_[_0x0052('0x4c')](db[_[_0x0052('0x7a')](_0x4ab919['query']['channel'][_0x0052('0x7b')]())+_0x0052('0x7c')]['rawAttributes']);_0x1b4342['query']=_[_0x0052('0x4c')](_0x4ab919[_0x0052('0x38')]);_0x1b4342['filters']=_[_0x0052('0x39')](_0x1b4342[_0x0052('0x3a')],_0x1b4342['query']);_0x5bcb35[_0x0052('0x3c')]=_['intersection'](_0x1b4342[_0x0052('0x3a')],qs['fields'](_0x4ab919['query'][_0x0052('0x3b')]));_0x5bcb35['attributes']=_0x5bcb35[_0x0052('0x3c')]['length']?_0x5bcb35[_0x0052('0x3c')]:_0x1b4342[_0x0052('0x3a')];_0x5bcb35['limit']=qs[_0x0052('0x23')](_0x4ab919[_0x0052('0x38')]['limit']);_0x5bcb35['offset']=qs['offset'](_0x4ab919[_0x0052('0x38')][_0x0052('0x22')]);_0x5bcb35[_0x0052('0x7d')]=qs['sort'](_0x4ab919[_0x0052('0x38')]['sort']);_0x5bcb35[_0x0052('0x43')]=qs['filters'](_[_0x0052('0x7e')](_0x4ab919[_0x0052('0x38')],_0x1b4342[_0x0052('0x41')]));_0x5bcb35=_[_0x0052('0x44')]({},_0x5bcb35,_0x4ab919['options']);return _0x10a7f2[_0x0052('0x50')+_[_0x0052('0x7a')](_0x4ab919['query']['channel'][_0x0052('0x7b')]())+_0x0052('0x7f')](_0x5bcb35);})[_0x0052('0x2c')](respondWithResult(_0x2b1f0f,null))[_0x0052('0x49')](handleError(_0x2b1f0f,null));};exports[_0x0052('0x80')]=function(_0x164d5a,_0x15fd1e,_0x57dfe4){return db[_0x0052('0x32')]['findOne']({'where':{'id':_0x164d5a[_0x0052('0x4b')]['id']}})[_0x0052('0x2c')](function(_0x51135){if(_0x51135){if(!_0x164d5a['body'][_0x0052('0x77')]||!utils[_0x0052('0x81')](_0x164d5a[_0x0052('0x4e')][_0x0052('0x77')])){throw new db[(_0x0052('0x5b'))][(_0x0052('0x78'))]('Unknown\x20channel');}return _0x51135[_0x0052('0x82')+_[_0x0052('0x7a')](_0x164d5a[_0x0052('0x4e')]['channel'][_0x0052('0x7b')]())+_0x0052('0x7f')](_0x164d5a[_0x0052('0x4e')][_0x0052('0x83')]);}return null;})[_0x0052('0x2c')](handleEntityNotFound(_0x15fd1e,null))[_0x0052('0x2c')](respondWithStatusCode(_0x15fd1e,null))[_0x0052('0x49')](handleError(_0x15fd1e,null));};exports[_0x0052('0x84')]=function(_0x5ad7d4,_0x319743,_0x3fca34){return db['Team'][_0x0052('0x76')]({'where':{'id':_0x5ad7d4[_0x0052('0x4b')]['id']}})[_0x0052('0x2c')](function(_0x2f1b8b){if(_0x2f1b8b){if(!_0x5ad7d4['query'][_0x0052('0x77')]||!utils[_0x0052('0x81')](_0x5ad7d4[_0x0052('0x38')]['channel'])){throw new db[(_0x0052('0x5b'))][(_0x0052('0x78'))](_0x0052('0x79'));}return _0x2f1b8b[_0x0052('0x85')+_[_0x0052('0x7a')](_0x5ad7d4[_0x0052('0x38')][_0x0052('0x77')][_0x0052('0x7b')]())+'Queues'](_0x5ad7d4[_0x0052('0x38')][_0x0052('0x83')]);}return null;})['then'](handleEntityNotFound(_0x319743,null))[_0x0052('0x2c')](respondWithStatusCode(_0x319743,null))[_0x0052('0x49')](handleError(_0x319743,null));};exports['addAgents']=function(_0x430c25,_0x53b885){var _0x22d973=_[_0x0052('0x86')](_0x430c25[_0x0052('0x4e')][_0x0052('0x83')])?_0x430c25[_0x0052('0x4e')][_0x0052('0x83')]:[_0x430c25['body'][_0x0052('0x83')]];var _0x6e2c7d=_0x430c25[_0x0052('0x4b')]['id'];return db['Team'][_0x0052('0x4d')]({'where':{'id':_0x6e2c7d}})[_0x0052('0x2c')](handleEntityNotFound(_0x53b885,null))[_0x0052('0x2c')](function(_0x99439f){if(_0x99439f){var _0x4c7d12=[_0x0052('0x87'),'Chat','Mail','Sms',_0x0052('0x88'),_0x0052('0x89'),_0x0052('0x8a')];return db['sequelize']['transaction'](function(_0x364051){var _0x31ea36=_[_0x0052('0x31')](_0x4c7d12,function(_0x33a7eb){var _0x25f33a={'attributes':['id','name']};if(_0x33a7eb==='Voice'){_0x25f33a['through']={'attributes':[_0x0052('0x8b')]};}return _0x99439f[_0x0052('0x50')+_0x33a7eb+_0x0052('0x7f')](_0x25f33a)[_0x0052('0x2c')](function(_0x53afbc){var _0x5545bc=_[_0x0052('0x31')](_0x53afbc,function(_0xaa3f29){var _0x46d3c0=_[_0x0052('0x31')](_0x22d973,function(_0xd0c027){var _0x559366={'where':{'UserId':_0xd0c027,[_0x33a7eb+'QueueId']:_0xaa3f29['id']},'transaction':_0x364051};if(_0x33a7eb===_0x0052('0x87')){_0x559366['defaults']={'penalty':_0xaa3f29['TeamVoiceQueue'][_0x0052('0x8b')]};}return db[_0x0052('0x8c')+_0x33a7eb+_0x0052('0x7c')][_0x0052('0x8d')](_0x559366)['then'](function(){socket[_0x0052('0x8e')](_0x0052('0x4f')+_0x33a7eb+_0x0052('0x8f'),{'UserId':_0xd0c027,[_0x33a7eb+_0x0052('0x90')]:_0xaa3f29['id']});if(_0x33a7eb!==_0x0052('0x87')){return;}return db['User']['findAll']({'where':{'id':_0x22d973,'online':0x1},'attributes':['id','name',_0x0052('0x91'),_0x0052('0x92'),_0x0052('0x93')],'raw':!![]})[_0x0052('0x2c')](function(_0x162d5d){var _0x26e497=_[_0x0052('0x31')](_0x162d5d,function(_0x5e3f75){return db[_0x0052('0x94')][_0x0052('0x95')]({'membername':_0x5e3f75[_0x0052('0x37')],'UserId':_0x5e3f75['id'],'queue_name':_0xaa3f29['name'],'VoiceQueueId':_0xaa3f29['id'],'interface':_[_0x0052('0x96')](_0x5e3f75['interface'])?util['format'](_0x0052('0x97'),_0x5e3f75['name']):_0x5e3f75[_0x0052('0x93')],'paused':_0x5e3f75['voicePause']||![],'penalty':_0xaa3f29[_0x0052('0x98')][_0x0052('0x8b')]},{'transaction':_0x364051});});return Promise[_0x0052('0x99')](_0x26e497);});});});return Promise[_0x0052('0x99')](_0x46d3c0);});return Promise[_0x0052('0x99')](_0x5545bc);})[_0x0052('0x2c')](function(){return db[_0x0052('0x70')][_0x0052('0x76')]({'where':{'teamId':_0x6e2c7d}})[_0x0052('0x2c')](function(_0x1c82d4){if(_0x1c82d4){var _0x426dd8=_[_0x0052('0x31')](_0x22d973,function(_0x544a0b){db[_0x0052('0x71')]['upsert']({'UserId':_0x544a0b,'VoicePrefixId':_0x1c82d4[_0x0052('0x72')]});});return Promise[_0x0052('0x99')](_0x426dd8);}});});});return Promise[_0x0052('0x99')](_0x31ea36)[_0x0052('0x2c')](function(){return _0x99439f[_0x0052('0x9a')](_0x22d973,{'transaction':_0x364051})[_0x0052('0x9b')](function(_0x50258b){return _0x50258b;});});});}})[_0x0052('0x2c')](respondWithResult(_0x53b885,null))[_0x0052('0x49')](handleError(_0x53b885,null));};exports[_0x0052('0x9c')]=function(_0x5a2be2,_0x12d2df){var _0x503170=_[_0x0052('0x86')](_0x5a2be2['query'][_0x0052('0x83')])?_0x5a2be2[_0x0052('0x38')]['ids']:[_0x5a2be2[_0x0052('0x38')][_0x0052('0x83')]];var _0x29e8fe=_0x5a2be2[_0x0052('0x4b')]['id'];return db['Team'][_0x0052('0x4d')]({'where':{'id':_0x29e8fe}})[_0x0052('0x2c')](handleEntityNotFound(_0x12d2df,null))['then'](function(_0x53a5cf){if(_0x53a5cf){var _0x2cd645=['Voice',_0x0052('0x9d'),_0x0052('0x9e'),'Sms','Fax',_0x0052('0x89'),_0x0052('0x8a')];return db['sequelize'][_0x0052('0x59')](function(_0x47382a){var _0x5bb0a6=_['map'](_0x2cd645,function(_0x44e703){var _0x3e576a={'attributes':['id','name']};return _0x53a5cf[_0x0052('0x50')+_0x44e703+'Queues'](_0x3e576a)[_0x0052('0x2c')](function(_0x56360b){var _0x6445f7=_['map'](_0x56360b,function(_0x2798ec){return _0x2798ec['removeAgents'](_0x503170,{'transaction':_0x47382a})[_0x0052('0x2c')](function(){var _0x51ad8a=_[_0x0052('0x31')](_0x503170,function(_0x4cdfa1){socket[_0x0052('0x8e')](_0x0052('0x4f')+_0x44e703+_0x0052('0x9f'),{'UserId':Number(_0x4cdfa1),[_0x44e703+'QueueId']:_0x2798ec['id']});if(_0x44e703!==_0x0052('0x87')){return;}return db[_0x0052('0x94')][_0x0052('0x58')]({'where':{'VoiceQueueId':_0x2798ec['id'],'UserId':_0x4cdfa1},'transaction':_0x47382a});});return Promise[_0x0052('0x99')](_0x51ad8a);});});return Promise[_0x0052('0x99')](_0x6445f7);});});return Promise['all'](_0x5bb0a6)['then'](function(){return _0x53a5cf['removeAgents'](_0x503170,{'transaction':_0x47382a});})[_0x0052('0x2c')](function(){return db[_0x0052('0x70')][_0x0052('0x76')]({'where':{'teamId':_0x29e8fe}})[_0x0052('0x2c')](function(_0xaf6390){if(_0xaf6390){var _0x1f0ea8=_[_0x0052('0x31')](_0x503170,function(_0x2eab4d){db[_0x0052('0x71')]['destroy']({'where':{'UserId':_0x2eab4d,'VoicePrefixId':_0xaf6390[_0x0052('0x72')]}});});return Promise['all'](_0x1f0ea8);}});});});}})[_0x0052('0x2c')](respondWithStatusCode(_0x12d2df,null))[_0x0052('0x49')](handleError(_0x12d2df,null));};exports[_0x0052('0xa0')]=function(_0x1a7d03,_0x3bad29,_0x515fa6){var _0x2344a5={};var _0x48ab0f={};var _0x426313;var _0x3f3f3f;return db['Team'][_0x0052('0x76')]({'where':{'id':_0x1a7d03[_0x0052('0x4b')]['id']}})[_0x0052('0x2c')](handleEntityNotFound(_0x3bad29,null))[_0x0052('0x2c')](function(_0x192d3e){if(_0x192d3e){_0x426313=_0x192d3e;_0x48ab0f[_0x0052('0x3a')]=_[_0x0052('0x4c')](db[_0x0052('0x8c')][_0x0052('0x33')]);_0x48ab0f[_0x0052('0x38')]=_[_0x0052('0x4c')](_0x1a7d03[_0x0052('0x38')]);_0x48ab0f[_0x0052('0x41')]=_[_0x0052('0x39')](_0x48ab0f['model'],_0x48ab0f['query']);_0x2344a5[_0x0052('0x3c')]=_[_0x0052('0x39')](_0x48ab0f[_0x0052('0x3a')],qs[_0x0052('0x3b')](_0x1a7d03[_0x0052('0x38')]['fields']));_0x2344a5['attributes']=_0x2344a5[_0x0052('0x3c')][_0x0052('0x3d')]?_0x2344a5[_0x0052('0x3c')]:_0x48ab0f[_0x0052('0x3a')];_0x2344a5[_0x0052('0x7d')]=qs[_0x0052('0x40')](_0x1a7d03['query'][_0x0052('0x40')]);_0x2344a5['where']=qs[_0x0052('0x41')](_[_0x0052('0x7e')](_0x1a7d03[_0x0052('0x38')],_0x48ab0f[_0x0052('0x41')]));if(_0x1a7d03['query'][_0x0052('0x42')]){_0x2344a5['where']=_[_0x0052('0x44')](_0x2344a5[_0x0052('0x43')],{'$or':_[_0x0052('0x31')](_0x2344a5[_0x0052('0x3c')],function(_0x1dd6b6){var _0x47f72f={};_0x47f72f[_0x1dd6b6]={'$like':'%'+_0x1a7d03['query'][_0x0052('0x42')]+'%'};return _0x47f72f;})});}_0x2344a5=_[_0x0052('0x44')]({},_0x2344a5,_0x1a7d03[_0x0052('0x45')]);return _0x426313[_0x0052('0xa0')](_0x2344a5);}})[_0x0052('0x2c')](function(_0x71e42f){if(_0x71e42f){_0x3f3f3f=_0x71e42f[_0x0052('0x3d')];if(!_0x1a7d03['query']['hasOwnProperty'](_0x0052('0x3f'))){_0x2344a5[_0x0052('0x23')]=qs[_0x0052('0x23')](_0x1a7d03[_0x0052('0x38')][_0x0052('0x23')]);_0x2344a5['offset']=qs[_0x0052('0x22')](_0x1a7d03['query'][_0x0052('0x22')]);}return _0x426313[_0x0052('0xa0')](_0x2344a5);}})[_0x0052('0x2c')](function(_0x4bef87){if(_0x4bef87){return _0x4bef87?{'count':_0x3f3f3f,'rows':_0x4bef87}:null;}})[_0x0052('0x2c')](respondWithResult(_0x3bad29,null))[_0x0052('0x49')](handleError(_0x3bad29,null));}; \ No newline at end of file +var _0xa02b=['defaults','socket.io-emitter','./team.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','find','create','body','get','role','Teams','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','end','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','ids','removeQueues','remove','isArray','Voice','Mail','Fax','Openchannel','Whatsapp','QueueId','penalty','User','user','Queue:save','online','UserVoiceQueueRt','isNil','format','SIP/%s','interface','voicePause','TeamVoiceQueue','all','TeamVoicePrefix','upsert','spread','Chat','Sms','removeAgents','emit','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xa02b,0x11e));var _0xba02=function(_0x2bdf72,_0x662686){_0x2bdf72=_0x2bdf72-0x0;var _0x47ac80=_0xa02b[_0x2bdf72];return _0x47ac80;};'use strict';var emlformat=require(_0xba02('0x0'));var rimraf=require(_0xba02('0x1'));var zipdir=require(_0xba02('0x2'));var jsonpatch=require(_0xba02('0x3'));var rp=require(_0xba02('0x4'));var moment=require(_0xba02('0x5'));var BPromise=require(_0xba02('0x6'));var Mustache=require(_0xba02('0x7'));var util=require(_0xba02('0x8'));var path=require(_0xba02('0x9'));var sox=require(_0xba02('0xa'));var csv=require(_0xba02('0xb'));var ejs=require(_0xba02('0xc'));var fs=require('fs');var fs_extra=require(_0xba02('0xd'));var _=require(_0xba02('0xe'));var squel=require(_0xba02('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba02('0x10'));var toCsv=require('to-csv');var querystring=require(_0xba02('0x11'));var Papa=require(_0xba02('0x12'));var Redis=require('ioredis');var authService=require(_0xba02('0x13'));var qs=require(_0xba02('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba02('0x15'));var logger=require(_0xba02('0x16'))('api');var utils=require(_0xba02('0x17'));var config=require(_0xba02('0x18'));var licenseUtil=require(_0xba02('0x19'));var db=require(_0xba02('0x1a'))['db'];config[_0xba02('0x1b')]=_[_0xba02('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xba02('0x1d'))(new Redis(config['redis']));require(_0xba02('0x1e'))[_0xba02('0x1f')](socket);function respondWithStatusCode(_0x1120c3,_0x25444c){_0x25444c=_0x25444c||0xcc;return function(_0x3f8881){if(_0x3f8881){return _0x1120c3['sendStatus'](_0x25444c);}return _0x1120c3[_0xba02('0x20')](_0x25444c)['end']();};}function respondWithResult(_0x81a25d,_0x286adb){_0x286adb=_0x286adb||0xc8;return function(_0x4ab598){if(_0x4ab598){return _0x81a25d[_0xba02('0x20')](_0x286adb)[_0xba02('0x21')](_0x4ab598);}};}function respondWithFilteredResult(_0x504f07,_0xf1950a){return function(_0x3eafa0){if(_0x3eafa0){var _0x296313=typeof _0xf1950a[_0xba02('0x22')]===_0xba02('0x23')&&typeof _0xf1950a['limit']==='undefined';var _0x51cc17=_0x3eafa0[_0xba02('0x24')];var _0x3b5122=_0x296313?0x0:_0xf1950a[_0xba02('0x22')];var _0x45bdb7=_0x296313?_0x3eafa0[_0xba02('0x24')]:_0xf1950a[_0xba02('0x22')]+_0xf1950a[_0xba02('0x25')];var _0x1856df;if(_0x45bdb7>=_0x51cc17){_0x45bdb7=_0x51cc17;_0x1856df=0xc8;}else{_0x1856df=0xce;}_0x504f07['status'](_0x1856df);return _0x504f07[_0xba02('0x26')](_0xba02('0x27'),_0x3b5122+'-'+_0x45bdb7+'/'+_0x51cc17)[_0xba02('0x21')](_0x3eafa0);}return null;};}function patchUpdates(_0x22edfa){return function(_0x3a01a2){try{jsonpatch['apply'](_0x3a01a2,_0x22edfa,!![]);}catch(_0x1f1659){return BPromise['reject'](_0x1f1659);}return _0x3a01a2['save']();};}function saveUpdates(_0x238911,_0x29e7ea){return function(_0x2c6211){if(_0x2c6211){return _0x2c6211[_0xba02('0x28')](_0x238911)[_0xba02('0x29')](function(_0x53575a){return _0x53575a;});}return null;};}function handleEntityNotFound(_0x1a85c5,_0x588308){return function(_0x4a512a){if(!_0x4a512a){_0x1a85c5[_0xba02('0x2a')](0x194);}return _0x4a512a;};}function handleError(_0x56eb94,_0x54561c){_0x54561c=_0x54561c||0x1f4;return function(_0x23fb97){logger[_0xba02('0x2b')](_0x23fb97[_0xba02('0x2c')]);if(_0x23fb97['name']){delete _0x23fb97[_0xba02('0x2d')];}_0x56eb94[_0xba02('0x20')](_0x54561c)[_0xba02('0x2e')](_0x23fb97);};}exports[_0xba02('0x2f')]=function(_0x3066c9,_0x22c9db){var _0x5a4c76={},_0x3e2de4={},_0x96ff58={'count':0x0,'rows':[]};var _0x347edf=_[_0xba02('0x30')](db[_0xba02('0x31')][_0xba02('0x32')],function(_0x535fb3){return{'name':_0x535fb3[_0xba02('0x33')],'type':_0x535fb3[_0xba02('0x34')][_0xba02('0x35')]};});_0x3e2de4[_0xba02('0x36')]=_[_0xba02('0x30')](_0x347edf,'name');_0x3e2de4['query']=_[_0xba02('0x37')](_0x3066c9['query']);_0x3e2de4['filters']=_[_0xba02('0x38')](_0x3e2de4[_0xba02('0x36')],_0x3e2de4[_0xba02('0x39')]);_0x5a4c76['attributes']=_[_0xba02('0x38')](_0x3e2de4[_0xba02('0x36')],qs[_0xba02('0x3a')](_0x3066c9[_0xba02('0x39')]['fields']));_0x5a4c76[_0xba02('0x3b')]=_0x5a4c76[_0xba02('0x3b')][_0xba02('0x3c')]?_0x5a4c76['attributes']:_0x3e2de4[_0xba02('0x36')];if(!_0x3066c9[_0xba02('0x39')][_0xba02('0x3d')](_0xba02('0x3e'))){_0x5a4c76[_0xba02('0x25')]=qs[_0xba02('0x25')](_0x3066c9[_0xba02('0x39')][_0xba02('0x25')]);_0x5a4c76['offset']=qs[_0xba02('0x22')](_0x3066c9[_0xba02('0x39')][_0xba02('0x22')]);}_0x5a4c76[_0xba02('0x3f')]=qs[_0xba02('0x40')](_0x3066c9[_0xba02('0x39')]['sort']);_0x5a4c76[_0xba02('0x41')]=qs[_0xba02('0x42')](_[_0xba02('0x43')](_0x3066c9[_0xba02('0x39')],_0x3e2de4[_0xba02('0x42')]),_0x347edf);if(_0x3066c9[_0xba02('0x39')][_0xba02('0x44')]){_0x5a4c76[_0xba02('0x41')]=_[_0xba02('0x45')](_0x5a4c76[_0xba02('0x41')],{'$or':_['map'](_0x347edf,function(_0x531c2d){if(_0x531c2d[_0xba02('0x34')]!=='VIRTUAL'){var _0x3bc178={};_0x3bc178[_0x531c2d[_0xba02('0x2d')]]={'$like':'%'+_0x3066c9['query'][_0xba02('0x44')]+'%'};return _0x3bc178;}})});}_0x5a4c76=_[_0xba02('0x45')]({},_0x5a4c76,_0x3066c9[_0xba02('0x46')]);var _0x9b7fd9={'where':_0x5a4c76['where']};return db['Team'][_0xba02('0x24')](_0x9b7fd9)['then'](function(_0x645462){_0x96ff58[_0xba02('0x24')]=_0x645462;if(_0x3066c9[_0xba02('0x39')]['includeAll']){_0x5a4c76[_0xba02('0x47')]=[{'all':!![]}];}return db[_0xba02('0x31')][_0xba02('0x48')](_0x5a4c76);})[_0xba02('0x29')](function(_0x3631ab){_0x96ff58[_0xba02('0x49')]=_0x3631ab;return _0x96ff58;})[_0xba02('0x29')](respondWithFilteredResult(_0x22c9db,_0x5a4c76))[_0xba02('0x4a')](handleError(_0x22c9db,null));};exports[_0xba02('0x4b')]=function(_0x523ec5,_0xb63c96){var _0x1dff43={'raw':![],'where':{'id':_0x523ec5[_0xba02('0x4c')]['id']}},_0x2e1228={};_0x2e1228[_0xba02('0x36')]=_['keys'](db['Team']['rawAttributes']);_0x2e1228[_0xba02('0x39')]=_[_0xba02('0x37')](_0x523ec5[_0xba02('0x39')]);_0x2e1228[_0xba02('0x42')]=_[_0xba02('0x38')](_0x2e1228[_0xba02('0x36')],_0x2e1228[_0xba02('0x39')]);_0x1dff43[_0xba02('0x3b')]=_[_0xba02('0x38')](_0x2e1228[_0xba02('0x36')],qs[_0xba02('0x3a')](_0x523ec5[_0xba02('0x39')][_0xba02('0x3a')]));_0x1dff43[_0xba02('0x3b')]=_0x1dff43[_0xba02('0x3b')][_0xba02('0x3c')]?_0x1dff43[_0xba02('0x3b')]:_0x2e1228[_0xba02('0x36')];if(_0x523ec5[_0xba02('0x39')]['includeAll']){_0x1dff43[_0xba02('0x47')]=[{'all':!![]}];}_0x1dff43=_[_0xba02('0x45')]({},_0x1dff43,_0x523ec5[_0xba02('0x46')]);return db[_0xba02('0x31')][_0xba02('0x4d')](_0x1dff43)[_0xba02('0x29')](handleEntityNotFound(_0xb63c96,null))['then'](respondWithResult(_0xb63c96,null))[_0xba02('0x4a')](handleError(_0xb63c96,null));};exports[_0xba02('0x4e')]=function(_0xb3a081,_0x4f4b79){return db[_0xba02('0x31')]['create'](_0xb3a081[_0xba02('0x4f')],{})[_0xba02('0x29')](function(_0x529392){var _0x36e93e=_0xb3a081['user'][_0xba02('0x50')]({'plain':!![]});if(!_0x36e93e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36e93e[_0xba02('0x51')]==='user'){var _0x4c700a=_0x529392[_0xba02('0x50')]({'plain':!![]});var _0x13ec85=_0xba02('0x52');return db['UserProfileSection']['find']({'where':{'name':_0x13ec85,'userProfileId':_0x36e93e[_0xba02('0x53')]},'raw':!![]})[_0xba02('0x29')](function(_0x599c6c){if(_0x599c6c&&_0x599c6c[_0xba02('0x54')]===0x0){return db['UserProfileResource'][_0xba02('0x4e')]({'name':_0x4c700a[_0xba02('0x2d')],'resourceId':_0x4c700a['id'],'type':_0x599c6c['name'],'sectionId':_0x599c6c['id']},{})['then'](function(){return _0x529392;});}else{return _0x529392;}})[_0xba02('0x4a')](function(_0x10335a){logger[_0xba02('0x2b')](_0xba02('0x55'),_0x10335a);throw _0x10335a;});}return _0x529392;})['then'](respondWithResult(_0x4f4b79,0xc9))['catch'](handleError(_0x4f4b79,null));};exports['update']=function(_0x516f09,_0x38c43c){if(_0x516f09[_0xba02('0x4f')]['id']){delete _0x516f09[_0xba02('0x4f')]['id'];}return db['Team'][_0xba02('0x4d')]({'where':{'id':_0x516f09[_0xba02('0x4c')]['id']}})[_0xba02('0x29')](handleEntityNotFound(_0x38c43c,null))['then'](saveUpdates(_0x516f09[_0xba02('0x4f')],null))[_0xba02('0x29')](respondWithResult(_0x38c43c,null))[_0xba02('0x4a')](handleError(_0x38c43c,null));};exports[_0xba02('0x56')]=function(_0x2bf777,_0x21839a){var _0x2eacfb=_0x2bf777[_0xba02('0x4c')]['id'];var _0x1029f1=[];return db[_0xba02('0x57')][_0xba02('0x58')](function(_0x431003){var _0x1e85c2=_0xba02('0x59')+_0x2eacfb;return db['sequelize'][_0xba02('0x39')](_0x1e85c2,{'type':db[_0xba02('0x5a')]['QueryTypes'][_0xba02('0x5b')],'raw':!![],'transaction':_0x431003})[_0xba02('0x29')](function(_0x416756){_0x1029f1=_[_0xba02('0x30')](_0x416756,function(_0x4c1f5d){return Number(_0x4c1f5d[_0xba02('0x5c')]);});})['then'](function(){var _0x3b8a42=_0xba02('0x5d')+_0x2eacfb;return db['sequelize']['query'](_0x3b8a42,{'type':db['Sequelize'][_0xba02('0x5e')][_0xba02('0x5b')],'raw':!![],'transaction':_0x431003});})['then'](function(_0x13da19){var _0x5e6b01=_[_0xba02('0x30')](_0x13da19,function(_0x4de481){return Number(_0x4de481[_0xba02('0x5f')]);});return db[_0xba02('0x60')][_0xba02('0x56')]({'where':{'UserId':{'$in':_0x1029f1},'VoiceQueueId':{'$in':_0x5e6b01}},'transaction':_0x431003});})[_0xba02('0x29')](function(){var _0x5191f2=_0xba02('0x61')+_0x2eacfb;return db['sequelize'][_0xba02('0x39')](_0x5191f2,{'type':db[_0xba02('0x5a')][_0xba02('0x5e')][_0xba02('0x5b')],'raw':!![],'transaction':_0x431003});})[_0xba02('0x29')](function(_0x3eea91){var _0x1b5269=_[_0xba02('0x30')](_0x3eea91,function(_0x14f692){return Number(_0x14f692[_0xba02('0x62')]);});return db[_0xba02('0x63')][_0xba02('0x56')]({'where':{'UserId':{'$in':_0x1029f1},'MailQueueId':{'$in':_0x1b5269}},'transaction':_0x431003});})[_0xba02('0x29')](function(){var _0x529f2c=_0xba02('0x64')+_0x2eacfb;return db[_0xba02('0x57')][_0xba02('0x39')](_0x529f2c,{'type':db[_0xba02('0x5a')][_0xba02('0x5e')][_0xba02('0x5b')],'raw':!![],'transaction':_0x431003});})[_0xba02('0x29')](function(_0x44d813){var _0x5470cb=_[_0xba02('0x30')](_0x44d813,function(_0x39ab60){return Number(_0x39ab60[_0xba02('0x65')]);});return db[_0xba02('0x66')][_0xba02('0x56')]({'where':{'UserId':{'$in':_0x1029f1},'SmsQueueId':{'$in':_0x5470cb}},'transaction':_0x431003});})[_0xba02('0x29')](function(){var _0x5b2ec7=_0xba02('0x67')+_0x2eacfb;return db[_0xba02('0x57')][_0xba02('0x39')](_0x5b2ec7,{'type':db['Sequelize'][_0xba02('0x5e')][_0xba02('0x5b')],'raw':!![],'transaction':_0x431003});})[_0xba02('0x29')](function(_0x5c4b89){var _0x25a8c2=_[_0xba02('0x30')](_0x5c4b89,function(_0x1162ee){return Number(_0x1162ee[_0xba02('0x68')]);});return db[_0xba02('0x69')]['destroy']({'where':{'UserId':{'$in':_0x1029f1},'ChatQueueId':{'$in':_0x25a8c2}},'transaction':_0x431003});})[_0xba02('0x29')](function(){var _0x487b7d=_0xba02('0x6a')+_0x2eacfb;return db[_0xba02('0x57')][_0xba02('0x39')](_0x487b7d,{'type':db['Sequelize'][_0xba02('0x5e')]['SELECT'],'raw':!![],'transaction':_0x431003});})[_0xba02('0x29')](function(_0x19b474){var _0x1411c7=_[_0xba02('0x30')](_0x19b474,function(_0x14c058){return Number(_0x14c058[_0xba02('0x6b')]);});return db['UserFaxQueue']['destroy']({'where':{'UserId':{'$in':_0x1029f1},'FaxQueueId':{'$in':_0x1411c7}},'transaction':_0x431003});})['then'](function(){var _0xe409aa='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2eacfb;return db[_0xba02('0x57')]['query'](_0xe409aa,{'type':db[_0xba02('0x5a')][_0xba02('0x5e')][_0xba02('0x5b')],'raw':!![],'transaction':_0x431003});})[_0xba02('0x29')](function(_0x309d72){var _0x1afcb7=_[_0xba02('0x30')](_0x309d72,function(_0x578a0b){return Number(_0x578a0b[_0xba02('0x6c')]);});return db['UserOpenchannelQueue'][_0xba02('0x56')]({'where':{'UserId':{'$in':_0x1029f1},'OpenchannelQueueId':{'$in':_0x1afcb7}},'transaction':_0x431003});})[_0xba02('0x29')](function(){var _0x2e1630=_0xba02('0x6d')+_0x2eacfb;return db[_0xba02('0x57')][_0xba02('0x39')](_0x2e1630,{'type':db[_0xba02('0x5a')]['QueryTypes'][_0xba02('0x5b')],'raw':!![],'transaction':_0x431003});})[_0xba02('0x29')](function(_0x19f233){var _0xc6e1a6=_['map'](_0x19f233,function(_0x2fe003){return Number(_0x2fe003[_0xba02('0x6e')]);});return db[_0xba02('0x6f')][_0xba02('0x56')]({'where':{'UserId':{'$in':_0x1029f1},'WhatsappQueueId':{'$in':_0xc6e1a6}},'transaction':_0x431003});})['then'](function(){return db['TeamVoicePrefix'][_0xba02('0x4d')]({'where':{'TeamId':_0x2eacfb}});})[_0xba02('0x29')](function(_0x18d0fc){if(_0x18d0fc===null){return;}return db[_0xba02('0x70')]['destroy']({'where':{'UserId':{'$in':_0x1029f1},'VoicePrefixId':_0x18d0fc[_0xba02('0x71')]},'transaction':_0x431003});})[_0xba02('0x29')](function(){return db[_0xba02('0x31')][_0xba02('0x56')]({'where':{'id':_0x2eacfb},'cascade':!![],'transaction':_0x431003});})[_0xba02('0x29')](function(_0x426cdd){if(_0x426cdd===0x0){_0x21839a[_0xba02('0x2a')](0x194);}else{return db['UserProfileResource'][_0xba02('0x56')]({'where':{'type':'Teams','resourceId':_0x2eacfb},'cascade':!![],'transaction':_0x431003})['then'](function(){_0x21839a[_0xba02('0x20')](0xcc)[_0xba02('0x72')]();});}})['catch'](function(_0x22aa5c){_0x21839a[_0xba02('0x20')](0x1f4)[_0xba02('0x2e')](_0x22aa5c);});});};exports['getQueues']=function(_0x5ba4e3,_0x37279a,_0x21c15f){return db[_0xba02('0x31')][_0xba02('0x73')]({'where':{'id':_0x5ba4e3[_0xba02('0x4c')]['id']}})[_0xba02('0x29')](handleEntityNotFound(_0x37279a,null))['then'](function(_0x4c31e3){if(!_0x5ba4e3[_0xba02('0x39')][_0xba02('0x74')]||!utils[_0xba02('0x75')](_0x5ba4e3[_0xba02('0x39')][_0xba02('0x74')])){throw new db[(_0xba02('0x5a'))][(_0xba02('0x76'))](_0xba02('0x77'));}var _0x4e94c1={};var _0x1aa88a={};_0x1aa88a[_0xba02('0x36')]=_[_0xba02('0x37')](db[_[_0xba02('0x78')](_0x5ba4e3[_0xba02('0x39')][_0xba02('0x74')][_0xba02('0x79')]())+_0xba02('0x7a')][_0xba02('0x32')]);_0x1aa88a[_0xba02('0x39')]=_[_0xba02('0x37')](_0x5ba4e3[_0xba02('0x39')]);_0x1aa88a[_0xba02('0x42')]=_[_0xba02('0x38')](_0x1aa88a[_0xba02('0x36')],_0x1aa88a[_0xba02('0x39')]);_0x4e94c1['attributes']=_[_0xba02('0x38')](_0x1aa88a['model'],qs['fields'](_0x5ba4e3[_0xba02('0x39')][_0xba02('0x3a')]));_0x4e94c1[_0xba02('0x3b')]=_0x4e94c1[_0xba02('0x3b')][_0xba02('0x3c')]?_0x4e94c1[_0xba02('0x3b')]:_0x1aa88a[_0xba02('0x36')];_0x4e94c1[_0xba02('0x25')]=qs[_0xba02('0x25')](_0x5ba4e3[_0xba02('0x39')][_0xba02('0x25')]);_0x4e94c1[_0xba02('0x22')]=qs['offset'](_0x5ba4e3[_0xba02('0x39')][_0xba02('0x22')]);_0x4e94c1['order']=qs[_0xba02('0x40')](_0x5ba4e3[_0xba02('0x39')][_0xba02('0x40')]);_0x4e94c1[_0xba02('0x41')]=qs[_0xba02('0x42')](_['pick'](_0x5ba4e3[_0xba02('0x39')],_0x1aa88a[_0xba02('0x42')]));_0x4e94c1=_[_0xba02('0x45')]({},_0x4e94c1,_0x5ba4e3['options']);return _0x4c31e3[_0xba02('0x50')+_[_0xba02('0x78')](_0x5ba4e3[_0xba02('0x39')]['channel'][_0xba02('0x79')]())+_0xba02('0x7b')](_0x4e94c1);})[_0xba02('0x29')](respondWithResult(_0x37279a,null))['catch'](handleError(_0x37279a,null));};exports[_0xba02('0x7c')]=function(_0x22b741,_0x398b68,_0x4eaccb){return db['Team'][_0xba02('0x73')]({'where':{'id':_0x22b741[_0xba02('0x4c')]['id']}})[_0xba02('0x29')](function(_0x3d6623){if(_0x3d6623){if(!_0x22b741[_0xba02('0x4f')][_0xba02('0x74')]||!utils['isValidChannel'](_0x22b741[_0xba02('0x4f')][_0xba02('0x74')])){throw new db['Sequelize'][(_0xba02('0x76'))](_0xba02('0x77'));}return _0x3d6623['add'+_[_0xba02('0x78')](_0x22b741[_0xba02('0x4f')][_0xba02('0x74')][_0xba02('0x79')]())+_0xba02('0x7b')](_0x22b741[_0xba02('0x4f')][_0xba02('0x7d')]);}return null;})[_0xba02('0x29')](handleEntityNotFound(_0x398b68,null))['then'](respondWithStatusCode(_0x398b68,null))['catch'](handleError(_0x398b68,null));};exports[_0xba02('0x7e')]=function(_0x9d270f,_0x5d1a8d,_0x311d27){return db[_0xba02('0x31')][_0xba02('0x73')]({'where':{'id':_0x9d270f[_0xba02('0x4c')]['id']}})['then'](function(_0x5e9529){if(_0x5e9529){if(!_0x9d270f[_0xba02('0x39')][_0xba02('0x74')]||!utils[_0xba02('0x75')](_0x9d270f[_0xba02('0x39')][_0xba02('0x74')])){throw new db[(_0xba02('0x5a'))][(_0xba02('0x76'))](_0xba02('0x77'));}return _0x5e9529[_0xba02('0x7f')+_[_0xba02('0x78')](_0x9d270f[_0xba02('0x39')][_0xba02('0x74')][_0xba02('0x79')]())+_0xba02('0x7b')](_0x9d270f['query'][_0xba02('0x7d')]);}return null;})[_0xba02('0x29')](handleEntityNotFound(_0x5d1a8d,null))[_0xba02('0x29')](respondWithStatusCode(_0x5d1a8d,null))['catch'](handleError(_0x5d1a8d,null));};exports['addAgents']=function(_0xbe42d5,_0x4804fc){var _0x2bb8ac=_[_0xba02('0x80')](_0xbe42d5['body'][_0xba02('0x7d')])?_0xbe42d5[_0xba02('0x4f')]['ids']:[_0xbe42d5['body'][_0xba02('0x7d')]];var _0x3b8087=_0xbe42d5[_0xba02('0x4c')]['id'];return db['Team'][_0xba02('0x4d')]({'where':{'id':_0x3b8087}})[_0xba02('0x29')](handleEntityNotFound(_0x4804fc,null))[_0xba02('0x29')](function(_0x26ca0e){if(_0x26ca0e){var _0x39291d=[_0xba02('0x81'),'Chat',_0xba02('0x82'),'Sms',_0xba02('0x83'),_0xba02('0x84'),_0xba02('0x85')];return db[_0xba02('0x57')][_0xba02('0x58')](function(_0x3bb6cf){var _0x1c8244=_[_0xba02('0x30')](_0x39291d,function(_0x5464a6){var _0x4fc39a={'attributes':['id',_0xba02('0x2d')]};if(_0x5464a6==='Voice'){_0x4fc39a['through']={'attributes':['penalty']};}return _0x26ca0e[_0xba02('0x50')+_0x5464a6+_0xba02('0x7b')](_0x4fc39a)['then'](function(_0x361dee){var _0x24924b=_[_0xba02('0x30')](_0x361dee,function(_0x331cbe){var _0x26d3aa=_[_0xba02('0x30')](_0x2bb8ac,function(_0x5bfc8e){var _0x5283e5={'where':{'UserId':_0x5bfc8e,[_0x5464a6+_0xba02('0x86')]:_0x331cbe['id']},'transaction':_0x3bb6cf};if(_0x5464a6===_0xba02('0x81')){_0x5283e5[_0xba02('0x1c')]={'penalty':_0x331cbe['TeamVoiceQueue'][_0xba02('0x87')]};}return db[_0xba02('0x88')+_0x5464a6+_0xba02('0x7a')]['findOrCreate'](_0x5283e5)['then'](function(){socket['emit'](_0xba02('0x89')+_0x5464a6+_0xba02('0x8a'),{'UserId':_0x5bfc8e,[_0x5464a6+_0xba02('0x86')]:_0x331cbe['id']});if(_0x5464a6!==_0xba02('0x81')){return;}return db['User'][_0xba02('0x48')]({'where':{'id':_0x2bb8ac,'online':0x1},'attributes':['id','name',_0xba02('0x8b'),'voicePause','interface'],'raw':!![]})[_0xba02('0x29')](function(_0x2d34e5){var _0x339f6d=_[_0xba02('0x30')](_0x2d34e5,function(_0x5bac58){return db[_0xba02('0x8c')]['upsert']({'membername':_0x5bac58[_0xba02('0x2d')],'UserId':_0x5bac58['id'],'queue_name':_0x331cbe['name'],'VoiceQueueId':_0x331cbe['id'],'interface':_[_0xba02('0x8d')](_0x5bac58['interface'])?util[_0xba02('0x8e')](_0xba02('0x8f'),_0x5bac58['name']):_0x5bac58[_0xba02('0x90')],'paused':_0x5bac58[_0xba02('0x91')]||![],'penalty':_0x331cbe[_0xba02('0x92')][_0xba02('0x87')]},{'transaction':_0x3bb6cf});});return Promise[_0xba02('0x93')](_0x339f6d);});});});return Promise[_0xba02('0x93')](_0x26d3aa);});return Promise[_0xba02('0x93')](_0x24924b);})[_0xba02('0x29')](function(){return db[_0xba02('0x94')][_0xba02('0x73')]({'where':{'teamId':_0x3b8087}})[_0xba02('0x29')](function(_0x2efcc2){if(_0x2efcc2){var _0x2c96c9=_[_0xba02('0x30')](_0x2bb8ac,function(_0x1dc687){db[_0xba02('0x70')][_0xba02('0x95')]({'UserId':_0x1dc687,'VoicePrefixId':_0x2efcc2[_0xba02('0x71')]});});return Promise[_0xba02('0x93')](_0x2c96c9);}});});});return Promise[_0xba02('0x93')](_0x1c8244)['then'](function(){return _0x26ca0e['addAgents'](_0x2bb8ac,{'transaction':_0x3bb6cf})[_0xba02('0x96')](function(_0x118b60){return _0x118b60;});});});}})['then'](respondWithResult(_0x4804fc,null))[_0xba02('0x4a')](handleError(_0x4804fc,null));};exports['removeAgents']=function(_0x89a61e,_0x576c4b){var _0x511147=_[_0xba02('0x80')](_0x89a61e['query'][_0xba02('0x7d')])?_0x89a61e[_0xba02('0x39')][_0xba02('0x7d')]:[_0x89a61e[_0xba02('0x39')][_0xba02('0x7d')]];var _0xd0e419=_0x89a61e[_0xba02('0x4c')]['id'];return db[_0xba02('0x31')][_0xba02('0x4d')]({'where':{'id':_0xd0e419}})['then'](handleEntityNotFound(_0x576c4b,null))[_0xba02('0x29')](function(_0x2df6b7){if(_0x2df6b7){var _0x544b97=['Voice',_0xba02('0x97'),'Mail',_0xba02('0x98'),_0xba02('0x83'),'Openchannel','Whatsapp'];return db[_0xba02('0x57')][_0xba02('0x58')](function(_0x4bd8ef){var _0x21799c=_[_0xba02('0x30')](_0x544b97,function(_0x3bf735){var _0x5eea47={'attributes':['id',_0xba02('0x2d')]};return _0x2df6b7['get'+_0x3bf735+_0xba02('0x7b')](_0x5eea47)[_0xba02('0x29')](function(_0x3c31a7){var _0xb3a2d1=_['map'](_0x3c31a7,function(_0x4562c3){return _0x4562c3[_0xba02('0x99')](_0x511147,{'transaction':_0x4bd8ef})[_0xba02('0x29')](function(){var _0x57d923=_[_0xba02('0x30')](_0x511147,function(_0x56a950){socket[_0xba02('0x9a')](_0xba02('0x89')+_0x3bf735+_0xba02('0x9b'),{'UserId':Number(_0x56a950),[_0x3bf735+_0xba02('0x86')]:_0x4562c3['id']});if(_0x3bf735!==_0xba02('0x81')){return;}return db[_0xba02('0x8c')][_0xba02('0x56')]({'where':{'VoiceQueueId':_0x4562c3['id'],'UserId':_0x56a950},'transaction':_0x4bd8ef});});return Promise[_0xba02('0x93')](_0x57d923);});});return Promise['all'](_0xb3a2d1);});});return Promise[_0xba02('0x93')](_0x21799c)['then'](function(){return _0x2df6b7['removeAgents'](_0x511147,{'transaction':_0x4bd8ef});})[_0xba02('0x29')](function(){return db[_0xba02('0x94')][_0xba02('0x73')]({'where':{'teamId':_0xd0e419}})[_0xba02('0x29')](function(_0xd67df3){if(_0xd67df3){var _0xcb2190=_[_0xba02('0x30')](_0x511147,function(_0x50c569){db[_0xba02('0x70')][_0xba02('0x56')]({'where':{'UserId':_0x50c569,'VoicePrefixId':_0xd67df3[_0xba02('0x71')]}});});return Promise[_0xba02('0x93')](_0xcb2190);}});});});}})[_0xba02('0x29')](respondWithStatusCode(_0x576c4b,null))[_0xba02('0x4a')](handleError(_0x576c4b,null));};exports[_0xba02('0x9c')]=function(_0xe7d3ed,_0x238a5e,_0x2ecaa2){var _0x2ca192={};var _0x517cd9={};var _0x457277;var _0x559230;return db[_0xba02('0x31')][_0xba02('0x73')]({'where':{'id':_0xe7d3ed[_0xba02('0x4c')]['id']}})['then'](handleEntityNotFound(_0x238a5e,null))['then'](function(_0x4c9f14){if(_0x4c9f14){_0x457277=_0x4c9f14;_0x517cd9[_0xba02('0x36')]=_[_0xba02('0x37')](db[_0xba02('0x88')]['rawAttributes']);_0x517cd9[_0xba02('0x39')]=_[_0xba02('0x37')](_0xe7d3ed[_0xba02('0x39')]);_0x517cd9[_0xba02('0x42')]=_['intersection'](_0x517cd9[_0xba02('0x36')],_0x517cd9[_0xba02('0x39')]);_0x2ca192[_0xba02('0x3b')]=_[_0xba02('0x38')](_0x517cd9[_0xba02('0x36')],qs[_0xba02('0x3a')](_0xe7d3ed['query'][_0xba02('0x3a')]));_0x2ca192[_0xba02('0x3b')]=_0x2ca192[_0xba02('0x3b')][_0xba02('0x3c')]?_0x2ca192[_0xba02('0x3b')]:_0x517cd9[_0xba02('0x36')];_0x2ca192[_0xba02('0x3f')]=qs[_0xba02('0x40')](_0xe7d3ed[_0xba02('0x39')][_0xba02('0x40')]);_0x2ca192[_0xba02('0x41')]=qs['filters'](_[_0xba02('0x43')](_0xe7d3ed['query'],_0x517cd9[_0xba02('0x42')]));if(_0xe7d3ed[_0xba02('0x39')][_0xba02('0x44')]){_0x2ca192[_0xba02('0x41')]=_['merge'](_0x2ca192['where'],{'$or':_[_0xba02('0x30')](_0x2ca192['attributes'],function(_0x1be395){var _0x21dd36={};_0x21dd36[_0x1be395]={'$like':'%'+_0xe7d3ed[_0xba02('0x39')][_0xba02('0x44')]+'%'};return _0x21dd36;})});}_0x2ca192=_[_0xba02('0x45')]({},_0x2ca192,_0xe7d3ed[_0xba02('0x46')]);return _0x457277[_0xba02('0x9c')](_0x2ca192);}})[_0xba02('0x29')](function(_0x3c0819){if(_0x3c0819){_0x559230=_0x3c0819['length'];if(!_0xe7d3ed['query'][_0xba02('0x3d')](_0xba02('0x3e'))){_0x2ca192[_0xba02('0x25')]=qs[_0xba02('0x25')](_0xe7d3ed[_0xba02('0x39')][_0xba02('0x25')]);_0x2ca192[_0xba02('0x22')]=qs[_0xba02('0x22')](_0xe7d3ed[_0xba02('0x39')][_0xba02('0x22')]);}return _0x457277[_0xba02('0x9c')](_0x2ca192);}})[_0xba02('0x29')](function(_0x587a92){if(_0x587a92){return _0x587a92?{'count':_0x559230,'rows':_0x587a92}:null;}})['then'](respondWithResult(_0x238a5e,null))['catch'](handleError(_0x238a5e,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 7d2b599..fe01314 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 _0xe737=['events','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3aabae,_0x353f8e){var _0x545639=function(_0x3078dc){while(--_0x3078dc){_0x3aabae['push'](_0x3aabae['shift']());}};_0x545639(++_0x353f8e);}(_0xe737,0x186));var _0x7e73=function(_0x178a06,_0x41c209){_0x178a06=_0x178a06-0x0;var _0x134e91=_0xe737[_0x178a06];return _0x134e91;};'use strict';var EventEmitter=require(_0x7e73('0x0'));var Team=require('../../mysqldb')['db'][_0x7e73('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x7e73('0x2')](0x0);var events={'afterCreate':_0x7e73('0x3'),'afterUpdate':_0x7e73('0x4'),'afterDestroy':_0x7e73('0x5')};function emitEvent(_0x1dae73){return function(_0x597281,_0x18cf58,_0x36be19){TeamEvents[_0x7e73('0x6')](_0x1dae73+':'+_0x597281['id'],_0x597281);TeamEvents[_0x7e73('0x6')](_0x1dae73,_0x597281);_0x36be19(null);};}for(var e in events){if(events[_0x7e73('0x7')](e)){var event=events[e];Team[_0x7e73('0x8')](e,emitEvent(event));}}module[_0x7e73('0x9')]=TeamEvents; \ No newline at end of file +var _0xba12=['exports','events','../../mysqldb','Team','save','remove','emit','hasOwnProperty'];(function(_0x5b6806,_0x58fb5e){var _0x164333=function(_0x4ab371){while(--_0x4ab371){_0x5b6806['push'](_0x5b6806['shift']());}};_0x164333(++_0x58fb5e);}(_0xba12,0xd9));var _0x2ba1=function(_0x123e12,_0x4aeaf7){_0x123e12=_0x123e12-0x0;var _0xd5d2b5=_0xba12[_0x123e12];return _0xd5d2b5;};'use strict';var EventEmitter=require(_0x2ba1('0x0'));var Team=require(_0x2ba1('0x1'))['db'][_0x2ba1('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2ba1('0x3'),'afterUpdate':'update','afterDestroy':_0x2ba1('0x4')};function emitEvent(_0x27d359){return function(_0x1869be,_0x1e9b1b,_0x1f1acf){TeamEvents[_0x2ba1('0x5')](_0x27d359+':'+_0x1869be['id'],_0x1869be);TeamEvents[_0x2ba1('0x5')](_0x27d359,_0x1869be);_0x1f1acf(null);};}for(var e in events){if(events[_0x2ba1('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x2ba1('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index cf693d5..be8d9fe 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 _0xdde6=['exports','define','teams','Chat','Fax','Mail','Openchannel','Sms','resolve','then','all','catch','./team.attributes','get','Queues','map','channel'];(function(_0x22d657,_0x5baf8d){var _0x5103c2=function(_0x23a5ed){while(--_0x23a5ed){_0x22d657['push'](_0x22d657['shift']());}};_0x5103c2(++_0x5baf8d);}(_0xdde6,0x1b5));var _0x6dde=function(_0x8d2fcc,_0x45f542){_0x8d2fcc=_0x8d2fcc-0x0;var _0x4e8bbe=_0xdde6[_0x8d2fcc];return _0x4e8bbe;};'use strict';var _=require('lodash');var attributes=require(_0x6dde('0x0'));function getQueuesByChannel(_0x16742f,_0x17e610){var _0x2c6b3e=_0x6dde('0x1')+_0x17e610+_0x6dde('0x2');return _0x16742f[_0x2c6b3e]()['then'](function(_0x583107){return _[_0x6dde('0x3')](_0x583107,function(_0x370187){_0x370187['setDataValue'](_0x6dde('0x4'),_0x17e610);return _0x370187;});})['catch'](function(_0x507d0b){throw _0x507d0b;});}module[_0x6dde('0x5')]=function(_0x19572d){return _0x19572d[_0x6dde('0x6')]('Team',attributes,{'tableName':_0x6dde('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x58f324=this;var _0x3115a1=[_0x6dde('0x8'),_0x6dde('0x9'),_0x6dde('0xa'),_0x6dde('0xb'),_0x6dde('0xc'),'Voice','Whatsapp'];return Promise[_0x6dde('0xd')]()[_0x6dde('0xe')](function(){var _0x22e5bd=_['map'](_0x3115a1,function(_0x2c7734){return getQueuesByChannel(_0x58f324,_0x2c7734);});return Promise[_0x6dde('0xf')](_0x22e5bd);})[_0x6dde('0x10')](function(_0x5ed819){throw _0x5ed819;});}}});}; \ No newline at end of file +var _0x54fd=['Team','teams','Fax','Mail','Openchannel','Whatsapp','resolve','get','Queues','then','map','setDataValue','channel','catch','exports','define'];(function(_0x546a88,_0x48d512){var _0x60ec43=function(_0x39d2e8){while(--_0x39d2e8){_0x546a88['push'](_0x546a88['shift']());}};_0x60ec43(++_0x48d512);}(_0x54fd,0x117));var _0xd54f=function(_0x4afadc,_0x5307ff){_0x4afadc=_0x4afadc-0x0;var _0x425475=_0x54fd[_0x4afadc];return _0x425475;};'use strict';var _=require('lodash');var attributes=require('./team.attributes');function getQueuesByChannel(_0x4e9639,_0x4e5543){var _0x1ad7ee=_0xd54f('0x0')+_0x4e5543+_0xd54f('0x1');return _0x4e9639[_0x1ad7ee]()[_0xd54f('0x2')](function(_0x4c5069){return _[_0xd54f('0x3')](_0x4c5069,function(_0x27077d){_0x27077d[_0xd54f('0x4')](_0xd54f('0x5'),_0x4e5543);return _0x27077d;});})[_0xd54f('0x6')](function(_0x5be66d){throw _0x5be66d;});}module[_0xd54f('0x7')]=function(_0x4b1a94){return _0x4b1a94[_0xd54f('0x8')](_0xd54f('0x9'),attributes,{'tableName':_0xd54f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x47a65d=this;var _0x33623c=['Chat',_0xd54f('0xb'),_0xd54f('0xc'),_0xd54f('0xd'),'Sms','Voice',_0xd54f('0xe')];return Promise[_0xd54f('0xf')]()[_0xd54f('0x2')](function(){var _0x283b93=_[_0xd54f('0x3')](_0x33623c,function(_0xcaa263){return getQueuesByChannel(_0x47a65d,_0xcaa263);});return Promise['all'](_0x283b93);})[_0xd54f('0x6')](function(_0x1297c5){throw _0x1297c5;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 013ff65..f57fc65 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 _0x4a70=['then','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4a70,0x77));var _0x04a7=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x4a70[_0x1d87fc];return _0x492b56;};'use strict';var _=require(_0x04a7('0x0'));var util=require(_0x04a7('0x1'));var moment=require(_0x04a7('0x2'));var BPromise=require('bluebird');var rs=require(_0x04a7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x04a7('0x4'))['db'];var utils=require(_0x04a7('0x5'));var logger=require(_0x04a7('0x6'))(_0x04a7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x04a7('0x8')]({'port':0x232a});config[_0x04a7('0x9')]=_[_0x04a7('0xa')](config['redis'],{'host':_0x04a7('0xb'),'port':0x18eb});var socket=require(_0x04a7('0xc'))(new Redis(config[_0x04a7('0x9')]));require(_0x04a7('0xd'))[_0x04a7('0xe')](socket);function respondWithRpcPromise(_0x4f6527,_0x131a78,_0x488084){return new BPromise(function(_0x153fba,_0x6291cc){return client[_0x04a7('0xf')](_0x4f6527,_0x488084)[_0x04a7('0x10')](function(_0x81acb){logger[_0x04a7('0x11')](_0x04a7('0x12'),_0x131a78,_0x04a7('0x13'));logger[_0x04a7('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x131a78,'request\x20sent',JSON[_0x04a7('0x15')](_0x81acb));if(_0x81acb[_0x04a7('0x16')]){if(_0x81acb['error'][_0x04a7('0x17')]===0x1f4){logger[_0x04a7('0x16')](_0x04a7('0x12'),_0x131a78,_0x81acb['error'][_0x04a7('0x18')]);return _0x6291cc(_0x81acb[_0x04a7('0x16')][_0x04a7('0x18')]);}logger[_0x04a7('0x16')]('Team,\x20%s,\x20%s',_0x131a78,_0x81acb['error'][_0x04a7('0x18')]);return _0x153fba(_0x81acb[_0x04a7('0x16')]['message']);}else{logger[_0x04a7('0x11')](_0x04a7('0x12'),_0x131a78,'request\x20sent');_0x153fba(_0x81acb[_0x04a7('0x19')][_0x04a7('0x18')]);}})[_0x04a7('0x1a')](function(_0x2b0c0e){logger[_0x04a7('0x16')](_0x04a7('0x12'),_0x131a78,_0x2b0c0e);_0x6291cc(_0x2b0c0e);});});} \ No newline at end of file +var _0x3a7e=['localhost','socket.io-emitter','./team.socket','request','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x255788,_0x554fb1){var _0x405ddd=function(_0x1fa1e4){while(--_0x1fa1e4){_0x255788['push'](_0x255788['shift']());}};_0x405ddd(++_0x554fb1);}(_0x3a7e,0x1cd));var _0xe3a7=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0x3a7e[_0x2adfb1];return _0xa52d45;};'use strict';var _=require(_0xe3a7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe3a7('0x1'));var rs=require(_0xe3a7('0x2'));var fs=require('fs');var Redis=require(_0xe3a7('0x3'));var db=require(_0xe3a7('0x4'))['db'];var utils=require(_0xe3a7('0x5'));var logger=require(_0xe3a7('0x6'))(_0xe3a7('0x7'));var config=require(_0xe3a7('0x8'));var jayson=require(_0xe3a7('0x9'));var client=jayson[_0xe3a7('0xa')][_0xe3a7('0xb')]({'port':0x232a});config[_0xe3a7('0xc')]=_[_0xe3a7('0xd')](config[_0xe3a7('0xc')],{'host':_0xe3a7('0xe'),'port':0x18eb});var socket=require(_0xe3a7('0xf'))(new Redis(config[_0xe3a7('0xc')]));require(_0xe3a7('0x10'))['register'](socket);function respondWithRpcPromise(_0x3c1501,_0x59c71c,_0xc44430){return new BPromise(function(_0x234ebb,_0x3c56ec){return client[_0xe3a7('0x11')](_0x3c1501,_0xc44430)['then'](function(_0x5415b){logger['info'](_0xe3a7('0x12'),_0x59c71c,_0xe3a7('0x13'));logger['debug'](_0xe3a7('0x14'),_0x59c71c,_0xe3a7('0x13'),JSON['stringify'](_0x5415b));if(_0x5415b['error']){if(_0x5415b[_0xe3a7('0x15')]['code']===0x1f4){logger[_0xe3a7('0x15')]('Team,\x20%s,\x20%s',_0x59c71c,_0x5415b[_0xe3a7('0x15')]['message']);return _0x3c56ec(_0x5415b[_0xe3a7('0x15')][_0xe3a7('0x16')]);}logger[_0xe3a7('0x15')](_0xe3a7('0x12'),_0x59c71c,_0x5415b['error']['message']);return _0x234ebb(_0x5415b['error']['message']);}else{logger[_0xe3a7('0x17')]('Team,\x20%s,\x20%s',_0x59c71c,_0xe3a7('0x13'));_0x234ebb(_0x5415b[_0xe3a7('0x18')][_0xe3a7('0x16')]);}})['catch'](function(_0x3026b5){logger['error'](_0xe3a7('0x12'),_0x59c71c,_0x3026b5);_0x3c56ec(_0x3026b5);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index ce66235..4758bdd 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 _0x3e40=['length','./team.events','remove','update','emit','removeListener','register'];(function(_0x26bcec,_0xe13f50){var _0x1049dc=function(_0x4c0d9b){while(--_0x4c0d9b){_0x26bcec['push'](_0x26bcec['shift']());}};_0x1049dc(++_0xe13f50);}(_0x3e40,0xef));var _0x03e4=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x3e40[_0x2f5ac5];return _0x37c9a8;};'use strict';var TeamEvents=require(_0x03e4('0x0'));var events=['save',_0x03e4('0x1'),_0x03e4('0x2')];function createListener(_0x30fffc,_0x1ede96){return function(_0x48057f){_0x1ede96[_0x03e4('0x3')](_0x30fffc,_0x48057f);};}function removeListener(_0x2a04cd,_0x501ef1){return function(){TeamEvents[_0x03e4('0x4')](_0x2a04cd,_0x501ef1);};}exports[_0x03e4('0x5')]=function(_0xc3aef1){for(var _0x55a049=0x0,_0x453eca=events[_0x03e4('0x6')];_0x55a049<_0x453eca;_0x55a049++){var _0x2fc58c=events[_0x55a049];var _0xecde64=createListener('team:'+_0x2fc58c,_0xc3aef1);TeamEvents['on'](_0x2fc58c,_0xecde64);}}; \ No newline at end of file +var _0x46b9=['removeListener','register','length','./team.events','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x46b9,0x199));var _0x946b=function(_0x1786c8,_0x26d97d){_0x1786c8=_0x1786c8-0x0;var _0x495f52=_0x46b9[_0x1786c8];return _0x495f52;};'use strict';var TeamEvents=require(_0x946b('0x0'));var events=['save',_0x946b('0x1'),_0x946b('0x2')];function createListener(_0x38c6c2,_0x41a75e){return function(_0x4b5e50){_0x41a75e[_0x946b('0x3')](_0x38c6c2,_0x4b5e50);};}function removeListener(_0x5fee4c,_0x125657){return function(){TeamEvents[_0x946b('0x4')](_0x5fee4c,_0x125657);};}exports[_0x946b('0x5')]=function(_0x19b552){for(var _0x14adc7=0x0,_0x23cec8=events[_0x946b('0x6')];_0x14adc7<_0x23cec8;_0x14adc7++){var _0x24a92e=events[_0x14adc7];var _0x4d2f0d=createListener('team:'+_0x24a92e,_0x19b552);TeamEvents['on'](_0x24a92e,_0x4d2f0d);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 1ea9047..29d6815 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 _0xcbe1=['exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xcbe1,0x1a2));var _0x1cbe=function(_0xfd1fcd,_0x3182b7){_0xfd1fcd=_0xfd1fcd-0x0;var _0x1e0646=_0xcbe1[_0xfd1fcd];return _0x1e0646;};'use strict';var Sequelize=require('sequelize');module[_0x1cbe('0x0')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2b52=['INTEGER','sequelize','exports'];(function(_0x3edc5f,_0xeb3299){var _0x172536=function(_0x8f257a){while(--_0x8f257a){_0x3edc5f['push'](_0x3edc5f['shift']());}};_0x172536(++_0xeb3299);}(_0x2b52,0x12a));var _0x22b5=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0x2b52[_0x261522];return _0x98a25a;};'use strict';var Sequelize=require(_0x22b5('0x0'));module[_0x22b5('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x22b5('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index c091f9e..fc211a3 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 _0x438a=['./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x46e319,_0x57c7ca){var _0x17d99f=function(_0x56b00c){while(--_0x56b00c){_0x46e319['push'](_0x46e319['shift']());}};_0x17d99f(++_0x57c7ca);}(_0x438a,0x18b));var _0xa438=function(_0x493b8f,_0x319487){_0x493b8f=_0x493b8f-0x0;var _0x400837=_0x438a[_0x493b8f];return _0x400837;};'use strict';var _=require(_0xa438('0x0'));var util=require(_0xa438('0x1'));var logger=require(_0xa438('0x2'))(_0xa438('0x3'));var moment=require(_0xa438('0x4'));var BPromise=require(_0xa438('0x5'));var rp=require(_0xa438('0x6'));var fs=require('fs');var path=require(_0xa438('0x7'));var rimraf=require(_0xa438('0x8'));var config=require(_0xa438('0x9'));var attributes=require(_0xa438('0xa'));module[_0xa438('0xb')]=function(_0x41817,_0x12e2cf){return _0x41817[_0xa438('0xc')](_0xa438('0xd'),attributes,{'tableName':_0xa438('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4af8=['path','../../config/environment','./teamVoicePrefix.attributes','TeamVoicePrefix','team_has_voice_prefixes','moment','bluebird','request-promise'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4af8,0x1ad));var _0x84af=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x4af8[_0x3ff085];return _0x2b68c3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x84af('0x0'));var BPromise=require(_0x84af('0x1'));var rp=require(_0x84af('0x2'));var fs=require('fs');var path=require(_0x84af('0x3'));var rimraf=require('rimraf');var config=require(_0x84af('0x4'));var attributes=require(_0x84af('0x5'));module['exports']=function(_0x37c4f9,_0x3971f1){return _0x37c4f9['define'](_0x84af('0x6'),attributes,{'tableName':_0x84af('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 9e1cb33..2599504 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2df413,_0x5303ae){var _0x1f5133=function(_0xb2347c){while(--_0xb2347c){_0x2df413['push'](_0x2df413['shift']());}};_0x1f5133(++_0x5303ae);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'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(_0x38af13,_0x3949a1){var _0x56a221=function(_0xf457af){while(--_0xf457af){_0x38af13['push'](_0x38af13['shift']());}};_0x56a221(++_0x3949a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 15bcde8..eb5c2c7 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 _0x5975=['INTEGER'];(function(_0x19d234,_0x2d355a){var _0x4bf4fc=function(_0x2d5c4d){while(--_0x2d5c4d){_0x19d234['push'](_0x19d234['shift']());}};_0x4bf4fc(++_0x2d355a);}(_0x5975,0xd0));var _0x5597=function(_0x3e6231,_0x3b410f){_0x3e6231=_0x3e6231-0x0;var _0x12e422=_0x5975[_0x3e6231];return _0x12e422;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x5597('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfb6c=['exports'];(function(_0x3543a6,_0x5b292f){var _0x2c6367=function(_0xd62627){while(--_0xd62627){_0x3543a6['push'](_0x3543a6['shift']());}};_0x2c6367(++_0x5b292f);}(_0xfb6c,0x1a2));var _0xcfb6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfb6c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xcfb6('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index aacbc10..a27b858 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 _0xb2b5=['exports','define','moment','bluebird','rimraf','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x222486,_0x1dcd81){var _0x6c259e=function(_0x17619e){while(--_0x17619e){_0x222486['push'](_0x222486['shift']());}};_0x6c259e(++_0x1dcd81);}(_0xb2b5,0xa3));var _0x5b2b=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xb2b5[_0x1caf6a];return _0x1bf493;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5b2b('0x0'));var BPromise=require(_0x5b2b('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5b2b('0x2'));var config=require(_0x5b2b('0x3'));var attributes=require(_0x5b2b('0x4'));module[_0x5b2b('0x5')]=function(_0x49d9f6,_0x30c3e2){return _0x49d9f6[_0x5b2b('0x6')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc090=['team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes','exports','define'];(function(_0x1af7c8,_0x412e34){var _0x1763c1=function(_0x3b6d57){while(--_0x3b6d57){_0x1af7c8['push'](_0x1af7c8['shift']());}};_0x1763c1(++_0x412e34);}(_0xc090,0x112));var _0x0c09=function(_0x58ae1e,_0x2dfdcd){_0x58ae1e=_0x58ae1e-0x0;var _0x1fa581=_0xc090[_0x58ae1e];return _0x1fa581;};'use strict';var _=require(_0x0c09('0x0'));var util=require(_0x0c09('0x1'));var logger=require(_0x0c09('0x2'))(_0x0c09('0x3'));var moment=require(_0x0c09('0x4'));var BPromise=require(_0x0c09('0x5'));var rp=require(_0x0c09('0x6'));var fs=require('fs');var path=require(_0x0c09('0x7'));var rimraf=require(_0x0c09('0x8'));var config=require('../../config/environment');var attributes=require(_0x0c09('0x9'));module[_0x0c09('0xa')]=function(_0x4f3f48,_0x49a403){return _0x4f3f48[_0x0c09('0xb')]('TeamVoiceQueue',attributes,{'tableName':_0x0c09('0xc'),'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 b975233..6151bc7 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 _0x7384=['debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3063b1,_0x19a85f){var _0x5095e3=function(_0x2dff40){while(--_0x2dff40){_0x3063b1['push'](_0x3063b1['shift']());}};_0x5095e3(++_0x19a85f);}(_0x7384,0xe0));var _0x4738=function(_0x1b06de,_0x9c7d28){_0x1b06de=_0x1b06de-0x0;var _0x396c4c=_0x7384[_0x1b06de];return _0x396c4c;};'use strict';var _=require(_0x4738('0x0'));var util=require(_0x4738('0x1'));var moment=require(_0x4738('0x2'));var BPromise=require(_0x4738('0x3'));var rs=require(_0x4738('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4738('0x5'))['db'];var utils=require(_0x4738('0x6'));var logger=require(_0x4738('0x7'))(_0x4738('0x8'));var config=require(_0x4738('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4738('0xa')][_0x4738('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4344f2,_0x10266e,_0x4c1e91){return new BPromise(function(_0x26abf6,_0x55b0f5){return client['request'](_0x4344f2,_0x4c1e91)[_0x4738('0xc')](function(_0x5a18c3){logger[_0x4738('0xd')](_0x4738('0xe'),_0x10266e,_0x4738('0xf'));logger[_0x4738('0x10')](_0x4738('0x11'),_0x10266e,_0x4738('0xf'),JSON[_0x4738('0x12')](_0x5a18c3));if(_0x5a18c3[_0x4738('0x13')]){if(_0x5a18c3[_0x4738('0x13')][_0x4738('0x14')]===0x1f4){logger[_0x4738('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x10266e,_0x5a18c3[_0x4738('0x13')]['message']);return _0x55b0f5(_0x5a18c3[_0x4738('0x13')][_0x4738('0x15')]);}logger[_0x4738('0x13')](_0x4738('0xe'),_0x10266e,_0x5a18c3['error'][_0x4738('0x15')]);return _0x26abf6(_0x5a18c3['error']['message']);}else{logger['info'](_0x4738('0xe'),_0x10266e,'request\x20sent');_0x26abf6(_0x5a18c3[_0x4738('0x16')][_0x4738('0x15')]);}})[_0x4738('0x17')](function(_0x3f84bf){logger[_0x4738('0x13')](_0x4738('0xe'),_0x10266e,_0x3f84bf);_0x55b0f5(_0x3f84bf);});});} \ No newline at end of file +var _0x7762=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0x7762,0x17b));var _0x2776=function(_0x287256,_0xae1dc9){_0x287256=_0x287256-0x0;var _0x38c630=_0x7762[_0x287256];return _0x38c630;};'use strict';var _=require(_0x2776('0x0'));var util=require(_0x2776('0x1'));var moment=require(_0x2776('0x2'));var BPromise=require('bluebird');var rs=require(_0x2776('0x3'));var fs=require('fs');var Redis=require(_0x2776('0x4'));var db=require(_0x2776('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2776('0x6'))(_0x2776('0x7'));var config=require('../../config/environment');var jayson=require(_0x2776('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51fb08,_0x15af30,_0x110f10){return new BPromise(function(_0x5364ad,_0x5336a2){return client['request'](_0x51fb08,_0x110f10)[_0x2776('0x9')](function(_0x3847f3){logger[_0x2776('0xa')](_0x2776('0xb'),_0x15af30,_0x2776('0xc'));logger[_0x2776('0xd')](_0x2776('0xe'),_0x15af30,'request\x20sent',JSON['stringify'](_0x3847f3));if(_0x3847f3[_0x2776('0xf')]){if(_0x3847f3[_0x2776('0xf')][_0x2776('0x10')]===0x1f4){logger['error'](_0x2776('0xb'),_0x15af30,_0x3847f3['error'][_0x2776('0x11')]);return _0x5336a2(_0x3847f3['error'][_0x2776('0x11')]);}logger[_0x2776('0xf')](_0x2776('0xb'),_0x15af30,_0x3847f3[_0x2776('0xf')][_0x2776('0x11')]);return _0x5364ad(_0x3847f3[_0x2776('0xf')]['message']);}else{logger[_0x2776('0xa')](_0x2776('0xb'),_0x15af30,'request\x20sent');_0x5364ad(_0x3847f3[_0x2776('0x12')][_0x2776('0x11')]);}})['catch'](function(_0x8ac668){logger[_0x2776('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x15af30,_0x8ac668);_0x5336a2(_0x8ac668);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index bbc2e2e..2c51bb5 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 _0x0af5=['create','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id'];(function(_0x26b9f8,_0x5b915b){var _0x4b268f=function(_0x4e806d){while(--_0x4e806d){_0x26b9f8['push'](_0x26b9f8['shift']());}};_0x4b268f(++_0x5b915b);}(_0x0af5,0x158));var _0x50af=function(_0x9fc698,_0x10183b){_0x9fc698=_0x9fc698-0x0;var _0xd18260=_0x0af5[_0x9fc698];return _0xd18260;};'use strict';var multer=require('multer');var util=require(_0x50af('0x0'));var path=require(_0x50af('0x1'));var timeout=require(_0x50af('0x2'));var express=require(_0x50af('0x3'));var router=express[_0x50af('0x4')]();var fs_extra=require(_0x50af('0x5'));var auth=require(_0x50af('0x6'));var interaction=require(_0x50af('0x7'));var config=require(_0x50af('0x8'));var controller=require(_0x50af('0x9'));router[_0x50af('0xa')]('/',auth[_0x50af('0xb')](),controller['index']);router['get'](_0x50af('0xc'),auth[_0x50af('0xb')](),controller['show']);router['post']('/',auth[_0x50af('0xb')](),controller[_0x50af('0xd')]);router['put']('/:id',auth[_0x50af('0xb')](),controller[_0x50af('0xe')]);router['delete'](_0x50af('0xc'),auth[_0x50af('0xb')](),controller[_0x50af('0xf')]);module[_0x50af('0x10')]=router; \ No newline at end of file +var _0xbdfb=['../../config/environment','get','isAuthenticated','/:id','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x537765,_0x28089e){var _0x1b6852=function(_0x1d0316){while(--_0x1d0316){_0x537765['push'](_0x537765['shift']());}};_0x1b6852(++_0x28089e);}(_0xbdfb,0x1ef));var _0xbbdf=function(_0x38f5f8,_0xefe164){_0x38f5f8=_0x38f5f8-0x0;var _0x34e820=_0xbdfb[_0x38f5f8];return _0x34e820;};'use strict';var multer=require(_0xbbdf('0x0'));var util=require(_0xbbdf('0x1'));var path=require(_0xbbdf('0x2'));var timeout=require(_0xbbdf('0x3'));var express=require(_0xbbdf('0x4'));var router=express[_0xbbdf('0x5')]();var fs_extra=require(_0xbbdf('0x6'));var auth=require(_0xbbdf('0x7'));var interaction=require(_0xbbdf('0x8'));var config=require(_0xbbdf('0x9'));var controller=require('./template.controller');router[_0xbbdf('0xa')]('/',auth[_0xbbdf('0xb')](),controller['index']);router[_0xbbdf('0xa')](_0xbbdf('0xc'),auth['isAuthenticated'](),controller[_0xbbdf('0xd')]);router[_0xbbdf('0xe')]('/',auth[_0xbbdf('0xb')](),controller[_0xbbdf('0xf')]);router['put'](_0xbbdf('0xc'),auth[_0xbbdf('0xb')](),controller['update']);router[_0xbbdf('0x10')](_0xbbdf('0xc'),auth[_0xbbdf('0xb')](),controller[_0xbbdf('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 668e47b..bef6607 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 _0x3185=['TEXT','sequelize','exports','STRING'];(function(_0x59fb8b,_0x4d6d2b){var _0x1a9502=function(_0x1074fe){while(--_0x1074fe){_0x59fb8b['push'](_0x59fb8b['shift']());}};_0x1a9502(++_0x4d6d2b);}(_0x3185,0x189));var _0x5318=function(_0x2a0b8d,_0x574c50){_0x2a0b8d=_0x2a0b8d-0x0;var _0x490d58=_0x3185[_0x2a0b8d];return _0x490d58;};'use strict';var Sequelize=require(_0x5318('0x0'));module[_0x5318('0x1')]={'name':{'type':Sequelize[_0x5318('0x2')]},'description':{'type':Sequelize[_0x5318('0x2')]},'html':{'type':Sequelize[_0x5318('0x3')]}}; \ No newline at end of file +var _0x5344=['TEXT','sequelize','exports'];(function(_0x23562f,_0x2bd221){var _0x29d8f2=function(_0x1aea85){while(--_0x1aea85){_0x23562f['push'](_0x23562f['shift']());}};_0x29d8f2(++_0x2bd221);}(_0x5344,0x1e4));var _0x4534=function(_0x277ff1,_0x13837e){_0x277ff1=_0x277ff1-0x0;var _0x5ece53=_0x5344[_0x277ff1];return _0x5ece53;};'use strict';var Sequelize=require(_0x4534('0x0'));module[_0x4534('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x4534('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index c852148..936617c 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 _0x7cb0=['count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','Templates','sendStatus','error','stack','index','map','Template','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined'];(function(_0x7b484,_0x195ad4){var _0x2ae1cf=function(_0x2e6247){while(--_0x2e6247){_0x7b484['push'](_0x7b484['shift']());}};_0x2ae1cf(++_0x195ad4);}(_0x7cb0,0xdd));var _0x07cb=function(_0x31b4aa,_0x9a6429){_0x31b4aa=_0x31b4aa-0x0;var _0x1bb3dd=_0x7cb0[_0x31b4aa];return _0x1bb3dd;};'use strict';var emlformat=require(_0x07cb('0x0'));var rimraf=require(_0x07cb('0x1'));var zipdir=require(_0x07cb('0x2'));var jsonpatch=require(_0x07cb('0x3'));var rp=require(_0x07cb('0x4'));var moment=require(_0x07cb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x07cb('0x6'));var util=require(_0x07cb('0x7'));var path=require(_0x07cb('0x8'));var sox=require(_0x07cb('0x9'));var csv=require(_0x07cb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x07cb('0xb'));var _=require(_0x07cb('0xc'));var squel=require(_0x07cb('0xd'));var crypto=require(_0x07cb('0xe'));var jsforce=require(_0x07cb('0xf'));var deskjs=require(_0x07cb('0x10'));var toCsv=require(_0x07cb('0xa'));var querystring=require('querystring');var Papa=require(_0x07cb('0x11'));var Redis=require('ioredis');var authService=require(_0x07cb('0x12'));var qs=require(_0x07cb('0x13'));var as=require(_0x07cb('0x14'));var hardwareService=require(_0x07cb('0x15'));var logger=require(_0x07cb('0x16'))(_0x07cb('0x17'));var utils=require(_0x07cb('0x18'));var config=require(_0x07cb('0x19'));var licenseUtil=require(_0x07cb('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50ade0,_0x48253a){_0x48253a=_0x48253a||0xcc;return function(_0x23a79c){if(_0x23a79c){return _0x50ade0['sendStatus'](_0x48253a);}return _0x50ade0[_0x07cb('0x1b')](_0x48253a)[_0x07cb('0x1c')]();};}function respondWithResult(_0x3b6b01,_0x5061da){_0x5061da=_0x5061da||0xc8;return function(_0x17c1b1){if(_0x17c1b1){return _0x3b6b01[_0x07cb('0x1b')](_0x5061da)['json'](_0x17c1b1);}};}function respondWithFilteredResult(_0x1fed32,_0x5c63fa){return function(_0x4085cc){if(_0x4085cc){var _0x3f324e=typeof _0x5c63fa[_0x07cb('0x1d')]===_0x07cb('0x1e')&&typeof _0x5c63fa['limit']===_0x07cb('0x1e');var _0x38c7cd=_0x4085cc[_0x07cb('0x1f')];var _0x4b4af5=_0x3f324e?0x0:_0x5c63fa['offset'];var _0xc3c9f4=_0x3f324e?_0x4085cc[_0x07cb('0x1f')]:_0x5c63fa['offset']+_0x5c63fa[_0x07cb('0x20')];var _0x3c59e0;if(_0xc3c9f4>=_0x38c7cd){_0xc3c9f4=_0x38c7cd;_0x3c59e0=0xc8;}else{_0x3c59e0=0xce;}_0x1fed32[_0x07cb('0x1b')](_0x3c59e0);return _0x1fed32[_0x07cb('0x21')](_0x07cb('0x22'),_0x4b4af5+'-'+_0xc3c9f4+'/'+_0x38c7cd)[_0x07cb('0x23')](_0x4085cc);}return null;};}function patchUpdates(_0x5f115c){return function(_0x33c2d8){try{jsonpatch[_0x07cb('0x24')](_0x33c2d8,_0x5f115c,!![]);}catch(_0x5acfa5){return BPromise[_0x07cb('0x25')](_0x5acfa5);}return _0x33c2d8[_0x07cb('0x26')]();};}function saveUpdates(_0x3c1110,_0x331f05){return function(_0x2ad07d){if(_0x2ad07d){return _0x2ad07d[_0x07cb('0x27')](_0x3c1110)['then'](function(_0x4693db){return _0x4693db;});}return null;};}function removeEntity(_0x3f97e9,_0x8d6382){return function(_0x400eb3){if(_0x400eb3){return _0x400eb3[_0x07cb('0x28')]()[_0x07cb('0x29')](function(){var _0x1fa3f3=_0x400eb3['get']({'plain':!![]});var _0x19b3d3=_0x07cb('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x19b3d3,'resourceId':_0x1fa3f3['id']}})[_0x07cb('0x29')](function(){return _0x400eb3;});})[_0x07cb('0x29')](function(){_0x3f97e9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x501ec8,_0x246d9f){return function(_0x846bad){if(!_0x846bad){_0x501ec8[_0x07cb('0x2b')](0x194);}return _0x846bad;};}function handleError(_0x4104fd,_0x2be615){_0x2be615=_0x2be615||0x1f4;return function(_0x2098ad){logger[_0x07cb('0x2c')](_0x2098ad[_0x07cb('0x2d')]);if(_0x2098ad['name']){delete _0x2098ad['name'];}_0x4104fd['status'](_0x2be615)['send'](_0x2098ad);};}exports[_0x07cb('0x2e')]=function(_0x505f43,_0x575504){var _0x8504f5={},_0x190c33={},_0x1baef9={'count':0x0,'rows':[]};var _0x23e1f2=_[_0x07cb('0x2f')](db[_0x07cb('0x30')][_0x07cb('0x31')],function(_0x49558c){return{'name':_0x49558c[_0x07cb('0x32')],'type':_0x49558c[_0x07cb('0x33')][_0x07cb('0x34')]};});_0x190c33[_0x07cb('0x35')]=_[_0x07cb('0x2f')](_0x23e1f2,_0x07cb('0x36'));_0x190c33['query']=_[_0x07cb('0x37')](_0x505f43[_0x07cb('0x38')]);_0x190c33[_0x07cb('0x39')]=_[_0x07cb('0x3a')](_0x190c33['model'],_0x190c33[_0x07cb('0x38')]);_0x8504f5['attributes']=_[_0x07cb('0x3a')](_0x190c33[_0x07cb('0x35')],qs['fields'](_0x505f43[_0x07cb('0x38')][_0x07cb('0x3b')]));_0x8504f5[_0x07cb('0x3c')]=_0x8504f5['attributes'][_0x07cb('0x3d')]?_0x8504f5[_0x07cb('0x3c')]:_0x190c33[_0x07cb('0x35')];if(!_0x505f43[_0x07cb('0x38')]['hasOwnProperty'](_0x07cb('0x3e'))){_0x8504f5[_0x07cb('0x20')]=qs['limit'](_0x505f43['query']['limit']);_0x8504f5['offset']=qs[_0x07cb('0x1d')](_0x505f43[_0x07cb('0x38')][_0x07cb('0x1d')]);}_0x8504f5[_0x07cb('0x3f')]=qs[_0x07cb('0x40')](_0x505f43['query']['sort']);_0x8504f5['where']=qs['filters'](_[_0x07cb('0x41')](_0x505f43[_0x07cb('0x38')],_0x190c33[_0x07cb('0x39')]),_0x23e1f2);if(_0x505f43[_0x07cb('0x38')][_0x07cb('0x42')]){_0x8504f5['where']=_[_0x07cb('0x43')](_0x8504f5['where'],{'$or':_[_0x07cb('0x2f')](_0x23e1f2,function(_0x292c74){if(_0x292c74[_0x07cb('0x33')]!==_0x07cb('0x44')){var _0x16de09={};_0x16de09[_0x292c74[_0x07cb('0x36')]]={'$like':'%'+_0x505f43['query'][_0x07cb('0x42')]+'%'};return _0x16de09;}})});}_0x8504f5=_['merge']({},_0x8504f5,_0x505f43['options']);var _0x5ec981={'where':_0x8504f5['where']};return db[_0x07cb('0x30')][_0x07cb('0x1f')](_0x5ec981)[_0x07cb('0x29')](function(_0xd5292){_0x1baef9[_0x07cb('0x1f')]=_0xd5292;if(_0x505f43[_0x07cb('0x38')][_0x07cb('0x45')]){_0x8504f5[_0x07cb('0x46')]=[{'all':!![]}];}return db[_0x07cb('0x30')]['findAll'](_0x8504f5);})[_0x07cb('0x29')](function(_0x3f45bc){_0x1baef9[_0x07cb('0x47')]=_0x3f45bc;return _0x1baef9;})[_0x07cb('0x29')](respondWithFilteredResult(_0x575504,_0x8504f5))[_0x07cb('0x48')](handleError(_0x575504,null));};exports['show']=function(_0x5f1999,_0x1728c9){var _0x1d4d57={'raw':!![],'where':{'id':_0x5f1999['params']['id']}},_0x2ff533={};_0x2ff533[_0x07cb('0x35')]=_[_0x07cb('0x37')](db[_0x07cb('0x30')]['rawAttributes']);_0x2ff533['query']=_['keys'](_0x5f1999[_0x07cb('0x38')]);_0x2ff533[_0x07cb('0x39')]=_[_0x07cb('0x3a')](_0x2ff533[_0x07cb('0x35')],_0x2ff533['query']);_0x1d4d57[_0x07cb('0x3c')]=_[_0x07cb('0x3a')](_0x2ff533[_0x07cb('0x35')],qs['fields'](_0x5f1999[_0x07cb('0x38')][_0x07cb('0x3b')]));_0x1d4d57[_0x07cb('0x3c')]=_0x1d4d57['attributes'][_0x07cb('0x3d')]?_0x1d4d57[_0x07cb('0x3c')]:_0x2ff533[_0x07cb('0x35')];if(_0x5f1999[_0x07cb('0x38')][_0x07cb('0x45')]){_0x1d4d57[_0x07cb('0x46')]=[{'all':!![]}];}_0x1d4d57=_['merge']({},_0x1d4d57,_0x5f1999[_0x07cb('0x49')]);return db['Template'][_0x07cb('0x4a')](_0x1d4d57)['then'](handleEntityNotFound(_0x1728c9,null))[_0x07cb('0x29')](respondWithResult(_0x1728c9,null))[_0x07cb('0x48')](handleError(_0x1728c9,null));};exports[_0x07cb('0x4b')]=function(_0x11de36,_0x1e03ff){return db[_0x07cb('0x30')][_0x07cb('0x4b')](_0x11de36[_0x07cb('0x4c')],{})['then'](function(_0x1976ab){var _0x29425d=_0x11de36[_0x07cb('0x4d')]['get']({'plain':!![]});if(!_0x29425d)throw new Error(_0x07cb('0x4e'));if(_0x29425d['role']==='user'){var _0x23a66c=_0x1976ab['get']({'plain':!![]});var _0x429fcd=_0x07cb('0x2a');return db[_0x07cb('0x4f')][_0x07cb('0x4a')]({'where':{'name':_0x429fcd,'userProfileId':_0x29425d[_0x07cb('0x50')]},'raw':!![]})[_0x07cb('0x29')](function(_0x4c805d){if(_0x4c805d&&_0x4c805d[_0x07cb('0x51')]===0x0){return db['UserProfileResource'][_0x07cb('0x4b')]({'name':_0x23a66c[_0x07cb('0x36')],'resourceId':_0x23a66c['id'],'type':_0x4c805d[_0x07cb('0x36')],'sectionId':_0x4c805d['id']},{})['then'](function(){return _0x1976ab;});}else{return _0x1976ab;}})[_0x07cb('0x48')](function(_0x28e44e){logger[_0x07cb('0x2c')](_0x07cb('0x52'),_0x28e44e);throw _0x28e44e;});}return _0x1976ab;})[_0x07cb('0x29')](respondWithResult(_0x1e03ff,0xc9))[_0x07cb('0x48')](handleError(_0x1e03ff,null));};exports[_0x07cb('0x27')]=function(_0x493352,_0x1da74f){if(_0x493352[_0x07cb('0x4c')]['id']){delete _0x493352[_0x07cb('0x4c')]['id'];}return db['Template'][_0x07cb('0x4a')]({'where':{'id':_0x493352[_0x07cb('0x53')]['id']}})[_0x07cb('0x29')](handleEntityNotFound(_0x1da74f,null))[_0x07cb('0x29')](saveUpdates(_0x493352['body'],null))['then'](respondWithResult(_0x1da74f,null))[_0x07cb('0x48')](handleError(_0x1da74f,null));};exports['destroy']=function(_0x2357e8,_0x4c93fb){return db['Template'][_0x07cb('0x4a')]({'where':{'id':_0x2357e8[_0x07cb('0x53')]['id']}})['then'](handleEntityNotFound(_0x4c93fb,null))[_0x07cb('0x29')](removeEntity(_0x4c93fb,null))['catch'](handleError(_0x4c93fb,null));}; \ No newline at end of file +var _0xd6c7=['rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Templates','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','then','destroy','UserProfileResource','stack','name','index','map','Template'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xd6c7,0xc9));var _0x7d6c=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xd6c7[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7d6c('0x0'));var jsonpatch=require(_0x7d6c('0x1'));var rp=require(_0x7d6c('0x2'));var moment=require(_0x7d6c('0x3'));var BPromise=require(_0x7d6c('0x4'));var Mustache=require(_0x7d6c('0x5'));var util=require('util');var path=require('path');var sox=require(_0x7d6c('0x6'));var csv=require(_0x7d6c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d6c('0x8'));var _=require(_0x7d6c('0x9'));var squel=require(_0x7d6c('0xa'));var crypto=require(_0x7d6c('0xb'));var jsforce=require(_0x7d6c('0xc'));var deskjs=require(_0x7d6c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7d6c('0xe'));var Papa=require(_0x7d6c('0xf'));var Redis=require(_0x7d6c('0x10'));var authService=require(_0x7d6c('0x11'));var qs=require(_0x7d6c('0x12'));var as=require(_0x7d6c('0x13'));var hardwareService=require(_0x7d6c('0x14'));var logger=require(_0x7d6c('0x15'))(_0x7d6c('0x16'));var utils=require(_0x7d6c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7d6c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20e555,_0x4a6060){_0x4a6060=_0x4a6060||0xcc;return function(_0x44f6e3){if(_0x44f6e3){return _0x20e555[_0x7d6c('0x19')](_0x4a6060);}return _0x20e555[_0x7d6c('0x1a')](_0x4a6060)[_0x7d6c('0x1b')]();};}function respondWithResult(_0x329898,_0x58d1da){_0x58d1da=_0x58d1da||0xc8;return function(_0x2769f6){if(_0x2769f6){return _0x329898[_0x7d6c('0x1a')](_0x58d1da)['json'](_0x2769f6);}};}function respondWithFilteredResult(_0x1e57f7,_0x59a6cd){return function(_0x30a056){if(_0x30a056){var _0x4ea3b4=typeof _0x59a6cd['offset']===_0x7d6c('0x1c')&&typeof _0x59a6cd[_0x7d6c('0x1d')]===_0x7d6c('0x1c');var _0x5d174a=_0x30a056[_0x7d6c('0x1e')];var _0xa67a18=_0x4ea3b4?0x0:_0x59a6cd['offset'];var _0x3c3222=_0x4ea3b4?_0x30a056[_0x7d6c('0x1e')]:_0x59a6cd[_0x7d6c('0x1f')]+_0x59a6cd[_0x7d6c('0x1d')];var _0x15b241;if(_0x3c3222>=_0x5d174a){_0x3c3222=_0x5d174a;_0x15b241=0xc8;}else{_0x15b241=0xce;}_0x1e57f7[_0x7d6c('0x1a')](_0x15b241);return _0x1e57f7['set'](_0x7d6c('0x20'),_0xa67a18+'-'+_0x3c3222+'/'+_0x5d174a)[_0x7d6c('0x21')](_0x30a056);}return null;};}function patchUpdates(_0x5d77fb){return function(_0x1375d3){try{jsonpatch[_0x7d6c('0x22')](_0x1375d3,_0x5d77fb,!![]);}catch(_0x571f38){return BPromise[_0x7d6c('0x23')](_0x571f38);}return _0x1375d3[_0x7d6c('0x24')]();};}function saveUpdates(_0x4bc7f6,_0x45d031){return function(_0x37580a){if(_0x37580a){return _0x37580a['update'](_0x4bc7f6)[_0x7d6c('0x25')](function(_0x2167f8){return _0x2167f8;});}return null;};}function removeEntity(_0xcaf80f,_0x3cbca8){return function(_0xded133){if(_0xded133){return _0xded133[_0x7d6c('0x26')]()[_0x7d6c('0x25')](function(){var _0xc0fd44=_0xded133['get']({'plain':!![]});var _0x963d21='Templates';return db[_0x7d6c('0x27')]['destroy']({'where':{'type':_0x963d21,'resourceId':_0xc0fd44['id']}})[_0x7d6c('0x25')](function(){return _0xded133;});})[_0x7d6c('0x25')](function(){_0xcaf80f[_0x7d6c('0x1a')](0xcc)[_0x7d6c('0x1b')]();});}};}function handleEntityNotFound(_0xa59cfb,_0x250cfe){return function(_0x2e6674){if(!_0x2e6674){_0xa59cfb[_0x7d6c('0x19')](0x194);}return _0x2e6674;};}function handleError(_0x5dec0b,_0x1ca6c6){_0x1ca6c6=_0x1ca6c6||0x1f4;return function(_0x176a3c){logger['error'](_0x176a3c[_0x7d6c('0x28')]);if(_0x176a3c['name']){delete _0x176a3c[_0x7d6c('0x29')];}_0x5dec0b[_0x7d6c('0x1a')](_0x1ca6c6)['send'](_0x176a3c);};}exports[_0x7d6c('0x2a')]=function(_0xfc9983,_0x5d1fd5){var _0x29a9b5={},_0xde64a3={},_0xa25f05={'count':0x0,'rows':[]};var _0x190fef=_[_0x7d6c('0x2b')](db[_0x7d6c('0x2c')][_0x7d6c('0x2d')],function(_0x5611f2){return{'name':_0x5611f2[_0x7d6c('0x2e')],'type':_0x5611f2[_0x7d6c('0x2f')][_0x7d6c('0x30')]};});_0xde64a3[_0x7d6c('0x31')]=_[_0x7d6c('0x2b')](_0x190fef,_0x7d6c('0x29'));_0xde64a3['query']=_[_0x7d6c('0x32')](_0xfc9983[_0x7d6c('0x33')]);_0xde64a3[_0x7d6c('0x34')]=_['intersection'](_0xde64a3[_0x7d6c('0x31')],_0xde64a3['query']);_0x29a9b5[_0x7d6c('0x35')]=_[_0x7d6c('0x36')](_0xde64a3['model'],qs[_0x7d6c('0x37')](_0xfc9983[_0x7d6c('0x33')][_0x7d6c('0x37')]));_0x29a9b5[_0x7d6c('0x35')]=_0x29a9b5[_0x7d6c('0x35')][_0x7d6c('0x38')]?_0x29a9b5[_0x7d6c('0x35')]:_0xde64a3['model'];if(!_0xfc9983[_0x7d6c('0x33')]['hasOwnProperty'](_0x7d6c('0x39'))){_0x29a9b5[_0x7d6c('0x1d')]=qs[_0x7d6c('0x1d')](_0xfc9983[_0x7d6c('0x33')][_0x7d6c('0x1d')]);_0x29a9b5[_0x7d6c('0x1f')]=qs[_0x7d6c('0x1f')](_0xfc9983[_0x7d6c('0x33')][_0x7d6c('0x1f')]);}_0x29a9b5['order']=qs[_0x7d6c('0x3a')](_0xfc9983[_0x7d6c('0x33')][_0x7d6c('0x3a')]);_0x29a9b5[_0x7d6c('0x3b')]=qs['filters'](_[_0x7d6c('0x3c')](_0xfc9983[_0x7d6c('0x33')],_0xde64a3[_0x7d6c('0x34')]),_0x190fef);if(_0xfc9983[_0x7d6c('0x33')][_0x7d6c('0x3d')]){_0x29a9b5[_0x7d6c('0x3b')]=_[_0x7d6c('0x3e')](_0x29a9b5[_0x7d6c('0x3b')],{'$or':_['map'](_0x190fef,function(_0x32f95d){if(_0x32f95d['type']!==_0x7d6c('0x3f')){var _0x3feccc={};_0x3feccc[_0x32f95d[_0x7d6c('0x29')]]={'$like':'%'+_0xfc9983['query'][_0x7d6c('0x3d')]+'%'};return _0x3feccc;}})});}_0x29a9b5=_[_0x7d6c('0x3e')]({},_0x29a9b5,_0xfc9983[_0x7d6c('0x40')]);var _0x9b5e04={'where':_0x29a9b5[_0x7d6c('0x3b')]};return db[_0x7d6c('0x2c')][_0x7d6c('0x1e')](_0x9b5e04)[_0x7d6c('0x25')](function(_0x221952){_0xa25f05[_0x7d6c('0x1e')]=_0x221952;if(_0xfc9983['query'][_0x7d6c('0x41')]){_0x29a9b5[_0x7d6c('0x42')]=[{'all':!![]}];}return db[_0x7d6c('0x2c')][_0x7d6c('0x43')](_0x29a9b5);})[_0x7d6c('0x25')](function(_0x3c881d){_0xa25f05['rows']=_0x3c881d;return _0xa25f05;})[_0x7d6c('0x25')](respondWithFilteredResult(_0x5d1fd5,_0x29a9b5))[_0x7d6c('0x44')](handleError(_0x5d1fd5,null));};exports['show']=function(_0x22f1a6,_0x29eb71){var _0x57e737={'raw':!![],'where':{'id':_0x22f1a6['params']['id']}},_0x41b375={};_0x41b375[_0x7d6c('0x31')]=_[_0x7d6c('0x32')](db[_0x7d6c('0x2c')][_0x7d6c('0x2d')]);_0x41b375[_0x7d6c('0x33')]=_[_0x7d6c('0x32')](_0x22f1a6[_0x7d6c('0x33')]);_0x41b375[_0x7d6c('0x34')]=_['intersection'](_0x41b375[_0x7d6c('0x31')],_0x41b375['query']);_0x57e737['attributes']=_[_0x7d6c('0x36')](_0x41b375[_0x7d6c('0x31')],qs[_0x7d6c('0x37')](_0x22f1a6[_0x7d6c('0x33')][_0x7d6c('0x37')]));_0x57e737[_0x7d6c('0x35')]=_0x57e737[_0x7d6c('0x35')][_0x7d6c('0x38')]?_0x57e737[_0x7d6c('0x35')]:_0x41b375[_0x7d6c('0x31')];if(_0x22f1a6[_0x7d6c('0x33')]['includeAll']){_0x57e737[_0x7d6c('0x42')]=[{'all':!![]}];}_0x57e737=_[_0x7d6c('0x3e')]({},_0x57e737,_0x22f1a6[_0x7d6c('0x40')]);return db[_0x7d6c('0x2c')]['find'](_0x57e737)[_0x7d6c('0x25')](handleEntityNotFound(_0x29eb71,null))[_0x7d6c('0x25')](respondWithResult(_0x29eb71,null))[_0x7d6c('0x44')](handleError(_0x29eb71,null));};exports[_0x7d6c('0x45')]=function(_0x299dd3,_0x1be1bf){return db[_0x7d6c('0x2c')]['create'](_0x299dd3[_0x7d6c('0x46')],{})['then'](function(_0x181c12){var _0x4b3ca0=_0x299dd3[_0x7d6c('0x47')][_0x7d6c('0x48')]({'plain':!![]});if(!_0x4b3ca0)throw new Error(_0x7d6c('0x49'));if(_0x4b3ca0['role']===_0x7d6c('0x47')){var _0x23258a=_0x181c12[_0x7d6c('0x48')]({'plain':!![]});var _0x536e24=_0x7d6c('0x4a');return db[_0x7d6c('0x4b')][_0x7d6c('0x4c')]({'where':{'name':_0x536e24,'userProfileId':_0x4b3ca0[_0x7d6c('0x4d')]},'raw':!![]})[_0x7d6c('0x25')](function(_0x50fa7d){if(_0x50fa7d&&_0x50fa7d['autoAssociation']===0x0){return db[_0x7d6c('0x27')][_0x7d6c('0x45')]({'name':_0x23258a['name'],'resourceId':_0x23258a['id'],'type':_0x50fa7d[_0x7d6c('0x29')],'sectionId':_0x50fa7d['id']},{})[_0x7d6c('0x25')](function(){return _0x181c12;});}else{return _0x181c12;}})[_0x7d6c('0x44')](function(_0x31f0c4){logger[_0x7d6c('0x4e')](_0x7d6c('0x4f'),_0x31f0c4);throw _0x31f0c4;});}return _0x181c12;})[_0x7d6c('0x25')](respondWithResult(_0x1be1bf,0xc9))['catch'](handleError(_0x1be1bf,null));};exports[_0x7d6c('0x50')]=function(_0x2b446f,_0x238f5f){if(_0x2b446f[_0x7d6c('0x46')]['id']){delete _0x2b446f['body']['id'];}return db[_0x7d6c('0x2c')][_0x7d6c('0x4c')]({'where':{'id':_0x2b446f[_0x7d6c('0x51')]['id']}})[_0x7d6c('0x25')](handleEntityNotFound(_0x238f5f,null))[_0x7d6c('0x25')](saveUpdates(_0x2b446f['body'],null))[_0x7d6c('0x25')](respondWithResult(_0x238f5f,null))[_0x7d6c('0x44')](handleError(_0x238f5f,null));};exports[_0x7d6c('0x26')]=function(_0xb8d8c1,_0x4f0b57){return db[_0x7d6c('0x2c')][_0x7d6c('0x4c')]({'where':{'id':_0xb8d8c1[_0x7d6c('0x51')]['id']}})[_0x7d6c('0x25')](handleEntityNotFound(_0x4f0b57,null))[_0x7d6c('0x25')](removeEntity(_0x4f0b57,null))[_0x7d6c('0x44')](handleError(_0x4f0b57,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index a34359e..8b631cb 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 _0x4a5b=['define','tools_templates','lodash','util','../../config/logger','request-promise','path','../../config/environment','./template.attributes','exports'];(function(_0x4ac2ce,_0x55d1ec){var _0x3d10e1=function(_0x413aca){while(--_0x413aca){_0x4ac2ce['push'](_0x4ac2ce['shift']());}};_0x3d10e1(++_0x55d1ec);}(_0x4a5b,0x1e2));var _0xb4a5=function(_0x4c6b5a,_0x59e5be){_0x4c6b5a=_0x4c6b5a-0x0;var _0x39a59a=_0x4a5b[_0x4c6b5a];return _0x39a59a;};'use strict';var _=require(_0xb4a5('0x0'));var util=require(_0xb4a5('0x1'));var logger=require(_0xb4a5('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb4a5('0x3'));var fs=require('fs');var path=require(_0xb4a5('0x4'));var rimraf=require('rimraf');var config=require(_0xb4a5('0x5'));var attributes=require(_0xb4a5('0x6'));module[_0xb4a5('0x7')]=function(_0xbedc01,_0x300cce){return _0xbedc01[_0xb4a5('0x8')]('Template',attributes,{'tableName':_0xb4a5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe989=['define','tools_templates','util','../../config/logger','bluebird','rimraf','../../config/environment','exports'];(function(_0x56e6d3,_0x5bb066){var _0x3e9763=function(_0x2481a9){while(--_0x2481a9){_0x56e6d3['push'](_0x56e6d3['shift']());}};_0x3e9763(++_0x5bb066);}(_0xe989,0xaa));var _0x9e98=function(_0x292427,_0x5dc5d1){_0x292427=_0x292427-0x0;var _0x1e5629=_0xe989[_0x292427];return _0x1e5629;};'use strict';var _=require('lodash');var util=require(_0x9e98('0x0'));var logger=require(_0x9e98('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9e98('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9e98('0x3'));var config=require(_0x9e98('0x4'));var attributes=require('./template.attributes');module[_0x9e98('0x5')]=function(_0x300fb3,_0x40d5e3){return _0x300fb3[_0x9e98('0x6')]('Template',attributes,{'tableName':_0x9e98('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index a530d22..a945d19 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 _0xb2af=['message','result','catch','GetTemplate','Template','options','raw','limit','include','map','attributes','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1c34a9,_0x2d10c7){var _0x493bf2=function(_0x93012c){while(--_0x93012c){_0x1c34a9['push'](_0x1c34a9['shift']());}};_0x493bf2(++_0x2d10c7);}(_0xb2af,0xd2));var _0xfb2a=function(_0x1ab52d,_0x55c814){_0x1ab52d=_0x1ab52d-0x0;var _0x4e0805=_0xb2af[_0x1ab52d];return _0x4e0805;};'use strict';var _=require(_0xfb2a('0x0'));var util=require(_0xfb2a('0x1'));var moment=require(_0xfb2a('0x2'));var BPromise=require(_0xfb2a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb2a('0x4'));var db=require(_0xfb2a('0x5'))['db'];var utils=require(_0xfb2a('0x6'));var logger=require(_0xfb2a('0x7'))(_0xfb2a('0x8'));var config=require('../../config/environment');var jayson=require(_0xfb2a('0x9'));var client=jayson[_0xfb2a('0xa')][_0xfb2a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55cf25,_0x715404,_0x3e20de){return new BPromise(function(_0x1f3315,_0x55bb4e){return client[_0xfb2a('0xc')](_0x55cf25,_0x3e20de)[_0xfb2a('0xd')](function(_0x3d3333){logger[_0xfb2a('0xe')](_0xfb2a('0xf'),_0x715404,_0xfb2a('0x10'));logger[_0xfb2a('0x11')](_0xfb2a('0x12'),_0x715404,_0xfb2a('0x10'),JSON[_0xfb2a('0x13')](_0x3d3333));if(_0x3d3333[_0xfb2a('0x14')]){if(_0x3d3333[_0xfb2a('0x14')]['code']===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x715404,_0x3d3333[_0xfb2a('0x14')][_0xfb2a('0x15')]);return _0x55bb4e(_0x3d3333[_0xfb2a('0x14')][_0xfb2a('0x15')]);}logger['error'](_0xfb2a('0xf'),_0x715404,_0x3d3333['error']['message']);return _0x1f3315(_0x3d3333[_0xfb2a('0x14')]['message']);}else{logger['info'](_0xfb2a('0xf'),_0x715404,_0xfb2a('0x10'));_0x1f3315(_0x3d3333[_0xfb2a('0x16')][_0xfb2a('0x15')]);}})[_0xfb2a('0x17')](function(_0xc85abf){logger[_0xfb2a('0x14')](_0xfb2a('0xf'),_0x715404,_0xc85abf);_0x55bb4e(_0xc85abf);});});}exports[_0xfb2a('0x18')]=function(_0x52743a){var _0x1cdaa7=this;return new Promise(function(_0xb5ff5c,_0x288a32){return db[_0xfb2a('0x19')]['findAll']({'raw':_0x52743a[_0xfb2a('0x1a')]?_0x52743a['options'][_0xfb2a('0x1b')]===undefined?!![]:![]:!![],'where':_0x52743a[_0xfb2a('0x1a')]?_0x52743a[_0xfb2a('0x1a')]['where']||null:null,'attributes':_0x52743a['options']?_0x52743a['options']['attributes']||null:null,'limit':_0x52743a[_0xfb2a('0x1a')]?_0x52743a[_0xfb2a('0x1a')][_0xfb2a('0x1c')]||null:null,'include':_0x52743a[_0xfb2a('0x1a')]?_0x52743a[_0xfb2a('0x1a')][_0xfb2a('0x1d')]?_[_0xfb2a('0x1e')](_0x52743a[_0xfb2a('0x1a')][_0xfb2a('0x1d')],function(_0x351489){return{'model':db[_0x351489['model']],'as':_0x351489['as'],'attributes':_0x351489[_0xfb2a('0x1f')],'include':_0x351489['include']?_[_0xfb2a('0x1e')](_0x351489[_0xfb2a('0x1d')],function(_0x5726b3){return{'model':db[_0x5726b3[_0xfb2a('0x20')]],'as':_0x5726b3['as'],'attributes':_0x5726b3[_0xfb2a('0x1f')],'include':_0x5726b3['include']?_[_0xfb2a('0x1e')](_0x5726b3[_0xfb2a('0x1d')],function(_0x4cdb14){return{'model':db[_0x4cdb14[_0xfb2a('0x20')]],'as':_0x4cdb14['as'],'attributes':_0x4cdb14[_0xfb2a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfb2a('0xd')](function(_0x38a7fa){logger[_0xfb2a('0xe')](_0xfb2a('0x18'),_0x52743a);logger[_0xfb2a('0x11')](_0xfb2a('0x18'),_0x52743a,JSON[_0xfb2a('0x13')](_0x38a7fa));_0xb5ff5c(_0x38a7fa);})[_0xfb2a('0x17')](function(_0x4b79e5){logger[_0xfb2a('0x14')](_0xfb2a('0x18'),_0x4b79e5[_0xfb2a('0x15')],_0x52743a);_0x288a32(_0x1cdaa7[_0xfb2a('0x14')](0x1f4,_0x4b79e5[_0xfb2a('0x15')]));});});}; \ No newline at end of file +var _0x3b44=['findAll','options','raw','where','attributes','limit','include','map','model','GetTemplate','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch'];(function(_0x2040dd,_0x156a63){var _0x27688f=function(_0xb90c80){while(--_0xb90c80){_0x2040dd['push'](_0x2040dd['shift']());}};_0x27688f(++_0x156a63);}(_0x3b44,0xa0));var _0x43b4=function(_0x33ee23,_0x22b9e4){_0x33ee23=_0x33ee23-0x0;var _0x34d783=_0x3b44[_0x33ee23];return _0x34d783;};'use strict';var _=require(_0x43b4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x43b4('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43b4('0x2'))['db'];var utils=require(_0x43b4('0x3'));var logger=require(_0x43b4('0x4'))(_0x43b4('0x5'));var config=require(_0x43b4('0x6'));var jayson=require(_0x43b4('0x7'));var client=jayson['client'][_0x43b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a279a,_0x1e461f,_0x413dd5){return new BPromise(function(_0x4b4341,_0x25c3c8){return client['request'](_0x3a279a,_0x413dd5)[_0x43b4('0x9')](function(_0x2a95bb){logger[_0x43b4('0xa')](_0x43b4('0xb'),_0x1e461f,'request\x20sent');logger[_0x43b4('0xc')](_0x43b4('0xd'),_0x1e461f,'request\x20sent',JSON[_0x43b4('0xe')](_0x2a95bb));if(_0x2a95bb[_0x43b4('0xf')]){if(_0x2a95bb[_0x43b4('0xf')][_0x43b4('0x10')]===0x1f4){logger['error'](_0x43b4('0xb'),_0x1e461f,_0x2a95bb[_0x43b4('0xf')][_0x43b4('0x11')]);return _0x25c3c8(_0x2a95bb[_0x43b4('0xf')][_0x43b4('0x11')]);}logger[_0x43b4('0xf')](_0x43b4('0xb'),_0x1e461f,_0x2a95bb[_0x43b4('0xf')][_0x43b4('0x11')]);return _0x4b4341(_0x2a95bb[_0x43b4('0xf')][_0x43b4('0x11')]);}else{logger['info'](_0x43b4('0xb'),_0x1e461f,_0x43b4('0x12'));_0x4b4341(_0x2a95bb['result']['message']);}})[_0x43b4('0x13')](function(_0x3a5462){logger[_0x43b4('0xf')](_0x43b4('0xb'),_0x1e461f,_0x3a5462);_0x25c3c8(_0x3a5462);});});}exports['GetTemplate']=function(_0x2d4bd5){var _0x339757=this;return new Promise(function(_0x33b6e3,_0x3ffad0){return db['Template'][_0x43b4('0x14')]({'raw':_0x2d4bd5[_0x43b4('0x15')]?_0x2d4bd5[_0x43b4('0x15')][_0x43b4('0x16')]===undefined?!![]:![]:!![],'where':_0x2d4bd5[_0x43b4('0x15')]?_0x2d4bd5['options'][_0x43b4('0x17')]||null:null,'attributes':_0x2d4bd5[_0x43b4('0x15')]?_0x2d4bd5['options'][_0x43b4('0x18')]||null:null,'limit':_0x2d4bd5[_0x43b4('0x15')]?_0x2d4bd5['options'][_0x43b4('0x19')]||null:null,'include':_0x2d4bd5['options']?_0x2d4bd5[_0x43b4('0x15')][_0x43b4('0x1a')]?_[_0x43b4('0x1b')](_0x2d4bd5['options'][_0x43b4('0x1a')],function(_0x4bd9aa){return{'model':db[_0x4bd9aa[_0x43b4('0x1c')]],'as':_0x4bd9aa['as'],'attributes':_0x4bd9aa[_0x43b4('0x18')],'include':_0x4bd9aa[_0x43b4('0x1a')]?_[_0x43b4('0x1b')](_0x4bd9aa['include'],function(_0x452658){return{'model':db[_0x452658[_0x43b4('0x1c')]],'as':_0x452658['as'],'attributes':_0x452658[_0x43b4('0x18')],'include':_0x452658['include']?_[_0x43b4('0x1b')](_0x452658['include'],function(_0x128833){return{'model':db[_0x128833[_0x43b4('0x1c')]],'as':_0x128833['as'],'attributes':_0x128833['attributes']};}):[]};}):[]};}):[]:[]})[_0x43b4('0x9')](function(_0x360394){logger['info']('GetTemplate',_0x2d4bd5);logger[_0x43b4('0xc')](_0x43b4('0x1d'),_0x2d4bd5,JSON[_0x43b4('0xe')](_0x360394));_0x33b6e3(_0x360394);})['catch'](function(_0x3f2b91){logger[_0x43b4('0xf')](_0x43b4('0x1d'),_0x3f2b91[_0x43b4('0x11')],_0x2d4bd5);_0x3ffad0(_0x339757[_0x43b4('0xf')](0x1f4,_0x3f2b91[_0x43b4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index b5078c3..8ac3aab 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 _0xfa3d=['show','/:id/all_conditions','/:id/any_conditions','getActions','post','create','addAnyCondition','addAction','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id'];(function(_0x2257c3,_0x38dc9b){var _0x53638c=function(_0x26bcdb){while(--_0x26bcdb){_0x2257c3['push'](_0x2257c3['shift']());}};_0x53638c(++_0x38dc9b);}(_0xfa3d,0x9d));var _0xdfa3=function(_0x1ae821,_0x2145c1){_0x1ae821=_0x1ae821-0x0;var _0x4ab020=_0xfa3d[_0x1ae821];return _0x4ab020;};'use strict';var multer=require(_0xdfa3('0x0'));var util=require('util');var path=require(_0xdfa3('0x1'));var timeout=require('connect-timeout');var express=require(_0xdfa3('0x2'));var router=express[_0xdfa3('0x3')]();var fs_extra=require(_0xdfa3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdfa3('0x5'));var config=require('../../config/environment');var controller=require(_0xdfa3('0x6'));router[_0xdfa3('0x7')]('/',auth[_0xdfa3('0x8')](),controller[_0xdfa3('0x9')]);router[_0xdfa3('0x7')](_0xdfa3('0xa'),auth[_0xdfa3('0x8')](),controller[_0xdfa3('0xb')]);router[_0xdfa3('0x7')](_0xdfa3('0xc'),auth[_0xdfa3('0x8')](),controller['getAllConditions']);router['get'](_0xdfa3('0xd'),auth[_0xdfa3('0x8')](),controller['getAnyConditions']);router['get']('/:id/actions',auth['isAuthenticated'](),controller[_0xdfa3('0xe')]);router[_0xdfa3('0xf')]('/',auth[_0xdfa3('0x8')](),controller[_0xdfa3('0x10')]);router[_0xdfa3('0xf')]('/:id/all_conditions',auth[_0xdfa3('0x8')](),controller['addAllCondition']);router['post'](_0xdfa3('0xd'),auth[_0xdfa3('0x8')](),controller[_0xdfa3('0x11')]);router[_0xdfa3('0xf')]('/:id/actions',auth[_0xdfa3('0x8')](),controller[_0xdfa3('0x12')]);router[_0xdfa3('0x13')](_0xdfa3('0xa'),auth[_0xdfa3('0x8')](),controller[_0xdfa3('0x14')]);router[_0xdfa3('0x15')](_0xdfa3('0xa'),auth[_0xdfa3('0x8')](),controller[_0xdfa3('0x16')]);module[_0xdfa3('0x17')]=router; \ No newline at end of file +var _0xefd8=['create','addAllCondition','/:id/actions','addAction','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','post'];(function(_0x22cefd,_0x352a38){var _0x2e23c2=function(_0x1332a3){while(--_0x1332a3){_0x22cefd['push'](_0x22cefd['shift']());}};_0x2e23c2(++_0x352a38);}(_0xefd8,0x1d3));var _0x8efd=function(_0x54bc01,_0x3c2d5a){_0x54bc01=_0x54bc01-0x0;var _0x14a34f=_0xefd8[_0x54bc01];return _0x14a34f;};'use strict';var multer=require(_0x8efd('0x0'));var util=require(_0x8efd('0x1'));var path=require(_0x8efd('0x2'));var timeout=require(_0x8efd('0x3'));var express=require(_0x8efd('0x4'));var router=express[_0x8efd('0x5')]();var fs_extra=require(_0x8efd('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8efd('0x7'));var controller=require(_0x8efd('0x8'));router[_0x8efd('0x9')]('/',auth[_0x8efd('0xa')](),controller[_0x8efd('0xb')]);router[_0x8efd('0x9')](_0x8efd('0xc'),auth[_0x8efd('0xa')](),controller[_0x8efd('0xd')]);router[_0x8efd('0x9')](_0x8efd('0xe'),auth[_0x8efd('0xa')](),controller[_0x8efd('0xf')]);router[_0x8efd('0x9')](_0x8efd('0x10'),auth[_0x8efd('0xa')](),controller[_0x8efd('0x11')]);router[_0x8efd('0x9')]('/:id/actions',auth[_0x8efd('0xa')](),controller['getActions']);router[_0x8efd('0x12')]('/',auth[_0x8efd('0xa')](),controller[_0x8efd('0x13')]);router['post'](_0x8efd('0xe'),auth[_0x8efd('0xa')](),controller[_0x8efd('0x14')]);router[_0x8efd('0x12')](_0x8efd('0x10'),auth['isAuthenticated'](),controller['addAnyCondition']);router[_0x8efd('0x12')](_0x8efd('0x15'),auth[_0x8efd('0xa')](),controller[_0x8efd('0x16')]);router[_0x8efd('0x17')](_0x8efd('0xc'),auth[_0x8efd('0xa')](),controller[_0x8efd('0x18')]);router[_0x8efd('0x19')](_0x8efd('0xc'),auth[_0x8efd('0xa')](),controller['destroy']);module[_0x8efd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index a783989..ea17da6 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 _0xac08=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3a4ab7,_0x132c42){var _0x21b043=function(_0x191377){while(--_0x191377){_0x3a4ab7['push'](_0x3a4ab7['shift']());}};_0x21b043(++_0x132c42);}(_0xac08,0x1f4));var _0x8ac0=function(_0x3d7001,_0x2879ac){_0x3d7001=_0x3d7001-0x0;var _0x2866d7=_0xac08[_0x3d7001];return _0x2866d7;};'use strict';var Sequelize=require(_0x8ac0('0x0'));module[_0x8ac0('0x1')]={'name':{'type':Sequelize[_0x8ac0('0x2')]},'channel':{'type':Sequelize[_0x8ac0('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x8ac0('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xeb9d=['sequelize','STRING'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0xeb9d,0x1a2));var _0xdeb9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb9d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xdeb9('0x0'));module['exports']={'name':{'type':Sequelize[_0xdeb9('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdeb9('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 08a0436..09e1323 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 _0x196d=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','hasOwnProperty','getAnyConditions','findOne','nolimit','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','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/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','Triggers','UserProfileResource','stack','name','send','index','map','fieldName','key','model','keys','query','filters','intersection','fields','attributes','order','sort','pick','filter','where','merge','type','VIRTUAL','options','Trigger','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create'];(function(_0x3e54d5,_0x179556){var _0x35ad39=function(_0x11cae5){while(--_0x11cae5){_0x3e54d5['push'](_0x3e54d5['shift']());}};_0x35ad39(++_0x179556);}(_0x196d,0xd3));var _0xd196=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x196d[_0x725b8e];return _0x43ac45;};'use strict';var emlformat=require(_0xd196('0x0'));var rimraf=require(_0xd196('0x1'));var zipdir=require(_0xd196('0x2'));var jsonpatch=require(_0xd196('0x3'));var rp=require('request-promise');var moment=require(_0xd196('0x4'));var BPromise=require(_0xd196('0x5'));var Mustache=require(_0xd196('0x6'));var util=require(_0xd196('0x7'));var path=require(_0xd196('0x8'));var sox=require(_0xd196('0x9'));var csv=require(_0xd196('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd196('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd196('0xc'));var jsforce=require(_0xd196('0xd'));var deskjs=require(_0xd196('0xe'));var toCsv=require(_0xd196('0xa'));var querystring=require(_0xd196('0xf'));var Papa=require('papaparse');var Redis=require(_0xd196('0x10'));var authService=require(_0xd196('0x11'));var qs=require(_0xd196('0x12'));var as=require(_0xd196('0x13'));var hardwareService=require(_0xd196('0x14'));var logger=require(_0xd196('0x15'))(_0xd196('0x16'));var utils=require(_0xd196('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd196('0x18'));var db=require(_0xd196('0x19'))['db'];function respondWithStatusCode(_0x40989f,_0x102476){_0x102476=_0x102476||0xcc;return function(_0x452727){if(_0x452727){return _0x40989f[_0xd196('0x1a')](_0x102476);}return _0x40989f[_0xd196('0x1b')](_0x102476)[_0xd196('0x1c')]();};}function respondWithResult(_0x447202,_0x1c44e9){_0x1c44e9=_0x1c44e9||0xc8;return function(_0xc9ff7a){if(_0xc9ff7a){return _0x447202[_0xd196('0x1b')](_0x1c44e9)['json'](_0xc9ff7a);}};}function respondWithFilteredResult(_0x482eee,_0xd2a763){return function(_0xb34fc8){if(_0xb34fc8){var _0x230f8b=typeof _0xd2a763[_0xd196('0x1d')]===_0xd196('0x1e')&&typeof _0xd2a763[_0xd196('0x1f')]===_0xd196('0x1e');var _0x2209e3=_0xb34fc8[_0xd196('0x20')];var _0x2c8aae=_0x230f8b?0x0:_0xd2a763[_0xd196('0x1d')];var _0x4b1673=_0x230f8b?_0xb34fc8[_0xd196('0x20')]:_0xd2a763[_0xd196('0x1d')]+_0xd2a763['limit'];var _0x48c18a;if(_0x4b1673>=_0x2209e3){_0x4b1673=_0x2209e3;_0x48c18a=0xc8;}else{_0x48c18a=0xce;}_0x482eee['status'](_0x48c18a);return _0x482eee[_0xd196('0x21')]('Content-Range',_0x2c8aae+'-'+_0x4b1673+'/'+_0x2209e3)[_0xd196('0x22')](_0xb34fc8);}return null;};}function patchUpdates(_0x181063){return function(_0x42252c){try{jsonpatch[_0xd196('0x23')](_0x42252c,_0x181063,!![]);}catch(_0x4422d6){return BPromise[_0xd196('0x24')](_0x4422d6);}return _0x42252c[_0xd196('0x25')]();};}function saveUpdates(_0x47de82,_0x5420f0){return function(_0x3a5d18){if(_0x3a5d18){return _0x3a5d18[_0xd196('0x26')](_0x47de82)[_0xd196('0x27')](function(_0x489236){return _0x489236;});}return null;};}function removeEntity(_0x36ec40,_0x291088){return function(_0x3e8944){if(_0x3e8944){return _0x3e8944[_0xd196('0x28')]()[_0xd196('0x27')](function(){var _0x1d190c=_0x3e8944['get']({'plain':!![]});var _0x28cf52=_0xd196('0x29');return db[_0xd196('0x2a')]['destroy']({'where':{'type':_0x28cf52,'resourceId':_0x1d190c['id']}})[_0xd196('0x27')](function(){return _0x3e8944;});})[_0xd196('0x27')](function(){_0x36ec40[_0xd196('0x1b')](0xcc)[_0xd196('0x1c')]();});}};}function handleEntityNotFound(_0x59021d,_0x2fe903){return function(_0x5711d2){if(!_0x5711d2){_0x59021d[_0xd196('0x1a')](0x194);}return _0x5711d2;};}function handleError(_0x459d28,_0xa99dc8){_0xa99dc8=_0xa99dc8||0x1f4;return function(_0x1af7d9){logger['error'](_0x1af7d9[_0xd196('0x2b')]);if(_0x1af7d9[_0xd196('0x2c')]){delete _0x1af7d9[_0xd196('0x2c')];}_0x459d28[_0xd196('0x1b')](_0xa99dc8)[_0xd196('0x2d')](_0x1af7d9);};}exports[_0xd196('0x2e')]=function(_0x4c43df,_0x23ad2b){var _0x38099d={},_0x48784c={},_0x17f378={'count':0x0,'rows':[]};var _0x42060a=_[_0xd196('0x2f')](db['Trigger']['rawAttributes'],function(_0x9433d1){return{'name':_0x9433d1[_0xd196('0x30')],'type':_0x9433d1['type'][_0xd196('0x31')]};});_0x48784c[_0xd196('0x32')]=_[_0xd196('0x2f')](_0x42060a,'name');_0x48784c['query']=_[_0xd196('0x33')](_0x4c43df[_0xd196('0x34')]);_0x48784c[_0xd196('0x35')]=_['intersection'](_0x48784c[_0xd196('0x32')],_0x48784c['query']);_0x38099d['attributes']=_[_0xd196('0x36')](_0x48784c[_0xd196('0x32')],qs[_0xd196('0x37')](_0x4c43df[_0xd196('0x34')][_0xd196('0x37')]));_0x38099d['attributes']=_0x38099d[_0xd196('0x38')]['length']?_0x38099d['attributes']:_0x48784c[_0xd196('0x32')];if(!_0x4c43df[_0xd196('0x34')]['hasOwnProperty']('nolimit')){_0x38099d[_0xd196('0x1f')]=qs[_0xd196('0x1f')](_0x4c43df[_0xd196('0x34')][_0xd196('0x1f')]);_0x38099d[_0xd196('0x1d')]=qs['offset'](_0x4c43df[_0xd196('0x34')]['offset']);}_0x38099d[_0xd196('0x39')]=qs[_0xd196('0x3a')](_0x4c43df[_0xd196('0x34')][_0xd196('0x3a')]);_0x38099d['where']=qs[_0xd196('0x35')](_[_0xd196('0x3b')](_0x4c43df['query'],_0x48784c[_0xd196('0x35')]),_0x42060a);if(_0x4c43df['query'][_0xd196('0x3c')]){_0x38099d[_0xd196('0x3d')]=_[_0xd196('0x3e')](_0x38099d['where'],{'$or':_[_0xd196('0x2f')](_0x42060a,function(_0x1688a4){if(_0x1688a4[_0xd196('0x3f')]!==_0xd196('0x40')){var _0x35cc33={};_0x35cc33[_0x1688a4[_0xd196('0x2c')]]={'$like':'%'+_0x4c43df[_0xd196('0x34')][_0xd196('0x3c')]+'%'};return _0x35cc33;}})});}_0x38099d=_[_0xd196('0x3e')]({},_0x38099d,_0x4c43df[_0xd196('0x41')]);var _0x4afbf9={'where':_0x38099d[_0xd196('0x3d')]};return db[_0xd196('0x42')][_0xd196('0x20')](_0x4afbf9)['then'](function(_0x457c4b){_0x17f378[_0xd196('0x20')]=_0x457c4b;if(_0x4c43df[_0xd196('0x34')][_0xd196('0x43')]){_0x38099d[_0xd196('0x44')]=[{'all':!![]}];}return db[_0xd196('0x42')][_0xd196('0x45')](_0x38099d);})[_0xd196('0x27')](function(_0x4e06ac){_0x17f378[_0xd196('0x46')]=_0x4e06ac;return _0x17f378;})['then'](respondWithFilteredResult(_0x23ad2b,_0x38099d))[_0xd196('0x47')](handleError(_0x23ad2b,null));};exports['show']=function(_0x26f6ac,_0x52a6a5){var _0x4a4c29={'raw':![],'where':{'id':_0x26f6ac[_0xd196('0x48')]['id']}},_0x144600={};_0x144600['model']=_[_0xd196('0x33')](db['Trigger'][_0xd196('0x49')]);_0x144600[_0xd196('0x34')]=_[_0xd196('0x33')](_0x26f6ac['query']);_0x144600[_0xd196('0x35')]=_[_0xd196('0x36')](_0x144600[_0xd196('0x32')],_0x144600[_0xd196('0x34')]);_0x4a4c29[_0xd196('0x38')]=_[_0xd196('0x36')](_0x144600['model'],qs[_0xd196('0x37')](_0x26f6ac[_0xd196('0x34')]['fields']));_0x4a4c29['attributes']=_0x4a4c29[_0xd196('0x38')][_0xd196('0x4a')]?_0x4a4c29[_0xd196('0x38')]:_0x144600[_0xd196('0x32')];if(_0x26f6ac['query'][_0xd196('0x43')]){_0x4a4c29['include']=[{'all':!![]}];}_0x4a4c29=_[_0xd196('0x3e')]({},_0x4a4c29,_0x26f6ac[_0xd196('0x41')]);return db[_0xd196('0x42')][_0xd196('0x4b')](_0x4a4c29)[_0xd196('0x27')](handleEntityNotFound(_0x52a6a5,null))[_0xd196('0x27')](respondWithResult(_0x52a6a5,null))[_0xd196('0x47')](handleError(_0x52a6a5,null));};exports[_0xd196('0x4c')]=function(_0x562542,_0x3cae75){return db[_0xd196('0x42')][_0xd196('0x4c')](_0x562542[_0xd196('0x4d')],{})['then'](function(_0x26d42b){var _0x306ee0=_0x562542[_0xd196('0x4e')]['get']({'plain':!![]});if(!_0x306ee0)throw new Error(_0xd196('0x4f'));if(_0x306ee0['role']==='user'){var _0xe00686=_0x26d42b[_0xd196('0x50')]({'plain':!![]});var _0x29013a='Triggers';return db[_0xd196('0x51')]['find']({'where':{'name':_0x29013a,'userProfileId':_0x306ee0['userProfileId']},'raw':!![]})[_0xd196('0x27')](function(_0x5e06ca){if(_0x5e06ca&&_0x5e06ca[_0xd196('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0xe00686['name'],'resourceId':_0xe00686['id'],'type':_0x5e06ca[_0xd196('0x2c')],'sectionId':_0x5e06ca['id']},{})[_0xd196('0x27')](function(){return _0x26d42b;});}else{return _0x26d42b;}})[_0xd196('0x47')](function(_0x3985e1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3985e1);throw _0x3985e1;});}return _0x26d42b;})[_0xd196('0x27')](respondWithResult(_0x3cae75,0xc9))[_0xd196('0x47')](handleError(_0x3cae75,null));};exports[_0xd196('0x26')]=function(_0x537285,_0x5c11e8){if(_0x537285[_0xd196('0x4d')]['id']){delete _0x537285[_0xd196('0x4d')]['id'];}return db[_0xd196('0x42')][_0xd196('0x4b')]({'where':{'id':_0x537285[_0xd196('0x48')]['id']}})['then'](handleEntityNotFound(_0x5c11e8,null))[_0xd196('0x27')](saveUpdates(_0x537285[_0xd196('0x4d')],null))[_0xd196('0x27')](respondWithResult(_0x5c11e8,null))[_0xd196('0x47')](handleError(_0x5c11e8,null));};exports[_0xd196('0x28')]=function(_0x2b0241,_0x12cac7){return db[_0xd196('0x42')]['find']({'where':{'id':_0x2b0241['params']['id']}})[_0xd196('0x27')](handleEntityNotFound(_0x12cac7,null))['then'](removeEntity(_0x12cac7,null))[_0xd196('0x47')](handleError(_0x12cac7,null));};exports[_0xd196('0x53')]=function(_0x4f744c,_0x9a8443,_0x56c539){if(_0x4f744c[_0xd196('0x4d')]['id']){delete _0x4f744c[_0xd196('0x4d')]['id'];}return db[_0xd196('0x42')][_0xd196('0x4b')]({'where':{'id':_0x4f744c[_0xd196('0x48')]['id']}})[_0xd196('0x27')](handleEntityNotFound(_0x9a8443,null))[_0xd196('0x27')](function(_0x11dccd){if(_0x11dccd){_0x4f744c[_0xd196('0x4d')][_0xd196('0x54')]=_0x11dccd['id'];return db[_0xd196('0x55')][_0xd196('0x4c')](_0x4f744c[_0xd196('0x4d')]);}})[_0xd196('0x27')](respondWithResult(_0x9a8443,null))[_0xd196('0x47')](handleError(_0x9a8443,null));};exports[_0xd196('0x56')]=function(_0x33b5b6,_0x3985f5,_0x298b88){if(_0x33b5b6['body']['id']){delete _0x33b5b6[_0xd196('0x4d')]['id'];}return db[_0xd196('0x42')][_0xd196('0x4b')]({'where':{'id':_0x33b5b6[_0xd196('0x48')]['id']}})[_0xd196('0x27')](handleEntityNotFound(_0x3985f5,null))[_0xd196('0x27')](function(_0x2215ba){if(_0x2215ba){_0x33b5b6[_0xd196('0x4d')][_0xd196('0x57')]=_0x2215ba['id'];return db[_0xd196('0x55')][_0xd196('0x4c')](_0x33b5b6[_0xd196('0x4d')]);}})[_0xd196('0x27')](respondWithResult(_0x3985f5,null))[_0xd196('0x47')](handleError(_0x3985f5,null));};exports[_0xd196('0x58')]=function(_0x2d3d78,_0x50e5b4,_0x16bac6){var _0x5baa74={};var _0x465b8f={};var _0xd1fb8d;var _0x4a85d6;return db['Trigger']['findOne']({'where':{'id':_0x2d3d78[_0xd196('0x48')]['id']}})[_0xd196('0x27')](handleEntityNotFound(_0x50e5b4,null))['then'](function(_0x2ad2ec){if(_0x2ad2ec){_0xd1fb8d=_0x2ad2ec;_0x465b8f[_0xd196('0x32')]=_[_0xd196('0x33')](db[_0xd196('0x55')][_0xd196('0x49')]);_0x465b8f[_0xd196('0x34')]=_[_0xd196('0x33')](_0x2d3d78['query']);_0x465b8f[_0xd196('0x35')]=_[_0xd196('0x36')](_0x465b8f[_0xd196('0x32')],_0x465b8f[_0xd196('0x34')]);_0x5baa74['attributes']=_[_0xd196('0x36')](_0x465b8f[_0xd196('0x32')],qs['fields'](_0x2d3d78['query']['fields']));_0x5baa74[_0xd196('0x38')]=_0x5baa74[_0xd196('0x38')][_0xd196('0x4a')]?_0x5baa74[_0xd196('0x38')]:_0x465b8f[_0xd196('0x32')];_0x5baa74[_0xd196('0x39')]=qs[_0xd196('0x3a')](_0x2d3d78[_0xd196('0x34')][_0xd196('0x3a')]);_0x5baa74[_0xd196('0x3d')]=qs[_0xd196('0x35')](_[_0xd196('0x3b')](_0x2d3d78[_0xd196('0x34')],_0x465b8f['filters']));if(_0x2d3d78[_0xd196('0x34')]['filter']){_0x5baa74[_0xd196('0x3d')]=_['merge'](_0x5baa74[_0xd196('0x3d')],{'$or':_['map'](_0x5baa74['attributes'],function(_0x292485){var _0x236013={};_0x236013[_0x292485]={'$like':'%'+_0x2d3d78[_0xd196('0x34')][_0xd196('0x3c')]+'%'};return _0x236013;})});}_0x5baa74=_[_0xd196('0x3e')]({},_0x5baa74,_0x2d3d78['options']);return _0xd1fb8d['getAllConditions'](_0x5baa74);}})[_0xd196('0x27')](function(_0x158dad){if(_0x158dad){_0x4a85d6=_0x158dad['length'];if(!_0x2d3d78[_0xd196('0x34')][_0xd196('0x59')]('nolimit')){_0x5baa74[_0xd196('0x1f')]=qs[_0xd196('0x1f')](_0x2d3d78[_0xd196('0x34')][_0xd196('0x1f')]);_0x5baa74['offset']=qs[_0xd196('0x1d')](_0x2d3d78[_0xd196('0x34')][_0xd196('0x1d')]);}return _0xd1fb8d[_0xd196('0x58')](_0x5baa74);}})[_0xd196('0x27')](function(_0x20feb6){if(_0x20feb6){return _0x20feb6?{'count':_0x4a85d6,'rows':_0x20feb6}:null;}})[_0xd196('0x27')](respondWithResult(_0x50e5b4,null))[_0xd196('0x47')](handleError(_0x50e5b4,null));};exports[_0xd196('0x5a')]=function(_0x1c6f1c,_0x468483,_0x22bfd8){var _0x5687f9={};var _0x1a14ec={};var _0x12a9cd;var _0x50b599;return db['Trigger'][_0xd196('0x5b')]({'where':{'id':_0x1c6f1c['params']['id']}})[_0xd196('0x27')](handleEntityNotFound(_0x468483,null))[_0xd196('0x27')](function(_0x6fe4ce){if(_0x6fe4ce){_0x12a9cd=_0x6fe4ce;_0x1a14ec[_0xd196('0x32')]=_[_0xd196('0x33')](db['Condition'][_0xd196('0x49')]);_0x1a14ec[_0xd196('0x34')]=_[_0xd196('0x33')](_0x1c6f1c[_0xd196('0x34')]);_0x1a14ec[_0xd196('0x35')]=_[_0xd196('0x36')](_0x1a14ec[_0xd196('0x32')],_0x1a14ec[_0xd196('0x34')]);_0x5687f9[_0xd196('0x38')]=_[_0xd196('0x36')](_0x1a14ec['model'],qs[_0xd196('0x37')](_0x1c6f1c[_0xd196('0x34')]['fields']));_0x5687f9[_0xd196('0x38')]=_0x5687f9[_0xd196('0x38')][_0xd196('0x4a')]?_0x5687f9[_0xd196('0x38')]:_0x1a14ec[_0xd196('0x32')];_0x5687f9[_0xd196('0x39')]=qs['sort'](_0x1c6f1c['query'][_0xd196('0x3a')]);_0x5687f9['where']=qs['filters'](_[_0xd196('0x3b')](_0x1c6f1c[_0xd196('0x34')],_0x1a14ec[_0xd196('0x35')]));if(_0x1c6f1c[_0xd196('0x34')][_0xd196('0x3c')]){_0x5687f9[_0xd196('0x3d')]=_[_0xd196('0x3e')](_0x5687f9['where'],{'$or':_[_0xd196('0x2f')](_0x5687f9[_0xd196('0x38')],function(_0x375141){var _0x5c6b15={};_0x5c6b15[_0x375141]={'$like':'%'+_0x1c6f1c[_0xd196('0x34')][_0xd196('0x3c')]+'%'};return _0x5c6b15;})});}_0x5687f9=_[_0xd196('0x3e')]({},_0x5687f9,_0x1c6f1c['options']);return _0x12a9cd['getAnyConditions'](_0x5687f9);}})[_0xd196('0x27')](function(_0x3942d1){if(_0x3942d1){_0x50b599=_0x3942d1[_0xd196('0x4a')];if(!_0x1c6f1c['query'][_0xd196('0x59')](_0xd196('0x5c'))){_0x5687f9[_0xd196('0x1f')]=qs[_0xd196('0x1f')](_0x1c6f1c['query'][_0xd196('0x1f')]);_0x5687f9['offset']=qs[_0xd196('0x1d')](_0x1c6f1c[_0xd196('0x34')]['offset']);}return _0x12a9cd[_0xd196('0x5a')](_0x5687f9);}})[_0xd196('0x27')](function(_0x1e4977){if(_0x1e4977){return _0x1e4977?{'count':_0x50b599,'rows':_0x1e4977}:null;}})[_0xd196('0x27')](respondWithResult(_0x468483,null))[_0xd196('0x47')](handleError(_0x468483,null));};exports['addAction']=function(_0x113f39,_0x29ec1a,_0x2aae63){if(_0x113f39[_0xd196('0x4d')]['id']){delete _0x113f39[_0xd196('0x4d')]['id'];}return db['Trigger']['find']({'where':{'id':_0x113f39['params']['id']}})['then'](handleEntityNotFound(_0x29ec1a,null))[_0xd196('0x27')](function(_0x4e8918){if(_0x4e8918){_0x113f39[_0xd196('0x4d')][_0xd196('0x5d')]=_0x4e8918['id'];return db['Action'][_0xd196('0x4c')](_0x113f39[_0xd196('0x4d')]);}})['then'](respondWithResult(_0x29ec1a,null))[_0xd196('0x47')](handleError(_0x29ec1a,null));};exports[_0xd196('0x5e')]=function(_0x11e897,_0x44e05d,_0x1a2de2){var _0x1b8e54={};var _0x5ce9b7={};var _0x1d8cbf;var _0x2954e2;return db[_0xd196('0x42')][_0xd196('0x5b')]({'where':{'id':_0x11e897[_0xd196('0x48')]['id']}})['then'](handleEntityNotFound(_0x44e05d,null))[_0xd196('0x27')](function(_0x32b655){if(_0x32b655){_0x1d8cbf=_0x32b655;_0x5ce9b7['model']=_['keys'](db[_0xd196('0x5f')][_0xd196('0x49')]);_0x5ce9b7['query']=_[_0xd196('0x33')](_0x11e897[_0xd196('0x34')]);_0x5ce9b7[_0xd196('0x35')]=_[_0xd196('0x36')](_0x5ce9b7['model'],_0x5ce9b7[_0xd196('0x34')]);_0x1b8e54[_0xd196('0x38')]=_[_0xd196('0x36')](_0x5ce9b7[_0xd196('0x32')],qs['fields'](_0x11e897['query'][_0xd196('0x37')]));_0x1b8e54[_0xd196('0x38')]=_0x1b8e54[_0xd196('0x38')][_0xd196('0x4a')]?_0x1b8e54[_0xd196('0x38')]:_0x5ce9b7[_0xd196('0x32')];_0x1b8e54[_0xd196('0x39')]=qs[_0xd196('0x3a')](_0x11e897[_0xd196('0x34')][_0xd196('0x3a')]);_0x1b8e54[_0xd196('0x3d')]=qs[_0xd196('0x35')](_['pick'](_0x11e897[_0xd196('0x34')],_0x5ce9b7[_0xd196('0x35')]));if(_0x11e897[_0xd196('0x34')][_0xd196('0x3c')]){_0x1b8e54[_0xd196('0x3d')]=_[_0xd196('0x3e')](_0x1b8e54[_0xd196('0x3d')],{'$or':_['map'](_0x1b8e54[_0xd196('0x38')],function(_0xec9906){var _0x4436e6={};_0x4436e6[_0xec9906]={'$like':'%'+_0x11e897[_0xd196('0x34')][_0xd196('0x3c')]+'%'};return _0x4436e6;})});}_0x1b8e54=_[_0xd196('0x3e')]({},_0x1b8e54,_0x11e897[_0xd196('0x41')]);return _0x1d8cbf[_0xd196('0x5e')](_0x1b8e54);}})['then'](function(_0x406a55){if(_0x406a55){_0x2954e2=_0x406a55[_0xd196('0x4a')];if(!_0x11e897[_0xd196('0x34')][_0xd196('0x59')](_0xd196('0x5c'))){_0x1b8e54['limit']=qs['limit'](_0x11e897[_0xd196('0x34')][_0xd196('0x1f')]);_0x1b8e54['offset']=qs[_0xd196('0x1d')](_0x11e897['query']['offset']);}return _0x1d8cbf[_0xd196('0x5e')](_0x1b8e54);}})[_0xd196('0x27')](function(_0x511b61){if(_0x511b61){return _0x511b61?{'count':_0x2954e2,'rows':_0x511b61}:null;}})[_0xd196('0x27')](respondWithResult(_0x44e05d,null))[_0xd196('0x47')](handleError(_0x44e05d,null));}; \ No newline at end of file +var _0x612f=['UserProfileResource','stack','name','map','type','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','Trigger','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Triggers','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','findOne','getAllConditions','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x4d564f,_0x2f7432){var _0xce8e4a=function(_0x55843b){while(--_0x55843b){_0x4d564f['push'](_0x4d564f['shift']());}};_0xce8e4a(++_0x2f7432);}(_0x612f,0x9a));var _0xf612=function(_0x153192,_0x27f3d8){_0x153192=_0x153192-0x0;var _0x1dee19=_0x612f[_0x153192];return _0x1dee19;};'use strict';var emlformat=require(_0xf612('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf612('0x1'));var jsonpatch=require(_0xf612('0x2'));var rp=require(_0xf612('0x3'));var moment=require(_0xf612('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf612('0x5'));var util=require(_0xf612('0x6'));var path=require(_0xf612('0x7'));var sox=require(_0xf612('0x8'));var csv=require('to-csv');var ejs=require(_0xf612('0x9'));var fs=require('fs');var fs_extra=require(_0xf612('0xa'));var _=require(_0xf612('0xb'));var squel=require(_0xf612('0xc'));var crypto=require(_0xf612('0xd'));var jsforce=require(_0xf612('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf612('0xf'));var querystring=require(_0xf612('0x10'));var Papa=require(_0xf612('0x11'));var Redis=require(_0xf612('0x12'));var authService=require(_0xf612('0x13'));var qs=require(_0xf612('0x14'));var as=require(_0xf612('0x15'));var hardwareService=require(_0xf612('0x16'));var logger=require('../../config/logger')(_0xf612('0x17'));var utils=require(_0xf612('0x18'));var config=require(_0xf612('0x19'));var licenseUtil=require(_0xf612('0x1a'));var db=require(_0xf612('0x1b'))['db'];function respondWithStatusCode(_0x48df68,_0x1ae2bc){_0x1ae2bc=_0x1ae2bc||0xcc;return function(_0x856c10){if(_0x856c10){return _0x48df68[_0xf612('0x1c')](_0x1ae2bc);}return _0x48df68['status'](_0x1ae2bc)[_0xf612('0x1d')]();};}function respondWithResult(_0x76572a,_0x1a573e){_0x1a573e=_0x1a573e||0xc8;return function(_0x2c4908){if(_0x2c4908){return _0x76572a[_0xf612('0x1e')](_0x1a573e)[_0xf612('0x1f')](_0x2c4908);}};}function respondWithFilteredResult(_0x5b6702,_0x1687e0){return function(_0x16357b){if(_0x16357b){var _0x1724c5=typeof _0x1687e0[_0xf612('0x20')]===_0xf612('0x21')&&typeof _0x1687e0[_0xf612('0x22')]==='undefined';var _0x372e44=_0x16357b[_0xf612('0x23')];var _0x555ee8=_0x1724c5?0x0:_0x1687e0['offset'];var _0x818b74=_0x1724c5?_0x16357b[_0xf612('0x23')]:_0x1687e0[_0xf612('0x20')]+_0x1687e0[_0xf612('0x22')];var _0x41cc42;if(_0x818b74>=_0x372e44){_0x818b74=_0x372e44;_0x41cc42=0xc8;}else{_0x41cc42=0xce;}_0x5b6702[_0xf612('0x1e')](_0x41cc42);return _0x5b6702[_0xf612('0x24')](_0xf612('0x25'),_0x555ee8+'-'+_0x818b74+'/'+_0x372e44)[_0xf612('0x1f')](_0x16357b);}return null;};}function patchUpdates(_0x20a109){return function(_0x206208){try{jsonpatch[_0xf612('0x26')](_0x206208,_0x20a109,!![]);}catch(_0x353c17){return BPromise[_0xf612('0x27')](_0x353c17);}return _0x206208[_0xf612('0x28')]();};}function saveUpdates(_0x47e319,_0x1e308b){return function(_0x56a0d6){if(_0x56a0d6){return _0x56a0d6[_0xf612('0x29')](_0x47e319)[_0xf612('0x2a')](function(_0x102d1b){return _0x102d1b;});}return null;};}function removeEntity(_0x4863fe,_0x414ee7){return function(_0x2944dd){if(_0x2944dd){return _0x2944dd[_0xf612('0x2b')]()[_0xf612('0x2a')](function(){var _0x12dd1a=_0x2944dd['get']({'plain':!![]});var _0x7f9a80='Triggers';return db[_0xf612('0x2c')][_0xf612('0x2b')]({'where':{'type':_0x7f9a80,'resourceId':_0x12dd1a['id']}})[_0xf612('0x2a')](function(){return _0x2944dd;});})[_0xf612('0x2a')](function(){_0x4863fe[_0xf612('0x1e')](0xcc)[_0xf612('0x1d')]();});}};}function handleEntityNotFound(_0x164f2b,_0x1afb2b){return function(_0x59adea){if(!_0x59adea){_0x164f2b['sendStatus'](0x194);}return _0x59adea;};}function handleError(_0x4a1bb1,_0x3a2d1e){_0x3a2d1e=_0x3a2d1e||0x1f4;return function(_0x2e9b25){logger['error'](_0x2e9b25[_0xf612('0x2d')]);if(_0x2e9b25[_0xf612('0x2e')]){delete _0x2e9b25[_0xf612('0x2e')];}_0x4a1bb1[_0xf612('0x1e')](_0x3a2d1e)['send'](_0x2e9b25);};}exports['index']=function(_0x311cf5,_0x780dbf){var _0x161f37={},_0x3c0751={},_0x20da47={'count':0x0,'rows':[]};var _0x4812fe=_[_0xf612('0x2f')](db['Trigger']['rawAttributes'],function(_0x4d7b7d){return{'name':_0x4d7b7d['fieldName'],'type':_0x4d7b7d[_0xf612('0x30')]['key']};});_0x3c0751[_0xf612('0x31')]=_[_0xf612('0x2f')](_0x4812fe,_0xf612('0x2e'));_0x3c0751[_0xf612('0x32')]=_[_0xf612('0x33')](_0x311cf5[_0xf612('0x32')]);_0x3c0751[_0xf612('0x34')]=_[_0xf612('0x35')](_0x3c0751['model'],_0x3c0751['query']);_0x161f37['attributes']=_[_0xf612('0x35')](_0x3c0751[_0xf612('0x31')],qs['fields'](_0x311cf5[_0xf612('0x32')]['fields']));_0x161f37[_0xf612('0x36')]=_0x161f37[_0xf612('0x36')][_0xf612('0x37')]?_0x161f37[_0xf612('0x36')]:_0x3c0751['model'];if(!_0x311cf5[_0xf612('0x32')]['hasOwnProperty'](_0xf612('0x38'))){_0x161f37[_0xf612('0x22')]=qs['limit'](_0x311cf5[_0xf612('0x32')]['limit']);_0x161f37[_0xf612('0x20')]=qs[_0xf612('0x20')](_0x311cf5[_0xf612('0x32')][_0xf612('0x20')]);}_0x161f37[_0xf612('0x39')]=qs[_0xf612('0x3a')](_0x311cf5['query'][_0xf612('0x3a')]);_0x161f37[_0xf612('0x3b')]=qs[_0xf612('0x34')](_[_0xf612('0x3c')](_0x311cf5[_0xf612('0x32')],_0x3c0751[_0xf612('0x34')]),_0x4812fe);if(_0x311cf5[_0xf612('0x32')]['filter']){_0x161f37['where']=_[_0xf612('0x3d')](_0x161f37[_0xf612('0x3b')],{'$or':_['map'](_0x4812fe,function(_0x45cddd){if(_0x45cddd[_0xf612('0x30')]!==_0xf612('0x3e')){var _0x2abc56={};_0x2abc56[_0x45cddd[_0xf612('0x2e')]]={'$like':'%'+_0x311cf5[_0xf612('0x32')][_0xf612('0x3f')]+'%'};return _0x2abc56;}})});}_0x161f37=_[_0xf612('0x3d')]({},_0x161f37,_0x311cf5['options']);var _0x123943={'where':_0x161f37[_0xf612('0x3b')]};return db[_0xf612('0x40')][_0xf612('0x23')](_0x123943)[_0xf612('0x2a')](function(_0x5a3d01){_0x20da47[_0xf612('0x23')]=_0x5a3d01;if(_0x311cf5[_0xf612('0x32')][_0xf612('0x41')]){_0x161f37['include']=[{'all':!![]}];}return db[_0xf612('0x40')][_0xf612('0x42')](_0x161f37);})[_0xf612('0x2a')](function(_0x2ef20b){_0x20da47[_0xf612('0x43')]=_0x2ef20b;return _0x20da47;})[_0xf612('0x2a')](respondWithFilteredResult(_0x780dbf,_0x161f37))[_0xf612('0x44')](handleError(_0x780dbf,null));};exports[_0xf612('0x45')]=function(_0x13a0e8,_0x1c0cd9){var _0x3c56aa={'raw':![],'where':{'id':_0x13a0e8[_0xf612('0x46')]['id']}},_0x93dc2d={};_0x93dc2d[_0xf612('0x31')]=_[_0xf612('0x33')](db[_0xf612('0x40')][_0xf612('0x47')]);_0x93dc2d['query']=_[_0xf612('0x33')](_0x13a0e8['query']);_0x93dc2d[_0xf612('0x34')]=_[_0xf612('0x35')](_0x93dc2d['model'],_0x93dc2d[_0xf612('0x32')]);_0x3c56aa['attributes']=_[_0xf612('0x35')](_0x93dc2d[_0xf612('0x31')],qs[_0xf612('0x48')](_0x13a0e8[_0xf612('0x32')][_0xf612('0x48')]));_0x3c56aa[_0xf612('0x36')]=_0x3c56aa[_0xf612('0x36')]['length']?_0x3c56aa[_0xf612('0x36')]:_0x93dc2d[_0xf612('0x31')];if(_0x13a0e8[_0xf612('0x32')][_0xf612('0x41')]){_0x3c56aa[_0xf612('0x49')]=[{'all':!![]}];}_0x3c56aa=_[_0xf612('0x3d')]({},_0x3c56aa,_0x13a0e8[_0xf612('0x4a')]);return db[_0xf612('0x40')][_0xf612('0x4b')](_0x3c56aa)[_0xf612('0x2a')](handleEntityNotFound(_0x1c0cd9,null))[_0xf612('0x2a')](respondWithResult(_0x1c0cd9,null))[_0xf612('0x44')](handleError(_0x1c0cd9,null));};exports[_0xf612('0x4c')]=function(_0x1cffc1,_0x395a42){return db[_0xf612('0x40')][_0xf612('0x4c')](_0x1cffc1[_0xf612('0x4d')],{})[_0xf612('0x2a')](function(_0xb072eb){var _0x567687=_0x1cffc1['user']['get']({'plain':!![]});if(!_0x567687)throw new Error(_0xf612('0x4e'));if(_0x567687[_0xf612('0x4f')]==='user'){var _0xe5b8b6=_0xb072eb[_0xf612('0x50')]({'plain':!![]});var _0xa7bb0f=_0xf612('0x51');return db[_0xf612('0x52')][_0xf612('0x4b')]({'where':{'name':_0xa7bb0f,'userProfileId':_0x567687[_0xf612('0x53')]},'raw':!![]})['then'](function(_0x495f50){if(_0x495f50&&_0x495f50['autoAssociation']===0x0){return db[_0xf612('0x2c')][_0xf612('0x4c')]({'name':_0xe5b8b6[_0xf612('0x2e')],'resourceId':_0xe5b8b6['id'],'type':_0x495f50[_0xf612('0x2e')],'sectionId':_0x495f50['id']},{})[_0xf612('0x2a')](function(){return _0xb072eb;});}else{return _0xb072eb;}})[_0xf612('0x44')](function(_0x44c3ef){logger[_0xf612('0x54')](_0xf612('0x55'),_0x44c3ef);throw _0x44c3ef;});}return _0xb072eb;})[_0xf612('0x2a')](respondWithResult(_0x395a42,0xc9))[_0xf612('0x44')](handleError(_0x395a42,null));};exports[_0xf612('0x29')]=function(_0x47cf3,_0x2efc13){if(_0x47cf3[_0xf612('0x4d')]['id']){delete _0x47cf3[_0xf612('0x4d')]['id'];}return db[_0xf612('0x40')]['find']({'where':{'id':_0x47cf3[_0xf612('0x46')]['id']}})[_0xf612('0x2a')](handleEntityNotFound(_0x2efc13,null))[_0xf612('0x2a')](saveUpdates(_0x47cf3[_0xf612('0x4d')],null))[_0xf612('0x2a')](respondWithResult(_0x2efc13,null))[_0xf612('0x44')](handleError(_0x2efc13,null));};exports['destroy']=function(_0x546bfa,_0x3ff18c){return db[_0xf612('0x40')][_0xf612('0x4b')]({'where':{'id':_0x546bfa[_0xf612('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ff18c,null))[_0xf612('0x2a')](removeEntity(_0x3ff18c,null))[_0xf612('0x44')](handleError(_0x3ff18c,null));};exports[_0xf612('0x56')]=function(_0x17896c,_0x43143a,_0x24acbb){if(_0x17896c[_0xf612('0x4d')]['id']){delete _0x17896c['body']['id'];}return db[_0xf612('0x40')][_0xf612('0x4b')]({'where':{'id':_0x17896c[_0xf612('0x46')]['id']}})[_0xf612('0x2a')](handleEntityNotFound(_0x43143a,null))[_0xf612('0x2a')](function(_0x41c8cb){if(_0x41c8cb){_0x17896c['body'][_0xf612('0x57')]=_0x41c8cb['id'];return db['Condition'][_0xf612('0x4c')](_0x17896c['body']);}})[_0xf612('0x2a')](respondWithResult(_0x43143a,null))[_0xf612('0x44')](handleError(_0x43143a,null));};exports[_0xf612('0x58')]=function(_0x1bf701,_0x46ee77,_0x4dae56){if(_0x1bf701[_0xf612('0x4d')]['id']){delete _0x1bf701[_0xf612('0x4d')]['id'];}return db['Trigger'][_0xf612('0x4b')]({'where':{'id':_0x1bf701['params']['id']}})[_0xf612('0x2a')](handleEntityNotFound(_0x46ee77,null))[_0xf612('0x2a')](function(_0x30d2f4){if(_0x30d2f4){_0x1bf701[_0xf612('0x4d')][_0xf612('0x59')]=_0x30d2f4['id'];return db[_0xf612('0x5a')][_0xf612('0x4c')](_0x1bf701[_0xf612('0x4d')]);}})['then'](respondWithResult(_0x46ee77,null))['catch'](handleError(_0x46ee77,null));};exports['getAllConditions']=function(_0x73cfb0,_0x106561,_0x544cfc){var _0x554aeb={};var _0x161d15={};var _0x3c8120;var _0x233ad7;return db[_0xf612('0x40')][_0xf612('0x5b')]({'where':{'id':_0x73cfb0[_0xf612('0x46')]['id']}})[_0xf612('0x2a')](handleEntityNotFound(_0x106561,null))['then'](function(_0xbc9e6e){if(_0xbc9e6e){_0x3c8120=_0xbc9e6e;_0x161d15[_0xf612('0x31')]=_[_0xf612('0x33')](db[_0xf612('0x5a')][_0xf612('0x47')]);_0x161d15[_0xf612('0x32')]=_[_0xf612('0x33')](_0x73cfb0[_0xf612('0x32')]);_0x161d15[_0xf612('0x34')]=_['intersection'](_0x161d15[_0xf612('0x31')],_0x161d15['query']);_0x554aeb[_0xf612('0x36')]=_['intersection'](_0x161d15[_0xf612('0x31')],qs[_0xf612('0x48')](_0x73cfb0[_0xf612('0x32')][_0xf612('0x48')]));_0x554aeb['attributes']=_0x554aeb[_0xf612('0x36')]['length']?_0x554aeb[_0xf612('0x36')]:_0x161d15[_0xf612('0x31')];_0x554aeb[_0xf612('0x39')]=qs[_0xf612('0x3a')](_0x73cfb0['query'][_0xf612('0x3a')]);_0x554aeb[_0xf612('0x3b')]=qs['filters'](_[_0xf612('0x3c')](_0x73cfb0['query'],_0x161d15[_0xf612('0x34')]));if(_0x73cfb0[_0xf612('0x32')]['filter']){_0x554aeb[_0xf612('0x3b')]=_[_0xf612('0x3d')](_0x554aeb[_0xf612('0x3b')],{'$or':_['map'](_0x554aeb[_0xf612('0x36')],function(_0x2731ab){var _0x325484={};_0x325484[_0x2731ab]={'$like':'%'+_0x73cfb0[_0xf612('0x32')][_0xf612('0x3f')]+'%'};return _0x325484;})});}_0x554aeb=_[_0xf612('0x3d')]({},_0x554aeb,_0x73cfb0['options']);return _0x3c8120[_0xf612('0x5c')](_0x554aeb);}})['then'](function(_0x2301f0){if(_0x2301f0){_0x233ad7=_0x2301f0[_0xf612('0x37')];if(!_0x73cfb0[_0xf612('0x32')][_0xf612('0x5d')](_0xf612('0x38'))){_0x554aeb[_0xf612('0x22')]=qs[_0xf612('0x22')](_0x73cfb0[_0xf612('0x32')][_0xf612('0x22')]);_0x554aeb[_0xf612('0x20')]=qs[_0xf612('0x20')](_0x73cfb0[_0xf612('0x32')]['offset']);}return _0x3c8120['getAllConditions'](_0x554aeb);}})['then'](function(_0x29c2c7){if(_0x29c2c7){return _0x29c2c7?{'count':_0x233ad7,'rows':_0x29c2c7}:null;}})[_0xf612('0x2a')](respondWithResult(_0x106561,null))['catch'](handleError(_0x106561,null));};exports[_0xf612('0x5e')]=function(_0x19d627,_0x56fc5a,_0x2ef348){var _0x305284={};var _0x516187={};var _0x5b6052;var _0x189849;return db[_0xf612('0x40')][_0xf612('0x5b')]({'where':{'id':_0x19d627[_0xf612('0x46')]['id']}})[_0xf612('0x2a')](handleEntityNotFound(_0x56fc5a,null))[_0xf612('0x2a')](function(_0x136539){if(_0x136539){_0x5b6052=_0x136539;_0x516187[_0xf612('0x31')]=_[_0xf612('0x33')](db[_0xf612('0x5a')]['rawAttributes']);_0x516187[_0xf612('0x32')]=_['keys'](_0x19d627[_0xf612('0x32')]);_0x516187['filters']=_[_0xf612('0x35')](_0x516187[_0xf612('0x31')],_0x516187[_0xf612('0x32')]);_0x305284[_0xf612('0x36')]=_[_0xf612('0x35')](_0x516187['model'],qs[_0xf612('0x48')](_0x19d627[_0xf612('0x32')][_0xf612('0x48')]));_0x305284['attributes']=_0x305284[_0xf612('0x36')][_0xf612('0x37')]?_0x305284[_0xf612('0x36')]:_0x516187[_0xf612('0x31')];_0x305284[_0xf612('0x39')]=qs[_0xf612('0x3a')](_0x19d627[_0xf612('0x32')][_0xf612('0x3a')]);_0x305284[_0xf612('0x3b')]=qs[_0xf612('0x34')](_[_0xf612('0x3c')](_0x19d627['query'],_0x516187[_0xf612('0x34')]));if(_0x19d627[_0xf612('0x32')][_0xf612('0x3f')]){_0x305284[_0xf612('0x3b')]=_[_0xf612('0x3d')](_0x305284[_0xf612('0x3b')],{'$or':_[_0xf612('0x2f')](_0x305284[_0xf612('0x36')],function(_0x2481ac){var _0x2128ed={};_0x2128ed[_0x2481ac]={'$like':'%'+_0x19d627[_0xf612('0x32')][_0xf612('0x3f')]+'%'};return _0x2128ed;})});}_0x305284=_[_0xf612('0x3d')]({},_0x305284,_0x19d627[_0xf612('0x4a')]);return _0x5b6052[_0xf612('0x5e')](_0x305284);}})[_0xf612('0x2a')](function(_0x42ee75){if(_0x42ee75){_0x189849=_0x42ee75[_0xf612('0x37')];if(!_0x19d627[_0xf612('0x32')]['hasOwnProperty'](_0xf612('0x38'))){_0x305284[_0xf612('0x22')]=qs['limit'](_0x19d627[_0xf612('0x32')]['limit']);_0x305284[_0xf612('0x20')]=qs[_0xf612('0x20')](_0x19d627[_0xf612('0x32')][_0xf612('0x20')]);}return _0x5b6052[_0xf612('0x5e')](_0x305284);}})[_0xf612('0x2a')](function(_0x527374){if(_0x527374){return _0x527374?{'count':_0x189849,'rows':_0x527374}:null;}})[_0xf612('0x2a')](respondWithResult(_0x56fc5a,null))[_0xf612('0x44')](handleError(_0x56fc5a,null));};exports[_0xf612('0x5f')]=function(_0xd5e14e,_0x145a8d,_0x33322a){if(_0xd5e14e[_0xf612('0x4d')]['id']){delete _0xd5e14e[_0xf612('0x4d')]['id'];}return db[_0xf612('0x40')]['find']({'where':{'id':_0xd5e14e[_0xf612('0x46')]['id']}})['then'](handleEntityNotFound(_0x145a8d,null))[_0xf612('0x2a')](function(_0x5db4a1){if(_0x5db4a1){_0xd5e14e[_0xf612('0x4d')][_0xf612('0x60')]=_0x5db4a1['id'];return db[_0xf612('0x61')][_0xf612('0x4c')](_0xd5e14e[_0xf612('0x4d')]);}})[_0xf612('0x2a')](respondWithResult(_0x145a8d,null))[_0xf612('0x44')](handleError(_0x145a8d,null));};exports['getActions']=function(_0x3bd770,_0x45c210,_0x253493){var _0x55afe1={};var _0x3ae79d={};var _0x172b01;var _0x3d8256;return db[_0xf612('0x40')][_0xf612('0x5b')]({'where':{'id':_0x3bd770[_0xf612('0x46')]['id']}})[_0xf612('0x2a')](handleEntityNotFound(_0x45c210,null))[_0xf612('0x2a')](function(_0x35a87f){if(_0x35a87f){_0x172b01=_0x35a87f;_0x3ae79d[_0xf612('0x31')]=_['keys'](db[_0xf612('0x61')][_0xf612('0x47')]);_0x3ae79d[_0xf612('0x32')]=_['keys'](_0x3bd770['query']);_0x3ae79d[_0xf612('0x34')]=_[_0xf612('0x35')](_0x3ae79d[_0xf612('0x31')],_0x3ae79d[_0xf612('0x32')]);_0x55afe1[_0xf612('0x36')]=_['intersection'](_0x3ae79d[_0xf612('0x31')],qs[_0xf612('0x48')](_0x3bd770[_0xf612('0x32')]['fields']));_0x55afe1[_0xf612('0x36')]=_0x55afe1[_0xf612('0x36')]['length']?_0x55afe1[_0xf612('0x36')]:_0x3ae79d[_0xf612('0x31')];_0x55afe1[_0xf612('0x39')]=qs[_0xf612('0x3a')](_0x3bd770[_0xf612('0x32')][_0xf612('0x3a')]);_0x55afe1[_0xf612('0x3b')]=qs[_0xf612('0x34')](_[_0xf612('0x3c')](_0x3bd770['query'],_0x3ae79d[_0xf612('0x34')]));if(_0x3bd770[_0xf612('0x32')][_0xf612('0x3f')]){_0x55afe1[_0xf612('0x3b')]=_[_0xf612('0x3d')](_0x55afe1[_0xf612('0x3b')],{'$or':_['map'](_0x55afe1[_0xf612('0x36')],function(_0x8a2f1e){var _0x1285b1={};_0x1285b1[_0x8a2f1e]={'$like':'%'+_0x3bd770[_0xf612('0x32')]['filter']+'%'};return _0x1285b1;})});}_0x55afe1=_[_0xf612('0x3d')]({},_0x55afe1,_0x3bd770[_0xf612('0x4a')]);return _0x172b01[_0xf612('0x62')](_0x55afe1);}})[_0xf612('0x2a')](function(_0x5a53a5){if(_0x5a53a5){_0x3d8256=_0x5a53a5[_0xf612('0x37')];if(!_0x3bd770[_0xf612('0x32')]['hasOwnProperty']('nolimit')){_0x55afe1[_0xf612('0x22')]=qs[_0xf612('0x22')](_0x3bd770[_0xf612('0x32')][_0xf612('0x22')]);_0x55afe1[_0xf612('0x20')]=qs['offset'](_0x3bd770['query'][_0xf612('0x20')]);}return _0x172b01['getActions'](_0x55afe1);}})[_0xf612('0x2a')](function(_0x5158c5){if(_0x5158c5){return _0x5158c5?{'count':_0x3d8256,'rows':_0x5158c5}:null;}})[_0xf612('0x2a')](respondWithResult(_0x45c210,null))[_0xf612('0x44')](handleError(_0x45c210,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 5612106..0bdb845 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 _0xb715=['tools_triggers','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x246e50,_0x33c7c4){var _0x915b44=function(_0x302af3){while(--_0x302af3){_0x246e50['push'](_0x246e50['shift']());}};_0x915b44(++_0x33c7c4);}(_0xb715,0x16d));var _0x5b71=function(_0x4ec15c,_0x23e072){_0x4ec15c=_0x4ec15c-0x0;var _0xa9f28f=_0xb715[_0x4ec15c];return _0xa9f28f;};'use strict';var _=require('lodash');var util=require(_0x5b71('0x0'));var logger=require('../../config/logger')(_0x5b71('0x1'));var moment=require(_0x5b71('0x2'));var BPromise=require('bluebird');var rp=require(_0x5b71('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b71('0x4'));var config=require(_0x5b71('0x5'));var attributes=require('./trigger.attributes');module['exports']=function(_0x887674,_0x2a2950){return _0x887674['define']('Trigger',attributes,{'tableName':_0x5b71('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c29=['define','Trigger','tools_triggers','../../config/logger','moment','bluebird','request-promise','../../config/environment','./trigger.attributes','exports'];(function(_0x57326a,_0x4682f5){var _0x24b1e7=function(_0x465727){while(--_0x465727){_0x57326a['push'](_0x57326a['shift']());}};_0x24b1e7(++_0x4682f5);}(_0x0c29,0xb7));var _0x90c2=function(_0x52a857,_0xc99fa1){_0x52a857=_0x52a857-0x0;var _0x4e2aae=_0x0c29[_0x52a857];return _0x4e2aae;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x90c2('0x0'))('api');var moment=require(_0x90c2('0x1'));var BPromise=require(_0x90c2('0x2'));var rp=require(_0x90c2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x90c2('0x4'));var attributes=require(_0x90c2('0x5'));module[_0x90c2('0x6')]=function(_0x1aa5a4,_0xfbe17b){return _0x1aa5a4[_0x90c2('0x7')](_0x90c2('0x8'),attributes,{'tableName':_0x90c2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index f693a66..d52b160 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 _0x42be=['catch','ShowTrigger','find','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','Trigger,\x20%s,\x20%s','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include','model','map','debug'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x42be,0x88));var _0xe42b=function(_0x31e2c0,_0x599191){_0x31e2c0=_0x31e2c0-0x0;var _0x5cecb6=_0x42be[_0x31e2c0];return _0x5cecb6;};'use strict';var _=require(_0xe42b('0x0'));var util=require(_0xe42b('0x1'));var moment=require(_0xe42b('0x2'));var BPromise=require('bluebird');var rs=require(_0xe42b('0x3'));var fs=require('fs');var Redis=require(_0xe42b('0x4'));var db=require(_0xe42b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe42b('0x6'))(_0xe42b('0x7'));var config=require(_0xe42b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe42b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x397c61,_0x39c43b,_0x36db5a){return new BPromise(function(_0x4eb880,_0x69ac3d){return client[_0xe42b('0xa')](_0x397c61,_0x36db5a)['then'](function(_0x3e7084){logger[_0xe42b('0xb')](_0xe42b('0xc'),_0x39c43b,'request\x20sent');logger['debug'](_0xe42b('0xd'),_0x39c43b,_0xe42b('0xe'),JSON['stringify'](_0x3e7084));if(_0x3e7084[_0xe42b('0xf')]){if(_0x3e7084[_0xe42b('0xf')][_0xe42b('0x10')]===0x1f4){logger[_0xe42b('0xf')](_0xe42b('0xc'),_0x39c43b,_0x3e7084[_0xe42b('0xf')][_0xe42b('0x11')]);return _0x69ac3d(_0x3e7084[_0xe42b('0xf')][_0xe42b('0x11')]);}logger[_0xe42b('0xf')]('Trigger,\x20%s,\x20%s',_0x39c43b,_0x3e7084[_0xe42b('0xf')][_0xe42b('0x11')]);return _0x4eb880(_0x3e7084[_0xe42b('0xf')][_0xe42b('0x11')]);}else{logger[_0xe42b('0xb')](_0xe42b('0xc'),_0x39c43b,'request\x20sent');_0x4eb880(_0x3e7084['result'][_0xe42b('0x11')]);}})['catch'](function(_0x209c83){logger[_0xe42b('0xf')](_0xe42b('0xc'),_0x39c43b,_0x209c83);_0x69ac3d(_0x209c83);});});}exports[_0xe42b('0x12')]=function(_0x15ddbc){var _0x28cbf7=this;return new Promise(function(_0x5397db,_0x59ab08){return db[_0xe42b('0x13')][_0xe42b('0x14')]({'raw':_0x15ddbc['options']?_0x15ddbc[_0xe42b('0x15')][_0xe42b('0x16')]===undefined?!![]:![]:!![],'where':_0x15ddbc[_0xe42b('0x15')]?_0x15ddbc[_0xe42b('0x15')]['where']||null:null,'attributes':_0x15ddbc[_0xe42b('0x15')]?_0x15ddbc['options'][_0xe42b('0x17')]||null:null,'limit':_0x15ddbc[_0xe42b('0x15')]?_0x15ddbc[_0xe42b('0x15')][_0xe42b('0x18')]||null:null,'include':_0x15ddbc[_0xe42b('0x15')]?_0x15ddbc[_0xe42b('0x15')]['include']?_['map'](_0x15ddbc['options'][_0xe42b('0x19')],function(_0x32b956){return{'model':db[_0x32b956[_0xe42b('0x1a')]],'as':_0x32b956['as'],'attributes':_0x32b956['attributes'],'include':_0x32b956[_0xe42b('0x19')]?_[_0xe42b('0x1b')](_0x32b956[_0xe42b('0x19')],function(_0x20a2af){return{'model':db[_0x20a2af[_0xe42b('0x1a')]],'as':_0x20a2af['as'],'attributes':_0x20a2af[_0xe42b('0x17')],'include':_0x20a2af[_0xe42b('0x19')]?_[_0xe42b('0x1b')](_0x20a2af[_0xe42b('0x19')],function(_0x277f95){return{'model':db[_0x277f95['model']],'as':_0x277f95['as'],'attributes':_0x277f95[_0xe42b('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26c045){logger[_0xe42b('0xb')](_0xe42b('0x12'),_0x15ddbc);logger[_0xe42b('0x1c')](_0xe42b('0x12'),_0x15ddbc,JSON['stringify'](_0x26c045));_0x5397db(_0x26c045);})[_0xe42b('0x1d')](function(_0x2f6d86){logger['error'](_0xe42b('0x12'),_0x2f6d86[_0xe42b('0x11')],_0x15ddbc);_0x59ab08(_0x28cbf7[_0xe42b('0xf')](0x1f4,_0x2f6d86[_0xe42b('0x11')]));});});};exports[_0xe42b('0x1e')]=function(_0x7589c6){var _0x5dcff9=this;return new Promise(function(_0x423cd9,_0xba5fdc){return db[_0xe42b('0x13')][_0xe42b('0x1f')]({'raw':_0x7589c6[_0xe42b('0x15')]?_0x7589c6[_0xe42b('0x15')][_0xe42b('0x16')]===undefined?!![]:![]:!![],'where':_0x7589c6[_0xe42b('0x15')]?_0x7589c6[_0xe42b('0x15')]['where']||null:null,'attributes':_0x7589c6[_0xe42b('0x15')]?_0x7589c6[_0xe42b('0x15')][_0xe42b('0x17')]||null:null,'include':_0x7589c6[_0xe42b('0x15')]?_0x7589c6['options'][_0xe42b('0x19')]?_[_0xe42b('0x1b')](_0x7589c6[_0xe42b('0x15')][_0xe42b('0x19')],function(_0x5799d3){return{'model':db[_0x5799d3['model']],'as':_0x5799d3['as'],'attributes':_0x5799d3[_0xe42b('0x17')],'include':_0x5799d3[_0xe42b('0x19')]?_[_0xe42b('0x1b')](_0x5799d3[_0xe42b('0x19')],function(_0x206ca4){return{'model':db[_0x206ca4[_0xe42b('0x1a')]],'as':_0x206ca4['as'],'attributes':_0x206ca4[_0xe42b('0x17')],'include':_0x206ca4[_0xe42b('0x19')]?_['map'](_0x206ca4['include'],function(_0x3174d7){return{'model':db[_0x3174d7['model']],'as':_0x3174d7['as'],'attributes':_0x3174d7[_0xe42b('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe42b('0x20')](function(_0x24f526){logger[_0xe42b('0xb')](_0xe42b('0x1e'),_0x7589c6);logger[_0xe42b('0x1c')](_0xe42b('0x1e'),_0x7589c6,JSON['stringify'](_0x24f526));_0x423cd9(_0x24f526);})['catch'](function(_0x577f6d){logger[_0xe42b('0xf')](_0xe42b('0x1e'),_0x577f6d[_0xe42b('0x11')],_0x7589c6);_0xba5fdc(_0x5dcff9['error'](0x1f4,_0x577f6d['message']));});});}; \ No newline at end of file +var _0x92b6=['include','model','then','ShowTrigger','Trigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','findAll','options','raw','where','attributes','map'];(function(_0x2f2360,_0x151089){var _0x1cc8d3=function(_0x5e356f){while(--_0x5e356f){_0x2f2360['push'](_0x2f2360['shift']());}};_0x1cc8d3(++_0x151089);}(_0x92b6,0x1da));var _0x692b=function(_0x1f6004,_0x5ea295){_0x1f6004=_0x1f6004-0x0;var _0x192f8c=_0x92b6[_0x1f6004];return _0x192f8c;};'use strict';var _=require(_0x692b('0x0'));var util=require(_0x692b('0x1'));var moment=require(_0x692b('0x2'));var BPromise=require(_0x692b('0x3'));var rs=require(_0x692b('0x4'));var fs=require('fs');var Redis=require(_0x692b('0x5'));var db=require(_0x692b('0x6'))['db'];var utils=require(_0x692b('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x692b('0x8'));var client=jayson[_0x692b('0x9')][_0x692b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3079e4,_0x587e3b,_0x50432f){return new BPromise(function(_0x5f20af,_0x5b87c7){return client[_0x692b('0xb')](_0x3079e4,_0x50432f)['then'](function(_0x537e4a){logger[_0x692b('0xc')]('Trigger,\x20%s,\x20%s',_0x587e3b,'request\x20sent');logger[_0x692b('0xd')](_0x692b('0xe'),_0x587e3b,_0x692b('0xf'),JSON[_0x692b('0x10')](_0x537e4a));if(_0x537e4a[_0x692b('0x11')]){if(_0x537e4a['error'][_0x692b('0x12')]===0x1f4){logger[_0x692b('0x11')](_0x692b('0x13'),_0x587e3b,_0x537e4a['error']['message']);return _0x5b87c7(_0x537e4a[_0x692b('0x11')][_0x692b('0x14')]);}logger['error'](_0x692b('0x13'),_0x587e3b,_0x537e4a[_0x692b('0x11')][_0x692b('0x14')]);return _0x5f20af(_0x537e4a['error'][_0x692b('0x14')]);}else{logger[_0x692b('0xc')]('Trigger,\x20%s,\x20%s',_0x587e3b,'request\x20sent');_0x5f20af(_0x537e4a[_0x692b('0x15')][_0x692b('0x14')]);}})[_0x692b('0x16')](function(_0x386397){logger['error'](_0x692b('0x13'),_0x587e3b,_0x386397);_0x5b87c7(_0x386397);});});}exports[_0x692b('0x17')]=function(_0x1d9736){var _0x370866=this;return new Promise(function(_0x2931f4,_0x26f384){return db['Trigger'][_0x692b('0x18')]({'raw':_0x1d9736['options']?_0x1d9736[_0x692b('0x19')][_0x692b('0x1a')]===undefined?!![]:![]:!![],'where':_0x1d9736[_0x692b('0x19')]?_0x1d9736[_0x692b('0x19')][_0x692b('0x1b')]||null:null,'attributes':_0x1d9736['options']?_0x1d9736['options'][_0x692b('0x1c')]||null:null,'limit':_0x1d9736[_0x692b('0x19')]?_0x1d9736[_0x692b('0x19')]['limit']||null:null,'include':_0x1d9736[_0x692b('0x19')]?_0x1d9736[_0x692b('0x19')]['include']?_[_0x692b('0x1d')](_0x1d9736[_0x692b('0x19')][_0x692b('0x1e')],function(_0x2864c6){return{'model':db[_0x2864c6[_0x692b('0x1f')]],'as':_0x2864c6['as'],'attributes':_0x2864c6[_0x692b('0x1c')],'include':_0x2864c6['include']?_[_0x692b('0x1d')](_0x2864c6[_0x692b('0x1e')],function(_0x44a751){return{'model':db[_0x44a751[_0x692b('0x1f')]],'as':_0x44a751['as'],'attributes':_0x44a751[_0x692b('0x1c')],'include':_0x44a751[_0x692b('0x1e')]?_['map'](_0x44a751[_0x692b('0x1e')],function(_0x3f453a){return{'model':db[_0x3f453a[_0x692b('0x1f')]],'as':_0x3f453a['as'],'attributes':_0x3f453a['attributes']};}):[]};}):[]};}):[]:[]})[_0x692b('0x20')](function(_0x241319){logger[_0x692b('0xc')](_0x692b('0x17'),_0x1d9736);logger[_0x692b('0xd')](_0x692b('0x17'),_0x1d9736,JSON[_0x692b('0x10')](_0x241319));_0x2931f4(_0x241319);})[_0x692b('0x16')](function(_0x469533){logger[_0x692b('0x11')]('GetTrigger',_0x469533[_0x692b('0x14')],_0x1d9736);_0x26f384(_0x370866[_0x692b('0x11')](0x1f4,_0x469533['message']));});});};exports[_0x692b('0x21')]=function(_0x483e18){var _0x2079d2=this;return new Promise(function(_0x403e54,_0x3e63c5){return db[_0x692b('0x22')][_0x692b('0x23')]({'raw':_0x483e18[_0x692b('0x19')]?_0x483e18[_0x692b('0x19')][_0x692b('0x1a')]===undefined?!![]:![]:!![],'where':_0x483e18['options']?_0x483e18[_0x692b('0x19')][_0x692b('0x1b')]||null:null,'attributes':_0x483e18['options']?_0x483e18[_0x692b('0x19')][_0x692b('0x1c')]||null:null,'include':_0x483e18[_0x692b('0x19')]?_0x483e18['options'][_0x692b('0x1e')]?_[_0x692b('0x1d')](_0x483e18['options']['include'],function(_0x2e7048){return{'model':db[_0x2e7048['model']],'as':_0x2e7048['as'],'attributes':_0x2e7048['attributes'],'include':_0x2e7048['include']?_[_0x692b('0x1d')](_0x2e7048['include'],function(_0x22045f){return{'model':db[_0x22045f[_0x692b('0x1f')]],'as':_0x22045f['as'],'attributes':_0x22045f[_0x692b('0x1c')],'include':_0x22045f[_0x692b('0x1e')]?_['map'](_0x22045f[_0x692b('0x1e')],function(_0x216eb6){return{'model':db[_0x216eb6['model']],'as':_0x216eb6['as'],'attributes':_0x216eb6[_0x692b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x692b('0x20')](function(_0x8e05dd){logger['info'](_0x692b('0x21'),_0x483e18);logger[_0x692b('0xd')](_0x692b('0x21'),_0x483e18,JSON[_0x692b('0x10')](_0x8e05dd));_0x403e54(_0x8e05dd);})[_0x692b('0x16')](function(_0x29403c){logger[_0x692b('0x11')](_0x692b('0x21'),_0x29403c[_0x692b('0x14')],_0x483e18);_0x3e63c5(_0x2079d2[_0x692b('0x11')](0x1f4,_0x29403c[_0x692b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 741f4f4..1eda211 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 _0xa25c=['/:id','show','post','/:id/clone','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x5808f5,_0x17154){var _0x51c16d=function(_0x521c58){while(--_0x521c58){_0x5808f5['push'](_0x5808f5['shift']());}};_0x51c16d(++_0x17154);}(_0xa25c,0xda));var _0xca25=function(_0x22f67c,_0x4e8f91){_0x22f67c=_0x22f67c-0x0;var _0x270d5a=_0xa25c[_0x22f67c];return _0x270d5a;};'use strict';var multer=require(_0xca25('0x0'));var util=require('util');var path=require(_0xca25('0x1'));var timeout=require(_0xca25('0x2'));var express=require(_0xca25('0x3'));var router=express[_0xca25('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xca25('0x5'));var interaction=require(_0xca25('0x6'));var config=require(_0xca25('0x7'));var controller=require('./trunk.controller');router['get']('/',auth[_0xca25('0x8')](),controller[_0xca25('0x9')]);router['get'](_0xca25('0xa'),auth[_0xca25('0x8')](),controller[_0xca25('0xb')]);router[_0xca25('0xc')](_0xca25('0xd'),auth[_0xca25('0x8')](),controller['clone']);router[_0xca25('0xc')]('/',auth[_0xca25('0x8')](),controller[_0xca25('0xe')]);router[_0xca25('0xf')](_0xca25('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xca25('0x10')]('/:id',auth[_0xca25('0x8')](),controller[_0xca25('0x11')]);module[_0xca25('0x12')]=router; \ No newline at end of file +var _0xd944=['index','/:id','isAuthenticated','/:id/clone','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0xd944,0x1c3));var _0x4d94=function(_0x296453,_0x219c2a){_0x296453=_0x296453-0x0;var _0x37b596=_0xd944[_0x296453];return _0x37b596;};'use strict';var multer=require(_0x4d94('0x0'));var util=require(_0x4d94('0x1'));var path=require('path');var timeout=require(_0x4d94('0x2'));var express=require(_0x4d94('0x3'));var router=express[_0x4d94('0x4')]();var fs_extra=require(_0x4d94('0x5'));var auth=require(_0x4d94('0x6'));var interaction=require(_0x4d94('0x7'));var config=require('../../config/environment');var controller=require('./trunk.controller');router[_0x4d94('0x8')]('/',auth['isAuthenticated'](),controller[_0x4d94('0x9')]);router['get'](_0x4d94('0xa'),auth[_0x4d94('0xb')](),controller['show']);router['post'](_0x4d94('0xc'),auth[_0x4d94('0xb')](),controller['clone']);router[_0x4d94('0xd')]('/',auth[_0x4d94('0xb')](),controller[_0x4d94('0xe')]);router[_0x4d94('0xf')](_0x4d94('0xa'),auth[_0x4d94('0xb')](),controller[_0x4d94('0x10')]);router[_0x4d94('0x11')](_0x4d94('0xa'),auth['isAuthenticated'](),controller[_0x4d94('0x12')]);module[_0x4d94('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 94bc1e4..c61cf34 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 _0x74b7=['originate','uac','uas','pai','certificate','active','passive','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','peer','friend','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','ENUM','info','yes','nonat','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','INTEGER','always','accept','refuse'];(function(_0x273386,_0x9a245b){var _0x32764e=function(_0x4d310e){while(--_0x4d310e){_0x273386['push'](_0x273386['shift']());}};_0x32764e(++_0x9a245b);}(_0x74b7,0x1b3));var _0x774b=function(_0x26b2b3,_0x2c4892){_0x26b2b3=_0x26b2b3-0x0;var _0x28486f=_0x74b7[_0x26b2b3];return _0x28486f;};'use strict';var Sequelize=require(_0x774b('0x0'));module[_0x774b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend','user',_0x774b('0x2')),'allowNull':![],'defaultValue':_0x774b('0x3')},'context':{'type':Sequelize[_0x774b('0x4')],'allowNull':![],'defaultValue':_0x774b('0x5')},'callingpres':{'type':Sequelize['ENUM'](_0x774b('0x6'),_0x774b('0x7'),'ALLOWED_FAILED_SCREEN',_0x774b('0x8'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x774b('0x9'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x774b('0x4')]},'secret':{'type':Sequelize[_0x774b('0x4')]},'md5secret':{'type':Sequelize[_0x774b('0x4')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x774b('0x4')],'defaultValue':_0x774b('0xa'),'set':function(_0x3fc536){this[_0x774b('0xb')]('transport',_0x3fc536?_0x3fc536['join'](','):null);},'get':function(){return this['getDataValue'](_0x774b('0xc'))?this[_0x774b('0xd')](_0x774b('0xc'))[_0x774b('0xe')](','):null;},'comment':_0x774b('0xf')},'dtmfmode':{'type':Sequelize[_0x774b('0x10')]('rfc2833',_0x774b('0x11'),'shortinfo','inband','auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x774b('0x10')](_0x774b('0x12'),'no',_0x774b('0x13'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x774b('0x10')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x774b('0x4')]},'directmediadeny':{'type':Sequelize[_0x774b('0x4')]},'nat':{'type':Sequelize[_0x774b('0x4')],'defaultValue':_0x774b('0x14'),'set':function(_0x585de0){this[_0x774b('0xb')](_0x774b('0x15'),_0x585de0?_0x585de0[_0x774b('0x16')](','):null);},'get':function(){return this[_0x774b('0xd')]('nat')?this[_0x774b('0xd')](_0x774b('0x15'))[_0x774b('0xe')](','):null;},'comment':_0x774b('0x17')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x774b('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x774b('0x4')]},'language':{'type':Sequelize[_0x774b('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x774b('0x4')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x774b('0x4')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x774b('0x4')],'allowNull':![],'defaultValue':_0x774b('0x18'),'set':function(_0x145df8){this[_0x774b('0xb')](_0x774b('0x19'),_0x145df8?_0x145df8[_0x774b('0x16')](';'):_0x774b('0x18'));},'get':function(){return this[_0x774b('0xd')](_0x774b('0x19'))?this[_0x774b('0xd')](_0x774b('0x19'))[_0x774b('0xe')](';'):null;},'comment':_0x774b('0x1a')},'autoframing':{'type':Sequelize['ENUM'](_0x774b('0x12'),'no')},'insecure':{'type':Sequelize[_0x774b('0x4')],'defaultValue':_0x774b('0x1b'),'set':function(_0x4e2ae6){this[_0x774b('0xb')](_0x774b('0x1c'),_0x4e2ae6?_0x4e2ae6['join'](','):null);},'get':function(){return this[_0x774b('0xd')](_0x774b('0x1c'))?this[_0x774b('0xd')](_0x774b('0x1c'))[_0x774b('0xe')](','):null;},'comment':_0x774b('0x1d')},'trustrpid':{'type':Sequelize[_0x774b('0x10')](_0x774b('0x12'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x774b('0x10')](_0x774b('0x12'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x774b('0x10')](_0x774b('0x12'),'no','never')},'promiscredir':{'type':Sequelize[_0x774b('0x10')](_0x774b('0x12'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x774b('0x12'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x774b('0x4')],'defaultValue':_0x774b('0x1e')},'amaflags':{'type':Sequelize[_0x774b('0x4')]},'callcounter':{'type':Sequelize[_0x774b('0x10')](_0x774b('0x12'),'no'),'defaultValue':_0x774b('0x12')},'busylevel':{'type':Sequelize[_0x774b('0x1f')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x774b('0x12'),'no')},'allowsubscribe':{'type':Sequelize[_0x774b('0x10')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x774b('0x10')](_0x774b('0x12'),'no')},'ignoresdpversion':{'type':Sequelize[_0x774b('0x10')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x774b('0x4')]},'template':{'type':Sequelize[_0x774b('0x4')]},'videosupport':{'type':Sequelize[_0x774b('0x10')](_0x774b('0x12'),'no',_0x774b('0x20')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x774b('0x1f')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x774b('0x10')](_0x774b('0x12'),'no')},'mailbox':{'type':Sequelize[_0x774b('0x4')]},'session_timers':{'type':Sequelize[_0x774b('0x10')](_0x774b('0x21'),_0x774b('0x22'),_0x774b('0x23'))},'session_expires':{'type':Sequelize[_0x774b('0x1f')](0xb)},'session_minse':{'type':Sequelize[_0x774b('0x1f')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x774b('0x24'),'uas'),'defaultValue':_0x774b('0x25')},'t38pt_usertpsource':{'type':Sequelize[_0x774b('0x4')]},'regexten':{'type':Sequelize[_0x774b('0x4')]},'fromdomain':{'type':Sequelize[_0x774b('0x4')]},'fromuser':{'type':Sequelize[_0x774b('0x4')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x774b('0x12'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x774b('0x1f')](0xb)},'defaultip':{'type':Sequelize[_0x774b('0x4')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x774b('0x1f')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x774b('0x1f')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x774b('0x1f')](0xb)},'sendrpid':{'type':Sequelize[_0x774b('0x10')](_0x774b('0x12'),'no',_0x774b('0x26')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x774b('0x4')]},'timert1':{'type':Sequelize[_0x774b('0x1f')](0xb)},'timerb':{'type':Sequelize[_0x774b('0x1f')](0xb)},'qualifyfreq':{'type':Sequelize[_0x774b('0x1f')](0xb)},'contactpermit':{'type':Sequelize[_0x774b('0x4')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x774b('0x4')]},'unsolicited_mailbox':{'type':Sequelize[_0x774b('0x4')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x774b('0x1f')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x774b('0x12'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x774b('0x10')](_0x774b('0x12'),'no')},'force_avp':{'type':Sequelize[_0x774b('0x10')](_0x774b('0x12'),'no')},'icesupport':{'type':Sequelize[_0x774b('0x10')](_0x774b('0x12'),'no')},'dtlsenable':{'type':Sequelize[_0x774b('0x10')](_0x774b('0x12'),'no')},'dtlsverify':{'type':Sequelize[_0x774b('0x10')]('yes','no','fingerprint',_0x774b('0x27'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x774b('0x4')]},'dtlsprivatekey':{'type':Sequelize[_0x774b('0x4')]},'dtlscipher':{'type':Sequelize[_0x774b('0x4')]},'dtlscafile':{'type':Sequelize[_0x774b('0x4')]},'dtlscapath':{'type':Sequelize[_0x774b('0x4')]},'dtlssetup':{'type':Sequelize[_0x774b('0x10')](_0x774b('0x28'),_0x774b('0x29'),_0x774b('0x2a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x774b('0x4')]},'usereqphone':{'type':Sequelize[_0x774b('0x10')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x774b('0x4')]},'recordofffeature':{'type':Sequelize[_0x774b('0x4')]},'call_limit':{'type':Sequelize[_0x774b('0x1f')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x774b('0x10')](_0x774b('0x12'),'no')},'subscribemwi':{'type':Sequelize[_0x774b('0x10')]('yes','no')},'vmexten':{'type':Sequelize[_0x774b('0x4')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x774b('0x4')]},'parkinglot':{'type':Sequelize[_0x774b('0x4')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x774b('0x4')],'defaultValue':_0x774b('0x2b')},'canreinvite':{'type':Sequelize[_0x774b('0x10')]('yes','no','nonat',_0x774b('0x2c'),_0x774b('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x774b('0x4')]},'otherFields':{'type':Sequelize[_0x774b('0x4')]},'active':{'type':Sequelize[_0x774b('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x774b('0x4')],'defaultValue':'no'}}; \ No newline at end of file +var _0x5ba8=['always','accept','originate','uac','uas','pai','fingerprint','certificate','active','passive','dynamic','update,nonat','exports','STRING','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','inband','auto','rfc2833','yes','nonat','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','\x22\x22\x20<>'];(function(_0x44218c,_0x49d97a){var _0x47bddb=function(_0x4c65da){while(--_0x4c65da){_0x44218c['push'](_0x44218c['shift']());}};_0x47bddb(++_0x49d97a);}(_0x5ba8,0xf7));var _0x85ba=function(_0x56a0a5,_0x4cb7a7){_0x56a0a5=_0x56a0a5-0x0;var _0x5961b2=_0x5ba8[_0x56a0a5];return _0x5961b2;};'use strict';var Sequelize=require('sequelize');module[_0x85ba('0x0')]={'name':{'type':Sequelize[_0x85ba('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x3'),_0x85ba('0x4'),'peer'),'allowNull':![],'defaultValue':_0x85ba('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x85ba('0x5')},'callingpres':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x6'),_0x85ba('0x7'),_0x85ba('0x8'),_0x85ba('0x9'),'PROHIB_NOT_SCREENED',_0x85ba('0xa'),_0x85ba('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0x85ba('0x1')]},'permit':{'type':Sequelize[_0x85ba('0x1')]},'secret':{'type':Sequelize[_0x85ba('0x1')]},'md5secret':{'type':Sequelize[_0x85ba('0x1')]},'remotesecret':{'type':Sequelize[_0x85ba('0x1')]},'transport':{'type':Sequelize[_0x85ba('0x1')],'defaultValue':'udp','set':function(_0x608286){this[_0x85ba('0xc')](_0x85ba('0xd'),_0x608286?_0x608286[_0x85ba('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x85ba('0xd'))?this[_0x85ba('0xf')](_0x85ba('0xd'))[_0x85ba('0x10')](','):null;},'comment':_0x85ba('0x11')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833','info','shortinfo',_0x85ba('0x12'),_0x85ba('0x13')),'defaultValue':_0x85ba('0x14')},'directmedia':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x15'),'no',_0x85ba('0x16'),_0x85ba('0x17'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x85ba('0x1')]},'directmediadeny':{'type':Sequelize[_0x85ba('0x1')]},'nat':{'type':Sequelize[_0x85ba('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x3d8c30){this[_0x85ba('0xc')](_0x85ba('0x18'),_0x3d8c30?_0x3d8c30[_0x85ba('0xe')](','):null);},'get':function(){return this[_0x85ba('0xf')](_0x85ba('0x18'))?this[_0x85ba('0xf')](_0x85ba('0x18'))[_0x85ba('0x10')](','):null;},'comment':_0x85ba('0x19')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x85ba('0x1')]},'pickupgroup':{'type':Sequelize[_0x85ba('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x85ba('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x85ba('0x1')],'defaultValue':_0x85ba('0x1a')},'allow':{'type':Sequelize[_0x85ba('0x1')],'allowNull':![],'defaultValue':_0x85ba('0x1b'),'set':function(_0x19d0e4){this[_0x85ba('0xc')](_0x85ba('0x1c'),_0x19d0e4?_0x19d0e4[_0x85ba('0xe')](';'):_0x85ba('0x1b'));},'get':function(){return this[_0x85ba('0xf')]('allow')?this[_0x85ba('0xf')]('allow')[_0x85ba('0x10')](';'):null;},'comment':_0x85ba('0x1d')},'autoframing':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x15'),'no')},'insecure':{'type':Sequelize[_0x85ba('0x1')],'defaultValue':_0x85ba('0x1e'),'set':function(_0x530e40){this[_0x85ba('0xc')](_0x85ba('0x1f'),_0x530e40?_0x530e40[_0x85ba('0xe')](','):null);},'get':function(){return this[_0x85ba('0xf')](_0x85ba('0x1f'))?this[_0x85ba('0xf')]('insecure')[_0x85ba('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x85ba('0x2')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x85ba('0x15'),'no',_0x85ba('0x20'))},'promiscredir':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x15'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x85ba('0x15'),'no')},'accountcode':{'type':Sequelize[_0x85ba('0x21')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x85ba('0x1')],'defaultValue':_0x85ba('0x22')},'amaflags':{'type':Sequelize[_0x85ba('0x1')]},'callcounter':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x15'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x85ba('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0x85ba('0x1')]},'template':{'type':Sequelize[_0x85ba('0x1')]},'videosupport':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x15'),'no',_0x85ba('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x85ba('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x85ba('0x15'),'no')},'mailbox':{'type':Sequelize[_0x85ba('0x1')]},'session_timers':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x24'),'refuse',_0x85ba('0x25'))},'session_expires':{'type':Sequelize[_0x85ba('0x21')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x26'),_0x85ba('0x27')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x85ba('0x1')]},'regexten':{'type':Sequelize[_0x85ba('0x1')]},'fromdomain':{'type':Sequelize[_0x85ba('0x1')]},'fromuser':{'type':Sequelize[_0x85ba('0x1')]},'port':{'type':Sequelize[_0x85ba('0x21')](0x5)},'qualify':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x15'),'no'),'defaultValue':_0x85ba('0x15')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x85ba('0x1')]},'defaultuser':{'type':Sequelize[_0x85ba('0x1')]},'rtptimeout':{'type':Sequelize[_0x85ba('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x85ba('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x85ba('0x21')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0x85ba('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x85ba('0x1')]},'timert1':{'type':Sequelize[_0x85ba('0x21')](0xb)},'timerb':{'type':Sequelize[_0x85ba('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0x85ba('0x21')](0xb)},'contactpermit':{'type':Sequelize[_0x85ba('0x1')]},'contactdeny':{'type':Sequelize[_0x85ba('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x85ba('0x1')]},'maxforwards':{'type':Sequelize[_0x85ba('0x21')](0xb)},'encryption':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x15'),'no')},'force_avp':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x15'),'no')},'icesupport':{'type':Sequelize[_0x85ba('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0x85ba('0x2')]('yes','no',_0x85ba('0x29'),_0x85ba('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x85ba('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0x85ba('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x85ba('0x1')]},'dtlscipher':{'type':Sequelize[_0x85ba('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x85ba('0x1')]},'dtlssetup':{'type':Sequelize[_0x85ba('0x2')](_0x85ba('0x2b'),_0x85ba('0x2c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x85ba('0x1')]},'usereqphone':{'type':Sequelize[_0x85ba('0x2')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x85ba('0x1')]},'recordofffeature':{'type':Sequelize[_0x85ba('0x1')]},'call_limit':{'type':Sequelize[_0x85ba('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x85ba('0x15'),'no')},'vmexten':{'type':Sequelize[_0x85ba('0x1')]},'mohinterpret':{'type':Sequelize[_0x85ba('0x1')]},'mohsuggest':{'type':Sequelize[_0x85ba('0x1')]},'parkinglot':{'type':Sequelize[_0x85ba('0x1')]},'description':{'type':Sequelize[_0x85ba('0x1')]},'host':{'type':Sequelize[_0x85ba('0x1')],'defaultValue':_0x85ba('0x2d')},'canreinvite':{'type':Sequelize['ENUM'](_0x85ba('0x15'),'no',_0x85ba('0x16'),'update',_0x85ba('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x85ba('0x1')]},'otherFields':{'type':Sequelize[_0x85ba('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x85ba('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 14e93b7..ca791cb 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 _0x9c44=['key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','clone','find','omit','createdAt','body','updatedAt','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','params','/etc/asterisk/sip_xcally_registers.conf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','get','Trunks','destroy','stack','name','send','index','Trunk','rawAttributes','fieldName','type'];(function(_0x1fe8b9,_0xd87696){var _0x25d006=function(_0x35727f){while(--_0x35727f){_0x1fe8b9['push'](_0x1fe8b9['shift']());}};_0x25d006(++_0xd87696);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x16')][_0x49c4('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5f2fd9,_0x1909fe,_0x280996,_0x21f15a){return new BPromise(function(_0x2decee,_0x12777c){var _0x18211c=_0x21f15a||client;return _0x18211c[_0x49c4('0x18')](_0x5f2fd9,_0x280996)[_0x49c4('0x19')](function(_0x58d177){logger[_0x49c4('0x1a')](_0x49c4('0x1b'),_0x1909fe,_0x49c4('0x1c'));logger[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x1909fe,'request\x20sent',JSON[_0x49c4('0x1f')](_0x58d177));if(_0x58d177[_0x49c4('0x20')]){if(_0x58d177['error']['code']===0x1f4){logger[_0x49c4('0x20')](_0x49c4('0x1b'),_0x1909fe,_0x58d177[_0x49c4('0x20')]['message']);return _0x12777c(_0x58d177[_0x49c4('0x20')]['message']);}logger[_0x49c4('0x20')](_0x49c4('0x1b'),_0x1909fe,_0x58d177[_0x49c4('0x20')][_0x49c4('0x21')]);return _0x2decee(_0x58d177[_0x49c4('0x20')][_0x49c4('0x21')]);}else{logger[_0x49c4('0x1a')](_0x49c4('0x1b'),_0x1909fe,_0x49c4('0x1c'));_0x2decee(_0x58d177['result']['message']);}})['catch'](function(_0x1c99b1){logger['error']('Trunk,\x20%s,\x20%s',_0x1909fe,_0x1c99b1);_0x12777c(_0x1c99b1);});});}function respondWithStatusCode(_0x2263ae,_0x15581b){_0x15581b=_0x15581b||0xcc;return function(_0x26c640){if(_0x26c640){return _0x2263ae[_0x49c4('0x22')](_0x15581b);}return _0x2263ae['status'](_0x15581b)['end']();};}function respondWithResult(_0x180276,_0x9cb797){_0x9cb797=_0x9cb797||0xc8;return function(_0x565423){if(_0x565423){return _0x180276[_0x49c4('0x23')](_0x9cb797)[_0x49c4('0x24')](_0x565423);}};}function respondWithFilteredResult(_0x210159,_0xa7a826){return function(_0x531d92){if(_0x531d92){var _0x543ea2=typeof _0xa7a826[_0x49c4('0x25')]==='undefined'&&typeof _0xa7a826[_0x49c4('0x26')]===_0x49c4('0x27');var _0x3f1708=_0x531d92[_0x49c4('0x28')];var _0x5987ae=_0x543ea2?0x0:_0xa7a826[_0x49c4('0x25')];var _0x2b2793=_0x543ea2?_0x531d92[_0x49c4('0x28')]:_0xa7a826[_0x49c4('0x25')]+_0xa7a826[_0x49c4('0x26')];var _0x29f835;if(_0x2b2793>=_0x3f1708){_0x2b2793=_0x3f1708;_0x29f835=0xc8;}else{_0x29f835=0xce;}_0x210159[_0x49c4('0x23')](_0x29f835);return _0x210159[_0x49c4('0x29')](_0x49c4('0x2a'),_0x5987ae+'-'+_0x2b2793+'/'+_0x3f1708)[_0x49c4('0x24')](_0x531d92);}return null;};}function patchUpdates(_0x46f7ea){return function(_0x4ea6ea){try{jsonpatch['apply'](_0x4ea6ea,_0x46f7ea,!![]);}catch(_0x59eb84){return BPromise[_0x49c4('0x2b')](_0x59eb84);}return _0x4ea6ea[_0x49c4('0x2c')]();};}function saveUpdates(_0x1eb035,_0x27e467){return function(_0x28eb47){if(_0x28eb47){return _0x28eb47['update'](_0x1eb035)[_0x49c4('0x19')](function(_0x116eb4){return _0x116eb4;});}return null;};}function removeEntity(_0x2e7a69,_0x24bba9){return function(_0x58e252){if(_0x58e252){return _0x58e252['destroy']()[_0x49c4('0x19')](function(){var _0x9a1bed=_0x58e252[_0x49c4('0x2d')]({'plain':!![]});var _0x13b3b4=_0x49c4('0x2e');return db['UserProfileResource'][_0x49c4('0x2f')]({'where':{'type':_0x13b3b4,'resourceId':_0x9a1bed['id']}})[_0x49c4('0x19')](function(){return _0x58e252;});})[_0x49c4('0x19')](function(){_0x2e7a69['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x85dce2,_0x1991e9){return function(_0x3bec0a){if(!_0x3bec0a){_0x85dce2[_0x49c4('0x22')](0x194);}return _0x3bec0a;};}function handleError(_0x2b45a1,_0x2cf897){_0x2cf897=_0x2cf897||0x1f4;return function(_0x1d1557){logger[_0x49c4('0x20')](_0x1d1557[_0x49c4('0x30')]);if(_0x1d1557['name']){delete _0x1d1557[_0x49c4('0x31')];}_0x2b45a1['status'](_0x2cf897)[_0x49c4('0x32')](_0x1d1557);};}exports[_0x49c4('0x33')]=function(_0x2625a6,_0x1c2830){var _0x4ed4f8={},_0x335f0c={},_0x31f3ff={'count':0x0,'rows':[]};var _0x1c910a=_['map'](db[_0x49c4('0x34')][_0x49c4('0x35')],function(_0x178987){return{'name':_0x178987[_0x49c4('0x36')],'type':_0x178987[_0x49c4('0x37')][_0x49c4('0x38')]};});_0x335f0c[_0x49c4('0x39')]=_[_0x49c4('0x3a')](_0x1c910a,_0x49c4('0x31'));_0x335f0c[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2625a6['query']);_0x335f0c[_0x49c4('0x3d')]=_[_0x49c4('0x3e')](_0x335f0c[_0x49c4('0x39')],_0x335f0c[_0x49c4('0x3b')]);_0x4ed4f8[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x335f0c[_0x49c4('0x39')],qs[_0x49c4('0x40')](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x40')]));_0x4ed4f8[_0x49c4('0x3f')]=_0x4ed4f8[_0x49c4('0x3f')][_0x49c4('0x41')]?_0x4ed4f8['attributes']:_0x335f0c[_0x49c4('0x39')];if(!_0x2625a6['query'][_0x49c4('0x42')](_0x49c4('0x43'))){_0x4ed4f8[_0x49c4('0x26')]=qs[_0x49c4('0x26')](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x26')]);_0x4ed4f8['offset']=qs['offset'](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x25')]);}_0x4ed4f8[_0x49c4('0x44')]=qs[_0x49c4('0x45')](_0x2625a6['query'][_0x49c4('0x45')]);_0x4ed4f8[_0x49c4('0x46')]=qs[_0x49c4('0x3d')](_[_0x49c4('0x47')](_0x2625a6[_0x49c4('0x3b')],_0x335f0c[_0x49c4('0x3d')]),_0x1c910a);if(_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x48')]){_0x4ed4f8[_0x49c4('0x46')]=_['merge'](_0x4ed4f8[_0x49c4('0x46')],{'$or':_['map'](_0x1c910a,function(_0x33696e){if(_0x33696e[_0x49c4('0x37')]!==_0x49c4('0x49')){var _0x258abe={};_0x258abe[_0x33696e[_0x49c4('0x31')]]={'$like':'%'+_0x2625a6['query'][_0x49c4('0x48')]+'%'};return _0x258abe;}})});}_0x4ed4f8=_[_0x49c4('0x4a')]({},_0x4ed4f8,_0x2625a6[_0x49c4('0x4b')]);var _0x254d07={'where':_0x4ed4f8[_0x49c4('0x46')]};return db[_0x49c4('0x34')][_0x49c4('0x28')](_0x254d07)['then'](function(_0x3bac1b){_0x31f3ff['count']=_0x3bac1b;if(_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x4c')]){_0x4ed4f8[_0x49c4('0x4d')]=[{'all':!![]}];}return db[_0x49c4('0x34')][_0x49c4('0x4e')](_0x4ed4f8);})[_0x49c4('0x19')](function(_0x2c6be1){_0x31f3ff['rows']=_0x2c6be1;return _0x31f3ff;})[_0x49c4('0x19')](respondWithFilteredResult(_0x1c2830,_0x4ed4f8))[_0x49c4('0x4f')](handleError(_0x1c2830,null));};exports['show']=function(_0x1e1ac4,_0xaece5f){var _0xfbe179={'raw':![],'where':{'id':_0x1e1ac4['params']['id']}},_0x242afc={};_0x242afc['model']=_[_0x49c4('0x3c')](db['Trunk'][_0x49c4('0x35')]);_0x242afc[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x1e1ac4[_0x49c4('0x3b')]);_0x242afc[_0x49c4('0x3d')]=_[_0x49c4('0x3e')](_0x242afc[_0x49c4('0x39')],_0x242afc['query']);_0xfbe179[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x242afc[_0x49c4('0x39')],qs[_0x49c4('0x40')](_0x1e1ac4[_0x49c4('0x3b')][_0x49c4('0x40')]));_0xfbe179[_0x49c4('0x3f')]=_0xfbe179[_0x49c4('0x3f')][_0x49c4('0x41')]?_0xfbe179[_0x49c4('0x3f')]:_0x242afc['model'];if(_0x1e1ac4['query'][_0x49c4('0x4c')]){_0xfbe179[_0x49c4('0x4d')]=[{'all':!![]}];}_0xfbe179=_['merge']({},_0xfbe179,_0x1e1ac4['options']);return db[_0x49c4('0x34')]['find'](_0xfbe179)['then'](handleEntityNotFound(_0xaece5f,null))[_0x49c4('0x19')](respondWithResult(_0xaece5f,null))[_0x49c4('0x4f')](handleError(_0xaece5f,null));};exports[_0x49c4('0x50')]=function(_0x38c480,_0x2884ca){var _0x16949a={'where':{'id':_0x38c480['params']['id']}},_0x35724e={};_0x35724e[_0x49c4('0x39')]=_[_0x49c4('0x3c')](db[_0x49c4('0x34')][_0x49c4('0x35')]);_0x16949a[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x35724e['model'],qs['fields'](_0x38c480[_0x49c4('0x3b')][_0x49c4('0x40')]));_0x16949a[_0x49c4('0x3f')]=_0x16949a[_0x49c4('0x3f')][_0x49c4('0x41')]?_0x16949a[_0x49c4('0x3f')]:_0x35724e[_0x49c4('0x39')];if(_0x38c480['query'][_0x49c4('0x4c')]){_0x16949a[_0x49c4('0x4d')]=[{'all':!![]}];}_0x16949a=_['merge']({},_0x16949a,_0x38c480[_0x49c4('0x4b')]);return db['Trunk'][_0x49c4('0x51')](_0x16949a)[_0x49c4('0x19')](handleEntityNotFound(_0x2884ca,null))[_0x49c4('0x19')](function(_0x2fe89a){if(_0x2fe89a){var _0x845f7e=_0x2fe89a[_0x49c4('0x2d')]({'plain':!![]});_0x845f7e=qs[_0x49c4('0x52')](_0x845f7e,['id',_0x49c4('0x53'),'updatedAt']);_0x38c480[_0x49c4('0x54')]=_[_0x49c4('0x52')](_0x38c480['body'],['id',_0x49c4('0x53'),_0x49c4('0x55')]);return db['Trunk'][_0x49c4('0x56')](_[_0x49c4('0x4a')](_0x845f7e,_0x38c480['body']),{'include':_0x38c480['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0xc43386){var _0x54947d=_0x38c480[_0x49c4('0x57')][_0x49c4('0x2d')]({'plain':!![]});if(!_0x54947d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54947d[_0x49c4('0x58')]===_0x49c4('0x57')){var _0x5ac9f0=_0xc43386[_0x49c4('0x2d')]({'plain':!![]});var _0x3dcf4c=_0x49c4('0x2e');return db[_0x49c4('0x59')]['find']({'where':{'name':_0x3dcf4c,'userProfileId':_0x54947d[_0x49c4('0x5a')]},'raw':!![]})[_0x49c4('0x19')](function(_0x3cc604){if(_0x3cc604&&_0x3cc604[_0x49c4('0x5b')]===0x0){return db['UserProfileResource'][_0x49c4('0x56')]({'name':_0x5ac9f0['name'],'resourceId':_0x5ac9f0['id'],'type':_0x3cc604['name'],'sectionId':_0x3cc604['id']},{})['then'](function(){return _0xc43386;});}else{return _0xc43386;}})['catch'](function(_0x302251){logger[_0x49c4('0x20')](_0x49c4('0x5c'),_0x302251);throw _0x302251;});}return _0xc43386;});}})[_0x49c4('0x19')](respondWithResult(_0x2884ca,0xc9))['catch'](handleError(_0x2884ca,null));};exports['create']=function(_0x340523,_0x109b81,_0x342326){var _0x295ad0;return db[_0x49c4('0x34')][_0x49c4('0x56')](_0x340523[_0x49c4('0x54')],{'raw':!![]})[_0x49c4('0x19')](function(_0x4d49e0){_0x295ad0=_0x4d49e0;return db[_0x49c4('0x34')]['findAll']({'raw':!![]});})[_0x49c4('0x19')](function(_0x264902){var _0x1a5d4c=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x60')),_0x49c4('0x61'));var _0x13d951=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x62')),_0x49c4('0x61'));var _0x2d5f63=ejs[_0x49c4('0x63')](_0x1a5d4c,{'trunks':_0x264902||[]});fs[_0x49c4('0x64')](_0x49c4('0x65'),_0x2d5f63);if(_0x295ad0['registry']){var _0x5ec201=ejs[_0x49c4('0x63')](_0x13d951,{'trunks':_0x264902||[]});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x5ec201);}})[_0x49c4('0x19')](function(){return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x56'),{'module':_0x49c4('0x67')});})['then'](function(){var _0x5a14a5=_0x340523['user'][_0x49c4('0x2d')]({'plain':!![]});if(!_0x5a14a5)throw new Error(_0x49c4('0x68'));if(_0x5a14a5[_0x49c4('0x58')]===_0x49c4('0x57')){var _0x118fc4=_0x295ad0[_0x49c4('0x2d')]({'plain':!![]});return db[_0x49c4('0x59')][_0x49c4('0x51')]({'where':{'name':_0x49c4('0x2e'),'userProfileId':_0x5a14a5['userProfileId']},'raw':!![]})[_0x49c4('0x19')](function(_0x10fb84){if(_0x10fb84&&_0x10fb84[_0x49c4('0x5b')]===0x0){return db['UserProfileResource'][_0x49c4('0x56')]({'name':_0x118fc4[_0x49c4('0x31')],'resourceId':_0x118fc4['id'],'type':_0x10fb84[_0x49c4('0x31')],'sectionId':_0x10fb84['id']},{})[_0x49c4('0x19')](function(){return _0x295ad0;});}else{return _0x295ad0;}})[_0x49c4('0x4f')](function(_0x2fd749){logger[_0x49c4('0x20')](_0x49c4('0x5c'),_0x2fd749);throw _0x2fd749;});}return _0x295ad0;})['then'](respondWithResult(_0x109b81,0xc9))[_0x49c4('0x4f')](handleError(_0x109b81,null));};exports[_0x49c4('0x69')]=function(_0x85540f,_0x18e82b,_0x1e948a){var _0x4a204d;return db['Trunk'][_0x49c4('0x51')]({'where':{'id':_0x85540f['params']['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x18e82b,null))['then'](saveUpdates(_0x85540f[_0x49c4('0x54')],null))[_0x49c4('0x19')](function(_0x3b03dd){if(_0x3b03dd){_0x4a204d=_0x3b03dd;return db[_0x49c4('0x34')]['findAll']({'raw':!![]});}})[_0x49c4('0x19')](function(_0x38d7d3){if(_0x38d7d3){var _0x2ceada=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x60')),_0x49c4('0x61'));var _0x46477f=fs[_0x49c4('0x5d')](path['join'](config[_0x49c4('0x5f')],_0x49c4('0x62')),'utf8');var _0x15bee0=ejs['render'](_0x2ceada,{'trunks':_0x38d7d3||[]});fs[_0x49c4('0x64')](_0x49c4('0x65'),_0x15bee0);var _0x1f14a6=ejs[_0x49c4('0x63')](_0x46477f,{'trunks':_0x38d7d3||[]});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x1f14a6);return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x69'),{'module':'chan_sip.so'});}return null;})[_0x49c4('0x19')](function(_0x167e41){if(_0x167e41){return _0x4a204d;}})['then'](respondWithResult(_0x18e82b,null))[_0x49c4('0x4f')](handleError(_0x18e82b,null));};exports[_0x49c4('0x2f')]=function(_0x57b137,_0x37fef1,_0x993d00){var _0x25989a;return db[_0x49c4('0x34')]['find']({'where':{'id':_0x57b137[_0x49c4('0x6a')]['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x37fef1,null))['then'](removeEntity(_0x37fef1,null))[_0x49c4('0x19')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x49c4('0x19')](function(_0x507078){var _0x50fd24=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config['root'],_0x49c4('0x60')),'utf8');var _0x578f4b=fs['readFileSync'](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x62')),_0x49c4('0x61'));var _0x4a5f0b=ejs['render'](_0x50fd24,{'trunks':_0x507078});var _0x348693=ejs['render'](_0x578f4b,{'trunks':_0x507078});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a5f0b);fs[_0x49c4('0x64')](_0x49c4('0x6b'),_0x348693);return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x2f'),{'module':_0x49c4('0x67')});})[_0x49c4('0x4f')](handleError(_0x37fef1,null));}; \ No newline at end of file +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(_0xee64cd,_0x168456){var _0x3d3d8a=function(_0x15fa76){while(--_0x15fa76){_0xee64cd['push'](_0xee64cd['shift']());}};_0x3d3d8a(++_0x168456);}(_0x54ef,0x112));var _0xf54e=function(_0x3d4832,_0x4542a6){_0x3d4832=_0x3d4832-0x0;var _0x440a43=_0x54ef[_0x3d4832];return _0x440a43;};'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 diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 8a2d172..c319e0c 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 _0x0739=['exports','define','Trunk','util','api','bluebird','rimraf','./trunk.attributes'];(function(_0x5b86bc,_0x5ebdf5){var _0xb4b2dc=function(_0x422f50){while(--_0x422f50){_0x5b86bc['push'](_0x5b86bc['shift']());}};_0xb4b2dc(++_0x5ebdf5);}(_0x0739,0x103));var _0x9073=function(_0x5d9db7,_0x4a2b0f){_0x5d9db7=_0x5d9db7-0x0;var _0x41ae91=_0x0739[_0x5d9db7];return _0x41ae91;};'use strict';var _=require('lodash');var util=require(_0x9073('0x0'));var logger=require('../../config/logger')(_0x9073('0x1'));var moment=require('moment');var BPromise=require(_0x9073('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9073('0x3'));var config=require('../../config/environment');var attributes=require(_0x9073('0x4'));module[_0x9073('0x5')]=function(_0x4cafc3,_0x56c4e9){return _0x4cafc3[_0x9073('0x6')](_0x9073('0x7'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90ec=['./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x52a6be,_0xe01d8d){var _0x449c4f=function(_0xddc8e){while(--_0xddc8e){_0x52a6be['push'](_0x52a6be['shift']());}};_0x449c4f(++_0xe01d8d);}(_0x90ec,0x19a));var _0xc90e=function(_0x6f5538,_0x167476){_0x6f5538=_0x6f5538-0x0;var _0x4b67a7=_0x90ec[_0x6f5538];return _0x4b67a7;};'use strict';var _=require(_0xc90e('0x0'));var util=require(_0xc90e('0x1'));var logger=require(_0xc90e('0x2'))(_0xc90e('0x3'));var moment=require(_0xc90e('0x4'));var BPromise=require(_0xc90e('0x5'));var rp=require(_0xc90e('0x6'));var fs=require('fs');var path=require(_0xc90e('0x7'));var rimraf=require(_0xc90e('0x8'));var config=require(_0xc90e('0x9'));var attributes=require(_0xc90e('0xa'));module[_0xc90e('0xb')]=function(_0x5e3c4b,_0x3f60ee){return _0x5e3c4b[_0xc90e('0xc')](_0xc90e('0xd'),attributes,{'tableName':_0xc90e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 2c9037d..49c2b72 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 _0x6ed7=['../../config/logger','rpc','../../config/environment','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetTrunk','Trunk','options','raw','attributes','include','map','model','catch','ShowTrunk','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x1ef48d,_0x19781c){var _0x25776c=function(_0x384d0e){while(--_0x384d0e){_0x1ef48d['push'](_0x1ef48d['shift']());}};_0x25776c(++_0x19781c);}(_0x6ed7,0x13a));var _0x76ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ed7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x76ed('0x0'));var util=require('util');var moment=require(_0x76ed('0x1'));var BPromise=require(_0x76ed('0x2'));var rs=require(_0x76ed('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76ed('0x4'))['db'];var utils=require(_0x76ed('0x5'));var logger=require(_0x76ed('0x6'))(_0x76ed('0x7'));var config=require(_0x76ed('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x76ed('0x9')][_0x76ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3071ec,_0xdf652a,_0x4fab35){return new BPromise(function(_0x5845f4,_0x5633f4){return client['request'](_0x3071ec,_0x4fab35)[_0x76ed('0xb')](function(_0x5ca1bb){logger[_0x76ed('0xc')](_0x76ed('0xd'),_0xdf652a,_0x76ed('0xe'));logger[_0x76ed('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0xdf652a,_0x76ed('0xe'),JSON[_0x76ed('0x10')](_0x5ca1bb));if(_0x5ca1bb[_0x76ed('0x11')]){if(_0x5ca1bb[_0x76ed('0x11')][_0x76ed('0x12')]===0x1f4){logger[_0x76ed('0x11')]('Trunk,\x20%s,\x20%s',_0xdf652a,_0x5ca1bb[_0x76ed('0x11')][_0x76ed('0x13')]);return _0x5633f4(_0x5ca1bb['error'][_0x76ed('0x13')]);}logger['error'](_0x76ed('0xd'),_0xdf652a,_0x5ca1bb[_0x76ed('0x11')][_0x76ed('0x13')]);return _0x5845f4(_0x5ca1bb['error'][_0x76ed('0x13')]);}else{logger[_0x76ed('0xc')](_0x76ed('0xd'),_0xdf652a,_0x76ed('0xe'));_0x5845f4(_0x5ca1bb[_0x76ed('0x14')]['message']);}})['catch'](function(_0x3c1360){logger[_0x76ed('0x11')](_0x76ed('0xd'),_0xdf652a,_0x3c1360);_0x5633f4(_0x3c1360);});});}exports[_0x76ed('0x15')]=function(_0x517076){var _0x2dfa0b=this;return new Promise(function(_0x20d66c,_0x33dc1f){return db[_0x76ed('0x16')]['findAll']({'raw':_0x517076['options']?_0x517076[_0x76ed('0x17')][_0x76ed('0x18')]===undefined?!![]:![]:!![],'where':_0x517076[_0x76ed('0x17')]?_0x517076['options']['where']||null:null,'attributes':_0x517076[_0x76ed('0x17')]?_0x517076[_0x76ed('0x17')][_0x76ed('0x19')]||null:null,'limit':_0x517076[_0x76ed('0x17')]?_0x517076[_0x76ed('0x17')]['limit']||null:null,'include':_0x517076[_0x76ed('0x17')]?_0x517076[_0x76ed('0x17')][_0x76ed('0x1a')]?_[_0x76ed('0x1b')](_0x517076[_0x76ed('0x17')]['include'],function(_0x4ed863){return{'model':db[_0x4ed863[_0x76ed('0x1c')]],'as':_0x4ed863['as'],'attributes':_0x4ed863[_0x76ed('0x19')],'include':_0x4ed863['include']?_[_0x76ed('0x1b')](_0x4ed863['include'],function(_0x1c2054){return{'model':db[_0x1c2054['model']],'as':_0x1c2054['as'],'attributes':_0x1c2054['attributes'],'include':_0x1c2054['include']?_['map'](_0x1c2054[_0x76ed('0x1a')],function(_0x382a67){return{'model':db[_0x382a67['model']],'as':_0x382a67['as'],'attributes':_0x382a67[_0x76ed('0x19')]};}):[]};}):[]};}):[]:[]})[_0x76ed('0xb')](function(_0x2b83fb){logger['info']('GetTrunk',_0x517076);logger[_0x76ed('0xf')](_0x76ed('0x15'),_0x517076,JSON[_0x76ed('0x10')](_0x2b83fb));_0x20d66c(_0x2b83fb);})[_0x76ed('0x1d')](function(_0x369e7d){logger['error'](_0x76ed('0x15'),_0x369e7d[_0x76ed('0x13')],_0x517076);_0x33dc1f(_0x2dfa0b[_0x76ed('0x11')](0x1f4,_0x369e7d[_0x76ed('0x13')]));});});};exports[_0x76ed('0x1e')]=function(_0x5024de){var _0xe27193=this;return new Promise(function(_0x4bc29d,_0x567bbe){return db[_0x76ed('0x16')]['find']({'raw':_0x5024de[_0x76ed('0x17')]?_0x5024de[_0x76ed('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5024de[_0x76ed('0x17')]?_0x5024de['options'][_0x76ed('0x1f')]||null:null,'attributes':_0x5024de[_0x76ed('0x17')]?_0x5024de['options'][_0x76ed('0x19')]||null:null,'include':_0x5024de[_0x76ed('0x17')]?_0x5024de['options'][_0x76ed('0x1a')]?_['map'](_0x5024de['options']['include'],function(_0x1fe74f){return{'model':db[_0x1fe74f[_0x76ed('0x1c')]],'as':_0x1fe74f['as'],'attributes':_0x1fe74f[_0x76ed('0x19')],'include':_0x1fe74f[_0x76ed('0x1a')]?_['map'](_0x1fe74f[_0x76ed('0x1a')],function(_0x480183){return{'model':db[_0x480183[_0x76ed('0x1c')]],'as':_0x480183['as'],'attributes':_0x480183[_0x76ed('0x19')],'include':_0x480183[_0x76ed('0x1a')]?_[_0x76ed('0x1b')](_0x480183['include'],function(_0x1eb5cc){return{'model':db[_0x1eb5cc[_0x76ed('0x1c')]],'as':_0x1eb5cc['as'],'attributes':_0x1eb5cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x76ed('0xb')](function(_0x5800e4){logger[_0x76ed('0xc')](_0x76ed('0x1e'),_0x5024de);logger[_0x76ed('0xf')](_0x76ed('0x1e'),_0x5024de,JSON[_0x76ed('0x10')](_0x5800e4));_0x4bc29d(_0x5800e4);})[_0x76ed('0x1d')](function(_0x23d674){logger[_0x76ed('0x11')]('ShowTrunk',_0x23d674[_0x76ed('0x13')],_0x5024de);_0x567bbe(_0xe27193[_0x76ed('0x11')](0x1f4,_0x23d674[_0x76ed('0x13')]));});});}; \ No newline at end of file +var _0x48ad=['find','where','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','GetTrunk','Trunk','findAll','options','attributes','limit','include','map','model','catch','ShowTrunk'];(function(_0x534757,_0x4c40d1){var _0x257066=function(_0x4297d7){while(--_0x4297d7){_0x534757['push'](_0x534757['shift']());}};_0x257066(++_0x4c40d1);}(_0x48ad,0xb1));var _0xd48a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x48ad[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd48a('0x0'));var util=require('util');var moment=require(_0xd48a('0x1'));var BPromise=require(_0xd48a('0x2'));var rs=require(_0xd48a('0x3'));var fs=require('fs');var Redis=require(_0xd48a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd48a('0x5'));var logger=require(_0xd48a('0x6'))(_0xd48a('0x7'));var config=require(_0xd48a('0x8'));var jayson=require(_0xd48a('0x9'));var client=jayson[_0xd48a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7a0584,_0xf2977b,_0x169b36){return new BPromise(function(_0x2633be,_0x3ed171){return client[_0xd48a('0xb')](_0x7a0584,_0x169b36)[_0xd48a('0xc')](function(_0xb1af13){logger[_0xd48a('0xd')]('Trunk,\x20%s,\x20%s',_0xf2977b,_0xd48a('0xe'));logger[_0xd48a('0xf')](_0xd48a('0x10'),_0xf2977b,_0xd48a('0xe'),JSON[_0xd48a('0x11')](_0xb1af13));if(_0xb1af13[_0xd48a('0x12')]){if(_0xb1af13[_0xd48a('0x12')][_0xd48a('0x13')]===0x1f4){logger['error'](_0xd48a('0x14'),_0xf2977b,_0xb1af13['error'][_0xd48a('0x15')]);return _0x3ed171(_0xb1af13[_0xd48a('0x12')]['message']);}logger[_0xd48a('0x12')]('Trunk,\x20%s,\x20%s',_0xf2977b,_0xb1af13[_0xd48a('0x12')][_0xd48a('0x15')]);return _0x2633be(_0xb1af13[_0xd48a('0x12')]['message']);}else{logger[_0xd48a('0xd')]('Trunk,\x20%s,\x20%s',_0xf2977b,'request\x20sent');_0x2633be(_0xb1af13['result'][_0xd48a('0x15')]);}})['catch'](function(_0x5a2cef){logger[_0xd48a('0x12')](_0xd48a('0x14'),_0xf2977b,_0x5a2cef);_0x3ed171(_0x5a2cef);});});}exports[_0xd48a('0x16')]=function(_0x573bdb){var _0x401aaa=this;return new Promise(function(_0x144013,_0x1f366f){return db[_0xd48a('0x17')][_0xd48a('0x18')]({'raw':_0x573bdb[_0xd48a('0x19')]?_0x573bdb[_0xd48a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x573bdb[_0xd48a('0x19')]?_0x573bdb['options']['where']||null:null,'attributes':_0x573bdb['options']?_0x573bdb[_0xd48a('0x19')][_0xd48a('0x1a')]||null:null,'limit':_0x573bdb[_0xd48a('0x19')]?_0x573bdb[_0xd48a('0x19')][_0xd48a('0x1b')]||null:null,'include':_0x573bdb[_0xd48a('0x19')]?_0x573bdb['options'][_0xd48a('0x1c')]?_[_0xd48a('0x1d')](_0x573bdb[_0xd48a('0x19')][_0xd48a('0x1c')],function(_0x348431){return{'model':db[_0x348431[_0xd48a('0x1e')]],'as':_0x348431['as'],'attributes':_0x348431[_0xd48a('0x1a')],'include':_0x348431[_0xd48a('0x1c')]?_[_0xd48a('0x1d')](_0x348431[_0xd48a('0x1c')],function(_0x54786c){return{'model':db[_0x54786c[_0xd48a('0x1e')]],'as':_0x54786c['as'],'attributes':_0x54786c[_0xd48a('0x1a')],'include':_0x54786c['include']?_['map'](_0x54786c[_0xd48a('0x1c')],function(_0x35ad3d){return{'model':db[_0x35ad3d[_0xd48a('0x1e')]],'as':_0x35ad3d['as'],'attributes':_0x35ad3d[_0xd48a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd48a('0xc')](function(_0x21fa1a){logger[_0xd48a('0xd')]('GetTrunk',_0x573bdb);logger[_0xd48a('0xf')](_0xd48a('0x16'),_0x573bdb,JSON[_0xd48a('0x11')](_0x21fa1a));_0x144013(_0x21fa1a);})[_0xd48a('0x1f')](function(_0x53b294){logger[_0xd48a('0x12')]('GetTrunk',_0x53b294[_0xd48a('0x15')],_0x573bdb);_0x1f366f(_0x401aaa[_0xd48a('0x12')](0x1f4,_0x53b294['message']));});});};exports[_0xd48a('0x20')]=function(_0x5670a9){var _0xb2ff72=this;return new Promise(function(_0xe53cee,_0x108e8f){return db[_0xd48a('0x17')][_0xd48a('0x21')]({'raw':_0x5670a9['options']?_0x5670a9['options']['raw']===undefined?!![]:![]:!![],'where':_0x5670a9['options']?_0x5670a9[_0xd48a('0x19')][_0xd48a('0x22')]||null:null,'attributes':_0x5670a9[_0xd48a('0x19')]?_0x5670a9['options'][_0xd48a('0x1a')]||null:null,'include':_0x5670a9[_0xd48a('0x19')]?_0x5670a9[_0xd48a('0x19')][_0xd48a('0x1c')]?_[_0xd48a('0x1d')](_0x5670a9[_0xd48a('0x19')][_0xd48a('0x1c')],function(_0x35d6d8){return{'model':db[_0x35d6d8[_0xd48a('0x1e')]],'as':_0x35d6d8['as'],'attributes':_0x35d6d8[_0xd48a('0x1a')],'include':_0x35d6d8[_0xd48a('0x1c')]?_[_0xd48a('0x1d')](_0x35d6d8['include'],function(_0x29de1f){return{'model':db[_0x29de1f[_0xd48a('0x1e')]],'as':_0x29de1f['as'],'attributes':_0x29de1f[_0xd48a('0x1a')],'include':_0x29de1f[_0xd48a('0x1c')]?_['map'](_0x29de1f[_0xd48a('0x1c')],function(_0x593355){return{'model':db[_0x593355['model']],'as':_0x593355['as'],'attributes':_0x593355[_0xd48a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd48a('0xc')](function(_0x977e29){logger['info'](_0xd48a('0x20'),_0x5670a9);logger[_0xd48a('0xf')](_0xd48a('0x20'),_0x5670a9,JSON[_0xd48a('0x11')](_0x977e29));_0xe53cee(_0x977e29);})[_0xd48a('0x1f')](function(_0x16bd87){logger['error'](_0xd48a('0x20'),_0x16bd87[_0xd48a('0x15')],_0x5670a9);_0x108e8f(_0xb2ff72['error'](0x1f4,_0x16bd87['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 2a382e3..8771e86 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 _0xa360=['exports','../../components/auth/service','./user-setting.controller','isAuthenticated','update'];(function(_0x4f3f32,_0x4569fa){var _0x477d70=function(_0x583404){while(--_0x583404){_0x4f3f32['push'](_0x4f3f32['shift']());}};_0x477d70(++_0x4569fa);}(_0xa360,0xb5));var _0x0a36=function(_0x4b52a7,_0x3f564d){_0x4b52a7=_0x4b52a7-0x0;var _0x341413=_0xa360[_0x4b52a7];return _0x341413;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x0a36('0x0'));var controller=require(_0x0a36('0x1'));router['put']('/:id',auth[_0x0a36('0x2')](),controller[_0x0a36('0x3')]);module[_0x0a36('0x4')]=router; \ No newline at end of file +var _0x4c76=['isAuthenticated','update','exports','express','Router','./user-setting.controller','put','/:id'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x4c76,0xc3));var _0x64c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c76[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x64c7('0x0'));var router=express[_0x64c7('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x64c7('0x2'));router[_0x64c7('0x3')](_0x64c7('0x4'),auth[_0x64c7('0x5')](),controller[_0x64c7('0x6')]);module[_0x64c7('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 6b2c083..eef34cd 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 _0xfc61=['DATE','INTEGER','error','warning','debug','exports','ENUM','TEXT'];(function(_0x376cd6,_0x26b785){var _0x542436=function(_0x19173c){while(--_0x19173c){_0x376cd6['push'](_0x376cd6['shift']());}};_0x542436(++_0x26b785);}(_0xfc61,0x1a2));var _0x1fc6=function(_0x9c6c1c,_0x21ead9){_0x9c6c1c=_0x9c6c1c-0x0;var _0x594c42=_0xfc61[_0x9c6c1c];return _0x594c42;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x1fc6('0x0'),_0x1fc6('0x1'),'info',_0x1fc6('0x2')];module[_0x1fc6('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x1fc6('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x1fc6('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x1fc6('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x1fc6('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x1fc6('0x7')],'unique':'UserId'}}; \ No newline at end of file +var _0x82ec=['UserId','sequelize','error','info','debug','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER'];(function(_0x17c596,_0x202055){var _0x443046=function(_0x53fc9f){while(--_0x53fc9f){_0x17c596['push'](_0x17c596['shift']());}};_0x443046(++_0x202055);}(_0x82ec,0x11f));var _0xc82e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x82ec[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc82e('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xc82e('0x1'),'warning',_0xc82e('0x2'),_0xc82e('0x3')];module[_0xc82e('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xc82e('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xc82e('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xc82e('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xc82e('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xc82e('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xc82e('0x9')],'unique':_0xc82e('0xa')}}; \ 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 651f602..90be8a2 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 _0xe148=['../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','localhost','status','json','then','error','stack','name','update','user','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch','lodash','ioredis','api'];(function(_0x429f2f,_0x8c7732){var _0x105d17=function(_0x109253){while(--_0x109253){_0x429f2f['push'](_0x429f2f['shift']());}};_0x105d17(++_0x8c7732);}(_0xe148,0x9e));var _0x8e14=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xe148[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0x8e14('0x0'));var Redis=require(_0x8e14('0x1'));var logger=require('../../config/logger')(_0x8e14('0x2'));var config=require(_0x8e14('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0x8e14('0x4'))(new Redis(config[_0x8e14('0x5')]));require(_0x8e14('0x6'))[_0x8e14('0x7')](socket);config['redis']=_['defaults'](config[_0x8e14('0x5')],{'host':_0x8e14('0x8'),'port':0x18eb});function respondWithResult(_0x5d5232,_0x1a8608){_0x1a8608=_0x1a8608||0xc8;return function(_0x231d97){if(_0x231d97){return _0x5d5232[_0x8e14('0x9')](_0x1a8608)[_0x8e14('0xa')](_0x231d97);}};}function saveUpdates(_0x57b082){return function(_0x1aaba9){if(_0x1aaba9){return _0x1aaba9['update'](_0x57b082)[_0x8e14('0xb')](function(_0x2587a1){return _0x2587a1;});}return null;};}function handleEntityNotFound(_0x491a46){return function(_0x9a0381){if(!_0x9a0381){_0x491a46['sendStatus'](0x194);}return _0x9a0381;};}function handleError(_0x4792a0,_0x197f35){_0x197f35=_0x197f35||0x1f4;return function(_0x48554a){logger[_0x8e14('0xc')](_0x48554a[_0x8e14('0xd')]);if(_0x48554a['name']){delete _0x48554a[_0x8e14('0xe')];}_0x4792a0['status'](_0x197f35)['send'](_0x48554a);};}exports[_0x8e14('0xf')]=function(_0x5d85ce,_0x29a2b4){if(_0x5d85ce[_0x8e14('0x10')]['role']!=='admin')throw new Error(_0x8e14('0x11'));if(isNaN(Number(_0x5d85ce[_0x8e14('0x12')]['id'])))throw new Error(_0x8e14('0x13'));return db[_0x8e14('0x14')][_0x8e14('0x15')]({'where':{'id':_0x5d85ce['params']['id']}})[_0x8e14('0xb')](handleEntityNotFound(_0x29a2b4,null))[_0x8e14('0xb')](saveUpdates(_0x5d85ce['body'],null))[_0x8e14('0xb')](respondWithResult(_0x29a2b4,null))[_0x8e14('0x16')](handleError(_0x29a2b4,null));}; \ No newline at end of file +var _0x99c9=['api','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','register','redis','defaults','localhost','status','json','update','sendStatus','error','stack','name','send','user','role','Invalid\x20user\x20setting\x20id','UserSetting','find','params','then','body','catch','lodash','ioredis','../../config/logger'];(function(_0x325e93,_0x1be29c){var _0x1fe218=function(_0x194bba){while(--_0x194bba){_0x325e93['push'](_0x325e93['shift']());}};_0x1fe218(++_0x1be29c);}(_0x99c9,0x13c));var _0x999c=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x99c9[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0x999c('0x0'));var Redis=require(_0x999c('0x1'));var logger=require(_0x999c('0x2'))(_0x999c('0x3'));var config=require(_0x999c('0x4'));var db=require(_0x999c('0x5'))['db'];var socket=require(_0x999c('0x6'))(new Redis(config['redis']));require(_0x999c('0x7'))[_0x999c('0x8')](socket);config[_0x999c('0x9')]=_[_0x999c('0xa')](config[_0x999c('0x9')],{'host':_0x999c('0xb'),'port':0x18eb});function respondWithResult(_0x34f100,_0x651b7e){_0x651b7e=_0x651b7e||0xc8;return function(_0xc8a6b5){if(_0xc8a6b5){return _0x34f100[_0x999c('0xc')](_0x651b7e)[_0x999c('0xd')](_0xc8a6b5);}};}function saveUpdates(_0x3c58ba){return function(_0x32984f){if(_0x32984f){return _0x32984f[_0x999c('0xe')](_0x3c58ba)['then'](function(_0x1f3f8f){return _0x1f3f8f;});}return null;};}function handleEntityNotFound(_0x2bf133){return function(_0x574ba0){if(!_0x574ba0){_0x2bf133[_0x999c('0xf')](0x194);}return _0x574ba0;};}function handleError(_0x140c4b,_0x97d9fd){_0x97d9fd=_0x97d9fd||0x1f4;return function(_0x3c1dab){logger[_0x999c('0x10')](_0x3c1dab[_0x999c('0x11')]);if(_0x3c1dab[_0x999c('0x12')]){delete _0x3c1dab[_0x999c('0x12')];}_0x140c4b[_0x999c('0xc')](_0x97d9fd)[_0x999c('0x13')](_0x3c1dab);};}exports[_0x999c('0xe')]=function(_0x85f4a0,_0x4c3209){if(_0x85f4a0[_0x999c('0x14')][_0x999c('0x15')]!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x85f4a0['params']['id'])))throw new Error(_0x999c('0x16'));return db[_0x999c('0x17')][_0x999c('0x18')]({'where':{'id':_0x85f4a0[_0x999c('0x19')]['id']}})[_0x999c('0x1a')](handleEntityNotFound(_0x4c3209,null))['then'](saveUpdates(_0x85f4a0[_0x999c('0x1b')],null))[_0x999c('0x1a')](respondWithResult(_0x4c3209,null))[_0x999c('0x1c')](handleError(_0x4c3209,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 41d0676..73304ef 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 _0x0ea3=['events','../../mysqldb','update','emit','hasOwnProperty','hook','exports'];(function(_0xee2e7a,_0x58354d){var _0x319dd3=function(_0xa99240){while(--_0xa99240){_0xee2e7a['push'](_0xee2e7a['shift']());}};_0x319dd3(++_0x58354d);}(_0x0ea3,0x19d));var _0x30ea=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0x0ea3[_0x3c4a7c];return _0xf13d1e;};'use strict';var EventEmitter=require(_0x30ea('0x0'));var UserSetting=require(_0x30ea('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x30ea('0x2'),'afterDestroy':'remove'};function emitEvent(_0x31bd7e){return function(_0xa2871e,_0x572a1a,_0x21fe79){UserSettingEvents[_0x30ea('0x3')](_0x31bd7e+':'+_0xa2871e['id'],_0xa2871e);UserSettingEvents[_0x30ea('0x3')](_0x31bd7e,_0xa2871e);_0x21fe79(null);};}for(var e in events){if(events[_0x30ea('0x4')](e)){var event=events[e];UserSetting[_0x30ea('0x5')](e,emitEvent(event));}}module[_0x30ea('0x6')]=UserSettingEvents; \ No newline at end of file +var _0x6a30=['events','../../mysqldb','UserSetting','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x4e5d94,_0x39be52){var _0x51de80=function(_0x384525){while(--_0x384525){_0x4e5d94['push'](_0x4e5d94['shift']());}};_0x51de80(++_0x39be52);}(_0x6a30,0xf3));var _0x06a3=function(_0x5ee290,_0x479806){_0x5ee290=_0x5ee290-0x0;var _0x3c7930=_0x6a30[_0x5ee290];return _0x3c7930;};'use strict';var EventEmitter=require(_0x06a3('0x0'));var UserSetting=require(_0x06a3('0x1'))['db'][_0x06a3('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x06a3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x06a3('0x4'),'afterDestroy':_0x06a3('0x5')};function emitEvent(_0xa801e8){return function(_0x44230e,_0x54f60e,_0x4b6a4f){UserSettingEvents[_0x06a3('0x6')](_0xa801e8+':'+_0x44230e['id'],_0x44230e);UserSettingEvents[_0x06a3('0x6')](_0xa801e8,_0x44230e);_0x4b6a4f(null);};}for(var e in events){if(events[_0x06a3('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x06a3('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 1f163c6..7898d0c 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 _0x30fc=['define','UserSetting','user_settings','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x568d7c,_0xee08ad){var _0x266c72=function(_0x255763){while(--_0x255763){_0x568d7c['push'](_0x568d7c['shift']());}};_0x266c72(++_0xee08ad);}(_0x30fc,0x64));var _0xc30f=function(_0x3bd792,_0x171a3e){_0x3bd792=_0x3bd792-0x0;var _0x405c0f=_0x30fc[_0x3bd792];return _0x405c0f;};'use strict';var attributes=require(_0xc30f('0x0'));module[_0xc30f('0x1')]=function(_0x587cb7){return _0x587cb7[_0xc30f('0x2')](_0xc30f('0x3'),attributes,{'tableName':_0xc30f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x44e16c){if(!_0x44e16c['clientSideLoggingEnabled'])_0x44e16c[_0xc30f('0x5')]=null;else if(_0x44e16c[_0xc30f('0x5')]===null)_0x44e16c[_0xc30f('0x5')]=new Date();}}});}; \ No newline at end of file +var _0xc788=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','user_settings','clientSideLoggingEnabled'];(function(_0x3a0f17,_0x1dcb60){var _0x48ef88=function(_0x25d422){while(--_0x25d422){_0x3a0f17['push'](_0x3a0f17['shift']());}};_0x48ef88(++_0x1dcb60);}(_0xc788,0xc4));var _0x8c78=function(_0xa041de,_0x3600e2){_0xa041de=_0xa041de-0x0;var _0x1d654c=_0xc788[_0xa041de];return _0x1d654c;};'use strict';var attributes=require(_0x8c78('0x0'));module[_0x8c78('0x1')]=function(_0x2344ba){return _0x2344ba['define']('UserSetting',attributes,{'tableName':_0x8c78('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1af8e2){if(!_0x1af8e2[_0x8c78('0x3')])_0x1af8e2[_0x8c78('0x4')]=null;else if(_0x1af8e2[_0x8c78('0x4')]===null)_0x1af8e2['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 47849d5..339be3f 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 _0xf82f=['emit','user-setting:update','user-setting:update:user-','register','length','user-setting:','./user-setting.events','save','remove'];(function(_0x38d757,_0x57e080){var _0x428190=function(_0x550ba1){while(--_0x550ba1){_0x38d757['push'](_0x38d757['shift']());}};_0x428190(++_0x57e080);}(_0xf82f,0x192));var _0xff82=function(_0xb227cf,_0xa05538){_0xb227cf=_0xb227cf-0x0;var _0x2ac0c2=_0xf82f[_0xb227cf];return _0x2ac0c2;};'use strict';var UserSettingEvents=require(_0xff82('0x0'));var events=[_0xff82('0x1'),_0xff82('0x2'),'update'];function createListener(_0x59b398,_0x5b422a){return function(_0x29106b){_0x5b422a[_0xff82('0x3')](_0x59b398,_0x29106b);if(_0x59b398===_0xff82('0x4')){_0x5b422a[_0xff82('0x3')](_0xff82('0x5')+_0x29106b['UserId'],_0x29106b);}};}exports[_0xff82('0x6')]=function(_0x1afbe3){for(var _0x4ab727=0x0,_0x40b907=events[_0xff82('0x7')];_0x4ab727<_0x40b907;_0x4ab727++){var _0x225e22=events[_0x4ab727];var _0x9fc83f=createListener(_0xff82('0x8')+_0x225e22,_0x1afbe3);UserSettingEvents['on'](_0x225e22,_0x9fc83f);}}; \ No newline at end of file +var _0x297b=['register','length','./user-setting.events','save','user-setting:update','user-setting:update:user-','UserId'];(function(_0x14153c,_0x5b0861){var _0x36f609=function(_0x543b8f){while(--_0x543b8f){_0x14153c['push'](_0x14153c['shift']());}};_0x36f609(++_0x5b0861);}(_0x297b,0xb8));var _0xb297=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x297b[_0x2642cb];return _0xe6e41;};'use strict';var UserSettingEvents=require(_0xb297('0x0'));var events=[_0xb297('0x1'),'remove','update'];function createListener(_0x4d0837,_0x60faa2){return function(_0x5e70d9){_0x60faa2['emit'](_0x4d0837,_0x5e70d9);if(_0x4d0837===_0xb297('0x2')){_0x60faa2['emit'](_0xb297('0x3')+_0x5e70d9[_0xb297('0x4')],_0x5e70d9);}};}exports[_0xb297('0x5')]=function(_0x4fe273){for(var _0x178e48=0x0,_0x5eeb0d=events[_0xb297('0x6')];_0x178e48<_0x5eeb0d;_0x178e48++){var _0x4cdd8e=events[_0x178e48];var _0x12f61b=createListener('user-setting:'+_0x4cdd8e,_0x4fe273);UserSettingEvents['on'](_0x4cdd8e,_0x12f61b);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index bf3aa05..64cd40e 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 _0xbd87=['destroy','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','get','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','getAvatar','getOpenTabs','/:id/contacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','diskStorage','join','root','server/files/images/','%s-%s','originalname','/:id/avatar','single','file','addAvatar','/:id/login','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addOpenchannelInteractions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','/:id/password','changePassword','delete','removeQueues','removeTeams'];(function(_0x105896,_0x2b1b8e){var _0x397ad0=function(_0xa176ec){while(--_0xa176ec){_0x105896['push'](_0x105896['shift']());}};_0x397ad0(++_0x2b1b8e);}(_0xbd87,0x84));var _0x7bd8=function(_0x338995,_0x467360){_0x338995=_0x338995-0x0;var _0x5e0956=_0xbd87[_0x338995];return _0x5e0956;};'use strict';var multer=require('multer');var util=require(_0x7bd8('0x0'));var path=require(_0x7bd8('0x1'));var timeout=require(_0x7bd8('0x2'));var express=require(_0x7bd8('0x3'));var router=express[_0x7bd8('0x4')]();var fs_extra=require(_0x7bd8('0x5'));var auth=require(_0x7bd8('0x6'));var interaction=require(_0x7bd8('0x7'));var config=require(_0x7bd8('0x8'));var controller=require(_0x7bd8('0x9'));router['get']('/',auth[_0x7bd8('0xa')](),controller['index']);router[_0x7bd8('0xb')](_0x7bd8('0xc'),auth['isAuthenticated'](),controller[_0x7bd8('0xd')]);router[_0x7bd8('0xb')](_0x7bd8('0xe'),auth['isAuthenticated'](),controller[_0x7bd8('0xf')]);router[_0x7bd8('0xb')](_0x7bd8('0x10'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x11')]);router[_0x7bd8('0xb')](_0x7bd8('0x12'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x13')]);router[_0x7bd8('0xb')]('/:id/avatar',controller[_0x7bd8('0x14')]);router['get']('/:id/open_tabs',auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x15')]);router[_0x7bd8('0xb')](_0x7bd8('0x16'),auth['isAuthenticated'](),controller['getContacts']);router[_0x7bd8('0xb')](_0x7bd8('0x17'),auth[_0x7bd8('0xa')](),controller['getQueues']);router['get'](_0x7bd8('0x18'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x19')]);router[_0x7bd8('0xb')]('/:id/groups',auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x1a')]);router[_0x7bd8('0xb')](_0x7bd8('0x1b'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x1c')]);router['get'](_0x7bd8('0x1d'),auth[_0x7bd8('0xa')](),controller['getScreenRecordings']);router[_0x7bd8('0xb')]('/:id/chat/interactions',auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x1e')]);router[_0x7bd8('0xb')]('/:id/openchannel/interactions',auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x1f')]);router[_0x7bd8('0xb')](_0x7bd8('0x20'),auth['isAuthenticated'](),controller[_0x7bd8('0x21')]);router['get']('/:id/sms/interactions',auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x22')]);router[_0x7bd8('0xb')](_0x7bd8('0x23'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x24')]);router['get'](_0x7bd8('0x25'),auth[_0x7bd8('0xa')](),controller['getWhatsappInteractions']);router[_0x7bd8('0xb')](_0x7bd8('0x26'),auth[_0x7bd8('0xa')](),controller['getTeams']);router[_0x7bd8('0xb')](_0x7bd8('0x27'),auth[_0x7bd8('0xa')](),controller['getLists']);router[_0x7bd8('0xb')](_0x7bd8('0x28'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x29')]);router['get']('/:id/prefixes',auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x2a')]);router[_0x7bd8('0xb')](_0x7bd8('0x2b'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x2c')]);router[_0x7bd8('0xb')](_0x7bd8('0x2d'),auth['isAuthenticated'](),controller[_0x7bd8('0x2e')]);router['get'](_0x7bd8('0x2f'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get'](_0x7bd8('0x30'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x31')]);router[_0x7bd8('0xb')](_0x7bd8('0x32'),auth[_0x7bd8('0xa')](),controller['getChatWebsites']);router[_0x7bd8('0xb')]('/:id/whatsapp_accounts',auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x33')]);router[_0x7bd8('0xb')](_0x7bd8('0x34'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x35')]);router['get'](_0x7bd8('0x36'),auth[_0x7bd8('0xa')](),controller['getApiKey']);router[_0x7bd8('0x37')](_0x7bd8('0x16'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x38')]);router[_0x7bd8('0x37')]('/',auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x39')]);router[_0x7bd8('0x37')](_0x7bd8('0x3a'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x3b')]);router[_0x7bd8('0x37')](_0x7bd8('0x17'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x7bd8('0x3c')]({'destination':function(_0x102034,_0x201859,_0x537329){_0x537329(null,path[_0x7bd8('0x3d')](config[_0x7bd8('0x3e')],_0x7bd8('0x3f')));},'filename':function(_0x5b3b5e,_0x49ed0b,_0x32f11d){_0x32f11d(null,util['format'](_0x7bd8('0x40'),Date['now'](),_0x49ed0b[_0x7bd8('0x41')]));}})});router[_0x7bd8('0x37')](_0x7bd8('0x42'),upload[_0x7bd8('0x43')](_0x7bd8('0x44')),controller[_0x7bd8('0x45')]);router[_0x7bd8('0x37')](_0x7bd8('0x46'),auth['isAuthenticated'](),controller['login']);router[_0x7bd8('0x37')]('/:id/logout',auth['isAuthenticated'](),controller[_0x7bd8('0x47')]);router[_0x7bd8('0x37')](_0x7bd8('0x48'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x49')]);router['post'](_0x7bd8('0x4a'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x4b')]);router[_0x7bd8('0x37')](_0x7bd8('0x26'),auth['isAuthenticated'](),controller['addTeams']);router[_0x7bd8('0x37')](_0x7bd8('0x4c'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x4d')]);router[_0x7bd8('0x37')](_0x7bd8('0x4e'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x4f')]);router[_0x7bd8('0x37')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x7bd8('0x50')]);router['post'](_0x7bd8('0x51'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0x7bd8('0x37')]('/:id/openchannel_interactions',auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x52')]);router['post']('/:id/whatsapp_interactions',auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x53')]);router[_0x7bd8('0x37')](_0x7bd8('0x2b'),auth[_0x7bd8('0xa')](),controller['addFaxAccounts']);router[_0x7bd8('0x37')](_0x7bd8('0x2d'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x54')]);router['post']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x7bd8('0x55')]);router[_0x7bd8('0x37')](_0x7bd8('0x30'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x56')]);router[_0x7bd8('0x37')](_0x7bd8('0x32'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x57')]);router[_0x7bd8('0x37')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x7bd8('0x58')]);router[_0x7bd8('0x37')]('/:id/api_key',auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x59')]);router[_0x7bd8('0x5a')](_0x7bd8('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x7bd8('0x5a')](_0x7bd8('0x5b'),auth['isAuthenticated'](),controller[_0x7bd8('0x5c')]);router[_0x7bd8('0x5d')](_0x7bd8('0x17'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x5e')]);router['delete'](_0x7bd8('0x26'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x5f')]);router[_0x7bd8('0x5d')](_0x7bd8('0x12'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x60')]);router[_0x7bd8('0x5d')](_0x7bd8('0x4c'),auth[_0x7bd8('0xa')](),controller['removeChatInteractions']);router['delete'](_0x7bd8('0x4e'),auth['isAuthenticated'](),controller[_0x7bd8('0x61')]);router[_0x7bd8('0x5d')](_0x7bd8('0x62'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x63')]);router[_0x7bd8('0x5d')](_0x7bd8('0x51'),auth['isAuthenticated'](),controller[_0x7bd8('0x64')]);router['delete'](_0x7bd8('0x65'),auth['isAuthenticated'](),controller[_0x7bd8('0x66')]);router[_0x7bd8('0x5d')](_0x7bd8('0x67'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x68')]);router[_0x7bd8('0x5d')](_0x7bd8('0x2b'),auth[_0x7bd8('0xa')](),controller['removeFaxAccounts']);router[_0x7bd8('0x5d')](_0x7bd8('0x2d'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x69')]);router[_0x7bd8('0x5d')](_0x7bd8('0x2f'),auth['isAuthenticated'](),controller[_0x7bd8('0x6a')]);router[_0x7bd8('0x5d')](_0x7bd8('0x30'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x6b')]);router[_0x7bd8('0x5d')](_0x7bd8('0x32'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x6c')]);router[_0x7bd8('0x5d')](_0x7bd8('0x6d'),auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x6e')]);router[_0x7bd8('0x5d')]('/:id/api_key',auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x6f')]);router['post']('/:id/messengerSoundNotification',auth[_0x7bd8('0xa')](),controller[_0x7bd8('0x70')]);module[_0x7bd8('0x71')]=router; \ No newline at end of file +var _0x37c7=['get','isAuthenticated','index','/describe','describe','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','addQueues','diskStorage','format','now','single','file','addAvatar','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','update','changePassword','delete','/:id/queues','removeQueues','/:id/teams','removeTeams','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x37c7,0xda));var _0x737c=function(_0x34ca5a,_0x2f14b1){_0x34ca5a=_0x34ca5a-0x0;var _0x38c2be=_0x37c7[_0x34ca5a];return _0x38c2be;};'use strict';var multer=require(_0x737c('0x0'));var util=require('util');var path=require(_0x737c('0x1'));var timeout=require(_0x737c('0x2'));var express=require(_0x737c('0x3'));var router=express[_0x737c('0x4')]();var fs_extra=require(_0x737c('0x5'));var auth=require(_0x737c('0x6'));var interaction=require(_0x737c('0x7'));var config=require(_0x737c('0x8'));var controller=require(_0x737c('0x9'));router[_0x737c('0xa')]('/',auth[_0x737c('0xb')](),controller[_0x737c('0xc')]);router[_0x737c('0xa')](_0x737c('0xd'),auth[_0x737c('0xb')](),controller[_0x737c('0xe')]);router[_0x737c('0xa')]('/whoami',auth[_0x737c('0xb')](),controller['whoami']);router[_0x737c('0xa')]('/presence',auth[_0x737c('0xb')](),controller['getPresence']);router[_0x737c('0xa')](_0x737c('0xf'),auth[_0x737c('0xb')](),controller[_0x737c('0x10')]);router[_0x737c('0xa')]('/:id/avatar',controller[_0x737c('0x11')]);router[_0x737c('0xa')](_0x737c('0x12'),auth[_0x737c('0xb')](),controller[_0x737c('0x13')]);router['get'](_0x737c('0x14'),auth['isAuthenticated'](),controller[_0x737c('0x15')]);router[_0x737c('0xa')]('/:id/queues',auth['isAuthenticated'](),controller[_0x737c('0x16')]);router[_0x737c('0xa')](_0x737c('0x17'),auth['isAuthenticated'](),controller[_0x737c('0x18')]);router[_0x737c('0xa')]('/:id/groups',auth[_0x737c('0xb')](),controller[_0x737c('0x19')]);router[_0x737c('0xa')](_0x737c('0x1a'),auth[_0x737c('0xb')](),controller['getRecordings']);router[_0x737c('0xa')](_0x737c('0x1b'),auth[_0x737c('0xb')](),controller[_0x737c('0x1c')]);router[_0x737c('0xa')](_0x737c('0x1d'),auth[_0x737c('0xb')](),controller[_0x737c('0x1e')]);router[_0x737c('0xa')](_0x737c('0x1f'),auth['isAuthenticated'](),controller[_0x737c('0x20')]);router[_0x737c('0xa')]('/:id/mail/interactions',auth[_0x737c('0xb')](),controller[_0x737c('0x21')]);router[_0x737c('0xa')](_0x737c('0x22'),auth[_0x737c('0xb')](),controller['getSmsInteractions']);router['get'](_0x737c('0x23'),auth[_0x737c('0xb')](),controller[_0x737c('0x24')]);router['get'](_0x737c('0x25'),auth[_0x737c('0xb')](),controller['getWhatsappInteractions']);router[_0x737c('0xa')]('/:id/teams',auth[_0x737c('0xb')](),controller[_0x737c('0x26')]);router[_0x737c('0xa')](_0x737c('0x27'),auth[_0x737c('0xb')](),controller[_0x737c('0x28')]);router[_0x737c('0xa')](_0x737c('0x29'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0x737c('0x2a'),auth['isAuthenticated'](),controller[_0x737c('0x2b')]);router['get'](_0x737c('0x2c'),auth['isAuthenticated'](),controller[_0x737c('0x2d')]);router[_0x737c('0xa')](_0x737c('0x2e'),auth[_0x737c('0xb')](),controller[_0x737c('0x2f')]);router[_0x737c('0xa')]('/:id/openchannel_accounts',auth[_0x737c('0xb')](),controller[_0x737c('0x30')]);router[_0x737c('0xa')](_0x737c('0x31'),auth[_0x737c('0xb')](),controller[_0x737c('0x32')]);router[_0x737c('0xa')](_0x737c('0x33'),auth[_0x737c('0xb')](),controller['getChatWebsites']);router[_0x737c('0xa')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x737c('0x34')]);router['get'](_0x737c('0x35'),auth[_0x737c('0xb')](),controller[_0x737c('0x36')]);router['get'](_0x737c('0x37'),auth[_0x737c('0xb')](),controller[_0x737c('0x38')]);router[_0x737c('0x39')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x737c('0x3a')]);router[_0x737c('0x39')]('/',auth[_0x737c('0xb')](),controller[_0x737c('0x3b')]);router['post'](_0x737c('0x3c'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x737c('0x39')]('/:id/queues',auth[_0x737c('0xb')](),controller[_0x737c('0x3d')]);var upload=multer({'storage':multer[_0x737c('0x3e')]({'destination':function(_0x3d2bda,_0xae1b3a,_0x21c352){_0x21c352(null,path['join'](config['root'],'server/files/images/'));},'filename':function(_0x149e9d,_0x32de4b,_0xdd9464){_0xdd9464(null,util[_0x737c('0x3f')]('%s-%s',Date[_0x737c('0x40')](),_0x32de4b['originalname']));}})});router['post']('/:id/avatar',upload[_0x737c('0x41')](_0x737c('0x42')),controller[_0x737c('0x43')]);router['post']('/:id/login',auth[_0x737c('0xb')](),controller['login']);router[_0x737c('0x39')]('/:id/logout',auth[_0x737c('0xb')](),controller[_0x737c('0x44')]);router[_0x737c('0x39')](_0x737c('0x45'),auth[_0x737c('0xb')](),controller[_0x737c('0x46')]);router['post'](_0x737c('0x47'),auth[_0x737c('0xb')](),controller[_0x737c('0x48')]);router['post']('/:id/teams',auth[_0x737c('0xb')](),controller['addTeams']);router[_0x737c('0x39')](_0x737c('0x49'),auth[_0x737c('0xb')](),controller[_0x737c('0x4a')]);router[_0x737c('0x39')](_0x737c('0x4b'),auth['isAuthenticated'](),controller[_0x737c('0x4c')]);router[_0x737c('0x39')](_0x737c('0x4d'),auth[_0x737c('0xb')](),controller[_0x737c('0x4e')]);router[_0x737c('0x39')](_0x737c('0x4f'),auth[_0x737c('0xb')](),controller[_0x737c('0x50')]);router[_0x737c('0x39')](_0x737c('0x51'),auth[_0x737c('0xb')](),controller[_0x737c('0x52')]);router[_0x737c('0x39')](_0x737c('0x53'),auth[_0x737c('0xb')](),controller[_0x737c('0x54')]);router[_0x737c('0x39')](_0x737c('0x2c'),auth[_0x737c('0xb')](),controller[_0x737c('0x55')]);router[_0x737c('0x39')](_0x737c('0x2e'),auth[_0x737c('0xb')](),controller[_0x737c('0x56')]);router[_0x737c('0x39')](_0x737c('0x57'),auth[_0x737c('0xb')](),controller['addOpenchannelAccounts']);router[_0x737c('0x39')](_0x737c('0x31'),auth[_0x737c('0xb')](),controller['addSmsAccounts']);router[_0x737c('0x39')](_0x737c('0x33'),auth['isAuthenticated'](),controller[_0x737c('0x58')]);router['post'](_0x737c('0x59'),auth[_0x737c('0xb')](),controller[_0x737c('0x5a')]);router[_0x737c('0x39')](_0x737c('0x37'),auth[_0x737c('0xb')](),controller[_0x737c('0x5b')]);router[_0x737c('0x5c')](_0x737c('0xf'),auth[_0x737c('0xb')](),controller[_0x737c('0x5d')]);router[_0x737c('0x5c')]('/:id/password',auth[_0x737c('0xb')](),controller[_0x737c('0x5e')]);router[_0x737c('0x5f')](_0x737c('0x60'),auth[_0x737c('0xb')](),controller[_0x737c('0x61')]);router[_0x737c('0x5f')](_0x737c('0x62'),auth['isAuthenticated'](),controller[_0x737c('0x63')]);router[_0x737c('0x5f')](_0x737c('0xf'),auth[_0x737c('0xb')](),controller['destroy']);router['delete'](_0x737c('0x49'),auth['isAuthenticated'](),controller[_0x737c('0x64')]);router[_0x737c('0x5f')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x737c('0x65')]);router[_0x737c('0x5f')]('/:id/fax_interactions',auth[_0x737c('0xb')](),controller[_0x737c('0x66')]);router[_0x737c('0x5f')](_0x737c('0x4f'),auth[_0x737c('0xb')](),controller[_0x737c('0x67')]);router[_0x737c('0x5f')](_0x737c('0x51'),auth[_0x737c('0xb')](),controller[_0x737c('0x68')]);router[_0x737c('0x5f')](_0x737c('0x53'),auth['isAuthenticated'](),controller[_0x737c('0x69')]);router[_0x737c('0x5f')](_0x737c('0x2c'),auth[_0x737c('0xb')](),controller[_0x737c('0x6a')]);router[_0x737c('0x5f')](_0x737c('0x2e'),auth[_0x737c('0xb')](),controller['removeMailAccounts']);router['delete']('/:id/openchannel_accounts',auth[_0x737c('0xb')](),controller[_0x737c('0x6b')]);router[_0x737c('0x5f')](_0x737c('0x31'),auth[_0x737c('0xb')](),controller[_0x737c('0x6c')]);router[_0x737c('0x5f')](_0x737c('0x33'),auth[_0x737c('0xb')](),controller[_0x737c('0x6d')]);router['delete']('/:id/whatsapp_accounts',auth[_0x737c('0xb')](),controller[_0x737c('0x6e')]);router['delete']('/:id/api_key',auth['isAuthenticated'](),controller[_0x737c('0x6f')]);router[_0x737c('0x39')]('/:id/messengerSoundNotification',auth[_0x737c('0xb')](),controller[_0x737c('0x70')]);module[_0x737c('0x71')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 0402bf5..841e686 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 _0xd69d=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','accept','refuse','originate','uas','certificate','passive','actpass','update,nonat','DATE','showWebBar','get','transport','wss','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','icesupport','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','ENUM','admin','user','local','INTEGER','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','nonat','update','outgoing','yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow'];(function(_0x2c6810,_0x23c079){var _0x213881=function(_0x528021){while(--_0x528021){_0x2c6810['push'](_0x2c6810['shift']());}};_0x213881(++_0x23c079);}(_0xd69d,0xd9));var _0xdd69=function(_0x412e02,_0x280754){_0x412e02=_0x412e02-0x0;var _0x29f758=_0xd69d[_0x412e02];return _0x29f758;};'use strict';var Sequelize=require(_0xdd69('0x0'));var moment=require(_0xdd69('0x1'));var util=require(_0xdd69('0x2'));var _=require(_0xdd69('0x3'));module[_0xdd69('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdd69('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x53a78e){this[_0xdd69('0x6')](_0xdd69('0x5'),_0x53a78e);this[_0xdd69('0x6')]('defaultuser',_0x53a78e);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xdd69('0x7')],'allowNull':![],'set':function(_0x4fa424){this[_0xdd69('0x6')](_0xdd69('0x8'),_0x4fa424);this['setDataValue'](_0xdd69('0x9'),util[_0xdd69('0xa')](_0xdd69('0xb'),_0x4fa424,this['getDataValue'](_0xdd69('0xc'))));}},'alias':{'type':Sequelize[_0xdd69('0x7')]},'email':{'type':Sequelize[_0xdd69('0x7')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x255cd7){if(_0x255cd7){this['setDataValue']('email',_0x255cd7['toLowerCase']());}}},'role':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0xe'),_0xdd69('0xf'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xdd69('0x7')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xdd69('0x7')],'defaultValue':_0xdd69('0x10')},'internal':{'type':Sequelize[_0xdd69('0x11')](0xb),'allowNull':![],'unique':_0xdd69('0xc'),'set':function(_0x26f170){this[_0xdd69('0x6')](_0xdd69('0xc'),_0x26f170);this['setDataValue']('accountcode',_0x26f170);this['setDataValue'](_0xdd69('0x9'),util[_0xdd69('0xa')]('\x22%s\x22\x20<%s>',this['getDataValue']('fullname'),_0x26f170));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xdd69('0x7')]},'mobile':{'type':Sequelize[_0xdd69('0x7')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xdd69('0x7')]},'userpic':{'type':Sequelize[_0xdd69('0x7')]},'city':{'type':Sequelize[_0xdd69('0x7')]},'country':{'type':Sequelize[_0xdd69('0x7')]},'online':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xdd69('0x7')],'defaultValue':_0xdd69('0x13')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xdd69('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xdd69('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xdd69('0x11')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xdd69('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xdd69('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xdd69('0x14')},'ipaddr':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xdd69('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xdd69('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x15'),_0xdd69('0xf'),_0xdd69('0x16')),'allowNull':!![],'defaultValue':_0xdd69('0x15')},'context':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![],'defaultValue':_0xdd69('0x17')},'callingpres':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x18'),_0xdd69('0x19'),'ALLOWED_FAILED_SCREEN',_0xdd69('0x1a'),_0xdd69('0x1b'),_0xdd69('0x1c'),_0xdd69('0x1d'),_0xdd69('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![],'defaultValue':_0xdd69('0x1f'),'set':function(_0x1958b6){this[_0xdd69('0x6')]('transport',_0x1958b6?_0x1958b6[_0xdd69('0x20')](','):null);},'get':function(){return this[_0xdd69('0x21')]('transport')?this[_0xdd69('0x21')]('transport')['split'](','):null;},'comment':_0xdd69('0x22')},'dtmfmode':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x23'),_0xdd69('0x24'),'shortinfo',_0xdd69('0x25'),_0xdd69('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0xdd69('0x27'),_0xdd69('0x28'),_0xdd69('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'nat':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x162d26){this[_0xdd69('0x6')](_0xdd69('0x2b'),_0x162d26?_0x162d26['join'](','):null);},'get':function(){return this[_0xdd69('0x21')](_0xdd69('0x2b'))?this[_0xdd69('0x21')](_0xdd69('0x2b'))['split'](','):null;},'comment':_0xdd69('0x2c')},'callgroup':{'type':Sequelize[_0xdd69('0x7')]},'namedcallgroup':{'type':Sequelize[_0xdd69('0x7')]},'pickupgroup':{'type':Sequelize[_0xdd69('0x7')]},'namedpickupgroup':{'type':Sequelize[_0xdd69('0x7')]},'language':{'type':Sequelize[_0xdd69('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xdd69('0x7')]},'disallow':{'type':Sequelize[_0xdd69('0x7')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xdd69('0x7')],'allowNull':![],'defaultValue':_0xdd69('0x2d'),'set':function(_0x47871f){this[_0xdd69('0x6')](_0xdd69('0x2e'),_0x47871f?_0x47871f['join'](';'):_0xdd69('0x2d'));},'get':function(){return this['getDataValue'](_0xdd69('0x2e'))?this['getDataValue'](_0xdd69('0x2e'))[_0xdd69('0x2f')](';'):null;},'comment':_0xdd69('0x30')},'autoframing':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![],'set':function(_0x3e9bf9){this[_0xdd69('0x6')](_0xdd69('0x31'),_0x3e9bf9?_0x3e9bf9[_0xdd69('0x20')](','):null);},'get':function(){return this[_0xdd69('0x21')]('insecure')?this[_0xdd69('0x21')]('insecure')['split'](','):null;},'comment':_0xdd69('0x32')},'trustrpid':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xdd69('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xdd69('0x2a'),'no',_0xdd69('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xdd69('0xd')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xdd69('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![],'defaultValue':_0xdd69('0x34')},'amaflags':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xdd69('0x2a'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xdd69('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'template':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x2a'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xdd69('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x35'),_0xdd69('0x36'),_0xdd69('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xdd69('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xdd69('0x11')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xdd69('0xd')]('uac',_0xdd69('0x38')),'allowNull':!![],'defaultValue':_0xdd69('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xdd69('0x2a')},'keepalive':{'type':Sequelize[_0xdd69('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xdd69('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xdd69('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xdd69('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xdd69('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xdd69('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdd69('0xd')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xdd69('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0xdd69('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xdd69('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xdd69('0xd')]('active',_0xdd69('0x3a'),_0xdd69('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xdd69('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xdd69('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xdd69('0x7')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xdd69('0xd')](_0xdd69('0x2a'),'no',_0xdd69('0x27'),_0xdd69('0x28'),_0xdd69('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xdd69('0x7')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xdd69('0x3d')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0xdb97ab){this['setDataValue'](_0xdd69('0x3e'),_0xdb97ab);var _0x40c46c=this[_0xdd69('0x3f')]({'plain':!![]});switch(_0xdb97ab){case 0x0:case 0x1:var _0x32df45=_0x40c46c[_0xdd69('0x40')]?_['isArray'](_0x40c46c['transport'])?_0x40c46c[_0xdd69('0x40')]['join']():_0x40c46c[_0xdd69('0x40')]:'udp';if(_0x32df45===_0xdd69('0x41')){_0x32df45=_0xdd69('0x1f');}this[_0xdd69('0x6')](_0xdd69('0x40'),_0x32df45);this[_0xdd69('0x6')](_0xdd69('0x42'),'no');this[_0xdd69('0x6')](_0xdd69('0x43'),null);this[_0xdd69('0x6')](_0xdd69('0x44'),null);this[_0xdd69('0x6')]('icesupport',null);this[_0xdd69('0x6')](_0xdd69('0x45'),null);this['setDataValue'](_0xdd69('0x46'),null);this[_0xdd69('0x6')](_0xdd69('0x47'),null);this['setDataValue'](_0xdd69('0x48'),null);this[_0xdd69('0x6')](_0xdd69('0x49'),null);this[_0xdd69('0x6')]('rtcp_mux','no');break;case 0x2:this[_0xdd69('0x6')](_0xdd69('0x40'),_0xdd69('0x41'));this[_0xdd69('0x6')](_0xdd69('0x42'),_0xdd69('0x2a'));this[_0xdd69('0x6')](_0xdd69('0x43'),_0xdd69('0x2a'));this[_0xdd69('0x6')](_0xdd69('0x44'),_0xdd69('0x2a'));this[_0xdd69('0x6')](_0xdd69('0x4a'),_0xdd69('0x2a'));this['setDataValue'](_0xdd69('0x45'),_0xdd69('0x2a'));this[_0xdd69('0x6')](_0xdd69('0x46'),'no');this[_0xdd69('0x6')](_0xdd69('0x47'),_0xdd69('0x3b'));this[_0xdd69('0x6')](_0xdd69('0x48'),_0x40c46c[_0xdd69('0x48')]||_0xdd69('0x4b'));this[_0xdd69('0x6')](_0xdd69('0x49'),_0x40c46c[_0xdd69('0x49')]||_0xdd69('0x4c'));this['setDataValue']('rtcp_mux',_0xdd69('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0xdd69('0x4d')],'set':function(_0x300d81){this[_0xdd69('0x6')]('permissions',_0x300d81?_0x300d81[_0xdd69('0x20')](','):[]);},'get':function(){return this[_0xdd69('0x21')]('permissions')?_['map'](this['getDataValue'](_0xdd69('0x4e'))[_0xdd69('0x2f')](','),function(_0x144bdb){return parseInt(_0x144bdb,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xdd69('0x7')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xdd69('0x7')]},'phoneBarBusyNumber':{'type':Sequelize[_0xdd69('0x7')]},'phoneBarUnconditional':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xdd69('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xdd69('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xdd69('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xdd69('0x4f')],'get':function(){return this[_0xdd69('0x21')](_0xdd69('0x50'))?this[_0xdd69('0x21')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x116885){if(typeof _0x116885===_0xdd69('0x51')){var _0x397232=_0x116885==='1'?!![]:_0x116885==='0'?![]:_0x116885===_0xdd69('0x52')?!![]:_0x116885===_0xdd69('0x53')?![]:![];this[_0xdd69('0x6')](_0xdd69('0x54'),_0x397232);}else{this['setDataValue'](_0xdd69('0x54'),_0x116885);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x41e636){this[_0xdd69('0x6')]('blocked',_0x41e636);if(_0x41e636===!![]){this['setDataValue'](_0xdd69('0x55'),moment());this[_0xdd69('0x6')](_0xdd69('0x56'),0x0);}else{this[_0xdd69('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xdd69('0x3d')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xdd69('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xdd69('0x11')](0x5)[_0xdd69('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xdd69('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xdd69('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xdd69('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xdd69('0x11')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xdd69('0x12')],'defaultValue':![]}}; \ No newline at end of file +var _0xb81d=['ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','update','outgoing','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','active','passive','actpass','TEXT','showWebBar','get','isArray','udp','wss','encryption','avpf','icesupport','dtlscertfile','dtlsprivatekey','force_avp','dtlsverify','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','util','exports','name','setDataValue','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','getDataValue','internal','email','toLowerCase','admin','user','telephone','local','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN'];(function(_0xd8f7bd,_0x45dc8c){var _0x1bd5ee=function(_0x20498e){while(--_0x20498e){_0xd8f7bd['push'](_0xd8f7bd['shift']());}};_0x1bd5ee(++_0x45dc8c);}(_0xb81d,0x1aa));var _0xdb81=function(_0x34d7c9,_0x5b1e6e){_0x34d7c9=_0x34d7c9-0x0;var _0x2cc2c2=_0xb81d[_0x34d7c9];return _0x2cc2c2;};'use strict';var Sequelize=require(_0xdb81('0x0'));var moment=require('moment');var util=require(_0xdb81('0x1'));var _=require('lodash');module[_0xdb81('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdb81('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xe57815){this['setDataValue']('name',_0xe57815);this[_0xdb81('0x4')]('defaultuser',_0xe57815);},'comment':_0xdb81('0x5')},'fullname':{'type':Sequelize[_0xdb81('0x6')],'allowNull':![],'set':function(_0x2f095e){this[_0xdb81('0x4')](_0xdb81('0x7'),_0x2f095e);this[_0xdb81('0x4')](_0xdb81('0x8'),util[_0xdb81('0x9')]('\x22%s\x22\x20<%s>',_0x2f095e,this[_0xdb81('0xa')](_0xdb81('0xb'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xdb81('0x6')],'allowNull':![],'unique':_0xdb81('0xc'),'validate':{'isEmail':!![]},'set':function(_0x4e6c7a){if(_0x4e6c7a){this['setDataValue'](_0xdb81('0xc'),_0x4e6c7a[_0xdb81('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0xdb81('0xe'),_0xdb81('0xf'),'agent',_0xdb81('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0xdb81('0x6')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xdb81('0x6')],'defaultValue':_0xdb81('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xdb81('0xb'),'set':function(_0x373bf0){this[_0xdb81('0x4')](_0xdb81('0xb'),_0x373bf0);this[_0xdb81('0x4')]('accountcode',_0x373bf0);this[_0xdb81('0x4')](_0xdb81('0x8'),util[_0xdb81('0x9')]('\x22%s\x22\x20<%s>',this['getDataValue'](_0xdb81('0x7')),_0x373bf0));}},'salt':{'type':Sequelize[_0xdb81('0x6')]},'phone':{'type':Sequelize[_0xdb81('0x6')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xdb81('0x6')]},'zipcode':{'type':Sequelize[_0xdb81('0x6')]},'userpic':{'type':Sequelize[_0xdb81('0x6')]},'city':{'type':Sequelize[_0xdb81('0x6')]},'country':{'type':Sequelize[_0xdb81('0x6')]},'online':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xdb81('0x13')]},'voicePause':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xdb81('0x6')],'defaultValue':_0xdb81('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xdb81('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xdb81('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xdb81('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xdb81('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xdb81('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xdb81('0x16')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xdb81('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xdb81('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xdb81('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xdb81('0x17')](_0xdb81('0x18'),_0xdb81('0xf'),_0xdb81('0x19')),'allowNull':!![],'defaultValue':_0xdb81('0x18')},'context':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![],'defaultValue':_0xdb81('0x1a')},'callingpres':{'type':Sequelize['ENUM'](_0xdb81('0x1b'),_0xdb81('0x1c'),'ALLOWED_FAILED_SCREEN',_0xdb81('0x1d'),_0xdb81('0x1e'),_0xdb81('0x1f'),_0xdb81('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'permit':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'secret':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![],'defaultValue':'udp','set':function(_0x45cfec){this[_0xdb81('0x4')](_0xdb81('0x21'),_0x45cfec?_0x45cfec['join'](','):null);},'get':function(){return this['getDataValue'](_0xdb81('0x21'))?this[_0xdb81('0xa')](_0xdb81('0x21'))[_0xdb81('0x22')](','):null;},'comment':_0xdb81('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0xdb81('0x24'),_0xdb81('0x25'),_0xdb81('0x26'),_0xdb81('0x27'),'auto'),'allowNull':!![],'defaultValue':_0xdb81('0x24')},'directmedia':{'type':Sequelize['ENUM'](_0xdb81('0x28'),'no',_0xdb81('0x29'),_0xdb81('0x2a'),_0xdb81('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xdb81('0x17')](_0xdb81('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x2c0586){this['setDataValue'](_0xdb81('0x2c'),_0x2c0586?_0x2c0586[_0xdb81('0x2d')](','):null);},'get':function(){return this[_0xdb81('0xa')](_0xdb81('0x2c'))?this[_0xdb81('0xa')](_0xdb81('0x2c'))[_0xdb81('0x22')](','):null;},'comment':_0xdb81('0x2e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xdb81('0x6')]},'pickupgroup':{'type':Sequelize[_0xdb81('0x6')]},'namedpickupgroup':{'type':Sequelize[_0xdb81('0x6')]},'language':{'type':Sequelize[_0xdb81('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xdb81('0x6')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdb81('0x2f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdb81('0x30'),'set':function(_0x9bca78){this[_0xdb81('0x4')]('allow',_0x9bca78?_0x9bca78[_0xdb81('0x2d')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xdb81('0xa')](_0xdb81('0x31'))?this[_0xdb81('0xa')](_0xdb81('0x31'))[_0xdb81('0x22')](';'):null;},'comment':_0xdb81('0x32')},'autoframing':{'type':Sequelize[_0xdb81('0x17')](_0xdb81('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![],'set':function(_0x358410){this[_0xdb81('0x4')](_0xdb81('0x33'),_0x358410?_0x358410[_0xdb81('0x2d')](','):null);},'get':function(){return this[_0xdb81('0xa')]('insecure')?this[_0xdb81('0xa')]('insecure')[_0xdb81('0x22')](','):null;},'comment':_0xdb81('0x34')},'trustrpid':{'type':Sequelize['ENUM'](_0xdb81('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xdb81('0x17')](_0xdb81('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xdb81('0x17')](_0xdb81('0x28'),'no',_0xdb81('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xdb81('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xdb81('0x17')](_0xdb81('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xdb81('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![],'defaultValue':_0xdb81('0x36')},'amaflags':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xdb81('0x17')]('yes','no'),'allowNull':!![],'defaultValue':_0xdb81('0x28')},'busylevel':{'type':Sequelize[_0xdb81('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xdb81('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xdb81('0x17')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xdb81('0x17')](_0xdb81('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xdb81('0x17')](_0xdb81('0x28'),'no',_0xdb81('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xdb81('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xdb81('0x17')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xdb81('0x17')](_0xdb81('0x38'),_0xdb81('0x39'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xdb81('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xdb81('0x3a'),_0xdb81('0x3b')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xdb81('0x17')]('yes','no'),'allowNull':!![],'defaultValue':_0xdb81('0x28')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xdb81('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xdb81('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xdb81('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xdb81('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xdb81('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xdb81('0x17')](_0xdb81('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdb81('0x17')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xdb81('0x17')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xdb81('0x17')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xdb81('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xdb81('0x17')](_0xdb81('0x28'),'no',_0xdb81('0x3c'),_0xdb81('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xdb81('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xdb81('0x17')](_0xdb81('0x3e'),_0xdb81('0x3f'),_0xdb81('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xdb81('0x17')](_0xdb81('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xdb81('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xdb81('0x17')](_0xdb81('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xdb81('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xdb81('0x28'),'no','nonat',_0xdb81('0x2a'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xdb81('0x6')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xdb81('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xdb81('0x41')]},'showWebBar':{'type':Sequelize[_0xdb81('0x15')],'defaultValue':0x0,'set':function(_0x5df048){this['setDataValue'](_0xdb81('0x42'),_0x5df048);var _0x3b8b62=this[_0xdb81('0x43')]({'plain':!![]});switch(_0x5df048){case 0x0:case 0x1:var _0x3d139d=_0x3b8b62['transport']?_[_0xdb81('0x44')](_0x3b8b62[_0xdb81('0x21')])?_0x3b8b62[_0xdb81('0x21')][_0xdb81('0x2d')]():_0x3b8b62['transport']:_0xdb81('0x45');if(_0x3d139d===_0xdb81('0x46')){_0x3d139d=_0xdb81('0x45');}this['setDataValue'](_0xdb81('0x21'),_0x3d139d);this[_0xdb81('0x4')](_0xdb81('0x47'),'no');this[_0xdb81('0x4')](_0xdb81('0x48'),null);this['setDataValue']('force_avp',null);this[_0xdb81('0x4')](_0xdb81('0x49'),null);this[_0xdb81('0x4')]('dtlsenable',null);this['setDataValue']('dtlsverify',null);this[_0xdb81('0x4')]('dtlssetup',null);this[_0xdb81('0x4')](_0xdb81('0x4a'),null);this[_0xdb81('0x4')](_0xdb81('0x4b'),null);this[_0xdb81('0x4')]('rtcp_mux','no');break;case 0x2:this[_0xdb81('0x4')](_0xdb81('0x21'),_0xdb81('0x46'));this[_0xdb81('0x4')](_0xdb81('0x47'),_0xdb81('0x28'));this['setDataValue']('avpf','yes');this[_0xdb81('0x4')](_0xdb81('0x4c'),'yes');this[_0xdb81('0x4')](_0xdb81('0x49'),'yes');this[_0xdb81('0x4')]('dtlsenable',_0xdb81('0x28'));this[_0xdb81('0x4')](_0xdb81('0x4d'),'no');this[_0xdb81('0x4')]('dtlssetup',_0xdb81('0x40'));this[_0xdb81('0x4')]('dtlscertfile',_0x3b8b62['dtlscertfile']||_0xdb81('0x4e'));this[_0xdb81('0x4')](_0xdb81('0x4b'),_0x3b8b62[_0xdb81('0x4b')]||_0xdb81('0x4f'));this[_0xdb81('0x4')](_0xdb81('0x50'),_0xdb81('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0xdb81('0x41')],'set':function(_0x366107){this[_0xdb81('0x4')](_0xdb81('0x51'),_0x366107?_0x366107[_0xdb81('0x2d')](','):[]);},'get':function(){return this[_0xdb81('0xa')]('permissions')?_[_0xdb81('0x52')](this[_0xdb81('0xa')](_0xdb81('0x51'))['split'](','),function(_0x2dadc5){return parseInt(_0x2dadc5,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xdb81('0x6')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xdb81('0x6')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xdb81('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xdb81('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xdb81('0x17')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xdb81('0x6')]},'phoneBarEnableJaws':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xdb81('0x53')],'get':function(){return this[_0xdb81('0xa')]('phoneBarEnableScreenRecordingByAgent')?this[_0xdb81('0xa')](_0xdb81('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xdb81('0x6')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xdb81('0x6')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x14a342){if(typeof _0x14a342==='string'){var _0x5063ae=_0x14a342==='1'?!![]:_0x14a342==='0'?![]:_0x14a342===_0xdb81('0x55')?!![]:_0x14a342===_0xdb81('0x56')?![]:![];this['setDataValue'](_0xdb81('0x57'),_0x5063ae);}else{this[_0xdb81('0x4')](_0xdb81('0x57'),_0x14a342);}}},'blocked':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![],'set':function(_0x5ab4ba){this[_0xdb81('0x4')](_0xdb81('0x58'),_0x5ab4ba);if(_0x5ab4ba===!![]){this['setDataValue'](_0xdb81('0x59'),moment());this[_0xdb81('0x4')](_0xdb81('0x5a'),0x0);}else{this[_0xdb81('0x4')](_0xdb81('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0xdb81('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xdb81('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xdb81('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xdb81('0x15')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xdb81('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xdb81('0x15')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xdb81('0x12')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 72b8a55..c170d2d 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 _0xa1f1=['connection','transaction','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','getChannels','forEach','PAUSE','LOGININPAUSE','YYYY-MM-DD\x20HH:mm:ss','isMiddleware','resolve','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','smsPause','whatsappPause','pauseType','lastPauseAt','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','getLists','getAgents','values','CmHopper','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','removeWhatsappAccounts','getScheduledCalls','$and','$gt','$lt','$lte','$ne','$between','$in','$notIn','$notLike','$iLike','$overlap','$contains','$contained','firstName','CmContact','Contact','dialActive','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','apiKeyIat','API\x20key\x20not\x20available','whoami','send','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','unknown','ringing','teams','queues','inbound','flatten','col','asc','desc','substring','uniqBy','orderBy','offline','voiceStatus','unavailable','busy','slice','charAt','field','ui.','InteractionId','ui.createdAt','OpenTabs','messengerSoundNotification','enabled','moment','util','ioredis','jayson/promise','../../components/auth/service','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','APIForbiddenrror','handleError','../../mysqldb','redis','register','defaults','localhost','http','sendStatus','json','offset','undefined','limit','count','status','set','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','agent','emit','userNotification:recalc:','get','role','Users','user','Agents','Telephones','telephone','filter','map','value','includes','find','name','UserProfileResource','destroy','end','stack','User','type','key','password','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','includeAll','include','userSetting','true','attributes','findAll','rows','query','openTabs','length','chat','dataValues','sms','push','fax','mail','openchannel','whatsapp','all','show','params','getOptions','UserSetting','body','describe','addContacts','ids','omit','internal','findById','validatePasswordPattern','min_internal','isNil','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','101','102','113','110','105','106','108','109','100','111','114','115','create','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','compact','changePassword','oldPassword','ValidationError','Sequelize','Wrong\x20credentials','newPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','securePassword','enforcePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','isValidChannel','add','capitalize','toLowerCase','penalty','Queue:save','VoiceQueue','voice','interface','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','Unknown\x20channel','remove','Queues','isArray','QueueId','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','WhatsappOpenTabs','WHATSAPP','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tags','color','tag','getQueues','model','keys','Queue','rawAttributes','filters','intersection','fields','sort','pick','where','merge','Unknown\x20role','getVoiceQueuesRt','order','options','nolimit','getGroups','getRecordings','VoiceRecording','UserId','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','WhatsappInteraction','getWhatsappInteractions','phone','LOCAL/%s@from-sip/n','intrf','user:%s','headers','x-forwarded-for','socket','remoteAddress'];(function(_0x4e0909,_0x2ef17f){var _0x59f69b=function(_0x258f1b){while(--_0x258f1b){_0x4e0909['push'](_0x4e0909['shift']());}};_0x59f69b(++_0x2ef17f);}(_0xa1f1,0x93));var _0x1a1f=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0xa1f1[_0x355ce8];return _0x1db8b8;};'use strict';var moment=require(_0x1a1f('0x0'));var util=require(_0x1a1f('0x1'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require('squel');var Redis=require(_0x1a1f('0x2'));var jayson=require(_0x1a1f('0x3'));var authService=require(_0x1a1f('0x4'));var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var rta=require(_0x1a1f('0x5'));var logger=require(_0x1a1f('0x6'))(_0x1a1f('0x7'));var utils=require(_0x1a1f('0x8'));var config=require(_0x1a1f('0x9'));var licenseUtil=require(_0x1a1f('0xa'));var APIBadRequestError=require(_0x1a1f('0xb'))[_0x1a1f('0xc')];var APINotFoundError=require(_0x1a1f('0xb'))[_0x1a1f('0xd')];var APIForbiddenError=require('../../errors/api')[_0x1a1f('0xe')];var APIHandleError=require(_0x1a1f('0xb'))[_0x1a1f('0xf')];var db=require(_0x1a1f('0x10'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x1a1f('0x11')]));require('./user.socket')[_0x1a1f('0x12')](socket);config[_0x1a1f('0x11')]=_[_0x1a1f('0x13')](config['redis'],{'host':_0x1a1f('0x14'),'port':0x18eb});var amiClient=jayson['client'][_0x1a1f('0x15')]({'port':0x232a});var values;function respondWithStatusCode(_0x2d2b68,_0x8b6b9e){_0x8b6b9e=_0x8b6b9e||0xcc;return function(_0x54a9ff){if(_0x54a9ff){return _0x2d2b68[_0x1a1f('0x16')](_0x8b6b9e);}return _0x2d2b68['status'](_0x8b6b9e)['end']();};}function respondWithResult(_0x37e70d,_0x2ca165){_0x2ca165=_0x2ca165||0xc8;return function(_0x46fc01){if(_0x46fc01){return _0x37e70d['status'](_0x2ca165)[_0x1a1f('0x17')](_0x46fc01);}};}function respondWithFilteredResult(_0x317202,_0x4425b7){return function(_0x467247){if(_0x467247){var _0x5e050b=typeof _0x4425b7[_0x1a1f('0x18')]===_0x1a1f('0x19')&&typeof _0x4425b7[_0x1a1f('0x1a')]==='undefined';var _0x618fc3=_0x467247['count'];var _0x19cf1c=_0x5e050b?0x0:_0x4425b7['offset'];var _0x104737=_0x5e050b?_0x467247[_0x1a1f('0x1b')]:_0x4425b7[_0x1a1f('0x18')]+_0x4425b7[_0x1a1f('0x1a')];var _0x586f27;if(_0x104737>=_0x618fc3){_0x104737=_0x618fc3;_0x586f27=0xc8;}else{_0x586f27=0xce;}_0x317202[_0x1a1f('0x1c')](_0x586f27);return _0x317202[_0x1a1f('0x1d')]('Content-Range',_0x19cf1c+'-'+_0x104737+'/'+_0x618fc3)[_0x1a1f('0x17')](_0x467247);}return null;};}function respondWithRpcPromise(_0x2d2f7d,_0xdbe00b,_0x399634,_0x35ea7e){return new Promise(function(_0x237cad,_0x5eb191){var _0x4d9156=_0x35ea7e||amiClient;return _0x4d9156[_0x1a1f('0x1e')](_0x2d2f7d,_0x399634)[_0x1a1f('0x1f')](function(_0x4235e4){logger[_0x1a1f('0x20')](_0x1a1f('0x21'),_0xdbe00b,_0x1a1f('0x22'));logger['debug'](_0x1a1f('0x23'),_0xdbe00b,_0x1a1f('0x22'),JSON[_0x1a1f('0x24')](_0x4235e4));if(_0x4235e4[_0x1a1f('0x25')]){if(_0x4235e4[_0x1a1f('0x25')][_0x1a1f('0x26')]===0x1f4){logger[_0x1a1f('0x25')](_0x1a1f('0x21'),_0xdbe00b,_0x4235e4['error'][_0x1a1f('0x27')]);return _0x5eb191(_0x4235e4['error']['message']);}logger[_0x1a1f('0x25')](_0x1a1f('0x21'),_0xdbe00b,_0x4235e4[_0x1a1f('0x25')]['message']);return _0x237cad(_0x4235e4[_0x1a1f('0x25')][_0x1a1f('0x27')]);}else{logger[_0x1a1f('0x20')](_0x1a1f('0x21'),_0xdbe00b,_0x1a1f('0x22'));_0x237cad(_0x4235e4[_0x1a1f('0x28')][_0x1a1f('0x27')]);}})[_0x1a1f('0x29')](function(_0x5f2259){logger[_0x1a1f('0x25')](_0x1a1f('0x21'),_0xdbe00b,_0x5f2259);_0x5eb191(_0x5f2259);});});}function saveUpdates(_0x143cd0){return function(_0x56d351){if(_0x56d351){return _0x56d351[_0x1a1f('0x2a')](_0x143cd0)[_0x1a1f('0x1f')](function(_0x157f18){if(_0x157f18['role']===_0x1a1f('0x2b')){socket[_0x1a1f('0x2c')](_0x1a1f('0x2d')+_0x157f18['id'],_0x157f18);}return _0x157f18;});}return null;};}function removeEntity(_0x4e35ae,_0x470552){return function(_0x3d6f62){if(_0x3d6f62){return _0x3d6f62['destroy']({'transaction':_0x470552})[_0x1a1f('0x1f')](function(){var _0x12ed62=_0x3d6f62[_0x1a1f('0x2e')]({'plain':!![]});if(_0x12ed62[_0x1a1f('0x2f')]==='admin')return;var _0x14c464=[{'name':_0x1a1f('0x30'),'value':_0x1a1f('0x31'),'ignore':!![]},{'name':_0x1a1f('0x32'),'value':_0x1a1f('0x2b'),'ignore':![]},{'name':_0x1a1f('0x33'),'value':_0x1a1f('0x34'),'ignore':![]}];var _0x3b64f6=_(_0x14c464)[_0x1a1f('0x35')]('ignore')[_0x1a1f('0x36')](_0x1a1f('0x37'))['value']();if(_[_0x1a1f('0x38')](_0x3b64f6,_0x12ed62[_0x1a1f('0x2f')])){return;}var _0x34625a=_[_0x1a1f('0x39')](_0x14c464,[_0x1a1f('0x37'),_0x12ed62[_0x1a1f('0x2f')]])[_0x1a1f('0x3a')];return db[_0x1a1f('0x3b')][_0x1a1f('0x3c')]({'where':{'type':_0x34625a,'resourceId':_0x12ed62['id']},'transaction':_0x470552})[_0x1a1f('0x1f')](function(){return _0x3d6f62;});})[_0x1a1f('0x1f')](function(){_0x4e35ae[_0x1a1f('0x1c')](0xcc)[_0x1a1f('0x3d')]();});}};}function handleEntityNotFound(_0x47deac){return function(_0x557284){if(!_0x557284){_0x47deac[_0x1a1f('0x16')](0x194);}return _0x557284;};}function handleError(_0x140a9d,_0x2ff2ff){_0x2ff2ff=_0x2ff2ff||0x1f4;return function(_0xc1f77d){logger[_0x1a1f('0x25')](_0xc1f77d[_0x1a1f('0x3e')]);if(_0xc1f77d['name']){delete _0xc1f77d[_0x1a1f('0x3a')];}_0x140a9d['status'](_0x2ff2ff)['send'](_0xc1f77d);};}function getUserAttributes(){return _(db[_0x1a1f('0x3f')]['rawAttributes'])[_0x1a1f('0x36')](function(_0x4269c8){return{'name':_0x4269c8['fieldName'],'type':_0x4269c8[_0x1a1f('0x40')][_0x1a1f('0x41')]};})[_0x1a1f('0x35')](function(_0x51622f){return![_0x1a1f('0x42'),'salt',_0x1a1f('0x43'),_0x1a1f('0x44'),_0x1a1f('0x45'),_0x1a1f('0x46')][_0x1a1f('0x38')](_0x51622f[_0x1a1f('0x3a')]);})['value']();}exports['index']=function(_0x584789,_0x107876){var _0x3c7a59={},_0x4581ba={'count':0x0,'rows':[]};var _0x1a5283=getUserAttributes();_0x3c7a59=qs['getOptions'](_0x1a5283,_0x584789);var _0x2891a9={'where':_0x3c7a59['where']};return db[_0x1a1f('0x3f')][_0x1a1f('0x1b')](_0x2891a9)[_0x1a1f('0x1f')](function(_0x557195){_0x4581ba[_0x1a1f('0x1b')]=_0x557195;if(_0x584789['query'][_0x1a1f('0x47')]){_0x3c7a59[_0x1a1f('0x48')]=[{'all':!![]}];}if(_0x584789['query'][_0x1a1f('0x49')]===_0x1a1f('0x4a')){_0x3c7a59[_0x1a1f('0x48')]=[{'model':db['UserSetting'],'as':_0x1a1f('0x49')}];}if(!_[_0x1a1f('0x38')](_0x3c7a59[_0x1a1f('0x4b')],'id')){_0x3c7a59[_0x1a1f('0x4b')]['push']('id');}return db[_0x1a1f('0x3f')][_0x1a1f('0x4c')](_0x3c7a59);})[_0x1a1f('0x1f')](function(_0x5e2756){_0x4581ba[_0x1a1f('0x4d')]=_0x5e2756;if(_0x584789[_0x1a1f('0x4e')][_0x1a1f('0x4f')]===_0x1a1f('0x4a')){var _0x5ddf37=[];for(var _0x192048=0x0;_0x192048<_0x4581ba['rows'][_0x1a1f('0x50')];_0x192048++){_0x5ddf37['push'](get_open_tabs(_0x1a1f('0x51'),_0x4581ba['rows'][_0x192048][_0x1a1f('0x52')]));_0x5ddf37['push'](get_open_tabs(_0x1a1f('0x53'),_0x4581ba['rows'][_0x192048][_0x1a1f('0x52')]));_0x5ddf37[_0x1a1f('0x54')](get_open_tabs(_0x1a1f('0x55'),_0x4581ba[_0x1a1f('0x4d')][_0x192048][_0x1a1f('0x52')]));_0x5ddf37['push'](get_open_tabs(_0x1a1f('0x56'),_0x4581ba[_0x1a1f('0x4d')][_0x192048]['dataValues']));_0x5ddf37[_0x1a1f('0x54')](get_open_tabs(_0x1a1f('0x57'),_0x4581ba['rows'][_0x192048][_0x1a1f('0x52')]));_0x5ddf37[_0x1a1f('0x54')](get_open_tabs(_0x1a1f('0x58'),_0x4581ba[_0x1a1f('0x4d')][_0x192048][_0x1a1f('0x52')]));}return Promise[_0x1a1f('0x59')](_0x5ddf37)[_0x1a1f('0x1f')](function(){return _0x4581ba;});}else{return _0x4581ba;}})[_0x1a1f('0x1f')](respondWithFilteredResult(_0x107876,_0x3c7a59))['catch'](handleError(_0x107876,null));};exports[_0x1a1f('0x5a')]=function(_0xac80a0,_0xf65cdb){var _0x455a31=getUserAttributes();_0xac80a0['query']['id']=_0xac80a0[_0x1a1f('0x5b')]['id'];var _0xb8d204=qs[_0x1a1f('0x5c')](_0x455a31,_0xac80a0);if(_0xac80a0['query']['includeAll']){_0xb8d204[_0x1a1f('0x48')]=[{'all':!![]}];}if(_0xac80a0['query'][_0x1a1f('0x49')]==='true'){_0xb8d204['include']=[{'model':db[_0x1a1f('0x5d')],'as':'userSetting'}];}_0xb8d204=_['merge']({},_0xb8d204,_0xac80a0['options']);if(!_[_0x1a1f('0x38')](_0xb8d204['attributes'],'id')){_0xb8d204[_0x1a1f('0x4b')]['push']('id');}return db[_0x1a1f('0x3f')][_0x1a1f('0x39')](_0xb8d204)[_0x1a1f('0x1f')](handleEntityNotFound(_0xf65cdb,null))[_0x1a1f('0x1f')](function(_0x3601cc){var _0x4fb0eb=[];values=_0x3601cc;if(_0xac80a0[_0x1a1f('0x4e')][_0x1a1f('0x4f')]===_0x1a1f('0x4a')){_0x4fb0eb[_0x1a1f('0x54')](get_open_tabs(_0x1a1f('0x51'),_0x3601cc[_0x1a1f('0x52')]));_0x4fb0eb[_0x1a1f('0x54')](get_open_tabs(_0x1a1f('0x53'),_0x3601cc[_0x1a1f('0x52')]));_0x4fb0eb[_0x1a1f('0x54')](get_open_tabs(_0x1a1f('0x57'),_0x3601cc[_0x1a1f('0x52')]));_0x4fb0eb[_0x1a1f('0x54')](get_open_tabs(_0x1a1f('0x58'),_0x3601cc[_0x1a1f('0x52')]));_0x4fb0eb[_0x1a1f('0x54')](get_open_tabs(_0x1a1f('0x55'),_0x3601cc[_0x1a1f('0x52')]));_0x4fb0eb[_0x1a1f('0x54')](get_open_tabs(_0x1a1f('0x56'),_0x3601cc[_0x1a1f('0x52')]));return Promise['all'](_0x4fb0eb);}else{return values;}})[_0x1a1f('0x1f')](function(){return values;})[_0x1a1f('0x1f')](respondWithResult(_0xf65cdb,null))[_0x1a1f('0x29')](handleError(_0xf65cdb,null));};exports['update']=function(_0x3969a3,_0xe54793){if(_0x3969a3[_0x1a1f('0x5e')]['id']){delete _0x3969a3[_0x1a1f('0x5e')]['id'];}delete _0x3969a3[_0x1a1f('0x5e')][_0x1a1f('0x2f')];return db[_0x1a1f('0x3f')][_0x1a1f('0x39')]({'where':{'id':_0x3969a3[_0x1a1f('0x5b')]['id']}})[_0x1a1f('0x1f')](handleEntityNotFound(_0xe54793,null))['then'](saveUpdates(_0x3969a3['body'],null))[_0x1a1f('0x1f')](respondWithResult(_0xe54793,null))[_0x1a1f('0x29')](handleError(_0xe54793,null));};exports[_0x1a1f('0x5f')]=function(_0x1a6019,_0x360810){return db[_0x1a1f('0x3f')][_0x1a1f('0x5f')]()[_0x1a1f('0x1f')](respondWithResult(_0x360810,null))[_0x1a1f('0x29')](handleError(_0x360810,null));};exports['addContacts']=function(_0x549b39,_0x34c766){return db[_0x1a1f('0x3f')][_0x1a1f('0x39')]({'where':{'id':_0x549b39[_0x1a1f('0x5b')]['id']}})[_0x1a1f('0x1f')](handleEntityNotFound(_0x34c766,null))[_0x1a1f('0x1f')](function(_0x2ca79e){if(_0x2ca79e){return _0x2ca79e[_0x1a1f('0x60')](_0x549b39['body'][_0x1a1f('0x61')],_[_0x1a1f('0x62')](_0x549b39[_0x1a1f('0x5e')],[_0x1a1f('0x61'),'id'])||{});}})[_0x1a1f('0x1f')](respondWithResult(_0x34c766,null))['catch'](handleError(_0x34c766,null));};function validateUser(_0x3c0404){return new Promise(function(_0x5e02e4,_0x23776a){if(_0x3c0404[_0x1a1f('0x63')])return _0x5e02e4(_0x3c0404);return db['Setting'][_0x1a1f('0x64')](0x1)[_0x1a1f('0x1f')](function(_0x5b122c){if(_0x5b122c['securePassword'])authService[_0x1a1f('0x65')](_0x3c0404[_0x1a1f('0x42')]);db[_0x1a1f('0x3f')]['max']('internal')['then'](function(_0x354a40){if(_['isNil'](_0x354a40)){_0x3c0404['internal']=_0x5b122c[_0x1a1f('0x66')]||0x1;return;}if(_[_0x1a1f('0x67')](_0x5b122c[_0x1a1f('0x66')])||_0x5b122c[_0x1a1f('0x66')]===_0x354a40){_0x3c0404['internal']=_0x354a40+0x1;return;}if(_0x5b122c['min_internal']>_0x354a40){_0x3c0404[_0x1a1f('0x63')]=_0x5b122c['min_internal'];return;}return db[_0x1a1f('0x68')]['query'](_0x1a1f('0x69'),{'type':db[_0x1a1f('0x68')][_0x1a1f('0x6a')][_0x1a1f('0x6b')]})['then'](function(_0x5f015b){if(_0x5f015b&&_0x5f015b['length']){for(var _0xfa05fa=0x0,_0x189689=_0x5f015b[_0x1a1f('0x50')];_0xfa05fa<_0x189689&&_[_0x1a1f('0x67')](_0x3c0404[_0x1a1f('0x63')]);_0xfa05fa++){if(_0x5b122c[_0x1a1f('0x66')]<=_0x5f015b[_0xfa05fa]['from']){_0x3c0404[_0x1a1f('0x63')]=_0x5f015b[_0xfa05fa][_0x1a1f('0x6c')];}else if(_0x5b122c[_0x1a1f('0x66')]>_0x5f015b[_0xfa05fa]['from']&&_0x5b122c[_0x1a1f('0x66')]<=_0x5f015b[_0xfa05fa]['to']){_0x3c0404[_0x1a1f('0x63')]=_0x5b122c[_0x1a1f('0x66')];}}}if(_[_0x1a1f('0x67')](_0x3c0404[_0x1a1f('0x63')])){_0x3c0404[_0x1a1f('0x63')]=_0x354a40+0x1;}return _0x5e02e4(_0x3c0404);});});})[_0x1a1f('0x29')](function(_0x1a9b43){_0x23776a(_0x1a9b43);});});}function updateUser(_0x1b1fd7){return new Promise(function(_0x5e2f5e,_0x410bf6){try{if(_0x1b1fd7[_0x1a1f('0x6d')]){_0x1b1fd7[_0x1a1f('0x6e')]=_0x1b1fd7[_0x1a1f('0x63')];_0x1b1fd7[_0x1a1f('0x6f')]={'mailbox':_0x1b1fd7['internal'],'password':_0x1b1fd7['password'],'fullname':_0x1b1fd7[_0x1a1f('0x70')],'email':_0x1b1fd7[_0x1a1f('0x71')]};}if(_0x1b1fd7['role']===_0x1a1f('0x2b')){if(!_0x1b1fd7['permissions'])_0x1b1fd7['permissions']=[_0x1a1f('0x72'),_0x1a1f('0x73'),'103',_0x1a1f('0x74'),_0x1a1f('0x75'),'104',_0x1a1f('0x76'),_0x1a1f('0x77'),'107',_0x1a1f('0x78'),_0x1a1f('0x79'),_0x1a1f('0x7a'),_0x1a1f('0x7b'),_0x1a1f('0x7c'),_0x1a1f('0x7d')];}_0x5e2f5e(_0x1b1fd7);}catch(_0xb5ff77){_0x410bf6(_0xb5ff77);}});}exports[_0x1a1f('0x7e')]=function(_0x8d4976,_0x24a4c6){if(_0x8d4976['user'][_0x1a1f('0x2f')]===_0x1a1f('0x2b'))throw new Error(_0x1a1f('0x7f'));if(_0x8d4976[_0x1a1f('0x5e')]['role']===_0x1a1f('0x31')&&_0x8d4976[_0x1a1f('0x31')][_0x1a1f('0x2f')]!==_0x1a1f('0x80')){throw new Error(_0x1a1f('0x81'));}if(_0x8d4976[_0x1a1f('0x5e')][_0x1a1f('0x2f')]===_0x1a1f('0x80')&&_0x8d4976[_0x1a1f('0x31')]['role']!==_0x1a1f('0x80')){throw new Error(_0x1a1f('0x82'));}return licenseUtil[_0x1a1f('0x83')]([_0x8d4976[_0x1a1f('0x5e')]])[_0x1a1f('0x1f')](function(){return validateUser(_0x8d4976[_0x1a1f('0x5e')]);})['then'](function(_0x661205){return updateUser(_0x661205)[_0x1a1f('0x1f')](function(_0x203ece){if(_0x203ece[_0x1a1f('0x2f')]==='admin'){_0x203ece['settingsEnabled']=_0x8d4976[_0x1a1f('0x31')][_0x1a1f('0x84')];delete _0x203ece[_0x1a1f('0x85')];}return _0x203ece;});})[_0x1a1f('0x1f')](function(_0x1d480){return db[_0x1a1f('0x3f')][_0x1a1f('0x7e')](_0x1d480,{'include':[{'model':db['VoiceMail'],'as':_0x1a1f('0x6f')}]});})['then'](function(_0xe0b578){if(_0x8d4976[_0x1a1f('0x5e')][_0x1a1f('0x2f')]===_0x1a1f('0x31'))return _0xe0b578;if(_0x8d4976['user'][_0x1a1f('0x2f')]!==_0x1a1f('0x31'))return _0xe0b578;return db[_0x1a1f('0x86')][_0x1a1f('0x39')]({'where':{'name':_0xe0b578[_0x1a1f('0x2f')]===_0x1a1f('0x2b')?_0x1a1f('0x32'):'Telephones','userProfileId':_0x8d4976['user'][_0x1a1f('0x85')]},'raw':!![]})[_0x1a1f('0x1f')](function(_0xf03b42){if(!_0xf03b42||_0xf03b42[_0x1a1f('0x87')]!=0x0)return _0xe0b578;return db[_0x1a1f('0x3b')]['create']({'name':_0xe0b578['name'],'resourceId':_0xe0b578['id'],'type':_0xf03b42['name'],'sectionId':_0xf03b42['id']},{})[_0x1a1f('0x1f')](function(){return _0xe0b578;});})[_0x1a1f('0x29')](function(_0x3b0a23){logger[_0x1a1f('0x25')](_0x1a1f('0x88'),_0x3b0a23);throw _0x3b0a23;});})[_0x1a1f('0x1f')](respondWithResult(_0x24a4c6,0xc9))[_0x1a1f('0x29')](handleError(_0x24a4c6,null));};exports[_0x1a1f('0x89')]=function(_0x4d0226,_0x327169){var _0x58304d=_0x4d0226[_0x1a1f('0x5e')];var _0x3f2a5e=[];if(_0x4d0226[_0x1a1f('0x31')][_0x1a1f('0x2f')]===_0x1a1f('0x2b'))throw new Error(_0x1a1f('0x7f'));if(_[_0x1a1f('0x8a')](_0x58304d,[_0x1a1f('0x2f'),_0x1a1f('0x31')])&&_0x4d0226[_0x1a1f('0x31')]['role']!==_0x1a1f('0x80')){throw new Error(_0x1a1f('0x81'));}if(_[_0x1a1f('0x8a')](_0x58304d,['role',_0x1a1f('0x80')])&&_0x4d0226[_0x1a1f('0x31')][_0x1a1f('0x2f')]!==_0x1a1f('0x80')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x1a1f('0x83')](_0x58304d)[_0x1a1f('0x1f')](function(){return validateUser(_0x58304d[0x0]);})[_0x1a1f('0x1f')](function(){for(var _0x6d0c6d=0x1;_0x6d0c6d<_0x58304d[_0x1a1f('0x50')];_0x6d0c6d++){var _0x4e8205=_0x58304d[_0x6d0c6d-0x1][_0x1a1f('0x63')];if(!_0x58304d[_0x6d0c6d][_0x1a1f('0x63')])_0x58304d[_0x6d0c6d][_0x1a1f('0x63')]=_0x4e8205+0x1;_0x3f2a5e[_0x1a1f('0x54')](validateUser(_0x58304d[_0x6d0c6d]));}return Promise[_0x1a1f('0x59')](_0x3f2a5e);})[_0x1a1f('0x1f')](function(){_0x3f2a5e=[];for(var _0x3e3abf=0x0;_0x3e3abf<_0x58304d[_0x1a1f('0x50')];_0x3e3abf++){_0x3f2a5e[_0x1a1f('0x54')](updateUser(_0x58304d[_0x3e3abf]));}return Promise[_0x1a1f('0x59')](_0x3f2a5e);})['then'](function(){_0x3f2a5e=_0x58304d['map'](function(_0x37ab66){return db[_0x1a1f('0x3f')]['create'](_0x37ab66,{'include':[{'model':db[_0x1a1f('0x6f')],'as':'VoiceMail'}]})[_0x1a1f('0x1f')](function(_0x38ec25){_0x37ab66['id']=_0x38ec25['id'];return _0x37ab66;});});return Promise[_0x1a1f('0x59')](_0x3f2a5e);})['then'](function(_0x5407dc){if(_0x4d0226[_0x1a1f('0x5e')][_0x1a1f('0x2f')]===_0x1a1f('0x31'))return _0x5407dc;if(_0x4d0226['user'][_0x1a1f('0x2f')]!==_0x1a1f('0x31'))return _0x5407dc;var _0x45d18d=_[_0x1a1f('0x8a')](_0x5407dc,function(_0x4820be){return _0x4820be[_0x1a1f('0x2f')]===_0x1a1f('0x2b')||_0x4820be[_0x1a1f('0x2f')]===_0x1a1f('0x34');});if(!_0x45d18d)return _0x5407dc;return db[_0x1a1f('0x86')][_0x1a1f('0x4c')]({'where':{'name':{'$or':['Agents',_0x1a1f('0x33')]},'userProfileId':_0x4d0226[_0x1a1f('0x31')][_0x1a1f('0x85')]},'raw':!![]})['then'](function(_0x2c1fec){if(_['isEmpty'](_0x2c1fec)||!_[_0x1a1f('0x8a')](_0x2c1fec,['autoAssociation',0x0]))return _0x5407dc;_0x3f2a5e=[];var _0x3b2c7e=_(_0x2c1fec)[_0x1a1f('0x36')](function(_0x33e361){if(_0x33e361[_0x1a1f('0x87')]===0x1)return;return _0x33e361[_0x1a1f('0x3a')]===_0x1a1f('0x32')?'agent':_0x1a1f('0x34');})[_0x1a1f('0x8b')]()['value']();for(var _0x5eac4f=0x0;_0x5eac4f<_0x5407dc['length'];_0x5eac4f++){if(!_['includes'](_0x3b2c7e,_0x5407dc[_0x5eac4f][_0x1a1f('0x2f')]))return;var _0x34f44a=_0x5407dc[_0x5eac4f][_0x1a1f('0x2f')]==='agent'?'Agents':_0x1a1f('0x33');_0x3f2a5e[_0x1a1f('0x54')](db[_0x1a1f('0x3b')][_0x1a1f('0x7e')]({'name':_0x5407dc[_0x5eac4f][_0x1a1f('0x3a')],'resourceId':_0x5407dc[_0x5eac4f]['id'],'type':_0x34f44a,'sectionId':_[_0x1a1f('0x39')](_0x2c1fec,[_0x1a1f('0x3a'),_0x34f44a])['id']},{}));}return Promise[_0x1a1f('0x59')](_0x3f2a5e);});})[_0x1a1f('0x1f')](respondWithResult(_0x327169,0xc9))[_0x1a1f('0x29')](handleError(_0x327169,null));};exports[_0x1a1f('0x8c')]=function(_0x5d7708,_0xbae286){if(_0x5d7708[_0x1a1f('0x5e')]['id']){delete _0x5d7708['body']['id'];}return db[_0x1a1f('0x3f')]['find']({'where':{'id':_0x5d7708[_0x1a1f('0x5b')]['id']}})[_0x1a1f('0x1f')](function(_0x254d1b){if(!_0x254d1b)return null;if(_0x254d1b['id']===_0x5d7708[_0x1a1f('0x31')]['id']){if(!_0x5d7708['body'][_0x1a1f('0x8d')]||!_0x5d7708[_0x1a1f('0x5e')]['newPassword']){throw new db['Sequelize'][(_0x1a1f('0x8e'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x254d1b['authenticate'](_0x5d7708[_0x1a1f('0x5e')]['oldPassword'])){throw new db[(_0x1a1f('0x8f'))]['ValidationError'](_0x1a1f('0x90'));}if(_0x5d7708[_0x1a1f('0x5e')][_0x1a1f('0x8d')]===_0x5d7708[_0x1a1f('0x5e')][_0x1a1f('0x91')]){throw new db[(_0x1a1f('0x8f'))][(_0x1a1f('0x8e'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x5d7708[_0x1a1f('0x31')][_0x1a1f('0x2f')]===_0x1a1f('0x80')){if(!_0x5d7708[_0x1a1f('0x5e')][_0x1a1f('0x91')]){throw new db[(_0x1a1f('0x8f'))][(_0x1a1f('0x8e'))](_0x1a1f('0x92'));}}else if(_0x5d7708[_0x1a1f('0x31')][_0x1a1f('0x2f')]===_0x1a1f('0x31')){if(!_0x5d7708[_0x1a1f('0x5e')]['newPassword']){throw new db[(_0x1a1f('0x8f'))][(_0x1a1f('0x8e'))](_0x1a1f('0x92'));}if(_0x254d1b[_0x1a1f('0x2f')]!=='agent'){throw new db[(_0x1a1f('0x8f'))][(_0x1a1f('0x8e'))](_0x1a1f('0x7f'));}}else{throw new db[(_0x1a1f('0x8f'))][(_0x1a1f('0x8e'))](_0x1a1f('0x7f'));}return _0x254d1b;})[_0x1a1f('0x1f')](handleEntityNotFound(_0xbae286,null))['then'](function(_0x57640b){return db['Setting'][_0x1a1f('0x93')]({'attributes':['id',_0x1a1f('0x94'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x1a1f('0x1f')](function(_0x5b0d78){if(_0x5b0d78['securePassword'])authService[_0x1a1f('0x65')](_0x5d7708[_0x1a1f('0x5e')][_0x1a1f('0x91')]);if(!_0x5b0d78[_0x1a1f('0x95')]||!_0x57640b['previousPasswords'])return _0x57640b;authService['validatePasswordHistory'](_0x5d7708[_0x1a1f('0x5e')]['newPassword'],_0x57640b[_0x1a1f('0x43')],_0x5b0d78[_0x1a1f('0x96')]);return _0x57640b;})[_0x1a1f('0x1f')](saveUpdates({'password':_0x5d7708[_0x1a1f('0x5e')][_0x1a1f('0x91')],'passwordResetAt':_0x5d7708['user']['id']==_0x5d7708[_0x1a1f('0x5b')]['id']?moment():null,'previousPasswords':authService[_0x1a1f('0x97')](_0x5d7708[_0x1a1f('0x5e')][_0x1a1f('0x91')],_0x57640b[_0x1a1f('0x43')])},null));})['then'](respondWithResult(_0xbae286,null))[_0x1a1f('0x29')](handleError(_0xbae286,null));};exports[_0x1a1f('0x98')]=function(_0x5588c0,_0xe3a436){var _0x5ce4f8=_0x5588c0[_0x1a1f('0x5e')][_0x1a1f('0x99')];return db[_0x1a1f('0x3f')][_0x1a1f('0x39')]({'where':{'id':_0x5588c0['params']['id']},'attributes':['id',_0x1a1f('0x3a'),'role',_0x1a1f('0x9a'),_0x1a1f('0x9b'),_0x1a1f('0x9c'),'interface']})[_0x1a1f('0x1f')](handleEntityNotFound(_0xe3a436,null))[_0x1a1f('0x1f')](function(_0x2b8fe8){if(_0x2b8fe8){if(!utils[_0x1a1f('0x9d')](_0x5ce4f8)){throw new db['Sequelize'][(_0x1a1f('0x8e'))]('Unknown\x20channel');}return _0x2b8fe8[_0x1a1f('0x9e')+_[_0x1a1f('0x9f')](_0x5ce4f8[_0x1a1f('0xa0')]())+'Queues'](_0x5588c0[_0x1a1f('0x5e')][_0x1a1f('0x61')],{'penalty':_0x5588c0[_0x1a1f('0x5e')][_0x1a1f('0xa1')]||0x0})['spread'](function(_0x257f18){for(var _0x57a29e=0x0;_0x57a29e<_0x5588c0[_0x1a1f('0x5e')][_0x1a1f('0x61')][_0x1a1f('0x50')];_0x57a29e+=0x1){var _0x115aa8={'UserId':Number(_0x5588c0['params']['id'])};_0x115aa8[_[_0x1a1f('0x9f')](_0x5ce4f8[_0x1a1f('0xa0')]())+'QueueId']=Number(_0x5588c0[_0x1a1f('0x5e')][_0x1a1f('0x61')][_0x57a29e]);socket['emit'](_0x1a1f('0x31')+_[_0x1a1f('0x9f')](_0x5ce4f8[_0x1a1f('0xa0')]())+_0x1a1f('0xa2'),_0x115aa8);}return _0x257f18;})['then'](function(){if(_0x5ce4f8==='voice'){return db[_0x1a1f('0xa3')][_0x1a1f('0x4c')]({'where':{'id':_0x5588c0[_0x1a1f('0x5e')][_0x1a1f('0x61')]||[]},'raw':!![],'attributes':['id',_0x1a1f('0x3a')]});}})[_0x1a1f('0x1f')](function(_0x1800bb){var _0x1cdfa6=_0x2b8fe8['get']({'plain':!![]});var _0x38d595=[];if(_0x5ce4f8===_0x1a1f('0xa4')&&_0x1cdfa6[_0x1a1f('0x2f')]===_0x1a1f('0x2b')&&_0x1cdfa6[_0x1a1f('0x9a')]){for(let _0x188078=0x0;_0x188078<_0x1800bb[_0x1a1f('0x50')];_0x188078+=0x1){_0x38d595[_0x1a1f('0x54')]({'membername':_0x1cdfa6[_0x1a1f('0x3a')],'UserId':_0x1cdfa6['id'],'queue_name':_0x1800bb[_0x188078]['name'],'VoiceQueueId':_0x1800bb[_0x188078]['id'],'interface':_['isNil'](_0x1cdfa6[_0x1a1f('0xa5')])?util[_0x1a1f('0xa6')](_0x1a1f('0xa7'),_0x1cdfa6[_0x1a1f('0x3a')]):_0x1cdfa6[_0x1a1f('0xa5')],'paused':_0x1cdfa6['voicePause']||![],'penalty':_0x5588c0[_0x1a1f('0x5e')][_0x1a1f('0xa1')]||0x0});}return Promise[_0x1a1f('0x59')](_0x38d595[_0x1a1f('0x36')](function(_0x8eb8d9){return db[_0x1a1f('0xa8')][_0x1a1f('0xa9')](_0x8eb8d9);}));}return _0x2b8fe8;});}})[_0x1a1f('0x1f')](respondWithStatusCode(_0xe3a436,null))['catch'](handleError(_0xe3a436,null));};exports[_0x1a1f('0xaa')]=function(_0x512b5a,_0x34739f){var _0x21d5b7,_0x2aa308;return db[_0x1a1f('0x3f')][_0x1a1f('0x39')]({'where':{'id':_0x512b5a[_0x1a1f('0x5b')]['id']},'attributes':['id',_0x1a1f('0x3a'),'role']})[_0x1a1f('0x1f')](handleEntityNotFound(_0x34739f,null))['then'](function(_0xe8a45e){if(_0xe8a45e){_0x21d5b7=_0xe8a45e;if(!_0x512b5a[_0x1a1f('0x4e')]['channel']||!utils[_0x1a1f('0x9d')](_0x512b5a['query'][_0x1a1f('0x99')])){throw new db[(_0x1a1f('0x8f'))]['ValidationError'](_0x1a1f('0xab'));}return _0xe8a45e[_0x1a1f('0xac')+_[_0x1a1f('0x9f')](_0x512b5a[_0x1a1f('0x4e')][_0x1a1f('0x99')][_0x1a1f('0xa0')]())+_0x1a1f('0xad')](_0x512b5a[_0x1a1f('0x4e')]['ids']);}})[_0x1a1f('0x1f')](function(_0x25b869){if(_[_0x1a1f('0xae')](_0x512b5a['query'][_0x1a1f('0x61')])){for(var _0x10c870=0x0;_0x10c870<_0x512b5a[_0x1a1f('0x4e')][_0x1a1f('0x61')]['length'];_0x10c870+=0x1){_0x2aa308={'UserId':Number(_0x512b5a['params']['id'])};_0x2aa308[_[_0x1a1f('0x9f')](_0x512b5a[_0x1a1f('0x4e')][_0x1a1f('0x99')][_0x1a1f('0xa0')]())+_0x1a1f('0xaf')]=Number(_0x512b5a[_0x1a1f('0x4e')][_0x1a1f('0x61')][_0x10c870]);socket['emit'](_0x1a1f('0x31')+_[_0x1a1f('0x9f')](_0x512b5a[_0x1a1f('0x4e')][_0x1a1f('0x99')]['toLowerCase']())+_0x1a1f('0xb0'),_0x2aa308);}}else{_0x2aa308={'UserId':Number(_0x512b5a[_0x1a1f('0x5b')]['id'])};_0x2aa308[_['capitalize'](_0x512b5a[_0x1a1f('0x4e')][_0x1a1f('0x99')]['toLowerCase']())+_0x1a1f('0xaf')]=Number(_0x512b5a[_0x1a1f('0x4e')][_0x1a1f('0x61')]);socket[_0x1a1f('0x2c')](_0x1a1f('0x31')+_[_0x1a1f('0x9f')](_0x512b5a[_0x1a1f('0x4e')][_0x1a1f('0x99')][_0x1a1f('0xa0')]())+_0x1a1f('0xb0'),_0x2aa308);}return _0x25b869;})[_0x1a1f('0x1f')](function(){if(_0x512b5a[_0x1a1f('0x4e')][_0x1a1f('0x99')]===_0x1a1f('0xa4')){return db[_0x1a1f('0xa8')][_0x1a1f('0x3c')]({'where':{'UserId':_0x512b5a['params']['id'],'VoiceQueueId':_0x512b5a[_0x1a1f('0x4e')]['ids']},'individualHooks':!![]})[_0x1a1f('0x1f')](function(){return _0x21d5b7;});}return _0x21d5b7;})['then'](respondWithStatusCode(_0x34739f,null))[_0x1a1f('0x29')](handleError(_0x34739f,null));};exports[_0x1a1f('0xb1')]=function(_0x4fe1a1,_0x190a0b){_0x4fe1a1[_0x1a1f('0x5e')][_0x1a1f('0xb2')]=_0x4fe1a1[_0x1a1f('0xb3')][_0x1a1f('0xb4')];return db[_0x1a1f('0x3f')][_0x1a1f('0x39')]({'where':{'id':_0x4fe1a1[_0x1a1f('0x5b')]['id']}})[_0x1a1f('0x1f')](handleEntityNotFound(_0x190a0b,null))[_0x1a1f('0x1f')](saveUpdates(_0x4fe1a1['body'],null))[_0x1a1f('0x1f')](respondWithResult(_0x190a0b,null))[_0x1a1f('0x29')](handleError(_0x190a0b,null));};exports[_0x1a1f('0xb5')]=function(_0x4b152f,_0x42fa3b){var _0x2aed4f=path[_0x1a1f('0xb6')](config[_0x1a1f('0xb7')],_0x1a1f('0xb8'));return db[_0x1a1f('0x3f')][_0x1a1f('0x39')]({'where':{'id':_0x4b152f['params']['id']},'attributes':['id',_0x1a1f('0xb2')],'raw':!![]})[_0x1a1f('0x1f')](handleEntityNotFound(_0x42fa3b,null))['then'](function(_0x3c3848){if(_0x3c3848){if(_['isNil'](_0x3c3848[_0x1a1f('0xb2')])){return _0x42fa3b['download'](_0x2aed4f);}else{if(!fs[_0x1a1f('0xb9')](path[_0x1a1f('0xb6')](config[_0x1a1f('0xb7')],_0x1a1f('0xba'),_0x3c3848[_0x1a1f('0xb2')]))){return _0x42fa3b['download'](_0x2aed4f);}return _0x42fa3b['download'](path['join'](config[_0x1a1f('0xb7')],_0x1a1f('0xba'),_0x3c3848[_0x1a1f('0xb2')]));}}})['catch'](handleError(_0x42fa3b,null));};exports[_0x1a1f('0xbb')]=function(_0x3fe066,_0x560940){return db[_0x1a1f('0x3f')][_0x1a1f('0x39')]({'where':{'id':_0x3fe066[_0x1a1f('0x5b')]['id']},'attributes':['id']})[_0x1a1f('0x1f')](handleEntityNotFound(_0x560940,null))[_0x1a1f('0x1f')](function(_0x4a2d94){var _0x4436f9=[];values=_0x4a2d94[_0x1a1f('0x52')];_0x4436f9[_0x1a1f('0x54')](get_open_tabs(_0x1a1f('0x51'),_0x4a2d94[_0x1a1f('0x52')]));_0x4436f9['push'](get_open_tabs(_0x1a1f('0x53'),_0x4a2d94[_0x1a1f('0x52')]));_0x4436f9[_0x1a1f('0x54')](get_open_tabs('openchannel',_0x4a2d94[_0x1a1f('0x52')]));_0x4436f9[_0x1a1f('0x54')](get_open_tabs(_0x1a1f('0x58'),_0x4a2d94[_0x1a1f('0x52')]));_0x4436f9['push'](get_open_tabs('fax',_0x4a2d94[_0x1a1f('0x52')]));_0x4436f9[_0x1a1f('0x54')](get_open_tabs(_0x1a1f('0x56'),_0x4a2d94[_0x1a1f('0x52')]));return Promise[_0x1a1f('0x59')](_0x4436f9);})[_0x1a1f('0x1f')](function(_0x102d3e){if(_0x102d3e){var _0x1b388e=_['map'](values[_0x1a1f('0xbc')],function(_0x3e3134){return{'channel':_0x1a1f('0xbd'),'id':_0x3e3134['id'],'createdAt':_0x3e3134[_0x1a1f('0xbe')]};});var _0x3951c3=_[_0x1a1f('0x36')](values[_0x1a1f('0xbf')],function(_0x55ffdc){return{'channel':_0x1a1f('0xc0'),'id':_0x55ffdc['id'],'createdAt':_0x55ffdc[_0x1a1f('0xbe')]};});var _0x20163d=_[_0x1a1f('0x36')](values[_0x1a1f('0xc1')],function(_0x2e8890){return{'channel':'OPENCHANNEL','id':_0x2e8890['id'],'createdAt':_0x2e8890[_0x1a1f('0xbe')]};});var _0x24b290=_[_0x1a1f('0x36')](values[_0x1a1f('0xc2')],function(_0x20315f){return{'channel':_0x1a1f('0xc3'),'id':_0x20315f['id'],'createdAt':_0x20315f[_0x1a1f('0xbe')]};});var _0x393140=_[_0x1a1f('0x36')](values['SmsOpenTabs'],function(_0x54be04){return{'channel':'SMS','id':_0x54be04['id'],'createdAt':_0x54be04[_0x1a1f('0xbe')]};});var _0x56a239=_[_0x1a1f('0x36')](values[_0x1a1f('0xc4')],function(_0x407325){return{'channel':_0x1a1f('0xc5'),'id':_0x407325['id'],'createdAt':_0x407325['createdAt']};});var _0x364d8f=_['concat'](_0x1b388e,_0x3951c3,_0x20163d,_0x24b290,_0x393140,_0x56a239);var _0x370097={'count':_0x364d8f[_0x1a1f('0x50')],'rows':_0x364d8f};return _0x370097;}else return null;})[_0x1a1f('0x1f')](respondWithResult(_0x560940,null))[_0x1a1f('0x29')](handleError(_0x560940,null));};exports[_0x1a1f('0xc6')]=function(_0x20aa73,_0x57a5d5){var _0x3b14cc={};return db[_0x1a1f('0x3f')][_0x1a1f('0x93')]({'where':{'id':_0x20aa73['params']['id']}})['then'](function(_0x407dd5){if(!_0x407dd5){throw new APINotFoundError(util['format'](_0x1a1f('0xc7'),_0x20aa73[_0x1a1f('0x5b')]['id']));}return contacts['describe']();})[_0x1a1f('0x1f')](function(_0x5b5876){_0x20aa73[_0x1a1f('0x4e')][_0x1a1f('0x3f')]=_0x20aa73[_0x1a1f('0x5b')]['id'];_0x3b14cc=qs['getOptions'](_0x5b5876,_0x20aa73);if(_0x20aa73[_0x1a1f('0x4e')][_0x1a1f('0xc8')](_0x1a1f('0x47'))){_0x3b14cc[_0x1a1f('0x48')]=[{'model':db[_0x1a1f('0xc9')],'as':_0x1a1f('0xca'),'required':![]},{'model':db['Tag'],'as':_0x1a1f('0xcb'),'attributes':['id',_0x1a1f('0x3a'),_0x1a1f('0xcc')],'where':_0x20aa73['query'][_0x1a1f('0xcd')]?{'id':_0x20aa73['query'][_0x1a1f('0xcd')]}:undefined,'required':_0x20aa73[_0x1a1f('0x4e')]['tag']?!![]:![]}];}return contacts[_0x1a1f('0x4c')](_0x20aa73[_0x1a1f('0x4e')],_0x20aa73['user'],_0x3b14cc,_0x5b5876);})[_0x1a1f('0x1f')](respondWithFilteredResult(_0x57a5d5,_0x3b14cc))['catch'](APIHandleError(_0x57a5d5));};exports[_0x1a1f('0xce')]=function(_0x10ed66,_0x6451f6){var _0x145216;var _0x1ffb6a={};var _0x160ca9;return db[_0x1a1f('0x3f')]['findOne']({'where':{'id':_0x10ed66[_0x1a1f('0x5b')]['id']},'attributes':['id',_0x1a1f('0x3a'),_0x1a1f('0x2f')]})['then'](handleEntityNotFound(_0x6451f6,null))[_0x1a1f('0x1f')](function(_0x59572c){if(!utils[_0x1a1f('0x9d')](_0x10ed66['query']['channel'])){throw new db[(_0x1a1f('0x8f'))][(_0x1a1f('0x8e'))](_0x1a1f('0xab'));}_0x145216=_0x59572c;var _0x56c597={};_0x56c597[_0x1a1f('0xcf')]=_[_0x1a1f('0xd0')](db[_[_0x1a1f('0x9f')](_0x10ed66[_0x1a1f('0x4e')][_0x1a1f('0x99')])+_0x1a1f('0xd1')][_0x1a1f('0xd2')]);_0x56c597[_0x1a1f('0x4e')]=_[_0x1a1f('0xd0')](_0x10ed66[_0x1a1f('0x4e')]);_0x56c597[_0x1a1f('0xd3')]=_[_0x1a1f('0xd4')](_0x56c597['model'],_0x56c597[_0x1a1f('0x4e')]);_0x1ffb6a[_0x1a1f('0x4b')]=_[_0x1a1f('0xd4')](_0x56c597[_0x1a1f('0xcf')],qs[_0x1a1f('0xd5')](_0x10ed66[_0x1a1f('0x4e')][_0x1a1f('0xd5')]));_0x1ffb6a[_0x1a1f('0x4b')]=_0x1ffb6a[_0x1a1f('0x4b')][_0x1a1f('0x50')]?_0x1ffb6a[_0x1a1f('0x4b')]:_0x56c597[_0x1a1f('0xcf')];_0x1ffb6a['order']=qs['sort'](_0x10ed66[_0x1a1f('0x4e')][_0x1a1f('0xd6')]);_0x1ffb6a['where']=qs[_0x1a1f('0xd3')](_[_0x1a1f('0xd7')](_0x10ed66['query'],_0x56c597[_0x1a1f('0xd3')]));if(_0x10ed66[_0x1a1f('0x4e')][_0x1a1f('0x35')]){_0x1ffb6a[_0x1a1f('0xd8')]=_['merge'](_0x1ffb6a['where'],{'$or':_[_0x1a1f('0x36')](_0x1ffb6a[_0x1a1f('0x4b')],function(_0x441120){var _0x3d0d5d={};_0x3d0d5d[_0x441120]={'$like':'%'+_0x10ed66[_0x1a1f('0x4e')][_0x1a1f('0x35')]+'%'};return _0x3d0d5d;})});}_0x1ffb6a=_[_0x1a1f('0xd9')]({},_0x1ffb6a,_0x10ed66['options']);switch(_0x145216[_0x1a1f('0x2f')]){case _0x1a1f('0x80'):return db[_[_0x1a1f('0x9f')](_0x10ed66[_0x1a1f('0x4e')][_0x1a1f('0x99')])+'Queue']['findAll'](_0x1ffb6a);case _0x1a1f('0x31'):case'agent':return _0x145216[_0x1a1f('0x2e')+_[_0x1a1f('0x9f')](_0x10ed66[_0x1a1f('0x4e')]['channel'])+_0x1a1f('0xad')](_0x1ffb6a);default:throw new db[(_0x1a1f('0x8f'))]['ValidationError'](_0x1a1f('0xda'));}})[_0x1a1f('0x1f')](function(_0xd93eee){_0x160ca9=_0xd93eee[_0x1a1f('0x50')];if(!_0x10ed66[_0x1a1f('0x4e')][_0x1a1f('0xc8')]('nolimit')){_0x1ffb6a['limit']=qs[_0x1a1f('0x1a')](_0x10ed66[_0x1a1f('0x4e')][_0x1a1f('0x1a')]);_0x1ffb6a[_0x1a1f('0x18')]=qs[_0x1a1f('0x18')](_0x10ed66['query']['offset']);}switch(_0x145216['role']){case _0x1a1f('0x80'):return db[_[_0x1a1f('0x9f')](_0x10ed66[_0x1a1f('0x4e')][_0x1a1f('0x99')])+_0x1a1f('0xd1')][_0x1a1f('0x4c')](_0x1ffb6a);case'user':case _0x1a1f('0x2b'):return _0x145216[_0x1a1f('0x2e')+_[_0x1a1f('0x9f')](_0x10ed66[_0x1a1f('0x4e')][_0x1a1f('0x99')])+_0x1a1f('0xad')](_0x1ffb6a);}})[_0x1a1f('0x1f')](function(_0x4bea51){return{'count':_0x160ca9,'rows':_0x4bea51};})[_0x1a1f('0x1f')](respondWithResult(_0x6451f6,null))[_0x1a1f('0x29')](handleError(_0x6451f6,null));};exports[_0x1a1f('0xdb')]=function(_0x1d88d6,_0x358c6e){var _0x924fa0={};var _0x3925d8={};var _0x2c3556;var _0x3f086c;return db[_0x1a1f('0x3f')]['findOne']({'where':{'id':_0x1d88d6['params']['id']}})[_0x1a1f('0x1f')](handleEntityNotFound(_0x358c6e,null))['then'](function(_0x45c4b5){if(_0x45c4b5){_0x2c3556=_0x45c4b5;_0x3925d8['model']=_[_0x1a1f('0xd0')](db[_0x1a1f('0xa8')][_0x1a1f('0xd2')]);_0x3925d8[_0x1a1f('0x4e')]=_[_0x1a1f('0xd0')](_0x1d88d6['query']);_0x3925d8[_0x1a1f('0xd3')]=_['intersection'](_0x3925d8[_0x1a1f('0xcf')],_0x3925d8[_0x1a1f('0x4e')]);_0x924fa0[_0x1a1f('0x4b')]=_['intersection'](_0x3925d8[_0x1a1f('0xcf')],qs[_0x1a1f('0xd5')](_0x1d88d6['query']['fields']));_0x924fa0[_0x1a1f('0x4b')]=_0x924fa0['attributes'][_0x1a1f('0x50')]?_0x924fa0[_0x1a1f('0x4b')]:_0x3925d8['model'];_0x924fa0[_0x1a1f('0xdc')]=qs[_0x1a1f('0xd6')](_0x1d88d6[_0x1a1f('0x4e')]['sort']);_0x924fa0[_0x1a1f('0xd8')]=qs[_0x1a1f('0xd3')](_['pick'](_0x1d88d6[_0x1a1f('0x4e')],_0x3925d8[_0x1a1f('0xd3')]));if(_0x1d88d6[_0x1a1f('0x4e')][_0x1a1f('0x35')]){_0x924fa0[_0x1a1f('0xd8')]=_['merge'](_0x924fa0['where'],{'$or':_[_0x1a1f('0x36')](_0x924fa0[_0x1a1f('0x4b')],function(_0x51805e){var _0x52cae5={};_0x52cae5[_0x51805e]={'$like':'%'+_0x1d88d6[_0x1a1f('0x4e')][_0x1a1f('0x35')]+'%'};return _0x52cae5;})});}_0x924fa0=_[_0x1a1f('0xd9')]({},_0x924fa0,_0x1d88d6[_0x1a1f('0xdd')]);return _0x2c3556[_0x1a1f('0xdb')](_0x924fa0);}})[_0x1a1f('0x1f')](function(_0x18e2ce){if(_0x18e2ce){_0x3f086c=_0x18e2ce[_0x1a1f('0x50')];if(!_0x1d88d6['query'][_0x1a1f('0xc8')](_0x1a1f('0xde'))){_0x924fa0[_0x1a1f('0x1a')]=qs[_0x1a1f('0x1a')](_0x1d88d6[_0x1a1f('0x4e')][_0x1a1f('0x1a')]);_0x924fa0[_0x1a1f('0x18')]=qs[_0x1a1f('0x18')](_0x1d88d6[_0x1a1f('0x4e')]['offset']);}return _0x2c3556['getVoiceQueuesRt'](_0x924fa0);}})[_0x1a1f('0x1f')](function(_0x2ef3dd){if(_0x2ef3dd){return _0x2ef3dd?{'count':_0x3f086c,'rows':_0x2ef3dd}:null;}})[_0x1a1f('0x1f')](respondWithResult(_0x358c6e,null))[_0x1a1f('0x29')](handleError(_0x358c6e,null));};exports['getGroups']=function(_0x2fcf83,_0x2602c1){var _0x491435={};var _0x465a0d={};var _0x3978ec;var _0x3cceab;return db['User'][_0x1a1f('0x93')]({'where':{'id':_0x2fcf83[_0x1a1f('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2602c1,null))[_0x1a1f('0x1f')](function(_0x454878){if(_0x454878){_0x3978ec=_0x454878;_0x465a0d[_0x1a1f('0xcf')]=_[_0x1a1f('0xd0')](db['ChatGroup']['rawAttributes']);_0x465a0d[_0x1a1f('0x4e')]=_[_0x1a1f('0xd0')](_0x2fcf83[_0x1a1f('0x4e')]);_0x465a0d[_0x1a1f('0xd3')]=_[_0x1a1f('0xd4')](_0x465a0d['model'],_0x465a0d[_0x1a1f('0x4e')]);_0x491435[_0x1a1f('0x4b')]=_[_0x1a1f('0xd4')](_0x465a0d[_0x1a1f('0xcf')],qs['fields'](_0x2fcf83[_0x1a1f('0x4e')][_0x1a1f('0xd5')]));_0x491435[_0x1a1f('0x4b')]=_0x491435[_0x1a1f('0x4b')][_0x1a1f('0x50')]?_0x491435['attributes']:_0x465a0d[_0x1a1f('0xcf')];_0x491435['order']=qs[_0x1a1f('0xd6')](_0x2fcf83[_0x1a1f('0x4e')][_0x1a1f('0xd6')]);_0x491435[_0x1a1f('0xd8')]=qs[_0x1a1f('0xd3')](_[_0x1a1f('0xd7')](_0x2fcf83[_0x1a1f('0x4e')],_0x465a0d[_0x1a1f('0xd3')]));if(_0x2fcf83['query'][_0x1a1f('0x35')]){_0x491435[_0x1a1f('0xd8')]=_[_0x1a1f('0xd9')](_0x491435[_0x1a1f('0xd8')],{'$or':_[_0x1a1f('0x36')](_0x491435[_0x1a1f('0x4b')],function(_0x3216fd){var _0x562d11={};_0x562d11[_0x3216fd]={'$like':'%'+_0x2fcf83[_0x1a1f('0x4e')][_0x1a1f('0x35')]+'%'};return _0x562d11;})});}_0x491435=_[_0x1a1f('0xd9')]({},_0x491435,_0x2fcf83[_0x1a1f('0xdd')]);return _0x3978ec[_0x1a1f('0xdf')](_0x491435);}})[_0x1a1f('0x1f')](function(_0x4ac730){if(_0x4ac730){_0x3cceab=_0x4ac730['length'];if(!_0x2fcf83[_0x1a1f('0x4e')][_0x1a1f('0xc8')]('nolimit')){_0x491435[_0x1a1f('0x1a')]=qs[_0x1a1f('0x1a')](_0x2fcf83[_0x1a1f('0x4e')][_0x1a1f('0x1a')]);_0x491435['offset']=qs['offset'](_0x2fcf83[_0x1a1f('0x4e')]['offset']);}return _0x3978ec[_0x1a1f('0xdf')](_0x491435);}})[_0x1a1f('0x1f')](function(_0x225a0e){if(_0x225a0e){return _0x225a0e?{'count':_0x3cceab,'rows':_0x225a0e}:null;}})[_0x1a1f('0x1f')](respondWithResult(_0x2602c1,null))[_0x1a1f('0x29')](handleError(_0x2602c1,null));};exports[_0x1a1f('0xe0')]=function(_0x79778a,_0x1d4534){var _0x40ca88={'raw':!![],'where':{}};var _0x225c54={};var _0xb78e7e={'count':0x0,'rows':[]};return db['User'][_0x1a1f('0x93')]({'where':{'id':_0x79778a['params']['id']}})['then'](handleEntityNotFound(_0x1d4534,null))[_0x1a1f('0x1f')](function(_0x1d6552){if(_0x1d6552){_0x225c54[_0x1a1f('0xcf')]=_['keys'](db[_0x1a1f('0xe1')][_0x1a1f('0xd2')]);_0x225c54[_0x1a1f('0x4e')]=_['keys'](_0x79778a[_0x1a1f('0x4e')]);_0x225c54[_0x1a1f('0xd3')]=_[_0x1a1f('0xd4')](_0x225c54[_0x1a1f('0xcf')],_0x225c54[_0x1a1f('0x4e')]);_0x40ca88[_0x1a1f('0x4b')]=_[_0x1a1f('0xd4')](_0x225c54['model'],qs[_0x1a1f('0xd5')](_0x79778a[_0x1a1f('0x4e')][_0x1a1f('0xd5')]));_0x40ca88[_0x1a1f('0x4b')]=_0x40ca88['attributes'][_0x1a1f('0x50')]?_0x40ca88['attributes']:_0x225c54[_0x1a1f('0xcf')];if(!_0x79778a[_0x1a1f('0x4e')][_0x1a1f('0xc8')](_0x1a1f('0xde'))){_0x40ca88[_0x1a1f('0x1a')]=qs[_0x1a1f('0x1a')](_0x79778a['query']['limit']);_0x40ca88[_0x1a1f('0x18')]=qs['offset'](_0x79778a[_0x1a1f('0x4e')][_0x1a1f('0x18')]);}_0x40ca88[_0x1a1f('0xdc')]=qs[_0x1a1f('0xd6')](_0x79778a['query'][_0x1a1f('0xd6')]);_0x40ca88[_0x1a1f('0xd8')]=qs['filters'](_[_0x1a1f('0xd7')](_0x79778a['query'],_0x225c54[_0x1a1f('0xd3')]));_0x40ca88['where'][_0x1a1f('0xe2')]=_0x1d6552['id'];if(_0x79778a[_0x1a1f('0x4e')]['filter']){_0x40ca88[_0x1a1f('0xd8')]=_[_0x1a1f('0xd9')](_0x40ca88[_0x1a1f('0xd8')],{'$or':_[_0x1a1f('0x36')](_0x40ca88[_0x1a1f('0x4b')],function(_0x5eb096){var _0x2633da={};_0x2633da[_0x5eb096]={'$like':'%'+_0x79778a[_0x1a1f('0x4e')][_0x1a1f('0x35')]+'%'};return _0x2633da;})});}_0x40ca88=_['merge']({},_0x40ca88,_0x79778a[_0x1a1f('0xdd')]);return db[_0x1a1f('0xe1')][_0x1a1f('0x1b')]({'where':_0x40ca88[_0x1a1f('0xd8')]})[_0x1a1f('0x1f')](function(_0x10ec8a){_0xb78e7e['count']=_0x10ec8a;if(_0x79778a[_0x1a1f('0x4e')]['includeAll']){_0x40ca88[_0x1a1f('0x48')]=[{'all':!![]}];}return db['VoiceRecording'][_0x1a1f('0x4c')](_0x40ca88);})['then'](function(_0x130cac){_0xb78e7e[_0x1a1f('0x4d')]=_0x130cac;return _0xb78e7e;});}})[_0x1a1f('0x1f')](respondWithFilteredResult(_0x1d4534,_0x40ca88))['catch'](handleError(_0x1d4534,null));};exports['getScreenRecordings']=function(_0x2ef495,_0x196aae){var _0x3961e9={'raw':!![],'where':{}};var _0x137617={};var _0x1a47ae={'count':0x0,'rows':[]};return db['User'][_0x1a1f('0x93')]({'where':{'id':_0x2ef495['params']['id']}})[_0x1a1f('0x1f')](handleEntityNotFound(_0x196aae,null))[_0x1a1f('0x1f')](function(_0x3b5342){if(_0x3b5342){_0x137617['model']=_[_0x1a1f('0xd0')](db['ScreenRecording'][_0x1a1f('0xd2')]);_0x137617[_0x1a1f('0x4e')]=_['keys'](_0x2ef495[_0x1a1f('0x4e')]);_0x137617[_0x1a1f('0xd3')]=_[_0x1a1f('0xd4')](_0x137617[_0x1a1f('0xcf')],_0x137617[_0x1a1f('0x4e')]);_0x3961e9['attributes']=_['intersection'](_0x137617[_0x1a1f('0xcf')],qs[_0x1a1f('0xd5')](_0x2ef495[_0x1a1f('0x4e')][_0x1a1f('0xd5')]));_0x3961e9[_0x1a1f('0x4b')]=_0x3961e9[_0x1a1f('0x4b')]['length']?_0x3961e9[_0x1a1f('0x4b')]:_0x137617[_0x1a1f('0xcf')];if(!_0x2ef495[_0x1a1f('0x4e')][_0x1a1f('0xc8')]('nolimit')){_0x3961e9['limit']=qs[_0x1a1f('0x1a')](_0x2ef495[_0x1a1f('0x4e')][_0x1a1f('0x1a')]);_0x3961e9[_0x1a1f('0x18')]=qs[_0x1a1f('0x18')](_0x2ef495[_0x1a1f('0x4e')][_0x1a1f('0x18')]);}_0x3961e9[_0x1a1f('0xdc')]=qs['sort'](_0x2ef495[_0x1a1f('0x4e')][_0x1a1f('0xd6')]);_0x3961e9[_0x1a1f('0xd8')]=qs[_0x1a1f('0xd3')](_[_0x1a1f('0xd7')](_0x2ef495[_0x1a1f('0x4e')],_0x137617[_0x1a1f('0xd3')]));_0x3961e9[_0x1a1f('0xd8')][_0x1a1f('0xe2')]=_0x3b5342['id'];if(_0x2ef495[_0x1a1f('0x4e')][_0x1a1f('0x35')]){_0x3961e9[_0x1a1f('0xd8')]=_[_0x1a1f('0xd9')](_0x3961e9[_0x1a1f('0xd8')],{'$or':_[_0x1a1f('0x36')](_0x3961e9[_0x1a1f('0x4b')],function(_0x3c2077){var _0x11d512={};_0x11d512[_0x3c2077]={'$like':'%'+_0x2ef495[_0x1a1f('0x4e')][_0x1a1f('0x35')]+'%'};return _0x11d512;})});}_0x3961e9=_['merge']({},_0x3961e9,_0x2ef495[_0x1a1f('0xdd')]);return db[_0x1a1f('0xe3')][_0x1a1f('0x1b')]({'where':_0x3961e9[_0x1a1f('0xd8')]})['then'](function(_0x428c11){_0x1a47ae[_0x1a1f('0x1b')]=_0x428c11;if(_0x2ef495[_0x1a1f('0x4e')][_0x1a1f('0x47')]){_0x3961e9[_0x1a1f('0x48')]=[{'all':!![]}];}return db[_0x1a1f('0xe3')][_0x1a1f('0x4c')](_0x3961e9);})[_0x1a1f('0x1f')](function(_0x4ee765){_0x1a47ae[_0x1a1f('0x4d')]=_0x4ee765;return _0x1a47ae;});}})[_0x1a1f('0x1f')](respondWithFilteredResult(_0x196aae,_0x3961e9))['catch'](handleError(_0x196aae,null));};exports['getChatInteractions']=function(_0x1c80c9,_0x56f71b){var _0x565ea3={};var _0x1616df={};var _0x54dd58;var _0x2ef37d;return db[_0x1a1f('0x3f')][_0x1a1f('0x93')]({'where':{'id':_0x1c80c9[_0x1a1f('0x5b')]['id']}})[_0x1a1f('0x1f')](handleEntityNotFound(_0x56f71b,null))['then'](function(_0xdf58eb){if(_0xdf58eb){_0x54dd58=_0xdf58eb;_0x1616df['model']=_['keys'](db[_0x1a1f('0xe4')][_0x1a1f('0xd2')]);_0x1616df['query']=_[_0x1a1f('0xd0')](_0x1c80c9[_0x1a1f('0x4e')]);_0x1616df[_0x1a1f('0xd3')]=_[_0x1a1f('0xd4')](_0x1616df[_0x1a1f('0xcf')],_0x1616df[_0x1a1f('0x4e')]);_0x565ea3[_0x1a1f('0x4b')]=_[_0x1a1f('0xd4')](_0x1616df[_0x1a1f('0xcf')],qs[_0x1a1f('0xd5')](_0x1c80c9['query'][_0x1a1f('0xd5')]));_0x565ea3[_0x1a1f('0x4b')]=_0x565ea3[_0x1a1f('0x4b')][_0x1a1f('0x50')]?_0x565ea3[_0x1a1f('0x4b')]:_0x1616df['model'];_0x565ea3[_0x1a1f('0xdc')]=qs[_0x1a1f('0xd6')](_0x1c80c9[_0x1a1f('0x4e')][_0x1a1f('0xd6')]);_0x565ea3[_0x1a1f('0xd8')]=qs[_0x1a1f('0xd3')](_[_0x1a1f('0xd7')](_0x1c80c9[_0x1a1f('0x4e')],_0x1616df[_0x1a1f('0xd3')]));if(_0x1c80c9['query'][_0x1a1f('0x35')]){_0x565ea3[_0x1a1f('0xd8')]=_[_0x1a1f('0xd9')](_0x565ea3[_0x1a1f('0xd8')],{'$or':_['map'](_0x565ea3[_0x1a1f('0x4b')],function(_0x93cc6f){var _0x302042={};_0x302042[_0x93cc6f]={'$like':'%'+_0x1c80c9[_0x1a1f('0x4e')][_0x1a1f('0x35')]+'%'};return _0x302042;})});}_0x565ea3=_['merge']({},_0x565ea3,_0x1c80c9[_0x1a1f('0xdd')]);return _0x54dd58[_0x1a1f('0xe5')](_0x565ea3);}})[_0x1a1f('0x1f')](function(_0x57f142){if(_0x57f142){_0x2ef37d=_0x57f142['length'];if(!_0x1c80c9[_0x1a1f('0x4e')][_0x1a1f('0xc8')](_0x1a1f('0xde'))){_0x565ea3[_0x1a1f('0x1a')]=qs[_0x1a1f('0x1a')](_0x1c80c9[_0x1a1f('0x4e')]['limit']);_0x565ea3[_0x1a1f('0x18')]=qs[_0x1a1f('0x18')](_0x1c80c9[_0x1a1f('0x4e')][_0x1a1f('0x18')]);}return _0x54dd58[_0x1a1f('0xe5')](_0x565ea3);}})[_0x1a1f('0x1f')](function(_0x79bb9e){if(_0x79bb9e){return _0x79bb9e?{'count':_0x2ef37d,'rows':_0x79bb9e}:null;}})[_0x1a1f('0x1f')](respondWithResult(_0x56f71b,null))[_0x1a1f('0x29')](handleError(_0x56f71b,null));};exports[_0x1a1f('0xe6')]=function(_0x59a908,_0x26e725){var _0x44a476={};var _0x47011f={};var _0x53e016;var _0x5de032;return db['User'][_0x1a1f('0x93')]({'where':{'id':_0x59a908[_0x1a1f('0x5b')]['id']}})[_0x1a1f('0x1f')](handleEntityNotFound(_0x26e725,null))['then'](function(_0x5d79b0){if(_0x5d79b0){_0x53e016=_0x5d79b0;_0x47011f[_0x1a1f('0xcf')]=_[_0x1a1f('0xd0')](db[_0x1a1f('0xe7')][_0x1a1f('0xd2')]);_0x47011f['query']=_[_0x1a1f('0xd0')](_0x59a908[_0x1a1f('0x4e')]);_0x47011f[_0x1a1f('0xd3')]=_[_0x1a1f('0xd4')](_0x47011f['model'],_0x47011f[_0x1a1f('0x4e')]);_0x44a476[_0x1a1f('0x4b')]=_[_0x1a1f('0xd4')](_0x47011f['model'],qs[_0x1a1f('0xd5')](_0x59a908[_0x1a1f('0x4e')]['fields']));_0x44a476[_0x1a1f('0x4b')]=_0x44a476[_0x1a1f('0x4b')]['length']?_0x44a476[_0x1a1f('0x4b')]:_0x47011f[_0x1a1f('0xcf')];_0x44a476[_0x1a1f('0xdc')]=qs[_0x1a1f('0xd6')](_0x59a908[_0x1a1f('0x4e')][_0x1a1f('0xd6')]);_0x44a476[_0x1a1f('0xd8')]=qs[_0x1a1f('0xd3')](_['pick'](_0x59a908[_0x1a1f('0x4e')],_0x47011f[_0x1a1f('0xd3')]));if(_0x59a908['query'][_0x1a1f('0x35')]){_0x44a476[_0x1a1f('0xd8')]=_['merge'](_0x44a476[_0x1a1f('0xd8')],{'$or':_['map'](_0x44a476['attributes'],function(_0x590662){var _0x20fda8={};_0x20fda8[_0x590662]={'$like':'%'+_0x59a908[_0x1a1f('0x4e')][_0x1a1f('0x35')]+'%'};return _0x20fda8;})});}_0x44a476=_[_0x1a1f('0xd9')]({},_0x44a476,_0x59a908[_0x1a1f('0xdd')]);return _0x53e016[_0x1a1f('0xe6')](_0x44a476);}})[_0x1a1f('0x1f')](function(_0x8cd2ea){if(_0x8cd2ea){_0x5de032=_0x8cd2ea[_0x1a1f('0x50')];if(!_0x59a908[_0x1a1f('0x4e')][_0x1a1f('0xc8')](_0x1a1f('0xde'))){_0x44a476[_0x1a1f('0x1a')]=qs['limit'](_0x59a908['query']['limit']);_0x44a476['offset']=qs[_0x1a1f('0x18')](_0x59a908[_0x1a1f('0x4e')][_0x1a1f('0x18')]);}return _0x53e016[_0x1a1f('0xe6')](_0x44a476);}})[_0x1a1f('0x1f')](function(_0x5e90a7){if(_0x5e90a7){return _0x5e90a7?{'count':_0x5de032,'rows':_0x5e90a7}:null;}})['then'](respondWithResult(_0x26e725,null))['catch'](handleError(_0x26e725,null));};exports[_0x1a1f('0xe8')]=function(_0x1a5bd3,_0x531ea8){var _0x557659={'raw':!![],'where':{}};var _0x18c634={};var _0x72ae98={'count':0x0,'rows':[]};return db[_0x1a1f('0x3f')][_0x1a1f('0x93')]({'where':{'id':_0x1a5bd3[_0x1a1f('0x5b')]['id']}})[_0x1a1f('0x1f')](handleEntityNotFound(_0x531ea8,null))[_0x1a1f('0x1f')](function(_0x3e9b73){if(_0x3e9b73){_0x18c634[_0x1a1f('0xcf')]=_[_0x1a1f('0xd0')](db[_0x1a1f('0xe9')][_0x1a1f('0xd2')]);_0x18c634[_0x1a1f('0x4e')]=_[_0x1a1f('0xd0')](_0x1a5bd3[_0x1a1f('0x4e')]);_0x18c634[_0x1a1f('0xd3')]=_[_0x1a1f('0xd4')](_0x18c634[_0x1a1f('0xcf')],_0x18c634[_0x1a1f('0x4e')]);_0x557659['attributes']=_[_0x1a1f('0xd4')](_0x18c634[_0x1a1f('0xcf')],qs[_0x1a1f('0xd5')](_0x1a5bd3[_0x1a1f('0x4e')][_0x1a1f('0xd5')]));_0x557659['attributes']=_0x557659[_0x1a1f('0x4b')][_0x1a1f('0x50')]?_0x557659[_0x1a1f('0x4b')]:_0x18c634[_0x1a1f('0xcf')];if(!_0x1a5bd3[_0x1a1f('0x4e')][_0x1a1f('0xc8')]('nolimit')){_0x557659[_0x1a1f('0x1a')]=qs[_0x1a1f('0x1a')](_0x1a5bd3[_0x1a1f('0x4e')][_0x1a1f('0x1a')]);_0x557659['offset']=qs[_0x1a1f('0x18')](_0x1a5bd3['query'][_0x1a1f('0x18')]);}_0x557659[_0x1a1f('0xdc')]=qs['sort'](_0x1a5bd3[_0x1a1f('0x4e')][_0x1a1f('0xd6')]);_0x557659[_0x1a1f('0xd8')]=qs[_0x1a1f('0xd3')](_['pick'](_0x1a5bd3[_0x1a1f('0x4e')],_0x18c634[_0x1a1f('0xd3')]));_0x557659['where'][_0x1a1f('0xe2')]=_0x3e9b73['id'];if(_0x1a5bd3[_0x1a1f('0x4e')]['filter']){_0x557659[_0x1a1f('0xd8')]=_['merge'](_0x557659[_0x1a1f('0xd8')],{'$or':_[_0x1a1f('0x36')](_0x557659[_0x1a1f('0x4b')],function(_0x2221b3){var _0x45c181={};_0x45c181[_0x2221b3]={'$like':'%'+_0x1a5bd3[_0x1a1f('0x4e')][_0x1a1f('0x35')]+'%'};return _0x45c181;})});}_0x557659=_[_0x1a1f('0xd9')]({},_0x557659,_0x1a5bd3[_0x1a1f('0xdd')]);return db['MailInteraction']['count']({'where':_0x557659[_0x1a1f('0xd8')]})[_0x1a1f('0x1f')](function(_0x4abd38){_0x72ae98[_0x1a1f('0x1b')]=_0x4abd38;if(_0x1a5bd3[_0x1a1f('0x4e')][_0x1a1f('0x47')]){_0x557659[_0x1a1f('0x48')]=[{'all':!![]}];}return db[_0x1a1f('0xe9')][_0x1a1f('0x4c')](_0x557659);})[_0x1a1f('0x1f')](function(_0x5bf3d8){_0x72ae98[_0x1a1f('0x4d')]=_0x5bf3d8;return _0x72ae98;});}})[_0x1a1f('0x1f')](respondWithFilteredResult(_0x531ea8,_0x557659))[_0x1a1f('0x29')](handleError(_0x531ea8,null));};exports[_0x1a1f('0xea')]=function(_0x18e51b,_0x45f776){var _0xbbbc1d={};var _0x401a12={};var _0x291c3e;var _0x4e4908;return db[_0x1a1f('0x3f')][_0x1a1f('0x93')]({'where':{'id':_0x18e51b[_0x1a1f('0x5b')]['id']}})[_0x1a1f('0x1f')](handleEntityNotFound(_0x45f776,null))['then'](function(_0x575f16){if(_0x575f16){_0x291c3e=_0x575f16;_0x401a12['model']=_[_0x1a1f('0xd0')](db[_0x1a1f('0xeb')][_0x1a1f('0xd2')]);_0x401a12['query']=_['keys'](_0x18e51b[_0x1a1f('0x4e')]);_0x401a12[_0x1a1f('0xd3')]=_[_0x1a1f('0xd4')](_0x401a12['model'],_0x401a12[_0x1a1f('0x4e')]);_0xbbbc1d[_0x1a1f('0x4b')]=_['intersection'](_0x401a12[_0x1a1f('0xcf')],qs[_0x1a1f('0xd5')](_0x18e51b[_0x1a1f('0x4e')][_0x1a1f('0xd5')]));_0xbbbc1d['attributes']=_0xbbbc1d['attributes']['length']?_0xbbbc1d[_0x1a1f('0x4b')]:_0x401a12[_0x1a1f('0xcf')];_0xbbbc1d[_0x1a1f('0xdc')]=qs[_0x1a1f('0xd6')](_0x18e51b[_0x1a1f('0x4e')]['sort']);_0xbbbc1d[_0x1a1f('0xd8')]=qs[_0x1a1f('0xd3')](_[_0x1a1f('0xd7')](_0x18e51b[_0x1a1f('0x4e')],_0x401a12[_0x1a1f('0xd3')]));if(_0x18e51b[_0x1a1f('0x4e')]['filter']){_0xbbbc1d['where']=_[_0x1a1f('0xd9')](_0xbbbc1d[_0x1a1f('0xd8')],{'$or':_[_0x1a1f('0x36')](_0xbbbc1d['attributes'],function(_0xfcfaea){var _0x102892={};_0x102892[_0xfcfaea]={'$like':'%'+_0x18e51b[_0x1a1f('0x4e')]['filter']+'%'};return _0x102892;})});}_0xbbbc1d=_['merge']({},_0xbbbc1d,_0x18e51b[_0x1a1f('0xdd')]);return _0x291c3e[_0x1a1f('0xea')](_0xbbbc1d);}})[_0x1a1f('0x1f')](function(_0x3b8a53){if(_0x3b8a53){_0x4e4908=_0x3b8a53[_0x1a1f('0x50')];if(!_0x18e51b['query'][_0x1a1f('0xc8')]('nolimit')){_0xbbbc1d['limit']=qs[_0x1a1f('0x1a')](_0x18e51b[_0x1a1f('0x4e')]['limit']);_0xbbbc1d['offset']=qs['offset'](_0x18e51b[_0x1a1f('0x4e')][_0x1a1f('0x18')]);}return _0x291c3e[_0x1a1f('0xea')](_0xbbbc1d);}})['then'](function(_0x96fabd){if(_0x96fabd){return _0x96fabd?{'count':_0x4e4908,'rows':_0x96fabd}:null;}})[_0x1a1f('0x1f')](respondWithResult(_0x45f776,null))['catch'](handleError(_0x45f776,null));};exports['getFaxInteractions']=function(_0x56a048,_0x436cb9){var _0x2490f9={};var _0x1651cb={};var _0xbb07aa;var _0x364d54;return db['User'][_0x1a1f('0x93')]({'where':{'id':_0x56a048[_0x1a1f('0x5b')]['id']}})[_0x1a1f('0x1f')](handleEntityNotFound(_0x436cb9,null))[_0x1a1f('0x1f')](function(_0x11e078){if(_0x11e078){_0xbb07aa=_0x11e078;_0x1651cb[_0x1a1f('0xcf')]=_['keys'](db[_0x1a1f('0xec')]['rawAttributes']);_0x1651cb[_0x1a1f('0x4e')]=_['keys'](_0x56a048[_0x1a1f('0x4e')]);_0x1651cb[_0x1a1f('0xd3')]=_[_0x1a1f('0xd4')](_0x1651cb[_0x1a1f('0xcf')],_0x1651cb[_0x1a1f('0x4e')]);_0x2490f9[_0x1a1f('0x4b')]=_[_0x1a1f('0xd4')](_0x1651cb['model'],qs[_0x1a1f('0xd5')](_0x56a048[_0x1a1f('0x4e')][_0x1a1f('0xd5')]));_0x2490f9[_0x1a1f('0x4b')]=_0x2490f9[_0x1a1f('0x4b')][_0x1a1f('0x50')]?_0x2490f9['attributes']:_0x1651cb[_0x1a1f('0xcf')];_0x2490f9[_0x1a1f('0xdc')]=qs['sort'](_0x56a048[_0x1a1f('0x4e')][_0x1a1f('0xd6')]);_0x2490f9['where']=qs[_0x1a1f('0xd3')](_[_0x1a1f('0xd7')](_0x56a048[_0x1a1f('0x4e')],_0x1651cb['filters']));if(_0x56a048[_0x1a1f('0x4e')]['filter']){_0x2490f9[_0x1a1f('0xd8')]=_['merge'](_0x2490f9['where'],{'$or':_[_0x1a1f('0x36')](_0x2490f9[_0x1a1f('0x4b')],function(_0x438755){var _0x9ffe34={};_0x9ffe34[_0x438755]={'$like':'%'+_0x56a048[_0x1a1f('0x4e')][_0x1a1f('0x35')]+'%'};return _0x9ffe34;})});}_0x2490f9=_[_0x1a1f('0xd9')]({},_0x2490f9,_0x56a048[_0x1a1f('0xdd')]);return _0xbb07aa[_0x1a1f('0xed')](_0x2490f9);}})[_0x1a1f('0x1f')](function(_0x17ff7b){if(_0x17ff7b){_0x364d54=_0x17ff7b['length'];if(!_0x56a048[_0x1a1f('0x4e')][_0x1a1f('0xc8')]('nolimit')){_0x2490f9['limit']=qs[_0x1a1f('0x1a')](_0x56a048[_0x1a1f('0x4e')][_0x1a1f('0x1a')]);_0x2490f9[_0x1a1f('0x18')]=qs['offset'](_0x56a048['query']['offset']);}return _0xbb07aa['getFaxInteractions'](_0x2490f9);}})['then'](function(_0x1a697e){if(_0x1a697e){return _0x1a697e?{'count':_0x364d54,'rows':_0x1a697e}:null;}})[_0x1a1f('0x1f')](respondWithResult(_0x436cb9,null))[_0x1a1f('0x29')](handleError(_0x436cb9,null));};exports['getWhatsappInteractions']=function(_0xabcfbe,_0x1cfb6e){var _0x441138={};var _0x550f9a={};var _0x279af5;var _0xba083;return db[_0x1a1f('0x3f')]['findOne']({'where':{'id':_0xabcfbe['params']['id']}})['then'](handleEntityNotFound(_0x1cfb6e,null))['then'](function(_0x39872e){if(_0x39872e){_0x279af5=_0x39872e;_0x550f9a[_0x1a1f('0xcf')]=_[_0x1a1f('0xd0')](db[_0x1a1f('0xee')]['rawAttributes']);_0x550f9a['query']=_[_0x1a1f('0xd0')](_0xabcfbe[_0x1a1f('0x4e')]);_0x550f9a[_0x1a1f('0xd3')]=_[_0x1a1f('0xd4')](_0x550f9a[_0x1a1f('0xcf')],_0x550f9a[_0x1a1f('0x4e')]);_0x441138[_0x1a1f('0x4b')]=_[_0x1a1f('0xd4')](_0x550f9a[_0x1a1f('0xcf')],qs[_0x1a1f('0xd5')](_0xabcfbe[_0x1a1f('0x4e')][_0x1a1f('0xd5')]));_0x441138['attributes']=_0x441138['attributes'][_0x1a1f('0x50')]?_0x441138[_0x1a1f('0x4b')]:_0x550f9a[_0x1a1f('0xcf')];_0x441138[_0x1a1f('0xdc')]=qs[_0x1a1f('0xd6')](_0xabcfbe[_0x1a1f('0x4e')][_0x1a1f('0xd6')]);_0x441138[_0x1a1f('0xd8')]=qs[_0x1a1f('0xd3')](_[_0x1a1f('0xd7')](_0xabcfbe[_0x1a1f('0x4e')],_0x550f9a[_0x1a1f('0xd3')]));if(_0xabcfbe[_0x1a1f('0x4e')][_0x1a1f('0x35')]){_0x441138[_0x1a1f('0xd8')]=_['merge'](_0x441138[_0x1a1f('0xd8')],{'$or':_['map'](_0x441138[_0x1a1f('0x4b')],function(_0x31efb3){var _0x52edcf={};_0x52edcf[_0x31efb3]={'$like':'%'+_0xabcfbe['query'][_0x1a1f('0x35')]+'%'};return _0x52edcf;})});}_0x441138=_[_0x1a1f('0xd9')]({},_0x441138,_0xabcfbe[_0x1a1f('0xdd')]);return _0x279af5[_0x1a1f('0xef')](_0x441138);}})[_0x1a1f('0x1f')](function(_0x210202){if(_0x210202){_0xba083=_0x210202[_0x1a1f('0x50')];if(!_0xabcfbe[_0x1a1f('0x4e')]['hasOwnProperty'](_0x1a1f('0xde'))){_0x441138['limit']=qs[_0x1a1f('0x1a')](_0xabcfbe['query'][_0x1a1f('0x1a')]);_0x441138[_0x1a1f('0x18')]=qs[_0x1a1f('0x18')](_0xabcfbe[_0x1a1f('0x4e')][_0x1a1f('0x18')]);}return _0x279af5[_0x1a1f('0xef')](_0x441138);}})['then'](function(_0x591477){if(_0x591477){return _0x591477?{'count':_0xba083,'rows':_0x591477}:null;}})[_0x1a1f('0x1f')](respondWithResult(_0x1cfb6e,null))['catch'](handleError(_0x1cfb6e,null));};exports['login']=function(_0x15eefc,_0x1099e2,_0x8863e5){var _0x668d14;var _0x51f3b4;var _0x4f0a37;var _0x3e819b=!_['isNil'](_0x15eefc[_0x1a1f('0x5b')]['id'])?_0x15eefc['params']['id']:!_[_0x1a1f('0x67')](_0x15eefc[_0x1a1f('0x31')]['id'])?_0x15eefc[_0x1a1f('0x31')]['id']:null;return db[_0x1a1f('0x3f')][_0x1a1f('0x39')]({'where':{'id':_0x3e819b,'role':{'$or':[_0x1a1f('0x80'),_0x1a1f('0x31'),'agent']}},'attributes':['id',_0x1a1f('0x3a'),_0x1a1f('0xf0'),'mobile',_0x1a1f('0x2f'),_0x1a1f('0x63'),'loginInPause']})[_0x1a1f('0x1f')](function(_0x25f08e){if(_0x25f08e){if(_0x25f08e[_0x1a1f('0x2f')]===_0x1a1f('0x2b')){_0x668d14=_0x25f08e;if(_0x15eefc[_0x1a1f('0x5e')]['interface']){_0x4f0a37=util['format'](_0x1a1f('0xf1'),_0x668d14[_0x15eefc['body'][_0x1a1f('0xa5')]]);}else if(_0x15eefc[_0x1a1f('0x5e')]['intrf']){_0x4f0a37=util[_0x1a1f('0xa6')](_0x1a1f('0xa7'),_0x15eefc[_0x1a1f('0x5e')][_0x1a1f('0xf2')]);}else{_0x4f0a37=util['format'](_0x1a1f('0xa7'),_0x668d14[_0x1a1f('0x3a')]);}socket['to'](util[_0x1a1f('0xa6')](_0x1a1f('0xf3'),_0x668d14[_0x1a1f('0x3a')]))[_0x1a1f('0x2c')]('user:forcelogout',{'user':{'id':_0x668d14['id'],'name':_0x668d14[_0x1a1f('0x3a')]},'ip':_0x15eefc[_0x1a1f('0xf4')][_0x1a1f('0xf5')]||_0x15eefc['connection']['remoteAddress']||_0x15eefc[_0x1a1f('0xf6')][_0x1a1f('0xf7')]||_0x15eefc[_0x1a1f('0xf8')][_0x1a1f('0xf6')][_0x1a1f('0xf7')]});return new Promise(function(_0x562f14,_0x5150d2){db[_0x1a1f('0x68')][_0x1a1f('0xf9')]()[_0x1a1f('0x1f')](_0x2c0c35=>{db[_0x1a1f('0xa8')]['destroy']({'where':{'membername':_0x668d14['name']},'individualHooks':!![]},{'transaction':_0x2c0c35})['then'](function(){return _0x2c0c35['commit']();})[_0x1a1f('0x1f')](_0x562f14)[_0x1a1f('0x29')](_0x5150d2);});});}}else{throw new db[(_0x1a1f('0x8f'))][(_0x1a1f('0x8e'))](_0x1a1f('0xfa'));}})['then'](function(){if(_0x668d14){return _0x668d14[_0x1a1f('0xfb')]({'raw':!![]});}})[_0x1a1f('0x1f')](function(_0x49de33){if(_0x668d14){if(_0x49de33){_0x51f3b4=_0x49de33;if(_0x51f3b4[_0x1a1f('0x50')]){var _0x2bb59d=_0x51f3b4[_0x1a1f('0x36')](function(_0x58efec){return{'membername':_0x668d14['name'],'UserId':_0x668d14['id'],'queue_name':_0x58efec[_0x1a1f('0x3a')],'VoiceQueueId':_0x58efec['id'],'interface':_0x4f0a37,'paused':_0x668d14['loginInPause']||![],'penalty':_0x58efec[_0x1a1f('0xfc')]||0x0};});return db[_0x1a1f('0xa8')][_0x1a1f('0x89')](_0x2bb59d);}}}})[_0x1a1f('0x1f')](function(){if(_0x668d14){return db[_0x1a1f('0xfd')][_0x1a1f('0x4c')]({'where':{'membername':_0x668d14[_0x1a1f('0x3a')],'exitAt':null}});}})[_0x1a1f('0x1f')](function(_0x248e8a){if(_0x668d14){var _0xfb4e74=[];_0x248e8a['forEach'](function(_0x4b28bc){_0xfb4e74[_0x1a1f('0x54')](_0x4b28bc['update']({'exitAt':moment()[_0x1a1f('0xa6')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x1a1f('0x59')](_0xfb4e74);}})['then'](function(){if(_0x668d14){var _0x37f5a2=[];var _0xd6c126=[];var _0x11a1a7=utils[_0x1a1f('0xfe')]();var _0x19a77b={'membername':_0x668d14['name'],'interface':_0x4f0a37,'enterAt':moment()[_0x1a1f('0xa6')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x668d14['role'],'internal':_0x668d14[_0x1a1f('0x63')]};_0x11a1a7[_0x1a1f('0xff')](function(_0x369f4d){_0x37f5a2[_0x1a1f('0x54')](_['merge']({'channel':_0x369f4d,'type':'LOGIN','data1':_0x15eefc[_0x1a1f('0x5e')]['device'],'data2':_0x4f0a37},_0x19a77b));if(_0x668d14[_0x1a1f('0x9b')]){_0xd6c126['push'](_[_0x1a1f('0xd9')]({'channel':_0x369f4d,'type':_0x1a1f('0x100'),'data1':_0x1a1f('0x101')},_0x19a77b));}});return db['MemberReport'][_0x1a1f('0x89')](_0x37f5a2['concat'](_0xd6c126),{'individualHooks':!![]});}})[_0x1a1f('0x1f')](function(){if(_0x668d14){return _0x668d14[_0x1a1f('0x2a')]({'online':!![],'lastLoginAt':moment()['format'](_0x1a1f('0x102')),'voicePause':_0x668d14[_0x1a1f('0x9b')]||![],'mailPause':_0x668d14[_0x1a1f('0x9b')]||![],'chatPause':_0x668d14[_0x1a1f('0x9b')]||![],'faxPause':_0x668d14[_0x1a1f('0x9b')]||![],'smsPause':_0x668d14[_0x1a1f('0x9b')]||![],'openchannelPause':_0x668d14[_0x1a1f('0x9b')]||![],'whatsappPause':_0x668d14[_0x1a1f('0x9b')]||![],'pauseType':_0x668d14[_0x1a1f('0x9b')]?_0x1a1f('0x101'):null,'interface':_0x4f0a37,'lastPauseAt':moment()[_0x1a1f('0xa6')](_0x1a1f('0x102'))});}})[_0x1a1f('0x1f')](function(_0xa2015e){if(_0x15eefc[_0x1a1f('0x103')]){return _0x8863e5();}else{return Promise[_0x1a1f('0x104')](_0xa2015e)[_0x1a1f('0x1f')](respondWithResult(_0x1099e2,null));}})[_0x1a1f('0x29')](handleError(_0x1099e2,null));};exports['logout']=function(_0x1f2f7c,_0x35589c){var _0x45bb95;return db[_0x1a1f('0x3f')][_0x1a1f('0x39')]({'where':{'id':_0x1f2f7c[_0x1a1f('0x5b')]['id'],'role':_0x1a1f('0x2b')},'attributes':['id',_0x1a1f('0x3a'),_0x1a1f('0x2f')]})[_0x1a1f('0x1f')](handleEntityNotFound(_0x35589c,null))[_0x1a1f('0x1f')](function(_0x272cec){if(_0x272cec){_0x45bb95=_0x272cec;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x45bb95[_0x1a1f('0x3a')]},'individualHooks':!![]});}})[_0x1a1f('0x1f')](function(){return db[_0x1a1f('0xfd')]['findAll']({'where':{'membername':_0x45bb95[_0x1a1f('0x3a')],'exitAt':null}});})[_0x1a1f('0x1f')](function(_0x3bc225){var _0x4a3fbc=[];_0x3bc225[_0x1a1f('0xff')](function(_0x16ec27){_0x4a3fbc[_0x1a1f('0x54')](_0x16ec27[_0x1a1f('0x2a')]({'exitAt':moment()[_0x1a1f('0xa6')](_0x1a1f('0x102'))}));});return Promise['all'](_0x4a3fbc);})[_0x1a1f('0x1f')](function(){return _0x45bb95[_0x1a1f('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x35589c,null))[_0x1a1f('0x29')](handleError(_0x35589c,null));};exports[_0x1a1f('0x105')]=function(_0x232863,_0x4a806c){var _0x311630;return db[_0x1a1f('0xa8')][_0x1a1f('0x2a')]({'paused':0x1},{'where':{'UserId':_0x232863[_0x1a1f('0x5b')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x1a1f('0x3f')][_0x1a1f('0x39')]({'where':{'id':_0x232863[_0x1a1f('0x5b')]['id'],'role':_0x1a1f('0x2b')},'attributes':['id',_0x1a1f('0x3a'),_0x1a1f('0x2f'),_0x1a1f('0x63'),_0x1a1f('0xa5'),_0x1a1f('0x9a')]});})[_0x1a1f('0x1f')](handleEntityNotFound(_0x4a806c,null))['then'](function(_0x40c794){if(_0x40c794){_0x311630=_0x40c794;return respondWithRpcPromise(_0x1a1f('0x106'),_0x1a1f('0x105'),{'id':_0x311630['id'],'name':_0x311630[_0x1a1f('0x3a')],'pause':!![]});}})[_0x1a1f('0x1f')](function(){if(_0x311630){return db[_0x1a1f('0xfd')][_0x1a1f('0x4c')]({'where':{'membername':_0x311630[_0x1a1f('0x3a')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x1f6220){if(_0x1f6220['length']){var _0x40445b=moment()['format'](_0x1a1f('0x102'));for(var _0xd636a3=0x0,_0x46e2a1=_0x1f6220[_0x1a1f('0x50')];_0xd636a3<_0x46e2a1;_0xd636a3++){_0x1f6220[_0xd636a3][_0x1a1f('0x107')]({'exitAt':_0x40445b});}}})[_0x1a1f('0x1f')](function(){var _0x3f5055=[];var _0x5972ae=utils['getChannels']();_0x5972ae[_0x1a1f('0xff')](function(_0x1647ac){_0x3f5055[_0x1a1f('0x54')]({'channel':_0x1647ac,'membername':_0x311630[_0x1a1f('0x3a')],'interface':_[_0x1a1f('0x67')](_0x311630[_0x1a1f('0xa5')])?util[_0x1a1f('0xa6')](_0x1a1f('0xa7'),_0x311630[_0x1a1f('0x3a')]):_0x311630[_0x1a1f('0xa5')],'type':'PAUSE','enterAt':moment()['format'](_0x1a1f('0x102')),'data1':_0x232863[_0x1a1f('0x5e')][_0x1a1f('0x40')]||_0x1a1f('0x108'),'role':_0x311630['role'],'internal':_0x311630[_0x1a1f('0x63')]});});return db[_0x1a1f('0xfd')][_0x1a1f('0x89')](_0x3f5055,{'individualHooks':!![]});})[_0x1a1f('0x1f')](function(){return _0x311630[_0x1a1f('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x232863[_0x1a1f('0x5e')][_0x1a1f('0x40')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0x1a1f('0x102'))});})[_0x1a1f('0x1f')](respondWithResult(_0x4a806c,null))[_0x1a1f('0x29')](handleError(_0x4a806c,null));};exports[_0x1a1f('0x109')]=function(_0x4b4d56,_0x5dd812){if(_0x4b4d56[_0x1a1f('0x5e')][_0x1a1f('0x99')]&&!utils['isValidChannel'](_0x4b4d56['body'][_0x1a1f('0x99')])){throw new APIBadRequestError(util[_0x1a1f('0xa6')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x4b4d56['body']['channel']));}return db[_0x1a1f('0x3f')][_0x1a1f('0x39')]({'where':{'id':_0x4b4d56[_0x1a1f('0x5b')]['id']},'attributes':['id',_0x1a1f('0x3a'),_0x1a1f('0x2f'),_0x1a1f('0x63'),_0x1a1f('0xa5'),'online',_0x1a1f('0x9c'),_0x1a1f('0x10a'),_0x1a1f('0x10b'),_0x1a1f('0x10c'),'openchannelPause',_0x1a1f('0x10d'),_0x1a1f('0x10e'),_0x1a1f('0x10f'),_0x1a1f('0x110')]})[_0x1a1f('0x1f')](function(_0x6b923b){if(!_0x6b923b){throw new APINotFoundError(util[_0x1a1f('0xa6')](_0x1a1f('0xc7'),_0x4b4d56[_0x1a1f('0x5b')]['id']));}return _0x6b923b[_0x1a1f('0x109')](_0x4b4d56['body'][_0x1a1f('0x99')]);})[_0x1a1f('0x1f')](respondWithResult(_0x5dd812,null))[_0x1a1f('0x29')](APIHandleError(_0x5dd812));};exports[_0x1a1f('0x111')]=function(_0x54aba5,_0x1afe67){var _0x416ba0={};var _0x1dca0d={};var _0x3d9dea;var _0x1a59ba;return db[_0x1a1f('0x3f')][_0x1a1f('0x93')]({'where':{'id':_0x54aba5[_0x1a1f('0x5b')]['id']}})[_0x1a1f('0x1f')](handleEntityNotFound(_0x1afe67,null))['then'](function(_0x2fbd91){if(_0x2fbd91){_0x3d9dea=_0x2fbd91;_0x1dca0d[_0x1a1f('0xcf')]=_['keys'](db[_0x1a1f('0x112')]['rawAttributes']);_0x1dca0d['query']=_['keys'](_0x54aba5[_0x1a1f('0x4e')]);_0x1dca0d['filters']=_[_0x1a1f('0xd4')](_0x1dca0d[_0x1a1f('0xcf')],_0x1dca0d[_0x1a1f('0x4e')]);_0x416ba0[_0x1a1f('0x4b')]=_[_0x1a1f('0xd4')](_0x1dca0d[_0x1a1f('0xcf')],qs[_0x1a1f('0xd5')](_0x54aba5[_0x1a1f('0x4e')][_0x1a1f('0xd5')]));_0x416ba0[_0x1a1f('0x4b')]=_0x416ba0['attributes']['length']?_0x416ba0[_0x1a1f('0x4b')]:_0x1dca0d[_0x1a1f('0xcf')];_0x416ba0['order']=qs[_0x1a1f('0xd6')](_0x54aba5[_0x1a1f('0x4e')][_0x1a1f('0xd6')]);_0x416ba0[_0x1a1f('0xd8')]=qs[_0x1a1f('0xd3')](_[_0x1a1f('0xd7')](_0x54aba5['query'],_0x1dca0d[_0x1a1f('0xd3')]));if(_0x54aba5[_0x1a1f('0x4e')][_0x1a1f('0x35')]){_0x416ba0[_0x1a1f('0xd8')]=_[_0x1a1f('0xd9')](_0x416ba0[_0x1a1f('0xd8')],{'$or':_[_0x1a1f('0x36')](_0x416ba0[_0x1a1f('0x4b')],function(_0x8f2854){var _0x1ed287={};_0x1ed287[_0x8f2854]={'$like':'%'+_0x54aba5[_0x1a1f('0x4e')][_0x1a1f('0x35')]+'%'};return _0x1ed287;})});}_0x416ba0=_[_0x1a1f('0xd9')]({},_0x416ba0,_0x54aba5[_0x1a1f('0xdd')]);return _0x3d9dea[_0x1a1f('0x111')](_0x416ba0);}})[_0x1a1f('0x1f')](function(_0x3b38a0){if(_0x3b38a0){_0x1a59ba=_0x3b38a0[_0x1a1f('0x50')];if(!_0x54aba5[_0x1a1f('0x4e')][_0x1a1f('0xc8')]('nolimit')){_0x416ba0[_0x1a1f('0x1a')]=qs[_0x1a1f('0x1a')](_0x54aba5['query'][_0x1a1f('0x1a')]);_0x416ba0[_0x1a1f('0x18')]=qs[_0x1a1f('0x18')](_0x54aba5['query'][_0x1a1f('0x18')]);}return _0x3d9dea[_0x1a1f('0x111')](_0x416ba0);}})[_0x1a1f('0x1f')](function(_0x39eadb){if(_0x39eadb){return _0x39eadb?{'count':_0x1a59ba,'rows':_0x39eadb}:null;}})[_0x1a1f('0x1f')](respondWithResult(_0x1afe67,null))[_0x1a1f('0x29')](handleError(_0x1afe67,null));};exports[_0x1a1f('0x113')]=function(_0x3504fe,_0x4ba148){var _0x5a1459=_0x3504fe[_0x1a1f('0x5b')]['id'];var _0x44da3b=_0x3504fe[_0x1a1f('0x5e')]?_0x3504fe[_0x1a1f('0x5e')][_0x1a1f('0x61')]:null;var _0x54652c=[];return Promise[_0x1a1f('0x104')]()[_0x1a1f('0x1f')](function(){if(!_0x44da3b)throw new APIBadRequestError(_0x1a1f('0x114'));})['then'](function(){return db[_0x1a1f('0x3f')][_0x1a1f('0x93')]({'where':{'id':_0x5a1459}});})[_0x1a1f('0x1f')](function(_0x503122){if(!_0x503122)throw new APINotFoundError(util[_0x1a1f('0xa6')](_0x1a1f('0xc7'),_0x3504fe[_0x1a1f('0x5b')]['id']));return db[_0x1a1f('0x68')][_0x1a1f('0xf9')](function(_0x48335e){return _0x503122[_0x1a1f('0x113')](_0x44da3b,{'transaction':_0x48335e})[_0x1a1f('0x1f')](function(){return db[_0x1a1f('0x112')][_0x1a1f('0x4c')]({'where':{'id':{'$in':_0x44da3b}}});})['then'](function(_0x5f4ecb){var _0x2e657d=_[_0x1a1f('0x36')](_0x5f4ecb,function(_0x3acd57){return _0x3acd57[_0x1a1f('0x115')]();});return Promise[_0x1a1f('0x59')](_0x2e657d);})[_0x1a1f('0x1f')](function(_0x5c4152){_0x54652c=_[_0x1a1f('0x116')](_0x5c4152);var _0x52bbcb=_[_0x1a1f('0x36')](_0x54652c,function(_0xb9ec37){return _0xb9ec37[_0x1a1f('0x117')](_0x503122['id'],{'transaction':_0x48335e});});return Promise['all'](_0x52bbcb);})[_0x1a1f('0x1f')](function(){if(!_0x503122['online'])return;var _0x2cdda9=_[_0x1a1f('0x35')](_0x54652c,function(_0x352368){return _0x352368[_0x1a1f('0x118')]('channel')===_0x1a1f('0x119');});var _0xf7525b=_[_0x1a1f('0x36')](_0x2cdda9,function(_0x2d9350){return db[_0x1a1f('0xa8')][_0x1a1f('0xa9')]({'membername':_0x503122[_0x1a1f('0x3a')],'UserId':_0x503122['id'],'queue_name':_0x2d9350[_0x1a1f('0x3a')],'VoiceQueueId':_0x2d9350['id'],'interface':_[_0x1a1f('0x67')](_0x503122[_0x1a1f('0xa5')])?util['format']('SIP/%s',_0x503122['name']):_0x503122['interface'],'paused':_0x503122['voicePause']||![],'penalty':_0x503122[_0x1a1f('0xa1')]},{'transaction':_0x48335e});});return Promise['all'](_0xf7525b);})[_0x1a1f('0x1f')](function(){return db[_0x1a1f('0x11a')][_0x1a1f('0x4c')]({'where':{'teamId':{'$in':_0x44da3b}}});})[_0x1a1f('0x1f')](function(_0x591dfa){var _0x273fd8=_[_0x1a1f('0x36')](_0x591dfa,function(_0x31c330){return db[_0x1a1f('0x11b')][_0x1a1f('0x7e')]({'UserId':_0x503122['id'],'VoicePrefixId':_0x31c330[_0x1a1f('0x11c')]},{'transaction':_0x48335e});});return Promise[_0x1a1f('0x59')](_0x273fd8);});});})[_0x1a1f('0x1f')](function(){for(var _0x458a20=0x0;_0x458a20<_0x54652c[_0x1a1f('0x50')];_0x458a20++){var _0x261ff4=_0x54652c[_0x458a20]['getDataValue']('channel');var _0x4d2a48=_0x261ff4+_0x1a1f('0xaf');socket[_0x1a1f('0x2c')](_0x1a1f('0x31')+_0x261ff4+_0x1a1f('0xa2'),{'UserId':_0x5a1459,['queueField']:_0x54652c[_0x458a20]['id']});}})[_0x1a1f('0x1f')](respondWithStatusCode(_0x4ba148,null))['catch'](APIHandleError(_0x4ba148));};exports['removeTeams']=function(_0x570acc,_0x5bf030){var _0x453d52=_0x570acc[_0x1a1f('0x5b')]['id'];var _0x54ea75=null;if(_0x570acc[_0x1a1f('0x4e')][_0x1a1f('0x61')]){_0x54ea75=_[_0x1a1f('0xae')](_0x570acc[_0x1a1f('0x4e')][_0x1a1f('0x61')])?_0x570acc[_0x1a1f('0x4e')]['ids']:[_0x570acc[_0x1a1f('0x4e')][_0x1a1f('0x61')]];}var _0x212bf5=[];return Promise[_0x1a1f('0x104')]()[_0x1a1f('0x1f')](function(){if(!_0x54ea75)throw new APIBadRequestError(_0x1a1f('0x11d'));})['then'](function(){return db['User']['findOne']({'where':{'id':_0x453d52}});})[_0x1a1f('0x1f')](function(_0x1b74df){if(!_0x1b74df)throw new APINotFoundError(util[_0x1a1f('0xa6')]('User\x20with\x20id\x20%s\x20not\x20found',_0x570acc['params']['id']));return db[_0x1a1f('0x68')]['transaction'](function(_0x2a3a5c){return _0x1b74df['removeTeams'](_0x54ea75,{'transaction':_0x2a3a5c})[_0x1a1f('0x1f')](function(){return db[_0x1a1f('0x112')][_0x1a1f('0x4c')]({'where':{'id':{'$in':_0x54ea75}}});})[_0x1a1f('0x1f')](function(_0x4d3f3f){var _0x15b479=_[_0x1a1f('0x36')](_0x4d3f3f,function(_0x366f50){return _0x366f50[_0x1a1f('0x115')]();});return Promise[_0x1a1f('0x59')](_0x15b479);})[_0x1a1f('0x1f')](function(_0x52b4a9){_0x212bf5=_[_0x1a1f('0x116')](_0x52b4a9);var _0x39964d=_[_0x1a1f('0x36')](_0x212bf5,function(_0x33eec4){return _0x33eec4[_0x1a1f('0x11e')](_0x1b74df['id'],{'transaction':_0x2a3a5c});});return Promise['all'](_0x39964d);})['then'](function(){if(!_0x1b74df[_0x1a1f('0x9a')])return;var _0xba1085=_[_0x1a1f('0x35')](_0x212bf5,function(_0x3abe5c){return _0x3abe5c[_0x1a1f('0x118')](_0x1a1f('0x99'))===_0x1a1f('0x119');});var _0x116bec=_[_0x1a1f('0x36')](_0xba1085,function(_0x3c2778){return db[_0x1a1f('0xa8')][_0x1a1f('0x3c')]({'where':{'VoiceQueueId':_0x3c2778['id'],'UserId':_0x1b74df['id']},'transaction':_0x2a3a5c});});return Promise[_0x1a1f('0x59')](_0x116bec);})[_0x1a1f('0x1f')](function(){return db[_0x1a1f('0x11a')][_0x1a1f('0x4c')]({'where':{'teamId':{'$in':_0x54ea75}}});})[_0x1a1f('0x1f')](function(_0x1d0f02){var _0x3b8d58=_[_0x1a1f('0x36')](_0x1d0f02,function(_0x3f8e89){return db[_0x1a1f('0x11b')][_0x1a1f('0x3c')]({'where':{'UserId':_0x1b74df['id'],'VoicePrefixId':_0x3f8e89[_0x1a1f('0x11c')]}},{'transaction':_0x2a3a5c});});return Promise[_0x1a1f('0x59')](_0x3b8d58);});});})[_0x1a1f('0x1f')](function(){for(var _0x428608=0x0;_0x428608<_0x212bf5[_0x1a1f('0x50')];_0x428608++){var _0x452362=_0x212bf5[_0x428608]['getDataValue'](_0x1a1f('0x99'));var _0x266ab3=_0x452362+'QueueId';socket[_0x1a1f('0x2c')]('user'+_0x452362+_0x1a1f('0xb0'),{'UserId':_0x453d52,['queueField']:_0x212bf5[_0x428608]['id']});}})[_0x1a1f('0x1f')](respondWithStatusCode(_0x5bf030,null))[_0x1a1f('0x29')](APIHandleError(_0x5bf030));};exports[_0x1a1f('0x11f')]=function(_0x2dfa5c,_0x59ed27){var _0x334b29={};var _0x2a8d59={};var _0x46e34d;var _0x37e844;return db[_0x1a1f('0x3f')][_0x1a1f('0x93')]({'where':{'id':_0x2dfa5c[_0x1a1f('0x5b')]['id']}})['then'](handleEntityNotFound(_0x59ed27,null))[_0x1a1f('0x1f')](function(_0x1698a4){if(_0x1698a4){_0x46e34d=_0x1698a4;_0x2a8d59[_0x1a1f('0xcf')]=_['keys'](db['CmList']['rawAttributes']);_0x2a8d59['query']=_[_0x1a1f('0xd0')](_0x2dfa5c[_0x1a1f('0x4e')]);_0x2a8d59['filters']=_[_0x1a1f('0xd4')](_0x2a8d59[_0x1a1f('0xcf')],_0x2a8d59[_0x1a1f('0x4e')]);_0x334b29[_0x1a1f('0x4b')]=_['intersection'](_0x2a8d59[_0x1a1f('0xcf')],qs['fields'](_0x2dfa5c['query']['fields']));_0x334b29[_0x1a1f('0x4b')]=_0x334b29['attributes'][_0x1a1f('0x50')]?_0x334b29[_0x1a1f('0x4b')]:_0x2a8d59[_0x1a1f('0xcf')];_0x334b29[_0x1a1f('0xdc')]=qs[_0x1a1f('0xd6')](_0x2dfa5c[_0x1a1f('0x4e')]['sort']);_0x334b29['where']=qs[_0x1a1f('0xd3')](_[_0x1a1f('0xd7')](_0x2dfa5c['query'],_0x2a8d59[_0x1a1f('0xd3')]));if(_0x2dfa5c['query'][_0x1a1f('0x35')]){_0x334b29[_0x1a1f('0xd8')]=_[_0x1a1f('0xd9')](_0x334b29[_0x1a1f('0xd8')],{'$or':_[_0x1a1f('0x36')](_0x334b29['attributes'],function(_0x4a3cd5){var _0x16edf0={};_0x16edf0[_0x4a3cd5]={'$like':'%'+_0x2dfa5c[_0x1a1f('0x4e')][_0x1a1f('0x35')]+'%'};return _0x16edf0;})});}_0x334b29=_[_0x1a1f('0xd9')]({},_0x334b29,_0x2dfa5c['options']);return _0x46e34d[_0x1a1f('0x11f')](_0x334b29);}})[_0x1a1f('0x1f')](function(_0x2e846e){if(_0x2e846e){_0x37e844=_0x2e846e[_0x1a1f('0x50')];if(!_0x2dfa5c[_0x1a1f('0x4e')]['hasOwnProperty'](_0x1a1f('0xde'))){_0x334b29[_0x1a1f('0x1a')]=qs[_0x1a1f('0x1a')](_0x2dfa5c[_0x1a1f('0x4e')]['limit']);_0x334b29[_0x1a1f('0x18')]=qs['offset'](_0x2dfa5c['query'][_0x1a1f('0x18')]);}return _0x46e34d['getLists'](_0x334b29);}})[_0x1a1f('0x1f')](function(_0x954edf){if(_0x954edf){return _0x954edf?{'count':_0x37e844,'rows':_0x954edf}:null;}})[_0x1a1f('0x1f')](respondWithResult(_0x59ed27,null))[_0x1a1f('0x29')](handleError(_0x59ed27,null));};exports[_0x1a1f('0x120')]=function(_0x17f26c,_0x40ede7){var _0x4569f9={};var _0x5dbcd0={};var _0x2a0c02;return db[_0x1a1f('0x3f')][_0x1a1f('0x93')]({'where':{'id':_0x17f26c['params']['id']}})[_0x1a1f('0x1f')](handleEntityNotFound(_0x40ede7,null))['then'](function(_0x203b4c){if(_0x203b4c){_0x2a0c02=_0x203b4c;_0x5dbcd0[_0x1a1f('0xcf')]=_[_0x1a1f('0xd0')](db[_0x1a1f('0x3f')]['rawAttributes']);_0x5dbcd0[_0x1a1f('0x4e')]=_[_0x1a1f('0xd0')](_0x17f26c['query']);_0x5dbcd0[_0x1a1f('0xd3')]=_[_0x1a1f('0xd4')](_0x5dbcd0['model'],_0x5dbcd0['query']);_0x4569f9[_0x1a1f('0x4b')]=_[_0x1a1f('0xd4')](_0x5dbcd0[_0x1a1f('0xcf')],qs['fields'](_0x17f26c['query'][_0x1a1f('0xd5')]));_0x4569f9[_0x1a1f('0x4b')]=_0x4569f9[_0x1a1f('0x4b')]['length']?_0x4569f9[_0x1a1f('0x4b')]:_0x5dbcd0[_0x1a1f('0xcf')];_0x4569f9[_0x1a1f('0xdc')]=qs[_0x1a1f('0xd6')](_0x17f26c['query'][_0x1a1f('0xd6')]);_0x4569f9[_0x1a1f('0xd8')]=qs['filters'](_['pick'](_0x17f26c[_0x1a1f('0x4e')],_0x5dbcd0[_0x1a1f('0xd3')]));if(_0x17f26c[_0x1a1f('0x4e')][_0x1a1f('0x35')]){_0x4569f9[_0x1a1f('0xd8')]=_[_0x1a1f('0xd9')](_0x4569f9['where'],{'$or':_[_0x1a1f('0x36')](_0x4569f9[_0x1a1f('0x4b')],function(_0x24892a){var _0x44c4c4={};_0x44c4c4[_0x24892a]={'$like':'%'+_0x17f26c[_0x1a1f('0x4e')][_0x1a1f('0x35')]+'%'};return _0x44c4c4;})});}_0x4569f9['model']=db[_0x1a1f('0x3f')];_0x4569f9['as']=_0x1a1f('0x32');_0x4569f9=_[_0x1a1f('0xd9')]({},_0x4569f9,_0x17f26c[_0x1a1f('0xdd')]);return _0x2a0c02['getVoiceQueues']({'include':[_0x4569f9]});}})[_0x1a1f('0x1f')](function(_0x41b8d1){if(_0x41b8d1){var _0x5b389f={},_0x2cb006=[];for(var _0x2d24d0=0x0;_0x2d24d0<_0x41b8d1[_0x1a1f('0x50')];_0x2d24d0+=0x1){for(var _0x410712=0x0,_0xbf6059;_0x410712<_0x41b8d1[_0x2d24d0][_0x1a1f('0x32')][_0x1a1f('0x50')];_0x410712+=0x1){_0xbf6059=_0x41b8d1[_0x2d24d0][_0x1a1f('0x32')][_0x410712]['get']({'plain':!![]});_0x5b389f[_0xbf6059['id']]=_0xbf6059;}}_0x5b389f=_[_0x1a1f('0x121')](_0x5b389f);for(var _0x57c230=qs[_0x1a1f('0x18')](_0x17f26c['query']['offset']);_0x57c230<_0x5b389f[_0x1a1f('0x50')]&&_0x2cb006[_0x1a1f('0x50')]=_0x50752b){_0x5508e9=_0x50752b;_0xbcdaf0=0xc8;}else{_0xbcdaf0=0xce;}_0x4ebf1c[_0x66d6('0x18')](_0xbcdaf0);return _0x4ebf1c[_0x66d6('0x1e')](_0x66d6('0x1f'),_0x3d1aff+'-'+_0x5508e9+'/'+_0x50752b)[_0x66d6('0x19')](_0x42ffd2);}return null;};}function respondWithRpcPromise(_0x4b9850,_0x53291a,_0x1f0be0,_0x457db1){return new Promise(function(_0x173088,_0x3a3bb8){var _0x1a722e=_0x457db1||amiClient;return _0x1a722e[_0x66d6('0x20')](_0x4b9850,_0x1f0be0)[_0x66d6('0x21')](function(_0x46d9e2){logger[_0x66d6('0x22')](_0x66d6('0x23'),_0x53291a,_0x66d6('0x24'));logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x53291a,_0x66d6('0x24'),JSON[_0x66d6('0x25')](_0x46d9e2));if(_0x46d9e2['error']){if(_0x46d9e2[_0x66d6('0x26')][_0x66d6('0x27')]===0x1f4){logger[_0x66d6('0x26')]('User,\x20%s,\x20%s',_0x53291a,_0x46d9e2[_0x66d6('0x26')][_0x66d6('0x28')]);return _0x3a3bb8(_0x46d9e2[_0x66d6('0x26')][_0x66d6('0x28')]);}logger[_0x66d6('0x26')]('User,\x20%s,\x20%s',_0x53291a,_0x46d9e2[_0x66d6('0x26')][_0x66d6('0x28')]);return _0x173088(_0x46d9e2[_0x66d6('0x26')][_0x66d6('0x28')]);}else{logger[_0x66d6('0x22')](_0x66d6('0x23'),_0x53291a,_0x66d6('0x24'));_0x173088(_0x46d9e2['result'][_0x66d6('0x28')]);}})['catch'](function(_0x407f04){logger[_0x66d6('0x26')]('User,\x20%s,\x20%s',_0x53291a,_0x407f04);_0x3a3bb8(_0x407f04);});});}function saveUpdates(_0x2ea036){return function(_0x1c4603){if(_0x1c4603){return _0x1c4603[_0x66d6('0x29')](_0x2ea036)[_0x66d6('0x21')](function(_0x37e4e7){if(_0x37e4e7[_0x66d6('0x2a')]===_0x66d6('0x2b')){socket[_0x66d6('0x2c')]('userNotification:recalc:'+_0x37e4e7['id'],_0x37e4e7);}return _0x37e4e7;});}return null;};}function removeEntity(_0x4bb34e,_0x2b8908){return function(_0x5d04fe){if(_0x5d04fe){return _0x5d04fe['destroy']({'transaction':_0x2b8908})[_0x66d6('0x21')](function(){var _0x20b604=_0x5d04fe[_0x66d6('0x2d')]({'plain':!![]});if(_0x20b604[_0x66d6('0x2a')]===_0x66d6('0x2e'))return;var _0x441049=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x66d6('0x2f'),'value':_0x66d6('0x2b'),'ignore':![]},{'name':_0x66d6('0x30'),'value':_0x66d6('0x31'),'ignore':![]}];var _0x1061da=_(_0x441049)[_0x66d6('0x32')](_0x66d6('0x33'))[_0x66d6('0x34')](_0x66d6('0x35'))[_0x66d6('0x35')]();if(_[_0x66d6('0x36')](_0x1061da,_0x20b604[_0x66d6('0x2a')])){return;}var _0xf554f1=_[_0x66d6('0x37')](_0x441049,[_0x66d6('0x35'),_0x20b604[_0x66d6('0x2a')]])[_0x66d6('0x38')];return db[_0x66d6('0x39')]['destroy']({'where':{'type':_0xf554f1,'resourceId':_0x20b604['id']},'transaction':_0x2b8908})[_0x66d6('0x21')](function(){return _0x5d04fe;});})[_0x66d6('0x21')](function(){_0x4bb34e[_0x66d6('0x18')](0xcc)[_0x66d6('0x3a')]();});}};}function handleEntityNotFound(_0x29bb56){return function(_0x479395){if(!_0x479395){_0x29bb56[_0x66d6('0x3b')](0x194);}return _0x479395;};}function handleError(_0x4176b0,_0x5e5169){_0x5e5169=_0x5e5169||0x1f4;return function(_0x204964){logger[_0x66d6('0x26')](_0x204964['stack']);if(_0x204964[_0x66d6('0x38')]){delete _0x204964[_0x66d6('0x38')];}_0x4176b0[_0x66d6('0x18')](_0x5e5169)[_0x66d6('0x3c')](_0x204964);};}function getUserAttributes(){return _(db['User'][_0x66d6('0x3d')])[_0x66d6('0x34')](function(_0x2c4b85){return{'name':_0x2c4b85[_0x66d6('0x3e')],'type':_0x2c4b85[_0x66d6('0x3f')]['key']};})['filter'](function(_0x2b5c72){return![_0x66d6('0x40'),_0x66d6('0x41'),_0x66d6('0x42'),_0x66d6('0x43'),_0x66d6('0x44'),_0x66d6('0x45')]['includes'](_0x2b5c72[_0x66d6('0x38')]);})['value']();}exports['index']=function(_0x2df98a,_0x54f268){var _0x375253={},_0x36d01d={'count':0x0,'rows':[]};var _0x1f3cdd=getUserAttributes();_0x375253=qs['getOptions'](_0x1f3cdd,_0x2df98a);var _0x4cb66a={'where':_0x375253[_0x66d6('0x46')]};return db['User'][_0x66d6('0x1c')](_0x4cb66a)[_0x66d6('0x21')](function(_0x5cf95b){_0x36d01d['count']=_0x5cf95b;if(_0x2df98a[_0x66d6('0x47')]['includeAll']){_0x375253[_0x66d6('0x48')]=[{'all':!![]}];}if(_0x2df98a[_0x66d6('0x47')]['userSetting']===_0x66d6('0x49')){_0x375253[_0x66d6('0x48')]=[{'model':db[_0x66d6('0x4a')],'as':_0x66d6('0x4b')}];}if(!_[_0x66d6('0x36')](_0x375253[_0x66d6('0x4c')],'id')){_0x375253['attributes'][_0x66d6('0x4d')]('id');}return db[_0x66d6('0x4e')][_0x66d6('0x4f')](_0x375253);})['then'](function(_0x4b3231){_0x36d01d[_0x66d6('0x50')]=_0x4b3231;if(_0x2df98a[_0x66d6('0x47')][_0x66d6('0x51')]==='true'){var _0x3adc4b=[];for(var _0x255e2d=0x0;_0x255e2d<_0x36d01d[_0x66d6('0x50')][_0x66d6('0x52')];_0x255e2d++){_0x3adc4b[_0x66d6('0x4d')](get_open_tabs(_0x66d6('0x53'),_0x36d01d[_0x66d6('0x50')][_0x255e2d][_0x66d6('0x54')]));_0x3adc4b[_0x66d6('0x4d')](get_open_tabs('sms',_0x36d01d['rows'][_0x255e2d][_0x66d6('0x54')]));_0x3adc4b[_0x66d6('0x4d')](get_open_tabs(_0x66d6('0x55'),_0x36d01d['rows'][_0x255e2d][_0x66d6('0x54')]));_0x3adc4b['push'](get_open_tabs(_0x66d6('0x56'),_0x36d01d[_0x66d6('0x50')][_0x255e2d][_0x66d6('0x54')]));_0x3adc4b['push'](get_open_tabs(_0x66d6('0x57'),_0x36d01d[_0x66d6('0x50')][_0x255e2d][_0x66d6('0x54')]));_0x3adc4b[_0x66d6('0x4d')](get_open_tabs('whatsapp',_0x36d01d['rows'][_0x255e2d][_0x66d6('0x54')]));}return Promise[_0x66d6('0x58')](_0x3adc4b)['then'](function(){return _0x36d01d;});}else{return _0x36d01d;}})['then'](respondWithFilteredResult(_0x54f268,_0x375253))[_0x66d6('0x59')](handleError(_0x54f268,null));};exports[_0x66d6('0x5a')]=function(_0x3687b7,_0x5c7515){var _0x9ed35c=getUserAttributes();_0x3687b7[_0x66d6('0x47')]['id']=_0x3687b7[_0x66d6('0x5b')]['id'];var _0x2d56a8=qs[_0x66d6('0x5c')](_0x9ed35c,_0x3687b7);if(_0x3687b7['query'][_0x66d6('0x5d')]){_0x2d56a8[_0x66d6('0x48')]=[{'all':!![]}];}if(_0x3687b7[_0x66d6('0x47')][_0x66d6('0x4b')]==='true'){_0x2d56a8[_0x66d6('0x48')]=[{'model':db[_0x66d6('0x4a')],'as':_0x66d6('0x4b')}];}_0x2d56a8=_[_0x66d6('0x5e')]({},_0x2d56a8,_0x3687b7[_0x66d6('0x5f')]);if(!_[_0x66d6('0x36')](_0x2d56a8['attributes'],'id')){_0x2d56a8[_0x66d6('0x4c')][_0x66d6('0x4d')]('id');}return db[_0x66d6('0x4e')][_0x66d6('0x37')](_0x2d56a8)[_0x66d6('0x21')](handleEntityNotFound(_0x5c7515,null))[_0x66d6('0x21')](function(_0x268e3c){var _0xe97c5e=[];values=_0x268e3c;if(_0x3687b7['query']['openTabs']===_0x66d6('0x49')){_0xe97c5e[_0x66d6('0x4d')](get_open_tabs(_0x66d6('0x53'),_0x268e3c[_0x66d6('0x54')]));_0xe97c5e['push'](get_open_tabs(_0x66d6('0x60'),_0x268e3c[_0x66d6('0x54')]));_0xe97c5e['push'](get_open_tabs(_0x66d6('0x57'),_0x268e3c[_0x66d6('0x54')]));_0xe97c5e[_0x66d6('0x4d')](get_open_tabs('whatsapp',_0x268e3c['dataValues']));_0xe97c5e[_0x66d6('0x4d')](get_open_tabs('fax',_0x268e3c[_0x66d6('0x54')]));_0xe97c5e[_0x66d6('0x4d')](get_open_tabs(_0x66d6('0x56'),_0x268e3c[_0x66d6('0x54')]));return Promise[_0x66d6('0x58')](_0xe97c5e);}else{return values;}})[_0x66d6('0x21')](function(){return values;})[_0x66d6('0x21')](respondWithResult(_0x5c7515,null))[_0x66d6('0x59')](handleError(_0x5c7515,null));};exports['update']=function(_0x5ceb7b,_0x41f750){if(_0x5ceb7b[_0x66d6('0x61')]['id']){delete _0x5ceb7b[_0x66d6('0x61')]['id'];}delete _0x5ceb7b[_0x66d6('0x61')][_0x66d6('0x2a')];return db[_0x66d6('0x4e')][_0x66d6('0x37')]({'where':{'id':_0x5ceb7b['params']['id']}})[_0x66d6('0x21')](handleEntityNotFound(_0x41f750,null))[_0x66d6('0x21')](saveUpdates(_0x5ceb7b[_0x66d6('0x61')],null))[_0x66d6('0x21')](respondWithResult(_0x41f750,null))[_0x66d6('0x59')](handleError(_0x41f750,null));};exports['describe']=function(_0x2611a2,_0x24c317){return db[_0x66d6('0x4e')][_0x66d6('0x62')]()[_0x66d6('0x21')](respondWithResult(_0x24c317,null))[_0x66d6('0x59')](handleError(_0x24c317,null));};exports[_0x66d6('0x63')]=function(_0xcfad2,_0x13d62e){return db[_0x66d6('0x4e')][_0x66d6('0x37')]({'where':{'id':_0xcfad2[_0x66d6('0x5b')]['id']}})[_0x66d6('0x21')](handleEntityNotFound(_0x13d62e,null))[_0x66d6('0x21')](function(_0x1e8369){if(_0x1e8369){return _0x1e8369[_0x66d6('0x63')](_0xcfad2[_0x66d6('0x61')][_0x66d6('0x64')],_[_0x66d6('0x65')](_0xcfad2['body'],['ids','id'])||{});}})[_0x66d6('0x21')](respondWithResult(_0x13d62e,null))[_0x66d6('0x59')](handleError(_0x13d62e,null));};function validateUser(_0x43ad59){return new Promise(function(_0x10b1cf,_0x2a1ce6){if(_0x43ad59['internal'])return _0x10b1cf(_0x43ad59);return db[_0x66d6('0x66')][_0x66d6('0x67')](0x1)[_0x66d6('0x21')](function(_0x222b29){if(_0x222b29[_0x66d6('0x68')])authService[_0x66d6('0x69')](_0x43ad59[_0x66d6('0x40')]);db[_0x66d6('0x4e')]['max'](_0x66d6('0x6a'))[_0x66d6('0x21')](function(_0x52f189){if(_[_0x66d6('0x6b')](_0x52f189)){_0x43ad59['internal']=_0x222b29[_0x66d6('0x6c')]||0x1;return;}if(_[_0x66d6('0x6b')](_0x222b29[_0x66d6('0x6c')])||_0x222b29['min_internal']===_0x52f189){_0x43ad59['internal']=_0x52f189+0x1;return;}if(_0x222b29[_0x66d6('0x6c')]>_0x52f189){_0x43ad59[_0x66d6('0x6a')]=_0x222b29[_0x66d6('0x6c')];return;}return db['sequelize']['query'](_0x66d6('0x6d'),{'type':db['sequelize']['QueryTypes'][_0x66d6('0x6e')]})['then'](function(_0xcb7741){if(_0xcb7741&&_0xcb7741[_0x66d6('0x52')]){for(var _0x36a8c7=0x0,_0x411d10=_0xcb7741['length'];_0x36a8c7<_0x411d10&&_[_0x66d6('0x6b')](_0x43ad59[_0x66d6('0x6a')]);_0x36a8c7++){if(_0x222b29[_0x66d6('0x6c')]<=_0xcb7741[_0x36a8c7][_0x66d6('0x6f')]){_0x43ad59[_0x66d6('0x6a')]=_0xcb7741[_0x36a8c7]['from'];}else if(_0x222b29[_0x66d6('0x6c')]>_0xcb7741[_0x36a8c7][_0x66d6('0x6f')]&&_0x222b29[_0x66d6('0x6c')]<=_0xcb7741[_0x36a8c7]['to']){_0x43ad59[_0x66d6('0x6a')]=_0x222b29[_0x66d6('0x6c')];}}}if(_[_0x66d6('0x6b')](_0x43ad59['internal'])){_0x43ad59[_0x66d6('0x6a')]=_0x52f189+0x1;}return _0x10b1cf(_0x43ad59);});});})['catch'](function(_0xeaa9b2){_0x2a1ce6(_0xeaa9b2);});});}function updateUser(_0x196d9f){return new Promise(function(_0x2ad84e,_0x2f2297){try{if(_0x196d9f[_0x66d6('0x70')]){_0x196d9f['mailbox']=_0x196d9f[_0x66d6('0x6a')];_0x196d9f['VoiceMail']={'mailbox':_0x196d9f[_0x66d6('0x6a')],'password':_0x196d9f[_0x66d6('0x40')],'fullname':_0x196d9f[_0x66d6('0x71')],'email':_0x196d9f[_0x66d6('0x72')]};}if(_0x196d9f[_0x66d6('0x2a')]===_0x66d6('0x2b')){if(!_0x196d9f[_0x66d6('0x73')])_0x196d9f[_0x66d6('0x73')]=[_0x66d6('0x74'),_0x66d6('0x75'),'103',_0x66d6('0x76'),_0x66d6('0x77'),_0x66d6('0x78'),_0x66d6('0x79'),_0x66d6('0x7a'),_0x66d6('0x7b'),'108','109',_0x66d6('0x7c'),_0x66d6('0x7d'),_0x66d6('0x7e'),_0x66d6('0x7f')];}_0x2ad84e(_0x196d9f);}catch(_0x5d38da){_0x2f2297(_0x5d38da);}});}exports[_0x66d6('0x80')]=function(_0x21f695,_0x29ddc6){if(_0x21f695[_0x66d6('0x81')][_0x66d6('0x2a')]===_0x66d6('0x2b'))throw new Error(_0x66d6('0x82'));if(_0x21f695[_0x66d6('0x61')]['role']===_0x66d6('0x81')&&_0x21f695[_0x66d6('0x81')][_0x66d6('0x2a')]!==_0x66d6('0x2e')){throw new Error(_0x66d6('0x83'));}if(_0x21f695['body'][_0x66d6('0x2a')]===_0x66d6('0x2e')&&_0x21f695[_0x66d6('0x81')][_0x66d6('0x2a')]!==_0x66d6('0x2e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x66d6('0x84')]([_0x21f695[_0x66d6('0x61')]])['then'](function(){return validateUser(_0x21f695['body']);})[_0x66d6('0x21')](function(_0x1d58c9){return updateUser(_0x1d58c9)[_0x66d6('0x21')](function(_0x20403d){if(_0x20403d[_0x66d6('0x2a')]===_0x66d6('0x2e')){_0x20403d[_0x66d6('0x85')]=_0x21f695[_0x66d6('0x81')][_0x66d6('0x85')];delete _0x20403d['userProfileId'];}return _0x20403d;});})[_0x66d6('0x21')](function(_0x293dce){return db[_0x66d6('0x4e')][_0x66d6('0x80')](_0x293dce,{'include':[{'model':db[_0x66d6('0x86')],'as':_0x66d6('0x86')}]});})[_0x66d6('0x21')](function(_0x4dccc6){if(_0x21f695[_0x66d6('0x61')][_0x66d6('0x2a')]===_0x66d6('0x81'))return _0x4dccc6;if(_0x21f695[_0x66d6('0x81')]['role']!=='user')return _0x4dccc6;return db[_0x66d6('0x87')][_0x66d6('0x37')]({'where':{'name':_0x4dccc6[_0x66d6('0x2a')]==='agent'?_0x66d6('0x2f'):'Telephones','userProfileId':_0x21f695[_0x66d6('0x81')][_0x66d6('0x88')]},'raw':!![]})[_0x66d6('0x21')](function(_0x3ec196){if(!_0x3ec196||_0x3ec196[_0x66d6('0x89')]!=0x0)return _0x4dccc6;return db['UserProfileResource'][_0x66d6('0x80')]({'name':_0x4dccc6[_0x66d6('0x38')],'resourceId':_0x4dccc6['id'],'type':_0x3ec196[_0x66d6('0x38')],'sectionId':_0x3ec196['id']},{})['then'](function(){return _0x4dccc6;});})['catch'](function(_0x320098){logger[_0x66d6('0x26')](_0x66d6('0x8a'),_0x320098);throw _0x320098;});})[_0x66d6('0x21')](respondWithResult(_0x29ddc6,0xc9))[_0x66d6('0x59')](handleError(_0x29ddc6,null));};exports[_0x66d6('0x8b')]=function(_0x4bb898,_0x4dd948){var _0x181d74=_0x4bb898['body'];var _0x3106a0=[];if(_0x4bb898[_0x66d6('0x81')][_0x66d6('0x2a')]==='agent')throw new Error(_0x66d6('0x82'));if(_[_0x66d6('0x8c')](_0x181d74,[_0x66d6('0x2a'),_0x66d6('0x81')])&&_0x4bb898[_0x66d6('0x81')][_0x66d6('0x2a')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x66d6('0x8c')](_0x181d74,['role','admin'])&&_0x4bb898[_0x66d6('0x81')][_0x66d6('0x2a')]!==_0x66d6('0x2e')){throw new Error(_0x66d6('0x8d'));}return licenseUtil[_0x66d6('0x84')](_0x181d74)['then'](function(){return validateUser(_0x181d74[0x0]);})[_0x66d6('0x21')](function(){for(var _0x5ea2ec=0x1;_0x5ea2ec<_0x181d74[_0x66d6('0x52')];_0x5ea2ec++){var _0x5ec43b=_0x181d74[_0x5ea2ec-0x1][_0x66d6('0x6a')];if(!_0x181d74[_0x5ea2ec][_0x66d6('0x6a')])_0x181d74[_0x5ea2ec]['internal']=_0x5ec43b+0x1;_0x3106a0['push'](validateUser(_0x181d74[_0x5ea2ec]));}return Promise['all'](_0x3106a0);})[_0x66d6('0x21')](function(){_0x3106a0=[];for(var _0x4e033a=0x0;_0x4e033a<_0x181d74[_0x66d6('0x52')];_0x4e033a++){_0x3106a0[_0x66d6('0x4d')](updateUser(_0x181d74[_0x4e033a]));}return Promise[_0x66d6('0x58')](_0x3106a0);})['then'](function(){_0x3106a0=_0x181d74[_0x66d6('0x34')](function(_0x4aa921){return db[_0x66d6('0x4e')]['create'](_0x4aa921,{'include':[{'model':db[_0x66d6('0x86')],'as':_0x66d6('0x86')}]})[_0x66d6('0x21')](function(_0x5b670f){_0x4aa921['id']=_0x5b670f['id'];return _0x4aa921;});});return Promise[_0x66d6('0x58')](_0x3106a0);})[_0x66d6('0x21')](function(_0x364225){if(_0x4bb898[_0x66d6('0x61')][_0x66d6('0x2a')]===_0x66d6('0x81'))return _0x364225;if(_0x4bb898[_0x66d6('0x81')][_0x66d6('0x2a')]!==_0x66d6('0x81'))return _0x364225;var _0x17847f=_[_0x66d6('0x8c')](_0x364225,function(_0x2e7156){return _0x2e7156[_0x66d6('0x2a')]===_0x66d6('0x2b')||_0x2e7156[_0x66d6('0x2a')]===_0x66d6('0x31');});if(!_0x17847f)return _0x364225;return db['UserProfileSection'][_0x66d6('0x4f')]({'where':{'name':{'$or':['Agents',_0x66d6('0x30')]},'userProfileId':_0x4bb898[_0x66d6('0x81')][_0x66d6('0x88')]},'raw':!![]})[_0x66d6('0x21')](function(_0x5d0ea5){if(_[_0x66d6('0x8e')](_0x5d0ea5)||!_['some'](_0x5d0ea5,[_0x66d6('0x89'),0x0]))return _0x364225;_0x3106a0=[];var _0x1dd9c1=_(_0x5d0ea5)[_0x66d6('0x34')](function(_0x599c3e){if(_0x599c3e[_0x66d6('0x89')]===0x1)return;return _0x599c3e[_0x66d6('0x38')]==='Agents'?_0x66d6('0x2b'):_0x66d6('0x31');})[_0x66d6('0x8f')]()[_0x66d6('0x35')]();for(var _0x1d8c4a=0x0;_0x1d8c4a<_0x364225[_0x66d6('0x52')];_0x1d8c4a++){if(!_[_0x66d6('0x36')](_0x1dd9c1,_0x364225[_0x1d8c4a]['role']))return;var _0x1ea49c=_0x364225[_0x1d8c4a][_0x66d6('0x2a')]===_0x66d6('0x2b')?_0x66d6('0x2f'):_0x66d6('0x30');_0x3106a0[_0x66d6('0x4d')](db[_0x66d6('0x39')][_0x66d6('0x80')]({'name':_0x364225[_0x1d8c4a][_0x66d6('0x38')],'resourceId':_0x364225[_0x1d8c4a]['id'],'type':_0x1ea49c,'sectionId':_[_0x66d6('0x37')](_0x5d0ea5,[_0x66d6('0x38'),_0x1ea49c])['id']},{}));}return Promise[_0x66d6('0x58')](_0x3106a0);});})[_0x66d6('0x21')](respondWithResult(_0x4dd948,0xc9))[_0x66d6('0x59')](handleError(_0x4dd948,null));};exports[_0x66d6('0x90')]=function(_0x3534a2,_0x2cfda2){if(_0x3534a2[_0x66d6('0x61')]['id']){delete _0x3534a2['body']['id'];}return db[_0x66d6('0x4e')][_0x66d6('0x37')]({'where':{'id':_0x3534a2[_0x66d6('0x5b')]['id']}})[_0x66d6('0x21')](function(_0x18b676){if(!_0x18b676)return null;if(_0x18b676['id']===_0x3534a2[_0x66d6('0x81')]['id']){if(!_0x3534a2[_0x66d6('0x61')]['oldPassword']||!_0x3534a2[_0x66d6('0x61')][_0x66d6('0x91')]){throw new db['Sequelize'][(_0x66d6('0x92'))](_0x66d6('0x93'));}if(!_0x18b676[_0x66d6('0x94')](_0x3534a2[_0x66d6('0x61')][_0x66d6('0x95')])){throw new db['Sequelize']['ValidationError'](_0x66d6('0x96'));}if(_0x3534a2['body']['oldPassword']===_0x3534a2[_0x66d6('0x61')][_0x66d6('0x91')]){throw new db[(_0x66d6('0x97'))]['ValidationError'](_0x66d6('0x98'));}}else if(_0x3534a2['user'][_0x66d6('0x2a')]===_0x66d6('0x2e')){if(!_0x3534a2[_0x66d6('0x61')][_0x66d6('0x91')]){throw new db['Sequelize'][(_0x66d6('0x92'))](_0x66d6('0x99'));}}else if(_0x3534a2[_0x66d6('0x81')][_0x66d6('0x2a')]==='user'){if(!_0x3534a2['body'][_0x66d6('0x91')]){throw new db[(_0x66d6('0x97'))]['ValidationError'](_0x66d6('0x99'));}if(_0x18b676[_0x66d6('0x2a')]!==_0x66d6('0x2b')){throw new db['Sequelize'][(_0x66d6('0x92'))](_0x66d6('0x82'));}}else{throw new db[(_0x66d6('0x97'))][(_0x66d6('0x92'))](_0x66d6('0x82'));}return _0x18b676;})[_0x66d6('0x21')](handleEntityNotFound(_0x2cfda2,null))[_0x66d6('0x21')](function(_0x5ae5bb){return db['Setting'][_0x66d6('0x9a')]({'attributes':['id','securePassword',_0x66d6('0x9b'),_0x66d6('0x9c')]})[_0x66d6('0x21')](function(_0x34b6da){if(_0x34b6da[_0x66d6('0x68')])authService[_0x66d6('0x69')](_0x3534a2[_0x66d6('0x61')][_0x66d6('0x91')]);if(!_0x34b6da[_0x66d6('0x9b')]||!_0x5ae5bb[_0x66d6('0x42')])return _0x5ae5bb;authService[_0x66d6('0x9d')](_0x3534a2[_0x66d6('0x61')]['newPassword'],_0x5ae5bb['previousPasswords'],_0x34b6da[_0x66d6('0x9c')]);return _0x5ae5bb;})[_0x66d6('0x21')](saveUpdates({'password':_0x3534a2['body'][_0x66d6('0x91')],'passwordResetAt':_0x3534a2[_0x66d6('0x81')]['id']==_0x3534a2[_0x66d6('0x5b')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x3534a2[_0x66d6('0x61')][_0x66d6('0x91')],_0x5ae5bb[_0x66d6('0x42')])},null));})[_0x66d6('0x21')](respondWithResult(_0x2cfda2,null))[_0x66d6('0x59')](handleError(_0x2cfda2,null));};exports['addQueues']=function(_0x5ca639,_0x3cb266){var _0x2ea3f7=_0x5ca639[_0x66d6('0x61')][_0x66d6('0x9e')];return db[_0x66d6('0x4e')][_0x66d6('0x37')]({'where':{'id':_0x5ca639[_0x66d6('0x5b')]['id']},'attributes':['id',_0x66d6('0x38'),_0x66d6('0x2a'),_0x66d6('0x9f'),_0x66d6('0xa0'),_0x66d6('0xa1'),_0x66d6('0xa2')]})[_0x66d6('0x21')](handleEntityNotFound(_0x3cb266,null))[_0x66d6('0x21')](function(_0x4bdd38){if(_0x4bdd38){if(!utils[_0x66d6('0xa3')](_0x2ea3f7)){throw new db[(_0x66d6('0x97'))][(_0x66d6('0x92'))]('Unknown\x20channel');}return _0x4bdd38['add'+_[_0x66d6('0xa4')](_0x2ea3f7[_0x66d6('0xa5')]())+_0x66d6('0xa6')](_0x5ca639[_0x66d6('0x61')][_0x66d6('0x64')],{'penalty':_0x5ca639[_0x66d6('0x61')][_0x66d6('0xa7')]||0x0})[_0x66d6('0xa8')](function(_0x5bae70){for(var _0x35eb9e=0x0;_0x35eb9e<_0x5ca639[_0x66d6('0x61')][_0x66d6('0x64')][_0x66d6('0x52')];_0x35eb9e+=0x1){var _0x4c92cd={'UserId':Number(_0x5ca639[_0x66d6('0x5b')]['id'])};_0x4c92cd[_[_0x66d6('0xa4')](_0x2ea3f7[_0x66d6('0xa5')]())+_0x66d6('0xa9')]=Number(_0x5ca639['body']['ids'][_0x35eb9e]);socket['emit'](_0x66d6('0x81')+_[_0x66d6('0xa4')](_0x2ea3f7['toLowerCase']())+_0x66d6('0xaa'),_0x4c92cd);}return _0x5bae70;})[_0x66d6('0x21')](function(){if(_0x2ea3f7===_0x66d6('0xab')){return db[_0x66d6('0xac')][_0x66d6('0x4f')]({'where':{'id':_0x5ca639[_0x66d6('0x61')][_0x66d6('0x64')]||[]},'raw':!![],'attributes':['id',_0x66d6('0x38')]});}})['then'](function(_0x5a58a1){var _0x49802d=_0x4bdd38[_0x66d6('0x2d')]({'plain':!![]});var _0x32a7e7=[];if(_0x2ea3f7===_0x66d6('0xab')&&_0x49802d[_0x66d6('0x2a')]==='agent'&&_0x49802d[_0x66d6('0x9f')]){for(let _0x590c36=0x0;_0x590c36<_0x5a58a1[_0x66d6('0x52')];_0x590c36+=0x1){_0x32a7e7[_0x66d6('0x4d')]({'membername':_0x49802d['name'],'UserId':_0x49802d['id'],'queue_name':_0x5a58a1[_0x590c36][_0x66d6('0x38')],'VoiceQueueId':_0x5a58a1[_0x590c36]['id'],'interface':_[_0x66d6('0x6b')](_0x49802d['interface'])?util[_0x66d6('0xad')]('SIP/%s',_0x49802d['name']):_0x49802d['interface'],'paused':_0x49802d['voicePause']||![],'penalty':_0x5ca639[_0x66d6('0x61')][_0x66d6('0xa7')]||0x0});}return Promise[_0x66d6('0x58')](_0x32a7e7[_0x66d6('0x34')](function(_0x2007e9){return db[_0x66d6('0xae')]['upsert'](_0x2007e9);}));}return _0x4bdd38;});}})[_0x66d6('0x21')](respondWithStatusCode(_0x3cb266,null))[_0x66d6('0x59')](handleError(_0x3cb266,null));};exports[_0x66d6('0xaf')]=function(_0x17731b,_0x47571d){var _0x3bb9b0,_0x695cdb;return db[_0x66d6('0x4e')][_0x66d6('0x37')]({'where':{'id':_0x17731b[_0x66d6('0x5b')]['id']},'attributes':['id',_0x66d6('0x38'),_0x66d6('0x2a')]})[_0x66d6('0x21')](handleEntityNotFound(_0x47571d,null))[_0x66d6('0x21')](function(_0x1bdcc7){if(_0x1bdcc7){_0x3bb9b0=_0x1bdcc7;if(!_0x17731b[_0x66d6('0x47')][_0x66d6('0x9e')]||!utils[_0x66d6('0xa3')](_0x17731b[_0x66d6('0x47')]['channel'])){throw new db['Sequelize'][(_0x66d6('0x92'))]('Unknown\x20channel');}return _0x1bdcc7[_0x66d6('0xb0')+_[_0x66d6('0xa4')](_0x17731b[_0x66d6('0x47')]['channel'][_0x66d6('0xa5')]())+_0x66d6('0xa6')](_0x17731b[_0x66d6('0x47')][_0x66d6('0x64')]);}})[_0x66d6('0x21')](function(_0x1ed840){if(_[_0x66d6('0xb1')](_0x17731b[_0x66d6('0x47')][_0x66d6('0x64')])){for(var _0x38c523=0x0;_0x38c523<_0x17731b[_0x66d6('0x47')][_0x66d6('0x64')][_0x66d6('0x52')];_0x38c523+=0x1){_0x695cdb={'UserId':Number(_0x17731b[_0x66d6('0x5b')]['id'])};_0x695cdb[_[_0x66d6('0xa4')](_0x17731b[_0x66d6('0x47')][_0x66d6('0x9e')][_0x66d6('0xa5')]())+_0x66d6('0xa9')]=Number(_0x17731b[_0x66d6('0x47')]['ids'][_0x38c523]);socket[_0x66d6('0x2c')](_0x66d6('0x81')+_[_0x66d6('0xa4')](_0x17731b[_0x66d6('0x47')][_0x66d6('0x9e')][_0x66d6('0xa5')]())+_0x66d6('0xb2'),_0x695cdb);}}else{_0x695cdb={'UserId':Number(_0x17731b[_0x66d6('0x5b')]['id'])};_0x695cdb[_[_0x66d6('0xa4')](_0x17731b[_0x66d6('0x47')][_0x66d6('0x9e')]['toLowerCase']())+_0x66d6('0xa9')]=Number(_0x17731b[_0x66d6('0x47')][_0x66d6('0x64')]);socket['emit'](_0x66d6('0x81')+_[_0x66d6('0xa4')](_0x17731b[_0x66d6('0x47')][_0x66d6('0x9e')][_0x66d6('0xa5')]())+_0x66d6('0xb2'),_0x695cdb);}return _0x1ed840;})[_0x66d6('0x21')](function(){if(_0x17731b['query']['channel']===_0x66d6('0xab')){return db[_0x66d6('0xae')]['destroy']({'where':{'UserId':_0x17731b[_0x66d6('0x5b')]['id'],'VoiceQueueId':_0x17731b['query'][_0x66d6('0x64')]},'individualHooks':!![]})[_0x66d6('0x21')](function(){return _0x3bb9b0;});}return _0x3bb9b0;})[_0x66d6('0x21')](respondWithStatusCode(_0x47571d,null))[_0x66d6('0x59')](handleError(_0x47571d,null));};exports['addAvatar']=function(_0x4fa1c6,_0x33efd6){_0x4fa1c6[_0x66d6('0x61')]['userpic']=_0x4fa1c6[_0x66d6('0xb3')][_0x66d6('0xb4')];return db['User'][_0x66d6('0x37')]({'where':{'id':_0x4fa1c6[_0x66d6('0x5b')]['id']}})[_0x66d6('0x21')](handleEntityNotFound(_0x33efd6,null))[_0x66d6('0x21')](saveUpdates(_0x4fa1c6[_0x66d6('0x61')],null))[_0x66d6('0x21')](respondWithResult(_0x33efd6,null))['catch'](handleError(_0x33efd6,null));};exports[_0x66d6('0xb5')]=function(_0x4ade81,_0x1b2ea4){var _0x139add=path[_0x66d6('0xb6')](config[_0x66d6('0xb7')],_0x66d6('0xb8'));return db[_0x66d6('0x4e')][_0x66d6('0x37')]({'where':{'id':_0x4ade81[_0x66d6('0x5b')]['id']},'attributes':['id',_0x66d6('0xb9')],'raw':!![]})[_0x66d6('0x21')](handleEntityNotFound(_0x1b2ea4,null))[_0x66d6('0x21')](function(_0x335cd1){if(_0x335cd1){if(_[_0x66d6('0x6b')](_0x335cd1[_0x66d6('0xb9')])){return _0x1b2ea4[_0x66d6('0xba')](_0x139add);}else{if(!fs[_0x66d6('0xbb')](path[_0x66d6('0xb6')](config[_0x66d6('0xb7')],'server/files/images/',_0x335cd1[_0x66d6('0xb9')]))){return _0x1b2ea4[_0x66d6('0xba')](_0x139add);}return _0x1b2ea4[_0x66d6('0xba')](path[_0x66d6('0xb6')](config[_0x66d6('0xb7')],_0x66d6('0xbc'),_0x335cd1[_0x66d6('0xb9')]));}}})[_0x66d6('0x59')](handleError(_0x1b2ea4,null));};exports[_0x66d6('0xbd')]=function(_0x468cae,_0x43861e){return db[_0x66d6('0x4e')][_0x66d6('0x37')]({'where':{'id':_0x468cae[_0x66d6('0x5b')]['id']},'attributes':['id']})[_0x66d6('0x21')](handleEntityNotFound(_0x43861e,null))[_0x66d6('0x21')](function(_0x505463){var _0x68d884=[];values=_0x505463[_0x66d6('0x54')];_0x68d884['push'](get_open_tabs(_0x66d6('0x53'),_0x505463['dataValues']));_0x68d884[_0x66d6('0x4d')](get_open_tabs('sms',_0x505463[_0x66d6('0x54')]));_0x68d884[_0x66d6('0x4d')](get_open_tabs(_0x66d6('0x57'),_0x505463[_0x66d6('0x54')]));_0x68d884[_0x66d6('0x4d')](get_open_tabs(_0x66d6('0xbe'),_0x505463[_0x66d6('0x54')]));_0x68d884[_0x66d6('0x4d')](get_open_tabs('fax',_0x505463[_0x66d6('0x54')]));_0x68d884[_0x66d6('0x4d')](get_open_tabs(_0x66d6('0x56'),_0x505463[_0x66d6('0x54')]));return Promise['all'](_0x68d884);})['then'](function(_0x52dfa4){if(_0x52dfa4){var _0xd03297=_[_0x66d6('0x34')](values[_0x66d6('0xbf')],function(_0x19070c){return{'channel':_0x66d6('0xc0'),'id':_0x19070c['id'],'createdAt':_0x19070c[_0x66d6('0xc1')]};});var _0x502a8b=_[_0x66d6('0x34')](values[_0x66d6('0xc2')],function(_0x139aa1){return{'channel':_0x66d6('0xc3'),'id':_0x139aa1['id'],'createdAt':_0x139aa1[_0x66d6('0xc1')]};});var _0x45e4cb=_[_0x66d6('0x34')](values[_0x66d6('0xc4')],function(_0x31b602){return{'channel':_0x66d6('0xc5'),'id':_0x31b602['id'],'createdAt':_0x31b602[_0x66d6('0xc1')]};});var _0x354ebf=_[_0x66d6('0x34')](values[_0x66d6('0xc6')],function(_0x279d2f){return{'channel':_0x66d6('0xc7'),'id':_0x279d2f['id'],'createdAt':_0x279d2f[_0x66d6('0xc1')]};});var _0x4de53a=_[_0x66d6('0x34')](values['SmsOpenTabs'],function(_0x11c4de){return{'channel':_0x66d6('0xc8'),'id':_0x11c4de['id'],'createdAt':_0x11c4de[_0x66d6('0xc1')]};});var _0x2092f8=_[_0x66d6('0x34')](values['WhatsappOpenTabs'],function(_0x1a9a7b){return{'channel':'WHATSAPP','id':_0x1a9a7b['id'],'createdAt':_0x1a9a7b[_0x66d6('0xc1')]};});var _0x11bf6d=_[_0x66d6('0xc9')](_0xd03297,_0x502a8b,_0x45e4cb,_0x354ebf,_0x4de53a,_0x2092f8);var _0x569976={'count':_0x11bf6d[_0x66d6('0x52')],'rows':_0x11bf6d};return _0x569976;}else return null;})[_0x66d6('0x21')](respondWithResult(_0x43861e,null))['catch'](handleError(_0x43861e,null));};exports['getContacts']=function(_0x4de167,_0x476655){var _0x1fb136={};return db[_0x66d6('0x4e')][_0x66d6('0x9a')]({'where':{'id':_0x4de167[_0x66d6('0x5b')]['id']}})[_0x66d6('0x21')](function(_0x1640b1){if(!_0x1640b1){throw new APINotFoundError(util['format'](_0x66d6('0xca'),_0x4de167[_0x66d6('0x5b')]['id']));}return contacts[_0x66d6('0x62')]();})[_0x66d6('0x21')](function(_0x289478){_0x4de167[_0x66d6('0x47')][_0x66d6('0x4e')]=_0x4de167[_0x66d6('0x5b')]['id'];_0x1fb136=qs['getOptions'](_0x289478,_0x4de167);if(_0x4de167[_0x66d6('0x47')]['hasOwnProperty'](_0x66d6('0x5d'))){_0x1fb136['include']=[{'model':db[_0x66d6('0xcb')],'as':_0x66d6('0xcc'),'required':![]},{'model':db[_0x66d6('0xcd')],'as':'Tags','attributes':['id','name',_0x66d6('0xce')],'where':_0x4de167[_0x66d6('0x47')][_0x66d6('0xcf')]?{'id':_0x4de167['query'][_0x66d6('0xcf')]}:undefined,'required':_0x4de167[_0x66d6('0x47')][_0x66d6('0xcf')]?!![]:![]}];}return contacts[_0x66d6('0x4f')](_0x4de167[_0x66d6('0x47')],_0x4de167['user'],_0x1fb136,_0x289478);})['then'](respondWithFilteredResult(_0x476655,_0x1fb136))['catch'](APIHandleError(_0x476655));};exports[_0x66d6('0xd0')]=function(_0x3c591a,_0x3eac05){var _0x3a7a6e;var _0x5965a5={};var _0x518ce3;return db[_0x66d6('0x4e')][_0x66d6('0x9a')]({'where':{'id':_0x3c591a[_0x66d6('0x5b')]['id']},'attributes':['id',_0x66d6('0x38'),'role']})[_0x66d6('0x21')](handleEntityNotFound(_0x3eac05,null))[_0x66d6('0x21')](function(_0x1886fd){if(!utils[_0x66d6('0xa3')](_0x3c591a['query'][_0x66d6('0x9e')])){throw new db[(_0x66d6('0x97'))][(_0x66d6('0x92'))](_0x66d6('0xd1'));}_0x3a7a6e=_0x1886fd;var _0x16ff22={};_0x16ff22[_0x66d6('0xd2')]=_[_0x66d6('0xd3')](db[_[_0x66d6('0xa4')](_0x3c591a[_0x66d6('0x47')][_0x66d6('0x9e')])+_0x66d6('0xd4')]['rawAttributes']);_0x16ff22[_0x66d6('0x47')]=_[_0x66d6('0xd3')](_0x3c591a[_0x66d6('0x47')]);_0x16ff22['filters']=_['intersection'](_0x16ff22[_0x66d6('0xd2')],_0x16ff22[_0x66d6('0x47')]);_0x5965a5[_0x66d6('0x4c')]=_['intersection'](_0x16ff22[_0x66d6('0xd2')],qs[_0x66d6('0xd5')](_0x3c591a[_0x66d6('0x47')][_0x66d6('0xd5')]));_0x5965a5[_0x66d6('0x4c')]=_0x5965a5[_0x66d6('0x4c')][_0x66d6('0x52')]?_0x5965a5[_0x66d6('0x4c')]:_0x16ff22[_0x66d6('0xd2')];_0x5965a5['order']=qs['sort'](_0x3c591a[_0x66d6('0x47')][_0x66d6('0xd6')]);_0x5965a5[_0x66d6('0x46')]=qs[_0x66d6('0xd7')](_[_0x66d6('0xd8')](_0x3c591a[_0x66d6('0x47')],_0x16ff22[_0x66d6('0xd7')]));if(_0x3c591a[_0x66d6('0x47')]['filter']){_0x5965a5[_0x66d6('0x46')]=_[_0x66d6('0x5e')](_0x5965a5[_0x66d6('0x46')],{'$or':_[_0x66d6('0x34')](_0x5965a5[_0x66d6('0x4c')],function(_0x48945d){var _0x221c8f={};_0x221c8f[_0x48945d]={'$like':'%'+_0x3c591a[_0x66d6('0x47')]['filter']+'%'};return _0x221c8f;})});}_0x5965a5=_[_0x66d6('0x5e')]({},_0x5965a5,_0x3c591a[_0x66d6('0x5f')]);switch(_0x3a7a6e['role']){case _0x66d6('0x2e'):return db[_[_0x66d6('0xa4')](_0x3c591a[_0x66d6('0x47')][_0x66d6('0x9e')])+'Queue'][_0x66d6('0x4f')](_0x5965a5);case _0x66d6('0x81'):case _0x66d6('0x2b'):return _0x3a7a6e[_0x66d6('0x2d')+_['capitalize'](_0x3c591a[_0x66d6('0x47')][_0x66d6('0x9e')])+'Queues'](_0x5965a5);default:throw new db[(_0x66d6('0x97'))][(_0x66d6('0x92'))]('Unknown\x20role');}})['then'](function(_0x32049){_0x518ce3=_0x32049[_0x66d6('0x52')];if(!_0x3c591a[_0x66d6('0x47')]['hasOwnProperty'](_0x66d6('0xd9'))){_0x5965a5[_0x66d6('0x1b')]=qs[_0x66d6('0x1b')](_0x3c591a[_0x66d6('0x47')][_0x66d6('0x1b')]);_0x5965a5[_0x66d6('0x1d')]=qs[_0x66d6('0x1d')](_0x3c591a['query'][_0x66d6('0x1d')]);}switch(_0x3a7a6e[_0x66d6('0x2a')]){case _0x66d6('0x2e'):return db[_[_0x66d6('0xa4')](_0x3c591a[_0x66d6('0x47')]['channel'])+_0x66d6('0xd4')][_0x66d6('0x4f')](_0x5965a5);case _0x66d6('0x81'):case _0x66d6('0x2b'):return _0x3a7a6e[_0x66d6('0x2d')+_[_0x66d6('0xa4')](_0x3c591a[_0x66d6('0x47')][_0x66d6('0x9e')])+_0x66d6('0xa6')](_0x5965a5);}})[_0x66d6('0x21')](function(_0x3115f5){return{'count':_0x518ce3,'rows':_0x3115f5};})[_0x66d6('0x21')](respondWithResult(_0x3eac05,null))[_0x66d6('0x59')](handleError(_0x3eac05,null));};exports[_0x66d6('0xda')]=function(_0x5475a1,_0x32c377){var _0x14d7eb={};var _0x522830={};var _0x514228;var _0x39a44b;return db[_0x66d6('0x4e')][_0x66d6('0x9a')]({'where':{'id':_0x5475a1[_0x66d6('0x5b')]['id']}})[_0x66d6('0x21')](handleEntityNotFound(_0x32c377,null))['then'](function(_0x48a86a){if(_0x48a86a){_0x514228=_0x48a86a;_0x522830['model']=_['keys'](db['UserVoiceQueueRt'][_0x66d6('0x3d')]);_0x522830[_0x66d6('0x47')]=_['keys'](_0x5475a1[_0x66d6('0x47')]);_0x522830[_0x66d6('0xd7')]=_[_0x66d6('0xdb')](_0x522830[_0x66d6('0xd2')],_0x522830[_0x66d6('0x47')]);_0x14d7eb['attributes']=_[_0x66d6('0xdb')](_0x522830[_0x66d6('0xd2')],qs['fields'](_0x5475a1[_0x66d6('0x47')][_0x66d6('0xd5')]));_0x14d7eb[_0x66d6('0x4c')]=_0x14d7eb[_0x66d6('0x4c')][_0x66d6('0x52')]?_0x14d7eb['attributes']:_0x522830[_0x66d6('0xd2')];_0x14d7eb[_0x66d6('0xdc')]=qs[_0x66d6('0xd6')](_0x5475a1[_0x66d6('0x47')][_0x66d6('0xd6')]);_0x14d7eb[_0x66d6('0x46')]=qs[_0x66d6('0xd7')](_[_0x66d6('0xd8')](_0x5475a1[_0x66d6('0x47')],_0x522830[_0x66d6('0xd7')]));if(_0x5475a1['query'][_0x66d6('0x32')]){_0x14d7eb[_0x66d6('0x46')]=_['merge'](_0x14d7eb[_0x66d6('0x46')],{'$or':_[_0x66d6('0x34')](_0x14d7eb[_0x66d6('0x4c')],function(_0x1a6595){var _0x2d785d={};_0x2d785d[_0x1a6595]={'$like':'%'+_0x5475a1[_0x66d6('0x47')][_0x66d6('0x32')]+'%'};return _0x2d785d;})});}_0x14d7eb=_[_0x66d6('0x5e')]({},_0x14d7eb,_0x5475a1['options']);return _0x514228[_0x66d6('0xda')](_0x14d7eb);}})['then'](function(_0x4fe82d){if(_0x4fe82d){_0x39a44b=_0x4fe82d[_0x66d6('0x52')];if(!_0x5475a1[_0x66d6('0x47')][_0x66d6('0xdd')](_0x66d6('0xd9'))){_0x14d7eb[_0x66d6('0x1b')]=qs[_0x66d6('0x1b')](_0x5475a1[_0x66d6('0x47')][_0x66d6('0x1b')]);_0x14d7eb[_0x66d6('0x1d')]=qs['offset'](_0x5475a1['query'][_0x66d6('0x1d')]);}return _0x514228['getVoiceQueuesRt'](_0x14d7eb);}})[_0x66d6('0x21')](function(_0x1499a8){if(_0x1499a8){return _0x1499a8?{'count':_0x39a44b,'rows':_0x1499a8}:null;}})[_0x66d6('0x21')](respondWithResult(_0x32c377,null))[_0x66d6('0x59')](handleError(_0x32c377,null));};exports[_0x66d6('0xde')]=function(_0x1b2103,_0x227c0f){var _0x367b3b={};var _0xb357ca={};var _0x3ac66a;var _0x49d43b;return db['User'][_0x66d6('0x9a')]({'where':{'id':_0x1b2103[_0x66d6('0x5b')]['id']}})[_0x66d6('0x21')](handleEntityNotFound(_0x227c0f,null))[_0x66d6('0x21')](function(_0x269734){if(_0x269734){_0x3ac66a=_0x269734;_0xb357ca[_0x66d6('0xd2')]=_[_0x66d6('0xd3')](db[_0x66d6('0xdf')]['rawAttributes']);_0xb357ca['query']=_['keys'](_0x1b2103[_0x66d6('0x47')]);_0xb357ca[_0x66d6('0xd7')]=_['intersection'](_0xb357ca[_0x66d6('0xd2')],_0xb357ca[_0x66d6('0x47')]);_0x367b3b[_0x66d6('0x4c')]=_[_0x66d6('0xdb')](_0xb357ca['model'],qs[_0x66d6('0xd5')](_0x1b2103[_0x66d6('0x47')][_0x66d6('0xd5')]));_0x367b3b[_0x66d6('0x4c')]=_0x367b3b['attributes'][_0x66d6('0x52')]?_0x367b3b[_0x66d6('0x4c')]:_0xb357ca[_0x66d6('0xd2')];_0x367b3b[_0x66d6('0xdc')]=qs[_0x66d6('0xd6')](_0x1b2103['query'][_0x66d6('0xd6')]);_0x367b3b[_0x66d6('0x46')]=qs['filters'](_[_0x66d6('0xd8')](_0x1b2103['query'],_0xb357ca['filters']));if(_0x1b2103['query'][_0x66d6('0x32')]){_0x367b3b[_0x66d6('0x46')]=_['merge'](_0x367b3b[_0x66d6('0x46')],{'$or':_[_0x66d6('0x34')](_0x367b3b[_0x66d6('0x4c')],function(_0x48155a){var _0x1e4ef6={};_0x1e4ef6[_0x48155a]={'$like':'%'+_0x1b2103[_0x66d6('0x47')]['filter']+'%'};return _0x1e4ef6;})});}_0x367b3b=_[_0x66d6('0x5e')]({},_0x367b3b,_0x1b2103[_0x66d6('0x5f')]);return _0x3ac66a[_0x66d6('0xde')](_0x367b3b);}})[_0x66d6('0x21')](function(_0x1ee574){if(_0x1ee574){_0x49d43b=_0x1ee574[_0x66d6('0x52')];if(!_0x1b2103[_0x66d6('0x47')][_0x66d6('0xdd')](_0x66d6('0xd9'))){_0x367b3b[_0x66d6('0x1b')]=qs[_0x66d6('0x1b')](_0x1b2103[_0x66d6('0x47')][_0x66d6('0x1b')]);_0x367b3b[_0x66d6('0x1d')]=qs['offset'](_0x1b2103[_0x66d6('0x47')][_0x66d6('0x1d')]);}return _0x3ac66a[_0x66d6('0xde')](_0x367b3b);}})[_0x66d6('0x21')](function(_0x35a04a){if(_0x35a04a){return _0x35a04a?{'count':_0x49d43b,'rows':_0x35a04a}:null;}})[_0x66d6('0x21')](respondWithResult(_0x227c0f,null))[_0x66d6('0x59')](handleError(_0x227c0f,null));};exports['getRecordings']=function(_0x2b2c83,_0x372527){var _0x376ee6={'raw':!![],'where':{}};var _0xe583a3={};var _0x10192a={'count':0x0,'rows':[]};return db[_0x66d6('0x4e')][_0x66d6('0x9a')]({'where':{'id':_0x2b2c83[_0x66d6('0x5b')]['id']}})['then'](handleEntityNotFound(_0x372527,null))[_0x66d6('0x21')](function(_0x2d7fd1){if(_0x2d7fd1){_0xe583a3[_0x66d6('0xd2')]=_['keys'](db[_0x66d6('0xe0')]['rawAttributes']);_0xe583a3[_0x66d6('0x47')]=_['keys'](_0x2b2c83[_0x66d6('0x47')]);_0xe583a3[_0x66d6('0xd7')]=_[_0x66d6('0xdb')](_0xe583a3[_0x66d6('0xd2')],_0xe583a3[_0x66d6('0x47')]);_0x376ee6[_0x66d6('0x4c')]=_[_0x66d6('0xdb')](_0xe583a3[_0x66d6('0xd2')],qs[_0x66d6('0xd5')](_0x2b2c83[_0x66d6('0x47')][_0x66d6('0xd5')]));_0x376ee6[_0x66d6('0x4c')]=_0x376ee6[_0x66d6('0x4c')][_0x66d6('0x52')]?_0x376ee6[_0x66d6('0x4c')]:_0xe583a3[_0x66d6('0xd2')];if(!_0x2b2c83[_0x66d6('0x47')]['hasOwnProperty'](_0x66d6('0xd9'))){_0x376ee6[_0x66d6('0x1b')]=qs['limit'](_0x2b2c83[_0x66d6('0x47')][_0x66d6('0x1b')]);_0x376ee6[_0x66d6('0x1d')]=qs['offset'](_0x2b2c83[_0x66d6('0x47')][_0x66d6('0x1d')]);}_0x376ee6['order']=qs['sort'](_0x2b2c83[_0x66d6('0x47')][_0x66d6('0xd6')]);_0x376ee6[_0x66d6('0x46')]=qs[_0x66d6('0xd7')](_['pick'](_0x2b2c83[_0x66d6('0x47')],_0xe583a3[_0x66d6('0xd7')]));_0x376ee6[_0x66d6('0x46')][_0x66d6('0xe1')]=_0x2d7fd1['id'];if(_0x2b2c83[_0x66d6('0x47')]['filter']){_0x376ee6['where']=_['merge'](_0x376ee6['where'],{'$or':_[_0x66d6('0x34')](_0x376ee6[_0x66d6('0x4c')],function(_0x2eefc6){var _0x5b499e={};_0x5b499e[_0x2eefc6]={'$like':'%'+_0x2b2c83[_0x66d6('0x47')][_0x66d6('0x32')]+'%'};return _0x5b499e;})});}_0x376ee6=_[_0x66d6('0x5e')]({},_0x376ee6,_0x2b2c83['options']);return db['VoiceRecording'][_0x66d6('0x1c')]({'where':_0x376ee6[_0x66d6('0x46')]})[_0x66d6('0x21')](function(_0x294fdf){_0x10192a[_0x66d6('0x1c')]=_0x294fdf;if(_0x2b2c83[_0x66d6('0x47')][_0x66d6('0x5d')]){_0x376ee6[_0x66d6('0x48')]=[{'all':!![]}];}return db['VoiceRecording'][_0x66d6('0x4f')](_0x376ee6);})[_0x66d6('0x21')](function(_0x4ab35f){_0x10192a[_0x66d6('0x50')]=_0x4ab35f;return _0x10192a;});}})['then'](respondWithFilteredResult(_0x372527,_0x376ee6))[_0x66d6('0x59')](handleError(_0x372527,null));};exports[_0x66d6('0xe2')]=function(_0x53c439,_0x16201c){var _0x359ef4={'raw':!![],'where':{}};var _0x21f9ef={};var _0x276a26={'count':0x0,'rows':[]};return db[_0x66d6('0x4e')][_0x66d6('0x9a')]({'where':{'id':_0x53c439[_0x66d6('0x5b')]['id']}})[_0x66d6('0x21')](handleEntityNotFound(_0x16201c,null))[_0x66d6('0x21')](function(_0x1088cd){if(_0x1088cd){_0x21f9ef[_0x66d6('0xd2')]=_[_0x66d6('0xd3')](db[_0x66d6('0xe3')][_0x66d6('0x3d')]);_0x21f9ef[_0x66d6('0x47')]=_[_0x66d6('0xd3')](_0x53c439[_0x66d6('0x47')]);_0x21f9ef[_0x66d6('0xd7')]=_[_0x66d6('0xdb')](_0x21f9ef[_0x66d6('0xd2')],_0x21f9ef[_0x66d6('0x47')]);_0x359ef4[_0x66d6('0x4c')]=_[_0x66d6('0xdb')](_0x21f9ef[_0x66d6('0xd2')],qs[_0x66d6('0xd5')](_0x53c439[_0x66d6('0x47')][_0x66d6('0xd5')]));_0x359ef4[_0x66d6('0x4c')]=_0x359ef4[_0x66d6('0x4c')][_0x66d6('0x52')]?_0x359ef4[_0x66d6('0x4c')]:_0x21f9ef[_0x66d6('0xd2')];if(!_0x53c439[_0x66d6('0x47')][_0x66d6('0xdd')](_0x66d6('0xd9'))){_0x359ef4[_0x66d6('0x1b')]=qs[_0x66d6('0x1b')](_0x53c439[_0x66d6('0x47')]['limit']);_0x359ef4[_0x66d6('0x1d')]=qs[_0x66d6('0x1d')](_0x53c439[_0x66d6('0x47')][_0x66d6('0x1d')]);}_0x359ef4[_0x66d6('0xdc')]=qs['sort'](_0x53c439['query'][_0x66d6('0xd6')]);_0x359ef4[_0x66d6('0x46')]=qs[_0x66d6('0xd7')](_[_0x66d6('0xd8')](_0x53c439[_0x66d6('0x47')],_0x21f9ef[_0x66d6('0xd7')]));_0x359ef4[_0x66d6('0x46')][_0x66d6('0xe1')]=_0x1088cd['id'];if(_0x53c439[_0x66d6('0x47')][_0x66d6('0x32')]){_0x359ef4['where']=_[_0x66d6('0x5e')](_0x359ef4[_0x66d6('0x46')],{'$or':_['map'](_0x359ef4[_0x66d6('0x4c')],function(_0x52feb0){var _0x4552e5={};_0x4552e5[_0x52feb0]={'$like':'%'+_0x53c439['query'][_0x66d6('0x32')]+'%'};return _0x4552e5;})});}_0x359ef4=_[_0x66d6('0x5e')]({},_0x359ef4,_0x53c439[_0x66d6('0x5f')]);return db[_0x66d6('0xe3')][_0x66d6('0x1c')]({'where':_0x359ef4[_0x66d6('0x46')]})['then'](function(_0x34f1a0){_0x276a26[_0x66d6('0x1c')]=_0x34f1a0;if(_0x53c439[_0x66d6('0x47')][_0x66d6('0x5d')]){_0x359ef4[_0x66d6('0x48')]=[{'all':!![]}];}return db[_0x66d6('0xe3')][_0x66d6('0x4f')](_0x359ef4);})['then'](function(_0x4b8a1f){_0x276a26[_0x66d6('0x50')]=_0x4b8a1f;return _0x276a26;});}})[_0x66d6('0x21')](respondWithFilteredResult(_0x16201c,_0x359ef4))[_0x66d6('0x59')](handleError(_0x16201c,null));};exports[_0x66d6('0xe4')]=function(_0x2aef38,_0x35ad9e){var _0x147f9e={};var _0x11cfb1={};var _0x24ebd6;var _0x58b39e;return db['User'][_0x66d6('0x9a')]({'where':{'id':_0x2aef38[_0x66d6('0x5b')]['id']}})[_0x66d6('0x21')](handleEntityNotFound(_0x35ad9e,null))['then'](function(_0x38d7b8){if(_0x38d7b8){_0x24ebd6=_0x38d7b8;_0x11cfb1[_0x66d6('0xd2')]=_['keys'](db[_0x66d6('0xe5')]['rawAttributes']);_0x11cfb1[_0x66d6('0x47')]=_['keys'](_0x2aef38['query']);_0x11cfb1['filters']=_[_0x66d6('0xdb')](_0x11cfb1[_0x66d6('0xd2')],_0x11cfb1['query']);_0x147f9e[_0x66d6('0x4c')]=_[_0x66d6('0xdb')](_0x11cfb1['model'],qs['fields'](_0x2aef38[_0x66d6('0x47')]['fields']));_0x147f9e[_0x66d6('0x4c')]=_0x147f9e[_0x66d6('0x4c')][_0x66d6('0x52')]?_0x147f9e[_0x66d6('0x4c')]:_0x11cfb1['model'];_0x147f9e['order']=qs[_0x66d6('0xd6')](_0x2aef38[_0x66d6('0x47')][_0x66d6('0xd6')]);_0x147f9e['where']=qs['filters'](_[_0x66d6('0xd8')](_0x2aef38[_0x66d6('0x47')],_0x11cfb1[_0x66d6('0xd7')]));if(_0x2aef38[_0x66d6('0x47')][_0x66d6('0x32')]){_0x147f9e[_0x66d6('0x46')]=_['merge'](_0x147f9e[_0x66d6('0x46')],{'$or':_['map'](_0x147f9e['attributes'],function(_0x37b551){var _0x2b0397={};_0x2b0397[_0x37b551]={'$like':'%'+_0x2aef38[_0x66d6('0x47')][_0x66d6('0x32')]+'%'};return _0x2b0397;})});}_0x147f9e=_[_0x66d6('0x5e')]({},_0x147f9e,_0x2aef38[_0x66d6('0x5f')]);return _0x24ebd6[_0x66d6('0xe4')](_0x147f9e);}})['then'](function(_0x3ce37a){if(_0x3ce37a){_0x58b39e=_0x3ce37a[_0x66d6('0x52')];if(!_0x2aef38[_0x66d6('0x47')]['hasOwnProperty'](_0x66d6('0xd9'))){_0x147f9e[_0x66d6('0x1b')]=qs[_0x66d6('0x1b')](_0x2aef38[_0x66d6('0x47')][_0x66d6('0x1b')]);_0x147f9e[_0x66d6('0x1d')]=qs['offset'](_0x2aef38['query'][_0x66d6('0x1d')]);}return _0x24ebd6[_0x66d6('0xe4')](_0x147f9e);}})[_0x66d6('0x21')](function(_0x53509f){if(_0x53509f){return _0x53509f?{'count':_0x58b39e,'rows':_0x53509f}:null;}})[_0x66d6('0x21')](respondWithResult(_0x35ad9e,null))[_0x66d6('0x59')](handleError(_0x35ad9e,null));};exports['getOpenchannelInteractions']=function(_0x11b642,_0x3b7899){var _0x345ee1={};var _0x4011d1={};var _0x28d990;var _0x485e5c;return db[_0x66d6('0x4e')][_0x66d6('0x9a')]({'where':{'id':_0x11b642[_0x66d6('0x5b')]['id']}})[_0x66d6('0x21')](handleEntityNotFound(_0x3b7899,null))[_0x66d6('0x21')](function(_0x1df62c){if(_0x1df62c){_0x28d990=_0x1df62c;_0x4011d1[_0x66d6('0xd2')]=_[_0x66d6('0xd3')](db['OpenchannelInteraction']['rawAttributes']);_0x4011d1[_0x66d6('0x47')]=_[_0x66d6('0xd3')](_0x11b642[_0x66d6('0x47')]);_0x4011d1[_0x66d6('0xd7')]=_['intersection'](_0x4011d1[_0x66d6('0xd2')],_0x4011d1['query']);_0x345ee1[_0x66d6('0x4c')]=_[_0x66d6('0xdb')](_0x4011d1[_0x66d6('0xd2')],qs[_0x66d6('0xd5')](_0x11b642[_0x66d6('0x47')]['fields']));_0x345ee1[_0x66d6('0x4c')]=_0x345ee1[_0x66d6('0x4c')]['length']?_0x345ee1['attributes']:_0x4011d1['model'];_0x345ee1['order']=qs[_0x66d6('0xd6')](_0x11b642['query']['sort']);_0x345ee1['where']=qs[_0x66d6('0xd7')](_[_0x66d6('0xd8')](_0x11b642[_0x66d6('0x47')],_0x4011d1[_0x66d6('0xd7')]));if(_0x11b642['query'][_0x66d6('0x32')]){_0x345ee1[_0x66d6('0x46')]=_[_0x66d6('0x5e')](_0x345ee1[_0x66d6('0x46')],{'$or':_[_0x66d6('0x34')](_0x345ee1[_0x66d6('0x4c')],function(_0x550194){var _0x1d0055={};_0x1d0055[_0x550194]={'$like':'%'+_0x11b642[_0x66d6('0x47')][_0x66d6('0x32')]+'%'};return _0x1d0055;})});}_0x345ee1=_[_0x66d6('0x5e')]({},_0x345ee1,_0x11b642[_0x66d6('0x5f')]);return _0x28d990[_0x66d6('0xe6')](_0x345ee1);}})['then'](function(_0x4e3b3b){if(_0x4e3b3b){_0x485e5c=_0x4e3b3b[_0x66d6('0x52')];if(!_0x11b642[_0x66d6('0x47')]['hasOwnProperty']('nolimit')){_0x345ee1['limit']=qs[_0x66d6('0x1b')](_0x11b642['query'][_0x66d6('0x1b')]);_0x345ee1[_0x66d6('0x1d')]=qs[_0x66d6('0x1d')](_0x11b642[_0x66d6('0x47')][_0x66d6('0x1d')]);}return _0x28d990[_0x66d6('0xe6')](_0x345ee1);}})['then'](function(_0x153a3c){if(_0x153a3c){return _0x153a3c?{'count':_0x485e5c,'rows':_0x153a3c}:null;}})['then'](respondWithResult(_0x3b7899,null))[_0x66d6('0x59')](handleError(_0x3b7899,null));};exports[_0x66d6('0xe7')]=function(_0x2f7efd,_0x3a20f7){var _0x4e3a37={'raw':!![],'where':{}};var _0x2ef1fb={};var _0x1e5bdb={'count':0x0,'rows':[]};return db[_0x66d6('0x4e')][_0x66d6('0x9a')]({'where':{'id':_0x2f7efd[_0x66d6('0x5b')]['id']}})[_0x66d6('0x21')](handleEntityNotFound(_0x3a20f7,null))[_0x66d6('0x21')](function(_0x5be6cd){if(_0x5be6cd){_0x2ef1fb[_0x66d6('0xd2')]=_[_0x66d6('0xd3')](db['MailInteraction'][_0x66d6('0x3d')]);_0x2ef1fb[_0x66d6('0x47')]=_[_0x66d6('0xd3')](_0x2f7efd[_0x66d6('0x47')]);_0x2ef1fb[_0x66d6('0xd7')]=_[_0x66d6('0xdb')](_0x2ef1fb[_0x66d6('0xd2')],_0x2ef1fb[_0x66d6('0x47')]);_0x4e3a37['attributes']=_[_0x66d6('0xdb')](_0x2ef1fb['model'],qs[_0x66d6('0xd5')](_0x2f7efd[_0x66d6('0x47')][_0x66d6('0xd5')]));_0x4e3a37[_0x66d6('0x4c')]=_0x4e3a37[_0x66d6('0x4c')]['length']?_0x4e3a37['attributes']:_0x2ef1fb[_0x66d6('0xd2')];if(!_0x2f7efd[_0x66d6('0x47')][_0x66d6('0xdd')](_0x66d6('0xd9'))){_0x4e3a37[_0x66d6('0x1b')]=qs[_0x66d6('0x1b')](_0x2f7efd[_0x66d6('0x47')][_0x66d6('0x1b')]);_0x4e3a37['offset']=qs[_0x66d6('0x1d')](_0x2f7efd[_0x66d6('0x47')]['offset']);}_0x4e3a37[_0x66d6('0xdc')]=qs[_0x66d6('0xd6')](_0x2f7efd[_0x66d6('0x47')]['sort']);_0x4e3a37[_0x66d6('0x46')]=qs[_0x66d6('0xd7')](_[_0x66d6('0xd8')](_0x2f7efd[_0x66d6('0x47')],_0x2ef1fb[_0x66d6('0xd7')]));_0x4e3a37[_0x66d6('0x46')]['UserId']=_0x5be6cd['id'];if(_0x2f7efd['query'][_0x66d6('0x32')]){_0x4e3a37[_0x66d6('0x46')]=_[_0x66d6('0x5e')](_0x4e3a37[_0x66d6('0x46')],{'$or':_[_0x66d6('0x34')](_0x4e3a37[_0x66d6('0x4c')],function(_0x2dc44e){var _0x412677={};_0x412677[_0x2dc44e]={'$like':'%'+_0x2f7efd[_0x66d6('0x47')][_0x66d6('0x32')]+'%'};return _0x412677;})});}_0x4e3a37=_[_0x66d6('0x5e')]({},_0x4e3a37,_0x2f7efd[_0x66d6('0x5f')]);return db[_0x66d6('0xe8')][_0x66d6('0x1c')]({'where':_0x4e3a37[_0x66d6('0x46')]})[_0x66d6('0x21')](function(_0xc724ca){_0x1e5bdb[_0x66d6('0x1c')]=_0xc724ca;if(_0x2f7efd[_0x66d6('0x47')][_0x66d6('0x5d')]){_0x4e3a37[_0x66d6('0x48')]=[{'all':!![]}];}return db[_0x66d6('0xe8')][_0x66d6('0x4f')](_0x4e3a37);})[_0x66d6('0x21')](function(_0x43bb62){_0x1e5bdb[_0x66d6('0x50')]=_0x43bb62;return _0x1e5bdb;});}})[_0x66d6('0x21')](respondWithFilteredResult(_0x3a20f7,_0x4e3a37))[_0x66d6('0x59')](handleError(_0x3a20f7,null));};exports[_0x66d6('0xe9')]=function(_0x500ae4,_0x1d7f48){var _0x43ec2c={};var _0x57d954={};var _0x2b8454;var _0x1e3d49;return db[_0x66d6('0x4e')][_0x66d6('0x9a')]({'where':{'id':_0x500ae4[_0x66d6('0x5b')]['id']}})[_0x66d6('0x21')](handleEntityNotFound(_0x1d7f48,null))[_0x66d6('0x21')](function(_0x194302){if(_0x194302){_0x2b8454=_0x194302;_0x57d954[_0x66d6('0xd2')]=_[_0x66d6('0xd3')](db[_0x66d6('0xea')][_0x66d6('0x3d')]);_0x57d954[_0x66d6('0x47')]=_[_0x66d6('0xd3')](_0x500ae4[_0x66d6('0x47')]);_0x57d954['filters']=_[_0x66d6('0xdb')](_0x57d954[_0x66d6('0xd2')],_0x57d954[_0x66d6('0x47')]);_0x43ec2c[_0x66d6('0x4c')]=_[_0x66d6('0xdb')](_0x57d954['model'],qs[_0x66d6('0xd5')](_0x500ae4['query']['fields']));_0x43ec2c[_0x66d6('0x4c')]=_0x43ec2c[_0x66d6('0x4c')]['length']?_0x43ec2c[_0x66d6('0x4c')]:_0x57d954[_0x66d6('0xd2')];_0x43ec2c[_0x66d6('0xdc')]=qs[_0x66d6('0xd6')](_0x500ae4[_0x66d6('0x47')][_0x66d6('0xd6')]);_0x43ec2c[_0x66d6('0x46')]=qs['filters'](_['pick'](_0x500ae4[_0x66d6('0x47')],_0x57d954[_0x66d6('0xd7')]));if(_0x500ae4[_0x66d6('0x47')][_0x66d6('0x32')]){_0x43ec2c[_0x66d6('0x46')]=_[_0x66d6('0x5e')](_0x43ec2c['where'],{'$or':_[_0x66d6('0x34')](_0x43ec2c[_0x66d6('0x4c')],function(_0x2bee15){var _0x318d2c={};_0x318d2c[_0x2bee15]={'$like':'%'+_0x500ae4['query'][_0x66d6('0x32')]+'%'};return _0x318d2c;})});}_0x43ec2c=_[_0x66d6('0x5e')]({},_0x43ec2c,_0x500ae4['options']);return _0x2b8454[_0x66d6('0xe9')](_0x43ec2c);}})['then'](function(_0x2a6b0c){if(_0x2a6b0c){_0x1e3d49=_0x2a6b0c[_0x66d6('0x52')];if(!_0x500ae4['query'][_0x66d6('0xdd')](_0x66d6('0xd9'))){_0x43ec2c[_0x66d6('0x1b')]=qs[_0x66d6('0x1b')](_0x500ae4[_0x66d6('0x47')][_0x66d6('0x1b')]);_0x43ec2c[_0x66d6('0x1d')]=qs[_0x66d6('0x1d')](_0x500ae4[_0x66d6('0x47')][_0x66d6('0x1d')]);}return _0x2b8454[_0x66d6('0xe9')](_0x43ec2c);}})[_0x66d6('0x21')](function(_0x1b2234){if(_0x1b2234){return _0x1b2234?{'count':_0x1e3d49,'rows':_0x1b2234}:null;}})['then'](respondWithResult(_0x1d7f48,null))[_0x66d6('0x59')](handleError(_0x1d7f48,null));};exports['getFaxInteractions']=function(_0x1e4c9f,_0x45281f){var _0x4e19fd={};var _0x265dd0={};var _0xc7af2c;var _0x8152ae;return db[_0x66d6('0x4e')][_0x66d6('0x9a')]({'where':{'id':_0x1e4c9f[_0x66d6('0x5b')]['id']}})['then'](handleEntityNotFound(_0x45281f,null))[_0x66d6('0x21')](function(_0x1b4b73){if(_0x1b4b73){_0xc7af2c=_0x1b4b73;_0x265dd0[_0x66d6('0xd2')]=_['keys'](db[_0x66d6('0xeb')]['rawAttributes']);_0x265dd0[_0x66d6('0x47')]=_['keys'](_0x1e4c9f[_0x66d6('0x47')]);_0x265dd0[_0x66d6('0xd7')]=_[_0x66d6('0xdb')](_0x265dd0['model'],_0x265dd0[_0x66d6('0x47')]);_0x4e19fd[_0x66d6('0x4c')]=_[_0x66d6('0xdb')](_0x265dd0['model'],qs[_0x66d6('0xd5')](_0x1e4c9f[_0x66d6('0x47')][_0x66d6('0xd5')]));_0x4e19fd[_0x66d6('0x4c')]=_0x4e19fd[_0x66d6('0x4c')][_0x66d6('0x52')]?_0x4e19fd[_0x66d6('0x4c')]:_0x265dd0[_0x66d6('0xd2')];_0x4e19fd[_0x66d6('0xdc')]=qs[_0x66d6('0xd6')](_0x1e4c9f[_0x66d6('0x47')][_0x66d6('0xd6')]);_0x4e19fd['where']=qs['filters'](_[_0x66d6('0xd8')](_0x1e4c9f[_0x66d6('0x47')],_0x265dd0[_0x66d6('0xd7')]));if(_0x1e4c9f[_0x66d6('0x47')][_0x66d6('0x32')]){_0x4e19fd['where']=_[_0x66d6('0x5e')](_0x4e19fd[_0x66d6('0x46')],{'$or':_[_0x66d6('0x34')](_0x4e19fd[_0x66d6('0x4c')],function(_0x39df89){var _0x5b57a3={};_0x5b57a3[_0x39df89]={'$like':'%'+_0x1e4c9f[_0x66d6('0x47')][_0x66d6('0x32')]+'%'};return _0x5b57a3;})});}_0x4e19fd=_[_0x66d6('0x5e')]({},_0x4e19fd,_0x1e4c9f['options']);return _0xc7af2c[_0x66d6('0xec')](_0x4e19fd);}})[_0x66d6('0x21')](function(_0x1f9f67){if(_0x1f9f67){_0x8152ae=_0x1f9f67[_0x66d6('0x52')];if(!_0x1e4c9f[_0x66d6('0x47')][_0x66d6('0xdd')](_0x66d6('0xd9'))){_0x4e19fd[_0x66d6('0x1b')]=qs[_0x66d6('0x1b')](_0x1e4c9f['query'][_0x66d6('0x1b')]);_0x4e19fd[_0x66d6('0x1d')]=qs[_0x66d6('0x1d')](_0x1e4c9f[_0x66d6('0x47')][_0x66d6('0x1d')]);}return _0xc7af2c[_0x66d6('0xec')](_0x4e19fd);}})[_0x66d6('0x21')](function(_0x1cc26d){if(_0x1cc26d){return _0x1cc26d?{'count':_0x8152ae,'rows':_0x1cc26d}:null;}})[_0x66d6('0x21')](respondWithResult(_0x45281f,null))[_0x66d6('0x59')](handleError(_0x45281f,null));};exports[_0x66d6('0xed')]=function(_0x28a28e,_0x5f1577){var _0x530731={};var _0x47b42c={};var _0x5cf50a;var _0x2cb1ad;return db[_0x66d6('0x4e')][_0x66d6('0x9a')]({'where':{'id':_0x28a28e['params']['id']}})[_0x66d6('0x21')](handleEntityNotFound(_0x5f1577,null))[_0x66d6('0x21')](function(_0x4185f8){if(_0x4185f8){_0x5cf50a=_0x4185f8;_0x47b42c['model']=_[_0x66d6('0xd3')](db[_0x66d6('0xee')][_0x66d6('0x3d')]);_0x47b42c['query']=_[_0x66d6('0xd3')](_0x28a28e[_0x66d6('0x47')]);_0x47b42c[_0x66d6('0xd7')]=_[_0x66d6('0xdb')](_0x47b42c[_0x66d6('0xd2')],_0x47b42c[_0x66d6('0x47')]);_0x530731[_0x66d6('0x4c')]=_[_0x66d6('0xdb')](_0x47b42c[_0x66d6('0xd2')],qs['fields'](_0x28a28e[_0x66d6('0x47')][_0x66d6('0xd5')]));_0x530731[_0x66d6('0x4c')]=_0x530731[_0x66d6('0x4c')]['length']?_0x530731[_0x66d6('0x4c')]:_0x47b42c['model'];_0x530731[_0x66d6('0xdc')]=qs[_0x66d6('0xd6')](_0x28a28e[_0x66d6('0x47')][_0x66d6('0xd6')]);_0x530731[_0x66d6('0x46')]=qs[_0x66d6('0xd7')](_[_0x66d6('0xd8')](_0x28a28e['query'],_0x47b42c[_0x66d6('0xd7')]));if(_0x28a28e[_0x66d6('0x47')][_0x66d6('0x32')]){_0x530731['where']=_[_0x66d6('0x5e')](_0x530731[_0x66d6('0x46')],{'$or':_['map'](_0x530731['attributes'],function(_0x437a18){var _0x57b425={};_0x57b425[_0x437a18]={'$like':'%'+_0x28a28e[_0x66d6('0x47')][_0x66d6('0x32')]+'%'};return _0x57b425;})});}_0x530731=_[_0x66d6('0x5e')]({},_0x530731,_0x28a28e[_0x66d6('0x5f')]);return _0x5cf50a['getWhatsappInteractions'](_0x530731);}})[_0x66d6('0x21')](function(_0x3d1cd5){if(_0x3d1cd5){_0x2cb1ad=_0x3d1cd5[_0x66d6('0x52')];if(!_0x28a28e[_0x66d6('0x47')]['hasOwnProperty'](_0x66d6('0xd9'))){_0x530731[_0x66d6('0x1b')]=qs[_0x66d6('0x1b')](_0x28a28e['query'][_0x66d6('0x1b')]);_0x530731['offset']=qs[_0x66d6('0x1d')](_0x28a28e[_0x66d6('0x47')]['offset']);}return _0x5cf50a[_0x66d6('0xed')](_0x530731);}})[_0x66d6('0x21')](function(_0x371b8f){if(_0x371b8f){return _0x371b8f?{'count':_0x2cb1ad,'rows':_0x371b8f}:null;}})['then'](respondWithResult(_0x5f1577,null))[_0x66d6('0x59')](handleError(_0x5f1577,null));};exports[_0x66d6('0xef')]=function(_0x37fffd,_0x52bd05,_0x2ae0a9){var _0x76a169;var _0x2f7d81;var _0x56119d;var _0x4209ac=!_['isNil'](_0x37fffd[_0x66d6('0x5b')]['id'])?_0x37fffd[_0x66d6('0x5b')]['id']:!_[_0x66d6('0x6b')](_0x37fffd['user']['id'])?_0x37fffd[_0x66d6('0x81')]['id']:null;return db[_0x66d6('0x4e')]['find']({'where':{'id':_0x4209ac,'role':{'$or':[_0x66d6('0x2e'),_0x66d6('0x81'),_0x66d6('0x2b')]}},'attributes':['id',_0x66d6('0x38'),_0x66d6('0xf0'),'mobile',_0x66d6('0x2a'),'internal',_0x66d6('0xa0')]})[_0x66d6('0x21')](function(_0x44c2dd){if(_0x44c2dd){if(_0x44c2dd[_0x66d6('0x2a')]===_0x66d6('0x2b')){_0x76a169=_0x44c2dd;if(_0x37fffd['body']['interface']){_0x56119d=util['format'](_0x66d6('0xf1'),_0x76a169[_0x37fffd[_0x66d6('0x61')][_0x66d6('0xa2')]]);}else if(_0x37fffd[_0x66d6('0x61')][_0x66d6('0xf2')]){_0x56119d=util[_0x66d6('0xad')]('SIP/%s',_0x37fffd[_0x66d6('0x61')]['intrf']);}else{_0x56119d=util[_0x66d6('0xad')]('SIP/%s',_0x76a169['name']);}socket['to'](util[_0x66d6('0xad')](_0x66d6('0xf3'),_0x76a169['name']))[_0x66d6('0x2c')](_0x66d6('0xf4'),{'user':{'id':_0x76a169['id'],'name':_0x76a169[_0x66d6('0x38')]},'ip':_0x37fffd[_0x66d6('0xf5')][_0x66d6('0xf6')]||_0x37fffd[_0x66d6('0xf7')][_0x66d6('0xf8')]||_0x37fffd[_0x66d6('0xf9')][_0x66d6('0xf8')]||_0x37fffd[_0x66d6('0xf7')][_0x66d6('0xf9')][_0x66d6('0xf8')]});return new Promise(function(_0x23195f,_0x2538fb){db['sequelize'][_0x66d6('0xfa')]()[_0x66d6('0x21')](_0x5883cc=>{db[_0x66d6('0xae')][_0x66d6('0xfb')]({'where':{'membername':_0x76a169['name']},'individualHooks':!![]},{'transaction':_0x5883cc})[_0x66d6('0x21')](function(){return _0x5883cc[_0x66d6('0xfc')]();})[_0x66d6('0x21')](_0x23195f)[_0x66d6('0x59')](_0x2538fb);});});}}else{throw new db[(_0x66d6('0x97'))][(_0x66d6('0x92'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x76a169){return _0x76a169['getVoiceQueues']({'raw':!![]});}})['then'](function(_0xd93216){if(_0x76a169){if(_0xd93216){_0x2f7d81=_0xd93216;if(_0x2f7d81[_0x66d6('0x52')]){var _0x496505=_0x2f7d81[_0x66d6('0x34')](function(_0x51f4ed){return{'membername':_0x76a169['name'],'UserId':_0x76a169['id'],'queue_name':_0x51f4ed[_0x66d6('0x38')],'VoiceQueueId':_0x51f4ed['id'],'interface':_0x56119d,'paused':_0x76a169['loginInPause']||![],'penalty':_0x51f4ed['UserVoiceQueue.penalty']||0x0};});return db[_0x66d6('0xae')][_0x66d6('0x8b')](_0x496505);}}}})[_0x66d6('0x21')](function(){if(_0x76a169){return db[_0x66d6('0xfd')][_0x66d6('0x4f')]({'where':{'membername':_0x76a169[_0x66d6('0x38')],'exitAt':null}});}})[_0x66d6('0x21')](function(_0x953ea0){if(_0x76a169){var _0x3d06f6=[];_0x953ea0[_0x66d6('0xfe')](function(_0x102851){_0x3d06f6[_0x66d6('0x4d')](_0x102851[_0x66d6('0x29')]({'exitAt':moment()[_0x66d6('0xad')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x66d6('0x58')](_0x3d06f6);}})[_0x66d6('0x21')](function(){if(_0x76a169){var _0x25c8b4=[];var _0x39a1ed=[];var _0x5f3314=utils[_0x66d6('0xff')]();var _0x51a0f5={'membername':_0x76a169[_0x66d6('0x38')],'interface':_0x56119d,'enterAt':moment()['format'](_0x66d6('0x100')),'role':_0x76a169['role'],'internal':_0x76a169[_0x66d6('0x6a')]};_0x5f3314['forEach'](function(_0x154fe2){_0x25c8b4[_0x66d6('0x4d')](_[_0x66d6('0x5e')]({'channel':_0x154fe2,'type':_0x66d6('0x101'),'data1':_0x37fffd[_0x66d6('0x61')][_0x66d6('0x102')],'data2':_0x56119d},_0x51a0f5));if(_0x76a169[_0x66d6('0xa0')]){_0x39a1ed[_0x66d6('0x4d')](_[_0x66d6('0x5e')]({'channel':_0x154fe2,'type':_0x66d6('0x103'),'data1':_0x66d6('0x104')},_0x51a0f5));}});return db[_0x66d6('0xfd')]['bulkCreate'](_0x25c8b4[_0x66d6('0xc9')](_0x39a1ed),{'individualHooks':!![]});}})['then'](function(){if(_0x76a169){return _0x76a169[_0x66d6('0x29')]({'online':!![],'lastLoginAt':moment()[_0x66d6('0xad')](_0x66d6('0x100')),'voicePause':_0x76a169['loginInPause']||![],'mailPause':_0x76a169['loginInPause']||![],'chatPause':_0x76a169[_0x66d6('0xa0')]||![],'faxPause':_0x76a169[_0x66d6('0xa0')]||![],'smsPause':_0x76a169[_0x66d6('0xa0')]||![],'openchannelPause':_0x76a169[_0x66d6('0xa0')]||![],'whatsappPause':_0x76a169[_0x66d6('0xa0')]||![],'pauseType':_0x76a169[_0x66d6('0xa0')]?'LOGININPAUSE':null,'interface':_0x56119d,'lastPauseAt':moment()[_0x66d6('0xad')](_0x66d6('0x100'))});}})[_0x66d6('0x21')](function(_0xc38c43){if(_0x37fffd[_0x66d6('0x105')]){return _0x2ae0a9();}else{return Promise[_0x66d6('0x106')](_0xc38c43)[_0x66d6('0x21')](respondWithResult(_0x52bd05,null));}})[_0x66d6('0x59')](handleError(_0x52bd05,null));};exports[_0x66d6('0x107')]=function(_0x11b6e7,_0x38ff1e){var _0x13791b;return db[_0x66d6('0x4e')][_0x66d6('0x37')]({'where':{'id':_0x11b6e7[_0x66d6('0x5b')]['id'],'role':_0x66d6('0x2b')},'attributes':['id',_0x66d6('0x38'),_0x66d6('0x2a')]})[_0x66d6('0x21')](handleEntityNotFound(_0x38ff1e,null))[_0x66d6('0x21')](function(_0xb9b0ca){if(_0xb9b0ca){_0x13791b=_0xb9b0ca;return db[_0x66d6('0xae')]['destroy']({'where':{'membername':_0x13791b[_0x66d6('0x38')]},'individualHooks':!![]});}})[_0x66d6('0x21')](function(){return db[_0x66d6('0xfd')]['findAll']({'where':{'membername':_0x13791b[_0x66d6('0x38')],'exitAt':null}});})[_0x66d6('0x21')](function(_0x5ced1a){var _0x32702d=[];_0x5ced1a[_0x66d6('0xfe')](function(_0x25dfc0){_0x32702d[_0x66d6('0x4d')](_0x25dfc0[_0x66d6('0x29')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x32702d);})[_0x66d6('0x21')](function(){return _0x13791b[_0x66d6('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x66d6('0x21')](respondWithResult(_0x38ff1e,null))['catch'](handleError(_0x38ff1e,null));};exports[_0x66d6('0x108')]=function(_0x50fc85,_0x146e17){var _0x2385f6;return db[_0x66d6('0xae')][_0x66d6('0x29')]({'paused':0x1},{'where':{'UserId':_0x50fc85[_0x66d6('0x5b')]['id']},'individualHooks':!![]})[_0x66d6('0x21')](function(){return db['User']['find']({'where':{'id':_0x50fc85['params']['id'],'role':_0x66d6('0x2b')},'attributes':['id',_0x66d6('0x38'),_0x66d6('0x2a'),_0x66d6('0x6a'),_0x66d6('0xa2'),_0x66d6('0x9f')]});})[_0x66d6('0x21')](handleEntityNotFound(_0x146e17,null))[_0x66d6('0x21')](function(_0x12d8fe){if(_0x12d8fe){_0x2385f6=_0x12d8fe;return respondWithRpcPromise(_0x66d6('0x109'),'pause',{'id':_0x2385f6['id'],'name':_0x2385f6['name'],'pause':!![]});}})['then'](function(){if(_0x2385f6){return db[_0x66d6('0xfd')][_0x66d6('0x4f')]({'where':{'membername':_0x2385f6[_0x66d6('0x38')],'type':_0x66d6('0x103'),'exitAt':null}});}})['then'](function(_0x193155){if(_0x193155[_0x66d6('0x52')]){var _0x58a30a=moment()[_0x66d6('0xad')](_0x66d6('0x100'));for(var _0x50930d=0x0,_0x4deeb5=_0x193155[_0x66d6('0x52')];_0x50930d<_0x4deeb5;_0x50930d++){_0x193155[_0x50930d][_0x66d6('0x10a')]({'exitAt':_0x58a30a});}}})[_0x66d6('0x21')](function(){var _0x3c1065=[];var _0x148960=utils[_0x66d6('0xff')]();_0x148960[_0x66d6('0xfe')](function(_0xb6d80b){_0x3c1065[_0x66d6('0x4d')]({'channel':_0xb6d80b,'membername':_0x2385f6[_0x66d6('0x38')],'interface':_['isNil'](_0x2385f6[_0x66d6('0xa2')])?util[_0x66d6('0xad')](_0x66d6('0x10b'),_0x2385f6[_0x66d6('0x38')]):_0x2385f6[_0x66d6('0xa2')],'type':_0x66d6('0x103'),'enterAt':moment()[_0x66d6('0xad')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x50fc85[_0x66d6('0x61')]['type']||_0x66d6('0x10c'),'role':_0x2385f6[_0x66d6('0x2a')],'internal':_0x2385f6[_0x66d6('0x6a')]});});return db[_0x66d6('0xfd')][_0x66d6('0x8b')](_0x3c1065,{'individualHooks':!![]});})[_0x66d6('0x21')](function(){return _0x2385f6[_0x66d6('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x50fc85[_0x66d6('0x61')][_0x66d6('0x3f')]||_0x66d6('0x10c'),'lastPauseAt':moment()[_0x66d6('0xad')](_0x66d6('0x100'))});})[_0x66d6('0x21')](respondWithResult(_0x146e17,null))['catch'](handleError(_0x146e17,null));};exports[_0x66d6('0x10d')]=function(_0xf04acb,_0xb4c10f){if(_0xf04acb[_0x66d6('0x61')]['channel']&&!utils[_0x66d6('0xa3')](_0xf04acb[_0x66d6('0x61')][_0x66d6('0x9e')])){throw new APIBadRequestError(util[_0x66d6('0xad')](_0x66d6('0x10e'),_0xf04acb[_0x66d6('0x61')][_0x66d6('0x9e')]));}return db['User'][_0x66d6('0x37')]({'where':{'id':_0xf04acb[_0x66d6('0x5b')]['id']},'attributes':['id',_0x66d6('0x38'),'role',_0x66d6('0x6a'),_0x66d6('0xa2'),_0x66d6('0x9f'),_0x66d6('0xa1'),_0x66d6('0x10f'),_0x66d6('0x110'),_0x66d6('0x111'),_0x66d6('0x112'),_0x66d6('0x113'),_0x66d6('0x114'),_0x66d6('0x115'),_0x66d6('0x116')]})[_0x66d6('0x21')](function(_0x1641bf){if(!_0x1641bf){throw new APINotFoundError(util[_0x66d6('0xad')](_0x66d6('0xca'),_0xf04acb['params']['id']));}return _0x1641bf[_0x66d6('0x10d')](_0xf04acb[_0x66d6('0x61')]['channel']);})['then'](respondWithResult(_0xb4c10f,null))[_0x66d6('0x59')](APIHandleError(_0xb4c10f));};exports[_0x66d6('0x117')]=function(_0x4a9c80,_0x2a972a){var _0x4eea45={};var _0x475f04={};var _0x5e8d71;var _0x26f299;return db[_0x66d6('0x4e')][_0x66d6('0x9a')]({'where':{'id':_0x4a9c80[_0x66d6('0x5b')]['id']}})[_0x66d6('0x21')](handleEntityNotFound(_0x2a972a,null))[_0x66d6('0x21')](function(_0x1bad83){if(_0x1bad83){_0x5e8d71=_0x1bad83;_0x475f04[_0x66d6('0xd2')]=_[_0x66d6('0xd3')](db[_0x66d6('0x118')]['rawAttributes']);_0x475f04[_0x66d6('0x47')]=_['keys'](_0x4a9c80['query']);_0x475f04[_0x66d6('0xd7')]=_[_0x66d6('0xdb')](_0x475f04['model'],_0x475f04[_0x66d6('0x47')]);_0x4eea45['attributes']=_['intersection'](_0x475f04[_0x66d6('0xd2')],qs['fields'](_0x4a9c80[_0x66d6('0x47')][_0x66d6('0xd5')]));_0x4eea45[_0x66d6('0x4c')]=_0x4eea45[_0x66d6('0x4c')][_0x66d6('0x52')]?_0x4eea45[_0x66d6('0x4c')]:_0x475f04[_0x66d6('0xd2')];_0x4eea45[_0x66d6('0xdc')]=qs['sort'](_0x4a9c80['query'][_0x66d6('0xd6')]);_0x4eea45[_0x66d6('0x46')]=qs[_0x66d6('0xd7')](_[_0x66d6('0xd8')](_0x4a9c80[_0x66d6('0x47')],_0x475f04[_0x66d6('0xd7')]));if(_0x4a9c80[_0x66d6('0x47')]['filter']){_0x4eea45[_0x66d6('0x46')]=_['merge'](_0x4eea45['where'],{'$or':_[_0x66d6('0x34')](_0x4eea45['attributes'],function(_0x3cea27){var _0x4e6c69={};_0x4e6c69[_0x3cea27]={'$like':'%'+_0x4a9c80[_0x66d6('0x47')][_0x66d6('0x32')]+'%'};return _0x4e6c69;})});}_0x4eea45=_[_0x66d6('0x5e')]({},_0x4eea45,_0x4a9c80[_0x66d6('0x5f')]);return _0x5e8d71[_0x66d6('0x117')](_0x4eea45);}})[_0x66d6('0x21')](function(_0x5b249f){if(_0x5b249f){_0x26f299=_0x5b249f['length'];if(!_0x4a9c80[_0x66d6('0x47')][_0x66d6('0xdd')](_0x66d6('0xd9'))){_0x4eea45[_0x66d6('0x1b')]=qs['limit'](_0x4a9c80[_0x66d6('0x47')][_0x66d6('0x1b')]);_0x4eea45[_0x66d6('0x1d')]=qs[_0x66d6('0x1d')](_0x4a9c80[_0x66d6('0x47')][_0x66d6('0x1d')]);}return _0x5e8d71[_0x66d6('0x117')](_0x4eea45);}})[_0x66d6('0x21')](function(_0x4aa602){if(_0x4aa602){return _0x4aa602?{'count':_0x26f299,'rows':_0x4aa602}:null;}})[_0x66d6('0x21')](respondWithResult(_0x2a972a,null))['catch'](handleError(_0x2a972a,null));};exports[_0x66d6('0x119')]=function(_0x1a2d78,_0x1baaa6){var _0x4857e2=_0x1a2d78[_0x66d6('0x5b')]['id'];var _0x1e74d6=_0x1a2d78['body']?_0x1a2d78['body'][_0x66d6('0x64')]:null;var _0x2a560c=[];return Promise['resolve']()[_0x66d6('0x21')](function(){if(!_0x1e74d6)throw new APIBadRequestError(_0x66d6('0x11a'));})[_0x66d6('0x21')](function(){return db[_0x66d6('0x4e')][_0x66d6('0x9a')]({'where':{'id':_0x4857e2}});})[_0x66d6('0x21')](function(_0x25d2d6){if(!_0x25d2d6)throw new APINotFoundError(util[_0x66d6('0xad')](_0x66d6('0xca'),_0x1a2d78[_0x66d6('0x5b')]['id']));return db[_0x66d6('0x11b')]['transaction'](function(_0x1eee34){return _0x25d2d6[_0x66d6('0x119')](_0x1e74d6,{'transaction':_0x1eee34})[_0x66d6('0x21')](function(){return db[_0x66d6('0x118')]['findAll']({'where':{'id':{'$in':_0x1e74d6}}});})[_0x66d6('0x21')](function(_0xccab2a){var _0x41e928=_['map'](_0xccab2a,function(_0x20bc4b){return _0x20bc4b['getAssociatedQueues']();});return Promise[_0x66d6('0x58')](_0x41e928);})[_0x66d6('0x21')](function(_0x32cd76){_0x2a560c=_[_0x66d6('0x11c')](_0x32cd76);var _0x2cc581=_['map'](_0x2a560c,function(_0x4407e1){return _0x4407e1[_0x66d6('0x11d')](_0x25d2d6['id'],{'transaction':_0x1eee34});});return Promise[_0x66d6('0x58')](_0x2cc581);})['then'](function(){if(!_0x25d2d6[_0x66d6('0x9f')])return;var _0x30f29d=_[_0x66d6('0x32')](_0x2a560c,function(_0x23b7a1){return _0x23b7a1[_0x66d6('0x11e')](_0x66d6('0x9e'))===_0x66d6('0x11f');});var _0xad9149=_[_0x66d6('0x34')](_0x30f29d,function(_0x5d4ab0){return db[_0x66d6('0xae')][_0x66d6('0x120')]({'membername':_0x25d2d6[_0x66d6('0x38')],'UserId':_0x25d2d6['id'],'queue_name':_0x5d4ab0[_0x66d6('0x38')],'VoiceQueueId':_0x5d4ab0['id'],'interface':_[_0x66d6('0x6b')](_0x25d2d6[_0x66d6('0xa2')])?util['format']('SIP/%s',_0x25d2d6[_0x66d6('0x38')]):_0x25d2d6[_0x66d6('0xa2')],'paused':_0x25d2d6['voicePause']||![],'penalty':_0x25d2d6[_0x66d6('0xa7')]},{'transaction':_0x1eee34});});return Promise[_0x66d6('0x58')](_0xad9149);})[_0x66d6('0x21')](function(){return db[_0x66d6('0x121')][_0x66d6('0x4f')]({'where':{'teamId':{'$in':_0x1e74d6}}});})[_0x66d6('0x21')](function(_0x29a939){var _0x59e295=_[_0x66d6('0x34')](_0x29a939,function(_0x46b90d){return db[_0x66d6('0x122')][_0x66d6('0x80')]({'UserId':_0x25d2d6['id'],'VoicePrefixId':_0x46b90d[_0x66d6('0x123')]},{'transaction':_0x1eee34});});return Promise[_0x66d6('0x58')](_0x59e295);});});})[_0x66d6('0x21')](function(){for(var _0x2c70ad=0x0;_0x2c70ad<_0x2a560c[_0x66d6('0x52')];_0x2c70ad++){var _0x19513c=_0x2a560c[_0x2c70ad][_0x66d6('0x11e')]('channel');var _0x83750a=_0x19513c+_0x66d6('0xa9');socket[_0x66d6('0x2c')](_0x66d6('0x81')+_0x19513c+'Queue:save',{'UserId':_0x4857e2,['queueField']:_0x2a560c[_0x2c70ad]['id']});}})['then'](respondWithStatusCode(_0x1baaa6,null))[_0x66d6('0x59')](APIHandleError(_0x1baaa6));};exports[_0x66d6('0x124')]=function(_0x428b7d,_0x353909){var _0x5e1e96=_0x428b7d[_0x66d6('0x5b')]['id'];var _0x219742=null;if(_0x428b7d['query'][_0x66d6('0x64')]){_0x219742=_[_0x66d6('0xb1')](_0x428b7d['query'][_0x66d6('0x64')])?_0x428b7d[_0x66d6('0x47')][_0x66d6('0x64')]:[_0x428b7d[_0x66d6('0x47')][_0x66d6('0x64')]];}var _0x5c97a8=[];return Promise['resolve']()['then'](function(){if(!_0x219742)throw new APIBadRequestError(_0x66d6('0x125'));})[_0x66d6('0x21')](function(){return db[_0x66d6('0x4e')][_0x66d6('0x9a')]({'where':{'id':_0x5e1e96}});})[_0x66d6('0x21')](function(_0x3cfaa9){if(!_0x3cfaa9)throw new APINotFoundError(util[_0x66d6('0xad')]('User\x20with\x20id\x20%s\x20not\x20found',_0x428b7d[_0x66d6('0x5b')]['id']));return db[_0x66d6('0x11b')][_0x66d6('0xfa')](function(_0x21c880){return _0x3cfaa9[_0x66d6('0x124')](_0x219742,{'transaction':_0x21c880})[_0x66d6('0x21')](function(){return db[_0x66d6('0x118')][_0x66d6('0x4f')]({'where':{'id':{'$in':_0x219742}}});})[_0x66d6('0x21')](function(_0x176deb){var _0x29ba0a=_['map'](_0x176deb,function(_0x5bdb98){return _0x5bdb98[_0x66d6('0x126')]();});return Promise['all'](_0x29ba0a);})[_0x66d6('0x21')](function(_0x3039a2){_0x5c97a8=_[_0x66d6('0x11c')](_0x3039a2);var _0x393aec=_['map'](_0x5c97a8,function(_0x23cb19){return _0x23cb19[_0x66d6('0x127')](_0x3cfaa9['id'],{'transaction':_0x21c880});});return Promise['all'](_0x393aec);})[_0x66d6('0x21')](function(){if(!_0x3cfaa9[_0x66d6('0x9f')])return;var _0x83f080=_[_0x66d6('0x32')](_0x5c97a8,function(_0x1b8d58){return _0x1b8d58[_0x66d6('0x11e')]('channel')===_0x66d6('0x11f');});var _0x2e4ee9=_[_0x66d6('0x34')](_0x83f080,function(_0x3b159b){return db[_0x66d6('0xae')][_0x66d6('0xfb')]({'where':{'VoiceQueueId':_0x3b159b['id'],'UserId':_0x3cfaa9['id']},'transaction':_0x21c880});});return Promise[_0x66d6('0x58')](_0x2e4ee9);})[_0x66d6('0x21')](function(){return db[_0x66d6('0x121')][_0x66d6('0x4f')]({'where':{'teamId':{'$in':_0x219742}}});})[_0x66d6('0x21')](function(_0x599639){var _0x54d636=_[_0x66d6('0x34')](_0x599639,function(_0x3a95b9){return db[_0x66d6('0x122')]['destroy']({'where':{'UserId':_0x3cfaa9['id'],'VoicePrefixId':_0x3a95b9[_0x66d6('0x123')]}},{'transaction':_0x21c880});});return Promise[_0x66d6('0x58')](_0x54d636);});});})[_0x66d6('0x21')](function(){for(var _0x3b8c4f=0x0;_0x3b8c4f<_0x5c97a8[_0x66d6('0x52')];_0x3b8c4f++){var _0x1b9ce6=_0x5c97a8[_0x3b8c4f][_0x66d6('0x11e')](_0x66d6('0x9e'));var _0xc4bf66=_0x1b9ce6+_0x66d6('0xa9');socket[_0x66d6('0x2c')](_0x66d6('0x81')+_0x1b9ce6+_0x66d6('0xb2'),{'UserId':_0x5e1e96,['queueField']:_0x5c97a8[_0x3b8c4f]['id']});}})[_0x66d6('0x21')](respondWithStatusCode(_0x353909,null))[_0x66d6('0x59')](APIHandleError(_0x353909));};exports[_0x66d6('0x128')]=function(_0x500951,_0x49dc70){var _0x41a48c={};var _0x27d5ec={};var _0x2bd94c;var _0x170a88;return db[_0x66d6('0x4e')][_0x66d6('0x9a')]({'where':{'id':_0x500951['params']['id']}})['then'](handleEntityNotFound(_0x49dc70,null))['then'](function(_0x316466){if(_0x316466){_0x2bd94c=_0x316466;_0x27d5ec['model']=_['keys'](db[_0x66d6('0xcb')][_0x66d6('0x3d')]);_0x27d5ec['query']=_['keys'](_0x500951[_0x66d6('0x47')]);_0x27d5ec[_0x66d6('0xd7')]=_[_0x66d6('0xdb')](_0x27d5ec['model'],_0x27d5ec[_0x66d6('0x47')]);_0x41a48c['attributes']=_[_0x66d6('0xdb')](_0x27d5ec['model'],qs['fields'](_0x500951['query'][_0x66d6('0xd5')]));_0x41a48c[_0x66d6('0x4c')]=_0x41a48c[_0x66d6('0x4c')][_0x66d6('0x52')]?_0x41a48c['attributes']:_0x27d5ec[_0x66d6('0xd2')];_0x41a48c[_0x66d6('0xdc')]=qs[_0x66d6('0xd6')](_0x500951[_0x66d6('0x47')][_0x66d6('0xd6')]);_0x41a48c[_0x66d6('0x46')]=qs['filters'](_[_0x66d6('0xd8')](_0x500951[_0x66d6('0x47')],_0x27d5ec[_0x66d6('0xd7')]));if(_0x500951[_0x66d6('0x47')][_0x66d6('0x32')]){_0x41a48c[_0x66d6('0x46')]=_['merge'](_0x41a48c['where'],{'$or':_[_0x66d6('0x34')](_0x41a48c[_0x66d6('0x4c')],function(_0x2d2f1a){var _0x2a2f57={};_0x2a2f57[_0x2d2f1a]={'$like':'%'+_0x500951[_0x66d6('0x47')][_0x66d6('0x32')]+'%'};return _0x2a2f57;})});}_0x41a48c=_[_0x66d6('0x5e')]({},_0x41a48c,_0x500951[_0x66d6('0x5f')]);return _0x2bd94c[_0x66d6('0x128')](_0x41a48c);}})[_0x66d6('0x21')](function(_0x58549b){if(_0x58549b){_0x170a88=_0x58549b[_0x66d6('0x52')];if(!_0x500951[_0x66d6('0x47')][_0x66d6('0xdd')](_0x66d6('0xd9'))){_0x41a48c[_0x66d6('0x1b')]=qs[_0x66d6('0x1b')](_0x500951[_0x66d6('0x47')][_0x66d6('0x1b')]);_0x41a48c['offset']=qs[_0x66d6('0x1d')](_0x500951[_0x66d6('0x47')][_0x66d6('0x1d')]);}return _0x2bd94c['getLists'](_0x41a48c);}})[_0x66d6('0x21')](function(_0x3afe6d){if(_0x3afe6d){return _0x3afe6d?{'count':_0x170a88,'rows':_0x3afe6d}:null;}})[_0x66d6('0x21')](respondWithResult(_0x49dc70,null))[_0x66d6('0x59')](handleError(_0x49dc70,null));};exports[_0x66d6('0x129')]=function(_0x4bb54f,_0x3eacef){var _0x9dd978={};var _0x5b30f={};var _0x47f071;return db['User'][_0x66d6('0x9a')]({'where':{'id':_0x4bb54f[_0x66d6('0x5b')]['id']}})[_0x66d6('0x21')](handleEntityNotFound(_0x3eacef,null))[_0x66d6('0x21')](function(_0x20d600){if(_0x20d600){_0x47f071=_0x20d600;_0x5b30f[_0x66d6('0xd2')]=_[_0x66d6('0xd3')](db['User'][_0x66d6('0x3d')]);_0x5b30f[_0x66d6('0x47')]=_[_0x66d6('0xd3')](_0x4bb54f[_0x66d6('0x47')]);_0x5b30f[_0x66d6('0xd7')]=_[_0x66d6('0xdb')](_0x5b30f[_0x66d6('0xd2')],_0x5b30f['query']);_0x9dd978[_0x66d6('0x4c')]=_['intersection'](_0x5b30f[_0x66d6('0xd2')],qs['fields'](_0x4bb54f[_0x66d6('0x47')]['fields']));_0x9dd978[_0x66d6('0x4c')]=_0x9dd978[_0x66d6('0x4c')][_0x66d6('0x52')]?_0x9dd978[_0x66d6('0x4c')]:_0x5b30f[_0x66d6('0xd2')];_0x9dd978[_0x66d6('0xdc')]=qs['sort'](_0x4bb54f[_0x66d6('0x47')][_0x66d6('0xd6')]);_0x9dd978['where']=qs['filters'](_[_0x66d6('0xd8')](_0x4bb54f['query'],_0x5b30f[_0x66d6('0xd7')]));if(_0x4bb54f['query']['filter']){_0x9dd978[_0x66d6('0x46')]=_[_0x66d6('0x5e')](_0x9dd978[_0x66d6('0x46')],{'$or':_['map'](_0x9dd978['attributes'],function(_0x32b906){var _0x328cb4={};_0x328cb4[_0x32b906]={'$like':'%'+_0x4bb54f[_0x66d6('0x47')][_0x66d6('0x32')]+'%'};return _0x328cb4;})});}_0x9dd978[_0x66d6('0xd2')]=db['User'];_0x9dd978['as']=_0x66d6('0x2f');_0x9dd978=_[_0x66d6('0x5e')]({},_0x9dd978,_0x4bb54f[_0x66d6('0x5f')]);return _0x47f071[_0x66d6('0x12a')]({'include':[_0x9dd978]});}})[_0x66d6('0x21')](function(_0x4229c8){if(_0x4229c8){var _0x475271={},_0x2ad463=[];for(var _0x365e28=0x0;_0x365e28<_0x4229c8[_0x66d6('0x52')];_0x365e28+=0x1){for(var _0x5ed08e=0x0,_0x1b180f;_0x5ed08e<_0x4229c8[_0x365e28][_0x66d6('0x2f')][_0x66d6('0x52')];_0x5ed08e+=0x1){_0x1b180f=_0x4229c8[_0x365e28][_0x66d6('0x2f')][_0x5ed08e][_0x66d6('0x2d')]({'plain':!![]});_0x475271[_0x1b180f['id']]=_0x1b180f;}}_0x475271=_[_0x66d6('0x12b')](_0x475271);for(var _0x1c97ae=qs[_0x66d6('0x1d')](_0x4bb54f['query']['offset']);_0x1c97ae<_0x475271[_0x66d6('0x52')]&&_0x2ad463[_0x66d6('0x52')]=_0x1e12c2['agents']){throw new Error(_0xc2b4('0x4e'));}})[_0xc2b4('0x15')](function(){if(_0x2ea050){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x2ea050['name']},'individualHooks':!![]});}})[_0xc2b4('0x15')](function(){if(_0x2ea050){return _0x2ea050['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x2b8728){if(_0x2ea050){if(_0x2b8728){var _0x3eefbc=[];_0x5b6fc7=_0x2b8728;if(_0x5b6fc7[_0xc2b4('0x29')]){for(var _0x4a9017=0x0;_0x4a9017<_0x5b6fc7[_0xc2b4('0x29')];_0x4a9017++){_0x3eefbc[_0xc2b4('0x2c')](db[_0xc2b4('0x26')][_0xc2b4('0x4f')]({'membername':_0x2ea050['name'],'UserId':_0x2ea050['id'],'queue_name':_0x5b6fc7[_0x4a9017]['name'],'VoiceQueueId':_0x5b6fc7[_0x4a9017]['id'],'interface':_0x3047df,'paused':_0x2ea050[_0xc2b4('0x47')]||![],'penalty':_0x5b6fc7[_0x4a9017][_0xc2b4('0x50')]||0x0}));}return BPromise[_0xc2b4('0x51')](_0x3eefbc);}}}})[_0xc2b4('0x15')](function(){if(_0x2ea050){return db[_0xc2b4('0x27')][_0xc2b4('0x28')]({'where':{'membername':_0x2ea050[_0xc2b4('0x20')],'exitAt':null}});}})[_0xc2b4('0x15')](function(_0x38f96c){if(_0x2ea050){if(_0x38f96c&&_0x38f96c['length']){var _0x5e6026=[];_0x38f96c[_0xc2b4('0x2b')](function(_0x542fb7){_0x5e6026['push'](_0x542fb7[_0xc2b4('0x43')]({'exitAt':moment()[_0xc2b4('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x5e6026);}}})[_0xc2b4('0x15')](function(){if(_0x2ea050){var _0x41a005=[];var _0x8817ce=[];var _0x4e48af=utils[_0xc2b4('0x52')]();var _0x2d06b3={'membername':_0x2ea050['name'],'interface':_0x3047df,'enterAt':moment()[_0xc2b4('0x2f')](_0xc2b4('0x2a')),'role':_0x2ea050[_0xc2b4('0x21')],'internal':_0x2ea050[_0xc2b4('0x22')]};_0x4e48af[_0xc2b4('0x2b')](function(_0x33a37d){_0x41a005[_0xc2b4('0x2c')](_['merge']({'channel':_0x33a37d,'type':_0xc2b4('0x53'),'data1':_0xc2b4('0x54'),'data2':_0x3047df},_0x2d06b3));if(_0x2ea050[_0xc2b4('0x47')]){_0x8817ce[_0xc2b4('0x2c')](_[_0xc2b4('0x55')]({'channel':_0x33a37d,'type':_0xc2b4('0x2e'),'data1':_0xc2b4('0x56')},_0x2d06b3));}});return db[_0xc2b4('0x27')][_0xc2b4('0x33')](_0x41a005[_0xc2b4('0x57')](_0x8817ce),{'individualHooks':!![]});}})['then'](function(){if(_0x2ea050){return _0x2ea050[_0xc2b4('0x43')]({'online':!![],'lastLoginAt':moment()[_0xc2b4('0x2f')](_0xc2b4('0x2a')),'voicePause':_0x2ea050[_0xc2b4('0x47')]||![],'mailPause':_0x2ea050[_0xc2b4('0x47')]||![],'chatPause':_0x2ea050[_0xc2b4('0x47')]||![],'faxPause':_0x2ea050[_0xc2b4('0x47')]||![],'smsPause':_0x2ea050[_0xc2b4('0x47')]||![],'openchannelPause':_0x2ea050['loginInPause']||![],'pauseType':_0x2ea050[_0xc2b4('0x47')]?_0xc2b4('0x56'):null,'lastPauseAt':moment()[_0xc2b4('0x2f')](_0xc2b4('0x2a')),'interface':_0x3047df});}})[_0xc2b4('0x15')](function(_0x2986d7){_0x41b1b1(_0x2986d7);})[_0xc2b4('0x19')](function(_0x1d42ab){_0x2e714e(_0x266605[_0xc2b4('0x44')](0x1f4,_0x1d42ab[_0xc2b4('0x1a')]));});});}; \ No newline at end of file +var _0x48b3=['role','uniqueid','bulkCreate','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','LogoutUser','destroy','all','LoginUser','mobile','phone','agent','../../config/license/util','agents','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','callysquare','loginInPause','LOGININPAUSE','concat','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','GetUser','User','findAll','options','raw','where','attributes','limit','include','map','model','then','info','catch','error','message','find','debug','ShowUser','PauseUser','internal','interface','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','name','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','body','type','DEFAULT\x20PAUSE'];(function(_0x4ab134,_0x22c764){var _0x95b707=function(_0x113790){while(--_0x113790){_0x4ab134['push'](_0x4ab134['shift']());}};_0x95b707(++_0x22c764);}(_0x48b3,0x171));var _0x348b=function(_0x16658e,_0x15dc5e){_0x16658e=_0x16658e-0x0;var _0x5cb025=_0x48b3[_0x16658e];return _0x5cb025;};'use strict';var _=require(_0x348b('0x0'));var util=require('util');var moment=require(_0x348b('0x1'));var BPromise=require(_0x348b('0x2'));var Redis=require('ioredis');var db=require(_0x348b('0x3'))['db'];var utils=require(_0x348b('0x4'));var logger=require(_0x348b('0x5'))(_0x348b('0x6'));var config=require(_0x348b('0x7'));config['redis']=_['defaults'](config[_0x348b('0x8')],{'host':_0x348b('0x9'),'port':0x18eb});var socket=require(_0x348b('0xa'))(new Redis(config[_0x348b('0x8')]));require('./user.socket')['register'](socket);exports[_0x348b('0xb')]=function(_0x569836){var _0x31d09b=this;return new Promise(function(_0x387f89,_0x50cedd){return db[_0x348b('0xc')][_0x348b('0xd')]({'raw':_0x569836[_0x348b('0xe')]?_0x569836[_0x348b('0xe')][_0x348b('0xf')]===undefined?!![]:![]:!![],'where':_0x569836[_0x348b('0xe')]?_0x569836[_0x348b('0xe')][_0x348b('0x10')]||null:null,'attributes':_0x569836[_0x348b('0xe')]?_0x569836['options'][_0x348b('0x11')]||null:null,'limit':_0x569836[_0x348b('0xe')]?_0x569836[_0x348b('0xe')][_0x348b('0x12')]||null:null,'include':_0x569836[_0x348b('0xe')]?_0x569836[_0x348b('0xe')][_0x348b('0x13')]?_[_0x348b('0x14')](_0x569836[_0x348b('0xe')][_0x348b('0x13')],function(_0x17e503){return{'model':db[_0x17e503[_0x348b('0x15')]],'as':_0x17e503['as'],'attributes':_0x17e503[_0x348b('0x11')],'include':_0x17e503['include']?_[_0x348b('0x14')](_0x17e503[_0x348b('0x13')],function(_0x638cf6){return{'model':db[_0x638cf6[_0x348b('0x15')]],'as':_0x638cf6['as'],'attributes':_0x638cf6[_0x348b('0x11')],'include':_0x638cf6[_0x348b('0x13')]?_['map'](_0x638cf6[_0x348b('0x13')],function(_0x46cb80){return{'model':db[_0x46cb80[_0x348b('0x15')]],'as':_0x46cb80['as'],'attributes':_0x46cb80['attributes']};}):[]};}):[]};}):[]:[]})[_0x348b('0x16')](function(_0x25f29b){logger[_0x348b('0x17')]('GetUser',_0x569836);logger['debug'](_0x348b('0xb'),_0x569836,JSON['stringify'](_0x25f29b));_0x387f89(_0x25f29b);})[_0x348b('0x18')](function(_0x3f353d){logger[_0x348b('0x19')]('GetUser',_0x3f353d[_0x348b('0x1a')],_0x569836);_0x50cedd(_0x31d09b[_0x348b('0x19')](0x1f4,_0x3f353d['message']));});});};exports['ShowUser']=function(_0x22cb20){var _0x42ca9e=this;return new Promise(function(_0x2689bd,_0x5b6803){return db[_0x348b('0xc')][_0x348b('0x1b')]({'raw':_0x22cb20[_0x348b('0xe')]?_0x22cb20['options'][_0x348b('0xf')]===undefined?!![]:![]:!![],'where':_0x22cb20[_0x348b('0xe')]?_0x22cb20[_0x348b('0xe')][_0x348b('0x10')]||null:null,'attributes':_0x22cb20[_0x348b('0xe')]?_0x22cb20[_0x348b('0xe')][_0x348b('0x11')]||null:null,'include':_0x22cb20[_0x348b('0xe')]?_0x22cb20[_0x348b('0xe')][_0x348b('0x13')]?_['map'](_0x22cb20[_0x348b('0xe')][_0x348b('0x13')],function(_0x128725){return{'model':db[_0x128725[_0x348b('0x15')]],'as':_0x128725['as'],'attributes':_0x128725[_0x348b('0x11')],'include':_0x128725[_0x348b('0x13')]?_[_0x348b('0x14')](_0x128725[_0x348b('0x13')],function(_0x1530be){return{'model':db[_0x1530be[_0x348b('0x15')]],'as':_0x1530be['as'],'attributes':_0x1530be[_0x348b('0x11')],'include':_0x1530be['include']?_[_0x348b('0x14')](_0x1530be[_0x348b('0x13')],function(_0x2ebea3){return{'model':db[_0x2ebea3[_0x348b('0x15')]],'as':_0x2ebea3['as'],'attributes':_0x2ebea3['attributes']};}):[]};}):[]};}):[]:[]})[_0x348b('0x16')](function(_0x22929e){logger['info']('ShowUser',_0x22cb20);logger[_0x348b('0x1c')](_0x348b('0x1d'),_0x22cb20,JSON['stringify'](_0x22929e));_0x2689bd(_0x22929e);})['catch'](function(_0x5196fd){logger[_0x348b('0x19')](_0x348b('0x1d'),_0x5196fd['message'],_0x22cb20);_0x5b6803(_0x42ca9e[_0x348b('0x19')](0x1f4,_0x5196fd[_0x348b('0x1a')]));});});};exports[_0x348b('0x1e')]=function(_0x12b1e7){var _0x2afa1b;return db[_0x348b('0xc')]['find']({'where':_0x12b1e7['options'][_0x348b('0x10')]||{},'attributes':['id','name','role',_0x348b('0x1f'),_0x348b('0x20')]})[_0x348b('0x16')](function(_0x337da9){if(!_0x337da9){throw new Error(util['format'](_0x348b('0x21'),_0x12b1e7[_0x348b('0x22')]['id']));}_0x2afa1b=_0x337da9;return db[_0x348b('0x23')][_0x348b('0x24')]({'paused':0x1},{'where':{'UserId':_0x2afa1b['id']},'individualHooks':!![]});})[_0x348b('0x16')](function(){return db[_0x348b('0x25')]['findAll']({'where':{'membername':_0x2afa1b[_0x348b('0x26')],'type':_0x348b('0x27'),'exitAt':null}});})[_0x348b('0x16')](function(_0x283e19){if(_0x283e19&&_0x283e19[_0x348b('0x28')]){var _0x2591a5=moment()[_0x348b('0x29')](_0x348b('0x2a'));for(var _0x1f8c1f=0x0,_0x2aa227=_0x283e19[_0x348b('0x28')];_0x1f8c1f<_0x2aa227;_0x1f8c1f++){_0x283e19[_0x1f8c1f][_0x348b('0x2b')]({'exitAt':_0x2591a5});}}})['then'](function(){var _0x1b656e=[];var _0x53e87c=utils[_0x348b('0x2c')]();_0x53e87c[_0x348b('0x2d')](function(_0x29c860){_0x1b656e[_0x348b('0x2e')]({'channel':_0x29c860,'membername':_0x2afa1b['name'],'interface':_[_0x348b('0x2f')](_0x2afa1b['interface'])?util[_0x348b('0x29')]('SIP/%s',_0x2afa1b[_0x348b('0x26')]):_0x2afa1b[_0x348b('0x20')],'type':_0x348b('0x27'),'enterAt':moment()[_0x348b('0x29')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x12b1e7[_0x348b('0x30')][_0x348b('0x31')]||_0x348b('0x32'),'role':_0x2afa1b[_0x348b('0x33')],'internal':_0x2afa1b[_0x348b('0x1f')],'uniqueid':_0x12b1e7[_0x348b('0x30')][_0x348b('0x34')]||null});});return db[_0x348b('0x25')][_0x348b('0x35')](_0x1b656e,{'individualHooks':!![]});})[_0x348b('0x16')](function(){return _0x2afa1b[_0x348b('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x12b1e7['body']['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x348b('0x29')](_0x348b('0x2a'))});})[_0x348b('0x18')](function(_0x1df0d0){throw _0x1df0d0;});};exports['UnpauseUser']=function(_0x5ca53e){return Promise[_0x348b('0x36')]()[_0x348b('0x16')](function(){if(_0x5ca53e[_0x348b('0x30')][_0x348b('0x37')]&&!utils[_0x348b('0x38')](_0x5ca53e[_0x348b('0x30')][_0x348b('0x37')])){throw new Error(util['format'](_0x348b('0x39'),_0x5ca53e[_0x348b('0x30')][_0x348b('0x37')]));}return db[_0x348b('0xc')][_0x348b('0x3a')]({'where':_0x5ca53e[_0x348b('0xe')]['where']||{},'attributes':['id',_0x348b('0x26'),_0x348b('0x33'),'internal',_0x348b('0x20'),_0x348b('0x3b'),'voicePause',_0x348b('0x3c'),_0x348b('0x3d'),'faxPause',_0x348b('0x3e'),_0x348b('0x3f'),_0x348b('0x40'),_0x348b('0x41'),_0x348b('0x42')]});})[_0x348b('0x16')](function(_0x54001f){if(!_0x54001f){throw new Error(util[_0x348b('0x29')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5ca53e[_0x348b('0x22')]['id']));}return _0x54001f['unpause'](_0x5ca53e[_0x348b('0x30')][_0x348b('0x37')],'system');})['catch'](function(_0x3fb8bf){throw _0x3fb8bf;});};exports[_0x348b('0x43')]=function(_0x488b4c){var _0x5c3a61=this;return new Promise(function(_0x32949e,_0x1e6826){var _0x6b871d;return db[_0x348b('0xc')][_0x348b('0x3a')]({'where':_0x488b4c[_0x348b('0xe')][_0x348b('0x10')]||{},'attributes':['id','name']})[_0x348b('0x16')](function(_0x272c11){if(_0x272c11){_0x6b871d=_0x272c11;return db[_0x348b('0x23')][_0x348b('0x44')]({'where':{'membername':_0x6b871d[_0x348b('0x26')]},'individualHooks':!![]});}})[_0x348b('0x16')](function(){if(_0x6b871d){return db['MemberReport'][_0x348b('0xd')]({'where':{'membername':_0x6b871d['name'],'exitAt':null}});}})[_0x348b('0x16')](function(_0x45170d){if(_0x6b871d){if(_0x45170d&&_0x45170d[_0x348b('0x28')]){var _0x1de8e9=[];_0x45170d['forEach'](function(_0x38222e){_0x1de8e9[_0x348b('0x2e')](_0x38222e[_0x348b('0x24')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x348b('0x45')](_0x1de8e9);}}})['then'](function(){if(_0x6b871d){return _0x6b871d[_0x348b('0x24')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x348b('0x16')](function(_0x38e76f){_0x32949e(_0x38e76f);})[_0x348b('0x18')](function(_0x419025){_0x1e6826(_0x5c3a61[_0x348b('0x19')](0x1f4,_0x419025[_0x348b('0x1a')]));});});};exports[_0x348b('0x46')]=function(_0x218e09){var _0x58d681=this;return new Promise(function(_0x5658fa,_0x4aa7bd){var _0x28bcef;var _0x19a529;var _0x387a04;var _0x344f75;return db[_0x348b('0xc')][_0x348b('0x3a')]({'where':_0x218e09[_0x348b('0xe')][_0x348b('0x10')]||{},'attributes':['id',_0x348b('0x26'),_0x348b('0x33'),_0x348b('0x47'),_0x348b('0x48'),_0x348b('0x1f'),'loginInPause',_0x348b('0x20')]})[_0x348b('0x16')](function(_0xdb91f1){if(_0xdb91f1){_0x28bcef=_0xdb91f1;_0x344f75=_0x218e09[_0x348b('0x30')][_0x348b('0x20')]?_0x218e09[_0x348b('0x30')][_0x348b('0x20')]:util[_0x348b('0x29')]('SIP/%s',_0x28bcef[_0x348b('0x26')]);return db[_0x348b('0xc')]['count']({'where':{'role':_0x348b('0x49'),'online':!![],'id':{'$ne':_0x28bcef['id']}}});}})[_0x348b('0x16')](function(_0x18e8df){if(_0x18e8df){_0x387a04=_0x18e8df;return require(_0x348b('0x4a'))['getLicense']();}})['then'](function(_0x36dd40){if(_0x36dd40&&_0x36dd40[_0x348b('0x4b')]&&_0x387a04>=_0x36dd40['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x28bcef){return db[_0x348b('0x23')][_0x348b('0x44')]({'where':{'membername':_0x28bcef[_0x348b('0x26')]},'individualHooks':!![]});}})[_0x348b('0x16')](function(){if(_0x28bcef){return _0x28bcef[_0x348b('0x4c')]({'raw':!![]});}})[_0x348b('0x16')](function(_0x407747){if(_0x28bcef){if(_0x407747){var _0x54e9f4=[];_0x19a529=_0x407747;if(_0x19a529[_0x348b('0x28')]){for(var _0x3caa6d=0x0;_0x3caa6d<_0x19a529['length'];_0x3caa6d++){_0x54e9f4['push'](db['UserVoiceQueueRt'][_0x348b('0x4d')]({'membername':_0x28bcef[_0x348b('0x26')],'UserId':_0x28bcef['id'],'queue_name':_0x19a529[_0x3caa6d][_0x348b('0x26')],'VoiceQueueId':_0x19a529[_0x3caa6d]['id'],'interface':_0x344f75,'paused':_0x28bcef['loginInPause']||![],'penalty':_0x19a529[_0x3caa6d][_0x348b('0x4e')]||0x0}));}return BPromise['all'](_0x54e9f4);}}}})[_0x348b('0x16')](function(){if(_0x28bcef){return db[_0x348b('0x25')]['findAll']({'where':{'membername':_0x28bcef['name'],'exitAt':null}});}})['then'](function(_0x5eb7e1){if(_0x28bcef){if(_0x5eb7e1&&_0x5eb7e1[_0x348b('0x28')]){var _0x290960=[];_0x5eb7e1[_0x348b('0x2d')](function(_0x281ff1){_0x290960['push'](_0x281ff1[_0x348b('0x24')]({'exitAt':moment()['format'](_0x348b('0x2a'))}));});return BPromise['all'](_0x290960);}}})[_0x348b('0x16')](function(){if(_0x28bcef){var _0x2b20fa=[];var _0x3aaf41=[];var _0x4130e1=utils[_0x348b('0x2c')]();var _0x55b6c2={'membername':_0x28bcef[_0x348b('0x26')],'interface':_0x344f75,'enterAt':moment()['format'](_0x348b('0x2a')),'role':_0x28bcef[_0x348b('0x33')],'internal':_0x28bcef[_0x348b('0x1f')]};_0x4130e1[_0x348b('0x2d')](function(_0x463b73){_0x2b20fa[_0x348b('0x2e')](_[_0x348b('0x4f')]({'channel':_0x463b73,'type':'LOGIN','data1':_0x348b('0x50'),'data2':_0x344f75},_0x55b6c2));if(_0x28bcef[_0x348b('0x51')]){_0x3aaf41[_0x348b('0x2e')](_[_0x348b('0x4f')]({'channel':_0x463b73,'type':'PAUSE','data1':_0x348b('0x52')},_0x55b6c2));}});return db['MemberReport'][_0x348b('0x35')](_0x2b20fa[_0x348b('0x53')](_0x3aaf41),{'individualHooks':!![]});}})[_0x348b('0x16')](function(){if(_0x28bcef){return _0x28bcef[_0x348b('0x24')]({'online':!![],'lastLoginAt':moment()[_0x348b('0x29')](_0x348b('0x2a')),'voicePause':_0x28bcef['loginInPause']||![],'mailPause':_0x28bcef[_0x348b('0x51')]||![],'chatPause':_0x28bcef[_0x348b('0x51')]||![],'faxPause':_0x28bcef[_0x348b('0x51')]||![],'smsPause':_0x28bcef[_0x348b('0x51')]||![],'openchannelPause':_0x28bcef[_0x348b('0x51')]||![],'pauseType':_0x28bcef[_0x348b('0x51')]?_0x348b('0x52'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x344f75});}})[_0x348b('0x16')](function(_0x50f615){_0x5658fa(_0x50f615);})[_0x348b('0x18')](function(_0x41a52c){_0x4aa7bd(_0x58d681[_0x348b('0x19')](0x1f4,_0x41a52c[_0x348b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 522aa9d..529c7bc 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 _0x7ee5=['register','length','user:','./user.events','remove','update','emit','removeListener'];(function(_0x5debd7,_0x333cff){var _0x4a02e4=function(_0x2c6675){while(--_0x2c6675){_0x5debd7['push'](_0x5debd7['shift']());}};_0x4a02e4(++_0x333cff);}(_0x7ee5,0x1bb));var _0x57ee=function(_0x4a2cc2,_0x1fbafa){_0x4a2cc2=_0x4a2cc2-0x0;var _0x3f5f5c=_0x7ee5[_0x4a2cc2];return _0x3f5f5c;};'use strict';var UserEvents=require(_0x57ee('0x0'));var events=['save',_0x57ee('0x1'),_0x57ee('0x2')];function createListener(_0x3831fb,_0x320fca){return function(_0x11a517){_0x320fca[_0x57ee('0x3')](_0x3831fb,_0x11a517);};}function removeListener(_0x8c15fd,_0x1c6998){return function(){UserEvents[_0x57ee('0x4')](_0x8c15fd,_0x1c6998);};}exports[_0x57ee('0x5')]=function(_0x396321){for(var _0x4bfb16=0x0,_0x2b529=events[_0x57ee('0x6')];_0x4bfb16<_0x2b529;_0x4bfb16++){var _0x51f134=events[_0x4bfb16];var _0x4220ae=createListener(_0x57ee('0x7')+_0x51f134,_0x396321);UserEvents['on'](_0x51f134,_0x4220ae);}}; \ No newline at end of file +var _0xa180=['update','emit','removeListener','register','./user.events','save','remove'];(function(_0x4cb095,_0x58da07){var _0x2b565d=function(_0x4d41b3){while(--_0x4d41b3){_0x4cb095['push'](_0x4cb095['shift']());}};_0x2b565d(++_0x58da07);}(_0xa180,0x9e));var _0x0a18=function(_0x4a4f0c,_0x1e7579){_0x4a4f0c=_0x4a4f0c-0x0;var _0x599464=_0xa180[_0x4a4f0c];return _0x599464;};'use strict';var UserEvents=require(_0x0a18('0x0'));var events=[_0x0a18('0x1'),_0x0a18('0x2'),_0x0a18('0x3')];function createListener(_0x781ded,_0x57a194){return function(_0x445cb3){_0x57a194[_0x0a18('0x4')](_0x781ded,_0x445cb3);};}function removeListener(_0x58718e,_0x5172d1){return function(){UserEvents[_0x0a18('0x5')](_0x58718e,_0x5172d1);};}exports[_0x0a18('0x6')]=function(_0x33bd09){for(var _0x27a771=0x0,_0xb97fe=events['length'];_0x27a771<_0xb97fe;_0x27a771++){var _0x3e14f9=events[_0x27a771];var _0x5dcdd7=createListener('user:'+_0x3e14f9,_0x33bd09);UserEvents['on'](_0x3e14f9,_0x5dcdd7);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 9a76c04..2c59126 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1c1796,_0x899132){var _0x2ad556=function(_0x549e2b){while(--_0x549e2b){_0x1c1796['push'](_0x1c1796['shift']());}};_0x2ad556(++_0x899132);}(_0xe706,0xa3));var _0x6e70=function(_0x46eb0e,_0x296d16){_0x46eb0e=_0x46eb0e-0x0;var _0x523297=_0xe706[_0x46eb0e];return _0x523297;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5752af,_0x3a3bff){var _0x116ad4=function(_0x875f75){while(--_0x875f75){_0x5752af['push'](_0x5752af['shift']());}};_0x116ad4(++_0x3a3bff);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 8b8d3ff..444240b 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 _0xf6da=['INTEGER','sequelize','exports'];(function(_0x2c8128,_0x4aaacb){var _0x2a5304=function(_0xe714ae){while(--_0xe714ae){_0x2c8128['push'](_0x2c8128['shift']());}};_0x2a5304(++_0x4aaacb);}(_0xf6da,0x19f));var _0xaf6d=function(_0x29b53e,_0x2e7e4e){_0x29b53e=_0x29b53e-0x0;var _0xb6cb4c=_0xf6da[_0x29b53e];return _0xb6cb4c;};'use strict';var Sequelize=require(_0xaf6d('0x0'));module[_0xaf6d('0x1')]={'penalty':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfbab=['sequelize','exports','INTEGER'];(function(_0x5ed0c5,_0xc21d27){var _0x2b8b5f=function(_0x50b7f7){while(--_0x50b7f7){_0x5ed0c5['push'](_0x5ed0c5['shift']());}};_0x2b8b5f(++_0xc21d27);}(_0xfbab,0x1da));var _0xbfba=function(_0x10c9ee,_0x12d721){_0x10c9ee=_0x10c9ee-0x0;var _0x19acfa=_0xfbab[_0x10c9ee];return _0x19acfa;};'use strict';var Sequelize=require(_0xbfba('0x0'));module[_0xbfba('0x1')]={'penalty':{'type':Sequelize[_0xbfba('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 6e2d941..55654d2 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 _0x153e=['./userChatQueue.attributes','exports','user_has_chat_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x29ae80,_0x3579f1){var _0x5d6d71=function(_0xfaffe2){while(--_0xfaffe2){_0x29ae80['push'](_0x29ae80['shift']());}};_0x5d6d71(++_0x3579f1);}(_0x153e,0x18f));var _0xe153=function(_0x4de1b1,_0x18c64c){_0x4de1b1=_0x4de1b1-0x0;var _0x639f27=_0x153e[_0x4de1b1];return _0x639f27;};'use strict';var _=require('lodash');var util=require(_0xe153('0x0'));var logger=require(_0xe153('0x1'))(_0xe153('0x2'));var moment=require(_0xe153('0x3'));var BPromise=require(_0xe153('0x4'));var rp=require(_0xe153('0x5'));var fs=require('fs');var path=require(_0xe153('0x6'));var rimraf=require(_0xe153('0x7'));var config=require(_0xe153('0x8'));var attributes=require(_0xe153('0x9'));module[_0xe153('0xa')]=function(_0x56d6ed,_0x5c32cc){return _0x56d6ed['define']('UserChatQueue',attributes,{'tableName':_0xe153('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb928=['request-promise','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x3bceea,_0x58af75){var _0x30a8d3=function(_0x1550b5){while(--_0x1550b5){_0x3bceea['push'](_0x3bceea['shift']());}};_0x30a8d3(++_0x58af75);}(_0xb928,0xed));var _0x8b92=function(_0x4179e2,_0xf2dbb){_0x4179e2=_0x4179e2-0x0;var _0x24cb50=_0xb928[_0x4179e2];return _0x24cb50;};'use strict';var _=require('lodash');var util=require(_0x8b92('0x0'));var logger=require(_0x8b92('0x1'))(_0x8b92('0x2'));var moment=require(_0x8b92('0x3'));var BPromise=require(_0x8b92('0x4'));var rp=require(_0x8b92('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8b92('0x6'));var attributes=require(_0x8b92('0x7'));module[_0x8b92('0x8')]=function(_0x3ab8e2,_0x37f075){return _0x3ab8e2['define'](_0x8b92('0x9'),attributes,{'tableName':_0x8b92('0xa'),'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 5f96363..55bd4c0 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 _0xa27c=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x443a06,_0x5bafca){var _0xa1fb2b=function(_0x141ddd){while(--_0x141ddd){_0x443a06['push'](_0x443a06['shift']());}};_0xa1fb2b(++_0x5bafca);}(_0xa27c,0x18b));var _0xca27=function(_0x2ec5f0,_0x2e1fbb){_0x2ec5f0=_0x2ec5f0-0x0;var _0x1bc57c=_0xa27c[_0x2ec5f0];return _0x1bc57c;};'use strict';var _=require(_0xca27('0x0'));var util=require(_0xca27('0x1'));var moment=require(_0xca27('0x2'));var BPromise=require(_0xca27('0x3'));var rs=require(_0xca27('0x4'));var fs=require('fs');var Redis=require(_0xca27('0x5'));var db=require(_0xca27('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xca27('0x7'));var jayson=require(_0xca27('0x8'));var client=jayson[_0xca27('0x9')][_0xca27('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x532990,_0x99bf98,_0x54962d){return new BPromise(function(_0x56a65c,_0x4ae02b){return client[_0xca27('0xb')](_0x532990,_0x54962d)[_0xca27('0xc')](function(_0x494049){logger[_0xca27('0xd')](_0xca27('0xe'),_0x99bf98,'request\x20sent');logger[_0xca27('0xf')](_0xca27('0x10'),_0x99bf98,_0xca27('0x11'),JSON['stringify'](_0x494049));if(_0x494049[_0xca27('0x12')]){if(_0x494049[_0xca27('0x12')][_0xca27('0x13')]===0x1f4){logger['error'](_0xca27('0xe'),_0x99bf98,_0x494049[_0xca27('0x12')]['message']);return _0x4ae02b(_0x494049['error']['message']);}logger[_0xca27('0x12')](_0xca27('0xe'),_0x99bf98,_0x494049[_0xca27('0x12')][_0xca27('0x14')]);return _0x56a65c(_0x494049[_0xca27('0x12')]['message']);}else{logger['info'](_0xca27('0xe'),_0x99bf98,_0xca27('0x11'));_0x56a65c(_0x494049[_0xca27('0x15')][_0xca27('0x14')]);}})[_0xca27('0x16')](function(_0x25459f){logger[_0xca27('0x12')](_0xca27('0xe'),_0x99bf98,_0x25459f);_0x4ae02b(_0x25459f);});});} \ No newline at end of file +var _0x1d30=['rpc','client','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','util','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x5d2dc8,_0x4088bb){var _0x2e6a66=function(_0x1d1f0a){while(--_0x1d1f0a){_0x5d2dc8['push'](_0x5d2dc8['shift']());}};_0x2e6a66(++_0x4088bb);}(_0x1d30,0x94));var _0x01d3=function(_0x50b5c0,_0x56504a){_0x50b5c0=_0x50b5c0-0x0;var _0x49901d=_0x1d30[_0x50b5c0];return _0x49901d;};'use strict';var _=require('lodash');var util=require(_0x01d3('0x0'));var moment=require('moment');var BPromise=require(_0x01d3('0x1'));var rs=require(_0x01d3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x01d3('0x4'))(_0x01d3('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x01d3('0x6')][_0x01d3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5064dd,_0x430336,_0x42b223){return new BPromise(function(_0x5ca811,_0x15730d){return client[_0x01d3('0x8')](_0x5064dd,_0x42b223)['then'](function(_0x34a7bb){logger[_0x01d3('0x9')](_0x01d3('0xa'),_0x430336,_0x01d3('0xb'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x430336,_0x01d3('0xb'),JSON[_0x01d3('0xc')](_0x34a7bb));if(_0x34a7bb['error']){if(_0x34a7bb['error'][_0x01d3('0xd')]===0x1f4){logger[_0x01d3('0xe')](_0x01d3('0xa'),_0x430336,_0x34a7bb[_0x01d3('0xe')][_0x01d3('0xf')]);return _0x15730d(_0x34a7bb[_0x01d3('0xe')][_0x01d3('0xf')]);}logger[_0x01d3('0xe')](_0x01d3('0xa'),_0x430336,_0x34a7bb[_0x01d3('0xe')][_0x01d3('0xf')]);return _0x5ca811(_0x34a7bb[_0x01d3('0xe')][_0x01d3('0xf')]);}else{logger[_0x01d3('0x9')](_0x01d3('0xa'),_0x430336,_0x01d3('0xb'));_0x5ca811(_0x34a7bb[_0x01d3('0x10')][_0x01d3('0xf')]);}})['catch'](function(_0x4542cf){logger[_0x01d3('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x430336,_0x4542cf);_0x15730d(_0x4542cf);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 570afd9..6080b8c 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x218c0c,_0x35715e){var _0x318dc5=function(_0x383286){while(--_0x383286){_0x218c0c['push'](_0x218c0c['shift']());}};_0x318dc5(++_0x35715e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x734db2,_0xef662f){var _0x2338d1=function(_0x5e368b){while(--_0x5e368b){_0x734db2['push'](_0x734db2['shift']());}};_0x2338d1(++_0xef662f);}(_0xe706,0xa3));var _0x6e70=function(_0x490da9,_0x31214f){_0x490da9=_0x490da9-0x0;var _0x5b9821=_0xe706[_0x490da9];return _0x5b9821;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 32ccd2a..9c54560 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 _0xf9fe=['exports','INTEGER','STRING','sequelize'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0xf9fe,0x1bb));var _0xef9f=function(_0x106a41,_0x34e1af){_0x106a41=_0x106a41-0x0;var _0x178cac=_0xf9fe[_0x106a41];return _0x178cac;};'use strict';var Sequelize=require(_0xef9f('0x0'));module[_0xef9f('0x1')]={'penalty':{'type':Sequelize[_0xef9f('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xef9f('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xef9f('0x3')]}}; \ No newline at end of file +var _0x1df5=['STRING','sequelize','INTEGER'];(function(_0x3f479d,_0x1b4070){var _0x31a909=function(_0x1c151c){while(--_0x1c151c){_0x3f479d['push'](_0x3f479d['shift']());}};_0x31a909(++_0x1b4070);}(_0x1df5,0x82));var _0x51df=function(_0x7b6abb,_0x492131){_0x7b6abb=_0x7b6abb-0x0;var _0x58aace=_0x1df5[_0x7b6abb];return _0x58aace;};'use strict';var Sequelize=require(_0x51df('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x51df('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x51df('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x51df('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index b2601e7..54a0471 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 _0x9cd7=['path','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xb4316d,_0x556f84){var _0x12d602=function(_0x2480da){while(--_0x2480da){_0xb4316d['push'](_0xb4316d['shift']());}};_0x12d602(++_0x556f84);}(_0x9cd7,0xe4));var _0x79cd=function(_0xaad974,_0x396049){_0xaad974=_0xaad974-0x0;var _0x3801e9=_0x9cd7[_0xaad974];return _0x3801e9;};'use strict';var _=require(_0x79cd('0x0'));var util=require(_0x79cd('0x1'));var logger=require(_0x79cd('0x2'))(_0x79cd('0x3'));var moment=require(_0x79cd('0x4'));var BPromise=require(_0x79cd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79cd('0x6'));var rimraf=require(_0x79cd('0x7'));var config=require(_0x79cd('0x8'));var attributes=require(_0x79cd('0x9'));module['exports']=function(_0x410bfb,_0x403813){return _0x410bfb[_0x79cd('0xa')](_0x79cd('0xb'),attributes,{'tableName':_0x79cd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24a6=['path','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','moment','request-promise'];(function(_0xf43cb,_0x465374){var _0x14e869=function(_0x454719){while(--_0x454719){_0xf43cb['push'](_0xf43cb['shift']());}};_0x14e869(++_0x465374);}(_0x24a6,0x1b7));var _0x624a=function(_0x1ed302,_0x4ddc2a){_0x1ed302=_0x1ed302-0x0;var _0x3f79ae=_0x24a6[_0x1ed302];return _0x3f79ae;};'use strict';var _=require(_0x624a('0x0'));var util=require(_0x624a('0x1'));var logger=require(_0x624a('0x2'))('api');var moment=require(_0x624a('0x3'));var BPromise=require('bluebird');var rp=require(_0x624a('0x4'));var fs=require('fs');var path=require(_0x624a('0x5'));var rimraf=require('rimraf');var config=require(_0x624a('0x6'));var attributes=require(_0x624a('0x7'));module[_0x624a('0x8')]=function(_0x507f13,_0x46db9b){return _0x507f13[_0x624a('0x9')](_0x624a('0xa'),attributes,{'tableName':_0x624a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 08b313a..cc4d45b 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 _0xef40=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird'];(function(_0x3f96bb,_0x89cb44){var _0x2a210b=function(_0x1628c9){while(--_0x1628c9){_0x3f96bb['push'](_0x3f96bb['shift']());}};_0x2a210b(++_0x89cb44);}(_0xef40,0x172));var _0x0ef4=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xef40[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0ef4('0x0'));var util=require(_0x0ef4('0x1'));var moment=require(_0x0ef4('0x2'));var BPromise=require(_0x0ef4('0x3'));var rs=require(_0x0ef4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ef4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ef4('0x6'))(_0x0ef4('0x7'));var config=require(_0x0ef4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0ef4('0x9')][_0x0ef4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3db8f5,_0x5ce119,_0x3a239e){return new BPromise(function(_0x189db4,_0x2f517e){return client[_0x0ef4('0xb')](_0x3db8f5,_0x3a239e)[_0x0ef4('0xc')](function(_0x40232f){logger[_0x0ef4('0xd')](_0x0ef4('0xe'),_0x5ce119,_0x0ef4('0xf'));logger[_0x0ef4('0x10')](_0x0ef4('0x11'),_0x5ce119,'request\x20sent',JSON[_0x0ef4('0x12')](_0x40232f));if(_0x40232f[_0x0ef4('0x13')]){if(_0x40232f[_0x0ef4('0x13')]['code']===0x1f4){logger[_0x0ef4('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x5ce119,_0x40232f[_0x0ef4('0x13')][_0x0ef4('0x14')]);return _0x2f517e(_0x40232f['error'][_0x0ef4('0x14')]);}logger[_0x0ef4('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x5ce119,_0x40232f[_0x0ef4('0x13')][_0x0ef4('0x14')]);return _0x189db4(_0x40232f[_0x0ef4('0x13')][_0x0ef4('0x14')]);}else{logger[_0x0ef4('0xd')](_0x0ef4('0xe'),_0x5ce119,_0x0ef4('0xf'));_0x189db4(_0x40232f['result'][_0x0ef4('0x14')]);}})[_0x0ef4('0x15')](function(_0x4f23d3){logger[_0x0ef4('0x13')](_0x0ef4('0xe'),_0x5ce119,_0x4f23d3);_0x2f517e(_0x4f23d3);});});} \ No newline at end of file +var _0xaf92=['UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info'];(function(_0x47924e,_0x221fd8){var _0x31a59e=function(_0x250a9c){while(--_0x250a9c){_0x47924e['push'](_0x47924e['shift']());}};_0x31a59e(++_0x221fd8);}(_0xaf92,0xca));var _0x2af9=function(_0xd9dda1,_0x260e39){_0xd9dda1=_0xd9dda1-0x0;var _0x57b03b=_0xaf92[_0xd9dda1];return _0x57b03b;};'use strict';var _=require(_0x2af9('0x0'));var util=require(_0x2af9('0x1'));var moment=require('moment');var BPromise=require(_0x2af9('0x2'));var rs=require(_0x2af9('0x3'));var fs=require('fs');var Redis=require(_0x2af9('0x4'));var db=require(_0x2af9('0x5'))['db'];var utils=require(_0x2af9('0x6'));var logger=require(_0x2af9('0x7'))(_0x2af9('0x8'));var config=require(_0x2af9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2af9('0xa')][_0x2af9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x287af0,_0x2a9c30,_0x21d5ce){return new BPromise(function(_0x5ce83a,_0x5748bf){return client['request'](_0x287af0,_0x21d5ce)[_0x2af9('0xc')](function(_0x1b3782){logger[_0x2af9('0xd')](_0x2af9('0xe'),_0x2a9c30,_0x2af9('0xf'));logger[_0x2af9('0x10')](_0x2af9('0x11'),_0x2a9c30,_0x2af9('0xf'),JSON[_0x2af9('0x12')](_0x1b3782));if(_0x1b3782['error']){if(_0x1b3782[_0x2af9('0x13')][_0x2af9('0x14')]===0x1f4){logger[_0x2af9('0x13')](_0x2af9('0xe'),_0x2a9c30,_0x1b3782[_0x2af9('0x13')][_0x2af9('0x15')]);return _0x5748bf(_0x1b3782[_0x2af9('0x13')]['message']);}logger[_0x2af9('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x2a9c30,_0x1b3782[_0x2af9('0x13')][_0x2af9('0x15')]);return _0x5ce83a(_0x1b3782['error'][_0x2af9('0x15')]);}else{logger[_0x2af9('0xd')](_0x2af9('0xe'),_0x2a9c30,_0x2af9('0xf'));_0x5ce83a(_0x1b3782[_0x2af9('0x16')][_0x2af9('0x15')]);}})[_0x2af9('0x17')](function(_0x299756){logger[_0x2af9('0x13')](_0x2af9('0xe'),_0x2a9c30,_0x299756);_0x5748bf(_0x299756);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index dfdff6f..e4bbfad 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x299038,_0x1f36a0){var _0x54bb83=function(_0x4ce148){while(--_0x4ce148){_0x299038['push'](_0x299038['shift']());}};_0x54bb83(++_0x1f36a0);}(_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(_0x2453d0,_0x1b2017){var _0x521fc8=function(_0xfc824f){while(--_0xfc824f){_0x2453d0['push'](_0x2453d0['shift']());}};_0x521fc8(++_0x1b2017);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 4598fde..2f0af4c 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 _0x8a26=['sequelize','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8a26,0x1a8));var _0x68a2=function(_0x2cee0b,_0x438fbf){_0x2cee0b=_0x2cee0b-0x0;var _0x8f8eff=_0x8a26[_0x2cee0b];return _0x8f8eff;};'use strict';var Sequelize=require(_0x68a2('0x0'));module[_0x68a2('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5e2f=['INTEGER','sequelize'];(function(_0x1e364,_0x39a7a4){var _0x20e8e8=function(_0x42674f){while(--_0x42674f){_0x1e364['push'](_0x1e364['shift']());}};_0x20e8e8(++_0x39a7a4);}(_0x5e2f,0x14b));var _0xf5e2=function(_0xe329b0,_0x118a12){_0xe329b0=_0xe329b0-0x0;var _0x1eee73=_0x5e2f[_0xe329b0];return _0x1eee73;};'use strict';var Sequelize=require(_0xf5e2('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf5e2('0x1')],'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 a157fd7..2d6f82c 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 _0x0182=['request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue','util','api','moment'];(function(_0x59ea3c,_0x5f1a1f){var _0x5639c3=function(_0x3dce06){while(--_0x3dce06){_0x59ea3c['push'](_0x59ea3c['shift']());}};_0x5639c3(++_0x5f1a1f);}(_0x0182,0x180));var _0x2018=function(_0x516044,_0x3677f7){_0x516044=_0x516044-0x0;var _0x31684b=_0x0182[_0x516044];return _0x31684b;};'use strict';var _=require('lodash');var util=require(_0x2018('0x0'));var logger=require('../../config/logger')(_0x2018('0x1'));var moment=require(_0x2018('0x2'));var BPromise=require('bluebird');var rp=require(_0x2018('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2018('0x4'));var config=require(_0x2018('0x5'));var attributes=require(_0x2018('0x6'));module[_0x2018('0x7')]=function(_0x4a08fb,_0x17cf0c){return _0x4a08fb['define'](_0x2018('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a47=['user_has_mail_queues','lodash','util','api','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x356a99,_0x1a7cc2){var _0x341729=function(_0x18a026){while(--_0x18a026){_0x356a99['push'](_0x356a99['shift']());}};_0x341729(++_0x1a7cc2);}(_0x6a47,0x109));var _0x76a4=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x6a47[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x76a4('0x0'));var util=require(_0x76a4('0x1'));var logger=require('../../config/logger')(_0x76a4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x76a4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76a4('0x4'));var config=require(_0x76a4('0x5'));var attributes=require(_0x76a4('0x6'));module[_0x76a4('0x7')]=function(_0x38a3ed,_0x51f083){return _0x38a3ed[_0x76a4('0x8')](_0x76a4('0x9'),attributes,{'tableName':_0x76a4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 727805e..9b64ac7 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 _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2f9f43,_0x3474aa){var _0x3ee375=function(_0x5af133){while(--_0x5af133){_0x2f9f43['push'](_0x2f9f43['shift']());}};_0x3ee375(++_0x3474aa);}(_0xa41a,0x6b));var _0xaa41=function(_0x5b156d,_0x576cf6){_0x5b156d=_0x5b156d-0x0;var _0x3531ec=_0xa41a[_0x5b156d];return _0x3531ec;};'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);});});} \ No newline at end of file +var _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x315cf7,_0x14e58d){var _0x32c24a=function(_0x3b132b){while(--_0x3b132b){_0x315cf7['push'](_0x315cf7['shift']());}};_0x32c24a(++_0x14e58d);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3f477c,_0x52b7ff){_0x3f477c=_0x3f477c-0x0;var _0x4c36b3=_0x7fbe[_0x3f477c];return _0x4c36b3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 509e6ca..3719e9f 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 _0xfe46=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification'];(function(_0x3b120a,_0x599584){var _0x3b612a=function(_0x1b0739){while(--_0x1b0739){_0x3b120a['push'](_0x3b120a['shift']());}};_0x3b612a(++_0x599584);}(_0xfe46,0x150));var _0x6fe4=function(_0x3ac9d3,_0xe137a5){_0x3ac9d3=_0x3ac9d3-0x0;var _0x223db3=_0xfe46[_0x3ac9d3];return _0x223db3;};'use strict';var multer=require(_0x6fe4('0x0'));var util=require('util');var path=require(_0x6fe4('0x1'));var timeout=require(_0x6fe4('0x2'));var express=require(_0x6fe4('0x3'));var router=express[_0x6fe4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6fe4('0x5'));var interaction=require(_0x6fe4('0x6'));var config=require(_0x6fe4('0x7'));var controller=require(_0x6fe4('0x8'));router[_0x6fe4('0x9')]('/',auth[_0x6fe4('0xa')](),controller[_0x6fe4('0xb')]);module['exports']=router; \ No newline at end of file +var _0x4b52=['../../config/environment','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2e394c,_0x1ee18d){var _0x585aa6=function(_0x4d2a30){while(--_0x4d2a30){_0x2e394c['push'](_0x2e394c['shift']());}};_0x585aa6(++_0x1ee18d);}(_0x4b52,0x116));var _0x24b5=function(_0x3efa42,_0x4a1c50){_0x3efa42=_0x3efa42-0x0;var _0x3f6781=_0x4b52[_0x3efa42];return _0x3f6781;};'use strict';var multer=require(_0x24b5('0x0'));var util=require(_0x24b5('0x1'));var path=require(_0x24b5('0x2'));var timeout=require(_0x24b5('0x3'));var express=require(_0x24b5('0x4'));var router=express['Router']();var fs_extra=require(_0x24b5('0x5'));var auth=require(_0x24b5('0x6'));var interaction=require(_0x24b5('0x7'));var config=require(_0x24b5('0x8'));var controller=require('./userNotification.controller');router[_0x24b5('0x9')]('/',auth[_0x24b5('0xa')](),controller[_0x24b5('0xb')]);module[_0x24b5('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 39448de..1ff14f2 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 _0xd393=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd393,0x1a3));var _0x3d39=function(_0xbc38b8,_0x26ba7f){_0xbc38b8=_0xbc38b8-0x0;var _0x4931b3=_0xd393[_0xbc38b8];return _0x4931b3;};'use strict';var Sequelize=require(_0x3d39('0x0'));module[_0x3d39('0x1')]={'body':{'type':Sequelize[_0x3d39('0x2')]},'senderName':{'type':Sequelize[_0x3d39('0x3')]},'recipientsId':{'type':Sequelize[_0x3d39('0x2')]},'recipientsDescription':{'type':Sequelize[_0x3d39('0x3')]},'beep':{'type':Sequelize[_0x3d39('0x4')]}}; \ No newline at end of file +var _0x5613=['sequelize','exports','STRING','TEXT','BOOLEAN'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0x5613,0x1d6));var _0x3561=function(_0x429693,_0x51ab45){_0x429693=_0x429693-0x0;var _0x1b934d=_0x5613[_0x429693];return _0x1b934d;};'use strict';var Sequelize=require(_0x3561('0x0'));module[_0x3561('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x3561('0x2')]},'recipientsId':{'type':Sequelize[_0x3561('0x3')]},'recipientsDescription':{'type':Sequelize[_0x3561('0x2')]},'beep':{'type':Sequelize[_0x3561('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 73123c0..046e8b6 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 _0x944c=['fs-extra','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','Sequelize','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','voicequeue','team','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','isEmpty','beep','recipientsId','sortBy','join','sequelize','create','recipientsDescription','forEach','recipient','emit','catch','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','User','union','ids','queue','replace','Queue','all','flatten','getAgents','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x944c,0xb0));var _0xc944=function(_0x4bafa2,_0x43ee66){_0x4bafa2=_0x4bafa2-0x0;var _0x581606=_0x944c[_0x4bafa2];return _0x581606;};'use strict';var emlformat=require(_0xc944('0x0'));var rimraf=require(_0xc944('0x1'));var zipdir=require(_0xc944('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc944('0x3'));var Mustache=require(_0xc944('0x4'));var util=require(_0xc944('0x5'));var path=require(_0xc944('0x6'));var sox=require(_0xc944('0x7'));var csv=require(_0xc944('0x8'));var ejs=require(_0xc944('0x9'));var fs=require('fs');var fs_extra=require(_0xc944('0xa'));var _=require('lodash');var squel=require(_0xc944('0xb'));var crypto=require('crypto');var jsforce=require(_0xc944('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc944('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc944('0xd'));var authService=require(_0xc944('0xe'));var qs=require(_0xc944('0xf'));var as=require(_0xc944('0x10'));var hardwareService=require(_0xc944('0x11'));var logger=require('../../config/logger')(_0xc944('0x12'));var utils=require(_0xc944('0x13'));var config=require(_0xc944('0x14'));var licenseUtil=require(_0xc944('0x15'));var db=require(_0xc944('0x16'))['db'];config[_0xc944('0x17')]=_[_0xc944('0x18')](config[_0xc944('0x17')],{'host':_0xc944('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc944('0x1a'))['register'](socket);function respondWithStatusCode(_0x37a8b2,_0x58d940){_0x58d940=_0x58d940||0xcc;return function(_0x5c0225){if(_0x5c0225){return _0x37a8b2[_0xc944('0x1b')](_0x58d940);}return _0x37a8b2[_0xc944('0x1c')](_0x58d940)['end']();};}function respondWithResult(_0x311d1c,_0x57a25f){_0x57a25f=_0x57a25f||0xc8;return function(_0x1898e0){if(_0x1898e0){return _0x311d1c[_0xc944('0x1c')](_0x57a25f)[_0xc944('0x1d')](_0x1898e0);}};}function respondWithFilteredResult(_0x10300c,_0x578617){return function(_0x204635){if(_0x204635){var _0x128d07=typeof _0x578617['offset']==='undefined'&&typeof _0x578617[_0xc944('0x1e')]===_0xc944('0x1f');var _0x1066dc=_0x204635[_0xc944('0x20')];var _0x5ebfef=_0x128d07?0x0:_0x578617[_0xc944('0x21')];var _0x44dc47=_0x128d07?_0x204635[_0xc944('0x20')]:_0x578617[_0xc944('0x21')]+_0x578617[_0xc944('0x1e')];var _0x15d80e;if(_0x44dc47>=_0x1066dc){_0x44dc47=_0x1066dc;_0x15d80e=0xc8;}else{_0x15d80e=0xce;}_0x10300c['status'](_0x15d80e);return _0x10300c[_0xc944('0x22')](_0xc944('0x23'),_0x5ebfef+'-'+_0x44dc47+'/'+_0x1066dc)[_0xc944('0x1d')](_0x204635);}return null;};}function patchUpdates(_0x571311){return function(_0x4307c1){try{jsonpatch[_0xc944('0x24')](_0x4307c1,_0x571311,!![]);}catch(_0x4a72ff){return BPromise[_0xc944('0x25')](_0x4a72ff);}return _0x4307c1[_0xc944('0x26')]();};}function saveUpdates(_0x3d1649,_0x182b6e){return function(_0x268921){if(_0x268921){return _0x268921[_0xc944('0x27')](_0x3d1649)[_0xc944('0x28')](function(_0x5ab11f){return _0x5ab11f;});}return null;};}function removeEntity(_0x413647,_0x43acf5){return function(_0x314bbc){if(_0x314bbc){return _0x314bbc['destroy']()[_0xc944('0x28')](function(){_0x413647['status'](0xcc)[_0xc944('0x29')]();});}};}function handleEntityNotFound(_0x13acf4,_0x4df0f1){return function(_0xa162e3){if(!_0xa162e3){_0x13acf4[_0xc944('0x1b')](0x194);}return _0xa162e3;};}function handleError(_0x322f6e,_0x47083a){_0x47083a=_0x47083a||0x1f4;return function(_0x13b2ad){logger[_0xc944('0x2a')](_0x13b2ad[_0xc944('0x2b')]);if(_0x13b2ad[_0xc944('0x2c')]){delete _0x13b2ad[_0xc944('0x2c')];}_0x322f6e['status'](_0x47083a)[_0xc944('0x2d')](_0x13b2ad);};}exports[_0xc944('0x2e')]=function(_0x2a61a9,_0x212e1f,_0x3dc92d){if(!_0x2a61a9[_0xc944('0x2f')][_0xc944('0x30')](_0xc944('0x31'))&&!_0x2a61a9['body'][_0xc944('0x30')]('TemplateId')){throw new db[(_0xc944('0x32'))]['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x2a61a9['body'][_0xc944('0x30')](_0xc944('0x33'))&&!_0x2a61a9[_0xc944('0x2f')][_0xc944('0x30')](_0xc944('0x34'))){throw new db[(_0xc944('0x32'))]['ValidationError'](_0xc944('0x35'));}if(!_0x2a61a9[_0xc944('0x2f')]['hasOwnProperty'](_0xc944('0x36'))){throw new db[(_0xc944('0x32'))][(_0xc944('0x37'))](_0xc944('0x38'));}else{try{var _0xbfbc11=JSON[_0xc944('0x39')](_0x2a61a9['body'][_0xc944('0x36')]);}catch(_0x1ef094){logger[_0xc944('0x2a')](_0x1ef094);throw new db[(_0xc944('0x32'))][(_0xc944('0x37'))](_0xc944('0x3a'));}var _0x15524b=[_0xc944('0x3b'),'faxqueue',_0xc944('0x3c'),'openchannelqueue','smsqueue',_0xc944('0x3d'),'whatsappqueue',_0xc944('0x3e'),'user'];if(_['some'](_0xbfbc11,function(_0x4bec02){return!_[_0xc944('0x3f')](_0x15524b,_0x4bec02[_0xc944('0x40')][_0xc944('0x41')]());})){throw new db[(_0xc944('0x32'))][(_0xc944('0x37'))](_0xc944('0x42'));}}}var _0x409d19={};_0x409d19[_0xc944('0x43')]=_0x2a61a9[_0xc944('0x2f')][_0xc944('0x30')](_0xc944('0x43'))?_0x2a61a9[_0xc944('0x2f')][_0xc944('0x43')]:_0x2a61a9[_0xc944('0x44')][_0xc944('0x45')];_0x409d19['recipientsDescription']=_[_0xc944('0x46')](_0x2a61a9[_0xc944('0x2f')]['recipientsDescription'])?null:_0x2a61a9['body']['recipientsDescription'];_0x409d19['beep']=_0x2a61a9[_0xc944('0x2f')][_0xc944('0x47')]||![];_0x409d19['SenderId']=_0x2a61a9[_0xc944('0x44')]['id'];return getContent(_0x2a61a9[_0xc944('0x2f')])['then'](function(_0x453915){_0x409d19[_0xc944('0x2f')]=_0x453915;return getRecipients(_0xbfbc11);})[_0xc944('0x28')](function(_0x480ff1){_0x409d19[_0xc944('0x48')]=_[_0xc944('0x49')](_0x480ff1)[_0xc944('0x4a')](',');return db[_0xc944('0x4b')]['transaction'](function(_0xba40bb){return db['UserNotification'][_0xc944('0x4c')](_0x409d19,{'raw':!![],'transaction':_0xba40bb})['then'](function(_0x2a8310){var _0x5f3483={'sender':_0x409d19['senderName'],'description':_0x409d19[_0xc944('0x4d')],'content':_0x409d19[_0xc944('0x2f')],'beep':_0x409d19[_0xc944('0x47')]};_0x480ff1[_0xc944('0x4e')](function(_0x5b9631){_0x5f3483[_0xc944('0x4f')]=_0x5b9631;socket[_0xc944('0x50')]('userNotification:send',_0x5f3483);});return _0x2a8310;});});})['then'](respondWithResult(_0x212e1f,0xc9))[_0xc944('0x51')](handleError(_0x212e1f,null));};function getContent(_0x245000){return new BPromise(function(_0x3492c3,_0x391b7d){if(_0x245000['text']){_0x3492c3(_0x245000[_0xc944('0x31')]);return;}return db['Template'][_0xc944('0x52')]({'attributes':['html'],'where':{'id':_0x245000[_0xc944('0x33')]},'raw':!![]})[_0xc944('0x28')](function(_0xc46e47){if(!_0xc46e47)throw new db[(_0xc944('0x32'))][(_0xc944('0x37'))](_0xc944('0x53'));var _0xda3a20=Mustache['render'](_0xc46e47['html'],_0x245000['view']);_0x3492c3(_0xda3a20);})['catch'](function(_0x1c6b7c){_0x391b7d(_0x1c6b7c);});});}function getRecipients(_0x501fe0){return new BPromise(function(_0x4e6d8e,_0x2b9b58){var _0x46e47a=[];var _0x159ab4=[];_0x501fe0[_0xc944('0x4e')](function(_0x1aeb5a){var _0x108baf=_['startCase'](_0x1aeb5a['model'][_0xc944('0x41')]());if(_0x108baf===_0xc944('0x54')){_0x46e47a=_[_0xc944('0x55')](_0x46e47a,_0x1aeb5a[_0xc944('0x56')]);}else{if(_['includes'](_0x108baf,_0xc944('0x57')))_0x108baf=_0x108baf[_0xc944('0x58')](_0xc944('0x57'),_0xc944('0x59'));_0x1aeb5a[_0xc944('0x56')]['forEach'](function(_0x27d74f){_0x159ab4['push'](getAgents(_0x108baf,_0x27d74f));});}});return BPromise[_0xc944('0x5a')](_0x159ab4)[_0xc944('0x28')](function(_0x445aec){_0x46e47a=_[_0xc944('0x55')](_0x46e47a,_[_0xc944('0x5b')](_0x445aec));_0x4e6d8e(_0x46e47a);})[_0xc944('0x51')](function(_0x30341c){_0x2b9b58(_0x30341c);});});}function getAgents(_0x220420,_0x52eee7){return new BPromise(function(_0x25e4d4,_0x535aca){return db[_0x220420]['findOne']({'where':{'id':_0x52eee7}})[_0xc944('0x28')](function(_0xda042b){return _0xda042b[_0xc944('0x5c')]({'attributes':['id'],'raw':!![]})[_0xc944('0x28')](function(_0x40bb95){var _0x520bbc=_['map'](_0x40bb95,'id');_0x25e4d4(_0x520bbc);});})['catch'](function(_0x114179){_0x535aca(_0x114179);});});} \ No newline at end of file +var _0x7284=['catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','model','User','union','ids','queue','Queue','forEach','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','destroy','error','stack','name','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','then','join','sequelize','UserNotification','create','recipient'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x7284,0xcf));var _0x4728=function(_0x48dccb,_0x2f1135){_0x48dccb=_0x48dccb-0x0;var _0x4982e4=_0x7284[_0x48dccb];return _0x4982e4;};'use strict';var emlformat=require(_0x4728('0x0'));var rimraf=require(_0x4728('0x1'));var zipdir=require(_0x4728('0x2'));var jsonpatch=require(_0x4728('0x3'));var rp=require(_0x4728('0x4'));var moment=require(_0x4728('0x5'));var BPromise=require(_0x4728('0x6'));var Mustache=require('mustache');var util=require(_0x4728('0x7'));var path=require(_0x4728('0x8'));var sox=require(_0x4728('0x9'));var csv=require(_0x4728('0xa'));var ejs=require(_0x4728('0xb'));var fs=require('fs');var fs_extra=require(_0x4728('0xc'));var _=require(_0x4728('0xd'));var squel=require(_0x4728('0xe'));var crypto=require(_0x4728('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x4728('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4728('0x11'));var Redis=require('ioredis');var authService=require(_0x4728('0x12'));var qs=require(_0x4728('0x13'));var as=require(_0x4728('0x14'));var hardwareService=require(_0x4728('0x15'));var logger=require('../../config/logger')(_0x4728('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4728('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x4728('0x18'),'port':0x18eb});var socket=require(_0x4728('0x19'))(new Redis(config[_0x4728('0x1a')]));require('./userNotification.socket')[_0x4728('0x1b')](socket);function respondWithStatusCode(_0x3aef09,_0x4f26e0){_0x4f26e0=_0x4f26e0||0xcc;return function(_0x58eb7e){if(_0x58eb7e){return _0x3aef09[_0x4728('0x1c')](_0x4f26e0);}return _0x3aef09[_0x4728('0x1d')](_0x4f26e0)[_0x4728('0x1e')]();};}function respondWithResult(_0x50a4a3,_0x211f57){_0x211f57=_0x211f57||0xc8;return function(_0x3f8c6e){if(_0x3f8c6e){return _0x50a4a3[_0x4728('0x1d')](_0x211f57)[_0x4728('0x1f')](_0x3f8c6e);}};}function respondWithFilteredResult(_0x49f453,_0x4d44a2){return function(_0x4cba00){if(_0x4cba00){var _0x30139b=typeof _0x4d44a2['offset']===_0x4728('0x20')&&typeof _0x4d44a2[_0x4728('0x21')]==='undefined';var _0x4164ea=_0x4cba00[_0x4728('0x22')];var _0x35449d=_0x30139b?0x0:_0x4d44a2[_0x4728('0x23')];var _0x18d232=_0x30139b?_0x4cba00[_0x4728('0x22')]:_0x4d44a2[_0x4728('0x23')]+_0x4d44a2[_0x4728('0x21')];var _0x72650c;if(_0x18d232>=_0x4164ea){_0x18d232=_0x4164ea;_0x72650c=0xc8;}else{_0x72650c=0xce;}_0x49f453['status'](_0x72650c);return _0x49f453['set'](_0x4728('0x24'),_0x35449d+'-'+_0x18d232+'/'+_0x4164ea)[_0x4728('0x1f')](_0x4cba00);}return null;};}function patchUpdates(_0x4d5f5c){return function(_0xafaae3){try{jsonpatch[_0x4728('0x25')](_0xafaae3,_0x4d5f5c,!![]);}catch(_0x41be89){return BPromise['reject'](_0x41be89);}return _0xafaae3[_0x4728('0x26')]();};}function saveUpdates(_0x153941,_0x3a4320){return function(_0x568e79){if(_0x568e79){return _0x568e79['update'](_0x153941)['then'](function(_0x1af532){return _0x1af532;});}return null;};}function removeEntity(_0x44ff5c,_0x34f55b){return function(_0x443043){if(_0x443043){return _0x443043[_0x4728('0x27')]()['then'](function(){_0x44ff5c[_0x4728('0x1d')](0xcc)[_0x4728('0x1e')]();});}};}function handleEntityNotFound(_0x299d2a,_0x5bc1d9){return function(_0x8488e5){if(!_0x8488e5){_0x299d2a[_0x4728('0x1c')](0x194);}return _0x8488e5;};}function handleError(_0x53b4e0,_0x1578d3){_0x1578d3=_0x1578d3||0x1f4;return function(_0x44e9f7){logger[_0x4728('0x28')](_0x44e9f7[_0x4728('0x29')]);if(_0x44e9f7[_0x4728('0x2a')]){delete _0x44e9f7[_0x4728('0x2a')];}_0x53b4e0[_0x4728('0x1d')](_0x1578d3)['send'](_0x44e9f7);};}exports[_0x4728('0x2b')]=function(_0x173a14,_0x5a9342,_0x840d03){if(!_0x173a14['body'][_0x4728('0x2c')](_0x4728('0x2d'))&&!_0x173a14[_0x4728('0x2e')][_0x4728('0x2c')](_0x4728('0x2f'))){throw new db[(_0x4728('0x30'))]['ValidationError'](_0x4728('0x31'));}else{if(_0x173a14['body'][_0x4728('0x2c')](_0x4728('0x2f'))&&!_0x173a14[_0x4728('0x2e')][_0x4728('0x2c')](_0x4728('0x32'))){throw new db[(_0x4728('0x30'))][(_0x4728('0x33'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x173a14[_0x4728('0x2e')][_0x4728('0x2c')](_0x4728('0x34'))){throw new db[(_0x4728('0x30'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x5be884=JSON[_0x4728('0x35')](_0x173a14[_0x4728('0x2e')]['recipients']);}catch(_0x1d2201){logger[_0x4728('0x28')](_0x1d2201);throw new db[(_0x4728('0x30'))]['ValidationError'](_0x4728('0x36'));}var _0x52505a=[_0x4728('0x37'),'faxqueue','mailqueue',_0x4728('0x38'),_0x4728('0x39'),_0x4728('0x3a'),_0x4728('0x3b'),_0x4728('0x3c'),_0x4728('0x3d')];if(_[_0x4728('0x3e')](_0x5be884,function(_0x1b56a0){return!_[_0x4728('0x3f')](_0x52505a,_0x1b56a0['model'][_0x4728('0x40')]());})){throw new db[(_0x4728('0x30'))][(_0x4728('0x33'))](_0x4728('0x41'));}}}var _0x34d880={};_0x34d880['senderName']=_0x173a14[_0x4728('0x2e')]['hasOwnProperty'](_0x4728('0x42'))?_0x173a14[_0x4728('0x2e')][_0x4728('0x42')]:_0x173a14['user'][_0x4728('0x43')];_0x34d880[_0x4728('0x44')]=_[_0x4728('0x45')](_0x173a14[_0x4728('0x2e')][_0x4728('0x44')])?null:_0x173a14[_0x4728('0x2e')][_0x4728('0x44')];_0x34d880[_0x4728('0x46')]=_0x173a14[_0x4728('0x2e')][_0x4728('0x46')]||![];_0x34d880[_0x4728('0x47')]=_0x173a14['user']['id'];return getContent(_0x173a14[_0x4728('0x2e')])[_0x4728('0x48')](function(_0x53c542){_0x34d880['body']=_0x53c542;return getRecipients(_0x5be884);})['then'](function(_0x3af007){_0x34d880['recipientsId']=_['sortBy'](_0x3af007)[_0x4728('0x49')](',');return db[_0x4728('0x4a')]['transaction'](function(_0x33d37f){return db[_0x4728('0x4b')][_0x4728('0x4c')](_0x34d880,{'raw':!![],'transaction':_0x33d37f})['then'](function(_0x2cb51f){var _0x111a7f={'sender':_0x34d880[_0x4728('0x42')],'description':_0x34d880[_0x4728('0x44')],'content':_0x34d880[_0x4728('0x2e')],'beep':_0x34d880[_0x4728('0x46')]};_0x3af007['forEach'](function(_0x4eaa73){_0x111a7f[_0x4728('0x4d')]=_0x4eaa73;socket['emit']('userNotification:send',_0x111a7f);});return _0x2cb51f;});});})[_0x4728('0x48')](respondWithResult(_0x5a9342,0xc9))[_0x4728('0x4e')](handleError(_0x5a9342,null));};function getContent(_0x2fa8e1){return new BPromise(function(_0x46c6e1,_0x1d3d3c){if(_0x2fa8e1[_0x4728('0x2d')]){_0x46c6e1(_0x2fa8e1[_0x4728('0x2d')]);return;}return db[_0x4728('0x4f')][_0x4728('0x50')]({'attributes':[_0x4728('0x51')],'where':{'id':_0x2fa8e1['TemplateId']},'raw':!![]})['then'](function(_0xf4cbdd){if(!_0xf4cbdd)throw new db['Sequelize']['ValidationError'](_0x4728('0x52'));var _0xae3ee=Mustache['render'](_0xf4cbdd[_0x4728('0x51')],_0x2fa8e1[_0x4728('0x32')]);_0x46c6e1(_0xae3ee);})[_0x4728('0x4e')](function(_0x1015d6){_0x1d3d3c(_0x1015d6);});});}function getRecipients(_0x255149){return new BPromise(function(_0x1afeb4,_0x41f376){var _0x1f0b3f=[];var _0x5518de=[];_0x255149['forEach'](function(_0xdc7810){var _0x4dd555=_[_0x4728('0x53')](_0xdc7810[_0x4728('0x54')][_0x4728('0x40')]());if(_0x4dd555===_0x4728('0x55')){_0x1f0b3f=_[_0x4728('0x56')](_0x1f0b3f,_0xdc7810[_0x4728('0x57')]);}else{if(_[_0x4728('0x3f')](_0x4dd555,_0x4728('0x58')))_0x4dd555=_0x4dd555['replace'](_0x4728('0x58'),_0x4728('0x59'));_0xdc7810['ids'][_0x4728('0x5a')](function(_0x1cbcfc){_0x5518de['push'](getAgents(_0x4dd555,_0x1cbcfc));});}});return BPromise[_0x4728('0x5b')](_0x5518de)[_0x4728('0x48')](function(_0x1aa112){_0x1f0b3f=_[_0x4728('0x56')](_0x1f0b3f,_[_0x4728('0x5c')](_0x1aa112));_0x1afeb4(_0x1f0b3f);})['catch'](function(_0x38bc24){_0x41f376(_0x38bc24);});});}function getAgents(_0x1bf84c,_0x3075de){return new BPromise(function(_0x3e99a1,_0x416527){return db[_0x1bf84c][_0x4728('0x50')]({'where':{'id':_0x3075de}})[_0x4728('0x48')](function(_0x40c657){return _0x40c657[_0x4728('0x5d')]({'attributes':['id'],'raw':!![]})[_0x4728('0x48')](function(_0x5782ef){var _0x2598d2=_[_0x4728('0x5e')](_0x5782ef,'id');_0x3e99a1(_0x2598d2);});})[_0x4728('0x4e')](function(_0x2a067d){_0x416527(_0x2a067d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 47679c5..b592445 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 _0x129b=['exports','events','../../mysqldb','UserNotification','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x11bdbb,_0x163195){var _0x17b0a7=function(_0x57b5ec){while(--_0x57b5ec){_0x11bdbb['push'](_0x11bdbb['shift']());}};_0x17b0a7(++_0x163195);}(_0x129b,0x1e7));var _0xb129=function(_0x47f07d,_0x195757){_0x47f07d=_0x47f07d-0x0;var _0x3fbb32=_0x129b[_0x47f07d];return _0x3fbb32;};'use strict';var EventEmitter=require(_0xb129('0x0'));var UserNotification=require(_0xb129('0x1'))['db'][_0xb129('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb129('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb129('0x4')};function emitEvent(_0xb3c1fa){return function(_0x11ee6b,_0x4a8174,_0x17cfa6){UserNotificationEvents['emit'](_0xb3c1fa+':'+_0x11ee6b['id'],_0x11ee6b);UserNotificationEvents[_0xb129('0x5')](_0xb3c1fa,_0x11ee6b);_0x17cfa6(null);};}for(var e in events){if(events[_0xb129('0x6')](e)){var event=events[e];UserNotification[_0xb129('0x7')](e,emitEvent(event));}}module[_0xb129('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x9471=['remove','emit','hasOwnProperty','hook','../../mysqldb','UserNotification','setMaxListeners','save','update'];(function(_0x2fd160,_0x53c0d6){var _0x5c2031=function(_0x8ecfa5){while(--_0x8ecfa5){_0x2fd160['push'](_0x2fd160['shift']());}};_0x5c2031(++_0x53c0d6);}(_0x9471,0x13f));var _0x1947=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9471[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x1947('0x0'))['db'][_0x1947('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x1947('0x2')](0x0);var events={'afterCreate':_0x1947('0x3'),'afterUpdate':_0x1947('0x4'),'afterDestroy':_0x1947('0x5')};function emitEvent(_0x285452){return function(_0x409623,_0x3d6b03,_0x520959){UserNotificationEvents[_0x1947('0x6')](_0x285452+':'+_0x409623['id'],_0x409623);UserNotificationEvents[_0x1947('0x6')](_0x285452,_0x409623);_0x520959(null);};}for(var e in events){if(events[_0x1947('0x7')](e)){var event=events[e];UserNotification[_0x1947('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index f228a87..0cbb503 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 _0x9d5c=['UserNotification','userNotifications','utf8mb4','lodash','util','moment','bluebird','rimraf','./userNotification.attributes','define'];(function(_0x5141b8,_0x45d57e){var _0x4b38a4=function(_0x447f7e){while(--_0x447f7e){_0x5141b8['push'](_0x5141b8['shift']());}};_0x4b38a4(++_0x45d57e);}(_0x9d5c,0x67));var _0xc9d5=function(_0x44618d,_0x1eebce){_0x44618d=_0x44618d-0x0;var _0x1b1873=_0x9d5c[_0x44618d];return _0x1b1873;};'use strict';var _=require(_0xc9d5('0x0'));var util=require(_0xc9d5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc9d5('0x2'));var BPromise=require(_0xc9d5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc9d5('0x4'));var config=require('../../config/environment');var attributes=require(_0xc9d5('0x5'));module['exports']=function(_0x17e5c6,_0x210932){return _0x17e5c6[_0xc9d5('0x6')](_0xc9d5('0x7'),attributes,{'tableName':_0xc9d5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc9d5('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x31b9=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x31b9,0xb4));var _0x931b=function(_0x5cf9d2,_0x2121da){_0x5cf9d2=_0x5cf9d2-0x0;var _0x52304a=_0x31b9[_0x5cf9d2];return _0x52304a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x931b('0x0'))(_0x931b('0x1'));var moment=require(_0x931b('0x2'));var BPromise=require(_0x931b('0x3'));var rp=require(_0x931b('0x4'));var fs=require('fs');var path=require(_0x931b('0x5'));var rimraf=require('rimraf');var config=require(_0x931b('0x6'));var attributes=require(_0x931b('0x7'));module['exports']=function(_0x29f022,_0x1112bb){return _0x29f022[_0x931b('0x8')](_0x931b('0x9'),attributes,{'tableName':_0x931b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x931b('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 3427f53..bb50147 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 _0x0649=['then','info','UserNotification,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0649,0x127));var _0x9064=function(_0x2de6b2,_0x466c15){_0x2de6b2=_0x2de6b2-0x0;var _0xc6e18a=_0x0649[_0x2de6b2];return _0xc6e18a;};'use strict';var _=require('lodash');var util=require(_0x9064('0x0'));var moment=require(_0x9064('0x1'));var BPromise=require(_0x9064('0x2'));var rs=require(_0x9064('0x3'));var fs=require('fs');var Redis=require(_0x9064('0x4'));var db=require(_0x9064('0x5'))['db'];var utils=require(_0x9064('0x6'));var logger=require(_0x9064('0x7'))(_0x9064('0x8'));var config=require(_0x9064('0x9'));var jayson=require(_0x9064('0xa'));var client=jayson[_0x9064('0xb')]['http']({'port':0x232a});config[_0x9064('0xc')]=_['defaults'](config[_0x9064('0xc')],{'host':_0x9064('0xd'),'port':0x18eb});var socket=require(_0x9064('0xe'))(new Redis(config[_0x9064('0xc')]));require('./userNotification.socket')[_0x9064('0xf')](socket);function respondWithRpcPromise(_0x1d9bac,_0x4d482f,_0x590219){return new BPromise(function(_0x12067d,_0x31e256){return client[_0x9064('0x10')](_0x1d9bac,_0x590219)[_0x9064('0x11')](function(_0x297827){logger[_0x9064('0x12')](_0x9064('0x13'),_0x4d482f,'request\x20sent');logger[_0x9064('0x14')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x4d482f,_0x9064('0x15'),JSON['stringify'](_0x297827));if(_0x297827['error']){if(_0x297827[_0x9064('0x16')][_0x9064('0x17')]===0x1f4){logger[_0x9064('0x16')](_0x9064('0x13'),_0x4d482f,_0x297827[_0x9064('0x16')][_0x9064('0x18')]);return _0x31e256(_0x297827[_0x9064('0x16')]['message']);}logger[_0x9064('0x16')](_0x9064('0x13'),_0x4d482f,_0x297827[_0x9064('0x16')]['message']);return _0x12067d(_0x297827[_0x9064('0x16')][_0x9064('0x18')]);}else{logger['info'](_0x9064('0x13'),_0x4d482f,'request\x20sent');_0x12067d(_0x297827['result'][_0x9064('0x18')]);}})[_0x9064('0x19')](function(_0x3836df){logger['error'](_0x9064('0x13'),_0x4d482f,_0x3836df);_0x31e256(_0x3836df);});});} \ No newline at end of file +var _0x7c97=['redis','defaults','localhost','socket.io-emitter','then','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','info','request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4d0173,_0x45f892){var _0x12a75b=function(_0x101413){while(--_0x101413){_0x4d0173['push'](_0x4d0173['shift']());}};_0x12a75b(++_0x45f892);}(_0x7c97,0x138));var _0x77c9=function(_0x2f1b5a,_0x2c19f0){_0x2f1b5a=_0x2f1b5a-0x0;var _0x3da9cd=_0x7c97[_0x2f1b5a];return _0x3da9cd;};'use strict';var _=require(_0x77c9('0x0'));var util=require(_0x77c9('0x1'));var moment=require(_0x77c9('0x2'));var BPromise=require(_0x77c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77c9('0x4'));var db=require(_0x77c9('0x5'))['db'];var utils=require(_0x77c9('0x6'));var logger=require('../../config/logger')(_0x77c9('0x7'));var config=require(_0x77c9('0x8'));var jayson=require(_0x77c9('0x9'));var client=jayson[_0x77c9('0xa')][_0x77c9('0xb')]({'port':0x232a});config[_0x77c9('0xc')]=_[_0x77c9('0xd')](config['redis'],{'host':_0x77c9('0xe'),'port':0x18eb});var socket=require(_0x77c9('0xf'))(new Redis(config[_0x77c9('0xc')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x4b5b7e,_0x522956,_0x27ec41){return new BPromise(function(_0x3ab03e,_0x3f2ae7){return client['request'](_0x4b5b7e,_0x27ec41)[_0x77c9('0x10')](function(_0x53c7d3){logger['info']('UserNotification,\x20%s,\x20%s',_0x522956,'request\x20sent');logger[_0x77c9('0x11')](_0x77c9('0x12'),_0x522956,'request\x20sent',JSON[_0x77c9('0x13')](_0x53c7d3));if(_0x53c7d3[_0x77c9('0x14')]){if(_0x53c7d3[_0x77c9('0x14')][_0x77c9('0x15')]===0x1f4){logger['error'](_0x77c9('0x16'),_0x522956,_0x53c7d3['error']['message']);return _0x3f2ae7(_0x53c7d3[_0x77c9('0x14')][_0x77c9('0x17')]);}logger[_0x77c9('0x14')](_0x77c9('0x16'),_0x522956,_0x53c7d3['error']['message']);return _0x3ab03e(_0x53c7d3[_0x77c9('0x14')]['message']);}else{logger[_0x77c9('0x18')]('UserNotification,\x20%s,\x20%s',_0x522956,_0x77c9('0x19'));_0x3ab03e(_0x53c7d3[_0x77c9('0x1a')][_0x77c9('0x17')]);}})['catch'](function(_0x579bd2){logger['error'](_0x77c9('0x16'),_0x522956,_0x579bd2);_0x3f2ae7(_0x579bd2);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index cc4236a..77a0e5b 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 _0xd203=['length','save','remove','update','emit','removeListener','register'];(function(_0x4f5e98,_0x5d859b){var _0x27b685=function(_0x159d19){while(--_0x159d19){_0x4f5e98['push'](_0x4f5e98['shift']());}};_0x27b685(++_0x5d859b);}(_0xd203,0xb7));var _0x3d20=function(_0x24b1cf,_0x1bfd5d){_0x24b1cf=_0x24b1cf-0x0;var _0x1c3a08=_0xd203[_0x24b1cf];return _0x1c3a08;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x3d20('0x0'),_0x3d20('0x1'),_0x3d20('0x2')];function createListener(_0x410aff,_0x467aa9){return function(_0x267900){_0x467aa9[_0x3d20('0x3')](_0x410aff,_0x267900);};}function removeListener(_0x4d6807,_0x54da10){return function(){UserNotificationEvents[_0x3d20('0x4')](_0x4d6807,_0x54da10);};}exports[_0x3d20('0x5')]=function(_0x828adf){for(var _0x257603=0x0,_0x270431=events[_0x3d20('0x6')];_0x257603<_0x270431;_0x257603++){var _0x406b53=events[_0x257603];var _0x2ace62=createListener('userNotification:'+_0x406b53,_0x828adf);UserNotificationEvents['on'](_0x406b53,_0x2ace62);}}; \ No newline at end of file +var _0xe095=['register','length','./userNotification.events','save','remove','emit'];(function(_0x3f3118,_0x3aca27){var _0x5c3c17=function(_0x472b43){while(--_0x472b43){_0x3f3118['push'](_0x3f3118['shift']());}};_0x5c3c17(++_0x3aca27);}(_0xe095,0x92));var _0x5e09=function(_0x54bf4d,_0x5d5c41){_0x54bf4d=_0x54bf4d-0x0;var _0x2684a6=_0xe095[_0x54bf4d];return _0x2684a6;};'use strict';var UserNotificationEvents=require(_0x5e09('0x0'));var events=[_0x5e09('0x1'),_0x5e09('0x2'),'update'];function createListener(_0x446377,_0x1777a1){return function(_0x28cb96){_0x1777a1[_0x5e09('0x3')](_0x446377,_0x28cb96);};}function removeListener(_0x487e85,_0x218c7b){return function(){UserNotificationEvents['removeListener'](_0x487e85,_0x218c7b);};}exports[_0x5e09('0x4')]=function(_0x24484c){for(var _0x1d31fe=0x0,_0x5bbdbb=events[_0x5e09('0x5')];_0x1d31fe<_0x5bbdbb;_0x1d31fe++){var _0x1274e9=events[_0x1d31fe];var _0x325e66=createListener('userNotification:'+_0x1274e9,_0x24484c);UserNotificationEvents['on'](_0x1274e9,_0x325e66);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index cb227d2..f66785c 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x10c800,_0x43cbe2){var _0x4bb6cf=function(_0x546094){while(--_0x546094){_0x10c800['push'](_0x10c800['shift']());}};_0x4bb6cf(++_0x43cbe2);}(_0xedd9,0xfc));var _0x9edd=function(_0x10148c,_0x413b91){_0x10148c=_0x10148c-0x0;var _0x174bb0=_0xedd9[_0x10148c];return _0x174bb0;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x229af0,_0x52ca56){var _0x529d21=function(_0x4476f1){while(--_0x4476f1){_0x229af0['push'](_0x229af0['shift']());}};_0x529d21(++_0x52ca56);}(_0x70e0,0x17b));var _0x070e=function(_0x560bd4,_0xa0bfcd){_0x560bd4=_0x560bd4-0x0;var _0x25fbd0=_0x70e0[_0x560bd4];return _0x25fbd0;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 57a557b..62335d8 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 _0x95d9=['INTEGER','sequelize','exports'];(function(_0x363a25,_0x501880){var _0x51933e=function(_0x17f7c2){while(--_0x17f7c2){_0x363a25['push'](_0x363a25['shift']());}};_0x51933e(++_0x501880);}(_0x95d9,0x97));var _0x995d=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x95d9[_0x1d24eb];return _0x1dc576;};'use strict';var Sequelize=require(_0x995d('0x0'));module[_0x995d('0x1')]={'penalty':{'type':Sequelize[_0x995d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4346=['INTEGER','sequelize','exports'];(function(_0x532c87,_0x5ce278){var _0xbe7f7f=function(_0x2a3d9f){while(--_0x2a3d9f){_0x532c87['push'](_0x532c87['shift']());}};_0xbe7f7f(++_0x5ce278);}(_0x4346,0x18a));var _0x6434=function(_0x3b3f4f,_0x403216){_0x3b3f4f=_0x3b3f4f-0x0;var _0x174dbe=_0x4346[_0x3b3f4f];return _0x174dbe;};'use strict';var Sequelize=require(_0x6434('0x0'));module[_0x6434('0x1')]={'penalty':{'type':Sequelize[_0x6434('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 271d89e..62b804f 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 _0x35fd=['bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0x274b0d,_0x3962c8){var _0x18ed83=function(_0xfbaa22){while(--_0xfbaa22){_0x274b0d['push'](_0x274b0d['shift']());}};_0x18ed83(++_0x3962c8);}(_0x35fd,0x70));var _0xd35f=function(_0x3d525f,_0x50f943){_0x3d525f=_0x3d525f-0x0;var _0x19024f=_0x35fd[_0x3d525f];return _0x19024f;};'use strict';var _=require(_0xd35f('0x0'));var util=require(_0xd35f('0x1'));var logger=require(_0xd35f('0x2'))(_0xd35f('0x3'));var moment=require(_0xd35f('0x4'));var BPromise=require(_0xd35f('0x5'));var rp=require(_0xd35f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd35f('0x7'));var config=require(_0xd35f('0x8'));var attributes=require(_0xd35f('0x9'));module['exports']=function(_0x47988a,_0x2c9185){return _0x47988a[_0xd35f('0xa')](_0xd35f('0xb'),attributes,{'tableName':_0xd35f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x100c=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x5df09c,_0x44bf0c){var _0x4571ff=function(_0x95d2f5){while(--_0x95d2f5){_0x5df09c['push'](_0x5df09c['shift']());}};_0x4571ff(++_0x44bf0c);}(_0x100c,0x138));var _0xc100=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x100c[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xc100('0x0'));var util=require(_0xc100('0x1'));var logger=require(_0xc100('0x2'))('api');var moment=require(_0xc100('0x3'));var BPromise=require(_0xc100('0x4'));var rp=require(_0xc100('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc100('0x6'));var config=require(_0xc100('0x7'));var attributes=require(_0xc100('0x8'));module['exports']=function(_0x42abc8,_0x3c55e6){return _0x42abc8[_0xc100('0x9')](_0xc100('0xa'),attributes,{'tableName':_0xc100('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 4f83a4c..e29529b 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 _0x84f3=['info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then'];(function(_0x3ecebf,_0x11d3f1){var _0x452aa8=function(_0x14c38c){while(--_0x14c38c){_0x3ecebf['push'](_0x3ecebf['shift']());}};_0x452aa8(++_0x11d3f1);}(_0x84f3,0x1ae));var _0x384f=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x84f3[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x384f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x384f('0x1'));var rs=require(_0x384f('0x2'));var fs=require('fs');var Redis=require(_0x384f('0x3'));var db=require(_0x384f('0x4'))['db'];var utils=require(_0x384f('0x5'));var logger=require(_0x384f('0x6'))(_0x384f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x384f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f9baa,_0x3a5d6c,_0x5f9632){return new BPromise(function(_0x44080d,_0x43d194){return client[_0x384f('0x9')](_0x2f9baa,_0x5f9632)[_0x384f('0xa')](function(_0x29de9c){logger[_0x384f('0xb')](_0x384f('0xc'),_0x3a5d6c,_0x384f('0xd'));logger[_0x384f('0xe')](_0x384f('0xf'),_0x3a5d6c,'request\x20sent',JSON[_0x384f('0x10')](_0x29de9c));if(_0x29de9c['error']){if(_0x29de9c[_0x384f('0x11')][_0x384f('0x12')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x3a5d6c,_0x29de9c['error'][_0x384f('0x13')]);return _0x43d194(_0x29de9c[_0x384f('0x11')][_0x384f('0x13')]);}logger['error'](_0x384f('0xc'),_0x3a5d6c,_0x29de9c[_0x384f('0x11')][_0x384f('0x13')]);return _0x44080d(_0x29de9c[_0x384f('0x11')][_0x384f('0x13')]);}else{logger['info'](_0x384f('0xc'),_0x3a5d6c,'request\x20sent');_0x44080d(_0x29de9c['result'][_0x384f('0x13')]);}})[_0x384f('0x14')](function(_0x11a453){logger[_0x384f('0x11')](_0x384f('0xc'),_0x3a5d6c,_0x11a453);_0x43d194(_0x11a453);});});} \ No newline at end of file +var _0xfefc=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x1f504c,_0x319b4f){var _0x50d2e6=function(_0x47f98d){while(--_0x47f98d){_0x1f504c['push'](_0x1f504c['shift']());}};_0x50d2e6(++_0x319b4f);}(_0xfefc,0xfa));var _0xcfef=function(_0x123009,_0x10be51){_0x123009=_0x123009-0x0;var _0x264d4e=_0xfefc[_0x123009];return _0x264d4e;};'use strict';var _=require(_0xcfef('0x0'));var util=require(_0xcfef('0x1'));var moment=require(_0xcfef('0x2'));var BPromise=require(_0xcfef('0x3'));var rs=require(_0xcfef('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfef('0x5'))['db'];var utils=require(_0xcfef('0x6'));var logger=require(_0xcfef('0x7'))(_0xcfef('0x8'));var config=require('../../config/environment');var jayson=require(_0xcfef('0x9'));var client=jayson['client'][_0xcfef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f825b,_0x570a61,_0x1075c8){return new BPromise(function(_0x5ab970,_0x5e378f){return client[_0xcfef('0xb')](_0x3f825b,_0x1075c8)[_0xcfef('0xc')](function(_0x38ea43){logger[_0xcfef('0xd')](_0xcfef('0xe'),_0x570a61,_0xcfef('0xf'));logger[_0xcfef('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x570a61,'request\x20sent',JSON[_0xcfef('0x11')](_0x38ea43));if(_0x38ea43[_0xcfef('0x12')]){if(_0x38ea43[_0xcfef('0x12')][_0xcfef('0x13')]===0x1f4){logger[_0xcfef('0x12')](_0xcfef('0xe'),_0x570a61,_0x38ea43['error']['message']);return _0x5e378f(_0x38ea43[_0xcfef('0x12')]['message']);}logger['error'](_0xcfef('0xe'),_0x570a61,_0x38ea43['error'][_0xcfef('0x14')]);return _0x5ab970(_0x38ea43[_0xcfef('0x12')][_0xcfef('0x14')]);}else{logger[_0xcfef('0xd')](_0xcfef('0xe'),_0x570a61,'request\x20sent');_0x5ab970(_0x38ea43[_0xcfef('0x15')]['message']);}})[_0xcfef('0x16')](function(_0x543dcb){logger[_0xcfef('0x12')](_0xcfef('0xe'),_0x570a61,_0x543dcb);_0x5e378f(_0x543dcb);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 4ae491f..2acb80e 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 _0xe305=['put','update','delete','destroy','removeSections','removeResources','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/sections','getSections','/:id/resources','create','post','/:id/clone','clone','addSections','addResources'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe305,0xc0));var _0x5e30=function(_0x390fde,_0x289d10){_0x390fde=_0x390fde-0x0;var _0x2d01cd=_0xe305[_0x390fde];return _0x2d01cd;};'use strict';var multer=require(_0x5e30('0x0'));var util=require(_0x5e30('0x1'));var path=require(_0x5e30('0x2'));var timeout=require('connect-timeout');var express=require(_0x5e30('0x3'));var router=express[_0x5e30('0x4')]();var fs_extra=require(_0x5e30('0x5'));var auth=require(_0x5e30('0x6'));var interaction=require(_0x5e30('0x7'));var config=require(_0x5e30('0x8'));var controller=require(_0x5e30('0x9'));router[_0x5e30('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5e30('0xb'),auth[_0x5e30('0xc')](),controller[_0x5e30('0xd')]);router[_0x5e30('0xa')](_0x5e30('0xe'),auth[_0x5e30('0xc')](),controller[_0x5e30('0xf')]);router[_0x5e30('0xa')](_0x5e30('0x10'),auth[_0x5e30('0xc')](),controller[_0x5e30('0x11')]);router[_0x5e30('0xa')](_0x5e30('0x12'),auth[_0x5e30('0xc')](),controller['getResources']);router['post']('/',auth[_0x5e30('0xc')](),controller[_0x5e30('0x13')]);router[_0x5e30('0x14')](_0x5e30('0x15'),auth[_0x5e30('0xc')](),controller[_0x5e30('0x16')]);router['post'](_0x5e30('0x10'),auth['isAuthenticated'](),controller[_0x5e30('0x17')]);router[_0x5e30('0x14')]('/:id/resources',auth[_0x5e30('0xc')](),controller[_0x5e30('0x18')]);router[_0x5e30('0x19')](_0x5e30('0xe'),auth[_0x5e30('0xc')](),controller[_0x5e30('0x1a')]);router[_0x5e30('0x1b')](_0x5e30('0xe'),auth['isAuthenticated'](),controller[_0x5e30('0x1c')]);router[_0x5e30('0x1b')](_0x5e30('0x10'),auth['isAuthenticated'](),controller[_0x5e30('0x1d')]);router[_0x5e30('0x1b')]('/:id/resources',auth[_0x5e30('0xc')](),controller[_0x5e30('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x894c=['show','/:id/sections','getSections','/:id/resources','post','/:id/clone','clone','addResources','put','update','delete','destroy','removeSections','removeResources','util','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x218ca6,_0x217c29){var _0x4ba2a6=function(_0x2d8e23){while(--_0x2d8e23){_0x218ca6['push'](_0x218ca6['shift']());}};_0x4ba2a6(++_0x217c29);}(_0x894c,0x98));var _0xc894=function(_0x2a23cd,_0x41e3f0){_0x2a23cd=_0x2a23cd-0x0;var _0x1f2a29=_0x894c[_0x2a23cd];return _0x1f2a29;};'use strict';var multer=require('multer');var util=require(_0xc894('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc894('0x1'));var router=express['Router']();var fs_extra=require(_0xc894('0x2'));var auth=require(_0xc894('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc894('0x4'));var controller=require('./userProfile.controller');router['get']('/',auth[_0xc894('0x5')](),controller[_0xc894('0x6')]);router[_0xc894('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xc894('0x8'),auth['isAuthenticated'](),controller[_0xc894('0x9')]);router['get'](_0xc894('0xa'),auth[_0xc894('0x5')](),controller[_0xc894('0xb')]);router[_0xc894('0x7')](_0xc894('0xc'),auth[_0xc894('0x5')](),controller['getResources']);router[_0xc894('0xd')]('/',auth[_0xc894('0x5')](),controller['create']);router[_0xc894('0xd')](_0xc894('0xe'),auth[_0xc894('0x5')](),controller[_0xc894('0xf')]);router[_0xc894('0xd')](_0xc894('0xa'),auth[_0xc894('0x5')](),controller['addSections']);router[_0xc894('0xd')]('/:id/resources',auth[_0xc894('0x5')](),controller[_0xc894('0x10')]);router[_0xc894('0x11')](_0xc894('0x8'),auth[_0xc894('0x5')](),controller[_0xc894('0x12')]);router[_0xc894('0x13')](_0xc894('0x8'),auth['isAuthenticated'](),controller[_0xc894('0x14')]);router['delete']('/:id/sections',auth[_0xc894('0x5')](),controller[_0xc894('0x15')]);router[_0xc894('0x13')](_0xc894('0xc'),auth['isAuthenticated'](),controller[_0xc894('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 7118710..e98aac9 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 _0xe105=['setDataValue','crudPermissions','join','getDataValue','BOOLEAN','STRING','name'];(function(_0x497daf,_0x3ec153){var _0x4838b1=function(_0x589c51){while(--_0x589c51){_0x497daf['push'](_0x497daf['shift']());}};_0x4838b1(++_0x3ec153);}(_0xe105,0x1a2));var _0x5e10=function(_0x2257af,_0x572110){_0x2257af=_0x2257af-0x0;var _0x3c6185=_0xe105[_0x2257af];return _0x3c6185;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5e10('0x0')],'allowNull':![],'unique':_0x5e10('0x1')},'crudPermissions':{'type':Sequelize[_0x5e10('0x0')],'set':function(_0x120cad){this[_0x5e10('0x2')](_0x5e10('0x3'),_0x120cad?_0x120cad[_0x5e10('0x4')](''):[]);},'get':function(){return this[_0x5e10('0x5')](_0x5e10('0x3'))?this[_0x5e10('0x5')](_0x5e10('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5e10('0x0')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x5e10('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x5e10('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x5e10('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x5e10('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5e10('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x5e10('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x8869=['STRING','setDataValue','join','getDataValue','crudPermissions','BOOLEAN','name'];(function(_0x32599b,_0x1b803f){var _0x4ac7f2=function(_0x2976bc){while(--_0x2976bc){_0x32599b['push'](_0x32599b['shift']());}};_0x4ac7f2(++_0x1b803f);}(_0x8869,0x172));var _0x9886=function(_0x5f1f9a,_0x234bba){_0x5f1f9a=_0x5f1f9a-0x0;var _0x2f54d0=_0x8869[_0x5f1f9a];return _0x2f54d0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9886('0x0')},'crudPermissions':{'type':Sequelize[_0x9886('0x1')],'set':function(_0x14a67e){this[_0x9886('0x2')]('crudPermissions',_0x14a67e?_0x14a67e[_0x9886('0x3')](''):[]);},'get':function(){return this[_0x9886('0x4')](_0x9886('0x5'))?this[_0x9886('0x4')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9886('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x9886('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9886('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9886('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x9886('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x9886('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9886('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9886('0x6')],'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 dd7d03e..1842ed6 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 _0x00cc=['sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','find','catch','create','body','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','get','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','params','describe','addSections','each','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','offset','undefined','limit','count','reject','save','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x372433,_0xb55d02){var _0x375ac3=function(_0x1c1d22){while(--_0x1c1d22){_0x372433['push'](_0x372433['shift']());}};_0x375ac3(++_0xb55d02);}(_0x00cc,0x11a));var _0xc00c=function(_0x54c09a,_0x1df9ed){_0x54c09a=_0x54c09a-0x0;var _0x5895f8=_0x00cc[_0x54c09a];return _0x5895f8;};'use strict';var emlformat=require(_0xc00c('0x0'));var rimraf=require(_0xc00c('0x1'));var zipdir=require(_0xc00c('0x2'));var jsonpatch=require(_0xc00c('0x3'));var rp=require(_0xc00c('0x4'));var moment=require(_0xc00c('0x5'));var BPromise=require(_0xc00c('0x6'));var Mustache=require(_0xc00c('0x7'));var util=require(_0xc00c('0x8'));var path=require('path');var sox=require(_0xc00c('0x9'));var csv=require('to-csv');var ejs=require(_0xc00c('0xa'));var fs=require('fs');var fs_extra=require(_0xc00c('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc00c('0xc'));var jsforce=require(_0xc00c('0xd'));var deskjs=require(_0xc00c('0xe'));var toCsv=require(_0xc00c('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc00c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc00c('0x11'));var as=require(_0xc00c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc00c('0x13'));var utils=require(_0xc00c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc00c('0x15'));var db=require(_0xc00c('0x16'))['db'];config['redis']=_[_0xc00c('0x17')](config[_0xc00c('0x18')],{'host':_0xc00c('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc00c('0x18')]));require('./userProfile.socket')[_0xc00c('0x1a')](socket);function respondWithStatusCode(_0xae4299,_0x1e8648){_0x1e8648=_0x1e8648||0xcc;return function(_0x380533){if(_0x380533){return _0xae4299[_0xc00c('0x1b')](_0x1e8648);}return _0xae4299[_0xc00c('0x1c')](_0x1e8648)[_0xc00c('0x1d')]();};}function respondWithResult(_0x5e4b60,_0x277761){_0x277761=_0x277761||0xc8;return function(_0x2261c9){if(_0x2261c9){return _0x5e4b60[_0xc00c('0x1c')](_0x277761)['json'](_0x2261c9);}};}function respondWithFilteredResult(_0x46791b,_0x534c9f){return function(_0x2fb637){if(_0x2fb637){var _0x58e734=typeof _0x534c9f[_0xc00c('0x1e')]===_0xc00c('0x1f')&&typeof _0x534c9f[_0xc00c('0x20')]===_0xc00c('0x1f');var _0x57eadc=_0x2fb637[_0xc00c('0x21')];var _0x43c945=_0x58e734?0x0:_0x534c9f[_0xc00c('0x1e')];var _0x1f1916=_0x58e734?_0x2fb637[_0xc00c('0x21')]:_0x534c9f[_0xc00c('0x1e')]+_0x534c9f['limit'];var _0x11c145;if(_0x1f1916>=_0x57eadc){_0x1f1916=_0x57eadc;_0x11c145=0xc8;}else{_0x11c145=0xce;}_0x46791b[_0xc00c('0x1c')](_0x11c145);return _0x46791b['set']('Content-Range',_0x43c945+'-'+_0x1f1916+'/'+_0x57eadc)['json'](_0x2fb637);}return null;};}function patchUpdates(_0x1fc202){return function(_0x3e63ff){try{jsonpatch['apply'](_0x3e63ff,_0x1fc202,!![]);}catch(_0x451019){return BPromise[_0xc00c('0x22')](_0x451019);}return _0x3e63ff[_0xc00c('0x23')]();};}function saveUpdates(_0x245835,_0x1eecb8){return function(_0x5d38f1){if(_0x5d38f1){return _0x5d38f1['update'](_0x245835)[_0xc00c('0x24')](function(_0x3948a7){return _0x3948a7;});}return null;};}function removeEntity(_0x2faca5,_0x27f81c){return function(_0x25531e){if(_0x25531e){return _0x25531e[_0xc00c('0x25')]()[_0xc00c('0x24')](function(){_0x2faca5[_0xc00c('0x1c')](0xcc)[_0xc00c('0x1d')]();});}};}function handleEntityNotFound(_0x4d9d7e,_0x138cd7){return function(_0x5dcf23){if(!_0x5dcf23){_0x4d9d7e[_0xc00c('0x1b')](0x194);}return _0x5dcf23;};}function handleError(_0x4fc988,_0x5b0b80){_0x5b0b80=_0x5b0b80||0x1f4;return function(_0x1d2aa7){logger[_0xc00c('0x26')](_0x1d2aa7[_0xc00c('0x27')]);if(_0x1d2aa7['name']){delete _0x1d2aa7[_0xc00c('0x28')];}_0x4fc988[_0xc00c('0x1c')](_0x5b0b80)[_0xc00c('0x29')](_0x1d2aa7);};}exports[_0xc00c('0x2a')]=function(_0x5c4144,_0x4b7ff8){var _0x5ce068={},_0x438559={},_0x196b2e={'count':0x0,'rows':[]};var _0x5cc8ff=_[_0xc00c('0x2b')](db[_0xc00c('0x2c')][_0xc00c('0x2d')],function(_0xe13de3){return{'name':_0xe13de3[_0xc00c('0x2e')],'type':_0xe13de3[_0xc00c('0x2f')][_0xc00c('0x30')]};});_0x438559[_0xc00c('0x31')]=_[_0xc00c('0x2b')](_0x5cc8ff,_0xc00c('0x28'));_0x438559[_0xc00c('0x32')]=_[_0xc00c('0x33')](_0x5c4144[_0xc00c('0x32')]);_0x438559[_0xc00c('0x34')]=_[_0xc00c('0x35')](_0x438559['model'],_0x438559[_0xc00c('0x32')]);_0x5ce068[_0xc00c('0x36')]=_[_0xc00c('0x35')](_0x438559[_0xc00c('0x31')],qs[_0xc00c('0x37')](_0x5c4144[_0xc00c('0x32')][_0xc00c('0x37')]));_0x5ce068[_0xc00c('0x36')]=_0x5ce068[_0xc00c('0x36')][_0xc00c('0x38')]?_0x5ce068[_0xc00c('0x36')]:_0x438559[_0xc00c('0x31')];if(!_0x5c4144[_0xc00c('0x32')][_0xc00c('0x39')](_0xc00c('0x3a'))){_0x5ce068[_0xc00c('0x20')]=qs[_0xc00c('0x20')](_0x5c4144[_0xc00c('0x32')][_0xc00c('0x20')]);_0x5ce068[_0xc00c('0x1e')]=qs[_0xc00c('0x1e')](_0x5c4144[_0xc00c('0x32')][_0xc00c('0x1e')]);}_0x5ce068[_0xc00c('0x3b')]=qs[_0xc00c('0x3c')](_0x5c4144['query'][_0xc00c('0x3c')]);_0x5ce068[_0xc00c('0x3d')]=qs['filters'](_[_0xc00c('0x3e')](_0x5c4144[_0xc00c('0x32')],_0x438559[_0xc00c('0x34')]),_0x5cc8ff);if(_0x5c4144['query'][_0xc00c('0x3f')]){_0x5ce068[_0xc00c('0x3d')]=_[_0xc00c('0x40')](_0x5ce068[_0xc00c('0x3d')],{'$or':_[_0xc00c('0x2b')](_0x5cc8ff,function(_0x5765be){if(_0x5765be[_0xc00c('0x2f')]!==_0xc00c('0x41')){var _0x4d43de={};_0x4d43de[_0x5765be[_0xc00c('0x28')]]={'$like':'%'+_0x5c4144[_0xc00c('0x32')][_0xc00c('0x3f')]+'%'};return _0x4d43de;}})});}_0x5ce068=_[_0xc00c('0x40')]({},_0x5ce068,_0x5c4144[_0xc00c('0x42')]);var _0x296c32={'where':_0x5ce068['where']};return db[_0xc00c('0x2c')][_0xc00c('0x21')](_0x296c32)[_0xc00c('0x24')](function(_0xafb47b){_0x196b2e[_0xc00c('0x21')]=_0xafb47b;if(_0x5c4144[_0xc00c('0x32')]['includeAll']){_0x5ce068[_0xc00c('0x43')]=[{'all':!![]}];}return db[_0xc00c('0x2c')][_0xc00c('0x44')](_0x5ce068);})[_0xc00c('0x24')](function(_0x2c0d5a){_0x196b2e[_0xc00c('0x45')]=_0x2c0d5a;return _0x196b2e;})['then'](respondWithFilteredResult(_0x4b7ff8,_0x5ce068))['catch'](handleError(_0x4b7ff8,null));};exports[_0xc00c('0x46')]=function(_0x326069,_0x5790d1){var _0x39060a={'raw':![],'where':{'id':_0x326069['params']['id']}},_0x1696f9={};_0x1696f9['model']=_[_0xc00c('0x33')](db[_0xc00c('0x2c')][_0xc00c('0x2d')]);_0x1696f9[_0xc00c('0x32')]=_[_0xc00c('0x33')](_0x326069[_0xc00c('0x32')]);_0x1696f9['filters']=_[_0xc00c('0x35')](_0x1696f9[_0xc00c('0x31')],_0x1696f9[_0xc00c('0x32')]);_0x39060a[_0xc00c('0x36')]=_[_0xc00c('0x35')](_0x1696f9['model'],qs[_0xc00c('0x37')](_0x326069[_0xc00c('0x32')][_0xc00c('0x37')]));_0x39060a[_0xc00c('0x36')]=_0x39060a[_0xc00c('0x36')][_0xc00c('0x38')]?_0x39060a[_0xc00c('0x36')]:_0x1696f9[_0xc00c('0x31')];if(_0x326069['query'][_0xc00c('0x47')]){_0x39060a['include']=[{'all':!![]}];}_0x39060a=_[_0xc00c('0x40')]({},_0x39060a,_0x326069[_0xc00c('0x42')]);return db['UserProfile'][_0xc00c('0x48')](_0x39060a)['then'](handleEntityNotFound(_0x5790d1,null))['then'](respondWithResult(_0x5790d1,null))[_0xc00c('0x49')](handleError(_0x5790d1,null));};exports[_0xc00c('0x4a')]=function(_0x26e3e1,_0x2a5744){return db[_0xc00c('0x2c')][_0xc00c('0x4a')](_0x26e3e1[_0xc00c('0x4b')],{})[_0xc00c('0x24')](respondWithResult(_0x2a5744,0xc9))[_0xc00c('0x49')](handleError(_0x2a5744,null));};exports['clone']=function(_0x57c59a,_0x454c76){var _0x145977={'where':{'id':_0x57c59a['params']['id']}},_0x38592e={};_0x38592e[_0xc00c('0x31')]=_[_0xc00c('0x33')](db[_0xc00c('0x2c')][_0xc00c('0x2d')]);_0x145977[_0xc00c('0x36')]=_[_0xc00c('0x35')](_0x38592e[_0xc00c('0x31')],qs[_0xc00c('0x37')](_0x57c59a[_0xc00c('0x32')][_0xc00c('0x37')]));_0x145977[_0xc00c('0x36')]=_0x145977[_0xc00c('0x36')][_0xc00c('0x38')]?_0x145977[_0xc00c('0x36')]:_0x38592e[_0xc00c('0x31')];if(_0x57c59a[_0xc00c('0x32')][_0xc00c('0x47')]){_0x145977[_0xc00c('0x43')]=[{'all':!![]}];}_0x145977=_['merge']({},_0x145977,_0x57c59a[_0xc00c('0x42')]);return db[_0xc00c('0x2c')][_0xc00c('0x48')](_0x145977)['then'](handleEntityNotFound(_0x454c76,null))['then'](function(_0x496cfe){if(_0x496cfe){var _0x514100=_0x496cfe['get']({'plain':!![]});_0x514100=qs[_0xc00c('0x4c')](_0x514100,['id','createdAt',_0xc00c('0x4d'),_0xc00c('0x4e')]);_0x57c59a[_0xc00c('0x4b')]=_['omit'](_0x57c59a[_0xc00c('0x4b')],['id',_0xc00c('0x4f'),_0xc00c('0x4d')]);return db[_0xc00c('0x50')][_0xc00c('0x51')](function(_0x85d85b){return db[_0xc00c('0x2c')]['create'](_[_0xc00c('0x40')](_0x514100,_0x57c59a['body']),{'include':_0x57c59a['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x85d85b})[_0xc00c('0x24')](function(_0x3d9d1b){var _0x1073e5=_0x3d9d1b[_0xc00c('0x52')]({'plain':!![]});return db[_0xc00c('0x53')][_0xc00c('0x44')]({'where':{'userProfileId':_0x57c59a['params']['id']},'raw':!![]})[_0xc00c('0x24')](function(_0x2e8a9c){if(_0x2e8a9c){return BPromise['each'](_0x2e8a9c,function(_0x1d1905){return new BPromise(function(_0x3f8f3f,_0x15485b){if(_0x1d1905['autoAssociation']===null||_0x1d1905[_0xc00c('0x54')]===0x1)_0x3f8f3f(null);return db[_0xc00c('0x55')][_0xc00c('0x44')]({'where':{'sectionId':_0x1d1905['id']},'raw':!![]})['then'](function(_0x302abc){var _0x5993b6=_['map'](_0x302abc,function(_0x5ee978){return qs[_0xc00c('0x4c')](_0x5ee978,['id','createdAt',_0xc00c('0x4d'),_0xc00c('0x56')]);});_0x3f8f3f(_0x5993b6);})[_0xc00c('0x49')](function(_0x4ba1fa){_0x15485b(_0x4ba1fa);});})[_0xc00c('0x24')](function(_0x11a2d0){var _0x27e176=qs[_0xc00c('0x4c')](_0x1d1905,['id',_0xc00c('0x4f'),_0xc00c('0x4d')]);_0x27e176[_0xc00c('0x57')]=_0x1073e5['id'];if(_0x11a2d0)_0x27e176[_0xc00c('0x58')]=_0x11a2d0;return _0x27e176;})[_0xc00c('0x24')](function(_0xd34db4){return db['UserProfileSection'][_0xc00c('0x4a')](_0xd34db4,{'include':[{'model':db[_0xc00c('0x55')],'as':_0xc00c('0x58')}],'raw':!![],'transaction':_0x85d85b});});})[_0xc00c('0x24')](function(){return _0x1073e5;});}});});});}})[_0xc00c('0x24')](respondWithResult(_0x454c76,0xc9))[_0xc00c('0x49')](handleError(_0x454c76,null));};exports[_0xc00c('0x59')]=function(_0x36925a,_0x3a67b5){if(_0x36925a[_0xc00c('0x4b')]['id']){delete _0x36925a[_0xc00c('0x4b')]['id'];}return db[_0xc00c('0x2c')][_0xc00c('0x48')]({'where':{'id':_0x36925a[_0xc00c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3a67b5,null))['then'](saveUpdates(_0x36925a['body'],null))[_0xc00c('0x24')](respondWithResult(_0x3a67b5,null))[_0xc00c('0x49')](handleError(_0x3a67b5,null));};exports[_0xc00c('0x25')]=function(_0x514dc9,_0x46743d){return db[_0xc00c('0x2c')]['find']({'where':{'id':_0x514dc9[_0xc00c('0x5a')]['id']}})[_0xc00c('0x24')](handleEntityNotFound(_0x46743d,null))[_0xc00c('0x24')](removeEntity(_0x46743d,null))[_0xc00c('0x49')](handleError(_0x46743d,null));};exports[_0xc00c('0x5b')]=function(_0x2d9c48,_0x2e6b75){return db['UserProfile']['describe']()['then'](respondWithResult(_0x2e6b75,null))[_0xc00c('0x49')](handleError(_0x2e6b75,null));};exports[_0xc00c('0x5c')]=function(_0x3aa2d5,_0x1096ca){var _0x5b0fa5=_0x3aa2d5[_0xc00c('0x4b')];return db['UserProfile'][_0xc00c('0x48')]({'where':{'id':_0x3aa2d5[_0xc00c('0x5a')]['id']}})[_0xc00c('0x24')](handleEntityNotFound(_0x1096ca,null))['then'](function(_0x39482e){if(_0x39482e){return db[_0xc00c('0x50')][_0xc00c('0x51')](function(_0x4e6f85){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x3aa2d5[_0xc00c('0x5a')]['id'],'sectionId':_[_0xc00c('0x2b')](_0x5b0fa5,function(_0x31f807){return _0x31f807[_0xc00c('0x56')];})},'transaction':_0x4e6f85})[_0xc00c('0x24')](function(){var _0x56b845=_[_0xc00c('0x2b')](_0x5b0fa5,function(_0xb0985b){_0xb0985b[_0xc00c('0x57')]=_0x3aa2d5[_0xc00c('0x5a')]['id'];return _0xb0985b;});var _0x26b7e7=[];return BPromise[_0xc00c('0x5d')](_0x56b845,function(_0x3b72bc){return db['UserProfileSection'][_0xc00c('0x4a')](_0x3b72bc,{'include':[{'model':db[_0xc00c('0x55')],'as':_0xc00c('0x58')}],'raw':!![],'transaction':_0x4e6f85})['then'](function(_0x68ab8d){_0x26b7e7[_0xc00c('0x5e')](_0x68ab8d[_0xc00c('0x52')]({'plain':!![]}));});})[_0xc00c('0x24')](function(){return _0x26b7e7;});});});}})[_0xc00c('0x24')](function(_0x4a5e7a){return _0x4a5e7a;})[_0xc00c('0x24')](respondWithResult(_0x1096ca,null))['catch'](handleError(_0x1096ca,null));};exports[_0xc00c('0x5f')]=function(_0x129616,_0x22cb7c){var _0x20c73d;return db['UserProfile'][_0xc00c('0x48')]({'where':{'id':_0x129616[_0xc00c('0x5a')]['id']},'attributes':['id',_0xc00c('0x28')]})[_0xc00c('0x24')](handleEntityNotFound(_0x22cb7c,null))[_0xc00c('0x24')](function(_0x37ea79){if(_0x37ea79){_0x20c73d=_0x37ea79;return db[_0xc00c('0x53')]['destroy']({'where':{'userProfileId':_0x129616[_0xc00c('0x5a')]['id'],'sectionId':_0x129616[_0xc00c('0x32')][_0xc00c('0x60')]}});}})[_0xc00c('0x24')](function(){return _0x20c73d;})[_0xc00c('0x24')](respondWithStatusCode(_0x22cb7c,null))[_0xc00c('0x49')](handleError(_0x22cb7c,null));};exports[_0xc00c('0x61')]=function(_0x46a415,_0x24cd0a){var _0x56f9b7=[];var _0xa32025=[];return db[_0xc00c('0x53')]['findAll']({'where':{'userProfileId':_0x46a415['params']['id']},'raw':!![]})[_0xc00c('0x24')](function(_0x1ba8bd){_0x56f9b7=_[_0xc00c('0x3f')](_0x1ba8bd,function(_0x2a7248){return _0x2a7248[_0xc00c('0x62')]===0x1||_[_0xc00c('0x63')]([0x3eb,0x709],_0x2a7248['sectionId']);});if(!_[_0xc00c('0x64')](_0x56f9b7)){return _[_0xc00c('0x2b')](_0x56f9b7,function(_0x505c7d){return _0x505c7d[_0xc00c('0x56')];});}else{return;}})['then'](function(_0x219ee6){if(_0x219ee6)_0xa32025=_0x219ee6;if(_['includes'](_0xa32025,0x64)){var _0x3bdeca=_['find'](_0x56f9b7,{'sectionId':0x64});return hasDefaultDashboard(_0x3bdeca)[_0xc00c('0x24')](function(_0xb97157){return _[_0xc00c('0x2b')](_0x56f9b7,function(_0x1cfa95){if(_0x1cfa95[_0xc00c('0x56')]===0x64){_0x1cfa95[_0xc00c('0x65')]=_0xb97157;}return _0x1cfa95;});});}else{return;}})[_0xc00c('0x24')](function(_0x2e30d2){if(_0x2e30d2)_0x56f9b7=_0x2e30d2;if(_[_0xc00c('0x63')](_0xa32025,0x3eb)){var _0x29a5f2=_['find'](_0x56f9b7,{'sectionId':0x3eb});return getCustomDashboards(_0x29a5f2)[_0xc00c('0x24')](function(_0x1ce683){return _[_0xc00c('0x2b')](_0x56f9b7,function(_0x5a912e){if(_0x29a5f2[_0xc00c('0x62')]){if(_0x5a912e[_0xc00c('0x56')]===0x3eb){_0x5a912e[_0xc00c('0x65')]=_0x1ce683;}}else{if(_0x5a912e[_0xc00c('0x56')]===0x64){if(!_0x5a912e['subsections']){_0x5a912e[_0xc00c('0x65')]=[];}_0x5a912e['subsections']=_0x5a912e[_0xc00c('0x65')][_0xc00c('0x66')](_0x1ce683);}}return _0x5a912e;});});}else{return;}})[_0xc00c('0x24')](function(_0xd97c0c){if(_0xd97c0c)_0x56f9b7=_0xd97c0c;if(_['includes'](_0xa32025,0x709)){var _0x236e79=_[_0xc00c('0x48')](_0x56f9b7,{'sectionId':0x709});return getPlugins(_0x236e79)['then'](function(_0x4c1ec6){if(_0x236e79[_0xc00c('0x62')]){return _['map'](_0x56f9b7,function(_0x610125){if(_0x610125['sectionId']===0x709){_0x610125['subsections']=_0x4c1ec6;}return _0x610125;});}else{var _0x1760e4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4c1ec6};var _0x5a7a89=_[_0xc00c('0x2b')](_0x56f9b7);_0x5a7a89['push'](_0x1760e4);return _0x5a7a89;}});}else{return;}})[_0xc00c('0x24')](function(_0x28b7b0){if(_0x28b7b0)_0x56f9b7=_0x28b7b0;return _[_0xc00c('0x3f')](_0x56f9b7,[_0xc00c('0x62'),0x1]);})[_0xc00c('0x24')](respondWithResult(_0x24cd0a,null))[_0xc00c('0x49')](handleError(_0x24cd0a,null));};function hasDefaultDashboard(_0x237838){var _0x2c649a=[0x65];return new BPromise(function(_0x1390cf,_0x1d99e8){try{if(_0x237838['autoAssociation']){_0x1390cf(_0x2c649a);}else{return db[_0xc00c('0x55')][_0xc00c('0x67')]({'where':{'sectionId':_0x237838['id']},'raw':!![]})[_0xc00c('0x24')](function(_0x209e59){_0x209e59?_0x1390cf(_0x2c649a):_0x1390cf();});}}catch(_0x2d6190){_0x1d99e8(_0x2d6190);}});}function getCustomDashboards(_0x54390b){var _0x59abbc=[];return new BPromise(function(_0x29fbf7,_0x264d7b){try{if(_0x54390b[_0xc00c('0x54')]){return db[_0xc00c('0x68')][_0xc00c('0x44')]({'raw':!![]})['then'](function(_0x4342a8){_0x4342a8['forEach'](function(_0x16d117){_0x59abbc[_0xc00c('0x5e')](_0x16d117['id']+0x1869f);});_0x29fbf7(_0x59abbc);});}else{return db[_0xc00c('0x55')][_0xc00c('0x44')]({'where':{'sectionId':_0x54390b['id']},'raw':!![]})[_0xc00c('0x24')](function(_0x5c16c9){_0x5c16c9[_0xc00c('0x69')](function(_0x22eb2c){_0x59abbc[_0xc00c('0x5e')](_0x22eb2c[_0xc00c('0x6a')]+0x1869f);});_0x29fbf7(_0x59abbc);});}}catch(_0x1be5ac){_0x264d7b(_0x1be5ac);}});}function getPlugins(_0x4ecb91){var _0x56de01=[];return new BPromise(function(_0x3e790b,_0xd763ae){try{if(_0x4ecb91[_0xc00c('0x54')]){return db['Plugin']['findAll']({'raw':!![]})[_0xc00c('0x24')](function(_0x456682){_0x456682[_0xc00c('0x69')](function(_0x270d05){_0x56de01[_0xc00c('0x5e')](_0x270d05['id']+0x15b38);});_0x3e790b(_0x56de01);});}else{return db['UserProfileResource'][_0xc00c('0x44')]({'where':{'sectionId':_0x4ecb91['id']},'raw':!![]})['then'](function(_0x74ad2c){_0x74ad2c[_0xc00c('0x69')](function(_0x40e4ff){_0x56de01[_0xc00c('0x5e')](_0x40e4ff[_0xc00c('0x6a')]+0x15b38);});_0x3e790b(_0x56de01);});}}catch(_0x39e819){_0xd763ae(_0x39e819);}});}exports[_0xc00c('0x6b')]=function(_0xf54de9,_0x12af02){return db[_0xc00c('0x2c')]['find']({'where':{'id':_0xf54de9[_0xc00c('0x5a')]['id']}})[_0xc00c('0x24')](handleEntityNotFound(_0x12af02,null))[_0xc00c('0x24')](function(_0x5177b0){if(_0x5177b0){return db['sequelize'][_0xc00c('0x51')](function(_0x40a7af){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0xf54de9[_0xc00c('0x5a')]['id']},'attributes':['id'],'raw':!![]})[_0xc00c('0x24')](function(_0x3d7c19){if(_0x3d7c19){return db[_0xc00c('0x53')][_0xc00c('0x25')]({'where':{'userProfileId':_0xf54de9[_0xc00c('0x5a')]['id'],'id':_[_0xc00c('0x2b')](_0x3d7c19,function(_0x429067){return _0x429067['id'];})},'transaction':_0x40a7af});}})[_0xc00c('0x24')](function(_0x47b857){var _0x3d93be=_[_0xc00c('0x2b')](_0xf54de9[_0xc00c('0x4b')],function(_0x45dfed){_0x45dfed[_0xc00c('0x57')]=_0xf54de9['params']['id'];return _0x45dfed;});return db['UserProfileSection']['bulkCreate'](_0x3d93be,{'raw':!![],'transaction':_0x40a7af});})[_0xc00c('0x24')](function(_0x5de12f){var _0x442a69=_['filter'](_[_0xc00c('0x2b')](_0x5de12f,function(_0xfb9ef5){return _0xfb9ef5['get']({'plain':!![]});}),{'includeAll':![]});if(_0x442a69){return db['UserProfileSection'][_0xc00c('0x44')]({'where':{'userProfileId':_0xf54de9[_0xc00c('0x5a')]['id'],'sectionId':_['map'](_0x442a69,function(_0x27c8cc){return _0x27c8cc[_0xc00c('0x56')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xc00c('0x24')](function(_0x232519){var _0x314645=_[_0xc00c('0x2b')](_0xf54de9['body'],function(_0x5c5d4a){_0x5c5d4a[_0xc00c('0x57')]=_0xf54de9[_0xc00c('0x5a')]['id'];return _0x5c5d4a;});return db[_0xc00c('0x55')][_0xc00c('0x6c')](_0x314645,{'raw':!![],'transaction':_0x40a7af});});}})[_0xc00c('0x49')](handleError(_0x12af02,null));});}})['then'](function(_0x1a9c72){var _0x1ee61f=_[_0xc00c('0x2b')](_0x1a9c72,function(_0x12b8ea){return _0x12b8ea[_0xc00c('0x52')]({'plain':!![]});});})[_0xc00c('0x24')](respondWithResult(_0x12af02,null))[_0xc00c('0x49')](handleError(_0x12af02,null));};exports[_0xc00c('0x6d')]=function(_0x96bdca,_0x55f531,_0x1ef514){return db[_0xc00c('0x2c')][_0xc00c('0x48')]({'where':{'id':_0x96bdca[_0xc00c('0x5a')]['id']}})[_0xc00c('0x24')](handleEntityNotFound(_0x55f531,null))['then'](function(_0x4312aa){if(_0x4312aa){return _0x4312aa[_0xc00c('0x6d')](_0x96bdca[_0xc00c('0x32')][_0xc00c('0x60')]);}})[_0xc00c('0x24')](respondWithStatusCode(_0x55f531,null))[_0xc00c('0x49')](handleError(_0x55f531,null));};exports['getResources']=function(_0x3ed810,_0x179539){var _0x50217d={};if(!_0x3ed810[_0xc00c('0x32')][_0xc00c('0x6e')])throw new Error(_0xc00c('0x6f'));if(!_0x3ed810['query'][_0xc00c('0x39')](_0xc00c('0x3a'))){_0x50217d[_0xc00c('0x20')]=qs[_0xc00c('0x20')](_0x3ed810[_0xc00c('0x32')]['limit']);_0x50217d[_0xc00c('0x1e')]=qs['offset'](_0x3ed810[_0xc00c('0x32')][_0xc00c('0x1e')]);}return db[_0xc00c('0x2c')][_0xc00c('0x48')]({'where':{'id':_0x3ed810[_0xc00c('0x5a')]['id']}})[_0xc00c('0x24')](function(_0x5c4580){if(!_0x5c4580)throw new Error(_0xc00c('0x70')+_0x3ed810['params']['id']);return db[_0xc00c('0x2c')][_0xc00c('0x71')](_0x3ed810);})[_0xc00c('0x24')](respondWithFilteredResult(_0x179539,_0x50217d))[_0xc00c('0x49')](handleError(_0x179539,null));}; \ No newline at end of file +var _0xcdd8=['set','Content-Range','apply','reject','save','update','then','destroy','name','index','map','UserProfile','fieldName','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','options','find','create','body','clone','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','get','UserProfileSection','each','autoAssociation','userProfileId','UserProfileResource','describe','addSections','sectionId','Resources','push','ids','getSections','includes','subsections','concat','enabled','findOne','Dashboard','forEach','resourceId','addResources','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x4f0c2b,_0x2c9d14){var _0x526436=function(_0x2e13b6){while(--_0x2e13b6){_0x4f0c2b['push'](_0x4f0c2b['shift']());}};_0x526436(++_0x2c9d14);}(_0xcdd8,0xbd));var _0x8cdd=function(_0x31cc7e,_0x517fed){_0x31cc7e=_0x31cc7e-0x0;var _0xcad61c=_0xcdd8[_0x31cc7e];return _0xcad61c;};'use strict';var emlformat=require(_0x8cdd('0x0'));var rimraf=require(_0x8cdd('0x1'));var zipdir=require(_0x8cdd('0x2'));var jsonpatch=require(_0x8cdd('0x3'));var rp=require(_0x8cdd('0x4'));var moment=require('moment');var BPromise=require(_0x8cdd('0x5'));var Mustache=require(_0x8cdd('0x6'));var util=require(_0x8cdd('0x7'));var path=require('path');var sox=require(_0x8cdd('0x8'));var csv=require(_0x8cdd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8cdd('0xa'));var _=require(_0x8cdd('0xb'));var squel=require(_0x8cdd('0xc'));var crypto=require('crypto');var jsforce=require(_0x8cdd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8cdd('0x9'));var querystring=require(_0x8cdd('0xe'));var Papa=require('papaparse');var Redis=require(_0x8cdd('0xf'));var authService=require(_0x8cdd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8cdd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8cdd('0x12'))('api');var utils=require(_0x8cdd('0x13'));var config=require(_0x8cdd('0x14'));var licenseUtil=require(_0x8cdd('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8cdd('0x16')](config[_0x8cdd('0x17')],{'host':_0x8cdd('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8cdd('0x19'))[_0x8cdd('0x1a')](socket);function respondWithStatusCode(_0x4c56c9,_0x4d1243){_0x4d1243=_0x4d1243||0xcc;return function(_0x1faec8){if(_0x1faec8){return _0x4c56c9[_0x8cdd('0x1b')](_0x4d1243);}return _0x4c56c9[_0x8cdd('0x1c')](_0x4d1243)[_0x8cdd('0x1d')]();};}function respondWithResult(_0x1f09fd,_0x4842e9){_0x4842e9=_0x4842e9||0xc8;return function(_0x3fb674){if(_0x3fb674){return _0x1f09fd[_0x8cdd('0x1c')](_0x4842e9)[_0x8cdd('0x1e')](_0x3fb674);}};}function respondWithFilteredResult(_0x4e733b,_0x51f5ae){return function(_0x27ff0d){if(_0x27ff0d){var _0x56f5d4=typeof _0x51f5ae[_0x8cdd('0x1f')]===_0x8cdd('0x20')&&typeof _0x51f5ae['limit']==='undefined';var _0x1ad37b=_0x27ff0d[_0x8cdd('0x21')];var _0x4e6771=_0x56f5d4?0x0:_0x51f5ae[_0x8cdd('0x1f')];var _0x2fb926=_0x56f5d4?_0x27ff0d[_0x8cdd('0x21')]:_0x51f5ae['offset']+_0x51f5ae[_0x8cdd('0x22')];var _0x1c6d7d;if(_0x2fb926>=_0x1ad37b){_0x2fb926=_0x1ad37b;_0x1c6d7d=0xc8;}else{_0x1c6d7d=0xce;}_0x4e733b[_0x8cdd('0x1c')](_0x1c6d7d);return _0x4e733b[_0x8cdd('0x23')](_0x8cdd('0x24'),_0x4e6771+'-'+_0x2fb926+'/'+_0x1ad37b)[_0x8cdd('0x1e')](_0x27ff0d);}return null;};}function patchUpdates(_0x322d42){return function(_0x2de430){try{jsonpatch[_0x8cdd('0x25')](_0x2de430,_0x322d42,!![]);}catch(_0x1ed25c){return BPromise[_0x8cdd('0x26')](_0x1ed25c);}return _0x2de430[_0x8cdd('0x27')]();};}function saveUpdates(_0x387f0e,_0x591068){return function(_0x31965e){if(_0x31965e){return _0x31965e[_0x8cdd('0x28')](_0x387f0e)[_0x8cdd('0x29')](function(_0x4a59d9){return _0x4a59d9;});}return null;};}function removeEntity(_0x4bc688,_0x4c68e0){return function(_0x4ab4ef){if(_0x4ab4ef){return _0x4ab4ef[_0x8cdd('0x2a')]()[_0x8cdd('0x29')](function(){_0x4bc688[_0x8cdd('0x1c')](0xcc)[_0x8cdd('0x1d')]();});}};}function handleEntityNotFound(_0x3434ec,_0x325835){return function(_0x65c7f1){if(!_0x65c7f1){_0x3434ec['sendStatus'](0x194);}return _0x65c7f1;};}function handleError(_0x5145f3,_0x573934){_0x573934=_0x573934||0x1f4;return function(_0x2fce58){logger['error'](_0x2fce58['stack']);if(_0x2fce58[_0x8cdd('0x2b')]){delete _0x2fce58['name'];}_0x5145f3[_0x8cdd('0x1c')](_0x573934)['send'](_0x2fce58);};}exports[_0x8cdd('0x2c')]=function(_0x5871ba,_0x4c8cf6){var _0x35bede={},_0x286713={},_0x239103={'count':0x0,'rows':[]};var _0x106748=_[_0x8cdd('0x2d')](db[_0x8cdd('0x2e')]['rawAttributes'],function(_0x9e072){return{'name':_0x9e072[_0x8cdd('0x2f')],'type':_0x9e072['type']['key']};});_0x286713[_0x8cdd('0x30')]=_[_0x8cdd('0x2d')](_0x106748,'name');_0x286713['query']=_[_0x8cdd('0x31')](_0x5871ba[_0x8cdd('0x32')]);_0x286713[_0x8cdd('0x33')]=_[_0x8cdd('0x34')](_0x286713['model'],_0x286713['query']);_0x35bede['attributes']=_['intersection'](_0x286713[_0x8cdd('0x30')],qs[_0x8cdd('0x35')](_0x5871ba[_0x8cdd('0x32')][_0x8cdd('0x35')]));_0x35bede[_0x8cdd('0x36')]=_0x35bede[_0x8cdd('0x36')]['length']?_0x35bede[_0x8cdd('0x36')]:_0x286713[_0x8cdd('0x30')];if(!_0x5871ba['query'][_0x8cdd('0x37')](_0x8cdd('0x38'))){_0x35bede['limit']=qs['limit'](_0x5871ba[_0x8cdd('0x32')]['limit']);_0x35bede[_0x8cdd('0x1f')]=qs[_0x8cdd('0x1f')](_0x5871ba[_0x8cdd('0x32')][_0x8cdd('0x1f')]);}_0x35bede[_0x8cdd('0x39')]=qs[_0x8cdd('0x3a')](_0x5871ba[_0x8cdd('0x32')][_0x8cdd('0x3a')]);_0x35bede['where']=qs['filters'](_[_0x8cdd('0x3b')](_0x5871ba[_0x8cdd('0x32')],_0x286713['filters']),_0x106748);if(_0x5871ba[_0x8cdd('0x32')][_0x8cdd('0x3c')]){_0x35bede[_0x8cdd('0x3d')]=_[_0x8cdd('0x3e')](_0x35bede[_0x8cdd('0x3d')],{'$or':_[_0x8cdd('0x2d')](_0x106748,function(_0x25701d){if(_0x25701d[_0x8cdd('0x3f')]!==_0x8cdd('0x40')){var _0x41ed20={};_0x41ed20[_0x25701d[_0x8cdd('0x2b')]]={'$like':'%'+_0x5871ba[_0x8cdd('0x32')][_0x8cdd('0x3c')]+'%'};return _0x41ed20;}})});}_0x35bede=_['merge']({},_0x35bede,_0x5871ba['options']);var _0x19edea={'where':_0x35bede[_0x8cdd('0x3d')]};return db['UserProfile'][_0x8cdd('0x21')](_0x19edea)[_0x8cdd('0x29')](function(_0x18c062){_0x239103[_0x8cdd('0x21')]=_0x18c062;if(_0x5871ba['query']['includeAll']){_0x35bede[_0x8cdd('0x41')]=[{'all':!![]}];}return db['UserProfile'][_0x8cdd('0x42')](_0x35bede);})[_0x8cdd('0x29')](function(_0x5ccba0){_0x239103[_0x8cdd('0x43')]=_0x5ccba0;return _0x239103;})[_0x8cdd('0x29')](respondWithFilteredResult(_0x4c8cf6,_0x35bede))[_0x8cdd('0x44')](handleError(_0x4c8cf6,null));};exports[_0x8cdd('0x45')]=function(_0x5e2add,_0x45c102){var _0x3d3c82={'raw':![],'where':{'id':_0x5e2add[_0x8cdd('0x46')]['id']}},_0x315c3b={};_0x315c3b['model']=_[_0x8cdd('0x31')](db[_0x8cdd('0x2e')][_0x8cdd('0x47')]);_0x315c3b[_0x8cdd('0x32')]=_[_0x8cdd('0x31')](_0x5e2add['query']);_0x315c3b[_0x8cdd('0x33')]=_[_0x8cdd('0x34')](_0x315c3b['model'],_0x315c3b[_0x8cdd('0x32')]);_0x3d3c82[_0x8cdd('0x36')]=_['intersection'](_0x315c3b[_0x8cdd('0x30')],qs['fields'](_0x5e2add[_0x8cdd('0x32')][_0x8cdd('0x35')]));_0x3d3c82[_0x8cdd('0x36')]=_0x3d3c82[_0x8cdd('0x36')][_0x8cdd('0x48')]?_0x3d3c82[_0x8cdd('0x36')]:_0x315c3b['model'];if(_0x5e2add[_0x8cdd('0x32')][_0x8cdd('0x49')]){_0x3d3c82[_0x8cdd('0x41')]=[{'all':!![]}];}_0x3d3c82=_[_0x8cdd('0x3e')]({},_0x3d3c82,_0x5e2add[_0x8cdd('0x4a')]);return db['UserProfile'][_0x8cdd('0x4b')](_0x3d3c82)[_0x8cdd('0x29')](handleEntityNotFound(_0x45c102,null))[_0x8cdd('0x29')](respondWithResult(_0x45c102,null))[_0x8cdd('0x44')](handleError(_0x45c102,null));};exports[_0x8cdd('0x4c')]=function(_0x1421fa,_0x1f9bc9){return db['UserProfile'][_0x8cdd('0x4c')](_0x1421fa[_0x8cdd('0x4d')],{})[_0x8cdd('0x29')](respondWithResult(_0x1f9bc9,0xc9))[_0x8cdd('0x44')](handleError(_0x1f9bc9,null));};exports[_0x8cdd('0x4e')]=function(_0x5d89f2,_0x4604e3){var _0xd25e6c={'where':{'id':_0x5d89f2[_0x8cdd('0x46')]['id']}},_0x26182e={};_0x26182e[_0x8cdd('0x30')]=_[_0x8cdd('0x31')](db['UserProfile'][_0x8cdd('0x47')]);_0xd25e6c['attributes']=_['intersection'](_0x26182e[_0x8cdd('0x30')],qs[_0x8cdd('0x35')](_0x5d89f2['query'][_0x8cdd('0x35')]));_0xd25e6c[_0x8cdd('0x36')]=_0xd25e6c[_0x8cdd('0x36')][_0x8cdd('0x48')]?_0xd25e6c['attributes']:_0x26182e[_0x8cdd('0x30')];if(_0x5d89f2[_0x8cdd('0x32')]['includeAll']){_0xd25e6c[_0x8cdd('0x41')]=[{'all':!![]}];}_0xd25e6c=_[_0x8cdd('0x3e')]({},_0xd25e6c,_0x5d89f2['options']);return db[_0x8cdd('0x2e')][_0x8cdd('0x4b')](_0xd25e6c)['then'](handleEntityNotFound(_0x4604e3,null))[_0x8cdd('0x29')](function(_0x46bfaa){if(_0x46bfaa){var _0x30f8bc=_0x46bfaa['get']({'plain':!![]});_0x30f8bc=qs[_0x8cdd('0x4f')](_0x30f8bc,['id',_0x8cdd('0x50'),_0x8cdd('0x51'),_0x8cdd('0x52')]);_0x5d89f2[_0x8cdd('0x4d')]=_[_0x8cdd('0x4f')](_0x5d89f2['body'],['id',_0x8cdd('0x50'),_0x8cdd('0x51')]);return db[_0x8cdd('0x53')][_0x8cdd('0x54')](function(_0x3ff16c){return db['UserProfile'][_0x8cdd('0x4c')](_[_0x8cdd('0x3e')](_0x30f8bc,_0x5d89f2['body']),{'include':_0x5d89f2[_0x8cdd('0x32')][_0x8cdd('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x3ff16c})[_0x8cdd('0x29')](function(_0x42ad69){var _0x5bcf99=_0x42ad69[_0x8cdd('0x55')]({'plain':!![]});return db[_0x8cdd('0x56')][_0x8cdd('0x42')]({'where':{'userProfileId':_0x5d89f2['params']['id']},'raw':!![]})[_0x8cdd('0x29')](function(_0x26ce72){if(_0x26ce72){return BPromise[_0x8cdd('0x57')](_0x26ce72,function(_0x50f665){return new BPromise(function(_0x36781e,_0x2e5577){if(_0x50f665[_0x8cdd('0x58')]===null||_0x50f665[_0x8cdd('0x58')]===0x1)_0x36781e(null);return db['UserProfileResource'][_0x8cdd('0x42')]({'where':{'sectionId':_0x50f665['id']},'raw':!![]})[_0x8cdd('0x29')](function(_0x3cc762){var _0x2669c8=_['map'](_0x3cc762,function(_0x136aa3){return qs[_0x8cdd('0x4f')](_0x136aa3,['id',_0x8cdd('0x50'),'updatedAt','sectionId']);});_0x36781e(_0x2669c8);})[_0x8cdd('0x44')](function(_0x1af589){_0x2e5577(_0x1af589);});})['then'](function(_0x39c0e3){var _0x498a46=qs[_0x8cdd('0x4f')](_0x50f665,['id',_0x8cdd('0x50'),_0x8cdd('0x51')]);_0x498a46[_0x8cdd('0x59')]=_0x5bcf99['id'];if(_0x39c0e3)_0x498a46['Resources']=_0x39c0e3;return _0x498a46;})[_0x8cdd('0x29')](function(_0x2042c7){return db[_0x8cdd('0x56')][_0x8cdd('0x4c')](_0x2042c7,{'include':[{'model':db[_0x8cdd('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0x3ff16c});});})[_0x8cdd('0x29')](function(){return _0x5bcf99;});}});});});}})['then'](respondWithResult(_0x4604e3,0xc9))[_0x8cdd('0x44')](handleError(_0x4604e3,null));};exports['update']=function(_0x3590e9,_0x27df4c){if(_0x3590e9[_0x8cdd('0x4d')]['id']){delete _0x3590e9[_0x8cdd('0x4d')]['id'];}return db[_0x8cdd('0x2e')][_0x8cdd('0x4b')]({'where':{'id':_0x3590e9[_0x8cdd('0x46')]['id']}})[_0x8cdd('0x29')](handleEntityNotFound(_0x27df4c,null))[_0x8cdd('0x29')](saveUpdates(_0x3590e9[_0x8cdd('0x4d')],null))[_0x8cdd('0x29')](respondWithResult(_0x27df4c,null))[_0x8cdd('0x44')](handleError(_0x27df4c,null));};exports[_0x8cdd('0x2a')]=function(_0x48685a,_0xb0bdc6){return db[_0x8cdd('0x2e')][_0x8cdd('0x4b')]({'where':{'id':_0x48685a['params']['id']}})[_0x8cdd('0x29')](handleEntityNotFound(_0xb0bdc6,null))['then'](removeEntity(_0xb0bdc6,null))[_0x8cdd('0x44')](handleError(_0xb0bdc6,null));};exports[_0x8cdd('0x5b')]=function(_0xc34ebd,_0x320c39){return db[_0x8cdd('0x2e')][_0x8cdd('0x5b')]()['then'](respondWithResult(_0x320c39,null))[_0x8cdd('0x44')](handleError(_0x320c39,null));};exports[_0x8cdd('0x5c')]=function(_0x405787,_0x4bd742){var _0x33cc2e=_0x405787[_0x8cdd('0x4d')];return db[_0x8cdd('0x2e')][_0x8cdd('0x4b')]({'where':{'id':_0x405787[_0x8cdd('0x46')]['id']}})[_0x8cdd('0x29')](handleEntityNotFound(_0x4bd742,null))[_0x8cdd('0x29')](function(_0x5bd03b){if(_0x5bd03b){return db[_0x8cdd('0x53')]['transaction'](function(_0xef053e){return db[_0x8cdd('0x56')]['destroy']({'where':{'userProfileId':_0x405787['params']['id'],'sectionId':_['map'](_0x33cc2e,function(_0x6ce7d9){return _0x6ce7d9[_0x8cdd('0x5d')];})},'transaction':_0xef053e})[_0x8cdd('0x29')](function(){var _0xd52ea8=_[_0x8cdd('0x2d')](_0x33cc2e,function(_0x54937b){_0x54937b[_0x8cdd('0x59')]=_0x405787[_0x8cdd('0x46')]['id'];return _0x54937b;});var _0x242a4b=[];return BPromise[_0x8cdd('0x57')](_0xd52ea8,function(_0x4eca5e){return db[_0x8cdd('0x56')]['create'](_0x4eca5e,{'include':[{'model':db[_0x8cdd('0x5a')],'as':_0x8cdd('0x5e')}],'raw':!![],'transaction':_0xef053e})['then'](function(_0x3bb8a2){_0x242a4b[_0x8cdd('0x5f')](_0x3bb8a2['get']({'plain':!![]}));});})['then'](function(){return _0x242a4b;});});});}})[_0x8cdd('0x29')](function(_0x580f2f){return _0x580f2f;})[_0x8cdd('0x29')](respondWithResult(_0x4bd742,null))['catch'](handleError(_0x4bd742,null));};exports['removeSections']=function(_0x3a4796,_0x9efff5){var _0x38c9f4;return db[_0x8cdd('0x2e')][_0x8cdd('0x4b')]({'where':{'id':_0x3a4796[_0x8cdd('0x46')]['id']},'attributes':['id',_0x8cdd('0x2b')]})[_0x8cdd('0x29')](handleEntityNotFound(_0x9efff5,null))['then'](function(_0x169d1f){if(_0x169d1f){_0x38c9f4=_0x169d1f;return db[_0x8cdd('0x56')][_0x8cdd('0x2a')]({'where':{'userProfileId':_0x3a4796['params']['id'],'sectionId':_0x3a4796[_0x8cdd('0x32')][_0x8cdd('0x60')]}});}})[_0x8cdd('0x29')](function(){return _0x38c9f4;})[_0x8cdd('0x29')](respondWithStatusCode(_0x9efff5,null))[_0x8cdd('0x44')](handleError(_0x9efff5,null));};exports[_0x8cdd('0x61')]=function(_0x563095,_0x484b6a){var _0x5dfee8=[];var _0x2e2862=[];return db['UserProfileSection'][_0x8cdd('0x42')]({'where':{'userProfileId':_0x563095[_0x8cdd('0x46')]['id']},'raw':!![]})['then'](function(_0x302bf9){_0x5dfee8=_[_0x8cdd('0x3c')](_0x302bf9,function(_0xc52694){return _0xc52694['enabled']===0x1||_[_0x8cdd('0x62')]([0x3eb,0x709],_0xc52694[_0x8cdd('0x5d')]);});if(!_['isEmpty'](_0x5dfee8)){return _[_0x8cdd('0x2d')](_0x5dfee8,function(_0x2a0a36){return _0x2a0a36[_0x8cdd('0x5d')];});}else{return;}})['then'](function(_0x26082d){if(_0x26082d)_0x2e2862=_0x26082d;if(_[_0x8cdd('0x62')](_0x2e2862,0x64)){var _0x2ffccc=_[_0x8cdd('0x4b')](_0x5dfee8,{'sectionId':0x64});return hasDefaultDashboard(_0x2ffccc)[_0x8cdd('0x29')](function(_0x34529e){return _[_0x8cdd('0x2d')](_0x5dfee8,function(_0x39afbe){if(_0x39afbe[_0x8cdd('0x5d')]===0x64){_0x39afbe[_0x8cdd('0x63')]=_0x34529e;}return _0x39afbe;});});}else{return;}})[_0x8cdd('0x29')](function(_0xf5a5c6){if(_0xf5a5c6)_0x5dfee8=_0xf5a5c6;if(_[_0x8cdd('0x62')](_0x2e2862,0x3eb)){var _0x57d3fe=_[_0x8cdd('0x4b')](_0x5dfee8,{'sectionId':0x3eb});return getCustomDashboards(_0x57d3fe)['then'](function(_0x556e0c){return _[_0x8cdd('0x2d')](_0x5dfee8,function(_0x53c2ab){if(_0x57d3fe['enabled']){if(_0x53c2ab['sectionId']===0x3eb){_0x53c2ab[_0x8cdd('0x63')]=_0x556e0c;}}else{if(_0x53c2ab['sectionId']===0x64){if(!_0x53c2ab[_0x8cdd('0x63')]){_0x53c2ab[_0x8cdd('0x63')]=[];}_0x53c2ab['subsections']=_0x53c2ab[_0x8cdd('0x63')][_0x8cdd('0x64')](_0x556e0c);}}return _0x53c2ab;});});}else{return;}})['then'](function(_0xea6226){if(_0xea6226)_0x5dfee8=_0xea6226;if(_[_0x8cdd('0x62')](_0x2e2862,0x709)){var _0x3c3678=_[_0x8cdd('0x4b')](_0x5dfee8,{'sectionId':0x709});return getPlugins(_0x3c3678)[_0x8cdd('0x29')](function(_0x173f14){if(_0x3c3678[_0x8cdd('0x65')]){return _['map'](_0x5dfee8,function(_0x271309){if(_0x271309[_0x8cdd('0x5d')]===0x709){_0x271309['subsections']=_0x173f14;}return _0x271309;});}else{var _0x492da3={'sectionId':0x76c,'enabled':0x1,'subsections':_0x173f14};var _0x563985=_[_0x8cdd('0x2d')](_0x5dfee8);_0x563985[_0x8cdd('0x5f')](_0x492da3);return _0x563985;}});}else{return;}})[_0x8cdd('0x29')](function(_0x50b169){if(_0x50b169)_0x5dfee8=_0x50b169;return _['filter'](_0x5dfee8,['enabled',0x1]);})[_0x8cdd('0x29')](respondWithResult(_0x484b6a,null))['catch'](handleError(_0x484b6a,null));};function hasDefaultDashboard(_0x5520f7){var _0x2bed74=[0x65];return new BPromise(function(_0x5396ee,_0x4f6b18){try{if(_0x5520f7[_0x8cdd('0x58')]){_0x5396ee(_0x2bed74);}else{return db[_0x8cdd('0x5a')][_0x8cdd('0x66')]({'where':{'sectionId':_0x5520f7['id']},'raw':!![]})[_0x8cdd('0x29')](function(_0x45e200){_0x45e200?_0x5396ee(_0x2bed74):_0x5396ee();});}}catch(_0x339dd3){_0x4f6b18(_0x339dd3);}});}function getCustomDashboards(_0x25f64d){var _0x4a3b58=[];return new BPromise(function(_0x11829f,_0x51d25a){try{if(_0x25f64d[_0x8cdd('0x58')]){return db[_0x8cdd('0x67')]['findAll']({'raw':!![]})[_0x8cdd('0x29')](function(_0x50b8a5){_0x50b8a5['forEach'](function(_0x62807f){_0x4a3b58[_0x8cdd('0x5f')](_0x62807f['id']+0x1869f);});_0x11829f(_0x4a3b58);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x25f64d['id']},'raw':!![]})['then'](function(_0x53903b){_0x53903b[_0x8cdd('0x68')](function(_0x529474){_0x4a3b58[_0x8cdd('0x5f')](_0x529474[_0x8cdd('0x69')]+0x1869f);});_0x11829f(_0x4a3b58);});}}catch(_0x48aed2){_0x51d25a(_0x48aed2);}});}function getPlugins(_0x454650){var _0x358348=[];return new BPromise(function(_0x3bd318,_0x1af7b3){try{if(_0x454650['autoAssociation']){return db['Plugin'][_0x8cdd('0x42')]({'raw':!![]})['then'](function(_0x1fb9f6){_0x1fb9f6[_0x8cdd('0x68')](function(_0x5bcb0b){_0x358348[_0x8cdd('0x5f')](_0x5bcb0b['id']+0x15b38);});_0x3bd318(_0x358348);});}else{return db[_0x8cdd('0x5a')][_0x8cdd('0x42')]({'where':{'sectionId':_0x454650['id']},'raw':!![]})['then'](function(_0x494e2f){_0x494e2f['forEach'](function(_0x52d4b7){_0x358348[_0x8cdd('0x5f')](_0x52d4b7[_0x8cdd('0x69')]+0x15b38);});_0x3bd318(_0x358348);});}}catch(_0x2d3253){_0x1af7b3(_0x2d3253);}});}exports[_0x8cdd('0x6a')]=function(_0x4b9abb,_0x1c7bcf){return db[_0x8cdd('0x2e')]['find']({'where':{'id':_0x4b9abb['params']['id']}})[_0x8cdd('0x29')](handleEntityNotFound(_0x1c7bcf,null))['then'](function(_0xdc33da){if(_0xdc33da){return db[_0x8cdd('0x53')]['transaction'](function(_0x2b87b3){return db[_0x8cdd('0x56')][_0x8cdd('0x42')]({'where':{'userProfileId':_0x4b9abb[_0x8cdd('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0x8cdd('0x29')](function(_0x1fb1c4){if(_0x1fb1c4){return db[_0x8cdd('0x56')]['destroy']({'where':{'userProfileId':_0x4b9abb[_0x8cdd('0x46')]['id'],'id':_[_0x8cdd('0x2d')](_0x1fb1c4,function(_0x5da316){return _0x5da316['id'];})},'transaction':_0x2b87b3});}})[_0x8cdd('0x29')](function(_0x542d28){var _0xe4fe31=_[_0x8cdd('0x2d')](_0x4b9abb[_0x8cdd('0x4d')],function(_0x2ba1ae){_0x2ba1ae['userProfileId']=_0x4b9abb['params']['id'];return _0x2ba1ae;});return db[_0x8cdd('0x56')]['bulkCreate'](_0xe4fe31,{'raw':!![],'transaction':_0x2b87b3});})[_0x8cdd('0x29')](function(_0xf311dc){var _0x46dee9=_[_0x8cdd('0x3c')](_[_0x8cdd('0x2d')](_0xf311dc,function(_0x395412){return _0x395412[_0x8cdd('0x55')]({'plain':!![]});}),{'includeAll':![]});if(_0x46dee9){return db[_0x8cdd('0x56')][_0x8cdd('0x42')]({'where':{'userProfileId':_0x4b9abb[_0x8cdd('0x46')]['id'],'sectionId':_[_0x8cdd('0x2d')](_0x46dee9,function(_0x29f587){return _0x29f587[_0x8cdd('0x5d')];})},'attributes':['id',_0x8cdd('0x5d')],'raw':!![]})['then'](function(_0x5c6251){var _0x1cb445=_[_0x8cdd('0x2d')](_0x4b9abb[_0x8cdd('0x4d')],function(_0x1d3c6a){_0x1d3c6a[_0x8cdd('0x59')]=_0x4b9abb[_0x8cdd('0x46')]['id'];return _0x1d3c6a;});return db[_0x8cdd('0x5a')]['bulkCreate'](_0x1cb445,{'raw':!![],'transaction':_0x2b87b3});});}})[_0x8cdd('0x44')](handleError(_0x1c7bcf,null));});}})['then'](function(_0x540d50){var _0x13692c=_['map'](_0x540d50,function(_0x573230){return _0x573230[_0x8cdd('0x55')]({'plain':!![]});});})[_0x8cdd('0x29')](respondWithResult(_0x1c7bcf,null))[_0x8cdd('0x44')](handleError(_0x1c7bcf,null));};exports[_0x8cdd('0x6b')]=function(_0x25b03c,_0x3eab47,_0x5e2f0e){return db['UserProfile']['find']({'where':{'id':_0x25b03c['params']['id']}})[_0x8cdd('0x29')](handleEntityNotFound(_0x3eab47,null))[_0x8cdd('0x29')](function(_0x4e4d88){if(_0x4e4d88){return _0x4e4d88[_0x8cdd('0x6b')](_0x25b03c[_0x8cdd('0x32')][_0x8cdd('0x60')]);}})[_0x8cdd('0x29')](respondWithStatusCode(_0x3eab47,null))['catch'](handleError(_0x3eab47,null));};exports['getResources']=function(_0x392017,_0x31eead){var _0xc17f2={};if(!_0x392017[_0x8cdd('0x32')][_0x8cdd('0x6c')])throw new Error(_0x8cdd('0x6d'));if(!_0x392017[_0x8cdd('0x32')][_0x8cdd('0x37')](_0x8cdd('0x38'))){_0xc17f2[_0x8cdd('0x22')]=qs[_0x8cdd('0x22')](_0x392017[_0x8cdd('0x32')][_0x8cdd('0x22')]);_0xc17f2[_0x8cdd('0x1f')]=qs[_0x8cdd('0x1f')](_0x392017[_0x8cdd('0x32')][_0x8cdd('0x1f')]);}return db[_0x8cdd('0x2e')][_0x8cdd('0x4b')]({'where':{'id':_0x392017[_0x8cdd('0x46')]['id']}})[_0x8cdd('0x29')](function(_0x468cf1){if(!_0x468cf1)throw new Error(_0x8cdd('0x6e')+_0x392017[_0x8cdd('0x46')]['id']);return db[_0x8cdd('0x2e')][_0x8cdd('0x6f')](_0x392017);})[_0x8cdd('0x29')](respondWithFilteredResult(_0x31eead,_0xc17f2))[_0x8cdd('0x44')](handleError(_0x31eead,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index db5defe..3aa4512 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 _0xeda7=['../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xeda7,0x196));var _0x7eda=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xeda7[_0x1f36bb];return _0xaf97fa;};'use strict';var EventEmitter=require(_0x7eda('0x0'));var UserProfile=require(_0x7eda('0x1'))['db'][_0x7eda('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7eda('0x3')](0x0);var events={'afterCreate':_0x7eda('0x4'),'afterUpdate':_0x7eda('0x5'),'afterDestroy':_0x7eda('0x6')};function emitEvent(_0x2b1d21){return function(_0x324a25,_0x36a9f1,_0x15856b){UserProfileEvents[_0x7eda('0x7')](_0x2b1d21+':'+_0x324a25['id'],_0x324a25);UserProfileEvents[_0x7eda('0x7')](_0x2b1d21,_0x324a25);_0x15856b(null);};}for(var e in events){if(events[_0x7eda('0x8')](e)){var event=events[e];UserProfile[_0x7eda('0x9')](e,emitEvent(event));}}module[_0x7eda('0xa')]=UserProfileEvents; \ No newline at end of file +var _0xf417=['UserProfile','setMaxListeners','update','hasOwnProperty','exports','../../mysqldb'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xf417,0x8f));var _0x7f41=function(_0x310a23,_0x49f6b5){_0x310a23=_0x310a23-0x0;var _0x50fe57=_0xf417[_0x310a23];return _0x50fe57;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x7f41('0x0'))['db'][_0x7f41('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7f41('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7f41('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4c7081){return function(_0x2b7d4c,_0x5170ec,_0x51b0cb){UserProfileEvents['emit'](_0x4c7081+':'+_0x2b7d4c['id'],_0x2b7d4c);UserProfileEvents['emit'](_0x4c7081,_0x2b7d4c);_0x51b0cb(null);};}for(var e in events){if(events[_0x7f41('0x4')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x7f41('0x5')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index ba514e8..917dbff 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 _0x27dd=['reportId','DefaultReports','custom','count','rows','ids','extraQueryConditions','CmContact','include','Tag','Tags','tag','ThroughTags','true','chat','dataValues','fax','mail','whatsapp','lodash','models','field','filter','value','findAll','then','associatedResources','map','model','name','catch','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','SquareRecording','projectName','projects','contacts','parentSections','ListId','lists','CmList','companies','CmCompany','CmCustomField','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceContext','VoiceMail','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueues','VoiceQueue','inbound','queue','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailsubstatuses','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','extractedreports','Reports','AnalyticMetric','slice','QueryTypes','SELECT','select','ui.','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','reportType','default'];(function(_0x21b2c8,_0x30afbf){var _0x433d14=function(_0x3ffa6d){while(--_0x3ffa6d){_0x21b2c8['push'](_0x21b2c8['shift']());}};_0x433d14(++_0x30afbf);}(_0x27dd,0x183));var _0xd27d=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x27dd[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xd27d('0x0'));var attributes=require('./userProfile.attributes');var squel=require('squel');module['exports']=function(_0x1cb284){var _0xf7c1cb=_0x1cb284[_0xd27d('0x1')];function _0xbd9c43(_0x23dd57,_0x390cbc){return new Promise(function(_0x253830,_0x153c5d){if(!_0x390cbc)return _0x253830(null);var _0x26e8af=_0x390cbc['filter']?{[_0x390cbc['filter'][_0xd27d('0x2')]]:_0x390cbc[_0xd27d('0x3')][_0xd27d('0x4')]}:undefined;return _0xf7c1cb[_0x23dd57][_0xd27d('0x5')]({'where':_0x26e8af,'raw':!![]})[_0xd27d('0x6')](function(_0x299613){_0x390cbc[_0xd27d('0x7')]=_[_0xd27d('0x8')](_0x299613,'id');_0x253830(_0x390cbc);})['catch'](function(_0x1839e2){_0x153c5d(_0x1839e2);});});}function _0x368473(_0x3b9457,_0x1af7ef){return new Promise(function(_0x5d4463,_0x3508f8){var _0x12e584=_0x3b9457[_0xd27d('0x3')]?{[_0x3b9457[_0xd27d('0x3')]['field']]:_0x3b9457[_0xd27d('0x3')][_0xd27d('0x4')]}:undefined;return _0xf7c1cb[_0x3b9457[_0xd27d('0x9')]][_0xd27d('0x5')]({'where':_0x12e584,'raw':!![]})[_0xd27d('0x6')](function(_0xda4d35){_0x1af7ef['associatedResources']=_[_0xd27d('0x8')](_0xda4d35,function(_0x2b371c){return _0x2b371c[_0xd27d('0xa')];});_0x5d4463(_0x1af7ef);})[_0xd27d('0xb')](function(_0x47b00b){_0x3508f8(_0x47b00b);});});}function _0x55a0be(_0xf3e26f,_0x1d9788,_0x45250a){if(!_0x1d9788)return Promise['resolve'](null);return new Promise(function(_0x2f0534,_0x2f7847){return _0xf7c1cb['UserProfileResource']['findAll']({'where':{'sectionId':_0x1d9788['id']},'raw':!![]})[_0xd27d('0x6')](function(_0x14a449){if(_0xf3e26f['field']&&_0xf3e26f[_0xd27d('0x2')]!=='id'){_0x1d9788['associatedResources']=_[_0xd27d('0x8')](_0x14a449,function(_0x445108){return _0x445108[_0xf3e26f[_0xd27d('0x2')]];});}else{if(_0x45250a===_0xd27d('0xc')){_0x1d9788[_0xd27d('0x7')]=_[_0xd27d('0x8')](_0x14a449,function(_0xd458f1){return{'id':_0xd458f1[_0xd27d('0xd')],'type':_0xd458f1[_0xd27d('0xe')]};});}else{_0x1d9788[_0xd27d('0x7')]=_[_0xd27d('0x8')](_0x14a449,function(_0x393bd2){return _0x393bd2[_0xd27d('0xd')];});}}_0x2f0534(_0x1d9788);})['catch'](function(_0x3faa49){_0x2f7847(_0x3faa49);});});}function _0x13f3c5(_0x508039,_0x208a0d){var _0xcdeb86={'parentSections':[]};switch(_0x508039[_0xd27d('0xf')]()){case _0xd27d('0x10'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x12');break;case'odbc':_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x13');break;case'squarerecordings':_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x14');_0xcdeb86['parentSections']=[{'name':'SquareProjects','field':_0xd27d('0xa'),'foreignKey':_0xd27d('0x15')}];break;case _0xd27d('0x16'):_0xcdeb86[_0xd27d('0x11')]='JscriptyProject';break;case _0xd27d('0x17'):_0xcdeb86[_0xd27d('0x11')]='CmContact';_0xcdeb86[_0xd27d('0x18')]=[{'name':'Lists','field':'id','foreignKey':_0xd27d('0x19')}];break;case _0xd27d('0x1a'):_0xcdeb86['childModel']=_0xd27d('0x1b');break;case _0xd27d('0x1c'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x1d');break;case'globalcustomfields':_0xcdeb86['childModel']=_0xd27d('0x1e');break;case'chatqueues':_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x1f');break;case _0xd27d('0x20'):_0xcdeb86[_0xd27d('0x11')]='ChatWebsite';break;case _0xd27d('0x21'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x22');break;case _0xd27d('0x23'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x24');break;case _0xd27d('0x25'):case _0xd27d('0x26'):case _0xd27d('0x27'):_0xcdeb86[_0xd27d('0x11')]='VoiceExtension';break;case'contexts':_0xcdeb86['childModel']=_0xd27d('0x28');break;case'voicemails':_0xcdeb86['childModel']=_0xd27d('0x29');break;case'voicerecordings':_0xcdeb86['childModel']='VoiceRecording';_0xcdeb86[_0xd27d('0x18')]=[{'name':_0xd27d('0x2a'),'field':_0xd27d('0xa'),'foreignKey':_0xd27d('0x2b'),'model':_0xd27d('0x2c'),'filter':{'field':'role','value':[_0xd27d('0x2d')]}},{'name':_0xd27d('0x2e'),'field':_0xd27d('0xa'),'foreignKey':_0xd27d('0x2b'),'model':_0xd27d('0x2c'),'filter':{'field':_0xd27d('0x2f'),'value':[_0xd27d('0x30')]}},{'name':_0xd27d('0x31'),'field':'name','foreignKey':'queue','model':_0xd27d('0x32'),'filter':{'field':_0xd27d('0xe'),'value':[_0xd27d('0x33')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0xd27d('0x34'),'model':_0xd27d('0x32'),'filter':{'field':_0xd27d('0xe'),'value':[_0xd27d('0x35')]}}];break;case _0xd27d('0x36'):_0xcdeb86['childModel']=_0xd27d('0x37');break;case'chanspies':_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x38');break;case _0xd27d('0x39'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x3a');break;case'ivrcampaigns':_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x3b');break;case _0xd27d('0x3c'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x3d');break;case'mailaccounts':_0xcdeb86['childModel']='MailAccount';break;case _0xd27d('0x3e'):_0xcdeb86[_0xd27d('0x11')]='MailSubstatus';break;case'openchannelqueues':_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x3f');break;case _0xd27d('0x40'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x41');break;case _0xd27d('0x42'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x43');break;case _0xd27d('0x44'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x45');break;case _0xd27d('0x46'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x47');break;case'whatsappaccounts':_0xcdeb86['childModel']=_0xd27d('0x48');break;case _0xd27d('0x49'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x4a');break;case _0xd27d('0x4b'):case _0xd27d('0x4c'):_0xcdeb86['childModel']=_0xd27d('0x32');if(_0x208a0d){_0xcdeb86[_0xd27d('0x18')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0xd27d('0x4d'):case _0xd27d('0x4e'):case _0xd27d('0x4f'):_0xcdeb86[_0xd27d('0x11')]='User';if(_0x208a0d){_0xcdeb86[_0xd27d('0x18')]=[{'name':_0xd27d('0x50'),'filter':{'field':_0xd27d('0x2f'),'value':[_0xd27d('0x51'),_0xd27d('0x52')]},'ignore':!![]},{'name':'Agents'},{'name':_0xd27d('0x2e')}];}break;case _0xd27d('0x53'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x54');break;case'salesforceaccounts':_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x55');break;case _0xd27d('0x56'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x57');break;case'sugarcrmaccounts':_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x58');break;case _0xd27d('0x59'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x5a');break;case _0xd27d('0x5b'):_0xcdeb86[_0xd27d('0x11')]='ZohoAccount';break;case'vtigeraccounts':_0xcdeb86[_0xd27d('0x11')]='User';break;case _0xd27d('0x5c'):_0xcdeb86['childModel']=_0xd27d('0x5d');break;case'dispositions':_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x5e');break;case _0xd27d('0x5f'):_0xcdeb86[_0xd27d('0x11')]='Dashboard';break;case _0xd27d('0x60'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x61');break;case _0xd27d('0x62'):_0xcdeb86[_0xd27d('0x11')]='Pause';break;case _0xd27d('0x63'):_0xcdeb86['childModel']=_0xd27d('0x64');break;case _0xd27d('0x65'):_0xcdeb86['childModel']=_0xd27d('0x66');break;case _0xd27d('0x67'):_0xcdeb86['childModel']='Tag';break;case'templates':_0xcdeb86['childModel']=_0xd27d('0x68');break;case _0xd27d('0x69'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x6a');break;case _0xd27d('0x6b'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x6c');break;case'variables':_0xcdeb86['childModel']=_0xd27d('0x6d');break;case _0xd27d('0x6e'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x6f');break;case _0xd27d('0x70'):_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0xc');_0xcdeb86[_0xd27d('0x18')]=[{'name':_0xd27d('0x71'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0xcdeb86[_0xd27d('0x11')]=_0xd27d('0x72');break;}return _0xcdeb86;}function _0x2759fb(_0x502bf5,_0x5b3a27){var _0x10a5dc=_0x502bf5['charAt'](0x0)['toUpperCase']()+_0x502bf5[_0xd27d('0x73')](0x1);var _0x1fb181={'type':_0xf7c1cb['Sequelize'][_0xd27d('0x74')][_0xd27d('0x75')],'raw':!![]};return new Promise(function(_0x2484e6,_0x4d2321){var _0xc5137a=squel[_0xd27d('0x76')]()['field'](_0xd27d('0x77')+_0x10a5dc+'InteractionId','id')[_0xd27d('0x2')](_0xd27d('0x78'))[_0xd27d('0x79')](_0xd27d('0x7a')+_0x502bf5+_0xd27d('0x7b'),'ui')[_0xd27d('0x7c')](_0xd27d('0x7d'),_0x5b3a27['id']);return _0xf7c1cb[_0xd27d('0x7e')][_0xd27d('0x7f')](_0xc5137a['toString'](),_0x1fb181)[_0xd27d('0x6')](function(_0x493f19){_0x5b3a27[_0x10a5dc+_0xd27d('0x80')]=_0x493f19;_0x2484e6(_0x493f19);})[_0xd27d('0xb')](function(_0x10ffa3){_0x4d2321(_0x10ffa3);});});}return _0x1cb284[_0xd27d('0x81')](_0xd27d('0x82'),attributes,{'tableName':_0xd27d('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x28acf6){var _0x5bcb8c=require(_0xd27d('0x84'));var _0x112cb1={'raw':_0x28acf6['query']['raw'],'where':{}};var _0x490e05={};var _0x46d9ed={'count':0x0,'rows':[]};var _0x88da3d=_0x28acf6[_0xd27d('0x7f')][_0xd27d('0x85')];var _0x15fc3a=_0x28acf6[_0xd27d('0x7f')]['mergeResources']||![];var _0x3ea2f1=_0x13f3c5(_0x88da3d,_0x15fc3a);if(!_0x3ea2f1[_0xd27d('0x11')])throw new Error(_0xd27d('0x86')+_0x88da3d+'\x27');var _0x24fef2=[{'name':_0x88da3d}];if(!_[_0xd27d('0x87')](_0x3ea2f1[_0xd27d('0x18')]))_0x24fef2=_0x3ea2f1['parentSections'];var _0x5df23e=[];for(var _0x94c94d=0x0;_0x94c94d<_0x24fef2[_0xd27d('0x88')];_0x94c94d++){_0x5df23e[_0xd27d('0x89')](_0xf7c1cb[_0xd27d('0x8a')][_0xd27d('0x8b')]({'where':{'userProfileId':_0x28acf6[_0xd27d('0x8c')]['id'],'name':_0x24fef2[_0x94c94d][_0xd27d('0xa')]},'raw':!![]}));}return Promise[_0xd27d('0x8d')](_0x5df23e)['then'](function(_0x141a3a){var _0x5c50c2=_['filter'](_0x141a3a,function(_0x49586b){return _0x49586b?_0x49586b:undefined;});var _0x2aa85d=_[_0xd27d('0x3')](_0x24fef2,[_0xd27d('0x8e'),!![]]);var _0x50e034=_['isEmpty'](_0x5c50c2)&&_[_0xd27d('0x87')](_0x2aa85d)?null:_[_0xd27d('0x8f')](_0x2aa85d,_0x5c50c2);if(!_0x50e034)return null;var _0x43e7e3=[];for(var _0x31a2f1=0x0;_0x31a2f1<_0x50e034['length'];_0x31a2f1++){var _0x4f4f4a=_[_0xd27d('0x8b')](_0x24fef2,function(_0x100248){return _0x50e034[_0x31a2f1]?_0x100248[_0xd27d('0xa')]===_0x50e034[_0x31a2f1][_0xd27d('0xa')]:null;});if(_0x4f4f4a){if(_0x50e034[_0x31a2f1][_0xd27d('0x8e')]){_0x43e7e3[_0xd27d('0x89')](_0xbd9c43(_0x3ea2f1[_0xd27d('0x11')],_0x50e034[_0x31a2f1]));}else{if(!_0x50e034[_0x31a2f1][_0xd27d('0x90')]){_0x43e7e3['push'](_0x55a0be(_0x4f4f4a,_0x50e034[_0x31a2f1],_0x3ea2f1['childModel']));}else{if(_0x4f4f4a['model']){_0x43e7e3[_0xd27d('0x89')](_0x368473(_0x4f4f4a,_0x50e034[_0x31a2f1]));}}}}}return Promise[_0xd27d('0x8d')](_0x43e7e3);})['then'](function(_0xdf34b1){var _0x2d5396=_0xdf34b1;var _0x3148a3=null;if(_0x2d5396){_0x3148a3=_0x2d5396[_0xd27d('0x88')]===0x1?_0x2d5396[0x0]:null;}if(!_0x3148a3&&!_0x2d5396)return _0x46d9ed;var _0x56a97d=_0xf7c1cb[_0x3ea2f1['childModel']]['rawAttributes'];_0x490e05[_0xd27d('0x9')]=_['keys'](_0x56a97d);_0x490e05[_0xd27d('0x7f')]=_[_0xd27d('0x91')](_0x28acf6[_0xd27d('0x7f')]);_0x490e05[_0xd27d('0x92')]=_[_0xd27d('0x93')](_0x490e05[_0xd27d('0x9')],_0x490e05[_0xd27d('0x7f')]);_0x112cb1[_0xd27d('0x94')]=_[_0xd27d('0x93')](_0x490e05['model'],_0x5bcb8c[_0xd27d('0x95')](_0x28acf6[_0xd27d('0x7f')][_0xd27d('0x95')]));_0x112cb1['attributes']=_0x112cb1[_0xd27d('0x94')][_0xd27d('0x88')]?_0x112cb1[_0xd27d('0x94')]:_0x490e05[_0xd27d('0x9')];if(!_0x28acf6[_0xd27d('0x7f')][_0xd27d('0x96')](_0xd27d('0x97'))){_0x112cb1[_0xd27d('0x98')]=_0x5bcb8c[_0xd27d('0x98')](_0x28acf6[_0xd27d('0x7f')]['limit']);_0x112cb1[_0xd27d('0x99')]=_0x5bcb8c[_0xd27d('0x99')](_0x28acf6['query'][_0xd27d('0x99')]);}_0x112cb1[_0xd27d('0x9a')]=_0x5bcb8c[_0xd27d('0x9b')](_0x28acf6[_0xd27d('0x7f')][_0xd27d('0x9b')]);_0x112cb1[_0xd27d('0x7c')]=_0x5bcb8c[_0xd27d('0x92')](_['pick'](_0x28acf6['query'],_0x490e05['filters']));if(_0x28acf6[_0xd27d('0x7f')][_0xd27d('0x3')]){_0x112cb1[_0xd27d('0x7c')]=_[_0xd27d('0x9c')](_0x112cb1[_0xd27d('0x7c')],{'$or':_['map'](_0x56a97d,function(_0x88449){if(_0x88449['type'][_0xd27d('0x9d')]!==_0xd27d('0x9e')){var _0x231b93={};_0x231b93[_0x88449[_0xd27d('0x2')]]={'$like':'%'+_0x28acf6[_0xd27d('0x7f')][_0xd27d('0x3')]+'%'};return _0x231b93;}})});}var _0x4cb06e=[];var _0x552a17=null;var _0x13a58f={};if(_0x3148a3){_0x552a17=_[_0xd27d('0x8b')](_0x24fef2,['name',_0x3148a3['name']]);if(_0x552a17[_0xd27d('0x2')]){_0x13a58f={};if(_0x3ea2f1['childModel']===_0xd27d('0xc')){_0x13a58f[_0x552a17['foreignKey']]=_['map'](_0x3148a3[_0xd27d('0x7')],'id');}else{_0x13a58f[_0x552a17[_0xd27d('0x9f')]]=_0x3148a3['associatedResources'];}_0x4cb06e[_0xd27d('0x89')](_0x13a58f);}else{_0x112cb1['where']['id']=_0x3148a3['associatedResources'];}}else{for(var _0x46a22b=0x0;_0x46a22b<_0x2d5396['length'];_0x46a22b++){_0x552a17=_[_0xd27d('0x8b')](_0x24fef2,[_0xd27d('0xa'),_0x2d5396[_0x46a22b][_0xd27d('0xa')]]);if(_0x552a17[_0xd27d('0x2')]){_0x13a58f={};_0x13a58f[_0x552a17[_0xd27d('0x9f')]]=_0x2d5396[_0x46a22b]['associatedResources'];_0x4cb06e[_0xd27d('0x89')](_0x13a58f);}else{if(!_0x112cb1['where']['id'])_0x112cb1[_0xd27d('0x7c')]['id']=[];_0x2d5396[_0x46a22b][_0xd27d('0x7')][_0xd27d('0xa0')](function(_0x176599){_0x112cb1['where']['id']['push'](_0x176599);});}}}if(!_[_0xd27d('0x87')](_0x4cb06e)){_0x112cb1['where']=_[_0xd27d('0x9c')](_0x112cb1[_0xd27d('0x7c')],{'$and':{'$or':_0x4cb06e}});}_0x112cb1=_[_0xd27d('0x9c')]({},_0x112cb1,_0x28acf6[_0xd27d('0xa1')]);if(_0x3148a3&&!_0x3148a3[_0xd27d('0x90')]&&_0x3ea2f1[_0xd27d('0x11')]===_0xd27d('0xc')){if(_0x28acf6[_0xd27d('0x7f')][_0xd27d('0xa2')]){_0x112cb1['include']=[{'all':!![]}];}return _0xf7c1cb[_0x3ea2f1[_0xd27d('0x11')]][_0xd27d('0x5')](_0x112cb1)[_0xd27d('0x6')](function(_0x3921a1){var _0x95cf10=[];_0x3921a1[_0xd27d('0xa0')](function(_0x27f654){var _0x2d86bc;switch(_0x27f654[_0xd27d('0xa3')]){case _0xd27d('0xa4'):_0x2d86bc=_[_0xd27d('0x8b')](_0x3148a3[_0xd27d('0x7')],function(_0x3ad8c8){return _0x3ad8c8['id']===_0x27f654[_0xd27d('0xa5')]&&_0x3ad8c8['type']===_0xd27d('0xa6');});break;case _0xd27d('0xa7'):_0x2d86bc=_[_0xd27d('0x8b')](_0x3148a3[_0xd27d('0x7')],function(_0x59616b){return _0x59616b['id']===_0x27f654[_0xd27d('0xa5')]&&_0x59616b[_0xd27d('0xe')]==='CustomReports';});break;}if(_0x2d86bc)_0x95cf10[_0xd27d('0x89')](_0x27f654);});_0x46d9ed[_0xd27d('0xa8')]=_0x95cf10['length'];_0x46d9ed[_0xd27d('0xa9')]=_0x95cf10;return _0x46d9ed;});}else{if(!_[_0xd27d('0x87')](_0x28acf6[_0xd27d('0x7f')][_0xd27d('0xaa')])){_0x112cb1['where']['id']=_0x112cb1[_0xd27d('0x7c')]['id']?_['intersection'](_0x112cb1['where']['id'],_0x28acf6[_0xd27d('0x7f')][_0xd27d('0xaa')]):_0x28acf6[_0xd27d('0x7f')][_0xd27d('0xaa')];if(_0x28acf6[_0xd27d('0x7f')]['customSorting']){_0x112cb1[_0xd27d('0x9a')]=_0x28acf6[_0xd27d('0x7f')]['customSorting'];}}if(_0x28acf6[_0xd27d('0x7f')][_0xd27d('0xab')]){_0x112cb1['where']=_[_0xd27d('0x9c')](_0x112cb1[_0xd27d('0x7c')],{'$and':_0x28acf6['query']['extraQueryConditions']});}return _0xf7c1cb[_0x3ea2f1[_0xd27d('0x11')]][_0xd27d('0xa8')]({'where':_0x112cb1[_0xd27d('0x7c')]})['then'](function(_0x1545cd){_0x46d9ed['count']=_0x1545cd;if(_0x28acf6[_0xd27d('0x7f')]['includeAll']){if(_0x3ea2f1[_0xd27d('0x11')]===_0xd27d('0xac')){_0x112cb1[_0xd27d('0xad')]=[{'model':_0xf7c1cb[_0xd27d('0xae')],'as':_0xd27d('0xaf'),'attributes':['id',_0xd27d('0xa'),'color'],'required':_0x28acf6[_0xd27d('0x7f')][_0xd27d('0xb0')]?!![]:![]},{'model':_0xf7c1cb[_0xd27d('0xae')],'as':_0xd27d('0xb1'),'attributes':['id','name','color'],'through':_0x28acf6[_0xd27d('0x7f')][_0xd27d('0xb0')]?{'attributes':[],'where':{'TagId':_0x28acf6['query'][_0xd27d('0xb0')]||undefined}}:{},'required':_0x28acf6['query'][_0xd27d('0xb0')]?!![]:![]}];}else{_0x112cb1[_0xd27d('0xad')]=[{'all':!![]}];}}return _0xf7c1cb[_0x3ea2f1[_0xd27d('0x11')]][_0xd27d('0x5')](_0x112cb1);})[_0xd27d('0x6')](function(_0x224fa4){_0x46d9ed[_0xd27d('0xa9')]=_0x224fa4;if(_0x88da3d==='Agents'&&_0x28acf6[_0xd27d('0x7f')]['openTabs']===_0xd27d('0xb2')){var _0x5d1746=[];for(var _0x2bf800=0x0;_0x2bf800<_0x46d9ed[_0xd27d('0xa9')][_0xd27d('0x88')];_0x2bf800++){_0x5d1746[_0xd27d('0x89')](_0x2759fb(_0xd27d('0xb3'),_0x46d9ed['rows'][_0x2bf800][_0xd27d('0xb4')]));_0x5d1746[_0xd27d('0x89')](_0x2759fb('sms',_0x46d9ed[_0xd27d('0xa9')][_0x2bf800][_0xd27d('0xb4')]));_0x5d1746[_0xd27d('0x89')](_0x2759fb(_0xd27d('0xb5'),_0x46d9ed['rows'][_0x2bf800][_0xd27d('0xb4')]));_0x5d1746[_0xd27d('0x89')](_0x2759fb(_0xd27d('0xb6'),_0x46d9ed[_0xd27d('0xa9')][_0x2bf800][_0xd27d('0xb4')]));_0x5d1746[_0xd27d('0x89')](_0x2759fb('openchannel',_0x46d9ed['rows'][_0x2bf800][_0xd27d('0xb4')]));_0x5d1746[_0xd27d('0x89')](_0x2759fb(_0xd27d('0xb7'),_0x46d9ed[_0xd27d('0xa9')][_0x2bf800][_0xd27d('0xb4')]));}return Promise[_0xd27d('0x8d')](_0x5d1746)[_0xd27d('0x6')](function(){return _0x46d9ed;});}return _0x46d9ed;});}});}}});}; \ No newline at end of file +var _0xeef5=['sort','pick','merge','key','VIRTUAL','foreignKey','options','includeAll','include','forEach','reportType','reportId','DefaultReports','custom','rows','ids','customSorting','extraQueryConditions','count','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','lodash','squel','exports','filter','field','value','findAll','associatedResources','catch','map','name','resolve','UserProfileResource','then','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','SquareProject','odbc','childModel','squarerecordings','SquareRecording','parentSections','projectName','contacts','CmContact','ListId','companies','globalcustomfields','CmCustomField','ChatWebsite','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','queuecampaigns','users','agents','telephones','Users','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','Disposition','intervals','Interval','Pause','scheduler','sounds','Tag','templates','triggers','Trigger','trunks','Trunk','variables','Plugin','extractedreports','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','OpenTabs','UserProfile','user_profiles','../../components/parsers/qs','query','section','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','isEmpty','ignore','autoAssociation','model','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order'];(function(_0x303030,_0x2c9147){var _0x66efd9=function(_0x3b223a){while(--_0x3b223a){_0x303030['push'](_0x303030['shift']());}};_0x66efd9(++_0x2c9147);}(_0xeef5,0xd4));var _0x5eef=function(_0x524a2c,_0x1f3f47){_0x524a2c=_0x524a2c-0x0;var _0x33df0b=_0xeef5[_0x524a2c];return _0x33df0b;};'use strict';var _=require(_0x5eef('0x0'));var attributes=require('./userProfile.attributes');var squel=require(_0x5eef('0x1'));module[_0x5eef('0x2')]=function(_0x52b982){var _0x23929f=_0x52b982['models'];function _0x2841b0(_0x3c92c7,_0x10b13e){return new Promise(function(_0x128c6d,_0x1ce3e8){if(!_0x10b13e)return _0x128c6d(null);var _0x1ca474=_0x10b13e[_0x5eef('0x3')]?{[_0x10b13e[_0x5eef('0x3')][_0x5eef('0x4')]]:_0x10b13e[_0x5eef('0x3')][_0x5eef('0x5')]}:undefined;return _0x23929f[_0x3c92c7][_0x5eef('0x6')]({'where':_0x1ca474,'raw':!![]})['then'](function(_0x3d84c9){_0x10b13e[_0x5eef('0x7')]=_['map'](_0x3d84c9,'id');_0x128c6d(_0x10b13e);})[_0x5eef('0x8')](function(_0x71d6a){_0x1ce3e8(_0x71d6a);});});}function _0x1cc30a(_0x52d5ee,_0x3592bb){return new Promise(function(_0xfad42b,_0x3e8ef3){var _0x5dd49c=_0x52d5ee['filter']?{[_0x52d5ee['filter'][_0x5eef('0x4')]]:_0x52d5ee[_0x5eef('0x3')][_0x5eef('0x5')]}:undefined;return _0x23929f[_0x52d5ee['model']][_0x5eef('0x6')]({'where':_0x5dd49c,'raw':!![]})['then'](function(_0x4526a0){_0x3592bb['associatedResources']=_[_0x5eef('0x9')](_0x4526a0,function(_0x5bfcb1){return _0x5bfcb1[_0x5eef('0xa')];});_0xfad42b(_0x3592bb);})[_0x5eef('0x8')](function(_0x5f1f84){_0x3e8ef3(_0x5f1f84);});});}function _0x515de3(_0x135f33,_0x5063e0,_0x3263a7){if(!_0x5063e0)return Promise[_0x5eef('0xb')](null);return new Promise(function(_0x5caa21,_0x5acd27){return _0x23929f[_0x5eef('0xc')]['findAll']({'where':{'sectionId':_0x5063e0['id']},'raw':!![]})[_0x5eef('0xd')](function(_0x20c275){if(_0x135f33[_0x5eef('0x4')]&&_0x135f33[_0x5eef('0x4')]!=='id'){_0x5063e0[_0x5eef('0x7')]=_[_0x5eef('0x9')](_0x20c275,function(_0x1aeb64){return _0x1aeb64[_0x135f33['field']];});}else{if(_0x3263a7===_0x5eef('0xe')){_0x5063e0[_0x5eef('0x7')]=_[_0x5eef('0x9')](_0x20c275,function(_0xe7ed6f){return{'id':_0xe7ed6f['resourceId'],'type':_0xe7ed6f[_0x5eef('0xf')]};});}else{_0x5063e0['associatedResources']=_['map'](_0x20c275,function(_0x2d9d4a){return _0x2d9d4a[_0x5eef('0x10')];});}}_0x5caa21(_0x5063e0);})[_0x5eef('0x8')](function(_0x152b3b){_0x5acd27(_0x152b3b);});});}function _0x1ffeb9(_0x6eeb0e,_0x1b55da){var _0x42cdde={'parentSections':[]};switch(_0x6eeb0e[_0x5eef('0x11')]()){case _0x5eef('0x12'):_0x42cdde['childModel']=_0x5eef('0x13');break;case _0x5eef('0x14'):_0x42cdde[_0x5eef('0x15')]='SquareOdbc';break;case _0x5eef('0x16'):_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x17');_0x42cdde[_0x5eef('0x18')]=[{'name':'SquareProjects','field':_0x5eef('0xa'),'foreignKey':_0x5eef('0x19')}];break;case'projects':_0x42cdde[_0x5eef('0x15')]='JscriptyProject';break;case _0x5eef('0x1a'):_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x1b');_0x42cdde['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0x5eef('0x1c')}];break;case'lists':_0x42cdde[_0x5eef('0x15')]='CmList';break;case _0x5eef('0x1d'):_0x42cdde[_0x5eef('0x15')]='CmCompany';break;case _0x5eef('0x1e'):_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x1f');break;case'chatqueues':_0x42cdde['childModel']='ChatQueue';break;case'chatwebsites':_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x20');break;case'faxqueues':_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x21');break;case'faxaccounts':_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x22');break;case _0x5eef('0x23'):case _0x5eef('0x24'):case _0x5eef('0x25'):_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x26');break;case _0x5eef('0x27'):_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x28');break;case'voicemails':_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x29');break;case _0x5eef('0x2a'):_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x2b');_0x42cdde[_0x5eef('0x18')]=[{'name':_0x5eef('0x2c'),'field':_0x5eef('0xa'),'foreignKey':'membername','model':_0x5eef('0x2d'),'filter':{'field':_0x5eef('0x2e'),'value':[_0x5eef('0x2f')]}},{'name':_0x5eef('0x30'),'field':'name','foreignKey':'membername','model':_0x5eef('0x2d'),'filter':{'field':_0x5eef('0x2e'),'value':['telephone']}},{'name':_0x5eef('0x31'),'field':'name','foreignKey':_0x5eef('0x32'),'model':_0x5eef('0x33'),'filter':{'field':'type','value':[_0x5eef('0x34')]}},{'name':_0x5eef('0x35'),'field':'name','foreignKey':_0x5eef('0x32'),'model':_0x5eef('0x33'),'filter':{'field':_0x5eef('0xf'),'value':[_0x5eef('0x36')]}}];break;case _0x5eef('0x37'):_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x38');break;case _0x5eef('0x39'):_0x42cdde[_0x5eef('0x15')]='VoiceChanSpy';break;case _0x5eef('0x3a'):_0x42cdde['childModel']=_0x5eef('0x3b');break;case _0x5eef('0x3c'):_0x42cdde['childModel']='Campaign';break;case'mailqueues':_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x3d');break;case _0x5eef('0x3e'):_0x42cdde[_0x5eef('0x15')]='MailAccount';break;case'mailsubstatuses':_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x3f');break;case _0x5eef('0x40'):_0x42cdde['childModel']='OpenchannelQueue';break;case _0x5eef('0x41'):_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x42');break;case _0x5eef('0x43'):_0x42cdde[_0x5eef('0x15')]='SmsQueue';break;case'smsaccounts':_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x44');break;case _0x5eef('0x45'):_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x46');break;case _0x5eef('0x47'):_0x42cdde[_0x5eef('0x15')]='WhatsappAccount';break;case _0x5eef('0x48'):_0x42cdde['childModel']=_0x5eef('0x49');break;case'voicequeues':case _0x5eef('0x4a'):_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x33');if(_0x1b55da){_0x42cdde[_0x5eef('0x18')]=[{'name':_0x5eef('0x31')},{'name':_0x5eef('0x35')}];}break;case _0x5eef('0x4b'):case _0x5eef('0x4c'):case _0x5eef('0x4d'):_0x42cdde['childModel']=_0x5eef('0x2d');if(_0x1b55da){_0x42cdde[_0x5eef('0x18')]=[{'name':_0x5eef('0x4e'),'filter':{'field':_0x5eef('0x2e'),'value':['admin',_0x5eef('0x4f')]},'ignore':!![]},{'name':_0x5eef('0x2c')},{'name':_0x5eef('0x30')}];}break;case _0x5eef('0x50'):_0x42cdde['childModel']='ZendeskAccount';break;case _0x5eef('0x51'):_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x52');break;case _0x5eef('0x53'):_0x42cdde[_0x5eef('0x15')]='FreshdeskAccount';break;case _0x5eef('0x54'):_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x55');break;case'deskaccounts':_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x56');break;case'zohoaccounts':_0x42cdde['childModel']=_0x5eef('0x57');break;case _0x5eef('0x58'):_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x2d');break;case _0x5eef('0x59'):_0x42cdde['childModel']='CannedAnswer';break;case'dispositions':_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x5a');break;case'customdashboards':_0x42cdde[_0x5eef('0x15')]='Dashboard';break;case _0x5eef('0x5b'):_0x42cdde['childModel']=_0x5eef('0x5c');break;case'pauses':_0x42cdde['childModel']=_0x5eef('0x5d');break;case _0x5eef('0x5e'):_0x42cdde[_0x5eef('0x15')]='Schedule';break;case _0x5eef('0x5f'):_0x42cdde['childModel']='Sound';break;case'tags':_0x42cdde['childModel']=_0x5eef('0x60');break;case _0x5eef('0x61'):_0x42cdde[_0x5eef('0x15')]='Template';break;case _0x5eef('0x62'):_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x63');break;case _0x5eef('0x64'):_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x65');break;case _0x5eef('0x66'):_0x42cdde['childModel']='Variable';break;case'plugins':_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x67');break;case _0x5eef('0x68'):_0x42cdde[_0x5eef('0x15')]=_0x5eef('0xe');_0x42cdde[_0x5eef('0x18')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x5eef('0x69'):_0x42cdde[_0x5eef('0x15')]=_0x5eef('0x6a');break;}return _0x42cdde;}function _0x24e9a6(_0x345211,_0x433a6c){var _0xcb5d9c=_0x345211[_0x5eef('0x6b')](0x0)[_0x5eef('0x6c')]()+_0x345211[_0x5eef('0x6d')](0x1);var _0x297433={'type':_0x23929f[_0x5eef('0x6e')][_0x5eef('0x6f')][_0x5eef('0x70')],'raw':!![]};return new Promise(function(_0x30040b,_0x3f1c98){var _0x5017db=squel[_0x5eef('0x71')]()[_0x5eef('0x4')](_0x5eef('0x72')+_0xcb5d9c+_0x5eef('0x73'),'id')['field'](_0x5eef('0x74'))[_0x5eef('0x75')](_0x5eef('0x76')+_0x345211+_0x5eef('0x77'),'ui')[_0x5eef('0x78')](_0x5eef('0x79'),_0x433a6c['id']);return _0x23929f[_0x5eef('0x7a')]['query'](_0x5017db['toString'](),_0x297433)[_0x5eef('0xd')](function(_0x379e34){_0x433a6c[_0xcb5d9c+_0x5eef('0x7b')]=_0x379e34;_0x30040b(_0x379e34);})[_0x5eef('0x8')](function(_0x137fc6){_0x3f1c98(_0x137fc6);});});}return _0x52b982['define'](_0x5eef('0x7c'),attributes,{'tableName':_0x5eef('0x7d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xd49bcd){var _0x23a4db=require(_0x5eef('0x7e'));var _0xec1270={'raw':_0xd49bcd[_0x5eef('0x7f')]['raw'],'where':{}};var _0x2989b2={};var _0x3a6468={'count':0x0,'rows':[]};var _0x57ade8=_0xd49bcd[_0x5eef('0x7f')][_0x5eef('0x80')];var _0x39ef32=_0xd49bcd[_0x5eef('0x7f')]['mergeResources']||![];var _0x652394=_0x1ffeb9(_0x57ade8,_0x39ef32);if(!_0x652394['childModel'])throw new Error(_0x5eef('0x81')+_0x57ade8+'\x27');var _0x484827=[{'name':_0x57ade8}];if(!_['isEmpty'](_0x652394[_0x5eef('0x18')]))_0x484827=_0x652394[_0x5eef('0x18')];var _0x3d3fa7=[];for(var _0x4101d2=0x0;_0x4101d2<_0x484827[_0x5eef('0x82')];_0x4101d2++){_0x3d3fa7[_0x5eef('0x83')](_0x23929f[_0x5eef('0x84')][_0x5eef('0x85')]({'where':{'userProfileId':_0xd49bcd[_0x5eef('0x86')]['id'],'name':_0x484827[_0x4101d2]['name']},'raw':!![]}));}return Promise['all'](_0x3d3fa7)[_0x5eef('0xd')](function(_0x21dc89){var _0xebc45a=_['filter'](_0x21dc89,function(_0x266aca){return _0x266aca?_0x266aca:undefined;});var _0x481e95=_['filter'](_0x484827,['ignore',!![]]);var _0x53d9fa=_[_0x5eef('0x87')](_0xebc45a)&&_[_0x5eef('0x87')](_0x481e95)?null:_['union'](_0x481e95,_0xebc45a);if(!_0x53d9fa)return null;var _0x40da54=[];for(var _0x27c8aa=0x0;_0x27c8aa<_0x53d9fa[_0x5eef('0x82')];_0x27c8aa++){var _0x27c117=_[_0x5eef('0x85')](_0x484827,function(_0x3baf93){return _0x53d9fa[_0x27c8aa]?_0x3baf93[_0x5eef('0xa')]===_0x53d9fa[_0x27c8aa][_0x5eef('0xa')]:null;});if(_0x27c117){if(_0x53d9fa[_0x27c8aa][_0x5eef('0x88')]){_0x40da54[_0x5eef('0x83')](_0x2841b0(_0x652394[_0x5eef('0x15')],_0x53d9fa[_0x27c8aa]));}else{if(!_0x53d9fa[_0x27c8aa][_0x5eef('0x89')]){_0x40da54[_0x5eef('0x83')](_0x515de3(_0x27c117,_0x53d9fa[_0x27c8aa],_0x652394[_0x5eef('0x15')]));}else{if(_0x27c117[_0x5eef('0x8a')]){_0x40da54[_0x5eef('0x83')](_0x1cc30a(_0x27c117,_0x53d9fa[_0x27c8aa]));}}}}}return Promise['all'](_0x40da54);})['then'](function(_0xb04757){var _0x59f2e4=_0xb04757;var _0x406a2a=null;if(_0x59f2e4){_0x406a2a=_0x59f2e4['length']===0x1?_0x59f2e4[0x0]:null;}if(!_0x406a2a&&!_0x59f2e4)return _0x3a6468;var _0x354866=_0x23929f[_0x652394[_0x5eef('0x15')]][_0x5eef('0x8b')];_0x2989b2[_0x5eef('0x8a')]=_[_0x5eef('0x8c')](_0x354866);_0x2989b2[_0x5eef('0x7f')]=_['keys'](_0xd49bcd[_0x5eef('0x7f')]);_0x2989b2[_0x5eef('0x8d')]=_[_0x5eef('0x8e')](_0x2989b2[_0x5eef('0x8a')],_0x2989b2[_0x5eef('0x7f')]);_0xec1270[_0x5eef('0x8f')]=_[_0x5eef('0x8e')](_0x2989b2[_0x5eef('0x8a')],_0x23a4db[_0x5eef('0x90')](_0xd49bcd['query']['fields']));_0xec1270[_0x5eef('0x8f')]=_0xec1270[_0x5eef('0x8f')][_0x5eef('0x82')]?_0xec1270[_0x5eef('0x8f')]:_0x2989b2[_0x5eef('0x8a')];if(!_0xd49bcd[_0x5eef('0x7f')][_0x5eef('0x91')](_0x5eef('0x92'))){_0xec1270[_0x5eef('0x93')]=_0x23a4db[_0x5eef('0x93')](_0xd49bcd['query']['limit']);_0xec1270[_0x5eef('0x94')]=_0x23a4db[_0x5eef('0x94')](_0xd49bcd[_0x5eef('0x7f')][_0x5eef('0x94')]);}_0xec1270[_0x5eef('0x95')]=_0x23a4db['sort'](_0xd49bcd[_0x5eef('0x7f')][_0x5eef('0x96')]);_0xec1270['where']=_0x23a4db[_0x5eef('0x8d')](_[_0x5eef('0x97')](_0xd49bcd[_0x5eef('0x7f')],_0x2989b2['filters']));if(_0xd49bcd[_0x5eef('0x7f')][_0x5eef('0x3')]){_0xec1270[_0x5eef('0x78')]=_[_0x5eef('0x98')](_0xec1270[_0x5eef('0x78')],{'$or':_[_0x5eef('0x9')](_0x354866,function(_0x472fb8){if(_0x472fb8[_0x5eef('0xf')][_0x5eef('0x99')]!==_0x5eef('0x9a')){var _0x2e0d0e={};_0x2e0d0e[_0x472fb8['field']]={'$like':'%'+_0xd49bcd[_0x5eef('0x7f')][_0x5eef('0x3')]+'%'};return _0x2e0d0e;}})});}var _0x30e429=[];var _0x5b996c=null;var _0x40c89f={};if(_0x406a2a){_0x5b996c=_[_0x5eef('0x85')](_0x484827,['name',_0x406a2a[_0x5eef('0xa')]]);if(_0x5b996c[_0x5eef('0x4')]){_0x40c89f={};if(_0x652394['childModel']===_0x5eef('0xe')){_0x40c89f[_0x5b996c[_0x5eef('0x9b')]]=_[_0x5eef('0x9')](_0x406a2a['associatedResources'],'id');}else{_0x40c89f[_0x5b996c[_0x5eef('0x9b')]]=_0x406a2a[_0x5eef('0x7')];}_0x30e429[_0x5eef('0x83')](_0x40c89f);}else{_0xec1270[_0x5eef('0x78')]['id']=_0x406a2a[_0x5eef('0x7')];}}else{for(var _0x40dca4=0x0;_0x40dca4<_0x59f2e4[_0x5eef('0x82')];_0x40dca4++){_0x5b996c=_[_0x5eef('0x85')](_0x484827,[_0x5eef('0xa'),_0x59f2e4[_0x40dca4]['name']]);if(_0x5b996c['field']){_0x40c89f={};_0x40c89f[_0x5b996c[_0x5eef('0x9b')]]=_0x59f2e4[_0x40dca4]['associatedResources'];_0x30e429[_0x5eef('0x83')](_0x40c89f);}else{if(!_0xec1270[_0x5eef('0x78')]['id'])_0xec1270[_0x5eef('0x78')]['id']=[];_0x59f2e4[_0x40dca4][_0x5eef('0x7')]['forEach'](function(_0x533e2f){_0xec1270[_0x5eef('0x78')]['id'][_0x5eef('0x83')](_0x533e2f);});}}}if(!_[_0x5eef('0x87')](_0x30e429)){_0xec1270[_0x5eef('0x78')]=_[_0x5eef('0x98')](_0xec1270[_0x5eef('0x78')],{'$and':{'$or':_0x30e429}});}_0xec1270=_[_0x5eef('0x98')]({},_0xec1270,_0xd49bcd[_0x5eef('0x9c')]);if(_0x406a2a&&!_0x406a2a['autoAssociation']&&_0x652394[_0x5eef('0x15')]===_0x5eef('0xe')){if(_0xd49bcd[_0x5eef('0x7f')][_0x5eef('0x9d')]){_0xec1270[_0x5eef('0x9e')]=[{'all':!![]}];}return _0x23929f[_0x652394[_0x5eef('0x15')]][_0x5eef('0x6')](_0xec1270)[_0x5eef('0xd')](function(_0x34d427){var _0x2faf8a=[];_0x34d427[_0x5eef('0x9f')](function(_0xe5efd0){var _0x137293;switch(_0xe5efd0[_0x5eef('0xa0')]){case'default':_0x137293=_[_0x5eef('0x85')](_0x406a2a[_0x5eef('0x7')],function(_0x1c7589){return _0x1c7589['id']===_0xe5efd0[_0x5eef('0xa1')]&&_0x1c7589[_0x5eef('0xf')]===_0x5eef('0xa2');});break;case _0x5eef('0xa3'):_0x137293=_['find'](_0x406a2a[_0x5eef('0x7')],function(_0x1a05ce){return _0x1a05ce['id']===_0xe5efd0[_0x5eef('0xa1')]&&_0x1a05ce[_0x5eef('0xf')]==='CustomReports';});break;}if(_0x137293)_0x2faf8a[_0x5eef('0x83')](_0xe5efd0);});_0x3a6468['count']=_0x2faf8a[_0x5eef('0x82')];_0x3a6468[_0x5eef('0xa4')]=_0x2faf8a;return _0x3a6468;});}else{if(!_[_0x5eef('0x87')](_0xd49bcd[_0x5eef('0x7f')][_0x5eef('0xa5')])){_0xec1270['where']['id']=_0xec1270['where']['id']?_[_0x5eef('0x8e')](_0xec1270[_0x5eef('0x78')]['id'],_0xd49bcd[_0x5eef('0x7f')]['ids']):_0xd49bcd['query'][_0x5eef('0xa5')];if(_0xd49bcd[_0x5eef('0x7f')][_0x5eef('0xa6')]){_0xec1270[_0x5eef('0x95')]=_0xd49bcd[_0x5eef('0x7f')][_0x5eef('0xa6')];}}if(_0xd49bcd[_0x5eef('0x7f')][_0x5eef('0xa7')]){_0xec1270[_0x5eef('0x78')]=_[_0x5eef('0x98')](_0xec1270[_0x5eef('0x78')],{'$and':_0xd49bcd[_0x5eef('0x7f')][_0x5eef('0xa7')]});}return _0x23929f[_0x652394[_0x5eef('0x15')]][_0x5eef('0xa8')]({'where':_0xec1270['where']})[_0x5eef('0xd')](function(_0x517ec7){_0x3a6468['count']=_0x517ec7;if(_0xd49bcd[_0x5eef('0x7f')][_0x5eef('0x9d')]){if(_0x652394['childModel']===_0x5eef('0x1b')){_0xec1270[_0x5eef('0x9e')]=[{'model':_0x23929f['Tag'],'as':_0x5eef('0xa9'),'attributes':['id',_0x5eef('0xa'),_0x5eef('0xaa')],'required':_0xd49bcd[_0x5eef('0x7f')][_0x5eef('0xab')]?!![]:![]},{'model':_0x23929f['Tag'],'as':_0x5eef('0xac'),'attributes':['id',_0x5eef('0xa'),_0x5eef('0xaa')],'through':_0xd49bcd['query'][_0x5eef('0xab')]?{'attributes':[],'where':{'TagId':_0xd49bcd['query']['tag']||undefined}}:{},'required':_0xd49bcd['query']['tag']?!![]:![]}];}else{_0xec1270['include']=[{'all':!![]}];}}return _0x23929f[_0x652394[_0x5eef('0x15')]][_0x5eef('0x6')](_0xec1270);})[_0x5eef('0xd')](function(_0x297362){_0x3a6468[_0x5eef('0xa4')]=_0x297362;if(_0x57ade8===_0x5eef('0x2c')&&_0xd49bcd[_0x5eef('0x7f')][_0x5eef('0xad')]===_0x5eef('0xae')){var _0xc51efe=[];for(var _0x5ef8d7=0x0;_0x5ef8d7<_0x3a6468['rows'][_0x5eef('0x82')];_0x5ef8d7++){_0xc51efe[_0x5eef('0x83')](_0x24e9a6(_0x5eef('0xaf'),_0x3a6468[_0x5eef('0xa4')][_0x5ef8d7][_0x5eef('0xb0')]));_0xc51efe[_0x5eef('0x83')](_0x24e9a6(_0x5eef('0xb1'),_0x3a6468[_0x5eef('0xa4')][_0x5ef8d7][_0x5eef('0xb0')]));_0xc51efe['push'](_0x24e9a6(_0x5eef('0xb2'),_0x3a6468[_0x5eef('0xa4')][_0x5ef8d7][_0x5eef('0xb0')]));_0xc51efe[_0x5eef('0x83')](_0x24e9a6(_0x5eef('0xb3'),_0x3a6468['rows'][_0x5ef8d7][_0x5eef('0xb0')]));_0xc51efe[_0x5eef('0x83')](_0x24e9a6(_0x5eef('0xb4'),_0x3a6468[_0x5eef('0xa4')][_0x5ef8d7][_0x5eef('0xb0')]));_0xc51efe['push'](_0x24e9a6('whatsapp',_0x3a6468['rows'][_0x5ef8d7][_0x5eef('0xb0')]));}return Promise['all'](_0xc51efe)['then'](function(){return _0x3a6468;});}return _0x3a6468;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index d99a3c6..a7a38bc 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 _0xba34=['then','UserProfile,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userProfile.socket','register'];(function(_0x372c92,_0x5e629e){var _0x33b9db=function(_0x187b68){while(--_0x187b68){_0x372c92['push'](_0x372c92['shift']());}};_0x33b9db(++_0x5e629e);}(_0xba34,0x119));var _0x4ba3=function(_0x2c8875,_0xebdc60){_0x2c8875=_0x2c8875-0x0;var _0x553a34=_0xba34[_0x2c8875];return _0x553a34;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});config[_0x4ba3('0xb')]=_['defaults'](config[_0x4ba3('0xb')],{'host':_0x4ba3('0xc'),'port':0x18eb});var socket=require(_0x4ba3('0xd'))(new Redis(config[_0x4ba3('0xb')]));require(_0x4ba3('0xe'))[_0x4ba3('0xf')](socket);function respondWithRpcPromise(_0x292f58,_0x3f653c,_0x2ed106){return new BPromise(function(_0x14ebf2,_0x2d215b){return client['request'](_0x292f58,_0x2ed106)[_0x4ba3('0x10')](function(_0x9071){logger['info'](_0x4ba3('0x11'),_0x3f653c,'request\x20sent');logger[_0x4ba3('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x3f653c,_0x4ba3('0x13'),JSON[_0x4ba3('0x14')](_0x9071));if(_0x9071[_0x4ba3('0x15')]){if(_0x9071[_0x4ba3('0x15')][_0x4ba3('0x16')]===0x1f4){logger[_0x4ba3('0x15')](_0x4ba3('0x11'),_0x3f653c,_0x9071[_0x4ba3('0x15')][_0x4ba3('0x17')]);return _0x2d215b(_0x9071[_0x4ba3('0x15')][_0x4ba3('0x17')]);}logger[_0x4ba3('0x15')](_0x4ba3('0x11'),_0x3f653c,_0x9071[_0x4ba3('0x15')][_0x4ba3('0x17')]);return _0x14ebf2(_0x9071[_0x4ba3('0x15')]['message']);}else{logger[_0x4ba3('0x18')](_0x4ba3('0x11'),_0x3f653c,_0x4ba3('0x13'));_0x14ebf2(_0x9071[_0x4ba3('0x19')]['message']);}})[_0x4ba3('0x1a')](function(_0xe4eff9){logger[_0x4ba3('0x15')](_0x4ba3('0x11'),_0x3f653c,_0xe4eff9);_0x2d215b(_0xe4eff9);});});} \ No newline at end of file +var _0xcf98=['debug','error','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s'];(function(_0x5728d3,_0x19dc46){var _0x4ab2e4=function(_0x3e9eb0){while(--_0x3e9eb0){_0x5728d3['push'](_0x5728d3['shift']());}};_0x4ab2e4(++_0x19dc46);}(_0xcf98,0x8d));var _0x8cf9=function(_0x269234,_0x506eed){_0x269234=_0x269234-0x0;var _0x4ed1ca=_0xcf98[_0x269234];return _0x4ed1ca;};'use strict';var _=require('lodash');var util=require(_0x8cf9('0x0'));var moment=require(_0x8cf9('0x1'));var BPromise=require(_0x8cf9('0x2'));var rs=require(_0x8cf9('0x3'));var fs=require('fs');var Redis=require(_0x8cf9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8cf9('0x5'))(_0x8cf9('0x6'));var config=require(_0x8cf9('0x7'));var jayson=require(_0x8cf9('0x8'));var client=jayson[_0x8cf9('0x9')][_0x8cf9('0xa')]({'port':0x232a});config[_0x8cf9('0xb')]=_[_0x8cf9('0xc')](config[_0x8cf9('0xb')],{'host':_0x8cf9('0xd'),'port':0x18eb});var socket=require(_0x8cf9('0xe'))(new Redis(config['redis']));require(_0x8cf9('0xf'))[_0x8cf9('0x10')](socket);function respondWithRpcPromise(_0x4f4ab3,_0xfe2da1,_0x5b9daa){return new BPromise(function(_0x23eb35,_0x432742){return client[_0x8cf9('0x11')](_0x4f4ab3,_0x5b9daa)[_0x8cf9('0x12')](function(_0x236fbd){logger[_0x8cf9('0x13')](_0x8cf9('0x14'),_0xfe2da1,'request\x20sent');logger[_0x8cf9('0x15')]('UserProfile,\x20%s,\x20%s,\x20%s',_0xfe2da1,'request\x20sent',JSON['stringify'](_0x236fbd));if(_0x236fbd[_0x8cf9('0x16')]){if(_0x236fbd['error']['code']===0x1f4){logger[_0x8cf9('0x16')](_0x8cf9('0x14'),_0xfe2da1,_0x236fbd[_0x8cf9('0x16')]['message']);return _0x432742(_0x236fbd[_0x8cf9('0x16')][_0x8cf9('0x17')]);}logger['error'](_0x8cf9('0x14'),_0xfe2da1,_0x236fbd[_0x8cf9('0x16')][_0x8cf9('0x17')]);return _0x23eb35(_0x236fbd[_0x8cf9('0x16')][_0x8cf9('0x17')]);}else{logger[_0x8cf9('0x13')](_0x8cf9('0x14'),_0xfe2da1,_0x8cf9('0x18'));_0x23eb35(_0x236fbd[_0x8cf9('0x19')][_0x8cf9('0x17')]);}})[_0x8cf9('0x1a')](function(_0x2929ee){logger[_0x8cf9('0x16')](_0x8cf9('0x14'),_0xfe2da1,_0x2929ee);_0x432742(_0x2929ee);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 5a76fe6..bbe5b50 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 _0xff55=['length','userProfile:','remove','removeListener','register'];(function(_0xe3773,_0x101f22){var _0x22f6a4=function(_0x400517){while(--_0x400517){_0xe3773['push'](_0xe3773['shift']());}};_0x22f6a4(++_0x101f22);}(_0xff55,0x151));var _0x5ff5=function(_0x2b78c9,_0x266af4){_0x2b78c9=_0x2b78c9-0x0;var _0x57ee4f=_0xff55[_0x2b78c9];return _0x57ee4f;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x5ff5('0x0'),'update'];function createListener(_0x42663c,_0xf3ff85){return function(_0xa36ae){_0xf3ff85['emit'](_0x42663c,_0xa36ae);};}function removeListener(_0x36f2bf,_0x452d15){return function(){UserProfileEvents[_0x5ff5('0x1')](_0x36f2bf,_0x452d15);};}exports[_0x5ff5('0x2')]=function(_0x307be0){for(var _0x5eac0a=0x0,_0x5299f0=events[_0x5ff5('0x3')];_0x5eac0a<_0x5299f0;_0x5eac0a++){var _0x4d2f4c=events[_0x5eac0a];var _0x3dc468=createListener(_0x5ff5('0x4')+_0x4d2f4c,_0x307be0);UserProfileEvents['on'](_0x4d2f4c,_0x3dc468);}}; \ No newline at end of file +var _0xaa36=['update','emit','removeListener','./userProfile.events','save','remove'];(function(_0x3ca39c,_0x263221){var _0x3aad48=function(_0x16830e){while(--_0x16830e){_0x3ca39c['push'](_0x3ca39c['shift']());}};_0x3aad48(++_0x263221);}(_0xaa36,0x1e3));var _0x6aa3=function(_0x394a3f,_0x5c407d){_0x394a3f=_0x394a3f-0x0;var _0x4672ab=_0xaa36[_0x394a3f];return _0x4672ab;};'use strict';var UserProfileEvents=require(_0x6aa3('0x0'));var events=[_0x6aa3('0x1'),_0x6aa3('0x2'),_0x6aa3('0x3')];function createListener(_0x2966b5,_0x162d13){return function(_0x398480){_0x162d13[_0x6aa3('0x4')](_0x2966b5,_0x398480);};}function removeListener(_0x3bd200,_0x2554c0){return function(){UserProfileEvents[_0x6aa3('0x5')](_0x3bd200,_0x2554c0);};}exports['register']=function(_0x357df3){for(var _0xfc3b5a=0x0,_0x2e8e03=events['length'];_0xfc3b5a<_0x2e8e03;_0xfc3b5a++){var _0x58ba85=events[_0xfc3b5a];var _0x2a0217=createListener('userProfile:'+_0x58ba85,_0x357df3);UserProfileEvents['on'](_0x58ba85,_0x2a0217);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index e7ae6bc..493c4a2 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 _0x3dd4=['isAuthenticated','/describe','describe','show','post','create','put','update','/:id','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','get'];(function(_0x3e47df,_0x847ba5){var _0x1d30d4=function(_0x4cde23){while(--_0x4cde23){_0x3e47df['push'](_0x3e47df['shift']());}};_0x1d30d4(++_0x847ba5);}(_0x3dd4,0x1e6));var _0x43dd=function(_0x2ac149,_0xe69954){_0x2ac149=_0x2ac149-0x0;var _0x5175b8=_0x3dd4[_0x2ac149];return _0x5175b8;};'use strict';var multer=require('multer');var util=require(_0x43dd('0x0'));var path=require(_0x43dd('0x1'));var timeout=require(_0x43dd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x43dd('0x3'));var auth=require(_0x43dd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43dd('0x5'));var controller=require(_0x43dd('0x6'));router[_0x43dd('0x7')]('/',auth[_0x43dd('0x8')](),controller['index']);router['get'](_0x43dd('0x9'),auth[_0x43dd('0x8')](),controller[_0x43dd('0xa')]);router['get']('/:id',auth[_0x43dd('0x8')](),controller[_0x43dd('0xb')]);router[_0x43dd('0xc')]('/',auth['isAuthenticated'](),controller[_0x43dd('0xd')]);router[_0x43dd('0xe')]('/:id',auth[_0x43dd('0x8')](),controller[_0x43dd('0xf')]);router['delete'](_0x43dd('0x10'),auth[_0x43dd('0x8')](),controller[_0x43dd('0x11')]);module[_0x43dd('0x12')]=router; \ No newline at end of file +var _0x7b51=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','destroy','exports','multer','util','path'];(function(_0x37a12a,_0x3d66eb){var _0x514b65=function(_0x40c3c9){while(--_0x40c3c9){_0x37a12a['push'](_0x37a12a['shift']());}};_0x514b65(++_0x3d66eb);}(_0x7b51,0x162));var _0x17b5=function(_0x496f2c,_0x333179){_0x496f2c=_0x496f2c-0x0;var _0x242388=_0x7b51[_0x496f2c];return _0x242388;};'use strict';var multer=require(_0x17b5('0x0'));var util=require(_0x17b5('0x1'));var path=require(_0x17b5('0x2'));var timeout=require(_0x17b5('0x3'));var express=require(_0x17b5('0x4'));var router=express[_0x17b5('0x5')]();var fs_extra=require(_0x17b5('0x6'));var auth=require(_0x17b5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x17b5('0x8'));var controller=require(_0x17b5('0x9'));router[_0x17b5('0xa')]('/',auth[_0x17b5('0xb')](),controller[_0x17b5('0xc')]);router[_0x17b5('0xa')](_0x17b5('0xd'),auth[_0x17b5('0xb')](),controller['describe']);router[_0x17b5('0xa')](_0x17b5('0xe'),auth[_0x17b5('0xb')](),controller[_0x17b5('0xf')]);router[_0x17b5('0x10')]('/',auth[_0x17b5('0xb')](),controller[_0x17b5('0x11')]);router[_0x17b5('0x12')](_0x17b5('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x17b5('0xe'),auth['isAuthenticated'](),controller[_0x17b5('0x13')]);module[_0x17b5('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 602dcb4..737b927 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 _0x1a4d=['exports','STRING','INTEGER','sequelize'];(function(_0xf1f80b,_0x44d17f){var _0x480b6a=function(_0x25199d){while(--_0x25199d){_0xf1f80b['push'](_0xf1f80b['shift']());}};_0x480b6a(++_0x44d17f);}(_0x1a4d,0x123));var _0xd1a4=function(_0x3e1669,_0x90e931){_0x3e1669=_0x3e1669-0x0;var _0x46ca6c=_0x1a4d[_0x3e1669];return _0x46ca6c;};'use strict';var Sequelize=require(_0xd1a4('0x0'));module[_0xd1a4('0x1')]={'name':{'type':Sequelize[_0xd1a4('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xd1a4('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xd1a4('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xdeb1=['exports','INTEGER'];(function(_0x2d5dc9,_0x3c6481){var _0x5ad0ef=function(_0x176c4f){while(--_0x176c4f){_0x2d5dc9['push'](_0x2d5dc9['shift']());}};_0x5ad0ef(++_0x3c6481);}(_0xdeb1,0x82));var _0x1deb=function(_0x91426a,_0x272b45){_0x91426a=_0x91426a-0x0;var _0xc9c2f0=_0xdeb1[_0x91426a];return _0xc9c2f0;};'use strict';var Sequelize=require('sequelize');module[_0x1deb('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x1deb('0x1')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 55702b2..e829941 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 _0x2542=['json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x585ff6,_0x14cf47){var _0x5a449e=function(_0x5e7d79){while(--_0x5e7d79){_0x585ff6['push'](_0x585ff6['shift']());}};_0x5a449e(++_0x14cf47);}(_0x2542,0x169));var _0x2254=function(_0x37412d,_0x4e2af8){_0x37412d=_0x37412d-0x0;var _0x24cd09=_0x2542[_0x37412d];return _0x24cd09;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1a')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1b')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1c')](_0x504749)[_0x2254('0x1d')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=typeof _0x26285a[_0x2254('0x1e')]==='undefined'&&typeof _0x26285a[_0x2254('0x1f')]===_0x2254('0x20');var _0x170ffa=_0xbc5548[_0x2254('0x21')];var _0x1ae11e=_0x50f137?0x0:_0x26285a[_0x2254('0x1e')];var _0x497724=_0x50f137?_0xbc5548['count']:_0x26285a['offset']+_0x26285a[_0x2254('0x1f')];var _0x3a79f8;if(_0x497724>=_0x170ffa){_0x497724=_0x170ffa;_0x3a79f8=0xc8;}else{_0x3a79f8=0xce;}_0x145272[_0x2254('0x1c')](_0x3a79f8);return _0x145272[_0x2254('0x22')](_0x2254('0x23'),_0x1ae11e+'-'+_0x497724+'/'+_0x170ffa)[_0x2254('0x1d')](_0xbc5548);}return null;};}function patchUpdates(_0x487f72){return function(_0x28381e){try{jsonpatch[_0x2254('0x24')](_0x28381e,_0x487f72,!![]);}catch(_0x906cde){return BPromise['reject'](_0x906cde);}return _0x28381e['save']();};}function saveUpdates(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x25')](_0x5bd982)['then'](function(_0x5713e4){return _0x5713e4;});}return null;};}function removeEntity(_0x4d8faf,_0x540020){return function(_0x5e5edb){if(_0x5e5edb){return _0x5e5edb['destroy']()[_0x2254('0x26')](function(){_0x4d8faf[_0x2254('0x1c')](0xcc)[_0x2254('0x1b')]();});}};}function handleEntityNotFound(_0x265467,_0x13522d){return function(_0x1349c9){if(!_0x1349c9){_0x265467['sendStatus'](0x194);}return _0x1349c9;};}function handleError(_0x4a8274,_0x1ada42){_0x1ada42=_0x1ada42||0x1f4;return function(_0x4f6877){logger[_0x2254('0x27')](_0x4f6877[_0x2254('0x28')]);if(_0x4f6877[_0x2254('0x29')]){delete _0x4f6877[_0x2254('0x29')];}_0x4a8274[_0x2254('0x1c')](_0x1ada42)['send'](_0x4f6877);};}exports[_0x2254('0x2a')]=function(_0x2a789b,_0x21285d){var _0x37af8b={},_0x13366a={},_0x377c41={'count':0x0,'rows':[]};var _0x3214a7=_[_0x2254('0x2b')](db[_0x2254('0x2c')][_0x2254('0x2d')],function(_0x21c641){return{'name':_0x21c641[_0x2254('0x2e')],'type':_0x21c641[_0x2254('0x2f')][_0x2254('0x30')]};});_0x13366a[_0x2254('0x31')]=_[_0x2254('0x2b')](_0x3214a7,_0x2254('0x29'));_0x13366a[_0x2254('0x32')]=_[_0x2254('0x33')](_0x2a789b['query']);_0x13366a[_0x2254('0x34')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],_0x13366a[_0x2254('0x32')]);_0x37af8b[_0x2254('0x36')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],qs[_0x2254('0x37')](_0x2a789b[_0x2254('0x32')]['fields']));_0x37af8b[_0x2254('0x36')]=_0x37af8b[_0x2254('0x36')]['length']?_0x37af8b[_0x2254('0x36')]:_0x13366a[_0x2254('0x31')];if(!_0x2a789b[_0x2254('0x32')][_0x2254('0x38')]('nolimit')){_0x37af8b['limit']=qs[_0x2254('0x1f')](_0x2a789b['query'][_0x2254('0x1f')]);_0x37af8b[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0x2a789b[_0x2254('0x32')][_0x2254('0x1e')]);}_0x37af8b[_0x2254('0x39')]=qs[_0x2254('0x3a')](_0x2a789b['query'][_0x2254('0x3a')]);_0x37af8b[_0x2254('0x3b')]=qs[_0x2254('0x34')](_[_0x2254('0x3c')](_0x2a789b[_0x2254('0x32')],_0x13366a[_0x2254('0x34')]),_0x3214a7);if(_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]){_0x37af8b[_0x2254('0x3b')]=_[_0x2254('0x3e')](_0x37af8b['where'],{'$or':_[_0x2254('0x2b')](_0x3214a7,function(_0xde3e4a){if(_0xde3e4a[_0x2254('0x2f')]!==_0x2254('0x3f')){var _0x4c7cc3={};_0x4c7cc3[_0xde3e4a[_0x2254('0x29')]]={'$like':'%'+_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]+'%'};return _0x4c7cc3;}})});}_0x37af8b=_[_0x2254('0x3e')]({},_0x37af8b,_0x2a789b[_0x2254('0x40')]);var _0x2602db={'where':_0x37af8b[_0x2254('0x3b')]};return db[_0x2254('0x2c')]['count'](_0x2602db)[_0x2254('0x26')](function(_0x5c15d7){_0x377c41[_0x2254('0x21')]=_0x5c15d7;if(_0x2a789b[_0x2254('0x32')][_0x2254('0x41')]){_0x37af8b[_0x2254('0x42')]=[{'all':!![]}];}return db[_0x2254('0x2c')][_0x2254('0x43')](_0x37af8b);})[_0x2254('0x26')](function(_0x568ec9){_0x377c41[_0x2254('0x44')]=_0x568ec9;return _0x377c41;})[_0x2254('0x26')](respondWithFilteredResult(_0x21285d,_0x37af8b))[_0x2254('0x45')](handleError(_0x21285d,null));};exports[_0x2254('0x46')]=function(_0x40d4da,_0x57cda2){var _0x22bb98={'raw':![],'where':{'id':_0x40d4da[_0x2254('0x47')]['id']}},_0x1dec43={};_0x1dec43[_0x2254('0x31')]=_[_0x2254('0x33')](db['UserProfileResource'][_0x2254('0x2d')]);_0x1dec43['query']=_[_0x2254('0x33')](_0x40d4da[_0x2254('0x32')]);_0x1dec43[_0x2254('0x34')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],_0x1dec43[_0x2254('0x32')]);_0x22bb98[_0x2254('0x36')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],qs[_0x2254('0x37')](_0x40d4da[_0x2254('0x32')][_0x2254('0x37')]));_0x22bb98[_0x2254('0x36')]=_0x22bb98['attributes'][_0x2254('0x48')]?_0x22bb98[_0x2254('0x36')]:_0x1dec43[_0x2254('0x31')];if(_0x40d4da['query'][_0x2254('0x41')]){_0x22bb98[_0x2254('0x42')]=[{'all':!![]}];}_0x22bb98=_[_0x2254('0x3e')]({},_0x22bb98,_0x40d4da[_0x2254('0x40')]);return db[_0x2254('0x2c')][_0x2254('0x49')](_0x22bb98)[_0x2254('0x26')](handleEntityNotFound(_0x57cda2,null))[_0x2254('0x26')](respondWithResult(_0x57cda2,null))[_0x2254('0x45')](handleError(_0x57cda2,null));};exports['create']=function(_0x239ba0,_0x405eb2){return db[_0x2254('0x2c')][_0x2254('0x4a')](_0x239ba0[_0x2254('0x4b')],{})[_0x2254('0x26')](respondWithResult(_0x405eb2,0xc9))[_0x2254('0x45')](handleError(_0x405eb2,null));};exports[_0x2254('0x25')]=function(_0x3ac691,_0xa103ea){if(_0x3ac691['body']['id']){delete _0x3ac691[_0x2254('0x4b')]['id'];}return db[_0x2254('0x2c')]['find']({'where':{'id':_0x3ac691[_0x2254('0x47')]['id']}})[_0x2254('0x26')](handleEntityNotFound(_0xa103ea,null))[_0x2254('0x26')](saveUpdates(_0x3ac691[_0x2254('0x4b')],null))['then'](respondWithResult(_0xa103ea,null))[_0x2254('0x45')](handleError(_0xa103ea,null));};exports[_0x2254('0x4c')]=function(_0x4d2c96,_0x26d01a){return db[_0x2254('0x2c')][_0x2254('0x49')]({'where':{'id':_0x4d2c96[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x26d01a,null))[_0x2254('0x26')](removeEntity(_0x26d01a,null))[_0x2254('0x45')](handleError(_0x26d01a,null));};exports[_0x2254('0x4d')]=function(_0x4ba6ef,_0x4cc18a){return db[_0x2254('0x2c')][_0x2254('0x4d')]()['then'](respondWithResult(_0x4cc18a,null))[_0x2254('0x45')](handleError(_0x4cc18a,null));}; \ No newline at end of file +var _0x1623=['filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','UserProfileResource','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1623,0xab));var _0x3162=function(_0x5e63dd,_0x4a152b){_0x5e63dd=_0x5e63dd-0x0;var _0x5e05db=_0x1623[_0x5e63dd];return _0x5e05db;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['UserProfileResource'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')](_0x3d2958[_0x3162('0x48')],{})['then'](respondWithResult(_0x28865c,0xc9))[_0x3162('0x42')](handleError(_0x28865c,null));};exports['update']=function(_0x4f1dde,_0x12d791){if(_0x4f1dde[_0x3162('0x48')]['id']){delete _0x4f1dde[_0x3162('0x48')]['id'];}return db[_0x3162('0x3f')]['find']({'where':{'id':_0x4f1dde[_0x3162('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d791,null))[_0x3162('0x24')](saveUpdates(_0x4f1dde[_0x3162('0x48')],null))['then'](respondWithResult(_0x12d791,null))[_0x3162('0x42')](handleError(_0x12d791,null));};exports['destroy']=function(_0x516599,_0x13e7c4){return db[_0x3162('0x3f')][_0x3162('0x46')]({'where':{'id':_0x516599[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x13e7c4,null))[_0x3162('0x24')](removeEntity(_0x13e7c4,null))[_0x3162('0x42')](handleError(_0x13e7c4,null));};exports[_0x3162('0x49')]=function(_0x554a03,_0x48b81d){return db['UserProfileResource'][_0x3162('0x49')]()[_0x3162('0x24')](respondWithResult(_0x48b81d,null))[_0x3162('0x42')](handleError(_0x48b81d,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 3bc9c30..ae905ed 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 _0xfb06=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userProfileResource.attributes','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x6c6115,_0x316fbd){var _0x309b1d=function(_0x8de540){while(--_0x8de540){_0x6c6115['push'](_0x6c6115['shift']());}};_0x309b1d(++_0x316fbd);}(_0xfb06,0x152));var _0x6fb0=function(_0x328bd3,_0x9cf5a5){_0x328bd3=_0x328bd3-0x0;var _0x458149=_0xfb06[_0x328bd3];return _0x458149;};'use strict';var _=require(_0x6fb0('0x0'));var util=require(_0x6fb0('0x1'));var logger=require(_0x6fb0('0x2'))(_0x6fb0('0x3'));var moment=require(_0x6fb0('0x4'));var BPromise=require(_0x6fb0('0x5'));var rp=require(_0x6fb0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6fb0('0x7'));var attributes=require(_0x6fb0('0x8'));module['exports']=function(_0x566658,_0x295713){return _0x566658['define'](_0x6fb0('0x9'),attributes,{'tableName':_0x6fb0('0xa'),'paranoid':![],'indexes':[{'name':_0x6fb0('0xb'),'fields':[_0x6fb0('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc46c=['compositeIndex','sectionId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileResource'];(function(_0xc7fcc2,_0x331733){var _0x55d4b0=function(_0x1d2374){while(--_0x1d2374){_0xc7fcc2['push'](_0xc7fcc2['shift']());}};_0x55d4b0(++_0x331733);}(_0xc46c,0x8e));var _0xcc46=function(_0x1f62c3,_0x1ff95b){_0x1f62c3=_0x1f62c3-0x0;var _0x385c1c=_0xc46c[_0x1f62c3];return _0x385c1c;};'use strict';var _=require(_0xcc46('0x0'));var util=require('util');var logger=require(_0xcc46('0x1'))(_0xcc46('0x2'));var moment=require(_0xcc46('0x3'));var BPromise=require(_0xcc46('0x4'));var rp=require(_0xcc46('0x5'));var fs=require('fs');var path=require(_0xcc46('0x6'));var rimraf=require(_0xcc46('0x7'));var config=require(_0xcc46('0x8'));var attributes=require('./userProfileResource.attributes');module[_0xcc46('0x9')]=function(_0x347152,_0x3c0b87){return _0x347152[_0xcc46('0xa')](_0xcc46('0xb'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xcc46('0xc'),'fields':['resourceId',_0xcc46('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 6c86c92..a721c3e 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 _0xb150=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','UserProfileResource,\x20%s,\x20%s','message','result','lodash','util','moment'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xb150,0x19f));var _0x0b15=function(_0x17abfe,_0x3d4a9a){_0x17abfe=_0x17abfe-0x0;var _0x8d5304=_0xb150[_0x17abfe];return _0x8d5304;};'use strict';var _=require(_0x0b15('0x0'));var util=require(_0x0b15('0x1'));var moment=require(_0x0b15('0x2'));var BPromise=require('bluebird');var rs=require(_0x0b15('0x3'));var fs=require('fs');var Redis=require(_0x0b15('0x4'));var db=require(_0x0b15('0x5'))['db'];var utils=require(_0x0b15('0x6'));var logger=require(_0x0b15('0x7'))(_0x0b15('0x8'));var config=require('../../config/environment');var jayson=require(_0x0b15('0x9'));var client=jayson[_0x0b15('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a724e,_0x106e8d,_0x4aa819){return new BPromise(function(_0x3fa841,_0x2f2b1d){return client[_0x0b15('0xb')](_0x3a724e,_0x4aa819)[_0x0b15('0xc')](function(_0x1933e2){logger[_0x0b15('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x106e8d,_0x0b15('0xe'));logger[_0x0b15('0xf')](_0x0b15('0x10'),_0x106e8d,'request\x20sent',JSON['stringify'](_0x1933e2));if(_0x1933e2[_0x0b15('0x11')]){if(_0x1933e2[_0x0b15('0x11')][_0x0b15('0x12')]===0x1f4){logger['error'](_0x0b15('0x13'),_0x106e8d,_0x1933e2[_0x0b15('0x11')]['message']);return _0x2f2b1d(_0x1933e2['error'][_0x0b15('0x14')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x106e8d,_0x1933e2[_0x0b15('0x11')]['message']);return _0x3fa841(_0x1933e2[_0x0b15('0x11')][_0x0b15('0x14')]);}else{logger[_0x0b15('0xd')](_0x0b15('0x13'),_0x106e8d,'request\x20sent');_0x3fa841(_0x1933e2[_0x0b15('0x15')][_0x0b15('0x14')]);}})['catch'](function(_0x319706){logger[_0x0b15('0x11')](_0x0b15('0x13'),_0x106e8d,_0x319706);_0x2f2b1d(_0x319706);});});} \ No newline at end of file +var _0x59e1=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfileResource,\x20%s,\x20%s','request\x20sent','result','lodash','util','moment'];(function(_0x3bb46e,_0x20721a){var _0x3af791=function(_0x249881){while(--_0x249881){_0x3bb46e['push'](_0x3bb46e['shift']());}};_0x3af791(++_0x20721a);}(_0x59e1,0x105));var _0x159e=function(_0x31b5d0,_0x3bffc6){_0x31b5d0=_0x31b5d0-0x0;var _0x2a6df3=_0x59e1[_0x31b5d0];return _0x2a6df3;};'use strict';var _=require(_0x159e('0x0'));var util=require(_0x159e('0x1'));var moment=require(_0x159e('0x2'));var BPromise=require(_0x159e('0x3'));var rs=require(_0x159e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x159e('0x5'))['db'];var utils=require(_0x159e('0x6'));var logger=require(_0x159e('0x7'))(_0x159e('0x8'));var config=require(_0x159e('0x9'));var jayson=require(_0x159e('0xa'));var client=jayson['client'][_0x159e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ea616,_0x5beccf,_0x3526aa){return new BPromise(function(_0x172d5a,_0x26c97a){return client[_0x159e('0xc')](_0x5ea616,_0x3526aa)['then'](function(_0x2f6381){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x5beccf,'request\x20sent');logger[_0x159e('0xd')](_0x159e('0xe'),_0x5beccf,'request\x20sent',JSON[_0x159e('0xf')](_0x2f6381));if(_0x2f6381['error']){if(_0x2f6381[_0x159e('0x10')][_0x159e('0x11')]===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x5beccf,_0x2f6381['error'][_0x159e('0x12')]);return _0x26c97a(_0x2f6381['error'][_0x159e('0x12')]);}logger[_0x159e('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x5beccf,_0x2f6381[_0x159e('0x10')][_0x159e('0x12')]);return _0x172d5a(_0x2f6381[_0x159e('0x10')][_0x159e('0x12')]);}else{logger['info'](_0x159e('0x13'),_0x5beccf,_0x159e('0x14'));_0x172d5a(_0x2f6381[_0x159e('0x15')][_0x159e('0x12')]);}})['catch'](function(_0x5ce4cd){logger[_0x159e('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x5beccf,_0x5ce4cd);_0x26c97a(_0x5ce4cd);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 591ca1c..14e0b51 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 _0x4c72=['index','/describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfileSection.controller','get','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4c72,0x1d8));var _0x24c7=function(_0x1e1125,_0x50682f){_0x1e1125=_0x1e1125-0x0;var _0x4007f1=_0x4c72[_0x1e1125];return _0x4007f1;};'use strict';var multer=require(_0x24c7('0x0'));var util=require(_0x24c7('0x1'));var path=require(_0x24c7('0x2'));var timeout=require(_0x24c7('0x3'));var express=require(_0x24c7('0x4'));var router=express[_0x24c7('0x5')]();var fs_extra=require(_0x24c7('0x6'));var auth=require(_0x24c7('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x24c7('0x8'));router[_0x24c7('0x9')]('/',auth[_0x24c7('0xa')](),controller[_0x24c7('0xb')]);router[_0x24c7('0x9')](_0x24c7('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x24c7('0x9')](_0x24c7('0xd'),auth['isAuthenticated'](),controller[_0x24c7('0xe')]);router[_0x24c7('0xf')]('/',auth[_0x24c7('0xa')](),controller[_0x24c7('0x10')]);router['put'](_0x24c7('0xd'),auth['isAuthenticated'](),controller[_0x24c7('0x11')]);router[_0x24c7('0x12')](_0x24c7('0xd'),auth[_0x24c7('0xa')](),controller[_0x24c7('0x13')]);module[_0x24c7('0x14')]=router; \ No newline at end of file +var _0x6d7a=['put','update','delete','destroy','path','express','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0x6d7a,0x154));var _0xa6d7=function(_0x443c10,_0x57f933){_0x443c10=_0x443c10-0x0;var _0x4077f1=_0x6d7a[_0x443c10];return _0x4077f1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa6d7('0x0'));var timeout=require('connect-timeout');var express=require(_0xa6d7('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa6d7('0x2'));var controller=require(_0xa6d7('0x3'));router[_0xa6d7('0x4')]('/',auth[_0xa6d7('0x5')](),controller[_0xa6d7('0x6')]);router[_0xa6d7('0x4')]('/describe',auth[_0xa6d7('0x5')](),controller[_0xa6d7('0x7')]);router[_0xa6d7('0x4')](_0xa6d7('0x8'),auth[_0xa6d7('0x5')](),controller[_0xa6d7('0x9')]);router[_0xa6d7('0xa')]('/',auth[_0xa6d7('0x5')](),controller[_0xa6d7('0xb')]);router[_0xa6d7('0xc')](_0xa6d7('0x8'),auth[_0xa6d7('0x5')](),controller[_0xa6d7('0xd')]);router[_0xa6d7('0xe')](_0xa6d7('0x8'),auth[_0xa6d7('0x5')](),controller[_0xa6d7('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 0430758..76cd634 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 _0xe2cf=['crudPermissions','join','getDataValue','exports','STRING','BOOLEAN'];(function(_0x1a226a,_0x456900){var _0xe9655d=function(_0x3fe3a9){while(--_0x3fe3a9){_0x1a226a['push'](_0x1a226a['shift']());}};_0xe9655d(++_0x456900);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x5c5f2f,_0x4325f3){_0x5c5f2f=_0x5c5f2f-0x0;var _0x4ecef=_0xe2cf[_0x5c5f2f];return _0x4ecef;};'use strict';var Sequelize=require('sequelize');module[_0xfe2c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xfe2c('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xfe2c('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xfe2c('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xfe2c('0x1')],'set':function(_0x11b6b8){this['setDataValue'](_0xfe2c('0x3'),_0x11b6b8?_0x11b6b8[_0xfe2c('0x4')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0xfe2c('0x5')](_0xfe2c('0x3'))['split'](''):[];}}}; \ No newline at end of file +var _0x4213=['getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN','crudPermissions','join'];(function(_0x5269c5,_0x2d14b5){var _0x4e09e3=function(_0x6e9b18){while(--_0x6e9b18){_0x5269c5['push'](_0x5269c5['shift']());}};_0x4e09e3(++_0x2d14b5);}(_0x4213,0x77));var _0x3421=function(_0x16362e,_0x2f48f6){_0x16362e=_0x16362e-0x0;var _0x5209e4=_0x4213[_0x16362e];return _0x5209e4;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'name':{'type':Sequelize[_0x3421('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x3421('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3421('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x3421('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3421('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xdbd54e){this['setDataValue'](_0x3421('0x5'),_0xdbd54e?_0xdbd54e[_0x3421('0x6')](''):[]);},'get':function(){return this[_0x3421('0x7')](_0x3421('0x5'))?this['getDataValue'](_0x3421('0x5'))[_0x3421('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 21b3010..65a079c 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 _0x0ee4=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','sort','where','filter','merge','options','includeAll','findAll','rows','catch','params','include','create','body','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x100fae,_0x138367){var _0x3d62cf=function(_0x1683f8){while(--_0x1683f8){_0x100fae['push'](_0x100fae['shift']());}};_0x3d62cf(++_0x138367);}(_0x0ee4,0xca));var _0x40ee=function(_0x1e6861,_0x430894){_0x1e6861=_0x1e6861-0x0;var _0x335eb4=_0x0ee4[_0x1e6861];return _0x335eb4;};'use strict';var emlformat=require(_0x40ee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x40ee('0x1'));var rp=require(_0x40ee('0x2'));var moment=require(_0x40ee('0x3'));var BPromise=require(_0x40ee('0x4'));var Mustache=require('mustache');var util=require(_0x40ee('0x5'));var path=require('path');var sox=require(_0x40ee('0x6'));var csv=require(_0x40ee('0x7'));var ejs=require(_0x40ee('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x40ee('0x9'));var squel=require(_0x40ee('0xa'));var crypto=require(_0x40ee('0xb'));var jsforce=require(_0x40ee('0xc'));var deskjs=require(_0x40ee('0xd'));var toCsv=require(_0x40ee('0x7'));var querystring=require(_0x40ee('0xe'));var Papa=require(_0x40ee('0xf'));var Redis=require('ioredis');var authService=require(_0x40ee('0x10'));var qs=require(_0x40ee('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x40ee('0x12'));var logger=require(_0x40ee('0x13'))(_0x40ee('0x14'));var utils=require('../../config/utils');var config=require(_0x40ee('0x15'));var licenseUtil=require(_0x40ee('0x16'));var db=require(_0x40ee('0x17'))['db'];function respondWithStatusCode(_0x594bd2,_0x396026){_0x396026=_0x396026||0xcc;return function(_0xff9d18){if(_0xff9d18){return _0x594bd2[_0x40ee('0x18')](_0x396026);}return _0x594bd2[_0x40ee('0x19')](_0x396026)[_0x40ee('0x1a')]();};}function respondWithResult(_0x584b39,_0x37307c){_0x37307c=_0x37307c||0xc8;return function(_0x4abca0){if(_0x4abca0){return _0x584b39['status'](_0x37307c)[_0x40ee('0x1b')](_0x4abca0);}};}function respondWithFilteredResult(_0xe58550,_0x3dd02c){return function(_0x43d0d1){if(_0x43d0d1){var _0x1fccf4=typeof _0x3dd02c[_0x40ee('0x1c')]==='undefined'&&typeof _0x3dd02c[_0x40ee('0x1d')]===_0x40ee('0x1e');var _0x1497c3=_0x43d0d1['count'];var _0x3bb888=_0x1fccf4?0x0:_0x3dd02c['offset'];var _0x312bdc=_0x1fccf4?_0x43d0d1[_0x40ee('0x1f')]:_0x3dd02c[_0x40ee('0x1c')]+_0x3dd02c[_0x40ee('0x1d')];var _0x4ecfbc;if(_0x312bdc>=_0x1497c3){_0x312bdc=_0x1497c3;_0x4ecfbc=0xc8;}else{_0x4ecfbc=0xce;}_0xe58550['status'](_0x4ecfbc);return _0xe58550[_0x40ee('0x20')](_0x40ee('0x21'),_0x3bb888+'-'+_0x312bdc+'/'+_0x1497c3)['json'](_0x43d0d1);}return null;};}function patchUpdates(_0xea49fa){return function(_0x57da3f){try{jsonpatch[_0x40ee('0x22')](_0x57da3f,_0xea49fa,!![]);}catch(_0x4b9968){return BPromise['reject'](_0x4b9968);}return _0x57da3f[_0x40ee('0x23')]();};}function saveUpdates(_0x3c0bb4,_0x3caab9){return function(_0x694d3b){if(_0x694d3b){return _0x694d3b[_0x40ee('0x24')](_0x3c0bb4)[_0x40ee('0x25')](function(_0x425555){return _0x425555;});}return null;};}function removeEntity(_0x12b719,_0x247cf1){return function(_0x2e62a2){if(_0x2e62a2){return _0x2e62a2[_0x40ee('0x26')]()[_0x40ee('0x25')](function(){_0x12b719[_0x40ee('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cbf4d,_0x23c902){return function(_0x3f78a4){if(!_0x3f78a4){_0x1cbf4d['sendStatus'](0x194);}return _0x3f78a4;};}function handleError(_0x1bedb5,_0x1e64d3){_0x1e64d3=_0x1e64d3||0x1f4;return function(_0x16eb2a){logger[_0x40ee('0x27')](_0x16eb2a[_0x40ee('0x28')]);if(_0x16eb2a[_0x40ee('0x29')]){delete _0x16eb2a['name'];}_0x1bedb5[_0x40ee('0x19')](_0x1e64d3)[_0x40ee('0x2a')](_0x16eb2a);};}exports['index']=function(_0x5e0fcd,_0x4692a0){var _0x3b2111={},_0xa49c09={},_0x2df35f={'count':0x0,'rows':[]};var _0x11e3cd=_[_0x40ee('0x2b')](db[_0x40ee('0x2c')][_0x40ee('0x2d')],function(_0x35c150){return{'name':_0x35c150[_0x40ee('0x2e')],'type':_0x35c150[_0x40ee('0x2f')][_0x40ee('0x30')]};});_0xa49c09[_0x40ee('0x31')]=_['map'](_0x11e3cd,_0x40ee('0x29'));_0xa49c09['query']=_[_0x40ee('0x32')](_0x5e0fcd[_0x40ee('0x33')]);_0xa49c09[_0x40ee('0x34')]=_[_0x40ee('0x35')](_0xa49c09[_0x40ee('0x31')],_0xa49c09[_0x40ee('0x33')]);_0x3b2111['attributes']=_['intersection'](_0xa49c09[_0x40ee('0x31')],qs[_0x40ee('0x36')](_0x5e0fcd[_0x40ee('0x33')][_0x40ee('0x36')]));_0x3b2111[_0x40ee('0x37')]=_0x3b2111[_0x40ee('0x37')][_0x40ee('0x38')]?_0x3b2111['attributes']:_0xa49c09[_0x40ee('0x31')];if(!_0x5e0fcd[_0x40ee('0x33')]['hasOwnProperty']('nolimit')){_0x3b2111[_0x40ee('0x1d')]=qs[_0x40ee('0x1d')](_0x5e0fcd[_0x40ee('0x33')][_0x40ee('0x1d')]);_0x3b2111[_0x40ee('0x1c')]=qs[_0x40ee('0x1c')](_0x5e0fcd[_0x40ee('0x33')][_0x40ee('0x1c')]);}_0x3b2111['order']=qs[_0x40ee('0x39')](_0x5e0fcd[_0x40ee('0x33')][_0x40ee('0x39')]);_0x3b2111[_0x40ee('0x3a')]=qs['filters'](_['pick'](_0x5e0fcd[_0x40ee('0x33')],_0xa49c09[_0x40ee('0x34')]),_0x11e3cd);if(_0x5e0fcd['query'][_0x40ee('0x3b')]){_0x3b2111[_0x40ee('0x3a')]=_[_0x40ee('0x3c')](_0x3b2111[_0x40ee('0x3a')],{'$or':_[_0x40ee('0x2b')](_0x11e3cd,function(_0x3c0c3e){if(_0x3c0c3e[_0x40ee('0x2f')]!=='VIRTUAL'){var _0x2a4959={};_0x2a4959[_0x3c0c3e[_0x40ee('0x29')]]={'$like':'%'+_0x5e0fcd[_0x40ee('0x33')][_0x40ee('0x3b')]+'%'};return _0x2a4959;}})});}_0x3b2111=_['merge']({},_0x3b2111,_0x5e0fcd[_0x40ee('0x3d')]);var _0x146c5b={'where':_0x3b2111['where']};return db[_0x40ee('0x2c')][_0x40ee('0x1f')](_0x146c5b)['then'](function(_0x35d4cb){_0x2df35f[_0x40ee('0x1f')]=_0x35d4cb;if(_0x5e0fcd['query'][_0x40ee('0x3e')]){_0x3b2111['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x40ee('0x3f')](_0x3b2111);})[_0x40ee('0x25')](function(_0x4b9ddb){_0x2df35f[_0x40ee('0x40')]=_0x4b9ddb;return _0x2df35f;})['then'](respondWithFilteredResult(_0x4692a0,_0x3b2111))[_0x40ee('0x41')](handleError(_0x4692a0,null));};exports['show']=function(_0x4d8f17,_0x68295f){var _0x37995b={'raw':![],'where':{'id':_0x4d8f17[_0x40ee('0x42')]['id']}},_0x384696={};_0x384696[_0x40ee('0x31')]=_[_0x40ee('0x32')](db[_0x40ee('0x2c')][_0x40ee('0x2d')]);_0x384696[_0x40ee('0x33')]=_[_0x40ee('0x32')](_0x4d8f17[_0x40ee('0x33')]);_0x384696['filters']=_[_0x40ee('0x35')](_0x384696[_0x40ee('0x31')],_0x384696[_0x40ee('0x33')]);_0x37995b[_0x40ee('0x37')]=_[_0x40ee('0x35')](_0x384696['model'],qs[_0x40ee('0x36')](_0x4d8f17[_0x40ee('0x33')][_0x40ee('0x36')]));_0x37995b['attributes']=_0x37995b[_0x40ee('0x37')][_0x40ee('0x38')]?_0x37995b[_0x40ee('0x37')]:_0x384696[_0x40ee('0x31')];if(_0x4d8f17[_0x40ee('0x33')][_0x40ee('0x3e')]){_0x37995b[_0x40ee('0x43')]=[{'all':!![]}];}_0x37995b=_[_0x40ee('0x3c')]({},_0x37995b,_0x4d8f17[_0x40ee('0x3d')]);return db[_0x40ee('0x2c')]['find'](_0x37995b)[_0x40ee('0x25')](handleEntityNotFound(_0x68295f,null))['then'](respondWithResult(_0x68295f,null))['catch'](handleError(_0x68295f,null));};exports['create']=function(_0x2f0966,_0x51d250){return db[_0x40ee('0x2c')][_0x40ee('0x44')](_0x2f0966[_0x40ee('0x45')],{})['then'](respondWithResult(_0x51d250,0xc9))[_0x40ee('0x41')](handleError(_0x51d250,null));};exports['update']=function(_0x36755f,_0xa97d7f){if(_0x36755f[_0x40ee('0x45')]['id']){delete _0x36755f[_0x40ee('0x45')]['id'];}return db['UserProfileSection'][_0x40ee('0x46')]({'where':{'id':_0x36755f[_0x40ee('0x42')]['id']}})['then'](handleEntityNotFound(_0xa97d7f,null))[_0x40ee('0x25')](saveUpdates(_0x36755f[_0x40ee('0x45')],null))[_0x40ee('0x25')](respondWithResult(_0xa97d7f,null))[_0x40ee('0x41')](handleError(_0xa97d7f,null));};exports[_0x40ee('0x26')]=function(_0x5810f9,_0x4d2616){return db['UserProfileSection'][_0x40ee('0x46')]({'where':{'id':_0x5810f9[_0x40ee('0x42')]['id']}})[_0x40ee('0x25')](handleEntityNotFound(_0x4d2616,null))[_0x40ee('0x25')](removeEntity(_0x4d2616,null))[_0x40ee('0x41')](handleError(_0x4d2616,null));};exports[_0x40ee('0x47')]=function(_0x211088,_0xe8809f){return db[_0x40ee('0x2c')][_0x40ee('0x47')]()[_0x40ee('0x25')](respondWithResult(_0xe8809f,null))[_0x40ee('0x41')](handleError(_0xe8809f,null));}; \ No newline at end of file +var _0x6d4e=['hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','fields','find','create','body','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','query','intersection','attributes','model','length'];(function(_0x2e1692,_0x604aec){var _0x38724b=function(_0x16dd9d){while(--_0x16dd9d){_0x2e1692['push'](_0x2e1692['shift']());}};_0x38724b(++_0x604aec);}(_0x6d4e,0x1dd));var _0xe6d4=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x6d4e[_0x33032e];return _0x13316b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe6d4('0x0'));var zipdir=require(_0xe6d4('0x1'));var jsonpatch=require(_0xe6d4('0x2'));var rp=require('request-promise');var moment=require(_0xe6d4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe6d4('0x4'));var util=require(_0xe6d4('0x5'));var path=require('path');var sox=require(_0xe6d4('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe6d4('0x7'));var _=require(_0xe6d4('0x8'));var squel=require(_0xe6d4('0x9'));var crypto=require(_0xe6d4('0xa'));var jsforce=require(_0xe6d4('0xb'));var deskjs=require(_0xe6d4('0xc'));var toCsv=require(_0xe6d4('0xd'));var querystring=require(_0xe6d4('0xe'));var Papa=require(_0xe6d4('0xf'));var Redis=require(_0xe6d4('0x10'));var authService=require(_0xe6d4('0x11'));var qs=require(_0xe6d4('0x12'));var as=require(_0xe6d4('0x13'));var hardwareService=require(_0xe6d4('0x14'));var logger=require(_0xe6d4('0x15'))(_0xe6d4('0x16'));var utils=require(_0xe6d4('0x17'));var config=require(_0xe6d4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe6d4('0x19'))['db'];function respondWithStatusCode(_0xa635fb,_0x2941d6){_0x2941d6=_0x2941d6||0xcc;return function(_0x122b11){if(_0x122b11){return _0xa635fb['sendStatus'](_0x2941d6);}return _0xa635fb[_0xe6d4('0x1a')](_0x2941d6)[_0xe6d4('0x1b')]();};}function respondWithResult(_0x470c0c,_0x13a263){_0x13a263=_0x13a263||0xc8;return function(_0x59727c){if(_0x59727c){return _0x470c0c['status'](_0x13a263)[_0xe6d4('0x1c')](_0x59727c);}};}function respondWithFilteredResult(_0x3d485b,_0x2b1b22){return function(_0x4f117b){if(_0x4f117b){var _0x2e4afd=typeof _0x2b1b22[_0xe6d4('0x1d')]===_0xe6d4('0x1e')&&typeof _0x2b1b22[_0xe6d4('0x1f')]===_0xe6d4('0x1e');var _0x5e598c=_0x4f117b['count'];var _0x33d655=_0x2e4afd?0x0:_0x2b1b22[_0xe6d4('0x1d')];var _0x3b39bc=_0x2e4afd?_0x4f117b[_0xe6d4('0x20')]:_0x2b1b22[_0xe6d4('0x1d')]+_0x2b1b22[_0xe6d4('0x1f')];var _0x45755d;if(_0x3b39bc>=_0x5e598c){_0x3b39bc=_0x5e598c;_0x45755d=0xc8;}else{_0x45755d=0xce;}_0x3d485b[_0xe6d4('0x1a')](_0x45755d);return _0x3d485b['set'](_0xe6d4('0x21'),_0x33d655+'-'+_0x3b39bc+'/'+_0x5e598c)['json'](_0x4f117b);}return null;};}function patchUpdates(_0x514810){return function(_0x5cfdbb){try{jsonpatch['apply'](_0x5cfdbb,_0x514810,!![]);}catch(_0x3f96f){return BPromise[_0xe6d4('0x22')](_0x3f96f);}return _0x5cfdbb[_0xe6d4('0x23')]();};}function saveUpdates(_0x57d3b5,_0x33e818){return function(_0x244890){if(_0x244890){return _0x244890[_0xe6d4('0x24')](_0x57d3b5)['then'](function(_0x5c5d22){return _0x5c5d22;});}return null;};}function removeEntity(_0x56923c,_0x3cccd8){return function(_0x145ce2){if(_0x145ce2){return _0x145ce2[_0xe6d4('0x25')]()[_0xe6d4('0x26')](function(){_0x56923c[_0xe6d4('0x1a')](0xcc)[_0xe6d4('0x1b')]();});}};}function handleEntityNotFound(_0x38fe99,_0x1555cf){return function(_0x27e2cb){if(!_0x27e2cb){_0x38fe99[_0xe6d4('0x27')](0x194);}return _0x27e2cb;};}function handleError(_0x55d61d,_0x39697a){_0x39697a=_0x39697a||0x1f4;return function(_0x1397fe){logger['error'](_0x1397fe[_0xe6d4('0x28')]);if(_0x1397fe[_0xe6d4('0x29')]){delete _0x1397fe[_0xe6d4('0x29')];}_0x55d61d['status'](_0x39697a)[_0xe6d4('0x2a')](_0x1397fe);};}exports[_0xe6d4('0x2b')]=function(_0x5ea368,_0x34bc4f){var _0x4249fc={},_0x4f2095={},_0x451782={'count':0x0,'rows':[]};var _0x18f4aa=_[_0xe6d4('0x2c')](db[_0xe6d4('0x2d')][_0xe6d4('0x2e')],function(_0x25e6bb){return{'name':_0x25e6bb[_0xe6d4('0x2f')],'type':_0x25e6bb[_0xe6d4('0x30')][_0xe6d4('0x31')]};});_0x4f2095['model']=_['map'](_0x18f4aa,_0xe6d4('0x29'));_0x4f2095[_0xe6d4('0x32')]=_['keys'](_0x5ea368[_0xe6d4('0x32')]);_0x4f2095['filters']=_[_0xe6d4('0x33')](_0x4f2095['model'],_0x4f2095[_0xe6d4('0x32')]);_0x4249fc[_0xe6d4('0x34')]=_[_0xe6d4('0x33')](_0x4f2095[_0xe6d4('0x35')],qs['fields'](_0x5ea368[_0xe6d4('0x32')]['fields']));_0x4249fc[_0xe6d4('0x34')]=_0x4249fc[_0xe6d4('0x34')][_0xe6d4('0x36')]?_0x4249fc[_0xe6d4('0x34')]:_0x4f2095['model'];if(!_0x5ea368[_0xe6d4('0x32')][_0xe6d4('0x37')](_0xe6d4('0x38'))){_0x4249fc[_0xe6d4('0x1f')]=qs[_0xe6d4('0x1f')](_0x5ea368['query']['limit']);_0x4249fc[_0xe6d4('0x1d')]=qs[_0xe6d4('0x1d')](_0x5ea368[_0xe6d4('0x32')]['offset']);}_0x4249fc[_0xe6d4('0x39')]=qs['sort'](_0x5ea368[_0xe6d4('0x32')][_0xe6d4('0x3a')]);_0x4249fc[_0xe6d4('0x3b')]=qs[_0xe6d4('0x3c')](_['pick'](_0x5ea368[_0xe6d4('0x32')],_0x4f2095[_0xe6d4('0x3c')]),_0x18f4aa);if(_0x5ea368[_0xe6d4('0x32')][_0xe6d4('0x3d')]){_0x4249fc[_0xe6d4('0x3b')]=_[_0xe6d4('0x3e')](_0x4249fc[_0xe6d4('0x3b')],{'$or':_[_0xe6d4('0x2c')](_0x18f4aa,function(_0x132fb4){if(_0x132fb4[_0xe6d4('0x30')]!==_0xe6d4('0x3f')){var _0x90043b={};_0x90043b[_0x132fb4[_0xe6d4('0x29')]]={'$like':'%'+_0x5ea368[_0xe6d4('0x32')]['filter']+'%'};return _0x90043b;}})});}_0x4249fc=_[_0xe6d4('0x3e')]({},_0x4249fc,_0x5ea368[_0xe6d4('0x40')]);var _0x105692={'where':_0x4249fc['where']};return db['UserProfileSection']['count'](_0x105692)[_0xe6d4('0x26')](function(_0x3bb18e){_0x451782[_0xe6d4('0x20')]=_0x3bb18e;if(_0x5ea368[_0xe6d4('0x32')][_0xe6d4('0x41')]){_0x4249fc[_0xe6d4('0x42')]=[{'all':!![]}];}return db[_0xe6d4('0x2d')][_0xe6d4('0x43')](_0x4249fc);})[_0xe6d4('0x26')](function(_0x33fef0){_0x451782[_0xe6d4('0x44')]=_0x33fef0;return _0x451782;})[_0xe6d4('0x26')](respondWithFilteredResult(_0x34bc4f,_0x4249fc))[_0xe6d4('0x45')](handleError(_0x34bc4f,null));};exports['show']=function(_0x2e38a9,_0x1b61f1){var _0x24d09d={'raw':![],'where':{'id':_0x2e38a9[_0xe6d4('0x46')]['id']}},_0x2bc840={};_0x2bc840['model']=_[_0xe6d4('0x47')](db[_0xe6d4('0x2d')][_0xe6d4('0x2e')]);_0x2bc840['query']=_[_0xe6d4('0x47')](_0x2e38a9[_0xe6d4('0x32')]);_0x2bc840[_0xe6d4('0x3c')]=_[_0xe6d4('0x33')](_0x2bc840['model'],_0x2bc840['query']);_0x24d09d[_0xe6d4('0x34')]=_['intersection'](_0x2bc840[_0xe6d4('0x35')],qs[_0xe6d4('0x48')](_0x2e38a9[_0xe6d4('0x32')][_0xe6d4('0x48')]));_0x24d09d[_0xe6d4('0x34')]=_0x24d09d[_0xe6d4('0x34')]['length']?_0x24d09d['attributes']:_0x2bc840[_0xe6d4('0x35')];if(_0x2e38a9[_0xe6d4('0x32')][_0xe6d4('0x41')]){_0x24d09d['include']=[{'all':!![]}];}_0x24d09d=_['merge']({},_0x24d09d,_0x2e38a9[_0xe6d4('0x40')]);return db['UserProfileSection'][_0xe6d4('0x49')](_0x24d09d)[_0xe6d4('0x26')](handleEntityNotFound(_0x1b61f1,null))[_0xe6d4('0x26')](respondWithResult(_0x1b61f1,null))[_0xe6d4('0x45')](handleError(_0x1b61f1,null));};exports[_0xe6d4('0x4a')]=function(_0x11c1d3,_0x2ac8f0){return db[_0xe6d4('0x2d')][_0xe6d4('0x4a')](_0x11c1d3[_0xe6d4('0x4b')],{})[_0xe6d4('0x26')](respondWithResult(_0x2ac8f0,0xc9))[_0xe6d4('0x45')](handleError(_0x2ac8f0,null));};exports[_0xe6d4('0x24')]=function(_0x4ee900,_0x59a8d4){if(_0x4ee900['body']['id']){delete _0x4ee900[_0xe6d4('0x4b')]['id'];}return db[_0xe6d4('0x2d')][_0xe6d4('0x49')]({'where':{'id':_0x4ee900[_0xe6d4('0x46')]['id']}})['then'](handleEntityNotFound(_0x59a8d4,null))[_0xe6d4('0x26')](saveUpdates(_0x4ee900[_0xe6d4('0x4b')],null))['then'](respondWithResult(_0x59a8d4,null))[_0xe6d4('0x45')](handleError(_0x59a8d4,null));};exports[_0xe6d4('0x25')]=function(_0x14de86,_0x37d785){return db[_0xe6d4('0x2d')][_0xe6d4('0x49')]({'where':{'id':_0x14de86[_0xe6d4('0x46')]['id']}})['then'](handleEntityNotFound(_0x37d785,null))[_0xe6d4('0x26')](removeEntity(_0x37d785,null))[_0xe6d4('0x45')](handleError(_0x37d785,null));};exports['describe']=function(_0x49055a,_0x3b6849){return db[_0xe6d4('0x2d')]['describe']()['then'](respondWithResult(_0x3b6849,null))[_0xe6d4('0x45')](handleError(_0x3b6849,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 272c0f6..9c60585 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 _0xa811=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','userProfileId','lodash','util'];(function(_0x6ea8a2,_0x561d6c){var _0x4fe938=function(_0x1efa6c){while(--_0x1efa6c){_0x6ea8a2['push'](_0x6ea8a2['shift']());}};_0x4fe938(++_0x561d6c);}(_0xa811,0x1de));var _0x1a81=function(_0x385cac,_0x196617){_0x385cac=_0x385cac-0x0;var _0xc0e067=_0xa811[_0x385cac];return _0xc0e067;};'use strict';var _=require(_0x1a81('0x0'));var util=require(_0x1a81('0x1'));var logger=require(_0x1a81('0x2'))(_0x1a81('0x3'));var moment=require(_0x1a81('0x4'));var BPromise=require(_0x1a81('0x5'));var rp=require(_0x1a81('0x6'));var fs=require('fs');var path=require(_0x1a81('0x7'));var rimraf=require(_0x1a81('0x8'));var config=require(_0x1a81('0x9'));var attributes=require(_0x1a81('0xa'));module[_0x1a81('0xb')]=function(_0x5eb8c1,_0x4ee147){return _0x5eb8c1[_0x1a81('0xc')]('UserProfileSection',attributes,{'tableName':_0x1a81('0xd'),'paranoid':![],'indexes':[{'name':_0x1a81('0xe'),'fields':['sectionId',_0x1a81('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbcff=['../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','../../config/logger','moment','bluebird','rimraf'];(function(_0x1c7e4d,_0x1d0390){var _0x26c510=function(_0x53aad7){while(--_0x53aad7){_0x1c7e4d['push'](_0x1c7e4d['shift']());}};_0x26c510(++_0x1d0390);}(_0xbcff,0xbb));var _0xfbcf=function(_0x308aa8,_0x39ae16){_0x308aa8=_0x308aa8-0x0;var _0x5f10c9=_0xbcff[_0x308aa8];return _0x5f10c9;};'use strict';var _=require(_0xfbcf('0x0'));var util=require('util');var logger=require(_0xfbcf('0x1'))('api');var moment=require(_0xfbcf('0x2'));var BPromise=require(_0xfbcf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfbcf('0x4'));var config=require(_0xfbcf('0x5'));var attributes=require('./userProfileSection.attributes');module[_0xfbcf('0x6')]=function(_0x454884,_0x33bde0){return _0x454884[_0xfbcf('0x7')](_0xfbcf('0x8'),attributes,{'tableName':_0xfbcf('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xfbcf('0xa'),_0xfbcf('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 44db998..aa5ec14 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 _0x89db=['../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','debug','stringify','error','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1e33fd,_0x12d3a5){var _0x4f4ea7=function(_0x3118e0){while(--_0x3118e0){_0x1e33fd['push'](_0x1e33fd['shift']());}};_0x4f4ea7(++_0x12d3a5);}(_0x89db,0x1c7));var _0xb89d=function(_0x41d934,_0x141cc0){_0x41d934=_0x41d934-0x0;var _0x5dcc0c=_0x89db[_0x41d934];return _0x5dcc0c;};'use strict';var _=require(_0xb89d('0x0'));var util=require(_0xb89d('0x1'));var moment=require(_0xb89d('0x2'));var BPromise=require(_0xb89d('0x3'));var rs=require(_0xb89d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb89d('0x5'));var logger=require(_0xb89d('0x6'))(_0xb89d('0x7'));var config=require(_0xb89d('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2945b8,_0x2767b3,_0x1d0d71){return new BPromise(function(_0x46d534,_0x598cc1){return client[_0xb89d('0x9')](_0x2945b8,_0x1d0d71)[_0xb89d('0xa')](function(_0x6565a2){logger[_0xb89d('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x2767b3,_0xb89d('0xc'));logger[_0xb89d('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2767b3,'request\x20sent',JSON[_0xb89d('0xe')](_0x6565a2));if(_0x6565a2['error']){if(_0x6565a2[_0xb89d('0xf')]['code']===0x1f4){logger[_0xb89d('0xf')](_0xb89d('0x10'),_0x2767b3,_0x6565a2['error'][_0xb89d('0x11')]);return _0x598cc1(_0x6565a2['error'][_0xb89d('0x11')]);}logger[_0xb89d('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x2767b3,_0x6565a2['error']['message']);return _0x46d534(_0x6565a2[_0xb89d('0xf')][_0xb89d('0x11')]);}else{logger[_0xb89d('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x2767b3,_0xb89d('0xc'));_0x46d534(_0x6565a2[_0xb89d('0x12')][_0xb89d('0x11')]);}})[_0xb89d('0x13')](function(_0x371bc8){logger[_0xb89d('0xf')](_0xb89d('0x10'),_0x2767b3,_0x371bc8);_0x598cc1(_0x371bc8);});});} \ No newline at end of file +var _0x38bb=['jayson/promise','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1740cd,_0x612d4b){var _0x216e45=function(_0x404640){while(--_0x404640){_0x1740cd['push'](_0x1740cd['shift']());}};_0x216e45(++_0x612d4b);}(_0x38bb,0x102));var _0xb38b=function(_0x40672c,_0x391d1e){_0x40672c=_0x40672c-0x0;var _0x29e0bb=_0x38bb[_0x40672c];return _0x29e0bb;};'use strict';var _=require(_0xb38b('0x0'));var util=require(_0xb38b('0x1'));var moment=require('moment');var BPromise=require(_0xb38b('0x2'));var rs=require(_0xb38b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb38b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb38b('0x5'))(_0xb38b('0x6'));var config=require(_0xb38b('0x7'));var jayson=require(_0xb38b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10ecd5,_0x49a207,_0x126924){return new BPromise(function(_0x2be360,_0x5bbe4e){return client[_0xb38b('0x9')](_0x10ecd5,_0x126924)[_0xb38b('0xa')](function(_0x43b5a7){logger[_0xb38b('0xb')](_0xb38b('0xc'),_0x49a207,_0xb38b('0xd'));logger[_0xb38b('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x49a207,_0xb38b('0xd'),JSON[_0xb38b('0xf')](_0x43b5a7));if(_0x43b5a7[_0xb38b('0x10')]){if(_0x43b5a7[_0xb38b('0x10')]['code']===0x1f4){logger[_0xb38b('0x10')](_0xb38b('0xc'),_0x49a207,_0x43b5a7[_0xb38b('0x10')][_0xb38b('0x11')]);return _0x5bbe4e(_0x43b5a7[_0xb38b('0x10')][_0xb38b('0x11')]);}logger[_0xb38b('0x10')](_0xb38b('0xc'),_0x49a207,_0x43b5a7[_0xb38b('0x10')][_0xb38b('0x11')]);return _0x2be360(_0x43b5a7[_0xb38b('0x10')][_0xb38b('0x11')]);}else{logger[_0xb38b('0xb')](_0xb38b('0xc'),_0x49a207,_0xb38b('0xd'));_0x2be360(_0x43b5a7['result'][_0xb38b('0x11')]);}})[_0xb38b('0x12')](function(_0x16e9e4){logger[_0xb38b('0x10')](_0xb38b('0xc'),_0x49a207,_0x16e9e4);_0x5bbe4e(_0x16e9e4);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 78c6a10..baa3cc3 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x25659c,_0x2dea5e){var _0x2a0749=function(_0x20f344){while(--_0x20f344){_0x25659c['push'](_0x25659c['shift']());}};_0x2a0749(++_0x2dea5e);}(_0xe706,0xa3));var _0x6e70=function(_0x31d849,_0x3db9bc){_0x31d849=_0x31d849-0x0;var _0x1c55b3=_0xe706[_0x31d849];return _0x1c55b3;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1d6535,_0x2d00b6){var _0xb56a6=function(_0x57be18){while(--_0x57be18){_0x1d6535['push'](_0x1d6535['shift']());}};_0xb56a6(++_0x2d00b6);}(_0x70e0,0x17b));var _0x070e=function(_0x5322b0,_0xed0037){_0x5322b0=_0x5322b0-0x0;var _0x203b70=_0x70e0[_0x5322b0];return _0x203b70;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 9a08948..7317047 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 _0xa2fb=['exports','INTEGER','sequelize'];(function(_0x38c6f2,_0x4a3579){var _0x2125f0=function(_0x23e2af){while(--_0x23e2af){_0x38c6f2['push'](_0x38c6f2['shift']());}};_0x2125f0(++_0x4a3579);}(_0xa2fb,0x188));var _0xba2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa2fb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xba2f('0x0'));module[_0xba2f('0x1')]={'penalty':{'type':Sequelize[_0xba2f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfd35=['INTEGER','sequelize','exports'];(function(_0x34c45b,_0x51d680){var _0x3e9a5f=function(_0x3f8f31){while(--_0x3f8f31){_0x34c45b['push'](_0x34c45b['shift']());}};_0x3e9a5f(++_0x51d680);}(_0xfd35,0x6d));var _0x5fd3=function(_0x34e939,_0x26bc81){_0x34e939=_0x34e939-0x0;var _0xcb77df=_0xfd35[_0x34e939];return _0xcb77df;};'use strict';var Sequelize=require(_0x5fd3('0x0'));module[_0x5fd3('0x1')]={'penalty':{'type':Sequelize[_0x5fd3('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index b711bfe..f7e1ae3 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 _0x2675=['lodash','moment','bluebird','path','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue'];(function(_0x334578,_0x4f68f1){var _0x11d272=function(_0x5dd791){while(--_0x5dd791){_0x334578['push'](_0x334578['shift']());}};_0x11d272(++_0x4f68f1);}(_0x2675,0x75));var _0x5267=function(_0x1724b1,_0x4766a1){_0x1724b1=_0x1724b1-0x0;var _0x33e021=_0x2675[_0x1724b1];return _0x33e021;};'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':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd2e=['./userSmsQueue.attributes','user_has_sms_queues','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xafa225,_0xd29c03){var _0x4f546a=function(_0x565b3f){while(--_0x565b3f){_0xafa225['push'](_0xafa225['shift']());}};_0x4f546a(++_0xd29c03);}(_0xfd2e,0x6e));var _0xefd2=function(_0x39808d,_0x330490){_0x39808d=_0x39808d-0x0;var _0x1899f5=_0xfd2e[_0x39808d];return _0x1899f5;};'use strict';var _=require(_0xefd2('0x0'));var util=require('util');var logger=require(_0xefd2('0x1'))('api');var moment=require(_0xefd2('0x2'));var BPromise=require('bluebird');var rp=require(_0xefd2('0x3'));var fs=require('fs');var path=require(_0xefd2('0x4'));var rimraf=require(_0xefd2('0x5'));var config=require(_0xefd2('0x6'));var attributes=require(_0xefd2('0x7'));module['exports']=function(_0x5124c6,_0x40e76c){return _0x5124c6['define']('UserSmsQueue',attributes,{'tableName':_0xefd2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index da3d9e6..8f3a422 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 _0xdad4=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xe75355,_0xcf85ce){var _0x335e32=function(_0x361cc6){while(--_0x361cc6){_0xe75355['push'](_0xe75355['shift']());}};_0x335e32(++_0xcf85ce);}(_0xdad4,0x1e9));var _0x4dad=function(_0xfd183f,_0x21bbde){_0xfd183f=_0xfd183f-0x0;var _0x40b42e=_0xdad4[_0xfd183f];return _0x40b42e;};'use strict';var _=require('lodash');var util=require(_0x4dad('0x0'));var moment=require(_0x4dad('0x1'));var BPromise=require(_0x4dad('0x2'));var rs=require(_0x4dad('0x3'));var fs=require('fs');var Redis=require(_0x4dad('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4dad('0x5'));var logger=require(_0x4dad('0x6'))(_0x4dad('0x7'));var config=require(_0x4dad('0x8'));var jayson=require(_0x4dad('0x9'));var client=jayson[_0x4dad('0xa')][_0x4dad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c2ea4,_0x51d153,_0x5b4329){return new BPromise(function(_0x47c67f,_0x571fb5){return client[_0x4dad('0xc')](_0x1c2ea4,_0x5b4329)[_0x4dad('0xd')](function(_0x437df2){logger[_0x4dad('0xe')](_0x4dad('0xf'),_0x51d153,_0x4dad('0x10'));logger[_0x4dad('0x11')](_0x4dad('0x12'),_0x51d153,_0x4dad('0x10'),JSON[_0x4dad('0x13')](_0x437df2));if(_0x437df2['error']){if(_0x437df2[_0x4dad('0x14')]['code']===0x1f4){logger[_0x4dad('0x14')](_0x4dad('0xf'),_0x51d153,_0x437df2[_0x4dad('0x14')]['message']);return _0x571fb5(_0x437df2['error'][_0x4dad('0x15')]);}logger[_0x4dad('0x14')](_0x4dad('0xf'),_0x51d153,_0x437df2['error']['message']);return _0x47c67f(_0x437df2[_0x4dad('0x14')]['message']);}else{logger[_0x4dad('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x51d153,_0x4dad('0x10'));_0x47c67f(_0x437df2[_0x4dad('0x16')][_0x4dad('0x15')]);}})[_0x4dad('0x17')](function(_0x384925){logger[_0x4dad('0x14')](_0x4dad('0xf'),_0x51d153,_0x384925);_0x571fb5(_0x384925);});});} \ No newline at end of file +var _0xc2c2=['../../config/environment','jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','moment','bluebird','randomstring','../../config/utils','rpc'];(function(_0x5906a5,_0x48af0a){var _0x1b9a31=function(_0x4b72ac){while(--_0x4b72ac){_0x5906a5['push'](_0x5906a5['shift']());}};_0x1b9a31(++_0x48af0a);}(_0xc2c2,0x19e));var _0x2c2c=function(_0x6d13ac,_0x418c22){_0x6d13ac=_0x6d13ac-0x0;var _0x56c1a0=_0xc2c2[_0x6d13ac];return _0x56c1a0;};'use strict';var _=require(_0x2c2c('0x0'));var util=require('util');var moment=require(_0x2c2c('0x1'));var BPromise=require(_0x2c2c('0x2'));var rs=require(_0x2c2c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2c2c('0x4'));var logger=require('../../config/logger')(_0x2c2c('0x5'));var config=require(_0x2c2c('0x6'));var jayson=require(_0x2c2c('0x7'));var client=jayson[_0x2c2c('0x8')][_0x2c2c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25fa0d,_0x561140,_0x28c30d){return new BPromise(function(_0x42c881,_0x59d3b3){return client[_0x2c2c('0xa')](_0x25fa0d,_0x28c30d)[_0x2c2c('0xb')](function(_0x4a15ec){logger['info'](_0x2c2c('0xc'),_0x561140,_0x2c2c('0xd'));logger[_0x2c2c('0xe')](_0x2c2c('0xf'),_0x561140,_0x2c2c('0xd'),JSON['stringify'](_0x4a15ec));if(_0x4a15ec[_0x2c2c('0x10')]){if(_0x4a15ec[_0x2c2c('0x10')]['code']===0x1f4){logger[_0x2c2c('0x10')](_0x2c2c('0xc'),_0x561140,_0x4a15ec['error'][_0x2c2c('0x11')]);return _0x59d3b3(_0x4a15ec['error']['message']);}logger[_0x2c2c('0x10')](_0x2c2c('0xc'),_0x561140,_0x4a15ec[_0x2c2c('0x10')]['message']);return _0x42c881(_0x4a15ec[_0x2c2c('0x10')][_0x2c2c('0x11')]);}else{logger[_0x2c2c('0x12')](_0x2c2c('0xc'),_0x561140,_0x2c2c('0xd'));_0x42c881(_0x4a15ec[_0x2c2c('0x13')]['message']);}})['catch'](function(_0x4b5327){logger[_0x2c2c('0x10')](_0x2c2c('0xc'),_0x561140,_0x4b5327);_0x59d3b3(_0x4b5327);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index a277124..bede558 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 _0x14aa=['exports','INTEGER'];(function(_0xebcdd6,_0x475de3){var _0x58e206=function(_0x585319){while(--_0x585319){_0xebcdd6['push'](_0xebcdd6['shift']());}};_0x58e206(++_0x475de3);}(_0x14aa,0xf8));var _0xa14a=function(_0x1327ed,_0x85e5a0){_0x1327ed=_0x1327ed-0x0;var _0x3c95cb=_0x14aa[_0x1327ed];return _0x3c95cb;};'use strict';var Sequelize=require('sequelize');module[_0xa14a('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xa14a('0x1')]}}; \ No newline at end of file +var _0x1220=['INTEGER','exports'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x1220,0x7f));var _0x0122=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1220[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0x0122('0x0')]={'UserId':{'type':Sequelize[_0x0122('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 0e69596..3a5b408 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(_0x190574,_0x561042){var _0x5b2e93=function(_0x40a81e){while(--_0x40a81e){_0x190574['push'](_0x190574['shift']());}};_0x5b2e93(++_0x561042);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x36fba4,_0x3ce6ee){var _0x27bb72=function(_0x2e4187){while(--_0x2e4187){_0x36fba4['push'](_0x36fba4['shift']());}};_0x27bb72(++_0x3ce6ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 94ab748..53960ed 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x21b929,_0x49c489){var _0x301e84=function(_0x28a619){while(--_0x28a619){_0x21b929['push'](_0x21b929['shift']());}};_0x301e84(++_0x49c489);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3e627c,_0x590e10){var _0x16f290=function(_0x53d7da){while(--_0x53d7da){_0x3e627c['push'](_0x3e627c['shift']());}};_0x16f290(++_0x590e10);}(_0x70e0,0x17b));var _0x070e=function(_0x3c6e7e,_0x50ce25){_0x3c6e7e=_0x3c6e7e-0x0;var _0x14a494=_0x70e0[_0x3c6e7e];return _0x14a494;};'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 173aa5f..9006424 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 _0x2271=['INTEGER','sequelize'];(function(_0xcd8338,_0x2771e4){var _0x2cc71d=function(_0x33c0a4){while(--_0x33c0a4){_0xcd8338['push'](_0xcd8338['shift']());}};_0x2cc71d(++_0x2771e4);}(_0x2271,0x133));var _0x1227=function(_0x33e572,_0x4024f5){_0x33e572=_0x33e572-0x0;var _0x1513eb=_0x2271[_0x33e572];return _0x1513eb;};'use strict';var Sequelize=require(_0x1227('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x1227('0x1')],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 0f89cb7..2a89025 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 _0x9b63=['UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','request-promise','rimraf','./userVoiceQueue.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b63,0x110));var _0x39b6=function(_0x553e6a,_0x495b2d){_0x553e6a=_0x553e6a-0x0;var _0x1ea151=_0x9b63[_0x553e6a];return _0x1ea151;};'use strict';var _=require(_0x39b6('0x0'));var util=require('util');var logger=require(_0x39b6('0x1'))(_0x39b6('0x2'));var moment=require(_0x39b6('0x3'));var BPromise=require('bluebird');var rp=require(_0x39b6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39b6('0x5'));var config=require('../../config/environment');var attributes=require(_0x39b6('0x6'));module['exports']=function(_0x3e71c5,_0x1f2a16){return _0x3e71c5[_0x39b6('0x7')](_0x39b6('0x8'),attributes,{'tableName':_0x39b6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66ee=['rimraf','../../config/environment','./userVoiceQueue.attributes','define','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3c88b8,_0x2472cf){var _0x1532f9=function(_0x180059){while(--_0x180059){_0x3c88b8['push'](_0x3c88b8['shift']());}};_0x1532f9(++_0x2472cf);}(_0x66ee,0xb4));var _0xe66e=function(_0x168134,_0x1edc4e){_0x168134=_0x168134-0x0;var _0x1bb0e9=_0x66ee[_0x168134];return _0x1bb0e9;};'use strict';var _=require('lodash');var util=require(_0xe66e('0x0'));var logger=require(_0xe66e('0x1'))(_0xe66e('0x2'));var moment=require(_0xe66e('0x3'));var BPromise=require(_0xe66e('0x4'));var rp=require(_0xe66e('0x5'));var fs=require('fs');var path=require(_0xe66e('0x6'));var rimraf=require(_0xe66e('0x7'));var config=require(_0xe66e('0x8'));var attributes=require(_0xe66e('0x9'));module['exports']=function(_0x12d067,_0x12d06e){return _0x12d067[_0xe66e('0xa')]('UserVoiceQueue',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 6751648..127eb96 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 _0xd4cb=['error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x16b433,_0x968d63){var _0x37d8a9=function(_0x5c4873){while(--_0x5c4873){_0x16b433['push'](_0x16b433['shift']());}};_0x37d8a9(++_0x968d63);}(_0xd4cb,0x1e0));var _0xbd4c=function(_0x3eaf59,_0x12af18){_0x3eaf59=_0x3eaf59-0x0;var _0xd47b2b=_0xd4cb[_0x3eaf59];return _0xd47b2b;};'use strict';var _=require(_0xbd4c('0x0'));var util=require('util');var moment=require(_0xbd4c('0x1'));var BPromise=require(_0xbd4c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd4c('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xbd4c('0x4'));var jayson=require(_0xbd4c('0x5'));var client=jayson[_0xbd4c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d18c2,_0x4f7bd7,_0x1912f5){return new BPromise(function(_0x3e6fd8,_0x2577a9){return client[_0xbd4c('0x7')](_0x1d18c2,_0x1912f5)[_0xbd4c('0x8')](function(_0xf3262b){logger[_0xbd4c('0x9')](_0xbd4c('0xa'),_0x4f7bd7,_0xbd4c('0xb'));logger[_0xbd4c('0xc')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4f7bd7,_0xbd4c('0xb'),JSON[_0xbd4c('0xd')](_0xf3262b));if(_0xf3262b['error']){if(_0xf3262b[_0xbd4c('0xe')][_0xbd4c('0xf')]===0x1f4){logger[_0xbd4c('0xe')](_0xbd4c('0xa'),_0x4f7bd7,_0xf3262b['error'][_0xbd4c('0x10')]);return _0x2577a9(_0xf3262b['error'][_0xbd4c('0x10')]);}logger['error'](_0xbd4c('0xa'),_0x4f7bd7,_0xf3262b[_0xbd4c('0xe')][_0xbd4c('0x10')]);return _0x3e6fd8(_0xf3262b[_0xbd4c('0xe')][_0xbd4c('0x10')]);}else{logger[_0xbd4c('0x9')]('UserVoiceQueue,\x20%s,\x20%s',_0x4f7bd7,_0xbd4c('0xb'));_0x3e6fd8(_0xf3262b[_0xbd4c('0x11')][_0xbd4c('0x10')]);}})[_0xbd4c('0x12')](function(_0x100572){logger[_0xbd4c('0xe')](_0xbd4c('0xa'),_0x4f7bd7,_0x100572);_0x2577a9(_0x100572);});});} \ No newline at end of file +var _0xc6c0=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','message','UserVoiceQueue,\x20%s,\x20%s','info','result','lodash','util','ioredis'];(function(_0x19996d,_0x28545c){var _0x4c38bc=function(_0x3abcc8){while(--_0x3abcc8){_0x19996d['push'](_0x19996d['shift']());}};_0x4c38bc(++_0x28545c);}(_0xc6c0,0x1b5));var _0x0c6c=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0xc6c0[_0x51fe5f];return _0x4abce9;};'use strict';var _=require(_0x0c6c('0x0'));var util=require(_0x0c6c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c6c('0x2'));var db=require(_0x0c6c('0x3'))['db'];var utils=require(_0x0c6c('0x4'));var logger=require(_0x0c6c('0x5'))('rpc');var config=require(_0x0c6c('0x6'));var jayson=require(_0x0c6c('0x7'));var client=jayson[_0x0c6c('0x8')][_0x0c6c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56c858,_0x40404f,_0x19d65b){return new BPromise(function(_0x378487,_0x3f0597){return client['request'](_0x56c858,_0x19d65b)[_0x0c6c('0xa')](function(_0x577653){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x40404f,_0x0c6c('0xb'));logger[_0x0c6c('0xc')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x40404f,_0x0c6c('0xb'),JSON[_0x0c6c('0xd')](_0x577653));if(_0x577653[_0x0c6c('0xe')]){if(_0x577653[_0x0c6c('0xe')][_0x0c6c('0xf')]===0x1f4){logger[_0x0c6c('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x40404f,_0x577653['error'][_0x0c6c('0x10')]);return _0x3f0597(_0x577653['error']['message']);}logger[_0x0c6c('0xe')](_0x0c6c('0x11'),_0x40404f,_0x577653[_0x0c6c('0xe')][_0x0c6c('0x10')]);return _0x378487(_0x577653[_0x0c6c('0xe')]['message']);}else{logger[_0x0c6c('0x12')](_0x0c6c('0x11'),_0x40404f,_0x0c6c('0xb'));_0x378487(_0x577653[_0x0c6c('0x13')][_0x0c6c('0x10')]);}})['catch'](function(_0x5560bf){logger['error'](_0x0c6c('0x11'),_0x40404f,_0x5560bf);_0x3f0597(_0x5560bf);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 2593c8e..baba540 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x544072,_0xc41ee1){var _0x590bf6=function(_0x41107f){while(--_0x41107f){_0x544072['push'](_0x544072['shift']());}};_0x590bf6(++_0xc41ee1);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x56f5ee,_0x2c8482){var _0x18054e=function(_0x143d05){while(--_0x143d05){_0x56f5ee['push'](_0x56f5ee['shift']());}};_0x18054e(++_0x2c8482);}(_0x70e0,0x17b));var _0x070e=function(_0x2e35e2,_0x3acc2e){_0x2e35e2=_0x2e35e2-0x0;var _0x145eca=_0x70e0[_0x2e35e2];return _0x145eca;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 05269de..fee7409 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 _0xbd23=['queue_interface','sequelize','exports','Required\x20by\x20Asterisk','INTEGER','STRING'];(function(_0x1aee2b,_0x23c1ee){var _0x20a746=function(_0x7a1f78){while(--_0x7a1f78){_0x1aee2b['push'](_0x1aee2b['shift']());}};_0x20a746(++_0x23c1ee);}(_0xbd23,0x9d));var _0x3bd2=function(_0x200427,_0x5119c3){_0x200427=_0x200427-0x0;var _0x88b56b=_0xbd23[_0x200427];return _0x88b56b;};'use strict';var Sequelize=require(_0x3bd2('0x0'));module[_0x3bd2('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3bd2('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x3bd2('0x2')},'UserId':{'type':Sequelize[_0x3bd2('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3bd2('0x4')],'allowNull':![],'unique':_0x3bd2('0x5'),'comment':_0x3bd2('0x2')},'VoiceQueueId':{'type':Sequelize[_0x3bd2('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0x3bd2('0x4')],'allowNull':![],'unique':_0x3bd2('0x5'),'comment':_0x3bd2('0x2')},'penalty':{'type':Sequelize[_0x3bd2('0x3')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x3bd2('0x3')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x06dc=['STRING','queue_interface','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x3fc827,_0x3a258f){var _0x19feed=function(_0x1837b3){while(--_0x1837b3){_0x3fc827['push'](_0x3fc827['shift']());}};_0x19feed(++_0x3a258f);}(_0x06dc,0x89));var _0xc06d=function(_0x176d14,_0x3984ea){_0x176d14=_0x176d14-0x0;var _0x89522c=_0x06dc[_0x176d14];return _0x89522c;};'use strict';var Sequelize=require('sequelize');module[_0xc06d('0x0')]={'uniqueid':{'type':Sequelize[_0xc06d('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xc06d('0x2')},'membername':{'type':Sequelize[_0xc06d('0x3')],'allowNull':![],'comment':_0xc06d('0x2')},'UserId':{'type':Sequelize[_0xc06d('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xc06d('0x3')],'allowNull':![],'unique':_0xc06d('0x4'),'comment':_0xc06d('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xc06d('0x3')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xc06d('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xc06d('0x1')](0xb),'defaultValue':0x0,'comment':_0xc06d('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index acbc2ef..34bd529 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 _0xbddf=['save','remove','emit','hasOwnProperty','hook','exports','events','UserVoiceQueueRt','setMaxListeners'];(function(_0x502694,_0x47dc80){var _0x1f28bc=function(_0x40d376){while(--_0x40d376){_0x502694['push'](_0x502694['shift']());}};_0x1f28bc(++_0x47dc80);}(_0xbddf,0x1bf));var _0xfbdd=function(_0x5b4064,_0x4b62a1){_0x5b4064=_0x5b4064-0x0;var _0x4a8001=_0xbddf[_0x5b4064];return _0x4a8001;};'use strict';var EventEmitter=require(_0xfbdd('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xfbdd('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xfbdd('0x2')](0x0);var events={'afterCreate':_0xfbdd('0x3'),'afterUpdate':'update','afterDestroy':_0xfbdd('0x4')};function emitEvent(_0x5b6f79){return function(_0x4860b1,_0x4de453,_0x4e5e51){UserVoiceQueueRtEvents[_0xfbdd('0x5')](_0x5b6f79+':'+_0x4860b1['id'],_0x4860b1);UserVoiceQueueRtEvents[_0xfbdd('0x5')](_0x5b6f79,_0x4860b1);_0x4e5e51(null);};}for(var e in events){if(events[_0xfbdd('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xfbdd('0x7')](e,emitEvent(event));}}module[_0xfbdd('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xb1f7=['hook','exports','events','UserVoiceQueueRt','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb1f7,0xfe));var _0x7b1f=function(_0x5e0f61,_0x1f5adb){_0x5e0f61=_0x5e0f61-0x0;var _0x1f80a7=_0xb1f7[_0x5e0f61];return _0x1f80a7;};'use strict';var EventEmitter=require(_0x7b1f('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x7b1f('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x7b1f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7b1f('0x3'),'afterDestroy':_0x7b1f('0x4')};function emitEvent(_0x59a789){return function(_0x2f9a65,_0x73ac2a,_0x107be4){UserVoiceQueueRtEvents[_0x7b1f('0x5')](_0x59a789+':'+_0x2f9a65['id'],_0x2f9a65);UserVoiceQueueRtEvents['emit'](_0x59a789,_0x2f9a65);_0x107be4(null);};}for(var e in events){if(events[_0x7b1f('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x7b1f('0x7')](e,emitEvent(event));}}module[_0x7b1f('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 7088306..43f57e7 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 _0x5d8a=['bluebird','path','rimraf','./userVoiceQueueRt.attributes','exports','define','lodash','../../config/logger','api','moment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5d8a,0x88));var _0xa5d8=function(_0x1bba6c,_0x1f94cf){_0x1bba6c=_0x1bba6c-0x0;var _0x415735=_0x5d8a[_0x1bba6c];return _0x415735;};'use strict';var _=require(_0xa5d8('0x0'));var util=require('util');var logger=require(_0xa5d8('0x1'))(_0xa5d8('0x2'));var moment=require(_0xa5d8('0x3'));var BPromise=require(_0xa5d8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5d8('0x5'));var rimraf=require(_0xa5d8('0x6'));var config=require('../../config/environment');var attributes=require(_0xa5d8('0x7'));module[_0xa5d8('0x8')]=function(_0x50e6eb,_0x2cae37){return _0x50e6eb[_0xa5d8('0x9')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d4b=['../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','moment','request-promise','rimraf'];(function(_0x12b81e,_0x592ff4){var _0x58630f=function(_0x161e8c){while(--_0x161e8c){_0x12b81e['push'](_0x12b81e['shift']());}};_0x58630f(++_0x592ff4);}(_0x7d4b,0xf7));var _0xb7d4=function(_0x368405,_0x7a252c){_0x368405=_0x368405-0x0;var _0x27b6bf=_0x7d4b[_0x368405];return _0x27b6bf;};'use strict';var _=require(_0xb7d4('0x0'));var util=require(_0xb7d4('0x1'));var logger=require('../../config/logger')(_0xb7d4('0x2'));var moment=require(_0xb7d4('0x3'));var BPromise=require('bluebird');var rp=require(_0xb7d4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7d4('0x5'));var config=require(_0xb7d4('0x6'));var attributes=require(_0xb7d4('0x7'));module['exports']=function(_0x160342,_0x35d1f0){return _0x160342[_0xb7d4('0x8')](_0xb7d4('0x9'),attributes,{'tableName':_0xb7d4('0xa'),'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 f6f2fe7..d093584 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 _0xab49=['info','request\x20sent','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','catch','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','debug','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./userVoiceQueueRt.socket','request','then'];(function(_0x557730,_0x5728ca){var _0x90f73b=function(_0x575cc7){while(--_0x575cc7){_0x557730['push'](_0x557730['shift']());}};_0x90f73b(++_0x5728ca);}(_0xab49,0xc0));var _0x9ab4=function(_0x6ca7f4,_0x51a5df){_0x6ca7f4=_0x6ca7f4-0x0;var _0x494fa6=_0xab49[_0x6ca7f4];return _0x494fa6;};'use strict';var _=require(_0x9ab4('0x0'));var util=require(_0x9ab4('0x1'));var moment=require(_0x9ab4('0x2'));var BPromise=require(_0x9ab4('0x3'));var rs=require(_0x9ab4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ab4('0x5'))['db'];var utils=require(_0x9ab4('0x6'));var logger=require(_0x9ab4('0x7'))(_0x9ab4('0x8'));var config=require(_0x9ab4('0x9'));var jayson=require(_0x9ab4('0xa'));var client=jayson[_0x9ab4('0xb')][_0x9ab4('0xc')]({'port':0x232a});config[_0x9ab4('0xd')]=_['defaults'](config[_0x9ab4('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x9ab4('0xe'))(new Redis(config[_0x9ab4('0xd')]));require(_0x9ab4('0xf'))['register'](socket);function respondWithRpcPromise(_0x4a4c46,_0x1cf463,_0x3a0db1){return new BPromise(function(_0x1daf79,_0xa4bd80){return client[_0x9ab4('0x10')](_0x4a4c46,_0x3a0db1)[_0x9ab4('0x11')](function(_0x5f4326){logger[_0x9ab4('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1cf463,_0x9ab4('0x13'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x1cf463,'request\x20sent',JSON[_0x9ab4('0x14')](_0x5f4326));if(_0x5f4326['error']){if(_0x5f4326[_0x9ab4('0x15')][_0x9ab4('0x16')]===0x1f4){logger[_0x9ab4('0x15')](_0x9ab4('0x17'),_0x1cf463,_0x5f4326[_0x9ab4('0x15')][_0x9ab4('0x18')]);return _0xa4bd80(_0x5f4326[_0x9ab4('0x15')][_0x9ab4('0x18')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x1cf463,_0x5f4326[_0x9ab4('0x15')][_0x9ab4('0x18')]);return _0x1daf79(_0x5f4326[_0x9ab4('0x15')][_0x9ab4('0x18')]);}else{logger[_0x9ab4('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1cf463,_0x9ab4('0x13'));_0x1daf79(_0x5f4326['result'][_0x9ab4('0x18')]);}})[_0x9ab4('0x19')](function(_0x4fc0a7){logger['error'](_0x9ab4('0x17'),_0x1cf463,_0x4fc0a7);_0xa4bd80(_0x4fc0a7);});});}exports['GetVoiceQueueRtPauses']=function(_0x4f60f9){var _0x525b7a=this;return new Promise(function(_0x2d4f50,_0xeff425){return db[_0x9ab4('0x1a')][_0x9ab4('0x1b')]({'raw':_0x4f60f9['options']?_0x4f60f9['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f60f9[_0x9ab4('0x1c')]?_0x4f60f9[_0x9ab4('0x1c')][_0x9ab4('0x1d')]||null:null,'attributes':[[db[_0x9ab4('0x1e')]['fn'](_0x9ab4('0x1f'),db[_0x9ab4('0x1e')]['fn']('IF',db[_0x9ab4('0x1e')][_0x9ab4('0x20')]('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0x9ab4('0x11')](function(_0x2db66f){logger[_0x9ab4('0x12')]('GetVoiceQueueRtPauses',_0x4f60f9);logger[_0x9ab4('0x21')](_0x9ab4('0x22'),_0x4f60f9,JSON['stringify'](_0x2db66f));_0x2d4f50(_0x2db66f);})[_0x9ab4('0x19')](function(_0x4e4118){logger[_0x9ab4('0x15')](_0x9ab4('0x22'),_0x4e4118[_0x9ab4('0x18')],_0x4f60f9);_0xeff425(_0x525b7a[_0x9ab4('0x15')](0x1f4,_0x4e4118[_0x9ab4('0x18')]));});});}; \ No newline at end of file +var _0x7ad0=['sequelize','literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','UserVoiceQueueRt,\x20%s,\x20%s','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7ad0,0x6c));var _0x07ad=function(_0xf2f76c,_0xbb16ed){_0xf2f76c=_0xf2f76c-0x0;var _0x518dfd=_0x7ad0[_0xf2f76c];return _0x518dfd;};'use strict';var _=require(_0x07ad('0x0'));var util=require(_0x07ad('0x1'));var moment=require(_0x07ad('0x2'));var BPromise=require(_0x07ad('0x3'));var rs=require(_0x07ad('0x4'));var fs=require('fs');var Redis=require(_0x07ad('0x5'));var db=require(_0x07ad('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x07ad('0x7'))(_0x07ad('0x8'));var config=require('../../config/environment');var jayson=require(_0x07ad('0x9'));var client=jayson[_0x07ad('0xa')][_0x07ad('0xb')]({'port':0x232a});config[_0x07ad('0xc')]=_['defaults'](config[_0x07ad('0xc')],{'host':_0x07ad('0xd'),'port':0x18eb});var socket=require(_0x07ad('0xe'))(new Redis(config['redis']));require(_0x07ad('0xf'))['register'](socket);function respondWithRpcPromise(_0x3987d8,_0x56284c,_0x3c1b8b){return new BPromise(function(_0x56ea16,_0xecf430){return client[_0x07ad('0x10')](_0x3987d8,_0x3c1b8b)[_0x07ad('0x11')](function(_0x324558){logger[_0x07ad('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x56284c,'request\x20sent');logger[_0x07ad('0x13')](_0x07ad('0x14'),_0x56284c,_0x07ad('0x15'),JSON[_0x07ad('0x16')](_0x324558));if(_0x324558['error']){if(_0x324558['error'][_0x07ad('0x17')]===0x1f4){logger[_0x07ad('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x56284c,_0x324558[_0x07ad('0x18')][_0x07ad('0x19')]);return _0xecf430(_0x324558[_0x07ad('0x18')][_0x07ad('0x19')]);}logger[_0x07ad('0x18')](_0x07ad('0x1a'),_0x56284c,_0x324558[_0x07ad('0x18')]['message']);return _0x56ea16(_0x324558[_0x07ad('0x18')]['message']);}else{logger['info'](_0x07ad('0x1a'),_0x56284c,_0x07ad('0x15'));_0x56ea16(_0x324558['result'][_0x07ad('0x19')]);}})['catch'](function(_0x2c75b1){logger[_0x07ad('0x18')](_0x07ad('0x1a'),_0x56284c,_0x2c75b1);_0xecf430(_0x2c75b1);});});}exports[_0x07ad('0x1b')]=function(_0x4a6a82){var _0x9e2770=this;return new Promise(function(_0x585a78,_0x3e3772){return db[_0x07ad('0x1c')]['findAll']({'raw':_0x4a6a82[_0x07ad('0x1d')]?_0x4a6a82['options'][_0x07ad('0x1e')]===undefined?!![]:![]:!![],'where':_0x4a6a82[_0x07ad('0x1d')]?_0x4a6a82[_0x07ad('0x1d')][_0x07ad('0x1f')]||null:null,'attributes':[[db[_0x07ad('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x07ad('0x20')][_0x07ad('0x21')](_0x07ad('0x22')))),'outboundQueuePauses']]})[_0x07ad('0x11')](function(_0x2f9876){logger[_0x07ad('0x12')]('GetVoiceQueueRtPauses',_0x4a6a82);logger[_0x07ad('0x13')](_0x07ad('0x1b'),_0x4a6a82,JSON['stringify'](_0x2f9876));_0x585a78(_0x2f9876);})['catch'](function(_0x4664e7){logger[_0x07ad('0x18')](_0x07ad('0x1b'),_0x4664e7[_0x07ad('0x19')],_0x4a6a82);_0x3e3772(_0x9e2770[_0x07ad('0x18')](0x1f4,_0x4664e7['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index a4c6a83..564fa25 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 _0x1623=['removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1623,0xab));var _0x3162=function(_0x34fe88,_0x4f26b5){_0x34fe88=_0x34fe88-0x0;var _0x1ccf57=_0x1623[_0x34fe88];return _0x1ccf57;};'use strict';var UserVoiceQueueRtEvents=require(_0x3162('0x0'));var events=['save','remove',_0x3162('0x1')];function createListener(_0x27ee21,_0x36ccc3){return function(_0x2cc4d7){_0x36ccc3[_0x3162('0x2')](_0x27ee21,_0x2cc4d7);};}function removeListener(_0x4ce2bd,_0x5d49d0){return function(){UserVoiceQueueRtEvents[_0x3162('0x3')](_0x4ce2bd,_0x5d49d0);};}exports['register']=function(_0x1b55f2){for(var _0x428de6=0x0,_0x53260d=events[_0x3162('0x4')];_0x428de6<_0x53260d;_0x428de6++){var _0x2dc07e=events[_0x428de6];var _0x26ee32=createListener(_0x3162('0x5')+_0x2dc07e,_0x1b55f2);UserVoiceQueueRtEvents['on'](_0x2dc07e,_0x26ee32);}}; \ No newline at end of file +var _0xdded=['register','length','./userVoiceQueueRt.events','save','remove','update','emit','removeListener'];(function(_0x11de67,_0x32c226){var _0x395709=function(_0x3d1ebc){while(--_0x3d1ebc){_0x11de67['push'](_0x11de67['shift']());}};_0x395709(++_0x32c226);}(_0xdded,0x17a));var _0xddde=function(_0xa695f7,_0x1aef71){_0xa695f7=_0xa695f7-0x0;var _0x572961=_0xdded[_0xa695f7];return _0x572961;};'use strict';var UserVoiceQueueRtEvents=require(_0xddde('0x0'));var events=[_0xddde('0x1'),_0xddde('0x2'),_0xddde('0x3')];function createListener(_0x3f2b75,_0x9b8506){return function(_0x5cc90a){_0x9b8506[_0xddde('0x4')](_0x3f2b75,_0x5cc90a);};}function removeListener(_0x276cc6,_0x44468e){return function(){UserVoiceQueueRtEvents[_0xddde('0x5')](_0x276cc6,_0x44468e);};}exports[_0xddde('0x6')]=function(_0x39fd85){for(var _0x3c3021=0x0,_0x3cea18=events[_0xddde('0x7')];_0x3c3021<_0x3cea18;_0x3c3021++){var _0x18d8b8=events[_0x3c3021];var _0x3a5e8a=createListener('userVoiceQueueRt:'+_0x18d8b8,_0x39fd85);UserVoiceQueueRtEvents['on'](_0x18d8b8,_0x3a5e8a);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 3bcb8c2..bad8a92 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x589f99,_0x2e94d3){var _0x8f928c=function(_0x3f3168){while(--_0x3f3168){_0x589f99['push'](_0x589f99['shift']());}};_0x8f928c(++_0x2e94d3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x45ab6e,_0x348b07){var _0x5eeaed=function(_0x3be27f){while(--_0x3be27f){_0x45ab6e['push'](_0x45ab6e['shift']());}};_0x5eeaed(++_0x348b07);}(_0x70e0,0x17b));var _0x070e=function(_0x1244dd,_0x62fe3b){_0x1244dd=_0x1244dd-0x0;var _0xbecbc6=_0x70e0[_0x1244dd];return _0xbecbc6;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index c196969..c60d152 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 _0xaffe=['exports','INTEGER','sequelize'];(function(_0x14fd72,_0x6c4d11){var _0x3ed8d1=function(_0x2dd53c){while(--_0x2dd53c){_0x14fd72['push'](_0x14fd72['shift']());}};_0x3ed8d1(++_0x6c4d11);}(_0xaffe,0x158));var _0xeaff=function(_0x2bffee,_0x36f265){_0x2bffee=_0x2bffee-0x0;var _0x76793a=_0xaffe[_0x2bffee];return _0x76793a;};'use strict';var Sequelize=require(_0xeaff('0x0'));module[_0xeaff('0x1')]={'penalty':{'type':Sequelize[_0xeaff('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5d28=['exports','INTEGER','sequelize'];(function(_0x41a3ab,_0x4bb061){var _0x3c9da9=function(_0x37c124){while(--_0x37c124){_0x41a3ab['push'](_0x41a3ab['shift']());}};_0x3c9da9(++_0x4bb061);}(_0x5d28,0xdd));var _0x85d2=function(_0x4bd190,_0x1e04f4){_0x4bd190=_0x4bd190-0x0;var _0xcd40ed=_0x5d28[_0x4bd190];return _0xcd40ed;};'use strict';var Sequelize=require(_0x85d2('0x0'));module[_0x85d2('0x1')]={'penalty':{'type':Sequelize[_0x85d2('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 0c4b042..e48332a 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 _0x4850=['request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','util','../../config/logger','api','moment'];(function(_0x269e00,_0x4aa663){var _0x1cbbbb=function(_0x2a7e46){while(--_0x2a7e46){_0x269e00['push'](_0x269e00['shift']());}};_0x1cbbbb(++_0x4aa663);}(_0x4850,0x164));var _0x0485=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4850[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x0485('0x0'));var logger=require(_0x0485('0x1'))(_0x0485('0x2'));var moment=require(_0x0485('0x3'));var BPromise=require('bluebird');var rp=require(_0x0485('0x4'));var fs=require('fs');var path=require(_0x0485('0x5'));var rimraf=require(_0x0485('0x6'));var config=require(_0x0485('0x7'));var attributes=require(_0x0485('0x8'));module[_0x0485('0x9')]=function(_0x349fda,_0x216849){return _0x349fda[_0x0485('0xa')](_0x0485('0xb'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ee7=['request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','api','moment'];(function(_0xd5d716,_0x48a8cb){var _0x2b4cd6=function(_0x151e2e){while(--_0x151e2e){_0xd5d716['push'](_0xd5d716['shift']());}};_0x2b4cd6(++_0x48a8cb);}(_0x6ee7,0xf9));var _0x76ee=function(_0x4de88b,_0x271c96){_0x4de88b=_0x4de88b-0x0;var _0x306a81=_0x6ee7[_0x4de88b];return _0x306a81;};'use strict';var _=require(_0x76ee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x76ee('0x1'));var moment=require(_0x76ee('0x2'));var BPromise=require('bluebird');var rp=require(_0x76ee('0x3'));var fs=require('fs');var path=require(_0x76ee('0x4'));var rimraf=require(_0x76ee('0x5'));var config=require(_0x76ee('0x6'));var attributes=require(_0x76ee('0x7'));module[_0x76ee('0x8')]=function(_0x3650f7,_0xdae0f0){return _0x3650f7[_0x76ee('0x9')](_0x76ee('0xa'),attributes,{'tableName':_0x76ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index e641b7d..a916833 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 _0x1127=['then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x371c0c,_0x4c16ae){var _0x3daee3=function(_0x15ed33){while(--_0x15ed33){_0x371c0c['push'](_0x371c0c['shift']());}};_0x3daee3(++_0x4c16ae);}(_0x1127,0x1d6));var _0x7112=function(_0x5767d1,_0x20323b){_0x5767d1=_0x5767d1-0x0;var _0x37b060=_0x1127[_0x5767d1];return _0x37b060;};'use strict';var _=require(_0x7112('0x0'));var util=require(_0x7112('0x1'));var moment=require(_0x7112('0x2'));var BPromise=require(_0x7112('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7112('0x4'))['db'];var utils=require(_0x7112('0x5'));var logger=require(_0x7112('0x6'))(_0x7112('0x7'));var config=require(_0x7112('0x8'));var jayson=require(_0x7112('0x9'));var client=jayson[_0x7112('0xa')][_0x7112('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ba627,_0x309aa7,_0x4f5ea3){return new BPromise(function(_0x3a6802,_0x596e12){return client[_0x7112('0xc')](_0x2ba627,_0x4f5ea3)[_0x7112('0xd')](function(_0x5c1d0a){logger[_0x7112('0xe')](_0x7112('0xf'),_0x309aa7,_0x7112('0x10'));logger['debug'](_0x7112('0x11'),_0x309aa7,_0x7112('0x10'),JSON['stringify'](_0x5c1d0a));if(_0x5c1d0a[_0x7112('0x12')]){if(_0x5c1d0a[_0x7112('0x12')][_0x7112('0x13')]===0x1f4){logger[_0x7112('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x309aa7,_0x5c1d0a['error']['message']);return _0x596e12(_0x5c1d0a[_0x7112('0x12')]['message']);}logger[_0x7112('0x12')](_0x7112('0xf'),_0x309aa7,_0x5c1d0a[_0x7112('0x12')]['message']);return _0x3a6802(_0x5c1d0a['error'][_0x7112('0x14')]);}else{logger['info'](_0x7112('0xf'),_0x309aa7,_0x7112('0x10'));_0x3a6802(_0x5c1d0a[_0x7112('0x15')][_0x7112('0x14')]);}})[_0x7112('0x16')](function(_0x5aeefe){logger[_0x7112('0x12')](_0x7112('0xf'),_0x309aa7,_0x5aeefe);_0x596e12(_0x5aeefe);});});} \ No newline at end of file +var _0xbd07=['UserWhatsappQueue,\x20%s,\x20%s','result','catch','lodash','bluebird','ioredis','../../config/utils','rpc','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xbd07,0x1b3));var _0x7bd0=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xbd07[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x7bd0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7bd0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7bd0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7bd0('0x3'));var logger=require('../../config/logger')(_0x7bd0('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7bd0('0x5')][_0x7bd0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xf65638,_0x4ca284,_0x5bd0a0){return new BPromise(function(_0x366692,_0x2e537b){return client['request'](_0xf65638,_0x5bd0a0)[_0x7bd0('0x7')](function(_0x5904e6){logger[_0x7bd0('0x8')]('UserWhatsappQueue,\x20%s,\x20%s',_0x4ca284,'request\x20sent');logger['debug'](_0x7bd0('0x9'),_0x4ca284,_0x7bd0('0xa'),JSON[_0x7bd0('0xb')](_0x5904e6));if(_0x5904e6[_0x7bd0('0xc')]){if(_0x5904e6[_0x7bd0('0xc')][_0x7bd0('0xd')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x4ca284,_0x5904e6['error'][_0x7bd0('0xe')]);return _0x2e537b(_0x5904e6['error'][_0x7bd0('0xe')]);}logger[_0x7bd0('0xc')](_0x7bd0('0xf'),_0x4ca284,_0x5904e6[_0x7bd0('0xc')][_0x7bd0('0xe')]);return _0x366692(_0x5904e6[_0x7bd0('0xc')][_0x7bd0('0xe')]);}else{logger[_0x7bd0('0x8')]('UserWhatsappQueue,\x20%s,\x20%s',_0x4ca284,'request\x20sent');_0x366692(_0x5904e6[_0x7bd0('0x10')][_0x7bd0('0xe')]);}})[_0x7bd0('0x11')](function(_0x563e6b){logger[_0x7bd0('0xc')](_0x7bd0('0xf'),_0x4ca284,_0x563e6b);_0x2e537b(_0x563e6b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 3c9b48b..7d0fdd0 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 _0x28a2=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','multer','util'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x228a('0x0'));var util=require(_0x228a('0x1'));var path=require(_0x228a('0x2'));var timeout=require(_0x228a('0x3'));var express=require(_0x228a('0x4'));var router=express[_0x228a('0x5')]();var fs_extra=require(_0x228a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x228a('0x7'));var config=require('../../config/environment');var controller=require(_0x228a('0x8'));router[_0x228a('0x9')]('/',auth[_0x228a('0xa')](),controller[_0x228a('0xb')]);router[_0x228a('0x9')]('/:id',auth[_0x228a('0xa')](),controller[_0x228a('0xc')]);router[_0x228a('0xd')]('/',auth[_0x228a('0xa')](),controller['create']);router[_0x228a('0xe')](_0x228a('0xf'),auth[_0x228a('0xa')](),controller[_0x228a('0x10')]);router[_0x228a('0x11')](_0x228a('0xf'),auth[_0x228a('0xa')](),controller[_0x228a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3c7b=['connect-timeout','express','../../config/environment','./variable.controller','isAuthenticated','get','/:id','show','post','create','update','delete','destroy','multer','util','path'];(function(_0x5d9768,_0x33cb00){var _0x465a4d=function(_0x234b4a){while(--_0x234b4a){_0x5d9768['push'](_0x5d9768['shift']());}};_0x465a4d(++_0x33cb00);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x4feca2,_0x95cb9){_0x4feca2=_0x4feca2-0x0;var _0xe9eb97=_0x3c7b[_0x4feca2];return _0xe9eb97;};'use strict';var multer=require(_0xb3c7('0x0'));var util=require(_0xb3c7('0x1'));var path=require(_0xb3c7('0x2'));var timeout=require(_0xb3c7('0x3'));var express=require(_0xb3c7('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(_0xb3c7('0x5'));var controller=require(_0xb3c7('0x6'));router['get']('/',auth[_0xb3c7('0x7')](),controller['index']);router[_0xb3c7('0x8')](_0xb3c7('0x9'),auth[_0xb3c7('0x7')](),controller[_0xb3c7('0xa')]);router[_0xb3c7('0xb')]('/',auth['isAuthenticated'](),controller[_0xb3c7('0xc')]);router['put'](_0xb3c7('0x9'),auth[_0xb3c7('0x7')](),controller[_0xb3c7('0xd')]);router[_0xb3c7('0xe')]('/:id',auth[_0xb3c7('0x7')](),controller[_0xb3c7('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 5f9766c..c3beb2f 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 _0xb904=['exports','STRING','sequelize'];(function(_0x5b0a9e,_0x157a51){var _0x5bc275=function(_0x4cf9b9){while(--_0x4cf9b9){_0x5b0a9e['push'](_0x5b0a9e['shift']());}};_0x5bc275(++_0x157a51);}(_0xb904,0x1cd));var _0x4b90=function(_0x724a6d,_0x3e84ec){_0x724a6d=_0x724a6d-0x0;var _0x48bc1e=_0xb904[_0x724a6d];return _0x48bc1e;};'use strict';var Sequelize=require(_0x4b90('0x0'));module[_0x4b90('0x1')]={'name':{'type':Sequelize[_0x4b90('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4b90('0x2')]}}; \ No newline at end of file +var _0x35f2=['STRING','name','exports'];(function(_0x302b8c,_0x4af231){var _0x249dc7=function(_0x55fd7c){while(--_0x55fd7c){_0x302b8c['push'](_0x302b8c['shift']());}};_0x249dc7(++_0x4af231);}(_0x35f2,0x68));var _0x235f=function(_0xf5b331,_0x589882){_0xf5b331=_0xf5b331-0x0;var _0x3ab679=_0x35f2[_0xf5b331];return _0x3ab679;};'use strict';var Sequelize=require('sequelize');module[_0x235f('0x0')]={'name':{'type':Sequelize[_0x235f('0x1')],'unique':_0x235f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 18c338e..4e897e0 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 _0x04c5=['desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','Variables','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','Variable','include','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x04c5,0xea));var _0x504c=function(_0x6607c9,_0x134ad1){_0x6607c9=_0x6607c9-0x0;var _0x39f266=_0x04c5[_0x6607c9];return _0x39f266;};'use strict';var emlformat=require(_0x504c('0x0'));var rimraf=require(_0x504c('0x1'));var zipdir=require(_0x504c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x504c('0x3'));var moment=require(_0x504c('0x4'));var BPromise=require(_0x504c('0x5'));var Mustache=require(_0x504c('0x6'));var util=require(_0x504c('0x7'));var path=require(_0x504c('0x8'));var sox=require(_0x504c('0x9'));var csv=require(_0x504c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x504c('0xb'));var _=require(_0x504c('0xc'));var squel=require(_0x504c('0xd'));var crypto=require('crypto');var jsforce=require(_0x504c('0xe'));var deskjs=require(_0x504c('0xf'));var toCsv=require(_0x504c('0xa'));var querystring=require(_0x504c('0x10'));var Papa=require(_0x504c('0x11'));var Redis=require(_0x504c('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x504c('0x13'));var hardwareService=require(_0x504c('0x14'));var logger=require(_0x504c('0x15'))(_0x504c('0x16'));var utils=require(_0x504c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x504c('0x18'))['db'];function respondWithStatusCode(_0x2afc5c,_0x20b06c){_0x20b06c=_0x20b06c||0xcc;return function(_0x2e0986){if(_0x2e0986){return _0x2afc5c[_0x504c('0x19')](_0x20b06c);}return _0x2afc5c[_0x504c('0x1a')](_0x20b06c)[_0x504c('0x1b')]();};}function respondWithResult(_0x413ce2,_0x56d485){_0x56d485=_0x56d485||0xc8;return function(_0x59df69){if(_0x59df69){return _0x413ce2['status'](_0x56d485)['json'](_0x59df69);}};}function respondWithFilteredResult(_0x2b4870,_0x43576f){return function(_0x30e65a){if(_0x30e65a){var _0x43e668=typeof _0x43576f[_0x504c('0x1c')]===_0x504c('0x1d')&&typeof _0x43576f[_0x504c('0x1e')]==='undefined';var _0x5886da=_0x30e65a[_0x504c('0x1f')];var _0x24b226=_0x43e668?0x0:_0x43576f[_0x504c('0x1c')];var _0xbc90ff=_0x43e668?_0x30e65a[_0x504c('0x1f')]:_0x43576f[_0x504c('0x1c')]+_0x43576f[_0x504c('0x1e')];var _0x514ee2;if(_0xbc90ff>=_0x5886da){_0xbc90ff=_0x5886da;_0x514ee2=0xc8;}else{_0x514ee2=0xce;}_0x2b4870[_0x504c('0x1a')](_0x514ee2);return _0x2b4870[_0x504c('0x20')](_0x504c('0x21'),_0x24b226+'-'+_0xbc90ff+'/'+_0x5886da)[_0x504c('0x22')](_0x30e65a);}return null;};}function patchUpdates(_0x3f7beb){return function(_0x14bc9e){try{jsonpatch[_0x504c('0x23')](_0x14bc9e,_0x3f7beb,!![]);}catch(_0x233993){return BPromise[_0x504c('0x24')](_0x233993);}return _0x14bc9e[_0x504c('0x25')]();};}function saveUpdates(_0x4c15ad,_0x22d720){return function(_0x486d20){if(_0x486d20){return _0x486d20[_0x504c('0x26')](_0x4c15ad)[_0x504c('0x27')](function(_0x26d5e9){return _0x26d5e9;});}return null;};}function removeEntity(_0x3ad3f2,_0x5d3e72){return function(_0xd1056e){if(_0xd1056e){return _0xd1056e['destroy']()[_0x504c('0x27')](function(){var _0x72eaae=_0xd1056e[_0x504c('0x28')]({'plain':!![]});var _0x35c5df=_0x504c('0x29');return db[_0x504c('0x2a')][_0x504c('0x2b')]({'where':{'type':_0x35c5df,'resourceId':_0x72eaae['id']}})[_0x504c('0x27')](function(){return _0xd1056e;});})['then'](function(){_0x3ad3f2[_0x504c('0x1a')](0xcc)[_0x504c('0x1b')]();});}};}function handleEntityNotFound(_0x1891d5,_0xf46e6){return function(_0x4205ec){if(!_0x4205ec){_0x1891d5[_0x504c('0x19')](0x194);}return _0x4205ec;};}function handleError(_0x3175b2,_0x46894a){_0x46894a=_0x46894a||0x1f4;return function(_0x452edd){logger[_0x504c('0x2c')](_0x452edd[_0x504c('0x2d')]);if(_0x452edd[_0x504c('0x2e')]){delete _0x452edd[_0x504c('0x2e')];}_0x3175b2[_0x504c('0x1a')](_0x46894a)[_0x504c('0x2f')](_0x452edd);};}exports['index']=function(_0x1b6c30,_0x136cd1){var _0x207b52={},_0x1fc118={},_0x56291f={'count':0x0,'rows':[]};var _0x2fb568=_[_0x504c('0x30')](db['Variable'][_0x504c('0x31')],function(_0x37748b){return{'name':_0x37748b[_0x504c('0x32')],'type':_0x37748b[_0x504c('0x33')]['key']};});_0x1fc118[_0x504c('0x34')]=_['map'](_0x2fb568,_0x504c('0x2e'));_0x1fc118[_0x504c('0x35')]=_[_0x504c('0x36')](_0x1b6c30[_0x504c('0x35')]);_0x1fc118[_0x504c('0x37')]=_[_0x504c('0x38')](_0x1fc118[_0x504c('0x34')],_0x1fc118[_0x504c('0x35')]);_0x207b52['attributes']=_[_0x504c('0x38')](_0x1fc118[_0x504c('0x34')],qs[_0x504c('0x39')](_0x1b6c30[_0x504c('0x35')][_0x504c('0x39')]));_0x207b52[_0x504c('0x3a')]=_0x207b52[_0x504c('0x3a')][_0x504c('0x3b')]?_0x207b52[_0x504c('0x3a')]:_0x1fc118[_0x504c('0x34')];if(!_0x1b6c30[_0x504c('0x35')]['hasOwnProperty'](_0x504c('0x3c'))){_0x207b52[_0x504c('0x1e')]=qs[_0x504c('0x1e')](_0x1b6c30[_0x504c('0x35')][_0x504c('0x1e')]);_0x207b52['offset']=qs['offset'](_0x1b6c30[_0x504c('0x35')][_0x504c('0x1c')]);}_0x207b52[_0x504c('0x3d')]=qs[_0x504c('0x3e')](_0x1b6c30[_0x504c('0x35')][_0x504c('0x3e')]);_0x207b52['where']=qs[_0x504c('0x37')](_[_0x504c('0x3f')](_0x1b6c30[_0x504c('0x35')],_0x1fc118[_0x504c('0x37')]),_0x2fb568);if(_0x1b6c30['query']['filter']){_0x207b52[_0x504c('0x40')]=_['merge'](_0x207b52[_0x504c('0x40')],{'$or':_[_0x504c('0x30')](_0x2fb568,function(_0x2c5bdb){if(_0x2c5bdb['type']!==_0x504c('0x41')){var _0x379417={};_0x379417[_0x2c5bdb[_0x504c('0x2e')]]={'$like':'%'+_0x1b6c30[_0x504c('0x35')][_0x504c('0x42')]+'%'};return _0x379417;}})});}_0x207b52=_[_0x504c('0x43')]({},_0x207b52,_0x1b6c30[_0x504c('0x44')]);var _0x217cc9={'where':_0x207b52['where']};return db[_0x504c('0x45')][_0x504c('0x1f')](_0x217cc9)[_0x504c('0x27')](function(_0x3d1f39){_0x56291f[_0x504c('0x1f')]=_0x3d1f39;if(_0x1b6c30[_0x504c('0x35')]['includeAll']){_0x207b52[_0x504c('0x46')]=[{'all':!![]}];}return db[_0x504c('0x45')]['findAll'](_0x207b52);})[_0x504c('0x27')](function(_0x45d9ae){_0x56291f['rows']=_0x45d9ae;return _0x56291f;})[_0x504c('0x27')](respondWithFilteredResult(_0x136cd1,_0x207b52))[_0x504c('0x47')](handleError(_0x136cd1,null));};exports['show']=function(_0x6f8fc8,_0xcbe765){var _0xbc7187={'raw':!![],'where':{'id':_0x6f8fc8[_0x504c('0x48')]['id']}},_0x55c9e5={};_0x55c9e5[_0x504c('0x34')]=_[_0x504c('0x36')](db['Variable'][_0x504c('0x31')]);_0x55c9e5[_0x504c('0x35')]=_['keys'](_0x6f8fc8[_0x504c('0x35')]);_0x55c9e5[_0x504c('0x37')]=_[_0x504c('0x38')](_0x55c9e5['model'],_0x55c9e5['query']);_0xbc7187['attributes']=_['intersection'](_0x55c9e5[_0x504c('0x34')],qs[_0x504c('0x39')](_0x6f8fc8[_0x504c('0x35')][_0x504c('0x39')]));_0xbc7187[_0x504c('0x3a')]=_0xbc7187[_0x504c('0x3a')][_0x504c('0x3b')]?_0xbc7187[_0x504c('0x3a')]:_0x55c9e5['model'];if(_0x6f8fc8[_0x504c('0x35')]['includeAll']){_0xbc7187['include']=[{'all':!![]}];}_0xbc7187=_['merge']({},_0xbc7187,_0x6f8fc8['options']);return db[_0x504c('0x45')][_0x504c('0x49')](_0xbc7187)[_0x504c('0x27')](handleEntityNotFound(_0xcbe765,null))[_0x504c('0x27')](respondWithResult(_0xcbe765,null))[_0x504c('0x47')](handleError(_0xcbe765,null));};exports[_0x504c('0x4a')]=function(_0x20d3fe,_0xa8cad8){return db[_0x504c('0x45')][_0x504c('0x4a')](_0x20d3fe[_0x504c('0x4b')],{})[_0x504c('0x27')](function(_0x586d1b){var _0x4b9b13=_0x20d3fe[_0x504c('0x4c')][_0x504c('0x28')]({'plain':!![]});if(!_0x4b9b13)throw new Error(_0x504c('0x4d'));if(_0x4b9b13[_0x504c('0x4e')]===_0x504c('0x4c')){var _0x45ba96=_0x586d1b[_0x504c('0x28')]({'plain':!![]});var _0x304a8b='Variables';return db[_0x504c('0x4f')]['find']({'where':{'name':_0x304a8b,'userProfileId':_0x4b9b13[_0x504c('0x50')]},'raw':!![]})[_0x504c('0x27')](function(_0x20f588){if(_0x20f588&&_0x20f588[_0x504c('0x51')]===0x0){return db[_0x504c('0x2a')]['create']({'name':_0x45ba96[_0x504c('0x2e')],'resourceId':_0x45ba96['id'],'type':_0x20f588[_0x504c('0x2e')],'sectionId':_0x20f588['id']},{})[_0x504c('0x27')](function(){return _0x586d1b;});}else{return _0x586d1b;}})['catch'](function(_0x64877e){logger[_0x504c('0x2c')](_0x504c('0x52'),_0x64877e);throw _0x64877e;});}return _0x586d1b;})[_0x504c('0x27')](respondWithResult(_0xa8cad8,0xc9))[_0x504c('0x47')](handleError(_0xa8cad8,null));};exports['update']=function(_0x56fbf9,_0x478d2b){if(_0x56fbf9[_0x504c('0x4b')]['id']){delete _0x56fbf9[_0x504c('0x4b')]['id'];}return db[_0x504c('0x45')]['find']({'where':{'id':_0x56fbf9[_0x504c('0x48')]['id']}})[_0x504c('0x27')](handleEntityNotFound(_0x478d2b,null))['then'](saveUpdates(_0x56fbf9[_0x504c('0x4b')],null))[_0x504c('0x27')](respondWithResult(_0x478d2b,null))['catch'](handleError(_0x478d2b,null));};exports['destroy']=function(_0x5dba1e,_0x341284){return db['Variable'][_0x504c('0x49')]({'where':{'id':_0x5dba1e[_0x504c('0x48')]['id']}})[_0x504c('0x27')](handleEntityNotFound(_0x341284,null))[_0x504c('0x27')](removeEntity(_0x341284,null))['catch'](handleError(_0x341284,null));}; \ No newline at end of file +var _0x3405=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','get','Variables','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Variable','include','findAll','rows','params','keys','length','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x297fd4,_0x53c39c){var _0x2e5702=function(_0x2463b2){while(--_0x2463b2){_0x297fd4['push'](_0x297fd4['shift']());}};_0x2e5702(++_0x53c39c);}(_0x3405,0x13f));var _0x5340=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x3405[_0x45b034];return _0x509cb0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5340('0x0'));var zipdir=require(_0x5340('0x1'));var jsonpatch=require(_0x5340('0x2'));var rp=require(_0x5340('0x3'));var moment=require(_0x5340('0x4'));var BPromise=require(_0x5340('0x5'));var Mustache=require(_0x5340('0x6'));var util=require(_0x5340('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5340('0x8'));var squel=require(_0x5340('0x9'));var crypto=require(_0x5340('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5340('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5340('0xc'));var Papa=require(_0x5340('0xd'));var Redis=require(_0x5340('0xe'));var authService=require(_0x5340('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5340('0x10'));var logger=require(_0x5340('0x11'))(_0x5340('0x12'));var utils=require(_0x5340('0x13'));var config=require(_0x5340('0x14'));var licenseUtil=require(_0x5340('0x15'));var db=require(_0x5340('0x16'))['db'];function respondWithStatusCode(_0x37e51e,_0x1ff77a){_0x1ff77a=_0x1ff77a||0xcc;return function(_0x549892){if(_0x549892){return _0x37e51e['sendStatus'](_0x1ff77a);}return _0x37e51e['status'](_0x1ff77a)[_0x5340('0x17')]();};}function respondWithResult(_0x145509,_0x357673){_0x357673=_0x357673||0xc8;return function(_0x3e4ab4){if(_0x3e4ab4){return _0x145509[_0x5340('0x18')](_0x357673)[_0x5340('0x19')](_0x3e4ab4);}};}function respondWithFilteredResult(_0x747d1f,_0x444832){return function(_0x1981c0){if(_0x1981c0){var _0xc725cd=typeof _0x444832[_0x5340('0x1a')]==='undefined'&&typeof _0x444832[_0x5340('0x1b')]===_0x5340('0x1c');var _0x4c5f87=_0x1981c0[_0x5340('0x1d')];var _0x35ff22=_0xc725cd?0x0:_0x444832[_0x5340('0x1a')];var _0xb56e4c=_0xc725cd?_0x1981c0[_0x5340('0x1d')]:_0x444832[_0x5340('0x1a')]+_0x444832[_0x5340('0x1b')];var _0x5ac7ec;if(_0xb56e4c>=_0x4c5f87){_0xb56e4c=_0x4c5f87;_0x5ac7ec=0xc8;}else{_0x5ac7ec=0xce;}_0x747d1f[_0x5340('0x18')](_0x5ac7ec);return _0x747d1f['set'](_0x5340('0x1e'),_0x35ff22+'-'+_0xb56e4c+'/'+_0x4c5f87)[_0x5340('0x19')](_0x1981c0);}return null;};}function patchUpdates(_0x51d6fa){return function(_0x474fba){try{jsonpatch[_0x5340('0x1f')](_0x474fba,_0x51d6fa,!![]);}catch(_0x28e919){return BPromise[_0x5340('0x20')](_0x28e919);}return _0x474fba[_0x5340('0x21')]();};}function saveUpdates(_0x46411c,_0x3bb801){return function(_0x1c4b29){if(_0x1c4b29){return _0x1c4b29[_0x5340('0x22')](_0x46411c)[_0x5340('0x23')](function(_0x2aed28){return _0x2aed28;});}return null;};}function removeEntity(_0x112ec4,_0x5197b0){return function(_0xd67aea){if(_0xd67aea){return _0xd67aea['destroy']()[_0x5340('0x23')](function(){var _0x2825b5=_0xd67aea[_0x5340('0x24')]({'plain':!![]});var _0x32ad66=_0x5340('0x25');return db['UserProfileResource'][_0x5340('0x26')]({'where':{'type':_0x32ad66,'resourceId':_0x2825b5['id']}})['then'](function(){return _0xd67aea;});})[_0x5340('0x23')](function(){_0x112ec4[_0x5340('0x18')](0xcc)[_0x5340('0x17')]();});}};}function handleEntityNotFound(_0x1d05c6,_0xb16044){return function(_0x2f688a){if(!_0x2f688a){_0x1d05c6[_0x5340('0x27')](0x194);}return _0x2f688a;};}function handleError(_0x42bdb3,_0x2bae74){_0x2bae74=_0x2bae74||0x1f4;return function(_0x42c4b5){logger[_0x5340('0x28')](_0x42c4b5[_0x5340('0x29')]);if(_0x42c4b5[_0x5340('0x2a')]){delete _0x42c4b5['name'];}_0x42bdb3['status'](_0x2bae74)[_0x5340('0x2b')](_0x42c4b5);};}exports[_0x5340('0x2c')]=function(_0xe49653,_0x32bdfa){var _0x123409={},_0xeb4044={},_0x581962={'count':0x0,'rows':[]};var _0x271eb0=_['map'](db['Variable'][_0x5340('0x2d')],function(_0x590c51){return{'name':_0x590c51[_0x5340('0x2e')],'type':_0x590c51[_0x5340('0x2f')]['key']};});_0xeb4044[_0x5340('0x30')]=_[_0x5340('0x31')](_0x271eb0,_0x5340('0x2a'));_0xeb4044[_0x5340('0x32')]=_['keys'](_0xe49653['query']);_0xeb4044[_0x5340('0x33')]=_['intersection'](_0xeb4044['model'],_0xeb4044[_0x5340('0x32')]);_0x123409[_0x5340('0x34')]=_[_0x5340('0x35')](_0xeb4044[_0x5340('0x30')],qs[_0x5340('0x36')](_0xe49653[_0x5340('0x32')][_0x5340('0x36')]));_0x123409['attributes']=_0x123409[_0x5340('0x34')]['length']?_0x123409[_0x5340('0x34')]:_0xeb4044[_0x5340('0x30')];if(!_0xe49653[_0x5340('0x32')][_0x5340('0x37')](_0x5340('0x38'))){_0x123409[_0x5340('0x1b')]=qs['limit'](_0xe49653[_0x5340('0x32')]['limit']);_0x123409['offset']=qs[_0x5340('0x1a')](_0xe49653['query'][_0x5340('0x1a')]);}_0x123409['order']=qs['sort'](_0xe49653[_0x5340('0x32')][_0x5340('0x39')]);_0x123409[_0x5340('0x3a')]=qs[_0x5340('0x33')](_[_0x5340('0x3b')](_0xe49653[_0x5340('0x32')],_0xeb4044['filters']),_0x271eb0);if(_0xe49653[_0x5340('0x32')][_0x5340('0x3c')]){_0x123409[_0x5340('0x3a')]=_[_0x5340('0x3d')](_0x123409[_0x5340('0x3a')],{'$or':_[_0x5340('0x31')](_0x271eb0,function(_0x397d28){if(_0x397d28['type']!==_0x5340('0x3e')){var _0x329568={};_0x329568[_0x397d28['name']]={'$like':'%'+_0xe49653['query'][_0x5340('0x3c')]+'%'};return _0x329568;}})});}_0x123409=_[_0x5340('0x3d')]({},_0x123409,_0xe49653[_0x5340('0x3f')]);var _0x29d212={'where':_0x123409[_0x5340('0x3a')]};return db[_0x5340('0x40')][_0x5340('0x1d')](_0x29d212)[_0x5340('0x23')](function(_0x45dc2a){_0x581962['count']=_0x45dc2a;if(_0xe49653[_0x5340('0x32')]['includeAll']){_0x123409[_0x5340('0x41')]=[{'all':!![]}];}return db[_0x5340('0x40')][_0x5340('0x42')](_0x123409);})[_0x5340('0x23')](function(_0x1f6dc7){_0x581962[_0x5340('0x43')]=_0x1f6dc7;return _0x581962;})['then'](respondWithFilteredResult(_0x32bdfa,_0x123409))['catch'](handleError(_0x32bdfa,null));};exports['show']=function(_0x5bbf4c,_0x23f2ea){var _0x27480b={'raw':!![],'where':{'id':_0x5bbf4c[_0x5340('0x44')]['id']}},_0x4d7f98={};_0x4d7f98[_0x5340('0x30')]=_[_0x5340('0x45')](db['Variable'][_0x5340('0x2d')]);_0x4d7f98[_0x5340('0x32')]=_['keys'](_0x5bbf4c[_0x5340('0x32')]);_0x4d7f98[_0x5340('0x33')]=_[_0x5340('0x35')](_0x4d7f98[_0x5340('0x30')],_0x4d7f98[_0x5340('0x32')]);_0x27480b[_0x5340('0x34')]=_[_0x5340('0x35')](_0x4d7f98[_0x5340('0x30')],qs[_0x5340('0x36')](_0x5bbf4c[_0x5340('0x32')][_0x5340('0x36')]));_0x27480b[_0x5340('0x34')]=_0x27480b[_0x5340('0x34')][_0x5340('0x46')]?_0x27480b[_0x5340('0x34')]:_0x4d7f98[_0x5340('0x30')];if(_0x5bbf4c[_0x5340('0x32')][_0x5340('0x47')]){_0x27480b[_0x5340('0x41')]=[{'all':!![]}];}_0x27480b=_['merge']({},_0x27480b,_0x5bbf4c[_0x5340('0x3f')]);return db['Variable']['find'](_0x27480b)[_0x5340('0x23')](handleEntityNotFound(_0x23f2ea,null))[_0x5340('0x23')](respondWithResult(_0x23f2ea,null))['catch'](handleError(_0x23f2ea,null));};exports['create']=function(_0x420db9,_0x3a9917){return db[_0x5340('0x40')][_0x5340('0x48')](_0x420db9[_0x5340('0x49')],{})['then'](function(_0x1e1611){var _0x53a49c=_0x420db9[_0x5340('0x4a')]['get']({'plain':!![]});if(!_0x53a49c)throw new Error(_0x5340('0x4b'));if(_0x53a49c[_0x5340('0x4c')]===_0x5340('0x4a')){var _0x52f41a=_0x1e1611['get']({'plain':!![]});var _0x5b0d34=_0x5340('0x25');return db[_0x5340('0x4d')][_0x5340('0x4e')]({'where':{'name':_0x5b0d34,'userProfileId':_0x53a49c[_0x5340('0x4f')]},'raw':!![]})[_0x5340('0x23')](function(_0x569bbb){if(_0x569bbb&&_0x569bbb[_0x5340('0x50')]===0x0){return db[_0x5340('0x51')][_0x5340('0x48')]({'name':_0x52f41a[_0x5340('0x2a')],'resourceId':_0x52f41a['id'],'type':_0x569bbb[_0x5340('0x2a')],'sectionId':_0x569bbb['id']},{})['then'](function(){return _0x1e1611;});}else{return _0x1e1611;}})[_0x5340('0x52')](function(_0x4c1b15){logger[_0x5340('0x28')](_0x5340('0x53'),_0x4c1b15);throw _0x4c1b15;});}return _0x1e1611;})['then'](respondWithResult(_0x3a9917,0xc9))[_0x5340('0x52')](handleError(_0x3a9917,null));};exports[_0x5340('0x22')]=function(_0x5e484e,_0x225e54){if(_0x5e484e[_0x5340('0x49')]['id']){delete _0x5e484e['body']['id'];}return db[_0x5340('0x40')]['find']({'where':{'id':_0x5e484e[_0x5340('0x44')]['id']}})[_0x5340('0x23')](handleEntityNotFound(_0x225e54,null))[_0x5340('0x23')](saveUpdates(_0x5e484e[_0x5340('0x49')],null))[_0x5340('0x23')](respondWithResult(_0x225e54,null))['catch'](handleError(_0x225e54,null));};exports['destroy']=function(_0x4563f5,_0x39d7e0){return db[_0x5340('0x40')][_0x5340('0x4e')]({'where':{'id':_0x4563f5[_0x5340('0x44')]['id']}})[_0x5340('0x23')](handleEntityNotFound(_0x39d7e0,null))['then'](removeEntity(_0x39d7e0,null))[_0x5340('0x52')](handleError(_0x39d7e0,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 3f59b2d..e0726ec 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 _0x6f8b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./variable.attributes','exports','Variable','tools_variables'];(function(_0x13e300,_0x1bcb41){var _0x5a3eea=function(_0x2dfd2a){while(--_0x2dfd2a){_0x13e300['push'](_0x13e300['shift']());}};_0x5a3eea(++_0x1bcb41);}(_0x6f8b,0x145));var _0xb6f8=function(_0x4f5ee5,_0x55bf18){_0x4f5ee5=_0x4f5ee5-0x0;var _0x3270d1=_0x6f8b[_0x4f5ee5];return _0x3270d1;};'use strict';var _=require(_0xb6f8('0x0'));var util=require(_0xb6f8('0x1'));var logger=require(_0xb6f8('0x2'))(_0xb6f8('0x3'));var moment=require(_0xb6f8('0x4'));var BPromise=require(_0xb6f8('0x5'));var rp=require(_0xb6f8('0x6'));var fs=require('fs');var path=require(_0xb6f8('0x7'));var rimraf=require(_0xb6f8('0x8'));var config=require('../../config/environment');var attributes=require(_0xb6f8('0x9'));module[_0xb6f8('0xa')]=function(_0x37bbf8,_0x35a576){return _0x37bbf8['define'](_0xb6f8('0xb'),attributes,{'tableName':_0xb6f8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb775=['exports','Variable','tools_variables','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./variable.attributes'];(function(_0x31a98a,_0x55e896){var _0x70d32b=function(_0x4249bc){while(--_0x4249bc){_0x31a98a['push'](_0x31a98a['shift']());}};_0x70d32b(++_0x55e896);}(_0xb775,0xe7));var _0x5b77=function(_0x4aa555,_0x5a50af){_0x4aa555=_0x4aa555-0x0;var _0x29bc42=_0xb775[_0x4aa555];return _0x29bc42;};'use strict';var _=require(_0x5b77('0x0'));var util=require(_0x5b77('0x1'));var logger=require(_0x5b77('0x2'))('api');var moment=require(_0x5b77('0x3'));var BPromise=require(_0x5b77('0x4'));var rp=require(_0x5b77('0x5'));var fs=require('fs');var path=require(_0x5b77('0x6'));var rimraf=require('rimraf');var config=require(_0x5b77('0x7'));var attributes=require(_0x5b77('0x8'));module[_0x5b77('0x9')]=function(_0x162b18,_0x21e771){return _0x162b18['define'](_0x5b77('0xa'),attributes,{'tableName':_0x5b77('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 6d68ae0..874986e 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 _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_0x5b5a44,_0x5ac308){var _0x339d7f=function(_0xbdabe8){while(--_0xbdabe8){_0x5b5a44['push'](_0x5b5a44['shift']());}};_0x339d7f(++_0x5ac308);}(_0x3e74,0x175));var _0x43e7=function(_0x5dca0e,_0x1db6a6){_0x5dca0e=_0x5dca0e-0x0;var _0x4a96dc=_0x3e74[_0x5dca0e];return _0x4a96dc;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('Variable,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('Variable,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('Variable,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowVariable']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file +var _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x44e088,_0x337135){var _0x57d868=function(_0xd3df0b){while(--_0xd3df0b){_0x44e088['push'](_0x44e088['shift']());}};_0x57d868(++_0x337135);}(_0xf494,0x1c6));var _0x4f49=function(_0x6cfac9,_0x205908){_0x6cfac9=_0x6cfac9-0x0;var _0x3f1343=_0xf494[_0x6cfac9];return _0x3f1343;};'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);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 32f8735..45c5c5a 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 _0xca75=['express','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','pull','/restart','/migrations'];(function(_0x25673a,_0x150b08){var _0x56bb76=function(_0x247e0c){while(--_0x247e0c){_0x25673a['push'](_0x25673a['shift']());}};_0x56bb76(++_0x150b08);}(_0xca75,0x150));var _0x5ca7=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0xca75[_0x1f6f84];return _0x177f40;};'use strict';var express=require(_0x5ca7('0x0'));var router=express['Router']();var auth=require(_0x5ca7('0x1'));var controller=require(_0x5ca7('0x2'));router[_0x5ca7('0x3')]('/',controller[_0x5ca7('0x4')]);router[_0x5ca7('0x3')](_0x5ca7('0x5'),auth[_0x5ca7('0x6')](),auth[_0x5ca7('0x7')](),controller[_0x5ca7('0x8')]);router[_0x5ca7('0x3')](_0x5ca7('0x9'),auth[_0x5ca7('0x6')](),auth[_0x5ca7('0x7')](),controller[_0x5ca7('0xa')]);router[_0x5ca7('0x3')]('/pull',auth[_0x5ca7('0x6')](),auth[_0x5ca7('0x7')](),controller[_0x5ca7('0xb')]);router['get'](_0x5ca7('0xc'),auth['isAuthenticated'](),controller['restart']);router['get'](_0x5ca7('0xd'),controller['migrations']);module['exports']=router; \ No newline at end of file +var _0xfb0e=['/reset','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','canUpdate'];(function(_0x4636d8,_0x434d5b){var _0x52cde0=function(_0x5cc19a){while(--_0x5cc19a){_0x4636d8['push'](_0x4636d8['shift']());}};_0x52cde0(++_0x434d5b);}(_0xfb0e,0x17f));var _0xefb0=function(_0x3a21c0,_0x348451){_0x3a21c0=_0x3a21c0-0x0;var _0x411e84=_0xfb0e[_0x3a21c0];return _0x411e84;};'use strict';var express=require(_0xefb0('0x0'));var router=express[_0xefb0('0x1')]();var auth=require(_0xefb0('0x2'));var controller=require(_0xefb0('0x3'));router[_0xefb0('0x4')]('/',controller['index']);router[_0xefb0('0x4')](_0xefb0('0x5'),auth[_0xefb0('0x6')](),auth[_0xefb0('0x7')](),controller['fetch']);router[_0xefb0('0x4')](_0xefb0('0x8'),auth[_0xefb0('0x6')](),auth['canUpdate'](),controller[_0xefb0('0x9')]);router['get'](_0xefb0('0xa'),auth[_0xefb0('0x6')](),auth[_0xefb0('0x7')](),controller[_0xefb0('0xb')]);router[_0xefb0('0x4')](_0xefb0('0xc'),auth[_0xefb0('0x6')](),controller[_0xefb0('0xd')]);router[_0xefb0('0x4')](_0xefb0('0xe'),controller[_0xefb0('0xf')]);module[_0xefb0('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 9c03cbf..00d1df0 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 _0xd84f=['git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','replace','.js','length','sequelize','Migration','getQueryInterface','constructor','server','Database\x20migrated\x20successfully\x20from\x20version\x20','last','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','status','json','master','error','info'];(function(_0x389722,_0x2cb8ac){var _0x2c41f5=function(_0x471ba9){while(--_0x471ba9){_0x389722['push'](_0x389722['shift']());}};_0x2c41f5(++_0x2cb8ac);}(_0xd84f,0x83));var _0xfd84=function(_0x20a8e2,_0x47608c){_0x20a8e2=_0x20a8e2-0x0;var _0x595df6=_0xd84f[_0x20a8e2];return _0x595df6;};'use strict';var Umzug=require('umzug');var path=require(_0xfd84('0x0'));var fs=require('fs');var _=require(_0xfd84('0x1'));var pkginfo=require(_0xfd84('0x2'))(module,_0xfd84('0x3'));var compareVersions=require(_0xfd84('0x4'));var exec=require(_0xfd84('0x5'))[_0xfd84('0x6')];var db=require(_0xfd84('0x7'))['db'];var config=require(_0xfd84('0x8'));var pm2=require(_0xfd84('0x9'));var logger=require(_0xfd84('0xa'))(_0xfd84('0xb'));var git=require(_0xfd84('0xc'))(config[_0xfd84('0xd')]);exports[_0xfd84('0xe')]=function(_0x3ccdd2,_0x510cc0){var _0x1eebec={'current':module[_0xfd84('0xf')][_0xfd84('0x3')],'phonebar':0x2};if(_0x3ccdd2[_0xfd84('0x10')]&&_0x3ccdd2[_0xfd84('0x10')][_0xfd84('0x11')]){return git[_0xfd84('0x12')]()[_0xfd84('0x13')](function(_0x1f9c6a,_0x14c2a9){_0x1eebec[_0xfd84('0x11')]=(_0x1f9c6a?module[_0xfd84('0xf')][_0xfd84('0x3')]:_0x14c2a9[_0xfd84('0x11')])||'2.0.0';return _0x510cc0[_0xfd84('0x14')](0xc8)[_0xfd84('0x15')](_0x1eebec);});}else{return _0x510cc0[_0xfd84('0x14')](0xc8)[_0xfd84('0x15')](_0x1eebec);}};exports[_0xfd84('0x12')]=function(_0x582c22,_0x1a2237){return git[_0xfd84('0x12')](['origin',_0xfd84('0x16')],function(_0x1bfad0){if(_0x1bfad0){logger[_0xfd84('0x17')](_0x1bfad0);return _0x1a2237[_0xfd84('0x14')](0x1f4)[_0xfd84('0x15')](_0x1bfad0);}logger[_0xfd84('0x18')](_0xfd84('0x19'));return _0x1a2237[_0xfd84('0x14')](0xc8)[_0xfd84('0x15')]({'output':_0xfd84('0x1a')});});};exports['reset']=function(_0x1d8b04,_0xc2ead7){return git[_0xfd84('0x1b')]([_0xfd84('0x1c'),_0xfd84('0x1d')],function(_0x3b2ad1){if(_0x3b2ad1){logger[_0xfd84('0x17')](_0x3b2ad1);return _0xc2ead7[_0xfd84('0x14')](0x1f4)[_0xfd84('0x15')](_0x3b2ad1);}logger[_0xfd84('0x18')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0xc2ead7[_0xfd84('0x14')](0xc8)['json']({'output':_0xfd84('0x1e')});});};exports[_0xfd84('0x1f')]=function(_0x108c4e,_0x4febc4){exec(_0xfd84('0x20'),function(_0x274603,_0x10c6ec,_0x5618e4){logger[_0xfd84('0x18')](_0x10c6ec);logger[_0xfd84('0x18')](_0x5618e4);if(_0x274603){logger[_0xfd84('0x17')](_0x274603);return _0x4febc4[_0xfd84('0x14')](0x1f4)[_0xfd84('0x15')](_0x274603);}return _0x4febc4['status'](0xc8)[_0xfd84('0x15')]({'output':_0x10c6ec});});};exports[_0xfd84('0x21')]=function(_0x14734f,_0x3943f7){return pm2['restart']('motion2')[_0xfd84('0x22')](function(_0x5de94f){logger[_0xfd84('0x18')](_0xfd84('0x23'),_0x5de94f);return _0x3943f7[_0xfd84('0x14')](0xc8)[_0xfd84('0x15')]({'output':_0xfd84('0x24')});})[_0xfd84('0x25')](function(_0x1c3d39){logger['error'](_0x1c3d39);return _0x3943f7['status'](0x1f4)['json'](_0x1c3d39);});};exports[_0xfd84('0x26')]=function(_0x12efaf,_0x5712c1){var _0x1ac626=fs[_0xfd84('0x27')](path[_0xfd84('0x28')](config[_0xfd84('0xd')],'server',_0xfd84('0x26')));var _0x154010=[];for(var _0x4f4256=0x0;_0x4f4256<_0x1ac626['length'];_0x4f4256++){var _0x282a1c=_0x1ac626[_0x4f4256][_0xfd84('0x29')](_0xfd84('0x2a'),'');if(compareVersions(module[_0xfd84('0xf')][_0xfd84('0x3')],_0x282a1c)===-0x1){_0x154010['push'](_0x282a1c);}}if(_0x154010[_0xfd84('0x2b')]){var _0x538e6a=_0x154010['sort'](compareVersions);var _0x295595=new Umzug({'storage':_0xfd84('0x2c'),'storageOptions':{'model':db[_0xfd84('0x2d')],'modelName':_0xfd84('0x2d'),'columnName':'version'},'migrations':{'params':[db[_0xfd84('0x2c')][_0xfd84('0x2e')](),db[_0xfd84('0x2c')][_0xfd84('0x2f')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xfd84('0x28')](config[_0xfd84('0xd')],_0xfd84('0x30'),'migrations'),'pattern':/\.js$/}});_0x295595['up']({'migrations':_['map'](_0x538e6a,function(_0x272a54){return _0x272a54+_0xfd84('0x2a');})})[_0xfd84('0x22')](function(){return _0x5712c1['status'](0xc8)[_0xfd84('0x15')]({'output':_0xfd84('0x31')+module[_0xfd84('0xf')][_0xfd84('0x3')]+'\x20to\x20'+_[_0xfd84('0x32')](_0x538e6a),'migrations':_[_0xfd84('0x28')](_0x538e6a)});})[_0xfd84('0x25')](function(_0x1d2013){if(_0x1d2013 instanceof db['sequelize']['UniqueConstraintError']){return _0x5712c1[_0xfd84('0x14')](0xc8)[_0xfd84('0x15')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x5712c1['status'](0x1f4)[_0xfd84('0x15')](_0x1d2013);}});}else{return _0x5712c1[_0xfd84('0x14')](0xc8)[_0xfd84('0x15')]({'output':_0xfd84('0x33')});}}; \ No newline at end of file +var _0xdc75=['reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','length','replace','.js','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','last','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','update','simple-git','root','exports','query','latest','fetch','tags','2.0.0','status','json','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master'];(function(_0x114a2e,_0x430f9d){var _0x3aad57=function(_0x21c919){while(--_0x21c919){_0x114a2e['push'](_0x114a2e['shift']());}};_0x3aad57(++_0x430f9d);}(_0xdc75,0x80));var _0x5dc7=function(_0x5d8ccb,_0x1966e2){_0x5d8ccb=_0x5d8ccb-0x0;var _0x181a4c=_0xdc75[_0x5d8ccb];return _0x181a4c;};'use strict';var Umzug=require('umzug');var path=require(_0x5dc7('0x0'));var fs=require('fs');var _=require(_0x5dc7('0x1'));var pkginfo=require(_0x5dc7('0x2'))(module,_0x5dc7('0x3'));var compareVersions=require(_0x5dc7('0x4'));var exec=require(_0x5dc7('0x5'))[_0x5dc7('0x6')];var db=require(_0x5dc7('0x7'))['db'];var config=require(_0x5dc7('0x8'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x5dc7('0x9'));var git=require(_0x5dc7('0xa'))(config[_0x5dc7('0xb')]);exports['index']=function(_0x398d97,_0x3d6a69){var _0x58c9d2={'current':module[_0x5dc7('0xc')][_0x5dc7('0x3')],'phonebar':0x2};if(_0x398d97[_0x5dc7('0xd')]&&_0x398d97[_0x5dc7('0xd')][_0x5dc7('0xe')]){return git[_0x5dc7('0xf')]()[_0x5dc7('0x10')](function(_0x548fdc,_0x1b81d6){_0x58c9d2[_0x5dc7('0xe')]=(_0x548fdc?module[_0x5dc7('0xc')]['version']:_0x1b81d6['latest'])||_0x5dc7('0x11');return _0x3d6a69[_0x5dc7('0x12')](0xc8)[_0x5dc7('0x13')](_0x58c9d2);});}else{return _0x3d6a69[_0x5dc7('0x12')](0xc8)[_0x5dc7('0x13')](_0x58c9d2);}};exports[_0x5dc7('0xf')]=function(_0x39e1bc,_0x30539d){return git[_0x5dc7('0xf')]([_0x5dc7('0x14'),'master'],function(_0x353fe0){if(_0x353fe0){logger[_0x5dc7('0x15')](_0x353fe0);return _0x30539d['status'](0x1f4)[_0x5dc7('0x13')](_0x353fe0);}logger[_0x5dc7('0x16')](_0x5dc7('0x17'));return _0x30539d['status'](0xc8)[_0x5dc7('0x13')]({'output':_0x5dc7('0x18')});});};exports[_0x5dc7('0x19')]=function(_0x2b293d,_0x4c4f16){return git['reset']([_0x5dc7('0x1a'),_0x5dc7('0x1b')],function(_0x3daca3){if(_0x3daca3){logger[_0x5dc7('0x15')](_0x3daca3);return _0x4c4f16['status'](0x1f4)[_0x5dc7('0x13')](_0x3daca3);}logger['info'](_0x5dc7('0x1c'));return _0x4c4f16['status'](0xc8)['json']({'output':_0x5dc7('0x1d')});});};exports[_0x5dc7('0x1e')]=function(_0x563015,_0x4c0548){exec(_0x5dc7('0x1f'),function(_0x1aa958,_0x21d857,_0x56a885){logger[_0x5dc7('0x16')](_0x21d857);logger[_0x5dc7('0x16')](_0x56a885);if(_0x1aa958){logger[_0x5dc7('0x15')](_0x1aa958);return _0x4c0548['status'](0x1f4)[_0x5dc7('0x13')](_0x1aa958);}return _0x4c0548['status'](0xc8)[_0x5dc7('0x13')]({'output':_0x21d857});});};exports['restart']=function(_0x379013,_0x5c6a7c){return pm2['restart'](_0x5dc7('0x20'))[_0x5dc7('0x21')](function(_0x52a951){logger[_0x5dc7('0x16')](_0x5dc7('0x22'),_0x52a951);return _0x5c6a7c[_0x5dc7('0x12')](0xc8)[_0x5dc7('0x13')]({'output':_0x5dc7('0x23')});})[_0x5dc7('0x24')](function(_0x2230b9){logger['error'](_0x2230b9);return _0x5c6a7c['status'](0x1f4)[_0x5dc7('0x13')](_0x2230b9);});};exports['migrations']=function(_0x35f502,_0x3473ca){var _0x108dfe=fs[_0x5dc7('0x25')](path[_0x5dc7('0x26')](config['root'],_0x5dc7('0x27'),_0x5dc7('0x28')));var _0x40fbf9=[];for(var _0x1f3ee1=0x0;_0x1f3ee1<_0x108dfe[_0x5dc7('0x29')];_0x1f3ee1++){var _0x32a4ef=_0x108dfe[_0x1f3ee1][_0x5dc7('0x2a')](_0x5dc7('0x2b'),'');if(compareVersions(module[_0x5dc7('0xc')][_0x5dc7('0x3')],_0x32a4ef)===-0x1){_0x40fbf9['push'](_0x32a4ef);}}if(_0x40fbf9[_0x5dc7('0x29')]){var _0x5bac34=_0x40fbf9['sort'](compareVersions);var _0x2544bd=new Umzug({'storage':_0x5dc7('0x2c'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x5dc7('0x3')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0x5dc7('0x2c')][_0x5dc7('0x2d')],function(){throw new Error(_0x5dc7('0x2e'));}],'path':path[_0x5dc7('0x26')](config['root'],_0x5dc7('0x27'),'migrations'),'pattern':/\.js$/}});_0x2544bd['up']({'migrations':_[_0x5dc7('0x2f')](_0x5bac34,function(_0x131777){return _0x131777+'.js';})})[_0x5dc7('0x21')](function(){return _0x3473ca[_0x5dc7('0x12')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports']['version']+_0x5dc7('0x30')+_[_0x5dc7('0x31')](_0x5bac34),'migrations':_['join'](_0x5bac34)});})[_0x5dc7('0x24')](function(_0x59ca6b){if(_0x59ca6b instanceof db[_0x5dc7('0x2c')]['UniqueConstraintError']){return _0x3473ca[_0x5dc7('0x12')](0xc8)['json']({'output':_0x5dc7('0x32')});}else{return _0x3473ca['status'](0x1f4)[_0x5dc7('0x13')](_0x59ca6b);}});}else{return _0x3473ca[_0x5dc7('0x12')](0xc8)[_0x5dc7('0x13')]({'output':_0x5dc7('0x32')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index a9c6053..82aa100 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 _0xa48c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express'];(function(_0x36146f,_0x3b4392){var _0x2e454c=function(_0x2b934d){while(--_0x2b934d){_0x36146f['push'](_0x36146f['shift']());}};_0x2e454c(++_0x3b4392);}(_0xa48c,0x18c));var _0xca48=function(_0x2159e6,_0x55c285){_0x2159e6=_0x2159e6-0x0;var _0x355dbb=_0xa48c[_0x2159e6];return _0x355dbb;};'use strict';var multer=require(_0xca48('0x0'));var util=require(_0xca48('0x1'));var path=require('path');var timeout=require(_0xca48('0x2'));var express=require(_0xca48('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xca48('0x4'));var interaction=require(_0xca48('0x5'));var config=require(_0xca48('0x6'));var controller=require(_0xca48('0x7'));router['get']('/',auth[_0xca48('0x8')](),controller['index']);router[_0xca48('0x9')](_0xca48('0xa'),auth[_0xca48('0x8')](),controller[_0xca48('0xb')]);router['get'](_0xca48('0xc'),auth['isAuthenticated'](),controller[_0xca48('0xd')]);router[_0xca48('0xe')]('/',auth[_0xca48('0x8')](),controller[_0xca48('0xf')]);router[_0xca48('0x10')](_0xca48('0xc'),auth[_0xca48('0x8')](),controller[_0xca48('0x11')]);router[_0xca48('0x12')]('/:id',auth[_0xca48('0x8')](),controller['destroy']);module[_0xca48('0x13')]=router; \ No newline at end of file +var _0x2fb1=['../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','describe','/:id','show','create','put','update','delete','multer','express','Router','fs-extra','../../components/auth/service'];(function(_0x3beefb,_0x54f8f4){var _0x512b34=function(_0x5090be){while(--_0x5090be){_0x3beefb['push'](_0x3beefb['shift']());}};_0x512b34(++_0x54f8f4);}(_0x2fb1,0xd8));var _0x12fb=function(_0x1e37b8,_0x2326c7){_0x1e37b8=_0x1e37b8-0x0;var _0x106e24=_0x2fb1[_0x1e37b8];return _0x106e24;};'use strict';var multer=require(_0x12fb('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x12fb('0x1'));var router=express[_0x12fb('0x2')]();var fs_extra=require(_0x12fb('0x3'));var auth=require(_0x12fb('0x4'));var interaction=require(_0x12fb('0x5'));var config=require(_0x12fb('0x6'));var controller=require(_0x12fb('0x7'));router[_0x12fb('0x8')]('/',auth[_0x12fb('0x9')](),controller['index']);router['get']('/describe',auth[_0x12fb('0x9')](),controller[_0x12fb('0xa')]);router[_0x12fb('0x8')](_0x12fb('0xb'),auth[_0x12fb('0x9')](),controller[_0x12fb('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x12fb('0xd')]);router[_0x12fb('0xe')](_0x12fb('0xb'),auth[_0x12fb('0x9')](),controller[_0x12fb('0xf')]);router[_0x12fb('0x10')]('/:id',auth[_0x12fb('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index e1d57cd..cbe2b89 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 _0x34bd=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x25acc8,_0x4ddf51){var _0x56fd09=function(_0x319ce3){while(--_0x319ce3){_0x25acc8['push'](_0x25acc8['shift']());}};_0x56fd09(++_0x4ddf51);}(_0x34bd,0x1d2));var _0xd34b=function(_0x368b19,_0xcf4ad7){_0x368b19=_0x368b19-0x0;var _0x8ec657=_0x34bd[_0x368b19];return _0x8ec657;};'use strict';var Sequelize=require(_0xd34b('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd34b('0x1')]},'calleridnum':{'type':Sequelize[_0xd34b('0x1')]},'calleridname':{'type':Sequelize[_0xd34b('0x1')]},'queue':{'type':Sequelize[_0xd34b('0x1')]},'interface':{'type':Sequelize[_0xd34b('0x1')]},'membername':{'type':Sequelize[_0xd34b('0x1')]},'agentcalledAt':{'type':Sequelize[_0xd34b('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xd34b('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xd34b('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd34b('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd34b('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd34b('0x4')]},'agentacw':{'type':Sequelize[_0xd34b('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd34b('0x4')]},'reason':{'type':Sequelize[_0xd34b('0x1')]},'lastevent':{'type':Sequelize[_0xd34b('0x1')]},'channel':{'type':Sequelize[_0xd34b('0x1')]},'channelstate':{'type':Sequelize[_0xd34b('0x4')]},'channelstatedesc':{'type':Sequelize[_0xd34b('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd34b('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd34b('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd34b('0x1')]},'exten':{'type':Sequelize[_0xd34b('0x1')]},'priority':{'type':Sequelize[_0xd34b('0x1')]},'destchannel':{'type':Sequelize[_0xd34b('0x1')]},'destchannelstate':{'type':Sequelize[_0xd34b('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xd34b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xd34b('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd34b('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xd34b('0x1')]},'destaccountcode':{'type':Sequelize[_0xd34b('0x1')]},'destcontext':{'type':Sequelize[_0xd34b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xd34b('0x1')]},'destuniqueid':{'type':Sequelize[_0xd34b('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xd34b('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd34b('0x1')],'comment':_0xd34b('0x5')},'transferexten':{'type':Sequelize[_0xd34b('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xd34b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xac35=['exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xac35,0x141));var _0x5ac3=function(_0x1900a3,_0x5c9e62){_0x1900a3=_0x1900a3-0x0;var _0x434e6e=_0xac35[_0x1900a3];return _0x434e6e;};'use strict';var Sequelize=require(_0x5ac3('0x0'));module[_0x5ac3('0x1')]={'type':{'type':Sequelize[_0x5ac3('0x2')]},'uniqueid':{'type':Sequelize[_0x5ac3('0x2')]},'calleridnum':{'type':Sequelize[_0x5ac3('0x2')]},'calleridname':{'type':Sequelize[_0x5ac3('0x2')]},'queue':{'type':Sequelize[_0x5ac3('0x2')]},'interface':{'type':Sequelize[_0x5ac3('0x2')]},'membername':{'type':Sequelize[_0x5ac3('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5ac3('0x3')]},'agentconnectAt':{'type':Sequelize[_0x5ac3('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x5ac3('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x5ac3('0x3')]},'agentdumpAt':{'type':Sequelize[_0x5ac3('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x5ac3('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x5ac3('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x5ac3('0x5')]},'agentacw':{'type':Sequelize[_0x5ac3('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5ac3('0x5')]},'reason':{'type':Sequelize[_0x5ac3('0x2')]},'lastevent':{'type':Sequelize[_0x5ac3('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x5ac3('0x5')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5ac3('0x2')]},'connectedlinename':{'type':Sequelize[_0x5ac3('0x2')]},'language':{'type':Sequelize[_0x5ac3('0x2')]},'accountcode':{'type':Sequelize[_0x5ac3('0x2')]},'context':{'type':Sequelize[_0x5ac3('0x2')]},'exten':{'type':Sequelize[_0x5ac3('0x2')]},'priority':{'type':Sequelize[_0x5ac3('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x5ac3('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x5ac3('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5ac3('0x2')]},'destcalleridname':{'type':Sequelize[_0x5ac3('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x5ac3('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x5ac3('0x2')]},'destlanguage':{'type':Sequelize[_0x5ac3('0x2')]},'destaccountcode':{'type':Sequelize[_0x5ac3('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5ac3('0x2')]},'destuniqueid':{'type':Sequelize[_0x5ac3('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x5ac3('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5ac3('0x2')],'comment':_0x5ac3('0x6')},'transferexten':{'type':Sequelize[_0x5ac3('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x5ac3('0x5')],'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 98e758e..6ab1fa5 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(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 d4ff2f2..344925b 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 _0x96aa=['define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./voiceAgentReport.attributes'];(function(_0x1f6f23,_0x590673){var _0x276030=function(_0xace844){while(--_0xace844){_0x1f6f23['push'](_0x1f6f23['shift']());}};_0x276030(++_0x590673);}(_0x96aa,0x67));var _0xa96a=function(_0x247a1f,_0x57e116){_0x247a1f=_0x247a1f-0x0;var _0x530b3b=_0x96aa[_0x247a1f];return _0x530b3b;};'use strict';var _=require(_0xa96a('0x0'));var util=require(_0xa96a('0x1'));var logger=require('../../config/logger')(_0xa96a('0x2'));var moment=require(_0xa96a('0x3'));var BPromise=require(_0xa96a('0x4'));var rp=require(_0xa96a('0x5'));var fs=require('fs');var path=require(_0xa96a('0x6'));var rimraf=require('rimraf');var config=require(_0xa96a('0x7'));var attributes=require(_0xa96a('0x8'));module['exports']=function(_0x464684,_0x2e9a41){return _0x464684[_0xa96a('0x9')](_0xa96a('0xa'),attributes,{'tableName':_0xa96a('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa96a('0xc'),_0xa96a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc21e=['bluebird','request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','util','../../config/logger','api','moment'];(function(_0x3361c9,_0x1856fc){var _0x4d3d82=function(_0x2abccd){while(--_0x2abccd){_0x3361c9['push'](_0x3361c9['shift']());}};_0x4d3d82(++_0x1856fc);}(_0xc21e,0x1ca));var _0xec21=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc21e[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0xec21('0x0'));var logger=require(_0xec21('0x1'))(_0xec21('0x2'));var moment=require(_0xec21('0x3'));var BPromise=require(_0xec21('0x4'));var rp=require(_0xec21('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec21('0x6'));var config=require(_0xec21('0x7'));var attributes=require(_0xec21('0x8'));module[_0xec21('0x9')]=function(_0x7fce38,_0x15699b){return _0x7fce38[_0xec21('0xa')](_0xec21('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xec21('0xc'),_0xec21('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 521be95..bd0b30a 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 _0xea45=['raw','UpdateVoiceAgentReport','update','options','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xea45,0x137));var _0x5ea4=function(_0x351865,_0x595cbe){_0x351865=_0x351865-0x0;var _0x28e5ff=_0xea45[_0x351865];return _0x28e5ff;};'use strict';var _=require(_0x5ea4('0x0'));var util=require('util');var moment=require(_0x5ea4('0x1'));var BPromise=require(_0x5ea4('0x2'));var rs=require(_0x5ea4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ea4('0x4'))['db'];var utils=require(_0x5ea4('0x5'));var logger=require(_0x5ea4('0x6'))(_0x5ea4('0x7'));var config=require(_0x5ea4('0x8'));var jayson=require(_0x5ea4('0x9'));var client=jayson[_0x5ea4('0xa')][_0x5ea4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c8d54,_0x5d93bf,_0x555dcc){return new BPromise(function(_0x519df5,_0x36dd23){return client[_0x5ea4('0xc')](_0x4c8d54,_0x555dcc)[_0x5ea4('0xd')](function(_0x2b2cf1){logger['info'](_0x5ea4('0xe'),_0x5d93bf,_0x5ea4('0xf'));logger[_0x5ea4('0x10')](_0x5ea4('0x11'),_0x5d93bf,_0x5ea4('0xf'),JSON[_0x5ea4('0x12')](_0x2b2cf1));if(_0x2b2cf1['error']){if(_0x2b2cf1[_0x5ea4('0x13')][_0x5ea4('0x14')]===0x1f4){logger[_0x5ea4('0x13')](_0x5ea4('0xe'),_0x5d93bf,_0x2b2cf1[_0x5ea4('0x13')]['message']);return _0x36dd23(_0x2b2cf1['error']['message']);}logger[_0x5ea4('0x13')](_0x5ea4('0xe'),_0x5d93bf,_0x2b2cf1[_0x5ea4('0x13')][_0x5ea4('0x15')]);return _0x519df5(_0x2b2cf1[_0x5ea4('0x13')][_0x5ea4('0x15')]);}else{logger[_0x5ea4('0x16')](_0x5ea4('0xe'),_0x5d93bf,_0x5ea4('0xf'));_0x519df5(_0x2b2cf1[_0x5ea4('0x17')][_0x5ea4('0x15')]);}})[_0x5ea4('0x18')](function(_0x1f8f55){logger['error'](_0x5ea4('0xe'),_0x5d93bf,_0x1f8f55);_0x36dd23(_0x1f8f55);});});}exports[_0x5ea4('0x19')]=function(_0x22512f){var _0x3c43f9=this;return new Promise(function(_0x24e7fc,_0x4dd22f){return db[_0x5ea4('0x1a')][_0x5ea4('0x1b')](_0x22512f[_0x5ea4('0x1c')],{'raw':_0x22512f['options']?_0x22512f['options'][_0x5ea4('0x1d')]===undefined?!![]:![]:!![]})[_0x5ea4('0xd')](function(_0x4817a4){logger[_0x5ea4('0x16')](_0x5ea4('0x19'),_0x22512f);logger[_0x5ea4('0x10')](_0x5ea4('0x19'),_0x22512f,JSON[_0x5ea4('0x12')](_0x4817a4));_0x24e7fc(_0x4817a4);})['catch'](function(_0x1e4d79){logger[_0x5ea4('0x13')]('CreateVoiceAgentReport',_0x1e4d79['message'],_0x22512f);_0x4dd22f(_0x3c43f9['error'](0x1f4,_0x1e4d79[_0x5ea4('0x15')]));});});};exports[_0x5ea4('0x1e')]=function(_0x160342){var _0x2e6c96=this;return new Promise(function(_0x30ec64,_0x15c2db){return db['VoiceAgentReport'][_0x5ea4('0x1f')](_0x160342[_0x5ea4('0x1c')],{'raw':_0x160342[_0x5ea4('0x20')]?_0x160342[_0x5ea4('0x20')][_0x5ea4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x160342['options']?_0x160342[_0x5ea4('0x20')]['where']||null:null,'attributes':_0x160342['options']?_0x160342[_0x5ea4('0x20')][_0x5ea4('0x21')]||null:null,'limit':_0x160342[_0x5ea4('0x20')]?_0x160342['options']['limit']||null:null})[_0x5ea4('0xd')](function(_0x47ded5){logger[_0x5ea4('0x16')]('UpdateVoiceAgentReport',_0x160342);logger[_0x5ea4('0x10')](_0x5ea4('0x1e'),_0x160342,JSON[_0x5ea4('0x12')](_0x47ded5));_0x30ec64(_0x47ded5);})[_0x5ea4('0x18')](function(_0x29e132){logger[_0x5ea4('0x13')](_0x5ea4('0x1e'),_0x29e132[_0x5ea4('0x15')],_0x160342);_0x15c2db(_0x2e6c96[_0x5ea4('0x13')](0x1f4,_0x29e132[_0x5ea4('0x15')]));});});}; \ No newline at end of file +var _0x3edd=['http','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','body','options','raw','CreateVoiceAgentReport','catch','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x10477b,_0x3716a3){var _0xc5cb82=function(_0x1c7edf){while(--_0x1c7edf){_0x10477b['push'](_0x10477b['shift']());}};_0xc5cb82(++_0x3716a3);}(_0x3edd,0xc1));var _0xd3ed=function(_0x50846b,_0x4fc657){_0x50846b=_0x50846b-0x0;var _0x4c1dba=_0x3edd[_0x50846b];return _0x4c1dba;};'use strict';var _=require('lodash');var util=require(_0xd3ed('0x0'));var moment=require(_0xd3ed('0x1'));var BPromise=require(_0xd3ed('0x2'));var rs=require(_0xd3ed('0x3'));var fs=require('fs');var Redis=require(_0xd3ed('0x4'));var db=require(_0xd3ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd3ed('0x6'))(_0xd3ed('0x7'));var config=require(_0xd3ed('0x8'));var jayson=require(_0xd3ed('0x9'));var client=jayson[_0xd3ed('0xa')][_0xd3ed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38f596,_0x58c0bd,_0x3124fc){return new BPromise(function(_0x5d18f5,_0x493b57){return client['request'](_0x38f596,_0x3124fc)[_0xd3ed('0xc')](function(_0x4f1dba){logger[_0xd3ed('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x58c0bd,_0xd3ed('0xe'));logger[_0xd3ed('0xf')](_0xd3ed('0x10'),_0x58c0bd,_0xd3ed('0xe'),JSON[_0xd3ed('0x11')](_0x4f1dba));if(_0x4f1dba['error']){if(_0x4f1dba[_0xd3ed('0x12')][_0xd3ed('0x13')]===0x1f4){logger[_0xd3ed('0x12')](_0xd3ed('0x14'),_0x58c0bd,_0x4f1dba[_0xd3ed('0x12')][_0xd3ed('0x15')]);return _0x493b57(_0x4f1dba[_0xd3ed('0x12')][_0xd3ed('0x15')]);}logger[_0xd3ed('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x58c0bd,_0x4f1dba['error'][_0xd3ed('0x15')]);return _0x5d18f5(_0x4f1dba[_0xd3ed('0x12')][_0xd3ed('0x15')]);}else{logger[_0xd3ed('0xd')](_0xd3ed('0x14'),_0x58c0bd,_0xd3ed('0xe'));_0x5d18f5(_0x4f1dba[_0xd3ed('0x16')]['message']);}})['catch'](function(_0x76b422){logger[_0xd3ed('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x58c0bd,_0x76b422);_0x493b57(_0x76b422);});});}exports['CreateVoiceAgentReport']=function(_0x359de8){var _0x279fdd=this;return new Promise(function(_0x25bc0e,_0x1df3f7){return db['VoiceAgentReport']['create'](_0x359de8[_0xd3ed('0x17')],{'raw':_0x359de8[_0xd3ed('0x18')]?_0x359de8[_0xd3ed('0x18')][_0xd3ed('0x19')]===undefined?!![]:![]:!![]})[_0xd3ed('0xc')](function(_0x1928ce){logger[_0xd3ed('0xd')]('CreateVoiceAgentReport',_0x359de8);logger['debug'](_0xd3ed('0x1a'),_0x359de8,JSON[_0xd3ed('0x11')](_0x1928ce));_0x25bc0e(_0x1928ce);})[_0xd3ed('0x1b')](function(_0x393091){logger[_0xd3ed('0x12')](_0xd3ed('0x1a'),_0x393091[_0xd3ed('0x15')],_0x359de8);_0x1df3f7(_0x279fdd[_0xd3ed('0x12')](0x1f4,_0x393091[_0xd3ed('0x15')]));});});};exports[_0xd3ed('0x1c')]=function(_0x8d1d27){var _0x580916=this;return new Promise(function(_0x33c89c,_0x4d9b29){return db[_0xd3ed('0x1d')][_0xd3ed('0x1e')](_0x8d1d27['body'],{'raw':_0x8d1d27[_0xd3ed('0x18')]?_0x8d1d27[_0xd3ed('0x18')][_0xd3ed('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8d1d27[_0xd3ed('0x18')]?_0x8d1d27[_0xd3ed('0x18')][_0xd3ed('0x1f')]||null:null,'attributes':_0x8d1d27[_0xd3ed('0x18')]?_0x8d1d27[_0xd3ed('0x18')][_0xd3ed('0x20')]||null:null,'limit':_0x8d1d27[_0xd3ed('0x18')]?_0x8d1d27['options'][_0xd3ed('0x21')]||null:null})['then'](function(_0x2fb4c9){logger[_0xd3ed('0xd')]('UpdateVoiceAgentReport',_0x8d1d27);logger[_0xd3ed('0xf')]('UpdateVoiceAgentReport',_0x8d1d27,JSON[_0xd3ed('0x11')](_0x2fb4c9));_0x33c89c(_0x2fb4c9);})[_0xd3ed('0x1b')](function(_0x304b32){logger['error'](_0xd3ed('0x1c'),_0x304b32[_0xd3ed('0x15')],_0x8d1d27);_0x4d9b29(_0x580916[_0xd3ed('0x12')](0x1f4,_0x304b32[_0xd3ed('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index eb3e1a7..845e5c0 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 _0xbf61=['get','/describe','isAuthenticated','describe','/:id','show','post','put','update','updateWithRetry','delete','destroy','express','../../components/auth/service','./voiceCallReport.controller'];(function(_0x4dae1b,_0x30e8d5){var _0x2f0b96=function(_0x48afcb){while(--_0x48afcb){_0x4dae1b['push'](_0x4dae1b['shift']());}};_0x2f0b96(++_0x30e8d5);}(_0xbf61,0x10b));var _0x1bf6=function(_0x50a549,_0x510994){_0x50a549=_0x50a549-0x0;var _0x11c9f9=_0xbf61[_0x50a549];return _0x11c9f9;};'use strict';var express=require(_0x1bf6('0x0'));var router=express['Router']();var auth=require(_0x1bf6('0x1'));var controller=require(_0x1bf6('0x2'));router[_0x1bf6('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1bf6('0x3')](_0x1bf6('0x4'),auth[_0x1bf6('0x5')](),controller[_0x1bf6('0x6')]);router[_0x1bf6('0x3')](_0x1bf6('0x7'),auth[_0x1bf6('0x5')](),controller[_0x1bf6('0x8')]);router[_0x1bf6('0x9')]('/',auth[_0x1bf6('0x5')](),controller['create']);router[_0x1bf6('0xa')]('/:id',auth[_0x1bf6('0x5')](),controller[_0x1bf6('0xb')]);router[_0x1bf6('0xa')]('/with-retry/:id',auth[_0x1bf6('0x5')](),controller[_0x1bf6('0xc')]);router[_0x1bf6('0xd')]('/:id',auth[_0x1bf6('0x5')](),controller[_0x1bf6('0xe')]);module['exports']=router; \ No newline at end of file +var _0x9a59=['put','update','/with-retry/:id','updateWithRetry','delete','destroy','exports','express','get','describe','/:id','post','isAuthenticated','create'];(function(_0x5782e9,_0x2df428){var _0x50f9ae=function(_0x460bfe){while(--_0x460bfe){_0x5782e9['push'](_0x5782e9['shift']());}};_0x50f9ae(++_0x2df428);}(_0x9a59,0x1e3));var _0x99a5=function(_0x16ff6e,_0x1e7e71){_0x16ff6e=_0x16ff6e-0x0;var _0x31124a=_0x9a59[_0x16ff6e];return _0x31124a;};'use strict';var express=require(_0x99a5('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./voiceCallReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x99a5('0x1')]('/describe',auth['isAuthenticated'](),controller[_0x99a5('0x2')]);router['get'](_0x99a5('0x3'),auth['isAuthenticated'](),controller['show']);router[_0x99a5('0x4')]('/',auth[_0x99a5('0x5')](),controller[_0x99a5('0x6')]);router[_0x99a5('0x7')]('/:id',auth[_0x99a5('0x5')](),controller[_0x99a5('0x8')]);router['put'](_0x99a5('0x9'),auth[_0x99a5('0x5')](),controller[_0x99a5('0xa')]);router[_0x99a5('0xb')]('/:id',auth[_0x99a5('0x5')](),controller[_0x99a5('0xc')]);module[_0x99a5('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 55b1537..6c669e2 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 _0x7969=['STRING','ENUM','inbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER'];(function(_0x48721b,_0x2063b7){var _0x5e2426=function(_0x19b071){while(--_0x19b071){_0x48721b['push'](_0x48721b['shift']());}};_0x5e2426(++_0x2063b7);}(_0x7969,0x1c2));var _0x9796=function(_0x2a7875,_0x1d4b3b){_0x2a7875=_0x2a7875-0x0;var _0x3aa89c=_0x7969[_0x2a7875];return _0x3aa89c;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x9796('0x0')]},'type':{'type':Sequelize[_0x9796('0x1')](_0x9796('0x2'),'internal','outbound',_0x9796('0x3'),_0x9796('0x4'),_0x9796('0x5'))},'tag':{'type':Sequelize[_0x9796('0x0')]},'accountcode':{'type':Sequelize[_0x9796('0x0')]},'source':{'type':Sequelize[_0x9796('0x0')]},'destination':{'type':Sequelize[_0x9796('0x0')]},'destinationcontext':{'type':Sequelize[_0x9796('0x0')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9796('0x0')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x9796('0x6')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x9796('0x7')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x9796('0x7')]},'duration':{'type':Sequelize[_0x9796('0x8')]},'billableseconds':{'type':Sequelize[_0x9796('0x8')]},'mohtime':{'type':Sequelize[_0x9796('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9796('0x0')]},'amaflags':{'type':Sequelize[_0x9796('0x0')]},'userfield':{'type':Sequelize[_0x9796('0x0')]},'userDisposition':{'type':Sequelize[_0x9796('0x0')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x9796('0x0')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x9796('0x0')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x9796('0x0')]}}; \ No newline at end of file +var _0x687a=['INTEGER','sequelize','exports','STRING','inbound','internal','outbound','inbound-fax','outbound-fax','TEXT','DATE'];(function(_0x2316b9,_0x87059b){var _0x4405a9=function(_0xd9a3e1){while(--_0xd9a3e1){_0x2316b9['push'](_0x2316b9['shift']());}};_0x4405a9(++_0x87059b);}(_0x687a,0xe8));var _0xa687=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x687a[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xa687('0x0'));module[_0xa687('0x1')]={'uniqueid':{'type':Sequelize[_0xa687('0x2')]},'type':{'type':Sequelize['ENUM'](_0xa687('0x3'),_0xa687('0x4'),_0xa687('0x5'),_0xa687('0x6'),_0xa687('0x7'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa687('0x2')]},'source':{'type':Sequelize[_0xa687('0x2')]},'destination':{'type':Sequelize[_0xa687('0x2')]},'destinationcontext':{'type':Sequelize[_0xa687('0x2')]},'callerid':{'type':Sequelize[_0xa687('0x2')]},'channel':{'type':Sequelize[_0xa687('0x2')]},'destinationchannel':{'type':Sequelize[_0xa687('0x2')]},'lastapplication':{'type':Sequelize[_0xa687('0x2')]},'lastdata':{'type':Sequelize[_0xa687('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xa687('0x9')]},'endtime':{'type':Sequelize[_0xa687('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xa687('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa687('0x2')]},'amaflags':{'type':Sequelize[_0xa687('0x2')]},'userfield':{'type':Sequelize[_0xa687('0x2')]},'userDisposition':{'type':Sequelize[_0xa687('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xa687('0x2')]},'note':{'type':Sequelize[_0xa687('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xa687('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 25dcea4..da5e829 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 _0x627e=['update','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','type','VIRTUAL','filter','VoiceCallReport','includeAll','include','User','findAll','rows','show','params','options','find','create','describe','user','body','uniqueid','catch','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','offset','undefined','limit','status','set','Content-Range','json'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x627e,0x14a));var _0xe627=function(_0x3d32b7,_0x251e65){_0x3d32b7=_0x3d32b7-0x0;var _0x844e43=_0x627e[_0x3d32b7];return _0x844e43;};'use strict';var _=require(_0xe627('0x0'));var qs=require(_0xe627('0x1'));var logger=require(_0xe627('0x2'))(_0xe627('0x3'));var db=require(_0xe627('0x4'))['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x2b7158,_0x328881){_0x328881=_0x328881||0xc8;return function(_0x2abdc7){if(_0x2abdc7){return _0x2b7158['status'](_0x328881)['json'](_0x2abdc7);}};}function respondWithFilteredResult(_0x4efcad,_0x1a1a3d){return function(_0x3f2791){if(_0x3f2791){var _0x45e49a=typeof _0x1a1a3d[_0xe627('0x5')]===_0xe627('0x6')&&typeof _0x1a1a3d[_0xe627('0x7')]==='undefined';var _0x3f2948=_0x3f2791['count'];var _0x56549e=_0x45e49a?0x0:_0x1a1a3d[_0xe627('0x5')];var _0x952c23=_0x45e49a?_0x3f2791['count']:_0x1a1a3d['offset']+_0x1a1a3d[_0xe627('0x7')];var _0x2c1820;if(_0x952c23>=_0x3f2948){_0x952c23=_0x3f2948;_0x2c1820=0xc8;}else{_0x2c1820=0xce;}_0x4efcad[_0xe627('0x8')](_0x2c1820);return _0x4efcad[_0xe627('0x9')](_0xe627('0xa'),_0x56549e+'-'+_0x952c23+'/'+_0x3f2948)[_0xe627('0xb')](_0x3f2791);}return null;};}function saveUpdates(_0x24261d){return function(_0x3919be){if(_0x3919be){return _0x3919be[_0xe627('0xc')](_0x24261d)['then'](function(_0x419fdf){return _0x419fdf;});}return null;};}function removeEntity(_0x1983f8){return function(_0x9f7eef){if(_0x9f7eef){return _0x9f7eef['destroy']()[_0xe627('0xd')](function(){_0x1983f8[_0xe627('0x8')](0xcc)[_0xe627('0xe')]();});}};}function handleEntityNotFound(_0x119d9c){return function(_0x62896f){if(!_0x62896f){_0x119d9c[_0xe627('0xf')](0x194);}return _0x62896f;};}function handleError(_0x271325,_0x54720a){_0x54720a=_0x54720a||0x1f4;return function(_0x241544){logger[_0xe627('0x10')](_0x241544[_0xe627('0x11')]);if(_0x241544[_0xe627('0x12')]){delete _0x241544[_0xe627('0x12')];}_0x271325[_0xe627('0x8')](_0x54720a)[_0xe627('0x13')](_0x241544);};}exports[_0xe627('0x14')]=function(_0x538b22,_0x24fddd){var _0x48e43a={},_0x2a4c68={},_0x565213={'count':0x0,'rows':[]};var _0x4d8881=_[_0xe627('0x15')](db['VoiceCallReport'][_0xe627('0x16')],function(_0x3391ce){return{'name':_0x3391ce['fieldName'],'type':_0x3391ce['type']['key']};});_0x2a4c68[_0xe627('0x17')]=_[_0xe627('0x15')](_0x4d8881,'name');_0x2a4c68[_0xe627('0x18')]=_[_0xe627('0x19')](_0x538b22['query']);_0x2a4c68[_0xe627('0x1a')]=_[_0xe627('0x1b')](_0x2a4c68['model'],_0x2a4c68[_0xe627('0x18')]);_0x48e43a[_0xe627('0x1c')]=_[_0xe627('0x1b')](_0x2a4c68['model'],qs[_0xe627('0x1d')](_0x538b22[_0xe627('0x18')][_0xe627('0x1d')]));_0x48e43a[_0xe627('0x1c')]=_0x48e43a['attributes'][_0xe627('0x1e')]?_0x48e43a[_0xe627('0x1c')]:_0x2a4c68[_0xe627('0x17')];if(!_0x538b22[_0xe627('0x18')][_0xe627('0x1f')](_0xe627('0x20'))){_0x48e43a[_0xe627('0x7')]=qs[_0xe627('0x7')](_0x538b22[_0xe627('0x18')]['limit']);_0x48e43a[_0xe627('0x5')]=qs['offset'](_0x538b22['query'][_0xe627('0x5')]);}_0x48e43a[_0xe627('0x21')]=qs['sort'](_0x538b22[_0xe627('0x18')]['sort']);_0x48e43a[_0xe627('0x22')]=qs['filters'](_[_0xe627('0x23')](_0x538b22[_0xe627('0x18')],_0x2a4c68['filters']),_0x4d8881);if(_0x538b22[_0xe627('0x18')]['filter']){_0x48e43a[_0xe627('0x22')]=_[_0xe627('0x24')](_0x48e43a[_0xe627('0x22')],{'$or':_[_0xe627('0x15')](_0x4d8881,function(_0x4098de){if(_0x4098de[_0xe627('0x25')]!==_0xe627('0x26')){var _0x3ece9e={};_0x3ece9e[_0x4098de[_0xe627('0x12')]]={'$like':'%'+_0x538b22[_0xe627('0x18')][_0xe627('0x27')]+'%'};return _0x3ece9e;}})});}_0x48e43a=_['merge']({},_0x48e43a,_0x538b22['options']);var _0x183fed={'where':_0x48e43a['where']};return db[_0xe627('0x28')]['count'](_0x183fed)['then'](function(_0x422451){_0x565213['count']=_0x422451;if(_0x538b22['query'][_0xe627('0x29')]){_0x48e43a[_0xe627('0x2a')]=[{'attributes':['id',_0xe627('0x12'),'fullname','alias'],'model':db['User'],'as':_0xe627('0x2b')}];}return db['VoiceCallReport'][_0xe627('0x2c')](_0x48e43a);})[_0xe627('0xd')](function(_0x5e4512){_0x565213[_0xe627('0x2d')]=_0x5e4512;return _0x565213;})[_0xe627('0xd')](respondWithFilteredResult(_0x24fddd,_0x48e43a))['catch'](handleError(_0x24fddd,null));};exports[_0xe627('0x2e')]=function(_0x40a23b,_0x10fd2b){var _0x2ddb18={'raw':!![],'where':{'id':_0x40a23b[_0xe627('0x2f')]['id']}},_0x188a21={};_0x188a21['model']=_[_0xe627('0x19')](db['VoiceCallReport'][_0xe627('0x16')]);_0x188a21['query']=_[_0xe627('0x19')](_0x40a23b[_0xe627('0x18')]);_0x188a21[_0xe627('0x1a')]=_[_0xe627('0x1b')](_0x188a21[_0xe627('0x17')],_0x188a21[_0xe627('0x18')]);_0x2ddb18[_0xe627('0x1c')]=_[_0xe627('0x1b')](_0x188a21[_0xe627('0x17')],qs[_0xe627('0x1d')](_0x40a23b[_0xe627('0x18')][_0xe627('0x1d')]));_0x2ddb18[_0xe627('0x1c')]=_0x2ddb18['attributes']['length']?_0x2ddb18['attributes']:_0x188a21['model'];if(_0x40a23b['query']['includeAll']){_0x2ddb18[_0xe627('0x2a')]=[{'all':!![]}];}_0x2ddb18=_['merge']({},_0x2ddb18,_0x40a23b[_0xe627('0x30')]);return db['VoiceCallReport'][_0xe627('0x31')](_0x2ddb18)[_0xe627('0xd')](handleEntityNotFound(_0x10fd2b,null))[_0xe627('0xd')](respondWithResult(_0x10fd2b,null))['catch'](handleError(_0x10fd2b,null));};exports['create']=function(_0x26064c,_0x5f3374){return db['VoiceCallReport'][_0xe627('0x32')](_0x26064c['body'],{})[_0xe627('0xd')](respondWithResult(_0x5f3374,0xc9))['catch'](handleError(_0x5f3374,null));};exports['destroy']=function(_0x408142,_0x26bc3e){return db[_0xe627('0x28')]['find']({'where':{'id':_0x408142['params']['id']}})[_0xe627('0xd')](handleEntityNotFound(_0x26bc3e,null))['then'](removeEntity(_0x26bc3e,null))['catch'](handleError(_0x26bc3e,null));};exports[_0xe627('0x33')]=function(_0x459c3b,_0x4561e0){return db[_0xe627('0x28')][_0xe627('0x33')]()[_0xe627('0xd')](respondWithResult(_0x4561e0,null))['catch'](handleError(_0x4561e0,null));};function findForUpdate(_0x7e0476){return db[_0xe627('0x28')]['find']({'where':{'uniqueid':_0x7e0476['params']['id'],'UserId':{'$or':[null,_0x7e0476[_0xe627('0x34')]['id']]}}});}exports[_0xe627('0xc')]=function(_0x1f6ee5,_0x18bd41){if(_0x1f6ee5[_0xe627('0x35')][_0xe627('0x36')]){delete _0x1f6ee5[_0xe627('0x35')]['uniqueid'];}return findForUpdate(_0x1f6ee5)[_0xe627('0xd')](handleEntityNotFound(_0x18bd41,null))['then'](saveUpdates(_0x1f6ee5[_0xe627('0x35')],null))[_0xe627('0xd')](respondWithResult(_0x18bd41,null))[_0xe627('0x37')](handleError(_0x18bd41,null));};exports['updateWithRetry']=function(_0x3ba3ed,_0x5da478,_0x28d954){if(_0x3ba3ed[_0xe627('0x35')][_0xe627('0x36')]){delete _0x3ba3ed[_0xe627('0x35')][_0xe627('0x36')];}promiseRetry(function(_0x5b52a4){return findForUpdate(_0x3ba3ed)[_0xe627('0xd')](function(_0x14c0a6){if(_0x14c0a6!==null){return _0x14c0a6;}else{_0x5b52a4(new Error(_0xe627('0x38')));}});},{'retries':0x4,'minTimeout':0xfa})[_0xe627('0xd')](function(_0x2d6417){if(!_0x2d6417){return new Promise(function(_0x148eec){_0x148eec(handleEntityNotFound(_0x5da478)());});}else{return _0x2d6417[_0xe627('0xc')](_0x3ba3ed[_0xe627('0x35')])[_0xe627('0xd')](function(_0x3824da){return respondWithResult(_0x5da478)(_0x3824da);});}},function(){handleEntityNotFound(_0x5da478)();});}; \ No newline at end of file +var _0xc5df=['nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','VoiceCallReport','includeAll','include','fullname','User','findAll','catch','show','params','rawAttributes','keys','length','find','body','describe','uniqueid','updateWithRetry','../../config/logger','api','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','index','type','model','map','query','intersection','fields','attributes'];(function(_0x563b86,_0x326c58){var _0x3e6478=function(_0x27ba2b){while(--_0x27ba2b){_0x563b86['push'](_0x563b86['shift']());}};_0x3e6478(++_0x326c58);}(_0xc5df,0x80));var _0xfc5d=function(_0x1fc221,_0x51f78a){_0x1fc221=_0x1fc221-0x0;var _0x3f463d=_0xc5df[_0x1fc221];return _0x3f463d;};'use strict';var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0xfc5d('0x0'))(_0xfc5d('0x1'));var db=require('../../mysqldb')['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x153d49,_0x30d66b){_0x30d66b=_0x30d66b||0xc8;return function(_0x562d72){if(_0x562d72){return _0x153d49[_0xfc5d('0x2')](_0x30d66b)[_0xfc5d('0x3')](_0x562d72);}};}function respondWithFilteredResult(_0x4a49a9,_0x1c8057){return function(_0x2df24e){if(_0x2df24e){var _0x1b8b10=typeof _0x1c8057[_0xfc5d('0x4')]===_0xfc5d('0x5')&&typeof _0x1c8057[_0xfc5d('0x6')]==='undefined';var _0x1b6237=_0x2df24e[_0xfc5d('0x7')];var _0x4f9a05=_0x1b8b10?0x0:_0x1c8057[_0xfc5d('0x4')];var _0x34671f=_0x1b8b10?_0x2df24e['count']:_0x1c8057[_0xfc5d('0x4')]+_0x1c8057[_0xfc5d('0x6')];var _0x25d332;if(_0x34671f>=_0x1b6237){_0x34671f=_0x1b6237;_0x25d332=0xc8;}else{_0x25d332=0xce;}_0x4a49a9[_0xfc5d('0x2')](_0x25d332);return _0x4a49a9['set'](_0xfc5d('0x8'),_0x4f9a05+'-'+_0x34671f+'/'+_0x1b6237)[_0xfc5d('0x3')](_0x2df24e);}return null;};}function saveUpdates(_0xa2421d){return function(_0x4f364c){if(_0x4f364c){return _0x4f364c[_0xfc5d('0x9')](_0xa2421d)[_0xfc5d('0xa')](function(_0x4a4eff){return _0x4a4eff;});}return null;};}function removeEntity(_0x3a5154){return function(_0x57581b){if(_0x57581b){return _0x57581b[_0xfc5d('0xb')]()['then'](function(){_0x3a5154[_0xfc5d('0x2')](0xcc)[_0xfc5d('0xc')]();});}};}function handleEntityNotFound(_0x1606ee){return function(_0x105bea){if(!_0x105bea){_0x1606ee[_0xfc5d('0xd')](0x194);}return _0x105bea;};}function handleError(_0x561131,_0x44d245){_0x44d245=_0x44d245||0x1f4;return function(_0x1d496e){logger['error'](_0x1d496e[_0xfc5d('0xe')]);if(_0x1d496e['name']){delete _0x1d496e[_0xfc5d('0xf')];}_0x561131['status'](_0x44d245)[_0xfc5d('0x10')](_0x1d496e);};}exports[_0xfc5d('0x11')]=function(_0x1b8c0d,_0x1bcee2){var _0x396de4={},_0x4e6aa6={},_0x5e5023={'count':0x0,'rows':[]};var _0x4580d7=_['map'](db['VoiceCallReport']['rawAttributes'],function(_0x2fe92b){return{'name':_0x2fe92b['fieldName'],'type':_0x2fe92b[_0xfc5d('0x12')]['key']};});_0x4e6aa6[_0xfc5d('0x13')]=_[_0xfc5d('0x14')](_0x4580d7,_0xfc5d('0xf'));_0x4e6aa6[_0xfc5d('0x15')]=_['keys'](_0x1b8c0d['query']);_0x4e6aa6['filters']=_[_0xfc5d('0x16')](_0x4e6aa6[_0xfc5d('0x13')],_0x4e6aa6[_0xfc5d('0x15')]);_0x396de4['attributes']=_[_0xfc5d('0x16')](_0x4e6aa6[_0xfc5d('0x13')],qs[_0xfc5d('0x17')](_0x1b8c0d[_0xfc5d('0x15')][_0xfc5d('0x17')]));_0x396de4[_0xfc5d('0x18')]=_0x396de4[_0xfc5d('0x18')]['length']?_0x396de4['attributes']:_0x4e6aa6[_0xfc5d('0x13')];if(!_0x1b8c0d['query']['hasOwnProperty'](_0xfc5d('0x19'))){_0x396de4['limit']=qs[_0xfc5d('0x6')](_0x1b8c0d[_0xfc5d('0x15')]['limit']);_0x396de4[_0xfc5d('0x4')]=qs['offset'](_0x1b8c0d['query'][_0xfc5d('0x4')]);}_0x396de4[_0xfc5d('0x1a')]=qs[_0xfc5d('0x1b')](_0x1b8c0d[_0xfc5d('0x15')][_0xfc5d('0x1b')]);_0x396de4[_0xfc5d('0x1c')]=qs[_0xfc5d('0x1d')](_['pick'](_0x1b8c0d[_0xfc5d('0x15')],_0x4e6aa6['filters']),_0x4580d7);if(_0x1b8c0d[_0xfc5d('0x15')][_0xfc5d('0x1e')]){_0x396de4['where']=_[_0xfc5d('0x1f')](_0x396de4[_0xfc5d('0x1c')],{'$or':_[_0xfc5d('0x14')](_0x4580d7,function(_0x47ba6e){if(_0x47ba6e[_0xfc5d('0x12')]!==_0xfc5d('0x20')){var _0x5ee60c={};_0x5ee60c[_0x47ba6e[_0xfc5d('0xf')]]={'$like':'%'+_0x1b8c0d['query'][_0xfc5d('0x1e')]+'%'};return _0x5ee60c;}})});}_0x396de4=_[_0xfc5d('0x1f')]({},_0x396de4,_0x1b8c0d[_0xfc5d('0x21')]);var _0x3cb6cd={'where':_0x396de4[_0xfc5d('0x1c')]};return db[_0xfc5d('0x22')][_0xfc5d('0x7')](_0x3cb6cd)['then'](function(_0x4bb2f6){_0x5e5023['count']=_0x4bb2f6;if(_0x1b8c0d['query'][_0xfc5d('0x23')]){_0x396de4[_0xfc5d('0x24')]=[{'attributes':['id',_0xfc5d('0xf'),_0xfc5d('0x25'),'alias'],'model':db['User'],'as':_0xfc5d('0x26')}];}return db[_0xfc5d('0x22')][_0xfc5d('0x27')](_0x396de4);})[_0xfc5d('0xa')](function(_0x50bba7){_0x5e5023['rows']=_0x50bba7;return _0x5e5023;})[_0xfc5d('0xa')](respondWithFilteredResult(_0x1bcee2,_0x396de4))[_0xfc5d('0x28')](handleError(_0x1bcee2,null));};exports[_0xfc5d('0x29')]=function(_0x101dc2,_0x197db6){var _0x3a3203={'raw':!![],'where':{'id':_0x101dc2[_0xfc5d('0x2a')]['id']}},_0x215d53={};_0x215d53[_0xfc5d('0x13')]=_['keys'](db[_0xfc5d('0x22')][_0xfc5d('0x2b')]);_0x215d53['query']=_[_0xfc5d('0x2c')](_0x101dc2[_0xfc5d('0x15')]);_0x215d53['filters']=_['intersection'](_0x215d53['model'],_0x215d53['query']);_0x3a3203['attributes']=_[_0xfc5d('0x16')](_0x215d53['model'],qs[_0xfc5d('0x17')](_0x101dc2[_0xfc5d('0x15')]['fields']));_0x3a3203[_0xfc5d('0x18')]=_0x3a3203['attributes'][_0xfc5d('0x2d')]?_0x3a3203['attributes']:_0x215d53[_0xfc5d('0x13')];if(_0x101dc2[_0xfc5d('0x15')][_0xfc5d('0x23')]){_0x3a3203[_0xfc5d('0x24')]=[{'all':!![]}];}_0x3a3203=_['merge']({},_0x3a3203,_0x101dc2[_0xfc5d('0x21')]);return db[_0xfc5d('0x22')][_0xfc5d('0x2e')](_0x3a3203)[_0xfc5d('0xa')](handleEntityNotFound(_0x197db6,null))[_0xfc5d('0xa')](respondWithResult(_0x197db6,null))[_0xfc5d('0x28')](handleError(_0x197db6,null));};exports['create']=function(_0x48dc95,_0x1cca31){return db[_0xfc5d('0x22')]['create'](_0x48dc95[_0xfc5d('0x2f')],{})[_0xfc5d('0xa')](respondWithResult(_0x1cca31,0xc9))[_0xfc5d('0x28')](handleError(_0x1cca31,null));};exports['destroy']=function(_0x116e72,_0x1c1cae){return db[_0xfc5d('0x22')][_0xfc5d('0x2e')]({'where':{'id':_0x116e72[_0xfc5d('0x2a')]['id']}})[_0xfc5d('0xa')](handleEntityNotFound(_0x1c1cae,null))[_0xfc5d('0xa')](removeEntity(_0x1c1cae,null))[_0xfc5d('0x28')](handleError(_0x1c1cae,null));};exports[_0xfc5d('0x30')]=function(_0x5815c9,_0x39cb3a){return db['VoiceCallReport']['describe']()[_0xfc5d('0xa')](respondWithResult(_0x39cb3a,null))[_0xfc5d('0x28')](handleError(_0x39cb3a,null));};function findForUpdate(_0x359916){return db[_0xfc5d('0x22')][_0xfc5d('0x2e')]({'where':{'uniqueid':_0x359916[_0xfc5d('0x2a')]['id'],'UserId':{'$or':[null,_0x359916['user']['id']]}}});}exports[_0xfc5d('0x9')]=function(_0x3ee53b,_0x3bc690){if(_0x3ee53b['body']['uniqueid']){delete _0x3ee53b[_0xfc5d('0x2f')][_0xfc5d('0x31')];}return findForUpdate(_0x3ee53b)[_0xfc5d('0xa')](handleEntityNotFound(_0x3bc690,null))[_0xfc5d('0xa')](saveUpdates(_0x3ee53b[_0xfc5d('0x2f')],null))[_0xfc5d('0xa')](respondWithResult(_0x3bc690,null))['catch'](handleError(_0x3bc690,null));};exports[_0xfc5d('0x32')]=function(_0x37940b,_0x197226,_0x1fa87f){if(_0x37940b[_0xfc5d('0x2f')]['uniqueid']){delete _0x37940b[_0xfc5d('0x2f')][_0xfc5d('0x31')];}promiseRetry(function(_0x17f852){return findForUpdate(_0x37940b)[_0xfc5d('0xa')](function(_0x5130d8){if(_0x5130d8!==null){return _0x5130d8;}else{_0x17f852(new Error('No\x20such\x20report'));}});},{'retries':0x4,'minTimeout':0xfa})[_0xfc5d('0xa')](function(_0x2afdfe){if(!_0x2afdfe){return new Promise(function(_0x512a30){_0x512a30(handleEntityNotFound(_0x197226)());});}else{return _0x2afdfe['update'](_0x37940b[_0xfc5d('0x2f')])[_0xfc5d('0xa')](function(_0x57d088){return respondWithResult(_0x197226)(_0x57d088);});}},function(){handleEntityNotFound(_0x197226)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index e5f386a..0ffe5e8 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 _0x2716=['../../config/environment','define','report_call','uniqueid','../../config/logger','api','bluebird','request-promise','path'];(function(_0x17cb62,_0x4504e6){var _0x32178f=function(_0x4f2d9b){while(--_0x4f2d9b){_0x17cb62['push'](_0x17cb62['shift']());}};_0x32178f(++_0x4504e6);}(_0x2716,0x1e1));var _0x6271=function(_0x527a20,_0x347399){_0x527a20=_0x527a20-0x0;var _0x21f5e0=_0x2716[_0x527a20];return _0x21f5e0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6271('0x0'))(_0x6271('0x1'));var moment=require('moment');var BPromise=require(_0x6271('0x2'));var rp=require(_0x6271('0x3'));var fs=require('fs');var path=require(_0x6271('0x4'));var rimraf=require('rimraf');var config=require(_0x6271('0x5'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x1704c4,_0x39ada8){return _0x1704c4[_0x6271('0x6')]('VoiceCallReport',attributes,{'tableName':_0x6271('0x7'),'paranoid':![],'indexes':[{'fields':[_0x6271('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ca3=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','VoiceCallReport','report_call','uniqueid','util'];(function(_0x40fecc,_0x5ad9e6){var _0x38c329=function(_0x19cbb6){while(--_0x19cbb6){_0x40fecc['push'](_0x40fecc['shift']());}};_0x38c329(++_0x5ad9e6);}(_0x7ca3,0x9b));var _0x37ca=function(_0x3a0ebd,_0x47f368){_0x3a0ebd=_0x3a0ebd-0x0;var _0x51a660=_0x7ca3[_0x3a0ebd];return _0x51a660;};'use strict';var _=require('lodash');var util=require(_0x37ca('0x0'));var logger=require(_0x37ca('0x1'))(_0x37ca('0x2'));var moment=require(_0x37ca('0x3'));var BPromise=require(_0x37ca('0x4'));var rp=require(_0x37ca('0x5'));var fs=require('fs');var path=require(_0x37ca('0x6'));var rimraf=require('rimraf');var config=require(_0x37ca('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0x37ca('0x8')]=function(_0x3f0a23,_0xbb16e3){return _0x3f0a23['define'](_0x37ca('0x9'),attributes,{'tableName':_0x37ca('0xa'),'paranoid':![],'indexes':[{'fields':[_0x37ca('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 3e7e7c9..2fc7050 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 _0xab3f=['catch','CreateVoiceCallReport','body','update','limit','UpdateVoiceCallReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','include','map','model','then'];(function(_0x5c9365,_0x17daf5){var _0x386302=function(_0x19a745){while(--_0x19a745){_0x5c9365['push'](_0x5c9365['shift']());}};_0x386302(++_0x17daf5);}(_0xab3f,0x72));var _0xfab3=function(_0x13fa3f,_0xd779d3){_0x13fa3f=_0x13fa3f-0x0;var _0x1b4548=_0xab3f[_0x13fa3f];return _0x1b4548;};'use strict';var _=require(_0xfab3('0x0'));var util=require('util');var moment=require(_0xfab3('0x1'));var BPromise=require(_0xfab3('0x2'));var rs=require(_0xfab3('0x3'));var fs=require('fs');var Redis=require(_0xfab3('0x4'));var db=require(_0xfab3('0x5'))['db'];var utils=require(_0xfab3('0x6'));var logger=require(_0xfab3('0x7'))(_0xfab3('0x8'));var config=require(_0xfab3('0x9'));var jayson=require(_0xfab3('0xa'));var client=jayson[_0xfab3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xde2d99,_0x2edb21,_0x10f201){return new BPromise(function(_0x4749b0,_0x16f3e8){return client['request'](_0xde2d99,_0x10f201)['then'](function(_0x30d46b){logger['info'](_0xfab3('0xc'),_0x2edb21,'request\x20sent');logger[_0xfab3('0xd')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x2edb21,_0xfab3('0xe'),JSON[_0xfab3('0xf')](_0x30d46b));if(_0x30d46b[_0xfab3('0x10')]){if(_0x30d46b[_0xfab3('0x10')]['code']===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x2edb21,_0x30d46b[_0xfab3('0x10')][_0xfab3('0x11')]);return _0x16f3e8(_0x30d46b[_0xfab3('0x10')][_0xfab3('0x11')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x2edb21,_0x30d46b[_0xfab3('0x10')][_0xfab3('0x11')]);return _0x4749b0(_0x30d46b[_0xfab3('0x10')][_0xfab3('0x11')]);}else{logger[_0xfab3('0x12')](_0xfab3('0xc'),_0x2edb21,_0xfab3('0xe'));_0x4749b0(_0x30d46b[_0xfab3('0x13')]['message']);}})['catch'](function(_0x24f03a){logger[_0xfab3('0x10')](_0xfab3('0xc'),_0x2edb21,_0x24f03a);_0x16f3e8(_0x24f03a);});});}exports[_0xfab3('0x14')]=function(_0x3d08b1){var _0x23cd33=this;return new Promise(function(_0x183ead,_0x3c8221){return db[_0xfab3('0x15')]['findAll']({'raw':_0x3d08b1['options']?_0x3d08b1[_0xfab3('0x16')][_0xfab3('0x17')]===undefined?!![]:![]:!![],'where':_0x3d08b1[_0xfab3('0x16')]?_0x3d08b1['options'][_0xfab3('0x18')]||null:null,'attributes':_0x3d08b1[_0xfab3('0x16')]?_0x3d08b1[_0xfab3('0x16')][_0xfab3('0x19')]||null:null,'limit':_0x3d08b1[_0xfab3('0x16')]?_0x3d08b1['options']['limit']||null:null,'include':_0x3d08b1['options']?_0x3d08b1[_0xfab3('0x16')][_0xfab3('0x1a')]?_[_0xfab3('0x1b')](_0x3d08b1[_0xfab3('0x16')]['include'],function(_0x3d7131){return{'model':db[_0x3d7131[_0xfab3('0x1c')]],'as':_0x3d7131['as'],'attributes':_0x3d7131[_0xfab3('0x19')],'include':_0x3d7131[_0xfab3('0x1a')]?_[_0xfab3('0x1b')](_0x3d7131['include'],function(_0x56516e){return{'model':db[_0x56516e[_0xfab3('0x1c')]],'as':_0x56516e['as'],'attributes':_0x56516e[_0xfab3('0x19')],'include':_0x56516e['include']?_['map'](_0x56516e[_0xfab3('0x1a')],function(_0x1a7d60){return{'model':db[_0x1a7d60[_0xfab3('0x1c')]],'as':_0x1a7d60['as'],'attributes':_0x1a7d60['attributes']};}):[]};}):[]};}):[]:[]})[_0xfab3('0x1d')](function(_0x2383bb){logger[_0xfab3('0x12')](_0xfab3('0x14'),_0x3d08b1);logger['debug'](_0xfab3('0x14'),_0x3d08b1,JSON[_0xfab3('0xf')](_0x2383bb));_0x183ead(_0x2383bb);})[_0xfab3('0x1e')](function(_0x14aa2d){logger[_0xfab3('0x10')](_0xfab3('0x14'),_0x14aa2d[_0xfab3('0x11')],_0x3d08b1);_0x3c8221(_0x23cd33['error'](0x1f4,_0x14aa2d[_0xfab3('0x11')]));});});};exports[_0xfab3('0x1f')]=function(_0x1ae467){var _0x43fdab=this;return new Promise(function(_0x1ee85c,_0x5c2c0f){return db[_0xfab3('0x15')]['create'](_0x1ae467[_0xfab3('0x20')],{'raw':_0x1ae467[_0xfab3('0x16')]?_0x1ae467['options'][_0xfab3('0x17')]===undefined?!![]:![]:!![]})[_0xfab3('0x1d')](function(_0x143031){logger[_0xfab3('0x12')](_0xfab3('0x1f'),_0x1ae467);logger['debug'](_0xfab3('0x1f'),_0x1ae467,JSON[_0xfab3('0xf')](_0x143031));_0x1ee85c(_0x143031);})[_0xfab3('0x1e')](function(_0x2edef0){logger[_0xfab3('0x10')](_0xfab3('0x1f'),_0x2edef0[_0xfab3('0x11')],_0x1ae467);_0x5c2c0f(_0x43fdab[_0xfab3('0x10')](0x1f4,_0x2edef0[_0xfab3('0x11')]));});});};exports['UpdateVoiceCallReport']=function(_0x5a841f){var _0xded2ca=this;return new Promise(function(_0x16cc91,_0x53e13c){return db[_0xfab3('0x15')][_0xfab3('0x21')](_0x5a841f[_0xfab3('0x20')],{'raw':_0x5a841f[_0xfab3('0x16')]?_0x5a841f[_0xfab3('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a841f[_0xfab3('0x16')]?_0x5a841f[_0xfab3('0x16')][_0xfab3('0x18')]||null:null,'attributes':_0x5a841f['options']?_0x5a841f['options']['attributes']||null:null,'limit':_0x5a841f['options']?_0x5a841f[_0xfab3('0x16')][_0xfab3('0x22')]||null:null})[_0xfab3('0x1d')](function(_0x381902){logger[_0xfab3('0x12')](_0xfab3('0x23'),_0x5a841f);logger[_0xfab3('0xd')](_0xfab3('0x23'),_0x5a841f,JSON[_0xfab3('0xf')](_0x381902));_0x16cc91(_0x381902);})[_0xfab3('0x1e')](function(_0x275c4f){logger[_0xfab3('0x10')](_0xfab3('0x23'),_0x275c4f[_0xfab3('0x11')],_0x5a841f);_0x53e13c(_0xded2ca['error'](0x1f4,_0x275c4f[_0xfab3('0x11')]));});});}; \ No newline at end of file +var _0xdef6=['code','error','message','info','catch','VoiceCallReport','findAll','options','raw','where','limit','include','map','attributes','model','stringify','GetVoiceCallReport','CreateVoiceCallReport','create','update','body','UpdateVoiceCallReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x46891a,_0x3e3051){var _0x4c578d=function(_0x3cf400){while(--_0x3cf400){_0x46891a['push'](_0x46891a['shift']());}};_0x4c578d(++_0x3e3051);}(_0xdef6,0xaa));var _0x6def=function(_0x2f9026,_0x3b954b){_0x2f9026=_0x2f9026-0x0;var _0x2dec99=_0xdef6[_0x2f9026];return _0x2dec99;};'use strict';var _=require('lodash');var util=require(_0x6def('0x0'));var moment=require('moment');var BPromise=require(_0x6def('0x1'));var rs=require(_0x6def('0x2'));var fs=require('fs');var Redis=require(_0x6def('0x3'));var db=require(_0x6def('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6def('0x5'))(_0x6def('0x6'));var config=require(_0x6def('0x7'));var jayson=require(_0x6def('0x8'));var client=jayson['client'][_0x6def('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a0d39,_0x1d4a7f,_0x37e597){return new BPromise(function(_0x287416,_0x5c3a9e){return client[_0x6def('0xa')](_0x4a0d39,_0x37e597)[_0x6def('0xb')](function(_0x436cba){logger['info'](_0x6def('0xc'),_0x1d4a7f,_0x6def('0xd'));logger[_0x6def('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x1d4a7f,_0x6def('0xd'),JSON['stringify'](_0x436cba));if(_0x436cba['error']){if(_0x436cba['error'][_0x6def('0xf')]===0x1f4){logger['error'](_0x6def('0xc'),_0x1d4a7f,_0x436cba[_0x6def('0x10')][_0x6def('0x11')]);return _0x5c3a9e(_0x436cba[_0x6def('0x10')][_0x6def('0x11')]);}logger[_0x6def('0x10')](_0x6def('0xc'),_0x1d4a7f,_0x436cba[_0x6def('0x10')][_0x6def('0x11')]);return _0x287416(_0x436cba[_0x6def('0x10')][_0x6def('0x11')]);}else{logger[_0x6def('0x12')](_0x6def('0xc'),_0x1d4a7f,'request\x20sent');_0x287416(_0x436cba['result'][_0x6def('0x11')]);}})[_0x6def('0x13')](function(_0x4cfbed){logger[_0x6def('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x1d4a7f,_0x4cfbed);_0x5c3a9e(_0x4cfbed);});});}exports['GetVoiceCallReport']=function(_0x15a408){var _0x59779b=this;return new Promise(function(_0x2dbb12,_0x1b30b1){return db[_0x6def('0x14')][_0x6def('0x15')]({'raw':_0x15a408[_0x6def('0x16')]?_0x15a408[_0x6def('0x16')][_0x6def('0x17')]===undefined?!![]:![]:!![],'where':_0x15a408[_0x6def('0x16')]?_0x15a408[_0x6def('0x16')][_0x6def('0x18')]||null:null,'attributes':_0x15a408[_0x6def('0x16')]?_0x15a408[_0x6def('0x16')]['attributes']||null:null,'limit':_0x15a408['options']?_0x15a408[_0x6def('0x16')][_0x6def('0x19')]||null:null,'include':_0x15a408[_0x6def('0x16')]?_0x15a408[_0x6def('0x16')][_0x6def('0x1a')]?_[_0x6def('0x1b')](_0x15a408[_0x6def('0x16')][_0x6def('0x1a')],function(_0x2f81e2){return{'model':db[_0x2f81e2['model']],'as':_0x2f81e2['as'],'attributes':_0x2f81e2[_0x6def('0x1c')],'include':_0x2f81e2[_0x6def('0x1a')]?_[_0x6def('0x1b')](_0x2f81e2[_0x6def('0x1a')],function(_0x2de558){return{'model':db[_0x2de558['model']],'as':_0x2de558['as'],'attributes':_0x2de558['attributes'],'include':_0x2de558[_0x6def('0x1a')]?_['map'](_0x2de558['include'],function(_0x4c4f94){return{'model':db[_0x4c4f94[_0x6def('0x1d')]],'as':_0x4c4f94['as'],'attributes':_0x4c4f94[_0x6def('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a8c43){logger[_0x6def('0x12')]('GetVoiceCallReport',_0x15a408);logger[_0x6def('0xe')]('GetVoiceCallReport',_0x15a408,JSON[_0x6def('0x1e')](_0x4a8c43));_0x2dbb12(_0x4a8c43);})[_0x6def('0x13')](function(_0x32559c){logger[_0x6def('0x10')](_0x6def('0x1f'),_0x32559c[_0x6def('0x11')],_0x15a408);_0x1b30b1(_0x59779b[_0x6def('0x10')](0x1f4,_0x32559c[_0x6def('0x11')]));});});};exports[_0x6def('0x20')]=function(_0x4df1c1){var _0x4d57e4=this;return new Promise(function(_0x5bb09d,_0x5dcd73){return db[_0x6def('0x14')][_0x6def('0x21')](_0x4df1c1['body'],{'raw':_0x4df1c1['options']?_0x4df1c1['options'][_0x6def('0x17')]===undefined?!![]:![]:!![]})[_0x6def('0xb')](function(_0x14e906){logger[_0x6def('0x12')](_0x6def('0x20'),_0x4df1c1);logger[_0x6def('0xe')](_0x6def('0x20'),_0x4df1c1,JSON[_0x6def('0x1e')](_0x14e906));_0x5bb09d(_0x14e906);})[_0x6def('0x13')](function(_0x15e2ac){logger[_0x6def('0x10')](_0x6def('0x20'),_0x15e2ac[_0x6def('0x11')],_0x4df1c1);_0x5dcd73(_0x4d57e4[_0x6def('0x10')](0x1f4,_0x15e2ac[_0x6def('0x11')]));});});};exports['UpdateVoiceCallReport']=function(_0x5dac0f){var _0x5c6fe9=this;return new Promise(function(_0x468e44,_0x35c4a3){return db[_0x6def('0x14')][_0x6def('0x22')](_0x5dac0f[_0x6def('0x23')],{'raw':_0x5dac0f[_0x6def('0x16')]?_0x5dac0f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5dac0f[_0x6def('0x16')]?_0x5dac0f[_0x6def('0x16')][_0x6def('0x18')]||null:null,'attributes':_0x5dac0f[_0x6def('0x16')]?_0x5dac0f[_0x6def('0x16')][_0x6def('0x1c')]||null:null,'limit':_0x5dac0f[_0x6def('0x16')]?_0x5dac0f[_0x6def('0x16')][_0x6def('0x19')]||null:null})[_0x6def('0xb')](function(_0x280487){logger['info'](_0x6def('0x24'),_0x5dac0f);logger['debug'](_0x6def('0x24'),_0x5dac0f,JSON['stringify'](_0x280487));_0x468e44(_0x280487);})['catch'](function(_0x19dd4d){logger[_0x6def('0x10')]('UpdateVoiceCallReport',_0x19dd4d[_0x6def('0x11')],_0x5dac0f);_0x35c4a3(_0x5c6fe9[_0x6def('0x10')](0x1f4,_0x19dd4d['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 36eb3b0..4426d44 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 _0x03a8=['../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','post','create','put','/:id','update','destroy','util','path','Router','fs-extra'];(function(_0x147393,_0x49150c){var _0x2097fc=function(_0x36233c){while(--_0x36233c){_0x147393['push'](_0x147393['shift']());}};_0x2097fc(++_0x49150c);}(_0x03a8,0x1eb));var _0x803a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03a8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x803a('0x0'));var path=require(_0x803a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x803a('0x2')]();var fs_extra=require(_0x803a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x803a('0x4'));var config=require('../../config/environment');var controller=require(_0x803a('0x5'));router[_0x803a('0x6')]('/',auth[_0x803a('0x7')](),controller[_0x803a('0x8')]);router[_0x803a('0x6')]('/:id',auth[_0x803a('0x7')](),controller['show']);router[_0x803a('0x9')]('/',auth[_0x803a('0x7')](),controller[_0x803a('0xa')]);router[_0x803a('0xb')](_0x803a('0xc'),auth[_0x803a('0x7')](),controller[_0x803a('0xd')]);router['delete'](_0x803a('0xc'),auth[_0x803a('0x7')](),controller[_0x803a('0xe')]);module['exports']=router; \ No newline at end of file +var _0xd518=['update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','get','/:id','post','create','put'];(function(_0x266ddc,_0x45aa52){var _0x39c1d7=function(_0x4cd07c){while(--_0x4cd07c){_0x266ddc['push'](_0x266ddc['shift']());}};_0x39c1d7(++_0x45aa52);}(_0xd518,0x88));var _0x8d51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd518[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8d51('0x0'));var util=require(_0x8d51('0x1'));var path=require(_0x8d51('0x2'));var timeout=require(_0x8d51('0x3'));var express=require('express');var router=express[_0x8d51('0x4')]();var fs_extra=require(_0x8d51('0x5'));var auth=require(_0x8d51('0x6'));var interaction=require(_0x8d51('0x7'));var config=require(_0x8d51('0x8'));var controller=require(_0x8d51('0x9'));router['get']('/',auth[_0x8d51('0xa')](),controller['index']);router[_0x8d51('0xb')](_0x8d51('0xc'),auth[_0x8d51('0xa')](),controller['show']);router[_0x8d51('0xd')]('/',auth[_0x8d51('0xa')](),controller[_0x8d51('0xe')]);router[_0x8d51('0xf')](_0x8d51('0xc'),auth[_0x8d51('0xa')](),controller[_0x8d51('0x10')]);router['delete'](_0x8d51('0xc'),auth[_0x8d51('0xa')](),controller[_0x8d51('0x11')]);module[_0x8d51('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 191593c..65e62f9 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 _0xbeb8=['name','STRING','setDataValue','options','getDataValue','split','BOOLEAN','sequelize'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xbeb8,0x1ef));var _0x8beb=function(_0x51887b,_0x5eb96e){_0x51887b=_0x51887b-0x0;var _0x2a7792=_0xbeb8[_0x51887b];return _0x2a7792;};'use strict';var Sequelize=require(_0x8beb('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x8beb('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x8beb('0x2')],'set':function(_0x557fac){this[_0x8beb('0x3')](_0x8beb('0x4'),_0x557fac?_0x557fac['join'](''):[]);},'get':function(){return this[_0x8beb('0x5')](_0x8beb('0x4'))?this[_0x8beb('0x5')](_0x8beb('0x4'))[_0x8beb('0x6')](''):[];}},'auth':{'type':Sequelize[_0x8beb('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x8beb('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9635=['sequelize','exports','STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0x2e7672,_0x492e99){var _0x53c3ae=function(_0x185935){while(--_0x185935){_0x2e7672['push'](_0x2e7672['shift']());}};_0x53c3ae(++_0x492e99);}(_0x9635,0x19a));var _0x5963=function(_0x329d17,_0x2b0158){_0x329d17=_0x329d17-0x0;var _0x445605=_0x9635[_0x329d17];return _0x445605;};'use strict';var Sequelize=require(_0x5963('0x0'));module[_0x5963('0x1')]={'name':{'type':Sequelize[_0x5963('0x2')]},'prefix':{'type':Sequelize[_0x5963('0x2')],'unique':_0x5963('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x5963('0x2')],'set':function(_0xb37746){this[_0x5963('0x4')](_0x5963('0x5'),_0xb37746?_0xb37746[_0x5963('0x6')](''):[]);},'get':function(){return this[_0x5963('0x7')](_0x5963('0x5'))?this[_0x5963('0x7')](_0x5963('0x5'))[_0x5963('0x8')](''):[];}},'auth':{'type':Sequelize[_0x5963('0x9')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x5963('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x5963('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 2a4f2b0..4e16223 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 _0xdfcc=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','VoiceChanSpy','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','rows','show','params','keys','rawAttributes','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x42c118,_0x197006){_0x42c118=_0x42c118-0x0;var _0x112ebd=_0xdfcc[_0x42c118];return _0x112ebd;};'use strict';var emlformat=require(_0xcdfc('0x0'));var rimraf=require(_0xcdfc('0x1'));var zipdir=require(_0xcdfc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcdfc('0x3'));var moment=require(_0xcdfc('0x4'));var BPromise=require(_0xcdfc('0x5'));var Mustache=require('mustache');var util=require(_0xcdfc('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcdfc('0x7'));var fs=require('fs');var fs_extra=require(_0xcdfc('0x8'));var _=require('lodash');var squel=require(_0xcdfc('0x9'));var crypto=require(_0xcdfc('0xa'));var jsforce=require(_0xcdfc('0xb'));var deskjs=require(_0xcdfc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xcdfc('0xd'));var Papa=require('papaparse');var Redis=require(_0xcdfc('0xe'));var authService=require(_0xcdfc('0xf'));var qs=require(_0xcdfc('0x10'));var as=require(_0xcdfc('0x11'));var hardwareService=require(_0xcdfc('0x12'));var logger=require(_0xcdfc('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xcdfc('0x14'));var licenseUtil=require(_0xcdfc('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b4b35,_0x358805){_0x358805=_0x358805||0xcc;return function(_0x5b278d){if(_0x5b278d){return _0x3b4b35[_0xcdfc('0x16')](_0x358805);}return _0x3b4b35[_0xcdfc('0x17')](_0x358805)[_0xcdfc('0x18')]();};}function respondWithResult(_0x4c6e77,_0x1378fe){_0x1378fe=_0x1378fe||0xc8;return function(_0xb5a56a){if(_0xb5a56a){return _0x4c6e77['status'](_0x1378fe)[_0xcdfc('0x19')](_0xb5a56a);}};}function respondWithFilteredResult(_0x2cbc4c,_0x1e2282){return function(_0x5189bd){if(_0x5189bd){var _0x3834aa=typeof _0x1e2282[_0xcdfc('0x1a')]==='undefined'&&typeof _0x1e2282[_0xcdfc('0x1b')]===_0xcdfc('0x1c');var _0x51ab72=_0x5189bd[_0xcdfc('0x1d')];var _0x446b6a=_0x3834aa?0x0:_0x1e2282[_0xcdfc('0x1a')];var _0x53324a=_0x3834aa?_0x5189bd[_0xcdfc('0x1d')]:_0x1e2282[_0xcdfc('0x1a')]+_0x1e2282['limit'];var _0x3e1707;if(_0x53324a>=_0x51ab72){_0x53324a=_0x51ab72;_0x3e1707=0xc8;}else{_0x3e1707=0xce;}_0x2cbc4c[_0xcdfc('0x17')](_0x3e1707);return _0x2cbc4c[_0xcdfc('0x1e')](_0xcdfc('0x1f'),_0x446b6a+'-'+_0x53324a+'/'+_0x51ab72)[_0xcdfc('0x19')](_0x5189bd);}return null;};}function patchUpdates(_0xd43d98){return function(_0x47d52a){try{jsonpatch[_0xcdfc('0x20')](_0x47d52a,_0xd43d98,!![]);}catch(_0x5f2293){return BPromise[_0xcdfc('0x21')](_0x5f2293);}return _0x47d52a[_0xcdfc('0x22')]();};}function saveUpdates(_0x2b7868,_0x578f36){return function(_0x4e58ce){if(_0x4e58ce){return _0x4e58ce[_0xcdfc('0x23')](_0x2b7868)[_0xcdfc('0x24')](function(_0x2e6e1c){return _0x2e6e1c;});}return null;};}function removeEntity(_0x338194,_0x2b9084){return function(_0x458587){if(_0x458587){return _0x458587[_0xcdfc('0x25')]()[_0xcdfc('0x24')](function(){var _0xf31d8a=_0x458587[_0xcdfc('0x26')]({'plain':!![]});var _0x44ab0b='ChanSpies';return db[_0xcdfc('0x27')]['destroy']({'where':{'type':_0x44ab0b,'resourceId':_0xf31d8a['id']}})[_0xcdfc('0x24')](function(){return _0x458587;});})[_0xcdfc('0x24')](function(){_0x338194[_0xcdfc('0x17')](0xcc)[_0xcdfc('0x18')]();});}};}function handleEntityNotFound(_0x1de322,_0x180198){return function(_0x3ef346){if(!_0x3ef346){_0x1de322['sendStatus'](0x194);}return _0x3ef346;};}function handleError(_0x48827a,_0x35809e){_0x35809e=_0x35809e||0x1f4;return function(_0x260843){logger[_0xcdfc('0x28')](_0x260843[_0xcdfc('0x29')]);if(_0x260843['name']){delete _0x260843[_0xcdfc('0x2a')];}_0x48827a[_0xcdfc('0x17')](_0x35809e)['send'](_0x260843);};}exports['index']=function(_0x29cc4e,_0x3854cf){var _0x3fbeff={},_0x4b56c4={},_0x411229={'count':0x0,'rows':[]};var _0x209ca7=_[_0xcdfc('0x2b')](db[_0xcdfc('0x2c')]['rawAttributes'],function(_0x36c82d){return{'name':_0x36c82d['fieldName'],'type':_0x36c82d['type'][_0xcdfc('0x2d')]};});_0x4b56c4[_0xcdfc('0x2e')]=_['map'](_0x209ca7,'name');_0x4b56c4[_0xcdfc('0x2f')]=_['keys'](_0x29cc4e[_0xcdfc('0x2f')]);_0x4b56c4[_0xcdfc('0x30')]=_[_0xcdfc('0x31')](_0x4b56c4['model'],_0x4b56c4[_0xcdfc('0x2f')]);_0x3fbeff[_0xcdfc('0x32')]=_[_0xcdfc('0x31')](_0x4b56c4[_0xcdfc('0x2e')],qs[_0xcdfc('0x33')](_0x29cc4e['query'][_0xcdfc('0x33')]));_0x3fbeff[_0xcdfc('0x32')]=_0x3fbeff[_0xcdfc('0x32')][_0xcdfc('0x34')]?_0x3fbeff[_0xcdfc('0x32')]:_0x4b56c4[_0xcdfc('0x2e')];if(!_0x29cc4e[_0xcdfc('0x2f')][_0xcdfc('0x35')](_0xcdfc('0x36'))){_0x3fbeff[_0xcdfc('0x1b')]=qs[_0xcdfc('0x1b')](_0x29cc4e[_0xcdfc('0x2f')]['limit']);_0x3fbeff[_0xcdfc('0x1a')]=qs[_0xcdfc('0x1a')](_0x29cc4e[_0xcdfc('0x2f')][_0xcdfc('0x1a')]);}_0x3fbeff[_0xcdfc('0x37')]=qs['sort'](_0x29cc4e[_0xcdfc('0x2f')][_0xcdfc('0x38')]);_0x3fbeff[_0xcdfc('0x39')]=qs[_0xcdfc('0x30')](_[_0xcdfc('0x3a')](_0x29cc4e['query'],_0x4b56c4[_0xcdfc('0x30')]),_0x209ca7);if(_0x29cc4e[_0xcdfc('0x2f')]['filter']){_0x3fbeff[_0xcdfc('0x39')]=_[_0xcdfc('0x3b')](_0x3fbeff[_0xcdfc('0x39')],{'$or':_[_0xcdfc('0x2b')](_0x209ca7,function(_0x537c71){if(_0x537c71['type']!=='VIRTUAL'){var _0x3ddf1d={};_0x3ddf1d[_0x537c71[_0xcdfc('0x2a')]]={'$like':'%'+_0x29cc4e['query'][_0xcdfc('0x3c')]+'%'};return _0x3ddf1d;}})});}_0x3fbeff=_[_0xcdfc('0x3b')]({},_0x3fbeff,_0x29cc4e[_0xcdfc('0x3d')]);var _0x28a9da={'where':_0x3fbeff['where']};return db[_0xcdfc('0x2c')]['count'](_0x28a9da)[_0xcdfc('0x24')](function(_0x30a5f9){_0x411229[_0xcdfc('0x1d')]=_0x30a5f9;if(_0x29cc4e[_0xcdfc('0x2f')]['includeAll']){_0x3fbeff[_0xcdfc('0x3e')]=[{'all':!![]}];}return db[_0xcdfc('0x2c')]['findAll'](_0x3fbeff);})['then'](function(_0x2904ef){_0x411229[_0xcdfc('0x3f')]=_0x2904ef;return _0x411229;})[_0xcdfc('0x24')](respondWithFilteredResult(_0x3854cf,_0x3fbeff))['catch'](handleError(_0x3854cf,null));};exports[_0xcdfc('0x40')]=function(_0x179a9,_0xd0d9f0){var _0xb58e4b={'raw':![],'where':{'id':_0x179a9[_0xcdfc('0x41')]['id']}},_0x3ab023={};_0x3ab023['model']=_[_0xcdfc('0x42')](db['VoiceChanSpy'][_0xcdfc('0x43')]);_0x3ab023[_0xcdfc('0x2f')]=_['keys'](_0x179a9['query']);_0x3ab023[_0xcdfc('0x30')]=_[_0xcdfc('0x31')](_0x3ab023[_0xcdfc('0x2e')],_0x3ab023[_0xcdfc('0x2f')]);_0xb58e4b[_0xcdfc('0x32')]=_[_0xcdfc('0x31')](_0x3ab023['model'],qs[_0xcdfc('0x33')](_0x179a9[_0xcdfc('0x2f')][_0xcdfc('0x33')]));_0xb58e4b[_0xcdfc('0x32')]=_0xb58e4b[_0xcdfc('0x32')][_0xcdfc('0x34')]?_0xb58e4b[_0xcdfc('0x32')]:_0x3ab023[_0xcdfc('0x2e')];if(_0x179a9[_0xcdfc('0x2f')]['includeAll']){_0xb58e4b[_0xcdfc('0x3e')]=[{'all':!![]}];}_0xb58e4b=_[_0xcdfc('0x3b')]({},_0xb58e4b,_0x179a9[_0xcdfc('0x3d')]);return db['VoiceChanSpy']['find'](_0xb58e4b)[_0xcdfc('0x24')](handleEntityNotFound(_0xd0d9f0,null))['then'](respondWithResult(_0xd0d9f0,null))[_0xcdfc('0x44')](handleError(_0xd0d9f0,null));};exports[_0xcdfc('0x45')]=function(_0x4f2a39,_0x536b93){return db[_0xcdfc('0x2c')][_0xcdfc('0x45')](_0x4f2a39[_0xcdfc('0x46')],{})[_0xcdfc('0x24')](function(_0x410f87){var _0x428a6c=_0x4f2a39[_0xcdfc('0x47')]['get']({'plain':!![]});if(!_0x428a6c)throw new Error(_0xcdfc('0x48'));if(_0x428a6c[_0xcdfc('0x49')]==='user'){var _0x289ca9=_0x410f87[_0xcdfc('0x26')]({'plain':!![]});var _0x204d1c=_0xcdfc('0x4a');return db[_0xcdfc('0x4b')][_0xcdfc('0x4c')]({'where':{'name':_0x204d1c,'userProfileId':_0x428a6c['userProfileId']},'raw':!![]})['then'](function(_0x59e921){if(_0x59e921&&_0x59e921[_0xcdfc('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x289ca9['name'],'resourceId':_0x289ca9['id'],'type':_0x59e921[_0xcdfc('0x2a')],'sectionId':_0x59e921['id']},{})['then'](function(){return _0x410f87;});}else{return _0x410f87;}})[_0xcdfc('0x44')](function(_0x505f81){logger[_0xcdfc('0x28')](_0xcdfc('0x4e'),_0x505f81);throw _0x505f81;});}return _0x410f87;})[_0xcdfc('0x24')](respondWithResult(_0x536b93,0xc9))[_0xcdfc('0x44')](handleError(_0x536b93,null));};exports[_0xcdfc('0x23')]=function(_0x3df36f,_0x51ae7a){if(_0x3df36f[_0xcdfc('0x46')]['id']){delete _0x3df36f['body']['id'];}return db[_0xcdfc('0x2c')][_0xcdfc('0x4c')]({'where':{'id':_0x3df36f['params']['id']}})[_0xcdfc('0x24')](handleEntityNotFound(_0x51ae7a,null))[_0xcdfc('0x24')](saveUpdates(_0x3df36f[_0xcdfc('0x46')],null))['then'](respondWithResult(_0x51ae7a,null))[_0xcdfc('0x44')](handleError(_0x51ae7a,null));};exports[_0xcdfc('0x25')]=function(_0x2ac221,_0x56c3c7){return db[_0xcdfc('0x2c')][_0xcdfc('0x4c')]({'where':{'id':_0x2ac221['params']['id']}})[_0xcdfc('0x24')](handleEntityNotFound(_0x56c3c7,null))['then'](removeEntity(_0x56c3c7,null))[_0xcdfc('0x44')](handleError(_0x56c3c7,null));}; \ No newline at end of file +var _0x48ea=['mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','get','ChanSpies','UserProfileResource','error','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','create','body','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x540419,_0x275616){var _0x4f6093=function(_0x4ba53e){while(--_0x4ba53e){_0x540419['push'](_0x540419['shift']());}};_0x4f6093(++_0x275616);}(_0x48ea,0x9c));var _0xa48e=function(_0x1170dc,_0xab6992){_0x1170dc=_0x1170dc-0x0;var _0xd3eb9c=_0x48ea[_0x1170dc];return _0xd3eb9c;};'use strict';var emlformat=require(_0xa48e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa48e('0x1'));var jsonpatch=require(_0xa48e('0x2'));var rp=require(_0xa48e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa48e('0x4'));var util=require('util');var path=require(_0xa48e('0x5'));var sox=require(_0xa48e('0x6'));var csv=require(_0xa48e('0x7'));var ejs=require(_0xa48e('0x8'));var fs=require('fs');var fs_extra=require(_0xa48e('0x9'));var _=require(_0xa48e('0xa'));var squel=require(_0xa48e('0xb'));var crypto=require(_0xa48e('0xc'));var jsforce=require(_0xa48e('0xd'));var deskjs=require(_0xa48e('0xe'));var toCsv=require(_0xa48e('0x7'));var querystring=require(_0xa48e('0xf'));var Papa=require(_0xa48e('0x10'));var Redis=require(_0xa48e('0x11'));var authService=require(_0xa48e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa48e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa48e('0x14'));var config=require(_0xa48e('0x15'));var licenseUtil=require(_0xa48e('0x16'));var db=require(_0xa48e('0x17'))['db'];function respondWithStatusCode(_0x59dd5e,_0x10f5d2){_0x10f5d2=_0x10f5d2||0xcc;return function(_0xd23154){if(_0xd23154){return _0x59dd5e[_0xa48e('0x18')](_0x10f5d2);}return _0x59dd5e[_0xa48e('0x19')](_0x10f5d2)[_0xa48e('0x1a')]();};}function respondWithResult(_0x23b810,_0x7251b1){_0x7251b1=_0x7251b1||0xc8;return function(_0x5a6c13){if(_0x5a6c13){return _0x23b810[_0xa48e('0x19')](_0x7251b1)[_0xa48e('0x1b')](_0x5a6c13);}};}function respondWithFilteredResult(_0x2653d1,_0x58b8b){return function(_0x54a0bf){if(_0x54a0bf){var _0x188faf=typeof _0x58b8b[_0xa48e('0x1c')]===_0xa48e('0x1d')&&typeof _0x58b8b[_0xa48e('0x1e')]===_0xa48e('0x1d');var _0xd6e5f0=_0x54a0bf[_0xa48e('0x1f')];var _0x1f1cbc=_0x188faf?0x0:_0x58b8b[_0xa48e('0x1c')];var _0x1baea5=_0x188faf?_0x54a0bf[_0xa48e('0x1f')]:_0x58b8b[_0xa48e('0x1c')]+_0x58b8b[_0xa48e('0x1e')];var _0x2ae264;if(_0x1baea5>=_0xd6e5f0){_0x1baea5=_0xd6e5f0;_0x2ae264=0xc8;}else{_0x2ae264=0xce;}_0x2653d1[_0xa48e('0x19')](_0x2ae264);return _0x2653d1['set']('Content-Range',_0x1f1cbc+'-'+_0x1baea5+'/'+_0xd6e5f0)[_0xa48e('0x1b')](_0x54a0bf);}return null;};}function patchUpdates(_0x5939e0){return function(_0x24d766){try{jsonpatch[_0xa48e('0x20')](_0x24d766,_0x5939e0,!![]);}catch(_0xe03bbe){return BPromise[_0xa48e('0x21')](_0xe03bbe);}return _0x24d766[_0xa48e('0x22')]();};}function saveUpdates(_0x3a3298,_0x240f87){return function(_0x50fee6){if(_0x50fee6){return _0x50fee6[_0xa48e('0x23')](_0x3a3298)['then'](function(_0x53a10a){return _0x53a10a;});}return null;};}function removeEntity(_0x4b3dd7,_0x1adb5d){return function(_0x286e19){if(_0x286e19){return _0x286e19[_0xa48e('0x24')]()[_0xa48e('0x25')](function(){var _0x1a54c0=_0x286e19[_0xa48e('0x26')]({'plain':!![]});var _0x45689b=_0xa48e('0x27');return db[_0xa48e('0x28')][_0xa48e('0x24')]({'where':{'type':_0x45689b,'resourceId':_0x1a54c0['id']}})[_0xa48e('0x25')](function(){return _0x286e19;});})['then'](function(){_0x4b3dd7[_0xa48e('0x19')](0xcc)[_0xa48e('0x1a')]();});}};}function handleEntityNotFound(_0x1474e6,_0x5f3d71){return function(_0x1b04f1){if(!_0x1b04f1){_0x1474e6[_0xa48e('0x18')](0x194);}return _0x1b04f1;};}function handleError(_0x283ddb,_0x96b916){_0x96b916=_0x96b916||0x1f4;return function(_0x537743){logger[_0xa48e('0x29')](_0x537743['stack']);if(_0x537743[_0xa48e('0x2a')]){delete _0x537743[_0xa48e('0x2a')];}_0x283ddb[_0xa48e('0x19')](_0x96b916)[_0xa48e('0x2b')](_0x537743);};}exports[_0xa48e('0x2c')]=function(_0x141c6c,_0x5d62b3){var _0x515962={},_0xbccacd={},_0x1008e7={'count':0x0,'rows':[]};var _0x2d2702=_[_0xa48e('0x2d')](db[_0xa48e('0x2e')][_0xa48e('0x2f')],function(_0x165fc2){return{'name':_0x165fc2[_0xa48e('0x30')],'type':_0x165fc2[_0xa48e('0x31')][_0xa48e('0x32')]};});_0xbccacd[_0xa48e('0x33')]=_[_0xa48e('0x2d')](_0x2d2702,'name');_0xbccacd[_0xa48e('0x34')]=_[_0xa48e('0x35')](_0x141c6c[_0xa48e('0x34')]);_0xbccacd[_0xa48e('0x36')]=_['intersection'](_0xbccacd[_0xa48e('0x33')],_0xbccacd[_0xa48e('0x34')]);_0x515962[_0xa48e('0x37')]=_[_0xa48e('0x38')](_0xbccacd[_0xa48e('0x33')],qs[_0xa48e('0x39')](_0x141c6c['query']['fields']));_0x515962['attributes']=_0x515962[_0xa48e('0x37')][_0xa48e('0x3a')]?_0x515962[_0xa48e('0x37')]:_0xbccacd[_0xa48e('0x33')];if(!_0x141c6c[_0xa48e('0x34')]['hasOwnProperty'](_0xa48e('0x3b'))){_0x515962[_0xa48e('0x1e')]=qs[_0xa48e('0x1e')](_0x141c6c[_0xa48e('0x34')]['limit']);_0x515962[_0xa48e('0x1c')]=qs[_0xa48e('0x1c')](_0x141c6c[_0xa48e('0x34')]['offset']);}_0x515962[_0xa48e('0x3c')]=qs['sort'](_0x141c6c[_0xa48e('0x34')]['sort']);_0x515962[_0xa48e('0x3d')]=qs[_0xa48e('0x36')](_[_0xa48e('0x3e')](_0x141c6c[_0xa48e('0x34')],_0xbccacd['filters']),_0x2d2702);if(_0x141c6c[_0xa48e('0x34')][_0xa48e('0x3f')]){_0x515962[_0xa48e('0x3d')]=_[_0xa48e('0x40')](_0x515962[_0xa48e('0x3d')],{'$or':_[_0xa48e('0x2d')](_0x2d2702,function(_0x5275eb){if(_0x5275eb['type']!==_0xa48e('0x41')){var _0x44cae9={};_0x44cae9[_0x5275eb[_0xa48e('0x2a')]]={'$like':'%'+_0x141c6c['query'][_0xa48e('0x3f')]+'%'};return _0x44cae9;}})});}_0x515962=_['merge']({},_0x515962,_0x141c6c[_0xa48e('0x42')]);var _0x34e296={'where':_0x515962[_0xa48e('0x3d')]};return db[_0xa48e('0x2e')][_0xa48e('0x1f')](_0x34e296)[_0xa48e('0x25')](function(_0x34b516){_0x1008e7[_0xa48e('0x1f')]=_0x34b516;if(_0x141c6c[_0xa48e('0x34')][_0xa48e('0x43')]){_0x515962['include']=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x515962);})[_0xa48e('0x25')](function(_0x3d5513){_0x1008e7[_0xa48e('0x44')]=_0x3d5513;return _0x1008e7;})['then'](respondWithFilteredResult(_0x5d62b3,_0x515962))[_0xa48e('0x45')](handleError(_0x5d62b3,null));};exports[_0xa48e('0x46')]=function(_0x5da361,_0x36558d){var _0x5767be={'raw':![],'where':{'id':_0x5da361[_0xa48e('0x47')]['id']}},_0x4da70d={};_0x4da70d['model']=_[_0xa48e('0x35')](db['VoiceChanSpy'][_0xa48e('0x2f')]);_0x4da70d[_0xa48e('0x34')]=_[_0xa48e('0x35')](_0x5da361[_0xa48e('0x34')]);_0x4da70d[_0xa48e('0x36')]=_['intersection'](_0x4da70d[_0xa48e('0x33')],_0x4da70d[_0xa48e('0x34')]);_0x5767be[_0xa48e('0x37')]=_['intersection'](_0x4da70d[_0xa48e('0x33')],qs[_0xa48e('0x39')](_0x5da361[_0xa48e('0x34')][_0xa48e('0x39')]));_0x5767be[_0xa48e('0x37')]=_0x5767be['attributes'][_0xa48e('0x3a')]?_0x5767be[_0xa48e('0x37')]:_0x4da70d[_0xa48e('0x33')];if(_0x5da361[_0xa48e('0x34')][_0xa48e('0x43')]){_0x5767be['include']=[{'all':!![]}];}_0x5767be=_['merge']({},_0x5767be,_0x5da361[_0xa48e('0x42')]);return db[_0xa48e('0x2e')]['find'](_0x5767be)[_0xa48e('0x25')](handleEntityNotFound(_0x36558d,null))[_0xa48e('0x25')](respondWithResult(_0x36558d,null))[_0xa48e('0x45')](handleError(_0x36558d,null));};exports[_0xa48e('0x48')]=function(_0x4f7c03,_0x35b20a){return db[_0xa48e('0x2e')]['create'](_0x4f7c03[_0xa48e('0x49')],{})[_0xa48e('0x25')](function(_0x36afb3){var _0x5a8776=_0x4f7c03[_0xa48e('0x4a')]['get']({'plain':!![]});if(!_0x5a8776)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a8776[_0xa48e('0x4b')]===_0xa48e('0x4a')){var _0x2d8332=_0x36afb3['get']({'plain':!![]});var _0x2e6efe=_0xa48e('0x27');return db[_0xa48e('0x4c')][_0xa48e('0x4d')]({'where':{'name':_0x2e6efe,'userProfileId':_0x5a8776['userProfileId']},'raw':!![]})['then'](function(_0x27ccae){if(_0x27ccae&&_0x27ccae[_0xa48e('0x4e')]===0x0){return db[_0xa48e('0x28')][_0xa48e('0x48')]({'name':_0x2d8332['name'],'resourceId':_0x2d8332['id'],'type':_0x27ccae[_0xa48e('0x2a')],'sectionId':_0x27ccae['id']},{})[_0xa48e('0x25')](function(){return _0x36afb3;});}else{return _0x36afb3;}})[_0xa48e('0x45')](function(_0x164f55){logger[_0xa48e('0x29')](_0xa48e('0x4f'),_0x164f55);throw _0x164f55;});}return _0x36afb3;})[_0xa48e('0x25')](respondWithResult(_0x35b20a,0xc9))[_0xa48e('0x45')](handleError(_0x35b20a,null));};exports[_0xa48e('0x23')]=function(_0x1a1aa7,_0x3865a7){if(_0x1a1aa7[_0xa48e('0x49')]['id']){delete _0x1a1aa7[_0xa48e('0x49')]['id'];}return db[_0xa48e('0x2e')][_0xa48e('0x4d')]({'where':{'id':_0x1a1aa7[_0xa48e('0x47')]['id']}})[_0xa48e('0x25')](handleEntityNotFound(_0x3865a7,null))[_0xa48e('0x25')](saveUpdates(_0x1a1aa7[_0xa48e('0x49')],null))['then'](respondWithResult(_0x3865a7,null))[_0xa48e('0x45')](handleError(_0x3865a7,null));};exports[_0xa48e('0x24')]=function(_0x2085d8,_0x59d0ed){return db['VoiceChanSpy'][_0xa48e('0x4d')]({'where':{'id':_0x2085d8['params']['id']}})[_0xa48e('0x25')](handleEntityNotFound(_0x59d0ed,null))[_0xa48e('0x25')](removeEntity(_0x59d0ed,null))[_0xa48e('0x45')](handleError(_0x59d0ed,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index edbb658..29c41a9 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 _0x1a8d=['options','StopMixMonitor','length','internal','User','findAll','agent','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','catch','destroy','bluebird','./voiceChanSpy.attributes','context','format','%s%s','system','push','CDR(type)=%s','chanspy','record','MixMonitor','auth','merge','password','ChanSpy','SIP/%s,%s','name'];(function(_0x4365e4,_0xb6354e){var _0x3a8202=function(_0x15d541){while(--_0x15d541){_0x4365e4['push'](_0x4365e4['shift']());}};_0x3a8202(++_0xb6354e);}(_0x1a8d,0x1ed));var _0xd1a8=function(_0x487e36,_0x2b2813){_0x487e36=_0x487e36-0x0;var _0x40a228=_0x1a8d[_0x487e36];return _0x40a228;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xd1a8('0x0'));var attributes=require(_0xd1a8('0x1'));var getUserApplications=function(_0x5c8f67,_0x2438a2,_0x2b0f55){var _0x5d2d4b=0x1;var _0x23fa16=[];var _0xbdcba8={'context':_0x2438a2[_0xd1a8('0x2')]||'from-sip','exten':util[_0xd1a8('0x3')](_0xd1a8('0x4'),_0x5c8f67['prefix'],_0x2b0f55),'type':_0xd1a8('0x5'),'isApp':![],'ChanSpyId':_0x5c8f67['id'],'UserId':_0x2438a2['id']};_0x23fa16[_0xd1a8('0x6')](_['merge']({'app':'Set','appdata':util['format'](_0xd1a8('0x7'),_0xd1a8('0x8')),'priority':_0x5d2d4b++},_0xbdcba8));if(_0x5c8f67[_0xd1a8('0x9')]){_0x23fa16[_0xd1a8('0x6')](_['merge']({'app':_0xd1a8('0xa'),'appdata':util[_0xd1a8('0x3')]('${UNIQUEID}.%s,a',_0x5c8f67['recordingFormat']),'priority':_0x5d2d4b++},_0xbdcba8));}if(_0x5c8f67[_0xd1a8('0xb')]){_0x23fa16[_0xd1a8('0x6')](_[_0xd1a8('0xc')]({'app':'Authenticate','appdata':_0x5c8f67[_0xd1a8('0xd')],'priority':_0x5d2d4b++},_0xbdcba8));}_0x23fa16['push'](_[_0xd1a8('0xc')]({'app':_0xd1a8('0xe'),'appdata':util[_0xd1a8('0x3')](_0xd1a8('0xf'),_0x2438a2[_0xd1a8('0x10')],_0x5c8f67[_0xd1a8('0x11')]?_0x5c8f67[_0xd1a8('0x11')]['join'](''):''),'priority':_0x5d2d4b++},_0xbdcba8));if(_0x5c8f67[_0xd1a8('0x9')]){_0x23fa16[_0xd1a8('0x6')](_[_0xd1a8('0xc')]({'app':_0xd1a8('0x12'),'priority':_0x5d2d4b++},_0xbdcba8));}return _0x23fa16;};var getChanSpyApplications=function(_0x4bcd68,_0x504bf5){var _0x279a49=[];for(var _0x279890=0x0,_0x12f2f2=0x1;_0x279890<_0x504bf5[_0xd1a8('0x13')];_0x279890++,_0x12f2f2=0x1){_0x279a49=_0x279a49['concat'](getUserApplications(_0x4bcd68,_0x504bf5[_0x279890],_0x504bf5[_0x279890][_0xd1a8('0x14')]));if(_0x504bf5[_0x279890]['internal']!=_0x504bf5[_0x279890][_0xd1a8('0x10')]){_0x279a49=_0x279a49['concat'](getUserApplications(_0x4bcd68,_0x504bf5[_0x279890],_0x504bf5[_0x279890][_0xd1a8('0x10')]));}}return _0x279a49;};var getChanSpyPromise=function(_0x4ab794,_0x3fda72){return new BPromise(function(_0x3ebca7,_0x41012b){return _0x4ab794[_0xd1a8('0x15')][_0xd1a8('0x16')]({'attributes':['id',_0xd1a8('0x10'),_0xd1a8('0x14')],'where':{'role':_0xd1a8('0x17'),'chanspy':!![]},'raw':!![]})['then'](function(_0x5aa994){if(_0x5aa994){return _0x3ebca7(getChanSpyApplications(_0x3fda72,_0x5aa994));}return _0x3ebca7([]);})['catch'](function(_0x242284){_0x41012b(_0x242284);});});};module[_0xd1a8('0x18')]=function(_0x29fbff,_0x24f012){var _0x57631d=_0x29fbff[_0xd1a8('0x19')];return _0x29fbff[_0xd1a8('0x1a')](_0xd1a8('0x1b'),attributes,{'tableName':_0xd1a8('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x37ffad,_0x103f94,_0x1ac320){return getChanSpyPromise(_0x57631d,_0x37ffad)[_0xd1a8('0x1d')](function(_0x3c5080){if(_0x3c5080&&_0x3c5080[_0xd1a8('0x13')]){return _0x57631d[_0xd1a8('0x1e')][_0xd1a8('0x1f')](_0x3c5080);}})[_0xd1a8('0x1d')](function(){_0x1ac320();})[_0xd1a8('0x20')](function(_0x32f490){_0x1ac320(_0x32f490);});},'afterUpdate':function(_0x18220e,_0x25fbb2,_0x4b126a){return _0x57631d[_0xd1a8('0x1e')]['destroy']({'where':{'ChanSpyId':_0x18220e['id']}})[_0xd1a8('0x1d')](function(){return getChanSpyPromise(_0x57631d,_0x18220e);})['then'](function(_0x1566b5){if(_0x1566b5&&_0x1566b5['length']){return _0x57631d['VoiceExtension'][_0xd1a8('0x1f')](_0x1566b5);}})[_0xd1a8('0x1d')](function(){_0x4b126a();})[_0xd1a8('0x20')](function(_0x5924a4){_0x4b126a(_0x5924a4);});},'afterDestroy':function(_0x203643,_0x1c409c,_0x30609b){return _0x57631d[_0xd1a8('0x1e')][_0xd1a8('0x21')]({'where':{'ChanSpyId':_0x203643['id']}})[_0xd1a8('0x1d')](function(){_0x30609b();})[_0xd1a8('0x20')](function(_0x551456){_0x30609b(_0x551456);});}}});}; \ No newline at end of file +var _0x07b6=['models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','destroy','bulkCreate','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','system','push','merge','CDR(type)=%s','chanspy','MixMonitor','recordingFormat','auth','Authenticate','password','SIP/%s,%s','name','options','join','record','length','concat','internal','User','findAll','agent','catch','exports'];(function(_0x483889,_0x4c80ad){var _0x477f7a=function(_0x574867){while(--_0x574867){_0x483889['push'](_0x483889['shift']());}};_0x477f7a(++_0x4c80ad);}(_0x07b6,0x19f));var _0x607b=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0x07b6[_0x445101];return _0x3c3d04;};'use strict';var _=require(_0x607b('0x0'));var util=require(_0x607b('0x1'));var BPromise=require('bluebird');var attributes=require(_0x607b('0x2'));var getUserApplications=function(_0x23384c,_0x3fd0f5,_0x4c6aa5){var _0x25082e=0x1;var _0x1c6f35=[];var _0x9e80cd={'context':_0x3fd0f5[_0x607b('0x3')]||_0x607b('0x4'),'exten':util[_0x607b('0x5')]('%s%s',_0x23384c['prefix'],_0x4c6aa5),'type':_0x607b('0x6'),'isApp':![],'ChanSpyId':_0x23384c['id'],'UserId':_0x3fd0f5['id']};_0x1c6f35[_0x607b('0x7')](_[_0x607b('0x8')]({'app':'Set','appdata':util[_0x607b('0x5')](_0x607b('0x9'),_0x607b('0xa')),'priority':_0x25082e++},_0x9e80cd));if(_0x23384c['record']){_0x1c6f35['push'](_[_0x607b('0x8')]({'app':_0x607b('0xb'),'appdata':util[_0x607b('0x5')]('${UNIQUEID}.%s,a',_0x23384c[_0x607b('0xc')]),'priority':_0x25082e++},_0x9e80cd));}if(_0x23384c[_0x607b('0xd')]){_0x1c6f35['push'](_[_0x607b('0x8')]({'app':_0x607b('0xe'),'appdata':_0x23384c[_0x607b('0xf')],'priority':_0x25082e++},_0x9e80cd));}_0x1c6f35[_0x607b('0x7')](_['merge']({'app':'ChanSpy','appdata':util[_0x607b('0x5')](_0x607b('0x10'),_0x3fd0f5[_0x607b('0x11')],_0x23384c[_0x607b('0x12')]?_0x23384c[_0x607b('0x12')][_0x607b('0x13')](''):''),'priority':_0x25082e++},_0x9e80cd));if(_0x23384c[_0x607b('0x14')]){_0x1c6f35[_0x607b('0x7')](_[_0x607b('0x8')]({'app':'StopMixMonitor','priority':_0x25082e++},_0x9e80cd));}return _0x1c6f35;};var getChanSpyApplications=function(_0x543a1d,_0x3f009c){var _0x20453f=[];for(var _0x3015bb=0x0,_0x1e2124=0x1;_0x3015bb<_0x3f009c[_0x607b('0x15')];_0x3015bb++,_0x1e2124=0x1){_0x20453f=_0x20453f[_0x607b('0x16')](getUserApplications(_0x543a1d,_0x3f009c[_0x3015bb],_0x3f009c[_0x3015bb][_0x607b('0x17')]));if(_0x3f009c[_0x3015bb]['internal']!=_0x3f009c[_0x3015bb][_0x607b('0x11')]){_0x20453f=_0x20453f['concat'](getUserApplications(_0x543a1d,_0x3f009c[_0x3015bb],_0x3f009c[_0x3015bb][_0x607b('0x11')]));}}return _0x20453f;};var getChanSpyPromise=function(_0x10e089,_0xf3592f){return new BPromise(function(_0x587bc4,_0x2b4ba1){return _0x10e089[_0x607b('0x18')][_0x607b('0x19')]({'attributes':['id',_0x607b('0x11'),_0x607b('0x17')],'where':{'role':_0x607b('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x25c248){if(_0x25c248){return _0x587bc4(getChanSpyApplications(_0xf3592f,_0x25c248));}return _0x587bc4([]);})[_0x607b('0x1b')](function(_0x54759d){_0x2b4ba1(_0x54759d);});});};module[_0x607b('0x1c')]=function(_0x323977,_0x5c8ba0){var _0x433ca3=_0x323977[_0x607b('0x1d')];return _0x323977[_0x607b('0x1e')](_0x607b('0x1f'),attributes,{'tableName':_0x607b('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x467c0e,_0x1e11c1,_0x536934){return getChanSpyPromise(_0x433ca3,_0x467c0e)[_0x607b('0x21')](function(_0x1d9b5b){if(_0x1d9b5b&&_0x1d9b5b['length']){return _0x433ca3[_0x607b('0x22')]['bulkCreate'](_0x1d9b5b);}})['then'](function(){_0x536934();})[_0x607b('0x1b')](function(_0x3ec9ef){_0x536934(_0x3ec9ef);});},'afterUpdate':function(_0x296bbb,_0x4db07e,_0x448538){return _0x433ca3[_0x607b('0x22')][_0x607b('0x23')]({'where':{'ChanSpyId':_0x296bbb['id']}})[_0x607b('0x21')](function(){return getChanSpyPromise(_0x433ca3,_0x296bbb);})[_0x607b('0x21')](function(_0x326d29){if(_0x326d29&&_0x326d29[_0x607b('0x15')]){return _0x433ca3[_0x607b('0x22')][_0x607b('0x24')](_0x326d29);}})['then'](function(){_0x448538();})[_0x607b('0x1b')](function(_0x1c0fca){_0x448538(_0x1c0fca);});},'afterDestroy':function(_0x1d5859,_0x5db1d2,_0x361862){return _0x433ca3[_0x607b('0x22')]['destroy']({'where':{'ChanSpyId':_0x1d5859['id']}})['then'](function(){_0x361862();})[_0x607b('0x1b')](function(_0x2b4218){_0x361862(_0x2b4218);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index d74d0a5..36e66e4 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 _0x668b=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x1eb6e9,_0x25815c){var _0x35fd78=function(_0x31d713){while(--_0x31d713){_0x1eb6e9['push'](_0x1eb6e9['shift']());}};_0x35fd78(++_0x25815c);}(_0x668b,0x140));var _0xb668=function(_0x4c7b20,_0x361515){_0x4c7b20=_0x4c7b20-0x0;var _0x4872bd=_0x668b[_0x4c7b20];return _0x4872bd;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var moment=require('moment');var BPromise=require(_0xb668('0x2'));var rs=require(_0xb668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb668('0x5'))(_0xb668('0x6'));var config=require(_0xb668('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb668('0x8')][_0xb668('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3be92e,_0x2778e9,_0x20b749){return new BPromise(function(_0x3f01bc,_0x517fc5){return client[_0xb668('0xa')](_0x3be92e,_0x20b749)[_0xb668('0xb')](function(_0x128cf5){logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));logger[_0xb668('0xf')](_0xb668('0x10'),_0x2778e9,'request\x20sent',JSON[_0xb668('0x11')](_0x128cf5));if(_0x128cf5[_0xb668('0x12')]){if(_0x128cf5[_0xb668('0x12')][_0xb668('0x13')]===0x1f4){logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x517fc5(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x3f01bc(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}else{logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));_0x3f01bc(_0x128cf5[_0xb668('0x15')][_0xb668('0x14')]);}})[_0xb668('0x16')](function(_0x4ab137){logger[_0xb668('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x2778e9,_0x4ab137);_0x517fc5(_0x4ab137);});});} \ No newline at end of file +var _0x9348=['error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x9348,0x10d));var _0x8934=function(_0x394f68,_0x198543){_0x394f68=_0x394f68-0x0;var _0x487357=_0x9348[_0x394f68];return _0x487357;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var moment=require(_0x8934('0x2'));var BPromise=require(_0x8934('0x3'));var rs=require(_0x8934('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8934('0x5'))['db'];var utils=require(_0x8934('0x6'));var logger=require('../../config/logger')(_0x8934('0x7'));var config=require(_0x8934('0x8'));var jayson=require(_0x8934('0x9'));var client=jayson[_0x8934('0xa')][_0x8934('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ee9b9,_0x512f30,_0x284a62){return new BPromise(function(_0x3734c5,_0x1c7f03){return client['request'](_0x3ee9b9,_0x284a62)['then'](function(_0x5ec16d){logger['info'](_0x8934('0xc'),_0x512f30,'request\x20sent');logger[_0x8934('0xd')](_0x8934('0xe'),_0x512f30,_0x8934('0xf'),JSON[_0x8934('0x10')](_0x5ec16d));if(_0x5ec16d[_0x8934('0x11')]){if(_0x5ec16d[_0x8934('0x11')][_0x8934('0x12')]===0x1f4){logger[_0x8934('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x512f30,_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);return _0x1c7f03(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0x5ec16d['error'][_0x8934('0x13')]);return _0x3734c5(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}else{logger[_0x8934('0x14')](_0x8934('0xc'),_0x512f30,_0x8934('0xf'));_0x3734c5(_0x5ec16d[_0x8934('0x15')][_0x8934('0x13')]);}})['catch'](function(_0xb86bc9){logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0xb86bc9);_0x1c7f03(_0xb86bc9);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index efafb3b..d3b3c04 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 _0xab09=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','/:id','isAuthenticated','show','post','delete'];(function(_0x483711,_0x16b601){var _0x891ae8=function(_0x4983cc){while(--_0x4983cc){_0x483711['push'](_0x483711['shift']());}};_0x891ae8(++_0x16b601);}(_0xab09,0x1ee));var _0x9ab0=function(_0x4d2157,_0x201cf1){_0x4d2157=_0x4d2157-0x0;var _0x172f80=_0xab09[_0x4d2157];return _0x172f80;};'use strict';var multer=require('multer');var util=require(_0x9ab0('0x0'));var path=require(_0x9ab0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9ab0('0x2')]();var fs_extra=require(_0x9ab0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9ab0('0x4'));var config=require(_0x9ab0('0x5'));var controller=require(_0x9ab0('0x6'));router[_0x9ab0('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9ab0('0x8'),auth[_0x9ab0('0x9')](),controller[_0x9ab0('0xa')]);router[_0x9ab0('0xb')]('/',auth[_0x9ab0('0x9')](),controller['create']);router['put'](_0x9ab0('0x8'),auth[_0x9ab0('0x9')](),controller['update']);router[_0x9ab0('0xc')](_0x9ab0('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbc79=['put','update','delete','destroy','exports','multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x1a8e22,_0x123487){var _0x25b68b=function(_0x509f6e){while(--_0x509f6e){_0x1a8e22['push'](_0x1a8e22['shift']());}};_0x25b68b(++_0x123487);}(_0xbc79,0xef));var _0x9bc7=function(_0x4e26c0,_0x347a6c){_0x4e26c0=_0x4e26c0-0x0;var _0x2b1ea7=_0xbc79[_0x4e26c0];return _0x2b1ea7;};'use strict';var multer=require(_0x9bc7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9bc7('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9bc7('0x2'));var interaction=require(_0x9bc7('0x3'));var config=require(_0x9bc7('0x4'));var controller=require(_0x9bc7('0x5'));router[_0x9bc7('0x6')]('/',auth[_0x9bc7('0x7')](),controller[_0x9bc7('0x8')]);router[_0x9bc7('0x6')](_0x9bc7('0x9'),auth[_0x9bc7('0x7')](),controller[_0x9bc7('0xa')]);router[_0x9bc7('0xb')]('/',auth[_0x9bc7('0x7')](),controller[_0x9bc7('0xc')]);router[_0x9bc7('0xd')]('/:id',auth[_0x9bc7('0x7')](),controller[_0x9bc7('0xe')]);router[_0x9bc7('0xf')](_0x9bc7('0x9'),auth['isAuthenticated'](),controller[_0x9bc7('0x10')]);module[_0x9bc7('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 07cb46f..6044948 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 _0x8bd6=['name','exports'];(function(_0x58f45e,_0x5ec2f6){var _0x155acd=function(_0x5aa35c){while(--_0x5aa35c){_0x58f45e['push'](_0x58f45e['shift']());}};_0x155acd(++_0x5ec2f6);}(_0x8bd6,0x1b1));var _0x68bd=function(_0x22d5c2,_0x5a3bce){_0x22d5c2=_0x22d5c2-0x0;var _0x2f346d=_0x8bd6[_0x22d5c2];return _0x2f346d;};'use strict';var Sequelize=require('sequelize');module[_0x68bd('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x68bd('0x1')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xffaf=['exports','STRING','BOOLEAN','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xffaf,0x1c3));var _0xfffa=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xffaf[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require(_0xfffa('0x0'));module[_0xfffa('0x1')]={'name':{'type':Sequelize[_0xfffa('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xfffa('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xfffa('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index a4b7bf0..8fc1f36 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 _0x5d88=['limit','set','Content-Range','json','apply','reject','update','destroy','get','Contexts','stack','name','status','send','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/context.ejs','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','offset','undefined','count'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d88,0x111));var _0x85d8=function(_0x17dddd,_0x259fc2){_0x17dddd=_0x17dddd-0x0;var _0x293a22=_0x5d88[_0x17dddd];return _0x293a22;};'use strict';var emlformat=require(_0x85d8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x85d8('0x1'));var jsonpatch=require(_0x85d8('0x2'));var rp=require(_0x85d8('0x3'));var moment=require(_0x85d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x85d8('0x5'));var util=require(_0x85d8('0x6'));var path=require('path');var sox=require(_0x85d8('0x7'));var csv=require(_0x85d8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x85d8('0x9'));var _=require(_0x85d8('0xa'));var squel=require(_0x85d8('0xb'));var crypto=require(_0x85d8('0xc'));var jsforce=require(_0x85d8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x85d8('0x8'));var querystring=require(_0x85d8('0xe'));var Papa=require(_0x85d8('0xf'));var Redis=require(_0x85d8('0x10'));var authService=require(_0x85d8('0x11'));var qs=require(_0x85d8('0x12'));var as=require(_0x85d8('0x13'));var hardwareService=require(_0x85d8('0x14'));var logger=require(_0x85d8('0x15'))('api');var utils=require(_0x85d8('0x16'));var config=require(_0x85d8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85d8('0x18'))['db'];var jayson=require(_0x85d8('0x19'));var client=jayson[_0x85d8('0x1a')][_0x85d8('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x22dfd0,_0x3bb712,_0x19e55c,_0x5228ce){return new BPromise(function(_0xfeef10,_0x36e200){var _0x21042b=_0x5228ce||client;return _0x21042b[_0x85d8('0x1c')](_0x22dfd0,_0x19e55c)[_0x85d8('0x1d')](function(_0x2ae5c2){logger[_0x85d8('0x1e')](_0x85d8('0x1f'),_0x3bb712,'request\x20sent');logger[_0x85d8('0x20')](_0x85d8('0x21'),_0x3bb712,_0x85d8('0x22'),JSON[_0x85d8('0x23')](_0x2ae5c2));if(_0x2ae5c2[_0x85d8('0x24')]){if(_0x2ae5c2['error']['code']===0x1f4){logger[_0x85d8('0x24')](_0x85d8('0x1f'),_0x3bb712,_0x2ae5c2[_0x85d8('0x24')]['message']);return _0x36e200(_0x2ae5c2[_0x85d8('0x24')][_0x85d8('0x25')]);}logger['error'](_0x85d8('0x1f'),_0x3bb712,_0x2ae5c2[_0x85d8('0x24')]['message']);return _0xfeef10(_0x2ae5c2['error'][_0x85d8('0x25')]);}else{logger[_0x85d8('0x1e')](_0x85d8('0x1f'),_0x3bb712,_0x85d8('0x22'));_0xfeef10(_0x2ae5c2[_0x85d8('0x26')]['message']);}})[_0x85d8('0x27')](function(_0x571d3d){logger[_0x85d8('0x24')]('VoiceContext,\x20%s,\x20%s',_0x3bb712,_0x571d3d);_0x36e200(_0x571d3d);});});}function respondWithStatusCode(_0x581824,_0x291545){_0x291545=_0x291545||0xcc;return function(_0x359258){if(_0x359258){return _0x581824[_0x85d8('0x28')](_0x291545);}return _0x581824['status'](_0x291545)[_0x85d8('0x29')]();};}function respondWithResult(_0x19ad9d,_0x57d215){_0x57d215=_0x57d215||0xc8;return function(_0x399219){if(_0x399219){return _0x19ad9d['status'](_0x57d215)['json'](_0x399219);}};}function respondWithFilteredResult(_0x15e8ea,_0x14b021){return function(_0x156d30){if(_0x156d30){var _0x3c598a=typeof _0x14b021[_0x85d8('0x2a')]===_0x85d8('0x2b')&&typeof _0x14b021['limit']===_0x85d8('0x2b');var _0x25cde4=_0x156d30[_0x85d8('0x2c')];var _0x3f3838=_0x3c598a?0x0:_0x14b021['offset'];var _0x414240=_0x3c598a?_0x156d30[_0x85d8('0x2c')]:_0x14b021[_0x85d8('0x2a')]+_0x14b021[_0x85d8('0x2d')];var _0xdae8e4;if(_0x414240>=_0x25cde4){_0x414240=_0x25cde4;_0xdae8e4=0xc8;}else{_0xdae8e4=0xce;}_0x15e8ea['status'](_0xdae8e4);return _0x15e8ea[_0x85d8('0x2e')](_0x85d8('0x2f'),_0x3f3838+'-'+_0x414240+'/'+_0x25cde4)[_0x85d8('0x30')](_0x156d30);}return null;};}function patchUpdates(_0x4da02b){return function(_0x397c54){try{jsonpatch[_0x85d8('0x31')](_0x397c54,_0x4da02b,!![]);}catch(_0x46d9c8){return BPromise[_0x85d8('0x32')](_0x46d9c8);}return _0x397c54['save']();};}function saveUpdates(_0x7c4b7b,_0x2577bd){return function(_0x3dfcf9){if(_0x3dfcf9){return _0x3dfcf9[_0x85d8('0x33')](_0x7c4b7b)[_0x85d8('0x1d')](function(_0x1516bf){return _0x1516bf;});}return null;};}function removeEntity(_0x3ec415,_0x3b66e6){return function(_0x482bfa){if(_0x482bfa){return _0x482bfa[_0x85d8('0x34')]()[_0x85d8('0x1d')](function(){var _0x411332=_0x482bfa[_0x85d8('0x35')]({'plain':!![]});var _0x431c10=_0x85d8('0x36');return db['UserProfileResource'][_0x85d8('0x34')]({'where':{'type':_0x431c10,'resourceId':_0x411332['id']}})['then'](function(){return _0x482bfa;});})['then'](function(){_0x3ec415['status'](0xcc)[_0x85d8('0x29')]();});}};}function handleEntityNotFound(_0x44baca,_0x1e5709){return function(_0x1f5c5f){if(!_0x1f5c5f){_0x44baca[_0x85d8('0x28')](0x194);}return _0x1f5c5f;};}function handleError(_0x384637,_0x12e105){_0x12e105=_0x12e105||0x1f4;return function(_0x381898){logger[_0x85d8('0x24')](_0x381898[_0x85d8('0x37')]);if(_0x381898[_0x85d8('0x38')]){delete _0x381898['name'];}_0x384637[_0x85d8('0x39')](_0x12e105)[_0x85d8('0x3a')](_0x381898);};}exports['index']=function(_0x5a5f1b,_0x4b767c){var _0x413f18={},_0x3abb5c={},_0x5198b9={'count':0x0,'rows':[]};var _0x81c395=_[_0x85d8('0x3b')](db[_0x85d8('0x3c')][_0x85d8('0x3d')],function(_0x1529f2){return{'name':_0x1529f2[_0x85d8('0x3e')],'type':_0x1529f2[_0x85d8('0x3f')][_0x85d8('0x40')]};});_0x3abb5c[_0x85d8('0x41')]=_['map'](_0x81c395,'name');_0x3abb5c[_0x85d8('0x42')]=_[_0x85d8('0x43')](_0x5a5f1b[_0x85d8('0x42')]);_0x3abb5c['filters']=_[_0x85d8('0x44')](_0x3abb5c[_0x85d8('0x41')],_0x3abb5c['query']);_0x413f18[_0x85d8('0x45')]=_[_0x85d8('0x44')](_0x3abb5c[_0x85d8('0x41')],qs[_0x85d8('0x46')](_0x5a5f1b['query'][_0x85d8('0x46')]));_0x413f18['attributes']=_0x413f18[_0x85d8('0x45')][_0x85d8('0x47')]?_0x413f18[_0x85d8('0x45')]:_0x3abb5c[_0x85d8('0x41')];if(!_0x5a5f1b[_0x85d8('0x42')][_0x85d8('0x48')](_0x85d8('0x49'))){_0x413f18[_0x85d8('0x2d')]=qs[_0x85d8('0x2d')](_0x5a5f1b[_0x85d8('0x42')][_0x85d8('0x2d')]);_0x413f18['offset']=qs[_0x85d8('0x2a')](_0x5a5f1b[_0x85d8('0x42')][_0x85d8('0x2a')]);}_0x413f18['order']=qs[_0x85d8('0x4a')](_0x5a5f1b[_0x85d8('0x42')][_0x85d8('0x4a')]);_0x413f18[_0x85d8('0x4b')]=qs[_0x85d8('0x4c')](_['pick'](_0x5a5f1b[_0x85d8('0x42')],_0x3abb5c['filters']),_0x81c395);if(_0x5a5f1b[_0x85d8('0x42')]['filter']){_0x413f18[_0x85d8('0x4b')]=_[_0x85d8('0x4d')](_0x413f18['where'],{'$or':_[_0x85d8('0x3b')](_0x81c395,function(_0x4fdbe5){if(_0x4fdbe5[_0x85d8('0x3f')]!==_0x85d8('0x4e')){var _0x497b60={};_0x497b60[_0x4fdbe5[_0x85d8('0x38')]]={'$like':'%'+_0x5a5f1b[_0x85d8('0x42')][_0x85d8('0x4f')]+'%'};return _0x497b60;}})});}_0x413f18=_[_0x85d8('0x4d')]({},_0x413f18,_0x5a5f1b[_0x85d8('0x50')]);var _0x253df8={'where':_0x413f18[_0x85d8('0x4b')]};return db[_0x85d8('0x3c')][_0x85d8('0x2c')](_0x253df8)[_0x85d8('0x1d')](function(_0x257a96){_0x5198b9['count']=_0x257a96;if(_0x5a5f1b['query'][_0x85d8('0x51')]){_0x413f18[_0x85d8('0x52')]=[{'all':!![]}];}return db['VoiceContext'][_0x85d8('0x53')](_0x413f18);})[_0x85d8('0x1d')](function(_0x3b9714){_0x5198b9[_0x85d8('0x54')]=_0x3b9714;return _0x5198b9;})[_0x85d8('0x1d')](respondWithFilteredResult(_0x4b767c,_0x413f18))[_0x85d8('0x27')](handleError(_0x4b767c,null));};exports[_0x85d8('0x55')]=function(_0x141eb7,_0x1b6f9d){var _0x27badb={'raw':![],'where':{'id':_0x141eb7[_0x85d8('0x56')]['id']}},_0x3c7c8d={};_0x3c7c8d['model']=_[_0x85d8('0x43')](db['VoiceContext'][_0x85d8('0x3d')]);_0x3c7c8d[_0x85d8('0x42')]=_[_0x85d8('0x43')](_0x141eb7[_0x85d8('0x42')]);_0x3c7c8d[_0x85d8('0x4c')]=_['intersection'](_0x3c7c8d['model'],_0x3c7c8d['query']);_0x27badb[_0x85d8('0x45')]=_[_0x85d8('0x44')](_0x3c7c8d[_0x85d8('0x41')],qs['fields'](_0x141eb7[_0x85d8('0x42')][_0x85d8('0x46')]));_0x27badb[_0x85d8('0x45')]=_0x27badb[_0x85d8('0x45')]['length']?_0x27badb[_0x85d8('0x45')]:_0x3c7c8d[_0x85d8('0x41')];if(_0x141eb7[_0x85d8('0x42')][_0x85d8('0x51')]){_0x27badb[_0x85d8('0x52')]=[{'all':!![]}];}_0x27badb=_['merge']({},_0x27badb,_0x141eb7[_0x85d8('0x50')]);return db['VoiceContext'][_0x85d8('0x57')](_0x27badb)[_0x85d8('0x1d')](handleEntityNotFound(_0x1b6f9d,null))['then'](respondWithResult(_0x1b6f9d,null))[_0x85d8('0x27')](handleError(_0x1b6f9d,null));};exports[_0x85d8('0x58')]=function(_0x58dd1b,_0x4dc273,_0x268e2b){var _0x8a369e;return db[_0x85d8('0x3c')]['create'](_0x58dd1b[_0x85d8('0x59')],{'raw':!![]})[_0x85d8('0x1d')](function(_0x5e0183){_0x8a369e=_0x5e0183;return db[_0x85d8('0x3c')]['findAll']({'raw':!![]});})[_0x85d8('0x1d')](function(_0xfac438){var _0x1c8d8e=fs[_0x85d8('0x5a')](path[_0x85d8('0x5b')](config[_0x85d8('0x5c')],'server/files/templates/context.ejs'),_0x85d8('0x5d'));var _0x5af362=ejs[_0x85d8('0x5e')](_0x1c8d8e,{'contexts':_0xfac438||[]});fs[_0x85d8('0x5f')](_0x85d8('0x60'),_0x5af362);})[_0x85d8('0x1d')](function(){return respondWithRpcPromise(_0x85d8('0x61'),_0x85d8('0x58'),{'module':_0x85d8('0x62')});})['then'](function(){var _0x1361c5=_0x58dd1b['user'][_0x85d8('0x35')]({'plain':!![]});if(!_0x1361c5)throw new Error(_0x85d8('0x63'));if(_0x1361c5['role']==='user'){var _0x3487ad=_0x8a369e[_0x85d8('0x35')]({'plain':!![]});return db[_0x85d8('0x64')][_0x85d8('0x57')]({'where':{'name':_0x85d8('0x36'),'userProfileId':_0x1361c5[_0x85d8('0x65')]},'raw':!![]})[_0x85d8('0x1d')](function(_0x57e0b2){if(_0x57e0b2&&_0x57e0b2[_0x85d8('0x66')]===0x0){return db[_0x85d8('0x67')][_0x85d8('0x58')]({'name':_0x3487ad['name'],'resourceId':_0x3487ad['id'],'type':_0x57e0b2[_0x85d8('0x38')],'sectionId':_0x57e0b2['id']},{})[_0x85d8('0x1d')](function(){return _0x8a369e;});}else{return _0x8a369e;}})[_0x85d8('0x27')](function(_0x47a033){logger[_0x85d8('0x24')](_0x85d8('0x68'),_0x47a033);throw _0x47a033;});}return _0x8a369e;})['then'](respondWithResult(_0x4dc273,0xc9))['catch'](handleError(_0x4dc273,null));};exports[_0x85d8('0x33')]=function(_0x48b1fb,_0x464a85,_0x2f52ee){var _0x3827f4;return db[_0x85d8('0x3c')][_0x85d8('0x57')]({'where':{'id':_0x48b1fb[_0x85d8('0x56')]['id']}})[_0x85d8('0x1d')](handleEntityNotFound(_0x464a85,null))[_0x85d8('0x1d')](saveUpdates(_0x48b1fb['body'],null))['then'](function(_0xd32af3){if(_0xd32af3){_0x3827f4=_0xd32af3;return db['VoiceContext'][_0x85d8('0x53')]({'raw':!![]});}})['then'](function(_0xab8177){var _0xd94183=fs['readFileSync'](path[_0x85d8('0x5b')](config[_0x85d8('0x5c')],_0x85d8('0x69')),'utf8');var _0x38ca75=ejs['render'](_0xd94183,{'contexts':_0xab8177||[]});fs[_0x85d8('0x5f')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x38ca75);})[_0x85d8('0x1d')](function(){return respondWithRpcPromise(_0x85d8('0x61'),_0x85d8('0x33'),{'module':_0x85d8('0x62')});})[_0x85d8('0x1d')](function(){return _0x3827f4;})[_0x85d8('0x1d')](respondWithResult(_0x464a85,null))[_0x85d8('0x27')](handleError(_0x464a85,null));};exports['destroy']=function(_0x3d43ce,_0x3691e3,_0x3251b1){var _0x6e02d2;return db[_0x85d8('0x3c')][_0x85d8('0x57')]({'where':{'id':_0x3d43ce[_0x85d8('0x56')]['id']}})[_0x85d8('0x1d')](handleEntityNotFound(_0x3691e3,null))[_0x85d8('0x1d')](removeEntity(_0x3691e3,null))[_0x85d8('0x1d')](function(){return db['VoiceContext'][_0x85d8('0x53')]({'raw':!![]});})[_0x85d8('0x1d')](function(_0x1a4a4b){var _0x49724d=fs['readFileSync'](path[_0x85d8('0x5b')](config['root'],_0x85d8('0x69')),_0x85d8('0x5d'));var _0x46479b=ejs[_0x85d8('0x5e')](_0x49724d,{'contexts':_0x1a4a4b});fs[_0x85d8('0x5f')](_0x85d8('0x60'),_0x46479b);return respondWithRpcPromise(_0x85d8('0x61'),_0x85d8('0x34'),{'module':'chan_sip.so'});})[_0x85d8('0x27')](handleError(_0x3691e3,null));}; \ No newline at end of file +var _0x1c92=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','end','json','offset','limit','undefined','count','set','save','destroy','get','UserProfileResource','sendStatus','stack','name','send','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Contexts','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info'];(function(_0x2148a6,_0x550868){var _0x405a7b=function(_0x43171e){while(--_0x43171e){_0x2148a6['push'](_0x2148a6['shift']());}};_0x405a7b(++_0x550868);}(_0x1c92,0x117));var _0x21c9=function(_0x390143,_0x2b54ac){_0x390143=_0x390143-0x0;var _0x11361b=_0x1c92[_0x390143];return _0x11361b;};'use strict';var emlformat=require(_0x21c9('0x0'));var rimraf=require(_0x21c9('0x1'));var zipdir=require(_0x21c9('0x2'));var jsonpatch=require(_0x21c9('0x3'));var rp=require('request-promise');var moment=require(_0x21c9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x21c9('0x5'));var path=require(_0x21c9('0x6'));var sox=require(_0x21c9('0x7'));var csv=require(_0x21c9('0x8'));var ejs=require(_0x21c9('0x9'));var fs=require('fs');var fs_extra=require(_0x21c9('0xa'));var _=require(_0x21c9('0xb'));var squel=require(_0x21c9('0xc'));var crypto=require(_0x21c9('0xd'));var jsforce=require(_0x21c9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x21c9('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x21c9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x21c9('0x10'));var as=require(_0x21c9('0x11'));var hardwareService=require(_0x21c9('0x12'));var logger=require(_0x21c9('0x13'))(_0x21c9('0x14'));var utils=require(_0x21c9('0x15'));var config=require(_0x21c9('0x16'));var licenseUtil=require(_0x21c9('0x17'));var db=require(_0x21c9('0x18'))['db'];var jayson=require(_0x21c9('0x19'));var client=jayson[_0x21c9('0x1a')][_0x21c9('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x351292,_0x45bbd1,_0x31ecd9,_0x2b2963){return new BPromise(function(_0x23aa9b,_0x51aad4){var _0xe9ea36=_0x2b2963||client;return _0xe9ea36['request'](_0x351292,_0x31ecd9)[_0x21c9('0x1c')](function(_0x4363a3){logger[_0x21c9('0x1d')](_0x21c9('0x1e'),_0x45bbd1,_0x21c9('0x1f'));logger[_0x21c9('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x45bbd1,_0x21c9('0x1f'),JSON[_0x21c9('0x21')](_0x4363a3));if(_0x4363a3['error']){if(_0x4363a3[_0x21c9('0x22')][_0x21c9('0x23')]===0x1f4){logger[_0x21c9('0x22')](_0x21c9('0x1e'),_0x45bbd1,_0x4363a3[_0x21c9('0x22')][_0x21c9('0x24')]);return _0x51aad4(_0x4363a3[_0x21c9('0x22')]['message']);}logger[_0x21c9('0x22')](_0x21c9('0x1e'),_0x45bbd1,_0x4363a3[_0x21c9('0x22')][_0x21c9('0x24')]);return _0x23aa9b(_0x4363a3['error']['message']);}else{logger['info'](_0x21c9('0x1e'),_0x45bbd1,_0x21c9('0x1f'));_0x23aa9b(_0x4363a3['result']['message']);}})[_0x21c9('0x25')](function(_0xe0165){logger['error'](_0x21c9('0x1e'),_0x45bbd1,_0xe0165);_0x51aad4(_0xe0165);});});}function respondWithStatusCode(_0x53d307,_0x35f99e){_0x35f99e=_0x35f99e||0xcc;return function(_0x330282){if(_0x330282){return _0x53d307['sendStatus'](_0x35f99e);}return _0x53d307[_0x21c9('0x26')](_0x35f99e)[_0x21c9('0x27')]();};}function respondWithResult(_0x174ed7,_0x146a77){_0x146a77=_0x146a77||0xc8;return function(_0x3dba1d){if(_0x3dba1d){return _0x174ed7[_0x21c9('0x26')](_0x146a77)[_0x21c9('0x28')](_0x3dba1d);}};}function respondWithFilteredResult(_0x163fbf,_0x4b82b2){return function(_0x277b23){if(_0x277b23){var _0x1338b8=typeof _0x4b82b2[_0x21c9('0x29')]==='undefined'&&typeof _0x4b82b2[_0x21c9('0x2a')]===_0x21c9('0x2b');var _0x3d65e=_0x277b23[_0x21c9('0x2c')];var _0x1990a5=_0x1338b8?0x0:_0x4b82b2[_0x21c9('0x29')];var _0x3ac257=_0x1338b8?_0x277b23['count']:_0x4b82b2[_0x21c9('0x29')]+_0x4b82b2[_0x21c9('0x2a')];var _0x1b9507;if(_0x3ac257>=_0x3d65e){_0x3ac257=_0x3d65e;_0x1b9507=0xc8;}else{_0x1b9507=0xce;}_0x163fbf[_0x21c9('0x26')](_0x1b9507);return _0x163fbf[_0x21c9('0x2d')]('Content-Range',_0x1990a5+'-'+_0x3ac257+'/'+_0x3d65e)[_0x21c9('0x28')](_0x277b23);}return null;};}function patchUpdates(_0x3f62e6){return function(_0x14f428){try{jsonpatch['apply'](_0x14f428,_0x3f62e6,!![]);}catch(_0x5ae01e){return BPromise['reject'](_0x5ae01e);}return _0x14f428[_0x21c9('0x2e')]();};}function saveUpdates(_0x22337c,_0x10fd0a){return function(_0x337958){if(_0x337958){return _0x337958['update'](_0x22337c)[_0x21c9('0x1c')](function(_0x2fd226){return _0x2fd226;});}return null;};}function removeEntity(_0x5140f8,_0x38e33a){return function(_0x361c18){if(_0x361c18){return _0x361c18[_0x21c9('0x2f')]()[_0x21c9('0x1c')](function(){var _0x55a105=_0x361c18[_0x21c9('0x30')]({'plain':!![]});var _0x5c427c='Contexts';return db[_0x21c9('0x31')][_0x21c9('0x2f')]({'where':{'type':_0x5c427c,'resourceId':_0x55a105['id']}})[_0x21c9('0x1c')](function(){return _0x361c18;});})[_0x21c9('0x1c')](function(){_0x5140f8[_0x21c9('0x26')](0xcc)[_0x21c9('0x27')]();});}};}function handleEntityNotFound(_0x46c1e1,_0x450023){return function(_0x204ee2){if(!_0x204ee2){_0x46c1e1[_0x21c9('0x32')](0x194);}return _0x204ee2;};}function handleError(_0x1e51c7,_0x272504){_0x272504=_0x272504||0x1f4;return function(_0x5cebd4){logger['error'](_0x5cebd4[_0x21c9('0x33')]);if(_0x5cebd4[_0x21c9('0x34')]){delete _0x5cebd4[_0x21c9('0x34')];}_0x1e51c7[_0x21c9('0x26')](_0x272504)[_0x21c9('0x35')](_0x5cebd4);};}exports['index']=function(_0x1d7827,_0x36b413){var _0x4a83a5={},_0x1dd1fb={},_0x15afdb={'count':0x0,'rows':[]};var _0x2901c7=_['map'](db[_0x21c9('0x36')][_0x21c9('0x37')],function(_0x51d978){return{'name':_0x51d978[_0x21c9('0x38')],'type':_0x51d978[_0x21c9('0x39')][_0x21c9('0x3a')]};});_0x1dd1fb[_0x21c9('0x3b')]=_[_0x21c9('0x3c')](_0x2901c7,_0x21c9('0x34'));_0x1dd1fb[_0x21c9('0x3d')]=_[_0x21c9('0x3e')](_0x1d7827[_0x21c9('0x3d')]);_0x1dd1fb[_0x21c9('0x3f')]=_['intersection'](_0x1dd1fb[_0x21c9('0x3b')],_0x1dd1fb[_0x21c9('0x3d')]);_0x4a83a5[_0x21c9('0x40')]=_[_0x21c9('0x41')](_0x1dd1fb[_0x21c9('0x3b')],qs['fields'](_0x1d7827[_0x21c9('0x3d')][_0x21c9('0x42')]));_0x4a83a5[_0x21c9('0x40')]=_0x4a83a5[_0x21c9('0x40')]['length']?_0x4a83a5[_0x21c9('0x40')]:_0x1dd1fb[_0x21c9('0x3b')];if(!_0x1d7827[_0x21c9('0x3d')][_0x21c9('0x43')]('nolimit')){_0x4a83a5[_0x21c9('0x2a')]=qs[_0x21c9('0x2a')](_0x1d7827['query'][_0x21c9('0x2a')]);_0x4a83a5[_0x21c9('0x29')]=qs['offset'](_0x1d7827['query'][_0x21c9('0x29')]);}_0x4a83a5[_0x21c9('0x44')]=qs['sort'](_0x1d7827['query']['sort']);_0x4a83a5['where']=qs[_0x21c9('0x3f')](_[_0x21c9('0x45')](_0x1d7827['query'],_0x1dd1fb[_0x21c9('0x3f')]),_0x2901c7);if(_0x1d7827[_0x21c9('0x3d')][_0x21c9('0x46')]){_0x4a83a5[_0x21c9('0x47')]=_[_0x21c9('0x48')](_0x4a83a5[_0x21c9('0x47')],{'$or':_[_0x21c9('0x3c')](_0x2901c7,function(_0x2290c8){if(_0x2290c8['type']!==_0x21c9('0x49')){var _0x28956b={};_0x28956b[_0x2290c8[_0x21c9('0x34')]]={'$like':'%'+_0x1d7827['query']['filter']+'%'};return _0x28956b;}})});}_0x4a83a5=_[_0x21c9('0x48')]({},_0x4a83a5,_0x1d7827[_0x21c9('0x4a')]);var _0x3f9fbb={'where':_0x4a83a5[_0x21c9('0x47')]};return db[_0x21c9('0x36')][_0x21c9('0x2c')](_0x3f9fbb)['then'](function(_0x3a1815){_0x15afdb[_0x21c9('0x2c')]=_0x3a1815;if(_0x1d7827[_0x21c9('0x3d')][_0x21c9('0x4b')]){_0x4a83a5[_0x21c9('0x4c')]=[{'all':!![]}];}return db[_0x21c9('0x36')][_0x21c9('0x4d')](_0x4a83a5);})[_0x21c9('0x1c')](function(_0x480309){_0x15afdb[_0x21c9('0x4e')]=_0x480309;return _0x15afdb;})['then'](respondWithFilteredResult(_0x36b413,_0x4a83a5))['catch'](handleError(_0x36b413,null));};exports[_0x21c9('0x4f')]=function(_0x57bf6b,_0x93e300){var _0x449517={'raw':![],'where':{'id':_0x57bf6b[_0x21c9('0x50')]['id']}},_0x280028={};_0x280028['model']=_[_0x21c9('0x3e')](db[_0x21c9('0x36')][_0x21c9('0x37')]);_0x280028[_0x21c9('0x3d')]=_[_0x21c9('0x3e')](_0x57bf6b[_0x21c9('0x3d')]);_0x280028['filters']=_[_0x21c9('0x41')](_0x280028[_0x21c9('0x3b')],_0x280028[_0x21c9('0x3d')]);_0x449517[_0x21c9('0x40')]=_['intersection'](_0x280028[_0x21c9('0x3b')],qs[_0x21c9('0x42')](_0x57bf6b[_0x21c9('0x3d')][_0x21c9('0x42')]));_0x449517['attributes']=_0x449517[_0x21c9('0x40')][_0x21c9('0x51')]?_0x449517[_0x21c9('0x40')]:_0x280028[_0x21c9('0x3b')];if(_0x57bf6b['query']['includeAll']){_0x449517['include']=[{'all':!![]}];}_0x449517=_['merge']({},_0x449517,_0x57bf6b[_0x21c9('0x4a')]);return db[_0x21c9('0x36')]['find'](_0x449517)['then'](handleEntityNotFound(_0x93e300,null))[_0x21c9('0x1c')](respondWithResult(_0x93e300,null))[_0x21c9('0x25')](handleError(_0x93e300,null));};exports['create']=function(_0x37c29d,_0x1c668f,_0x4aab28){var _0x2af772;return db['VoiceContext']['create'](_0x37c29d['body'],{'raw':!![]})[_0x21c9('0x1c')](function(_0x2bce60){_0x2af772=_0x2bce60;return db['VoiceContext'][_0x21c9('0x4d')]({'raw':!![]});})['then'](function(_0x4c399a){var _0x1315d5=fs[_0x21c9('0x52')](path[_0x21c9('0x53')](config[_0x21c9('0x54')],_0x21c9('0x55')),_0x21c9('0x56'));var _0xafc2c9=ejs[_0x21c9('0x57')](_0x1315d5,{'contexts':_0x4c399a||[]});fs[_0x21c9('0x58')](_0x21c9('0x59'),_0xafc2c9);})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':_0x21c9('0x5a')});})[_0x21c9('0x1c')](function(){var _0xf696d6=_0x37c29d[_0x21c9('0x5b')][_0x21c9('0x30')]({'plain':!![]});if(!_0xf696d6)throw new Error(_0x21c9('0x5c'));if(_0xf696d6[_0x21c9('0x5d')]===_0x21c9('0x5b')){var _0x569b26=_0x2af772[_0x21c9('0x30')]({'plain':!![]});return db[_0x21c9('0x5e')][_0x21c9('0x5f')]({'where':{'name':_0x21c9('0x60'),'userProfileId':_0xf696d6[_0x21c9('0x61')]},'raw':!![]})[_0x21c9('0x1c')](function(_0x241ef5){if(_0x241ef5&&_0x241ef5[_0x21c9('0x62')]===0x0){return db[_0x21c9('0x31')][_0x21c9('0x63')]({'name':_0x569b26['name'],'resourceId':_0x569b26['id'],'type':_0x241ef5[_0x21c9('0x34')],'sectionId':_0x241ef5['id']},{})['then'](function(){return _0x2af772;});}else{return _0x2af772;}})[_0x21c9('0x25')](function(_0x57f866){logger[_0x21c9('0x22')](_0x21c9('0x64'),_0x57f866);throw _0x57f866;});}return _0x2af772;})['then'](respondWithResult(_0x1c668f,0xc9))[_0x21c9('0x25')](handleError(_0x1c668f,null));};exports[_0x21c9('0x65')]=function(_0x162128,_0x8b942c,_0x52b7dd){var _0x3d5b51;return db['VoiceContext'][_0x21c9('0x5f')]({'where':{'id':_0x162128[_0x21c9('0x50')]['id']}})[_0x21c9('0x1c')](handleEntityNotFound(_0x8b942c,null))['then'](saveUpdates(_0x162128[_0x21c9('0x66')],null))[_0x21c9('0x1c')](function(_0x1f5e79){if(_0x1f5e79){_0x3d5b51=_0x1f5e79;return db[_0x21c9('0x36')][_0x21c9('0x4d')]({'raw':!![]});}})[_0x21c9('0x1c')](function(_0x326854){var _0x681db7=fs[_0x21c9('0x52')](path[_0x21c9('0x53')](config[_0x21c9('0x54')],'server/files/templates/context.ejs'),'utf8');var _0x2e4f40=ejs[_0x21c9('0x57')](_0x681db7,{'contexts':_0x326854||[]});fs[_0x21c9('0x58')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x2e4f40);})[_0x21c9('0x1c')](function(){return respondWithRpcPromise('Reload',_0x21c9('0x65'),{'module':_0x21c9('0x5a')});})[_0x21c9('0x1c')](function(){return _0x3d5b51;})[_0x21c9('0x1c')](respondWithResult(_0x8b942c,null))[_0x21c9('0x25')](handleError(_0x8b942c,null));};exports['destroy']=function(_0x17dd77,_0x184494,_0x46fad8){var _0x403fcc;return db['VoiceContext']['find']({'where':{'id':_0x17dd77[_0x21c9('0x50')]['id']}})[_0x21c9('0x1c')](handleEntityNotFound(_0x184494,null))[_0x21c9('0x1c')](removeEntity(_0x184494,null))['then'](function(){return db[_0x21c9('0x36')]['findAll']({'raw':!![]});})[_0x21c9('0x1c')](function(_0x3cfeea){var _0x247679=fs[_0x21c9('0x52')](path[_0x21c9('0x53')](config[_0x21c9('0x54')],_0x21c9('0x55')),_0x21c9('0x56'));var _0x4a0e69=ejs[_0x21c9('0x57')](_0x247679,{'contexts':_0x3cfeea});fs[_0x21c9('0x58')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4a0e69);return respondWithRpcPromise('Reload',_0x21c9('0x2f'),{'module':_0x21c9('0x5a')});})['catch'](handleError(_0x184494,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index f6f2fe5..a1dd12e 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 _0x8a85=['define','VoiceContext','voice_contexts','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a85,0x153));var _0x58a8=function(_0x3e208d,_0x2566a1){_0x3e208d=_0x3e208d-0x0;var _0xea15c3=_0x8a85[_0x3e208d];return _0xea15c3;};'use strict';var _=require('lodash');var util=require(_0x58a8('0x0'));var logger=require('../../config/logger')(_0x58a8('0x1'));var moment=require(_0x58a8('0x2'));var BPromise=require(_0x58a8('0x3'));var rp=require(_0x58a8('0x4'));var fs=require('fs');var path=require(_0x58a8('0x5'));var rimraf=require(_0x58a8('0x6'));var config=require(_0x58a8('0x7'));var attributes=require('./voiceContext.attributes');module[_0x58a8('0x8')]=function(_0x14a00e,_0x886419){return _0x14a00e[_0x58a8('0x9')](_0x58a8('0xa'),attributes,{'tableName':_0x58a8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x117c=['rimraf','./voiceContext.attributes','exports','VoiceContext','voice_contexts','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x4f454f,_0x31485d){var _0x314402=function(_0x20001b){while(--_0x20001b){_0x4f454f['push'](_0x4f454f['shift']());}};_0x314402(++_0x31485d);}(_0x117c,0x11d));var _0xc117=function(_0xd77fa2,_0x489a23){_0xd77fa2=_0xd77fa2-0x0;var _0x101679=_0x117c[_0xd77fa2];return _0x101679;};'use strict';var _=require(_0xc117('0x0'));var util=require('util');var logger=require(_0xc117('0x1'))('api');var moment=require(_0xc117('0x2'));var BPromise=require(_0xc117('0x3'));var rp=require(_0xc117('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc117('0x5'));var config=require('../../config/environment');var attributes=require(_0xc117('0x6'));module[_0xc117('0x7')]=function(_0x5e7641,_0x1212a7){return _0x5e7641['define'](_0xc117('0x8'),attributes,{'tableName':_0xc117('0x9'),'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 66b426e..b4eccfc 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 _0xc35f=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0xb0871e,_0x4adf2d){var _0x379670=function(_0x22698d){while(--_0x22698d){_0xb0871e['push'](_0xb0871e['shift']());}};_0x379670(++_0x4adf2d);}(_0xc35f,0x1ca));var _0xfc35=function(_0x34a8b8,_0x50e655){_0x34a8b8=_0x34a8b8-0x0;var _0x518fd4=_0xc35f[_0x34a8b8];return _0x518fd4;};'use strict';var _=require(_0xfc35('0x0'));var util=require(_0xfc35('0x1'));var moment=require(_0xfc35('0x2'));var BPromise=require(_0xfc35('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc35('0x4'));var db=require(_0xfc35('0x5'))['db'];var utils=require(_0xfc35('0x6'));var logger=require('../../config/logger')(_0xfc35('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfc35('0x8')][_0xfc35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c92db,_0x47d695,_0x4283cd){return new BPromise(function(_0x290dcc,_0x43deed){return client['request'](_0x4c92db,_0x4283cd)[_0xfc35('0xa')](function(_0x13d7b9){logger[_0xfc35('0xb')]('VoiceContext,\x20%s,\x20%s',_0x47d695,_0xfc35('0xc'));logger[_0xfc35('0xd')](_0xfc35('0xe'),_0x47d695,_0xfc35('0xc'),JSON['stringify'](_0x13d7b9));if(_0x13d7b9[_0xfc35('0xf')]){if(_0x13d7b9[_0xfc35('0xf')]['code']===0x1f4){logger[_0xfc35('0xf')](_0xfc35('0x10'),_0x47d695,_0x13d7b9[_0xfc35('0xf')]['message']);return _0x43deed(_0x13d7b9[_0xfc35('0xf')]['message']);}logger[_0xfc35('0xf')]('VoiceContext,\x20%s,\x20%s',_0x47d695,_0x13d7b9[_0xfc35('0xf')][_0xfc35('0x11')]);return _0x290dcc(_0x13d7b9['error']['message']);}else{logger[_0xfc35('0xb')](_0xfc35('0x10'),_0x47d695,_0xfc35('0xc'));_0x290dcc(_0x13d7b9[_0xfc35('0x12')][_0xfc35('0x11')]);}})[_0xfc35('0x13')](function(_0x58aae3){logger[_0xfc35('0xf')](_0xfc35('0x10'),_0x47d695,_0x58aae3);_0x43deed(_0x58aae3);});});} \ No newline at end of file +var _0x0ca5=['request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x508870,_0x485259){var _0x3231ba=function(_0x5efdf0){while(--_0x5efdf0){_0x508870['push'](_0x508870['shift']());}};_0x3231ba(++_0x485259);}(_0x0ca5,0xfc));var _0x50ca=function(_0x17707b,_0x3ab473){_0x17707b=_0x17707b-0x0;var _0x3eff23=_0x0ca5[_0x17707b];return _0x3eff23;};'use strict';var _=require(_0x50ca('0x0'));var util=require(_0x50ca('0x1'));var moment=require(_0x50ca('0x2'));var BPromise=require(_0x50ca('0x3'));var rs=require(_0x50ca('0x4'));var fs=require('fs');var Redis=require(_0x50ca('0x5'));var db=require(_0x50ca('0x6'))['db'];var utils=require(_0x50ca('0x7'));var logger=require('../../config/logger')(_0x50ca('0x8'));var config=require(_0x50ca('0x9'));var jayson=require(_0x50ca('0xa'));var client=jayson[_0x50ca('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e7d2c,_0x18142d,_0x47e1b1){return new BPromise(function(_0x14709d,_0x56e57a){return client[_0x50ca('0xc')](_0x4e7d2c,_0x47e1b1)['then'](function(_0x3ab7a0){logger[_0x50ca('0xd')](_0x50ca('0xe'),_0x18142d,_0x50ca('0xf'));logger[_0x50ca('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x18142d,'request\x20sent',JSON[_0x50ca('0x11')](_0x3ab7a0));if(_0x3ab7a0[_0x50ca('0x12')]){if(_0x3ab7a0[_0x50ca('0x12')][_0x50ca('0x13')]===0x1f4){logger[_0x50ca('0x12')](_0x50ca('0xe'),_0x18142d,_0x3ab7a0[_0x50ca('0x12')][_0x50ca('0x14')]);return _0x56e57a(_0x3ab7a0[_0x50ca('0x12')][_0x50ca('0x14')]);}logger[_0x50ca('0x12')](_0x50ca('0xe'),_0x18142d,_0x3ab7a0[_0x50ca('0x12')][_0x50ca('0x14')]);return _0x14709d(_0x3ab7a0[_0x50ca('0x12')]['message']);}else{logger[_0x50ca('0xd')](_0x50ca('0xe'),_0x18142d,_0x50ca('0xf'));_0x14709d(_0x3ab7a0[_0x50ca('0x15')][_0x50ca('0x14')]);}})['catch'](function(_0x1566f4){logger['error'](_0x50ca('0xe'),_0x18142d,_0x1566f4);_0x56e57a(_0x1566f4);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 007120f..38e0874 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 _0x4bcc=['put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','describe','/:id','isAuthenticated','show','create'];(function(_0x312e8a,_0x24624c){var _0x583bb4=function(_0x2c4b61){while(--_0x2c4b61){_0x312e8a['push'](_0x312e8a['shift']());}};_0x583bb4(++_0x24624c);}(_0x4bcc,0x1a6));var _0xc4bc=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4bcc[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xc4bc('0x0'));var util=require(_0xc4bc('0x1'));var path=require(_0xc4bc('0x2'));var timeout=require(_0xc4bc('0x3'));var express=require('express');var router=express[_0xc4bc('0x4')]();var fs_extra=require(_0xc4bc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc4bc('0x6'));var config=require(_0xc4bc('0x7'));var controller=require('./voiceDialReport.controller');router[_0xc4bc('0x8')]('/',auth['isAuthenticated'](),controller[_0xc4bc('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc4bc('0xa')]);router[_0xc4bc('0x8')](_0xc4bc('0xb'),auth[_0xc4bc('0xc')](),controller[_0xc4bc('0xd')]);router['post']('/',auth[_0xc4bc('0xc')](),controller[_0xc4bc('0xe')]);router[_0xc4bc('0xf')]('/:id',auth[_0xc4bc('0xc')](),controller['update']);router[_0xc4bc('0x10')](_0xc4bc('0xb'),auth[_0xc4bc('0xc')](),controller[_0xc4bc('0x11')]);module[_0xc4bc('0x12')]=router; \ No newline at end of file +var _0x078a=['../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','create','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5c2e5e,_0x2bc00e){var _0x46a5da=function(_0xf0fa38){while(--_0xf0fa38){_0x5c2e5e['push'](_0x5c2e5e['shift']());}};_0x46a5da(++_0x2bc00e);}(_0x078a,0x1c1));var _0xa078=function(_0xbe8e73,_0x979f5f){_0xbe8e73=_0xbe8e73-0x0;var _0x46f932=_0x078a[_0xbe8e73];return _0x46f932;};'use strict';var multer=require(_0xa078('0x0'));var util=require(_0xa078('0x1'));var path=require(_0xa078('0x2'));var timeout=require('connect-timeout');var express=require(_0xa078('0x3'));var router=express[_0xa078('0x4')]();var fs_extra=require(_0xa078('0x5'));var auth=require(_0xa078('0x6'));var interaction=require(_0xa078('0x7'));var config=require(_0xa078('0x8'));var controller=require(_0xa078('0x9'));router[_0xa078('0xa')]('/',auth[_0xa078('0xb')](),controller[_0xa078('0xc')]);router[_0xa078('0xa')]('/describe',auth[_0xa078('0xb')](),controller[_0xa078('0xd')]);router[_0xa078('0xa')](_0xa078('0xe'),auth['isAuthenticated'](),controller[_0xa078('0xf')]);router['post']('/',auth[_0xa078('0xb')](),controller[_0xa078('0x10')]);router['put'](_0xa078('0xe'),auth[_0xa078('0xb')](),controller['update']);router['delete'](_0xa078('0xe'),auth[_0xa078('0xb')](),controller[_0xa078('0x11')]);module[_0xa078('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index ad3f794..315e9e3 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 _0x55ca=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x4c276,_0x3d651a){var _0x1f46d2=function(_0x14002f){while(--_0x14002f){_0x4c276['push'](_0x4c276['shift']());}};_0x1f46d2(++_0x3d651a);}(_0x55ca,0x126));var _0xa55c=function(_0x12e650,_0x33f29f){_0x12e650=_0x12e650-0x0;var _0x5b56b1=_0x55ca[_0x12e650];return _0x5b56b1;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'calleridnum':{'type':Sequelize[_0xa55c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa55c('0x2')]},'connectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'language':{'type':Sequelize[_0xa55c('0x2')]},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'context':{'type':Sequelize[_0xa55c('0x2')]},'exten':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa55c('0x2')]},'destchannel':{'type':Sequelize[_0xa55c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'destlanguage':{'type':Sequelize[_0xa55c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa55c('0x2')]},'destcontext':{'type':Sequelize[_0xa55c('0x2')]},'destexten':{'type':Sequelize[_0xa55c('0x2')]},'destpriority':{'type':Sequelize[_0xa55c('0x3')]},'destuniqueid':{'type':Sequelize[_0xa55c('0x2')]},'destlinkedid':{'type':Sequelize[_0xa55c('0x2')]},'dialstring':{'type':Sequelize[_0xa55c('0x2')]},'dialstatus':{'type':Sequelize[_0xa55c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa55c('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa55c('0x3')]},'holdtime':{'type':Sequelize[_0xa55c('0x3')]},'billableseconds':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file +var _0x6aa7=['called,connect,complete','sequelize','STRING','INTEGER','DATE'];(function(_0x3182f7,_0x303e5a){var _0x664cfa=function(_0x42cf23){while(--_0x42cf23){_0x3182f7['push'](_0x3182f7['shift']());}};_0x664cfa(++_0x303e5a);}(_0x6aa7,0x178));var _0x76aa=function(_0x4e6118,_0x41d0d7){_0x4e6118=_0x4e6118-0x0;var _0x71f58b=_0x6aa7[_0x4e6118];return _0x71f58b;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x76aa('0x1')]},'channel':{'type':Sequelize[_0x76aa('0x1')]},'channelstate':{'type':Sequelize[_0x76aa('0x2')]},'channelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x76aa('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x2')]},'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'linkedid':{'type':Sequelize[_0x76aa('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x76aa('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridnum':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'destlanguage':{'type':Sequelize[_0x76aa('0x1')]},'destaccountcode':{'type':Sequelize[_0x76aa('0x1')]},'destcontext':{'type':Sequelize[_0x76aa('0x1')]},'destexten':{'type':Sequelize[_0x76aa('0x1')]},'destpriority':{'type':Sequelize[_0x76aa('0x2')]},'destuniqueid':{'type':Sequelize[_0x76aa('0x1')]},'destlinkedid':{'type':Sequelize[_0x76aa('0x1')]},'dialstring':{'type':Sequelize[_0x76aa('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x76aa('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x76aa('0x3')]},'lastevent':{'type':Sequelize[_0x76aa('0x1')],'comment':_0x76aa('0x4')},'routeId':{'type':Sequelize[_0x76aa('0x2')]},'duration':{'type':Sequelize[_0x76aa('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 4b0423d..ca11596 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 _0xace6=['hasOwnProperty','nolimit','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','fields','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','end','send','index','map','VoiceDialReport','rawAttributes','fieldName','key','name','query','keys','filters','intersection','model','attributes','length'];(function(_0xc75f55,_0x283a13){var _0x232b18=function(_0x1bf2a0){while(--_0x1bf2a0){_0xc75f55['push'](_0xc75f55['shift']());}};_0x232b18(++_0x283a13);}(_0xace6,0x1d7));var _0x6ace=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xace6[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6ace('0x0'));var zipdir=require(_0x6ace('0x1'));var jsonpatch=require(_0x6ace('0x2'));var rp=require(_0x6ace('0x3'));var moment=require(_0x6ace('0x4'));var BPromise=require(_0x6ace('0x5'));var Mustache=require(_0x6ace('0x6'));var util=require(_0x6ace('0x7'));var path=require(_0x6ace('0x8'));var sox=require(_0x6ace('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ace('0xa'));var _=require(_0x6ace('0xb'));var squel=require(_0x6ace('0xc'));var crypto=require(_0x6ace('0xd'));var jsforce=require(_0x6ace('0xe'));var deskjs=require(_0x6ace('0xf'));var toCsv=require(_0x6ace('0x10'));var querystring=require(_0x6ace('0x11'));var Papa=require('papaparse');var Redis=require(_0x6ace('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6ace('0x13'));var hardwareService=require(_0x6ace('0x14'));var logger=require(_0x6ace('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x6ace('0x16'));var licenseUtil=require(_0x6ace('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x540933,_0x47b385){_0x47b385=_0x47b385||0xcc;return function(_0x191043){if(_0x191043){return _0x540933[_0x6ace('0x18')](_0x47b385);}return _0x540933[_0x6ace('0x19')](_0x47b385)['end']();};}function respondWithResult(_0x2ca881,_0x3ea4a0){_0x3ea4a0=_0x3ea4a0||0xc8;return function(_0x1b1409){if(_0x1b1409){return _0x2ca881['status'](_0x3ea4a0)[_0x6ace('0x1a')](_0x1b1409);}};}function respondWithFilteredResult(_0x5a1d33,_0x32eb20){return function(_0x81e0af){if(_0x81e0af){var _0xffad03=typeof _0x32eb20[_0x6ace('0x1b')]==='undefined'&&typeof _0x32eb20[_0x6ace('0x1c')]===_0x6ace('0x1d');var _0x441e59=_0x81e0af[_0x6ace('0x1e')];var _0x172f57=_0xffad03?0x0:_0x32eb20['offset'];var _0x228069=_0xffad03?_0x81e0af[_0x6ace('0x1e')]:_0x32eb20[_0x6ace('0x1b')]+_0x32eb20[_0x6ace('0x1c')];var _0x5ea2fd;if(_0x228069>=_0x441e59){_0x228069=_0x441e59;_0x5ea2fd=0xc8;}else{_0x5ea2fd=0xce;}_0x5a1d33['status'](_0x5ea2fd);return _0x5a1d33[_0x6ace('0x1f')](_0x6ace('0x20'),_0x172f57+'-'+_0x228069+'/'+_0x441e59)[_0x6ace('0x1a')](_0x81e0af);}return null;};}function patchUpdates(_0x41a13b){return function(_0x409001){try{jsonpatch[_0x6ace('0x21')](_0x409001,_0x41a13b,!![]);}catch(_0x2d0130){return BPromise[_0x6ace('0x22')](_0x2d0130);}return _0x409001['save']();};}function saveUpdates(_0x2ff70c,_0x3bd005){return function(_0x31e532){if(_0x31e532){return _0x31e532[_0x6ace('0x23')](_0x2ff70c)['then'](function(_0x122632){return _0x122632;});}return null;};}function removeEntity(_0x5e4492,_0x5090ab){return function(_0x4fe39c){if(_0x4fe39c){return _0x4fe39c[_0x6ace('0x24')]()[_0x6ace('0x25')](function(){_0x5e4492[_0x6ace('0x19')](0xcc)[_0x6ace('0x26')]();});}};}function handleEntityNotFound(_0xf99236,_0x1a87e8){return function(_0x430794){if(!_0x430794){_0xf99236[_0x6ace('0x18')](0x194);}return _0x430794;};}function handleError(_0x2420b8,_0x5688f8){_0x5688f8=_0x5688f8||0x1f4;return function(_0x38b027){logger['error'](_0x38b027['stack']);if(_0x38b027['name']){delete _0x38b027['name'];}_0x2420b8[_0x6ace('0x19')](_0x5688f8)[_0x6ace('0x27')](_0x38b027);};}exports[_0x6ace('0x28')]=function(_0x25e800,_0x14c920){var _0x30d79e={},_0x4026b9={},_0x3b19f4={'count':0x0,'rows':[]};var _0x19602e=_[_0x6ace('0x29')](db[_0x6ace('0x2a')][_0x6ace('0x2b')],function(_0x4b27cc){return{'name':_0x4b27cc[_0x6ace('0x2c')],'type':_0x4b27cc['type'][_0x6ace('0x2d')]};});_0x4026b9['model']=_[_0x6ace('0x29')](_0x19602e,_0x6ace('0x2e'));_0x4026b9[_0x6ace('0x2f')]=_[_0x6ace('0x30')](_0x25e800['query']);_0x4026b9[_0x6ace('0x31')]=_[_0x6ace('0x32')](_0x4026b9[_0x6ace('0x33')],_0x4026b9[_0x6ace('0x2f')]);_0x30d79e[_0x6ace('0x34')]=_[_0x6ace('0x32')](_0x4026b9[_0x6ace('0x33')],qs['fields'](_0x25e800[_0x6ace('0x2f')]['fields']));_0x30d79e['attributes']=_0x30d79e['attributes'][_0x6ace('0x35')]?_0x30d79e[_0x6ace('0x34')]:_0x4026b9[_0x6ace('0x33')];if(!_0x25e800[_0x6ace('0x2f')][_0x6ace('0x36')](_0x6ace('0x37'))){_0x30d79e[_0x6ace('0x1c')]=qs['limit'](_0x25e800[_0x6ace('0x2f')][_0x6ace('0x1c')]);_0x30d79e['offset']=qs[_0x6ace('0x1b')](_0x25e800[_0x6ace('0x2f')][_0x6ace('0x1b')]);}_0x30d79e['order']=qs[_0x6ace('0x38')](_0x25e800[_0x6ace('0x2f')]['sort']);_0x30d79e['where']=qs[_0x6ace('0x31')](_[_0x6ace('0x39')](_0x25e800[_0x6ace('0x2f')],_0x4026b9[_0x6ace('0x31')]),_0x19602e);if(_0x25e800[_0x6ace('0x2f')]['filter']){_0x30d79e[_0x6ace('0x3a')]=_[_0x6ace('0x3b')](_0x30d79e[_0x6ace('0x3a')],{'$or':_[_0x6ace('0x29')](_0x19602e,function(_0x22dee6){if(_0x22dee6[_0x6ace('0x3c')]!==_0x6ace('0x3d')){var _0x335111={};_0x335111[_0x22dee6[_0x6ace('0x2e')]]={'$like':'%'+_0x25e800[_0x6ace('0x2f')][_0x6ace('0x3e')]+'%'};return _0x335111;}})});}_0x30d79e=_[_0x6ace('0x3b')]({},_0x30d79e,_0x25e800[_0x6ace('0x3f')]);var _0x52f528={'where':_0x30d79e['where']};return db[_0x6ace('0x2a')][_0x6ace('0x1e')](_0x52f528)['then'](function(_0x4e4558){_0x3b19f4['count']=_0x4e4558;if(_0x25e800[_0x6ace('0x2f')][_0x6ace('0x40')]){_0x30d79e[_0x6ace('0x41')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x6ace('0x42')](_0x30d79e);})[_0x6ace('0x25')](function(_0x2e0575){_0x3b19f4['rows']=_0x2e0575;return _0x3b19f4;})['then'](respondWithFilteredResult(_0x14c920,_0x30d79e))[_0x6ace('0x43')](handleError(_0x14c920,null));};exports[_0x6ace('0x44')]=function(_0x385f6f,_0x29ca2b){var _0x56e736={'raw':!![],'where':{'id':_0x385f6f['params']['id']}},_0x10a777={};_0x10a777['model']=_[_0x6ace('0x30')](db['VoiceDialReport'][_0x6ace('0x2b')]);_0x10a777[_0x6ace('0x2f')]=_[_0x6ace('0x30')](_0x385f6f[_0x6ace('0x2f')]);_0x10a777['filters']=_['intersection'](_0x10a777[_0x6ace('0x33')],_0x10a777[_0x6ace('0x2f')]);_0x56e736[_0x6ace('0x34')]=_[_0x6ace('0x32')](_0x10a777[_0x6ace('0x33')],qs[_0x6ace('0x45')](_0x385f6f[_0x6ace('0x2f')][_0x6ace('0x45')]));_0x56e736['attributes']=_0x56e736[_0x6ace('0x34')]['length']?_0x56e736[_0x6ace('0x34')]:_0x10a777['model'];if(_0x385f6f[_0x6ace('0x2f')][_0x6ace('0x40')]){_0x56e736[_0x6ace('0x41')]=[{'all':!![]}];}_0x56e736=_[_0x6ace('0x3b')]({},_0x56e736,_0x385f6f[_0x6ace('0x3f')]);return db[_0x6ace('0x2a')][_0x6ace('0x46')](_0x56e736)['then'](handleEntityNotFound(_0x29ca2b,null))[_0x6ace('0x25')](respondWithResult(_0x29ca2b,null))['catch'](handleError(_0x29ca2b,null));};exports[_0x6ace('0x47')]=function(_0x5efc2f,_0x1596b9){return db[_0x6ace('0x2a')][_0x6ace('0x47')](_0x5efc2f[_0x6ace('0x48')],{})[_0x6ace('0x25')](respondWithResult(_0x1596b9,0xc9))[_0x6ace('0x43')](handleError(_0x1596b9,null));};exports['update']=function(_0x187635,_0x46ef0f){if(_0x187635[_0x6ace('0x48')]['id']){delete _0x187635[_0x6ace('0x48')]['id'];}return db[_0x6ace('0x2a')]['find']({'where':{'id':_0x187635[_0x6ace('0x49')]['id']}})[_0x6ace('0x25')](handleEntityNotFound(_0x46ef0f,null))[_0x6ace('0x25')](saveUpdates(_0x187635['body'],null))[_0x6ace('0x25')](respondWithResult(_0x46ef0f,null))[_0x6ace('0x43')](handleError(_0x46ef0f,null));};exports['destroy']=function(_0x4e20fa,_0x3537ae){return db[_0x6ace('0x2a')][_0x6ace('0x46')]({'where':{'id':_0x4e20fa[_0x6ace('0x49')]['id']}})[_0x6ace('0x25')](handleEntityNotFound(_0x3537ae,null))[_0x6ace('0x25')](removeEntity(_0x3537ae,null))['catch'](handleError(_0x3537ae,null));};exports[_0x6ace('0x4a')]=function(_0x128c18,_0xa14d50){return db[_0x6ace('0x2a')]['describe']()[_0x6ace('0x25')](respondWithResult(_0xa14d50,null))[_0x6ace('0x43')](handleError(_0xa14d50,null));}; \ No newline at end of file +var _0x03fd=['length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','find','create','body','params','describe','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','index','VoiceDialReport','type','key','model','map','query','keys','filters','intersection','fields','attributes'];(function(_0x2567a9,_0x3b0780){var _0x29cd7c=function(_0x142d27){while(--_0x142d27){_0x2567a9['push'](_0x2567a9['shift']());}};_0x29cd7c(++_0x3b0780);}(_0x03fd,0xa8));var _0xd03f=function(_0x500582,_0x68f187){_0x500582=_0x500582-0x0;var _0x21ddc3=_0x03fd[_0x500582];return _0x21ddc3;};'use strict';var emlformat=require(_0xd03f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd03f('0x1'));var moment=require(_0xd03f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd03f('0x3'));var util=require(_0xd03f('0x4'));var path=require(_0xd03f('0x5'));var sox=require(_0xd03f('0x6'));var csv=require(_0xd03f('0x7'));var ejs=require(_0xd03f('0x8'));var fs=require('fs');var fs_extra=require(_0xd03f('0x9'));var _=require(_0xd03f('0xa'));var squel=require(_0xd03f('0xb'));var crypto=require(_0xd03f('0xc'));var jsforce=require(_0xd03f('0xd'));var deskjs=require(_0xd03f('0xe'));var toCsv=require(_0xd03f('0x7'));var querystring=require(_0xd03f('0xf'));var Papa=require('papaparse');var Redis=require(_0xd03f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd03f('0x11'));var as=require(_0xd03f('0x12'));var hardwareService=require(_0xd03f('0x13'));var logger=require(_0xd03f('0x14'))(_0xd03f('0x15'));var utils=require(_0xd03f('0x16'));var config=require(_0xd03f('0x17'));var licenseUtil=require(_0xd03f('0x18'));var db=require(_0xd03f('0x19'))['db'];function respondWithStatusCode(_0xb0dc42,_0xdbfbd6){_0xdbfbd6=_0xdbfbd6||0xcc;return function(_0x274741){if(_0x274741){return _0xb0dc42[_0xd03f('0x1a')](_0xdbfbd6);}return _0xb0dc42[_0xd03f('0x1b')](_0xdbfbd6)['end']();};}function respondWithResult(_0x4b7b61,_0x2972b7){_0x2972b7=_0x2972b7||0xc8;return function(_0x445d6c){if(_0x445d6c){return _0x4b7b61['status'](_0x2972b7)[_0xd03f('0x1c')](_0x445d6c);}};}function respondWithFilteredResult(_0x117413,_0x4c1de8){return function(_0x1fcf56){if(_0x1fcf56){var _0x2b3f2a=typeof _0x4c1de8[_0xd03f('0x1d')]==='undefined'&&typeof _0x4c1de8[_0xd03f('0x1e')]==='undefined';var _0x3ea59c=_0x1fcf56[_0xd03f('0x1f')];var _0x2ff1d0=_0x2b3f2a?0x0:_0x4c1de8[_0xd03f('0x1d')];var _0xe46404=_0x2b3f2a?_0x1fcf56[_0xd03f('0x1f')]:_0x4c1de8[_0xd03f('0x1d')]+_0x4c1de8[_0xd03f('0x1e')];var _0x503a70;if(_0xe46404>=_0x3ea59c){_0xe46404=_0x3ea59c;_0x503a70=0xc8;}else{_0x503a70=0xce;}_0x117413[_0xd03f('0x1b')](_0x503a70);return _0x117413[_0xd03f('0x20')](_0xd03f('0x21'),_0x2ff1d0+'-'+_0xe46404+'/'+_0x3ea59c)[_0xd03f('0x1c')](_0x1fcf56);}return null;};}function patchUpdates(_0x26f23c){return function(_0x1dda1f){try{jsonpatch['apply'](_0x1dda1f,_0x26f23c,!![]);}catch(_0x28e5fa){return BPromise['reject'](_0x28e5fa);}return _0x1dda1f[_0xd03f('0x22')]();};}function saveUpdates(_0x31ab5d,_0x48cc3d){return function(_0x1d705d){if(_0x1d705d){return _0x1d705d[_0xd03f('0x23')](_0x31ab5d)[_0xd03f('0x24')](function(_0x42e642){return _0x42e642;});}return null;};}function removeEntity(_0x5a0a8a,_0x13af95){return function(_0x597e26){if(_0x597e26){return _0x597e26[_0xd03f('0x25')]()[_0xd03f('0x24')](function(){_0x5a0a8a[_0xd03f('0x1b')](0xcc)[_0xd03f('0x26')]();});}};}function handleEntityNotFound(_0x9773b2,_0x311b45){return function(_0x35941e){if(!_0x35941e){_0x9773b2['sendStatus'](0x194);}return _0x35941e;};}function handleError(_0x448ef4,_0x1e1bca){_0x1e1bca=_0x1e1bca||0x1f4;return function(_0x4b28b2){logger[_0xd03f('0x27')](_0x4b28b2[_0xd03f('0x28')]);if(_0x4b28b2[_0xd03f('0x29')]){delete _0x4b28b2[_0xd03f('0x29')];}_0x448ef4[_0xd03f('0x1b')](_0x1e1bca)['send'](_0x4b28b2);};}exports[_0xd03f('0x2a')]=function(_0x18af68,_0x52b237){var _0x544b6f={},_0x12277a={},_0x4dcbbc={'count':0x0,'rows':[]};var _0x58c972=_['map'](db[_0xd03f('0x2b')]['rawAttributes'],function(_0x130936){return{'name':_0x130936['fieldName'],'type':_0x130936[_0xd03f('0x2c')][_0xd03f('0x2d')]};});_0x12277a[_0xd03f('0x2e')]=_[_0xd03f('0x2f')](_0x58c972,_0xd03f('0x29'));_0x12277a[_0xd03f('0x30')]=_[_0xd03f('0x31')](_0x18af68[_0xd03f('0x30')]);_0x12277a[_0xd03f('0x32')]=_[_0xd03f('0x33')](_0x12277a[_0xd03f('0x2e')],_0x12277a['query']);_0x544b6f['attributes']=_['intersection'](_0x12277a['model'],qs[_0xd03f('0x34')](_0x18af68['query'][_0xd03f('0x34')]));_0x544b6f['attributes']=_0x544b6f[_0xd03f('0x35')][_0xd03f('0x36')]?_0x544b6f[_0xd03f('0x35')]:_0x12277a[_0xd03f('0x2e')];if(!_0x18af68[_0xd03f('0x30')]['hasOwnProperty'](_0xd03f('0x37'))){_0x544b6f[_0xd03f('0x1e')]=qs['limit'](_0x18af68[_0xd03f('0x30')][_0xd03f('0x1e')]);_0x544b6f['offset']=qs['offset'](_0x18af68[_0xd03f('0x30')][_0xd03f('0x1d')]);}_0x544b6f[_0xd03f('0x38')]=qs[_0xd03f('0x39')](_0x18af68[_0xd03f('0x30')][_0xd03f('0x39')]);_0x544b6f[_0xd03f('0x3a')]=qs[_0xd03f('0x32')](_[_0xd03f('0x3b')](_0x18af68['query'],_0x12277a['filters']),_0x58c972);if(_0x18af68['query'][_0xd03f('0x3c')]){_0x544b6f[_0xd03f('0x3a')]=_[_0xd03f('0x3d')](_0x544b6f[_0xd03f('0x3a')],{'$or':_['map'](_0x58c972,function(_0x3cbb74){if(_0x3cbb74[_0xd03f('0x2c')]!==_0xd03f('0x3e')){var _0x202ce5={};_0x202ce5[_0x3cbb74[_0xd03f('0x29')]]={'$like':'%'+_0x18af68['query'][_0xd03f('0x3c')]+'%'};return _0x202ce5;}})});}_0x544b6f=_['merge']({},_0x544b6f,_0x18af68[_0xd03f('0x3f')]);var _0x4159df={'where':_0x544b6f['where']};return db[_0xd03f('0x2b')][_0xd03f('0x1f')](_0x4159df)[_0xd03f('0x24')](function(_0xf707f3){_0x4dcbbc['count']=_0xf707f3;if(_0x18af68[_0xd03f('0x30')][_0xd03f('0x40')]){_0x544b6f['include']=[{'all':!![]}];}return db[_0xd03f('0x2b')][_0xd03f('0x41')](_0x544b6f);})['then'](function(_0x252074){_0x4dcbbc[_0xd03f('0x42')]=_0x252074;return _0x4dcbbc;})['then'](respondWithFilteredResult(_0x52b237,_0x544b6f))[_0xd03f('0x43')](handleError(_0x52b237,null));};exports[_0xd03f('0x44')]=function(_0x32cae6,_0x4f49e0){var _0x4b67dd={'raw':!![],'where':{'id':_0x32cae6['params']['id']}},_0x300913={};_0x300913[_0xd03f('0x2e')]=_[_0xd03f('0x31')](db[_0xd03f('0x2b')]['rawAttributes']);_0x300913['query']=_['keys'](_0x32cae6[_0xd03f('0x30')]);_0x300913[_0xd03f('0x32')]=_[_0xd03f('0x33')](_0x300913[_0xd03f('0x2e')],_0x300913[_0xd03f('0x30')]);_0x4b67dd[_0xd03f('0x35')]=_[_0xd03f('0x33')](_0x300913[_0xd03f('0x2e')],qs[_0xd03f('0x34')](_0x32cae6[_0xd03f('0x30')]['fields']));_0x4b67dd[_0xd03f('0x35')]=_0x4b67dd['attributes']['length']?_0x4b67dd[_0xd03f('0x35')]:_0x300913['model'];if(_0x32cae6[_0xd03f('0x30')][_0xd03f('0x40')]){_0x4b67dd['include']=[{'all':!![]}];}_0x4b67dd=_['merge']({},_0x4b67dd,_0x32cae6['options']);return db[_0xd03f('0x2b')][_0xd03f('0x45')](_0x4b67dd)[_0xd03f('0x24')](handleEntityNotFound(_0x4f49e0,null))['then'](respondWithResult(_0x4f49e0,null))['catch'](handleError(_0x4f49e0,null));};exports[_0xd03f('0x46')]=function(_0x33f487,_0x227c74){return db[_0xd03f('0x2b')][_0xd03f('0x46')](_0x33f487[_0xd03f('0x47')],{})['then'](respondWithResult(_0x227c74,0xc9))[_0xd03f('0x43')](handleError(_0x227c74,null));};exports[_0xd03f('0x23')]=function(_0x16fb4e,_0x1b290f){if(_0x16fb4e[_0xd03f('0x47')]['id']){delete _0x16fb4e[_0xd03f('0x47')]['id'];}return db[_0xd03f('0x2b')][_0xd03f('0x45')]({'where':{'id':_0x16fb4e[_0xd03f('0x48')]['id']}})[_0xd03f('0x24')](handleEntityNotFound(_0x1b290f,null))['then'](saveUpdates(_0x16fb4e[_0xd03f('0x47')],null))[_0xd03f('0x24')](respondWithResult(_0x1b290f,null))['catch'](handleError(_0x1b290f,null));};exports[_0xd03f('0x25')]=function(_0x128431,_0x1e8176){return db[_0xd03f('0x2b')][_0xd03f('0x45')]({'where':{'id':_0x128431[_0xd03f('0x48')]['id']}})[_0xd03f('0x24')](handleEntityNotFound(_0x1e8176,null))[_0xd03f('0x24')](removeEntity(_0x1e8176,null))[_0xd03f('0x43')](handleError(_0x1e8176,null));};exports[_0xd03f('0x49')]=function(_0x545b9f,_0x5f1e9f){return db[_0xd03f('0x2b')][_0xd03f('0x49')]()['then'](respondWithResult(_0x5f1e9f,null))[_0xd03f('0x43')](handleError(_0x5f1e9f,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 06f5afd..321446a 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 _0xa4b0=['uniqueid','lodash','util','../../config/logger','api','bluebird','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial'];(function(_0x114a9b,_0x5e2c9e){var _0x389c9f=function(_0x37a16d){while(--_0x37a16d){_0x114a9b['push'](_0x114a9b['shift']());}};_0x389c9f(++_0x5e2c9e);}(_0xa4b0,0x15d));var _0x0a4b=function(_0x3a19de,_0x308bbf){_0x3a19de=_0x3a19de-0x0;var _0x31e000=_0xa4b0[_0x3a19de];return _0x31e000;};'use strict';var _=require(_0x0a4b('0x0'));var util=require(_0x0a4b('0x1'));var logger=require(_0x0a4b('0x2'))(_0x0a4b('0x3'));var moment=require('moment');var BPromise=require(_0x0a4b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0a4b('0x5'));var config=require('../../config/environment');var attributes=require(_0x0a4b('0x6'));module[_0x0a4b('0x7')]=function(_0x5d24ad,_0x16e82d){return _0x5d24ad[_0x0a4b('0x8')](_0x0a4b('0x9'),attributes,{'tableName':_0x0a4b('0xa'),'paranoid':![],'indexes':[{'fields':[_0x0a4b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe1bc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','report_dial','uniqueid','util','../../config/logger','api'];(function(_0x10bc17,_0x33701c){var _0x4b22be=function(_0x5606dd){while(--_0x5606dd){_0x10bc17['push'](_0x10bc17['shift']());}};_0x4b22be(++_0x33701c);}(_0xe1bc,0xf4));var _0xce1b=function(_0x5ae164,_0x4fcbc2){_0x5ae164=_0x5ae164-0x0;var _0x377866=_0xe1bc[_0x5ae164];return _0x377866;};'use strict';var _=require('lodash');var util=require(_0xce1b('0x0'));var logger=require(_0xce1b('0x1'))(_0xce1b('0x2'));var moment=require(_0xce1b('0x3'));var BPromise=require(_0xce1b('0x4'));var rp=require(_0xce1b('0x5'));var fs=require('fs');var path=require(_0xce1b('0x6'));var rimraf=require(_0xce1b('0x7'));var config=require(_0xce1b('0x8'));var attributes=require(_0xce1b('0x9'));module[_0xce1b('0xa')]=function(_0x2700a0,_0x286300){return _0x2700a0['define']('VoiceDialReport',attributes,{'tableName':_0xce1b('0xb'),'paranoid':![],'indexes':[{'fields':[_0xce1b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index f88e2bf..485fb49 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 _0x29de=['../../config/logger','../../config/environment','jayson/promise','http','info','VoiceDialReport,\x20%s,\x20%s','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','then','debug','update','where','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0x29de,0xe6));var _0xe29d=function(_0x3edc70,_0x20b827){_0x3edc70=_0x3edc70-0x0;var _0xd44bf5=_0x29de[_0x3edc70];return _0xd44bf5;};'use strict';var _=require(_0xe29d('0x0'));var util=require(_0xe29d('0x1'));var moment=require(_0xe29d('0x2'));var BPromise=require(_0xe29d('0x3'));var rs=require(_0xe29d('0x4'));var fs=require('fs');var Redis=require(_0xe29d('0x5'));var db=require(_0xe29d('0x6'))['db'];var utils=require(_0xe29d('0x7'));var logger=require(_0xe29d('0x8'))('rpc');var config=require(_0xe29d('0x9'));var jayson=require(_0xe29d('0xa'));var client=jayson['client'][_0xe29d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21fcfb,_0x4b6c70,_0x5d9e92){return new BPromise(function(_0x57c761,_0x5194d7){return client['request'](_0x21fcfb,_0x5d9e92)['then'](function(_0x5a4b1b){logger[_0xe29d('0xc')](_0xe29d('0xd'),_0x4b6c70,'request\x20sent');logger['debug'](_0xe29d('0xe'),_0x4b6c70,_0xe29d('0xf'),JSON[_0xe29d('0x10')](_0x5a4b1b));if(_0x5a4b1b['error']){if(_0x5a4b1b['error'][_0xe29d('0x11')]===0x1f4){logger[_0xe29d('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x4b6c70,_0x5a4b1b['error'][_0xe29d('0x13')]);return _0x5194d7(_0x5a4b1b[_0xe29d('0x12')]['message']);}logger[_0xe29d('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x4b6c70,_0x5a4b1b[_0xe29d('0x12')][_0xe29d('0x13')]);return _0x57c761(_0x5a4b1b[_0xe29d('0x12')][_0xe29d('0x13')]);}else{logger[_0xe29d('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x4b6c70,_0xe29d('0xf'));_0x57c761(_0x5a4b1b['result']['message']);}})[_0xe29d('0x14')](function(_0x542caa){logger[_0xe29d('0x12')](_0xe29d('0xd'),_0x4b6c70,_0x542caa);_0x5194d7(_0x542caa);});});}exports[_0xe29d('0x15')]=function(_0x47db37){var _0xe32c39=this;return new Promise(function(_0x1eb9f6,_0x95a41c){return db[_0xe29d('0x16')][_0xe29d('0x17')](_0x47db37[_0xe29d('0x18')],{'raw':_0x47db37['options']?_0x47db37[_0xe29d('0x19')][_0xe29d('0x1a')]===undefined?!![]:![]:!![]})[_0xe29d('0x1b')](function(_0x24d0d7){logger[_0xe29d('0xc')](_0xe29d('0x15'),_0x47db37);logger[_0xe29d('0x1c')](_0xe29d('0x15'),_0x47db37,JSON['stringify'](_0x24d0d7));_0x1eb9f6(_0x24d0d7);})['catch'](function(_0x3eb28a){logger[_0xe29d('0x12')]('CreateVoiceDialReport',_0x3eb28a[_0xe29d('0x13')],_0x47db37);_0x95a41c(_0xe32c39[_0xe29d('0x12')](0x1f4,_0x3eb28a[_0xe29d('0x13')]));});});};exports['UpdateVoiceDialReport']=function(_0x4954ed){var _0x5a399f=this;return new Promise(function(_0x49b5ec,_0x56088e){return db[_0xe29d('0x16')][_0xe29d('0x1d')](_0x4954ed[_0xe29d('0x18')],{'raw':_0x4954ed[_0xe29d('0x19')]?_0x4954ed['options'][_0xe29d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4954ed['options']?_0x4954ed['options'][_0xe29d('0x1e')]||null:null,'attributes':_0x4954ed[_0xe29d('0x19')]?_0x4954ed[_0xe29d('0x19')][_0xe29d('0x1f')]||null:null,'limit':_0x4954ed['options']?_0x4954ed[_0xe29d('0x19')][_0xe29d('0x20')]||null:null})['then'](function(_0x2dedb7){logger[_0xe29d('0xc')](_0xe29d('0x21'),_0x4954ed);logger[_0xe29d('0x1c')](_0xe29d('0x21'),_0x4954ed,JSON['stringify'](_0x2dedb7));_0x49b5ec(_0x2dedb7);})[_0xe29d('0x14')](function(_0x43cc07){logger[_0xe29d('0x12')](_0xe29d('0x21'),_0x43cc07['message'],_0x4954ed);_0x56088e(_0x5a399f[_0xe29d('0x12')](0x1f4,_0x43cc07['message']));});});}; \ No newline at end of file +var _0x82e4=['debug','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','then','UpdateVoiceDialReport','where','attributes','limit','lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x52072e,_0x50ba14){var _0x59b680=function(_0x3b7316){while(--_0x3b7316){_0x52072e['push'](_0x52072e['shift']());}};_0x59b680(++_0x50ba14);}(_0x82e4,0x1a8));var _0x482e=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0x82e4[_0x64aff8];return _0x5488a3;};'use strict';var _=require(_0x482e('0x0'));var util=require(_0x482e('0x1'));var moment=require('moment');var BPromise=require(_0x482e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x482e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x482e('0x4'));var logger=require('../../config/logger')(_0x482e('0x5'));var config=require(_0x482e('0x6'));var jayson=require(_0x482e('0x7'));var client=jayson[_0x482e('0x8')][_0x482e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36edc8,_0x199a73,_0x148b93){return new BPromise(function(_0x470196,_0x417571){return client['request'](_0x36edc8,_0x148b93)['then'](function(_0x1c448b){logger[_0x482e('0xa')]('VoiceDialReport,\x20%s,\x20%s',_0x199a73,'request\x20sent');logger[_0x482e('0xb')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x199a73,'request\x20sent',JSON[_0x482e('0xc')](_0x1c448b));if(_0x1c448b['error']){if(_0x1c448b[_0x482e('0xd')][_0x482e('0xe')]===0x1f4){logger[_0x482e('0xd')](_0x482e('0xf'),_0x199a73,_0x1c448b[_0x482e('0xd')][_0x482e('0x10')]);return _0x417571(_0x1c448b[_0x482e('0xd')]['message']);}logger[_0x482e('0xd')](_0x482e('0xf'),_0x199a73,_0x1c448b[_0x482e('0xd')][_0x482e('0x10')]);return _0x470196(_0x1c448b[_0x482e('0xd')][_0x482e('0x10')]);}else{logger['info'](_0x482e('0xf'),_0x199a73,_0x482e('0x11'));_0x470196(_0x1c448b[_0x482e('0x12')][_0x482e('0x10')]);}})[_0x482e('0x13')](function(_0x4b894e){logger[_0x482e('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x199a73,_0x4b894e);_0x417571(_0x4b894e);});});}exports[_0x482e('0x14')]=function(_0x4daa5b){var _0x21fdd2=this;return new Promise(function(_0x2b2ad4,_0x6d1e6b){return db[_0x482e('0x15')]['create'](_0x4daa5b[_0x482e('0x16')],{'raw':_0x4daa5b[_0x482e('0x17')]?_0x4daa5b[_0x482e('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x482e('0x18')](function(_0x6bff4e){logger[_0x482e('0xa')]('CreateVoiceDialReport',_0x4daa5b);logger[_0x482e('0xb')]('CreateVoiceDialReport',_0x4daa5b,JSON[_0x482e('0xc')](_0x6bff4e));_0x2b2ad4(_0x6bff4e);})['catch'](function(_0xc5c436){logger['error'](_0x482e('0x14'),_0xc5c436['message'],_0x4daa5b);_0x6d1e6b(_0x21fdd2[_0x482e('0xd')](0x1f4,_0xc5c436[_0x482e('0x10')]));});});};exports[_0x482e('0x19')]=function(_0x39830e){var _0x527317=this;return new Promise(function(_0x442fc6,_0x56a344){return db[_0x482e('0x15')]['update'](_0x39830e[_0x482e('0x16')],{'raw':_0x39830e['options']?_0x39830e[_0x482e('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39830e[_0x482e('0x17')]?_0x39830e[_0x482e('0x17')][_0x482e('0x1a')]||null:null,'attributes':_0x39830e[_0x482e('0x17')]?_0x39830e['options'][_0x482e('0x1b')]||null:null,'limit':_0x39830e['options']?_0x39830e[_0x482e('0x17')][_0x482e('0x1c')]||null:null})['then'](function(_0x241f9c){logger[_0x482e('0xa')](_0x482e('0x19'),_0x39830e);logger[_0x482e('0xb')]('UpdateVoiceDialReport',_0x39830e,JSON[_0x482e('0xc')](_0x241f9c));_0x442fc6(_0x241f9c);})[_0x482e('0x13')](function(_0x196427){logger[_0x482e('0xd')](_0x482e('0x19'),_0x196427[_0x482e('0x10')],_0x39830e);_0x56a344(_0x527317['error'](0x1f4,_0x196427[_0x482e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index bdf824a..fa6458d 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 _0x78ee=['fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','/:id','isAuthenticated','post','create','/:id/applications','addApplications','put','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x37746d,_0x550f5c){var _0x1088bd=function(_0x2888ac){while(--_0x2888ac){_0x37746d['push'](_0x37746d['shift']());}};_0x1088bd(++_0x550f5c);}(_0x78ee,0x1dc));var _0xe78e=function(_0x4bfb81,_0x16f1e2){_0x4bfb81=_0x4bfb81-0x0;var _0x3b59ab=_0x78ee[_0x4bfb81];return _0x3b59ab;};'use strict';var multer=require(_0xe78e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe78e('0x1'));var express=require(_0xe78e('0x2'));var router=express[_0xe78e('0x3')]();var fs_extra=require(_0xe78e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe78e('0x5'));var config=require(_0xe78e('0x6'));var controller=require(_0xe78e('0x7'));router[_0xe78e('0x8')]('/',auth['isAuthenticated'](),controller[_0xe78e('0x9')]);router[_0xe78e('0x8')](_0xe78e('0xa'),auth[_0xe78e('0xb')](),controller['show']);router[_0xe78e('0xc')]('/',auth[_0xe78e('0xb')](),controller[_0xe78e('0xd')]);router[_0xe78e('0xc')](_0xe78e('0xe'),auth['isAuthenticated'](),controller[_0xe78e('0xf')]);router[_0xe78e('0x10')](_0xe78e('0xa'),auth[_0xe78e('0xb')](),controller['update']);router[_0xe78e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xe78e('0x12')]);module[_0xe78e('0x13')]=router; \ No newline at end of file +var _0x1ffa=['isAuthenticated','index','show','post','create','/:id/applications','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get'];(function(_0x1a1fe8,_0x4486c7){var _0x220963=function(_0x3ab1f4){while(--_0x3ab1f4){_0x1a1fe8['push'](_0x1a1fe8['shift']());}};_0x220963(++_0x4486c7);}(_0x1ffa,0x1ee));var _0xa1ff=function(_0x565372,_0x408f85){_0x565372=_0x565372-0x0;var _0x4543a4=_0x1ffa[_0x565372];return _0x4543a4;};'use strict';var multer=require('multer');var util=require(_0xa1ff('0x0'));var path=require(_0xa1ff('0x1'));var timeout=require(_0xa1ff('0x2'));var express=require(_0xa1ff('0x3'));var router=express[_0xa1ff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa1ff('0x5'));var interaction=require(_0xa1ff('0x6'));var config=require(_0xa1ff('0x7'));var controller=require(_0xa1ff('0x8'));router[_0xa1ff('0x9')]('/',auth[_0xa1ff('0xa')](),controller[_0xa1ff('0xb')]);router[_0xa1ff('0x9')]('/:id',auth[_0xa1ff('0xa')](),controller[_0xa1ff('0xc')]);router[_0xa1ff('0xd')]('/',auth['isAuthenticated'](),controller[_0xa1ff('0xe')]);router[_0xa1ff('0xd')](_0xa1ff('0xf'),auth['isAuthenticated'](),controller['addApplications']);router['put']('/:id',auth[_0xa1ff('0xa')](),controller[_0xa1ff('0x10')]);router[_0xa1ff('0x11')](_0xa1ff('0x12'),auth['isAuthenticated'](),controller[_0xa1ff('0x13')]);module[_0xa1ff('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 7ad2dda..57a003a 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(_0x4da356,_0x5235e1){var _0x321b07=function(_0x2bc6f4){while(--_0x2bc6f4){_0x4da356['push'](_0x4da356['shift']());}};_0x321b07(++_0x5235e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 _0xe706=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x30e3a6,_0x2590ea){var _0x2129ce=function(_0x36f5db){while(--_0x36f5db){_0x30e3a6['push'](_0x30e3a6['shift']());}};_0x2129ce(++_0x2590ea);}(_0xe706,0xa3));var _0x6e70=function(_0xc54c54,_0x59053b){_0xc54c54=_0xc54c54-0x0;var _0x476786=_0xe706[_0xc54c54];return _0x476786;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'context':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':_0x6e70('0x3')},'priority':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x6e70('0x3')},'tag':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0x4')},'appdata':{'type':Sequelize[_0x6e70('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x6e70('0x5')](_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x6e70('0x2')]},'interval':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0xd')},'IntervalId':{'type':Sequelize[_0x6e70('0xe')]},'isApp':{'type':Sequelize[_0x6e70('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x6e70('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x10')},'answer':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0x6e70('0x11')],'get':function(){return this[_0x6e70('0x12')](_0x6e70('0x13'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 9c3357e..89e8334 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 _0xb2f3=['find','name','UserProfileResource','send','index','VoiceExtension','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','merge','VIRTUAL','options','findAll','rows','show','rawAttributes','includeAll','include','catch','create','body','startsWith','exten','concat','user','role','UserProfileSection','userProfileId','autoAssociation','error','update','params','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','sendStatus','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','status','end','json','undefined','count','offset','limit','set','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','type'];(function(_0x2fc113,_0x45ec6e){var _0x5144ce=function(_0x47fd29){while(--_0x47fd29){_0x2fc113['push'](_0x2fc113['shift']());}};_0x5144ce(++_0x45ec6e);}(_0xb2f3,0x157));var _0x3b2f=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xb2f3[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0x3b2f('0x0'));var Redis=require(_0x3b2f('0x1'));var qs=require(_0x3b2f('0x2'));var logger=require(_0x3b2f('0x3'))(_0x3b2f('0x4'));var config=require(_0x3b2f('0x5'));var db=require(_0x3b2f('0x6'))['db'];config[_0x3b2f('0x7')]=_[_0x3b2f('0x8')](config[_0x3b2f('0x7')],{'host':_0x3b2f('0x9'),'port':0x18eb});var socket=require(_0x3b2f('0xa'))(new Redis(config[_0x3b2f('0x7')]));require(_0x3b2f('0xb'))['register'](socket);function respondWithStatusCode(_0xaef66b,_0x528bb0){_0x528bb0=_0x528bb0||0xcc;return function(_0x1176c0){if(_0x1176c0){return _0xaef66b['sendStatus'](_0x528bb0);}return _0xaef66b[_0x3b2f('0xc')](_0x528bb0)[_0x3b2f('0xd')]();};}function respondWithResult(_0x4b1f3f,_0x137ebd){_0x137ebd=_0x137ebd||0xc8;return function(_0x133277){if(_0x133277){return _0x4b1f3f[_0x3b2f('0xc')](_0x137ebd)[_0x3b2f('0xe')](_0x133277);}};}function respondWithFilteredResult(_0x46f356,_0x5551dc){return function(_0x69daa6){if(_0x69daa6){var _0x361f7f=typeof _0x5551dc['offset']===_0x3b2f('0xf')&&typeof _0x5551dc['limit']===_0x3b2f('0xf');var _0x91d539=_0x69daa6[_0x3b2f('0x10')];var _0x272796=_0x361f7f?0x0:_0x5551dc[_0x3b2f('0x11')];var _0x386be1=_0x361f7f?_0x69daa6[_0x3b2f('0x10')]:_0x5551dc[_0x3b2f('0x11')]+_0x5551dc[_0x3b2f('0x12')];var _0x1fba53;if(_0x386be1>=_0x91d539){_0x386be1=_0x91d539;_0x1fba53=0xc8;}else{_0x1fba53=0xce;}_0x46f356[_0x3b2f('0xc')](_0x1fba53);return _0x46f356[_0x3b2f('0x13')]('Content-Range',_0x272796+'-'+_0x386be1+'/'+_0x91d539)[_0x3b2f('0xe')](_0x69daa6);}return null;};}function removeEntity(_0x3448ff){return function(_0x22cfb3){if(_0x22cfb3){return _0x22cfb3[_0x3b2f('0x14')]()[_0x3b2f('0x15')](function(){var _0x5e33ec=_0x22cfb3[_0x3b2f('0x16')]({'plain':!![]});var _0x2c38c4=[{'name':_0x3b2f('0x17'),'value':_0x3b2f('0x18'),'ignore':![]},{'name':_0x3b2f('0x19'),'value':_0x3b2f('0x1a'),'ignore':![]},{'name':_0x3b2f('0x1b'),'value':'internal','ignore':![]}];var _0x24d2f0=_(_0x2c38c4)[_0x3b2f('0x1c')](_0x3b2f('0x1d'))[_0x3b2f('0x1e')]('value')[_0x3b2f('0x1f')]();if(_['includes'](_0x24d2f0,_0x5e33ec[_0x3b2f('0x20')])){return;}var _0x46b23e=_[_0x3b2f('0x21')](_0x2c38c4,[_0x3b2f('0x1f'),_0x5e33ec[_0x3b2f('0x20')]])[_0x3b2f('0x22')];return db[_0x3b2f('0x23')][_0x3b2f('0x14')]({'where':{'type':_0x46b23e,'resourceId':_0x5e33ec['id']}})[_0x3b2f('0x15')](function(){return _0x22cfb3;});})[_0x3b2f('0x15')](function(){_0x3448ff['status'](0xcc)[_0x3b2f('0xd')]();});}};}function handleEntityNotFound(_0x59f162){return function(_0xdeb540){if(!_0xdeb540){_0x59f162['sendStatus'](0x194);}return _0xdeb540;};}function handleError(_0x33652c,_0x5bde54){_0x5bde54=_0x5bde54||0x1f4;return function(_0x285c87){logger['error'](_0x285c87['stack']);if(_0x285c87[_0x3b2f('0x22')]){delete _0x285c87[_0x3b2f('0x22')];}_0x33652c[_0x3b2f('0xc')](_0x5bde54)[_0x3b2f('0x24')](_0x285c87);};}exports[_0x3b2f('0x25')]=function(_0x5c387b,_0xfa0c99){var _0x59f148={},_0x462cb5={},_0xcc2ad5={'count':0x0,'rows':[]};var _0x1f3f72=_[_0x3b2f('0x1e')](db[_0x3b2f('0x26')]['rawAttributes'],function(_0x46e347){return{'name':_0x46e347['fieldName'],'type':_0x46e347[_0x3b2f('0x20')][_0x3b2f('0x27')]};});_0x462cb5[_0x3b2f('0x28')]=_[_0x3b2f('0x1e')](_0x1f3f72,_0x3b2f('0x22'));_0x462cb5[_0x3b2f('0x29')]=_[_0x3b2f('0x2a')](_0x5c387b['query']);_0x462cb5[_0x3b2f('0x2b')]=_[_0x3b2f('0x2c')](_0x462cb5[_0x3b2f('0x28')],_0x462cb5['query']);_0x59f148[_0x3b2f('0x2d')]=_['intersection'](_0x462cb5[_0x3b2f('0x28')],qs[_0x3b2f('0x2e')](_0x5c387b['query'][_0x3b2f('0x2e')]));_0x59f148[_0x3b2f('0x2d')]=_0x59f148[_0x3b2f('0x2d')][_0x3b2f('0x2f')]?_0x59f148['attributes']:_0x462cb5['model'];if(!_0x5c387b[_0x3b2f('0x29')]['hasOwnProperty'](_0x3b2f('0x30'))){_0x59f148['limit']=qs[_0x3b2f('0x12')](_0x5c387b['query'][_0x3b2f('0x12')]);_0x59f148[_0x3b2f('0x11')]=qs['offset'](_0x5c387b[_0x3b2f('0x29')][_0x3b2f('0x11')]);}_0x59f148['order']=qs[_0x3b2f('0x31')](_0x5c387b[_0x3b2f('0x29')]['sort']);_0x59f148['where']=qs[_0x3b2f('0x2b')](_[_0x3b2f('0x32')](_0x5c387b[_0x3b2f('0x29')],_0x462cb5[_0x3b2f('0x2b')]),_0x1f3f72);if(_0x5c387b[_0x3b2f('0x29')]['filter']){_0x59f148[_0x3b2f('0x33')]=_[_0x3b2f('0x34')](_0x59f148['where'],{'$or':_[_0x3b2f('0x1e')](_0x1f3f72,function(_0x5d23cc){if(_0x5d23cc[_0x3b2f('0x20')]!==_0x3b2f('0x35')){var _0x2f12d4={};_0x2f12d4[_0x5d23cc[_0x3b2f('0x22')]]={'$like':'%'+_0x5c387b[_0x3b2f('0x29')][_0x3b2f('0x1c')]+'%'};return _0x2f12d4;}})});}_0x59f148=_[_0x3b2f('0x34')]({},_0x59f148,_0x5c387b[_0x3b2f('0x36')]);var _0x314b8b={'where':_0x59f148['where']};return db['VoiceExtension']['count'](_0x314b8b)['then'](function(_0x13f7cf){_0xcc2ad5['count']=_0x13f7cf;if(_0x5c387b[_0x3b2f('0x29')]['includeAll']){_0x59f148['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x3b2f('0x37')](_0x59f148);})[_0x3b2f('0x15')](function(_0x5acf3d){_0xcc2ad5[_0x3b2f('0x38')]=_0x5acf3d;return _0xcc2ad5;})[_0x3b2f('0x15')](respondWithFilteredResult(_0xfa0c99,_0x59f148))['catch'](handleError(_0xfa0c99,null));};exports[_0x3b2f('0x39')]=function(_0x275254,_0x175d6e){var _0x166fa6={'raw':![],'where':{'id':_0x275254['params']['id']}},_0x3f82ee={};_0x3f82ee[_0x3b2f('0x28')]=_['keys'](db['VoiceExtension'][_0x3b2f('0x3a')]);_0x3f82ee[_0x3b2f('0x29')]=_['keys'](_0x275254[_0x3b2f('0x29')]);_0x3f82ee[_0x3b2f('0x2b')]=_[_0x3b2f('0x2c')](_0x3f82ee[_0x3b2f('0x28')],_0x3f82ee[_0x3b2f('0x29')]);_0x166fa6[_0x3b2f('0x2d')]=_[_0x3b2f('0x2c')](_0x3f82ee[_0x3b2f('0x28')],qs[_0x3b2f('0x2e')](_0x275254[_0x3b2f('0x29')][_0x3b2f('0x2e')]));_0x166fa6[_0x3b2f('0x2d')]=_0x166fa6[_0x3b2f('0x2d')][_0x3b2f('0x2f')]?_0x166fa6[_0x3b2f('0x2d')]:_0x3f82ee[_0x3b2f('0x28')];if(_0x275254[_0x3b2f('0x29')][_0x3b2f('0x3b')]){_0x166fa6[_0x3b2f('0x3c')]=[{'all':!![]}];}_0x166fa6=_[_0x3b2f('0x34')]({},_0x166fa6,_0x275254['options']);return db['VoiceExtension'][_0x3b2f('0x21')](_0x166fa6)[_0x3b2f('0x15')](handleEntityNotFound(_0x175d6e,null))['then'](respondWithResult(_0x175d6e,null))[_0x3b2f('0x3d')](handleError(_0x175d6e,null));};exports['destroy']=function(_0x17a872,_0x4db532){return db['VoiceExtension'][_0x3b2f('0x21')]({'where':{'id':_0x17a872['params']['id']}})['then'](handleEntityNotFound(_0x4db532,null))[_0x3b2f('0x15')](removeEntity(_0x4db532,null))[_0x3b2f('0x3d')](handleError(_0x4db532,null));};exports[_0x3b2f('0x3e')]=function(_0x41f9f4,_0x70c6ed){if(_0x41f9f4[_0x3b2f('0x3f')][_0x3b2f('0x20')]==='outbound'&&!_[_0x3b2f('0x40')](_0x41f9f4[_0x3b2f('0x3f')][_0x3b2f('0x41')],'_')){_0x41f9f4['body'][_0x3b2f('0x41')]='_'[_0x3b2f('0x42')](_0x41f9f4[_0x3b2f('0x3f')]['exten']);}return db[_0x3b2f('0x26')]['create'](_0x41f9f4[_0x3b2f('0x3f')],{'raw':![]})[_0x3b2f('0x15')](function(_0x1c199f){var _0x3165cd=_0x41f9f4[_0x3b2f('0x43')]['get']({'plain':!![]});if(!_0x3165cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3165cd[_0x3b2f('0x44')]===_0x3b2f('0x43')){var _0x4a9a47=_0x1c199f['get']({'plain':!![]});var _0x24abaf=[{'name':_0x3b2f('0x17'),'value':'inbound'},{'name':_0x3b2f('0x19'),'value':_0x3b2f('0x1a')},{'name':'InternalRoutes','value':'internal'}];var _0x30c1ad=_[_0x3b2f('0x21')](_0x24abaf,[_0x3b2f('0x1f'),_0x4a9a47[_0x3b2f('0x20')]])[_0x3b2f('0x22')];return db[_0x3b2f('0x45')][_0x3b2f('0x21')]({'where':{'name':_0x30c1ad,'userProfileId':_0x3165cd[_0x3b2f('0x46')]},'raw':!![]})['then'](function(_0x58385a){if(_0x58385a&&_0x58385a[_0x3b2f('0x47')]===0x0){return db[_0x3b2f('0x23')]['create']({'name':_0x4a9a47[_0x3b2f('0x22')],'resourceId':_0x4a9a47['id'],'type':_0x58385a[_0x3b2f('0x22')],'sectionId':_0x58385a['id']},{})[_0x3b2f('0x15')](function(){return _0x1c199f;});}else{return _0x1c199f;}})['catch'](function(_0x3d153e){logger[_0x3b2f('0x48')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d153e);throw _0x3d153e;});}return _0x1c199f;})[_0x3b2f('0x15')](respondWithResult(_0x70c6ed,0xc9))[_0x3b2f('0x3d')](handleError(_0x70c6ed,null));};exports[_0x3b2f('0x49')]=function(_0x346366,_0x5dd914){if(_0x346366['body']['id']){delete _0x346366[_0x3b2f('0x3f')]['id'];}return db[_0x3b2f('0x26')][_0x3b2f('0x21')]({'where':{'id':_0x346366[_0x3b2f('0x4a')]['id']}})[_0x3b2f('0x15')](handleEntityNotFound(_0x5dd914,null))[_0x3b2f('0x15')](function(_0x37a691){if(_0x37a691){return db[_0x3b2f('0x26')][_0x3b2f('0x49')](_[_0x3b2f('0x32')](_0x346366[_0x3b2f('0x3f')],[_0x3b2f('0x41'),_0x3b2f('0x4b'),_0x3b2f('0x4c'),_0x3b2f('0x4d'),_0x3b2f('0x4e'),_0x3b2f('0x4f'),_0x3b2f('0x50')]),{'where':{'context':_0x37a691['context'],'exten':_0x37a691[_0x3b2f('0x41')]},'individualHooks':!![]})[_0x3b2f('0x15')](function(_0x5d45c9){return _0x5d45c9;});}return null;})[_0x3b2f('0x15')](respondWithStatusCode(_0x5dd914,null))[_0x3b2f('0x3d')](handleError(_0x5dd914,null));};exports[_0x3b2f('0x51')]=function(_0x4a9f3b,_0x303856){var _0x39f24e=_0x4a9f3b['params']['id'];var _0x351d4a=_0x4a9f3b['body'];var _0x21ecaf=0xc8;var _0x3a39d8=null;return db[_0x3b2f('0x52')][_0x3b2f('0x53')]({'isolationLevel':db[_0x3b2f('0x52')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x4b883b){return db[_0x3b2f('0x26')][_0x3b2f('0x54')]({'where':{'id':_0x39f24e},'transaction':_0x4b883b})[_0x3b2f('0x15')](function(_0x298ec4){if(_0x298ec4){return db[_0x3b2f('0x26')][_0x3b2f('0x14')]({'where':{'VoiceExtensionId':_0x39f24e},'transaction':_0x4b883b})[_0x3b2f('0x15')](function(){var _0x3db20e=_[_0x3b2f('0x1e')](_0x351d4a,function(_0x126980){_0x126980[_0x3b2f('0x55')]=_0x39f24e;_0x126980[_0x3b2f('0x56')]=!![];return _0x126980;});return _0x298ec4[_0x3b2f('0x57')](_0x3db20e);})[_0x3b2f('0x15')](function(_0x3d2d29){return db['VoiceExtension'][_0x3b2f('0x58')](_0x3d2d29,{'transaction':_0x4b883b});});}else{_0x21ecaf=0x194;_0x3a39d8=[];}});})[_0x3b2f('0x15')](function(){if(_0x21ecaf!==0x194){return db[_0x3b2f('0x26')][_0x3b2f('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x39f24e},'order':_0x3b2f('0x5a')})['then'](function(_0x4e93f6){_0x3a39d8=_0x4e93f6;});}})[_0x3b2f('0x3d')](function(_0x4587d4){_0x21ecaf=0x1f4;logger[_0x3b2f('0x48')](_0x4587d4[_0x3b2f('0x5b')]);if(_0x4587d4[_0x3b2f('0x22')]){delete _0x4587d4[_0x3b2f('0x22')];}_0x3a39d8=_0x4587d4;})[_0x3b2f('0x5c')](function(){if(_0x3a39d8===null){_0x303856[_0x3b2f('0x5d')](_0x21ecaf);}else{if(_0x21ecaf===0x1f4){_0x303856[_0x3b2f('0xc')](_0x21ecaf)[_0x3b2f('0x24')](_0x3a39d8);}else{_0x303856[_0x3b2f('0xc')](_0x21ecaf)['json'](_0x3a39d8);}}});}; \ No newline at end of file +var _0xbe7e=['outbound','InternalRoutes','filter','ignore','value','includes','type','find','name','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','model','map','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','show','params','catch','create','startsWith','body','exten','concat','get','role','InboundRoutes','OutboundRoutes','internal','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','mandatoryDisposition','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','json','destroy','then','inbound'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0xbe7e,0xf5));var _0xebe7=function(_0x15e3a0,_0x5f251d){_0x15e3a0=_0x15e3a0-0x0;var _0x846b24=_0xbe7e[_0x15e3a0];return _0x846b24;};'use strict';var _=require(_0xebe7('0x0'));var Redis=require(_0xebe7('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xebe7('0x2'))(_0xebe7('0x3'));var config=require(_0xebe7('0x4'));var db=require(_0xebe7('0x5'))['db'];config[_0xebe7('0x6')]=_[_0xebe7('0x7')](config[_0xebe7('0x6')],{'host':_0xebe7('0x8'),'port':0x18eb});var socket=require(_0xebe7('0x9'))(new Redis(config[_0xebe7('0x6')]));require('./voiceExtension.socket')[_0xebe7('0xa')](socket);function respondWithStatusCode(_0x15d507,_0x58317a){_0x58317a=_0x58317a||0xcc;return function(_0x585f15){if(_0x585f15){return _0x15d507[_0xebe7('0xb')](_0x58317a);}return _0x15d507[_0xebe7('0xc')](_0x58317a)[_0xebe7('0xd')]();};}function respondWithResult(_0x2263f4,_0x5ad8f2){_0x5ad8f2=_0x5ad8f2||0xc8;return function(_0x455587){if(_0x455587){return _0x2263f4[_0xebe7('0xc')](_0x5ad8f2)['json'](_0x455587);}};}function respondWithFilteredResult(_0x1edd0,_0x414543){return function(_0x566987){if(_0x566987){var _0x58ce1a=typeof _0x414543[_0xebe7('0xe')]===_0xebe7('0xf')&&typeof _0x414543[_0xebe7('0x10')]===_0xebe7('0xf');var _0x31d97b=_0x566987[_0xebe7('0x11')];var _0xc96e4f=_0x58ce1a?0x0:_0x414543[_0xebe7('0xe')];var _0x573e09=_0x58ce1a?_0x566987[_0xebe7('0x11')]:_0x414543[_0xebe7('0xe')]+_0x414543[_0xebe7('0x10')];var _0x3fc63e;if(_0x573e09>=_0x31d97b){_0x573e09=_0x31d97b;_0x3fc63e=0xc8;}else{_0x3fc63e=0xce;}_0x1edd0[_0xebe7('0xc')](_0x3fc63e);return _0x1edd0['set']('Content-Range',_0xc96e4f+'-'+_0x573e09+'/'+_0x31d97b)[_0xebe7('0x12')](_0x566987);}return null;};}function removeEntity(_0x2a6366){return function(_0x2c290d){if(_0x2c290d){return _0x2c290d[_0xebe7('0x13')]()[_0xebe7('0x14')](function(){var _0x36140d=_0x2c290d['get']({'plain':!![]});var _0x1917ef=[{'name':'InboundRoutes','value':_0xebe7('0x15'),'ignore':![]},{'name':'OutboundRoutes','value':_0xebe7('0x16'),'ignore':![]},{'name':_0xebe7('0x17'),'value':'internal','ignore':![]}];var _0x423c49=_(_0x1917ef)[_0xebe7('0x18')](_0xebe7('0x19'))['map'](_0xebe7('0x1a'))[_0xebe7('0x1a')]();if(_[_0xebe7('0x1b')](_0x423c49,_0x36140d[_0xebe7('0x1c')])){return;}var _0x3fe4bf=_[_0xebe7('0x1d')](_0x1917ef,[_0xebe7('0x1a'),_0x36140d['type']])[_0xebe7('0x1e')];return db['UserProfileResource']['destroy']({'where':{'type':_0x3fe4bf,'resourceId':_0x36140d['id']}})[_0xebe7('0x14')](function(){return _0x2c290d;});})[_0xebe7('0x14')](function(){_0x2a6366[_0xebe7('0xc')](0xcc)[_0xebe7('0xd')]();});}};}function handleEntityNotFound(_0x53e3b5){return function(_0x30457f){if(!_0x30457f){_0x53e3b5[_0xebe7('0xb')](0x194);}return _0x30457f;};}function handleError(_0x3eb9be,_0x26b8a4){_0x26b8a4=_0x26b8a4||0x1f4;return function(_0x8520b2){logger[_0xebe7('0x1f')](_0x8520b2[_0xebe7('0x20')]);if(_0x8520b2[_0xebe7('0x1e')]){delete _0x8520b2[_0xebe7('0x1e')];}_0x3eb9be[_0xebe7('0xc')](_0x26b8a4)[_0xebe7('0x21')](_0x8520b2);};}exports[_0xebe7('0x22')]=function(_0x318f35,_0x268f21){var _0x584260={},_0x2c19b4={},_0x15370e={'count':0x0,'rows':[]};var _0x3f83e1=_['map'](db[_0xebe7('0x23')][_0xebe7('0x24')],function(_0x28a778){return{'name':_0x28a778[_0xebe7('0x25')],'type':_0x28a778[_0xebe7('0x1c')]['key']};});_0x2c19b4[_0xebe7('0x26')]=_[_0xebe7('0x27')](_0x3f83e1,_0xebe7('0x1e'));_0x2c19b4['query']=_[_0xebe7('0x28')](_0x318f35[_0xebe7('0x29')]);_0x2c19b4['filters']=_[_0xebe7('0x2a')](_0x2c19b4[_0xebe7('0x26')],_0x2c19b4[_0xebe7('0x29')]);_0x584260['attributes']=_[_0xebe7('0x2a')](_0x2c19b4['model'],qs[_0xebe7('0x2b')](_0x318f35[_0xebe7('0x29')][_0xebe7('0x2b')]));_0x584260['attributes']=_0x584260[_0xebe7('0x2c')]['length']?_0x584260[_0xebe7('0x2c')]:_0x2c19b4[_0xebe7('0x26')];if(!_0x318f35[_0xebe7('0x29')][_0xebe7('0x2d')](_0xebe7('0x2e'))){_0x584260[_0xebe7('0x10')]=qs[_0xebe7('0x10')](_0x318f35[_0xebe7('0x29')][_0xebe7('0x10')]);_0x584260[_0xebe7('0xe')]=qs['offset'](_0x318f35['query'][_0xebe7('0xe')]);}_0x584260[_0xebe7('0x2f')]=qs[_0xebe7('0x30')](_0x318f35[_0xebe7('0x29')][_0xebe7('0x30')]);_0x584260[_0xebe7('0x31')]=qs[_0xebe7('0x32')](_[_0xebe7('0x33')](_0x318f35[_0xebe7('0x29')],_0x2c19b4['filters']),_0x3f83e1);if(_0x318f35['query'][_0xebe7('0x18')]){_0x584260[_0xebe7('0x31')]=_[_0xebe7('0x34')](_0x584260[_0xebe7('0x31')],{'$or':_[_0xebe7('0x27')](_0x3f83e1,function(_0x39bbaf){if(_0x39bbaf[_0xebe7('0x1c')]!==_0xebe7('0x35')){var _0x127e70={};_0x127e70[_0x39bbaf['name']]={'$like':'%'+_0x318f35[_0xebe7('0x29')]['filter']+'%'};return _0x127e70;}})});}_0x584260=_[_0xebe7('0x34')]({},_0x584260,_0x318f35[_0xebe7('0x36')]);var _0x13be7f={'where':_0x584260[_0xebe7('0x31')]};return db['VoiceExtension'][_0xebe7('0x11')](_0x13be7f)['then'](function(_0x1089ef){_0x15370e[_0xebe7('0x11')]=_0x1089ef;if(_0x318f35[_0xebe7('0x29')][_0xebe7('0x37')]){_0x584260['include']=[{'all':!![]}];}return db[_0xebe7('0x23')]['findAll'](_0x584260);})[_0xebe7('0x14')](function(_0x53495b){_0x15370e['rows']=_0x53495b;return _0x15370e;})[_0xebe7('0x14')](respondWithFilteredResult(_0x268f21,_0x584260))['catch'](handleError(_0x268f21,null));};exports[_0xebe7('0x38')]=function(_0x3344a9,_0x3b9e1d){var _0x39f793={'raw':![],'where':{'id':_0x3344a9[_0xebe7('0x39')]['id']}},_0x206096={};_0x206096[_0xebe7('0x26')]=_['keys'](db[_0xebe7('0x23')][_0xebe7('0x24')]);_0x206096['query']=_[_0xebe7('0x28')](_0x3344a9[_0xebe7('0x29')]);_0x206096[_0xebe7('0x32')]=_[_0xebe7('0x2a')](_0x206096[_0xebe7('0x26')],_0x206096[_0xebe7('0x29')]);_0x39f793[_0xebe7('0x2c')]=_[_0xebe7('0x2a')](_0x206096['model'],qs['fields'](_0x3344a9[_0xebe7('0x29')][_0xebe7('0x2b')]));_0x39f793[_0xebe7('0x2c')]=_0x39f793['attributes']['length']?_0x39f793[_0xebe7('0x2c')]:_0x206096[_0xebe7('0x26')];if(_0x3344a9['query']['includeAll']){_0x39f793['include']=[{'all':!![]}];}_0x39f793=_['merge']({},_0x39f793,_0x3344a9['options']);return db[_0xebe7('0x23')][_0xebe7('0x1d')](_0x39f793)[_0xebe7('0x14')](handleEntityNotFound(_0x3b9e1d,null))[_0xebe7('0x14')](respondWithResult(_0x3b9e1d,null))['catch'](handleError(_0x3b9e1d,null));};exports[_0xebe7('0x13')]=function(_0x4d80a5,_0x5977f3){return db[_0xebe7('0x23')]['find']({'where':{'id':_0x4d80a5['params']['id']}})[_0xebe7('0x14')](handleEntityNotFound(_0x5977f3,null))['then'](removeEntity(_0x5977f3,null))[_0xebe7('0x3a')](handleError(_0x5977f3,null));};exports[_0xebe7('0x3b')]=function(_0x2a3d9e,_0x5b80bc){if(_0x2a3d9e['body'][_0xebe7('0x1c')]===_0xebe7('0x16')&&!_[_0xebe7('0x3c')](_0x2a3d9e[_0xebe7('0x3d')][_0xebe7('0x3e')],'_')){_0x2a3d9e['body']['exten']='_'[_0xebe7('0x3f')](_0x2a3d9e['body'][_0xebe7('0x3e')]);}return db['VoiceExtension'][_0xebe7('0x3b')](_0x2a3d9e[_0xebe7('0x3d')],{'raw':![]})[_0xebe7('0x14')](function(_0x2564aa){var _0x48ffcc=_0x2a3d9e['user'][_0xebe7('0x40')]({'plain':!![]});if(!_0x48ffcc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48ffcc[_0xebe7('0x41')]==='user'){var _0x255a6b=_0x2564aa[_0xebe7('0x40')]({'plain':!![]});var _0x199368=[{'name':_0xebe7('0x42'),'value':'inbound'},{'name':_0xebe7('0x43'),'value':_0xebe7('0x16')},{'name':_0xebe7('0x17'),'value':_0xebe7('0x44')}];var _0x52b43e=_['find'](_0x199368,[_0xebe7('0x1a'),_0x255a6b[_0xebe7('0x1c')]])[_0xebe7('0x1e')];return db['UserProfileSection'][_0xebe7('0x1d')]({'where':{'name':_0x52b43e,'userProfileId':_0x48ffcc[_0xebe7('0x45')]},'raw':!![]})['then'](function(_0x5985bf){if(_0x5985bf&&_0x5985bf[_0xebe7('0x46')]===0x0){return db['UserProfileResource'][_0xebe7('0x3b')]({'name':_0x255a6b['name'],'resourceId':_0x255a6b['id'],'type':_0x5985bf[_0xebe7('0x1e')],'sectionId':_0x5985bf['id']},{})[_0xebe7('0x14')](function(){return _0x2564aa;});}else{return _0x2564aa;}})[_0xebe7('0x3a')](function(_0x320d61){logger[_0xebe7('0x1f')](_0xebe7('0x47'),_0x320d61);throw _0x320d61;});}return _0x2564aa;})[_0xebe7('0x14')](respondWithResult(_0x5b80bc,0xc9))[_0xebe7('0x3a')](handleError(_0x5b80bc,null));};exports['update']=function(_0x4d9643,_0xf610cc){if(_0x4d9643['body']['id']){delete _0x4d9643['body']['id'];}return db[_0xebe7('0x23')][_0xebe7('0x1d')]({'where':{'id':_0x4d9643[_0xebe7('0x39')]['id']}})[_0xebe7('0x14')](handleEntityNotFound(_0xf610cc,null))[_0xebe7('0x14')](function(_0x134d9a){if(_0x134d9a){return db[_0xebe7('0x23')][_0xebe7('0x48')](_['pick'](_0x4d9643['body'],[_0xebe7('0x3e'),_0xebe7('0x49'),_0xebe7('0x4a'),'recordingFormat',_0xebe7('0x4b'),_0xebe7('0x4c'),'alias']),{'where':{'context':_0x134d9a[_0xebe7('0x49')],'exten':_0x134d9a[_0xebe7('0x3e')]},'individualHooks':!![]})[_0xebe7('0x14')](function(_0x41cc39){return _0x41cc39;});}return null;})[_0xebe7('0x14')](respondWithStatusCode(_0xf610cc,null))[_0xebe7('0x3a')](handleError(_0xf610cc,null));};exports[_0xebe7('0x4d')]=function(_0x2e1671,_0x39a014){var _0x43ed75=_0x2e1671[_0xebe7('0x39')]['id'];var _0x5c001d=_0x2e1671[_0xebe7('0x3d')];var _0xb16401=0xc8;var _0x29497b=null;return db[_0xebe7('0x4e')]['transaction']({'isolationLevel':db['sequelize'][_0xebe7('0x4f')][_0xebe7('0x50')][_0xebe7('0x51')]},function(_0x15fbba){return db[_0xebe7('0x23')][_0xebe7('0x52')]({'where':{'id':_0x43ed75},'transaction':_0x15fbba})[_0xebe7('0x14')](function(_0xd301b8){if(_0xd301b8){return db[_0xebe7('0x23')][_0xebe7('0x13')]({'where':{'VoiceExtensionId':_0x43ed75},'transaction':_0x15fbba})[_0xebe7('0x14')](function(){var _0xa01919=_['map'](_0x5c001d,function(_0x2435a6){_0x2435a6[_0xebe7('0x53')]=_0x43ed75;_0x2435a6[_0xebe7('0x54')]=!![];return _0x2435a6;});return _0xd301b8[_0xebe7('0x55')](_0xa01919);})[_0xebe7('0x14')](function(_0x4cd873){return db[_0xebe7('0x23')][_0xebe7('0x56')](_0x4cd873,{'transaction':_0x15fbba});});}else{_0xb16401=0x194;_0x29497b=[];}});})[_0xebe7('0x14')](function(){if(_0xb16401!==0x194){return db[_0xebe7('0x23')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x43ed75},'order':_0xebe7('0x57')})[_0xebe7('0x14')](function(_0x4ac7e1){_0x29497b=_0x4ac7e1;});}})[_0xebe7('0x3a')](function(_0xb99573){_0xb16401=0x1f4;logger[_0xebe7('0x1f')](_0xb99573[_0xebe7('0x20')]);if(_0xb99573[_0xebe7('0x1e')]){delete _0xb99573[_0xebe7('0x1e')];}_0x29497b=_0xb99573;})[_0xebe7('0x58')](function(){if(_0x29497b===null){_0x39a014[_0xebe7('0xb')](_0xb16401);}else{if(_0xb16401===0x1f4){_0x39a014[_0xebe7('0xc')](_0xb16401)[_0xebe7('0x21')](_0x29497b);}else{_0x39a014['status'](_0xb16401)[_0xebe7('0x12')](_0x29497b);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 752c723..3d4d898 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 _0xbd76=['events','../../mysqldb','VoiceExtension','setMaxListeners','remove','hasOwnProperty','hook','exports'];(function(_0x2eb6f5,_0x2d16c3){var _0x2396c3=function(_0x5efe20){while(--_0x5efe20){_0x2eb6f5['push'](_0x2eb6f5['shift']());}};_0x2396c3(++_0x2d16c3);}(_0xbd76,0x1b0));var _0x6bd7=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xbd76[_0x2dadb9];return _0x2f0097;};'use strict';var EventEmitter=require(_0x6bd7('0x0'));var VoiceExtension=require(_0x6bd7('0x1'))['db'][_0x6bd7('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x6bd7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6bd7('0x4')};function emitEvent(_0x602569){return function(_0x1aa637,_0x14c527,_0x2e7ba4){VoiceExtensionEvents['emit'](_0x602569+':'+_0x1aa637['id'],_0x1aa637);VoiceExtensionEvents['emit'](_0x602569,_0x1aa637);_0x2e7ba4(null);};}for(var e in events){if(events[_0x6bd7('0x5')](e)){var event=events[e];VoiceExtension[_0x6bd7('0x6')](e,emitEvent(event));}}module[_0x6bd7('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0xb653=['setMaxListeners','save','update','remove','emit','exports','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb653,0x1db));var _0x3b65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb653[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x3b65('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x3b65('0x1')](0x0);var events={'afterCreate':_0x3b65('0x2'),'afterUpdate':_0x3b65('0x3'),'afterDestroy':_0x3b65('0x4')};function emitEvent(_0x3668f4){return function(_0x15035c,_0x5d78fa,_0xc074b4){VoiceExtensionEvents['emit'](_0x3668f4+':'+_0x15035c['id'],_0x15035c);VoiceExtensionEvents[_0x3b65('0x5')](_0x3668f4,_0x15035c);_0xc074b4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x3b65('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 0cb12fa..4761329 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 _0xaac4=['lodash','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','context','inbound','push','CDR(routeid)=','exten','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','split','length','name','param','phone','prefix','SIP','U(xcally-mixmonitor-context)','replace','join','Interval','IntervalId','then','interval','*,*,*,*','intervals','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','last','catch','define','VoiceExtension','get','Hangup'];(function(_0x1d3046,_0x8b14e1){var _0x3b9b62=function(_0xb69d69){while(--_0xb69d69){_0x1d3046['push'](_0x1d3046['shift']());}};_0x3b9b62(++_0x8b14e1);}(_0xaac4,0x190));var _0x4aac=function(_0x123cc3,_0x361fd8){_0x123cc3=_0x123cc3-0x0;var _0x134ee0=_0xaac4[_0x123cc3];return _0x134ee0;};'use strict';var _=require(_0x4aac('0x0'));var attributes=require(_0x4aac('0x1'));module[_0x4aac('0x2')]=function(_0x4e0baf){var _0x17dc67=_0x4e0baf[_0x4aac('0x3')];function _0x24d2df(_0x2dfb4b){var _0x30599d=0x2;var _0x360dbd=[{'type':_0x2dfb4b['type'],'app':_0x4aac('0x4'),'appdata':_0x4aac('0x5')+_0x2dfb4b[_0x4aac('0x6')],'context':_0x2dfb4b[_0x4aac('0x7')],'exten':_0x2dfb4b['exten'],'priority':_0x30599d++,'VoiceExtensionId':_0x2dfb4b['id']}];if(_0x2dfb4b[_0x4aac('0x6')]===_0x4aac('0x8')){_0x360dbd[_0x4aac('0x9')]({'type':_0x4aac('0x8'),'app':'Set','appdata':_0x4aac('0xa')+_0x2dfb4b['id'],'context':_0x2dfb4b['context'],'exten':_0x2dfb4b[_0x4aac('0xb')],'priority':_0x30599d++,'VoiceExtensionId':_0x2dfb4b['id']});}_0x360dbd[_0x4aac('0x9')]({'type':_0x2dfb4b['type'],'app':_0x4aac('0x4'),'appdata':_0x4aac('0xc'),'context':_0x2dfb4b[_0x4aac('0x7')],'exten':_0x2dfb4b['exten'],'priority':_0x30599d++,'VoiceExtensionId':_0x2dfb4b['id']},{'type':_0x2dfb4b[_0x4aac('0x6')],'app':_0x4aac('0x4'),'appdata':_0x4aac('0xd'),'context':_0x2dfb4b['context'],'exten':_0x2dfb4b[_0x4aac('0xb')],'priority':_0x30599d++,'VoiceExtensionId':_0x2dfb4b['id']},{'type':_0x2dfb4b[_0x4aac('0x6')],'app':'Set','appdata':_0x4aac('0xe'),'context':_0x2dfb4b['context'],'exten':_0x2dfb4b['exten'],'priority':_0x30599d++,'VoiceExtensionId':_0x2dfb4b['id']});return _0x360dbd;}function _0x321afa(_0x4b8ffe){var _0x4f941a=0x2;var _0x346f9e=[{'type':_0x4aac('0xf'),'app':_0x4aac('0x4'),'appdata':_0x4aac('0x10'),'context':_0x4b8ffe[_0x4aac('0x7')],'exten':_0x4b8ffe[_0x4aac('0xb')],'priority':_0x4f941a++,'VoiceExtensionId':_0x4b8ffe['id']},{'type':_0x4aac('0xf'),'app':'Set','appdata':'CDR(destination)='+(_0x4b8ffe[_0x4aac('0x11')]?_0x4aac('0x12')+_0x4b8ffe[_0x4aac('0x11')]+'}':_0x4aac('0x13')),'context':_0x4b8ffe[_0x4aac('0x7')],'exten':_0x4b8ffe[_0x4aac('0xb')],'priority':_0x4f941a++,'VoiceExtensionId':_0x4b8ffe['id']},{'type':_0x4aac('0xf'),'app':_0x4aac('0x4'),'appdata':_0x4aac('0xa')+_0x4b8ffe['id'],'context':_0x4b8ffe[_0x4aac('0x7')],'exten':_0x4b8ffe[_0x4aac('0xb')],'priority':_0x4f941a++,'VoiceExtensionId':_0x4b8ffe['id']},{'type':_0x4aac('0xf'),'app':_0x4aac('0x14'),'appdata':_0x4aac('0x15')+(_0x4f941a+0x2)+'):Goto('+(_0x4f941a+0x1)+')','context':_0x4b8ffe[_0x4aac('0x7')],'exten':_0x4b8ffe[_0x4aac('0xb')],'priority':_0x4f941a++,'VoiceExtensionId':_0x4b8ffe['id']},{'type':'outbound','app':'Set','appdata':_0x4b8ffe[_0x4aac('0x11')]?'CDR(prefix)=${EXTEN:0:'+_0x4b8ffe[_0x4aac('0x11')]+'}':_0x4aac('0x16'),'context':_0x4b8ffe[_0x4aac('0x7')],'exten':_0x4b8ffe[_0x4aac('0xb')],'priority':_0x4f941a++,'VoiceExtensionId':_0x4b8ffe['id']},{'type':_0x4aac('0xf'),'app':_0x4aac('0x4'),'appdata':_0x4aac('0xc'),'context':_0x4b8ffe[_0x4aac('0x7')],'exten':_0x4b8ffe['exten'],'priority':_0x4f941a++,'VoiceExtensionId':_0x4b8ffe['id']},{'type':_0x4aac('0xf'),'app':_0x4aac('0x4'),'appdata':_0x4aac('0xd'),'context':_0x4b8ffe[_0x4aac('0x7')],'exten':_0x4b8ffe['exten'],'priority':_0x4f941a++,'VoiceExtensionId':_0x4b8ffe['id']},{'type':'outbound','app':'Set','appdata':_0x4aac('0xe'),'context':_0x4b8ffe[_0x4aac('0x7')],'exten':_0x4b8ffe['exten'],'priority':_0x4f941a++,'VoiceExtensionId':_0x4b8ffe['id']},{'type':_0x4aac('0xf'),'app':_0x4aac('0x4'),'appdata':_0x4aac('0x17')+_0x4b8ffe['id'],'context':_0x4b8ffe[_0x4aac('0x7')],'exten':_0x4b8ffe['exten'],'priority':_0x4f941a++,'VoiceExtensionId':_0x4b8ffe['id']}];if(_0x4b8ffe['hasOwnProperty'](_0x4aac('0x18'))&&_0x4b8ffe['recordingFormat']!==_0x4aac('0x19')){_0x346f9e[_0x4aac('0x9')]({'type':_0x4aac('0xf'),'app':_0x4aac('0x4'),'appdata':_0x4aac('0x1a'),'context':_0x4b8ffe[_0x4aac('0x7')],'exten':_0x4b8ffe[_0x4aac('0xb')],'priority':_0x4f941a++,'VoiceExtensionId':_0x4b8ffe['id']},{'type':'outbound','app':_0x4aac('0x4'),'appdata':_0x4aac('0x1b')+_0x4b8ffe['recordingFormat']||_0x4aac('0x1c'),'context':_0x4b8ffe[_0x4aac('0x7')],'exten':_0x4b8ffe['exten'],'priority':_0x4f941a++,'VoiceExtensionId':_0x4b8ffe['id']});}return _0x346f9e;}function _0x58ab51(_0x2fd527,_0x4b5150){var _0x5c4ceb=[{'name':_0x4aac('0x1d'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x4aac('0x1e'),'param':0x2},{'name':_0x4aac('0x1f'),'param':0x3}];var _0x2d45a9={};var _0x857252=_0x4b5150[_0x4aac('0x20')](',');var _0x575cda=[];for(var _0x4f71bd=0x0;_0x4f71bd<_0x5c4ceb[_0x4aac('0x21')];_0x4f71bd++){switch(_0x5c4ceb[_0x4f71bd][_0x4aac('0x22')]){case'trunk':_0x2d45a9[_0x4aac('0x1d')]=_0x857252[_0x5c4ceb[_0x4f71bd][_0x4aac('0x23')]][_0x4aac('0x20')]('/')[0x1];_0x2d45a9[_0x4aac('0x24')]=_0x857252[_0x5c4ceb[_0x4f71bd]['param']][_0x4aac('0x20')]('/')[0x2];_0x2d45a9[_0x4aac('0x25')]=_0x2d45a9[_0x4aac('0x24')]?_0x2d45a9[_0x4aac('0x24')][_0x4aac('0x20')]('$')[0x0]:undefined;_0x2d45a9[_0x4aac('0x24')]=_0x2fd527[_0x4aac('0x11')]?(_0x2d45a9[_0x4aac('0x25')]||'')+_0x4aac('0x12')+_0x2fd527[_0x4aac('0x11')]+'}':(_0x2d45a9[_0x4aac('0x25')]||'')+_0x4aac('0x13');_0x575cda[_0x5c4ceb[_0x4f71bd][_0x4aac('0x23')]]=[_0x4aac('0x26'),_0x2d45a9['trunk'],_0x2d45a9[_0x4aac('0x24')]]['join']('/');break;case _0x4aac('0x1e'):_0x2d45a9[_0x4aac('0x1e')]=_0x857252[_0x5c4ceb[_0x4f71bd][_0x4aac('0x23')]];if(_0x2fd527[_0x4aac('0x18')]!==_0x4aac('0x19')){if(_0x2d45a9[_0x4aac('0x1e')]['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x2d45a9['options']+=_0x4aac('0x27');}}else{_0x2d45a9[_0x4aac('0x1e')]=_0x2d45a9['options'][_0x4aac('0x28')](_0x4aac('0x27'),'');}_0x575cda[_0x5c4ceb[_0x4f71bd][_0x4aac('0x23')]]=_0x2d45a9[_0x4aac('0x1e')];break;default:_0x575cda[_0x5c4ceb[_0x4f71bd][_0x4aac('0x23')]]=_0x857252[_0x5c4ceb[_0x4f71bd][_0x4aac('0x23')]];}}return _0x575cda[_0x4aac('0x29')](',');}function _0x59ead8(_0x3fbb1d,_0x295d9a,_0x3e7af1){return new Promise(function(_0x1b87f2,_0x2a8a96){var _0x3472ff=[];if(_['isEmpty'](_0x295d9a))return _0x1b87f2(_0x3472ff);_0x17dc67[_0x4aac('0x2a')]['findAll']({'attributes':['id','interval',_0x4aac('0x2b')],'raw':!![]})[_0x4aac('0x2c')](function(_0x1194a4){for(var _0x1457de=0x0,_0x1ae4ac=0x0;_0x1457de<_0x295d9a[_0x4aac('0x21')];_0x1457de++,_0x1ae4ac=0x0){var _0x1a4e22=_0x295d9a[_0x1457de];var _0x39dc70=[];var _0x3376b1=[];delete _0x1a4e22['id'];if(_0x1a4e22[_0x4aac('0x2d')]!==_0x4aac('0x2e')){_0x1a4e22[_0x4aac('0x2f')]=[_0x1a4e22['interval']];}else{_0x1a4e22[_0x4aac('0x2f')]=_0x1a4e22[_0x4aac('0x2b')]?_['map'](_[_0x4aac('0x30')](_0x1194a4,{'IntervalId':_0x1a4e22[_0x4aac('0x2b')]}),_0x4aac('0x2d')):[];}_0x1a4e22[_0x4aac('0x7')]=_0x3fbb1d[_0x4aac('0x7')];_0x1a4e22['exten']=_0x3fbb1d[_0x4aac('0xb')];if(_0x1a4e22['type'])_0x1a4e22[_0x4aac('0x6')]=_0x1a4e22['type'][_0x4aac('0x31')]();if(_0x3fbb1d[_0x4aac('0x6')]===_0x4aac('0xf')){if(_0x1a4e22[_0x4aac('0x32')](_0x4aac('0x33'))&&_0x1a4e22[_0x4aac('0x33')]&&_0x1a4e22[_0x4aac('0x33')]!=='--'){_0x39dc70[_0x4aac('0x9')]({'type':_0x1a4e22[_0x4aac('0x6')][_0x4aac('0x31')](),'app':'Set','appdata':_0x4aac('0x34')+_0x1a4e22['tag'],'context':_0x3fbb1d['context'],'exten':_0x3fbb1d[_0x4aac('0xb')],'priority':_0x1a4e22['intervals'][_0x4aac('0x21')]+_0x3e7af1+_0x1ae4ac++,'VoiceExtensionId':_0x3fbb1d['id']});}_0x39dc70[_0x4aac('0x9')]({'type':_0x1a4e22[_0x4aac('0x6')]['toLowerCase'](),'app':_0x4aac('0x14'),'appdata':_0x4aac('0x35')+(_0x1a4e22[_0x4aac('0x36')]?_0x4aac('0x37')+_0x1a4e22[_0x4aac('0x36')]+')':_0x4aac('0x38')),'context':_0x3fbb1d[_0x4aac('0x7')],'exten':_0x3fbb1d[_0x4aac('0xb')],'priority':_0x1a4e22[_0x4aac('0x2f')]['length']+_0x3e7af1+_0x1ae4ac++,'VoiceExtensionId':_0x3fbb1d['id']});}else{if(_0x1a4e22[_0x4aac('0x32')]('answer')){if([_0x4aac('0x39'),_0x4aac('0x3a')]['includes'](_0x1a4e22[_0x4aac('0x3b')][_0x4aac('0x31')]())&&_0x1a4e22['appType']!==_0x4aac('0x3c')){if(_0x1a4e22[_0x4aac('0x3d')]){_0x39dc70[_0x4aac('0x9')]({'type':_0x1a4e22[_0x4aac('0x6')]['toLowerCase'](),'app':_0x4aac('0x14'),'appdata':_0x4aac('0x3e'),'context':_0x3fbb1d[_0x4aac('0x7')],'exten':_0x3fbb1d[_0x4aac('0xb')],'priority':_0x1a4e22[_0x4aac('0x2f')][_0x4aac('0x21')]+_0x3e7af1+_0x1ae4ac++,'VoiceExtensionId':_0x3fbb1d['id']});_0x39dc70[_0x4aac('0x9')]({'type':_0x1a4e22[_0x4aac('0x6')][_0x4aac('0x31')](),'app':'Set','appdata':_0x4aac('0x3f'),'context':_0x3fbb1d[_0x4aac('0x7')],'exten':_0x3fbb1d[_0x4aac('0xb')],'priority':_0x1a4e22['intervals'][_0x4aac('0x21')]+_0x3e7af1+_0x1ae4ac++,'VoiceExtensionId':_0x3fbb1d['id']});}else{_0x39dc70[_0x4aac('0x9')]({'type':_0x1a4e22[_0x4aac('0x6')][_0x4aac('0x31')](),'app':_0x4aac('0x14'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3fbb1d['context'],'exten':_0x3fbb1d['exten'],'priority':_0x1a4e22[_0x4aac('0x2f')][_0x4aac('0x21')]+_0x3e7af1+_0x1ae4ac++,'VoiceExtensionId':_0x3fbb1d['id']});_0x39dc70[_0x4aac('0x9')]({'type':_0x1a4e22['type'][_0x4aac('0x31')](),'app':_0x4aac('0x4'),'appdata':_0x4aac('0x40'),'context':_0x3fbb1d['context'],'exten':_0x3fbb1d['exten'],'priority':_0x1a4e22['intervals'][_0x4aac('0x21')]+_0x3e7af1+_0x1ae4ac++,'VoiceExtensionId':_0x3fbb1d['id']});}}}}for(var _0x38390b=0x0;_0x38390b<_0x1a4e22[_0x4aac('0x2f')][_0x4aac('0x21')];_0x38390b++){var _0x5c6e82=_0x3e7af1+_0x1a4e22['intervals']['length'];var _0x18f9fe=_0x38390b===_0x1a4e22[_0x4aac('0x2f')][_0x4aac('0x21')]-0x1?_0x3e7af1+_0x39dc70[_0x4aac('0x21')]+_0x3376b1[_0x4aac('0x21')]+0x2:_0x3e7af1+_0x38390b+0x1;_0x39dc70[_0x4aac('0x41')](_0x38390b,0x0,{'type':_0x3fbb1d[_0x4aac('0x6')],'app':_0x4aac('0x42'),'appdata':_0x1a4e22[_0x4aac('0x2f')][_0x38390b]+'?'+_0x3fbb1d['context']+',${EXTEN},'+_0x5c6e82+':'+_0x3fbb1d[_0x4aac('0x7')]+_0x4aac('0x43')+_0x18f9fe,'exten':_0x3fbb1d['exten'],'context':_0x3fbb1d[_0x4aac('0x7')],'priority':_0x3e7af1+_0x38390b,'VoiceExtensionId':_0x3fbb1d['id']});}if(_0x1a4e22[_0x4aac('0x44')]==='outboundDial'){_0x1a4e22[_0x4aac('0x45')]=_0x58ab51(_0x3fbb1d,_0x1a4e22[_0x4aac('0x45')]);}if(_0x1a4e22['appType']===_0x4aac('0x46')){_0x39dc70['push']({'type':_0x1a4e22[_0x4aac('0x6')][_0x4aac('0x31')](),'app':_0x4aac('0x4'),'appdata':_0x4aac('0x47'),'context':_0x3fbb1d[_0x4aac('0x7')],'exten':_0x3fbb1d[_0x4aac('0xb')],'priority':_0x1a4e22[_0x4aac('0x2f')][_0x4aac('0x21')]+_0x3e7af1+_0x1ae4ac++,'VoiceExtensionId':_0x3fbb1d['id']});}_0x1a4e22[_0x4aac('0x48')]=_0x39dc70[_0x4aac('0x21')]?_['last'](_0x39dc70)[_0x4aac('0x48')]+0x1:_0x3e7af1;_0x3472ff=_[_0x4aac('0x49')](_0x3472ff,_0x39dc70,[_0x1a4e22],_0x3376b1);_0x3e7af1=_[_0x4aac('0x4a')](_0x3472ff)[_0x4aac('0x48')]+0x1;}return _0x1b87f2(_0x3472ff);})[_0x4aac('0x4b')](function(_0x1762e1){_0x2a8a96(_0x1762e1);});});}return _0x4e0baf[_0x4aac('0x4c')](_0x4aac('0x4d'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2ce7ca){var _0x43235e=this[_0x4aac('0x4e')]({'plain':!![]});var _0x2083fe=_0x43235e['type']===_0x4aac('0xf')?_0x321afa(_0x43235e):_0x24d2df(_0x43235e);return _0x59ead8(_0x43235e,_0x2ce7ca,_['last'](_0x2083fe)[_0x4aac('0x48')]+0x1)[_0x4aac('0x2c')](function(_0x57891e){var _0x5cfcdd=_[_0x4aac('0x49')](_0x2083fe,_0x57891e);_0x5cfcdd[_0x4aac('0x9')]({'type':_0x43235e[_0x4aac('0x6')],'app':_0x4aac('0x4f'),'exten':_0x43235e[_0x4aac('0xb')],'context':_0x43235e['context'],'priority':_[_0x4aac('0x4a')](_0x5cfcdd)[_0x4aac('0x48')]+0x1,'VoiceExtensionId':_0x43235e['id']});return _0x5cfcdd;});}}});}; \ No newline at end of file +var _0xfc18=['findAll','interval','then','length','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','playback','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress',',${EXTEN},','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','lodash','./voiceExtension.attributes','exports','models','type','Set','exten','inbound','push','context','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','options','url','split','name','trunk','param','phone','prefix','${EXTEN:','SIP','indexOf','U(xcally-mixmonitor-context)','join','isEmpty','Interval'];(function(_0x187399,_0x40c56d){var _0x40fa92=function(_0x36058c){while(--_0x36058c){_0x187399['push'](_0x187399['shift']());}};_0x40fa92(++_0x40c56d);}(_0xfc18,0xc5));var _0x8fc1=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0xfc18[_0x5e6ea3];return _0x4048b5;};'use strict';var _=require(_0x8fc1('0x0'));var attributes=require(_0x8fc1('0x1'));module[_0x8fc1('0x2')]=function(_0x105b33){var _0x4496e7=_0x105b33[_0x8fc1('0x3')];function _0x56ee8d(_0x3cda0d){var _0x19c5a8=0x2;var _0x29bf0b=[{'type':_0x3cda0d[_0x8fc1('0x4')],'app':_0x8fc1('0x5'),'appdata':'CDR(type)='+_0x3cda0d[_0x8fc1('0x4')],'context':_0x3cda0d['context'],'exten':_0x3cda0d[_0x8fc1('0x6')],'priority':_0x19c5a8++,'VoiceExtensionId':_0x3cda0d['id']}];if(_0x3cda0d[_0x8fc1('0x4')]===_0x8fc1('0x7')){_0x29bf0b[_0x8fc1('0x8')]({'type':_0x8fc1('0x7'),'app':_0x8fc1('0x5'),'appdata':'CDR(routeid)='+_0x3cda0d['id'],'context':_0x3cda0d[_0x8fc1('0x9')],'exten':_0x3cda0d[_0x8fc1('0x6')],'priority':_0x19c5a8++,'VoiceExtensionId':_0x3cda0d['id']});}_0x29bf0b[_0x8fc1('0x8')]({'type':_0x3cda0d['type'],'app':_0x8fc1('0x5'),'appdata':_0x8fc1('0xa'),'context':_0x3cda0d['context'],'exten':_0x3cda0d[_0x8fc1('0x6')],'priority':_0x19c5a8++,'VoiceExtensionId':_0x3cda0d['id']},{'type':_0x3cda0d[_0x8fc1('0x4')],'app':'Set','appdata':_0x8fc1('0xb'),'context':_0x3cda0d['context'],'exten':_0x3cda0d[_0x8fc1('0x6')],'priority':_0x19c5a8++,'VoiceExtensionId':_0x3cda0d['id']},{'type':_0x3cda0d['type'],'app':_0x8fc1('0x5'),'appdata':_0x8fc1('0xc'),'context':_0x3cda0d['context'],'exten':_0x3cda0d['exten'],'priority':_0x19c5a8++,'VoiceExtensionId':_0x3cda0d['id']});return _0x29bf0b;}function _0x10aada(_0x28253d){var _0x1df5e3=0x2;var _0x3a761=[{'type':'outbound','app':_0x8fc1('0x5'),'appdata':_0x8fc1('0xd'),'context':_0x28253d[_0x8fc1('0x9')],'exten':_0x28253d[_0x8fc1('0x6')],'priority':_0x1df5e3++,'VoiceExtensionId':_0x28253d['id']},{'type':_0x8fc1('0xe'),'app':_0x8fc1('0x5'),'appdata':_0x8fc1('0xf')+(_0x28253d[_0x8fc1('0x10')]?'${EXTEN:'+_0x28253d[_0x8fc1('0x10')]+'}':_0x8fc1('0x11')),'context':_0x28253d[_0x8fc1('0x9')],'exten':_0x28253d['exten'],'priority':_0x1df5e3++,'VoiceExtensionId':_0x28253d['id']},{'type':'outbound','app':_0x8fc1('0x5'),'appdata':_0x8fc1('0x12')+_0x28253d['id'],'context':_0x28253d[_0x8fc1('0x9')],'exten':_0x28253d[_0x8fc1('0x6')],'priority':_0x1df5e3++,'VoiceExtensionId':_0x28253d['id']},{'type':_0x8fc1('0xe'),'app':_0x8fc1('0x13'),'appdata':_0x8fc1('0x14')+(_0x1df5e3+0x2)+_0x8fc1('0x15')+(_0x1df5e3+0x1)+')','context':_0x28253d[_0x8fc1('0x9')],'exten':_0x28253d[_0x8fc1('0x6')],'priority':_0x1df5e3++,'VoiceExtensionId':_0x28253d['id']},{'type':_0x8fc1('0xe'),'app':_0x8fc1('0x5'),'appdata':_0x28253d[_0x8fc1('0x10')]?_0x8fc1('0x16')+_0x28253d[_0x8fc1('0x10')]+'}':_0x8fc1('0x17'),'context':_0x28253d['context'],'exten':_0x28253d[_0x8fc1('0x6')],'priority':_0x1df5e3++,'VoiceExtensionId':_0x28253d['id']},{'type':'outbound','app':_0x8fc1('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x28253d[_0x8fc1('0x9')],'exten':_0x28253d[_0x8fc1('0x6')],'priority':_0x1df5e3++,'VoiceExtensionId':_0x28253d['id']},{'type':_0x8fc1('0xe'),'app':'Set','appdata':_0x8fc1('0xb'),'context':_0x28253d[_0x8fc1('0x9')],'exten':_0x28253d[_0x8fc1('0x6')],'priority':_0x1df5e3++,'VoiceExtensionId':_0x28253d['id']},{'type':'outbound','app':_0x8fc1('0x5'),'appdata':_0x8fc1('0xc'),'context':_0x28253d[_0x8fc1('0x9')],'exten':_0x28253d[_0x8fc1('0x6')],'priority':_0x1df5e3++,'VoiceExtensionId':_0x28253d['id']},{'type':_0x8fc1('0xe'),'app':'Set','appdata':_0x8fc1('0x18')+_0x28253d['id'],'context':_0x28253d['context'],'exten':_0x28253d[_0x8fc1('0x6')],'priority':_0x1df5e3++,'VoiceExtensionId':_0x28253d['id']}];if(_0x28253d[_0x8fc1('0x19')](_0x8fc1('0x1a'))&&_0x28253d[_0x8fc1('0x1a')]!==_0x8fc1('0x1b')){_0x3a761[_0x8fc1('0x8')]({'type':_0x8fc1('0xe'),'app':_0x8fc1('0x5'),'appdata':_0x8fc1('0x1c'),'context':_0x28253d[_0x8fc1('0x9')],'exten':_0x28253d[_0x8fc1('0x6')],'priority':_0x1df5e3++,'VoiceExtensionId':_0x28253d['id']},{'type':'outbound','app':'Set','appdata':_0x8fc1('0x1d')+_0x28253d['recordingFormat']||_0x8fc1('0x1e'),'context':_0x28253d[_0x8fc1('0x9')],'exten':_0x28253d[_0x8fc1('0x6')],'priority':_0x1df5e3++,'VoiceExtensionId':_0x28253d['id']});}return _0x3a761;}function _0x30c7b5(_0x2c533c,_0x2315cc){var _0x34560b=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':_0x8fc1('0x1f'),'param':0x2},{'name':_0x8fc1('0x20'),'param':0x3}];var _0xdf913e={};var _0x519f9a=_0x2315cc[_0x8fc1('0x21')](',');var _0x3041ca=[];for(var _0x2fcf1e=0x0;_0x2fcf1e<_0x34560b['length'];_0x2fcf1e++){switch(_0x34560b[_0x2fcf1e][_0x8fc1('0x22')]){case _0x8fc1('0x23'):_0xdf913e[_0x8fc1('0x23')]=_0x519f9a[_0x34560b[_0x2fcf1e][_0x8fc1('0x24')]]['split']('/')[0x1];_0xdf913e[_0x8fc1('0x25')]=_0x519f9a[_0x34560b[_0x2fcf1e]['param']][_0x8fc1('0x21')]('/')[0x2];_0xdf913e[_0x8fc1('0x26')]=_0xdf913e[_0x8fc1('0x25')]?_0xdf913e['phone']['split']('$')[0x0]:undefined;_0xdf913e[_0x8fc1('0x25')]=_0x2c533c[_0x8fc1('0x10')]?(_0xdf913e[_0x8fc1('0x26')]||'')+_0x8fc1('0x27')+_0x2c533c[_0x8fc1('0x10')]+'}':(_0xdf913e[_0x8fc1('0x26')]||'')+_0x8fc1('0x11');_0x3041ca[_0x34560b[_0x2fcf1e][_0x8fc1('0x24')]]=[_0x8fc1('0x28'),_0xdf913e[_0x8fc1('0x23')],_0xdf913e['phone']]['join']('/');break;case _0x8fc1('0x1f'):_0xdf913e[_0x8fc1('0x1f')]=_0x519f9a[_0x34560b[_0x2fcf1e][_0x8fc1('0x24')]];if(_0x2c533c[_0x8fc1('0x1a')]!==_0x8fc1('0x1b')){if(_0xdf913e[_0x8fc1('0x1f')][_0x8fc1('0x29')](_0x8fc1('0x2a'))<0x0){_0xdf913e[_0x8fc1('0x1f')]+='U(xcally-mixmonitor-context)';}}else{_0xdf913e['options']=_0xdf913e[_0x8fc1('0x1f')]['replace'](_0x8fc1('0x2a'),'');}_0x3041ca[_0x34560b[_0x2fcf1e]['param']]=_0xdf913e[_0x8fc1('0x1f')];break;default:_0x3041ca[_0x34560b[_0x2fcf1e][_0x8fc1('0x24')]]=_0x519f9a[_0x34560b[_0x2fcf1e][_0x8fc1('0x24')]];}}return _0x3041ca[_0x8fc1('0x2b')](',');}function _0x117513(_0x489886,_0x2f8ade,_0x2ffe8c){return new Promise(function(_0x17a690,_0x2b5985){var _0x5a3b58=[];if(_[_0x8fc1('0x2c')](_0x2f8ade))return _0x17a690(_0x5a3b58);_0x4496e7[_0x8fc1('0x2d')][_0x8fc1('0x2e')]({'attributes':['id',_0x8fc1('0x2f'),'IntervalId'],'raw':!![]})[_0x8fc1('0x30')](function(_0x4b6a5e){for(var _0x538c56=0x0,_0x1315b0=0x0;_0x538c56<_0x2f8ade[_0x8fc1('0x31')];_0x538c56++,_0x1315b0=0x0){var _0x411fdb=_0x2f8ade[_0x538c56];var _0x279443=[];var _0x297d74=[];delete _0x411fdb['id'];if(_0x411fdb[_0x8fc1('0x2f')]!==_0x8fc1('0x32')){_0x411fdb[_0x8fc1('0x33')]=[_0x411fdb[_0x8fc1('0x2f')]];}else{_0x411fdb[_0x8fc1('0x33')]=_0x411fdb[_0x8fc1('0x34')]?_[_0x8fc1('0x35')](_[_0x8fc1('0x36')](_0x4b6a5e,{'IntervalId':_0x411fdb[_0x8fc1('0x34')]}),'interval'):[];}_0x411fdb[_0x8fc1('0x9')]=_0x489886[_0x8fc1('0x9')];_0x411fdb[_0x8fc1('0x6')]=_0x489886[_0x8fc1('0x6')];if(_0x411fdb[_0x8fc1('0x4')])_0x411fdb[_0x8fc1('0x4')]=_0x411fdb['type'][_0x8fc1('0x37')]();if(_0x489886[_0x8fc1('0x4')]===_0x8fc1('0xe')){if(_0x411fdb[_0x8fc1('0x19')](_0x8fc1('0x38'))&&_0x411fdb[_0x8fc1('0x38')]&&_0x411fdb[_0x8fc1('0x38')]!=='--'){_0x279443[_0x8fc1('0x8')]({'type':_0x411fdb['type'][_0x8fc1('0x37')](),'app':_0x8fc1('0x5'),'appdata':_0x8fc1('0x39')+_0x411fdb[_0x8fc1('0x38')],'context':_0x489886[_0x8fc1('0x9')],'exten':_0x489886[_0x8fc1('0x6')],'priority':_0x411fdb[_0x8fc1('0x33')][_0x8fc1('0x31')]+_0x2ffe8c+_0x1315b0++,'VoiceExtensionId':_0x489886['id']});}_0x279443[_0x8fc1('0x8')]({'type':_0x411fdb[_0x8fc1('0x4')][_0x8fc1('0x37')](),'app':_0x8fc1('0x13'),'appdata':_0x8fc1('0x3a')+(_0x411fdb['callerID']?_0x8fc1('0x3b')+_0x411fdb[_0x8fc1('0x3c')]+')':_0x8fc1('0x3d')),'context':_0x489886[_0x8fc1('0x9')],'exten':_0x489886['exten'],'priority':_0x411fdb[_0x8fc1('0x33')][_0x8fc1('0x31')]+_0x2ffe8c+_0x1315b0++,'VoiceExtensionId':_0x489886['id']});}else{if(_0x411fdb['hasOwnProperty'](_0x8fc1('0x3e'))){if(['queue',_0x8fc1('0x3f')][_0x8fc1('0x40')](_0x411fdb['app'][_0x8fc1('0x37')]())&&_0x411fdb[_0x8fc1('0x41')]!==_0x8fc1('0x42')){if(_0x411fdb[_0x8fc1('0x3e')]){_0x279443['push']({'type':_0x411fdb[_0x8fc1('0x4')][_0x8fc1('0x37')](),'app':_0x8fc1('0x13'),'appdata':_0x8fc1('0x43'),'context':_0x489886['context'],'exten':_0x489886[_0x8fc1('0x6')],'priority':_0x411fdb['intervals']['length']+_0x2ffe8c+_0x1315b0++,'VoiceExtensionId':_0x489886['id']});_0x279443['push']({'type':_0x411fdb['type'][_0x8fc1('0x37')](),'app':_0x8fc1('0x5'),'appdata':_0x8fc1('0x44'),'context':_0x489886['context'],'exten':_0x489886[_0x8fc1('0x6')],'priority':_0x411fdb['intervals']['length']+_0x2ffe8c+_0x1315b0++,'VoiceExtensionId':_0x489886['id']});}else{_0x279443[_0x8fc1('0x8')]({'type':_0x411fdb[_0x8fc1('0x4')][_0x8fc1('0x37')](),'app':'ExecIf','appdata':_0x8fc1('0x45'),'context':_0x489886['context'],'exten':_0x489886[_0x8fc1('0x6')],'priority':_0x411fdb[_0x8fc1('0x33')][_0x8fc1('0x31')]+_0x2ffe8c+_0x1315b0++,'VoiceExtensionId':_0x489886['id']});_0x279443[_0x8fc1('0x8')]({'type':_0x411fdb[_0x8fc1('0x4')][_0x8fc1('0x37')](),'app':_0x8fc1('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x489886[_0x8fc1('0x9')],'exten':_0x489886[_0x8fc1('0x6')],'priority':_0x411fdb['intervals']['length']+_0x2ffe8c+_0x1315b0++,'VoiceExtensionId':_0x489886['id']});}}}}for(var _0x3ebe3d=0x0;_0x3ebe3d<_0x411fdb['intervals'][_0x8fc1('0x31')];_0x3ebe3d++){var _0x4b5764=_0x2ffe8c+_0x411fdb[_0x8fc1('0x33')]['length'];var _0x1e4531=_0x3ebe3d===_0x411fdb[_0x8fc1('0x33')][_0x8fc1('0x31')]-0x1?_0x2ffe8c+_0x279443[_0x8fc1('0x31')]+_0x297d74['length']+0x2:_0x2ffe8c+_0x3ebe3d+0x1;_0x279443['splice'](_0x3ebe3d,0x0,{'type':_0x489886[_0x8fc1('0x4')],'app':'GotoIfTime','appdata':_0x411fdb[_0x8fc1('0x33')][_0x3ebe3d]+'?'+_0x489886[_0x8fc1('0x9')]+_0x8fc1('0x46')+_0x4b5764+':'+_0x489886[_0x8fc1('0x9')]+_0x8fc1('0x46')+_0x1e4531,'exten':_0x489886[_0x8fc1('0x6')],'context':_0x489886[_0x8fc1('0x9')],'priority':_0x2ffe8c+_0x3ebe3d,'VoiceExtensionId':_0x489886['id']});}if(_0x411fdb[_0x8fc1('0x41')]==='outboundDial'){_0x411fdb[_0x8fc1('0x47')]=_0x30c7b5(_0x489886,_0x411fdb[_0x8fc1('0x47')]);}if(_0x411fdb['appType']==='agi'){_0x279443['push']({'type':_0x411fdb['type'][_0x8fc1('0x37')](),'app':_0x8fc1('0x5'),'appdata':_0x8fc1('0x48'),'context':_0x489886[_0x8fc1('0x9')],'exten':_0x489886['exten'],'priority':_0x411fdb[_0x8fc1('0x33')][_0x8fc1('0x31')]+_0x2ffe8c+_0x1315b0++,'VoiceExtensionId':_0x489886['id']});}_0x411fdb[_0x8fc1('0x49')]=_0x279443[_0x8fc1('0x31')]?_[_0x8fc1('0x4a')](_0x279443)['priority']+0x1:_0x2ffe8c;_0x5a3b58=_[_0x8fc1('0x4b')](_0x5a3b58,_0x279443,[_0x411fdb],_0x297d74);_0x2ffe8c=_[_0x8fc1('0x4a')](_0x5a3b58)['priority']+0x1;}return _0x17a690(_0x5a3b58);})[_0x8fc1('0x4c')](function(_0x467d27){_0x2b5985(_0x467d27);});});}return _0x105b33[_0x8fc1('0x4d')](_0x8fc1('0x4e'),attributes,{'tableName':_0x8fc1('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xdf5d92){var _0x11b2c8=this[_0x8fc1('0x50')]({'plain':!![]});var _0x102643=_0x11b2c8[_0x8fc1('0x4')]==='outbound'?_0x10aada(_0x11b2c8):_0x56ee8d(_0x11b2c8);return _0x117513(_0x11b2c8,_0xdf5d92,_[_0x8fc1('0x4a')](_0x102643)[_0x8fc1('0x49')]+0x1)[_0x8fc1('0x30')](function(_0x205358){var _0x125ccd=_[_0x8fc1('0x4b')](_0x102643,_0x205358);_0x125ccd[_0x8fc1('0x8')]({'type':_0x11b2c8[_0x8fc1('0x4')],'app':'Hangup','exten':_0x11b2c8[_0x8fc1('0x6')],'context':_0x11b2c8['context'],'priority':_['last'](_0x125ccd)[_0x8fc1('0x49')]+0x1,'VoiceExtensionId':_0x11b2c8['id']});return _0x125ccd;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 28cf3fa..d32df12 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 _0xe015=['http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceExtension','VoiceExtension','options','where','attributes','limit','map','include','model','debug','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x583179,_0x185cc3){var _0x44ac3d=function(_0x1f3e3f){while(--_0x1f3e3f){_0x583179['push'](_0x583179['shift']());}};_0x44ac3d(++_0x185cc3);}(_0xe015,0x13b));var _0x5e01=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xe015[_0x126558];return _0x1f6d14;};'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});config['redis']=_['defaults'](config[_0x5e01('0xa')],{'host':_0x5e01('0xb'),'port':0x18eb});var socket=require(_0x5e01('0xc'))(new Redis(config[_0x5e01('0xa')]));require(_0x5e01('0xd'))[_0x5e01('0xe')](socket);function respondWithRpcPromise(_0x5b3938,_0x1c4a44,_0x502518){return new BPromise(function(_0x3859e8,_0x5be859){return client[_0x5e01('0xf')](_0x5b3938,_0x502518)[_0x5e01('0x10')](function(_0x553a53){logger[_0x5e01('0x11')](_0x5e01('0x12'),_0x1c4a44,'request\x20sent');logger['debug'](_0x5e01('0x13'),_0x1c4a44,_0x5e01('0x14'),JSON[_0x5e01('0x15')](_0x553a53));if(_0x553a53[_0x5e01('0x16')]){if(_0x553a53[_0x5e01('0x16')][_0x5e01('0x17')]===0x1f4){logger['error'](_0x5e01('0x12'),_0x1c4a44,_0x553a53['error']['message']);return _0x5be859(_0x553a53[_0x5e01('0x16')][_0x5e01('0x18')]);}logger['error'](_0x5e01('0x12'),_0x1c4a44,_0x553a53['error'][_0x5e01('0x18')]);return _0x3859e8(_0x553a53['error'][_0x5e01('0x18')]);}else{logger['info'](_0x5e01('0x12'),_0x1c4a44,'request\x20sent');_0x3859e8(_0x553a53['result'][_0x5e01('0x18')]);}})[_0x5e01('0x19')](function(_0x4fa1c7){logger[_0x5e01('0x16')](_0x5e01('0x12'),_0x1c4a44,_0x4fa1c7);_0x5be859(_0x4fa1c7);});});}exports[_0x5e01('0x1a')]=function(_0x45e543){var _0x396cf3=this;return new Promise(function(_0x35eb4e,_0x173410){return db[_0x5e01('0x1b')]['findAll']({'raw':_0x45e543[_0x5e01('0x1c')]?_0x45e543[_0x5e01('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x45e543[_0x5e01('0x1c')]?_0x45e543[_0x5e01('0x1c')][_0x5e01('0x1d')]||null:null,'attributes':_0x45e543[_0x5e01('0x1c')]?_0x45e543[_0x5e01('0x1c')][_0x5e01('0x1e')]||null:null,'limit':_0x45e543['options']?_0x45e543[_0x5e01('0x1c')][_0x5e01('0x1f')]||null:null,'include':_0x45e543[_0x5e01('0x1c')]?_0x45e543[_0x5e01('0x1c')]['include']?_[_0x5e01('0x20')](_0x45e543[_0x5e01('0x1c')][_0x5e01('0x21')],function(_0x4f94d0){return{'model':db[_0x4f94d0[_0x5e01('0x22')]],'as':_0x4f94d0['as'],'attributes':_0x4f94d0[_0x5e01('0x1e')],'include':_0x4f94d0[_0x5e01('0x21')]?_[_0x5e01('0x20')](_0x4f94d0['include'],function(_0x4d0ebe){return{'model':db[_0x4d0ebe[_0x5e01('0x22')]],'as':_0x4d0ebe['as'],'attributes':_0x4d0ebe['attributes'],'include':_0x4d0ebe[_0x5e01('0x21')]?_[_0x5e01('0x20')](_0x4d0ebe[_0x5e01('0x21')],function(_0xc26cf8){return{'model':db[_0xc26cf8['model']],'as':_0xc26cf8['as'],'attributes':_0xc26cf8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x51a98d){logger[_0x5e01('0x11')]('GetVoiceExtension',_0x45e543);logger[_0x5e01('0x23')](_0x5e01('0x1a'),_0x45e543,JSON[_0x5e01('0x15')](_0x51a98d));_0x35eb4e(_0x51a98d);})['catch'](function(_0x393bf0){logger[_0x5e01('0x16')](_0x5e01('0x1a'),_0x393bf0[_0x5e01('0x18')],_0x45e543);_0x173410(_0x396cf3['error'](0x1f4,_0x393bf0['message']));});});}; \ No newline at end of file +var _0x8085=['catch','options','raw','where','attributes','limit','map','include','model','GetVoiceExtension','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0x8085,0x71));var _0x5808=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x8085[_0x279d37];return _0x530173;};'use strict';var _=require(_0x5808('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5808('0x1'));var rs=require(_0x5808('0x2'));var fs=require('fs');var Redis=require(_0x5808('0x3'));var db=require(_0x5808('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5808('0x5'));var config=require(_0x5808('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5808('0x7')][_0x5808('0x8')]({'port':0x232a});config[_0x5808('0x9')]=_[_0x5808('0xa')](config[_0x5808('0x9')],{'host':_0x5808('0xb'),'port':0x18eb});var socket=require(_0x5808('0xc'))(new Redis(config[_0x5808('0x9')]));require(_0x5808('0xd'))[_0x5808('0xe')](socket);function respondWithRpcPromise(_0x54ab63,_0x422c41,_0x42099d){return new BPromise(function(_0xd55e7d,_0x16d194){return client['request'](_0x54ab63,_0x42099d)['then'](function(_0x3c056e){logger[_0x5808('0xf')](_0x5808('0x10'),_0x422c41,_0x5808('0x11'));logger[_0x5808('0x12')](_0x5808('0x13'),_0x422c41,_0x5808('0x11'),JSON['stringify'](_0x3c056e));if(_0x3c056e['error']){if(_0x3c056e[_0x5808('0x14')][_0x5808('0x15')]===0x1f4){logger[_0x5808('0x14')](_0x5808('0x10'),_0x422c41,_0x3c056e[_0x5808('0x14')][_0x5808('0x16')]);return _0x16d194(_0x3c056e[_0x5808('0x14')][_0x5808('0x16')]);}logger[_0x5808('0x14')](_0x5808('0x10'),_0x422c41,_0x3c056e[_0x5808('0x14')]['message']);return _0xd55e7d(_0x3c056e[_0x5808('0x14')]['message']);}else{logger[_0x5808('0xf')](_0x5808('0x10'),_0x422c41,_0x5808('0x11'));_0xd55e7d(_0x3c056e['result'][_0x5808('0x16')]);}})[_0x5808('0x17')](function(_0x5386eb){logger['error'](_0x5808('0x10'),_0x422c41,_0x5386eb);_0x16d194(_0x5386eb);});});}exports['GetVoiceExtension']=function(_0x40cfbd){var _0x3c0937=this;return new Promise(function(_0x480165,_0xaac16a){return db['VoiceExtension']['findAll']({'raw':_0x40cfbd[_0x5808('0x18')]?_0x40cfbd[_0x5808('0x18')][_0x5808('0x19')]===undefined?!![]:![]:!![],'where':_0x40cfbd[_0x5808('0x18')]?_0x40cfbd[_0x5808('0x18')][_0x5808('0x1a')]||null:null,'attributes':_0x40cfbd[_0x5808('0x18')]?_0x40cfbd[_0x5808('0x18')][_0x5808('0x1b')]||null:null,'limit':_0x40cfbd['options']?_0x40cfbd['options'][_0x5808('0x1c')]||null:null,'include':_0x40cfbd[_0x5808('0x18')]?_0x40cfbd['options']['include']?_[_0x5808('0x1d')](_0x40cfbd[_0x5808('0x18')][_0x5808('0x1e')],function(_0x4a4d05){return{'model':db[_0x4a4d05['model']],'as':_0x4a4d05['as'],'attributes':_0x4a4d05[_0x5808('0x1b')],'include':_0x4a4d05[_0x5808('0x1e')]?_[_0x5808('0x1d')](_0x4a4d05[_0x5808('0x1e')],function(_0x1da724){return{'model':db[_0x1da724['model']],'as':_0x1da724['as'],'attributes':_0x1da724[_0x5808('0x1b')],'include':_0x1da724[_0x5808('0x1e')]?_[_0x5808('0x1d')](_0x1da724[_0x5808('0x1e')],function(_0x28c1eb){return{'model':db[_0x28c1eb[_0x5808('0x1f')]],'as':_0x28c1eb['as'],'attributes':_0x28c1eb[_0x5808('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x560e83){logger[_0x5808('0xf')](_0x5808('0x20'),_0x40cfbd);logger[_0x5808('0x12')]('GetVoiceExtension',_0x40cfbd,JSON[_0x5808('0x21')](_0x560e83));_0x480165(_0x560e83);})[_0x5808('0x17')](function(_0x269810){logger[_0x5808('0x14')](_0x5808('0x20'),_0x269810[_0x5808('0x16')],_0x40cfbd);_0xaac16a(_0x3c0937['error'](0x1f4,_0x269810[_0x5808('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 65870c3..162a2ee 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 _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x516a5a,_0x41a6de){var _0x1c65b9=function(_0x203e46){while(--_0x203e46){_0x516a5a['push'](_0x516a5a['shift']());}};_0x1c65b9(++_0x41a6de);}(_0x53ec,0x192));var _0xc53e=function(_0x45a85e,_0x292dd7){_0x45a85e=_0x45a85e-0x0;var _0x4c85b7=_0x53ec[_0x45a85e];return _0x4c85b7;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x8a7e93,_0x174d2c){var _0x267c94=function(_0x274f69){while(--_0x274f69){_0x8a7e93['push'](_0x8a7e93['shift']());}};_0x267c94(++_0x174d2c);}(_0x7a54,0x106));var _0x47a5=function(_0x53ddd6,_0x4090fc){_0x53ddd6=_0x53ddd6-0x0;var _0x18ae4b=_0x7a54[_0x53ddd6];return _0x18ae4b;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 1962bfa..8641228 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 _0x01d9=['../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated','show','/:id/messages','getMessages','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x167a92,_0x4c4338){var _0x18fbd2=function(_0x36bbd9){while(--_0x36bbd9){_0x167a92['push'](_0x167a92['shift']());}};_0x18fbd2(++_0x4c4338);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require(_0x901d('0x2'));var timeout=require(_0x901d('0x3'));var express=require('express');var router=express[_0x901d('0x4')]();var fs_extra=require(_0x901d('0x5'));var auth=require(_0x901d('0x6'));var interaction=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var controller=require(_0x901d('0x9'));router[_0x901d('0xa')]('/',auth['isAuthenticated'](),controller[_0x901d('0xb')]);router[_0x901d('0xa')](_0x901d('0xc'),auth[_0x901d('0xd')](),controller[_0x901d('0xe')]);router[_0x901d('0xa')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x10')]);router[_0x901d('0x11')]('/',auth[_0x901d('0xd')](),controller[_0x901d('0x12')]);router[_0x901d('0x13')]('/:id',auth[_0x901d('0xd')](),controller['update']);router[_0x901d('0x14')](_0x901d('0xc'),auth[_0x901d('0xd')](),controller[_0x901d('0x15')]);module[_0x901d('0x16')]=router; \ No newline at end of file +var _0x6050=['/:id/messages','isAuthenticated','getMessages','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','show','get'];(function(_0x5299eb,_0x183697){var _0x25309c=function(_0x52989b){while(--_0x52989b){_0x5299eb['push'](_0x5299eb['shift']());}};_0x25309c(++_0x183697);}(_0x6050,0x196));var _0x0605=function(_0x4d97ae,_0x197c00){_0x4d97ae=_0x4d97ae-0x0;var _0x4bf311=_0x6050[_0x4d97ae];return _0x4bf311;};'use strict';var multer=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var path=require(_0x0605('0x2'));var timeout=require(_0x0605('0x3'));var express=require(_0x0605('0x4'));var router=express[_0x0605('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0605('0x6'));var interaction=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var controller=require('./voiceMail.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0605('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0605('0xa')]);router[_0x0605('0xb')](_0x0605('0xc'),auth[_0x0605('0xd')](),controller[_0x0605('0xe')]);router['post']('/',auth[_0x0605('0xd')](),controller[_0x0605('0xf')]);router[_0x0605('0x10')](_0x0605('0x11'),auth[_0x0605('0xd')](),controller[_0x0605('0x12')]);router[_0x0605('0x13')](_0x0605('0x11'),auth[_0x0605('0xd')](),controller[_0x0605('0x14')]);module[_0x0605('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index b7d7cc6..54cf12e 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 _0x6335=['STRING','from-voicemail','contest_mailbox','email','string','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6335,0x1b8));var _0x5633=function(_0x388c04,_0x4288f8){_0x388c04=_0x388c04-0x0;var _0x3cb532=_0x6335[_0x388c04];return _0x3cb532;};'use strict';var Sequelize=require(_0x5633('0x0'));module[_0x5633('0x1')]={'customer_id':{'type':Sequelize[_0x5633('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x5633('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x5633('0x4')},'password':{'type':Sequelize[_0x5633('0x2')]},'fullname':{'type':Sequelize[_0x5633('0x2')]},'email':{'type':Sequelize[_0x5633('0x2')],'validate':{'isEmail':!![]},'set':function(_0x353001){this['setDataValue'](_0x5633('0x5'),typeof _0x353001===_0x5633('0x6')&&_0x353001[_0x5633('0x7')]()?_0x353001[_0x5633('0x7')]():null);}},'pager':{'type':Sequelize[_0x5633('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x5633('0x8')},'attach':{'type':Sequelize[_0x5633('0x9')](_0x5633('0xa'),'no'),'defaultValue':_0x5633('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x5633('0x9')](_0x5633('0xa'),'no'),'defaultValue':_0x5633('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x5633('0x2')]},'callback':{'type':Sequelize[_0x5633('0x2')]},'review':{'type':Sequelize['ENUM'](_0x5633('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x5633('0x9')](_0x5633('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x5633('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x5633('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x5633('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x5633('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x5633('0x9')](_0x5633('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x5633('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x5633('0x9')](_0x5633('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x5633('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x5633('0x9')]('yes','no'),'defaultValue':_0x5633('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x5633('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x5633('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x5633('0xd')],'get':function(){return this[_0x5633('0xe')](_0x5633('0xf'))+'\x20-\x20'+this[_0x5633('0xe')](_0x5633('0x10'));}}}; \ No newline at end of file +var _0xbd98=['fullname','\x20-\x20','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbd98,0x182));var _0x8bd9=function(_0x5ad3a6,_0x59572c){_0x5ad3a6=_0x5ad3a6-0x0;var _0x1056b8=_0xbd98[_0x5ad3a6];return _0x1056b8;};'use strict';var Sequelize=require(_0x8bd9('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x8bd9('0x1')]},'context':{'type':Sequelize[_0x8bd9('0x1')],'defaultValue':_0x8bd9('0x2'),'unique':_0x8bd9('0x3')},'mailbox':{'type':Sequelize[_0x8bd9('0x1')],'defaultValue':'','allowNull':![],'unique':_0x8bd9('0x3')},'password':{'type':Sequelize[_0x8bd9('0x1')]},'fullname':{'type':Sequelize[_0x8bd9('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x16c04b){this[_0x8bd9('0x4')](_0x8bd9('0x5'),typeof _0x16c04b==='string'&&_0x16c04b[_0x8bd9('0x6')]()?_0x16c04b[_0x8bd9('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x8bd9('0x1')],'defaultValue':_0x8bd9('0x7')},'attach':{'type':Sequelize[_0x8bd9('0x8')](_0x8bd9('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x8bd9('0x8')](_0x8bd9('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x8bd9('0x1')]},'callback':{'type':Sequelize[_0x8bd9('0x1')]},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8bd9('0x8')](_0x8bd9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x8bd9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8bd9('0x8')](_0x8bd9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8bd9('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8bd9('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8bd9('0x8')](_0x8bd9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8bd9('0x8')](_0x8bd9('0x9'),'no'),'defaultValue':_0x8bd9('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8bd9('0x8')](_0x8bd9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8bd9('0x8')](_0x8bd9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x8bd9('0x8')](_0x8bd9('0x9'),'no'),'defaultValue':_0x8bd9('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x8bd9('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8bd9('0xc')],'get':function(){return this[_0x8bd9('0xd')](_0x8bd9('0xe'))+_0x8bd9('0xf')+this[_0x8bd9('0xd')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index f48f22d..f4fc398 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 _0x39cb=['filter','merge','options','VoiceMail','includeAll','include','findAll','rows','params','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','then','Voicemails','UserProfileResource','destroy','end','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x39cb,0x1bd));var _0xb39c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x39cb[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb39c('0x0'));var zipdir=require(_0xb39c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb39c('0x2'));var moment=require(_0xb39c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb39c('0x4'));var util=require(_0xb39c('0x5'));var path=require(_0xb39c('0x6'));var sox=require(_0xb39c('0x7'));var csv=require(_0xb39c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb39c('0x9'));var _=require(_0xb39c('0xa'));var squel=require(_0xb39c('0xb'));var crypto=require(_0xb39c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb39c('0x8'));var querystring=require(_0xb39c('0xd'));var Papa=require(_0xb39c('0xe'));var Redis=require(_0xb39c('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb39c('0x10'));var logger=require(_0xb39c('0x11'))(_0xb39c('0x12'));var utils=require(_0xb39c('0x13'));var config=require(_0xb39c('0x14'));var licenseUtil=require(_0xb39c('0x15'));var db=require(_0xb39c('0x16'))['db'];function respondWithStatusCode(_0x18d12e,_0x51ff24){_0x51ff24=_0x51ff24||0xcc;return function(_0x31e07e){if(_0x31e07e){return _0x18d12e[_0xb39c('0x17')](_0x51ff24);}return _0x18d12e[_0xb39c('0x18')](_0x51ff24)['end']();};}function respondWithResult(_0xf4662a,_0x40a6d3){_0x40a6d3=_0x40a6d3||0xc8;return function(_0x42a203){if(_0x42a203){return _0xf4662a[_0xb39c('0x18')](_0x40a6d3)[_0xb39c('0x19')](_0x42a203);}};}function respondWithFilteredResult(_0x27c22a,_0x8e9181){return function(_0x5277ce){if(_0x5277ce){var _0x316c9b=typeof _0x8e9181[_0xb39c('0x1a')]===_0xb39c('0x1b')&&typeof _0x8e9181[_0xb39c('0x1c')]===_0xb39c('0x1b');var _0x3b7fad=_0x5277ce[_0xb39c('0x1d')];var _0x4e02cf=_0x316c9b?0x0:_0x8e9181[_0xb39c('0x1a')];var _0x2eeae6=_0x316c9b?_0x5277ce['count']:_0x8e9181[_0xb39c('0x1a')]+_0x8e9181[_0xb39c('0x1c')];var _0x28bbe1;if(_0x2eeae6>=_0x3b7fad){_0x2eeae6=_0x3b7fad;_0x28bbe1=0xc8;}else{_0x28bbe1=0xce;}_0x27c22a[_0xb39c('0x18')](_0x28bbe1);return _0x27c22a['set'](_0xb39c('0x1e'),_0x4e02cf+'-'+_0x2eeae6+'/'+_0x3b7fad)[_0xb39c('0x19')](_0x5277ce);}return null;};}function patchUpdates(_0x5e4a0b){return function(_0x2d8e93){try{jsonpatch[_0xb39c('0x1f')](_0x2d8e93,_0x5e4a0b,!![]);}catch(_0x1d3e2d){return BPromise['reject'](_0x1d3e2d);}return _0x2d8e93['save']();};}function saveUpdates(_0x2789fd,_0x1a5b9d){return function(_0x3c8dfd){if(_0x3c8dfd){return _0x3c8dfd['update'](_0x2789fd)[_0xb39c('0x20')](function(_0x438207){return _0x438207;});}return null;};}function removeEntity(_0x1bb895,_0x16f3b0){return function(_0x3b03ed){if(_0x3b03ed){return _0x3b03ed['destroy']()[_0xb39c('0x20')](function(){var _0xbeab7e=_0x3b03ed['get']({'plain':!![]});var _0x1fd145=_0xb39c('0x21');return db[_0xb39c('0x22')][_0xb39c('0x23')]({'where':{'type':_0x1fd145,'resourceId':_0xbeab7e['id']}})[_0xb39c('0x20')](function(){return _0x3b03ed;});})['then'](function(){_0x1bb895[_0xb39c('0x18')](0xcc)[_0xb39c('0x24')]();});}};}function handleEntityNotFound(_0x132769,_0x4c06fa){return function(_0x41fff2){if(!_0x41fff2){_0x132769[_0xb39c('0x17')](0x194);}return _0x41fff2;};}function handleError(_0x52eb5e,_0x3d08e1){_0x3d08e1=_0x3d08e1||0x1f4;return function(_0x4b4458){logger[_0xb39c('0x25')](_0x4b4458['stack']);if(_0x4b4458[_0xb39c('0x26')]){delete _0x4b4458[_0xb39c('0x26')];}_0x52eb5e['status'](_0x3d08e1)[_0xb39c('0x27')](_0x4b4458);};}exports['index']=function(_0x8e2d7,_0x2d2743){var _0x309697={},_0x7339b4={},_0x17eb7b={'count':0x0,'rows':[]};var _0x52e642=_[_0xb39c('0x28')](db['VoiceMail'][_0xb39c('0x29')],function(_0x48a888){return{'name':_0x48a888[_0xb39c('0x2a')],'type':_0x48a888[_0xb39c('0x2b')][_0xb39c('0x2c')]};});_0x7339b4[_0xb39c('0x2d')]=_['map'](_0x52e642,'name');_0x7339b4[_0xb39c('0x2e')]=_[_0xb39c('0x2f')](_0x8e2d7['query']);_0x7339b4[_0xb39c('0x30')]=_[_0xb39c('0x31')](_0x7339b4[_0xb39c('0x2d')],_0x7339b4[_0xb39c('0x2e')]);_0x309697[_0xb39c('0x32')]=_[_0xb39c('0x31')](_0x7339b4[_0xb39c('0x2d')],qs[_0xb39c('0x33')](_0x8e2d7[_0xb39c('0x2e')][_0xb39c('0x33')]));_0x309697[_0xb39c('0x32')]=_0x309697[_0xb39c('0x32')][_0xb39c('0x34')]?_0x309697[_0xb39c('0x32')]:_0x7339b4[_0xb39c('0x2d')];if(!_0x8e2d7[_0xb39c('0x2e')][_0xb39c('0x35')](_0xb39c('0x36'))){_0x309697[_0xb39c('0x1c')]=qs['limit'](_0x8e2d7[_0xb39c('0x2e')][_0xb39c('0x1c')]);_0x309697['offset']=qs['offset'](_0x8e2d7['query'][_0xb39c('0x1a')]);}_0x309697[_0xb39c('0x37')]=qs[_0xb39c('0x38')](_0x8e2d7['query'][_0xb39c('0x38')]);_0x309697[_0xb39c('0x39')]=qs[_0xb39c('0x30')](_[_0xb39c('0x3a')](_0x8e2d7[_0xb39c('0x2e')],_0x7339b4['filters']),_0x52e642);if(_0x8e2d7[_0xb39c('0x2e')][_0xb39c('0x3b')]){_0x309697['where']=_[_0xb39c('0x3c')](_0x309697['where'],{'$or':_[_0xb39c('0x28')](_0x52e642,function(_0xc6e494){if(_0xc6e494[_0xb39c('0x2b')]!=='VIRTUAL'){var _0x406fc6={};_0x406fc6[_0xc6e494[_0xb39c('0x26')]]={'$like':'%'+_0x8e2d7[_0xb39c('0x2e')][_0xb39c('0x3b')]+'%'};return _0x406fc6;}})});}_0x309697=_[_0xb39c('0x3c')]({},_0x309697,_0x8e2d7[_0xb39c('0x3d')]);var _0x17ed52={'where':_0x309697[_0xb39c('0x39')]};return db[_0xb39c('0x3e')][_0xb39c('0x1d')](_0x17ed52)[_0xb39c('0x20')](function(_0xd1136f){_0x17eb7b['count']=_0xd1136f;if(_0x8e2d7[_0xb39c('0x2e')][_0xb39c('0x3f')]){_0x309697[_0xb39c('0x40')]=[{'all':!![]}];}return db[_0xb39c('0x3e')][_0xb39c('0x41')](_0x309697);})[_0xb39c('0x20')](function(_0x1db549){_0x17eb7b[_0xb39c('0x42')]=_0x1db549;return _0x17eb7b;})[_0xb39c('0x20')](respondWithFilteredResult(_0x2d2743,_0x309697))['catch'](handleError(_0x2d2743,null));};exports['show']=function(_0x2f88c9,_0x36d948){var _0x496da9={'raw':!![],'where':{'id':_0x2f88c9[_0xb39c('0x43')]['id']}},_0x4bc2be={};_0x4bc2be['model']=_[_0xb39c('0x2f')](db[_0xb39c('0x3e')][_0xb39c('0x29')]);_0x4bc2be[_0xb39c('0x2e')]=_[_0xb39c('0x2f')](_0x2f88c9['query']);_0x4bc2be[_0xb39c('0x30')]=_[_0xb39c('0x31')](_0x4bc2be['model'],_0x4bc2be['query']);_0x496da9[_0xb39c('0x32')]=_['intersection'](_0x4bc2be['model'],qs[_0xb39c('0x33')](_0x2f88c9[_0xb39c('0x2e')][_0xb39c('0x33')]));_0x496da9[_0xb39c('0x32')]=_0x496da9[_0xb39c('0x32')][_0xb39c('0x34')]?_0x496da9[_0xb39c('0x32')]:_0x4bc2be[_0xb39c('0x2d')];if(_0x2f88c9[_0xb39c('0x2e')][_0xb39c('0x3f')]){_0x496da9['include']=[{'all':!![]}];}_0x496da9=_[_0xb39c('0x3c')]({},_0x496da9,_0x2f88c9[_0xb39c('0x3d')]);return db[_0xb39c('0x3e')][_0xb39c('0x44')](_0x496da9)[_0xb39c('0x20')](handleEntityNotFound(_0x36d948,null))[_0xb39c('0x20')](respondWithResult(_0x36d948,null))[_0xb39c('0x45')](handleError(_0x36d948,null));};exports[_0xb39c('0x46')]=function(_0x38bc36,_0x1ae2cb){return db[_0xb39c('0x3e')][_0xb39c('0x46')](_0x38bc36[_0xb39c('0x47')],{})[_0xb39c('0x20')](function(_0x17ad13){var _0x44b825=_0x38bc36['user'][_0xb39c('0x48')]({'plain':!![]});if(!_0x44b825)throw new Error(_0xb39c('0x49'));if(_0x44b825[_0xb39c('0x4a')]===_0xb39c('0x4b')){var _0xa50077=_0x17ad13[_0xb39c('0x48')]({'plain':!![]});var _0xd4f368=_0xb39c('0x21');return db['UserProfileSection']['find']({'where':{'name':_0xd4f368,'userProfileId':_0x44b825[_0xb39c('0x4c')]},'raw':!![]})[_0xb39c('0x20')](function(_0x5a7e75){if(_0x5a7e75&&_0x5a7e75['autoAssociation']===0x0){return db[_0xb39c('0x22')][_0xb39c('0x46')]({'name':_0xa50077['name'],'resourceId':_0xa50077['id'],'type':_0x5a7e75[_0xb39c('0x26')],'sectionId':_0x5a7e75['id']},{})['then'](function(){return _0x17ad13;});}else{return _0x17ad13;}})['catch'](function(_0x2d88dd){logger['error'](_0xb39c('0x4d'),_0x2d88dd);throw _0x2d88dd;});}return _0x17ad13;})[_0xb39c('0x20')](respondWithResult(_0x1ae2cb,0xc9))[_0xb39c('0x45')](handleError(_0x1ae2cb,null));};exports[_0xb39c('0x4e')]=function(_0x2f2944,_0x97f170){if(_0x2f2944['body']['id']){delete _0x2f2944[_0xb39c('0x47')]['id'];}return db[_0xb39c('0x3e')][_0xb39c('0x44')]({'where':{'id':_0x2f2944[_0xb39c('0x43')]['id']}})[_0xb39c('0x20')](handleEntityNotFound(_0x97f170,null))['then'](saveUpdates(_0x2f2944[_0xb39c('0x47')],null))['then'](respondWithResult(_0x97f170,null))[_0xb39c('0x45')](handleError(_0x97f170,null));};exports[_0xb39c('0x23')]=function(_0x131cb2,_0x9e4e89){return db[_0xb39c('0x3e')][_0xb39c('0x44')]({'where':{'id':_0x131cb2[_0xb39c('0x43')]['id']}})[_0xb39c('0x20')](handleEntityNotFound(_0x9e4e89,null))[_0xb39c('0x20')](removeEntity(_0x9e4e89,null))[_0xb39c('0x45')](handleError(_0x9e4e89,null));};exports[_0xb39c('0x4f')]=function(_0x260fbf,_0x2620ee,_0x33c0c6){return db[_0xb39c('0x3e')][_0xb39c('0x50')]({'where':{'id':_0x260fbf[_0xb39c('0x43')]['id']}})[_0xb39c('0x20')](handleEntityNotFound(_0x2620ee,null))[_0xb39c('0x20')](function(_0x49f118){var _0x57f2f4;var _0x1e9893={},_0x15534c={};_0x15534c['model']=_[_0xb39c('0x2f')](db[_0xb39c('0x51')]['rawAttributes']);_0x15534c[_0xb39c('0x2e')]=_[_0xb39c('0x2f')](_0x260fbf[_0xb39c('0x2e')]);_0x15534c[_0xb39c('0x30')]=_[_0xb39c('0x31')](_0x15534c[_0xb39c('0x2d')],_0x15534c['query']);_0x1e9893[_0xb39c('0x32')]=_[_0xb39c('0x31')](_0x15534c[_0xb39c('0x2d')],qs[_0xb39c('0x33')](_0x260fbf[_0xb39c('0x2e')][_0xb39c('0x33')]));_0x1e9893[_0xb39c('0x32')]=_0x1e9893['attributes'][_0xb39c('0x34')]?_0x1e9893[_0xb39c('0x32')]:_0x15534c[_0xb39c('0x2d')];if(!_0x260fbf[_0xb39c('0x2e')][_0xb39c('0x35')]('nolimit')){_0x1e9893['limit']=qs[_0xb39c('0x1c')](_0x260fbf[_0xb39c('0x2e')][_0xb39c('0x1c')]);_0x1e9893['offset']=qs[_0xb39c('0x1a')](_0x260fbf['query'][_0xb39c('0x1a')]);}_0x1e9893['order']=qs[_0xb39c('0x38')](_0x260fbf[_0xb39c('0x2e')][_0xb39c('0x38')]);_0x1e9893['where']=qs[_0xb39c('0x30')](_[_0xb39c('0x3a')](_0x260fbf[_0xb39c('0x2e')],_0x15534c[_0xb39c('0x30')]));if(_0x260fbf[_0xb39c('0x2e')][_0xb39c('0x3b')]){_0x1e9893[_0xb39c('0x39')]=_[_0xb39c('0x3c')](_0x1e9893[_0xb39c('0x39')],{'$or':_[_0xb39c('0x28')](_0x1e9893[_0xb39c('0x32')],function(_0x227152){var _0x3fb267={};_0x3fb267[_0x227152]={'$like':'%'+_0x260fbf[_0xb39c('0x2e')][_0xb39c('0x3b')]+'%'};return _0x3fb267;})});}_0x1e9893[_0xb39c('0x39')]=_[_0xb39c('0x3c')](_0x1e9893['where'],{'mailboxuser':_0x49f118[_0xb39c('0x52')]});_0x1e9893=_[_0xb39c('0x3c')]({},_0x1e9893,_0x260fbf[_0xb39c('0x3d')]);return db['VoiceMailMessage'][_0xb39c('0x53')](_0x1e9893)['then'](respondWithFilteredResult(_0x2620ee,_0x1e9893));})['catch'](handleError(_0x2620ee,null));}; \ No newline at end of file +var _0xac4a=['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','end','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','VoiceMail','include','findAll','rows','catch','includeAll','create','body','user','get','Voicemails','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce'];(function(_0x5571eb,_0x4ccd4e){var _0x427d55=function(_0x2cb267){while(--_0x2cb267){_0x5571eb['push'](_0x5571eb['shift']());}};_0x427d55(++_0x4ccd4e);}(_0xac4a,0x13f));var _0xaac4=function(_0x9ba322,_0x4b9110){_0x9ba322=_0x9ba322-0x0;var _0x2f61aa=_0xac4a[_0x9ba322];return _0x2f61aa;};'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(){var _0xb2577b=_0x4f10ec['get']({'plain':!![]});var _0x24186b='Voicemails';return db['UserProfileResource']['destroy']({'where':{'type':_0x24186b,'resourceId':_0xb2577b['id']}})['then'](function(){return _0x4f10ec;});})[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)[_0xaac4('0x24')]();});}};}function handleEntityNotFound(_0xe93120,_0x3c1445){return function(_0x249a5d){if(!_0x249a5d){_0xe93120[_0xaac4('0x15')](0x194);}return _0x249a5d;};}function handleError(_0x2d68b6,_0x2f36ad){_0x2f36ad=_0x2f36ad||0x1f4;return function(_0x386c9b){logger['error'](_0x386c9b[_0xaac4('0x25')]);if(_0x386c9b[_0xaac4('0x26')]){delete _0x386c9b[_0xaac4('0x26')];}_0x2d68b6[_0xaac4('0x16')](_0x2f36ad)[_0xaac4('0x27')](_0x386c9b);};}exports[_0xaac4('0x28')]=function(_0x5e469a,_0xcf6c1){var _0x5d2c9a={},_0x2df7e3={},_0xab5d04={'count':0x0,'rows':[]};var _0x182343=_[_0xaac4('0x29')](db['VoiceMail']['rawAttributes'],function(_0x58f748){return{'name':_0x58f748[_0xaac4('0x2a')],'type':_0x58f748[_0xaac4('0x2b')][_0xaac4('0x2c')]};});_0x2df7e3[_0xaac4('0x2d')]=_[_0xaac4('0x29')](_0x182343,_0xaac4('0x26'));_0x2df7e3[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x5e469a[_0xaac4('0x2e')]);_0x2df7e3[_0xaac4('0x30')]=_[_0xaac4('0x31')](_0x2df7e3[_0xaac4('0x2d')],_0x2df7e3[_0xaac4('0x2e')]);_0x5d2c9a[_0xaac4('0x32')]=_[_0xaac4('0x31')](_0x2df7e3['model'],qs['fields'](_0x5e469a[_0xaac4('0x2e')][_0xaac4('0x33')]));_0x5d2c9a[_0xaac4('0x32')]=_0x5d2c9a['attributes'][_0xaac4('0x34')]?_0x5d2c9a[_0xaac4('0x32')]:_0x2df7e3[_0xaac4('0x2d')];if(!_0x5e469a[_0xaac4('0x2e')][_0xaac4('0x35')](_0xaac4('0x36'))){_0x5d2c9a[_0xaac4('0x1a')]=qs['limit'](_0x5e469a[_0xaac4('0x2e')][_0xaac4('0x1a')]);_0x5d2c9a[_0xaac4('0x18')]=qs['offset'](_0x5e469a[_0xaac4('0x2e')]['offset']);}_0x5d2c9a['order']=qs[_0xaac4('0x37')](_0x5e469a[_0xaac4('0x2e')][_0xaac4('0x37')]);_0x5d2c9a['where']=qs['filters'](_[_0xaac4('0x38')](_0x5e469a[_0xaac4('0x2e')],_0x2df7e3[_0xaac4('0x30')]),_0x182343);if(_0x5e469a[_0xaac4('0x2e')][_0xaac4('0x39')]){_0x5d2c9a[_0xaac4('0x3a')]=_['merge'](_0x5d2c9a['where'],{'$or':_[_0xaac4('0x29')](_0x182343,function(_0x3b2b72){if(_0x3b2b72['type']!==_0xaac4('0x3b')){var _0xdea3a0={};_0xdea3a0[_0x3b2b72[_0xaac4('0x26')]]={'$like':'%'+_0x5e469a['query'][_0xaac4('0x39')]+'%'};return _0xdea3a0;}})});}_0x5d2c9a=_[_0xaac4('0x3c')]({},_0x5d2c9a,_0x5e469a[_0xaac4('0x3d')]);var _0x5bc387={'where':_0x5d2c9a[_0xaac4('0x3a')]};return db[_0xaac4('0x3e')][_0xaac4('0x1b')](_0x5bc387)[_0xaac4('0x23')](function(_0x51e59d){_0xab5d04[_0xaac4('0x1b')]=_0x51e59d;if(_0x5e469a['query']['includeAll']){_0x5d2c9a[_0xaac4('0x3f')]=[{'all':!![]}];}return db[_0xaac4('0x3e')][_0xaac4('0x40')](_0x5d2c9a);})[_0xaac4('0x23')](function(_0x43bc12){_0xab5d04[_0xaac4('0x41')]=_0x43bc12;return _0xab5d04;})[_0xaac4('0x23')](respondWithFilteredResult(_0xcf6c1,_0x5d2c9a))[_0xaac4('0x42')](handleError(_0xcf6c1,null));};exports['show']=function(_0x15191a,_0x36ac31){var _0x1fea3d={'raw':!![],'where':{'id':_0x15191a['params']['id']}},_0x2bba0c={};_0x2bba0c[_0xaac4('0x2d')]=_[_0xaac4('0x2f')](db[_0xaac4('0x3e')]['rawAttributes']);_0x2bba0c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x15191a[_0xaac4('0x2e')]);_0x2bba0c[_0xaac4('0x30')]=_['intersection'](_0x2bba0c[_0xaac4('0x2d')],_0x2bba0c[_0xaac4('0x2e')]);_0x1fea3d[_0xaac4('0x32')]=_['intersection'](_0x2bba0c[_0xaac4('0x2d')],qs[_0xaac4('0x33')](_0x15191a[_0xaac4('0x2e')][_0xaac4('0x33')]));_0x1fea3d[_0xaac4('0x32')]=_0x1fea3d[_0xaac4('0x32')][_0xaac4('0x34')]?_0x1fea3d[_0xaac4('0x32')]:_0x2bba0c[_0xaac4('0x2d')];if(_0x15191a['query'][_0xaac4('0x43')]){_0x1fea3d[_0xaac4('0x3f')]=[{'all':!![]}];}_0x1fea3d=_[_0xaac4('0x3c')]({},_0x1fea3d,_0x15191a[_0xaac4('0x3d')]);return db[_0xaac4('0x3e')]['find'](_0x1fea3d)['then'](handleEntityNotFound(_0x36ac31,null))[_0xaac4('0x23')](respondWithResult(_0x36ac31,null))[_0xaac4('0x42')](handleError(_0x36ac31,null));};exports[_0xaac4('0x44')]=function(_0x16c7f4,_0x5f33ea){return db[_0xaac4('0x3e')]['create'](_0x16c7f4[_0xaac4('0x45')],{})[_0xaac4('0x23')](function(_0x487203){var _0x282de3=_0x16c7f4[_0xaac4('0x46')][_0xaac4('0x47')]({'plain':!![]});if(!_0x282de3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x282de3['role']===_0xaac4('0x46')){var _0x2c1751=_0x487203[_0xaac4('0x47')]({'plain':!![]});var _0xb32d1d=_0xaac4('0x48');return db[_0xaac4('0x49')]['find']({'where':{'name':_0xb32d1d,'userProfileId':_0x282de3[_0xaac4('0x4a')]},'raw':!![]})[_0xaac4('0x23')](function(_0x1c9979){if(_0x1c9979&&_0x1c9979[_0xaac4('0x4b')]===0x0){return db['UserProfileResource'][_0xaac4('0x44')]({'name':_0x2c1751['name'],'resourceId':_0x2c1751['id'],'type':_0x1c9979[_0xaac4('0x26')],'sectionId':_0x1c9979['id']},{})[_0xaac4('0x23')](function(){return _0x487203;});}else{return _0x487203;}})[_0xaac4('0x42')](function(_0x3922a0){logger[_0xaac4('0x4c')](_0xaac4('0x4d'),_0x3922a0);throw _0x3922a0;});}return _0x487203;})[_0xaac4('0x23')](respondWithResult(_0x5f33ea,0xc9))[_0xaac4('0x42')](handleError(_0x5f33ea,null));};exports[_0xaac4('0x21')]=function(_0x1b9219,_0x1a637e){if(_0x1b9219[_0xaac4('0x45')]['id']){delete _0x1b9219[_0xaac4('0x45')]['id'];}return db[_0xaac4('0x3e')]['find']({'where':{'id':_0x1b9219[_0xaac4('0x4e')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x1a637e,null))[_0xaac4('0x23')](saveUpdates(_0x1b9219[_0xaac4('0x45')],null))[_0xaac4('0x23')](respondWithResult(_0x1a637e,null))[_0xaac4('0x42')](handleError(_0x1a637e,null));};exports[_0xaac4('0x22')]=function(_0x46082d,_0x5e8928){return db[_0xaac4('0x3e')]['find']({'where':{'id':_0x46082d[_0xaac4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5e8928,null))[_0xaac4('0x23')](removeEntity(_0x5e8928,null))['catch'](handleError(_0x5e8928,null));};exports['getMessages']=function(_0x19764c,_0x3a4e29,_0x48ae39){return db[_0xaac4('0x3e')][_0xaac4('0x4f')]({'where':{'id':_0x19764c[_0xaac4('0x4e')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x3a4e29,null))[_0xaac4('0x23')](function(_0x19d9c1){var _0x5d38bc;var _0x346f4c={},_0x586a10={};_0x586a10[_0xaac4('0x2d')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x586a10[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x19764c[_0xaac4('0x2e')]);_0x586a10[_0xaac4('0x30')]=_['intersection'](_0x586a10[_0xaac4('0x2d')],_0x586a10[_0xaac4('0x2e')]);_0x346f4c[_0xaac4('0x32')]=_['intersection'](_0x586a10[_0xaac4('0x2d')],qs[_0xaac4('0x33')](_0x19764c[_0xaac4('0x2e')][_0xaac4('0x33')]));_0x346f4c[_0xaac4('0x32')]=_0x346f4c[_0xaac4('0x32')][_0xaac4('0x34')]?_0x346f4c['attributes']:_0x586a10['model'];if(!_0x19764c[_0xaac4('0x2e')]['hasOwnProperty']('nolimit')){_0x346f4c[_0xaac4('0x1a')]=qs['limit'](_0x19764c[_0xaac4('0x2e')]['limit']);_0x346f4c[_0xaac4('0x18')]=qs[_0xaac4('0x18')](_0x19764c['query']['offset']);}_0x346f4c['order']=qs['sort'](_0x19764c[_0xaac4('0x2e')][_0xaac4('0x37')]);_0x346f4c[_0xaac4('0x3a')]=qs[_0xaac4('0x30')](_['pick'](_0x19764c[_0xaac4('0x2e')],_0x586a10[_0xaac4('0x30')]));if(_0x19764c[_0xaac4('0x2e')][_0xaac4('0x39')]){_0x346f4c[_0xaac4('0x3a')]=_[_0xaac4('0x3c')](_0x346f4c[_0xaac4('0x3a')],{'$or':_[_0xaac4('0x29')](_0x346f4c[_0xaac4('0x32')],function(_0x40271c){var _0x43aeee={};_0x43aeee[_0x40271c]={'$like':'%'+_0x19764c['query']['filter']+'%'};return _0x43aeee;})});}_0x346f4c[_0xaac4('0x3a')]=_['merge'](_0x346f4c['where'],{'mailboxuser':_0x19d9c1[_0xaac4('0x50')]});_0x346f4c=_['merge']({},_0x346f4c,_0x19764c[_0xaac4('0x3d')]);return db[_0xaac4('0x51')][_0xaac4('0x52')](_0x346f4c)[_0xaac4('0x23')](respondWithFilteredResult(_0x3a4e29,_0x346f4c));})['catch'](handleError(_0x3a4e29,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 1051cbb..86b3e5c 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 _0x2649=['../../config/environment','exports','define','VoiceMail','mailbox_context','mailbox','context','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1b5bc8,_0xa4b41f){var _0x2e6109=function(_0x148a0c){while(--_0x148a0c){_0x1b5bc8['push'](_0x1b5bc8['shift']());}};_0x2e6109(++_0xa4b41f);}(_0x2649,0x1e3));var _0x9264=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x2649[_0x57d13b];return _0x467696;};'use strict';var _=require(_0x9264('0x0'));var util=require('util');var logger=require(_0x9264('0x1'))('api');var moment=require(_0x9264('0x2'));var BPromise=require(_0x9264('0x3'));var rp=require(_0x9264('0x4'));var fs=require('fs');var path=require(_0x9264('0x5'));var rimraf=require(_0x9264('0x6'));var config=require(_0x9264('0x7'));var attributes=require('./voiceMail.attributes');module[_0x9264('0x8')]=function(_0x15f08a,_0x11f007){return _0x15f08a[_0x9264('0x9')](_0x9264('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x9264('0xb'),'fields':[_0x9264('0xc'),_0x9264('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e9b=['./voiceMail.attributes','VoiceMail','voice_voicemail','mailbox_context','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1071a6,_0x7812f7){var _0x1e8ad8=function(_0x39cadb){while(--_0x39cadb){_0x1071a6['push'](_0x1071a6['shift']());}};_0x1e8ad8(++_0x7812f7);}(_0x0e9b,0x1f4));var _0xb0e9=function(_0x3d3f7e,_0x17fee5){_0x3d3f7e=_0x3d3f7e-0x0;var _0x62fb3d=_0x0e9b[_0x3d3f7e];return _0x62fb3d;};'use strict';var _=require(_0xb0e9('0x0'));var util=require(_0xb0e9('0x1'));var logger=require(_0xb0e9('0x2'))(_0xb0e9('0x3'));var moment=require(_0xb0e9('0x4'));var BPromise=require(_0xb0e9('0x5'));var rp=require(_0xb0e9('0x6'));var fs=require('fs');var path=require(_0xb0e9('0x7'));var rimraf=require(_0xb0e9('0x8'));var config=require(_0xb0e9('0x9'));var attributes=require(_0xb0e9('0xa'));module['exports']=function(_0x24c359,_0x453d60){return _0x24c359['define'](_0xb0e9('0xb'),attributes,{'tableName':_0xb0e9('0xc'),'paranoid':![],'indexes':[{'name':_0xb0e9('0xd'),'fields':['mailbox',_0xb0e9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index c9be506..447a4dd 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 _0x6483=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','util','moment'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x6483,0x17a));var _0x3648=function(_0xa7c8ce,_0x2b85c5){_0xa7c8ce=_0xa7c8ce-0x0;var _0x12f2ce=_0x6483[_0xa7c8ce];return _0x12f2ce;};'use strict';var _=require('lodash');var util=require(_0x3648('0x0'));var moment=require(_0x3648('0x1'));var BPromise=require(_0x3648('0x2'));var rs=require(_0x3648('0x3'));var fs=require('fs');var Redis=require(_0x3648('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3648('0x5'));var logger=require(_0x3648('0x6'))(_0x3648('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3648('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31cab4,_0x542821,_0x5bccf9){return new BPromise(function(_0x52efdf,_0x59201c){return client[_0x3648('0x9')](_0x31cab4,_0x5bccf9)[_0x3648('0xa')](function(_0xe2ead){logger[_0x3648('0xb')](_0x3648('0xc'),_0x542821,_0x3648('0xd'));logger[_0x3648('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x542821,_0x3648('0xd'),JSON['stringify'](_0xe2ead));if(_0xe2ead['error']){if(_0xe2ead[_0x3648('0xf')][_0x3648('0x10')]===0x1f4){logger[_0x3648('0xf')](_0x3648('0xc'),_0x542821,_0xe2ead[_0x3648('0xf')][_0x3648('0x11')]);return _0x59201c(_0xe2ead['error'][_0x3648('0x11')]);}logger[_0x3648('0xf')](_0x3648('0xc'),_0x542821,_0xe2ead['error'][_0x3648('0x11')]);return _0x52efdf(_0xe2ead[_0x3648('0xf')][_0x3648('0x11')]);}else{logger[_0x3648('0xb')]('VoiceMail,\x20%s,\x20%s',_0x542821,_0x3648('0xd'));_0x52efdf(_0xe2ead['result']['message']);}})[_0x3648('0x12')](function(_0x153770){logger[_0x3648('0xf')](_0x3648('0xc'),_0x542821,_0x153770);_0x59201c(_0x153770);});});} \ No newline at end of file +var _0xc257=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x12c735,_0x5df101){var _0x336169=function(_0x563f21){while(--_0x563f21){_0x12c735['push'](_0x12c735['shift']());}};_0x336169(++_0x5df101);}(_0xc257,0x1cd));var _0x7c25=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xc257[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7c25('0x0'));var util=require(_0x7c25('0x1'));var moment=require('moment');var BPromise=require(_0x7c25('0x2'));var rs=require(_0x7c25('0x3'));var fs=require('fs');var Redis=require(_0x7c25('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7c25('0x5'))('rpc');var config=require(_0x7c25('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x244ad6,_0x10b807,_0x538c28){return new BPromise(function(_0x2dc35d,_0x5085c1){return client[_0x7c25('0x7')](_0x244ad6,_0x538c28)['then'](function(_0x4890d9){logger[_0x7c25('0x8')](_0x7c25('0x9'),_0x10b807,_0x7c25('0xa'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x10b807,_0x7c25('0xa'),JSON[_0x7c25('0xb')](_0x4890d9));if(_0x4890d9['error']){if(_0x4890d9[_0x7c25('0xc')][_0x7c25('0xd')]===0x1f4){logger[_0x7c25('0xc')]('VoiceMail,\x20%s,\x20%s',_0x10b807,_0x4890d9[_0x7c25('0xc')]['message']);return _0x5085c1(_0x4890d9[_0x7c25('0xc')][_0x7c25('0xe')]);}logger[_0x7c25('0xc')](_0x7c25('0x9'),_0x10b807,_0x4890d9[_0x7c25('0xc')][_0x7c25('0xe')]);return _0x2dc35d(_0x4890d9[_0x7c25('0xc')]['message']);}else{logger[_0x7c25('0x8')](_0x7c25('0x9'),_0x10b807,_0x7c25('0xa'));_0x2dc35d(_0x4890d9[_0x7c25('0xf')]['message']);}})[_0x7c25('0x10')](function(_0x5b614d){logger[_0x7c25('0xc')](_0x7c25('0x9'),_0x10b807,_0x5b614d);_0x5085c1(_0x5b614d);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 3bc521a..94dd6d5 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 _0x3a0b=['isAuthenticated','index','show','/:id/download','download','post','put','/:id','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get'];(function(_0x48a71f,_0x2cbd28){var _0x49a7a0=function(_0x97dd4e){while(--_0x97dd4e){_0x48a71f['push'](_0x48a71f['shift']());}};_0x49a7a0(++_0x2cbd28);}(_0x3a0b,0x6f));var _0xb3a0=function(_0x283127,_0x54d4d5){_0x283127=_0x283127-0x0;var _0x43da5d=_0x3a0b[_0x283127];return _0x43da5d;};'use strict';var multer=require(_0xb3a0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb3a0('0x1'));var express=require(_0xb3a0('0x2'));var router=express[_0xb3a0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb3a0('0x4'));var interaction=require(_0xb3a0('0x5'));var config=require(_0xb3a0('0x6'));var controller=require(_0xb3a0('0x7'));router[_0xb3a0('0x8')]('/',auth[_0xb3a0('0x9')](),controller[_0xb3a0('0xa')]);router[_0xb3a0('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb3a0('0xb')]);router[_0xb3a0('0x8')](_0xb3a0('0xc'),auth[_0xb3a0('0x9')](),controller[_0xb3a0('0xd')]);router[_0xb3a0('0xe')]('/',auth[_0xb3a0('0x9')](),controller['create']);router[_0xb3a0('0xf')](_0xb3a0('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xb3a0('0x11')]('/:id',auth[_0xb3a0('0x9')](),controller[_0xb3a0('0x12')]);module[_0xb3a0('0x13')]=router; \ No newline at end of file +var _0xa130=['create','put','/:id','update','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','show','download','post'];(function(_0x6df4f9,_0x5364f9){var _0x3ceac1=function(_0x222479){while(--_0x222479){_0x6df4f9['push'](_0x6df4f9['shift']());}};_0x3ceac1(++_0x5364f9);}(_0xa130,0x137));var _0x0a13=function(_0x30027b,_0x56b889){_0x30027b=_0x30027b-0x0;var _0x5e77f2=_0xa130[_0x30027b];return _0x5e77f2;};'use strict';var multer=require('multer');var util=require(_0x0a13('0x0'));var path=require(_0x0a13('0x1'));var timeout=require('connect-timeout');var express=require(_0x0a13('0x2'));var router=express[_0x0a13('0x3')]();var fs_extra=require(_0x0a13('0x4'));var auth=require(_0x0a13('0x5'));var interaction=require(_0x0a13('0x6'));var config=require('../../config/environment');var controller=require(_0x0a13('0x7'));router[_0x0a13('0x8')]('/',auth[_0x0a13('0x9')](),controller['index']);router[_0x0a13('0x8')]('/:id',auth[_0x0a13('0x9')](),controller[_0x0a13('0xa')]);router['get']('/:id/download',auth[_0x0a13('0x9')](),controller[_0x0a13('0xb')]);router[_0x0a13('0xc')]('/',auth['isAuthenticated'](),controller[_0x0a13('0xd')]);router[_0x0a13('0xe')](_0x0a13('0xf'),auth[_0x0a13('0x9')](),controller[_0x0a13('0x10')]);router['delete'](_0x0a13('0xf'),auth[_0x0a13('0x9')](),controller[_0x0a13('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index a8f7cbd..e400c3a 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 _0xcdf8=['exports','VIRTUAL','INTEGER','STRING','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x2de0ad,_0x2565be){var _0x1a99bd=function(_0x3bb587){while(--_0x3bb587){_0x2de0ad['push'](_0x2de0ad['shift']());}};_0x1a99bd(++_0x2565be);}(_0xcdf8,0x1c0));var _0x8cdf=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xcdf8[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require('sequelize');module[_0x8cdf('0x0')]={'name':{'type':Sequelize[_0x8cdf('0x1')],'get':function(_0x26dd85){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x8cdf('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x8cdf('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x8cdf('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x8cdf('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x8cdf('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x8cdf('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x8cdf('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x8cdf('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x8cdf('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x8cdf('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x8cdf('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x8cdf('0x3')],'defaultValue':''},'stamp':{'type':_0x8cdf('0x5'),'defaultValue':Sequelize[_0x8cdf('0x6')](_0x8cdf('0x7'))}}; \ No newline at end of file +var _0x818c=['sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x818c,0x1d4));var _0xc818=function(_0x3ef51c,_0x337e28){_0x3ef51c=_0x3ef51c-0x0;var _0x5e04bb=_0x818c[_0x3ef51c];return _0x5e04bb;};'use strict';var Sequelize=require(_0xc818('0x0'));module[_0xc818('0x1')]={'name':{'type':Sequelize[_0xc818('0x2')],'get':function(_0x2f5053){return this[_0xc818('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xc818('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xc818('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xc818('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xc818('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xc818('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xc818('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xc818('0x5')],'defaultValue':''},'stamp':{'type':_0xc818('0x7'),'defaultValue':Sequelize['literal'](_0xc818('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 3d7565c..29d0736 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 _0x56af=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','end','sendStatus','error','stack','name','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','map','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','download','recording','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x56af,0x99));var _0xf56a=function(_0x40f31d,_0x166318){_0x40f31d=_0x40f31d-0x0;var _0x10d4e4=_0x56af[_0x40f31d];return _0x10d4e4;};'use strict';var emlformat=require(_0xf56a('0x0'));var rimraf=require(_0xf56a('0x1'));var zipdir=require(_0xf56a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf56a('0x3'));var moment=require(_0xf56a('0x4'));var BPromise=require(_0xf56a('0x5'));var Mustache=require(_0xf56a('0x6'));var util=require('util');var path=require(_0xf56a('0x7'));var sox=require('sox');var csv=require(_0xf56a('0x8'));var ejs=require(_0xf56a('0x9'));var fs=require('fs');var fs_extra=require(_0xf56a('0xa'));var _=require(_0xf56a('0xb'));var squel=require(_0xf56a('0xc'));var crypto=require(_0xf56a('0xd'));var jsforce=require(_0xf56a('0xe'));var deskjs=require(_0xf56a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf56a('0x10'));var Papa=require(_0xf56a('0x11'));var Redis=require('ioredis');var authService=require(_0xf56a('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf56a('0x13'));var logger=require(_0xf56a('0x14'))('api');var utils=require(_0xf56a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf56a('0x16'));var db=require(_0xf56a('0x17'))['db'];function respondWithStatusCode(_0x3dbaa4,_0x5a59c3){_0x5a59c3=_0x5a59c3||0xcc;return function(_0x344bcc){if(_0x344bcc){return _0x3dbaa4['sendStatus'](_0x5a59c3);}return _0x3dbaa4[_0xf56a('0x18')](_0x5a59c3)['end']();};}function respondWithResult(_0x2dc892,_0x565c6f){_0x565c6f=_0x565c6f||0xc8;return function(_0x4cc3ac){if(_0x4cc3ac){return _0x2dc892[_0xf56a('0x18')](_0x565c6f)[_0xf56a('0x19')](_0x4cc3ac);}};}function respondWithFilteredResult(_0x548e46,_0x5c2bcd){return function(_0x1b1977){if(_0x1b1977){var _0x54247e=typeof _0x5c2bcd[_0xf56a('0x1a')]==='undefined'&&typeof _0x5c2bcd['limit']===_0xf56a('0x1b');var _0x26e766=_0x1b1977['count'];var _0x478ba0=_0x54247e?0x0:_0x5c2bcd[_0xf56a('0x1a')];var _0x4ded89=_0x54247e?_0x1b1977[_0xf56a('0x1c')]:_0x5c2bcd[_0xf56a('0x1a')]+_0x5c2bcd[_0xf56a('0x1d')];var _0x11e46f;if(_0x4ded89>=_0x26e766){_0x4ded89=_0x26e766;_0x11e46f=0xc8;}else{_0x11e46f=0xce;}_0x548e46[_0xf56a('0x18')](_0x11e46f);return _0x548e46[_0xf56a('0x1e')](_0xf56a('0x1f'),_0x478ba0+'-'+_0x4ded89+'/'+_0x26e766)[_0xf56a('0x19')](_0x1b1977);}return null;};}function patchUpdates(_0x4e2771){return function(_0x5210b4){try{jsonpatch[_0xf56a('0x20')](_0x5210b4,_0x4e2771,!![]);}catch(_0xb5afb2){return BPromise['reject'](_0xb5afb2);}return _0x5210b4['save']();};}function saveUpdates(_0x3f7ef7,_0x3ae032){return function(_0x93746a){if(_0x93746a){return _0x93746a[_0xf56a('0x21')](_0x3f7ef7)[_0xf56a('0x22')](function(_0x3e9b42){return _0x3e9b42;});}return null;};}function removeEntity(_0xece834,_0x2a4158){return function(_0x2e8203){if(_0x2e8203){return _0x2e8203['destroy']()[_0xf56a('0x22')](function(){_0xece834['status'](0xcc)[_0xf56a('0x23')]();});}};}function handleEntityNotFound(_0x1f0697,_0xeac200){return function(_0x8f9091){if(!_0x8f9091){_0x1f0697[_0xf56a('0x24')](0x194);}return _0x8f9091;};}function handleError(_0x176f52,_0x59214d){_0x59214d=_0x59214d||0x1f4;return function(_0x5e0c47){logger[_0xf56a('0x25')](_0x5e0c47[_0xf56a('0x26')]);if(_0x5e0c47[_0xf56a('0x27')]){delete _0x5e0c47[_0xf56a('0x27')];}_0x176f52['status'](_0x59214d)['send'](_0x5e0c47);};}exports['index']=function(_0x41c9dd,_0x40f875){var _0x1cec32={},_0x58df2c={},_0xa20fd2={'count':0x0,'rows':[]};var _0x2b6911=_['map'](db[_0xf56a('0x28')][_0xf56a('0x29')],function(_0x1f21bc){return{'name':_0x1f21bc[_0xf56a('0x2a')],'type':_0x1f21bc[_0xf56a('0x2b')]['key']};});_0x58df2c[_0xf56a('0x2c')]=_[_0xf56a('0x2d')](_[_0xf56a('0x2e')](_0x2b6911,_0xf56a('0x27')),[_0xf56a('0x27')]);_0x58df2c[_0xf56a('0x2f')]=_[_0xf56a('0x30')](_0x41c9dd['query']);_0x58df2c[_0xf56a('0x31')]=_[_0xf56a('0x32')](_0x58df2c[_0xf56a('0x2c')],_0x58df2c[_0xf56a('0x2f')]);_0x1cec32['attributes']=_[_0xf56a('0x32')](_0x58df2c[_0xf56a('0x2c')],qs[_0xf56a('0x33')](_0x41c9dd[_0xf56a('0x2f')]['fields']));_0x1cec32[_0xf56a('0x34')]=_0x1cec32[_0xf56a('0x34')][_0xf56a('0x35')]?_0x1cec32[_0xf56a('0x34')]:_0x58df2c[_0xf56a('0x2c')];if(!_0x41c9dd['query']['hasOwnProperty']('nolimit')){_0x1cec32[_0xf56a('0x1d')]=qs[_0xf56a('0x1d')](_0x41c9dd[_0xf56a('0x2f')][_0xf56a('0x1d')]);_0x1cec32[_0xf56a('0x1a')]=qs['offset'](_0x41c9dd['query'][_0xf56a('0x1a')]);}_0x1cec32[_0xf56a('0x36')]=qs[_0xf56a('0x37')](_0x41c9dd[_0xf56a('0x2f')]['sort']);_0x1cec32[_0xf56a('0x38')]=qs[_0xf56a('0x31')](_[_0xf56a('0x39')](_0x41c9dd[_0xf56a('0x2f')],_0x58df2c[_0xf56a('0x31')]),_0x2b6911);if(_0x41c9dd[_0xf56a('0x2f')][_0xf56a('0x3a')]){_0x1cec32[_0xf56a('0x38')]=_['merge'](_0x1cec32[_0xf56a('0x38')],{'$or':_['map'](_0x2b6911,function(_0x42b013){if(_0x42b013[_0xf56a('0x2b')]!==_0xf56a('0x3b')){var _0x2a5975={};_0x2a5975[_0x42b013[_0xf56a('0x27')]]={'$like':'%'+_0x41c9dd[_0xf56a('0x2f')][_0xf56a('0x3a')]+'%'};return _0x2a5975;}})});}_0x1cec32=_[_0xf56a('0x3c')]({},_0x1cec32,_0x41c9dd[_0xf56a('0x3d')]);var _0x280450={'where':_0x1cec32[_0xf56a('0x38')]};return db[_0xf56a('0x28')]['count'](_0x280450)['then'](function(_0x2706e7){_0xa20fd2[_0xf56a('0x1c')]=_0x2706e7;if(_0x41c9dd[_0xf56a('0x2f')]['includeAll']){_0x1cec32[_0xf56a('0x3e')]=[{'all':!![]}];}return db[_0xf56a('0x28')][_0xf56a('0x3f')](_0x1cec32);})[_0xf56a('0x22')](function(_0xa5acb4){_0xa20fd2[_0xf56a('0x40')]=_0xa5acb4;return _0xa20fd2;})[_0xf56a('0x22')](respondWithFilteredResult(_0x40f875,_0x1cec32))[_0xf56a('0x41')](handleError(_0x40f875,null));};exports[_0xf56a('0x42')]=function(_0x5b4a32,_0x495d7a){var _0x3ea70a={'raw':!![],'where':{'id':_0x5b4a32[_0xf56a('0x43')]['id']}},_0x2920cc={};_0x2920cc[_0xf56a('0x2c')]=_[_0xf56a('0x30')](db[_0xf56a('0x28')][_0xf56a('0x29')]);_0x2920cc[_0xf56a('0x2f')]=_[_0xf56a('0x30')](_0x5b4a32[_0xf56a('0x2f')]);_0x2920cc[_0xf56a('0x31')]=_[_0xf56a('0x32')](_0x2920cc['model'],_0x2920cc[_0xf56a('0x2f')]);_0x3ea70a[_0xf56a('0x34')]=_[_0xf56a('0x32')](_0x2920cc[_0xf56a('0x2c')],qs[_0xf56a('0x33')](_0x5b4a32[_0xf56a('0x2f')][_0xf56a('0x33')]));_0x3ea70a[_0xf56a('0x34')]=_0x3ea70a[_0xf56a('0x34')][_0xf56a('0x35')]?_0x3ea70a[_0xf56a('0x34')]:_0x2920cc[_0xf56a('0x2c')];if(_0x5b4a32[_0xf56a('0x2f')][_0xf56a('0x44')]){_0x3ea70a[_0xf56a('0x3e')]=[{'all':!![]}];}_0x3ea70a=_[_0xf56a('0x3c')]({},_0x3ea70a,_0x5b4a32[_0xf56a('0x3d')]);return db['VoiceMailMessage'][_0xf56a('0x45')](_0x3ea70a)[_0xf56a('0x22')](handleEntityNotFound(_0x495d7a,null))[_0xf56a('0x22')](respondWithResult(_0x495d7a,null))[_0xf56a('0x41')](handleError(_0x495d7a,null));};exports['create']=function(_0x2100de,_0x10ac42){return db['VoiceMailMessage'][_0xf56a('0x46')](_0x2100de[_0xf56a('0x47')],{})[_0xf56a('0x22')](respondWithResult(_0x10ac42,0xc9))[_0xf56a('0x41')](handleError(_0x10ac42,null));};exports[_0xf56a('0x21')]=function(_0x3cbc55,_0x47f32c){if(_0x3cbc55['body']['id']){delete _0x3cbc55[_0xf56a('0x47')]['id'];}return db[_0xf56a('0x28')][_0xf56a('0x45')]({'where':{'id':_0x3cbc55[_0xf56a('0x43')]['id']}})[_0xf56a('0x22')](handleEntityNotFound(_0x47f32c,null))[_0xf56a('0x22')](saveUpdates(_0x3cbc55[_0xf56a('0x47')],null))['then'](respondWithResult(_0x47f32c,null))[_0xf56a('0x41')](handleError(_0x47f32c,null));};exports[_0xf56a('0x48')]=function(_0x2f7663,_0x4d1ce0){return db[_0xf56a('0x28')][_0xf56a('0x45')]({'where':{'id':_0x2f7663[_0xf56a('0x43')]['id']}})['then'](handleEntityNotFound(_0x4d1ce0,null))[_0xf56a('0x22')](removeEntity(_0x4d1ce0,null))['catch'](handleError(_0x4d1ce0,null));};exports[_0xf56a('0x49')]=function(_0x33b320,_0x4d16ad,_0xbf3f8){return db[_0xf56a('0x28')][_0xf56a('0x45')]({'where':{'id':_0x33b320['params']['id']},'attributes':['id',_0xf56a('0x4a'),'msg_id']})[_0xf56a('0x22')](handleEntityNotFound(_0x4d16ad,null))[_0xf56a('0x22')](function(_0x39529d){if(_0x39529d){if(!_0x39529d[_0xf56a('0x4a')]){throw new db['Sequelize']['ValidationError'](_0xf56a('0x4b'));}var _0x127216={'Content-Type':_0xf56a('0x4c'),'Content-Disposition':_0xf56a('0x4d')};if(_0x39529d[_0xf56a('0x4e')]){_0x127216[_0xf56a('0x4f')]=_0xf56a('0x50')+_0x39529d[_0xf56a('0x4e')]+_0xf56a('0x51');}_0x4d16ad['set'](_0x127216);return _0x4d16ad[_0xf56a('0x52')](new Buffer(_0x39529d[_0xf56a('0x4a')]));}})['catch'](handleError(_0x4d16ad,null));}; \ No newline at end of file +var _0xbc84=['filter','merge','options','includeAll','rows','catch','show','params','include','find','create','body','destroy','download','recording','Sequelize','VoiceMailMessage\x20not\x20found','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','error','stack','send','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3d7daf,_0x370ea2){var _0x18edd1=function(_0x331b82){while(--_0x331b82){_0x3d7daf['push'](_0x3d7daf['shift']());}};_0x18edd1(++_0x370ea2);}(_0xbc84,0x1b4));var _0x4bc8=function(_0x336b57,_0x56aab9){_0x336b57=_0x336b57-0x0;var _0x38b982=_0xbc84[_0x336b57];return _0x38b982;};'use strict';var emlformat=require(_0x4bc8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4bc8('0x1'));var rp=require(_0x4bc8('0x2'));var moment=require(_0x4bc8('0x3'));var BPromise=require(_0x4bc8('0x4'));var Mustache=require(_0x4bc8('0x5'));var util=require(_0x4bc8('0x6'));var path=require(_0x4bc8('0x7'));var sox=require(_0x4bc8('0x8'));var csv=require(_0x4bc8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4bc8('0xa'));var _=require(_0x4bc8('0xb'));var squel=require(_0x4bc8('0xc'));var crypto=require('crypto');var jsforce=require(_0x4bc8('0xd'));var deskjs=require(_0x4bc8('0xe'));var toCsv=require(_0x4bc8('0x9'));var querystring=require(_0x4bc8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4bc8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4bc8('0x11'));var logger=require(_0x4bc8('0x12'))(_0x4bc8('0x13'));var utils=require('../../config/utils');var config=require(_0x4bc8('0x14'));var licenseUtil=require(_0x4bc8('0x15'));var db=require(_0x4bc8('0x16'))['db'];function respondWithStatusCode(_0x35cbe6,_0x558aa8){_0x558aa8=_0x558aa8||0xcc;return function(_0x3faa47){if(_0x3faa47){return _0x35cbe6[_0x4bc8('0x17')](_0x558aa8);}return _0x35cbe6[_0x4bc8('0x18')](_0x558aa8)[_0x4bc8('0x19')]();};}function respondWithResult(_0x2781d2,_0x262c84){_0x262c84=_0x262c84||0xc8;return function(_0x37a30a){if(_0x37a30a){return _0x2781d2['status'](_0x262c84)[_0x4bc8('0x1a')](_0x37a30a);}};}function respondWithFilteredResult(_0x168d05,_0x9a215d){return function(_0x487b59){if(_0x487b59){var _0x28e841=typeof _0x9a215d[_0x4bc8('0x1b')]==='undefined'&&typeof _0x9a215d[_0x4bc8('0x1c')]===_0x4bc8('0x1d');var _0x1b47b2=_0x487b59['count'];var _0xf79bd0=_0x28e841?0x0:_0x9a215d[_0x4bc8('0x1b')];var _0x32ba55=_0x28e841?_0x487b59[_0x4bc8('0x1e')]:_0x9a215d[_0x4bc8('0x1b')]+_0x9a215d[_0x4bc8('0x1c')];var _0x480959;if(_0x32ba55>=_0x1b47b2){_0x32ba55=_0x1b47b2;_0x480959=0xc8;}else{_0x480959=0xce;}_0x168d05[_0x4bc8('0x18')](_0x480959);return _0x168d05[_0x4bc8('0x1f')]('Content-Range',_0xf79bd0+'-'+_0x32ba55+'/'+_0x1b47b2)[_0x4bc8('0x1a')](_0x487b59);}return null;};}function patchUpdates(_0x1184bb){return function(_0x3ca257){try{jsonpatch[_0x4bc8('0x20')](_0x3ca257,_0x1184bb,!![]);}catch(_0x1ebbd2){return BPromise[_0x4bc8('0x21')](_0x1ebbd2);}return _0x3ca257[_0x4bc8('0x22')]();};}function saveUpdates(_0x4d443d,_0x2c8c99){return function(_0x5eacec){if(_0x5eacec){return _0x5eacec[_0x4bc8('0x23')](_0x4d443d)[_0x4bc8('0x24')](function(_0x474a64){return _0x474a64;});}return null;};}function removeEntity(_0xab1c01,_0x274bd2){return function(_0x50a8f1){if(_0x50a8f1){return _0x50a8f1['destroy']()[_0x4bc8('0x24')](function(){_0xab1c01[_0x4bc8('0x18')](0xcc)[_0x4bc8('0x19')]();});}};}function handleEntityNotFound(_0x2f02f7,_0x4008fc){return function(_0x51376a){if(!_0x51376a){_0x2f02f7[_0x4bc8('0x17')](0x194);}return _0x51376a;};}function handleError(_0x87f73c,_0x4da307){_0x4da307=_0x4da307||0x1f4;return function(_0x5d50cc){logger[_0x4bc8('0x25')](_0x5d50cc[_0x4bc8('0x26')]);if(_0x5d50cc['name']){delete _0x5d50cc['name'];}_0x87f73c[_0x4bc8('0x18')](_0x4da307)[_0x4bc8('0x27')](_0x5d50cc);};}exports[_0x4bc8('0x28')]=function(_0x2bb4dd,_0x1fa940){var _0x4c4226={},_0x2ac0f9={},_0xd5e56c={'count':0x0,'rows':[]};var _0x173200=_[_0x4bc8('0x29')](db[_0x4bc8('0x2a')][_0x4bc8('0x2b')],function(_0x106a4e){return{'name':_0x106a4e[_0x4bc8('0x2c')],'type':_0x106a4e['type'][_0x4bc8('0x2d')]};});_0x2ac0f9[_0x4bc8('0x2e')]=_[_0x4bc8('0x2f')](_[_0x4bc8('0x29')](_0x173200,_0x4bc8('0x30')),['name']);_0x2ac0f9[_0x4bc8('0x31')]=_[_0x4bc8('0x32')](_0x2bb4dd[_0x4bc8('0x31')]);_0x2ac0f9[_0x4bc8('0x33')]=_['intersection'](_0x2ac0f9[_0x4bc8('0x2e')],_0x2ac0f9['query']);_0x4c4226['attributes']=_[_0x4bc8('0x34')](_0x2ac0f9[_0x4bc8('0x2e')],qs['fields'](_0x2bb4dd[_0x4bc8('0x31')][_0x4bc8('0x35')]));_0x4c4226[_0x4bc8('0x36')]=_0x4c4226[_0x4bc8('0x36')][_0x4bc8('0x37')]?_0x4c4226['attributes']:_0x2ac0f9['model'];if(!_0x2bb4dd[_0x4bc8('0x31')][_0x4bc8('0x38')](_0x4bc8('0x39'))){_0x4c4226[_0x4bc8('0x1c')]=qs['limit'](_0x2bb4dd['query'][_0x4bc8('0x1c')]);_0x4c4226['offset']=qs['offset'](_0x2bb4dd['query'][_0x4bc8('0x1b')]);}_0x4c4226[_0x4bc8('0x3a')]=qs[_0x4bc8('0x3b')](_0x2bb4dd['query'][_0x4bc8('0x3b')]);_0x4c4226[_0x4bc8('0x3c')]=qs[_0x4bc8('0x33')](_[_0x4bc8('0x3d')](_0x2bb4dd[_0x4bc8('0x31')],_0x2ac0f9[_0x4bc8('0x33')]),_0x173200);if(_0x2bb4dd[_0x4bc8('0x31')][_0x4bc8('0x3e')]){_0x4c4226[_0x4bc8('0x3c')]=_[_0x4bc8('0x3f')](_0x4c4226[_0x4bc8('0x3c')],{'$or':_[_0x4bc8('0x29')](_0x173200,function(_0x57870c){if(_0x57870c['type']!=='VIRTUAL'){var _0x322164={};_0x322164[_0x57870c[_0x4bc8('0x30')]]={'$like':'%'+_0x2bb4dd['query'][_0x4bc8('0x3e')]+'%'};return _0x322164;}})});}_0x4c4226=_['merge']({},_0x4c4226,_0x2bb4dd[_0x4bc8('0x40')]);var _0x5ea434={'where':_0x4c4226[_0x4bc8('0x3c')]};return db[_0x4bc8('0x2a')][_0x4bc8('0x1e')](_0x5ea434)[_0x4bc8('0x24')](function(_0x2fe981){_0xd5e56c[_0x4bc8('0x1e')]=_0x2fe981;if(_0x2bb4dd['query'][_0x4bc8('0x41')]){_0x4c4226['include']=[{'all':!![]}];}return db[_0x4bc8('0x2a')]['findAll'](_0x4c4226);})[_0x4bc8('0x24')](function(_0x1edef2){_0xd5e56c[_0x4bc8('0x42')]=_0x1edef2;return _0xd5e56c;})[_0x4bc8('0x24')](respondWithFilteredResult(_0x1fa940,_0x4c4226))[_0x4bc8('0x43')](handleError(_0x1fa940,null));};exports[_0x4bc8('0x44')]=function(_0x5858e2,_0x37d6ad){var _0xed579b={'raw':!![],'where':{'id':_0x5858e2[_0x4bc8('0x45')]['id']}},_0x67c8ff={};_0x67c8ff[_0x4bc8('0x2e')]=_[_0x4bc8('0x32')](db[_0x4bc8('0x2a')][_0x4bc8('0x2b')]);_0x67c8ff[_0x4bc8('0x31')]=_['keys'](_0x5858e2[_0x4bc8('0x31')]);_0x67c8ff[_0x4bc8('0x33')]=_[_0x4bc8('0x34')](_0x67c8ff[_0x4bc8('0x2e')],_0x67c8ff['query']);_0xed579b['attributes']=_['intersection'](_0x67c8ff['model'],qs[_0x4bc8('0x35')](_0x5858e2['query']['fields']));_0xed579b[_0x4bc8('0x36')]=_0xed579b[_0x4bc8('0x36')][_0x4bc8('0x37')]?_0xed579b[_0x4bc8('0x36')]:_0x67c8ff['model'];if(_0x5858e2[_0x4bc8('0x31')][_0x4bc8('0x41')]){_0xed579b[_0x4bc8('0x46')]=[{'all':!![]}];}_0xed579b=_[_0x4bc8('0x3f')]({},_0xed579b,_0x5858e2[_0x4bc8('0x40')]);return db[_0x4bc8('0x2a')][_0x4bc8('0x47')](_0xed579b)['then'](handleEntityNotFound(_0x37d6ad,null))[_0x4bc8('0x24')](respondWithResult(_0x37d6ad,null))['catch'](handleError(_0x37d6ad,null));};exports[_0x4bc8('0x48')]=function(_0x4fed1e,_0x45914e){return db['VoiceMailMessage']['create'](_0x4fed1e['body'],{})[_0x4bc8('0x24')](respondWithResult(_0x45914e,0xc9))[_0x4bc8('0x43')](handleError(_0x45914e,null));};exports[_0x4bc8('0x23')]=function(_0x523b96,_0x36385f){if(_0x523b96[_0x4bc8('0x49')]['id']){delete _0x523b96[_0x4bc8('0x49')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x523b96[_0x4bc8('0x45')]['id']}})[_0x4bc8('0x24')](handleEntityNotFound(_0x36385f,null))['then'](saveUpdates(_0x523b96[_0x4bc8('0x49')],null))['then'](respondWithResult(_0x36385f,null))[_0x4bc8('0x43')](handleError(_0x36385f,null));};exports[_0x4bc8('0x4a')]=function(_0x254f8d,_0x2057a9){return db['VoiceMailMessage'][_0x4bc8('0x47')]({'where':{'id':_0x254f8d['params']['id']}})[_0x4bc8('0x24')](handleEntityNotFound(_0x2057a9,null))[_0x4bc8('0x24')](removeEntity(_0x2057a9,null))[_0x4bc8('0x43')](handleError(_0x2057a9,null));};exports[_0x4bc8('0x4b')]=function(_0x9929e6,_0x46cb5e,_0x53e55c){return db[_0x4bc8('0x2a')]['find']({'where':{'id':_0x9929e6[_0x4bc8('0x45')]['id']},'attributes':['id',_0x4bc8('0x4c'),'msg_id']})['then'](handleEntityNotFound(_0x46cb5e,null))['then'](function(_0x32443d){if(_0x32443d){if(!_0x32443d[_0x4bc8('0x4c')]){throw new db[(_0x4bc8('0x4d'))]['ValidationError'](_0x4bc8('0x4e'));}var _0x5a5ebe={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x32443d[_0x4bc8('0x4f')]){_0x5a5ebe[_0x4bc8('0x50')]=_0x4bc8('0x51')+_0x32443d[_0x4bc8('0x4f')]+_0x4bc8('0x52');}_0x46cb5e[_0x4bc8('0x1f')](_0x5a5ebe);return _0x46cb5e[_0x4bc8('0x27')](new Buffer(_0x32443d[_0x4bc8('0x4c')]));}})[_0x4bc8('0x43')](handleError(_0x46cb5e,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 78d9679..d3155ab 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 _0x6636=['path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','dir','lodash','util','api','moment'];(function(_0x29e0eb,_0x9acb52){var _0x597d2d=function(_0x596ef9){while(--_0x596ef9){_0x29e0eb['push'](_0x29e0eb['shift']());}};_0x597d2d(++_0x9acb52);}(_0x6636,0xee));var _0x6663=function(_0x314b1f,_0x1f8c97){_0x314b1f=_0x314b1f-0x0;var _0x3d405c=_0x6636[_0x314b1f];return _0x3d405c;};'use strict';var _=require(_0x6663('0x0'));var util=require(_0x6663('0x1'));var logger=require('../../config/logger')(_0x6663('0x2'));var moment=require(_0x6663('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6663('0x4'));var rimraf=require(_0x6663('0x5'));var config=require(_0x6663('0x6'));var attributes=require(_0x6663('0x7'));module['exports']=function(_0x46b93f,_0x3c5cd1){return _0x46b93f[_0x6663('0x8')](_0x6663('0x9'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0x6663('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x17f6=['../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x45494,_0x1040a5){var _0x2ee547=function(_0x8d38d8){while(--_0x8d38d8){_0x45494['push'](_0x45494['shift']());}};_0x2ee547(++_0x1040a5);}(_0x17f6,0x7e));var _0x617f=function(_0x223ea3,_0x3bd9c9){_0x223ea3=_0x223ea3-0x0;var _0x158472=_0x17f6[_0x223ea3];return _0x158472;};'use strict';var _=require(_0x617f('0x0'));var util=require(_0x617f('0x1'));var logger=require(_0x617f('0x2'))(_0x617f('0x3'));var moment=require(_0x617f('0x4'));var BPromise=require(_0x617f('0x5'));var rp=require(_0x617f('0x6'));var fs=require('fs');var path=require(_0x617f('0x7'));var rimraf=require(_0x617f('0x8'));var config=require(_0x617f('0x9'));var attributes=require(_0x617f('0xa'));module['exports']=function(_0x2c3bda,_0x3299f8){return _0x2c3bda[_0x617f('0xb')](_0x617f('0xc'),attributes,{'tableName':_0x617f('0xd'),'paranoid':![],'indexes':[{'name':_0x617f('0xe'),'fields':[_0x617f('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 4d704ae..243dfee 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 _0x3b34=['../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5e5f7c,_0x2d92a1){var _0x1a112b=function(_0x28a049){while(--_0x28a049){_0x5e5f7c['push'](_0x5e5f7c['shift']());}};_0x1a112b(++_0x2d92a1);}(_0x3b34,0x184));var _0x43b3=function(_0x3d33cc,_0x56f9ed){_0x3d33cc=_0x3d33cc-0x0;var _0x95394d=_0x3b34[_0x3d33cc];return _0x95394d;};'use strict';var _=require(_0x43b3('0x0'));var util=require(_0x43b3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x43b3('0x2'));var fs=require('fs');var Redis=require(_0x43b3('0x3'));var db=require(_0x43b3('0x4'))['db'];var utils=require(_0x43b3('0x5'));var logger=require(_0x43b3('0x6'))(_0x43b3('0x7'));var config=require(_0x43b3('0x8'));var jayson=require(_0x43b3('0x9'));var client=jayson[_0x43b3('0xa')][_0x43b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x330f61,_0x495790,_0x36736b){return new BPromise(function(_0x2e82c4,_0x17b4e7){return client[_0x43b3('0xc')](_0x330f61,_0x36736b)['then'](function(_0x21054c){logger[_0x43b3('0xd')](_0x43b3('0xe'),_0x495790,_0x43b3('0xf'));logger[_0x43b3('0x10')](_0x43b3('0x11'),_0x495790,'request\x20sent',JSON['stringify'](_0x21054c));if(_0x21054c[_0x43b3('0x12')]){if(_0x21054c[_0x43b3('0x12')]['code']===0x1f4){logger[_0x43b3('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x495790,_0x21054c[_0x43b3('0x12')][_0x43b3('0x13')]);return _0x17b4e7(_0x21054c['error']['message']);}logger[_0x43b3('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x495790,_0x21054c[_0x43b3('0x12')][_0x43b3('0x13')]);return _0x2e82c4(_0x21054c['error'][_0x43b3('0x13')]);}else{logger[_0x43b3('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x495790,_0x43b3('0xf'));_0x2e82c4(_0x21054c[_0x43b3('0x14')][_0x43b3('0x13')]);}})[_0x43b3('0x15')](function(_0xbad27b){logger[_0x43b3('0x12')](_0x43b3('0xe'),_0x495790,_0xbad27b);_0x17b4e7(_0xbad27b);});});} \ No newline at end of file +var _0x64bd=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x64bd,0xd5));var _0xd64b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x64bd[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xd64b('0x0'));var util=require('util');var moment=require(_0xd64b('0x1'));var BPromise=require(_0xd64b('0x2'));var rs=require(_0xd64b('0x3'));var fs=require('fs');var Redis=require(_0xd64b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd64b('0x5'));var logger=require(_0xd64b('0x6'))(_0xd64b('0x7'));var config=require('../../config/environment');var jayson=require(_0xd64b('0x8'));var client=jayson[_0xd64b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e50ea,_0xf381a3,_0x3635d1){return new BPromise(function(_0xfc0b01,_0x56a758){return client[_0xd64b('0xa')](_0x3e50ea,_0x3635d1)[_0xd64b('0xb')](function(_0x53ba0d){logger[_0xd64b('0xc')](_0xd64b('0xd'),_0xf381a3,_0xd64b('0xe'));logger[_0xd64b('0xf')](_0xd64b('0x10'),_0xf381a3,'request\x20sent',JSON[_0xd64b('0x11')](_0x53ba0d));if(_0x53ba0d['error']){if(_0x53ba0d[_0xd64b('0x12')][_0xd64b('0x13')]===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0xf381a3,_0x53ba0d[_0xd64b('0x12')][_0xd64b('0x14')]);return _0x56a758(_0x53ba0d[_0xd64b('0x12')][_0xd64b('0x14')]);}logger[_0xd64b('0x12')](_0xd64b('0xd'),_0xf381a3,_0x53ba0d[_0xd64b('0x12')][_0xd64b('0x14')]);return _0xfc0b01(_0x53ba0d['error']['message']);}else{logger[_0xd64b('0xc')](_0xd64b('0xd'),_0xf381a3,'request\x20sent');_0xfc0b01(_0x53ba0d[_0xd64b('0x15')][_0xd64b('0x14')]);}})[_0xd64b('0x16')](function(_0x577352){logger[_0xd64b('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0xf381a3,_0x577352);_0x56a758(_0x577352);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 7183395..56febae 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 _0xbf51=['destroy','removeSound','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','/:id/sounds','getSounds','post','put','update','delete'];(function(_0x5d5a5e,_0x3e6054){var _0x35a912=function(_0x3d2ff3){while(--_0x3d2ff3){_0x5d5a5e['push'](_0x5d5a5e['shift']());}};_0x35a912(++_0x3e6054);}(_0xbf51,0xf2));var _0x1bf5=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xbf51[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require(_0x1bf5('0x0'));var util=require('util');var path=require(_0x1bf5('0x1'));var timeout=require(_0x1bf5('0x2'));var express=require(_0x1bf5('0x3'));var router=express['Router']();var fs_extra=require(_0x1bf5('0x4'));var auth=require(_0x1bf5('0x5'));var interaction=require(_0x1bf5('0x6'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1bf5('0x7')]);router[_0x1bf5('0x8')](_0x1bf5('0x9'),auth[_0x1bf5('0xa')](),controller[_0x1bf5('0xb')]);router[_0x1bf5('0x8')](_0x1bf5('0xc'),auth[_0x1bf5('0xa')](),controller[_0x1bf5('0xd')]);router[_0x1bf5('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1bf5('0xe')](_0x1bf5('0xc'),auth[_0x1bf5('0xa')](),controller['addSound']);router[_0x1bf5('0xf')]('/:id',auth[_0x1bf5('0xa')](),controller[_0x1bf5('0x10')]);router[_0x1bf5('0x11')]('/:id',auth[_0x1bf5('0xa')](),controller[_0x1bf5('0x12')]);router[_0x1bf5('0x11')]('/:id/sounds/:id2',auth[_0x1bf5('0xa')](),controller[_0x1bf5('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7162=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/sounds','post','addSound','delete','/:id','/:id/sounds/:id2','exports'];(function(_0x20ddfa,_0x288ed2){var _0x3956f7=function(_0x2163a5){while(--_0x2163a5){_0x20ddfa['push'](_0x20ddfa['shift']());}};_0x3956f7(++_0x288ed2);}(_0x7162,0x154));var _0x2716=function(_0x535250,_0x1127f7){_0x535250=_0x535250-0x0;var _0x16ffe8=_0x7162[_0x535250];return _0x16ffe8;};'use strict';var multer=require(_0x2716('0x0'));var util=require(_0x2716('0x1'));var path=require(_0x2716('0x2'));var timeout=require(_0x2716('0x3'));var express=require(_0x2716('0x4'));var router=express[_0x2716('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2716('0x6'));var config=require(_0x2716('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0x2716('0x8')]('/',auth[_0x2716('0x9')](),controller['index']);router[_0x2716('0x8')]('/:id',auth[_0x2716('0x9')](),controller['show']);router[_0x2716('0x8')](_0x2716('0xa'),auth['isAuthenticated'](),controller['getSounds']);router[_0x2716('0xb')]('/',auth[_0x2716('0x9')](),controller['create']);router[_0x2716('0xb')](_0x2716('0xa'),auth[_0x2716('0x9')](),controller[_0x2716('0xc')]);router['put']('/:id',auth[_0x2716('0x9')](),controller['update']);router[_0x2716('0xd')](_0x2716('0xe'),auth[_0x2716('0x9')](),controller['destroy']);router[_0x2716('0xd')](_0x2716('0xf'),auth[_0x2716('0x9')](),controller['removeSound']);module[_0x2716('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 98c6f28..b07d95a 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 _0x3d3d=['BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha'];(function(_0x1a1fd9,_0x4e6a5e){var _0x3601fb=function(_0x1a2af5){while(--_0x1a2af5){_0x1a1fd9['push'](_0x1a1fd9['shift']());}};_0x3601fb(++_0x4e6a5e);}(_0x3d3d,0x12c));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd3d3('0x0'));module[_0xd3d3('0x1')]={'name':{'type':Sequelize[_0xd3d3('0x2')],'allowNull':![],'unique':_0xd3d3('0x3')},'mode':{'type':Sequelize[_0xd3d3('0x4')](_0xd3d3('0x5'),_0xd3d3('0x6'),_0xd3d3('0x7'),_0xd3d3('0x8'),_0xd3d3('0x9'),_0xd3d3('0xa')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xd3d3('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xd3d3('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd3d3('0xb')},'format':{'type':Sequelize[_0xd3d3('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xd3d3('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa59f=['exports','STRING','name','ENUM','mp3nb','quietmp3','mp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xa59f,0xcb));var _0xfa59=function(_0x3b9a14,_0x210288){_0x3b9a14=_0x3b9a14-0x0;var _0x5addf1=_0xa59f[_0x3b9a14];return _0x5addf1;};'use strict';var Sequelize=require(_0xfa59('0x0'));module[_0xfa59('0x1')]={'name':{'type':Sequelize[_0xfa59('0x2')],'allowNull':![],'unique':_0xfa59('0x3')},'mode':{'type':Sequelize[_0xfa59('0x4')]('custom','files',_0xfa59('0x5'),'quietmp3nb',_0xfa59('0x6'),_0xfa59('0x7')),'allowNull':!![],'defaultValue':_0xfa59('0x8')},'directory':{'type':Sequelize[_0xfa59('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xfa59('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xfa59('0x2')],'allowNull':!![],'defaultValue':_0xfa59('0x9')},'format':{'type':Sequelize[_0xfa59('0x2')],'allowNull':!![]},'stamp':{'type':_0xfa59('0xa')},'defaultEntry':{'type':Sequelize[_0xfa59('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 8bc7b4a..c172e16 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 _0xc560=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','index','map','VoiceMusicOnHold','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','VIRTUAL','where','includeAll','include','findAll','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','join','root','mkdirSync','directory','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','format','%s.%s','server/files/moh','symlinkSync','Sequelize','removeSound','id2','converted_format','getSounds','rawAttributes','options','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x4ac17d,_0x541c8a){var _0x2a354b=function(_0x59ad6b){while(--_0x59ad6b){_0x4ac17d['push'](_0x4ac17d['shift']());}};_0x2a354b(++_0x541c8a);}(_0xc560,0x13e));var _0x0c56=function(_0x3cdb07,_0x5c5970){_0x3cdb07=_0x3cdb07-0x0;var _0xc2dc60=_0xc560[_0x3cdb07];return _0xc2dc60;};'use strict';var emlformat=require(_0x0c56('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c56('0x1'));var jsonpatch=require(_0x0c56('0x2'));var rp=require(_0x0c56('0x3'));var moment=require(_0x0c56('0x4'));var BPromise=require(_0x0c56('0x5'));var Mustache=require(_0x0c56('0x6'));var util=require(_0x0c56('0x7'));var path=require(_0x0c56('0x8'));var sox=require('sox');var csv=require(_0x0c56('0x9'));var ejs=require(_0x0c56('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c56('0xb'));var squel=require('squel');var crypto=require(_0x0c56('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0c56('0xd'));var Redis=require(_0x0c56('0xe'));var authService=require(_0x0c56('0xf'));var qs=require(_0x0c56('0x10'));var as=require(_0x0c56('0x11'));var hardwareService=require(_0x0c56('0x12'));var logger=require(_0x0c56('0x13'))(_0x0c56('0x14'));var utils=require(_0x0c56('0x15'));var config=require(_0x0c56('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c56('0x17'))['db'];function respondWithStatusCode(_0x3eb872,_0x248cca){_0x248cca=_0x248cca||0xcc;return function(_0x41dcab){if(_0x41dcab){return _0x3eb872[_0x0c56('0x18')](_0x248cca);}return _0x3eb872[_0x0c56('0x19')](_0x248cca)[_0x0c56('0x1a')]();};}function respondWithResult(_0x12fd34,_0x134834){_0x134834=_0x134834||0xc8;return function(_0x50bbe6){if(_0x50bbe6){return _0x12fd34[_0x0c56('0x19')](_0x134834)[_0x0c56('0x1b')](_0x50bbe6);}};}function respondWithFilteredResult(_0x59ac5e,_0x12092f){return function(_0xb81340){if(_0xb81340){var _0x4210b7=typeof _0x12092f['offset']===_0x0c56('0x1c')&&typeof _0x12092f['limit']===_0x0c56('0x1c');var _0x1dfa12=_0xb81340[_0x0c56('0x1d')];var _0xcbae4c=_0x4210b7?0x0:_0x12092f['offset'];var _0x243a75=_0x4210b7?_0xb81340[_0x0c56('0x1d')]:_0x12092f[_0x0c56('0x1e')]+_0x12092f['limit'];var _0x506dd0;if(_0x243a75>=_0x1dfa12){_0x243a75=_0x1dfa12;_0x506dd0=0xc8;}else{_0x506dd0=0xce;}_0x59ac5e['status'](_0x506dd0);return _0x59ac5e[_0x0c56('0x1f')](_0x0c56('0x20'),_0xcbae4c+'-'+_0x243a75+'/'+_0x1dfa12)[_0x0c56('0x1b')](_0xb81340);}return null;};}function patchUpdates(_0x408a32){return function(_0x598ecd){try{jsonpatch[_0x0c56('0x21')](_0x598ecd,_0x408a32,!![]);}catch(_0x1ad607){return BPromise[_0x0c56('0x22')](_0x1ad607);}return _0x598ecd['save']();};}function saveUpdates(_0x5acae8,_0x22f271){return function(_0x43455e){if(_0x43455e){return _0x43455e['update'](_0x5acae8)[_0x0c56('0x23')](function(_0x4fe3ed){return _0x4fe3ed;});}return null;};}function removeEntity(_0x3aaa70,_0x341b69){return function(_0x52016c){if(_0x52016c){return _0x52016c[_0x0c56('0x24')]()['then'](function(){var _0xe29ca6=_0x52016c[_0x0c56('0x25')]({'plain':!![]});var _0x490bfb='MusicOnHolds';return db[_0x0c56('0x26')][_0x0c56('0x24')]({'where':{'type':_0x490bfb,'resourceId':_0xe29ca6['id']}})['then'](function(){return _0x52016c;});})['then'](function(){_0x3aaa70[_0x0c56('0x19')](0xcc)[_0x0c56('0x1a')]();});}};}function handleEntityNotFound(_0x3c7b66,_0x2039dd){return function(_0x350343){if(!_0x350343){_0x3c7b66[_0x0c56('0x18')](0x194);}return _0x350343;};}function handleError(_0xf05c4b,_0x4de30a){_0x4de30a=_0x4de30a||0x1f4;return function(_0x24ae7d){logger[_0x0c56('0x27')](_0x24ae7d[_0x0c56('0x28')]);if(_0x24ae7d[_0x0c56('0x29')]){delete _0x24ae7d[_0x0c56('0x29')];}_0xf05c4b[_0x0c56('0x19')](_0x4de30a)['send'](_0x24ae7d);};}exports[_0x0c56('0x2a')]=function(_0x374509,_0x56de61){var _0x2f123e={},_0x689f1c={},_0x365336={'count':0x0,'rows':[]};var _0x39f320=_[_0x0c56('0x2b')](db[_0x0c56('0x2c')]['rawAttributes'],function(_0xdc5982){return{'name':_0xdc5982['fieldName'],'type':_0xdc5982[_0x0c56('0x2d')][_0x0c56('0x2e')]};});_0x689f1c[_0x0c56('0x2f')]=_[_0x0c56('0x2b')](_0x39f320,_0x0c56('0x29'));_0x689f1c[_0x0c56('0x30')]=_[_0x0c56('0x31')](_0x374509[_0x0c56('0x30')]);_0x689f1c[_0x0c56('0x32')]=_['intersection'](_0x689f1c[_0x0c56('0x2f')],_0x689f1c[_0x0c56('0x30')]);_0x2f123e[_0x0c56('0x33')]=_[_0x0c56('0x34')](_0x689f1c[_0x0c56('0x2f')],qs[_0x0c56('0x35')](_0x374509[_0x0c56('0x30')][_0x0c56('0x35')]));_0x2f123e['attributes']=_0x2f123e['attributes'][_0x0c56('0x36')]?_0x2f123e[_0x0c56('0x33')]:_0x689f1c[_0x0c56('0x2f')];if(!_0x374509[_0x0c56('0x30')][_0x0c56('0x37')](_0x0c56('0x38'))){_0x2f123e[_0x0c56('0x39')]=qs[_0x0c56('0x39')](_0x374509[_0x0c56('0x30')][_0x0c56('0x39')]);_0x2f123e[_0x0c56('0x1e')]=qs[_0x0c56('0x1e')](_0x374509['query'][_0x0c56('0x1e')]);}_0x2f123e[_0x0c56('0x3a')]=qs['sort'](_0x374509[_0x0c56('0x30')][_0x0c56('0x3b')]);delete _0x374509['query'][_0x0c56('0x3b')];_0x2f123e['where']=qs[_0x0c56('0x32')](_[_0x0c56('0x3c')](_0x374509['query'],_0x689f1c[_0x0c56('0x32')]),_0x39f320);if(_0x374509[_0x0c56('0x30')][_0x0c56('0x3d')]){_0x2f123e['where']=_[_0x0c56('0x3e')](_0x2f123e['where'],{'$or':_[_0x0c56('0x2b')](_0x39f320,function(_0x37921c){if(_0x37921c['type']!==_0x0c56('0x3f')){var _0x257892={};_0x257892[_0x37921c[_0x0c56('0x29')]]={'$like':'%'+_0x374509[_0x0c56('0x30')][_0x0c56('0x3d')]+'%'};return _0x257892;}})});}_0x2f123e=_[_0x0c56('0x3e')]({},_0x2f123e,_0x374509['options']);var _0x4896f6={'where':_0x2f123e[_0x0c56('0x40')]};return db['VoiceMusicOnHold'][_0x0c56('0x1d')](_0x4896f6)[_0x0c56('0x23')](function(_0x21d271){_0x365336['count']=_0x21d271;if(_0x374509[_0x0c56('0x30')][_0x0c56('0x41')]){_0x2f123e[_0x0c56('0x42')]=[{'all':!![]}];}return db[_0x0c56('0x2c')][_0x0c56('0x43')](_0x2f123e);})[_0x0c56('0x23')](function(_0x55b15c){_0x365336['rows']=_0x55b15c;return _0x365336;})[_0x0c56('0x23')](respondWithFilteredResult(_0x56de61,_0x2f123e))[_0x0c56('0x44')](handleError(_0x56de61,null));};exports[_0x0c56('0x45')]=function(_0x12bd8b,_0x41a231){var _0xdb7fe0={'raw':![],'where':{'id':_0x12bd8b[_0x0c56('0x46')]['id']}},_0x39574f={};_0x39574f[_0x0c56('0x2f')]=_[_0x0c56('0x31')](db[_0x0c56('0x2c')]['rawAttributes']);_0x39574f['query']=_['keys'](_0x12bd8b[_0x0c56('0x30')]);_0x39574f[_0x0c56('0x32')]=_['intersection'](_0x39574f[_0x0c56('0x2f')],_0x39574f[_0x0c56('0x30')]);_0xdb7fe0[_0x0c56('0x33')]=_[_0x0c56('0x34')](_0x39574f[_0x0c56('0x2f')],qs['fields'](_0x12bd8b['query'][_0x0c56('0x35')]));_0xdb7fe0[_0x0c56('0x33')]=_0xdb7fe0[_0x0c56('0x33')]['length']?_0xdb7fe0[_0x0c56('0x33')]:_0x39574f[_0x0c56('0x2f')];if(_0x12bd8b[_0x0c56('0x30')][_0x0c56('0x41')]){_0xdb7fe0[_0x0c56('0x42')]=[{'all':!![]}];}_0xdb7fe0=_['merge']({},_0xdb7fe0,_0x12bd8b['options']);return db[_0x0c56('0x2c')][_0x0c56('0x47')](_0xdb7fe0)[_0x0c56('0x23')](handleEntityNotFound(_0x41a231,null))[_0x0c56('0x23')](respondWithResult(_0x41a231,null))[_0x0c56('0x44')](handleError(_0x41a231,null));};exports[_0x0c56('0x48')]=function(_0x3f5426,_0x537320){if(_0x3f5426[_0x0c56('0x49')]['id']){delete _0x3f5426['body']['id'];}return db[_0x0c56('0x2c')]['find']({'where':{'id':_0x3f5426['params']['id']}})['then'](handleEntityNotFound(_0x537320,null))[_0x0c56('0x23')](saveUpdates(_0x3f5426[_0x0c56('0x49')],null))[_0x0c56('0x23')](respondWithResult(_0x537320,null))['catch'](handleError(_0x537320,null));};exports[_0x0c56('0x4a')]=function(_0x27e936,_0x72ec84,_0x13b7c7){return db[_0x0c56('0x4b')][_0x0c56('0x4c')](function(_0x4410e9){if(_0x27e936[_0x0c56('0x49')][_0x0c56('0x4d')]===_0x0c56('0x4e')){_0x27e936[_0x0c56('0x49')]['directory']=path[_0x0c56('0x4f')](config[_0x0c56('0x50')],'server/files/moh',_0x27e936[_0x0c56('0x49')][_0x0c56('0x29')]);}return db[_0x0c56('0x2c')][_0x0c56('0x4a')](_0x27e936[_0x0c56('0x49')],{'transaction':_0x4410e9})[_0x0c56('0x23')](function(_0xf6fd63){if(_0x27e936[_0x0c56('0x49')][_0x0c56('0x4d')]==='files'){fs[_0x0c56('0x51')](_0xf6fd63[_0x0c56('0x52')],parseInt('0777',0x8));}var _0x3f60ed=_0x27e936[_0x0c56('0x53')][_0x0c56('0x25')]({'plain':!![]});if(!_0x3f60ed)throw new Error(_0x0c56('0x54'));if(_0x3f60ed[_0x0c56('0x55')]==='user'){var _0x1fb9b3=_0xf6fd63[_0x0c56('0x25')]({'plain':!![]});return db[_0x0c56('0x56')]['find']({'where':{'name':_0x0c56('0x57'),'userProfileId':_0x3f60ed[_0x0c56('0x58')]},'raw':!![]})[_0x0c56('0x23')](function(_0x55e344){if(_0x55e344&&_0x55e344[_0x0c56('0x59')]===0x0){return db['UserProfileResource'][_0x0c56('0x4a')]({'name':_0x1fb9b3['name'],'resourceId':_0x1fb9b3['id'],'type':_0x55e344[_0x0c56('0x29')],'sectionId':_0x55e344['id']},{})[_0x0c56('0x23')](function(){return _0xf6fd63;});}else{return _0xf6fd63;}})[_0x0c56('0x44')](function(_0x3ead3a){logger['error'](_0x0c56('0x5a'),_0x3ead3a);});}return _0xf6fd63;});})[_0x0c56('0x23')](respondWithResult(_0x72ec84,0xc9))[_0x0c56('0x44')](handleError(_0x72ec84,null));};exports[_0x0c56('0x24')]=function(_0x12f45a,_0x1959ab,_0x13abef){var _0x2927e4;return db[_0x0c56('0x2c')][_0x0c56('0x47')]({'where':{'id':_0x12f45a[_0x0c56('0x46')]['id']}})[_0x0c56('0x23')](function(_0x50cf1d){if(_0x50cf1d){return db['sequelize']['transaction'](function(_0x4f4060){return _0x50cf1d['destroy']({'transaction':_0x4f4060,'raw':!![]})['then'](function(_0x38d541){if(_0x38d541['directory']){fs[_0x0c56('0x5b')](_0x38d541[_0x0c56('0x52')])[_0x0c56('0x5c')](function(_0x12bfc8){fs[_0x0c56('0x5d')](path[_0x0c56('0x4f')](_0x38d541[_0x0c56('0x52')],_0x12bfc8));});fs[_0x0c56('0x5e')](_0x38d541[_0x0c56('0x52')]);}return _0x38d541;});})[_0x0c56('0x44')](function(_0x1cd57c){throw new db['Sequelize'][(_0x0c56('0x5f'))](_0x1cd57c[_0x0c56('0x60')]);});}})[_0x0c56('0x23')](handleEntityNotFound(_0x1959ab,null))['then'](removeEntity(_0x1959ab,null))[_0x0c56('0x44')](handleError(_0x1959ab,null));};exports[_0x0c56('0x61')]=function(_0x2a3950,_0x33ddb3,_0x4c9a56){return db[_0x0c56('0x4b')][_0x0c56('0x4c')](function(_0x3c33fb){var _0xc883a8;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x2a3950[_0x0c56('0x46')]['id']}})[_0x0c56('0x23')](function(_0x350b94){if(_0x350b94){_0xc883a8=_0x350b94;return _0x350b94['addSound'](_0x2a3950[_0x0c56('0x49')]['id'],{'transaction':_0x3c33fb});}})['then'](function(_0x2f67e2){if(_0x2f67e2){return db[_0x0c56('0x62')][_0x0c56('0x63')]({'where':{'id':_0x2a3950['body']['id']},'attributes':['id',_0x0c56('0x29'),_0x0c56('0x64'),'converted_format',_0x0c56('0x65')],'raw':!![]});}})[_0x0c56('0x23')](function(_0x10ea1c){if(_0x10ea1c){var _0x316018=path[_0x0c56('0x4f')](config[_0x0c56('0x50')],'server/files/sounds/converted',util[_0x0c56('0x66')](_0x0c56('0x67'),path['basename'](_0x10ea1c[_0x0c56('0x64')],path['extname'](_0x10ea1c[_0x0c56('0x64')])),_0x10ea1c['converted_format']));var _0x1a467f=path[_0x0c56('0x4f')](config[_0x0c56('0x50')],_0x0c56('0x68'),_0xc883a8[_0x0c56('0x29')],util[_0x0c56('0x66')](_0x0c56('0x67'),_0x10ea1c[_0x0c56('0x29')],_0x10ea1c['converted_format']));fs[_0x0c56('0x69')](_0x316018,_0x1a467f);return _0x10ea1c;}})['catch'](function(_0xb57404){throw new db[(_0x0c56('0x6a'))]['ValidationError'](_0xb57404[_0x0c56('0x60')]);});})[_0x0c56('0x23')](handleEntityNotFound(_0x33ddb3,null))[_0x0c56('0x23')](respondWithResult(_0x33ddb3,0xc9))['catch'](handleError(_0x33ddb3,null));};exports['removeSound']=function(_0x21b091,_0x42e000,_0x2c699a){return db[_0x0c56('0x4b')][_0x0c56('0x4c')](function(_0x9ec029){var _0x5e32f8;return db[_0x0c56('0x2c')]['findOne']({'where':{'id':_0x21b091[_0x0c56('0x46')]['id']}})['then'](handleEntityNotFound(_0x42e000,null))[_0x0c56('0x23')](function(_0x3cc8fb){if(_0x3cc8fb){_0x5e32f8=_0x3cc8fb;return _0x3cc8fb[_0x0c56('0x6b')](_0x21b091['params'][_0x0c56('0x6c')]);}})[_0x0c56('0x23')](function(_0x411026){if(_0x411026){return db[_0x0c56('0x62')]['findOne']({'where':{'id':_0x21b091[_0x0c56('0x46')][_0x0c56('0x6c')]},'attributes':['id',_0x0c56('0x29'),_0x0c56('0x64'),'converted_format',_0x0c56('0x65')],'raw':!![]});}})[_0x0c56('0x23')](function(_0x335743){if(_0x335743){fs[_0x0c56('0x5d')](path[_0x0c56('0x4f')](_0x5e32f8[_0x0c56('0x52')],util[_0x0c56('0x66')]('%s.%s',_0x335743['name'],_0x335743[_0x0c56('0x6d')])));return _0x335743;}})[_0x0c56('0x44')](function(_0x3411d4){throw new db[(_0x0c56('0x6a'))][(_0x0c56('0x5f'))](_0x3411d4[_0x0c56('0x60')]);});})[_0x0c56('0x23')](handleEntityNotFound(_0x42e000,null))[_0x0c56('0x23')](respondWithStatusCode(_0x42e000,0xcc))[_0x0c56('0x44')](handleError(_0x42e000,null));};exports[_0x0c56('0x6e')]=function(_0x154675,_0x21fd1a,_0x3d785e){var _0x16a364={};var _0x4773ff={};var _0x54406e;var _0x3fce07;return db['VoiceMusicOnHold'][_0x0c56('0x63')]({'where':{'id':_0x154675[_0x0c56('0x46')]['id']}})['then'](handleEntityNotFound(_0x21fd1a,null))['then'](function(_0x375d3e){if(_0x375d3e){_0x54406e=_0x375d3e;_0x4773ff[_0x0c56('0x2f')]=_[_0x0c56('0x31')](db['Sound'][_0x0c56('0x6f')]);_0x4773ff[_0x0c56('0x30')]=_[_0x0c56('0x31')](_0x154675['query']);_0x4773ff[_0x0c56('0x32')]=_['intersection'](_0x4773ff[_0x0c56('0x2f')],_0x4773ff[_0x0c56('0x30')]);_0x16a364[_0x0c56('0x33')]=_[_0x0c56('0x34')](_0x4773ff['model'],qs[_0x0c56('0x35')](_0x154675[_0x0c56('0x30')]['fields']));_0x16a364[_0x0c56('0x33')]=_0x16a364[_0x0c56('0x33')][_0x0c56('0x36')]?_0x16a364[_0x0c56('0x33')]:_0x4773ff[_0x0c56('0x2f')];_0x16a364[_0x0c56('0x3a')]=qs[_0x0c56('0x3b')](_0x154675[_0x0c56('0x30')][_0x0c56('0x3b')]);_0x16a364[_0x0c56('0x40')]=qs[_0x0c56('0x32')](_[_0x0c56('0x3c')](_0x154675['query'],_0x4773ff[_0x0c56('0x32')]));if(_0x154675['query'][_0x0c56('0x3d')]){_0x16a364[_0x0c56('0x40')]=_['merge'](_0x16a364['where'],{'$or':_['map'](_0x16a364[_0x0c56('0x33')],function(_0xb4f250){var _0x5310c1={};_0x5310c1[_0xb4f250]={'$like':'%'+_0x154675[_0x0c56('0x30')][_0x0c56('0x3d')]+'%'};return _0x5310c1;})});}_0x16a364=_['merge']({},_0x16a364,_0x154675[_0x0c56('0x70')]);return _0x54406e[_0x0c56('0x6e')](_0x16a364);}})['then'](function(_0x45b4f0){if(_0x45b4f0){_0x3fce07=_0x45b4f0[_0x0c56('0x36')];if(!_0x154675[_0x0c56('0x30')][_0x0c56('0x37')](_0x0c56('0x38'))){_0x16a364['limit']=qs[_0x0c56('0x39')](_0x154675[_0x0c56('0x30')][_0x0c56('0x39')]);_0x16a364[_0x0c56('0x1e')]=qs['offset'](_0x154675[_0x0c56('0x30')][_0x0c56('0x1e')]);}return _0x54406e[_0x0c56('0x6e')](_0x16a364);}})[_0x0c56('0x23')](function(_0x367add){if(_0x367add){return _0x367add?{'count':_0x3fce07,'rows':_0x367add}:null;}})[_0x0c56('0x23')](respondWithResult(_0x21fd1a,null))[_0x0c56('0x44')](handleError(_0x21fd1a,null));}; \ No newline at end of file +var _0x83f7=['rawAttributes','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','keys','length','options','find','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','save_name','server/files/sounds/converted','format','%s.%s','basename','extname','converted_format','symlinkSync','removeSound','findOne','id2','createdAt','ValidationError','getSounds','eml-format','rimraf','zip-dir','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','map','VoiceMusicOnHold'];(function(_0x42ce20,_0x2716b6){var _0x1868be=function(_0x33b7fa){while(--_0x33b7fa){_0x42ce20['push'](_0x42ce20['shift']());}};_0x1868be(++_0x2716b6);}(_0x83f7,0x196));var _0x783f=function(_0x58c5db,_0x4bded){_0x58c5db=_0x58c5db-0x0;var _0x31ea55=_0x83f7[_0x58c5db];return _0x31ea55;};'use strict';var emlformat=require(_0x783f('0x0'));var rimraf=require(_0x783f('0x1'));var zipdir=require(_0x783f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x783f('0x3'));var Mustache=require(_0x783f('0x4'));var util=require(_0x783f('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x783f('0x6'));var fs=require('fs');var fs_extra=require(_0x783f('0x7'));var _=require(_0x783f('0x8'));var squel=require(_0x783f('0x9'));var crypto=require(_0x783f('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x783f('0xb'));var querystring=require(_0x783f('0xc'));var Papa=require(_0x783f('0xd'));var Redis=require(_0x783f('0xe'));var authService=require(_0x783f('0xf'));var qs=require(_0x783f('0x10'));var as=require(_0x783f('0x11'));var hardwareService=require(_0x783f('0x12'));var logger=require(_0x783f('0x13'))(_0x783f('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x783f('0x15'));var db=require(_0x783f('0x16'))['db'];function respondWithStatusCode(_0x21ecdf,_0xf43f85){_0xf43f85=_0xf43f85||0xcc;return function(_0xb6f3d9){if(_0xb6f3d9){return _0x21ecdf[_0x783f('0x17')](_0xf43f85);}return _0x21ecdf[_0x783f('0x18')](_0xf43f85)[_0x783f('0x19')]();};}function respondWithResult(_0x3a66de,_0x5d9409){_0x5d9409=_0x5d9409||0xc8;return function(_0x446043){if(_0x446043){return _0x3a66de['status'](_0x5d9409)[_0x783f('0x1a')](_0x446043);}};}function respondWithFilteredResult(_0x4ae30d,_0xf38725){return function(_0x3d9a8d){if(_0x3d9a8d){var _0x2c488b=typeof _0xf38725[_0x783f('0x1b')]===_0x783f('0x1c')&&typeof _0xf38725[_0x783f('0x1d')]===_0x783f('0x1c');var _0x1f1610=_0x3d9a8d[_0x783f('0x1e')];var _0x9a4f76=_0x2c488b?0x0:_0xf38725[_0x783f('0x1b')];var _0x5edeb0=_0x2c488b?_0x3d9a8d[_0x783f('0x1e')]:_0xf38725['offset']+_0xf38725[_0x783f('0x1d')];var _0x53e7b1;if(_0x5edeb0>=_0x1f1610){_0x5edeb0=_0x1f1610;_0x53e7b1=0xc8;}else{_0x53e7b1=0xce;}_0x4ae30d['status'](_0x53e7b1);return _0x4ae30d[_0x783f('0x1f')]('Content-Range',_0x9a4f76+'-'+_0x5edeb0+'/'+_0x1f1610)['json'](_0x3d9a8d);}return null;};}function patchUpdates(_0x30a974){return function(_0x575051){try{jsonpatch['apply'](_0x575051,_0x30a974,!![]);}catch(_0x517595){return BPromise[_0x783f('0x20')](_0x517595);}return _0x575051[_0x783f('0x21')]();};}function saveUpdates(_0x479ad5,_0x1ba74a){return function(_0x36f138){if(_0x36f138){return _0x36f138[_0x783f('0x22')](_0x479ad5)[_0x783f('0x23')](function(_0x1676d6){return _0x1676d6;});}return null;};}function removeEntity(_0x7e05c2,_0x3c4eef){return function(_0x3254db){if(_0x3254db){return _0x3254db[_0x783f('0x24')]()['then'](function(){var _0x392f96=_0x3254db[_0x783f('0x25')]({'plain':!![]});var _0xe1bd93=_0x783f('0x26');return db[_0x783f('0x27')][_0x783f('0x24')]({'where':{'type':_0xe1bd93,'resourceId':_0x392f96['id']}})[_0x783f('0x23')](function(){return _0x3254db;});})[_0x783f('0x23')](function(){_0x7e05c2['status'](0xcc)[_0x783f('0x19')]();});}};}function handleEntityNotFound(_0x48bc22,_0x1b44e1){return function(_0x4c745b){if(!_0x4c745b){_0x48bc22[_0x783f('0x17')](0x194);}return _0x4c745b;};}function handleError(_0x25f22c,_0x512176){_0x512176=_0x512176||0x1f4;return function(_0x272d79){logger[_0x783f('0x28')](_0x272d79[_0x783f('0x29')]);if(_0x272d79[_0x783f('0x2a')]){delete _0x272d79['name'];}_0x25f22c[_0x783f('0x18')](_0x512176)[_0x783f('0x2b')](_0x272d79);};}exports['index']=function(_0x3140c7,_0x1f1ff7){var _0x107c6e={},_0x39cabd={},_0x4238ef={'count':0x0,'rows':[]};var _0x5930fc=_[_0x783f('0x2c')](db[_0x783f('0x2d')][_0x783f('0x2e')],function(_0x25c9c5){return{'name':_0x25c9c5['fieldName'],'type':_0x25c9c5['type'][_0x783f('0x2f')]};});_0x39cabd[_0x783f('0x30')]=_[_0x783f('0x2c')](_0x5930fc,_0x783f('0x2a'));_0x39cabd['query']=_['keys'](_0x3140c7[_0x783f('0x31')]);_0x39cabd['filters']=_[_0x783f('0x32')](_0x39cabd[_0x783f('0x30')],_0x39cabd['query']);_0x107c6e[_0x783f('0x33')]=_['intersection'](_0x39cabd[_0x783f('0x30')],qs[_0x783f('0x34')](_0x3140c7[_0x783f('0x31')]['fields']));_0x107c6e[_0x783f('0x33')]=_0x107c6e[_0x783f('0x33')]['length']?_0x107c6e[_0x783f('0x33')]:_0x39cabd[_0x783f('0x30')];if(!_0x3140c7[_0x783f('0x31')][_0x783f('0x35')]('nolimit')){_0x107c6e['limit']=qs[_0x783f('0x1d')](_0x3140c7[_0x783f('0x31')][_0x783f('0x1d')]);_0x107c6e[_0x783f('0x1b')]=qs['offset'](_0x3140c7[_0x783f('0x31')][_0x783f('0x1b')]);}_0x107c6e[_0x783f('0x36')]=qs['sort'](_0x3140c7[_0x783f('0x31')][_0x783f('0x37')]);delete _0x3140c7['query'][_0x783f('0x37')];_0x107c6e[_0x783f('0x38')]=qs[_0x783f('0x39')](_[_0x783f('0x3a')](_0x3140c7[_0x783f('0x31')],_0x39cabd[_0x783f('0x39')]),_0x5930fc);if(_0x3140c7[_0x783f('0x31')][_0x783f('0x3b')]){_0x107c6e[_0x783f('0x38')]=_['merge'](_0x107c6e[_0x783f('0x38')],{'$or':_[_0x783f('0x2c')](_0x5930fc,function(_0x17530f){if(_0x17530f[_0x783f('0x3c')]!==_0x783f('0x3d')){var _0x519617={};_0x519617[_0x17530f[_0x783f('0x2a')]]={'$like':'%'+_0x3140c7[_0x783f('0x31')][_0x783f('0x3b')]+'%'};return _0x519617;}})});}_0x107c6e=_[_0x783f('0x3e')]({},_0x107c6e,_0x3140c7['options']);var _0x490964={'where':_0x107c6e[_0x783f('0x38')]};return db[_0x783f('0x2d')]['count'](_0x490964)[_0x783f('0x23')](function(_0x2b3d8f){_0x4238ef[_0x783f('0x1e')]=_0x2b3d8f;if(_0x3140c7[_0x783f('0x31')][_0x783f('0x3f')]){_0x107c6e[_0x783f('0x40')]=[{'all':!![]}];}return db[_0x783f('0x2d')][_0x783f('0x41')](_0x107c6e);})[_0x783f('0x23')](function(_0x41b2d3){_0x4238ef[_0x783f('0x42')]=_0x41b2d3;return _0x4238ef;})[_0x783f('0x23')](respondWithFilteredResult(_0x1f1ff7,_0x107c6e))[_0x783f('0x43')](handleError(_0x1f1ff7,null));};exports['show']=function(_0x484c35,_0x1cd1bc){var _0x29029c={'raw':![],'where':{'id':_0x484c35[_0x783f('0x44')]['id']}},_0x53ea99={};_0x53ea99[_0x783f('0x30')]=_[_0x783f('0x45')](db['VoiceMusicOnHold']['rawAttributes']);_0x53ea99[_0x783f('0x31')]=_[_0x783f('0x45')](_0x484c35[_0x783f('0x31')]);_0x53ea99[_0x783f('0x39')]=_['intersection'](_0x53ea99['model'],_0x53ea99[_0x783f('0x31')]);_0x29029c[_0x783f('0x33')]=_[_0x783f('0x32')](_0x53ea99[_0x783f('0x30')],qs['fields'](_0x484c35[_0x783f('0x31')][_0x783f('0x34')]));_0x29029c[_0x783f('0x33')]=_0x29029c[_0x783f('0x33')][_0x783f('0x46')]?_0x29029c[_0x783f('0x33')]:_0x53ea99[_0x783f('0x30')];if(_0x484c35[_0x783f('0x31')][_0x783f('0x3f')]){_0x29029c[_0x783f('0x40')]=[{'all':!![]}];}_0x29029c=_['merge']({},_0x29029c,_0x484c35[_0x783f('0x47')]);return db[_0x783f('0x2d')][_0x783f('0x48')](_0x29029c)[_0x783f('0x23')](handleEntityNotFound(_0x1cd1bc,null))[_0x783f('0x23')](respondWithResult(_0x1cd1bc,null))[_0x783f('0x43')](handleError(_0x1cd1bc,null));};exports['update']=function(_0x5d8168,_0x4fa178){if(_0x5d8168[_0x783f('0x49')]['id']){delete _0x5d8168[_0x783f('0x49')]['id'];}return db[_0x783f('0x2d')][_0x783f('0x48')]({'where':{'id':_0x5d8168[_0x783f('0x44')]['id']}})[_0x783f('0x23')](handleEntityNotFound(_0x4fa178,null))[_0x783f('0x23')](saveUpdates(_0x5d8168[_0x783f('0x49')],null))['then'](respondWithResult(_0x4fa178,null))[_0x783f('0x43')](handleError(_0x4fa178,null));};exports[_0x783f('0x4a')]=function(_0x2531d8,_0x28a0f7,_0x2f0aee){return db[_0x783f('0x4b')][_0x783f('0x4c')](function(_0x417daf){if(_0x2531d8[_0x783f('0x49')][_0x783f('0x4d')]===_0x783f('0x4e')){_0x2531d8[_0x783f('0x49')][_0x783f('0x4f')]=path[_0x783f('0x50')](config[_0x783f('0x51')],_0x783f('0x52'),_0x2531d8['body'][_0x783f('0x2a')]);}return db[_0x783f('0x2d')]['create'](_0x2531d8['body'],{'transaction':_0x417daf})[_0x783f('0x23')](function(_0x453ed0){if(_0x2531d8[_0x783f('0x49')][_0x783f('0x4d')]===_0x783f('0x4e')){fs[_0x783f('0x53')](_0x453ed0['directory'],parseInt(_0x783f('0x54'),0x8));}var _0x59e5bd=_0x2531d8[_0x783f('0x55')][_0x783f('0x25')]({'plain':!![]});if(!_0x59e5bd)throw new Error(_0x783f('0x56'));if(_0x59e5bd[_0x783f('0x57')]===_0x783f('0x55')){var _0x243837=_0x453ed0[_0x783f('0x25')]({'plain':!![]});return db['UserProfileSection'][_0x783f('0x48')]({'where':{'name':_0x783f('0x26'),'userProfileId':_0x59e5bd[_0x783f('0x58')]},'raw':!![]})['then'](function(_0x15a7e6){if(_0x15a7e6&&_0x15a7e6[_0x783f('0x59')]===0x0){return db[_0x783f('0x27')]['create']({'name':_0x243837[_0x783f('0x2a')],'resourceId':_0x243837['id'],'type':_0x15a7e6[_0x783f('0x2a')],'sectionId':_0x15a7e6['id']},{})[_0x783f('0x23')](function(){return _0x453ed0;});}else{return _0x453ed0;}})[_0x783f('0x43')](function(_0x48560f){logger[_0x783f('0x28')](_0x783f('0x5a'),_0x48560f);});}return _0x453ed0;});})[_0x783f('0x23')](respondWithResult(_0x28a0f7,0xc9))['catch'](handleError(_0x28a0f7,null));};exports[_0x783f('0x24')]=function(_0x5decce,_0x93f593,_0x1c8086){var _0x11867b;return db[_0x783f('0x2d')][_0x783f('0x48')]({'where':{'id':_0x5decce[_0x783f('0x44')]['id']}})[_0x783f('0x23')](function(_0x3253e5){if(_0x3253e5){return db[_0x783f('0x4b')][_0x783f('0x4c')](function(_0x540527){return _0x3253e5[_0x783f('0x24')]({'transaction':_0x540527,'raw':!![]})[_0x783f('0x23')](function(_0x55c075){if(_0x55c075[_0x783f('0x4f')]){fs[_0x783f('0x5b')](_0x55c075[_0x783f('0x4f')])[_0x783f('0x5c')](function(_0x2a7b93){fs[_0x783f('0x5d')](path[_0x783f('0x50')](_0x55c075['directory'],_0x2a7b93));});fs[_0x783f('0x5e')](_0x55c075['directory']);}return _0x55c075;});})['catch'](function(_0x1e4a4f){throw new db[(_0x783f('0x5f'))]['ValidationError'](_0x1e4a4f[_0x783f('0x60')]);});}})[_0x783f('0x23')](handleEntityNotFound(_0x93f593,null))[_0x783f('0x23')](removeEntity(_0x93f593,null))[_0x783f('0x43')](handleError(_0x93f593,null));};exports[_0x783f('0x61')]=function(_0x5c002e,_0x100b0d,_0x2f063d){return db[_0x783f('0x4b')][_0x783f('0x4c')](function(_0x1cbdcf){var _0x518169;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x5c002e[_0x783f('0x44')]['id']}})[_0x783f('0x23')](function(_0x7a80c1){if(_0x7a80c1){_0x518169=_0x7a80c1;return _0x7a80c1[_0x783f('0x61')](_0x5c002e[_0x783f('0x49')]['id'],{'transaction':_0x1cbdcf});}})['then'](function(_0x333cd1){if(_0x333cd1){return db[_0x783f('0x62')]['findOne']({'where':{'id':_0x5c002e[_0x783f('0x49')]['id']},'attributes':['id',_0x783f('0x2a'),_0x783f('0x63'),'converted_format','createdAt'],'raw':!![]});}})[_0x783f('0x23')](function(_0x1de474){if(_0x1de474){var _0x28a9f9=path['join'](config['root'],_0x783f('0x64'),util[_0x783f('0x65')](_0x783f('0x66'),path[_0x783f('0x67')](_0x1de474[_0x783f('0x63')],path[_0x783f('0x68')](_0x1de474['save_name'])),_0x1de474[_0x783f('0x69')]));var _0x39245d=path['join'](config['root'],_0x783f('0x52'),_0x518169[_0x783f('0x2a')],util[_0x783f('0x65')]('%s.%s',_0x1de474[_0x783f('0x2a')],_0x1de474[_0x783f('0x69')]));fs[_0x783f('0x6a')](_0x28a9f9,_0x39245d);return _0x1de474;}})['catch'](function(_0x37a1b5){throw new db[(_0x783f('0x5f'))]['ValidationError'](_0x37a1b5[_0x783f('0x60')]);});})[_0x783f('0x23')](handleEntityNotFound(_0x100b0d,null))['then'](respondWithResult(_0x100b0d,0xc9))[_0x783f('0x43')](handleError(_0x100b0d,null));};exports[_0x783f('0x6b')]=function(_0x4466c7,_0x58dc34,_0x449333){return db[_0x783f('0x4b')][_0x783f('0x4c')](function(_0x473611){var _0x31452c;return db[_0x783f('0x2d')][_0x783f('0x6c')]({'where':{'id':_0x4466c7[_0x783f('0x44')]['id']}})[_0x783f('0x23')](handleEntityNotFound(_0x58dc34,null))[_0x783f('0x23')](function(_0x22581b){if(_0x22581b){_0x31452c=_0x22581b;return _0x22581b['removeSound'](_0x4466c7[_0x783f('0x44')][_0x783f('0x6d')]);}})[_0x783f('0x23')](function(_0x36fd43){if(_0x36fd43){return db['Sound'][_0x783f('0x6c')]({'where':{'id':_0x4466c7['params']['id2']},'attributes':['id',_0x783f('0x2a'),_0x783f('0x63'),'converted_format',_0x783f('0x6e')],'raw':!![]});}})[_0x783f('0x23')](function(_0x36595c){if(_0x36595c){fs[_0x783f('0x5d')](path[_0x783f('0x50')](_0x31452c['directory'],util['format'](_0x783f('0x66'),_0x36595c[_0x783f('0x2a')],_0x36595c[_0x783f('0x69')])));return _0x36595c;}})['catch'](function(_0x3808e5){throw new db[(_0x783f('0x5f'))][(_0x783f('0x6f'))](_0x3808e5[_0x783f('0x60')]);});})[_0x783f('0x23')](handleEntityNotFound(_0x58dc34,null))['then'](respondWithStatusCode(_0x58dc34,0xcc))[_0x783f('0x43')](handleError(_0x58dc34,null));};exports['getSounds']=function(_0x3177c2,_0x48523d,_0x345ebe){var _0x4ec994={};var _0x19bb99={};var _0x11f900;var _0x1d1193;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x3177c2[_0x783f('0x44')]['id']}})[_0x783f('0x23')](handleEntityNotFound(_0x48523d,null))[_0x783f('0x23')](function(_0x24b82e){if(_0x24b82e){_0x11f900=_0x24b82e;_0x19bb99[_0x783f('0x30')]=_[_0x783f('0x45')](db[_0x783f('0x62')][_0x783f('0x2e')]);_0x19bb99[_0x783f('0x31')]=_[_0x783f('0x45')](_0x3177c2[_0x783f('0x31')]);_0x19bb99[_0x783f('0x39')]=_['intersection'](_0x19bb99[_0x783f('0x30')],_0x19bb99[_0x783f('0x31')]);_0x4ec994[_0x783f('0x33')]=_[_0x783f('0x32')](_0x19bb99[_0x783f('0x30')],qs[_0x783f('0x34')](_0x3177c2[_0x783f('0x31')][_0x783f('0x34')]));_0x4ec994[_0x783f('0x33')]=_0x4ec994[_0x783f('0x33')][_0x783f('0x46')]?_0x4ec994[_0x783f('0x33')]:_0x19bb99['model'];_0x4ec994[_0x783f('0x36')]=qs[_0x783f('0x37')](_0x3177c2[_0x783f('0x31')][_0x783f('0x37')]);_0x4ec994[_0x783f('0x38')]=qs[_0x783f('0x39')](_[_0x783f('0x3a')](_0x3177c2[_0x783f('0x31')],_0x19bb99[_0x783f('0x39')]));if(_0x3177c2[_0x783f('0x31')]['filter']){_0x4ec994[_0x783f('0x38')]=_[_0x783f('0x3e')](_0x4ec994['where'],{'$or':_[_0x783f('0x2c')](_0x4ec994['attributes'],function(_0x414b7b){var _0x2c8a4d={};_0x2c8a4d[_0x414b7b]={'$like':'%'+_0x3177c2[_0x783f('0x31')][_0x783f('0x3b')]+'%'};return _0x2c8a4d;})});}_0x4ec994=_['merge']({},_0x4ec994,_0x3177c2[_0x783f('0x47')]);return _0x11f900[_0x783f('0x70')](_0x4ec994);}})['then'](function(_0x22bac9){if(_0x22bac9){_0x1d1193=_0x22bac9[_0x783f('0x46')];if(!_0x3177c2[_0x783f('0x31')]['hasOwnProperty']('nolimit')){_0x4ec994[_0x783f('0x1d')]=qs['limit'](_0x3177c2[_0x783f('0x31')][_0x783f('0x1d')]);_0x4ec994[_0x783f('0x1b')]=qs[_0x783f('0x1b')](_0x3177c2['query'][_0x783f('0x1b')]);}return _0x11f900['getSounds'](_0x4ec994);}})[_0x783f('0x23')](function(_0x584ecc){if(_0x584ecc){return _0x584ecc?{'count':_0x1d1193,'rows':_0x584ecc}:null;}})[_0x783f('0x23')](respondWithResult(_0x48523d,null))['catch'](handleError(_0x48523d,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index c62abbb..f8a674b 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 _0xa7f1=['util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash'];(function(_0xca1585,_0x219dfb){var _0x117736=function(_0x386c85){while(--_0x386c85){_0xca1585['push'](_0xca1585['shift']());}};_0x117736(++_0x219dfb);}(_0xa7f1,0xb3));var _0x1a7f=function(_0x37dbbb,_0x1909de){_0x37dbbb=_0x37dbbb-0x0;var _0x10068f=_0xa7f1[_0x37dbbb];return _0x10068f;};'use strict';var _=require(_0x1a7f('0x0'));var util=require(_0x1a7f('0x1'));var logger=require(_0x1a7f('0x2'))(_0x1a7f('0x3'));var moment=require(_0x1a7f('0x4'));var BPromise=require(_0x1a7f('0x5'));var rp=require(_0x1a7f('0x6'));var fs=require('fs');var path=require(_0x1a7f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1a7f('0x8'));module[_0x1a7f('0x9')]=function(_0x2ec409,_0x406fea){return _0x2ec409[_0x1a7f('0xa')](_0x1a7f('0xb'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb60f=['moment','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','lodash','util','../../config/logger'];(function(_0x571971,_0x1120c9){var _0x25f1dd=function(_0x598fd7){while(--_0x598fd7){_0x571971['push'](_0x571971['shift']());}};_0x25f1dd(++_0x1120c9);}(_0xb60f,0xa7));var _0xfb60=function(_0x5d3fc3,_0x19cb2c){_0x5d3fc3=_0x5d3fc3-0x0;var _0x1c1552=_0xb60f[_0x5d3fc3];return _0x1c1552;};'use strict';var _=require(_0xfb60('0x0'));var util=require(_0xfb60('0x1'));var logger=require(_0xfb60('0x2'))('api');var moment=require(_0xfb60('0x3'));var BPromise=require('bluebird');var rp=require(_0xfb60('0x4'));var fs=require('fs');var path=require(_0xfb60('0x5'));var rimraf=require('rimraf');var config=require(_0xfb60('0x6'));var attributes=require(_0xfb60('0x7'));module[_0xfb60('0x8')]=function(_0x16b7b3,_0x27372f){return _0x16b7b3['define'](_0xfb60('0x9'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 2482a07..f7183f4 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 _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x748028,_0x4e2f33){var _0x275d6d=function(_0x28d06d){while(--_0x28d06d){_0x748028['push'](_0x748028['shift']());}};_0x275d6d(++_0x4e2f33);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x107b18,_0x5f514d){var _0x580f33=function(_0x5d7b23){while(--_0x5d7b23){_0x107b18['push'](_0x107b18['shift']());}};_0x580f33(++_0x5f514d);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index ba0f923..f8824a5 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 _0x5af9=['/:id/teams','getTeams','post','/:id/users','addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','getAgents'];(function(_0x397f7f,_0x3c97e9){var _0x49984f=function(_0x2f1700){while(--_0x2f1700){_0x397f7f['push'](_0x397f7f['shift']());}};_0x49984f(++_0x3c97e9);}(_0x5af9,0xdc));var _0x95af=function(_0x446208,_0xb483fb){_0x446208=_0x446208-0x0;var _0xe49563=_0x5af9[_0x446208];return _0xe49563;};'use strict';var multer=require(_0x95af('0x0'));var util=require(_0x95af('0x1'));var path=require(_0x95af('0x2'));var timeout=require('connect-timeout');var express=require(_0x95af('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x95af('0x4'));var interaction=require(_0x95af('0x5'));var config=require(_0x95af('0x6'));var controller=require('./voicePrefix.controller');router[_0x95af('0x7')]('/',auth[_0x95af('0x8')](),controller[_0x95af('0x9')]);router[_0x95af('0x7')](_0x95af('0xa'),auth['isAuthenticated'](),controller[_0x95af('0xb')]);router[_0x95af('0x7')](_0x95af('0xc'),auth[_0x95af('0x8')](),controller['show']);router[_0x95af('0x7')]('/:id/users',auth[_0x95af('0x8')](),controller[_0x95af('0xd')]);router[_0x95af('0x7')](_0x95af('0xe'),auth[_0x95af('0x8')](),controller[_0x95af('0xf')]);router[_0x95af('0x10')]('/',auth[_0x95af('0x8')](),controller['create']);router[_0x95af('0x10')](_0x95af('0x11'),auth[_0x95af('0x8')](),controller[_0x95af('0x12')]);router[_0x95af('0x10')](_0x95af('0xe'),auth['isAuthenticated'](),controller[_0x95af('0x13')]);router[_0x95af('0x14')](_0x95af('0xc'),auth[_0x95af('0x8')](),controller[_0x95af('0x15')]);router[_0x95af('0x16')](_0x95af('0xc'),auth['isAuthenticated'](),controller[_0x95af('0x17')]);router[_0x95af('0x16')](_0x95af('0x11'),auth[_0x95af('0x8')](),controller[_0x95af('0x18')]);router[_0x95af('0x16')](_0x95af('0xe'),auth['isAuthenticated'](),controller[_0x95af('0x19')]);module['exports']=router; \ No newline at end of file +var _0xc923=['show','/:id/users','getAgents','/:id/teams','getTeams','post','create','put','update','delete','removeAgents','exports','multer','util','path','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x2bd7cd,_0x55e0a8){var _0x47260b=function(_0x393880){while(--_0x393880){_0x2bd7cd['push'](_0x2bd7cd['shift']());}};_0x47260b(++_0x55e0a8);}(_0xc923,0x1ef));var _0x3c92=function(_0x134fed,_0x7cd6a5){_0x134fed=_0x134fed-0x0;var _0x32a426=_0xc923[_0x134fed];return _0x32a426;};'use strict';var multer=require(_0x3c92('0x0'));var util=require(_0x3c92('0x1'));var path=require(_0x3c92('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3c92('0x3'));var config=require(_0x3c92('0x4'));var controller=require(_0x3c92('0x5'));router[_0x3c92('0x6')]('/',auth[_0x3c92('0x7')](),controller[_0x3c92('0x8')]);router[_0x3c92('0x6')](_0x3c92('0x9'),auth[_0x3c92('0x7')](),controller['describe']);router[_0x3c92('0x6')](_0x3c92('0xa'),auth[_0x3c92('0x7')](),controller[_0x3c92('0xb')]);router['get'](_0x3c92('0xc'),auth['isAuthenticated'](),controller[_0x3c92('0xd')]);router['get'](_0x3c92('0xe'),auth[_0x3c92('0x7')](),controller[_0x3c92('0xf')]);router[_0x3c92('0x10')]('/',auth[_0x3c92('0x7')](),controller[_0x3c92('0x11')]);router['post'](_0x3c92('0xc'),auth[_0x3c92('0x7')](),controller['addAgents']);router[_0x3c92('0x10')](_0x3c92('0xe'),auth['isAuthenticated'](),controller['addTeams']);router[_0x3c92('0x12')](_0x3c92('0xa'),auth[_0x3c92('0x7')](),controller[_0x3c92('0x13')]);router[_0x3c92('0x14')](_0x3c92('0xa'),auth[_0x3c92('0x7')](),controller['destroy']);router[_0x3c92('0x14')](_0x3c92('0xc'),auth['isAuthenticated'](),controller[_0x3c92('0x15')]);router[_0x3c92('0x14')](_0x3c92('0xe'),auth[_0x3c92('0x7')](),controller['removeTeams']);module[_0x3c92('0x16')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 4180d16..98918c2 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 _0xa92a=['sequelize','exports','name','STRING'];(function(_0x4cda06,_0x3cb29c){var _0x48f3fa=function(_0x21f3a6){while(--_0x21f3a6){_0x4cda06['push'](_0x4cda06['shift']());}};_0x48f3fa(++_0x3cb29c);}(_0xa92a,0x78));var _0xaa92=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa92a[_0x5037ab];return _0x512adb;};'use strict';var Sequelize=require(_0xaa92('0x0'));module[_0xaa92('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xaa92('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x4a887a){return'system-'+this['getDataValue'](_0xaa92('0x2'))+'-';}},'description':{'type':Sequelize[_0xaa92('0x3')]},'callerIdAll':{'type':Sequelize[_0xaa92('0x3')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xca8b=['sequelize','exports','STRING','name','system-','INTEGER'];(function(_0x4aa7b8,_0xc69b67){var _0x310986=function(_0x1d18e7){while(--_0x1d18e7){_0x4aa7b8['push'](_0x4aa7b8['shift']());}};_0x310986(++_0xc69b67);}(_0xca8b,0x19e));var _0xbca8=function(_0xd02742,_0x55c7f6){_0xd02742=_0xd02742-0x0;var _0x1738f6=_0xca8b[_0xd02742];return _0x1738f6;};'use strict';var Sequelize=require(_0xbca8('0x0'));module[_0xbca8('0x1')]={'name':{'type':Sequelize[_0xbca8('0x2')],'allowNull':![],'unique':_0xbca8('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x46272e){return _0xbca8('0x4')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0xbca8('0x2')]},'callerIdAll':{'type':Sequelize[_0xbca8('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xbca8('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 95d0e8e..e4a75d6 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 _0x9582=['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','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','VoicePrefix','include','rows','catch','show','params','keys','includeAll','find','describe','sequelize','create','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','getTeams','Team','addTeams','findAll','Agents','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x14bff6,_0x3d3098){var _0x5dd309=function(_0x8d14d5){while(--_0x8d14d5){_0x14bff6['push'](_0x14bff6['shift']());}};_0x5dd309(++_0x3d3098);}(_0x9582,0x95));var _0x2958=function(_0x56feeb,_0x1ac766){_0x56feeb=_0x56feeb-0x0;var _0x7153c7=_0x9582[_0x56feeb];return _0x7153c7;};'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'];config[_0x2958('0x19')]=_[_0x2958('0x1a')](config[_0x2958('0x19')],{'host':_0x2958('0x1b'),'port':0x18eb});var socket=require(_0x2958('0x1c'))(new Redis(config[_0x2958('0x19')]));require('./voicePrefix.socket')[_0x2958('0x1d')](socket);function respondWithStatusCode(_0x2e12d4,_0x4f2a1b){_0x4f2a1b=_0x4f2a1b||0xcc;return function(_0x4c762e){if(_0x4c762e){return _0x2e12d4[_0x2958('0x1e')](_0x4f2a1b);}return _0x2e12d4[_0x2958('0x1f')](_0x4f2a1b)['end']();};}function respondWithResult(_0x3bef50,_0x544563){_0x544563=_0x544563||0xc8;return function(_0x5c3ac3){if(_0x5c3ac3){return _0x3bef50[_0x2958('0x1f')](_0x544563)[_0x2958('0x20')](_0x5c3ac3);}};}function respondWithFilteredResult(_0x55e261,_0x54ef76){return function(_0x28a92c){if(_0x28a92c){var _0x160949=typeof _0x54ef76[_0x2958('0x21')]===_0x2958('0x22')&&typeof _0x54ef76[_0x2958('0x23')]==='undefined';var _0x19a614=_0x28a92c[_0x2958('0x24')];var _0x1a12fa=_0x160949?0x0:_0x54ef76['offset'];var _0x1e77eb=_0x160949?_0x28a92c['count']:_0x54ef76[_0x2958('0x21')]+_0x54ef76['limit'];var _0x5eaf36;if(_0x1e77eb>=_0x19a614){_0x1e77eb=_0x19a614;_0x5eaf36=0xc8;}else{_0x5eaf36=0xce;}_0x55e261[_0x2958('0x1f')](_0x5eaf36);return _0x55e261[_0x2958('0x25')](_0x2958('0x26'),_0x1a12fa+'-'+_0x1e77eb+'/'+_0x19a614)[_0x2958('0x20')](_0x28a92c);}return null;};}function patchUpdates(_0x2202f8){return function(_0x412e42){try{jsonpatch[_0x2958('0x27')](_0x412e42,_0x2202f8,!![]);}catch(_0x2b9818){return BPromise[_0x2958('0x28')](_0x2b9818);}return _0x412e42[_0x2958('0x29')]();};}function saveUpdates(_0xaf5547,_0xd58ae1){return function(_0x119242){if(_0x119242){return _0x119242[_0x2958('0x2a')](_0xaf5547)[_0x2958('0x2b')](function(_0x4f811a){return _0x4f811a;});}return null;};}function removeEntity(_0x574df5,_0x3c1155){return function(_0x33c5b0){if(_0x33c5b0){return _0x33c5b0[_0x2958('0x2c')]()[_0x2958('0x2b')](function(){var _0x52bd32=_0x33c5b0[_0x2958('0x2d')]({'plain':!![]});var _0x57ae96=_0x2958('0x2e');return db[_0x2958('0x2f')][_0x2958('0x2c')]({'where':{'type':_0x57ae96,'resourceId':_0x52bd32['id']}})[_0x2958('0x2b')](function(){return _0x33c5b0;});})[_0x2958('0x2b')](function(){_0x574df5[_0x2958('0x1f')](0xcc)[_0x2958('0x30')]();});}};}function handleEntityNotFound(_0x5d1dfc,_0x21b919){return function(_0x5053d0){if(!_0x5053d0){_0x5d1dfc['sendStatus'](0x194);}return _0x5053d0;};}function handleError(_0x28ee09,_0x15bab3){_0x15bab3=_0x15bab3||0x1f4;return function(_0x973486){logger[_0x2958('0x31')](_0x973486[_0x2958('0x32')]);if(_0x973486[_0x2958('0x33')]){delete _0x973486[_0x2958('0x33')];}_0x28ee09[_0x2958('0x1f')](_0x15bab3)['send'](_0x973486);};}exports[_0x2958('0x34')]=function(_0x32e366,_0x5f34d4){var _0x430484={},_0x5ed343={},_0x380e1d={'count':0x0,'rows':[]};var _0x56d9fd=_[_0x2958('0x35')](db['VoicePrefix'][_0x2958('0x36')],function(_0x2e2a0b){return{'name':_0x2e2a0b[_0x2958('0x37')],'type':_0x2e2a0b[_0x2958('0x38')][_0x2958('0x39')]};});_0x5ed343[_0x2958('0x3a')]=_[_0x2958('0x35')](_0x56d9fd,_0x2958('0x33'));_0x5ed343[_0x2958('0x3b')]=_['keys'](_0x32e366[_0x2958('0x3b')]);_0x5ed343['filters']=_[_0x2958('0x3c')](_0x5ed343['model'],_0x5ed343[_0x2958('0x3b')]);_0x430484[_0x2958('0x3d')]=_[_0x2958('0x3c')](_0x5ed343[_0x2958('0x3a')],qs[_0x2958('0x3e')](_0x32e366[_0x2958('0x3b')][_0x2958('0x3e')]));_0x430484[_0x2958('0x3d')]=_0x430484[_0x2958('0x3d')][_0x2958('0x3f')]?_0x430484[_0x2958('0x3d')]:_0x5ed343[_0x2958('0x3a')];if(!_0x32e366[_0x2958('0x3b')]['hasOwnProperty'](_0x2958('0x40'))){_0x430484[_0x2958('0x23')]=qs[_0x2958('0x23')](_0x32e366[_0x2958('0x3b')]['limit']);_0x430484[_0x2958('0x21')]=qs[_0x2958('0x21')](_0x32e366[_0x2958('0x3b')][_0x2958('0x21')]);}_0x430484[_0x2958('0x41')]=qs[_0x2958('0x42')](_0x32e366[_0x2958('0x3b')][_0x2958('0x42')]);_0x430484[_0x2958('0x43')]=qs[_0x2958('0x44')](_[_0x2958('0x45')](_0x32e366[_0x2958('0x3b')],_0x5ed343[_0x2958('0x44')]),_0x56d9fd);if(_0x32e366['query'][_0x2958('0x46')]){_0x430484[_0x2958('0x43')]=_['merge'](_0x430484['where'],{'$or':_[_0x2958('0x35')](_0x56d9fd,function(_0x265055){if(_0x265055[_0x2958('0x38')]!==_0x2958('0x47')){var _0x3ec87a={};_0x3ec87a[_0x265055[_0x2958('0x33')]]={'$like':'%'+_0x32e366[_0x2958('0x3b')][_0x2958('0x46')]+'%'};return _0x3ec87a;}})});}_0x430484=_[_0x2958('0x48')]({},_0x430484,_0x32e366[_0x2958('0x49')]);var _0x16aae8={'where':_0x430484[_0x2958('0x43')]};return db[_0x2958('0x4a')]['count'](_0x16aae8)[_0x2958('0x2b')](function(_0x112256){_0x380e1d[_0x2958('0x24')]=_0x112256;if(_0x32e366[_0x2958('0x3b')]['includeAll']){_0x430484[_0x2958('0x4b')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x430484);})[_0x2958('0x2b')](function(_0x35993f){_0x380e1d[_0x2958('0x4c')]=_0x35993f;return _0x380e1d;})[_0x2958('0x2b')](respondWithFilteredResult(_0x5f34d4,_0x430484))[_0x2958('0x4d')](handleError(_0x5f34d4,null));};exports[_0x2958('0x4e')]=function(_0x52d40e,_0x17e8d6){var _0x4fb27a={'raw':![],'where':{'id':_0x52d40e[_0x2958('0x4f')]['id']}},_0x488f49={};_0x488f49['model']=_[_0x2958('0x50')](db[_0x2958('0x4a')][_0x2958('0x36')]);_0x488f49[_0x2958('0x3b')]=_[_0x2958('0x50')](_0x52d40e[_0x2958('0x3b')]);_0x488f49[_0x2958('0x44')]=_[_0x2958('0x3c')](_0x488f49['model'],_0x488f49[_0x2958('0x3b')]);_0x4fb27a[_0x2958('0x3d')]=_[_0x2958('0x3c')](_0x488f49[_0x2958('0x3a')],qs['fields'](_0x52d40e[_0x2958('0x3b')][_0x2958('0x3e')]));_0x4fb27a['attributes']=_0x4fb27a[_0x2958('0x3d')][_0x2958('0x3f')]?_0x4fb27a[_0x2958('0x3d')]:_0x488f49[_0x2958('0x3a')];if(_0x52d40e[_0x2958('0x3b')][_0x2958('0x51')]){_0x4fb27a['include']=[{'all':!![]}];}_0x4fb27a=_[_0x2958('0x48')]({},_0x4fb27a,_0x52d40e[_0x2958('0x49')]);return db[_0x2958('0x4a')][_0x2958('0x52')](_0x4fb27a)[_0x2958('0x2b')](handleEntityNotFound(_0x17e8d6,null))[_0x2958('0x2b')](respondWithResult(_0x17e8d6,null))[_0x2958('0x4d')](handleError(_0x17e8d6,null));};exports[_0x2958('0x2c')]=function(_0x2e0fc7,_0x329652){return db[_0x2958('0x4a')][_0x2958('0x52')]({'where':{'id':_0x2e0fc7[_0x2958('0x4f')]['id']}})[_0x2958('0x2b')](handleEntityNotFound(_0x329652,null))[_0x2958('0x2b')](removeEntity(_0x329652,null))[_0x2958('0x4d')](handleError(_0x329652,null));};exports[_0x2958('0x53')]=function(_0x4889b6,_0xa1073b){return db['VoicePrefix'][_0x2958('0x53')]()[_0x2958('0x2b')](respondWithResult(_0xa1073b,null))[_0x2958('0x4d')](handleError(_0xa1073b,null));};exports['create']=function(_0x497a30,_0x39cc25){var _0x394c29;return db[_0x2958('0x54')]['transaction'](function(_0x524562){return db[_0x2958('0x4a')][_0x2958('0x55')](_0x497a30[_0x2958('0x56')],{'transaction':_0x524562})[_0x2958('0x2b')](function(_0x4347c0){_0x394c29=_0x4347c0[_0x2958('0x2d')]({'plain':!![]});return db[_0x2958('0x57')][_0x2958('0x52')]({'where':{'id':_0x394c29[_0x2958('0x58')]},'raw':!![]})['then'](function(_0x30c739){return createVoicePrefixExtensions(_0x394c29,_0x30c739,_0x524562);});});})[_0x2958('0x2b')](function(){var _0x5671d1=_0x497a30[_0x2958('0x59')][_0x2958('0x2d')]({'plain':!![]});if(!_0x5671d1)throw new Error(_0x2958('0x5a'));if(_0x5671d1[_0x2958('0x5b')]===_0x2958('0x59')){var _0x16d927=_0x394c29;return db['UserProfileSection'][_0x2958('0x52')]({'where':{'name':_0x2958('0x2e'),'userProfileId':_0x5671d1[_0x2958('0x5c')]},'raw':!![]})['then'](function(_0x595738){if(_0x595738&&_0x595738[_0x2958('0x5d')]===0x0){return db['UserProfileResource'][_0x2958('0x55')]({'name':_0x16d927['name'],'resourceId':_0x16d927['id'],'type':_0x595738[_0x2958('0x33')],'sectionId':_0x595738['id']},{})[_0x2958('0x2b')](function(){return _0x394c29;});}else{return _0x394c29;}})[_0x2958('0x4d')](function(_0x474f6b){logger[_0x2958('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x474f6b);throw _0x474f6b;});}return _0x394c29;})['then'](respondWithResult(_0x39cc25,null))[_0x2958('0x4d')](handleError(_0x39cc25,null));};function Extension(_0x3e11eb,_0xfa171d,_0x51bf4c,_0x55676f){this[_0x2958('0x5e')]=_0x2958('0x5f');this[_0x2958('0x60')]=_0x3e11eb;this[_0x2958('0x61')]=_0x51bf4c;this[_0x2958('0x38')]=_0x2958('0x62');this[_0x2958('0x63')]=_0x2958('0x64');this[_0x2958('0x65')]=_0xfa171d;this[_0x2958('0x66')]=_0x55676f;}function createVoicePrefixExtensions(_0x2de03a,_0x2bef16,_0x3cc345){return new BPromise(function(_0x49d190,_0x3a4ad9){var _0x8c7203=new Extension(formatPrefixName(_0x2de03a[_0x2958('0x67')]),0x1,_0x2958('0x68'),_0x2958('0x69'));_0x8c7203[_0x2958('0x6a')]=_0x2de03a['id'];return db[_0x2958('0x57')][_0x2958('0x55')](_0x8c7203,{'transaction':_0x3cc345})[_0x2958('0x2b')](function(_0x4dd3de){var _0x2269e1=_0x4dd3de['get']({'plain':!![]});var _0x196901=_[_0x2958('0x35')](addVoicePrefixExtensions(_0x2de03a,_0x2bef16),function(_0x31a596){_0x31a596['VoiceExtensionId']=_0x2269e1['id'];_0x31a596['VoicePrefixId']=_0x2de03a['id'];return _0x31a596;});return db['VoiceExtension'][_0x2958('0x6b')](_0x196901,{'transaction':_0x3cc345})[_0x2958('0x2b')](function(_0x4c1516){if(!_0x4c1516){return _0x3a4ad9(_0x2958('0x6c'));}else{return _0x49d190(_0x4c1516);}})[_0x2958('0x4d')](function(_0xb2fe28){return _0x3a4ad9(_0xb2fe28);});});;});};function addVoicePrefixExtensions(_0x32a216,_0x13f850){var _0x538298=[];var _0x55da00=formatPrefixName(_0x32a216[_0x2958('0x67')]);_0x538298[_0x2958('0x6d')](new Extension(_0x55da00,0x2,_0x2958('0x6e'),_0x2958('0x6f')+_0x32a216['name']));if(_0x32a216[_0x2958('0x70')]){_0x538298[_0x2958('0x6d')](new Extension(_0x55da00,0x3,_0x2958('0x6e'),_0x2958('0x71')+_0x32a216['callerIdAll']));}else{_0x538298['push'](new Extension(_0x55da00,0x3,'NoOp','No\x20callerid\x20available'));}_0x538298[_0x2958('0x6d')](new Extension(_0x55da00,0x4,_0x2958('0x72'),_0x13f850['context']+','+_0x2958('0x73')+(0x8+_0x32a216[_0x2958('0x33')][_0x2958('0x3f')])+'}'+','+0x1));return _0x538298;}function formatPrefixName(_0x234d7f){var _0x1eefb5='_';for(var _0x41ab26=0x0;_0x41ab26<_0x234d7f['length'];_0x41ab26++){if(_0x234d7f[_0x2958('0x74')](_0x41ab26)=='-'){_0x1eefb5+=_0x234d7f[_0x2958('0x74')](_0x41ab26);}else{_0x1eefb5+='['+_0x234d7f[_0x2958('0x74')](_0x41ab26)+']';}}_0x1eefb5+='.';return _0x1eefb5;}exports['update']=function(_0xd61e21,_0x566123,_0x546721){var _0x584429=_0xd61e21['body'];_0x584429[_0x2958('0x67')]='system-'+_0x584429[_0x2958('0x33')]+'-';return db[_0x2958('0x54')][_0x2958('0x75')](function(_0x41ead9){return db[_0x2958('0x4a')][_0x2958('0x2a')](_0x584429,{'where':{'id':_0x584429['id']},'transaction':_0x41ead9})['then'](function(){return db[_0x2958('0x57')][_0x2958('0x2c')]({'where':{'VoicePrefixId':_0x584429['id']},'transaction':_0x41ead9})[_0x2958('0x2b')](function(){return db[_0x2958('0x57')][_0x2958('0x52')]({'where':{'id':_0x584429[_0x2958('0x58')]},'raw':!![]})[_0x2958('0x2b')](function(_0x3674b3){return createVoicePrefixExtensions(_0x584429,_0x3674b3,_0x41ead9);});});});})[_0x2958('0x2b')](function(){return db[_0x2958('0x4a')][_0x2958('0x76')](_0x584429['id']);})[_0x2958('0x2b')](respondWithResult(_0x566123,null))[_0x2958('0x4d')](handleError(_0x566123,null));};exports[_0x2958('0x77')]=function(_0x1a2cf2,_0x2136fe,_0x19b819){return db[_0x2958('0x4a')][_0x2958('0x52')]({'where':{'id':_0x1a2cf2[_0x2958('0x4f')]['id']}})[_0x2958('0x2b')](handleEntityNotFound(_0x2136fe,null))['then'](function(_0x831f42){if(_0x831f42){return _0x831f42[_0x2958('0x77')](_0x1a2cf2[_0x2958('0x56')][_0x2958('0x78')],_[_0x2958('0x79')](_0x1a2cf2['body'],[_0x2958('0x78'),'id'])||{})[_0x2958('0x7a')](function(_0x214b51){for(var _0x1a9f51=0x0;_0x1a9f51<_0x1a2cf2[_0x2958('0x56')][_0x2958('0x78')][_0x2958('0x3f')];_0x1a9f51+=0x1){socket[_0x2958('0x7b')](_0x2958('0x7c'),{'UserId':Number(_0x1a2cf2[_0x2958('0x56')][_0x2958('0x78')][_0x1a9f51]),'VoicePrefixId':Number(_0x1a2cf2[_0x2958('0x4f')]['id'])});}return _0x214b51;});}})[_0x2958('0x2b')](respondWithResult(_0x2136fe,null))[_0x2958('0x4d')](handleError(_0x2136fe,null));};exports[_0x2958('0x7d')]=function(_0x33e4b5,_0x3c7a19,_0x80a4db){return db[_0x2958('0x4a')][_0x2958('0x52')]({'where':{'id':_0x33e4b5[_0x2958('0x4f')]['id']}})[_0x2958('0x2b')](handleEntityNotFound(_0x3c7a19,null))[_0x2958('0x2b')](function(_0x2a3c34){if(_0x2a3c34){return _0x2a3c34['removeAgents'](_0x33e4b5[_0x2958('0x3b')][_0x2958('0x78')])[_0x2958('0x2b')](function(){if(_[_0x2958('0x7e')](_0x33e4b5[_0x2958('0x3b')][_0x2958('0x78')])){for(var _0x1d0bfd=0x0;_0x1d0bfd<_0x33e4b5[_0x2958('0x3b')][_0x2958('0x78')][_0x2958('0x3f')];_0x1d0bfd+=0x1){socket[_0x2958('0x7b')](_0x2958('0x7f'),{'UserId':Number(_0x33e4b5['query'][_0x2958('0x78')][_0x1d0bfd]),'VoicePrefixId':Number(_0x33e4b5[_0x2958('0x4f')]['id'])});}}else{socket[_0x2958('0x7b')](_0x2958('0x7f'),{'UserId':Number(_0x33e4b5[_0x2958('0x3b')][_0x2958('0x78')]),'VoicePrefixId':Number(_0x33e4b5['params']['id'])});}});}})[_0x2958('0x2b')](respondWithStatusCode(_0x3c7a19,null))[_0x2958('0x4d')](handleError(_0x3c7a19,null));};exports[_0x2958('0x80')]=function(_0xe483b9,_0x2b7e0e,_0x558b10){var _0x158c43={};var _0x5be9e={};var _0x2f3f81;var _0x171717;return db[_0x2958('0x4a')][_0x2958('0x81')]({'where':{'id':_0xe483b9[_0x2958('0x4f')]['id']}})[_0x2958('0x2b')](handleEntityNotFound(_0x2b7e0e,null))[_0x2958('0x2b')](function(_0x4739b0){if(_0x4739b0){_0x2f3f81=_0x4739b0;_0x5be9e[_0x2958('0x3a')]=_['keys'](db[_0x2958('0x82')][_0x2958('0x36')]);_0x5be9e['query']=_['keys'](_0xe483b9[_0x2958('0x3b')]);_0x5be9e[_0x2958('0x44')]=_['intersection'](_0x5be9e[_0x2958('0x3a')],_0x5be9e[_0x2958('0x3b')]);_0x158c43[_0x2958('0x3d')]=_['intersection'](_0x5be9e[_0x2958('0x3a')],qs[_0x2958('0x3e')](_0xe483b9[_0x2958('0x3b')][_0x2958('0x3e')]));_0x158c43[_0x2958('0x3d')]=_0x158c43[_0x2958('0x3d')]['length']?_0x158c43[_0x2958('0x3d')]:_0x5be9e[_0x2958('0x3a')];_0x158c43[_0x2958('0x41')]=qs[_0x2958('0x42')](_0xe483b9['query']['sort']);_0x158c43['where']=qs[_0x2958('0x44')](_['pick'](_0xe483b9[_0x2958('0x3b')],_0x5be9e['filters']));if(_0xe483b9['query'][_0x2958('0x46')]){_0x158c43[_0x2958('0x43')]=_['merge'](_0x158c43[_0x2958('0x43')],{'$or':_[_0x2958('0x35')](_0x158c43[_0x2958('0x3d')],function(_0x2aa634){var _0x37b94a={};_0x37b94a[_0x2aa634]={'$like':'%'+_0xe483b9['query'][_0x2958('0x46')]+'%'};return _0x37b94a;})});}_0x158c43=_[_0x2958('0x48')]({},_0x158c43,_0xe483b9[_0x2958('0x49')]);return _0x2f3f81[_0x2958('0x80')](_0x158c43);}})[_0x2958('0x2b')](function(_0x17b2bf){if(_0x17b2bf){_0x171717=_0x17b2bf[_0x2958('0x3f')];if(!_0xe483b9[_0x2958('0x3b')][_0x2958('0x83')]('nolimit')){_0x158c43[_0x2958('0x23')]=qs[_0x2958('0x23')](_0xe483b9[_0x2958('0x3b')]['limit']);_0x158c43[_0x2958('0x21')]=qs[_0x2958('0x21')](_0xe483b9[_0x2958('0x3b')][_0x2958('0x21')]);}return _0x2f3f81[_0x2958('0x80')](_0x158c43);}})[_0x2958('0x2b')](function(_0xb41929){if(_0xb41929){return _0xb41929?{'count':_0x171717,'rows':_0xb41929}:null;}})[_0x2958('0x2b')](respondWithResult(_0x2b7e0e,null))[_0x2958('0x4d')](handleError(_0x2b7e0e,null));};exports[_0x2958('0x84')]=function(_0x57db70,_0x3077ef,_0x5d9ad0){var _0x57ae87={};var _0x2f279a={};var _0x445e57;var _0x561ecc;return db['VoicePrefix']['findOne']({'where':{'id':_0x57db70[_0x2958('0x4f')]['id']}})[_0x2958('0x2b')](handleEntityNotFound(_0x3077ef,null))['then'](function(_0x3876cb){if(_0x3876cb){_0x445e57=_0x3876cb;_0x2f279a[_0x2958('0x3a')]=_[_0x2958('0x50')](db[_0x2958('0x85')][_0x2958('0x36')]);_0x2f279a[_0x2958('0x3b')]=_[_0x2958('0x50')](_0x57db70['query']);_0x2f279a[_0x2958('0x44')]=_[_0x2958('0x3c')](_0x2f279a[_0x2958('0x3a')],_0x2f279a[_0x2958('0x3b')]);_0x57ae87[_0x2958('0x3d')]=_[_0x2958('0x3c')](_0x2f279a[_0x2958('0x3a')],qs[_0x2958('0x3e')](_0x57db70[_0x2958('0x3b')][_0x2958('0x3e')]));_0x57ae87['attributes']=_0x57ae87['attributes'][_0x2958('0x3f')]?_0x57ae87['attributes']:_0x2f279a[_0x2958('0x3a')];_0x57ae87[_0x2958('0x41')]=qs[_0x2958('0x42')](_0x57db70[_0x2958('0x3b')][_0x2958('0x42')]);_0x57ae87[_0x2958('0x43')]=qs[_0x2958('0x44')](_['pick'](_0x57db70[_0x2958('0x3b')],_0x2f279a[_0x2958('0x44')]));if(_0x57db70[_0x2958('0x3b')][_0x2958('0x46')]){_0x57ae87[_0x2958('0x43')]=_['merge'](_0x57ae87[_0x2958('0x43')],{'$or':_[_0x2958('0x35')](_0x57ae87[_0x2958('0x3d')],function(_0x533243){var _0x12ffd1={};_0x12ffd1[_0x533243]={'$like':'%'+_0x57db70[_0x2958('0x3b')][_0x2958('0x46')]+'%'};return _0x12ffd1;})});}_0x57ae87=_[_0x2958('0x48')]({},_0x57ae87,_0x57db70[_0x2958('0x49')]);return _0x445e57[_0x2958('0x84')](_0x57ae87);}})['then'](function(_0x5f4622){if(_0x5f4622){_0x561ecc=_0x5f4622[_0x2958('0x3f')];if(!_0x57db70[_0x2958('0x3b')][_0x2958('0x83')]('nolimit')){_0x57ae87[_0x2958('0x23')]=qs['limit'](_0x57db70[_0x2958('0x3b')][_0x2958('0x23')]);_0x57ae87[_0x2958('0x21')]=qs['offset'](_0x57db70[_0x2958('0x3b')][_0x2958('0x21')]);}return _0x445e57[_0x2958('0x84')](_0x57ae87);}})[_0x2958('0x2b')](function(_0x49bd35){if(_0x49bd35){return _0x49bd35?{'count':_0x561ecc,'rows':_0x49bd35}:null;}})['then'](respondWithResult(_0x3077ef,null))[_0x2958('0x4d')](handleError(_0x3077ef,null));};exports[_0x2958('0x86')]=function(_0x118318,_0x39d235,_0x3eeedf){var _0x498e07=_0x118318[_0x2958('0x56')][_0x2958('0x78')];var _0x1437a7;return db[_0x2958('0x85')][_0x2958('0x87')]({'where':{'id':_0x498e07},'attributes':['id'],'include':[{'model':db[_0x2958('0x82')],'as':_0x2958('0x88'),'attributes':['id',_0x2958('0x33'),'online','voicePause','interface'],'raw':!![]}]})[_0x2958('0x2b')](function(_0x45fcc5){if(_0x45fcc5){_0x1437a7=_0x45fcc5;var _0x3d4314=_['flatMap'](_0x45fcc5,function(_0x413447){var _0x42c8b0=_0x413447[_0x2958('0x2d')]({'plain':!![]});return _0x42c8b0['Agents'];});return db['VoicePrefix']['find']({'where':{'id':_0x118318[_0x2958('0x4f')]['id']}})[_0x2958('0x2b')](function(_0x36c52a){return db[_0x2958('0x54')][_0x2958('0x75')](function(_0x43b9ec){return _0x36c52a['addTeams'](_0x498e07,{'transaction':_0x43b9ec})[_0x2958('0x2b')](function(){return BPromise[_0x2958('0x89')](_0x1437a7,function(_0x9b8367){return db[_0x2958('0x8a')][_0x2958('0x8b')]({'TeamId':_0x9b8367['id'],'VoicePrefixId':_0x118318[_0x2958('0x4f')]['id']},{'transaction':_0x43b9ec});});})['then'](function(){return BPromise['each'](_0x3d4314,function(_0x38a789){return db[_0x2958('0x8c')][_0x2958('0x8d')]({'where':{'UserId':_0x38a789['id'],'VoicePrefixId':_0x118318[_0x2958('0x4f')]['id']},'transaction':_0x43b9ec});});})[_0x2958('0x2b')](function(){_0x3d4314[_0x2958('0x8e')](function(_0x1ec753){socket[_0x2958('0x7b')]('userVoicePrefix:save',{'UserId':_0x1ec753['id'],'VoicePrefixId':_0x36c52a['id']});});});});});}})[_0x2958('0x2b')](respondWithStatusCode(_0x39d235,null))[_0x2958('0x4d')](handleError(_0x39d235,null));};exports[_0x2958('0x8f')]=function(_0x6f44ca,_0x1ddda5,_0x2f5a39){return db[_0x2958('0x85')][_0x2958('0x87')]({'where':{'id':_0x6f44ca['query'][_0x2958('0x78')]},'attributes':['id'],'include':[{'model':db[_0x2958('0x82')],'as':_0x2958('0x88'),'attributes':['id'],'raw':!![]}]})[_0x2958('0x2b')](handleEntityNotFound(_0x1ddda5,null))[_0x2958('0x2b')](function(_0x1c926e){var _0x245a12=_['map'](_0x1c926e,'id');var _0x270846=[];var _0x1d0d0d=[];var _0xc3b770=squel[_0x2958('0x90')]();_0xc3b770[_0x2958('0x91')]('tq.TeamId')['from']('team_has_voice_prefixes','tq')[_0x2958('0x92')]('user_has_teams','ut',_0x2958('0x93'))[_0x2958('0x43')](_0x2958('0x94'),_0x6f44ca['params']['id']);for(var _0x56c6a3=0x0;_0x56c6a3<_0x1c926e[_0x2958('0x3f')];_0x56c6a3+=0x1){let _0x1fd536=_0x1c926e[_0x56c6a3];for(var _0x3fbe11=0x0;_0x3fbe11<_0x1fd536[_0x2958('0x88')][_0x2958('0x3f')];_0x3fbe11+=0x1){let _0x21c020=_0x1fd536[_0x2958('0x88')][_0x3fbe11];var _0x89b78c=_0xc3b770[_0x2958('0x95')]();_0x89b78c[_0x2958('0x43')](_0x2958('0x96'),_0x21c020['id']);_0x1d0d0d[_0x2958('0x6d')](db[_0x2958('0x54')][_0x2958('0x3b')](_0x89b78c[_0x2958('0x97')](),{'type':db[_0x2958('0x54')][_0x2958('0x98')][_0x2958('0x99')]})[_0x2958('0x2b')](function(_0x729aaf){if(_0x729aaf[_0x2958('0x3f')]===0x1){return _0x21c020['id'];}else{var _0x362837=_['every'](_[_0x2958('0x35')](_0x729aaf,_0x2958('0x9a')),function(_0x33af4f){return _[_0x2958('0x9b')](_0x245a12,_0x33af4f);});if(_0x362837){return _0x21c020['id'];}}}));}}return BPromise['all'](_0x1d0d0d)[_0x2958('0x2b')](function(_0x119ff3){_0x270846=_(_0x270846)['union'](_0x119ff3)['compact']()['value']();return db[_0x2958('0x4a')]['find']({'where':{'id':_0x6f44ca[_0x2958('0x4f')]['id']}})[_0x2958('0x2b')](function(_0x26c52f){return db['sequelize'][_0x2958('0x75')](function(_0x2355a0){return _0x26c52f[_0x2958('0x8f')](_0x6f44ca[_0x2958('0x3b')][_0x2958('0x78')],{'transaction':_0x2355a0})[_0x2958('0x2b')](function(){if(!_[_0x2958('0x9c')](_0x270846)){return _0x26c52f[_0x2958('0x7d')](_0x270846,{'transaction':_0x2355a0});}})['then'](function(){_0x270846['forEach'](function(_0x1c5d40){socket[_0x2958('0x7b')](_0x2958('0x7f'),{'UserId':_0x1c5d40,'VoicePrefixId':_0x26c52f['id']});});});});});});})[_0x2958('0x2b')](respondWithStatusCode(_0x1ddda5,null))[_0x2958('0x4d')](handleError(_0x1ddda5,null));}; \ No newline at end of file +var _0x3423=['VoiceExtension','role','user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','charAt','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','order','getAgents','nolimit','getTeams','Team','addTeams','online','Agents','each','TeamVoicePrefix','upsert','findOrCreate','forEach','removeTeams','User','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','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','../../components/auth/service','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','UserProfileResource','then','end','error','stack','name','index','VoicePrefix','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','includeAll','find','params','describe','create','sequelize','body','get'];(function(_0x242d66,_0x550c10){var _0x4d12c9=function(_0x249bcf){while(--_0x249bcf){_0x242d66['push'](_0x242d66['shift']());}};_0x4d12c9(++_0x550c10);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3342('0x0'));var jsonpatch=require(_0x3342('0x1'));var rp=require(_0x3342('0x2'));var moment=require(_0x3342('0x3'));var BPromise=require(_0x3342('0x4'));var Mustache=require(_0x3342('0x5'));var util=require(_0x3342('0x6'));var path=require(_0x3342('0x7'));var sox=require(_0x3342('0x8'));var csv=require(_0x3342('0x9'));var ejs=require(_0x3342('0xa'));var fs=require('fs');var fs_extra=require(_0x3342('0xb'));var _=require(_0x3342('0xc'));var squel=require(_0x3342('0xd'));var crypto=require(_0x3342('0xe'));var jsforce=require(_0x3342('0xf'));var deskjs=require(_0x3342('0x10'));var toCsv=require(_0x3342('0x9'));var querystring=require(_0x3342('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3342('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3342('0x13'));var utils=require(_0x3342('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3342('0x15'));var db=require('../../mysqldb')['db'];config[_0x3342('0x16')]=_[_0x3342('0x17')](config['redis'],{'host':_0x3342('0x18'),'port':0x18eb});var socket=require(_0x3342('0x19'))(new Redis(config[_0x3342('0x16')]));require(_0x3342('0x1a'))[_0x3342('0x1b')](socket);function respondWithStatusCode(_0x104077,_0x34a306){_0x34a306=_0x34a306||0xcc;return function(_0x59be1d){if(_0x59be1d){return _0x104077[_0x3342('0x1c')](_0x34a306);}return _0x104077[_0x3342('0x1d')](_0x34a306)['end']();};}function respondWithResult(_0x40d609,_0x2c9df0){_0x2c9df0=_0x2c9df0||0xc8;return function(_0x51ef91){if(_0x51ef91){return _0x40d609['status'](_0x2c9df0)[_0x3342('0x1e')](_0x51ef91);}};}function respondWithFilteredResult(_0x143cf1,_0x6949fc){return function(_0x2075cb){if(_0x2075cb){var _0x12947a=typeof _0x6949fc[_0x3342('0x1f')]===_0x3342('0x20')&&typeof _0x6949fc[_0x3342('0x21')]===_0x3342('0x20');var _0x4f4c2a=_0x2075cb[_0x3342('0x22')];var _0xda235a=_0x12947a?0x0:_0x6949fc[_0x3342('0x1f')];var _0x5e05f5=_0x12947a?_0x2075cb[_0x3342('0x22')]:_0x6949fc[_0x3342('0x1f')]+_0x6949fc['limit'];var _0xe774b7;if(_0x5e05f5>=_0x4f4c2a){_0x5e05f5=_0x4f4c2a;_0xe774b7=0xc8;}else{_0xe774b7=0xce;}_0x143cf1[_0x3342('0x1d')](_0xe774b7);return _0x143cf1['set'](_0x3342('0x23'),_0xda235a+'-'+_0x5e05f5+'/'+_0x4f4c2a)['json'](_0x2075cb);}return null;};}function patchUpdates(_0x3f271c){return function(_0x38994e){try{jsonpatch[_0x3342('0x24')](_0x38994e,_0x3f271c,!![]);}catch(_0x2dbad1){return BPromise[_0x3342('0x25')](_0x2dbad1);}return _0x38994e[_0x3342('0x26')]();};}function saveUpdates(_0x26eb87,_0x2d8622){return function(_0x5d4f14){if(_0x5d4f14){return _0x5d4f14[_0x3342('0x27')](_0x26eb87)['then'](function(_0x51cf45){return _0x51cf45;});}return null;};}function removeEntity(_0x986ab0,_0x52ba65){return function(_0x5d2f0b){if(_0x5d2f0b){return _0x5d2f0b[_0x3342('0x28')]()['then'](function(){var _0x37df78=_0x5d2f0b['get']({'plain':!![]});var _0x524286='VoicePrefixes';return db[_0x3342('0x29')][_0x3342('0x28')]({'where':{'type':_0x524286,'resourceId':_0x37df78['id']}})[_0x3342('0x2a')](function(){return _0x5d2f0b;});})['then'](function(){_0x986ab0[_0x3342('0x1d')](0xcc)[_0x3342('0x2b')]();});}};}function handleEntityNotFound(_0x1cc542,_0x272a52){return function(_0x4fbfb7){if(!_0x4fbfb7){_0x1cc542[_0x3342('0x1c')](0x194);}return _0x4fbfb7;};}function handleError(_0x3d6810,_0x387ba2){_0x387ba2=_0x387ba2||0x1f4;return function(_0x301114){logger[_0x3342('0x2c')](_0x301114[_0x3342('0x2d')]);if(_0x301114[_0x3342('0x2e')]){delete _0x301114['name'];}_0x3d6810[_0x3342('0x1d')](_0x387ba2)['send'](_0x301114);};}exports[_0x3342('0x2f')]=function(_0x407f8c,_0x508f87){var _0x250396={},_0x1cc42d={},_0x347d52={'count':0x0,'rows':[]};var _0x4e7410=_['map'](db[_0x3342('0x30')][_0x3342('0x31')],function(_0x311cfe){return{'name':_0x311cfe[_0x3342('0x32')],'type':_0x311cfe[_0x3342('0x33')][_0x3342('0x34')]};});_0x1cc42d[_0x3342('0x35')]=_[_0x3342('0x36')](_0x4e7410,_0x3342('0x2e'));_0x1cc42d[_0x3342('0x37')]=_[_0x3342('0x38')](_0x407f8c[_0x3342('0x37')]);_0x1cc42d['filters']=_['intersection'](_0x1cc42d[_0x3342('0x35')],_0x1cc42d['query']);_0x250396[_0x3342('0x39')]=_[_0x3342('0x3a')](_0x1cc42d[_0x3342('0x35')],qs[_0x3342('0x3b')](_0x407f8c[_0x3342('0x37')][_0x3342('0x3b')]));_0x250396[_0x3342('0x39')]=_0x250396['attributes'][_0x3342('0x3c')]?_0x250396[_0x3342('0x39')]:_0x1cc42d[_0x3342('0x35')];if(!_0x407f8c[_0x3342('0x37')][_0x3342('0x3d')]('nolimit')){_0x250396[_0x3342('0x21')]=qs['limit'](_0x407f8c[_0x3342('0x37')][_0x3342('0x21')]);_0x250396[_0x3342('0x1f')]=qs[_0x3342('0x1f')](_0x407f8c['query'][_0x3342('0x1f')]);}_0x250396['order']=qs[_0x3342('0x3e')](_0x407f8c[_0x3342('0x37')][_0x3342('0x3e')]);_0x250396[_0x3342('0x3f')]=qs[_0x3342('0x40')](_[_0x3342('0x41')](_0x407f8c[_0x3342('0x37')],_0x1cc42d['filters']),_0x4e7410);if(_0x407f8c[_0x3342('0x37')][_0x3342('0x42')]){_0x250396['where']=_[_0x3342('0x43')](_0x250396[_0x3342('0x3f')],{'$or':_['map'](_0x4e7410,function(_0x45b956){if(_0x45b956[_0x3342('0x33')]!=='VIRTUAL'){var _0x4985db={};_0x4985db[_0x45b956['name']]={'$like':'%'+_0x407f8c[_0x3342('0x37')][_0x3342('0x42')]+'%'};return _0x4985db;}})});}_0x250396=_['merge']({},_0x250396,_0x407f8c[_0x3342('0x44')]);var _0x2a1f7e={'where':_0x250396[_0x3342('0x3f')]};return db[_0x3342('0x30')][_0x3342('0x22')](_0x2a1f7e)[_0x3342('0x2a')](function(_0x34de7b){_0x347d52[_0x3342('0x22')]=_0x34de7b;if(_0x407f8c['query']['includeAll']){_0x250396[_0x3342('0x45')]=[{'all':!![]}];}return db[_0x3342('0x30')][_0x3342('0x46')](_0x250396);})[_0x3342('0x2a')](function(_0x717946){_0x347d52[_0x3342('0x47')]=_0x717946;return _0x347d52;})['then'](respondWithFilteredResult(_0x508f87,_0x250396))[_0x3342('0x48')](handleError(_0x508f87,null));};exports[_0x3342('0x49')]=function(_0x283ce9,_0x309423){var _0x64e352={'raw':![],'where':{'id':_0x283ce9['params']['id']}},_0x365d6f={};_0x365d6f[_0x3342('0x35')]=_['keys'](db[_0x3342('0x30')][_0x3342('0x31')]);_0x365d6f[_0x3342('0x37')]=_[_0x3342('0x38')](_0x283ce9['query']);_0x365d6f[_0x3342('0x40')]=_[_0x3342('0x3a')](_0x365d6f['model'],_0x365d6f[_0x3342('0x37')]);_0x64e352[_0x3342('0x39')]=_[_0x3342('0x3a')](_0x365d6f[_0x3342('0x35')],qs['fields'](_0x283ce9[_0x3342('0x37')][_0x3342('0x3b')]));_0x64e352['attributes']=_0x64e352[_0x3342('0x39')]['length']?_0x64e352['attributes']:_0x365d6f[_0x3342('0x35')];if(_0x283ce9[_0x3342('0x37')][_0x3342('0x4a')]){_0x64e352[_0x3342('0x45')]=[{'all':!![]}];}_0x64e352=_[_0x3342('0x43')]({},_0x64e352,_0x283ce9[_0x3342('0x44')]);return db[_0x3342('0x30')]['find'](_0x64e352)['then'](handleEntityNotFound(_0x309423,null))[_0x3342('0x2a')](respondWithResult(_0x309423,null))['catch'](handleError(_0x309423,null));};exports[_0x3342('0x28')]=function(_0x5e1202,_0x4c9214){return db['VoicePrefix'][_0x3342('0x4b')]({'where':{'id':_0x5e1202[_0x3342('0x4c')]['id']}})[_0x3342('0x2a')](handleEntityNotFound(_0x4c9214,null))[_0x3342('0x2a')](removeEntity(_0x4c9214,null))['catch'](handleError(_0x4c9214,null));};exports[_0x3342('0x4d')]=function(_0x3a6597,_0x4ce271){return db[_0x3342('0x30')][_0x3342('0x4d')]()[_0x3342('0x2a')](respondWithResult(_0x4ce271,null))['catch'](handleError(_0x4ce271,null));};exports[_0x3342('0x4e')]=function(_0x1497d9,_0x45eb2c){var _0x3be76c;return db[_0x3342('0x4f')]['transaction'](function(_0x2699d2){return db[_0x3342('0x30')][_0x3342('0x4e')](_0x1497d9[_0x3342('0x50')],{'transaction':_0x2699d2})[_0x3342('0x2a')](function(_0x386a5d){_0x3be76c=_0x386a5d[_0x3342('0x51')]({'plain':!![]});return db[_0x3342('0x52')][_0x3342('0x4b')]({'where':{'id':_0x3be76c['VoiceExtensionId']},'raw':!![]})[_0x3342('0x2a')](function(_0x4eebaa){return createVoicePrefixExtensions(_0x3be76c,_0x4eebaa,_0x2699d2);});});})[_0x3342('0x2a')](function(){var _0x524fb6=_0x1497d9['user']['get']({'plain':!![]});if(!_0x524fb6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x524fb6[_0x3342('0x53')]===_0x3342('0x54')){var _0x3cd098=_0x3be76c;return db[_0x3342('0x55')][_0x3342('0x4b')]({'where':{'name':_0x3342('0x56'),'userProfileId':_0x524fb6[_0x3342('0x57')]},'raw':!![]})[_0x3342('0x2a')](function(_0x2938e0){if(_0x2938e0&&_0x2938e0[_0x3342('0x58')]===0x0){return db[_0x3342('0x29')]['create']({'name':_0x3cd098['name'],'resourceId':_0x3cd098['id'],'type':_0x2938e0[_0x3342('0x2e')],'sectionId':_0x2938e0['id']},{})['then'](function(){return _0x3be76c;});}else{return _0x3be76c;}})[_0x3342('0x48')](function(_0x59964b){logger['error'](_0x3342('0x59'),_0x59964b);throw _0x59964b;});}return _0x3be76c;})[_0x3342('0x2a')](respondWithResult(_0x45eb2c,null))[_0x3342('0x48')](handleError(_0x45eb2c,null));};function Extension(_0x5d5e0f,_0x58d37a,_0x54b41d,_0x3cc92a){this['context']=_0x3342('0x5a');this[_0x3342('0x5b')]=_0x5d5e0f;this[_0x3342('0x5c')]=_0x54b41d;this['type']=_0x3342('0x5d');this[_0x3342('0x5e')]=_0x3342('0x5f');this[_0x3342('0x60')]=_0x58d37a;this[_0x3342('0x61')]=_0x3cc92a;}function createVoicePrefixExtensions(_0x19e27b,_0xa4452,_0x57942a){return new BPromise(function(_0x4bc9a9,_0x30e299){var _0x4ec1c4=new Extension(formatPrefixName(_0x19e27b[_0x3342('0x62')]),0x1,_0x3342('0x63'),_0x3342('0x64'));_0x4ec1c4[_0x3342('0x65')]=_0x19e27b['id'];return db[_0x3342('0x52')]['create'](_0x4ec1c4,{'transaction':_0x57942a})[_0x3342('0x2a')](function(_0x3f2fcb){var _0x4c1c6a=_0x3f2fcb[_0x3342('0x51')]({'plain':!![]});var _0x14cc64=_[_0x3342('0x36')](addVoicePrefixExtensions(_0x19e27b,_0xa4452),function(_0x2858a6){_0x2858a6[_0x3342('0x66')]=_0x4c1c6a['id'];_0x2858a6[_0x3342('0x65')]=_0x19e27b['id'];return _0x2858a6;});return db[_0x3342('0x52')][_0x3342('0x67')](_0x14cc64,{'transaction':_0x57942a})[_0x3342('0x2a')](function(_0x36eec8){if(!_0x36eec8){return _0x30e299(_0x3342('0x68'));}else{return _0x4bc9a9(_0x36eec8);}})[_0x3342('0x48')](function(_0x3b01a3){return _0x30e299(_0x3b01a3);});});;});};function addVoicePrefixExtensions(_0x58cbdd,_0x5c9399){var _0x146ffc=[];var _0x4672b5=formatPrefixName(_0x58cbdd[_0x3342('0x62')]);_0x146ffc[_0x3342('0x69')](new Extension(_0x4672b5,0x2,'Set','CDR(prefix)='+_0x58cbdd[_0x3342('0x2e')]));if(_0x58cbdd[_0x3342('0x6a')]){_0x146ffc[_0x3342('0x69')](new Extension(_0x4672b5,0x3,_0x3342('0x6b'),_0x3342('0x6c')+_0x58cbdd[_0x3342('0x6a')]));}else{_0x146ffc[_0x3342('0x69')](new Extension(_0x4672b5,0x3,_0x3342('0x63'),_0x3342('0x6d')));}_0x146ffc[_0x3342('0x69')](new Extension(_0x4672b5,0x4,'goto',_0x5c9399[_0x3342('0x6e')]+','+'${EXTEN:'+(0x8+_0x58cbdd[_0x3342('0x2e')][_0x3342('0x3c')])+'}'+','+0x1));return _0x146ffc;}function formatPrefixName(_0x536fbc){var _0x18cadb='_';for(var _0x3506d4=0x0;_0x3506d4<_0x536fbc['length'];_0x3506d4++){if(_0x536fbc[_0x3342('0x6f')](_0x3506d4)=='-'){_0x18cadb+=_0x536fbc[_0x3342('0x6f')](_0x3506d4);}else{_0x18cadb+='['+_0x536fbc[_0x3342('0x6f')](_0x3506d4)+']';}}_0x18cadb+='.';return _0x18cadb;}exports[_0x3342('0x27')]=function(_0x6b9502,_0x42bc3b,_0x28d937){var _0x57b8ac=_0x6b9502[_0x3342('0x50')];_0x57b8ac['prefix']='system-'+_0x57b8ac[_0x3342('0x2e')]+'-';return db[_0x3342('0x4f')][_0x3342('0x70')](function(_0x28e73f){return db[_0x3342('0x30')][_0x3342('0x27')](_0x57b8ac,{'where':{'id':_0x57b8ac['id']},'transaction':_0x28e73f})[_0x3342('0x2a')](function(){return db[_0x3342('0x52')]['destroy']({'where':{'VoicePrefixId':_0x57b8ac['id']},'transaction':_0x28e73f})[_0x3342('0x2a')](function(){return db[_0x3342('0x52')][_0x3342('0x4b')]({'where':{'id':_0x57b8ac[_0x3342('0x66')]},'raw':!![]})[_0x3342('0x2a')](function(_0x2f02ce){return createVoicePrefixExtensions(_0x57b8ac,_0x2f02ce,_0x28e73f);});});});})[_0x3342('0x2a')](function(){return db['VoicePrefix'][_0x3342('0x71')](_0x57b8ac['id']);})[_0x3342('0x2a')](respondWithResult(_0x42bc3b,null))[_0x3342('0x48')](handleError(_0x42bc3b,null));};exports[_0x3342('0x72')]=function(_0x38a83f,_0x30e493,_0x5a9027){return db['VoicePrefix']['find']({'where':{'id':_0x38a83f[_0x3342('0x4c')]['id']}})[_0x3342('0x2a')](handleEntityNotFound(_0x30e493,null))[_0x3342('0x2a')](function(_0x43cabb){if(_0x43cabb){return _0x43cabb[_0x3342('0x72')](_0x38a83f[_0x3342('0x50')][_0x3342('0x73')],_[_0x3342('0x74')](_0x38a83f['body'],[_0x3342('0x73'),'id'])||{})[_0x3342('0x75')](function(_0x2967d6){for(var _0x42782f=0x0;_0x42782f<_0x38a83f['body'][_0x3342('0x73')][_0x3342('0x3c')];_0x42782f+=0x1){socket[_0x3342('0x76')](_0x3342('0x77'),{'UserId':Number(_0x38a83f[_0x3342('0x50')][_0x3342('0x73')][_0x42782f]),'VoicePrefixId':Number(_0x38a83f[_0x3342('0x4c')]['id'])});}return _0x2967d6;});}})[_0x3342('0x2a')](respondWithResult(_0x30e493,null))[_0x3342('0x48')](handleError(_0x30e493,null));};exports['removeAgents']=function(_0xdc419a,_0x1862b8,_0x58c1b1){return db[_0x3342('0x30')]['find']({'where':{'id':_0xdc419a[_0x3342('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1862b8,null))[_0x3342('0x2a')](function(_0x5b2f46){if(_0x5b2f46){return _0x5b2f46[_0x3342('0x78')](_0xdc419a[_0x3342('0x37')]['ids'])[_0x3342('0x2a')](function(){if(_[_0x3342('0x79')](_0xdc419a['query'][_0x3342('0x73')])){for(var _0x24c9ef=0x0;_0x24c9ef<_0xdc419a[_0x3342('0x37')][_0x3342('0x73')][_0x3342('0x3c')];_0x24c9ef+=0x1){socket[_0x3342('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0xdc419a[_0x3342('0x37')][_0x3342('0x73')][_0x24c9ef]),'VoicePrefixId':Number(_0xdc419a[_0x3342('0x4c')]['id'])});}}else{socket[_0x3342('0x76')](_0x3342('0x7a'),{'UserId':Number(_0xdc419a[_0x3342('0x37')][_0x3342('0x73')]),'VoicePrefixId':Number(_0xdc419a[_0x3342('0x4c')]['id'])});}});}})[_0x3342('0x2a')](respondWithStatusCode(_0x1862b8,null))[_0x3342('0x48')](handleError(_0x1862b8,null));};exports['getAgents']=function(_0x677fc4,_0x7c5834,_0x2e050f){var _0x592122={};var _0x5ef689={};var _0x344a1d;var _0x52e891;return db['VoicePrefix'][_0x3342('0x7b')]({'where':{'id':_0x677fc4[_0x3342('0x4c')]['id']}})['then'](handleEntityNotFound(_0x7c5834,null))[_0x3342('0x2a')](function(_0x4d7132){if(_0x4d7132){_0x344a1d=_0x4d7132;_0x5ef689[_0x3342('0x35')]=_['keys'](db['User'][_0x3342('0x31')]);_0x5ef689[_0x3342('0x37')]=_[_0x3342('0x38')](_0x677fc4['query']);_0x5ef689['filters']=_[_0x3342('0x3a')](_0x5ef689['model'],_0x5ef689[_0x3342('0x37')]);_0x592122[_0x3342('0x39')]=_[_0x3342('0x3a')](_0x5ef689[_0x3342('0x35')],qs['fields'](_0x677fc4['query'][_0x3342('0x3b')]));_0x592122[_0x3342('0x39')]=_0x592122['attributes'][_0x3342('0x3c')]?_0x592122['attributes']:_0x5ef689[_0x3342('0x35')];_0x592122[_0x3342('0x7c')]=qs[_0x3342('0x3e')](_0x677fc4[_0x3342('0x37')][_0x3342('0x3e')]);_0x592122['where']=qs['filters'](_['pick'](_0x677fc4[_0x3342('0x37')],_0x5ef689[_0x3342('0x40')]));if(_0x677fc4[_0x3342('0x37')]['filter']){_0x592122[_0x3342('0x3f')]=_[_0x3342('0x43')](_0x592122[_0x3342('0x3f')],{'$or':_[_0x3342('0x36')](_0x592122[_0x3342('0x39')],function(_0x2355c0){var _0x5cfbf6={};_0x5cfbf6[_0x2355c0]={'$like':'%'+_0x677fc4[_0x3342('0x37')]['filter']+'%'};return _0x5cfbf6;})});}_0x592122=_['merge']({},_0x592122,_0x677fc4['options']);return _0x344a1d[_0x3342('0x7d')](_0x592122);}})[_0x3342('0x2a')](function(_0x50c080){if(_0x50c080){_0x52e891=_0x50c080[_0x3342('0x3c')];if(!_0x677fc4[_0x3342('0x37')]['hasOwnProperty'](_0x3342('0x7e'))){_0x592122[_0x3342('0x21')]=qs[_0x3342('0x21')](_0x677fc4[_0x3342('0x37')][_0x3342('0x21')]);_0x592122[_0x3342('0x1f')]=qs[_0x3342('0x1f')](_0x677fc4[_0x3342('0x37')]['offset']);}return _0x344a1d[_0x3342('0x7d')](_0x592122);}})[_0x3342('0x2a')](function(_0x13738c){if(_0x13738c){return _0x13738c?{'count':_0x52e891,'rows':_0x13738c}:null;}})[_0x3342('0x2a')](respondWithResult(_0x7c5834,null))[_0x3342('0x48')](handleError(_0x7c5834,null));};exports[_0x3342('0x7f')]=function(_0x2d2902,_0x49de28,_0x57a3f8){var _0x1fdaa3={};var _0x2fd436={};var _0x28b7ba;var _0x36ac0d;return db[_0x3342('0x30')][_0x3342('0x7b')]({'where':{'id':_0x2d2902[_0x3342('0x4c')]['id']}})['then'](handleEntityNotFound(_0x49de28,null))[_0x3342('0x2a')](function(_0x15652e){if(_0x15652e){_0x28b7ba=_0x15652e;_0x2fd436[_0x3342('0x35')]=_[_0x3342('0x38')](db[_0x3342('0x80')]['rawAttributes']);_0x2fd436[_0x3342('0x37')]=_[_0x3342('0x38')](_0x2d2902[_0x3342('0x37')]);_0x2fd436[_0x3342('0x40')]=_['intersection'](_0x2fd436[_0x3342('0x35')],_0x2fd436[_0x3342('0x37')]);_0x1fdaa3[_0x3342('0x39')]=_[_0x3342('0x3a')](_0x2fd436[_0x3342('0x35')],qs[_0x3342('0x3b')](_0x2d2902[_0x3342('0x37')]['fields']));_0x1fdaa3['attributes']=_0x1fdaa3[_0x3342('0x39')]['length']?_0x1fdaa3[_0x3342('0x39')]:_0x2fd436[_0x3342('0x35')];_0x1fdaa3[_0x3342('0x7c')]=qs[_0x3342('0x3e')](_0x2d2902[_0x3342('0x37')]['sort']);_0x1fdaa3[_0x3342('0x3f')]=qs[_0x3342('0x40')](_[_0x3342('0x41')](_0x2d2902['query'],_0x2fd436['filters']));if(_0x2d2902[_0x3342('0x37')][_0x3342('0x42')]){_0x1fdaa3[_0x3342('0x3f')]=_[_0x3342('0x43')](_0x1fdaa3[_0x3342('0x3f')],{'$or':_[_0x3342('0x36')](_0x1fdaa3[_0x3342('0x39')],function(_0x2c8c08){var _0x316b4c={};_0x316b4c[_0x2c8c08]={'$like':'%'+_0x2d2902[_0x3342('0x37')][_0x3342('0x42')]+'%'};return _0x316b4c;})});}_0x1fdaa3=_[_0x3342('0x43')]({},_0x1fdaa3,_0x2d2902['options']);return _0x28b7ba['getTeams'](_0x1fdaa3);}})['then'](function(_0x2539a0){if(_0x2539a0){_0x36ac0d=_0x2539a0[_0x3342('0x3c')];if(!_0x2d2902[_0x3342('0x37')][_0x3342('0x3d')](_0x3342('0x7e'))){_0x1fdaa3['limit']=qs[_0x3342('0x21')](_0x2d2902[_0x3342('0x37')][_0x3342('0x21')]);_0x1fdaa3['offset']=qs[_0x3342('0x1f')](_0x2d2902[_0x3342('0x37')]['offset']);}return _0x28b7ba['getTeams'](_0x1fdaa3);}})[_0x3342('0x2a')](function(_0x1cbc11){if(_0x1cbc11){return _0x1cbc11?{'count':_0x36ac0d,'rows':_0x1cbc11}:null;}})[_0x3342('0x2a')](respondWithResult(_0x49de28,null))[_0x3342('0x48')](handleError(_0x49de28,null));};exports[_0x3342('0x81')]=function(_0x51b0f9,_0x48cb53,_0x37fdc5){var _0x26063d=_0x51b0f9[_0x3342('0x50')][_0x3342('0x73')];var _0x43323e;return db[_0x3342('0x80')][_0x3342('0x46')]({'where':{'id':_0x26063d},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x3342('0x82'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x3c1c34){if(_0x3c1c34){_0x43323e=_0x3c1c34;var _0x319a6e=_['flatMap'](_0x3c1c34,function(_0x36739b){var _0x4dcbb1=_0x36739b['get']({'plain':!![]});return _0x4dcbb1[_0x3342('0x83')];});return db['VoicePrefix'][_0x3342('0x4b')]({'where':{'id':_0x51b0f9[_0x3342('0x4c')]['id']}})[_0x3342('0x2a')](function(_0x2b029d){return db[_0x3342('0x4f')][_0x3342('0x70')](function(_0x5aa6ce){return _0x2b029d[_0x3342('0x81')](_0x26063d,{'transaction':_0x5aa6ce})[_0x3342('0x2a')](function(){return BPromise[_0x3342('0x84')](_0x43323e,function(_0x5d9c1e){return db[_0x3342('0x85')][_0x3342('0x86')]({'TeamId':_0x5d9c1e['id'],'VoicePrefixId':_0x51b0f9[_0x3342('0x4c')]['id']},{'transaction':_0x5aa6ce});});})[_0x3342('0x2a')](function(){return BPromise[_0x3342('0x84')](_0x319a6e,function(_0x41de0c){return db['UserVoicePrefix'][_0x3342('0x87')]({'where':{'UserId':_0x41de0c['id'],'VoicePrefixId':_0x51b0f9[_0x3342('0x4c')]['id']},'transaction':_0x5aa6ce});});})[_0x3342('0x2a')](function(){_0x319a6e[_0x3342('0x88')](function(_0x441c2a){socket['emit'](_0x3342('0x77'),{'UserId':_0x441c2a['id'],'VoicePrefixId':_0x2b029d['id']});});});});});}})[_0x3342('0x2a')](respondWithStatusCode(_0x48cb53,null))[_0x3342('0x48')](handleError(_0x48cb53,null));};exports[_0x3342('0x89')]=function(_0x498de2,_0x100d41,_0x56251e){return db[_0x3342('0x80')][_0x3342('0x46')]({'where':{'id':_0x498de2[_0x3342('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3342('0x8a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x3342('0x2a')](handleEntityNotFound(_0x100d41,null))['then'](function(_0x340350){var _0xe6d040=_[_0x3342('0x36')](_0x340350,'id');var _0x58253f=[];var _0x25b867=[];var _0x3a6d87=squel[_0x3342('0x8b')]();_0x3a6d87[_0x3342('0x8c')](_0x3342('0x8d'))[_0x3342('0x8e')](_0x3342('0x8f'),'tq')['join'](_0x3342('0x90'),'ut',_0x3342('0x91'))[_0x3342('0x3f')]('VoicePrefixId\x20=\x20?',_0x498de2[_0x3342('0x4c')]['id']);for(var _0x3c0eb8=0x0;_0x3c0eb8<_0x340350[_0x3342('0x3c')];_0x3c0eb8+=0x1){let _0x2b5df1=_0x340350[_0x3c0eb8];for(var _0xe57bc1=0x0;_0xe57bc1<_0x2b5df1[_0x3342('0x83')][_0x3342('0x3c')];_0xe57bc1+=0x1){let _0x2ae81c=_0x2b5df1['Agents'][_0xe57bc1];var _0x448a3c=_0x3a6d87[_0x3342('0x92')]();_0x448a3c['where'](_0x3342('0x93'),_0x2ae81c['id']);_0x25b867[_0x3342('0x69')](db[_0x3342('0x4f')][_0x3342('0x37')](_0x448a3c[_0x3342('0x94')](),{'type':db[_0x3342('0x4f')][_0x3342('0x95')][_0x3342('0x96')]})[_0x3342('0x2a')](function(_0x31095f){if(_0x31095f[_0x3342('0x3c')]===0x1){return _0x2ae81c['id'];}else{var _0x4a301d=_['every'](_[_0x3342('0x36')](_0x31095f,_0x3342('0x97')),function(_0x107e1b){return _[_0x3342('0x98')](_0xe6d040,_0x107e1b);});if(_0x4a301d){return _0x2ae81c['id'];}}}));}}return BPromise[_0x3342('0x99')](_0x25b867)[_0x3342('0x2a')](function(_0x34f15a){_0x58253f=_(_0x58253f)[_0x3342('0x9a')](_0x34f15a)[_0x3342('0x9b')]()[_0x3342('0x9c')]();return db[_0x3342('0x30')][_0x3342('0x4b')]({'where':{'id':_0x498de2[_0x3342('0x4c')]['id']}})[_0x3342('0x2a')](function(_0x45d548){return db[_0x3342('0x4f')]['transaction'](function(_0x4e1359){return _0x45d548[_0x3342('0x89')](_0x498de2[_0x3342('0x37')]['ids'],{'transaction':_0x4e1359})[_0x3342('0x2a')](function(){if(!_[_0x3342('0x9d')](_0x58253f)){return _0x45d548['removeAgents'](_0x58253f,{'transaction':_0x4e1359});}})[_0x3342('0x2a')](function(){_0x58253f['forEach'](function(_0x24049f){socket[_0x3342('0x76')](_0x3342('0x7a'),{'UserId':_0x24049f,'VoicePrefixId':_0x45d548['id']});});});});});});})[_0x3342('0x2a')](respondWithStatusCode(_0x100d41,null))[_0x3342('0x48')](handleError(_0x100d41,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 0352b44..c3438fe 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 _0xe2b6=['save','update','remove','emit','hook','exports','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x51cb1f,_0x4ba4ac){var _0xcf7afa=function(_0x711e15){while(--_0x711e15){_0x51cb1f['push'](_0x51cb1f['shift']());}};_0xcf7afa(++_0x4ba4ac);}(_0xe2b6,0x7b));var _0x6e2b=function(_0x17e4f5,_0x4496ce){_0x17e4f5=_0x17e4f5-0x0;var _0x2d6e8a=_0xe2b6[_0x17e4f5];return _0x2d6e8a;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x6e2b('0x0'))['db'][_0x6e2b('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6e2b('0x2')](0x0);var events={'afterCreate':_0x6e2b('0x3'),'afterUpdate':_0x6e2b('0x4'),'afterDestroy':_0x6e2b('0x5')};function emitEvent(_0x2118b1){return function(_0x3eb0d3,_0x4a91a8,_0x4deb8b){VoicePrefixEvents['emit'](_0x2118b1+':'+_0x3eb0d3['id'],_0x3eb0d3);VoicePrefixEvents[_0x6e2b('0x6')](_0x2118b1,_0x3eb0d3);_0x4deb8b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x6e2b('0x7')](e,emitEvent(event));}}module[_0x6e2b('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x40bc=['VoicePrefix','setMaxListeners','save','remove','emit','events','../../mysqldb'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x40bc,0x67));var _0xc40b=function(_0x2d8d24,_0x2f292f){_0x2d8d24=_0x2d8d24-0x0;var _0x1c5d30=_0x40bc[_0x2d8d24];return _0x1c5d30;};'use strict';var EventEmitter=require(_0xc40b('0x0'));var VoicePrefix=require(_0xc40b('0x1'))['db'][_0xc40b('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc40b('0x3')](0x0);var events={'afterCreate':_0xc40b('0x4'),'afterUpdate':'update','afterDestroy':_0xc40b('0x5')};function emitEvent(_0x5dc946){return function(_0x4bd02c,_0x48933f,_0x5232a0){VoicePrefixEvents[_0xc40b('0x6')](_0x5dc946+':'+_0x4bd02c['id'],_0x4bd02c);VoicePrefixEvents['emit'](_0x5dc946,_0x4bd02c);_0x5232a0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 6d4d6b1..7071202 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 _0xe0fa=['bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','voice_prefixes','lodash','util','../../config/logger','moment'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xe0fa,0x1b8));var _0xae0f=function(_0x2ff762,_0x342c0b){_0x2ff762=_0x2ff762-0x0;var _0x158b02=_0xe0fa[_0x2ff762];return _0x158b02;};'use strict';var _=require(_0xae0f('0x0'));var util=require(_0xae0f('0x1'));var logger=require(_0xae0f('0x2'))('api');var moment=require(_0xae0f('0x3'));var BPromise=require(_0xae0f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xae0f('0x5'));var rimraf=require(_0xae0f('0x6'));var config=require(_0xae0f('0x7'));var attributes=require(_0xae0f('0x8'));module[_0xae0f('0x9')]=function(_0x3efe92,_0x4ac1df){return _0x3efe92[_0xae0f('0xa')]('VoicePrefix',attributes,{'tableName':_0xae0f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb082=['request-promise','path','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','api','moment','bluebird'];(function(_0x1d937f,_0x3c7b6a){var _0x2d2505=function(_0x4be994){while(--_0x4be994){_0x1d937f['push'](_0x1d937f['shift']());}};_0x2d2505(++_0x3c7b6a);}(_0xb082,0xc7));var _0x2b08=function(_0x435e16,_0x164211){_0x435e16=_0x435e16-0x0;var _0x4f2e6b=_0xb082[_0x435e16];return _0x4f2e6b;};'use strict';var _=require(_0x2b08('0x0'));var util=require(_0x2b08('0x1'));var logger=require('../../config/logger')(_0x2b08('0x2'));var moment=require(_0x2b08('0x3'));var BPromise=require(_0x2b08('0x4'));var rp=require(_0x2b08('0x5'));var fs=require('fs');var path=require(_0x2b08('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2b08('0x7'));module[_0x2b08('0x8')]=function(_0x1e7ca9,_0x3fdc18){return _0x1e7ca9[_0x2b08('0x9')](_0x2b08('0xa'),attributes,{'tableName':_0x2b08('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index da690f1..009ece7 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 _0x81d4=['moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','error','code','message','util'];(function(_0x15f15d,_0x445248){var _0x1bdab0=function(_0x5f06d8){while(--_0x5f06d8){_0x15f15d['push'](_0x15f15d['shift']());}};_0x1bdab0(++_0x445248);}(_0x81d4,0x197));var _0x481d=function(_0x20194a,_0x16d2ce){_0x20194a=_0x20194a-0x0;var _0x5174bd=_0x81d4[_0x20194a];return _0x5174bd;};'use strict';var _=require('lodash');var util=require(_0x481d('0x0'));var moment=require(_0x481d('0x1'));var BPromise=require('bluebird');var rs=require(_0x481d('0x2'));var fs=require('fs');var Redis=require(_0x481d('0x3'));var db=require(_0x481d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x481d('0x5'));var config=require(_0x481d('0x6'));var jayson=require(_0x481d('0x7'));var client=jayson['client'][_0x481d('0x8')]({'port':0x232a});config[_0x481d('0x9')]=_[_0x481d('0xa')](config[_0x481d('0x9')],{'host':_0x481d('0xb'),'port':0x18eb});var socket=require(_0x481d('0xc'))(new Redis(config['redis']));require(_0x481d('0xd'))[_0x481d('0xe')](socket);function respondWithRpcPromise(_0x1c1464,_0x57108c,_0x135981){return new BPromise(function(_0x44e436,_0x5ea1d3){return client[_0x481d('0xf')](_0x1c1464,_0x135981)[_0x481d('0x10')](function(_0x22f802){logger[_0x481d('0x11')](_0x481d('0x12'),_0x57108c,_0x481d('0x13'));logger[_0x481d('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x57108c,_0x481d('0x13'),JSON['stringify'](_0x22f802));if(_0x22f802['error']){if(_0x22f802[_0x481d('0x15')][_0x481d('0x16')]===0x1f4){logger[_0x481d('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x57108c,_0x22f802[_0x481d('0x15')]['message']);return _0x5ea1d3(_0x22f802[_0x481d('0x15')][_0x481d('0x17')]);}logger[_0x481d('0x15')](_0x481d('0x12'),_0x57108c,_0x22f802[_0x481d('0x15')]['message']);return _0x44e436(_0x22f802[_0x481d('0x15')][_0x481d('0x17')]);}else{logger[_0x481d('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x57108c,_0x481d('0x13'));_0x44e436(_0x22f802['result'][_0x481d('0x17')]);}})['catch'](function(_0x149212){logger['error'](_0x481d('0x12'),_0x57108c,_0x149212);_0x5ea1d3(_0x149212);});});} \ No newline at end of file +var _0x2542=['register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket'];(function(_0x52c46a,_0x3cd892){var _0x545b0f=function(_0x1b0cd6){while(--_0x1b0cd6){_0x52c46a['push'](_0x52c46a['shift']());}};_0x545b0f(++_0x3cd892);}(_0x2542,0x169));var _0x2254=function(_0x59c3f2,_0x505d4a){_0x59c3f2=_0x59c3f2-0x0;var _0x473b4d=_0x2542[_0x59c3f2];return _0x473b4d;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});config[_0x2254('0xb')]=_[_0x2254('0xc')](config[_0x2254('0xb')],{'host':_0x2254('0xd'),'port':0x18eb});var socket=require(_0x2254('0xe'))(new Redis(config[_0x2254('0xb')]));require(_0x2254('0xf'))[_0x2254('0x10')](socket);function respondWithRpcPromise(_0x1ae415,_0x38fb2b,_0x5b1ab9){return new BPromise(function(_0x336e14,_0x2655ea){return client[_0x2254('0x11')](_0x1ae415,_0x5b1ab9)[_0x2254('0x12')](function(_0x575d58){logger['info'](_0x2254('0x13'),_0x38fb2b,_0x2254('0x14'));logger[_0x2254('0x15')](_0x2254('0x16'),_0x38fb2b,_0x2254('0x14'),JSON[_0x2254('0x17')](_0x575d58));if(_0x575d58['error']){if(_0x575d58[_0x2254('0x18')][_0x2254('0x19')]===0x1f4){logger['error'](_0x2254('0x13'),_0x38fb2b,_0x575d58[_0x2254('0x18')][_0x2254('0x1a')]);return _0x2655ea(_0x575d58[_0x2254('0x18')][_0x2254('0x1a')]);}logger[_0x2254('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x38fb2b,_0x575d58[_0x2254('0x18')]['message']);return _0x336e14(_0x575d58[_0x2254('0x18')][_0x2254('0x1a')]);}else{logger[_0x2254('0x1b')](_0x2254('0x13'),_0x38fb2b,_0x2254('0x14'));_0x336e14(_0x575d58[_0x2254('0x1c')]['message']);}})['catch'](function(_0x5ec98d){logger[_0x2254('0x18')](_0x2254('0x13'),_0x38fb2b,_0x5ec98d);_0x2655ea(_0x5ec98d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 801d110..deb5a10 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 _0x4e83=['save','remove','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x43eb89,_0x62d271){var _0x385fcb=function(_0x5c38e5){while(--_0x5c38e5){_0x43eb89['push'](_0x43eb89['shift']());}};_0x385fcb(++_0x62d271);}(_0x4e83,0x88));var _0x34e8=function(_0x4b91fb,_0xe92b69){_0x4b91fb=_0x4b91fb-0x0;var _0x5eca8e=_0x4e83[_0x4b91fb];return _0x5eca8e;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x34e8('0x0'),_0x34e8('0x1'),_0x34e8('0x2')];function createListener(_0x3d2157,_0x5bec5b){return function(_0x33b4e1){_0x5bec5b[_0x34e8('0x3')](_0x3d2157,_0x33b4e1);};}function removeListener(_0x3b6abf,_0x2e88cb){return function(){VoicePrefixEvents[_0x34e8('0x4')](_0x3b6abf,_0x2e88cb);};}exports[_0x34e8('0x5')]=function(_0x1017db){for(var _0x38d4e0=0x0,_0x320b00=events[_0x34e8('0x6')];_0x38d4e0<_0x320b00;_0x38d4e0++){var _0x188f11=events[_0x38d4e0];var _0x18e178=createListener(_0x34e8('0x7')+_0x188f11,_0x1017db);VoicePrefixEvents['on'](_0x188f11,_0x18e178);}}; \ No newline at end of file +var _0x9993=['voicePrefix:','./voicePrefix.events','remove','update','removeListener','length'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9993,0x109));var _0x3999=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x9993[_0x4a53d];return _0x27410e;};'use strict';var VoicePrefixEvents=require(_0x3999('0x0'));var events=['save',_0x3999('0x1'),_0x3999('0x2')];function createListener(_0x1fd8c5,_0x4b3123){return function(_0x464d6f){_0x4b3123['emit'](_0x1fd8c5,_0x464d6f);};}function removeListener(_0x3e3ea7,_0x145a79){return function(){VoicePrefixEvents[_0x3999('0x3')](_0x3e3ea7,_0x145a79);};}exports['register']=function(_0x9f0add){for(var _0x59fcf8=0x0,_0x536de7=events[_0x3999('0x4')];_0x59fcf8<_0x536de7;_0x59fcf8++){var _0x85b5af=events[_0x59fcf8];var _0x4c1a49=createListener(_0x3999('0x5')+_0x85b5af,_0x9f0add);VoicePrefixEvents['on'](_0x85b5af,_0x4c1a49);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index a40a497..19f3ec3 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(_0x1bd4ea,_0x3c80d8){var _0x2ed321=function(_0x10ecc0){while(--_0x10ecc0){_0x1bd4ea['push'](_0x1bd4ea['shift']());}};_0x2ed321(++_0x3c80d8);}(_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('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x3d9557,_0x5d09d2){var _0x359ff8=function(_0x784fa){while(--_0x784fa){_0x3d9557['push'](_0x3d9557['shift']());}};_0x359ff8(++_0x5d09d2);}(_0xb10b,0x12a));var _0xbb10=function(_0x582269,_0x529ef3){_0x582269=_0x582269-0x0;var _0x506c1f=_0xb10b[_0x582269];return _0x506c1f;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 5a81964..b8c624a 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 _0x477c=['Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','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)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','ringall','leastrecent','fewestcalls','random','wrandom','rrordered','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','outbound','preview','booked','roundrobin','includes','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x477c,0x8a));var _0xc477=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x477c[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0xc477('0x0'));module[_0xc477('0x1')]={'name':{'type':Sequelize[_0xc477('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc477('0x3')](_0xc477('0x4'),'outbound'),'allowNull':![],'defaultValue':_0xc477('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xc477('0x3')]('rr',_0xc477('0x5'),_0xc477('0x6'),_0xc477('0x7'),_0xc477('0x8'),'rrmemory','linear',_0xc477('0x9'),_0xc477('0xa')),'allowNull':![],'defaultValue':_0xc477('0x5'),'set':function(_0x87e7a2){this[_0xc477('0xb')](_0xc477('0xc'),_0x87e7a2?_0x87e7a2:_0xc477('0xd'));},'get':function(){var _0x298397=this[_0xc477('0xe')](_0xc477('0xf'));var _0x15f164=this[_0xc477('0xe')](_0xc477('0x10'));var _0x5ce110=this[_0xc477('0xe')](_0xc477('0xc'));if(_0x298397===_0xc477('0x11')){if(_0x15f164===_0xc477('0x12')){return null;}if(_0x15f164===_0xc477('0x13')&&!['rrmemory',_0xc477('0x14')][_0xc477('0x15')](_0x5ce110)){this[_0xc477('0xb')](_0xc477('0xc'),_0xc477('0xd'));}}return _0x5ce110;}},'servicelevel':{'type':Sequelize[_0xc477('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xc477('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xc477('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xc477('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xc477('0x2')]},'weight':{'type':Sequelize[_0xc477('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xc477('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xc477('0x3')](_0xc477('0x17'),'no'),'defaultValue':_0xc477('0x17')},'autopause':{'type':Sequelize['ENUM'](_0xc477('0x17'),'no',_0xc477('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xc477('0x16')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xc477('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xc477('0x3')](_0xc477('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xc477('0x3')](_0xc477('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xc477('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xc477('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xc477('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xc477('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xc477('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xc477('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xc477('0x3')](_0xc477('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xc477('0x3')](_0xc477('0x17'),'no'),'defaultValue':_0xc477('0x17')},'announce_holdtime':{'type':Sequelize[_0xc477('0x3')](_0xc477('0x17'),'no',_0xc477('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xc477('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xc477('0x3')](_0xc477('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0xc477('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xc477('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xc477('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xc477('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xc477('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xc477('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xc477('0x2')]},'queue_quantity1':{'type':Sequelize[_0xc477('0x2')]},'queue_quantity2':{'type':Sequelize[_0xc477('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xc477('0x2')]},'periodic_announce':{'type':Sequelize[_0xc477('0x1a')],'set':function(_0x53769d){this[_0xc477('0xb')]('periodic_announce',_0x53769d?_0x53769d[_0xc477('0x1b')](','):[]);},'get':function(){return this[_0xc477('0xe')](_0xc477('0x1c'))?this[_0xc477('0xe')](_0xc477('0x1c'))[_0xc477('0x1d')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xc477('0x17'),'set':function(_0x19ccd9){this['setDataValue']('joinempty',_0x19ccd9?_0x19ccd9['join'](','):undefined);},'get':function(){return this[_0xc477('0xe')](_0xc477('0x1e'))?this[_0xc477('0xe')]('joinempty')[_0xc477('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xc477('0x2')],'defaultValue':'no','set':function(_0x5e9adf){this[_0xc477('0xb')](_0xc477('0x1f'),_0x5e9adf?_0x5e9adf[_0xc477('0x1b')](','):undefined);},'get':function(){return this[_0xc477('0xe')](_0xc477('0x1f'))?this[_0xc477('0xe')]('leavewhenempty')[_0xc477('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xc477('0x3')](_0xc477('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xc477('0x3')](_0xc477('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc477('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xc477('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xc477('0x2')]},'description':{'type':Sequelize[_0xc477('0x2')]},'acw':{'type':Sequelize[_0xc477('0x20')],'defaultValue':0x0,'set':function(_0x1072fd){this[_0xc477('0xb')]('acw',_0x1072fd);if(_0x1072fd){if(this[_0xc477('0xe')](_0xc477('0x21'))<0x2){this[_0xc477('0xb')](_0xc477('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xc477('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc477('0x22')},'dialMethod':{'type':Sequelize['ENUM'](_0xc477('0x12'),_0xc477('0x23'),_0xc477('0x24'),_0xc477('0x25'),_0xc477('0x13')),'defaultValue':_0xc477('0x23'),'comment':_0xc477('0x26')},'dialLimitChannel':{'type':Sequelize[_0xc477('0x16')](0x4)[_0xc477('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc477('0x28')},'dialLimitQueue':{'type':Sequelize[_0xc477('0x16')](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[_0xc477('0x29')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xc477('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0xc477('0x3')](_0xc477('0x2b'),_0xc477('0x2c')),'defaultValue':_0xc477('0x2c'),'comment':_0xc477('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xc477('0x2e')},'dialPredictiveInterval':{'type':Sequelize[_0xc477('0x16')](0x3)[_0xc477('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xc477('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc477('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc477('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xc477('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc477('0x30')},'dialQueueOptions':{'type':Sequelize[_0xc477('0x2')],'defaultValue':_0xc477('0x31'),'comment':_0xc477('0x32')},'dialQueueTimeout':{'type':Sequelize[_0xc477('0x16')](0x3)[_0xc477('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc477('0x33')},'dialQueueProject':{'type':Sequelize[_0xc477('0x2')],'comment':_0xc477('0x34')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc477('0x16')](0x3)[_0xc477('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc477('0x35')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc477('0x16')](0x5)[_0xc477('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xc477('0x16')](0x3)[_0xc477('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc477('0x36')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc477('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc477('0x37')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc477('0x16')](0x3)[_0xc477('0x27')],'defaultValue':0x3,'comment':_0xc477('0x38')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc477('0x16')](0x5)[_0xc477('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc477('0x39')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc477('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xc477('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc477('0x2')],'defaultValue':_0xc477('0x3a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xc477('0x3')](_0xc477('0x3b'),'never',_0xc477('0x3c')),'defaultValue':_0xc477('0x3b')},'dialAMDActive':{'type':Sequelize[_0xc477('0x20')],'defaultValue':0x0,'comment':_0xc477('0x3d')},'dialAMDInitialSilence':{'type':Sequelize[_0xc477('0x16')](0x9)[_0xc477('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc477('0x3e')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xc477('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc477('0x3f')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc477('0x16')](0x9)[_0xc477('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc477('0x40')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc477('0x16')](0x9)[_0xc477('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc477('0x41')},'dialAMDMinWordLength':{'type':Sequelize[_0xc477('0x16')](0x9)[_0xc477('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc477('0x42')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc477('0x16')](0x9)[_0xc477('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc477('0x43')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc477('0x16')](0x9)[_0xc477('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc477('0x44')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc477('0x16')](0x5)[_0xc477('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc477('0x45')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc477('0x16')](0x9)[_0xc477('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc477('0x46')},'dialRecallMeTimeout':{'type':Sequelize[_0xc477('0x16')](0x5)[_0xc477('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xc477('0x47')},'dialRecallInQueue':{'type':Sequelize[_0xc477('0x20')],'defaultValue':0x0,'comment':_0xc477('0x48')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc477('0x3')]('DESC',_0xc477('0x49')),'defaultValue':_0xc477('0x4a')},'dialQueueProject2':{'type':Sequelize[_0xc477('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc477('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xc477('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xc477('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc477('0x4b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc477('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc477('0x4c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc477('0x16')](0x5)[_0xc477('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc477('0x4d')},'dialDropMaxRetry':{'type':Sequelize[_0xc477('0x16')](0x3)[_0xc477('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc477('0x4e')},'dialDropRetryFrequency':{'type':Sequelize[_0xc477('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc477('0x4f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc477('0x16')](0x3)[_0xc477('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc477('0x50')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc477('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc477('0x51')},'dialMachineMaxRetry':{'type':Sequelize[_0xc477('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc477('0x52')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc477('0x16')](0x5)[_0xc477('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc477('0x16')](0x3)[_0xc477('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc477('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc477('0x53')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc477('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc477('0x54'),'set':function(_0x243e9d){if(!_0x243e9d)this[_0xc477('0xb')]('mandatoryDispositionPauseId',null);this[_0xc477('0xb')](_0xc477('0x55'),_0x243e9d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xc477('0x16')](0x3)[_0xc477('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xc477('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xc477('0x16')](0x3)[_0xc477('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xc477('0x20')],'defaultValue':![]}}; \ No newline at end of file +var _0xb553=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','exports','name','ENUM','inbound','outbound','STRING','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','strategy','getDataValue','dialMethod','preview','roundrobin','includes','INTEGER','yes','all','TEXT','setDataValue','periodic_announce','split','joinempty','leavewhenempty','join','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','Active/Disactive\x20AMD','#AMD\x20Greeting','#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','ASC','DESC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x37a4bc,_0x288035){var _0x12b0b5=function(_0xc5351f){while(--_0xc5351f){_0x37a4bc['push'](_0x37a4bc['shift']());}};_0x12b0b5(++_0x288035);}(_0xb553,0xa9));var _0x3b55=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xb553[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require('sequelize');module[_0x3b55('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3b55('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3b55('0x2')](_0x3b55('0x3'),_0x3b55('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x3b55('0x5')],'defaultValue':_0x3b55('0x6')},'announce':{'type':Sequelize[_0x3b55('0x5')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x3b55('0x7'),_0x3b55('0x8'),_0x3b55('0x9'),_0x3b55('0xa'),_0x3b55('0xb'),_0x3b55('0xc'),_0x3b55('0xd'),_0x3b55('0xe')),'allowNull':![],'defaultValue':'ringall','set':function(_0x5866eb){this['setDataValue'](_0x3b55('0xf'),_0x5866eb?_0x5866eb:'rrmemory');},'get':function(){var _0x1cb13d=this['getDataValue']('type');var _0x4e6204=this[_0x3b55('0x10')](_0x3b55('0x11'));var _0xbd5a52=this['getDataValue'](_0x3b55('0xf'));if(_0x1cb13d===_0x3b55('0x4')){if(_0x4e6204===_0x3b55('0x12')){return null;}if(_0x4e6204==='booked'&&!['rrmemory',_0x3b55('0x13')][_0x3b55('0x14')](_0xbd5a52)){this['setDataValue'](_0x3b55('0xf'),_0x3b55('0xb'));}}return _0xbd5a52;}},'servicelevel':{'type':Sequelize[_0x3b55('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x3b55('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x3b55('0x5')]},'weight':{'type':Sequelize[_0x3b55('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x3b55('0x2')](_0x3b55('0x16'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x3b55('0x2')]('yes','no',_0x3b55('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x3b55('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x3b55('0x2')](_0x3b55('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x3b55('0x2')](_0x3b55('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x3b55('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x3b55('0x2')](_0x3b55('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x3b55('0x2')](_0x3b55('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x3b55('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x3b55('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x3b55('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x3b55('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x3b55('0x2')](_0x3b55('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x3b55('0x16'),'no'),'defaultValue':_0x3b55('0x16')},'announce_holdtime':{'type':Sequelize[_0x3b55('0x2')]('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x3b55('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x3b55('0x2')](_0x3b55('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x3b55('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x3b55('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x3b55('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x3b55('0x5')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x3b55('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x3b55('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x3b55('0x5')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x3b55('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x3b55('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x3b55('0x5')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x3b55('0x5')]},'queue_less_than':{'type':Sequelize[_0x3b55('0x5')]},'periodic_announce':{'type':Sequelize[_0x3b55('0x18')],'set':function(_0x4e200b){this[_0x3b55('0x19')]('periodic_announce',_0x4e200b?_0x4e200b['join'](','):[]);},'get':function(){return this[_0x3b55('0x10')](_0x3b55('0x1a'))?this['getDataValue'](_0x3b55('0x1a'))[_0x3b55('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x3b55('0x5')],'defaultValue':_0x3b55('0x16'),'set':function(_0x4066b4){this[_0x3b55('0x19')](_0x3b55('0x1c'),_0x4066b4?_0x4066b4['join'](','):undefined);},'get':function(){return this[_0x3b55('0x10')](_0x3b55('0x1c'))?this[_0x3b55('0x10')]('joinempty')[_0x3b55('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x3b55('0x5')],'defaultValue':'no','set':function(_0x230146){this[_0x3b55('0x19')](_0x3b55('0x1d'),_0x230146?_0x230146[_0x3b55('0x1e')](','):undefined);},'get':function(){return this[_0x3b55('0x10')](_0x3b55('0x1d'))?this[_0x3b55('0x10')]('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x3b55('0x2')](_0x3b55('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x3b55('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x3b55('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x3b55('0x2')](_0x3b55('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x3b55('0x5')]},'description':{'type':Sequelize[_0x3b55('0x5')]},'acw':{'type':Sequelize[_0x3b55('0x1f')],'defaultValue':0x0,'set':function(_0x4f0443){this[_0x3b55('0x19')](_0x3b55('0x20'),_0x4f0443);if(_0x4f0443){if(this[_0x3b55('0x10')](_0x3b55('0x21'))<0x2){this[_0x3b55('0x19')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x3b55('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x3b55('0x1f')],'defaultValue':0x0,'comment':_0x3b55('0x22')},'dialMethod':{'type':Sequelize[_0x3b55('0x2')](_0x3b55('0x12'),_0x3b55('0x23'),_0x3b55('0x24'),_0x3b55('0x25'),'booked'),'defaultValue':_0x3b55('0x23'),'comment':_0x3b55('0x26')},'dialLimitChannel':{'type':Sequelize[_0x3b55('0x15')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3b55('0x27')},'dialLimitQueue':{'type':Sequelize[_0x3b55('0x15')](0x4)[_0x3b55('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3b55('0x29')},'dialPowerLevel':{'type':Sequelize[_0x3b55('0x2a')](0x2)[_0x3b55('0x28')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x3b55('0x2')](_0x3b55('0x2b'),'dropRate'),'defaultValue':_0x3b55('0x2c'),'comment':_0x3b55('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x3b55('0x2a')](0x2)[_0x3b55('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x3b55('0x2e')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x3b55('0x28')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x3b55('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize[_0x3b55('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3b55('0x5')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b55('0x30')},'dialQueueOptions':{'type':Sequelize[_0x3b55('0x5')],'defaultValue':_0x3b55('0x31'),'comment':_0x3b55('0x32')},'dialQueueTimeout':{'type':Sequelize[_0x3b55('0x15')](0x3)[_0x3b55('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b55('0x33')},'dialQueueProject':{'type':Sequelize[_0x3b55('0x5')],'comment':_0x3b55('0x34')},'dialCongestionMaxRetry':{'type':Sequelize[_0x3b55('0x15')](0x3)[_0x3b55('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b55('0x35')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3b55('0x15')](0x5)[_0x3b55('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b55('0x36')},'dialBusyMaxRetry':{'type':Sequelize[_0x3b55('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b55('0x37')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3b55('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b55('0x38')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3b55('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x3b55('0x39')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b55('0x3a')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3b55('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3b55('0x3b')},'dialTimezone':{'type':Sequelize[_0x3b55('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3b55('0x5')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x3b55('0x5')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x3b55('0x3c'),_0x3b55('0x3d'),'onlyIfOpen'),'defaultValue':_0x3b55('0x3c')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3b55('0x3e')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x3b55('0x15')](0x9)[_0x3b55('0x28')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3b55('0x3f')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3b55('0x15')](0x9)[_0x3b55('0x28')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3b55('0x15')](0x9)[_0x3b55('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3b55('0x40')},'dialAMDMinWordLength':{'type':Sequelize[_0x3b55('0x15')](0x9)[_0x3b55('0x28')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3b55('0x41')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3b55('0x28')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3b55('0x15')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3b55('0x15')](0x5)[_0x3b55('0x28')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3b55('0x42')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3b55('0x43')},'dialRecallMeTimeout':{'type':Sequelize[_0x3b55('0x15')](0x5)[_0x3b55('0x28')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x3b55('0x44')},'dialRecallInQueue':{'type':Sequelize[_0x3b55('0x1f')],'defaultValue':0x0,'comment':_0x3b55('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3b55('0x2')]('DESC',_0x3b55('0x46')),'defaultValue':_0x3b55('0x47')},'dialQueueProject2':{'type':Sequelize[_0x3b55('0x5')],'comment':_0x3b55('0x34')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x3b55('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x3b55('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x3b55('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x3b55('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3b55('0x15')](0x3)[_0x3b55('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b55('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3b55('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b55('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0x3b55('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b55('0x4a')},'dialDropRetryFrequency':{'type':Sequelize[_0x3b55('0x15')](0x5)[_0x3b55('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b55('0x4b')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3b55('0x15')](0x3)[_0x3b55('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b55('0x4c')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3b55('0x15')](0x5)[_0x3b55('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b55('0x4d')},'dialMachineMaxRetry':{'type':Sequelize[_0x3b55('0x15')](0x3)[_0x3b55('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b55('0x4e')},'dialMachineRetryFrequency':{'type':Sequelize[_0x3b55('0x15')](0x5)[_0x3b55('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3b55('0x15')](0x3)[_0x3b55('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3b55('0x15')](0x5)[_0x3b55('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b55('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3b55('0x15')],'allowNull':!![],'comment':_0x3b55('0x50')},'mandatoryDisposition':{'type':Sequelize[_0x3b55('0x1f')],'defaultValue':![],'comment':_0x3b55('0x51'),'set':function(_0x12e4d5){if(!_0x12e4d5)this[_0x3b55('0x19')](_0x3b55('0x52'),null);this[_0x3b55('0x19')]('mandatoryDisposition',_0x12e4d5);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x3b55('0x15')](0x3)[_0x3b55('0x28')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x3b55('0x15')](0x3)[_0x3b55('0x28')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x3b55('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x3b55('0x15')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x3b55('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 6185a18..4dad6c8 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 _0x55ca=['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','clone','merge','omit','createdAt','updatedAt','VoiceQueues','UserProfileResource','findOne','CmHopper','hasOwnProperty','nolimit','limit','order','sort','where','rows','getHopperHistories','CmHopperHistory','pick','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','flatMap','penalty','sequelize','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','select','tq.TeamId','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','union','transaction','isEmpty','userVoiceQueue:remove','addAgents','ids','spread','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','ContactId','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','COALESCE(phone,\x27\x27)','push','cm_hopper_additional_phones','CmHopperId','h.id','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','phone\x20IS\x20NOT\x20NULL','removeBlackLists','moment','bluebird','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','status','end','json','undefined','count','offset','set','Content-Range','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','sendStatus','error','stack','name','send','index','map','VoiceQueue','key','getOptions','include','query','findAll','catch','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','options'];(function(_0x49abdb,_0x419c4d){var _0x131ed7=function(_0x387035){while(--_0x387035){_0x49abdb['push'](_0x49abdb['shift']());}};_0x131ed7(++_0x419c4d);}(_0x55ca,0x126));var _0xa55c=function(_0x21e79a,_0x5a7990){_0x21e79a=_0x21e79a-0x0;var _0x506c02=_0x55ca[_0x21e79a];return _0x506c02;};'use strict';var moment=require(_0xa55c('0x0'));var BPromise=require(_0xa55c('0x1'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0xa55c('0x2'));var qs=require(_0xa55c('0x3'));var logger=require('../../config/logger')(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var db=require(_0xa55c('0x6'))['db'];config[_0xa55c('0x7')]=_[_0xa55c('0x8')](config[_0xa55c('0x7')],{'host':_0xa55c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa55c('0x7')]));require(_0xa55c('0xa'))['register'](socket);function respondWithStatusCode(_0x291996,_0x290d28){_0x290d28=_0x290d28||0xcc;return function(_0x52a3bc){if(_0x52a3bc){return _0x291996['sendStatus'](_0x290d28);}return _0x291996[_0xa55c('0xb')](_0x290d28)[_0xa55c('0xc')]();};}function respondWithResult(_0x381d07,_0x5d8e5a){_0x5d8e5a=_0x5d8e5a||0xc8;return function(_0x31646d){if(_0x31646d){return _0x381d07[_0xa55c('0xb')](_0x5d8e5a)[_0xa55c('0xd')](_0x31646d);}};}function respondWithFilteredResult(_0x70c2de,_0x3998f7){return function(_0x15eec8){if(_0x15eec8){var _0x5d47ff=typeof _0x3998f7['offset']===_0xa55c('0xe')&&typeof _0x3998f7['limit']==='undefined';var _0x59ea8d=_0x15eec8[_0xa55c('0xf')];var _0x3930e4=_0x5d47ff?0x0:_0x3998f7[_0xa55c('0x10')];var _0x938bd6=_0x5d47ff?_0x15eec8[_0xa55c('0xf')]:_0x3998f7[_0xa55c('0x10')]+_0x3998f7['limit'];var _0x3ccf65;if(_0x938bd6>=_0x59ea8d){_0x938bd6=_0x59ea8d;_0x3ccf65=0xc8;}else{_0x3ccf65=0xce;}_0x70c2de[_0xa55c('0xb')](_0x3ccf65);return _0x70c2de[_0xa55c('0x11')](_0xa55c('0x12'),_0x3930e4+'-'+_0x938bd6+'/'+_0x59ea8d)[_0xa55c('0xd')](_0x15eec8);}return null;};}function saveUpdates(_0x3ae86b){return function(_0x51590e){if(_0x51590e){return _0x51590e[_0xa55c('0x13')](_0x3ae86b)[_0xa55c('0x14')](function(_0x4cee3c){return _0x4cee3c;});}return null;};}function removeEntity(_0x3d4c9e){return function(_0x104a99){if(_0x104a99){return _0x104a99[_0xa55c('0x15')]()[_0xa55c('0x14')](function(){var _0x23a1ae=_0x104a99[_0xa55c('0x16')]({'plain':!![]});var _0x4c0daf=[{'name':'VoiceQueues','value':_0xa55c('0x17'),'ignore':![]},{'name':_0xa55c('0x18'),'value':_0xa55c('0x19'),'ignore':![]}];var _0x4cfe10=_(_0x4c0daf)[_0xa55c('0x1a')](_0xa55c('0x1b'))['map'](_0xa55c('0x1c'))[_0xa55c('0x1c')]();if(_[_0xa55c('0x1d')](_0x4cfe10,_0x23a1ae[_0xa55c('0x1e')])){return;}var _0x234372=_['find'](_0x4c0daf,[_0xa55c('0x1c'),_0x23a1ae['type']])['name'];return db['UserProfileResource'][_0xa55c('0x15')]({'where':{'type':_0x234372,'resourceId':_0x23a1ae['id']}})['then'](function(){return _0x104a99;});})[_0xa55c('0x14')](function(){_0x3d4c9e[_0xa55c('0xb')](0xcc)[_0xa55c('0xc')]();});}};}function handleEntityNotFound(_0xf0e574){return function(_0x2313a9){if(!_0x2313a9){_0xf0e574[_0xa55c('0x1f')](0x194);}return _0x2313a9;};}function handleError(_0x1da633,_0x11e7f7){_0x11e7f7=_0x11e7f7||0x1f4;return function(_0x192df2){logger[_0xa55c('0x20')](_0x192df2[_0xa55c('0x21')]);if(_0x192df2['name']){delete _0x192df2[_0xa55c('0x22')];}_0x1da633[_0xa55c('0xb')](_0x11e7f7)[_0xa55c('0x23')](_0x192df2);};}exports[_0xa55c('0x24')]=function(_0x5d940d,_0x1377b0){var _0x22f6b6={};var _0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x25')](db[_0xa55c('0x26')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x1e')][_0xa55c('0x27')]};});_0x22f6b6=qs[_0xa55c('0x28')](_0x201941,_0x5d940d);var _0x223813={'where':_0x22f6b6['where']};return db[_0xa55c('0x26')][_0xa55c('0xf')](_0x223813)[_0xa55c('0x14')](function(_0x20da31){_0x1b8388[_0xa55c('0xf')]=_0x20da31;_0x22f6b6[_0xa55c('0x29')]=qs[_0xa55c('0x29')](_0x5d940d[_0xa55c('0x2a')]);return db[_0xa55c('0x26')][_0xa55c('0x2b')](_0x22f6b6);})[_0xa55c('0x14')](function(_0x4eb7c4){_0x1b8388['rows']=_0x4eb7c4;return _0x1b8388;})[_0xa55c('0x14')](respondWithFilteredResult(_0x1377b0,_0x22f6b6))[_0xa55c('0x2c')](handleError(_0x1377b0,null));};exports['show']=function(_0x30fadd,_0x2f0110){var _0x2e9623={'raw':![],'where':{'id':_0x30fadd[_0xa55c('0x2d')]['id']}},_0x1839ac={};_0x1839ac[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x26')][_0xa55c('0x30')]);_0x1839ac['query']=_['keys'](_0x30fadd['query']);_0x1839ac[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x1839ac[_0xa55c('0x2e')],_0x1839ac['query']);_0x2e9623[_0xa55c('0x33')]=_['intersection'](_0x1839ac[_0xa55c('0x2e')],qs['fields'](_0x30fadd[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x2e9623[_0xa55c('0x33')]=_0x2e9623['attributes'][_0xa55c('0x35')]?_0x2e9623[_0xa55c('0x33')]:_0x1839ac['model'];if(_0x30fadd[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x2e9623['include']=[{'all':!![]}];}_0x2e9623=_['merge']({},_0x2e9623,_0x30fadd[_0xa55c('0x37')]);return db['VoiceQueue'][_0xa55c('0x38')](_0x2e9623)[_0xa55c('0x14')](handleEntityNotFound(_0x2f0110,null))['then'](respondWithResult(_0x2f0110,null))['catch'](handleError(_0x2f0110,null));};exports['create']=function(_0x4de781,_0x3b3308){return db[_0xa55c('0x26')][_0xa55c('0x39')](_0x4de781[_0xa55c('0x3a')],{})[_0xa55c('0x14')](function(_0x56d17c){var _0x3d52d8=_0x4de781[_0xa55c('0x3b')][_0xa55c('0x16')]({'plain':!![]});if(!_0x3d52d8)throw new Error(_0xa55c('0x3c'));if(_0x3d52d8[_0xa55c('0x3d')]===_0xa55c('0x3b')){var _0x554620=_0x56d17c[_0xa55c('0x16')]({'plain':!![]});var _0x5ee63d=[{'name':'VoiceQueues','value':_0xa55c('0x17')},{'name':_0xa55c('0x18'),'value':'outbound'}];var _0x2bd98b=_['find'](_0x5ee63d,['value',_0x554620[_0xa55c('0x1e')]])[_0xa55c('0x22')];return db[_0xa55c('0x3e')]['find']({'where':{'name':_0x2bd98b,'userProfileId':_0x3d52d8[_0xa55c('0x3f')]},'raw':!![]})[_0xa55c('0x14')](function(_0x5d9d5d){if(_0x5d9d5d&&_0x5d9d5d[_0xa55c('0x40')]===0x0){return db['UserProfileResource'][_0xa55c('0x39')]({'name':_0x554620[_0xa55c('0x22')],'resourceId':_0x554620['id'],'type':_0x5d9d5d['name'],'sectionId':_0x5d9d5d['id']},{})[_0xa55c('0x14')](function(){return _0x56d17c;});}else{return _0x56d17c;}})[_0xa55c('0x2c')](function(_0x5d834d){logger[_0xa55c('0x20')](_0xa55c('0x41'),_0x5d834d);throw _0x5d834d;});}return _0x56d17c;})[_0xa55c('0x14')](respondWithResult(_0x3b3308,0xc9))['catch'](handleError(_0x3b3308,null));};exports[_0xa55c('0x42')]=function(_0x582901,_0x2f9717){var _0x3a8af4={'where':{'id':_0x582901['params']['id']}},_0x451269={};_0x451269[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db['VoiceQueue'][_0xa55c('0x30')]);_0x3a8af4[_0xa55c('0x33')]=_['intersection'](_0x451269[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x582901['query'][_0xa55c('0x34')]));_0x3a8af4[_0xa55c('0x33')]=_0x3a8af4[_0xa55c('0x33')][_0xa55c('0x35')]?_0x3a8af4['attributes']:_0x451269[_0xa55c('0x2e')];if(_0x582901['query'][_0xa55c('0x36')]){_0x3a8af4[_0xa55c('0x29')]=[{'all':!![]}];}_0x3a8af4=_[_0xa55c('0x43')]({},_0x3a8af4,_0x582901['options']);return db[_0xa55c('0x26')][_0xa55c('0x38')](_0x3a8af4)['then'](handleEntityNotFound(_0x2f9717,null))[_0xa55c('0x14')](function(_0x34de95){if(_0x34de95){var _0x3822b7=_0x34de95[_0xa55c('0x16')]({'plain':!![]});_0x3822b7=qs[_0xa55c('0x44')](_0x3822b7,['id',_0xa55c('0x45'),_0xa55c('0x46')]);_0x582901[_0xa55c('0x3a')]=_[_0xa55c('0x44')](_0x582901[_0xa55c('0x3a')],['id','createdAt',_0xa55c('0x46')]);return db[_0xa55c('0x26')][_0xa55c('0x39')](_['merge'](_0x3822b7,_0x582901[_0xa55c('0x3a')]),{'include':_0x582901[_0xa55c('0x2a')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x14')](function(_0x4fa412){var _0x2b6a0e=_0x582901[_0xa55c('0x3b')][_0xa55c('0x16')]({'plain':!![]});if(!_0x2b6a0e)throw new Error(_0xa55c('0x3c'));if(_0x2b6a0e[_0xa55c('0x3d')]==='user'){var _0x44b7c1=_0x4fa412[_0xa55c('0x16')]({'plain':!![]});var _0x4b85cc=[{'name':_0xa55c('0x47'),'value':_0xa55c('0x17')},{'name':_0xa55c('0x18'),'value':_0xa55c('0x19')}];var _0x50176b=_['find'](_0x4b85cc,[_0xa55c('0x1c'),_0x44b7c1[_0xa55c('0x1e')]])[_0xa55c('0x22')];return db[_0xa55c('0x3e')]['find']({'where':{'name':_0x50176b,'userProfileId':_0x2b6a0e[_0xa55c('0x3f')]},'raw':!![]})['then'](function(_0x2742e4){if(_0x2742e4&&_0x2742e4[_0xa55c('0x40')]===0x0){return db[_0xa55c('0x48')][_0xa55c('0x39')]({'name':_0x44b7c1[_0xa55c('0x22')],'resourceId':_0x44b7c1['id'],'type':_0x2742e4['name'],'sectionId':_0x2742e4['id']},{})[_0xa55c('0x14')](function(){return _0x4fa412;});}else{return _0x4fa412;}})['catch'](function(_0x23f67f){logger[_0xa55c('0x20')](_0xa55c('0x41'),_0x23f67f);throw _0x23f67f;});}return _0x4fa412;});}})[_0xa55c('0x14')](respondWithResult(_0x2f9717,0xc9))[_0xa55c('0x2c')](handleError(_0x2f9717,null));};exports[_0xa55c('0x13')]=function(_0x5d14e0,_0x53e2be){if(_0x5d14e0[_0xa55c('0x3a')]['id']){delete _0x5d14e0[_0xa55c('0x3a')]['id'];}return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x5d14e0[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x53e2be,null))[_0xa55c('0x14')](saveUpdates(_0x5d14e0[_0xa55c('0x3a')],null))[_0xa55c('0x14')](respondWithResult(_0x53e2be,null))[_0xa55c('0x2c')](handleError(_0x53e2be,null));};exports[_0xa55c('0x15')]=function(_0x493f51,_0xdd92c1){return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x493f51[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0xdd92c1,null))['then'](removeEntity(_0xdd92c1,null))[_0xa55c('0x2c')](handleError(_0xdd92c1,null));};exports['getHoppers']=function(_0x2e482a,_0x5e3a28){var _0x3495a7={'raw':![],'where':{}};var _0x5a8897={};var _0x34edc5={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x2e482a[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x5e3a28,null))[_0xa55c('0x14')](function(_0xafaf8c){if(_0xafaf8c){_0x5a8897[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x4a')]['rawAttributes']);_0x5a8897[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x2e482a['query']);_0x5a8897[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x5a8897[_0xa55c('0x2e')],_0x5a8897[_0xa55c('0x2a')]);_0x3495a7[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x5a8897[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x2e482a['query'][_0xa55c('0x34')]));_0x3495a7[_0xa55c('0x33')]=_0x3495a7[_0xa55c('0x33')][_0xa55c('0x35')]?_0x3495a7[_0xa55c('0x33')]:_0x5a8897[_0xa55c('0x2e')];if(!_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x3495a7['limit']=qs[_0xa55c('0x4d')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x3495a7[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x10')]);}_0x3495a7[_0xa55c('0x4e')]=qs[_0xa55c('0x4f')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x3495a7['where']=qs[_0xa55c('0x31')](_['pick'](_0x2e482a[_0xa55c('0x2a')],_0x5a8897[_0xa55c('0x31')]));_0x3495a7[_0xa55c('0x50')]['VoiceQueueId']=_0xafaf8c['id'];if(_0x2e482a['query'][_0xa55c('0x1a')]){_0x3495a7[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x50')],{'$or':_['map'](_0x3495a7[_0xa55c('0x33')],function(_0xd02251){var _0x8ea1c6={};_0x8ea1c6[_0xd02251]={'$like':'%'+_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x8ea1c6;})});}_0x3495a7=_['merge']({},_0x3495a7,_0x2e482a['options']);return db[_0xa55c('0x4a')][_0xa55c('0xf')]({'where':_0x3495a7[_0xa55c('0x50')]})[_0xa55c('0x14')](function(_0x1af9d5){_0x34edc5['count']=_0x1af9d5;if(_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x3495a7['include']=[{'all':!![]}];}return db[_0xa55c('0x4a')][_0xa55c('0x2b')](_0x3495a7);})[_0xa55c('0x14')](function(_0x4dcb93){_0x34edc5[_0xa55c('0x51')]=_0x4dcb93;return _0x34edc5;});}})[_0xa55c('0x14')](respondWithFilteredResult(_0x5e3a28,_0x3495a7))[_0xa55c('0x2c')](handleError(_0x5e3a28,null));};exports[_0xa55c('0x52')]=function(_0x232143,_0x506f74){var _0x25bd5b={'raw':!![],'where':{}};var _0x2e2cf6={};var _0x4bf233={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x232143['params']['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x506f74,null))[_0xa55c('0x14')](function(_0x2f13db){if(_0x2f13db){_0x2e2cf6[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x53')][_0xa55c('0x30')]);_0x2e2cf6[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x232143['query']);_0x2e2cf6[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x2e2cf6[_0xa55c('0x2e')],_0x2e2cf6[_0xa55c('0x2a')]);_0x25bd5b['attributes']=_[_0xa55c('0x32')](_0x2e2cf6[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x232143[_0xa55c('0x2a')]['fields']));_0x25bd5b['attributes']=_0x25bd5b[_0xa55c('0x33')][_0xa55c('0x35')]?_0x25bd5b[_0xa55c('0x33')]:_0x2e2cf6[_0xa55c('0x2e')];if(!_0x232143['query']['hasOwnProperty'](_0xa55c('0x4c'))){_0x25bd5b[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x232143[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x25bd5b[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x232143['query'][_0xa55c('0x10')]);}_0x25bd5b['order']=qs[_0xa55c('0x4f')](_0x232143['query'][_0xa55c('0x4f')]);_0x25bd5b[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x232143[_0xa55c('0x2a')],_0x2e2cf6[_0xa55c('0x31')]));_0x25bd5b[_0xa55c('0x50')][_0xa55c('0x55')]=_0x2f13db['id'];if(_0x232143['query']['filter']){_0x25bd5b[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x25bd5b[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x25bd5b[_0xa55c('0x33')],function(_0x137728){var _0x47e8e2={};_0x47e8e2[_0x137728]={'$like':'%'+_0x232143[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x47e8e2;})});}_0x25bd5b=_[_0xa55c('0x43')]({},_0x25bd5b,_0x232143[_0xa55c('0x37')]);return db[_0xa55c('0x53')][_0xa55c('0xf')]({'where':_0x25bd5b[_0xa55c('0x50')]})[_0xa55c('0x14')](function(_0x58b670){_0x4bf233[_0xa55c('0xf')]=_0x58b670;if(_0x232143[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x25bd5b[_0xa55c('0x29')]=[{'all':!![]}];}return db[_0xa55c('0x53')]['findAll'](_0x25bd5b);})[_0xa55c('0x14')](function(_0x2ab1f2){_0x4bf233['rows']=_0x2ab1f2;return _0x4bf233;});}})['then'](respondWithFilteredResult(_0x506f74,_0x25bd5b))[_0xa55c('0x2c')](handleError(_0x506f74,null));};exports[_0xa55c('0x56')]=function(_0x5c2229,_0x559e71){var _0x579726={'raw':!![],'where':{}};var _0x5ab79e={};var _0xf8e295={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x5c2229[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x559e71,null))[_0xa55c('0x14')](function(_0x568a5b){if(_0x568a5b){_0x5ab79e[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x57')][_0xa55c('0x30')]);_0x5ab79e['query']=_[_0xa55c('0x2f')](_0x5c2229[_0xa55c('0x2a')]);_0x5ab79e[_0xa55c('0x31')]=_['intersection'](_0x5ab79e[_0xa55c('0x2e')],_0x5ab79e['query']);_0x579726['attributes']=_[_0xa55c('0x32')](_0x5ab79e[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x579726[_0xa55c('0x33')]=_0x579726[_0xa55c('0x33')]['length']?_0x579726['attributes']:_0x5ab79e[_0xa55c('0x2e')];if(!_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x579726[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x579726[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x5c2229['query'][_0xa55c('0x10')]);}_0x579726[_0xa55c('0x4e')]=qs['sort'](_0x5c2229[_0xa55c('0x2a')]['sort']);_0x579726[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x5c2229[_0xa55c('0x2a')],_0x5ab79e[_0xa55c('0x31')]));_0x579726['where'][_0xa55c('0x55')]=_0x568a5b['id'];if(_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x579726[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x579726[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x579726['attributes'],function(_0x49a307){var _0x5c08e5={};_0x5c08e5[_0x49a307]={'$like':'%'+_0x5c2229[_0xa55c('0x2a')]['filter']+'%'};return _0x5c08e5;})});}_0x579726=_[_0xa55c('0x43')]({},_0x579726,_0x5c2229[_0xa55c('0x37')]);return db[_0xa55c('0x57')][_0xa55c('0xf')]({'where':_0x579726[_0xa55c('0x50')]})['then'](function(_0x253d7a){_0xf8e295['count']=_0x253d7a;if(_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x579726[_0xa55c('0x29')]=[{'all':!![]}];}return db[_0xa55c('0x57')]['findAll'](_0x579726);})[_0xa55c('0x14')](function(_0x46f8ab){_0xf8e295[_0xa55c('0x51')]=_0x46f8ab;return _0xf8e295;});}})[_0xa55c('0x14')](respondWithFilteredResult(_0x559e71,_0x579726))[_0xa55c('0x2c')](handleError(_0x559e71,null));};exports[_0xa55c('0x58')]=function(_0x270bd0,_0x472c73){var _0x5bae40={'raw':!![],'where':{}};var _0x147962={};var _0x1538dc={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x270bd0[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x472c73,null))['then'](function(_0x46124b){if(_0x46124b){_0x147962['model']=_[_0xa55c('0x2f')](db['CmHopperBlack'][_0xa55c('0x30')]);_0x147962[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x270bd0['query']);_0x147962[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x147962[_0xa55c('0x2e')],_0x147962['query']);_0x5bae40[_0xa55c('0x33')]=_['intersection'](_0x147962[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x270bd0['query'][_0xa55c('0x34')]));_0x5bae40['attributes']=_0x5bae40[_0xa55c('0x33')][_0xa55c('0x35')]?_0x5bae40['attributes']:_0x147962[_0xa55c('0x2e')];if(!_0x270bd0[_0xa55c('0x2a')]['hasOwnProperty'](_0xa55c('0x4c'))){_0x5bae40[_0xa55c('0x4d')]=qs['limit'](_0x270bd0[_0xa55c('0x2a')]['limit']);_0x5bae40['offset']=qs[_0xa55c('0x10')](_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x10')]);}_0x5bae40[_0xa55c('0x4e')]=qs['sort'](_0x270bd0[_0xa55c('0x2a')]['sort']);_0x5bae40[_0xa55c('0x50')]=qs['filters'](_['pick'](_0x270bd0['query'],_0x147962[_0xa55c('0x31')]));_0x5bae40['where']['VoiceQueueId']=_0x46124b['id'];if(_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x5bae40[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x5bae40[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x5bae40[_0xa55c('0x33')],function(_0x9225d9){var _0x465801={};_0x465801[_0x9225d9]={'$like':'%'+_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x465801;})});}_0x5bae40=_[_0xa55c('0x43')]({},_0x5bae40,_0x270bd0[_0xa55c('0x37')]);return db['CmHopperBlack'][_0xa55c('0xf')]({'where':_0x5bae40['where']})['then'](function(_0x5c8003){_0x1538dc[_0xa55c('0xf')]=_0x5c8003;if(_0x270bd0['query'][_0xa55c('0x36')]){_0x5bae40['include']=[{'all':!![]}];}return db[_0xa55c('0x59')]['findAll'](_0x5bae40);})['then'](function(_0xfb1954){_0x1538dc['rows']=_0xfb1954;return _0x1538dc;});}})['then'](respondWithFilteredResult(_0x472c73,_0x5bae40))[_0xa55c('0x2c')](handleError(_0x472c73,null));};exports[_0xa55c('0x5a')]=function(_0x4ba496,_0x11349d){var _0x55caeb={};var _0x294e54={};var _0x403dff;var _0x1dcd8a;return db['VoiceQueue']['findOne']({'where':{'id':_0x4ba496[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x11349d,null))[_0xa55c('0x14')](function(_0xfda07f){if(_0xfda07f){_0x403dff=_0xfda07f;_0x294e54[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x5b')][_0xa55c('0x30')]);_0x294e54['query']=_[_0xa55c('0x2f')](_0x4ba496[_0xa55c('0x2a')]);_0x294e54[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x294e54[_0xa55c('0x2e')],_0x294e54[_0xa55c('0x2a')]);_0x55caeb[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x294e54[_0xa55c('0x2e')],qs['fields'](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x55caeb[_0xa55c('0x33')]=_0x55caeb['attributes']['length']?_0x55caeb['attributes']:_0x294e54[_0xa55c('0x2e')];_0x55caeb['order']=qs[_0xa55c('0x4f')](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x55caeb[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x4ba496[_0xa55c('0x2a')],_0x294e54[_0xa55c('0x31')]));if(_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x55caeb[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x55caeb[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x55caeb[_0xa55c('0x33')],function(_0x1c7aec){var _0xf0bcac={};_0xf0bcac[_0x1c7aec]={'$like':'%'+_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0xf0bcac;})});}_0x55caeb=_[_0xa55c('0x43')]({},_0x55caeb,_0x4ba496[_0xa55c('0x37')]);return _0x403dff[_0xa55c('0x5a')](_0x55caeb);}})[_0xa55c('0x14')](function(_0x168b3f){if(_0x168b3f){_0x1dcd8a=_0x168b3f['length'];if(!_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4b')]('nolimit')){_0x55caeb[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x55caeb[_0xa55c('0x10')]=qs['offset'](_0x4ba496[_0xa55c('0x2a')]['offset']);}return _0x403dff['getTeams'](_0x55caeb);}})[_0xa55c('0x14')](function(_0x1c9903){if(_0x1c9903){return _0x1c9903?{'count':_0x1dcd8a,'rows':_0x1c9903}:null;}})[_0xa55c('0x14')](respondWithResult(_0x11349d,null))[_0xa55c('0x2c')](handleError(_0x11349d,null));};exports[_0xa55c('0x5c')]=function(_0x23b513,_0x1e4464){var _0xd9f634=_0x23b513[_0xa55c('0x3a')][_0xa55c('0x5d')];var _0x1036b3=_[_0xa55c('0x25')](_0xd9f634,'id');return db[_0xa55c('0x5b')][_0xa55c('0x2b')]({'where':{'id':_0x1036b3},'attributes':['id'],'include':[{'model':db[_0xa55c('0x5e')],'as':_0xa55c('0x5f'),'attributes':['id',_0xa55c('0x22'),_0xa55c('0x60'),_0xa55c('0x61'),'interface'],'raw':!![]}]})['then'](function(_0x55a98d){if(_0x55a98d){var _0x200c28=_[_0xa55c('0x62')](_0x55a98d,function(_0x5e41b3){var _0x45b329=_0x5e41b3['get']({'plain':!![]});_0x45b329[_0xa55c('0x5f')]['forEach'](function(_0x3060f2){_0x3060f2[_0xa55c('0x63')]=_[_0xa55c('0x38')](_0xd9f634,{'id':_0x45b329['id']})[_0xa55c('0x63')];});return _0x45b329[_0xa55c('0x5f')];});return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x23b513[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(_0x665054){return db[_0xa55c('0x64')]['transaction'](function(_0x59f3a4){return _0x665054[_0xa55c('0x5c')](_0x1036b3,{'transaction':_0x59f3a4})['then'](function(){return BPromise[_0xa55c('0x65')](_0xd9f634,function(_0x5447a4){return db[_0xa55c('0x66')][_0xa55c('0x67')]({'TeamId':_0x5447a4['id'],'VoiceQueueId':_0x23b513[_0xa55c('0x2d')]['id'],'penalty':_0x5447a4['penalty']},{'transaction':_0x59f3a4});});})[_0xa55c('0x14')](function(){return BPromise[_0xa55c('0x65')](_0x200c28,function(_0x130c5f){return db['UserVoiceQueue'][_0xa55c('0x68')]({'where':{'UserId':_0x130c5f['id'],'VoiceQueueId':_0x23b513['params']['id']},'defaults':{'penalty':_0x130c5f[_0xa55c('0x63')]},'transaction':_0x59f3a4});});})['then'](function(){return BPromise['each'](_[_0xa55c('0x1a')](_0x200c28,{'online':!![]}),function(_0x40e121){return db[_0xa55c('0x69')]['upsert']({'membername':_0x40e121[_0xa55c('0x22')],'UserId':_0x40e121['id'],'queue_name':_0x665054[_0xa55c('0x22')],'VoiceQueueId':_0x665054['id'],'interface':_[_0xa55c('0x6a')](_0x40e121[_0xa55c('0x6b')])?util[_0xa55c('0x6c')](_0xa55c('0x6d'),_0x40e121[_0xa55c('0x22')]):_0x40e121[_0xa55c('0x6b')],'paused':_0x40e121['voicePause']||![],'penalty':_0x40e121[_0xa55c('0x63')]},{'transaction':_0x59f3a4});});})[_0xa55c('0x14')](function(){_0x200c28[_0xa55c('0x6e')](function(_0x151533){socket[_0xa55c('0x6f')](_0xa55c('0x70'),{'UserId':_0x151533['id'],'VoiceQueueId':_0x665054['id']});});});});});}})[_0xa55c('0x14')](respondWithStatusCode(_0x1e4464,null))[_0xa55c('0x2c')](handleError(_0x1e4464,null));};exports[_0xa55c('0x71')]=function(_0x261087,_0x2ef9dd){return db['Team'][_0xa55c('0x2b')]({'where':{'id':_0x261087['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xa55c('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa55c('0x14')](handleEntityNotFound(_0x2ef9dd,null))['then'](function(_0x302284){var _0x231499=_[_0xa55c('0x25')](_0x302284,'id');var _0x2d3e42=[];var _0x97275b=[];var _0x5c7c60=squel[_0xa55c('0x72')]();_0x5c7c60['field'](_0xa55c('0x73'))['from']('team_has_voice_queues','tq')[_0xa55c('0x74')](_0xa55c('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa55c('0x50')](_0xa55c('0x76'),_0x261087[_0xa55c('0x2d')]['id']);for(var _0x485652=0x0;_0x485652<_0x302284['length'];_0x485652+=0x1){let _0x57a1fc=_0x302284[_0x485652];for(var _0x50018c=0x0;_0x50018c<_0x57a1fc[_0xa55c('0x5f')][_0xa55c('0x35')];_0x50018c+=0x1){let _0x4c77c4=_0x57a1fc[_0xa55c('0x5f')][_0x50018c];var _0x1322a0=_0x5c7c60[_0xa55c('0x42')]();_0x1322a0['where'](_0xa55c('0x77'),_0x4c77c4['id']);_0x97275b['push'](db['sequelize']['query'](_0x1322a0[_0xa55c('0x78')](),{'type':db['sequelize'][_0xa55c('0x79')]['SELECT']})[_0xa55c('0x14')](function(_0x21e529){if(_0x21e529[_0xa55c('0x35')]===0x1){return _0x4c77c4['id'];}else{var _0x5063e7=_[_0xa55c('0x7a')](_[_0xa55c('0x25')](_0x21e529,_0xa55c('0x7b')),function(_0x16401f){return _[_0xa55c('0x1d')](_0x231499,_0x16401f);});if(_0x5063e7){return _0x4c77c4['id'];}}}));}}return BPromise[_0xa55c('0x7c')](_0x97275b)[_0xa55c('0x14')](function(_0x34d755){_0x2d3e42=_(_0x2d3e42)[_0xa55c('0x7d')](_0x34d755)['compact']()[_0xa55c('0x1c')]();return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x261087[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(_0x2c0b71){return db['sequelize'][_0xa55c('0x7e')](function(_0x5bae58){return _0x2c0b71[_0xa55c('0x71')](_0x261087[_0xa55c('0x2a')]['ids'],{'transaction':_0x5bae58})[_0xa55c('0x14')](function(){if(!_[_0xa55c('0x7f')](_0x2d3e42)){return _0x2c0b71['removeAgents'](_0x2d3e42,{'transaction':_0x5bae58})['then'](function(){return db[_0xa55c('0x69')][_0xa55c('0x15')]({'where':{'VoiceQueueId':_0x261087[_0xa55c('0x2d')]['id'],'UserId':_0x2d3e42},'transaction':_0x5bae58});});}})[_0xa55c('0x14')](function(){_0x2d3e42[_0xa55c('0x6e')](function(_0x1a335b){socket[_0xa55c('0x6f')](_0xa55c('0x80'),{'UserId':_0x1a335b,'VoiceQueueId':_0x2c0b71['id']});});});});});});})['then'](respondWithStatusCode(_0x2ef9dd,null))[_0xa55c('0x2c')](handleError(_0x2ef9dd,null));};exports[_0xa55c('0x81')]=function(_0xc8cd97,_0x21a206){var _0x29469d,_0x59a69d;return db[_0xa55c('0x26')]['find']({'where':{'id':_0xc8cd97['params']['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x21a206,null))[_0xa55c('0x14')](function(_0x6fcc){if(_0x6fcc){_0x59a69d=_0x6fcc;return _0x6fcc[_0xa55c('0x81')](_0xc8cd97['body'][_0xa55c('0x82')],_[_0xa55c('0x44')](_0xc8cd97[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{})[_0xa55c('0x83')](function(_0x4295c1){for(var _0x37f242=0x0;_0x37f242<_0xc8cd97[_0xa55c('0x3a')]['ids'][_0xa55c('0x35')];_0x37f242+=0x1){socket[_0xa55c('0x6f')](_0xa55c('0x70'),{'UserId':Number(_0xc8cd97[_0xa55c('0x3a')]['ids'][_0x37f242]),'VoiceQueueId':Number(_0xc8cd97[_0xa55c('0x2d')]['id'])});}return _0x4295c1;});}})[_0xa55c('0x14')](function(_0x65c752){_0x29469d=_0x65c752||[];if(_0x59a69d){return db['User'][_0xa55c('0x2b')]({'where':{'id':_0xc8cd97[_0xa55c('0x3a')][_0xa55c('0x82')]},'attributes':['id',_0xa55c('0x22'),_0xa55c('0x60'),_0xa55c('0x61'),_0xa55c('0x6b')],'raw':!![]});}})['then'](function(_0xcd4f3a){if(!_[_0xa55c('0x7f')](_0xcd4f3a)){var _0x496e8c=[];for(var _0x1c930b=0x0;_0x1c930b<_0xcd4f3a[_0xa55c('0x35')];_0x1c930b++){if(_0xcd4f3a[_0x1c930b][_0xa55c('0x60')]){_0x496e8c['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0xcd4f3a[_0x1c930b][_0xa55c('0x22')],'UserId':_0xcd4f3a[_0x1c930b]['id'],'queue_name':_0x59a69d[_0xa55c('0x22')],'VoiceQueueId':_0x59a69d['id'],'interface':_['isNil'](_0xcd4f3a[_0x1c930b]['interface'])?util[_0xa55c('0x6c')](_0xa55c('0x6d'),_0xcd4f3a[_0x1c930b]['name']):_0xcd4f3a[_0x1c930b]['interface'],'paused':_0xcd4f3a[_0x1c930b][_0xa55c('0x61')]||![],'penalty':_0xc8cd97[_0xa55c('0x3a')][_0xa55c('0x63')]||0x0}));}}return BPromise['all'](_0x496e8c);}})['then'](function(){return _0x29469d;})[_0xa55c('0x14')](respondWithResult(_0x21a206,null))['catch'](handleError(_0x21a206,null));};exports[_0xa55c('0x84')]=function(_0xe0a356,_0x5a4e69){return db[_0xa55c('0x26')]['find']({'where':{'id':_0xe0a356['params']['id']}})['then'](handleEntityNotFound(_0x5a4e69,null))['then'](function(_0x527669){if(_0x527669){return _0x527669[_0xa55c('0x84')](_0xe0a356['query'][_0xa55c('0x82')])[_0xa55c('0x14')](function(){if(_[_0xa55c('0x85')](_0xe0a356['query'][_0xa55c('0x82')])){for(var _0x111ff8=0x0;_0x111ff8<_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')][_0xa55c('0x35')];_0x111ff8+=0x1){socket[_0xa55c('0x6f')](_0xa55c('0x80'),{'UserId':Number(_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')][_0x111ff8]),'VoiceQueueId':Number(_0xe0a356[_0xa55c('0x2d')]['id'])});}}else{socket['emit'](_0xa55c('0x80'),{'UserId':Number(_0xe0a356[_0xa55c('0x2a')]['ids']),'VoiceQueueId':Number(_0xe0a356[_0xa55c('0x2d')]['id'])});}});}})[_0xa55c('0x14')](function(_0x940871){return db[_0xa55c('0x69')][_0xa55c('0x15')]({'where':{'VoiceQueueId':_0xe0a356[_0xa55c('0x2d')]['id'],'UserId':_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')]}})[_0xa55c('0x14')](function(){return _0x940871;});})[_0xa55c('0x14')](respondWithStatusCode(_0x5a4e69,null))[_0xa55c('0x2c')](handleError(_0x5a4e69,null));};exports[_0xa55c('0x86')]=function(_0x262d72,_0x228d12){var _0x16e229={};var _0x5c8713={};var _0x2d03b2;var _0x4b2e75;return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x262d72[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x228d12,null))['then'](function(_0x537011){if(_0x537011){_0x2d03b2=_0x537011;_0x5c8713[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db['User'][_0xa55c('0x30')]);_0x5c8713[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x262d72['query']);_0x5c8713[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x5c8713[_0xa55c('0x2e')],_0x5c8713['query']);_0x16e229[_0xa55c('0x33')]=_['intersection'](_0x5c8713[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x16e229[_0xa55c('0x33')]=_0x16e229['attributes'][_0xa55c('0x35')]?_0x16e229[_0xa55c('0x33')]:_0x5c8713[_0xa55c('0x2e')];_0x16e229['order']=qs[_0xa55c('0x4f')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x16e229['where']=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x262d72[_0xa55c('0x2a')],_0x5c8713[_0xa55c('0x31')]));if(_0x262d72[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x16e229[_0xa55c('0x50')]=_['merge'](_0x16e229[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x16e229[_0xa55c('0x33')],function(_0x100ccb){var _0x531e60={};_0x531e60[_0x100ccb]={'$like':'%'+_0x262d72[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x531e60;})});}_0x16e229=_[_0xa55c('0x43')]({},_0x16e229,_0x262d72[_0xa55c('0x37')]);return _0x2d03b2[_0xa55c('0x86')](_0x16e229);}})[_0xa55c('0x14')](function(_0x243cf3){if(_0x243cf3){_0x4b2e75=_0x243cf3['length'];if(!_0x262d72[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x16e229[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x262d72['query']['limit']);_0x16e229['offset']=qs[_0xa55c('0x10')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x2d03b2[_0xa55c('0x86')](_0x16e229);}})[_0xa55c('0x14')](function(_0xb22076){if(_0xb22076){return _0xb22076?{'count':_0x4b2e75,'rows':_0xb22076}:null;}})[_0xa55c('0x14')](respondWithResult(_0x228d12,null))[_0xa55c('0x2c')](handleError(_0x228d12,null));};exports['getMembers']=function(_0x35c42c,_0x3b2174){var _0x35375e={};var _0x19a5f1={};var _0x3e7cfa;var _0xd511c0;return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x35c42c['params']['id']}})['then'](handleEntityNotFound(_0x3b2174,null))['then'](function(_0x58831d){if(_0x58831d){_0x3e7cfa=_0x58831d;_0x19a5f1[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x69')][_0xa55c('0x30')]);_0x19a5f1[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x35c42c[_0xa55c('0x2a')]);_0x19a5f1[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x19a5f1[_0xa55c('0x2e')],_0x19a5f1[_0xa55c('0x2a')]);_0x35375e['attributes']=_['intersection'](_0x19a5f1[_0xa55c('0x2e')],qs['fields'](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x35375e[_0xa55c('0x33')]=_0x35375e[_0xa55c('0x33')][_0xa55c('0x35')]?_0x35375e[_0xa55c('0x33')]:_0x19a5f1[_0xa55c('0x2e')];_0x35375e[_0xa55c('0x4e')]=qs[_0xa55c('0x4f')](_0x35c42c['query'][_0xa55c('0x4f')]);_0x35375e[_0xa55c('0x50')]=qs['filters'](_['pick'](_0x35c42c[_0xa55c('0x2a')],_0x19a5f1[_0xa55c('0x31')]));if(_0x35c42c[_0xa55c('0x2a')]['filter']){_0x35375e[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x35375e[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x35375e['attributes'],function(_0x55459c){var _0x33d58c={};_0x33d58c[_0x55459c]={'$like':'%'+_0x35c42c['query']['filter']+'%'};return _0x33d58c;})});}_0x35375e=_[_0xa55c('0x43')]({},_0x35375e,_0x35c42c[_0xa55c('0x37')]);return _0x3e7cfa[_0xa55c('0x87')](_0x35375e);}})[_0xa55c('0x14')](function(_0x5184ea){if(_0x5184ea){_0xd511c0=_0x5184ea[_0xa55c('0x35')];if(!_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x35375e[_0xa55c('0x4d')]=qs['limit'](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x35375e[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x3e7cfa[_0xa55c('0x87')](_0x35375e);}})['then'](function(_0x2d5e0e){return _0x2d5e0e?{'count':_0xd511c0,'rows':_0x2d5e0e}:null;})['then'](respondWithResult(_0x3b2174,null))[_0xa55c('0x2c')](handleError(_0x3b2174,null));};exports[_0xa55c('0x88')]=function(_0x3755a7,_0x50663f){var _0x50b42f={};var _0x307b39={};var _0x1319c6;var _0x536e1d;return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x3755a7[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x50663f,null))[_0xa55c('0x14')](function(_0x568a42){if(_0x568a42){_0x1319c6=_0x568a42;_0x307b39[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x89')][_0xa55c('0x30')]);_0x307b39['query']=_[_0xa55c('0x2f')](_0x3755a7[_0xa55c('0x2a')]);_0x307b39[_0xa55c('0x31')]=_['intersection'](_0x307b39['model'],_0x307b39[_0xa55c('0x2a')]);_0x50b42f['attributes']=_['intersection'](_0x307b39[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x50b42f[_0xa55c('0x33')]=_0x50b42f[_0xa55c('0x33')][_0xa55c('0x35')]?_0x50b42f[_0xa55c('0x33')]:_0x307b39[_0xa55c('0x2e')];_0x50b42f[_0xa55c('0x4e')]=qs['sort'](_0x3755a7['query'][_0xa55c('0x4f')]);_0x50b42f[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x3755a7['query'],_0x307b39[_0xa55c('0x31')]));if(_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x50b42f[_0xa55c('0x50')]=_['merge'](_0x50b42f[_0xa55c('0x50')],{'$or':_['map'](_0x50b42f['attributes'],function(_0x545806){var _0x4fbb59={};_0x4fbb59[_0x545806]={'$like':'%'+_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x4fbb59;})});}_0x50b42f=_['merge']({},_0x50b42f,_0x3755a7[_0xa55c('0x37')]);return _0x1319c6[_0xa55c('0x88')](_0x50b42f);}})[_0xa55c('0x14')](function(_0x3899bd){if(_0x3899bd){_0x536e1d=_0x3899bd[_0xa55c('0x35')];if(!_0x3755a7[_0xa55c('0x2a')]['hasOwnProperty'](_0xa55c('0x4c'))){_0x50b42f[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x3755a7[_0xa55c('0x2a')]['limit']);_0x50b42f['offset']=qs['offset'](_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x1319c6[_0xa55c('0x88')](_0x50b42f);}})[_0xa55c('0x14')](function(_0x1205cb){if(_0x1205cb){return _0x1205cb?{'count':_0x536e1d,'rows':_0x1205cb}:null;}})[_0xa55c('0x14')](respondWithResult(_0x50663f,null))[_0xa55c('0x2c')](handleError(_0x50663f,null));};exports[_0xa55c('0x8a')]=function(_0x499008,_0x4ef239){var _0x3e3208=moment()[_0xa55c('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e19d6,_0x286b33;return db['VoiceQueue']['find']({'where':{'id':_0x499008[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x4ef239,null))[_0xa55c('0x14')](function(_0x236015){if(_0x236015){_0x286b33=_0x236015;return _0x236015['addLists'](_0x499008['body'][_0xa55c('0x82')],_[_0xa55c('0x44')](_0x499008[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{});}return null;})[_0xa55c('0x83')](function(_0x18e4fd){var _0x185c5b;_0x1e19d6=_0x18e4fd||[];var _0x2511fe=[];if(_0x18e4fd){for(var _0x3ba948=0x0;_0x3ba948<_0x18e4fd[_0xa55c('0x35')];_0x3ba948+=0x1){var _0x5e83e9=_0x18e4fd[_0x3ba948][_0xa55c('0x16')]({'plain':!![]});_0x286b33['dialCheckDuplicateType']=_0x499008[_0xa55c('0x3a')][_0xa55c('0x8b')]?_0x499008[_0xa55c('0x3a')][_0xa55c('0x8b')]:_0x286b33[_0xa55c('0x8b')];switch(_0x286b33[_0xa55c('0x8b')]){case _0xa55c('0x8c'):_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),'ContactId',_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')]('phone',_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','scheduledAt')[_0xa55c('0x94')]('id',_0xa55c('0x95'))['field'](_0x5e83e9[_0xa55c('0x96')]['toString'](),_0xa55c('0x93'))[_0xa55c('0x94')](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x45'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x46'))[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')]['toString']())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL')[_0xa55c('0x50')](_0xa55c('0x9b'),squel[_0xa55c('0x72')]()['field'](_0xa55c('0x9c'))[_0xa55c('0x97')](_0xa55c('0x9d'))[_0xa55c('0x50')]('VoiceQueueId\x20=\x20?',_0x499008['params']['id'][_0xa55c('0x78')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa55c('0x72')]()[_0xa55c('0x94')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0xa55c('0x50')](_0xa55c('0x76'),_0x499008['params']['id'][_0xa55c('0x78')]())))[_0xa55c('0x78')]();break;case _0xa55c('0x9e'):_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x95'),_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x92'))[_0xa55c('0x94')]('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x5e83e9['CmListId']['toString'](),_0xa55c('0x93'))[_0xa55c('0x94')](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))['field']('\x27'+_0x3e3208+'\x27',_0xa55c('0x45'))['field']('\x27'+_0x3e3208+'\x27','updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))['where'](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')][_0xa55c('0x78')]())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL')[_0xa55c('0x50')](_0xa55c('0x9b'),squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x9f'))[_0xa55c('0x97')](_0xa55c('0x8f'))[_0xa55c('0x50')](_0xa55c('0x76'),_0x499008[_0xa55c('0x2d')]['id']['toString']())))[_0xa55c('0x78')]();break;default:_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x95'),_0xa55c('0x93'),'VoiceQueueId',_0xa55c('0x45'),'updatedAt'],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x92'))[_0xa55c('0x94')]('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x5e83e9['CmListId']['toString'](),_0xa55c('0x93'))['field'](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','createdAt')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')][_0xa55c('0x78')]())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL'))[_0xa55c('0x78')]();}_0x2511fe[_0xa55c('0xa0')](db[_0xa55c('0x64')]['query'](_0x185c5b));}return BPromise[_0xa55c('0x7c')](_0x2511fe);}})[_0xa55c('0x14')](function(){var _0x4457e9=[];var _0x456cb9=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0xa1'))[_0xa55c('0x90')]([_0xa55c('0xa2'),_0xa55c('0x91'),'OrderBy',_0xa55c('0x45'),_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0xa3'))['field']('ci.item')['field']('ci.OrderBy+1')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','createdAt')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x46'))[_0xa55c('0x97')](_0xa55c('0xa4'),'ci')[_0xa55c('0x74')](_0xa55c('0x8f'),'h',_0xa55c('0xa5'))[_0xa55c('0x50')](_0xa55c('0xa6'),_0x3e3208)[_0xa55c('0x50')](_0xa55c('0xa7'),'PHONE'))[_0xa55c('0x78')]();_0x4457e9[_0xa55c('0xa0')](db[_0xa55c('0x64')]['query'](_0x456cb9));return BPromise['all'](_0x4457e9);})['then'](function(){return _0x1e19d6;})[_0xa55c('0x14')](respondWithResult(_0x4ef239,null))[_0xa55c('0x2c')](handleError(_0x4ef239,null));};exports[_0xa55c('0xa8')]=function(_0x27cd1b,_0x3ed3a5){return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x27cd1b[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x3ed3a5,null))[_0xa55c('0x14')](function(_0x3def57){if(_0x3def57){return _0x3def57[_0xa55c('0xa8')](_0x27cd1b[_0xa55c('0x2a')][_0xa55c('0x82')]);}})[_0xa55c('0x14')](function(_0x4f5f1a){if(_0x4f5f1a){return db[_0xa55c('0x4a')]['destroy']({'where':{'ListId':_0x27cd1b[_0xa55c('0x2a')][_0xa55c('0x82')],'VoiceQueueId':_0x27cd1b[_0xa55c('0x2d')]['id']}})['then'](function(){return _0x4f5f1a;});}})['then'](respondWithStatusCode(_0x3ed3a5,null))[_0xa55c('0x2c')](handleError(_0x3ed3a5,null));};exports[_0xa55c('0xa9')]=function(_0x30af02,_0x5ebd8a){var _0x2420da={};var _0x2a4b78={};var _0x1e4c2d;var _0x2bf777;return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x30af02[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5ebd8a,null))[_0xa55c('0x14')](function(_0x266b12){if(_0x266b12){_0x1e4c2d=_0x266b12;_0x2a4b78[_0xa55c('0x2e')]=_['keys'](db[_0xa55c('0x89')]['rawAttributes']);_0x2a4b78[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x30af02['query']);_0x2a4b78[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x2a4b78[_0xa55c('0x2e')],_0x2a4b78['query']);_0x2420da[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x2a4b78['model'],qs['fields'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x2420da[_0xa55c('0x33')]=_0x2420da[_0xa55c('0x33')][_0xa55c('0x35')]?_0x2420da['attributes']:_0x2a4b78[_0xa55c('0x2e')];_0x2420da['order']=qs['sort'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x2420da['where']=qs[_0xa55c('0x31')](_['pick'](_0x30af02[_0xa55c('0x2a')],_0x2a4b78[_0xa55c('0x31')]));if(_0x30af02['query'][_0xa55c('0x1a')]){_0x2420da[_0xa55c('0x50')]=_['merge'](_0x2420da[_0xa55c('0x50')],{'$or':_['map'](_0x2420da['attributes'],function(_0x37273b){var _0x1cd529={};_0x1cd529[_0x37273b]={'$like':'%'+_0x30af02[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x1cd529;})});}_0x2420da=_[_0xa55c('0x43')]({},_0x2420da,_0x30af02[_0xa55c('0x37')]);return _0x1e4c2d[_0xa55c('0xa9')](_0x2420da);}})['then'](function(_0x27e791){if(_0x27e791){_0x2bf777=_0x27e791[_0xa55c('0x35')];if(!_0x30af02['query'][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x2420da['limit']=qs[_0xa55c('0x4d')](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x2420da[_0xa55c('0x10')]=qs['offset'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x1e4c2d[_0xa55c('0xa9')](_0x2420da);}})[_0xa55c('0x14')](function(_0x365331){if(_0x365331){return _0x365331?{'count':_0x2bf777,'rows':_0x365331}:null;}})[_0xa55c('0x14')](respondWithResult(_0x5ebd8a,null))['catch'](handleError(_0x5ebd8a,null));};exports[_0xa55c('0xaa')]=function(_0x4d7cd6,_0x1ca9bd){var _0x2bf932;return db['VoiceQueue']['find']({'where':{'id':_0x4d7cd6[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x1ca9bd,null))[_0xa55c('0x14')](function(_0x3c9d2b){if(_0x3c9d2b){return _0x3c9d2b[_0xa55c('0xaa')](_0x4d7cd6[_0xa55c('0x3a')][_0xa55c('0x82')],_['omit'](_0x4d7cd6[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{});}return null;})[_0xa55c('0x83')](function(_0x158b01){var _0x19f576;_0x2bf932=_0x158b01||[];var _0x10da4b=[];if(_0x158b01){for(var _0x3320ab=0x0;_0x3320ab<_0x158b01[_0xa55c('0x35')];_0x3320ab+=0x1){var _0x298cf5=_0x158b01[_0x3320ab][_0xa55c('0x16')]({'plain':!![]});_0x19f576=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0xab'))['fromQuery']([_0xa55c('0x91'),'ContactId',_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))['field']('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x298cf5[_0xa55c('0x96')]['toString'](),'ListId')['field'](_0x4d7cd6[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),'VoiceQueueId')[_0xa55c('0x94')](_0xa55c('0xac'),_0xa55c('0x45'))[_0xa55c('0x94')](_0xa55c('0xac'),'updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')]('ListId\x20=\x20?',_0x298cf5['CmListId'][_0xa55c('0x78')]())[_0xa55c('0x50')](_0xa55c('0xad')))['toString']();_0x10da4b[_0xa55c('0xa0')](db[_0xa55c('0x64')][_0xa55c('0x2a')](_0x19f576));}return BPromise[_0xa55c('0x7c')](_0x10da4b);}})[_0xa55c('0x14')](function(){return _0x2bf932;})[_0xa55c('0x14')](respondWithResult(_0x1ca9bd,null))[_0xa55c('0x2c')](handleError(_0x1ca9bd,null));};exports[_0xa55c('0xae')]=function(_0x23862a,_0xb432d1){return db['VoiceQueue'][_0xa55c('0x38')]({'where':{'id':_0x23862a[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0xb432d1,null))[_0xa55c('0x14')](function(_0x5bc270){if(_0x5bc270){return _0x5bc270[_0xa55c('0xae')](_0x23862a[_0xa55c('0x2a')][_0xa55c('0x82')]);}})[_0xa55c('0x14')](function(_0x543b4a){if(_0x543b4a){return db[_0xa55c('0x59')]['destroy']({'where':{'ListId':_0x23862a[_0xa55c('0x2a')][_0xa55c('0x82')],'VoiceQueueId':_0x23862a[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(){return _0x543b4a;});}})[_0xa55c('0x14')](respondWithStatusCode(_0xb432d1,null))['catch'](handleError(_0xb432d1,null));}; \ No newline at end of file +var _0x7217=['toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','ids','emit','userVoiceQueue:remove','addAgents','isEmpty','removeAgents','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper','fromQuery','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','ignore','map','value','type','find','name','UserProfileResource','end','error','send','index','VoiceQueue','fieldName','getOptions','where','include','query','findAll','rows','catch','params','model','keys','rawAttributes','filters','attributes','intersection','fields','length','options','create','user','role','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','includeAll','omit','createdAt','updatedAt','body','merge','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','limit','order','sort','pick','VoiceQueueId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','online','flatMap','penalty','sequelize','transaction','addTeams','upsert','each','UserVoiceQueueRt','isNil','interface','format','SIP/%s','voicePause','forEach','userVoiceQueue:save','removeTeams','Agents','select','field','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push'];(function(_0x5c956b,_0xa87d11){var _0xaff46a=function(_0x463d89){while(--_0x463d89){_0x5c956b['push'](_0x5c956b['shift']());}};_0xaff46a(++_0xa87d11);}(_0x7217,0x19e));var _0x7721=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x7217[_0x3ce3c];return _0x55a2c9;};'use strict';var moment=require(_0x7721('0x0'));var BPromise=require('bluebird');var util=require(_0x7721('0x1'));var _=require(_0x7721('0x2'));var squel=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var qs=require(_0x7721('0x5'));var logger=require('../../config/logger')('api');var config=require(_0x7721('0x6'));var db=require(_0x7721('0x7'))['db'];config[_0x7721('0x8')]=_[_0x7721('0x9')](config[_0x7721('0x8')],{'host':_0x7721('0xa'),'port':0x18eb});var socket=require(_0x7721('0xb'))(new Redis(config[_0x7721('0x8')]));require(_0x7721('0xc'))[_0x7721('0xd')](socket);function respondWithStatusCode(_0x3e6368,_0x2a66cb){_0x2a66cb=_0x2a66cb||0xcc;return function(_0xfa8835){if(_0xfa8835){return _0x3e6368[_0x7721('0xe')](_0x2a66cb);}return _0x3e6368[_0x7721('0xf')](_0x2a66cb)['end']();};}function respondWithResult(_0x461d1a,_0x29bc8f){_0x29bc8f=_0x29bc8f||0xc8;return function(_0x8729a6){if(_0x8729a6){return _0x461d1a[_0x7721('0xf')](_0x29bc8f)[_0x7721('0x10')](_0x8729a6);}};}function respondWithFilteredResult(_0x409b37,_0x1e7fd7){return function(_0x27b36b){if(_0x27b36b){var _0x55b4ca=typeof _0x1e7fd7[_0x7721('0x11')]===_0x7721('0x12')&&typeof _0x1e7fd7['limit']===_0x7721('0x12');var _0x30da54=_0x27b36b[_0x7721('0x13')];var _0x2e9752=_0x55b4ca?0x0:_0x1e7fd7['offset'];var _0x3cbce8=_0x55b4ca?_0x27b36b[_0x7721('0x13')]:_0x1e7fd7['offset']+_0x1e7fd7['limit'];var _0x4b183e;if(_0x3cbce8>=_0x30da54){_0x3cbce8=_0x30da54;_0x4b183e=0xc8;}else{_0x4b183e=0xce;}_0x409b37[_0x7721('0xf')](_0x4b183e);return _0x409b37[_0x7721('0x14')](_0x7721('0x15'),_0x2e9752+'-'+_0x3cbce8+'/'+_0x30da54)[_0x7721('0x10')](_0x27b36b);}return null;};}function saveUpdates(_0x5ed94b){return function(_0x20f669){if(_0x20f669){return _0x20f669['update'](_0x5ed94b)[_0x7721('0x16')](function(_0x5cb0e6){return _0x5cb0e6;});}return null;};}function removeEntity(_0xfec626){return function(_0x4e96fb){if(_0x4e96fb){return _0x4e96fb[_0x7721('0x17')]()[_0x7721('0x16')](function(){var _0x2286e5=_0x4e96fb[_0x7721('0x18')]({'plain':!![]});var _0x402820=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a'),'ignore':![]},{'name':_0x7721('0x1b'),'value':'outbound','ignore':![]}];var _0x288f7e=_(_0x402820)[_0x7721('0x1c')](_0x7721('0x1d'))[_0x7721('0x1e')]('value')[_0x7721('0x1f')]();if(_['includes'](_0x288f7e,_0x2286e5[_0x7721('0x20')])){return;}var _0x288e3a=_[_0x7721('0x21')](_0x402820,[_0x7721('0x1f'),_0x2286e5[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x23')]['destroy']({'where':{'type':_0x288e3a,'resourceId':_0x2286e5['id']}})[_0x7721('0x16')](function(){return _0x4e96fb;});})[_0x7721('0x16')](function(){_0xfec626[_0x7721('0xf')](0xcc)[_0x7721('0x24')]();});}};}function handleEntityNotFound(_0x40d550){return function(_0x16355a){if(!_0x16355a){_0x40d550[_0x7721('0xe')](0x194);}return _0x16355a;};}function handleError(_0xf753f1,_0x40f367){_0x40f367=_0x40f367||0x1f4;return function(_0x52316e){logger[_0x7721('0x25')](_0x52316e['stack']);if(_0x52316e['name']){delete _0x52316e[_0x7721('0x22')];}_0xf753f1[_0x7721('0xf')](_0x40f367)[_0x7721('0x26')](_0x52316e);};}exports[_0x7721('0x27')]=function(_0x1ea4d,_0x37b9f0){var _0xd7d703={};var _0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x1e')](db[_0x7721('0x28')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x29')],'type':_0x4a25c9[_0x7721('0x20')]['key']};});_0xd7d703=qs[_0x7721('0x2a')](_0x5c54f0,_0x1ea4d);var _0x4651b5={'where':_0xd7d703[_0x7721('0x2b')]};return db['VoiceQueue'][_0x7721('0x13')](_0x4651b5)[_0x7721('0x16')](function(_0x1492d4){_0x1da2d8[_0x7721('0x13')]=_0x1492d4;_0xd7d703[_0x7721('0x2c')]=qs['include'](_0x1ea4d[_0x7721('0x2d')]);return db[_0x7721('0x28')][_0x7721('0x2e')](_0xd7d703);})['then'](function(_0x35de7a){_0x1da2d8[_0x7721('0x2f')]=_0x35de7a;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x37b9f0,_0xd7d703))[_0x7721('0x30')](handleError(_0x37b9f0,null));};exports['show']=function(_0x2d6ba0,_0x326c50){var _0x19d082={'raw':![],'where':{'id':_0x2d6ba0[_0x7721('0x31')]['id']}},_0x1d894b={};_0x1d894b[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x28')][_0x7721('0x34')]);_0x1d894b[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x2d6ba0['query']);_0x1d894b[_0x7721('0x35')]=_['intersection'](_0x1d894b[_0x7721('0x32')],_0x1d894b[_0x7721('0x2d')]);_0x19d082[_0x7721('0x36')]=_[_0x7721('0x37')](_0x1d894b[_0x7721('0x32')],qs[_0x7721('0x38')](_0x2d6ba0['query']['fields']));_0x19d082['attributes']=_0x19d082['attributes'][_0x7721('0x39')]?_0x19d082[_0x7721('0x36')]:_0x1d894b[_0x7721('0x32')];if(_0x2d6ba0[_0x7721('0x2d')]['includeAll']){_0x19d082[_0x7721('0x2c')]=[{'all':!![]}];}_0x19d082=_['merge']({},_0x19d082,_0x2d6ba0[_0x7721('0x3a')]);return db[_0x7721('0x28')]['find'](_0x19d082)[_0x7721('0x16')](handleEntityNotFound(_0x326c50,null))[_0x7721('0x16')](respondWithResult(_0x326c50,null))['catch'](handleError(_0x326c50,null));};exports['create']=function(_0x3d84d3,_0xfc4dc4){return db[_0x7721('0x28')][_0x7721('0x3b')](_0x3d84d3['body'],{})[_0x7721('0x16')](function(_0x120de9){var _0x40ce8c=_0x3d84d3[_0x7721('0x3c')][_0x7721('0x18')]({'plain':!![]});if(!_0x40ce8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40ce8c[_0x7721('0x3d')]==='user'){var _0xaa3216=_0x120de9['get']({'plain':!![]});var _0x2333b8=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a')},{'name':'QueueCampaigns','value':_0x7721('0x3e')}];var _0x11d853=_[_0x7721('0x21')](_0x2333b8,['value',_0xaa3216[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x3f')][_0x7721('0x21')]({'where':{'name':_0x11d853,'userProfileId':_0x40ce8c[_0x7721('0x40')]},'raw':!![]})[_0x7721('0x16')](function(_0x463ccc){if(_0x463ccc&&_0x463ccc['autoAssociation']===0x0){return db['UserProfileResource'][_0x7721('0x3b')]({'name':_0xaa3216[_0x7721('0x22')],'resourceId':_0xaa3216['id'],'type':_0x463ccc[_0x7721('0x22')],'sectionId':_0x463ccc['id']},{})[_0x7721('0x16')](function(){return _0x120de9;});}else{return _0x120de9;}})[_0x7721('0x30')](function(_0x15181b){logger[_0x7721('0x25')](_0x7721('0x41'),_0x15181b);throw _0x15181b;});}return _0x120de9;})[_0x7721('0x16')](respondWithResult(_0xfc4dc4,0xc9))[_0x7721('0x30')](handleError(_0xfc4dc4,null));};exports['clone']=function(_0x578867,_0x5ed70d){var _0x6a4664={'where':{'id':_0x578867[_0x7721('0x31')]['id']}},_0x151f69={};_0x151f69['model']=_[_0x7721('0x33')](db[_0x7721('0x28')]['rawAttributes']);_0x6a4664[_0x7721('0x36')]=_['intersection'](_0x151f69[_0x7721('0x32')],qs['fields'](_0x578867[_0x7721('0x2d')][_0x7721('0x38')]));_0x6a4664[_0x7721('0x36')]=_0x6a4664['attributes'][_0x7721('0x39')]?_0x6a4664[_0x7721('0x36')]:_0x151f69['model'];if(_0x578867[_0x7721('0x2d')][_0x7721('0x42')]){_0x6a4664[_0x7721('0x2c')]=[{'all':!![]}];}_0x6a4664=_['merge']({},_0x6a4664,_0x578867[_0x7721('0x3a')]);return db['VoiceQueue'][_0x7721('0x21')](_0x6a4664)[_0x7721('0x16')](handleEntityNotFound(_0x5ed70d,null))[_0x7721('0x16')](function(_0x443503){if(_0x443503){var _0x1c95d8=_0x443503[_0x7721('0x18')]({'plain':!![]});_0x1c95d8=qs[_0x7721('0x43')](_0x1c95d8,['id',_0x7721('0x44'),_0x7721('0x45')]);_0x578867[_0x7721('0x46')]=_[_0x7721('0x43')](_0x578867[_0x7721('0x46')],['id',_0x7721('0x44'),_0x7721('0x45')]);return db[_0x7721('0x28')]['create'](_[_0x7721('0x47')](_0x1c95d8,_0x578867[_0x7721('0x46')]),{'include':_0x578867[_0x7721('0x2d')][_0x7721('0x42')]?[{'all':!![]}]:undefined})[_0x7721('0x16')](function(_0x315127){var _0x267f5e=_0x578867['user'][_0x7721('0x18')]({'plain':!![]});if(!_0x267f5e)throw new Error(_0x7721('0x48'));if(_0x267f5e[_0x7721('0x3d')]===_0x7721('0x3c')){var _0x1f1e84=_0x315127[_0x7721('0x18')]({'plain':!![]});var _0x7fbd6c=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a')},{'name':_0x7721('0x1b'),'value':_0x7721('0x3e')}];var _0x52e870=_[_0x7721('0x21')](_0x7fbd6c,[_0x7721('0x1f'),_0x1f1e84[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x3f')][_0x7721('0x21')]({'where':{'name':_0x52e870,'userProfileId':_0x267f5e[_0x7721('0x40')]},'raw':!![]})[_0x7721('0x16')](function(_0x360882){if(_0x360882&&_0x360882[_0x7721('0x49')]===0x0){return db[_0x7721('0x23')][_0x7721('0x3b')]({'name':_0x1f1e84[_0x7721('0x22')],'resourceId':_0x1f1e84['id'],'type':_0x360882[_0x7721('0x22')],'sectionId':_0x360882['id']},{})[_0x7721('0x16')](function(){return _0x315127;});}else{return _0x315127;}})['catch'](function(_0x50e9e9){logger['error'](_0x7721('0x41'),_0x50e9e9);throw _0x50e9e9;});}return _0x315127;});}})['then'](respondWithResult(_0x5ed70d,0xc9))['catch'](handleError(_0x5ed70d,null));};exports['update']=function(_0x5d7036,_0x47925a){if(_0x5d7036[_0x7721('0x46')]['id']){delete _0x5d7036[_0x7721('0x46')]['id'];}return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0x5d7036['params']['id']}})['then'](handleEntityNotFound(_0x47925a,null))['then'](saveUpdates(_0x5d7036[_0x7721('0x46')],null))['then'](respondWithResult(_0x47925a,null))['catch'](handleError(_0x47925a,null));};exports['destroy']=function(_0x160292,_0x2e9155){return db[_0x7721('0x28')]['find']({'where':{'id':_0x160292[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x2e9155,null))[_0x7721('0x16')](removeEntity(_0x2e9155,null))[_0x7721('0x30')](handleError(_0x2e9155,null));};exports[_0x7721('0x4a')]=function(_0x16e80b,_0xad43ce){var _0x3e3301={'raw':![],'where':{}};var _0x127f46={};var _0x197b73={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x16e80b[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0xad43ce,null))[_0x7721('0x16')](function(_0x4cbd28){if(_0x4cbd28){_0x127f46[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x4c')][_0x7721('0x34')]);_0x127f46['query']=_[_0x7721('0x33')](_0x16e80b[_0x7721('0x2d')]);_0x127f46['filters']=_[_0x7721('0x37')](_0x127f46['model'],_0x127f46[_0x7721('0x2d')]);_0x3e3301[_0x7721('0x36')]=_[_0x7721('0x37')](_0x127f46[_0x7721('0x32')],qs[_0x7721('0x38')](_0x16e80b[_0x7721('0x2d')][_0x7721('0x38')]));_0x3e3301[_0x7721('0x36')]=_0x3e3301[_0x7721('0x36')]['length']?_0x3e3301[_0x7721('0x36')]:_0x127f46[_0x7721('0x32')];if(!_0x16e80b[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0x3e3301[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x16e80b['query'][_0x7721('0x4f')]);_0x3e3301[_0x7721('0x11')]=qs['offset'](_0x16e80b[_0x7721('0x2d')]['offset']);}_0x3e3301[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x16e80b[_0x7721('0x2d')][_0x7721('0x51')]);_0x3e3301[_0x7721('0x2b')]=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x16e80b['query'],_0x127f46[_0x7721('0x35')]));_0x3e3301[_0x7721('0x2b')][_0x7721('0x53')]=_0x4cbd28['id'];if(_0x16e80b['query']['filter']){_0x3e3301['where']=_['merge'](_0x3e3301['where'],{'$or':_[_0x7721('0x1e')](_0x3e3301[_0x7721('0x36')],function(_0x580473){var _0x2d4b3a={};_0x2d4b3a[_0x580473]={'$like':'%'+_0x16e80b[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x2d4b3a;})});}_0x3e3301=_[_0x7721('0x47')]({},_0x3e3301,_0x16e80b['options']);return db[_0x7721('0x4c')][_0x7721('0x13')]({'where':_0x3e3301[_0x7721('0x2b')]})[_0x7721('0x16')](function(_0x3cf3fd){_0x197b73['count']=_0x3cf3fd;if(_0x16e80b[_0x7721('0x2d')][_0x7721('0x42')]){_0x3e3301[_0x7721('0x2c')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x3e3301);})[_0x7721('0x16')](function(_0x752564){_0x197b73[_0x7721('0x2f')]=_0x752564;return _0x197b73;});}})[_0x7721('0x16')](respondWithFilteredResult(_0xad43ce,_0x3e3301))[_0x7721('0x30')](handleError(_0xad43ce,null));};exports['getHopperHistories']=function(_0x4ba35e,_0x263070){var _0x1bd97e={'raw':!![],'where':{}};var _0x68de4={};var _0x3c66b3={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x4ba35e[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x263070,null))[_0x7721('0x16')](function(_0x413185){if(_0x413185){_0x68de4[_0x7721('0x32')]=_['keys'](db[_0x7721('0x54')][_0x7721('0x34')]);_0x68de4[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x4ba35e['query']);_0x68de4['filters']=_[_0x7721('0x37')](_0x68de4[_0x7721('0x32')],_0x68de4[_0x7721('0x2d')]);_0x1bd97e[_0x7721('0x36')]=_[_0x7721('0x37')](_0x68de4[_0x7721('0x32')],qs['fields'](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x38')]));_0x1bd97e[_0x7721('0x36')]=_0x1bd97e['attributes'][_0x7721('0x39')]?_0x1bd97e[_0x7721('0x36')]:_0x68de4[_0x7721('0x32')];if(!_0x4ba35e[_0x7721('0x2d')][_0x7721('0x4d')]('nolimit')){_0x1bd97e[_0x7721('0x4f')]=qs['limit'](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x4f')]);_0x1bd97e[_0x7721('0x11')]=qs[_0x7721('0x11')](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x11')]);}_0x1bd97e[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x51')]);_0x1bd97e[_0x7721('0x2b')]=qs['filters'](_[_0x7721('0x52')](_0x4ba35e[_0x7721('0x2d')],_0x68de4[_0x7721('0x35')]));_0x1bd97e['where'][_0x7721('0x53')]=_0x413185['id'];if(_0x4ba35e[_0x7721('0x2d')][_0x7721('0x1c')]){_0x1bd97e[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x1bd97e['where'],{'$or':_[_0x7721('0x1e')](_0x1bd97e[_0x7721('0x36')],function(_0x44326d){var _0x21b365={};_0x21b365[_0x44326d]={'$like':'%'+_0x4ba35e[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x21b365;})});}_0x1bd97e=_['merge']({},_0x1bd97e,_0x4ba35e[_0x7721('0x3a')]);return db[_0x7721('0x54')]['count']({'where':_0x1bd97e[_0x7721('0x2b')]})['then'](function(_0x453792){_0x3c66b3[_0x7721('0x13')]=_0x453792;if(_0x4ba35e['query'][_0x7721('0x42')]){_0x1bd97e['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1bd97e);})[_0x7721('0x16')](function(_0x20f12e){_0x3c66b3[_0x7721('0x2f')]=_0x20f12e;return _0x3c66b3;});}})['then'](respondWithFilteredResult(_0x263070,_0x1bd97e))['catch'](handleError(_0x263070,null));};exports['getHopperFinals']=function(_0x355aa8,_0x3f7923){var _0x3c9334={'raw':!![],'where':{}};var _0x4220cf={};var _0x3b02d7={'count':0x0,'rows':[]};return db[_0x7721('0x28')]['findOne']({'where':{'id':_0x355aa8[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x3f7923,null))[_0x7721('0x16')](function(_0xcf5304){if(_0xcf5304){_0x4220cf[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x55')][_0x7721('0x34')]);_0x4220cf[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x355aa8[_0x7721('0x2d')]);_0x4220cf[_0x7721('0x35')]=_['intersection'](_0x4220cf['model'],_0x4220cf[_0x7721('0x2d')]);_0x3c9334[_0x7721('0x36')]=_['intersection'](_0x4220cf[_0x7721('0x32')],qs['fields'](_0x355aa8['query'][_0x7721('0x38')]));_0x3c9334['attributes']=_0x3c9334['attributes'][_0x7721('0x39')]?_0x3c9334[_0x7721('0x36')]:_0x4220cf[_0x7721('0x32')];if(!_0x355aa8[_0x7721('0x2d')][_0x7721('0x4d')]('nolimit')){_0x3c9334[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x355aa8[_0x7721('0x2d')][_0x7721('0x4f')]);_0x3c9334['offset']=qs['offset'](_0x355aa8[_0x7721('0x2d')][_0x7721('0x11')]);}_0x3c9334['order']=qs[_0x7721('0x51')](_0x355aa8[_0x7721('0x2d')]['sort']);_0x3c9334['where']=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x355aa8[_0x7721('0x2d')],_0x4220cf[_0x7721('0x35')]));_0x3c9334[_0x7721('0x2b')][_0x7721('0x53')]=_0xcf5304['id'];if(_0x355aa8[_0x7721('0x2d')][_0x7721('0x1c')]){_0x3c9334['where']=_[_0x7721('0x47')](_0x3c9334[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x3c9334[_0x7721('0x36')],function(_0xe1c795){var _0x9b5f60={};_0x9b5f60[_0xe1c795]={'$like':'%'+_0x355aa8[_0x7721('0x2d')]['filter']+'%'};return _0x9b5f60;})});}_0x3c9334=_[_0x7721('0x47')]({},_0x3c9334,_0x355aa8[_0x7721('0x3a')]);return db['CmHopperFinal'][_0x7721('0x13')]({'where':_0x3c9334[_0x7721('0x2b')]})[_0x7721('0x16')](function(_0xb8547a){_0x3b02d7[_0x7721('0x13')]=_0xb8547a;if(_0x355aa8[_0x7721('0x2d')][_0x7721('0x42')]){_0x3c9334[_0x7721('0x2c')]=[{'all':!![]}];}return db[_0x7721('0x55')][_0x7721('0x2e')](_0x3c9334);})['then'](function(_0x418954){_0x3b02d7[_0x7721('0x2f')]=_0x418954;return _0x3b02d7;});}})[_0x7721('0x16')](respondWithFilteredResult(_0x3f7923,_0x3c9334))[_0x7721('0x30')](handleError(_0x3f7923,null));};exports[_0x7721('0x56')]=function(_0x47653d,_0x12869b){var _0x1cfee2={'raw':!![],'where':{}};var _0x425327={};var _0x42ee11={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x47653d[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x12869b,null))[_0x7721('0x16')](function(_0x461938){if(_0x461938){_0x425327[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x57')][_0x7721('0x34')]);_0x425327['query']=_[_0x7721('0x33')](_0x47653d['query']);_0x425327[_0x7721('0x35')]=_[_0x7721('0x37')](_0x425327[_0x7721('0x32')],_0x425327[_0x7721('0x2d')]);_0x1cfee2[_0x7721('0x36')]=_['intersection'](_0x425327['model'],qs['fields'](_0x47653d['query'][_0x7721('0x38')]));_0x1cfee2[_0x7721('0x36')]=_0x1cfee2[_0x7721('0x36')][_0x7721('0x39')]?_0x1cfee2[_0x7721('0x36')]:_0x425327['model'];if(!_0x47653d[_0x7721('0x2d')]['hasOwnProperty'](_0x7721('0x4e'))){_0x1cfee2[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x47653d[_0x7721('0x2d')][_0x7721('0x4f')]);_0x1cfee2[_0x7721('0x11')]=qs['offset'](_0x47653d[_0x7721('0x2d')]['offset']);}_0x1cfee2['order']=qs[_0x7721('0x51')](_0x47653d[_0x7721('0x2d')][_0x7721('0x51')]);_0x1cfee2[_0x7721('0x2b')]=qs[_0x7721('0x35')](_['pick'](_0x47653d[_0x7721('0x2d')],_0x425327[_0x7721('0x35')]));_0x1cfee2[_0x7721('0x2b')][_0x7721('0x53')]=_0x461938['id'];if(_0x47653d[_0x7721('0x2d')][_0x7721('0x1c')]){_0x1cfee2[_0x7721('0x2b')]=_['merge'](_0x1cfee2[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x1cfee2[_0x7721('0x36')],function(_0x193326){var _0x1dbf47={};_0x1dbf47[_0x193326]={'$like':'%'+_0x47653d['query'][_0x7721('0x1c')]+'%'};return _0x1dbf47;})});}_0x1cfee2=_[_0x7721('0x47')]({},_0x1cfee2,_0x47653d[_0x7721('0x3a')]);return db['CmHopperBlack'][_0x7721('0x13')]({'where':_0x1cfee2[_0x7721('0x2b')]})['then'](function(_0x29403d){_0x42ee11[_0x7721('0x13')]=_0x29403d;if(_0x47653d[_0x7721('0x2d')][_0x7721('0x42')]){_0x1cfee2['include']=[{'all':!![]}];}return db[_0x7721('0x57')]['findAll'](_0x1cfee2);})[_0x7721('0x16')](function(_0x1c50c2){_0x42ee11['rows']=_0x1c50c2;return _0x42ee11;});}})[_0x7721('0x16')](respondWithFilteredResult(_0x12869b,_0x1cfee2))[_0x7721('0x30')](handleError(_0x12869b,null));};exports['getTeams']=function(_0x29968c,_0x11733f){var _0x5e3816={};var _0x7fd3e8={};var _0x52e8b1;var _0x240b0a;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x29968c['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x11733f,null))['then'](function(_0x5a00be){if(_0x5a00be){_0x52e8b1=_0x5a00be;_0x7fd3e8[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x58')][_0x7721('0x34')]);_0x7fd3e8[_0x7721('0x2d')]=_['keys'](_0x29968c[_0x7721('0x2d')]);_0x7fd3e8[_0x7721('0x35')]=_[_0x7721('0x37')](_0x7fd3e8[_0x7721('0x32')],_0x7fd3e8[_0x7721('0x2d')]);_0x5e3816['attributes']=_[_0x7721('0x37')](_0x7fd3e8['model'],qs[_0x7721('0x38')](_0x29968c['query']['fields']));_0x5e3816[_0x7721('0x36')]=_0x5e3816['attributes']['length']?_0x5e3816[_0x7721('0x36')]:_0x7fd3e8[_0x7721('0x32')];_0x5e3816[_0x7721('0x50')]=qs['sort'](_0x29968c[_0x7721('0x2d')]['sort']);_0x5e3816['where']=qs['filters'](_[_0x7721('0x52')](_0x29968c[_0x7721('0x2d')],_0x7fd3e8[_0x7721('0x35')]));if(_0x29968c[_0x7721('0x2d')][_0x7721('0x1c')]){_0x5e3816[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x5e3816[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x5e3816[_0x7721('0x36')],function(_0x25bf32){var _0x4ec3c6={};_0x4ec3c6[_0x25bf32]={'$like':'%'+_0x29968c[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x4ec3c6;})});}_0x5e3816=_[_0x7721('0x47')]({},_0x5e3816,_0x29968c[_0x7721('0x3a')]);return _0x52e8b1[_0x7721('0x59')](_0x5e3816);}})[_0x7721('0x16')](function(_0xc7e4e9){if(_0xc7e4e9){_0x240b0a=_0xc7e4e9['length'];if(!_0x29968c['query'][_0x7721('0x4d')](_0x7721('0x4e'))){_0x5e3816[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x29968c['query'][_0x7721('0x4f')]);_0x5e3816['offset']=qs[_0x7721('0x11')](_0x29968c['query'][_0x7721('0x11')]);}return _0x52e8b1[_0x7721('0x59')](_0x5e3816);}})[_0x7721('0x16')](function(_0x249a5b){if(_0x249a5b){return _0x249a5b?{'count':_0x240b0a,'rows':_0x249a5b}:null;}})[_0x7721('0x16')](respondWithResult(_0x11733f,null))[_0x7721('0x30')](handleError(_0x11733f,null));};exports['addTeams']=function(_0x509f2d,_0x4d2644){var _0x2b0968=_0x509f2d['body'][_0x7721('0x5a')];var _0x186ada=_['map'](_0x2b0968,'id');return db[_0x7721('0x58')][_0x7721('0x2e')]({'where':{'id':_0x186ada},'attributes':['id'],'include':[{'model':db[_0x7721('0x5b')],'as':'Agents','attributes':['id',_0x7721('0x22'),_0x7721('0x5c'),'voicePause','interface'],'raw':!![]}]})[_0x7721('0x16')](function(_0xc85b9){if(_0xc85b9){var _0x58be49=_[_0x7721('0x5d')](_0xc85b9,function(_0x283716){var _0x4cd26e=_0x283716['get']({'plain':!![]});_0x4cd26e['Agents']['forEach'](function(_0x19be6b){_0x19be6b[_0x7721('0x5e')]=_[_0x7721('0x21')](_0x2b0968,{'id':_0x4cd26e['id']})['penalty'];});return _0x4cd26e['Agents'];});return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x509f2d[_0x7721('0x31')]['id']}})[_0x7721('0x16')](function(_0x14711c){return db[_0x7721('0x5f')][_0x7721('0x60')](function(_0x435455){return _0x14711c[_0x7721('0x61')](_0x186ada,{'transaction':_0x435455})['then'](function(){return BPromise['each'](_0x2b0968,function(_0x415445){return db['TeamVoiceQueue'][_0x7721('0x62')]({'TeamId':_0x415445['id'],'VoiceQueueId':_0x509f2d['params']['id'],'penalty':_0x415445[_0x7721('0x5e')]},{'transaction':_0x435455});});})['then'](function(){return BPromise[_0x7721('0x63')](_0x58be49,function(_0x14341e){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x14341e['id'],'VoiceQueueId':_0x509f2d[_0x7721('0x31')]['id']},'defaults':{'penalty':_0x14341e[_0x7721('0x5e')]},'transaction':_0x435455});});})[_0x7721('0x16')](function(){return BPromise[_0x7721('0x63')](_[_0x7721('0x1c')](_0x58be49,{'online':!![]}),function(_0x5e69d7){return db[_0x7721('0x64')][_0x7721('0x62')]({'membername':_0x5e69d7[_0x7721('0x22')],'UserId':_0x5e69d7['id'],'queue_name':_0x14711c['name'],'VoiceQueueId':_0x14711c['id'],'interface':_[_0x7721('0x65')](_0x5e69d7[_0x7721('0x66')])?util[_0x7721('0x67')](_0x7721('0x68'),_0x5e69d7[_0x7721('0x22')]):_0x5e69d7[_0x7721('0x66')],'paused':_0x5e69d7[_0x7721('0x69')]||![],'penalty':_0x5e69d7[_0x7721('0x5e')]},{'transaction':_0x435455});});})[_0x7721('0x16')](function(){_0x58be49[_0x7721('0x6a')](function(_0x2a2d8a){socket['emit'](_0x7721('0x6b'),{'UserId':_0x2a2d8a['id'],'VoiceQueueId':_0x14711c['id']});});});});});}})[_0x7721('0x16')](respondWithStatusCode(_0x4d2644,null))[_0x7721('0x30')](handleError(_0x4d2644,null));};exports[_0x7721('0x6c')]=function(_0xcb843e,_0x35d3f1){return db[_0x7721('0x58')]['findAll']({'where':{'id':_0xcb843e[_0x7721('0x2d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7721('0x5b')],'as':_0x7721('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x7721('0x16')](handleEntityNotFound(_0x35d3f1,null))[_0x7721('0x16')](function(_0x37b607){var _0x3d6d41=_['map'](_0x37b607,'id');var _0xbce1b=[];var _0x4d3ad1=[];var _0x4028fa=squel[_0x7721('0x6e')]();_0x4028fa[_0x7721('0x6f')]('tq.TeamId')[_0x7721('0x70')](_0x7721('0x71'),'tq')[_0x7721('0x72')](_0x7721('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7721('0x2b')](_0x7721('0x74'),_0xcb843e[_0x7721('0x31')]['id']);for(var _0x980f26=0x0;_0x980f26<_0x37b607['length'];_0x980f26+=0x1){let _0x40dd5e=_0x37b607[_0x980f26];for(var _0x3d143a=0x0;_0x3d143a<_0x40dd5e[_0x7721('0x6d')][_0x7721('0x39')];_0x3d143a+=0x1){let _0x53fa66=_0x40dd5e[_0x7721('0x6d')][_0x3d143a];var _0x1a95e6=_0x4028fa[_0x7721('0x75')]();_0x1a95e6[_0x7721('0x2b')](_0x7721('0x76'),_0x53fa66['id']);_0x4d3ad1[_0x7721('0x77')](db[_0x7721('0x5f')][_0x7721('0x2d')](_0x1a95e6[_0x7721('0x78')](),{'type':db['sequelize'][_0x7721('0x79')][_0x7721('0x7a')]})[_0x7721('0x16')](function(_0x1c246b){if(_0x1c246b[_0x7721('0x39')]===0x1){return _0x53fa66['id'];}else{var _0x31447d=_[_0x7721('0x7b')](_[_0x7721('0x1e')](_0x1c246b,_0x7721('0x7c')),function(_0x14fd97){return _[_0x7721('0x7d')](_0x3d6d41,_0x14fd97);});if(_0x31447d){return _0x53fa66['id'];}}}));}}return BPromise[_0x7721('0x7e')](_0x4d3ad1)[_0x7721('0x16')](function(_0x18ccdf){_0xbce1b=_(_0xbce1b)[_0x7721('0x7f')](_0x18ccdf)[_0x7721('0x80')]()['value']();return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0xcb843e[_0x7721('0x31')]['id']}})[_0x7721('0x16')](function(_0x157310){return db[_0x7721('0x5f')][_0x7721('0x60')](function(_0xdd0e7a){return _0x157310[_0x7721('0x6c')](_0xcb843e[_0x7721('0x2d')][_0x7721('0x81')],{'transaction':_0xdd0e7a})[_0x7721('0x16')](function(){if(!_['isEmpty'](_0xbce1b)){return _0x157310['removeAgents'](_0xbce1b,{'transaction':_0xdd0e7a})[_0x7721('0x16')](function(){return db[_0x7721('0x64')][_0x7721('0x17')]({'where':{'VoiceQueueId':_0xcb843e[_0x7721('0x31')]['id'],'UserId':_0xbce1b},'transaction':_0xdd0e7a});});}})[_0x7721('0x16')](function(){_0xbce1b['forEach'](function(_0x1ebc86){socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':_0x1ebc86,'VoiceQueueId':_0x157310['id']});});});});});});})[_0x7721('0x16')](respondWithStatusCode(_0x35d3f1,null))[_0x7721('0x30')](handleError(_0x35d3f1,null));};exports[_0x7721('0x84')]=function(_0xc0f448,_0x3dc688){var _0x298aca,_0x45b430;return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0xc0f448['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x3dc688,null))[_0x7721('0x16')](function(_0x16e0cd){if(_0x16e0cd){_0x45b430=_0x16e0cd;return _0x16e0cd['addAgents'](_0xc0f448[_0x7721('0x46')][_0x7721('0x81')],_[_0x7721('0x43')](_0xc0f448['body'],[_0x7721('0x81'),'id'])||{})['spread'](function(_0x5f3dd2){for(var _0xa73193=0x0;_0xa73193<_0xc0f448[_0x7721('0x46')][_0x7721('0x81')][_0x7721('0x39')];_0xa73193+=0x1){socket['emit'](_0x7721('0x6b'),{'UserId':Number(_0xc0f448[_0x7721('0x46')][_0x7721('0x81')][_0xa73193]),'VoiceQueueId':Number(_0xc0f448[_0x7721('0x31')]['id'])});}return _0x5f3dd2;});}})[_0x7721('0x16')](function(_0x5b12c7){_0x298aca=_0x5b12c7||[];if(_0x45b430){return db[_0x7721('0x5b')][_0x7721('0x2e')]({'where':{'id':_0xc0f448[_0x7721('0x46')][_0x7721('0x81')]},'attributes':['id',_0x7721('0x22'),_0x7721('0x5c'),_0x7721('0x69'),_0x7721('0x66')],'raw':!![]});}})[_0x7721('0x16')](function(_0x385c86){if(!_[_0x7721('0x85')](_0x385c86)){var _0xc18d1a=[];for(var _0x9575b3=0x0;_0x9575b3<_0x385c86[_0x7721('0x39')];_0x9575b3++){if(_0x385c86[_0x9575b3][_0x7721('0x5c')]){_0xc18d1a[_0x7721('0x77')](db[_0x7721('0x64')][_0x7721('0x62')]({'membername':_0x385c86[_0x9575b3][_0x7721('0x22')],'UserId':_0x385c86[_0x9575b3]['id'],'queue_name':_0x45b430[_0x7721('0x22')],'VoiceQueueId':_0x45b430['id'],'interface':_[_0x7721('0x65')](_0x385c86[_0x9575b3][_0x7721('0x66')])?util['format'](_0x7721('0x68'),_0x385c86[_0x9575b3]['name']):_0x385c86[_0x9575b3][_0x7721('0x66')],'paused':_0x385c86[_0x9575b3][_0x7721('0x69')]||![],'penalty':_0xc0f448[_0x7721('0x46')][_0x7721('0x5e')]||0x0}));}}return BPromise['all'](_0xc18d1a);}})[_0x7721('0x16')](function(){return _0x298aca;})[_0x7721('0x16')](respondWithResult(_0x3dc688,null))['catch'](handleError(_0x3dc688,null));};exports[_0x7721('0x86')]=function(_0x3a8f89,_0x52aae1){return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x3a8f89[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x52aae1,null))[_0x7721('0x16')](function(_0x55c43c){if(_0x55c43c){return _0x55c43c['removeAgents'](_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')])['then'](function(){if(_['isArray'](_0x3a8f89[_0x7721('0x2d')]['ids'])){for(var _0x1c23e3=0x0;_0x1c23e3<_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')]['length'];_0x1c23e3+=0x1){socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':Number(_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')][_0x1c23e3]),'VoiceQueueId':Number(_0x3a8f89[_0x7721('0x31')]['id'])});}}else{socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':Number(_0x3a8f89[_0x7721('0x2d')]['ids']),'VoiceQueueId':Number(_0x3a8f89[_0x7721('0x31')]['id'])});}});}})[_0x7721('0x16')](function(_0x3c3c7e){return db[_0x7721('0x64')][_0x7721('0x17')]({'where':{'VoiceQueueId':_0x3a8f89['params']['id'],'UserId':_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')]}})[_0x7721('0x16')](function(){return _0x3c3c7e;});})[_0x7721('0x16')](respondWithStatusCode(_0x52aae1,null))[_0x7721('0x30')](handleError(_0x52aae1,null));};exports[_0x7721('0x87')]=function(_0x16b110,_0x366323){var _0x14b49e={};var _0x12f568={};var _0x259640;var _0x4a0e50;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x16b110[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x366323,null))[_0x7721('0x16')](function(_0x25e4db){if(_0x25e4db){_0x259640=_0x25e4db;_0x12f568[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x5b')][_0x7721('0x34')]);_0x12f568[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x16b110[_0x7721('0x2d')]);_0x12f568[_0x7721('0x35')]=_[_0x7721('0x37')](_0x12f568['model'],_0x12f568[_0x7721('0x2d')]);_0x14b49e['attributes']=_['intersection'](_0x12f568[_0x7721('0x32')],qs['fields'](_0x16b110[_0x7721('0x2d')][_0x7721('0x38')]));_0x14b49e[_0x7721('0x36')]=_0x14b49e[_0x7721('0x36')]['length']?_0x14b49e['attributes']:_0x12f568[_0x7721('0x32')];_0x14b49e[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x16b110[_0x7721('0x2d')][_0x7721('0x51')]);_0x14b49e[_0x7721('0x2b')]=qs[_0x7721('0x35')](_['pick'](_0x16b110[_0x7721('0x2d')],_0x12f568['filters']));if(_0x16b110[_0x7721('0x2d')][_0x7721('0x1c')]){_0x14b49e[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x14b49e[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x14b49e[_0x7721('0x36')],function(_0x184f1b){var _0xa257a0={};_0xa257a0[_0x184f1b]={'$like':'%'+_0x16b110[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0xa257a0;})});}_0x14b49e=_[_0x7721('0x47')]({},_0x14b49e,_0x16b110[_0x7721('0x3a')]);return _0x259640[_0x7721('0x87')](_0x14b49e);}})[_0x7721('0x16')](function(_0x1ee0c1){if(_0x1ee0c1){_0x4a0e50=_0x1ee0c1[_0x7721('0x39')];if(!_0x16b110[_0x7721('0x2d')]['hasOwnProperty'](_0x7721('0x4e'))){_0x14b49e[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x16b110[_0x7721('0x2d')][_0x7721('0x4f')]);_0x14b49e[_0x7721('0x11')]=qs['offset'](_0x16b110[_0x7721('0x2d')][_0x7721('0x11')]);}return _0x259640[_0x7721('0x87')](_0x14b49e);}})['then'](function(_0x1bdadb){if(_0x1bdadb){return _0x1bdadb?{'count':_0x4a0e50,'rows':_0x1bdadb}:null;}})['then'](respondWithResult(_0x366323,null))[_0x7721('0x30')](handleError(_0x366323,null));};exports['getMembers']=function(_0xe5e55f,_0x17ce3b){var _0xbc0a80={};var _0xf2dc08={};var _0x5b493a;var _0x45024c;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0xe5e55f[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x17ce3b,null))['then'](function(_0x12b255){if(_0x12b255){_0x5b493a=_0x12b255;_0xf2dc08['model']=_[_0x7721('0x33')](db[_0x7721('0x64')][_0x7721('0x34')]);_0xf2dc08[_0x7721('0x2d')]=_[_0x7721('0x33')](_0xe5e55f[_0x7721('0x2d')]);_0xf2dc08[_0x7721('0x35')]=_[_0x7721('0x37')](_0xf2dc08[_0x7721('0x32')],_0xf2dc08['query']);_0xbc0a80[_0x7721('0x36')]=_[_0x7721('0x37')](_0xf2dc08[_0x7721('0x32')],qs['fields'](_0xe5e55f['query'][_0x7721('0x38')]));_0xbc0a80[_0x7721('0x36')]=_0xbc0a80[_0x7721('0x36')][_0x7721('0x39')]?_0xbc0a80[_0x7721('0x36')]:_0xf2dc08[_0x7721('0x32')];_0xbc0a80['order']=qs[_0x7721('0x51')](_0xe5e55f[_0x7721('0x2d')]['sort']);_0xbc0a80[_0x7721('0x2b')]=qs['filters'](_[_0x7721('0x52')](_0xe5e55f['query'],_0xf2dc08[_0x7721('0x35')]));if(_0xe5e55f['query']['filter']){_0xbc0a80['where']=_[_0x7721('0x47')](_0xbc0a80['where'],{'$or':_['map'](_0xbc0a80['attributes'],function(_0x52a1ee){var _0x41c991={};_0x41c991[_0x52a1ee]={'$like':'%'+_0xe5e55f[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x41c991;})});}_0xbc0a80=_[_0x7721('0x47')]({},_0xbc0a80,_0xe5e55f[_0x7721('0x3a')]);return _0x5b493a['getMembers'](_0xbc0a80);}})[_0x7721('0x16')](function(_0x22d4e0){if(_0x22d4e0){_0x45024c=_0x22d4e0['length'];if(!_0xe5e55f[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0xbc0a80[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0xe5e55f[_0x7721('0x2d')][_0x7721('0x4f')]);_0xbc0a80[_0x7721('0x11')]=qs['offset'](_0xe5e55f[_0x7721('0x2d')][_0x7721('0x11')]);}return _0x5b493a[_0x7721('0x88')](_0xbc0a80);}})[_0x7721('0x16')](function(_0x2fbb00){return _0x2fbb00?{'count':_0x45024c,'rows':_0x2fbb00}:null;})[_0x7721('0x16')](respondWithResult(_0x17ce3b,null))[_0x7721('0x30')](handleError(_0x17ce3b,null));};exports[_0x7721('0x89')]=function(_0x561235,_0x12ad4d){var _0x226081={};var _0x17c3e7={};var _0x250cbf;var _0x255b22;return db['VoiceQueue'][_0x7721('0x4b')]({'where':{'id':_0x561235[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x12ad4d,null))[_0x7721('0x16')](function(_0x396880){if(_0x396880){_0x250cbf=_0x396880;_0x17c3e7['model']=_[_0x7721('0x33')](db[_0x7721('0x8a')]['rawAttributes']);_0x17c3e7[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x561235[_0x7721('0x2d')]);_0x17c3e7[_0x7721('0x35')]=_[_0x7721('0x37')](_0x17c3e7['model'],_0x17c3e7[_0x7721('0x2d')]);_0x226081[_0x7721('0x36')]=_['intersection'](_0x17c3e7['model'],qs[_0x7721('0x38')](_0x561235[_0x7721('0x2d')][_0x7721('0x38')]));_0x226081['attributes']=_0x226081[_0x7721('0x36')]['length']?_0x226081['attributes']:_0x17c3e7[_0x7721('0x32')];_0x226081[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x561235[_0x7721('0x2d')][_0x7721('0x51')]);_0x226081['where']=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x561235[_0x7721('0x2d')],_0x17c3e7[_0x7721('0x35')]));if(_0x561235[_0x7721('0x2d')]['filter']){_0x226081[_0x7721('0x2b')]=_['merge'](_0x226081[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x226081[_0x7721('0x36')],function(_0x5209ff){var _0x2583c1={};_0x2583c1[_0x5209ff]={'$like':'%'+_0x561235['query'][_0x7721('0x1c')]+'%'};return _0x2583c1;})});}_0x226081=_[_0x7721('0x47')]({},_0x226081,_0x561235[_0x7721('0x3a')]);return _0x250cbf[_0x7721('0x89')](_0x226081);}})[_0x7721('0x16')](function(_0x3235d8){if(_0x3235d8){_0x255b22=_0x3235d8[_0x7721('0x39')];if(!_0x561235[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0x226081['limit']=qs[_0x7721('0x4f')](_0x561235[_0x7721('0x2d')][_0x7721('0x4f')]);_0x226081[_0x7721('0x11')]=qs[_0x7721('0x11')](_0x561235['query'][_0x7721('0x11')]);}return _0x250cbf[_0x7721('0x89')](_0x226081);}})[_0x7721('0x16')](function(_0x501e31){if(_0x501e31){return _0x501e31?{'count':_0x255b22,'rows':_0x501e31}:null;}})[_0x7721('0x16')](respondWithResult(_0x12ad4d,null))[_0x7721('0x30')](handleError(_0x12ad4d,null));};exports[_0x7721('0x8b')]=function(_0xe325e1,_0x1aa1fc){var _0x560be6=moment()[_0x7721('0x67')](_0x7721('0x8c'));var _0x1bd066,_0xaa15c5;return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0xe325e1[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x1aa1fc,null))[_0x7721('0x16')](function(_0x42ffff){if(_0x42ffff){_0xaa15c5=_0x42ffff;return _0x42ffff[_0x7721('0x8b')](_0xe325e1[_0x7721('0x46')][_0x7721('0x81')],_[_0x7721('0x43')](_0xe325e1[_0x7721('0x46')],[_0x7721('0x81'),'id'])||{});}return null;})[_0x7721('0x8d')](function(_0x3f19f5){var _0x28f11a;_0x1bd066=_0x3f19f5||[];var _0x3bc8f3=[];if(_0x3f19f5){for(var _0x26cea3=0x0;_0x26cea3<_0x3f19f5[_0x7721('0x39')];_0x26cea3+=0x1){var _0x57e928=_0x3f19f5[_0x26cea3]['get']({'plain':!![]});_0xaa15c5[_0x7721('0x8e')]=_0xe325e1[_0x7721('0x46')][_0x7721('0x8e')]?_0xe325e1[_0x7721('0x46')]['dialCheckDuplicateType']:_0xaa15c5[_0x7721('0x8e')];switch(_0xaa15c5['dialCheckDuplicateType']){case _0x7721('0x8f'):_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')]('cm_hopper')['fromQuery'](['phone',_0x7721('0x92'),_0x7721('0x93'),_0x7721('0x94'),_0x7721('0x53'),_0x7721('0x44'),'updatedAt'],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x95'),'phone')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x57e928[_0x7721('0x96')][_0x7721('0x78')](),'ListId')[_0x7721('0x6f')](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','updatedAt')['from'](_0x7721('0x97'))[_0x7721('0x2b')](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x57e928['CmListId'][_0x7721('0x78')]())[_0x7721('0x2b')](_0x7721('0x9a'))[_0x7721('0x2b')](_0x7721('0x9b'),squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x9c'))[_0x7721('0x70')](_0x7721('0x9d'))['where'](_0x7721('0x74'),_0xe325e1[_0x7721('0x31')]['id']['toString']()))[_0x7721('0x2b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7721('0x6e')]()['field'](_0x7721('0x9e'))['from']('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0xe325e1[_0x7721('0x31')]['id']['toString']())))[_0x7721('0x78')]();break;case _0x7721('0x9f'):_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')](_0x7721('0xa0'))[_0x7721('0xa1')](['phone',_0x7721('0x92'),_0x7721('0x93'),'ListId','VoiceQueueId',_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()['field'](_0x7721('0x95'),_0x7721('0x95'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x57e928[_0x7721('0x96')][_0x7721('0x78')](),_0x7721('0x94'))[_0x7721('0x6f')](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))['field']('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))['from'](_0x7721('0x97'))['where']('deletedAt\x20IS\x20NULL')[_0x7721('0x2b')]('ListId\x20=\x20?',_0x57e928[_0x7721('0x96')]['toString']())[_0x7721('0x2b')](_0x7721('0x9a'))['where'](_0x7721('0x9b'),squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x9e'))[_0x7721('0x70')]('cm_hopper')[_0x7721('0x2b')](_0x7721('0x74'),_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')]())))[_0x7721('0x78')]();break;default:_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')]('cm_hopper')[_0x7721('0xa1')]([_0x7721('0x95'),_0x7721('0x92'),_0x7721('0x93'),_0x7721('0x94'),'VoiceQueueId',_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x95'),_0x7721('0x95'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id',_0x7721('0x93'))['field'](_0x57e928['CmListId'][_0x7721('0x78')](),'ListId')['field'](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x44'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))[_0x7721('0x70')](_0x7721('0x97'))[_0x7721('0x2b')](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x57e928[_0x7721('0x96')][_0x7721('0x78')]())[_0x7721('0x2b')]('phone\x20IS\x20NOT\x20NULL'))[_0x7721('0x78')]();}_0x3bc8f3[_0x7721('0x77')](db[_0x7721('0x5f')][_0x7721('0x2d')](_0x28f11a));}return BPromise[_0x7721('0x7e')](_0x3bc8f3);}})[_0x7721('0x16')](function(){var _0x5f53b3=[];var _0x8fc283=squel[_0x7721('0x90')]()['into'](_0x7721('0xa2'))['fromQuery']([_0x7721('0xa3'),_0x7721('0x95'),_0x7721('0xa4'),_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0xa5'))[_0x7721('0x6f')](_0x7721('0xa6'))[_0x7721('0x6f')](_0x7721('0xa7'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))[_0x7721('0x70')](_0x7721('0xa8'),'ci')[_0x7721('0x72')](_0x7721('0xa0'),'h',_0x7721('0xa9'))['where'](_0x7721('0xaa'),_0x560be6)[_0x7721('0x2b')](_0x7721('0xab'),'PHONE'))[_0x7721('0x78')]();_0x5f53b3['push'](db['sequelize'][_0x7721('0x2d')](_0x8fc283));return BPromise[_0x7721('0x7e')](_0x5f53b3);})['then'](function(){return _0x1bd066;})[_0x7721('0x16')](respondWithResult(_0x1aa1fc,null))[_0x7721('0x30')](handleError(_0x1aa1fc,null));};exports[_0x7721('0xac')]=function(_0xbc4f13,_0x50f4bd){return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0xbc4f13['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x50f4bd,null))[_0x7721('0x16')](function(_0x537831){if(_0x537831){return _0x537831[_0x7721('0xac')](_0xbc4f13[_0x7721('0x2d')][_0x7721('0x81')]);}})[_0x7721('0x16')](function(_0x49548e){if(_0x49548e){return db['CmHopper'][_0x7721('0x17')]({'where':{'ListId':_0xbc4f13[_0x7721('0x2d')][_0x7721('0x81')],'VoiceQueueId':_0xbc4f13[_0x7721('0x31')]['id']}})['then'](function(){return _0x49548e;});}})['then'](respondWithStatusCode(_0x50f4bd,null))[_0x7721('0x30')](handleError(_0x50f4bd,null));};exports[_0x7721('0xad')]=function(_0x4ea8ac,_0x226556){var _0x4bd023={};var _0x50de45={};var _0x51ac8f;var _0x27ed5e;return db['VoiceQueue'][_0x7721('0x4b')]({'where':{'id':_0x4ea8ac[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x226556,null))['then'](function(_0x4893c0){if(_0x4893c0){_0x51ac8f=_0x4893c0;_0x50de45[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x8a')][_0x7721('0x34')]);_0x50de45[_0x7721('0x2d')]=_['keys'](_0x4ea8ac[_0x7721('0x2d')]);_0x50de45[_0x7721('0x35')]=_[_0x7721('0x37')](_0x50de45[_0x7721('0x32')],_0x50de45[_0x7721('0x2d')]);_0x4bd023['attributes']=_[_0x7721('0x37')](_0x50de45[_0x7721('0x32')],qs[_0x7721('0x38')](_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x38')]));_0x4bd023[_0x7721('0x36')]=_0x4bd023['attributes']['length']?_0x4bd023[_0x7721('0x36')]:_0x50de45[_0x7721('0x32')];_0x4bd023[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x51')]);_0x4bd023[_0x7721('0x2b')]=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x4ea8ac[_0x7721('0x2d')],_0x50de45[_0x7721('0x35')]));if(_0x4ea8ac['query'][_0x7721('0x1c')]){_0x4bd023[_0x7721('0x2b')]=_['merge'](_0x4bd023[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x4bd023[_0x7721('0x36')],function(_0x400273){var _0x42c438={};_0x42c438[_0x400273]={'$like':'%'+_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x42c438;})});}_0x4bd023=_[_0x7721('0x47')]({},_0x4bd023,_0x4ea8ac[_0x7721('0x3a')]);return _0x51ac8f[_0x7721('0xad')](_0x4bd023);}})[_0x7721('0x16')](function(_0x1192a8){if(_0x1192a8){_0x27ed5e=_0x1192a8[_0x7721('0x39')];if(!_0x4ea8ac['query'][_0x7721('0x4d')](_0x7721('0x4e'))){_0x4bd023['limit']=qs[_0x7721('0x4f')](_0x4ea8ac['query'][_0x7721('0x4f')]);_0x4bd023[_0x7721('0x11')]=qs['offset'](_0x4ea8ac['query'][_0x7721('0x11')]);}return _0x51ac8f['getBlackLists'](_0x4bd023);}})[_0x7721('0x16')](function(_0x2f7067){if(_0x2f7067){return _0x2f7067?{'count':_0x27ed5e,'rows':_0x2f7067}:null;}})[_0x7721('0x16')](respondWithResult(_0x226556,null))[_0x7721('0x30')](handleError(_0x226556,null));};exports[_0x7721('0xae')]=function(_0x376f37,_0x5b157e){var _0x4b84b9;return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0x376f37[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x5b157e,null))[_0x7721('0x16')](function(_0x39d43b){if(_0x39d43b){return _0x39d43b['addBlackLists'](_0x376f37['body'][_0x7721('0x81')],_[_0x7721('0x43')](_0x376f37[_0x7721('0x46')],[_0x7721('0x81'),'id'])||{});}return null;})[_0x7721('0x8d')](function(_0x430304){var _0x469b6b;_0x4b84b9=_0x430304||[];var _0x6766c6=[];if(_0x430304){for(var _0x37877c=0x0;_0x37877c<_0x430304['length'];_0x37877c+=0x1){var _0x259eaa=_0x430304[_0x37877c][_0x7721('0x18')]({'plain':!![]});_0x469b6b=squel['insert']()['into'](_0x7721('0xaf'))[_0x7721('0xa1')]([_0x7721('0x95'),'ContactId',_0x7721('0x94'),_0x7721('0x53'),_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()['field'](_0x7721('0x95'),'phone')[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x259eaa['CmListId'][_0x7721('0x78')](),_0x7721('0x94'))[_0x7721('0x6f')](_0x376f37[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))['field'](_0x7721('0xb0'),_0x7721('0x44'))[_0x7721('0x6f')](_0x7721('0xb0'),'updatedAt')[_0x7721('0x70')](_0x7721('0x97'))['where'](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x259eaa['CmListId']['toString']())[_0x7721('0x2b')]('phone\x20IS\x20NOT\x20NULL'))[_0x7721('0x78')]();_0x6766c6[_0x7721('0x77')](db['sequelize'][_0x7721('0x2d')](_0x469b6b));}return BPromise[_0x7721('0x7e')](_0x6766c6);}})['then'](function(){return _0x4b84b9;})[_0x7721('0x16')](respondWithResult(_0x5b157e,null))[_0x7721('0x30')](handleError(_0x5b157e,null));};exports[_0x7721('0xb1')]=function(_0x37da70,_0x54616a){return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x37da70[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x54616a,null))[_0x7721('0x16')](function(_0x174e79){if(_0x174e79){return _0x174e79['removeBlackLists'](_0x37da70[_0x7721('0x2d')]['ids']);}})[_0x7721('0x16')](function(_0x4c1b63){if(_0x4c1b63){return db[_0x7721('0x57')][_0x7721('0x17')]({'where':{'ListId':_0x37da70[_0x7721('0x2d')][_0x7721('0x81')],'VoiceQueueId':_0x37da70[_0x7721('0x31')]['id']}})['then'](function(){return _0x4c1b63;});}})[_0x7721('0x16')](respondWithStatusCode(_0x54616a,null))[_0x7721('0x30')](handleError(_0x54616a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index f0a2e9f..2e0bb33 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 _0x03d8=['events','../../mysqldb','VoiceQueue','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x4a8a1c,_0x350126){var _0x2c009c=function(_0x20d2ef){while(--_0x20d2ef){_0x4a8a1c['push'](_0x4a8a1c['shift']());}};_0x2c009c(++_0x350126);}(_0x03d8,0xe1));var _0x803d=function(_0x3eb153,_0x237f7b){_0x3eb153=_0x3eb153-0x0;var _0x219a69=_0x03d8[_0x3eb153];return _0x219a69;};'use strict';var EventEmitter=require(_0x803d('0x0'));var VoiceQueue=require(_0x803d('0x1'))['db'][_0x803d('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x803d('0x3')](0x0);var events={'afterCreate':_0x803d('0x4'),'afterUpdate':'update','afterDestroy':_0x803d('0x5')};function emitEvent(_0x574154){return function(_0x8575fd,_0x22d7d0,_0x65680a){VoiceQueueEvents[_0x803d('0x6')](_0x574154+':'+_0x8575fd['id'],_0x8575fd);VoiceQueueEvents['emit'](_0x574154,_0x8575fd);_0x65680a(null);};}for(var e in events){if(events[_0x803d('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x803d('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xb4b6=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save'];(function(_0x27cffe,_0x50d42d){var _0xa40832=function(_0x3932bd){while(--_0x3932bd){_0x27cffe['push'](_0x27cffe['shift']());}};_0xa40832(++_0x50d42d);}(_0xb4b6,0xed));var _0x6b4b=function(_0x257a0e,_0x9d8d76){_0x257a0e=_0x257a0e-0x0;var _0x2cf3b7=_0xb4b6[_0x257a0e];return _0x2cf3b7;};'use strict';var EventEmitter=require(_0x6b4b('0x0'));var VoiceQueue=require(_0x6b4b('0x1'))['db'][_0x6b4b('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x6b4b('0x3')](0x0);var events={'afterCreate':_0x6b4b('0x4'),'afterUpdate':_0x6b4b('0x5'),'afterDestroy':_0x6b4b('0x6')};function emitEvent(_0x16847b){return function(_0x3f85be,_0x250de9,_0x389128){VoiceQueueEvents[_0x6b4b('0x7')](_0x16847b+':'+_0x3f85be['id'],_0x3f85be);VoiceQueueEvents[_0x6b4b('0x7')](_0x16847b,_0x3f85be);_0x389128(null);};}for(var e in events){if(events[_0x6b4b('0x8')](e)){var event=events[e];VoiceQueue[_0x6b4b('0x9')](e,emitEvent(event));}}module[_0x6b4b('0xa')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index d8a65fc..337535e 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x366ad2,_0xae247c){var _0x271bf5=function(_0x540043){while(--_0x540043){_0x366ad2['push'](_0x366ad2['shift']());}};_0x271bf5(++_0xae247c);}(_0x34e8,0x12c));var _0x834e=function(_0x2e875a,_0x247a97){_0x2e875a=_0x2e875a-0x0;var _0x37f6d8=_0x34e8[_0x2e875a];return _0x37f6d8;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x259cad,_0x3dae11){var _0x4e6a68=function(_0x1669dc){while(--_0x1669dc){_0x259cad['push'](_0x259cad['shift']());}};_0x4e6a68(++_0x3dae11);}(_0x3e74,0x175));var _0x43e7=function(_0x50759a,_0x46412e){_0x50759a=_0x50759a-0x0;var _0x1c7816=_0x3e74[_0x50759a];return _0x1c7816;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index f097606..ef850f1 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 _0xaefb=['attributes','limit','include','model','map','ShowVoiceQueue','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaefb,0x15d));var _0xbaef=function(_0x4baac8,_0x5f1dc7){_0x4baac8=_0x4baac8-0x0;var _0x56ebc5=_0xaefb[_0x4baac8];return _0x56ebc5;};'use strict';var _=require(_0xbaef('0x0'));var util=require(_0xbaef('0x1'));var moment=require(_0xbaef('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbaef('0x3'));var db=require(_0xbaef('0x4'))['db'];var utils=require(_0xbaef('0x5'));var logger=require(_0xbaef('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbaef('0x7'));var client=jayson[_0xbaef('0x8')][_0xbaef('0x9')]({'port':0x232a});config[_0xbaef('0xa')]=_[_0xbaef('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbaef('0xc'))(new Redis(config[_0xbaef('0xa')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x1dbf33,_0x3f7646,_0x21c006){return new BPromise(function(_0x311a72,_0x23ffdb){return client[_0xbaef('0xd')](_0x1dbf33,_0x21c006)[_0xbaef('0xe')](function(_0x477c3e){logger['info'](_0xbaef('0xf'),_0x3f7646,_0xbaef('0x10'));logger[_0xbaef('0x11')](_0xbaef('0x12'),_0x3f7646,_0xbaef('0x10'),JSON[_0xbaef('0x13')](_0x477c3e));if(_0x477c3e[_0xbaef('0x14')]){if(_0x477c3e[_0xbaef('0x14')][_0xbaef('0x15')]===0x1f4){logger['error'](_0xbaef('0xf'),_0x3f7646,_0x477c3e[_0xbaef('0x14')][_0xbaef('0x16')]);return _0x23ffdb(_0x477c3e[_0xbaef('0x14')]['message']);}logger[_0xbaef('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x3f7646,_0x477c3e[_0xbaef('0x14')][_0xbaef('0x16')]);return _0x311a72(_0x477c3e[_0xbaef('0x14')]['message']);}else{logger[_0xbaef('0x17')](_0xbaef('0xf'),_0x3f7646,_0xbaef('0x10'));_0x311a72(_0x477c3e['result']['message']);}})[_0xbaef('0x18')](function(_0x10fd17){logger[_0xbaef('0x14')](_0xbaef('0xf'),_0x3f7646,_0x10fd17);_0x23ffdb(_0x10fd17);});});}exports[_0xbaef('0x19')]=function(_0x2e6b42){var _0x342e05=this;return new Promise(function(_0x2628c2,_0x1bdf47){return db[_0xbaef('0x1a')][_0xbaef('0x1b')]({'raw':_0x2e6b42['options']?_0x2e6b42[_0xbaef('0x1c')][_0xbaef('0x1d')]===undefined?!![]:![]:!![],'where':_0x2e6b42['options']?_0x2e6b42['options'][_0xbaef('0x1e')]||null:null,'attributes':_0x2e6b42[_0xbaef('0x1c')]?_0x2e6b42[_0xbaef('0x1c')][_0xbaef('0x1f')]||null:null,'limit':_0x2e6b42['options']?_0x2e6b42[_0xbaef('0x1c')][_0xbaef('0x20')]||null:null,'include':_0x2e6b42[_0xbaef('0x1c')]?_0x2e6b42[_0xbaef('0x1c')][_0xbaef('0x21')]?_['map'](_0x2e6b42[_0xbaef('0x1c')][_0xbaef('0x21')],function(_0x596daf){return{'model':db[_0x596daf[_0xbaef('0x22')]],'as':_0x596daf['as'],'attributes':_0x596daf[_0xbaef('0x1f')],'include':_0x596daf[_0xbaef('0x21')]?_['map'](_0x596daf[_0xbaef('0x21')],function(_0x2f0c29){return{'model':db[_0x2f0c29[_0xbaef('0x22')]],'as':_0x2f0c29['as'],'attributes':_0x2f0c29[_0xbaef('0x1f')],'include':_0x2f0c29[_0xbaef('0x21')]?_[_0xbaef('0x23')](_0x2f0c29['include'],function(_0x26b699){return{'model':db[_0x26b699['model']],'as':_0x26b699['as'],'attributes':_0x26b699[_0xbaef('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbaef('0xe')](function(_0x342a3b){logger[_0xbaef('0x17')](_0xbaef('0x19'),_0x2e6b42);logger[_0xbaef('0x11')](_0xbaef('0x19'),_0x2e6b42,JSON[_0xbaef('0x13')](_0x342a3b));_0x2628c2(_0x342a3b);})[_0xbaef('0x18')](function(_0x2bd963){logger['error'](_0xbaef('0x19'),_0x2bd963[_0xbaef('0x16')],_0x2e6b42);_0x1bdf47(_0x342e05[_0xbaef('0x14')](0x1f4,_0x2bd963['message']));});});};exports[_0xbaef('0x24')]=function(_0x114189){var _0x38e0be=this;return new Promise(function(_0x6a90fb,_0x43f4f2){return db[_0xbaef('0x1a')][_0xbaef('0x25')]({'raw':_0x114189[_0xbaef('0x1c')]?_0x114189[_0xbaef('0x1c')][_0xbaef('0x1d')]===undefined?!![]:![]:!![],'where':_0x114189[_0xbaef('0x1c')]?_0x114189[_0xbaef('0x1c')][_0xbaef('0x1e')]||null:null,'attributes':_0x114189[_0xbaef('0x1c')]?_0x114189[_0xbaef('0x1c')][_0xbaef('0x1f')]||null:null,'include':_0x114189[_0xbaef('0x1c')]?_0x114189[_0xbaef('0x1c')][_0xbaef('0x21')]?_['map'](_0x114189[_0xbaef('0x1c')][_0xbaef('0x21')],function(_0x212286){return{'model':db[_0x212286[_0xbaef('0x22')]],'as':_0x212286['as'],'attributes':_0x212286[_0xbaef('0x1f')],'include':_0x212286['include']?_[_0xbaef('0x23')](_0x212286[_0xbaef('0x21')],function(_0x1ed071){return{'model':db[_0x1ed071[_0xbaef('0x22')]],'as':_0x1ed071['as'],'attributes':_0x1ed071[_0xbaef('0x1f')],'include':_0x1ed071['include']?_[_0xbaef('0x23')](_0x1ed071[_0xbaef('0x21')],function(_0x1ab0fb){return{'model':db[_0x1ab0fb[_0xbaef('0x22')]],'as':_0x1ab0fb['as'],'attributes':_0x1ab0fb[_0xbaef('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbaef('0xe')](function(_0x9e83ab){logger[_0xbaef('0x17')]('ShowVoiceQueue',_0x114189);logger[_0xbaef('0x11')](_0xbaef('0x24'),_0x114189,JSON[_0xbaef('0x13')](_0x9e83ab));_0x6a90fb(_0x9e83ab);})[_0xbaef('0x18')](function(_0x487625){logger[_0xbaef('0x14')](_0xbaef('0x24'),_0x487625[_0xbaef('0x16')],_0x114189);_0x43f4f2(_0x38e0be['error'](0x1f4,_0x487625[_0xbaef('0x16')]));});});}; \ No newline at end of file +var _0xdf97=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','GetVoiceQueue','VoiceQueue','findAll','raw','options','where','attributes','limit','map','model','include','stringify','catch','find','ShowVoiceQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x41a080,_0x2ee5bf){var _0x4a3594=function(_0x29c3d7){while(--_0x29c3d7){_0x41a080['push'](_0x41a080['shift']());}};_0x4a3594(++_0x2ee5bf);}(_0xdf97,0x1f3));var _0x7df9=function(_0x5c6a57,_0x429ec5){_0x5c6a57=_0x5c6a57-0x0;var _0x346d3f=_0xdf97[_0x5c6a57];return _0x346d3f;};'use strict';var _=require(_0x7df9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7df9('0x1'));var rs=require(_0x7df9('0x2'));var fs=require('fs');var Redis=require(_0x7df9('0x3'));var db=require(_0x7df9('0x4'))['db'];var utils=require(_0x7df9('0x5'));var logger=require(_0x7df9('0x6'))(_0x7df9('0x7'));var config=require(_0x7df9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7df9('0x9')][_0x7df9('0xa')]({'port':0x232a});config[_0x7df9('0xb')]=_[_0x7df9('0xc')](config[_0x7df9('0xb')],{'host':_0x7df9('0xd'),'port':0x18eb});var socket=require(_0x7df9('0xe'))(new Redis(config['redis']));require(_0x7df9('0xf'))[_0x7df9('0x10')](socket);function respondWithRpcPromise(_0x2b1232,_0x1afa0d,_0xaa8933){return new BPromise(function(_0x44e91b,_0x5b0cc3){return client[_0x7df9('0x11')](_0x2b1232,_0xaa8933)[_0x7df9('0x12')](function(_0x97ae8e){logger['info'](_0x7df9('0x13'),_0x1afa0d,_0x7df9('0x14'));logger[_0x7df9('0x15')](_0x7df9('0x16'),_0x1afa0d,_0x7df9('0x14'),JSON['stringify'](_0x97ae8e));if(_0x97ae8e[_0x7df9('0x17')]){if(_0x97ae8e[_0x7df9('0x17')][_0x7df9('0x18')]===0x1f4){logger[_0x7df9('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x1afa0d,_0x97ae8e[_0x7df9('0x17')][_0x7df9('0x19')]);return _0x5b0cc3(_0x97ae8e[_0x7df9('0x17')][_0x7df9('0x19')]);}logger[_0x7df9('0x17')](_0x7df9('0x13'),_0x1afa0d,_0x97ae8e[_0x7df9('0x17')][_0x7df9('0x19')]);return _0x44e91b(_0x97ae8e[_0x7df9('0x17')][_0x7df9('0x19')]);}else{logger[_0x7df9('0x1a')](_0x7df9('0x13'),_0x1afa0d,'request\x20sent');_0x44e91b(_0x97ae8e['result']['message']);}})['catch'](function(_0x1f674a){logger['error'](_0x7df9('0x13'),_0x1afa0d,_0x1f674a);_0x5b0cc3(_0x1f674a);});});}exports[_0x7df9('0x1b')]=function(_0x384ecf){var _0x3e1f77=this;return new Promise(function(_0x10c768,_0x11de41){return db[_0x7df9('0x1c')][_0x7df9('0x1d')]({'raw':_0x384ecf['options']?_0x384ecf['options'][_0x7df9('0x1e')]===undefined?!![]:![]:!![],'where':_0x384ecf[_0x7df9('0x1f')]?_0x384ecf[_0x7df9('0x1f')][_0x7df9('0x20')]||null:null,'attributes':_0x384ecf[_0x7df9('0x1f')]?_0x384ecf[_0x7df9('0x1f')][_0x7df9('0x21')]||null:null,'limit':_0x384ecf[_0x7df9('0x1f')]?_0x384ecf['options'][_0x7df9('0x22')]||null:null,'include':_0x384ecf[_0x7df9('0x1f')]?_0x384ecf[_0x7df9('0x1f')]['include']?_[_0x7df9('0x23')](_0x384ecf[_0x7df9('0x1f')]['include'],function(_0x5ba1c2){return{'model':db[_0x5ba1c2[_0x7df9('0x24')]],'as':_0x5ba1c2['as'],'attributes':_0x5ba1c2[_0x7df9('0x21')],'include':_0x5ba1c2[_0x7df9('0x25')]?_[_0x7df9('0x23')](_0x5ba1c2[_0x7df9('0x25')],function(_0x21cc4f){return{'model':db[_0x21cc4f[_0x7df9('0x24')]],'as':_0x21cc4f['as'],'attributes':_0x21cc4f[_0x7df9('0x21')],'include':_0x21cc4f[_0x7df9('0x25')]?_['map'](_0x21cc4f[_0x7df9('0x25')],function(_0xef840c){return{'model':db[_0xef840c[_0x7df9('0x24')]],'as':_0xef840c['as'],'attributes':_0xef840c['attributes']};}):[]};}):[]};}):[]:[]})[_0x7df9('0x12')](function(_0x1cda86){logger[_0x7df9('0x1a')](_0x7df9('0x1b'),_0x384ecf);logger[_0x7df9('0x15')](_0x7df9('0x1b'),_0x384ecf,JSON[_0x7df9('0x26')](_0x1cda86));_0x10c768(_0x1cda86);})[_0x7df9('0x27')](function(_0x2585c5){logger[_0x7df9('0x17')]('GetVoiceQueue',_0x2585c5[_0x7df9('0x19')],_0x384ecf);_0x11de41(_0x3e1f77['error'](0x1f4,_0x2585c5[_0x7df9('0x19')]));});});};exports['ShowVoiceQueue']=function(_0xda52d4){var _0x199052=this;return new Promise(function(_0x5abce5,_0x5ba95f){return db[_0x7df9('0x1c')][_0x7df9('0x28')]({'raw':_0xda52d4['options']?_0xda52d4[_0x7df9('0x1f')][_0x7df9('0x1e')]===undefined?!![]:![]:!![],'where':_0xda52d4[_0x7df9('0x1f')]?_0xda52d4['options'][_0x7df9('0x20')]||null:null,'attributes':_0xda52d4[_0x7df9('0x1f')]?_0xda52d4[_0x7df9('0x1f')][_0x7df9('0x21')]||null:null,'include':_0xda52d4[_0x7df9('0x1f')]?_0xda52d4[_0x7df9('0x1f')][_0x7df9('0x25')]?_[_0x7df9('0x23')](_0xda52d4[_0x7df9('0x1f')][_0x7df9('0x25')],function(_0x36c590){return{'model':db[_0x36c590[_0x7df9('0x24')]],'as':_0x36c590['as'],'attributes':_0x36c590[_0x7df9('0x21')],'include':_0x36c590[_0x7df9('0x25')]?_[_0x7df9('0x23')](_0x36c590[_0x7df9('0x25')],function(_0x2db82d){return{'model':db[_0x2db82d['model']],'as':_0x2db82d['as'],'attributes':_0x2db82d[_0x7df9('0x21')],'include':_0x2db82d[_0x7df9('0x25')]?_[_0x7df9('0x23')](_0x2db82d['include'],function(_0x1e8e9f){return{'model':db[_0x1e8e9f[_0x7df9('0x24')]],'as':_0x1e8e9f['as'],'attributes':_0x1e8e9f[_0x7df9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7df9('0x12')](function(_0x57e990){logger[_0x7df9('0x1a')]('ShowVoiceQueue',_0xda52d4);logger[_0x7df9('0x15')](_0x7df9('0x29'),_0xda52d4,JSON[_0x7df9('0x26')](_0x57e990));_0x5abce5(_0x57e990);})['catch'](function(_0x389359){logger[_0x7df9('0x17')](_0x7df9('0x29'),_0x389359[_0x7df9('0x19')],_0xda52d4);_0x5ba95f(_0x199052['error'](0x1f4,_0x389359[_0x7df9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 601f8d1..3214b63 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 _0x332a=['voiceQueue:','./voiceQueue.events','save','remove','update','emit','register'];(function(_0x1f5303,_0x354414){var _0x84ef1a=function(_0x27e275){while(--_0x27e275){_0x1f5303['push'](_0x1f5303['shift']());}};_0x84ef1a(++_0x354414);}(_0x332a,0x158));var _0xa332=function(_0x259264,_0xfe2f1f){_0x259264=_0x259264-0x0;var _0x333ff4=_0x332a[_0x259264];return _0x333ff4;};'use strict';var VoiceQueueEvents=require(_0xa332('0x0'));var events=[_0xa332('0x1'),_0xa332('0x2'),_0xa332('0x3')];function createListener(_0x327169,_0x44bbd6){return function(_0x16aaa1){_0x44bbd6[_0xa332('0x4')](_0x327169,_0x16aaa1);};}function removeListener(_0xa73375,_0xc28549){return function(){VoiceQueueEvents['removeListener'](_0xa73375,_0xc28549);};}exports[_0xa332('0x5')]=function(_0x2f7b0c){for(var _0x18fb37=0x0,_0x3d169b=events['length'];_0x18fb37<_0x3d169b;_0x18fb37++){var _0x1e74bc=events[_0x18fb37];var _0x425a4a=createListener(_0xa332('0x6')+_0x1e74bc,_0x2f7b0c);VoiceQueueEvents['on'](_0x1e74bc,_0x425a4a);}}; \ No newline at end of file +var _0x7571=['length','./voiceQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x49a4be,_0x35dab0){var _0x4ae213=function(_0x592453){while(--_0x592453){_0x49a4be['push'](_0x49a4be['shift']());}};_0x4ae213(++_0x35dab0);}(_0x7571,0xc9));var _0x1757=function(_0x1c56c0,_0x44022d){_0x1c56c0=_0x1c56c0-0x0;var _0x54ef1c=_0x7571[_0x1c56c0];return _0x54ef1c;};'use strict';var VoiceQueueEvents=require(_0x1757('0x0'));var events=[_0x1757('0x1'),_0x1757('0x2'),_0x1757('0x3')];function createListener(_0xc37367,_0x5310ba){return function(_0x1461c3){_0x5310ba[_0x1757('0x4')](_0xc37367,_0x1461c3);};}function removeListener(_0x167d0a,_0x5daf88){return function(){VoiceQueueEvents[_0x1757('0x5')](_0x167d0a,_0x5daf88);};}exports[_0x1757('0x6')]=function(_0x346be9){for(var _0x33a907=0x0,_0x88cc19=events[_0x1757('0x7')];_0x33a907<_0x88cc19;_0x33a907++){var _0x13b60a=events[_0x33a907];var _0x1cc071=createListener('voiceQueue:'+_0x13b60a,_0x346be9);VoiceQueueEvents['on'](_0x13b60a,_0x1cc071);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 5aa2d71..cf0cfa7 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 _0x15d3=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','index','get','/describe','describe','/index','isAuthenticated','getVoiceQueuesReport','/:id','show','post','create','update','delete','destroy','exports','multer','util'];(function(_0x58f960,_0x4a2b10){var _0xebcafa=function(_0x14eb04){while(--_0x14eb04){_0x58f960['push'](_0x58f960['shift']());}};_0xebcafa(++_0x4a2b10);}(_0x15d3,0x1e2));var _0x315d=function(_0x458c53,_0x9ceccd){_0x458c53=_0x458c53-0x0;var _0x4cfc64=_0x15d3[_0x458c53];return _0x4cfc64;};'use strict';var multer=require(_0x315d('0x0'));var util=require(_0x315d('0x1'));var path=require(_0x315d('0x2'));var timeout=require(_0x315d('0x3'));var express=require(_0x315d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x315d('0x5'));var interaction=require(_0x315d('0x6'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x315d('0x7')]);router[_0x315d('0x8')](_0x315d('0x9'),auth['isAuthenticated'](),controller[_0x315d('0xa')]);router['get'](_0x315d('0xb'),auth[_0x315d('0xc')](),controller[_0x315d('0xd')]);router[_0x315d('0x8')](_0x315d('0xe'),auth['isAuthenticated'](),controller[_0x315d('0xf')]);router[_0x315d('0x10')]('/',auth[_0x315d('0xc')](),controller[_0x315d('0x11')]);router['put'](_0x315d('0xe'),auth[_0x315d('0xc')](),controller[_0x315d('0x12')]);router[_0x315d('0x13')](_0x315d('0xe'),auth[_0x315d('0xc')](),controller[_0x315d('0x14')]);module[_0x315d('0x15')]=router; \ No newline at end of file +var _0x048b=['describe','/index','getVoiceQueuesReport','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x048b,0x12b));var _0xb048=function(_0x1549d9,_0x219756){_0x1549d9=_0x1549d9-0x0;var _0xa8ec06=_0x048b[_0x1549d9];return _0xa8ec06;};'use strict';var multer=require(_0xb048('0x0'));var util=require(_0xb048('0x1'));var path=require(_0xb048('0x2'));var timeout=require(_0xb048('0x3'));var express=require(_0xb048('0x4'));var router=express['Router']();var fs_extra=require(_0xb048('0x5'));var auth=require(_0xb048('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb048('0x7'));var controller=require(_0xb048('0x8'));router[_0xb048('0x9')]('/',auth[_0xb048('0xa')](),controller[_0xb048('0xb')]);router['get'](_0xb048('0xc'),auth[_0xb048('0xa')](),controller[_0xb048('0xd')]);router[_0xb048('0x9')](_0xb048('0xe'),auth[_0xb048('0xa')](),controller[_0xb048('0xf')]);router[_0xb048('0x9')](_0xb048('0x10'),auth['isAuthenticated'](),controller['show']);router[_0xb048('0x11')]('/',auth[_0xb048('0xa')](),controller[_0xb048('0x12')]);router[_0xb048('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xb048('0x14')]);router[_0xb048('0x15')](_0xb048('0x10'),auth[_0xb048('0xa')](),controller[_0xb048('0x16')]);module[_0xb048('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 38fa39e..c9abfb9 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 _0x0f77=['getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','moment','exports','STRING','DATE'];(function(_0x49f45f,_0x17a489){var _0x22c73d=function(_0x50b9eb){while(--_0x50b9eb){_0x49f45f['push'](_0x49f45f['shift']());}};_0x22c73d(++_0x17a489);}(_0x0f77,0xb2));var _0x70f7=function(_0x39e1f0,_0x560848){_0x39e1f0=_0x39e1f0-0x0;var _0x240e82=_0x0f77[_0x39e1f0];return _0x240e82;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x70f7('0x0'));module[_0x70f7('0x1')]={'type':{'type':Sequelize[_0x70f7('0x2')]},'uniqueid':{'type':Sequelize[_0x70f7('0x2')]},'calleridnum':{'type':Sequelize[_0x70f7('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x70f7('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x70f7('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x2051bd){var _0xb109de=moment(_0x2051bd);var _0x4b4e0e=moment(this[_0x70f7('0x4')](_0x70f7('0x5')))[_0x70f7('0x6')](_0x70f7('0x7'));var _0x3b7547=_0xb109de[_0x70f7('0x8')](_0x4b4e0e,'seconds');this[_0x70f7('0x9')]('queuecallerleaveAt',_0x2051bd);this[_0x70f7('0x9')](_0x70f7('0xa'),_0x3b7547||null);}},'position':{'type':Sequelize[_0x70f7('0xb')]},'count':{'type':Sequelize[_0x70f7('0xb')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x70f7('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x70f7('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x70f7('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x70f7('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x70f7('0x2')]},'accountcode':{'type':Sequelize[_0x70f7('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x70f7('0x2')]},'priority':{'type':Sequelize[_0x70f7('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x70f7('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x70f7('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x70f7('0x2')]},'secondDisposition':{'type':Sequelize[_0x70f7('0x2')]},'thirdDisposition':{'type':Sequelize[_0x70f7('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x70f7('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0x70f7('0x2')]}}; \ No newline at end of file +var _0x5c32=['seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x2e52f8,_0x3ff88e){var _0x21687b=function(_0x382a8f){while(--_0x382a8f){_0x2e52f8['push'](_0x2e52f8['shift']());}};_0x21687b(++_0x3ff88e);}(_0x5c32,0x108));var _0x25c3=function(_0x13bd3f,_0x51fabc){_0x13bd3f=_0x13bd3f-0x0;var _0x191efa=_0x5c32[_0x13bd3f];return _0x191efa;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x25c3('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x25c3('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x25c3('0x2')],'set':function(_0xc26d11){var _0x207f9d=moment(_0xc26d11);var _0x212bd2=moment(this[_0x25c3('0x3')](_0x25c3('0x4')))[_0x25c3('0x5')](_0x25c3('0x6'));var _0x4b5777=_0x207f9d[_0x25c3('0x7')](_0x212bd2,_0x25c3('0x8'));this[_0x25c3('0x9')](_0x25c3('0xa'),_0xc26d11);this[_0x25c3('0x9')](_0x25c3('0xb'),_0x4b5777||null);}},'position':{'type':Sequelize[_0x25c3('0xc')]},'count':{'type':Sequelize[_0x25c3('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x25c3('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x25c3('0x2')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x25c3('0x2')]},'queuecallerexit':{'type':Sequelize[_0x25c3('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x25c3('0x2')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x25c3('0xe')},'originalposition':{'type':Sequelize[_0x25c3('0xc')]},'channel':{'type':Sequelize[_0x25c3('0x1')]},'connectedlinenum':{'type':Sequelize[_0x25c3('0x1')]},'connectedlinename':{'type':Sequelize[_0x25c3('0x1')]},'accountcode':{'type':Sequelize[_0x25c3('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x25c3('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x25c3('0xc')]},'mohtime':{'type':Sequelize[_0x25c3('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x25c3('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x25c3('0x1')]},'transfer':{'type':Sequelize[_0x25c3('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x25c3('0xf')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x25c3('0x1')]},'disposition':{'type':Sequelize[_0x25c3('0x1')]},'secondDisposition':{'type':Sequelize[_0x25c3('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x25c3('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x25c3('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 4bf5c54..65e5258 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 _0x6777=['redis','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','limit','undefined','offset','count','set','Content-Range','json','save','update','destroy','error','name','send','index','VoiceQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','type','options','then','includeAll','include','findAll','rows','catch','params','find','create','body','hasOwnProperty','getVoiceQueuesReport','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb'];(function(_0x546aaf,_0x1ed138){var _0x1cbf6d=function(_0x36c837){while(--_0x36c837){_0x546aaf['push'](_0x546aaf['shift']());}};_0x1cbf6d(++_0x1ed138);}(_0x6777,0xcc));var _0x7677=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0x6777[_0x4c1ec2];return _0x3f6f1c;};'use strict';var emlformat=require(_0x7677('0x0'));var rimraf=require(_0x7677('0x1'));var zipdir=require(_0x7677('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7677('0x3'));var moment=require(_0x7677('0x4'));var BPromise=require(_0x7677('0x5'));var Mustache=require('mustache');var util=require(_0x7677('0x6'));var path=require(_0x7677('0x7'));var sox=require('sox');var csv=require(_0x7677('0x8'));var ejs=require(_0x7677('0x9'));var fs=require('fs');var fs_extra=require(_0x7677('0xa'));var _=require('lodash');var squel=require(_0x7677('0xb'));var crypto=require(_0x7677('0xc'));var jsforce=require(_0x7677('0xd'));var deskjs=require(_0x7677('0xe'));var toCsv=require(_0x7677('0x8'));var querystring=require('querystring');var Papa=require(_0x7677('0xf'));var Redis=require(_0x7677('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7677('0x11'));var hardwareService=require(_0x7677('0x12'));var logger=require('../../config/logger')(_0x7677('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7677('0x14'))['db'];config[_0x7677('0x15')]=_['defaults'](config[_0x7677('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x7677('0x16'))(new Redis(config[_0x7677('0x15')]));require(_0x7677('0x17'))[_0x7677('0x18')](socket);function respondWithStatusCode(_0xacb100,_0x149a3b){_0x149a3b=_0x149a3b||0xcc;return function(_0x2ce50d){if(_0x2ce50d){return _0xacb100[_0x7677('0x19')](_0x149a3b);}return _0xacb100[_0x7677('0x1a')](_0x149a3b)[_0x7677('0x1b')]();};}function respondWithResult(_0x1767d8,_0x3f6d15){_0x3f6d15=_0x3f6d15||0xc8;return function(_0xd7efbe){if(_0xd7efbe){return _0x1767d8[_0x7677('0x1a')](_0x3f6d15)['json'](_0xd7efbe);}};}function respondWithFilteredResult(_0x328925,_0x644a75){return function(_0x53c278){if(_0x53c278){var _0x49ac98=typeof _0x644a75['offset']==='undefined'&&typeof _0x644a75[_0x7677('0x1c')]===_0x7677('0x1d');var _0x1a5561=_0x53c278['count'];var _0x359ae2=_0x49ac98?0x0:_0x644a75[_0x7677('0x1e')];var _0x2d511a=_0x49ac98?_0x53c278[_0x7677('0x1f')]:_0x644a75['offset']+_0x644a75[_0x7677('0x1c')];var _0x2db296;if(_0x2d511a>=_0x1a5561){_0x2d511a=_0x1a5561;_0x2db296=0xc8;}else{_0x2db296=0xce;}_0x328925[_0x7677('0x1a')](_0x2db296);return _0x328925[_0x7677('0x20')](_0x7677('0x21'),_0x359ae2+'-'+_0x2d511a+'/'+_0x1a5561)[_0x7677('0x22')](_0x53c278);}return null;};}function patchUpdates(_0x82c97a){return function(_0x2d76ef){try{jsonpatch['apply'](_0x2d76ef,_0x82c97a,!![]);}catch(_0x1d20df){return BPromise['reject'](_0x1d20df);}return _0x2d76ef[_0x7677('0x23')]();};}function saveUpdates(_0x8e8d45,_0x1b6006){return function(_0x47b1e6){if(_0x47b1e6){return _0x47b1e6[_0x7677('0x24')](_0x8e8d45)['then'](function(_0x3106a6){return _0x3106a6;});}return null;};}function removeEntity(_0x41b6dd,_0x57618a){return function(_0xbb2c69){if(_0xbb2c69){return _0xbb2c69[_0x7677('0x25')]()['then'](function(){_0x41b6dd[_0x7677('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2823e0,_0x13cb61){return function(_0x363ca9){if(!_0x363ca9){_0x2823e0['sendStatus'](0x194);}return _0x363ca9;};}function handleError(_0x131013,_0xc1be54){_0xc1be54=_0xc1be54||0x1f4;return function(_0x3ab613){logger[_0x7677('0x26')](_0x3ab613['stack']);if(_0x3ab613[_0x7677('0x27')]){delete _0x3ab613['name'];}_0x131013[_0x7677('0x1a')](_0xc1be54)[_0x7677('0x28')](_0x3ab613);};}exports[_0x7677('0x29')]=function(_0x4afeab,_0x3ce049){var _0x3342d7={},_0x5dca18={},_0x4f607f={'count':0x0,'rows':[]};var _0x1cf037=_['map'](db[_0x7677('0x2a')][_0x7677('0x2b')],function(_0x166e78){return{'name':_0x166e78[_0x7677('0x2c')],'type':_0x166e78['type'][_0x7677('0x2d')]};});_0x5dca18[_0x7677('0x2e')]=_[_0x7677('0x2f')](_0x1cf037,_0x7677('0x27'));_0x5dca18[_0x7677('0x30')]=_[_0x7677('0x31')](_0x4afeab[_0x7677('0x30')]);_0x5dca18[_0x7677('0x32')]=_['intersection'](_0x5dca18[_0x7677('0x2e')],_0x5dca18[_0x7677('0x30')]);_0x3342d7[_0x7677('0x33')]=_[_0x7677('0x34')](_0x5dca18[_0x7677('0x2e')],qs[_0x7677('0x35')](_0x4afeab[_0x7677('0x30')][_0x7677('0x35')]));_0x3342d7[_0x7677('0x33')]=_0x3342d7[_0x7677('0x33')][_0x7677('0x36')]?_0x3342d7['attributes']:_0x5dca18[_0x7677('0x2e')];if(!_0x4afeab[_0x7677('0x30')]['hasOwnProperty']('nolimit')){_0x3342d7[_0x7677('0x1c')]=qs[_0x7677('0x1c')](_0x4afeab[_0x7677('0x30')]['limit']);_0x3342d7[_0x7677('0x1e')]=qs['offset'](_0x4afeab[_0x7677('0x30')][_0x7677('0x1e')]);}_0x3342d7[_0x7677('0x37')]=qs[_0x7677('0x38')](_0x4afeab[_0x7677('0x30')]['sort']);_0x3342d7[_0x7677('0x39')]=qs['filters'](_[_0x7677('0x3a')](_0x4afeab[_0x7677('0x30')],_0x5dca18['filters']),_0x1cf037);if(_0x4afeab[_0x7677('0x30')][_0x7677('0x3b')]){_0x3342d7[_0x7677('0x39')]=_[_0x7677('0x3c')](_0x3342d7['where'],{'$or':_[_0x7677('0x2f')](_0x1cf037,function(_0x594223){if(_0x594223[_0x7677('0x3d')]!=='VIRTUAL'){var _0x383452={};_0x383452[_0x594223['name']]={'$like':'%'+_0x4afeab['query']['filter']+'%'};return _0x383452;}})});}_0x3342d7=_[_0x7677('0x3c')]({},_0x3342d7,_0x4afeab[_0x7677('0x3e')]);var _0x1a6a73={'where':_0x3342d7[_0x7677('0x39')]};return db[_0x7677('0x2a')][_0x7677('0x1f')](_0x1a6a73)[_0x7677('0x3f')](function(_0x29d46c){_0x4f607f[_0x7677('0x1f')]=_0x29d46c;if(_0x4afeab[_0x7677('0x30')][_0x7677('0x40')]){_0x3342d7[_0x7677('0x41')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x7677('0x42')](_0x3342d7);})[_0x7677('0x3f')](function(_0x365447){_0x4f607f[_0x7677('0x43')]=_0x365447;return _0x4f607f;})['then'](respondWithFilteredResult(_0x3ce049,_0x3342d7))[_0x7677('0x44')](handleError(_0x3ce049,null));};exports['show']=function(_0x357611,_0x8a961){var _0x472442={'raw':![],'where':{'id':_0x357611[_0x7677('0x45')]['id']}},_0x20dbcb={};_0x20dbcb[_0x7677('0x2e')]=_[_0x7677('0x31')](db[_0x7677('0x2a')][_0x7677('0x2b')]);_0x20dbcb[_0x7677('0x30')]=_[_0x7677('0x31')](_0x357611[_0x7677('0x30')]);_0x20dbcb[_0x7677('0x32')]=_[_0x7677('0x34')](_0x20dbcb['model'],_0x20dbcb[_0x7677('0x30')]);_0x472442[_0x7677('0x33')]=_['intersection'](_0x20dbcb[_0x7677('0x2e')],qs[_0x7677('0x35')](_0x357611[_0x7677('0x30')][_0x7677('0x35')]));_0x472442['attributes']=_0x472442[_0x7677('0x33')][_0x7677('0x36')]?_0x472442['attributes']:_0x20dbcb[_0x7677('0x2e')];if(_0x357611[_0x7677('0x30')][_0x7677('0x40')]){_0x472442['include']=[{'all':!![]}];}_0x472442=_[_0x7677('0x3c')]({},_0x472442,_0x357611[_0x7677('0x3e')]);return db['VoiceQueueReport'][_0x7677('0x46')](_0x472442)[_0x7677('0x3f')](handleEntityNotFound(_0x8a961,null))[_0x7677('0x3f')](respondWithResult(_0x8a961,null))[_0x7677('0x44')](handleError(_0x8a961,null));};exports[_0x7677('0x47')]=function(_0x1e698d,_0x2d2764){return db[_0x7677('0x2a')]['create'](_0x1e698d[_0x7677('0x48')],{})[_0x7677('0x3f')](respondWithResult(_0x2d2764,0xc9))['catch'](handleError(_0x2d2764,null));};exports['update']=function(_0x428c94,_0x19512a){if(_0x428c94[_0x7677('0x48')]['id']){delete _0x428c94['body']['id'];}return db[_0x7677('0x2a')]['find']({'where':{'id':_0x428c94['params']['id']}})[_0x7677('0x3f')](handleEntityNotFound(_0x19512a,null))['then'](saveUpdates(_0x428c94['body'],null))[_0x7677('0x3f')](respondWithResult(_0x19512a,null))['catch'](handleError(_0x19512a,null));};exports[_0x7677('0x25')]=function(_0x56e319,_0x3a17b6){return db[_0x7677('0x2a')]['find']({'where':{'id':_0x56e319[_0x7677('0x45')]['id']}})[_0x7677('0x3f')](handleEntityNotFound(_0x3a17b6,null))[_0x7677('0x3f')](removeEntity(_0x3a17b6,null))[_0x7677('0x44')](handleError(_0x3a17b6,null));};exports['describe']=function(_0x5d2f97,_0x5f36f2){return db['VoiceQueueReport']['describe']()[_0x7677('0x3f')](respondWithResult(_0x5f36f2,null))[_0x7677('0x44')](handleError(_0x5f36f2,null));};exports['getVoiceQueuesReport']=function(_0x459bcf,_0x3676d0){var _0x22a1dc={},_0x581861={},_0x468d80={'count':0x0,'rows':[]};_0x581861['model']=_[_0x7677('0x31')](db['VoiceQueueReport'][_0x7677('0x2b')]);_0x581861[_0x7677('0x30')]=_[_0x7677('0x31')](_0x459bcf[_0x7677('0x30')]);_0x581861['filters']=_['intersection'](_0x581861[_0x7677('0x2e')],_0x581861[_0x7677('0x30')]);_0x22a1dc[_0x7677('0x33')]=_[_0x7677('0x34')](_0x581861['model'],qs[_0x7677('0x35')](_0x459bcf[_0x7677('0x30')][_0x7677('0x35')]));_0x22a1dc[_0x7677('0x33')]=_0x22a1dc[_0x7677('0x33')][_0x7677('0x36')]?_0x22a1dc[_0x7677('0x33')]:_0x581861['model'];if(!_0x459bcf[_0x7677('0x30')][_0x7677('0x49')]('nolimit')){_0x22a1dc[_0x7677('0x1c')]=qs['limit'](_0x459bcf[_0x7677('0x30')][_0x7677('0x1c')]);_0x22a1dc['offset']=qs['offset'](_0x459bcf[_0x7677('0x30')][_0x7677('0x1e')]);}_0x22a1dc[_0x7677('0x37')]=qs[_0x7677('0x38')](_0x459bcf[_0x7677('0x30')]['sort']);_0x22a1dc[_0x7677('0x39')]=qs[_0x7677('0x32')](_['pick'](_0x459bcf[_0x7677('0x30')],_0x581861['filters']));if(_0x459bcf[_0x7677('0x30')][_0x7677('0x3b')]){_0x22a1dc['where']=_['merge'](_0x22a1dc[_0x7677('0x39')],{'$or':_[_0x7677('0x2f')](_0x22a1dc[_0x7677('0x33')],function(_0xf5062d){var _0x53643e={};_0x53643e[_0xf5062d]={'$like':'%'+_0x459bcf[_0x7677('0x30')]['filter']+'%'};return _0x53643e;})});}_0x22a1dc=_[_0x7677('0x3c')]({},_0x22a1dc,_0x459bcf[_0x7677('0x3e')]);var _0x4e60c0={'where':_0x22a1dc['where']};return db[_0x7677('0x2a')][_0x7677('0x1f')](_0x4e60c0)[_0x7677('0x3f')](function(_0x109aa9){_0x468d80[_0x7677('0x1f')]=_0x109aa9;if(_0x459bcf[_0x7677('0x30')][_0x7677('0x40')]){_0x22a1dc[_0x7677('0x41')]=[{'all':!![]}];}return db[_0x7677('0x2a')]['findAll'](_0x22a1dc);})[_0x7677('0x3f')](function(_0xebb1b6){_0x468d80['rows']=_0xebb1b6;return _0x468d80;})[_0x7677('0x3f')](respondWithFilteredResult(_0x3676d0,_0x22a1dc,_0x7677('0x4a')))[_0x7677('0x44')](handleError(_0x3676d0,null,_0x7677('0x4a')));}; \ No newline at end of file +var _0x8f34=['length','model','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','show','include','catch','create','body','find','params','describe','getVoiceQueuesReport','findAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','offset','limit','undefined','count','json','reject','save','update','then','destroy','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','keys','query','filters','attributes','intersection','fields'];(function(_0xb30d7f,_0x438b75){var _0x3f52a7=function(_0x8840d7){while(--_0x8840d7){_0xb30d7f['push'](_0xb30d7f['shift']());}};_0x3f52a7(++_0x438b75);}(_0x8f34,0x108));var _0x48f3=function(_0x3cdbc6,_0x5d1841){_0x3cdbc6=_0x3cdbc6-0x0;var _0x2b8b80=_0x8f34[_0x3cdbc6];return _0x2b8b80;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x48f3('0x0'));var zipdir=require(_0x48f3('0x1'));var jsonpatch=require(_0x48f3('0x2'));var rp=require(_0x48f3('0x3'));var moment=require(_0x48f3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x48f3('0x5'));var util=require(_0x48f3('0x6'));var path=require(_0x48f3('0x7'));var sox=require('sox');var csv=require(_0x48f3('0x8'));var ejs=require(_0x48f3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x48f3('0xa'));var jsforce=require(_0x48f3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x48f3('0x8'));var querystring=require(_0x48f3('0xc'));var Papa=require(_0x48f3('0xd'));var Redis=require(_0x48f3('0xe'));var authService=require(_0x48f3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x48f3('0x10'));var hardwareService=require(_0x48f3('0x11'));var logger=require(_0x48f3('0x12'))('api');var utils=require(_0x48f3('0x13'));var config=require(_0x48f3('0x14'));var licenseUtil=require(_0x48f3('0x15'));var db=require(_0x48f3('0x16'))['db'];config[_0x48f3('0x17')]=_[_0x48f3('0x18')](config[_0x48f3('0x17')],{'host':_0x48f3('0x19'),'port':0x18eb});var socket=require(_0x48f3('0x1a'))(new Redis(config[_0x48f3('0x17')]));require(_0x48f3('0x1b'))[_0x48f3('0x1c')](socket);function respondWithStatusCode(_0x5bf974,_0x4c1b11){_0x4c1b11=_0x4c1b11||0xcc;return function(_0x58e14e){if(_0x58e14e){return _0x5bf974['sendStatus'](_0x4c1b11);}return _0x5bf974[_0x48f3('0x1d')](_0x4c1b11)['end']();};}function respondWithResult(_0x15f986,_0x271365){_0x271365=_0x271365||0xc8;return function(_0x25000e){if(_0x25000e){return _0x15f986[_0x48f3('0x1d')](_0x271365)['json'](_0x25000e);}};}function respondWithFilteredResult(_0x45c0f6,_0x543870){return function(_0x17d36d){if(_0x17d36d){var _0x2fec72=typeof _0x543870[_0x48f3('0x1e')]==='undefined'&&typeof _0x543870[_0x48f3('0x1f')]===_0x48f3('0x20');var _0x18b9ba=_0x17d36d[_0x48f3('0x21')];var _0x1fafe0=_0x2fec72?0x0:_0x543870[_0x48f3('0x1e')];var _0x3b8a11=_0x2fec72?_0x17d36d[_0x48f3('0x21')]:_0x543870[_0x48f3('0x1e')]+_0x543870['limit'];var _0x5d6bd5;if(_0x3b8a11>=_0x18b9ba){_0x3b8a11=_0x18b9ba;_0x5d6bd5=0xc8;}else{_0x5d6bd5=0xce;}_0x45c0f6[_0x48f3('0x1d')](_0x5d6bd5);return _0x45c0f6['set']('Content-Range',_0x1fafe0+'-'+_0x3b8a11+'/'+_0x18b9ba)[_0x48f3('0x22')](_0x17d36d);}return null;};}function patchUpdates(_0x437705){return function(_0x5612d4){try{jsonpatch['apply'](_0x5612d4,_0x437705,!![]);}catch(_0x195bed){return BPromise[_0x48f3('0x23')](_0x195bed);}return _0x5612d4[_0x48f3('0x24')]();};}function saveUpdates(_0x37cbf1,_0x2c9f2a){return function(_0x2ab129){if(_0x2ab129){return _0x2ab129[_0x48f3('0x25')](_0x37cbf1)[_0x48f3('0x26')](function(_0x322de1){return _0x322de1;});}return null;};}function removeEntity(_0x21772b,_0x2fa494){return function(_0xde75e0){if(_0xde75e0){return _0xde75e0[_0x48f3('0x27')]()[_0x48f3('0x26')](function(){_0x21772b[_0x48f3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x222b23,_0x437768){return function(_0x114856){if(!_0x114856){_0x222b23['sendStatus'](0x194);}return _0x114856;};}function handleError(_0x3f0ef5,_0xc988d8){_0xc988d8=_0xc988d8||0x1f4;return function(_0x17d406){logger['error'](_0x17d406[_0x48f3('0x28')]);if(_0x17d406[_0x48f3('0x29')]){delete _0x17d406[_0x48f3('0x29')];}_0x3f0ef5[_0x48f3('0x1d')](_0xc988d8)[_0x48f3('0x2a')](_0x17d406);};}exports[_0x48f3('0x2b')]=function(_0x4df6c6,_0x55c331){var _0x19697d={},_0x306980={},_0x29a819={'count':0x0,'rows':[]};var _0x8b83a0=_[_0x48f3('0x2c')](db[_0x48f3('0x2d')][_0x48f3('0x2e')],function(_0x5865d7){return{'name':_0x5865d7[_0x48f3('0x2f')],'type':_0x5865d7[_0x48f3('0x30')][_0x48f3('0x31')]};});_0x306980['model']=_[_0x48f3('0x2c')](_0x8b83a0,_0x48f3('0x29'));_0x306980['query']=_[_0x48f3('0x32')](_0x4df6c6[_0x48f3('0x33')]);_0x306980[_0x48f3('0x34')]=_['intersection'](_0x306980['model'],_0x306980[_0x48f3('0x33')]);_0x19697d[_0x48f3('0x35')]=_[_0x48f3('0x36')](_0x306980['model'],qs[_0x48f3('0x37')](_0x4df6c6[_0x48f3('0x33')][_0x48f3('0x37')]));_0x19697d[_0x48f3('0x35')]=_0x19697d[_0x48f3('0x35')][_0x48f3('0x38')]?_0x19697d[_0x48f3('0x35')]:_0x306980[_0x48f3('0x39')];if(!_0x4df6c6[_0x48f3('0x33')][_0x48f3('0x3a')](_0x48f3('0x3b'))){_0x19697d[_0x48f3('0x1f')]=qs['limit'](_0x4df6c6[_0x48f3('0x33')]['limit']);_0x19697d[_0x48f3('0x1e')]=qs[_0x48f3('0x1e')](_0x4df6c6[_0x48f3('0x33')][_0x48f3('0x1e')]);}_0x19697d[_0x48f3('0x3c')]=qs['sort'](_0x4df6c6['query'][_0x48f3('0x3d')]);_0x19697d['where']=qs[_0x48f3('0x34')](_[_0x48f3('0x3e')](_0x4df6c6[_0x48f3('0x33')],_0x306980[_0x48f3('0x34')]),_0x8b83a0);if(_0x4df6c6['query']['filter']){_0x19697d[_0x48f3('0x3f')]=_[_0x48f3('0x40')](_0x19697d[_0x48f3('0x3f')],{'$or':_[_0x48f3('0x2c')](_0x8b83a0,function(_0x40c00c){if(_0x40c00c['type']!==_0x48f3('0x41')){var _0x9dd846={};_0x9dd846[_0x40c00c[_0x48f3('0x29')]]={'$like':'%'+_0x4df6c6[_0x48f3('0x33')][_0x48f3('0x42')]+'%'};return _0x9dd846;}})});}_0x19697d=_[_0x48f3('0x40')]({},_0x19697d,_0x4df6c6[_0x48f3('0x43')]);var _0x1839f5={'where':_0x19697d[_0x48f3('0x3f')]};return db[_0x48f3('0x2d')]['count'](_0x1839f5)[_0x48f3('0x26')](function(_0x483431){_0x29a819[_0x48f3('0x21')]=_0x483431;if(_0x4df6c6['query'][_0x48f3('0x44')]){_0x19697d['include']=[{'all':!![]}];}return db[_0x48f3('0x2d')]['findAll'](_0x19697d);})[_0x48f3('0x26')](function(_0x16079f){_0x29a819[_0x48f3('0x45')]=_0x16079f;return _0x29a819;})[_0x48f3('0x26')](respondWithFilteredResult(_0x55c331,_0x19697d))['catch'](handleError(_0x55c331,null));};exports[_0x48f3('0x46')]=function(_0xf75d0f,_0x332ce2){var _0x1f7645={'raw':![],'where':{'id':_0xf75d0f['params']['id']}},_0x11a61f={};_0x11a61f['model']=_[_0x48f3('0x32')](db['VoiceQueueReport']['rawAttributes']);_0x11a61f[_0x48f3('0x33')]=_['keys'](_0xf75d0f[_0x48f3('0x33')]);_0x11a61f['filters']=_[_0x48f3('0x36')](_0x11a61f[_0x48f3('0x39')],_0x11a61f['query']);_0x1f7645['attributes']=_['intersection'](_0x11a61f['model'],qs[_0x48f3('0x37')](_0xf75d0f[_0x48f3('0x33')][_0x48f3('0x37')]));_0x1f7645[_0x48f3('0x35')]=_0x1f7645[_0x48f3('0x35')][_0x48f3('0x38')]?_0x1f7645[_0x48f3('0x35')]:_0x11a61f[_0x48f3('0x39')];if(_0xf75d0f[_0x48f3('0x33')][_0x48f3('0x44')]){_0x1f7645[_0x48f3('0x47')]=[{'all':!![]}];}_0x1f7645=_[_0x48f3('0x40')]({},_0x1f7645,_0xf75d0f['options']);return db[_0x48f3('0x2d')]['find'](_0x1f7645)[_0x48f3('0x26')](handleEntityNotFound(_0x332ce2,null))[_0x48f3('0x26')](respondWithResult(_0x332ce2,null))[_0x48f3('0x48')](handleError(_0x332ce2,null));};exports[_0x48f3('0x49')]=function(_0x57ba29,_0xe0e54a){return db[_0x48f3('0x2d')][_0x48f3('0x49')](_0x57ba29[_0x48f3('0x4a')],{})[_0x48f3('0x26')](respondWithResult(_0xe0e54a,0xc9))[_0x48f3('0x48')](handleError(_0xe0e54a,null));};exports[_0x48f3('0x25')]=function(_0x3b2c73,_0x3bd0e7){if(_0x3b2c73[_0x48f3('0x4a')]['id']){delete _0x3b2c73[_0x48f3('0x4a')]['id'];}return db[_0x48f3('0x2d')][_0x48f3('0x4b')]({'where':{'id':_0x3b2c73[_0x48f3('0x4c')]['id']}})[_0x48f3('0x26')](handleEntityNotFound(_0x3bd0e7,null))[_0x48f3('0x26')](saveUpdates(_0x3b2c73[_0x48f3('0x4a')],null))['then'](respondWithResult(_0x3bd0e7,null))[_0x48f3('0x48')](handleError(_0x3bd0e7,null));};exports[_0x48f3('0x27')]=function(_0x13cbaf,_0x49492b){return db[_0x48f3('0x2d')][_0x48f3('0x4b')]({'where':{'id':_0x13cbaf['params']['id']}})[_0x48f3('0x26')](handleEntityNotFound(_0x49492b,null))[_0x48f3('0x26')](removeEntity(_0x49492b,null))[_0x48f3('0x48')](handleError(_0x49492b,null));};exports['describe']=function(_0x2d3d44,_0x810231){return db[_0x48f3('0x2d')][_0x48f3('0x4d')]()[_0x48f3('0x26')](respondWithResult(_0x810231,null))[_0x48f3('0x48')](handleError(_0x810231,null));};exports[_0x48f3('0x4e')]=function(_0x482ae9,_0x2091f5){var _0x35ceba={},_0x59f93b={},_0x5647f={'count':0x0,'rows':[]};_0x59f93b['model']=_[_0x48f3('0x32')](db[_0x48f3('0x2d')]['rawAttributes']);_0x59f93b[_0x48f3('0x33')]=_[_0x48f3('0x32')](_0x482ae9[_0x48f3('0x33')]);_0x59f93b[_0x48f3('0x34')]=_[_0x48f3('0x36')](_0x59f93b[_0x48f3('0x39')],_0x59f93b[_0x48f3('0x33')]);_0x35ceba[_0x48f3('0x35')]=_[_0x48f3('0x36')](_0x59f93b[_0x48f3('0x39')],qs[_0x48f3('0x37')](_0x482ae9[_0x48f3('0x33')][_0x48f3('0x37')]));_0x35ceba[_0x48f3('0x35')]=_0x35ceba[_0x48f3('0x35')]['length']?_0x35ceba['attributes']:_0x59f93b[_0x48f3('0x39')];if(!_0x482ae9[_0x48f3('0x33')][_0x48f3('0x3a')]('nolimit')){_0x35ceba[_0x48f3('0x1f')]=qs[_0x48f3('0x1f')](_0x482ae9[_0x48f3('0x33')][_0x48f3('0x1f')]);_0x35ceba[_0x48f3('0x1e')]=qs[_0x48f3('0x1e')](_0x482ae9[_0x48f3('0x33')][_0x48f3('0x1e')]);}_0x35ceba[_0x48f3('0x3c')]=qs[_0x48f3('0x3d')](_0x482ae9[_0x48f3('0x33')][_0x48f3('0x3d')]);_0x35ceba['where']=qs[_0x48f3('0x34')](_['pick'](_0x482ae9['query'],_0x59f93b[_0x48f3('0x34')]));if(_0x482ae9['query'][_0x48f3('0x42')]){_0x35ceba[_0x48f3('0x3f')]=_[_0x48f3('0x40')](_0x35ceba[_0x48f3('0x3f')],{'$or':_[_0x48f3('0x2c')](_0x35ceba[_0x48f3('0x35')],function(_0x5e2dad){var _0x3b642c={};_0x3b642c[_0x5e2dad]={'$like':'%'+_0x482ae9[_0x48f3('0x33')]['filter']+'%'};return _0x3b642c;})});}_0x35ceba=_['merge']({},_0x35ceba,_0x482ae9[_0x48f3('0x43')]);var _0x9f47ef={'where':_0x35ceba['where']};return db[_0x48f3('0x2d')][_0x48f3('0x21')](_0x9f47ef)[_0x48f3('0x26')](function(_0x32ef9f){_0x5647f[_0x48f3('0x21')]=_0x32ef9f;if(_0x482ae9['query'][_0x48f3('0x44')]){_0x35ceba[_0x48f3('0x47')]=[{'all':!![]}];}return db[_0x48f3('0x2d')][_0x48f3('0x4f')](_0x35ceba);})[_0x48f3('0x26')](function(_0x38db2f){_0x5647f['rows']=_0x38db2f;return _0x5647f;})[_0x48f3('0x26')](respondWithFilteredResult(_0x2091f5,_0x35ceba,_0x48f3('0x4e')))[_0x48f3('0x48')](handleError(_0x2091f5,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 67f56e0..cbc09d3 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 _0x88d4=['remove','hasOwnProperty','hook','exports','events','setMaxListeners','save','update'];(function(_0x229bda,_0x354683){var _0x347f38=function(_0x592503){while(--_0x592503){_0x229bda['push'](_0x229bda['shift']());}};_0x347f38(++_0x354683);}(_0x88d4,0xdc));var _0x488d=function(_0x2bcbc8,_0x3d1f69){_0x2bcbc8=_0x2bcbc8-0x0;var _0xf97356=_0x88d4[_0x2bcbc8];return _0xf97356;};'use strict';var EventEmitter=require(_0x488d('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x488d('0x1')](0x0);var events={'afterCreate':_0x488d('0x2'),'afterUpdate':_0x488d('0x3'),'afterDestroy':_0x488d('0x4')};function emitEvent(_0x378caa){return function(_0x3b9ddf,_0x2926e1,_0x1a087e){VoiceQueueReportEvents['emit'](_0x378caa+':'+_0x3b9ddf['id'],_0x3b9ddf);VoiceQueueReportEvents['emit'](_0x378caa,_0x3b9ddf);_0x1a087e(null);};}for(var e in events){if(events[_0x488d('0x5')](e)){var event=events[e];VoiceQueueReport[_0x488d('0x6')](e,emitEvent(event));}}module[_0x488d('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x3ee5=['hook','exports','../../mysqldb','VoiceQueueReport','update','emit'];(function(_0x998701,_0x5eeff0){var _0xb92772=function(_0x464a55){while(--_0x464a55){_0x998701['push'](_0x998701['shift']());}};_0xb92772(++_0x5eeff0);}(_0x3ee5,0x1b8));var _0x53ee=function(_0x2560eb,_0x56e299){_0x2560eb=_0x2560eb-0x0;var _0x380988=_0x3ee5[_0x2560eb];return _0x380988;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x53ee('0x0'))['db'][_0x53ee('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x53ee('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3cb5b4){return function(_0x470ca4,_0x370afd,_0xef1bb6){VoiceQueueReportEvents[_0x53ee('0x3')](_0x3cb5b4+':'+_0x470ca4['id'],_0x470ca4);VoiceQueueReportEvents[_0x53ee('0x3')](_0x3cb5b4,_0x470ca4);_0xef1bb6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x53ee('0x4')](e,emitEvent(event));}}module[_0x53ee('0x5')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 03992b3..edafbe6 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 _0xb822=['exports','define','VoiceQueueReport','calleridnum','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0xb822,0xfb));var _0x2b82=function(_0x13b263,_0x53e194){_0x13b263=_0x13b263-0x0;var _0x1d9281=_0xb822[_0x13b263];return _0x1d9281;};'use strict';var _=require(_0x2b82('0x0'));var util=require('util');var logger=require(_0x2b82('0x1'))(_0x2b82('0x2'));var moment=require(_0x2b82('0x3'));var BPromise=require(_0x2b82('0x4'));var rp=require(_0x2b82('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2b82('0x6'));var config=require(_0x2b82('0x7'));var attributes=require(_0x2b82('0x8'));module[_0x2b82('0x9')]=function(_0x1a58b8,_0x2dd162){return _0x1a58b8[_0x2b82('0xa')](_0x2b82('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x2b82('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x474f=['define','VoiceQueueReport','calleridnum','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1501bc,_0x9f91cc){var _0x32f2cf=function(_0x2984d6){while(--_0x2984d6){_0x1501bc['push'](_0x1501bc['shift']());}};_0x32f2cf(++_0x9f91cc);}(_0x474f,0xc6));var _0xf474=function(_0x12bea9,_0x4b62f6){_0x12bea9=_0x12bea9-0x0;var _0xf7195d=_0x474f[_0x12bea9];return _0xf7195d;};'use strict';var _=require(_0xf474('0x0'));var util=require(_0xf474('0x1'));var logger=require(_0xf474('0x2'))('api');var moment=require(_0xf474('0x3'));var BPromise=require(_0xf474('0x4'));var rp=require(_0xf474('0x5'));var fs=require('fs');var path=require(_0xf474('0x6'));var rimraf=require(_0xf474('0x7'));var config=require(_0xf474('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0xf474('0x9')]=function(_0x4d5d7b,_0x408bfb){return _0x4d5d7b[_0xf474('0xa')](_0xf474('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xf474('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 51b2eff..ce00551 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 _0x2f88=['raw','where','attributes','limit','include','map','model','debug','stringify','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueReport','options'];(function(_0x5ee700,_0x42de34){var _0xab0ad=function(_0x220cd6){while(--_0x220cd6){_0x5ee700['push'](_0x5ee700['shift']());}};_0xab0ad(++_0x42de34);}(_0x2f88,0xe5));var _0x82f8=function(_0x39fb38,_0x13ebb4){_0x39fb38=_0x39fb38-0x0;var _0x2cbaea=_0x2f88[_0x39fb38];return _0x2cbaea;};'use strict';var _=require(_0x82f8('0x0'));var util=require('util');var moment=require(_0x82f8('0x1'));var BPromise=require(_0x82f8('0x2'));var rs=require(_0x82f8('0x3'));var fs=require('fs');var Redis=require(_0x82f8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x82f8('0x5'));var logger=require('../../config/logger')(_0x82f8('0x6'));var config=require(_0x82f8('0x7'));var jayson=require(_0x82f8('0x8'));var client=jayson[_0x82f8('0x9')][_0x82f8('0xa')]({'port':0x232a});config[_0x82f8('0xb')]=_[_0x82f8('0xc')](config[_0x82f8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x82f8('0xd'))(new Redis(config[_0x82f8('0xb')]));require(_0x82f8('0xe'))[_0x82f8('0xf')](socket);function respondWithRpcPromise(_0x55b2fc,_0x5034c9,_0x3e3d2d){return new BPromise(function(_0x41e40b,_0x2aab9b){return client[_0x82f8('0x10')](_0x55b2fc,_0x3e3d2d)[_0x82f8('0x11')](function(_0x31d866){logger[_0x82f8('0x12')](_0x82f8('0x13'),_0x5034c9,_0x82f8('0x14'));logger['debug'](_0x82f8('0x15'),_0x5034c9,_0x82f8('0x14'),JSON['stringify'](_0x31d866));if(_0x31d866[_0x82f8('0x16')]){if(_0x31d866[_0x82f8('0x16')][_0x82f8('0x17')]===0x1f4){logger[_0x82f8('0x16')](_0x82f8('0x13'),_0x5034c9,_0x31d866[_0x82f8('0x16')][_0x82f8('0x18')]);return _0x2aab9b(_0x31d866[_0x82f8('0x16')][_0x82f8('0x18')]);}logger[_0x82f8('0x16')](_0x82f8('0x13'),_0x5034c9,_0x31d866[_0x82f8('0x16')][_0x82f8('0x18')]);return _0x41e40b(_0x31d866[_0x82f8('0x16')][_0x82f8('0x18')]);}else{logger[_0x82f8('0x12')](_0x82f8('0x13'),_0x5034c9,_0x82f8('0x14'));_0x41e40b(_0x31d866[_0x82f8('0x19')][_0x82f8('0x18')]);}})[_0x82f8('0x1a')](function(_0xfca36b){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x5034c9,_0xfca36b);_0x2aab9b(_0xfca36b);});});}exports[_0x82f8('0x1b')]=function(_0x296c71){var _0x24dcab=this;return new Promise(function(_0x262f3c,_0x3fa5cf){return db['VoiceQueueReport']['findAll']({'raw':_0x296c71[_0x82f8('0x1c')]?_0x296c71[_0x82f8('0x1c')][_0x82f8('0x1d')]===undefined?!![]:![]:!![],'where':_0x296c71['options']?_0x296c71[_0x82f8('0x1c')][_0x82f8('0x1e')]||null:null,'attributes':_0x296c71[_0x82f8('0x1c')]?_0x296c71[_0x82f8('0x1c')][_0x82f8('0x1f')]||null:null,'limit':_0x296c71[_0x82f8('0x1c')]?_0x296c71[_0x82f8('0x1c')][_0x82f8('0x20')]||null:null,'include':_0x296c71[_0x82f8('0x1c')]?_0x296c71['options'][_0x82f8('0x21')]?_[_0x82f8('0x22')](_0x296c71['options'][_0x82f8('0x21')],function(_0x5c5707){return{'model':db[_0x5c5707[_0x82f8('0x23')]],'as':_0x5c5707['as'],'attributes':_0x5c5707[_0x82f8('0x1f')],'include':_0x5c5707['include']?_[_0x82f8('0x22')](_0x5c5707[_0x82f8('0x21')],function(_0x443520){return{'model':db[_0x443520[_0x82f8('0x23')]],'as':_0x443520['as'],'attributes':_0x443520[_0x82f8('0x1f')],'include':_0x443520[_0x82f8('0x21')]?_['map'](_0x443520[_0x82f8('0x21')],function(_0x57c9ea){return{'model':db[_0x57c9ea[_0x82f8('0x23')]],'as':_0x57c9ea['as'],'attributes':_0x57c9ea['attributes']};}):[]};}):[]};}):[]:[]})[_0x82f8('0x11')](function(_0x4a3946){logger['info'](_0x82f8('0x1b'),_0x296c71);logger[_0x82f8('0x24')]('GetVoiceQueueReport',_0x296c71,JSON[_0x82f8('0x25')](_0x4a3946));_0x262f3c(_0x4a3946);})[_0x82f8('0x1a')](function(_0x1b2a20){logger['error'](_0x82f8('0x1b'),_0x1b2a20[_0x82f8('0x18')],_0x296c71);_0x3fa5cf(_0x24dcab[_0x82f8('0x16')](0x1f4,_0x1b2a20[_0x82f8('0x18')]));});});};exports[_0x82f8('0x26')]=function(_0x180fc1){var _0x4bab97=this;return new Promise(function(_0x2a5c02,_0x20fae8){return db['VoiceQueueReport'][_0x82f8('0x27')](_0x180fc1[_0x82f8('0x28')],{'raw':_0x180fc1[_0x82f8('0x1c')]?_0x180fc1['options'][_0x82f8('0x1d')]===undefined?!![]:![]:!![]})[_0x82f8('0x11')](function(_0x4b2022){logger[_0x82f8('0x12')](_0x82f8('0x26'),_0x180fc1);logger[_0x82f8('0x24')](_0x82f8('0x26'),_0x180fc1,JSON[_0x82f8('0x25')](_0x4b2022));_0x2a5c02(_0x4b2022);})['catch'](function(_0x4a9f3e){logger['error'](_0x82f8('0x26'),_0x4a9f3e['message'],_0x180fc1);_0x20fae8(_0x4bab97[_0x82f8('0x16')](0x1f4,_0x4a9f3e[_0x82f8('0x18')]));});});};exports[_0x82f8('0x29')]=function(_0x25c714){var _0x2d289f=this;return new Promise(function(_0x2eb775,_0x2f815b){return db['VoiceQueueReport'][_0x82f8('0x2a')](_0x25c714[_0x82f8('0x28')],{'raw':_0x25c714[_0x82f8('0x1c')]?_0x25c714[_0x82f8('0x1c')][_0x82f8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25c714['options']?_0x25c714[_0x82f8('0x1c')][_0x82f8('0x1e')]||null:null,'attributes':_0x25c714['options']?_0x25c714[_0x82f8('0x1c')][_0x82f8('0x1f')]||null:null,'limit':_0x25c714[_0x82f8('0x1c')]?_0x25c714[_0x82f8('0x1c')][_0x82f8('0x20')]||null:null})['then'](function(_0x2ff2fa){logger[_0x82f8('0x12')]('UpdateVoiceQueueReport',_0x25c714);logger[_0x82f8('0x24')](_0x82f8('0x29'),_0x25c714,JSON['stringify'](_0x2ff2fa));_0x2eb775(_0x2ff2fa);})[_0x82f8('0x1a')](function(_0x4b2f86){logger[_0x82f8('0x16')]('UpdateVoiceQueueReport',_0x4b2f86['message'],_0x25c714);_0x2f815b(_0x2d289f[_0x82f8('0x16')](0x1f4,_0x4b2f86[_0x82f8('0x18')]));});});}; \ No newline at end of file +var _0x8aa6=['where','attributes','limit','include','map','model','then','CreateVoiceQueueReport','body','raw','UpdateVoiceQueueReport','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','options'];(function(_0x24d1c1,_0x365bf3){var _0x908781=function(_0x40eb3f){while(--_0x40eb3f){_0x24d1c1['push'](_0x24d1c1['shift']());}};_0x908781(++_0x365bf3);}(_0x8aa6,0xc9));var _0x68aa=function(_0x22a9db,_0x4506c5){_0x22a9db=_0x22a9db-0x0;var _0x35715a=_0x8aa6[_0x22a9db];return _0x35715a;};'use strict';var _=require(_0x68aa('0x0'));var util=require(_0x68aa('0x1'));var moment=require('moment');var BPromise=require(_0x68aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x68aa('0x3'));var db=require(_0x68aa('0x4'))['db'];var utils=require(_0x68aa('0x5'));var logger=require(_0x68aa('0x6'))(_0x68aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x68aa('0x8')]['http']({'port':0x232a});config[_0x68aa('0x9')]=_[_0x68aa('0xa')](config[_0x68aa('0x9')],{'host':_0x68aa('0xb'),'port':0x18eb});var socket=require(_0x68aa('0xc'))(new Redis(config[_0x68aa('0x9')]));require(_0x68aa('0xd'))['register'](socket);function respondWithRpcPromise(_0x404969,_0x515a8b,_0x2ac82a){return new BPromise(function(_0x407b66,_0x503f91){return client[_0x68aa('0xe')](_0x404969,_0x2ac82a)['then'](function(_0x4435bc){logger[_0x68aa('0xf')](_0x68aa('0x10'),_0x515a8b,'request\x20sent');logger[_0x68aa('0x11')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x515a8b,_0x68aa('0x12'),JSON[_0x68aa('0x13')](_0x4435bc));if(_0x4435bc[_0x68aa('0x14')]){if(_0x4435bc[_0x68aa('0x14')][_0x68aa('0x15')]===0x1f4){logger[_0x68aa('0x14')](_0x68aa('0x10'),_0x515a8b,_0x4435bc['error']['message']);return _0x503f91(_0x4435bc[_0x68aa('0x14')][_0x68aa('0x16')]);}logger[_0x68aa('0x14')](_0x68aa('0x10'),_0x515a8b,_0x4435bc[_0x68aa('0x14')]['message']);return _0x407b66(_0x4435bc[_0x68aa('0x14')][_0x68aa('0x16')]);}else{logger['info'](_0x68aa('0x10'),_0x515a8b,'request\x20sent');_0x407b66(_0x4435bc['result'][_0x68aa('0x16')]);}})[_0x68aa('0x17')](function(_0x2eb01c){logger[_0x68aa('0x14')](_0x68aa('0x10'),_0x515a8b,_0x2eb01c);_0x503f91(_0x2eb01c);});});}exports[_0x68aa('0x18')]=function(_0x1df6a4){var _0x39796f=this;return new Promise(function(_0x1e45fd,_0x190144){return db[_0x68aa('0x19')]['findAll']({'raw':_0x1df6a4['options']?_0x1df6a4[_0x68aa('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1df6a4[_0x68aa('0x1a')]?_0x1df6a4[_0x68aa('0x1a')][_0x68aa('0x1b')]||null:null,'attributes':_0x1df6a4[_0x68aa('0x1a')]?_0x1df6a4[_0x68aa('0x1a')][_0x68aa('0x1c')]||null:null,'limit':_0x1df6a4[_0x68aa('0x1a')]?_0x1df6a4[_0x68aa('0x1a')][_0x68aa('0x1d')]||null:null,'include':_0x1df6a4[_0x68aa('0x1a')]?_0x1df6a4['options'][_0x68aa('0x1e')]?_[_0x68aa('0x1f')](_0x1df6a4['options'][_0x68aa('0x1e')],function(_0x599e8d){return{'model':db[_0x599e8d[_0x68aa('0x20')]],'as':_0x599e8d['as'],'attributes':_0x599e8d['attributes'],'include':_0x599e8d['include']?_[_0x68aa('0x1f')](_0x599e8d[_0x68aa('0x1e')],function(_0x11eca3){return{'model':db[_0x11eca3[_0x68aa('0x20')]],'as':_0x11eca3['as'],'attributes':_0x11eca3[_0x68aa('0x1c')],'include':_0x11eca3[_0x68aa('0x1e')]?_[_0x68aa('0x1f')](_0x11eca3[_0x68aa('0x1e')],function(_0x3b93de){return{'model':db[_0x3b93de[_0x68aa('0x20')]],'as':_0x3b93de['as'],'attributes':_0x3b93de[_0x68aa('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x68aa('0x21')](function(_0x200d80){logger['info']('GetVoiceQueueReport',_0x1df6a4);logger['debug'](_0x68aa('0x18'),_0x1df6a4,JSON[_0x68aa('0x13')](_0x200d80));_0x1e45fd(_0x200d80);})[_0x68aa('0x17')](function(_0x4b622e){logger[_0x68aa('0x14')]('GetVoiceQueueReport',_0x4b622e[_0x68aa('0x16')],_0x1df6a4);_0x190144(_0x39796f[_0x68aa('0x14')](0x1f4,_0x4b622e[_0x68aa('0x16')]));});});};exports[_0x68aa('0x22')]=function(_0x30e2c2){var _0x210a25=this;return new Promise(function(_0x4fdf60,_0x14df62){return db[_0x68aa('0x19')]['create'](_0x30e2c2[_0x68aa('0x23')],{'raw':_0x30e2c2[_0x68aa('0x1a')]?_0x30e2c2['options'][_0x68aa('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x448f3b){logger[_0x68aa('0xf')]('CreateVoiceQueueReport',_0x30e2c2);logger[_0x68aa('0x11')](_0x68aa('0x22'),_0x30e2c2,JSON['stringify'](_0x448f3b));_0x4fdf60(_0x448f3b);})['catch'](function(_0x5802b1){logger[_0x68aa('0x14')](_0x68aa('0x22'),_0x5802b1[_0x68aa('0x16')],_0x30e2c2);_0x14df62(_0x210a25['error'](0x1f4,_0x5802b1[_0x68aa('0x16')]));});});};exports['UpdateVoiceQueueReport']=function(_0x23aed3){var _0x39d19d=this;return new Promise(function(_0x5dc66b,_0x206c36){return db[_0x68aa('0x19')]['update'](_0x23aed3[_0x68aa('0x23')],{'raw':_0x23aed3[_0x68aa('0x1a')]?_0x23aed3[_0x68aa('0x1a')][_0x68aa('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23aed3[_0x68aa('0x1a')]?_0x23aed3[_0x68aa('0x1a')][_0x68aa('0x1b')]||null:null,'attributes':_0x23aed3[_0x68aa('0x1a')]?_0x23aed3[_0x68aa('0x1a')][_0x68aa('0x1c')]||null:null,'limit':_0x23aed3[_0x68aa('0x1a')]?_0x23aed3[_0x68aa('0x1a')]['limit']||null:null})[_0x68aa('0x21')](function(_0x383e44){logger['info'](_0x68aa('0x25'),_0x23aed3);logger[_0x68aa('0x11')]('UpdateVoiceQueueReport',_0x23aed3,JSON['stringify'](_0x383e44));_0x5dc66b(_0x383e44);})['catch'](function(_0x4d7e33){logger['error'](_0x68aa('0x25'),_0x4d7e33[_0x68aa('0x16')],_0x23aed3);_0x206c36(_0x39d19d[_0x68aa('0x14')](0x1f4,_0x4d7e33[_0x68aa('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 8771cb1..7a4b982 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 _0xb38e=['save','remove','update','register','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xb38e,0xa7));var _0xeb38=function(_0x351ddc,_0x190771){_0x351ddc=_0x351ddc-0x0;var _0x1e9323=_0xb38e[_0x351ddc];return _0x1e9323;};'use strict';var VoiceQueueReportEvents=require(_0xeb38('0x0'));var events=[_0xeb38('0x1'),_0xeb38('0x2'),_0xeb38('0x3')];function createListener(_0x2c099d,_0x2dbc7c){return function(_0x3b888c){_0x2dbc7c['emit'](_0x2c099d,_0x3b888c);};}function removeListener(_0x33e6e9,_0x1f150e){return function(){VoiceQueueReportEvents['removeListener'](_0x33e6e9,_0x1f150e);};}exports[_0xeb38('0x4')]=function(_0xd3e5dc){for(var _0x28e501=0x0,_0x31db8c=events['length'];_0x28e501<_0x31db8c;_0x28e501++){var _0x3003aa=events[_0x28e501];var _0x196580=createListener(_0xeb38('0x5')+_0x3003aa,_0xd3e5dc);VoiceQueueReportEvents['on'](_0x3003aa,_0x196580);}}; \ No newline at end of file +var _0xbe83=['update','emit','removeListener','voiceQueueReport:','./voiceQueueReport.events','remove'];(function(_0xa0404d,_0x559a59){var _0x2d2f1d=function(_0x2177b8){while(--_0x2177b8){_0xa0404d['push'](_0xa0404d['shift']());}};_0x2d2f1d(++_0x559a59);}(_0xbe83,0xee));var _0x3be8=function(_0x4e8421,_0x1174f7){_0x4e8421=_0x4e8421-0x0;var _0x24c459=_0xbe83[_0x4e8421];return _0x24c459;};'use strict';var VoiceQueueReportEvents=require(_0x3be8('0x0'));var events=['save',_0x3be8('0x1'),_0x3be8('0x2')];function createListener(_0x46982c,_0x2d919d){return function(_0x4a3a25){_0x2d919d[_0x3be8('0x3')](_0x46982c,_0x4a3a25);};}function removeListener(_0x3951f5,_0x782e74){return function(){VoiceQueueReportEvents[_0x3be8('0x4')](_0x3951f5,_0x782e74);};}exports['register']=function(_0x2def96){for(var _0x31183c=0x0,_0x3dbe5c=events['length'];_0x31183c<_0x3dbe5c;_0x31183c++){var _0xa7c59e=events[_0x31183c];var _0x33187c=createListener(_0x3be8('0x5')+_0xa7c59e,_0x2def96);VoiceQueueReportEvents['on'](_0xa7c59e,_0x33187c);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index f11a49e..1530af3 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 _0x4c63=['get','isAuthenticated','index','/:id','show','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x265094,_0x28f551){var _0x13bfd1=function(_0x314d1f){while(--_0x314d1f){_0x265094['push'](_0x265094['shift']());}};_0x13bfd1(++_0x28f551);}(_0x4c63,0xf2));var _0x34c6=function(_0x589464,_0x1b3987){_0x589464=_0x589464-0x0;var _0x3c711e=_0x4c63[_0x589464];return _0x3c711e;};'use strict';var multer=require(_0x34c6('0x0'));var util=require('util');var path=require(_0x34c6('0x1'));var timeout=require(_0x34c6('0x2'));var express=require(_0x34c6('0x3'));var router=express[_0x34c6('0x4')]();var fs_extra=require(_0x34c6('0x5'));var auth=require(_0x34c6('0x6'));var interaction=require(_0x34c6('0x7'));var config=require(_0x34c6('0x8'));var controller=require(_0x34c6('0x9'));router[_0x34c6('0xa')]('/',auth[_0x34c6('0xb')](),controller[_0x34c6('0xc')]);router[_0x34c6('0xa')](_0x34c6('0xd'),auth['isAuthenticated'](),controller[_0x34c6('0xe')]);router['post']('/',auth[_0x34c6('0xb')](),controller['create']);router[_0x34c6('0xf')]('/:id',auth[_0x34c6('0xb')](),controller[_0x34c6('0x10')]);router[_0x34c6('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd45b=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','destroy','exports','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd45b,0x11f));var _0xbd45=function(_0x5597f9,_0x2619d6){_0x5597f9=_0x5597f9-0x0;var _0x42ec0e=_0xd45b[_0x5597f9];return _0x42ec0e;};'use strict';var multer=require(_0xbd45('0x0'));var util=require(_0xbd45('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbd45('0x2'));var router=express[_0xbd45('0x3')]();var fs_extra=require(_0xbd45('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbd45('0x5'));var config=require(_0xbd45('0x6'));var controller=require(_0xbd45('0x7'));router[_0xbd45('0x8')]('/',auth[_0xbd45('0x9')](),controller[_0xbd45('0xa')]);router[_0xbd45('0x8')](_0xbd45('0xb'),auth['isAuthenticated'](),controller[_0xbd45('0xc')]);router[_0xbd45('0xd')]('/',auth[_0xbd45('0x9')](),controller[_0xbd45('0xe')]);router['put'](_0xbd45('0xb'),auth[_0xbd45('0x9')](),controller['update']);router['delete'](_0xbd45('0xb'),auth[_0xbd45('0x9')](),controller[_0xbd45('0xf')]);module[_0xbd45('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index b204691..90a32af 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 _0x3d56=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING','DATE','literal'];(function(_0x211ff4,_0x1f84c7){var _0x5df2b8=function(_0x55580a){while(--_0x55580a){_0x211ff4['push'](_0x211ff4['shift']());}};_0x5df2b8(++_0x1f84c7);}(_0x3d56,0x78));var _0x63d5=function(_0x50bf63,_0x556f08){_0x50bf63=_0x50bf63-0x0;var _0x45bf03=_0x3d56[_0x50bf63];return _0x45bf03;};'use strict';var Sequelize=require(_0x63d5('0x0'));var moment=require(_0x63d5('0x1'));module[_0x63d5('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x63d5('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x63d5('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x63d5('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x63d5('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x63d5('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x63d5('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x63d5('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x63d5('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x63d5('0x5')](_0x63d5('0x6'))}}; \ No newline at end of file +var _0x604f=['exports','STRING','sequelize'];(function(_0x32801a,_0x455c9f){var _0x2fe9e9=function(_0x280af7){while(--_0x280af7){_0x32801a['push'](_0x32801a['shift']());}};_0x2fe9e9(++_0x455c9f);}(_0x604f,0x149));var _0xf604=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x604f[_0x5cb1af];return _0x8d7940;};'use strict';var Sequelize=require(_0xf604('0x0'));var moment=require('moment');module[_0xf604('0x1')]={'time':{'type':Sequelize[_0xf604('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xf604('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xf604('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xf604('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xf604('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xf604('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xf604('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xf604('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['literal']('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 e58b631..a79c12d 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 _0xefd2=['sort','where','filters','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','VoiceQueuesLog','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x1abd54,_0x17c3a7){var _0x592315=function(_0xfb160){while(--_0xfb160){_0x1abd54['push'](_0x1abd54['shift']());}};_0x592315(++_0x17c3a7);}(_0xefd2,0xef));var _0x2efd=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xefd2[_0x4c445a];return _0x2f611c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2efd('0x0'));var zipdir=require(_0x2efd('0x1'));var jsonpatch=require(_0x2efd('0x2'));var rp=require(_0x2efd('0x3'));var moment=require(_0x2efd('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2efd('0x5'));var path=require('path');var sox=require(_0x2efd('0x6'));var csv=require('to-csv');var ejs=require(_0x2efd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2efd('0x8'));var crypto=require(_0x2efd('0x9'));var jsforce=require(_0x2efd('0xa'));var deskjs=require(_0x2efd('0xb'));var toCsv=require(_0x2efd('0xc'));var querystring=require(_0x2efd('0xd'));var Papa=require(_0x2efd('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2efd('0xf'));var as=require(_0x2efd('0x10'));var hardwareService=require(_0x2efd('0x11'));var logger=require(_0x2efd('0x12'))(_0x2efd('0x13'));var utils=require(_0x2efd('0x14'));var config=require(_0x2efd('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c7ebf,_0x5db220){_0x5db220=_0x5db220||0xcc;return function(_0x22477){if(_0x22477){return _0x3c7ebf[_0x2efd('0x16')](_0x5db220);}return _0x3c7ebf['status'](_0x5db220)['end']();};}function respondWithResult(_0x266783,_0x26b646){_0x26b646=_0x26b646||0xc8;return function(_0xe7ecae){if(_0xe7ecae){return _0x266783[_0x2efd('0x17')](_0x26b646)[_0x2efd('0x18')](_0xe7ecae);}};}function respondWithFilteredResult(_0x558d23,_0x6057c3){return function(_0x8691e3){if(_0x8691e3){var _0xe22c35=typeof _0x6057c3[_0x2efd('0x19')]===_0x2efd('0x1a')&&typeof _0x6057c3[_0x2efd('0x1b')]===_0x2efd('0x1a');var _0x116c0a=_0x8691e3[_0x2efd('0x1c')];var _0x21d79a=_0xe22c35?0x0:_0x6057c3[_0x2efd('0x19')];var _0x3f5aa5=_0xe22c35?_0x8691e3[_0x2efd('0x1c')]:_0x6057c3['offset']+_0x6057c3[_0x2efd('0x1b')];var _0x16c0da;if(_0x3f5aa5>=_0x116c0a){_0x3f5aa5=_0x116c0a;_0x16c0da=0xc8;}else{_0x16c0da=0xce;}_0x558d23[_0x2efd('0x17')](_0x16c0da);return _0x558d23[_0x2efd('0x1d')](_0x2efd('0x1e'),_0x21d79a+'-'+_0x3f5aa5+'/'+_0x116c0a)[_0x2efd('0x18')](_0x8691e3);}return null;};}function patchUpdates(_0x9a7d77){return function(_0x5a63c2){try{jsonpatch[_0x2efd('0x1f')](_0x5a63c2,_0x9a7d77,!![]);}catch(_0xede5bd){return BPromise[_0x2efd('0x20')](_0xede5bd);}return _0x5a63c2['save']();};}function saveUpdates(_0x382cc5,_0xc1b19c){return function(_0x3f4bab){if(_0x3f4bab){return _0x3f4bab[_0x2efd('0x21')](_0x382cc5)[_0x2efd('0x22')](function(_0x35e8ed){return _0x35e8ed;});}return null;};}function removeEntity(_0x2a0649,_0x23db68){return function(_0x23e9b5){if(_0x23e9b5){return _0x23e9b5[_0x2efd('0x23')]()[_0x2efd('0x22')](function(){_0x2a0649[_0x2efd('0x17')](0xcc)[_0x2efd('0x24')]();});}};}function handleEntityNotFound(_0x19cbdf,_0x3ff238){return function(_0x5c4553){if(!_0x5c4553){_0x19cbdf[_0x2efd('0x16')](0x194);}return _0x5c4553;};}function handleError(_0x506fc1,_0x496d81){_0x496d81=_0x496d81||0x1f4;return function(_0x1ed605){logger[_0x2efd('0x25')](_0x1ed605[_0x2efd('0x26')]);if(_0x1ed605[_0x2efd('0x27')]){delete _0x1ed605[_0x2efd('0x27')];}_0x506fc1[_0x2efd('0x17')](_0x496d81)[_0x2efd('0x28')](_0x1ed605);};}exports[_0x2efd('0x29')]=function(_0x3a85eb,_0x3f4436){var _0x4d5e96={},_0x49b771={},_0x2cb2f2={'count':0x0,'rows':[]};var _0x36cb24=_['map'](db[_0x2efd('0x2a')]['rawAttributes'],function(_0x1f305d){return{'name':_0x1f305d[_0x2efd('0x2b')],'type':_0x1f305d[_0x2efd('0x2c')][_0x2efd('0x2d')]};});_0x49b771[_0x2efd('0x2e')]=_[_0x2efd('0x2f')](_0x36cb24,_0x2efd('0x27'));_0x49b771[_0x2efd('0x30')]=_[_0x2efd('0x31')](_0x3a85eb[_0x2efd('0x30')]);_0x49b771['filters']=_['intersection'](_0x49b771[_0x2efd('0x2e')],_0x49b771[_0x2efd('0x30')]);_0x4d5e96['attributes']=_[_0x2efd('0x32')](_0x49b771[_0x2efd('0x2e')],qs[_0x2efd('0x33')](_0x3a85eb[_0x2efd('0x30')][_0x2efd('0x33')]));_0x4d5e96[_0x2efd('0x34')]=_0x4d5e96['attributes'][_0x2efd('0x35')]?_0x4d5e96['attributes']:_0x49b771['model'];if(!_0x3a85eb[_0x2efd('0x30')][_0x2efd('0x36')](_0x2efd('0x37'))){_0x4d5e96['limit']=qs[_0x2efd('0x1b')](_0x3a85eb['query'][_0x2efd('0x1b')]);_0x4d5e96['offset']=qs['offset'](_0x3a85eb[_0x2efd('0x30')][_0x2efd('0x19')]);}_0x4d5e96[_0x2efd('0x38')]=qs[_0x2efd('0x39')](_0x3a85eb[_0x2efd('0x30')][_0x2efd('0x39')]);_0x4d5e96[_0x2efd('0x3a')]=qs[_0x2efd('0x3b')](_[_0x2efd('0x3c')](_0x3a85eb[_0x2efd('0x30')],_0x49b771[_0x2efd('0x3b')]),_0x36cb24);if(_0x3a85eb[_0x2efd('0x30')]['filter']){_0x4d5e96[_0x2efd('0x3a')]=_[_0x2efd('0x3d')](_0x4d5e96[_0x2efd('0x3a')],{'$or':_[_0x2efd('0x2f')](_0x36cb24,function(_0xea2674){if(_0xea2674[_0x2efd('0x2c')]!==_0x2efd('0x3e')){var _0x56cdcb={};_0x56cdcb[_0xea2674['name']]={'$like':'%'+_0x3a85eb['query'][_0x2efd('0x3f')]+'%'};return _0x56cdcb;}})});}_0x4d5e96=_['merge']({},_0x4d5e96,_0x3a85eb[_0x2efd('0x40')]);var _0x50d734={'where':_0x4d5e96['where']};return db[_0x2efd('0x2a')][_0x2efd('0x1c')](_0x50d734)['then'](function(_0xaba2e1){_0x2cb2f2[_0x2efd('0x1c')]=_0xaba2e1;if(_0x3a85eb[_0x2efd('0x30')]['includeAll']){_0x4d5e96['include']=[{'all':!![]}];}return db[_0x2efd('0x2a')][_0x2efd('0x41')](_0x4d5e96);})[_0x2efd('0x22')](function(_0x49bc6a){_0x2cb2f2[_0x2efd('0x42')]=_0x49bc6a;return _0x2cb2f2;})[_0x2efd('0x22')](respondWithFilteredResult(_0x3f4436,_0x4d5e96))[_0x2efd('0x43')](handleError(_0x3f4436,null));};exports['show']=function(_0x13b1aa,_0xb1e0f){var _0x3d1780={'raw':!![],'where':{'id':_0x13b1aa[_0x2efd('0x44')]['id']}},_0x47ca90={};_0x47ca90['model']=_['keys'](db[_0x2efd('0x2a')][_0x2efd('0x45')]);_0x47ca90[_0x2efd('0x30')]=_[_0x2efd('0x31')](_0x13b1aa[_0x2efd('0x30')]);_0x47ca90['filters']=_[_0x2efd('0x32')](_0x47ca90['model'],_0x47ca90[_0x2efd('0x30')]);_0x3d1780[_0x2efd('0x34')]=_[_0x2efd('0x32')](_0x47ca90[_0x2efd('0x2e')],qs[_0x2efd('0x33')](_0x13b1aa['query']['fields']));_0x3d1780[_0x2efd('0x34')]=_0x3d1780[_0x2efd('0x34')][_0x2efd('0x35')]?_0x3d1780[_0x2efd('0x34')]:_0x47ca90['model'];if(_0x13b1aa[_0x2efd('0x30')][_0x2efd('0x46')]){_0x3d1780['include']=[{'all':!![]}];}_0x3d1780=_[_0x2efd('0x3d')]({},_0x3d1780,_0x13b1aa['options']);return db['VoiceQueuesLog'][_0x2efd('0x47')](_0x3d1780)[_0x2efd('0x22')](handleEntityNotFound(_0xb1e0f,null))[_0x2efd('0x22')](respondWithResult(_0xb1e0f,null))[_0x2efd('0x43')](handleError(_0xb1e0f,null));};exports['create']=function(_0x4446ff,_0x4a4895){return db[_0x2efd('0x2a')][_0x2efd('0x48')](_0x4446ff[_0x2efd('0x49')],{})[_0x2efd('0x22')](respondWithResult(_0x4a4895,0xc9))[_0x2efd('0x43')](handleError(_0x4a4895,null));};exports['update']=function(_0x59815c,_0x326a19){if(_0x59815c[_0x2efd('0x49')]['id']){delete _0x59815c[_0x2efd('0x49')]['id'];}return db[_0x2efd('0x2a')]['find']({'where':{'id':_0x59815c[_0x2efd('0x44')]['id']}})['then'](handleEntityNotFound(_0x326a19,null))[_0x2efd('0x22')](saveUpdates(_0x59815c['body'],null))[_0x2efd('0x22')](respondWithResult(_0x326a19,null))[_0x2efd('0x43')](handleError(_0x326a19,null));};exports[_0x2efd('0x23')]=function(_0x498945,_0x1a1b47){return db[_0x2efd('0x2a')][_0x2efd('0x47')]({'where':{'id':_0x498945['params']['id']}})[_0x2efd('0x22')](handleEntityNotFound(_0x1a1b47,null))[_0x2efd('0x22')](removeEntity(_0x1a1b47,null))[_0x2efd('0x43')](handleError(_0x1a1b47,null));}; \ No newline at end of file +var _0x69a3=['model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','type','key'];(function(_0x5d887f,_0x314fdf){var _0x9645d5=function(_0x4446c3){while(--_0x4446c3){_0x5d887f['push'](_0x5d887f['shift']());}};_0x9645d5(++_0x314fdf);}(_0x69a3,0x1b1));var _0x369a=function(_0x125cf6,_0x306062){_0x125cf6=_0x125cf6-0x0;var _0x2c0b7a=_0x69a3[_0x125cf6];return _0x2c0b7a;};'use strict';var emlformat=require(_0x369a('0x0'));var rimraf=require(_0x369a('0x1'));var zipdir=require(_0x369a('0x2'));var jsonpatch=require(_0x369a('0x3'));var rp=require('request-promise');var moment=require(_0x369a('0x4'));var BPromise=require(_0x369a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x369a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x369a('0x7'));var _=require('lodash');var squel=require(_0x369a('0x8'));var crypto=require(_0x369a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x369a('0xa'));var toCsv=require(_0x369a('0x6'));var querystring=require(_0x369a('0xb'));var Papa=require(_0x369a('0xc'));var Redis=require('ioredis');var authService=require(_0x369a('0xd'));var qs=require(_0x369a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x369a('0xf'));var licenseUtil=require(_0x369a('0x10'));var db=require(_0x369a('0x11'))['db'];function respondWithStatusCode(_0x5db760,_0x2afa13){_0x2afa13=_0x2afa13||0xcc;return function(_0x353289){if(_0x353289){return _0x5db760['sendStatus'](_0x2afa13);}return _0x5db760[_0x369a('0x12')](_0x2afa13)['end']();};}function respondWithResult(_0x3678b0,_0x25aadb){_0x25aadb=_0x25aadb||0xc8;return function(_0x356c07){if(_0x356c07){return _0x3678b0['status'](_0x25aadb)[_0x369a('0x13')](_0x356c07);}};}function respondWithFilteredResult(_0x5253c5,_0x11c7a9){return function(_0x3f801c){if(_0x3f801c){var _0x64a569=typeof _0x11c7a9[_0x369a('0x14')]===_0x369a('0x15')&&typeof _0x11c7a9['limit']===_0x369a('0x15');var _0x422f2d=_0x3f801c[_0x369a('0x16')];var _0x397332=_0x64a569?0x0:_0x11c7a9[_0x369a('0x14')];var _0x113412=_0x64a569?_0x3f801c[_0x369a('0x16')]:_0x11c7a9[_0x369a('0x14')]+_0x11c7a9[_0x369a('0x17')];var _0x5b1351;if(_0x113412>=_0x422f2d){_0x113412=_0x422f2d;_0x5b1351=0xc8;}else{_0x5b1351=0xce;}_0x5253c5[_0x369a('0x12')](_0x5b1351);return _0x5253c5[_0x369a('0x18')](_0x369a('0x19'),_0x397332+'-'+_0x113412+'/'+_0x422f2d)[_0x369a('0x13')](_0x3f801c);}return null;};}function patchUpdates(_0x2bd0cd){return function(_0x58e608){try{jsonpatch[_0x369a('0x1a')](_0x58e608,_0x2bd0cd,!![]);}catch(_0x37383c){return BPromise[_0x369a('0x1b')](_0x37383c);}return _0x58e608[_0x369a('0x1c')]();};}function saveUpdates(_0x1117ba,_0x10f99a){return function(_0x5da766){if(_0x5da766){return _0x5da766[_0x369a('0x1d')](_0x1117ba)['then'](function(_0x1ebd94){return _0x1ebd94;});}return null;};}function removeEntity(_0x3201e3,_0x201814){return function(_0xe406a2){if(_0xe406a2){return _0xe406a2[_0x369a('0x1e')]()[_0x369a('0x1f')](function(){_0x3201e3['status'](0xcc)[_0x369a('0x20')]();});}};}function handleEntityNotFound(_0x203e44,_0x1e675f){return function(_0x39ac18){if(!_0x39ac18){_0x203e44[_0x369a('0x21')](0x194);}return _0x39ac18;};}function handleError(_0x12e6fe,_0x213914){_0x213914=_0x213914||0x1f4;return function(_0x296d30){logger['error'](_0x296d30[_0x369a('0x22')]);if(_0x296d30['name']){delete _0x296d30[_0x369a('0x23')];}_0x12e6fe[_0x369a('0x12')](_0x213914)[_0x369a('0x24')](_0x296d30);};}exports[_0x369a('0x25')]=function(_0x524dd5,_0x42eb21){var _0x4efd07={},_0x23a5f8={},_0x363c5e={'count':0x0,'rows':[]};var _0x52484b=_[_0x369a('0x26')](db[_0x369a('0x27')][_0x369a('0x28')],function(_0x447a5a){return{'name':_0x447a5a['fieldName'],'type':_0x447a5a[_0x369a('0x29')][_0x369a('0x2a')]};});_0x23a5f8[_0x369a('0x2b')]=_['map'](_0x52484b,_0x369a('0x23'));_0x23a5f8[_0x369a('0x2c')]=_[_0x369a('0x2d')](_0x524dd5[_0x369a('0x2c')]);_0x23a5f8[_0x369a('0x2e')]=_[_0x369a('0x2f')](_0x23a5f8['model'],_0x23a5f8[_0x369a('0x2c')]);_0x4efd07['attributes']=_[_0x369a('0x2f')](_0x23a5f8[_0x369a('0x2b')],qs[_0x369a('0x30')](_0x524dd5['query'][_0x369a('0x30')]));_0x4efd07['attributes']=_0x4efd07['attributes'][_0x369a('0x31')]?_0x4efd07[_0x369a('0x32')]:_0x23a5f8[_0x369a('0x2b')];if(!_0x524dd5['query'][_0x369a('0x33')](_0x369a('0x34'))){_0x4efd07[_0x369a('0x17')]=qs[_0x369a('0x17')](_0x524dd5[_0x369a('0x2c')][_0x369a('0x17')]);_0x4efd07[_0x369a('0x14')]=qs[_0x369a('0x14')](_0x524dd5[_0x369a('0x2c')][_0x369a('0x14')]);}_0x4efd07[_0x369a('0x35')]=qs[_0x369a('0x36')](_0x524dd5['query']['sort']);_0x4efd07[_0x369a('0x37')]=qs['filters'](_['pick'](_0x524dd5['query'],_0x23a5f8[_0x369a('0x2e')]),_0x52484b);if(_0x524dd5[_0x369a('0x2c')][_0x369a('0x38')]){_0x4efd07['where']=_[_0x369a('0x39')](_0x4efd07[_0x369a('0x37')],{'$or':_[_0x369a('0x26')](_0x52484b,function(_0x390ba3){if(_0x390ba3[_0x369a('0x29')]!=='VIRTUAL'){var _0x44bbb1={};_0x44bbb1[_0x390ba3[_0x369a('0x23')]]={'$like':'%'+_0x524dd5[_0x369a('0x2c')]['filter']+'%'};return _0x44bbb1;}})});}_0x4efd07=_[_0x369a('0x39')]({},_0x4efd07,_0x524dd5[_0x369a('0x3a')]);var _0x5aa296={'where':_0x4efd07['where']};return db[_0x369a('0x27')][_0x369a('0x16')](_0x5aa296)['then'](function(_0x143c6f){_0x363c5e[_0x369a('0x16')]=_0x143c6f;if(_0x524dd5[_0x369a('0x2c')][_0x369a('0x3b')]){_0x4efd07['include']=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x369a('0x3c')](_0x4efd07);})[_0x369a('0x1f')](function(_0x2dc787){_0x363c5e[_0x369a('0x3d')]=_0x2dc787;return _0x363c5e;})[_0x369a('0x1f')](respondWithFilteredResult(_0x42eb21,_0x4efd07))[_0x369a('0x3e')](handleError(_0x42eb21,null));};exports[_0x369a('0x3f')]=function(_0x2dbbf1,_0x58131a){var _0x18e2f0={'raw':!![],'where':{'id':_0x2dbbf1[_0x369a('0x40')]['id']}},_0x1d4db0={};_0x1d4db0[_0x369a('0x2b')]=_[_0x369a('0x2d')](db[_0x369a('0x27')][_0x369a('0x28')]);_0x1d4db0[_0x369a('0x2c')]=_[_0x369a('0x2d')](_0x2dbbf1[_0x369a('0x2c')]);_0x1d4db0[_0x369a('0x2e')]=_[_0x369a('0x2f')](_0x1d4db0[_0x369a('0x2b')],_0x1d4db0[_0x369a('0x2c')]);_0x18e2f0[_0x369a('0x32')]=_[_0x369a('0x2f')](_0x1d4db0[_0x369a('0x2b')],qs[_0x369a('0x30')](_0x2dbbf1['query'][_0x369a('0x30')]));_0x18e2f0[_0x369a('0x32')]=_0x18e2f0[_0x369a('0x32')][_0x369a('0x31')]?_0x18e2f0[_0x369a('0x32')]:_0x1d4db0[_0x369a('0x2b')];if(_0x2dbbf1['query']['includeAll']){_0x18e2f0['include']=[{'all':!![]}];}_0x18e2f0=_[_0x369a('0x39')]({},_0x18e2f0,_0x2dbbf1[_0x369a('0x3a')]);return db[_0x369a('0x27')][_0x369a('0x41')](_0x18e2f0)[_0x369a('0x1f')](handleEntityNotFound(_0x58131a,null))[_0x369a('0x1f')](respondWithResult(_0x58131a,null))['catch'](handleError(_0x58131a,null));};exports['create']=function(_0x3e5dde,_0x21641b){return db[_0x369a('0x27')][_0x369a('0x42')](_0x3e5dde['body'],{})[_0x369a('0x1f')](respondWithResult(_0x21641b,0xc9))[_0x369a('0x3e')](handleError(_0x21641b,null));};exports[_0x369a('0x1d')]=function(_0x3949cd,_0x567c0c){if(_0x3949cd[_0x369a('0x43')]['id']){delete _0x3949cd[_0x369a('0x43')]['id'];}return db[_0x369a('0x27')]['find']({'where':{'id':_0x3949cd['params']['id']}})[_0x369a('0x1f')](handleEntityNotFound(_0x567c0c,null))['then'](saveUpdates(_0x3949cd[_0x369a('0x43')],null))[_0x369a('0x1f')](respondWithResult(_0x567c0c,null))[_0x369a('0x3e')](handleError(_0x567c0c,null));};exports[_0x369a('0x1e')]=function(_0x39343a,_0x58b6c3){return db['VoiceQueuesLog']['find']({'where':{'id':_0x39343a[_0x369a('0x40')]['id']}})[_0x369a('0x1f')](handleEntityNotFound(_0x58b6c3,null))[_0x369a('0x1f')](removeEntity(_0x58b6c3,null))[_0x369a('0x3e')](handleError(_0x58b6c3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 5ba0ada..5c0f227 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 _0x083e=['define','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x30f226,_0x1d0330){var _0x2a6f74=function(_0x4c9acc){while(--_0x4c9acc){_0x30f226['push'](_0x30f226['shift']());}};_0x2a6f74(++_0x1d0330);}(_0x083e,0x140));var _0xe083=function(_0x2d5934,_0x1acc4f){_0x2d5934=_0x2d5934-0x0;var _0x5807c8=_0x083e[_0x2d5934];return _0x5807c8;};'use strict';var _=require(_0xe083('0x0'));var util=require(_0xe083('0x1'));var logger=require('../../config/logger')(_0xe083('0x2'));var moment=require('moment');var BPromise=require(_0xe083('0x3'));var rp=require(_0xe083('0x4'));var fs=require('fs');var path=require(_0xe083('0x5'));var rimraf=require(_0xe083('0x6'));var config=require(_0xe083('0x7'));var attributes=require(_0xe083('0x8'));module[_0xe083('0x9')]=function(_0x489164,_0x298388){return _0x489164[_0xe083('0xa')](_0xe083('0xb'),attributes,{'tableName':_0xe083('0xc'),'paranoid':![],'indexes':[{'name':_0xe083('0xd'),'fields':[_0xe083('0xe'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xbfa1=['api','moment','bluebird','request-promise','path','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','util','../../config/logger'];(function(_0x3ff78f,_0x4bfafd){var _0x5abe3c=function(_0x5d83d0){while(--_0x5d83d0){_0x3ff78f['push'](_0x3ff78f['shift']());}};_0x5abe3c(++_0x4bfafd);}(_0xbfa1,0xfa));var _0x1bfa=function(_0x39e626,_0xeda754){_0x39e626=_0x39e626-0x0;var _0x4b8135=_0xbfa1[_0x39e626];return _0x4b8135;};'use strict';var _=require('lodash');var util=require(_0x1bfa('0x0'));var logger=require(_0x1bfa('0x1'))(_0x1bfa('0x2'));var moment=require(_0x1bfa('0x3'));var BPromise=require(_0x1bfa('0x4'));var rp=require(_0x1bfa('0x5'));var fs=require('fs');var path=require(_0x1bfa('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1bfa('0x7'));module[_0x1bfa('0x8')]=function(_0x92e087,_0x50b924){return _0x92e087['define'](_0x1bfa('0x9'),attributes,{'tableName':_0x1bfa('0xa'),'paranoid':![],'indexes':[{'name':_0x1bfa('0xb'),'fields':[_0x1bfa('0xc'),_0x1bfa('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 74554e4..e24c6ba 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 _0xbcc3=['client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x146780,_0x5b0b8d){var _0x3d5e98=function(_0x35305f){while(--_0x35305f){_0x146780['push'](_0x146780['shift']());}};_0x3d5e98(++_0x5b0b8d);}(_0xbcc3,0x86));var _0x3bcc=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0xbcc3[_0x1bfe2b];return _0x1477d4;};'use strict';var _=require(_0x3bcc('0x0'));var util=require(_0x3bcc('0x1'));var moment=require(_0x3bcc('0x2'));var BPromise=require('bluebird');var rs=require(_0x3bcc('0x3'));var fs=require('fs');var Redis=require(_0x3bcc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3bcc('0x5'));var logger=require(_0x3bcc('0x6'))(_0x3bcc('0x7'));var config=require(_0x3bcc('0x8'));var jayson=require(_0x3bcc('0x9'));var client=jayson[_0x3bcc('0xa')][_0x3bcc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x322219,_0x39cdd0,_0x54b4c3){return new BPromise(function(_0x3f17d6,_0x451e2a){return client['request'](_0x322219,_0x54b4c3)[_0x3bcc('0xc')](function(_0xb98b0b){logger[_0x3bcc('0xd')](_0x3bcc('0xe'),_0x39cdd0,'request\x20sent');logger[_0x3bcc('0xf')](_0x3bcc('0x10'),_0x39cdd0,_0x3bcc('0x11'),JSON[_0x3bcc('0x12')](_0xb98b0b));if(_0xb98b0b[_0x3bcc('0x13')]){if(_0xb98b0b['error'][_0x3bcc('0x14')]===0x1f4){logger[_0x3bcc('0x13')](_0x3bcc('0xe'),_0x39cdd0,_0xb98b0b['error'][_0x3bcc('0x15')]);return _0x451e2a(_0xb98b0b[_0x3bcc('0x13')][_0x3bcc('0x15')]);}logger[_0x3bcc('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x39cdd0,_0xb98b0b[_0x3bcc('0x13')][_0x3bcc('0x15')]);return _0x3f17d6(_0xb98b0b[_0x3bcc('0x13')]['message']);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x39cdd0,_0x3bcc('0x11'));_0x3f17d6(_0xb98b0b[_0x3bcc('0x16')][_0x3bcc('0x15')]);}})[_0x3bcc('0x17')](function(_0x166706){logger['error'](_0x3bcc('0xe'),_0x39cdd0,_0x166706);_0x451e2a(_0x166706);});});} \ No newline at end of file +var _0xd5e4=['info','debug','request\x20sent','stringify','code','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x5d57e3,_0x3f853a){var _0x1566ef=function(_0x34b6a3){while(--_0x34b6a3){_0x5d57e3['push'](_0x5d57e3['shift']());}};_0x1566ef(++_0x3f853a);}(_0xd5e4,0x8e));var _0x4d5e=function(_0x1b8008,_0x3055fb){_0x1b8008=_0x1b8008-0x0;var _0x3d6b69=_0xd5e4[_0x1b8008];return _0x3d6b69;};'use strict';var _=require(_0x4d5e('0x0'));var util=require(_0x4d5e('0x1'));var moment=require('moment');var BPromise=require(_0x4d5e('0x2'));var rs=require(_0x4d5e('0x3'));var fs=require('fs');var Redis=require(_0x4d5e('0x4'));var db=require(_0x4d5e('0x5'))['db'];var utils=require(_0x4d5e('0x6'));var logger=require('../../config/logger')(_0x4d5e('0x7'));var config=require(_0x4d5e('0x8'));var jayson=require(_0x4d5e('0x9'));var client=jayson[_0x4d5e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x408d51,_0x1a73fe,_0x28e2ca){return new BPromise(function(_0x583a3a,_0x7cacd1){return client['request'](_0x408d51,_0x28e2ca)[_0x4d5e('0xb')](function(_0x5a8186){logger[_0x4d5e('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1a73fe,'request\x20sent');logger[_0x4d5e('0xd')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x1a73fe,_0x4d5e('0xe'),JSON[_0x4d5e('0xf')](_0x5a8186));if(_0x5a8186['error']){if(_0x5a8186['error'][_0x4d5e('0x10')]===0x1f4){logger[_0x4d5e('0x11')](_0x4d5e('0x12'),_0x1a73fe,_0x5a8186[_0x4d5e('0x11')]['message']);return _0x7cacd1(_0x5a8186[_0x4d5e('0x11')][_0x4d5e('0x13')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x1a73fe,_0x5a8186[_0x4d5e('0x11')][_0x4d5e('0x13')]);return _0x583a3a(_0x5a8186[_0x4d5e('0x11')][_0x4d5e('0x13')]);}else{logger[_0x4d5e('0xc')](_0x4d5e('0x12'),_0x1a73fe,_0x4d5e('0xe'));_0x583a3a(_0x5a8186[_0x4d5e('0x14')]['message']);}})[_0x4d5e('0x15')](function(_0x4b03e1){logger[_0x4d5e('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1a73fe,_0x4b03e1);_0x7cacd1(_0x4b03e1);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index d436e9d..06658d3 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 _0xc709=['delete','exports','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','runTranscribe','update'];(function(_0x1282ba,_0x54b4dd){var _0x1c52e4=function(_0x7054cf){while(--_0x7054cf){_0x1282ba['push'](_0x1282ba['shift']());}};_0x1c52e4(++_0x54b4dd);}(_0xc709,0xb2));var _0x9c70=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0xc709[_0x4fbb15];return _0x436338;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9c70('0x0'));var timeout=require('connect-timeout');var express=require(_0x9c70('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9c70('0x2'));var interaction=require(_0x9c70('0x3'));var config=require(_0x9c70('0x4'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x9c70('0x5')](),controller['index']);router[_0x9c70('0x6')](_0x9c70('0x7'),auth[_0x9c70('0x5')](),controller[_0x9c70('0x8')]);router[_0x9c70('0x6')](_0x9c70('0x9'),auth['isAuthenticated'](),controller[_0x9c70('0xa')]);router[_0x9c70('0x6')](_0x9c70('0xb'),auth[_0x9c70('0x5')](),controller[_0x9c70('0xc')]);router['get'](_0x9c70('0xd'),controller[_0x9c70('0xe')]);router['get'](_0x9c70('0xf'),auth[_0x9c70('0x5')](),controller[_0x9c70('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9c70('0x11')]);router['post'](_0x9c70('0xf'),auth[_0x9c70('0x5')](),controller[_0x9c70('0x12')]);router['put'](_0x9c70('0x9'),auth[_0x9c70('0x5')](),controller[_0x9c70('0x13')]);router[_0x9c70('0x14')](_0x9c70('0x9'),auth[_0x9c70('0x5')](),controller['destroy']);module[_0x9c70('0x15')]=router; \ No newline at end of file +var _0x5954=['/describe','describe','/:id','show','/:id/download','/:id/downloads','/:id/transcribe','post','runTranscribe','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0x5954,0x1e9));var _0x4595=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5954[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0x4595('0x0'));var path=require(_0x4595('0x1'));var timeout=require(_0x4595('0x2'));var express=require(_0x4595('0x3'));var router=express['Router']();var fs_extra=require(_0x4595('0x4'));var auth=require(_0x4595('0x5'));var interaction=require(_0x4595('0x6'));var config=require(_0x4595('0x7'));var controller=require(_0x4595('0x8'));router[_0x4595('0x9')]('/',auth[_0x4595('0xa')](),controller['index']);router[_0x4595('0x9')](_0x4595('0xb'),auth[_0x4595('0xa')](),controller[_0x4595('0xc')]);router[_0x4595('0x9')](_0x4595('0xd'),auth[_0x4595('0xa')](),controller[_0x4595('0xe')]);router['get'](_0x4595('0xf'),auth[_0x4595('0xa')](),controller['download']);router[_0x4595('0x9')](_0x4595('0x10'),controller['downloads']);router[_0x4595('0x9')](_0x4595('0x11'),auth[_0x4595('0xa')](),controller['downloadTranscribe']);router[_0x4595('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4595('0x12')](_0x4595('0x11'),auth[_0x4595('0xa')](),controller[_0x4595('0x13')]);router[_0x4595('0x14')]('/:id',auth[_0x4595('0xa')](),controller[_0x4595('0x15')]);router[_0x4595('0x16')]('/:id',auth[_0x4595('0xa')](),controller[_0x4595('0x17')]);module[_0x4595('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 5450ee0..c79b815 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(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index f385804..2b20a4d 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 _0x74c4=['ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','sequelize','MD5','col','token','$and','push','destroy','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','upload','startTranscriptionJob','basename','readFileSync','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','TranscriptionJob','transcribeStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','sentiment','sentimentRegion','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Name','NEW','IN_PROGRESS','tempSentiment','runSentiment','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','aws-sdk','uuid/v4','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','save','update','then','end','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','include','findAll','show','params','includeAll','find','create','body','describe','catch','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','recording','existsSync','Sequelize'];(function(_0x3b75a0,_0x4da3b7){var _0x3854ba=function(_0x2c0aa4){while(--_0x2c0aa4){_0x3b75a0['push'](_0x3b75a0['shift']());}};_0x3854ba(++_0x4da3b7);}(_0x74c4,0x15c));var _0x474c=function(_0x4e929e,_0x508e16){_0x4e929e=_0x4e929e-0x0;var _0x13ed2d=_0x74c4[_0x4e929e];return _0x13ed2d;};'use strict';var emlformat=require(_0x474c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x474c('0x1'));var jsonpatch=require(_0x474c('0x2'));var rp=require(_0x474c('0x3'));var moment=require(_0x474c('0x4'));var BPromise=require(_0x474c('0x5'));var Mustache=require(_0x474c('0x6'));var util=require(_0x474c('0x7'));var path=require(_0x474c('0x8'));var sox=require(_0x474c('0x9'));var csv=require(_0x474c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x474c('0xb'));var squel=require(_0x474c('0xc'));var crypto=require(_0x474c('0xd'));var jsforce=require(_0x474c('0xe'));var deskjs=require(_0x474c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x474c('0x10'));var Papa=require('papaparse');var AWS=require(_0x474c('0x11'));var uuidv4=require(_0x474c('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x474c('0x13'));var as=require(_0x474c('0x14'));var hardwareService=require(_0x474c('0x15'));var logger=require(_0x474c('0x16'))(_0x474c('0x17'));var utils=require(_0x474c('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x474c('0x19'))['db'];function respondWithStatusCode(_0x3a2ae6,_0x10be0a){_0x10be0a=_0x10be0a||0xcc;return function(_0x986b0){if(_0x986b0){return _0x3a2ae6[_0x474c('0x1a')](_0x10be0a);}return _0x3a2ae6[_0x474c('0x1b')](_0x10be0a)['end']();};}function respondWithResult(_0x2c6e5f,_0x5d71af){_0x5d71af=_0x5d71af||0xc8;return function(_0x4c8ae1){if(_0x4c8ae1){return _0x2c6e5f[_0x474c('0x1b')](_0x5d71af)[_0x474c('0x1c')](_0x4c8ae1);}};}function respondWithFilteredResult(_0x17de57,_0x2c8b76){return function(_0x4a5c07){if(_0x4a5c07){var _0x164890=typeof _0x2c8b76['offset']==='undefined'&&typeof _0x2c8b76['limit']===_0x474c('0x1d');var _0x423d6f=_0x4a5c07[_0x474c('0x1e')];var _0x4ccb8f=_0x164890?0x0:_0x2c8b76[_0x474c('0x1f')];var _0x507785=_0x164890?_0x4a5c07[_0x474c('0x1e')]:_0x2c8b76[_0x474c('0x1f')]+_0x2c8b76[_0x474c('0x20')];var _0x5013f6;if(_0x507785>=_0x423d6f){_0x507785=_0x423d6f;_0x5013f6=0xc8;}else{_0x5013f6=0xce;}_0x17de57['status'](_0x5013f6);return _0x17de57[_0x474c('0x21')](_0x474c('0x22'),_0x4ccb8f+'-'+_0x507785+'/'+_0x423d6f)[_0x474c('0x1c')](_0x4a5c07);}return null;};}function patchUpdates(_0x39a392){return function(_0x1ea62f){try{jsonpatch['apply'](_0x1ea62f,_0x39a392,!![]);}catch(_0xd6979e){return BPromise['reject'](_0xd6979e);}return _0x1ea62f[_0x474c('0x23')]();};}function saveUpdates(_0x4661ac,_0x4a969d){return function(_0x52a427){if(_0x52a427){return _0x52a427[_0x474c('0x24')](_0x4661ac)[_0x474c('0x25')](function(_0x1b23b3){return _0x1b23b3;});}return null;};}function removeEntity(_0x210428,_0x5e20ed){return function(_0x5267d4){if(_0x5267d4){return _0x5267d4['destroy']()['then'](function(){_0x210428[_0x474c('0x1b')](0xcc)[_0x474c('0x26')]();});}};}function handleEntityNotFound(_0x1f9567,_0x474481){return function(_0x34eaf7){if(!_0x34eaf7){_0x1f9567['sendStatus'](0x194);}return _0x34eaf7;};}function handleError(_0x38cf2c,_0x432642){_0x432642=_0x432642||0x1f4;return function(_0x1e2e67){logger[_0x474c('0x27')](_0x1e2e67[_0x474c('0x28')]);if(_0x1e2e67[_0x474c('0x29')]){delete _0x1e2e67[_0x474c('0x29')];}_0x38cf2c['status'](_0x432642)[_0x474c('0x2a')](_0x1e2e67);};}exports[_0x474c('0x2b')]=function(_0x4acbfd,_0x540dc8){var _0x14b233={},_0x2ffcfb={},_0x32dee9={'count':0x0,'rows':[]};var _0x47de7d=_[_0x474c('0x2c')](db[_0x474c('0x2d')][_0x474c('0x2e')],function(_0x5ee52c){return{'name':_0x5ee52c[_0x474c('0x2f')],'type':_0x5ee52c[_0x474c('0x30')][_0x474c('0x31')]};});_0x2ffcfb[_0x474c('0x32')]=_[_0x474c('0x33')](_['map'](_0x47de7d,_0x474c('0x29')),[_0x474c('0x34')]);_0x2ffcfb[_0x474c('0x35')]=_[_0x474c('0x36')](_0x4acbfd[_0x474c('0x35')]);_0x2ffcfb[_0x474c('0x37')]=_['intersection'](_0x2ffcfb['model'],_0x2ffcfb[_0x474c('0x35')]);_0x14b233[_0x474c('0x38')]=_[_0x474c('0x39')](_0x2ffcfb[_0x474c('0x32')],qs[_0x474c('0x3a')](_0x4acbfd[_0x474c('0x35')][_0x474c('0x3a')]));_0x14b233[_0x474c('0x38')]=_0x14b233[_0x474c('0x38')][_0x474c('0x3b')]?_0x14b233[_0x474c('0x38')]:_0x2ffcfb['model'];if(!_0x4acbfd['query'][_0x474c('0x3c')](_0x474c('0x3d'))){_0x14b233[_0x474c('0x20')]=qs[_0x474c('0x20')](_0x4acbfd[_0x474c('0x35')]['limit']);_0x14b233[_0x474c('0x1f')]=qs['offset'](_0x4acbfd['query']['offset']);}_0x14b233[_0x474c('0x3e')]=qs[_0x474c('0x3f')](_0x4acbfd[_0x474c('0x35')][_0x474c('0x3f')]);_0x14b233['where']=qs[_0x474c('0x37')](_['pick'](_0x4acbfd[_0x474c('0x35')],_0x2ffcfb[_0x474c('0x37')]),_0x47de7d);if(_0x4acbfd[_0x474c('0x35')]['filter']){_0x14b233[_0x474c('0x40')]=_['merge'](_0x14b233[_0x474c('0x40')],{'$or':_[_0x474c('0x2c')](_0x47de7d,function(_0xed1844){if(_0xed1844[_0x474c('0x30')]!==_0x474c('0x41')){var _0x5ecc1b={};_0x5ecc1b[_0xed1844[_0x474c('0x29')]]={'$like':'%'+_0x4acbfd[_0x474c('0x35')]['filter']+'%'};return _0x5ecc1b;}})});}_0x14b233=_[_0x474c('0x42')]({},_0x14b233,_0x4acbfd[_0x474c('0x43')]);var _0x3a9483={'where':_0x14b233['where']};return db['VoiceRecording'][_0x474c('0x1e')](_0x3a9483)[_0x474c('0x25')](function(_0x1738cf){_0x32dee9[_0x474c('0x1e')]=_0x1738cf;if(_0x4acbfd[_0x474c('0x35')]['includeAll']){_0x14b233[_0x474c('0x44')]=[{'all':!![]}];}return db['VoiceRecording'][_0x474c('0x45')](_0x14b233);})[_0x474c('0x25')](function(_0x2a603c){_0x32dee9['rows']=_0x2a603c;return _0x32dee9;})['then'](respondWithFilteredResult(_0x540dc8,_0x14b233))['catch'](handleError(_0x540dc8,null));};exports[_0x474c('0x46')]=function(_0x28e225,_0x4cec91){var _0x2ca475={'raw':![],'where':{'id':_0x28e225[_0x474c('0x47')]['id']}},_0x4c3c38={};_0x4c3c38[_0x474c('0x32')]=_['keys'](db['VoiceRecording'][_0x474c('0x2e')]);_0x4c3c38[_0x474c('0x35')]=_[_0x474c('0x36')](_0x28e225['query']);_0x4c3c38[_0x474c('0x37')]=_[_0x474c('0x39')](_0x4c3c38[_0x474c('0x32')],_0x4c3c38[_0x474c('0x35')]);_0x2ca475[_0x474c('0x38')]=_['intersection'](_0x4c3c38['model'],qs[_0x474c('0x3a')](_0x28e225['query']['fields']));_0x2ca475[_0x474c('0x38')]=_0x2ca475[_0x474c('0x38')]['length']?_0x2ca475[_0x474c('0x38')]:_0x4c3c38['model'];if(_0x28e225[_0x474c('0x35')][_0x474c('0x48')]){_0x2ca475['include']=[{'all':!![]}];}_0x2ca475=_['merge']({},_0x2ca475,_0x28e225[_0x474c('0x43')]);return db[_0x474c('0x2d')][_0x474c('0x49')](_0x2ca475)[_0x474c('0x25')](handleEntityNotFound(_0x4cec91,null))[_0x474c('0x25')](respondWithResult(_0x4cec91,null))['catch'](handleError(_0x4cec91,null));};exports[_0x474c('0x4a')]=function(_0x3d0763,_0x1413c6){return db[_0x474c('0x2d')][_0x474c('0x4a')](_0x3d0763['body'],{})[_0x474c('0x25')](respondWithResult(_0x1413c6,0xc9))['catch'](handleError(_0x1413c6,null));};exports[_0x474c('0x24')]=function(_0x52dc5c,_0x345c7c){if(_0x52dc5c[_0x474c('0x4b')]['id']){delete _0x52dc5c[_0x474c('0x4b')]['id'];}return db[_0x474c('0x2d')][_0x474c('0x49')]({'where':{'id':_0x52dc5c[_0x474c('0x47')]['id']}})[_0x474c('0x25')](handleEntityNotFound(_0x345c7c,null))['then'](saveUpdates(_0x52dc5c['body'],null))['then'](respondWithResult(_0x345c7c,null))['catch'](handleError(_0x345c7c,null));};exports[_0x474c('0x4c')]=function(_0xc7f880,_0x3c7a19){return db[_0x474c('0x2d')]['describe']()['then'](respondWithResult(_0x3c7a19,null))[_0x474c('0x4d')](handleError(_0x3c7a19,null));};exports[_0x474c('0x4e')]=function(_0xb73fc8,_0x3a871d,_0x594652){var _0x23e700=require(_0x474c('0x4f'));var _0x4d4fbd=![];var _0x1f1346={};if(_0xb73fc8['query'][_0x474c('0x30')]&&_0xb73fc8[_0x474c('0x35')]['type']==='uniqueid'){_0x1f1346[_0x474c('0x50')]=_0xb73fc8[_0x474c('0x47')]['id'];}else{_0x1f1346['id']=_0xb73fc8[_0x474c('0x47')]['id'];}return db[_0x474c('0x2d')][_0x474c('0x49')]({'where':_0x1f1346,'attributes':['id',_0x474c('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x3a871d,null))['then'](function(_0x252a4e){if(_0x252a4e){var _0x5269d8=_0x252a4e[_0x474c('0x51')];var _0x5eee7e=util['format'](_0x474c('0x52'),_0x5269d8);if(fs['existsSync'](_0x5eee7e)){_0x4d4fbd=!![];return _0x23e700[_0x474c('0x53')](_0x5eee7e,_0x5269d8,config['secrets'][_0x474c('0x54')])[_0x474c('0x25')](function(){return _0x252a4e;});}return _0x252a4e;}})['then'](function(_0x4fe95a){if(_0x4fe95a){var _0x20ae26=_0x4fe95a[_0x474c('0x51')];if(!fs[_0x474c('0x55')](_0x20ae26)){throw new db[(_0x474c('0x56'))][(_0x474c('0x57'))](_0x474c('0x58'));}if(_0x4fe95a[_0x474c('0x59')]){return _0x3a871d['download'](_0x20ae26,_0x4fe95a['filename']+path[_0x474c('0x5a')](_0x20ae26),function(){if(_0x4d4fbd){fs['unlink'](_0x20ae26);}});}else{return _0x3a871d[_0x474c('0x4e')](_0x20ae26,function(_0x18706a){if(_0x4d4fbd){fs[_0x474c('0x5b')](_0x20ae26);}});}}})[_0x474c('0x4d')](function(_0x1c3e73){if(_0x1c3e73[_0x474c('0x5c')]===_0x474c('0x58')){_0x3a871d[_0x474c('0x1b')](0x194)['send']('Not\x20found');}else{return handleError(_0x3a871d,null);}});};exports['downloads']=function(_0x70a83f,_0x35e88e,_0x12eb8c){var _0x370ce9=require(_0x474c('0x4f'));var _0x38852c=![];var _0x55a141={'$and':[db[_0x474c('0x5d')][_0x474c('0x40')](db[_0x474c('0x5d')]['fn'](_0x474c('0x5e'),db['sequelize'][_0x474c('0x5f')]('uniqueid')),_0x70a83f[_0x474c('0x35')][_0x474c('0x60')])]};if(_0x70a83f['query'][_0x474c('0x30')]&&_0x70a83f['query']['type']===_0x474c('0x50')){_0x55a141[_0x474c('0x61')]['push']({'uniqueid':_0x70a83f[_0x474c('0x47')]['id']});}else{_0x55a141['$and'][_0x474c('0x62')]({'id':_0x70a83f[_0x474c('0x47')]['id']});}return db[_0x474c('0x2d')][_0x474c('0x49')]({'where':_0x55a141,'attributes':['id',_0x474c('0x51')],'raw':!![]})[_0x474c('0x25')](handleEntityNotFound(_0x35e88e,null))[_0x474c('0x25')](function(_0x15ee42){if(_0x15ee42){var _0x4e58de=util[_0x474c('0x34')](_0x474c('0x52'),_0x15ee42['value']);if(fs[_0x474c('0x55')](_0x4e58de)){_0x38852c=!![];return _0x370ce9['decryptFile'](_0x4e58de,_0x15ee42[_0x474c('0x51')],config['secrets']['recording'])[_0x474c('0x25')](function(){return _0x15ee42;});}return _0x15ee42;}})[_0x474c('0x25')](function(_0x48e34a){if(_0x48e34a){if(!fs[_0x474c('0x55')](_0x48e34a[_0x474c('0x51')])){throw new db[(_0x474c('0x56'))][(_0x474c('0x57'))](_0x474c('0x58'));}if(_0x48e34a[_0x474c('0x59')]){return _0x35e88e[_0x474c('0x4e')](_0x48e34a['value'],_0x48e34a[_0x474c('0x59')]+path[_0x474c('0x5a')](_0x48e34a[_0x474c('0x51')]),function(){if(_0x38852c){fs['unlink'](_0x48e34a[_0x474c('0x51')]);}});}else{return _0x35e88e[_0x474c('0x4e')](_0x48e34a['value'],function(_0x45a84b){if(_0x38852c){fs[_0x474c('0x5b')](_0x48e34a[_0x474c('0x51')]);}});}}})[_0x474c('0x4d')](handleError(_0x35e88e,null));};exports[_0x474c('0x63')]=function(_0x19c5d2,_0x2043fe){return db[_0x474c('0x2d')][_0x474c('0x49')]({'where':{'id':_0x19c5d2[_0x474c('0x47')]['id']}})[_0x474c('0x25')](function(_0x8be8d2){if(_['isNil'](_0x8be8d2)){throw new ReferenceError('Entity\x20not\x20found');}return _0x8be8d2;})[_0x474c('0x25')](function(_0x1ac50a){var _0x36a568=_0x1ac50a['value'];logger[_0x474c('0x64')](_0x474c('0x65'),_0x36a568);if(!_[_0x474c('0x66')](_0x1ac50a[_0x474c('0x51')])&&fs[_0x474c('0x55')](_0x36a568)){logger[_0x474c('0x64')](_0x474c('0x67')+_0x36a568+_0x474c('0x68'));fs[_0x474c('0x69')](_0x36a568);}_0x36a568=_0x36a568+_0x474c('0x6a');if(!_[_0x474c('0x66')](_0x1ac50a['value'])&&fs[_0x474c('0x55')](_0x36a568)){logger[_0x474c('0x64')](_0x474c('0x67')+_0x36a568+_0x474c('0x68'));fs[_0x474c('0x69')](_0x36a568);}return _0x1ac50a;})['then'](function(_0x2eaf5f){if(!_0x2eaf5f)throw new InternalError();return _0x2eaf5f[_0x474c('0x63')]();})[_0x474c('0x25')](function(){_0x2043fe[_0x474c('0x1b')](0xcc)[_0x474c('0x26')]();})[_0x474c('0x4d')](handleError(_0x2043fe,null));};function getBucketslist(_0x80ddab,_0x5839fa,_0x1577fd){return new Promise(function(_0x28c5ad,_0x132fde){var _0x5e0cb8=new AWS['S3']({'accessKeyId':_0x5839fa,'secretAccessKey':_0x80ddab,'region':_0x1577fd});_0x5e0cb8['listBuckets']({},function(_0x3c7c44,_0x29f4a2){if(_0x3c7c44){return _0x132fde(_0x3c7c44);}else{return _0x28c5ad(_0x29f4a2);}});});}function createBucket(_0x2011c0,_0x35bb2f,_0x2789b7,_0x15f5a2){return new Promise(function(_0x4c2c61,_0x49717b){var _0x2ebc98=new AWS['S3']({'accessKeyId':_0x35bb2f,'secretAccessKey':_0x2011c0,'region':_0x2789b7});_0x2ebc98[_0x474c('0x6b')]({'Bucket':_0x15f5a2},function(_0x287aba,_0x283cb9){if(_0x287aba){return _0x49717b(_0x287aba);}else{return _0x4c2c61(_0x283cb9);}});});}function uploadFile(_0x3035d9,_0x10e8f8,_0x2c6b79,_0x11b92f,_0xedc6c5,_0x60ec89){return new Promise(function(_0x12e80b,_0x13eca2){var _0x419a0f=new AWS['S3']({'accessKeyId':_0x10e8f8,'secretAccessKey':_0x3035d9,'region':_0x2c6b79});_0x419a0f[_0x474c('0x6c')]({'Bucket':_0x11b92f,'Key':_0xedc6c5,'Body':_0x60ec89},function(_0x16999a,_0x229667){if(_0x16999a){return _0x13eca2(_0x16999a);}else{return _0x12e80b(_0x229667);}});});}function startTranscribe(_0x401e13,_0x99643c,_0x8943e0,_0x517925,_0x3fc6b0,_0x12b07c){return new Promise(function(_0x2248b4,_0x5841ab){var _0x13d35e=new AWS['TranscribeService']({'accessKeyId':_0x99643c,'secretAccessKey':_0x401e13,'region':_0x8943e0});_0x13d35e[_0x474c('0x6d')]({'TranscriptionJobName':_0x517925,'LanguageCode':_0x3fc6b0,'Media':{'MediaFileUri':_0x12b07c}},function(_0x43768f,_0x4c11b4){if(_0x43768f){return _0x5841ab(_0x43768f);}else{return _0x2248b4(_0x4c11b4);}});});}function transcribe(_0x34d2b3,_0x1e5a79,_0x35e4fc,_0x162793,_0x5b5ca3,_0x3a30e0,_0x43d64a){return new Promise(function(_0x36b9ea,_0x54b255){var _0x25fc63={};logger['info'](util[_0x474c('0x34')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x34d2b3,_0x5b5ca3));return uploadFile(_0x1e5a79,_0x35e4fc,_0x162793,_0x5b5ca3,path[_0x474c('0x6e')](_0x3a30e0),fs[_0x474c('0x6f')](_0x3a30e0))[_0x474c('0x25')](function(_0x3213b1){logger[_0x474c('0x64')](util[_0x474c('0x34')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x34d2b3,_0x5b5ca3,_0x3213b1['Location']));_0x25fc63['bucket']=_0x3213b1[_0x474c('0x70')];_0x25fc63[_0x474c('0x71')]=_0x3213b1[_0x474c('0x72')];logger[_0x474c('0x64')](util[_0x474c('0x34')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x34d2b3));return startTranscribe(_0x1e5a79,_0x35e4fc,_0x162793,uuidv4(),_0x43d64a,_0x3213b1['Location']);})[_0x474c('0x25')](function(_0x2b630f){logger['info'](util['format'](_0x474c('0x73'),_0x34d2b3,_0x2b630f['TranscriptionJob'][_0x474c('0x74')]));_0x25fc63['transcribeName']=_0x2b630f[_0x474c('0x75')][_0x474c('0x74')];_0x25fc63[_0x474c('0x76')]=_0x2b630f[_0x474c('0x75')]['TranscriptionJobStatus'];return _0x36b9ea(_0x25fc63);})[_0x474c('0x4d')](function(_0x381b2b){return _0x54b255(_0x381b2b);});});}exports['runTranscribe']=function(_0x5d47fa,_0x21c0df,_0x26d356){var _0x1283d7;var _0x15e9a6;var _0x31541a;var _0x28e8c8=require(_0x474c('0x4f'));return db[_0x474c('0x2d')][_0x474c('0x77')]({'where':{'id':_0x5d47fa[_0x474c('0x47')]['id']}})[_0x474c('0x25')](function(_0x2f3442){if(_0x2f3442){var _0x4de760=util[_0x474c('0x34')](_0x474c('0x52'),_0x2f3442['value']);if(fs[_0x474c('0x55')](_0x4de760)){cypher=!![];return _0x28e8c8['decryptFile'](_0x4de760,_0x2f3442['value'],config['secrets'][_0x474c('0x54')])[_0x474c('0x25')](function(){return _0x2f3442;});}return _0x2f3442;}})[_0x474c('0x25')](function(_0x5a47df){if(!_0x5a47df){throw new db[(_0x474c('0x56'))][(_0x474c('0x57'))](_0x474c('0x78'));}_0x15e9a6=_0x5a47df;return db[_0x474c('0x79')]['findOne']({'where':{'id':0x1}});})[_0x474c('0x25')](handleEntityNotFound(_0x21c0df,null))[_0x474c('0x25')](function(_0x1a8fa4){if(_0x1a8fa4){_0x1283d7=_0x1a8fa4;if(!_0x1283d7[_0x474c('0x7a')]||!_0x1283d7[_0x474c('0x7b')]||!_0x1283d7[_0x474c('0x7c')]||!_0x1283d7[_0x474c('0x7d')]||!_0x1283d7[_0x474c('0x7e')]){throw new db[(_0x474c('0x56'))][(_0x474c('0x57'))](_0x474c('0x7f'));}if(_0x5d47fa[_0x474c('0x4b')]['runSentiment']&&(!_0x1283d7[_0x474c('0x80')]||!_0x1283d7['sentimentAccountId']||!_0x1283d7[_0x474c('0x81')]||!_0x1283d7[_0x474c('0x7d')]||!_0x1283d7[_0x474c('0x7e')])){throw new db[(_0x474c('0x56'))][(_0x474c('0x57'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0x474c('0x77')]({'where':{'id':_0x1283d7[_0x474c('0x7b')]}});}})[_0x474c('0x25')](function(_0x5b3d39){if(!_0x5b3d39){throw new db[(_0x474c('0x56'))]['ValidationError'](_0x474c('0x82'));}if(!_0x5b3d39[_0x474c('0x83')]||!_0x5b3d39[_0x474c('0x84')]){throw new db[(_0x474c('0x56'))]['ValidationError'](_0x474c('0x85'));}_0x31541a=_0x5b3d39;return getBucketslist(_0x31541a[_0x474c('0x83')],_0x31541a['data2'],_0x1283d7[_0x474c('0x7c')]);})[_0x474c('0x25')](function(_0x176b17){if(_0x176b17&&_0x176b17['Buckets']){var _0xb74182=_[_0x474c('0x49')](_0x176b17['Buckets'],function(_0x23ba46){return _0x23ba46[_0x474c('0x86')]===_0x1283d7['bucket'];});if(!_0xb74182){logger[_0x474c('0x64')](util[_0x474c('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x5d47fa[_0x474c('0x47')]['id'],_0x1283d7[_0x474c('0x7e')]));return createBucket(_0x31541a[_0x474c('0x83')],_0x31541a[_0x474c('0x84')],_0x1283d7[_0x474c('0x7c')],_0x1283d7[_0x474c('0x7e')]);}logger[_0x474c('0x64')](util[_0x474c('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x5d47fa['params']['id'],_0x1283d7['bucket']));return;}})[_0x474c('0x25')](function(_0x2c4d03){if(_0x15e9a6['transcribeStatus']===_0x474c('0x87')){return transcribe(_0x5d47fa[_0x474c('0x47')]['id'],_0x31541a[_0x474c('0x83')],_0x31541a['data2'],_0x1283d7[_0x474c('0x7c')],_0x1283d7['bucket'],_0x15e9a6[_0x474c('0x51')],_0x1283d7[_0x474c('0x7d')]);}else{logger[_0x474c('0x64')](util[_0x474c('0x34')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x5d47fa['params']['id']));return{'transcribeStatus':_0x474c('0x88')};}})[_0x474c('0x25')](function(_0x51df50){if(_0x51df50){_0x51df50[_0x474c('0x89')]=_0x5d47fa[_0x474c('0x4b')][_0x474c('0x8a')];return _0x15e9a6['updateAttributes'](_0x51df50);}})[_0x474c('0x25')](respondWithResult(_0x21c0df,null))[_0x474c('0x4d')](handleError(_0x21c0df,null));};function writeFile(_0x5b9549,_0x467a96){return new Promise(function(_0x4021c3,_0xc87834){fs[_0x474c('0x8b')](_0x467a96,_0x5b9549,function(_0x40dbd2,_0x4ec34a){if(_0x40dbd2){return _0xc87834(_0x40dbd2);}else{return _0x4021c3(_0x4ec34a);}});});}exports[_0x474c('0x8c')]=function(_0x2e2e05,_0x47e5ba,_0x1dfc40){return db['VoiceRecording'][_0x474c('0x77')]({'where':{'id':_0x2e2e05[_0x474c('0x47')]['id']}})[_0x474c('0x25')](handleEntityNotFound(_0x47e5ba))[_0x474c('0x25')](function(_0x2b6bc7){if(_0x2b6bc7&&_0x2b6bc7[_0x474c('0x8d')]){var _0x59d96c=_0x2b6bc7[_0x474c('0x8d')];var _0x5d8ba4=config['root']+_0x474c('0x8e')+_0x2b6bc7['id']+_0x474c('0x8f');if(fs[_0x474c('0x55')](_0x5d8ba4)){return _0x5d8ba4;}return writeFile(_0x59d96c,_0x5d8ba4)[_0x474c('0x25')](function(){return _0x5d8ba4;});}else{throw new db[(_0x474c('0x56'))][(_0x474c('0x57'))](_0x474c('0x90'));}})[_0x474c('0x25')](function(_0x3c0cd7){return _0x47e5ba[_0x474c('0x4e')](_0x3c0cd7);})[_0x474c('0x4d')](handleError(_0x47e5ba));}; \ No newline at end of file +var _0x8528=['end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','index','map','VoiceRecording','fieldName','type','key','model','format','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','keys','rawAttributes','find','create','body','update','params','describe','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','send','downloads','../../components/encryptor','sequelize','MD5','col','push','$and','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','listBuckets','upload','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','TranscriptionJobStatus','runTranscribe','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','downloadTranscribe','findOne','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','aws-sdk','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x43b06b,_0x1929c7){var _0x2c555b=function(_0x30fa8c){while(--_0x30fa8c){_0x43b06b['push'](_0x43b06b['shift']());}};_0x2c555b(++_0x1929c7);}(_0x8528,0x108));var _0x8852=function(_0x4e4ad8,_0x3cf315){_0x4e4ad8=_0x4e4ad8-0x0;var _0x2f1947=_0x8528[_0x4e4ad8];return _0x2f1947;};'use strict';var emlformat=require(_0x8852('0x0'));var rimraf=require(_0x8852('0x1'));var zipdir=require(_0x8852('0x2'));var jsonpatch=require(_0x8852('0x3'));var rp=require(_0x8852('0x4'));var moment=require(_0x8852('0x5'));var BPromise=require(_0x8852('0x6'));var Mustache=require(_0x8852('0x7'));var util=require('util');var path=require(_0x8852('0x8'));var sox=require(_0x8852('0x9'));var csv=require(_0x8852('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8852('0xb'));var squel=require(_0x8852('0xc'));var crypto=require(_0x8852('0xd'));var jsforce=require(_0x8852('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8852('0xa'));var querystring=require(_0x8852('0xf'));var Papa=require('papaparse');var AWS=require(_0x8852('0x10'));var uuidv4=require(_0x8852('0x11'));var Redis=require(_0x8852('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8852('0x13'));var hardwareService=require(_0x8852('0x14'));var logger=require('../../config/logger')(_0x8852('0x15'));var utils=require(_0x8852('0x16'));var config=require(_0x8852('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a1aa6,_0x29a8cf){_0x29a8cf=_0x29a8cf||0xcc;return function(_0xa0eee1){if(_0xa0eee1){return _0x2a1aa6[_0x8852('0x18')](_0x29a8cf);}return _0x2a1aa6[_0x8852('0x19')](_0x29a8cf)[_0x8852('0x1a')]();};}function respondWithResult(_0x207b62,_0x1f2d03){_0x1f2d03=_0x1f2d03||0xc8;return function(_0x156a19){if(_0x156a19){return _0x207b62[_0x8852('0x19')](_0x1f2d03)[_0x8852('0x1b')](_0x156a19);}};}function respondWithFilteredResult(_0x374cb3,_0x4d1379){return function(_0x594dcd){if(_0x594dcd){var _0x133e63=typeof _0x4d1379[_0x8852('0x1c')]===_0x8852('0x1d')&&typeof _0x4d1379[_0x8852('0x1e')]==='undefined';var _0x1ce076=_0x594dcd['count'];var _0x27a828=_0x133e63?0x0:_0x4d1379[_0x8852('0x1c')];var _0x1bacd0=_0x133e63?_0x594dcd['count']:_0x4d1379[_0x8852('0x1c')]+_0x4d1379[_0x8852('0x1e')];var _0x351599;if(_0x1bacd0>=_0x1ce076){_0x1bacd0=_0x1ce076;_0x351599=0xc8;}else{_0x351599=0xce;}_0x374cb3['status'](_0x351599);return _0x374cb3[_0x8852('0x1f')](_0x8852('0x20'),_0x27a828+'-'+_0x1bacd0+'/'+_0x1ce076)['json'](_0x594dcd);}return null;};}function patchUpdates(_0x1ea366){return function(_0x18531e){try{jsonpatch[_0x8852('0x21')](_0x18531e,_0x1ea366,!![]);}catch(_0x23e145){return BPromise[_0x8852('0x22')](_0x23e145);}return _0x18531e[_0x8852('0x23')]();};}function saveUpdates(_0x70488b,_0x373823){return function(_0xdbe39){if(_0xdbe39){return _0xdbe39['update'](_0x70488b)['then'](function(_0x1b89a9){return _0x1b89a9;});}return null;};}function removeEntity(_0x831496,_0x3b633d){return function(_0xbc17ea){if(_0xbc17ea){return _0xbc17ea[_0x8852('0x24')]()[_0x8852('0x25')](function(){_0x831496[_0x8852('0x19')](0xcc)[_0x8852('0x1a')]();});}};}function handleEntityNotFound(_0x10c63a,_0x52eb89){return function(_0x80fb05){if(!_0x80fb05){_0x10c63a['sendStatus'](0x194);}return _0x80fb05;};}function handleError(_0x21182b,_0x3064da){_0x3064da=_0x3064da||0x1f4;return function(_0x7f97bd){logger['error'](_0x7f97bd[_0x8852('0x26')]);if(_0x7f97bd[_0x8852('0x27')]){delete _0x7f97bd[_0x8852('0x27')];}_0x21182b[_0x8852('0x19')](_0x3064da)['send'](_0x7f97bd);};}exports[_0x8852('0x28')]=function(_0x3ba0f1,_0x4e355f){var _0x1b86e7={},_0x1629a4={},_0x4fead2={'count':0x0,'rows':[]};var _0x39ece0=_[_0x8852('0x29')](db[_0x8852('0x2a')]['rawAttributes'],function(_0x59c39e){return{'name':_0x59c39e[_0x8852('0x2b')],'type':_0x59c39e[_0x8852('0x2c')][_0x8852('0x2d')]};});_0x1629a4[_0x8852('0x2e')]=_['differenceBy'](_[_0x8852('0x29')](_0x39ece0,_0x8852('0x27')),[_0x8852('0x2f')]);_0x1629a4[_0x8852('0x30')]=_['keys'](_0x3ba0f1[_0x8852('0x30')]);_0x1629a4[_0x8852('0x31')]=_['intersection'](_0x1629a4[_0x8852('0x2e')],_0x1629a4['query']);_0x1b86e7[_0x8852('0x32')]=_[_0x8852('0x33')](_0x1629a4[_0x8852('0x2e')],qs['fields'](_0x3ba0f1[_0x8852('0x30')][_0x8852('0x34')]));_0x1b86e7[_0x8852('0x32')]=_0x1b86e7['attributes'][_0x8852('0x35')]?_0x1b86e7[_0x8852('0x32')]:_0x1629a4['model'];if(!_0x3ba0f1[_0x8852('0x30')][_0x8852('0x36')](_0x8852('0x37'))){_0x1b86e7['limit']=qs['limit'](_0x3ba0f1[_0x8852('0x30')][_0x8852('0x1e')]);_0x1b86e7['offset']=qs['offset'](_0x3ba0f1[_0x8852('0x30')][_0x8852('0x1c')]);}_0x1b86e7[_0x8852('0x38')]=qs['sort'](_0x3ba0f1[_0x8852('0x30')][_0x8852('0x39')]);_0x1b86e7['where']=qs[_0x8852('0x31')](_[_0x8852('0x3a')](_0x3ba0f1['query'],_0x1629a4[_0x8852('0x31')]),_0x39ece0);if(_0x3ba0f1[_0x8852('0x30')][_0x8852('0x3b')]){_0x1b86e7[_0x8852('0x3c')]=_[_0x8852('0x3d')](_0x1b86e7[_0x8852('0x3c')],{'$or':_[_0x8852('0x29')](_0x39ece0,function(_0x20f90d){if(_0x20f90d[_0x8852('0x2c')]!==_0x8852('0x3e')){var _0x40715c={};_0x40715c[_0x20f90d['name']]={'$like':'%'+_0x3ba0f1[_0x8852('0x30')][_0x8852('0x3b')]+'%'};return _0x40715c;}})});}_0x1b86e7=_[_0x8852('0x3d')]({},_0x1b86e7,_0x3ba0f1[_0x8852('0x3f')]);var _0x2c403c={'where':_0x1b86e7[_0x8852('0x3c')]};return db[_0x8852('0x2a')][_0x8852('0x40')](_0x2c403c)[_0x8852('0x25')](function(_0x498dd5){_0x4fead2[_0x8852('0x40')]=_0x498dd5;if(_0x3ba0f1['query'][_0x8852('0x41')]){_0x1b86e7[_0x8852('0x42')]=[{'all':!![]}];}return db[_0x8852('0x2a')]['findAll'](_0x1b86e7);})[_0x8852('0x25')](function(_0x587b1a){_0x4fead2[_0x8852('0x43')]=_0x587b1a;return _0x4fead2;})['then'](respondWithFilteredResult(_0x4e355f,_0x1b86e7))[_0x8852('0x44')](handleError(_0x4e355f,null));};exports[_0x8852('0x45')]=function(_0x137b01,_0x119a14){var _0x2d1a2c={'raw':![],'where':{'id':_0x137b01['params']['id']}},_0x1d4185={};_0x1d4185[_0x8852('0x2e')]=_[_0x8852('0x46')](db[_0x8852('0x2a')][_0x8852('0x47')]);_0x1d4185[_0x8852('0x30')]=_[_0x8852('0x46')](_0x137b01[_0x8852('0x30')]);_0x1d4185[_0x8852('0x31')]=_[_0x8852('0x33')](_0x1d4185[_0x8852('0x2e')],_0x1d4185[_0x8852('0x30')]);_0x2d1a2c[_0x8852('0x32')]=_[_0x8852('0x33')](_0x1d4185['model'],qs[_0x8852('0x34')](_0x137b01[_0x8852('0x30')][_0x8852('0x34')]));_0x2d1a2c['attributes']=_0x2d1a2c[_0x8852('0x32')][_0x8852('0x35')]?_0x2d1a2c[_0x8852('0x32')]:_0x1d4185[_0x8852('0x2e')];if(_0x137b01[_0x8852('0x30')]['includeAll']){_0x2d1a2c[_0x8852('0x42')]=[{'all':!![]}];}_0x2d1a2c=_[_0x8852('0x3d')]({},_0x2d1a2c,_0x137b01['options']);return db['VoiceRecording'][_0x8852('0x48')](_0x2d1a2c)[_0x8852('0x25')](handleEntityNotFound(_0x119a14,null))[_0x8852('0x25')](respondWithResult(_0x119a14,null))[_0x8852('0x44')](handleError(_0x119a14,null));};exports[_0x8852('0x49')]=function(_0x5ef69b,_0x5edd59){return db[_0x8852('0x2a')][_0x8852('0x49')](_0x5ef69b[_0x8852('0x4a')],{})[_0x8852('0x25')](respondWithResult(_0x5edd59,0xc9))[_0x8852('0x44')](handleError(_0x5edd59,null));};exports[_0x8852('0x4b')]=function(_0x581ef6,_0x107335){if(_0x581ef6[_0x8852('0x4a')]['id']){delete _0x581ef6['body']['id'];}return db[_0x8852('0x2a')][_0x8852('0x48')]({'where':{'id':_0x581ef6[_0x8852('0x4c')]['id']}})[_0x8852('0x25')](handleEntityNotFound(_0x107335,null))[_0x8852('0x25')](saveUpdates(_0x581ef6[_0x8852('0x4a')],null))[_0x8852('0x25')](respondWithResult(_0x107335,null))[_0x8852('0x44')](handleError(_0x107335,null));};exports[_0x8852('0x4d')]=function(_0x49916b,_0x12e1c4){return db[_0x8852('0x2a')][_0x8852('0x4d')]()[_0x8852('0x25')](respondWithResult(_0x12e1c4,null))[_0x8852('0x44')](handleError(_0x12e1c4,null));};exports['download']=function(_0xadbaa3,_0x854646,_0x33d9e1){var _0x2f5721=require('../../components/encryptor');var _0x354969=![];var _0x596c50={};if(_0xadbaa3[_0x8852('0x30')][_0x8852('0x2c')]&&_0xadbaa3['query'][_0x8852('0x2c')]===_0x8852('0x4e')){_0x596c50[_0x8852('0x4e')]=_0xadbaa3[_0x8852('0x4c')]['id'];}else{_0x596c50['id']=_0xadbaa3[_0x8852('0x4c')]['id'];}return db[_0x8852('0x2a')]['find']({'where':_0x596c50,'attributes':['id','value'],'raw':!![]})[_0x8852('0x25')](handleEntityNotFound(_0x854646,null))[_0x8852('0x25')](function(_0x34a941){if(_0x34a941){var _0x5dcdab=_0x34a941[_0x8852('0x4f')];var _0x2901ae=util[_0x8852('0x2f')](_0x8852('0x50'),_0x5dcdab);if(fs[_0x8852('0x51')](_0x2901ae)){_0x354969=!![];return _0x2f5721[_0x8852('0x52')](_0x2901ae,_0x5dcdab,config['secrets'][_0x8852('0x53')])[_0x8852('0x25')](function(){return _0x34a941;});}return _0x34a941;}})[_0x8852('0x25')](function(_0x2a371b){if(_0x2a371b){var _0x36a0da=_0x2a371b['value'];if(!fs[_0x8852('0x51')](_0x36a0da)){throw new db[(_0x8852('0x54'))][(_0x8852('0x55'))](_0x8852('0x56'));}if(_0x2a371b[_0x8852('0x57')]){return _0x854646[_0x8852('0x58')](_0x36a0da,_0x2a371b[_0x8852('0x57')]+path[_0x8852('0x59')](_0x36a0da),function(){if(_0x354969){fs[_0x8852('0x5a')](_0x36a0da);}});}else{return _0x854646['download'](_0x36a0da,function(_0x5405d1){if(_0x354969){fs[_0x8852('0x5a')](_0x36a0da);}});}}})[_0x8852('0x44')](function(_0x292455){if(_0x292455[_0x8852('0x5b')]==='VoiceRecording\x20not\x20found'){_0x854646[_0x8852('0x19')](0x194)[_0x8852('0x5c')]('Not\x20found');}else{return handleError(_0x854646,null);}});};exports[_0x8852('0x5d')]=function(_0x1e25bc,_0x35dd12,_0x18cc39){var _0x1044f6=require(_0x8852('0x5e'));var _0x4657e0=![];var _0x23949b={'$and':[db[_0x8852('0x5f')][_0x8852('0x3c')](db[_0x8852('0x5f')]['fn'](_0x8852('0x60'),db[_0x8852('0x5f')][_0x8852('0x61')](_0x8852('0x4e'))),_0x1e25bc[_0x8852('0x30')]['token'])]};if(_0x1e25bc['query'][_0x8852('0x2c')]&&_0x1e25bc['query'][_0x8852('0x2c')]===_0x8852('0x4e')){_0x23949b['$and'][_0x8852('0x62')]({'uniqueid':_0x1e25bc[_0x8852('0x4c')]['id']});}else{_0x23949b[_0x8852('0x63')]['push']({'id':_0x1e25bc[_0x8852('0x4c')]['id']});}return db[_0x8852('0x2a')][_0x8852('0x48')]({'where':_0x23949b,'attributes':['id',_0x8852('0x4f')],'raw':!![]})[_0x8852('0x25')](handleEntityNotFound(_0x35dd12,null))[_0x8852('0x25')](function(_0x486a5a){if(_0x486a5a){var _0x34dd87=util[_0x8852('0x2f')](_0x8852('0x50'),_0x486a5a[_0x8852('0x4f')]);if(fs['existsSync'](_0x34dd87)){_0x4657e0=!![];return _0x1044f6[_0x8852('0x52')](_0x34dd87,_0x486a5a[_0x8852('0x4f')],config['secrets'][_0x8852('0x53')])[_0x8852('0x25')](function(){return _0x486a5a;});}return _0x486a5a;}})[_0x8852('0x25')](function(_0x10fce6){if(_0x10fce6){if(!fs['existsSync'](_0x10fce6[_0x8852('0x4f')])){throw new db['Sequelize']['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x10fce6[_0x8852('0x57')]){return _0x35dd12[_0x8852('0x58')](_0x10fce6['value'],_0x10fce6['filename']+path[_0x8852('0x59')](_0x10fce6[_0x8852('0x4f')]),function(){if(_0x4657e0){fs[_0x8852('0x5a')](_0x10fce6[_0x8852('0x4f')]);}});}else{return _0x35dd12[_0x8852('0x58')](_0x10fce6[_0x8852('0x4f')],function(_0x221b52){if(_0x4657e0){fs['unlink'](_0x10fce6[_0x8852('0x4f')]);}});}}})[_0x8852('0x44')](handleError(_0x35dd12,null));};exports['destroy']=function(_0x44ebd0,_0x4a0b3e){return db['VoiceRecording'][_0x8852('0x48')]({'where':{'id':_0x44ebd0[_0x8852('0x4c')]['id']}})[_0x8852('0x25')](function(_0x3203e3){if(_[_0x8852('0x64')](_0x3203e3)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3203e3;})['then'](function(_0x293939){var _0x41639b=_0x293939[_0x8852('0x4f')];logger[_0x8852('0x65')](_0x8852('0x66'),_0x41639b);if(!_['isNil'](_0x293939['value'])&&fs[_0x8852('0x51')](_0x41639b)){logger[_0x8852('0x65')]('File:\x20\x22'+_0x41639b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x41639b);}_0x41639b=_0x41639b+'.cypher';if(!_[_0x8852('0x64')](_0x293939['value'])&&fs[_0x8852('0x51')](_0x41639b)){logger[_0x8852('0x65')](_0x8852('0x67')+_0x41639b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8852('0x68')](_0x41639b);}return _0x293939;})[_0x8852('0x25')](function(_0x54a385){if(!_0x54a385)throw new InternalError();return _0x54a385['destroy']();})[_0x8852('0x25')](function(){_0x4a0b3e[_0x8852('0x19')](0xcc)[_0x8852('0x1a')]();})['catch'](handleError(_0x4a0b3e,null));};function getBucketslist(_0x4973e2,_0x1d00a7,_0x4d3641){return new Promise(function(_0x4021eb,_0x1ed9e1){var _0x5e68a7=new AWS['S3']({'accessKeyId':_0x1d00a7,'secretAccessKey':_0x4973e2,'region':_0x4d3641});_0x5e68a7[_0x8852('0x69')]({},function(_0xce080c,_0x24f2a8){if(_0xce080c){return _0x1ed9e1(_0xce080c);}else{return _0x4021eb(_0x24f2a8);}});});}function createBucket(_0x71a85c,_0x46f99b,_0x5ccaac,_0x4fc6a0){return new Promise(function(_0x4f2a18,_0xeb0b29){var _0x4d2e7b=new AWS['S3']({'accessKeyId':_0x46f99b,'secretAccessKey':_0x71a85c,'region':_0x5ccaac});_0x4d2e7b['createBucket']({'Bucket':_0x4fc6a0},function(_0x3e39de,_0x4f16a3){if(_0x3e39de){return _0xeb0b29(_0x3e39de);}else{return _0x4f2a18(_0x4f16a3);}});});}function uploadFile(_0x4ffa5f,_0x4f619c,_0x32030a,_0x254e5a,_0x32305e,_0x439636){return new Promise(function(_0x6320c9,_0x254b92){var _0x11f323=new AWS['S3']({'accessKeyId':_0x4f619c,'secretAccessKey':_0x4ffa5f,'region':_0x32030a});_0x11f323[_0x8852('0x6a')]({'Bucket':_0x254e5a,'Key':_0x32305e,'Body':_0x439636},function(_0x318b99,_0x3a20a2){if(_0x318b99){return _0x254b92(_0x318b99);}else{return _0x6320c9(_0x3a20a2);}});});}function startTranscribe(_0x4dad2b,_0x1702f4,_0x1b66cc,_0x3e1ffa,_0x5d15e8,_0x4c2f97){return new Promise(function(_0x2f57c1,_0x5af31b){var _0x32f0e8=new AWS['TranscribeService']({'accessKeyId':_0x1702f4,'secretAccessKey':_0x4dad2b,'region':_0x1b66cc});_0x32f0e8['startTranscriptionJob']({'TranscriptionJobName':_0x3e1ffa,'LanguageCode':_0x5d15e8,'Media':{'MediaFileUri':_0x4c2f97}},function(_0x114bed,_0x255d6b){if(_0x114bed){return _0x5af31b(_0x114bed);}else{return _0x2f57c1(_0x255d6b);}});});}function transcribe(_0x1aa0ed,_0x366e61,_0x134edb,_0x5e1acd,_0x3c9e14,_0x1a6342,_0x49fba4){return new Promise(function(_0x47396b,_0xd4c0dc){var _0x4199a9={};logger[_0x8852('0x65')](util[_0x8852('0x2f')](_0x8852('0x6b'),_0x1aa0ed,_0x3c9e14));return uploadFile(_0x366e61,_0x134edb,_0x5e1acd,_0x3c9e14,path['basename'](_0x1a6342),fs['readFileSync'](_0x1a6342))[_0x8852('0x25')](function(_0x35c77b){logger['info'](util[_0x8852('0x2f')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x1aa0ed,_0x3c9e14,_0x35c77b[_0x8852('0x6c')]));_0x4199a9['bucket']=_0x35c77b[_0x8852('0x6d')];_0x4199a9[_0x8852('0x6e')]=_0x35c77b[_0x8852('0x6c')];logger[_0x8852('0x65')](util['format'](_0x8852('0x6f'),_0x1aa0ed));return startTranscribe(_0x366e61,_0x134edb,_0x5e1acd,uuidv4(),_0x49fba4,_0x35c77b[_0x8852('0x6c')]);})[_0x8852('0x25')](function(_0x113172){logger['info'](util[_0x8852('0x2f')](_0x8852('0x70'),_0x1aa0ed,_0x113172[_0x8852('0x71')][_0x8852('0x72')]));_0x4199a9['transcribeName']=_0x113172['TranscriptionJob'][_0x8852('0x72')];_0x4199a9['transcribeStatus']=_0x113172['TranscriptionJob'][_0x8852('0x73')];return _0x47396b(_0x4199a9);})[_0x8852('0x44')](function(_0x577ffe){return _0xd4c0dc(_0x577ffe);});});}exports[_0x8852('0x74')]=function(_0x37730a,_0x4f0239,_0x5c39d9){var _0x4a5043;var _0x1a3ded;var _0x47b489;var _0x144338=require(_0x8852('0x5e'));return db[_0x8852('0x2a')]['findOne']({'where':{'id':_0x37730a[_0x8852('0x4c')]['id']}})[_0x8852('0x25')](function(_0x2a4672){if(_0x2a4672){var _0x542e66=util[_0x8852('0x2f')](_0x8852('0x50'),_0x2a4672[_0x8852('0x4f')]);if(fs[_0x8852('0x51')](_0x542e66)){cypher=!![];return _0x144338[_0x8852('0x52')](_0x542e66,_0x2a4672[_0x8852('0x4f')],config['secrets'][_0x8852('0x53')])[_0x8852('0x25')](function(){return _0x2a4672;});}return _0x2a4672;}})[_0x8852('0x25')](function(_0x2b5113){if(!_0x2b5113){throw new db[(_0x8852('0x54'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x1a3ded=_0x2b5113;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x8852('0x25')](handleEntityNotFound(_0x4f0239,null))['then'](function(_0x51076a){if(_0x51076a){_0x4a5043=_0x51076a;if(!_0x4a5043[_0x8852('0x75')]||!_0x4a5043[_0x8852('0x76')]||!_0x4a5043[_0x8852('0x77')]||!_0x4a5043[_0x8852('0x78')]||!_0x4a5043['bucket']){throw new db[(_0x8852('0x54'))]['ValidationError'](_0x8852('0x79'));}if(_0x37730a[_0x8852('0x4a')][_0x8852('0x7a')]&&(!_0x4a5043['sentiment']||!_0x4a5043[_0x8852('0x7b')]||!_0x4a5043[_0x8852('0x7c')]||!_0x4a5043[_0x8852('0x78')]||!_0x4a5043[_0x8852('0x7d')])){throw new db[(_0x8852('0x54'))][(_0x8852('0x55'))](_0x8852('0x7e'));}return db['CloudProvider']['findOne']({'where':{'id':_0x4a5043[_0x8852('0x76')]}});}})['then'](function(_0x2845c0){if(!_0x2845c0){throw new db['Sequelize'][(_0x8852('0x55'))](_0x8852('0x7f'));}if(!_0x2845c0[_0x8852('0x80')]||!_0x2845c0['data2']){throw new db[(_0x8852('0x54'))][(_0x8852('0x55'))](_0x8852('0x81'));}_0x47b489=_0x2845c0;return getBucketslist(_0x47b489['data1'],_0x47b489[_0x8852('0x82')],_0x4a5043[_0x8852('0x77')]);})[_0x8852('0x25')](function(_0x2f9ef5){if(_0x2f9ef5&&_0x2f9ef5[_0x8852('0x83')]){var _0x7e019a=_['find'](_0x2f9ef5[_0x8852('0x83')],function(_0x3a6699){return _0x3a6699[_0x8852('0x84')]===_0x4a5043['bucket'];});if(!_0x7e019a){logger[_0x8852('0x65')](util[_0x8852('0x2f')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x37730a['params']['id'],_0x4a5043['bucket']));return createBucket(_0x47b489[_0x8852('0x80')],_0x47b489[_0x8852('0x82')],_0x4a5043[_0x8852('0x77')],_0x4a5043[_0x8852('0x7d')]);}logger['info'](util['format'](_0x8852('0x85'),_0x37730a['params']['id'],_0x4a5043['bucket']));return;}})[_0x8852('0x25')](function(_0x3ff74c){if(_0x1a3ded[_0x8852('0x86')]===_0x8852('0x87')){return transcribe(_0x37730a[_0x8852('0x4c')]['id'],_0x47b489[_0x8852('0x80')],_0x47b489[_0x8852('0x82')],_0x4a5043[_0x8852('0x77')],_0x4a5043[_0x8852('0x7d')],_0x1a3ded[_0x8852('0x4f')],_0x4a5043[_0x8852('0x78')]);}else{logger['info'](util[_0x8852('0x2f')](_0x8852('0x88'),_0x37730a[_0x8852('0x4c')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x8852('0x25')](function(_0x2c8198){if(_0x2c8198){_0x2c8198[_0x8852('0x89')]=_0x37730a[_0x8852('0x4a')]['runSentiment'];return _0x1a3ded[_0x8852('0x8a')](_0x2c8198);}})[_0x8852('0x25')](respondWithResult(_0x4f0239,null))[_0x8852('0x44')](handleError(_0x4f0239,null));};function writeFile(_0x2695c9,_0x5045ab){return new Promise(function(_0x22b5b0,_0x285b33){fs[_0x8852('0x8b')](_0x5045ab,_0x2695c9,function(_0x3297f8,_0x582f95){if(_0x3297f8){return _0x285b33(_0x3297f8);}else{return _0x22b5b0(_0x582f95);}});});}exports[_0x8852('0x8c')]=function(_0x2b62aa,_0x514d26,_0x591f0b){return db[_0x8852('0x2a')][_0x8852('0x8d')]({'where':{'id':_0x2b62aa[_0x8852('0x4c')]['id']}})[_0x8852('0x25')](handleEntityNotFound(_0x514d26))[_0x8852('0x25')](function(_0x2992f2){if(_0x2992f2&&_0x2992f2[_0x8852('0x8e')]){var _0x8167d3=_0x2992f2[_0x8852('0x8e')];var _0x16c47b=config['root']+_0x8852('0x8f')+_0x2992f2['id']+'.txt';if(fs[_0x8852('0x51')](_0x16c47b)){return _0x16c47b;}return writeFile(_0x8167d3,_0x16c47b)[_0x8852('0x25')](function(){return _0x16c47b;});}else{throw new db['Sequelize'][(_0x8852('0x55'))](_0x8852('0x90'));}})[_0x8852('0x25')](function(_0x36cd52){return _0x514d26[_0x8852('0x58')](_0x36cd52);})[_0x8852('0x44')](handleError(_0x514d26));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 2a57d61..f6913ff 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 _0x3c7b=['transcribeStatus','./voiceRecording.attributes','exports','define'];(function(_0x40a923,_0x371735){var _0x153f91=function(_0x504e45){while(--_0x504e45){_0x40a923['push'](_0x40a923['shift']());}};_0x153f91(++_0x371735);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x1834ff,_0x40f4bd){_0x1834ff=_0x1834ff-0x0;var _0x29e647=_0x3c7b[_0x1834ff];return _0x29e647;};'use strict';var attributes=require(_0xb3c7('0x0'));module[_0xb3c7('0x1')]=function(_0xc43ced,_0x2686ba){return _0xc43ced[_0xb3c7('0x2')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']},{'name':_0xb3c7('0x3'),'fields':[_0xb3c7('0x3')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0328=['exports','define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x56a28a,_0x12b812){var _0x2f0161=function(_0x39c580){while(--_0x39c580){_0x56a28a['push'](_0x56a28a['shift']());}};_0x2f0161(++_0x12b812);}(_0x0328,0x172));var _0x8032=function(_0x2a3872,_0x44ccd4){_0x2a3872=_0x2a3872-0x0;var _0x59ffb2=_0x0328[_0x2a3872];return _0x59ffb2;};'use strict';var attributes=require(_0x8032('0x0'));module[_0x8032('0x1')]=function(_0x2bdc4f,_0x3be376){return _0x2bdc4f[_0x8032('0x2')](_0x8032('0x3'),attributes,{'tableName':_0x8032('0x4'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8032('0x5')]},{'name':_0x8032('0x6'),'fields':[_0x8032('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 397eb0c..a5d742a 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 _0x3a6d=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateVoiceRecording','VoiceRecording','update','options','raw','where','debug','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','body','value','%s.cypher','encryptFile','secrets','recording','unlink','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x51d8a1,_0x2f63ee){var _0x51be5a=function(_0x1f7a85){while(--_0x1f7a85){_0x51d8a1['push'](_0x51d8a1['shift']());}};_0x51be5a(++_0x2f63ee);}(_0x3a6d,0x143));var _0xd3a6=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x3a6d[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var moment=require('moment');var BPromise=require(_0xd3a6('0x2'));var rs=require(_0xd3a6('0x3'));var fs=require('fs');var Redis=require(_0xd3a6('0x4'));var db=require(_0xd3a6('0x5'))['db'];var utils=require(_0xd3a6('0x6'));var logger=require('../../config/logger')(_0xd3a6('0x7'));var config=require(_0xd3a6('0x8'));var jayson=require(_0xd3a6('0x9'));var client=jayson[_0xd3a6('0xa')][_0xd3a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x282cb1,_0x58d83a,_0x121bd2){return new BPromise(function(_0x134dd3,_0x16858){return client[_0xd3a6('0xc')](_0x282cb1,_0x121bd2)[_0xd3a6('0xd')](function(_0xa67661){logger[_0xd3a6('0xe')](_0xd3a6('0xf'),_0x58d83a,_0xd3a6('0x10'));logger['debug'](_0xd3a6('0x11'),_0x58d83a,_0xd3a6('0x10'),JSON[_0xd3a6('0x12')](_0xa67661));if(_0xa67661[_0xd3a6('0x13')]){if(_0xa67661[_0xd3a6('0x13')]['code']===0x1f4){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x58d83a,_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);return _0x16858(_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);}logger[_0xd3a6('0x13')](_0xd3a6('0xf'),_0x58d83a,_0xa67661[_0xd3a6('0x13')]['message']);return _0x134dd3(_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);}else{logger[_0xd3a6('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x58d83a,_0xd3a6('0x10'));_0x134dd3(_0xa67661[_0xd3a6('0x15')][_0xd3a6('0x14')]);}})['catch'](function(_0x3498d5){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x58d83a,_0x3498d5);_0x16858(_0x3498d5);});});}exports[_0xd3a6('0x16')]=function(_0x8d1286){var _0x32683f=this;return new Promise(function(_0xbe58b4,_0x22fb05){return db[_0xd3a6('0x17')][_0xd3a6('0x18')](_0x8d1286['body'],{'raw':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286['options'][_0xd3a6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286[_0xd3a6('0x19')][_0xd3a6('0x1b')]||null:null,'attributes':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286[_0xd3a6('0x19')]['attributes']||null:null,'limit':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286[_0xd3a6('0x19')]['limit']||null:null})['then'](function(_0x5846bc){logger['info']('UpdateVoiceRecording',_0x8d1286);logger[_0xd3a6('0x1c')](_0xd3a6('0x16'),_0x8d1286,JSON[_0xd3a6('0x12')](_0x5846bc));_0xbe58b4(_0x5846bc);})['catch'](function(_0x456541){logger['error'](_0xd3a6('0x16'),_0x456541[_0xd3a6('0x14')],_0x8d1286);_0x22fb05(_0x32683f[_0xd3a6('0x13')](0x1f4,_0x456541['message']));});});};exports[_0xd3a6('0x1d')]=function(_0x3bc8d1){var _0x1b09ac=this;return new Promise(function(_0x219e32,_0x169d11){var _0x3106f1=require('../../components/encryptor');var _0x30df90;return db[_0xd3a6('0x1e')][_0xd3a6('0x1f')]({'attributes':['id',_0xd3a6('0x20')],'where':{'id':0x1},'raw':!![]})[_0xd3a6('0xd')](function(_0x45c628){_0x30df90=_0x45c628;return db['VoiceRecording']['create'](_0x3bc8d1[_0xd3a6('0x21')]);})[_0xd3a6('0xd')](function(_0x35981c){if(_0x30df90[_0xd3a6('0x20')]&&fs['existsSync'](_0x35981c[_0xd3a6('0x22')])){var _0xa4efd=util['format'](_0xd3a6('0x23'),_0x35981c['value']);return _0x3106f1[_0xd3a6('0x24')](_0x35981c[_0xd3a6('0x22')],_0xa4efd,config[_0xd3a6('0x25')][_0xd3a6('0x26')])[_0xd3a6('0xd')](function(){fs[_0xd3a6('0x27')](_0x35981c[_0xd3a6('0x22')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x35981c;});}return _0x35981c;})[_0xd3a6('0xd')](function(_0x155640){logger[_0xd3a6('0xe')]('CreateVoiceRecording',_0x3bc8d1);logger[_0xd3a6('0x1c')](_0xd3a6('0x1d'),_0x3bc8d1,JSON[_0xd3a6('0x12')](_0x155640));_0x219e32(_0x155640);})[_0xd3a6('0x28')](function(_0x3ebd0d){logger[_0xd3a6('0x13')](_0xd3a6('0x1d'),_0x3ebd0d[_0xd3a6('0x14')],_0x3bc8d1);_0x169d11(_0x1b09ac['error'](0x1f4,_0x3ebd0d[_0xd3a6('0x14')]));});});}; \ No newline at end of file +var _0x7bd0=['callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','VoiceRecording','update','body','options','raw','attributes','UpdateVoiceRecording','CreateVoiceRecording','Setting','findOne'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x7bd0,0x111));var _0x07bd=function(_0x1b76e6,_0x598520){_0x1b76e6=_0x1b76e6-0x0;var _0x333b53=_0x7bd0[_0x1b76e6];return _0x333b53;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422a22,_0x2e4cd1,_0x5a939d){return new BPromise(function(_0x3968d9,_0x5cd446){return client[_0x07bd('0xd')](_0x422a22,_0x5a939d)[_0x07bd('0xe')](function(_0x323724){logger['info'](_0x07bd('0xf'),_0x2e4cd1,_0x07bd('0x10'));logger[_0x07bd('0x11')](_0x07bd('0x12'),_0x2e4cd1,'request\x20sent',JSON[_0x07bd('0x13')](_0x323724));if(_0x323724[_0x07bd('0x14')]){if(_0x323724[_0x07bd('0x14')][_0x07bd('0x15')]===0x1f4){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x5cd446(_0x323724['error']['message']);}logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x3968d9(_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);}else{logger[_0x07bd('0x17')]('VoiceRecording,\x20%s,\x20%s',_0x2e4cd1,_0x07bd('0x10'));_0x3968d9(_0x323724['result'][_0x07bd('0x16')]);}})[_0x07bd('0x18')](function(_0x31655a){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x31655a);_0x5cd446(_0x31655a);});});}exports['UpdateVoiceRecording']=function(_0x3f9f0b){var _0xc4cf4c=this;return new Promise(function(_0x4948f4,_0x3e8ec4){return db[_0x07bd('0x19')][_0x07bd('0x1a')](_0x3f9f0b[_0x07bd('0x1b')],{'raw':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')][_0x07bd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')]['where']||null:null,'attributes':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')][_0x07bd('0x1e')]||null:null,'limit':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')]['limit']||null:null})['then'](function(_0xbb7117){logger['info'](_0x07bd('0x1f'),_0x3f9f0b);logger['debug']('UpdateVoiceRecording',_0x3f9f0b,JSON[_0x07bd('0x13')](_0xbb7117));_0x4948f4(_0xbb7117);})[_0x07bd('0x18')](function(_0xf3b23c){logger[_0x07bd('0x14')](_0x07bd('0x1f'),_0xf3b23c[_0x07bd('0x16')],_0x3f9f0b);_0x3e8ec4(_0xc4cf4c['error'](0x1f4,_0xf3b23c[_0x07bd('0x16')]));});});};exports[_0x07bd('0x20')]=function(_0x3db9d0){var _0x2a7202=this;return new Promise(function(_0x12ce26,_0x1c1fda){var _0x571dab=require('../../components/encryptor');var _0x5184dc;return db[_0x07bd('0x21')][_0x07bd('0x22')]({'attributes':['id',_0x07bd('0x23')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x1a3aa9){_0x5184dc=_0x1a3aa9;return db[_0x07bd('0x19')][_0x07bd('0x24')](_0x3db9d0[_0x07bd('0x1b')]);})[_0x07bd('0xe')](function(_0x13bf6b){if(_0x5184dc['callRecordingEncryption']&&fs[_0x07bd('0x25')](_0x13bf6b[_0x07bd('0x26')])){var _0x4182b9=util[_0x07bd('0x27')](_0x07bd('0x28'),_0x13bf6b[_0x07bd('0x26')]);return _0x571dab[_0x07bd('0x29')](_0x13bf6b[_0x07bd('0x26')],_0x4182b9,config['secrets']['recording'])[_0x07bd('0xe')](function(){fs[_0x07bd('0x2a')](_0x13bf6b[_0x07bd('0x26')]);logger['info'](_0x07bd('0x2b'));return _0x13bf6b;});}return _0x13bf6b;})[_0x07bd('0xe')](function(_0x208aca){logger['info']('CreateVoiceRecording',_0x3db9d0);logger[_0x07bd('0x11')](_0x07bd('0x20'),_0x3db9d0,JSON[_0x07bd('0x13')](_0x208aca));_0x12ce26(_0x208aca);})[_0x07bd('0x18')](function(_0x5f29c5){logger[_0x07bd('0x14')](_0x07bd('0x20'),_0x5f29c5[_0x07bd('0x16')],_0x3db9d0);_0x1c1fda(_0x2a7202['error'](0x1f4,_0x5f29c5[_0x07bd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index aabdae1..814f938 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 _0xfce3=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x2a608d,_0x298459){var _0x1bee3e=function(_0x989a39){while(--_0x989a39){_0x2a608d['push'](_0x2a608d['shift']());}};_0x1bee3e(++_0x298459);}(_0xfce3,0x1cf));var _0x3fce=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0xfce3[_0x52f1e6];return _0x21f104;};'use strict';var multer=require('multer');var util=require(_0x3fce('0x0'));var path=require(_0x3fce('0x1'));var timeout=require(_0x3fce('0x2'));var express=require(_0x3fce('0x3'));var router=express[_0x3fce('0x4')]();var fs_extra=require(_0x3fce('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3fce('0x6'));var config=require(_0x3fce('0x7'));var controller=require('./voiceTransferReport.controller');router[_0x3fce('0x8')]('/',auth[_0x3fce('0x9')](),controller[_0x3fce('0xa')]);router[_0x3fce('0x8')](_0x3fce('0xb'),auth[_0x3fce('0x9')](),controller[_0x3fce('0xc')]);router[_0x3fce('0x8')](_0x3fce('0xd'),auth['isAuthenticated'](),controller[_0x3fce('0xe')]);router[_0x3fce('0xf')]('/',auth[_0x3fce('0x9')](),controller[_0x3fce('0x10')]);router['put'](_0x3fce('0xd'),auth[_0x3fce('0x9')](),controller['update']);router[_0x3fce('0x11')](_0x3fce('0xd'),auth[_0x3fce('0x9')](),controller[_0x3fce('0x12')]);module[_0x3fce('0x13')]=router; \ No newline at end of file +var _0xd993=['show','post','isAuthenticated','create','put','/:id','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','/describe','describe'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd993,0x184));var _0x3d99=function(_0x1fcaf3,_0x2b922e){_0x1fcaf3=_0x1fcaf3-0x0;var _0x264641=_0xd993[_0x1fcaf3];return _0x264641;};'use strict';var multer=require(_0x3d99('0x0'));var util=require(_0x3d99('0x1'));var path=require('path');var timeout=require(_0x3d99('0x2'));var express=require(_0x3d99('0x3'));var router=express[_0x3d99('0x4')]();var fs_extra=require(_0x3d99('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3d99('0x6'));var config=require(_0x3d99('0x7'));var controller=require(_0x3d99('0x8'));router[_0x3d99('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3d99('0x9')](_0x3d99('0xa'),auth['isAuthenticated'](),controller[_0x3d99('0xb')]);router[_0x3d99('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3d99('0xc')]);router[_0x3d99('0xd')]('/',auth[_0x3d99('0xe')](),controller[_0x3d99('0xf')]);router[_0x3d99('0x10')](_0x3d99('0x11'),auth[_0x3d99('0xe')](),controller['update']);router[_0x3d99('0x12')]('/:id',auth[_0x3d99('0xe')](),controller[_0x3d99('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index a91d5c8..b9a9249 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 _0x14b9=['attended','STRING','Yes','moment','exports','ENUM','blind'];(function(_0x3682d8,_0x21f366){var _0x443fc4=function(_0xbb10ca){while(--_0xbb10ca){_0x3682d8['push'](_0x3682d8['shift']());}};_0x443fc4(++_0x21f366);}(_0x14b9,0xc7));var _0x914b=function(_0x345642,_0x58db41){_0x345642=_0x345642-0x0;var _0x161334=_0x14b9[_0x345642];return _0x161334;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x914b('0x0'));module[_0x914b('0x1')]={'type':{'type':Sequelize[_0x914b('0x2')](_0x914b('0x3'),_0x914b('0x4'))},'result':{'type':Sequelize[_0x914b('0x5')]},'transfererchannel':{'type':Sequelize[_0x914b('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x914b('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x914b('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x914b('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x914b('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x914b('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x914b('0x5')]},'transfereechannel':{'type':Sequelize[_0x914b('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x914b('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x914b('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x914b('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x914b('0x5')]},'transfereecontext':{'type':Sequelize[_0x914b('0x5')]},'transfereeexten':{'type':Sequelize[_0x914b('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x914b('0x5')]},'isexternal':{'type':Sequelize[_0x914b('0x2')](_0x914b('0x6'),'No')},'context':{'type':Sequelize[_0x914b('0x5')]},'extension':{'type':Sequelize[_0x914b('0x5')]}}; \ No newline at end of file +var _0x4ce0=['STRING','sequelize','moment','ENUM'];(function(_0x5e0b66,_0x2cfcf3){var _0x104792=function(_0xbacaf7){while(--_0xbacaf7){_0x5e0b66['push'](_0x5e0b66['shift']());}};_0x104792(++_0x2cfcf3);}(_0x4ce0,0x91));var _0x04ce=function(_0xe6df97,_0x544f0a){_0xe6df97=_0xe6df97-0x0;var _0x511d51=_0x4ce0[_0xe6df97];return _0x511d51;};'use strict';var Sequelize=require(_0x04ce('0x0'));var moment=require(_0x04ce('0x1'));module['exports']={'type':{'type':Sequelize[_0x04ce('0x2')]('blind','attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x04ce('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x04ce('0x3')]},'transferercalleridname':{'type':Sequelize[_0x04ce('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x04ce('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x04ce('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x04ce('0x3')]},'transfereechannel':{'type':Sequelize[_0x04ce('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x04ce('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x04ce('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x04ce('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x04ce('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0x04ce('0x3')]},'transfereecontext':{'type':Sequelize[_0x04ce('0x3')]},'transfereeexten':{'type':Sequelize[_0x04ce('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x04ce('0x3')]},'isexternal':{'type':Sequelize[_0x04ce('0x2')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 734a607..4aee1db 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 _0x8f62=['name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','stack'];(function(_0x58f16c,_0x2aed51){var _0x2fb1f0=function(_0x8ef637){while(--_0x8ef637){_0x58f16c['push'](_0x58f16c['shift']());}};_0x2fb1f0(++_0x2aed51);}(_0x8f62,0x71));var _0x28f6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8f62[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x28f6('0x0'));var rimraf=require(_0x28f6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28f6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x28f6('0x3'));var Mustache=require(_0x28f6('0x4'));var util=require(_0x28f6('0x5'));var path=require(_0x28f6('0x6'));var sox=require(_0x28f6('0x7'));var csv=require(_0x28f6('0x8'));var ejs=require(_0x28f6('0x9'));var fs=require('fs');var fs_extra=require(_0x28f6('0xa'));var _=require(_0x28f6('0xb'));var squel=require(_0x28f6('0xc'));var crypto=require(_0x28f6('0xd'));var jsforce=require(_0x28f6('0xe'));var deskjs=require(_0x28f6('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x28f6('0x10'));var authService=require(_0x28f6('0x11'));var qs=require(_0x28f6('0x12'));var as=require(_0x28f6('0x13'));var hardwareService=require(_0x28f6('0x14'));var logger=require(_0x28f6('0x15'))('api');var utils=require(_0x28f6('0x16'));var config=require(_0x28f6('0x17'));var licenseUtil=require(_0x28f6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x385c5f,_0x992a42){_0x992a42=_0x992a42||0xcc;return function(_0x8146db){if(_0x8146db){return _0x385c5f[_0x28f6('0x19')](_0x992a42);}return _0x385c5f[_0x28f6('0x1a')](_0x992a42)[_0x28f6('0x1b')]();};}function respondWithResult(_0xca215b,_0x24c503){_0x24c503=_0x24c503||0xc8;return function(_0x144197){if(_0x144197){return _0xca215b[_0x28f6('0x1a')](_0x24c503)[_0x28f6('0x1c')](_0x144197);}};}function respondWithFilteredResult(_0x33b720,_0x28cb15){return function(_0x1d88ed){if(_0x1d88ed){var _0x1c1592=typeof _0x28cb15[_0x28f6('0x1d')]===_0x28f6('0x1e')&&typeof _0x28cb15[_0x28f6('0x1f')]==='undefined';var _0x11360f=_0x1d88ed[_0x28f6('0x20')];var _0xac2bd=_0x1c1592?0x0:_0x28cb15[_0x28f6('0x1d')];var _0x417ca7=_0x1c1592?_0x1d88ed['count']:_0x28cb15[_0x28f6('0x1d')]+_0x28cb15['limit'];var _0x2d42bd;if(_0x417ca7>=_0x11360f){_0x417ca7=_0x11360f;_0x2d42bd=0xc8;}else{_0x2d42bd=0xce;}_0x33b720['status'](_0x2d42bd);return _0x33b720[_0x28f6('0x21')]('Content-Range',_0xac2bd+'-'+_0x417ca7+'/'+_0x11360f)[_0x28f6('0x1c')](_0x1d88ed);}return null;};}function patchUpdates(_0x5b1693){return function(_0x4db1b7){try{jsonpatch[_0x28f6('0x22')](_0x4db1b7,_0x5b1693,!![]);}catch(_0x5f22ce){return BPromise[_0x28f6('0x23')](_0x5f22ce);}return _0x4db1b7[_0x28f6('0x24')]();};}function saveUpdates(_0x398f60,_0x1558f1){return function(_0x4b6cea){if(_0x4b6cea){return _0x4b6cea['update'](_0x398f60)['then'](function(_0x30248b){return _0x30248b;});}return null;};}function removeEntity(_0x2fd0c1,_0x25b9ee){return function(_0x5f679d){if(_0x5f679d){return _0x5f679d['destroy']()[_0x28f6('0x25')](function(){_0x2fd0c1[_0x28f6('0x1a')](0xcc)[_0x28f6('0x1b')]();});}};}function handleEntityNotFound(_0x47e212,_0x37ead9){return function(_0x4ea72d){if(!_0x4ea72d){_0x47e212['sendStatus'](0x194);}return _0x4ea72d;};}function handleError(_0x268de4,_0x13852b){_0x13852b=_0x13852b||0x1f4;return function(_0x2a2da8){logger['error'](_0x2a2da8[_0x28f6('0x26')]);if(_0x2a2da8[_0x28f6('0x27')]){delete _0x2a2da8['name'];}_0x268de4[_0x28f6('0x1a')](_0x13852b)[_0x28f6('0x28')](_0x2a2da8);};}exports[_0x28f6('0x29')]=function(_0x345984,_0x5b6086){var _0x538fbf={},_0x16bbbd={},_0x1c16b8={'count':0x0,'rows':[]};var _0x4f0f52=_[_0x28f6('0x2a')](db[_0x28f6('0x2b')][_0x28f6('0x2c')],function(_0x124f06){return{'name':_0x124f06[_0x28f6('0x2d')],'type':_0x124f06['type'][_0x28f6('0x2e')]};});_0x16bbbd[_0x28f6('0x2f')]=_['map'](_0x4f0f52,_0x28f6('0x27'));_0x16bbbd[_0x28f6('0x30')]=_[_0x28f6('0x31')](_0x345984[_0x28f6('0x30')]);_0x16bbbd['filters']=_[_0x28f6('0x32')](_0x16bbbd[_0x28f6('0x2f')],_0x16bbbd[_0x28f6('0x30')]);_0x538fbf[_0x28f6('0x33')]=_[_0x28f6('0x32')](_0x16bbbd[_0x28f6('0x2f')],qs[_0x28f6('0x34')](_0x345984['query'][_0x28f6('0x34')]));_0x538fbf[_0x28f6('0x33')]=_0x538fbf[_0x28f6('0x33')][_0x28f6('0x35')]?_0x538fbf[_0x28f6('0x33')]:_0x16bbbd[_0x28f6('0x2f')];if(!_0x345984[_0x28f6('0x30')][_0x28f6('0x36')](_0x28f6('0x37'))){_0x538fbf['limit']=qs['limit'](_0x345984['query']['limit']);_0x538fbf['offset']=qs[_0x28f6('0x1d')](_0x345984[_0x28f6('0x30')][_0x28f6('0x1d')]);}_0x538fbf[_0x28f6('0x38')]=qs['sort'](_0x345984[_0x28f6('0x30')]['sort']);_0x538fbf[_0x28f6('0x39')]=qs[_0x28f6('0x3a')](_[_0x28f6('0x3b')](_0x345984['query'],_0x16bbbd[_0x28f6('0x3a')]),_0x4f0f52);if(_0x345984['query'][_0x28f6('0x3c')]){_0x538fbf[_0x28f6('0x39')]=_[_0x28f6('0x3d')](_0x538fbf[_0x28f6('0x39')],{'$or':_[_0x28f6('0x2a')](_0x4f0f52,function(_0x1f792f){if(_0x1f792f['type']!==_0x28f6('0x3e')){var _0x4ebaa2={};_0x4ebaa2[_0x1f792f['name']]={'$like':'%'+_0x345984[_0x28f6('0x30')]['filter']+'%'};return _0x4ebaa2;}})});}_0x538fbf=_['merge']({},_0x538fbf,_0x345984[_0x28f6('0x3f')]);var _0x2738a5={'where':_0x538fbf['where']};return db[_0x28f6('0x2b')][_0x28f6('0x20')](_0x2738a5)[_0x28f6('0x25')](function(_0x22d418){_0x1c16b8[_0x28f6('0x20')]=_0x22d418;if(_0x345984['query'][_0x28f6('0x40')]){_0x538fbf[_0x28f6('0x41')]=[{'all':!![]}];}return db[_0x28f6('0x2b')][_0x28f6('0x42')](_0x538fbf);})[_0x28f6('0x25')](function(_0x1730c4){_0x1c16b8[_0x28f6('0x43')]=_0x1730c4;return _0x1c16b8;})['then'](respondWithFilteredResult(_0x5b6086,_0x538fbf))[_0x28f6('0x44')](handleError(_0x5b6086,null));};exports[_0x28f6('0x45')]=function(_0x48bfed,_0x5cb996){var _0x109ca7={'raw':!![],'where':{'id':_0x48bfed[_0x28f6('0x46')]['id']}},_0x46c01={};_0x46c01['model']=_[_0x28f6('0x31')](db[_0x28f6('0x2b')][_0x28f6('0x2c')]);_0x46c01[_0x28f6('0x30')]=_['keys'](_0x48bfed[_0x28f6('0x30')]);_0x46c01['filters']=_[_0x28f6('0x32')](_0x46c01[_0x28f6('0x2f')],_0x46c01[_0x28f6('0x30')]);_0x109ca7[_0x28f6('0x33')]=_[_0x28f6('0x32')](_0x46c01[_0x28f6('0x2f')],qs[_0x28f6('0x34')](_0x48bfed['query']['fields']));_0x109ca7[_0x28f6('0x33')]=_0x109ca7[_0x28f6('0x33')][_0x28f6('0x35')]?_0x109ca7[_0x28f6('0x33')]:_0x46c01[_0x28f6('0x2f')];if(_0x48bfed[_0x28f6('0x30')][_0x28f6('0x40')]){_0x109ca7[_0x28f6('0x41')]=[{'all':!![]}];}_0x109ca7=_['merge']({},_0x109ca7,_0x48bfed[_0x28f6('0x3f')]);return db['VoiceTransferReport'][_0x28f6('0x47')](_0x109ca7)[_0x28f6('0x25')](handleEntityNotFound(_0x5cb996,null))[_0x28f6('0x25')](respondWithResult(_0x5cb996,null))['catch'](handleError(_0x5cb996,null));};exports[_0x28f6('0x48')]=function(_0x353b5b,_0xb7490a){return db[_0x28f6('0x2b')][_0x28f6('0x48')](_0x353b5b['body'],{})['then'](respondWithResult(_0xb7490a,0xc9))[_0x28f6('0x44')](handleError(_0xb7490a,null));};exports['update']=function(_0x1f9799,_0x210417){if(_0x1f9799[_0x28f6('0x49')]['id']){delete _0x1f9799[_0x28f6('0x49')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x1f9799[_0x28f6('0x46')]['id']}})[_0x28f6('0x25')](handleEntityNotFound(_0x210417,null))['then'](saveUpdates(_0x1f9799[_0x28f6('0x49')],null))[_0x28f6('0x25')](respondWithResult(_0x210417,null))['catch'](handleError(_0x210417,null));};exports[_0x28f6('0x4a')]=function(_0x38143e,_0xf5cca8){return db[_0x28f6('0x2b')]['find']({'where':{'id':_0x38143e[_0x28f6('0x46')]['id']}})[_0x28f6('0x25')](handleEntityNotFound(_0xf5cca8,null))[_0x28f6('0x25')](removeEntity(_0xf5cca8,null))[_0x28f6('0x44')](handleError(_0xf5cca8,null));};exports['describe']=function(_0x56999b,_0x32f12b){return db[_0x28f6('0x2b')][_0x28f6('0x4b')]()['then'](respondWithResult(_0x32f12b,null))[_0x28f6('0x44')](handleError(_0x32f12b,null));}; \ No newline at end of file +var _0xc59d=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceTransferReport','includeAll','include','findAll','rows','rawAttributes','catch','create','body','params','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','error','name','send','index','map','fieldName'];(function(_0xb106c7,_0x1e0c90){var _0x24a91e=function(_0x3805b6){while(--_0x3805b6){_0xb106c7['push'](_0xb106c7['shift']());}};_0x24a91e(++_0x1e0c90);}(_0xc59d,0x113));var _0xdc59=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xc59d[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xdc59('0x0'));var rimraf=require(_0xdc59('0x1'));var zipdir=require(_0xdc59('0x2'));var jsonpatch=require(_0xdc59('0x3'));var rp=require(_0xdc59('0x4'));var moment=require(_0xdc59('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdc59('0x6'));var util=require(_0xdc59('0x7'));var path=require(_0xdc59('0x8'));var sox=require('sox');var csv=require(_0xdc59('0x9'));var ejs=require(_0xdc59('0xa'));var fs=require('fs');var fs_extra=require(_0xdc59('0xb'));var _=require(_0xdc59('0xc'));var squel=require(_0xdc59('0xd'));var crypto=require(_0xdc59('0xe'));var jsforce=require(_0xdc59('0xf'));var deskjs=require(_0xdc59('0x10'));var toCsv=require('to-csv');var querystring=require(_0xdc59('0x11'));var Papa=require(_0xdc59('0x12'));var Redis=require(_0xdc59('0x13'));var authService=require(_0xdc59('0x14'));var qs=require(_0xdc59('0x15'));var as=require(_0xdc59('0x16'));var hardwareService=require(_0xdc59('0x17'));var logger=require(_0xdc59('0x18'))(_0xdc59('0x19'));var utils=require('../../config/utils');var config=require(_0xdc59('0x1a'));var licenseUtil=require(_0xdc59('0x1b'));var db=require(_0xdc59('0x1c'))['db'];function respondWithStatusCode(_0xae0da9,_0x503207){_0x503207=_0x503207||0xcc;return function(_0x5f2918){if(_0x5f2918){return _0xae0da9['sendStatus'](_0x503207);}return _0xae0da9[_0xdc59('0x1d')](_0x503207)[_0xdc59('0x1e')]();};}function respondWithResult(_0x6f112e,_0x2a976e){_0x2a976e=_0x2a976e||0xc8;return function(_0x3427b3){if(_0x3427b3){return _0x6f112e[_0xdc59('0x1d')](_0x2a976e)[_0xdc59('0x1f')](_0x3427b3);}};}function respondWithFilteredResult(_0x555678,_0x1f9543){return function(_0x617d62){if(_0x617d62){var _0x31cf66=typeof _0x1f9543[_0xdc59('0x20')]==='undefined'&&typeof _0x1f9543[_0xdc59('0x21')]===_0xdc59('0x22');var _0x200d02=_0x617d62[_0xdc59('0x23')];var _0x232666=_0x31cf66?0x0:_0x1f9543['offset'];var _0x1a6ba9=_0x31cf66?_0x617d62[_0xdc59('0x23')]:_0x1f9543[_0xdc59('0x20')]+_0x1f9543[_0xdc59('0x21')];var _0x3d8ec6;if(_0x1a6ba9>=_0x200d02){_0x1a6ba9=_0x200d02;_0x3d8ec6=0xc8;}else{_0x3d8ec6=0xce;}_0x555678['status'](_0x3d8ec6);return _0x555678[_0xdc59('0x24')](_0xdc59('0x25'),_0x232666+'-'+_0x1a6ba9+'/'+_0x200d02)[_0xdc59('0x1f')](_0x617d62);}return null;};}function patchUpdates(_0x2ceb9d){return function(_0x416503){try{jsonpatch[_0xdc59('0x26')](_0x416503,_0x2ceb9d,!![]);}catch(_0x1aee7d){return BPromise['reject'](_0x1aee7d);}return _0x416503[_0xdc59('0x27')]();};}function saveUpdates(_0x42c366,_0x26a64e){return function(_0x552986){if(_0x552986){return _0x552986[_0xdc59('0x28')](_0x42c366)['then'](function(_0x5f2114){return _0x5f2114;});}return null;};}function removeEntity(_0x407bde,_0x2cfb7a){return function(_0x22d762){if(_0x22d762){return _0x22d762[_0xdc59('0x29')]()[_0xdc59('0x2a')](function(){_0x407bde['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ed7,_0x46c779){return function(_0x18c427){if(!_0x18c427){_0x3ed7['sendStatus'](0x194);}return _0x18c427;};}function handleError(_0x4f6fb9,_0x203596){_0x203596=_0x203596||0x1f4;return function(_0x47d8bd){logger[_0xdc59('0x2b')](_0x47d8bd['stack']);if(_0x47d8bd[_0xdc59('0x2c')]){delete _0x47d8bd['name'];}_0x4f6fb9[_0xdc59('0x1d')](_0x203596)[_0xdc59('0x2d')](_0x47d8bd);};}exports[_0xdc59('0x2e')]=function(_0x2dedfe,_0x3dece5){var _0x2af3f6={},_0x45f25b={},_0xbc61cc={'count':0x0,'rows':[]};var _0x23e303=_[_0xdc59('0x2f')](db['VoiceTransferReport']['rawAttributes'],function(_0x2aa64d){return{'name':_0x2aa64d[_0xdc59('0x30')],'type':_0x2aa64d[_0xdc59('0x31')][_0xdc59('0x32')]};});_0x45f25b[_0xdc59('0x33')]=_[_0xdc59('0x2f')](_0x23e303,_0xdc59('0x2c'));_0x45f25b[_0xdc59('0x34')]=_[_0xdc59('0x35')](_0x2dedfe['query']);_0x45f25b[_0xdc59('0x36')]=_[_0xdc59('0x37')](_0x45f25b[_0xdc59('0x33')],_0x45f25b[_0xdc59('0x34')]);_0x2af3f6[_0xdc59('0x38')]=_[_0xdc59('0x37')](_0x45f25b[_0xdc59('0x33')],qs['fields'](_0x2dedfe['query'][_0xdc59('0x39')]));_0x2af3f6[_0xdc59('0x38')]=_0x2af3f6[_0xdc59('0x38')][_0xdc59('0x3a')]?_0x2af3f6[_0xdc59('0x38')]:_0x45f25b['model'];if(!_0x2dedfe[_0xdc59('0x34')][_0xdc59('0x3b')](_0xdc59('0x3c'))){_0x2af3f6[_0xdc59('0x21')]=qs['limit'](_0x2dedfe[_0xdc59('0x34')][_0xdc59('0x21')]);_0x2af3f6[_0xdc59('0x20')]=qs['offset'](_0x2dedfe['query']['offset']);}_0x2af3f6[_0xdc59('0x3d')]=qs[_0xdc59('0x3e')](_0x2dedfe['query'][_0xdc59('0x3e')]);_0x2af3f6[_0xdc59('0x3f')]=qs[_0xdc59('0x36')](_[_0xdc59('0x40')](_0x2dedfe[_0xdc59('0x34')],_0x45f25b[_0xdc59('0x36')]),_0x23e303);if(_0x2dedfe[_0xdc59('0x34')]['filter']){_0x2af3f6[_0xdc59('0x3f')]=_[_0xdc59('0x41')](_0x2af3f6[_0xdc59('0x3f')],{'$or':_[_0xdc59('0x2f')](_0x23e303,function(_0x36ba8f){if(_0x36ba8f['type']!==_0xdc59('0x42')){var _0x13adad={};_0x13adad[_0x36ba8f[_0xdc59('0x2c')]]={'$like':'%'+_0x2dedfe['query'][_0xdc59('0x43')]+'%'};return _0x13adad;}})});}_0x2af3f6=_[_0xdc59('0x41')]({},_0x2af3f6,_0x2dedfe[_0xdc59('0x44')]);var _0x1f4fc0={'where':_0x2af3f6[_0xdc59('0x3f')]};return db[_0xdc59('0x45')][_0xdc59('0x23')](_0x1f4fc0)['then'](function(_0x5cda0b){_0xbc61cc['count']=_0x5cda0b;if(_0x2dedfe['query'][_0xdc59('0x46')]){_0x2af3f6[_0xdc59('0x47')]=[{'all':!![]}];}return db[_0xdc59('0x45')][_0xdc59('0x48')](_0x2af3f6);})['then'](function(_0x2da323){_0xbc61cc[_0xdc59('0x49')]=_0x2da323;return _0xbc61cc;})[_0xdc59('0x2a')](respondWithFilteredResult(_0x3dece5,_0x2af3f6))['catch'](handleError(_0x3dece5,null));};exports['show']=function(_0x5df9db,_0x5b4ef3){var _0x2ee0bc={'raw':!![],'where':{'id':_0x5df9db['params']['id']}},_0x2ff08a={};_0x2ff08a[_0xdc59('0x33')]=_[_0xdc59('0x35')](db[_0xdc59('0x45')][_0xdc59('0x4a')]);_0x2ff08a[_0xdc59('0x34')]=_[_0xdc59('0x35')](_0x5df9db[_0xdc59('0x34')]);_0x2ff08a[_0xdc59('0x36')]=_[_0xdc59('0x37')](_0x2ff08a[_0xdc59('0x33')],_0x2ff08a['query']);_0x2ee0bc[_0xdc59('0x38')]=_['intersection'](_0x2ff08a[_0xdc59('0x33')],qs['fields'](_0x5df9db[_0xdc59('0x34')][_0xdc59('0x39')]));_0x2ee0bc[_0xdc59('0x38')]=_0x2ee0bc[_0xdc59('0x38')][_0xdc59('0x3a')]?_0x2ee0bc[_0xdc59('0x38')]:_0x2ff08a[_0xdc59('0x33')];if(_0x5df9db[_0xdc59('0x34')][_0xdc59('0x46')]){_0x2ee0bc[_0xdc59('0x47')]=[{'all':!![]}];}_0x2ee0bc=_[_0xdc59('0x41')]({},_0x2ee0bc,_0x5df9db['options']);return db[_0xdc59('0x45')]['find'](_0x2ee0bc)[_0xdc59('0x2a')](handleEntityNotFound(_0x5b4ef3,null))[_0xdc59('0x2a')](respondWithResult(_0x5b4ef3,null))[_0xdc59('0x4b')](handleError(_0x5b4ef3,null));};exports[_0xdc59('0x4c')]=function(_0x1517e3,_0x28e21b){return db['VoiceTransferReport']['create'](_0x1517e3[_0xdc59('0x4d')],{})[_0xdc59('0x2a')](respondWithResult(_0x28e21b,0xc9))[_0xdc59('0x4b')](handleError(_0x28e21b,null));};exports[_0xdc59('0x28')]=function(_0x188c9a,_0x33133e){if(_0x188c9a[_0xdc59('0x4d')]['id']){delete _0x188c9a[_0xdc59('0x4d')]['id'];}return db[_0xdc59('0x45')]['find']({'where':{'id':_0x188c9a[_0xdc59('0x4e')]['id']}})[_0xdc59('0x2a')](handleEntityNotFound(_0x33133e,null))['then'](saveUpdates(_0x188c9a[_0xdc59('0x4d')],null))[_0xdc59('0x2a')](respondWithResult(_0x33133e,null))[_0xdc59('0x4b')](handleError(_0x33133e,null));};exports[_0xdc59('0x29')]=function(_0x40ca2c,_0x584526){return db[_0xdc59('0x45')][_0xdc59('0x4f')]({'where':{'id':_0x40ca2c[_0xdc59('0x4e')]['id']}})[_0xdc59('0x2a')](handleEntityNotFound(_0x584526,null))['then'](removeEntity(_0x584526,null))[_0xdc59('0x4b')](handleError(_0x584526,null));};exports['describe']=function(_0x5f21d1,_0x487cf1){return db[_0xdc59('0x45')][_0xdc59('0x50')]()[_0xdc59('0x2a')](respondWithResult(_0x487cf1,null))[_0xdc59('0x4b')](handleError(_0x487cf1,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 5374fa4..0ed57b2 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 _0xfc75=['./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x18a213,_0x3ebdf0){var _0x312c3f=function(_0x5d184b){while(--_0x5d184b){_0x18a213['push'](_0x18a213['shift']());}};_0x312c3f(++_0x3ebdf0);}(_0xfc75,0x1ef));var _0x5fc7=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfc75[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x5fc7('0x0'));var util=require(_0x5fc7('0x1'));var logger=require(_0x5fc7('0x2'))(_0x5fc7('0x3'));var moment=require(_0x5fc7('0x4'));var BPromise=require('bluebird');var rp=require(_0x5fc7('0x5'));var fs=require('fs');var path=require(_0x5fc7('0x6'));var rimraf=require(_0x5fc7('0x7'));var config=require(_0x5fc7('0x8'));var attributes=require(_0x5fc7('0x9'));module[_0x5fc7('0xa')]=function(_0x1b3a18,_0x34099c){return _0x1b3a18[_0x5fc7('0xb')](_0x5fc7('0xc'),attributes,{'tableName':_0x5fc7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe302=['define','VoiceTransferReport','lodash','util','../../config/logger','api','moment','path','../../config/environment'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0xe302,0x16a));var _0x2e30=function(_0x25eb27,_0x189c7b){_0x25eb27=_0x25eb27-0x0;var _0x235830=_0xe302[_0x25eb27];return _0x235830;};'use strict';var _=require(_0x2e30('0x0'));var util=require(_0x2e30('0x1'));var logger=require(_0x2e30('0x2'))(_0x2e30('0x3'));var moment=require(_0x2e30('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e30('0x5'));var rimraf=require('rimraf');var config=require(_0x2e30('0x6'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x1a3b77,_0x208fe2){return _0x1a3b77[_0x2e30('0x7')](_0x2e30('0x8'),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 ae78ab9..49b642e 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 _0x0db7=['create','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceTransferReport'];(function(_0x3442e8,_0x473096){var _0x323578=function(_0x24fc8e){while(--_0x24fc8e){_0x3442e8['push'](_0x3442e8['shift']());}};_0x323578(++_0x473096);}(_0x0db7,0x1c4));var _0x70db=function(_0x173c2b,_0x241c78){_0x173c2b=_0x173c2b-0x0;var _0x237590=_0x0db7[_0x173c2b];return _0x237590;};'use strict';var _=require(_0x70db('0x0'));var util=require(_0x70db('0x1'));var moment=require(_0x70db('0x2'));var BPromise=require(_0x70db('0x3'));var rs=require(_0x70db('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x70db('0x5'))['db'];var utils=require(_0x70db('0x6'));var logger=require('../../config/logger')(_0x70db('0x7'));var config=require(_0x70db('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x70db('0x9')][_0x70db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14b087,_0x5c1360,_0x36e333){return new BPromise(function(_0x2cf36a,_0x55dae1){return client[_0x70db('0xb')](_0x14b087,_0x36e333)[_0x70db('0xc')](function(_0x200f68){logger[_0x70db('0xd')](_0x70db('0xe'),_0x5c1360,_0x70db('0xf'));logger[_0x70db('0x10')](_0x70db('0x11'),_0x5c1360,_0x70db('0xf'),JSON['stringify'](_0x200f68));if(_0x200f68[_0x70db('0x12')]){if(_0x200f68[_0x70db('0x12')][_0x70db('0x13')]===0x1f4){logger[_0x70db('0x12')](_0x70db('0xe'),_0x5c1360,_0x200f68[_0x70db('0x12')][_0x70db('0x14')]);return _0x55dae1(_0x200f68['error'][_0x70db('0x14')]);}logger[_0x70db('0x12')](_0x70db('0xe'),_0x5c1360,_0x200f68['error']['message']);return _0x2cf36a(_0x200f68['error'][_0x70db('0x14')]);}else{logger[_0x70db('0xd')](_0x70db('0xe'),_0x5c1360,_0x70db('0xf'));_0x2cf36a(_0x200f68[_0x70db('0x15')][_0x70db('0x14')]);}})[_0x70db('0x16')](function(_0x4d4893){logger[_0x70db('0x12')](_0x70db('0xe'),_0x5c1360,_0x4d4893);_0x55dae1(_0x4d4893);});});}exports[_0x70db('0x17')]=function(_0x363a59){var _0x204757=this;return new Promise(function(_0x3ec656,_0x23f867){return db['VoiceTransferReport'][_0x70db('0x18')](_0x363a59['body'],{'raw':_0x363a59[_0x70db('0x19')]?_0x363a59[_0x70db('0x19')][_0x70db('0x1a')]===undefined?!![]:![]:!![]})[_0x70db('0xc')](function(_0x5ed8cf){logger[_0x70db('0xd')]('CreateVoiceTransferReport',_0x363a59);logger[_0x70db('0x10')]('CreateVoiceTransferReport',_0x363a59,JSON[_0x70db('0x1b')](_0x5ed8cf));_0x3ec656(_0x5ed8cf);})[_0x70db('0x16')](function(_0x4a7fa5){logger[_0x70db('0x12')](_0x70db('0x17'),_0x4a7fa5[_0x70db('0x14')],_0x363a59);_0x23f867(_0x204757[_0x70db('0x12')](0x1f4,_0x4a7fa5[_0x70db('0x14')]));});});}; \ No newline at end of file +var _0x2da1=['info','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','debug','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2da1,0x133));var _0x12da=function(_0x374f59,_0x5c2098){_0x374f59=_0x374f59-0x0;var _0x408ead=_0x2da1[_0x374f59];return _0x408ead;};'use strict';var _=require(_0x12da('0x0'));var util=require(_0x12da('0x1'));var moment=require(_0x12da('0x2'));var BPromise=require(_0x12da('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x12da('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x12da('0x5'))(_0x12da('0x6'));var config=require(_0x12da('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x12da('0x8')][_0x12da('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x149133,_0x2f851c,_0x1a21a3){return new BPromise(function(_0x461b5e,_0x40bd13){return client[_0x12da('0xa')](_0x149133,_0x1a21a3)['then'](function(_0x44e328){logger['info'](_0x12da('0xb'),_0x2f851c,_0x12da('0xc'));logger['debug'](_0x12da('0xd'),_0x2f851c,_0x12da('0xc'),JSON[_0x12da('0xe')](_0x44e328));if(_0x44e328['error']){if(_0x44e328[_0x12da('0xf')]['code']===0x1f4){logger[_0x12da('0xf')](_0x12da('0xb'),_0x2f851c,_0x44e328[_0x12da('0xf')][_0x12da('0x10')]);return _0x40bd13(_0x44e328[_0x12da('0xf')][_0x12da('0x10')]);}logger['error'](_0x12da('0xb'),_0x2f851c,_0x44e328['error']['message']);return _0x461b5e(_0x44e328[_0x12da('0xf')][_0x12da('0x10')]);}else{logger[_0x12da('0x11')](_0x12da('0xb'),_0x2f851c,'request\x20sent');_0x461b5e(_0x44e328['result'][_0x12da('0x10')]);}})[_0x12da('0x12')](function(_0x1599c2){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x2f851c,_0x1599c2);_0x40bd13(_0x1599c2);});});}exports[_0x12da('0x13')]=function(_0x22f4dc){var _0x326e1e=this;return new Promise(function(_0x194e22,_0x48929e){return db[_0x12da('0x14')][_0x12da('0x15')](_0x22f4dc[_0x12da('0x16')],{'raw':_0x22f4dc[_0x12da('0x17')]?_0x22f4dc['options'][_0x12da('0x18')]===undefined?!![]:![]:!![]})[_0x12da('0x19')](function(_0x261875){logger[_0x12da('0x11')](_0x12da('0x13'),_0x22f4dc);logger[_0x12da('0x1a')](_0x12da('0x13'),_0x22f4dc,JSON[_0x12da('0xe')](_0x261875));_0x194e22(_0x261875);})[_0x12da('0x12')](function(_0x298ff4){logger[_0x12da('0xf')](_0x12da('0x13'),_0x298ff4[_0x12da('0x10')],_0x22f4dc);_0x48929e(_0x326e1e['error'](0x1f4,_0x298ff4[_0x12da('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index a94c1bc..1bcbbfe 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 _0x9bde=['Router','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','transfer'];(function(_0xa9dd3e,_0x218069){var _0x4f03a1=function(_0x3427d7){while(--_0x3427d7){_0xa9dd3e['push'](_0xa9dd3e['shift']());}};_0x4f03a1(++_0x218069);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4f9295,_0x240581){_0x4f9295=_0x4f9295-0x0;var _0x333f0b=_0x9bde[_0x4f9295];return _0x333f0b;};'use strict';var express=require('express');var router=express[_0xe9bd('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xe9bd('0x1'));router['post'](_0xe9bd('0x2'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0x5')]);router[_0xe9bd('0x6')](_0xe9bd('0x7'),auth[_0xe9bd('0x3')](),auth['isWebrtcLicence'](),controller[_0xe9bd('0x8')]);router[_0xe9bd('0x6')](_0xe9bd('0x9'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xa')]);router[_0xe9bd('0x6')](_0xe9bd('0xb'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['hold']);router['post'](_0xe9bd('0xc'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['unhold']);router[_0xe9bd('0x6')](_0xe9bd('0xd'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['calls']);router[_0xe9bd('0x6')]('/transfer',auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xe')]);module['exports']=router; \ No newline at end of file +var _0x9f62=['/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','hold','/calls','/transfer','transfer','exports','Router','./webbar.controller','post','/originate','originate'];(function(_0x1165f5,_0x200f89){var _0x455f85=function(_0x4a22c9){while(--_0x4a22c9){_0x1165f5['push'](_0x1165f5['shift']());}};_0x455f85(++_0x200f89);}(_0x9f62,0x154));var _0x29f6=function(_0x8613f6,_0xb72dc2){_0x8613f6=_0x8613f6-0x0;var _0x22acc1=_0x9f62[_0x8613f6];return _0x22acc1;};'use strict';var express=require('express');var router=express[_0x29f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x29f6('0x1'));router[_0x29f6('0x2')](_0x29f6('0x3'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x29f6('0x4')]);router[_0x29f6('0x2')](_0x29f6('0x5'),auth[_0x29f6('0x6')](),auth['isWebrtcLicence'](),controller[_0x29f6('0x7')]);router[_0x29f6('0x2')](_0x29f6('0x8'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['answer']);router['post']('/hold',auth['isAuthenticated'](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xa')]);router['post']('/unhold',auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['unhold']);router[_0x29f6('0x2')](_0x29f6('0xb'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['calls']);router['post'](_0x29f6('0xc'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xd')]);module[_0x29f6('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 10d772f..32480e7 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 _0xeb89=['unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','info','stringify','error','stack','name','status','send','NotFound','request','then','code','message','User','agent','VoiceChannels','all','filter','rows','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','length','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','sessionId','entityFound:','webbar:hangup','catch','answer','hold','webbar:hold','hold\x20executed!','unhold'];(function(_0x4e2173,_0xc41264){var _0x373f74=function(_0x505fc2){while(--_0x505fc2){_0x4e2173['push'](_0x4e2173['shift']());}};_0x373f74(++_0xc41264);}(_0xeb89,0x9a));var _0x9eb8=function(_0x1130b6,_0xb58cb8){_0x1130b6=_0x1130b6-0x0;var _0x1da4ff=_0xeb89[_0x1130b6];return _0x1da4ff;};'use strict';var path=require(_0x9eb8('0x0'));var fs=require('fs');var _=require(_0x9eb8('0x1'));var db=require(_0x9eb8('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x9eb8('0x3'));var jayson=require(_0x9eb8('0x4'));var amiClient=jayson[_0x9eb8('0x5')][_0x9eb8('0x6')]({'port':0x232a});var logger=require(_0x9eb8('0x7'))(_0x9eb8('0x8'));var Redis=require(_0x9eb8('0x9'));config[_0x9eb8('0xa')]=_[_0x9eb8('0xb')](config[_0x9eb8('0xa')],{'host':_0x9eb8('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9eb8('0xa')]));var Schema=require(_0x9eb8('0xd'));var originateValidation=new Schema({'userId':{'type':_0x9eb8('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x9eb8('0xf'),'required':[!![],_0x9eb8('0x10')]},'callerId':{'type':_0x9eb8('0xf')},'callbackUrl':{'type':_0x9eb8('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x9eb8('0xe'),'required':[!![],_0x9eb8('0x11')]},'sessionId':{'type':_0x9eb8('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x9eb8('0xe'),'required':[!![],_0x9eb8('0x11')]},'sessionId':{'type':_0x9eb8('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9eb8('0x11')]},'sessionId':{'type':_0x9eb8('0xf'),'required':[!![],_0x9eb8('0x12')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x9eb8('0xe'),'required':[!![],_0x9eb8('0x11')]},'sessionId':{'type':_0x9eb8('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9eb8('0x11')]},'sessionId':{'type':_0x9eb8('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x9eb8('0xe'),'required':[!![],_0x9eb8('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0x9eb8('0xe'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x53e11a,_0x29c974,_0x271b7b){logger[_0x9eb8('0x13')](_0x53e11a,_0x29c974,JSON[_0x9eb8('0x14')](_0x271b7b));io['to'](_0x53e11a)['emit'](_0x29c974,_0x271b7b);}function handleError(_0x4718e2){return function(_0x1fd560){console['log']('handleError:',_0x1fd560,_0x1fd560 instanceof RangeError);logger[_0x9eb8('0x15')](_0x1fd560[_0x9eb8('0x16')]);if(_0x1fd560 instanceof RangeError){if(_0x1fd560[_0x9eb8('0x17')]){delete _0x1fd560['name'];}_0x4718e2[_0x9eb8('0x18')](0x194)[_0x9eb8('0x19')](_0x1fd560);}else{if(_0x1fd560[_0x9eb8('0x17')]){delete _0x1fd560[_0x9eb8('0x17')];}_0x4718e2['status'](0x1f4)['send'](_0x1fd560);}};}function checkError(){return function(_0x2b0ce0){if(!_0x2b0ce0){throw new RangeError(_0x9eb8('0x1a'));}return _0x2b0ce0;};}function respondWithRpcPromise(_0x47c823,_0x36836e){return new BPromise(function(_0x554408,_0x267287){var _0x4d22c4=amiClient;return _0x4d22c4[_0x9eb8('0x1b')](_0x47c823,_0x36836e)[_0x9eb8('0x1c')](function(_0x14c956){if(_0x14c956['error']){if(_0x14c956[_0x9eb8('0x15')][_0x9eb8('0x1d')]===0x1f4){return _0x267287(_0x14c956[_0x9eb8('0x15')][_0x9eb8('0x1e')]);}return _0x554408(_0x14c956[_0x9eb8('0x15')][_0x9eb8('0x1e')]);}else{_0x554408(_0x14c956['result']);}})['catch'](function(_0x4d3f55){_0x267287(_0x4d3f55);});});}function getAgent(_0x2ed403){return db[_0x9eb8('0x1f')]['findOne']({'where':{'id':_0x2ed403,'role':_0x9eb8('0x20')}})[_0x9eb8('0x1c')](checkError());}function getAgentCheckSession(_0x2e3435,_0x1b4d2a){return new BPromise(function(_0x379f6f,_0x1f288b){var _0x5aa151=respondWithRpcPromise(_0x9eb8('0x21'));var _0x34a259=getAgent(_0x2e3435);Promise[_0x9eb8('0x22')]([_0x5aa151,_0x34a259])[_0x9eb8('0x1c')](function(_0x140bda){var _0x54b19d=_0x140bda[0x0];var _0x2faf6f=_0x140bda[0x1];var _0x48407f=_[_0x9eb8('0x23')](_0x54b19d[_0x9eb8('0x24')],function(_0x553072){return _0x553072['UserId']==_0x2faf6f['id']&&_0x553072['sessionId']==_0x1b4d2a;});if(_0x48407f['length']==0x1){_0x379f6f(_0x2faf6f);}else{_0x1f288b(new RangeError(_0x9eb8('0x25')+_0x1b4d2a+_0x9eb8('0x26')));}});});}exports['originate']=function(_0x3a5791,_0x5d807f){logger['info'](_0x9eb8('0x27'),_0x3a5791[_0x9eb8('0x28')]);var _0x39cf00=originateValidation['validate'](_0x3a5791['body']);if(_0x39cf00[_0x9eb8('0x29')]>0x0){return _0x5d807f[_0x9eb8('0x18')](0x190)['json'](_0x39cf00);}var _0x32346e=_0x3a5791[_0x9eb8('0x28')][_0x9eb8('0x2a')];var _0x3e02cb=_0x3a5791['body'][_0x9eb8('0x2b')];var _0x21b954=_0x3a5791[_0x9eb8('0x28')][_0x9eb8('0x2c')];var _0x41b956=_0x3a5791[_0x9eb8('0x28')][_0x9eb8('0x2d')];return getAgent(_0x32346e)[_0x9eb8('0x1c')](function(_0x13380b){logger['info']('entityFound:',_0x13380b[_0x9eb8('0x17')]);emit(util[_0x9eb8('0x2e')](_0x9eb8('0x2f'),_0x13380b[_0x9eb8('0x17')]),_0x9eb8('0x30'),{'callNumber':_0x3e02cb,'callerId':_0x21b954,'callbackUrl':_0x41b956});return _0x5d807f['status'](0xc8)[_0x9eb8('0x31')]({'error':![],'message':_0x9eb8('0x32')});})['catch'](handleError(_0x5d807f));};exports[_0x9eb8('0x33')]=function(_0x194773,_0x422a1a){logger[_0x9eb8('0x13')](_0x9eb8('0x34'),_0x194773[_0x9eb8('0x28')]);var _0x31fdd2=hangupValidation[_0x9eb8('0xd')](_0x194773[_0x9eb8('0x28')]);if(_0x31fdd2['length']>0x0){return _0x422a1a['status'](0x190)[_0x9eb8('0x31')](_0x31fdd2);}var _0x1954f2=_0x194773[_0x9eb8('0x28')][_0x9eb8('0x2a')];var _0x45bfbb=_0x194773[_0x9eb8('0x28')][_0x9eb8('0x35')];return getAgent(_0x1954f2)[_0x9eb8('0x1c')](function(_0x6ab280){logger[_0x9eb8('0x13')](_0x9eb8('0x36'),_0x6ab280['name']);emit(util[_0x9eb8('0x2e')](_0x9eb8('0x2f'),_0x6ab280['name']),_0x9eb8('0x37'),{'sessionId':_0x45bfbb});return _0x422a1a['status'](0xc8)[_0x9eb8('0x31')]({'error':![],'message':'hangup\x20executed!'});})[_0x9eb8('0x38')](handleError(_0x422a1a));};exports[_0x9eb8('0x39')]=function(_0x47c8f5,_0x506b9f){logger[_0x9eb8('0x13')]('answer\x20fired:',_0x47c8f5['body']);var _0x2a1115=answerValidation[_0x9eb8('0xd')](_0x47c8f5['body']);if(_0x2a1115[_0x9eb8('0x29')]>0x0){return _0x506b9f[_0x9eb8('0x18')](0x190)[_0x9eb8('0x31')](_0x2a1115);}var _0xca57d1=_0x47c8f5[_0x9eb8('0x28')][_0x9eb8('0x2a')];var _0x454a84=_0x47c8f5[_0x9eb8('0x28')][_0x9eb8('0x35')];return getAgent(_0xca57d1)[_0x9eb8('0x1c')](function(_0x4ad56c){logger['info'](_0x9eb8('0x36'),_0x4ad56c['name']);emit(util[_0x9eb8('0x2e')](_0x9eb8('0x2f'),_0x4ad56c['name']),'webbar:answer',{'sessionId':_0x454a84});return _0x506b9f[_0x9eb8('0x18')](0xc8)[_0x9eb8('0x31')]({'error':![],'message':'answer\x20executed!'});})[_0x9eb8('0x38')](handleError(_0x506b9f));};exports[_0x9eb8('0x3a')]=function(_0x15403c,_0x2a0010){logger[_0x9eb8('0x13')]('hold\x20fired:',_0x15403c[_0x9eb8('0x28')]);var _0xedec79=holdValidation[_0x9eb8('0xd')](_0x15403c['body']);if(_0xedec79[_0x9eb8('0x29')]>0x0){return _0x2a0010[_0x9eb8('0x18')](0x190)['json'](_0xedec79);}var _0x4f7c5a=_0x15403c[_0x9eb8('0x28')]['userId'];var _0x137c5c=_0x15403c[_0x9eb8('0x28')][_0x9eb8('0x35')];return getAgent(_0x4f7c5a)['then'](function(_0x5774ba){logger[_0x9eb8('0x13')](_0x9eb8('0x36'),_0x5774ba[_0x9eb8('0x17')]);emit(util[_0x9eb8('0x2e')](_0x9eb8('0x2f'),_0x5774ba[_0x9eb8('0x17')]),_0x9eb8('0x3b'),{'sessionId':_0x137c5c});return _0x2a0010[_0x9eb8('0x18')](0xc8)[_0x9eb8('0x31')]({'error':![],'message':_0x9eb8('0x3c')});})[_0x9eb8('0x38')](handleError(_0x2a0010));};exports[_0x9eb8('0x3d')]=function(_0x46bd90,_0x5926d9){logger[_0x9eb8('0x13')](_0x9eb8('0x3e'),_0x46bd90['body']);var _0x46f40a=unholdValidation[_0x9eb8('0xd')](_0x46bd90['body']);if(_0x46f40a['length']>0x0){return _0x5926d9[_0x9eb8('0x18')](0x190)[_0x9eb8('0x31')](_0x46f40a);}var _0x24e09a=_0x46bd90[_0x9eb8('0x28')]['userId'];var _0x4c5ed0=_0x46bd90['body'][_0x9eb8('0x35')];return getAgent(_0x24e09a)[_0x9eb8('0x1c')](function(_0x2ccaa4){logger['info'](_0x9eb8('0x36'),_0x2ccaa4['name']);emit(util['format'](_0x9eb8('0x2f'),_0x2ccaa4[_0x9eb8('0x17')]),'webbar:unhold',{'sessionId':_0x4c5ed0});return _0x5926d9['status'](0xc8)[_0x9eb8('0x31')]({'error':![],'message':_0x9eb8('0x3f')});})[_0x9eb8('0x38')](handleError(_0x5926d9));};exports[_0x9eb8('0x40')]=function(_0x558954,_0x145eba){logger[_0x9eb8('0x13')](_0x9eb8('0x41'),_0x145eba[_0x9eb8('0x28')]);var _0x675c48=callsValidation['validate'](_0x558954[_0x9eb8('0x28')]);if(_0x675c48[_0x9eb8('0x29')]>0x0){return _0x145eba[_0x9eb8('0x18')](0x190)[_0x9eb8('0x31')](_0x675c48);}var _0x4a1fbe=_0x558954[_0x9eb8('0x28')][_0x9eb8('0x2a')];var _0x15f1f5=respondWithRpcPromise(_0x9eb8('0x21'));var _0x1a7730=getAgent(_0x4a1fbe);return Promise['all']([_0x15f1f5,_0x1a7730])[_0x9eb8('0x1c')](function(_0x595317){var _0x15ca17=_0x595317[0x0];var _0xabb6cb=_0x595317[0x1];var _0x49911f=_[_0x9eb8('0x23')](_0x15ca17[_0x9eb8('0x24')],function(_0x6b3bdd){return _0x6b3bdd['UserId']==_0xabb6cb['id'];});return _0x145eba['status'](0xc8)['json']({'count':_0x49911f[_0x9eb8('0x29')],'rows':_0x49911f});})[_0x9eb8('0x38')](handleError(_0x145eba));};exports['conference']=function(_0x2c74d8,_0x6e0da0){logger[_0x9eb8('0x13')](_0x9eb8('0x42'),_0x2c74d8['body']);var _0x571af8=conferenceValidation[_0x9eb8('0xd')](_0x2c74d8[_0x9eb8('0x28')]);if(_0x571af8['length']>0x0){return _0x6e0da0['status'](0x190)[_0x9eb8('0x31')](_0x571af8);}var _0x1ed0e2=_0x2c74d8[_0x9eb8('0x28')][_0x9eb8('0x2a')];return getAgent(_0x1ed0e2)[_0x9eb8('0x1c')](function(_0xb7341e){logger[_0x9eb8('0x13')](_0x9eb8('0x36'),_0xb7341e[_0x9eb8('0x17')]);emit(util[_0x9eb8('0x2e')](_0x9eb8('0x2f'),_0xb7341e[_0x9eb8('0x17')]),_0x9eb8('0x43'));return _0x6e0da0[_0x9eb8('0x18')](0xc8)[_0x9eb8('0x31')]({'error':![],'message':_0x9eb8('0x44')});})[_0x9eb8('0x38')](handleError(_0x6e0da0));};exports[_0x9eb8('0x45')]=function(_0x513234,_0x559019){logger[_0x9eb8('0x13')]('transfer\x20fired:',_0x513234['body']);var _0x48a9c8=transferValidation[_0x9eb8('0xd')](_0x513234[_0x9eb8('0x28')]);if(_0x48a9c8[_0x9eb8('0x29')]>0x0){return _0x559019[_0x9eb8('0x18')](0x190)['json'](_0x48a9c8);}var _0x126aac=_0x513234[_0x9eb8('0x28')][_0x9eb8('0x2a')];var _0x1a23f7=_0x513234[_0x9eb8('0x28')][_0x9eb8('0x35')];var _0x449c27=_0x513234[_0x9eb8('0x28')][_0x9eb8('0x46')];return getAgent(_0x126aac)[_0x9eb8('0x1c')](function(_0x31a61b){logger[_0x9eb8('0x13')](_0x9eb8('0x36'),_0x31a61b[_0x9eb8('0x17')]);emit(util[_0x9eb8('0x2e')]('user:%s',_0x31a61b[_0x9eb8('0x17')]),'webbar:transfer',{'sessionId':_0x1a23f7,'transferNumber':_0x449c27});return _0x559019[_0x9eb8('0x18')](0xc8)[_0x9eb8('0x31')]({'error':![],'message':_0x9eb8('0x47')});})[_0x9eb8('0x38')](handleError(_0x559019));}; \ No newline at end of file +var _0x7cb9=['sessionId\x20','originate','info','originate\x20fired:','body','json','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','userId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','sessionId','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','findOne','all','filter','rows','UserId','length'];(function(_0x2b3f0e,_0x4f4cd8){var _0x422115=function(_0xfc4879){while(--_0xfc4879){_0x2b3f0e['push'](_0x2b3f0e['shift']());}};_0x422115(++_0x4f4cd8);}(_0x7cb9,0x160));var _0x97cb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7cb9[_0x122ef9];return _0x42fba0;};'use strict';var path=require(_0x97cb('0x0'));var fs=require('fs');var _=require(_0x97cb('0x1'));var db=require(_0x97cb('0x2'))['db'];var config=require(_0x97cb('0x3'));var util=require(_0x97cb('0x4'));var BPromise=require(_0x97cb('0x5'));var jayson=require(_0x97cb('0x6'));var amiClient=jayson[_0x97cb('0x7')][_0x97cb('0x8')]({'port':0x232a});var logger=require(_0x97cb('0x9'))(_0x97cb('0xa'));var Redis=require(_0x97cb('0xb'));config[_0x97cb('0xc')]=_[_0x97cb('0xd')](config[_0x97cb('0xc')],{'host':_0x97cb('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x97cb('0xc')]));var Schema=require(_0x97cb('0xf'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x97cb('0x10')]},'callNumber':{'type':_0x97cb('0x11'),'required':[!![],_0x97cb('0x12')]},'callerId':{'type':_0x97cb('0x11')},'callbackUrl':{'type':_0x97cb('0x11')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x97cb('0x10')]},'sessionId':{'type':_0x97cb('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x97cb('0x13'),'required':[!![],_0x97cb('0x10')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x97cb('0x13'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x97cb('0x11'),'required':[!![],_0x97cb('0x14')]},'transferNumber':{'type':_0x97cb('0x11'),'required':[!![],_0x97cb('0x15')]}});var holdValidation=new Schema({'userId':{'type':_0x97cb('0x13'),'required':[!![],_0x97cb('0x10')]},'sessionId':{'type':_0x97cb('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x97cb('0x13'),'required':[!![],_0x97cb('0x10')]},'sessionId':{'type':_0x97cb('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x97cb('0x13'),'required':[!![],_0x97cb('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x97cb('0x13'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x44fb4c,_0x14fc5d,_0x56217d){logger['info'](_0x44fb4c,_0x14fc5d,JSON['stringify'](_0x56217d));io['to'](_0x44fb4c)[_0x97cb('0x16')](_0x14fc5d,_0x56217d);}function handleError(_0x12594e){return function(_0x50cd4c){console[_0x97cb('0x17')](_0x97cb('0x18'),_0x50cd4c,_0x50cd4c instanceof RangeError);logger[_0x97cb('0x19')](_0x50cd4c[_0x97cb('0x1a')]);if(_0x50cd4c instanceof RangeError){if(_0x50cd4c[_0x97cb('0x1b')]){delete _0x50cd4c[_0x97cb('0x1b')];}_0x12594e[_0x97cb('0x1c')](0x194)['send'](_0x50cd4c);}else{if(_0x50cd4c['name']){delete _0x50cd4c['name'];}_0x12594e[_0x97cb('0x1c')](0x1f4)[_0x97cb('0x1d')](_0x50cd4c);}};}function checkError(){return function(_0x2e399d){if(!_0x2e399d){throw new RangeError(_0x97cb('0x1e'));}return _0x2e399d;};}function respondWithRpcPromise(_0x1c5d2b,_0x1ecf30){return new BPromise(function(_0x1ad783,_0x41fd0e){var _0x225564=amiClient;return _0x225564[_0x97cb('0x1f')](_0x1c5d2b,_0x1ecf30)[_0x97cb('0x20')](function(_0x40bf55){if(_0x40bf55[_0x97cb('0x19')]){if(_0x40bf55[_0x97cb('0x19')][_0x97cb('0x21')]===0x1f4){return _0x41fd0e(_0x40bf55['error']['message']);}return _0x1ad783(_0x40bf55[_0x97cb('0x19')][_0x97cb('0x22')]);}else{_0x1ad783(_0x40bf55[_0x97cb('0x23')]);}})[_0x97cb('0x24')](function(_0x23fdff){_0x41fd0e(_0x23fdff);});});}function getAgent(_0x1b1335){return db['User'][_0x97cb('0x25')]({'where':{'id':_0x1b1335,'role':'agent'}})[_0x97cb('0x20')](checkError());}function getAgentCheckSession(_0x3dbee5,_0x217329){return new BPromise(function(_0x3a15a6,_0x40c7b3){var _0x3fa65b=respondWithRpcPromise('VoiceChannels');var _0x14c4f8=getAgent(_0x3dbee5);Promise[_0x97cb('0x26')]([_0x3fa65b,_0x14c4f8])[_0x97cb('0x20')](function(_0x35df8f){var _0x1489ff=_0x35df8f[0x0];var _0x48efd0=_0x35df8f[0x1];var _0x206cae=_[_0x97cb('0x27')](_0x1489ff[_0x97cb('0x28')],function(_0x227aa0){return _0x227aa0[_0x97cb('0x29')]==_0x48efd0['id']&&_0x227aa0['sessionId']==_0x217329;});if(_0x206cae[_0x97cb('0x2a')]==0x1){_0x3a15a6(_0x48efd0);}else{_0x40c7b3(new RangeError(_0x97cb('0x2b')+_0x217329+'\x20not\x20found!'));}});});}exports[_0x97cb('0x2c')]=function(_0x218bcd,_0x8bb9ca){logger[_0x97cb('0x2d')](_0x97cb('0x2e'),_0x218bcd[_0x97cb('0x2f')]);var _0x1c3de8=originateValidation['validate'](_0x218bcd[_0x97cb('0x2f')]);if(_0x1c3de8[_0x97cb('0x2a')]>0x0){return _0x8bb9ca[_0x97cb('0x1c')](0x190)[_0x97cb('0x30')](_0x1c3de8);}var _0x62305b=_0x218bcd[_0x97cb('0x2f')]['userId'];var _0x4822a4=_0x218bcd[_0x97cb('0x2f')][_0x97cb('0x31')];var _0x87eb15=_0x218bcd[_0x97cb('0x2f')]['callerId'];var _0x2dcff8=_0x218bcd['body'][_0x97cb('0x32')];return getAgent(_0x62305b)[_0x97cb('0x20')](function(_0x234f45){logger[_0x97cb('0x2d')](_0x97cb('0x33'),_0x234f45[_0x97cb('0x1b')]);emit(util[_0x97cb('0x34')](_0x97cb('0x35'),_0x234f45[_0x97cb('0x1b')]),_0x97cb('0x36'),{'callNumber':_0x4822a4,'callerId':_0x87eb15,'callbackUrl':_0x2dcff8});return _0x8bb9ca[_0x97cb('0x1c')](0xc8)[_0x97cb('0x30')]({'error':![],'message':_0x97cb('0x37')});})[_0x97cb('0x24')](handleError(_0x8bb9ca));};exports[_0x97cb('0x38')]=function(_0x18f377,_0xd514f9){logger[_0x97cb('0x2d')]('hangup\x20fired:',_0x18f377[_0x97cb('0x2f')]);var _0x223d35=hangupValidation[_0x97cb('0xf')](_0x18f377[_0x97cb('0x2f')]);if(_0x223d35[_0x97cb('0x2a')]>0x0){return _0xd514f9[_0x97cb('0x1c')](0x190)[_0x97cb('0x30')](_0x223d35);}var _0x3b1abe=_0x18f377[_0x97cb('0x2f')][_0x97cb('0x39')];var _0x40f753=_0x18f377['body']['sessionId'];return getAgent(_0x3b1abe)[_0x97cb('0x20')](function(_0x1e3b6c){logger[_0x97cb('0x2d')](_0x97cb('0x33'),_0x1e3b6c[_0x97cb('0x1b')]);emit(util[_0x97cb('0x34')]('user:%s',_0x1e3b6c[_0x97cb('0x1b')]),_0x97cb('0x3a'),{'sessionId':_0x40f753});return _0xd514f9[_0x97cb('0x1c')](0xc8)[_0x97cb('0x30')]({'error':![],'message':_0x97cb('0x3b')});})['catch'](handleError(_0xd514f9));};exports[_0x97cb('0x3c')]=function(_0x29c506,_0x579bfb){logger[_0x97cb('0x2d')](_0x97cb('0x3d'),_0x29c506[_0x97cb('0x2f')]);var _0x5a7186=answerValidation[_0x97cb('0xf')](_0x29c506['body']);if(_0x5a7186['length']>0x0){return _0x579bfb[_0x97cb('0x1c')](0x190)[_0x97cb('0x30')](_0x5a7186);}var _0x4bc9e3=_0x29c506['body'][_0x97cb('0x39')];var _0x2d2ccf=_0x29c506[_0x97cb('0x2f')][_0x97cb('0x3e')];return getAgent(_0x4bc9e3)[_0x97cb('0x20')](function(_0x4a686c){logger[_0x97cb('0x2d')](_0x97cb('0x33'),_0x4a686c[_0x97cb('0x1b')]);emit(util['format'](_0x97cb('0x35'),_0x4a686c[_0x97cb('0x1b')]),_0x97cb('0x3f'),{'sessionId':_0x2d2ccf});return _0x579bfb['status'](0xc8)[_0x97cb('0x30')]({'error':![],'message':_0x97cb('0x40')});})[_0x97cb('0x24')](handleError(_0x579bfb));};exports['hold']=function(_0x59ae10,_0x5a1a79){logger['info'](_0x97cb('0x41'),_0x59ae10[_0x97cb('0x2f')]);var _0x257cf0=holdValidation[_0x97cb('0xf')](_0x59ae10[_0x97cb('0x2f')]);if(_0x257cf0[_0x97cb('0x2a')]>0x0){return _0x5a1a79[_0x97cb('0x1c')](0x190)[_0x97cb('0x30')](_0x257cf0);}var _0x1b07ca=_0x59ae10[_0x97cb('0x2f')][_0x97cb('0x39')];var _0x1c37b4=_0x59ae10['body'][_0x97cb('0x3e')];return getAgent(_0x1b07ca)[_0x97cb('0x20')](function(_0x150c73){logger[_0x97cb('0x2d')](_0x97cb('0x33'),_0x150c73[_0x97cb('0x1b')]);emit(util[_0x97cb('0x34')](_0x97cb('0x35'),_0x150c73['name']),_0x97cb('0x42'),{'sessionId':_0x1c37b4});return _0x5a1a79['status'](0xc8)[_0x97cb('0x30')]({'error':![],'message':'hold\x20executed!'});})[_0x97cb('0x24')](handleError(_0x5a1a79));};exports['unhold']=function(_0x295835,_0x36d182){logger[_0x97cb('0x2d')](_0x97cb('0x43'),_0x295835['body']);var _0x31be69=unholdValidation[_0x97cb('0xf')](_0x295835[_0x97cb('0x2f')]);if(_0x31be69[_0x97cb('0x2a')]>0x0){return _0x36d182['status'](0x190)[_0x97cb('0x30')](_0x31be69);}var _0x43c9b2=_0x295835[_0x97cb('0x2f')][_0x97cb('0x39')];var _0x15a722=_0x295835[_0x97cb('0x2f')][_0x97cb('0x3e')];return getAgent(_0x43c9b2)[_0x97cb('0x20')](function(_0x5aeffe){logger['info'](_0x97cb('0x33'),_0x5aeffe[_0x97cb('0x1b')]);emit(util['format']('user:%s',_0x5aeffe[_0x97cb('0x1b')]),_0x97cb('0x44'),{'sessionId':_0x15a722});return _0x36d182[_0x97cb('0x1c')](0xc8)['json']({'error':![],'message':_0x97cb('0x45')});})[_0x97cb('0x24')](handleError(_0x36d182));};exports[_0x97cb('0x46')]=function(_0x355796,_0x3285e8){logger[_0x97cb('0x2d')](_0x97cb('0x47'),_0x3285e8[_0x97cb('0x2f')]);var _0x2e2b08=callsValidation[_0x97cb('0xf')](_0x355796[_0x97cb('0x2f')]);if(_0x2e2b08[_0x97cb('0x2a')]>0x0){return _0x3285e8[_0x97cb('0x1c')](0x190)[_0x97cb('0x30')](_0x2e2b08);}var _0x3363f1=_0x355796[_0x97cb('0x2f')][_0x97cb('0x39')];var _0x5d85ec=respondWithRpcPromise(_0x97cb('0x48'));var _0x5a5dd0=getAgent(_0x3363f1);return Promise[_0x97cb('0x26')]([_0x5d85ec,_0x5a5dd0])[_0x97cb('0x20')](function(_0x1fbae7){var _0x2345e8=_0x1fbae7[0x0];var _0x5ce74b=_0x1fbae7[0x1];var _0x32784d=_[_0x97cb('0x27')](_0x2345e8[_0x97cb('0x28')],function(_0xd3dd9d){return _0xd3dd9d[_0x97cb('0x29')]==_0x5ce74b['id'];});return _0x3285e8[_0x97cb('0x1c')](0xc8)[_0x97cb('0x30')]({'count':_0x32784d[_0x97cb('0x2a')],'rows':_0x32784d});})[_0x97cb('0x24')](handleError(_0x3285e8));};exports[_0x97cb('0x49')]=function(_0x28e0ef,_0x244f52){logger[_0x97cb('0x2d')]('conference\x20fired:',_0x28e0ef[_0x97cb('0x2f')]);var _0x1a8bb2=conferenceValidation[_0x97cb('0xf')](_0x28e0ef[_0x97cb('0x2f')]);if(_0x1a8bb2['length']>0x0){return _0x244f52[_0x97cb('0x1c')](0x190)[_0x97cb('0x30')](_0x1a8bb2);}var _0x52ceb2=_0x28e0ef['body'][_0x97cb('0x39')];return getAgent(_0x52ceb2)[_0x97cb('0x20')](function(_0x84ac83){logger['info'](_0x97cb('0x33'),_0x84ac83[_0x97cb('0x1b')]);emit(util[_0x97cb('0x34')](_0x97cb('0x35'),_0x84ac83['name']),'webbar:conference');return _0x244f52[_0x97cb('0x1c')](0xc8)['json']({'error':![],'message':_0x97cb('0x4a')});})[_0x97cb('0x24')](handleError(_0x244f52));};exports[_0x97cb('0x4b')]=function(_0x25b8e1,_0x338c72){logger['info'](_0x97cb('0x4c'),_0x25b8e1[_0x97cb('0x2f')]);var _0x144b91=transferValidation['validate'](_0x25b8e1[_0x97cb('0x2f')]);if(_0x144b91[_0x97cb('0x2a')]>0x0){return _0x338c72[_0x97cb('0x1c')](0x190)[_0x97cb('0x30')](_0x144b91);}var _0x1452dd=_0x25b8e1[_0x97cb('0x2f')][_0x97cb('0x39')];var _0x3a506c=_0x25b8e1[_0x97cb('0x2f')]['sessionId'];var _0x4ed4f8=_0x25b8e1[_0x97cb('0x2f')]['transferNumber'];return getAgent(_0x1452dd)['then'](function(_0x3ebe37){logger['info'](_0x97cb('0x33'),_0x3ebe37[_0x97cb('0x1b')]);emit(util[_0x97cb('0x34')](_0x97cb('0x35'),_0x3ebe37['name']),_0x97cb('0x4d'),{'sessionId':_0x3a506c,'transferNumber':_0x4ed4f8});return _0x338c72[_0x97cb('0x1c')](0xc8)[_0x97cb('0x30')]({'error':![],'message':_0x97cb('0x4e')});})[_0x97cb('0x24')](handleError(_0x338c72));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index ae34787..f5742ca 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 _0xcb9e=['get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','create','addAgents','addApplications','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller'];(function(_0x3531ea,_0x304217){var _0x59e8e2=function(_0x4d1d73){while(--_0x4d1d73){_0x3531ea['push'](_0x3531ea['shift']());}};_0x59e8e2(++_0x304217);}(_0xcb9e,0x1df));var _0xecb9=function(_0x1476ec,_0x3551fa){_0x1476ec=_0x1476ec-0x0;var _0x4b1de0=_0xcb9e[_0x1476ec];return _0x4b1de0;};'use strict';var multer=require(_0xecb9('0x0'));var util=require(_0xecb9('0x1'));var path=require(_0xecb9('0x2'));var timeout=require(_0xecb9('0x3'));var express=require(_0xecb9('0x4'));var router=express[_0xecb9('0x5')]();var fs_extra=require(_0xecb9('0x6'));var auth=require(_0xecb9('0x7'));var interaction=require(_0xecb9('0x8'));var config=require(_0xecb9('0x9'));var controller=require(_0xecb9('0xa'));router[_0xecb9('0xb')]('/',auth[_0xecb9('0xc')](),controller['index']);router['get'](_0xecb9('0xd'),auth['isAuthenticated'](),controller[_0xecb9('0xe')]);router['get'](_0xecb9('0xf'),auth['isAuthenticated'](),controller[_0xecb9('0x10')]);router['get'](_0xecb9('0x11'),auth[_0xecb9('0xc')](),controller['getDispositions']);router['get'](_0xecb9('0x12'),auth[_0xecb9('0xc')](),controller[_0xecb9('0x13')]);router[_0xecb9('0xb')](_0xecb9('0x14'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0xecb9('0x15'),auth[_0xecb9('0xc')](),controller[_0xecb9('0x16')]);router[_0xecb9('0x17')]('/',auth[_0xecb9('0xc')](),controller[_0xecb9('0x18')]);router[_0xecb9('0x17')]('/:id/dispositions',auth[_0xecb9('0xc')](),controller['addDisposition']);router[_0xecb9('0x17')](_0xecb9('0x12'),auth[_0xecb9('0xc')](),controller['addAnswer']);router[_0xecb9('0x17')](_0xecb9('0x14'),auth['isAuthenticated'](),controller[_0xecb9('0x19')]);router['post'](_0xecb9('0x15'),auth[_0xecb9('0xc')](),controller[_0xecb9('0x1a')]);router[_0xecb9('0x17')]('/:id/notify',controller['notify']);router[_0xecb9('0x17')](_0xecb9('0x1b'),auth['isAuthenticated'](),controller[_0xecb9('0x1c')]);router[_0xecb9('0x1d')](_0xecb9('0xf'),auth['isAuthenticated'](),controller[_0xecb9('0x1e')]);router['delete'](_0xecb9('0xf'),auth[_0xecb9('0xc')](),controller['destroy']);router[_0xecb9('0x1f')](_0xecb9('0x11'),auth[_0xecb9('0xc')](),controller[_0xecb9('0x20')]);router[_0xecb9('0x1f')](_0xecb9('0x12'),auth['isAuthenticated'](),controller[_0xecb9('0x21')]);router[_0xecb9('0x1f')](_0xecb9('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xecb9('0x22')]=router; \ No newline at end of file +var _0x50eb=['delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getAnswers','/:id/users','getAgents','/:id/applications','post','addDisposition','/:id/canned_answers','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x50eb,0x135));var _0xb50e=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x50eb[_0xc8a931];return _0x28bd27;};'use strict';var multer=require(_0xb50e('0x0'));var util=require(_0xb50e('0x1'));var path=require(_0xb50e('0x2'));var timeout=require(_0xb50e('0x3'));var express=require('express');var router=express[_0xb50e('0x4')]();var fs_extra=require(_0xb50e('0x5'));var auth=require(_0xb50e('0x6'));var interaction=require(_0xb50e('0x7'));var config=require(_0xb50e('0x8'));var controller=require(_0xb50e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xb50e('0xa')]);router[_0xb50e('0xb')](_0xb50e('0xc'),auth[_0xb50e('0xd')](),controller[_0xb50e('0xe')]);router[_0xb50e('0xb')](_0xb50e('0xf'),auth[_0xb50e('0xd')](),controller[_0xb50e('0x10')]);router['get'](_0xb50e('0x11'),auth[_0xb50e('0xd')](),controller['getDispositions']);router[_0xb50e('0xb')]('/:id/canned_answers',auth[_0xb50e('0xd')](),controller[_0xb50e('0x12')]);router[_0xb50e('0xb')](_0xb50e('0x13'),auth[_0xb50e('0xd')](),controller[_0xb50e('0x14')]);router[_0xb50e('0xb')](_0xb50e('0x15'),auth['isAuthenticated'](),controller['getApplications']);router[_0xb50e('0x16')]('/',auth[_0xb50e('0xd')](),controller['create']);router[_0xb50e('0x16')]('/:id/dispositions',auth[_0xb50e('0xd')](),controller[_0xb50e('0x17')]);router[_0xb50e('0x16')](_0xb50e('0x18'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0xb50e('0x13'),auth[_0xb50e('0xd')](),controller[_0xb50e('0x19')]);router[_0xb50e('0x16')](_0xb50e('0x15'),auth[_0xb50e('0xd')](),controller[_0xb50e('0x1a')]);router[_0xb50e('0x16')](_0xb50e('0x1b'),controller[_0xb50e('0x1c')]);router['post'](_0xb50e('0x1d'),auth[_0xb50e('0xd')](),controller[_0xb50e('0x1e')]);router[_0xb50e('0x1f')]('/:id',auth[_0xb50e('0xd')](),controller[_0xb50e('0x20')]);router[_0xb50e('0x21')]('/:id',auth[_0xb50e('0xd')](),controller[_0xb50e('0x22')]);router['delete'](_0xb50e('0x11'),auth[_0xb50e('0xd')](),controller[_0xb50e('0x23')]);router[_0xb50e('0x21')](_0xb50e('0x18'),auth[_0xb50e('0xd')](),controller['removeAnswers']);router[_0xb50e('0x21')]('/:id/users',auth[_0xb50e('0xd')](),controller[_0xb50e('0x24')]);module[_0xb50e('0x25')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 22911e9..8b7bc91 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 _0xec8f=['sequelize','randomstring','exports','STRING','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','setDataValue','mandatoryDispositionPauseId'];(function(_0x217b7f,_0x33979e){var _0x455009=function(_0xcac767){while(--_0xcac767){_0x217b7f['push'](_0x217b7f['shift']());}};_0x455009(++_0x33979e);}(_0xec8f,0x134));var _0xfec8=function(_0x70a4e2,_0x1b833a){_0x70a4e2=_0x70a4e2-0x0;var _0x4d1d1e=_0xec8f[_0x70a4e2];return _0x4d1d1e;};'use strict';var Sequelize=require(_0xfec8('0x0'));var rs=require(_0xfec8('0x1'));module[_0xfec8('0x2')]={'name':{'type':Sequelize[_0xfec8('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xfec8('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xfec8('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xfec8('0x3')]},'type':{'type':Sequelize[_0xfec8('0x4')](_0xfec8('0x5'),_0xfec8('0x6'))},'accountSid':{'type':Sequelize[_0xfec8('0x3')]},'baseUrl':{'type':Sequelize[_0xfec8('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xfec8('0x7')],'defaultValue':function(){return _0xfec8('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xfec8('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xfec8('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfec8('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfec8('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfec8('0xa')],'comment':_0xfec8('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xfec8('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x543fa8){if(!_0x543fa8){this[_0xfec8('0xc')](_0xfec8('0xd'),null);}this['setDataValue']('mandatoryDisposition',_0x543fa8);}},'description':{'type':Sequelize[_0xfec8('0x3')]}}; \ No newline at end of file +var _0xfead=['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','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio'];(function(_0xe775fd,_0x487a45){var _0x49d8cd=function(_0x36dc30){while(--_0x36dc30){_0xe775fd['push'](_0xe775fd['shift']());}};_0x49d8cd(++_0x487a45);}(_0xfead,0x1d8));var _0xdfea=function(_0x4652a3,_0xe0d58a){_0x4652a3=_0x4652a3-0x0;var _0x433b77=_0xfead[_0x4652a3];return _0x433b77;};'use strict';var Sequelize=require(_0xdfea('0x0'));var rs=require(_0xdfea('0x1'));module[_0xdfea('0x2')]={'name':{'type':Sequelize[_0xdfea('0x3')],'unique':_0xdfea('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xdfea('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xdfea('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xdfea('0x3')],'defaultValue':function(){return rs[_0xdfea('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xdfea('0x6')](_0xdfea('0x7'),'sinch')},'accountSid':{'type':Sequelize[_0xdfea('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xdfea('0x3')]},'notificationTemplate':{'type':Sequelize[_0xdfea('0x8')],'defaultValue':function(){return _0xdfea('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xdfea('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdfea('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xdfea('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdfea('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdfea('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdfea('0xb')],'comment':_0xdfea('0xc')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xdfea('0xd'),'set':function(_0x55865a){if(!_0x55865a){this[_0xdfea('0xe')]('mandatoryDispositionPauseId',null);}this[_0xdfea('0xe')](_0xdfea('0xf'),_0x55865a);}},'description':{'type':Sequelize[_0xdfea('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 75b6def..1b0b9d9 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 _0x76e0=['ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','get','WhatsappAccounts','UserProfileResource','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','type','filter','options','includeAll','include','rows','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','sort','findAll','removeDispositions','ids','addAnswer','CannedAnswer','findOne','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','priority','asc','CmContact','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','From','replace','Body','MessageSid','sinch','from','notifications','messageId','from\x20is\x20mandatory','isNil','Sequelize','ValidationError','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','ListId','DESC','omit','Contacts','contact','interaction','created','push','unmanaged','*,*,*,*','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','waitForTheAssignedQueue','Start','startRouting','entity\x20found','twilio','set','text/xml','send','\x0a','to\x20is\x20mandatory','List','WhatsappInteraction','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x51ac7f,_0x14b422){var _0x3978b4=function(_0x18a6d2){while(--_0x18a6d2){_0x51ac7f['push'](_0x51ac7f['shift']());}};_0x3978b4(++_0x14b422);}(_0x76e0,0x18d));var _0x076e=function(_0x173dec,_0x4e1613){_0x173dec=_0x173dec-0x0;var _0x99b13b=_0x76e0[_0x173dec];return _0x99b13b;};'use strict';var emlformat=require(_0x076e('0x0'));var rimraf=require(_0x076e('0x1'));var zipdir=require(_0x076e('0x2'));var jsonpatch=require(_0x076e('0x3'));var rp=require(_0x076e('0x4'));var moment=require(_0x076e('0x5'));var BPromise=require(_0x076e('0x6'));var Mustache=require('mustache');var util=require(_0x076e('0x7'));var path=require(_0x076e('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x076e('0x9'));var fs=require('fs');var fs_extra=require(_0x076e('0xa'));var _=require(_0x076e('0xb'));var squel=require(_0x076e('0xc'));var crypto=require('crypto');var jsforce=require(_0x076e('0xd'));var deskjs=require(_0x076e('0xe'));var toCsv=require(_0x076e('0xf'));var querystring=require(_0x076e('0x10'));var Papa=require(_0x076e('0x11'));var Redis=require('ioredis');var authService=require(_0x076e('0x12'));var qs=require(_0x076e('0x13'));var as=require(_0x076e('0x14'));var hardwareService=require(_0x076e('0x15'));var logger=require(_0x076e('0x16'))(_0x076e('0x17'));var utils=require('../../config/utils');var config=require(_0x076e('0x18'));var licenseUtil=require(_0x076e('0x19'));var db=require(_0x076e('0x1a'))['db'];config['redis']=_[_0x076e('0x1b')](config[_0x076e('0x1c')],{'host':_0x076e('0x1d'),'port':0x18eb});var socket=require(_0x076e('0x1e'))(new Redis(config[_0x076e('0x1c')]));require('./whatsappAccount.socket')[_0x076e('0x1f')](socket);var jayson=require(_0x076e('0x20'));var client=jayson[_0x076e('0x21')][_0x076e('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x5486cd,_0x212796,_0x488bca,_0x1f41d7){return new BPromise(function(_0x502f94,_0x1b35ee){var _0xd80f67=_0x1f41d7||client;return _0xd80f67[_0x076e('0x23')](_0x5486cd,_0x488bca)[_0x076e('0x24')](function(_0x383199){logger[_0x076e('0x25')](_0x076e('0x26'),_0x212796,'request\x20sent');logger[_0x076e('0x27')](_0x076e('0x28'),_0x212796,_0x076e('0x29'),JSON[_0x076e('0x2a')](_0x383199));if(_0x383199['error']){if(_0x383199['error'][_0x076e('0x2b')]===0x1f4){logger[_0x076e('0x2c')]('WhatsappAccount,\x20%s,\x20%s',_0x212796,_0x383199[_0x076e('0x2c')]['message']);return _0x1b35ee(_0x383199[_0x076e('0x2c')][_0x076e('0x2d')]);}logger['error'](_0x076e('0x26'),_0x212796,_0x383199['error'][_0x076e('0x2d')]);return _0x502f94(_0x383199[_0x076e('0x2c')][_0x076e('0x2d')]);}else{logger[_0x076e('0x25')](_0x076e('0x26'),_0x212796,_0x076e('0x29'));_0x502f94(_0x383199[_0x076e('0x2e')][_0x076e('0x2d')]);}})[_0x076e('0x2f')](function(_0x51a116){logger['error'](_0x076e('0x26'),_0x212796,_0x51a116);_0x1b35ee(_0x51a116);});});}function respondWithStatusCode(_0x3052de,_0x4f373c){_0x4f373c=_0x4f373c||0xcc;return function(_0x5e6d84){if(_0x5e6d84){return _0x3052de[_0x076e('0x30')](_0x4f373c);}return _0x3052de[_0x076e('0x31')](_0x4f373c)[_0x076e('0x32')]();};}function respondWithResult(_0x4ca718,_0x50da4d){_0x50da4d=_0x50da4d||0xc8;return function(_0xacdaa2){if(_0xacdaa2){return _0x4ca718['status'](_0x50da4d)[_0x076e('0x33')](_0xacdaa2);}};}function respondWithFilteredResult(_0x5f312d,_0xa6f927){return function(_0x1a8b12){if(_0x1a8b12){var _0x959a93=typeof _0xa6f927[_0x076e('0x34')]===_0x076e('0x35')&&typeof _0xa6f927[_0x076e('0x36')]===_0x076e('0x35');var _0x3900b8=_0x1a8b12['count'];var _0x448ef5=_0x959a93?0x0:_0xa6f927[_0x076e('0x34')];var _0x10fc97=_0x959a93?_0x1a8b12[_0x076e('0x37')]:_0xa6f927['offset']+_0xa6f927[_0x076e('0x36')];var _0x217026;if(_0x10fc97>=_0x3900b8){_0x10fc97=_0x3900b8;_0x217026=0xc8;}else{_0x217026=0xce;}_0x5f312d['status'](_0x217026);return _0x5f312d['set'](_0x076e('0x38'),_0x448ef5+'-'+_0x10fc97+'/'+_0x3900b8)['json'](_0x1a8b12);}return null;};}function patchUpdates(_0x596d26){return function(_0x580381){try{jsonpatch['apply'](_0x580381,_0x596d26,!![]);}catch(_0x1eae1a){return BPromise[_0x076e('0x39')](_0x1eae1a);}return _0x580381['save']();};}function saveUpdates(_0x1b2f02,_0x4b2497){return function(_0x4f6bc7){if(_0x4f6bc7){return _0x4f6bc7[_0x076e('0x3a')](_0x1b2f02)['then'](function(_0x4b1cb4){return _0x4b1cb4;});}return null;};}function removeEntity(_0x4c4051,_0x11b8e3){return function(_0x136401){if(_0x136401){return _0x136401['destroy']()[_0x076e('0x24')](function(){var _0x652c4b=_0x136401[_0x076e('0x3b')]({'plain':!![]});var _0xe3fb81=_0x076e('0x3c');return db[_0x076e('0x3d')][_0x076e('0x3e')]({'where':{'type':_0xe3fb81,'resourceId':_0x652c4b['id']}})[_0x076e('0x24')](function(){return _0x136401;});})[_0x076e('0x24')](function(){_0x4c4051['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29ddce,_0x291163){return function(_0x480fd5){if(!_0x480fd5){_0x29ddce[_0x076e('0x30')](0x194);}return _0x480fd5;};}function handleError(_0x435e79,_0xe51c0e){_0xe51c0e=_0xe51c0e||0x1f4;return function(_0x5355d8){logger[_0x076e('0x2c')](_0x5355d8[_0x076e('0x3f')]);if(_0x5355d8['name']){delete _0x5355d8[_0x076e('0x40')];}_0x435e79['status'](_0xe51c0e)['send'](_0x5355d8);};}exports[_0x076e('0x41')]=function(_0xfde20,_0x283024){var _0x197013={'include':[{'model':db[_0x076e('0x42')],'as':_0x076e('0x43')}]},_0x2c53d3={},_0x1f3700={'count':0x0,'rows':[]};var _0x267a34=_[_0x076e('0x44')](db[_0x076e('0x45')][_0x076e('0x46')],function(_0x441e53){return{'name':_0x441e53[_0x076e('0x47')],'type':_0x441e53['type']['key']};});_0x2c53d3['model']=_[_0x076e('0x44')](_0x267a34,'name');_0x2c53d3['query']=_[_0x076e('0x48')](_0xfde20[_0x076e('0x49')]);_0x2c53d3[_0x076e('0x4a')]=_[_0x076e('0x4b')](_0x2c53d3[_0x076e('0x4c')],_0x2c53d3['query']);_0x197013[_0x076e('0x4d')]=_[_0x076e('0x4b')](_0x2c53d3['model'],qs['fields'](_0xfde20['query'][_0x076e('0x4e')]));_0x197013[_0x076e('0x4d')]=_0x197013['attributes'][_0x076e('0x4f')]?_0x197013[_0x076e('0x4d')]:_0x2c53d3[_0x076e('0x4c')];if(!_0xfde20[_0x076e('0x49')][_0x076e('0x50')](_0x076e('0x51'))){_0x197013[_0x076e('0x36')]=qs[_0x076e('0x36')](_0xfde20[_0x076e('0x49')][_0x076e('0x36')]);_0x197013['offset']=qs[_0x076e('0x34')](_0xfde20[_0x076e('0x49')][_0x076e('0x34')]);}_0x197013[_0x076e('0x52')]=qs['sort'](_0xfde20['query']['sort']);_0x197013[_0x076e('0x53')]=qs[_0x076e('0x4a')](_[_0x076e('0x54')](_0xfde20[_0x076e('0x49')],_0x2c53d3['filters']),_0x267a34);if(_0xfde20[_0x076e('0x49')]['filter']){_0x197013[_0x076e('0x53')]=_[_0x076e('0x55')](_0x197013[_0x076e('0x53')],{'$or':_['map'](_0x267a34,function(_0x4cdf90){if(_0x4cdf90[_0x076e('0x56')]!=='VIRTUAL'){var _0x2413d0={};_0x2413d0[_0x4cdf90['name']]={'$like':'%'+_0xfde20[_0x076e('0x49')][_0x076e('0x57')]+'%'};return _0x2413d0;}})});}_0x197013=_[_0x076e('0x55')]({},_0x197013,_0xfde20[_0x076e('0x58')]);var _0x1f972d={'where':_0x197013[_0x076e('0x53')]};return db[_0x076e('0x45')][_0x076e('0x37')](_0x1f972d)['then'](function(_0x51bc1e){_0x1f3700[_0x076e('0x37')]=_0x51bc1e;if(_0xfde20['query'][_0x076e('0x59')]){_0x197013[_0x076e('0x5a')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x197013);})[_0x076e('0x24')](function(_0x573b4b){_0x1f3700[_0x076e('0x5b')]=_0x573b4b;return _0x1f3700;})[_0x076e('0x24')](respondWithFilteredResult(_0x283024,_0x197013))[_0x076e('0x2f')](handleError(_0x283024,null));};exports[_0x076e('0x5c')]=function(_0x3509ce,_0x5463ac){var _0x1b3b9c={'raw':![],'where':{'id':_0x3509ce[_0x076e('0x5d')]['id']},'include':[{'model':db[_0x076e('0x42')],'as':_0x076e('0x43')}]},_0x4ac843={};_0x4ac843[_0x076e('0x4c')]=_[_0x076e('0x48')](db[_0x076e('0x45')][_0x076e('0x46')]);_0x4ac843['query']=_[_0x076e('0x48')](_0x3509ce[_0x076e('0x49')]);_0x4ac843[_0x076e('0x4a')]=_[_0x076e('0x4b')](_0x4ac843[_0x076e('0x4c')],_0x4ac843[_0x076e('0x49')]);_0x1b3b9c[_0x076e('0x4d')]=_['intersection'](_0x4ac843[_0x076e('0x4c')],qs[_0x076e('0x4e')](_0x3509ce[_0x076e('0x49')][_0x076e('0x4e')]));_0x1b3b9c[_0x076e('0x4d')]=_0x1b3b9c['attributes'][_0x076e('0x4f')]?_0x1b3b9c[_0x076e('0x4d')]:_0x4ac843[_0x076e('0x4c')];if(_0x3509ce[_0x076e('0x49')][_0x076e('0x59')]){_0x1b3b9c[_0x076e('0x5a')]=[{'all':!![]}];}_0x1b3b9c=_[_0x076e('0x55')]({},_0x1b3b9c,_0x3509ce[_0x076e('0x58')]);return db['WhatsappAccount'][_0x076e('0x5e')](_0x1b3b9c)[_0x076e('0x24')](handleEntityNotFound(_0x5463ac,null))['then'](respondWithResult(_0x5463ac,null))[_0x076e('0x2f')](handleError(_0x5463ac,null));};exports['create']=function(_0x20fcae,_0x4245b6){return db[_0x076e('0x45')][_0x076e('0x5f')](_0x20fcae['body'],{})['then'](function(_0x53b35d){var _0x24148c=_0x20fcae['user'][_0x076e('0x3b')]({'plain':!![]});if(!_0x24148c)throw new Error(_0x076e('0x60'));if(_0x24148c[_0x076e('0x61')]===_0x076e('0x62')){var _0x55fccb=_0x53b35d[_0x076e('0x3b')]({'plain':!![]});var _0x7e8f2=_0x076e('0x3c');return db[_0x076e('0x63')][_0x076e('0x5e')]({'where':{'name':_0x7e8f2,'userProfileId':_0x24148c['userProfileId']},'raw':!![]})[_0x076e('0x24')](function(_0x258bd5){if(_0x258bd5&&_0x258bd5[_0x076e('0x64')]===0x0){return db[_0x076e('0x3d')]['create']({'name':_0x55fccb[_0x076e('0x40')],'resourceId':_0x55fccb['id'],'type':_0x258bd5[_0x076e('0x40')],'sectionId':_0x258bd5['id']},{})['then'](function(){return _0x53b35d;});}else{return _0x53b35d;}})[_0x076e('0x2f')](function(_0x3b9ad0){logger[_0x076e('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b9ad0);throw _0x3b9ad0;});}return _0x53b35d;})[_0x076e('0x24')](respondWithResult(_0x4245b6,0xc9))[_0x076e('0x2f')](handleError(_0x4245b6,null));};exports[_0x076e('0x3a')]=function(_0x2f0456,_0x3f50a9){if(_0x2f0456[_0x076e('0x65')]['id']){delete _0x2f0456[_0x076e('0x65')]['id'];}return db[_0x076e('0x45')]['find']({'where':{'id':_0x2f0456[_0x076e('0x5d')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x076e('0x24')](handleEntityNotFound(_0x3f50a9,null))[_0x076e('0x24')](saveUpdates(_0x2f0456['body'],null))[_0x076e('0x24')](respondWithResult(_0x3f50a9,null))[_0x076e('0x2f')](handleError(_0x3f50a9,null));};exports[_0x076e('0x3e')]=function(_0x34a06f,_0x537ba9){return db[_0x076e('0x45')][_0x076e('0x5e')]({'where':{'id':_0x34a06f[_0x076e('0x5d')]['id']}})[_0x076e('0x24')](handleEntityNotFound(_0x537ba9,null))[_0x076e('0x24')](removeEntity(_0x537ba9,null))['catch'](handleError(_0x537ba9,null));};exports[_0x076e('0x66')]=function(_0x320990,_0x171180){return db[_0x076e('0x45')][_0x076e('0x66')]()[_0x076e('0x24')](respondWithResult(_0x171180,null))[_0x076e('0x2f')](handleError(_0x171180,null));};exports[_0x076e('0x67')]=function(_0x4a12ff,_0x385e29,_0x32458f){if(_0x4a12ff[_0x076e('0x65')]['id']){delete _0x4a12ff['body']['id'];}return db[_0x076e('0x45')][_0x076e('0x5e')]({'where':{'id':_0x4a12ff[_0x076e('0x5d')]['id']}})[_0x076e('0x24')](handleEntityNotFound(_0x385e29,null))[_0x076e('0x24')](function(_0x450582){if(_0x450582){_0x4a12ff[_0x076e('0x65')][_0x076e('0x68')]=_0x450582['id'];return db[_0x076e('0x69')][_0x076e('0x5f')](_0x4a12ff[_0x076e('0x65')]);}})[_0x076e('0x24')](respondWithResult(_0x385e29,null))[_0x076e('0x2f')](handleError(_0x385e29,null));};exports[_0x076e('0x6a')]=function(_0x1ca8c5,_0x1b6297,_0x4f2ed6){var _0x51802f={'raw':![],'where':{}};var _0x2e5435={};var _0x422722={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x1ca8c5[_0x076e('0x5d')]['id']}})[_0x076e('0x24')](handleEntityNotFound(_0x1b6297,null))[_0x076e('0x24')](function(_0x3db3d6){if(_0x3db3d6){_0x2e5435[_0x076e('0x4c')]=_['keys'](db[_0x076e('0x69')][_0x076e('0x46')]);_0x2e5435[_0x076e('0x49')]=_['keys'](_0x1ca8c5[_0x076e('0x49')]);_0x2e5435[_0x076e('0x4a')]=_['intersection'](_0x2e5435[_0x076e('0x4c')],_0x2e5435['query']);_0x51802f[_0x076e('0x4d')]=_['intersection'](_0x2e5435[_0x076e('0x4c')],qs[_0x076e('0x4e')](_0x1ca8c5[_0x076e('0x49')]['fields']));_0x51802f[_0x076e('0x4d')]=_0x51802f[_0x076e('0x4d')]['length']?_0x51802f[_0x076e('0x4d')]:_0x2e5435[_0x076e('0x4c')];if(!_0x1ca8c5[_0x076e('0x49')][_0x076e('0x50')](_0x076e('0x51'))){_0x51802f[_0x076e('0x36')]=qs[_0x076e('0x36')](_0x1ca8c5['query'][_0x076e('0x36')]);_0x51802f['offset']=qs[_0x076e('0x34')](_0x1ca8c5['query'][_0x076e('0x34')]);}_0x51802f[_0x076e('0x52')]=qs[_0x076e('0x6b')](_0x1ca8c5[_0x076e('0x49')][_0x076e('0x6b')]);_0x51802f[_0x076e('0x53')]=qs[_0x076e('0x4a')](_[_0x076e('0x54')](_0x1ca8c5[_0x076e('0x49')],_0x2e5435[_0x076e('0x4a')]));_0x51802f['where'][_0x076e('0x68')]=_0x3db3d6['id'];if(_0x1ca8c5[_0x076e('0x49')][_0x076e('0x57')]){_0x51802f[_0x076e('0x53')]=_[_0x076e('0x55')](_0x51802f[_0x076e('0x53')],{'$or':_[_0x076e('0x44')](_0x51802f['attributes'],function(_0x80d211){var _0xd28106={};_0xd28106[_0x80d211]={'$like':'%'+_0x1ca8c5['query'][_0x076e('0x57')]+'%'};return _0xd28106;})});}_0x51802f=_[_0x076e('0x55')]({},_0x51802f,_0x1ca8c5[_0x076e('0x58')]);return db[_0x076e('0x69')][_0x076e('0x37')]({'where':_0x51802f[_0x076e('0x53')]})[_0x076e('0x24')](function(_0x231785){_0x422722['count']=_0x231785;if(_0x1ca8c5['query'][_0x076e('0x59')]){_0x51802f[_0x076e('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0x076e('0x6c')](_0x51802f);})['then'](function(_0x1dc7ed){_0x422722['rows']=_0x1dc7ed;return _0x422722;});}})[_0x076e('0x24')](respondWithFilteredResult(_0x1b6297,_0x51802f))[_0x076e('0x2f')](handleError(_0x1b6297,null));};exports[_0x076e('0x6d')]=function(_0x4ad007,_0x5f0949,_0x3f52ea){return db[_0x076e('0x45')]['find']({'where':{'id':_0x4ad007[_0x076e('0x5d')]['id']}})[_0x076e('0x24')](handleEntityNotFound(_0x5f0949,null))[_0x076e('0x24')](function(_0x1d18d4){if(_0x1d18d4){return _0x1d18d4['removeDispositions'](_0x4ad007[_0x076e('0x49')][_0x076e('0x6e')]);}})['then'](respondWithStatusCode(_0x5f0949,null))['catch'](handleError(_0x5f0949,null));};exports[_0x076e('0x6f')]=function(_0x5eebb9,_0x42b0d6,_0x4d7611){if(_0x5eebb9['body']['id']){delete _0x5eebb9[_0x076e('0x65')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x5eebb9['params']['id']}})[_0x076e('0x24')](handleEntityNotFound(_0x42b0d6,null))[_0x076e('0x24')](function(_0xda0100){if(_0xda0100){_0x5eebb9[_0x076e('0x65')]['WhatsappAccountId']=_0xda0100['id'];return db[_0x076e('0x70')][_0x076e('0x5f')](_0x5eebb9[_0x076e('0x65')]);}})['then'](respondWithResult(_0x42b0d6,null))[_0x076e('0x2f')](handleError(_0x42b0d6,null));};exports['getAnswers']=function(_0xd0226d,_0x2a2a7a,_0x352414){var _0x351b3a={'raw':![],'where':{}};var _0x2234a8={};var _0xbbd7f7={'count':0x0,'rows':[]};return db[_0x076e('0x45')][_0x076e('0x71')]({'where':{'id':_0xd0226d[_0x076e('0x5d')]['id']}})[_0x076e('0x24')](handleEntityNotFound(_0x2a2a7a,null))['then'](function(_0x399bff){if(_0x399bff){_0x2234a8['model']=_[_0x076e('0x48')](db[_0x076e('0x70')]['rawAttributes']);_0x2234a8[_0x076e('0x49')]=_[_0x076e('0x48')](_0xd0226d[_0x076e('0x49')]);_0x2234a8[_0x076e('0x4a')]=_[_0x076e('0x4b')](_0x2234a8[_0x076e('0x4c')],_0x2234a8[_0x076e('0x49')]);_0x351b3a[_0x076e('0x4d')]=_[_0x076e('0x4b')](_0x2234a8['model'],qs[_0x076e('0x4e')](_0xd0226d[_0x076e('0x49')][_0x076e('0x4e')]));_0x351b3a[_0x076e('0x4d')]=_0x351b3a[_0x076e('0x4d')][_0x076e('0x4f')]?_0x351b3a['attributes']:_0x2234a8[_0x076e('0x4c')];if(!_0xd0226d[_0x076e('0x49')][_0x076e('0x50')](_0x076e('0x51'))){_0x351b3a[_0x076e('0x36')]=qs['limit'](_0xd0226d[_0x076e('0x49')][_0x076e('0x36')]);_0x351b3a['offset']=qs[_0x076e('0x34')](_0xd0226d[_0x076e('0x49')][_0x076e('0x34')]);}_0x351b3a['order']=qs[_0x076e('0x6b')](_0xd0226d[_0x076e('0x49')][_0x076e('0x6b')]);_0x351b3a[_0x076e('0x53')]=qs[_0x076e('0x4a')](_[_0x076e('0x54')](_0xd0226d['query'],_0x2234a8[_0x076e('0x4a')]));_0x351b3a['where'][_0x076e('0x68')]=_0x399bff['id'];if(_0xd0226d['query'][_0x076e('0x57')]){_0x351b3a['where']=_['merge'](_0x351b3a[_0x076e('0x53')],{'$or':_[_0x076e('0x44')](_0x351b3a[_0x076e('0x4d')],function(_0x2ac377){var _0x121053={};_0x121053[_0x2ac377]={'$like':'%'+_0xd0226d[_0x076e('0x49')][_0x076e('0x57')]+'%'};return _0x121053;})});}_0x351b3a=_['merge']({},_0x351b3a,_0xd0226d[_0x076e('0x58')]);return db[_0x076e('0x70')][_0x076e('0x37')]({'where':_0x351b3a[_0x076e('0x53')]})[_0x076e('0x24')](function(_0x4cef29){_0xbbd7f7[_0x076e('0x37')]=_0x4cef29;if(_0xd0226d[_0x076e('0x49')][_0x076e('0x59')]){_0x351b3a[_0x076e('0x5a')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x351b3a);})[_0x076e('0x24')](function(_0x3990c2){_0xbbd7f7[_0x076e('0x5b')]=_0x3990c2;return _0xbbd7f7;});}})[_0x076e('0x24')](respondWithFilteredResult(_0x2a2a7a,_0x351b3a))[_0x076e('0x2f')](handleError(_0x2a2a7a,null));};exports['removeAnswers']=function(_0x33c4e1,_0x2d51f2,_0x119994){return db[_0x076e('0x45')][_0x076e('0x5e')]({'where':{'id':_0x33c4e1[_0x076e('0x5d')]['id']}})[_0x076e('0x24')](handleEntityNotFound(_0x2d51f2,null))['then'](function(_0x40a279){if(_0x40a279){return _0x40a279['removeAnswers'](_0x33c4e1[_0x076e('0x49')][_0x076e('0x6e')]);}})['then'](respondWithStatusCode(_0x2d51f2,null))[_0x076e('0x2f')](handleError(_0x2d51f2,null));};exports['addAgents']=function(_0x15e523,_0xebba32,_0x4c1b96){return db[_0x076e('0x45')][_0x076e('0x5e')]({'where':{'id':_0x15e523['params']['id']}})['then'](handleEntityNotFound(_0xebba32,null))[_0x076e('0x24')](function(_0x361000){if(_0x361000){return _0x361000[_0x076e('0x72')](_0x15e523[_0x076e('0x65')][_0x076e('0x6e')],_['omit'](_0x15e523[_0x076e('0x65')],[_0x076e('0x6e'),'id'])||{})[_0x076e('0x73')](function(_0x12f62b){for(var _0x405e54=0x0;_0x405e54<_0x15e523['body'][_0x076e('0x6e')][_0x076e('0x4f')];_0x405e54+=0x1){socket[_0x076e('0x74')](_0x076e('0x75'),{'UserId':Number(_0x15e523[_0x076e('0x65')][_0x076e('0x6e')][_0x405e54]),'WhatsappAccountId':Number(_0x15e523[_0x076e('0x5d')]['id'])});}return _0x12f62b;});}})[_0x076e('0x24')](respondWithResult(_0xebba32,null))[_0x076e('0x2f')](handleError(_0xebba32,null));};exports[_0x076e('0x76')]=function(_0x288b31,_0x2a88f3,_0x42e121){return db[_0x076e('0x45')]['find']({'where':{'id':_0x288b31[_0x076e('0x5d')]['id']}})[_0x076e('0x24')](handleEntityNotFound(_0x2a88f3,null))[_0x076e('0x24')](function(_0x5dd65d){if(_0x5dd65d){return _0x5dd65d[_0x076e('0x76')](_0x288b31[_0x076e('0x49')]['ids'])['then'](function(){if(_[_0x076e('0x77')](_0x288b31[_0x076e('0x49')][_0x076e('0x6e')])){for(var _0x37b3ae=0x0;_0x37b3ae<_0x288b31['query'][_0x076e('0x6e')][_0x076e('0x4f')];_0x37b3ae+=0x1){socket[_0x076e('0x74')](_0x076e('0x78'),{'UserId':Number(_0x288b31[_0x076e('0x49')]['ids'][_0x37b3ae]),'WhatsappAccountId':Number(_0x288b31['params']['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x288b31[_0x076e('0x49')][_0x076e('0x6e')]),'WhatsappAccountId':Number(_0x288b31[_0x076e('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a88f3,null))[_0x076e('0x2f')](handleError(_0x2a88f3,null));};exports[_0x076e('0x79')]=function(_0x208629,_0x5c5090,_0xcfd21c){var _0xe5a09b={};var _0x426d0={};var _0x42c173;var _0x3d05bd;return db[_0x076e('0x45')][_0x076e('0x71')]({'where':{'id':_0x208629['params']['id']}})[_0x076e('0x24')](handleEntityNotFound(_0x5c5090,null))[_0x076e('0x24')](function(_0xc36c25){if(_0xc36c25){_0x42c173=_0xc36c25;_0x426d0[_0x076e('0x4c')]=_['keys'](db[_0x076e('0x7a')][_0x076e('0x46')]);_0x426d0[_0x076e('0x49')]=_[_0x076e('0x48')](_0x208629[_0x076e('0x49')]);_0x426d0[_0x076e('0x4a')]=_['intersection'](_0x426d0['model'],_0x426d0[_0x076e('0x49')]);_0xe5a09b[_0x076e('0x4d')]=_[_0x076e('0x4b')](_0x426d0['model'],qs[_0x076e('0x4e')](_0x208629[_0x076e('0x49')]['fields']));_0xe5a09b[_0x076e('0x4d')]=_0xe5a09b[_0x076e('0x4d')]['length']?_0xe5a09b[_0x076e('0x4d')]:_0x426d0[_0x076e('0x4c')];_0xe5a09b[_0x076e('0x52')]=qs[_0x076e('0x6b')](_0x208629[_0x076e('0x49')]['sort']);_0xe5a09b[_0x076e('0x53')]=qs[_0x076e('0x4a')](_[_0x076e('0x54')](_0x208629[_0x076e('0x49')],_0x426d0['filters']));if(_0x208629[_0x076e('0x49')]['filter']){_0xe5a09b[_0x076e('0x53')]=_[_0x076e('0x55')](_0xe5a09b[_0x076e('0x53')],{'$or':_[_0x076e('0x44')](_0xe5a09b['attributes'],function(_0x1e9d1f){var _0x26c895={};_0x26c895[_0x1e9d1f]={'$like':'%'+_0x208629[_0x076e('0x49')]['filter']+'%'};return _0x26c895;})});}_0xe5a09b=_['merge']({},_0xe5a09b,_0x208629['options']);return _0x42c173[_0x076e('0x79')](_0xe5a09b);}})[_0x076e('0x24')](function(_0x1634ad){if(_0x1634ad){_0x3d05bd=_0x1634ad[_0x076e('0x4f')];if(!_0x208629[_0x076e('0x49')]['hasOwnProperty'](_0x076e('0x51'))){_0xe5a09b[_0x076e('0x36')]=qs['limit'](_0x208629[_0x076e('0x49')][_0x076e('0x36')]);_0xe5a09b['offset']=qs[_0x076e('0x34')](_0x208629[_0x076e('0x49')][_0x076e('0x34')]);}return _0x42c173[_0x076e('0x79')](_0xe5a09b);}})[_0x076e('0x24')](function(_0x2e39ff){if(_0x2e39ff){return _0x2e39ff?{'count':_0x3d05bd,'rows':_0x2e39ff}:null;}})[_0x076e('0x24')](respondWithResult(_0x5c5090,null))['catch'](handleError(_0x5c5090,null));};exports[_0x076e('0x7b')]=function(_0x4a6e57,_0x1fc29a){var _0x3df5f1=_0x4a6e57[_0x076e('0x5d')]['id'];var _0x194961=_0x4a6e57['body'];var _0x424ddd=0xc8;var _0x22d528=null;return db[_0x076e('0x7c')][_0x076e('0x7d')]({'isolationLevel':db[_0x076e('0x7c')][_0x076e('0x7e')]['ISOLATION_LEVELS'][_0x076e('0x7f')]},function(_0x3fdd92){return db[_0x076e('0x45')][_0x076e('0x71')]({'where':{'id':_0x3df5f1},'transaction':_0x3fdd92})['then'](function(_0x1ee24e){if(_0x1ee24e){return db[_0x076e('0x80')]['destroy']({'where':{'WhatsappAccountId':_0x3df5f1},'transaction':_0x3fdd92})[_0x076e('0x24')](function(){var _0x30cb39=_[_0x076e('0x44')](_0x194961,function(_0x1aa18c){_0x1aa18c['WhatsappAccountId']=_0x3df5f1;return _0x1aa18c;});return db[_0x076e('0x80')][_0x076e('0x81')](_0x30cb39,{'transaction':_0x3fdd92});});}else{_0x424ddd=0x194;_0x22d528=[];}});})[_0x076e('0x24')](function(){if(_0x424ddd!==0x194){return db[_0x076e('0x80')][_0x076e('0x82')]({'where':{'WhatsappAccountId':_0x3df5f1},'order':'priority'})[_0x076e('0x24')](function(_0x387f07){_0x22d528=_0x387f07;});}})[_0x076e('0x2f')](function(_0x3f6ab4){_0x424ddd=0x1f4;logger[_0x076e('0x2c')](_0x3f6ab4[_0x076e('0x3f')]);if(_0x3f6ab4[_0x076e('0x40')]){delete _0x3f6ab4['name'];}_0x22d528=_0x3f6ab4;})[_0x076e('0x83')](function(){if(_0x22d528===null){_0x1fc29a[_0x076e('0x30')](_0x424ddd);}else{if(_0x424ddd===0x1f4){_0x1fc29a[_0x076e('0x31')](_0x424ddd)['send'](_0x22d528);}else{_0x1fc29a[_0x076e('0x31')](_0x424ddd)['json'](_0x22d528);}}});};exports[_0x076e('0x84')]=function(_0x285a40,_0x5abc81,_0x88722f){var _0xc7402c={};var _0x5f02cb={};var _0x32465d;var _0x3a2ab1;return db['WhatsappAccount'][_0x076e('0x71')]({'where':{'id':_0x285a40['params']['id']}})[_0x076e('0x24')](handleEntityNotFound(_0x5abc81,null))['then'](function(_0x4eb0aa){if(_0x4eb0aa){_0x32465d=_0x4eb0aa;_0x5f02cb[_0x076e('0x4c')]=_[_0x076e('0x48')](db[_0x076e('0x80')][_0x076e('0x46')]);_0x5f02cb[_0x076e('0x49')]=_[_0x076e('0x48')](_0x285a40[_0x076e('0x49')]);_0x5f02cb[_0x076e('0x4a')]=_[_0x076e('0x4b')](_0x5f02cb[_0x076e('0x4c')],_0x5f02cb['query']);_0xc7402c[_0x076e('0x4d')]=_[_0x076e('0x4b')](_0x5f02cb[_0x076e('0x4c')],qs['fields'](_0x285a40['query'][_0x076e('0x4e')]));_0xc7402c[_0x076e('0x4d')]=_0xc7402c[_0x076e('0x4d')][_0x076e('0x4f')]?_0xc7402c[_0x076e('0x4d')]:_0x5f02cb[_0x076e('0x4c')];_0xc7402c[_0x076e('0x52')]=qs['sort'](_0x285a40[_0x076e('0x49')][_0x076e('0x6b')]);_0xc7402c[_0x076e('0x53')]=qs[_0x076e('0x4a')](_[_0x076e('0x54')](_0x285a40[_0x076e('0x49')],_0x5f02cb[_0x076e('0x4a')]));if(_0x285a40['query'][_0x076e('0x57')]){_0xc7402c[_0x076e('0x53')]=_[_0x076e('0x55')](_0xc7402c[_0x076e('0x53')],{'$or':_['map'](_0xc7402c[_0x076e('0x4d')],function(_0x48d714){var _0x134eba={};_0x134eba[_0x48d714]={'$like':'%'+_0x285a40['query'][_0x076e('0x57')]+'%'};return _0x134eba;})});}_0xc7402c=_['merge']({},_0xc7402c,_0x285a40[_0x076e('0x58')]);return _0x32465d[_0x076e('0x84')](_0xc7402c);}})['then'](function(_0x41ff31){if(_0x41ff31){_0x3a2ab1=_0x41ff31[_0x076e('0x4f')];if(!_0x285a40['query']['hasOwnProperty']('nolimit')){_0xc7402c[_0x076e('0x36')]=qs[_0x076e('0x36')](_0x285a40['query']['limit']);_0xc7402c[_0x076e('0x34')]=qs['offset'](_0x285a40['query'][_0x076e('0x34')]);}return _0x32465d['getApplications'](_0xc7402c);}})[_0x076e('0x24')](function(_0x7a7b33){if(_0x7a7b33){return _0x7a7b33?{'count':_0x3a2ab1,'rows':_0x7a7b33}:null;}})['then'](respondWithResult(_0x5abc81,null))[_0x076e('0x2f')](handleError(_0x5abc81,null));};exports[_0x076e('0x85')]=function(_0x46bb15,_0x335fc3,_0x1fb1e4){var _0x316600={'channel':_0x076e('0x86')};var _0x17cf40=[];var _0x51067f=[];var _0x2ff789={};return db[_0x076e('0x45')][_0x076e('0x5e')]({'where':{'id':_0x46bb15[_0x076e('0x5d')]['id']},'include':[{'model':db[_0x076e('0x80')],'as':_0x076e('0x87')}]})[_0x076e('0x24')](handleEntityNotFound(_0x335fc3,null))[_0x076e('0x24')](function(_0x525ddf){_0x316600['account']=_0x525ddf;if(_0x316600[_0x076e('0x88')]&&_0x316600[_0x076e('0x88')][_0x076e('0x56')]==='sinch'&&_0x46bb15[_0x076e('0x65')]['statuses']){if(_0x46bb15['body'][_0x076e('0x89')][_0x076e('0x4f')]===0x0)return;if(_0x46bb15[_0x076e('0x65')][_0x076e('0x89')][0x0][_0x076e('0x8a')]!==_0x076e('0x8b'))return;return db[_0x076e('0x8c')][_0x076e('0x3a')]({'read':!![],'readAt':_0x46bb15[_0x076e('0x65')]['statuses'][0x0][_0x076e('0x8d')]},{'where':{'messageId':_0x46bb15[_0x076e('0x65')][_0x076e('0x89')][0x0][_0x076e('0x8e')]},'individualHooks':!![]})['then'](function(_0x5a179d){return _0x335fc3['status'](0xc8)[_0x076e('0x33')](_0x5a179d);});}_0x316600[_0x076e('0x8f')]=_[_0x076e('0x90')](_0x525ddf[_0x076e('0x87')],[_0x076e('0x91')],[_0x076e('0x92')]);if(_0x316600[_0x076e('0x88')][_0x076e('0x87')]){delete _0x316600[_0x076e('0x88')][_0x076e('0x87')];}return db[_0x076e('0x93')][_0x076e('0x66')]()[_0x076e('0x24')](function(_0x225316){if(!_0x225316){throw new db['Sequelize']['ValidationError'](_0x076e('0x94'));}_0x17cf40=_[_0x076e('0x95')](_[_0x076e('0x48')](_0x225316),['createdAt',_0x076e('0x96')]);_0x51067f=_['difference'](_[_0x076e('0x48')](_0x225316),[_0x076e('0x97'),_0x076e('0x96'),_0x076e('0x98'),'ListId']);_0x316600[_0x076e('0x65')]={'mapKey':'mobile'};if(_0x316600['account']&&_0x316600[_0x076e('0x88')][_0x076e('0x56')]==='twilio'){_0x316600['body']['from']=_0x46bb15[_0x076e('0x65')][_0x076e('0x99')][_0x076e('0x9a')]('whatsapp:','');_0x316600[_0x076e('0x65')]['body']=_0x46bb15[_0x076e('0x65')][_0x076e('0x9b')];_0x316600[_0x076e('0x65')]['messageId']=_0x46bb15['body'][_0x076e('0x9c')];}if(_0x316600['account']&&_0x316600[_0x076e('0x88')][_0x076e('0x56')]===_0x076e('0x9d')){_0x316600[_0x076e('0x65')][_0x076e('0x9e')]=_0x46bb15[_0x076e('0x65')][_0x076e('0x9f')][0x0][_0x076e('0x9e')];_0x316600[_0x076e('0x65')]['body']=_0x46bb15[_0x076e('0x65')]['notifications'][0x0][_0x076e('0x2d')][_0x076e('0x65')];_0x316600[_0x076e('0x65')][_0x076e('0xa0')]=_0x46bb15[_0x076e('0x65')][_0x076e('0x9f')][0x0][_0x076e('0x8e')];}if(_0x316600[_0x076e('0x65')]['id']){delete _0x316600[_0x076e('0x65')]['id'];}if(_['isNil'](_0x316600['body'][_0x076e('0x9e')])){throw new db['Sequelize']['ValidationError'](_0x076e('0xa1'));}if(_[_0x076e('0xa2')](_0x316600[_0x076e('0x65')][_0x076e('0x65')])||_0x316600[_0x076e('0x65')][_0x076e('0x65')]===''){throw new db[(_0x076e('0xa3'))][(_0x076e('0xa4'))](_0x076e('0xa5'));}if(_[_0x076e('0xa2')](_0x316600[_0x076e('0x65')][_0x076e('0xa6')])){throw new db[(_0x076e('0xa3'))]['ValidationError'](_0x076e('0xa7')+_0x51067f);}if(!_[_0x076e('0xa8')](_0x51067f,_0x316600[_0x076e('0x65')][_0x076e('0xa6')])){throw new db['Sequelize']['ValidationError'](_0x076e('0xa9')+_0x51067f);}_0x2ff789[_0x316600[_0x076e('0x65')]['mapKey']]=_0x316600[_0x076e('0x65')][_0x076e('0x9e')];return db[_0x076e('0xaa')]['find']({'where':{'id':_0x316600[_0x076e('0x88')][_0x076e('0xab')]},'include':[{'model':db[_0x076e('0x93')],'as':'Contacts','where':_0x2ff789,'limit':0x1,'order':[['updatedAt',_0x076e('0xac')]]}]});})['then'](handleEntityNotFound(_0x335fc3,null))['then'](function(_0x4d4324){if(_0x4d4324){_0x316600['list']=_[_0x076e('0xad')](_0x4d4324,[_0x076e('0xae')]);if(_0x4d4324[_0x076e('0xae')][_0x076e('0x4f')]){return _0x4d4324[_0x076e('0xae')][0x0];}var _0x37b027=_[_0x076e('0x1b')](_0x316600['body'],{'firstName':_0x316600[_0x076e('0x65')][_0x076e('0x9e')],'ListId':_0x4d4324['id']});_0x37b027[_0x316600[_0x076e('0x65')][_0x076e('0xa6')]]=_0x316600[_0x076e('0x65')]['from'];return db[_0x076e('0x93')][_0x076e('0x5f')](_0x37b027,{'fields':_0x17cf40,'raw':!![]});}})[_0x076e('0x24')](handleEntityNotFound(_0x335fc3,null))[_0x076e('0x24')](function(_0x3f8135){if(_0x3f8135){_0x316600[_0x076e('0xaf')]=_0x3f8135;var _0x1bd72f={'ContactId':_0x3f8135['id'],'phone':_0x316600[_0x076e('0x65')][_0x076e('0x9e')],'WhatsappAccountId':_0x46bb15[_0x076e('0x5d')]['id']};var _0x4e735c={'ContactId':_0x3f8135['id'],'WhatsappAccountId':_0x46bb15[_0x076e('0x5d')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x076e('0x5e')]({'where':_0x4e735c})[_0x076e('0x24')](function(_0x3c4982){if(_0x3c4982){return[_0x3c4982,![]];}return db['WhatsappInteraction'][_0x076e('0x5f')](_0x1bd72f)[_0x076e('0x24')](function(_0x5c5b09){return[_0x5c5b09,!![]];});});}})[_0x076e('0x73')](function(_0x14abb2,_0x25e1f5){_0x316600['interaction']=_0x14abb2[_0x076e('0x3b')]({'plain':!![]});_0x316600[_0x076e('0xb0')][_0x076e('0xb1')]=![];if(_0x25e1f5){if(_0x316600[_0x076e('0x88')]['autoclose']){_0x316600['applications'][_0x076e('0xb2')]({'id':0x0,'priority':_0x316600[_0x076e('0x8f')][_0x076e('0x4f')]+0x1,'app':'close','appdata':_0x076e('0xb3'),'interval':_0x076e('0xb4')});}_0x316600[_0x076e('0xb0')][_0x076e('0xb1')]=!![];}return db[_0x076e('0x8c')]['create']({'phone':_0x316600[_0x076e('0x65')][_0x076e('0x9e')],'messageId':_0x316600[_0x076e('0x65')][_0x076e('0xa0')],'body':_0x316600[_0x076e('0x65')]['body'],'WhatsappAccountId':_0x46bb15[_0x076e('0x5d')]['id'],'WhatsappInteractionId':_0x14abb2['id'],'direction':'in','ContactId':_0x14abb2[_0x076e('0xb5')],'AttachmentId':_0x316600[_0x076e('0x65')]['AttachmentId']});})[_0x076e('0x24')](function(_0xca09fc){_0x316600[_0x076e('0x2d')]=_0xca09fc;if(!_0x316600[_0x076e('0xb0')][_0x076e('0xb6')])return;return db[_0x076e('0x7a')]['find']({'attributes':['id',_0x076e('0x40')],'where':{'id':_0x316600[_0x076e('0xb0')]['UserId']}});})[_0x076e('0x24')](function(_0x204188){if(_0x204188){_0x316600[_0x076e('0x8f')][_0x076e('0xb7')]({'id':0x0,'priority':0x0,'app':_0x076e('0xb8'),'appdata':_0x204188[_0x076e('0x40')]+','+(_0x316600[_0x076e('0x88')][_0x076e('0xb9')]||0xa),'interval':_0x076e('0xb4')});}if(!_0x316600[_0x076e('0xb0')][_0x076e('0xba')])return;return db[_0x076e('0xbb')][_0x076e('0x5e')]({'attributes':['id',_0x076e('0x40')],'where':{'id':_0x316600['interaction']['queueId']}});})['then'](function(_0x538711){if(_0x538711){_0x316600[_0x076e('0x8f')][_0x076e('0xb7')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x538711[_0x076e('0x40')]+','+(_0x316600[_0x076e('0x88')][_0x076e('0xbc')]||0x12c),'interval':_0x076e('0xb4')});}return respondWithRpcPromise(_0x076e('0xbd'),_0x076e('0xbe'),_0x316600);})[_0x076e('0x24')](function(_0x571ca3){if(_0x571ca3){var _0xa0a529=0xc8;var _0x3010d2='receiveMessage';logger[_0x076e('0x25')](_0x076e('0x28'),_0x3010d2,_0xa0a529,_0x076e('0xbf'));logger[_0x076e('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3010d2,_0xa0a529,_0x076e('0xbf'),JSON[_0x076e('0x2a')](_0x571ca3));if(_0x316600[_0x076e('0x88')]['type']===_0x076e('0xc0')){return _0x335fc3['status'](_0xa0a529)[_0x076e('0xc1')]('Content-Type',_0x076e('0xc2'))[_0x076e('0xc3')](_0x076e('0xc4'));}else{return _0x335fc3[_0x076e('0x31')](_0xa0a529)[_0x076e('0x33')](_0x571ca3);}}});})[_0x076e('0x2f')](handleError(_0x335fc3,null));};exports['send']=function(_0x23e2eb,_0x54e857,_0xb38835){var _0x3e69bd,_0x231e62,_0x370032;if(_[_0x076e('0xa2')](_0x23e2eb['body'][_0x076e('0x65')])||_0x23e2eb[_0x076e('0x65')][_0x076e('0x65')]===''){throw new db[(_0x076e('0xa3'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x076e('0xa2')](_0x23e2eb[_0x076e('0x65')]['to'])){throw new db[(_0x076e('0xa3'))][(_0x076e('0xa4'))](_0x076e('0xc5'));}_0x3e69bd=_0x23e2eb[_0x076e('0x65')]['to'];return db['WhatsappAccount'][_0x076e('0x5e')]({'where':{'id':_0x23e2eb['params']['id']},'include':[{'model':db['CmList'],'as':_0x076e('0xc6'),'include':[{'model':db[_0x076e('0x93')],'as':_0x076e('0xae'),'where':{'mobile':_0x3e69bd},'limit':0x1,'order':[[_0x076e('0x96'),_0x076e('0xac')]]}]}]})['then'](handleEntityNotFound(_0x54e857,null))[_0x076e('0x24')](function(_0x2b0498){if(_0x2b0498&&_0x2b0498[_0x076e('0xc6')]){_0x231e62=_0x2b0498['get']({'plain':!![]});if(_0x231e62[_0x076e('0xc6')]&&_0x231e62[_0x076e('0xc6')][_0x076e('0xae')][_0x076e('0x4f')]){return _0x231e62[_0x076e('0xc6')][_0x076e('0xae')][0x0];}return db[_0x076e('0x93')]['create'](_[_0x076e('0x1b')](_0x23e2eb[_0x076e('0x65')],{'firstName':_0x3e69bd,'mobile':_0x3e69bd,'phone':_0x3e69bd,'ListId':_0x231e62['ListId']}));}})[_0x076e('0x24')](handleEntityNotFound(_0x54e857,null))[_0x076e('0x24')](function(_0x5746b7){if(_0x5746b7){_0x370032=_0x5746b7;return db[_0x076e('0xc7')][_0x076e('0x5e')]({'where':{'ContactId':_0x370032['id'],'closed':![],'WhatsappAccountId':_0x231e62['id']}})['then'](function(_0x4bd1a2){if(_0x4bd1a2){return[_0x4bd1a2,![]];}return db[_0x076e('0xc7')][_0x076e('0x5f')]({'UserId':_0x23e2eb['user']['id'],'ContactId':_0x370032['id'],'WhatsappAccountId':_0x231e62['id'],'phone':_0x3e69bd,'firstMsgDirection':_0x076e('0xc8'),'Messages':[_[_0x076e('0x55')](_0x23e2eb[_0x076e('0x65')],{'read':![],'body':_0x23e2eb[_0x076e('0x65')][_0x076e('0x65')],'phone':_0x3e69bd,'WhatsappAccountId':_0x231e62['id'],'UserId':_0x23e2eb['user']['id'],'ContactId':_0x370032['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x076e('0xc9')}]})[_0x076e('0x24')](function(_0x1c61f9){return[_0x1c61f9,!![]];});});}})['spread'](function(_0x3bb559,_0x113d8a){if(_0x113d8a){return _0x3bb559;}return db['WhatsappMessage']['create'](_[_0x076e('0x55')](_0x23e2eb[_0x076e('0x65')],{'read':![],'body':_0x23e2eb[_0x076e('0x65')][_0x076e('0x65')],'phone':_0x3e69bd,'WhatsappAccountId':_0x231e62['id'],'WhatsappInteractionId':_0x3bb559['id'],'UserId':_0x23e2eb[_0x076e('0x62')]['id'],'ContactId':_0x370032['id']}))[_0x076e('0x24')](function(_0x40299e){_0x3bb559[_0x076e('0xca')][_0x076e('0xc9')]=[];_0x3bb559[_0x076e('0xca')]['Messages'][_0x076e('0xb2')](_0x40299e[_0x076e('0xca')]);return _0x3bb559;});})[_0x076e('0x24')](respondWithResult(_0x54e857,null))[_0x076e('0x2f')](handleError(_0x54e857,null));}; \ No newline at end of file +var _0xa30f=['../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','get','WhatsappAccounts','UserProfileResource','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','show','params','keys','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','findOne','Disposition','rawAttributes','hasOwnProperty','nolimit','pick','findAll','rows','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','from','From','Body','messageId','MessageSid','notifications','message_id','isNil','Sequelize','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','contact','spread','created','applications','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','interaction','agent','waitForTheAssignedAgent','WhatsappQueue','queueId','unshift','queue','Start','receiveMessage','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','twilio','Content-Type','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','WhatsappInteraction','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment'];(function(_0x2303b6,_0x162e7e){var _0x213946=function(_0x444de4){while(--_0x444de4){_0x2303b6['push'](_0x2303b6['shift']());}};_0x213946(++_0x162e7e);}(_0xa30f,0xb8));var _0xfa30=function(_0xc77aea,_0x535482){_0xc77aea=_0xc77aea-0x0;var _0x1e44b1=_0xa30f[_0xc77aea];return _0x1e44b1;};'use strict';var emlformat=require(_0xfa30('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfa30('0x1'));var jsonpatch=require(_0xfa30('0x2'));var rp=require(_0xfa30('0x3'));var moment=require(_0xfa30('0x4'));var BPromise=require(_0xfa30('0x5'));var Mustache=require(_0xfa30('0x6'));var util=require('util');var path=require(_0xfa30('0x7'));var sox=require('sox');var csv=require(_0xfa30('0x8'));var ejs=require(_0xfa30('0x9'));var fs=require('fs');var fs_extra=require(_0xfa30('0xa'));var _=require(_0xfa30('0xb'));var squel=require(_0xfa30('0xc'));var crypto=require(_0xfa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfa30('0xe'));var toCsv=require(_0xfa30('0x8'));var querystring=require(_0xfa30('0xf'));var Papa=require(_0xfa30('0x10'));var Redis=require('ioredis');var authService=require(_0xfa30('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfa30('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfa30('0x13'));var utils=require(_0xfa30('0x14'));var config=require(_0xfa30('0x15'));var licenseUtil=require(_0xfa30('0x16'));var db=require(_0xfa30('0x17'))['db'];config[_0xfa30('0x18')]=_[_0xfa30('0x19')](config[_0xfa30('0x18')],{'host':_0xfa30('0x1a'),'port':0x18eb});var socket=require(_0xfa30('0x1b'))(new Redis(config['redis']));require(_0xfa30('0x1c'))[_0xfa30('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xfa30('0x1e')][_0xfa30('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x556543,_0x31e89a,_0x44e7ee,_0x4b8bc3){return new BPromise(function(_0x1a616d,_0x5f0e4a){var _0x3f41a7=_0x4b8bc3||client;return _0x3f41a7[_0xfa30('0x20')](_0x556543,_0x44e7ee)[_0xfa30('0x21')](function(_0x303b59){logger['info'](_0xfa30('0x22'),_0x31e89a,_0xfa30('0x23'));logger[_0xfa30('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x31e89a,_0xfa30('0x23'),JSON['stringify'](_0x303b59));if(_0x303b59['error']){if(_0x303b59[_0xfa30('0x25')][_0xfa30('0x26')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x31e89a,_0x303b59[_0xfa30('0x25')]['message']);return _0x5f0e4a(_0x303b59[_0xfa30('0x25')][_0xfa30('0x27')]);}logger[_0xfa30('0x25')](_0xfa30('0x22'),_0x31e89a,_0x303b59[_0xfa30('0x25')][_0xfa30('0x27')]);return _0x1a616d(_0x303b59[_0xfa30('0x25')]['message']);}else{logger['info'](_0xfa30('0x22'),_0x31e89a,_0xfa30('0x23'));_0x1a616d(_0x303b59[_0xfa30('0x28')][_0xfa30('0x27')]);}})[_0xfa30('0x29')](function(_0x328839){logger[_0xfa30('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x31e89a,_0x328839);_0x5f0e4a(_0x328839);});});}function respondWithStatusCode(_0x1f9617,_0x4738f2){_0x4738f2=_0x4738f2||0xcc;return function(_0x278312){if(_0x278312){return _0x1f9617[_0xfa30('0x2a')](_0x4738f2);}return _0x1f9617['status'](_0x4738f2)[_0xfa30('0x2b')]();};}function respondWithResult(_0x1799cb,_0x411436){_0x411436=_0x411436||0xc8;return function(_0x54c462){if(_0x54c462){return _0x1799cb['status'](_0x411436)[_0xfa30('0x2c')](_0x54c462);}};}function respondWithFilteredResult(_0x5ba087,_0x5c6ccd){return function(_0x51fca8){if(_0x51fca8){var _0x106bc2=typeof _0x5c6ccd[_0xfa30('0x2d')]===_0xfa30('0x2e')&&typeof _0x5c6ccd[_0xfa30('0x2f')]===_0xfa30('0x2e');var _0x3baddd=_0x51fca8[_0xfa30('0x30')];var _0x51b15c=_0x106bc2?0x0:_0x5c6ccd[_0xfa30('0x2d')];var _0x618fae=_0x106bc2?_0x51fca8[_0xfa30('0x30')]:_0x5c6ccd[_0xfa30('0x2d')]+_0x5c6ccd[_0xfa30('0x2f')];var _0x2f4ab8;if(_0x618fae>=_0x3baddd){_0x618fae=_0x3baddd;_0x2f4ab8=0xc8;}else{_0x2f4ab8=0xce;}_0x5ba087[_0xfa30('0x31')](_0x2f4ab8);return _0x5ba087[_0xfa30('0x32')](_0xfa30('0x33'),_0x51b15c+'-'+_0x618fae+'/'+_0x3baddd)[_0xfa30('0x2c')](_0x51fca8);}return null;};}function patchUpdates(_0x5bded7){return function(_0x3c7744){try{jsonpatch[_0xfa30('0x34')](_0x3c7744,_0x5bded7,!![]);}catch(_0x1ca185){return BPromise[_0xfa30('0x35')](_0x1ca185);}return _0x3c7744[_0xfa30('0x36')]();};}function saveUpdates(_0x1d5caf,_0x3ebc1c){return function(_0x221c97){if(_0x221c97){return _0x221c97[_0xfa30('0x37')](_0x1d5caf)[_0xfa30('0x21')](function(_0x40f332){return _0x40f332;});}return null;};}function removeEntity(_0x53bf87,_0x11ef56){return function(_0x17efe7){if(_0x17efe7){return _0x17efe7['destroy']()[_0xfa30('0x21')](function(){var _0x319f10=_0x17efe7[_0xfa30('0x38')]({'plain':!![]});var _0x2f0fa9=_0xfa30('0x39');return db[_0xfa30('0x3a')][_0xfa30('0x3b')]({'where':{'type':_0x2f0fa9,'resourceId':_0x319f10['id']}})['then'](function(){return _0x17efe7;});})['then'](function(){_0x53bf87[_0xfa30('0x31')](0xcc)[_0xfa30('0x2b')]();});}};}function handleEntityNotFound(_0x564e2e,_0x82f4f4){return function(_0x1c2eb9){if(!_0x1c2eb9){_0x564e2e[_0xfa30('0x2a')](0x194);}return _0x1c2eb9;};}function handleError(_0x1756d8,_0x37127e){_0x37127e=_0x37127e||0x1f4;return function(_0x5ad6a0){logger[_0xfa30('0x25')](_0x5ad6a0[_0xfa30('0x3c')]);if(_0x5ad6a0[_0xfa30('0x3d')]){delete _0x5ad6a0['name'];}_0x1756d8[_0xfa30('0x31')](_0x37127e)['send'](_0x5ad6a0);};}exports[_0xfa30('0x3e')]=function(_0x5e9b5c,_0x5618e3){var _0x102ceb={'include':[{'model':db[_0xfa30('0x3f')],'as':_0xfa30('0x40')}]},_0x245ce9={},_0x35b9ba={'count':0x0,'rows':[]};var _0x2435aa=_[_0xfa30('0x41')](db[_0xfa30('0x42')]['rawAttributes'],function(_0x4ac724){return{'name':_0x4ac724[_0xfa30('0x43')],'type':_0x4ac724[_0xfa30('0x44')][_0xfa30('0x45')]};});_0x245ce9['model']=_[_0xfa30('0x41')](_0x2435aa,_0xfa30('0x3d'));_0x245ce9[_0xfa30('0x46')]=_['keys'](_0x5e9b5c[_0xfa30('0x46')]);_0x245ce9[_0xfa30('0x47')]=_[_0xfa30('0x48')](_0x245ce9['model'],_0x245ce9[_0xfa30('0x46')]);_0x102ceb[_0xfa30('0x49')]=_['intersection'](_0x245ce9[_0xfa30('0x4a')],qs[_0xfa30('0x4b')](_0x5e9b5c[_0xfa30('0x46')][_0xfa30('0x4b')]));_0x102ceb['attributes']=_0x102ceb[_0xfa30('0x49')][_0xfa30('0x4c')]?_0x102ceb[_0xfa30('0x49')]:_0x245ce9['model'];if(!_0x5e9b5c[_0xfa30('0x46')]['hasOwnProperty']('nolimit')){_0x102ceb[_0xfa30('0x2f')]=qs[_0xfa30('0x2f')](_0x5e9b5c[_0xfa30('0x46')][_0xfa30('0x2f')]);_0x102ceb['offset']=qs[_0xfa30('0x2d')](_0x5e9b5c[_0xfa30('0x46')][_0xfa30('0x2d')]);}_0x102ceb[_0xfa30('0x4d')]=qs['sort'](_0x5e9b5c[_0xfa30('0x46')][_0xfa30('0x4e')]);_0x102ceb[_0xfa30('0x4f')]=qs['filters'](_['pick'](_0x5e9b5c[_0xfa30('0x46')],_0x245ce9[_0xfa30('0x47')]),_0x2435aa);if(_0x5e9b5c[_0xfa30('0x46')][_0xfa30('0x50')]){_0x102ceb[_0xfa30('0x4f')]=_[_0xfa30('0x51')](_0x102ceb[_0xfa30('0x4f')],{'$or':_[_0xfa30('0x41')](_0x2435aa,function(_0x446017){if(_0x446017[_0xfa30('0x44')]!==_0xfa30('0x52')){var _0x3b1c4e={};_0x3b1c4e[_0x446017[_0xfa30('0x3d')]]={'$like':'%'+_0x5e9b5c[_0xfa30('0x46')][_0xfa30('0x50')]+'%'};return _0x3b1c4e;}})});}_0x102ceb=_[_0xfa30('0x51')]({},_0x102ceb,_0x5e9b5c[_0xfa30('0x53')]);var _0xbb1d45={'where':_0x102ceb[_0xfa30('0x4f')]};return db[_0xfa30('0x42')]['count'](_0xbb1d45)[_0xfa30('0x21')](function(_0xc14c88){_0x35b9ba[_0xfa30('0x30')]=_0xc14c88;if(_0x5e9b5c[_0xfa30('0x46')][_0xfa30('0x54')]){_0x102ceb[_0xfa30('0x55')]=[{'all':!![]}];}return db[_0xfa30('0x42')]['findAll'](_0x102ceb);})[_0xfa30('0x21')](function(_0x71dc35){_0x35b9ba['rows']=_0x71dc35;return _0x35b9ba;})[_0xfa30('0x21')](respondWithFilteredResult(_0x5618e3,_0x102ceb))[_0xfa30('0x29')](handleError(_0x5618e3,null));};exports[_0xfa30('0x56')]=function(_0x1f0fe0,_0x5cb792){var _0x43da88={'raw':![],'where':{'id':_0x1f0fe0[_0xfa30('0x57')]['id']},'include':[{'model':db[_0xfa30('0x3f')],'as':_0xfa30('0x40')}]},_0x25cb29={};_0x25cb29['model']=_['keys'](db['WhatsappAccount']['rawAttributes']);_0x25cb29[_0xfa30('0x46')]=_[_0xfa30('0x58')](_0x1f0fe0['query']);_0x25cb29['filters']=_['intersection'](_0x25cb29[_0xfa30('0x4a')],_0x25cb29[_0xfa30('0x46')]);_0x43da88[_0xfa30('0x49')]=_['intersection'](_0x25cb29[_0xfa30('0x4a')],qs[_0xfa30('0x4b')](_0x1f0fe0[_0xfa30('0x46')]['fields']));_0x43da88['attributes']=_0x43da88[_0xfa30('0x49')][_0xfa30('0x4c')]?_0x43da88['attributes']:_0x25cb29[_0xfa30('0x4a')];if(_0x1f0fe0[_0xfa30('0x46')][_0xfa30('0x54')]){_0x43da88['include']=[{'all':!![]}];}_0x43da88=_[_0xfa30('0x51')]({},_0x43da88,_0x1f0fe0[_0xfa30('0x53')]);return db[_0xfa30('0x42')]['find'](_0x43da88)[_0xfa30('0x21')](handleEntityNotFound(_0x5cb792,null))[_0xfa30('0x21')](respondWithResult(_0x5cb792,null))['catch'](handleError(_0x5cb792,null));};exports[_0xfa30('0x59')]=function(_0x28a939,_0x20741d){return db[_0xfa30('0x42')][_0xfa30('0x59')](_0x28a939[_0xfa30('0x5a')],{})[_0xfa30('0x21')](function(_0x3a2781){var _0x3d7a6e=_0x28a939[_0xfa30('0x5b')][_0xfa30('0x38')]({'plain':!![]});if(!_0x3d7a6e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d7a6e[_0xfa30('0x5c')]==='user'){var _0x19aae5=_0x3a2781['get']({'plain':!![]});var _0xc17b6e=_0xfa30('0x39');return db[_0xfa30('0x5d')][_0xfa30('0x5e')]({'where':{'name':_0xc17b6e,'userProfileId':_0x3d7a6e[_0xfa30('0x5f')]},'raw':!![]})[_0xfa30('0x21')](function(_0x1579fe){if(_0x1579fe&&_0x1579fe[_0xfa30('0x60')]===0x0){return db[_0xfa30('0x3a')][_0xfa30('0x59')]({'name':_0x19aae5[_0xfa30('0x3d')],'resourceId':_0x19aae5['id'],'type':_0x1579fe['name'],'sectionId':_0x1579fe['id']},{})[_0xfa30('0x21')](function(){return _0x3a2781;});}else{return _0x3a2781;}})[_0xfa30('0x29')](function(_0xcb1321){logger[_0xfa30('0x25')](_0xfa30('0x61'),_0xcb1321);throw _0xcb1321;});}return _0x3a2781;})[_0xfa30('0x21')](respondWithResult(_0x20741d,0xc9))[_0xfa30('0x29')](handleError(_0x20741d,null));};exports[_0xfa30('0x37')]=function(_0x1e2ae3,_0x46d96b){if(_0x1e2ae3[_0xfa30('0x5a')]['id']){delete _0x1e2ae3[_0xfa30('0x5a')]['id'];}return db[_0xfa30('0x42')][_0xfa30('0x5e')]({'where':{'id':_0x1e2ae3['params']['id']},'include':[{'model':db['Pause'],'as':_0xfa30('0x40')}]})[_0xfa30('0x21')](handleEntityNotFound(_0x46d96b,null))[_0xfa30('0x21')](saveUpdates(_0x1e2ae3['body'],null))['then'](respondWithResult(_0x46d96b,null))[_0xfa30('0x29')](handleError(_0x46d96b,null));};exports[_0xfa30('0x3b')]=function(_0x2d3f21,_0x2acf21){return db[_0xfa30('0x42')][_0xfa30('0x5e')]({'where':{'id':_0x2d3f21[_0xfa30('0x57')]['id']}})[_0xfa30('0x21')](handleEntityNotFound(_0x2acf21,null))[_0xfa30('0x21')](removeEntity(_0x2acf21,null))['catch'](handleError(_0x2acf21,null));};exports['describe']=function(_0x3de75e,_0x25f80f){return db[_0xfa30('0x42')][_0xfa30('0x62')]()[_0xfa30('0x21')](respondWithResult(_0x25f80f,null))['catch'](handleError(_0x25f80f,null));};exports[_0xfa30('0x63')]=function(_0x1d6382,_0x3b10ae,_0x47f29c){if(_0x1d6382[_0xfa30('0x5a')]['id']){delete _0x1d6382[_0xfa30('0x5a')]['id'];}return db[_0xfa30('0x42')][_0xfa30('0x5e')]({'where':{'id':_0x1d6382[_0xfa30('0x57')]['id']}})[_0xfa30('0x21')](handleEntityNotFound(_0x3b10ae,null))['then'](function(_0x3ba81f){if(_0x3ba81f){_0x1d6382[_0xfa30('0x5a')][_0xfa30('0x64')]=_0x3ba81f['id'];return db['Disposition'][_0xfa30('0x59')](_0x1d6382[_0xfa30('0x5a')]);}})[_0xfa30('0x21')](respondWithResult(_0x3b10ae,null))[_0xfa30('0x29')](handleError(_0x3b10ae,null));};exports['getDispositions']=function(_0x22cde2,_0x320314,_0x18ae43){var _0x2a480f={'raw':![],'where':{}};var _0x53c2f6={};var _0x4c4e9b={'count':0x0,'rows':[]};return db[_0xfa30('0x42')][_0xfa30('0x65')]({'where':{'id':_0x22cde2['params']['id']}})['then'](handleEntityNotFound(_0x320314,null))[_0xfa30('0x21')](function(_0x597d1b){if(_0x597d1b){_0x53c2f6[_0xfa30('0x4a')]=_['keys'](db[_0xfa30('0x66')][_0xfa30('0x67')]);_0x53c2f6[_0xfa30('0x46')]=_[_0xfa30('0x58')](_0x22cde2[_0xfa30('0x46')]);_0x53c2f6[_0xfa30('0x47')]=_['intersection'](_0x53c2f6['model'],_0x53c2f6[_0xfa30('0x46')]);_0x2a480f['attributes']=_[_0xfa30('0x48')](_0x53c2f6[_0xfa30('0x4a')],qs['fields'](_0x22cde2[_0xfa30('0x46')][_0xfa30('0x4b')]));_0x2a480f[_0xfa30('0x49')]=_0x2a480f[_0xfa30('0x49')][_0xfa30('0x4c')]?_0x2a480f[_0xfa30('0x49')]:_0x53c2f6['model'];if(!_0x22cde2[_0xfa30('0x46')][_0xfa30('0x68')](_0xfa30('0x69'))){_0x2a480f[_0xfa30('0x2f')]=qs[_0xfa30('0x2f')](_0x22cde2[_0xfa30('0x46')]['limit']);_0x2a480f['offset']=qs['offset'](_0x22cde2[_0xfa30('0x46')][_0xfa30('0x2d')]);}_0x2a480f[_0xfa30('0x4d')]=qs[_0xfa30('0x4e')](_0x22cde2['query'][_0xfa30('0x4e')]);_0x2a480f['where']=qs[_0xfa30('0x47')](_[_0xfa30('0x6a')](_0x22cde2[_0xfa30('0x46')],_0x53c2f6['filters']));_0x2a480f[_0xfa30('0x4f')][_0xfa30('0x64')]=_0x597d1b['id'];if(_0x22cde2[_0xfa30('0x46')]['filter']){_0x2a480f[_0xfa30('0x4f')]=_[_0xfa30('0x51')](_0x2a480f[_0xfa30('0x4f')],{'$or':_[_0xfa30('0x41')](_0x2a480f[_0xfa30('0x49')],function(_0x420955){var _0x4df7f5={};_0x4df7f5[_0x420955]={'$like':'%'+_0x22cde2[_0xfa30('0x46')][_0xfa30('0x50')]+'%'};return _0x4df7f5;})});}_0x2a480f=_[_0xfa30('0x51')]({},_0x2a480f,_0x22cde2[_0xfa30('0x53')]);return db[_0xfa30('0x66')][_0xfa30('0x30')]({'where':_0x2a480f[_0xfa30('0x4f')]})[_0xfa30('0x21')](function(_0x58f6ab){_0x4c4e9b[_0xfa30('0x30')]=_0x58f6ab;if(_0x22cde2[_0xfa30('0x46')][_0xfa30('0x54')]){_0x2a480f[_0xfa30('0x55')]=[{'all':!![]}];}return db['Disposition'][_0xfa30('0x6b')](_0x2a480f);})[_0xfa30('0x21')](function(_0xcedac0){_0x4c4e9b[_0xfa30('0x6c')]=_0xcedac0;return _0x4c4e9b;});}})[_0xfa30('0x21')](respondWithFilteredResult(_0x320314,_0x2a480f))[_0xfa30('0x29')](handleError(_0x320314,null));};exports[_0xfa30('0x6d')]=function(_0x3bc630,_0x32cfb5,_0x2fcae1){return db[_0xfa30('0x42')][_0xfa30('0x5e')]({'where':{'id':_0x3bc630[_0xfa30('0x57')]['id']}})['then'](handleEntityNotFound(_0x32cfb5,null))['then'](function(_0x30a358){if(_0x30a358){return _0x30a358['removeDispositions'](_0x3bc630[_0xfa30('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x32cfb5,null))[_0xfa30('0x29')](handleError(_0x32cfb5,null));};exports[_0xfa30('0x6e')]=function(_0x1e4dd0,_0x3c12c5,_0x4fb2ab){if(_0x1e4dd0['body']['id']){delete _0x1e4dd0[_0xfa30('0x5a')]['id'];}return db[_0xfa30('0x42')][_0xfa30('0x5e')]({'where':{'id':_0x1e4dd0[_0xfa30('0x57')]['id']}})[_0xfa30('0x21')](handleEntityNotFound(_0x3c12c5,null))['then'](function(_0x141d06){if(_0x141d06){_0x1e4dd0[_0xfa30('0x5a')][_0xfa30('0x64')]=_0x141d06['id'];return db['CannedAnswer'][_0xfa30('0x59')](_0x1e4dd0[_0xfa30('0x5a')]);}})[_0xfa30('0x21')](respondWithResult(_0x3c12c5,null))['catch'](handleError(_0x3c12c5,null));};exports[_0xfa30('0x6f')]=function(_0x1db496,_0x304ab2,_0x4f786d){var _0x16e114={'raw':![],'where':{}};var _0x42cb62={};var _0x412000={'count':0x0,'rows':[]};return db[_0xfa30('0x42')]['findOne']({'where':{'id':_0x1db496[_0xfa30('0x57')]['id']}})[_0xfa30('0x21')](handleEntityNotFound(_0x304ab2,null))[_0xfa30('0x21')](function(_0x7f1c5b){if(_0x7f1c5b){_0x42cb62[_0xfa30('0x4a')]=_[_0xfa30('0x58')](db['CannedAnswer']['rawAttributes']);_0x42cb62[_0xfa30('0x46')]=_[_0xfa30('0x58')](_0x1db496[_0xfa30('0x46')]);_0x42cb62[_0xfa30('0x47')]=_[_0xfa30('0x48')](_0x42cb62['model'],_0x42cb62[_0xfa30('0x46')]);_0x16e114['attributes']=_[_0xfa30('0x48')](_0x42cb62[_0xfa30('0x4a')],qs[_0xfa30('0x4b')](_0x1db496[_0xfa30('0x46')]['fields']));_0x16e114[_0xfa30('0x49')]=_0x16e114[_0xfa30('0x49')]['length']?_0x16e114[_0xfa30('0x49')]:_0x42cb62[_0xfa30('0x4a')];if(!_0x1db496[_0xfa30('0x46')][_0xfa30('0x68')](_0xfa30('0x69'))){_0x16e114[_0xfa30('0x2f')]=qs['limit'](_0x1db496[_0xfa30('0x46')][_0xfa30('0x2f')]);_0x16e114[_0xfa30('0x2d')]=qs['offset'](_0x1db496[_0xfa30('0x46')][_0xfa30('0x2d')]);}_0x16e114[_0xfa30('0x4d')]=qs[_0xfa30('0x4e')](_0x1db496[_0xfa30('0x46')][_0xfa30('0x4e')]);_0x16e114[_0xfa30('0x4f')]=qs['filters'](_[_0xfa30('0x6a')](_0x1db496['query'],_0x42cb62[_0xfa30('0x47')]));_0x16e114[_0xfa30('0x4f')][_0xfa30('0x64')]=_0x7f1c5b['id'];if(_0x1db496['query'][_0xfa30('0x50')]){_0x16e114[_0xfa30('0x4f')]=_[_0xfa30('0x51')](_0x16e114['where'],{'$or':_[_0xfa30('0x41')](_0x16e114[_0xfa30('0x49')],function(_0x261638){var _0x39d73d={};_0x39d73d[_0x261638]={'$like':'%'+_0x1db496[_0xfa30('0x46')][_0xfa30('0x50')]+'%'};return _0x39d73d;})});}_0x16e114=_[_0xfa30('0x51')]({},_0x16e114,_0x1db496['options']);return db[_0xfa30('0x70')][_0xfa30('0x30')]({'where':_0x16e114[_0xfa30('0x4f')]})['then'](function(_0xf6abf4){_0x412000[_0xfa30('0x30')]=_0xf6abf4;if(_0x1db496[_0xfa30('0x46')][_0xfa30('0x54')]){_0x16e114[_0xfa30('0x55')]=[{'all':!![]}];}return db[_0xfa30('0x70')][_0xfa30('0x6b')](_0x16e114);})[_0xfa30('0x21')](function(_0x359ecf){_0x412000[_0xfa30('0x6c')]=_0x359ecf;return _0x412000;});}})[_0xfa30('0x21')](respondWithFilteredResult(_0x304ab2,_0x16e114))[_0xfa30('0x29')](handleError(_0x304ab2,null));};exports[_0xfa30('0x71')]=function(_0x4d3348,_0x4bbc4f,_0x2308a9){return db[_0xfa30('0x42')][_0xfa30('0x5e')]({'where':{'id':_0x4d3348[_0xfa30('0x57')]['id']}})['then'](handleEntityNotFound(_0x4bbc4f,null))['then'](function(_0x237c3b){if(_0x237c3b){return _0x237c3b[_0xfa30('0x71')](_0x4d3348['query'][_0xfa30('0x72')]);}})[_0xfa30('0x21')](respondWithStatusCode(_0x4bbc4f,null))['catch'](handleError(_0x4bbc4f,null));};exports['addAgents']=function(_0x36bf27,_0x5730ee,_0x5959d4){return db['WhatsappAccount'][_0xfa30('0x5e')]({'where':{'id':_0x36bf27[_0xfa30('0x57')]['id']}})['then'](handleEntityNotFound(_0x5730ee,null))['then'](function(_0x599dc2){if(_0x599dc2){return _0x599dc2[_0xfa30('0x73')](_0x36bf27[_0xfa30('0x5a')][_0xfa30('0x72')],_[_0xfa30('0x74')](_0x36bf27['body'],[_0xfa30('0x72'),'id'])||{})['spread'](function(_0x396c00){for(var _0x1b6c05=0x0;_0x1b6c05<_0x36bf27[_0xfa30('0x5a')]['ids'][_0xfa30('0x4c')];_0x1b6c05+=0x1){socket[_0xfa30('0x75')](_0xfa30('0x76'),{'UserId':Number(_0x36bf27[_0xfa30('0x5a')][_0xfa30('0x72')][_0x1b6c05]),'WhatsappAccountId':Number(_0x36bf27[_0xfa30('0x57')]['id'])});}return _0x396c00;});}})[_0xfa30('0x21')](respondWithResult(_0x5730ee,null))['catch'](handleError(_0x5730ee,null));};exports[_0xfa30('0x77')]=function(_0xe011e5,_0x321f4c,_0x438ed2){return db['WhatsappAccount'][_0xfa30('0x5e')]({'where':{'id':_0xe011e5[_0xfa30('0x57')]['id']}})[_0xfa30('0x21')](handleEntityNotFound(_0x321f4c,null))[_0xfa30('0x21')](function(_0xc0e00e){if(_0xc0e00e){return _0xc0e00e[_0xfa30('0x77')](_0xe011e5['query'][_0xfa30('0x72')])[_0xfa30('0x21')](function(){if(_[_0xfa30('0x78')](_0xe011e5['query']['ids'])){for(var _0x169aba=0x0;_0x169aba<_0xe011e5['query'][_0xfa30('0x72')][_0xfa30('0x4c')];_0x169aba+=0x1){socket[_0xfa30('0x75')](_0xfa30('0x79'),{'UserId':Number(_0xe011e5['query']['ids'][_0x169aba]),'WhatsappAccountId':Number(_0xe011e5['params']['id'])});}}else{socket['emit'](_0xfa30('0x79'),{'UserId':Number(_0xe011e5[_0xfa30('0x46')]['ids']),'WhatsappAccountId':Number(_0xe011e5['params']['id'])});}});}})[_0xfa30('0x21')](respondWithStatusCode(_0x321f4c,null))[_0xfa30('0x29')](handleError(_0x321f4c,null));};exports[_0xfa30('0x7a')]=function(_0x317805,_0x5b3316,_0x5be7a1){var _0xea060e={};var _0x55b7c2={};var _0x25ffbd;var _0x3a16c9;return db[_0xfa30('0x42')][_0xfa30('0x65')]({'where':{'id':_0x317805['params']['id']}})[_0xfa30('0x21')](handleEntityNotFound(_0x5b3316,null))[_0xfa30('0x21')](function(_0x141dbc){if(_0x141dbc){_0x25ffbd=_0x141dbc;_0x55b7c2[_0xfa30('0x4a')]=_[_0xfa30('0x58')](db['User'][_0xfa30('0x67')]);_0x55b7c2['query']=_[_0xfa30('0x58')](_0x317805[_0xfa30('0x46')]);_0x55b7c2[_0xfa30('0x47')]=_[_0xfa30('0x48')](_0x55b7c2['model'],_0x55b7c2[_0xfa30('0x46')]);_0xea060e['attributes']=_[_0xfa30('0x48')](_0x55b7c2[_0xfa30('0x4a')],qs[_0xfa30('0x4b')](_0x317805[_0xfa30('0x46')]['fields']));_0xea060e[_0xfa30('0x49')]=_0xea060e[_0xfa30('0x49')][_0xfa30('0x4c')]?_0xea060e[_0xfa30('0x49')]:_0x55b7c2[_0xfa30('0x4a')];_0xea060e[_0xfa30('0x4d')]=qs[_0xfa30('0x4e')](_0x317805[_0xfa30('0x46')][_0xfa30('0x4e')]);_0xea060e[_0xfa30('0x4f')]=qs[_0xfa30('0x47')](_[_0xfa30('0x6a')](_0x317805['query'],_0x55b7c2[_0xfa30('0x47')]));if(_0x317805[_0xfa30('0x46')][_0xfa30('0x50')]){_0xea060e[_0xfa30('0x4f')]=_['merge'](_0xea060e[_0xfa30('0x4f')],{'$or':_[_0xfa30('0x41')](_0xea060e['attributes'],function(_0x10cf1a){var _0xedbd5b={};_0xedbd5b[_0x10cf1a]={'$like':'%'+_0x317805['query'][_0xfa30('0x50')]+'%'};return _0xedbd5b;})});}_0xea060e=_['merge']({},_0xea060e,_0x317805[_0xfa30('0x53')]);return _0x25ffbd['getAgents'](_0xea060e);}})['then'](function(_0x3846b6){if(_0x3846b6){_0x3a16c9=_0x3846b6[_0xfa30('0x4c')];if(!_0x317805[_0xfa30('0x46')][_0xfa30('0x68')](_0xfa30('0x69'))){_0xea060e['limit']=qs[_0xfa30('0x2f')](_0x317805['query']['limit']);_0xea060e['offset']=qs[_0xfa30('0x2d')](_0x317805[_0xfa30('0x46')][_0xfa30('0x2d')]);}return _0x25ffbd['getAgents'](_0xea060e);}})[_0xfa30('0x21')](function(_0xb9a831){if(_0xb9a831){return _0xb9a831?{'count':_0x3a16c9,'rows':_0xb9a831}:null;}})[_0xfa30('0x21')](respondWithResult(_0x5b3316,null))[_0xfa30('0x29')](handleError(_0x5b3316,null));};exports[_0xfa30('0x7b')]=function(_0x23672a,_0x583984){var _0x46e5d6=_0x23672a[_0xfa30('0x57')]['id'];var _0x975d5b=_0x23672a[_0xfa30('0x5a')];var _0x16e13a=0xc8;var _0x1c15e0=null;return db['sequelize'][_0xfa30('0x7c')]({'isolationLevel':db[_0xfa30('0x7d')][_0xfa30('0x7e')][_0xfa30('0x7f')][_0xfa30('0x80')]},function(_0x1fcc66){return db[_0xfa30('0x42')][_0xfa30('0x65')]({'where':{'id':_0x46e5d6},'transaction':_0x1fcc66})[_0xfa30('0x21')](function(_0x10ed4e){if(_0x10ed4e){return db[_0xfa30('0x81')][_0xfa30('0x3b')]({'where':{'WhatsappAccountId':_0x46e5d6},'transaction':_0x1fcc66})[_0xfa30('0x21')](function(){var _0x26292d=_[_0xfa30('0x41')](_0x975d5b,function(_0x4363f8){_0x4363f8[_0xfa30('0x64')]=_0x46e5d6;return _0x4363f8;});return db[_0xfa30('0x81')][_0xfa30('0x82')](_0x26292d,{'transaction':_0x1fcc66});});}else{_0x16e13a=0x194;_0x1c15e0=[];}});})[_0xfa30('0x21')](function(){if(_0x16e13a!==0x194){return db[_0xfa30('0x81')][_0xfa30('0x83')]({'where':{'WhatsappAccountId':_0x46e5d6},'order':_0xfa30('0x84')})[_0xfa30('0x21')](function(_0x1f65a0){_0x1c15e0=_0x1f65a0;});}})[_0xfa30('0x29')](function(_0x1207d0){_0x16e13a=0x1f4;logger[_0xfa30('0x25')](_0x1207d0['stack']);if(_0x1207d0[_0xfa30('0x3d')]){delete _0x1207d0[_0xfa30('0x3d')];}_0x1c15e0=_0x1207d0;})[_0xfa30('0x85')](function(){if(_0x1c15e0===null){_0x583984[_0xfa30('0x2a')](_0x16e13a);}else{if(_0x16e13a===0x1f4){_0x583984[_0xfa30('0x31')](_0x16e13a)[_0xfa30('0x86')](_0x1c15e0);}else{_0x583984[_0xfa30('0x31')](_0x16e13a)[_0xfa30('0x2c')](_0x1c15e0);}}});};exports[_0xfa30('0x87')]=function(_0x10c70f,_0x2fbf96,_0x57b465){var _0x5ac2f1={};var _0x3cbdbc={};var _0x5a94b1;var _0x5dfee7;return db[_0xfa30('0x42')][_0xfa30('0x65')]({'where':{'id':_0x10c70f[_0xfa30('0x57')]['id']}})[_0xfa30('0x21')](handleEntityNotFound(_0x2fbf96,null))[_0xfa30('0x21')](function(_0x4721d1){if(_0x4721d1){_0x5a94b1=_0x4721d1;_0x3cbdbc[_0xfa30('0x4a')]=_[_0xfa30('0x58')](db['WhatsappApplication'][_0xfa30('0x67')]);_0x3cbdbc[_0xfa30('0x46')]=_[_0xfa30('0x58')](_0x10c70f['query']);_0x3cbdbc[_0xfa30('0x47')]=_[_0xfa30('0x48')](_0x3cbdbc[_0xfa30('0x4a')],_0x3cbdbc['query']);_0x5ac2f1[_0xfa30('0x49')]=_[_0xfa30('0x48')](_0x3cbdbc[_0xfa30('0x4a')],qs['fields'](_0x10c70f[_0xfa30('0x46')]['fields']));_0x5ac2f1[_0xfa30('0x49')]=_0x5ac2f1[_0xfa30('0x49')]['length']?_0x5ac2f1[_0xfa30('0x49')]:_0x3cbdbc[_0xfa30('0x4a')];_0x5ac2f1[_0xfa30('0x4d')]=qs[_0xfa30('0x4e')](_0x10c70f['query'][_0xfa30('0x4e')]);_0x5ac2f1['where']=qs['filters'](_[_0xfa30('0x6a')](_0x10c70f['query'],_0x3cbdbc[_0xfa30('0x47')]));if(_0x10c70f[_0xfa30('0x46')][_0xfa30('0x50')]){_0x5ac2f1[_0xfa30('0x4f')]=_[_0xfa30('0x51')](_0x5ac2f1[_0xfa30('0x4f')],{'$or':_[_0xfa30('0x41')](_0x5ac2f1[_0xfa30('0x49')],function(_0x6fe83e){var _0x3585e5={};_0x3585e5[_0x6fe83e]={'$like':'%'+_0x10c70f[_0xfa30('0x46')][_0xfa30('0x50')]+'%'};return _0x3585e5;})});}_0x5ac2f1=_['merge']({},_0x5ac2f1,_0x10c70f[_0xfa30('0x53')]);return _0x5a94b1['getApplications'](_0x5ac2f1);}})[_0xfa30('0x21')](function(_0x369d84){if(_0x369d84){_0x5dfee7=_0x369d84[_0xfa30('0x4c')];if(!_0x10c70f['query'][_0xfa30('0x68')](_0xfa30('0x69'))){_0x5ac2f1[_0xfa30('0x2f')]=qs[_0xfa30('0x2f')](_0x10c70f[_0xfa30('0x46')]['limit']);_0x5ac2f1['offset']=qs['offset'](_0x10c70f['query'][_0xfa30('0x2d')]);}return _0x5a94b1[_0xfa30('0x87')](_0x5ac2f1);}})[_0xfa30('0x21')](function(_0x4b8cac){if(_0x4b8cac){return _0x4b8cac?{'count':_0x5dfee7,'rows':_0x4b8cac}:null;}})['then'](respondWithResult(_0x2fbf96,null))[_0xfa30('0x29')](handleError(_0x2fbf96,null));};exports[_0xfa30('0x88')]=function(_0x40a091,_0x2fc3b1,_0x10ae97){var _0x4c8dec={'channel':_0xfa30('0x89')};var _0x4800df=[];var _0x3961d9=[];var _0x1d8b9c={};return db['WhatsappAccount']['find']({'where':{'id':_0x40a091[_0xfa30('0x57')]['id']},'include':[{'model':db[_0xfa30('0x81')],'as':_0xfa30('0x8a')}]})['then'](handleEntityNotFound(_0x2fc3b1,null))[_0xfa30('0x21')](function(_0x2355e0){_0x4c8dec[_0xfa30('0x8b')]=_0x2355e0;if(_0x4c8dec['account']&&_0x4c8dec[_0xfa30('0x8b')][_0xfa30('0x44')]===_0xfa30('0x8c')&&_0x40a091['body'][_0xfa30('0x8d')]){if(_0x40a091[_0xfa30('0x5a')]['statuses'][_0xfa30('0x4c')]===0x0)return;if(_0x40a091[_0xfa30('0x5a')][_0xfa30('0x8d')][0x0][_0xfa30('0x8e')]!==_0xfa30('0x8f'))return;return db[_0xfa30('0x90')][_0xfa30('0x37')]({'read':!![],'readAt':_0x40a091[_0xfa30('0x5a')][_0xfa30('0x8d')][0x0][_0xfa30('0x91')]},{'where':{'messageId':_0x40a091[_0xfa30('0x5a')][_0xfa30('0x8d')][0x0]['message_id']},'individualHooks':!![]})[_0xfa30('0x21')](function(_0x7b6027){return _0x2fc3b1[_0xfa30('0x31')](0xc8)[_0xfa30('0x2c')](_0x7b6027);});}_0x4c8dec['applications']=_['orderBy'](_0x2355e0[_0xfa30('0x8a')],[_0xfa30('0x84')],['asc']);if(_0x4c8dec[_0xfa30('0x8b')][_0xfa30('0x8a')]){delete _0x4c8dec['account'][_0xfa30('0x8a')];}return db[_0xfa30('0x92')]['describe']()[_0xfa30('0x21')](function(_0x4635c3){if(!_0x4635c3){throw new db['Sequelize'][(_0xfa30('0x93'))](_0xfa30('0x94'));}_0x4800df=_[_0xfa30('0x95')](_[_0xfa30('0x58')](_0x4635c3),[_0xfa30('0x96'),_0xfa30('0x97')]);_0x3961d9=_[_0xfa30('0x95')](_[_0xfa30('0x58')](_0x4635c3),['createdAt',_0xfa30('0x97'),_0xfa30('0x98'),'ListId']);_0x4c8dec['body']={'mapKey':_0xfa30('0x99')};if(_0x4c8dec['account']&&_0x4c8dec[_0xfa30('0x8b')][_0xfa30('0x44')]==='twilio'){_0x4c8dec[_0xfa30('0x5a')][_0xfa30('0x9a')]=_0x40a091['body'][_0xfa30('0x9b')]['replace']('whatsapp:','');_0x4c8dec[_0xfa30('0x5a')]['body']=_0x40a091[_0xfa30('0x5a')][_0xfa30('0x9c')];_0x4c8dec[_0xfa30('0x5a')][_0xfa30('0x9d')]=_0x40a091[_0xfa30('0x5a')][_0xfa30('0x9e')];}if(_0x4c8dec['account']&&_0x4c8dec[_0xfa30('0x8b')]['type']==='sinch'){_0x4c8dec[_0xfa30('0x5a')][_0xfa30('0x9a')]=_0x40a091[_0xfa30('0x5a')][_0xfa30('0x9f')][0x0][_0xfa30('0x9a')];_0x4c8dec['body'][_0xfa30('0x5a')]=_0x40a091[_0xfa30('0x5a')]['notifications'][0x0][_0xfa30('0x27')]['body'];_0x4c8dec[_0xfa30('0x5a')][_0xfa30('0x9d')]=_0x40a091[_0xfa30('0x5a')][_0xfa30('0x9f')][0x0][_0xfa30('0xa0')];}if(_0x4c8dec[_0xfa30('0x5a')]['id']){delete _0x4c8dec['body']['id'];}if(_[_0xfa30('0xa1')](_0x4c8dec[_0xfa30('0x5a')][_0xfa30('0x9a')])){throw new db[(_0xfa30('0xa2'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x4c8dec['body'][_0xfa30('0x5a')])||_0x4c8dec[_0xfa30('0x5a')][_0xfa30('0x5a')]===''){throw new db[(_0xfa30('0xa2'))][(_0xfa30('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xfa30('0xa1')](_0x4c8dec[_0xfa30('0x5a')][_0xfa30('0xa3')])){throw new db[(_0xfa30('0xa2'))]['ValidationError'](_0xfa30('0xa4')+_0x3961d9);}if(!_[_0xfa30('0xa5')](_0x3961d9,_0x4c8dec[_0xfa30('0x5a')][_0xfa30('0xa3')])){throw new db[(_0xfa30('0xa2'))]['ValidationError'](_0xfa30('0xa6')+_0x3961d9);}_0x1d8b9c[_0x4c8dec[_0xfa30('0x5a')][_0xfa30('0xa3')]]=_0x4c8dec[_0xfa30('0x5a')][_0xfa30('0x9a')];return db[_0xfa30('0xa7')]['find']({'where':{'id':_0x4c8dec[_0xfa30('0x8b')][_0xfa30('0xa8')]},'include':[{'model':db['CmContact'],'as':_0xfa30('0xa9'),'where':_0x1d8b9c,'limit':0x1,'order':[[_0xfa30('0x97'),_0xfa30('0xaa')]]}]});})['then'](handleEntityNotFound(_0x2fc3b1,null))[_0xfa30('0x21')](function(_0x57147e){if(_0x57147e){_0x4c8dec[_0xfa30('0xab')]=_[_0xfa30('0x74')](_0x57147e,[_0xfa30('0xa9')]);if(_0x57147e[_0xfa30('0xa9')][_0xfa30('0x4c')]){return _0x57147e[_0xfa30('0xa9')][0x0];}var _0x36eefe=_['defaults'](_0x4c8dec[_0xfa30('0x5a')],{'firstName':_0x4c8dec[_0xfa30('0x5a')]['from'],'ListId':_0x57147e['id']});_0x36eefe[_0x4c8dec[_0xfa30('0x5a')][_0xfa30('0xa3')]]=_0x4c8dec[_0xfa30('0x5a')][_0xfa30('0x9a')];return db[_0xfa30('0x92')]['create'](_0x36eefe,{'fields':_0x4800df,'raw':!![]});}})[_0xfa30('0x21')](handleEntityNotFound(_0x2fc3b1,null))[_0xfa30('0x21')](function(_0x40eed6){if(_0x40eed6){_0x4c8dec[_0xfa30('0xac')]=_0x40eed6;var _0x23b1cc={'ContactId':_0x40eed6['id'],'phone':_0x4c8dec[_0xfa30('0x5a')][_0xfa30('0x9a')],'WhatsappAccountId':_0x40a091[_0xfa30('0x57')]['id']};var _0x284ebb={'ContactId':_0x40eed6['id'],'WhatsappAccountId':_0x40a091[_0xfa30('0x57')]['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0x284ebb})[_0xfa30('0x21')](function(_0x587d6b){if(_0x587d6b){return[_0x587d6b,![]];}return db['WhatsappInteraction'][_0xfa30('0x59')](_0x23b1cc)[_0xfa30('0x21')](function(_0x13dd06){return[_0x13dd06,!![]];});});}})[_0xfa30('0xad')](function(_0x5b83ea,_0x1d237b){_0x4c8dec['interaction']=_0x5b83ea[_0xfa30('0x38')]({'plain':!![]});_0x4c8dec['interaction'][_0xfa30('0xae')]=![];if(_0x1d237b){if(_0x4c8dec['account']['autoclose']){_0x4c8dec[_0xfa30('0xaf')]['push']({'id':0x0,'priority':_0x4c8dec[_0xfa30('0xaf')][_0xfa30('0x4c')]+0x1,'app':_0xfa30('0xb0'),'appdata':_0xfa30('0xb1'),'interval':_0xfa30('0xb2')});}_0x4c8dec['interaction'][_0xfa30('0xae')]=!![];}return db['WhatsappMessage']['create']({'phone':_0x4c8dec[_0xfa30('0x5a')][_0xfa30('0x9a')],'messageId':_0x4c8dec[_0xfa30('0x5a')][_0xfa30('0x9d')],'body':_0x4c8dec[_0xfa30('0x5a')][_0xfa30('0x5a')],'WhatsappAccountId':_0x40a091[_0xfa30('0x57')]['id'],'WhatsappInteractionId':_0x5b83ea['id'],'direction':'in','ContactId':_0x5b83ea[_0xfa30('0xb3')],'AttachmentId':_0x4c8dec['body'][_0xfa30('0xb4')]});})[_0xfa30('0x21')](function(_0x3d3de9){_0x4c8dec[_0xfa30('0x27')]=_0x3d3de9;if(!_0x4c8dec['interaction'][_0xfa30('0xb5')])return;return db[_0xfa30('0xb6')][_0xfa30('0x5e')]({'attributes':['id','name'],'where':{'id':_0x4c8dec[_0xfa30('0xb7')][_0xfa30('0xb5')]}});})['then'](function(_0x21c91c){if(_0x21c91c){_0x4c8dec[_0xfa30('0xaf')]['unshift']({'id':0x0,'priority':0x0,'app':_0xfa30('0xb8'),'appdata':_0x21c91c[_0xfa30('0x3d')]+','+(_0x4c8dec[_0xfa30('0x8b')][_0xfa30('0xb9')]||0xa),'interval':'*,*,*,*'});}if(!_0x4c8dec['interaction']['queueId'])return;return db[_0xfa30('0xba')][_0xfa30('0x5e')]({'attributes':['id','name'],'where':{'id':_0x4c8dec[_0xfa30('0xb7')][_0xfa30('0xbb')]}});})['then'](function(_0x5959f0){if(_0x5959f0){_0x4c8dec['applications'][_0xfa30('0xbc')]({'id':0x0,'priority':0x1,'app':_0xfa30('0xbd'),'appdata':_0x5959f0['name']+','+(_0x4c8dec[_0xfa30('0x8b')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xfa30('0xbe'),'startRouting',_0x4c8dec);})[_0xfa30('0x21')](function(_0x3b6452){if(_0x3b6452){var _0x46934f=0xc8;var _0xde2c7f=_0xfa30('0xbf');logger[_0xfa30('0xc0')](_0xfa30('0xc1'),_0xde2c7f,_0x46934f,_0xfa30('0xc2'));logger['debug'](_0xfa30('0xc3'),_0xde2c7f,_0x46934f,_0xfa30('0xc2'),JSON[_0xfa30('0xc4')](_0x3b6452));if(_0x4c8dec[_0xfa30('0x8b')][_0xfa30('0x44')]===_0xfa30('0xc5')){return _0x2fc3b1[_0xfa30('0x31')](_0x46934f)[_0xfa30('0x32')](_0xfa30('0xc6'),'text/xml')[_0xfa30('0x86')]('\x0a');}else{return _0x2fc3b1[_0xfa30('0x31')](_0x46934f)[_0xfa30('0x2c')](_0x3b6452);}}});})[_0xfa30('0x29')](handleError(_0x2fc3b1,null));};exports['send']=function(_0x186b24,_0x3490b1,_0x1d9b55){var _0x20de04,_0x2e62a4,_0x2b9f1b;if(_[_0xfa30('0xa1')](_0x186b24[_0xfa30('0x5a')][_0xfa30('0x5a')])||_0x186b24[_0xfa30('0x5a')][_0xfa30('0x5a')]===''){throw new db[(_0xfa30('0xa2'))][(_0xfa30('0x93'))](_0xfa30('0xc7'));}if(_['isNil'](_0x186b24[_0xfa30('0x5a')]['to'])){throw new db[(_0xfa30('0xa2'))][(_0xfa30('0x93'))](_0xfa30('0xc8'));}_0x20de04=_0x186b24[_0xfa30('0x5a')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x186b24[_0xfa30('0x57')]['id']},'include':[{'model':db[_0xfa30('0xa7')],'as':_0xfa30('0xc9'),'include':[{'model':db[_0xfa30('0x92')],'as':_0xfa30('0xa9'),'where':{'mobile':_0x20de04},'limit':0x1,'order':[[_0xfa30('0x97'),'DESC']]}]}]})[_0xfa30('0x21')](handleEntityNotFound(_0x3490b1,null))['then'](function(_0x37fb54){if(_0x37fb54&&_0x37fb54['List']){_0x2e62a4=_0x37fb54['get']({'plain':!![]});if(_0x2e62a4['List']&&_0x2e62a4['List'][_0xfa30('0xa9')]['length']){return _0x2e62a4[_0xfa30('0xc9')][_0xfa30('0xa9')][0x0];}return db['CmContact'][_0xfa30('0x59')](_[_0xfa30('0x19')](_0x186b24[_0xfa30('0x5a')],{'firstName':_0x20de04,'mobile':_0x20de04,'phone':_0x20de04,'ListId':_0x2e62a4['ListId']}));}})[_0xfa30('0x21')](handleEntityNotFound(_0x3490b1,null))['then'](function(_0x446bb3){if(_0x446bb3){_0x2b9f1b=_0x446bb3;return db[_0xfa30('0xca')][_0xfa30('0x5e')]({'where':{'ContactId':_0x2b9f1b['id'],'closed':![],'WhatsappAccountId':_0x2e62a4['id']}})[_0xfa30('0x21')](function(_0x25f8f3){if(_0x25f8f3){return[_0x25f8f3,![]];}return db[_0xfa30('0xca')][_0xfa30('0x59')]({'UserId':_0x186b24[_0xfa30('0x5b')]['id'],'ContactId':_0x2b9f1b['id'],'WhatsappAccountId':_0x2e62a4['id'],'phone':_0x20de04,'firstMsgDirection':_0xfa30('0xcb'),'Messages':[_[_0xfa30('0x51')](_0x186b24[_0xfa30('0x5a')],{'read':![],'body':_0x186b24[_0xfa30('0x5a')]['body'],'phone':_0x20de04,'WhatsappAccountId':_0x2e62a4['id'],'UserId':_0x186b24[_0xfa30('0x5b')]['id'],'ContactId':_0x2b9f1b['id']})]},{'include':[{'model':db[_0xfa30('0x90')],'as':_0xfa30('0xcc')}]})[_0xfa30('0x21')](function(_0x5adf67){return[_0x5adf67,!![]];});});}})[_0xfa30('0xad')](function(_0x59f4ef,_0x59d02b){if(_0x59d02b){return _0x59f4ef;}return db[_0xfa30('0x90')][_0xfa30('0x59')](_['merge'](_0x186b24[_0xfa30('0x5a')],{'read':![],'body':_0x186b24[_0xfa30('0x5a')]['body'],'phone':_0x20de04,'WhatsappAccountId':_0x2e62a4['id'],'WhatsappInteractionId':_0x59f4ef['id'],'UserId':_0x186b24[_0xfa30('0x5b')]['id'],'ContactId':_0x2b9f1b['id']}))[_0xfa30('0x21')](function(_0x50a577){_0x59f4ef[_0xfa30('0xcd')][_0xfa30('0xcc')]=[];_0x59f4ef[_0xfa30('0xcd')]['Messages']['push'](_0x50a577[_0xfa30('0xcd')]);return _0x59f4ef;});})['then'](respondWithResult(_0x3490b1,null))[_0xfa30('0x29')](handleError(_0x3490b1,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 3320fc8..14ea6a2 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 _0xd9a1=['remove','emit','hook','exports','events','WhatsappAccount','setMaxListeners','save','update'];(function(_0x10cdec,_0x18b5f){var _0xd5687=function(_0x4ce22c){while(--_0x4ce22c){_0x10cdec['push'](_0x10cdec['shift']());}};_0xd5687(++_0x18b5f);}(_0xd9a1,0x70));var _0x1d9a=function(_0x9efe0,_0x1e7272){_0x9efe0=_0x9efe0-0x0;var _0x232a0f=_0xd9a1[_0x9efe0];return _0x232a0f;};'use strict';var EventEmitter=require(_0x1d9a('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x1d9a('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x1d9a('0x2')](0x0);var events={'afterCreate':_0x1d9a('0x3'),'afterUpdate':_0x1d9a('0x4'),'afterDestroy':_0x1d9a('0x5')};function emitEvent(_0x48b106){return function(_0x31d89a,_0x2edcbe,_0x499750){WhatsappAccountEvents[_0x1d9a('0x6')](_0x48b106+':'+_0x31d89a['id'],_0x31d89a);WhatsappAccountEvents[_0x1d9a('0x6')](_0x48b106,_0x31d89a);_0x499750(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x1d9a('0x7')](e,emitEvent(event));}}module[_0x1d9a('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x52dd=['save','update','remove','emit','hasOwnProperty','exports','WhatsappAccount','setMaxListeners'];(function(_0x21b831,_0x345bf2){var _0x39b1bd=function(_0x4c5175){while(--_0x4c5175){_0x21b831['push'](_0x21b831['shift']());}};_0x39b1bd(++_0x345bf2);}(_0x52dd,0x136));var _0xd52d=function(_0xf79f3e,_0x5c1fef){_0xf79f3e=_0xf79f3e-0x0;var _0x4c220d=_0x52dd[_0xf79f3e];return _0x4c220d;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0xd52d('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd52d('0x1')](0x0);var events={'afterCreate':_0xd52d('0x2'),'afterUpdate':_0xd52d('0x3'),'afterDestroy':_0xd52d('0x4')};function emitEvent(_0x41eac4){return function(_0x46ba57,_0x528541,_0x4f400f){WhatsappAccountEvents[_0xd52d('0x5')](_0x41eac4+':'+_0x46ba57['id'],_0x46ba57);WhatsappAccountEvents[_0xd52d('0x5')](_0x41eac4,_0x46ba57);_0x4f400f(null);};}for(var e in events){if(events[_0xd52d('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xd52d('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 95fe64c..b97a062 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 _0x0439=['./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3b0e74,_0x295ca1){var _0x2ebdc1=function(_0x4cd489){while(--_0x4cd489){_0x3b0e74['push'](_0x3b0e74['shift']());}};_0x2ebdc1(++_0x295ca1);}(_0x0439,0xe8));var _0x9043=function(_0xe4ee1e,_0xea8b9b){_0xe4ee1e=_0xe4ee1e-0x0;var _0x22f903=_0x0439[_0xe4ee1e];return _0x22f903;};'use strict';var _=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var logger=require(_0x9043('0x2'))('api');var moment=require(_0x9043('0x3'));var BPromise=require(_0x9043('0x4'));var rp=require(_0x9043('0x5'));var fs=require('fs');var path=require(_0x9043('0x6'));var rimraf=require(_0x9043('0x7'));var config=require('../../config/environment');var attributes=require(_0x9043('0x8'));module[_0x9043('0x9')]=function(_0x4eea70,_0x3f4c66){return _0x4eea70['define'](_0x9043('0xa'),attributes,{'tableName':_0x9043('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb870=['bluebird','path','rimraf','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x4cca5b,_0x15d645){var _0x2ecbd3=function(_0x3065e1){while(--_0x3065e1){_0x4cca5b['push'](_0x4cca5b['shift']());}};_0x2ecbd3(++_0x15d645);}(_0xb870,0x1c3));var _0x0b87=function(_0x416468,_0x2e7a72){_0x416468=_0x416468-0x0;var _0x2ee9b7=_0xb870[_0x416468];return _0x2ee9b7;};'use strict';var _=require(_0x0b87('0x0'));var util=require(_0x0b87('0x1'));var logger=require(_0x0b87('0x2'))(_0x0b87('0x3'));var moment=require(_0x0b87('0x4'));var BPromise=require(_0x0b87('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b87('0x6'));var rimraf=require(_0x0b87('0x7'));var config=require('../../config/environment');var attributes=require(_0x0b87('0x8'));module[_0x0b87('0x9')]=function(_0x4da47f,_0xe08f58){return _0x4da47f[_0x0b87('0xa')]('WhatsappAccount',attributes,{'tableName':_0x0b87('0xb'),'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 e6538e0..4e66b73 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 _0xfc37=['result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','model','map','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message'];(function(_0x19c169,_0x2530f2){var _0x231ee7=function(_0x2f97f1){while(--_0x2f97f1){_0x19c169['push'](_0x19c169['shift']());}};_0x231ee7(++_0x2530f2);}(_0xfc37,0x17d));var _0x7fc3=function(_0xcf8676,_0x1407bb){_0xcf8676=_0xcf8676-0x0;var _0x244c49=_0xfc37[_0xcf8676];return _0x244c49;};'use strict';var _=require(_0x7fc3('0x0'));var util=require(_0x7fc3('0x1'));var moment=require(_0x7fc3('0x2'));var BPromise=require(_0x7fc3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7fc3('0x4'));var db=require(_0x7fc3('0x5'))['db'];var utils=require(_0x7fc3('0x6'));var logger=require(_0x7fc3('0x7'))(_0x7fc3('0x8'));var config=require(_0x7fc3('0x9'));var jayson=require(_0x7fc3('0xa'));var client=jayson[_0x7fc3('0xb')][_0x7fc3('0xc')]({'port':0x232a});config[_0x7fc3('0xd')]=_[_0x7fc3('0xe')](config[_0x7fc3('0xd')],{'host':_0x7fc3('0xf'),'port':0x18eb});var socket=require(_0x7fc3('0x10'))(new Redis(config[_0x7fc3('0xd')]));require(_0x7fc3('0x11'))[_0x7fc3('0x12')](socket);function respondWithRpcPromise(_0x15a206,_0x34e386,_0x4c04b8){return new BPromise(function(_0x1eeac0,_0x19e496){return client['request'](_0x15a206,_0x4c04b8)[_0x7fc3('0x13')](function(_0x1b7af6){logger[_0x7fc3('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x34e386,_0x7fc3('0x15'));logger[_0x7fc3('0x16')](_0x7fc3('0x17'),_0x34e386,_0x7fc3('0x15'),JSON[_0x7fc3('0x18')](_0x1b7af6));if(_0x1b7af6[_0x7fc3('0x19')]){if(_0x1b7af6[_0x7fc3('0x19')][_0x7fc3('0x1a')]===0x1f4){logger['error'](_0x7fc3('0x1b'),_0x34e386,_0x1b7af6[_0x7fc3('0x19')][_0x7fc3('0x1c')]);return _0x19e496(_0x1b7af6['error'][_0x7fc3('0x1c')]);}logger[_0x7fc3('0x19')](_0x7fc3('0x1b'),_0x34e386,_0x1b7af6[_0x7fc3('0x19')]['message']);return _0x1eeac0(_0x1b7af6[_0x7fc3('0x19')][_0x7fc3('0x1c')]);}else{logger['info'](_0x7fc3('0x1b'),_0x34e386,'request\x20sent');_0x1eeac0(_0x1b7af6[_0x7fc3('0x1d')]['message']);}})[_0x7fc3('0x1e')](function(_0x3c9561){logger[_0x7fc3('0x19')](_0x7fc3('0x1b'),_0x34e386,_0x3c9561);_0x19e496(_0x3c9561);});});}exports[_0x7fc3('0x1f')]=function(_0x193681){var _0x76310a=this;return new Promise(function(_0x9fe316,_0x1c49ba){return db[_0x7fc3('0x20')][_0x7fc3('0x21')]({'raw':_0x193681['options']?_0x193681[_0x7fc3('0x22')][_0x7fc3('0x23')]===undefined?!![]:![]:!![],'where':_0x193681[_0x7fc3('0x22')]?_0x193681[_0x7fc3('0x22')][_0x7fc3('0x24')]||null:null,'attributes':_0x193681[_0x7fc3('0x22')]?_0x193681[_0x7fc3('0x22')][_0x7fc3('0x25')]||null:null,'include':_0x193681[_0x7fc3('0x22')]?_0x193681[_0x7fc3('0x22')]['include']?_['map'](_0x193681[_0x7fc3('0x22')][_0x7fc3('0x26')],function(_0x15eb2f){return{'model':db[_0x15eb2f[_0x7fc3('0x27')]],'as':_0x15eb2f['as'],'attributes':_0x15eb2f[_0x7fc3('0x25')],'include':_0x15eb2f['include']?_[_0x7fc3('0x28')](_0x15eb2f[_0x7fc3('0x26')],function(_0x386f9f){return{'model':db[_0x386f9f[_0x7fc3('0x27')]],'as':_0x386f9f['as'],'attributes':_0x386f9f['attributes'],'include':_0x386f9f[_0x7fc3('0x26')]?_[_0x7fc3('0x28')](_0x386f9f[_0x7fc3('0x26')],function(_0x2eb0b3){return{'model':db[_0x2eb0b3[_0x7fc3('0x27')]],'as':_0x2eb0b3['as'],'attributes':_0x2eb0b3[_0x7fc3('0x25')]};}):[]};}):[]};}):[]:[]})[_0x7fc3('0x13')](function(_0xc57acc){logger[_0x7fc3('0x14')](_0x7fc3('0x1f'),_0x193681);logger[_0x7fc3('0x16')](_0x7fc3('0x1f'),_0x193681,JSON[_0x7fc3('0x18')](_0xc57acc));_0x9fe316(_0xc57acc);})[_0x7fc3('0x1e')](function(_0x5ead5c){logger[_0x7fc3('0x19')](_0x7fc3('0x1f'),_0x5ead5c['message'],_0x193681);_0x1c49ba(_0x76310a[_0x7fc3('0x19')](0x1f4,_0x5ead5c[_0x7fc3('0x1c')]));});});}; \ No newline at end of file +var _0x35d5=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','ShowWhatsappAccount','options','raw','where','attributes','include','map','model','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xd98ca3,_0x38fbd9){var _0x35960d=function(_0x52e8ee){while(--_0x52e8ee){_0xd98ca3['push'](_0xd98ca3['shift']());}};_0x35960d(++_0x38fbd9);}(_0x35d5,0x1b5));var _0x535d=function(_0xbc11dd,_0x31c1ea){_0xbc11dd=_0xbc11dd-0x0;var _0x3419e1=_0x35d5[_0xbc11dd];return _0x3419e1;};'use strict';var _=require('lodash');var util=require(_0x535d('0x0'));var moment=require(_0x535d('0x1'));var BPromise=require(_0x535d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x535d('0x3'));var db=require(_0x535d('0x4'))['db'];var utils=require(_0x535d('0x5'));var logger=require(_0x535d('0x6'))(_0x535d('0x7'));var config=require(_0x535d('0x8'));var jayson=require(_0x535d('0x9'));var client=jayson[_0x535d('0xa')][_0x535d('0xb')]({'port':0x232a});config[_0x535d('0xc')]=_[_0x535d('0xd')](config[_0x535d('0xc')],{'host':_0x535d('0xe'),'port':0x18eb});var socket=require(_0x535d('0xf'))(new Redis(config['redis']));require(_0x535d('0x10'))['register'](socket);function respondWithRpcPromise(_0x246af9,_0x51c96c,_0x14c390){return new BPromise(function(_0x215806,_0x548dd4){return client[_0x535d('0x11')](_0x246af9,_0x14c390)[_0x535d('0x12')](function(_0x583543){logger['info'](_0x535d('0x13'),_0x51c96c,_0x535d('0x14'));logger[_0x535d('0x15')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x51c96c,_0x535d('0x14'),JSON[_0x535d('0x16')](_0x583543));if(_0x583543[_0x535d('0x17')]){if(_0x583543[_0x535d('0x17')][_0x535d('0x18')]===0x1f4){logger[_0x535d('0x17')](_0x535d('0x13'),_0x51c96c,_0x583543[_0x535d('0x17')][_0x535d('0x19')]);return _0x548dd4(_0x583543['error'][_0x535d('0x19')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x51c96c,_0x583543[_0x535d('0x17')][_0x535d('0x19')]);return _0x215806(_0x583543[_0x535d('0x17')]['message']);}else{logger[_0x535d('0x1a')](_0x535d('0x13'),_0x51c96c,_0x535d('0x14'));_0x215806(_0x583543[_0x535d('0x1b')][_0x535d('0x19')]);}})[_0x535d('0x1c')](function(_0x2ed4dc){logger[_0x535d('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x51c96c,_0x2ed4dc);_0x548dd4(_0x2ed4dc);});});}exports[_0x535d('0x1d')]=function(_0x27c506){var _0x32d308=this;return new Promise(function(_0x1560d8,_0xc78467){return db['WhatsappAccount']['find']({'raw':_0x27c506['options']?_0x27c506[_0x535d('0x1e')][_0x535d('0x1f')]===undefined?!![]:![]:!![],'where':_0x27c506['options']?_0x27c506[_0x535d('0x1e')][_0x535d('0x20')]||null:null,'attributes':_0x27c506['options']?_0x27c506['options'][_0x535d('0x21')]||null:null,'include':_0x27c506[_0x535d('0x1e')]?_0x27c506[_0x535d('0x1e')][_0x535d('0x22')]?_[_0x535d('0x23')](_0x27c506[_0x535d('0x1e')][_0x535d('0x22')],function(_0x31a02e){return{'model':db[_0x31a02e[_0x535d('0x24')]],'as':_0x31a02e['as'],'attributes':_0x31a02e[_0x535d('0x21')],'include':_0x31a02e[_0x535d('0x22')]?_[_0x535d('0x23')](_0x31a02e['include'],function(_0x165b60){return{'model':db[_0x165b60[_0x535d('0x24')]],'as':_0x165b60['as'],'attributes':_0x165b60[_0x535d('0x21')],'include':_0x165b60[_0x535d('0x22')]?_[_0x535d('0x23')](_0x165b60[_0x535d('0x22')],function(_0x354d89){return{'model':db[_0x354d89[_0x535d('0x24')]],'as':_0x354d89['as'],'attributes':_0x354d89[_0x535d('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x210824){logger['info'](_0x535d('0x1d'),_0x27c506);logger[_0x535d('0x15')](_0x535d('0x1d'),_0x27c506,JSON[_0x535d('0x16')](_0x210824));_0x1560d8(_0x210824);})[_0x535d('0x1c')](function(_0x11132b){logger[_0x535d('0x17')](_0x535d('0x1d'),_0x11132b['message'],_0x27c506);_0xc78467(_0x32d308[_0x535d('0x17')](0x1f4,_0x11132b[_0x535d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 4fd55dd..d85d506 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 _0x3951=['register','length','whatsappAccount:','./whatsappAccount.events','save','remove','update','removeListener'];(function(_0x262b2b,_0x563924){var _0x195357=function(_0x43d2fe){while(--_0x43d2fe){_0x262b2b['push'](_0x262b2b['shift']());}};_0x195357(++_0x563924);}(_0x3951,0x12b));var _0x1395=function(_0x2f03ad,_0x232e62){_0x2f03ad=_0x2f03ad-0x0;var _0x589148=_0x3951[_0x2f03ad];return _0x589148;};'use strict';var WhatsappAccountEvents=require(_0x1395('0x0'));var events=[_0x1395('0x1'),_0x1395('0x2'),_0x1395('0x3')];function createListener(_0x28a8b5,_0x471fe8){return function(_0x49fbd5){_0x471fe8['emit'](_0x28a8b5,_0x49fbd5);};}function removeListener(_0x4b6c68,_0x386d94){return function(){WhatsappAccountEvents[_0x1395('0x4')](_0x4b6c68,_0x386d94);};}exports[_0x1395('0x5')]=function(_0x19d110){for(var _0x2041da=0x0,_0x5b1a96=events[_0x1395('0x6')];_0x2041da<_0x5b1a96;_0x2041da++){var _0x1f780a=events[_0x2041da];var _0x65492a=createListener(_0x1395('0x7')+_0x1f780a,_0x19d110);WhatsappAccountEvents['on'](_0x1f780a,_0x65492a);}}; \ No newline at end of file +var _0x8fb8=['register','length','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x537563,_0x1eab9e){var _0x3d3f2=function(_0x3fdb0a){while(--_0x3fdb0a){_0x537563['push'](_0x537563['shift']());}};_0x3d3f2(++_0x1eab9e);}(_0x8fb8,0x81));var _0x88fb=function(_0x22ca53,_0x30e1a9){_0x22ca53=_0x22ca53-0x0;var _0x80aacf=_0x8fb8[_0x22ca53];return _0x80aacf;};'use strict';var WhatsappAccountEvents=require(_0x88fb('0x0'));var events=[_0x88fb('0x1'),_0x88fb('0x2'),'update'];function createListener(_0x2f854d,_0x54d039){return function(_0x4aad71){_0x54d039['emit'](_0x2f854d,_0x4aad71);};}function removeListener(_0x18c6b0,_0xb435a0){return function(){WhatsappAccountEvents['removeListener'](_0x18c6b0,_0xb435a0);};}exports[_0x88fb('0x3')]=function(_0x433353){for(var _0x59a2dd=0x0,_0x15b8f7=events[_0x88fb('0x4')];_0x59a2dd<_0x15b8f7;_0x59a2dd++){var _0x4754a4=events[_0x59a2dd];var _0x2417a=createListener(_0x88fb('0x5')+_0x4754a4,_0x433353);WhatsappAccountEvents['on'](_0x4754a4,_0x2417a);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 808e548..12b2293 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 _0x723d=['put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x723d,0xd6));var _0xd723=function(_0x1597e2,_0x388d3e){_0x1597e2=_0x1597e2-0x0;var _0x4c8c0a=_0x723d[_0x1597e2];return _0x4c8c0a;};'use strict';var multer=require(_0xd723('0x0'));var util=require('util');var path=require(_0xd723('0x1'));var timeout=require(_0xd723('0x2'));var express=require(_0xd723('0x3'));var router=express[_0xd723('0x4')]();var fs_extra=require(_0xd723('0x5'));var auth=require(_0xd723('0x6'));var interaction=require(_0xd723('0x7'));var config=require(_0xd723('0x8'));var controller=require(_0xd723('0x9'));router[_0xd723('0xa')]('/',auth[_0xd723('0xb')](),controller[_0xd723('0xc')]);router['get'](_0xd723('0xd'),auth[_0xd723('0xb')](),controller[_0xd723('0xe')]);router[_0xd723('0xf')]('/',auth['isAuthenticated'](),controller[_0xd723('0x10')]);router[_0xd723('0x11')](_0xd723('0xd'),auth[_0xd723('0xb')](),controller['update']);router[_0xd723('0x12')](_0xd723('0xd'),auth['isAuthenticated'](),controller[_0xd723('0x13')]);module[_0xd723('0x14')]=router; \ No newline at end of file +var _0xce66=['isAuthenticated','index','show','post','create','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x500812,_0x296a3c){var _0x4add02=function(_0x33c252){while(--_0x33c252){_0x500812['push'](_0x500812['shift']());}};_0x4add02(++_0x296a3c);}(_0xce66,0x100));var _0x6ce6=function(_0x4c5c97,_0x4f85bf){_0x4c5c97=_0x4c5c97-0x0;var _0xd5d2cb=_0xce66[_0x4c5c97];return _0xd5d2cb;};'use strict';var multer=require(_0x6ce6('0x0'));var util=require('util');var path=require(_0x6ce6('0x1'));var timeout=require(_0x6ce6('0x2'));var express=require(_0x6ce6('0x3'));var router=express[_0x6ce6('0x4')]();var fs_extra=require(_0x6ce6('0x5'));var auth=require(_0x6ce6('0x6'));var interaction=require(_0x6ce6('0x7'));var config=require(_0x6ce6('0x8'));var controller=require('./whatsappApplication.controller');router[_0x6ce6('0x9')]('/',auth[_0x6ce6('0xa')](),controller[_0x6ce6('0xb')]);router[_0x6ce6('0x9')]('/:id',auth[_0x6ce6('0xa')](),controller[_0x6ce6('0xc')]);router[_0x6ce6('0xd')]('/',auth[_0x6ce6('0xa')](),controller[_0x6ce6('0xe')]);router['put'](_0x6ce6('0xf'),auth[_0x6ce6('0xa')](),controller[_0x6ce6('0x10')]);router[_0x6ce6('0x11')](_0x6ce6('0xf'),auth[_0x6ce6('0xa')](),controller[_0x6ce6('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 50895cc..3c65977 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 _0x0721=['INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x0721,0x131));var _0x1072=function(_0x2a7b50,_0x545d55){_0x2a7b50=_0x2a7b50-0x0;var _0x4224c9=_0x0721[_0x2a7b50];return _0x4224c9;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x1072('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1072('0x1')},'appdata':{'type':Sequelize[_0x1072('0x2')]()},'description':{'type':Sequelize[_0x1072('0x3')]},'interval':{'type':Sequelize[_0x1072('0x3')],'defaultValue':_0x1072('0x4')}}; \ No newline at end of file +var _0xcd7a=['STRING','TEXT','sequelize','exports','INTEGER'];(function(_0x8de24,_0x368002){var _0x20fdbc=function(_0xb77eaa){while(--_0xb77eaa){_0x8de24['push'](_0x8de24['shift']());}};_0x20fdbc(++_0x368002);}(_0xcd7a,0xb6));var _0xacd7=function(_0x419152,_0x5ea792){_0x419152=_0x419152-0x0;var _0x4c7cab=_0xcd7a[_0x419152];return _0x4c7cab;};'use strict';var Sequelize=require(_0xacd7('0x0'));module[_0xacd7('0x1')]={'priority':{'type':Sequelize[_0xacd7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xacd7('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xacd7('0x4')]()},'description':{'type':Sequelize[_0xacd7('0x3')]},'interval':{'type':Sequelize[_0xacd7('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index c5e39ac..42dbb39 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 _0x806d=['send','index','map','WhatsappApplication','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','error','stack','name'];(function(_0x558e75,_0x1a1b0c){var _0x74b1ba=function(_0xb72420){while(--_0xb72420){_0x558e75['push'](_0x558e75['shift']());}};_0x74b1ba(++_0x1a1b0c);}(_0x806d,0x131));var _0xd806=function(_0x26fe4b,_0xec37a1){_0x26fe4b=_0x26fe4b-0x0;var _0x5b82ce=_0x806d[_0x26fe4b];return _0x5b82ce;};'use strict';var emlformat=require(_0xd806('0x0'));var rimraf=require(_0xd806('0x1'));var zipdir=require(_0xd806('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd806('0x3'));var Mustache=require(_0xd806('0x4'));var util=require('util');var path=require(_0xd806('0x5'));var sox=require('sox');var csv=require(_0xd806('0x6'));var ejs=require(_0xd806('0x7'));var fs=require('fs');var fs_extra=require(_0xd806('0x8'));var _=require(_0xd806('0x9'));var squel=require(_0xd806('0xa'));var crypto=require(_0xd806('0xb'));var jsforce=require(_0xd806('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd806('0x6'));var querystring=require(_0xd806('0xd'));var Papa=require(_0xd806('0xe'));var Redis=require(_0xd806('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd806('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd806('0x11'));var logger=require(_0xd806('0x12'))('api');var utils=require(_0xd806('0x13'));var config=require(_0xd806('0x14'));var licenseUtil=require(_0xd806('0x15'));var db=require(_0xd806('0x16'))['db'];function respondWithStatusCode(_0x451cba,_0x394569){_0x394569=_0x394569||0xcc;return function(_0x1c751c){if(_0x1c751c){return _0x451cba[_0xd806('0x17')](_0x394569);}return _0x451cba[_0xd806('0x18')](_0x394569)[_0xd806('0x19')]();};}function respondWithResult(_0x32f405,_0x47ef3b){_0x47ef3b=_0x47ef3b||0xc8;return function(_0x17d8bc){if(_0x17d8bc){return _0x32f405[_0xd806('0x18')](_0x47ef3b)[_0xd806('0x1a')](_0x17d8bc);}};}function respondWithFilteredResult(_0x4a2139,_0x7a8ed1){return function(_0x5a4ae4){if(_0x5a4ae4){var _0x33127f=typeof _0x7a8ed1[_0xd806('0x1b')]===_0xd806('0x1c')&&typeof _0x7a8ed1[_0xd806('0x1d')]===_0xd806('0x1c');var _0x1e7f7f=_0x5a4ae4[_0xd806('0x1e')];var _0x332eec=_0x33127f?0x0:_0x7a8ed1[_0xd806('0x1b')];var _0x5bd7a1=_0x33127f?_0x5a4ae4[_0xd806('0x1e')]:_0x7a8ed1[_0xd806('0x1b')]+_0x7a8ed1[_0xd806('0x1d')];var _0x5a3781;if(_0x5bd7a1>=_0x1e7f7f){_0x5bd7a1=_0x1e7f7f;_0x5a3781=0xc8;}else{_0x5a3781=0xce;}_0x4a2139[_0xd806('0x18')](_0x5a3781);return _0x4a2139['set'](_0xd806('0x1f'),_0x332eec+'-'+_0x5bd7a1+'/'+_0x1e7f7f)[_0xd806('0x1a')](_0x5a4ae4);}return null;};}function patchUpdates(_0x222a12){return function(_0x469f01){try{jsonpatch[_0xd806('0x20')](_0x469f01,_0x222a12,!![]);}catch(_0x58c632){return BPromise['reject'](_0x58c632);}return _0x469f01[_0xd806('0x21')]();};}function saveUpdates(_0x3680c1,_0x76392f){return function(_0x95450b){if(_0x95450b){return _0x95450b[_0xd806('0x22')](_0x3680c1)['then'](function(_0x500f9d){return _0x500f9d;});}return null;};}function removeEntity(_0x2a173b,_0x1335c9){return function(_0x17aa45){if(_0x17aa45){return _0x17aa45[_0xd806('0x23')]()[_0xd806('0x24')](function(){_0x2a173b['status'](0xcc)[_0xd806('0x19')]();});}};}function handleEntityNotFound(_0xf8df1e,_0x53782d){return function(_0x479744){if(!_0x479744){_0xf8df1e[_0xd806('0x17')](0x194);}return _0x479744;};}function handleError(_0x5acda8,_0x26bf96){_0x26bf96=_0x26bf96||0x1f4;return function(_0xe9664e){logger[_0xd806('0x25')](_0xe9664e[_0xd806('0x26')]);if(_0xe9664e[_0xd806('0x27')]){delete _0xe9664e['name'];}_0x5acda8['status'](_0x26bf96)[_0xd806('0x28')](_0xe9664e);};}exports[_0xd806('0x29')]=function(_0x10db6c,_0x4a7c5f){var _0x2b6b4d={},_0x25a2f0={},_0x358ae2={'count':0x0,'rows':[]};var _0x524893=_[_0xd806('0x2a')](db[_0xd806('0x2b')][_0xd806('0x2c')],function(_0x441e1d){return{'name':_0x441e1d[_0xd806('0x2d')],'type':_0x441e1d[_0xd806('0x2e')]['key']};});_0x25a2f0['model']=_['map'](_0x524893,'name');_0x25a2f0[_0xd806('0x2f')]=_[_0xd806('0x30')](_0x10db6c[_0xd806('0x2f')]);_0x25a2f0[_0xd806('0x31')]=_[_0xd806('0x32')](_0x25a2f0[_0xd806('0x33')],_0x25a2f0[_0xd806('0x2f')]);_0x2b6b4d[_0xd806('0x34')]=_[_0xd806('0x32')](_0x25a2f0['model'],qs[_0xd806('0x35')](_0x10db6c[_0xd806('0x2f')][_0xd806('0x35')]));_0x2b6b4d[_0xd806('0x34')]=_0x2b6b4d['attributes'][_0xd806('0x36')]?_0x2b6b4d['attributes']:_0x25a2f0[_0xd806('0x33')];if(!_0x10db6c['query']['hasOwnProperty'](_0xd806('0x37'))){_0x2b6b4d[_0xd806('0x1d')]=qs['limit'](_0x10db6c[_0xd806('0x2f')][_0xd806('0x1d')]);_0x2b6b4d['offset']=qs[_0xd806('0x1b')](_0x10db6c[_0xd806('0x2f')]['offset']);}_0x2b6b4d[_0xd806('0x38')]=qs[_0xd806('0x39')](_0x10db6c['query']['sort']);_0x2b6b4d[_0xd806('0x3a')]=qs[_0xd806('0x31')](_['pick'](_0x10db6c[_0xd806('0x2f')],_0x25a2f0[_0xd806('0x31')]),_0x524893);if(_0x10db6c['query']['filter']){_0x2b6b4d['where']=_[_0xd806('0x3b')](_0x2b6b4d[_0xd806('0x3a')],{'$or':_[_0xd806('0x2a')](_0x524893,function(_0x3e69f6){if(_0x3e69f6[_0xd806('0x2e')]!==_0xd806('0x3c')){var _0x370644={};_0x370644[_0x3e69f6[_0xd806('0x27')]]={'$like':'%'+_0x10db6c[_0xd806('0x2f')][_0xd806('0x3d')]+'%'};return _0x370644;}})});}_0x2b6b4d=_['merge']({},_0x2b6b4d,_0x10db6c[_0xd806('0x3e')]);var _0x5c1cbf={'where':_0x2b6b4d[_0xd806('0x3a')]};return db[_0xd806('0x2b')]['count'](_0x5c1cbf)[_0xd806('0x24')](function(_0x54ab4a){_0x358ae2[_0xd806('0x1e')]=_0x54ab4a;if(_0x10db6c['query']['includeAll']){_0x2b6b4d['include']=[{'all':!![]}];}return db[_0xd806('0x2b')]['findAll'](_0x2b6b4d);})[_0xd806('0x24')](function(_0x11a915){_0x358ae2[_0xd806('0x3f')]=_0x11a915;return _0x358ae2;})[_0xd806('0x24')](respondWithFilteredResult(_0x4a7c5f,_0x2b6b4d))[_0xd806('0x40')](handleError(_0x4a7c5f,null));};exports['show']=function(_0x4e7904,_0x3f8ab5){var _0x5a97ae={'raw':!![],'where':{'id':_0x4e7904[_0xd806('0x41')]['id']}},_0x1c4191={};_0x1c4191[_0xd806('0x33')]=_['keys'](db[_0xd806('0x2b')]['rawAttributes']);_0x1c4191[_0xd806('0x2f')]=_[_0xd806('0x30')](_0x4e7904[_0xd806('0x2f')]);_0x1c4191[_0xd806('0x31')]=_['intersection'](_0x1c4191[_0xd806('0x33')],_0x1c4191[_0xd806('0x2f')]);_0x5a97ae[_0xd806('0x34')]=_['intersection'](_0x1c4191[_0xd806('0x33')],qs['fields'](_0x4e7904[_0xd806('0x2f')][_0xd806('0x35')]));_0x5a97ae[_0xd806('0x34')]=_0x5a97ae[_0xd806('0x34')]['length']?_0x5a97ae['attributes']:_0x1c4191[_0xd806('0x33')];if(_0x4e7904[_0xd806('0x2f')]['includeAll']){_0x5a97ae['include']=[{'all':!![]}];}_0x5a97ae=_[_0xd806('0x3b')]({},_0x5a97ae,_0x4e7904[_0xd806('0x3e')]);return db[_0xd806('0x2b')][_0xd806('0x42')](_0x5a97ae)[_0xd806('0x24')](handleEntityNotFound(_0x3f8ab5,null))['then'](respondWithResult(_0x3f8ab5,null))['catch'](handleError(_0x3f8ab5,null));};exports[_0xd806('0x43')]=function(_0x5058ba,_0x5555da){return db[_0xd806('0x2b')][_0xd806('0x43')](_0x5058ba[_0xd806('0x44')],{})['then'](respondWithResult(_0x5555da,0xc9))[_0xd806('0x40')](handleError(_0x5555da,null));};exports['update']=function(_0x45a75c,_0x1e5da1){if(_0x45a75c[_0xd806('0x44')]['id']){delete _0x45a75c[_0xd806('0x44')]['id'];}return db[_0xd806('0x2b')]['find']({'where':{'id':_0x45a75c['params']['id']}})['then'](handleEntityNotFound(_0x1e5da1,null))[_0xd806('0x24')](saveUpdates(_0x45a75c[_0xd806('0x44')],null))['then'](respondWithResult(_0x1e5da1,null))['catch'](handleError(_0x1e5da1,null));};exports[_0xd806('0x23')]=function(_0x34166a,_0x527dcb){return db[_0xd806('0x2b')]['find']({'where':{'id':_0x34166a[_0xd806('0x41')]['id']}})[_0xd806('0x24')](handleEntityNotFound(_0x527dcb,null))['then'](removeEntity(_0x527dcb,null))[_0xd806('0x40')](handleError(_0x527dcb,null));}; \ No newline at end of file +var _0xad07=['rows','show','options','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','update','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','VIRTUAL','filter','merge','WhatsappApplication','then','includeAll','include'];(function(_0x1c1903,_0x47f1db){var _0x1ffc05=function(_0x1d83b3){while(--_0x1d83b3){_0x1c1903['push'](_0x1c1903['shift']());}};_0x1ffc05(++_0x47f1db);}(_0xad07,0xe3));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7ad0('0x0'));var rimraf=require(_0x7ad0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ad0('0x2'));var rp=require(_0x7ad0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7ad0('0x4'));var util=require(_0x7ad0('0x5'));var path=require(_0x7ad0('0x6'));var sox=require('sox');var csv=require(_0x7ad0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ad0('0x8'));var squel=require(_0x7ad0('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7ad0('0xa'));var toCsv=require(_0x7ad0('0x7'));var querystring=require('querystring');var Papa=require(_0x7ad0('0xb'));var Redis=require(_0x7ad0('0xc'));var authService=require(_0x7ad0('0xd'));var qs=require(_0x7ad0('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ad0('0xf'));var logger=require(_0x7ad0('0x10'))(_0x7ad0('0x11'));var utils=require(_0x7ad0('0x12'));var config=require(_0x7ad0('0x13'));var licenseUtil=require(_0x7ad0('0x14'));var db=require(_0x7ad0('0x15'))['db'];function respondWithStatusCode(_0x30d2af,_0x5e1389){_0x5e1389=_0x5e1389||0xcc;return function(_0x572905){if(_0x572905){return _0x30d2af[_0x7ad0('0x16')](_0x5e1389);}return _0x30d2af[_0x7ad0('0x17')](_0x5e1389)[_0x7ad0('0x18')]();};}function respondWithResult(_0x1478e6,_0x51fed3){_0x51fed3=_0x51fed3||0xc8;return function(_0x53cdff){if(_0x53cdff){return _0x1478e6[_0x7ad0('0x17')](_0x51fed3)[_0x7ad0('0x19')](_0x53cdff);}};}function respondWithFilteredResult(_0x456226,_0xcecbc1){return function(_0xebb4da){if(_0xebb4da){var _0x901908=typeof _0xcecbc1[_0x7ad0('0x1a')]===_0x7ad0('0x1b')&&typeof _0xcecbc1['limit']===_0x7ad0('0x1b');var _0x40fa9c=_0xebb4da['count'];var _0x4f45e4=_0x901908?0x0:_0xcecbc1[_0x7ad0('0x1a')];var _0x4f9d6b=_0x901908?_0xebb4da[_0x7ad0('0x1c')]:_0xcecbc1[_0x7ad0('0x1a')]+_0xcecbc1['limit'];var _0x126454;if(_0x4f9d6b>=_0x40fa9c){_0x4f9d6b=_0x40fa9c;_0x126454=0xc8;}else{_0x126454=0xce;}_0x456226['status'](_0x126454);return _0x456226[_0x7ad0('0x1d')]('Content-Range',_0x4f45e4+'-'+_0x4f9d6b+'/'+_0x40fa9c)[_0x7ad0('0x19')](_0xebb4da);}return null;};}function patchUpdates(_0x1795e5){return function(_0x1c5c7c){try{jsonpatch[_0x7ad0('0x1e')](_0x1c5c7c,_0x1795e5,!![]);}catch(_0x481eeb){return BPromise[_0x7ad0('0x1f')](_0x481eeb);}return _0x1c5c7c['save']();};}function saveUpdates(_0x291352,_0x304054){return function(_0x5df5c8){if(_0x5df5c8){return _0x5df5c8[_0x7ad0('0x20')](_0x291352)['then'](function(_0x5edbdf){return _0x5edbdf;});}return null;};}function removeEntity(_0x4be2a0,_0x1d9a26){return function(_0x4fbe51){if(_0x4fbe51){return _0x4fbe51[_0x7ad0('0x21')]()['then'](function(){_0x4be2a0[_0x7ad0('0x17')](0xcc)[_0x7ad0('0x18')]();});}};}function handleEntityNotFound(_0x3894a7,_0x319644){return function(_0x103222){if(!_0x103222){_0x3894a7[_0x7ad0('0x16')](0x194);}return _0x103222;};}function handleError(_0x51716e,_0x14ca11){_0x14ca11=_0x14ca11||0x1f4;return function(_0xf9c854){logger[_0x7ad0('0x22')](_0xf9c854[_0x7ad0('0x23')]);if(_0xf9c854[_0x7ad0('0x24')]){delete _0xf9c854[_0x7ad0('0x24')];}_0x51716e[_0x7ad0('0x17')](_0x14ca11)[_0x7ad0('0x25')](_0xf9c854);};}exports['index']=function(_0x5196df,_0x2b2e49){var _0x380eb3={},_0x8150f5={},_0x21e083={'count':0x0,'rows':[]};var _0x2b0b1e=_['map'](db['WhatsappApplication'][_0x7ad0('0x26')],function(_0x1b4028){return{'name':_0x1b4028[_0x7ad0('0x27')],'type':_0x1b4028[_0x7ad0('0x28')][_0x7ad0('0x29')]};});_0x8150f5[_0x7ad0('0x2a')]=_[_0x7ad0('0x2b')](_0x2b0b1e,_0x7ad0('0x24'));_0x8150f5[_0x7ad0('0x2c')]=_[_0x7ad0('0x2d')](_0x5196df['query']);_0x8150f5['filters']=_[_0x7ad0('0x2e')](_0x8150f5[_0x7ad0('0x2a')],_0x8150f5[_0x7ad0('0x2c')]);_0x380eb3[_0x7ad0('0x2f')]=_[_0x7ad0('0x2e')](_0x8150f5[_0x7ad0('0x2a')],qs[_0x7ad0('0x30')](_0x5196df[_0x7ad0('0x2c')][_0x7ad0('0x30')]));_0x380eb3[_0x7ad0('0x2f')]=_0x380eb3[_0x7ad0('0x2f')][_0x7ad0('0x31')]?_0x380eb3[_0x7ad0('0x2f')]:_0x8150f5['model'];if(!_0x5196df[_0x7ad0('0x2c')][_0x7ad0('0x32')](_0x7ad0('0x33'))){_0x380eb3[_0x7ad0('0x34')]=qs[_0x7ad0('0x34')](_0x5196df[_0x7ad0('0x2c')][_0x7ad0('0x34')]);_0x380eb3[_0x7ad0('0x1a')]=qs[_0x7ad0('0x1a')](_0x5196df[_0x7ad0('0x2c')]['offset']);}_0x380eb3[_0x7ad0('0x35')]=qs['sort'](_0x5196df[_0x7ad0('0x2c')][_0x7ad0('0x36')]);_0x380eb3[_0x7ad0('0x37')]=qs['filters'](_[_0x7ad0('0x38')](_0x5196df[_0x7ad0('0x2c')],_0x8150f5[_0x7ad0('0x39')]),_0x2b0b1e);if(_0x5196df[_0x7ad0('0x2c')]['filter']){_0x380eb3[_0x7ad0('0x37')]=_['merge'](_0x380eb3['where'],{'$or':_[_0x7ad0('0x2b')](_0x2b0b1e,function(_0x56f6a0){if(_0x56f6a0['type']!==_0x7ad0('0x3a')){var _0x1faccd={};_0x1faccd[_0x56f6a0[_0x7ad0('0x24')]]={'$like':'%'+_0x5196df[_0x7ad0('0x2c')][_0x7ad0('0x3b')]+'%'};return _0x1faccd;}})});}_0x380eb3=_[_0x7ad0('0x3c')]({},_0x380eb3,_0x5196df['options']);var _0x448962={'where':_0x380eb3[_0x7ad0('0x37')]};return db[_0x7ad0('0x3d')]['count'](_0x448962)[_0x7ad0('0x3e')](function(_0x3c92d5){_0x21e083[_0x7ad0('0x1c')]=_0x3c92d5;if(_0x5196df['query'][_0x7ad0('0x3f')]){_0x380eb3[_0x7ad0('0x40')]=[{'all':!![]}];}return db[_0x7ad0('0x3d')]['findAll'](_0x380eb3);})['then'](function(_0x1e73d6){_0x21e083[_0x7ad0('0x41')]=_0x1e73d6;return _0x21e083;})['then'](respondWithFilteredResult(_0x2b2e49,_0x380eb3))['catch'](handleError(_0x2b2e49,null));};exports[_0x7ad0('0x42')]=function(_0x267644,_0x448fe6){var _0x43dbd2={'raw':!![],'where':{'id':_0x267644['params']['id']}},_0x5f5959={};_0x5f5959['model']=_[_0x7ad0('0x2d')](db[_0x7ad0('0x3d')][_0x7ad0('0x26')]);_0x5f5959[_0x7ad0('0x2c')]=_['keys'](_0x267644[_0x7ad0('0x2c')]);_0x5f5959[_0x7ad0('0x39')]=_['intersection'](_0x5f5959['model'],_0x5f5959[_0x7ad0('0x2c')]);_0x43dbd2['attributes']=_['intersection'](_0x5f5959[_0x7ad0('0x2a')],qs[_0x7ad0('0x30')](_0x267644[_0x7ad0('0x2c')][_0x7ad0('0x30')]));_0x43dbd2[_0x7ad0('0x2f')]=_0x43dbd2[_0x7ad0('0x2f')][_0x7ad0('0x31')]?_0x43dbd2['attributes']:_0x5f5959[_0x7ad0('0x2a')];if(_0x267644['query']['includeAll']){_0x43dbd2[_0x7ad0('0x40')]=[{'all':!![]}];}_0x43dbd2=_[_0x7ad0('0x3c')]({},_0x43dbd2,_0x267644[_0x7ad0('0x43')]);return db[_0x7ad0('0x3d')][_0x7ad0('0x44')](_0x43dbd2)[_0x7ad0('0x3e')](handleEntityNotFound(_0x448fe6,null))[_0x7ad0('0x3e')](respondWithResult(_0x448fe6,null))[_0x7ad0('0x45')](handleError(_0x448fe6,null));};exports['create']=function(_0x313397,_0x24372d){return db[_0x7ad0('0x3d')][_0x7ad0('0x46')](_0x313397[_0x7ad0('0x47')],{})[_0x7ad0('0x3e')](respondWithResult(_0x24372d,0xc9))[_0x7ad0('0x45')](handleError(_0x24372d,null));};exports[_0x7ad0('0x20')]=function(_0x2677be,_0x23b613){if(_0x2677be['body']['id']){delete _0x2677be['body']['id'];}return db[_0x7ad0('0x3d')][_0x7ad0('0x44')]({'where':{'id':_0x2677be[_0x7ad0('0x48')]['id']}})[_0x7ad0('0x3e')](handleEntityNotFound(_0x23b613,null))[_0x7ad0('0x3e')](saveUpdates(_0x2677be[_0x7ad0('0x47')],null))[_0x7ad0('0x3e')](respondWithResult(_0x23b613,null))[_0x7ad0('0x45')](handleError(_0x23b613,null));};exports[_0x7ad0('0x21')]=function(_0x61d8ac,_0x4ea6d6){return db[_0x7ad0('0x3d')][_0x7ad0('0x44')]({'where':{'id':_0x61d8ac[_0x7ad0('0x48')]['id']}})['then'](handleEntityNotFound(_0x4ea6d6,null))[_0x7ad0('0x3e')](removeEntity(_0x4ea6d6,null))[_0x7ad0('0x45')](handleError(_0x4ea6d6,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index df4f4fa..d5e3f5c 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 _0x6379=['lodash','util','../../config/logger','api','moment','request-promise','path','./whatsappApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6379,0x84));var _0x9637=function(_0x47bf8b,_0x5c377e){_0x47bf8b=_0x47bf8b-0x0;var _0x2d71ff=_0x6379[_0x47bf8b];return _0x2d71ff;};'use strict';var _=require(_0x9637('0x0'));var util=require(_0x9637('0x1'));var logger=require(_0x9637('0x2'))(_0x9637('0x3'));var moment=require(_0x9637('0x4'));var BPromise=require('bluebird');var rp=require(_0x9637('0x5'));var fs=require('fs');var path=require(_0x9637('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9637('0x7'));module[_0x9637('0x8')]=function(_0x19f7d0,_0x25087c){return _0x19f7d0[_0x9637('0x9')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9637('0xa'),'collate':_0x9637('0xb')});}; \ No newline at end of file +var _0x9221=['exports','WhatsappApplication','whatsapp_applications','utf8mb4','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x9221,0x64));var _0x1922=function(_0x22bae4,_0x22474b){_0x22bae4=_0x22bae4-0x0;var _0x2047b6=_0x9221[_0x22bae4];return _0x2047b6;};'use strict';var _=require('lodash');var util=require(_0x1922('0x0'));var logger=require(_0x1922('0x1'))('api');var moment=require(_0x1922('0x2'));var BPromise=require(_0x1922('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1922('0x4'));var rimraf=require(_0x1922('0x5'));var config=require(_0x1922('0x6'));var attributes=require(_0x1922('0x7'));module[_0x1922('0x8')]=function(_0x1944a5,_0x1351a0){return _0x1944a5['define'](_0x1922('0x9'),attributes,{'tableName':_0x1922('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1922('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 87ca003..c465b83 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 _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x250499,_0x54cf95){var _0x557736=function(_0xffa107){while(--_0xffa107){_0x250499['push'](_0x250499['shift']());}};_0x557736(++_0x54cf95);}(_0x54ef,0x112));var _0xf54e=function(_0x116a7b,_0x2d19a1){_0x116a7b=_0x116a7b-0x0;var _0x557d70=_0x54ef[_0x116a7b];return _0x557d70;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x255543,_0xde9908){var _0x57cb50=function(_0x5c0e67){while(--_0x5c0e67){_0x255543['push'](_0x255543['shift']());}};_0x57cb50(++_0xde9908);}(_0x6aa7,0x178));var _0x76aa=function(_0xbe3e2b,_0x583d47){_0xbe3e2b=_0xbe3e2b-0x0;var _0x2ce45b=_0x6aa7[_0xbe3e2b];return _0x2ce45b;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index dd21353..1db6efb 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 _0x7da7=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','/:id/messages','/:id/download','download','create','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','whatsappinteraction:destroy','destroy','delete','/:id/tags','removeTags','multer'];(function(_0x1bd3ab,_0x352c42){var _0x37e394=function(_0x2f581d){while(--_0x2f581d){_0x1bd3ab['push'](_0x1bd3ab['shift']());}};_0x37e394(++_0x352c42);}(_0x7da7,0x10d));var _0x77da=function(_0x1b3a5c,_0x2f9d5f){_0x1b3a5c=_0x1b3a5c-0x0;var _0x2ae8cb=_0x7da7[_0x1b3a5c];return _0x2ae8cb;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var fs_extra=require(_0x77da('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var controller=require('./whatsappInteraction.controller');router[_0x77da('0x7')]('/',auth[_0x77da('0x8')](),controller['index']);router[_0x77da('0x7')]('/describe',auth[_0x77da('0x8')](),controller[_0x77da('0x9')]);router[_0x77da('0x7')](_0x77da('0xa'),auth[_0x77da('0x8')](),controller['show']);router[_0x77da('0x7')](_0x77da('0xb'),auth[_0x77da('0x8')](),controller['getMessages']);router[_0x77da('0x7')](_0x77da('0xc'),auth[_0x77da('0x8')](),controller[_0x77da('0xd')]);router['post']('/',auth[_0x77da('0x8')](),controller[_0x77da('0xe')]);router[_0x77da('0xf')]('/:id/messages',auth['isAuthenticated'](),controller[_0x77da('0x10')]);router[_0x77da('0xf')]('/:id/tags',auth[_0x77da('0x8')](),interaction[_0x77da('0x11')](_0x77da('0x12'),_0x77da('0x13')),controller['addTags']);router[_0x77da('0x14')]('/:id',auth[_0x77da('0x8')](),interaction[_0x77da('0x11')](_0x77da('0x12'),_0x77da('0x15')),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x77da('0x11')](_0x77da('0x12'),_0x77da('0x16')),controller[_0x77da('0x17')]);router[_0x77da('0x18')](_0x77da('0x19'),auth[_0x77da('0x8')](),controller[_0x77da('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x1115=['get','show','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe'];(function(_0x1bdca2,_0x173eff){var _0x45a947=function(_0x5a790d){while(--_0x5a790d){_0x1bdca2['push'](_0x1bdca2['shift']());}};_0x45a947(++_0x173eff);}(_0x1115,0x1b6));var _0x5111=function(_0x4e25ae,_0x20ba82){_0x4e25ae=_0x4e25ae-0x0;var _0x481980=_0x1115[_0x4e25ae];return _0x481980;};'use strict';var multer=require('multer');var util=require(_0x5111('0x0'));var path=require(_0x5111('0x1'));var timeout=require(_0x5111('0x2'));var express=require(_0x5111('0x3'));var router=express[_0x5111('0x4')]();var fs_extra=require(_0x5111('0x5'));var auth=require(_0x5111('0x6'));var interaction=require(_0x5111('0x7'));var config=require(_0x5111('0x8'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0x5111('0x9')](),controller[_0x5111('0xa')]);router['get'](_0x5111('0xb'),auth[_0x5111('0x9')](),controller['describe']);router[_0x5111('0xc')]('/:id',auth[_0x5111('0x9')](),controller[_0x5111('0xd')]);router['get']('/:id/messages',auth[_0x5111('0x9')](),controller['getMessages']);router[_0x5111('0xc')]('/:id/download',auth[_0x5111('0x9')](),controller[_0x5111('0xe')]);router[_0x5111('0xf')]('/',auth[_0x5111('0x9')](),controller[_0x5111('0x10')]);router[_0x5111('0xf')](_0x5111('0x11'),auth[_0x5111('0x9')](),controller[_0x5111('0x12')]);router[_0x5111('0xf')](_0x5111('0x13'),auth[_0x5111('0x9')](),interaction[_0x5111('0x14')](_0x5111('0x15'),_0x5111('0x16')),controller[_0x5111('0x17')]);router[_0x5111('0x18')](_0x5111('0x19'),auth['isAuthenticated'](),interaction[_0x5111('0x14')]('whatsapp','whatsappinteraction:update'),controller[_0x5111('0x1a')]);router[_0x5111('0x1b')](_0x5111('0x19'),auth['isAuthenticated'](),interaction[_0x5111('0x14')](_0x5111('0x15'),'whatsappinteraction:destroy'),controller[_0x5111('0x1c')]);router[_0x5111('0x1b')](_0x5111('0x13'),auth[_0x5111('0x9')](),controller['removeTags']);module[_0x5111('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 bc7cdd5..9ac84ab 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 _0x578c=['BOOLEAN','INTEGER','sequelize','moment','exports','DATE','STRING','ENUM','out'];(function(_0xe6f1fb,_0x53c61a){var _0x22f673=function(_0x5adcb7){while(--_0x5adcb7){_0xe6f1fb['push'](_0xe6f1fb['shift']());}};_0x22f673(++_0x53c61a);}(_0x578c,0x158));var _0xc578=function(_0x1da9eb,_0x550aa1){_0x1da9eb=_0x1da9eb-0x0;var _0xe87e46=_0x578c[_0x1da9eb];return _0xe87e46;};'use strict';var Sequelize=require(_0xc578('0x0'));var moment=require(_0xc578('0x1'));module[_0xc578('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc578('0x3')]},'disposition':{'type':Sequelize[_0xc578('0x4')]},'secondDisposition':{'type':Sequelize[_0xc578('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc578('0x4')]},'phone':{'type':Sequelize[_0xc578('0x4')]},'read1stAt':{'type':Sequelize[_0xc578('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xc578('0x5')]('in',_0xc578('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc578('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc578('0x5')]('in',_0xc578('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc578('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc578('0x8')]}}; \ No newline at end of file +var _0xdf5d=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize','moment','exports'];(function(_0x4f7a1d,_0x5c86d8){var _0x34c972=function(_0x44a149){while(--_0x44a149){_0x4f7a1d['push'](_0x4f7a1d['shift']());}};_0x34c972(++_0x5c86d8);}(_0xdf5d,0x126));var _0xddf5=function(_0x104299,_0x202943){_0x104299=_0x104299-0x0;var _0x20ba3f=_0xdf5d[_0x104299];return _0x20ba3f;};'use strict';var Sequelize=require(_0xddf5('0x0'));var moment=require(_0xddf5('0x1'));module[_0xddf5('0x2')]={'closed':{'type':Sequelize[_0xddf5('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xddf5('0x4')]},'disposition':{'type':Sequelize[_0xddf5('0x5')]},'secondDisposition':{'type':Sequelize[_0xddf5('0x5')]},'thirdDisposition':{'type':Sequelize[_0xddf5('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xddf5('0x5')]},'read1stAt':{'type':Sequelize[_0xddf5('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xddf5('0x6')]('in',_0xddf5('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xddf5('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xddf5('0x6')]('in',_0xddf5('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xddf5('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xddf5('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index d8b13d7..32cf01c 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 _0x5630=['create','body','update','params','describe','addMessage','WhatsappMessage','ids','omit','findOne','hasOwnProperty','order','where','pick','filter','$gte','split','format','includeAll','findAll','rows','setTags','name','emit','whatsappInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','CmContact','Contact','Attachment','Messages','createdAt','secret','WhatsappAccount','Account','push','Owner','fullname','get','mkdirSync','Whatsapp','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','YYYY-MM-DD\x20HH:mm:ss','out','firstName','lastName','direction','read','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','rimraf','zip-dir','moment','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','sendStatus','index','map','WhatsappInteraction','rawAttributes','key','getOptions','whatsapp','query','user','catch','show','model','keys','filters','intersection','attributes','fields','include','merge','options','find'];(function(_0x3f0091,_0x3670b4){var _0x34e10b=function(_0x58e39d){while(--_0x58e39d){_0x3f0091['push'](_0x3f0091['shift']());}};_0x34e10b(++_0x3670b4);}(_0x5630,0xc3));var _0x0563=function(_0x31769d,_0x1d2997){_0x31769d=_0x31769d-0x0;var _0x19ab46=_0x5630[_0x31769d];return _0x19ab46;};'use strict';var rimraf=require(_0x0563('0x0'));var zipdir=require(_0x0563('0x1'));var moment=require(_0x0563('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var ejs=require(_0x0563('0x3'));var fs=require('fs');var _=require(_0x0563('0x4'));var Redis=require(_0x0563('0x5'));var interaction=require(_0x0563('0x6'));var qs=require(_0x0563('0x7'));var pdf=require(_0x0563('0x8'));var logger=require('../../config/logger')('api');var config=require(_0x0563('0x9'));var db=require(_0x0563('0xa'))['db'];config[_0x0563('0xb')]=_[_0x0563('0xc')](config['redis'],{'host':_0x0563('0xd'),'port':0x18eb});var socket=require(_0x0563('0xe'))(new Redis(config[_0x0563('0xb')]));require(_0x0563('0xf'))[_0x0563('0x10')](socket);function respondWithStatusCode(_0x1f7ac6,_0x715076){_0x715076=_0x715076||0xcc;return function(_0x38c2b3){if(_0x38c2b3){return _0x1f7ac6['sendStatus'](_0x715076);}return _0x1f7ac6[_0x0563('0x11')](_0x715076)[_0x0563('0x12')]();};}function respondWithResult(_0x1296ae,_0x2c056e){_0x2c056e=_0x2c056e||0xc8;return function(_0x36d2fa){if(_0x36d2fa){return _0x1296ae[_0x0563('0x11')](_0x2c056e)[_0x0563('0x13')](_0x36d2fa);}};}function respondWithFilteredResult(_0x427755,_0x12d437){return function(_0x2d81df){if(_0x2d81df){var _0x2214a3=typeof _0x12d437[_0x0563('0x14')]==='undefined'&&typeof _0x12d437[_0x0563('0x15')]===_0x0563('0x16');var _0xef49f9=_0x2d81df[_0x0563('0x17')];var _0x538810=_0x2214a3?0x0:_0x12d437['offset'];var _0x2f85c1=_0x2214a3?_0x2d81df['count']:_0x12d437[_0x0563('0x14')]+_0x12d437[_0x0563('0x15')];var _0x50acb5;if(_0x2f85c1>=_0xef49f9){_0x2f85c1=_0xef49f9;_0x50acb5=0xc8;}else{_0x50acb5=0xce;}_0x427755[_0x0563('0x11')](_0x50acb5);return _0x427755['set'](_0x0563('0x18'),_0x538810+'-'+_0x2f85c1+'/'+_0xef49f9)[_0x0563('0x13')](_0x2d81df);}return null;};}function saveUpdates(_0x9a7a42){return function(_0x3a7b4a){if(_0x3a7b4a){return _0x3a7b4a['update'](_0x9a7a42)[_0x0563('0x19')](function(_0x2ab6ef){return _0x2ab6ef;});}return null;};}function removeEntity(_0x38dea1){return function(_0x3e6bde){if(_0x3e6bde){return _0x3e6bde[_0x0563('0x1a')]()['then'](function(){_0x38dea1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39e464){return function(_0x35c163){if(!_0x35c163){_0x39e464[_0x0563('0x1b')](0x194);}return _0x35c163;};}function handleError(_0x1b5c65,_0x43e1ac){_0x43e1ac=_0x43e1ac||0x1f4;return function(_0x35c920){logger['error'](_0x35c920['stack']);if(_0x35c920['name']){delete _0x35c920['name'];}_0x1b5c65['status'](_0x43e1ac)['send'](_0x35c920);};}exports[_0x0563('0x1c')]=function(_0x14fd98,_0x4c6952){var _0x5f04bd={};var _0x4cc6af=_[_0x0563('0x1d')](db[_0x0563('0x1e')][_0x0563('0x1f')],function(_0x3f1ee2){return{'name':_0x3f1ee2['fieldName'],'type':_0x3f1ee2['type'][_0x0563('0x20')]};});_0x5f04bd=qs[_0x0563('0x21')](_0x4cc6af,_0x14fd98);return interaction['findAll'](_0x0563('0x22'),_0x14fd98[_0x0563('0x23')],_0x14fd98[_0x0563('0x24')],_0x5f04bd,_0x4cc6af)[_0x0563('0x19')](respondWithFilteredResult(_0x4c6952,_0x5f04bd))[_0x0563('0x25')](handleError(_0x4c6952,null));};exports[_0x0563('0x26')]=function(_0x540d23,_0x39bc3a){var _0xd08f9c={'raw':![],'where':{'id':_0x540d23['params']['id']}},_0x59a355={};_0x59a355[_0x0563('0x27')]=_['keys'](db[_0x0563('0x1e')][_0x0563('0x1f')]);_0x59a355[_0x0563('0x23')]=_[_0x0563('0x28')](_0x540d23[_0x0563('0x23')]);_0x59a355[_0x0563('0x29')]=_[_0x0563('0x2a')](_0x59a355[_0x0563('0x27')],_0x59a355[_0x0563('0x23')]);_0xd08f9c[_0x0563('0x2b')]=_[_0x0563('0x2a')](_0x59a355[_0x0563('0x27')],qs[_0x0563('0x2c')](_0x540d23[_0x0563('0x23')][_0x0563('0x2c')]));_0xd08f9c['attributes']=_0xd08f9c[_0x0563('0x2b')]['length']?_0xd08f9c['attributes']:_0x59a355[_0x0563('0x27')];if(_0x540d23[_0x0563('0x23')]['includeAll']){_0xd08f9c[_0x0563('0x2d')]=[{'all':!![]}];}_0xd08f9c=_[_0x0563('0x2e')]({},_0xd08f9c,_0x540d23[_0x0563('0x2f')]);return db[_0x0563('0x1e')][_0x0563('0x30')](_0xd08f9c)['then'](handleEntityNotFound(_0x39bc3a,null))[_0x0563('0x19')](respondWithResult(_0x39bc3a,null))['catch'](handleError(_0x39bc3a,null));};exports[_0x0563('0x31')]=function(_0x2186eb,_0x240f3b){return db[_0x0563('0x1e')][_0x0563('0x31')](_0x2186eb[_0x0563('0x32')],{})[_0x0563('0x19')](respondWithResult(_0x240f3b,0xc9))[_0x0563('0x25')](handleError(_0x240f3b,null));};exports[_0x0563('0x33')]=function(_0xe04985,_0x5ada65){if(_0xe04985[_0x0563('0x32')]['id']){delete _0xe04985[_0x0563('0x32')]['id'];}return db[_0x0563('0x1e')]['find']({'where':{'id':_0xe04985[_0x0563('0x34')]['id']}})['then'](handleEntityNotFound(_0x5ada65,null))[_0x0563('0x19')](saveUpdates(_0xe04985[_0x0563('0x32')],null))[_0x0563('0x19')](respondWithResult(_0x5ada65,null))[_0x0563('0x25')](handleError(_0x5ada65,null));};exports[_0x0563('0x1a')]=function(_0x334df7,_0x58b1ff){return db[_0x0563('0x1e')][_0x0563('0x30')]({'where':{'id':_0x334df7[_0x0563('0x34')]['id']}})[_0x0563('0x19')](handleEntityNotFound(_0x58b1ff,null))[_0x0563('0x19')](removeEntity(_0x58b1ff,null))[_0x0563('0x25')](handleError(_0x58b1ff,null));};exports[_0x0563('0x35')]=function(_0x1b2216,_0x13560e){return db[_0x0563('0x1e')][_0x0563('0x35')]()[_0x0563('0x19')](respondWithResult(_0x13560e,null))[_0x0563('0x25')](handleError(_0x13560e,null));};exports[_0x0563('0x36')]=function(_0x445239,_0xf899c2){return db[_0x0563('0x37')][_0x0563('0x30')]({'where':{'id':_0x445239['params']['id']}})[_0x0563('0x19')](handleEntityNotFound(_0xf899c2,null))['then'](function(_0x464393){if(_0x464393){return _0x464393[_0x0563('0x36')](_0x445239[_0x0563('0x32')][_0x0563('0x38')],_[_0x0563('0x39')](_0x445239['body'],[_0x0563('0x38'),'id'])||{});}})[_0x0563('0x19')](respondWithResult(_0xf899c2,null))[_0x0563('0x25')](handleError(_0xf899c2,null));};exports['getMessages']=function(_0x3469c3,_0xc2b9f9){var _0x57b3f3={'raw':![],'where':{}};var _0xa1715d={};var _0x454dec={'count':0x0,'rows':[]};return db[_0x0563('0x1e')][_0x0563('0x3a')]({'where':{'id':_0x3469c3[_0x0563('0x34')]['id']}})[_0x0563('0x19')](handleEntityNotFound(_0xc2b9f9,null))[_0x0563('0x19')](function(_0x52e2ee){if(_0x52e2ee){_0xa1715d[_0x0563('0x27')]=_[_0x0563('0x28')](db[_0x0563('0x37')][_0x0563('0x1f')]);_0xa1715d[_0x0563('0x23')]=_[_0x0563('0x28')](_0x3469c3['query']);_0xa1715d['filters']=_['intersection'](_0xa1715d['model'],_0xa1715d[_0x0563('0x23')]);_0x57b3f3[_0x0563('0x2b')]=_[_0x0563('0x2a')](_0xa1715d[_0x0563('0x27')],qs['fields'](_0x3469c3[_0x0563('0x23')][_0x0563('0x2c')]));_0x57b3f3[_0x0563('0x2b')]=_0x57b3f3['attributes']['length']?_0x57b3f3[_0x0563('0x2b')]:_0xa1715d['model'];if(!_0x3469c3['query'][_0x0563('0x3b')]('nolimit')){_0x57b3f3[_0x0563('0x15')]=qs[_0x0563('0x15')](_0x3469c3[_0x0563('0x23')][_0x0563('0x15')]);_0x57b3f3[_0x0563('0x14')]=qs[_0x0563('0x14')](_0x3469c3[_0x0563('0x23')]['offset']);}_0x57b3f3[_0x0563('0x3c')]=qs['sort'](_0x3469c3[_0x0563('0x23')]['sort']);_0x57b3f3[_0x0563('0x3d')]=qs[_0x0563('0x29')](_[_0x0563('0x3e')](_0x3469c3[_0x0563('0x23')],_0xa1715d['filters']));_0x57b3f3['where']['WhatsappInteractionId']=_0x52e2ee['id'];if(_0x3469c3[_0x0563('0x23')][_0x0563('0x3f')]){_0x57b3f3[_0x0563('0x3d')]=_['merge'](_0x57b3f3[_0x0563('0x3d')],{'$or':_[_0x0563('0x1d')](_0x57b3f3[_0x0563('0x2b')],function(_0x30c389){var _0x169a28={};_0x169a28[_0x30c389]={'$like':'%'+_0x3469c3['query']['filter']+'%'};return _0x169a28;})});}if(_0x3469c3[_0x0563('0x23')][_0x0563('0x40')]){var _0x182056=_0x3469c3['query'][_0x0563('0x40')][_0x0563('0x41')](',');var _0x25a9da={};_0x25a9da[_0x182056[0x0]]={'$gte':moment(_0x182056[0x1])[_0x0563('0x42')]('YYYY-MM-DD\x20HH:mm:ss')};_0x57b3f3[_0x0563('0x3d')]=_['merge'](_0x57b3f3[_0x0563('0x3d')],_0x25a9da);}_0x57b3f3=_['merge']({},_0x57b3f3,_0x3469c3[_0x0563('0x2f')]);return db['WhatsappMessage'][_0x0563('0x17')]({'where':_0x57b3f3[_0x0563('0x3d')]})['then'](function(_0x5a821e){_0x454dec['count']=_0x5a821e;if(_0x3469c3[_0x0563('0x23')][_0x0563('0x43')]){_0x57b3f3['include']=[{'all':!![]}];}return db[_0x0563('0x37')][_0x0563('0x44')](_0x57b3f3);})[_0x0563('0x19')](function(_0x34bde0){_0x454dec[_0x0563('0x45')]=_0x34bde0;return _0x454dec;});}})[_0x0563('0x19')](respondWithFilteredResult(_0xc2b9f9,_0x57b3f3))[_0x0563('0x25')](handleError(_0xc2b9f9,null));};exports['addTags']=function(_0x6e7d3d,_0x41e964){return db['WhatsappInteraction'][_0x0563('0x30')]({'where':{'id':_0x6e7d3d[_0x0563('0x34')]['id']}})[_0x0563('0x19')](handleEntityNotFound(_0x41e964,null))[_0x0563('0x19')](function(_0x1b9192){if(_0x1b9192){return _0x1b9192[_0x0563('0x46')](_0x6e7d3d['body'][_0x0563('0x38')],_[_0x0563('0x39')](_0x6e7d3d[_0x0563('0x32')],[_0x0563('0x38'),'id'])||{})['spread'](function(){return db['Tag'][_0x0563('0x44')]({'attributes':['id',_0x0563('0x47'),'color'],'where':{'id':_0x6e7d3d[_0x0563('0x32')][_0x0563('0x38')]}});})[_0x0563('0x19')](function(_0x4d0fa3){socket[_0x0563('0x48')](_0x0563('0x49'),{'id':Number(_0x6e7d3d[_0x0563('0x34')]['id']),'tags':_0x4d0fa3||[]});return{'id':Number(_0x6e7d3d['params']['id']),'tags':_0x4d0fa3||[]};});}})['then'](respondWithResult(_0x41e964,null))['catch'](handleError(_0x41e964,null));};exports[_0x0563('0x4a')]=function(_0x237deb,_0xe68c92){return db[_0x0563('0x1e')][_0x0563('0x30')]({'where':{'id':_0x237deb[_0x0563('0x34')]['id']}})[_0x0563('0x19')](handleEntityNotFound(_0xe68c92,null))[_0x0563('0x19')](function(_0x31afcc){if(_0x31afcc){return _0x31afcc['removeTags'](_0x237deb[_0x0563('0x23')]['ids']);}})[_0x0563('0x19')](respondWithStatusCode(_0xe68c92,null))['catch'](handleError(_0xe68c92,null));};exports['download']=function(_0x35f82a,_0x3b78b2){var _0x3c5f79=moment()[_0x0563('0x4b')]()[_0x0563('0x4c')]();var _0xf96cc9=path[_0x0563('0x4d')](config[_0x0563('0x4e')],_0x0563('0x4f'),_0x0563('0x50'),_0x0563('0x51'));var _0x1653b2=path[_0x0563('0x4d')](config[_0x0563('0x4e')],_0x0563('0x4f'),_0x0563('0x50'),_0x0563('0x52'));var _0x15cd74=path['join'](_0xf96cc9,_0x3c5f79);var _0x23831a=util[_0x0563('0x42')](_0x0563('0x53'),_0x35f82a[_0x0563('0x34')]['id'],_0x3c5f79);var _0x239c8d=path[_0x0563('0x4d')](_0xf96cc9,_0x23831a);var _0x2a57c2=[];_0x2a57c2['push']({'model':db[_0x0563('0x54')],'as':_0x0563('0x54'),'attributes':['id','fullname'],'raw':!![]});_0x2a57c2['push']({'model':db[_0x0563('0x55')],'as':_0x0563('0x56'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x35f82a[_0x0563('0x23')][_0x0563('0x52')]){_0x2a57c2['push']({'model':db[_0x0563('0x57')],'as':'Attachment','raw':!![]});}var _0x79e54f=[{'model':db['WhatsappMessage'],'as':_0x0563('0x58'),'attributes':['id','body',_0x0563('0x59'),'direction',_0x0563('0x5a'),'read'],'include':_0x2a57c2}];_0x79e54f['push']({'model':db[_0x0563('0x5b')],'as':_0x0563('0x5c'),'attributes':['id',_0x0563('0x47')]});_0x79e54f[_0x0563('0x5d')]({'model':db['User'],'as':_0x0563('0x5e'),'attributes':['id',_0x0563('0x5f')]});return db[_0x0563('0x1e')]['find']({'where':{'id':_0x35f82a[_0x0563('0x34')]['id']},'include':_0x79e54f})['then'](handleEntityNotFound(_0x3b78b2,null))[_0x0563('0x19')](function(_0x58fa38){if(_0x58fa38){var _0x48e62b=_0x58fa38[_0x0563('0x60')]({'plain':!![]});fs[_0x0563('0x61')](_0x15cd74);var _0x28f756={'channel':_0x0563('0x62'),'account':_0x48e62b['Account'][_0x0563('0x47')],'agent':_0x48e62b['Owner']?_0x48e62b[_0x0563('0x5e')][_0x0563('0x5f')]:_0x0563('0x63'),'createdAt':moment(_0x48e62b[_0x0563('0x59')])[_0x0563('0x42')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x48e62b[_0x0563('0x64')]?moment(_0x48e62b[_0x0563('0x65')])[_0x0563('0x42')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x48e62b[_0x0563('0x66')],'messages':_(_0x48e62b[_0x0563('0x58')])[_0x0563('0x3f')]({'secret':![]})[_0x0563('0x1d')](function(_0x4cf183){if(_0x4cf183[_0x0563('0x57')]){var _0xcf68b8=path[_0x0563('0x4d')](_0x1653b2,_0x4cf183['Attachment'][_0x0563('0x67')]);if(fs[_0x0563('0x68')](_0xcf68b8)){fs[_0x0563('0x69')](_0xcf68b8)['pipe'](fs['createWriteStream'](path['join'](_0x15cd74,_0x4cf183[_0x0563('0x57')][_0x0563('0x67')])));}}return{'date':moment(_0x4cf183['createdAt'])[_0x0563('0x42')](_0x0563('0x6a'))[_0x0563('0x4c')](),'sender':_0x4cf183['direction']===_0x0563('0x6b')?_0x4cf183[_0x0563('0x54')]?_0x4cf183['User'][_0x0563('0x5f')]:'System':_0x4cf183[_0x0563('0x56')][_0x0563('0x6c')]+(_0x4cf183[_0x0563('0x56')][_0x0563('0x6d')]?'\x20'+_0x4cf183['Contact'][_0x0563('0x6d')]:''),'body':_0x4cf183['Attachment']?_0x4cf183[_0x0563('0x57')]['basename']:_0x4cf183[_0x0563('0x32')],'direction':_0x4cf183[_0x0563('0x6e')]===_0x0563('0x6b')?'A':'C','secret':_0x4cf183[_0x0563('0x5a')],'read':_0x4cf183[_0x0563('0x6f')],'attachment':_0x4cf183[_0x0563('0x57')]};})[_0x0563('0x70')]()};return ejs[_0x0563('0x71')](path[_0x0563('0x4d')](config['root'],_0x0563('0x4f'),_0x0563('0x72'),'downloadInteraction.ejs'),{'interaction':_0x28f756})[_0x0563('0x19')](function(_0x14383e){var _0x148fc7=path[_0x0563('0x4d')](_0x15cd74,_0x0563('0x73')+_0x48e62b['id']+'-'+_0x3c5f79+_0x0563('0x74'));var _0x231250={'path':_0x148fc7,'channel':_0x0563('0x62'),'interactionId':_0x48e62b['id']};return pdf[_0x0563('0x75')](_0x14383e,_0x231250);})[_0x0563('0x19')](function(){return new BPromise(function(_0xae5488,_0x4a4d91){zipdir(_0x15cd74,{'saveTo':_0x239c8d},function(_0x139f09,_0x1db13e){if(_0x139f09)return _0x4a4d91(_0x139f09);return _0xae5488(_0x1db13e);});})[_0x0563('0x19')](function(){return new BPromise(function(_0x48d979,_0x551246){rimraf(_0x15cd74,function(_0x4aa191){if(_0x4aa191)_0x551246(_0x4aa191);return _0x48d979();});});})[_0x0563('0x19')](function(){return _0x3b78b2[_0x0563('0x76')](_0x239c8d,_0x23831a,function(_0x5a4833){if(_0x5a4833){console[_0x0563('0x77')](_0x0563('0x78'),_0x5a4833);}else{fs[_0x0563('0x79')](_0x239c8d);}});});});}else{return _0x3b78b2[_0x0563('0x1b')](0xc8);}})['catch'](handleError(_0x3b78b2,null));}; \ No newline at end of file +var _0xa25d=['intersection','model','attributes','fields','includeAll','options','find','create','body','update','describe','addMessage','WhatsappMessage','ids','omit','findOne','length','hasOwnProperty','nolimit','sort','where','pick','WhatsappInteractionId','filter','merge','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','emit','whatsappInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','secret','read','Account','Owner','mkdirSync','Whatsapp','createdAt','closed','closedAt','disposition','basename','existsSync','createReadStream','createWriteStream','out','Contact','renderFile','transcript-','.pdf','log','err','unlinkSync','rimraf','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','status','offset','undefined','limit','count','set','json','then','destroy','end','sendStatus','stack','name','index','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','catch','show','params','WhatsappInteraction','keys','filters'];(function(_0x3f5522,_0x28e324){var _0x4731f1=function(_0xfe154){while(--_0xfe154){_0x3f5522['push'](_0x3f5522['shift']());}};_0x4731f1(++_0x28e324);}(_0xa25d,0x1b3));var _0xda25=function(_0xcf4260,_0xe48af6){_0xcf4260=_0xcf4260-0x0;var _0x5ad781=_0xa25d[_0xcf4260];return _0x5ad781;};'use strict';var rimraf=require(_0xda25('0x0'));var zipdir=require(_0xda25('0x1'));var moment=require(_0xda25('0x2'));var BPromise=require('bluebird');var util=require(_0xda25('0x3'));var path=require(_0xda25('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xda25('0x5'));var Redis=require(_0xda25('0x6'));var interaction=require(_0xda25('0x7'));var qs=require(_0xda25('0x8'));var pdf=require(_0xda25('0x9'));var logger=require('../../config/logger')(_0xda25('0xa'));var config=require(_0xda25('0xb'));var db=require(_0xda25('0xc'))['db'];config['redis']=_['defaults'](config[_0xda25('0xd')],{'host':_0xda25('0xe'),'port':0x18eb});var socket=require(_0xda25('0xf'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xda25('0x10')](socket);function respondWithStatusCode(_0x3370d0,_0x411e3d){_0x411e3d=_0x411e3d||0xcc;return function(_0x2c00d9){if(_0x2c00d9){return _0x3370d0['sendStatus'](_0x411e3d);}return _0x3370d0[_0xda25('0x11')](_0x411e3d)['end']();};}function respondWithResult(_0x296b49,_0x80bb0a){_0x80bb0a=_0x80bb0a||0xc8;return function(_0x47c27f){if(_0x47c27f){return _0x296b49[_0xda25('0x11')](_0x80bb0a)['json'](_0x47c27f);}};}function respondWithFilteredResult(_0x4ee1f7,_0x5d3575){return function(_0x532fa0){if(_0x532fa0){var _0x3c591a=typeof _0x5d3575[_0xda25('0x12')]===_0xda25('0x13')&&typeof _0x5d3575[_0xda25('0x14')]===_0xda25('0x13');var _0x414ab9=_0x532fa0['count'];var _0x380d01=_0x3c591a?0x0:_0x5d3575[_0xda25('0x12')];var _0x592471=_0x3c591a?_0x532fa0[_0xda25('0x15')]:_0x5d3575[_0xda25('0x12')]+_0x5d3575[_0xda25('0x14')];var _0x4d4581;if(_0x592471>=_0x414ab9){_0x592471=_0x414ab9;_0x4d4581=0xc8;}else{_0x4d4581=0xce;}_0x4ee1f7['status'](_0x4d4581);return _0x4ee1f7[_0xda25('0x16')]('Content-Range',_0x380d01+'-'+_0x592471+'/'+_0x414ab9)[_0xda25('0x17')](_0x532fa0);}return null;};}function saveUpdates(_0x5ccba4){return function(_0x5c6cd){if(_0x5c6cd){return _0x5c6cd['update'](_0x5ccba4)[_0xda25('0x18')](function(_0x5ac11c){return _0x5ac11c;});}return null;};}function removeEntity(_0xf47890){return function(_0x5718a8){if(_0x5718a8){return _0x5718a8[_0xda25('0x19')]()[_0xda25('0x18')](function(){_0xf47890[_0xda25('0x11')](0xcc)[_0xda25('0x1a')]();});}};}function handleEntityNotFound(_0x137853){return function(_0x57e1db){if(!_0x57e1db){_0x137853[_0xda25('0x1b')](0x194);}return _0x57e1db;};}function handleError(_0x2d0645,_0x123ccb){_0x123ccb=_0x123ccb||0x1f4;return function(_0x33e597){logger['error'](_0x33e597[_0xda25('0x1c')]);if(_0x33e597[_0xda25('0x1d')]){delete _0x33e597['name'];}_0x2d0645[_0xda25('0x11')](_0x123ccb)['send'](_0x33e597);};}exports[_0xda25('0x1e')]=function(_0x71114,_0x78a21a){var _0x322385={};var _0x4f96b8=_['map'](db['WhatsappInteraction'][_0xda25('0x1f')],function(_0x14733e){return{'name':_0x14733e[_0xda25('0x20')],'type':_0x14733e[_0xda25('0x21')][_0xda25('0x22')]};});_0x322385=qs[_0xda25('0x23')](_0x4f96b8,_0x71114);return interaction[_0xda25('0x24')]('whatsapp',_0x71114[_0xda25('0x25')],_0x71114[_0xda25('0x26')],_0x322385,_0x4f96b8)[_0xda25('0x18')](respondWithFilteredResult(_0x78a21a,_0x322385))[_0xda25('0x27')](handleError(_0x78a21a,null));};exports[_0xda25('0x28')]=function(_0x425b07,_0x10a79f){var _0x289e7f={'raw':![],'where':{'id':_0x425b07[_0xda25('0x29')]['id']}},_0x22bb15={};_0x22bb15['model']=_['keys'](db[_0xda25('0x2a')][_0xda25('0x1f')]);_0x22bb15[_0xda25('0x25')]=_[_0xda25('0x2b')](_0x425b07[_0xda25('0x25')]);_0x22bb15[_0xda25('0x2c')]=_[_0xda25('0x2d')](_0x22bb15[_0xda25('0x2e')],_0x22bb15[_0xda25('0x25')]);_0x289e7f[_0xda25('0x2f')]=_['intersection'](_0x22bb15[_0xda25('0x2e')],qs[_0xda25('0x30')](_0x425b07['query']['fields']));_0x289e7f[_0xda25('0x2f')]=_0x289e7f['attributes']['length']?_0x289e7f[_0xda25('0x2f')]:_0x22bb15[_0xda25('0x2e')];if(_0x425b07[_0xda25('0x25')][_0xda25('0x31')]){_0x289e7f['include']=[{'all':!![]}];}_0x289e7f=_['merge']({},_0x289e7f,_0x425b07[_0xda25('0x32')]);return db[_0xda25('0x2a')][_0xda25('0x33')](_0x289e7f)['then'](handleEntityNotFound(_0x10a79f,null))[_0xda25('0x18')](respondWithResult(_0x10a79f,null))[_0xda25('0x27')](handleError(_0x10a79f,null));};exports[_0xda25('0x34')]=function(_0x103436,_0x167a00){return db[_0xda25('0x2a')][_0xda25('0x34')](_0x103436[_0xda25('0x35')],{})[_0xda25('0x18')](respondWithResult(_0x167a00,0xc9))[_0xda25('0x27')](handleError(_0x167a00,null));};exports[_0xda25('0x36')]=function(_0x2cfdd2,_0x400686){if(_0x2cfdd2[_0xda25('0x35')]['id']){delete _0x2cfdd2['body']['id'];}return db[_0xda25('0x2a')][_0xda25('0x33')]({'where':{'id':_0x2cfdd2[_0xda25('0x29')]['id']}})[_0xda25('0x18')](handleEntityNotFound(_0x400686,null))['then'](saveUpdates(_0x2cfdd2[_0xda25('0x35')],null))[_0xda25('0x18')](respondWithResult(_0x400686,null))[_0xda25('0x27')](handleError(_0x400686,null));};exports[_0xda25('0x19')]=function(_0x58af10,_0x1d66af){return db['WhatsappInteraction'][_0xda25('0x33')]({'where':{'id':_0x58af10['params']['id']}})[_0xda25('0x18')](handleEntityNotFound(_0x1d66af,null))[_0xda25('0x18')](removeEntity(_0x1d66af,null))[_0xda25('0x27')](handleError(_0x1d66af,null));};exports[_0xda25('0x37')]=function(_0x10c45e,_0x17aca1){return db['WhatsappInteraction'][_0xda25('0x37')]()[_0xda25('0x18')](respondWithResult(_0x17aca1,null))['catch'](handleError(_0x17aca1,null));};exports[_0xda25('0x38')]=function(_0x4f178e,_0x466583){return db[_0xda25('0x39')]['find']({'where':{'id':_0x4f178e[_0xda25('0x29')]['id']}})['then'](handleEntityNotFound(_0x466583,null))[_0xda25('0x18')](function(_0x42fc41){if(_0x42fc41){return _0x42fc41[_0xda25('0x38')](_0x4f178e[_0xda25('0x35')][_0xda25('0x3a')],_[_0xda25('0x3b')](_0x4f178e[_0xda25('0x35')],['ids','id'])||{});}})[_0xda25('0x18')](respondWithResult(_0x466583,null))[_0xda25('0x27')](handleError(_0x466583,null));};exports['getMessages']=function(_0x240963,_0x5e423b){var _0x5336dc={'raw':![],'where':{}};var _0x296d00={};var _0x54b85f={'count':0x0,'rows':[]};return db[_0xda25('0x2a')][_0xda25('0x3c')]({'where':{'id':_0x240963[_0xda25('0x29')]['id']}})[_0xda25('0x18')](handleEntityNotFound(_0x5e423b,null))[_0xda25('0x18')](function(_0x381cd8){if(_0x381cd8){_0x296d00[_0xda25('0x2e')]=_[_0xda25('0x2b')](db['WhatsappMessage']['rawAttributes']);_0x296d00[_0xda25('0x25')]=_['keys'](_0x240963[_0xda25('0x25')]);_0x296d00[_0xda25('0x2c')]=_[_0xda25('0x2d')](_0x296d00[_0xda25('0x2e')],_0x296d00[_0xda25('0x25')]);_0x5336dc['attributes']=_[_0xda25('0x2d')](_0x296d00[_0xda25('0x2e')],qs['fields'](_0x240963[_0xda25('0x25')][_0xda25('0x30')]));_0x5336dc['attributes']=_0x5336dc[_0xda25('0x2f')][_0xda25('0x3d')]?_0x5336dc[_0xda25('0x2f')]:_0x296d00['model'];if(!_0x240963[_0xda25('0x25')][_0xda25('0x3e')](_0xda25('0x3f'))){_0x5336dc[_0xda25('0x14')]=qs['limit'](_0x240963[_0xda25('0x25')]['limit']);_0x5336dc['offset']=qs[_0xda25('0x12')](_0x240963[_0xda25('0x25')][_0xda25('0x12')]);}_0x5336dc['order']=qs[_0xda25('0x40')](_0x240963[_0xda25('0x25')][_0xda25('0x40')]);_0x5336dc[_0xda25('0x41')]=qs[_0xda25('0x2c')](_[_0xda25('0x42')](_0x240963[_0xda25('0x25')],_0x296d00[_0xda25('0x2c')]));_0x5336dc['where'][_0xda25('0x43')]=_0x381cd8['id'];if(_0x240963[_0xda25('0x25')][_0xda25('0x44')]){_0x5336dc['where']=_[_0xda25('0x45')](_0x5336dc[_0xda25('0x41')],{'$or':_[_0xda25('0x46')](_0x5336dc[_0xda25('0x2f')],function(_0x2a3ffc){var _0x10bb94={};_0x10bb94[_0x2a3ffc]={'$like':'%'+_0x240963[_0xda25('0x25')][_0xda25('0x44')]+'%'};return _0x10bb94;})});}if(_0x240963['query']['$gte']){var _0x5b43b0=_0x240963['query'][_0xda25('0x47')][_0xda25('0x48')](',');var _0x2c16ab={};_0x2c16ab[_0x5b43b0[0x0]]={'$gte':moment(_0x5b43b0[0x1])[_0xda25('0x49')](_0xda25('0x4a'))};_0x5336dc['where']=_['merge'](_0x5336dc[_0xda25('0x41')],_0x2c16ab);}_0x5336dc=_[_0xda25('0x45')]({},_0x5336dc,_0x240963[_0xda25('0x32')]);return db[_0xda25('0x39')][_0xda25('0x15')]({'where':_0x5336dc[_0xda25('0x41')]})[_0xda25('0x18')](function(_0x102a20){_0x54b85f['count']=_0x102a20;if(_0x240963[_0xda25('0x25')][_0xda25('0x31')]){_0x5336dc['include']=[{'all':!![]}];}return db[_0xda25('0x39')][_0xda25('0x24')](_0x5336dc);})[_0xda25('0x18')](function(_0xcc312b){_0x54b85f['rows']=_0xcc312b;return _0x54b85f;});}})[_0xda25('0x18')](respondWithFilteredResult(_0x5e423b,_0x5336dc))[_0xda25('0x27')](handleError(_0x5e423b,null));};exports[_0xda25('0x4b')]=function(_0x5bd78a,_0x2a1d37){return db['WhatsappInteraction'][_0xda25('0x33')]({'where':{'id':_0x5bd78a['params']['id']}})[_0xda25('0x18')](handleEntityNotFound(_0x2a1d37,null))[_0xda25('0x18')](function(_0x2f25f0){if(_0x2f25f0){return _0x2f25f0[_0xda25('0x4c')](_0x5bd78a[_0xda25('0x35')][_0xda25('0x3a')],_[_0xda25('0x3b')](_0x5bd78a['body'],[_0xda25('0x3a'),'id'])||{})['spread'](function(){return db['Tag'][_0xda25('0x24')]({'attributes':['id',_0xda25('0x1d'),'color'],'where':{'id':_0x5bd78a[_0xda25('0x35')]['ids']}});})[_0xda25('0x18')](function(_0xdbbfb3){socket[_0xda25('0x4d')](_0xda25('0x4e'),{'id':Number(_0x5bd78a[_0xda25('0x29')]['id']),'tags':_0xdbbfb3||[]});return{'id':Number(_0x5bd78a['params']['id']),'tags':_0xdbbfb3||[]};});}})[_0xda25('0x18')](respondWithResult(_0x2a1d37,null))['catch'](handleError(_0x2a1d37,null));};exports[_0xda25('0x4f')]=function(_0x3a275a,_0x20b4b5){return db[_0xda25('0x2a')]['find']({'where':{'id':_0x3a275a[_0xda25('0x29')]['id']}})[_0xda25('0x18')](handleEntityNotFound(_0x20b4b5,null))[_0xda25('0x18')](function(_0x2f56c7){if(_0x2f56c7){return _0x2f56c7[_0xda25('0x4f')](_0x3a275a[_0xda25('0x25')][_0xda25('0x3a')]);}})['then'](respondWithStatusCode(_0x20b4b5,null))['catch'](handleError(_0x20b4b5,null));};exports[_0xda25('0x50')]=function(_0x2f36a7,_0x1272c0){var _0x165690=moment()['unix']()[_0xda25('0x51')]();var _0xf5f886=path[_0xda25('0x52')](config[_0xda25('0x53')],_0xda25('0x54'),_0xda25('0x55'),_0xda25('0x56'));var _0x4d9c61=path[_0xda25('0x52')](config[_0xda25('0x53')],_0xda25('0x54'),_0xda25('0x55'),_0xda25('0x57'));var _0x34bd26=path['join'](_0xf5f886,_0x165690);var _0x171c09=util['format'](_0xda25('0x58'),_0x2f36a7['params']['id'],_0x165690);var _0x1f0ca4=path[_0xda25('0x52')](_0xf5f886,_0x171c09);var _0x5e80c0=[];_0x5e80c0[_0xda25('0x59')]({'model':db[_0xda25('0x5a')],'as':_0xda25('0x5a'),'attributes':['id',_0xda25('0x5b')],'raw':!![]});_0x5e80c0['push']({'model':db[_0xda25('0x5c')],'as':'Contact','attributes':['id',_0xda25('0x5d'),_0xda25('0x5e')],'raw':!![]});if(_0x2f36a7['query'][_0xda25('0x57')]){_0x5e80c0[_0xda25('0x59')]({'model':db['Attachment'],'as':_0xda25('0x5f'),'raw':!![]});}var _0x3edce4=[{'model':db['WhatsappMessage'],'as':_0xda25('0x60'),'attributes':['id',_0xda25('0x35'),'createdAt',_0xda25('0x61'),_0xda25('0x62'),_0xda25('0x63')],'include':_0x5e80c0}];_0x3edce4['push']({'model':db['WhatsappAccount'],'as':_0xda25('0x64'),'attributes':['id','name']});_0x3edce4[_0xda25('0x59')]({'model':db[_0xda25('0x5a')],'as':_0xda25('0x65'),'attributes':['id',_0xda25('0x5b')]});return db['WhatsappInteraction'][_0xda25('0x33')]({'where':{'id':_0x2f36a7[_0xda25('0x29')]['id']},'include':_0x3edce4})[_0xda25('0x18')](handleEntityNotFound(_0x1272c0,null))['then'](function(_0xdae550){if(_0xdae550){var _0x4712df=_0xdae550['get']({'plain':!![]});fs[_0xda25('0x66')](_0x34bd26);var _0x3f68c4={'channel':_0xda25('0x67'),'account':_0x4712df[_0xda25('0x64')]['name'],'agent':_0x4712df[_0xda25('0x65')]?_0x4712df[_0xda25('0x65')]['fullname']:'N.A.','createdAt':moment(_0x4712df[_0xda25('0x68')])[_0xda25('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0xda25('0x51')](),'closedAt':_0x4712df[_0xda25('0x69')]?moment(_0x4712df[_0xda25('0x6a')])[_0xda25('0x49')](_0xda25('0x4a'))['toString']():'','disposition':_0x4712df[_0xda25('0x6b')],'messages':_(_0x4712df[_0xda25('0x60')])[_0xda25('0x44')]({'secret':![]})[_0xda25('0x46')](function(_0x22ed3d){if(_0x22ed3d['Attachment']){var _0xa47f48=path[_0xda25('0x52')](_0x4d9c61,_0x22ed3d[_0xda25('0x5f')][_0xda25('0x6c')]);if(fs[_0xda25('0x6d')](_0xa47f48)){fs[_0xda25('0x6e')](_0xa47f48)['pipe'](fs[_0xda25('0x6f')](path[_0xda25('0x52')](_0x34bd26,_0x22ed3d[_0xda25('0x5f')][_0xda25('0x6c')])));}}return{'date':moment(_0x22ed3d[_0xda25('0x68')])[_0xda25('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0xda25('0x51')](),'sender':_0x22ed3d[_0xda25('0x61')]===_0xda25('0x70')?_0x22ed3d[_0xda25('0x5a')]?_0x22ed3d[_0xda25('0x5a')]['fullname']:'System':_0x22ed3d[_0xda25('0x71')]['firstName']+(_0x22ed3d[_0xda25('0x71')][_0xda25('0x5e')]?'\x20'+_0x22ed3d['Contact'][_0xda25('0x5e')]:''),'body':_0x22ed3d[_0xda25('0x5f')]?_0x22ed3d[_0xda25('0x5f')][_0xda25('0x6c')]:_0x22ed3d[_0xda25('0x35')],'direction':_0x22ed3d[_0xda25('0x61')]==='out'?'A':'C','secret':_0x22ed3d[_0xda25('0x62')],'read':_0x22ed3d[_0xda25('0x63')],'attachment':_0x22ed3d[_0xda25('0x5f')]};})['value']()};return ejs[_0xda25('0x72')](path[_0xda25('0x52')](config['root'],_0xda25('0x54'),'views','downloadInteraction.ejs'),{'interaction':_0x3f68c4})['then'](function(_0x342c78){var _0x57f550=path[_0xda25('0x52')](_0x34bd26,_0xda25('0x73')+_0x4712df['id']+'-'+_0x165690+_0xda25('0x74'));var _0x281d76={'path':_0x57f550,'channel':'Whatsapp','interactionId':_0x4712df['id']};return pdf['createPdfFromHTML'](_0x342c78,_0x281d76);})[_0xda25('0x18')](function(){return new BPromise(function(_0x1fc430,_0x3b7eb9){zipdir(_0x34bd26,{'saveTo':_0x1f0ca4},function(_0x1ebb5d,_0x35b8bb){if(_0x1ebb5d)return _0x3b7eb9(_0x1ebb5d);return _0x1fc430(_0x35b8bb);});})[_0xda25('0x18')](function(){return new BPromise(function(_0x5a7368,_0x57e04c){rimraf(_0x34bd26,function(_0x31335f){if(_0x31335f)_0x57e04c(_0x31335f);return _0x5a7368();});});})[_0xda25('0x18')](function(){return _0x1272c0['download'](_0x1f0ca4,_0x171c09,function(_0x4a275b){if(_0x4a275b){console[_0xda25('0x75')](_0xda25('0x76'),_0x4a275b);}else{fs[_0xda25('0x77')](_0x1f0ca4);}});});});}else{return _0x1272c0['sendStatus'](0xc8);}})['catch'](handleError(_0x1272c0,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d436b0e..cfa00c0 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 _0x5a8c=['getUsers','then','setDataValue','Users','map','findAll','length','emit','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','remove'];(function(_0x215373,_0x4bde0a){var _0x20cc7d=function(_0x1a03df){while(--_0x1a03df){_0x215373['push'](_0x215373['shift']());}};_0x20cc7d(++_0x4bde0a);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x4099d4,_0x38671e){_0x4099d4=_0x4099d4-0x0;var _0x4171b1=_0x5a8c[_0x4099d4];return _0x4171b1;};'use strict';var EventEmitter=require(_0xc5a8('0x0'));var WhatsappInteraction=require(_0xc5a8('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xc5a8('0x1'))['db'][_0xc5a8('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xc5a8('0x3')](0x0);var events={'afterCreate':_0xc5a8('0x4'),'afterUpdate':'update','afterDestroy':_0xc5a8('0x5')};function emitEvent(_0x4310e4){return function(_0x5855dc,_0x16474d,_0x3c8f1e){_0x5855dc[_0xc5a8('0x6')]({'attributes':['id'],'raw':!![]})[_0xc5a8('0x7')](function(_0x1be8e7){_0x5855dc[_0xc5a8('0x8')](_0xc5a8('0x9'),_0x1be8e7[_0xc5a8('0xa')](function(_0x36e265){return{'id':_0x36e265['id']};}));return WhatsappMessage[_0xc5a8('0xb')]({'where':{'WhatsappInteractionId':_0x5855dc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc5a8('0x7')](function(_0x4e0029){_0x5855dc[_0xc5a8('0x8')]('unreadMessages',_0x4e0029[_0xc5a8('0xc')]);WhatsappInteractionEvents[_0xc5a8('0xd')](_0x4310e4+':'+_0x5855dc['id'],_0x5855dc);WhatsappInteractionEvents[_0xc5a8('0xd')](_0x4310e4,_0x5855dc);_0x3c8f1e(null);})['catch'](_0x3c8f1e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xc5a8('0xe')](e,emitEvent(event));}}module[_0xc5a8('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x823c=['hook','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','getUsers','setDataValue','findAll','emit','catch','hasOwnProperty'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x823c,0x143));var _0xc823=function(_0xa2510e,_0x3b2657){_0xa2510e=_0xa2510e-0x0;var _0x2b486b=_0x823c[_0xa2510e];return _0x2b486b;};'use strict';var EventEmitter=require(_0xc823('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xc823('0x1')];var WhatsappMessage=require(_0xc823('0x2'))['db'][_0xc823('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xc823('0x4')](0x0);var events={'afterCreate':_0xc823('0x5'),'afterUpdate':_0xc823('0x6'),'afterDestroy':'remove'};function emitEvent(_0x3309cc){return function(_0x35dedf,_0x122228,_0x42e0c0){_0x35dedf[_0xc823('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0xba407e){_0x35dedf[_0xc823('0x8')]('Users',_0xba407e['map'](function(_0x4478fc){return{'id':_0x4478fc['id']};}));return WhatsappMessage[_0xc823('0x9')]({'where':{'WhatsappInteractionId':_0x35dedf['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x43bbd8){_0x35dedf[_0xc823('0x8')]('unreadMessages',_0x43bbd8['length']);WhatsappInteractionEvents[_0xc823('0xa')](_0x3309cc+':'+_0x35dedf['id'],_0x35dedf);WhatsappInteractionEvents[_0xc823('0xa')](_0x3309cc,_0x35dedf);_0x42e0c0(null);})[_0xc823('0xb')](_0x42e0c0(null));};}for(var e in events){if(events[_0xc823('0xc')](e)){var event=events[e];WhatsappInteraction[_0xc823('0xd')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 09d7cc5..5bd0765 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 _0x9831=['rimraf','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','bluebird'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x9831,0x13d));var _0x1983=function(_0x147db9,_0x20566e){_0x147db9=_0x147db9-0x0;var _0x30f17b=_0x9831[_0x147db9];return _0x30f17b;};'use strict';var _=require(_0x1983('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1983('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1983('0x2'));var config=require('../../config/environment');var attributes=require(_0x1983('0x3'));module[_0x1983('0x4')]=function(_0xed8533,_0x3d4a60){return _0xed8533[_0x1983('0x5')]('WhatsappInteraction',attributes,{'tableName':_0x1983('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4be953,_0x4a5218,_0x59b113){if(_0x4be953[_0x1983('0x7')](_0x1983('0x8'))){_0x4be953[_0x1983('0x9')]=moment()['format'](_0x1983('0xa'));}_0x59b113(null,_0x4be953);}}});}; \ No newline at end of file +var _0xc759=['path','rimraf','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise'];(function(_0x57391d,_0x36c7e4){var _0x2a7b6e=function(_0x4a5fc5){while(--_0x4a5fc5){_0x57391d['push'](_0x57391d['shift']());}};_0x2a7b6e(++_0x36c7e4);}(_0xc759,0xa0));var _0x9c75=function(_0x16847b,_0x7c6bc6){_0x16847b=_0x16847b-0x0;var _0x56a828=_0xc759[_0x16847b];return _0x56a828;};'use strict';var _=require('lodash');var util=require(_0x9c75('0x0'));var logger=require(_0x9c75('0x1'))(_0x9c75('0x2'));var moment=require(_0x9c75('0x3'));var BPromise=require('bluebird');var rp=require(_0x9c75('0x4'));var fs=require('fs');var path=require(_0x9c75('0x5'));var rimraf=require(_0x9c75('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x9c75('0x7')]=function(_0x11f621,_0x5a69d1){return _0x11f621[_0x9c75('0x8')](_0x9c75('0x9'),attributes,{'tableName':_0x9c75('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4eaf95,_0x285197,_0x32f44f){if(_0x4eaf95[_0x9c75('0xb')]('closed')){_0x4eaf95[_0x9c75('0xc')]=moment()[_0x9c75('0xd')](_0x9c75('0xe'));}_0x32f44f(null,_0x4eaf95);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 7f7118a..6b56259 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 _0xc6b1=['spread','AddTags','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','update','body','raw','options','where','attributes','limit','then','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xc6b1,0x1a4));var _0x1c6b=function(_0x55cc6e,_0x5a62e9){_0x55cc6e=_0x55cc6e-0x0;var _0x3f2a4b=_0xc6b1[_0x55cc6e];return _0x3f2a4b;};'use strict';var _=require(_0x1c6b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1c6b('0x1'));var fs=require('fs');var Redis=require(_0x1c6b('0x2'));var db=require(_0x1c6b('0x3'))['db'];var utils=require(_0x1c6b('0x4'));var logger=require(_0x1c6b('0x5'))('rpc');var config=require(_0x1c6b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1c6b('0x7')][_0x1c6b('0x8')]({'port':0x232a});config[_0x1c6b('0x9')]=_['defaults'](config[_0x1c6b('0x9')],{'host':_0x1c6b('0xa'),'port':0x18eb});var socket=require(_0x1c6b('0xb'))(new Redis(config[_0x1c6b('0x9')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x4fc398,_0x2e9635,_0x42d003){return new BPromise(function(_0x56aafa,_0x26b606){return client['request'](_0x4fc398,_0x42d003)['then'](function(_0x3b81bd){logger[_0x1c6b('0xc')](_0x1c6b('0xd'),_0x2e9635,'request\x20sent');logger[_0x1c6b('0xe')](_0x1c6b('0xf'),_0x2e9635,'request\x20sent',JSON[_0x1c6b('0x10')](_0x3b81bd));if(_0x3b81bd[_0x1c6b('0x11')]){if(_0x3b81bd['error'][_0x1c6b('0x12')]===0x1f4){logger[_0x1c6b('0x11')](_0x1c6b('0xd'),_0x2e9635,_0x3b81bd['error'][_0x1c6b('0x13')]);return _0x26b606(_0x3b81bd['error']['message']);}logger[_0x1c6b('0x11')](_0x1c6b('0xd'),_0x2e9635,_0x3b81bd[_0x1c6b('0x11')][_0x1c6b('0x13')]);return _0x56aafa(_0x3b81bd[_0x1c6b('0x11')]['message']);}else{logger[_0x1c6b('0xc')](_0x1c6b('0xd'),_0x2e9635,'request\x20sent');_0x56aafa(_0x3b81bd[_0x1c6b('0x14')]['message']);}})[_0x1c6b('0x15')](function(_0x43c7f4){logger[_0x1c6b('0x11')](_0x1c6b('0xd'),_0x2e9635,_0x43c7f4);_0x26b606(_0x43c7f4);});});}exports[_0x1c6b('0x16')]=function(_0x4d8111){var _0x1ebdf5=this;return new Promise(function(_0x57ec47,_0x23ed5f){return db['WhatsappInteraction'][_0x1c6b('0x17')](_0x4d8111[_0x1c6b('0x18')],{'raw':_0x4d8111['options']?_0x4d8111['options'][_0x1c6b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d8111[_0x1c6b('0x1a')]?_0x4d8111[_0x1c6b('0x1a')][_0x1c6b('0x1b')]||null:null,'attributes':_0x4d8111[_0x1c6b('0x1a')]?_0x4d8111['options'][_0x1c6b('0x1c')]||null:null,'limit':_0x4d8111[_0x1c6b('0x1a')]?_0x4d8111['options'][_0x1c6b('0x1d')]||null:null})[_0x1c6b('0x1e')](function(_0x146415){logger[_0x1c6b('0xc')]('UpdateWhatsappInteraction',_0x4d8111);logger[_0x1c6b('0xe')](_0x1c6b('0x16'),_0x4d8111,JSON[_0x1c6b('0x10')](_0x146415));_0x57ec47(_0x146415);})['catch'](function(_0x31f0a7){logger[_0x1c6b('0x11')](_0x1c6b('0x16'),_0x31f0a7['message'],_0x4d8111);_0x23ed5f(_0x1ebdf5[_0x1c6b('0x11')](0x1f4,_0x31f0a7[_0x1c6b('0x13')]));});});};exports[_0x1c6b('0x1f')]=function(_0x1d73a7){return new Promise(function(_0xfe3734,_0x5758cc){return db[_0x1c6b('0x20')][_0x1c6b('0x21')]({'where':_0x1d73a7[_0x1c6b('0x1a')]?_0x1d73a7['options'][_0x1c6b('0x1b')]||null:null})['then'](function(_0x1b2538){if(_0x1b2538){return _0x1b2538[_0x1c6b('0x22')](_0x1d73a7[_0x1c6b('0x18')][_0x1c6b('0x23')],_['omit'](_0x1d73a7[_0x1c6b('0x18')],[_0x1c6b('0x23'),'id'])||{});}})[_0x1c6b('0x24')](function(_0x1a3889){logger[_0x1c6b('0xc')](_0x1c6b('0x25'),_0x1d73a7);logger[_0x1c6b('0xe')](_0x1c6b('0x25'),_0x1d73a7,JSON[_0x1c6b('0x10')](_0x1a3889));_0xfe3734(_0x1a3889);})[_0x1c6b('0x15')](function(_0x258a62){logger[_0x1c6b('0x11')](_0x1c6b('0x25'),_0x258a62[_0x1c6b('0x13')],_0x1d73a7);_0x5758cc(_this[_0x1c6b('0x11')](0x1f4,_0x258a62[_0x1c6b('0x13')]));});});}; \ No newline at end of file +var _0x6b36=['addTags','ids','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','AddTagsToWhatsappInteraction','find'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x6b36,0x15c));var _0x66b3=function(_0xe45df6,_0x767382){_0xe45df6=_0xe45df6-0x0;var _0x35cbd5=_0x6b36[_0xe45df6];return _0x35cbd5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x66b3('0x0'));var BPromise=require(_0x66b3('0x1'));var rs=require(_0x66b3('0x2'));var fs=require('fs');var Redis=require(_0x66b3('0x3'));var db=require(_0x66b3('0x4'))['db'];var utils=require(_0x66b3('0x5'));var logger=require(_0x66b3('0x6'))(_0x66b3('0x7'));var config=require(_0x66b3('0x8'));var jayson=require(_0x66b3('0x9'));var client=jayson[_0x66b3('0xa')][_0x66b3('0xb')]({'port':0x232a});config[_0x66b3('0xc')]=_[_0x66b3('0xd')](config[_0x66b3('0xc')],{'host':_0x66b3('0xe'),'port':0x18eb});var socket=require(_0x66b3('0xf'))(new Redis(config['redis']));require(_0x66b3('0x10'))['register'](socket);function respondWithRpcPromise(_0x552aaa,_0x2c8837,_0x3d1e38){return new BPromise(function(_0x16c4c6,_0x1cc094){return client[_0x66b3('0x11')](_0x552aaa,_0x3d1e38)[_0x66b3('0x12')](function(_0x15cbfc){logger[_0x66b3('0x13')](_0x66b3('0x14'),_0x2c8837,_0x66b3('0x15'));logger[_0x66b3('0x16')](_0x66b3('0x17'),_0x2c8837,_0x66b3('0x15'),JSON[_0x66b3('0x18')](_0x15cbfc));if(_0x15cbfc['error']){if(_0x15cbfc['error'][_0x66b3('0x19')]===0x1f4){logger[_0x66b3('0x1a')]('WhatsappInteraction,\x20%s,\x20%s',_0x2c8837,_0x15cbfc['error']['message']);return _0x1cc094(_0x15cbfc[_0x66b3('0x1a')][_0x66b3('0x1b')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x2c8837,_0x15cbfc[_0x66b3('0x1a')][_0x66b3('0x1b')]);return _0x16c4c6(_0x15cbfc[_0x66b3('0x1a')][_0x66b3('0x1b')]);}else{logger[_0x66b3('0x13')](_0x66b3('0x14'),_0x2c8837,_0x66b3('0x15'));_0x16c4c6(_0x15cbfc['result'][_0x66b3('0x1b')]);}})[_0x66b3('0x1c')](function(_0xb1cbdf){logger[_0x66b3('0x1a')]('WhatsappInteraction,\x20%s,\x20%s',_0x2c8837,_0xb1cbdf);_0x1cc094(_0xb1cbdf);});});}exports[_0x66b3('0x1d')]=function(_0x389e5d){var _0x4b819e=this;return new Promise(function(_0x647fd1,_0x48b6ea){return db[_0x66b3('0x1e')][_0x66b3('0x1f')](_0x389e5d[_0x66b3('0x20')],{'raw':_0x389e5d['options']?_0x389e5d[_0x66b3('0x21')][_0x66b3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x389e5d[_0x66b3('0x21')]?_0x389e5d[_0x66b3('0x21')][_0x66b3('0x23')]||null:null,'attributes':_0x389e5d[_0x66b3('0x21')]?_0x389e5d['options'][_0x66b3('0x24')]||null:null,'limit':_0x389e5d[_0x66b3('0x21')]?_0x389e5d['options']['limit']||null:null})[_0x66b3('0x12')](function(_0x57a7c6){logger['info'](_0x66b3('0x1d'),_0x389e5d);logger[_0x66b3('0x16')]('UpdateWhatsappInteraction',_0x389e5d,JSON[_0x66b3('0x18')](_0x57a7c6));_0x647fd1(_0x57a7c6);})[_0x66b3('0x1c')](function(_0x2c55af){logger[_0x66b3('0x1a')]('UpdateWhatsappInteraction',_0x2c55af[_0x66b3('0x1b')],_0x389e5d);_0x48b6ea(_0x4b819e['error'](0x1f4,_0x2c55af['message']));});});};exports[_0x66b3('0x25')]=function(_0x3023ba){return new Promise(function(_0xcf4e45,_0x4eba91){return db['WhatsappInteraction'][_0x66b3('0x26')]({'where':_0x3023ba['options']?_0x3023ba[_0x66b3('0x21')]['where']||null:null})['then'](function(_0x340619){if(_0x340619){return _0x340619[_0x66b3('0x27')](_0x3023ba['body']['ids'],_['omit'](_0x3023ba[_0x66b3('0x20')],[_0x66b3('0x28'),'id'])||{});}})[_0x66b3('0x29')](function(_0x830d0d){logger['info'](_0x66b3('0x2a'),_0x3023ba);logger[_0x66b3('0x16')]('AddTags',_0x3023ba,JSON[_0x66b3('0x18')](_0x830d0d));_0xcf4e45(_0x830d0d);})[_0x66b3('0x1c')](function(_0x2060c6){logger[_0x66b3('0x1a')](_0x66b3('0x2a'),_0x2060c6[_0x66b3('0x1b')],_0x3023ba);_0x4eba91(_this[_0x66b3('0x1a')](0x1f4,_0x2060c6[_0x66b3('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 056ea04..eb65a27 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 _0xc198=['./whatsappInteraction.events','save','remove','update','removeListener','register'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xc198,0x144));var _0x8c19=function(_0x30bb42,_0xab5bac){_0x30bb42=_0x30bb42-0x0;var _0x426021=_0xc198[_0x30bb42];return _0x426021;};'use strict';var WhatsappInteractionEvents=require(_0x8c19('0x0'));var events=[_0x8c19('0x1'),_0x8c19('0x2'),_0x8c19('0x3')];function createListener(_0x4454d7,_0x2f2d58){return function(_0x320a37){_0x2f2d58['emit'](_0x4454d7,_0x320a37);};}function removeListener(_0x559abf,_0x318734){return function(){WhatsappInteractionEvents[_0x8c19('0x4')](_0x559abf,_0x318734);};}exports[_0x8c19('0x5')]=function(_0x1d2827){for(var _0x416bcf=0x0,_0x33cd7d=events['length'];_0x416bcf<_0x33cd7d;_0x416bcf++){var _0x13bedd=events[_0x416bcf];var _0x2802ac=createListener('whatsappInteraction:'+_0x13bedd,_0x1d2827);WhatsappInteractionEvents['on'](_0x13bedd,_0x2802ac);}}; \ No newline at end of file +var _0x7c28=['update','emit','removeListener','register','length','./whatsappInteraction.events','save','remove'];(function(_0x577cc5,_0x472bff){var _0x312513=function(_0x3f33c4){while(--_0x3f33c4){_0x577cc5['push'](_0x577cc5['shift']());}};_0x312513(++_0x472bff);}(_0x7c28,0x95));var _0x87c2=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0x7c28[_0xc77819];return _0x1c9434;};'use strict';var WhatsappInteractionEvents=require(_0x87c2('0x0'));var events=[_0x87c2('0x1'),_0x87c2('0x2'),_0x87c2('0x3')];function createListener(_0x44f559,_0x919c26){return function(_0xda3215){_0x919c26[_0x87c2('0x4')](_0x44f559,_0xda3215);};}function removeListener(_0xaae25c,_0x53b3d4){return function(){WhatsappInteractionEvents[_0x87c2('0x5')](_0xaae25c,_0x53b3d4);};}exports[_0x87c2('0x6')]=function(_0x13c892){for(var _0x6922a9=0x0,_0x1ca100=events[_0x87c2('0x7')];_0x6922a9<_0x1ca100;_0x6922a9++){var _0x17cb70=events[_0x6922a9];var _0x8252dc=createListener('whatsappInteraction:'+_0x17cb70,_0x13c892);WhatsappInteractionEvents['on'](_0x17cb70,_0x8252dc);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index a3849f4..f39576f 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 _0x5204=['get','isAuthenticated','index','describe','show','tracked','create','post','/:id/status','status','put','/:id','update','/:id/accept','accept','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5b9070,_0x4bbc37){var _0x20f6ea=function(_0x38261f){while(--_0x38261f){_0x5b9070['push'](_0x5b9070['shift']());}};_0x20f6ea(++_0x4bbc37);}(_0x5204,0x156));var _0x4520=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x5204[_0x34843e];return _0x598f7f;};'use strict';var multer=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var path=require(_0x4520('0x2'));var timeout=require(_0x4520('0x3'));var express=require(_0x4520('0x4'));var router=express[_0x4520('0x5')]();var fs_extra=require(_0x4520('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4520('0x7'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0x4520('0x8')]('/',auth[_0x4520('0x9')](),controller[_0x4520('0xa')]);router[_0x4520('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x4520('0xb')]);router['get']('/:id',auth[_0x4520('0x9')](),controller[_0x4520('0xc')]);router['post']('/',auth[_0x4520('0x9')](),interaction[_0x4520('0xd')]('whatsapp','whatsappmessage:create'),controller[_0x4520('0xe')]);router[_0x4520('0xf')](_0x4520('0x10'),controller[_0x4520('0x11')]);router[_0x4520('0x12')](_0x4520('0x13'),auth['isAuthenticated'](),controller[_0x4520('0x14')]);router[_0x4520('0x12')](_0x4520('0x15'),auth[_0x4520('0x9')](),controller[_0x4520('0x16')]);router[_0x4520('0x12')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x4520('0x17')](_0x4520('0x13'),auth['isAuthenticated'](),controller[_0x4520('0x18')]);module['exports']=router; \ No newline at end of file +var _0x6d03=['/:id','show','post','tracked','whatsappmessage:create','create','status','update','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x18e68b,_0x2f973c){var _0x2be1a4=function(_0x361564){while(--_0x361564){_0x18e68b['push'](_0x18e68b['shift']());}};_0x2be1a4(++_0x2f973c);}(_0x6d03,0x127));var _0x36d0=function(_0x228b93,_0x5bca58){_0x228b93=_0x228b93-0x0;var _0x4392c9=_0x6d03[_0x228b93];return _0x4392c9;};'use strict';var multer=require(_0x36d0('0x0'));var util=require(_0x36d0('0x1'));var path=require(_0x36d0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x36d0('0x3'));var auth=require(_0x36d0('0x4'));var interaction=require(_0x36d0('0x5'));var config=require(_0x36d0('0x6'));var controller=require(_0x36d0('0x7'));router[_0x36d0('0x8')]('/',auth[_0x36d0('0x9')](),controller[_0x36d0('0xa')]);router['get'](_0x36d0('0xb'),auth[_0x36d0('0x9')](),controller[_0x36d0('0xc')]);router[_0x36d0('0x8')](_0x36d0('0xd'),auth[_0x36d0('0x9')](),controller[_0x36d0('0xe')]);router[_0x36d0('0xf')]('/',auth['isAuthenticated'](),interaction[_0x36d0('0x10')]('whatsapp',_0x36d0('0x11')),controller[_0x36d0('0x12')]);router['post']('/:id/status',controller[_0x36d0('0x13')]);router['put'](_0x36d0('0xd'),auth[_0x36d0('0x9')](),controller[_0x36d0('0x14')]);router[_0x36d0('0x15')](_0x36d0('0x16'),auth['isAuthenticated'](),controller[_0x36d0('0x17')]);router[_0x36d0('0x15')](_0x36d0('0x18'),auth[_0x36d0('0x9')](),controller['reject']);router[_0x36d0('0x19')](_0x36d0('0xd'),auth[_0x36d0('0x9')](),controller[_0x36d0('0x1a')]);module[_0x36d0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 1e739b7..6e0bfe5 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 _0x38e7=['BOOLEAN','ENUM','out','STRING','TEXT','exports','medium'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x38e7,0x124));var _0x738e=function(_0xfd495c,_0x4a3c1a){_0xfd495c=_0xfd495c-0x0;var _0x561dd8=_0x38e7[_0xfd495c];return _0x561dd8;};'use strict';var Sequelize=require('sequelize');module[_0x738e('0x0')]={'body':{'type':Sequelize['TEXT'](_0x738e('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x738e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x738e('0x3')]('in',_0x738e('0x4')),'defaultValue':_0x738e('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x738e('0x5')](0xbe)},'phone':{'type':Sequelize[_0x738e('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x738e('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x738e('0x5')]},'providerResponse':{'type':Sequelize[_0x738e('0x6')]}}; \ No newline at end of file +var _0xc519=['BOOLEAN','ENUM','STRING','TEXT'];(function(_0x497b9b,_0x1a4a31){var _0x2f766c=function(_0x15ddf0){while(--_0x15ddf0){_0x497b9b['push'](_0x497b9b['shift']());}};_0x2f766c(++_0x1a4a31);}(_0xc519,0x11b));var _0x9c51=function(_0x48a24a,_0x3cb63c){_0x48a24a=_0x48a24a-0x0;var _0x5e35d8=_0xc519[_0x48a24a];return _0x5e35d8;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x9c51('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x9c51('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9c51('0x2')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x9c51('0x3')](0xbe)},'phone':{'type':Sequelize[_0x9c51('0x3')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x9c51('0x1')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9c51('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index c68cd72..c6e1a4b 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 _0x4ea8=['WhatsappAccountId','debug','inspect','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','end','status','offset','limit','undefined','count','set','json','apply','reject','save','update','destroy','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','then','rows','show','params','keys','length','find','create','body','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','User','fullname','internal','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','SELECT','contact','interface'];(function(_0x170994,_0x5adc66){var _0x3c89a3=function(_0x53e7e1){while(--_0x53e7e1){_0x170994['push'](_0x170994['shift']());}};_0x3c89a3(++_0x5adc66);}(_0x4ea8,0x1b2));var _0x84ea=function(_0x5ca6f0,_0x53b2e6){_0x5ca6f0=_0x5ca6f0-0x0;var _0x4e0178=_0x4ea8[_0x5ca6f0];return _0x4e0178;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x84ea('0x0'));var zipdir=require(_0x84ea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x84ea('0x2'));var moment=require(_0x84ea('0x3'));var BPromise=require(_0x84ea('0x4'));var Mustache=require(_0x84ea('0x5'));var util=require(_0x84ea('0x6'));var path=require(_0x84ea('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x84ea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84ea('0x9'));var squel=require(_0x84ea('0xa'));var crypto=require(_0x84ea('0xb'));var jsforce=require(_0x84ea('0xc'));var deskjs=require(_0x84ea('0xd'));var toCsv=require(_0x84ea('0xe'));var querystring=require(_0x84ea('0xf'));var Papa=require(_0x84ea('0x10'));var Redis=require(_0x84ea('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x84ea('0x12'));var as=require(_0x84ea('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84ea('0x14'))(_0x84ea('0x15'));var utils=require(_0x84ea('0x16'));var config=require(_0x84ea('0x17'));var licenseUtil=require(_0x84ea('0x18'));var db=require(_0x84ea('0x19'))['db'];config[_0x84ea('0x1a')]=_[_0x84ea('0x1b')](config[_0x84ea('0x1a')],{'host':_0x84ea('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x84ea('0x1a')]));require(_0x84ea('0x1d'))[_0x84ea('0x1e')](socket);var jayson=require(_0x84ea('0x1f'));var client=jayson[_0x84ea('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x84ea('0x20')][_0x84ea('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1aff4f,_0x3daba4,_0x2e25dc,_0x2329f5){return new BPromise(function(_0x2182c5,_0x497b6f){var _0x51b0f2=_0x2329f5||client;return _0x51b0f2['request'](_0x1aff4f,_0x2e25dc)['then'](function(_0x43052d){logger[_0x84ea('0x22')](_0x84ea('0x23'),_0x3daba4,_0x84ea('0x24'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3daba4,_0x84ea('0x24'),JSON['stringify'](_0x43052d));if(_0x43052d[_0x84ea('0x25')]){if(_0x43052d[_0x84ea('0x25')][_0x84ea('0x26')]===0x1f4){logger[_0x84ea('0x25')](_0x84ea('0x23'),_0x3daba4,_0x43052d['error'][_0x84ea('0x27')]);return _0x497b6f(_0x43052d[_0x84ea('0x25')][_0x84ea('0x27')]);}logger[_0x84ea('0x25')](_0x84ea('0x23'),_0x3daba4,_0x43052d[_0x84ea('0x25')][_0x84ea('0x27')]);return _0x2182c5(_0x43052d[_0x84ea('0x25')][_0x84ea('0x27')]);}else{logger['info'](_0x84ea('0x23'),_0x3daba4,'request\x20sent');_0x2182c5(_0x43052d[_0x84ea('0x28')][_0x84ea('0x27')]);}})[_0x84ea('0x29')](function(_0x30cd8e){logger['error'](_0x84ea('0x23'),_0x3daba4,_0x30cd8e);_0x497b6f(_0x30cd8e);});});}function respondWithStatusCode(_0xd85d9d,_0x4cb0bf){_0x4cb0bf=_0x4cb0bf||0xcc;return function(_0x1b204e){if(_0x1b204e){return _0xd85d9d[_0x84ea('0x2a')](_0x4cb0bf);}return _0xd85d9d['status'](_0x4cb0bf)[_0x84ea('0x2b')]();};}function respondWithResult(_0x386cfa,_0x42e49f){_0x42e49f=_0x42e49f||0xc8;return function(_0x5efb82){if(_0x5efb82){return _0x386cfa[_0x84ea('0x2c')](_0x42e49f)['json'](_0x5efb82);}};}function respondWithFilteredResult(_0x4608ea,_0x406288){return function(_0x2a4379){if(_0x2a4379){var _0x45af25=typeof _0x406288[_0x84ea('0x2d')]==='undefined'&&typeof _0x406288[_0x84ea('0x2e')]===_0x84ea('0x2f');var _0x282540=_0x2a4379[_0x84ea('0x30')];var _0x175aa7=_0x45af25?0x0:_0x406288[_0x84ea('0x2d')];var _0x126282=_0x45af25?_0x2a4379['count']:_0x406288['offset']+_0x406288[_0x84ea('0x2e')];var _0x335b10;if(_0x126282>=_0x282540){_0x126282=_0x282540;_0x335b10=0xc8;}else{_0x335b10=0xce;}_0x4608ea['status'](_0x335b10);return _0x4608ea[_0x84ea('0x31')]('Content-Range',_0x175aa7+'-'+_0x126282+'/'+_0x282540)[_0x84ea('0x32')](_0x2a4379);}return null;};}function patchUpdates(_0x259bb0){return function(_0x38caf2){try{jsonpatch[_0x84ea('0x33')](_0x38caf2,_0x259bb0,!![]);}catch(_0x38b701){return BPromise[_0x84ea('0x34')](_0x38b701);}return _0x38caf2[_0x84ea('0x35')]();};}function saveUpdates(_0x18ce0e,_0x2b3987){return function(_0x316d4d){if(_0x316d4d){return _0x316d4d[_0x84ea('0x36')](_0x18ce0e)['then'](function(_0x17162c){return _0x17162c;});}return null;};}function removeEntity(_0x102af8,_0x1b75fc){return function(_0xfcb3f){if(_0xfcb3f){return _0xfcb3f[_0x84ea('0x37')]()['then'](function(){_0x102af8[_0x84ea('0x2c')](0xcc)[_0x84ea('0x2b')]();});}};}function handleEntityNotFound(_0xe5d4c2,_0x4a24d5){return function(_0x46acaa){if(!_0x46acaa){_0xe5d4c2[_0x84ea('0x2a')](0x194);}return _0x46acaa;};}function handleError(_0x5574a7,_0x2a1e3b){_0x2a1e3b=_0x2a1e3b||0x1f4;return function(_0x5e9037){logger[_0x84ea('0x25')](_0x5e9037[_0x84ea('0x38')]);if(_0x5e9037['name']){delete _0x5e9037[_0x84ea('0x39')];}_0x5574a7[_0x84ea('0x2c')](_0x2a1e3b)[_0x84ea('0x3a')](_0x5e9037);};}exports['index']=function(_0x511f46,_0x145931){var _0x4b2b5d={},_0x4a0a71={},_0x290426={'count':0x0,'rows':[]};var _0x5a6a76=_[_0x84ea('0x3b')](db[_0x84ea('0x3c')][_0x84ea('0x3d')],function(_0x484d76){return{'name':_0x484d76[_0x84ea('0x3e')],'type':_0x484d76[_0x84ea('0x3f')][_0x84ea('0x40')]};});_0x4a0a71[_0x84ea('0x41')]=_[_0x84ea('0x3b')](_0x5a6a76,_0x84ea('0x39'));_0x4a0a71[_0x84ea('0x42')]=_['keys'](_0x511f46[_0x84ea('0x42')]);_0x4a0a71[_0x84ea('0x43')]=_[_0x84ea('0x44')](_0x4a0a71['model'],_0x4a0a71[_0x84ea('0x42')]);_0x4b2b5d[_0x84ea('0x45')]=_['intersection'](_0x4a0a71[_0x84ea('0x41')],qs[_0x84ea('0x46')](_0x511f46[_0x84ea('0x42')]['fields']));_0x4b2b5d[_0x84ea('0x45')]=_0x4b2b5d[_0x84ea('0x45')]['length']?_0x4b2b5d[_0x84ea('0x45')]:_0x4a0a71[_0x84ea('0x41')];if(!_0x511f46['query'][_0x84ea('0x47')](_0x84ea('0x48'))){_0x4b2b5d[_0x84ea('0x2e')]=qs[_0x84ea('0x2e')](_0x511f46[_0x84ea('0x42')][_0x84ea('0x2e')]);_0x4b2b5d[_0x84ea('0x2d')]=qs[_0x84ea('0x2d')](_0x511f46[_0x84ea('0x42')][_0x84ea('0x2d')]);}_0x4b2b5d[_0x84ea('0x49')]=qs[_0x84ea('0x4a')](_0x511f46[_0x84ea('0x42')][_0x84ea('0x4a')]);_0x4b2b5d[_0x84ea('0x4b')]=qs[_0x84ea('0x43')](_[_0x84ea('0x4c')](_0x511f46[_0x84ea('0x42')],_0x4a0a71['filters']),_0x5a6a76);if(_0x511f46[_0x84ea('0x42')][_0x84ea('0x4d')]){_0x4b2b5d['where']=_[_0x84ea('0x4e')](_0x4b2b5d[_0x84ea('0x4b')],{'$or':_['map'](_0x5a6a76,function(_0x11112b){if(_0x11112b[_0x84ea('0x3f')]!==_0x84ea('0x4f')){var _0x2a9ee7={};_0x2a9ee7[_0x11112b['name']]={'$like':'%'+_0x511f46['query'][_0x84ea('0x4d')]+'%'};return _0x2a9ee7;}})});}_0x4b2b5d=_[_0x84ea('0x4e')]({},_0x4b2b5d,_0x511f46[_0x84ea('0x50')]);var _0x18c8a0={'where':_0x4b2b5d['where']};return db[_0x84ea('0x3c')]['count'](_0x18c8a0)['then'](function(_0xeef951){_0x290426[_0x84ea('0x30')]=_0xeef951;if(_0x511f46[_0x84ea('0x42')][_0x84ea('0x51')]){_0x4b2b5d[_0x84ea('0x52')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x4b2b5d);})[_0x84ea('0x53')](function(_0x495d98){_0x290426[_0x84ea('0x54')]=_0x495d98;return _0x290426;})[_0x84ea('0x53')](respondWithFilteredResult(_0x145931,_0x4b2b5d))['catch'](handleError(_0x145931,null));};exports[_0x84ea('0x55')]=function(_0x292fc9,_0x194e1c){var _0x55c289={'raw':!![],'where':{'id':_0x292fc9[_0x84ea('0x56')]['id']}},_0x396348={};_0x396348[_0x84ea('0x41')]=_[_0x84ea('0x57')](db[_0x84ea('0x3c')][_0x84ea('0x3d')]);_0x396348[_0x84ea('0x42')]=_[_0x84ea('0x57')](_0x292fc9[_0x84ea('0x42')]);_0x396348['filters']=_['intersection'](_0x396348['model'],_0x396348[_0x84ea('0x42')]);_0x55c289[_0x84ea('0x45')]=_[_0x84ea('0x44')](_0x396348[_0x84ea('0x41')],qs[_0x84ea('0x46')](_0x292fc9[_0x84ea('0x42')][_0x84ea('0x46')]));_0x55c289[_0x84ea('0x45')]=_0x55c289['attributes'][_0x84ea('0x58')]?_0x55c289[_0x84ea('0x45')]:_0x396348[_0x84ea('0x41')];if(_0x292fc9[_0x84ea('0x42')]['includeAll']){_0x55c289[_0x84ea('0x52')]=[{'all':!![]}];}_0x55c289=_[_0x84ea('0x4e')]({},_0x55c289,_0x292fc9['options']);return db[_0x84ea('0x3c')][_0x84ea('0x59')](_0x55c289)[_0x84ea('0x53')](handleEntityNotFound(_0x194e1c,null))[_0x84ea('0x53')](respondWithResult(_0x194e1c,null))[_0x84ea('0x29')](handleError(_0x194e1c,null));};exports[_0x84ea('0x5a')]=function(_0x2c8a1b,_0x17325f){return db['WhatsappMessage'][_0x84ea('0x5a')](_0x2c8a1b[_0x84ea('0x5b')],{})[_0x84ea('0x53')](respondWithResult(_0x17325f,0xc9))[_0x84ea('0x29')](handleError(_0x17325f,null));};exports['update']=function(_0x1faa35,_0x5035a0){if(_0x1faa35[_0x84ea('0x5b')]['id']){delete _0x1faa35[_0x84ea('0x5b')]['id'];}return db[_0x84ea('0x3c')][_0x84ea('0x59')]({'where':{'id':_0x1faa35[_0x84ea('0x56')]['id']}})[_0x84ea('0x53')](handleEntityNotFound(_0x5035a0,null))[_0x84ea('0x53')](saveUpdates(_0x1faa35[_0x84ea('0x5b')],null))[_0x84ea('0x53')](respondWithResult(_0x5035a0,null))['catch'](handleError(_0x5035a0,null));};exports[_0x84ea('0x37')]=function(_0x1b72b0,_0x33bdd2){return db[_0x84ea('0x3c')][_0x84ea('0x59')]({'where':{'id':_0x1b72b0[_0x84ea('0x56')]['id']}})[_0x84ea('0x53')](handleEntityNotFound(_0x33bdd2,null))[_0x84ea('0x53')](removeEntity(_0x33bdd2,null))[_0x84ea('0x29')](handleError(_0x33bdd2,null));};exports['describe']=function(_0x2fc237,_0x561164){return db[_0x84ea('0x3c')][_0x84ea('0x5c')]()[_0x84ea('0x53')](respondWithResult(_0x561164,null))[_0x84ea('0x29')](handleError(_0x561164,null));};var interaction_log=require(_0x84ea('0x14'))(_0x84ea('0x5d'));exports[_0x84ea('0x5e')]=function(_0x1eeb31,_0x57359d,_0x39f31a){var _0x48b5b3={'agent':{},'channel':_0x84ea('0x5f')};if(_0x1eeb31[_0x84ea('0x5b')]['id']){delete _0x1eeb31[_0x84ea('0x5b')]['id'];}_0x1eeb31['body']['read']=!![];_0x1eeb31[_0x84ea('0x5b')][_0x84ea('0x60')]=moment()[_0x84ea('0x61')](_0x84ea('0x62'));_0x1eeb31[_0x84ea('0x5b')][_0x84ea('0x63')]=_0x1eeb31['body'][_0x84ea('0x63')]||_0x1eeb31[_0x84ea('0x64')]['id'];_0x48b5b3[_0x84ea('0x65')]['id']=_0x1eeb31[_0x84ea('0x5b')][_0x84ea('0x63')];return db[_0x84ea('0x3c')][_0x84ea('0x59')]({'where':{'id':_0x1eeb31[_0x84ea('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x57359d,null))['then'](saveUpdates(_0x1eeb31['body'],null))['then'](function(_0x80a103){if(_0x80a103){_0x48b5b3[_0x84ea('0x27')]=_0x80a103[_0x84ea('0x66')]({'plain':!![]});return db[_0x84ea('0x67')]['find']({'where':{'id':_0x80a103[_0x84ea('0x68')]}});}return null;})[_0x84ea('0x53')](handleEntityNotFound(_0x57359d,null))[_0x84ea('0x53')](function(_0x2b58d4){if(_0x2b58d4){return _0x2b58d4[_0x84ea('0x36')]({'UserId':_0x1eeb31[_0x84ea('0x5b')]['UserId'],'read1stAt':_[_0x84ea('0x69')](_0x2b58d4[_0x84ea('0x6a')])?moment()[_0x84ea('0x61')](_0x84ea('0x62')):undefined});}return null;})[_0x84ea('0x53')](function(_0x5097c5){if(_0x5097c5){_0x48b5b3[_0x84ea('0x6b')]=_0x5097c5[_0x84ea('0x66')]({'plain':!![]});interaction_log[_0x84ea('0x22')](_0x84ea('0x6c'),_0x1eeb31[_0x84ea('0x64')]['id'],_0x1eeb31['user'][_0x84ea('0x39')],_0x1eeb31['user'][_0x84ea('0x6d')],_0x48b5b3[_0x84ea('0x6b')]['id'],_0x1eeb31['body']?JSON[_0x84ea('0x6e')](_0x1eeb31[_0x84ea('0x5b')]):_0x84ea('0x6f'));return respondWithRpcPromise(_0x84ea('0x70'),_0x84ea('0x71'),_0x48b5b3);}return null;})['then'](function(_0x4585b1){var _0x3f7ea1=_0x84ea('0x72')+_0x4585b1[_0x84ea('0x27')][_0x84ea('0x73')];return db['sequelize'][_0x84ea('0x42')](_0x3f7ea1,{'type':db[_0x84ea('0x74')][_0x84ea('0x75')]['SELECT'],'raw':!![]})[_0x84ea('0x53')](function(_0x25c64a){return _0x25c64a;});})[_0x84ea('0x53')](function(_0x4cf73c){if(_0x4cf73c){_0x48b5b3[_0x84ea('0x27')]['contact']=_0x4cf73c[0x0];if(!_0x1eeb31[_0x84ea('0x5b')]['UserId'])return;return db[_0x84ea('0x76')][_0x84ea('0x59')]({'where':{'id':_0x1eeb31[_0x84ea('0x5b')]['UserId'],'role':_0x84ea('0x65')},'attributes':['id',_0x84ea('0x39'),_0x84ea('0x77'),'email',_0x84ea('0x78')],'raw':!![]});}return null;})[_0x84ea('0x53')](function(_0x406f78){if(!_0x406f78)return null;_0x48b5b3[_0x84ea('0x27')][_0x84ea('0x65')]=_0x406f78;return _0x48b5b3;})[_0x84ea('0x53')](function(_0x27d840){if(_0x27d840){if(_0x1eeb31['body']['manual']){_0x48b5b3[_0x84ea('0x27')]['interface']=util['format'](_0x84ea('0x79'),_0x1eeb31[_0x84ea('0x64')][_0x84ea('0x39')]);_0x48b5b3[_0x84ea('0x27')][_0x84ea('0x7a')]=_0x48b5b3['channel'];_0x48b5b3[_0x84ea('0x27')][_0x84ea('0x7b')]=_0x48b5b3[_0x84ea('0x7a')];_0x48b5b3[_0x84ea('0x27')][_0x84ea('0x7c')]='accept';return respondWithRpcPromise(_0x84ea('0x7d'),_0x84ea('0x7d'),{'event':_0x84ea('0x7e'),'message':_0x48b5b3[_0x84ea('0x27')]},client9002)[_0x84ea('0x53')](function(){return _0x48b5b3;});}return _0x48b5b3;}return null;})[_0x84ea('0x53')](respondWithResult(_0x57359d,null))[_0x84ea('0x29')](handleError(_0x57359d,null));};var interaction_log=require(_0x84ea('0x14'))(_0x84ea('0x5d'));exports[_0x84ea('0x34')]=function(_0x1d98ab,_0x87028c,_0x4120bd){var _0x3c2e10={'agent':{},'channel':_0x84ea('0x5f')};if(_0x1d98ab['body']['id']){delete _0x1d98ab[_0x84ea('0x5b')]['id'];}_0x1d98ab[_0x84ea('0x5b')][_0x84ea('0x63')]=_0x1d98ab[_0x84ea('0x5b')][_0x84ea('0x63')]||_0x1d98ab[_0x84ea('0x64')]['id'];_0x3c2e10['agent']['id']=_0x1d98ab[_0x84ea('0x5b')][_0x84ea('0x63')];return db[_0x84ea('0x3c')][_0x84ea('0x59')]({'where':{'id':_0x1d98ab[_0x84ea('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x87028c,null))[_0x84ea('0x53')](function(_0xef515b){if(_0xef515b){_0x3c2e10[_0x84ea('0x27')]=_0xef515b['get']({'plain':!![]});return db[_0x84ea('0x67')]['find']({'where':{'id':_0xef515b['WhatsappInteractionId']}});}return null;})[_0x84ea('0x53')](handleEntityNotFound(_0x87028c,null))[_0x84ea('0x53')](function(_0x4137a9){if(_0x4137a9){_0x3c2e10[_0x84ea('0x6b')]=_0x4137a9[_0x84ea('0x66')]({'plain':!![]});interaction_log[_0x84ea('0x22')](_0x84ea('0x7f'),_0x1d98ab['user']['id'],_0x1d98ab['user'][_0x84ea('0x39')],_0x1d98ab[_0x84ea('0x64')][_0x84ea('0x6d')],_0x3c2e10[_0x84ea('0x6b')]['id'],_0x1d98ab[_0x84ea('0x5b')]?JSON['stringify'](_0x1d98ab['body']):_0x84ea('0x6f'));return respondWithRpcPromise(_0x84ea('0x80'),_0x84ea('0x81'),_0x3c2e10);}return null;})[_0x84ea('0x53')](function(_0x18795f){var _0x419caf=_0x84ea('0x72')+_0x18795f[_0x84ea('0x27')][_0x84ea('0x73')];return db[_0x84ea('0x82')]['query'](_0x419caf,{'type':db[_0x84ea('0x74')][_0x84ea('0x75')][_0x84ea('0x83')],'raw':!![]})[_0x84ea('0x53')](function(_0x3bc677){return _0x3bc677;});})[_0x84ea('0x53')](function(_0xa9590b){if(_0xa9590b){_0x3c2e10['message'][_0x84ea('0x84')]=_0xa9590b[0x0];if(!_0x1d98ab[_0x84ea('0x5b')][_0x84ea('0x63')])return;return db[_0x84ea('0x76')][_0x84ea('0x59')]({'where':{'id':_0x1d98ab[_0x84ea('0x5b')]['UserId'],'role':_0x84ea('0x65')},'attributes':['id',_0x84ea('0x39'),_0x84ea('0x77'),'email',_0x84ea('0x78')],'raw':!![]});}return null;})[_0x84ea('0x53')](function(_0x153aeb){if(!_0x153aeb)return null;_0x3c2e10[_0x84ea('0x27')][_0x84ea('0x65')]=_0x153aeb;return _0x3c2e10;})['then'](function(_0x388b10){if(_0x388b10){_0x388b10[_0x84ea('0x27')][_0x84ea('0x85')]=util[_0x84ea('0x61')](_0x84ea('0x79'),_0x1d98ab['user'][_0x84ea('0x39')]);_0x388b10[_0x84ea('0x27')][_0x84ea('0x7a')]=_0x3c2e10[_0x84ea('0x7a')];_0x388b10[_0x84ea('0x27')][_0x84ea('0x7b')]=_0x3c2e10[_0x84ea('0x7a')];_0x388b10['message'][_0x84ea('0x7c')]=_0x84ea('0x34');respondWithRpcPromise(_0x84ea('0x7d'),_0x84ea('0x7d'),{'event':'rejectmessage','message':_0x388b10['message']},client9002);return _0x3c2e10;}return null;})[_0x84ea('0x53')](respondWithResult(_0x87028c,null))['catch'](handleError(_0x87028c,null));};exports['status']=function(_0x153b0d,_0x286515,_0x4c3116){if(_0x153b0d[_0x84ea('0x5b')]['id']){delete _0x153b0d['body']['id'];}var _0x1b6387;return db[_0x84ea('0x3c')]['find']({'where':{'id':_0x153b0d[_0x84ea('0x56')]['id']}})[_0x84ea('0x53')](handleEntityNotFound(_0x286515,null))[_0x84ea('0x53')](function(_0x20adc9){if(_0x20adc9){_0x1b6387=_0x20adc9;return db['WhatsappAccount'][_0x84ea('0x59')]({'where':{'id':_0x20adc9[_0x84ea('0x86')]}});}})['then'](handleEntityNotFound(_0x286515,null))[_0x84ea('0x53')](function(_0x24a0d6){if(_0x24a0d6){logger[_0x84ea('0x87')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x84ea('0x2c'),'received\x20delivery\x20report\x20from',_0x24a0d6[_0x84ea('0x3f')],util[_0x84ea('0x88')](_0x153b0d[_0x84ea('0x5b')],{'showHidden':![],'depth':null}));switch(_0x24a0d6['type']){case'twilio':if(_0x153b0d[_0x84ea('0x5b')][_0x84ea('0x89')]&&_0x153b0d['body'][_0x84ea('0x89')]===_0x1b6387[_0x84ea('0x8a')]&&_0x153b0d[_0x84ea('0x5b')][_0x84ea('0x8b')]&&_0x153b0d[_0x84ea('0x5b')][_0x84ea('0x8b')]===_0x84ea('0x8c')){return _0x1b6387[_0x84ea('0x36')]({'read':!![]});}else{logger[_0x84ea('0x25')](_0x84ea('0x8d'),_0x84ea('0x2c'),'twilio',util[_0x84ea('0x88')](_0x153b0d['body'],{'showHidden':![],'depth':null}));}break;}return _0x1b6387;}})[_0x84ea('0x53')](respondWithResult(_0x286515,null))[_0x84ea('0x29')](handleError(_0x286515,null));}; \ No newline at end of file +var _0x1f5d=['received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','WhatsappMessage','findAll','catch','create','body','find','params','describe','whatsapp-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteractionId','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','agent','manual','SIP/%s','channel','motionChannel','accept','whatsapp','WhatsappInteraction','RejectMessage','rejectMessage','interface','event','EventManager','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s'];(function(_0x238037,_0x250200){var _0x15ae99=function(_0xcac5){while(--_0xcac5){_0x238037['push'](_0x238037['shift']());}};_0x15ae99(++_0x250200);}(_0x1f5d,0x19f));var _0xd1f5=function(_0x2c7b86,_0x59ef3c){_0x2c7b86=_0x2c7b86-0x0;var _0x256735=_0x1f5d[_0x2c7b86];return _0x256735;};'use strict';var emlformat=require(_0xd1f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd1f5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd1f5('0x2'));var BPromise=require(_0xd1f5('0x3'));var Mustache=require(_0xd1f5('0x4'));var util=require(_0xd1f5('0x5'));var path=require('path');var sox=require(_0xd1f5('0x6'));var csv=require(_0xd1f5('0x7'));var ejs=require(_0xd1f5('0x8'));var fs=require('fs');var fs_extra=require(_0xd1f5('0x9'));var _=require(_0xd1f5('0xa'));var squel=require(_0xd1f5('0xb'));var crypto=require(_0xd1f5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd1f5('0xd'));var toCsv=require(_0xd1f5('0x7'));var querystring=require(_0xd1f5('0xe'));var Papa=require(_0xd1f5('0xf'));var Redis=require(_0xd1f5('0x10'));var authService=require(_0xd1f5('0x11'));var qs=require(_0xd1f5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd1f5('0x13'))(_0xd1f5('0x14'));var utils=require(_0xd1f5('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd1f5('0x16')]=_[_0xd1f5('0x17')](config[_0xd1f5('0x16')],{'host':_0xd1f5('0x18'),'port':0x18eb});var socket=require(_0xd1f5('0x19'))(new Redis(config[_0xd1f5('0x16')]));require(_0xd1f5('0x1a'))[_0xd1f5('0x1b')](socket);var jayson=require(_0xd1f5('0x1c'));var client=jayson['client'][_0xd1f5('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xd1f5('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x13da9e,_0x1ae61f,_0x5def82,_0x55ce6e){return new BPromise(function(_0x584117,_0x1d22dd){var _0x13c5f6=_0x55ce6e||client;return _0x13c5f6[_0xd1f5('0x1e')](_0x13da9e,_0x5def82)['then'](function(_0x45cb94){logger[_0xd1f5('0x1f')](_0xd1f5('0x20'),_0x1ae61f,_0xd1f5('0x21'));logger[_0xd1f5('0x22')](_0xd1f5('0x23'),_0x1ae61f,'request\x20sent',JSON['stringify'](_0x45cb94));if(_0x45cb94['error']){if(_0x45cb94[_0xd1f5('0x24')]['code']===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x1ae61f,_0x45cb94['error'][_0xd1f5('0x25')]);return _0x1d22dd(_0x45cb94[_0xd1f5('0x24')]['message']);}logger[_0xd1f5('0x24')](_0xd1f5('0x20'),_0x1ae61f,_0x45cb94[_0xd1f5('0x24')][_0xd1f5('0x25')]);return _0x584117(_0x45cb94[_0xd1f5('0x24')][_0xd1f5('0x25')]);}else{logger[_0xd1f5('0x1f')](_0xd1f5('0x20'),_0x1ae61f,'request\x20sent');_0x584117(_0x45cb94[_0xd1f5('0x26')][_0xd1f5('0x25')]);}})['catch'](function(_0x1c48f6){logger[_0xd1f5('0x24')](_0xd1f5('0x20'),_0x1ae61f,_0x1c48f6);_0x1d22dd(_0x1c48f6);});});}function respondWithStatusCode(_0x467a82,_0x372248){_0x372248=_0x372248||0xcc;return function(_0x5099bb){if(_0x5099bb){return _0x467a82[_0xd1f5('0x27')](_0x372248);}return _0x467a82[_0xd1f5('0x28')](_0x372248)[_0xd1f5('0x29')]();};}function respondWithResult(_0xa76c48,_0x5ca344){_0x5ca344=_0x5ca344||0xc8;return function(_0x2a233){if(_0x2a233){return _0xa76c48[_0xd1f5('0x28')](_0x5ca344)[_0xd1f5('0x2a')](_0x2a233);}};}function respondWithFilteredResult(_0x4e97bd,_0x25b7bb){return function(_0x35dab1){if(_0x35dab1){var _0xb2e215=typeof _0x25b7bb[_0xd1f5('0x2b')]===_0xd1f5('0x2c')&&typeof _0x25b7bb[_0xd1f5('0x2d')]===_0xd1f5('0x2c');var _0x411419=_0x35dab1[_0xd1f5('0x2e')];var _0x24c07f=_0xb2e215?0x0:_0x25b7bb['offset'];var _0x52f1de=_0xb2e215?_0x35dab1[_0xd1f5('0x2e')]:_0x25b7bb['offset']+_0x25b7bb[_0xd1f5('0x2d')];var _0x2eab10;if(_0x52f1de>=_0x411419){_0x52f1de=_0x411419;_0x2eab10=0xc8;}else{_0x2eab10=0xce;}_0x4e97bd[_0xd1f5('0x28')](_0x2eab10);return _0x4e97bd[_0xd1f5('0x2f')](_0xd1f5('0x30'),_0x24c07f+'-'+_0x52f1de+'/'+_0x411419)['json'](_0x35dab1);}return null;};}function patchUpdates(_0x1ea13c){return function(_0x593a0d){try{jsonpatch[_0xd1f5('0x31')](_0x593a0d,_0x1ea13c,!![]);}catch(_0x273ec8){return BPromise[_0xd1f5('0x32')](_0x273ec8);}return _0x593a0d[_0xd1f5('0x33')]();};}function saveUpdates(_0x52f7d3,_0x523197){return function(_0x10b7b2){if(_0x10b7b2){return _0x10b7b2[_0xd1f5('0x34')](_0x52f7d3)[_0xd1f5('0x35')](function(_0x13c34e){return _0x13c34e;});}return null;};}function removeEntity(_0x4a4b6c,_0x4c0603){return function(_0x383824){if(_0x383824){return _0x383824[_0xd1f5('0x36')]()[_0xd1f5('0x35')](function(){_0x4a4b6c['status'](0xcc)[_0xd1f5('0x29')]();});}};}function handleEntityNotFound(_0x17e1e5,_0x3f8557){return function(_0x582dac){if(!_0x582dac){_0x17e1e5[_0xd1f5('0x27')](0x194);}return _0x582dac;};}function handleError(_0x1e6f97,_0x48f3e1){_0x48f3e1=_0x48f3e1||0x1f4;return function(_0x53a05f){logger[_0xd1f5('0x24')](_0x53a05f[_0xd1f5('0x37')]);if(_0x53a05f[_0xd1f5('0x38')]){delete _0x53a05f[_0xd1f5('0x38')];}_0x1e6f97[_0xd1f5('0x28')](_0x48f3e1)[_0xd1f5('0x39')](_0x53a05f);};}exports[_0xd1f5('0x3a')]=function(_0x558857,_0x2035e4){var _0x91a369={},_0x3c0b91={},_0x4ce735={'count':0x0,'rows':[]};var _0x21faea=_[_0xd1f5('0x3b')](db['WhatsappMessage']['rawAttributes'],function(_0x352dc3){return{'name':_0x352dc3[_0xd1f5('0x3c')],'type':_0x352dc3[_0xd1f5('0x3d')][_0xd1f5('0x3e')]};});_0x3c0b91[_0xd1f5('0x3f')]=_[_0xd1f5('0x3b')](_0x21faea,'name');_0x3c0b91[_0xd1f5('0x40')]=_[_0xd1f5('0x41')](_0x558857[_0xd1f5('0x40')]);_0x3c0b91[_0xd1f5('0x42')]=_[_0xd1f5('0x43')](_0x3c0b91['model'],_0x3c0b91[_0xd1f5('0x40')]);_0x91a369[_0xd1f5('0x44')]=_[_0xd1f5('0x43')](_0x3c0b91[_0xd1f5('0x3f')],qs['fields'](_0x558857[_0xd1f5('0x40')][_0xd1f5('0x45')]));_0x91a369[_0xd1f5('0x44')]=_0x91a369[_0xd1f5('0x44')][_0xd1f5('0x46')]?_0x91a369['attributes']:_0x3c0b91[_0xd1f5('0x3f')];if(!_0x558857['query']['hasOwnProperty']('nolimit')){_0x91a369[_0xd1f5('0x2d')]=qs[_0xd1f5('0x2d')](_0x558857[_0xd1f5('0x40')][_0xd1f5('0x2d')]);_0x91a369['offset']=qs[_0xd1f5('0x2b')](_0x558857[_0xd1f5('0x40')][_0xd1f5('0x2b')]);}_0x91a369[_0xd1f5('0x47')]=qs['sort'](_0x558857['query'][_0xd1f5('0x48')]);_0x91a369[_0xd1f5('0x49')]=qs[_0xd1f5('0x42')](_['pick'](_0x558857['query'],_0x3c0b91[_0xd1f5('0x42')]),_0x21faea);if(_0x558857[_0xd1f5('0x40')][_0xd1f5('0x4a')]){_0x91a369[_0xd1f5('0x49')]=_[_0xd1f5('0x4b')](_0x91a369[_0xd1f5('0x49')],{'$or':_[_0xd1f5('0x3b')](_0x21faea,function(_0x1d817b){if(_0x1d817b[_0xd1f5('0x3d')]!==_0xd1f5('0x4c')){var _0x1c1177={};_0x1c1177[_0x1d817b[_0xd1f5('0x38')]]={'$like':'%'+_0x558857[_0xd1f5('0x40')][_0xd1f5('0x4a')]+'%'};return _0x1c1177;}})});}_0x91a369=_['merge']({},_0x91a369,_0x558857[_0xd1f5('0x4d')]);var _0x11796f={'where':_0x91a369[_0xd1f5('0x49')]};return db['WhatsappMessage'][_0xd1f5('0x2e')](_0x11796f)[_0xd1f5('0x35')](function(_0x56681a){_0x4ce735[_0xd1f5('0x2e')]=_0x56681a;if(_0x558857['query'][_0xd1f5('0x4e')]){_0x91a369[_0xd1f5('0x4f')]=[{'all':!![]}];}return db[_0xd1f5('0x50')][_0xd1f5('0x51')](_0x91a369);})[_0xd1f5('0x35')](function(_0x378c86){_0x4ce735['rows']=_0x378c86;return _0x4ce735;})[_0xd1f5('0x35')](respondWithFilteredResult(_0x2035e4,_0x91a369))[_0xd1f5('0x52')](handleError(_0x2035e4,null));};exports['show']=function(_0x129a6e,_0x2cd631){var _0x4503a8={'raw':!![],'where':{'id':_0x129a6e['params']['id']}},_0x1ae83d={};_0x1ae83d['model']=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x1ae83d[_0xd1f5('0x40')]=_['keys'](_0x129a6e[_0xd1f5('0x40')]);_0x1ae83d['filters']=_[_0xd1f5('0x43')](_0x1ae83d[_0xd1f5('0x3f')],_0x1ae83d['query']);_0x4503a8[_0xd1f5('0x44')]=_['intersection'](_0x1ae83d[_0xd1f5('0x3f')],qs['fields'](_0x129a6e[_0xd1f5('0x40')][_0xd1f5('0x45')]));_0x4503a8['attributes']=_0x4503a8[_0xd1f5('0x44')]['length']?_0x4503a8[_0xd1f5('0x44')]:_0x1ae83d['model'];if(_0x129a6e[_0xd1f5('0x40')]['includeAll']){_0x4503a8[_0xd1f5('0x4f')]=[{'all':!![]}];}_0x4503a8=_['merge']({},_0x4503a8,_0x129a6e[_0xd1f5('0x4d')]);return db[_0xd1f5('0x50')]['find'](_0x4503a8)[_0xd1f5('0x35')](handleEntityNotFound(_0x2cd631,null))[_0xd1f5('0x35')](respondWithResult(_0x2cd631,null))[_0xd1f5('0x52')](handleError(_0x2cd631,null));};exports[_0xd1f5('0x53')]=function(_0x3cdcfe,_0x19a50f){return db[_0xd1f5('0x50')][_0xd1f5('0x53')](_0x3cdcfe['body'],{})[_0xd1f5('0x35')](respondWithResult(_0x19a50f,0xc9))[_0xd1f5('0x52')](handleError(_0x19a50f,null));};exports[_0xd1f5('0x34')]=function(_0x767b23,_0x3471e4){if(_0x767b23[_0xd1f5('0x54')]['id']){delete _0x767b23['body']['id'];}return db['WhatsappMessage'][_0xd1f5('0x55')]({'where':{'id':_0x767b23[_0xd1f5('0x56')]['id']}})[_0xd1f5('0x35')](handleEntityNotFound(_0x3471e4,null))['then'](saveUpdates(_0x767b23[_0xd1f5('0x54')],null))[_0xd1f5('0x35')](respondWithResult(_0x3471e4,null))[_0xd1f5('0x52')](handleError(_0x3471e4,null));};exports['destroy']=function(_0x19698c,_0x184a26){return db['WhatsappMessage'][_0xd1f5('0x55')]({'where':{'id':_0x19698c[_0xd1f5('0x56')]['id']}})[_0xd1f5('0x35')](handleEntityNotFound(_0x184a26,null))[_0xd1f5('0x35')](removeEntity(_0x184a26,null))[_0xd1f5('0x52')](handleError(_0x184a26,null));};exports[_0xd1f5('0x57')]=function(_0x22dec4,_0xd09f16){return db[_0xd1f5('0x50')][_0xd1f5('0x57')]()[_0xd1f5('0x35')](respondWithResult(_0xd09f16,null))[_0xd1f5('0x52')](handleError(_0xd09f16,null));};var interaction_log=require(_0xd1f5('0x13'))(_0xd1f5('0x58'));exports['accept']=function(_0x488259,_0x1fe996,_0x16bff8){var _0x5f2eeb={'agent':{},'channel':'whatsapp'};if(_0x488259[_0xd1f5('0x54')]['id']){delete _0x488259[_0xd1f5('0x54')]['id'];}_0x488259['body'][_0xd1f5('0x59')]=!![];_0x488259[_0xd1f5('0x54')][_0xd1f5('0x5a')]=moment()[_0xd1f5('0x5b')](_0xd1f5('0x5c'));_0x488259[_0xd1f5('0x54')][_0xd1f5('0x5d')]=_0x488259['body'][_0xd1f5('0x5d')]||_0x488259[_0xd1f5('0x5e')]['id'];_0x5f2eeb['agent']['id']=_0x488259[_0xd1f5('0x54')][_0xd1f5('0x5d')];return db[_0xd1f5('0x50')][_0xd1f5('0x55')]({'where':{'id':_0x488259[_0xd1f5('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1fe996,null))[_0xd1f5('0x35')](saveUpdates(_0x488259[_0xd1f5('0x54')],null))[_0xd1f5('0x35')](function(_0x50d468){if(_0x50d468){_0x5f2eeb[_0xd1f5('0x25')]=_0x50d468[_0xd1f5('0x5f')]({'plain':!![]});return db['WhatsappInteraction'][_0xd1f5('0x55')]({'where':{'id':_0x50d468[_0xd1f5('0x60')]}});}return null;})[_0xd1f5('0x35')](handleEntityNotFound(_0x1fe996,null))[_0xd1f5('0x35')](function(_0x2dd9c7){if(_0x2dd9c7){return _0x2dd9c7[_0xd1f5('0x34')]({'UserId':_0x488259[_0xd1f5('0x54')][_0xd1f5('0x5d')],'read1stAt':_[_0xd1f5('0x61')](_0x2dd9c7['read1stAt'])?moment()['format'](_0xd1f5('0x5c')):undefined});}return null;})[_0xd1f5('0x35')](function(_0x47ab22){if(_0x47ab22){_0x5f2eeb[_0xd1f5('0x62')]=_0x47ab22[_0xd1f5('0x5f')]({'plain':!![]});interaction_log[_0xd1f5('0x1f')](_0xd1f5('0x63'),_0x488259[_0xd1f5('0x5e')]['id'],_0x488259['user'][_0xd1f5('0x38')],_0x488259[_0xd1f5('0x5e')]['role'],_0x5f2eeb[_0xd1f5('0x62')]['id'],_0x488259['body']?JSON[_0xd1f5('0x64')](_0x488259[_0xd1f5('0x54')]):_0xd1f5('0x65'));return respondWithRpcPromise('AcceptMessage',_0xd1f5('0x66'),_0x5f2eeb);}return null;})[_0xd1f5('0x35')](function(_0x229ad5){var _0x567ba5=_0xd1f5('0x67')+_0x229ad5[_0xd1f5('0x25')]['ContactId'];return db[_0xd1f5('0x68')][_0xd1f5('0x40')](_0x567ba5,{'type':db[_0xd1f5('0x69')][_0xd1f5('0x6a')][_0xd1f5('0x6b')],'raw':!![]})['then'](function(_0x2edb31){return _0x2edb31;});})[_0xd1f5('0x35')](function(_0x478e78){if(_0x478e78){_0x5f2eeb[_0xd1f5('0x25')][_0xd1f5('0x6c')]=_0x478e78[0x0];if(!_0x488259[_0xd1f5('0x54')]['UserId'])return;return db[_0xd1f5('0x6d')][_0xd1f5('0x55')]({'where':{'id':_0x488259['body'][_0xd1f5('0x5d')],'role':'agent'},'attributes':['id',_0xd1f5('0x38'),_0xd1f5('0x6e'),_0xd1f5('0x6f'),_0xd1f5('0x70')],'raw':!![]});}return null;})[_0xd1f5('0x35')](function(_0x2478f3){if(!_0x2478f3)return null;_0x5f2eeb['message'][_0xd1f5('0x71')]=_0x2478f3;return _0x5f2eeb;})[_0xd1f5('0x35')](function(_0x17608e){if(_0x17608e){if(_0x488259[_0xd1f5('0x54')][_0xd1f5('0x72')]){_0x5f2eeb['message']['interface']=util[_0xd1f5('0x5b')](_0xd1f5('0x73'),_0x488259['user'][_0xd1f5('0x38')]);_0x5f2eeb[_0xd1f5('0x25')][_0xd1f5('0x74')]=_0x5f2eeb['channel'];_0x5f2eeb[_0xd1f5('0x25')][_0xd1f5('0x75')]=_0x5f2eeb[_0xd1f5('0x74')];_0x5f2eeb[_0xd1f5('0x25')]['event']=_0xd1f5('0x76');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x5f2eeb['message']},client9002)['then'](function(){return _0x5f2eeb;});}return _0x5f2eeb;}return null;})[_0xd1f5('0x35')](respondWithResult(_0x1fe996,null))[_0xd1f5('0x52')](handleError(_0x1fe996,null));};var interaction_log=require(_0xd1f5('0x13'))('whatsapp-interactions');exports[_0xd1f5('0x32')]=function(_0x2e3b11,_0x4d4422,_0x3897f0){var _0x1c991f={'agent':{},'channel':_0xd1f5('0x77')};if(_0x2e3b11[_0xd1f5('0x54')]['id']){delete _0x2e3b11['body']['id'];}_0x2e3b11[_0xd1f5('0x54')][_0xd1f5('0x5d')]=_0x2e3b11['body']['UserId']||_0x2e3b11[_0xd1f5('0x5e')]['id'];_0x1c991f[_0xd1f5('0x71')]['id']=_0x2e3b11[_0xd1f5('0x54')][_0xd1f5('0x5d')];return db[_0xd1f5('0x50')][_0xd1f5('0x55')]({'where':{'id':_0x2e3b11[_0xd1f5('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4d4422,null))[_0xd1f5('0x35')](function(_0x2ef399){if(_0x2ef399){_0x1c991f[_0xd1f5('0x25')]=_0x2ef399['get']({'plain':!![]});return db[_0xd1f5('0x78')]['find']({'where':{'id':_0x2ef399[_0xd1f5('0x60')]}});}return null;})[_0xd1f5('0x35')](handleEntityNotFound(_0x4d4422,null))['then'](function(_0xd55190){if(_0xd55190){_0x1c991f[_0xd1f5('0x62')]=_0xd55190[_0xd1f5('0x5f')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2e3b11[_0xd1f5('0x5e')]['id'],_0x2e3b11[_0xd1f5('0x5e')]['name'],_0x2e3b11[_0xd1f5('0x5e')]['role'],_0x1c991f[_0xd1f5('0x62')]['id'],_0x2e3b11['body']?JSON['stringify'](_0x2e3b11[_0xd1f5('0x54')]):_0xd1f5('0x65'));return respondWithRpcPromise(_0xd1f5('0x79'),_0xd1f5('0x7a'),_0x1c991f);}return null;})['then'](function(_0x40749f){var _0x16130a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x40749f[_0xd1f5('0x25')]['ContactId'];return db['sequelize'][_0xd1f5('0x40')](_0x16130a,{'type':db[_0xd1f5('0x69')][_0xd1f5('0x6a')][_0xd1f5('0x6b')],'raw':!![]})['then'](function(_0x227781){return _0x227781;});})['then'](function(_0x27bd6a){if(_0x27bd6a){_0x1c991f[_0xd1f5('0x25')][_0xd1f5('0x6c')]=_0x27bd6a[0x0];if(!_0x2e3b11[_0xd1f5('0x54')]['UserId'])return;return db[_0xd1f5('0x6d')][_0xd1f5('0x55')]({'where':{'id':_0x2e3b11[_0xd1f5('0x54')][_0xd1f5('0x5d')],'role':_0xd1f5('0x71')},'attributes':['id',_0xd1f5('0x38'),'fullname','email','internal'],'raw':!![]});}return null;})[_0xd1f5('0x35')](function(_0x2bb1a8){if(!_0x2bb1a8)return null;_0x1c991f[_0xd1f5('0x25')][_0xd1f5('0x71')]=_0x2bb1a8;return _0x1c991f;})[_0xd1f5('0x35')](function(_0x5339d0){if(_0x5339d0){_0x5339d0[_0xd1f5('0x25')][_0xd1f5('0x7b')]=util[_0xd1f5('0x5b')](_0xd1f5('0x73'),_0x2e3b11['user']['name']);_0x5339d0[_0xd1f5('0x25')]['channel']=_0x1c991f['channel'];_0x5339d0[_0xd1f5('0x25')][_0xd1f5('0x75')]=_0x1c991f[_0xd1f5('0x74')];_0x5339d0[_0xd1f5('0x25')][_0xd1f5('0x7c')]=_0xd1f5('0x32');respondWithRpcPromise(_0xd1f5('0x7d'),_0xd1f5('0x7d'),{'event':_0xd1f5('0x7e'),'message':_0x5339d0[_0xd1f5('0x25')]},client9002);return _0x1c991f;}return null;})[_0xd1f5('0x35')](respondWithResult(_0x4d4422,null))[_0xd1f5('0x52')](handleError(_0x4d4422,null));};exports[_0xd1f5('0x28')]=function(_0x4487d8,_0x3a2319,_0x2ebdc9){if(_0x4487d8[_0xd1f5('0x54')]['id']){delete _0x4487d8[_0xd1f5('0x54')]['id'];}var _0x5b19eb;return db[_0xd1f5('0x50')][_0xd1f5('0x55')]({'where':{'id':_0x4487d8['params']['id']}})[_0xd1f5('0x35')](handleEntityNotFound(_0x3a2319,null))[_0xd1f5('0x35')](function(_0x488651){if(_0x488651){_0x5b19eb=_0x488651;return db['WhatsappAccount'][_0xd1f5('0x55')]({'where':{'id':_0x488651[_0xd1f5('0x7f')]}});}})[_0xd1f5('0x35')](handleEntityNotFound(_0x3a2319,null))['then'](function(_0x6986e4){if(_0x6986e4){logger['debug'](_0xd1f5('0x80'),'status',_0xd1f5('0x81'),_0x6986e4[_0xd1f5('0x3d')],util[_0xd1f5('0x82')](_0x4487d8[_0xd1f5('0x54')],{'showHidden':![],'depth':null}));switch(_0x6986e4[_0xd1f5('0x3d')]){case'twilio':if(_0x4487d8[_0xd1f5('0x54')]['MessageSid']&&_0x4487d8[_0xd1f5('0x54')][_0xd1f5('0x83')]===_0x5b19eb[_0xd1f5('0x84')]&&_0x4487d8[_0xd1f5('0x54')][_0xd1f5('0x85')]&&_0x4487d8[_0xd1f5('0x54')][_0xd1f5('0x85')]===_0xd1f5('0x59')){return _0x5b19eb[_0xd1f5('0x34')]({'read':!![]});}else{logger[_0xd1f5('0x24')](_0xd1f5('0x86'),'status',_0xd1f5('0x87'),util[_0xd1f5('0x82')](_0x4487d8[_0xd1f5('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x5b19eb;}})['then'](respondWithResult(_0x3a2319,null))[_0xd1f5('0x52')](handleError(_0x3a2319,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 6245695..4ceeecc 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 _0x765e=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x5df6dd,_0x264678){var _0x11bc3b=function(_0x38061b){while(--_0x38061b){_0x5df6dd['push'](_0x5df6dd['shift']());}};_0x11bc3b(++_0x264678);}(_0x765e,0x131));var _0xe765=function(_0x45e05d,_0x31452a){_0x45e05d=_0x45e05d-0x0;var _0x5c2876=_0x765e[_0x45e05d];return _0x5c2876;};'use strict';var EventEmitter=require(_0xe765('0x0'));var WhatsappMessage=require(_0xe765('0x1'))['db'][_0xe765('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xe765('0x3')](0x0);var events={'afterCreate':_0xe765('0x4'),'afterUpdate':_0xe765('0x5'),'afterDestroy':_0xe765('0x6')};function emitEvent(_0x38d6d2){return function(_0x30703f,_0xd2e232,_0x9559d4){WhatsappMessageEvents[_0xe765('0x7')](_0x38d6d2+':'+_0x30703f['id'],_0x30703f);WhatsappMessageEvents[_0xe765('0x7')](_0x38d6d2,_0x30703f);_0x9559d4(null);};}for(var e in events){if(events[_0xe765('0x8')](e)){var event=events[e];WhatsappMessage[_0xe765('0x9')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x6215=['events','../../mysqldb','WhatsappMessage','save','update','remove','hook','exports'];(function(_0x54054f,_0x2fe26c){var _0x41480e=function(_0x1ae68e){while(--_0x1ae68e){_0x54054f['push'](_0x54054f['shift']());}};_0x41480e(++_0x2fe26c);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x5621('0x0'));var WhatsappMessage=require(_0x5621('0x1'))['db'][_0x5621('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5621('0x3'),'afterUpdate':_0x5621('0x4'),'afterDestroy':_0x5621('0x5')};function emitEvent(_0x173213){return function(_0x204284,_0x13397a,_0x492c6d){WhatsappMessageEvents['emit'](_0x173213+':'+_0x204284['id'],_0x204284);WhatsappMessageEvents['emit'](_0x173213,_0x204284);_0x492c6d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x5621('0x6')](e,emitEvent(event));}}module[_0x5621('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index ffc193f..b002d70 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 _0xd086=['WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','./whatsappMessage.attributes','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','catch','error','find','type','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','sid'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xd086,0x1da));var _0x6d08=function(_0x29a148,_0x128f93){_0x29a148=_0x29a148-0x0;var _0x5a100a=_0xd086[_0x29a148];return _0x5a100a;};'use strict';var _=require(_0x6d08('0x0'));var util=require('util');var logger=require(_0x6d08('0x1'))(_0x6d08('0x2'));var moment=require(_0x6d08('0x3'));var BPromise=require(_0x6d08('0x4'));var rp=require(_0x6d08('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6d08('0x6'));module['exports']=function(_0x267397,_0x99f762){return _0x267397['define'](_0x6d08('0x7'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x6d08('0x8'),'fields':[_0x6d08('0x8')]},{'name':_0x6d08('0x9'),'fields':[_0x6d08('0xa')],'type':_0x6d08('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d6c11,_0x74c228,_0x4a8adc){var _0x548402=_0x267397[_0x6d08('0xc')];var _0x371536=_0x1d6c11['get']({'plain':!![]});if(_0x371536[_0x6d08('0xd')][_0x6d08('0xe')]()==='in'||_0x371536['direction'][_0x6d08('0xe')]()===_0x6d08('0xf')&&!_0x371536[_0x6d08('0x10')]&&!_[_0x6d08('0x11')](_0x371536['UserId'])){_0x548402[_0x6d08('0x12')]['findOne']({'where':{'id':_0x371536[_0x6d08('0x13')]}})[_0x6d08('0x14')](function(_0xd886d4){if(_0xd886d4){_0xd886d4[_0x6d08('0x15')]({'lastMsgAt':_0x371536[_0x6d08('0x16')],'lastMsgDirection':_0x371536[_0x6d08('0xd')][_0x6d08('0xe')]()});}})[_0x6d08('0x17')](function(_0x1fa83f){console[_0x6d08('0x18')](_0x1fa83f);});}if(_0x371536[_0x6d08('0xd')]===_0x6d08('0xf')&&!_0x371536[_0x6d08('0x10')]){var _0x39cc99;_0x548402['WhatsappAccount'][_0x6d08('0x19')]({'where':{'id':_0x371536['WhatsappAccountId']},'raw':!![]})[_0x6d08('0x14')](function(_0x3e135a){_0x39cc99=_0x3e135a;if(_0x39cc99&&_0x39cc99[_0x6d08('0x1a')]){switch(_0x39cc99['type']){case'twilio':var _0x5b26c1=require(_0x6d08('0x1b'));if(_0x39cc99[_0x6d08('0x1c')]&&_0x39cc99[_0x6d08('0x1d')]&&_0x39cc99[_0x6d08('0x1e')]){var _0x480ee2=new _0x5b26c1(_0x39cc99['accountSid'],_0x39cc99[_0x6d08('0x1d')]);_0x480ee2[_0x6d08('0x1f')]['create']({'body':_0x371536['body'],'to':_0x6d08('0x20')+_0x371536[_0x6d08('0x1e')],'from':_0x6d08('0x20')+_0x39cc99['phone'],'statusCallback':_0x39cc99[_0x6d08('0x21')]+_0x6d08('0x22')+_0x371536['id']+'/status?token='+_0x39cc99['token']})['then'](function(_0x27b305){if(_0x27b305[_0x6d08('0x23')]){return _0x1d6c11[_0x6d08('0x15')]({'messageId':_0x27b305[_0x6d08('0x23')]});}})[_0x6d08('0x17')](function(_0x127e59){logger['error'](_0x6d08('0x24'),_0x6d08('0x25'),_0x6d08('0x1b'),util[_0x6d08('0x26')](_0x127e59,{'showHidden':![],'depth':null}));});}else{logger[_0x6d08('0x18')](_0x6d08('0x24'),_0x6d08('0x25'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x6d08('0x27'):var _0xfbb7e9=_0x39cc99[_0x6d08('0x1c')];var _0x48c90d=_0x39cc99[_0x6d08('0x1d')];var _0x438fb9=_0x39cc99['baseUrl']+_0x6d08('0x28')+_0xfbb7e9+_0x6d08('0x29');var _0x3bef1a={'to':[_0x371536[_0x6d08('0x1e')]],'message':{'type':_0x6d08('0x2a'),'text':_0x371536[_0x6d08('0xa')]}};var _0x2a5550={'method':_0x6d08('0x2b'),'uri':_0x438fb9,'headers':{'Authorization':_0x6d08('0x2c')+_0x48c90d,'Content-Type':_0x6d08('0x2d')},'body':_0x3bef1a,'json':!![]};rp(_0x2a5550)[_0x6d08('0x14')](function(_0x33a8c3){if(_0x33a8c3[_0x6d08('0x2e')][0x0][_0x6d08('0x2f')]){return _0x1d6c11[_0x6d08('0x15')]({'messageId':_0x33a8c3['statuses'][0x0]['message_id']});}})[_0x6d08('0x17')](function(_0x10ba8d){logger[_0x6d08('0x30')](_0x6d08('0x31'),_0x10ba8d);});break;}}})['finally'](function(){_0x4a8adc();});}else{_0x4a8adc();}}},'charset':'utf8mb4','collate':_0x6d08('0x32')});}; \ No newline at end of file +var _0xeec6=['Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','whatsapp:','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','baseUrl','/whatsapp/v1/','/messages/','text'];(function(_0x3a57ea,_0x5b39c5){var _0x1d26ca=function(_0x5a04b3){while(--_0x5a04b3){_0x3a57ea['push'](_0x3a57ea['shift']());}};_0x1d26ca(++_0x5b39c5);}(_0xeec6,0x1c2));var _0x6eec=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0xeec6[_0x56138f];return _0x1acaf7;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var logger=require(_0x6eec('0x2'))(_0x6eec('0x3'));var moment=require('moment');var BPromise=require(_0x6eec('0x4'));var rp=require(_0x6eec('0x5'));var fetch=require(_0x6eec('0x6'));var fs=require('fs');var path=require(_0x6eec('0x7'));var rimraf=require(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var attributes=require('./whatsappMessage.attributes');module[_0x6eec('0xa')]=function(_0x3c6eda,_0x48064a){return _0x3c6eda[_0x6eec('0xb')](_0x6eec('0xc'),attributes,{'tableName':_0x6eec('0xd'),'paranoid':![],'indexes':[{'name':_0x6eec('0xe'),'fields':['messageId']},{'name':_0x6eec('0xf'),'fields':[_0x6eec('0x10')],'type':_0x6eec('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49ad4c,_0x595dd4,_0x5e8aba){var _0x295cae=_0x3c6eda[_0x6eec('0x12')];var _0x51a9e3=_0x49ad4c['get']({'plain':!![]});if(_0x51a9e3[_0x6eec('0x13')]['toLowerCase']()==='in'||_0x51a9e3[_0x6eec('0x13')][_0x6eec('0x14')]()===_0x6eec('0x15')&&!_0x51a9e3[_0x6eec('0x16')]&&!_[_0x6eec('0x17')](_0x51a9e3['UserId'])){_0x295cae[_0x6eec('0x18')][_0x6eec('0x19')]({'where':{'id':_0x51a9e3[_0x6eec('0x1a')]}})[_0x6eec('0x1b')](function(_0x3d653b){if(_0x3d653b){_0x3d653b[_0x6eec('0x1c')]({'lastMsgAt':_0x51a9e3[_0x6eec('0x1d')],'lastMsgDirection':_0x51a9e3[_0x6eec('0x13')][_0x6eec('0x14')]()});}})[_0x6eec('0x1e')](function(_0x5e2a9b){console[_0x6eec('0x1f')](_0x5e2a9b);});}if(_0x51a9e3['direction']===_0x6eec('0x15')&&!_0x51a9e3[_0x6eec('0x16')]){var _0x512619;_0x295cae[_0x6eec('0x20')][_0x6eec('0x21')]({'where':{'id':_0x51a9e3[_0x6eec('0x22')]},'raw':!![]})['then'](function(_0x87f3be){_0x512619=_0x87f3be;if(_0x512619&&_0x512619[_0x6eec('0x23')]){switch(_0x512619[_0x6eec('0x23')]){case _0x6eec('0x24'):var _0xd86135=require(_0x6eec('0x24'));if(_0x512619['accountSid']&&_0x512619[_0x6eec('0x25')]&&_0x512619[_0x6eec('0x26')]){var _0x132652=new _0xd86135(_0x512619[_0x6eec('0x27')],_0x512619[_0x6eec('0x25')]);_0x132652[_0x6eec('0x28')]['create']({'body':_0x51a9e3[_0x6eec('0x10')],'to':_0x6eec('0x29')+_0x51a9e3[_0x6eec('0x26')],'from':_0x6eec('0x29')+_0x512619[_0x6eec('0x26')],'statusCallback':_0x512619[_0x6eec('0x2a')]+'/api/whatsapp/messages/'+_0x51a9e3['id']+_0x6eec('0x2b')+_0x512619[_0x6eec('0x2c')]})[_0x6eec('0x1b')](function(_0x33d580){if(_0x33d580[_0x6eec('0x2d')]){return _0x49ad4c[_0x6eec('0x1c')]({'messageId':_0x33d580[_0x6eec('0x2d')]});}})[_0x6eec('0x1e')](function(_0x316317){logger['error'](_0x6eec('0x2e'),_0x6eec('0x2f'),_0x6eec('0x24'),util[_0x6eec('0x30')](_0x316317,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6eec('0x2e'),_0x6eec('0x2f'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x6eec('0x31'):var _0x47ed95=_0x512619[_0x6eec('0x27')];var _0xede270=_0x512619[_0x6eec('0x25')];var _0x34bdea=_0x512619[_0x6eec('0x32')]+_0x6eec('0x33')+_0x47ed95+_0x6eec('0x34');var _0x33e4a1={'to':[_0x51a9e3[_0x6eec('0x26')]],'message':{'type':_0x6eec('0x35'),'text':_0x51a9e3['body']}};var _0x383c6b={'method':'POST','uri':_0x34bdea,'headers':{'Authorization':_0x6eec('0x36')+_0xede270,'Content-Type':_0x6eec('0x37')},'body':_0x33e4a1,'json':!![]};rp(_0x383c6b)[_0x6eec('0x1b')](function(_0x487de8){if(_0x487de8['statuses'][0x0]['message_id']){return _0x49ad4c[_0x6eec('0x1c')]({'messageId':_0x487de8[_0x6eec('0x38')][0x0][_0x6eec('0x39')]});}})[_0x6eec('0x1e')](function(_0x20c794){logger[_0x6eec('0x3a')](_0x6eec('0x3b'),_0x20c794);});break;}}})[_0x6eec('0x3c')](function(){_0x5e8aba();});}else{_0x5e8aba();}}},'charset':_0x6eec('0x3d'),'collate':_0x6eec('0x3e')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 38e7663..3193acf 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 _0xf373=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateWhatsappMessage','create','options','raw','lodash','util','bluebird','randomstring'];(function(_0x847592,_0x38709a){var _0x5e954d=function(_0x404616){while(--_0x404616){_0x847592['push'](_0x847592['shift']());}};_0x5e954d(++_0x38709a);}(_0xf373,0x1a0));var _0x3f37=function(_0x50e2a3,_0x39fbe5){_0x50e2a3=_0x50e2a3-0x0;var _0x425def=_0xf373[_0x50e2a3];return _0x425def;};'use strict';var _=require(_0x3f37('0x0'));var util=require(_0x3f37('0x1'));var moment=require('moment');var BPromise=require(_0x3f37('0x2'));var rs=require(_0x3f37('0x3'));var fs=require('fs');var Redis=require(_0x3f37('0x4'));var db=require(_0x3f37('0x5'))['db'];var utils=require(_0x3f37('0x6'));var logger=require(_0x3f37('0x7'))(_0x3f37('0x8'));var config=require(_0x3f37('0x9'));var jayson=require(_0x3f37('0xa'));var client=jayson[_0x3f37('0xb')]['http']({'port':0x232a});config['redis']=_[_0x3f37('0xc')](config[_0x3f37('0xd')],{'host':_0x3f37('0xe'),'port':0x18eb});var socket=require(_0x3f37('0xf'))(new Redis(config[_0x3f37('0xd')]));require(_0x3f37('0x10'))[_0x3f37('0x11')](socket);function respondWithRpcPromise(_0x37198a,_0x44cab3,_0x18f985){return new BPromise(function(_0x2af3f6,_0x51a441){return client[_0x3f37('0x12')](_0x37198a,_0x18f985)[_0x3f37('0x13')](function(_0x18b1dd){logger['info'](_0x3f37('0x14'),_0x44cab3,_0x3f37('0x15'));logger[_0x3f37('0x16')](_0x3f37('0x17'),_0x44cab3,_0x3f37('0x15'),JSON[_0x3f37('0x18')](_0x18b1dd));if(_0x18b1dd['error']){if(_0x18b1dd[_0x3f37('0x19')][_0x3f37('0x1a')]===0x1f4){logger[_0x3f37('0x19')](_0x3f37('0x14'),_0x44cab3,_0x18b1dd[_0x3f37('0x19')]['message']);return _0x51a441(_0x18b1dd[_0x3f37('0x19')][_0x3f37('0x1b')]);}logger[_0x3f37('0x19')](_0x3f37('0x14'),_0x44cab3,_0x18b1dd[_0x3f37('0x19')][_0x3f37('0x1b')]);return _0x2af3f6(_0x18b1dd[_0x3f37('0x19')][_0x3f37('0x1b')]);}else{logger[_0x3f37('0x1c')](_0x3f37('0x14'),_0x44cab3,_0x3f37('0x15'));_0x2af3f6(_0x18b1dd[_0x3f37('0x1d')][_0x3f37('0x1b')]);}})[_0x3f37('0x1e')](function(_0x5d8767){logger['error'](_0x3f37('0x14'),_0x44cab3,_0x5d8767);_0x51a441(_0x5d8767);});});}exports[_0x3f37('0x1f')]=function(_0x4e7679){var _0x4fc9fc=this;return new Promise(function(_0x37e27a,_0x3c1a7b){return db['WhatsappMessage'][_0x3f37('0x20')](_0x4e7679['body'],{'raw':_0x4e7679[_0x3f37('0x21')]?_0x4e7679[_0x3f37('0x21')][_0x3f37('0x22')]===undefined?!![]:![]:!![]})[_0x3f37('0x13')](function(_0x314666){logger[_0x3f37('0x1c')]('CreateWhatsappMessage',_0x4e7679);logger[_0x3f37('0x16')](_0x3f37('0x1f'),_0x4e7679,JSON[_0x3f37('0x18')](_0x314666));_0x37e27a(_0x314666);})['catch'](function(_0x2d6b47){logger[_0x3f37('0x19')](_0x3f37('0x1f'),_0x2d6b47['message'],_0x4e7679);_0x3c1a7b(_0x4fc9fc[_0x3f37('0x19')](0x1f4,_0x2d6b47[_0x3f37('0x1b')]));});});}; \ No newline at end of file +var _0x461f=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','CreateWhatsappMessage','WhatsappMessage','create','options','debug','lodash','moment'];(function(_0x254112,_0x200b0e){var _0x427d39=function(_0x231df1){while(--_0x231df1){_0x254112['push'](_0x254112['shift']());}};_0x427d39(++_0x200b0e);}(_0x461f,0xd7));var _0xf461=function(_0x2a43e5,_0x4ad894){_0x2a43e5=_0x2a43e5-0x0;var _0x28301d=_0x461f[_0x2a43e5];return _0x28301d;};'use strict';var _=require(_0xf461('0x0'));var util=require('util');var moment=require(_0xf461('0x1'));var BPromise=require(_0xf461('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf461('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf461('0x4'));var logger=require(_0xf461('0x5'))(_0xf461('0x6'));var config=require('../../config/environment');var jayson=require(_0xf461('0x7'));var client=jayson[_0xf461('0x8')][_0xf461('0x9')]({'port':0x232a});config['redis']=_[_0xf461('0xa')](config[_0xf461('0xb')],{'host':_0xf461('0xc'),'port':0x18eb});var socket=require(_0xf461('0xd'))(new Redis(config[_0xf461('0xb')]));require(_0xf461('0xe'))['register'](socket);function respondWithRpcPromise(_0x3ae282,_0x160e40,_0x247c6f){return new BPromise(function(_0xbc8872,_0x5ab000){return client[_0xf461('0xf')](_0x3ae282,_0x247c6f)[_0xf461('0x10')](function(_0x2245d4){logger[_0xf461('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x160e40,_0xf461('0x12'));logger['debug'](_0xf461('0x13'),_0x160e40,_0xf461('0x12'),JSON[_0xf461('0x14')](_0x2245d4));if(_0x2245d4[_0xf461('0x15')]){if(_0x2245d4['error'][_0xf461('0x16')]===0x1f4){logger[_0xf461('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x160e40,_0x2245d4['error'][_0xf461('0x17')]);return _0x5ab000(_0x2245d4[_0xf461('0x15')][_0xf461('0x17')]);}logger['error'](_0xf461('0x18'),_0x160e40,_0x2245d4[_0xf461('0x15')][_0xf461('0x17')]);return _0xbc8872(_0x2245d4[_0xf461('0x15')]['message']);}else{logger[_0xf461('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x160e40,_0xf461('0x12'));_0xbc8872(_0x2245d4[_0xf461('0x19')][_0xf461('0x17')]);}})['catch'](function(_0x11c6f3){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x160e40,_0x11c6f3);_0x5ab000(_0x11c6f3);});});}exports[_0xf461('0x1a')]=function(_0x37e78e){var _0xbf9fb=this;return new Promise(function(_0x5d6362,_0x1a245f){return db[_0xf461('0x1b')][_0xf461('0x1c')](_0x37e78e['body'],{'raw':_0x37e78e[_0xf461('0x1d')]?_0x37e78e[_0xf461('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xf461('0x10')](function(_0x52a5b0){logger['info'](_0xf461('0x1a'),_0x37e78e);logger[_0xf461('0x1e')]('CreateWhatsappMessage',_0x37e78e,JSON[_0xf461('0x14')](_0x52a5b0));_0x5d6362(_0x52a5b0);})['catch'](function(_0x229098){logger[_0xf461('0x15')](_0xf461('0x1a'),_0x229098['message'],_0x37e78e);_0x1a245f(_0xbf9fb[_0xf461('0x15')](0x1f4,_0x229098[_0xf461('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 64154c2..be40c17 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 _0x707a=['whatsappMessage:','save','update','emit','register','length'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x707a,0xc7));var _0xa707=function(_0x271178,_0x1d86ab){_0x271178=_0x271178-0x0;var _0x3a927f=_0x707a[_0x271178];return _0x3a927f;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xa707('0x0'),'remove',_0xa707('0x1')];function createListener(_0x15144f,_0x5ac7e1){return function(_0x5e993a){_0x5ac7e1[_0xa707('0x2')](_0x15144f,_0x5e993a);};}function removeListener(_0x34115c,_0x17c5ca){return function(){WhatsappMessageEvents['removeListener'](_0x34115c,_0x17c5ca);};}exports[_0xa707('0x3')]=function(_0x3d0631){for(var _0x1d72ad=0x0,_0x2b1ce9=events[_0xa707('0x4')];_0x1d72ad<_0x2b1ce9;_0x1d72ad++){var _0x2901df=events[_0x1d72ad];var _0x529ab2=createListener(_0xa707('0x5')+_0x2901df,_0x3d0631);WhatsappMessageEvents['on'](_0x2901df,_0x529ab2);}}; \ No newline at end of file +var _0x29e1=['remove','update','emit','removeListener','register','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x5dafd0,_0x3bcbb6){var _0x364354=function(_0x5da31c){while(--_0x5da31c){_0x5dafd0['push'](_0x5dafd0['shift']());}};_0x364354(++_0x3bcbb6);}(_0x29e1,0x1b6));var _0x129e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e1[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappMessageEvents=require(_0x129e('0x0'));var events=[_0x129e('0x1'),_0x129e('0x2'),_0x129e('0x3')];function createListener(_0x3a4433,_0x47db57){return function(_0x44e5c9){_0x47db57[_0x129e('0x4')](_0x3a4433,_0x44e5c9);};}function removeListener(_0x294717,_0x631ea7){return function(){WhatsappMessageEvents[_0x129e('0x5')](_0x294717,_0x631ea7);};}exports[_0x129e('0x6')]=function(_0xa75ab8){for(var _0x351e52=0x0,_0x373ffc=events['length'];_0x351e52<_0x373ffc;_0x351e52++){var _0x2ebe8e=events[_0x351e52];var _0x25009d=createListener(_0x129e('0x7')+_0x2ebe8e,_0xa75ab8);WhatsappMessageEvents['on'](_0x2ebe8e,_0x25009d);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 30ab4ec..f651b92 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 _0xcd0d=['exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','put','delete','destroy','removeTeams'];(function(_0x3b9382,_0x32d102){var _0x303c10=function(_0xd10b4){while(--_0xd10b4){_0x3b9382['push'](_0x3b9382['shift']());}};_0x303c10(++_0x32d102);}(_0xcd0d,0xa3));var _0xdcd0=function(_0x3f2ecf,_0x4ccad6){_0x3f2ecf=_0x3f2ecf-0x0;var _0xa6dd7e=_0xcd0d[_0x3f2ecf];return _0xa6dd7e;};'use strict';var multer=require(_0xdcd0('0x0'));var util=require('util');var path=require(_0xdcd0('0x1'));var timeout=require(_0xdcd0('0x2'));var express=require(_0xdcd0('0x3'));var router=express['Router']();var fs_extra=require(_0xdcd0('0x4'));var auth=require(_0xdcd0('0x5'));var interaction=require(_0xdcd0('0x6'));var config=require(_0xdcd0('0x7'));var controller=require(_0xdcd0('0x8'));router[_0xdcd0('0x9')]('/',auth[_0xdcd0('0xa')](),controller['index']);router[_0xdcd0('0x9')](_0xdcd0('0xb'),auth[_0xdcd0('0xa')](),controller[_0xdcd0('0xc')]);router[_0xdcd0('0x9')](_0xdcd0('0xd'),auth[_0xdcd0('0xa')](),controller['show']);router[_0xdcd0('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0xdcd0('0xe')]);router[_0xdcd0('0x9')](_0xdcd0('0xf'),auth[_0xdcd0('0xa')](),controller['getTeams']);router[_0xdcd0('0x9')](_0xdcd0('0x10'),auth[_0xdcd0('0xa')](),controller[_0xdcd0('0x11')]);router['post']('/',auth[_0xdcd0('0xa')](),controller[_0xdcd0('0x12')]);router[_0xdcd0('0x13')]('/:id/teams',auth[_0xdcd0('0xa')](),controller[_0xdcd0('0x14')]);router[_0xdcd0('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xdcd0('0x15')]);router[_0xdcd0('0x16')]('/:id',auth[_0xdcd0('0xa')](),controller['update']);router[_0xdcd0('0x17')](_0xdcd0('0xd'),auth['isAuthenticated'](),controller[_0xdcd0('0x18')]);router[_0xdcd0('0x17')](_0xdcd0('0xf'),auth[_0xdcd0('0xa')](),controller[_0xdcd0('0x19')]);router[_0xdcd0('0x17')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xdcd0('0x1a')]=router; \ No newline at end of file +var _0xda0a=['/:id/users','post','create','addTeams','addAgents','delete','destroy','removeTeams','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x2df2d0,_0x1d6ea8){var _0x3c4438=function(_0x456da2){while(--_0x456da2){_0x2df2d0['push'](_0x2df2d0['shift']());}};_0x3c4438(++_0x1d6ea8);}(_0xda0a,0xea));var _0xada0=function(_0x57c558,_0x3ea855){_0x57c558=_0x57c558-0x0;var _0x1844be=_0xda0a[_0x57c558];return _0x1844be;};'use strict';var multer=require('multer');var util=require(_0xada0('0x0'));var path=require(_0xada0('0x1'));var timeout=require(_0xada0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xada0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xada0('0x4'));var config=require(_0xada0('0x5'));var controller=require(_0xada0('0x6'));router[_0xada0('0x7')]('/',auth[_0xada0('0x8')](),controller[_0xada0('0x9')]);router[_0xada0('0x7')](_0xada0('0xa'),auth[_0xada0('0x8')](),controller['describe']);router[_0xada0('0x7')](_0xada0('0xb'),auth[_0xada0('0x8')](),controller['show']);router[_0xada0('0x7')](_0xada0('0xc'),auth[_0xada0('0x8')](),controller[_0xada0('0xd')]);router[_0xada0('0x7')](_0xada0('0xe'),auth[_0xada0('0x8')](),controller[_0xada0('0xf')]);router[_0xada0('0x7')](_0xada0('0x10'),auth[_0xada0('0x8')](),controller['getAgents']);router[_0xada0('0x11')]('/',auth[_0xada0('0x8')](),controller[_0xada0('0x12')]);router[_0xada0('0x11')](_0xada0('0xe'),auth['isAuthenticated'](),controller[_0xada0('0x13')]);router[_0xada0('0x11')]('/:id/users',auth[_0xada0('0x8')](),controller[_0xada0('0x14')]);router['put'](_0xada0('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xada0('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xada0('0x16')]);router['delete'](_0xada0('0xe'),auth[_0xada0('0x8')](),controller[_0xada0('0x17')]);router[_0xada0('0x15')](_0xada0('0x10'),auth[_0xada0('0x8')](),controller['removeAgents']);module[_0xada0('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 7494cf2..ca108a2 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 _0xc17f=['sequelize','exports','STRING','name','INTEGER','ENUM','beepall','roundrobin'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xc17f,0xb8));var _0xfc17=function(_0x4da568,_0x594839){_0x4da568=_0x4da568-0x0;var _0x25387a=_0xc17f[_0x4da568];return _0x25387a;};'use strict';var Sequelize=require(_0xfc17('0x0'));module[_0xfc17('0x1')]={'name':{'type':Sequelize[_0xfc17('0x2')],'unique':_0xfc17('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xfc17('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfc17('0x5')]('rrmemory',_0xfc17('0x6'),_0xfc17('0x7'))},'description':{'type':Sequelize[_0xfc17('0x2')]}}; \ No newline at end of file +var _0x976a=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x468ee6,_0x21623){var _0x18ebdd=function(_0x2ecba0){while(--_0x2ecba0){_0x468ee6['push'](_0x468ee6['shift']());}};_0x18ebdd(++_0x21623);}(_0x976a,0xf4));var _0xa976=function(_0x699072,_0x3aca68){_0x699072=_0x699072-0x0;var _0x44edc2=_0x976a[_0x699072];return _0x44edc2;};'use strict';var Sequelize=require(_0xa976('0x0'));module[_0xa976('0x1')]={'name':{'type':Sequelize[_0xa976('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xa976('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa976('0x4')](_0xa976('0x5'),_0xa976('0x6'),_0xa976('0x7'))},'description':{'type':Sequelize[_0xa976('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 1d7484e..0023c19 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 _0x6d12=['undefined','limit','count','Content-Range','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','index','map','WhatsappQueue','rawAttributes','type','key','where','include','query','show','params','model','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','user','role','UserProfileSection','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','keys','UserWhatsappQueue','hasOwnProperty','nolimit','order','WhatsappQueueId','filter','findAll','UserId','agent','updatedAt','createdAt','rows','format','%s/%s','SIP','whatsappPause','getTeams','findOne','Team','sort','pick','ids','User','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','Agents','clone','toString','QueryTypes','includes','union','value','removeTeams','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','json','offset'];(function(_0x26299e,_0x394ad1){var _0x6c4f4a=function(_0x539ae9){while(--_0x539ae9){_0x26299e['push'](_0x26299e['shift']());}};_0x6c4f4a(++_0x394ad1);}(_0x6d12,0x15b));var _0x26d1=function(_0x14cc9d,_0x138641){_0x14cc9d=_0x14cc9d-0x0;var _0x28fee3=_0x6d12[_0x14cc9d];return _0x28fee3;};'use strict';var BPromise=require(_0x26d1('0x0'));var util=require(_0x26d1('0x1'));var _=require(_0x26d1('0x2'));var squel=require(_0x26d1('0x3'));var Redis=require('ioredis');var qs=require(_0x26d1('0x4'));var logger=require('../../config/logger')(_0x26d1('0x5'));var config=require(_0x26d1('0x6'));var db=require(_0x26d1('0x7'))['db'];config[_0x26d1('0x8')]=_[_0x26d1('0x9')](config[_0x26d1('0x8')],{'host':_0x26d1('0xa'),'port':0x18eb});var socket=require(_0x26d1('0xb'))(new Redis(config['redis']));require(_0x26d1('0xc'))[_0x26d1('0xd')](socket);function respondWithStatusCode(_0x3e157f,_0x21f510){_0x21f510=_0x21f510||0xcc;return function(_0x2d1f84){if(_0x2d1f84){return _0x3e157f[_0x26d1('0xe')](_0x21f510);}return _0x3e157f['status'](_0x21f510)[_0x26d1('0xf')]();};}function respondWithResult(_0x2dff29,_0x2e69f7){_0x2e69f7=_0x2e69f7||0xc8;return function(_0x5116de){if(_0x5116de){return _0x2dff29[_0x26d1('0x10')](_0x2e69f7)[_0x26d1('0x11')](_0x5116de);}};}function respondWithFilteredResult(_0x32230a,_0x468c88){return function(_0xba7231){if(_0xba7231){var _0x529899=typeof _0x468c88[_0x26d1('0x12')]===_0x26d1('0x13')&&typeof _0x468c88[_0x26d1('0x14')]===_0x26d1('0x13');var _0x8a60ba=_0xba7231[_0x26d1('0x15')];var _0x44e51b=_0x529899?0x0:_0x468c88[_0x26d1('0x12')];var _0x546283=_0x529899?_0xba7231[_0x26d1('0x15')]:_0x468c88[_0x26d1('0x12')]+_0x468c88[_0x26d1('0x14')];var _0x155106;if(_0x546283>=_0x8a60ba){_0x546283=_0x8a60ba;_0x155106=0xc8;}else{_0x155106=0xce;}_0x32230a[_0x26d1('0x10')](_0x155106);return _0x32230a['set'](_0x26d1('0x16'),_0x44e51b+'-'+_0x546283+'/'+_0x8a60ba)[_0x26d1('0x11')](_0xba7231);}return null;};}function saveUpdates(_0x5d0c91){return function(_0x2571e0){if(_0x2571e0){return _0x2571e0[_0x26d1('0x17')](_0x5d0c91)[_0x26d1('0x18')](function(_0x37f3fa){return _0x37f3fa;});}return null;};}function removeEntity(_0x46ba2c){return function(_0x34504e){if(_0x34504e){return _0x34504e[_0x26d1('0x19')]()[_0x26d1('0x18')](function(){var _0x15d96f=_0x34504e[_0x26d1('0x1a')]({'plain':!![]});var _0x24f6b4=_0x26d1('0x1b');return db[_0x26d1('0x1c')][_0x26d1('0x19')]({'where':{'type':_0x24f6b4,'resourceId':_0x15d96f['id']}})[_0x26d1('0x18')](function(){return _0x34504e;});})[_0x26d1('0x18')](function(){_0x46ba2c[_0x26d1('0x10')](0xcc)[_0x26d1('0xf')]();});}};}function handleEntityNotFound(_0x2c07a7){return function(_0x1b95a5){if(!_0x1b95a5){_0x2c07a7[_0x26d1('0xe')](0x194);}return _0x1b95a5;};}function handleError(_0x5563ad,_0x3bd9ed){_0x3bd9ed=_0x3bd9ed||0x1f4;return function(_0x4e68a7){logger[_0x26d1('0x1d')](_0x4e68a7[_0x26d1('0x1e')]);if(_0x4e68a7['name']){delete _0x4e68a7['name'];}_0x5563ad[_0x26d1('0x10')](_0x3bd9ed)['send'](_0x4e68a7);};}exports[_0x26d1('0x1f')]=function(_0x226cc3,_0x419a85){var _0x27779b={};var _0x22bbf6={'count':0x0,'rows':[]};var _0x4a0a36=_[_0x26d1('0x20')](db[_0x26d1('0x21')][_0x26d1('0x22')],function(_0x89b85a){return{'name':_0x89b85a['fieldName'],'type':_0x89b85a[_0x26d1('0x23')][_0x26d1('0x24')]};});_0x27779b=qs['getOptions'](_0x4a0a36,_0x226cc3);var _0x47dd43={'where':_0x27779b[_0x26d1('0x25')]};return db[_0x26d1('0x21')]['count'](_0x47dd43)[_0x26d1('0x18')](function(_0xff66a5){_0x22bbf6[_0x26d1('0x15')]=_0xff66a5;_0x27779b[_0x26d1('0x26')]=qs['include'](_0x226cc3[_0x26d1('0x27')]);return db['WhatsappQueue']['findAll'](_0x27779b);})[_0x26d1('0x18')](function(_0xf84875){_0x22bbf6['rows']=_0xf84875;return _0x22bbf6;})['then'](respondWithFilteredResult(_0x419a85,_0x27779b))['catch'](handleError(_0x419a85,null));};exports[_0x26d1('0x28')]=function(_0x3b7f27,_0x55c7ec){var _0x1d01a9={'raw':!![],'where':{'id':_0x3b7f27[_0x26d1('0x29')]['id']}},_0x2499ac={};_0x2499ac[_0x26d1('0x2a')]=_['keys'](db['WhatsappQueue'][_0x26d1('0x22')]);_0x2499ac['query']=_['keys'](_0x3b7f27['query']);_0x2499ac[_0x26d1('0x2b')]=_[_0x26d1('0x2c')](_0x2499ac['model'],_0x2499ac['query']);_0x1d01a9[_0x26d1('0x2d')]=_['intersection'](_0x2499ac[_0x26d1('0x2a')],qs[_0x26d1('0x2e')](_0x3b7f27[_0x26d1('0x27')][_0x26d1('0x2e')]));_0x1d01a9['attributes']=_0x1d01a9[_0x26d1('0x2d')][_0x26d1('0x2f')]?_0x1d01a9[_0x26d1('0x2d')]:_0x2499ac['model'];if(_0x3b7f27['query'][_0x26d1('0x30')]){_0x1d01a9[_0x26d1('0x26')]=[{'all':!![]}];}_0x1d01a9=_[_0x26d1('0x31')]({},_0x1d01a9,_0x3b7f27[_0x26d1('0x32')]);return db[_0x26d1('0x21')][_0x26d1('0x33')](_0x1d01a9)[_0x26d1('0x18')](handleEntityNotFound(_0x55c7ec,null))[_0x26d1('0x18')](respondWithResult(_0x55c7ec,null))[_0x26d1('0x34')](handleError(_0x55c7ec,null));};exports[_0x26d1('0x35')]=function(_0x9e019c,_0x232ad9){return db[_0x26d1('0x21')][_0x26d1('0x35')](_0x9e019c['body'],{})['then'](function(_0x380338){var _0x427e16=_0x9e019c[_0x26d1('0x36')][_0x26d1('0x1a')]({'plain':!![]});if(!_0x427e16)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x427e16[_0x26d1('0x37')]===_0x26d1('0x36')){var _0x1fe772=_0x380338[_0x26d1('0x1a')]({'plain':!![]});var _0x236583=_0x26d1('0x1b');return db[_0x26d1('0x38')][_0x26d1('0x33')]({'where':{'name':_0x236583,'userProfileId':_0x427e16[_0x26d1('0x39')]},'raw':!![]})[_0x26d1('0x18')](function(_0x2c4411){if(_0x2c4411&&_0x2c4411['autoAssociation']===0x0){return db[_0x26d1('0x1c')][_0x26d1('0x35')]({'name':_0x1fe772[_0x26d1('0x3a')],'resourceId':_0x1fe772['id'],'type':_0x2c4411[_0x26d1('0x3a')],'sectionId':_0x2c4411['id']},{})[_0x26d1('0x18')](function(){return _0x380338;});}else{return _0x380338;}})[_0x26d1('0x34')](function(_0x3d5b41){logger['error'](_0x26d1('0x3b'),_0x3d5b41);throw _0x3d5b41;});}return _0x380338;})['then'](respondWithResult(_0x232ad9,0xc9))[_0x26d1('0x34')](handleError(_0x232ad9,null));};exports[_0x26d1('0x17')]=function(_0x198aa2,_0x3f4446){if(_0x198aa2[_0x26d1('0x3c')]['id']){delete _0x198aa2['body']['id'];}return db[_0x26d1('0x21')][_0x26d1('0x33')]({'where':{'id':_0x198aa2['params']['id']}})[_0x26d1('0x18')](handleEntityNotFound(_0x3f4446,null))[_0x26d1('0x18')](saveUpdates(_0x198aa2[_0x26d1('0x3c')],null))[_0x26d1('0x18')](respondWithResult(_0x3f4446,null))[_0x26d1('0x34')](handleError(_0x3f4446,null));};exports[_0x26d1('0x19')]=function(_0x1bb984,_0x3a352d){return db[_0x26d1('0x21')][_0x26d1('0x33')]({'where':{'id':_0x1bb984['params']['id']}})[_0x26d1('0x18')](handleEntityNotFound(_0x3a352d,null))['then'](removeEntity(_0x3a352d,null))[_0x26d1('0x34')](handleError(_0x3a352d,null));};exports[_0x26d1('0x3d')]=function(_0x2fabc5,_0x1f08e3){return db[_0x26d1('0x21')]['describe']()[_0x26d1('0x18')](respondWithResult(_0x1f08e3,null))[_0x26d1('0x34')](handleError(_0x1f08e3,null));};exports[_0x26d1('0x3e')]=function(_0x599b9a,_0x1ff4e5){var _0x12caf3={'raw':!![],'where':{}},_0x3c30cb={},_0x2b6ed2;return db[_0x26d1('0x21')]['findOne']({'where':{'id':_0x599b9a[_0x26d1('0x29')]['id']}})['then'](handleEntityNotFound(_0x1ff4e5,null))[_0x26d1('0x18')](function(_0x2f71f1){if(_0x2f71f1){_0x2b6ed2=_0x2f71f1[_0x26d1('0x1a')]({'plain':!![]});_0x3c30cb[_0x26d1('0x2a')]=_[_0x26d1('0x3f')](db[_0x26d1('0x40')]['rawAttributes']);_0x3c30cb[_0x26d1('0x27')]=_[_0x26d1('0x3f')](_0x599b9a[_0x26d1('0x27')]);_0x3c30cb['filters']=_[_0x26d1('0x2c')](_0x3c30cb[_0x26d1('0x2a')],_0x3c30cb[_0x26d1('0x27')]);_0x12caf3[_0x26d1('0x2d')]=_[_0x26d1('0x2c')](_0x3c30cb[_0x26d1('0x2a')],qs[_0x26d1('0x2e')](_0x599b9a[_0x26d1('0x27')]['fields']));_0x12caf3[_0x26d1('0x2d')]=_0x12caf3[_0x26d1('0x2d')][_0x26d1('0x2f')]?_0x12caf3['attributes']:_0x3c30cb[_0x26d1('0x2a')];if(!_0x599b9a['query'][_0x26d1('0x41')](_0x26d1('0x42'))){_0x12caf3[_0x26d1('0x14')]=qs[_0x26d1('0x14')](_0x599b9a[_0x26d1('0x27')]['limit']);_0x12caf3['offset']=qs['offset'](_0x599b9a[_0x26d1('0x27')][_0x26d1('0x12')]);}_0x12caf3[_0x26d1('0x43')]=qs['sort'](_0x599b9a[_0x26d1('0x27')]['sort']);_0x12caf3[_0x26d1('0x25')]=qs[_0x26d1('0x2b')](_['pick'](_0x599b9a[_0x26d1('0x27')],_0x3c30cb[_0x26d1('0x2b')]));_0x12caf3[_0x26d1('0x25')][_0x26d1('0x44')]=_0x2f71f1['id'];if(_0x599b9a[_0x26d1('0x27')][_0x26d1('0x45')]){_0x12caf3['where']=_['merge'](_0x12caf3[_0x26d1('0x25')],{'$or':_[_0x26d1('0x20')](_0x12caf3[_0x26d1('0x2d')],function(_0x4910dd){var _0x4e0ccb={};_0x4e0ccb[_0x4910dd]={'$like':'%'+_0x599b9a[_0x26d1('0x27')][_0x26d1('0x45')]+'%'};return _0x4e0ccb;})});}_0x12caf3=_[_0x26d1('0x31')]({},_0x12caf3,_0x599b9a['options']);return db[_0x26d1('0x40')][_0x26d1('0x46')](_0x12caf3);}})['then'](function(_0x3d15b0){if(_0x3d15b0){return db['User']['findAndCountAll']({'where':{'id':_[_0x26d1('0x20')](_0x3d15b0,_0x26d1('0x47')),'role':_0x26d1('0x48')},'attributes':['id',_0x26d1('0x3a'),'whatsappPause',_0x26d1('0x49'),_0x26d1('0x4a')]});}})['then'](function(_0x4223b0){if(_0x4223b0){return{'count':_0x4223b0[_0x26d1('0x15')],'rows':_['map'](_0x4223b0[_0x26d1('0x4b')],function(_0x5ad637){return{'membername':_0x5ad637[_0x26d1('0x3a')],'UserId':_0x5ad637['id'],'queue_name':_0x2b6ed2['name'],'WhatsappQueueId':_0x2b6ed2['id'],'interface':util[_0x26d1('0x4c')](_0x26d1('0x4d'),_0x26d1('0x4e'),_0x5ad637[_0x26d1('0x3a')]),'penalty':0x0,'paused':_0x5ad637[_0x26d1('0x4f')],'createdAt':_0x5ad637[_0x26d1('0x4a')],'updatedAt':_0x5ad637[_0x26d1('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x26d1('0x18')](respondWithFilteredResult(_0x1ff4e5,_0x12caf3))[_0x26d1('0x34')](handleError(_0x1ff4e5,null));};exports[_0x26d1('0x50')]=function(_0x132c5e,_0x133176){var _0x5a2a23={};var _0x81630c={};var _0x3f413c;var _0x4d3590;return db['WhatsappQueue'][_0x26d1('0x51')]({'where':{'id':_0x132c5e['params']['id']}})['then'](handleEntityNotFound(_0x133176,null))[_0x26d1('0x18')](function(_0x45006a){if(_0x45006a){_0x3f413c=_0x45006a;_0x81630c[_0x26d1('0x2a')]=_[_0x26d1('0x3f')](db[_0x26d1('0x52')][_0x26d1('0x22')]);_0x81630c[_0x26d1('0x27')]=_[_0x26d1('0x3f')](_0x132c5e[_0x26d1('0x27')]);_0x81630c['filters']=_['intersection'](_0x81630c[_0x26d1('0x2a')],_0x81630c[_0x26d1('0x27')]);_0x5a2a23['attributes']=_['intersection'](_0x81630c[_0x26d1('0x2a')],qs[_0x26d1('0x2e')](_0x132c5e[_0x26d1('0x27')][_0x26d1('0x2e')]));_0x5a2a23[_0x26d1('0x2d')]=_0x5a2a23[_0x26d1('0x2d')][_0x26d1('0x2f')]?_0x5a2a23[_0x26d1('0x2d')]:_0x81630c[_0x26d1('0x2a')];_0x5a2a23[_0x26d1('0x43')]=qs[_0x26d1('0x53')](_0x132c5e[_0x26d1('0x27')][_0x26d1('0x53')]);_0x5a2a23[_0x26d1('0x25')]=qs[_0x26d1('0x2b')](_[_0x26d1('0x54')](_0x132c5e[_0x26d1('0x27')],_0x81630c['filters']));if(_0x132c5e['query'][_0x26d1('0x45')]){_0x5a2a23[_0x26d1('0x25')]=_[_0x26d1('0x31')](_0x5a2a23[_0x26d1('0x25')],{'$or':_[_0x26d1('0x20')](_0x5a2a23[_0x26d1('0x2d')],function(_0x4ca600){var _0x3806cb={};_0x3806cb[_0x4ca600]={'$like':'%'+_0x132c5e['query'][_0x26d1('0x45')]+'%'};return _0x3806cb;})});}_0x5a2a23=_['merge']({},_0x5a2a23,_0x132c5e[_0x26d1('0x32')]);return _0x3f413c[_0x26d1('0x50')](_0x5a2a23);}})['then'](function(_0x4533dc){if(_0x4533dc){_0x4d3590=_0x4533dc[_0x26d1('0x2f')];if(!_0x132c5e['query'][_0x26d1('0x41')](_0x26d1('0x42'))){_0x5a2a23[_0x26d1('0x14')]=qs[_0x26d1('0x14')](_0x132c5e['query'][_0x26d1('0x14')]);_0x5a2a23[_0x26d1('0x12')]=qs[_0x26d1('0x12')](_0x132c5e[_0x26d1('0x27')]['offset']);}return _0x3f413c[_0x26d1('0x50')](_0x5a2a23);}})[_0x26d1('0x18')](function(_0x520a89){if(_0x520a89){return _0x520a89?{'count':_0x4d3590,'rows':_0x520a89}:null;}})[_0x26d1('0x18')](respondWithResult(_0x133176,null))[_0x26d1('0x34')](handleError(_0x133176,null));};exports['addTeams']=function(_0x27d730,_0x29c03b){var _0x1270e3=_0x27d730[_0x26d1('0x3c')][_0x26d1('0x55')];return db['Team'][_0x26d1('0x46')]({'where':{'id':_0x1270e3},'attributes':['id'],'include':[{'model':db[_0x26d1('0x56')],'as':'Agents','attributes':['id',_0x26d1('0x3a'),_0x26d1('0x57'),_0x26d1('0x58'),_0x26d1('0x59')],'raw':!![]}]})['then'](function(_0x2e0842){if(_0x2e0842){var _0x3fa97c=_[_0x26d1('0x5a')](_0x2e0842,function(_0x125535){var _0x3623ca=_0x125535[_0x26d1('0x1a')]({'plain':!![]});return _0x3623ca['Agents'];});return db[_0x26d1('0x21')][_0x26d1('0x33')]({'where':{'id':_0x27d730[_0x26d1('0x29')]['id']}})[_0x26d1('0x18')](function(_0x12febe){return db[_0x26d1('0x5b')]['transaction'](function(_0x4ba922){return _0x12febe[_0x26d1('0x5c')](_0x1270e3,{'transaction':_0x4ba922})[_0x26d1('0x18')](function(){return BPromise[_0x26d1('0x5d')](_0x3fa97c,function(_0x12d60b){return db[_0x26d1('0x40')][_0x26d1('0x5e')]({'where':{'UserId':_0x12d60b['id'],'WhatsappQueueId':_0x27d730[_0x26d1('0x29')]['id']},'transaction':_0x4ba922});});})[_0x26d1('0x18')](function(){_0x3fa97c[_0x26d1('0x5f')](function(_0x5ae898){socket[_0x26d1('0x60')](_0x26d1('0x61'),{'UserId':_0x5ae898['id'],'WhatsappQueueId':_0x12febe['id']});});});});});}})[_0x26d1('0x18')](respondWithStatusCode(_0x29c03b,null))[_0x26d1('0x34')](handleError(_0x29c03b,null));};exports['removeTeams']=function(_0x343804,_0xc20299){return db[_0x26d1('0x52')]['findAll']({'where':{'id':_0x343804[_0x26d1('0x27')][_0x26d1('0x55')]},'attributes':['id'],'include':[{'model':db[_0x26d1('0x56')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x26d1('0x18')](handleEntityNotFound(_0xc20299,null))[_0x26d1('0x18')](function(_0x377e5f){var _0x3e154f=_[_0x26d1('0x20')](_0x377e5f,'id');var _0x2e02e0=[];var _0x4b0cb5=[];var _0x3976a5=squel[_0x26d1('0x62')]();_0x3976a5[_0x26d1('0x63')](_0x26d1('0x64'))[_0x26d1('0x65')](_0x26d1('0x66'),'tq')[_0x26d1('0x67')]('user_has_teams','ut',_0x26d1('0x68'))[_0x26d1('0x25')](_0x26d1('0x69'),_0x343804['params']['id']);for(var _0x2788ed=0x0;_0x2788ed<_0x377e5f[_0x26d1('0x2f')];_0x2788ed+=0x1){let _0x359d15=_0x377e5f[_0x2788ed];for(var _0x15c8b6=0x0;_0x15c8b6<_0x359d15[_0x26d1('0x6a')][_0x26d1('0x2f')];_0x15c8b6+=0x1){let _0x295742=_0x359d15[_0x26d1('0x6a')][_0x15c8b6];var _0x2978ae=_0x3976a5[_0x26d1('0x6b')]();_0x2978ae[_0x26d1('0x25')]('ut.UserId\x20=\x20?',_0x295742['id']);_0x4b0cb5['push'](db['sequelize'][_0x26d1('0x27')](_0x2978ae[_0x26d1('0x6c')](),{'type':db[_0x26d1('0x5b')][_0x26d1('0x6d')]['SELECT']})[_0x26d1('0x18')](function(_0x3ab244){if(_0x3ab244[_0x26d1('0x2f')]===0x1){return _0x295742['id'];}else{var _0x42d80e=_['every'](_['map'](_0x3ab244,'TeamId'),function(_0x492aaf){return _[_0x26d1('0x6e')](_0x3e154f,_0x492aaf);});if(_0x42d80e){return _0x295742['id'];}}}));}}return BPromise['all'](_0x4b0cb5)[_0x26d1('0x18')](function(_0x29905c){_0x2e02e0=_(_0x2e02e0)[_0x26d1('0x6f')](_0x29905c)['compact']()[_0x26d1('0x70')]();return db['WhatsappQueue'][_0x26d1('0x33')]({'where':{'id':_0x343804[_0x26d1('0x29')]['id']}})[_0x26d1('0x18')](function(_0x4b4293){return db['sequelize']['transaction'](function(_0x22e8ab){return _0x4b4293[_0x26d1('0x71')](_0x343804[_0x26d1('0x27')][_0x26d1('0x55')],{'transaction':_0x22e8ab})[_0x26d1('0x18')](function(){if(!_[_0x26d1('0x72')](_0x2e02e0)){return _0x4b4293['removeAgents'](_0x2e02e0,{'transaction':_0x22e8ab});}})['then'](function(){_0x2e02e0['forEach'](function(_0x1aa2f1){socket[_0x26d1('0x60')](_0x26d1('0x73'),{'UserId':_0x1aa2f1,'WhatsappQueueId':_0x4b4293['id']});});});});});});})['then'](respondWithStatusCode(_0xc20299,null))[_0x26d1('0x34')](handleError(_0xc20299,null));};exports[_0x26d1('0x74')]=function(_0x1cfb7a,_0x5faa1a){return db['WhatsappQueue'][_0x26d1('0x33')]({'where':{'id':_0x1cfb7a['params']['id']}})[_0x26d1('0x18')](handleEntityNotFound(_0x5faa1a,null))[_0x26d1('0x18')](function(_0x352d95){if(_0x352d95){return _0x352d95[_0x26d1('0x74')](_0x1cfb7a[_0x26d1('0x3c')]['ids'],_[_0x26d1('0x75')](_0x1cfb7a[_0x26d1('0x3c')],['ids','id'])||{})[_0x26d1('0x76')](function(_0x42a0b3){for(var _0x4cd654=0x0;_0x4cd654<_0x1cfb7a[_0x26d1('0x3c')]['ids']['length'];_0x4cd654+=0x1){socket['emit'](_0x26d1('0x61'),{'UserId':Number(_0x1cfb7a[_0x26d1('0x3c')][_0x26d1('0x55')][_0x4cd654]),'WhatsappQueueId':Number(_0x1cfb7a[_0x26d1('0x29')]['id'])});}return _0x42a0b3;});}})[_0x26d1('0x18')](respondWithResult(_0x5faa1a,null))['catch'](handleError(_0x5faa1a,null));};exports[_0x26d1('0x77')]=function(_0x419325,_0x350d09){return db[_0x26d1('0x21')][_0x26d1('0x33')]({'where':{'id':_0x419325[_0x26d1('0x29')]['id']}})[_0x26d1('0x18')](handleEntityNotFound(_0x350d09,null))[_0x26d1('0x18')](function(_0x4ae272){if(_0x4ae272){return _0x4ae272[_0x26d1('0x77')](_0x419325[_0x26d1('0x27')][_0x26d1('0x55')])['then'](function(){if(_[_0x26d1('0x78')](_0x419325['query']['ids'])){for(var _0x4b569d=0x0;_0x4b569d<_0x419325['query'][_0x26d1('0x55')][_0x26d1('0x2f')];_0x4b569d+=0x1){socket['emit'](_0x26d1('0x73'),{'UserId':Number(_0x419325[_0x26d1('0x27')][_0x26d1('0x55')][_0x4b569d]),'WhatsappQueueId':Number(_0x419325[_0x26d1('0x29')]['id'])});}}else{socket['emit'](_0x26d1('0x73'),{'UserId':Number(_0x419325[_0x26d1('0x27')][_0x26d1('0x55')]),'WhatsappQueueId':Number(_0x419325[_0x26d1('0x29')]['id'])});}});}})[_0x26d1('0x18')](respondWithStatusCode(_0x350d09,null))[_0x26d1('0x34')](handleError(_0x350d09,null));};exports[_0x26d1('0x79')]=function(_0x24ae63,_0x46ebbb){var _0x2bf107={};var _0xa17dbb={};var _0x30b9e8;var _0x4e002b;return db[_0x26d1('0x21')][_0x26d1('0x51')]({'where':{'id':_0x24ae63['params']['id']}})['then'](handleEntityNotFound(_0x46ebbb,null))[_0x26d1('0x18')](function(_0x274051){if(_0x274051){_0x30b9e8=_0x274051;_0xa17dbb[_0x26d1('0x2a')]=_[_0x26d1('0x3f')](db[_0x26d1('0x56')][_0x26d1('0x22')]);_0xa17dbb['query']=_[_0x26d1('0x3f')](_0x24ae63[_0x26d1('0x27')]);_0xa17dbb[_0x26d1('0x2b')]=_[_0x26d1('0x2c')](_0xa17dbb[_0x26d1('0x2a')],_0xa17dbb[_0x26d1('0x27')]);_0x2bf107[_0x26d1('0x2d')]=_['intersection'](_0xa17dbb[_0x26d1('0x2a')],qs[_0x26d1('0x2e')](_0x24ae63[_0x26d1('0x27')]['fields']));_0x2bf107[_0x26d1('0x2d')]=_0x2bf107['attributes'][_0x26d1('0x2f')]?_0x2bf107['attributes']:_0xa17dbb[_0x26d1('0x2a')];_0x2bf107[_0x26d1('0x43')]=qs['sort'](_0x24ae63[_0x26d1('0x27')][_0x26d1('0x53')]);_0x2bf107[_0x26d1('0x25')]=qs[_0x26d1('0x2b')](_['pick'](_0x24ae63[_0x26d1('0x27')],_0xa17dbb[_0x26d1('0x2b')]));if(_0x24ae63[_0x26d1('0x27')][_0x26d1('0x45')]){_0x2bf107[_0x26d1('0x25')]=_[_0x26d1('0x31')](_0x2bf107[_0x26d1('0x25')],{'$or':_['map'](_0x2bf107[_0x26d1('0x2d')],function(_0x1da823){var _0x370b25={};_0x370b25[_0x1da823]={'$like':'%'+_0x24ae63['query']['filter']+'%'};return _0x370b25;})});}_0x2bf107=_[_0x26d1('0x31')]({},_0x2bf107,_0x24ae63[_0x26d1('0x32')]);return _0x30b9e8[_0x26d1('0x79')](_0x2bf107);}})['then'](function(_0x5d80e5){if(_0x5d80e5){_0x4e002b=_0x5d80e5[_0x26d1('0x2f')];if(!_0x24ae63['query'][_0x26d1('0x41')](_0x26d1('0x42'))){_0x2bf107['limit']=qs['limit'](_0x24ae63[_0x26d1('0x27')]['limit']);_0x2bf107[_0x26d1('0x12')]=qs[_0x26d1('0x12')](_0x24ae63['query'][_0x26d1('0x12')]);}return _0x30b9e8[_0x26d1('0x79')](_0x2bf107);}})[_0x26d1('0x18')](function(_0x5ec766){if(_0x5ec766){return _0x5ec766?{'count':_0x4e002b,'rows':_0x5ec766}:null;}})[_0x26d1('0x18')](respondWithResult(_0x46ebbb,null))[_0x26d1('0x34')](handleError(_0x46ebbb,null));}; \ No newline at end of file +var _0x09de=['name','send','index','map','rawAttributes','fieldName','type','getOptions','where','WhatsappQueue','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','userProfileId','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','order','WhatsappQueueId','filter','User','findAndCountAll','agent','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','sort','pick','addTeams','ids','Agents','online','sequelize','transaction','each','emit','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','addAgents','spread','userWhatsappQueue:save','isArray','userWhatsappQueue:remove','getAgents','nolimit','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','register','sendStatus','status','end','json','count','offset','limit','Content-Range','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack'];(function(_0x47ad0a,_0x4ed519){var _0x18d8dd=function(_0x2df8b5){while(--_0x2df8b5){_0x47ad0a['push'](_0x47ad0a['shift']());}};_0x18d8dd(++_0x4ed519);}(_0x09de,0x143));var _0xe09d=function(_0x4bb2b9,_0x459c78){_0x4bb2b9=_0x4bb2b9-0x0;var _0x40e2a2=_0x09de[_0x4bb2b9];return _0x40e2a2;};'use strict';var BPromise=require(_0xe09d('0x0'));var util=require(_0xe09d('0x1'));var _=require(_0xe09d('0x2'));var squel=require(_0xe09d('0x3'));var Redis=require(_0xe09d('0x4'));var qs=require(_0xe09d('0x5'));var logger=require(_0xe09d('0x6'))(_0xe09d('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xe09d('0x8')]=_[_0xe09d('0x9')](config[_0xe09d('0x8')],{'host':_0xe09d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe09d('0x8')]));require('./whatsappQueue.socket')[_0xe09d('0xb')](socket);function respondWithStatusCode(_0x31d22e,_0x515872){_0x515872=_0x515872||0xcc;return function(_0x508e64){if(_0x508e64){return _0x31d22e[_0xe09d('0xc')](_0x515872);}return _0x31d22e[_0xe09d('0xd')](_0x515872)[_0xe09d('0xe')]();};}function respondWithResult(_0x560df4,_0x861785){_0x861785=_0x861785||0xc8;return function(_0x463a4d){if(_0x463a4d){return _0x560df4['status'](_0x861785)[_0xe09d('0xf')](_0x463a4d);}};}function respondWithFilteredResult(_0x178616,_0x226982){return function(_0x5a4655){if(_0x5a4655){var _0xfb2c23=typeof _0x226982['offset']==='undefined'&&typeof _0x226982['limit']==='undefined';var _0x1c92df=_0x5a4655['count'];var _0x43e181=_0xfb2c23?0x0:_0x226982['offset'];var _0x3b8262=_0xfb2c23?_0x5a4655[_0xe09d('0x10')]:_0x226982[_0xe09d('0x11')]+_0x226982[_0xe09d('0x12')];var _0x16126e;if(_0x3b8262>=_0x1c92df){_0x3b8262=_0x1c92df;_0x16126e=0xc8;}else{_0x16126e=0xce;}_0x178616[_0xe09d('0xd')](_0x16126e);return _0x178616['set'](_0xe09d('0x13'),_0x43e181+'-'+_0x3b8262+'/'+_0x1c92df)[_0xe09d('0xf')](_0x5a4655);}return null;};}function saveUpdates(_0x248533){return function(_0x48c5bf){if(_0x48c5bf){return _0x48c5bf[_0xe09d('0x14')](_0x248533)[_0xe09d('0x15')](function(_0x42575a){return _0x42575a;});}return null;};}function removeEntity(_0x499b72){return function(_0x207f5f){if(_0x207f5f){return _0x207f5f[_0xe09d('0x16')]()[_0xe09d('0x15')](function(){var _0x548d13=_0x207f5f[_0xe09d('0x17')]({'plain':!![]});var _0x5658a2=_0xe09d('0x18');return db[_0xe09d('0x19')][_0xe09d('0x16')]({'where':{'type':_0x5658a2,'resourceId':_0x548d13['id']}})['then'](function(){return _0x207f5f;});})[_0xe09d('0x15')](function(){_0x499b72[_0xe09d('0xd')](0xcc)[_0xe09d('0xe')]();});}};}function handleEntityNotFound(_0x9231d2){return function(_0x5e4b4a){if(!_0x5e4b4a){_0x9231d2['sendStatus'](0x194);}return _0x5e4b4a;};}function handleError(_0x4c647d,_0x22b163){_0x22b163=_0x22b163||0x1f4;return function(_0x22eceb){logger[_0xe09d('0x1a')](_0x22eceb[_0xe09d('0x1b')]);if(_0x22eceb[_0xe09d('0x1c')]){delete _0x22eceb[_0xe09d('0x1c')];}_0x4c647d[_0xe09d('0xd')](_0x22b163)[_0xe09d('0x1d')](_0x22eceb);};}exports[_0xe09d('0x1e')]=function(_0x3e5a75,_0x89c9bf){var _0xf448c9={};var _0x1b7f3b={'count':0x0,'rows':[]};var _0x41db71=_[_0xe09d('0x1f')](db['WhatsappQueue'][_0xe09d('0x20')],function(_0xae9e31){return{'name':_0xae9e31[_0xe09d('0x21')],'type':_0xae9e31[_0xe09d('0x22')]['key']};});_0xf448c9=qs[_0xe09d('0x23')](_0x41db71,_0x3e5a75);var _0x379870={'where':_0xf448c9[_0xe09d('0x24')]};return db[_0xe09d('0x25')][_0xe09d('0x10')](_0x379870)[_0xe09d('0x15')](function(_0x33651f){_0x1b7f3b['count']=_0x33651f;_0xf448c9['include']=qs[_0xe09d('0x26')](_0x3e5a75[_0xe09d('0x27')]);return db[_0xe09d('0x25')][_0xe09d('0x28')](_0xf448c9);})[_0xe09d('0x15')](function(_0x2682c5){_0x1b7f3b[_0xe09d('0x29')]=_0x2682c5;return _0x1b7f3b;})['then'](respondWithFilteredResult(_0x89c9bf,_0xf448c9))[_0xe09d('0x2a')](handleError(_0x89c9bf,null));};exports[_0xe09d('0x2b')]=function(_0x12b3e8,_0x22b380){var _0x3fe8c9={'raw':!![],'where':{'id':_0x12b3e8[_0xe09d('0x2c')]['id']}},_0x109674={};_0x109674[_0xe09d('0x2d')]=_[_0xe09d('0x2e')](db['WhatsappQueue'][_0xe09d('0x20')]);_0x109674['query']=_['keys'](_0x12b3e8[_0xe09d('0x27')]);_0x109674[_0xe09d('0x2f')]=_[_0xe09d('0x30')](_0x109674[_0xe09d('0x2d')],_0x109674[_0xe09d('0x27')]);_0x3fe8c9[_0xe09d('0x31')]=_[_0xe09d('0x30')](_0x109674['model'],qs['fields'](_0x12b3e8['query'][_0xe09d('0x32')]));_0x3fe8c9[_0xe09d('0x31')]=_0x3fe8c9[_0xe09d('0x31')][_0xe09d('0x33')]?_0x3fe8c9[_0xe09d('0x31')]:_0x109674[_0xe09d('0x2d')];if(_0x12b3e8[_0xe09d('0x27')][_0xe09d('0x34')]){_0x3fe8c9[_0xe09d('0x26')]=[{'all':!![]}];}_0x3fe8c9=_[_0xe09d('0x35')]({},_0x3fe8c9,_0x12b3e8[_0xe09d('0x36')]);return db['WhatsappQueue'][_0xe09d('0x37')](_0x3fe8c9)[_0xe09d('0x15')](handleEntityNotFound(_0x22b380,null))[_0xe09d('0x15')](respondWithResult(_0x22b380,null))['catch'](handleError(_0x22b380,null));};exports[_0xe09d('0x38')]=function(_0x552d20,_0x52803b){return db[_0xe09d('0x25')][_0xe09d('0x38')](_0x552d20[_0xe09d('0x39')],{})[_0xe09d('0x15')](function(_0x39fd2d){var _0x2953c2=_0x552d20[_0xe09d('0x3a')][_0xe09d('0x17')]({'plain':!![]});if(!_0x2953c2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2953c2['role']===_0xe09d('0x3a')){var _0x5de04b=_0x39fd2d[_0xe09d('0x17')]({'plain':!![]});var _0x171998=_0xe09d('0x18');return db['UserProfileSection']['find']({'where':{'name':_0x171998,'userProfileId':_0x2953c2[_0xe09d('0x3b')]},'raw':!![]})['then'](function(_0x23ded5){if(_0x23ded5&&_0x23ded5['autoAssociation']===0x0){return db[_0xe09d('0x19')]['create']({'name':_0x5de04b[_0xe09d('0x1c')],'resourceId':_0x5de04b['id'],'type':_0x23ded5['name'],'sectionId':_0x23ded5['id']},{})['then'](function(){return _0x39fd2d;});}else{return _0x39fd2d;}})[_0xe09d('0x2a')](function(_0x83e0ef){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x83e0ef);throw _0x83e0ef;});}return _0x39fd2d;})[_0xe09d('0x15')](respondWithResult(_0x52803b,0xc9))[_0xe09d('0x2a')](handleError(_0x52803b,null));};exports[_0xe09d('0x14')]=function(_0x478025,_0xbc2ab2){if(_0x478025[_0xe09d('0x39')]['id']){delete _0x478025[_0xe09d('0x39')]['id'];}return db[_0xe09d('0x25')][_0xe09d('0x37')]({'where':{'id':_0x478025[_0xe09d('0x2c')]['id']}})['then'](handleEntityNotFound(_0xbc2ab2,null))[_0xe09d('0x15')](saveUpdates(_0x478025['body'],null))[_0xe09d('0x15')](respondWithResult(_0xbc2ab2,null))['catch'](handleError(_0xbc2ab2,null));};exports[_0xe09d('0x16')]=function(_0x426479,_0x1ad0de){return db[_0xe09d('0x25')][_0xe09d('0x37')]({'where':{'id':_0x426479[_0xe09d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1ad0de,null))[_0xe09d('0x15')](removeEntity(_0x1ad0de,null))[_0xe09d('0x2a')](handleError(_0x1ad0de,null));};exports[_0xe09d('0x3c')]=function(_0x10a90d,_0x54b904){return db['WhatsappQueue'][_0xe09d('0x3c')]()[_0xe09d('0x15')](respondWithResult(_0x54b904,null))['catch'](handleError(_0x54b904,null));};exports[_0xe09d('0x3d')]=function(_0x132b72,_0x5552db){var _0x204e92={'raw':!![],'where':{}},_0x2b4ac8={},_0x162c28;return db[_0xe09d('0x25')][_0xe09d('0x3e')]({'where':{'id':_0x132b72[_0xe09d('0x2c')]['id']}})[_0xe09d('0x15')](handleEntityNotFound(_0x5552db,null))[_0xe09d('0x15')](function(_0x2bc678){if(_0x2bc678){_0x162c28=_0x2bc678[_0xe09d('0x17')]({'plain':!![]});_0x2b4ac8[_0xe09d('0x2d')]=_['keys'](db[_0xe09d('0x3f')][_0xe09d('0x20')]);_0x2b4ac8[_0xe09d('0x27')]=_['keys'](_0x132b72[_0xe09d('0x27')]);_0x2b4ac8[_0xe09d('0x2f')]=_['intersection'](_0x2b4ac8[_0xe09d('0x2d')],_0x2b4ac8[_0xe09d('0x27')]);_0x204e92[_0xe09d('0x31')]=_['intersection'](_0x2b4ac8[_0xe09d('0x2d')],qs[_0xe09d('0x32')](_0x132b72[_0xe09d('0x27')][_0xe09d('0x32')]));_0x204e92[_0xe09d('0x31')]=_0x204e92[_0xe09d('0x31')][_0xe09d('0x33')]?_0x204e92[_0xe09d('0x31')]:_0x2b4ac8[_0xe09d('0x2d')];if(!_0x132b72[_0xe09d('0x27')][_0xe09d('0x40')]('nolimit')){_0x204e92[_0xe09d('0x12')]=qs[_0xe09d('0x12')](_0x132b72[_0xe09d('0x27')][_0xe09d('0x12')]);_0x204e92[_0xe09d('0x11')]=qs[_0xe09d('0x11')](_0x132b72[_0xe09d('0x27')][_0xe09d('0x11')]);}_0x204e92[_0xe09d('0x41')]=qs['sort'](_0x132b72[_0xe09d('0x27')]['sort']);_0x204e92[_0xe09d('0x24')]=qs['filters'](_['pick'](_0x132b72['query'],_0x2b4ac8[_0xe09d('0x2f')]));_0x204e92[_0xe09d('0x24')][_0xe09d('0x42')]=_0x2bc678['id'];if(_0x132b72[_0xe09d('0x27')][_0xe09d('0x43')]){_0x204e92[_0xe09d('0x24')]=_[_0xe09d('0x35')](_0x204e92[_0xe09d('0x24')],{'$or':_[_0xe09d('0x1f')](_0x204e92[_0xe09d('0x31')],function(_0x29d8b0){var _0x184984={};_0x184984[_0x29d8b0]={'$like':'%'+_0x132b72['query']['filter']+'%'};return _0x184984;})});}_0x204e92=_[_0xe09d('0x35')]({},_0x204e92,_0x132b72[_0xe09d('0x36')]);return db['UserWhatsappQueue'][_0xe09d('0x28')](_0x204e92);}})[_0xe09d('0x15')](function(_0x752351){if(_0x752351){return db[_0xe09d('0x44')][_0xe09d('0x45')]({'where':{'id':_[_0xe09d('0x1f')](_0x752351,'UserId'),'role':_0xe09d('0x46')},'attributes':['id',_0xe09d('0x1c'),_0xe09d('0x47'),_0xe09d('0x48'),'createdAt']});}})[_0xe09d('0x15')](function(_0xeb85c4){if(_0xeb85c4){return{'count':_0xeb85c4[_0xe09d('0x10')],'rows':_[_0xe09d('0x1f')](_0xeb85c4[_0xe09d('0x29')],function(_0x56e73b){return{'membername':_0x56e73b[_0xe09d('0x1c')],'UserId':_0x56e73b['id'],'queue_name':_0x162c28[_0xe09d('0x1c')],'WhatsappQueueId':_0x162c28['id'],'interface':util[_0xe09d('0x49')](_0xe09d('0x4a'),_0xe09d('0x4b'),_0x56e73b['name']),'penalty':0x0,'paused':_0x56e73b[_0xe09d('0x47')],'createdAt':_0x56e73b[_0xe09d('0x4c')],'updatedAt':_0x56e73b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5552db,_0x204e92))['catch'](handleError(_0x5552db,null));};exports[_0xe09d('0x4d')]=function(_0x175de0,_0x4ee488){var _0x4252b7={};var _0x15cf2b={};var _0x4db930;var _0x46f67a;return db[_0xe09d('0x25')][_0xe09d('0x3e')]({'where':{'id':_0x175de0['params']['id']}})['then'](handleEntityNotFound(_0x4ee488,null))[_0xe09d('0x15')](function(_0x596ab9){if(_0x596ab9){_0x4db930=_0x596ab9;_0x15cf2b[_0xe09d('0x2d')]=_[_0xe09d('0x2e')](db[_0xe09d('0x4e')]['rawAttributes']);_0x15cf2b[_0xe09d('0x27')]=_[_0xe09d('0x2e')](_0x175de0[_0xe09d('0x27')]);_0x15cf2b[_0xe09d('0x2f')]=_[_0xe09d('0x30')](_0x15cf2b[_0xe09d('0x2d')],_0x15cf2b[_0xe09d('0x27')]);_0x4252b7['attributes']=_['intersection'](_0x15cf2b[_0xe09d('0x2d')],qs[_0xe09d('0x32')](_0x175de0[_0xe09d('0x27')][_0xe09d('0x32')]));_0x4252b7['attributes']=_0x4252b7[_0xe09d('0x31')]['length']?_0x4252b7['attributes']:_0x15cf2b[_0xe09d('0x2d')];_0x4252b7['order']=qs[_0xe09d('0x4f')](_0x175de0[_0xe09d('0x27')][_0xe09d('0x4f')]);_0x4252b7[_0xe09d('0x24')]=qs[_0xe09d('0x2f')](_[_0xe09d('0x50')](_0x175de0[_0xe09d('0x27')],_0x15cf2b[_0xe09d('0x2f')]));if(_0x175de0['query'][_0xe09d('0x43')]){_0x4252b7[_0xe09d('0x24')]=_[_0xe09d('0x35')](_0x4252b7[_0xe09d('0x24')],{'$or':_['map'](_0x4252b7[_0xe09d('0x31')],function(_0x1f9772){var _0x1b0949={};_0x1b0949[_0x1f9772]={'$like':'%'+_0x175de0[_0xe09d('0x27')][_0xe09d('0x43')]+'%'};return _0x1b0949;})});}_0x4252b7=_['merge']({},_0x4252b7,_0x175de0[_0xe09d('0x36')]);return _0x4db930['getTeams'](_0x4252b7);}})[_0xe09d('0x15')](function(_0x6ed819){if(_0x6ed819){_0x46f67a=_0x6ed819[_0xe09d('0x33')];if(!_0x175de0[_0xe09d('0x27')]['hasOwnProperty']('nolimit')){_0x4252b7[_0xe09d('0x12')]=qs[_0xe09d('0x12')](_0x175de0[_0xe09d('0x27')]['limit']);_0x4252b7[_0xe09d('0x11')]=qs['offset'](_0x175de0['query']['offset']);}return _0x4db930[_0xe09d('0x4d')](_0x4252b7);}})['then'](function(_0x283755){if(_0x283755){return _0x283755?{'count':_0x46f67a,'rows':_0x283755}:null;}})[_0xe09d('0x15')](respondWithResult(_0x4ee488,null))[_0xe09d('0x2a')](handleError(_0x4ee488,null));};exports[_0xe09d('0x51')]=function(_0x420304,_0x56a047){var _0x50b088=_0x420304[_0xe09d('0x39')][_0xe09d('0x52')];return db['Team'][_0xe09d('0x28')]({'where':{'id':_0x50b088},'attributes':['id'],'include':[{'model':db[_0xe09d('0x44')],'as':_0xe09d('0x53'),'attributes':['id',_0xe09d('0x1c'),_0xe09d('0x54'),'voicePause','interface'],'raw':!![]}]})[_0xe09d('0x15')](function(_0x3a5612){if(_0x3a5612){var _0x3210c9=_['flatMap'](_0x3a5612,function(_0x4c5316){var _0x3ce30f=_0x4c5316['get']({'plain':!![]});return _0x3ce30f[_0xe09d('0x53')];});return db[_0xe09d('0x25')][_0xe09d('0x37')]({'where':{'id':_0x420304[_0xe09d('0x2c')]['id']}})[_0xe09d('0x15')](function(_0x112a24){return db[_0xe09d('0x55')][_0xe09d('0x56')](function(_0x411502){return _0x112a24[_0xe09d('0x51')](_0x50b088,{'transaction':_0x411502})[_0xe09d('0x15')](function(){return BPromise[_0xe09d('0x57')](_0x3210c9,function(_0x2195c5){return db[_0xe09d('0x3f')]['findOrCreate']({'where':{'UserId':_0x2195c5['id'],'WhatsappQueueId':_0x420304[_0xe09d('0x2c')]['id']},'transaction':_0x411502});});})['then'](function(){_0x3210c9['forEach'](function(_0x28c1cb){socket[_0xe09d('0x58')]('userWhatsappQueue:save',{'UserId':_0x28c1cb['id'],'WhatsappQueueId':_0x112a24['id']});});});});});}})['then'](respondWithStatusCode(_0x56a047,null))[_0xe09d('0x2a')](handleError(_0x56a047,null));};exports['removeTeams']=function(_0x43ef3f,_0x8ec72a){return db[_0xe09d('0x4e')][_0xe09d('0x28')]({'where':{'id':_0x43ef3f[_0xe09d('0x27')][_0xe09d('0x52')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe09d('0x15')](handleEntityNotFound(_0x8ec72a,null))[_0xe09d('0x15')](function(_0x256ec5){var _0x4851a3=_[_0xe09d('0x1f')](_0x256ec5,'id');var _0x284376=[];var _0x4521a5=[];var _0x8121c2=squel[_0xe09d('0x59')]();_0x8121c2[_0xe09d('0x5a')](_0xe09d('0x5b'))[_0xe09d('0x5c')](_0xe09d('0x5d'),'tq')[_0xe09d('0x5e')]('user_has_teams','ut',_0xe09d('0x5f'))[_0xe09d('0x24')](_0xe09d('0x60'),_0x43ef3f['params']['id']);for(var _0x469b02=0x0;_0x469b02<_0x256ec5[_0xe09d('0x33')];_0x469b02+=0x1){let _0x3da6ff=_0x256ec5[_0x469b02];for(var _0x34246b=0x0;_0x34246b<_0x3da6ff[_0xe09d('0x53')]['length'];_0x34246b+=0x1){let _0x3bb9d5=_0x3da6ff[_0xe09d('0x53')][_0x34246b];var _0x4d82a8=_0x8121c2[_0xe09d('0x61')]();_0x4d82a8[_0xe09d('0x24')](_0xe09d('0x62'),_0x3bb9d5['id']);_0x4521a5[_0xe09d('0x63')](db[_0xe09d('0x55')]['query'](_0x4d82a8['toString'](),{'type':db[_0xe09d('0x55')][_0xe09d('0x64')][_0xe09d('0x65')]})[_0xe09d('0x15')](function(_0x38f12b){if(_0x38f12b[_0xe09d('0x33')]===0x1){return _0x3bb9d5['id'];}else{var _0x3ef4d6=_[_0xe09d('0x66')](_[_0xe09d('0x1f')](_0x38f12b,'TeamId'),function(_0x3636bc){return _['includes'](_0x4851a3,_0x3636bc);});if(_0x3ef4d6){return _0x3bb9d5['id'];}}}));}}return BPromise['all'](_0x4521a5)['then'](function(_0x202f15){_0x284376=_(_0x284376)[_0xe09d('0x67')](_0x202f15)[_0xe09d('0x68')]()[_0xe09d('0x69')]();return db[_0xe09d('0x25')][_0xe09d('0x37')]({'where':{'id':_0x43ef3f[_0xe09d('0x2c')]['id']}})[_0xe09d('0x15')](function(_0x195d92){return db['sequelize'][_0xe09d('0x56')](function(_0x494dda){return _0x195d92[_0xe09d('0x6a')](_0x43ef3f['query'][_0xe09d('0x52')],{'transaction':_0x494dda})[_0xe09d('0x15')](function(){if(!_[_0xe09d('0x6b')](_0x284376)){return _0x195d92[_0xe09d('0x6c')](_0x284376,{'transaction':_0x494dda});}})['then'](function(){_0x284376[_0xe09d('0x6d')](function(_0x5199be){socket[_0xe09d('0x58')]('userWhatsappQueue:remove',{'UserId':_0x5199be,'WhatsappQueueId':_0x195d92['id']});});});});});});})['then'](respondWithStatusCode(_0x8ec72a,null))['catch'](handleError(_0x8ec72a,null));};exports[_0xe09d('0x6e')]=function(_0x5e052d,_0x1fb272){return db[_0xe09d('0x25')][_0xe09d('0x37')]({'where':{'id':_0x5e052d['params']['id']}})[_0xe09d('0x15')](handleEntityNotFound(_0x1fb272,null))['then'](function(_0x48c592){if(_0x48c592){return _0x48c592[_0xe09d('0x6e')](_0x5e052d[_0xe09d('0x39')][_0xe09d('0x52')],_['omit'](_0x5e052d[_0xe09d('0x39')],[_0xe09d('0x52'),'id'])||{})[_0xe09d('0x6f')](function(_0x2b9317){for(var _0x3bd887=0x0;_0x3bd887<_0x5e052d['body'][_0xe09d('0x52')]['length'];_0x3bd887+=0x1){socket[_0xe09d('0x58')](_0xe09d('0x70'),{'UserId':Number(_0x5e052d['body'][_0xe09d('0x52')][_0x3bd887]),'WhatsappQueueId':Number(_0x5e052d[_0xe09d('0x2c')]['id'])});}return _0x2b9317;});}})[_0xe09d('0x15')](respondWithResult(_0x1fb272,null))['catch'](handleError(_0x1fb272,null));};exports[_0xe09d('0x6c')]=function(_0x2e9c4a,_0x5d8bdc){return db[_0xe09d('0x25')][_0xe09d('0x37')]({'where':{'id':_0x2e9c4a[_0xe09d('0x2c')]['id']}})[_0xe09d('0x15')](handleEntityNotFound(_0x5d8bdc,null))[_0xe09d('0x15')](function(_0x2ba4ba){if(_0x2ba4ba){return _0x2ba4ba[_0xe09d('0x6c')](_0x2e9c4a[_0xe09d('0x27')][_0xe09d('0x52')])[_0xe09d('0x15')](function(){if(_[_0xe09d('0x71')](_0x2e9c4a['query'][_0xe09d('0x52')])){for(var _0x36724a=0x0;_0x36724a<_0x2e9c4a[_0xe09d('0x27')][_0xe09d('0x52')][_0xe09d('0x33')];_0x36724a+=0x1){socket[_0xe09d('0x58')](_0xe09d('0x72'),{'UserId':Number(_0x2e9c4a[_0xe09d('0x27')][_0xe09d('0x52')][_0x36724a]),'WhatsappQueueId':Number(_0x2e9c4a['params']['id'])});}}else{socket['emit'](_0xe09d('0x72'),{'UserId':Number(_0x2e9c4a[_0xe09d('0x27')][_0xe09d('0x52')]),'WhatsappQueueId':Number(_0x2e9c4a[_0xe09d('0x2c')]['id'])});}});}})['then'](respondWithStatusCode(_0x5d8bdc,null))[_0xe09d('0x2a')](handleError(_0x5d8bdc,null));};exports[_0xe09d('0x73')]=function(_0x150a24,_0x346dfa){var _0x334144={};var _0xde0ec8={};var _0x5a0d10;var _0x42eac4;return db[_0xe09d('0x25')]['findOne']({'where':{'id':_0x150a24[_0xe09d('0x2c')]['id']}})[_0xe09d('0x15')](handleEntityNotFound(_0x346dfa,null))[_0xe09d('0x15')](function(_0x24400c){if(_0x24400c){_0x5a0d10=_0x24400c;_0xde0ec8[_0xe09d('0x2d')]=_[_0xe09d('0x2e')](db[_0xe09d('0x44')][_0xe09d('0x20')]);_0xde0ec8[_0xe09d('0x27')]=_['keys'](_0x150a24[_0xe09d('0x27')]);_0xde0ec8['filters']=_[_0xe09d('0x30')](_0xde0ec8[_0xe09d('0x2d')],_0xde0ec8[_0xe09d('0x27')]);_0x334144['attributes']=_[_0xe09d('0x30')](_0xde0ec8['model'],qs[_0xe09d('0x32')](_0x150a24[_0xe09d('0x27')][_0xe09d('0x32')]));_0x334144[_0xe09d('0x31')]=_0x334144[_0xe09d('0x31')][_0xe09d('0x33')]?_0x334144['attributes']:_0xde0ec8[_0xe09d('0x2d')];_0x334144[_0xe09d('0x41')]=qs[_0xe09d('0x4f')](_0x150a24[_0xe09d('0x27')][_0xe09d('0x4f')]);_0x334144[_0xe09d('0x24')]=qs[_0xe09d('0x2f')](_[_0xe09d('0x50')](_0x150a24[_0xe09d('0x27')],_0xde0ec8[_0xe09d('0x2f')]));if(_0x150a24[_0xe09d('0x27')][_0xe09d('0x43')]){_0x334144[_0xe09d('0x24')]=_[_0xe09d('0x35')](_0x334144[_0xe09d('0x24')],{'$or':_[_0xe09d('0x1f')](_0x334144['attributes'],function(_0x2456fb){var _0xa84453={};_0xa84453[_0x2456fb]={'$like':'%'+_0x150a24[_0xe09d('0x27')][_0xe09d('0x43')]+'%'};return _0xa84453;})});}_0x334144=_[_0xe09d('0x35')]({},_0x334144,_0x150a24['options']);return _0x5a0d10[_0xe09d('0x73')](_0x334144);}})[_0xe09d('0x15')](function(_0x19a0d3){if(_0x19a0d3){_0x42eac4=_0x19a0d3['length'];if(!_0x150a24[_0xe09d('0x27')][_0xe09d('0x40')](_0xe09d('0x74'))){_0x334144[_0xe09d('0x12')]=qs[_0xe09d('0x12')](_0x150a24['query']['limit']);_0x334144[_0xe09d('0x11')]=qs[_0xe09d('0x11')](_0x150a24[_0xe09d('0x27')][_0xe09d('0x11')]);}return _0x5a0d10[_0xe09d('0x73')](_0x334144);}})['then'](function(_0x3c944f){if(_0x3c944f){return _0x3c944f?{'count':_0x42eac4,'rows':_0x3c944f}:null;}})[_0xe09d('0x15')](respondWithResult(_0x346dfa,null))[_0xe09d('0x2a')](handleError(_0x346dfa,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 8eb1914..915435b 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 _0x1b7f=['../../mysqldb','WhatsappQueue','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4a43f9,_0x1c5b74){var _0x4ffd26=function(_0x1aa260){while(--_0x1aa260){_0x4a43f9['push'](_0x4a43f9['shift']());}};_0x4ffd26(++_0x1c5b74);}(_0x1b7f,0x77));var _0xf1b7=function(_0x3ad446,_0x369c9f){_0x3ad446=_0x3ad446-0x0;var _0x337be7=_0x1b7f[_0x3ad446];return _0x337be7;};'use strict';var EventEmitter=require(_0xf1b7('0x0'));var WhatsappQueue=require(_0xf1b7('0x1'))['db'][_0xf1b7('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf1b7('0x3'),'afterUpdate':_0xf1b7('0x4'),'afterDestroy':_0xf1b7('0x5')};function emitEvent(_0x24cb83){return function(_0x56a210,_0x3acb01,_0x5b206c){WhatsappQueueEvents[_0xf1b7('0x6')](_0x24cb83+':'+_0x56a210['id'],_0x56a210);WhatsappQueueEvents[_0xf1b7('0x6')](_0x24cb83,_0x56a210);_0x5b206c(null);};}for(var e in events){if(events[_0xf1b7('0x7')](e)){var event=events[e];WhatsappQueue[_0xf1b7('0x8')](e,emitEvent(event));}}module[_0xf1b7('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x755d=['exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x46918d,_0x4ceca2){var _0x5cddee=function(_0x539f4c){while(--_0x539f4c){_0x46918d['push'](_0x46918d['shift']());}};_0x5cddee(++_0x4ceca2);}(_0x755d,0xfd));var _0xd755=function(_0x43b06b,_0x1929c7){_0x43b06b=_0x43b06b-0x0;var _0x2c555b=_0x755d[_0x43b06b];return _0x2c555b;};'use strict';var EventEmitter=require(_0xd755('0x0'));var WhatsappQueue=require(_0xd755('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd755('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd755('0x3'),'afterDestroy':_0xd755('0x4')};function emitEvent(_0x3909f5){return function(_0x4d4f96,_0x2ece35,_0x3f6a29){WhatsappQueueEvents[_0xd755('0x5')](_0x3909f5+':'+_0x4d4f96['id'],_0x4d4f96);WhatsappQueueEvents[_0xd755('0x5')](_0x3909f5,_0x4d4f96);_0x3f6a29(null);};}for(var e in events){if(events[_0xd755('0x6')](e)){var event=events[e];WhatsappQueue[_0xd755('0x7')](e,emitEvent(event));}}module[_0xd755('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index f1a0f45..83f161c 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 _0xacec=['api','moment','bluebird','request-promise','rimraf','exports','define','whatsapp_queues','util','../../config/logger'];(function(_0x1024df,_0x2cddf7){var _0x5ad535=function(_0x532ac4){while(--_0x532ac4){_0x1024df['push'](_0x1024df['shift']());}};_0x5ad535(++_0x2cddf7);}(_0xacec,0x102));var _0xcace=function(_0x8a0d94,_0x16fcee){_0x8a0d94=_0x8a0d94-0x0;var _0x48f382=_0xacec[_0x8a0d94];return _0x48f382;};'use strict';var _=require('lodash');var util=require(_0xcace('0x0'));var logger=require(_0xcace('0x1'))(_0xcace('0x2'));var moment=require(_0xcace('0x3'));var BPromise=require(_0xcace('0x4'));var rp=require(_0xcace('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcace('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0xcace('0x7')]=function(_0x45d0f2,_0x337abd){return _0x45d0f2[_0xcace('0x8')]('WhatsappQueue',attributes,{'tableName':_0xcace('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5915=['exports','WhatsappQueue','whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes'];(function(_0x513154,_0x541172){var _0x43fe15=function(_0x2a96e5){while(--_0x2a96e5){_0x513154['push'](_0x513154['shift']());}};_0x43fe15(++_0x541172);}(_0x5915,0xdb));var _0x5591=function(_0xd2364c,_0x475ac0){_0xd2364c=_0xd2364c-0x0;var _0x155a18=_0x5915[_0xd2364c];return _0x155a18;};'use strict';var _=require(_0x5591('0x0'));var util=require(_0x5591('0x1'));var logger=require('../../config/logger')(_0x5591('0x2'));var moment=require(_0x5591('0x3'));var BPromise=require(_0x5591('0x4'));var rp=require(_0x5591('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5591('0x6'));var config=require(_0x5591('0x7'));var attributes=require(_0x5591('0x8'));module[_0x5591('0x9')]=function(_0x543de6,_0x52bdf2){return _0x543de6['define'](_0x5591('0xa'),attributes,{'tableName':_0x5591('0xb'),'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 f375526..affe70d 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 _0xc02c=['WhatsappQueue','findAll','options','raw','limit','include','map','attributes','model','stringify','ShowWhatsappQueue','find','where','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetWhatsappQueue'];(function(_0x4e5873,_0x3c1bb7){var _0x24eab8=function(_0xd1edac){while(--_0xd1edac){_0x4e5873['push'](_0x4e5873['shift']());}};_0x24eab8(++_0x3c1bb7);}(_0xc02c,0x88));var _0xcc02=function(_0x5e59c2,_0x2ec577){_0x5e59c2=_0x5e59c2-0x0;var _0x56625f=_0xc02c[_0x5e59c2];return _0x56625f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcc02('0x0'));var BPromise=require(_0xcc02('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc02('0x2'));var db=require(_0xcc02('0x3'))['db'];var utils=require(_0xcc02('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xcc02('0x5'));var jayson=require(_0xcc02('0x6'));var client=jayson[_0xcc02('0x7')][_0xcc02('0x8')]({'port':0x232a});config[_0xcc02('0x9')]=_[_0xcc02('0xa')](config[_0xcc02('0x9')],{'host':_0xcc02('0xb'),'port':0x18eb});var socket=require(_0xcc02('0xc'))(new Redis(config[_0xcc02('0x9')]));require(_0xcc02('0xd'))[_0xcc02('0xe')](socket);function respondWithRpcPromise(_0x5ed410,_0x2515b1,_0x311dba){return new BPromise(function(_0x1ab806,_0x45f88d){return client[_0xcc02('0xf')](_0x5ed410,_0x311dba)[_0xcc02('0x10')](function(_0x4e8b1c){logger[_0xcc02('0x11')](_0xcc02('0x12'),_0x2515b1,_0xcc02('0x13'));logger[_0xcc02('0x14')](_0xcc02('0x15'),_0x2515b1,'request\x20sent',JSON['stringify'](_0x4e8b1c));if(_0x4e8b1c[_0xcc02('0x16')]){if(_0x4e8b1c[_0xcc02('0x16')][_0xcc02('0x17')]===0x1f4){logger[_0xcc02('0x16')](_0xcc02('0x12'),_0x2515b1,_0x4e8b1c['error'][_0xcc02('0x18')]);return _0x45f88d(_0x4e8b1c['error'][_0xcc02('0x18')]);}logger[_0xcc02('0x16')](_0xcc02('0x12'),_0x2515b1,_0x4e8b1c[_0xcc02('0x16')]['message']);return _0x1ab806(_0x4e8b1c[_0xcc02('0x16')][_0xcc02('0x18')]);}else{logger[_0xcc02('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x2515b1,_0xcc02('0x13'));_0x1ab806(_0x4e8b1c[_0xcc02('0x19')][_0xcc02('0x18')]);}})[_0xcc02('0x1a')](function(_0x3d3c8e){logger[_0xcc02('0x16')](_0xcc02('0x12'),_0x2515b1,_0x3d3c8e);_0x45f88d(_0x3d3c8e);});});}exports[_0xcc02('0x1b')]=function(_0x2c883f){var _0x56e9eb=this;return new Promise(function(_0x4266d7,_0x114d79){return db[_0xcc02('0x1c')][_0xcc02('0x1d')]({'raw':_0x2c883f[_0xcc02('0x1e')]?_0x2c883f['options'][_0xcc02('0x1f')]===undefined?!![]:![]:!![],'where':_0x2c883f[_0xcc02('0x1e')]?_0x2c883f[_0xcc02('0x1e')]['where']||null:null,'attributes':_0x2c883f[_0xcc02('0x1e')]?_0x2c883f[_0xcc02('0x1e')]['attributes']||null:null,'limit':_0x2c883f[_0xcc02('0x1e')]?_0x2c883f[_0xcc02('0x1e')][_0xcc02('0x20')]||null:null,'include':_0x2c883f[_0xcc02('0x1e')]?_0x2c883f[_0xcc02('0x1e')][_0xcc02('0x21')]?_[_0xcc02('0x22')](_0x2c883f[_0xcc02('0x1e')][_0xcc02('0x21')],function(_0x4c8029){return{'model':db[_0x4c8029['model']],'as':_0x4c8029['as'],'attributes':_0x4c8029[_0xcc02('0x23')],'include':_0x4c8029[_0xcc02('0x21')]?_['map'](_0x4c8029['include'],function(_0x49846a){return{'model':db[_0x49846a[_0xcc02('0x24')]],'as':_0x49846a['as'],'attributes':_0x49846a['attributes'],'include':_0x49846a[_0xcc02('0x21')]?_[_0xcc02('0x22')](_0x49846a[_0xcc02('0x21')],function(_0x1b1326){return{'model':db[_0x1b1326[_0xcc02('0x24')]],'as':_0x1b1326['as'],'attributes':_0x1b1326[_0xcc02('0x23')]};}):[]};}):[]};}):[]:[]})[_0xcc02('0x10')](function(_0x25121a){logger['info']('GetWhatsappQueue',_0x2c883f);logger['debug'](_0xcc02('0x1b'),_0x2c883f,JSON[_0xcc02('0x25')](_0x25121a));_0x4266d7(_0x25121a);})[_0xcc02('0x1a')](function(_0x20caf5){logger[_0xcc02('0x16')]('GetWhatsappQueue',_0x20caf5['message'],_0x2c883f);_0x114d79(_0x56e9eb[_0xcc02('0x16')](0x1f4,_0x20caf5[_0xcc02('0x18')]));});});};exports[_0xcc02('0x26')]=function(_0x97bd38){var _0x1a511e=this;return new Promise(function(_0x23e565,_0x5296a6){return db[_0xcc02('0x1c')][_0xcc02('0x27')]({'raw':_0x97bd38[_0xcc02('0x1e')]?_0x97bd38[_0xcc02('0x1e')][_0xcc02('0x1f')]===undefined?!![]:![]:!![],'where':_0x97bd38['options']?_0x97bd38[_0xcc02('0x1e')][_0xcc02('0x28')]||null:null,'attributes':_0x97bd38[_0xcc02('0x1e')]?_0x97bd38[_0xcc02('0x1e')][_0xcc02('0x23')]||null:null,'include':_0x97bd38[_0xcc02('0x1e')]?_0x97bd38[_0xcc02('0x1e')]['include']?_[_0xcc02('0x22')](_0x97bd38[_0xcc02('0x1e')][_0xcc02('0x21')],function(_0x176314){return{'model':db[_0x176314[_0xcc02('0x24')]],'as':_0x176314['as'],'attributes':_0x176314[_0xcc02('0x23')],'include':_0x176314[_0xcc02('0x21')]?_['map'](_0x176314[_0xcc02('0x21')],function(_0x22f02b){return{'model':db[_0x22f02b[_0xcc02('0x24')]],'as':_0x22f02b['as'],'attributes':_0x22f02b['attributes'],'include':_0x22f02b[_0xcc02('0x21')]?_['map'](_0x22f02b[_0xcc02('0x21')],function(_0x3d43ae){return{'model':db[_0x3d43ae[_0xcc02('0x24')]],'as':_0x3d43ae['as'],'attributes':_0x3d43ae['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc02('0x10')](function(_0x3daeb9){logger[_0xcc02('0x11')](_0xcc02('0x26'),_0x97bd38);logger[_0xcc02('0x14')](_0xcc02('0x26'),_0x97bd38,JSON[_0xcc02('0x25')](_0x3daeb9));_0x23e565(_0x3daeb9);})[_0xcc02('0x1a')](function(_0x4fb9b3){logger['error']('ShowWhatsappQueue',_0x4fb9b3[_0xcc02('0x18')],_0x97bd38);_0x5296a6(_0x1a511e['error'](0x1f4,_0x4fb9b3[_0xcc02('0x18')]));});});}; \ No newline at end of file +var _0xd88e=['GetWhatsappQueue','options','raw','where','limit','include','map','model','attributes','ShowWhatsappQueue','WhatsappQueue','util','moment','randomstring','../../config/logger','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x4955c5,_0x440571){var _0xcea68=function(_0x10054a){while(--_0x10054a){_0x4955c5['push'](_0x4955c5['shift']());}};_0xcea68(++_0x440571);}(_0xd88e,0x12b));var _0xed88=function(_0x2ad861,_0x3a746d){_0x2ad861=_0x2ad861-0x0;var _0x123275=_0xd88e[_0x2ad861];return _0x123275;};'use strict';var _=require('lodash');var util=require(_0xed88('0x0'));var moment=require(_0xed88('0x1'));var BPromise=require('bluebird');var rs=require(_0xed88('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xed88('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xed88('0x4')]=_[_0xed88('0x5')](config[_0xed88('0x4')],{'host':_0xed88('0x6'),'port':0x18eb});var socket=require(_0xed88('0x7'))(new Redis(config[_0xed88('0x4')]));require(_0xed88('0x8'))[_0xed88('0x9')](socket);function respondWithRpcPromise(_0x4d3aa9,_0x32b462,_0x36387d){return new BPromise(function(_0xf8d71b,_0x3308e1){return client['request'](_0x4d3aa9,_0x36387d)[_0xed88('0xa')](function(_0x52e8e3){logger[_0xed88('0xb')](_0xed88('0xc'),_0x32b462,_0xed88('0xd'));logger[_0xed88('0xe')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x32b462,_0xed88('0xd'),JSON[_0xed88('0xf')](_0x52e8e3));if(_0x52e8e3['error']){if(_0x52e8e3[_0xed88('0x10')][_0xed88('0x11')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x32b462,_0x52e8e3[_0xed88('0x10')][_0xed88('0x12')]);return _0x3308e1(_0x52e8e3[_0xed88('0x10')][_0xed88('0x12')]);}logger[_0xed88('0x10')](_0xed88('0xc'),_0x32b462,_0x52e8e3['error'][_0xed88('0x12')]);return _0xf8d71b(_0x52e8e3[_0xed88('0x10')][_0xed88('0x12')]);}else{logger[_0xed88('0xb')]('WhatsappQueue,\x20%s,\x20%s',_0x32b462,_0xed88('0xd'));_0xf8d71b(_0x52e8e3[_0xed88('0x13')][_0xed88('0x12')]);}})[_0xed88('0x14')](function(_0x28b1aa){logger[_0xed88('0x10')](_0xed88('0xc'),_0x32b462,_0x28b1aa);_0x3308e1(_0x28b1aa);});});}exports[_0xed88('0x15')]=function(_0x27ae3b){var _0xc0611b=this;return new Promise(function(_0x2cc111,_0x4a2da5){return db['WhatsappQueue']['findAll']({'raw':_0x27ae3b[_0xed88('0x16')]?_0x27ae3b[_0xed88('0x16')][_0xed88('0x17')]===undefined?!![]:![]:!![],'where':_0x27ae3b[_0xed88('0x16')]?_0x27ae3b[_0xed88('0x16')][_0xed88('0x18')]||null:null,'attributes':_0x27ae3b[_0xed88('0x16')]?_0x27ae3b[_0xed88('0x16')]['attributes']||null:null,'limit':_0x27ae3b[_0xed88('0x16')]?_0x27ae3b[_0xed88('0x16')][_0xed88('0x19')]||null:null,'include':_0x27ae3b[_0xed88('0x16')]?_0x27ae3b[_0xed88('0x16')][_0xed88('0x1a')]?_[_0xed88('0x1b')](_0x27ae3b[_0xed88('0x16')][_0xed88('0x1a')],function(_0x528b10){return{'model':db[_0x528b10[_0xed88('0x1c')]],'as':_0x528b10['as'],'attributes':_0x528b10[_0xed88('0x1d')],'include':_0x528b10[_0xed88('0x1a')]?_[_0xed88('0x1b')](_0x528b10[_0xed88('0x1a')],function(_0x5b2d51){return{'model':db[_0x5b2d51[_0xed88('0x1c')]],'as':_0x5b2d51['as'],'attributes':_0x5b2d51[_0xed88('0x1d')],'include':_0x5b2d51[_0xed88('0x1a')]?_[_0xed88('0x1b')](_0x5b2d51[_0xed88('0x1a')],function(_0x16096a){return{'model':db[_0x16096a[_0xed88('0x1c')]],'as':_0x16096a['as'],'attributes':_0x16096a[_0xed88('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xed88('0xa')](function(_0x519b94){logger[_0xed88('0xb')](_0xed88('0x15'),_0x27ae3b);logger[_0xed88('0xe')](_0xed88('0x15'),_0x27ae3b,JSON[_0xed88('0xf')](_0x519b94));_0x2cc111(_0x519b94);})[_0xed88('0x14')](function(_0x193a5a){logger[_0xed88('0x10')]('GetWhatsappQueue',_0x193a5a['message'],_0x27ae3b);_0x4a2da5(_0xc0611b[_0xed88('0x10')](0x1f4,_0x193a5a[_0xed88('0x12')]));});});};exports[_0xed88('0x1e')]=function(_0x3db393){var _0x51b28e=this;return new Promise(function(_0x392ffa,_0xce9154){return db[_0xed88('0x1f')]['find']({'raw':_0x3db393[_0xed88('0x16')]?_0x3db393['options'][_0xed88('0x17')]===undefined?!![]:![]:!![],'where':_0x3db393[_0xed88('0x16')]?_0x3db393[_0xed88('0x16')][_0xed88('0x18')]||null:null,'attributes':_0x3db393[_0xed88('0x16')]?_0x3db393[_0xed88('0x16')]['attributes']||null:null,'include':_0x3db393['options']?_0x3db393[_0xed88('0x16')][_0xed88('0x1a')]?_['map'](_0x3db393[_0xed88('0x16')][_0xed88('0x1a')],function(_0x3e64a1){return{'model':db[_0x3e64a1[_0xed88('0x1c')]],'as':_0x3e64a1['as'],'attributes':_0x3e64a1[_0xed88('0x1d')],'include':_0x3e64a1[_0xed88('0x1a')]?_[_0xed88('0x1b')](_0x3e64a1[_0xed88('0x1a')],function(_0x366d95){return{'model':db[_0x366d95[_0xed88('0x1c')]],'as':_0x366d95['as'],'attributes':_0x366d95[_0xed88('0x1d')],'include':_0x366d95[_0xed88('0x1a')]?_[_0xed88('0x1b')](_0x366d95[_0xed88('0x1a')],function(_0x22db86){return{'model':db[_0x22db86[_0xed88('0x1c')]],'as':_0x22db86['as'],'attributes':_0x22db86[_0xed88('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xed88('0xa')](function(_0x4deead){logger[_0xed88('0xb')]('ShowWhatsappQueue',_0x3db393);logger['debug'](_0xed88('0x1e'),_0x3db393,JSON[_0xed88('0xf')](_0x4deead));_0x392ffa(_0x4deead);})[_0xed88('0x14')](function(_0x333dfb){logger[_0xed88('0x10')](_0xed88('0x1e'),_0x333dfb[_0xed88('0x12')],_0x3db393);_0xce9154(_0x51b28e[_0xed88('0x10')](0x1f4,_0x333dfb[_0xed88('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 0c5ea3a..f8a5f02 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 _0xf764=['removeListener','register','length','whatsappQueue:','save','remove','update','emit'];(function(_0x5be235,_0x46833c){var _0x21c7ce=function(_0x39d565){while(--_0x39d565){_0x5be235['push'](_0x5be235['shift']());}};_0x21c7ce(++_0x46833c);}(_0xf764,0x19c));var _0x4f76=function(_0x162a5e,_0x2b060a){_0x162a5e=_0x162a5e-0x0;var _0x581db4=_0xf764[_0x162a5e];return _0x581db4;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x4f76('0x0'),_0x4f76('0x1'),_0x4f76('0x2')];function createListener(_0x5eefa0,_0x30cbe7){return function(_0x589528){_0x30cbe7[_0x4f76('0x3')](_0x5eefa0,_0x589528);};}function removeListener(_0x5824f3,_0x481378){return function(){WhatsappQueueEvents[_0x4f76('0x4')](_0x5824f3,_0x481378);};}exports[_0x4f76('0x5')]=function(_0x3f9c73){for(var _0x3ff64b=0x0,_0x3db698=events[_0x4f76('0x6')];_0x3ff64b<_0x3db698;_0x3ff64b++){var _0x3ca649=events[_0x3ff64b];var _0x32d5b5=createListener(_0x4f76('0x7')+_0x3ca649,_0x3f9c73);WhatsappQueueEvents['on'](_0x3ca649,_0x32d5b5);}}; \ No newline at end of file +var _0xb226=['register','length','./whatsappQueue.events','save','update','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb226,0xa4));var _0x6b22=function(_0x4fb4a3,_0x2c9173){_0x4fb4a3=_0x4fb4a3-0x0;var _0x815732=_0xb226[_0x4fb4a3];return _0x815732;};'use strict';var WhatsappQueueEvents=require(_0x6b22('0x0'));var events=[_0x6b22('0x1'),'remove',_0x6b22('0x2')];function createListener(_0x211ca8,_0x1316b0){return function(_0x22646a){_0x1316b0['emit'](_0x211ca8,_0x22646a);};}function removeListener(_0x31cc78,_0x2ea538){return function(){WhatsappQueueEvents[_0x6b22('0x3')](_0x31cc78,_0x2ea538);};}exports[_0x6b22('0x4')]=function(_0xd96390){for(var _0x7eec05=0x0,_0x4ba282=events[_0x6b22('0x5')];_0x7eec05<_0x4ba282;_0x7eec05++){var _0x43afc4=events[_0x7eec05];var _0x3cb8a3=createListener('whatsappQueue:'+_0x43afc4,_0xd96390);WhatsappQueueEvents['on'](_0x43afc4,_0x3cb8a3);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 7607b69..5853c22 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 _0x008e=['exports','multer','util','express','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x008e,0x1d1));var _0xe008=function(_0x4c87fe,_0x1a57c7){_0x4c87fe=_0x4c87fe-0x0;var _0x2b35ee=_0x008e[_0x4c87fe];return _0x2b35ee;};'use strict';var multer=require(_0xe008('0x0'));var util=require(_0xe008('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe008('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe008('0x3'));var config=require('../../config/environment');var controller=require(_0xe008('0x4'));router[_0xe008('0x5')]('/',auth[_0xe008('0x6')](),controller[_0xe008('0x7')]);router[_0xe008('0x5')](_0xe008('0x8'),auth[_0xe008('0x6')](),controller['describe']);router[_0xe008('0x5')]('/:id',auth[_0xe008('0x6')](),controller[_0xe008('0x9')]);router[_0xe008('0xa')]('/',auth[_0xe008('0x6')](),controller[_0xe008('0xb')]);router[_0xe008('0xc')](_0xe008('0xd'),auth[_0xe008('0x6')](),controller[_0xe008('0xe')]);router['delete']('/:id',auth[_0xe008('0x6')](),controller['destroy']);module[_0xe008('0xf')]=router; \ No newline at end of file +var _0xd8d6=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','destroy'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xd8d6,0x177));var _0x6d8d=function(_0x3374e9,_0x53dad0){_0x3374e9=_0x3374e9-0x0;var _0x213651=_0xd8d6[_0x3374e9];return _0x213651;};'use strict';var multer=require(_0x6d8d('0x0'));var util=require(_0x6d8d('0x1'));var path=require(_0x6d8d('0x2'));var timeout=require(_0x6d8d('0x3'));var express=require(_0x6d8d('0x4'));var router=express[_0x6d8d('0x5')]();var fs_extra=require(_0x6d8d('0x6'));var auth=require(_0x6d8d('0x7'));var interaction=require(_0x6d8d('0x8'));var config=require(_0x6d8d('0x9'));var controller=require(_0x6d8d('0xa'));router[_0x6d8d('0xb')]('/',auth[_0x6d8d('0xc')](),controller['index']);router['get'](_0x6d8d('0xd'),auth[_0x6d8d('0xc')](),controller[_0x6d8d('0xe')]);router[_0x6d8d('0xb')](_0x6d8d('0xf'),auth[_0x6d8d('0xc')](),controller[_0x6d8d('0x10')]);router['post']('/',auth[_0x6d8d('0xc')](),controller[_0x6d8d('0x11')]);router[_0x6d8d('0x12')](_0x6d8d('0xf'),auth[_0x6d8d('0xc')](),controller[_0x6d8d('0x13')]);router['delete'](_0x6d8d('0xf'),auth['isAuthenticated'](),controller[_0x6d8d('0x14')]);module[_0x6d8d('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index e211571..074d017 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x293658,_0x1dab65){var _0x3e7969=function(_0x1993d7){while(--_0x1993d7){_0x293658['push'](_0x293658['shift']());}};_0x3e7969(++_0x1dab65);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x5b0a43,_0x1f52cf){var _0x491492=function(_0x28054c){while(--_0x28054c){_0x5b0a43['push'](_0x5b0a43['shift']());}};_0x491492(++_0x1f52cf);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 6c464ac..fb02263 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 _0x087b=['name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','merge','find','create','body','update','params','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','error','stack'];(function(_0x43a2e2,_0x4e9243){var _0x11e516=function(_0x317d19){while(--_0x317d19){_0x43a2e2['push'](_0x43a2e2['shift']());}};_0x11e516(++_0x4e9243);}(_0x087b,0x11a));var _0xb087=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x087b[_0x2e4e19];return _0x9ba20b;};'use strict';var emlformat=require(_0xb087('0x0'));var rimraf=require(_0xb087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb087('0x2'));var moment=require('moment');var BPromise=require(_0xb087('0x3'));var Mustache=require(_0xb087('0x4'));var util=require(_0xb087('0x5'));var path=require(_0xb087('0x6'));var sox=require(_0xb087('0x7'));var csv=require(_0xb087('0x8'));var ejs=require(_0xb087('0x9'));var fs=require('fs');var fs_extra=require(_0xb087('0xa'));var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x8'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb087('0x1a'))['db'];function respondWithStatusCode(_0x31f977,_0x323656){_0x323656=_0x323656||0xcc;return function(_0x51ceaa){if(_0x51ceaa){return _0x31f977[_0xb087('0x1b')](_0x323656);}return _0x31f977[_0xb087('0x1c')](_0x323656)[_0xb087('0x1d')]();};}function respondWithResult(_0x46410b,_0x11784c){_0x11784c=_0x11784c||0xc8;return function(_0x12d0db){if(_0x12d0db){return _0x46410b[_0xb087('0x1c')](_0x11784c)[_0xb087('0x1e')](_0x12d0db);}};}function respondWithFilteredResult(_0x24e1a3,_0x16d0b7){return function(_0x5193a4){if(_0x5193a4){var _0x43e576=typeof _0x16d0b7[_0xb087('0x1f')]==='undefined'&&typeof _0x16d0b7[_0xb087('0x20')]===_0xb087('0x21');var _0x2e9e74=_0x5193a4['count'];var _0x330005=_0x43e576?0x0:_0x16d0b7[_0xb087('0x1f')];var _0x17200d=_0x43e576?_0x5193a4[_0xb087('0x22')]:_0x16d0b7['offset']+_0x16d0b7[_0xb087('0x20')];var _0x28428e;if(_0x17200d>=_0x2e9e74){_0x17200d=_0x2e9e74;_0x28428e=0xc8;}else{_0x28428e=0xce;}_0x24e1a3[_0xb087('0x1c')](_0x28428e);return _0x24e1a3[_0xb087('0x23')]('Content-Range',_0x330005+'-'+_0x17200d+'/'+_0x2e9e74)['json'](_0x5193a4);}return null;};}function patchUpdates(_0x5ea3dc){return function(_0x49450a){try{jsonpatch[_0xb087('0x24')](_0x49450a,_0x5ea3dc,!![]);}catch(_0x17be8e){return BPromise[_0xb087('0x25')](_0x17be8e);}return _0x49450a[_0xb087('0x26')]();};}function saveUpdates(_0x1fb765,_0x258b4c){return function(_0x31ae01){if(_0x31ae01){return _0x31ae01['update'](_0x1fb765)[_0xb087('0x27')](function(_0x466397){return _0x466397;});}return null;};}function removeEntity(_0x1de654,_0x1cfb3e){return function(_0x3ad74e){if(_0x3ad74e){return _0x3ad74e['destroy']()[_0xb087('0x27')](function(){_0x1de654[_0xb087('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a2dc6,_0x50745a){return function(_0x598b99){if(!_0x598b99){_0x5a2dc6['sendStatus'](0x194);}return _0x598b99;};}function handleError(_0x304840,_0x45685d){_0x45685d=_0x45685d||0x1f4;return function(_0x1d124f){logger[_0xb087('0x28')](_0x1d124f[_0xb087('0x29')]);if(_0x1d124f[_0xb087('0x2a')]){delete _0x1d124f[_0xb087('0x2a')];}_0x304840[_0xb087('0x1c')](_0x45685d)[_0xb087('0x2b')](_0x1d124f);};}exports[_0xb087('0x2c')]=function(_0x18058c,_0x31e3e6){var _0xb0baf6={},_0x263259={},_0x593b78={'count':0x0,'rows':[]};var _0x37393a=_[_0xb087('0x2d')](db[_0xb087('0x2e')][_0xb087('0x2f')],function(_0x22d441){return{'name':_0x22d441[_0xb087('0x30')],'type':_0x22d441[_0xb087('0x31')][_0xb087('0x32')]};});_0x263259['model']=_['map'](_0x37393a,_0xb087('0x2a'));_0x263259[_0xb087('0x33')]=_['keys'](_0x18058c[_0xb087('0x33')]);_0x263259[_0xb087('0x34')]=_[_0xb087('0x35')](_0x263259[_0xb087('0x36')],_0x263259[_0xb087('0x33')]);_0xb0baf6[_0xb087('0x37')]=_[_0xb087('0x35')](_0x263259[_0xb087('0x36')],qs[_0xb087('0x38')](_0x18058c[_0xb087('0x33')][_0xb087('0x38')]));_0xb0baf6[_0xb087('0x37')]=_0xb0baf6['attributes'][_0xb087('0x39')]?_0xb0baf6['attributes']:_0x263259[_0xb087('0x36')];if(!_0x18058c[_0xb087('0x33')][_0xb087('0x3a')](_0xb087('0x3b'))){_0xb0baf6[_0xb087('0x20')]=qs[_0xb087('0x20')](_0x18058c[_0xb087('0x33')][_0xb087('0x20')]);_0xb0baf6[_0xb087('0x1f')]=qs['offset'](_0x18058c['query'][_0xb087('0x1f')]);}_0xb0baf6[_0xb087('0x3c')]=qs[_0xb087('0x3d')](_0x18058c[_0xb087('0x33')][_0xb087('0x3d')]);_0xb0baf6['where']=qs[_0xb087('0x34')](_[_0xb087('0x3e')](_0x18058c['query'],_0x263259['filters']),_0x37393a);if(_0x18058c[_0xb087('0x33')][_0xb087('0x3f')]){_0xb0baf6[_0xb087('0x40')]=_['merge'](_0xb0baf6[_0xb087('0x40')],{'$or':_[_0xb087('0x2d')](_0x37393a,function(_0x1caa6e){if(_0x1caa6e[_0xb087('0x31')]!==_0xb087('0x41')){var _0x5db6b9={};_0x5db6b9[_0x1caa6e[_0xb087('0x2a')]]={'$like':'%'+_0x18058c['query'][_0xb087('0x3f')]+'%'};return _0x5db6b9;}})});}_0xb0baf6=_['merge']({},_0xb0baf6,_0x18058c[_0xb087('0x42')]);var _0xc9f9e9={'where':_0xb0baf6['where']};return db[_0xb087('0x2e')]['count'](_0xc9f9e9)[_0xb087('0x27')](function(_0x4a360c){_0x593b78[_0xb087('0x22')]=_0x4a360c;if(_0x18058c[_0xb087('0x33')][_0xb087('0x43')]){_0xb0baf6[_0xb087('0x44')]=[{'all':!![]}];}return db[_0xb087('0x2e')][_0xb087('0x45')](_0xb0baf6);})[_0xb087('0x27')](function(_0x5e7690){_0x593b78[_0xb087('0x46')]=_0x5e7690;return _0x593b78;})['then'](respondWithFilteredResult(_0x31e3e6,_0xb0baf6))[_0xb087('0x47')](handleError(_0x31e3e6,null));};exports[_0xb087('0x48')]=function(_0x5b6924,_0xb662bf){var _0x45dc6f={'raw':!![],'where':{'id':_0x5b6924['params']['id']}},_0x7650c5={};_0x7650c5[_0xb087('0x36')]=_['keys'](db[_0xb087('0x2e')][_0xb087('0x2f')]);_0x7650c5['query']=_[_0xb087('0x49')](_0x5b6924[_0xb087('0x33')]);_0x7650c5['filters']=_[_0xb087('0x35')](_0x7650c5[_0xb087('0x36')],_0x7650c5['query']);_0x45dc6f[_0xb087('0x37')]=_[_0xb087('0x35')](_0x7650c5[_0xb087('0x36')],qs[_0xb087('0x38')](_0x5b6924['query']['fields']));_0x45dc6f[_0xb087('0x37')]=_0x45dc6f[_0xb087('0x37')][_0xb087('0x39')]?_0x45dc6f[_0xb087('0x37')]:_0x7650c5[_0xb087('0x36')];if(_0x5b6924[_0xb087('0x33')]['includeAll']){_0x45dc6f['include']=[{'all':!![]}];}_0x45dc6f=_[_0xb087('0x4a')]({},_0x45dc6f,_0x5b6924['options']);return db[_0xb087('0x2e')][_0xb087('0x4b')](_0x45dc6f)[_0xb087('0x27')](handleEntityNotFound(_0xb662bf,null))[_0xb087('0x27')](respondWithResult(_0xb662bf,null))['catch'](handleError(_0xb662bf,null));};exports[_0xb087('0x4c')]=function(_0x562751,_0x2fe8a0){return db[_0xb087('0x2e')][_0xb087('0x4c')](_0x562751[_0xb087('0x4d')],{})[_0xb087('0x27')](respondWithResult(_0x2fe8a0,0xc9))['catch'](handleError(_0x2fe8a0,null));};exports[_0xb087('0x4e')]=function(_0xb15e28,_0x588d96){if(_0xb15e28['body']['id']){delete _0xb15e28[_0xb087('0x4d')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0xb15e28[_0xb087('0x4f')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0x588d96,null))['then'](saveUpdates(_0xb15e28[_0xb087('0x4d')],null))[_0xb087('0x27')](respondWithResult(_0x588d96,null))[_0xb087('0x47')](handleError(_0x588d96,null));};exports['destroy']=function(_0x5ba160,_0x30cc83){return db['WhatsappQueueReport']['find']({'where':{'id':_0x5ba160[_0xb087('0x4f')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0x30cc83,null))[_0xb087('0x27')](removeEntity(_0x30cc83,null))[_0xb087('0x47')](handleError(_0x30cc83,null));};exports[_0xb087('0x50')]=function(_0x148642,_0xbd849d){return db[_0xb087('0x2e')][_0xb087('0x50')]()[_0xb087('0x27')](respondWithResult(_0xbd849d,null))[_0xb087('0x47')](handleError(_0xbd849d,null));}; \ No newline at end of file +var _0xf45e=['Content-Range','json','apply','reject','save','destroy','then','sendStatus','stack','index','map','rawAttributes','type','key','model','name','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','WhatsappQueueReport','includeAll','include','findAll','rows','show','params','keys','length','merge','find','create','body','update','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set'];(function(_0x284cb4,_0x3483a9){var _0x4b5e92=function(_0x12e8ea){while(--_0x12e8ea){_0x284cb4['push'](_0x284cb4['shift']());}};_0x4b5e92(++_0x3483a9);}(_0xf45e,0x115));var _0xef45=function(_0x4f74df,_0x57fc4b){_0x4f74df=_0x4f74df-0x0;var _0x2f1321=_0xf45e[_0x4f74df];return _0x2f1321;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];function respondWithStatusCode(_0x30babb,_0x433be9){_0x433be9=_0x433be9||0xcc;return function(_0x476739){if(_0x476739){return _0x30babb['sendStatus'](_0x433be9);}return _0x30babb['status'](_0x433be9)[_0xef45('0x1c')]();};}function respondWithResult(_0x47fd96,_0x2ae89a){_0x2ae89a=_0x2ae89a||0xc8;return function(_0xb0fc43){if(_0xb0fc43){return _0x47fd96[_0xef45('0x1d')](_0x2ae89a)['json'](_0xb0fc43);}};}function respondWithFilteredResult(_0x5b3136,_0x29c0c4){return function(_0x5530e6){if(_0x5530e6){var _0x11cd3a=typeof _0x29c0c4[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x29c0c4[_0xef45('0x20')]==='undefined';var _0x560b2f=_0x5530e6[_0xef45('0x21')];var _0x219778=_0x11cd3a?0x0:_0x29c0c4[_0xef45('0x1e')];var _0x258785=_0x11cd3a?_0x5530e6['count']:_0x29c0c4['offset']+_0x29c0c4[_0xef45('0x20')];var _0x20ef26;if(_0x258785>=_0x560b2f){_0x258785=_0x560b2f;_0x20ef26=0xc8;}else{_0x20ef26=0xce;}_0x5b3136[_0xef45('0x1d')](_0x20ef26);return _0x5b3136[_0xef45('0x22')](_0xef45('0x23'),_0x219778+'-'+_0x258785+'/'+_0x560b2f)[_0xef45('0x24')](_0x5530e6);}return null;};}function patchUpdates(_0x375cbd){return function(_0x4a6217){try{jsonpatch[_0xef45('0x25')](_0x4a6217,_0x375cbd,!![]);}catch(_0x3e2a47){return BPromise[_0xef45('0x26')](_0x3e2a47);}return _0x4a6217[_0xef45('0x27')]();};}function saveUpdates(_0x27322f,_0x5205bf){return function(_0x40abc8){if(_0x40abc8){return _0x40abc8['update'](_0x27322f)['then'](function(_0x7707a1){return _0x7707a1;});}return null;};}function removeEntity(_0x2b41d8,_0xbb859b){return function(_0x7817d0){if(_0x7817d0){return _0x7817d0[_0xef45('0x28')]()[_0xef45('0x29')](function(){_0x2b41d8[_0xef45('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208b35,_0x5f0593){return function(_0x38b470){if(!_0x38b470){_0x208b35[_0xef45('0x2a')](0x194);}return _0x38b470;};}function handleError(_0x578f03,_0x46e423){_0x46e423=_0x46e423||0x1f4;return function(_0x2c356d){logger['error'](_0x2c356d[_0xef45('0x2b')]);if(_0x2c356d['name']){delete _0x2c356d['name'];}_0x578f03['status'](_0x46e423)['send'](_0x2c356d);};}exports[_0xef45('0x2c')]=function(_0x2f72ef,_0x217e8d){var _0x15ad38={},_0x5782d0={},_0x18f304={'count':0x0,'rows':[]};var _0x4f028c=_[_0xef45('0x2d')](db['WhatsappQueueReport'][_0xef45('0x2e')],function(_0x5bfd2d){return{'name':_0x5bfd2d['fieldName'],'type':_0x5bfd2d[_0xef45('0x2f')][_0xef45('0x30')]};});_0x5782d0[_0xef45('0x31')]=_[_0xef45('0x2d')](_0x4f028c,_0xef45('0x32'));_0x5782d0['query']=_['keys'](_0x2f72ef['query']);_0x5782d0[_0xef45('0x33')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],_0x5782d0[_0xef45('0x35')]);_0x15ad38[_0xef45('0x36')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],qs['fields'](_0x2f72ef['query'][_0xef45('0x37')]));_0x15ad38['attributes']=_0x15ad38[_0xef45('0x36')]['length']?_0x15ad38[_0xef45('0x36')]:_0x5782d0[_0xef45('0x31')];if(!_0x2f72ef[_0xef45('0x35')][_0xef45('0x38')](_0xef45('0x39'))){_0x15ad38['limit']=qs[_0xef45('0x20')](_0x2f72ef[_0xef45('0x35')][_0xef45('0x20')]);_0x15ad38['offset']=qs['offset'](_0x2f72ef[_0xef45('0x35')][_0xef45('0x1e')]);}_0x15ad38['order']=qs[_0xef45('0x3a')](_0x2f72ef['query']['sort']);_0x15ad38[_0xef45('0x3b')]=qs[_0xef45('0x33')](_[_0xef45('0x3c')](_0x2f72ef['query'],_0x5782d0[_0xef45('0x33')]),_0x4f028c);if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]){_0x15ad38[_0xef45('0x3b')]=_['merge'](_0x15ad38['where'],{'$or':_[_0xef45('0x2d')](_0x4f028c,function(_0x474be1){if(_0x474be1[_0xef45('0x2f')]!==_0xef45('0x3e')){var _0x269a11={};_0x269a11[_0x474be1[_0xef45('0x32')]]={'$like':'%'+_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]+'%'};return _0x269a11;}})});}_0x15ad38=_['merge']({},_0x15ad38,_0x2f72ef['options']);var _0x13f8b2={'where':_0x15ad38[_0xef45('0x3b')]};return db[_0xef45('0x3f')][_0xef45('0x21')](_0x13f8b2)[_0xef45('0x29')](function(_0x3bcada){_0x18f304[_0xef45('0x21')]=_0x3bcada;if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x40')]){_0x15ad38[_0xef45('0x41')]=[{'all':!![]}];}return db[_0xef45('0x3f')][_0xef45('0x42')](_0x15ad38);})[_0xef45('0x29')](function(_0xd7d217){_0x18f304[_0xef45('0x43')]=_0xd7d217;return _0x18f304;})[_0xef45('0x29')](respondWithFilteredResult(_0x217e8d,_0x15ad38))['catch'](handleError(_0x217e8d,null));};exports[_0xef45('0x44')]=function(_0x5bdfad,_0x1b9d45){var _0x82c123={'raw':!![],'where':{'id':_0x5bdfad[_0xef45('0x45')]['id']}},_0x54ccb8={};_0x54ccb8['model']=_[_0xef45('0x46')](db['WhatsappQueueReport'][_0xef45('0x2e')]);_0x54ccb8[_0xef45('0x35')]=_[_0xef45('0x46')](_0x5bdfad[_0xef45('0x35')]);_0x54ccb8[_0xef45('0x33')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],_0x54ccb8['query']);_0x82c123[_0xef45('0x36')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],qs[_0xef45('0x37')](_0x5bdfad[_0xef45('0x35')][_0xef45('0x37')]));_0x82c123[_0xef45('0x36')]=_0x82c123[_0xef45('0x36')][_0xef45('0x47')]?_0x82c123[_0xef45('0x36')]:_0x54ccb8[_0xef45('0x31')];if(_0x5bdfad[_0xef45('0x35')][_0xef45('0x40')]){_0x82c123[_0xef45('0x41')]=[{'all':!![]}];}_0x82c123=_[_0xef45('0x48')]({},_0x82c123,_0x5bdfad['options']);return db[_0xef45('0x3f')][_0xef45('0x49')](_0x82c123)[_0xef45('0x29')](handleEntityNotFound(_0x1b9d45,null))['then'](respondWithResult(_0x1b9d45,null))['catch'](handleError(_0x1b9d45,null));};exports['create']=function(_0x29aeab,_0x18143c){return db[_0xef45('0x3f')][_0xef45('0x4a')](_0x29aeab[_0xef45('0x4b')],{})[_0xef45('0x29')](respondWithResult(_0x18143c,0xc9))['catch'](handleError(_0x18143c,null));};exports[_0xef45('0x4c')]=function(_0x463796,_0x2b2419){if(_0x463796['body']['id']){delete _0x463796['body']['id'];}return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x463796['params']['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x2b2419,null))[_0xef45('0x29')](saveUpdates(_0x463796[_0xef45('0x4b')],null))[_0xef45('0x29')](respondWithResult(_0x2b2419,null))[_0xef45('0x4d')](handleError(_0x2b2419,null));};exports[_0xef45('0x28')]=function(_0x23581f,_0xfa5fdd){return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x23581f[_0xef45('0x45')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0xfa5fdd,null))[_0xef45('0x29')](removeEntity(_0xfa5fdd,null))[_0xef45('0x4d')](handleError(_0xfa5fdd,null));};exports['describe']=function(_0x22b75e,_0x24aceb){return db[_0xef45('0x3f')]['describe']()[_0xef45('0x29')](respondWithResult(_0x24aceb,null))[_0xef45('0x4d')](handleError(_0x24aceb,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 07e1eaf..edcd687 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 _0x4e00=['lodash','util','api','moment','bluebird','request-promise','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x4e00,0x78));var _0x04e0=function(_0x13a25e,_0x361428){_0x13a25e=_0x13a25e-0x0;var _0x1f6c57=_0x4e00[_0x13a25e];return _0x1f6c57;};'use strict';var _=require(_0x04e0('0x0'));var util=require(_0x04e0('0x1'));var logger=require('../../config/logger')(_0x04e0('0x2'));var moment=require(_0x04e0('0x3'));var BPromise=require(_0x04e0('0x4'));var rp=require(_0x04e0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x04e0('0x6'));var attributes=require(_0x04e0('0x7'));module[_0x04e0('0x8')]=function(_0x271725,_0x20f0d0){return _0x271725['define'](_0x04e0('0x9'),attributes,{'tableName':_0x04e0('0xa'),'paranoid':![],'indexes':[{'name':_0x04e0('0xb'),'fields':[_0x04e0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x42e5=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x44b652,_0x135335){var _0x1de725=function(_0x243ef2){while(--_0x243ef2){_0x44b652['push'](_0x44b652['shift']());}};_0x1de725(++_0x135335);}(_0x42e5,0x9c));var _0x542e=function(_0x2bd007,_0x281ba0){_0x2bd007=_0x2bd007-0x0;var _0x53c252=_0x42e5[_0x2bd007];return _0x53c252;};'use strict';var _=require(_0x542e('0x0'));var util=require(_0x542e('0x1'));var logger=require(_0x542e('0x2'))(_0x542e('0x3'));var moment=require(_0x542e('0x4'));var BPromise=require(_0x542e('0x5'));var rp=require(_0x542e('0x6'));var fs=require('fs');var path=require(_0x542e('0x7'));var rimraf=require(_0x542e('0x8'));var config=require(_0x542e('0x9'));var attributes=require(_0x542e('0xa'));module[_0x542e('0xb')]=function(_0x55bc99,_0x110d4f){return _0x55bc99[_0x542e('0xc')](_0x542e('0xd'),attributes,{'tableName':_0x542e('0xe'),'paranoid':![],'indexes':[{'name':_0x542e('0xf'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 9950a32..781b606 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 _0x6394=['randomstring','ioredis','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x412c8f,_0x11ec94){var _0x27c005=function(_0x127059){while(--_0x127059){_0x412c8f['push'](_0x412c8f['shift']());}};_0x27c005(++_0x11ec94);}(_0x6394,0x101));var _0x4639=function(_0x492543,_0x5b98a4){_0x492543=_0x492543-0x0;var _0x11c12a=_0x6394[_0x492543];return _0x11c12a;};'use strict';var _=require(_0x4639('0x0'));var util=require(_0x4639('0x1'));var moment=require(_0x4639('0x2'));var BPromise=require(_0x4639('0x3'));var rs=require(_0x4639('0x4'));var fs=require('fs');var Redis=require(_0x4639('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4639('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22160b,_0x3e1b35,_0x38e031){return new BPromise(function(_0x4919f5,_0x407a6e){return client[_0x4639('0x7')](_0x22160b,_0x38e031)[_0x4639('0x8')](function(_0x586266){logger[_0x4639('0x9')](_0x4639('0xa'),_0x3e1b35,_0x4639('0xb'));logger[_0x4639('0xc')](_0x4639('0xd'),_0x3e1b35,'request\x20sent',JSON[_0x4639('0xe')](_0x586266));if(_0x586266[_0x4639('0xf')]){if(_0x586266[_0x4639('0xf')][_0x4639('0x10')]===0x1f4){logger[_0x4639('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3e1b35,_0x586266[_0x4639('0xf')][_0x4639('0x11')]);return _0x407a6e(_0x586266[_0x4639('0xf')][_0x4639('0x11')]);}logger[_0x4639('0xf')](_0x4639('0xa'),_0x3e1b35,_0x586266['error'][_0x4639('0x11')]);return _0x4919f5(_0x586266[_0x4639('0xf')]['message']);}else{logger[_0x4639('0x9')](_0x4639('0xa'),_0x3e1b35,_0x4639('0xb'));_0x4919f5(_0x586266['result']['message']);}})[_0x4639('0x12')](function(_0x195fe3){logger['error'](_0x4639('0xa'),_0x3e1b35,_0x195fe3);_0x407a6e(_0x195fe3);});});}exports[_0x4639('0x13')]=function(_0x2930fa){var _0x35bb40=this;return new Promise(function(_0x32edda,_0x39a8f2){return db['WhatsappQueueReport'][_0x4639('0x14')](_0x2930fa[_0x4639('0x15')],{'raw':_0x2930fa[_0x4639('0x16')]?_0x2930fa[_0x4639('0x16')][_0x4639('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x171017){logger[_0x4639('0x9')](_0x4639('0x13'),_0x2930fa);logger[_0x4639('0xc')]('CreateWhatsappQueueReport',_0x2930fa,JSON[_0x4639('0xe')](_0x171017));_0x32edda(_0x171017);})['catch'](function(_0x287511){logger[_0x4639('0xf')](_0x4639('0x13'),_0x287511[_0x4639('0x11')],_0x2930fa);_0x39a8f2(_0x35bb40['error'](0x1f4,_0x287511['message']));});});};exports[_0x4639('0x18')]=function(_0x1f5bdd){var _0x153abd=this;return new Promise(function(_0x75e4ac,_0x43f999){return db['WhatsappQueueReport'][_0x4639('0x19')](_0x1f5bdd[_0x4639('0x15')],{'raw':_0x1f5bdd[_0x4639('0x16')]?_0x1f5bdd[_0x4639('0x16')][_0x4639('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f5bdd[_0x4639('0x16')]?_0x1f5bdd[_0x4639('0x16')][_0x4639('0x1a')]||null:null,'attributes':_0x1f5bdd['options']?_0x1f5bdd[_0x4639('0x16')][_0x4639('0x1b')]||null:null,'limit':_0x1f5bdd[_0x4639('0x16')]?_0x1f5bdd[_0x4639('0x16')][_0x4639('0x1c')]||null:null})['then'](function(_0x3a737d){logger[_0x4639('0x9')]('UpdateWhatsappQueueReport',_0x1f5bdd);logger[_0x4639('0xc')](_0x4639('0x18'),_0x1f5bdd,JSON[_0x4639('0xe')](_0x3a737d));_0x75e4ac(_0x3a737d);})[_0x4639('0x12')](function(_0x455979){logger[_0x4639('0xf')](_0x4639('0x18'),_0x455979['message'],_0x1f5bdd);_0x43f999(_0x153abd[_0x4639('0xf')](0x1f4,_0x455979[_0x4639('0x11')]));});});}; \ No newline at end of file +var _0x6d67=['limit','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport','update','body','attributes'];(function(_0x1bdd2d,_0x308db2){var _0x3f723a=function(_0xff0e6b){while(--_0xff0e6b){_0x1bdd2d['push'](_0x1bdd2d['shift']());}};_0x3f723a(++_0x308db2);}(_0x6d67,0x156));var _0x76d6=function(_0x236324,_0x2e24bc){_0x236324=_0x236324-0x0;var _0x16ef65=_0x6d67[_0x236324];return _0x16ef65;};'use strict';var _=require(_0x76d6('0x0'));var util=require('util');var moment=require(_0x76d6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76d6('0x2'));var db=require(_0x76d6('0x3'))['db'];var utils=require(_0x76d6('0x4'));var logger=require(_0x76d6('0x5'))(_0x76d6('0x6'));var config=require(_0x76d6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x76d6('0x8')][_0x76d6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55bdcb,_0x5b145f,_0xd08370){return new BPromise(function(_0xd34b36,_0x5d8a62){return client[_0x76d6('0xa')](_0x55bdcb,_0xd08370)[_0x76d6('0xb')](function(_0x1f058a){logger[_0x76d6('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5b145f,_0x76d6('0xd'));logger[_0x76d6('0xe')](_0x76d6('0xf'),_0x5b145f,_0x76d6('0xd'),JSON[_0x76d6('0x10')](_0x1f058a));if(_0x1f058a[_0x76d6('0x11')]){if(_0x1f058a[_0x76d6('0x11')][_0x76d6('0x12')]===0x1f4){logger[_0x76d6('0x11')](_0x76d6('0x13'),_0x5b145f,_0x1f058a[_0x76d6('0x11')][_0x76d6('0x14')]);return _0x5d8a62(_0x1f058a['error']['message']);}logger['error'](_0x76d6('0x13'),_0x5b145f,_0x1f058a['error'][_0x76d6('0x14')]);return _0xd34b36(_0x1f058a['error'][_0x76d6('0x14')]);}else{logger[_0x76d6('0xc')](_0x76d6('0x13'),_0x5b145f,'request\x20sent');_0xd34b36(_0x1f058a['result'][_0x76d6('0x14')]);}})['catch'](function(_0x55f4e5){logger[_0x76d6('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5b145f,_0x55f4e5);_0x5d8a62(_0x55f4e5);});});}exports[_0x76d6('0x15')]=function(_0x4b6208){var _0x3bdbd4=this;return new Promise(function(_0x199d5d,_0x39af2b){return db[_0x76d6('0x16')][_0x76d6('0x17')](_0x4b6208['body'],{'raw':_0x4b6208[_0x76d6('0x18')]?_0x4b6208['options'][_0x76d6('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xd28623){logger['info'](_0x76d6('0x15'),_0x4b6208);logger[_0x76d6('0xe')](_0x76d6('0x15'),_0x4b6208,JSON[_0x76d6('0x10')](_0xd28623));_0x199d5d(_0xd28623);})['catch'](function(_0x2df911){logger[_0x76d6('0x11')](_0x76d6('0x15'),_0x2df911[_0x76d6('0x14')],_0x4b6208);_0x39af2b(_0x3bdbd4[_0x76d6('0x11')](0x1f4,_0x2df911['message']));});});};exports[_0x76d6('0x1a')]=function(_0xe908ce){var _0x1d1091=this;return new Promise(function(_0x164197,_0x495841){return db['WhatsappQueueReport'][_0x76d6('0x1b')](_0xe908ce[_0x76d6('0x1c')],{'raw':_0xe908ce[_0x76d6('0x18')]?_0xe908ce[_0x76d6('0x18')][_0x76d6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe908ce[_0x76d6('0x18')]?_0xe908ce[_0x76d6('0x18')]['where']||null:null,'attributes':_0xe908ce[_0x76d6('0x18')]?_0xe908ce['options'][_0x76d6('0x1d')]||null:null,'limit':_0xe908ce[_0x76d6('0x18')]?_0xe908ce[_0x76d6('0x18')][_0x76d6('0x1e')]||null:null})[_0x76d6('0xb')](function(_0x5258ee){logger[_0x76d6('0xc')](_0x76d6('0x1a'),_0xe908ce);logger['debug'](_0x76d6('0x1a'),_0xe908ce,JSON[_0x76d6('0x10')](_0x5258ee));_0x164197(_0x5258ee);})['catch'](function(_0x5d9520){logger[_0x76d6('0x11')](_0x76d6('0x1a'),_0x5d9520['message'],_0xe908ce);_0x495841(_0x1d1091[_0x76d6('0x11')](0x1f4,_0x5d9520[_0x76d6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 653a75d..e5221a2 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 _0x6b26=['/describe','describe','show','post','create','put','/:id','update','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6b26,0xda));var _0x66b2=function(_0x579e7a,_0x3a970e){_0x579e7a=_0x579e7a-0x0;var _0x151d75=_0x6b26[_0x579e7a];return _0x151d75;};'use strict';var multer=require('multer');var util=require(_0x66b2('0x0'));var path=require(_0x66b2('0x1'));var timeout=require(_0x66b2('0x2'));var express=require(_0x66b2('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x66b2('0x4'));var interaction=require(_0x66b2('0x5'));var config=require(_0x66b2('0x6'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0x66b2('0x7')](),controller[_0x66b2('0x8')]);router[_0x66b2('0x9')](_0x66b2('0xa'),auth[_0x66b2('0x7')](),controller[_0x66b2('0xb')]);router[_0x66b2('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x66b2('0xc')]);router[_0x66b2('0xd')]('/',auth[_0x66b2('0x7')](),controller[_0x66b2('0xe')]);router[_0x66b2('0xf')](_0x66b2('0x10'),auth[_0x66b2('0x7')](),controller[_0x66b2('0x11')]);router['delete'](_0x66b2('0x10'),auth['isAuthenticated'](),controller[_0x66b2('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc8a3=['./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2fd2d9,_0x5f20a6){var _0x57cb6e=function(_0x4f929c){while(--_0x4f929c){_0x2fd2d9['push'](_0x2fd2d9['shift']());}};_0x57cb6e(++_0x5f20a6);}(_0xc8a3,0x70));var _0x3c8a=function(_0xdc0760,_0x3f8676){_0xdc0760=_0xdc0760-0x0;var _0x448673=_0xc8a3[_0xdc0760];return _0x448673;};'use strict';var multer=require('multer');var util=require(_0x3c8a('0x0'));var path=require(_0x3c8a('0x1'));var timeout=require(_0x3c8a('0x2'));var express=require(_0x3c8a('0x3'));var router=express['Router']();var fs_extra=require(_0x3c8a('0x4'));var auth=require(_0x3c8a('0x5'));var interaction=require(_0x3c8a('0x6'));var config=require(_0x3c8a('0x7'));var controller=require(_0x3c8a('0x8'));router[_0x3c8a('0x9')]('/',auth[_0x3c8a('0xa')](),controller[_0x3c8a('0xb')]);router[_0x3c8a('0x9')](_0x3c8a('0xc'),auth['isAuthenticated'](),controller[_0x3c8a('0xd')]);router[_0x3c8a('0x9')]('/:id',auth[_0x3c8a('0xa')](),controller[_0x3c8a('0xe')]);router['post']('/',auth[_0x3c8a('0xa')](),controller[_0x3c8a('0xf')]);router[_0x3c8a('0x10')](_0x3c8a('0x11'),auth[_0x3c8a('0xa')](),controller[_0x3c8a('0x12')]);router['delete'](_0x3c8a('0x11'),auth[_0x3c8a('0xa')](),controller['destroy']);module[_0x3c8a('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 fcb04dd..bd5a9c3 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 _0x9656=['ENUM','agent','sequelize','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9656,0x15e));var _0x6965=function(_0x4d312f,_0x5e35c7){_0x4d312f=_0x4d312f-0x0;var _0x2f777f=_0x9656[_0x4d312f];return _0x2f777f;};'use strict';var Sequelize=require(_0x6965('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6965('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6965('0x2')]('account',_0x6965('0x3'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xf65d=['ENUM','account','agent','queue','DATE','sequelize','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf65d,0x9f));var _0xdf65=function(_0xd307d9,_0x50e8e0){_0xd307d9=_0xd307d9-0x0;var _0x209bf8=_0xf65d[_0xd307d9];return _0x209bf8;};'use strict';var Sequelize=require(_0xdf65('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xdf65('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xdf65('0x2')](_0xdf65('0x3'),_0xdf65('0x4'),_0xdf65('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xdf65('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 951bbc6..7713f40 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 _0xa7fa=['error','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xaa7f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaa7f('0x1'));var rp=require(_0xaa7f('0x2'));var moment=require(_0xaa7f('0x3'));var BPromise=require(_0xaa7f('0x4'));var Mustache=require('mustache');var util=require(_0xaa7f('0x5'));var path=require(_0xaa7f('0x6'));var sox=require(_0xaa7f('0x7'));var csv=require(_0xaa7f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa7f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa7f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xaa7f('0xb'));var toCsv=require(_0xaa7f('0x8'));var querystring=require(_0xaa7f('0xc'));var Papa=require(_0xaa7f('0xd'));var Redis=require('ioredis');var authService=require(_0xaa7f('0xe'));var qs=require(_0xaa7f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa7f('0x10'));var logger=require(_0xaa7f('0x11'))(_0xaa7f('0x12'));var utils=require(_0xaa7f('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaa7f('0x14'))['db'];function respondWithStatusCode(_0x7e736,_0x2d03f3){_0x2d03f3=_0x2d03f3||0xcc;return function(_0x8c42d8){if(_0x8c42d8){return _0x7e736[_0xaa7f('0x15')](_0x2d03f3);}return _0x7e736[_0xaa7f('0x16')](_0x2d03f3)[_0xaa7f('0x17')]();};}function respondWithResult(_0x347929,_0x992494){_0x992494=_0x992494||0xc8;return function(_0x4dfb46){if(_0x4dfb46){return _0x347929[_0xaa7f('0x16')](_0x992494)['json'](_0x4dfb46);}};}function respondWithFilteredResult(_0x3c1615,_0x6ba90d){return function(_0x470c74){if(_0x470c74){var _0x48844f=typeof _0x6ba90d[_0xaa7f('0x18')]===_0xaa7f('0x19')&&typeof _0x6ba90d[_0xaa7f('0x1a')]===_0xaa7f('0x19');var _0x207aff=_0x470c74[_0xaa7f('0x1b')];var _0x2c17c4=_0x48844f?0x0:_0x6ba90d['offset'];var _0x90863a=_0x48844f?_0x470c74[_0xaa7f('0x1b')]:_0x6ba90d[_0xaa7f('0x18')]+_0x6ba90d[_0xaa7f('0x1a')];var _0x4d1119;if(_0x90863a>=_0x207aff){_0x90863a=_0x207aff;_0x4d1119=0xc8;}else{_0x4d1119=0xce;}_0x3c1615['status'](_0x4d1119);return _0x3c1615[_0xaa7f('0x1c')]('Content-Range',_0x2c17c4+'-'+_0x90863a+'/'+_0x207aff)[_0xaa7f('0x1d')](_0x470c74);}return null;};}function patchUpdates(_0x21e870){return function(_0x4eac0b){try{jsonpatch[_0xaa7f('0x1e')](_0x4eac0b,_0x21e870,!![]);}catch(_0x489b56){return BPromise[_0xaa7f('0x1f')](_0x489b56);}return _0x4eac0b[_0xaa7f('0x20')]();};}function saveUpdates(_0x3e203b,_0x516d7e){return function(_0x1436f7){if(_0x1436f7){return _0x1436f7[_0xaa7f('0x21')](_0x3e203b)[_0xaa7f('0x22')](function(_0x3900df){return _0x3900df;});}return null;};}function removeEntity(_0x55363c,_0x5e3d5e){return function(_0x28d627){if(_0x28d627){return _0x28d627[_0xaa7f('0x23')]()[_0xaa7f('0x22')](function(){_0x55363c[_0xaa7f('0x16')](0xcc)[_0xaa7f('0x17')]();});}};}function handleEntityNotFound(_0x1bd627,_0x4b33d3){return function(_0x5442e2){if(!_0x5442e2){_0x1bd627['sendStatus'](0x194);}return _0x5442e2;};}function handleError(_0x40d7f4,_0x4fb956){_0x4fb956=_0x4fb956||0x1f4;return function(_0xbff8a0){logger[_0xaa7f('0x24')](_0xbff8a0['stack']);if(_0xbff8a0[_0xaa7f('0x25')]){delete _0xbff8a0['name'];}_0x40d7f4[_0xaa7f('0x16')](_0x4fb956)[_0xaa7f('0x26')](_0xbff8a0);};}exports[_0xaa7f('0x27')]=function(_0xfcf172,_0x223321){var _0x4983a3={},_0x1541e1={},_0x3e0223={'count':0x0,'rows':[]};var _0x35034b=_['map'](db[_0xaa7f('0x28')][_0xaa7f('0x29')],function(_0x2b2ce2){return{'name':_0x2b2ce2[_0xaa7f('0x2a')],'type':_0x2b2ce2[_0xaa7f('0x2b')][_0xaa7f('0x2c')]};});_0x1541e1['model']=_[_0xaa7f('0x2d')](_0x35034b,_0xaa7f('0x25'));_0x1541e1['query']=_[_0xaa7f('0x2e')](_0xfcf172[_0xaa7f('0x2f')]);_0x1541e1[_0xaa7f('0x30')]=_[_0xaa7f('0x31')](_0x1541e1[_0xaa7f('0x32')],_0x1541e1[_0xaa7f('0x2f')]);_0x4983a3[_0xaa7f('0x33')]=_[_0xaa7f('0x31')](_0x1541e1[_0xaa7f('0x32')],qs[_0xaa7f('0x34')](_0xfcf172[_0xaa7f('0x2f')][_0xaa7f('0x34')]));_0x4983a3[_0xaa7f('0x33')]=_0x4983a3[_0xaa7f('0x33')][_0xaa7f('0x35')]?_0x4983a3['attributes']:_0x1541e1[_0xaa7f('0x32')];if(!_0xfcf172['query'][_0xaa7f('0x36')](_0xaa7f('0x37'))){_0x4983a3['limit']=qs[_0xaa7f('0x1a')](_0xfcf172[_0xaa7f('0x2f')]['limit']);_0x4983a3[_0xaa7f('0x18')]=qs[_0xaa7f('0x18')](_0xfcf172['query']['offset']);}_0x4983a3[_0xaa7f('0x38')]=qs[_0xaa7f('0x39')](_0xfcf172[_0xaa7f('0x2f')][_0xaa7f('0x39')]);_0x4983a3[_0xaa7f('0x3a')]=qs['filters'](_['pick'](_0xfcf172[_0xaa7f('0x2f')],_0x1541e1[_0xaa7f('0x30')]),_0x35034b);if(_0xfcf172[_0xaa7f('0x2f')][_0xaa7f('0x3b')]){_0x4983a3[_0xaa7f('0x3a')]=_[_0xaa7f('0x3c')](_0x4983a3[_0xaa7f('0x3a')],{'$or':_['map'](_0x35034b,function(_0x384555){if(_0x384555[_0xaa7f('0x2b')]!==_0xaa7f('0x3d')){var _0x109084={};_0x109084[_0x384555[_0xaa7f('0x25')]]={'$like':'%'+_0xfcf172[_0xaa7f('0x2f')][_0xaa7f('0x3b')]+'%'};return _0x109084;}})});}_0x4983a3=_[_0xaa7f('0x3c')]({},_0x4983a3,_0xfcf172[_0xaa7f('0x3e')]);var _0x2ad879={'where':_0x4983a3[_0xaa7f('0x3a')]};return db[_0xaa7f('0x28')][_0xaa7f('0x1b')](_0x2ad879)[_0xaa7f('0x22')](function(_0x47a079){_0x3e0223[_0xaa7f('0x1b')]=_0x47a079;if(_0xfcf172[_0xaa7f('0x2f')][_0xaa7f('0x3f')]){_0x4983a3[_0xaa7f('0x40')]=[{'all':!![]}];}return db[_0xaa7f('0x28')][_0xaa7f('0x41')](_0x4983a3);})[_0xaa7f('0x22')](function(_0x3713d5){_0x3e0223['rows']=_0x3713d5;return _0x3e0223;})[_0xaa7f('0x22')](respondWithFilteredResult(_0x223321,_0x4983a3))[_0xaa7f('0x42')](handleError(_0x223321,null));};exports[_0xaa7f('0x43')]=function(_0x243d40,_0x4bc35e){var _0x4cf01c={'raw':!![],'where':{'id':_0x243d40['params']['id']}},_0x132cee={};_0x132cee['model']=_['keys'](db['WhatsappTransferReport'][_0xaa7f('0x29')]);_0x132cee[_0xaa7f('0x2f')]=_[_0xaa7f('0x2e')](_0x243d40[_0xaa7f('0x2f')]);_0x132cee[_0xaa7f('0x30')]=_[_0xaa7f('0x31')](_0x132cee[_0xaa7f('0x32')],_0x132cee[_0xaa7f('0x2f')]);_0x4cf01c['attributes']=_[_0xaa7f('0x31')](_0x132cee['model'],qs['fields'](_0x243d40['query'][_0xaa7f('0x34')]));_0x4cf01c[_0xaa7f('0x33')]=_0x4cf01c[_0xaa7f('0x33')][_0xaa7f('0x35')]?_0x4cf01c[_0xaa7f('0x33')]:_0x132cee['model'];if(_0x243d40[_0xaa7f('0x2f')][_0xaa7f('0x3f')]){_0x4cf01c[_0xaa7f('0x40')]=[{'all':!![]}];}_0x4cf01c=_['merge']({},_0x4cf01c,_0x243d40[_0xaa7f('0x3e')]);return db[_0xaa7f('0x28')][_0xaa7f('0x44')](_0x4cf01c)['then'](handleEntityNotFound(_0x4bc35e,null))[_0xaa7f('0x22')](respondWithResult(_0x4bc35e,null))[_0xaa7f('0x42')](handleError(_0x4bc35e,null));};exports[_0xaa7f('0x45')]=function(_0x35566c,_0x12b9b2){return db['WhatsappTransferReport'][_0xaa7f('0x45')](_0x35566c[_0xaa7f('0x46')],{})['then'](respondWithResult(_0x12b9b2,0xc9))[_0xaa7f('0x42')](handleError(_0x12b9b2,null));};exports[_0xaa7f('0x21')]=function(_0x38313f,_0x406f7f){if(_0x38313f[_0xaa7f('0x46')]['id']){delete _0x38313f[_0xaa7f('0x46')]['id'];}return db[_0xaa7f('0x28')][_0xaa7f('0x44')]({'where':{'id':_0x38313f['params']['id']}})['then'](handleEntityNotFound(_0x406f7f,null))[_0xaa7f('0x22')](saveUpdates(_0x38313f[_0xaa7f('0x46')],null))[_0xaa7f('0x22')](respondWithResult(_0x406f7f,null))[_0xaa7f('0x42')](handleError(_0x406f7f,null));};exports[_0xaa7f('0x23')]=function(_0x515619,_0x495949){return db['WhatsappTransferReport'][_0xaa7f('0x44')]({'where':{'id':_0x515619['params']['id']}})['then'](handleEntityNotFound(_0x495949,null))[_0xaa7f('0x22')](removeEntity(_0x495949,null))[_0xaa7f('0x42')](handleError(_0x495949,null));};exports[_0xaa7f('0x47')]=function(_0x4ef547,_0x1f3c28){return db[_0xaa7f('0x28')][_0xaa7f('0x47')]()[_0xaa7f('0x22')](respondWithResult(_0x1f3c28,null))[_0xaa7f('0x42')](handleError(_0x1f3c28,null));}; \ No newline at end of file +var _0x1ce6=['fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','filter','options','includeAll','include','findAll','rows','params','keys','find','create','body','catch','update','describe','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/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','destroy','then','end','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes'];(function(_0x226f71,_0x549cf7){var _0x186f9f=function(_0x3a4168){while(--_0x3a4168){_0x226f71['push'](_0x226f71['shift']());}};_0x186f9f(++_0x549cf7);}(_0x1ce6,0x6f));var _0x61ce=function(_0x4e0016,_0x24b199){_0x4e0016=_0x4e0016-0x0;var _0x406390=_0x1ce6[_0x4e0016];return _0x406390;};'use strict';var emlformat=require(_0x61ce('0x0'));var rimraf=require(_0x61ce('0x1'));var zipdir=require(_0x61ce('0x2'));var jsonpatch=require(_0x61ce('0x3'));var rp=require(_0x61ce('0x4'));var moment=require(_0x61ce('0x5'));var BPromise=require(_0x61ce('0x6'));var Mustache=require(_0x61ce('0x7'));var util=require(_0x61ce('0x8'));var path=require(_0x61ce('0x9'));var sox=require('sox');var csv=require(_0x61ce('0xa'));var ejs=require(_0x61ce('0xb'));var fs=require('fs');var fs_extra=require(_0x61ce('0xc'));var _=require(_0x61ce('0xd'));var squel=require(_0x61ce('0xe'));var crypto=require(_0x61ce('0xf'));var jsforce=require(_0x61ce('0x10'));var deskjs=require(_0x61ce('0x11'));var toCsv=require(_0x61ce('0xa'));var querystring=require('querystring');var Papa=require(_0x61ce('0x12'));var Redis=require(_0x61ce('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x61ce('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x61ce('0x15'))(_0x61ce('0x16'));var utils=require(_0x61ce('0x17'));var config=require(_0x61ce('0x18'));var licenseUtil=require(_0x61ce('0x19'));var db=require(_0x61ce('0x1a'))['db'];function respondWithStatusCode(_0x5a011f,_0x1437f4){_0x1437f4=_0x1437f4||0xcc;return function(_0x161337){if(_0x161337){return _0x5a011f[_0x61ce('0x1b')](_0x1437f4);}return _0x5a011f[_0x61ce('0x1c')](_0x1437f4)['end']();};}function respondWithResult(_0x3db79b,_0x5c1a7e){_0x5c1a7e=_0x5c1a7e||0xc8;return function(_0x2cbf0f){if(_0x2cbf0f){return _0x3db79b[_0x61ce('0x1c')](_0x5c1a7e)[_0x61ce('0x1d')](_0x2cbf0f);}};}function respondWithFilteredResult(_0x12a962,_0x524130){return function(_0x5e2ae5){if(_0x5e2ae5){var _0x32336a=typeof _0x524130['offset']===_0x61ce('0x1e')&&typeof _0x524130[_0x61ce('0x1f')]===_0x61ce('0x1e');var _0x2b184d=_0x5e2ae5[_0x61ce('0x20')];var _0xe3126f=_0x32336a?0x0:_0x524130[_0x61ce('0x21')];var _0x4127fd=_0x32336a?_0x5e2ae5[_0x61ce('0x20')]:_0x524130[_0x61ce('0x21')]+_0x524130[_0x61ce('0x1f')];var _0x3c7bb5;if(_0x4127fd>=_0x2b184d){_0x4127fd=_0x2b184d;_0x3c7bb5=0xc8;}else{_0x3c7bb5=0xce;}_0x12a962[_0x61ce('0x1c')](_0x3c7bb5);return _0x12a962[_0x61ce('0x22')](_0x61ce('0x23'),_0xe3126f+'-'+_0x4127fd+'/'+_0x2b184d)[_0x61ce('0x1d')](_0x5e2ae5);}return null;};}function patchUpdates(_0x2ba850){return function(_0x39bd91){try{jsonpatch[_0x61ce('0x24')](_0x39bd91,_0x2ba850,!![]);}catch(_0x16c121){return BPromise[_0x61ce('0x25')](_0x16c121);}return _0x39bd91['save']();};}function saveUpdates(_0xd08171,_0x1f44c2){return function(_0x20c1f4){if(_0x20c1f4){return _0x20c1f4['update'](_0xd08171)['then'](function(_0xabf46f){return _0xabf46f;});}return null;};}function removeEntity(_0x237cd0,_0x195bc7){return function(_0x3da1c1){if(_0x3da1c1){return _0x3da1c1[_0x61ce('0x26')]()[_0x61ce('0x27')](function(){_0x237cd0['status'](0xcc)[_0x61ce('0x28')]();});}};}function handleEntityNotFound(_0x39a1e0,_0x429a5e){return function(_0x34af1a){if(!_0x34af1a){_0x39a1e0['sendStatus'](0x194);}return _0x34af1a;};}function handleError(_0x3211ef,_0x19c5ff){_0x19c5ff=_0x19c5ff||0x1f4;return function(_0xb69270){logger[_0x61ce('0x29')](_0xb69270[_0x61ce('0x2a')]);if(_0xb69270['name']){delete _0xb69270[_0x61ce('0x2b')];}_0x3211ef[_0x61ce('0x1c')](_0x19c5ff)[_0x61ce('0x2c')](_0xb69270);};}exports[_0x61ce('0x2d')]=function(_0x150aa7,_0x561180){var _0x5a46d1={},_0x2b05ef={},_0x176d94={'count':0x0,'rows':[]};var _0x4bd718=_[_0x61ce('0x2e')](db[_0x61ce('0x2f')][_0x61ce('0x30')],function(_0x141790){return{'name':_0x141790[_0x61ce('0x31')],'type':_0x141790[_0x61ce('0x32')][_0x61ce('0x33')]};});_0x2b05ef[_0x61ce('0x34')]=_['map'](_0x4bd718,_0x61ce('0x2b'));_0x2b05ef[_0x61ce('0x35')]=_['keys'](_0x150aa7[_0x61ce('0x35')]);_0x2b05ef['filters']=_['intersection'](_0x2b05ef[_0x61ce('0x34')],_0x2b05ef[_0x61ce('0x35')]);_0x5a46d1[_0x61ce('0x36')]=_[_0x61ce('0x37')](_0x2b05ef[_0x61ce('0x34')],qs[_0x61ce('0x38')](_0x150aa7[_0x61ce('0x35')][_0x61ce('0x38')]));_0x5a46d1['attributes']=_0x5a46d1[_0x61ce('0x36')][_0x61ce('0x39')]?_0x5a46d1[_0x61ce('0x36')]:_0x2b05ef[_0x61ce('0x34')];if(!_0x150aa7[_0x61ce('0x35')][_0x61ce('0x3a')](_0x61ce('0x3b'))){_0x5a46d1['limit']=qs[_0x61ce('0x1f')](_0x150aa7[_0x61ce('0x35')]['limit']);_0x5a46d1[_0x61ce('0x21')]=qs[_0x61ce('0x21')](_0x150aa7['query']['offset']);}_0x5a46d1[_0x61ce('0x3c')]=qs[_0x61ce('0x3d')](_0x150aa7[_0x61ce('0x35')][_0x61ce('0x3d')]);_0x5a46d1['where']=qs[_0x61ce('0x3e')](_[_0x61ce('0x3f')](_0x150aa7['query'],_0x2b05ef[_0x61ce('0x3e')]),_0x4bd718);if(_0x150aa7[_0x61ce('0x35')]['filter']){_0x5a46d1['where']=_[_0x61ce('0x40')](_0x5a46d1[_0x61ce('0x41')],{'$or':_['map'](_0x4bd718,function(_0x5aa7d4){if(_0x5aa7d4['type']!=='VIRTUAL'){var _0x4fa3c2={};_0x4fa3c2[_0x5aa7d4['name']]={'$like':'%'+_0x150aa7['query'][_0x61ce('0x42')]+'%'};return _0x4fa3c2;}})});}_0x5a46d1=_[_0x61ce('0x40')]({},_0x5a46d1,_0x150aa7[_0x61ce('0x43')]);var _0x53022d={'where':_0x5a46d1[_0x61ce('0x41')]};return db['WhatsappTransferReport']['count'](_0x53022d)[_0x61ce('0x27')](function(_0x21fb25){_0x176d94['count']=_0x21fb25;if(_0x150aa7[_0x61ce('0x35')][_0x61ce('0x44')]){_0x5a46d1[_0x61ce('0x45')]=[{'all':!![]}];}return db[_0x61ce('0x2f')][_0x61ce('0x46')](_0x5a46d1);})[_0x61ce('0x27')](function(_0x359bf2){_0x176d94[_0x61ce('0x47')]=_0x359bf2;return _0x176d94;})[_0x61ce('0x27')](respondWithFilteredResult(_0x561180,_0x5a46d1))['catch'](handleError(_0x561180,null));};exports['show']=function(_0x47fa62,_0x8d016a){var _0x5a1658={'raw':!![],'where':{'id':_0x47fa62[_0x61ce('0x48')]['id']}},_0x66638={};_0x66638[_0x61ce('0x34')]=_[_0x61ce('0x49')](db['WhatsappTransferReport'][_0x61ce('0x30')]);_0x66638[_0x61ce('0x35')]=_[_0x61ce('0x49')](_0x47fa62[_0x61ce('0x35')]);_0x66638[_0x61ce('0x3e')]=_[_0x61ce('0x37')](_0x66638[_0x61ce('0x34')],_0x66638[_0x61ce('0x35')]);_0x5a1658[_0x61ce('0x36')]=_[_0x61ce('0x37')](_0x66638['model'],qs[_0x61ce('0x38')](_0x47fa62[_0x61ce('0x35')][_0x61ce('0x38')]));_0x5a1658['attributes']=_0x5a1658[_0x61ce('0x36')][_0x61ce('0x39')]?_0x5a1658[_0x61ce('0x36')]:_0x66638[_0x61ce('0x34')];if(_0x47fa62[_0x61ce('0x35')][_0x61ce('0x44')]){_0x5a1658[_0x61ce('0x45')]=[{'all':!![]}];}_0x5a1658=_['merge']({},_0x5a1658,_0x47fa62['options']);return db[_0x61ce('0x2f')][_0x61ce('0x4a')](_0x5a1658)[_0x61ce('0x27')](handleEntityNotFound(_0x8d016a,null))[_0x61ce('0x27')](respondWithResult(_0x8d016a,null))['catch'](handleError(_0x8d016a,null));};exports[_0x61ce('0x4b')]=function(_0x208290,_0x419005){return db['WhatsappTransferReport'][_0x61ce('0x4b')](_0x208290[_0x61ce('0x4c')],{})[_0x61ce('0x27')](respondWithResult(_0x419005,0xc9))[_0x61ce('0x4d')](handleError(_0x419005,null));};exports[_0x61ce('0x4e')]=function(_0x352cf6,_0x24af70){if(_0x352cf6[_0x61ce('0x4c')]['id']){delete _0x352cf6[_0x61ce('0x4c')]['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x352cf6['params']['id']}})[_0x61ce('0x27')](handleEntityNotFound(_0x24af70,null))[_0x61ce('0x27')](saveUpdates(_0x352cf6[_0x61ce('0x4c')],null))[_0x61ce('0x27')](respondWithResult(_0x24af70,null))[_0x61ce('0x4d')](handleError(_0x24af70,null));};exports[_0x61ce('0x26')]=function(_0x5a517d,_0x454ab4){return db[_0x61ce('0x2f')]['find']({'where':{'id':_0x5a517d['params']['id']}})[_0x61ce('0x27')](handleEntityNotFound(_0x454ab4,null))[_0x61ce('0x27')](removeEntity(_0x454ab4,null))[_0x61ce('0x4d')](handleError(_0x454ab4,null));};exports[_0x61ce('0x4f')]=function(_0x33dc46,_0x34d10b){return db[_0x61ce('0x2f')][_0x61ce('0x4f')]()[_0x61ce('0x27')](respondWithResult(_0x34d10b,null))['catch'](handleError(_0x34d10b,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index edbe28a..614102f 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 _0xcebb=['uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x1c7889,_0x24cd26){var _0x2f14e5=function(_0x9ae1b1){while(--_0x9ae1b1){_0x1c7889['push'](_0x1c7889['shift']());}};_0x2f14e5(++_0x24cd26);}(_0xcebb,0x1c9));var _0xbceb=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xcebb[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0xbceb('0x0'));var util=require(_0xbceb('0x1'));var logger=require('../../config/logger')(_0xbceb('0x2'));var moment=require(_0xbceb('0x3'));var BPromise=require(_0xbceb('0x4'));var rp=require(_0xbceb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbceb('0x6'));var config=require('../../config/environment');var attributes=require(_0xbceb('0x7'));module['exports']=function(_0xeae7df,_0x4e1be6){return _0xeae7df[_0xbceb('0x8')](_0xbceb('0x9'),attributes,{'tableName':_0xbceb('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbceb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x953e=['uniqueid','lodash','../../config/logger','api','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x27f89b,_0x87a619){var _0x486c6f=function(_0x3258e1){while(--_0x3258e1){_0x27f89b['push'](_0x27f89b['shift']());}};_0x486c6f(++_0x87a619);}(_0x953e,0x156));var _0xe953=function(_0x3e3f6a,_0x3e4153){_0x3e3f6a=_0x3e3f6a-0x0;var _0x5528c4=_0x953e[_0x3e3f6a];return _0x5528c4;};'use strict';var _=require(_0xe953('0x0'));var util=require('util');var logger=require(_0xe953('0x1'))(_0xe953('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe953('0x3'));var fs=require('fs');var path=require(_0xe953('0x4'));var rimraf=require('rimraf');var config=require(_0xe953('0x5'));var attributes=require(_0xe953('0x6'));module['exports']=function(_0x537dd6,_0x530cb5){return _0x537dd6[_0xe953('0x7')](_0xe953('0x8'),attributes,{'tableName':_0xe953('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe953('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 f94558c..500fc44 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 _0xf8bd=['request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','WhatsappTransferReport,\x20%s,\x20%s'];(function(_0xd73d53,_0x598443){var _0x560148=function(_0x3c8918){while(--_0x3c8918){_0xd73d53['push'](_0xd73d53['shift']());}};_0x560148(++_0x598443);}(_0xf8bd,0x197));var _0xdf8b=function(_0x3dcab,_0x58860f){_0x3dcab=_0x3dcab-0x0;var _0x517c6a=_0xf8bd[_0x3dcab];return _0x517c6a;};'use strict';var _=require(_0xdf8b('0x0'));var util=require(_0xdf8b('0x1'));var moment=require(_0xdf8b('0x2'));var BPromise=require(_0xdf8b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf8b('0x4'))['db'];var utils=require(_0xdf8b('0x5'));var logger=require('../../config/logger')(_0xdf8b('0x6'));var config=require(_0xdf8b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdf8b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5143a1,_0x389186,_0x6abf4){return new BPromise(function(_0x1f4810,_0x5448a0){return client[_0xdf8b('0x9')](_0x5143a1,_0x6abf4)[_0xdf8b('0xa')](function(_0x2d7489){logger[_0xdf8b('0xb')](_0xdf8b('0xc'),_0x389186,_0xdf8b('0xd'));logger['debug'](_0xdf8b('0xe'),_0x389186,_0xdf8b('0xd'),JSON[_0xdf8b('0xf')](_0x2d7489));if(_0x2d7489[_0xdf8b('0x10')]){if(_0x2d7489['error'][_0xdf8b('0x11')]===0x1f4){logger[_0xdf8b('0x10')](_0xdf8b('0xc'),_0x389186,_0x2d7489['error']['message']);return _0x5448a0(_0x2d7489[_0xdf8b('0x10')][_0xdf8b('0x12')]);}logger[_0xdf8b('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x389186,_0x2d7489[_0xdf8b('0x10')][_0xdf8b('0x12')]);return _0x1f4810(_0x2d7489[_0xdf8b('0x10')][_0xdf8b('0x12')]);}else{logger[_0xdf8b('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x389186,_0xdf8b('0xd'));_0x1f4810(_0x2d7489[_0xdf8b('0x13')][_0xdf8b('0x12')]);}})[_0xdf8b('0x14')](function(_0x26ff95){logger[_0xdf8b('0x10')](_0xdf8b('0xc'),_0x389186,_0x26ff95);_0x5448a0(_0x26ff95);});});} \ No newline at end of file +var _0x992d=['request','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','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2df8cc,_0x28d78a){var _0x22405c=function(_0x2758e5){while(--_0x2758e5){_0x2df8cc['push'](_0x2df8cc['shift']());}};_0x22405c(++_0x28d78a);}(_0x992d,0x11b));var _0xd992=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x992d[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xd992('0x0'));var util=require(_0xd992('0x1'));var moment=require(_0xd992('0x2'));var BPromise=require(_0xd992('0x3'));var rs=require(_0xd992('0x4'));var fs=require('fs');var Redis=require(_0xd992('0x5'));var db=require(_0xd992('0x6'))['db'];var utils=require(_0xd992('0x7'));var logger=require(_0xd992('0x8'))(_0xd992('0x9'));var config=require(_0xd992('0xa'));var jayson=require(_0xd992('0xb'));var client=jayson[_0xd992('0xc')][_0xd992('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5d31e4,_0x29679e,_0x3f483f){return new BPromise(function(_0xad54e9,_0x10da2a){return client[_0xd992('0xe')](_0x5d31e4,_0x3f483f)[_0xd992('0xf')](function(_0x2aaaea){logger[_0xd992('0x10')](_0xd992('0x11'),_0x29679e,_0xd992('0x12'));logger[_0xd992('0x13')](_0xd992('0x14'),_0x29679e,_0xd992('0x12'),JSON[_0xd992('0x15')](_0x2aaaea));if(_0x2aaaea[_0xd992('0x16')]){if(_0x2aaaea['error'][_0xd992('0x17')]===0x1f4){logger[_0xd992('0x16')](_0xd992('0x11'),_0x29679e,_0x2aaaea[_0xd992('0x16')][_0xd992('0x18')]);return _0x10da2a(_0x2aaaea[_0xd992('0x16')][_0xd992('0x18')]);}logger['error'](_0xd992('0x11'),_0x29679e,_0x2aaaea[_0xd992('0x16')]['message']);return _0xad54e9(_0x2aaaea[_0xd992('0x16')][_0xd992('0x18')]);}else{logger['info'](_0xd992('0x11'),_0x29679e,_0xd992('0x12'));_0xad54e9(_0x2aaaea[_0xd992('0x19')][_0xd992('0x18')]);}})[_0xd992('0x1a')](function(_0x56ca39){logger[_0xd992('0x16')](_0xd992('0x11'),_0x29679e,_0x56ca39);_0x10da2a(_0x56ca39);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 670c06e..bc34866 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd8f=['./config/schedule/cloud-provider','sequelize','sync','seedDB','default','then','listen','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','Offline\x20apps:','join','None','App\x20Ready!','catch','log','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe'];(function(_0x2814e8,_0x251be1){var _0x5d1183=function(_0x30c44d){while(--_0x30c44d){_0x2814e8['push'](_0x2814e8['shift']());}};_0x5d1183(++_0x251be1);}(_0xfd8f,0xae));var _0xffd8=function(_0x1d3ade,_0x44bbfb){_0x1d3ade=_0x1d3ade-0x0;var _0x1a47c6=_0xfd8f[_0x1d3ade];return _0x1a47c6;};'use strict';var _=require(_0xffd8('0x0'));var db=require(_0xffd8('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xffd8('0x2'));var rpc=require(_0xffd8('0x3'));var config=require(_0xffd8('0x4'));var logger=require(_0xffd8('0x5'))('app');var pm2=require(_0xffd8('0x6'));var pm2Config=require(_0xffd8('0x7'));var schedule=require('./config/schedule');var chat=require(_0xffd8('0x8'));var whatsapp=require(_0xffd8('0x9'));var transcribe=require(_0xffd8('0xa'));var provider=require(_0xffd8('0xb'));function main(){return db[_0xffd8('0xc')][_0xffd8('0xd')]()['then'](function(){if(config[_0xffd8('0xe')]){return seedDb[_0xffd8('0xf')]();}})[_0xffd8('0x10')](function(){return checkLicense[_0xffd8('0xf')]();})['then'](function(){return rpc[_0xffd8('0x11')]();})[_0xffd8('0x10')](function(_0x2b552b){logger[_0xffd8('0x12')](_0x2b552b);return chat[_0xffd8('0x13')]();})[_0xffd8('0x10')](function(){return whatsapp[_0xffd8('0x13')]();})[_0xffd8('0x10')](function(){return schedule[_0xffd8('0x13')]();})['then'](function(){return transcribe['start']();})['then'](function(){return provider[_0xffd8('0x13')]();})[_0xffd8('0x10')](function(_0x29499a){logger[_0xffd8('0x12')](_0x29499a);return pm2[_0xffd8('0x13')](pm2Config);})['then'](function(_0x36f48a){var _0x1c6104=_0x36f48a[_0xffd8('0x14')](function(_0x31739f){return typeof _0x31739f[_0xffd8('0x15')]==='number'&&_0x31739f[_0xffd8('0x15')]>=0x0;});if(_0x1c6104[_0xffd8('0x16')]>0x0){throw new Error(_0x1c6104['length']+_0xffd8('0x17')+_[_0xffd8('0x18')](_0x1c6104,function(_0x6b035f){return'\x22'+_0x6b035f[_0xffd8('0x19')][_0xffd8('0x1a')]+'\x22';}));}logger[_0xffd8('0x12')]('Online\x20apps:',_[_0xffd8('0x18')](_[_0xffd8('0x14')](_0x36f48a,{'status':_0xffd8('0x1b')}),'name')['join']());logger[_0xffd8('0x12')](_0xffd8('0x1c'),_[_0xffd8('0x18')](_['filter'](_0x36f48a,function(_0x4ca566){return _0x4ca566['status']!==_0xffd8('0x1b');}),_0xffd8('0x1a'))[_0xffd8('0x1d')]()||_0xffd8('0x1e'));console['log'](_0xffd8('0x1f'));})[_0xffd8('0x20')](function(_0x450a96){console[_0xffd8('0x21')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x450a96);logger[_0xffd8('0x22')](_0xffd8('0x23'),_0x450a96);process[_0xffd8('0x24')](0x1);});}main(); \ No newline at end of file +var _0x1354=['catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','default','listen','info','start','filter','number','exitCode','\x20processes\x20failed\x20at\x20startup:\x20','map','online','name','join','Offline\x20apps:','status','None','log'];(function(_0x26aee5,_0x3d18ea){var _0x5ab716=function(_0x3cce5d){while(--_0x3cce5d){_0x26aee5['push'](_0x26aee5['shift']());}};_0x5ab716(++_0x3d18ea);}(_0x1354,0x95));var _0x4135=function(_0x3c62ab,_0x33f23d){_0x3c62ab=_0x3c62ab-0x0;var _0x536970=_0x1354[_0x3c62ab];return _0x536970;};'use strict';var _=require(_0x4135('0x0'));var db=require(_0x4135('0x1'))['db'];var seedDb=require(_0x4135('0x2'));var checkLicense=require(_0x4135('0x3'));var rpc=require(_0x4135('0x4'));var config=require(_0x4135('0x5'));var logger=require(_0x4135('0x6'))('app');var pm2=require(_0x4135('0x7'));var pm2Config=require(_0x4135('0x8'));var schedule=require(_0x4135('0x9'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x4135('0xa'));var transcribe=require(_0x4135('0xb'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x4135('0xc')][_0x4135('0xd')]()[_0x4135('0xe')](function(){if(config['seedDB']){return seedDb[_0x4135('0xf')]();}})['then'](function(){return checkLicense[_0x4135('0xf')]();})[_0x4135('0xe')](function(){return rpc[_0x4135('0x10')]();})[_0x4135('0xe')](function(_0x5dd78a){logger[_0x4135('0x11')](_0x5dd78a);return chat['start']();})['then'](function(){return whatsapp[_0x4135('0x12')]();})[_0x4135('0xe')](function(){return schedule[_0x4135('0x12')]();})['then'](function(){return transcribe[_0x4135('0x12')]();})[_0x4135('0xe')](function(){return provider[_0x4135('0x12')]();})[_0x4135('0xe')](function(_0x3731e8){logger[_0x4135('0x11')](_0x3731e8);return pm2['start'](pm2Config);})['then'](function(_0x249c86){var _0x3c90cf=_0x249c86[_0x4135('0x13')](function(_0x17179a){return typeof _0x17179a['exitCode']===_0x4135('0x14')&&_0x17179a[_0x4135('0x15')]>=0x0;});if(_0x3c90cf['length']>0x0){throw new Error(_0x3c90cf['length']+_0x4135('0x16')+_['map'](_0x3c90cf,function(_0x2f2600){return'\x22'+_0x2f2600['pm2_env']['name']+'\x22';}));}logger['info']('Online\x20apps:',_[_0x4135('0x17')](_['filter'](_0x249c86,{'status':_0x4135('0x18')}),_0x4135('0x19'))[_0x4135('0x1a')]());logger['info'](_0x4135('0x1b'),_[_0x4135('0x17')](_[_0x4135('0x13')](_0x249c86,function(_0x485395){return _0x485395[_0x4135('0x1c')]!=='online';}),_0x4135('0x19'))[_0x4135('0x1a')]()||_0x4135('0x1d'));console[_0x4135('0x1e')]('App\x20Ready!');})[_0x4135('0x1f')](function(_0x126527){console[_0x4135('0x1e')](_0x4135('0x20'),_0x126527);logger[_0x4135('0x21')](_0x4135('0x22'),_0x126527);process[_0x4135('0x23')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 11cdd88..2f5e9a9 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 _0x8de3=['query','forceDownload','status','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','startsWith','authorization','Basic','User','find','authenticate','pass','Wrong\x20credentials.','Unknown\x20authorization\x20format','getUuid','apikey','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isMiddleware','signToken','motion.token','redirect','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','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','encryptString','promisify','sign','secret','payload','options','verify','randomBytes','toString','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','util','moment','secrets','session','role','fullname','name','userpic','mailPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then'];(function(_0x3dea6e,_0x8a6a5f){var _0x38d7c8=function(_0x2203b2){while(--_0x2203b2){_0x3dea6e['push'](_0x3dea6e['shift']());}};_0x38d7c8(++_0x8a6a5f);}(_0x8de3,0x1d4));var _0x38de=function(_0x326a44,_0x41c393){_0x326a44=_0x326a44-0x0;var _0x218e10=_0x8de3[_0x326a44];return _0x218e10;};'use strict';var db=require(_0x38de('0x0'))['db'];var config=require(_0x38de('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x38de('0x2'));var encryptor=require('../encryptor');var _=require(_0x38de('0x3'));var jwt=require(_0x38de('0x4'));var expressJwt=require(_0x38de('0x5'));var compose=require(_0x38de('0x6'));var basicAuth=require(_0x38de('0x7'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x38de('0x8'));var moment=require(_0x38de('0x9'));var validateJwt=expressJwt({'secret':config[_0x38de('0xa')][_0x38de('0xb')]});var userAttributes=['id',_0x38de('0xc'),_0x38de('0xd'),_0x38de('0xe'),'internal','email',_0x38de('0xf'),'permissions','md5secret','voicePause','chatPause',_0x38de('0x10'),'faxPause',_0x38de('0x11'),_0x38de('0x12'),'pauseType',_0x38de('0x13'),_0x38de('0x14'),_0x38de('0x15'),_0x38de('0x16'),_0x38de('0x17'),_0x38de('0x18'),'alias',_0x38de('0x19'),_0x38de('0x1a'),_0x38de('0x1b'),'phoneBarEnableRecording',_0x38de('0x1c'),_0x38de('0x1d'),_0x38de('0x1e'),_0x38de('0x1f'),'phoneBarRemoteControl',_0x38de('0x20'),_0x38de('0x21'),_0x38de('0x22'),_0x38de('0x23'),_0x38de('0x24'),_0x38de('0x25'),'wssPort',_0x38de('0x26'),'downloadOmnichannelInteractions',_0x38de('0x27'),_0x38de('0x28'),_0x38de('0x29'),'chatAutoanswer','chatAutoanswerDelay','emailAutoanswer',_0x38de('0x2a'),_0x38de('0x2b'),_0x38de('0x2c'),_0x38de('0x2d'),'openchannelAutoanswerDelay',_0x38de('0x2e'),_0x38de('0x2f'),_0x38de('0x30'),_0x38de('0x31'),_0x38de('0x32')];exports[_0x38de('0x33')]=function(){return this['isAuthenticated'](!![])[_0x38de('0x34')](function(_0x22faf5,_0x2d149f,_0x4fbaca){if(_0x22faf5[_0x38de('0x35')]){_0x4fbaca();}else{return db[_0x38de('0x36')][_0x38de('0x37')]({'where':{'id':_0x22faf5[_0x38de('0x38')]['id']},'attributes':['id',_0x38de('0x39'),_0x38de('0x3a')],'raw':!![]})[_0x38de('0x3b')](function(_0x47efd9){if(_0x47efd9&&_0x47efd9['closed']&&!_0x22faf5[_0x38de('0x3c')][_0x38de('0x3d')]){return _0x2d149f[_0x38de('0x3e')](_0x47efd9[_0x38de('0x3a')]===_0x38de('0x3f')?0x195:0x193)[_0x38de('0x40')]({'message':_0x47efd9[_0x38de('0x3a')]===_0x38de('0x3f')?_0x38de('0x41'):_0x38de('0x42')});}else{_0x4fbaca();}})[_0x38de('0x43')](function(_0x49519a){_0x4fbaca(_0x49519a);});}});};exports[_0x38de('0x44')]=function isAuthenticated(_0x35af03){return compose()['use'](function(_0x477779,_0x167bea,_0x38fe71){var _0x16be8a;if(_0x477779[_0x38de('0x45')]['authorization']){if(_[_0x38de('0x46')](_0x477779[_0x38de('0x45')][_0x38de('0x47')],_0x38de('0x48'))){var _0x50df5b=basicAuth(_0x477779);db[_0x38de('0x49')][_0x38de('0x4a')]({'where':{'name':_0x50df5b['name']}})[_0x38de('0x3b')](function(_0x3d8cb4){if(!_0x3d8cb4||!_0x3d8cb4[_0x38de('0x4b')](_0x50df5b[_0x38de('0x4c')])){return _0x167bea['status'](0x191)['json']({'message':_0x38de('0x4d')});}_0x477779['user']={'id':_0x3d8cb4['id']};_0x38fe71();})[_0x38de('0x43')](function(_0x5b096d){_0x38fe71(_0x5b096d);});}else if(_[_0x38de('0x46')](_0x477779[_0x38de('0x45')][_0x38de('0x47')],'Bearer')){validateJwt(_0x477779,_0x167bea,_0x38fe71);}else{if(_0x35af03){_0x38fe71();}else{return _0x167bea[_0x38de('0x3e')](0x193)['json']({'message':_0x38de('0x4e')});}}}else if(_0x477779[_0x38de('0x3c')]['apikey']){try{var _0x273dda={'audience':hardwareConf[_0x38de('0x4f')](),'issuer':hardwareConf[_0x38de('0x4f')]()};verifyJwt(_0x477779[_0x38de('0x3c')][_0x38de('0x50')],_0x273dda)[_0x38de('0x3b')](function(_0x931de){return db['User'][_0x38de('0x4a')]({'where':{'id':_0x931de[_0x38de('0x51')]}})[_0x38de('0x3b')](function(_0x117068){_0x16be8a=_0x117068;return db[_0x38de('0x52')][_0x38de('0x37')]({'where':{'id':0x1},'attributes':[_0x38de('0x53'),_0x38de('0x54')],'raw':!![]});})[_0x38de('0x3b')](function(_0x1b85f6){if(!_0x16be8a||!_[_0x38de('0x55')](_0x16be8a['apiKeyNonce'],_0x931de['nonce'])){return _0x167bea[_0x38de('0x3e')](0x191)['json']({'message':_0x38de('0x56')});}if(_0x16be8a[_0x38de('0x57')]){return _0x167bea['status'](0x191)[_0x38de('0x40')]({'message':_0x38de('0x58')});}if(_0x16be8a['blocked']){if(_0x1b85f6['blockDuration']>0x0){if(moment(_0x16be8a[_0x38de('0x59')])[_0x38de('0x5a')](_0x1b85f6[_0x38de('0x54')],_0x38de('0x5b'))>moment()){return _0x167bea[_0x38de('0x3e')](0x191)[_0x38de('0x40')]({'message':_0x38de('0x58')});}}else{return _0x167bea[_0x38de('0x3e')](0x191)[_0x38de('0x40')]({'message':_0x38de('0x58')});}}_0x477779[_0x38de('0x35')]={'id':_0x16be8a['id']};_0x38fe71();});})['catch'](function(){return _0x167bea['status'](0x191)[_0x38de('0x40')]({'message':_0x38de('0x58')});});}catch(_0x587fec){_0x38fe71(_0x587fec);}}else if(_0x35af03){_0x38fe71();}else{return _0x167bea[_0x38de('0x3e')](0x193)['json']({'message':_0x38de('0x4e')});}})[_0x38de('0x34')](function(_0x16555d,_0x5c1fb3,_0x959652){if(_0x16555d[_0x38de('0x35')]){db[_0x38de('0x49')][_0x38de('0x4a')]({'where':{'id':_0x16555d[_0x38de('0x35')]['id']},'attributes':userAttributes})[_0x38de('0x3b')](function(_0x2449f3){if(!_0x2449f3){return _0x5c1fb3[_0x38de('0x3e')](0x194)['json']({'message':_0x38de('0x5c')});}_0x16555d[_0x38de('0x35')]=_0x2449f3;_0x959652();})[_0x38de('0x43')](function(_0x14fbb0){_0x959652(_0x14fbb0);});}else if(_0x35af03){_0x959652();}else{return _0x5c1fb3[_0x38de('0x3e')](0x194)[_0x38de('0x40')]({'message':_0x38de('0x5d')});}});};exports[_0x38de('0x5e')]=function canUpdate(){return compose()[_0x38de('0x34')](function(_0x1dd6ec,_0x2b4c83,_0x14bcda){return licenseUtil[_0x38de('0x5f')]()[_0x38de('0x3b')](function(_0x4175cc){if(_0x4175cc['update']){_0x14bcda();}else{return _0x2b4c83['status'](0x193)[_0x38de('0x40')]({'message':_0x38de('0x60')});}})['catch'](function(_0x461634){_0x14bcda(_0x461634);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x38de('0x34')](function(_0x311db9,_0xd5249e,_0x2dea03){return licenseUtil['getLicense']()['then'](function(_0x5198a3){if(_0x5198a3['webrtc']){_0x2dea03();}else{return _0xd5249e[_0x38de('0x3e')](0x193)['json']({'message':_0x38de('0x60')});}})[_0x38de('0x43')](function(_0x40d198){_0x2dea03(_0x40d198);});});};exports['isMiddleware']=function(_0x8903ca,_0x4871ef,_0x5304bb){_0x8903ca[_0x38de('0x61')]=!![];return _0x5304bb();};exports[_0x38de('0x62')]=function signToken(_0x37b4ff){return signJwt(_0x37b4ff);};exports['setTokenCookie']=function(_0x12bc91,_0x208af8){if(!_0x12bc91['user']){return _0x208af8[_0x38de('0x3e')](0x194)[_0x38de('0x40')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x31fef7={'payload':{'id':_0x12bc91[_0x38de('0x35')]['id'],'role':_0x12bc91[_0x38de('0x35')][_0x38de('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x31fef7)['then'](function(_0xf9928){_0x208af8['cookie'](_0x38de('0x63'),_0xf9928);_0x208af8[_0x38de('0x64')]('/dashboards/general');})['catch'](function(_0xf3d69f){return _0x208af8[_0x38de('0x3e')](0x1f4)['send'](_0xf3d69f);});};exports['retrieveApiKey']=function(_0x554d53){if(_['isNil'](_0x554d53[_0x38de('0x65')])||_['isNil'](_0x554d53[_0x38de('0x66')])){return null;}else{return createJwt(_0x554d53);}};exports[_0x38de('0x67')]=function(_0x4bd5fd){_0x4bd5fd[_0x38de('0x65')]=generateNonce();_0x4bd5fd[_0x38de('0x66')]=generateIssuedAt();return createJwt(_0x4bd5fd);};exports[_0x38de('0x68')]=function(_0x4bb6fd,_0x55cd1c){var _0x2ab601=_0x4bb6fd[_0x38de('0x3c')][_0x38de('0x50')];if(_0x2ab601){var _0x37d428={'nonce':_0x55cd1c['apiKeyNonce'],'iat':_0x55cd1c[_0x38de('0x66')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x38de('0x4f')]()};return verifyJwt(_0x2ab601,_0x37d428)[_0x38de('0x3b')](function(){return generateApiKey(_0x55cd1c);});}else{throw{'message':_0x38de('0x69')};}};exports[_0x38de('0x6a')]=function(_0x1a0ab0){var _0x33373e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x33373e['test'](_0x1a0ab0))throw new db['Sequelize'][(_0x38de('0x6b'))](_0x38de('0x6c'));return;};exports[_0x38de('0x6d')]=function(_0x489b31,_0xc3adad,_0x7b7251){var _0x139c85=encryptor[_0x38de('0x6e')](_0xc3adad)[_0x38de('0x6f')](',');for(var _0xf2a4d=0x0;_0xf2a4d<_0x7b7251;_0xf2a4d++){if(!_0x139c85[_0xf2a4d])break;if(_0x489b31[_0x38de('0x70')]()===_0x139c85[_0xf2a4d][_0x38de('0x70')]()){var _0x1617e3=util[_0x38de('0x71')](_0x38de('0x72'),_0x7b7251);if(_0x7b7251===0x1){_0x1617e3=_0x38de('0x73');}throw new db['Sequelize']['ValidationError'](_0x1617e3);}}return;};exports[_0x38de('0x74')]=function(_0x5dc838,_0x1fc688){var _0x5aaab0=_0x1fc688?encryptor[_0x38de('0x6e')](_0x1fc688)[_0x38de('0x6f')](','):[];if(_0x5aaab0[_0x38de('0x75')]===0x5){_0x5aaab0[_0x38de('0x76')](-0x1,0x1);}_0x5aaab0[_0x38de('0x77')](_0x5dc838);return encryptor[_0x38de('0x78')](_0x5aaab0['join'](','));};function signJwt(_0x7b20a0){var _0x3ffaa8=BPromise[_0x38de('0x79')](jwt[_0x38de('0x7a')],{'context':jwt});var _0x3e5514=_0x7b20a0[_0x38de('0x7b')]||config[_0x38de('0xa')][_0x38de('0xb')];return new BPromise(function(_0x2f280d,_0x45242e){_0x3ffaa8(_0x7b20a0[_0x38de('0x7c')],_0x3e5514,_0x7b20a0[_0x38de('0x7d')])[_0x38de('0x3b')](function(_0x1b0a31){_0x2f280d(_0x1b0a31);})[_0x38de('0x43')](function(_0x12a606){_0x45242e(_0x12a606);});});}function verifyJwt(_0x2e6106,_0x31ec6d,_0x273fdf){var _0x34dd72=BPromise[_0x38de('0x79')](jwt[_0x38de('0x7e')],{'context':jwt});var _0x497737=_0x273fdf||config[_0x38de('0xa')][_0x38de('0xb')];return new BPromise(function(_0x2a78f2,_0x4965ae){_0x34dd72(_0x2e6106,_0x497737,_0x31ec6d)['then'](function(_0x2740a0){_0x2a78f2(_0x2740a0);})[_0x38de('0x43')](function(_0x239377){_0x4965ae(_0x239377);});});}function generateNonce(){return crypto[_0x38de('0x7f')](0x10)[_0x38de('0x80')]('hex');}function generateIssuedAt(){return Math[_0x38de('0x81')](Date[_0x38de('0x82')]()/0x3e8)['toString']();}function createJwt(_0x817850){var _0x176f9d={'payload':{'iat':_0x817850[_0x38de('0x66')],'nonce':_0x817850[_0x38de('0x65')]},'options':{'algorithm':_0x38de('0x83'),'subject':_0x817850['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x38de('0x4f')]()}};return signJwt(_0x176f9d)[_0x38de('0x3b')](function(_0x1fe152){return{'iat':_0x817850[_0x38de('0x66')],'nonce':_0x817850[_0x38de('0x65')],'token':_0x1fe152};});} \ No newline at end of file +var _0x7d7c=['ignorePauseForPreviewCalls','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','use','user','findOne','disposition','then','closed','query','forceDownload','status','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','find','authenticate','Wrong\x20credentials.','json','apikey','getUuid','sub','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockedAt','blockDuration','minutes','Unknown\x20authorization\x20format','User','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secret','session','payload','verify','randomBytes','toString','hex','floor','now','HS512','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','composable-middleware','crypto','util','moment','secrets','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadAttachments'];(function(_0x19b2b4,_0x5c4f47){var _0x3070c4=function(_0x42d6e1){while(--_0x42d6e1){_0x19b2b4['push'](_0x19b2b4['shift']());}};_0x3070c4(++_0x5c4f47);}(_0x7d7c,0xde));var _0xc7d7=function(_0x554456,_0x231849){_0x554456=_0x554456-0x0;var _0x3814b2=_0x7d7c[_0x554456];return _0x3814b2;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xc7d7('0x0'));var hardwareConf=require(_0xc7d7('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0xc7d7('0x2'));var jwt=require(_0xc7d7('0x3'));var expressJwt=require('express-jwt');var compose=require(_0xc7d7('0x4'));var basicAuth=require('basic-auth');var crypto=require(_0xc7d7('0x5'));var BPromise=require('bluebird');var util=require(_0xc7d7('0x6'));var moment=require(_0xc7d7('0x7'));var validateJwt=expressJwt({'secret':config[_0xc7d7('0x8')]['session']});var userAttributes=['id','role',_0xc7d7('0x9'),_0xc7d7('0xa'),_0xc7d7('0xb'),_0xc7d7('0xc'),_0xc7d7('0xd'),_0xc7d7('0xe'),_0xc7d7('0xf'),_0xc7d7('0x10'),'chatPause',_0xc7d7('0x11'),_0xc7d7('0x12'),'smsPause',_0xc7d7('0x13'),_0xc7d7('0x14'),_0xc7d7('0x15'),_0xc7d7('0x16'),_0xc7d7('0x17'),'crudPermissions',_0xc7d7('0x18'),'passwordResetAt','alias','phoneBarAutoAnswer',_0xc7d7('0x19'),_0xc7d7('0x1a'),_0xc7d7('0x1b'),_0xc7d7('0x1c'),_0xc7d7('0x1d'),_0xc7d7('0x1e'),'phoneBarPrefixRequired',_0xc7d7('0x1f'),'phoneBarRemoteControlPort','hotdesk',_0xc7d7('0x20'),_0xc7d7('0x21'),_0xc7d7('0x22'),'settingsEnabled',_0xc7d7('0x23'),_0xc7d7('0x24'),'downloadOmnichannelInteractions',_0xc7d7('0x25'),_0xc7d7('0x26'),'selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay',_0xc7d7('0x27'),_0xc7d7('0x28'),_0xc7d7('0x29'),_0xc7d7('0x2a'),'openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer',_0xc7d7('0x2b'),_0xc7d7('0x2c'),_0xc7d7('0x2d'),_0xc7d7('0x2e')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0xc7d7('0x2f')](function(_0x205a44,_0xfd1f49,_0x208245){if(_0x205a44[_0xc7d7('0x30')]){_0x208245();}else{return db['ChatInteraction'][_0xc7d7('0x31')]({'where':{'id':_0x205a44['params']['id']},'attributes':['id','closed',_0xc7d7('0x32')],'raw':!![]})[_0xc7d7('0x33')](function(_0x428264){if(_0x428264&&_0x428264[_0xc7d7('0x34')]&&!_0x205a44[_0xc7d7('0x35')][_0xc7d7('0x36')]){return _0xfd1f49[_0xc7d7('0x37')](_0x428264[_0xc7d7('0x32')]===_0xc7d7('0x38')?0x195:0x193)['json']({'message':_0x428264[_0xc7d7('0x32')]==='unmanaged'?_0xc7d7('0x39'):_0xc7d7('0x3a')});}else{_0x208245();}})[_0xc7d7('0x3b')](function(_0x333167){_0x208245(_0x333167);});}});};exports['isAuthenticated']=function isAuthenticated(_0x5406e6){return compose()[_0xc7d7('0x2f')](function(_0x5dd3b0,_0x1fcd36,_0x2afd18){var _0x38b941;if(_0x5dd3b0[_0xc7d7('0x3c')][_0xc7d7('0x3d')]){if(_[_0xc7d7('0x3e')](_0x5dd3b0[_0xc7d7('0x3c')]['authorization'],'Basic')){var _0x23a9a1=basicAuth(_0x5dd3b0);db['User'][_0xc7d7('0x3f')]({'where':{'name':_0x23a9a1['name']}})[_0xc7d7('0x33')](function(_0x3b64b9){if(!_0x3b64b9||!_0x3b64b9[_0xc7d7('0x40')](_0x23a9a1['pass'])){return _0x1fcd36[_0xc7d7('0x37')](0x191)['json']({'message':_0xc7d7('0x41')});}_0x5dd3b0[_0xc7d7('0x30')]={'id':_0x3b64b9['id']};_0x2afd18();})[_0xc7d7('0x3b')](function(_0x535a8b){_0x2afd18(_0x535a8b);});}else if(_[_0xc7d7('0x3e')](_0x5dd3b0[_0xc7d7('0x3c')][_0xc7d7('0x3d')],'Bearer')){validateJwt(_0x5dd3b0,_0x1fcd36,_0x2afd18);}else{if(_0x5406e6){_0x2afd18();}else{return _0x1fcd36[_0xc7d7('0x37')](0x193)[_0xc7d7('0x42')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5dd3b0['query'][_0xc7d7('0x43')]){try{var _0x555256={'audience':hardwareConf[_0xc7d7('0x44')](),'issuer':hardwareConf[_0xc7d7('0x44')]()};verifyJwt(_0x5dd3b0[_0xc7d7('0x35')][_0xc7d7('0x43')],_0x555256)[_0xc7d7('0x33')](function(_0x1549b2){return db['User']['find']({'where':{'id':_0x1549b2[_0xc7d7('0x45')]}})['then'](function(_0x233635){_0x38b941=_0x233635;return db[_0xc7d7('0x46')][_0xc7d7('0x31')]({'where':{'id':0x1},'attributes':[_0xc7d7('0x47'),'blockDuration'],'raw':!![]});})[_0xc7d7('0x33')](function(_0x5d8ac6){if(!_0x38b941||!_[_0xc7d7('0x48')](_0x38b941[_0xc7d7('0x49')],_0x1549b2[_0xc7d7('0x4a')])){return _0x1fcd36[_0xc7d7('0x37')](0x191)[_0xc7d7('0x42')]({'message':_0xc7d7('0x4b')});}if(_0x38b941['disabled']){return _0x1fcd36[_0xc7d7('0x37')](0x191)[_0xc7d7('0x42')]({'message':_0xc7d7('0x4c')});}if(_0x38b941[_0xc7d7('0x4d')]){if(_0x5d8ac6['blockDuration']>0x0){if(moment(_0x38b941[_0xc7d7('0x4e')])['add'](_0x5d8ac6[_0xc7d7('0x4f')],_0xc7d7('0x50'))>moment()){return _0x1fcd36[_0xc7d7('0x37')](0x191)['json']({'message':_0xc7d7('0x4c')});}}else{return _0x1fcd36[_0xc7d7('0x37')](0x191)[_0xc7d7('0x42')]({'message':_0xc7d7('0x4c')});}}_0x5dd3b0['user']={'id':_0x38b941['id']};_0x2afd18();});})[_0xc7d7('0x3b')](function(){return _0x1fcd36['status'](0x191)[_0xc7d7('0x42')]({'message':_0xc7d7('0x4c')});});}catch(_0x34b84c){_0x2afd18(_0x34b84c);}}else if(_0x5406e6){_0x2afd18();}else{return _0x1fcd36[_0xc7d7('0x37')](0x193)[_0xc7d7('0x42')]({'message':_0xc7d7('0x51')});}})[_0xc7d7('0x2f')](function(_0x16f8f4,_0x2ae2d8,_0x191204){if(_0x16f8f4['user']){db[_0xc7d7('0x52')]['find']({'where':{'id':_0x16f8f4['user']['id']},'attributes':userAttributes})[_0xc7d7('0x33')](function(_0x39bedd){if(!_0x39bedd){return _0x2ae2d8[_0xc7d7('0x37')](0x194)[_0xc7d7('0x42')]({'message':_0xc7d7('0x53')});}_0x16f8f4[_0xc7d7('0x30')]=_0x39bedd;_0x191204();})[_0xc7d7('0x3b')](function(_0x27309d){_0x191204(_0x27309d);});}else if(_0x5406e6){_0x191204();}else{return _0x2ae2d8[_0xc7d7('0x37')](0x194)[_0xc7d7('0x42')]({'message':_0xc7d7('0x54')});}});};exports[_0xc7d7('0x55')]=function canUpdate(){return compose()[_0xc7d7('0x2f')](function(_0x41c851,_0x3568c4,_0x3d0361){return licenseUtil['getLicense']()[_0xc7d7('0x33')](function(_0x3c1aa5){if(_0x3c1aa5[_0xc7d7('0x56')]){_0x3d0361();}else{return _0x3568c4[_0xc7d7('0x37')](0x193)['json']({'message':_0xc7d7('0x57')});}})['catch'](function(_0x141546){_0x3d0361(_0x141546);});});};exports[_0xc7d7('0x58')]=function isWebrtcLicence(){return compose()[_0xc7d7('0x2f')](function(_0xcba428,_0x2b3338,_0x5d33c9){return licenseUtil[_0xc7d7('0x59')]()[_0xc7d7('0x33')](function(_0x22b9ab){if(_0x22b9ab['webrtc']){_0x5d33c9();}else{return _0x2b3338['status'](0x193)['json']({'message':_0xc7d7('0x57')});}})[_0xc7d7('0x3b')](function(_0x4c7243){_0x5d33c9(_0x4c7243);});});};exports['isMiddleware']=function(_0x5b3fdb,_0x338801,_0x2df0c7){_0x5b3fdb[_0xc7d7('0x5a')]=!![];return _0x2df0c7();};exports[_0xc7d7('0x5b')]=function signToken(_0x161b07){return signJwt(_0x161b07);};exports[_0xc7d7('0x5c')]=function(_0x1a86a0,_0x5def05){if(!_0x1a86a0['user']){return _0x5def05[_0xc7d7('0x37')](0x194)['json']({'message':_0xc7d7('0x5d')});}var _0x343a88={'payload':{'id':_0x1a86a0[_0xc7d7('0x30')]['id'],'role':_0x1a86a0[_0xc7d7('0x30')][_0xc7d7('0x5e')]},'options':{'expiresIn':0x15180}};return signJwt(_0x343a88)[_0xc7d7('0x33')](function(_0x199fe5){_0x5def05[_0xc7d7('0x5f')](_0xc7d7('0x60'),_0x199fe5);_0x5def05[_0xc7d7('0x61')]('/dashboards/general');})['catch'](function(_0x5448e8){return _0x5def05[_0xc7d7('0x37')](0x1f4)[_0xc7d7('0x62')](_0x5448e8);});};exports[_0xc7d7('0x63')]=function(_0x1c6fb8){if(_[_0xc7d7('0x64')](_0x1c6fb8[_0xc7d7('0x49')])||_[_0xc7d7('0x64')](_0x1c6fb8['apiKeyIat'])){return null;}else{return createJwt(_0x1c6fb8);}};exports[_0xc7d7('0x65')]=function(_0x2af8b9){_0x2af8b9[_0xc7d7('0x49')]=generateNonce();_0x2af8b9[_0xc7d7('0x66')]=generateIssuedAt();return createJwt(_0x2af8b9);};exports[_0xc7d7('0x67')]=function(_0x2a3271,_0x112e0b){var _0x53c244=_0x2a3271[_0xc7d7('0x35')][_0xc7d7('0x43')];if(_0x53c244){var _0x1ac748={'nonce':_0x112e0b['apiKeyNonce'],'iat':_0x112e0b[_0xc7d7('0x66')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x53c244,_0x1ac748)[_0xc7d7('0x33')](function(){return generateApiKey(_0x112e0b);});}else{throw{'message':_0xc7d7('0x68')};}};exports[_0xc7d7('0x69')]=function(_0x5ae491){var _0x499d7b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x499d7b['test'](_0x5ae491))throw new db[(_0xc7d7('0x6a'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x5cbf48,_0x5c7759,_0x4c6cc1){var _0x14028e=encryptor[_0xc7d7('0x6b')](_0x5c7759)[_0xc7d7('0x6c')](',');for(var _0x5c780c=0x0;_0x5c780c<_0x4c6cc1;_0x5c780c++){if(!_0x14028e[_0x5c780c])break;if(_0x5cbf48[_0xc7d7('0x6d')]()===_0x14028e[_0x5c780c][_0xc7d7('0x6d')]()){var _0x56dc33=util[_0xc7d7('0x6e')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x4c6cc1);if(_0x4c6cc1===0x1){_0x56dc33=_0xc7d7('0x6f');}throw new db['Sequelize']['ValidationError'](_0x56dc33);}}return;};exports[_0xc7d7('0x70')]=function(_0x1d82aa,_0x3cb3ee){var _0x410228=_0x3cb3ee?encryptor[_0xc7d7('0x6b')](_0x3cb3ee)[_0xc7d7('0x6c')](','):[];if(_0x410228[_0xc7d7('0x71')]===0x5){_0x410228[_0xc7d7('0x72')](-0x1,0x1);}_0x410228[_0xc7d7('0x73')](_0x1d82aa);return encryptor[_0xc7d7('0x74')](_0x410228[_0xc7d7('0x75')](','));};function signJwt(_0x2168ce){var _0x40d5df=BPromise[_0xc7d7('0x76')](jwt[_0xc7d7('0x77')],{'context':jwt});var _0x5c18f7=_0x2168ce[_0xc7d7('0x78')]||config[_0xc7d7('0x8')][_0xc7d7('0x79')];return new BPromise(function(_0x130a9f,_0x5ae3d9){_0x40d5df(_0x2168ce[_0xc7d7('0x7a')],_0x5c18f7,_0x2168ce['options'])[_0xc7d7('0x33')](function(_0x1d5362){_0x130a9f(_0x1d5362);})[_0xc7d7('0x3b')](function(_0x27df20){_0x5ae3d9(_0x27df20);});});}function verifyJwt(_0x2b886d,_0x41737f,_0x561d58){var _0x6bd9a3=BPromise[_0xc7d7('0x76')](jwt[_0xc7d7('0x7b')],{'context':jwt});var _0x5f3b4d=_0x561d58||config[_0xc7d7('0x8')][_0xc7d7('0x79')];return new BPromise(function(_0x3fad30,_0x19df1b){_0x6bd9a3(_0x2b886d,_0x5f3b4d,_0x41737f)[_0xc7d7('0x33')](function(_0x1afba5){_0x3fad30(_0x1afba5);})[_0xc7d7('0x3b')](function(_0x2f5397){_0x19df1b(_0x2f5397);});});}function generateNonce(){return crypto[_0xc7d7('0x7c')](0x10)[_0xc7d7('0x7d')](_0xc7d7('0x7e'));}function generateIssuedAt(){return Math[_0xc7d7('0x7f')](Date[_0xc7d7('0x80')]()/0x3e8)[_0xc7d7('0x7d')]();}function createJwt(_0x352f5f){var _0x2a7f6f={'payload':{'iat':_0x352f5f[_0xc7d7('0x66')],'nonce':_0x352f5f[_0xc7d7('0x49')]},'options':{'algorithm':_0xc7d7('0x81'),'subject':_0x352f5f['id'][_0xc7d7('0x7d')](),'issuer':hardwareConf[_0xc7d7('0x44')](),'audience':hardwareConf[_0xc7d7('0x44')]()}};return signJwt(_0x2a7f6f)[_0xc7d7('0x33')](function(_0x3572c5){return{'iat':_0x352f5f['apiKeyIat'],'nonce':_0x352f5f[_0xc7d7('0x49')],'token':_0x3572c5};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index a482df3..6b4436a 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 _0xadc1=['tags','skip','checkListsRestrictions','tag','count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe','keys','startsWith','cf_','map','findOne','slice','all','fieldType','type','lodash','./sql-utils','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','fields','filter','user','clause'];(function(_0x191463,_0x3d59eb){var _0x1a4941=function(_0x5c0b92){while(--_0x5c0b92){_0x191463['push'](_0x191463['shift']());}};_0x1a4941(++_0x3d59eb);}(_0xadc1,0xc3));var _0x1adc=function(_0x58999b,_0xea4695){_0x58999b=_0x58999b-0x0;var _0x5efc3a=_0xadc1[_0x58999b];return _0x5efc3a;};'use strict';var _=require(_0x1adc('0x0'));var sqlUtils=require(_0x1adc('0x1'));var db=require('../../mysqldb')['db'];exports[_0x1adc('0x2')]=function(_0x179d73,_0x3ae693,_0x3d1362,_0x10a52b){var _0x4e9ecb={'count':0x0,'rows':[]};var _0x57f3ab=sqlUtils[_0x1adc('0x3')](_0x3ae693,_0x179d73);if(_0x57f3ab){return Promise[_0x1adc('0x4')](_0x4e9ecb);}var _0x2c3ce6=sqlUtils[_0x1adc('0x5')]();var _0x44c942={};var _0x54607f=![];var _0x4e81ce=![];return Promise[_0x1adc('0x4')]()[_0x1adc('0x6')](function(){if(_0x179d73[_0x1adc('0x7')]){return sqlUtils[_0x1adc('0x8')](_0x179d73[_0x1adc('0x7')],_0x10a52b);}else{return sqlUtils[_0x1adc('0x9')](_0x179d73,_0x10a52b);}})[_0x1adc('0x6')](function(_0x45a4f3){_0x2c3ce6[_0x1adc('0xa')](_0x45a4f3['default']);_0x2c3ce6['where'](_0x45a4f3[_0x1adc('0xb')]);_0x2c3ce6['where'](_0x45a4f3[_0x1adc('0xc')]);_0x2c3ce6[_0x1adc('0xa')](_0x45a4f3[_0x1adc('0xd')][_0x1adc('0xe')]);_0x44c942=_0x45a4f3[_0x1adc('0xf')];_0x4e81ce=_0x45a4f3[_0x1adc('0xd')][_0x1adc('0x10')];return sqlUtils[_0x1adc('0x11')](_0x3ae693,_0x179d73,_0x4e81ce);})[_0x1adc('0x6')](function(_0x5c38b3){_0x2c3ce6[_0x1adc('0xa')](_0x5c38b3);var _0x415072=_0x179d73[_0x1adc('0x7')]?_0x44c942['ids']:_0x179d73[_0x1adc('0x12')];_0x54607f=_0x415072?!![]:![];return sqlUtils['countFilteredContacts'](_0x2c3ce6,_0x415072);})[_0x1adc('0x6')](function(_0x1639f3){_0x4e9ecb[_0x1adc('0x13')]=_0x1639f3;if(_0x4e9ecb[_0x1adc('0x13')]===0x0){return;}if(_0x179d73[_0x1adc('0x14')]){_0x4e81ce=!![];}return sqlUtils[_0x1adc('0x15')](_0x2c3ce6,_0x179d73[_0x1adc('0xb')],_0x3d1362,_0x54607f,_0x44c942['clause'],_0x4e81ce);})[_0x1adc('0x6')](function(_0x5087e7){if(!_0x5087e7){return[];}return sqlUtils[_0x1adc('0x16')](_0x5087e7,_0x179d73,_0x3d1362);})[_0x1adc('0x6')](function(_0x5e7059){_0x4e9ecb[_0x1adc('0x17')]=_0x5e7059;return _0x4e9ecb;})[_0x1adc('0x18')](function(_0x2ad365){throw _0x2ad365;});};exports[_0x1adc('0x19')]=function(){var _0x4eee1a={};var _0x568bc5=[];return db['CmContact']['describe']()['then'](function(_0x10314b){_0x4eee1a=_0x10314b;var _0x3ccf59=Object[_0x1adc('0x1a')](_0x4eee1a)[_0x1adc('0xc')](function(_0x1737af){return _[_0x1adc('0x1b')](_0x1737af,_0x1adc('0x1c'))?_0x1737af:undefined;});var _0x4dcb96=_0x3ccf59[_0x1adc('0x1d')](function(_0x2ccd58){return db['CmCustomField'][_0x1adc('0x1e')]({'where':{'id':_0x2ccd58[_0x1adc('0x1f')](0x3)},'raw':!![]});});return Promise[_0x1adc('0x20')](_0x4dcb96);})[_0x1adc('0x6')](function(_0x541654){for(var _0x4268b2=0x0;_0x4268b2<_0x541654['length'];_0x4268b2++){if(_0x541654[_0x4268b2]){var _0x172a00=_0x1adc('0x1c')+_0x541654[_0x4268b2]['id'];_0x4eee1a[_0x172a00][_0x1adc('0x21')]=_0x541654[_0x4268b2][_0x1adc('0x22')];}}_0x568bc5=_['map'](Object['keys'](_0x4eee1a),function(_0x3992c4){return{'name':_0x3992c4,'type':_0x4eee1a[_0x3992c4]['type']};});return _0x568bc5;})[_0x1adc('0x18')](function(_0x497c43){throw _0x497c43;});}; \ No newline at end of file +var _0x0428=['skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','fields','clause','getFilteredContacts','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','slice','fieldType','type','lodash','./sql-utils','../../mysqldb','skipContactsQuery','getContactsSubquery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','filter','user','tags'];(function(_0x1b8fba,_0x183490){var _0xfe1cc9=function(_0x395848){while(--_0x395848){_0x1b8fba['push'](_0x1b8fba['shift']());}};_0xfe1cc9(++_0x183490);}(_0x0428,0xcf));var _0x8042=function(_0x31e29b,_0x5d7ff0){_0x31e29b=_0x31e29b-0x0;var _0x1438aa=_0x0428[_0x31e29b];return _0x1438aa;};'use strict';var _=require(_0x8042('0x0'));var sqlUtils=require(_0x8042('0x1'));var db=require(_0x8042('0x2'))['db'];exports['findAll']=function(_0x4cb58a,_0xdda071,_0x5aee1b,_0x2b0a8f){var _0x1c8874={'count':0x0,'rows':[]};var _0x169f2a=sqlUtils[_0x8042('0x3')](_0xdda071,_0x4cb58a);if(_0x169f2a){return Promise['resolve'](_0x1c8874);}var _0x30a57c=sqlUtils[_0x8042('0x4')]();var _0x13454c={};var _0x5a15b9=![];var _0x54cd0b=![];return Promise[_0x8042('0x5')]()[_0x8042('0x6')](function(){if(_0x4cb58a[_0x8042('0x7')]){return sqlUtils[_0x8042('0x8')](_0x4cb58a['search'],_0x2b0a8f);}else{return sqlUtils[_0x8042('0x9')](_0x4cb58a,_0x2b0a8f);}})[_0x8042('0x6')](function(_0x39202f){_0x30a57c['where'](_0x39202f[_0x8042('0xa')]);_0x30a57c['where'](_0x39202f['fields']);_0x30a57c[_0x8042('0xb')](_0x39202f[_0x8042('0xc')]);_0x30a57c[_0x8042('0xb')](_0x39202f[_0x8042('0xd')]['clause']);_0x13454c=_0x39202f[_0x8042('0xe')];_0x54cd0b=_0x39202f[_0x8042('0xd')][_0x8042('0xf')];return sqlUtils[_0x8042('0x10')](_0xdda071,_0x4cb58a,_0x54cd0b);})[_0x8042('0x6')](function(_0x52190d){_0x30a57c[_0x8042('0xb')](_0x52190d);var _0x2871ac=_0x4cb58a[_0x8042('0x7')]?_0x13454c[_0x8042('0x11')]:_0x4cb58a[_0x8042('0x12')];_0x5a15b9=_0x2871ac?!![]:![];return sqlUtils[_0x8042('0x13')](_0x30a57c,_0x2871ac);})[_0x8042('0x6')](function(_0x28b026){_0x1c8874[_0x8042('0x14')]=_0x28b026;if(_0x1c8874['count']===0x0){return;}if(_0x4cb58a['User']){_0x54cd0b=!![];}return sqlUtils[_0x8042('0x15')](_0x30a57c,_0x4cb58a[_0x8042('0x16')],_0x5aee1b,_0x5a15b9,_0x13454c[_0x8042('0x17')],_0x54cd0b);})[_0x8042('0x6')](function(_0x973987){if(!_0x973987){return[];}return sqlUtils[_0x8042('0x18')](_0x973987,_0x4cb58a,_0x5aee1b);})[_0x8042('0x6')](function(_0xfeef1f){_0x1c8874['rows']=_0xfeef1f;return _0x1c8874;})[_0x8042('0x19')](function(_0x361506){throw _0x361506;});};exports[_0x8042('0x1a')]=function(){var _0x35301a={};var _0x4e06f7=[];return db[_0x8042('0x1b')][_0x8042('0x1a')]()['then'](function(_0x2a938a){_0x35301a=_0x2a938a;var _0x278bd6=Object[_0x8042('0x1c')](_0x35301a)[_0x8042('0xc')](function(_0x487ec7){return _[_0x8042('0x1d')](_0x487ec7,_0x8042('0x1e'))?_0x487ec7:undefined;});var _0x258dec=_0x278bd6[_0x8042('0x1f')](function(_0x5c9a58){return db[_0x8042('0x20')][_0x8042('0x21')]({'where':{'id':_0x5c9a58[_0x8042('0x22')](0x3)},'raw':!![]});});return Promise['all'](_0x258dec);})[_0x8042('0x6')](function(_0x3691a0){for(var _0x52f8bf=0x0;_0x52f8bf<_0x3691a0['length'];_0x52f8bf++){if(_0x3691a0[_0x52f8bf]){var _0x21b909=_0x8042('0x1e')+_0x3691a0[_0x52f8bf]['id'];_0x35301a[_0x21b909][_0x8042('0x23')]=_0x3691a0[_0x52f8bf][_0x8042('0x24')];}}_0x4e06f7=_[_0x8042('0x1f')](Object[_0x8042('0x1c')](_0x35301a),function(_0x177992){return{'name':_0x177992,'type':_0x35301a[_0x177992][_0x8042('0x24')]};});return _0x4e06f7;})[_0x8042('0x19')](function(_0x31d749){throw _0x31d749;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 3fe44b8..c375228 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 _0x7687=['replace','escapeLIKESpecialChars','split','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','name','dateOfBirth','castTo','DATE','buildExpression','type','default','text','start','value','end','Tag','map','tags','and','ids','User','clause','uc.UserId\x20=\x20?','user','skip','keys','some','Contact','push','length','c.ListId\x20IN\x20?','concat','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','subqry.','DESC','findAll','color','keyBy','Sequelize','SELECT','CmContact','sequelize','toString','Tags','clone','isEmpty','query','COUNT(*)','exports','squel','../parsers/advancedSearch','../interaction/utils','role','agent','search','ListId','autocomplete','true','select','from','cm_contacts','where','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','left_join','ct.CmContactId\x20=\x20','.id','t.id\x20=\x20ct.TagId','lastName','phone','mobile','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags'];(function(_0x47a8fd,_0x2c5a8b){var _0x484db9=function(_0x15cafa){while(--_0x15cafa){_0x47a8fd['push'](_0x47a8fd['shift']());}};_0x484db9(++_0x2c5a8b);}(_0x7687,0x18e));var _0x7768=function(_0x18ea8a,_0x32f09f){_0x18ea8a=_0x18ea8a-0x0;var _0x19c99a=_0x7687[_0x18ea8a];return _0x19c99a;};'use strict';var _=require('lodash');var squel=require(_0x7768('0x0'));var as=require(_0x7768('0x1'));var qs=require('../parsers/qs');var utils=require(_0x7768('0x2'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x3da8ec,_0x1a6845){var _0x144832=![];if(_0x3da8ec[_0x7768('0x3')]===_0x7768('0x4')&&!_0x1a6845[_0x7768('0x5')]&&!_0x1a6845[_0x7768('0x6')]&&_0x1a6845[_0x7768('0x7')]!==_0x7768('0x8')){_0x144832=!![];}return _0x144832;}function getContactsSubquery(){return squel[_0x7768('0x9')]()[_0x7768('0xa')](_0x7768('0xb'),'c')[_0x7768('0xc')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x5aca6e,_0x2f77d1){var _0x4986e4=_0x2f77d1?'c':_0x7768('0xd');_0x5aca6e['left_join'](_0x7768('0xe'),'uc',_0x7768('0xf')+_0x4986e4+'.id')[_0x7768('0x10')]('cm_contact_has_tags','ct',_0x7768('0x11')+_0x4986e4+_0x7768('0x12'))[_0x7768('0x10')]('tools_tags','t',_0x7768('0x13'));return _0x5aca6e;}function addFieldsToQuery(_0x3d7e11,_0x5c7f10,_0xc11d42,_0x5ac7ca,_0x206f78){var _0x43e163=_0x206f78?'c':'subqry';if(!_0x5c7f10){_0x5c7f10=['id','firstName',_0x7768('0x14'),_0x7768('0x15'),_0x7768('0x16'),'fax',_0x7768('0x17'),_0x7768('0x6'),_0x7768('0x18'),_0x7768('0x19'),_0x7768('0x1a'),_0x7768('0x1b'),_0x7768('0x1c')];}else if(!_0x5c7f10['includes']('id')){_0x5c7f10['push']('id');}var _0x31a151=_0xc11d42&&_0x206f78||!_0xc11d42&&!_0x206f78;if(_0x5ac7ca){_0x31a151=_0x5ac7ca&&_0x206f78||!_0x5ac7ca&&!_0x206f78;}_0x5c7f10[_0x7768('0x1d')](function(_0x28bc4f){if(_0x28bc4f==='TagIds'){if(_0x31a151){_0x3d7e11['field'](_0x7768('0x1e'),_0x28bc4f);}else if(_0xc11d42||_0x5ac7ca){_0x3d7e11['field'](_0x43e163+'.'+_0x28bc4f);}}else{_0x3d7e11[_0x7768('0x1f')](_0x43e163+'.'+_0x28bc4f);}});return _0x3d7e11;}function getSqlClauses(){var _0x1d7dff={'default':squel[_0x7768('0x20')](),'fields':squel[_0x7768('0x20')](),'filter':squel[_0x7768('0x20')](),'tags':{'clause':squel[_0x7768('0x20')](),'ids':null},'user':{'clause':squel[_0x7768('0x20')](),'skip':![]}};return _0x1d7dff;}function parseTagParameter(_0x5a7ca2){var _0x54f7e7=squel[_0x7768('0x20')]();if(_0x5a7ca2){var _0x549352=utils[_0x7768('0x21')](_0x5a7ca2);_0x549352[_0x7768('0x1d')](function(_0x177b12){_0x54f7e7['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x177b12+',%');});}return _0x54f7e7;}function parseSearchFilter(_0x2d45e3){var _0x1c213d=squel[_0x7768('0x20')]();if(_0x2d45e3){var _0x49df6c=_0x2d45e3['replace']('\x5c','\x5c\x5c')[_0x7768('0x22')](/'/g,'\x27\x27');var _0x11ec49=qs[_0x7768('0x23')](_0x49df6c);if(_0x49df6c[_0x7768('0x24')]('\x20')['length']>0x1){_0x1c213d['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7768('0x25')](_0x49df6c,!![]),null);}else{if(qs[_0x7768('0x26')](_0x49df6c)){_0x1c213d['or'](_0x7768('0x27'),_0x11ec49+'%');_0x1c213d['or'](_0x7768('0x28'),_0x11ec49+'%');_0x1c213d['or'](_0x7768('0x29'),_0x11ec49+'%');_0x1c213d['or'](_0x7768('0x2a'),_0x11ec49+'%');}else if(qs['isEmail'](_0x49df6c)){_0x1c213d['or']('c.email\x20LIKE\x20?',_0x11ec49+'%');}else{_0x1c213d['or']('c.firstName\x20LIKE\x20?','%'+_0x11ec49+'%');_0x1c213d['or'](_0x7768('0x2b'),'%'+_0x11ec49+'%');_0x1c213d['or'](_0x7768('0x2c'),'%'+_0x11ec49+'%');}}}return _0x1c213d;}function parseAdvancedSearchFilter(_0x3661a8,_0x4e0fc5){var _0x3138b6=getSqlClauses();var _0x578dac=as[_0x7768('0x2d')](_0x3661a8);var _0x3801be=_0x578dac[_0x7768('0x2e')];for(var _0x5d213f=0x0;_0x5d213f<_0x578dac[_0x7768('0x2f')]['length'];_0x5d213f++){var _0x3ac6be=_0x578dac['conditions'][_0x5d213f];var _0x58d3ac='c';var _0x4378a6=_['find'](_0x4e0fc5,[_0x7768('0x30'),_0x3ac6be[_0x7768('0x1f')]]);if(_0x4378a6){if(_0x3ac6be['field']===_0x7768('0x31')||_0x4378a6['fieldType']==='datetime'){_0x3ac6be[_0x7768('0x32')]=_0x7768('0x33');}var _0x5ccd6f=as[_0x7768('0x34')](_0x58d3ac,_0x4378a6[_0x7768('0x35')],_0x3ac6be);_0x3138b6[_0x7768('0x36')][_0x3801be](_0x5ccd6f[_0x7768('0x37')],_0x5ccd6f['value'][_0x7768('0x38')],_0x5ccd6f[_0x7768('0x39')][_0x7768('0x3a')]);}else{if(_0x3ac6be[_0x7768('0x1f')]===_0x7768('0x3b')){var _0x1ec774=_0x3ac6be['value']['split'](',')[_0x7768('0x3c')](function(_0x3e1e05){return Number(_0x3e1e05);});var _0x33dc2b=parseTagParameter(_0x1ec774);_0x3138b6[_0x7768('0x3d')]['clause'][_0x7768('0x3e')](_0x33dc2b);_0x3138b6[_0x7768('0x3d')][_0x7768('0x3f')]=_0x1ec774;}else if(_0x3ac6be[_0x7768('0x1f')]===_0x7768('0x40')){_0x3138b6['user'][_0x7768('0x41')][_0x7768('0x3e')](_0x7768('0x42'),_0x3ac6be['value']);_0x3138b6[_0x7768('0x43')][_0x7768('0x44')]=!![];}}}return _0x3138b6;}function parseModelFields(_0x38f087,_0x5c2ec8){var _0x3f1127=squel['expr']();var _0x290e7e=_(_0x38f087)[_0x7768('0x45')]()[_0x7768('0x3c')](function(_0x506e7e){return _[_0x7768('0x46')](_0x5c2ec8,['name',_0x506e7e])?_0x506e7e:undefined;})['compact']()[_0x7768('0x39')]();if(_0x38f087[_0x7768('0x47')]){_0x290e7e[_0x7768('0x48')](_0x7768('0x47'));}if(_0x38f087['User']){_0x290e7e['push'](_0x7768('0x40'));}if(_0x290e7e[_0x7768('0x49')]>0x0){_0x290e7e[_0x7768('0x1d')](function(_0x513015){if(_0x513015===_0x7768('0x6')){_0x3f1127[_0x7768('0x3e')](_0x7768('0x4a'),[][_0x7768('0x4b')](_0x38f087[_0x513015]));}else if(_0x513015===_0x7768('0x47')){var _0x2f14fb='%'+_0x38f087[_0x513015]+'%';_0x3f1127[_0x7768('0x3e')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x2f14fb);}else if(_0x513015==='User'){_0x3f1127[_0x7768('0x3e')](_0x7768('0x42'),_0x38f087[_0x513015]);}else{_0x3f1127[_0x7768('0x3e')]('c.'+_0x513015+_0x7768('0x4c'),_0x38f087[_0x513015]);}});}return _0x3f1127;}function parseQueryParameters(_0x18c427,_0xf21d24){var _0x436c6f=getSqlClauses();return Promise[_0x7768('0x4d')]()[_0x7768('0x4e')](function(){return parseModelFields(_0x18c427,_0xf21d24);})[_0x7768('0x4e')](function(_0x121a26){_0x436c6f[_0x7768('0x4f')][_0x7768('0x3e')](_0x121a26);return parseTagParameter(_0x18c427[_0x7768('0x50')]);})['then'](function(_0x145d5a){_0x436c6f[_0x7768('0x3d')]['clause']['and'](_0x145d5a);return parseSearchFilter(_0x18c427[_0x7768('0x51')]);})['then'](function(_0x32ea8e){_0x436c6f[_0x7768('0x51')]=_0x32ea8e;return _0x436c6f;});}function checkListsRestrictions(_0x30ab62,_0x15c44a,_0x1efe4d){var _0x6cf46=squel['expr']();return Promise[_0x7768('0x4d')]()[_0x7768('0x4e')](function(){if(_0x15c44a[_0x7768('0x5')]&&_0x30ab62[_0x7768('0x3')]==='agent'&&!_0x1efe4d){return _0x30ab62[_0x7768('0x52')]({'attributes':['id'],'raw':!![]});}})[_0x7768('0x4e')](function(_0xc92069){if(_0xc92069){if(_0xc92069[_0x7768('0x49')]===0x0){_0x6cf46[_0x7768('0x3e')](_0x7768('0x53'));}else{_0x6cf46['and'](_0x7768('0x4a'),_[_0x7768('0x3c')](_0xc92069,'id'));}}})['then'](function(){return _0x6cf46;});}function buildContactsQuery(_0x29746b,_0x3b086f,_0x5cc190,_0x1c0adf,_0x363a65,_0xff5afc){if(_0x3b086f){_0x3b086f=_0x5cc190[_0x7768('0x54')];}_0x29746b=addFieldsToQuery(_0x29746b,_0x3b086f,_0x1c0adf,_0xff5afc,!![]);var _0x46a820=squel[_0x7768('0x9')]();_0x46a820=addFieldsToQuery(_0x46a820,_0x3b086f,_0x1c0adf,_0xff5afc,![]);if(_0x1c0adf||_0xff5afc){_0x29746b=applyJoinClauses(_0x29746b,!![]);_0x29746b[_0x7768('0x55')](_0x7768('0x56'));if(_0x5cc190[_0x7768('0x57')]){_0x46a820[_0x7768('0x57')](_0x5cc190['limit']);}if(_0x5cc190[_0x7768('0x58')]){_0x46a820[_0x7768('0x58')](_0x5cc190[_0x7768('0x58')]);}}else{_0x46a820=applyJoinClauses(_0x46a820,![]);_0x46a820[_0x7768('0x55')](_0x7768('0x59'));if(_0x5cc190['limit']){_0x29746b[_0x7768('0x57')](_0x5cc190['limit']);}if(_0x5cc190[_0x7768('0x58')]){_0x29746b['offset'](_0x5cc190[_0x7768('0x58')]);}}_0x46a820[_0x7768('0x5a')](_0x363a65);if(_0x5cc190['order']){_0x5cc190[_0x7768('0x5b')][_0x7768('0x1d')](function(_0x212bc6){_0x29746b[_0x7768('0x5b')]('c.'+_0x212bc6[0x0],_0x212bc6[0x1]==='DESC'?![]:!![]);_0x46a820[_0x7768('0x5b')](_0x7768('0x5c')+_0x212bc6[0x0],_0x212bc6[0x1]===_0x7768('0x5d')?![]:!![]);});}_0x46a820[_0x7768('0xa')](_0x29746b,_0x7768('0xd'));return _0x46a820;}function getFilteredContacts(_0xc1f8c7){var _0xb9ebf4=[];return db['Tag'][_0x7768('0x5e')]({'attributes':['id',_0x7768('0x30'),_0x7768('0x5f')],'raw':!![]})['then'](function(_0x395a0b){_0xb9ebf4=_[_0x7768('0x60')](_0x395a0b,'id');var _0x328f63={'type':db[_0x7768('0x61')]['QueryTypes'][_0x7768('0x62')],'model':db[_0x7768('0x63')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x7768('0x64')]['query'](_0xc1f8c7[_0x7768('0x65')](),_0x328f63);})[_0x7768('0x4e')](function(_0x24d8de){_0x24d8de['forEach'](function(_0xfc5462){if(_0xfc5462['TagIds']){_0xfc5462['Tags']=[];_0xfc5462[_0x7768('0x1c')][_0x7768('0x24')](',')[_0x7768('0x1d')](function(_0x10c7b6){_0xfc5462[_0x7768('0x66')][_0x7768('0x48')](_0xb9ebf4[_0x10c7b6]);});}delete _0xfc5462['TagIds'];});return _0x24d8de;});}function countFilteredContacts(_0x331e68,_0x38c315){var _0x2845a5=_0x331e68[_0x7768('0x67')]();_0x2845a5[_0x7768('0x1f')]('COUNT(*)');_0x2845a5=applyJoinClauses(_0x2845a5,!![]);_0x331e68['group']('c.id');var _0x1a72db=utils[_0x7768('0x21')](_0x38c315);if(!_[_0x7768('0x68')](_0x1a72db)){_0x2845a5[_0x7768('0xc')]('t.id\x20IN\x20?',_0x1a72db);}var _0x5b247c={'type':db['Sequelize']['QueryTypes'][_0x7768('0x62')],'raw':!![]};return db['sequelize'][_0x7768('0x69')](_0x2845a5[_0x7768('0x65')](),_0x5b247c)[_0x7768('0x4e')](function(_0x27baa0){return _0x27baa0[0x0][_0x7768('0x6a')];});}module[_0x7768('0x6b')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x8c1d=['compact','Contact','c.ListId\x20IN\x20?','concat','resolve','tag','filter','then','agent','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','having','order','DESC','subqry.','from','findAll','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','isEmpty','COUNT(*)','exports','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','search','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','phone','mobile','fax','ListId','CompanyId','updatedAt','deletedAt','push','forEach','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','fieldType','buildExpression','type','text','value','end','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','some'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c1d,0x88));var _0xd8c1=function(_0xc8ffa5,_0x1fd15f){_0xc8ffa5=_0xc8ffa5-0x0;var _0x35bc1b=_0x8c1d[_0xc8ffa5];return _0x35bc1b;};'use strict';var _=require(_0xd8c1('0x0'));var squel=require('squel');var as=require(_0xd8c1('0x1'));var qs=require(_0xd8c1('0x2'));var utils=require(_0xd8c1('0x3'));var db=require(_0xd8c1('0x4'))['db'];function skipContactsQuery(_0x38f0ad,_0x22dcae){var _0x4d52a5=![];if(_0x38f0ad[_0xd8c1('0x5')]==='agent'&&!_0x22dcae[_0xd8c1('0x6')]&&!_0x22dcae['ListId']&&_0x22dcae['autocomplete']!=='true'){_0x4d52a5=!![];}return _0x4d52a5;}function getContactsSubquery(){return squel[_0xd8c1('0x7')]()['from'](_0xd8c1('0x8'),'c')[_0xd8c1('0x9')](_0xd8c1('0xa'));}function applyJoinClauses(_0x41e0c4,_0x24104e){var _0x15500a=_0x24104e?'c':_0xd8c1('0xb');_0x41e0c4[_0xd8c1('0xc')](_0xd8c1('0xd'),'uc',_0xd8c1('0xe')+_0x15500a+_0xd8c1('0xf'))[_0xd8c1('0xc')]('cm_contact_has_tags','ct','ct.CmContactId\x20=\x20'+_0x15500a+_0xd8c1('0xf'))[_0xd8c1('0xc')](_0xd8c1('0x10'),'t',_0xd8c1('0x11'));return _0x41e0c4;}function addFieldsToQuery(_0x265ddb,_0x7781b2,_0x235c7e,_0x5baa73,_0x424776){var _0x136279=_0x424776?'c':'subqry';if(!_0x7781b2){_0x7781b2=['id','firstName','lastName',_0xd8c1('0x12'),_0xd8c1('0x13'),_0xd8c1('0x14'),'email',_0xd8c1('0x15'),_0xd8c1('0x16'),'createdAt',_0xd8c1('0x17'),_0xd8c1('0x18'),'TagIds'];}else if(!_0x7781b2['includes']('id')){_0x7781b2[_0xd8c1('0x19')]('id');}var _0x1afee9=_0x235c7e&&_0x424776||!_0x235c7e&&!_0x424776;if(_0x5baa73){_0x1afee9=_0x5baa73&&_0x424776||!_0x5baa73&&!_0x424776;}_0x7781b2[_0xd8c1('0x1a')](function(_0x1c8129){if(_0x1c8129===_0xd8c1('0x1b')){if(_0x1afee9){_0x265ddb[_0xd8c1('0x1c')](_0xd8c1('0x1d'),_0x1c8129);}else if(_0x235c7e||_0x5baa73){_0x265ddb[_0xd8c1('0x1c')](_0x136279+'.'+_0x1c8129);}}else{_0x265ddb[_0xd8c1('0x1c')](_0x136279+'.'+_0x1c8129);}});return _0x265ddb;}function getSqlClauses(){var _0x371424={'default':squel['expr'](),'fields':squel[_0xd8c1('0x1e')](),'filter':squel[_0xd8c1('0x1e')](),'tags':{'clause':squel[_0xd8c1('0x1e')](),'ids':null},'user':{'clause':squel[_0xd8c1('0x1e')](),'skip':![]}};return _0x371424;}function parseTagParameter(_0x41d06b){var _0x35ea7f=squel[_0xd8c1('0x1e')]();if(_0x41d06b){var _0xca22f4=utils[_0xd8c1('0x1f')](_0x41d06b);_0xca22f4[_0xd8c1('0x1a')](function(_0x3466ad){_0x35ea7f['or'](_0xd8c1('0x20'),'%,'+_0x3466ad+',%');});}return _0x35ea7f;}function parseSearchFilter(_0x278775){var _0x3cb0d4=squel[_0xd8c1('0x1e')]();if(_0x278775){var _0x4e42f4=_0x278775[_0xd8c1('0x21')]('\x5c','\x5c\x5c')[_0xd8c1('0x21')](/'/g,'\x27\x27');var _0x257eff=qs[_0xd8c1('0x22')](_0x4e42f4);if(_0x4e42f4[_0xd8c1('0x23')]('\x20')[_0xd8c1('0x24')]>0x1){_0x3cb0d4['or'](_0xd8c1('0x25'),qs[_0xd8c1('0x26')](_0x4e42f4,!![]),null);}else{if(qs[_0xd8c1('0x27')](_0x4e42f4)){_0x3cb0d4['or'](_0xd8c1('0x28'),_0x257eff+'%');_0x3cb0d4['or']('c.phone\x20LIKE\x20?',_0x257eff+'%');_0x3cb0d4['or'](_0xd8c1('0x29'),_0x257eff+'%');_0x3cb0d4['or'](_0xd8c1('0x2a'),_0x257eff+'%');}else if(qs[_0xd8c1('0x2b')](_0x4e42f4)){_0x3cb0d4['or'](_0xd8c1('0x2c'),_0x257eff+'%');}else{_0x3cb0d4['or']('c.firstName\x20LIKE\x20?','%'+_0x257eff+'%');_0x3cb0d4['or'](_0xd8c1('0x2d'),'%'+_0x257eff+'%');_0x3cb0d4['or'](_0xd8c1('0x2c'),'%'+_0x257eff+'%');}}}return _0x3cb0d4;}function parseAdvancedSearchFilter(_0x7a5a51,_0x8ce284){var _0x203f1d=getSqlClauses();var _0x39b745=as['parseSearch'](_0x7a5a51);var _0x2d724f=_0x39b745[_0xd8c1('0x2e')];for(var _0x48fe02=0x0;_0x48fe02<_0x39b745[_0xd8c1('0x2f')]['length'];_0x48fe02++){var _0x2bf99e=_0x39b745[_0xd8c1('0x2f')][_0x48fe02];var _0x28a3b2='c';var _0x34efcb=_[_0xd8c1('0x30')](_0x8ce284,[_0xd8c1('0x31'),_0x2bf99e[_0xd8c1('0x1c')]]);if(_0x34efcb){if(_0x2bf99e[_0xd8c1('0x1c')]==='dateOfBirth'||_0x34efcb[_0xd8c1('0x32')]==='datetime'){_0x2bf99e['castTo']='DATE';}var _0x1620b0=as[_0xd8c1('0x33')](_0x28a3b2,_0x34efcb[_0xd8c1('0x34')],_0x2bf99e);_0x203f1d['default'][_0x2d724f](_0x1620b0[_0xd8c1('0x35')],_0x1620b0[_0xd8c1('0x36')]['start'],_0x1620b0[_0xd8c1('0x36')][_0xd8c1('0x37')]);}else{if(_0x2bf99e[_0xd8c1('0x1c')]==='Tag'){var _0x52283c=_0x2bf99e[_0xd8c1('0x36')][_0xd8c1('0x23')](',')[_0xd8c1('0x38')](function(_0x3e831f){return Number(_0x3e831f);});var _0x47d2d4=parseTagParameter(_0x52283c);_0x203f1d[_0xd8c1('0x39')][_0xd8c1('0x3a')][_0xd8c1('0x3b')](_0x47d2d4);_0x203f1d[_0xd8c1('0x39')][_0xd8c1('0x3c')]=_0x52283c;}else if(_0x2bf99e['field']===_0xd8c1('0x3d')){_0x203f1d[_0xd8c1('0x3e')][_0xd8c1('0x3a')]['and'](_0xd8c1('0x3f'),_0x2bf99e[_0xd8c1('0x36')]);_0x203f1d[_0xd8c1('0x3e')][_0xd8c1('0x40')]=!![];}}}return _0x203f1d;}function parseModelFields(_0x7f6314,_0x17cb5e){var _0x535920=squel[_0xd8c1('0x1e')]();var _0x4b3503=_(_0x7f6314)['keys']()[_0xd8c1('0x38')](function(_0xdef114){return _[_0xd8c1('0x41')](_0x17cb5e,[_0xd8c1('0x31'),_0xdef114])?_0xdef114:undefined;})[_0xd8c1('0x42')]()[_0xd8c1('0x36')]();if(_0x7f6314[_0xd8c1('0x43')]){_0x4b3503[_0xd8c1('0x19')](_0xd8c1('0x43'));}if(_0x7f6314['User']){_0x4b3503[_0xd8c1('0x19')]('User');}if(_0x4b3503[_0xd8c1('0x24')]>0x0){_0x4b3503[_0xd8c1('0x1a')](function(_0x66628){if(_0x66628===_0xd8c1('0x15')){_0x535920[_0xd8c1('0x3b')](_0xd8c1('0x44'),[][_0xd8c1('0x45')](_0x7f6314[_0x66628]));}else if(_0x66628==='Contact'){var _0x2772f5='%'+_0x7f6314[_0x66628]+'%';_0x535920['and']('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x2772f5);}else if(_0x66628===_0xd8c1('0x3d')){_0x535920[_0xd8c1('0x3b')](_0xd8c1('0x3f'),_0x7f6314[_0x66628]);}else{_0x535920[_0xd8c1('0x3b')]('c.'+_0x66628+'\x20=\x20?',_0x7f6314[_0x66628]);}});}return _0x535920;}function parseQueryParameters(_0x5df551,_0x28683a){var _0x380249=getSqlClauses();return Promise[_0xd8c1('0x46')]()['then'](function(){return parseModelFields(_0x5df551,_0x28683a);})['then'](function(_0x36a0b3){_0x380249['fields'][_0xd8c1('0x3b')](_0x36a0b3);return parseTagParameter(_0x5df551[_0xd8c1('0x47')]);})['then'](function(_0x8969c8){_0x380249['tags'][_0xd8c1('0x3a')][_0xd8c1('0x3b')](_0x8969c8);return parseSearchFilter(_0x5df551[_0xd8c1('0x48')]);})['then'](function(_0x4a173e){_0x380249[_0xd8c1('0x48')]=_0x4a173e;return _0x380249;});}function checkListsRestrictions(_0x2c4ce1,_0x1423a9,_0x4e0c8d){var _0x3e7cf3=squel[_0xd8c1('0x1e')]();return Promise['resolve']()[_0xd8c1('0x49')](function(){if(_0x1423a9[_0xd8c1('0x6')]&&_0x2c4ce1[_0xd8c1('0x5')]===_0xd8c1('0x4a')&&!_0x4e0c8d){return _0x2c4ce1[_0xd8c1('0x4b')]({'attributes':['id'],'raw':!![]});}})[_0xd8c1('0x49')](function(_0x4ab1b5){if(_0x4ab1b5){if(_0x4ab1b5[_0xd8c1('0x24')]===0x0){_0x3e7cf3['and'](_0xd8c1('0x4c'));}else{_0x3e7cf3[_0xd8c1('0x3b')](_0xd8c1('0x44'),_[_0xd8c1('0x38')](_0x4ab1b5,'id'));}}})[_0xd8c1('0x49')](function(){return _0x3e7cf3;});}function buildContactsQuery(_0x53205e,_0x596dc7,_0x544273,_0x32bc37,_0x4e4782,_0x3d5c9b){if(_0x596dc7){_0x596dc7=_0x544273[_0xd8c1('0x4d')];}_0x53205e=addFieldsToQuery(_0x53205e,_0x596dc7,_0x32bc37,_0x3d5c9b,!![]);var _0x44cf94=squel[_0xd8c1('0x7')]();_0x44cf94=addFieldsToQuery(_0x44cf94,_0x596dc7,_0x32bc37,_0x3d5c9b,![]);if(_0x32bc37||_0x3d5c9b){_0x53205e=applyJoinClauses(_0x53205e,!![]);_0x53205e[_0xd8c1('0x4e')](_0xd8c1('0x4f'));if(_0x544273[_0xd8c1('0x50')]){_0x44cf94[_0xd8c1('0x50')](_0x544273[_0xd8c1('0x50')]);}if(_0x544273[_0xd8c1('0x51')]){_0x44cf94['offset'](_0x544273['offset']);}}else{_0x44cf94=applyJoinClauses(_0x44cf94,![]);_0x44cf94[_0xd8c1('0x4e')]('subqry.id');if(_0x544273['limit']){_0x53205e['limit'](_0x544273[_0xd8c1('0x50')]);}if(_0x544273[_0xd8c1('0x51')]){_0x53205e[_0xd8c1('0x51')](_0x544273[_0xd8c1('0x51')]);}}_0x44cf94[_0xd8c1('0x52')](_0x4e4782);if(_0x544273[_0xd8c1('0x53')]){_0x544273[_0xd8c1('0x53')][_0xd8c1('0x1a')](function(_0x49e34c){_0x53205e[_0xd8c1('0x53')]('c.'+_0x49e34c[0x0],_0x49e34c[0x1]===_0xd8c1('0x54')?![]:!![]);_0x44cf94[_0xd8c1('0x53')](_0xd8c1('0x55')+_0x49e34c[0x0],_0x49e34c[0x1]===_0xd8c1('0x54')?![]:!![]);});}_0x44cf94[_0xd8c1('0x56')](_0x53205e,_0xd8c1('0xb'));return _0x44cf94;}function getFilteredContacts(_0x37e3e6){var _0x1400b4=[];return db['Tag'][_0xd8c1('0x57')]({'attributes':['id',_0xd8c1('0x31'),'color'],'raw':!![]})['then'](function(_0x3b4c33){_0x1400b4=_[_0xd8c1('0x58')](_0x3b4c33,'id');var _0x46c0bb={'type':db[_0xd8c1('0x59')][_0xd8c1('0x5a')][_0xd8c1('0x5b')],'model':db[_0xd8c1('0x5c')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xd8c1('0x5d')][_0xd8c1('0x5e')](_0x37e3e6[_0xd8c1('0x5f')](),_0x46c0bb);})[_0xd8c1('0x49')](function(_0x476177){_0x476177[_0xd8c1('0x1a')](function(_0x761395){if(_0x761395[_0xd8c1('0x1b')]){_0x761395[_0xd8c1('0x60')]=[];_0x761395['TagIds'][_0xd8c1('0x23')](',')[_0xd8c1('0x1a')](function(_0x43d9b7){_0x761395['Tags']['push'](_0x1400b4[_0x43d9b7]);});}delete _0x761395[_0xd8c1('0x1b')];});return _0x476177;});}function countFilteredContacts(_0x3db27d,_0x1ca7bc){var _0x5a11e5=_0x3db27d[_0xd8c1('0x61')]();_0x5a11e5['field']('COUNT(*)');_0x5a11e5=applyJoinClauses(_0x5a11e5,!![]);_0x3db27d[_0xd8c1('0x4e')](_0xd8c1('0x4f'));var _0x24a045=utils['getSelectedTags'](_0x1ca7bc);if(!_[_0xd8c1('0x62')](_0x24a045)){_0x5a11e5[_0xd8c1('0x9')]('t.id\x20IN\x20?',_0x24a045);}var _0x1b28b8={'type':db[_0xd8c1('0x59')]['QueryTypes']['SELECT'],'raw':!![]};return db['sequelize'][_0xd8c1('0x5e')](_0x5a11e5['toString'](),_0x1b28b8)[_0xd8c1('0x49')](function(_0x1a0d8b){return _0x1a0d8b[0x0][_0xd8c1('0x63')];});}module[_0xd8c1('0x64')]={'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 9fe4514..4e8472d 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 _0x2086=['encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','close','unlink','decryptFile','createDecipher','encryptString','secret','utf8','base64','decryptString','lodash','../../config/environment','app','secrets','session','aes-256-ctr','aes192','algorithm','encrypt','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','hasOwnProperty'];(function(_0x34a8c8,_0x31e259){var _0x1fe6e5=function(_0x30f28d){while(--_0x30f28d){_0x34a8c8['push'](_0x34a8c8['shift']());}};_0x1fe6e5(++_0x31e259);}(_0x2086,0xbd));var _0x6208=function(_0x3e8a26,_0x5e52bd){_0x3e8a26=_0x3e8a26-0x0;var _0x506a43=_0x2086[_0x3e8a26];return _0x506a43;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x6208('0x0'));var config=require(_0x6208('0x1'));var logger=require('../../config/logger')(_0x6208('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x6208('0x3')][_0x6208('0x4')],'algorithm':_0x6208('0x5')};const fileOptions={'algorithm':_0x6208('0x6')};if(config['encrypt']&&config['encrypt'][_0x6208('0x7')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x6208('0x7')]);if(isSupported){fileOptions[_0x6208('0x7')]=config[_0x6208('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x6208('0x9')](',\x20');logger[_0x6208('0xa')](config['encrypt'][_0x6208('0x7')],_0x6208('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x18e27f){return AES_SUPPORTED_RX['test'](_0x18e27f);}function getSupportedCiphers(){return crypto[_0x6208('0xc')]()[_0x6208('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x5c22cb){return getSupportedCiphers()['indexOf'](_0x5c22cb)>-0x1;}function combineOptions(_0x40c668){var _0x3ca536={};for(var _0x24a94e in fileOptions){if(fileOptions[_0x6208('0xe')](_0x24a94e)){_0x3ca536[_0x24a94e]=fileOptions[_0x24a94e];}}if(_0x40c668){for(var _0x15a763 in _0x40c668){if(_0x40c668[_0x6208('0xe')](_0x15a763)){_0x3ca536[_0x15a763]=_0x40c668[_0x15a763];}}}return _0x3ca536;}exports[_0x6208('0xf')]=function(_0x1efe5a,_0x3f8b7a,_0x157dc9,_0x27d1c4){return new BPromise(function(_0x29f74c,_0xb3cba1){_0x27d1c4=combineOptions(_0x27d1c4);var _0x57da02=new Buffer(_0x157dc9);var _0x1da1ef=fs[_0x6208('0x10')](_0x1efe5a);var _0x189c8f=fs[_0x6208('0x11')](_0x3f8b7a);var _0x5e127c=crypto[_0x6208('0x12')](_0x27d1c4[_0x6208('0x7')],_0x57da02);_0x1da1ef['on'](_0x6208('0x13'),function(_0x2d7ffb){var _0x57e58a=new Buffer(_0x5e127c[_0x6208('0x14')](_0x2d7ffb),_0x6208('0x15'));_0x189c8f[_0x6208('0x16')](_0x57e58a);});_0x1da1ef['on'](_0x6208('0x17'),function(){try{var _0x42c1e6=new Buffer(_0x5e127c[_0x6208('0x18')]('binary'),_0x6208('0x15'));_0x189c8f[_0x6208('0x16')](_0x42c1e6);_0x189c8f['end']();_0x189c8f['on'](_0x6208('0x19'),function(){return _0x29f74c(_0x3f8b7a);});}catch(_0x504cca){fs[_0x6208('0x1a')](_0x3f8b7a);return _0xb3cba1(_0x504cca);}});});};exports[_0x6208('0x1b')]=function(_0x3c6909,_0x4750bf,_0x34bb87,_0x3d396a){return new BPromise(function(_0x4c0f33,_0x36e600){_0x3d396a=combineOptions(_0x3d396a);var _0x1dd684=new Buffer(_0x34bb87);var _0x3ff724=fs[_0x6208('0x10')](_0x3c6909);var _0x9b58b=fs[_0x6208('0x11')](_0x4750bf);var _0x20bd68=crypto[_0x6208('0x1c')](_0x3d396a[_0x6208('0x7')],_0x1dd684);_0x3ff724['on'](_0x6208('0x13'),function(_0x1a36fe){var _0x50d970=new Buffer(_0x20bd68[_0x6208('0x14')](_0x1a36fe),_0x6208('0x15'));_0x9b58b[_0x6208('0x16')](_0x50d970);});_0x3ff724['on'](_0x6208('0x17'),function(){try{var _0xaab259=new Buffer(_0x20bd68[_0x6208('0x18')](_0x6208('0x15')),_0x6208('0x15'));_0x9b58b[_0x6208('0x16')](_0xaab259);_0x9b58b[_0x6208('0x17')]();_0x9b58b['on'](_0x6208('0x19'),function(){return _0x4c0f33(_0x4750bf);});}catch(_0x53db15){fs[_0x6208('0x1a')](_0x4750bf);return _0x36e600(_0x53db15);}});});};exports[_0x6208('0x1d')]=function(_0x4faeaf,_0x3d429d,_0x128c24){var _0x1844e9=_0x128c24||stringOptions[_0x6208('0x7')];var _0x5b215e=_0x3d429d||stringOptions[_0x6208('0x1e')];var _0x32dbad=crypto[_0x6208('0x12')](_0x1844e9,_0x5b215e);var _0x3ae339=_0x32dbad[_0x6208('0x14')](_0x4faeaf,_0x6208('0x1f'),_0x6208('0x20'));_0x3ae339+=_0x32dbad[_0x6208('0x18')](_0x6208('0x20'));return _0x3ae339;};exports[_0x6208('0x21')]=function(_0xbe553f,_0x296ca0,_0x4eca2c){var _0x3c88c8=_0x4eca2c||stringOptions['algorithm'];var _0x3cc933=_0x296ca0||stringOptions['secret'];var _0x3fa6bd=crypto[_0x6208('0x1c')](_0x3c88c8,_0x3cc933);var _0x416f81=_0x3fa6bd[_0x6208('0x14')](_0xbe553f,_0x6208('0x20'),'utf8');_0x416f81+=_0x3fa6bd[_0x6208('0x18')](_0x6208('0x1f'));return _0x416f81;}; \ No newline at end of file +var _0x480e=['lodash','../../config/environment','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','error','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','end','final','write','close','unlink','decryptFile','createDecipher','encryptString','secret','utf8','base64','decryptString','crypto'];(function(_0x49e133,_0x39faa7){var _0x1c08ae=function(_0x51e56c){while(--_0x51e56c){_0x49e133['push'](_0x49e133['shift']());}};_0x1c08ae(++_0x39faa7);}(_0x480e,0x87));var _0xe480=function(_0xc29f07,_0x121b16){_0xc29f07=_0xc29f07-0x0;var _0x480acc=_0x480e[_0xc29f07];return _0x480acc;};'use strict';var crypto=require(_0xe480('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xe480('0x1'));var config=require(_0xe480('0x2'));var logger=require(_0xe480('0x3'))(_0xe480('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xe480('0x5')]['session'],'algorithm':_0xe480('0x6')};const fileOptions={'algorithm':_0xe480('0x7')};if(config[_0xe480('0x8')]&&config[_0xe480('0x8')][_0xe480('0x9')]){var isSupported=isAlgorithmSupported(config[_0xe480('0x8')][_0xe480('0x9')]);if(isSupported){fileOptions[_0xe480('0x9')]=config['encrypt'][_0xe480('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xe480('0xa')](config[_0xe480('0x8')][_0xe480('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x1e0ba6){return AES_SUPPORTED_RX[_0xe480('0xb')](_0x1e0ba6);}function getSupportedCiphers(){return crypto[_0xe480('0xc')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x1c6e5e){return getSupportedCiphers()[_0xe480('0xd')](_0x1c6e5e)>-0x1;}function combineOptions(_0x3728b9){var _0x34a261={};for(var _0x54f9a0 in fileOptions){if(fileOptions['hasOwnProperty'](_0x54f9a0)){_0x34a261[_0x54f9a0]=fileOptions[_0x54f9a0];}}if(_0x3728b9){for(var _0x26763f in _0x3728b9){if(_0x3728b9[_0xe480('0xe')](_0x26763f)){_0x34a261[_0x26763f]=_0x3728b9[_0x26763f];}}}return _0x34a261;}exports[_0xe480('0xf')]=function(_0x387507,_0x2513a7,_0x1e25ab,_0x556ab6){return new BPromise(function(_0x242388,_0x333114){_0x556ab6=combineOptions(_0x556ab6);var _0x3e10e0=new Buffer(_0x1e25ab);var _0x55268d=fs[_0xe480('0x10')](_0x387507);var _0x241d33=fs[_0xe480('0x11')](_0x2513a7);var _0xcdc722=crypto[_0xe480('0x12')](_0x556ab6['algorithm'],_0x3e10e0);_0x55268d['on'](_0xe480('0x13'),function(_0x39870f){var _0x349e0e=new Buffer(_0xcdc722[_0xe480('0x14')](_0x39870f),_0xe480('0x15'));_0x241d33['write'](_0x349e0e);});_0x55268d['on'](_0xe480('0x16'),function(){try{var _0x4a7b76=new Buffer(_0xcdc722[_0xe480('0x17')](_0xe480('0x15')),_0xe480('0x15'));_0x241d33[_0xe480('0x18')](_0x4a7b76);_0x241d33[_0xe480('0x16')]();_0x241d33['on'](_0xe480('0x19'),function(){return _0x242388(_0x2513a7);});}catch(_0x54a1a3){fs[_0xe480('0x1a')](_0x2513a7);return _0x333114(_0x54a1a3);}});});};exports[_0xe480('0x1b')]=function(_0x446d45,_0x232920,_0x165687,_0x2e5f96){return new BPromise(function(_0x1f206c,_0x553eb5){_0x2e5f96=combineOptions(_0x2e5f96);var _0x8d2120=new Buffer(_0x165687);var _0x8e3565=fs[_0xe480('0x10')](_0x446d45);var _0x1fd30f=fs[_0xe480('0x11')](_0x232920);var _0x229357=crypto[_0xe480('0x1c')](_0x2e5f96[_0xe480('0x9')],_0x8d2120);_0x8e3565['on']('data',function(_0x385114){var _0x426fd4=new Buffer(_0x229357[_0xe480('0x14')](_0x385114),_0xe480('0x15'));_0x1fd30f[_0xe480('0x18')](_0x426fd4);});_0x8e3565['on'](_0xe480('0x16'),function(){try{var _0x4315ee=new Buffer(_0x229357['final'](_0xe480('0x15')),_0xe480('0x15'));_0x1fd30f['write'](_0x4315ee);_0x1fd30f[_0xe480('0x16')]();_0x1fd30f['on'](_0xe480('0x19'),function(){return _0x1f206c(_0x232920);});}catch(_0x568b44){fs['unlink'](_0x232920);return _0x553eb5(_0x568b44);}});});};exports[_0xe480('0x1d')]=function(_0x35bc23,_0x31fd75,_0x1c197d){var _0x24aa98=_0x1c197d||stringOptions[_0xe480('0x9')];var _0xeb7b1f=_0x31fd75||stringOptions[_0xe480('0x1e')];var _0x349af7=crypto[_0xe480('0x12')](_0x24aa98,_0xeb7b1f);var _0x4c56d6=_0x349af7[_0xe480('0x14')](_0x35bc23,_0xe480('0x1f'),_0xe480('0x20'));_0x4c56d6+=_0x349af7['final']('base64');return _0x4c56d6;};exports[_0xe480('0x21')]=function(_0x41cd87,_0x43ef5e,_0x14954a){var _0x4e7550=_0x14954a||stringOptions[_0xe480('0x9')];var _0x1c8bfa=_0x43ef5e||stringOptions[_0xe480('0x1e')];var _0x5f07a9=crypto['createDecipher'](_0x4e7550,_0x1c8bfa);var _0x57474a=_0x5f07a9[_0xe480('0x14')](_0x41cd87,_0xe480('0x20'),'utf8');_0x57474a+=_0x5f07a9[_0xe480('0x17')](_0xe480('0x1f'));return _0x57474a;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index f81777f..de7b79a 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 _0xa7e4=['update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','then','splitSizeCsv','sequelize','query','format','SELECT','num','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','.csv','existsSync','join','mkdirSync','each','csv','%s.%s','zip\x20finished','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport'];(function(_0x40e282,_0x249007){var _0x1254e5=function(_0x5affca){while(--_0x5affca){_0x40e282['push'](_0x40e282['shift']());}};_0x1254e5(++_0x249007);}(_0xa7e4,0xd0));var _0x4a7e=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xa7e4[_0x255d5b];return _0x3e141a;};'use strict';var util=require(_0x4a7e('0x0'));var path=require(_0x4a7e('0x1'));var _=require(_0x4a7e('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x4a7e('0x3'));var zipdir=require(_0x4a7e('0x4'));var rimraf=require(_0x4a7e('0x5'));var db=require(_0x4a7e('0x6'))['db'];var dbH=require('../../mysqldb')[_0x4a7e('0x7')];var logger=require(_0x4a7e('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x4a7e('0x9')][0x2]);var QUERY=process[_0x4a7e('0x9')][0x3];var PATH=process[_0x4a7e('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5d72b0,_0x4932fb){var _0x489444={'status':_0x5d72b0};var _0x485ed9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4932fb){_0x489444[_0x4a7e('0xa')]=_0x4932fb;}return db[_0x4a7e('0xb')][_0x4a7e('0xc')](_0x489444,_0x485ed9);}function main(){var _0x3ef4b3=0x1388;var _0x4117a8;logger[_0x4a7e('0xd')](util['format'](_0x4a7e('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x4a7e('0xf')][_0x4a7e('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4a7e('0x11'),'splitSizeCsv']})[_0x4a7e('0x12')](function(_0x20ea26){if(_0x20ea26){_0x4117a8=_0x20ea26;_0x3ef4b3=_0x4117a8[_0x4a7e('0x13')]||0x1388;}})[_0x4a7e('0x12')](function(){return dbH[_0x4a7e('0x14')][_0x4a7e('0x15')](util[_0x4a7e('0x16')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x4a7e('0x14')]['QueryTypes'][_0x4a7e('0x17')]});})[_0x4a7e('0x12')](function(_0x11acba){if(!_0x11acba[0x0][_0x4a7e('0x18')]){return analyticExtractedReport('Empty');}var _0x1303f3=[];var _0x3fb666=0x0;if(_0x4117a8[_0x4a7e('0x11')]){if(_0x11acba&&_0x11acba[_0x4a7e('0x19')]){var _0x38bc41=_['range'](_0x11acba[0x0]['num']/_0x3ef4b3);var _0x2f034a=Number[_0x4a7e('0x1a')](_0x11acba[0x0][_0x4a7e('0x18')]/_0x3ef4b3)?_0x11acba[0x0][_0x4a7e('0x18')]%_0x3ef4b3:0x0;_0x38bc41[_0x4a7e('0x1b')](function(_0x3867c8){if(_0x3867c8>0x0){_0x3fb666+=_0x3ef4b3;}_0x1303f3[_0x4a7e('0x1c')](dbH[_0x4a7e('0x14')][_0x4a7e('0x15')](util[_0x4a7e('0x16')](_0x4a7e('0x1d'),QUERY,_0x3ef4b3,_0x3fb666),{'type':dbH[_0x4a7e('0x14')]['QueryTypes']['SELECT']}));});if(_0x2f034a>0x0){_0x3fb666+=_0x3ef4b3;_0x1303f3[_0x4a7e('0x1c')](dbH[_0x4a7e('0x14')][_0x4a7e('0x15')](util['format'](_0x4a7e('0x1d'),QUERY,_0x2f034a,_0x3fb666),{'type':dbH[_0x4a7e('0x14')][_0x4a7e('0x1e')][_0x4a7e('0x17')]}));}}}else{_0x1303f3['push'](dbH[_0x4a7e('0x14')]['query'](QUERY,{'type':dbH[_0x4a7e('0x14')][_0x4a7e('0x1e')][_0x4a7e('0x17')]}));}var _0x393e97=path['dirname'](PATH);var _0x59955c=path['basename'](PATH,_0x4a7e('0x1f'));var _0x2e7edb=_0x4117a8[_0x4a7e('0x11')]&&_0x1303f3['length']>0x1;var _0x3d5d08=[];if(!fs[_0x4a7e('0x20')](path[_0x4a7e('0x21')](_0x393e97,_0x59955c))&&_0x2e7edb){fs[_0x4a7e('0x22')](path['join'](_0x393e97,_0x59955c));}return BPromise[_0x4a7e('0x23')](_0x1303f3,function(_0x48102f){_0x3d5d08[_0x4a7e('0x1c')](_0x48102f);})[_0x4a7e('0x12')](function(){for(var _0x53450c=0x0;_0x53450c<_0x3d5d08[_0x4a7e('0x19')];_0x53450c+=0x1){var _0x456071;var _0x19b55d=_0x3d5d08[_0x53450c];if(_0x2e7edb){_0x456071=path[_0x4a7e('0x21')](_0x393e97,_0x59955c,util[_0x4a7e('0x16')]('%s%d.%s',_0x59955c,_0x53450c,_0x4a7e('0x24')));}else{_0x456071=path[_0x4a7e('0x21')](_0x393e97,util[_0x4a7e('0x16')](_0x4a7e('0x25'),_0x59955c,_0x4a7e('0x24')));}fs['writeFileSync'](_0x456071,csv(_0x19b55d));}})[_0x4a7e('0x12')](function(){if(_0x2e7edb){return new Promise(function(_0x500030){zipdir(path['join'](_0x393e97,_0x59955c),{'saveTo':path[_0x4a7e('0x21')](_0x393e97,util['format']('%s.%s',_0x59955c,'zip'))},function(_0x50e992,_0x1d623c){rimraf(path[_0x4a7e('0x21')](_0x393e97,_0x59955c),function(){});_0x500030(_0x4a7e('0x26'));});});}})[_0x4a7e('0x12')](function(){logger[_0x4a7e('0xd')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x4a7e('0x27'),_0x2e7edb?util[_0x4a7e('0x16')](_0x4a7e('0x25'),_0x59955c,_0x2e7edb?_0x4a7e('0x28'):'csv'):null);});})['catch'](function(_0x4af9c7){logger[_0x4a7e('0xd')](util[_0x4a7e('0x16')](_0x4a7e('0x29'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x4af9c7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4a7e('0x2a'));})['finally'](function(){process[_0x4a7e('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xdc70=['analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','isInteger','forEach','push','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','mkdirSync','join','each','csv','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','to-csv','zip-dir','dbH','../../config/logger'];(function(_0x3b3cc6,_0x1a6e24){var _0x1161e4=function(_0x19cc52){while(--_0x19cc52){_0x3b3cc6['push'](_0x3b3cc6['shift']());}};_0x1161e4(++_0x1a6e24);}(_0xdc70,0x10e));var _0x0dc7=function(_0x5a74c1,_0x4f92e7){_0x5a74c1=_0x5a74c1-0x0;var _0x1d9d76=_0xdc70[_0x5a74c1];return _0x1d9d76;};'use strict';var util=require(_0x0dc7('0x0'));var path=require(_0x0dc7('0x1'));var _=require('lodash');var csv=require(_0x0dc7('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x0dc7('0x3'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x0dc7('0x4')];var logger=require(_0x0dc7('0x5'))(_0x0dc7('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0dc7('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x0dc7('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2b519d,_0x427358){var _0x2f871d={'status':_0x2b519d};var _0x11584c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x427358){_0x2f871d[_0x0dc7('0x8')]=_0x427358;}return db[_0x0dc7('0x9')][_0x0dc7('0xa')](_0x2f871d,_0x11584c);}function main(){var _0x486679=0x1388;var _0x23bcb3;logger['info'](util[_0x0dc7('0xb')](_0x0dc7('0xc'),EXTRACTED_REPORT_ID,_0x0dc7('0xd')));return db['Setting'][_0x0dc7('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0dc7('0xf'),_0x0dc7('0x10')]})[_0x0dc7('0x11')](function(_0x1e5f33){if(_0x1e5f33){_0x23bcb3=_0x1e5f33;_0x486679=_0x23bcb3[_0x0dc7('0x10')]||0x1388;}})[_0x0dc7('0x11')](function(){return dbH['sequelize']['query'](util[_0x0dc7('0xb')](_0x0dc7('0x12'),QUERY),{'type':dbH['sequelize'][_0x0dc7('0x13')][_0x0dc7('0x14')]});})[_0x0dc7('0x11')](function(_0x3a52da){if(!_0x3a52da[0x0]['num']){return analyticExtractedReport(_0x0dc7('0x15'));}var _0x6784d8=[];var _0x2911d9=0x0;if(_0x23bcb3[_0x0dc7('0xf')]){if(_0x3a52da&&_0x3a52da[_0x0dc7('0x16')]){var _0x1762e8=_[_0x0dc7('0x17')](_0x3a52da[0x0]['num']/_0x486679);var _0x2a8bd7=Number[_0x0dc7('0x18')](_0x3a52da[0x0]['num']/_0x486679)?_0x3a52da[0x0]['num']%_0x486679:0x0;_0x1762e8[_0x0dc7('0x19')](function(_0x83c868){if(_0x83c868>0x0){_0x2911d9+=_0x486679;}_0x6784d8[_0x0dc7('0x1a')](dbH[_0x0dc7('0x1b')][_0x0dc7('0x1c')](util['format'](_0x0dc7('0x1d'),QUERY,_0x486679,_0x2911d9),{'type':dbH[_0x0dc7('0x1b')][_0x0dc7('0x13')][_0x0dc7('0x14')]}));});if(_0x2a8bd7>0x0){_0x2911d9+=_0x486679;_0x6784d8[_0x0dc7('0x1a')](dbH[_0x0dc7('0x1b')][_0x0dc7('0x1c')](util[_0x0dc7('0xb')](_0x0dc7('0x1d'),QUERY,_0x2a8bd7,_0x2911d9),{'type':dbH['sequelize'][_0x0dc7('0x13')][_0x0dc7('0x14')]}));}}}else{_0x6784d8['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x0dc7('0x1b')][_0x0dc7('0x13')][_0x0dc7('0x14')]}));}var _0x4017f8=path[_0x0dc7('0x1e')](PATH);var _0xab0401=path[_0x0dc7('0x1f')](PATH,_0x0dc7('0x20'));var _0x519114=_0x23bcb3[_0x0dc7('0xf')]&&_0x6784d8['length']>0x1;var _0x5bee3d=[];if(!fs['existsSync'](path['join'](_0x4017f8,_0xab0401))&&_0x519114){fs[_0x0dc7('0x21')](path[_0x0dc7('0x22')](_0x4017f8,_0xab0401));}return BPromise[_0x0dc7('0x23')](_0x6784d8,function(_0x1c2dbb){_0x5bee3d[_0x0dc7('0x1a')](_0x1c2dbb);})[_0x0dc7('0x11')](function(){for(var _0x3edbd2=0x0;_0x3edbd2<_0x5bee3d[_0x0dc7('0x16')];_0x3edbd2+=0x1){var _0x493814;var _0x13f3c5=_0x5bee3d[_0x3edbd2];if(_0x519114){_0x493814=path[_0x0dc7('0x22')](_0x4017f8,_0xab0401,util[_0x0dc7('0xb')]('%s%d.%s',_0xab0401,_0x3edbd2,_0x0dc7('0x24')));}else{_0x493814=path[_0x0dc7('0x22')](_0x4017f8,util[_0x0dc7('0xb')]('%s.%s',_0xab0401,_0x0dc7('0x24')));}fs['writeFileSync'](_0x493814,csv(_0x13f3c5));}})[_0x0dc7('0x11')](function(){if(_0x519114){return new Promise(function(_0x690e79){zipdir(path[_0x0dc7('0x22')](_0x4017f8,_0xab0401),{'saveTo':path['join'](_0x4017f8,util[_0x0dc7('0xb')](_0x0dc7('0x25'),_0xab0401,_0x0dc7('0x26')))},function(_0x3acd91,_0x4d9de8){rimraf(path[_0x0dc7('0x22')](_0x4017f8,_0xab0401),function(){});_0x690e79(_0x0dc7('0x27'));});});}})[_0x0dc7('0x11')](function(){logger[_0x0dc7('0x28')](util[_0x0dc7('0xb')](_0x0dc7('0x29'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x519114?util[_0x0dc7('0xb')]('%s.%s',_0xab0401,_0x519114?'zip':_0x0dc7('0x24')):null);});})[_0x0dc7('0x2a')](function(_0x33d4ff){logger['info'](util['format'](_0x0dc7('0x2b'),EXTRACTED_REPORT_ID,_0x0dc7('0xd')),util[_0x0dc7('0x2c')](_0x33d4ff,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0dc7('0x2d'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index ac5b5eb..ab73de5 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 _0x2a07=['Arial','black','num','Setting','find','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','split','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','zip\x20finished','info','PDF','zip','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','pipe','createWriteStream','finish','error','end','createPdfFromHTML','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','tableHeader','pick','map','toString','value','fill','length','auto','body','push','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','endDate','header','before','margin','\x20/\x20','footer'];(function(_0x5d5b69,_0x1111ab){var _0xf82413=function(_0x3a1f48){while(--_0x3a1f48){_0x5d5b69['push'](_0x5d5b69['shift']());}};_0xf82413(++_0x1111ab);}(_0x2a07,0x18a));var _0x72a0=function(_0xe7281f,_0x2d77c3){_0xe7281f=_0xe7281f-0x0;var _0x90dc99=_0x2a07[_0xe7281f];return _0x90dc99;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x72a0('0x0'));var path=require(_0x72a0('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0x72a0('0x2'));var PdfPrinter=require(_0x72a0('0x3'));var zipdir=require(_0x72a0('0x4'));var rimraf=require(_0x72a0('0x5'));var JSDOM=require(_0x72a0('0x6'))[_0x72a0('0x7')];var window=new JSDOM('')[_0x72a0('0x8')];var BPromise=require(_0x72a0('0x9'));var db=require(_0x72a0('0xa'))['db'];var dbH=require(_0x72a0('0xa'))[_0x72a0('0xb')];var logger=require(_0x72a0('0xc'))(_0x72a0('0xd'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x72a0('0xe')][0x3];var PATH=process[_0x72a0('0xe')][0x4];var NAME=process[_0x72a0('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x521612,_0x2211db){var _0x1b5e46={'status':_0x521612};var _0x55a2db={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2211db){_0x1b5e46['savename']=_0x2211db;}return db[_0x72a0('0xf')]['update'](_0x1b5e46,_0x55a2db);}function getHeaders(_0xaba689){return _['map'](_0xaba689,function(_0x1e66a1){return{'text':_0x1e66a1,'style':_0x72a0('0x10')};});}function getRows(_0x599910,_0xfded6e){return _['map'](_0xfded6e,function(_0x4b622a){return _(_0x4b622a)[_0x72a0('0x11')](_0x599910)[_0x72a0('0x12')](function(_0x4a83b7){return _0x4a83b7?_[_0x72a0('0x13')](_0x4a83b7):'';})[_0x72a0('0x14')]();});}function createTable(_0x333315,_0x301b7d){var _0x58e15e={'widths':_[_0x72a0('0x15')](Array(_0x333315[_0x72a0('0x16')]),0x91),'heights':function(_0x371928){return _0x371928===0x0?_0x72a0('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xc84ff0=getHeaders(_0x333315);_0x58e15e[_0x72a0('0x18')][_0x72a0('0x19')](_0xc84ff0);var _0x81b0aa=getRows(_0x333315,_0x301b7d);_0x58e15e[_0x72a0('0x18')]=_0x58e15e[_0x72a0('0x18')]['concat'](_0x81b0aa);return _0x58e15e;}function createTables(_0x14af58){var _0x169fab=[];var _0x1f82ee=_[_0x72a0('0x1a')](Object['keys'](_0x14af58[0x0]),0x5);_0x1f82ee[_0x72a0('0x1b')](function(_0x2a94d9){_0x169fab[_0x72a0('0x19')](createTable(_0x2a94d9,_0x14af58));});return _0x169fab;}function getPDFDocDefinition(_0x1747dd){var _0x47fb72=util[_0x72a0('0x1c')](_0x72a0('0x1d'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x72a0('0x1e')])[_0x72a0('0x1c')](FORMAT));var _0x285307=[];for(var _0x21f3cb=0x0;_0x21f3cb<_0x1747dd[_0x72a0('0x16')];_0x21f3cb++){var _0x436d50=[];if(_0x21f3cb===0x0){_0x436d50['push']({'text':_0x47fb72,'style':_0x72a0('0x1f')});}var _0x5736da={'table':_0x1747dd[_0x21f3cb]};if(_0x21f3cb>0x0){_0x5736da['pageBreak']=_0x72a0('0x20');_0x5736da[_0x72a0('0x21')]=[0x0,0x46,0x0,0x0];}_0x436d50[_0x72a0('0x19')](_0x5736da);_0x285307['push'](_0x436d50);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x285307,'footer':function(_0x457632,_0x4eeabd){return{'text':_0x457632[_0x72a0('0x13')]()+_0x72a0('0x22')+_0x4eeabd,'style':_0x72a0('0x23')};},'defaultStyle':{'font':_0x72a0('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x72a0('0x25')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x128760){var _0x658260=0x1388;var _0xe5af52;if(!_0x128760[0x0][_0x72a0('0x26')]){return analyticExtractedReport('Empty');}return db[_0x72a0('0x27')][_0x72a0('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x72a0('0x29')]})[_0x72a0('0x2a')](function(_0x4dc3ab){if(_0x4dc3ab){_0xe5af52=_0x4dc3ab;_0x658260=_0xe5af52[_0x72a0('0x29')]||0x3e8;}})[_0x72a0('0x2a')](function(){var _0x27a485=[];var _0x50224a=0x0;if(_0xe5af52['split']){if(_0x128760&&_0x128760[_0x72a0('0x16')]){var _0xd89297=_[_0x72a0('0x2b')](_0x128760[0x0][_0x72a0('0x26')]/_0x658260);var _0x3c0d02=Number[_0x72a0('0x2c')](_0x128760[0x0]['num']/_0x658260)?_0x128760[0x0][_0x72a0('0x26')]%_0x658260:0x0;_0xd89297[_0x72a0('0x1b')](function(_0x35ca8d){if(_0x35ca8d>0x0){_0x50224a+=_0x658260;}_0x27a485[_0x72a0('0x19')](dbH[_0x72a0('0x2d')][_0x72a0('0x2e')](util[_0x72a0('0x1c')](_0x72a0('0x2f'),QUERY,_0x658260,_0x50224a),{'type':dbH[_0x72a0('0x2d')][_0x72a0('0x30')]['SELECT']}));});if(_0x3c0d02>0x0){_0x50224a+=_0x658260;_0x27a485['push'](dbH['sequelize'][_0x72a0('0x2e')](util[_0x72a0('0x1c')](_0x72a0('0x2f'),QUERY,_0x3c0d02,_0x50224a),{'type':dbH['sequelize']['QueryTypes'][_0x72a0('0x31')]}));}}}else{_0x27a485[_0x72a0('0x19')](dbH[_0x72a0('0x2d')][_0x72a0('0x2e')](QUERY,{'type':dbH[_0x72a0('0x2d')][_0x72a0('0x30')][_0x72a0('0x31')]}));}var _0x18d211=path[_0x72a0('0x32')](PATH);var _0x31ff60=path[_0x72a0('0x33')](PATH,_0x72a0('0x34'));var _0x12c309=_0xe5af52[_0x72a0('0x35')]&&_0x27a485[_0x72a0('0x16')]>0x1;var _0x4661d3=[];if(!fs[_0x72a0('0x36')](path[_0x72a0('0x37')](_0x18d211,_0x31ff60))&&_0x12c309){fs[_0x72a0('0x38')](path[_0x72a0('0x37')](_0x18d211,_0x31ff60));}return BPromise[_0x72a0('0x39')](_0x27a485,function(_0x1401ad){_0x4661d3[_0x72a0('0x19')](_0x1401ad);})[_0x72a0('0x2a')](function(){var _0x40b28e=[];for(var _0x2eeb5a=0x0;_0x2eeb5a<_0x4661d3['length'];_0x2eeb5a+=0x1){var _0x5c1240=_0x4661d3[_0x2eeb5a];var _0x35ab93=createTables(_[_0x72a0('0x3a')](_0x5c1240));var _0x457652;var _0x11f233=getPDFDocDefinition(_0x35ab93);var _0x4a3d47=getPDFPrinter();var _0x5768b1=_0x4a3d47[_0x72a0('0x3b')](_0x11f233);if(_0x12c309){_0x457652=path[_0x72a0('0x37')](_0x18d211,_0x31ff60,util['format']('%s%d.%s',_0x31ff60,_0x2eeb5a,_0x72a0('0x3c')));}else{_0x457652=path[_0x72a0('0x37')](_0x18d211,util[_0x72a0('0x1c')](_0x72a0('0x3d'),_0x31ff60,_0x72a0('0x3c')));}_0x40b28e['push'](writePDFDocument(_0x5768b1,_0x457652));}return Promise['all'](_0x40b28e);})[_0x72a0('0x2a')](function(){if(_0x12c309){return new Promise(function(_0x1a9e20){zipdir(path[_0x72a0('0x37')](_0x18d211,_0x31ff60),{'saveTo':path[_0x72a0('0x37')](_0x18d211,util[_0x72a0('0x1c')](_0x72a0('0x3d'),_0x31ff60,'zip'))},function(){rimraf(path[_0x72a0('0x37')](_0x18d211,_0x31ff60),function(){});_0x1a9e20(_0x72a0('0x3e'));});});}})['then'](function(){if(!_0x12c309)return;rimraf(path[_0x72a0('0x37')](_0x18d211,_0x31ff60),function(){});})[_0x72a0('0x2a')](function(){logger[_0x72a0('0x3f')](util[_0x72a0('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x72a0('0x40')));return analyticExtractedReport('Completed',_0x12c309?util[_0x72a0('0x1c')](_0x72a0('0x3d'),_0x31ff60,_0x12c309?_0x72a0('0x41'):_0x72a0('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x72a0('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db[_0x72a0('0xf')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x44f10f){EXTRACTED_REPORT=_0x44f10f;return dbH['sequelize'][_0x72a0('0x2e')](util[_0x72a0('0x1c')](_0x72a0('0x42'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x72a0('0x31')]});})['then'](extractReport)[_0x72a0('0x43')](function(_0x74f96a){logger[_0x72a0('0x3f')](util[_0x72a0('0x1c')](_0x72a0('0x44'),EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x74f96a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x72a0('0x45'));})[_0x72a0('0x46')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3e8c74=new PdfPrinter({'Arial':{'normal':__dirname+_0x72a0('0x47'),'bold':__dirname+_0x72a0('0x48'),'italics':__dirname+_0x72a0('0x49'),'bolditalics':__dirname+_0x72a0('0x4a')}});return _0x3e8c74;}function getPDFDocDefinitionFromHTML(_0x2b6d6b,_0x19ed0d){var _0x3ff40b=util[_0x72a0('0x1c')]('%s\x20#%d',_0x19ed0d[_0x72a0('0x4b')],_0x19ed0d[_0x72a0('0x4c')]);var _0x529be7=moment()['format'](_0x72a0('0x4d'))[_0x72a0('0x13')]();var _0x110be7=htmlToPdfmake(_0x2b6d6b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x110be7],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x72a0('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x72a0('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x72a0('0x4e')}},'header':function(){return[{'text':_0x72a0('0x4f'),'style':_0x72a0('0x1f')}];},'footer':function(_0x3e2c4f,_0x645a26){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x3ff40b,_0x3e2c4f,_0x645a26,_0x529be7),'style':'footer'}];}};}function writePDFDocument(_0x542857,_0x1ac2d3){return new Promise(function(_0x180d0e,_0x4edb2f){var _0x181312=_0x542857[_0x72a0('0x50')](fs[_0x72a0('0x51')](_0x1ac2d3));_0x181312['on'](_0x72a0('0x52'),function(){_0x180d0e(_0x72a0('0x52'));});_0x181312['on'](_0x72a0('0x53'),function(_0x46d865){_0x4edb2f(_0x46d865);});_0x542857[_0x72a0('0x54')]();});}exports[_0x72a0('0x55')]=function(_0x58e32a,_0x453d14){var _0x5283d2=getPDFPrinter();var _0x53b355=getPDFDocDefinitionFromHTML(_0x58e32a,_0x453d14);var _0x583e08=_0x5283d2['createPdfKitDocument'](_0x53b355);return writePDFDocument(_0x583e08,_0x453d14[_0x72a0('0x1')])[_0x72a0('0x43')](function(_0x5a54bf){throw _0x5a54bf;});}; \ No newline at end of file +var _0x06bb=['query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','zip','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','YYYY-MM-DD','center','pipe','createWriteStream','finish','end','createPdfFromHTML','catch','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','jsdom','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','pick','toString','fill','length','auto','body','push','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','pageBreak','before','margin','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','isInteger','sequelize'];(function(_0x48ac0a,_0x2f2fc9){var _0x9f7de8=function(_0x19ece0){while(--_0x19ece0){_0x48ac0a['push'](_0x48ac0a['shift']());}};_0x9f7de8(++_0x2f2fc9);}(_0x06bb,0x135));var _0xb06b=function(_0x42603c,_0x3b92dc){_0x42603c=_0x42603c-0x0;var _0x5d6547=_0x06bb[_0x42603c];return _0x5d6547;};'use strict';var _=require(_0xb06b('0x0'));var fs=require('fs');var util=require(_0xb06b('0x1'));var path=require(_0xb06b('0x2'));var moment=require(_0xb06b('0x3'));var htmlToPdfmake=require(_0xb06b('0x4'));var PdfPrinter=require(_0xb06b('0x5'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0xb06b('0x6'))['JSDOM'];var window=new JSDOM('')[_0xb06b('0x7')];var BPromise=require(_0xb06b('0x8'));var db=require('../../mysqldb')['db'];var dbH=require(_0xb06b('0x9'))[_0xb06b('0xa')];var logger=require(_0xb06b('0xb'))(_0xb06b('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0xb06b('0xd')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xb06b('0xd')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xb06b('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x57cb07,_0x44548e){var _0x5137c5={'status':_0x57cb07};var _0x315216={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x44548e){_0x5137c5[_0xb06b('0xf')]=_0x44548e;}return db[_0xb06b('0x10')][_0xb06b('0x11')](_0x5137c5,_0x315216);}function getHeaders(_0x2f21f4){return _['map'](_0x2f21f4,function(_0xc9342b){return{'text':_0xc9342b,'style':'tableHeader'};});}function getRows(_0x43c4b4,_0x2a2362){return _[_0xb06b('0x12')](_0x2a2362,function(_0x50dad4){return _(_0x50dad4)[_0xb06b('0x13')](_0x43c4b4)[_0xb06b('0x12')](function(_0x1c5e7c){return _0x1c5e7c?_[_0xb06b('0x14')](_0x1c5e7c):'';})['value']();});}function createTable(_0x1c50f6,_0x3caa20){var _0x3aed2e={'widths':_[_0xb06b('0x15')](Array(_0x1c50f6[_0xb06b('0x16')]),0x91),'heights':function(_0x374ac0){return _0x374ac0===0x0?_0xb06b('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2bc436=getHeaders(_0x1c50f6);_0x3aed2e[_0xb06b('0x18')][_0xb06b('0x19')](_0x2bc436);var _0x491b3e=getRows(_0x1c50f6,_0x3caa20);_0x3aed2e['body']=_0x3aed2e[_0xb06b('0x18')]['concat'](_0x491b3e);return _0x3aed2e;}function createTables(_0x27a532){var _0xcc2018=[];var _0x49d191=_[_0xb06b('0x1a')](Object[_0xb06b('0x1b')](_0x27a532[0x0]),0x5);_0x49d191[_0xb06b('0x1c')](function(_0x55e5d1){_0xcc2018[_0xb06b('0x19')](createTable(_0x55e5d1,_0x27a532));});return _0xcc2018;}function getPDFDocDefinition(_0x2a61bb){var _0x5b200d=util[_0xb06b('0x1d')](_0xb06b('0x1e'),NAME,EXTRACTED_REPORT[_0xb06b('0x1f')],moment(EXTRACTED_REPORT['startDate'])[_0xb06b('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0xb06b('0x20')])[_0xb06b('0x1d')](FORMAT));var _0x38ad80=[];for(var _0x11dbc5=0x0;_0x11dbc5<_0x2a61bb[_0xb06b('0x16')];_0x11dbc5++){var _0x3123cd=[];if(_0x11dbc5===0x0){_0x3123cd['push']({'text':_0x5b200d,'style':_0xb06b('0x21')});}var _0x47e2c1={'table':_0x2a61bb[_0x11dbc5]};if(_0x11dbc5>0x0){_0x47e2c1[_0xb06b('0x22')]=_0xb06b('0x23');_0x47e2c1[_0xb06b('0x24')]=[0x0,0x46,0x0,0x0];}_0x3123cd[_0xb06b('0x19')](_0x47e2c1);_0x38ad80[_0xb06b('0x19')](_0x3123cd);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x38ad80,'footer':function(_0xaecb90,_0x3bcb69){return{'text':_0xaecb90[_0xb06b('0x14')]()+_0xb06b('0x25')+_0x3bcb69,'style':_0xb06b('0x26')};},'defaultStyle':{'font':_0xb06b('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xb06b('0x28')},'footer':{'alignment':_0xb06b('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xc7c7ff){var _0x51360d=0x1388;var _0x149c8a;if(!_0xc7c7ff[0x0][_0xb06b('0x2a')]){return analyticExtractedReport(_0xb06b('0x2b'));}return db[_0xb06b('0x2c')][_0xb06b('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb06b('0x2e'),_0xb06b('0x2f')]})[_0xb06b('0x30')](function(_0x25c396){if(_0x25c396){_0x149c8a=_0x25c396;_0x51360d=_0x149c8a[_0xb06b('0x2f')]||0x3e8;}})[_0xb06b('0x30')](function(){var _0x5e2720=[];var _0x59c514=0x0;if(_0x149c8a[_0xb06b('0x2e')]){if(_0xc7c7ff&&_0xc7c7ff[_0xb06b('0x16')]){var _0x4102e4=_['range'](_0xc7c7ff[0x0]['num']/_0x51360d);var _0x354702=Number[_0xb06b('0x31')](_0xc7c7ff[0x0][_0xb06b('0x2a')]/_0x51360d)?_0xc7c7ff[0x0][_0xb06b('0x2a')]%_0x51360d:0x0;_0x4102e4[_0xb06b('0x1c')](function(_0x5e73b3){if(_0x5e73b3>0x0){_0x59c514+=_0x51360d;}_0x5e2720[_0xb06b('0x19')](dbH[_0xb06b('0x32')][_0xb06b('0x33')](util['format'](_0xb06b('0x34'),QUERY,_0x51360d,_0x59c514),{'type':dbH['sequelize'][_0xb06b('0x35')][_0xb06b('0x36')]}));});if(_0x354702>0x0){_0x59c514+=_0x51360d;_0x5e2720[_0xb06b('0x19')](dbH[_0xb06b('0x32')][_0xb06b('0x33')](util['format'](_0xb06b('0x34'),QUERY,_0x354702,_0x59c514),{'type':dbH[_0xb06b('0x32')][_0xb06b('0x35')][_0xb06b('0x36')]}));}}}else{_0x5e2720[_0xb06b('0x19')](dbH[_0xb06b('0x32')][_0xb06b('0x33')](QUERY,{'type':dbH[_0xb06b('0x32')]['QueryTypes'][_0xb06b('0x36')]}));}var _0x40a0ae=path[_0xb06b('0x37')](PATH);var _0x50b8d0=path[_0xb06b('0x38')](PATH,'.pdf');var _0x5a43b6=_0x149c8a[_0xb06b('0x2e')]&&_0x5e2720['length']>0x1;var _0x54044c=[];if(!fs[_0xb06b('0x39')](path[_0xb06b('0x3a')](_0x40a0ae,_0x50b8d0))&&_0x5a43b6){fs[_0xb06b('0x3b')](path['join'](_0x40a0ae,_0x50b8d0));}return BPromise[_0xb06b('0x3c')](_0x5e2720,function(_0x128e10){_0x54044c['push'](_0x128e10);})[_0xb06b('0x30')](function(){var _0x8ae78=[];for(var _0x37078f=0x0;_0x37078f<_0x54044c[_0xb06b('0x16')];_0x37078f+=0x1){var _0x525b27=_0x54044c[_0x37078f];var _0x55ad1a=createTables(_[_0xb06b('0x3d')](_0x525b27));var _0x1359b9;var _0x1879f1=getPDFDocDefinition(_0x55ad1a);var _0xe38d40=getPDFPrinter();var _0x3ea7bf=_0xe38d40[_0xb06b('0x3e')](_0x1879f1);if(_0x5a43b6){_0x1359b9=path[_0xb06b('0x3a')](_0x40a0ae,_0x50b8d0,util['format'](_0xb06b('0x3f'),_0x50b8d0,_0x37078f,_0xb06b('0x40')));}else{_0x1359b9=path[_0xb06b('0x3a')](_0x40a0ae,util['format'](_0xb06b('0x41'),_0x50b8d0,'pdf'));}_0x8ae78[_0xb06b('0x19')](writePDFDocument(_0x3ea7bf,_0x1359b9));}return Promise[_0xb06b('0x42')](_0x8ae78);})[_0xb06b('0x30')](function(){if(_0x5a43b6){return new Promise(function(_0x21b703){zipdir(path[_0xb06b('0x3a')](_0x40a0ae,_0x50b8d0),{'saveTo':path[_0xb06b('0x3a')](_0x40a0ae,util[_0xb06b('0x1d')]('%s.%s',_0x50b8d0,'zip'))},function(){rimraf(path[_0xb06b('0x3a')](_0x40a0ae,_0x50b8d0),function(){});_0x21b703('zip\x20finished');});});}})[_0xb06b('0x30')](function(){if(!_0x5a43b6)return;rimraf(path[_0xb06b('0x3a')](_0x40a0ae,_0x50b8d0),function(){});})[_0xb06b('0x30')](function(){logger['info'](util[_0xb06b('0x1d')](_0xb06b('0x43'),EXTRACTED_REPORT_ID,_0xb06b('0x44')));return analyticExtractedReport('Completed',_0x5a43b6?util[_0xb06b('0x1d')](_0xb06b('0x41'),_0x50b8d0,_0x5a43b6?_0xb06b('0x45'):_0xb06b('0x40')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xb06b('0x46')](util[_0xb06b('0x1d')](_0xb06b('0x47'),EXTRACTED_REPORT_ID,_0xb06b('0x44')));return db[_0xb06b('0x10')][_0xb06b('0x48')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xb06b('0x30')](function(_0x4cda25){EXTRACTED_REPORT=_0x4cda25;return dbH[_0xb06b('0x32')][_0xb06b('0x33')](util[_0xb06b('0x1d')](_0xb06b('0x49'),QUERY),{'type':dbH[_0xb06b('0x32')][_0xb06b('0x35')][_0xb06b('0x36')]});})['then'](extractReport)['catch'](function(_0x22f72f){logger[_0xb06b('0x46')](util[_0xb06b('0x1d')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util[_0xb06b('0x4a')](_0x22f72f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xb06b('0x4b')](function(){process[_0xb06b('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x27022b=new PdfPrinter({'Arial':{'normal':__dirname+_0xb06b('0x4d'),'bold':__dirname+_0xb06b('0x4e'),'italics':__dirname+_0xb06b('0x4f'),'bolditalics':__dirname+_0xb06b('0x50')}});return _0x27022b;}function getPDFDocDefinitionFromHTML(_0x1921a2,_0x49854e){var _0x56168a=util[_0xb06b('0x1d')](_0xb06b('0x51'),_0x49854e['channel'],_0x49854e['interactionId']);var _0x42e716=moment()[_0xb06b('0x1d')](_0xb06b('0x52'))['toString']();var _0x1f1c55=htmlToPdfmake(_0x1921a2,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1f1c55],'defaultStyle':{'font':_0xb06b('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xb06b('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x5a1a1a,_0x4669ff){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x56168a,_0x5a1a1a,_0x4669ff,_0x42e716),'style':_0xb06b('0x26')}];}};}function writePDFDocument(_0xa48bfb,_0x57ccd1){return new Promise(function(_0xca39ca,_0x3a075e){var _0x2c61f2=_0xa48bfb[_0xb06b('0x54')](fs[_0xb06b('0x55')](_0x57ccd1));_0x2c61f2['on']('finish',function(){_0xca39ca(_0xb06b('0x56'));});_0x2c61f2['on']('error',function(_0x5c4478){_0x3a075e(_0x5c4478);});_0xa48bfb[_0xb06b('0x57')]();});}exports[_0xb06b('0x58')]=function(_0x1c754f,_0x26b21a){var _0x40329c=getPDFPrinter();var _0x13b5b8=getPDFDocDefinitionFromHTML(_0x1c754f,_0x26b21a);var _0x1b9ded=_0x40329c['createPdfKitDocument'](_0x13b5b8);return writePDFDocument(_0x1b9ded,_0x26b21a[_0xb06b('0x2')])[_0xb06b('0x59')](function(_0x209a1a){throw _0x209a1a;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 2a6366a..f00fde4 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 _0x5f60=['mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','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','inspect','Failed','path','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','XLSX','Setting','find','split','splitSizeXlsx','then','query','sequelize','SELECT','Empty','length','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','existsSync','join'];(function(_0x2a384c,_0xa73757){var _0x27418a=function(_0x3e413f){while(--_0x3e413f){_0x2a384c['push'](_0x2a384c['shift']());}};_0x27418a(++_0xa73757);}(_0x5f60,0x134));var _0x05f6=function(_0x51cc1d,_0xaa88ae){_0x51cc1d=_0x51cc1d-0x0;var _0x2eb9f2=_0x5f60[_0x51cc1d];return _0x2eb9f2;};'use strict';var util=require('util');var path=require(_0x05f6('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x05f6('0x1'));var BPromise=require('bluebird');var zipdir=require(_0x05f6('0x2'));var rimraf=require(_0x05f6('0x3'));var db=require(_0x05f6('0x4'))['db'];var dbH=require('../../mysqldb')[_0x05f6('0x5')];var logger=require(_0x05f6('0x6'))(_0x05f6('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x05f6('0x8')][0x2]);var QUERY=process[_0x05f6('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4fb112,_0x3d253c){var _0x344f3a={'status':_0x4fb112};var _0x139e9f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3d253c){_0x344f3a[_0x05f6('0x9')]=_0x3d253c;}return db[_0x05f6('0xa')][_0x05f6('0xb')](_0x344f3a,_0x139e9f);}function main(){var _0x4ed4a7=0x1388;var _0x1ed28d;logger['info'](util[_0x05f6('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x05f6('0xd')));return db[_0x05f6('0xe')][_0x05f6('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x05f6('0x10'),_0x05f6('0x11')]})[_0x05f6('0x12')](function(_0x2715b0){if(_0x2715b0){_0x1ed28d=_0x2715b0;_0x4ed4a7=_0x1ed28d['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH['sequelize'][_0x05f6('0x13')](util[_0x05f6('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x05f6('0x14')]['QueryTypes'][_0x05f6('0x15')]});})[_0x05f6('0x12')](function(_0x2ce228){if(!_0x2ce228[0x0]['num']){return analyticExtractedReport(_0x05f6('0x16'));}var _0x86fb1b=[];var _0x57691c=0x0;if(_0x1ed28d[_0x05f6('0x10')]){if(_0x2ce228&&_0x2ce228[_0x05f6('0x17')]){var _0x5cd2cc=_['range'](_0x2ce228[0x0][_0x05f6('0x18')]/_0x4ed4a7);var _0x19e29c=Number[_0x05f6('0x19')](_0x2ce228[0x0][_0x05f6('0x18')]/_0x4ed4a7)?_0x2ce228[0x0][_0x05f6('0x18')]%_0x4ed4a7:0x0;_0x5cd2cc[_0x05f6('0x1a')](function(_0x14d135){if(_0x14d135>0x0){_0x57691c+=_0x4ed4a7;}_0x86fb1b[_0x05f6('0x1b')](dbH['sequelize'][_0x05f6('0x13')](util[_0x05f6('0xc')](_0x05f6('0x1c'),QUERY,_0x4ed4a7,_0x57691c),{'type':dbH[_0x05f6('0x14')][_0x05f6('0x1d')]['SELECT']}));});if(_0x19e29c>0x0){_0x57691c+=_0x4ed4a7;_0x86fb1b['push'](dbH[_0x05f6('0x14')][_0x05f6('0x13')](util['format'](_0x05f6('0x1c'),QUERY,_0x19e29c,_0x57691c),{'type':dbH[_0x05f6('0x14')][_0x05f6('0x1d')][_0x05f6('0x15')]}));}}}else{_0x86fb1b[_0x05f6('0x1b')](dbH[_0x05f6('0x14')][_0x05f6('0x13')](QUERY,{'type':dbH[_0x05f6('0x14')][_0x05f6('0x1d')][_0x05f6('0x15')]}));}var _0x21a627=path[_0x05f6('0x1e')](PATH);var _0x5d7cbf=path[_0x05f6('0x1f')](PATH,_0x05f6('0x20'));var _0x217443=_0x1ed28d[_0x05f6('0x10')]&&_0x86fb1b['length']>0x1;var _0x4fe54f=[];if(!fs[_0x05f6('0x21')](path[_0x05f6('0x22')](_0x21a627,_0x5d7cbf))&&_0x217443){fs[_0x05f6('0x23')](path['join'](_0x21a627,_0x5d7cbf));}return BPromise[_0x05f6('0x24')](_0x86fb1b,function(_0x109f13){_0x4fe54f[_0x05f6('0x1b')](_0x109f13);})[_0x05f6('0x12')](function(){for(var _0x12fe30=0x0;_0x12fe30<_0x4fe54f[_0x05f6('0x17')];_0x12fe30+=0x1){var _0x4f5ce3;var _0x350f91=_0x4fe54f[_0x12fe30];if(_0x217443){_0x4f5ce3=path['join'](_0x21a627,_0x5d7cbf,util[_0x05f6('0xc')](_0x05f6('0x25'),_0x5d7cbf,_0x12fe30,_0x05f6('0x26')));}else{_0x4f5ce3=path[_0x05f6('0x22')](_0x21a627,util[_0x05f6('0xc')](_0x05f6('0x27'),_0x5d7cbf,_0x05f6('0x26')));}fs[_0x05f6('0x28')](_0x4f5ce3,json2xls(_0x350f91),_0x05f6('0x29'));}})[_0x05f6('0x12')](function(){if(_0x217443){return new Promise(function(_0xeff6ed){zipdir(path[_0x05f6('0x22')](_0x21a627,_0x5d7cbf),{'saveTo':path[_0x05f6('0x22')](_0x21a627,util[_0x05f6('0xc')](_0x05f6('0x27'),_0x5d7cbf,_0x05f6('0x2a')))},function(_0x46439d,_0x44dc4f){rimraf(path[_0x05f6('0x22')](_0x21a627,_0x5d7cbf),function(){});_0xeff6ed('zip\x20finished');});});}})[_0x05f6('0x12')](function(){logger['info'](util[_0x05f6('0xc')](_0x05f6('0x2b'),EXTRACTED_REPORT_ID,_0x05f6('0xd')));return analyticExtractedReport('Completed',_0x217443?util[_0x05f6('0xc')](_0x05f6('0x27'),_0x5d7cbf,_0x217443?_0x05f6('0x2a'):_0x05f6('0x26')):null);});})[_0x05f6('0x2c')](function(_0x48e02e){logger[_0x05f6('0x2d')](util[_0x05f6('0xc')](_0x05f6('0x2e'),EXTRACTED_REPORT_ID,_0x05f6('0xd')),util[_0x05f6('0x2f')](_0x48e02e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x05f6('0x30'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x4d96=['../../config/logger','analytics','argv','savename','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','existsSync','join','each','xlsx','%s.%s','binary','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','path','lodash','json2xls','bluebird','zip-dir','rimraf','dbH'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4d96,0x89));var _0x64d9=function(_0x5803e9,_0x3aeb8d){_0x5803e9=_0x5803e9-0x0;var _0x19d987=_0x4d96[_0x5803e9];return _0x19d987;};'use strict';var util=require('util');var path=require(_0x64d9('0x0'));var _=require(_0x64d9('0x1'));var fs=require('fs');var json2xls=require(_0x64d9('0x2'));var BPromise=require(_0x64d9('0x3'));var zipdir=require(_0x64d9('0x4'));var rimraf=require(_0x64d9('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x64d9('0x6')];var logger=require(_0x64d9('0x7'))(_0x64d9('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x64d9('0x9')][0x2]);var QUERY=process[_0x64d9('0x9')][0x3];var PATH=process[_0x64d9('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5def87,_0x329eea){var _0x1741b3={'status':_0x5def87};var _0x1e6676={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x329eea){_0x1741b3[_0x64d9('0xa')]=_0x329eea;}return db['AnalyticExtractedReport'][_0x64d9('0xb')](_0x1741b3,_0x1e6676);}function main(){var _0x4b8906=0x1388;var _0x500e0b;logger['info'](util[_0x64d9('0xc')](_0x64d9('0xd'),EXTRACTED_REPORT_ID,_0x64d9('0xe')));return db[_0x64d9('0xf')][_0x64d9('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x64d9('0x11'),_0x64d9('0x12')]})[_0x64d9('0x13')](function(_0x17d19c){if(_0x17d19c){_0x500e0b=_0x17d19c;_0x4b8906=_0x500e0b[_0x64d9('0x12')]||0x1388;}})[_0x64d9('0x13')](function(){return dbH[_0x64d9('0x14')][_0x64d9('0x15')](util[_0x64d9('0xc')](_0x64d9('0x16'),QUERY),{'type':dbH[_0x64d9('0x14')][_0x64d9('0x17')][_0x64d9('0x18')]});})[_0x64d9('0x13')](function(_0x36639c){if(!_0x36639c[0x0][_0x64d9('0x19')]){return analyticExtractedReport(_0x64d9('0x1a'));}var _0x239a15=[];var _0x5fc4e9=0x0;if(_0x500e0b[_0x64d9('0x11')]){if(_0x36639c&&_0x36639c[_0x64d9('0x1b')]){var _0x528113=_[_0x64d9('0x1c')](_0x36639c[0x0][_0x64d9('0x19')]/_0x4b8906);var _0x506bc8=Number[_0x64d9('0x1d')](_0x36639c[0x0][_0x64d9('0x19')]/_0x4b8906)?_0x36639c[0x0][_0x64d9('0x19')]%_0x4b8906:0x0;_0x528113[_0x64d9('0x1e')](function(_0x205e9a){if(_0x205e9a>0x0){_0x5fc4e9+=_0x4b8906;}_0x239a15[_0x64d9('0x1f')](dbH[_0x64d9('0x14')]['query'](util[_0x64d9('0xc')](_0x64d9('0x20'),QUERY,_0x4b8906,_0x5fc4e9),{'type':dbH[_0x64d9('0x14')][_0x64d9('0x17')][_0x64d9('0x18')]}));});if(_0x506bc8>0x0){_0x5fc4e9+=_0x4b8906;_0x239a15['push'](dbH[_0x64d9('0x14')][_0x64d9('0x15')](util[_0x64d9('0xc')](_0x64d9('0x20'),QUERY,_0x506bc8,_0x5fc4e9),{'type':dbH[_0x64d9('0x14')]['QueryTypes'][_0x64d9('0x18')]}));}}}else{_0x239a15['push'](dbH[_0x64d9('0x14')][_0x64d9('0x15')](QUERY,{'type':dbH['sequelize'][_0x64d9('0x17')][_0x64d9('0x18')]}));}var _0x29dd01=path['dirname'](PATH);var _0x23d665=path['basename'](PATH,'.xlsx');var _0x456260=_0x500e0b['split']&&_0x239a15[_0x64d9('0x1b')]>0x1;var _0x1b15e7=[];if(!fs[_0x64d9('0x21')](path[_0x64d9('0x22')](_0x29dd01,_0x23d665))&&_0x456260){fs['mkdirSync'](path[_0x64d9('0x22')](_0x29dd01,_0x23d665));}return BPromise[_0x64d9('0x23')](_0x239a15,function(_0x285613){_0x1b15e7[_0x64d9('0x1f')](_0x285613);})[_0x64d9('0x13')](function(){for(var _0x6b04c0=0x0;_0x6b04c0<_0x1b15e7[_0x64d9('0x1b')];_0x6b04c0+=0x1){var _0x17e1a5;var _0x3e84fa=_0x1b15e7[_0x6b04c0];if(_0x456260){_0x17e1a5=path['join'](_0x29dd01,_0x23d665,util[_0x64d9('0xc')]('%s%d.%s',_0x23d665,_0x6b04c0,_0x64d9('0x24')));}else{_0x17e1a5=path['join'](_0x29dd01,util[_0x64d9('0xc')](_0x64d9('0x25'),_0x23d665,_0x64d9('0x24')));}fs['writeFileSync'](_0x17e1a5,json2xls(_0x3e84fa),_0x64d9('0x26'));}})[_0x64d9('0x13')](function(){if(_0x456260){return new Promise(function(_0x5cde12){zipdir(path[_0x64d9('0x22')](_0x29dd01,_0x23d665),{'saveTo':path['join'](_0x29dd01,util[_0x64d9('0xc')](_0x64d9('0x25'),_0x23d665,_0x64d9('0x27')))},function(_0x2b70bb,_0x364abe){rimraf(path[_0x64d9('0x22')](_0x29dd01,_0x23d665),function(){});_0x5cde12(_0x64d9('0x28'));});});}})[_0x64d9('0x13')](function(){logger[_0x64d9('0x29')](util[_0x64d9('0xc')](_0x64d9('0x2a'),EXTRACTED_REPORT_ID,_0x64d9('0xe')));return analyticExtractedReport(_0x64d9('0x2b'),_0x456260?util['format'](_0x64d9('0x25'),_0x23d665,_0x456260?_0x64d9('0x27'):_0x64d9('0x24')):null);});})['catch'](function(_0x520f4f){logger[_0x64d9('0x29')](util[_0x64d9('0xc')](_0x64d9('0x2c'),EXTRACTED_REPORT_ID,_0x64d9('0xe')),util[_0x64d9('0x2d')](_0x520f4f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x64d9('0x2e'));})['finally'](function(){process[_0x64d9('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 8fe9db5..d57e9da 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 _0xa138=['$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','bulkCreate','error','rewrite','lodash','util','Interval','findAll','models','VoiceExtension','IntervalId','then','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','priority','extensions','extension','type','format','CDR(type)=%s','inbound','push','Set','CDR(routeid)=','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','context','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa138,0xde));var _0x8a13=function(_0x37d3d1,_0x5873b6){_0x37d3d1=_0x37d3d1-0x0;var _0x10503b=_0xa138[_0x37d3d1];return _0x10503b;};'use strict';var _=require(_0x8a13('0x0'));var util=require(_0x8a13('0x1'));function rewrite(_0x50b806,_0x4b39c9){var _0x33f303=this;return _0x50b806['models'][_0x8a13('0x2')][_0x8a13('0x3')]({'raw':!![]})['then'](function(_0x1d66ad){_0x33f303['intervals']=_0x1d66ad;return _0x50b806[_0x8a13('0x4')][_0x8a13('0x5')][_0x8a13('0x3')]({'where':{'IntervalId':_0x4b39c9[_0x8a13('0x6')]},'raw':!![]});})[_0x8a13('0x7')](function(_0x4c210b){return _0x50b806[_0x8a13('0x4')][_0x8a13('0x5')][_0x8a13('0x3')]({'where':{'exten':{'$in':_[_0x8a13('0x8')](_['map'](_0x4c210b,_0x8a13('0x9')))}},'order':[{'raw':_0x8a13('0xa')}],'raw':!![]});})[_0x8a13('0x7')](function(_0x5c6199){var _0x3e4b55=_[_0x8a13('0xb')](_0x5c6199,{'priority':'1'});var _0x5115b2=_[_0x8a13('0xb')](_0x5c6199,{'isApp':0x1});var _0x1c6ca9=_[_0x8a13('0xc')](_0x5115b2,'exten');var _0xa154c1=['queue',_0x8a13('0xd')];var _0x421a98=[];var _0x293422=[];for(var _0x235e83 in _0x1c6ca9){if(_0x1c6ca9[_0x8a13('0xe')](_0x235e83)){_0x33f303[_0x8a13('0xf')]=0x2;_0x33f303[_0x8a13('0x10')]=[];_0x33f303[_0x8a13('0x11')]=_['find'](_0x3e4b55,{'exten':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x9')]});_0x33f303[_0x8a13('0x10')]['push']({'type':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x12')],'app':'Set','appdata':util[_0x8a13('0x13')](_0x8a13('0x14'),_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x12')]),'context':_0x1c6ca9[_0x235e83][0x0]['context'],'exten':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x9')],'priority':_0x33f303[_0x8a13('0xf')]++,'VoiceExtensionId':_0x1c6ca9[_0x235e83][0x0]['VoiceExtensionId']});if(_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x12')]===_0x8a13('0x15')){_0x33f303[_0x8a13('0x10')][_0x8a13('0x16')]({'type':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x12')],'app':_0x8a13('0x17'),'appdata':_0x8a13('0x18')+_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x19')],'context':_0x1c6ca9[_0x235e83][0x0]['context'],'exten':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x9')],'priority':_0x33f303[_0x8a13('0xf')]++,'VoiceExtensionId':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x19')]});}else if(_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x12')]===_0x8a13('0x1a')){if(_0x33f303[_0x8a13('0x11')]){_0x33f303['extensions'][_0x8a13('0x16')]({'type':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x12')],'app':'Set','appdata':_0x8a13('0x1b')+(_0x33f303[_0x8a13('0x11')][_0x8a13('0x1c')]?'${EXTEN:'+_0x33f303[_0x8a13('0x11')]['cutdigits']+'}':'${EXTEN}'),'context':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x1d')],'exten':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x9')],'priority':_0x33f303[_0x8a13('0xf')]++,'VoiceExtensionId':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x19')]});}_0x33f303['extensions'][_0x8a13('0x16')]({'type':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x12')],'app':'Set','appdata':_0x8a13('0x18')+_0x1c6ca9[_0x235e83][0x0]['VoiceExtensionId'],'context':_0x1c6ca9[_0x235e83][0x0]['context'],'exten':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x9')],'priority':_0x33f303['priority']++,'VoiceExtensionId':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x19')]});var _0x412e3e=_0x33f303['priority']++;_0x33f303['extensions']['push']({'type':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x12')],'app':_0x8a13('0x1e'),'appdata':_0x8a13('0x1f')+(_0x412e3e+0x2)+_0x8a13('0x20')+(_0x412e3e+0x1)+')','context':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x1d')],'exten':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x9')],'priority':_0x412e3e,'VoiceExtensionId':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x19')]});if(_0x33f303[_0x8a13('0x11')]){_0x33f303[_0x8a13('0x10')][_0x8a13('0x16')]({'type':_0x1c6ca9[_0x235e83][0x0]['type'],'app':_0x8a13('0x17'),'appdata':_0x33f303['extension'][_0x8a13('0x1c')]?_0x8a13('0x21')+_0x33f303['extension'][_0x8a13('0x1c')]+'}':_0x8a13('0x22'),'context':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x1d')],'exten':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x9')],'priority':_0x33f303[_0x8a13('0xf')]++,'VoiceExtensionId':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x19')]});}_0x33f303[_0x8a13('0x10')]['push']({'type':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x12')],'app':_0x8a13('0x17'),'appdata':_0x8a13('0x23')+_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x19')],'context':_0x1c6ca9[_0x235e83][0x0]['context'],'exten':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x9')],'priority':_0x33f303[_0x8a13('0xf')]++,'VoiceExtensionId':_0x1c6ca9[_0x235e83][0x0]['VoiceExtensionId']});if(_0x33f303['extension']&&_0x33f303[_0x8a13('0x11')][_0x8a13('0xe')]('recordingFormat')&&_0x33f303[_0x8a13('0x11')][_0x8a13('0x24')]!==_0x8a13('0x25')){_0x33f303[_0x8a13('0x10')][_0x8a13('0x16')]({'type':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x12')],'app':'Set','appdata':_0x8a13('0x26'),'context':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x1d')],'exten':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x9')],'priority':_0x33f303[_0x8a13('0xf')]++,'VoiceExtensionId':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x19')]});_0x33f303[_0x8a13('0x10')][_0x8a13('0x16')]({'type':_0x1c6ca9[_0x235e83][0x0]['type'],'app':_0x8a13('0x17'),'appdata':_0x8a13('0x27')+_0x33f303[_0x8a13('0x11')][_0x8a13('0x24')]||'wav','context':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x1d')],'exten':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x9')],'priority':_0x33f303['priority']++,'VoiceExtensionId':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x19')]});}}_0x33f303['extensions'][_0x8a13('0x16')]({'type':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x12')],'app':_0x8a13('0x17'),'appdata':_0x8a13('0x28'),'context':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x1d')],'exten':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x9')],'priority':_0x33f303[_0x8a13('0xf')]++,'VoiceExtensionId':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x19')]});_0x33f303[_0x8a13('0x10')][_0x8a13('0x16')]({'type':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x12')],'app':_0x8a13('0x17'),'appdata':_0x8a13('0x29'),'context':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x1d')],'exten':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x9')],'priority':_0x33f303[_0x8a13('0xf')]++,'VoiceExtensionId':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x19')]});_0x33f303[_0x8a13('0x10')][_0x8a13('0x16')]({'type':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x12')],'app':_0x8a13('0x17'),'appdata':_0x8a13('0x2a'),'context':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x1d')],'exten':_0x1c6ca9[_0x235e83][0x0]['exten'],'priority':_0x33f303[_0x8a13('0xf')]++,'VoiceExtensionId':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x19')]});for(var _0x20837a=0x0,_0x31d58f=0x0;_0x20837a<_0x1c6ca9[_0x235e83][_0x8a13('0x2b')];_0x20837a+=0x1,_0x31d58f=0x0){var _0x2c9a1c=_0x1c6ca9[_0x235e83][_0x20837a];if(_0x2c9a1c[_0x8a13('0x12')]){_0x2c9a1c['type']=_0x2c9a1c[_0x8a13('0x12')][_0x8a13('0x2c')]();}var _0x20d8fc=[];var _0x45038c=[];delete _0x2c9a1c['id'];delete _0x2c9a1c[_0x8a13('0x2d')];delete _0x2c9a1c[_0x8a13('0x2e')];var _0xc2c5e8=_0x2c9a1c[_0x8a13('0x2f')]!==_0x8a13('0x30')?[_0x2c9a1c[_0x8a13('0x2f')]]:_0x2c9a1c[_0x8a13('0x6')]?_[_0x8a13('0x31')](_[_0x8a13('0xb')](_0x33f303['intervals'],{'IntervalId':_0x2c9a1c[_0x8a13('0x6')]}),_0x8a13('0x2f')):[];if(_0x2c9a1c[_0x8a13('0xe')](_0x8a13('0x32'))){if(_0x2c9a1c[_0x8a13('0x32')]&&_0x2c9a1c[_0x8a13('0x32')]!=='--'){_0x20d8fc[_0x8a13('0x16')]({'type':_0x2c9a1c[_0x8a13('0x12')],'app':_0x8a13('0x17'),'appdata':_0x8a13('0x33')+_0x2c9a1c[_0x8a13('0x32')],'context':_0x2c9a1c['context'],'exten':_0x2c9a1c['exten'],'priority':_0xc2c5e8[_0x8a13('0x2b')]+_0x33f303[_0x8a13('0xf')]+_0x31d58f++,'VoiceExtensionId':_0x2c9a1c['VoiceExtensionId']});}}if(_0x2c9a1c['type']===_0x8a13('0x1a')&&_0x2c9a1c['hasOwnProperty'](_0x8a13('0x34'))){if(_0x2c9a1c[_0x8a13('0x34')]){_0x20d8fc['push']({'type':_0x2c9a1c[_0x8a13('0x12')],'app':_0x8a13('0x1e'),'appdata':_0x8a13('0x35')+_0x2c9a1c['callerID']+')','context':_0x2c9a1c[_0x8a13('0x1d')],'exten':_0x2c9a1c[_0x8a13('0x9')],'priority':_0xc2c5e8[_0x8a13('0x2b')]+_0x33f303[_0x8a13('0xf')]+_0x31d58f++,'VoiceExtensionId':_0x2c9a1c[_0x8a13('0x19')]});}else{_0x20d8fc[_0x8a13('0x16')]({'type':_0x2c9a1c[_0x8a13('0x12')],'app':_0x8a13('0x1e'),'appdata':_0x8a13('0x36'),'context':_0x2c9a1c[_0x8a13('0x1d')],'exten':_0x2c9a1c[_0x8a13('0x9')],'priority':_0xc2c5e8[_0x8a13('0x2b')]+_0x33f303[_0x8a13('0xf')]+_0x31d58f++,'VoiceExtensionId':_0x2c9a1c[_0x8a13('0x19')]});}}if(_0x2c9a1c[_0x8a13('0xe')]('answer')){if(_0xa154c1[_0x8a13('0x37')](_0x2c9a1c[_0x8a13('0x38')]['toLowerCase']())>=0x0&&_0x2c9a1c[_0x8a13('0x39')]!==_0x8a13('0x3a')){if(_0x2c9a1c[_0x8a13('0x3b')]){_0x20d8fc['push']({'type':_0x2c9a1c['type'],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2c9a1c['context'],'exten':_0x2c9a1c[_0x8a13('0x9')],'priority':_0xc2c5e8[_0x8a13('0x2b')]+_0x33f303[_0x8a13('0xf')]+_0x31d58f++,'VoiceExtensionId':_0x2c9a1c[_0x8a13('0x19')]});_0x20d8fc[_0x8a13('0x16')]({'type':_0x2c9a1c[_0x8a13('0x12')],'app':_0x8a13('0x17'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2c9a1c[_0x8a13('0x1d')],'exten':_0x2c9a1c[_0x8a13('0x9')],'priority':_0xc2c5e8[_0x8a13('0x2b')]+_0x33f303[_0x8a13('0xf')]+_0x31d58f++,'VoiceExtensionId':_0x2c9a1c[_0x8a13('0x19')]});}else{_0x20d8fc[_0x8a13('0x16')]({'type':_0x2c9a1c[_0x8a13('0x12')],'app':_0x8a13('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2c9a1c[_0x8a13('0x1d')],'exten':_0x2c9a1c[_0x8a13('0x9')],'priority':_0xc2c5e8['length']+_0x33f303[_0x8a13('0xf')]+_0x31d58f++,'VoiceExtensionId':_0x2c9a1c['VoiceExtensionId']});_0x20d8fc[_0x8a13('0x16')]({'type':_0x2c9a1c['type'],'app':'Set','appdata':_0x8a13('0x3c'),'context':_0x2c9a1c[_0x8a13('0x1d')],'exten':_0x2c9a1c[_0x8a13('0x9')],'priority':_0xc2c5e8[_0x8a13('0x2b')]+_0x33f303['priority']+_0x31d58f++,'VoiceExtensionId':_0x2c9a1c[_0x8a13('0x19')]});}}}for(var _0x5dfb59=0x0;_0x5dfb59<_0xc2c5e8[_0x8a13('0x2b')];_0x5dfb59+=0x1){var _0x42b052=_0x33f303[_0x8a13('0xf')]+_0xc2c5e8[_0x8a13('0x2b')];var _0x51fc89=_0x5dfb59===_0xc2c5e8[_0x8a13('0x2b')]-0x1?_0x33f303[_0x8a13('0xf')]+_0x20d8fc['length']+_0x45038c['length']+0x2:_0x33f303[_0x8a13('0xf')]+_0x5dfb59+0x1;_0x20d8fc[_0x8a13('0x3d')](_0x5dfb59,0x0,{'type':_0x2c9a1c['type'],'app':_0x8a13('0x3e'),'appdata':_0xc2c5e8[_0x5dfb59]+'?'+_0x2c9a1c[_0x8a13('0x1d')]+_0x8a13('0x3f')+_0x42b052+':'+_0x2c9a1c[_0x8a13('0x1d')]+_0x8a13('0x3f')+_0x51fc89,'exten':_0x2c9a1c[_0x8a13('0x9')],'context':_0x2c9a1c[_0x8a13('0x1d')],'priority':_0x33f303[_0x8a13('0xf')]+_0x5dfb59,'VoiceExtensionId':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x19')]});}_0x2c9a1c[_0x8a13('0xf')]=_0x20d8fc[_0x8a13('0x2b')]?_[_0x8a13('0x40')](_0x20d8fc)[_0x8a13('0xf')]+0x1:_0x33f303['priority'];_0x33f303[_0x8a13('0xf')]=(_0x45038c[_0x8a13('0x2b')]?_[_0x8a13('0x40')](_0x45038c)[_0x8a13('0xf')]:_0x2c9a1c['priority'])+0x1;_0x33f303[_0x8a13('0x10')]=_['concat'](_0x33f303[_0x8a13('0x10')],_0x20d8fc,[_0x2c9a1c],_0x45038c);}_0x33f303['extensions']['push']({'type':_0x1c6ca9[_0x235e83][0x0]['type'],'app':'Hangup','exten':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x9')],'context':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x1d')],'priority':_0x33f303['priority'],'VoiceExtensionId':_0x1c6ca9[_0x235e83][0x0][_0x8a13('0x19')]});_0x421a98[_0x8a13('0x16')](_0x1c6ca9[_0x235e83][0x0]['VoiceExtensionId']);_0x293422=_[_0x8a13('0x41')](_0x293422,_0x33f303[_0x8a13('0x10')]);}}return _0x50b806['transaction'](function(_0x104291){return _0x50b806[_0x8a13('0x4')][_0x8a13('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x421a98}},'transaction':_0x104291})['then'](function(_0x24d459){return _0x50b806[_0x8a13('0x4')]['VoiceExtension'][_0x8a13('0x42')](_['sortBy'](_0x293422,'priority'),{'transaction':_0x104291});});});})['catch'](function(_0x349ff8){console[_0x8a13('0x43')](_0x349ff8);});}exports[_0x8a13('0x44')]=rewrite; \ No newline at end of file +var _0x9bb2=['groupBy','queue','playback','hasOwnProperty','priority','extensions','push','type','Set','format','CDR(type)=%s','VoiceExtensionId','inbound','CDR(routeid)=','context','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','catch','error','rewrite','models','Interval','findAll','then','intervals','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter'];(function(_0x4132de,_0x5ef197){var _0x1df0eb=function(_0x1a13cc){while(--_0x1a13cc){_0x4132de['push'](_0x4132de['shift']());}};_0x1df0eb(++_0x5ef197);}(_0x9bb2,0x1df));var _0x29bb=function(_0x395516,_0x26f41a){_0x395516=_0x395516-0x0;var _0x5af650=_0x9bb2[_0x395516];return _0x5af650;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x21d4f4,_0x3cd53b){var _0x3b481c=this;return _0x21d4f4[_0x29bb('0x0')][_0x29bb('0x1')][_0x29bb('0x2')]({'raw':!![]})[_0x29bb('0x3')](function(_0x4b0ecc){_0x3b481c[_0x29bb('0x4')]=_0x4b0ecc;return _0x21d4f4[_0x29bb('0x0')]['VoiceExtension'][_0x29bb('0x2')]({'where':{'IntervalId':_0x3cd53b['IntervalId']},'raw':!![]});})['then'](function(_0x2b3c7d){return _0x21d4f4[_0x29bb('0x0')][_0x29bb('0x5')][_0x29bb('0x2')]({'where':{'exten':{'$in':_[_0x29bb('0x6')](_[_0x29bb('0x7')](_0x2b3c7d,_0x29bb('0x8')))}},'order':[{'raw':_0x29bb('0x9')}],'raw':!![]});})[_0x29bb('0x3')](function(_0x2faa1c){var _0xf15ea1=_[_0x29bb('0xa')](_0x2faa1c,{'priority':'1'});var _0x1d2747=_[_0x29bb('0xa')](_0x2faa1c,{'isApp':0x1});var _0x546777=_[_0x29bb('0xb')](_0x1d2747,'exten');var _0x41f836=[_0x29bb('0xc'),_0x29bb('0xd')];var _0x2629bf=[];var _0x3ae34c=[];for(var _0x371694 in _0x546777){if(_0x546777[_0x29bb('0xe')](_0x371694)){_0x3b481c[_0x29bb('0xf')]=0x2;_0x3b481c['extensions']=[];_0x3b481c['extension']=_['find'](_0xf15ea1,{'exten':_0x546777[_0x371694][0x0][_0x29bb('0x8')]});_0x3b481c[_0x29bb('0x10')][_0x29bb('0x11')]({'type':_0x546777[_0x371694][0x0][_0x29bb('0x12')],'app':_0x29bb('0x13'),'appdata':util[_0x29bb('0x14')](_0x29bb('0x15'),_0x546777[_0x371694][0x0][_0x29bb('0x12')]),'context':_0x546777[_0x371694][0x0]['context'],'exten':_0x546777[_0x371694][0x0][_0x29bb('0x8')],'priority':_0x3b481c[_0x29bb('0xf')]++,'VoiceExtensionId':_0x546777[_0x371694][0x0][_0x29bb('0x16')]});if(_0x546777[_0x371694][0x0][_0x29bb('0x12')]===_0x29bb('0x17')){_0x3b481c[_0x29bb('0x10')][_0x29bb('0x11')]({'type':_0x546777[_0x371694][0x0][_0x29bb('0x12')],'app':_0x29bb('0x13'),'appdata':_0x29bb('0x18')+_0x546777[_0x371694][0x0][_0x29bb('0x16')],'context':_0x546777[_0x371694][0x0][_0x29bb('0x19')],'exten':_0x546777[_0x371694][0x0][_0x29bb('0x8')],'priority':_0x3b481c[_0x29bb('0xf')]++,'VoiceExtensionId':_0x546777[_0x371694][0x0]['VoiceExtensionId']});}else if(_0x546777[_0x371694][0x0][_0x29bb('0x12')]===_0x29bb('0x1a')){if(_0x3b481c[_0x29bb('0x1b')]){_0x3b481c[_0x29bb('0x10')]['push']({'type':_0x546777[_0x371694][0x0][_0x29bb('0x12')],'app':_0x29bb('0x13'),'appdata':_0x29bb('0x1c')+(_0x3b481c[_0x29bb('0x1b')][_0x29bb('0x1d')]?_0x29bb('0x1e')+_0x3b481c[_0x29bb('0x1b')][_0x29bb('0x1d')]+'}':'${EXTEN}'),'context':_0x546777[_0x371694][0x0][_0x29bb('0x19')],'exten':_0x546777[_0x371694][0x0]['exten'],'priority':_0x3b481c['priority']++,'VoiceExtensionId':_0x546777[_0x371694][0x0]['VoiceExtensionId']});}_0x3b481c[_0x29bb('0x10')]['push']({'type':_0x546777[_0x371694][0x0][_0x29bb('0x12')],'app':_0x29bb('0x13'),'appdata':_0x29bb('0x18')+_0x546777[_0x371694][0x0][_0x29bb('0x16')],'context':_0x546777[_0x371694][0x0][_0x29bb('0x19')],'exten':_0x546777[_0x371694][0x0][_0x29bb('0x8')],'priority':_0x3b481c[_0x29bb('0xf')]++,'VoiceExtensionId':_0x546777[_0x371694][0x0][_0x29bb('0x16')]});var _0x115a89=_0x3b481c[_0x29bb('0xf')]++;_0x3b481c[_0x29bb('0x10')][_0x29bb('0x11')]({'type':_0x546777[_0x371694][0x0][_0x29bb('0x12')],'app':_0x29bb('0x1f'),'appdata':_0x29bb('0x20')+(_0x115a89+0x2)+_0x29bb('0x21')+(_0x115a89+0x1)+')','context':_0x546777[_0x371694][0x0][_0x29bb('0x19')],'exten':_0x546777[_0x371694][0x0]['exten'],'priority':_0x115a89,'VoiceExtensionId':_0x546777[_0x371694][0x0][_0x29bb('0x16')]});if(_0x3b481c[_0x29bb('0x1b')]){_0x3b481c[_0x29bb('0x10')]['push']({'type':_0x546777[_0x371694][0x0][_0x29bb('0x12')],'app':_0x29bb('0x13'),'appdata':_0x3b481c[_0x29bb('0x1b')][_0x29bb('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0x3b481c[_0x29bb('0x1b')][_0x29bb('0x1d')]+'}':_0x29bb('0x22'),'context':_0x546777[_0x371694][0x0][_0x29bb('0x19')],'exten':_0x546777[_0x371694][0x0][_0x29bb('0x8')],'priority':_0x3b481c[_0x29bb('0xf')]++,'VoiceExtensionId':_0x546777[_0x371694][0x0]['VoiceExtensionId']});}_0x3b481c['extensions'][_0x29bb('0x11')]({'type':_0x546777[_0x371694][0x0][_0x29bb('0x12')],'app':'Set','appdata':_0x29bb('0x23')+_0x546777[_0x371694][0x0][_0x29bb('0x16')],'context':_0x546777[_0x371694][0x0][_0x29bb('0x19')],'exten':_0x546777[_0x371694][0x0][_0x29bb('0x8')],'priority':_0x3b481c[_0x29bb('0xf')]++,'VoiceExtensionId':_0x546777[_0x371694][0x0][_0x29bb('0x16')]});if(_0x3b481c['extension']&&_0x3b481c['extension'][_0x29bb('0xe')](_0x29bb('0x24'))&&_0x3b481c[_0x29bb('0x1b')][_0x29bb('0x24')]!==_0x29bb('0x25')){_0x3b481c[_0x29bb('0x10')]['push']({'type':_0x546777[_0x371694][0x0][_0x29bb('0x12')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x546777[_0x371694][0x0][_0x29bb('0x19')],'exten':_0x546777[_0x371694][0x0][_0x29bb('0x8')],'priority':_0x3b481c[_0x29bb('0xf')]++,'VoiceExtensionId':_0x546777[_0x371694][0x0][_0x29bb('0x16')]});_0x3b481c[_0x29bb('0x10')][_0x29bb('0x11')]({'type':_0x546777[_0x371694][0x0]['type'],'app':_0x29bb('0x13'),'appdata':_0x29bb('0x26')+_0x3b481c[_0x29bb('0x1b')]['recordingFormat']||_0x29bb('0x27'),'context':_0x546777[_0x371694][0x0][_0x29bb('0x19')],'exten':_0x546777[_0x371694][0x0][_0x29bb('0x8')],'priority':_0x3b481c['priority']++,'VoiceExtensionId':_0x546777[_0x371694][0x0][_0x29bb('0x16')]});}}_0x3b481c[_0x29bb('0x10')][_0x29bb('0x11')]({'type':_0x546777[_0x371694][0x0][_0x29bb('0x12')],'app':_0x29bb('0x13'),'appdata':_0x29bb('0x28'),'context':_0x546777[_0x371694][0x0][_0x29bb('0x19')],'exten':_0x546777[_0x371694][0x0][_0x29bb('0x8')],'priority':_0x3b481c[_0x29bb('0xf')]++,'VoiceExtensionId':_0x546777[_0x371694][0x0][_0x29bb('0x16')]});_0x3b481c[_0x29bb('0x10')][_0x29bb('0x11')]({'type':_0x546777[_0x371694][0x0][_0x29bb('0x12')],'app':'Set','appdata':_0x29bb('0x29'),'context':_0x546777[_0x371694][0x0][_0x29bb('0x19')],'exten':_0x546777[_0x371694][0x0]['exten'],'priority':_0x3b481c[_0x29bb('0xf')]++,'VoiceExtensionId':_0x546777[_0x371694][0x0]['VoiceExtensionId']});_0x3b481c[_0x29bb('0x10')][_0x29bb('0x11')]({'type':_0x546777[_0x371694][0x0][_0x29bb('0x12')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x546777[_0x371694][0x0][_0x29bb('0x19')],'exten':_0x546777[_0x371694][0x0]['exten'],'priority':_0x3b481c[_0x29bb('0xf')]++,'VoiceExtensionId':_0x546777[_0x371694][0x0][_0x29bb('0x16')]});for(var _0x379f57=0x0,_0x22da5d=0x0;_0x379f57<_0x546777[_0x371694][_0x29bb('0x2a')];_0x379f57+=0x1,_0x22da5d=0x0){var _0x4eea0f=_0x546777[_0x371694][_0x379f57];if(_0x4eea0f[_0x29bb('0x12')]){_0x4eea0f[_0x29bb('0x12')]=_0x4eea0f[_0x29bb('0x12')][_0x29bb('0x2b')]();}var _0x254a68=[];var _0x4d0e22=[];delete _0x4eea0f['id'];delete _0x4eea0f[_0x29bb('0x2c')];delete _0x4eea0f[_0x29bb('0x2d')];var _0x31a69a=_0x4eea0f[_0x29bb('0x2e')]!==_0x29bb('0x2f')?[_0x4eea0f[_0x29bb('0x2e')]]:_0x4eea0f[_0x29bb('0x30')]?_['map'](_[_0x29bb('0xa')](_0x3b481c[_0x29bb('0x4')],{'IntervalId':_0x4eea0f[_0x29bb('0x30')]}),_0x29bb('0x2e')):[];if(_0x4eea0f[_0x29bb('0xe')](_0x29bb('0x31'))){if(_0x4eea0f[_0x29bb('0x31')]&&_0x4eea0f['tag']!=='--'){_0x254a68[_0x29bb('0x11')]({'type':_0x4eea0f['type'],'app':_0x29bb('0x13'),'appdata':'CDR(tag)='+_0x4eea0f['tag'],'context':_0x4eea0f[_0x29bb('0x19')],'exten':_0x4eea0f[_0x29bb('0x8')],'priority':_0x31a69a[_0x29bb('0x2a')]+_0x3b481c[_0x29bb('0xf')]+_0x22da5d++,'VoiceExtensionId':_0x4eea0f['VoiceExtensionId']});}}if(_0x4eea0f[_0x29bb('0x12')]===_0x29bb('0x1a')&&_0x4eea0f[_0x29bb('0xe')](_0x29bb('0x32'))){if(_0x4eea0f[_0x29bb('0x32')]){_0x254a68[_0x29bb('0x11')]({'type':_0x4eea0f[_0x29bb('0x12')],'app':'ExecIf','appdata':_0x29bb('0x33')+_0x4eea0f['callerID']+')','context':_0x4eea0f[_0x29bb('0x19')],'exten':_0x4eea0f['exten'],'priority':_0x31a69a[_0x29bb('0x2a')]+_0x3b481c[_0x29bb('0xf')]+_0x22da5d++,'VoiceExtensionId':_0x4eea0f[_0x29bb('0x16')]});}else{_0x254a68[_0x29bb('0x11')]({'type':_0x4eea0f[_0x29bb('0x12')],'app':_0x29bb('0x1f'),'appdata':_0x29bb('0x34'),'context':_0x4eea0f[_0x29bb('0x19')],'exten':_0x4eea0f[_0x29bb('0x8')],'priority':_0x31a69a[_0x29bb('0x2a')]+_0x3b481c[_0x29bb('0xf')]+_0x22da5d++,'VoiceExtensionId':_0x4eea0f['VoiceExtensionId']});}}if(_0x4eea0f['hasOwnProperty'](_0x29bb('0x35'))){if(_0x41f836[_0x29bb('0x36')](_0x4eea0f[_0x29bb('0x37')][_0x29bb('0x2b')]())>=0x0&&_0x4eea0f[_0x29bb('0x38')]!==_0x29bb('0x39')){if(_0x4eea0f[_0x29bb('0x35')]){_0x254a68[_0x29bb('0x11')]({'type':_0x4eea0f[_0x29bb('0x12')],'app':_0x29bb('0x1f'),'appdata':_0x29bb('0x3a'),'context':_0x4eea0f['context'],'exten':_0x4eea0f[_0x29bb('0x8')],'priority':_0x31a69a['length']+_0x3b481c[_0x29bb('0xf')]+_0x22da5d++,'VoiceExtensionId':_0x4eea0f[_0x29bb('0x16')]});_0x254a68[_0x29bb('0x11')]({'type':_0x4eea0f[_0x29bb('0x12')],'app':_0x29bb('0x13'),'appdata':_0x29bb('0x3b'),'context':_0x4eea0f[_0x29bb('0x19')],'exten':_0x4eea0f[_0x29bb('0x8')],'priority':_0x31a69a[_0x29bb('0x2a')]+_0x3b481c[_0x29bb('0xf')]+_0x22da5d++,'VoiceExtensionId':_0x4eea0f[_0x29bb('0x16')]});}else{_0x254a68[_0x29bb('0x11')]({'type':_0x4eea0f[_0x29bb('0x12')],'app':_0x29bb('0x1f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4eea0f[_0x29bb('0x19')],'exten':_0x4eea0f[_0x29bb('0x8')],'priority':_0x31a69a['length']+_0x3b481c[_0x29bb('0xf')]+_0x22da5d++,'VoiceExtensionId':_0x4eea0f[_0x29bb('0x16')]});_0x254a68[_0x29bb('0x11')]({'type':_0x4eea0f[_0x29bb('0x12')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4eea0f[_0x29bb('0x19')],'exten':_0x4eea0f[_0x29bb('0x8')],'priority':_0x31a69a['length']+_0x3b481c['priority']+_0x22da5d++,'VoiceExtensionId':_0x4eea0f[_0x29bb('0x16')]});}}}for(var _0x4e9fa1=0x0;_0x4e9fa1<_0x31a69a['length'];_0x4e9fa1+=0x1){var _0x16a4ba=_0x3b481c[_0x29bb('0xf')]+_0x31a69a['length'];var _0x578f5d=_0x4e9fa1===_0x31a69a[_0x29bb('0x2a')]-0x1?_0x3b481c[_0x29bb('0xf')]+_0x254a68['length']+_0x4d0e22[_0x29bb('0x2a')]+0x2:_0x3b481c[_0x29bb('0xf')]+_0x4e9fa1+0x1;_0x254a68[_0x29bb('0x3c')](_0x4e9fa1,0x0,{'type':_0x4eea0f['type'],'app':_0x29bb('0x3d'),'appdata':_0x31a69a[_0x4e9fa1]+'?'+_0x4eea0f['context']+_0x29bb('0x3e')+_0x16a4ba+':'+_0x4eea0f[_0x29bb('0x19')]+_0x29bb('0x3e')+_0x578f5d,'exten':_0x4eea0f[_0x29bb('0x8')],'context':_0x4eea0f[_0x29bb('0x19')],'priority':_0x3b481c[_0x29bb('0xf')]+_0x4e9fa1,'VoiceExtensionId':_0x546777[_0x371694][0x0]['VoiceExtensionId']});}_0x4eea0f[_0x29bb('0xf')]=_0x254a68[_0x29bb('0x2a')]?_[_0x29bb('0x3f')](_0x254a68)['priority']+0x1:_0x3b481c['priority'];_0x3b481c[_0x29bb('0xf')]=(_0x4d0e22['length']?_['last'](_0x4d0e22)[_0x29bb('0xf')]:_0x4eea0f[_0x29bb('0xf')])+0x1;_0x3b481c[_0x29bb('0x10')]=_[_0x29bb('0x40')](_0x3b481c[_0x29bb('0x10')],_0x254a68,[_0x4eea0f],_0x4d0e22);}_0x3b481c[_0x29bb('0x10')]['push']({'type':_0x546777[_0x371694][0x0][_0x29bb('0x12')],'app':_0x29bb('0x41'),'exten':_0x546777[_0x371694][0x0][_0x29bb('0x8')],'context':_0x546777[_0x371694][0x0]['context'],'priority':_0x3b481c[_0x29bb('0xf')],'VoiceExtensionId':_0x546777[_0x371694][0x0][_0x29bb('0x16')]});_0x2629bf[_0x29bb('0x11')](_0x546777[_0x371694][0x0]['VoiceExtensionId']);_0x3ae34c=_[_0x29bb('0x40')](_0x3ae34c,_0x3b481c[_0x29bb('0x10')]);}}return _0x21d4f4['transaction'](function(_0x3445b3){return _0x21d4f4['models'][_0x29bb('0x5')][_0x29bb('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x2629bf}},'transaction':_0x3445b3})['then'](function(_0x1d8967){return _0x21d4f4['models'][_0x29bb('0x5')]['bulkCreate'](_['sortBy'](_0x3ae34c,_0x29bb('0xf')),{'transaction':_0x3445b3});});});})[_0x29bb('0x43')](function(_0xb82ea9){console[_0x29bb('0x44')](_0xb82ea9);});}exports[_0x29bb('0x45')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 39702e7..b81cdf3 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 _0x8be1=['id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','Lists','get','dialCheckDuplicateType','always','VoiceQueueId','catch','onlyIfOpen','query','BlackLists','sequelize','all','CmList','CampaignId','Campaign','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','resolve','createReadStream','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','then','push','Error\x20while\x20creating\x20contact:\x20','stringify','inspect','cm_hopper','fromQuery','ContactId','createdAt','select','field','NOW()','scheduledAt','toString','updatedAt','from','cm_contacts','deletedAt\x20IS\x20NULL','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','into','ListId\x20=\x20?'];(function(_0x2d0289,_0x55137c){var _0x4ff75e=function(_0x1063b3){while(--_0x1063b3){_0x2d0289['push'](_0x2d0289['shift']());}};_0x4ff75e(++_0x55137c);}(_0x8be1,0x1de));var _0x18be=function(_0x1e74f0,_0x24cae3){_0x1e74f0=_0x1e74f0-0x0;var _0x4c39fd=_0x8be1[_0x1e74f0];return _0x4c39fd;};'use strict';var BPromise=require(_0x18be('0x0'));var util=require(_0x18be('0x1'));var _=require(_0x18be('0x2'));var fs=require('fs');var squel=require(_0x18be('0x3'));var Papa=require(_0x18be('0x4'));var Redis=require(_0x18be('0x5'));var db=require(_0x18be('0x6'))['db'];var config=require(_0x18be('0x7'));var logger=require(_0x18be('0x8'))('api');config[_0x18be('0x9')]=_[_0x18be('0xa')](config[_0x18be('0x9')],{'host':_0x18be('0xb'),'port':0x18eb});var socket=require(_0x18be('0xc'))(new Redis(config[_0x18be('0x9')]));require('../../../api/cmContact/cmContact.socket')[_0x18be('0xd')](socket);try{if(!process[_0x18be('0xe')][0x2]||process[_0x18be('0xe')][0x2]===_0x18be('0xf')||process[_0x18be('0xe')][0x2]===_0x18be('0x10')){throw new Error(_0x18be('0x11'));}var FILEPATH=process[_0x18be('0xe')][0x2];if(!process[_0x18be('0xe')][0x3]||process[_0x18be('0xe')][0x3]==='undefined'||process[_0x18be('0xe')][0x3]===_0x18be('0x10')||!process[_0x18be('0xe')][0x4]||process['argv'][0x4]===_0x18be('0xf')||process['argv'][0x4]==='null'){throw new Error(_0x18be('0x12'));}var FIELDS=_[_0x18be('0x13')](process[_0x18be('0xe')][0x3][_0x18be('0x14')](','),process[_0x18be('0xe')][0x4][_0x18be('0x14')](','));if(!process[_0x18be('0xe')][0x5]||process[_0x18be('0xe')][0x5]==='undefined'||process[_0x18be('0xe')][0x5]===_0x18be('0x10')){throw new Error(_0x18be('0x15'));}var LISTID=process[_0x18be('0xe')][0x5];var COMPANYID=process[_0x18be('0xe')][0x6]&&process[_0x18be('0xe')][0x6]!=='undefined'&&process[_0x18be('0xe')][0x6]!==_0x18be('0x10')?process[_0x18be('0xe')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0x18be('0xf')&&process[_0x18be('0xe')][0x7]!==_0x18be('0x10')?process[_0x18be('0xe')][0x7]:null;if(!process[_0x18be('0xe')][0x8]||process[_0x18be('0xe')][0x8]==='undefined'||process[_0x18be('0xe')][0x8]===_0x18be('0x10')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x18be('0xe')][0x8];}catch(_0x1de73c){logger[_0x18be('0x16')](_0x1de73c);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(_0x13bd52,_0x41dc11,_0x3d30bb,_0x353471){var _0x1e0312={'message':_0x41dc11};_0x1e0312[_0x13bd52]=!![];if(_0x3d30bb){_0x1e0312['contact']=_0x3d30bb;}if(_0x353471){_0x1e0312[_0x18be('0x17')]=_0x353471;}return _0x1e0312;}function isEmail(_0x345f24){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))*$/[_0x18be('0x18')](_0x345f24);}function checkRow(_0x215642,_0x37d5f0,_0x3f604c){return new BPromise(function(_0x59322d,_0x1a8683){if(_[_0x18be('0x19')](_0x215642)){return _0x1a8683(handleCheckRowError(_0x18be('0x16'),_0x18be('0x1a'),null,_0x3f604c));}if(_0x215642[_0x18be('0x1b')]&&_0x215642[_0x18be('0x1b')]['length']){var _0x803404=_['map'](_0x215642[_0x18be('0x1b')],_0x18be('0x1c'))[_0x18be('0x1d')](';');return _0x1a8683(handleCheckRowError(_0x18be('0x16'),_0x803404,null,_0x3f604c));}var _0x4c8584={};for(var _0x196845 in FIELDS){if(FIELDS[_0x18be('0x1e')](_0x196845)&&FIELDS[_0x196845]){_0x4c8584[_0x196845]=_0x215642[_0x18be('0x1f')][0x0][FIELDS[_0x196845]]||_0x215642['data'][0x0]['\ufeff'+FIELDS[_0x196845]];}}if(!_0x4c8584[_0x18be('0x20')]){return _0x1a8683(handleCheckRowError(_0x18be('0x16'),_0x18be('0x21'),null,_0x3f604c));}if(!_0x4c8584[_0x18be('0x22')]){return _0x1a8683(handleCheckRowError('error',_0x18be('0x23'),null,_0x3f604c));}if(_0x4c8584[_0x18be('0x24')]){var _0x280c53=moment(_0x4c8584[_0x18be('0x24')],_0x18be('0x25'));if(!_0x280c53[_0x18be('0x26')]()){return _0x1a8683(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x3f604c));}}if(_0x4c8584['email']){if(!isEmail(_0x4c8584['email'])){return _0x1a8683(handleCheckRowError(_0x18be('0x16'),'email\x20format\x20is\x20not\x20valid!',null,_0x3f604c));}}_0x4c8584[_0x18be('0x27')]=LISTID;_0x4c8584[_0x18be('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x18be('0x29')]&&_0x37d5f0){var _0x1e5ecc={};for(var _0x44c324=0x0,_0x40cb9b=DUPLICATES[_0x18be('0x29')];_0x44c324<_0x40cb9b;_0x44c324+=0x1){_0x1e5ecc[DUPLICATES[_0x44c324]]=_0x4c8584[DUPLICATES[_0x44c324]];}var _0x5c8370=_[_0x18be('0x2a')](_0x37d5f0,_0x1e5ecc);if(_0x5c8370){return _0x1a8683(handleCheckRowError(_0x18be('0x2b'),_0x18be('0x2c'),_0x5c8370,_0x3f604c));}}return db[_0x18be('0x2d')][_0x18be('0x2e')](_0x4c8584,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4c8584)})[_0x18be('0x2f')](function(_0x190101){if(DUPLICATES&&DUPLICATES[_0x18be('0x29')]&&_0x37d5f0){_0x37d5f0[_0x18be('0x30')](_['pick'](_0x4c8584,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x190101['id'];return _0x59322d();})['catch'](function(_0x48d233){return _0x1a8683(handleCheckRowError(_0x18be('0x16'),_0x18be('0x31')+(_0x48d233[_0x18be('0x1c')]||JSON[_0x18be('0x32')](_0x48d233)),null,_0x3f604c));});});}function checkHopper(){function _0x4fe4c9(){return function(_0x2987ce){logger[_0x18be('0x16')]('cmContact','checkHopper',util[_0x18be('0x33')](_0x2987ce,{'showHidden':![],'depth':null}));};}var _0x2c9b27=function(_0x495960,_0xce3822){var _0x10e9f6=squel['insert']()['into'](_0x18be('0x34'))[_0x18be('0x35')]([_0x18be('0x22'),'scheduledAt',_0x18be('0x36'),_0x18be('0x27'),_0xce3822,_0x18be('0x37'),'updatedAt'],squel[_0x18be('0x38')]()[_0x18be('0x39')](_0x18be('0x22'),_0x18be('0x22'))[_0x18be('0x39')](_0x18be('0x3a'),_0x18be('0x3b'))[_0x18be('0x39')]('id',_0x18be('0x36'))[_0x18be('0x39')](LISTID['toString'](),'ListId')[_0x18be('0x39')](_0x495960['id'][_0x18be('0x3c')](),_0xce3822)['field']('NOW()',_0x18be('0x37'))['field'](_0x18be('0x3a'),_0x18be('0x3d'))[_0x18be('0x3e')](_0x18be('0x3f'))['where'](_0x18be('0x40'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0x18be('0x41')](_0x18be('0x42'))[_0x18be('0x41')](_0x18be('0x43'),squel['select']()[_0x18be('0x39')]('phone')[_0x18be('0x3e')](_0x18be('0x34'))['where'](_0xce3822+_0x18be('0x44'),_0x495960['id'][_0x18be('0x3c')]())))[_0x18be('0x3c')]();return _0x10e9f6;};var _0x56879c=function(_0x3ec64d,_0x1d7aed){var _0x1aac90=squel[_0x18be('0x45')]()[_0x18be('0x46')]('cm_hopper')[_0x18be('0x35')]([_0x18be('0x22'),_0x18be('0x3b'),_0x18be('0x36'),_0x18be('0x27'),_0x1d7aed,'createdAt',_0x18be('0x3d')],squel['select']()['field'](_0x18be('0x22'),_0x18be('0x22'))[_0x18be('0x39')](_0x18be('0x3a'),_0x18be('0x3b'))['field']('id',_0x18be('0x36'))[_0x18be('0x39')](LISTID['toString'](),_0x18be('0x27'))[_0x18be('0x39')](_0x3ec64d['id'][_0x18be('0x3c')](),_0x1d7aed)[_0x18be('0x39')](_0x18be('0x3a'),_0x18be('0x37'))[_0x18be('0x39')](_0x18be('0x3a'),_0x18be('0x3d'))[_0x18be('0x3e')](_0x18be('0x3f'))[_0x18be('0x41')](_0x18be('0x40'))[_0x18be('0x41')](_0x18be('0x47'),LISTID[_0x18be('0x3c')]())[_0x18be('0x41')](_0x18be('0x48'),squel[_0x18be('0x49')](hopperContacts))[_0x18be('0x41')](_0x18be('0x42'))['where'](_0x18be('0x43'),squel[_0x18be('0x38')]()[_0x18be('0x39')](_0x18be('0x4a'))[_0x18be('0x3e')](_0x18be('0x4b'))[_0x18be('0x41')](_0x1d7aed+'\x20=\x20?',_0x3ec64d['id'][_0x18be('0x3c')]()))[_0x18be('0x41')](_0x18be('0x43'),squel['select']()[_0x18be('0x39')]('phone')[_0x18be('0x3e')](_0x18be('0x34'))['where'](_0x1d7aed+_0x18be('0x44'),_0x3ec64d['id'][_0x18be('0x3c')]())))[_0x18be('0x3c')]();return _0x1aac90;};function _0x1250da(_0x5b9ecd,_0x28a04a){var _0x1f54bd=squel[_0x18be('0x45')]()[_0x18be('0x46')](_0x18be('0x34'))[_0x18be('0x35')]([_0x18be('0x22'),_0x18be('0x3b'),_0x18be('0x36'),_0x18be('0x27'),_0x28a04a,_0x18be('0x37'),_0x18be('0x3d')],squel[_0x18be('0x38')]()[_0x18be('0x39')](_0x18be('0x22'),_0x18be('0x22'))[_0x18be('0x39')]('NOW()',_0x18be('0x3b'))['field']('id','ContactId')[_0x18be('0x39')](LISTID[_0x18be('0x3c')](),_0x18be('0x27'))[_0x18be('0x39')](_0x5b9ecd['id'][_0x18be('0x3c')](),_0x28a04a)['field'](_0x18be('0x3a'),_0x18be('0x37'))['field'](_0x18be('0x3a'),'updatedAt')['from'](_0x18be('0x3f'))[_0x18be('0x41')]('deletedAt\x20IS\x20NULL')[_0x18be('0x41')](_0x18be('0x47'),LISTID[_0x18be('0x3c')]())[_0x18be('0x41')](_0x18be('0x48'),squel[_0x18be('0x49')](hopperContacts))[_0x18be('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0x18be('0x3c')]();return _0x1f54bd;}function _0x2ad642(_0x2ac1bd,_0x313c35){var _0xc9adff=squel['insert']()[_0x18be('0x46')](_0x18be('0x4c'))[_0x18be('0x35')](['phone','ContactId',_0x18be('0x27'),_0x313c35,'createdAt',_0x18be('0x3d')],squel[_0x18be('0x38')]()[_0x18be('0x39')](_0x18be('0x22'),_0x18be('0x22'))['field']('id',_0x18be('0x36'))['field'](LISTID[_0x18be('0x3c')](),'ListId')[_0x18be('0x39')](_0x2ac1bd['id'][_0x18be('0x3c')](),_0x313c35)['field'](_0x18be('0x3a'),'createdAt')[_0x18be('0x39')]('NOW()',_0x18be('0x3d'))[_0x18be('0x3e')]('cm_contacts')[_0x18be('0x41')](_0x18be('0x40'))[_0x18be('0x41')]('ListId\x20=\x20?',LISTID[_0x18be('0x3c')]())[_0x18be('0x41')](_0x18be('0x48'),squel[_0x18be('0x49')](hopperContacts))[_0x18be('0x41')](_0x18be('0x42')))[_0x18be('0x3c')]();return _0xc9adff;}return db[_0x18be('0x4d')][_0x18be('0x4e')]({'where':{'type':_0x18be('0x4f')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x18be('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x5dae74){var _0x3da70e=[];if(_0x5dae74){var _0x356110;for(var _0x35981d=0x0,_0xd407d5;_0x35981d<_0x5dae74[_0x18be('0x29')];_0x35981d+=0x1){_0xd407d5=_0x5dae74[_0x35981d][_0x18be('0x51')]({'plain':!![]});switch(_0xd407d5[_0x18be('0x52')]){case _0x18be('0x53'):_0x3da70e[_0x18be('0x30')](db['sequelize']['query'](_0x56879c(_0xd407d5,_0x18be('0x54')))[_0x18be('0x2f')](function(){})[_0x18be('0x55')](_0x4fe4c9()));break;case _0x18be('0x56'):_0x3da70e[_0x18be('0x30')](db['sequelize'][_0x18be('0x57')](_0x2c9b27(_0xd407d5,'VoiceQueueId'))[_0x18be('0x2f')](function(){})[_0x18be('0x55')](_0x4fe4c9()));break;default:_0x3da70e[_0x18be('0x30')](db['sequelize'][_0x18be('0x57')](_0x1250da(_0xd407d5,_0x18be('0x54')))['then'](function(){})[_0x18be('0x55')](_0x4fe4c9()));}}}return _0x3da70e;})['all']()[_0x18be('0x2f')](function(){return db[_0x18be('0x4d')][_0x18be('0x4e')]({'where':{'type':_0x18be('0x4f')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x18be('0x58'),'where':{'id':LISTID}}]})[_0x18be('0x2f')](function(_0x2595d3){var _0x109481=[];if(_0x2595d3){var _0x127053;for(var _0x226a62=0x0,_0x1e7240;_0x226a62<_0x2595d3[_0x18be('0x29')];_0x226a62+=0x1){_0x1e7240=_0x2595d3[_0x226a62][_0x18be('0x51')]({'plain':!![]});_0x109481[_0x18be('0x30')](db[_0x18be('0x59')]['query'](_0x2ad642(_0x1e7240,_0x18be('0x54')))[_0x18be('0x2f')](function(){})[_0x18be('0x55')](_0x4fe4c9()));}}return _0x109481;})[_0x18be('0x5a')]();})['then'](function(){return db['Campaign'][_0x18be('0x4e')]({'attributes':['id',_0x18be('0x52')],'include':[{'model':db[_0x18be('0x5b')],'as':_0x18be('0x50'),'where':{'id':LISTID}}]})[_0x18be('0x2f')](function(_0xddacda){var _0x1e33b9=[];if(_0xddacda){for(var _0x2c1462=0x0,_0x57246a;_0x2c1462<_0xddacda[_0x18be('0x29')];_0x2c1462+=0x1){_0x57246a=_0xddacda[_0x2c1462][_0x18be('0x51')]({'plain':!![]});switch(_0x57246a[_0x18be('0x52')]){case _0x18be('0x53'):_0x1e33b9[_0x18be('0x30')](db['sequelize']['query'](_0x56879c(_0x57246a,_0x18be('0x5c')))[_0x18be('0x2f')](function(){})[_0x18be('0x55')](_0x4fe4c9()));break;case _0x18be('0x56'):_0x1e33b9[_0x18be('0x30')](db[_0x18be('0x59')][_0x18be('0x57')](_0x2c9b27(_0x57246a,_0x18be('0x5c')))['then'](function(){})[_0x18be('0x55')](_0x4fe4c9()));break;default:_0x1e33b9['push'](db[_0x18be('0x59')][_0x18be('0x57')](_0x1250da(_0x57246a,_0x18be('0x5c')))[_0x18be('0x2f')](function(){})['catch'](_0x4fe4c9()));}}}return _0x1e33b9;})[_0x18be('0x5a')]();})['then'](function(){return db[_0x18be('0x5d')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x18be('0x5b')],'as':_0x18be('0x58'),'where':{'id':LISTID}}]})[_0x18be('0x2f')](function(_0x248f94){var _0x455e3a=[];if(_0x248f94){for(var _0x36aac9=0x0,_0x51d8f7;_0x36aac9<_0x248f94[_0x18be('0x29')];_0x36aac9+=0x1){_0x51d8f7=_0x248f94[_0x36aac9][_0x18be('0x51')]({'plain':!![]});_0x455e3a[_0x18be('0x30')](db['sequelize'][_0x18be('0x57')](_0x2ad642(_0x51d8f7,_0x18be('0x5c')))[_0x18be('0x2f')](function(){})['catch'](_0x4fe4c9()));}}return _0x455e3a;})[_0x18be('0x5a')]();})[_0x18be('0x55')](function(_0x5c19ec){logger[_0x18be('0x16')]('cmContact,\x20%s,\x20%s',_0x18be('0x5e'),_0x5c19ec[_0x18be('0x1c')]);});}var processPromises=function(_0x3af6c2){return BPromise[_0x18be('0x5a')](promises)[_0x18be('0x2f')](function(_0x599a4a){})[_0x18be('0x55')](function(_0x2f982b){logger['error'](_0x18be('0x5f'),JSON['stringify'](_0x2f982b));})[_0x18be('0x60')](function(){socket['emit'](_0x18be('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3af6c2){return _0x3af6c2[_0x18be('0x62')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x18be('0x2f')](function(){if(hopperContacts){return checkHopper();}})[_0x18be('0x2f')](function(){socket[_0x18be('0x63')](_0x18be('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x18be('0x64')](FILEPATH);}catch(_0x59d4de){logger[_0x18be('0x16')](_0x18be('0x65'),JSON['stringify'](_0x59d4de));}finally{process[_0x18be('0x66')](0x0);}});};process['on'](_0x18be('0x67'),function(){logger[_0x18be('0x68')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x18be('0x69')]()[_0x18be('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x18be('0x14')](',');return db['CmContact'][_0x18be('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1b1d9d){var _0x3565a7=fs[_0x18be('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x18be('0x6b')](_0x3565a7,{'header':!![],'skipEmptyLines':!![],'step':function(_0x26c83f,_0x324a53){total+=0x1;var _0xc97046=total;promises[_0x18be('0x30')](checkRow(_0x26c83f,_0x1b1d9d,_0xc97046)[_0x18be('0x2f')](function(){success+=0x1;})[_0x18be('0x55')](function(_0x836134){if(_0x836134[_0x18be('0x16')]){errors+=0x1;delete _0x836134['error'];}else if(_0x836134[_0x18be('0x2b')]){duplicates+=0x1;delete _0x836134['duplicate'];}rows[_0x18be('0x30')](_0x836134);}));if(total%0xc8===0x0){_0x324a53['pause']();return processPromises(_0x324a53);}},'complete':function(){return processPromises()[_0x18be('0x2f')](function(){logger[_0x18be('0x68')](_0x18be('0x6c'));endCsv();});},'error':function(_0x2529b8,_0xe6b94d){logger[_0x18be('0x68')](_0x18be('0x6d'),JSON['stringify'](_0x2529b8));endCsv();}});})[_0x18be('0x55')](function(_0x1744ea){logger[_0x18be('0x16')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x18be('0x32')](_0x1744ea));});}main(); \ No newline at end of file +var _0xa905=['outbound','dialCheckDuplicateType','CmList','get','sequelize','query','VoiceQueueId','all','BlackLists','Campaign','Lists','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','emit','resume','resolve','contact:csv_','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','ioredis','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','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','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','find','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','NOW()','field','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','calleridnum','cm_hopper_final','id\x20IN\x20?','str','cm_hopper_black','VoiceQueue','findAll'];(function(_0x3890d7,_0x5d6229){var _0x224e89=function(_0x2d82f0){while(--_0x2d82f0){_0x3890d7['push'](_0x3890d7['shift']());}};_0x224e89(++_0x5d6229);}(_0xa905,0x100));var _0x5a90=function(_0x3a4ebc,_0x5136b2){_0x3a4ebc=_0x3a4ebc-0x0;var _0xbca62b=_0xa905[_0x3a4ebc];return _0xbca62b;};'use strict';var BPromise=require(_0x5a90('0x0'));var util=require(_0x5a90('0x1'));var _=require(_0x5a90('0x2'));var fs=require('fs');var squel=require(_0x5a90('0x3'));var Papa=require('papaparse');var Redis=require(_0x5a90('0x4'));var db=require(_0x5a90('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x5a90('0x6'))(_0x5a90('0x7'));config[_0x5a90('0x8')]=_['defaults'](config[_0x5a90('0x8')],{'host':_0x5a90('0x9'),'port':0x18eb});var socket=require(_0x5a90('0xa'))(new Redis(config['redis']));require(_0x5a90('0xb'))[_0x5a90('0xc')](socket);try{if(!process[_0x5a90('0xd')][0x2]||process['argv'][0x2]===_0x5a90('0xe')||process['argv'][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x5a90('0xd')][0x2];if(!process[_0x5a90('0xd')][0x3]||process[_0x5a90('0xd')][0x3]===_0x5a90('0xe')||process[_0x5a90('0xd')][0x3]===_0x5a90('0xf')||!process['argv'][0x4]||process[_0x5a90('0xd')][0x4]==='undefined'||process[_0x5a90('0xd')][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x5a90('0x10')](process[_0x5a90('0xd')][0x3][_0x5a90('0x11')](','),process[_0x5a90('0xd')][0x4]['split'](','));if(!process[_0x5a90('0xd')][0x5]||process[_0x5a90('0xd')][0x5]==='undefined'||process[_0x5a90('0xd')][0x5]===_0x5a90('0xf')){throw new Error(_0x5a90('0x12'));}var LISTID=process[_0x5a90('0xd')][0x5];var COMPANYID=process[_0x5a90('0xd')][0x6]&&process[_0x5a90('0xd')][0x6]!=='undefined'&&process[_0x5a90('0xd')][0x6]!==_0x5a90('0xf')?process[_0x5a90('0xd')][0x6]:null;var DUPLICATES=process[_0x5a90('0xd')][0x7]&&process[_0x5a90('0xd')][0x7]!==_0x5a90('0xe')&&process['argv'][0x7]!==_0x5a90('0xf')?process[_0x5a90('0xd')][0x7]:null;if(!process[_0x5a90('0xd')][0x8]||process[_0x5a90('0xd')][0x8]===_0x5a90('0xe')||process['argv'][0x8]===_0x5a90('0xf')){throw new Error(_0x5a90('0x13'));}var SOCKET_TIMESTAMP=process[_0x5a90('0xd')][0x8];}catch(_0x39f6c5){logger[_0x5a90('0x14')](_0x39f6c5);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(_0x33075a,_0x14dff7,_0x5ae7ab,_0x11ca77){var _0x6eb1be={'message':_0x14dff7};_0x6eb1be[_0x33075a]=!![];if(_0x5ae7ab){_0x6eb1be[_0x5a90('0x15')]=_0x5ae7ab;}if(_0x11ca77){_0x6eb1be[_0x5a90('0x16')]=_0x11ca77;}return _0x6eb1be;}function isEmail(_0x18b6f2){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))*$/[_0x5a90('0x17')](_0x18b6f2);}function checkRow(_0x4840f9,_0x2d6cba,_0x549a60){return new BPromise(function(_0x55929b,_0x1a8387){if(_[_0x5a90('0x18')](_0x4840f9)){return _0x1a8387(handleCheckRowError(_0x5a90('0x14'),_0x5a90('0x19'),null,_0x549a60));}if(_0x4840f9[_0x5a90('0x1a')]&&_0x4840f9[_0x5a90('0x1a')][_0x5a90('0x1b')]){var _0x254562=_[_0x5a90('0x1c')](_0x4840f9[_0x5a90('0x1a')],_0x5a90('0x1d'))[_0x5a90('0x1e')](';');return _0x1a8387(handleCheckRowError(_0x5a90('0x14'),_0x254562,null,_0x549a60));}var _0xea1c0c={};for(var _0x3769f7 in FIELDS){if(FIELDS[_0x5a90('0x1f')](_0x3769f7)&&FIELDS[_0x3769f7]){_0xea1c0c[_0x3769f7]=_0x4840f9[_0x5a90('0x20')][0x0][FIELDS[_0x3769f7]]||_0x4840f9['data'][0x0]['\ufeff'+FIELDS[_0x3769f7]];}}if(!_0xea1c0c[_0x5a90('0x21')]){return _0x1a8387(handleCheckRowError(_0x5a90('0x14'),_0x5a90('0x22'),null,_0x549a60));}if(!_0xea1c0c[_0x5a90('0x23')]){return _0x1a8387(handleCheckRowError(_0x5a90('0x14'),_0x5a90('0x24'),null,_0x549a60));}if(_0xea1c0c[_0x5a90('0x25')]){var _0x11d26a=moment(_0xea1c0c[_0x5a90('0x25')],_0x5a90('0x26'));if(!_0x11d26a['isValid']()){return _0x1a8387(handleCheckRowError(_0x5a90('0x14'),_0x5a90('0x27'),null,_0x549a60));}}if(_0xea1c0c[_0x5a90('0x28')]){if(!isEmail(_0xea1c0c['email'])){return _0x1a8387(handleCheckRowError(_0x5a90('0x14'),_0x5a90('0x29'),null,_0x549a60));}}_0xea1c0c[_0x5a90('0x2a')]=LISTID;_0xea1c0c[_0x5a90('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x5a90('0x1b')]&&_0x2d6cba){var _0x57a353={};for(var _0x6efb89=0x0,_0x158a90=DUPLICATES['length'];_0x6efb89<_0x158a90;_0x6efb89+=0x1){_0x57a353[DUPLICATES[_0x6efb89]]=_0xea1c0c[DUPLICATES[_0x6efb89]];}var _0x52fbef=_[_0x5a90('0x2c')](_0x2d6cba,_0x57a353);if(_0x52fbef){return _0x1a8387(handleCheckRowError('duplicate','Duplicate\x20Contact',_0x52fbef,_0x549a60));}}return db[_0x5a90('0x2d')][_0x5a90('0x2e')](_0xea1c0c,{'raw':!![],'hooks':![],'fields':_[_0x5a90('0x2f')](_0xea1c0c)})[_0x5a90('0x30')](function(_0x16f5b6){if(DUPLICATES&&DUPLICATES[_0x5a90('0x1b')]&&_0x2d6cba){_0x2d6cba[_0x5a90('0x31')](_[_0x5a90('0x32')](_0xea1c0c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x16f5b6['id'];return _0x55929b();})[_0x5a90('0x33')](function(_0x408e61){return _0x1a8387(handleCheckRowError(_0x5a90('0x14'),_0x5a90('0x34')+(_0x408e61[_0x5a90('0x1d')]||JSON[_0x5a90('0x35')](_0x408e61)),null,_0x549a60));});});}function checkHopper(){function _0x2b7c98(){return function(_0x3884fe){logger[_0x5a90('0x14')](_0x5a90('0x36'),_0x5a90('0x37'),util['inspect'](_0x3884fe,{'showHidden':![],'depth':null}));};}var _0x4b7204=function(_0x3dc160,_0x2039f7){var _0x463b52=squel[_0x5a90('0x38')]()[_0x5a90('0x39')](_0x5a90('0x3a'))[_0x5a90('0x3b')]([_0x5a90('0x23'),_0x5a90('0x3c'),_0x5a90('0x3d'),_0x5a90('0x2a'),_0x2039f7,_0x5a90('0x3e'),_0x5a90('0x3f')],squel[_0x5a90('0x40')]()['field'](_0x5a90('0x23'),'phone')['field'](_0x5a90('0x41'),_0x5a90('0x3c'))[_0x5a90('0x42')]('id',_0x5a90('0x3d'))['field'](LISTID['toString'](),_0x5a90('0x2a'))[_0x5a90('0x42')](_0x3dc160['id'][_0x5a90('0x43')](),_0x2039f7)['field']('NOW()',_0x5a90('0x3e'))[_0x5a90('0x42')]('NOW()',_0x5a90('0x3f'))[_0x5a90('0x44')](_0x5a90('0x45'))[_0x5a90('0x46')](_0x5a90('0x47'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0x5a90('0x46')](_0x5a90('0x48'))[_0x5a90('0x46')](_0x5a90('0x49'),squel[_0x5a90('0x40')]()[_0x5a90('0x42')](_0x5a90('0x23'))[_0x5a90('0x44')](_0x5a90('0x3a'))['where'](_0x2039f7+_0x5a90('0x4a'),_0x3dc160['id'][_0x5a90('0x43')]())))[_0x5a90('0x43')]();return _0x463b52;};var _0x373593=function(_0x107287,_0x5d8dc6){var _0x5d7ad4=squel[_0x5a90('0x38')]()[_0x5a90('0x39')]('cm_hopper')[_0x5a90('0x3b')](['phone',_0x5a90('0x3c'),'ContactId',_0x5a90('0x2a'),_0x5d8dc6,'createdAt',_0x5a90('0x3f')],squel[_0x5a90('0x40')]()[_0x5a90('0x42')](_0x5a90('0x23'),'phone')[_0x5a90('0x42')](_0x5a90('0x41'),_0x5a90('0x3c'))[_0x5a90('0x42')]('id',_0x5a90('0x3d'))[_0x5a90('0x42')](LISTID[_0x5a90('0x43')](),_0x5a90('0x2a'))[_0x5a90('0x42')](_0x107287['id'][_0x5a90('0x43')](),_0x5d8dc6)['field'](_0x5a90('0x41'),_0x5a90('0x3e'))[_0x5a90('0x42')](_0x5a90('0x41'),_0x5a90('0x3f'))[_0x5a90('0x44')]('cm_contacts')[_0x5a90('0x46')](_0x5a90('0x47'))['where'](_0x5a90('0x4b'),LISTID['toString']())[_0x5a90('0x46')]('id\x20IN\x20?',squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0x5a90('0x46')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x5a90('0x42')](_0x5a90('0x4c'))['from'](_0x5a90('0x4d'))['where'](_0x5d8dc6+_0x5a90('0x4a'),_0x107287['id'][_0x5a90('0x43')]()))['where'](_0x5a90('0x49'),squel[_0x5a90('0x40')]()[_0x5a90('0x42')](_0x5a90('0x23'))['from'](_0x5a90('0x3a'))[_0x5a90('0x46')](_0x5d8dc6+'\x20=\x20?',_0x107287['id'][_0x5a90('0x43')]())))[_0x5a90('0x43')]();return _0x5d7ad4;};function _0x35e70d(_0x37aa20,_0x109d11){var _0x506736=squel['insert']()[_0x5a90('0x39')](_0x5a90('0x3a'))[_0x5a90('0x3b')]([_0x5a90('0x23'),'scheduledAt',_0x5a90('0x3d'),_0x5a90('0x2a'),_0x109d11,_0x5a90('0x3e'),'updatedAt'],squel['select']()[_0x5a90('0x42')](_0x5a90('0x23'),_0x5a90('0x23'))[_0x5a90('0x42')](_0x5a90('0x41'),_0x5a90('0x3c'))['field']('id','ContactId')['field'](LISTID[_0x5a90('0x43')](),_0x5a90('0x2a'))['field'](_0x37aa20['id']['toString'](),_0x109d11)[_0x5a90('0x42')](_0x5a90('0x41'),'createdAt')[_0x5a90('0x42')]('NOW()',_0x5a90('0x3f'))[_0x5a90('0x44')]('cm_contacts')[_0x5a90('0x46')](_0x5a90('0x47'))['where'](_0x5a90('0x4b'),LISTID[_0x5a90('0x43')]())[_0x5a90('0x46')](_0x5a90('0x4e'),squel[_0x5a90('0x4f')](hopperContacts))[_0x5a90('0x46')](_0x5a90('0x48')))[_0x5a90('0x43')]();return _0x506736;}function _0x2ea161(_0x1dde33,_0x4e2eef){var _0x5c0892=squel[_0x5a90('0x38')]()[_0x5a90('0x39')](_0x5a90('0x50'))[_0x5a90('0x3b')]([_0x5a90('0x23'),_0x5a90('0x3d'),_0x5a90('0x2a'),_0x4e2eef,_0x5a90('0x3e'),'updatedAt'],squel[_0x5a90('0x40')]()[_0x5a90('0x42')]('phone',_0x5a90('0x23'))[_0x5a90('0x42')]('id',_0x5a90('0x3d'))['field'](LISTID[_0x5a90('0x43')](),_0x5a90('0x2a'))[_0x5a90('0x42')](_0x1dde33['id'][_0x5a90('0x43')](),_0x4e2eef)[_0x5a90('0x42')](_0x5a90('0x41'),_0x5a90('0x3e'))[_0x5a90('0x42')](_0x5a90('0x41'),_0x5a90('0x3f'))[_0x5a90('0x44')](_0x5a90('0x45'))[_0x5a90('0x46')](_0x5a90('0x47'))['where'](_0x5a90('0x4b'),LISTID[_0x5a90('0x43')]())[_0x5a90('0x46')]('id\x20IN\x20?',squel[_0x5a90('0x4f')](hopperContacts))['where'](_0x5a90('0x48')))['toString']();return _0x5c0892;}return db[_0x5a90('0x51')][_0x5a90('0x52')]({'where':{'type':_0x5a90('0x53')},'attributes':['id',_0x5a90('0x54')],'include':[{'model':db[_0x5a90('0x55')],'as':'Lists','where':{'id':LISTID}}]})[_0x5a90('0x30')](function(_0x2cfd11){var _0x5314e2=[];if(_0x2cfd11){var _0x50ba94;for(var _0x4a960f=0x0,_0x536b85;_0x4a960f<_0x2cfd11[_0x5a90('0x1b')];_0x4a960f+=0x1){_0x536b85=_0x2cfd11[_0x4a960f][_0x5a90('0x56')]({'plain':!![]});switch(_0x536b85[_0x5a90('0x54')]){case'always':_0x5314e2[_0x5a90('0x31')](db[_0x5a90('0x57')][_0x5a90('0x58')](_0x373593(_0x536b85,_0x5a90('0x59')))[_0x5a90('0x30')](function(){})[_0x5a90('0x33')](_0x2b7c98()));break;case'onlyIfOpen':_0x5314e2['push'](db[_0x5a90('0x57')]['query'](_0x4b7204(_0x536b85,_0x5a90('0x59')))[_0x5a90('0x30')](function(){})[_0x5a90('0x33')](_0x2b7c98()));break;default:_0x5314e2[_0x5a90('0x31')](db['sequelize'][_0x5a90('0x58')](_0x35e70d(_0x536b85,_0x5a90('0x59')))['then'](function(){})[_0x5a90('0x33')](_0x2b7c98()));}}}return _0x5314e2;})[_0x5a90('0x5a')]()[_0x5a90('0x30')](function(){return db[_0x5a90('0x51')][_0x5a90('0x52')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x5a90('0x5b'),'where':{'id':LISTID}}]})[_0x5a90('0x30')](function(_0x5ec57f){var _0x1e8309=[];if(_0x5ec57f){var _0x16468d;for(var _0x7c9a15=0x0,_0x48850;_0x7c9a15<_0x5ec57f[_0x5a90('0x1b')];_0x7c9a15+=0x1){_0x48850=_0x5ec57f[_0x7c9a15]['get']({'plain':!![]});_0x1e8309['push'](db['sequelize']['query'](_0x2ea161(_0x48850,_0x5a90('0x59')))[_0x5a90('0x30')](function(){})[_0x5a90('0x33')](_0x2b7c98()));}}return _0x1e8309;})[_0x5a90('0x5a')]();})[_0x5a90('0x30')](function(){return db[_0x5a90('0x5c')][_0x5a90('0x52')]({'attributes':['id',_0x5a90('0x54')],'include':[{'model':db['CmList'],'as':_0x5a90('0x5d'),'where':{'id':LISTID}}]})[_0x5a90('0x30')](function(_0x3e92e4){var _0x2c7129=[];if(_0x3e92e4){for(var _0x446a26=0x0,_0x144c83;_0x446a26<_0x3e92e4['length'];_0x446a26+=0x1){_0x144c83=_0x3e92e4[_0x446a26]['get']({'plain':!![]});switch(_0x144c83[_0x5a90('0x54')]){case'always':_0x2c7129['push'](db[_0x5a90('0x57')]['query'](_0x373593(_0x144c83,_0x5a90('0x5e')))[_0x5a90('0x30')](function(){})['catch'](_0x2b7c98()));break;case _0x5a90('0x5f'):_0x2c7129['push'](db['sequelize'][_0x5a90('0x58')](_0x4b7204(_0x144c83,_0x5a90('0x5e')))[_0x5a90('0x30')](function(){})['catch'](_0x2b7c98()));break;default:_0x2c7129[_0x5a90('0x31')](db['sequelize'][_0x5a90('0x58')](_0x35e70d(_0x144c83,'CampaignId'))[_0x5a90('0x30')](function(){})['catch'](_0x2b7c98()));}}}return _0x2c7129;})['all']();})[_0x5a90('0x30')](function(){return db[_0x5a90('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x5a90('0x55')],'as':_0x5a90('0x5b'),'where':{'id':LISTID}}]})['then'](function(_0x2442dc){var _0x1f9040=[];if(_0x2442dc){for(var _0x5b5771=0x0,_0x128f9d;_0x5b5771<_0x2442dc[_0x5a90('0x1b')];_0x5b5771+=0x1){_0x128f9d=_0x2442dc[_0x5b5771][_0x5a90('0x56')]({'plain':!![]});_0x1f9040[_0x5a90('0x31')](db[_0x5a90('0x57')]['query'](_0x2ea161(_0x128f9d,_0x5a90('0x5e')))[_0x5a90('0x30')](function(){})['catch'](_0x2b7c98()));}}return _0x1f9040;})[_0x5a90('0x5a')]();})['catch'](function(_0x1c4331){logger[_0x5a90('0x14')](_0x5a90('0x60'),_0x5a90('0x61'),_0x1c4331[_0x5a90('0x1d')]);});}var processPromises=function(_0x357282){return BPromise[_0x5a90('0x5a')](promises)[_0x5a90('0x30')](function(_0xe3b9e5){})[_0x5a90('0x33')](function(_0xa61691){logger[_0x5a90('0x14')]('Error\x20processing\x20rows\x20block:',JSON[_0x5a90('0x35')](_0xa61691));})['finally'](function(){socket[_0x5a90('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x357282){return _0x357282[_0x5a90('0x63')]();}});};var endCsv=function(){return BPromise[_0x5a90('0x64')]()[_0x5a90('0x30')](function(){if(hopperContacts){return checkHopper();}})[_0x5a90('0x30')](function(){socket[_0x5a90('0x62')](_0x5a90('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x5a90('0x66')](FILEPATH);}catch(_0x9e449f){logger[_0x5a90('0x14')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x5a90('0x35')](_0x9e449f));}finally{process[_0x5a90('0x67')](0x0);}});};process['on'](_0x5a90('0x68'),function(){logger[_0x5a90('0x69')](_0x5a90('0x6a'));endCsv();});function main(){return BPromise[_0x5a90('0x64')]()[_0x5a90('0x30')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x5a90('0x11')](',');return db[_0x5a90('0x2d')][_0x5a90('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x5b5578){var _0x1cd90d=fs[_0x5a90('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x5a90('0x6c')](_0x1cd90d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x277b29,_0x5637cb){total+=0x1;var _0x22a0e1=total;promises['push'](checkRow(_0x277b29,_0x5b5578,_0x22a0e1)['then'](function(){success+=0x1;})[_0x5a90('0x33')](function(_0x2193a1){if(_0x2193a1[_0x5a90('0x14')]){errors+=0x1;delete _0x2193a1[_0x5a90('0x14')];}else if(_0x2193a1[_0x5a90('0x6d')]){duplicates+=0x1;delete _0x2193a1[_0x5a90('0x6d')];}rows[_0x5a90('0x31')](_0x2193a1);}));if(total%0xc8===0x0){_0x5637cb[_0x5a90('0x6e')]();return processPromises(_0x5637cb);}},'complete':function(){return processPromises()[_0x5a90('0x30')](function(){logger[_0x5a90('0x69')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x256db3,_0x33be12){logger[_0x5a90('0x69')](_0x5a90('0x6f'),JSON[_0x5a90('0x35')](_0x256db3));endCsv();}});})[_0x5a90('0x33')](function(_0x40e381){logger[_0x5a90('0x14')](_0x5a90('0x70'),JSON[_0x5a90('0x35')](_0x40e381));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 2b51a00..b9395fa 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 _0x1860=['\x22onlyIfOpen\x22','\x22always\x22','insert','cm_hopper_black','ContactId','ListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','priority','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt','MIN(id)','min_id','group','info','Received\x20SIGINT','message','exit','errors','code','sequelize','query','spread','catch','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','offset','main','stringify','send','binding','socket_timestamp','root','server/files/tmp','.csv','includes','ContactItemType','name','_description','header','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','contact:import:','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','findAll','length','all','then','AdditionalPhones','push','isNil','filter','split','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)'];(function(_0x21ee39,_0x4cfb13){var _0x11cd6a=function(_0x20d235){while(--_0x20d235){_0x21ee39['push'](_0x21ee39['shift']());}};_0x11cd6a(++_0x4cfb13);}(_0x1860,0x1e5));var _0x0186=function(_0x3d6f19,_0x30d37a){_0x3d6f19=_0x3d6f19-0x0;var _0x2f93ac=_0x1860[_0x3d6f19];return _0x2f93ac;};'use strict';var fs=require('fs');var path=require(_0x0186('0x0'));var _=require(_0x0186('0x1'));var Papa=require(_0x0186('0x2'));var util=require(_0x0186('0x3'));var BPromise=require('bluebird');var moment=require(_0x0186('0x4'));var squel=require(_0x0186('0x5'));var Redis=require(_0x0186('0x6'));var db=require(_0x0186('0x7'))['db'];var config=require(_0x0186('0x8'));var shared=require(_0x0186('0x9'));var logger=require(_0x0186('0xa'))(_0x0186('0xb'));config[_0x0186('0xc')]=_[_0x0186('0xd')](config[_0x0186('0xc')],{'host':_0x0186('0xe'),'port':0x18eb});var socket=require(_0x0186('0xf'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x0186('0x10')]('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()[_0x0186('0x10')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x2460c2){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))*$/[_0x0186('0x11')](_0x2460c2);}function selectNotIn(_0x452e27,_0x29a732,_0x1cb167,_0x5e1d29,_0x34d3b7){return squel[_0x0186('0x12')]()[_0x0186('0x13')](_0x0186('0x14'))[_0x0186('0x15')](_0x5e1d29)['join'](_0x29a732,null,_0x29a732+_0x0186('0x16')+_0x5e1d29+'.'+_0x1cb167)[_0x0186('0x17')](_0x5e1d29+'.'+_0x1cb167+_0x0186('0x18')+_0x452e27+'.'+_0x1cb167)[_0x0186('0x17')](_0x29a732+_0x0186('0x19')+_0x34d3b7[_0x0186('0x1a')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x116381,_0x28a24b){promisesAdditionalPhones=[];return db[_0x0186('0x1b')][_0x0186('0x1c')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x5c32ca){if(_0x5c32ca!==null){var _0x1fe4f5=[];for(var _0x20a9b6=0x0;_0x20a9b6<_0x5c32ca[_0x0186('0x1d')];_0x20a9b6++){var _0x247cd9=_0x5c32ca[_0x20a9b6];_0x1fe4f5['push'](insertAdditionalPhones(_0x247cd9));}}Promise[_0x0186('0x1e')](_0x1fe4f5)[_0x0186('0x1f')](function(){_0x116381({'val':0x1});});});});}function insertAdditionalPhones(_0x3f13ee){return new Promise(function(_0x55e5eb,_0x56441f){var _0x45c7a1=_0x3f13ee[_0x0186('0x20')];var _0x471dcf=_0x45c7a1['split'](';');var _0x3f331a=[];orderBy=0x0;for(var _0x5161db=0x0;_0x5161db<_0x471dcf[_0x0186('0x1d')];_0x5161db++){_0x3f331a[_0x0186('0x21')](splitAdditionalPhone(_0x3f13ee['id'],_0x471dcf[_0x5161db]));}Promise['all'](_0x3f331a)['then'](function(){_0x55e5eb({'val':_0x471dcf['length']});});});}function splitAdditionalPhone(_0x3cf1bb,_0x178031){return new Promise(function(_0x90391a,_0x424bd4){var _0x4046c7=_0x178031['split'](':');var _0x14fa95=_0x4046c7[0x0];var _0x783908=_0x4046c7[0x1];if(!_[_0x0186('0x22')](_0x783908)){var _0x4c0ea9=_0x783908['split']('|');var _0x2d1178=[];for(var _0x18fd47=0x0;_0x18fd47<_0x4c0ea9[_0x0186('0x1d')];_0x18fd47++){if(_0x4c0ea9[_0x18fd47]!==''){var _0x15df6f=_[_0x0186('0x23')](promisesAdditionalPhones,{'contactId':_0x3cf1bb,'phone':_0x4c0ea9[_0x18fd47]});if(_0x15df6f[_0x0186('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0x0186('0x21')]({'contactId':_0x3cf1bb,'contactTypeId':_0x14fa95,'phone':_0x4c0ea9[_0x18fd47],'orderBy':orderBy});}}}_0x90391a({'ok':0x1});}else _0x90391a({'res':0x0});});}function createAdditionalPhone(_0x1d7ab7,_0x3aeb1b,_0x4549da,_0x1752a1){var _0x1baeed='';var _0x1e72dc='';var _0x285847=_0x4549da[_0x0186('0x24')]('§');_0x1baeed=_0x285847[0x0];if(_0x285847[_0x0186('0x1d')]==0x2)_0x1e72dc=_0x285847[0x1];return new Promise(function(_0x57e876,_0x46aec8){return db[_0x0186('0x25')]['findOne']({'where':{'CmContactId':_0x1d7ab7,'item':_0x1baeed}})[_0x0186('0x1f')](function(_0x5b8416){if(_0x5b8416){return db[_0x0186('0x25')][_0x0186('0x26')]({'ItemTypeId':_0x3aeb1b,'description':_0x1e72dc,'OrderBy':_0x1752a1},{'where':{'CmContactId':_0x1d7ab7,'item':_0x1baeed}})[_0x0186('0x1f')](function(_0x1e2d90){_0x57e876({'res':_0x0186('0x27')});});}else{return db['CmContactHasItem'][_0x0186('0x28')]({'CmContactId':_0x1d7ab7,'item':_0x1baeed,'description':_0x1e72dc,'ItemTypeId':_0x3aeb1b,'OrderBy':_0x1752a1,'ItemClass':_0x0186('0x29')})[_0x0186('0x1f')](function(_0x465747){_0x57e876({'res':_0x0186('0x2a')});});}});});}function insertCmHopper(_0x2956e5,_0x24583d,_0x30d352,_0x4a8005,_0x28f3a9){var _0x2ce776=[_0x0186('0x2b'),_0x0186('0x2c'),_0x0186('0x2d'),_0x0186('0x2e'),_0x24583d+'.'+_0x4a8005,_0x0186('0x2f'),_0x0186('0x30'),_0x0186('0x31'),_0x0186('0x32'),'\x22'+_0x28f3a9+'\x22'];return squel['insert']()[_0x0186('0x33')](_0x0186('0x34'))[_0x0186('0x35')]([_0x0186('0x14'),_0x0186('0x36'),'ContactId',_0x0186('0x37'),_0x4a8005,_0x0186('0x38'),_0x0186('0x39'),'priority',_0x0186('0x3a'),_0x0186('0x3b')],squel['select']()[_0x0186('0x3c')](_0x2ce776)[_0x0186('0x15')](_0x24583d)[_0x0186('0x1a')](_0x0186('0x3d'),null,_0x0186('0x3e')+_0x24583d+_0x0186('0x3f'))[_0x0186('0x1a')](_0x30d352,null,_0x30d352+_0x0186('0x16')+_0x24583d+'.'+_0x4a8005)[_0x0186('0x17')](_0x24583d+_0x0186('0x40'),_0x2956e5)[_0x0186('0x17')](_0x0186('0x41'),NOW)[_0x0186('0x17')](_0x0186('0x42'),selectNotIn(_0x24583d,_0x30d352,_0x4a8005,_0x0186('0x34'),['\x22always\x22',_0x0186('0x43')]))[_0x0186('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x24583d,_0x30d352,_0x4a8005,_0x0186('0x34'),[_0x0186('0x44')])))['toString']();}function insertCmHopperBlack(_0x86ab49,_0x2dd851,_0x43f9f2,_0x102856){var _0x2dfaf7=[_0x0186('0x2b'),'cm_contacts.id',_0x0186('0x2e'),_0x2dd851+'.'+_0x102856,_0x0186('0x2f'),'cm_contacts.updatedAt'];return squel[_0x0186('0x45')]()[_0x0186('0x33')](_0x0186('0x46'))[_0x0186('0x35')]([_0x0186('0x14'),_0x0186('0x47'),_0x0186('0x37'),_0x102856,_0x0186('0x38'),_0x0186('0x39')],squel[_0x0186('0x12')]()['fields'](_0x2dfaf7)['from'](_0x2dd851)[_0x0186('0x1a')](_0x0186('0x3d'),null,_0x0186('0x3e')+_0x2dd851+_0x0186('0x3f'))[_0x0186('0x1a')](_0x43f9f2,null,_0x43f9f2+_0x0186('0x16')+_0x2dd851+'.'+_0x102856)[_0x0186('0x17')](_0x2dd851+'.CmListId\x20=\x20?',_0x86ab49)[_0x0186('0x17')](_0x0186('0x41'),NOW)['where'](_0x0186('0x42'),squel[_0x0186('0x12')]()[_0x0186('0x13')]('phone')[_0x0186('0x15')](_0x0186('0x46'))[_0x0186('0x17')](_0x0186('0x48'),_0x86ab49)[_0x0186('0x17')](_0x102856+'\x20=\x20'+_0x2dd851+'.'+_0x102856)))[_0x0186('0x49')]();}function insertTzCmHopper(_0x55a721,_0x521c55,_0x3ec982,_0x111933,_0x1a0c10,_0x1a06e3){var _0x120c47=[_0x0186('0x2b'),_0x0186('0x4a')+_0x1a06e3+_0x0186('0x4b'),_0x0186('0x2d'),_0x0186('0x2e'),_0x521c55+'.'+_0x111933,_0x0186('0x2f'),_0x0186('0x30'),_0x0186('0x31'),_0x0186('0x32'),'\x22'+_0x1a0c10+'\x22'];var _0x2cd679=squel['insert']()[_0x0186('0x33')]('cm_hopper')[_0x0186('0x35')]([_0x0186('0x14'),'scheduledat',_0x0186('0x47'),'ListId',_0x111933,_0x0186('0x38'),'updatedAt',_0x0186('0x4c'),_0x0186('0x3a'),'recallme'],squel[_0x0186('0x12')]()[_0x0186('0x3c')](_0x120c47)[_0x0186('0x15')](_0x521c55)[_0x0186('0x1a')]('cm_contacts',null,_0x0186('0x3e')+_0x521c55+_0x0186('0x3f'))[_0x0186('0x1a')](_0x3ec982,null,_0x3ec982+_0x0186('0x16')+_0x521c55+'.'+_0x111933)[_0x0186('0x1a')](_0x1a06e3,null,_0x1a06e3+'.id\x20=\x20'+_0x521c55+'.'+_0x111933)[_0x0186('0x17')](_0x521c55+_0x0186('0x40'),_0x55a721)[_0x0186('0x17')](_0x0186('0x41'),NOW)[_0x0186('0x17')](_0x0186('0x42'),selectNotIn(_0x521c55,_0x3ec982,_0x111933,_0x0186('0x34'),[_0x0186('0x44'),_0x0186('0x43')]))[_0x0186('0x17')](_0x0186('0x42'),selectNotIn(_0x521c55,_0x3ec982,_0x111933,_0x0186('0x34'),[_0x0186('0x44')])))[_0x0186('0x49')]();return _0x2cd679;}function insertTzCmHopperBlack(_0x56b91b,_0x35483c,_0x19c61b,_0x254139){var _0x517478=[_0x0186('0x2b'),_0x0186('0x2d'),_0x0186('0x2e'),_0x35483c+'.'+_0x254139,_0x0186('0x2f'),_0x0186('0x30')];return squel['insert']()[_0x0186('0x33')]('cm_hopper_black')[_0x0186('0x35')]([_0x0186('0x14'),_0x0186('0x47'),'ListId',_0x254139,'createdAt',_0x0186('0x39')],squel['select']()[_0x0186('0x3c')](_0x517478)[_0x0186('0x15')](_0x35483c)[_0x0186('0x1a')](_0x0186('0x3d'),null,_0x0186('0x3e')+_0x35483c+_0x0186('0x3f'))[_0x0186('0x1a')](_0x19c61b,null,_0x19c61b+_0x0186('0x16')+_0x35483c+'.'+_0x254139)[_0x0186('0x17')](_0x35483c+_0x0186('0x40'),_0x56b91b)[_0x0186('0x17')](_0x0186('0x41'),NOW)[_0x0186('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x0186('0x12')]()['field'](_0x0186('0x14'))[_0x0186('0x15')](_0x0186('0x46'))[_0x0186('0x17')](_0x0186('0x48'),_0x56b91b)[_0x0186('0x17')](_0x254139+'\x20=\x20'+_0x35483c+'.'+_0x254139)))['toString']();}function insertCmHopperAdditionalPhones(_0x258da5){var _0x8c11c=[_0x0186('0x4d'),'cm_contact_has_items.item',_0x0186('0x4e'),_0x0186('0x4f'),'cm_contact_has_items.updatedAt'];return squel[_0x0186('0x45')]()['into'](_0x0186('0x50'))[_0x0186('0x35')]([_0x0186('0x51'),_0x0186('0x14'),'OrderBy',_0x0186('0x38'),_0x0186('0x39')],squel[_0x0186('0x12')]()['fields'](_0x8c11c)[_0x0186('0x15')](_0x0186('0x34'))[_0x0186('0x1a')](_0x0186('0x3d'),null,_0x0186('0x52'))['join']('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x0186('0x17')](_0x0186('0x53'),_0x258da5)[_0x0186('0x17')](_0x0186('0x41'),NOW))['toString']();}function insertCmContact(_0x430613,_0x4bdb45,_0x3f2590,_0x52fd1a){var _0x56b4ba=_[_0x0186('0x54')](_[_0x0186('0x55')](_0x52fd1a),[_0x0186('0x37'),_0x0186('0x56'),_0x0186('0x38'),_0x0186('0x39'),_0x0186('0x57')]);return squel['insert']()[_0x0186('0x33')]('cm_contacts')[_0x0186('0x35')](_0x56b4ba,squel[_0x0186('0x12')]()[_0x0186('0x3c')](_0x56b4ba)[_0x0186('0x15')](_0x4bdb45)[_0x0186('0x17')]('('+_0x3f2590['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x0186('0x12')]()[_0x0186('0x3c')](_0x3f2590)[_0x0186('0x15')](_0x0186('0x3d'))[_0x0186('0x17')]('ListId\x20=\x20?',_0x430613)[_0x0186('0x17')]('deletedAt\x20IS\x20NULL'))[_0x0186('0x17')]('id\x20IN\x20?',squel[_0x0186('0x12')]()['field'](_0x0186('0x58'),_0x0186('0x59'))[_0x0186('0x15')](_0x4bdb45)[_0x0186('0x5a')](_0x3f2590[_0x0186('0x1a')](','))))[_0x0186('0x49')]();}function handleStop(){logger[_0x0186('0x5b')](_0x0186('0x5c'));stopped=!![];}function handleUncaughtException(_0x451e3a){logger['error'](_0x451e3a[_0x0186('0x5d')]);process[_0x0186('0x5e')](0x1);}function handleError(_0x5a1b46,_0x5124b5){stats[_0x0186('0x5f')][_0x0186('0x21')]({'name':_0x5124b5[_0x0186('0x60')],'message':_0x5124b5[_0x0186('0x5d')],'row':_0x5a1b46});}function handleQuery(_0x13e8c0){logger[_0x0186('0x5b')](_0x13e8c0);return db[_0x0186('0x61')][_0x0186('0x62')](_0x13e8c0)[_0x0186('0x63')](function(_0x473548){results[_0x0186('0x21')](_0x473548);})[_0x0186('0x64')](function(_0x580a61){logger[_0x0186('0x65')](_0x580a61['message']);});}function updateTzCampaigns(_0x11c889){return new Promise(function(_0x4680af,_0x31a720){var _0x50b2fa=squel[_0x0186('0x12')]()[_0x0186('0x3c')]([_0x0186('0x66'),_0x0186('0x67')])[_0x0186('0x15')](_0x0186('0x68'))[_0x0186('0x1a')](_0x0186('0x69'),null,_0x0186('0x6a'))[_0x0186('0x17')]('campaigns_has_cm_lists.CmListId='+_0x11c889);db[_0x0186('0x61')][_0x0186('0x62')](_0x50b2fa[_0x0186('0x49')]())[_0x0186('0x63')](function(_0x9285ec){var _0x7e2ed3=[];for(var _0x27f60a=0x0;_0x27f60a<_0x9285ec['length'];_0x27f60a++){_0x7e2ed3[_0x0186('0x21')](getTimezoneData(_0x9285ec[_0x27f60a],tmp_campaigns));}BPromise['all'](_0x7e2ed3)[_0x0186('0x1f')](function(){_0x4680af({'val':0x1});});})[_0x0186('0x64')](function(_0x5178eb){logger[_0x0186('0x65')](_0x5178eb[_0x0186('0x5d')]);_0x4680af({'val':0x0});});});}function updateTzVoiceQueues(_0x4f8b81){return new Promise(function(_0x3c9fa2,_0x204459){var _0x2c2b8f=squel['select']()[_0x0186('0x3c')]([_0x0186('0x6b'),_0x0186('0x6c')])[_0x0186('0x15')](_0x0186('0x6d'))[_0x0186('0x1a')](_0x0186('0x6e'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where'](_0x0186('0x6f')+_0x4f8b81);db[_0x0186('0x61')][_0x0186('0x62')](_0x2c2b8f[_0x0186('0x49')]())['spread'](function(_0x6eb932){var _0x2f3200=[];for(var _0xa9b196=0x0;_0xa9b196<_0x6eb932[_0x0186('0x1d')];_0xa9b196++){_0x2f3200[_0x0186('0x21')](getTimezoneData(_0x6eb932[_0xa9b196],tmp_voice_queues));}BPromise[_0x0186('0x1e')](_0x2f3200)[_0x0186('0x1f')](function(){_0x3c9fa2({'val':0x1});});})[_0x0186('0x64')](function(_0xfdb8d9){logger[_0x0186('0x65')](_0xfdb8d9[_0x0186('0x5d')]);_0x3c9fa2({'val':0x0});});});}function getTimezoneData(_0x38ede2,_0x58f993){return new Promise(function(_0x24f1a6,_0xc95ea6){var _0x2df465=shared[_0x0186('0x70')];var _0x583c51=_0x2df465[_0x38ede2[_0x0186('0x71')]];if(_[_0x0186('0x22')](_0x583c51)){_0x24f1a6({'ret':0x1});}else{var _0x3237d6=_0x583c51[_0x0186('0x72')];var _0x235dab=squel[_0x0186('0x45')]()[_0x0186('0x33')](_0x58f993)['set']('id',_0x38ede2['id'])['set'](_0x0186('0x73'),_0x3237d6)['set'](_0x0186('0x71'),_0x38ede2[_0x0186('0x71')])[_0x0186('0x49')]();return db['sequelize'][_0x0186('0x62')](_0x235dab)[_0x0186('0x63')](function(_0x497d49){_0x24f1a6({'ret':0x1});})[_0x0186('0x64')](function(_0x105e6a){logger['error'](_0x105e6a[_0x0186('0x5d')]);_0xc95ea6({'ret':0x1});});}});}function handleTZQuery(_0x1363c0){logger[_0x0186('0x5b')](_0x1363c0);return db[_0x0186('0x61')][_0x0186('0x62')](_0x1363c0)['spread'](function(_0x46d572){})[_0x0186('0x64')](function(_0x351053){logger[_0x0186('0x65')](_0x351053['message']);});}function main(_0x15eb81,_0x5aa2a9,_0xe75f20,_0x21b7ea){logger[_0x0186('0x5b')](_0x0186('0x74'),_0x15eb81,JSON[_0x0186('0x75')](_0x5aa2a9));process[_0x0186('0x76')]('start');var _0x2ffa86=_0x5aa2a9[_0x0186('0x77')];var _0x2ce857=_['clone'](_0x2ffa86);var _0x2087ce=_0x5aa2a9[_0x0186('0x78')];var _0x481582=path['join'](config[_0x0186('0x79')],_0x0186('0x7a'),_0x2087ce+_0x0186('0x7b'));hasTZ=_[_0x0186('0x55')](_0x2ffa86)[_0x0186('0x7c')](_0x0186('0x71'));var _0x559f6e=_[_0x0186('0x55')](_0x2ffa86)[_0x0186('0x1a')]();logger['info']('header',_0x559f6e);db[_0x0186('0x7d')]['findAll']({'raw':!![],'attributes':['id',_0x0186('0x7e')]})[_0x0186('0x1f')](function(_0xb9671c){for(var _0x3df3b5=0x0;_0x3df3b5<_0xb9671c['length'];_0x3df3b5++){if(_0xb9671c[_0x3df3b5]['name']in _0x2ffa86){contactItemTypes[_0x0186('0x21')](_0xb9671c[_0x3df3b5]);delete _0x2ce857[_0xb9671c[_0x3df3b5]['name']];hasAdditionalPhones=!![];}for(var _0x1ab7c7 in _0x2ffa86){if(_0xb9671c[_0x3df3b5][_0x0186('0x7e')]+_0x0186('0x7f')===_0x1ab7c7){phoneDescriptions[_0x0186('0x21')]({'itemTypeId':_0xb9671c[_0x3df3b5]['id'],'description':_0x1ab7c7});delete _0x2ce857[_0x1ab7c7];}}}if(hasAdditionalPhones)_0x2ce857[_0x0186('0x20')]='';var _0x1658d1=_[_0x0186('0x55')](_0x2ce857)['join']();logger[_0x0186('0x5b')](_0x0186('0x80'),_0x1658d1);fs['writeFileSync'](_0x481582,_0x1658d1+'\x0a');Papa['parse'](fs[_0x0186('0x81')](_0x15eb81),{'header':!![],'skipEmptyLines':!![],'step':function(_0x566e47,_0xb7e428){try{for(var _0x2ce486=0x0,_0xd251eb=[];_0x2ce486<_0x566e47[_0x0186('0x82')][_0x0186('0x1d')];_0x2ce486++){stats[_0x0186('0x83')]+=0x1;if(_0x566e47[_0x0186('0x5f')][_0x2ce486]){handleError(_0x566e47[_0x0186('0x82')][_0x2ce486],_0x566e47[_0x0186('0x5f')][_0x2ce486]);}else{var _0x30b26e=[];var _0x1e8a47=[];var _0x4610be={};for(var _0x44dbd in _0x2ffa86){let _0x1210ec=contactItemTypes[_0x0186('0x84')](_0x174e7f=>_0x174e7f[_0x0186('0x7e')]===_0x44dbd);let _0x5adb25=contactItemTypes['find'](_0x2d728c=>_0x2d728c[_0x0186('0x7e')]+_0x0186('0x7f')===_0x44dbd);if(_[_0x0186('0x22')](_0x1210ec)&&_[_0x0186('0x22')](_0x5adb25)){if(_0x2ffa86[_0x0186('0x85')](_0x44dbd)){if(_0x566e47[_0x0186('0x82')][_0x2ce486][_0x2ffa86[_0x44dbd]]){var _0x2f20ce=_[_0x0186('0x86')](_0x566e47['data'][_0x2ce486][_0x2ffa86[_0x44dbd]][_0x0186('0x87')](/"/g,'\x27'));switch(_0x44dbd){case _0x0186('0x36'):var _0x46871e=moment(_0x2f20ce,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x46871e[_0x0186('0x88')]()){_0xd251eb[_0x0186('0x21')]('\x22'+_0x2f20ce+'\x22');}else{_0x30b26e[_0x0186('0x21')](_0x0186('0x89'));}break;case _0x0186('0x4c'):var _0x4de154=parseInt(_0x2f20ce);_0x2f20ce=_[_0x0186('0x8a')](_0x4de154)||_0x4de154<0x0||_0x4de154>0x4?_0x21b7ea?0x3:0x2:_0x4de154;_0xd251eb[_0x0186('0x21')]('\x22'+_0x2f20ce+'\x22');break;case _0x0186('0x3a'):var _0x14221e=parseInt(_0x2f20ce);if(_['isNumber'](_0x14221e)&&_[_0x0186('0x7c')](_0xe75f20,_0x14221e)){_0xd251eb[_0x0186('0x21')]('\x22'+_0x14221e+'\x22');}else{_0x30b26e[_0x0186('0x21')](_0x0186('0x8b'));}break;case _0x0186('0x8c'):if(isEmail(_0x2f20ce)){_0xd251eb[_0x0186('0x21')]('\x22'+_0x2f20ce+'\x22');}else{_0x30b26e[_0x0186('0x21')]('email\x20wrong\x20format');}break;case _0x0186('0x8d'):var _0x1f34f3=moment(_0x2f20ce,_0x0186('0x8e'),!![]);if(_0x1f34f3[_0x0186('0x88')]()){_0xd251eb['push']('\x22'+_0x2f20ce+'\x22');}else{_0x30b26e[_0x0186('0x21')](_0x0186('0x8f'));}break;case _0x0186('0x71'):var _0x606d86=shared[_0x0186('0x70')];var _0xf36169=_0x606d86[_0x2f20ce];if(!_[_0x0186('0x22')](_0xf36169)){var _0x55377e=_0xf36169[_0x0186('0x72')];_0xd251eb['push']('\x22'+_0x2f20ce+'\x22');_0xd251eb['push']('\x22'+_0x55377e+'\x22');}break;default:_0xd251eb['push']('\x22'+_0x2f20ce+'\x22');}}else{switch(_0x44dbd){case _0x0186('0x90'):case'phone':_0x30b26e['push'](_0x44dbd+_0x0186('0x91'));break;default:_0xd251eb[_0x0186('0x21')]('\x22\x22');}}}}else{var _0x2ea6aa='';if(!_[_0x0186('0x22')](_0x1210ec)){if(!_0x4610be[_0x0186('0x85')](_0x1210ec['id'])){if(!_[_0x0186('0x22')](_0x566e47[_0x0186('0x82')][_0x2ce486][_0x2ffa86[_0x44dbd]])){var _0x2f20ce=_[_0x0186('0x86')](_0x566e47[_0x0186('0x82')][_0x2ce486][_0x2ffa86[_0x44dbd]]['replace'](/"/g,'\x27'));var _0x373144=phoneDescriptions['find'](_0x5b399c=>_0x5b399c[_0x0186('0x92')]===_0x1210ec['id']);if(!_[_0x0186('0x22')](_0x373144)){var _0xdc9fe=_[_0x0186('0x86')](_0x566e47[_0x0186('0x82')][_0x2ce486][_0x2ffa86[_0x373144[_0x0186('0x93')]]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0xdc9fe))_0x2f20ce=_0x2f20ce+'§'+_0xdc9fe;}if(_0x2ea6aa=='')_0x2ea6aa=_0x2f20ce;else _0x2ea6aa+='|'+_0x2f20ce;}_0x1e8a47[_0x0186('0x21')](_0x1210ec['id']+':'+_0x2ea6aa);_0x4610be[_0x1210ec['id']]=0x1;}}}}if(hasAdditionalPhones){_0xd251eb['push']('\x22'+_0x1e8a47['join'](';')+'\x22');}if(_0x30b26e[_0x0186('0x1d')]){handleError(_0x566e47[_0x0186('0x82')][_0x2ce486],{'code':_0x0186('0x94'),'message':_0x30b26e[_0x0186('0x1a')]()});}else{fs['appendFileSync'](_0x481582,_0xd251eb[_0x0186('0x1a')]()+'\x0a');}_0xd251eb=[];}if(!(stats[_0x0186('0x83')]%0xc8)){socket['emit'](_0x0186('0x95')+_0x2087ce,stats);stats['errors']=[];}}if(stopped){logger[_0x0186('0x5b')]('Abort\x20parser');_0xb7e428[_0x0186('0x96')]();}}catch(_0x18928c){handleError(_0x566e47[_0x0186('0x82')][_0x2ce486],{'code':'SystemError','message':_0x18928c[_0x0186('0x5d')]});logger[_0x0186('0x65')](_0x0186('0x97'),_0x18928c[_0x0186('0x5d')]);}},'complete':function(){try{var _0x10cd71=[];var _0x917d9=[];var _0x5a9316=_0x0186('0x3d');if(_0x5aa2a9[_0x0186('0x98')]&&_0x5aa2a9[_0x0186('0x98')][_0x0186('0x1d')]){_0x5a9316=_0x0186('0x99')+_0x2087ce;_0x10cd71[_0x0186('0x21')](_0x0186('0x9a')+_0x5a9316+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x0186('0x9b')+_0x2087ce;tmp_voice_queues=_0x0186('0x9c')+_0x2087ce;_0x917d9[_0x0186('0x21')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x0186('0x9d'));_0x917d9[_0x0186('0x21')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x0186('0x9d'));BPromise['each'](_0x917d9,handleTZQuery)[_0x0186('0x1f')](function(_0x15e808){updateTzCampaigns(_0x5aa2a9[_0x0186('0x37')])[_0x0186('0x1f')](function(_0x5c1595){updateTzVoiceQueues(_0x5aa2a9[_0x0186('0x37')])[_0x0186('0x1f')](function(_0x484d11){if(hasTZ)_0x1658d1=_0x1658d1['replace'](_0x0186('0x71'),'dialTimezone,utcOffset');var _0x4882be=util['format'](_0x0186('0x9e'),_0x481582,_0x5a9316,_0x1658d1,_0x5aa2a9[_0x0186('0x37')],_0x5aa2a9['CompanyId']||null,NOW,NOW);if(_[_0x0186('0x22')](_0x2ffa86['scheduledat'])){_0x4882be+=_0x0186('0x9f');}_0x10cd71[_0x0186('0x21')](_0x4882be);if(_0x5aa2a9['duplicates']&&_0x5aa2a9[_0x0186('0x98')][_0x0186('0x1d')]){_0x10cd71[_0x0186('0x21')](insertCmContact(_0x5aa2a9[_0x0186('0x37')],_0x5a9316,_0x5aa2a9[_0x0186('0x98')],_0x2ffa86));_0x10cd71[_0x0186('0x21')]('DROP\x20TABLE\x20'+_0x5a9316+';');}BPromise[_0x0186('0xa0')](_0x10cd71,handleQuery)['then'](function(_0x29ad1a){BPromise[_0x0186('0x1e')]([handleAdditionalPhones()])[_0x0186('0x1f')](function(){_0x10cd71=[];for(var _0x383ec5=0x0;_0x383ec5\x20\x20','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','YYYY-MM-DD\x20HH:mm:ss','select','phone','.id\x20=\x20','\x20=\x20','where','join','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','findOne','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','updatedAt','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','field','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.createdAt','cm_contacts.UserId','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','exit','errors','message','sequelize','query'];(function(_0x406795,_0x58ba36){var _0x3ae6b4=function(_0x8d74e4){while(--_0x8d74e4){_0x406795['push'](_0x406795['shift']());}};_0x3ae6b4(++_0x58ba36);}(_0xb20d,0x1c6));var _0xdb20=function(_0xb61d97,_0x4c11ea){_0xb61d97=_0xb61d97-0x0;var _0x2b20a6=_0xb20d[_0xb61d97];return _0x2b20a6;};'use strict';var fs=require('fs');var path=require(_0xdb20('0x0'));var _=require(_0xdb20('0x1'));var Papa=require(_0xdb20('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0xdb20('0x3'));var squel=require(_0xdb20('0x4'));var Redis=require(_0xdb20('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xdb20('0x6'));var shared=require(_0xdb20('0x7'));var logger=require(_0xdb20('0x8'))('import');config['redis']=_['defaults'](config[_0xdb20('0x9')],{'host':_0xdb20('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdb20('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0xdb20('0xb'));function isEmail(_0x95c889){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'](_0x95c889);}function selectNotIn(_0xaba518,_0x2f8b4b,_0x221d77,_0x4de78e,_0x4d0d48){return squel[_0xdb20('0xc')]()['field'](_0xdb20('0xd'))['from'](_0x4de78e)['join'](_0x2f8b4b,null,_0x2f8b4b+_0xdb20('0xe')+_0x4de78e+'.'+_0x221d77)['where'](_0x4de78e+'.'+_0x221d77+_0xdb20('0xf')+_0xaba518+'.'+_0x221d77)[_0xdb20('0x10')](_0x2f8b4b+'.dialCheckDuplicateType\x20IN\x20('+_0x4d0d48[_0xdb20('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x532d41,_0x72de00){promisesAdditionalPhones=[];return db[_0xdb20('0x12')][_0xdb20('0x13')]({'raw':!![],'attributes':['id',_0xdb20('0x14')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xdb20('0x15')](function(_0x5cded6){if(_0x5cded6!==null){var _0x48cf11=[];for(var _0x2c093b=0x0;_0x2c093b<_0x5cded6[_0xdb20('0x16')];_0x2c093b++){var _0x4ef5bf=_0x5cded6[_0x2c093b];_0x48cf11[_0xdb20('0x17')](insertAdditionalPhones(_0x4ef5bf));}}Promise[_0xdb20('0x18')](_0x48cf11)[_0xdb20('0x15')](function(){_0x532d41({'val':0x1});});});});}function insertAdditionalPhones(_0x1e0d3f){return new Promise(function(_0x1971f2,_0x3e6884){var _0x20842c=_0x1e0d3f[_0xdb20('0x14')];var _0x4e75e3=_0x20842c[_0xdb20('0x19')](';');var _0x39f624=[];orderBy=0x0;for(var _0x5e8cfb=0x0;_0x5e8cfb<_0x4e75e3[_0xdb20('0x16')];_0x5e8cfb++){_0x39f624[_0xdb20('0x17')](splitAdditionalPhone(_0x1e0d3f['id'],_0x4e75e3[_0x5e8cfb]));}Promise[_0xdb20('0x18')](_0x39f624)[_0xdb20('0x15')](function(){_0x1971f2({'val':_0x4e75e3[_0xdb20('0x16')]});});});}function splitAdditionalPhone(_0x40d5a5,_0xb8289f){return new Promise(function(_0x54071a,_0x2ee0be){var _0x1d4030=_0xb8289f[_0xdb20('0x19')](':');var _0x372400=_0x1d4030[0x0];var _0x384eff=_0x1d4030[0x1];if(!_[_0xdb20('0x1a')](_0x384eff)){var _0x44dde0=_0x384eff['split']('|');var _0x1ed6a7=[];for(var _0x561e46=0x0;_0x561e46<_0x44dde0[_0xdb20('0x16')];_0x561e46++){if(_0x44dde0[_0x561e46]!==''){var _0x59fefc=_['filter'](promisesAdditionalPhones,{'contactId':_0x40d5a5,'phone':_0x44dde0[_0x561e46]});if(_0x59fefc[_0xdb20('0x16')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x40d5a5,'contactTypeId':_0x372400,'phone':_0x44dde0[_0x561e46],'orderBy':orderBy});}}}_0x54071a({'ok':0x1});}else _0x54071a({'res':0x0});});}function createAdditionalPhone(_0xa4f1a4,_0x1ca17d,_0x450174,_0x192fff){var _0x4ab4a8='';var _0x26976a='';var _0x43b91e=_0x450174[_0xdb20('0x19')]('§');_0x4ab4a8=_0x43b91e[0x0];if(_0x43b91e[_0xdb20('0x16')]==0x2)_0x26976a=_0x43b91e[0x1];return new Promise(function(_0x4a3cb1,_0x369380){return db['CmContactHasItem'][_0xdb20('0x1b')]({'where':{'CmContactId':_0xa4f1a4,'item':_0x4ab4a8}})[_0xdb20('0x15')](function(_0x135b11){if(_0x135b11){return db[_0xdb20('0x1c')][_0xdb20('0x1d')]({'ItemTypeId':_0x1ca17d,'description':_0x26976a,'OrderBy':_0x192fff},{'where':{'CmContactId':_0xa4f1a4,'item':_0x4ab4a8}})[_0xdb20('0x15')](function(_0xda8501){_0x4a3cb1({'res':_0xdb20('0x1e')});});}else{return db[_0xdb20('0x1c')][_0xdb20('0x1f')]({'CmContactId':_0xa4f1a4,'item':_0x4ab4a8,'description':_0x26976a,'ItemTypeId':_0x1ca17d,'OrderBy':_0x192fff,'ItemClass':_0xdb20('0x20')})[_0xdb20('0x15')](function(_0x1e0ca4){_0x4a3cb1({'res':_0xdb20('0x21')});});}});});}function insertCmHopper(_0x27f752,_0x2e2e16,_0x349a79,_0x59e885,_0x5753e6){var _0x17db7=[_0xdb20('0x22'),_0xdb20('0x23'),_0xdb20('0x24'),_0xdb20('0x25'),_0x2e2e16+'.'+_0x59e885,'cm_contacts.createdAt',_0xdb20('0x26'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x5753e6+'\x22'];return squel[_0xdb20('0x27')]()[_0xdb20('0x28')](_0xdb20('0x29'))[_0xdb20('0x2a')](['phone',_0xdb20('0x2b'),_0xdb20('0x2c'),_0xdb20('0x2d'),_0x59e885,_0xdb20('0x2e'),'updatedAt',_0xdb20('0x2f'),_0xdb20('0x30'),'recallme'],squel[_0xdb20('0xc')]()[_0xdb20('0x31')](_0x17db7)[_0xdb20('0x32')](_0x2e2e16)[_0xdb20('0x11')](_0xdb20('0x33'),null,_0xdb20('0x34')+_0x2e2e16+_0xdb20('0x35'))[_0xdb20('0x11')](_0x349a79,null,_0x349a79+_0xdb20('0xe')+_0x2e2e16+'.'+_0x59e885)['where'](_0x2e2e16+'.CmListId\x20=\x20?',_0x27f752)[_0xdb20('0x10')](_0xdb20('0x36'),NOW)[_0xdb20('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2e2e16,_0x349a79,_0x59e885,_0xdb20('0x29'),[_0xdb20('0x37'),_0xdb20('0x38')]))[_0xdb20('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2e2e16,_0x349a79,_0x59e885,_0xdb20('0x29'),[_0xdb20('0x37')])))[_0xdb20('0x39')]();}function insertCmHopperBlack(_0x2eb99a,_0x5ad395,_0x12384f,_0x39afed){var _0x4fa403=[_0xdb20('0x22'),'cm_contacts.id',_0xdb20('0x25'),_0x5ad395+'.'+_0x39afed,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0xdb20('0x27')]()[_0xdb20('0x28')](_0xdb20('0x3a'))[_0xdb20('0x2a')]([_0xdb20('0xd'),_0xdb20('0x2c'),_0xdb20('0x2d'),_0x39afed,_0xdb20('0x2e'),_0xdb20('0x3b')],squel[_0xdb20('0xc')]()[_0xdb20('0x31')](_0x4fa403)['from'](_0x5ad395)[_0xdb20('0x11')](_0xdb20('0x33'),null,_0xdb20('0x34')+_0x5ad395+_0xdb20('0x35'))[_0xdb20('0x11')](_0x12384f,null,_0x12384f+_0xdb20('0xe')+_0x5ad395+'.'+_0x39afed)[_0xdb20('0x10')](_0x5ad395+_0xdb20('0x3c'),_0x2eb99a)[_0xdb20('0x10')](_0xdb20('0x36'),NOW)[_0xdb20('0x10')](_0xdb20('0x3d'),squel[_0xdb20('0xc')]()[_0xdb20('0x3e')]('phone')[_0xdb20('0x32')](_0xdb20('0x3a'))['where'](_0xdb20('0x3f'),_0x2eb99a)[_0xdb20('0x10')](_0x39afed+_0xdb20('0xf')+_0x5ad395+'.'+_0x39afed)))[_0xdb20('0x39')]();}function insertTzCmHopper(_0xee43e7,_0x120ea3,_0x9aa832,_0x252306,_0x34a538,_0x16b5bf){var _0x4045cb=[_0xdb20('0x22'),_0xdb20('0x40')+_0x16b5bf+_0xdb20('0x41'),_0xdb20('0x24'),_0xdb20('0x25'),_0x120ea3+'.'+_0x252306,_0xdb20('0x42'),_0xdb20('0x26'),'cm_contacts.priority',_0xdb20('0x43'),'\x22'+_0x34a538+'\x22'];var _0x524894=squel[_0xdb20('0x27')]()[_0xdb20('0x28')](_0xdb20('0x29'))['fromQuery']([_0xdb20('0xd'),_0xdb20('0x2b'),_0xdb20('0x2c'),_0xdb20('0x2d'),_0x252306,_0xdb20('0x2e'),_0xdb20('0x3b'),_0xdb20('0x2f'),_0xdb20('0x30'),'recallme'],squel[_0xdb20('0xc')]()[_0xdb20('0x31')](_0x4045cb)[_0xdb20('0x32')](_0x120ea3)[_0xdb20('0x11')](_0xdb20('0x33'),null,_0xdb20('0x34')+_0x120ea3+_0xdb20('0x35'))[_0xdb20('0x11')](_0x9aa832,null,_0x9aa832+_0xdb20('0xe')+_0x120ea3+'.'+_0x252306)[_0xdb20('0x11')](_0x16b5bf,null,_0x16b5bf+_0xdb20('0xe')+_0x120ea3+'.'+_0x252306)[_0xdb20('0x10')](_0x120ea3+_0xdb20('0x3c'),_0xee43e7)[_0xdb20('0x10')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xdb20('0x10')](_0xdb20('0x3d'),selectNotIn(_0x120ea3,_0x9aa832,_0x252306,'cm_hopper',[_0xdb20('0x37'),_0xdb20('0x38')]))[_0xdb20('0x10')](_0xdb20('0x3d'),selectNotIn(_0x120ea3,_0x9aa832,_0x252306,_0xdb20('0x29'),['\x22always\x22'])))[_0xdb20('0x39')]();return _0x524894;}function insertTzCmHopperBlack(_0x681309,_0x48c583,_0x1a6803,_0x33b748){var _0x19fcf6=['cm_contacts.phone',_0xdb20('0x24'),_0xdb20('0x25'),_0x48c583+'.'+_0x33b748,_0xdb20('0x42'),_0xdb20('0x26')];return squel['insert']()[_0xdb20('0x28')](_0xdb20('0x3a'))[_0xdb20('0x2a')]([_0xdb20('0xd'),_0xdb20('0x2c'),_0xdb20('0x2d'),_0x33b748,_0xdb20('0x2e'),_0xdb20('0x3b')],squel[_0xdb20('0xc')]()['fields'](_0x19fcf6)['from'](_0x48c583)['join'](_0xdb20('0x33'),null,_0xdb20('0x34')+_0x48c583+_0xdb20('0x35'))[_0xdb20('0x11')](_0x1a6803,null,_0x1a6803+'.id\x20=\x20'+_0x48c583+'.'+_0x33b748)[_0xdb20('0x10')](_0x48c583+_0xdb20('0x3c'),_0x681309)[_0xdb20('0x10')](_0xdb20('0x36'),NOW)[_0xdb20('0x10')](_0xdb20('0x3d'),squel[_0xdb20('0xc')]()['field'](_0xdb20('0xd'))['from'](_0xdb20('0x3a'))[_0xdb20('0x10')]('ListId\x20=\x20?',_0x681309)['where'](_0x33b748+_0xdb20('0xf')+_0x48c583+'.'+_0x33b748)))[_0xdb20('0x39')]();}function insertCmHopperAdditionalPhones(_0x421be9){var _0x5c9a04=[_0xdb20('0x44'),'cm_contact_has_items.item',_0xdb20('0x45'),'cm_contact_has_items.createdAt',_0xdb20('0x46')];return squel['insert']()[_0xdb20('0x28')]('cm_hopper_additional_phones')[_0xdb20('0x2a')]([_0xdb20('0x47'),_0xdb20('0xd'),_0xdb20('0x48'),_0xdb20('0x2e'),_0xdb20('0x3b')],squel[_0xdb20('0xc')]()[_0xdb20('0x31')](_0x5c9a04)[_0xdb20('0x32')](_0xdb20('0x29'))[_0xdb20('0x11')](_0xdb20('0x33'),null,_0xdb20('0x49'))[_0xdb20('0x11')](_0xdb20('0x4a'),null,_0xdb20('0x4b'))['where'](_0xdb20('0x4c'),_0x421be9)[_0xdb20('0x10')](_0xdb20('0x36'),NOW))[_0xdb20('0x39')]();}function insertCmContact(_0x5cbadd,_0x9e9596,_0xc966af,_0x182e37){var _0x5103df=_[_0xdb20('0x4d')](_[_0xdb20('0x4e')](_0x182e37),[_0xdb20('0x2d'),_0xdb20('0x4f'),_0xdb20('0x2e'),'updatedAt',_0xdb20('0x50')]);return squel['insert']()[_0xdb20('0x28')](_0xdb20('0x33'))[_0xdb20('0x2a')](_0x5103df,squel[_0xdb20('0xc')]()[_0xdb20('0x31')](_0x5103df)['from'](_0x9e9596)[_0xdb20('0x10')]('('+_0xc966af[_0xdb20('0x11')](',')+_0xdb20('0x51'),squel[_0xdb20('0xc')]()[_0xdb20('0x31')](_0xc966af)[_0xdb20('0x32')](_0xdb20('0x33'))[_0xdb20('0x10')](_0xdb20('0x3f'),_0x5cbadd)[_0xdb20('0x10')](_0xdb20('0x52')))[_0xdb20('0x10')](_0xdb20('0x53'),squel['select']()[_0xdb20('0x3e')](_0xdb20('0x54'),_0xdb20('0x55'))['from'](_0x9e9596)[_0xdb20('0x56')](_0xc966af[_0xdb20('0x11')](','))))['toString']();}function handleStop(){logger[_0xdb20('0x57')](_0xdb20('0x58'));stopped=!![];}function handleUncaughtException(_0x357454){logger[_0xdb20('0x59')](_0x357454['message']);process[_0xdb20('0x5a')](0x1);}function handleError(_0x30c52a,_0x531b03){stats[_0xdb20('0x5b')]['push']({'name':_0x531b03['code'],'message':_0x531b03[_0xdb20('0x5c')],'row':_0x30c52a});}function handleQuery(_0xc97e60){logger[_0xdb20('0x57')](_0xc97e60);return db[_0xdb20('0x5d')][_0xdb20('0x5e')](_0xc97e60)[_0xdb20('0x5f')](function(_0x3c9e0d){results['push'](_0x3c9e0d);})[_0xdb20('0x60')](function(_0xcf7c23){logger[_0xdb20('0x59')](_0xcf7c23[_0xdb20('0x5c')]);});}function updateTzCampaigns(_0x5842d9){return new Promise(function(_0x35f42b,_0x584db7){var _0x22e30c=squel[_0xdb20('0xc')]()[_0xdb20('0x31')]([_0xdb20('0x61'),_0xdb20('0x62')])[_0xdb20('0x32')](_0xdb20('0x63'))[_0xdb20('0x11')](_0xdb20('0x64'),null,_0xdb20('0x65'))[_0xdb20('0x10')](_0xdb20('0x66')+_0x5842d9);db['sequelize'][_0xdb20('0x5e')](_0x22e30c[_0xdb20('0x39')]())[_0xdb20('0x5f')](function(_0x48d0c7){var _0x27f1f5=[];for(var _0x3475db=0x0;_0x3475db<_0x48d0c7[_0xdb20('0x16')];_0x3475db++){_0x27f1f5['push'](getTimezoneData(_0x48d0c7[_0x3475db],tmp_campaigns));}BPromise[_0xdb20('0x18')](_0x27f1f5)[_0xdb20('0x15')](function(){_0x35f42b({'val':0x1});});})[_0xdb20('0x60')](function(_0x3505f0){logger[_0xdb20('0x59')](_0x3505f0['message']);_0x35f42b({'val':0x0});});});}function updateTzVoiceQueues(_0x3438c6){return new Promise(function(_0x1ab753,_0x50a303){var _0xf1462=squel[_0xdb20('0xc')]()[_0xdb20('0x31')]([_0xdb20('0x67'),'voice_queues.dialTimezone'])['from'](_0xdb20('0x68'))[_0xdb20('0x11')](_0xdb20('0x69'),null,_0xdb20('0x6a'))['where'](_0xdb20('0x6b')+_0x3438c6);db[_0xdb20('0x5d')][_0xdb20('0x5e')](_0xf1462[_0xdb20('0x39')]())[_0xdb20('0x5f')](function(_0x4153e1){var _0xb5492f=[];for(var _0x37f06f=0x0;_0x37f06f<_0x4153e1[_0xdb20('0x16')];_0x37f06f++){_0xb5492f['push'](getTimezoneData(_0x4153e1[_0x37f06f],tmp_voice_queues));}BPromise[_0xdb20('0x18')](_0xb5492f)[_0xdb20('0x15')](function(){_0x1ab753({'val':0x1});});})[_0xdb20('0x60')](function(_0x50813d){logger['error'](_0x50813d[_0xdb20('0x5c')]);_0x1ab753({'val':0x0});});});}function getTimezoneData(_0x795971,_0x45cd25){return new Promise(function(_0x107213,_0x561d4c){var _0x248014=shared[_0xdb20('0x6c')];var _0x3aea6f=_0x248014[_0x795971[_0xdb20('0x6d')]];if(_['isNil'](_0x3aea6f)){_0x107213({'ret':0x1});}else{var _0x32b354=_0x3aea6f[_0xdb20('0x6e')];var _0x37f344=squel[_0xdb20('0x27')]()[_0xdb20('0x28')](_0x45cd25)[_0xdb20('0x6f')]('id',_0x795971['id'])[_0xdb20('0x6f')](_0xdb20('0x70'),_0x32b354)['set'](_0xdb20('0x6d'),_0x795971['dialTimezone'])['toString']();return db[_0xdb20('0x5d')][_0xdb20('0x5e')](_0x37f344)[_0xdb20('0x5f')](function(_0x405670){_0x107213({'ret':0x1});})[_0xdb20('0x60')](function(_0x531fcd){logger[_0xdb20('0x59')](_0x531fcd[_0xdb20('0x5c')]);_0x561d4c({'ret':0x1});});}});}function handleTZQuery(_0x3a783a){logger[_0xdb20('0x57')](_0x3a783a);return db[_0xdb20('0x5d')][_0xdb20('0x5e')](_0x3a783a)['spread'](function(_0x531d51){})['catch'](function(_0x111a1a){logger[_0xdb20('0x59')](_0x111a1a[_0xdb20('0x5c')]);});}function main(_0x57ecb2,_0x585d36,_0x2be545,_0x19b9e4){logger[_0xdb20('0x57')](_0xdb20('0x71'),_0x57ecb2,JSON[_0xdb20('0x72')](_0x585d36));process[_0xdb20('0x73')](_0xdb20('0x74'));var _0x5aa455=_0x585d36[_0xdb20('0x75')];var _0x4e3e56=_[_0xdb20('0x76')](_0x5aa455);var _0x44b1bb=_0x585d36[_0xdb20('0x77')];var _0x568a24=path[_0xdb20('0x11')](config[_0xdb20('0x78')],_0xdb20('0x79'),_0x44b1bb+_0xdb20('0x7a'));hasTZ=_[_0xdb20('0x4e')](_0x5aa455)[_0xdb20('0x7b')](_0xdb20('0x6d'));var _0x3ae11a=_['keys'](_0x5aa455)[_0xdb20('0x11')]();logger[_0xdb20('0x57')]('header',_0x3ae11a);db[_0xdb20('0x7c')][_0xdb20('0x13')]({'raw':!![],'attributes':['id','name']})['then'](function(_0x8c602d){for(var _0x11405e=0x0;_0x11405e<_0x8c602d[_0xdb20('0x16')];_0x11405e++){if(_0x8c602d[_0x11405e]['name']in _0x5aa455){contactItemTypes[_0xdb20('0x17')](_0x8c602d[_0x11405e]);delete _0x4e3e56[_0x8c602d[_0x11405e][_0xdb20('0x7d')]];hasAdditionalPhones=!![];}for(var _0x2f3fd2 in _0x5aa455){if(_0x8c602d[_0x11405e][_0xdb20('0x7d')]+_0xdb20('0x7e')===_0x2f3fd2){phoneDescriptions[_0xdb20('0x17')]({'itemTypeId':_0x8c602d[_0x11405e]['id'],'description':_0x2f3fd2});delete _0x4e3e56[_0x2f3fd2];}}}if(hasAdditionalPhones)_0x4e3e56[_0xdb20('0x14')]='';var _0x189875=_['keys'](_0x4e3e56)[_0xdb20('0x11')]();logger[_0xdb20('0x57')](_0xdb20('0x7f'),_0x189875);fs[_0xdb20('0x80')](_0x568a24,_0x189875+'\x0a');Papa[_0xdb20('0x81')](fs[_0xdb20('0x82')](_0x57ecb2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x50db3e,_0x2f52fb){try{for(var _0x4b444d=0x0,_0x2bebf7=[];_0x4b444d<_0x50db3e[_0xdb20('0x83')][_0xdb20('0x16')];_0x4b444d++){stats[_0xdb20('0x84')]+=0x1;if(_0x50db3e['errors'][_0x4b444d]){handleError(_0x50db3e[_0xdb20('0x83')][_0x4b444d],_0x50db3e[_0xdb20('0x5b')][_0x4b444d]);}else{var _0x30837c=[];var _0x9d8bad=[];var _0x2446df={};for(var _0x2776fc in _0x5aa455){let _0x48d19a=contactItemTypes[_0xdb20('0x85')](_0x36c6cb=>_0x36c6cb[_0xdb20('0x7d')]===_0x2776fc);let _0x11f611=contactItemTypes[_0xdb20('0x85')](_0x5add6d=>_0x5add6d[_0xdb20('0x7d')]+_0xdb20('0x7e')===_0x2776fc);if(_['isNil'](_0x48d19a)&&_[_0xdb20('0x1a')](_0x11f611)){if(_0x5aa455[_0xdb20('0x86')](_0x2776fc)){if(_0x50db3e[_0xdb20('0x83')][_0x4b444d][_0x5aa455[_0x2776fc]]){var _0x1e4d97=_['trim'](_0x50db3e['data'][_0x4b444d][_0x5aa455[_0x2776fc]][_0xdb20('0x87')](/"/g,'\x27'));switch(_0x2776fc){case _0xdb20('0x2b'):var _0x2f22e0=moment(_0x1e4d97,_0xdb20('0xb'),!![]);if(_0x2f22e0[_0xdb20('0x88')]()){_0x2bebf7['push']('\x22'+_0x1e4d97+'\x22');}else{_0x30837c['push'](_0xdb20('0x89'));}break;case _0xdb20('0x2f'):var _0x9d5ea4=parseInt(_0x1e4d97);_0x1e4d97=_[_0xdb20('0x8a')](_0x9d5ea4)||_0x9d5ea4<0x0||_0x9d5ea4>0x4?_0x19b9e4?0x3:0x2:_0x9d5ea4;_0x2bebf7[_0xdb20('0x17')]('\x22'+_0x1e4d97+'\x22');break;case _0xdb20('0x30'):var _0x2815b9=parseInt(_0x1e4d97);if(_[_0xdb20('0x8b')](_0x2815b9)&&_[_0xdb20('0x7b')](_0x2be545,_0x2815b9)){_0x2bebf7[_0xdb20('0x17')]('\x22'+_0x2815b9+'\x22');}else{_0x30837c[_0xdb20('0x17')]('agent\x20not\x20exists');}break;case _0xdb20('0x8c'):if(isEmail(_0x1e4d97)){_0x2bebf7[_0xdb20('0x17')]('\x22'+_0x1e4d97+'\x22');}else{_0x30837c[_0xdb20('0x17')]('email\x20wrong\x20format');}break;case _0xdb20('0x8d'):var _0x5a3d41=moment(_0x1e4d97,_0xdb20('0x8e'),!![]);if(_0x5a3d41[_0xdb20('0x88')]()){_0x2bebf7[_0xdb20('0x17')]('\x22'+_0x1e4d97+'\x22');}else{_0x30837c['push'](_0xdb20('0x8f'));}break;case'dialTimezone':var _0x5af50b=shared[_0xdb20('0x6c')];var _0x90b322=_0x5af50b[_0x1e4d97];if(!_[_0xdb20('0x1a')](_0x90b322)){var _0x294170=_0x90b322['utcOffset'];_0x2bebf7['push']('\x22'+_0x1e4d97+'\x22');_0x2bebf7[_0xdb20('0x17')]('\x22'+_0x294170+'\x22');}break;default:_0x2bebf7[_0xdb20('0x17')]('\x22'+_0x1e4d97+'\x22');}}else{switch(_0x2776fc){case _0xdb20('0x90'):case _0xdb20('0xd'):_0x30837c['push'](_0x2776fc+'\x20not\x20specified');break;default:_0x2bebf7[_0xdb20('0x17')]('\x22\x22');}}}}else{var _0x35efc2='';if(!_['isNil'](_0x48d19a)){if(!_0x2446df[_0xdb20('0x86')](_0x48d19a['id'])){if(!_[_0xdb20('0x1a')](_0x50db3e[_0xdb20('0x83')][_0x4b444d][_0x5aa455[_0x2776fc]])){var _0x1e4d97=_[_0xdb20('0x91')](_0x50db3e[_0xdb20('0x83')][_0x4b444d][_0x5aa455[_0x2776fc]][_0xdb20('0x87')](/"/g,'\x27'));var _0x13efd2=phoneDescriptions[_0xdb20('0x85')](_0x269317=>_0x269317[_0xdb20('0x92')]===_0x48d19a['id']);if(!_['isNil'](_0x13efd2)){var _0x22ffde=_['trim'](_0x50db3e[_0xdb20('0x83')][_0x4b444d][_0x5aa455[_0x13efd2['description']]][_0xdb20('0x87')](/"/g,'\x27'));if(!_[_0xdb20('0x1a')](_0x22ffde))_0x1e4d97=_0x1e4d97+'§'+_0x22ffde;}if(_0x35efc2=='')_0x35efc2=_0x1e4d97;else _0x35efc2+='|'+_0x1e4d97;}_0x9d8bad[_0xdb20('0x17')](_0x48d19a['id']+':'+_0x35efc2);_0x2446df[_0x48d19a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2bebf7[_0xdb20('0x17')]('\x22'+_0x9d8bad['join'](';')+'\x22');}if(_0x30837c[_0xdb20('0x16')]){handleError(_0x50db3e[_0xdb20('0x83')][_0x4b444d],{'code':_0xdb20('0x93'),'message':_0x30837c[_0xdb20('0x11')]()});}else{fs[_0xdb20('0x94')](_0x568a24,_0x2bebf7[_0xdb20('0x11')]()+'\x0a');}_0x2bebf7=[];}if(!(stats[_0xdb20('0x84')]%0xc8)){socket[_0xdb20('0x95')](_0xdb20('0x96')+_0x44b1bb,stats);stats[_0xdb20('0x5b')]=[];}}if(stopped){logger[_0xdb20('0x57')]('Abort\x20parser');_0x2f52fb[_0xdb20('0x97')]();}}catch(_0x3d5899){handleError(_0x50db3e[_0xdb20('0x83')][_0x4b444d],{'code':'SystemError','message':_0x3d5899['message']});logger[_0xdb20('0x59')](_0xdb20('0x98'),_0x3d5899[_0xdb20('0x5c')]);}},'complete':function(){try{var _0x42f752=[];var _0x3f6e6d=[];var _0xba117b=_0xdb20('0x33');if(_0x585d36[_0xdb20('0x99')]&&_0x585d36[_0xdb20('0x99')]['length']){_0xba117b='cm_contacts_'+_0x44b1bb;_0x42f752[_0xdb20('0x17')](_0xdb20('0x9a')+_0xba117b+_0xdb20('0x9b'));}tmp_campaigns=_0xdb20('0x9c')+_0x44b1bb;tmp_voice_queues=_0xdb20('0x9d')+_0x44b1bb;_0x3f6e6d[_0xdb20('0x17')]('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x3f6e6d['push'](_0xdb20('0x9a')+tmp_voice_queues+_0xdb20('0x9e'));BPromise[_0xdb20('0x9f')](_0x3f6e6d,handleTZQuery)['then'](function(_0x276d9e){updateTzCampaigns(_0x585d36[_0xdb20('0x2d')])[_0xdb20('0x15')](function(_0x1e2365){updateTzVoiceQueues(_0x585d36[_0xdb20('0x2d')])[_0xdb20('0x15')](function(_0x526fa9){if(hasTZ)_0x189875=_0x189875[_0xdb20('0x87')](_0xdb20('0x6d'),_0xdb20('0xa0'));var _0xc7d4=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x568a24,_0xba117b,_0x189875,_0x585d36[_0xdb20('0x2d')],_0x585d36['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x5aa455[_0xdb20('0x2b')])){_0xc7d4+=_0xdb20('0xa1');}_0x42f752['push'](_0xc7d4);if(_0x585d36[_0xdb20('0x99')]&&_0x585d36[_0xdb20('0x99')][_0xdb20('0x16')]){_0x42f752[_0xdb20('0x17')](insertCmContact(_0x585d36[_0xdb20('0x2d')],_0xba117b,_0x585d36[_0xdb20('0x99')],_0x5aa455));_0x42f752[_0xdb20('0x17')](_0xdb20('0xa2')+_0xba117b+';');}BPromise[_0xdb20('0x9f')](_0x42f752,handleQuery)['then'](function(_0xd6538b){BPromise[_0xdb20('0x18')]([handleAdditionalPhones()])[_0xdb20('0x15')](function(){_0x42f752=[];for(var _0x5b1d44=0x0;_0x5b1d44\x20\x20'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x9972,0xaa));var _0x2997=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9972[_0x57b54c];return _0x59cc19;};'use strict';var fs=require('fs');var path=require(_0x2997('0x0'));var _=require(_0x2997('0x1'));var Papa=require(_0x2997('0x2'));var util=require(_0x2997('0x3'));var BPromise=require('bluebird');var moment=require(_0x2997('0x4'));var squel=require('squel');var Redis=require(_0x2997('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x2997('0x6'));var logger=require(_0x2997('0x7'))('import');config[_0x2997('0x8')]=_[_0x2997('0x9')](config[_0x2997('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x2997('0xa'))(new Redis(config[_0x2997('0x8')]));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()[_0x2997('0xb')](_0x2997('0xc'));var tempTableName=_0x2997('0xd')+moment()[_0x2997('0xb')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2070e8){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))*$/[_0x2997('0xe')](_0x2070e8);}function selectNotIn(_0x4955cc,_0x153cc8,_0x5209bd,_0x37b760,_0x550a7f){return squel[_0x2997('0xf')]()[_0x2997('0x10')](_0x2997('0x11'))['from'](_0x37b760)[_0x2997('0x12')](_0x153cc8,null,_0x153cc8+_0x2997('0x13')+_0x37b760+'.'+_0x5209bd)['where'](_0x37b760+'.'+_0x5209bd+_0x2997('0x14')+_0x4955cc+'.'+_0x5209bd)[_0x2997('0x15')](_0x153cc8+_0x2997('0x16')+_0x550a7f[_0x2997('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2c07d8,_0x3f7f74){promisesAdditionalPhones=[];promisesContact=[];return db[_0x2997('0x17')]['query'](_0x2997('0x18')+tempTableName)[_0x2997('0x19')](function(_0xd3251c){if(_0xd3251c!==null){var _0x48bee9=[];for(var _0x3f147b=0x0;_0x3f147b<_0xd3251c[_0x2997('0x1a')];_0x3f147b++){var _0x400fbf=_0xd3251c[_0x3f147b];if(!_[_0x2997('0x1b')](_0x400fbf[_0x2997('0x11')])){if(!_['isNil'](_0x400fbf[_0x2997('0x1c')]))_0x48bee9['push'](insertAdditionalPhones(_0x400fbf));promisesContact[_0x2997('0x1d')]({'contact':_0x400fbf});}}}Promise[_0x2997('0x1e')](_0x48bee9)['then'](function(){_0x2c07d8({'val':0x1});});})[_0x2997('0x1f')](function(_0x217a40){logger[_0x2997('0x20')](_0x217a40[_0x2997('0x21')]);});});}function insertAdditionalPhones(_0x50bdac){return new Promise(function(_0x1f89f2,_0x9efd0d){var _0xec80e6=_0x50bdac[_0x2997('0x1c')];if(_['isNil'](_0xec80e6))_0x9efd0d({'val':0x0});else{var _0x555b5c=_0xec80e6[_0x2997('0x22')](';');var _0x46e68e=[];orderBy=0x0;for(var _0x2453ba=0x0;_0x2453ba<_0x555b5c['length'];_0x2453ba++){_0x46e68e['push'](splitAdditionalPhone(_0x50bdac['id'],_0x555b5c[_0x2453ba]));}Promise[_0x2997('0x1e')](_0x46e68e)[_0x2997('0x23')](function(){_0x1f89f2({'val':_0x555b5c[_0x2997('0x1a')]});});}});}function splitAdditionalPhone(_0x40afdb,_0x8b69a4){return new Promise(function(_0x366791,_0x1e52c1){var _0x1856b7=_0x8b69a4[_0x2997('0x22')](':');var _0x5962d7=_0x1856b7[0x0];var _0x1e61be=_0x1856b7[0x1];if(_0x1e61be!==''){var _0x56eebd=_0x1e61be[_0x2997('0x22')]('|');var _0x4f4fef=[];for(var _0x3630d5=0x0;_0x3630d5<_0x56eebd[_0x2997('0x1a')];_0x3630d5++){if(_0x56eebd[_0x3630d5]!==''){var _0x228726=_[_0x2997('0x24')](promisesAdditionalPhones,{'contactId':_0x40afdb,'phone':_0x56eebd[_0x3630d5]});if(_0x228726[_0x2997('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x40afdb,'contactTypeId':_0x5962d7,'phone':_0x56eebd[_0x3630d5],'orderBy':orderBy});}}}_0x366791({'ok':0x1});}else _0x366791({'res':0x0});});}function createAdditionalPhone(_0x6639be,_0x5677b5,_0x24b27a,_0x1f088e){var _0x5d0bb5='';var _0x5d5d59='';var _0x1029a6=_0x24b27a[_0x2997('0x22')]('§');_0x5d0bb5=_0x1029a6[0x0];if(_0x1029a6[_0x2997('0x1a')]==0x2)_0x5d5d59=_0x1029a6[0x1];return new Promise(function(_0x46b286,_0x5bd487){return db[_0x2997('0x25')]['findOne']({'where':{'CmContactId':_0x6639be,'item':_0x5d0bb5}})[_0x2997('0x23')](function(_0x53caf3){if(_0x53caf3){return db['CmContactHasItem']['update']({'ItemTypeId':_0x5677b5,'description':_0x5d5d59,'OrderBy':_0x1f088e},{'where':{'CmContactId':_0x6639be,'item':_0x5d0bb5}})[_0x2997('0x23')](function(_0x51827e){_0x46b286({'res':_0x2997('0x26')});});}else{return db[_0x2997('0x25')]['create']({'CmContactId':_0x6639be,'item':_0x5d0bb5,'ItemTypeId':_0x5677b5,'description':_0x5d5d59,'OrderBy':_0x1f088e,'ItemClass':'PHONE'})[_0x2997('0x23')](function(_0x3360d7){_0x46b286({'res':_0x2997('0x27')});});}});});}function updateContact(_0x17beb0){return new Promise(function(_0x2e869c,_0x44e951){var _0x37ec69=_0x17beb0['id'];delete _0x17beb0['id'];return db[_0x2997('0x28')][_0x2997('0x29')](_0x17beb0,{'where':{'id':_0x37ec69}})[_0x2997('0x23')](function(_0x32225b){updatedRows+=0x1;return db['CmHopper']['update']({'phone':_0x17beb0['phone']},{'where':{'ContactId':_0x37ec69}})[_0x2997('0x23')](function(_0x1e26b0){_0x2e869c({'ret':'OK'});});});});}function insertCmHopper(_0x26db5d,_0x214cc4,_0x14d692,_0x389c2f,_0x1cac00){var _0x1c5a05=[_0x2997('0x2a'),_0x2997('0x2b'),'cm_contacts.id','cm_contacts.ListId',_0x214cc4+'.'+_0x389c2f,_0x2997('0x2c'),_0x2997('0x2d'),_0x2997('0x2e'),_0x2997('0x2f'),'\x22'+_0x1cac00+'\x22'];return squel['insert']()[_0x2997('0x30')](_0x2997('0x31'))['fromQuery']([_0x2997('0x11'),'scheduledat',_0x2997('0x32'),_0x2997('0x33'),_0x389c2f,_0x2997('0x34'),'updatedAt',_0x2997('0x35'),_0x2997('0x36'),_0x2997('0x37')],squel[_0x2997('0xf')]()[_0x2997('0x38')](_0x1c5a05)['from'](_0x214cc4)['join'](_0x2997('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x214cc4+_0x2997('0x3a'))[_0x2997('0x12')](_0x14d692,null,_0x14d692+_0x2997('0x13')+_0x214cc4+'.'+_0x389c2f)['where'](_0x214cc4+'.CmListId\x20=\x20?',_0x26db5d)['where'](_0x2997('0x3b'),NOW)[_0x2997('0x15')](_0x2997('0x3c'),selectNotIn(_0x214cc4,_0x14d692,_0x389c2f,_0x2997('0x31'),[_0x2997('0x3d'),_0x2997('0x3e')]))[_0x2997('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x214cc4,_0x14d692,_0x389c2f,_0x2997('0x31'),[_0x2997('0x3d')])))[_0x2997('0x3f')]();}function insertCmHopperBlack(_0x5defa8,_0xdb9c5a,_0x4232a8,_0x45d100){var _0x4015c2=[_0x2997('0x2a'),_0x2997('0x40'),_0x2997('0x41'),_0xdb9c5a+'.'+_0x45d100,_0x2997('0x2c'),_0x2997('0x2d')];return squel['insert']()[_0x2997('0x30')](_0x2997('0x42'))[_0x2997('0x43')]([_0x2997('0x11'),'ContactId','ListId',_0x45d100,_0x2997('0x34'),_0x2997('0x44')],squel[_0x2997('0xf')]()['fields'](_0x4015c2)[_0x2997('0x45')](_0xdb9c5a)[_0x2997('0x12')]('cm_contacts',null,_0x2997('0x46')+_0xdb9c5a+'.CmListId')['join'](_0x4232a8,null,_0x4232a8+_0x2997('0x13')+_0xdb9c5a+'.'+_0x45d100)[_0x2997('0x15')](_0xdb9c5a+'.CmListId\x20=\x20?',_0x5defa8)[_0x2997('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x2997('0x3c'),squel[_0x2997('0xf')]()[_0x2997('0x10')](_0x2997('0x11'))[_0x2997('0x45')](_0x2997('0x42'))[_0x2997('0x15')](_0x2997('0x47'),_0x5defa8)[_0x2997('0x15')](_0x45d100+'\x20=\x20?',_0xdb9c5a+'.'+_0x45d100)))['toString']();}function insertCmHopperAdditionalPhones(_0x5a4f42){var _0xa7eb19=[_0x2997('0x48'),_0x2997('0x49'),_0x2997('0x4a'),_0x2997('0x4b'),_0x2997('0x4c')];return squel['insert']()[_0x2997('0x30')](_0x2997('0x4d'))[_0x2997('0x43')](['CmHopperId',_0x2997('0x11'),_0x2997('0x4e'),'createdAt','updatedAt'],squel[_0x2997('0xf')]()[_0x2997('0x38')](_0xa7eb19)[_0x2997('0x45')](_0x2997('0x31'))[_0x2997('0x12')]('cm_contacts',null,_0x2997('0x4f'))[_0x2997('0x12')](_0x2997('0x50'),null,_0x2997('0x51'))[_0x2997('0x15')](_0x2997('0x52'),_0x5a4f42)[_0x2997('0x15')](_0x2997('0x3b'),NOW))[_0x2997('0x3f')]();}function insertCmContact(_0x3364b6,_0x4f7b50,_0x1e8b40,_0x4fe392){var _0x22b14c=_[_0x2997('0x53')](_[_0x2997('0x54')](_0x4fe392),['ListId',_0x2997('0x55'),_0x2997('0x34'),_0x2997('0x44')]);return squel[_0x2997('0x56')]()[_0x2997('0x30')](_0x2997('0x39'))['fromQuery'](_0x22b14c,squel[_0x2997('0xf')]()['fields'](_0x22b14c)[_0x2997('0x45')](_0x4f7b50)[_0x2997('0x15')]('('+_0x1e8b40['join'](',')+_0x2997('0x57'),squel['select']()['fields'](_0x1e8b40)[_0x2997('0x45')]('cm_contacts')[_0x2997('0x15')]('ListId\x20=\x20?',_0x3364b6))[_0x2997('0x15')](_0x2997('0x58'),squel[_0x2997('0xf')]()[_0x2997('0x10')](_0x2997('0x59'),'min_id')[_0x2997('0x45')](_0x4f7b50)[_0x2997('0x5a')](_0x1e8b40[_0x2997('0x12')](','))))[_0x2997('0x3f')]();}function handleStop(){logger[_0x2997('0x5b')](_0x2997('0x5c'));stopped=!![];}function handleUncaughtException(_0x26dad7){logger[_0x2997('0x20')](_0x26dad7['message']);process['exit'](0x1);}function handleError(_0x22f412,_0x1c7952){stats[_0x2997('0x5d')][_0x2997('0x1d')]({'name':_0x1c7952[_0x2997('0x5e')],'message':_0x1c7952[_0x2997('0x21')],'row':_0x22f412});}function handleQuery(_0x30b52d){logger[_0x2997('0x5b')](_0x30b52d);return db[_0x2997('0x17')][_0x2997('0x5f')](_0x30b52d)[_0x2997('0x19')](function(_0x2376c0){results[_0x2997('0x1d')](_0x2376c0);})[_0x2997('0x1f')](function(_0x3c4c09){logger[_0x2997('0x20')](_0x3c4c09[_0x2997('0x21')]);});}function main(_0x4f403e,_0x4bcafa,_0x227526,_0x233b90){logger[_0x2997('0x5b')]('main',_0x4f403e,JSON['stringify'](_0x4bcafa));process[_0x2997('0x60')](_0x2997('0x61'));var _0xede2f0=_0x4bcafa[_0x2997('0x62')];var _0x400d28=_[_0x2997('0x63')](_0xede2f0);var _0x2e152f=_0x4bcafa[_0x2997('0x64')];var _0xf83629=path[_0x2997('0x12')](config[_0x2997('0x65')],_0x2997('0x66'),_0x2e152f+_0x2997('0x67'));logger[_0x2997('0x5b')](_0x2997('0x68'),_0x4bcafa);db[_0x2997('0x69')][_0x2997('0x6a')]({'raw':!![],'attributes':['id','name']})[_0x2997('0x23')](function(_0x1fed50){for(var _0xcbe375=0x0;_0xcbe375<_0x1fed50[_0x2997('0x1a')];_0xcbe375++){if(_0x1fed50[_0xcbe375][_0x2997('0x6b')]in _0xede2f0){contactItemTypes[_0x2997('0x1d')](_0x1fed50[_0xcbe375]);delete _0x400d28[_0x1fed50[_0xcbe375][_0x2997('0x6b')]];hasAdditionalPhones=!![];}for(var _0x1a6c17 in _0xede2f0){if(_0x1fed50[_0xcbe375][_0x2997('0x6b')]+'_description'===_0x1a6c17){phoneDescriptions[_0x2997('0x1d')]({'itemTypeId':_0x1fed50[_0xcbe375]['id'],'description':_0x1a6c17});delete _0x400d28[_0x1a6c17];}}}if(hasAdditionalPhones)_0x400d28[_0x2997('0x1c')]='';var _0x4c5a93=_[_0x2997('0x54')](_0x400d28)[_0x2997('0x12')]();logger['info'](_0x2997('0x6c'),_0x4c5a93);fs[_0x2997('0x6d')](_0xf83629,_0x4c5a93+'\x0a');Papa['parse'](fs[_0x2997('0x6e')](_0x4f403e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x39eae2,_0x29adef){try{for(var _0x4d6d2d=0x0,_0x25c5c9=[];_0x4d6d2d<_0x39eae2[_0x2997('0x6f')]['length'];_0x4d6d2d++){stats['rows']+=0x1;if(_0x39eae2[_0x2997('0x5d')][_0x4d6d2d]){handleError(_0x39eae2[_0x2997('0x6f')][_0x4d6d2d],_0x39eae2['errors'][_0x4d6d2d]);}else{var _0xb8ddd4=[];var _0x1e4923=[];var _0x1e4a0f={};for(var _0xe4e70a in _0xede2f0){let _0x197b22=contactItemTypes['find'](_0x49b7dd=>_0x49b7dd[_0x2997('0x6b')]===_0xe4e70a);let _0x3a0ecd=contactItemTypes[_0x2997('0x70')](_0x448821=>_0x448821[_0x2997('0x6b')]+_0x2997('0x71')===_0xe4e70a);if(_['isNil'](_0x197b22)&&_[_0x2997('0x1b')](_0x3a0ecd)){if(_0xede2f0['hasOwnProperty'](_0xe4e70a)){if(_0x39eae2[_0x2997('0x6f')][_0x4d6d2d][_0xede2f0[_0xe4e70a]]){var _0x320ca6=_['trim'](_0x39eae2['data'][_0x4d6d2d][_0xede2f0[_0xe4e70a]]['replace'](/"/g,'\x27'));switch(_0xe4e70a){case _0x2997('0x72'):var _0x473c3a=moment(_0x320ca6,_0x2997('0xc'),!![]);if(_0x473c3a[_0x2997('0x73')]()){_0x25c5c9['push']('\x22'+_0x320ca6+'\x22');}else{_0xb8ddd4[_0x2997('0x1d')](_0x2997('0x74'));}break;case _0x2997('0x35'):var _0x521dcc=parseInt(_0x320ca6);_0x320ca6=_['isNaN'](_0x521dcc)||_0x521dcc<0x0||_0x521dcc>0x4?_0x233b90?0x3:0x2:_0x521dcc;_0x25c5c9[_0x2997('0x1d')]('\x22'+_0x320ca6+'\x22');break;case'UserId':var _0x17f841=parseInt(_0x320ca6);if(_['isNumber'](_0x17f841)&&_[_0x2997('0x75')](_0x227526,_0x17f841)){_0x25c5c9[_0x2997('0x1d')]('\x22'+_0x17f841+'\x22');}else{_0xb8ddd4[_0x2997('0x1d')](_0x2997('0x76'));}break;case _0x2997('0x77'):if(isEmail(_0x320ca6)){_0x25c5c9[_0x2997('0x1d')]('\x22'+_0x320ca6+'\x22');}else{_0xb8ddd4[_0x2997('0x1d')](_0x2997('0x78'));}break;case _0x2997('0x79'):var _0x4d5d7d=moment(_0x320ca6,_0x2997('0x7a'),!![]);if(_0x4d5d7d[_0x2997('0x73')]()){_0x25c5c9[_0x2997('0x1d')]('\x22'+_0x320ca6+'\x22');}else{_0xb8ddd4[_0x2997('0x1d')](_0x2997('0x7b'));}break;default:_0x25c5c9[_0x2997('0x1d')]('\x22'+_0x320ca6+'\x22');}}else{switch(_0xe4e70a){case _0x2997('0x7c'):case _0x2997('0x11'):_0xb8ddd4[_0x2997('0x1d')](_0xe4e70a+_0x2997('0x7d'));break;default:_0x25c5c9[_0x2997('0x1d')]('\x22\x22');}}}}else{var _0x32eba1='';if(!_[_0x2997('0x1b')](_0x197b22)){if(!_0x1e4a0f['hasOwnProperty'](_0x197b22['id'])){for(var _0x58086f=0x0;_0x58086f<_0xede2f0[_0xe4e70a][_0x2997('0x1a')];_0x58086f++){var _0x320ca6=_[_0x2997('0x7e')](_0x39eae2[_0x2997('0x6f')][_0x4d6d2d][_0xede2f0[_0xe4e70a][_0x58086f]]['replace'](/"/g,'\x27'));var _0x19e69b=phoneDescriptions['find'](_0x2cf9f4=>_0x2cf9f4[_0x2997('0x7f')]===_0x197b22['id']);if(!_[_0x2997('0x1b')](_0x19e69b)){var _0x64cffd=_[_0x2997('0x7e')](_0x39eae2[_0x2997('0x6f')][_0x4d6d2d][_0xede2f0[_0x19e69b[_0x2997('0x80')]][0x0]][_0x2997('0x81')](/"/g,'\x27'));if(!_[_0x2997('0x1b')](_0x64cffd))_0x320ca6=_0x320ca6+'§'+_0x64cffd;}if(_0x32eba1=='')_0x32eba1=_0x320ca6;else _0x32eba1+='|'+_0x320ca6;}_0x1e4923[_0x2997('0x1d')](_0x197b22['id']+':'+_0x32eba1);_0x1e4a0f[_0x197b22['id']]=0x1;}}}}if(hasAdditionalPhones){_0x25c5c9[_0x2997('0x1d')]('\x22'+_0x1e4923['join'](';')+'\x22');}if(_0xb8ddd4['length']){handleError(_0x39eae2[_0x2997('0x6f')][_0x4d6d2d],{'code':'SystemRow','message':_0xb8ddd4[_0x2997('0x12')]()});}else{fs[_0x2997('0x82')](_0xf83629,_0x25c5c9['join']()+'\x0a');}_0x25c5c9=[];}if(!(stats[_0x2997('0x83')]%0xc8)){socket[_0x2997('0x84')](_0x2997('0x85')+_0x2e152f,stats);stats[_0x2997('0x5d')]=[];}}if(stopped){logger[_0x2997('0x5b')](_0x2997('0x86'));_0x29adef[_0x2997('0x87')]();}}catch(_0x5660b0){handleError(_0x39eae2[_0x2997('0x6f')][_0x4d6d2d],{'code':_0x2997('0x88'),'message':_0x5660b0['message']});logger[_0x2997('0x20')](_0x2997('0x89'),_0x5660b0[_0x2997('0x21')]);}},'complete':function(){try{var _0x2f2caa=[];var _0x2dd9b7=tempTableName;_0x2f2caa[_0x2997('0x1d')]('CREATE\x20TABLE\x20'+_0x2dd9b7+_0x2997('0x8a'));logger[_0x2997('0x5b')](_0x2997('0x8b'),contactItemTypes[_0x2997('0x1a')]);var _0x338732=util['format'](_0x2997('0x8c'),_0xf83629,_0x2dd9b7,_0x4c5a93,_0x4bcafa[_0x2997('0x33')],_0x4bcafa[_0x2997('0x55')]||null,NOW,NOW);if(_[_0x2997('0x1b')](_0xede2f0[_0x2997('0x72')])){_0x338732+=_0x2997('0x8d');}_0x2f2caa[_0x2997('0x1d')](_0x338732);BPromise['each'](_0x2f2caa,handleQuery)[_0x2997('0x23')](function(_0x15100a){BPromise[_0x2997('0x1e')]([handleAdditionalPhones()])[_0x2997('0x23')](function(){_0x2f2caa=[];for(var _0x2af888=0x0;_0x2af888\x20\x20','server/files/tmp','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','push','all','then','catch','message','length','split','CmContactHasItem','findOne','update','create','PHONE','inserted','CmContact','cm_contacts.phone','cm_contacts.id'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4760,0x1b4));var _0x0476=function(_0x1df491,_0x20d294){_0x1df491=_0x1df491-0x0;var _0xa292f4=_0x4760[_0x1df491];return _0xa292f4;};'use strict';var fs=require('fs');var path=require(_0x0476('0x0'));var _=require('lodash');var Papa=require(_0x0476('0x1'));var util=require(_0x0476('0x2'));var BPromise=require(_0x0476('0x3'));var moment=require(_0x0476('0x4'));var squel=require(_0x0476('0x5'));var Redis=require(_0x0476('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x0476('0x7'));var logger=require(_0x0476('0x8'))(_0x0476('0x9'));config[_0x0476('0xa')]=_[_0x0476('0xb')](config[_0x0476('0xa')],{'host':_0x0476('0xc'),'port':0x18eb});var socket=require(_0x0476('0xd'))(new Redis(config[_0x0476('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x0476('0xe')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()['format']('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2818b4){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))*$/[_0x0476('0xf')](_0x2818b4);}function selectNotIn(_0x35db49,_0x572ec2,_0x670807,_0x26dec0,_0x5aee81){return squel[_0x0476('0x10')]()[_0x0476('0x11')](_0x0476('0x12'))[_0x0476('0x13')](_0x26dec0)[_0x0476('0x14')](_0x572ec2,null,_0x572ec2+_0x0476('0x15')+_0x26dec0+'.'+_0x670807)['where'](_0x26dec0+'.'+_0x670807+_0x0476('0x16')+_0x35db49+'.'+_0x670807)[_0x0476('0x17')](_0x572ec2+_0x0476('0x18')+_0x5aee81[_0x0476('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x334d11,_0x531175){promisesAdditionalPhones=[];promisesContact=[];return db[_0x0476('0x19')][_0x0476('0x1a')](_0x0476('0x1b')+tempTableName)[_0x0476('0x1c')](function(_0x4646e6){if(_0x4646e6!==null){var _0x3c5dbe=[];for(var _0x1d860f=0x0;_0x1d860f<_0x4646e6['length'];_0x1d860f++){var _0x1dc86b=_0x4646e6[_0x1d860f];if(!_[_0x0476('0x1d')](_0x1dc86b[_0x0476('0x12')])){if(!_[_0x0476('0x1d')](_0x1dc86b[_0x0476('0x1e')]))_0x3c5dbe['push'](insertAdditionalPhones(_0x1dc86b));promisesContact[_0x0476('0x1f')]({'contact':_0x1dc86b});}}}Promise[_0x0476('0x20')](_0x3c5dbe)[_0x0476('0x21')](function(){_0x334d11({'val':0x1});});})[_0x0476('0x22')](function(_0x3a97dc){logger['error'](_0x3a97dc[_0x0476('0x23')]);});});}function insertAdditionalPhones(_0x328f00){return new Promise(function(_0x45f854,_0x39b5e2){var _0x19e4d6=_0x328f00[_0x0476('0x1e')];if(_[_0x0476('0x1d')](_0x19e4d6))_0x39b5e2({'val':0x0});else{var _0x40fe17=_0x19e4d6['split'](';');var _0x548178=[];orderBy=0x0;for(var _0x4b1faa=0x0;_0x4b1faa<_0x40fe17[_0x0476('0x24')];_0x4b1faa++){_0x548178[_0x0476('0x1f')](splitAdditionalPhone(_0x328f00['id'],_0x40fe17[_0x4b1faa]));}Promise['all'](_0x548178)[_0x0476('0x21')](function(){_0x45f854({'val':_0x40fe17[_0x0476('0x24')]});});}});}function splitAdditionalPhone(_0x5866b6,_0x5bd62f){return new Promise(function(_0x1e4dc7,_0x573b15){var _0x618991=_0x5bd62f[_0x0476('0x25')](':');var _0x21653e=_0x618991[0x0];var _0x192d27=_0x618991[0x1];if(_0x192d27!==''){var _0x46291c=_0x192d27['split']('|');var _0x4ef29e=[];for(var _0x43be2e=0x0;_0x43be2e<_0x46291c[_0x0476('0x24')];_0x43be2e++){if(_0x46291c[_0x43be2e]!==''){var _0x27ef0=_['filter'](promisesAdditionalPhones,{'contactId':_0x5866b6,'phone':_0x46291c[_0x43be2e]});if(_0x27ef0[_0x0476('0x24')]==0x0){orderBy++;promisesAdditionalPhones[_0x0476('0x1f')]({'contactId':_0x5866b6,'contactTypeId':_0x21653e,'phone':_0x46291c[_0x43be2e],'orderBy':orderBy});}}}_0x1e4dc7({'ok':0x1});}else _0x1e4dc7({'res':0x0});});}function createAdditionalPhone(_0x18e92c,_0x56519d,_0xf7d72f,_0x365531){var _0x5833d6='';var _0x3fb8e5='';var _0x56384a=_0xf7d72f[_0x0476('0x25')]('§');_0x5833d6=_0x56384a[0x0];if(_0x56384a[_0x0476('0x24')]==0x2)_0x3fb8e5=_0x56384a[0x1];return new Promise(function(_0x1fe4b7,_0x114c7b){return db[_0x0476('0x26')][_0x0476('0x27')]({'where':{'CmContactId':_0x18e92c,'item':_0x5833d6}})[_0x0476('0x21')](function(_0x27dbc8){if(_0x27dbc8){return db['CmContactHasItem'][_0x0476('0x28')]({'ItemTypeId':_0x56519d,'description':_0x3fb8e5,'OrderBy':_0x365531},{'where':{'CmContactId':_0x18e92c,'item':_0x5833d6}})[_0x0476('0x21')](function(_0x2b4813){_0x1fe4b7({'res':'updated'});});}else{return db[_0x0476('0x26')][_0x0476('0x29')]({'CmContactId':_0x18e92c,'item':_0x5833d6,'ItemTypeId':_0x56519d,'description':_0x3fb8e5,'OrderBy':_0x365531,'ItemClass':_0x0476('0x2a')})['then'](function(_0x3c0bc0){_0x1fe4b7({'res':_0x0476('0x2b')});});}});});}function updateContact(_0xfd9cc1){return new Promise(function(_0x476103,_0x52f33a){var _0x509cb9=_0xfd9cc1['id'];delete _0xfd9cc1['id'];return db[_0x0476('0x2c')]['update'](_0xfd9cc1,{'where':{'id':_0x509cb9}})[_0x0476('0x21')](function(_0x5ce731){updatedRows+=0x1;return db['CmHopper'][_0x0476('0x28')]({'phone':_0xfd9cc1[_0x0476('0x12')]},{'where':{'ContactId':_0x509cb9}})['then'](function(_0x3f4058){_0x476103({'ret':'OK'});});});});}function insertCmHopper(_0x5aad38,_0x46af59,_0x286b63,_0xed84ff,_0x32dcfe){var _0x5e2ab2=[_0x0476('0x2d'),'cm_contacts.scheduledat',_0x0476('0x2e'),_0x0476('0x2f'),_0x46af59+'.'+_0xed84ff,_0x0476('0x30'),_0x0476('0x31'),_0x0476('0x32'),_0x0476('0x33'),'\x22'+_0x32dcfe+'\x22'];return squel[_0x0476('0x34')]()[_0x0476('0x35')](_0x0476('0x36'))[_0x0476('0x37')]([_0x0476('0x12'),'scheduledat',_0x0476('0x38'),'ListId',_0xed84ff,_0x0476('0x39'),_0x0476('0x3a'),_0x0476('0x3b'),_0x0476('0x3c'),_0x0476('0x3d')],squel[_0x0476('0x10')]()[_0x0476('0x3e')](_0x5e2ab2)[_0x0476('0x13')](_0x46af59)[_0x0476('0x14')](_0x0476('0x3f'),null,_0x0476('0x40')+_0x46af59+'.CmListId')[_0x0476('0x14')](_0x286b63,null,_0x286b63+_0x0476('0x15')+_0x46af59+'.'+_0xed84ff)[_0x0476('0x17')](_0x46af59+_0x0476('0x41'),_0x5aad38)[_0x0476('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x0476('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x46af59,_0x286b63,_0xed84ff,_0x0476('0x36'),[_0x0476('0x42'),'\x22onlyIfOpen\x22']))[_0x0476('0x17')](_0x0476('0x43'),selectNotIn(_0x46af59,_0x286b63,_0xed84ff,_0x0476('0x36'),[_0x0476('0x42')])))[_0x0476('0x44')]();}function insertCmHopperBlack(_0x5d57cc,_0x1458f0,_0x560dcb,_0x4afc6c){var _0x4872e7=[_0x0476('0x2d'),'cm_contacts.id','cm_contacts.ListId',_0x1458f0+'.'+_0x4afc6c,_0x0476('0x30'),_0x0476('0x31')];return squel[_0x0476('0x34')]()[_0x0476('0x35')](_0x0476('0x45'))[_0x0476('0x37')](['phone',_0x0476('0x38'),_0x0476('0x46'),_0x4afc6c,_0x0476('0x39'),_0x0476('0x3a')],squel[_0x0476('0x10')]()['fields'](_0x4872e7)['from'](_0x1458f0)[_0x0476('0x14')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x1458f0+_0x0476('0x47'))[_0x0476('0x14')](_0x560dcb,null,_0x560dcb+_0x0476('0x15')+_0x1458f0+'.'+_0x4afc6c)[_0x0476('0x17')](_0x1458f0+_0x0476('0x41'),_0x5d57cc)[_0x0476('0x17')](_0x0476('0x48'),NOW)['where'](_0x0476('0x43'),squel[_0x0476('0x10')]()[_0x0476('0x11')]('phone')[_0x0476('0x13')](_0x0476('0x45'))[_0x0476('0x17')]('ListId\x20=\x20?',_0x5d57cc)[_0x0476('0x17')](_0x4afc6c+'\x20=\x20?',_0x1458f0+'.'+_0x4afc6c)))[_0x0476('0x44')]();}function insertCmHopperAdditionalPhones(_0x268812){var _0xa53399=[_0x0476('0x49'),_0x0476('0x4a'),_0x0476('0x4b'),'cm_contact_has_items.createdAt',_0x0476('0x4c')];return squel['insert']()[_0x0476('0x35')](_0x0476('0x4d'))[_0x0476('0x37')]([_0x0476('0x4e'),_0x0476('0x12'),_0x0476('0x4f'),_0x0476('0x39'),_0x0476('0x3a')],squel[_0x0476('0x10')]()[_0x0476('0x3e')](_0xa53399)[_0x0476('0x13')](_0x0476('0x36'))[_0x0476('0x14')](_0x0476('0x3f'),null,_0x0476('0x50'))[_0x0476('0x14')](_0x0476('0x51'),null,_0x0476('0x52'))['where'](_0x0476('0x53'),_0x268812)[_0x0476('0x17')](_0x0476('0x48'),NOW))['toString']();}function insertCmContact(_0x451e51,_0x78675a,_0x4f6685,_0x4d5152){var _0x1c40e0=_[_0x0476('0x54')](_['keys'](_0x4d5152),['ListId',_0x0476('0x55'),_0x0476('0x39'),_0x0476('0x3a')]);return squel[_0x0476('0x34')]()[_0x0476('0x35')](_0x0476('0x3f'))[_0x0476('0x37')](_0x1c40e0,squel[_0x0476('0x10')]()[_0x0476('0x3e')](_0x1c40e0)[_0x0476('0x13')](_0x78675a)[_0x0476('0x17')]('('+_0x4f6685['join'](',')+_0x0476('0x56'),squel[_0x0476('0x10')]()[_0x0476('0x3e')](_0x4f6685)[_0x0476('0x13')](_0x0476('0x3f'))[_0x0476('0x17')]('ListId\x20=\x20?',_0x451e51))[_0x0476('0x17')](_0x0476('0x57'),squel['select']()[_0x0476('0x11')](_0x0476('0x58'),_0x0476('0x59'))['from'](_0x78675a)[_0x0476('0x5a')](_0x4f6685[_0x0476('0x14')](','))))[_0x0476('0x44')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2ade7a){logger['error'](_0x2ade7a[_0x0476('0x23')]);process['exit'](0x1);}function handleError(_0x29cdf8,_0x46d757){stats['errors'][_0x0476('0x1f')]({'name':_0x46d757[_0x0476('0x5b')],'message':_0x46d757[_0x0476('0x23')],'row':_0x29cdf8});}function handleQuery(_0x549a75){logger[_0x0476('0x5c')](_0x549a75);return db[_0x0476('0x19')][_0x0476('0x1a')](_0x549a75)[_0x0476('0x1c')](function(_0x1be7fd){results[_0x0476('0x1f')](_0x1be7fd);})['catch'](function(_0xdd6f9e){logger[_0x0476('0x5d')](_0xdd6f9e[_0x0476('0x23')]);});}function main(_0x39b924,_0x580650,_0x1d166a,_0x1a4124){logger[_0x0476('0x5c')](_0x0476('0x5e'),_0x39b924,JSON[_0x0476('0x5f')](_0x580650));process[_0x0476('0x60')]('start');var _0x127194=_0x580650[_0x0476('0x61')];var _0xd4af9a=_[_0x0476('0x62')](_0x127194);var _0xbace5=_0x580650[_0x0476('0x63')];var _0x108971=path[_0x0476('0x14')](config[_0x0476('0x64')],'server/files/tmp',_0xbace5+_0x0476('0x65'));logger['info'](_0x0476('0x66'),_0x580650);db[_0x0476('0x67')][_0x0476('0x68')]({'raw':!![],'attributes':['id',_0x0476('0x69')]})[_0x0476('0x21')](function(_0x1f02c4){for(var _0x230d0a=0x0;_0x230d0a<_0x1f02c4[_0x0476('0x24')];_0x230d0a++){if(_0x1f02c4[_0x230d0a][_0x0476('0x69')]in _0x127194){contactItemTypes[_0x0476('0x1f')](_0x1f02c4[_0x230d0a]);delete _0xd4af9a[_0x1f02c4[_0x230d0a][_0x0476('0x69')]];hasAdditionalPhones=!![];}for(var _0x39fe88 in _0x127194){if(_0x1f02c4[_0x230d0a][_0x0476('0x69')]+'_description'===_0x39fe88){phoneDescriptions[_0x0476('0x1f')]({'itemTypeId':_0x1f02c4[_0x230d0a]['id'],'description':_0x39fe88});delete _0xd4af9a[_0x39fe88];}}}if(hasAdditionalPhones)_0xd4af9a[_0x0476('0x1e')]='';var _0x431904=_[_0x0476('0x6a')](_0xd4af9a)['join']();logger[_0x0476('0x5c')](_0x0476('0x6b'),_0x431904);fs['writeFileSync'](_0x108971,_0x431904+'\x0a');Papa[_0x0476('0x6c')](fs['createReadStream'](_0x39b924),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2e35fe,_0x15bc6a){try{for(var _0xedb345=0x0,_0x5bba30=[];_0xedb345<_0x2e35fe['data'][_0x0476('0x24')];_0xedb345++){stats[_0x0476('0x6d')]+=0x1;if(_0x2e35fe[_0x0476('0x6e')][_0xedb345]){handleError(_0x2e35fe[_0x0476('0x6f')][_0xedb345],_0x2e35fe['errors'][_0xedb345]);}else{var _0x3b0c3e=[];var _0x367ae3=[];var _0x59567b={};for(var _0x484ae6 in _0x127194){let _0x323d3c=contactItemTypes[_0x0476('0x70')](_0x25ce78=>_0x25ce78[_0x0476('0x69')]===_0x484ae6);let _0x3ac11b=contactItemTypes[_0x0476('0x70')](_0x5d19b5=>_0x5d19b5['name']+_0x0476('0x71')===_0x484ae6);if(_[_0x0476('0x1d')](_0x323d3c)&&_[_0x0476('0x1d')](_0x3ac11b)){if(_0x127194[_0x0476('0x72')](_0x484ae6)){if(_0x2e35fe[_0x0476('0x6f')][_0xedb345][_0x127194[_0x484ae6]]){var _0x1bbcaa=_[_0x0476('0x73')](_0x2e35fe[_0x0476('0x6f')][_0xedb345][_0x127194[_0x484ae6]][_0x0476('0x74')](/"/g,'\x27'));switch(_0x484ae6){case _0x0476('0x75'):var _0x153d3a=moment(_0x1bbcaa,_0x0476('0x76'),!![]);if(_0x153d3a[_0x0476('0x77')]()){_0x5bba30['push']('\x22'+_0x1bbcaa+'\x22');}else{_0x3b0c3e[_0x0476('0x1f')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x0476('0x3b'):var _0x179d7d=parseInt(_0x1bbcaa);_0x1bbcaa=_[_0x0476('0x78')](_0x179d7d)||_0x179d7d<0x0||_0x179d7d>0x4?_0x1a4124?0x3:0x2:_0x179d7d;_0x5bba30[_0x0476('0x1f')]('\x22'+_0x1bbcaa+'\x22');break;case _0x0476('0x3c'):var _0x10e925=parseInt(_0x1bbcaa);if(_[_0x0476('0x79')](_0x10e925)&&_['includes'](_0x1d166a,_0x10e925)){_0x5bba30['push']('\x22'+_0x10e925+'\x22');}else{_0x3b0c3e[_0x0476('0x1f')](_0x0476('0x7a'));}break;case _0x0476('0x7b'):if(isEmail(_0x1bbcaa)){_0x5bba30[_0x0476('0x1f')]('\x22'+_0x1bbcaa+'\x22');}else{_0x3b0c3e[_0x0476('0x1f')](_0x0476('0x7c'));}break;case _0x0476('0x7d'):var _0x532109=moment(_0x1bbcaa,'YYYY-MM-DD',!![]);if(_0x532109['isValid']()){_0x5bba30[_0x0476('0x1f')]('\x22'+_0x1bbcaa+'\x22');}else{_0x3b0c3e[_0x0476('0x1f')](_0x0476('0x7e'));}break;default:_0x5bba30['push']('\x22'+_0x1bbcaa+'\x22');}}else{switch(_0x484ae6){case _0x0476('0x7f'):case'phone':_0x3b0c3e[_0x0476('0x1f')](_0x484ae6+_0x0476('0x80'));break;default:_0x5bba30['push']('\x22\x22');}}}}else{var _0x42ea12='';if(!_[_0x0476('0x1d')](_0x323d3c)){if(!_0x59567b[_0x0476('0x72')](_0x323d3c['id'])){for(var _0x2cb310=0x0;_0x2cb310<_0x127194[_0x484ae6][_0x0476('0x24')];_0x2cb310++){var _0x1bbcaa=_[_0x0476('0x73')](_0x2e35fe['data'][_0xedb345][_0x127194[_0x484ae6][_0x2cb310]][_0x0476('0x74')](/"/g,'\x27'));var _0x1ad1dd=phoneDescriptions[_0x0476('0x70')](_0x1a628a=>_0x1a628a[_0x0476('0x81')]===_0x323d3c['id']);if(!_[_0x0476('0x1d')](_0x1ad1dd)){var _0x325108=_['trim'](_0x2e35fe[_0x0476('0x6f')][_0xedb345][_0x127194[_0x1ad1dd['description']][0x0]][_0x0476('0x74')](/"/g,'\x27'));if(!_[_0x0476('0x1d')](_0x325108))_0x1bbcaa=_0x1bbcaa+'§'+_0x325108;}if(_0x42ea12=='')_0x42ea12=_0x1bbcaa;else _0x42ea12+='|'+_0x1bbcaa;}_0x367ae3['push'](_0x323d3c['id']+':'+_0x42ea12);_0x59567b[_0x323d3c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5bba30[_0x0476('0x1f')]('\x22'+_0x367ae3[_0x0476('0x14')](';')+'\x22');}if(_0x3b0c3e[_0x0476('0x24')]){handleError(_0x2e35fe['data'][_0xedb345],{'code':_0x0476('0x82'),'message':_0x3b0c3e['join']()});}else{fs[_0x0476('0x83')](_0x108971,_0x5bba30['join']()+'\x0a');}_0x5bba30=[];}if(!(stats[_0x0476('0x6d')]%0xc8)){socket[_0x0476('0x84')](_0x0476('0x85')+_0xbace5,stats);stats[_0x0476('0x6e')]=[];}}if(stopped){logger[_0x0476('0x5c')]('Abort\x20parser');_0x15bc6a['abort']();}}catch(_0x21024b){handleError(_0x2e35fe[_0x0476('0x6f')][_0xedb345],{'code':_0x0476('0x86'),'message':_0x21024b[_0x0476('0x23')]});logger[_0x0476('0x5d')](_0x0476('0x87'),_0x21024b[_0x0476('0x23')]);}},'complete':function(){try{var _0x587467=[];var _0x1adcfd=tempTableName;_0x587467[_0x0476('0x1f')](_0x0476('0x88')+_0x1adcfd+_0x0476('0x89'));logger[_0x0476('0x5c')]('CIS\x20len',contactItemTypes[_0x0476('0x24')]);var _0x127e4a=util[_0x0476('0xe')](_0x0476('0x8a'),_0x108971,_0x1adcfd,_0x431904,_0x580650[_0x0476('0x46')],_0x580650[_0x0476('0x55')]||null,NOW,NOW);if(_['isNil'](_0x127194[_0x0476('0x75')])){_0x127e4a+=',\x20scheduledAt\x20=\x20NOW()';}_0x587467[_0x0476('0x1f')](_0x127e4a);BPromise[_0x0476('0x8b')](_0x587467,handleQuery)[_0x0476('0x21')](function(_0x39f7a3){BPromise[_0x0476('0x20')]([handleAdditionalPhones()])[_0x0476('0x21')](function(){_0x587467=[];for(var _0x24df6d=0x0;_0x24df6d\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.createdAt','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.to','i.ContactId','i.UserId','openchannel','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','where','t.id\x20IN\x20?','Sequelize','exports'];(function(_0x58e276,_0x18f1a1){var _0x52fdb8=function(_0x564e6e){while(--_0x564e6e){_0x58e276['push'](_0x58e276['shift']());}};_0x52fdb8(++_0x18f1a1);}(_0xc0fc,0x14c));var _0xcc0f=function(_0x3a660d,_0x40a16b){_0x3a660d=_0x3a660d-0x0;var _0x4449d2=_0xc0fc[_0x3a660d];return _0x4449d2;};'use strict';var _=require(_0xcc0f('0x0'));var squel=require(_0xcc0f('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0xcc0f('0x2'));var updateInteraction=require('./update-interaction')[_0xcc0f('0x3')];var utils=require(_0xcc0f('0x4'));var db=require(_0xcc0f('0x5'))['db'];function skipInteractionsQuery(_0x192cad,_0x451715,_0x22456d){var _0x52ccc1=![];var _0x51b1e1=utils[_0xcc0f('0x6')](_0x192cad);if(_0x451715[_0xcc0f('0x7')]===_0xcc0f('0x8')&&!_0x22456d['search']&&!_0x22456d[_0x51b1e1]){_0x52ccc1=!![];}return _0x52ccc1;}function getTagsQuery(){return squel[_0xcc0f('0x9')]()[_0xcc0f('0xa')]('id')[_0xcc0f('0xa')](_0xcc0f('0xb'))[_0xcc0f('0xa')]('color')[_0xcc0f('0xc')](_0xcc0f('0xd'));}function getUsersQuery(_0x283614,_0x7e98e3){var _0x30ce6d=utils[_0xcc0f('0xe')](_0x283614);var _0x55be5f='user_has_'+_0x283614+_0xcc0f('0xf');var _0x2154de=squel['select']()[_0xcc0f('0xa')](_0xcc0f('0x10'))[_0xcc0f('0xa')](_0xcc0f('0x11'))[_0xcc0f('0xa')](_0xcc0f('0x12')+_0x30ce6d)[_0xcc0f('0xc')](_0x55be5f,'ui')[_0xcc0f('0x13')](_0xcc0f('0x14'),'u','u.id\x20=\x20ui.UserId');if(_0x7e98e3['length']>0x0){_0x2154de['where']('ui.'+_0x30ce6d+'\x20IN\x20?',_['map'](_0x7e98e3,'id'));}return _0x2154de;}function getInteractionsQuery(_0x1578ea){var _0x4d66f7=utils[_0xcc0f('0x15')](_0x1578ea);var _0x4b0945=utils[_0xcc0f('0x6')](_0x1578ea);var _0x5963e7=utils[_0xcc0f('0xe')](_0x1578ea);return squel[_0xcc0f('0x9')]()['from'](_0x4d66f7[_0xcc0f('0x16')],'i')[_0xcc0f('0x13')](_0xcc0f('0x17'),'c',_0xcc0f('0x18'))['left_join'](_0xcc0f('0x14'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x4d66f7[_0xcc0f('0x19')],'a',_0xcc0f('0x1a')+_0x4b0945)[_0xcc0f('0x13')](_0x4d66f7[_0xcc0f('0x1b')],'me',_0xcc0f('0x1c')+_0x5963e7+_0xcc0f('0x1d'))[_0xcc0f('0x13')](_0x4d66f7[_0xcc0f('0x1e')],'it','it.'+_0x5963e7+_0xcc0f('0x1d'))[_0xcc0f('0x13')](_0xcc0f('0xd'),'t',_0xcc0f('0x1f'));}function getSqlClauses(){var _0x36847a={'body':squel[_0xcc0f('0x20')](),'contact':squel[_0xcc0f('0x20')](),'default':squel['expr'](),'fields':squel[_0xcc0f('0x20')](),'filter':squel[_0xcc0f('0x20')](),'read':squel['expr'](),'tags':{'clause':squel[_0xcc0f('0x20')](),'ids':null},'user':squel[_0xcc0f('0x20')]()};return _0x36847a;}function parseTagParameter(_0x5d4e17){var _0x5b7fb0=squel['expr']();if(_0x5d4e17){var _0x2fece8=utils[_0xcc0f('0x21')](_0x5d4e17);_0x2fece8[_0xcc0f('0x22')](function(_0xc16371){_0x5b7fb0['or'](_0xcc0f('0x23'),'%,'+_0xc16371+',%');});}return _0x5b7fb0;}function parseReadParameter(_0xb4be97){var _0x5dc396='';if(_0xb4be97){_0x5dc396=_0xcc0f('0x24');if(_0xb4be97==='1'){_0x5dc396=_0x5dc396[_0xcc0f('0x25')]('{OPERATOR}','=');}else{_0x5dc396=_0x5dc396[_0xcc0f('0x25')](_0xcc0f('0x26'),'>');}}return _0x5dc396;}function parseSearchFilter(_0x5d8959,_0x378e1a){var _0x35d34d=squel[_0xcc0f('0x20')]();if(_0x378e1a){var _0x2ba0bf=_0x378e1a[_0xcc0f('0x25')]('\x5c','\x5c\x5c')[_0xcc0f('0x25')](/'/g,'\x27\x27');var _0x53c157=qs[_0xcc0f('0x27')](_0x2ba0bf);if(qs[_0xcc0f('0x28')](_0x2ba0bf)){_0x35d34d['or'](_0xcc0f('0x29'),_0x53c157+'%');if([_0xcc0f('0x2a'),_0xcc0f('0x2b')][_0xcc0f('0x2c')](_0x5d8959)){_0x35d34d['or'](_0xcc0f('0x2d'),_0x53c157+'%');}else if(_0x5d8959===_0xcc0f('0x2e')){_0x35d34d['or'](_0xcc0f('0x2f'),_0x53c157+'%');}else if(_0x5d8959==='openchannel'){_0x35d34d['or'](_0xcc0f('0x30'),_0x53c157+'%');}}else if(_0x5d8959===_0xcc0f('0x31')&&qs['isEmail'](_0x2ba0bf)){_0x35d34d['or'](_0xcc0f('0x32'),_0x53c157+'%');}else{if(_0x5d8959===_0xcc0f('0x31')){_0x35d34d['or'](_0xcc0f('0x33'),qs[_0xcc0f('0x34')](_0x2ba0bf,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcc0f('0x34')](_0x2ba0bf));}else if(_0x5d8959!=='fax'){_0x35d34d['or'](_0xcc0f('0x35'),qs['getFullTextValue'](_0x2ba0bf));}_0x35d34d['or'](_0xcc0f('0x36'),qs[_0xcc0f('0x34')](_0x2ba0bf,!![]),null);}}return _0x35d34d;}function parseAdvancedSearchFilter(_0x1eac60,_0x45320b){var _0x167463=getSqlClauses();var _0xc7d2aa=as[_0xcc0f('0x37')](_0x1eac60);var _0x5286ae=_0xc7d2aa[_0xcc0f('0x38')];for(var _0x2285be=0x0;_0x2285be<_0xc7d2aa[_0xcc0f('0x39')][_0xcc0f('0x3a')];_0x2285be++){var _0x52f2e2=_0xc7d2aa[_0xcc0f('0x39')][_0x2285be];var _0x184de3='i';var _0x2ab9c9=_['find'](_0x45320b,[_0xcc0f('0xb'),_0x52f2e2['field']]);if(_0x2ab9c9){var _0x5ede44=as[_0xcc0f('0x3b')](_0x184de3,_0x2ab9c9[_0xcc0f('0x3c')],_0x52f2e2);_0x167463['default'][_0x5286ae](_0x5ede44['text'],_0x5ede44[_0xcc0f('0x3d')][_0xcc0f('0x3e')],_0x5ede44[_0xcc0f('0x3d')]['end']);}else{switch(_0x52f2e2[_0xcc0f('0xa')]){case _0xcc0f('0x3f'):var _0x5d84bf=parseReadParameter(_0x52f2e2[_0xcc0f('0x3d')]);_0x167463['read'][_0xcc0f('0x40')](_0x5d84bf);break;case _0xcc0f('0x41'):if(_0x52f2e2[_0xcc0f('0x42')]===_0xcc0f('0x43')){if(_0x52f2e2[_0xcc0f('0x3d')]['split']('\x20')['length']>0x1){_0x167463[_0xcc0f('0x44')][_0x5286ae](_0xcc0f('0x36'),qs[_0xcc0f('0x34')](_0x52f2e2[_0xcc0f('0x3d')],!![]),null);}else{var _0x4c5b53='%'+_0x52f2e2['value']+'%';_0x167463['contact'][_0x5286ae](_0xcc0f('0x45'),_0x4c5b53,_0x4c5b53,_0x4c5b53);}}else{_0x2ab9c9=_[_0xcc0f('0x46')](_0x45320b,[_0xcc0f('0xb'),'ContactId']);_0x52f2e2['field']='ContactId';_0x5ede44=as[_0xcc0f('0x3b')](_0x184de3,_0x2ab9c9[_0xcc0f('0x3c')],_0x52f2e2);_0x167463[_0xcc0f('0x44')][_0x5286ae](_0x5ede44[_0xcc0f('0x47')],_0x5ede44[_0xcc0f('0x3d')][_0xcc0f('0x3e')],_0x5ede44[_0xcc0f('0x3d')]['end']);}break;case _0xcc0f('0x48'):var _0x90571a=_0x52f2e2[_0xcc0f('0x3d')][_0xcc0f('0x49')](',')[_0xcc0f('0x4a')](function(_0x3d6e35){return Number(_0x3d6e35);});var _0x51e2d4=parseTagParameter(_0x90571a);_0x167463[_0xcc0f('0x4b')]['clause'][_0xcc0f('0x40')](_0x51e2d4);_0x167463[_0xcc0f('0x4b')][_0xcc0f('0x4c')]=_0x90571a;break;case _0xcc0f('0x4d'):if(_0x52f2e2['operator']==='$substring'){_0x167463[_0xcc0f('0x4e')][_0x5286ae](_0xcc0f('0x4f'),'%'+_0x52f2e2[_0xcc0f('0x3d')]+'%',null);}else{_0x2ab9c9=_[_0xcc0f('0x46')](_0x45320b,[_0xcc0f('0xb'),_0xcc0f('0x50')]);_0x52f2e2[_0xcc0f('0xa')]=_0xcc0f('0x50');_0x5ede44=as[_0xcc0f('0x3b')](_0x184de3,_0x2ab9c9[_0xcc0f('0x3c')],_0x52f2e2);_0x167463[_0xcc0f('0x4e')][_0x5286ae](_0x5ede44[_0xcc0f('0x47')],_0x5ede44[_0xcc0f('0x3d')][_0xcc0f('0x3e')],_0x5ede44[_0xcc0f('0x3d')][_0xcc0f('0x51')]);}break;case _0xcc0f('0x52'):case _0xcc0f('0x53'):_0x5ede44=as[_0xcc0f('0x3b')]('me',null,_0x52f2e2);_0x167463[_0xcc0f('0x52')][_0x5286ae](_0x5ede44[_0xcc0f('0x47')],_0x5ede44['value'][_0xcc0f('0x3e')],_0x5ede44[_0xcc0f('0x3d')][_0xcc0f('0x51')]);break;}}}return _0x167463;}function parseModelFields(_0x3ce7f9,_0x3c0e52,_0x4a7acc){var _0x2d7e88=utils[_0xcc0f('0x6')](_0x3ce7f9);var _0x19a92b=squel[_0xcc0f('0x20')]();var _0x376c91=_(_0x3c0e52)[_0xcc0f('0x54')]()[_0xcc0f('0x4a')](function(_0x3f9f6b){return _[_0xcc0f('0x55')](_0x4a7acc,[_0xcc0f('0xb'),_0x3f9f6b])?_0x3f9f6b:undefined;})[_0xcc0f('0x56')]()[_0xcc0f('0x3d')]();if(_0x376c91['length']>0x0){_0x376c91['forEach'](function(_0x5dfd0d){if(_0x5dfd0d===_0x2d7e88){_0x19a92b['and']('i.'+_0x2d7e88+_0xcc0f('0x57'),[]['concat'](_0x3c0e52[_0x5dfd0d]));}else if(_0x5dfd0d===_0xcc0f('0x58')){var _0x4a7ae2=JSON[_0xcc0f('0x59')](_0x3c0e52[_0x5dfd0d])[_0xcc0f('0x5a')];var _0x50abdb=JSON[_0xcc0f('0x59')](_0x3c0e52[_0x5dfd0d])[_0xcc0f('0x5b')];_0x19a92b['and']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4a7ae2,_0x50abdb);}else{if(_0x3c0e52[_0x5dfd0d]==='null'){_0x19a92b['and']('i.'+_0x5dfd0d+_0xcc0f('0x5c'));}else{_0x19a92b['and']('i.'+_0x5dfd0d+'\x20=\x20?',_0x3c0e52[_0x5dfd0d]);}}});}return _0x19a92b;}function parseQueryParameters(_0x44e311,_0x41d116,_0x2d923a){var _0x52e0eb=getSqlClauses();return Promise['resolve']()[_0xcc0f('0x5d')](function(){return parseModelFields(_0x44e311,_0x41d116,_0x2d923a);})[_0xcc0f('0x5d')](function(_0x112ed1){_0x52e0eb['fields']['and'](_0x112ed1);return parseReadParameter(_0x41d116[_0xcc0f('0x5e')]);})[_0xcc0f('0x5d')](function(_0x66fb65){_0x52e0eb[_0xcc0f('0x5e')][_0xcc0f('0x40')](_0x66fb65);return parseTagParameter(_0x41d116[_0xcc0f('0x5f')]);})[_0xcc0f('0x5d')](function(_0x1fd0b2){_0x52e0eb[_0xcc0f('0x4b')]['clause'][_0xcc0f('0x40')](_0x1fd0b2);return parseSearchFilter(_0x44e311,_0x41d116[_0xcc0f('0x60')]);})[_0xcc0f('0x5d')](function(_0x2d667a){_0x52e0eb[_0xcc0f('0x60')]=_0x2d667a;return _0x52e0eb;});}function checkAccountsRestrictions(_0x24b423,_0x12626f,_0x22c750){var _0x352d74=utils[_0xcc0f('0x6')](_0x24b423);var _0x2f9525=_0xcc0f('0x61')+_['capitalize'](_0x24b423)+(_0x24b423===_0xcc0f('0x62')?'Websites':_0xcc0f('0x63'));var _0x3f2d60=squel[_0xcc0f('0x20')]();return Promise[_0xcc0f('0x64')]()[_0xcc0f('0x5d')](function(){if(_0x22c750[_0xcc0f('0x65')]&&_0x12626f[_0xcc0f('0x7')]===_0xcc0f('0x8')){return _0x12626f[_0x2f9525]({'attributes':['id'],'raw':!![]});}})[_0xcc0f('0x5d')](function(_0x2d895e){if(_0x2d895e){if(_0x2d895e[_0xcc0f('0x3a')]===0x0){_0x3f2d60[_0xcc0f('0x40')]('i.'+_0x352d74+'\x20IS\x20NULL');}else{_0x3f2d60['and']('i.'+_0x352d74+_0xcc0f('0x57'),_[_0xcc0f('0x4a')](_0x2d895e,'id'));}}else if(!_0x22c750[_0x352d74]){_0x3f2d60[_0xcc0f('0x40')]('i.'+_0x352d74+_0xcc0f('0x66'));}})[_0xcc0f('0x5d')](function(){return _0x3f2d60;});}function getClosedOrderClause(_0x339bd7,_0x2dbba5){var _0x4ea78d='';var _0x401be3=['i.thirdDisposition','i.secondDisposition','i.disposition'];if(_0x339bd7===_0xcc0f('0x31')){_0x401be3[_0xcc0f('0x67')](_0xcc0f('0x68'));}if(_0x2dbba5[_0xcc0f('0x69')]==='0'&&_0x339bd7===_0xcc0f('0x31')){_0x4ea78d=_0xcc0f('0x68');}else{if(_0x2dbba5[_0xcc0f('0x69')]==='1'){_0x401be3[_0xcc0f('0x6a')]();}_0x4ea78d=_0xcc0f('0x6b')+_0x401be3[_0xcc0f('0x6c')](',\x20')+')';}return _0x4ea78d;}function getFilteredInteractions(_0x164620,_0x2984fd,_0x132ae0,_0x546b06){var _0x141bae=utils['getInteractionFK'](_0x164620);var _0x465d2f=_[_0xcc0f('0x6d')](_0x164620)+_0xcc0f('0x6e');var _0x508273=[];var _0x58d777=getTagsQuery();var _0x1cc8c2={'type':db['Sequelize'][_0xcc0f('0x6f')]['SELECT'],'raw':!![]};var _0x4d2427=[];var _0x5480e2=[];return db[_0xcc0f('0x70')][_0xcc0f('0x71')](_0x58d777[_0xcc0f('0x72')](),_0x1cc8c2)[_0xcc0f('0x5d')](function(_0x5b5b81){_0x508273=_['keyBy'](_0x5b5b81,'id');_0x1cc8c2=_[_0xcc0f('0x73')](_0x1cc8c2,{'model':db[_0x465d2f],'mapToModel':!![],'nest':!![]});if(_0x132ae0[_0xcc0f('0x74')]){_0x546b06[_0xcc0f('0x75')][_0xcc0f('0x22')](function(_0x474862){_0x2984fd[_0xcc0f('0xa')]('i.'+_0x474862);});}else{_0x2984fd[_0xcc0f('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x2984fd[_0xcc0f('0xa')](_0xcc0f('0x76'),_0xcc0f('0x77'));_0x2984fd['field'](_0xcc0f('0x78'),'Account.mandatoryDisposition');if(_0x164620==='mail'){_0x2984fd[_0xcc0f('0xa')](_0xcc0f('0x79'),_0xcc0f('0x7a'));_0x2984fd['field'](_0xcc0f('0x7b'),'contactName');_0x2984fd['field'](_0xcc0f('0x7c'));_0x2984fd['field'](_0xcc0f('0x7d'));_0x2984fd[_0xcc0f('0xa')]('i.updatedAt');_0x2984fd[_0xcc0f('0xa')]('i.closed');_0x2984fd['field'](_0xcc0f('0x7e'));_0x2984fd[_0xcc0f('0xa')](_0xcc0f('0x7f'));_0x2984fd['field']('i.lastMsgAt');_0x2984fd[_0xcc0f('0xa')](_0xcc0f('0x80'));_0x2984fd[_0xcc0f('0xa')]('i.subject');_0x2984fd['field'](_0xcc0f('0x81'));_0x2984fd[_0xcc0f('0xa')](_0xcc0f('0x82'));_0x2984fd[_0xcc0f('0xa')]('i.thirdDisposition');_0x2984fd[_0xcc0f('0xa')](_0xcc0f('0x68'));_0x2984fd['field'](_0xcc0f('0x83'));_0x2984fd[_0xcc0f('0xa')](_0xcc0f('0x84'));_0x2984fd['field']('i.MailAccountId');_0x2984fd[_0xcc0f('0xa')](_0xcc0f('0x85'));}else if(_0x164620===_0xcc0f('0x86')){_0x2984fd['field'](_0xcc0f('0x87'),_0xcc0f('0x88'));}else{_0x2984fd['field']('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(_0x164620!==_0xcc0f('0x31')){_0x2984fd[_0xcc0f('0xa')](_0xcc0f('0x89'));}_0x2984fd['field'](_0xcc0f('0x8a'),'Contact.firstName');_0x2984fd['field'](_0xcc0f('0x8b'),_0xcc0f('0x8c'));_0x2984fd[_0xcc0f('0xa')](_0xcc0f('0x8d'),_0xcc0f('0x8e'));_0x2984fd[_0xcc0f('0xa')](_0xcc0f('0x8f'),_0xcc0f('0x90'));_0x2984fd['field'](_0xcc0f('0x91'),'Contact.mobile');_0x2984fd['field'](_0xcc0f('0x92'),_0xcc0f('0x93'));_0x2984fd[_0xcc0f('0xa')](_0xcc0f('0x94'),'Owner.fullname');_0x2984fd[_0xcc0f('0xa')](_0xcc0f('0x95'),_0xcc0f('0x96'));_0x2984fd['field'](_0xcc0f('0x97'),'TagIds');}if(_0x546b06[_0xcc0f('0x98')]){_0x2984fd[_0xcc0f('0x98')](_0x546b06[_0xcc0f('0x98')]);}if(_0x546b06['offset']){_0x2984fd['offset'](_0x546b06[_0xcc0f('0x99')]);}return db['sequelize'][_0xcc0f('0x71')](_0x2984fd[_0xcc0f('0x72')](),_0x1cc8c2);})[_0xcc0f('0x5d')](function(_0x163ee9){_0x4d2427=_0x163ee9;var _0x54b4f2=getUsersQuery(_0x164620,_0x4d2427);return db['sequelize']['query'](_0x54b4f2[_0xcc0f('0x72')](),_0x1cc8c2);})['then'](function(_0x318a7e){_0x5480e2=_[_0xcc0f('0x9a')](_0x318a7e,_0x141bae);if(_0x164620===_0xcc0f('0x31')){return db[_0xcc0f('0x9b')][_0xcc0f('0x9c')]({'attributes':[_0xcc0f('0x9d')],'raw':!![]});}})['then'](function(_0x1e1303){var _0x8782a8=_0x1e1303?_0x1e1303[_0xcc0f('0x9d')]:undefined;var _0x39f2bd=_0x4d2427['map'](function(_0x48740a){return updateInteraction(_0x48740a,_0x508273,_0x5480e2,_0x8782a8);});return Promise[_0xcc0f('0x9e')](_0x39f2bd);});}function countFilteredInteractions(_0x5deb68,_0x18f117){var _0x1ce227=_0x5deb68[_0xcc0f('0x9f')]();_0x1ce227[_0xcc0f('0xa')](_0xcc0f('0xa0'));_0x1ce227[_0xcc0f('0xa')](_0xcc0f('0xa1'),'unreadMessages');var _0x31f506=utils['getSelectedTags'](_0x18f117);if(!_['isEmpty'](_0x31f506)){_0x1ce227[_0xcc0f('0xa2')](_0xcc0f('0xa3'),_0x31f506);}var _0x1cbb6c={'type':db[_0xcc0f('0xa4')][_0xcc0f('0x6f')]['SELECT'],'raw':!![]};return db[_0xcc0f('0x70')][_0xcc0f('0x71')](_0x1ce227[_0xcc0f('0x72')](),_0x1cbb6c);}module[_0xcc0f('0xa5')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x23fe=['find','buildExpression','type','text','start','value','end','unreadMessages','read','and','Contact','operator','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','tags','clause','ids','$substring','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','body','plainBody','keys','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','resolve','then','tag','filter','capitalize','chat','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','Interaction','Sequelize','QueryTypes','SELECT','query','toString','keyBy','merge','fields','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','openchannel','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','Setting','enableEmailPreview','clone','isEmpty','t.id\x20IN\x20?','exports','squel','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','u.id','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','fax','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','conditions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x23fe,0x6e));var _0xe23f=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x23fe[_0xaa0309];return _0x5de7ce;};'use strict';var _=require('lodash');var squel=require(_0xe23f('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0xe23f('0x1'));var updateInteraction=require(_0xe23f('0x2'))[_0xe23f('0x3')];var utils=require(_0xe23f('0x4'));var db=require(_0xe23f('0x5'))['db'];function skipInteractionsQuery(_0x369f91,_0x37aa4b,_0x53c339){var _0x54a9ef=![];var _0x18cf28=utils[_0xe23f('0x6')](_0x369f91);if(_0x37aa4b[_0xe23f('0x7')]===_0xe23f('0x8')&&!_0x53c339[_0xe23f('0x9')]&&!_0x53c339[_0x18cf28]){_0x54a9ef=!![];}return _0x54a9ef;}function getTagsQuery(){return squel[_0xe23f('0xa')]()[_0xe23f('0xb')]('id')[_0xe23f('0xb')](_0xe23f('0xc'))['field'](_0xe23f('0xd'))[_0xe23f('0xe')](_0xe23f('0xf'));}function getUsersQuery(_0x7819d6,_0x364cc7){var _0x431c4f=utils[_0xe23f('0x10')](_0x7819d6);var _0x1d3434=_0xe23f('0x11')+_0x7819d6+'_interactions';var _0x46cc74=squel[_0xe23f('0xa')]()['field'](_0xe23f('0x12'))[_0xe23f('0xb')]('u.fullname')[_0xe23f('0xb')](_0xe23f('0x13')+_0x431c4f)[_0xe23f('0xe')](_0x1d3434,'ui')[_0xe23f('0x14')](_0xe23f('0x15'),'u',_0xe23f('0x16'));if(_0x364cc7[_0xe23f('0x17')]>0x0){_0x46cc74[_0xe23f('0x18')](_0xe23f('0x13')+_0x431c4f+_0xe23f('0x19'),_[_0xe23f('0x1a')](_0x364cc7,'id'));}return _0x46cc74;}function getInteractionsQuery(_0x1fe36f){var _0x130452=utils[_0xe23f('0x1b')](_0x1fe36f);var _0x1d7b52=utils[_0xe23f('0x6')](_0x1fe36f);var _0x4fbb3b=utils[_0xe23f('0x10')](_0x1fe36f);return squel[_0xe23f('0xa')]()[_0xe23f('0xe')](_0x130452[_0xe23f('0x1c')],'i')[_0xe23f('0x14')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xe23f('0x15'),'o',_0xe23f('0x1d'))[_0xe23f('0x14')](_0x130452[_0xe23f('0x1e')],'a',_0xe23f('0x1f')+_0x1d7b52)[_0xe23f('0x14')](_0x130452[_0xe23f('0x20')],'me','me.'+_0x4fbb3b+_0xe23f('0x21'))[_0xe23f('0x14')](_0x130452[_0xe23f('0x22')],'it',_0xe23f('0x23')+_0x4fbb3b+_0xe23f('0x21'))[_0xe23f('0x14')]('tools_tags','t',_0xe23f('0x24'));}function getSqlClauses(){var _0x1d70c8={'body':squel[_0xe23f('0x25')](),'contact':squel[_0xe23f('0x25')](),'default':squel[_0xe23f('0x25')](),'fields':squel[_0xe23f('0x25')](),'filter':squel['expr'](),'read':squel[_0xe23f('0x25')](),'tags':{'clause':squel[_0xe23f('0x25')](),'ids':null},'user':squel['expr']()};return _0x1d70c8;}function parseTagParameter(_0x278dd8){var _0x122bf4=squel[_0xe23f('0x25')]();if(_0x278dd8){var _0x2dc213=utils[_0xe23f('0x26')](_0x278dd8);_0x2dc213[_0xe23f('0x27')](function(_0x5a0d08){_0x122bf4['or'](_0xe23f('0x28'),'%,'+_0x5a0d08+',%');});}return _0x122bf4;}function parseReadParameter(_0x3fe404){var _0x4115a6='';if(_0x3fe404){_0x4115a6='unreadMessages\x20{OPERATOR}\x200';if(_0x3fe404==='1'){_0x4115a6=_0x4115a6[_0xe23f('0x29')](_0xe23f('0x2a'),'=');}else{_0x4115a6=_0x4115a6[_0xe23f('0x29')](_0xe23f('0x2a'),'>');}}return _0x4115a6;}function parseSearchFilter(_0x2b58d8,_0x10402d){var _0x105733=squel[_0xe23f('0x25')]();if(_0x10402d){var _0x48814e=_0x10402d['replace']('\x5c','\x5c\x5c')[_0xe23f('0x29')](/'/g,'\x27\x27');var _0x47af61=qs[_0xe23f('0x2b')](_0x48814e);if(qs[_0xe23f('0x2c')](_0x48814e)){_0x105733['or'](_0xe23f('0x2d'),_0x47af61+'%');if([_0xe23f('0x2e'),_0xe23f('0x2f')][_0xe23f('0x30')](_0x2b58d8)){_0x105733['or']('i.phone\x20LIKE\x20?',_0x47af61+'%');}else if(_0x2b58d8===_0xe23f('0x31')){_0x105733['or']('i.fax\x20LIKE\x20?',_0x47af61+'%');}else if(_0x2b58d8==='openchannel'){_0x105733['or'](_0xe23f('0x32'),_0x47af61+'%');}}else if(_0x2b58d8===_0xe23f('0x33')&&qs[_0xe23f('0x34')](_0x48814e)){_0x105733['or'](_0xe23f('0x35'),_0x47af61+'%');}else{if(_0x2b58d8==='mail'){_0x105733['or'](_0xe23f('0x36'),qs[_0xe23f('0x37')](_0x48814e,!![]))['or'](_0xe23f('0x38'),qs[_0xe23f('0x37')](_0x48814e));}else if(_0x2b58d8!==_0xe23f('0x31')){_0x105733['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe23f('0x37')](_0x48814e));}_0x105733['or'](_0xe23f('0x39'),qs[_0xe23f('0x37')](_0x48814e,!![]),null);}}return _0x105733;}function parseAdvancedSearchFilter(_0x9af06d,_0x4b04da){var _0x2001e5=getSqlClauses();var _0x55b0b0=as[_0xe23f('0x3a')](_0x9af06d);var _0x1ad8a9=_0x55b0b0['sqlOperator'];for(var _0xce4c47=0x0;_0xce4c47<_0x55b0b0['conditions']['length'];_0xce4c47++){var _0x123d79=_0x55b0b0[_0xe23f('0x3b')][_0xce4c47];var _0x3641c7='i';var _0x5a7f9a=_[_0xe23f('0x3c')](_0x4b04da,[_0xe23f('0xc'),_0x123d79[_0xe23f('0xb')]]);if(_0x5a7f9a){var _0x179a96=as[_0xe23f('0x3d')](_0x3641c7,_0x5a7f9a[_0xe23f('0x3e')],_0x123d79);_0x2001e5['default'][_0x1ad8a9](_0x179a96[_0xe23f('0x3f')],_0x179a96['value'][_0xe23f('0x40')],_0x179a96[_0xe23f('0x41')][_0xe23f('0x42')]);}else{switch(_0x123d79[_0xe23f('0xb')]){case _0xe23f('0x43'):var _0x5d38af=parseReadParameter(_0x123d79[_0xe23f('0x41')]);_0x2001e5[_0xe23f('0x44')][_0xe23f('0x45')](_0x5d38af);break;case _0xe23f('0x46'):if(_0x123d79[_0xe23f('0x47')]==='$substring'){if(_0x123d79[_0xe23f('0x41')][_0xe23f('0x48')]('\x20')[_0xe23f('0x17')]>0x1){_0x2001e5['contact'][_0x1ad8a9]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x123d79[_0xe23f('0x41')],!![]),null);}else{var _0xcb6865='%'+_0x123d79[_0xe23f('0x41')]+'%';_0x2001e5[_0xe23f('0x49')][_0x1ad8a9](_0xe23f('0x4a'),_0xcb6865,_0xcb6865,_0xcb6865);}}else{_0x5a7f9a=_[_0xe23f('0x3c')](_0x4b04da,[_0xe23f('0xc'),_0xe23f('0x4b')]);_0x123d79[_0xe23f('0xb')]='ContactId';_0x179a96=as['buildExpression'](_0x3641c7,_0x5a7f9a[_0xe23f('0x3e')],_0x123d79);_0x2001e5['contact'][_0x1ad8a9](_0x179a96['text'],_0x179a96[_0xe23f('0x41')][_0xe23f('0x40')],_0x179a96[_0xe23f('0x41')][_0xe23f('0x42')]);}break;case'Tag':var _0x41201e=_0x123d79[_0xe23f('0x41')][_0xe23f('0x48')](',')['map'](function(_0x130980){return Number(_0x130980);});var _0x588381=parseTagParameter(_0x41201e);_0x2001e5[_0xe23f('0x4c')][_0xe23f('0x4d')][_0xe23f('0x45')](_0x588381);_0x2001e5[_0xe23f('0x4c')][_0xe23f('0x4e')]=_0x41201e;break;case'User':if(_0x123d79['operator']===_0xe23f('0x4f')){_0x2001e5[_0xe23f('0x50')][_0x1ad8a9](_0xe23f('0x51'),'%'+_0x123d79['value']+'%',null);}else{_0x5a7f9a=_[_0xe23f('0x3c')](_0x4b04da,['name',_0xe23f('0x52')]);_0x123d79[_0xe23f('0xb')]=_0xe23f('0x52');_0x179a96=as[_0xe23f('0x3d')](_0x3641c7,_0x5a7f9a[_0xe23f('0x3e')],_0x123d79);_0x2001e5[_0xe23f('0x50')][_0x1ad8a9](_0x179a96[_0xe23f('0x3f')],_0x179a96[_0xe23f('0x41')][_0xe23f('0x40')],_0x179a96[_0xe23f('0x41')][_0xe23f('0x42')]);}break;case _0xe23f('0x53'):case _0xe23f('0x54'):_0x179a96=as['buildExpression']('me',null,_0x123d79);_0x2001e5['body'][_0x1ad8a9](_0x179a96[_0xe23f('0x3f')],_0x179a96[_0xe23f('0x41')][_0xe23f('0x40')],_0x179a96[_0xe23f('0x41')][_0xe23f('0x42')]);break;}}}return _0x2001e5;}function parseModelFields(_0x2813b4,_0x2b5001,_0x2bf5d6){var _0x398e7b=utils[_0xe23f('0x6')](_0x2813b4);var _0x5a63ce=squel[_0xe23f('0x25')]();var _0x2e3e35=_(_0x2b5001)[_0xe23f('0x55')]()[_0xe23f('0x1a')](function(_0x5c6503){return _['some'](_0x2bf5d6,[_0xe23f('0xc'),_0x5c6503])?_0x5c6503:undefined;})[_0xe23f('0x56')]()[_0xe23f('0x41')]();if(_0x2e3e35[_0xe23f('0x17')]>0x0){_0x2e3e35[_0xe23f('0x27')](function(_0x49a228){if(_0x49a228===_0x398e7b){_0x5a63ce[_0xe23f('0x45')]('i.'+_0x398e7b+_0xe23f('0x19'),[][_0xe23f('0x57')](_0x2b5001[_0x49a228]));}else if(_0x49a228===_0xe23f('0x58')){var _0x444cb8=JSON[_0xe23f('0x59')](_0x2b5001[_0x49a228])[_0xe23f('0x5a')];var _0xb7533=JSON[_0xe23f('0x59')](_0x2b5001[_0x49a228])[_0xe23f('0x5b')];_0x5a63ce[_0xe23f('0x45')](_0xe23f('0x5c'),_0x444cb8,_0xb7533);}else{if(_0x2b5001[_0x49a228]===_0xe23f('0x5d')){_0x5a63ce[_0xe23f('0x45')]('i.'+_0x49a228+'\x20IS\x20NULL');}else{_0x5a63ce[_0xe23f('0x45')]('i.'+_0x49a228+_0xe23f('0x5e'),_0x2b5001[_0x49a228]);}}});}return _0x5a63ce;}function parseQueryParameters(_0x45f807,_0x2d6db6,_0x767db4){var _0x57a9cf=getSqlClauses();return Promise[_0xe23f('0x5f')]()[_0xe23f('0x60')](function(){return parseModelFields(_0x45f807,_0x2d6db6,_0x767db4);})[_0xe23f('0x60')](function(_0x59b56a){_0x57a9cf['fields'][_0xe23f('0x45')](_0x59b56a);return parseReadParameter(_0x2d6db6[_0xe23f('0x44')]);})[_0xe23f('0x60')](function(_0x138f84){_0x57a9cf[_0xe23f('0x44')]['and'](_0x138f84);return parseTagParameter(_0x2d6db6[_0xe23f('0x61')]);})[_0xe23f('0x60')](function(_0x3ee8a4){_0x57a9cf[_0xe23f('0x4c')][_0xe23f('0x4d')]['and'](_0x3ee8a4);return parseSearchFilter(_0x45f807,_0x2d6db6['filter']);})[_0xe23f('0x60')](function(_0x4af006){_0x57a9cf[_0xe23f('0x62')]=_0x4af006;return _0x57a9cf;});}function checkAccountsRestrictions(_0x26f870,_0x299a43,_0x2b19fc){var _0x52a258=utils['getAccountFK'](_0x26f870);var _0x5d2a10='get'+_[_0xe23f('0x63')](_0x26f870)+(_0x26f870===_0xe23f('0x64')?'Websites':'Accounts');var _0x258db9=squel[_0xe23f('0x25')]();return Promise[_0xe23f('0x5f')]()[_0xe23f('0x60')](function(){if(_0x2b19fc[_0xe23f('0x9')]&&_0x299a43[_0xe23f('0x7')]==='agent'){return _0x299a43[_0x5d2a10]({'attributes':['id'],'raw':!![]});}})[_0xe23f('0x60')](function(_0x23f584){if(_0x23f584){if(_0x23f584['length']===0x0){_0x258db9[_0xe23f('0x45')]('i.'+_0x52a258+_0xe23f('0x65'));}else{_0x258db9[_0xe23f('0x45')]('i.'+_0x52a258+'\x20IN\x20?',_[_0xe23f('0x1a')](_0x23f584,'id'));}}else if(!_0x2b19fc[_0x52a258]){_0x258db9['and']('i.'+_0x52a258+_0xe23f('0x66'));}})['then'](function(){return _0x258db9;});}function getClosedOrderClause(_0x5b054d,_0x2f993f){var _0x1d9ce6='';var _0x409f9b=[_0xe23f('0x67'),_0xe23f('0x68'),_0xe23f('0x69')];if(_0x5b054d===_0xe23f('0x33')){_0x409f9b[_0xe23f('0x6a')](_0xe23f('0x6b'));}if(_0x2f993f[_0xe23f('0x6c')]==='0'&&_0x5b054d===_0xe23f('0x33')){_0x1d9ce6=_0xe23f('0x6b');}else{if(_0x2f993f['closed']==='1'){_0x409f9b[_0xe23f('0x6d')]();}_0x1d9ce6=_0xe23f('0x6e')+_0x409f9b['join'](',\x20')+')';}return _0x1d9ce6;}function getFilteredInteractions(_0x52f8c3,_0x3ff121,_0x33ed9c,_0x278636){var _0x9e53c5=utils[_0xe23f('0x10')](_0x52f8c3);var _0x14653a=_[_0xe23f('0x63')](_0x52f8c3)+_0xe23f('0x6f');var _0xf3d48=[];var _0x5e383e=getTagsQuery();var _0x3d2175={'type':db[_0xe23f('0x70')][_0xe23f('0x71')][_0xe23f('0x72')],'raw':!![]};var _0x74ee7d=[];var _0x4699a8=[];return db['sequelize'][_0xe23f('0x73')](_0x5e383e[_0xe23f('0x74')](),_0x3d2175)['then'](function(_0x22f94a){_0xf3d48=_[_0xe23f('0x75')](_0x22f94a,'id');_0x3d2175=_[_0xe23f('0x76')](_0x3d2175,{'model':db[_0x14653a],'mapToModel':!![],'nest':!![]});if(_0x33ed9c[_0xe23f('0x77')]){_0x278636[_0xe23f('0x78')][_0xe23f('0x27')](function(_0x564599){_0x3ff121[_0xe23f('0xb')]('i.'+_0x564599);});}else{_0x3ff121[_0xe23f('0xb')](_0xe23f('0x79'),_0xe23f('0x43'));_0x3ff121['field'](_0xe23f('0x7a'),'Account.key');_0x3ff121['field'](_0xe23f('0x7b'),_0xe23f('0x7c'));if(_0x52f8c3===_0xe23f('0x33')){_0x3ff121[_0xe23f('0xb')](_0xe23f('0x7d'),_0xe23f('0x7e'));_0x3ff121[_0xe23f('0xb')](_0xe23f('0x7f'),_0xe23f('0x80'));_0x3ff121[_0xe23f('0xb')](_0xe23f('0x81'));_0x3ff121[_0xe23f('0xb')](_0xe23f('0x82'));_0x3ff121[_0xe23f('0xb')](_0xe23f('0x83'));_0x3ff121['field']('i.closed');_0x3ff121[_0xe23f('0xb')](_0xe23f('0x84'));_0x3ff121['field'](_0xe23f('0x85'));_0x3ff121['field'](_0xe23f('0x86'));_0x3ff121['field'](_0xe23f('0x87'));_0x3ff121['field'](_0xe23f('0x88'));_0x3ff121[_0xe23f('0xb')](_0xe23f('0x69'));_0x3ff121[_0xe23f('0xb')](_0xe23f('0x68'));_0x3ff121[_0xe23f('0xb')](_0xe23f('0x67'));_0x3ff121[_0xe23f('0xb')](_0xe23f('0x6b'));_0x3ff121[_0xe23f('0xb')](_0xe23f('0x89'));_0x3ff121[_0xe23f('0xb')](_0xe23f('0x8a'));_0x3ff121['field'](_0xe23f('0x8b'));_0x3ff121['field'](_0xe23f('0x8c'));}else if(_0x52f8c3===_0xe23f('0x8d')){_0x3ff121[_0xe23f('0xb')](_0xe23f('0x8e'),_0xe23f('0x80'));}else{_0x3ff121['field'](_0xe23f('0x8f'),_0xe23f('0x80'));}if(_0x52f8c3!==_0xe23f('0x33')){_0x3ff121[_0xe23f('0xb')](_0xe23f('0x90'));}_0x3ff121[_0xe23f('0xb')](_0xe23f('0x91'),_0xe23f('0x92'));_0x3ff121['field'](_0xe23f('0x93'),_0xe23f('0x94'));_0x3ff121['field'](_0xe23f('0x95'),_0xe23f('0x96'));_0x3ff121[_0xe23f('0xb')](_0xe23f('0x97'),_0xe23f('0x98'));_0x3ff121[_0xe23f('0xb')]('c.mobile',_0xe23f('0x99'));_0x3ff121['field'](_0xe23f('0x9a'),_0xe23f('0x9b'));_0x3ff121[_0xe23f('0xb')](_0xe23f('0x9c'),_0xe23f('0x9d'));_0x3ff121['field']('o.internal',_0xe23f('0x9e'));_0x3ff121[_0xe23f('0xb')](_0xe23f('0x9f'),_0xe23f('0xa0'));}if(_0x278636[_0xe23f('0xa1')]){_0x3ff121['limit'](_0x278636[_0xe23f('0xa1')]);}if(_0x278636[_0xe23f('0xa2')]){_0x3ff121[_0xe23f('0xa2')](_0x278636['offset']);}return db['sequelize'][_0xe23f('0x73')](_0x3ff121['toString'](),_0x3d2175);})[_0xe23f('0x60')](function(_0x292669){_0x74ee7d=_0x292669;var _0x53ea87=getUsersQuery(_0x52f8c3,_0x74ee7d);return db[_0xe23f('0xa3')][_0xe23f('0x73')](_0x53ea87['toString'](),_0x3d2175);})[_0xe23f('0x60')](function(_0x1990da){_0x4699a8=_['groupBy'](_0x1990da,_0x9e53c5);if(_0x52f8c3===_0xe23f('0x33')){return db[_0xe23f('0xa4')]['findOne']({'attributes':[_0xe23f('0xa5')],'raw':!![]});}})['then'](function(_0x66ad22){var _0x3e6d71=_0x66ad22?_0x66ad22[_0xe23f('0xa5')]:undefined;var _0x304000=_0x74ee7d[_0xe23f('0x1a')](function(_0xb9f721){return updateInteraction(_0xb9f721,_0xf3d48,_0x4699a8,_0x3e6d71);});return Promise['all'](_0x304000);});}function countFilteredInteractions(_0x1bf496,_0x17dbd7){var _0x4e487d=_0x1bf496[_0xe23f('0xa6')]();_0x4e487d['field']('COUNT(*)');_0x4e487d[_0xe23f('0xb')](_0xe23f('0x79'),_0xe23f('0x43'));var _0x582a4d=utils[_0xe23f('0x26')](_0x17dbd7);if(!_[_0xe23f('0xa7')](_0x582a4d)){_0x4e487d['where'](_0xe23f('0xa8'),_0x582a4d);}var _0xc41d9b={'type':db[_0xe23f('0x70')][_0xe23f('0x71')]['SELECT'],'raw':!![]};return db['sequelize'][_0xe23f('0x73')](_0x4e487d[_0xe23f('0x74')](),_0xc41d9b);}module[_0xe23f('0xa9')]={'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 ac36f55..e57c379 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 _0x6cdb=['then','trimStart','catch','updateInteraction','Users','Tags','TagIds','../../mysqldb','map','fullname','split','forEach','push','waiting','talking','answered','abandoned','total','UserId','disposition','unmanaged','MailMessage','findOne','out','plainBody'];(function(_0x4dc81e,_0x298e86){var _0x27c666=function(_0x121e05){while(--_0x121e05){_0x4dc81e['push'](_0x4dc81e['shift']());}};_0x27c666(++_0x298e86);}(_0x6cdb,0x1e2));var _0xb6cd=function(_0x190123,_0x174d69){_0x190123=_0x190123-0x0;var _0x218430=_0x6cdb[_0x190123];return _0x218430;};'use strict';var _=require('lodash');var db=require(_0xb6cd('0x0'))['db'];function getInteractionUsers(_0x2c5a8d,_0x5203d3){return new Promise(function(_0x4a013d,_0x1a43c0){try{var _0x4cbfa6=[];if(_0x5203d3[_0x2c5a8d]){_0x4cbfa6=_0x5203d3[_0x2c5a8d][_0xb6cd('0x1')](function(_0x518b3f){return{'id':_0x518b3f['id'],'fullname':_0x518b3f[_0xb6cd('0x2')]};});}return _0x4a013d(_0x4cbfa6);}catch(_0x57f8e9){_0x1a43c0(_0x57f8e9);}});}function getInteractionTags(_0x20eaa9,_0x33f6bb){var _0x14ccd9=[];if(_0x20eaa9){_0x20eaa9[_0xb6cd('0x3')](',')[_0xb6cd('0x4')](function(_0x3cc08f){_0x14ccd9[_0xb6cd('0x5')](_0x33f6bb[_0x3cc08f]);});}return _0x14ccd9;}function updateWaitingCounter(_0x4874c3){if(_0x4874c3[_0xb6cd('0x6')]){_0x4874c3[_0xb6cd('0x6')]-=0x1;}}function updateInteractionCounters(_0x5c39e0){_0x5c39e0[_0xb6cd('0x6')]=0x0;_0x5c39e0[_0xb6cd('0x7')]=0x0;_0x5c39e0[_0xb6cd('0x8')]=0x0;_0x5c39e0['unmanaged']=0x0;_0x5c39e0[_0xb6cd('0x9')]=0x0;_0x5c39e0[_0xb6cd('0xa')]=0x0;if(_0x5c39e0['closed']){if(_0x5c39e0['disposition']==='abandoned'){_0x5c39e0[_0xb6cd('0x9')]+=0x1;updateWaitingCounter(_0x5c39e0);}if(_0x5c39e0[_0xb6cd('0xb')]){_0x5c39e0[_0xb6cd('0x8')]+=0x1;if(_0x5c39e0[_0xb6cd('0x7')]){_0x5c39e0['talking']-=0x1;}}else{if(_0x5c39e0[_0xb6cd('0xc')]){_0x5c39e0[_0xb6cd('0xd')]+=0x1;updateWaitingCounter(_0x5c39e0);}}}else{if(!_0x5c39e0[_0xb6cd('0xb')]){_0x5c39e0[_0xb6cd('0x6')]+=0x1;}if(_0x5c39e0[_0xb6cd('0xb')]){_0x5c39e0['talking']+=0x1;updateWaitingCounter(_0x5c39e0);}}_0x5c39e0[_0xb6cd('0xa')]+=0x1;return _0x5c39e0;}function getLastMessageText(_0x2e4453){return db[_0xb6cd('0xe')][_0xb6cd('0xf')]({'where':{'$and':[{'MailInteractionId':_0x2e4453['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xb6cd('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xb6cd('0x11')],'order':'-id','raw':!![]})[_0xb6cd('0x12')](function(_0x5e6d67){if(_0x5e6d67&&_0x5e6d67[_0xb6cd('0x11')]){_0x2e4453['lastMsgText']=_[_0xb6cd('0x13')](_0x5e6d67[_0xb6cd('0x11')]);}return _0x2e4453;})[_0xb6cd('0x14')](function(_0x4f02e8){throw _0x4f02e8;});}exports[_0xb6cd('0x15')]=function(_0x412cca,_0x401b11,_0x32383a,_0x4d666b){return new Promise(function(_0x4bfe2a,_0x160671){return getInteractionUsers(_0x412cca['id'],_0x32383a)['then'](function(_0x34b386){_0x412cca[_0xb6cd('0x16')]=_0x34b386;return getInteractionTags(_0x412cca['TagIds'],_0x401b11);})[_0xb6cd('0x12')](function(_0x424525){_0x412cca[_0xb6cd('0x17')]=_0x424525;delete _0x412cca[_0xb6cd('0x18')];return updateInteractionCounters(_0x412cca);})[_0xb6cd('0x12')](function(_0x26e5b1){if(_0x4d666b){return getLastMessageText(_0x26e5b1);}else{return _0x26e5b1;}})[_0xb6cd('0x12')](function(_0xc06dd2){_0x4bfe2a(_0xc06dd2);})[_0xb6cd('0x14')](function(_0x3b25ac){_0x160671(_0x3b25ac);});});}; \ No newline at end of file +var _0x0d88=['trimStart','catch','updateInteraction','Users','TagIds','Tags','lodash','fullname','split','forEach','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','findOne','out','plainBody','then'];(function(_0xec625b,_0x31d6f9){var _0x58c103=function(_0x476793){while(--_0x476793){_0xec625b['push'](_0xec625b['shift']());}};_0x58c103(++_0x31d6f9);}(_0x0d88,0x10e));var _0x80d8=function(_0x18734b,_0x7f1b4f){_0x18734b=_0x18734b-0x0;var _0x4eef52=_0x0d88[_0x18734b];return _0x4eef52;};'use strict';var _=require(_0x80d8('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x4eb01a,_0x14c9ff){return new Promise(function(_0x5562c7,_0x32bc27){try{var _0x2e6f2a=[];if(_0x14c9ff[_0x4eb01a]){_0x2e6f2a=_0x14c9ff[_0x4eb01a]['map'](function(_0x5822eb){return{'id':_0x5822eb['id'],'fullname':_0x5822eb[_0x80d8('0x1')]};});}return _0x5562c7(_0x2e6f2a);}catch(_0x4c5c36){_0x32bc27(_0x4c5c36);}});}function getInteractionTags(_0x1688ba,_0x2efd51){var _0x4b40a7=[];if(_0x1688ba){_0x1688ba[_0x80d8('0x2')](',')[_0x80d8('0x3')](function(_0x1b52aa){_0x4b40a7['push'](_0x2efd51[_0x1b52aa]);});}return _0x4b40a7;}function updateWaitingCounter(_0x1b2e4c){if(_0x1b2e4c[_0x80d8('0x4')]){_0x1b2e4c['waiting']-=0x1;}}function updateInteractionCounters(_0xe5f492){_0xe5f492['waiting']=0x0;_0xe5f492[_0x80d8('0x5')]=0x0;_0xe5f492[_0x80d8('0x6')]=0x0;_0xe5f492[_0x80d8('0x7')]=0x0;_0xe5f492[_0x80d8('0x8')]=0x0;_0xe5f492[_0x80d8('0x9')]=0x0;if(_0xe5f492[_0x80d8('0xa')]){if(_0xe5f492[_0x80d8('0xb')]==='abandoned'){_0xe5f492[_0x80d8('0x8')]+=0x1;updateWaitingCounter(_0xe5f492);}if(_0xe5f492[_0x80d8('0xc')]){_0xe5f492[_0x80d8('0x6')]+=0x1;if(_0xe5f492[_0x80d8('0x5')]){_0xe5f492[_0x80d8('0x5')]-=0x1;}}else{if(_0xe5f492[_0x80d8('0xb')]){_0xe5f492[_0x80d8('0x7')]+=0x1;updateWaitingCounter(_0xe5f492);}}}else{if(!_0xe5f492[_0x80d8('0xc')]){_0xe5f492[_0x80d8('0x4')]+=0x1;}if(_0xe5f492[_0x80d8('0xc')]){_0xe5f492[_0x80d8('0x5')]+=0x1;updateWaitingCounter(_0xe5f492);}}_0xe5f492[_0x80d8('0x9')]+=0x1;return _0xe5f492;}function getLastMessageText(_0x5131ee){return db[_0x80d8('0xd')][_0x80d8('0xe')]({'where':{'$and':[{'MailInteractionId':_0x5131ee['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x80d8('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x80d8('0x10')],'order':'-id','raw':!![]})[_0x80d8('0x11')](function(_0x64445e){if(_0x64445e&&_0x64445e[_0x80d8('0x10')]){_0x5131ee['lastMsgText']=_[_0x80d8('0x12')](_0x64445e[_0x80d8('0x10')]);}return _0x5131ee;})[_0x80d8('0x13')](function(_0x16ed28){throw _0x16ed28;});}exports[_0x80d8('0x14')]=function(_0x10e7ad,_0x3d687e,_0x3b0504,_0x4b6963){return new Promise(function(_0x349557,_0x479895){return getInteractionUsers(_0x10e7ad['id'],_0x3b0504)['then'](function(_0x199386){_0x10e7ad[_0x80d8('0x15')]=_0x199386;return getInteractionTags(_0x10e7ad[_0x80d8('0x16')],_0x3d687e);})[_0x80d8('0x11')](function(_0x241f19){_0x10e7ad[_0x80d8('0x17')]=_0x241f19;delete _0x10e7ad[_0x80d8('0x16')];return updateInteractionCounters(_0x10e7ad);})[_0x80d8('0x11')](function(_0x2a7b9a){if(_0x4b6963){return getLastMessageText(_0x2a7b9a);}else{return _0x2a7b9a;}})[_0x80d8('0x11')](function(_0x58282c){_0x349557(_0x58282c);})[_0x80d8('0x13')](function(_0x6a5833){_0x479895(_0x6a5833);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index b17822f..8b8c27d 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 _0xe350=['openchannel-interactions','mail-interactions','chat-interactions','whatsapp-interactions','chat','capitalize','InteractionId','upperFirst','unknown','accounts','_interactions','_interaction_has_tags','_messages','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','findOne','then','update','info','catch','exports','lodash','../../config/logger'];(function(_0x347471,_0x1c9a02){var _0x422b6a=function(_0x2b6f88){while(--_0x2b6f88){_0x347471['push'](_0x347471['shift']());}};_0x422b6a(++_0x1c9a02);}(_0xe350,0x72));var _0x0e35=function(_0x8023ac,_0x382702){_0x8023ac=_0x8023ac-0x0;var _0x2d89d1=_0xe350[_0x8023ac];return _0x2d89d1;};'use strict';var _=require(_0x0e35('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x0e35('0x1'))(_0x0e35('0x2')),'mail':require(_0x0e35('0x1'))(_0x0e35('0x3')),'fax':require(_0x0e35('0x1'))('fax-interactions'),'sms':require(_0x0e35('0x1'))('sms-interactions'),'chat':require(_0x0e35('0x1'))(_0x0e35('0x4')),'whatsapp':require('../../config/logger')(_0x0e35('0x5'))};function getAccountFK(_0x1dac17){return _['capitalize'](_0x1dac17)+(_0x1dac17===_0x0e35('0x6')?'Website':'Account')+'Id';}function getInteractionFK(_0x312601){return _[_0x0e35('0x7')](_0x312601)+_0x0e35('0x8');}function getInteractionId(_0x295cdb,_0x3c5695,_0x76ca0b){if(_0x295cdb&&_0x295cdb[_[_0x0e35('0x9')](_0x76ca0b)+'InteractionId']){return _0x295cdb[_['upperFirst'](_0x76ca0b)+'InteractionId'];}else if(_0x295cdb&&_0x295cdb['id']){return _0x295cdb['id'];}else if(_0x3c5695&&_0x3c5695['id']){return _0x3c5695['id'];}else{return _0x0e35('0xa');}}function getInteractionsTables(_0x3aad2f){return{'accounts':_0x3aad2f+'_'+(_0x3aad2f===_0x0e35('0x6')?'websites':_0x0e35('0xb')),'interactions':_0x3aad2f+_0x0e35('0xc'),'interactionsTags':_0x3aad2f+_0x0e35('0xd'),'messages':_0x3aad2f+_0x0e35('0xe'),'userInteractions':_0x0e35('0xf')+_0x3aad2f+'_interactions'};}function getSelectedTags(_0x9e094a){var _0x371999=[];if(_0x9e094a){_0x371999=Array['isArray'](_0x9e094a)?_0x9e094a:[_0x9e094a];}return _0x371999;}function log(_0x3d442a,_0x5d8396,_0x3e7c3f,_0x2c6b5e,_0x51a359,_0xb6546a){loggers[_0x51a359[_0x0e35('0x10')]()][_0x3d442a](_0x0e35('0x11'),_0xb6546a[_0x0e35('0x12')](),_0x5d8396?_0x5d8396['id']:null,_0x5d8396?_0x5d8396[_0x0e35('0x13')]:null,_0x5d8396?_0x5d8396[_0x0e35('0x14')]:null,getInteractionId(_0x3e7c3f,_0x2c6b5e,_0x51a359),_0x3e7c3f?JSON[_0x0e35('0x15')](_0x3e7c3f):_0x0e35('0x16'));}function updateUser(_0x1c3b42,_0x227265,_0x89f89d,_0x3bea85,_0x2d29f9){db[_['upperFirst'](_0x3bea85)+'Interaction'][_0x0e35('0x17')]({'where':{'id':getInteractionId(_0x227265,_0x89f89d,_0x3bea85)}})[_0x0e35('0x18')](function(_0x26ebe){if(_0x26ebe){return _0x26ebe[_0x0e35('0x19')]({'UserId':_0x1c3b42?_0x1c3b42['id']:null});}})[_0x0e35('0x18')](function(_0x6256ae){if(_0x6256ae){log(_0x0e35('0x1a'),_0x1c3b42,_0x227265,_0x89f89d,_0x3bea85,_0x2d29f9);}})[_0x0e35('0x1b')](function(){log('error',_0x1c3b42,_0x227265,_0x89f89d,_0x3bea85,_0x2d29f9);});}module[_0x0e35('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xc439=['websites','accounts','_interactions','_messages','isArray','toLowerCase','toUpperCase','role','stringify','null','Interaction','findOne','then','update','catch','error','exports','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','whatsapp-interactions','capitalize','chat','Account','InteractionId','upperFirst'];(function(_0x55a89e,_0x1a05ab){var _0x3aa2bd=function(_0x4b9d09){while(--_0x4b9d09){_0x55a89e['push'](_0x55a89e['shift']());}};_0x3aa2bd(++_0x1a05ab);}(_0xc439,0x129));var _0x9c43=function(_0x3dfadf,_0x3601ec){_0x3dfadf=_0x3dfadf-0x0;var _0x164874=_0xc439[_0x3dfadf];return _0x164874;};'use strict';var _=require(_0x9c43('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x9c43('0x1'))(_0x9c43('0x2')),'mail':require(_0x9c43('0x1'))(_0x9c43('0x3')),'fax':require(_0x9c43('0x1'))(_0x9c43('0x4')),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0x9c43('0x1'))('chat-interactions'),'whatsapp':require(_0x9c43('0x1'))(_0x9c43('0x5'))};function getAccountFK(_0x538cf5){return _[_0x9c43('0x6')](_0x538cf5)+(_0x538cf5===_0x9c43('0x7')?'Website':_0x9c43('0x8'))+'Id';}function getInteractionFK(_0x11c0e3){return _[_0x9c43('0x6')](_0x11c0e3)+_0x9c43('0x9');}function getInteractionId(_0x39c1dd,_0x4946d0,_0x370014){if(_0x39c1dd&&_0x39c1dd[_[_0x9c43('0xa')](_0x370014)+_0x9c43('0x9')]){return _0x39c1dd[_['upperFirst'](_0x370014)+'InteractionId'];}else if(_0x39c1dd&&_0x39c1dd['id']){return _0x39c1dd['id'];}else if(_0x4946d0&&_0x4946d0['id']){return _0x4946d0['id'];}else{return'unknown';}}function getInteractionsTables(_0x40d5f1){return{'accounts':_0x40d5f1+'_'+(_0x40d5f1===_0x9c43('0x7')?_0x9c43('0xb'):_0x9c43('0xc')),'interactions':_0x40d5f1+_0x9c43('0xd'),'interactionsTags':_0x40d5f1+'_interaction_has_tags','messages':_0x40d5f1+_0x9c43('0xe'),'userInteractions':'user_has_'+_0x40d5f1+'_interactions'};}function getSelectedTags(_0x29ac8c){var _0x44eed2=[];if(_0x29ac8c){_0x44eed2=Array[_0x9c43('0xf')](_0x29ac8c)?_0x29ac8c:[_0x29ac8c];}return _0x44eed2;}function log(_0x4358a9,_0x209fe1,_0x3478ea,_0x1545da,_0x413427,_0x327617){loggers[_0x413427[_0x9c43('0x10')]()][_0x4358a9]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x327617[_0x9c43('0x11')](),_0x209fe1?_0x209fe1['id']:null,_0x209fe1?_0x209fe1['name']:null,_0x209fe1?_0x209fe1[_0x9c43('0x12')]:null,getInteractionId(_0x3478ea,_0x1545da,_0x413427),_0x3478ea?JSON[_0x9c43('0x13')](_0x3478ea):_0x9c43('0x14'));}function updateUser(_0x18f0c6,_0x479c49,_0x12ae6e,_0x1cc232,_0x28c45a){db[_[_0x9c43('0xa')](_0x1cc232)+_0x9c43('0x15')][_0x9c43('0x16')]({'where':{'id':getInteractionId(_0x479c49,_0x12ae6e,_0x1cc232)}})[_0x9c43('0x17')](function(_0x46ade5){if(_0x46ade5){return _0x46ade5[_0x9c43('0x18')]({'UserId':_0x18f0c6?_0x18f0c6['id']:null});}})[_0x9c43('0x17')](function(_0x2ae1b0){if(_0x2ae1b0){log('info',_0x18f0c6,_0x479c49,_0x12ae6e,_0x1cc232,_0x28c45a);}})[_0x9c43('0x19')](function(){log(_0x9c43('0x1a'),_0x18f0c6,_0x479c49,_0x12ae6e,_0x1cc232,_0x28c45a);});}module[_0x9c43('0x1b')]={'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 e458434..62038fe 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 _0x7ac7=['createDecipher','aes-256-ctr','format','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','catch','users','User','admin','user','isUserLimit','crypto','composable-middleware','../../mysqldb','../../config/environment','license','data1'];(function(_0x509a4b,_0x579da4){var _0xef3d31=function(_0x10789e){while(--_0x10789e){_0x509a4b['push'](_0x509a4b['shift']());}};_0xef3d31(++_0x579da4);}(_0x7ac7,0xf6));var _0x77ac=function(_0x4f13b6,_0x416d12){_0x4f13b6=_0x4f13b6-0x0;var _0x6fce57=_0x7ac7[_0x4f13b6];return _0x6fce57;};'use strict';var crypto=require(_0x77ac('0x0'));var util=require('util');var compose=require(_0x77ac('0x1'));var db=require(_0x77ac('0x2'))['db'];var config=require(_0x77ac('0x3'));function getValueFromLicense(_0x548270,_0xf43f2){if(_0x548270&&_0xf43f2){if(_0xf43f2['data1']&&_0xf43f2[_0x77ac('0x4')]){var _0x4f6b63=_0xf43f2[_0x77ac('0x5')];var _0x42969f=_0xf43f2['license'];var _0x4f5ef1=_0x4f6b63['split']('-')[0x4];var _0x555dbc=_0x4f6b63['split']('-')[0x0];var _0x3adc69=crypto[_0x77ac('0x6')](_0x77ac('0x7'),util[_0x77ac('0x8')]('%s:%s:%s',_0x4f5ef1,_0x4f6b63,_0x555dbc));var _0x169cf8=_0x3adc69[_0x77ac('0x9')](_0x42969f,_0x77ac('0xa'),_0x77ac('0xb'));_0x169cf8+=_0x3adc69[_0x77ac('0xc')](_0x77ac('0xb'));var _0x1c506b=JSON[_0x77ac('0xd')](_0x169cf8);return _0x1c506b[_0x77ac('0xe')](_0x548270)?_0x1c506b[_0x548270]:null;}}return null;}function isLimit(_0x2f4720,_0x552aab,_0xb4f695,_0x26ed56){var _0x5e8ff8=_0x552aab;return compose()[_0x77ac('0xf')](function(_0x5c96e5,_0x26bb8d,_0x5afc88){return db[_0x77ac('0x10')][_0x77ac('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x77ac('0x12')](function(_0x13d945){var _0x5aa0a2=getValueFromLicense(_0x2f4720,_0x13d945);return _0x5aa0a2?_0x5aa0a2:_0x5e8ff8;})[_0x77ac('0x12')](function(_0x198f7b){_0x5e8ff8=_0x198f7b;return _0xb4f695[_0x77ac('0x13')](_0x26ed56);})['then'](function(_0x3d8751){if(_0x3d8751>=_0x5e8ff8){return _0x26bb8d[_0x77ac('0x14')](0x193)[_0x77ac('0x15')]({'message':util[_0x77ac('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x2f4720)});}_0x5afc88();})[_0x77ac('0x16')](function(_0x48bf2f){_0x5afc88(_0x48bf2f);});});}function isUserLimit(){return isLimit(_0x77ac('0x17'),0x1,db[_0x77ac('0x18')],{'where':{'$or':[{'role':_0x77ac('0x19')},{'role':_0x77ac('0x1a')}]}});}exports[_0x77ac('0x1b')]=isUserLimit; \ No newline at end of file +var _0xaed7=['utf8','final','parse','hasOwnProperty','use','License','findOne','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','update'];(function(_0x576a48,_0x516ad4){var _0x367f6d=function(_0xe9040b){while(--_0xe9040b){_0x576a48['push'](_0x576a48['shift']());}};_0x367f6d(++_0x516ad4);}(_0xaed7,0xf1));var _0x7aed=function(_0x2ce56b,_0x4624b0){_0x2ce56b=_0x2ce56b-0x0;var _0x1ccb68=_0xaed7[_0x2ce56b];return _0x1ccb68;};'use strict';var crypto=require(_0x7aed('0x0'));var util=require(_0x7aed('0x1'));var compose=require(_0x7aed('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x7aed('0x3'));function getValueFromLicense(_0x29a7f7,_0x1ede5e){if(_0x29a7f7&&_0x1ede5e){if(_0x1ede5e[_0x7aed('0x4')]&&_0x1ede5e[_0x7aed('0x5')]){var _0x5424b3=_0x1ede5e['data1'];var _0xb07685=_0x1ede5e['license'];var _0x3e6d6a=_0x5424b3[_0x7aed('0x6')]('-')[0x4];var _0x3294ab=_0x5424b3[_0x7aed('0x6')]('-')[0x0];var _0x528aa5=crypto[_0x7aed('0x7')](_0x7aed('0x8'),util[_0x7aed('0x9')]('%s:%s:%s',_0x3e6d6a,_0x5424b3,_0x3294ab));var _0x5c023f=_0x528aa5[_0x7aed('0xa')](_0xb07685,'base64',_0x7aed('0xb'));_0x5c023f+=_0x528aa5[_0x7aed('0xc')]('utf8');var _0x4defbe=JSON[_0x7aed('0xd')](_0x5c023f);return _0x4defbe[_0x7aed('0xe')](_0x29a7f7)?_0x4defbe[_0x29a7f7]:null;}}return null;}function isLimit(_0x13eac4,_0x3c973d,_0x18b872,_0x420d46){var _0x6f6d0a=_0x3c973d;return compose()[_0x7aed('0xf')](function(_0x2f384a,_0x413f11,_0x209869){return db[_0x7aed('0x10')][_0x7aed('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x4ca4cc){var _0x5b1507=getValueFromLicense(_0x13eac4,_0x4ca4cc);return _0x5b1507?_0x5b1507:_0x6f6d0a;})['then'](function(_0x250ebb){_0x6f6d0a=_0x250ebb;return _0x18b872[_0x7aed('0x12')](_0x420d46);})['then'](function(_0x4e753a){if(_0x4e753a>=_0x6f6d0a){return _0x413f11[_0x7aed('0x13')](0x193)[_0x7aed('0x14')]({'message':util[_0x7aed('0x9')](_0x7aed('0x15'),_0x13eac4)});}_0x209869();})[_0x7aed('0x16')](function(_0x3e6f18){_0x209869(_0x3e6f18);});});}function isUserLimit(){return isLimit(_0x7aed('0x17'),0x1,db[_0x7aed('0x18')],{'where':{'$or':[{'role':_0x7aed('0x19')},{'role':_0x7aed('0x1a')}]}});}exports[_0x7aed('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 8cc4734..b3f3f65 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 _0x9038=['buildExpression','DATE','operator','$eq','$between','value','$gt','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','$notIn','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','utcOffset','hours','minutes','add','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','length','slice','forEach','shift','match','filter','map','push'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x9038,0x110));var _0x8903=function(_0x4dc903,_0x20fd9c){_0x4dc903=_0x4dc903-0x0;var _0x1212bc=_0x9038[_0x4dc903];return _0x1212bc;};'use strict';var _=require(_0x8903('0x0'));var moment=require(_0x8903('0x1'));exports[_0x8903('0x2')]=function(_0x280479){var _0x461fa5={'conditions':[]};_0x461fa5[_0x8903('0x3')]=_[_0x8903('0x4')](_0x280479,_0x8903('0x5'))?'or':_0x8903('0x6');var _0x453200=_0x280479['replace'](_0x8903('0x7'),'')[_0x8903('0x8')](_0x8903('0x5'),'')[_0x8903('0x9')]('||');for(var _0x5b220a=0x0;_0x5b220a<_0x453200[_0x8903('0xa')];_0x5b220a++){var _0x5fb019=_0x453200[_0x5b220a][_0x8903('0x9')](':=');var _0x2ea090=_0x5fb019[0x0];var _0x222788=_0x5fb019[_0x8903('0xb')](0x1);_0x222788[_0x8903('0xc')](function(_0x318794){var _0x521c8f=_0x318794['split']('[')[_0x8903('0xd')]();var _0x1cf964=_0x318794[_0x8903('0xe')](/\[(.*?)\]/g);_0x1cf964[_0x8903('0xc')](function(_0x5c6d63){var _0x422a48=_0x5c6d63[_0x8903('0x9')]('[')[_0x8903('0xf')](function(_0x5b9252){return _0x5b9252['indexOf'](']')>-0x1;})[_0x8903('0x10')](function(_0x19ee19){return _0x19ee19[_0x8903('0x9')](']')[0x0];})[0x0];_0x461fa5['conditions'][_0x8903('0x11')]({'field':_0x2ea090,'operator':_0x521c8f,'value':_0x422a48});});});}return _0x461fa5;};exports[_0x8903('0x12')]=function(_0x242675,_0x5d140d,_0x43e495){var _0x498613={};if(_0x5d140d===_0x8903('0x13')){if(_0x43e495[_0x8903('0x14')]===_0x8903('0x15')){_0x43e495[_0x8903('0x14')]=_0x8903('0x16');_0x43e495['value']+=','+_0x43e495[_0x8903('0x17')];}else if(_['includes']([_0x8903('0x18'),_0x8903('0x19')],_0x43e495[_0x8903('0x14')])){_0x43e495['value']=moment(_0x43e495[_0x8903('0x17')])['add'](0x1,_0x8903('0x1a'))[_0x8903('0x1b')](_0x8903('0x1c'));}}if(_0x43e495['castTo']){_0x5d140d=_0x43e495[_0x8903('0x1d')];_0x498613[_0x8903('0x1e')]=_0x8903('0x1f')+_0x242675+'.'+_0x43e495[_0x8903('0x20')]+_0x8903('0x21')+_0x43e495[_0x8903('0x1d')]+')\x20'+parseOperator(_0x43e495['operator']);}else{_0x498613[_0x8903('0x1e')]=_0x242675+'.'+_0x43e495['field']+'\x20'+parseOperator(_0x43e495['operator']);}if(_[_0x8903('0x22')]([_0x8903('0x23'),_0x8903('0x24')],_0x43e495[_0x8903('0x14')]))_0x498613[_0x8903('0x1e')]='('+_0x498613[_0x8903('0x1e')]+'\x20OR\x20'+_0x242675+'.'+_0x43e495['field']+'\x20IS\x20NULL)';_0x498613[_0x8903('0x17')]=parseValue(_0x5d140d,_0x43e495[_0x8903('0x14')],_0x43e495[_0x8903('0x17')]);return _0x498613;};function parseOperator(_0x16bc67){var _0x1b426a;switch(_0x16bc67){case _0x8903('0x25'):_0x1b426a=_0x8903('0x26');break;case _0x8903('0x24'):_0x1b426a=_0x8903('0x27');break;case _0x8903('0x15'):_0x1b426a=_0x8903('0x28');break;case _0x8903('0x23'):_0x1b426a=_0x8903('0x29');break;case _0x8903('0x2a'):case _0x8903('0x2b'):case'$endsWith':_0x1b426a=_0x8903('0x2c');break;case _0x8903('0x2d'):_0x1b426a=_0x8903('0x2e');break;case _0x8903('0x18'):_0x1b426a='>\x20?';break;case _0x8903('0x19'):_0x1b426a=_0x8903('0x2f');break;case _0x8903('0x30'):_0x1b426a='>=\x20?';break;case _0x8903('0x16'):_0x1b426a=_0x8903('0x31');break;}return _0x1b426a;}function parseValue(_0x4d5766,_0x326297,_0x3b8639){var _0x27ddbe={'start':undefined,'end':undefined};switch(_0x326297){case _0x8903('0x25'):case'$notIn':_0x27ddbe['start']=_0x3b8639['split'](',');break;case _0x8903('0x2a'):_0x27ddbe[_0x8903('0x32')]='%'+_0x3b8639+'%';break;case _0x8903('0x2b'):_0x27ddbe[_0x8903('0x32')]=_0x3b8639+'%';break;case _0x8903('0x33'):_0x27ddbe[_0x8903('0x32')]='%'+_0x3b8639;break;case _0x8903('0x16'):var _0x3f7e7e=_0x3b8639[_0x8903('0x9')](',');var _0x3b8639=_0x3f7e7e[_0x8903('0xd')]();var _0x23d814=_0x3f7e7e[_0x8903('0x34')]();if(_0x4d5766===_0x8903('0x13')){_0x3b8639=moment(_0x3b8639)[_0x8903('0x35')](0x0,!![])[_0x8903('0x1b')]();_0x23d814=moment(_0x23d814)[_0x8903('0x35')](0x0,!![])['add'](0x17,_0x8903('0x36'))['add'](0x3b,_0x8903('0x37'))[_0x8903('0x38')](0x3b,_0x8903('0x39'))[_0x8903('0x1b')]();}_0x27ddbe={'start':_0x3b8639,'end':_0x23d814};break;default:_0x27ddbe['start']=_0x3b8639;break;}return _0x27ddbe;} \ No newline at end of file +var _0x93e3=['$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','filter','map','conditions','push','DATE','operator','$eq','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','CAST(','field','text','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith'];(function(_0x504c88,_0x1c3016){var _0xb5611e=function(_0x2beaf8){while(--_0x2beaf8){_0x504c88['push'](_0x504c88['shift']());}};_0xb5611e(++_0x1c3016);}(_0x93e3,0x16a));var _0x393e=function(_0x475aa9,_0x439aab){_0x475aa9=_0x475aa9-0x0;var _0x360bbc=_0x93e3[_0x475aa9];return _0x360bbc;};'use strict';var _=require(_0x393e('0x0'));var moment=require(_0x393e('0x1'));exports['parseSearch']=function(_0x7f1e8d){var _0x170c89={'conditions':[]};_0x170c89[_0x393e('0x2')]=_[_0x393e('0x3')](_0x7f1e8d,_0x393e('0x4'))?'or':_0x393e('0x5');var _0x47b542=_0x7f1e8d[_0x393e('0x6')](_0x393e('0x7'),'')[_0x393e('0x6')](_0x393e('0x4'),'')[_0x393e('0x8')]('||');for(var _0x4b1298=0x0;_0x4b1298<_0x47b542[_0x393e('0x9')];_0x4b1298++){var _0x59e982=_0x47b542[_0x4b1298][_0x393e('0x8')](':=');var _0x44d9fd=_0x59e982[0x0];var _0x5eb17f=_0x59e982[_0x393e('0xa')](0x1);_0x5eb17f[_0x393e('0xb')](function(_0x2c761c){var _0x132fb2=_0x2c761c[_0x393e('0x8')]('[')[_0x393e('0xc')]();var _0x12c442=_0x2c761c[_0x393e('0xd')](/\[(.*?)\]/g);_0x12c442[_0x393e('0xb')](function(_0x333cb4){var _0x364d6d=_0x333cb4['split']('[')[_0x393e('0xe')](function(_0x36d92e){return _0x36d92e['indexOf'](']')>-0x1;})[_0x393e('0xf')](function(_0x1a0da5){return _0x1a0da5[_0x393e('0x8')](']')[0x0];})[0x0];_0x170c89[_0x393e('0x10')][_0x393e('0x11')]({'field':_0x44d9fd,'operator':_0x132fb2,'value':_0x364d6d});});});}return _0x170c89;};exports['buildExpression']=function(_0x211a12,_0x59b92b,_0x21e0e0){var _0x553da0={};if(_0x59b92b===_0x393e('0x12')){if(_0x21e0e0[_0x393e('0x13')]===_0x393e('0x14')){_0x21e0e0[_0x393e('0x13')]='$between';_0x21e0e0[_0x393e('0x15')]+=','+_0x21e0e0[_0x393e('0x15')];}else if(_[_0x393e('0x16')]([_0x393e('0x17'),_0x393e('0x18')],_0x21e0e0[_0x393e('0x13')])){_0x21e0e0[_0x393e('0x15')]=moment(_0x21e0e0[_0x393e('0x15')])[_0x393e('0x19')](0x1,_0x393e('0x1a'))[_0x393e('0x1b')](_0x393e('0x1c'));}}if(_0x21e0e0[_0x393e('0x1d')]){_0x59b92b=_0x21e0e0['castTo'];_0x553da0['text']=_0x393e('0x1e')+_0x211a12+'.'+_0x21e0e0[_0x393e('0x1f')]+'\x20AS\x20'+_0x21e0e0[_0x393e('0x1d')]+')\x20'+parseOperator(_0x21e0e0[_0x393e('0x13')]);}else{_0x553da0[_0x393e('0x20')]=_0x211a12+'.'+_0x21e0e0['field']+'\x20'+parseOperator(_0x21e0e0[_0x393e('0x13')]);}if(_['includes']([_0x393e('0x21'),_0x393e('0x22')],_0x21e0e0['operator']))_0x553da0['text']='('+_0x553da0['text']+_0x393e('0x23')+_0x211a12+'.'+_0x21e0e0[_0x393e('0x1f')]+_0x393e('0x24');_0x553da0[_0x393e('0x15')]=parseValue(_0x59b92b,_0x21e0e0[_0x393e('0x13')],_0x21e0e0[_0x393e('0x15')]);return _0x553da0;};function parseOperator(_0x4d071f){var _0x26078c;switch(_0x4d071f){case _0x393e('0x25'):_0x26078c=_0x393e('0x26');break;case _0x393e('0x22'):_0x26078c=_0x393e('0x27');break;case _0x393e('0x14'):_0x26078c=_0x393e('0x28');break;case _0x393e('0x21'):_0x26078c=_0x393e('0x29');break;case _0x393e('0x2a'):case _0x393e('0x2b'):case _0x393e('0x2c'):_0x26078c=_0x393e('0x2d');break;case _0x393e('0x2e'):_0x26078c=_0x393e('0x2f');break;case _0x393e('0x17'):_0x26078c=_0x393e('0x30');break;case _0x393e('0x18'):_0x26078c=_0x393e('0x31');break;case'$gte':_0x26078c=_0x393e('0x32');break;case _0x393e('0x33'):_0x26078c=_0x393e('0x34');break;}return _0x26078c;}function parseValue(_0x217f6a,_0x355be3,_0x1524dc){var _0x2063f8={'start':undefined,'end':undefined};switch(_0x355be3){case _0x393e('0x25'):case'$notIn':_0x2063f8[_0x393e('0x35')]=_0x1524dc[_0x393e('0x8')](',');break;case _0x393e('0x2a'):_0x2063f8['start']='%'+_0x1524dc+'%';break;case _0x393e('0x2b'):_0x2063f8[_0x393e('0x35')]=_0x1524dc+'%';break;case _0x393e('0x2c'):_0x2063f8['start']='%'+_0x1524dc;break;case _0x393e('0x33'):var _0x275e43=_0x1524dc['split'](',');var _0x1524dc=_0x275e43[_0x393e('0xc')]();var _0x149c17=_0x275e43[_0x393e('0x36')]();if(_0x217f6a==='DATE'){_0x1524dc=moment(_0x1524dc)['utcOffset'](0x0,!![])[_0x393e('0x1b')]();_0x149c17=moment(_0x149c17)[_0x393e('0x37')](0x0,!![])['add'](0x17,'hours')[_0x393e('0x19')](0x3b,_0x393e('0x38'))[_0x393e('0x19')](0x3b,_0x393e('0x39'))[_0x393e('0x1b')]();}_0x2063f8={'start':_0x1524dc,'end':_0x149c17};break;default:_0x2063f8['start']=_0x1524dc;break;}return _0x2063f8;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 6a65176..e6b0a5d 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 _0x990f=['$lte','subtract','name','uniqueid','isArray','offset','sort','map','priority','cast','col','unsigned','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','trim','replace','push','join','query','$id','intersection','attributes','nolimit','limit','order','where','pick','filter','object','columns','value','merge','VIRTUAL','lower','options','include','lodash','moment','../../mysqldb','keys','includes','parse','model','alias','fields','raw','split','filters','isEmpty','forOwn','find','type','$gte','format','YYYY-MM-DD','utc'];(function(_0x508d11,_0xb2499b){var _0x46e574=function(_0xf5268c){while(--_0xf5268c){_0x508d11['push'](_0x508d11['shift']());}};_0x46e574(++_0xb2499b);}(_0x990f,0xbb));var _0xf990=function(_0x127124,_0x3fc04c){_0x127124=_0x127124-0x0;var _0x5e1ea6=_0x990f[_0x127124];return _0x5e1ea6;};'use strict';var _=require(_0xf990('0x0'));var sequelize=require('sequelize');var moment=require(_0xf990('0x1'));var db=require(_0xf990('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x13b60f){var _0x42385e=['ne'];try{var _0x38957a=JSON['parse'](_0x13b60f);var _0x4049d6=Object[_0xf990('0x3')](_0x38957a)[0x0];return _0x42385e[_0xf990('0x4')](_0x4049d6);}catch(_0x542943){return![];}}function getOperatorValue(_0x44284c){var _0x43bb02=JSON[_0xf990('0x5')](_0x44284c);var _0x291f05=Object[_0xf990('0x3')](_0x43bb02)[0x0];var _0x5d1dc0=_0x43bb02[_0x291f05];return{['$'+_0x291f05]:_0x5d1dc0};}function parseIncludeModel(_0xfbefd8){var _0x77753b=JSON[_0xf990('0x5')](_0xfbefd8);return{'model':db[_0x77753b[_0xf990('0x6')]],'as':_0x77753b[_0xf990('0x7')],'attributes':_0x77753b[_0xf990('0x8')],'raw':_0x77753b[_0xf990('0x9')]};}exports['fields']=function(_0x44ed02){var _0x4e1182=null;if(_0x44ed02){_0x4e1182=_0x44ed02[_0xf990('0xa')](',');}return _0x4e1182;};exports[_0xf990('0xb')]=function(_0x58a718,_0x3fae33){var _0xb78733={};if(!_[_0xf990('0xc')](_0x58a718)){_[_0xf990('0xd')](_0x58a718,function(_0x1a6edb,_0x34a8e2){try{if(_0x3fae33){var _0x428c6e=_[_0xf990('0xe')](_0x3fae33,{'name':_0x34a8e2})||{};if(hasSequelizeOperator(_0x1a6edb)){_0xb78733[_0x34a8e2]=getOperatorValue(_0x1a6edb);}else if(_0x428c6e[_0xf990('0xf')]==='DATE'&&_['isPlainObject'](_0x1a6edb)){var _0x5a16aa=JSON['parse'](_0x1a6edb);var _0x15ebb4={'$gte':moment(moment(_0x5a16aa[_0xf990('0x10')])[_0xf990('0x11')](_0xf990('0x12')))[_0xf990('0x13')]()[_0xf990('0x11')](),'$lte':moment(moment(_0x5a16aa[_0xf990('0x14')])[_0xf990('0x11')](_0xf990('0x12')))[_0xf990('0x13')]()[_0xf990('0x15')](0x1,'s')[_0xf990('0x11')]()};_0xb78733[_0x34a8e2]=_0x15ebb4;}else if(_0x428c6e[_0xf990('0x16')]===_0xf990('0x17')){_0xb78733[_0x34a8e2]=_0x1a6edb;}else{_0xb78733[_0x34a8e2]=_['isArray'](_0x1a6edb)?_0x1a6edb:JSON[_0xf990('0x5')](_0x1a6edb);}}else{_0xb78733[_0x34a8e2]=_[_0xf990('0x18')](_0x1a6edb)?_0x1a6edb:JSON[_0xf990('0x5')](_0x1a6edb);}}catch(_0x2c1851){_0xb78733[_0x34a8e2]=_0x1a6edb[_0xf990('0xa')](',');}});}return _0xb78733;};exports['limit']=function(_0x1d3af2){_0x1d3af2=parseInt(_0x1d3af2,0xa);if(!_0x1d3af2||_0x1d3af2<0x0){_0x1d3af2=LIMIT_VALUE;}return _0x1d3af2;};exports[_0xf990('0x19')]=function(_0x170ce4){_0x170ce4=parseInt(_0x170ce4,0xa);if(!_0x170ce4||_0x170ce4<0x0){_0x170ce4=0x0;}return _0x170ce4;};exports[_0xf990('0x1a')]=function(_0xc794e2){var _0x45580b,_0x260073=null;if(_0xc794e2){_0x45580b=_0xc794e2[_0xf990('0xa')](',');_0x260073=_[_0xf990('0x1b')](_0x45580b,function(_0x1c54b4){if(_0x1c54b4['indexOf']('-')===0x0){return[_0x1c54b4===_0xf990('0x1c')?sequelize[_0xf990('0x1d')](sequelize[_0xf990('0x1e')](_0xf990('0x1c')),_0xf990('0x1f')):_0x1c54b4['substr'](0x1),_0xf990('0x20')];}else{return[_0x1c54b4==='priority'?sequelize[_0xf990('0x1d')](sequelize[_0xf990('0x1e')](_0xf990('0x1c')),_0xf990('0x1f')):_0x1c54b4,_0xf990('0x21')];}});}return _0x260073;};exports[_0xf990('0x22')]=function(_0x343226,_0x24b9a5){if(_[_0xf990('0xc')](_0x343226)){return _0x343226;}if(_['isArray'](_0x343226)){for(var _0x2839d0=0x0;_0x2839d0<_0x343226[_0xf990('0x23')];_0x2839d0+=0x1){_0x343226[_0x2839d0]=this[_0xf990('0x22')](_0x343226[_0x2839d0],_0x24b9a5);}return _0x343226;}if(!_[_0xf990('0x24')](_0x343226)){return _0x343226;}if(_[_0xf990('0x25')](_0x24b9a5)){_0x24b9a5=[_0x24b9a5];}if(!_['isArray'](_0x24b9a5)){return _0x343226;}for(var _0x920912=0x0;_0x920912<_0x24b9a5['length'];_0x920912+=0x1){_[_0xf990('0x26')](_0x343226,_0x24b9a5[_0x920912]);}for(var _0x1dc142 in _0x343226){if(_0x343226[_0xf990('0x27')](_0x1dc142)){_0x343226[_0x1dc142]=this['omit'](_0x343226[_0x1dc142],_0x24b9a5);}}return _0x343226;};exports[_0xf990('0x28')]=function(_0x263b27){return _0x263b27[_0xf990('0x29')](RegExp(_0xf990('0x2a')))?!![]:![];};exports[_0xf990('0x2b')]=function(_0x329895){return _0x329895[_0xf990('0x29')](/^\S+@\S+$/)?!![]:![];};exports[_0xf990('0x2c')]=function(_0x2ac668,_0x401b29){var _0x93a7aa=[];var _0x1ac04f=/([^:]")"+/g;var _0x3fd4b6=/[*<>~@-]/g;var _0x2a05fa=/[ `!@#$%^&*()_\-?~<>]/;var _0x529e4d=/[ ,]+/;var _0x4599c8=_0x401b29?_0xf990('0x2d'):_0xf990('0x2e');if(_0x401b29){_0x2ac668=_0x2ac668['replace'](_0x3fd4b6,'\x20')[_0xf990('0x2f')]();}_0x2ac668['split'](_0x529e4d)['forEach'](function(_0x4543ba){_0x4543ba=_0x4543ba[_0xf990('0x30')](_0x1ac04f,'$1');_0x4543ba='+'+_0x4543ba+'*';var _0x2ae979=_0x4543ba[_0xf990('0x29')](_0x2a05fa);if(_0x2ae979){_0x4543ba='\x22'+_0x4543ba+'\x22';}_0x93a7aa[_0xf990('0x31')](_0x4543ba);});_0x4599c8=_0x4599c8[_0xf990('0x30')](_0xf990('0x2e'),_0x93a7aa[_0xf990('0x32')]('\x20'));return _0x4599c8;};exports['getOptions']=function(_0x3e15af,_0x2ab3a4,_0x22c728){var _0x19a96d={},_0x4ccf5f={};if(_0x2ab3a4[_0xf990('0x33')][_0xf990('0x34')]){_0x2ab3a4[_0xf990('0x33')]['id']=_0x2ab3a4[_0xf990('0x33')][_0xf990('0x34')];delete _0x2ab3a4['query']['$id'];}_0x19a96d[_0xf990('0x6')]=_[_0xf990('0x1b')](_0x3e15af,'name');_0x19a96d[_0xf990('0x33')]=_[_0xf990('0x3')](_0x2ab3a4['query']);_0x19a96d['filters']=_['intersection'](_0x19a96d['model'],_0x19a96d[_0xf990('0x33')]);_0x4ccf5f['attributes']=_[_0xf990('0x35')](_0x19a96d[_0xf990('0x6')],this[_0xf990('0x8')](_0x2ab3a4[_0xf990('0x33')][_0xf990('0x8')]));_0x4ccf5f[_0xf990('0x36')]=_0x4ccf5f['attributes'][_0xf990('0x23')]?_0x4ccf5f[_0xf990('0x36')]:_0x19a96d[_0xf990('0x6')];if(!_0x2ab3a4['query'][_0xf990('0x27')](_0xf990('0x37'))){_0x4ccf5f[_0xf990('0x38')]=this['limit'](_0x2ab3a4[_0xf990('0x33')][_0xf990('0x38')]);_0x4ccf5f[_0xf990('0x19')]=this[_0xf990('0x19')](_0x2ab3a4[_0xf990('0x33')][_0xf990('0x19')]);}_0x4ccf5f[_0xf990('0x39')]=this[_0xf990('0x1a')](_0x2ab3a4[_0xf990('0x33')][_0xf990('0x1a')]);_0x4ccf5f[_0xf990('0x3a')]=this[_0xf990('0xb')](_[_0xf990('0x3b')](_0x2ab3a4[_0xf990('0x33')],_0x19a96d['filters']),_0x3e15af);if(_0x2ab3a4[_0xf990('0x33')][_0xf990('0x3c')]){var _0x382e1f=_0x3e15af;var _0x437e96=_0x2ab3a4[_0xf990('0x33')][_0xf990('0x3c')];if(typeof _0x437e96===_0xf990('0x3d')){_0x382e1f=_[_0xf990('0x3c')](_0x3e15af,function(_0x34b17b){return _[_0xf990('0x4')](_0x437e96[_0xf990('0x3e')],_0x34b17b[_0xf990('0x16')]);});_0x437e96=_0x437e96[_0xf990('0x3f')];}_0x4ccf5f['where']=_[_0xf990('0x40')](_0x4ccf5f[_0xf990('0x3a')],{'$or':_['map'](_0x382e1f,function(_0x53fa25){if(_0x53fa25[_0xf990('0xf')]!==_0xf990('0x41')){if(_0x22c728){return sequelize[_0xf990('0x3a')](sequelize['fn']('lower',sequelize[_0xf990('0x1e')](_0x53fa25[_0xf990('0x16')])),{'$like':sequelize['fn'](_0xf990('0x42'),'%'+_0x2ab3a4[_0xf990('0x33')][_0xf990('0x3c')]+'%')});}else{var _0x21358c={};_0x21358c[_0x53fa25['name']]={'$like':'%'+_0x2ab3a4[_0xf990('0x33')][_0xf990('0x3c')]+'%'};return _0x21358c;}}})});}_0x4ccf5f=_[_0xf990('0x40')]({},_0x4ccf5f,_0x2ab3a4[_0xf990('0x43')]);return _0x4ccf5f;};exports[_0xf990('0x44')]=function(_0x8b1834){var _0x19341e=[];if(_0x8b1834['includeAll']){_0x19341e['push']({'all':!![]});}else if(_0x8b1834['include']){if(Array[_0xf990('0x18')](_0x8b1834[_0xf990('0x44')])){_0x19341e=Object[_0xf990('0x3')](_0x8b1834['include'])['map'](function(_0x553680){return parseIncludeModel(_0x8b1834['include'][_0x553680]);});}else{var _0x52abf7=parseIncludeModel(_0x8b1834[_0xf990('0x44')]);_0x19341e[_0xf990('0x31')](_0x52abf7);}}return _0x19341e;};exports['escapeLIKESpecialChars']=function(_0x37836b){return _0x37836b[_0xf990('0x30')](/[%_^-]/g,function(_0x2915f0){return'\x5c'+_0x2915f0;});}; \ No newline at end of file +var _0x3159=['filters','isEmpty','forOwn','find','type','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','trim','forEach','replace','push','getOptions','query','$id','intersection','attributes','nolimit','offset','order','where','pick','filter','object','value','merge','VIRTUAL','lower','options','include','includeAll','lodash','moment','../../mysqldb','parse','keys','includes','model','fields','raw','split'];(function(_0x48bc7b,_0x4d6670){var _0x231278=function(_0x3e9091){while(--_0x3e9091){_0x48bc7b['push'](_0x48bc7b['shift']());}};_0x231278(++_0x4d6670);}(_0x3159,0x154));var _0x9315=function(_0x13b796,_0x19507b){_0x13b796=_0x13b796-0x0;var _0x54757d=_0x3159[_0x13b796];return _0x54757d;};'use strict';var _=require(_0x9315('0x0'));var sequelize=require('sequelize');var moment=require(_0x9315('0x1'));var db=require(_0x9315('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1b5e63){var _0x257b94=['ne'];try{var _0x1d65f2=JSON[_0x9315('0x3')](_0x1b5e63);var _0x5e5798=Object[_0x9315('0x4')](_0x1d65f2)[0x0];return _0x257b94[_0x9315('0x5')](_0x5e5798);}catch(_0x55a219){return![];}}function getOperatorValue(_0xab67cb){var _0x28f8e2=JSON[_0x9315('0x3')](_0xab67cb);var _0x3e3436=Object['keys'](_0x28f8e2)[0x0];var _0x4c6735=_0x28f8e2[_0x3e3436];return{['$'+_0x3e3436]:_0x4c6735};}function parseIncludeModel(_0x13a358){var _0xa844d4=JSON[_0x9315('0x3')](_0x13a358);return{'model':db[_0xa844d4[_0x9315('0x6')]],'as':_0xa844d4['alias'],'attributes':_0xa844d4[_0x9315('0x7')],'raw':_0xa844d4[_0x9315('0x8')]};}exports['fields']=function(_0x54df22){var _0x55c5dc=null;if(_0x54df22){_0x55c5dc=_0x54df22[_0x9315('0x9')](',');}return _0x55c5dc;};exports[_0x9315('0xa')]=function(_0x3e10f7,_0x10b7cd){var _0x11c8a0={};if(!_[_0x9315('0xb')](_0x3e10f7)){_[_0x9315('0xc')](_0x3e10f7,function(_0x24933d,_0x6fd606){try{if(_0x10b7cd){var _0x43777f=_[_0x9315('0xd')](_0x10b7cd,{'name':_0x6fd606})||{};if(hasSequelizeOperator(_0x24933d)){_0x11c8a0[_0x6fd606]=getOperatorValue(_0x24933d);}else if(_0x43777f[_0x9315('0xe')]==='DATE'&&_[_0x9315('0xf')](_0x24933d)){var _0x3cd07a=JSON['parse'](_0x24933d);var _0x35921f={'$gte':moment(moment(_0x3cd07a[_0x9315('0x10')])[_0x9315('0x11')](_0x9315('0x12')))[_0x9315('0x13')]()['format'](),'$lte':moment(moment(_0x3cd07a[_0x9315('0x14')])[_0x9315('0x11')](_0x9315('0x12')))[_0x9315('0x13')]()[_0x9315('0x15')](0x1,'s')[_0x9315('0x11')]()};_0x11c8a0[_0x6fd606]=_0x35921f;}else if(_0x43777f[_0x9315('0x16')]===_0x9315('0x17')){_0x11c8a0[_0x6fd606]=_0x24933d;}else{_0x11c8a0[_0x6fd606]=_['isArray'](_0x24933d)?_0x24933d:JSON['parse'](_0x24933d);}}else{_0x11c8a0[_0x6fd606]=_[_0x9315('0x18')](_0x24933d)?_0x24933d:JSON[_0x9315('0x3')](_0x24933d);}}catch(_0x191e40){_0x11c8a0[_0x6fd606]=_0x24933d['split'](',');}});}return _0x11c8a0;};exports[_0x9315('0x19')]=function(_0x50d4fc){_0x50d4fc=parseInt(_0x50d4fc,0xa);if(!_0x50d4fc||_0x50d4fc<0x0){_0x50d4fc=LIMIT_VALUE;}return _0x50d4fc;};exports['offset']=function(_0x5254ba){_0x5254ba=parseInt(_0x5254ba,0xa);if(!_0x5254ba||_0x5254ba<0x0){_0x5254ba=0x0;}return _0x5254ba;};exports[_0x9315('0x1a')]=function(_0x3406f0){var _0x36ca16,_0xbff863=null;if(_0x3406f0){_0x36ca16=_0x3406f0[_0x9315('0x9')](',');_0xbff863=_[_0x9315('0x1b')](_0x36ca16,function(_0x1d78a4){if(_0x1d78a4[_0x9315('0x1c')]('-')===0x0){return[_0x1d78a4===_0x9315('0x1d')?sequelize[_0x9315('0x1e')](sequelize[_0x9315('0x1f')]('priority'),_0x9315('0x20')):_0x1d78a4[_0x9315('0x21')](0x1),_0x9315('0x22')];}else{return[_0x1d78a4===_0x9315('0x1d')?sequelize[_0x9315('0x1e')](sequelize[_0x9315('0x1f')]('priority'),_0x9315('0x20')):_0x1d78a4,_0x9315('0x23')];}});}return _0xbff863;};exports[_0x9315('0x24')]=function(_0x343762,_0x2923d8){if(_['isEmpty'](_0x343762)){return _0x343762;}if(_[_0x9315('0x18')](_0x343762)){for(var _0x597b28=0x0;_0x597b28<_0x343762[_0x9315('0x25')];_0x597b28+=0x1){_0x343762[_0x597b28]=this[_0x9315('0x24')](_0x343762[_0x597b28],_0x2923d8);}return _0x343762;}if(!_[_0x9315('0x26')](_0x343762)){return _0x343762;}if(_['isString'](_0x2923d8)){_0x2923d8=[_0x2923d8];}if(!_[_0x9315('0x18')](_0x2923d8)){return _0x343762;}for(var _0x2596ef=0x0;_0x2596ef<_0x2923d8[_0x9315('0x25')];_0x2596ef+=0x1){_[_0x9315('0x27')](_0x343762,_0x2923d8[_0x2596ef]);}for(var _0x157c1b in _0x343762){if(_0x343762[_0x9315('0x28')](_0x157c1b)){_0x343762[_0x157c1b]=this['omit'](_0x343762[_0x157c1b],_0x2923d8);}}return _0x343762;};exports[_0x9315('0x29')]=function(_0x1b0476){return _0x1b0476[_0x9315('0x2a')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x9315('0x2b')]=function(_0x468a3e){return _0x468a3e[_0x9315('0x2a')](/^\S+@\S+$/)?!![]:![];};exports[_0x9315('0x2c')]=function(_0x2cc5de,_0x2841b9){var _0x16aa04=[];var _0xd34b=/([^:]")"+/g;var _0x5ee598=/[*<>~@-]/g;var _0x8ece91=/[ `!@#$%^&*()_\-?~<>]/;var _0x5c1ec1=/[ ,]+/;var _0x1ceff4=_0x2841b9?_0x9315('0x2d'):_0x9315('0x2e');if(_0x2841b9){_0x2cc5de=_0x2cc5de['replace'](_0x5ee598,'\x20')[_0x9315('0x2f')]();}_0x2cc5de[_0x9315('0x9')](_0x5c1ec1)[_0x9315('0x30')](function(_0x5aebe4){_0x5aebe4=_0x5aebe4[_0x9315('0x31')](_0xd34b,'$1');_0x5aebe4='+'+_0x5aebe4+'*';var _0x431b44=_0x5aebe4[_0x9315('0x2a')](_0x8ece91);if(_0x431b44){_0x5aebe4='\x22'+_0x5aebe4+'\x22';}_0x16aa04[_0x9315('0x32')](_0x5aebe4);});_0x1ceff4=_0x1ceff4[_0x9315('0x31')](_0x9315('0x2e'),_0x16aa04['join']('\x20'));return _0x1ceff4;};exports[_0x9315('0x33')]=function(_0x510962,_0x4b8826,_0x3a813e){var _0x3f55aa={},_0x594392={};if(_0x4b8826[_0x9315('0x34')][_0x9315('0x35')]){_0x4b8826['query']['id']=_0x4b8826['query'][_0x9315('0x35')];delete _0x4b8826[_0x9315('0x34')][_0x9315('0x35')];}_0x3f55aa[_0x9315('0x6')]=_[_0x9315('0x1b')](_0x510962,_0x9315('0x16'));_0x3f55aa[_0x9315('0x34')]=_[_0x9315('0x4')](_0x4b8826[_0x9315('0x34')]);_0x3f55aa['filters']=_['intersection'](_0x3f55aa[_0x9315('0x6')],_0x3f55aa[_0x9315('0x34')]);_0x594392['attributes']=_[_0x9315('0x36')](_0x3f55aa[_0x9315('0x6')],this[_0x9315('0x7')](_0x4b8826[_0x9315('0x34')][_0x9315('0x7')]));_0x594392[_0x9315('0x37')]=_0x594392[_0x9315('0x37')][_0x9315('0x25')]?_0x594392[_0x9315('0x37')]:_0x3f55aa['model'];if(!_0x4b8826[_0x9315('0x34')][_0x9315('0x28')](_0x9315('0x38'))){_0x594392[_0x9315('0x19')]=this[_0x9315('0x19')](_0x4b8826[_0x9315('0x34')][_0x9315('0x19')]);_0x594392[_0x9315('0x39')]=this[_0x9315('0x39')](_0x4b8826['query'][_0x9315('0x39')]);}_0x594392[_0x9315('0x3a')]=this[_0x9315('0x1a')](_0x4b8826['query']['sort']);_0x594392[_0x9315('0x3b')]=this['filters'](_[_0x9315('0x3c')](_0x4b8826[_0x9315('0x34')],_0x3f55aa[_0x9315('0xa')]),_0x510962);if(_0x4b8826['query'][_0x9315('0x3d')]){var _0x1eedd2=_0x510962;var _0x485995=_0x4b8826[_0x9315('0x34')][_0x9315('0x3d')];if(typeof _0x485995===_0x9315('0x3e')){_0x1eedd2=_[_0x9315('0x3d')](_0x510962,function(_0x24be16){return _[_0x9315('0x5')](_0x485995['columns'],_0x24be16[_0x9315('0x16')]);});_0x485995=_0x485995[_0x9315('0x3f')];}_0x594392[_0x9315('0x3b')]=_[_0x9315('0x40')](_0x594392[_0x9315('0x3b')],{'$or':_[_0x9315('0x1b')](_0x1eedd2,function(_0x13626a){if(_0x13626a[_0x9315('0xe')]!==_0x9315('0x41')){if(_0x3a813e){return sequelize[_0x9315('0x3b')](sequelize['fn'](_0x9315('0x42'),sequelize[_0x9315('0x1f')](_0x13626a['name'])),{'$like':sequelize['fn'](_0x9315('0x42'),'%'+_0x4b8826['query'][_0x9315('0x3d')]+'%')});}else{var _0xc77a82={};_0xc77a82[_0x13626a[_0x9315('0x16')]]={'$like':'%'+_0x4b8826[_0x9315('0x34')][_0x9315('0x3d')]+'%'};return _0xc77a82;}}})});}_0x594392=_[_0x9315('0x40')]({},_0x594392,_0x4b8826[_0x9315('0x43')]);return _0x594392;};exports[_0x9315('0x44')]=function(_0x414bd2){var _0x2ef27b=[];if(_0x414bd2[_0x9315('0x45')]){_0x2ef27b['push']({'all':!![]});}else if(_0x414bd2['include']){if(Array[_0x9315('0x18')](_0x414bd2[_0x9315('0x44')])){_0x2ef27b=Object[_0x9315('0x4')](_0x414bd2['include'])['map'](function(_0x2b444f){return parseIncludeModel(_0x414bd2[_0x9315('0x44')][_0x2b444f]);});}else{var _0x57f165=parseIncludeModel(_0x414bd2['include']);_0x2ef27b[_0x9315('0x32')](_0x57f165);}}return _0x2ef27b;};exports['escapeLIKESpecialChars']=function(_0x27f33){return _0x27f33['replace'](/[%_^-]/g,function(_0x18085d){return'\x5c'+_0x18085d;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 64aa66d..44fc993 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 _0x13b6=['order','startsWith','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','sort','toLowerCase','DESC','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','filterAgentAttributes','role','faxStatusTime','openchannelStatusTime','voiceStatusTime','chatCapacity','phoneBarEnableScreenRecordingByAgent','onhold','getRealtimeAgentsQueryFields','lodash','../../mysqldb','client','http','faxPause','mailPause','openchannelPause','voicePause','every','length','idle','ringing','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','unknown','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','all','flatten','uniq','value','getAgentIdsByQueues','filter','includes','getAgentIdsByStatus','User','findAll','name','fullname','chatPause','smsPause','whatsappPause','pauseType','find','getSortedAgentsIdsByStatus','split','fields','globalStatus'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x13b6,0x97));var _0x613b=function(_0x606b6b,_0x5af92b){_0x606b6b=_0x606b6b-0x0;var _0x1167f6=_0x13b6[_0x606b6b];return _0x1167f6;};'use strict';var _=require(_0x613b('0x0'));var jayson=require('jayson/promise');var db=require(_0x613b('0x1'))['db'];var amiClient=jayson[_0x613b('0x2')][_0x613b('0x3')]({'port':0x232a});var routingClient=jayson[_0x613b('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x3d03ec,_0x1dc7f9){var _0x451191=[_0x3d03ec['chatPause'],_0x3d03ec[_0x613b('0x4')],_0x3d03ec[_0x613b('0x5')],_0x3d03ec[_0x613b('0x6')],_0x3d03ec['smsPause'],_0x3d03ec[_0x613b('0x7')],_0x3d03ec['whatsappPause']];if(!_0x1dc7f9)return _[_0x613b('0x8')](_0x451191);var _0x4abb96=_['filter'](_0x451191);return _0x4abb96[_0x613b('0x9')]>0x0&&_0x4abb96[_0x613b('0x9')]<_0x451191[_0x613b('0x9')]?!![]:![];}function isIdle(_0x402c15){return _0x402c15===_0x613b('0xa')||_0x402c15==='unknown'||_0x402c15==='unavailable'||_0x402c15===_0x613b('0xb')||_['isNil'](_0x402c15);}function isAgentIdle(_0xda8aa){if(_0xda8aa['voiceStatus']!=='idle'&&_0xda8aa[_0x613b('0x7')]){_0xda8aa[_0x613b('0xc')]=_0x613b('0xd');return![];}return _['every']([_0xda8aa[_0x613b('0xe')],_0xda8aa[_0x613b('0xf')],_0xda8aa[_0x613b('0x10')],_0xda8aa[_0x613b('0x11')],_0xda8aa[_0x613b('0x12')],_0xda8aa[_0x613b('0xc')],_0xda8aa[_0x613b('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x613b('0x14')](_0x613b('0x15'),{})[_0x613b('0x16')](function(_0x52c088){if(_0x52c088[_0x613b('0x17')]){throw new Error(_0x613b('0x18'));}var _0x12f0d1=_0x52c088['result'];return routingClient['request'](_0x613b('0x15'),{})['then'](function(_0x27949c){if(_0x27949c['error']){throw new Error(_0x613b('0x19'));}var _0x26dbfa=_0x27949c[_0x613b('0x1a')];return _[_0x613b('0x1b')]({},_0x12f0d1,_0x26dbfa);});})[_0x613b('0x1c')](function(_0x154b73){throw _0x154b73;});}exports[_0x613b('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x484b06){var _0x393168=_0x613b('0x1e');if(isAgentPaused(_0x484b06))_0x393168='pause';else if(isAgentPaused(_0x484b06,!![]))_0x393168='*pause';else if(isAgentIdle(_0x484b06))_0x393168=_0x613b('0xa');else _0x393168=_0x613b('0x1f');return _0x393168;}exports[_0x613b('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x425ebb,_0x1df68a){var _0x4d9728=_[_0x613b('0x21')](_0x425ebb)?_0x425ebb:[_0x425ebb];var _0x59a787=_[_0x613b('0x22')](_0x1df68a)+_0x613b('0x23');var _0x3a17a1=_[_0x613b('0x24')](_0x4d9728,function(_0x485a6d){return db[_0x59a787][_0x613b('0x25')]({'where':{'id':_0x485a6d}})['then'](function(_0x31e9cb){if(!_0x31e9cb)return[];return _0x31e9cb['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x613b('0x26')](_0x3a17a1)[_0x613b('0x16')](function(_0x1a08dc){var _0x45736d=_(_0x1a08dc)[_0x613b('0x27')]()[_0x613b('0x24')]('id')[_0x613b('0x28')]()[_0x613b('0x29')]();return _0x45736d;});}exports[_0x613b('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x63f8c3,_0x30f08b,_0x367c1a){try{if(_0x30f08b['length']>0x0){_0x63f8c3=_0x63f8c3[_0x613b('0x2b')](function(_0x1c0157){return _0x30f08b[_0x613b('0x2c')](_0x1c0157['id']);});}var _0x27cbe1=_0x63f8c3[_0x613b('0x2b')](function(_0x2f2820){var _0x4767fc='busy';if(isAgentIdle(_0x2f2820)){_0x4767fc=_0x613b('0xa');}return _0x4767fc===_0x367c1a;});return _[_0x613b('0x24')](_0x27cbe1,'id');}catch(_0x56561f){throw _0x56561f;}}exports[_0x613b('0x2d')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x4f2df9,_0x3ed316,_0x35bbbe){return Promise['resolve']()[_0x613b('0x16')](function(){if(_0x3ed316[_0x613b('0x9')]>0x0){_0x4f2df9=_0x4f2df9[_0x613b('0x2b')](function(_0x136f0e){return _0x3ed316[_0x613b('0x2c')](_0x136f0e['id']);});}return _0x4f2df9;})[_0x613b('0x16')](function(){return db[_0x613b('0x2e')][_0x613b('0x2f')]({'attributes':['id',_0x613b('0x30'),_0x613b('0x31'),_0x613b('0x32'),_0x613b('0x4'),_0x613b('0x5'),'openchannelPause',_0x613b('0x33'),_0x613b('0x7'),_0x613b('0x34'),_0x613b('0x35')],'where':{'id':{'$in':_['map'](_0x4f2df9,'id')}},'raw':!![]});})['then'](function(_0x2ca332){return _0x2ca332[_0x613b('0x24')](function(_0x18aff4){var _0xf34fa9=_[_0x613b('0x36')](_0x4f2df9,['id',_0x18aff4['id']]);var _0x236769=filterAgentAttributes(_0xf34fa9);_[_0x613b('0x1b')](_0x18aff4,_0x236769);_0x18aff4['globalStatus']=getAgentStatus(_0x18aff4);return _0x18aff4;});})[_0x613b('0x16')](function(_0x6e2369){var _0x41514e=sortAgentsByStatus(_0x6e2369,_0x35bbbe);return _[_0x613b('0x24')](_0x41514e,'id');})[_0x613b('0x1c')](function(_0x77b494){throw _0x77b494;});}exports[_0x613b('0x37')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x37478d){var _0x1dc079={'fields':[],'order':null};var _0x3cd1f2=_0x37478d[_0x613b('0x38')](',');_0x1dc079[_0x613b('0x39')]=_[_0x613b('0x2b')](_0x3cd1f2,function(_0x423ae2){if(!_0x423ae2[_0x613b('0x2c')](_0x613b('0x3a'))){return!![];}_0x1dc079[_0x613b('0x3b')]=_[_0x613b('0x3c')](_0x423ae2,'-')?'DESC':_0x613b('0x3d');return![];});return _0x1dc079;}exports[_0x613b('0x3e')]=getUpdatedSortOptions;function validateSortParameter(_0x1068a4){if(!_0x1068a4){_0x1068a4=_0x613b('0x3f');}if(_0x1068a4[_0x613b('0x2c')](_0x613b('0x31'))&&!_0x1068a4[_0x613b('0x2c')](_0x613b('0x40'))){var _0x18d31e=_0x1068a4[_0x613b('0x41')](0x0,_0x1068a4[_0x613b('0x42')]('fullname'));_0x1068a4+=','+_0x18d31e+_0x613b('0x40');}return _0x1068a4;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x5ea015,_0x3ed724){var _0x1888fa=_0x5ea015[_0x613b('0x43')](function(_0x421808,_0x48bca8){if(_0x421808[_0x613b('0x3a')]===_0x48bca8['globalStatus']){if(_0x421808[_0x613b('0x3a')]===_0x613b('0xd')){if(_0x3ed724==='DESC'){return(_0x421808[_0x613b('0x35')]||'')<(_0x48bca8['pauseType']||'')||_0x421808['fullname']['toLowerCase']()>_0x48bca8['fullname'][_0x613b('0x44')]()?0x1:-0x1;}else{return(_0x421808['pauseType']||'')<(_0x48bca8[_0x613b('0x35')]||'')||_0x421808[_0x613b('0x31')]['toLowerCase']()>_0x48bca8[_0x613b('0x31')][_0x613b('0x44')]()?-0x1:0x1;}}else{if(_0x3ed724===_0x613b('0x45')){return _0x421808[_0x613b('0x31')]['toLowerCase']()<_0x48bca8['fullname'][_0x613b('0x44')]()?0x1:-0x1;}else{return _0x421808[_0x613b('0x31')][_0x613b('0x44')]()<_0x48bca8['fullname']['toLowerCase']()?-0x1:0x1;}}}else{if(_0x3ed724===_0x613b('0x45')){return _0x421808[_0x613b('0x3a')]<_0x48bca8[_0x613b('0x3a')]?0x1:-0x1;}else{return _0x421808['globalStatus']<_0x48bca8['globalStatus']?-0x1:0x1;}}});return _0x1888fa;}exports[_0x613b('0x46')]=sortAgentsByStatus;function filterAgentAttributes(_0x191830){var _0x24f119=[_0x613b('0x47'),_0x613b('0x48'),_0x613b('0x49'),_0x613b('0x4a'),_0x613b('0x35'),_0x613b('0x4a'),_0x613b('0x40'),_0x613b('0x4b'),_0x613b('0x32'),'openchannelPause',_0x613b('0x5'),_0x613b('0x33'),_0x613b('0x34'),_0x613b('0x4'),_0x613b('0x7'),'chatCapacity',_0x613b('0x4c'),_0x613b('0x4d'),_0x613b('0x4e'),_0x613b('0x4f'),_0x613b('0x50'),_0x613b('0x51'),_0x613b('0x52'),_0x613b('0x53'),_0x613b('0x54'),_0x613b('0x55'),_0x613b('0x56'),_0x613b('0xe'),_0x613b('0x11'),_0x613b('0x10'),_0x613b('0x12'),_0x613b('0x13'),_0x613b('0xf'),_0x613b('0xc'),_0x613b('0x57'),'openchannelStatusTime',_0x613b('0x58'),_0x613b('0x59'),_0x613b('0x5a'),'faxStatusTime','voiceStatusTime',_0x613b('0x5b'),_0x613b('0x5c'),_0x613b('0x5d'),'phoneBarEnableScreenRecordingByAgent',_0x613b('0x5e')];var _0x21421c=['chatPause',_0x613b('0x6'),_0x613b('0x5'),_0x613b('0x33'),_0x613b('0x34'),_0x613b('0x4'),_0x613b('0x7'),'online'];var _0x2f7aa0=_(_0x191830)[_0x613b('0x5f')](_0x21421c)['pick'](_0x24f119)['value']();return _0x2f7aa0;}exports[_0x613b('0x60')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name','fullname',_0x613b('0x61'),_0x613b('0x40'),_0x613b('0x48'),_0x613b('0x3a'),'userpic',_0x613b('0x49'),_0x613b('0x35'),_0x613b('0x4a'),'faxPause','chatPause',_0x613b('0x5'),'openchannelPause','smsPause',_0x613b('0x7'),'whatsappPause',_0x613b('0xe'),_0x613b('0xf'),_0x613b('0x10'),_0x613b('0x11'),'smsStatus','voiceStatus',_0x613b('0x13'),_0x613b('0x57'),_0x613b('0x62'),_0x613b('0x58'),_0x613b('0x63'),_0x613b('0x59'),_0x613b('0x64'),_0x613b('0x5a'),_0x613b('0x65'),_0x613b('0x50'),_0x613b('0x4d'),_0x613b('0x4c'),_0x613b('0x4e'),_0x613b('0x4f'),'chatCurrentCapacity',_0x613b('0x56'),_0x613b('0x53'),_0x613b('0x52'),'smsCurrentCapacity',_0x613b('0x55'),_0x613b('0x66'),_0x613b('0x5e'),_0x613b('0x5c'),_0x613b('0x67'),_0x613b('0x5b'),_0x613b('0x5d')];}exports[_0x613b('0x68')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xf8f2=['screenrecording','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','length','unknown','unavailable','isNil','voiceStatus','idle','pause','faxStatus','mailStatus','smsStatus','whatsappStatus','request','Agents','result','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','busy','isArray','startCase','Queue','map','findOne','getAgents','flatten','value','getAgentIdsByQueues','includes','filter','getAgentIdsByStatus','resolve','User','findAll','fullname','chatPause','pauseType','globalStatus','getSortedAgentsIdsByStatus','fields','order','ASC','substring','indexOf','internal','validateSortParameter','sort','toLowerCase','DESC','sortAgentsByStatus','online','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','openchannelStatus','chatStatusTime','mailStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','omit','pick','filterAgentAttributes','name','lastLoginAt','smsStatusTime','whatsappStatusTime','smsCapacity','whatsappCapacity','phoneBarEnableAutomaticScreenRecording','onhold'];(function(_0x23dda5,_0x221860){var _0x32c24e=function(_0x431a9d){while(--_0x431a9d){_0x23dda5['push'](_0x23dda5['shift']());}};_0x32c24e(++_0x221860);}(_0xf8f2,0xc2));var _0x2f8f=function(_0x4f706b,_0x195773){_0x4f706b=_0x4f706b-0x0;var _0x3872b4=_0xf8f2[_0x4f706b];return _0x3872b4;};'use strict';var _=require(_0x2f8f('0x0'));var jayson=require(_0x2f8f('0x1'));var db=require(_0x2f8f('0x2'))['db'];var amiClient=jayson[_0x2f8f('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0x2f8f('0x3')][_0x2f8f('0x4')]({'port':0x232c});function isAgentPaused(_0x13ba97,_0xd3f48d){var _0x9fbe3=[_0x13ba97['chatPause'],_0x13ba97[_0x2f8f('0x5')],_0x13ba97[_0x2f8f('0x6')],_0x13ba97[_0x2f8f('0x7')],_0x13ba97[_0x2f8f('0x8')],_0x13ba97[_0x2f8f('0x9')],_0x13ba97[_0x2f8f('0xa')]];if(!_0xd3f48d)return _[_0x2f8f('0xb')](_0x9fbe3);var _0x1237d5=_['filter'](_0x9fbe3);return _0x1237d5[_0x2f8f('0xc')]>0x0&&_0x1237d5[_0x2f8f('0xc')]<_0x9fbe3[_0x2f8f('0xc')]?!![]:![];}function isIdle(_0x3d7e3d){return _0x3d7e3d==='idle'||_0x3d7e3d===_0x2f8f('0xd')||_0x3d7e3d===_0x2f8f('0xe')||_0x3d7e3d==='ringing'||_[_0x2f8f('0xf')](_0x3d7e3d);}function isAgentIdle(_0x88dde7){if(_0x88dde7[_0x2f8f('0x10')]!==_0x2f8f('0x11')&&_0x88dde7['voicePause']){_0x88dde7[_0x2f8f('0x10')]=_0x2f8f('0x12');return![];}return _['every']([_0x88dde7['chatStatus'],_0x88dde7[_0x2f8f('0x13')],_0x88dde7[_0x2f8f('0x14')],_0x88dde7['openchannelStatus'],_0x88dde7[_0x2f8f('0x15')],_0x88dde7[_0x2f8f('0x10')],_0x88dde7[_0x2f8f('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x2f8f('0x17')](_0x2f8f('0x18'),{})['then'](function(_0x5a1baf){if(_0x5a1baf['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x1e34bd=_0x5a1baf[_0x2f8f('0x19')];return routingClient[_0x2f8f('0x17')](_0x2f8f('0x18'),{})[_0x2f8f('0x1a')](function(_0x54a5d2){if(_0x54a5d2['error']){throw new Error(_0x2f8f('0x1b'));}var _0x584925=_0x54a5d2['result'];return _[_0x2f8f('0x1c')]({},_0x1e34bd,_0x584925);});})[_0x2f8f('0x1d')](function(_0x477122){throw _0x477122;});}exports[_0x2f8f('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x3fbcb8){var _0x261a5a=_0x2f8f('0xd');if(isAgentPaused(_0x3fbcb8))_0x261a5a=_0x2f8f('0x12');else if(isAgentPaused(_0x3fbcb8,!![]))_0x261a5a='*pause';else if(isAgentIdle(_0x3fbcb8))_0x261a5a=_0x2f8f('0x11');else _0x261a5a=_0x2f8f('0x1f');return _0x261a5a;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x56083a,_0x305b87){var _0x44fba4=_[_0x2f8f('0x20')](_0x56083a)?_0x56083a:[_0x56083a];var _0x1f3037=_[_0x2f8f('0x21')](_0x305b87)+_0x2f8f('0x22');var _0x35d7ca=_[_0x2f8f('0x23')](_0x44fba4,function(_0xcb3156){return db[_0x1f3037][_0x2f8f('0x24')]({'where':{'id':_0xcb3156}})[_0x2f8f('0x1a')](function(_0xef6b09){if(!_0xef6b09)return[];return _0xef6b09[_0x2f8f('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x35d7ca)[_0x2f8f('0x1a')](function(_0x16dc27){var _0x14dc5f=_(_0x16dc27)[_0x2f8f('0x26')]()[_0x2f8f('0x23')]('id')['uniq']()[_0x2f8f('0x27')]();return _0x14dc5f;});}exports[_0x2f8f('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x4e65d2,_0x47992e,_0x5a4064){try{if(_0x47992e[_0x2f8f('0xc')]>0x0){_0x4e65d2=_0x4e65d2['filter'](function(_0xb6207c){return _0x47992e[_0x2f8f('0x29')](_0xb6207c['id']);});}var _0x125ed5=_0x4e65d2[_0x2f8f('0x2a')](function(_0x2ffba2){var _0x4cb570=_0x2f8f('0x1f');if(isAgentIdle(_0x2ffba2)){_0x4cb570=_0x2f8f('0x11');}return _0x4cb570===_0x5a4064;});return _['map'](_0x125ed5,'id');}catch(_0x151613){throw _0x151613;}}exports[_0x2f8f('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x46cce2,_0xb0800a,_0x2d8d33){return Promise[_0x2f8f('0x2c')]()[_0x2f8f('0x1a')](function(){if(_0xb0800a[_0x2f8f('0xc')]>0x0){_0x46cce2=_0x46cce2[_0x2f8f('0x2a')](function(_0x561c3a){return _0xb0800a[_0x2f8f('0x29')](_0x561c3a['id']);});}return _0x46cce2;})[_0x2f8f('0x1a')](function(){return db[_0x2f8f('0x2d')][_0x2f8f('0x2e')]({'attributes':['id','name',_0x2f8f('0x2f'),_0x2f8f('0x30'),_0x2f8f('0x5'),_0x2f8f('0x6'),_0x2f8f('0x7'),_0x2f8f('0x8'),'voicePause',_0x2f8f('0xa'),_0x2f8f('0x31')],'where':{'id':{'$in':_[_0x2f8f('0x23')](_0x46cce2,'id')}},'raw':!![]});})[_0x2f8f('0x1a')](function(_0x92c520){return _0x92c520[_0x2f8f('0x23')](function(_0x57b2f9){var _0x5ca135=_['find'](_0x46cce2,['id',_0x57b2f9['id']]);var _0x55a33f=filterAgentAttributes(_0x5ca135);_[_0x2f8f('0x1c')](_0x57b2f9,_0x55a33f);_0x57b2f9[_0x2f8f('0x32')]=getAgentStatus(_0x57b2f9);return _0x57b2f9;});})[_0x2f8f('0x1a')](function(_0x2bd883){var _0x3e03ee=sortAgentsByStatus(_0x2bd883,_0x2d8d33);return _[_0x2f8f('0x23')](_0x3e03ee,'id');})[_0x2f8f('0x1d')](function(_0x521167){throw _0x521167;});}exports[_0x2f8f('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x12b7cd){var _0x244a3b={'fields':[],'order':null};var _0x598603=_0x12b7cd['split'](',');_0x244a3b[_0x2f8f('0x34')]=_['filter'](_0x598603,function(_0x4c509b){if(!_0x4c509b['includes'](_0x2f8f('0x32'))){return!![];}_0x244a3b[_0x2f8f('0x35')]=_['startsWith'](_0x4c509b,'-')?'DESC':_0x2f8f('0x36');return![];});return _0x244a3b;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x1dee85){if(!_0x1dee85){_0x1dee85='fullname,internal';}if(_0x1dee85['includes'](_0x2f8f('0x2f'))&&!_0x1dee85['includes']('internal')){var _0x141362=_0x1dee85[_0x2f8f('0x37')](0x0,_0x1dee85[_0x2f8f('0x38')]('fullname'));_0x1dee85+=','+_0x141362+_0x2f8f('0x39');}return _0x1dee85;}exports[_0x2f8f('0x3a')]=validateSortParameter;function sortAgentsByStatus(_0xe1e709,_0xd3137d){var _0x3bd513=_0xe1e709[_0x2f8f('0x3b')](function(_0x2e4bda,_0xaf0bee){if(_0x2e4bda[_0x2f8f('0x32')]===_0xaf0bee[_0x2f8f('0x32')]){if(_0x2e4bda['globalStatus']===_0x2f8f('0x12')){if(_0xd3137d==='DESC'){return(_0x2e4bda['pauseType']||'')<(_0xaf0bee[_0x2f8f('0x31')]||'')||_0x2e4bda['fullname']['toLowerCase']()>_0xaf0bee[_0x2f8f('0x2f')]['toLowerCase']()?0x1:-0x1;}else{return(_0x2e4bda[_0x2f8f('0x31')]||'')<(_0xaf0bee[_0x2f8f('0x31')]||'')||_0x2e4bda[_0x2f8f('0x2f')][_0x2f8f('0x3c')]()>_0xaf0bee[_0x2f8f('0x2f')][_0x2f8f('0x3c')]()?-0x1:0x1;}}else{if(_0xd3137d===_0x2f8f('0x3d')){return _0x2e4bda[_0x2f8f('0x2f')][_0x2f8f('0x3c')]()<_0xaf0bee[_0x2f8f('0x2f')][_0x2f8f('0x3c')]()?0x1:-0x1;}else{return _0x2e4bda[_0x2f8f('0x2f')][_0x2f8f('0x3c')]()<_0xaf0bee[_0x2f8f('0x2f')][_0x2f8f('0x3c')]()?-0x1:0x1;}}}else{if(_0xd3137d===_0x2f8f('0x3d')){return _0x2e4bda[_0x2f8f('0x32')]<_0xaf0bee[_0x2f8f('0x32')]?0x1:-0x1;}else{return _0x2e4bda[_0x2f8f('0x32')]<_0xaf0bee[_0x2f8f('0x32')]?-0x1:0x1;}}});return _0x3bd513;}exports[_0x2f8f('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x2a9f5b){var _0x4bcc19=['userpic',_0x2f8f('0x3f'),'lastLoginAt',_0x2f8f('0x40'),_0x2f8f('0x31'),'lastPauseAt','internal','address',_0x2f8f('0x30'),_0x2f8f('0x7'),_0x2f8f('0x6'),'smsPause',_0x2f8f('0xa'),_0x2f8f('0x5'),_0x2f8f('0x9'),_0x2f8f('0x41'),_0x2f8f('0x42'),_0x2f8f('0x43'),'smsCapacity','whatsappCapacity','faxCapacity',_0x2f8f('0x44'),_0x2f8f('0x45'),_0x2f8f('0x46'),_0x2f8f('0x47'),_0x2f8f('0x48'),_0x2f8f('0x49'),_0x2f8f('0x4a'),_0x2f8f('0x4b'),_0x2f8f('0x14'),_0x2f8f('0x15'),_0x2f8f('0x16'),_0x2f8f('0x13'),_0x2f8f('0x10'),_0x2f8f('0x4c'),'openchannelStatusTime',_0x2f8f('0x4d'),'smsStatusTime','whatsappStatusTime',_0x2f8f('0x4e'),_0x2f8f('0x4f'),_0x2f8f('0x50'),_0x2f8f('0x51'),'screenrecording',_0x2f8f('0x52'),'phoneBarEnableAutomaticScreenRecording'];var _0x2cbd95=['chatPause',_0x2f8f('0x7'),_0x2f8f('0x6'),_0x2f8f('0x8'),_0x2f8f('0xa'),_0x2f8f('0x5'),'voicePause','online'];var _0x5ae093=_(_0x2a9f5b)[_0x2f8f('0x53')](_0x2cbd95)[_0x2f8f('0x54')](_0x4bcc19)[_0x2f8f('0x27')]();return _0x5ae093;}exports[_0x2f8f('0x55')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x2f8f('0x56'),_0x2f8f('0x2f'),'role',_0x2f8f('0x39'),'online',_0x2f8f('0x32'),'userpic',_0x2f8f('0x57'),_0x2f8f('0x31'),_0x2f8f('0x40'),'faxPause',_0x2f8f('0x30'),_0x2f8f('0x6'),_0x2f8f('0x7'),'smsPause',_0x2f8f('0x9'),_0x2f8f('0xa'),_0x2f8f('0x4a'),_0x2f8f('0x13'),_0x2f8f('0x14'),_0x2f8f('0x4b'),_0x2f8f('0x15'),_0x2f8f('0x10'),'whatsappStatus',_0x2f8f('0x4c'),_0x2f8f('0x4e'),'mailStatusTime','openchannelStatusTime',_0x2f8f('0x58'),'voiceStatusTime',_0x2f8f('0x59'),_0x2f8f('0x41'),'faxCapacity',_0x2f8f('0x43'),_0x2f8f('0x42'),_0x2f8f('0x5a'),_0x2f8f('0x5b'),_0x2f8f('0x44'),_0x2f8f('0x49'),_0x2f8f('0x46'),_0x2f8f('0x45'),_0x2f8f('0x47'),_0x2f8f('0x48'),_0x2f8f('0x52'),_0x2f8f('0x5c'),_0x2f8f('0x51'),_0x2f8f('0x5d'),_0x2f8f('0x50'),_0x2f8f('0x5e')];}exports[_0x2f8f('0x5f')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index ab510d4..34ac570 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 _0x31f5=['util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','onHold','ringing','ringInUse','talking','unknown','pTalking','originated','message','statusMessage','Trunk','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','inbound','concat','outbound','map','get','find','merge','initializeQueues','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x31f5,0x197));var _0x531f=function(_0x28912c,_0x217d87){_0x28912c=_0x28912c-0x0;var _0xc1d854=_0x31f5[_0x28912c];return _0xc1d854;};'use strict';var _=require('lodash');var jayson=require(_0x531f('0x0'));var util=require(_0x531f('0x1'));var amiClient=jayson[_0x531f('0x2')][_0x531f('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x531f('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x531f('0x4'),_0x531f('0x5'),_0x531f('0x6'),_0x531f('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x531f('0x8'),_0x531f('0x9'),_0x531f('0xa'),_0x531f('0xb'),'notInUse',_0x531f('0xc'),_0x531f('0xd'),_0x531f('0xe'),_0x531f('0xf'),'unavailable',_0x531f('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x531f('0x11'),_0x531f('0x12'),_0x531f('0x13'),_0x531f('0x14'),'dialActive','dialMethod',_0x531f('0x15'),'startPredictive',_0x531f('0x16'),'erlangCalls',_0x531f('0x17'),_0x531f('0x18'),_0x531f('0x19'),_0x531f('0x1a'),_0x531f('0x1b'),_0x531f('0x1c'),_0x531f('0x1d'),'predictiveIntervalTotalCalls',_0x531f('0x1e'),_0x531f('0x1f'),'predictiveIntervalDroppedCallsCallersExit',_0x531f('0x20'),_0x531f('0x21')];function getRealtimeQueues(_0x7f8cda,_0x5c0f4f){var _0x1fb122=_0x5c0f4f===_0x531f('0x22')?amiClient:routingClient;return _0x1fb122['request'](_[_0x531f('0x23')](_0x5c0f4f)+_0x531f('0x24'),_0x7f8cda)[_0x531f('0x25')](function(_0xecc4be){if(_0xecc4be[_0x531f('0x26')])throw new Error(util[_0x531f('0x27')](_0x531f('0x28'),_0x5c0f4f));return _0xecc4be[_0x531f('0x29')];})['catch'](function(_0xd90ca3){throw _0xd90ca3;});}exports[_0x531f('0x2a')]=getRealtimeQueues;function initializeQueues(_0x102b3b,_0x46bdda,_0x168629,_0x29ae39){var _0x474543=DEFAULT_QUEUE_ATTRIBUTES;if(_0x168629===_0x531f('0x22')){if(_0x29ae39===_0x531f('0x2b')){_0x474543=_0x474543[_0x531f('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x29ae39===_0x531f('0x2d')){_0x474543=_0x474543['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x102b3b[_0x531f('0x2e')](function(_0x4f4be8){var _0x94a43c=_0x4f4be8[_0x531f('0x2f')]({'plain':!![]});_0x94a43c['paused']=0x0;_0x94a43c[_0x531f('0xb')]=0x0;_0x94a43c['loggedIn']=0x0;_0x94a43c[_0x531f('0x4')]=0x0;_0x94a43c[_0x531f('0x7')]=0x0;if(_0x168629==='voice'){_0x94a43c[_0x531f('0xf')]=0x0;_0x94a43c[_0x531f('0x8')]=0x0;if(_0x29ae39==='outbound'){_0x94a43c[_0x531f('0x11')]=0x0;_0x94a43c[_0x531f('0x12')]=0x0;}}var _0x214d0=_[_0x531f('0x30')](_0x46bdda,['id',_0x94a43c['id']]);if(_0x214d0){_[_0x531f('0x31')](_0x94a43c,_['pick'](_0x214d0,_0x474543));}return _0x94a43c;});}exports[_0x531f('0x32')]=initializeQueues; \ No newline at end of file +var _0xeec6=['catch','inbound','concat','outbound','map','get','available','waiting','busy','pTalking','find','merge','initializeQueues','jayson/promise','util','client','http','loggedIn','paused','invalid','loggedInDb','onHold','ringing','ringInUse','unavailable','unknown','originated','statusMessage','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','then','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues'];(function(_0x5af86f,_0x3ef98c){var _0x31097e=function(_0x11b03b){while(--_0x11b03b){_0x5af86f['push'](_0x5af86f['shift']());}};_0x31097e(++_0x3ef98c);}(_0xeec6,0x16b));var _0x6eec=function(_0x3399bb,_0x5e7c53){_0x3399bb=_0x3399bb-0x0;var _0x1afd51=_0xeec6[_0x3399bb];return _0x1afd51;};'use strict';var _=require('lodash');var jayson=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var amiClient=jayson[_0x6eec('0x2')][_0x6eec('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x6eec('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x6eec('0x4'),_0x6eec('0x5'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=['busy','inUse',_0x6eec('0x6'),_0x6eec('0x7'),'notInUse',_0x6eec('0x8'),_0x6eec('0x9'),_0x6eec('0xa'),'talking',_0x6eec('0xb'),_0x6eec('0xc')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x6eec('0xd'),'message',_0x6eec('0xe'),_0x6eec('0xf'),_0x6eec('0x10'),'Trunk',_0x6eec('0x11'),_0x6eec('0x12'),_0x6eec('0x13'),'erlangCallToSecond',_0x6eec('0x14'),_0x6eec('0x15'),_0x6eec('0x16'),_0x6eec('0x17'),_0x6eec('0x18'),_0x6eec('0x19'),_0x6eec('0x1a'),_0x6eec('0x1b'),_0x6eec('0x1c'),_0x6eec('0x1d'),_0x6eec('0x1e'),_0x6eec('0x1f')];function getRealtimeQueues(_0x3e9e01,_0x3fabce){var _0x41fb54=_0x3fabce===_0x6eec('0x20')?amiClient:routingClient;return _0x41fb54[_0x6eec('0x21')](_[_0x6eec('0x22')](_0x3fabce)+'Queues',_0x3e9e01)[_0x6eec('0x23')](function(_0x40b113){if(_0x40b113['error'])throw new Error(util['format'](_0x6eec('0x24'),_0x3fabce));return _0x40b113['result'];})[_0x6eec('0x25')](function(_0x183109){throw _0x183109;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x44840e,_0x18c880,_0x3fdeb0,_0x5a34bf){var _0x113914=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3fdeb0===_0x6eec('0x20')){if(_0x5a34bf===_0x6eec('0x26')){_0x113914=_0x113914[_0x6eec('0x27')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x5a34bf===_0x6eec('0x28')){_0x113914=_0x113914[_0x6eec('0x27')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x44840e[_0x6eec('0x29')](function(_0x19a252){var _0x2584ad=_0x19a252[_0x6eec('0x2a')]({'plain':!![]});_0x2584ad['paused']=0x0;_0x2584ad[_0x6eec('0x7')]=0x0;_0x2584ad['loggedIn']=0x0;_0x2584ad[_0x6eec('0x2b')]=0x0;_0x2584ad[_0x6eec('0x2c')]=0x0;if(_0x3fdeb0===_0x6eec('0x20')){_0x2584ad['talking']=0x0;_0x2584ad[_0x6eec('0x2d')]=0x0;if(_0x5a34bf==='outbound'){_0x2584ad[_0x6eec('0x2e')]=0x0;_0x2584ad[_0x6eec('0xd')]=0x0;}}var _0x2dd3c8=_[_0x6eec('0x2f')](_0x18c880,['id',_0x2584ad['id']]);if(_0x2dd3c8){_[_0x6eec('0x30')](_0x2584ad,_['pick'](_0x2dd3c8,_0x113914));}return _0x2584ad;});}exports[_0x6eec('0x31')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index eff1174..33f348e 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x3590ed,_0x3a4587){var _0x21f72f=function(_0x45be21){while(--_0x45be21){_0x3590ed['push'](_0x3590ed['shift']());}};_0x21f72f(++_0x3a4587);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x4b80e5,_0x3553e6){var _0x298493=function(_0x4a5d61){while(--_0x4a5d61){_0x4b80e5['push'](_0x4b80e5['shift']());}};_0x298493(++_0x3553e6);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 72513d8..c527c9f 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 _0x4ab7=['networkInterfaces','keys','length','filter','family','internal','mac','address','getFirstInterface','cpus','map','model','createHash','update','digest','hex','getUuid','licenseToken','win32','utf8','replace','macAddress','ipAddress','md5','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment'];(function(_0x3882dc,_0x65c004){var _0x3858bb=function(_0x4f7c7c){while(--_0x4f7c7c){_0x3882dc['push'](_0x3882dc['shift']());}};_0x3858bb(++_0x65c004);}(_0x4ab7,0xeb));var _0x74ab=function(_0x26f6cb,_0x518a96){_0x26f6cb=_0x26f6cb-0x0;var _0x1277b0=_0x4ab7[_0x26f6cb];return _0x1277b0;};'use strict';var _=require(_0x74ab('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x74ab('0x1'));var exec=require(_0x74ab('0x2'))[_0x74ab('0x3')];var config=require(_0x74ab('0x4'));function getInterfaces(){var _0x47f562=[];var _0x280e06=os[_0x74ab('0x5')]();var _0x5c0043=_['orderBy'](_[_0x74ab('0x6')](_0x280e06));for(var _0x35bfc5=0x0;_0x35bfc5<_0x5c0043[_0x74ab('0x7')];_0x35bfc5++){var _0x461a9b=_0x280e06[_0x5c0043[_0x35bfc5]][_0x74ab('0x8')](function(_0x3fa4ce){return _0x3fa4ce[_0x74ab('0x9')]==='IPv4'&&_0x3fa4ce[_0x74ab('0xa')]===![];});_0x47f562=_0x47f562['concat'](_0x461a9b);}return _0x47f562;}function getFirstInterface(){var _0x4e1504=_['head'](getInterfaces());return{'macAddress':_0x4e1504&&_0x4e1504['mac']?_0x4e1504[_0x74ab('0xb')]:'00:00:00:00:00:00','ipAddress':_0x4e1504&&_0x4e1504[_0x74ab('0xc')]?_0x4e1504[_0x74ab('0xc')]:'127.0.0.1'};}exports[_0x74ab('0xd')]=getFirstInterface;function getCPUhash(){var _0x363fea=_['orderBy'](os[_0x74ab('0xe')]()[_0x74ab('0xf')](function(_0x19b1af){return _0x19b1af[_0x74ab('0x10')];}))['join'](':');return crypto[_0x74ab('0x11')]('md5')[_0x74ab('0x12')](_0x363fea)[_0x74ab('0x13')](_0x74ab('0x14'));}exports[_0x74ab('0x15')]=function(){var _0x2ebfe7=os['platform']();var _0x1b8c53=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x1b8c53['test'](config[_0x74ab('0x16')])){return config['licenseToken'];}else if(_0x2ebfe7===_0x74ab('0x17')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x74ab('0x18')})[_0x74ab('0x19')]('\x0d\x0a','');}else{var _0x50e3fc=getFirstInterface();var _0x3d077d=getCPUhash();var _0x2aeca2=_0x3d077d+'|'+os['hostname']()+'|'+_0x50e3fc[_0x74ab('0x1a')]+'|'+_0x50e3fc[_0x74ab('0x1b')];var _0x4eeefc=crypto[_0x74ab('0x11')](_0x74ab('0x1c'))[_0x74ab('0x12')](_0x2aeca2)['digest'](_0x74ab('0x14'));return _0x4eeefc[_0x74ab('0x1d')](0x0,0x8)+'-'+_0x4eeefc['substring'](0x8,0xc)+'-'+_0x4eeefc['substring'](0xc,0x10)+'-'+_0x4eeefc['substring'](0x10,0x14)+'-'+_0x4eeefc[_0x74ab('0x1d')](0x14);}}; \ No newline at end of file +var _0xd01a=['getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','join','createHash','md5','update','digest','hex'];(function(_0x808cfa,_0x5694b6){var _0x1b6374=function(_0x3bc563){while(--_0x3bc563){_0x808cfa['push'](_0x808cfa['shift']());}};_0x1b6374(++_0x5694b6);}(_0xd01a,0xe9));var _0xad01=function(_0x68d64c,_0x50f4f4){_0x68d64c=_0x68d64c-0x0;var _0x58f48d=_0xd01a[_0x68d64c];return _0x58f48d;};'use strict';var _=require(_0xad01('0x0'));var os=require('os');var crypto=require(_0xad01('0x1'));var machine=require(_0xad01('0x2'));var exec=require(_0xad01('0x3'))[_0xad01('0x4')];var config=require(_0xad01('0x5'));function getInterfaces(){var _0x40a43d=[];var _0x363b95=os[_0xad01('0x6')]();var _0x37eb27=_[_0xad01('0x7')](_['keys'](_0x363b95));for(var _0x1f03c1=0x0;_0x1f03c1<_0x37eb27[_0xad01('0x8')];_0x1f03c1++){var _0x121327=_0x363b95[_0x37eb27[_0x1f03c1]][_0xad01('0x9')](function(_0x41c6d8){return _0x41c6d8[_0xad01('0xa')]===_0xad01('0xb')&&_0x41c6d8[_0xad01('0xc')]===![];});_0x40a43d=_0x40a43d[_0xad01('0xd')](_0x121327);}return _0x40a43d;}function getFirstInterface(){var _0x4be28b=_['head'](getInterfaces());return{'macAddress':_0x4be28b&&_0x4be28b[_0xad01('0xe')]?_0x4be28b[_0xad01('0xe')]:_0xad01('0xf'),'ipAddress':_0x4be28b&&_0x4be28b[_0xad01('0x10')]?_0x4be28b[_0xad01('0x10')]:_0xad01('0x11')};}exports[_0xad01('0x12')]=getFirstInterface;function getCPUhash(){var _0x3b301a=_[_0xad01('0x7')](os['cpus']()[_0xad01('0x13')](function(_0x5e9030){return _0x5e9030['model'];}))[_0xad01('0x14')](':');return crypto[_0xad01('0x15')](_0xad01('0x16'))[_0xad01('0x17')](_0x3b301a)[_0xad01('0x18')](_0xad01('0x19'));}exports[_0xad01('0x1a')]=function(){var _0x14ea79=os[_0xad01('0x1b')]();var _0x1ab98d=/[0-9a-f-]{36}/;if(config[_0xad01('0x1c')]&&_0x1ab98d[_0xad01('0x1d')](config[_0xad01('0x1c')])){return config['licenseToken'];}else if(_0x14ea79===_0xad01('0x1e')){return exec(_0xad01('0x1f'),{'encoding':'utf8'})[_0xad01('0x20')]('\x0d\x0a','');}else{var _0x3b43a9=getFirstInterface();var _0x135736=getCPUhash();var _0x29b4be=_0x135736+'|'+os[_0xad01('0x21')]()+'|'+_0x3b43a9[_0xad01('0x22')]+'|'+_0x3b43a9[_0xad01('0x23')];var _0x191234=crypto['createHash'](_0xad01('0x16'))[_0xad01('0x17')](_0x29b4be)[_0xad01('0x18')](_0xad01('0x19'));return _0x191234[_0xad01('0x24')](0x0,0x8)+'-'+_0x191234[_0xad01('0x24')](0x8,0xc)+'-'+_0x191234[_0xad01('0x24')](0xc,0x10)+'-'+_0x191234[_0xad01('0x24')](0x10,0x14)+'-'+_0x191234[_0xad01('0x24')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 9342526..d70a95a 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 _0x0273=['./hardware','../logger','license','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','message','request-promise','bluebird','version','../../mysqldb'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0x0273,0x71));var _0x3027=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0273[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0x3027('0x0'));var BPromise=require(_0x3027('0x1'));var pkginfo=require('pkginfo')(module,_0x3027('0x2'));var db=require(_0x3027('0x3'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x3027('0x4'));var logger=require(_0x3027('0x5'))(_0x3027('0x6'));var HOST=_0x3027('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x332e28){return new BPromise(function(_0x352144,_0x1d1b5f){var _0x35df28=util[_0x3027('0x8')]('%s/api/servers/%s/check?version=%s',HOST,_0x332e28,module[_0x3027('0x9')][_0x3027('0x2')]);if(oldToken){_0x35df28=util[_0x3027('0x8')](_0x3027('0xa'),HOST,_0x332e28,module['exports'][_0x3027('0x2')],oldToken);}var _0x1c4f95={'uri':_0x35df28,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x1c4f95)[_0x3027('0xb')](function(_0x315eed){_0x352144(_0x315eed);})['catch'](function(_0x5512f5){_0x1d1b5f(_0x5512f5);});});}function manageLicense(_0x5b577b,_0x2eb52){var _0x2a8c75=_0x2eb52[_0x3027('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0x2a8c75[_0x3027('0xd')]!==_0x5b577b&&!_0x2a8c75['data2']){oldToken=_0x2a8c75[_0x3027('0xd')];}httpRequest(_0x5b577b)['then'](function(_0x588fc9){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x588fc9[_0x3027('0xe')]){isOldTokenSent=![];if(!_0x2a8c75[_0x3027('0x6')]&&_0x2a8c75[_0x3027('0x6')]!=_0x588fc9['license']||_0x2a8c75[_0x3027('0x6')]&&_0x2a8c75[_0x3027('0xf')]){logger[_0x3027('0x10')](_0x3027('0x11'));}if(_0x2a8c75[_0x3027('0x6')]&&!_0x2a8c75['data2']&&_0x2a8c75['license']!=_0x588fc9[_0x3027('0x6')]){logger[_0x3027('0x10')](_0x3027('0x12'));}if(_0x2a8c75[_0x3027('0x6')]&&!_0x2a8c75[_0x3027('0xf')]&&_0x2a8c75['license']==_0x588fc9[_0x3027('0x6')]){return _0x2eb52;}return _0x2eb52[_0x3027('0x13')]({'data1':_0x5b577b,'data2':null,'license':_0x588fc9[_0x3027('0x6')]});}else{if(_0x588fc9['license']||_0x2a8c75[_0x3027('0x6')]){if(!_0x2a8c75[_0x3027('0xf')]){if(_0x2a8c75['data1']==_0x5b577b){GRAY_PERIOD_REASON=_0x3027('0x14');logger[_0x3027('0x10')](_0x3027('0x15'));}else{GRAY_PERIOD_REASON=_0x3027('0x16');logger[_0x3027('0x10')](_0x3027('0x17'),_0x2a8c75[_0x3027('0xd')],_0x5b577b);}logger[_0x3027('0x10')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x3027('0x18')](),moment()[_0x3027('0x8')]('YYYY-MM-DD\x20HH:mm'));return _0x2eb52[_0x3027('0x13')]({'data2':encryptor[_0x3027('0x19')](moment()['format'](_0x3027('0x1a')))});}else{if(moment()[_0x3027('0x1b')](encryptor[_0x3027('0x1c')](_0x2a8c75['data2']),_0x3027('0x1d'))>DAYS){logger[_0x3027('0x10')](_0x3027('0x1e'),moment()[_0x3027('0x8')](_0x3027('0x1a')));isOldTokenSent=![];return _0x2eb52['update']({'data1':_0x5b577b,'data2':null,'license':null});}}}else{if(_0x2a8c75[_0x3027('0xd')]!=_0x5b577b){logger[_0x3027('0x10')](_0x3027('0x17'),_0x2a8c75[_0x3027('0xd')],_0x5b577b);return _0x2eb52[_0x3027('0x13')]({'data1':_0x5b577b,'data2':null,'license':null});}}}return _0x2eb52;})[_0x3027('0xb')](function(_0x9cdb44){_0x2eb52=_0x9cdb44;})[_0x3027('0x1f')](function(_0x4e806c){logger[_0x3027('0x20')](_0x4e806c['message']);})[_0x3027('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x3027('0x22')](),_0x2eb52);},TIME);});}function defaultLicense(){var _0x16e8eb=hardware[_0x3027('0x22')]();if(_0x16e8eb){return db[_0x3027('0x23')][_0x3027('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x16e8eb}})['spread'](function(_0x56d4e4,_0x419b9d){logger[_0x3027('0x10')](_0x3027('0x25'),_0x16e8eb);manageLicense(_0x16e8eb,_0x56d4e4);})['catch'](function(_0x51ccac){logger[_0x3027('0x20')](_0x51ccac[_0x3027('0x26')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xaa58=['YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','version','../../mysqldb','../../components/encryptor','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','get','data1','data2','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase'];(function(_0x326a2a,_0x4303a4){var _0x1e8f5f=function(_0x3ccc5a){while(--_0x3ccc5a){_0x326a2a['push'](_0x326a2a['shift']());}};_0x1e8f5f(++_0x4303a4);}(_0xaa58,0x1a9));var _0x8aa5=function(_0x4c376b,_0x2a1a2b){_0x4c376b=_0x4c376b-0x0;var _0x228475=_0xaa58[_0x4c376b];return _0x228475;};'use strict';var util=require(_0x8aa5('0x0'));var moment=require(_0x8aa5('0x1'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x8aa5('0x2'));var db=require(_0x8aa5('0x3'))['db'];var encryptor=require(_0x8aa5('0x4'));var hardware=require('./hardware');var logger=require(_0x8aa5('0x5'))('license');var HOST=_0x8aa5('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x10161b){return new BPromise(function(_0x51e235,_0xc9933c){var _0x172756=util[_0x8aa5('0x7')](_0x8aa5('0x8'),HOST,_0x10161b,module[_0x8aa5('0x9')][_0x8aa5('0x2')]);if(oldToken){_0x172756=util[_0x8aa5('0x7')](_0x8aa5('0xa'),HOST,_0x10161b,module[_0x8aa5('0x9')]['version'],oldToken);}var _0x535faf={'uri':_0x172756,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x535faf)[_0x8aa5('0xb')](function(_0x562d64){_0x51e235(_0x562d64);})['catch'](function(_0x322b8b){_0xc9933c(_0x322b8b);});});}function manageLicense(_0x46f90c,_0x5398ce){var _0x4e1775=_0x5398ce[_0x8aa5('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0x4e1775[_0x8aa5('0xd')]!==_0x46f90c&&!_0x4e1775[_0x8aa5('0xe')]){oldToken=_0x4e1775['data1'];}httpRequest(_0x46f90c)['then'](function(_0x33b256){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x33b256[_0x8aa5('0xf')]){isOldTokenSent=![];if(!_0x4e1775[_0x8aa5('0x10')]&&_0x4e1775[_0x8aa5('0x10')]!=_0x33b256['license']||_0x4e1775[_0x8aa5('0x10')]&&_0x4e1775[_0x8aa5('0xe')]){logger[_0x8aa5('0x11')](_0x8aa5('0x12'));}if(_0x4e1775[_0x8aa5('0x10')]&&!_0x4e1775['data2']&&_0x4e1775[_0x8aa5('0x10')]!=_0x33b256['license']){logger[_0x8aa5('0x11')](_0x8aa5('0x13'));}if(_0x4e1775['license']&&!_0x4e1775[_0x8aa5('0xe')]&&_0x4e1775[_0x8aa5('0x10')]==_0x33b256[_0x8aa5('0x10')]){return _0x5398ce;}return _0x5398ce[_0x8aa5('0x14')]({'data1':_0x46f90c,'data2':null,'license':_0x33b256[_0x8aa5('0x10')]});}else{if(_0x33b256[_0x8aa5('0x10')]||_0x4e1775[_0x8aa5('0x10')]){if(!_0x4e1775[_0x8aa5('0xe')]){if(_0x4e1775[_0x8aa5('0xd')]==_0x46f90c){GRAY_PERIOD_REASON='Disabled';logger['info'](_0x8aa5('0x15'));}else{GRAY_PERIOD_REASON=_0x8aa5('0x16');logger[_0x8aa5('0x11')](_0x8aa5('0x17'),_0x4e1775[_0x8aa5('0xd')],_0x46f90c);}logger[_0x8aa5('0x11')](_0x8aa5('0x18'),GRAY_PERIOD_REASON[_0x8aa5('0x19')](),moment()[_0x8aa5('0x7')](_0x8aa5('0x1a')));return _0x5398ce[_0x8aa5('0x14')]({'data2':encryptor[_0x8aa5('0x1b')](moment()[_0x8aa5('0x7')](_0x8aa5('0x1a')))});}else{if(moment()[_0x8aa5('0x1c')](encryptor[_0x8aa5('0x1d')](_0x4e1775['data2']),_0x8aa5('0x1e'))>DAYS){logger[_0x8aa5('0x11')](_0x8aa5('0x1f'),moment()[_0x8aa5('0x7')](_0x8aa5('0x1a')));isOldTokenSent=![];return _0x5398ce['update']({'data1':_0x46f90c,'data2':null,'license':null});}}}else{if(_0x4e1775[_0x8aa5('0xd')]!=_0x46f90c){logger['info'](_0x8aa5('0x17'),_0x4e1775[_0x8aa5('0xd')],_0x46f90c);return _0x5398ce[_0x8aa5('0x14')]({'data1':_0x46f90c,'data2':null,'license':null});}}}return _0x5398ce;})[_0x8aa5('0xb')](function(_0x49e527){_0x5398ce=_0x49e527;})[_0x8aa5('0x20')](function(_0x53ca6a){logger[_0x8aa5('0x21')](_0x53ca6a[_0x8aa5('0x22')]);})[_0x8aa5('0x23')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x5398ce);},TIME);});}function defaultLicense(){var _0x1c154f=hardware['getUuid']();if(_0x1c154f){return db[_0x8aa5('0x24')][_0x8aa5('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x1c154f}})[_0x8aa5('0x26')](function(_0x1251ad,_0x54ba43){logger['info'](_0x8aa5('0x27'),_0x1c154f);manageLicense(_0x1c154f,_0x1251ad);})['catch'](function(_0x3699a6){logger['error'](_0x3699a6[_0x8aa5('0x22')]);});}}exports[_0x8aa5('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 133c3cd..648d752 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 _0x9916=['admin','user','telephone','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','then','catch','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','demo','machineUuid','deadline','add','days','grayReason','changed','disabled','message','sequelize','COUNT','col','role','count'];(function(_0x471462,_0x194a2e){var _0x5db871=function(_0x19fd97){while(--_0x19fd97){_0x471462['push'](_0x471462['shift']());}};_0x5db871(++_0x194a2e);}(_0x9916,0xc6));var _0x6991=function(_0x7d1b39,_0x169a70){_0x7d1b39=_0x7d1b39-0x0;var _0x515a7c=_0x9916[_0x7d1b39];return _0x515a7c;};'use strict';var util=require(_0x6991('0x0'));var _=require(_0x6991('0x1'));var moment=require(_0x6991('0x2'));var BPromise=require(_0x6991('0x3'));var hardware=require('./hardware');var encryptor=require(_0x6991('0x4'));var db=require(_0x6991('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6991('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6991('0x7'),'machineUuid':hardware[_0x6991('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6991('0x9'),'machineUuid':hardware[_0x6991('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x533779){return new BPromise(function(_0x143cfe,_0x2e746c){return db[_0x6991('0xa')][_0x6991('0xb')](_['defaults'](_0x533779,{'raw':!![],'where':{'id':0x1}}))[_0x6991('0xc')](function(_0x304432){return checkLicense(_0x304432,null);})[_0x6991('0xc')](function(_0x142958){_0x143cfe(_0x142958);return;})[_0x6991('0xd')](function(_0x1a955f){_0x2e746c(_0x1a955f);});});}function checkLicense(_0x4bc7bc,_0x2e69d2){if(!_0x4bc7bc){demoLicense[_0x6991('0xe')]=_0x4bc7bc[_0x6991('0xf')];return demoLicense;}try{var _0x369979=_0x2e69d2||_0x4bc7bc['license'];if(_[_0x6991('0x10')](_0x369979)){throw new Error(_0x6991('0x11'));}var _0x3fbd44=_0x4bc7bc['data1'];var _0x3ee039=_0x4bc7bc[_0x6991('0x12')];var _0x928a13=_0x3fbd44[_0x6991('0x13')]('-')[0x4];var _0x113601=_0x3fbd44[_0x6991('0x13')]('-')[0x0];var _0x136fb4=encryptor[_0x6991('0x14')](_0x369979,util[_0x6991('0x15')]('%s:%s:%s',_0x928a13,_0x3fbd44,_0x113601));var _0x6cc50=JSON[_0x6991('0x16')](_0x136fb4);_0x6cc50[_0x6991('0x17')]=![];_0x6cc50['uuid']=_0x3fbd44;_0x6cc50[_0x6991('0x18')]=hardware['getUuid']();if(_0x3ee039){var _0x800bf6=encryptor[_0x6991('0x14')](_0x3ee039);_0x6cc50['gray']=_0x800bf6;_0x6cc50[_0x6991('0x19')]=moment(_0x800bf6)[_0x6991('0x1a')](0x7,_0x6991('0x1b'))[_0x6991('0x15')]();_0x6cc50[_0x6991('0x1c')]=_0x6cc50['uuid']!=_0x6cc50[_0x6991('0x18')]?_0x6991('0x1d'):_0x6991('0x1e');}return _0x6cc50;}catch(_0x39c5d4){breakingLicense[_0x6991('0xe')]=_0x4bc7bc[_0x6991('0xf')];breakingLicense['message']=_0x39c5d4[_0x6991('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1285a4,_0x56d634){getLicense()[_0x6991('0xc')](function(_0x1f86fe){return db['User']['findAll']({'attributes':['role',[db[_0x6991('0x20')]['fn'](_0x6991('0x21'),db[_0x6991('0x20')][_0x6991('0x22')](_0x6991('0x23'))),_0x6991('0x24')]],'group':'role','where':{'role':{'$or':[_0x6991('0x25'),_0x6991('0x26'),_0x6991('0x27')]}},'raw':!![]})[_0x6991('0xc')](function(_0x46ed71){var _0x3b3874={'user':_0x1f86fe['users']||0x0,'telephone':_0x1f86fe[_0x6991('0x28')]||0x0};_0x46ed71[_0x6991('0x29')](function(_0x40643b){var _0x46f393=_0x40643b[_0x6991('0x23')]===_0x6991('0x25')?'user':_0x40643b[_0x6991('0x23')];_0x3b3874[_0x46f393]-=_0x40643b['count'];if(_0x3b3874[_0x46f393]<0x0)_0x3b3874[_0x46f393]=0x0;});_0x1285a4(_0x3b3874);return;});})[_0x6991('0xd')](function(_0x5ab647){_0x56d634(_0x5ab647);});});}function checkUserLimits(_0xbfc944){return new BPromise(function(_0x8d14c0,_0x26a508){getLimits()[_0x6991('0xc')](function(_0x143eed){var _0x2e20aa=_[_0x6991('0x2a')](_[_0x6991('0x2b')](_0xbfc944,'role'),[_0x6991('0x25'),_0x6991('0x26'),_0x6991('0x27')]);var _0x1ed2fa=(_0x2e20aa[_0x6991('0x25')]||0x0)+(_0x2e20aa[_0x6991('0x26')]||0x0);var _0x2c9bcc=_0x2e20aa[_0x6991('0x27')]||0x0;if(_0x1ed2fa>_0x143eed[_0x6991('0x26')])return _0x26a508(_0x6991('0x2c'));if(_0x2c9bcc>_0x143eed['telephone'])return _0x26a508(_0x6991('0x2d'));return _0x8d14c0();})[_0x6991('0xd')](function(_0x1976ec){_0x26a508(_0x1976ec);});});}module[_0x6991('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xe92d=['uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','parse','machineUuid','deadline','add','days','grayReason','changed','User','findAll','role','sequelize','COUNT','col','count','admin','user','users','telephones','forEach','countBy','telephone','License\x20limit\x20reached\x20for\x20users','lodash','moment','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','then','catch'];(function(_0x4fdaeb,_0x2bcebb){var _0x4ef7f8=function(_0x63b170){while(--_0x63b170){_0x4fdaeb['push'](_0x4fdaeb['shift']());}};_0x4ef7f8(++_0x2bcebb);}(_0xe92d,0xcb));var _0xde92=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe92d[_0x1facfa];return _0x9ec701;};'use strict';var util=require('util');var _=require(_0xde92('0x0'));var moment=require(_0xde92('0x1'));var BPromise=require('bluebird');var hardware=require(_0xde92('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0xde92('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xde92('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xde92('0x5'),'machineUuid':hardware[_0xde92('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xde92('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xde92('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x268350){return new BPromise(function(_0x4e0767,_0x2de982){return db[_0xde92('0x7')][_0xde92('0x8')](_[_0xde92('0x9')](_0x268350,{'raw':!![],'where':{'id':0x1}}))[_0xde92('0xa')](function(_0x140980){return checkLicense(_0x140980,null);})[_0xde92('0xa')](function(_0x39d809){_0x4e0767(_0x39d809);return;})[_0xde92('0xb')](function(_0x36b5db){_0x2de982(_0x36b5db);});});}function checkLicense(_0x20433b,_0xf72e62){if(!_0x20433b){demoLicense[_0xde92('0xc')]=_0x20433b[_0xde92('0xd')];return demoLicense;}try{var _0x2141eb=_0xf72e62||_0x20433b[_0xde92('0xe')];if(_[_0xde92('0xf')](_0x2141eb)){throw new Error(_0xde92('0x10'));}var _0x32da6c=_0x20433b['data1'];var _0x295b32=_0x20433b['data2'];var _0x7a7b73=_0x32da6c[_0xde92('0x11')]('-')[0x4];var _0x1c0328=_0x32da6c[_0xde92('0x11')]('-')[0x0];var _0x3794e5=encryptor[_0xde92('0x12')](_0x2141eb,util[_0xde92('0x13')](_0xde92('0x14'),_0x7a7b73,_0x32da6c,_0x1c0328));var _0x269cfa=JSON[_0xde92('0x15')](_0x3794e5);_0x269cfa['demo']=![];_0x269cfa[_0xde92('0xc')]=_0x32da6c;_0x269cfa[_0xde92('0x16')]=hardware[_0xde92('0x6')]();if(_0x295b32){var _0x38b9b8=encryptor[_0xde92('0x12')](_0x295b32);_0x269cfa['gray']=_0x38b9b8;_0x269cfa[_0xde92('0x17')]=moment(_0x38b9b8)[_0xde92('0x18')](0x7,_0xde92('0x19'))['format']();_0x269cfa[_0xde92('0x1a')]=_0x269cfa[_0xde92('0xc')]!=_0x269cfa[_0xde92('0x16')]?_0xde92('0x1b'):'disabled';}return _0x269cfa;}catch(_0x3ff359){breakingLicense[_0xde92('0xc')]=_0x20433b['data1'];breakingLicense['message']=_0x3ff359['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3639ed,_0x5ec509){getLicense()[_0xde92('0xa')](function(_0x2e81f1){return db[_0xde92('0x1c')][_0xde92('0x1d')]({'attributes':[_0xde92('0x1e'),[db[_0xde92('0x1f')]['fn'](_0xde92('0x20'),db['sequelize'][_0xde92('0x21')]('role')),_0xde92('0x22')]],'group':_0xde92('0x1e'),'where':{'role':{'$or':[_0xde92('0x23'),_0xde92('0x24'),'telephone']}},'raw':!![]})[_0xde92('0xa')](function(_0x50067d){var _0x375a02={'user':_0x2e81f1[_0xde92('0x25')]||0x0,'telephone':_0x2e81f1[_0xde92('0x26')]||0x0};_0x50067d[_0xde92('0x27')](function(_0x53c2ee){var _0x20190a=_0x53c2ee[_0xde92('0x1e')]===_0xde92('0x23')?_0xde92('0x24'):_0x53c2ee['role'];_0x375a02[_0x20190a]-=_0x53c2ee[_0xde92('0x22')];if(_0x375a02[_0x20190a]<0x0)_0x375a02[_0x20190a]=0x0;});_0x3639ed(_0x375a02);return;});})[_0xde92('0xb')](function(_0x5c99ec){_0x5ec509(_0x5c99ec);});});}function checkUserLimits(_0x2f168f){return new BPromise(function(_0x170ee4,_0x4e70a7){getLimits()[_0xde92('0xa')](function(_0x15e4cc){var _0x5eb946=_['pick'](_[_0xde92('0x28')](_0x2f168f,_0xde92('0x1e')),[_0xde92('0x23'),'user',_0xde92('0x29')]);var _0x1a725a=(_0x5eb946['admin']||0x0)+(_0x5eb946[_0xde92('0x24')]||0x0);var _0x374ec7=_0x5eb946[_0xde92('0x29')]||0x0;if(_0x1a725a>_0x15e4cc[_0xde92('0x24')])return _0x4e70a7(_0xde92('0x2a'));if(_0x374ec7>_0x15e4cc['telephone'])return _0x4e70a7('License\x20limit\x20reached\x20for\x20telephones');return _0x170ee4();})['catch'](function(_0x4d6071){_0x4e70a7(_0x4d6071);});});}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 b0f055f..09ce254 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 _0xefda=['exports','app-id','secret'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0xefda,0x96));var _0xaefd=function(_0x35de26,_0x1e4713){_0x35de26=_0x35de26-0x0;var _0x419e50=_0xefda[_0x35de26];return _0x419e50;};'use strict';module[_0xaefd('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xaefd('0x1'),'GOOGLE_SECRET':_0xaefd('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x8f59=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8f59,0x11d));var _0x98f5=function(_0x3376bd,_0x4fdb2a){_0x3376bd=_0x3376bd-0x0;var _0x587b0b=_0x8f59[_0x3376bd];return _0x587b0b;};'use strict';module[_0x98f5('0x0')]={'DOMAIN':_0x98f5('0x1'),'SESSION_SECRET':_0x98f5('0x2'),'GOOGLE_ID':_0x98f5('0x3'),'GOOGLE_SECRET':_0x98f5('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 6eb5a94..92264f6 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x932a=['exports','../utils/loggers','fileLogger'];(function(_0x30a5e0,_0x63c81d){var _0x238a27=function(_0x2c80c4){while(--_0x2c80c4){_0x30a5e0['push'](_0x30a5e0['shift']());}};_0x238a27(++_0x63c81d);}(_0x932a,0x160));var _0xa932=function(_0x21d849,_0xc0fde0){_0x21d849=_0x21d849-0x0;var _0x42c3f6=_0x932a[_0x21d849];return _0x42c3f6;};'use strict';var fileLogger=require(_0xa932('0x0'))[_0xa932('0x1')];module[_0xa932('0x2')]=fileLogger; \ No newline at end of file +var _0x30b9=['../utils/loggers','fileLogger','exports'];(function(_0x44f301,_0x21ac8c){var _0x135e0e=function(_0x3952d1){while(--_0x3952d1){_0x44f301['push'](_0x44f301['shift']());}};_0x135e0e(++_0x21ac8c);}(_0x30b9,0xae));var _0x930b=function(_0x1e3aac,_0x5118ba){_0x1e3aac=_0x1e3aac-0x0;var _0x4e72d0=_0x30b9[_0x1e3aac];return _0x4e72d0;};'use strict';var fileLogger=require(_0x930b('0x0'))[_0x930b('0x1')];module[_0x930b('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 5d0a126..895d929 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 _0x5a56=['../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','path','../../config/environment','resolve','root','legacy-libs','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js'];(function(_0x303310,_0x3d6211){var _0x1e4370=function(_0x1d648){while(--_0x1d648){_0x303310['push'](_0x303310['shift']());}};_0x1e4370(++_0x3d6211);}(_0x5a56,0x112));var _0x65a5=function(_0x47a2ab,_0x5ecea1){_0x47a2ab=_0x47a2ab-0x0;var _0x5cfa39=_0x5a56[_0x47a2ab];return _0x5cfa39;};'use strict';var path=require(_0x65a5('0x0'));var cfg=require(_0x65a5('0x1'));var env={'NODE_PATH':path[_0x65a5('0x2')](path['join'](cfg[_0x65a5('0x3')],_0x65a5('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0x65a5('0x5')](__dirname,_0x65a5('0x6')),'env':env},{'name':_0x65a5('0x7'),'script':path[_0x65a5('0x5')](__dirname,_0x65a5('0x8')),'env':env},{'name':_0x65a5('0x9'),'script':path[_0x65a5('0x5')](__dirname,_0x65a5('0xa')),'env':env},{'name':'email','script':path[_0x65a5('0x5')](__dirname,_0x65a5('0xb')),'env':env},{'name':_0x65a5('0xc'),'script':path['join'](__dirname,_0x65a5('0xd')),'env':env},{'name':'xdr','script':path[_0x65a5('0x5')](__dirname,_0x65a5('0xe')),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0xb9d0=['path','../../config/environment','resolve','legacy-libs','../../services/express/index.js','ami','../../services/ami/index.js','agi','join','../../services/agi/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0x126e47,_0x19916d){var _0x433282=function(_0x2a9517){while(--_0x2a9517){_0x126e47['push'](_0x126e47['shift']());}};_0x433282(++_0x19916d);}(_0xb9d0,0xff));var _0x0b9d=function(_0x531691,_0x37501b){_0x531691=_0x531691-0x0;var _0x1ad413=_0xb9d0[_0x531691];return _0x1ad413;};'use strict';var path=require(_0x0b9d('0x0'));var cfg=require(_0x0b9d('0x1'));var env={'NODE_PATH':path[_0x0b9d('0x2')](path['join'](cfg['root'],_0x0b9d('0x3')))};var pm2config={'apps':[{'name':'express','script':path['join'](__dirname,_0x0b9d('0x4')),'env':env},{'name':_0x0b9d('0x5'),'script':path['join'](__dirname,_0x0b9d('0x6')),'env':env},{'name':_0x0b9d('0x7'),'script':path[_0x0b9d('0x8')](__dirname,_0x0b9d('0x9')),'env':env},{'name':'email','script':path['join'](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x0b9d('0xa'),'script':path['join'](__dirname,_0x0b9d('0xb')),'env':env},{'name':_0x0b9d('0xc'),'script':path[_0x0b9d('0x8')](__dirname,_0x0b9d('0xd')),'env':env}]};module[_0x0b9d('0xe')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 07eb0ac..b6581b1 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 _0x983f=['restart','list','describe','delete','dump','saved','pm2','bluebird','./config','start','then','disconnect','stop'];(function(_0x2548c5,_0x3b6156){var _0x54b194=function(_0x57ca7d){while(--_0x57ca7d){_0x2548c5['push'](_0x2548c5['shift']());}};_0x54b194(++_0x3b6156);}(_0x983f,0x13e));var _0xf983=function(_0x5e8ae4,_0x77fe95){_0x5e8ae4=_0x5e8ae4-0x0;var _0x170a28=_0x983f[_0x5e8ae4];return _0x170a28;};'use strict';var pm2=require(_0xf983('0x0'));var BPromise=require(_0xf983('0x1'));var config=require(_0xf983('0x2'));function connect(){return new BPromise(function(_0x4858bf,_0x37bb7b){return pm2['connect'](function(_0x127347){if(_0x127347){return _0x37bb7b(_0x127347);}return _0x4858bf('connected');});});};exports[_0xf983('0x3')]=function(_0x449b76){return connect()[_0xf983('0x4')](function(){return new BPromise(function(_0x1d184e,_0xb50fb0){return pm2['start'](_0x449b76,function(_0x591538,_0x311c3d){if(_0x591538){return _0xb50fb0(_0x591538);}pm2[_0xf983('0x5')]();return _0x1d184e(_0x311c3d);});});});};exports[_0xf983('0x6')]=function(_0x41a96f){return connect()['then'](function(){return new BPromise(function(_0x5b4283,_0x6709c7){return pm2[_0xf983('0x6')](_0x41a96f,function(_0x576eb3,_0x9d5782){if(_0x576eb3){return _0x6709c7(_0x576eb3);}pm2[_0xf983('0x5')]();return _0x5b4283(_0x9d5782);});});});};exports[_0xf983('0x7')]=function(_0x1b1fdd){return connect()[_0xf983('0x4')](function(){return new BPromise(function(_0x54852b,_0x276ec1){return pm2[_0xf983('0x7')](_0x1b1fdd,function(_0x247176,_0x53e00e){if(_0x247176){return _0x276ec1(_0x247176);}pm2['disconnect']();return _0x54852b(_0x53e00e);});});});};exports[_0xf983('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x4d281b,_0x15f2ea){return pm2['list'](function(_0x35f467,_0x5940e1){if(_0x35f467){return _0x15f2ea(_0x35f467);}pm2[_0xf983('0x5')]();return _0x4d281b(_0x5940e1);});});});};exports[_0xf983('0x9')]=function(_0x5a65e1){return connect()['then'](function(){return new BPromise(function(_0x5c87b9,_0x1b14ea){return pm2['describe'](_0x5a65e1,function(_0x1173a5,_0x42d014){if(_0x1173a5){return _0x1b14ea(_0x1173a5);}pm2[_0xf983('0x5')]();return _0x5c87b9(_0x42d014);});});});};exports[_0xf983('0xa')]=function(_0x59f3c8){return connect()['then'](function(){return new BPromise(function(_0x1ca628,_0x49d74d){return pm2[_0xf983('0xa')](_0x59f3c8,function(_0x4194a3,_0x1a7a10){if(_0x4194a3){return _0x49d74d(_0x4194a3);}pm2[_0xf983('0x5')]();return _0x1ca628(_0x1a7a10);});});});};exports[_0xf983('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2beb2b,_0x164bb4){return pm2['dump'](function(_0x4773b3){if(_0x4773b3){return _0x164bb4(_0x4773b3);}return _0x2beb2b(_0xf983('0xc'));});});});}; \ No newline at end of file +var _0x96ae=['disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','start','then'];(function(_0x2cb526,_0x12de3e){var _0x25a037=function(_0x31e102){while(--_0x31e102){_0x2cb526['push'](_0x2cb526['shift']());}};_0x25a037(++_0x12de3e);}(_0x96ae,0xda));var _0xe96a=function(_0x3bc04d,_0x28ab50){_0x3bc04d=_0x3bc04d-0x0;var _0x2a543b=_0x96ae[_0x3bc04d];return _0x2a543b;};'use strict';var pm2=require(_0xe96a('0x0'));var BPromise=require(_0xe96a('0x1'));var config=require(_0xe96a('0x2'));function connect(){return new BPromise(function(_0x343dd7,_0x4a77e4){return pm2[_0xe96a('0x3')](function(_0x30d7b3){if(_0x30d7b3){return _0x4a77e4(_0x30d7b3);}return _0x343dd7('connected');});});};exports[_0xe96a('0x4')]=function(_0x22c7d0){return connect()[_0xe96a('0x5')](function(){return new BPromise(function(_0x11511c,_0x12589d){return pm2[_0xe96a('0x4')](_0x22c7d0,function(_0x4f66d6,_0x506b9a){if(_0x4f66d6){return _0x12589d(_0x4f66d6);}pm2[_0xe96a('0x6')]();return _0x11511c(_0x506b9a);});});});};exports[_0xe96a('0x7')]=function(_0x1190bf){return connect()[_0xe96a('0x5')](function(){return new BPromise(function(_0x142338,_0x4120cf){return pm2['stop'](_0x1190bf,function(_0x2aa0a9,_0x2123db){if(_0x2aa0a9){return _0x4120cf(_0x2aa0a9);}pm2[_0xe96a('0x6')]();return _0x142338(_0x2123db);});});});};exports['restart']=function(_0x34cb7e){return connect()['then'](function(){return new BPromise(function(_0x5ad903,_0x2e14f1){return pm2[_0xe96a('0x8')](_0x34cb7e,function(_0x38a5d3,_0x559c37){if(_0x38a5d3){return _0x2e14f1(_0x38a5d3);}pm2[_0xe96a('0x6')]();return _0x5ad903(_0x559c37);});});});};exports[_0xe96a('0x9')]=function(){return connect()[_0xe96a('0x5')](function(){return new BPromise(function(_0x469374,_0x515d7a){return pm2[_0xe96a('0x9')](function(_0x355dad,_0x3ebb51){if(_0x355dad){return _0x515d7a(_0x355dad);}pm2['disconnect']();return _0x469374(_0x3ebb51);});});});};exports[_0xe96a('0xa')]=function(_0x13f029){return connect()[_0xe96a('0x5')](function(){return new BPromise(function(_0x284c16,_0xf7d2a8){return pm2[_0xe96a('0xa')](_0x13f029,function(_0x2be253,_0x21e8ac){if(_0x2be253){return _0xf7d2a8(_0x2be253);}pm2[_0xe96a('0x6')]();return _0x284c16(_0x21e8ac);});});});};exports[_0xe96a('0xb')]=function(_0x57208){return connect()[_0xe96a('0x5')](function(){return new BPromise(function(_0x5b66c5,_0x43ca93){return pm2[_0xe96a('0xb')](_0x57208,function(_0x162e21,_0x4e862e){if(_0x162e21){return _0x43ca93(_0x162e21);}pm2['disconnect']();return _0x5b66c5(_0x4e862e);});});});};exports[_0xe96a('0xc')]=function(){return connect()[_0xe96a('0x5')](function(){return new BPromise(function(_0x1d096c,_0x223c1b){return pm2['dump'](function(_0x546e59){if(_0x546e59){return _0x223c1b(_0x546e59);}return _0x1d096c(_0xe96a('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 84ef1c7..259f710 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 _0x734c=['catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update'];(function(_0x17ab43,_0x5b0523){var _0xbd49e4=function(_0x1e099c){while(--_0x1e099c){_0x17ab43['push'](_0x17ab43['shift']());}};_0xbd49e4(++_0x5b0523);}(_0x734c,0x124));var _0xc734=function(_0x6196b,_0x43bd6e){_0x6196b=_0x6196b-0x0;var _0x2b54a6=_0x734c[_0x6196b];return _0x2b54a6;};'use strict';var _=require('lodash');var moment=require(_0xc734('0x0'));var Redis=require(_0xc734('0x1'));var util=require(_0xc734('0x2'));var config=require(_0xc734('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xc734('0x4'))(_0xc734('0x5'));config[_0xc734('0x6')]=_[_0xc734('0x7')](config[_0xc734('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xc734('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x5b8411=0x0;var _0x3baa59=[];return db['Setting'][_0xc734('0x9')]({'raw':!![],'attributes':['id',_0xc734('0xa')],'where':{'id':0x1}})[_0xc734('0xb')](function(_0x14668f){_0x5b8411=_0x14668f[_0xc734('0xa')];if(_0x5b8411){return db[_0xc734('0xc')][_0xc734('0xd')]({'raw':!![],'attributes':['id',_0xc734('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xc734('0xf')](_0x14668f['chatTimeout'],_0xc734('0x10'))}}});}else{return[];}})[_0xc734('0xb')](function(_0xea1041){if(_0xea1041&&_0xea1041[_0xc734('0x11')]){_0x3baa59=_[_0xc734('0x12')](_0xea1041||[],'id');logger[_0xc734('0x13')](_0xc734('0x14'),_0x3baa59[_0xc734('0x15')]());return db[_0xc734('0xc')][_0xc734('0x16')]({'closeReason':_0xc734('0x17'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0xc734('0x18'))},{'where':{'id':_0x3baa59}});}})[_0xc734('0xb')](function(){if(_0x3baa59&&_0x3baa59[_0xc734('0x11')]){logger[_0xc734('0x13')](_0xc734('0x19'),_0x3baa59['join']());for(var _0x337cc8=0x0;_0x337cc8<_0x3baa59[_0xc734('0x11')];_0x337cc8++){io[_0xc734('0x1a')](_0xc734('0x1b'),{'id':_0x3baa59[_0x337cc8],'closed':!![]});}}})[_0xc734('0x1c')](function(_0x79b9db){logger[_0xc734('0x1d')](_0xc734('0x1e'),_0x79b9db?util[_0xc734('0x1f')](_0x79b9db,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1a8f=['[CHAT]\x20Interactions\x20to\x20close:','join','timeout','format','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info'];(function(_0x3d7478,_0x587549){var _0x2ac749=function(_0x15bf49){while(--_0x15bf49){_0x3d7478['push'](_0x3d7478['shift']());}};_0x2ac749(++_0x587549);}(_0x1a8f,0x95));var _0xf1a8=function(_0x25292e,_0x44f47f){_0x25292e=_0x25292e-0x0;var _0x48de57=_0x1a8f[_0x25292e];return _0x48de57;};'use strict';var _=require(_0xf1a8('0x0'));var moment=require('moment');var Redis=require(_0xf1a8('0x1'));var util=require(_0xf1a8('0x2'));var config=require(_0xf1a8('0x3'));var db=require(_0xf1a8('0x4'))['db'];var logger=require(_0xf1a8('0x5'))('schedule');config[_0xf1a8('0x6')]=_[_0xf1a8('0x7')](config['redis'],{'host':_0xf1a8('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf1a8('0x6')]));function closeInteractions(){var _0x251359=0x0;var _0xbcd66c=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0xf1a8('0x9')],'where':{'id':0x1}})[_0xf1a8('0xa')](function(_0x10e905){_0x251359=_0x10e905['chatTimeout'];if(_0x251359){return db[_0xf1a8('0xb')][_0xf1a8('0xc')]({'raw':!![],'attributes':['id',_0xf1a8('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xf1a8('0xe')](_0x10e905[_0xf1a8('0x9')],_0xf1a8('0xf'))}}});}else{return[];}})['then'](function(_0x44e6fc){if(_0x44e6fc&&_0x44e6fc[_0xf1a8('0x10')]){_0xbcd66c=_[_0xf1a8('0x11')](_0x44e6fc||[],'id');logger[_0xf1a8('0x12')](_0xf1a8('0x13'),_0xbcd66c[_0xf1a8('0x14')]());return db['ChatInteraction']['update']({'closeReason':'system','disposition':_0xf1a8('0x15'),'closed':!![],'closedAt':moment()[_0xf1a8('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xbcd66c}});}})['then'](function(){if(_0xbcd66c&&_0xbcd66c['length']){logger[_0xf1a8('0x12')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0xbcd66c[_0xf1a8('0x14')]());for(var _0x1e9664=0x0;_0x1e9664<_0xbcd66c[_0xf1a8('0x10')];_0x1e9664++){io[_0xf1a8('0x17')](_0xf1a8('0x18'),{'id':_0xbcd66c[_0x1e9664],'closed':!![]});}}})[_0xf1a8('0x19')](function(_0xa121fb){logger[_0xf1a8('0x1a')](_0xf1a8('0x1b'),_0xa121fb?util['inspect'](_0xa121fb,{'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 de29864..f8130ea 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 _0xc52c=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x182140,_0x4d3397){var _0x1a6415=function(_0xcbc8eb){while(--_0xcbc8eb){_0x182140['push'](_0x182140['shift']());}};_0x1a6415(++_0x4d3397);}(_0xc52c,0x6b));var _0xcc52=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0xc52c[_0x14a0a0];return _0x56b651;};'use strict';function start(){var _0x2ad83c=require(_0xcc52('0x0'));return _0x2ad83c[_0xcc52('0x1')]();}module[_0xcc52('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x2932=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x592f2c,_0x458bff){var _0x4669af=function(_0x1338c7){while(--_0x1338c7){_0x592f2c['push'](_0x592f2c['shift']());}};_0x4669af(++_0x458bff);}(_0x2932,0x18e));var _0x2293=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0x2932[_0x178856];return _0x3c7fe7;};'use strict';function start(){var _0x13cb49=require(_0x2293('0x0'));return _0x13cb49[_0x2293('0x1')]();}module[_0x2293('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 a149665..17fdaa3 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 _0x904b=['util','lodash','moment','jayson/promise','bluebird','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','number','AnalyticExtractedReport','findOne','catch','error','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','join','../../files/reports','savename','%s.%s','basename','zip','existsSync','status','Sent','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','message','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','Loading','text','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','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','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','then','stringify','info','email\x20sent','error\x20mail','case\x20loading','currentAttempt','retryOptions','retries','data','operation','stop','case\x20completed','job','case\x20empty','case\x20failed','entity','\x20Attempt\x20#:','report\x20status:','dataValues','sendMail','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','toString','difference','length','delete\x20cron','run\x20job','cron','active','isBetween','startAt','endAt','add','start','deleteJob','exists','update\x20cron','stop\x20cron','run'];(function(_0x103faf,_0x1b2a3d){var _0x3ecd72=function(_0x110ab1){while(--_0x110ab1){_0x103faf['push'](_0x103faf['shift']());}};_0x3ecd72(++_0x1b2a3d);}(_0x904b,0x138));var _0xb904=function(_0xebad11,_0x1ad153){_0xebad11=_0xebad11-0x0;var _0x4dccda=_0x904b[_0xebad11];return _0x4dccda;};'use strict';var fs=require('fs');var util=require(_0xb904('0x0'));var path=require('path');var _=require(_0xb904('0x1'));var moment=require(_0xb904('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xb904('0x3'));var BPromise=require(_0xb904('0x4'));var logger=require('../logger')('schedule');var db=require(_0xb904('0x5'))['db'];const retry=require(_0xb904('0x6'));var analyticCustomReportController=require(_0xb904('0x7'));var analyticDefaultReportController=require(_0xb904('0x8'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x3954d7){const _0x581511={};if(typeof _0x3954d7===_0xb904('0x9')){_0x581511['id']=_0x3954d7;}return db[_0xb904('0xa')][_0xb904('0xb')]({'where':_0x581511})['then'](function(_0x185b75){return _0x185b75;})[_0xb904('0xc')](function(_0x56bfaf){logger[_0xb904('0xd')](_0x56bfaf);});}function handleSendEmail(_0x4cb72c,_0x15595d){logger['info'](_0xb904('0xe'),_0x4cb72c[_0xb904('0xf')]);var _0x24aef5=!![];var _0x4e593b=_0x4cb72c[_0xb904('0x10')]['getSmtpOptions']();var _0x256383={'account':_0x4e593b,'message':{'from':util[_0xb904('0x11')](_0xb904('0x12'),_0x4cb72c[_0xb904('0x10')][_0xb904('0x13')],_0x4cb72c[_0xb904('0x10')][_0xb904('0xf')]||_0x4cb72c[_0xb904('0x10')][_0xb904('0x14')][_0xb904('0x15')]),'to':_0x4cb72c['email'],'cc':_0x4cb72c['cc'],'bcc':_0x4cb72c[_0xb904('0x16')],'subject':util[_0xb904('0x11')](_0xb904('0x17'),_0x15595d[_0xb904('0x13')],_0x4cb72c['subtractNumber'],_0x4cb72c['subtractUnit'])}};var _0xdd2d69=path[_0xb904('0x18')](__dirname,_0xb904('0x19'));var _0xb2146a=_0x15595d[_0xb904('0x1a')];var _0x4950a2=util[_0xb904('0x11')](_0xb904('0x1b'),path[_0xb904('0x1c')](_0x15595d[_0xb904('0x1a')],path['extname'](_0x15595d[_0xb904('0x1a')])),_0xb904('0x1d'));var _0xc7e38c=path['join'](_0xdd2d69,_0xb2146a);var _0x40a9cf=path[_0xb904('0x18')](_0xdd2d69,_0x4950a2);if(fs[_0xb904('0x1e')](_0xc7e38c)){_0x15595d[_0xb904('0x1f')]=_0xb904('0x20');_0x256383['message']['attachments']=[{'filename':_0xb2146a,'path':_0xc7e38c}];_0x256383['message']['text']=util[_0xb904('0x11')](_0xb904('0x21'),JSON['stringify'](_0x15595d,null,0x2));}else if(fs['existsSync'](_0x40a9cf)){_0x15595d[_0xb904('0x1f')]='Sent';_0x256383[_0xb904('0x22')][_0xb904('0x23')]=[{'filename':_0x4950a2,'path':_0x40a9cf}];}else{if(_0x15595d[_0xb904('0x1f')]==='Empty'){_0x256383['message']['text']=_0xb904('0x24');if(!_0x4cb72c['sendIfEmpty']){_0x24aef5=![];logger['info'](_0xb904('0x25'));}}else if(_0x15595d[_0xb904('0x1f')]===_0xb904('0x26')){_0x256383[_0xb904('0x22')][_0xb904('0x27')]=_0xb904('0x28');}else if(_0x15595d[_0xb904('0x1f')]==='Completed'){_0x256383[_0xb904('0x22')][_0xb904('0x27')]=_0xb904('0x29');}else if(_0x15595d[_0xb904('0x1f')]==='Failed'){_0x256383[_0xb904('0x22')]['text']=_0xb904('0x2a');}else{logger[_0xb904('0xd')](_0xb904('0x2b'),_0x15595d['status']);}}if(_0x24aef5){return client[_0xb904('0x2c')](_0xb904('0x2d'),_0x256383)[_0xb904('0x2e')](function(_0x43309f){if(_0x43309f['error']){return logger[_0xb904('0xd')]('error\x20mail',JSON[_0xb904('0x2f')](_0x43309f));}return logger[_0xb904('0x30')](_0xb904('0x31'));})[_0xb904('0xc')](function(_0x32d501){return logger[_0xb904('0xd')](_0xb904('0x32'),JSON[_0xb904('0x2f')](_0x32d501));});}}function handleError(){return function(_0x4c7a93){return logger['error'](JSON[_0xb904('0x2f')](_0x4c7a93));};}function loading(_0x5370b2){logger[_0xb904('0x30')](_0xb904('0x33'));if(_0x5370b2[_0xb904('0x34')]===_0x5370b2[_0xb904('0x35')][_0xb904('0x36')]){handleSendEmail(_0x5370b2['job'],_0x5370b2[_0xb904('0x37')]);_0x5370b2[_0xb904('0x38')][_0xb904('0x39')]();}else{_0x5370b2[_0xb904('0x38')][_0xb904('0x6')]('still\x20loading');}}function completed(_0x25b7fe){logger[_0xb904('0x30')](_0xb904('0x3a'));handleSendEmail(_0x25b7fe[_0xb904('0x3b')],_0x25b7fe['data']);_0x25b7fe[_0xb904('0x38')][_0xb904('0x39')]();}function empty(_0x23ad01){logger['info'](_0xb904('0x3c'));handleSendEmail(_0x23ad01[_0xb904('0x3b')],_0x23ad01[_0xb904('0x37')]);_0x23ad01['operation']['stop']();}function failed(_0x3d80c1){logger[_0xb904('0x30')](_0xb904('0x3d'));handleSendEmail(_0x3d80c1[_0xb904('0x3b')],_0x3d80c1[_0xb904('0x37')]);_0x3d80c1['operation'][_0xb904('0x39')]();}function urecognized(_0x1eafd5){logger[_0xb904('0xd')]('Unrecognized\x20status:',_0x1eafd5[_0xb904('0x3e')]['dataValues']['status']);_0x1eafd5[_0xb904('0x38')][_0xb904('0x39')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0xe1eb4c,_0x4537b4){const _0x588991={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x36a29f=retry['operation'](_0x588991);_0x36a29f['attempt'](_0xb9354=>{logger[_0xb904('0x30')]('Job\x20ID\x20'+_0xe1eb4c['id']+_0xb904('0x3f')+_0xb9354);try{getReportData(_0x4537b4['id'])[_0xb904('0x2e')](function(_0x27d379){_0x4537b4=_0x27d379;logger[_0xb904('0x30')](_0xb904('0x40'),_0x27d379[_0xb904('0x41')]['status']);if(!reportStatusStrategies[_0x27d379['dataValues'][_0xb904('0x1f')]]){logger[_0xb904('0xd')]('report\x20status:',_0x27d379[_0xb904('0x41')][_0xb904('0x1f')]);_0x36a29f[_0xb904('0x6')]();}reportStatusStrategies[_0x27d379[_0xb904('0x41')][_0xb904('0x1f')]]({'operation':_0x36a29f,'currentAttempt':_0xb9354,'retryOptions':_0x588991,'job':_0xe1eb4c,'data':_0x4537b4,'entity':_0x27d379});});}catch(_0xa95f54){_0x36a29f['retry'](_0xa95f54);}});}function handleResult(_0x44e594){return function(_0x1ab157){if(_0x44e594[_0xb904('0x42')]&&_0x44e594[_0xb904('0x10')]&&_0x44e594[_0xb904('0x10')][_0xb904('0x14')]&&!_[_0xb904('0x43')](_0x44e594[_0xb904('0xf')])){retryer(_0x44e594,_0x1ab157);}};}function handleJob(_0x438c55){return function(){try{if(_['isNil'](_0x438c55[_0xb904('0x44')])){return logger[_0xb904('0x30')](_0xb904('0x45'));}if(_[_0xb904('0x43')](_0x438c55[_0xb904('0x46')])){return logger[_0xb904('0x30')](_0xb904('0x47'));}var _0x11e868={'startDate':moment()['subtract'](_0x438c55[_0xb904('0x44')],_0x438c55[_0xb904('0x46')])['format'](_0xb904('0x48')),'endDate':moment()[_0xb904('0x11')](_0xb904('0x48')),'type':_0xb904('0x49'),'output':_0x438c55[_0xb904('0x4a')],'name':_0x438c55['name']};if(!_[_0xb904('0x43')](_0x438c55['DefaultReportId'])){logger[_0xb904('0x30')](_0xb904('0x4b'),_0x438c55['DefaultReportId']);return analyticDefaultReportController[_0xb904('0x4c')]({'id':_0x438c55[_0xb904('0x4d')]},_0x11e868)[_0xb904('0x2e')](handleResult(_0x438c55))['catch'](handleError());}if(!_[_0xb904('0x43')](_0x438c55[_0xb904('0x4e')])){logger[_0xb904('0x30')](_0xb904('0x4f'),_0x438c55['CustomReportId']);return analyticCustomReportController[_0xb904('0x4c')]({'id':_0x438c55[_0xb904('0x4e')]},_0x11e868)['then'](handleResult(_0x438c55))[_0xb904('0xc')](handleError());}}catch(_0x4c987e){logger['error'](JSON['stringify'](_0x4c987e));}return logger[_0xb904('0x30')](_0xb904('0x50'));};}function getJobs(_0x43cfb2){var _0x322548={};if(_0x43cfb2){_0x322548['id']=_0x43cfb2;}return db[_0xb904('0x51')][_0xb904('0x52')]({'where':_0x322548,'include':[{'model':db[_0xb904('0x10')],'attributes':['id','name',_0xb904('0xf')],'include':[{'model':db[_0xb904('0x53')],'as':'Smtp','include':[{'model':db[_0xb904('0x54')],'as':_0xb904('0x54')}]}]}]})[_0xb904('0x2e')](function(_0x1c078f){var _0x4d4cb2=_['keys'](manager[_0xb904('0x55')]);var _0x1c91dc=_[_0xb904('0x56')](_0x1c078f,function(_0x20cf83){return _0x20cf83['id']['toString']();});var _0x461b19=_['keyBy'](_0x1c078f,function(_0x3cdd1b){return _0x3cdd1b['id'][_0xb904('0x57')]();});var _0x1651b2=_0x43cfb2?_0x1c91dc:_[_0xb904('0x58')](_0x1c91dc,_0x4d4cb2);var _0x23bc9d=_['intersection'](_0x1c91dc,_0x4d4cb2);var _0x3764cb=_['difference'](_0x4d4cb2,_0x1c91dc);var _0x7aca85;var _0x236ffc;for(_0x7aca85=0x0;_0x7aca85<_0x3764cb[_0xb904('0x59')]&&!_0x43cfb2;_0x7aca85+=0x1){_0x236ffc=_0x3764cb[_0x7aca85][_0xb904('0x57')]();if(manager['exists'](_0x236ffc)){manager['stop'](_0x236ffc);manager['deleteJob'](_0x236ffc);logger[_0xb904('0x30')](_0xb904('0x5a'),_0x236ffc);}}logger[_0xb904('0x30')]('toRun',JSON[_0xb904('0x2f')](_0x1651b2));for(_0x7aca85=0x0;_0x7aca85<_0x1651b2[_0xb904('0x59')];_0x7aca85+=0x1){_0x236ffc=_0x1651b2[_0x7aca85][_0xb904('0x57')]();if(_0x43cfb2){logger[_0xb904('0x30')](JSON[_0xb904('0x2f')](_0x461b19[_0x236ffc]));BPromise['resolve']()[_0xb904('0x2e')](handleJob(_0x461b19[_0x236ffc]));logger[_0xb904('0x30')](_0xb904('0x5b'),_0x461b19[_0x236ffc][_0xb904('0x13')],_0x461b19[_0x236ffc]['cron']);}else if(_0x461b19[_0x236ffc][_0xb904('0x5c')]&&_0x461b19[_0x236ffc][_0xb904('0x5d')]&&moment()[_0xb904('0x5e')](_0x461b19[_0x236ffc][_0xb904('0x5f')],_0x461b19[_0x236ffc][_0xb904('0x60')])){manager[_0xb904('0x61')](_0x236ffc,_0x461b19[_0x236ffc][_0xb904('0x5c')],handleJob(_0x461b19[_0x236ffc]));manager[_0xb904('0x62')](_0x236ffc);logger['info']('add\x20cron',_0x461b19[_0x236ffc][_0xb904('0x13')],_0x461b19[_0x236ffc]['cron']);}else if(manager['exists'](_0x236ffc)){manager[_0xb904('0x39')](_0x236ffc);manager[_0xb904('0x63')](_0x236ffc);logger[_0xb904('0x30')]('stop\x20cron',_0x461b19[_0x236ffc]['name'],_0x461b19[_0x236ffc][_0xb904('0x5c')]);}}for(_0x7aca85=0x0,_0x236ffc;_0x7aca85<_0x23bc9d[_0xb904('0x59')]&&!_0x43cfb2;_0x7aca85+=0x1){_0x236ffc=_0x23bc9d[_0x7aca85]['toString']();if(manager[_0xb904('0x64')](_0x236ffc)){if(_0x461b19[_0x236ffc][_0xb904('0x5c')]&&_0x461b19[_0x236ffc][_0xb904('0x5d')]&&moment()[_0xb904('0x5e')](_0x461b19[_0x236ffc]['startAt'],_0x461b19[_0x236ffc][_0xb904('0x60')])){manager['update'](_0x236ffc,_0x461b19[_0x236ffc][_0xb904('0x5c')],handleJob(_0x461b19[_0x236ffc]));logger[_0xb904('0x30')](_0xb904('0x65'),_0x461b19[_0x236ffc]['name'],_0x461b19[_0x236ffc][_0xb904('0x5c')]);}else{manager[_0xb904('0x39')](_0x236ffc);manager[_0xb904('0x63')](_0x236ffc);logger['info'](_0xb904('0x66'),_0x461b19[_0x236ffc][_0xb904('0x13')],_0x461b19[_0x236ffc][_0xb904('0x5c')]);}}}})['catch'](function(_0x1bd2be){logger[_0xb904('0xd')](JSON[_0xb904('0x2f')](_0x1bd2be));});}exports[_0xb904('0x67')]=function(_0x5bc0cb){return getJobs(_0x5bc0cb);};exports[_0xb904('0x62')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xa144=['http','AnalyticExtractedReport','findOne','then','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','\x22%s\x22\x20<%s>','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','name','join','savename','%s.%s','extname','zip','existsSync','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','Empty','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','error\x20mail','email\x20sent','case\x20loading','currentAttempt','retryOptions','job','operation','stop','still\x20loading','data','case\x20failed','Unrecognized\x20status:','entity','dataValues','attempt','\x20Attempt\x20#:','report\x20status:','sendMail','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','catch','exec\x20custom\x20report\x20id:%s','runReport','CustomReportId','findAll','MailServerOut','CloudProvider','keys','jobs','keyBy','toString','difference','intersection','length','exists','deleteJob','delete\x20cron','cron','startAt','start','add\x20cron','active','isBetween','endAt','update','update\x20cron','stop\x20cron','run','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client'];(function(_0x2b6d82,_0x4cb5e2){var _0x531824=function(_0x13c44c){while(--_0x13c44c){_0x2b6d82['push'](_0x2b6d82['shift']());}};_0x531824(++_0x4cb5e2);}(_0xa144,0x12d));var _0x4a14=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa144[_0x3b380d];return _0x54502b;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0x4a14('0x0'));var moment=require(_0x4a14('0x1'));var CronJobManager=require(_0x4a14('0x2'));var jayson=require(_0x4a14('0x3'));var BPromise=require(_0x4a14('0x4'));var logger=require(_0x4a14('0x5'))('schedule');var db=require(_0x4a14('0x6'))['db'];const retry=require(_0x4a14('0x7'));var analyticCustomReportController=require(_0x4a14('0x8'));var analyticDefaultReportController=require(_0x4a14('0x9'));var client=jayson[_0x4a14('0xa')][_0x4a14('0xb')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x586081){const _0xbfbd4c={};if(typeof _0x586081==='number'){_0xbfbd4c['id']=_0x586081;}return db[_0x4a14('0xc')][_0x4a14('0xd')]({'where':_0xbfbd4c})[_0x4a14('0xe')](function(_0x295ce6){return _0x295ce6;})['catch'](function(_0x1c8164){logger[_0x4a14('0xf')](_0x1c8164);});}function handleSendEmail(_0x1b308c,_0x1b2b0f){logger[_0x4a14('0x10')](_0x4a14('0x11'),_0x1b308c[_0x4a14('0x12')]);var _0x2a7d26=!![];var _0x38dc27=_0x1b308c[_0x4a14('0x13')]['getSmtpOptions']();var _0x1005f5={'account':_0x38dc27,'message':{'from':util['format'](_0x4a14('0x14'),_0x1b308c['MailAccount']['name'],_0x1b308c[_0x4a14('0x13')]['email']||_0x1b308c[_0x4a14('0x13')][_0x4a14('0x15')][_0x4a14('0x16')]),'to':_0x1b308c[_0x4a14('0x12')],'cc':_0x1b308c['cc'],'bcc':_0x1b308c[_0x4a14('0x17')],'subject':util[_0x4a14('0x18')](_0x4a14('0x19'),_0x1b2b0f[_0x4a14('0x1a')],_0x1b308c['subtractNumber'],_0x1b308c['subtractUnit'])}};var _0x2619a3=path[_0x4a14('0x1b')](__dirname,'../../files/reports');var _0x5ec9ca=_0x1b2b0f[_0x4a14('0x1c')];var _0x50eedc=util['format'](_0x4a14('0x1d'),path['basename'](_0x1b2b0f[_0x4a14('0x1c')],path[_0x4a14('0x1e')](_0x1b2b0f[_0x4a14('0x1c')])),_0x4a14('0x1f'));var _0x4198d2=path['join'](_0x2619a3,_0x5ec9ca);var _0x3e622d=path[_0x4a14('0x1b')](_0x2619a3,_0x50eedc);if(fs[_0x4a14('0x20')](_0x4198d2)){_0x1b2b0f['status']=_0x4a14('0x21');_0x1005f5[_0x4a14('0x22')][_0x4a14('0x23')]=[{'filename':_0x5ec9ca,'path':_0x4198d2}];_0x1005f5[_0x4a14('0x22')]['text']=util[_0x4a14('0x18')](_0x4a14('0x24'),JSON[_0x4a14('0x25')](_0x1b2b0f,null,0x2));}else if(fs['existsSync'](_0x3e622d)){_0x1b2b0f[_0x4a14('0x26')]=_0x4a14('0x21');_0x1005f5[_0x4a14('0x22')][_0x4a14('0x23')]=[{'filename':_0x50eedc,'path':_0x3e622d}];}else{if(_0x1b2b0f[_0x4a14('0x26')]===_0x4a14('0x27')){_0x1005f5[_0x4a14('0x22')][_0x4a14('0x28')]=_0x4a14('0x29');if(!_0x1b308c['sendIfEmpty']){_0x2a7d26=![];logger[_0x4a14('0x10')]('empty\x20file,\x20email\x20not\x20sent');}}else if(_0x1b2b0f[_0x4a14('0x26')]===_0x4a14('0x2a')){_0x1005f5[_0x4a14('0x22')][_0x4a14('0x28')]=_0x4a14('0x2b');}else if(_0x1b2b0f[_0x4a14('0x26')]==='Completed'){_0x1005f5[_0x4a14('0x22')][_0x4a14('0x28')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x1b2b0f['status']===_0x4a14('0x2c')){_0x1005f5['message'][_0x4a14('0x28')]=_0x4a14('0x2d');}else{logger[_0x4a14('0xf')](_0x4a14('0x2e'),_0x1b2b0f[_0x4a14('0x26')]);}}if(_0x2a7d26){return client['request']('SendMail',_0x1005f5)[_0x4a14('0xe')](function(_0xbbd7a9){if(_0xbbd7a9['error']){return logger[_0x4a14('0xf')](_0x4a14('0x2f'),JSON[_0x4a14('0x25')](_0xbbd7a9));}return logger[_0x4a14('0x10')](_0x4a14('0x30'));})['catch'](function(_0x30564c){return logger[_0x4a14('0xf')](_0x4a14('0x2f'),JSON[_0x4a14('0x25')](_0x30564c));});}}function handleError(){return function(_0x4dd938){return logger[_0x4a14('0xf')](JSON['stringify'](_0x4dd938));};}function loading(_0x545525){logger[_0x4a14('0x10')](_0x4a14('0x31'));if(_0x545525[_0x4a14('0x32')]===_0x545525[_0x4a14('0x33')]['retries']){handleSendEmail(_0x545525[_0x4a14('0x34')],_0x545525['data']);_0x545525[_0x4a14('0x35')][_0x4a14('0x36')]();}else{_0x545525[_0x4a14('0x35')]['retry'](_0x4a14('0x37'));}}function completed(_0x5baa90){logger[_0x4a14('0x10')]('case\x20completed');handleSendEmail(_0x5baa90[_0x4a14('0x34')],_0x5baa90[_0x4a14('0x38')]);_0x5baa90[_0x4a14('0x35')][_0x4a14('0x36')]();}function empty(_0x94b680){logger[_0x4a14('0x10')]('case\x20empty');handleSendEmail(_0x94b680[_0x4a14('0x34')],_0x94b680[_0x4a14('0x38')]);_0x94b680[_0x4a14('0x35')][_0x4a14('0x36')]();}function failed(_0x321966){logger['info'](_0x4a14('0x39'));handleSendEmail(_0x321966[_0x4a14('0x34')],_0x321966[_0x4a14('0x38')]);_0x321966[_0x4a14('0x35')][_0x4a14('0x36')]();}function urecognized(_0x100a2d){logger[_0x4a14('0xf')](_0x4a14('0x3a'),_0x100a2d[_0x4a14('0x3b')][_0x4a14('0x3c')]['status']);_0x100a2d['operation']['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x3b8b36,_0x38f625){const _0x217340={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x1302fa=retry[_0x4a14('0x35')](_0x217340);_0x1302fa[_0x4a14('0x3d')](_0x44017a=>{logger[_0x4a14('0x10')]('Job\x20ID\x20'+_0x3b8b36['id']+_0x4a14('0x3e')+_0x44017a);try{getReportData(_0x38f625['id'])[_0x4a14('0xe')](function(_0x1a377e){_0x38f625=_0x1a377e;logger['info'](_0x4a14('0x3f'),_0x1a377e['dataValues'][_0x4a14('0x26')]);if(!reportStatusStrategies[_0x1a377e[_0x4a14('0x3c')][_0x4a14('0x26')]]){logger[_0x4a14('0xf')](_0x4a14('0x3f'),_0x1a377e[_0x4a14('0x3c')][_0x4a14('0x26')]);_0x1302fa[_0x4a14('0x7')]();}reportStatusStrategies[_0x1a377e[_0x4a14('0x3c')][_0x4a14('0x26')]]({'operation':_0x1302fa,'currentAttempt':_0x44017a,'retryOptions':_0x217340,'job':_0x3b8b36,'data':_0x38f625,'entity':_0x1a377e});});}catch(_0x53c0c9){_0x1302fa[_0x4a14('0x7')](_0x53c0c9);}});}function handleResult(_0x438224){return function(_0x183308){if(_0x438224[_0x4a14('0x40')]&&_0x438224[_0x4a14('0x13')]&&_0x438224[_0x4a14('0x13')][_0x4a14('0x15')]&&!_[_0x4a14('0x41')](_0x438224[_0x4a14('0x12')])){retryer(_0x438224,_0x183308);}};}function handleJob(_0x28d677){return function(){try{if(_[_0x4a14('0x41')](_0x28d677[_0x4a14('0x42')])){return logger[_0x4a14('0x10')](_0x4a14('0x43'));}if(_[_0x4a14('0x41')](_0x28d677[_0x4a14('0x44')])){return logger[_0x4a14('0x10')](_0x4a14('0x45'));}var _0x191ff5={'startDate':moment()[_0x4a14('0x46')](_0x28d677[_0x4a14('0x42')],_0x28d677[_0x4a14('0x44')])[_0x4a14('0x18')](_0x4a14('0x47')),'endDate':moment()[_0x4a14('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x4a14('0x48'),'output':_0x28d677[_0x4a14('0x49')],'name':_0x28d677[_0x4a14('0x1a')]};if(!_[_0x4a14('0x41')](_0x28d677['DefaultReportId'])){logger[_0x4a14('0x10')](_0x4a14('0x4a'),_0x28d677[_0x4a14('0x4b')]);return analyticDefaultReportController['runReport']({'id':_0x28d677[_0x4a14('0x4b')]},_0x191ff5)[_0x4a14('0xe')](handleResult(_0x28d677))[_0x4a14('0x4c')](handleError());}if(!_['isNil'](_0x28d677['CustomReportId'])){logger[_0x4a14('0x10')](_0x4a14('0x4d'),_0x28d677['CustomReportId']);return analyticCustomReportController[_0x4a14('0x4e')]({'id':_0x28d677[_0x4a14('0x4f')]},_0x191ff5)[_0x4a14('0xe')](handleResult(_0x28d677))[_0x4a14('0x4c')](handleError());}}catch(_0x64ee45){logger['error'](JSON['stringify'](_0x64ee45));}return logger[_0x4a14('0x10')]('no\x20report\x20id');};}function getJobs(_0x4349c2){var _0x5ba0c8={};if(_0x4349c2){_0x5ba0c8['id']=_0x4349c2;}return db['Schedule'][_0x4a14('0x50')]({'where':_0x5ba0c8,'include':[{'model':db[_0x4a14('0x13')],'attributes':['id',_0x4a14('0x1a'),_0x4a14('0x12')],'include':[{'model':db[_0x4a14('0x51')],'as':_0x4a14('0x15'),'include':[{'model':db[_0x4a14('0x52')],'as':'CloudProvider'}]}]}]})[_0x4a14('0xe')](function(_0x5dae0a){var _0x4c02b7=_[_0x4a14('0x53')](manager[_0x4a14('0x54')]);var _0x692b88=_['map'](_0x5dae0a,function(_0x2a9c70){return _0x2a9c70['id']['toString']();});var _0x5c2441=_[_0x4a14('0x55')](_0x5dae0a,function(_0x2e22f3){return _0x2e22f3['id'][_0x4a14('0x56')]();});var _0x2a851a=_0x4349c2?_0x692b88:_[_0x4a14('0x57')](_0x692b88,_0x4c02b7);var _0x27740f=_[_0x4a14('0x58')](_0x692b88,_0x4c02b7);var _0x1304f2=_[_0x4a14('0x57')](_0x4c02b7,_0x692b88);var _0x19a089;var _0x113c6c;for(_0x19a089=0x0;_0x19a089<_0x1304f2[_0x4a14('0x59')]&&!_0x4349c2;_0x19a089+=0x1){_0x113c6c=_0x1304f2[_0x19a089][_0x4a14('0x56')]();if(manager[_0x4a14('0x5a')](_0x113c6c)){manager['stop'](_0x113c6c);manager[_0x4a14('0x5b')](_0x113c6c);logger[_0x4a14('0x10')](_0x4a14('0x5c'),_0x113c6c);}}logger['info']('toRun',JSON[_0x4a14('0x25')](_0x2a851a));for(_0x19a089=0x0;_0x19a089<_0x2a851a[_0x4a14('0x59')];_0x19a089+=0x1){_0x113c6c=_0x2a851a[_0x19a089][_0x4a14('0x56')]();if(_0x4349c2){logger[_0x4a14('0x10')](JSON['stringify'](_0x5c2441[_0x113c6c]));BPromise['resolve']()['then'](handleJob(_0x5c2441[_0x113c6c]));logger[_0x4a14('0x10')]('run\x20job',_0x5c2441[_0x113c6c]['name'],_0x5c2441[_0x113c6c][_0x4a14('0x5d')]);}else if(_0x5c2441[_0x113c6c][_0x4a14('0x5d')]&&_0x5c2441[_0x113c6c]['active']&&moment()['isBetween'](_0x5c2441[_0x113c6c][_0x4a14('0x5e')],_0x5c2441[_0x113c6c]['endAt'])){manager['add'](_0x113c6c,_0x5c2441[_0x113c6c][_0x4a14('0x5d')],handleJob(_0x5c2441[_0x113c6c]));manager[_0x4a14('0x5f')](_0x113c6c);logger[_0x4a14('0x10')](_0x4a14('0x60'),_0x5c2441[_0x113c6c][_0x4a14('0x1a')],_0x5c2441[_0x113c6c][_0x4a14('0x5d')]);}else if(manager[_0x4a14('0x5a')](_0x113c6c)){manager['stop'](_0x113c6c);manager[_0x4a14('0x5b')](_0x113c6c);logger[_0x4a14('0x10')]('stop\x20cron',_0x5c2441[_0x113c6c][_0x4a14('0x1a')],_0x5c2441[_0x113c6c][_0x4a14('0x5d')]);}}for(_0x19a089=0x0,_0x113c6c;_0x19a089<_0x27740f['length']&&!_0x4349c2;_0x19a089+=0x1){_0x113c6c=_0x27740f[_0x19a089][_0x4a14('0x56')]();if(manager['exists'](_0x113c6c)){if(_0x5c2441[_0x113c6c][_0x4a14('0x5d')]&&_0x5c2441[_0x113c6c][_0x4a14('0x61')]&&moment()[_0x4a14('0x62')](_0x5c2441[_0x113c6c][_0x4a14('0x5e')],_0x5c2441[_0x113c6c][_0x4a14('0x63')])){manager[_0x4a14('0x64')](_0x113c6c,_0x5c2441[_0x113c6c][_0x4a14('0x5d')],handleJob(_0x5c2441[_0x113c6c]));logger['info'](_0x4a14('0x65'),_0x5c2441[_0x113c6c]['name'],_0x5c2441[_0x113c6c][_0x4a14('0x5d')]);}else{manager[_0x4a14('0x36')](_0x113c6c);manager['deleteJob'](_0x113c6c);logger[_0x4a14('0x10')](_0x4a14('0x66'),_0x5c2441[_0x113c6c][_0x4a14('0x1a')],_0x5c2441[_0x113c6c]['cron']);}}}})[_0x4a14('0x4c')](function(_0x1ca690){logger[_0x4a14('0xf')](JSON[_0x4a14('0x25')](_0x1ca690));});}exports[_0x4a14('0x67')]=function(_0x204ab5){return getJobs(_0x204ab5);};exports[_0x4a14('0x5f')]=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 a4f9da5..3226aa8 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 _0x61d0=['update','SentimentScore','Positive','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','resolve','Sentiment','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','catch','start','lodash','request-promise','util','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available'];(function(_0x3124b0,_0x298376){var _0x156cf4=function(_0x57c165){while(--_0x57c165){_0x3124b0['push'](_0x3124b0['shift']());}};_0x156cf4(++_0x298376);}(_0x61d0,0x187));var _0x061d=function(_0x203d64,_0x1ec79c){_0x203d64=_0x203d64-0x0;var _0x462ab3=_0x61d0[_0x203d64];return _0x462ab3;};var _=require(_0x061d('0x0'));var AWS=require('aws-sdk');var rp=require(_0x061d('0x1'));var util=require(_0x061d('0x2'));var BPromise=require('bluebird');var db=require(_0x061d('0x3'))['db'];var logger=require('../../config/logger')(_0x061d('0x4'));function getTranscriptionJob(_0x21af8d,_0x48c88c,_0x441375,_0x152a73){return new Promise(function(_0x14e976,_0x255478){var _0x1edb0c=new AWS[(_0x061d('0x5'))]({'accessKeyId':_0x48c88c,'secretAccessKey':_0x21af8d,'region':_0x441375});_0x1edb0c[_0x061d('0x6')]({'TranscriptionJobName':_0x152a73},function(_0x572b0e,_0x4b6606){if(_0x572b0e){return _0x255478(_0x572b0e);}else{return _0x14e976(_0x4b6606);}});});}function sentiment(_0x54b498,_0x311d7c,_0x5d5a4b,_0x2443db,_0x148e76){return new Promise(function(_0x517437,_0x295620){var _0x1e9b5b=new AWS[(_0x061d('0x7'))]({'accessKeyId':_0x311d7c,'secretAccessKey':_0x54b498,'region':_0x5d5a4b});_0x1e9b5b[_0x061d('0x8')]({'Text':_0x2443db,'LanguageCode':_0x148e76[_0x061d('0x9')](0x0,0x2)},function(_0x14209b,_0x3872fd){if(_0x14209b){return _0x295620(_0x14209b);}else{return _0x517437(_0x3872fd);}});});}function checkTranscribeJob(_0x4827bc,_0x3fed5f,_0x35c760){var _0x1bbe47;return new BPromise(function(_0x237136,_0x35cdaf){logger[_0x061d('0xa')](util[_0x061d('0xb')](_0x061d('0xc'),_0x4827bc['id'],_0x4827bc[_0x061d('0xd')]));return getTranscriptionJob(_0x35c760[_0x061d('0xe')],_0x35c760['data2'],_0x3fed5f[_0x061d('0xf')],_0x4827bc[_0x061d('0xd')])[_0x061d('0x10')](function(_0x4f926b){logger[_0x061d('0xa')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x4827bc['id'],_0x4827bc[_0x061d('0xd')],_0x4f926b[_0x061d('0x11')][_0x061d('0x12')]));if(!_0x4827bc[_0x061d('0x13')]){switch(_0x4f926b['TranscriptionJob'][_0x061d('0x12')]){case _0x061d('0x14'):var _0x3ae47b={'transcribeStatus':_0x4f926b['TranscriptionJob'][_0x061d('0x12')],'fileUri':_0x4f926b[_0x061d('0x11')][_0x061d('0x15')][_0x061d('0x16')]};logger['info'](util[_0x061d('0xb')](_0x061d('0x17'),_0x4827bc['id']));return rp({'uri':_0x4f926b['TranscriptionJob'][_0x061d('0x15')][_0x061d('0x16')],'json':!![]})[_0x061d('0x10')](function(_0x2efddf){logger[_0x061d('0xa')](util[_0x061d('0xb')](_0x061d('0x18'),_0x4827bc['id']));if(_0x2efddf&&_0x2efddf[_0x061d('0x19')]&&_0x2efddf['results'][_0x061d('0x1a')]&&_0x2efddf[_0x061d('0x19')]['transcripts'][_0x061d('0x1b')]){_0x3ae47b[_0x061d('0x13')]='';for(var _0x5b884a=0x0;_0x5b884a<_0x2efddf['results'][_0x061d('0x1a')][_0x061d('0x1b')];_0x5b884a++){_0x3ae47b[_0x061d('0x13')]+=_0x2efddf[_0x061d('0x19')][_0x061d('0x1a')][_0x5b884a][_0x061d('0x1c')]+'';}}return _0x4827bc['update'](_0x3ae47b);})['then'](function(){logger[_0x061d('0xa')](util[_0x061d('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4827bc['id']));if(!_0x4827bc[_0x061d('0x1d')]){throw new db['Sequelize'][(_0x061d('0x1e'))](_0x061d('0x1f'));}if(!_0x3fed5f[_0x061d('0x20')]||!_0x3fed5f[_0x061d('0x21')]||!_0x3fed5f[_0x061d('0x22')]||!_0x3fed5f[_0x061d('0x23')]||!_0x3fed5f[_0x061d('0x24')]){throw new db[(_0x061d('0x25'))][(_0x061d('0x1e'))](_0x061d('0x26'));}if(!_0x3ae47b[_0x061d('0x13')]){throw new Error(_0x061d('0x27'));}if(_0x3fed5f['sentimentAccountId']===_0x35c760['id']){return _0x35c760;}else{return db[_0x061d('0x28')][_0x061d('0x29')]({'where':{'id':_settings[_0x061d('0x21')]}});}})[_0x061d('0x10')](function(_0x545d34){if(!_0x545d34){throw new db[(_0x061d('0x25'))]['ValidationError'](_0x061d('0x2a'));}if(!_0x545d34['data1']||!_0x545d34[_0x061d('0x2b')]){throw new db[(_0x061d('0x25'))]['ValidationError'](_0x061d('0x2c'));}_0x1bbe47=_0x545d34;logger['info'](util[_0x061d('0xb')](_0x061d('0x2d'),_0x4827bc['id']));return sentiment(_0x1bbe47[_0x061d('0xe')],_0x1bbe47[_0x061d('0x2b')],_0x3fed5f[_0x061d('0x22')],_0x3ae47b['fileText'],_0x3fed5f[_0x061d('0x23')]);})[_0x061d('0x10')](function(_0x2cc972){logger[_0x061d('0xa')](util[_0x061d('0xb')](_0x061d('0x2e'),_0x4827bc['id']));return _0x4827bc[_0x061d('0x2f')]({'sentiment':_0x2cc972['Sentiment'],'sPositive':_0x2cc972[_0x061d('0x30')][_0x061d('0x31')],'sNegative':_0x2cc972['SentimentScore'][_0x061d('0x32')],'sMixed':_0x2cc972['SentimentScore'][_0x061d('0x33')],'sNeutral':_0x2cc972[_0x061d('0x30')][_0x061d('0x34')]});})['then'](function(){logger[_0x061d('0xa')](util[_0x061d('0xb')](_0x061d('0x35'),_0x4827bc['id']));_0x237136();});case _0x061d('0x36'):return _0x4827bc['update']({'transcribeStatus':_0x061d('0x36'),'failureReason':_0x4f926b[_0x061d('0x11')][_0x061d('0x37')]})[_0x061d('0x10')](function(){logger[_0x061d('0xa')](util[_0x061d('0xb')](_0x061d('0x35'),_0x4827bc['id']));_0x237136();});default:logger[_0x061d('0xa')](util[_0x061d('0xb')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x4827bc['id']));break;}}else{return BPromise[_0x061d('0x38')]()['then'](function(){if(!_0x4827bc[_0x061d('0x1d')]){throw new db['Sequelize'][(_0x061d('0x1e'))](_0x061d('0x1f'));}if(!_0x3fed5f['sentiment']||!_0x3fed5f['sentimentAccountId']||!_0x3fed5f['sentimentRegion']||!_0x3fed5f[_0x061d('0x23')]||!_0x3fed5f[_0x061d('0x24')]){throw new db['Sequelize'][(_0x061d('0x1e'))](_0x061d('0x26'));}if(!_0x4827bc[_0x061d('0x13')]){throw new Error(_0x061d('0x27'));}if(_0x3fed5f[_0x061d('0x21')]===_0x35c760['id']){return _0x35c760;}else{return db[_0x061d('0x28')][_0x061d('0x29')]({'where':{'id':_settings[_0x061d('0x21')]}});}})[_0x061d('0x10')](function(_0x5cc40e){if(!_0x5cc40e){throw new db[(_0x061d('0x25'))]['ValidationError'](_0x061d('0x2a'));}if(!_0x5cc40e[_0x061d('0xe')]||!_0x5cc40e[_0x061d('0x2b')]){throw new db['Sequelize'][(_0x061d('0x1e'))](_0x061d('0x2c'));}_0x1bbe47=_0x5cc40e;logger[_0x061d('0xa')](util['format'](_0x061d('0x2d'),_0x4827bc['id']));return sentiment(_0x1bbe47[_0x061d('0xe')],_0x1bbe47[_0x061d('0x2b')],_0x3fed5f[_0x061d('0x22')],_0x4827bc[_0x061d('0x13')],_0x3fed5f[_0x061d('0x23')]);})[_0x061d('0x10')](function(_0x1145da){logger[_0x061d('0xa')](util[_0x061d('0xb')](_0x061d('0x2e'),_0x4827bc['id']));return _0x4827bc[_0x061d('0x2f')]({'sentiment':_0x1145da[_0x061d('0x39')],'sPositive':_0x1145da['SentimentScore']['Positive'],'sNegative':_0x1145da[_0x061d('0x30')]['Negative'],'sMixed':_0x1145da[_0x061d('0x30')][_0x061d('0x33')],'sNeutral':_0x1145da[_0x061d('0x30')][_0x061d('0x34')],'transcribeStatus':_0x061d('0x14')});})[_0x061d('0x10')](function(){logger[_0x061d('0xa')](util[_0x061d('0xb')](_0x061d('0x35'),_0x4827bc['id']));_0x237136();});}})['catch'](function(_0x5ee577){if(_0x5ee577){if(!_0x5ee577['name']||_0x5ee577[_0x061d('0x3a')]!==_0x061d('0x3b')){logger[_0x061d('0x3c')](util[_0x061d('0xb')](_0x061d('0x3d'),_0x4827bc['id']),util[_0x061d('0x3e')](_0x5ee577,{'showHidden':![],'depth':null}));}}_0x237136();});});}function checkTranscribe(){var _0x3a06bb;var _0x1e3871;var _0x577ff6;return db[_0x061d('0x3f')]['findAll']({'where':{'transcribeStatus':_0x061d('0x40')}})[_0x061d('0x10')](function(_0x1c9f51){if(!_0x1c9f51||!_0x1c9f51[_0x061d('0x1b')]){throw new db[(_0x061d('0x25'))][(_0x061d('0x1e'))](_0x061d('0x41'));}_0x3a06bb=_0x1c9f51;return db[_0x061d('0x42')][_0x061d('0x29')]({'where':{'id':0x1}});})[_0x061d('0x10')](function(_0x5caf08){if(!_0x5caf08){throw new db['Sequelize'][(_0x061d('0x1e'))](_0x061d('0x43'));}_0x1e3871=_0x5caf08;if(!_0x1e3871[_0x061d('0x4')]||!_0x1e3871['transcribeAccountId']||!_0x1e3871['transcribeRegion']||!_0x1e3871[_0x061d('0x23')]||!_0x1e3871[_0x061d('0x24')]){throw new db[(_0x061d('0x25'))][(_0x061d('0x1e'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x061d('0x29')]({'where':{'id':_0x1e3871[_0x061d('0x44')]}});})[_0x061d('0x10')](function(_0xb3051f){if(!_0xb3051f){throw new db[(_0x061d('0x25'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0xb3051f['data1']||!_0xb3051f['data2']){throw new db[(_0x061d('0x25'))][(_0x061d('0x1e'))](_0x061d('0x2c'));}_0x577ff6=_0xb3051f;var _0x17e213=[];_0x3a06bb[_0x061d('0x45')](function(_0x416c6a){_0x17e213[_0x061d('0x46')](checkTranscribeJob(_0x416c6a,_0x1e3871,_0x577ff6));});return BPromise['all'](_0x17e213);})[_0x061d('0x47')](function(_0xa564b4){if(_0xa564b4){if(!_0xa564b4[_0x061d('0x3a')]||_0xa564b4[_0x061d('0x3a')]!==_0x061d('0x3b')){logger[_0x061d('0x3c')](util['inspect'](_0xa564b4,{'showHidden':![],'depth':null}));}}});}exports[_0x061d('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xe706=['VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','all','catch','error','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','transcribeName','transcribeRegion','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','Transcript','TranscriptFileUri','info','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','fileText','transcripts','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','findOne','Cloud\x20Provider\x20not\x20available','COMPLETED','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect'];(function(_0x4cd7f8,_0x1b9f91){var _0x179122=function(_0x1b2145){while(--_0x1b2145){_0x4cd7f8['push'](_0x4cd7f8['shift']());}};_0x179122(++_0x1b9f91);}(_0xe706,0xa3));var _0x6e70=function(_0x98c519,_0x541919){_0x98c519=_0x98c519-0x0;var _0x3aa2d8=_0xe706[_0x98c519];return _0x3aa2d8;};var _=require(_0x6e70('0x0'));var AWS=require(_0x6e70('0x1'));var rp=require(_0x6e70('0x2'));var util=require('util');var BPromise=require(_0x6e70('0x3'));var db=require(_0x6e70('0x4'))['db'];var logger=require(_0x6e70('0x5'))(_0x6e70('0x6'));function getTranscriptionJob(_0x142c27,_0x2164a4,_0x376a8d,_0x506db9){return new Promise(function(_0x1b0389,_0x4381d1){var _0x36357b=new AWS[(_0x6e70('0x7'))]({'accessKeyId':_0x2164a4,'secretAccessKey':_0x142c27,'region':_0x376a8d});_0x36357b[_0x6e70('0x8')]({'TranscriptionJobName':_0x506db9},function(_0x188ed3,_0x3c4843){if(_0x188ed3){return _0x4381d1(_0x188ed3);}else{return _0x1b0389(_0x3c4843);}});});}function sentiment(_0x449b48,_0x954545,_0x25e61c,_0x100eb7,_0x463853){return new Promise(function(_0x743eb5,_0x3f474a){var _0x37b3e0=new AWS[(_0x6e70('0x9'))]({'accessKeyId':_0x954545,'secretAccessKey':_0x449b48,'region':_0x25e61c});_0x37b3e0['detectSentiment']({'Text':_0x100eb7,'LanguageCode':_0x463853['substring'](0x0,0x2)},function(_0x3594c1,_0x15a1a5){if(_0x3594c1){return _0x3f474a(_0x3594c1);}else{return _0x743eb5(_0x15a1a5);}});});}function checkTranscribeJob(_0x18cf27,_0x27dd9b,_0x3b38f3){var _0x310eb7;return new BPromise(function(_0xa1eb74,_0x181005){logger['info'](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x18cf27['id'],_0x18cf27[_0x6e70('0xa')]));return getTranscriptionJob(_0x3b38f3['data1'],_0x3b38f3['data2'],_0x27dd9b[_0x6e70('0xb')],_0x18cf27[_0x6e70('0xa')])['then'](function(_0x24f3ac){logger['info'](util[_0x6e70('0xc')](_0x6e70('0xd'),_0x18cf27['id'],_0x18cf27['transcribeName'],_0x24f3ac['TranscriptionJob'][_0x6e70('0xe')]));if(!_0x18cf27['fileText']){switch(_0x24f3ac[_0x6e70('0xf')][_0x6e70('0xe')]){case'COMPLETED':var _0x497d61={'transcribeStatus':_0x24f3ac[_0x6e70('0xf')][_0x6e70('0xe')],'fileUri':_0x24f3ac[_0x6e70('0xf')][_0x6e70('0x10')][_0x6e70('0x11')]};logger[_0x6e70('0x12')](util[_0x6e70('0xc')](_0x6e70('0x13'),_0x18cf27['id']));return rp({'uri':_0x24f3ac[_0x6e70('0xf')][_0x6e70('0x10')]['TranscriptFileUri'],'json':!![]})[_0x6e70('0x14')](function(_0x344b65){logger[_0x6e70('0x12')](util['format'](_0x6e70('0x15'),_0x18cf27['id']));if(_0x344b65&&_0x344b65[_0x6e70('0x16')]&&_0x344b65[_0x6e70('0x16')]['transcripts']&&_0x344b65[_0x6e70('0x16')]['transcripts']['length']){_0x497d61['fileText']='';for(var _0x41e352=0x0;_0x41e352<_0x344b65[_0x6e70('0x16')]['transcripts'][_0x6e70('0x17')];_0x41e352++){_0x497d61[_0x6e70('0x18')]+=_0x344b65['results'][_0x6e70('0x19')][_0x41e352][_0x6e70('0x1a')]+'';}}return _0x18cf27[_0x6e70('0x1b')](_0x497d61);})['then'](function(){logger['info'](util[_0x6e70('0xc')](_0x6e70('0x1c'),_0x18cf27['id']));if(!_0x18cf27[_0x6e70('0x1d')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x27dd9b[_0x6e70('0x20')]||!_0x27dd9b[_0x6e70('0x21')]||!_0x27dd9b[_0x6e70('0x22')]||!_0x27dd9b[_0x6e70('0x23')]||!_0x27dd9b[_0x6e70('0x24')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x25'));}if(!_0x497d61[_0x6e70('0x18')]){throw new Error(_0x6e70('0x26'));}if(_0x27dd9b['sentimentAccountId']===_0x3b38f3['id']){return _0x3b38f3;}else{return db[_0x6e70('0x27')]['findOne']({'where':{'id':_settings[_0x6e70('0x21')]}});}})['then'](function(_0xdd7cc1){if(!_0xdd7cc1){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xdd7cc1[_0x6e70('0x28')]||!_0xdd7cc1[_0x6e70('0x29')]){throw new db['Sequelize'][(_0x6e70('0x1f'))](_0x6e70('0x2a'));}_0x310eb7=_0xdd7cc1;logger['info'](util[_0x6e70('0xc')](_0x6e70('0x2b'),_0x18cf27['id']));return sentiment(_0x310eb7[_0x6e70('0x28')],_0x310eb7[_0x6e70('0x29')],_0x27dd9b[_0x6e70('0x22')],_0x497d61[_0x6e70('0x18')],_0x27dd9b[_0x6e70('0x23')]);})[_0x6e70('0x14')](function(_0xf146fd){logger[_0x6e70('0x12')](util['format'](_0x6e70('0x2c'),_0x18cf27['id']));return _0x18cf27['update']({'sentiment':_0xf146fd[_0x6e70('0x2d')],'sPositive':_0xf146fd[_0x6e70('0x2e')][_0x6e70('0x2f')],'sNegative':_0xf146fd[_0x6e70('0x2e')][_0x6e70('0x30')],'sMixed':_0xf146fd[_0x6e70('0x2e')][_0x6e70('0x31')],'sNeutral':_0xf146fd[_0x6e70('0x2e')][_0x6e70('0x32')]});})[_0x6e70('0x14')](function(){logger[_0x6e70('0x12')](util[_0x6e70('0xc')](_0x6e70('0x1c'),_0x18cf27['id']));_0xa1eb74();});case'FAILED':return _0x18cf27['update']({'transcribeStatus':'FAILED','failureReason':_0x24f3ac[_0x6e70('0xf')][_0x6e70('0x33')]})[_0x6e70('0x14')](function(){logger[_0x6e70('0x12')](util[_0x6e70('0xc')](_0x6e70('0x1c'),_0x18cf27['id']));_0xa1eb74();});default:logger['info'](util[_0x6e70('0xc')](_0x6e70('0x34'),_0x18cf27['id']));break;}}else{return BPromise[_0x6e70('0x35')]()[_0x6e70('0x14')](function(){if(!_0x18cf27[_0x6e70('0x1d')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x36'));}if(!_0x27dd9b['sentiment']||!_0x27dd9b[_0x6e70('0x21')]||!_0x27dd9b[_0x6e70('0x22')]||!_0x27dd9b[_0x6e70('0x23')]||!_0x27dd9b[_0x6e70('0x24')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x25'));}if(!_0x18cf27['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x27dd9b['sentimentAccountId']===_0x3b38f3['id']){return _0x3b38f3;}else{return db[_0x6e70('0x27')][_0x6e70('0x37')]({'where':{'id':_settings[_0x6e70('0x21')]}});}})[_0x6e70('0x14')](function(_0x45c83a){if(!_0x45c83a){throw new db['Sequelize'][(_0x6e70('0x1f'))](_0x6e70('0x38'));}if(!_0x45c83a[_0x6e70('0x28')]||!_0x45c83a['data2']){throw new db['Sequelize']['ValidationError'](_0x6e70('0x2a'));}_0x310eb7=_0x45c83a;logger['info'](util[_0x6e70('0xc')](_0x6e70('0x2b'),_0x18cf27['id']));return sentiment(_0x310eb7[_0x6e70('0x28')],_0x310eb7[_0x6e70('0x29')],_0x27dd9b['sentimentRegion'],_0x18cf27[_0x6e70('0x18')],_0x27dd9b['language']);})[_0x6e70('0x14')](function(_0x1e9b06){logger[_0x6e70('0x12')](util[_0x6e70('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x18cf27['id']));return _0x18cf27[_0x6e70('0x1b')]({'sentiment':_0x1e9b06[_0x6e70('0x2d')],'sPositive':_0x1e9b06[_0x6e70('0x2e')][_0x6e70('0x2f')],'sNegative':_0x1e9b06[_0x6e70('0x2e')][_0x6e70('0x30')],'sMixed':_0x1e9b06[_0x6e70('0x2e')]['Mixed'],'sNeutral':_0x1e9b06[_0x6e70('0x2e')][_0x6e70('0x32')],'transcribeStatus':_0x6e70('0x39')});})[_0x6e70('0x14')](function(){logger[_0x6e70('0x12')](util[_0x6e70('0xc')](_0x6e70('0x1c'),_0x18cf27['id']));_0xa1eb74();});}})['catch'](function(_0x3f5c89){if(_0x3f5c89){if(!_0x3f5c89['name']||_0x3f5c89[_0x6e70('0x3a')]!==_0x6e70('0x3b')){logger['error'](util['format'](_0x6e70('0x3c'),_0x18cf27['id']),util[_0x6e70('0x3d')](_0x3f5c89,{'showHidden':![],'depth':null}));}}_0xa1eb74();});});}function checkTranscribe(){var _0x18fa40;var _0x587f04;var _0x4af9b1;return db[_0x6e70('0x3e')][_0x6e70('0x3f')]({'where':{'transcribeStatus':_0x6e70('0x40')}})[_0x6e70('0x14')](function(_0x2e25d5){if(!_0x2e25d5||!_0x2e25d5[_0x6e70('0x17')]){throw new db['Sequelize'][(_0x6e70('0x1f'))](_0x6e70('0x41'));}_0x18fa40=_0x2e25d5;return db[_0x6e70('0x42')][_0x6e70('0x37')]({'where':{'id':0x1}});})[_0x6e70('0x14')](function(_0x4b354e){if(!_0x4b354e){throw new db['Sequelize'][(_0x6e70('0x1f'))](_0x6e70('0x43'));}_0x587f04=_0x4b354e;if(!_0x587f04[_0x6e70('0x6')]||!_0x587f04[_0x6e70('0x44')]||!_0x587f04[_0x6e70('0xb')]||!_0x587f04['language']||!_0x587f04[_0x6e70('0x24')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x45'));}return db[_0x6e70('0x27')]['findOne']({'where':{'id':_0x587f04[_0x6e70('0x44')]}});})[_0x6e70('0x14')](function(_0x2c20d3){if(!_0x2c20d3){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x38'));}if(!_0x2c20d3['data1']||!_0x2c20d3[_0x6e70('0x29')]){throw new db[(_0x6e70('0x1e'))]['ValidationError'](_0x6e70('0x2a'));}_0x4af9b1=_0x2c20d3;var _0xebe5f7=[];_0x18fa40['forEach'](function(_0x3cfaa9){_0xebe5f7[_0x6e70('0x46')](checkTranscribeJob(_0x3cfaa9,_0x587f04,_0x4af9b1));});return BPromise[_0x6e70('0x47')](_0xebe5f7);})[_0x6e70('0x48')](function(_0xfcadfe){if(_0xfcadfe){if(!_0xfcadfe['name']||_0xfcadfe[_0x6e70('0x3a')]!==_0x6e70('0x3b')){logger[_0x6e70('0x49')](util[_0x6e70('0x3d')](_0xfcadfe,{'showHidden':![],'depth':null}));}}});}exports[_0x6e70('0x4a')]=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 2864606..a5a7115 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 _0xe863=['findAll','subtract','hours','map','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','format','YYYY-MM-DD\x20HH:mm:ss','length','info','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','util','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','WhatsappInteraction'];(function(_0x3040ed,_0x31ec54){var _0x195d5a=function(_0x2139cf){while(--_0x2139cf){_0x3040ed['push'](_0x3040ed['shift']());}};_0x195d5a(++_0x31ec54);}(_0xe863,0x1cb));var _0x3e86=function(_0x48360f,_0x4fefcf){_0x48360f=_0x48360f-0x0;var _0x6bd90d=_0xe863[_0x48360f];return _0x6bd90d;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require('ioredis');var util=require(_0x3e86('0x0'));var config=require('../../config/environment');var db=require(_0x3e86('0x1'))['db'];var logger=require(_0x3e86('0x2'))(_0x3e86('0x3'));config['redis']=_[_0x3e86('0x4')](config[_0x3e86('0x5')],{'host':_0x3e86('0x6'),'port':0x18eb});var io=require(_0x3e86('0x7'))(new Redis(config[_0x3e86('0x5')]));function closeInteractions(){var _0x3bf08c=[];return db[_0x3e86('0x8')][_0x3e86('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x3e86('0xa')](0x18,_0x3e86('0xb'))}}})['then'](function(_0x3a9a9e){if(_0x3a9a9e&&_0x3a9a9e['length']){_0x3bf08c=_[_0x3e86('0xc')](_0x3a9a9e||[],'id');logger['info'](_0x3e86('0xd'),_0x3bf08c['join']());return db[_0x3e86('0x8')][_0x3e86('0xe')]({'closeReason':_0x3e86('0xf'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x3e86('0x10')](_0x3e86('0x11'))},{'where':{'id':_0x3bf08c}});}})['then'](function(){if(_0x3bf08c&&_0x3bf08c[_0x3e86('0x12')]){logger[_0x3e86('0x13')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x3bf08c['join']());for(var _0x968377=0x0;_0x968377<_0x3bf08c[_0x3e86('0x12')];_0x968377++){io[_0x3e86('0x14')](_0x3e86('0x15'),{'id':_0x3bf08c[_0x968377],'closed':!![]});}}})[_0x3e86('0x16')](function(_0x1341c7){logger[_0x3e86('0x17')](_0x3e86('0x18'),_0x1341c7?util['inspect'](_0x1341c7,{'showHidden':![],'depth':null}):'');});}exports[_0x3e86('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa091=['lastMsgAt','hours','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','YYYY-MM-DD\x20HH:mm:ss','then','length','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction'];(function(_0x289b59,_0x245c11){var _0x247e8b=function(_0x1acb3a){while(--_0x1acb3a){_0x289b59['push'](_0x289b59['shift']());}};_0x247e8b(++_0x245c11);}(_0xa091,0xf0));var _0x1a09=function(_0x8f2ee8,_0xb1f7d4){_0x8f2ee8=_0x8f2ee8-0x0;var _0x470834=_0xa091[_0x8f2ee8];return _0x470834;};'use strict';var _=require(_0x1a09('0x0'));var moment=require(_0x1a09('0x1'));var Redis=require(_0x1a09('0x2'));var util=require('util');var config=require(_0x1a09('0x3'));var db=require(_0x1a09('0x4'))['db'];var logger=require(_0x1a09('0x5'))(_0x1a09('0x6'));config[_0x1a09('0x7')]=_[_0x1a09('0x8')](config[_0x1a09('0x7')],{'host':_0x1a09('0x9'),'port':0x18eb});var io=require(_0x1a09('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x163e60=[];return db[_0x1a09('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x1a09('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x1a09('0xd'))}}})['then'](function(_0x1d2641){if(_0x1d2641&&_0x1d2641['length']){_0x163e60=_[_0x1a09('0xe')](_0x1d2641||[],'id');logger['info'](_0x1a09('0xf'),_0x163e60[_0x1a09('0x10')]());return db['WhatsappInteraction'][_0x1a09('0x11')]({'closeReason':_0x1a09('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x1a09('0x13'))},{'where':{'id':_0x163e60}});}})[_0x1a09('0x14')](function(){if(_0x163e60&&_0x163e60[_0x1a09('0x15')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x163e60[_0x1a09('0x10')]());for(var _0x85a0a0=0x0;_0x85a0a0<_0x163e60['length'];_0x85a0a0++){io[_0x1a09('0x16')](_0x1a09('0x17'),{'id':_0x163e60[_0x85a0a0],'closed':!![]});}}})[_0x1a09('0x18')](function(_0x466ae5){logger[_0x1a09('0x19')](_0x1a09('0x1a'),_0x466ae5?util[_0x1a09('0x1b')](_0x466ae5,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 036f36b..85aaeb7 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a87=['catch','util','Innocenzo','innocenzo.biondo','push','now','Biondo','CmContact','destroy','then','bulkCreate','log','contacts1','CmHopper','finished\x20populating','hopper1','contacts2','hopper2'];(function(_0x21f410,_0x44a58c){var _0x38496c=function(_0x2f0d2f){while(--_0x2f0d2f){_0x21f410['push'](_0x21f410['shift']());}};_0x38496c(++_0x44a58c);}(_0x4a87,0x1b1));var _0x74a8=function(_0x286fcb,_0x32a4ae){_0x286fcb=_0x286fcb-0x0;var _0x211cae=_0x4a87[_0x286fcb];return _0x211cae;};'use strict';var util=require(_0x74a8('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x74a8('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x74a8('0x2')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x74a8('0x3')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x74a8('0x4')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x74a8('0x3')]({'id':i,'firstName':_0x74a8('0x1')+i,'lastName':_0x74a8('0x5')+i,'phone':0xf879fb460+i,'email':_0x74a8('0x2')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x74a8('0x3')]({'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[_0x74a8('0x4')]()});}db[_0x74a8('0x6')][_0x74a8('0x7')]({'where':{}})[_0x74a8('0x8')](function(){return db[_0x74a8('0x6')][_0x74a8('0x9')](contacts);})[_0x74a8('0x8')](function(){console[_0x74a8('0xa')]('finished\x20populating',_0x74a8('0xb'));return db[_0x74a8('0xc')][_0x74a8('0x7')]({'where':{}});})[_0x74a8('0x8')](function(){return db[_0x74a8('0xc')][_0x74a8('0x9')](hopper);})['then'](function(){console['log'](_0x74a8('0xd'),_0x74a8('0xe'));return db[_0x74a8('0x6')][_0x74a8('0x9')](contacts2);})[_0x74a8('0x8')](function(){console[_0x74a8('0xa')](_0x74a8('0xd'),_0x74a8('0xf'));return db[_0x74a8('0xc')][_0x74a8('0x9')](hopper2);})[_0x74a8('0x8')](function(){console['log']('finished\x20populating',_0x74a8('0x10'));})[_0x74a8('0x11')](function(_0x3a5cb7){console[_0x74a8('0xa')](_0x3a5cb7);}); \ No newline at end of file +var _0x630b=['contacts2','catch','util','push','Biondo','now','Innocenzo','@xcally.com','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','hopper1','bulkCreate'];(function(_0x23d1dd,_0x245d9d){var _0x5744ca=function(_0x225880){while(--_0x225880){_0x23d1dd['push'](_0x23d1dd['shift']());}};_0x5744ca(++_0x245d9d);}(_0x630b,0x145));var _0xb630=function(_0x1f9a46,_0x357428){_0x1f9a46=_0x1f9a46-0x0;var _0x5c7cb0=_0x630b[_0x1f9a46];return _0x5c7cb0;};'use strict';var util=require(_0xb630('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xb630('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xb630('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xb630('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xb630('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb630('0x3')](),'updatedAt':Date[_0xb630('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xb630('0x1')]({'id':i,'firstName':_0xb630('0x4')+i,'lastName':_0xb630('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xb630('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xb630('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb630('0x3')](),'updatedAt':Date[_0xb630('0x3')]()});}db[_0xb630('0x6')][_0xb630('0x7')]({'where':{}})[_0xb630('0x8')](function(){return db[_0xb630('0x6')]['bulkCreate'](contacts);})[_0xb630('0x8')](function(){console[_0xb630('0x9')](_0xb630('0xa'),_0xb630('0xb'));return db[_0xb630('0xc')][_0xb630('0x7')]({'where':{}});})['then'](function(){return db['CmHopper']['bulkCreate'](hopper);})['then'](function(){console['log'](_0xb630('0xa'),_0xb630('0xd'));return db[_0xb630('0x6')][_0xb630('0xe')](contacts2);})[_0xb630('0x8')](function(){console[_0xb630('0x9')](_0xb630('0xa'),_0xb630('0xf'));return db[_0xb630('0xc')][_0xb630('0xe')](hopper2);})[_0xb630('0x8')](function(){console[_0xb630('0x9')](_0xb630('0xa'),'hopper2');})[_0xb630('0x10')](function(_0x9d0eaf){console[_0xb630('0x9')](_0x9d0eaf);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 69463c1..d257102 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbec7=['wss','ulaw','yes','/etc/pki/tls/private/motion.key','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','format','agent','%s%s','%s%s@xcally.com','friend'];(function(_0x4eb833,_0xa3e548){var _0x1ce0e8=function(_0x10f4a6){while(--_0x10f4a6){_0x4eb833['push'](_0x4eb833['shift']());}};_0x1ce0e8(++_0xa3e548);}(_0xbec7,0x1a2));var _0x7bec=function(_0x306909,_0x1393c1){_0x306909=_0x306909-0x0;var _0x328bdb=_0xbec7[_0x306909];return _0x328bdb;};'use strict';var util=require(_0x7bec('0x0'));var db=require(_0x7bec('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x7bec('0x2')]('%s%s',_0x7bec('0x3'),i),'fullname':util[_0x7bec('0x2')](_0x7bec('0x4'),_0x7bec('0x3'),i),'email':util[_0x7bec('0x2')](_0x7bec('0x5'),_0x7bec('0x3'),i),'role':_0x7bec('0x3'),'password':'password','internal':0xfa0+i,'type':_0x7bec('0x6'),'transport':['udp','ws',_0x7bec('0x7')],'disallow':['all'],'allow':[_0x7bec('0x8')],'defaultuser':util[_0x7bec('0x2')](_0x7bec('0x4'),'agent',i),'encryption':'yes','avpf':_0x7bec('0x9'),'force_avp':'yes','icesupport':_0x7bec('0x9'),'dtlsenable':_0x7bec('0x9'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x7bec('0xa'),'dtlssetup':'actpass','callerid':util[_0x7bec('0x2')]('\x22%s\x22\x20<%s>',util[_0x7bec('0x2')](_0x7bec('0x4'),_0x7bec('0x3'),i),0xfa0+i)});}db[_0x7bec('0xb')][_0x7bec('0xc')](users)[_0x7bec('0xd')](function(){console[_0x7bec('0xe')](_0x7bec('0xf'));})[_0x7bec('0x10')](function(_0x495ec9){console[_0x7bec('0xe')](_0x495ec9);}); \ No newline at end of file +var _0x254c=['wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp'];(function(_0x27dd67,_0x1efb4c){var _0x1ef2b8=function(_0x54fbfd){while(--_0x54fbfd){_0x27dd67['push'](_0x27dd67['shift']());}};_0x1ef2b8(++_0x1efb4c);}(_0x254c,0x90));var _0xc254=function(_0x534ba4,_0x346ff4){_0x534ba4=_0x534ba4-0x0;var _0x2ab864=_0x254c[_0x534ba4];return _0x2ab864;};'use strict';var util=require(_0xc254('0x0'));var db=require(_0xc254('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xc254('0x2')]({'name':util[_0xc254('0x3')](_0xc254('0x4'),_0xc254('0x5'),i),'fullname':util[_0xc254('0x3')]('%s%s','agent',i),'email':util[_0xc254('0x3')](_0xc254('0x6'),_0xc254('0x5'),i),'role':'agent','password':_0xc254('0x7'),'internal':0xfa0+i,'type':_0xc254('0x8'),'transport':[_0xc254('0x9'),'ws',_0xc254('0xa')],'disallow':[_0xc254('0xb')],'allow':[_0xc254('0xc')],'defaultuser':util[_0xc254('0x3')](_0xc254('0x4'),_0xc254('0x5'),i),'encryption':_0xc254('0xd'),'avpf':_0xc254('0xd'),'force_avp':_0xc254('0xd'),'icesupport':_0xc254('0xd'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xc254('0xe'),'dtlsprivatekey':_0xc254('0xf'),'dtlssetup':'actpass','callerid':util[_0xc254('0x3')](_0xc254('0x10'),util['format']('%s%s',_0xc254('0x5'),i),0xfa0+i)});}db[_0xc254('0x11')][_0xc254('0x12')](users)[_0xc254('0x13')](function(){console[_0xc254('0x14')](_0xc254('0x15'));})['catch'](function(_0x4f0762){console[_0xc254('0x14')](_0x4f0762);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 6664965..336db46 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x199d=['removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','request','remotePort','connectedAt','SocketIO\x20','address','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','name','role','agent','telephone','type','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','resourceId','map','User','where','Campaign','ivr','format','%s:queue:%s','user:%s','handshake','query','find','userProfileId','MailInteraction','MailInteractions','FaxInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','MailQueue','Trunk','VoiceQueues','SmsQueue','OpenchannelQueue','WhatsappQueue','IvrCampaigns','voice:inbound','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove'];(function(_0x4b8540,_0x545a30){var _0x29a203=function(_0x34c0e8){while(--_0x34c0e8){_0x4b8540['push'](_0x4b8540['shift']());}};_0x29a203(++_0x545a30);}(_0x199d,0x13d));var _0xd199=function(_0x2a8c21,_0x163576){_0x2a8c21=_0x2a8c21-0x0;var _0x5f3061=_0x199d[_0x2a8c21];return _0x5f3061;};'use strict';var _=require(_0xd199('0x0'));var util=require(_0xd199('0x1'));var BPromise=require(_0xd199('0x2'));var db=require(_0xd199('0x3'))['db'];var config=require(_0xd199('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xd199('0x5'),'model':db['User'],'attributes':['id',_0xd199('0x6'),_0xd199('0x7')],'raw':!![],'where':{'role':_0xd199('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xd199('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xd199('0x6')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xd199('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xd199('0x6'),_0xd199('0xa')],'where':{'type':'ivr'}};function getAssociatedResources(_0x2bcbbd,_0x38056d,_0x27cbe6){return db['UserProfileSection'][_0xd199('0xb')]({'where':{'name':_0x2bcbbd,'userProfileId':_0x38056d},'raw':!![]})[_0xd199('0xc')](function(_0x49c25e){if(_0x49c25e){if(_0x49c25e[_0xd199('0xd')]){switch(_0x2bcbbd){case'VoiceQueues':case _0xd199('0xe'):case _0xd199('0xf'):case _0xd199('0x10'):case _0xd199('0x11'):case _0xd199('0x12'):case _0xd199('0x13'):return db[_0x27cbe6][_0xd199('0x14')](queryQueues);case _0xd199('0x15'):return db[_0x27cbe6][_0xd199('0x14')](queryTelephones);case _0xd199('0x16'):return db[_0x27cbe6][_0xd199('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x27cbe6][_0xd199('0x14')](queryCampaigns);}}else{return db['UserProfileResource'][_0xd199('0x14')]({'attributes':[_0xd199('0x17')],'where':{'sectionId':_0x49c25e['id']},'raw':!![]})[_0xd199('0xc')](function(_0x2dacb0){if(_0x2dacb0){var _0x5ee42f={'where':{'id':_[_0xd199('0x18')](_0x2dacb0,_0xd199('0x17'))},'raw':!![]};switch(_0x27cbe6){case _0xd199('0x19'):_0x5ee42f[_0xd199('0x1a')][_0xd199('0x7')]='telephone';break;case _0xd199('0x1b'):_0x5ee42f['where'][_0xd199('0xa')]=_0xd199('0x1c');break;}return db[_0x27cbe6][_0xd199('0x14')](_0x5ee42f);}else{return[];}});}}else{return[];}})[_0xd199('0xc')](function(_0xad26cd){return _0xad26cd;});}function joinOrLeaveQueues(_0x3c997b,_0x2c7fa6,_0x4e3d64,_0x94b9d9){_0x3c997b[_0x2c7fa6](util[_0xd199('0x1d')](_0xd199('0x1e'),_0x4e3d64,_0x94b9d9[_0xd199('0x6')]));if(_0x94b9d9['Agents']){for(var _0x236962=0x0;_0x236962<_0x94b9d9['Agents']['length'];_0x236962+=0x1){_0x3c997b[_0x2c7fa6](util[_0xd199('0x1d')](_0xd199('0x1f'),_0x94b9d9[_0xd199('0x5')][_0x236962]['name']));}}}function joinOrLeave(_0x5a0354,_0x1407ff,_0x237a71){var _0x5653d0;if(_0x5a0354[_0xd199('0x20')][_0xd199('0x21')]['id']){db[_0xd199('0x19')][_0xd199('0x22')]({'attributes':['id',_0xd199('0x6'),_0xd199('0x7'),_0xd199('0x23')],'where':{'id':_0x5a0354[_0xd199('0x20')][_0xd199('0x21')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xd199('0x24')],'as':_0xd199('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xd199('0x26')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xd199('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xd199('0x28')],'as':_0xd199('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xd199('0x2a')],'as':_0xd199('0x2b'),'attributes':['id'],'raw':!![]}]})[_0xd199('0xc')](function(_0x3c1269){if(_0x3c1269){_0x5653d0=_0x3c1269;_0x5a0354[_0x1407ff](util[_0xd199('0x1d')](_0xd199('0x1f'),_0x3c1269[_0xd199('0x6')]));var _0x564110=[];switch(_0x3c1269[_0xd199('0x7')]){case'admin':_0x5a0354[_0x1407ff]('voice:inbound');_0x5a0354[_0x1407ff](_0xd199('0x2c'));if(queryQueues[_0xd199('0x2d')](_0xd199('0x2e'))){delete queryQueues[_0xd199('0x2e')];}_0x564110[_0xd199('0x2f')](db[_0xd199('0x30')]['findAll'](queryQueues));_0x564110[_0xd199('0x2f')](db[_0xd199('0x31')][_0xd199('0x14')](queryQueues));_0x564110[_0xd199('0x2f')](db['FaxQueue'][_0xd199('0x14')](queryQueues));_0x564110[_0xd199('0x2f')](db['SmsQueue']['findAll'](queryQueues));_0x564110['push'](db[_0xd199('0x32')][_0xd199('0x14')](queryQueues));_0x564110[_0xd199('0x2f')](db['OpenchannelQueue']['findAll'](queryQueues));_0x564110[_0xd199('0x2f')](db['WhatsappQueue'][_0xd199('0x14')](queryQueues));_0x564110[_0xd199('0x2f')](db[_0xd199('0x19')][_0xd199('0x14')](queryTelephones));_0x564110['push'](db[_0xd199('0x33')][_0xd199('0x14')](queryTrunks));_0x564110[_0xd199('0x2f')](db[_0xd199('0x1b')][_0xd199('0x14')](queryCampaigns));_0x564110[_0xd199('0x2f')](db[_0xd199('0x19')][_0xd199('0x14')](queryAgents));break;case'user':_0x5a0354[_0x1407ff]('voice:inbound');_0x5a0354[_0x1407ff](_0xd199('0x2c'));_0x564110['push'](getAssociatedResources(_0xd199('0x34'),_0x3c1269[_0xd199('0x23')],_0xd199('0x30')));_0x564110[_0xd199('0x2f')](getAssociatedResources('ChatQueues',_0x3c1269['userProfileId'],_0xd199('0x31')));_0x564110[_0xd199('0x2f')](getAssociatedResources(_0xd199('0xf'),_0x3c1269[_0xd199('0x23')],'FaxQueue'));_0x564110[_0xd199('0x2f')](getAssociatedResources(_0xd199('0x10'),_0x3c1269[_0xd199('0x23')],_0xd199('0x35')));_0x564110[_0xd199('0x2f')](getAssociatedResources(_0xd199('0x11'),_0x3c1269[_0xd199('0x23')],_0xd199('0x32')));_0x564110[_0xd199('0x2f')](getAssociatedResources('OpenchannelQueues',_0x3c1269['userProfileId'],_0xd199('0x36')));_0x564110[_0xd199('0x2f')](getAssociatedResources(_0xd199('0x13'),_0x3c1269[_0xd199('0x23')],_0xd199('0x37')));_0x564110[_0xd199('0x2f')](getAssociatedResources(_0xd199('0x15'),_0x3c1269[_0xd199('0x23')],_0xd199('0x19')));_0x564110[_0xd199('0x2f')](getAssociatedResources(_0xd199('0x16'),_0x3c1269[_0xd199('0x23')],_0xd199('0x33')));_0x564110[_0xd199('0x2f')](getAssociatedResources(_0xd199('0x38'),_0x3c1269['userProfileId'],_0xd199('0x1b')));_0x564110[_0xd199('0x2f')](db[_0xd199('0x19')][_0xd199('0x14')](queryAgents));break;case _0xd199('0x8'):_0x5a0354[_0x1407ff](_0xd199('0x39'));_0x5a0354[_0x1407ff]('voice:outbound');_0x564110['push'](_0x3c1269[_0xd199('0x3a')]({'attributes':['id',_0xd199('0x6')]}));_0x564110[_0xd199('0x2f')](_0x3c1269[_0xd199('0x3b')]({'attributes':['id','name']}));_0x564110[_0xd199('0x2f')](_0x3c1269[_0xd199('0x3c')]({'attributes':['id',_0xd199('0x6')]}));_0x564110[_0xd199('0x2f')](_0x3c1269[_0xd199('0x3d')]({'attributes':['id',_0xd199('0x6')]}));_0x564110[_0xd199('0x2f')](_0x3c1269['getMailQueues']({'attributes':['id',_0xd199('0x6')]}));_0x564110['push'](_0x3c1269['getOpenchannelQueues']({'attributes':['id',_0xd199('0x6')]}));_0x564110[_0xd199('0x2f')](_0x3c1269[_0xd199('0x3e')]({'attributes':['id',_0xd199('0x6')]}));break;}return BPromise[_0xd199('0x3f')](_0x564110);}})['then'](function(_0x3ed4e6){if(_0x3ed4e6&&_0x3ed4e6[_0xd199('0x40')]){for(var _0x5b33ab=0x0;_0x5b33ab<_0x3ed4e6[_0xd199('0x40')];_0x5b33ab+=0x1){for(var _0xab7644=0x0;_0xab7644<_0x3ed4e6[_0x5b33ab]['length'];_0xab7644+=0x1){switch(_0x5b33ab){case 0x0:joinOrLeaveQueues(_0x5a0354,_0x1407ff,_0xd199('0x41'),_0x3ed4e6[_0x5b33ab][_0xab7644]);break;case 0x1:joinOrLeaveQueues(_0x5a0354,_0x1407ff,_0xd199('0x42'),_0x3ed4e6[_0x5b33ab][_0xab7644]);break;case 0x2:joinOrLeaveQueues(_0x5a0354,_0x1407ff,_0xd199('0x43'),_0x3ed4e6[_0x5b33ab][_0xab7644]);break;case 0x3:joinOrLeaveQueues(_0x5a0354,_0x1407ff,_0xd199('0x44'),_0x3ed4e6[_0x5b33ab][_0xab7644]);break;case 0x4:joinOrLeaveQueues(_0x5a0354,_0x1407ff,_0xd199('0x45'),_0x3ed4e6[_0x5b33ab][_0xab7644]);break;case 0x5:joinOrLeaveQueues(_0x5a0354,_0x1407ff,_0xd199('0x46'),_0x3ed4e6[_0x5b33ab][_0xab7644]);break;case 0x6:joinOrLeaveQueues(_0x5a0354,_0x1407ff,_0xd199('0x47'),_0x3ed4e6[_0x5b33ab][_0xab7644]);break;case 0x7:if(_0x5653d0[_0xd199('0x7')]!==_0xd199('0x8'))_0x5a0354[_0x1407ff](util[_0xd199('0x1d')]('telephone:%s',_0x3ed4e6[_0x5b33ab][_0xab7644][_0xd199('0x6')]));break;case 0x8:if(_0x5653d0[_0xd199('0x7')]!==_0xd199('0x8'))_0x5a0354[_0x1407ff](util['format'](_0xd199('0x48'),_0x3ed4e6[_0x5b33ab][_0xab7644]['name']));break;case 0x9:if(_0x5653d0[_0xd199('0x7')]!==_0xd199('0x8'))_0x5a0354[_0x1407ff](util['format'](_0xd199('0x49'),_0x3ed4e6[_0x5b33ab][_0xab7644][_0xd199('0xa')],_0x3ed4e6[_0x5b33ab][_0xab7644][_0xd199('0x6')]));break;case 0xa:_0x5a0354[_0x1407ff](util['format'](_0xd199('0x1f'),_0x3ed4e6[_0x5b33ab][_0xab7644][_0xd199('0x6')]));break;}}}}})[_0xd199('0xc')](function(){if(_0x1407ff===_0xd199('0x4a')){var _0x415a11=_[_0xd199('0x18')](_0x5653d0[_0xd199('0x4b')],'id');return _0x5653d0[_0xd199('0x4c')](_0x415a11)[_0xd199('0xc')](function(){for(var _0x61300c=0x0;_0x61300c<_0x415a11[_0xd199('0x40')];_0x61300c+=0x1){_0x237a71[_0xd199('0x4d')](_0xd199('0x4e'),{'ChatInteractionId':Number(_0x415a11[_0x61300c]),'UserId':Number(_0x5653d0['id'])});}});}})[_0xd199('0xc')](function(){if(_0x1407ff===_0xd199('0x4a')){var _0x21ceeb=_[_0xd199('0x18')](_0x5653d0[_0xd199('0x25')],'id');return _0x5653d0[_0xd199('0x4f')](_0x21ceeb)[_0xd199('0xc')](function(){for(var _0x9cfc46=0x0;_0x9cfc46<_0x21ceeb['length'];_0x9cfc46+=0x1){_0x237a71[_0xd199('0x4d')](_0xd199('0x50'),{'MailInteractionId':Number(_0x21ceeb[_0x9cfc46]),'UserId':Number(_0x5653d0['id'])});}});}})[_0xd199('0xc')](function(){if(_0x1407ff==='leave'){var _0x16f352=_['map'](_0x5653d0['FaxInteractions'],'id');return _0x5653d0[_0xd199('0x51')](_0x16f352)[_0xd199('0xc')](function(){for(var _0xb5b0f1=0x0;_0xb5b0f1<_0x16f352[_0xd199('0x40')];_0xb5b0f1+=0x1){_0x237a71[_0xd199('0x4d')](_0xd199('0x52'),{'FaxInteractionId':Number(_0x16f352[_0xb5b0f1]),'UserId':Number(_0x5653d0['id'])});}});}})[_0xd199('0xc')](function(){if(_0x1407ff==='leave'){var _0x3bf23a=_[_0xd199('0x18')](_0x5653d0[_0xd199('0x27')],'id');return _0x5653d0[_0xd199('0x53')](_0x3bf23a)[_0xd199('0xc')](function(){for(var _0x2f9de1=0x0;_0x2f9de1<_0x3bf23a['length'];_0x2f9de1+=0x1){_0x237a71[_0xd199('0x4d')](_0xd199('0x54'),{'SmsInteractionId':Number(_0x3bf23a[_0x2f9de1]),'UserId':Number(_0x5653d0['id'])});}});}})[_0xd199('0xc')](function(){if(_0x1407ff===_0xd199('0x4a')){var _0x4fd330=_[_0xd199('0x18')](_0x5653d0[_0xd199('0x29')],'id');return _0x5653d0[_0xd199('0x55')](_0x4fd330)[_0xd199('0xc')](function(){for(var _0x30acf0=0x0;_0x30acf0<_0x4fd330[_0xd199('0x40')];_0x30acf0+=0x1){_0x237a71[_0xd199('0x4d')](_0xd199('0x56'),{'OpenchannelInteractionId':Number(_0x4fd330[_0x30acf0]),'UserId':Number(_0x5653d0['id'])});}});}})[_0xd199('0xc')](function(){if(_0x1407ff===_0xd199('0x4a')){var _0xc73c7d=_[_0xd199('0x18')](_0x5653d0[_0xd199('0x2b')],'id');return _0x5653d0[_0xd199('0x57')](_0xc73c7d)['then'](function(){for(var _0x161309=0x0;_0x161309<_0xc73c7d['length'];_0x161309+=0x1){_0x237a71[_0xd199('0x4d')](_0xd199('0x58'),{'WhatsappInteractionId':Number(_0xc73c7d[_0x161309]),'UserId':Number(_0x5653d0['id'])});}});}})[_0xd199('0x59')](function(_0x3e291e){_0x5a0354[_0xd199('0x5a')](_0x3e291e);});}}function onDisconnect(_0x284396,_0x172a68){joinOrLeave(_0x284396,'leave',_0x172a68);}function onConnect(_0x599152){joinOrLeave(_0x599152,_0xd199('0x5b'));}exports[_0xd199('0x5c')]=function(_0x5f2035){_0x5f2035['on'](_0xd199('0x5d'),function(_0x30edcf){_0x30edcf['setMaxListeners'](0x0);_0x30edcf['address']=_0x30edcf[_0xd199('0x5e')]['connection']['remoteAddress']+':'+_0x30edcf[_0xd199('0x5e')][_0xd199('0x5d')][_0xd199('0x5f')];_0x30edcf[_0xd199('0x60')]=new Date();_0x30edcf[_0xd199('0x5a')]=function(_0xf6aee5){console[_0xd199('0x5a')](_0xd199('0x61')+_0x30edcf['nsp']['name']+'['+_0x30edcf[_0xd199('0x62')]+']',_0xf6aee5);};_0x30edcf['on']('disconnect',function(){onDisconnect(_0x30edcf,_0x5f2035);_0x30edcf[_0xd199('0x5a')](_0xd199('0x63'));});onConnect(_0x30edcf);_0x30edcf[_0xd199('0x5a')](_0xd199('0x64'));});}; \ No newline at end of file +var _0x9300=['removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','UserProfileSection','findOne','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','then','map','where','ivr','format','%s:queue:%s','handshake','query','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','voice:inbound','voice:outbound','SmsQueues','MailQueues','IvrCampaigns','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','leave'];(function(_0x2734d3,_0x34e4e4){var _0x24dbf=function(_0x47107a){while(--_0x47107a){_0x2734d3['push'](_0x2734d3['shift']());}};_0x24dbf(++_0x34e4e4);}(_0x9300,0x153));var _0x0930=function(_0x42ee1e,_0x3f1a64){_0x42ee1e=_0x42ee1e-0x0;var _0x1e21b8=_0x9300[_0x42ee1e];return _0x1e21b8;};'use strict';var _=require(_0x0930('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x0930('0x1'))['db'];var config=require(_0x0930('0x2'));var queryQueues={'attributes':['id',_0x0930('0x3')],'include':[{'as':_0x0930('0x4'),'model':db[_0x0930('0x5')],'attributes':['id','name',_0x0930('0x6')],'raw':!![],'where':{'role':_0x0930('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x0930('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x0930('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x0930('0x3')],'where':{'role':_0x0930('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x0930('0x3'),_0x0930('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x4a7705,_0x31aaa2,_0x4b1994){return db[_0x0930('0xa')][_0x0930('0xb')]({'where':{'name':_0x4a7705,'userProfileId':_0x31aaa2},'raw':!![]})['then'](function(_0x6db8ef){if(_0x6db8ef){if(_0x6db8ef['autoAssociation']){switch(_0x4a7705){case'VoiceQueues':case _0x0930('0xc'):case _0x0930('0xd'):case'SmsQueues':case'MailQueues':case _0x0930('0xe'):case _0x0930('0xf'):return db[_0x4b1994][_0x0930('0x10')](queryQueues);case _0x0930('0x11'):return db[_0x4b1994][_0x0930('0x10')](queryTelephones);case _0x0930('0x12'):return db[_0x4b1994]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x4b1994]['findAll'](queryCampaigns);}}else{return db[_0x0930('0x13')]['findAll']({'attributes':[_0x0930('0x14')],'where':{'sectionId':_0x6db8ef['id']},'raw':!![]})[_0x0930('0x15')](function(_0x255988){if(_0x255988){var _0x3af83f={'where':{'id':_[_0x0930('0x16')](_0x255988,_0x0930('0x14'))},'raw':!![]};switch(_0x4b1994){case'User':_0x3af83f[_0x0930('0x17')][_0x0930('0x6')]='telephone';break;case'Campaign':_0x3af83f[_0x0930('0x17')][_0x0930('0x9')]=_0x0930('0x18');break;}return db[_0x4b1994][_0x0930('0x10')](_0x3af83f);}else{return[];}});}}else{return[];}})[_0x0930('0x15')](function(_0x4b1eb0){return _0x4b1eb0;});}function joinOrLeaveQueues(_0x19b4e4,_0x16c5fb,_0x4cf8ad,_0x1aa8bb){_0x19b4e4[_0x16c5fb](util[_0x0930('0x19')](_0x0930('0x1a'),_0x4cf8ad,_0x1aa8bb[_0x0930('0x3')]));if(_0x1aa8bb[_0x0930('0x4')]){for(var _0xea7c6c=0x0;_0xea7c6c<_0x1aa8bb['Agents']['length'];_0xea7c6c+=0x1){_0x19b4e4[_0x16c5fb](util[_0x0930('0x19')]('user:%s',_0x1aa8bb[_0x0930('0x4')][_0xea7c6c][_0x0930('0x3')]));}}}function joinOrLeave(_0x361264,_0x4aac18,_0x37e243){var _0x48bdf5;if(_0x361264[_0x0930('0x1b')][_0x0930('0x1c')]['id']){db['User']['find']({'attributes':['id',_0x0930('0x3'),_0x0930('0x6'),_0x0930('0x1d')],'where':{'id':_0x361264[_0x0930('0x1b')][_0x0930('0x1c')]['id']},'include':[{'model':db[_0x0930('0x1e')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0930('0x1f')],'as':_0x0930('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x0930('0x21')],'as':_0x0930('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x0930('0x23')],'as':_0x0930('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x0930('0x25')],'as':_0x0930('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x0930('0x27')],'as':_0x0930('0x28'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x2a47f2){if(_0x2a47f2){_0x48bdf5=_0x2a47f2;_0x361264[_0x4aac18](util['format'](_0x0930('0x29'),_0x2a47f2[_0x0930('0x3')]));var _0x2e21c7=[];switch(_0x2a47f2['role']){case _0x0930('0x2a'):_0x361264[_0x4aac18]('voice:inbound');_0x361264[_0x4aac18]('voice:outbound');if(queryQueues[_0x0930('0x2b')]('include')){delete queryQueues[_0x0930('0x2c')];}_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x2e')][_0x0930('0x10')](queryQueues));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x2f')]['findAll'](queryQueues));_0x2e21c7['push'](db[_0x0930('0x30')][_0x0930('0x10')](queryQueues));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x31')][_0x0930('0x10')](queryQueues));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x32')][_0x0930('0x10')](queryQueues));_0x2e21c7['push'](db[_0x0930('0x33')][_0x0930('0x10')](queryQueues));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x34')]['findAll'](queryQueues));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x5')][_0x0930('0x10')](queryTelephones));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x35')]['findAll'](queryTrunks));_0x2e21c7['push'](db[_0x0930('0x36')][_0x0930('0x10')](queryCampaigns));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x5')][_0x0930('0x10')](queryAgents));break;case _0x0930('0x37'):_0x361264[_0x4aac18](_0x0930('0x38'));_0x361264[_0x4aac18](_0x0930('0x39'));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources('VoiceQueues',_0x2a47f2[_0x0930('0x1d')],_0x0930('0x2e')));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources(_0x0930('0xc'),_0x2a47f2[_0x0930('0x1d')],_0x0930('0x2f')));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources(_0x0930('0xd'),_0x2a47f2[_0x0930('0x1d')],_0x0930('0x30')));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources(_0x0930('0x3a'),_0x2a47f2[_0x0930('0x1d')],_0x0930('0x31')));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources(_0x0930('0x3b'),_0x2a47f2['userProfileId'],'MailQueue'));_0x2e21c7['push'](getAssociatedResources(_0x0930('0xe'),_0x2a47f2[_0x0930('0x1d')],_0x0930('0x33')));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources(_0x0930('0xf'),_0x2a47f2[_0x0930('0x1d')],_0x0930('0x34')));_0x2e21c7['push'](getAssociatedResources(_0x0930('0x11'),_0x2a47f2[_0x0930('0x1d')],_0x0930('0x5')));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources(_0x0930('0x12'),_0x2a47f2['userProfileId'],_0x0930('0x35')));_0x2e21c7['push'](getAssociatedResources(_0x0930('0x3c'),_0x2a47f2[_0x0930('0x1d')],'Campaign'));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x5')][_0x0930('0x10')](queryAgents));break;case _0x0930('0x7'):_0x361264[_0x4aac18]('voice:inbound');_0x361264[_0x4aac18](_0x0930('0x39'));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2['getVoiceQueues']({'attributes':['id',_0x0930('0x3')]}));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2[_0x0930('0x3d')]({'attributes':['id','name']}));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2[_0x0930('0x3e')]({'attributes':['id',_0x0930('0x3')]}));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2[_0x0930('0x3f')]({'attributes':['id',_0x0930('0x3')]}));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2['getMailQueues']({'attributes':['id','name']}));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2[_0x0930('0x40')]({'attributes':['id','name']}));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2[_0x0930('0x41')]({'attributes':['id',_0x0930('0x3')]}));break;}return BPromise[_0x0930('0x42')](_0x2e21c7);}})['then'](function(_0x1b9af2){if(_0x1b9af2&&_0x1b9af2['length']){for(var _0x294e15=0x0;_0x294e15<_0x1b9af2[_0x0930('0x43')];_0x294e15+=0x1){for(var _0x2d6d40=0x0;_0x2d6d40<_0x1b9af2[_0x294e15][_0x0930('0x43')];_0x2d6d40+=0x1){switch(_0x294e15){case 0x0:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x44'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x1:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x45'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x2:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x46'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x3:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x47'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x4:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x48'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x5:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x49'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x6:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x4a'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x7:if(_0x48bdf5[_0x0930('0x6')]!==_0x0930('0x7'))_0x361264[_0x4aac18](util[_0x0930('0x19')](_0x0930('0x4b'),_0x1b9af2[_0x294e15][_0x2d6d40][_0x0930('0x3')]));break;case 0x8:if(_0x48bdf5[_0x0930('0x6')]!=='agent')_0x361264[_0x4aac18](util[_0x0930('0x19')]('trunk:%s',_0x1b9af2[_0x294e15][_0x2d6d40][_0x0930('0x3')]));break;case 0x9:if(_0x48bdf5['role']!==_0x0930('0x7'))_0x361264[_0x4aac18](util[_0x0930('0x19')]('campaign:%s:%s',_0x1b9af2[_0x294e15][_0x2d6d40][_0x0930('0x9')],_0x1b9af2[_0x294e15][_0x2d6d40][_0x0930('0x3')]));break;case 0xa:_0x361264[_0x4aac18](util[_0x0930('0x19')](_0x0930('0x29'),_0x1b9af2[_0x294e15][_0x2d6d40][_0x0930('0x3')]));break;}}}}})['then'](function(){if(_0x4aac18==='leave'){var _0x50b47d=_[_0x0930('0x16')](_0x48bdf5[_0x0930('0x4c')],'id');return _0x48bdf5[_0x0930('0x4d')](_0x50b47d)[_0x0930('0x15')](function(){for(var _0x2ceb03=0x0;_0x2ceb03<_0x50b47d[_0x0930('0x43')];_0x2ceb03+=0x1){_0x37e243[_0x0930('0x4e')](_0x0930('0x4f'),{'ChatInteractionId':Number(_0x50b47d[_0x2ceb03]),'UserId':Number(_0x48bdf5['id'])});}});}})[_0x0930('0x15')](function(){if(_0x4aac18===_0x0930('0x50')){var _0x1d8124=_[_0x0930('0x16')](_0x48bdf5[_0x0930('0x20')],'id');return _0x48bdf5[_0x0930('0x51')](_0x1d8124)[_0x0930('0x15')](function(){for(var _0x58e812=0x0;_0x58e812<_0x1d8124['length'];_0x58e812+=0x1){_0x37e243['emit'](_0x0930('0x52'),{'MailInteractionId':Number(_0x1d8124[_0x58e812]),'UserId':Number(_0x48bdf5['id'])});}});}})[_0x0930('0x15')](function(){if(_0x4aac18===_0x0930('0x50')){var _0x38da03=_['map'](_0x48bdf5['FaxInteractions'],'id');return _0x48bdf5[_0x0930('0x53')](_0x38da03)[_0x0930('0x15')](function(){for(var _0x2d7ef2=0x0;_0x2d7ef2<_0x38da03[_0x0930('0x43')];_0x2d7ef2+=0x1){_0x37e243['emit'](_0x0930('0x54'),{'FaxInteractionId':Number(_0x38da03[_0x2d7ef2]),'UserId':Number(_0x48bdf5['id'])});}});}})[_0x0930('0x15')](function(){if(_0x4aac18===_0x0930('0x50')){var _0x3f47f2=_[_0x0930('0x16')](_0x48bdf5[_0x0930('0x24')],'id');return _0x48bdf5[_0x0930('0x55')](_0x3f47f2)[_0x0930('0x15')](function(){for(var _0x310199=0x0;_0x310199<_0x3f47f2[_0x0930('0x43')];_0x310199+=0x1){_0x37e243[_0x0930('0x4e')](_0x0930('0x56'),{'SmsInteractionId':Number(_0x3f47f2[_0x310199]),'UserId':Number(_0x48bdf5['id'])});}});}})[_0x0930('0x15')](function(){if(_0x4aac18===_0x0930('0x50')){var _0xda8945=_[_0x0930('0x16')](_0x48bdf5[_0x0930('0x26')],'id');return _0x48bdf5[_0x0930('0x57')](_0xda8945)[_0x0930('0x15')](function(){for(var _0x1297ab=0x0;_0x1297ab<_0xda8945[_0x0930('0x43')];_0x1297ab+=0x1){_0x37e243[_0x0930('0x4e')](_0x0930('0x58'),{'OpenchannelInteractionId':Number(_0xda8945[_0x1297ab]),'UserId':Number(_0x48bdf5['id'])});}});}})[_0x0930('0x15')](function(){if(_0x4aac18===_0x0930('0x50')){var _0x5aa376=_[_0x0930('0x16')](_0x48bdf5[_0x0930('0x28')],'id');return _0x48bdf5[_0x0930('0x59')](_0x5aa376)[_0x0930('0x15')](function(){for(var _0x3a96c0=0x0;_0x3a96c0<_0x5aa376[_0x0930('0x43')];_0x3a96c0+=0x1){_0x37e243[_0x0930('0x4e')](_0x0930('0x5a'),{'WhatsappInteractionId':Number(_0x5aa376[_0x3a96c0]),'UserId':Number(_0x48bdf5['id'])});}});}})[_0x0930('0x5b')](function(_0x41e35b){_0x361264[_0x0930('0x5c')](_0x41e35b);});}}function onDisconnect(_0x30ad0b,_0x2fd05d){joinOrLeave(_0x30ad0b,_0x0930('0x50'),_0x2fd05d);}function onConnect(_0x7bd12d){joinOrLeave(_0x7bd12d,_0x0930('0x5d'));}exports['default']=function(_0x37b3b2){_0x37b3b2['on'](_0x0930('0x5e'),function(_0x564008){_0x564008[_0x0930('0x5f')](0x0);_0x564008[_0x0930('0x60')]=_0x564008[_0x0930('0x61')][_0x0930('0x5e')][_0x0930('0x62')]+':'+_0x564008['request'][_0x0930('0x5e')]['remotePort'];_0x564008[_0x0930('0x63')]=new Date();_0x564008[_0x0930('0x5c')]=function(_0x35b867){console['log'](_0x0930('0x64')+_0x564008[_0x0930('0x65')][_0x0930('0x3')]+'['+_0x564008['address']+']',_0x35b867);};_0x564008['on'](_0x0930('0x66'),function(){onDisconnect(_0x564008,_0x37b3b2);_0x564008[_0x0930('0x5c')](_0x0930('0x67'));});onConnect(_0x564008);_0x564008[_0x0930('0x5c')](_0x0930('0x68'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 3ae3840..08315c2 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 _0x9c24=['SmsInteraction','closedinteraction','SmsMessage','newmessage','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','error','code','Trigger,\x20%s','get','channel','direction','resolve','undefined','ContactId','sequelize','Sequelize','contact','UserId','interface','format','SIP/%s','incomingmessage','outgoingmessage','catch','AfterCreateMessage','motionChannel','event','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','QueryTypes','SELECT','name','agent','AfterCreate','closed','changed','substatus','AfterUpdate','User','find','email','default','hasOwnProperty','model','hook','callback','condition','util','../../mysqldb','jayson/promise','triggers','client','http','newinteraction','Chat','ChatInteraction','afterUpdate','afterCreate','ChatOfflineMessage','Sms'];(function(_0x5b516b,_0x2c4dfc){var _0x33a254=function(_0x3cb6a5){while(--_0x3cb6a5){_0x5b516b['push'](_0x5b516b['shift']());}};_0x33a254(++_0x2c4dfc);}(_0x9c24,0xd1));var _0x49c2=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x9c24[_0x39096d];return _0x13da4f;};'use strict';var util=require(_0x49c2('0x0'));var db=require(_0x49c2('0x1'))['db'];var jayson=require(_0x49c2('0x2'));var logger=require('../logger')(_0x49c2('0x3'));var client=jayson[_0x49c2('0x4')][_0x49c2('0x5')]({'port':0x232a});var triggers=[{'channel':'Chat','model':'ChatInteraction','event':'afterCreate','condition':_0x49c2('0x6'),'callback':afterCreate},{'channel':_0x49c2('0x7'),'model':_0x49c2('0x8'),'event':_0x49c2('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x49c2('0x7'),'model':'ChatMessage','event':_0x49c2('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Chat','model':_0x49c2('0xb'),'event':'afterCreate','condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0x49c2('0xc'),'model':_0x49c2('0xd'),'event':'afterCreate','condition':_0x49c2('0x6'),'callback':afterCreate},{'channel':_0x49c2('0xc'),'model':_0x49c2('0xd'),'event':_0x49c2('0x9'),'condition':_0x49c2('0xe'),'callback':afterUpdate},{'channel':'Sms','model':_0x49c2('0xf'),'event':_0x49c2('0xa'),'condition':_0x49c2('0x10'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x49c2('0x11'),'event':'afterCreate','condition':_0x49c2('0x6'),'callback':afterCreate},{'channel':_0x49c2('0x12'),'model':_0x49c2('0x11'),'event':_0x49c2('0x9'),'condition':_0x49c2('0xe'),'callback':afterUpdate},{'channel':_0x49c2('0x12'),'model':_0x49c2('0x13'),'event':_0x49c2('0xa'),'condition':_0x49c2('0x10'),'callback':afterCreateMessage},{'channel':_0x49c2('0x14'),'model':_0x49c2('0x15'),'event':'afterCreate','condition':_0x49c2('0x6'),'callback':afterCreate},{'channel':_0x49c2('0x14'),'model':_0x49c2('0x15'),'event':_0x49c2('0x9'),'condition':_0x49c2('0xe'),'callback':afterUpdate},{'channel':_0x49c2('0x14'),'model':'FaxMessage','event':_0x49c2('0xa'),'condition':_0x49c2('0x10'),'callback':afterCreateMessage},{'channel':'Mail','model':'MailInteraction','event':_0x49c2('0xa'),'condition':_0x49c2('0x6'),'callback':afterCreate},{'channel':_0x49c2('0x16'),'model':'MailInteraction','event':_0x49c2('0x9'),'condition':_0x49c2('0xe'),'callback':afterUpdate},{'channel':_0x49c2('0x16'),'model':_0x49c2('0x17'),'event':_0x49c2('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x49c2('0x18'),'model':_0x49c2('0x19'),'event':_0x49c2('0xa'),'condition':_0x49c2('0x6'),'callback':afterCreate},{'channel':_0x49c2('0x18'),'model':_0x49c2('0x19'),'event':_0x49c2('0x9'),'condition':_0x49c2('0xe'),'callback':afterUpdate},{'channel':_0x49c2('0x18'),'model':_0x49c2('0x1a'),'event':_0x49c2('0xa'),'condition':_0x49c2('0x10'),'callback':afterCreateMessage}];function request(_0x334567){return client[_0x49c2('0x1b')](_0x49c2('0x1c'),_0x334567)[_0x49c2('0x1d')](function(_0x6b01c4){logger[_0x49c2('0x1e')]('Trigger,\x20%s','EventManager',_0x6b01c4);if(_0x6b01c4[_0x49c2('0x1f')]){if(_0x6b01c4['error'][_0x49c2('0x20')]===0x1f4){logger[_0x49c2('0x1f')](_0x49c2('0x21'),'EventManager',_0x6b01c4['error']);}}})['catch'](function(_0x2168f9){logger['error'](_0x49c2('0x21'),_0x49c2('0x1c'),_0x2168f9);});}function afterCreateMessage(_0x5f5159){return function(_0x4e2303){_0x4e2303=_0x4e2303[_0x49c2('0x22')]({'plain':!![]});_0x4e2303[_0x49c2('0x23')]=_0x5f5159;_0x4e2303['motionChannel']=_0x5f5159;_0x4e2303['event']=_0x4e2303[_0x49c2('0x24')];Promise[_0x49c2('0x25')]()[_0x49c2('0x1d')](function(){if(typeof _0x4e2303['ContactId']===_0x49c2('0x26'))return null;var _0x99c9c6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e2303[_0x49c2('0x27')];return db[_0x49c2('0x28')]['query'](_0x99c9c6,{'type':db[_0x49c2('0x29')]['QueryTypes']['SELECT'],'raw':!![]});})[_0x49c2('0x1d')](function(_0x3ccf1e){if(_0x3ccf1e){_0x4e2303[_0x49c2('0x2a')]=_0x3ccf1e[0x0];}if(typeof _0x4e2303[_0x49c2('0x2b')]==='undefined')return;return getAgent(_0x4e2303[_0x49c2('0x2b')]);})['then'](function(_0x8f8a73){if(_0x8f8a73){_0x4e2303[_0x49c2('0x2c')]=util[_0x49c2('0x2d')](_0x49c2('0x2e'),_0x8f8a73['name']);_0x4e2303['agent']=_0x8f8a73;_0x4e2303[_0x49c2('0x23')]=_0x5f5159;return request({'event':_0x49c2('0x2f'),'message':_0x4e2303});}else{return request({'event':_0x49c2('0x30'),'message':_0x4e2303});}})[_0x49c2('0x31')](function(_0x294ea5){logger[_0x49c2('0x1f')]('Trigger,\x20%s',_0x49c2('0x32'),_0x294ea5);});};}function afterCreateOfflineMessage(_0x5aceb9){return function(_0xf837e1){_0xf837e1=_0xf837e1[_0x49c2('0x22')]({'plain':!![]});_0xf837e1[_0x49c2('0x23')]=_0x5aceb9;_0xf837e1[_0x49c2('0x33')]=_0x5aceb9;_0xf837e1[_0x49c2('0x34')]='offlineMessage';return request({'event':_0xf837e1['event'],'message':_0xf837e1});};}function afterCreate(_0x57c469,_0x2891ac){return function(_0x5b7eb9){_0x5b7eb9=_0x5b7eb9[_0x49c2('0x22')]({'plain':!![]});_0x5b7eb9['channel']=_0x57c469;_0x5b7eb9[_0x49c2('0x33')]=_0x57c469;_0x5b7eb9[_0x49c2('0x34')]=_0x49c2('0x35');Promise[_0x49c2('0x25')]()[_0x49c2('0x1d')](function(){var _0x395045=_0x49c2('0x36')+_0x5b7eb9[_0x49c2('0x27')];return db[_0x49c2('0x28')][_0x49c2('0x37')](_0x395045,{'type':db[_0x49c2('0x29')][_0x49c2('0x38')][_0x49c2('0x39')],'raw':!![]});})[_0x49c2('0x1d')](function(_0x20025b){if(_0x20025b){_0x5b7eb9[_0x49c2('0x2a')]=_0x20025b[0x0];}if(typeof _0x5b7eb9[_0x49c2('0x2b')]===_0x49c2('0x26'))return;return getAgent(_0x5b7eb9[_0x49c2('0x2b')]);})[_0x49c2('0x1d')](function(_0x5350e7){if(_0x5350e7){_0x5b7eb9['interface']=util[_0x49c2('0x2d')]('SIP/%s',_0x5350e7[_0x49c2('0x3a')]);_0x5b7eb9[_0x49c2('0x3b')]=_0x5350e7;}return request({'event':_0x2891ac,'message':_0x5b7eb9});})['catch'](function(_0x1a6d12){logger[_0x49c2('0x1f')]('Trigger,\x20%s',_0x49c2('0x3c'),_0x1a6d12);});};}function afterUpdate(_0x33a189){return function(_0x4c5440){var _0x340d5c=_0x4c5440['changed'](_0x49c2('0x3d'))&&_0x4c5440[_0x49c2('0x3d')];var _0x9981f2=_0x4c5440[_0x49c2('0x3e')](_0x49c2('0x3f'));if(_0x340d5c||_0x9981f2){var _0x1d65d9=_0x340d5c?_0x49c2('0xe'):_0x49c2('0x3f');var _0x42f0f8=_0x4c5440[_0x49c2('0x22')]({'plain':!![]});_0x42f0f8[_0x49c2('0x23')]=_0x33a189;_0x42f0f8[_0x49c2('0x33')]=_0x33a189;_0x42f0f8[_0x49c2('0x34')]=_0x340d5c?_0x49c2('0x3d'):_0x49c2('0x3f');var _0x409111='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x42f0f8[_0x49c2('0x27')];return db[_0x49c2('0x28')][_0x49c2('0x37')](_0x409111,{'type':db['Sequelize'][_0x49c2('0x38')][_0x49c2('0x39')],'raw':!![]})['then'](function(_0x4d5ec4){if(_0x4d5ec4){_0x42f0f8[_0x49c2('0x2a')]=_0x4d5ec4[0x0];}if(typeof _0x42f0f8[_0x49c2('0x2b')]===_0x49c2('0x26'))return;return getAgent(_0x42f0f8['UserId']);})[_0x49c2('0x1d')](function(_0x43d43b){if(_0x43d43b){_0x42f0f8['interface']=util['format'](_0x49c2('0x2e'),_0x43d43b['name']);_0x42f0f8[_0x49c2('0x3b')]=_0x43d43b;}return request({'event':_0x1d65d9,'message':_0x42f0f8});})[_0x49c2('0x31')](function(_0x57fcd8){logger[_0x49c2('0x1f')](_0x49c2('0x21'),_0x49c2('0x40'),_0x57fcd8);});}};}function getAgent(_0x320dd6){return db[_0x49c2('0x41')][_0x49c2('0x42')]({'where':{'id':_0x320dd6},'attributes':['id',_0x49c2('0x3a'),'fullname',_0x49c2('0x43'),'internal'],'raw':!![]})[_0x49c2('0x1d')](function(_0x544a70){return _0x544a70;});}exports[_0x49c2('0x44')]=function(){for(var _0x31c1fa=0x0;_0x31c1fa=_0x29abf5[_0x7c0b('0x13')]){throw Error(_0x7c0b('0x14'));}_0x11a42b(_0x41b70a);})[_0x7c0b('0x15')](function(_0x1f455b){_0x3e17ee(_0x1f455b);});});}; \ No newline at end of file +var _0x6c1f=['agents','catch','bluebird','./license/util','voice','chat','fax','sms','openchannel','getChannels','isValidChannel','includes','clearBlockUser','isUndefined','updateAttributes','getLicense','role','agent','then'];(function(_0x34110c,_0x7f09b7){var _0xabbc0a=function(_0x12cc0a){while(--_0x12cc0a){_0x34110c['push'](_0x34110c['shift']());}};_0xabbc0a(++_0x7f09b7);}(_0x6c1f,0x1ca));var _0xf6c1=function(_0x1bac4a,_0x34f93f){_0x1bac4a=_0x1bac4a-0x0;var _0x257a51=_0x6c1f[_0x1bac4a];return _0x257a51;};'use strict';var _=require('lodash');var BPromise=require(_0xf6c1('0x0'));var db=require('../mysqldb')['db'];var util=require(_0xf6c1('0x1'));var channels=[_0xf6c1('0x2'),'mail',_0xf6c1('0x3'),_0xf6c1('0x4'),_0xf6c1('0x5'),'whatsapp',_0xf6c1('0x6')];exports[_0xf6c1('0x7')]=function(){return channels;};exports[_0xf6c1('0x8')]=function(_0x5e6dd5){_0x5e6dd5=_0x5e6dd5['toLowerCase']();return _[_0xf6c1('0x9')](channels,_0x5e6dd5);};exports[_0xf6c1('0xa')]=function(_0x4c8c6c,_0x3bb62f,_0x2d3aa0,_0x3a6d95){var _0x3fb41e={'loginAttempts':_0x3bb62f,'blocked':_0x2d3aa0};if(!_[_0xf6c1('0xb')](_0x3a6d95)){_0x3fb41e['blockedAt']=_0x3a6d95;}return _0x4c8c6c[_0xf6c1('0xc')](_0x3fb41e);};exports[_0xf6c1('0xd')]=function(_0x2b4298){return new BPromise(function(_0x31b0c2,_0xe52d2c){var _0x3e6de1=0x0;if(_0x2b4298[_0xf6c1('0xe')]!==_0xf6c1('0xf')){_0x31b0c2(_0x2b4298);}db['User']['count']({'where':{'role':_0xf6c1('0xf'),'online':!![],'id':{'$ne':_0x2b4298['id']}}})[_0xf6c1('0x10')](function(_0x261968){_0x3e6de1=_0x261968;return util['getLicense']();})['then'](function(_0x1daf3f){if(_0x1daf3f&&_0x1daf3f[_0xf6c1('0x11')]&&_0x3e6de1>=_0x1daf3f[_0xf6c1('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x31b0c2(_0x2b4298);})[_0xf6c1('0x12')](function(_0x561f69){_0xe52d2c(_0x561f69);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 8dd0740..1c8830b 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x119a=['util','api','message','name','Error','inherits','Bad\x20Request','Forbidden','Not\x20Found','code','details','OutOfInterval','Resource\x20Conflict','Conflict','Out\x20Of\x20Interval','error','statusMessage','status','send','exports'];(function(_0x43ac58,_0x67dc5a){var _0x425edd=function(_0x2d8e27){while(--_0x2d8e27){_0x43ac58['push'](_0x43ac58['shift']());}};_0x425edd(++_0x67dc5a);}(_0x119a,0xc8));var _0xa119=function(_0x41a273,_0x194b0d){_0x41a273=_0x41a273-0x0;var _0x4aacfa=_0x119a[_0x41a273];return _0x4aacfa;};'use strict';var util=require(_0xa119('0x0'));var logger=require('../config/logger')(_0xa119('0x1'));var APIError=function(_0x132d31,_0x118a1c){this[_0xa119('0x2')]=_0x132d31||'Internal\x20Server\x20Error';this[_0xa119('0x3')]=_0x118a1c||_0xa119('0x4');util[_0xa119('0x5')](APIError,Error);};var APIBadRequestError=function(_0x2641dd){this[_0xa119('0x2')]=_0x2641dd||_0xa119('0x6');this['name']=_0xa119('0x6');util[_0xa119('0x5')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0xf9e370){this['message']=_0xf9e370||_0xa119('0x7');this[_0xa119('0x3')]=_0xa119('0x7');util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x99703c){this['message']=_0x99703c||'Entity\x20not\x20found';this[_0xa119('0x3')]=_0xa119('0x8');util[_0xa119('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x463095){this[_0xa119('0x2')]=_0x463095||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this['name']='Out\x20Of\x20Interval';this[_0xa119('0x9')]=0x193;this[_0xa119('0xa')]={'type':_0xa119('0xb')};util[_0xa119('0x5')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x4e3004){this[_0xa119('0x2')]=_0x4e3004||_0xa119('0xc');this['name']=_0xa119('0xd');util[_0xa119('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x4930bd){switch(_0x4930bd){case _0xa119('0x6'):return 0x190;case _0xa119('0x7'),_0xa119('0xe'):return 0x193;case _0xa119('0x8'):return 0x194;case _0xa119('0xd'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x2a7878){if(_0x2a7878==='Out\x20Of\x20Interval')return _0x2a7878;return null;}function handleError(_0x34703c){return function(_0x1c9113){logger[_0xa119('0xf')](_0x1c9113['stack']);var _0x30113f=getStatusCode(_0x1c9113['name']);var _0x140fef=getCustomStatusMessage(_0x1c9113[_0xa119('0x3')]);if(_0x1c9113[_0xa119('0x3')]){delete _0x1c9113[_0xa119('0x3')];}if(_0x140fef){_0x34703c[_0xa119('0x10')]=_0x140fef;}return _0x34703c[_0xa119('0x11')](_0x30113f)[_0xa119('0x12')](_0x1c9113);};}module[_0xa119('0x13')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xf4ef=['exports','../config/logger','message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','Resource\x20Conflict','Conflict','error','statusMessage'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xf4ef,0x10f));var _0xff4e=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0xf4ef[_0x3430aa];return _0x2ac5c;};'use strict';var util=require('util');var logger=require(_0xff4e('0x0'))('api');var APIError=function(_0x31e96e,_0x223948){this[_0xff4e('0x1')]=_0x31e96e||_0xff4e('0x2');this[_0xff4e('0x3')]=_0x223948||_0xff4e('0x4');util[_0xff4e('0x5')](APIError,Error);};var APIBadRequestError=function(_0x11d973){this[_0xff4e('0x1')]=_0x11d973||_0xff4e('0x6');this[_0xff4e('0x3')]='Bad\x20Request';util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x3d1c30){this[_0xff4e('0x1')]=_0x3d1c30||_0xff4e('0x7');this['name']=_0xff4e('0x7');util[_0xff4e('0x5')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x57051e){this[_0xff4e('0x1')]=_0x57051e||_0xff4e('0x8');this['name']=_0xff4e('0x9');util[_0xff4e('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x350e12){this[_0xff4e('0x1')]=_0x350e12||_0xff4e('0xa');this[_0xff4e('0x3')]=_0xff4e('0xb');this[_0xff4e('0xc')]=0x193;this['details']={'type':'OutOfInterval'};util[_0xff4e('0x5')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x56d35f){this[_0xff4e('0x1')]=_0x56d35f||_0xff4e('0xd');this[_0xff4e('0x3')]=_0xff4e('0xe');util[_0xff4e('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x47f9cf){switch(_0x47f9cf){case _0xff4e('0x6'):return 0x190;case'Forbidden',_0xff4e('0xb'):return 0x193;case _0xff4e('0x9'):return 0x194;case _0xff4e('0xe'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x40a766){if(_0x40a766===_0xff4e('0xb'))return _0x40a766;return null;}function handleError(_0x2ef695){return function(_0x37c284){logger[_0xff4e('0xf')](_0x37c284['stack']);var _0x71d5e=getStatusCode(_0x37c284[_0xff4e('0x3')]);var _0x2cc6b8=getCustomStatusMessage(_0x37c284['name']);if(_0x37c284['name']){delete _0x37c284['name'];}if(_0x2cc6b8){_0x2ef695[_0xff4e('0x10')]=_0x2cc6b8;}return _0x2ef695['status'](_0x71d5e)['send'](_0x37c284);};}module[_0xff4e('0x11')]={'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 6be824b..3cc82ff 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3438=['render','json','send','exports','404','status'];(function(_0x16046c,_0x42eb6c){var _0x2ee5e6=function(_0x3a6fc7){while(--_0x3a6fc7){_0x16046c['push'](_0x16046c['shift']());}};_0x2ee5e6(++_0x42eb6c);}(_0x3438,0x141));var _0x8343=function(_0x21bf2b,_0x2fe35d){_0x21bf2b=_0x21bf2b-0x0;var _0x1d1c2d=_0x3438[_0x21bf2b];return _0x1d1c2d;};'use strict';module[_0x8343('0x0')][0x194]=function pageNotFound(_0x55fecf,_0x63c767){var _0x24c701=_0x8343('0x1');var _0x4d244d=0x194;var _0x1b6360={'status':_0x4d244d};_0x63c767[_0x8343('0x2')](_0x1b6360[_0x8343('0x2')]);_0x63c767[_0x8343('0x3')](_0x24c701,{},function(_0x322618,_0x317ca7){if(_0x322618){return _0x63c767[_0x8343('0x2')](_0x1b6360[_0x8343('0x2')])[_0x8343('0x4')](_0x1b6360);}_0x63c767[_0x8343('0x5')](_0x317ca7);});}; \ No newline at end of file +var _0x35b7=['404','status','render','json','send','exports'];(function(_0x2fc6cf,_0x2bb133){var _0xf2ade3=function(_0x522b04){while(--_0x522b04){_0x2fc6cf['push'](_0x2fc6cf['shift']());}};_0xf2ade3(++_0x2bb133);}(_0x35b7,0x185));var _0x735b=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x35b7[_0x176329];return _0x31997c;};'use strict';module[_0x735b('0x0')][0x194]=function pageNotFound(_0x5750c1,_0x5221f5){var _0x4b63ee=_0x735b('0x1');var _0x5b6965=0x194;var _0xc4f517={'status':_0x5b6965};_0x5221f5[_0x735b('0x2')](_0xc4f517['status']);_0x5221f5[_0x735b('0x3')](_0x4b63ee,{},function(_0x3e9f38,_0x5a855c){if(_0x3e9f38){return _0x5221f5[_0x735b('0x2')](_0xc4f517[_0x735b('0x2')])[_0x735b('0x4')](_0xc4f517);}_0x5221f5[_0x735b('0x5')](_0x5a855c);});}; \ No newline at end of file diff --git a/server/migrations/2.6.31.js b/server/migrations/2.6.31.js new file mode 100644 index 0000000..a59425a --- /dev/null +++ b/server/migrations/2.6.31.js @@ -0,0 +1,169 @@ +'use strict'; + +var BPromise = require('bluebird'); +var util = require('util'); +var logger = require('../config/logger')('migration'); +var Sequence = function() {}; + +Sequence.prototype.enqueue = function(fn) { + this.tail = this.tail ? this.tail.finally(fn) : fn(); +}; + +var Migration = function(queryInterface) { + this.queryInterface = queryInterface; + this.sequence = new Sequence(); +}; + +Migration.prototype.changeColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .changeColumn(table, column, type) + .then(function() { + logger.info('Changed column %s in table %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addColumn(table, column, type) + .then(function() { + logger.info('Added column %s to %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.dropTable = function(table) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .dropTable(table, { + force: true, + }) + .then(function() { + logger.info('table dropped %s', table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addIndex = function(table, column, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addIndex(table, column, { + indexName: indexName, + }) + .then(function() { + logger.info('addIndex %s %s %s', table, column.join(','), indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeIndex = function(table, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeIndex(table, indexName) + .then(function() { + logger.info('removeIndex %s %s', table, indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.query = function(sql) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface.sequelize + .query(sql) + .then(function() { + logger.info('query %s', sql); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeColumn = function(table, column) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeColumn(table, column) + .then(function() { + logger.info('Removed column %s from %s', column, table); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.renameColumn = function(table, oldColumn, newColumn) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .renameColumn(table, oldColumn, newColumn) + .then(function() { + logger.info( + 'Renamed column from %s to %s on %s', + oldColumn, + newColumn, + table + ); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.final = function(resolve) { + this.sequence.enqueue(function() { + return resolve(); + }); +}; + +module.exports = { + up: function(queryInterface /*, Sequelize */) { + return new BPromise(function(resolve) { + var migration = new Migration(queryInterface); + // Add your migration code here + + // START FINAL + migration.final(resolve); + // END FINAL + }); + }, + + down: function( /* queryInterface, Sequelize */ ) { + // var migration = new Migration(queryInterface); + }, +}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 60382ca..eaddfb6 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf0bb=['../api/schedule/schedule.model','Sound','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','Plugin','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','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','MailInteractionHasTag','hasOne','VoiceMail','cascade','UserId','userSetting','hasMany','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','UserNotifications','SenderId','SET\x20NULL','belongsTo','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueue','SmsQueues','WhatsappQueues','UserWhatsappQueue','CmList','cm_user_has_lists','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','VoiceChanSpy','ChanSpyId','Sounds','Members','VoiceQueueId','Hoppers','HopperHistories','ReportAgentPreview','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','Agents','Team','Teams','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailbox','VoiceCallReport','VoiceQueueReport','uniqueid','Contact','ContactId','MailServerIn','MailAccount','MailAccountId','CloudProviderId','restrict','Smtp','Answers','Interactions','List','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','Users','Interaction','ChatWebsiteId','ChatOfflineMessageId','IntervalId','TagId','MailQueueReport','Items','Dispositions','FaxAccountId','Applications','Exntensions','user_has_fax_accounts','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','ThroughTags','SmsQueueId','OpenchannelAccountId','OpenchannelMessage','openchannel_interaction_has_tags','OpenchannelInteractionId','OpenchannelQueueId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','ChatMessage','OpenchannelQueueReport','ChatApplication','Agent','Queue','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','ChatGroupId','Website','CompanyId','CmContactHasItem','CmContactId','AdditionalPhones','CmHopperId','CampaignId','OwnerId','CmHopperBlack','All','OneAll','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','cm_contact_has_tags','whatsapp_interaction_has_tags','ContactItemType','ItemType','ItemTypeId','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','Configurations','AccountId','SubjectId','DescriptionId','FieldId','Description','Field','Variable','SugarcrmConfiguration','Descriptions','Subject','VariableId','Subjects','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','Dynamics365Field','ChatInternalMessage','FromId','SessionId','ProjectId','team_has_whatsapp_queues','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','userProfileId','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','user','Imap','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerOut','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','Condition','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule'];(function(_0xf4129c,_0x44fcf1){var _0x426611=function(_0x3b5bcd){while(--_0x3b5bcd){_0xf4129c['push'](_0xf4129c['shift']());}};_0x426611(++_0x44fcf1);}(_0xf0bb,0x170));var _0xbf0b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf0bb[_0x3bf83f];return _0x22c4a9;};'use strict';var config=require(_0xbf0b('0x0'));var Sequelize=require('sequelize');var _=require(_0xbf0b('0x1'));var jstz=require(_0xbf0b('0x2'));var timezone=jstz[_0xbf0b('0x3')]();config[_0xbf0b('0x4')]=_[_0xbf0b('0x5')](config[_0xbf0b('0x4')],{'database':_0xbf0b('0x6'),'username':_0xbf0b('0x7'),'password':_0xbf0b('0x8'),'options':{'host':_0xbf0b('0x9'),'port':0xcea,'dialect':_0xbf0b('0xa'),'dialectOptions':{'charset':_0xbf0b('0xb')},'logging':![],'timezone':timezone[_0xbf0b('0xc')](),'define':{'charset':_0xbf0b('0xd'),'collate':_0xbf0b('0xe')}}});config[_0xbf0b('0xf')]=_['defaultsDeep'](config[_0xbf0b('0xf')],{'database':_0xbf0b('0x6'),'username':_0xbf0b('0x7'),'password':_0xbf0b('0x8'),'options':{'host':_0xbf0b('0x9'),'port':0xcea,'dialect':_0xbf0b('0xa'),'dialectOptions':{'charset':_0xbf0b('0xb')},'logging':![],'timezone':timezone[_0xbf0b('0xc')](),'define':{'charset':_0xbf0b('0xd'),'collate':_0xbf0b('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xbf0b('0x4')][_0xbf0b('0x10')],config['sequelize'][_0xbf0b('0x11')],config['sequelize'][_0xbf0b('0x12')],config['sequelize'][_0xbf0b('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xbf0b('0x10')],config[_0xbf0b('0xf')][_0xbf0b('0x11')],config[_0xbf0b('0xf')][_0xbf0b('0x12')],config['sequelizeHistory']['options'])};db[_0xbf0b('0x14')]=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0x16'));db['VoiceChanSpy']=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0x17'));db[_0xbf0b('0x18')]=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0x19'));db['VoiceExtension']=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0x1a'));db[_0xbf0b('0x1b')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x1c'));db[_0xbf0b('0x1d')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/voiceQueue/voiceQueue.model');db[_0xbf0b('0x1e')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x1f'));db['ScreenRecording']=db['sequelize'][_0xbf0b('0x15')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x20'));db[_0xbf0b('0x21')]=db['sequelize']['import'](_0xbf0b('0x22'));db['VoiceCallReport']=db['sequelize'][_0xbf0b('0x15')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x23'));db[_0xbf0b('0x24')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0x25'));db['MemberReport']=db[_0xbf0b('0x4')]['import'](_0xbf0b('0x26'));db[_0xbf0b('0x27')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/trunk/trunk.model');db[_0xbf0b('0x28')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x29'));db[_0xbf0b('0x2a')]=db['sequelize']['import'](_0xbf0b('0x2b'));db[_0xbf0b('0x2c')]=db[_0xbf0b('0x4')]['import'](_0xbf0b('0x2d'));db[_0xbf0b('0x2e')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x2f'));db[_0xbf0b('0x30')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x31'));db[_0xbf0b('0x32')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x33'));db[_0xbf0b('0x34')]=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0x35'));db[_0xbf0b('0x36')]=db[_0xbf0b('0x4')]['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db[_0xbf0b('0x4')]['import'](_0xbf0b('0x37'));db['MailServerIn']=db[_0xbf0b('0x4')]['import']('../api/mailServerIn/mailServerIn.model');db[_0xbf0b('0x38')]=db[_0xbf0b('0x4')]['import']('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x39'));db[_0xbf0b('0x3a')]=db['sequelize'][_0xbf0b('0x15')]('../api/mailQueue/mailQueue.model');db[_0xbf0b('0x3b')]=db['sequelize']['import'](_0xbf0b('0x3c'));db[_0xbf0b('0x3d')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x3e'));db[_0xbf0b('0x3f')]=db[_0xbf0b('0x4')]['import']('../api/mailMessage/mailMessage.model');db[_0xbf0b('0x40')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x41'));db[_0xbf0b('0x42')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x43'));db[_0xbf0b('0x44')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x45'));db[_0xbf0b('0x46')]=db['sequelize']['import'](_0xbf0b('0x47'));db[_0xbf0b('0x48')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/faxApplication/faxApplication.model');db[_0xbf0b('0x49')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/faxInteraction/faxInteraction.model');db[_0xbf0b('0x4a')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x4b'));db[_0xbf0b('0x4c')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x4d'));db[_0xbf0b('0x4e')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/faxQueueReport/faxQueueReport.model');db[_0xbf0b('0x4f')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x50'));db[_0xbf0b('0x51')]=db[_0xbf0b('0x4')]['import'](_0xbf0b('0x52'));db[_0xbf0b('0x53')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/smsInteraction/smsInteraction.model');db[_0xbf0b('0x54')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x55'));db['SmsQueue']=db[_0xbf0b('0x4')]['import'](_0xbf0b('0x56'));db['OpenchannelAccount']=db[_0xbf0b('0x4')]['import'](_0xbf0b('0x57'));db[_0xbf0b('0x58')]=db[_0xbf0b('0x4')]['import']('../api/openchannelApplication/openchannelApplication.model');db[_0xbf0b('0x59')]=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0x5a'));db['OpenchannelMessage']=db['sequelize'][_0xbf0b('0x15')]('../api/openchannelMessage/openchannelMessage.model');db[_0xbf0b('0x5b')]=db[_0xbf0b('0x4')]['import'](_0xbf0b('0x5c'));db['ChatWebsite']=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x5d'));db['OpenchannelQueueReport']=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x5e'));db['ChatApplication']=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db['sequelize'][_0xbf0b('0x15')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0x5f'));db[_0xbf0b('0x60')]=db['sequelize']['import'](_0xbf0b('0x61'));db[_0xbf0b('0x62')]=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0x63'));db[_0xbf0b('0x64')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x65'));db['ChatProactiveAction']=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0xbf0b('0x66')]=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0x67'));db[_0xbf0b('0x68')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/cmContact/cmContact.model');db[_0xbf0b('0x69')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x6a'));db['CmHopperBlack']=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0x6b'));db[_0xbf0b('0x6c')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x6d'));db[_0xbf0b('0x6e')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db['sequelize']['import'](_0xbf0b('0x6f'));db[_0xbf0b('0x70')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x71'));db[_0xbf0b('0x72')]=db[_0xbf0b('0x4')]['import'](_0xbf0b('0x73'));db[_0xbf0b('0x74')]=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0x75'));db[_0xbf0b('0x76')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/cannedAnswer/cannedAnswer.model');db[_0xbf0b('0x77')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/disposition/disposition.model');db[_0xbf0b('0x78')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/condition/condition.model');db[_0xbf0b('0x79')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/interval/interval.model');db[_0xbf0b('0x7a')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x7b'));db[_0xbf0b('0x7c')]=db[_0xbf0b('0x4')]['import'](_0xbf0b('0x7d'));db[_0xbf0b('0x7e')]=db[_0xbf0b('0x4')]['import'](_0xbf0b('0x7f'));db[_0xbf0b('0x80')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x81'));db[_0xbf0b('0x82')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/sound/sound.model');db['Tag']=db['sequelize']['import']('../api/tag/tag.model');db['ContactItemType']=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/contactItemType/contactItemType.model');db['CmContactHasItem']=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0x83'));db[_0xbf0b('0x84')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x85'));db[_0xbf0b('0x86')]=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0x87'));db[_0xbf0b('0x88')]=db[_0xbf0b('0x4')]['import']('../api/trigger/trigger.model');db['Variable']=db[_0xbf0b('0x4')]['import'](_0xbf0b('0x89'));db[_0xbf0b('0x8a')]=db[_0xbf0b('0x4')]['import'](_0xbf0b('0x8b'));db[_0xbf0b('0x8c')]=db[_0xbf0b('0x4')]['import'](_0xbf0b('0x8d'));db[_0xbf0b('0x8e')]=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0x8f'));db[_0xbf0b('0x90')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x91'));db[_0xbf0b('0x92')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x93'));db[_0xbf0b('0x94')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/analyticMetric/analyticMetric.model');db[_0xbf0b('0x95')]=db['sequelize'][_0xbf0b('0x15')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x96'));db[_0xbf0b('0x97')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xbf0b('0x98')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xbf0b('0x99')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x9a'));db[_0xbf0b('0x9b')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0xbf0b('0x9c')]=db['sequelize']['import'](_0xbf0b('0x9d'));db[_0xbf0b('0x9e')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0x9f'));db[_0xbf0b('0xa0')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xbf0b('0xa1')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/intDeskField/intDeskField.model');db[_0xbf0b('0xa2')]=db[_0xbf0b('0x4')]['import']('../api/intZohoAccount/intZohoAccount.model');db[_0xbf0b('0xa3')]=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0xa4'));db[_0xbf0b('0xa5')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xa6'));db[_0xbf0b('0xa7')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xa8'));db[_0xbf0b('0xa9')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xbf0b('0xaa')]=db['sequelize'][_0xbf0b('0x15')]('../api/intZendeskField/intZendeskField.model');db[_0xbf0b('0xab')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xac'));db['FreshdeskConfiguration']=db[_0xbf0b('0x4')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xbf0b('0xad')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xae'));db['VtigerAccount']=db[_0xbf0b('0x4')]['import'](_0xbf0b('0xaf'));db[_0xbf0b('0xb0')]=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0xb1'));db[_0xbf0b('0xb2')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/intVtigerField/intVtigerField.model');db[_0xbf0b('0xb3')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xb4'));db[_0xbf0b('0xb5')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xb6'));db[_0xbf0b('0xb7')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xb8'));db[_0xbf0b('0xb9')]=db[_0xbf0b('0x4')]['import']('../api/intDynamics365Account/intDynamics365Account.model');db[_0xbf0b('0xba')]=db[_0xbf0b('0x4')]['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db['sequelize']['import'](_0xbf0b('0xbb'));db[_0xbf0b('0xbc')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xbd'));db[_0xbf0b('0xbe')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xbf0b('0xbf')]=db[_0xbf0b('0x4')]['import'](_0xbf0b('0xc0'));db['Integration']=db[_0xbf0b('0x4')]['import']('../api/integration/integration.model');db[_0xbf0b('0xc1')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xc2'));db[_0xbf0b('0xc3')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0xc4'));db[_0xbf0b('0xc5')]=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0xc6'));db[_0xbf0b('0xc7')]=db[_0xbf0b('0x4')]['import'](_0xbf0b('0xc8'));db[_0xbf0b('0xc9')]=db['sequelize']['import'](_0xbf0b('0xca'));db[_0xbf0b('0xcb')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xcc'));db[_0xbf0b('0xcd')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xce'));db[_0xbf0b('0xcf')]=db[_0xbf0b('0x4')]['import'](_0xbf0b('0xd0'));db[_0xbf0b('0xd1')]=db['sequelize'][_0xbf0b('0x15')]('../api/jscriptyProject/jscriptyProject.model');db[_0xbf0b('0xd2')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/setting/setting.model');db[_0xbf0b('0xd3')]=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0xd4'));db[_0xbf0b('0xd5')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xd6'));db['SquareRecording']=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xd7'));db['SquareMessage']=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xd8'));db['Team']=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/team/team.model');db['License']=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xd9'));db[_0xbf0b('0xda')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xdb'));db[_0xbf0b('0xdc')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/migration/migration.model');db[_0xbf0b('0xdd')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/attachment/attachment.model');db[_0xbf0b('0xde')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/plugin/plugin.model');db[_0xbf0b('0xdf')]=db['sequelize'][_0xbf0b('0x15')]('../api/mailTransferReport/mailTransferReport.model');db[_0xbf0b('0xe0')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xe1'));db['FaxTransferReport']=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xe2'));db[_0xbf0b('0xe3')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/cmList/cmList.model');db[_0xbf0b('0xe4')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xe5'));db[_0xbf0b('0xe6')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/userProfile/userProfile.model');db[_0xbf0b('0xe7')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xe8'));db[_0xbf0b('0xe9')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/userProfileResource/userProfileResource.model');db[_0xbf0b('0xea')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xeb'));db[_0xbf0b('0xec')]=db[_0xbf0b('0x4')]['import'](_0xbf0b('0xed'));db[_0xbf0b('0xee')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/whatsappApplication/whatsappApplication.model');db[_0xbf0b('0xef')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xf0'));db[_0xbf0b('0xf1')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/whatsappMessage/whatsappMessage.model');db[_0xbf0b('0xf2')]=db[_0xbf0b('0x4')]['import'](_0xbf0b('0xf3'));db[_0xbf0b('0xf4')]=db[_0xbf0b('0x4')]['import'](_0xbf0b('0xf5'));db[_0xbf0b('0xf6')]=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0xf7'));db[_0xbf0b('0xf8')]=db[_0xbf0b('0x4')]['import'](_0xbf0b('0xf9'));db[_0xbf0b('0xfa')]=db['sequelize'][_0xbf0b('0x15')](_0xbf0b('0xfb'));db[_0xbf0b('0xfc')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')](_0xbf0b('0xfd'));db[_0xbf0b('0xfe')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0xbf0b('0xff')]=db['sequelize']['import']('../api/user-setting/user-setting.model');db[_0xbf0b('0x100')]=db[_0xbf0b('0x4')][_0xbf0b('0x15')]('../api/mailInteractionHasTag/mailInteractionHasTag.model');db['User'][_0xbf0b('0x101')](db['VoiceMail'],{'as':_0xbf0b('0x102'),'onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x104')});db[_0xbf0b('0x14')]['hasOne'](db[_0xbf0b('0xff')],{'as':_0xbf0b('0x105'),'onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x104')});db['User'][_0xbf0b('0x106')](db[_0xbf0b('0x1e')],{'as':'Recordings','foreignKey':_0xbf0b('0x104')});db['User'][_0xbf0b('0x106')](db[_0xbf0b('0x2a')],{'as':_0xbf0b('0x107'),'foreignKey':_0xbf0b('0x104')});db['User'][_0xbf0b('0x106')](db[_0xbf0b('0x108')],{'as':_0xbf0b('0x109'),'onDelete':_0xbf0b('0x103'),'hooks':!![]});db[_0xbf0b('0x14')][_0xbf0b('0x106')](db[_0xbf0b('0x6c')],{'as':_0xbf0b('0x10a'),'foreignKey':'UserId'});db[_0xbf0b('0x14')][_0xbf0b('0x106')](db[_0xbf0b('0x6e')],{'as':'HopperHistory','foreignKey':_0xbf0b('0x104')});db[_0xbf0b('0x14')][_0xbf0b('0x106')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xbf0b('0x104')});db['User'][_0xbf0b('0x106')](db[_0xbf0b('0x59')],{'as':_0xbf0b('0x10b'),'foreignKey':_0xbf0b('0x104')});db[_0xbf0b('0x14')][_0xbf0b('0x106')](db[_0xbf0b('0x10c')],{'as':_0xbf0b('0x10d'),'foreignKey':_0xbf0b('0x104')});db[_0xbf0b('0x14')]['hasMany'](db[_0xbf0b('0x53')],{'as':_0xbf0b('0x10e'),'foreignKey':_0xbf0b('0x104')});db['User'][_0xbf0b('0x106')](db[_0xbf0b('0x49')],{'as':_0xbf0b('0x10f'),'foreignKey':_0xbf0b('0x104')});db[_0xbf0b('0x14')][_0xbf0b('0x106')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0xbf0b('0x104')});db[_0xbf0b('0x14')][_0xbf0b('0x106')](db[_0xbf0b('0xef')],{'as':'WhatsappInteractions','foreignKey':_0xbf0b('0x104')});db[_0xbf0b('0x14')][_0xbf0b('0x106')](db[_0xbf0b('0xea')],{'as':_0xbf0b('0x110'),'foreignKey':_0xbf0b('0x111')});db[_0xbf0b('0x14')][_0xbf0b('0x106')](db[_0xbf0b('0x69')],{'as':'Hoppers','foreignKey':_0xbf0b('0x104'),'onDelete':_0xbf0b('0x112')});db[_0xbf0b('0x14')][_0xbf0b('0x113')](db[_0xbf0b('0xe6')],{'as':_0xbf0b('0xe6'),'foreignKey':'userProfileId'});db[_0xbf0b('0x14')][_0xbf0b('0x114')](db[_0xbf0b('0x64')],{'as':_0xbf0b('0x115'),'through':_0xbf0b('0x116')});db[_0xbf0b('0x14')][_0xbf0b('0x114')](db[_0xbf0b('0x68')],{'as':_0xbf0b('0x117'),'through':_0xbf0b('0x118')});db[_0xbf0b('0x14')][_0xbf0b('0x114')](db['CmList'],{'as':'Lists','through':'cm_user_has_lists'});db[_0xbf0b('0x14')][_0xbf0b('0x114')](db['Team'],{'through':_0xbf0b('0x119')});db[_0xbf0b('0x14')][_0xbf0b('0x114')](db['MailInteraction'],{'as':_0xbf0b('0x11a'),'through':_0xbf0b('0x11b')});db['User'][_0xbf0b('0x114')](db[_0xbf0b('0x10c')],{'as':_0xbf0b('0x10d'),'through':_0xbf0b('0x11c')});db[_0xbf0b('0x14')][_0xbf0b('0x114')](db[_0xbf0b('0x49')],{'as':_0xbf0b('0x10f'),'through':_0xbf0b('0x11d')});db[_0xbf0b('0x14')][_0xbf0b('0x114')](db['SmsInteraction'],{'as':_0xbf0b('0x10e'),'through':_0xbf0b('0x11e')});db['User'][_0xbf0b('0x114')](db[_0xbf0b('0x59')],{'as':_0xbf0b('0x10b'),'through':_0xbf0b('0x11f')});db[_0xbf0b('0x14')][_0xbf0b('0x114')](db[_0xbf0b('0xef')],{'as':_0xbf0b('0x120'),'through':_0xbf0b('0x121')});db['User']['belongsToMany'](db[_0xbf0b('0x1d')],{'as':_0xbf0b('0x122'),'through':'UserVoiceQueue','required':![]});db[_0xbf0b('0x14')]['belongsToMany'](db['VoicePrefix'],{'as':_0xbf0b('0x123'),'through':_0xbf0b('0xfe'),'required':![]});db[_0xbf0b('0x14')][_0xbf0b('0x114')](db[_0xbf0b('0x3a')],{'as':_0xbf0b('0x124'),'through':_0xbf0b('0x30'),'required':![]});db[_0xbf0b('0x14')][_0xbf0b('0x114')](db[_0xbf0b('0x62')],{'as':_0xbf0b('0x125'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0xbf0b('0x14')][_0xbf0b('0x114')](db[_0xbf0b('0x4c')],{'as':_0xbf0b('0x126'),'through':_0xbf0b('0x32'),'required':![]});db[_0xbf0b('0x14')]['belongsToMany'](db[_0xbf0b('0x127')],{'as':_0xbf0b('0x128'),'through':_0xbf0b('0x34'),'required':![]});db[_0xbf0b('0x14')]['belongsToMany'](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0xbf0b('0x36'),'required':![]});db[_0xbf0b('0x14')][_0xbf0b('0x114')](db[_0xbf0b('0xf6')],{'as':_0xbf0b('0x129'),'through':_0xbf0b('0x12a'),'required':![]});db[_0xbf0b('0x14')][_0xbf0b('0x114')](db[_0xbf0b('0x12b')],{'through':_0xbf0b('0x12c')});db[_0xbf0b('0x14')]['belongsToMany'](db[_0xbf0b('0x12d')],{'as':_0xbf0b('0x12e'),'through':_0xbf0b('0x12f')});db[_0xbf0b('0x14')][_0xbf0b('0x114')](db[_0xbf0b('0x46')],{'as':_0xbf0b('0x130'),'through':'user_has_fax_accounts'});db[_0xbf0b('0x14')][_0xbf0b('0x114')](db['MailAccount'],{'as':'MailAccounts','through':_0xbf0b('0x131')});db[_0xbf0b('0x14')][_0xbf0b('0x114')](db[_0xbf0b('0x132')],{'as':_0xbf0b('0x133'),'through':_0xbf0b('0x134')});db['User']['belongsToMany'](db[_0xbf0b('0x4f')],{'as':_0xbf0b('0x135'),'through':_0xbf0b('0x136')});db[_0xbf0b('0x14')][_0xbf0b('0x114')](db[_0xbf0b('0xec')],{'as':_0xbf0b('0x137'),'through':_0xbf0b('0x138')});db[_0xbf0b('0x139')][_0xbf0b('0x106')](db[_0xbf0b('0x108')],{'as':'SpiedAgents','onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x13a')});db['VoiceContext'][_0xbf0b('0x106')](db[_0xbf0b('0x108')],{'onDelete':_0xbf0b('0x103')});db['VoiceExtension'][_0xbf0b('0x106')](db['VoiceExtension'],{'as':'Applications','onDelete':_0xbf0b('0x103')});db['VoiceMusicOnHold']['belongsToMany'](db[_0xbf0b('0x82')],{'as':_0xbf0b('0x13b'),'through':'moh_has_sounds'});db[_0xbf0b('0x1d')]['hasMany'](db[_0xbf0b('0x2a')],{'as':_0xbf0b('0x13c'),'foreignKey':_0xbf0b('0x13d')});db[_0xbf0b('0x1d')][_0xbf0b('0x106')](db[_0xbf0b('0x69')],{'as':_0xbf0b('0x13e'),'foreignKey':'VoiceQueueId'});db[_0xbf0b('0x1d')]['hasMany'](db[_0xbf0b('0x6c')],{'as':_0xbf0b('0x10a'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db['CmHopperHistory'],{'as':_0xbf0b('0x13f'),'foreignKey':_0xbf0b('0x13d')});db[_0xbf0b('0x1d')][_0xbf0b('0x106')](db[_0xbf0b('0x140')],{'as':_0xbf0b('0x140'),'foreignKey':_0xbf0b('0x13d')});db['VoiceQueue']['hasMany'](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xbf0b('0x13d')});db[_0xbf0b('0x1d')][_0xbf0b('0x106')](db[_0xbf0b('0xc9')],{'as':_0xbf0b('0x141'),'foreignKey':_0xbf0b('0x13d')});db['VoiceQueue'][_0xbf0b('0x113')](db[_0xbf0b('0x27')],{'as':_0xbf0b('0x27'),'foreignKey':_0xbf0b('0x142')});db[_0xbf0b('0x1d')][_0xbf0b('0x113')](db[_0xbf0b('0x27')],{'as':_0xbf0b('0x143'),'foreignKey':_0xbf0b('0x144')});db[_0xbf0b('0x1d')][_0xbf0b('0x113')](db[_0xbf0b('0x79')],{'as':_0xbf0b('0x79'),'foreignKey':'IntervalId'});db[_0xbf0b('0x1d')][_0xbf0b('0x113')](db['Pause'],{'as':_0xbf0b('0x145'),'foreignKey':_0xbf0b('0x146')});db[_0xbf0b('0x1d')][_0xbf0b('0x114')](db[_0xbf0b('0x12b')],{'as':_0xbf0b('0x147'),'through':'voice_queues_has_cm_lists'});db[_0xbf0b('0x1d')][_0xbf0b('0x114')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x148'),'through':_0xbf0b('0x2c')});db[_0xbf0b('0x1d')][_0xbf0b('0x114')](db[_0xbf0b('0x149')],{'as':_0xbf0b('0x14a'),'through':_0xbf0b('0xfa')});db[_0xbf0b('0x1d')][_0xbf0b('0x114')](db[_0xbf0b('0x12b')],{'as':'BlackLists','through':_0xbf0b('0x14b')});db[_0xbf0b('0x1e')][_0xbf0b('0x113')](db['User'],{'as':_0xbf0b('0x14'),'foreignKey':_0xbf0b('0x104')});db[_0xbf0b('0x14c')]['belongsTo'](db[_0xbf0b('0x14')],{'as':'User','foreignKey':_0xbf0b('0x104')});db[_0xbf0b('0x102')][_0xbf0b('0x106')](db[_0xbf0b('0x21')],{'as':_0xbf0b('0x14d'),'onDelete':_0xbf0b('0x103'),'foreignKey':'mailboxuser','sourceKey':_0xbf0b('0x14e')});db['VoiceMailMessage'][_0xbf0b('0x113')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0xbf0b('0x14e')});db[_0xbf0b('0x14f')]['hasMany'](db[_0xbf0b('0x150')],{'as':'QueueCalls','foreignKey':_0xbf0b('0x151'),'constraints':![]});db[_0xbf0b('0x14f')]['hasMany'](db[_0xbf0b('0x24')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0xbf0b('0x14f')][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'as':'User','foreignKey':_0xbf0b('0x104')});db[_0xbf0b('0x14f')][_0xbf0b('0x113')](db[_0xbf0b('0x68')],{'as':_0xbf0b('0x152'),'foreignKey':_0xbf0b('0x153')});db[_0xbf0b('0x154')]['belongsTo'](db[_0xbf0b('0x155')],{'as':'MailAccount','foreignKey':_0xbf0b('0x156')});db[_0xbf0b('0x154')][_0xbf0b('0x113')](db[_0xbf0b('0xf8')],{'as':_0xbf0b('0xf8'),'foreignKey':_0xbf0b('0x157'),'onDelete':'restrict'});db[_0xbf0b('0x38')][_0xbf0b('0x113')](db['MailAccount'],{'as':_0xbf0b('0x155'),'foreignKey':_0xbf0b('0x156')});db[_0xbf0b('0x38')]['belongsTo'](db['CloudProvider'],{'as':_0xbf0b('0xf8'),'foreignKey':_0xbf0b('0x157'),'onDelete':_0xbf0b('0x158')});db['MailAccount']['hasOne'](db[_0xbf0b('0x154')],{'as':'Imap','onDelete':_0xbf0b('0x103')});db[_0xbf0b('0x155')][_0xbf0b('0x101')](db[_0xbf0b('0x38')],{'as':_0xbf0b('0x159'),'onDelete':'cascade'});db[_0xbf0b('0x155')][_0xbf0b('0x106')](db[_0xbf0b('0x77')],{'as':'Dispositions','foreignKey':_0xbf0b('0x156'),'onDelete':_0xbf0b('0x103')});db[_0xbf0b('0x155')][_0xbf0b('0x106')](db['CannedAnswer'],{'as':_0xbf0b('0x15a'),'foreignKey':_0xbf0b('0x156')});db[_0xbf0b('0x155')][_0xbf0b('0x106')](db[_0xbf0b('0x3f')],{'as':'Messages','foreignKey':_0xbf0b('0x156')});db[_0xbf0b('0x155')][_0xbf0b('0x106')](db[_0xbf0b('0x3d')],{'as':_0xbf0b('0x15b')});db['MailAccount'][_0xbf0b('0x106')](db[_0xbf0b('0x40')],{'as':'Applications','foreignKey':_0xbf0b('0x156'),'onDelete':_0xbf0b('0x103')});db[_0xbf0b('0x155')][_0xbf0b('0x113')](db['CmList'],{'as':_0xbf0b('0x15c'),'foreignKey':_0xbf0b('0x15d')});db[_0xbf0b('0x155')]['belongsTo'](db[_0xbf0b('0x86')],{'as':'Template','foreignKey':_0xbf0b('0x15e')});db[_0xbf0b('0x155')]['belongsTo'](db[_0xbf0b('0x7a')],{'as':_0xbf0b('0x145'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xbf0b('0x155')][_0xbf0b('0x114')](db['User'],{'as':_0xbf0b('0x148'),'through':_0xbf0b('0x131')});db[_0xbf0b('0x3a')][_0xbf0b('0x114')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x148'),'through':_0xbf0b('0x30')});db[_0xbf0b('0x3a')][_0xbf0b('0x114')](db[_0xbf0b('0x149')],{'through':_0xbf0b('0x15f'),'as':_0xbf0b('0x14a')});db[_0xbf0b('0x3d')][_0xbf0b('0x106')](db[_0xbf0b('0x3f')],{'as':_0xbf0b('0x14d'),'onDelete':'cascade','foreignKey':_0xbf0b('0x160')});db[_0xbf0b('0x3d')][_0xbf0b('0x113')](db[_0xbf0b('0x155')],{'as':_0xbf0b('0x161'),'foreignKey':'MailAccountId'});db[_0xbf0b('0x3d')][_0xbf0b('0x113')](db['CmContact'],{'as':'Contact','foreignKey':_0xbf0b('0x153')});db[_0xbf0b('0x3d')][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x162'),'foreignKey':_0xbf0b('0x104')});db[_0xbf0b('0x3d')]['belongsToMany'](db[_0xbf0b('0x163')],{'through':_0xbf0b('0x164'),'as':_0xbf0b('0x165')});db[_0xbf0b('0x3d')][_0xbf0b('0x114')](db[_0xbf0b('0x163')],{'through':_0xbf0b('0x164'),'as':'ThroughTags'});db[_0xbf0b('0x3d')][_0xbf0b('0x114')](db['User'],{'as':_0xbf0b('0x166'),'through':_0xbf0b('0x11b'),'foreignKey':_0xbf0b('0x160')});db[_0xbf0b('0x3f')][_0xbf0b('0x106')](db[_0xbf0b('0xdd')],{'as':'Attachments','onDelete':_0xbf0b('0x103')});db[_0xbf0b('0x3f')][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x14')});db[_0xbf0b('0x3f')][_0xbf0b('0x113')](db[_0xbf0b('0x68')],{'onDelete':_0xbf0b('0x103'),'as':_0xbf0b('0x152')});db['MailMessage'][_0xbf0b('0x113')](db[_0xbf0b('0x3d')],{'as':_0xbf0b('0x167'),'foreignKey':_0xbf0b('0x160')});db[_0xbf0b('0x3f')]['belongsTo'](db[_0xbf0b('0x155')],{'as':'Account','foreignKey':'MailAccountId'});db[_0xbf0b('0x3f')][_0xbf0b('0x113')](db[_0xbf0b('0x12d')],{'as':'ChatWebsite','foreignKey':_0xbf0b('0x168')});db[_0xbf0b('0x3f')]['belongsTo'](db['ChatOfflineMessage'],{'as':_0xbf0b('0x60'),'foreignKey':_0xbf0b('0x169')});db[_0xbf0b('0x40')]['belongsTo'](db[_0xbf0b('0x14')],{'onDelete':'restrict'});db['MailApplication'][_0xbf0b('0x113')](db[_0xbf0b('0x3a')],{'onDelete':_0xbf0b('0x158')});db[_0xbf0b('0x40')][_0xbf0b('0x113')](db[_0xbf0b('0x155')],{'onDelete':'restrict'});db[_0xbf0b('0x40')]['belongsTo'](db[_0xbf0b('0x79')],{'onDelete':'restrict','foreignKey':_0xbf0b('0x16a')});db[_0xbf0b('0x40')][_0xbf0b('0x113')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xbf0b('0x16b')});db['MailQueueReport'][_0xbf0b('0x113')](db[_0xbf0b('0x155')],{});db[_0xbf0b('0x16c')][_0xbf0b('0x113')](db[_0xbf0b('0x12b')],{'as':_0xbf0b('0x15c'),'foreignKey':'ListId'});db[_0xbf0b('0x16c')][_0xbf0b('0x113')](db['CmContact'],{'as':_0xbf0b('0x152'),'foreignKey':_0xbf0b('0x153')});db[_0xbf0b('0x16c')][_0xbf0b('0x113')](db[_0xbf0b('0x3d')],{});db[_0xbf0b('0x16c')]['belongsTo'](db['MailMessage'],{});db[_0xbf0b('0x16c')][_0xbf0b('0x113')](db['User'],{});db['MailQueueReport'][_0xbf0b('0x113')](db[_0xbf0b('0x3a')],{});db[_0xbf0b('0x42')][_0xbf0b('0x106')](db[_0xbf0b('0x44')],{'as':_0xbf0b('0x16d'),'onDelete':_0xbf0b('0x103')});db[_0xbf0b('0x46')][_0xbf0b('0x106')](db[_0xbf0b('0x77')],{'as':_0xbf0b('0x16e'),'foreignKey':_0xbf0b('0x16f'),'onDelete':_0xbf0b('0x103')});db[_0xbf0b('0x46')][_0xbf0b('0x106')](db[_0xbf0b('0x76')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0xbf0b('0x46')][_0xbf0b('0x106')](db[_0xbf0b('0x49')],{'as':'Interactions'});db[_0xbf0b('0x46')][_0xbf0b('0x106')](db[_0xbf0b('0x48')],{'as':_0xbf0b('0x170'),'foreignKey':_0xbf0b('0x16f'),'onDelete':'cascade'});db['FaxAccount'][_0xbf0b('0x106')](db[_0xbf0b('0x108')],{'as':_0xbf0b('0x171'),'onDelete':_0xbf0b('0x103')});db['FaxAccount'][_0xbf0b('0x106')](db[_0xbf0b('0x4a')],{'as':'Messages'});db[_0xbf0b('0x46')][_0xbf0b('0x113')](db[_0xbf0b('0x27')],{'as':_0xbf0b('0x27')});db['FaxAccount'][_0xbf0b('0x113')](db[_0xbf0b('0x12b')],{'as':_0xbf0b('0x15c'),'foreignKey':_0xbf0b('0x15d')});db[_0xbf0b('0x46')]['belongsTo'](db[_0xbf0b('0x7a')],{'as':_0xbf0b('0x145'),'foreignKey':_0xbf0b('0x146')});db[_0xbf0b('0x46')]['belongsToMany'](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x148'),'through':_0xbf0b('0x172')});db[_0xbf0b('0x48')]['belongsTo'](db[_0xbf0b('0x14')],{'onDelete':_0xbf0b('0x158')});db[_0xbf0b('0x48')][_0xbf0b('0x113')](db[_0xbf0b('0x4c')],{'onDelete':_0xbf0b('0x158')});db['FaxApplication'][_0xbf0b('0x113')](db[_0xbf0b('0x46')],{'onDelete':_0xbf0b('0x158')});db[_0xbf0b('0x48')][_0xbf0b('0x113')](db['Tag'],{'onDelete':_0xbf0b('0x158'),'foreignKey':_0xbf0b('0x16b')});db[_0xbf0b('0x49')][_0xbf0b('0x106')](db[_0xbf0b('0x4a')],{'as':'Messages','onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x173')});db[_0xbf0b('0x49')][_0xbf0b('0x113')](db[_0xbf0b('0x46')],{'as':_0xbf0b('0x161'),'foreignKey':_0xbf0b('0x16f')});db[_0xbf0b('0x49')][_0xbf0b('0x113')](db['CmContact'],{'as':_0xbf0b('0x152'),'foreignKey':'ContactId'});db['FaxInteraction'][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x162'),'foreignKey':_0xbf0b('0x104')});db[_0xbf0b('0x49')][_0xbf0b('0x114')](db[_0xbf0b('0x163')],{'through':'fax_interaction_has_tags','as':_0xbf0b('0x165')});db['FaxInteraction'][_0xbf0b('0x114')](db['Tag'],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0xbf0b('0x49')][_0xbf0b('0x114')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x166'),'through':'user_has_fax_interactions','foreignKey':_0xbf0b('0x173')});db[_0xbf0b('0x4a')][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'onDelete':_0xbf0b('0x103'),'as':'User'});db[_0xbf0b('0x4a')][_0xbf0b('0x113')](db[_0xbf0b('0x49')],{'as':'Interaction','foreignKey':_0xbf0b('0x173')});db['FaxMessage'][_0xbf0b('0x113')](db['CmContact'],{'onDelete':_0xbf0b('0x103'),'as':_0xbf0b('0x152')});db[_0xbf0b('0x4a')][_0xbf0b('0x113')](db[_0xbf0b('0xdd')],{'as':_0xbf0b('0xdd'),'foreignKey':_0xbf0b('0x174')});db['FaxMessage'][_0xbf0b('0x113')](db['FaxAccount'],{'as':_0xbf0b('0x161'),'foreignKey':_0xbf0b('0x16f')});db[_0xbf0b('0x4c')][_0xbf0b('0x114')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x148'),'through':_0xbf0b('0x32')});db['FaxQueue'][_0xbf0b('0x114')](db[_0xbf0b('0x149')],{'through':_0xbf0b('0x175'),'as':'Teams'});db[_0xbf0b('0x4e')][_0xbf0b('0x113')](db[_0xbf0b('0x46')],{});db[_0xbf0b('0x4e')][_0xbf0b('0x113')](db['CmList'],{'as':_0xbf0b('0x15c'),'foreignKey':_0xbf0b('0x15d')});db['FaxQueueReport'][_0xbf0b('0x113')](db['CmContact'],{'as':_0xbf0b('0x152'),'foreignKey':_0xbf0b('0x153')});db['FaxQueueReport'][_0xbf0b('0x113')](db[_0xbf0b('0x49')],{});db['FaxQueueReport'][_0xbf0b('0x113')](db[_0xbf0b('0x4a')],{});db[_0xbf0b('0x4e')][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{});db[_0xbf0b('0x4e')][_0xbf0b('0x113')](db[_0xbf0b('0x4c')],{});db['SmsAccount'][_0xbf0b('0x106')](db[_0xbf0b('0x77')],{'as':_0xbf0b('0x16e'),'foreignKey':'SmsAccountId','onDelete':_0xbf0b('0x103')});db[_0xbf0b('0x4f')][_0xbf0b('0x106')](db[_0xbf0b('0x76')],{'as':'Answers','foreignKey':_0xbf0b('0x176')});db['SmsAccount'][_0xbf0b('0x106')](db[_0xbf0b('0x54')],{'as':_0xbf0b('0x14d'),'foreignKey':_0xbf0b('0x176')});db['SmsAccount'][_0xbf0b('0x106')](db[_0xbf0b('0x53')],{'as':'Interactions'});db[_0xbf0b('0x4f')][_0xbf0b('0x106')](db[_0xbf0b('0x51')],{'as':_0xbf0b('0x170'),'foreignKey':_0xbf0b('0x176'),'onDelete':_0xbf0b('0x103')});db[_0xbf0b('0x4f')][_0xbf0b('0x113')](db[_0xbf0b('0x12b')],{'as':_0xbf0b('0x15c'),'foreignKey':_0xbf0b('0x15d')});db['SmsAccount'][_0xbf0b('0x113')](db[_0xbf0b('0x7a')],{'as':_0xbf0b('0x145'),'foreignKey':_0xbf0b('0x146')});db[_0xbf0b('0x4f')][_0xbf0b('0x114')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x148'),'through':_0xbf0b('0x136')});db[_0xbf0b('0x51')][_0xbf0b('0x113')](db['User'],{'onDelete':'restrict'});db[_0xbf0b('0x51')]['belongsTo'](db[_0xbf0b('0x127')],{'onDelete':_0xbf0b('0x158')});db[_0xbf0b('0x51')][_0xbf0b('0x113')](db[_0xbf0b('0x4f')],{'onDelete':_0xbf0b('0x158')});db['SmsApplication'][_0xbf0b('0x113')](db[_0xbf0b('0x79')],{'onDelete':_0xbf0b('0x158'),'foreignKey':_0xbf0b('0x16a')});db[_0xbf0b('0x51')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xbf0b('0x53')][_0xbf0b('0x106')](db['SmsMessage'],{'as':_0xbf0b('0x14d'),'onDelete':'cascade','foreignKey':_0xbf0b('0x177')});db[_0xbf0b('0x53')][_0xbf0b('0x113')](db[_0xbf0b('0x4f')],{'as':_0xbf0b('0x161'),'foreignKey':_0xbf0b('0x176')});db['SmsInteraction'][_0xbf0b('0x113')](db[_0xbf0b('0x68')],{'as':_0xbf0b('0x152'),'foreignKey':'ContactId'});db['SmsInteraction']['belongsTo'](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x162'),'foreignKey':'UserId'});db[_0xbf0b('0x53')]['belongsToMany'](db['Tag'],{'through':_0xbf0b('0x178'),'as':_0xbf0b('0x165')});db[_0xbf0b('0x53')][_0xbf0b('0x114')](db[_0xbf0b('0x163')],{'through':'sms_interaction_has_tags','as':_0xbf0b('0x179')});db['SmsInteraction'][_0xbf0b('0x114')](db[_0xbf0b('0x14')],{'as':'Users','through':_0xbf0b('0x11e'),'foreignKey':_0xbf0b('0x177')});db['SmsMessage'][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x14')});db[_0xbf0b('0x54')]['belongsTo'](db[_0xbf0b('0x68')],{'onDelete':_0xbf0b('0x103'),'as':_0xbf0b('0x152')});db[_0xbf0b('0x54')][_0xbf0b('0x113')](db['SmsInteraction'],{'onDelete':_0xbf0b('0x103'),'as':'Interaction','foreignKey':'SmsInteractionId'});db[_0xbf0b('0x54')][_0xbf0b('0x113')](db[_0xbf0b('0x4f')],{'as':_0xbf0b('0x161'),'foreignKey':_0xbf0b('0x176')});db[_0xbf0b('0x127')][_0xbf0b('0x114')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x148'),'through':'UserSmsQueue','foreignKey':_0xbf0b('0x17a')});db[_0xbf0b('0x127')][_0xbf0b('0x114')](db[_0xbf0b('0x149')],{'through':'team_has_sms_queues','as':'Teams'});db[_0xbf0b('0x132')][_0xbf0b('0x106')](db['Disposition'],{'as':_0xbf0b('0x16e'),'foreignKey':'OpenchannelAccountId','onDelete':_0xbf0b('0x103')});db[_0xbf0b('0x132')][_0xbf0b('0x106')](db[_0xbf0b('0x76')],{'as':_0xbf0b('0x15a'),'foreignKey':'OpenchannelAccountId'});db[_0xbf0b('0x132')][_0xbf0b('0x106')](db[_0xbf0b('0x59')],{'as':_0xbf0b('0x15b'),'foreignKey':_0xbf0b('0x17b')});db[_0xbf0b('0x132')]['hasMany'](db[_0xbf0b('0x17c')],{'as':_0xbf0b('0x14d'),'foreignKey':_0xbf0b('0x17b')});db[_0xbf0b('0x132')]['hasMany'](db['OpenchannelApplication'],{'as':'Applications','foreignKey':'OpenchannelAccountId','onDelete':_0xbf0b('0x103')});db[_0xbf0b('0x132')]['belongsTo'](db[_0xbf0b('0x12b')],{'as':'List','foreignKey':_0xbf0b('0x15d')});db[_0xbf0b('0x132')][_0xbf0b('0x113')](db['Pause'],{'as':_0xbf0b('0x145'),'foreignKey':_0xbf0b('0x146')});db[_0xbf0b('0x132')]['belongsToMany'](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x148'),'through':'user_has_openchannel_accounts'});db[_0xbf0b('0x58')]['belongsTo'](db[_0xbf0b('0x14')],{'onDelete':_0xbf0b('0x158')});db['OpenchannelApplication'][_0xbf0b('0x113')](db['OpenchannelQueue'],{'onDelete':_0xbf0b('0x158'),'foreignKey':'OpenchannelQueueId'});db[_0xbf0b('0x58')]['belongsTo'](db[_0xbf0b('0x132')],{'onDelete':_0xbf0b('0x158'),'foreignKey':_0xbf0b('0x17b')});db[_0xbf0b('0x58')][_0xbf0b('0x113')](db[_0xbf0b('0x79')],{'onDelete':'restrict','foreignKey':_0xbf0b('0x16a')});db['OpenchannelApplication'][_0xbf0b('0x113')](db[_0xbf0b('0x163')],{'onDelete':_0xbf0b('0x158'),'foreignKey':_0xbf0b('0x16b')});db[_0xbf0b('0x59')][_0xbf0b('0x106')](db['OpenchannelMessage'],{'as':_0xbf0b('0x14d'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0xbf0b('0x59')][_0xbf0b('0x113')](db[_0xbf0b('0x132')],{'as':_0xbf0b('0x161'),'foreignKey':'OpenchannelAccountId'});db[_0xbf0b('0x59')][_0xbf0b('0x113')](db['CmContact'],{'as':_0xbf0b('0x152'),'foreignKey':_0xbf0b('0x153')});db[_0xbf0b('0x59')][_0xbf0b('0x113')](db['User'],{'as':_0xbf0b('0x162'),'foreignKey':_0xbf0b('0x104')});db['OpenchannelInteraction'][_0xbf0b('0x114')](db[_0xbf0b('0x163')],{'through':_0xbf0b('0x17d'),'as':_0xbf0b('0x165')});db[_0xbf0b('0x59')]['belongsToMany'](db[_0xbf0b('0x163')],{'through':_0xbf0b('0x17d'),'as':_0xbf0b('0x179')});db[_0xbf0b('0x59')][_0xbf0b('0x114')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x166'),'through':'user_has_openchannel_interactions','foreignKey':_0xbf0b('0x17e')});db[_0xbf0b('0x17c')][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'onDelete':'cascade','as':_0xbf0b('0x14')});db[_0xbf0b('0x17c')]['belongsTo'](db[_0xbf0b('0x68')],{'onDelete':_0xbf0b('0x103'),'as':'Contact'});db[_0xbf0b('0x17c')]['belongsTo'](db[_0xbf0b('0x59')],{'onDelete':_0xbf0b('0x103'),'as':'Interaction','foreignKey':_0xbf0b('0x17e')});db[_0xbf0b('0x17c')][_0xbf0b('0x113')](db[_0xbf0b('0xdd')],{'as':'Attachment','foreignKey':_0xbf0b('0x174')});db['OpenchannelMessage'][_0xbf0b('0x113')](db[_0xbf0b('0x132')],{'as':_0xbf0b('0x161'),'foreignKey':_0xbf0b('0x17b')});db[_0xbf0b('0x5b')][_0xbf0b('0x114')](db['User'],{'as':_0xbf0b('0x148'),'through':'UserOpenchannelQueue','foreignKey':_0xbf0b('0x17f')});db[_0xbf0b('0x5b')]['belongsToMany'](db[_0xbf0b('0x149')],{'through':_0xbf0b('0x180'),'as':_0xbf0b('0x14a')});db[_0xbf0b('0x12d')]['hasMany'](db[_0xbf0b('0x77')],{'as':_0xbf0b('0x16e'),'foreignKey':_0xbf0b('0x168'),'onDelete':_0xbf0b('0x103')});db['ChatWebsite'][_0xbf0b('0x106')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xbf0b('0x168')});db[_0xbf0b('0x12d')][_0xbf0b('0x106')](db[_0xbf0b('0x181')],{'as':_0xbf0b('0x182')});db[_0xbf0b('0x12d')][_0xbf0b('0x106')](db[_0xbf0b('0x10c')],{'as':_0xbf0b('0x15b')});db[_0xbf0b('0x12d')]['hasMany'](db['ChatApplication'],{'as':_0xbf0b('0x170'),'foreignKey':_0xbf0b('0x168'),'onDelete':'cascade'});db[_0xbf0b('0x12d')]['hasMany'](db[_0xbf0b('0x183')],{'as':_0xbf0b('0x14d')});db['ChatWebsite'][_0xbf0b('0x113')](db['CmList'],{'as':_0xbf0b('0x15c'),'foreignKey':_0xbf0b('0x15d')});db[_0xbf0b('0x12d')][_0xbf0b('0x113')](db[_0xbf0b('0x79')],{'as':_0xbf0b('0x79'),'foreignKey':_0xbf0b('0x16a')});db[_0xbf0b('0x12d')][_0xbf0b('0x113')](db[_0xbf0b('0x155')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0xbf0b('0x12d')]['belongsTo'](db['Pause'],{'as':_0xbf0b('0x145'),'foreignKey':_0xbf0b('0x146')});db['ChatWebsite'][_0xbf0b('0x114')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x148'),'through':_0xbf0b('0x12f')});db['OpenchannelQueueReport'][_0xbf0b('0x113')](db['OpenchannelAccount'],{});db['OpenchannelQueueReport'][_0xbf0b('0x113')](db['CmList'],{'as':_0xbf0b('0x15c'),'foreignKey':'ListId'});db['OpenchannelQueueReport'][_0xbf0b('0x113')](db['CmContact'],{'as':'Contact','foreignKey':_0xbf0b('0x153')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0xbf0b('0x184')]['belongsTo'](db[_0xbf0b('0x17c')],{});db['OpenchannelQueueReport'][_0xbf0b('0x113')](db['User'],{});db[_0xbf0b('0x184')][_0xbf0b('0x113')](db[_0xbf0b('0x5b')],{});db[_0xbf0b('0x185')][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x186'),'foreignKey':_0xbf0b('0x104'),'onDelete':_0xbf0b('0x158')});db['ChatApplication'][_0xbf0b('0x113')](db[_0xbf0b('0x62')],{'as':_0xbf0b('0x187'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db[_0xbf0b('0x185')][_0xbf0b('0x113')](db[_0xbf0b('0x12d')],{'as':'Website','foreignKey':_0xbf0b('0x168'),'onDelete':'restrict'});db[_0xbf0b('0x185')][_0xbf0b('0x113')](db[_0xbf0b('0x163')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xbf0b('0x10c')][_0xbf0b('0x106')](db['ChatMessage'],{'as':'Messages','onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x188')});db[_0xbf0b('0x10c')][_0xbf0b('0x113')](db['ChatWebsite'],{'as':_0xbf0b('0x161'),'foreignKey':'ChatWebsiteId'});db[_0xbf0b('0x10c')]['belongsTo'](db[_0xbf0b('0x68')],{'as':_0xbf0b('0x152'),'foreignKey':_0xbf0b('0x153')});db['ChatInteraction'][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x162'),'foreignKey':_0xbf0b('0x104')});db['ChatInteraction'][_0xbf0b('0x114')](db[_0xbf0b('0x163')],{'through':_0xbf0b('0x189'),'as':_0xbf0b('0x165')});db[_0xbf0b('0x10c')][_0xbf0b('0x114')](db[_0xbf0b('0x163')],{'through':'chat_interaction_has_tags','as':_0xbf0b('0x179')});db[_0xbf0b('0x10c')][_0xbf0b('0x114')](db['User'],{'as':_0xbf0b('0x166'),'through':_0xbf0b('0x11c'),'foreignKey':'ChatInteractionId'});db[_0xbf0b('0x183')]['belongsTo'](db[_0xbf0b('0x14')],{'onDelete':'cascade','as':_0xbf0b('0x14')});db[_0xbf0b('0x183')]['belongsTo'](db[_0xbf0b('0x68')],{'onDelete':'cascade','as':_0xbf0b('0x152'),'foreignKey':_0xbf0b('0x153')});db['ChatMessage'][_0xbf0b('0x113')](db['ChatInteraction'],{'onDelete':_0xbf0b('0x103'),'as':_0xbf0b('0x167'),'foreignKey':_0xbf0b('0x188')});db[_0xbf0b('0x183')][_0xbf0b('0x113')](db[_0xbf0b('0xdd')],{'as':'Attachment','foreignKey':_0xbf0b('0x174')});db[_0xbf0b('0x183')][_0xbf0b('0x113')](db[_0xbf0b('0x12d')],{'as':_0xbf0b('0x161'),'foreignKey':_0xbf0b('0x168')});db[_0xbf0b('0x60')][_0xbf0b('0x106')](db[_0xbf0b('0xdd')],{'as':_0xbf0b('0x18a'),'foreignKey':_0xbf0b('0x169'),'onDelete':_0xbf0b('0x103'),'hooks':!![]});db['ChatOfflineMessage'][_0xbf0b('0x113')](db[_0xbf0b('0x68')],{'onDelete':_0xbf0b('0x103'),'as':_0xbf0b('0x152'),'foreignKey':_0xbf0b('0x153')});db[_0xbf0b('0x60')][_0xbf0b('0x113')](db[_0xbf0b('0x12d')],{'as':_0xbf0b('0x161'),'foreignKey':'ChatWebsiteId'});db[_0xbf0b('0x62')][_0xbf0b('0x114')](db['User'],{'as':_0xbf0b('0x148'),'through':_0xbf0b('0x2e'),'hooks':!![]});db[_0xbf0b('0x62')][_0xbf0b('0x114')](db[_0xbf0b('0x149')],{'through':_0xbf0b('0x18b'),'as':_0xbf0b('0x14a')});db['ChatGroup']['hasMany'](db['ChatInternalMessage'],{'as':_0xbf0b('0x14d'),'foreignKey':_0xbf0b('0x18c'),'onDelete':_0xbf0b('0x103')});db['ChatGroup'][_0xbf0b('0x114')](db[_0xbf0b('0x14')],{'as':'Members','through':'chat_group_has_users'});db[_0xbf0b('0x181')][_0xbf0b('0x113')](db['ChatWebsite'],{'as':_0xbf0b('0x18d'),'foreignKey':_0xbf0b('0x168')});db[_0xbf0b('0x66')][_0xbf0b('0x106')](db[_0xbf0b('0x68')],{'as':_0xbf0b('0x117'),'foreignKey':_0xbf0b('0x18e')});db[_0xbf0b('0x68')][_0xbf0b('0x106')](db[_0xbf0b('0x18f')],{'as':'Phones','foreignKey':_0xbf0b('0x190')});db[_0xbf0b('0x68')][_0xbf0b('0x106')](db[_0xbf0b('0x69')],{'as':_0xbf0b('0x13e'),'foreignKey':'ContactId'});db[_0xbf0b('0x68')][_0xbf0b('0x106')](db[_0xbf0b('0x6c')],{'as':_0xbf0b('0x10a'),'foreignKey':_0xbf0b('0x153')});db[_0xbf0b('0x68')][_0xbf0b('0x106')](db[_0xbf0b('0x6e')],{'as':'HopperHistories','foreignKey':_0xbf0b('0x153')});db[_0xbf0b('0x68')][_0xbf0b('0x106')](db[_0xbf0b('0x140')],{'as':_0xbf0b('0x140'),'foreignKey':_0xbf0b('0x153')});db[_0xbf0b('0x68')]['hasMany'](db[_0xbf0b('0xc9')],{'as':_0xbf0b('0x141'),'foreignKey':'ContactId'});db[_0xbf0b('0x68')][_0xbf0b('0x106')](db[_0xbf0b('0x59')],{'as':'OpenchannelInteractions','foreignKey':_0xbf0b('0x153'),'onDelete':'restrict'});db[_0xbf0b('0x68')][_0xbf0b('0x106')](db[_0xbf0b('0x10c')],{'as':_0xbf0b('0x10d'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xbf0b('0x68')][_0xbf0b('0x106')](db[_0xbf0b('0x53')],{'as':_0xbf0b('0x10e'),'foreignKey':_0xbf0b('0x153'),'onDelete':_0xbf0b('0x158')});db[_0xbf0b('0x68')][_0xbf0b('0x106')](db['FaxInteraction'],{'as':_0xbf0b('0x10f'),'foreignKey':_0xbf0b('0x153'),'onDelete':_0xbf0b('0x158')});db['CmContact'][_0xbf0b('0x106')](db[_0xbf0b('0x3d')],{'as':_0xbf0b('0x11a'),'foreignKey':_0xbf0b('0x153'),'onDelete':'restrict'});db[_0xbf0b('0x68')][_0xbf0b('0x113')](db[_0xbf0b('0x66')],{'as':'Company','foreignKey':_0xbf0b('0x18e')});db['CmContact'][_0xbf0b('0x113')](db['CmList'],{'as':_0xbf0b('0x15c'),'foreignKey':_0xbf0b('0x15d'),'onDelete':_0xbf0b('0x103')});db[_0xbf0b('0x68')][_0xbf0b('0x114')](db[_0xbf0b('0x14')],{'as':'Users','through':_0xbf0b('0x118')});db['CmContact'][_0xbf0b('0x114')](db[_0xbf0b('0x163')],{'as':_0xbf0b('0x165'),'through':'cm_contact_has_tags'});db['CmContact'][_0xbf0b('0x114')](db[_0xbf0b('0x163')],{'through':'cm_contact_has_tags','as':_0xbf0b('0x179')});db[_0xbf0b('0x69')][_0xbf0b('0x106')](db[_0xbf0b('0x84')],{'as':_0xbf0b('0x191'),'foreignKey':_0xbf0b('0x192')});db[_0xbf0b('0x69')][_0xbf0b('0x113')](db[_0xbf0b('0x68')],{'as':_0xbf0b('0x152'),'foreignKey':'ContactId','onDelete':_0xbf0b('0x103')});db[_0xbf0b('0x69')][_0xbf0b('0x113')](db[_0xbf0b('0x12b')],{'as':_0xbf0b('0x15c'),'foreignKey':_0xbf0b('0x15d'),'onDelete':_0xbf0b('0x103')});db['CmHopper'][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x186'),'foreignKey':_0xbf0b('0x104')});db[_0xbf0b('0x69')][_0xbf0b('0x113')](db[_0xbf0b('0x1d')],{'as':_0xbf0b('0x187'),'foreignKey':_0xbf0b('0x13d'),'onDelete':_0xbf0b('0x103')});db[_0xbf0b('0x69')][_0xbf0b('0x113')](db[_0xbf0b('0xda')],{'as':_0xbf0b('0xda'),'foreignKey':_0xbf0b('0x193'),'onDelete':_0xbf0b('0x103')});db[_0xbf0b('0x69')][_0xbf0b('0x113')](db['User'],{'as':_0xbf0b('0x162'),'foreignKey':_0xbf0b('0x194')});db['CmHopperBlack'][_0xbf0b('0x113')](db[_0xbf0b('0x68')],{'as':_0xbf0b('0x152'),'foreignKey':_0xbf0b('0x153'),'onDelete':_0xbf0b('0x103')});db['CmHopperBlack'][_0xbf0b('0x113')](db[_0xbf0b('0x12b')],{'as':_0xbf0b('0x15c'),'foreignKey':'ListId','onDelete':_0xbf0b('0x103')});db[_0xbf0b('0x195')][_0xbf0b('0x113')](db[_0xbf0b('0x1d')],{'as':_0xbf0b('0x187'),'foreignKey':_0xbf0b('0x13d'),'onDelete':_0xbf0b('0x103')});db[_0xbf0b('0x195')]['belongsTo'](db[_0xbf0b('0xda')],{'as':_0xbf0b('0xda'),'foreignKey':_0xbf0b('0x193'),'onDelete':_0xbf0b('0x103')});db[_0xbf0b('0x74')]['hasMany'](db[_0xbf0b('0x78')],{'as':{'plural':_0xbf0b('0x196'),'singular':_0xbf0b('0x197')},'foreignKey':'AutomationAllId','onDelete':_0xbf0b('0x103'),'hooks':!![]});db[_0xbf0b('0x74')][_0xbf0b('0x106')](db['Condition'],{'as':{'plural':'Any','singular':_0xbf0b('0x198')},'foreignKey':_0xbf0b('0x199'),'onDelete':_0xbf0b('0x103'),'hooks':!![]});db[_0xbf0b('0x74')][_0xbf0b('0x106')](db[_0xbf0b('0x72')],{'as':_0xbf0b('0x19a'),'foreignKey':_0xbf0b('0x19b'),'onDelete':_0xbf0b('0x103'),'hooks':!![]});db[_0xbf0b('0x77')][_0xbf0b('0x106')](db[_0xbf0b('0x77')],{'as':_0xbf0b('0x16e'),'foreignKey':_0xbf0b('0x19c'),'onDelete':'cascade'});db[_0xbf0b('0x79')][_0xbf0b('0x106')](db['Interval'],{'as':_0xbf0b('0x19d'),'foreignKey':_0xbf0b('0x16a'),'onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0xbf0b('0x106')](db['VoiceExtension'],{'as':_0xbf0b('0x109'),'foreignKey':_0xbf0b('0x16a'),'onDelete':_0xbf0b('0x158')});db[_0xbf0b('0x79')][_0xbf0b('0x106')](db[_0xbf0b('0x40')],{'as':_0xbf0b('0x19e'),'foreignKey':'IntervalId'});db['Interval']['hasMany'](db['ChatApplication'],{'as':_0xbf0b('0x19f'),'foreignKey':_0xbf0b('0x16a')});db['Interval'][_0xbf0b('0x106')](db['FaxApplication'],{'as':_0xbf0b('0x1a0'),'foreignKey':'IntervalId'});db[_0xbf0b('0x79')][_0xbf0b('0x106')](db[_0xbf0b('0x51')],{'as':_0xbf0b('0x1a1'),'foreignKey':'IntervalId'});db[_0xbf0b('0x80')][_0xbf0b('0x113')](db[_0xbf0b('0x155')],{});db[_0xbf0b('0x80')]['belongsTo'](db[_0xbf0b('0x90')],{'foreignKey':_0xbf0b('0x1a2')});db[_0xbf0b('0x80')][_0xbf0b('0x113')](db[_0xbf0b('0x8e')],{'foreignKey':_0xbf0b('0x1a3')});db['Sound'][_0xbf0b('0x114')](db[_0xbf0b('0x1b')],{'as':_0xbf0b('0x1a4'),'through':_0xbf0b('0x1a5'),'onDelete':'restrict'});db[_0xbf0b('0x163')][_0xbf0b('0x114')](db[_0xbf0b('0x68')],{'through':_0xbf0b('0x1a6')});db[_0xbf0b('0x163')]['belongsToMany'](db[_0xbf0b('0x10c')],{'through':_0xbf0b('0x189')});db[_0xbf0b('0x163')][_0xbf0b('0x114')](db[_0xbf0b('0x3d')],{'through':'mail_interaction_has_tags'});db['Tag'][_0xbf0b('0x114')](db[_0xbf0b('0x53')],{'through':'sms_interaction_has_tags'});db['Tag'][_0xbf0b('0x114')](db[_0xbf0b('0x49')],{'through':'fax_interaction_has_tags'});db[_0xbf0b('0x163')][_0xbf0b('0x114')](db[_0xbf0b('0x59')],{'through':_0xbf0b('0x17d')});db[_0xbf0b('0x163')][_0xbf0b('0x114')](db[_0xbf0b('0xef')],{'through':_0xbf0b('0x1a7')});db[_0xbf0b('0x18f')][_0xbf0b('0x113')](db[_0xbf0b('0x1a8')],{'as':_0xbf0b('0x1a9'),'foreignKey':_0xbf0b('0x1aa')});db[_0xbf0b('0x84')][_0xbf0b('0x113')](db[_0xbf0b('0x69')],{'as':'Hopper','foreignKey':_0xbf0b('0x192')});db[_0xbf0b('0x18f')]['belongsTo'](db[_0xbf0b('0x68')],{'as':'Contact','foreignKey':'CmContactId'});db[_0xbf0b('0x88')][_0xbf0b('0x106')](db[_0xbf0b('0x78')],{'as':{'plural':'AllConditions','singular':'AllCondition'},'foreignKey':_0xbf0b('0x1ab'),'onDelete':_0xbf0b('0x103'),'hooks':!![]});db[_0xbf0b('0x88')][_0xbf0b('0x106')](db[_0xbf0b('0x78')],{'as':{'plural':_0xbf0b('0x1ac'),'singular':_0xbf0b('0x1ad')},'foreignKey':'TriggerAnyId','onDelete':_0xbf0b('0x103'),'hooks':!![]});db[_0xbf0b('0x88')][_0xbf0b('0x106')](db[_0xbf0b('0x72')],{'as':_0xbf0b('0x19a'),'foreignKey':_0xbf0b('0x1ae'),'onDelete':'cascade','hooks':!![]});db[_0xbf0b('0x8e')][_0xbf0b('0x106')](db[_0xbf0b('0x95')],{'as':_0xbf0b('0x1af'),'onDelete':'cascade','foreignKey':_0xbf0b('0x1a3'),'hooks':!![]});db['AnalyticDefaultReport'][_0xbf0b('0x106')](db[_0xbf0b('0x95')],{'as':_0xbf0b('0x1af'),'onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x1a2')});db[_0xbf0b('0x94')][_0xbf0b('0x106')](db[_0xbf0b('0x95')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xbf0b('0x1b0')});db['AnalyticFieldReport']['belongsTo'](db[_0xbf0b('0x94')],{'foreignKey':_0xbf0b('0x1b0')});db['SalesforceAccount'][_0xbf0b('0x106')](db[_0xbf0b('0x98')],{'as':_0xbf0b('0x1b1'),'onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x1b2')});db[_0xbf0b('0x98')][_0xbf0b('0x106')](db[_0xbf0b('0x99')],{'as':'Subjects','onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x1b3')});db['SalesforceConfiguration']['hasMany'](db[_0xbf0b('0x99')],{'as':'Descriptions','onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x1b4')});db['SalesforceConfiguration'][_0xbf0b('0x106')](db[_0xbf0b('0x99')],{'as':_0xbf0b('0x1af'),'onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x1b5')});db[_0xbf0b('0x98')][_0xbf0b('0x113')](db['SalesforceAccount'],{'as':_0xbf0b('0x161'),'foreignKey':_0xbf0b('0x1b2')});db[_0xbf0b('0x99')][_0xbf0b('0x106')](db[_0xbf0b('0x99')],{'as':'Subject','foreignKey':_0xbf0b('0x1b3')});db[_0xbf0b('0x99')][_0xbf0b('0x106')](db[_0xbf0b('0x99')],{'as':_0xbf0b('0x1b6'),'foreignKey':'DescriptionId'});db[_0xbf0b('0x99')][_0xbf0b('0x106')](db[_0xbf0b('0x99')],{'as':_0xbf0b('0x1b7'),'foreignKey':_0xbf0b('0x1b5')});db[_0xbf0b('0x99')][_0xbf0b('0x113')](db[_0xbf0b('0x1b8')],{'as':'Variable','foreignKey':'VariableId'});db[_0xbf0b('0x9b')][_0xbf0b('0x106')](db[_0xbf0b('0x1b9')],{'as':_0xbf0b('0x1b1'),'onDelete':'cascade','foreignKey':_0xbf0b('0x1b2')});db[_0xbf0b('0x1b9')][_0xbf0b('0x106')](db[_0xbf0b('0x9c')],{'as':'Subjects','onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x1b3')});db['SugarcrmConfiguration'][_0xbf0b('0x106')](db[_0xbf0b('0x9c')],{'as':_0xbf0b('0x1ba'),'onDelete':'cascade','foreignKey':_0xbf0b('0x1b4')});db['SugarcrmConfiguration'][_0xbf0b('0x106')](db[_0xbf0b('0x9c')],{'as':_0xbf0b('0x1af'),'onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x1b5')});db[_0xbf0b('0x1b9')][_0xbf0b('0x113')](db[_0xbf0b('0x9b')],{'as':'Account','foreignKey':_0xbf0b('0x1b2')});db[_0xbf0b('0x9c')][_0xbf0b('0x106')](db[_0xbf0b('0x9c')],{'as':_0xbf0b('0x1bb'),'foreignKey':_0xbf0b('0x1b3')});db['SugarcrmField'][_0xbf0b('0x106')](db[_0xbf0b('0x9c')],{'as':_0xbf0b('0x1b6'),'foreignKey':'DescriptionId'});db[_0xbf0b('0x9c')][_0xbf0b('0x106')](db[_0xbf0b('0x9c')],{'as':'Field','foreignKey':_0xbf0b('0x1b5')});db['SugarcrmField']['belongsTo'](db[_0xbf0b('0x1b8')],{'as':_0xbf0b('0x1b8'),'foreignKey':_0xbf0b('0x1bc')});db['DeskAccount'][_0xbf0b('0x106')](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x1b2')});db[_0xbf0b('0xa0')][_0xbf0b('0x106')](db[_0xbf0b('0xa1')],{'as':_0xbf0b('0x1bd'),'onDelete':'cascade','foreignKey':_0xbf0b('0x1b3')});db[_0xbf0b('0xa0')]['hasMany'](db[_0xbf0b('0xa1')],{'as':_0xbf0b('0x1ba'),'onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x1b4')});db['DeskConfiguration'][_0xbf0b('0x106')](db[_0xbf0b('0xa1')],{'as':_0xbf0b('0x1af'),'onDelete':'cascade','foreignKey':_0xbf0b('0x1b5')});db[_0xbf0b('0xa0')]['belongsTo'](db[_0xbf0b('0x9e')],{'as':_0xbf0b('0x161'),'foreignKey':_0xbf0b('0x1b2')});db[_0xbf0b('0xa0')][_0xbf0b('0x114')](db['Tag'],{'through':_0xbf0b('0x1be')});db[_0xbf0b('0xa1')][_0xbf0b('0x106')](db['DeskField'],{'as':_0xbf0b('0x1bb'),'foreignKey':'SubjectId'});db[_0xbf0b('0xa1')][_0xbf0b('0x106')](db[_0xbf0b('0xa1')],{'as':_0xbf0b('0x1b6'),'foreignKey':_0xbf0b('0x1b4')});db[_0xbf0b('0xa1')][_0xbf0b('0x106')](db[_0xbf0b('0xa1')],{'as':_0xbf0b('0x1b7'),'foreignKey':_0xbf0b('0x1b5')});db[_0xbf0b('0xa1')][_0xbf0b('0x113')](db[_0xbf0b('0x1b8')],{'as':_0xbf0b('0x1b8'),'foreignKey':_0xbf0b('0x1bc')});db['ZohoAccount'][_0xbf0b('0x106')](db[_0xbf0b('0xa3')],{'as':_0xbf0b('0x1b1'),'onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x1b2')});db[_0xbf0b('0xa3')][_0xbf0b('0x106')](db[_0xbf0b('0xa5')],{'as':_0xbf0b('0x1bd'),'onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x1b3')});db[_0xbf0b('0xa3')]['hasMany'](db['ZohoField'],{'as':'Descriptions','onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x1b4')});db['ZohoConfiguration'][_0xbf0b('0x106')](db['ZohoField'],{'as':_0xbf0b('0x1af'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xbf0b('0xa3')][_0xbf0b('0x113')](db[_0xbf0b('0xa2')],{'as':_0xbf0b('0x161'),'foreignKey':_0xbf0b('0x1b2')});db['ZohoField'][_0xbf0b('0x106')](db['ZohoField'],{'as':_0xbf0b('0x1bb'),'foreignKey':_0xbf0b('0x1b3')});db[_0xbf0b('0xa5')]['hasMany'](db[_0xbf0b('0xa5')],{'as':_0xbf0b('0x1b6'),'foreignKey':_0xbf0b('0x1b4')});db[_0xbf0b('0xa5')][_0xbf0b('0x106')](db[_0xbf0b('0xa5')],{'as':_0xbf0b('0x1b7'),'foreignKey':_0xbf0b('0x1b5')});db[_0xbf0b('0xa5')][_0xbf0b('0x113')](db['Variable'],{'as':_0xbf0b('0x1b8'),'foreignKey':_0xbf0b('0x1bc')});db[_0xbf0b('0xa7')][_0xbf0b('0x106')](db[_0xbf0b('0xa9')],{'as':_0xbf0b('0x1b1'),'onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x1b2')});db[_0xbf0b('0xa9')][_0xbf0b('0x106')](db[_0xbf0b('0xaa')],{'as':_0xbf0b('0x1bd'),'foreignKey':'SubjectId'});db[_0xbf0b('0xa9')]['hasMany'](db[_0xbf0b('0xaa')],{'as':_0xbf0b('0x1ba'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0xbf0b('0x106')](db[_0xbf0b('0xaa')],{'as':_0xbf0b('0x1af'),'foreignKey':_0xbf0b('0x1b5')});db[_0xbf0b('0xa9')]['belongsTo'](db[_0xbf0b('0xa7')],{'as':_0xbf0b('0x161'),'foreignKey':_0xbf0b('0x1b2')});db[_0xbf0b('0xa9')][_0xbf0b('0x114')](db[_0xbf0b('0x163')],{'through':_0xbf0b('0x1bf')});db[_0xbf0b('0xaa')]['hasMany'](db[_0xbf0b('0xaa')],{'as':_0xbf0b('0x1bb'),'foreignKey':_0xbf0b('0x1b3')});db[_0xbf0b('0xaa')][_0xbf0b('0x106')](db[_0xbf0b('0xaa')],{'as':'Description','foreignKey':_0xbf0b('0x1b4')});db[_0xbf0b('0xaa')][_0xbf0b('0x106')](db[_0xbf0b('0xaa')],{'as':'Field','foreignKey':_0xbf0b('0x1b5')});db[_0xbf0b('0xaa')][_0xbf0b('0x113')](db[_0xbf0b('0x1b8')],{'as':_0xbf0b('0x1b8'),'foreignKey':_0xbf0b('0x1bc')});db[_0xbf0b('0xab')][_0xbf0b('0x106')](db[_0xbf0b('0x1c0')],{'as':_0xbf0b('0x1b1'),'onDelete':_0xbf0b('0x103'),'foreignKey':'AccountId'});db[_0xbf0b('0x1c0')]['hasMany'](db[_0xbf0b('0xad')],{'as':_0xbf0b('0x1bd'),'onDelete':_0xbf0b('0x103'),'foreignKey':'SubjectId'});db[_0xbf0b('0x1c0')][_0xbf0b('0x106')](db['FreshdeskField'],{'as':_0xbf0b('0x1ba'),'onDelete':_0xbf0b('0x103'),'foreignKey':'DescriptionId'});db[_0xbf0b('0x1c0')][_0xbf0b('0x106')](db['FreshdeskField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0xbf0b('0x1b5')});db['FreshdeskConfiguration'][_0xbf0b('0x113')](db[_0xbf0b('0xab')],{'as':'Account','foreignKey':_0xbf0b('0x1b2')});db[_0xbf0b('0x1c0')][_0xbf0b('0x114')](db[_0xbf0b('0x163')],{'through':_0xbf0b('0x1c1')});db[_0xbf0b('0xad')]['hasMany'](db[_0xbf0b('0xad')],{'as':_0xbf0b('0x1bb'),'foreignKey':'SubjectId'});db[_0xbf0b('0xad')][_0xbf0b('0x106')](db[_0xbf0b('0xad')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xbf0b('0xad')][_0xbf0b('0x106')](db[_0xbf0b('0xad')],{'as':'Field','foreignKey':_0xbf0b('0x1b5')});db['FreshdeskField'][_0xbf0b('0x113')](db[_0xbf0b('0x1b8')],{'as':_0xbf0b('0x1b8'),'foreignKey':_0xbf0b('0x1bc')});db[_0xbf0b('0x1c2')][_0xbf0b('0x106')](db[_0xbf0b('0xb0')],{'as':_0xbf0b('0x1b1'),'onDelete':_0xbf0b('0x103'),'foreignKey':'AccountId'});db[_0xbf0b('0xb0')]['hasMany'](db['VtigerField'],{'as':_0xbf0b('0x1bd'),'foreignKey':'SubjectId'});db[_0xbf0b('0xb0')][_0xbf0b('0x106')](db[_0xbf0b('0xb2')],{'as':_0xbf0b('0x1ba'),'foreignKey':_0xbf0b('0x1b4')});db[_0xbf0b('0xb0')][_0xbf0b('0x106')](db[_0xbf0b('0xb2')],{'as':_0xbf0b('0x1af'),'foreignKey':'FieldId'});db[_0xbf0b('0xb0')][_0xbf0b('0x113')](db['VtigerAccount'],{'as':_0xbf0b('0x161'),'foreignKey':_0xbf0b('0x1b2')});db[_0xbf0b('0xb2')][_0xbf0b('0x106')](db[_0xbf0b('0xb2')],{'as':'Subject','foreignKey':_0xbf0b('0x1b3')});db[_0xbf0b('0xb2')][_0xbf0b('0x106')](db[_0xbf0b('0xb2')],{'as':_0xbf0b('0x1b6'),'foreignKey':_0xbf0b('0x1b4')});db['VtigerField'][_0xbf0b('0x106')](db[_0xbf0b('0xb2')],{'as':_0xbf0b('0x1b7'),'foreignKey':_0xbf0b('0x1b5')});db['VtigerField'][_0xbf0b('0x113')](db[_0xbf0b('0x1b8')],{'as':'Variable','foreignKey':_0xbf0b('0x1bc')});db['ServicenowAccount'][_0xbf0b('0x106')](db[_0xbf0b('0xb5')],{'as':_0xbf0b('0x1b1'),'onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x1b2')});db['ServicenowConfiguration'][_0xbf0b('0x106')](db[_0xbf0b('0xb7')],{'as':_0xbf0b('0x1bd'),'foreignKey':'SubjectId'});db[_0xbf0b('0xb5')][_0xbf0b('0x106')](db[_0xbf0b('0xb7')],{'as':_0xbf0b('0x1ba'),'foreignKey':_0xbf0b('0x1b4')});db['ServicenowConfiguration']['hasMany'](db[_0xbf0b('0xb7')],{'as':_0xbf0b('0x1af'),'foreignKey':_0xbf0b('0x1b5')});db[_0xbf0b('0xb5')][_0xbf0b('0x113')](db[_0xbf0b('0xb3')],{'as':_0xbf0b('0x161'),'foreignKey':'AccountId'});db[_0xbf0b('0xb7')][_0xbf0b('0x106')](db[_0xbf0b('0xb7')],{'as':_0xbf0b('0x1bb'),'foreignKey':_0xbf0b('0x1b3')});db[_0xbf0b('0xb7')]['hasMany'](db[_0xbf0b('0xb7')],{'as':_0xbf0b('0x1b6'),'foreignKey':'DescriptionId'});db[_0xbf0b('0xb7')][_0xbf0b('0x106')](db['ServicenowField'],{'as':_0xbf0b('0x1b7'),'foreignKey':'FieldId'});db['ServicenowField'][_0xbf0b('0x113')](db[_0xbf0b('0x1b8')],{'as':_0xbf0b('0x1b8'),'foreignKey':_0xbf0b('0x1bc')});db['Dynamics365Account'][_0xbf0b('0x106')](db[_0xbf0b('0xba')],{'as':_0xbf0b('0x1b1'),'onDelete':'cascade','foreignKey':_0xbf0b('0x1b2')});db['Dynamics365Account'][_0xbf0b('0x113')](db[_0xbf0b('0xf8')],{'as':_0xbf0b('0xf8'),'foreignKey':'CloudProviderId'});db[_0xbf0b('0xba')]['hasMany'](db[_0xbf0b('0x1c3')],{'as':_0xbf0b('0x1bd'),'onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x1b3')});db[_0xbf0b('0xba')][_0xbf0b('0x106')](db[_0xbf0b('0x1c3')],{'as':_0xbf0b('0x1ba'),'onDelete':'cascade','foreignKey':_0xbf0b('0x1b4')});db['Dynamics365Configuration']['hasMany'](db[_0xbf0b('0x1c3')],{'as':'Fields','onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x1b5')});db['Dynamics365Configuration'][_0xbf0b('0x113')](db[_0xbf0b('0xb9')],{'as':_0xbf0b('0x161'),'foreignKey':'AccountId'});db[_0xbf0b('0x1c3')][_0xbf0b('0x106')](db[_0xbf0b('0x1c3')],{'as':'Subject','foreignKey':_0xbf0b('0x1b3')});db[_0xbf0b('0x1c3')][_0xbf0b('0x106')](db[_0xbf0b('0x1c3')],{'as':'Description','foreignKey':_0xbf0b('0x1b4')});db[_0xbf0b('0x1c3')]['hasMany'](db[_0xbf0b('0x1c3')],{'as':_0xbf0b('0x1b7'),'foreignKey':_0xbf0b('0x1b5')});db['Dynamics365Field']['belongsTo'](db[_0xbf0b('0x1b8')],{'as':_0xbf0b('0x1b8'),'foreignKey':_0xbf0b('0x1bc')});db['FreshsalesAccount']['hasMany'](db[_0xbf0b('0xbe')],{'as':_0xbf0b('0x1b1'),'onDelete':_0xbf0b('0x103'),'foreignKey':'AccountId'});db[_0xbf0b('0xbe')][_0xbf0b('0x106')](db[_0xbf0b('0xbf')],{'as':_0xbf0b('0x1bd'),'foreignKey':_0xbf0b('0x1b3')});db[_0xbf0b('0xbe')][_0xbf0b('0x106')](db['FreshsalesField'],{'as':_0xbf0b('0x1ba'),'foreignKey':_0xbf0b('0x1b4')});db[_0xbf0b('0xbe')][_0xbf0b('0x106')](db[_0xbf0b('0xbf')],{'as':_0xbf0b('0x1af'),'foreignKey':_0xbf0b('0x1b5')});db['FreshsalesConfiguration'][_0xbf0b('0x113')](db['FreshsalesAccount'],{'as':_0xbf0b('0x161'),'foreignKey':_0xbf0b('0x1b2')});db['FreshsalesField'][_0xbf0b('0x106')](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xbf0b('0x1b3')});db[_0xbf0b('0xbf')][_0xbf0b('0x106')](db[_0xbf0b('0xbf')],{'as':_0xbf0b('0x1b6'),'foreignKey':_0xbf0b('0x1b4')});db[_0xbf0b('0xbf')][_0xbf0b('0x106')](db['FreshsalesField'],{'as':_0xbf0b('0x1b7'),'foreignKey':_0xbf0b('0x1b5')});db[_0xbf0b('0xbf')][_0xbf0b('0x113')](db[_0xbf0b('0x1b8')],{'as':_0xbf0b('0x1b8'),'foreignKey':'VariableId'});db[_0xbf0b('0xc3')][_0xbf0b('0x113')](db[_0xbf0b('0x12d')],{});db['ChatQueueReport'][_0xbf0b('0x113')](db[_0xbf0b('0x12b')],{'as':_0xbf0b('0x15c'),'foreignKey':_0xbf0b('0x15d')});db[_0xbf0b('0xc3')][_0xbf0b('0x113')](db[_0xbf0b('0x68')],{'as':_0xbf0b('0x152'),'foreignKey':_0xbf0b('0x153')});db['ChatQueueReport'][_0xbf0b('0x113')](db[_0xbf0b('0x10c')],{});db[_0xbf0b('0xc3')][_0xbf0b('0x113')](db['ChatMessage'],{});db[_0xbf0b('0xc3')]['belongsTo'](db[_0xbf0b('0x14')],{});db['ChatQueueReport'][_0xbf0b('0x113')](db[_0xbf0b('0x62')],{});db[_0xbf0b('0x1c4')][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x1c5')});db['ChatInternalMessage'][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'onDelete':_0xbf0b('0x103'),'foreignKey':'ToId'});db[_0xbf0b('0xc9')][_0xbf0b('0x106')](db['JscriptyQuestionReport'],{'foreignKey':_0xbf0b('0x1c6'),'onDelete':'cascade'});db[_0xbf0b('0xc9')][_0xbf0b('0x106')](db[_0xbf0b('0xc5')],{'foreignKey':_0xbf0b('0x1c6'),'onDelete':_0xbf0b('0x103')});db[_0xbf0b('0xcb')][_0xbf0b('0x113')](db[_0xbf0b('0x4f')],{});db[_0xbf0b('0xcb')]['belongsTo'](db['CmList'],{'as':_0xbf0b('0x15c'),'foreignKey':_0xbf0b('0x15d')});db[_0xbf0b('0xcb')]['belongsTo'](db[_0xbf0b('0x68')],{'as':_0xbf0b('0x152'),'foreignKey':'ContactId'});db[_0xbf0b('0xcb')][_0xbf0b('0x113')](db['SmsInteraction'],{});db[_0xbf0b('0xcb')][_0xbf0b('0x113')](db[_0xbf0b('0x54')],{});db[_0xbf0b('0xcb')][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{});db[_0xbf0b('0xcb')][_0xbf0b('0x113')](db[_0xbf0b('0x127')],{});db[_0xbf0b('0xd1')][_0xbf0b('0x106')](db[_0xbf0b('0xc9')],{'foreignKey':_0xbf0b('0x1c7')});db[_0xbf0b('0xd1')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0xbf0b('0x1c7')});db['JscriptyProject'][_0xbf0b('0x106')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0xbf0b('0x149')][_0xbf0b('0x114')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x148'),'through':_0xbf0b('0x119')});db[_0xbf0b('0x149')][_0xbf0b('0x114')](db[_0xbf0b('0x1d')],{'through':_0xbf0b('0xfa'),'as':'VoiceQueues'});db[_0xbf0b('0x149')][_0xbf0b('0x114')](db[_0xbf0b('0x3a')],{'through':'team_has_mail_queues','as':_0xbf0b('0x124')});db['Team'][_0xbf0b('0x114')](db[_0xbf0b('0x62')],{'through':_0xbf0b('0x18b'),'as':_0xbf0b('0x125')});db[_0xbf0b('0x149')][_0xbf0b('0x114')](db['FaxQueue'],{'through':_0xbf0b('0x175'),'as':_0xbf0b('0x126')});db[_0xbf0b('0x149')][_0xbf0b('0x114')](db['SmsQueue'],{'through':'team_has_sms_queues','as':_0xbf0b('0x128')});db[_0xbf0b('0x149')][_0xbf0b('0x114')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0xbf0b('0x149')][_0xbf0b('0x114')](db[_0xbf0b('0xf6')],{'through':_0xbf0b('0x1c8'),'as':_0xbf0b('0x129')});db[_0xbf0b('0x149')][_0xbf0b('0x114')](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':_0xbf0b('0x123')});db[_0xbf0b('0xda')]['hasMany'](db[_0xbf0b('0x69')],{'as':_0xbf0b('0x13e'),'foreignKey':_0xbf0b('0x193')});db['Campaign'][_0xbf0b('0x106')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0xbf0b('0xda')][_0xbf0b('0x106')](db[_0xbf0b('0x6e')],{'as':_0xbf0b('0x13f'),'foreignKey':_0xbf0b('0x193')});db['Campaign']['hasMany'](db[_0xbf0b('0x195')],{'as':_0xbf0b('0x1c9'),'foreignKey':_0xbf0b('0x193')});db['Campaign'][_0xbf0b('0x113')](db[_0xbf0b('0x27')],{'as':_0xbf0b('0x27'),'foreignKey':_0xbf0b('0x142')});db[_0xbf0b('0xda')]['belongsTo'](db[_0xbf0b('0x27')],{'as':_0xbf0b('0x143'),'foreignKey':_0xbf0b('0x144')});db[_0xbf0b('0xda')][_0xbf0b('0x113')](db[_0xbf0b('0x79')],{'as':_0xbf0b('0x79'),'foreignKey':_0xbf0b('0x16a')});db[_0xbf0b('0xda')][_0xbf0b('0x113')](db[_0xbf0b('0xd5')],{'as':_0xbf0b('0xd5'),'foreignKey':_0xbf0b('0x1ca')});db[_0xbf0b('0xda')]['belongsToMany'](db[_0xbf0b('0x12b')],{'as':'Lists','through':_0xbf0b('0x1cb')});db[_0xbf0b('0xda')][_0xbf0b('0x114')](db[_0xbf0b('0x12b')],{'as':_0xbf0b('0x1cc'),'through':_0xbf0b('0x1cd')});db['Attachment'][_0xbf0b('0x113')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0xbf0b('0x169')});db[_0xbf0b('0xdf')]['belongsTo'](db[_0xbf0b('0x3f')],{});db[_0xbf0b('0xdf')]['belongsTo'](db[_0xbf0b('0x3d')],{});db[_0xbf0b('0xdf')][_0xbf0b('0x113')](db[_0xbf0b('0x155')],{'foreignKey':_0xbf0b('0x1ce'),'as':_0xbf0b('0x1cf')});db['MailTransferReport']['belongsTo'](db['User'],{'foreignKey':_0xbf0b('0x1d0'),'as':'FromAgent'});db[_0xbf0b('0xdf')][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'foreignKey':_0xbf0b('0x1d1'),'as':_0xbf0b('0x1d2')});db['MailTransferReport'][_0xbf0b('0x113')](db[_0xbf0b('0x3a')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0xbf0b('0xdf')][_0xbf0b('0x113')](db[_0xbf0b('0x155')],{'foreignKey':_0xbf0b('0x1d3'),'as':_0xbf0b('0x1d4')});db['ChatTransferReport']['belongsTo'](db[_0xbf0b('0x183')],{});db[_0xbf0b('0xe0')][_0xbf0b('0x113')](db['ChatInteraction'],{});db[_0xbf0b('0xe0')][_0xbf0b('0x113')](db[_0xbf0b('0x12d')],{'foreignKey':_0xbf0b('0x1d5'),'as':'FromAccount'});db[_0xbf0b('0xe0')][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'foreignKey':_0xbf0b('0x1d0'),'as':_0xbf0b('0x1d6')});db['ChatTransferReport'][_0xbf0b('0x113')](db['User'],{'foreignKey':'ToUserId','as':_0xbf0b('0x1d2')});db['ChatTransferReport'][_0xbf0b('0x113')](db['ChatQueue'],{'foreignKey':_0xbf0b('0x1d7'),'as':_0xbf0b('0x1d8')});db['ChatTransferReport'][_0xbf0b('0x113')](db[_0xbf0b('0x12d')],{'foreignKey':_0xbf0b('0x1d9'),'as':_0xbf0b('0x1d4')});db[_0xbf0b('0x1da')]['belongsTo'](db['FaxMessage'],{});db[_0xbf0b('0x1da')][_0xbf0b('0x113')](db[_0xbf0b('0x49')],{});db[_0xbf0b('0x1da')][_0xbf0b('0x113')](db[_0xbf0b('0x46')],{'foreignKey':_0xbf0b('0x1db'),'as':'FromAccount'});db[_0xbf0b('0x1da')][_0xbf0b('0x113')](db['User'],{'foreignKey':_0xbf0b('0x1d0'),'as':_0xbf0b('0x1d6')});db[_0xbf0b('0x1da')][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xbf0b('0x1da')][_0xbf0b('0x113')](db[_0xbf0b('0x4c')],{'foreignKey':_0xbf0b('0x1dc'),'as':_0xbf0b('0x1d8')});db['FaxTransferReport'][_0xbf0b('0x113')](db[_0xbf0b('0x46')],{'foreignKey':_0xbf0b('0x1dd'),'as':_0xbf0b('0x1d4')});db['OpenchannelTransferReport'][_0xbf0b('0x113')](db[_0xbf0b('0x17c')],{});db[_0xbf0b('0x1de')][_0xbf0b('0x113')](db[_0xbf0b('0x59')],{});db['OpenchannelTransferReport'][_0xbf0b('0x113')](db[_0xbf0b('0x132')],{'foreignKey':_0xbf0b('0x1df'),'as':_0xbf0b('0x1cf')});db[_0xbf0b('0x1de')][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'foreignKey':_0xbf0b('0x1d0'),'as':_0xbf0b('0x1d6')});db['OpenchannelTransferReport'][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'foreignKey':_0xbf0b('0x1d1'),'as':_0xbf0b('0x1d2')});db[_0xbf0b('0x1de')]['belongsTo'](db[_0xbf0b('0x5b')],{'foreignKey':_0xbf0b('0x1e0'),'as':_0xbf0b('0x1d8')});db['OpenchannelTransferReport']['belongsTo'](db[_0xbf0b('0x132')],{'foreignKey':_0xbf0b('0x1e1'),'as':'ToAccount'});db[_0xbf0b('0xe3')][_0xbf0b('0x113')](db[_0xbf0b('0x54')],{});db[_0xbf0b('0xe3')][_0xbf0b('0x113')](db[_0xbf0b('0x53')],{});db[_0xbf0b('0xe3')][_0xbf0b('0x113')](db['SmsAccount'],{'foreignKey':_0xbf0b('0x1e2'),'as':_0xbf0b('0x1cf')});db['SmsTransferReport'][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'foreignKey':_0xbf0b('0x1d0'),'as':_0xbf0b('0x1d6')});db[_0xbf0b('0xe3')][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'foreignKey':_0xbf0b('0x1d1'),'as':'ToAgent'});db[_0xbf0b('0xe3')]['belongsTo'](db['SmsQueue'],{'foreignKey':_0xbf0b('0x1e3'),'as':_0xbf0b('0x1d8')});db['SmsTransferReport'][_0xbf0b('0x113')](db[_0xbf0b('0x4f')],{'foreignKey':_0xbf0b('0x1e4'),'as':_0xbf0b('0x1d4')});db[_0xbf0b('0x12b')][_0xbf0b('0x106')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xbf0b('0x15d'),'onDelete':'cascade'});db[_0xbf0b('0x12b')][_0xbf0b('0x106')](db[_0xbf0b('0x70')],{'as':_0xbf0b('0x1e5'),'foreignKey':_0xbf0b('0x15d')});db[_0xbf0b('0x12b')][_0xbf0b('0x106')](db[_0xbf0b('0x68')],{'as':'Contacts','onDelete':_0xbf0b('0x103'),'foreignKey':'ListId'});db['CmList'][_0xbf0b('0x106')](db[_0xbf0b('0x6c')],{'as':_0xbf0b('0x10a'),'foreignKey':_0xbf0b('0x15d')});db[_0xbf0b('0x12b')][_0xbf0b('0x106')](db['CmHopperHistory'],{'as':_0xbf0b('0x1e6'),'foreignKey':'ListId'});db[_0xbf0b('0x12b')][_0xbf0b('0x106')](db[_0xbf0b('0x140')],{'as':_0xbf0b('0x140'),'foreignKey':'ListId'});db[_0xbf0b('0x12b')][_0xbf0b('0x114')](db[_0xbf0b('0x1d')],{'as':_0xbf0b('0x1e7'),'through':'voice_queues_has_cm_lists'});db[_0xbf0b('0x12b')][_0xbf0b('0x114')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x148'),'through':_0xbf0b('0x12c')});db['VoicePrefix'][_0xbf0b('0x106')](db[_0xbf0b('0x108')],{'as':'Extensions','onDelete':'cascade'});db['VoicePrefix'][_0xbf0b('0x114')](db['User'],{'as':_0xbf0b('0x148'),'through':_0xbf0b('0xfe')});db[_0xbf0b('0xe4')][_0xbf0b('0x114')](db[_0xbf0b('0x149')],{'through':_0xbf0b('0xfc'),'as':'Teams'});db[_0xbf0b('0xe6')][_0xbf0b('0x106')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x166'),'foreignKey':'userProfileId'});db[_0xbf0b('0xe6')][_0xbf0b('0x106')](db[_0xbf0b('0xe7')],{'as':'UserProfileSections','foreignKey':_0xbf0b('0x1e8'),'onDelete':'cascade'});db[_0xbf0b('0xe7')][_0xbf0b('0x106')](db[_0xbf0b('0xe9')],{'as':'Resources','foreignKey':_0xbf0b('0x1e9'),'onDelete':_0xbf0b('0x103')});db[_0xbf0b('0xec')][_0xbf0b('0x106')](db[_0xbf0b('0x77')],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':_0xbf0b('0x103')});db['WhatsappAccount']['hasMany'](db[_0xbf0b('0x76')],{'as':'Answers','foreignKey':_0xbf0b('0x1ea')});db['WhatsappAccount'][_0xbf0b('0x106')](db['WhatsappMessage'],{'as':'Messages','foreignKey':_0xbf0b('0x1ea')});db[_0xbf0b('0xec')][_0xbf0b('0x106')](db[_0xbf0b('0xef')],{'as':_0xbf0b('0x15b')});db[_0xbf0b('0xec')][_0xbf0b('0x106')](db['WhatsappApplication'],{'as':_0xbf0b('0x170'),'foreignKey':_0xbf0b('0x1ea'),'onDelete':_0xbf0b('0x103')});db[_0xbf0b('0xec')][_0xbf0b('0x113')](db[_0xbf0b('0x12b')],{'as':_0xbf0b('0x15c'),'foreignKey':_0xbf0b('0x15d')});db[_0xbf0b('0xec')][_0xbf0b('0x113')](db[_0xbf0b('0x7a')],{'as':_0xbf0b('0x145'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xbf0b('0xec')]['belongsToMany'](db['User'],{'as':_0xbf0b('0x148'),'through':'user_has_whatsapp_accounts'});db[_0xbf0b('0xee')][_0xbf0b('0x113')](db['User'],{'onDelete':'restrict'});db[_0xbf0b('0xee')][_0xbf0b('0x113')](db[_0xbf0b('0xf6')],{'onDelete':_0xbf0b('0x158')});db['WhatsappApplication'][_0xbf0b('0x113')](db['WhatsappAccount'],{'onDelete':_0xbf0b('0x158')});db['WhatsappApplication']['belongsTo'](db[_0xbf0b('0x79')],{'onDelete':_0xbf0b('0x158'),'foreignKey':_0xbf0b('0x16a')});db['WhatsappApplication'][_0xbf0b('0x113')](db[_0xbf0b('0x163')],{'onDelete':_0xbf0b('0x158'),'foreignKey':_0xbf0b('0x16b')});db[_0xbf0b('0xef')][_0xbf0b('0x106')](db[_0xbf0b('0xf1')],{'as':_0xbf0b('0x14d'),'onDelete':_0xbf0b('0x103'),'foreignKey':_0xbf0b('0x1eb')});db[_0xbf0b('0xef')][_0xbf0b('0x113')](db[_0xbf0b('0xec')],{'as':_0xbf0b('0x161'),'foreignKey':'WhatsappAccountId'});db[_0xbf0b('0xef')][_0xbf0b('0x113')](db[_0xbf0b('0x68')],{'as':_0xbf0b('0x152'),'foreignKey':'ContactId'});db['WhatsappInteraction'][_0xbf0b('0x113')](db['User'],{'as':_0xbf0b('0x162'),'foreignKey':_0xbf0b('0x104')});db['WhatsappInteraction'][_0xbf0b('0x114')](db[_0xbf0b('0x163')],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0xbf0b('0xef')][_0xbf0b('0x114')](db[_0xbf0b('0x163')],{'through':'whatsapp_interaction_has_tags','as':_0xbf0b('0x179')});db['WhatsappInteraction'][_0xbf0b('0x114')](db[_0xbf0b('0x14')],{'as':'Users','through':_0xbf0b('0x121'),'foreignKey':_0xbf0b('0x1eb')});db['WhatsappMessage'][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x14')});db[_0xbf0b('0xf1')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db[_0xbf0b('0xf1')][_0xbf0b('0x113')](db[_0xbf0b('0xef')],{'onDelete':_0xbf0b('0x103'),'as':_0xbf0b('0x167'),'foreignKey':_0xbf0b('0x1eb')});db[_0xbf0b('0xf1')][_0xbf0b('0x113')](db[_0xbf0b('0xec')],{'as':_0xbf0b('0x161'),'foreignKey':_0xbf0b('0x1ea')});db[_0xbf0b('0xf2')][_0xbf0b('0x113')](db[_0xbf0b('0xec')],{});db[_0xbf0b('0xf2')][_0xbf0b('0x113')](db[_0xbf0b('0x12b')],{'as':_0xbf0b('0x15c'),'foreignKey':'ListId'});db[_0xbf0b('0xf2')][_0xbf0b('0x113')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xbf0b('0xf2')]['belongsTo'](db[_0xbf0b('0xef')],{});db[_0xbf0b('0xf2')][_0xbf0b('0x113')](db[_0xbf0b('0xf6')],{});db[_0xbf0b('0xf2')]['belongsTo'](db[_0xbf0b('0xf1')],{});db[_0xbf0b('0xf2')][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{});db['WhatsappTransferReport'][_0xbf0b('0x113')](db[_0xbf0b('0xf1')],{});db[_0xbf0b('0xf4')]['belongsTo'](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0xbf0b('0x113')](db[_0xbf0b('0xec')],{'foreignKey':_0xbf0b('0x1ec'),'as':'FromAccount'});db[_0xbf0b('0xf4')][_0xbf0b('0x113')](db[_0xbf0b('0xec')],{'foreignKey':_0xbf0b('0x1ed'),'as':_0xbf0b('0x1d4')});db[_0xbf0b('0xf4')][_0xbf0b('0x113')](db[_0xbf0b('0xf6')],{'foreignKey':'ToQueueId','as':_0xbf0b('0x1d8')});db[_0xbf0b('0xf4')][_0xbf0b('0x113')](db['User'],{'foreignKey':_0xbf0b('0x1d0'),'as':'FromAgent'});db[_0xbf0b('0xf4')][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'foreignKey':_0xbf0b('0x1d1'),'as':'ToAgent'});db[_0xbf0b('0xf6')][_0xbf0b('0x114')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x148'),'through':_0xbf0b('0x12a'),'foreignKey':_0xbf0b('0x1ee')});db[_0xbf0b('0xf6')]['belongsToMany'](db[_0xbf0b('0x149')],{'through':'team_has_whatsapp_queues','as':_0xbf0b('0x14a')});db['UserSetting'][_0xbf0b('0x113')](db[_0xbf0b('0x14')],{'as':_0xbf0b('0x1ef'),'foreignKey':_0xbf0b('0x104'),'onDelete':_0xbf0b('0x103'),'hooks':!![]});db['CloudProvider'][_0xbf0b('0x101')](db[_0xbf0b('0xb9')],{'as':_0xbf0b('0xb9'),'onDelete':_0xbf0b('0x158')});db[_0xbf0b('0xf8')][_0xbf0b('0x101')](db[_0xbf0b('0x154')],{'as':_0xbf0b('0x1f0'),'onDelete':_0xbf0b('0x158')});db[_0xbf0b('0xf8')][_0xbf0b('0x101')](db[_0xbf0b('0x38')],{'as':_0xbf0b('0x159'),'onDelete':_0xbf0b('0x158')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x0ca8=['../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','userSetting','hasMany','VoiceQueuesRt','HopperFinals','HopperHistory','OpenchannelInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotification','UserNotifications','SenderId','Hoppers','belongsTo','belongsToMany','chat_group_has_users','CmContact','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','ChatInteractions','user_has_fax_interactions','SmsInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','UserChatQueue','FaxQueues','SmsQueue','WhatsappQueues','ChatWebsites','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','Sounds','VoiceQueue','Members','VoiceQueueId','HopperHistories','HopperBlacks','Trunk','TrunkId','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Team','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Interactions','Template','TemplateId','team_has_mail_queues','MailInteractionId','Account','mail_interaction_has_tags','Users','user_has_mail_interactions','Attachments','Interaction','TagId','ListId','Items','FaxAccountId','Exntensions','FaxMessage','List','user_has_fax_accounts','Tags','fax_interaction_has_tags','FaxInteractionId','AttachmentId','Teams','SmsAccountId','Owner','sms_interaction_has_tags','user_has_sms_interactions','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ThroughTags','ChatWebsiteId','user_has_chat_websites','ChatApplication','Queue','ChatQueueId','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','team_has_chat_queues','Website','Contacts','CmContactHasItem','CmContactId','JscriptySessions','CompanyId','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','Automation','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ItemType','CmHopperAdditionalPhone','Hopper','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','CustomReportId','Fields','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','SalesforceAccount','Description','DescriptionId','Field','FieldId','Variable','Subject','VariableId','int_desk_configuration_has_tags','ZohoAccount','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskField','int_freshdesk_configuration_has_tags','FromId','ToId','SessionId','SmsQueueReport','ProjectId','team_has_fax_queues','SmsQueues','team_has_openchannel_queues','TrunkBackup','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToAccount','FromChatWebsiteId','ToChatWebsiteId','ToFaxQueueId','ToQueue','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','Extensions','UserProfileSections','Resources','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserWhatsappQueue','WhatsappQueueId','team_has_whatsapp_queues','exports','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','name','utf8_general_ci','sequelizeHistory','utf8mb4','utf8','database','username','options','password','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','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','DashboardItem','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','../api/team/team.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag'];(function(_0x3c2a18,_0x224b8d){var _0x336f6f=function(_0x2fe160){while(--_0x2fe160){_0x3c2a18['push'](_0x3c2a18['shift']());}};_0x336f6f(++_0x224b8d);}(_0x0ca8,0xe6));var _0x80ca=function(_0x4f3be7,_0x447558){_0x4f3be7=_0x4f3be7-0x0;var _0x499480=_0x0ca8[_0x4f3be7];return _0x499480;};'use strict';var config=require(_0x80ca('0x0'));var Sequelize=require(_0x80ca('0x1'));var _=require('lodash');var jstz=require(_0x80ca('0x2'));var timezone=jstz[_0x80ca('0x3')]();config['sequelize']=_[_0x80ca('0x4')](config[_0x80ca('0x1')],{'database':_0x80ca('0x5'),'username':_0x80ca('0x6'),'password':_0x80ca('0x7'),'options':{'host':_0x80ca('0x8'),'port':0xcea,'dialect':_0x80ca('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x80ca('0xa')](),'define':{'charset':'utf8','collate':_0x80ca('0xb')}}});config['sequelizeHistory']=_['defaultsDeep'](config[_0x80ca('0xc')],{'database':_0x80ca('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':_0x80ca('0x8'),'port':0xcea,'dialect':_0x80ca('0x9'),'dialectOptions':{'charset':_0x80ca('0xd')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x80ca('0xe'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x80ca('0x1')][_0x80ca('0xf')],config['sequelize'][_0x80ca('0x10')],config[_0x80ca('0x1')]['password'],config['sequelize'][_0x80ca('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x80ca('0xc')]['database'],config['sequelizeHistory']['username'],config[_0x80ca('0xc')][_0x80ca('0x12')],config[_0x80ca('0xc')][_0x80ca('0x11')])};db[_0x80ca('0x13')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x15'));db['VoiceChanSpy']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x16'));db[_0x80ca('0x17')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x18'));db[_0x80ca('0x19')]=db[_0x80ca('0x1')]['import'](_0x80ca('0x1a'));db[_0x80ca('0x1b')]=db['sequelize'][_0x80ca('0x14')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x1c'));db[_0x80ca('0x1d')]=db[_0x80ca('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x80ca('0x1e')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0x1f'));db[_0x80ca('0x20')]=db['sequelize'][_0x80ca('0x14')]('../api/voiceMail/voiceMail.model');db[_0x80ca('0x21')]=db[_0x80ca('0x1')]['import'](_0x80ca('0x22'));db[_0x80ca('0x23')]=db[_0x80ca('0x1')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x80ca('0x24')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x25'));db['VoiceAgentReport']=db['sequelize'][_0x80ca('0x14')](_0x80ca('0x26'));db[_0x80ca('0x27')]=db[_0x80ca('0x1')]['import'](_0x80ca('0x28'));db['MemberReport']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x29'));db['Trunk']=db[_0x80ca('0x1')]['import'](_0x80ca('0x2a'));db[_0x80ca('0x2b')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x2c'));db[_0x80ca('0x2d')]=db['sequelize'][_0x80ca('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x80ca('0x2e')]=db[_0x80ca('0x1')][_0x80ca('0x14')]('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x2f'));db[_0x80ca('0x30')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x31'));db[_0x80ca('0x32')]=db[_0x80ca('0x1')]['import']('../api/userFaxQueue/userFaxQueue.model');db[_0x80ca('0x33')]=db[_0x80ca('0x1')][_0x80ca('0x14')]('../api/userSmsQueue/userSmsQueue.model');db[_0x80ca('0x34')]=db[_0x80ca('0x1')]['import'](_0x80ca('0x35'));db['UserWhatsappQueue']=db[_0x80ca('0x1')]['import'](_0x80ca('0x36'));db[_0x80ca('0x37')]=db['sequelize']['import']('../api/mailServerIn/mailServerIn.model');db[_0x80ca('0x38')]=db[_0x80ca('0x1')][_0x80ca('0x14')]('../api/mailServerOut/mailServerOut.model');db[_0x80ca('0x39')]=db[_0x80ca('0x1')]['import'](_0x80ca('0x3a'));db[_0x80ca('0x3b')]=db[_0x80ca('0x1')]['import']('../api/mailQueue/mailQueue.model');db[_0x80ca('0x3c')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x3d'));db['MailInteraction']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x3e'));db[_0x80ca('0x3f')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x40'));db[_0x80ca('0x41')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x42'));db[_0x80ca('0x43')]=db[_0x80ca('0x1')]['import'](_0x80ca('0x44'));db[_0x80ca('0x45')]=db['sequelize'][_0x80ca('0x14')]('../api/dashboard/dashboard.model');db[_0x80ca('0x46')]=db[_0x80ca('0x1')][_0x80ca('0x14')]('../api/dashboardItem/dashboardItem.model');db[_0x80ca('0x47')]=db[_0x80ca('0x1')][_0x80ca('0x14')]('../api/faxAccount/faxAccount.model');db[_0x80ca('0x48')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0x49'));db[_0x80ca('0x4a')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0x4b'));db['FaxMessage']=db[_0x80ca('0x1')]['import'](_0x80ca('0x4c'));db[_0x80ca('0x4d')]=db['sequelize']['import'](_0x80ca('0x4e'));db[_0x80ca('0x4f')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0x50'));db[_0x80ca('0x51')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x52'));db[_0x80ca('0x53')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0x54'));db[_0x80ca('0x55')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0x56'));db[_0x80ca('0x57')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x58'));db['SmsQueue']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x59'));db[_0x80ca('0x5a')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x5b'));db[_0x80ca('0x5c')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0x5d'));db[_0x80ca('0x5e')]=db[_0x80ca('0x1')]['import'](_0x80ca('0x5f'));db[_0x80ca('0x60')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x61'));db[_0x80ca('0x62')]=db[_0x80ca('0x1')]['import'](_0x80ca('0x63'));db[_0x80ca('0x64')]=db[_0x80ca('0x1')]['import'](_0x80ca('0x65'));db[_0x80ca('0x66')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x67'));db['ChatApplication']=db[_0x80ca('0x1')][_0x80ca('0x14')]('../api/chatApplication/chatApplication.model');db[_0x80ca('0x68')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x69'));db[_0x80ca('0x6a')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x6b'));db[_0x80ca('0x6c')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x6d'));db[_0x80ca('0x6e')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0x6f'));db[_0x80ca('0x70')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0x71'));db[_0x80ca('0x72')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0x73'));db[_0x80ca('0x74')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x75'));db['CmContact']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x76'));db[_0x80ca('0x77')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0x78'));db[_0x80ca('0x79')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x7a'));db[_0x80ca('0x7b')]=db['sequelize']['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0x80ca('0x7c')]=db[_0x80ca('0x1')]['import'](_0x80ca('0x7d'));db[_0x80ca('0x7e')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0x7f'));db[_0x80ca('0x80')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x81'));db[_0x80ca('0x82')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0x83'));db['Automation']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x84'));db[_0x80ca('0x85')]=db[_0x80ca('0x1')][_0x80ca('0x14')]('../api/cannedAnswer/cannedAnswer.model');db[_0x80ca('0x86')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x87'));db[_0x80ca('0x88')]=db[_0x80ca('0x1')][_0x80ca('0x14')]('../api/condition/condition.model');db[_0x80ca('0x89')]=db[_0x80ca('0x1')]['import'](_0x80ca('0x8a'));db['Pause']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x8b'));db['Cdr']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x8c'));db[_0x80ca('0x8d')]=db[_0x80ca('0x1')][_0x80ca('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x80ca('0x8e')]=db['sequelize']['import'](_0x80ca('0x8f'));db[_0x80ca('0x90')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x91'));db[_0x80ca('0x92')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x93'));db[_0x80ca('0x94')]=db['sequelize']['import']('../api/contactItemType/contactItemType.model');db['CmContactHasItem']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x95'));db['CmHopperAdditionalPhone']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x96'));db['Template']=db['sequelize'][_0x80ca('0x14')](_0x80ca('0x97'));db[_0x80ca('0x98')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x99'));db['Variable']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x9a'));db[_0x80ca('0x9b')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0x9c'));db[_0x80ca('0x9d')]=db[_0x80ca('0x1')]['import'](_0x80ca('0x9e'));db['AnalyticCustomReport']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x9f'));db[_0x80ca('0xa0')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xa1'));db[_0x80ca('0xa2')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xa3'));db[_0x80ca('0xa4')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0xa5'));db[_0x80ca('0xa6')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xa7'));db['AnalyticTreeReport']=db['sequelize'][_0x80ca('0x14')](_0x80ca('0xa8'));db['SalesforceAccount']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xa9'));db[_0x80ca('0xaa')]=db[_0x80ca('0x1')][_0x80ca('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db['sequelize'][_0x80ca('0x14')](_0x80ca('0xab'));db[_0x80ca('0xac')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xad'));db[_0x80ca('0xae')]=db['sequelize'][_0x80ca('0x14')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x80ca('0xaf')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0xb0'));db[_0x80ca('0xb1')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xb2'));db[_0x80ca('0xb3')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0xb4'));db[_0x80ca('0xb5')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xb6'));db['ZohoAccount']=db['sequelize'][_0x80ca('0x14')](_0x80ca('0xb7'));db[_0x80ca('0xb8')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0xb9'));db[_0x80ca('0xba')]=db[_0x80ca('0x1')][_0x80ca('0x14')]('../api/intZohoField/intZohoField.model');db[_0x80ca('0xbb')]=db[_0x80ca('0x1')]['import'](_0x80ca('0xbc'));db[_0x80ca('0xbd')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0xbe'));db[_0x80ca('0xbf')]=db[_0x80ca('0x1')][_0x80ca('0x14')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xc0'));db[_0x80ca('0xc1')]=db[_0x80ca('0x1')]['import'](_0x80ca('0xc2'));db['FreshdeskField']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xc3'));db[_0x80ca('0xc4')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0xc5'));db[_0x80ca('0xc6')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0xc7'));db[_0x80ca('0xc8')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0xc9'));db[_0x80ca('0xca')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xcb'));db[_0x80ca('0xcc')]=db['sequelize'][_0x80ca('0x14')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x80ca('0xcd')]=db[_0x80ca('0x1')]['import'](_0x80ca('0xce'));db[_0x80ca('0xcf')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xd0'));db[_0x80ca('0xd1')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xd2'));db[_0x80ca('0xd3')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0xd4'));db[_0x80ca('0xd5')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xd6'));db[_0x80ca('0xd7')]=db[_0x80ca('0x1')]['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x80ca('0xd8')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xd9'));db['Integration']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x9c'));db[_0x80ca('0xda')]=db[_0x80ca('0x1')]['import'](_0x80ca('0xdb'));db[_0x80ca('0xdc')]=db['sequelize'][_0x80ca('0x14')]('../api/chatQueueReport/chatQueueReport.model');db[_0x80ca('0xdd')]=db[_0x80ca('0x1')]['import'](_0x80ca('0xde'));db[_0x80ca('0xdf')]=db[_0x80ca('0x1')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x80ca('0xe0')]=db['sequelize']['import'](_0x80ca('0xe1'));db[_0x80ca('0xe2')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xe3'));db['SmsQueueReport']=db[_0x80ca('0x1')]['import'](_0x80ca('0xe4'));db[_0x80ca('0xe5')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0xe6'));db[_0x80ca('0xe7')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xe8'));db[_0x80ca('0xe9')]=db['sequelize'][_0x80ca('0x14')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xea'));db[_0x80ca('0xeb')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0xec'));db[_0x80ca('0xed')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xee'));db['SquareRecording']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xef'));db['SquareMessage']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xf0'));db['Team']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xf1'));db['License']=db[_0x80ca('0x1')][_0x80ca('0x14')]('../api/license/license.model');db[_0x80ca('0xf2')]=db[_0x80ca('0x1')][_0x80ca('0x14')]('../api/campaign/campaign.model');db[_0x80ca('0xf3')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xf4'));db[_0x80ca('0xf5')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xf6'));db['Plugin']=db[_0x80ca('0x1')][_0x80ca('0x14')]('../api/plugin/plugin.model');db['MailTransferReport']=db['sequelize'][_0x80ca('0x14')]('../api/mailTransferReport/mailTransferReport.model');db[_0x80ca('0xf7')]=db[_0x80ca('0x1')]['import'](_0x80ca('0xf8'));db[_0x80ca('0xf9')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xfa'));db[_0x80ca('0xfb')]=db[_0x80ca('0x1')]['import'](_0x80ca('0xfc'));db[_0x80ca('0xfd')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0xfe'));db[_0x80ca('0xff')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x100'));db[_0x80ca('0x101')]=db[_0x80ca('0x1')][_0x80ca('0x14')]('../api/voicePrefix/voicePrefix.model');db[_0x80ca('0x102')]=db[_0x80ca('0x1')]['import'](_0x80ca('0x103'));db[_0x80ca('0x104')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0x105'));db[_0x80ca('0x106')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x107'));db['UserNotification']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x108'));db[_0x80ca('0x109')]=db[_0x80ca('0x1')]['import'](_0x80ca('0x10a'));db[_0x80ca('0x10b')]=db[_0x80ca('0x1')]['import'](_0x80ca('0x10c'));db[_0x80ca('0x10d')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x10e'));db[_0x80ca('0x10f')]=db['sequelize'][_0x80ca('0x14')](_0x80ca('0x110'));db[_0x80ca('0x111')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x112'));db[_0x80ca('0x113')]=db[_0x80ca('0x1')]['import'](_0x80ca('0x114'));db[_0x80ca('0x115')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x116'));db[_0x80ca('0x117')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x118'));db[_0x80ca('0x119')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x11a'));db['TeamVoicePrefix']=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x11b'));db[_0x80ca('0x11c')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x11d'));db[_0x80ca('0x11e')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x11f'));db[_0x80ca('0x120')]=db[_0x80ca('0x1')][_0x80ca('0x14')](_0x80ca('0x121'));db[_0x80ca('0x13')][_0x80ca('0x122')](db['VoiceMail'],{'as':_0x80ca('0x20'),'onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x124')});db['User'][_0x80ca('0x122')](db[_0x80ca('0x11e')],{'as':_0x80ca('0x125'),'onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x124')});db['User']['hasMany'](db['VoiceRecording'],{'as':'Recordings','foreignKey':_0x80ca('0x124')});db['User'][_0x80ca('0x126')](db[_0x80ca('0x2d')],{'as':_0x80ca('0x127'),'foreignKey':'UserId'});db[_0x80ca('0x13')][_0x80ca('0x126')](db[_0x80ca('0x19')],{'as':'Extensions','onDelete':_0x80ca('0x123'),'hooks':!![]});db['User'][_0x80ca('0x126')](db['CmHopperFinal'],{'as':_0x80ca('0x128'),'foreignKey':_0x80ca('0x124')});db[_0x80ca('0x13')]['hasMany'](db['CmHopperHistory'],{'as':_0x80ca('0x129'),'foreignKey':'UserId'});db['User'][_0x80ca('0x126')](db[_0x80ca('0x7e')],{'as':_0x80ca('0x7e'),'foreignKey':_0x80ca('0x124')});db[_0x80ca('0x13')][_0x80ca('0x126')](db['OpenchannelInteraction'],{'as':_0x80ca('0x12a'),'foreignKey':_0x80ca('0x124')});db[_0x80ca('0x13')]['hasMany'](db[_0x80ca('0x68')],{'as':'ChatInteractions','foreignKey':_0x80ca('0x124')});db[_0x80ca('0x13')][_0x80ca('0x126')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x80ca('0x124')});db[_0x80ca('0x13')][_0x80ca('0x126')](db[_0x80ca('0x4a')],{'as':_0x80ca('0x12b'),'foreignKey':_0x80ca('0x124')});db[_0x80ca('0x13')][_0x80ca('0x126')](db[_0x80ca('0x12c')],{'as':_0x80ca('0x12d'),'foreignKey':_0x80ca('0x124')});db[_0x80ca('0x13')][_0x80ca('0x126')](db[_0x80ca('0x10d')],{'as':_0x80ca('0x12e'),'foreignKey':_0x80ca('0x124')});db['User'][_0x80ca('0x126')](db[_0x80ca('0x12f')],{'as':_0x80ca('0x130'),'foreignKey':_0x80ca('0x131')});db[_0x80ca('0x13')]['hasMany'](db['CmHopper'],{'as':_0x80ca('0x132'),'foreignKey':_0x80ca('0x124'),'onDelete':'SET\x20NULL'});db['User'][_0x80ca('0x133')](db['UserProfile'],{'as':_0x80ca('0x102'),'foreignKey':'userProfileId'});db['User'][_0x80ca('0x134')](db['ChatGroup'],{'as':'Groups','through':_0x80ca('0x135')});db[_0x80ca('0x13')][_0x80ca('0x134')](db[_0x80ca('0x136')],{'as':'Contacts','through':_0x80ca('0x137')});db[_0x80ca('0x13')]['belongsToMany'](db[_0x80ca('0xff')],{'as':_0x80ca('0x138'),'through':_0x80ca('0x139')});db[_0x80ca('0x13')]['belongsToMany'](db['Team'],{'through':_0x80ca('0x13a')});db['User'][_0x80ca('0x134')](db[_0x80ca('0x12c')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db['User'][_0x80ca('0x134')](db[_0x80ca('0x68')],{'as':_0x80ca('0x13b'),'through':'user_has_chat_interactions'});db[_0x80ca('0x13')][_0x80ca('0x134')](db[_0x80ca('0x4a')],{'as':'FaxInteractions','through':_0x80ca('0x13c')});db['User'][_0x80ca('0x134')](db[_0x80ca('0x55')],{'as':_0x80ca('0x13d'),'through':'user_has_sms_interactions'});db[_0x80ca('0x13')][_0x80ca('0x134')](db[_0x80ca('0x5e')],{'as':'OpenchannelInteractions','through':_0x80ca('0x13e')});db[_0x80ca('0x13')][_0x80ca('0x134')](db[_0x80ca('0x10d')],{'as':_0x80ca('0x12e'),'through':_0x80ca('0x13f')});db[_0x80ca('0x13')]['belongsToMany'](db['VoiceQueue'],{'as':_0x80ca('0x140'),'through':_0x80ca('0x2e'),'required':![]});db[_0x80ca('0x13')]['belongsToMany'](db[_0x80ca('0x101')],{'as':_0x80ca('0x141'),'through':_0x80ca('0x11c'),'required':![]});db[_0x80ca('0x13')][_0x80ca('0x134')](db['MailQueue'],{'as':_0x80ca('0x142'),'through':_0x80ca('0x30'),'required':![]});db['User'][_0x80ca('0x134')](db[_0x80ca('0x6e')],{'as':_0x80ca('0x143'),'through':_0x80ca('0x144'),'required':![],'hooks':!![]});db[_0x80ca('0x13')][_0x80ca('0x134')](db['FaxQueue'],{'as':_0x80ca('0x145'),'through':_0x80ca('0x32'),'required':![]});db['User'][_0x80ca('0x134')](db[_0x80ca('0x146')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0x80ca('0x13')][_0x80ca('0x134')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x80ca('0x34'),'required':![]});db['User'][_0x80ca('0x134')](db['WhatsappQueue'],{'as':_0x80ca('0x147'),'through':'UserWhatsappQueue','required':![]});db[_0x80ca('0x13')][_0x80ca('0x134')](db[_0x80ca('0xff')],{'through':_0x80ca('0x139')});db[_0x80ca('0x13')][_0x80ca('0x134')](db[_0x80ca('0x64')],{'as':_0x80ca('0x148'),'through':'user_has_chat_websites'});db[_0x80ca('0x13')]['belongsToMany'](db[_0x80ca('0x47')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0x80ca('0x13')]['belongsToMany'](db['MailAccount'],{'as':_0x80ca('0x149'),'through':_0x80ca('0x14a')});db[_0x80ca('0x13')]['belongsToMany'](db[_0x80ca('0x5a')],{'as':_0x80ca('0x14b'),'through':_0x80ca('0x14c')});db['User'][_0x80ca('0x134')](db[_0x80ca('0x51')],{'as':_0x80ca('0x14d'),'through':'user_has_sms_accounts'});db['User'][_0x80ca('0x134')](db[_0x80ca('0x109')],{'as':_0x80ca('0x14e'),'through':_0x80ca('0x14f')});db[_0x80ca('0x150')][_0x80ca('0x126')](db[_0x80ca('0x19')],{'as':_0x80ca('0x151'),'onDelete':'cascade','foreignKey':_0x80ca('0x152')});db[_0x80ca('0x17')][_0x80ca('0x126')](db['VoiceExtension'],{'onDelete':_0x80ca('0x123')});db[_0x80ca('0x19')][_0x80ca('0x126')](db[_0x80ca('0x19')],{'as':_0x80ca('0x153'),'onDelete':'cascade'});db[_0x80ca('0x1b')][_0x80ca('0x134')](db[_0x80ca('0x90')],{'as':_0x80ca('0x154'),'through':'moh_has_sounds'});db[_0x80ca('0x155')][_0x80ca('0x126')](db[_0x80ca('0x2d')],{'as':_0x80ca('0x156'),'foreignKey':_0x80ca('0x157')});db[_0x80ca('0x155')][_0x80ca('0x126')](db[_0x80ca('0x77')],{'as':_0x80ca('0x132'),'foreignKey':_0x80ca('0x157')});db[_0x80ca('0x155')][_0x80ca('0x126')](db[_0x80ca('0x7b')],{'as':_0x80ca('0x128'),'foreignKey':_0x80ca('0x157')});db['VoiceQueue'][_0x80ca('0x126')](db[_0x80ca('0x7c')],{'as':_0x80ca('0x158'),'foreignKey':'VoiceQueueId'});db[_0x80ca('0x155')][_0x80ca('0x126')](db[_0x80ca('0x7e')],{'as':'ReportAgentPreview','foreignKey':_0x80ca('0x157')});db[_0x80ca('0x155')][_0x80ca('0x126')](db[_0x80ca('0x79')],{'as':_0x80ca('0x159'),'foreignKey':_0x80ca('0x157')});db[_0x80ca('0x155')][_0x80ca('0x126')](db[_0x80ca('0xe2')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0x80ca('0x155')][_0x80ca('0x133')](db[_0x80ca('0x15a')],{'as':_0x80ca('0x15a'),'foreignKey':_0x80ca('0x15b')});db['VoiceQueue'][_0x80ca('0x133')](db[_0x80ca('0x15a')],{'as':'TrunkBackup','foreignKey':_0x80ca('0x15c')});db[_0x80ca('0x155')][_0x80ca('0x133')](db[_0x80ca('0x89')],{'as':_0x80ca('0x89'),'foreignKey':_0x80ca('0x15d')});db['VoiceQueue'][_0x80ca('0x133')](db[_0x80ca('0x15e')],{'as':_0x80ca('0x15f'),'foreignKey':_0x80ca('0x160')});db[_0x80ca('0x155')]['belongsToMany'](db[_0x80ca('0xff')],{'as':_0x80ca('0x138'),'through':_0x80ca('0x161')});db[_0x80ca('0x155')][_0x80ca('0x134')](db[_0x80ca('0x13')],{'as':_0x80ca('0x162'),'through':'UserVoiceQueue'});db[_0x80ca('0x155')][_0x80ca('0x134')](db[_0x80ca('0x163')],{'as':'Teams','through':_0x80ca('0x119')});db['VoiceQueue']['belongsToMany'](db[_0x80ca('0xff')],{'as':_0x80ca('0x164'),'through':_0x80ca('0x165')});db[_0x80ca('0x1d')][_0x80ca('0x133')](db[_0x80ca('0x13')],{'as':_0x80ca('0x13'),'foreignKey':_0x80ca('0x124')});db[_0x80ca('0x1e')][_0x80ca('0x133')](db[_0x80ca('0x13')],{'as':'User','foreignKey':'UserId'});db['VoiceMail']['hasMany'](db[_0x80ca('0x21')],{'as':_0x80ca('0x166'),'onDelete':_0x80ca('0x123'),'foreignKey':'mailboxuser','sourceKey':_0x80ca('0x167')});db[_0x80ca('0x21')][_0x80ca('0x133')](db[_0x80ca('0x20')],{'foreignKey':_0x80ca('0x168'),'targetKey':_0x80ca('0x167')});db[_0x80ca('0x23')][_0x80ca('0x126')](db[_0x80ca('0x27')],{'as':_0x80ca('0x169'),'foreignKey':_0x80ca('0x16a'),'constraints':![]});db[_0x80ca('0x23')]['hasMany'](db[_0x80ca('0x16b')],{'as':_0x80ca('0x16c'),'foreignKey':_0x80ca('0x16a'),'constraints':![]});db[_0x80ca('0x23')][_0x80ca('0x133')](db[_0x80ca('0x13')],{'as':_0x80ca('0x13'),'foreignKey':_0x80ca('0x124')});db[_0x80ca('0x23')][_0x80ca('0x133')](db['CmContact'],{'as':_0x80ca('0x16d'),'foreignKey':_0x80ca('0x16e')});db['MailServerIn']['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':_0x80ca('0x16f')});db[_0x80ca('0x37')][_0x80ca('0x133')](db[_0x80ca('0x117')],{'as':'CloudProvider','foreignKey':_0x80ca('0x170'),'onDelete':_0x80ca('0x171')});db[_0x80ca('0x38')]['belongsTo'](db[_0x80ca('0x39')],{'as':_0x80ca('0x39'),'foreignKey':_0x80ca('0x16f')});db[_0x80ca('0x38')][_0x80ca('0x133')](db[_0x80ca('0x117')],{'as':_0x80ca('0x117'),'foreignKey':_0x80ca('0x170'),'onDelete':'restrict'});db[_0x80ca('0x39')][_0x80ca('0x122')](db['MailServerIn'],{'as':_0x80ca('0x172'),'onDelete':'cascade'});db[_0x80ca('0x39')][_0x80ca('0x122')](db[_0x80ca('0x38')],{'as':_0x80ca('0x173'),'onDelete':'cascade'});db['MailAccount']['hasMany'](db[_0x80ca('0x86')],{'as':_0x80ca('0x174'),'foreignKey':'MailAccountId','onDelete':_0x80ca('0x123')});db[_0x80ca('0x39')]['hasMany'](db[_0x80ca('0x85')],{'as':_0x80ca('0x175'),'foreignKey':_0x80ca('0x16f')});db[_0x80ca('0x39')][_0x80ca('0x126')](db['MailMessage'],{'as':_0x80ca('0x166'),'foreignKey':_0x80ca('0x16f')});db[_0x80ca('0x39')][_0x80ca('0x126')](db[_0x80ca('0x12c')],{'as':_0x80ca('0x176')});db[_0x80ca('0x39')][_0x80ca('0x126')](db[_0x80ca('0x41')],{'as':_0x80ca('0x153'),'foreignKey':_0x80ca('0x16f'),'onDelete':_0x80ca('0x123')});db[_0x80ca('0x39')][_0x80ca('0x133')](db[_0x80ca('0xff')],{'as':'List','foreignKey':'ListId'});db[_0x80ca('0x39')][_0x80ca('0x133')](db[_0x80ca('0x177')],{'as':'Template','foreignKey':_0x80ca('0x178')});db['MailAccount'][_0x80ca('0x133')](db[_0x80ca('0x15e')],{'as':_0x80ca('0x15f'),'foreignKey':_0x80ca('0x160')});db[_0x80ca('0x39')]['belongsToMany'](db[_0x80ca('0x13')],{'as':'Agents','through':_0x80ca('0x14a')});db['MailQueue'][_0x80ca('0x134')](db['User'],{'as':'Agents','through':_0x80ca('0x30')});db[_0x80ca('0x3b')][_0x80ca('0x134')](db[_0x80ca('0x163')],{'through':_0x80ca('0x179'),'as':'Teams'});db[_0x80ca('0x12c')][_0x80ca('0x126')](db[_0x80ca('0x3f')],{'as':_0x80ca('0x166'),'onDelete':'cascade','foreignKey':_0x80ca('0x17a')});db[_0x80ca('0x12c')]['belongsTo'](db[_0x80ca('0x39')],{'as':_0x80ca('0x17b'),'foreignKey':'MailAccountId'});db[_0x80ca('0x12c')][_0x80ca('0x133')](db[_0x80ca('0x136')],{'as':_0x80ca('0x16d'),'foreignKey':_0x80ca('0x16e')});db[_0x80ca('0x12c')]['belongsTo'](db[_0x80ca('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0x80ca('0x12c')][_0x80ca('0x134')](db['Tag'],{'through':_0x80ca('0x17c'),'as':'Tags'});db['MailInteraction']['belongsToMany'](db[_0x80ca('0x92')],{'through':_0x80ca('0x17c'),'as':'ThroughTags'});db[_0x80ca('0x12c')][_0x80ca('0x134')](db[_0x80ca('0x13')],{'as':_0x80ca('0x17d'),'through':_0x80ca('0x17e'),'foreignKey':_0x80ca('0x17a')});db[_0x80ca('0x3f')][_0x80ca('0x126')](db[_0x80ca('0xf5')],{'as':_0x80ca('0x17f'),'onDelete':_0x80ca('0x123')});db[_0x80ca('0x3f')][_0x80ca('0x133')](db[_0x80ca('0x13')],{'as':_0x80ca('0x13')});db['MailMessage'][_0x80ca('0x133')](db[_0x80ca('0x136')],{'onDelete':_0x80ca('0x123'),'as':_0x80ca('0x16d')});db['MailMessage'][_0x80ca('0x133')](db[_0x80ca('0x12c')],{'as':_0x80ca('0x180'),'foreignKey':_0x80ca('0x17a')});db[_0x80ca('0x3f')][_0x80ca('0x133')](db['MailAccount'],{'as':_0x80ca('0x17b'),'foreignKey':_0x80ca('0x16f')});db[_0x80ca('0x3f')][_0x80ca('0x133')](db[_0x80ca('0x64')],{'as':_0x80ca('0x64'),'foreignKey':'ChatWebsiteId'});db[_0x80ca('0x3f')][_0x80ca('0x133')](db[_0x80ca('0x6c')],{'as':_0x80ca('0x6c'),'foreignKey':'ChatOfflineMessageId'});db[_0x80ca('0x41')][_0x80ca('0x133')](db[_0x80ca('0x13')],{'onDelete':_0x80ca('0x171')});db[_0x80ca('0x41')]['belongsTo'](db[_0x80ca('0x3b')],{'onDelete':'restrict'});db[_0x80ca('0x41')][_0x80ca('0x133')](db['MailAccount'],{'onDelete':_0x80ca('0x171')});db[_0x80ca('0x41')][_0x80ca('0x133')](db[_0x80ca('0x89')],{'onDelete':'restrict','foreignKey':_0x80ca('0x15d')});db[_0x80ca('0x41')][_0x80ca('0x133')](db[_0x80ca('0x92')],{'onDelete':_0x80ca('0x171'),'foreignKey':_0x80ca('0x181')});db[_0x80ca('0x43')][_0x80ca('0x133')](db['MailAccount'],{});db[_0x80ca('0x43')][_0x80ca('0x133')](db['CmList'],{'as':'List','foreignKey':_0x80ca('0x182')});db['MailQueueReport'][_0x80ca('0x133')](db[_0x80ca('0x136')],{'as':_0x80ca('0x16d'),'foreignKey':_0x80ca('0x16e')});db[_0x80ca('0x43')]['belongsTo'](db['MailInteraction'],{});db['MailQueueReport'][_0x80ca('0x133')](db[_0x80ca('0x3f')],{});db[_0x80ca('0x43')][_0x80ca('0x133')](db[_0x80ca('0x13')],{});db['MailQueueReport'][_0x80ca('0x133')](db[_0x80ca('0x3b')],{});db[_0x80ca('0x45')]['hasMany'](db['DashboardItem'],{'as':_0x80ca('0x183'),'onDelete':_0x80ca('0x123')});db[_0x80ca('0x47')]['hasMany'](db['Disposition'],{'as':_0x80ca('0x174'),'foreignKey':_0x80ca('0x184'),'onDelete':'cascade'});db[_0x80ca('0x47')][_0x80ca('0x126')](db[_0x80ca('0x85')],{'as':_0x80ca('0x175'),'foreignKey':_0x80ca('0x184')});db['FaxAccount']['hasMany'](db[_0x80ca('0x4a')],{'as':_0x80ca('0x176')});db[_0x80ca('0x47')]['hasMany'](db[_0x80ca('0x48')],{'as':_0x80ca('0x153'),'foreignKey':'FaxAccountId','onDelete':_0x80ca('0x123')});db['FaxAccount'][_0x80ca('0x126')](db['VoiceExtension'],{'as':_0x80ca('0x185'),'onDelete':'cascade'});db[_0x80ca('0x47')]['hasMany'](db[_0x80ca('0x186')],{'as':_0x80ca('0x166')});db[_0x80ca('0x47')][_0x80ca('0x133')](db[_0x80ca('0x15a')],{'as':_0x80ca('0x15a')});db[_0x80ca('0x47')]['belongsTo'](db[_0x80ca('0xff')],{'as':_0x80ca('0x187'),'foreignKey':_0x80ca('0x182')});db[_0x80ca('0x47')][_0x80ca('0x133')](db['Pause'],{'as':_0x80ca('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x80ca('0x47')]['belongsToMany'](db[_0x80ca('0x13')],{'as':_0x80ca('0x162'),'through':_0x80ca('0x188')});db[_0x80ca('0x48')]['belongsTo'](db[_0x80ca('0x13')],{'onDelete':_0x80ca('0x171')});db[_0x80ca('0x48')]['belongsTo'](db[_0x80ca('0x4d')],{'onDelete':'restrict'});db[_0x80ca('0x48')]['belongsTo'](db[_0x80ca('0x47')],{'onDelete':'restrict'});db['FaxApplication'][_0x80ca('0x133')](db[_0x80ca('0x92')],{'onDelete':_0x80ca('0x171'),'foreignKey':_0x80ca('0x181')});db[_0x80ca('0x4a')][_0x80ca('0x126')](db[_0x80ca('0x186')],{'as':'Messages','onDelete':_0x80ca('0x123'),'foreignKey':'FaxInteractionId'});db[_0x80ca('0x4a')][_0x80ca('0x133')](db[_0x80ca('0x47')],{'as':_0x80ca('0x17b'),'foreignKey':_0x80ca('0x184')});db[_0x80ca('0x4a')][_0x80ca('0x133')](db[_0x80ca('0x136')],{'as':'Contact','foreignKey':'ContactId'});db['FaxInteraction']['belongsTo'](db[_0x80ca('0x13')],{'as':'Owner','foreignKey':_0x80ca('0x124')});db[_0x80ca('0x4a')][_0x80ca('0x134')](db[_0x80ca('0x92')],{'through':'fax_interaction_has_tags','as':_0x80ca('0x189')});db['FaxInteraction'][_0x80ca('0x134')](db[_0x80ca('0x92')],{'through':_0x80ca('0x18a'),'as':'ThroughTags'});db['FaxInteraction'][_0x80ca('0x134')](db[_0x80ca('0x13')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0x80ca('0x186')][_0x80ca('0x133')](db[_0x80ca('0x13')],{'onDelete':_0x80ca('0x123'),'as':_0x80ca('0x13')});db[_0x80ca('0x186')]['belongsTo'](db[_0x80ca('0x4a')],{'as':'Interaction','foreignKey':_0x80ca('0x18b')});db[_0x80ca('0x186')]['belongsTo'](db[_0x80ca('0x136')],{'onDelete':_0x80ca('0x123'),'as':_0x80ca('0x16d')});db[_0x80ca('0x186')]['belongsTo'](db[_0x80ca('0xf5')],{'as':_0x80ca('0xf5'),'foreignKey':_0x80ca('0x18c')});db[_0x80ca('0x186')][_0x80ca('0x133')](db[_0x80ca('0x47')],{'as':_0x80ca('0x17b'),'foreignKey':_0x80ca('0x184')});db['FaxQueue']['belongsToMany'](db['User'],{'as':'Agents','through':_0x80ca('0x32')});db[_0x80ca('0x4d')][_0x80ca('0x134')](db[_0x80ca('0x163')],{'through':'team_has_fax_queues','as':_0x80ca('0x18d')});db[_0x80ca('0x4f')][_0x80ca('0x133')](db[_0x80ca('0x47')],{});db[_0x80ca('0x4f')][_0x80ca('0x133')](db[_0x80ca('0xff')],{'as':_0x80ca('0x187'),'foreignKey':_0x80ca('0x182')});db['FaxQueueReport'][_0x80ca('0x133')](db[_0x80ca('0x136')],{'as':'Contact','foreignKey':_0x80ca('0x16e')});db[_0x80ca('0x4f')][_0x80ca('0x133')](db[_0x80ca('0x4a')],{});db[_0x80ca('0x4f')][_0x80ca('0x133')](db[_0x80ca('0x186')],{});db['FaxQueueReport'][_0x80ca('0x133')](db['User'],{});db[_0x80ca('0x4f')][_0x80ca('0x133')](db['FaxQueue'],{});db[_0x80ca('0x51')][_0x80ca('0x126')](db[_0x80ca('0x86')],{'as':'Dispositions','foreignKey':_0x80ca('0x18e'),'onDelete':_0x80ca('0x123')});db[_0x80ca('0x51')][_0x80ca('0x126')](db[_0x80ca('0x85')],{'as':_0x80ca('0x175'),'foreignKey':_0x80ca('0x18e')});db['SmsAccount'][_0x80ca('0x126')](db['SmsMessage'],{'as':_0x80ca('0x166'),'foreignKey':_0x80ca('0x18e')});db['SmsAccount'][_0x80ca('0x126')](db[_0x80ca('0x55')],{'as':_0x80ca('0x176')});db[_0x80ca('0x51')][_0x80ca('0x126')](db[_0x80ca('0x53')],{'as':_0x80ca('0x153'),'foreignKey':'SmsAccountId','onDelete':_0x80ca('0x123')});db[_0x80ca('0x51')]['belongsTo'](db[_0x80ca('0xff')],{'as':_0x80ca('0x187'),'foreignKey':'ListId'});db[_0x80ca('0x51')]['belongsTo'](db[_0x80ca('0x15e')],{'as':_0x80ca('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db['SmsAccount'][_0x80ca('0x134')](db[_0x80ca('0x13')],{'as':'Agents','through':'user_has_sms_accounts'});db[_0x80ca('0x53')][_0x80ca('0x133')](db[_0x80ca('0x13')],{'onDelete':_0x80ca('0x171')});db[_0x80ca('0x53')][_0x80ca('0x133')](db['SmsQueue'],{'onDelete':_0x80ca('0x171')});db[_0x80ca('0x53')][_0x80ca('0x133')](db[_0x80ca('0x51')],{'onDelete':_0x80ca('0x171')});db[_0x80ca('0x53')][_0x80ca('0x133')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x80ca('0x15d')});db['SmsApplication'][_0x80ca('0x133')](db[_0x80ca('0x92')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x80ca('0x55')][_0x80ca('0x126')](db['SmsMessage'],{'as':'Messages','onDelete':_0x80ca('0x123'),'foreignKey':'SmsInteractionId'});db[_0x80ca('0x55')][_0x80ca('0x133')](db['SmsAccount'],{'as':'Account','foreignKey':_0x80ca('0x18e')});db['SmsInteraction']['belongsTo'](db[_0x80ca('0x136')],{'as':_0x80ca('0x16d'),'foreignKey':'ContactId'});db[_0x80ca('0x55')]['belongsTo'](db[_0x80ca('0x13')],{'as':_0x80ca('0x18f'),'foreignKey':_0x80ca('0x124')});db[_0x80ca('0x55')]['belongsToMany'](db[_0x80ca('0x92')],{'through':'sms_interaction_has_tags','as':_0x80ca('0x189')});db[_0x80ca('0x55')][_0x80ca('0x134')](db[_0x80ca('0x92')],{'through':_0x80ca('0x190'),'as':'ThroughTags'});db[_0x80ca('0x55')][_0x80ca('0x134')](db[_0x80ca('0x13')],{'as':_0x80ca('0x17d'),'through':_0x80ca('0x191'),'foreignKey':_0x80ca('0x192')});db[_0x80ca('0x57')][_0x80ca('0x133')](db['User'],{'as':_0x80ca('0x13')});db[_0x80ca('0x57')]['belongsTo'](db['CmContact'],{'onDelete':_0x80ca('0x123'),'as':_0x80ca('0x16d')});db[_0x80ca('0x57')][_0x80ca('0x133')](db[_0x80ca('0x55')],{'onDelete':_0x80ca('0x123'),'as':'Interaction','foreignKey':_0x80ca('0x192')});db[_0x80ca('0x57')][_0x80ca('0x133')](db[_0x80ca('0x51')],{'as':_0x80ca('0x17b'),'foreignKey':_0x80ca('0x18e')});db['SmsQueue'][_0x80ca('0x134')](db['User'],{'as':_0x80ca('0x162'),'through':_0x80ca('0x33'),'foreignKey':_0x80ca('0x193')});db[_0x80ca('0x146')][_0x80ca('0x134')](db[_0x80ca('0x163')],{'through':_0x80ca('0x194'),'as':_0x80ca('0x18d')});db[_0x80ca('0x5a')][_0x80ca('0x126')](db[_0x80ca('0x86')],{'as':_0x80ca('0x174'),'foreignKey':_0x80ca('0x195'),'onDelete':'cascade'});db['OpenchannelAccount'][_0x80ca('0x126')](db[_0x80ca('0x85')],{'as':'Answers','foreignKey':_0x80ca('0x195')});db[_0x80ca('0x5a')]['hasMany'](db[_0x80ca('0x5e')],{'as':_0x80ca('0x176'),'foreignKey':'OpenchannelAccountId'});db[_0x80ca('0x5a')][_0x80ca('0x126')](db[_0x80ca('0x60')],{'as':_0x80ca('0x166'),'foreignKey':_0x80ca('0x195')});db['OpenchannelAccount'][_0x80ca('0x126')](db[_0x80ca('0x5c')],{'as':_0x80ca('0x153'),'foreignKey':_0x80ca('0x195'),'onDelete':_0x80ca('0x123')});db['OpenchannelAccount'][_0x80ca('0x133')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x80ca('0x5a')][_0x80ca('0x133')](db[_0x80ca('0x15e')],{'as':'mandatoryDispositionPause','foreignKey':_0x80ca('0x160')});db[_0x80ca('0x5a')][_0x80ca('0x134')](db['User'],{'as':_0x80ca('0x162'),'through':_0x80ca('0x14c')});db[_0x80ca('0x5c')][_0x80ca('0x133')](db['User'],{'onDelete':_0x80ca('0x171')});db[_0x80ca('0x5c')][_0x80ca('0x133')](db['OpenchannelQueue'],{'onDelete':_0x80ca('0x171'),'foreignKey':_0x80ca('0x196')});db['OpenchannelApplication'][_0x80ca('0x133')](db[_0x80ca('0x5a')],{'onDelete':_0x80ca('0x171'),'foreignKey':_0x80ca('0x195')});db['OpenchannelApplication']['belongsTo'](db['Interval'],{'onDelete':_0x80ca('0x171'),'foreignKey':'IntervalId'});db[_0x80ca('0x5c')]['belongsTo'](db[_0x80ca('0x92')],{'onDelete':_0x80ca('0x171'),'foreignKey':'TagId'});db[_0x80ca('0x5e')]['hasMany'](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x197')});db[_0x80ca('0x5e')][_0x80ca('0x133')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x80ca('0x195')});db['OpenchannelInteraction'][_0x80ca('0x133')](db['CmContact'],{'as':'Contact','foreignKey':_0x80ca('0x16e')});db[_0x80ca('0x5e')][_0x80ca('0x133')](db[_0x80ca('0x13')],{'as':_0x80ca('0x18f'),'foreignKey':_0x80ca('0x124')});db[_0x80ca('0x5e')][_0x80ca('0x134')](db[_0x80ca('0x92')],{'through':_0x80ca('0x198'),'as':'Tags'});db[_0x80ca('0x5e')][_0x80ca('0x134')](db[_0x80ca('0x92')],{'through':_0x80ca('0x198'),'as':_0x80ca('0x199')});db[_0x80ca('0x5e')]['belongsToMany'](db[_0x80ca('0x13')],{'as':_0x80ca('0x17d'),'through':_0x80ca('0x13e'),'foreignKey':_0x80ca('0x197')});db['OpenchannelMessage'][_0x80ca('0x133')](db[_0x80ca('0x13')],{'onDelete':'cascade','as':'User'});db['OpenchannelMessage'][_0x80ca('0x133')](db[_0x80ca('0x136')],{'onDelete':_0x80ca('0x123'),'as':'Contact'});db['OpenchannelMessage'][_0x80ca('0x133')](db[_0x80ca('0x5e')],{'onDelete':_0x80ca('0x123'),'as':_0x80ca('0x180'),'foreignKey':_0x80ca('0x197')});db[_0x80ca('0x60')]['belongsTo'](db['Attachment'],{'as':_0x80ca('0xf5'),'foreignKey':'AttachmentId'});db[_0x80ca('0x60')][_0x80ca('0x133')](db[_0x80ca('0x5a')],{'as':_0x80ca('0x17b'),'foreignKey':_0x80ca('0x195')});db[_0x80ca('0x62')][_0x80ca('0x134')](db[_0x80ca('0x13')],{'as':'Agents','through':_0x80ca('0x34'),'foreignKey':_0x80ca('0x196')});db[_0x80ca('0x62')]['belongsToMany'](db[_0x80ca('0x163')],{'through':'team_has_openchannel_queues','as':_0x80ca('0x18d')});db[_0x80ca('0x64')][_0x80ca('0x126')](db[_0x80ca('0x86')],{'as':_0x80ca('0x174'),'foreignKey':'ChatWebsiteId','onDelete':_0x80ca('0x123')});db['ChatWebsite'][_0x80ca('0x126')](db[_0x80ca('0x85')],{'as':_0x80ca('0x175'),'foreignKey':_0x80ca('0x19a')});db[_0x80ca('0x64')][_0x80ca('0x126')](db[_0x80ca('0x72')],{'as':'ProactiveActions'});db['ChatWebsite'][_0x80ca('0x126')](db[_0x80ca('0x68')],{'as':_0x80ca('0x176')});db['ChatWebsite']['hasMany'](db['ChatApplication'],{'as':_0x80ca('0x153'),'foreignKey':_0x80ca('0x19a'),'onDelete':_0x80ca('0x123')});db[_0x80ca('0x64')]['hasMany'](db[_0x80ca('0x6a')],{'as':'Messages'});db[_0x80ca('0x64')][_0x80ca('0x133')](db['CmList'],{'as':_0x80ca('0x187'),'foreignKey':_0x80ca('0x182')});db[_0x80ca('0x64')][_0x80ca('0x133')](db[_0x80ca('0x89')],{'as':_0x80ca('0x89'),'foreignKey':'IntervalId'});db[_0x80ca('0x64')]['belongsTo'](db['MailAccount'],{'as':_0x80ca('0x39'),'foreignKey':_0x80ca('0x16f')});db[_0x80ca('0x64')][_0x80ca('0x133')](db[_0x80ca('0x15e')],{'as':'mandatoryDispositionPause','foreignKey':_0x80ca('0x160')});db[_0x80ca('0x64')][_0x80ca('0x134')](db[_0x80ca('0x13')],{'as':_0x80ca('0x162'),'through':_0x80ca('0x19b')});db['OpenchannelQueueReport'][_0x80ca('0x133')](db['OpenchannelAccount'],{});db[_0x80ca('0x66')][_0x80ca('0x133')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x80ca('0x66')][_0x80ca('0x133')](db[_0x80ca('0x136')],{'as':_0x80ca('0x16d'),'foreignKey':_0x80ca('0x16e')});db[_0x80ca('0x66')]['belongsTo'](db[_0x80ca('0x5e')],{});db[_0x80ca('0x66')][_0x80ca('0x133')](db['OpenchannelMessage'],{});db[_0x80ca('0x66')][_0x80ca('0x133')](db[_0x80ca('0x13')],{});db[_0x80ca('0x66')][_0x80ca('0x133')](db[_0x80ca('0x62')],{});db[_0x80ca('0x19c')][_0x80ca('0x133')](db[_0x80ca('0x13')],{'as':'Agent','foreignKey':_0x80ca('0x124'),'onDelete':_0x80ca('0x171')});db[_0x80ca('0x19c')][_0x80ca('0x133')](db[_0x80ca('0x6e')],{'as':_0x80ca('0x19d'),'foreignKey':_0x80ca('0x19e'),'onDelete':_0x80ca('0x171')});db['ChatApplication'][_0x80ca('0x133')](db['ChatWebsite'],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0x80ca('0x19c')][_0x80ca('0x133')](db[_0x80ca('0x92')],{'onDelete':_0x80ca('0x171'),'foreignKey':'TagId'});db[_0x80ca('0x68')][_0x80ca('0x126')](db[_0x80ca('0x6a')],{'as':'Messages','onDelete':_0x80ca('0x123'),'foreignKey':'ChatInteractionId'});db[_0x80ca('0x68')][_0x80ca('0x133')](db[_0x80ca('0x64')],{'as':'Account','foreignKey':_0x80ca('0x19a')});db[_0x80ca('0x68')][_0x80ca('0x133')](db[_0x80ca('0x136')],{'as':'Contact','foreignKey':_0x80ca('0x16e')});db[_0x80ca('0x68')]['belongsTo'](db[_0x80ca('0x13')],{'as':'Owner','foreignKey':_0x80ca('0x124')});db[_0x80ca('0x68')][_0x80ca('0x134')](db[_0x80ca('0x92')],{'through':_0x80ca('0x19f'),'as':'Tags'});db['ChatInteraction'][_0x80ca('0x134')](db[_0x80ca('0x92')],{'through':_0x80ca('0x19f'),'as':'ThroughTags'});db[_0x80ca('0x68')][_0x80ca('0x134')](db['User'],{'as':_0x80ca('0x17d'),'through':_0x80ca('0x1a0'),'foreignKey':_0x80ca('0x1a1')});db[_0x80ca('0x6a')][_0x80ca('0x133')](db['User'],{'onDelete':_0x80ca('0x123'),'as':'User'});db[_0x80ca('0x6a')][_0x80ca('0x133')](db[_0x80ca('0x136')],{'onDelete':'cascade','as':_0x80ca('0x16d'),'foreignKey':_0x80ca('0x16e')});db[_0x80ca('0x6a')][_0x80ca('0x133')](db[_0x80ca('0x68')],{'onDelete':_0x80ca('0x123'),'as':'Interaction','foreignKey':_0x80ca('0x1a1')});db[_0x80ca('0x6a')]['belongsTo'](db[_0x80ca('0xf5')],{'as':_0x80ca('0xf5'),'foreignKey':_0x80ca('0x18c')});db[_0x80ca('0x6a')][_0x80ca('0x133')](db[_0x80ca('0x64')],{'as':'Account','foreignKey':_0x80ca('0x19a')});db[_0x80ca('0x6c')][_0x80ca('0x126')](db[_0x80ca('0xf5')],{'as':_0x80ca('0x17f'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x80ca('0x123'),'hooks':!![]});db['ChatOfflineMessage'][_0x80ca('0x133')](db[_0x80ca('0x136')],{'onDelete':_0x80ca('0x123'),'as':_0x80ca('0x16d'),'foreignKey':_0x80ca('0x16e')});db[_0x80ca('0x6c')][_0x80ca('0x133')](db[_0x80ca('0x64')],{'as':'Account','foreignKey':_0x80ca('0x19a')});db[_0x80ca('0x6e')][_0x80ca('0x134')](db[_0x80ca('0x13')],{'as':_0x80ca('0x162'),'through':_0x80ca('0x144'),'hooks':!![]});db[_0x80ca('0x6e')]['belongsToMany'](db[_0x80ca('0x163')],{'through':_0x80ca('0x1a2'),'as':'Teams'});db['ChatGroup'][_0x80ca('0x126')](db[_0x80ca('0xdd')],{'as':_0x80ca('0x166'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0x80ca('0x70')][_0x80ca('0x134')](db[_0x80ca('0x13')],{'as':_0x80ca('0x156'),'through':_0x80ca('0x135')});db[_0x80ca('0x72')][_0x80ca('0x133')](db['ChatWebsite'],{'as':_0x80ca('0x1a3'),'foreignKey':_0x80ca('0x19a')});db[_0x80ca('0x74')][_0x80ca('0x126')](db[_0x80ca('0x136')],{'as':_0x80ca('0x1a4'),'foreignKey':'CompanyId'});db[_0x80ca('0x136')][_0x80ca('0x126')](db[_0x80ca('0x1a5')],{'as':'Phones','foreignKey':_0x80ca('0x1a6')});db[_0x80ca('0x136')][_0x80ca('0x126')](db[_0x80ca('0x77')],{'as':_0x80ca('0x132'),'foreignKey':'ContactId'});db['CmContact'][_0x80ca('0x126')](db[_0x80ca('0x7b')],{'as':_0x80ca('0x128'),'foreignKey':'ContactId'});db[_0x80ca('0x136')][_0x80ca('0x126')](db[_0x80ca('0x7c')],{'as':'HopperHistories','foreignKey':_0x80ca('0x16e')});db[_0x80ca('0x136')][_0x80ca('0x126')](db['ReportAgentPreview'],{'as':_0x80ca('0x7e'),'foreignKey':'ContactId'});db[_0x80ca('0x136')]['hasMany'](db['JscriptySessionReport'],{'as':_0x80ca('0x1a7'),'foreignKey':'ContactId'});db['CmContact'][_0x80ca('0x126')](db[_0x80ca('0x5e')],{'as':_0x80ca('0x12a'),'foreignKey':_0x80ca('0x16e'),'onDelete':'restrict'});db['CmContact'][_0x80ca('0x126')](db[_0x80ca('0x68')],{'as':_0x80ca('0x13b'),'foreignKey':_0x80ca('0x16e'),'onDelete':_0x80ca('0x171')});db[_0x80ca('0x136')][_0x80ca('0x126')](db[_0x80ca('0x55')],{'as':_0x80ca('0x13d'),'foreignKey':_0x80ca('0x16e'),'onDelete':'restrict'});db[_0x80ca('0x136')][_0x80ca('0x126')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x80ca('0x16e'),'onDelete':'restrict'});db[_0x80ca('0x136')][_0x80ca('0x126')](db['MailInteraction'],{'as':_0x80ca('0x12d'),'foreignKey':_0x80ca('0x16e'),'onDelete':_0x80ca('0x171')});db[_0x80ca('0x136')][_0x80ca('0x133')](db['CmCompany'],{'as':'Company','foreignKey':_0x80ca('0x1a8')});db['CmContact'][_0x80ca('0x133')](db[_0x80ca('0xff')],{'as':_0x80ca('0x187'),'foreignKey':_0x80ca('0x182'),'onDelete':_0x80ca('0x123')});db[_0x80ca('0x136')][_0x80ca('0x134')](db[_0x80ca('0x13')],{'as':'Users','through':_0x80ca('0x137')});db[_0x80ca('0x136')][_0x80ca('0x134')](db['Tag'],{'as':_0x80ca('0x189'),'through':'cm_contact_has_tags'});db['CmContact'][_0x80ca('0x134')](db[_0x80ca('0x92')],{'through':_0x80ca('0x1a9'),'as':_0x80ca('0x199')});db[_0x80ca('0x77')]['hasMany'](db['CmHopperAdditionalPhone'],{'as':_0x80ca('0x1aa'),'foreignKey':_0x80ca('0x1ab')});db[_0x80ca('0x77')][_0x80ca('0x133')](db[_0x80ca('0x136')],{'as':'Contact','foreignKey':_0x80ca('0x16e'),'onDelete':_0x80ca('0x123')});db[_0x80ca('0x77')][_0x80ca('0x133')](db[_0x80ca('0xff')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x80ca('0x133')](db[_0x80ca('0x13')],{'as':'Agent','foreignKey':_0x80ca('0x124')});db[_0x80ca('0x77')]['belongsTo'](db['VoiceQueue'],{'as':_0x80ca('0x19d'),'foreignKey':'VoiceQueueId','onDelete':_0x80ca('0x123')});db[_0x80ca('0x77')][_0x80ca('0x133')](db[_0x80ca('0xf2')],{'as':_0x80ca('0xf2'),'foreignKey':_0x80ca('0x1ac'),'onDelete':'cascade'});db[_0x80ca('0x77')][_0x80ca('0x133')](db[_0x80ca('0x13')],{'as':'Owner','foreignKey':_0x80ca('0x1ad')});db[_0x80ca('0x79')][_0x80ca('0x133')](db[_0x80ca('0x136')],{'as':_0x80ca('0x16d'),'foreignKey':_0x80ca('0x16e'),'onDelete':_0x80ca('0x123')});db[_0x80ca('0x79')][_0x80ca('0x133')](db['CmList'],{'as':_0x80ca('0x187'),'foreignKey':_0x80ca('0x182'),'onDelete':_0x80ca('0x123')});db[_0x80ca('0x79')][_0x80ca('0x133')](db[_0x80ca('0x155')],{'as':'Queue','foreignKey':_0x80ca('0x157'),'onDelete':_0x80ca('0x123')});db['CmHopperBlack']['belongsTo'](db[_0x80ca('0xf2')],{'as':_0x80ca('0xf2'),'foreignKey':_0x80ca('0x1ac'),'onDelete':_0x80ca('0x123')});db[_0x80ca('0x1ae')][_0x80ca('0x126')](db[_0x80ca('0x88')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0x80ca('0x1af'),'onDelete':_0x80ca('0x123'),'hooks':!![]});db['Automation'][_0x80ca('0x126')](db[_0x80ca('0x88')],{'as':{'plural':_0x80ca('0x1b0'),'singular':_0x80ca('0x1b1')},'foreignKey':_0x80ca('0x1b2'),'onDelete':_0x80ca('0x123'),'hooks':!![]});db['Automation']['hasMany'](db[_0x80ca('0x82')],{'as':_0x80ca('0x1b3'),'foreignKey':_0x80ca('0x1b4'),'onDelete':'cascade','hooks':!![]});db['Disposition']['hasMany'](db[_0x80ca('0x86')],{'as':_0x80ca('0x174'),'foreignKey':'ParentId','onDelete':_0x80ca('0x123')});db[_0x80ca('0x89')][_0x80ca('0x126')](db['Interval'],{'as':'Intervals','foreignKey':_0x80ca('0x15d'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x80ca('0x89')][_0x80ca('0x126')](db[_0x80ca('0x19')],{'as':'Extensions','foreignKey':_0x80ca('0x15d'),'onDelete':'restrict'});db[_0x80ca('0x89')]['hasMany'](db[_0x80ca('0x41')],{'as':'MailApplications','foreignKey':_0x80ca('0x15d')});db[_0x80ca('0x89')][_0x80ca('0x126')](db[_0x80ca('0x19c')],{'as':_0x80ca('0x1b5'),'foreignKey':_0x80ca('0x15d')});db[_0x80ca('0x89')][_0x80ca('0x126')](db[_0x80ca('0x48')],{'as':_0x80ca('0x1b6'),'foreignKey':_0x80ca('0x15d')});db['Interval']['hasMany'](db[_0x80ca('0x53')],{'as':_0x80ca('0x1b7'),'foreignKey':'IntervalId'});db[_0x80ca('0x8e')][_0x80ca('0x133')](db[_0x80ca('0x39')],{});db[_0x80ca('0x8e')][_0x80ca('0x133')](db[_0x80ca('0xa0')],{'foreignKey':_0x80ca('0x1b8')});db['Schedule'][_0x80ca('0x133')](db[_0x80ca('0x1b9')],{'foreignKey':'CustomReportId'});db['Sound'][_0x80ca('0x134')](db[_0x80ca('0x1b')],{'as':_0x80ca('0x1ba'),'through':_0x80ca('0x1bb'),'onDelete':_0x80ca('0x171')});db['Tag']['belongsToMany'](db[_0x80ca('0x136')],{'through':'cm_contact_has_tags'});db[_0x80ca('0x92')]['belongsToMany'](db[_0x80ca('0x68')],{'through':_0x80ca('0x19f')});db[_0x80ca('0x92')][_0x80ca('0x134')](db[_0x80ca('0x12c')],{'through':'mail_interaction_has_tags'});db[_0x80ca('0x92')][_0x80ca('0x134')](db[_0x80ca('0x55')],{'through':_0x80ca('0x190')});db[_0x80ca('0x92')]['belongsToMany'](db[_0x80ca('0x4a')],{'through':'fax_interaction_has_tags'});db[_0x80ca('0x92')][_0x80ca('0x134')](db[_0x80ca('0x5e')],{'through':'openchannel_interaction_has_tags'});db['Tag']['belongsToMany'](db['WhatsappInteraction'],{'through':_0x80ca('0x1bc')});db[_0x80ca('0x1a5')]['belongsTo'](db[_0x80ca('0x94')],{'as':_0x80ca('0x1bd'),'foreignKey':'ItemTypeId'});db[_0x80ca('0x1be')][_0x80ca('0x133')](db[_0x80ca('0x77')],{'as':_0x80ca('0x1bf'),'foreignKey':_0x80ca('0x1ab')});db[_0x80ca('0x1a5')][_0x80ca('0x133')](db[_0x80ca('0x136')],{'as':_0x80ca('0x16d'),'foreignKey':_0x80ca('0x1a6')});db[_0x80ca('0x98')][_0x80ca('0x126')](db[_0x80ca('0x88')],{'as':{'plural':_0x80ca('0x1c0'),'singular':_0x80ca('0x1c1')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db[_0x80ca('0x98')][_0x80ca('0x126')](db['Condition'],{'as':{'plural':_0x80ca('0x1c2'),'singular':_0x80ca('0x1c3')},'foreignKey':_0x80ca('0x1c4'),'onDelete':_0x80ca('0x123'),'hooks':!![]});db[_0x80ca('0x98')][_0x80ca('0x126')](db['Action'],{'as':_0x80ca('0x1b3'),'foreignKey':'TriggerId','onDelete':_0x80ca('0x123'),'hooks':!![]});db[_0x80ca('0x1b9')][_0x80ca('0x126')](db[_0x80ca('0xa6')],{'as':'Fields','onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x1c5'),'hooks':!![]});db[_0x80ca('0xa0')][_0x80ca('0x126')](db['AnalyticFieldReport'],{'as':_0x80ca('0x1c6'),'onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x1b8')});db['AnalyticMetric']['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x1c7')});db[_0x80ca('0xa6')][_0x80ca('0x133')](db['AnalyticMetric'],{'foreignKey':_0x80ca('0x1c7')});db['SalesforceAccount'][_0x80ca('0x126')](db['SalesforceConfiguration'],{'as':_0x80ca('0x1c8'),'onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x1c9')});db[_0x80ca('0xaa')][_0x80ca('0x126')](db[_0x80ca('0x1ca')],{'as':_0x80ca('0x1cb'),'onDelete':'cascade','foreignKey':_0x80ca('0x1cc')});db['SalesforceConfiguration']['hasMany'](db[_0x80ca('0x1ca')],{'as':_0x80ca('0x1cd'),'onDelete':_0x80ca('0x123'),'foreignKey':'DescriptionId'});db[_0x80ca('0xaa')][_0x80ca('0x126')](db['SalesforceField'],{'as':'Fields','onDelete':_0x80ca('0x123'),'foreignKey':'FieldId'});db[_0x80ca('0xaa')][_0x80ca('0x133')](db[_0x80ca('0x1ce')],{'as':_0x80ca('0x17b'),'foreignKey':_0x80ca('0x1c9')});db[_0x80ca('0x1ca')][_0x80ca('0x126')](db[_0x80ca('0x1ca')],{'as':'Subject','foreignKey':_0x80ca('0x1cc')});db[_0x80ca('0x1ca')][_0x80ca('0x126')](db[_0x80ca('0x1ca')],{'as':_0x80ca('0x1cf'),'foreignKey':_0x80ca('0x1d0')});db[_0x80ca('0x1ca')]['hasMany'](db[_0x80ca('0x1ca')],{'as':_0x80ca('0x1d1'),'foreignKey':_0x80ca('0x1d2')});db[_0x80ca('0x1ca')][_0x80ca('0x133')](db[_0x80ca('0x1d3')],{'as':_0x80ca('0x1d3'),'foreignKey':'VariableId'});db[_0x80ca('0xac')][_0x80ca('0x126')](db[_0x80ca('0xae')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x80ca('0x1c9')});db['SugarcrmConfiguration'][_0x80ca('0x126')](db[_0x80ca('0xaf')],{'as':_0x80ca('0x1cb'),'onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x1cc')});db[_0x80ca('0xae')][_0x80ca('0x126')](db['SugarcrmField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x80ca('0x1d0')});db[_0x80ca('0xae')][_0x80ca('0x126')](db['SugarcrmField'],{'as':_0x80ca('0x1c6'),'onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x1d2')});db['SugarcrmConfiguration'][_0x80ca('0x133')](db[_0x80ca('0xac')],{'as':'Account','foreignKey':_0x80ca('0x1c9')});db['SugarcrmField'][_0x80ca('0x126')](db[_0x80ca('0xaf')],{'as':_0x80ca('0x1d4'),'foreignKey':'SubjectId'});db[_0x80ca('0xaf')][_0x80ca('0x126')](db[_0x80ca('0xaf')],{'as':_0x80ca('0x1cf'),'foreignKey':_0x80ca('0x1d0')});db['SugarcrmField']['hasMany'](db[_0x80ca('0xaf')],{'as':_0x80ca('0x1d1'),'foreignKey':'FieldId'});db['SugarcrmField'][_0x80ca('0x133')](db[_0x80ca('0x1d3')],{'as':_0x80ca('0x1d3'),'foreignKey':_0x80ca('0x1d5')});db[_0x80ca('0xb1')][_0x80ca('0x126')](db[_0x80ca('0xb3')],{'as':_0x80ca('0x1c8'),'onDelete':'cascade','foreignKey':_0x80ca('0x1c9')});db[_0x80ca('0xb3')][_0x80ca('0x126')](db[_0x80ca('0xb5')],{'as':_0x80ca('0x1cb'),'onDelete':'cascade','foreignKey':_0x80ca('0x1cc')});db['DeskConfiguration'][_0x80ca('0x126')](db[_0x80ca('0xb5')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x80ca('0xb3')][_0x80ca('0x126')](db[_0x80ca('0xb5')],{'as':'Fields','onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x1d2')});db['DeskConfiguration'][_0x80ca('0x133')](db[_0x80ca('0xb1')],{'as':_0x80ca('0x17b'),'foreignKey':_0x80ca('0x1c9')});db[_0x80ca('0xb3')][_0x80ca('0x134')](db[_0x80ca('0x92')],{'through':_0x80ca('0x1d6')});db['DeskField'][_0x80ca('0x126')](db[_0x80ca('0xb5')],{'as':_0x80ca('0x1d4'),'foreignKey':_0x80ca('0x1cc')});db[_0x80ca('0xb5')][_0x80ca('0x126')](db[_0x80ca('0xb5')],{'as':_0x80ca('0x1cf'),'foreignKey':'DescriptionId'});db[_0x80ca('0xb5')][_0x80ca('0x126')](db[_0x80ca('0xb5')],{'as':_0x80ca('0x1d1'),'foreignKey':'FieldId'});db[_0x80ca('0xb5')][_0x80ca('0x133')](db[_0x80ca('0x1d3')],{'as':_0x80ca('0x1d3'),'foreignKey':_0x80ca('0x1d5')});db[_0x80ca('0x1d7')][_0x80ca('0x126')](db[_0x80ca('0xb8')],{'as':_0x80ca('0x1c8'),'onDelete':_0x80ca('0x123'),'foreignKey':'AccountId'});db[_0x80ca('0xb8')][_0x80ca('0x126')](db['ZohoField'],{'as':_0x80ca('0x1cb'),'onDelete':'cascade','foreignKey':_0x80ca('0x1cc')});db['ZohoConfiguration'][_0x80ca('0x126')](db[_0x80ca('0xba')],{'as':_0x80ca('0x1cd'),'onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x1d0')});db[_0x80ca('0xb8')][_0x80ca('0x126')](db[_0x80ca('0xba')],{'as':'Fields','onDelete':_0x80ca('0x123'),'foreignKey':'FieldId'});db[_0x80ca('0xb8')][_0x80ca('0x133')](db[_0x80ca('0x1d7')],{'as':'Account','foreignKey':_0x80ca('0x1c9')});db[_0x80ca('0xba')][_0x80ca('0x126')](db[_0x80ca('0xba')],{'as':_0x80ca('0x1d4'),'foreignKey':'SubjectId'});db['ZohoField'][_0x80ca('0x126')](db[_0x80ca('0xba')],{'as':_0x80ca('0x1cf'),'foreignKey':_0x80ca('0x1d0')});db['ZohoField']['hasMany'](db['ZohoField'],{'as':_0x80ca('0x1d1'),'foreignKey':_0x80ca('0x1d2')});db[_0x80ca('0xba')][_0x80ca('0x133')](db[_0x80ca('0x1d3')],{'as':_0x80ca('0x1d3'),'foreignKey':'VariableId'});db[_0x80ca('0xbb')][_0x80ca('0x126')](db[_0x80ca('0xbd')],{'as':_0x80ca('0x1c8'),'onDelete':'cascade','foreignKey':_0x80ca('0x1c9')});db['ZendeskConfiguration']['hasMany'](db[_0x80ca('0xbf')],{'as':_0x80ca('0x1cb'),'foreignKey':'SubjectId'});db[_0x80ca('0xbd')][_0x80ca('0x126')](db[_0x80ca('0xbf')],{'as':_0x80ca('0x1cd'),'foreignKey':_0x80ca('0x1d0')});db['ZendeskConfiguration']['hasMany'](db[_0x80ca('0xbf')],{'as':_0x80ca('0x1c6'),'foreignKey':_0x80ca('0x1d2')});db[_0x80ca('0xbd')]['belongsTo'](db[_0x80ca('0xbb')],{'as':'Account','foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x80ca('0x134')](db['Tag'],{'through':_0x80ca('0x1d8')});db['ZendeskField'][_0x80ca('0x126')](db[_0x80ca('0xbf')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x80ca('0xbf')][_0x80ca('0x126')](db[_0x80ca('0xbf')],{'as':'Description','foreignKey':_0x80ca('0x1d0')});db[_0x80ca('0xbf')][_0x80ca('0x126')](db[_0x80ca('0xbf')],{'as':_0x80ca('0x1d1'),'foreignKey':_0x80ca('0x1d2')});db[_0x80ca('0xbf')][_0x80ca('0x133')](db[_0x80ca('0x1d3')],{'as':'Variable','foreignKey':_0x80ca('0x1d5')});db[_0x80ca('0x1d9')][_0x80ca('0x126')](db[_0x80ca('0xc1')],{'as':_0x80ca('0x1c8'),'onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x1c9')});db[_0x80ca('0xc1')]['hasMany'](db['FreshdeskField'],{'as':_0x80ca('0x1cb'),'onDelete':'cascade','foreignKey':_0x80ca('0x1cc')});db[_0x80ca('0xc1')][_0x80ca('0x126')](db[_0x80ca('0x1da')],{'as':_0x80ca('0x1cd'),'onDelete':_0x80ca('0x123'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0x80ca('0x126')](db['FreshdeskField'],{'as':_0x80ca('0x1c6'),'onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x1d2')});db['FreshdeskConfiguration']['belongsTo'](db['FreshdeskAccount'],{'as':_0x80ca('0x17b'),'foreignKey':_0x80ca('0x1c9')});db[_0x80ca('0xc1')][_0x80ca('0x134')](db[_0x80ca('0x92')],{'through':_0x80ca('0x1db')});db[_0x80ca('0x1da')][_0x80ca('0x126')](db[_0x80ca('0x1da')],{'as':_0x80ca('0x1d4'),'foreignKey':_0x80ca('0x1cc')});db[_0x80ca('0x1da')][_0x80ca('0x126')](db[_0x80ca('0x1da')],{'as':'Description','foreignKey':_0x80ca('0x1d0')});db[_0x80ca('0x1da')][_0x80ca('0x126')](db[_0x80ca('0x1da')],{'as':_0x80ca('0x1d1'),'foreignKey':_0x80ca('0x1d2')});db['FreshdeskField'][_0x80ca('0x133')](db['Variable'],{'as':_0x80ca('0x1d3'),'foreignKey':'VariableId'});db[_0x80ca('0xc4')]['hasMany'](db['VtigerConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x80ca('0xc6')][_0x80ca('0x126')](db[_0x80ca('0xc8')],{'as':_0x80ca('0x1cb'),'foreignKey':_0x80ca('0x1cc')});db['VtigerConfiguration'][_0x80ca('0x126')](db['VtigerField'],{'as':'Descriptions','foreignKey':_0x80ca('0x1d0')});db['VtigerConfiguration']['hasMany'](db[_0x80ca('0xc8')],{'as':_0x80ca('0x1c6'),'foreignKey':'FieldId'});db[_0x80ca('0xc6')][_0x80ca('0x133')](db[_0x80ca('0xc4')],{'as':_0x80ca('0x17b'),'foreignKey':_0x80ca('0x1c9')});db[_0x80ca('0xc8')][_0x80ca('0x126')](db['VtigerField'],{'as':_0x80ca('0x1d4'),'foreignKey':_0x80ca('0x1cc')});db[_0x80ca('0xc8')][_0x80ca('0x126')](db[_0x80ca('0xc8')],{'as':_0x80ca('0x1cf'),'foreignKey':'DescriptionId'});db[_0x80ca('0xc8')][_0x80ca('0x126')](db[_0x80ca('0xc8')],{'as':_0x80ca('0x1d1'),'foreignKey':_0x80ca('0x1d2')});db[_0x80ca('0xc8')][_0x80ca('0x133')](db[_0x80ca('0x1d3')],{'as':_0x80ca('0x1d3'),'foreignKey':_0x80ca('0x1d5')});db[_0x80ca('0xca')][_0x80ca('0x126')](db[_0x80ca('0xcc')],{'as':'Configurations','onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x1c9')});db[_0x80ca('0xcc')]['hasMany'](db['ServicenowField'],{'as':_0x80ca('0x1cb'),'foreignKey':'SubjectId'});db[_0x80ca('0xcc')][_0x80ca('0x126')](db[_0x80ca('0xcd')],{'as':_0x80ca('0x1cd'),'foreignKey':_0x80ca('0x1d0')});db[_0x80ca('0xcc')][_0x80ca('0x126')](db[_0x80ca('0xcd')],{'as':_0x80ca('0x1c6'),'foreignKey':'FieldId'});db[_0x80ca('0xcc')][_0x80ca('0x133')](db['ServicenowAccount'],{'as':_0x80ca('0x17b'),'foreignKey':_0x80ca('0x1c9')});db[_0x80ca('0xcd')][_0x80ca('0x126')](db[_0x80ca('0xcd')],{'as':_0x80ca('0x1d4'),'foreignKey':_0x80ca('0x1cc')});db['ServicenowField']['hasMany'](db[_0x80ca('0xcd')],{'as':_0x80ca('0x1cf'),'foreignKey':_0x80ca('0x1d0')});db[_0x80ca('0xcd')][_0x80ca('0x126')](db['ServicenowField'],{'as':_0x80ca('0x1d1'),'foreignKey':_0x80ca('0x1d2')});db['ServicenowField'][_0x80ca('0x133')](db[_0x80ca('0x1d3')],{'as':'Variable','foreignKey':_0x80ca('0x1d5')});db[_0x80ca('0xcf')]['hasMany'](db[_0x80ca('0xd1')],{'as':_0x80ca('0x1c8'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x80ca('0xcf')][_0x80ca('0x133')](db[_0x80ca('0x117')],{'as':_0x80ca('0x117'),'foreignKey':_0x80ca('0x170')});db['Dynamics365Configuration'][_0x80ca('0x126')](db[_0x80ca('0xd3')],{'as':_0x80ca('0x1cb'),'onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x1cc')});db[_0x80ca('0xd1')][_0x80ca('0x126')](db[_0x80ca('0xd3')],{'as':_0x80ca('0x1cd'),'onDelete':'cascade','foreignKey':_0x80ca('0x1d0')});db['Dynamics365Configuration'][_0x80ca('0x126')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x1d2')});db['Dynamics365Configuration']['belongsTo'](db[_0x80ca('0xcf')],{'as':'Account','foreignKey':'AccountId'});db[_0x80ca('0xd3')][_0x80ca('0x126')](db['Dynamics365Field'],{'as':_0x80ca('0x1d4'),'foreignKey':_0x80ca('0x1cc')});db[_0x80ca('0xd3')]['hasMany'](db[_0x80ca('0xd3')],{'as':_0x80ca('0x1cf'),'foreignKey':'DescriptionId'});db[_0x80ca('0xd3')][_0x80ca('0x126')](db[_0x80ca('0xd3')],{'as':_0x80ca('0x1d1'),'foreignKey':_0x80ca('0x1d2')});db[_0x80ca('0xd3')][_0x80ca('0x133')](db['Variable'],{'as':'Variable','foreignKey':_0x80ca('0x1d5')});db[_0x80ca('0xd5')][_0x80ca('0x126')](db[_0x80ca('0xd7')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x80ca('0xd7')]['hasMany'](db[_0x80ca('0xd8')],{'as':_0x80ca('0x1cb'),'foreignKey':_0x80ca('0x1cc')});db[_0x80ca('0xd7')][_0x80ca('0x126')](db['FreshsalesField'],{'as':_0x80ca('0x1cd'),'foreignKey':_0x80ca('0x1d0')});db[_0x80ca('0xd7')][_0x80ca('0x126')](db[_0x80ca('0xd8')],{'as':_0x80ca('0x1c6'),'foreignKey':_0x80ca('0x1d2')});db[_0x80ca('0xd7')]['belongsTo'](db[_0x80ca('0xd5')],{'as':_0x80ca('0x17b'),'foreignKey':'AccountId'});db[_0x80ca('0xd8')]['hasMany'](db[_0x80ca('0xd8')],{'as':_0x80ca('0x1d4'),'foreignKey':'SubjectId'});db[_0x80ca('0xd8')][_0x80ca('0x126')](db[_0x80ca('0xd8')],{'as':_0x80ca('0x1cf'),'foreignKey':'DescriptionId'});db[_0x80ca('0xd8')][_0x80ca('0x126')](db[_0x80ca('0xd8')],{'as':_0x80ca('0x1d1'),'foreignKey':_0x80ca('0x1d2')});db[_0x80ca('0xd8')][_0x80ca('0x133')](db[_0x80ca('0x1d3')],{'as':_0x80ca('0x1d3'),'foreignKey':_0x80ca('0x1d5')});db[_0x80ca('0xdc')][_0x80ca('0x133')](db[_0x80ca('0x64')],{});db[_0x80ca('0xdc')][_0x80ca('0x133')](db[_0x80ca('0xff')],{'as':_0x80ca('0x187'),'foreignKey':_0x80ca('0x182')});db[_0x80ca('0xdc')][_0x80ca('0x133')](db['CmContact'],{'as':_0x80ca('0x16d'),'foreignKey':_0x80ca('0x16e')});db['ChatQueueReport'][_0x80ca('0x133')](db[_0x80ca('0x68')],{});db[_0x80ca('0xdc')]['belongsTo'](db[_0x80ca('0x6a')],{});db[_0x80ca('0xdc')][_0x80ca('0x133')](db[_0x80ca('0x13')],{});db[_0x80ca('0xdc')]['belongsTo'](db[_0x80ca('0x6e')],{});db[_0x80ca('0xdd')]['belongsTo'](db[_0x80ca('0x13')],{'onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x1dc')});db['ChatInternalMessage'][_0x80ca('0x133')](db[_0x80ca('0x13')],{'onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x1dd')});db['JscriptySessionReport'][_0x80ca('0x126')](db['JscriptyQuestionReport'],{'foreignKey':_0x80ca('0x1de'),'onDelete':_0x80ca('0x123')});db[_0x80ca('0xe2')][_0x80ca('0x126')](db['JscriptyAnswerReport'],{'foreignKey':_0x80ca('0x1de'),'onDelete':_0x80ca('0x123')});db[_0x80ca('0x1df')][_0x80ca('0x133')](db[_0x80ca('0x51')],{});db[_0x80ca('0x1df')][_0x80ca('0x133')](db[_0x80ca('0xff')],{'as':'List','foreignKey':_0x80ca('0x182')});db[_0x80ca('0x1df')][_0x80ca('0x133')](db['CmContact'],{'as':_0x80ca('0x16d'),'foreignKey':'ContactId'});db['SmsQueueReport'][_0x80ca('0x133')](db[_0x80ca('0x55')],{});db[_0x80ca('0x1df')]['belongsTo'](db[_0x80ca('0x57')],{});db[_0x80ca('0x1df')]['belongsTo'](db[_0x80ca('0x13')],{});db[_0x80ca('0x1df')][_0x80ca('0x133')](db[_0x80ca('0x146')],{});db[_0x80ca('0xe9')][_0x80ca('0x126')](db['JscriptySessionReport'],{'foreignKey':_0x80ca('0x1e0')});db[_0x80ca('0xe9')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x80ca('0x1e0')});db['JscriptyProject'][_0x80ca('0x126')](db['JscriptyAnswerReport'],{'foreignKey':_0x80ca('0x1e0')});db[_0x80ca('0x163')][_0x80ca('0x134')](db[_0x80ca('0x13')],{'as':'Agents','through':_0x80ca('0x13a')});db[_0x80ca('0x163')][_0x80ca('0x134')](db[_0x80ca('0x155')],{'through':_0x80ca('0x119'),'as':_0x80ca('0x140')});db['Team'][_0x80ca('0x134')](db[_0x80ca('0x3b')],{'through':'team_has_mail_queues','as':_0x80ca('0x142')});db[_0x80ca('0x163')]['belongsToMany'](db[_0x80ca('0x6e')],{'through':_0x80ca('0x1a2'),'as':_0x80ca('0x143')});db[_0x80ca('0x163')][_0x80ca('0x134')](db[_0x80ca('0x4d')],{'through':_0x80ca('0x1e1'),'as':'FaxQueues'});db[_0x80ca('0x163')]['belongsToMany'](db[_0x80ca('0x146')],{'through':'team_has_sms_queues','as':_0x80ca('0x1e2')});db[_0x80ca('0x163')][_0x80ca('0x134')](db[_0x80ca('0x62')],{'through':_0x80ca('0x1e3'),'as':'OpenchannelQueues'});db['Team'][_0x80ca('0x134')](db[_0x80ca('0x115')],{'through':'team_has_whatsapp_queues','as':_0x80ca('0x147')});db[_0x80ca('0x163')][_0x80ca('0x134')](db[_0x80ca('0x101')],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db[_0x80ca('0xf2')][_0x80ca('0x126')](db[_0x80ca('0x77')],{'as':_0x80ca('0x132'),'foreignKey':'CampaignId'});db[_0x80ca('0xf2')][_0x80ca('0x126')](db[_0x80ca('0x7b')],{'as':_0x80ca('0x128'),'foreignKey':_0x80ca('0x1ac')});db[_0x80ca('0xf2')][_0x80ca('0x126')](db[_0x80ca('0x7c')],{'as':_0x80ca('0x158'),'foreignKey':_0x80ca('0x1ac')});db[_0x80ca('0xf2')][_0x80ca('0x126')](db[_0x80ca('0x79')],{'as':_0x80ca('0x159'),'foreignKey':_0x80ca('0x1ac')});db[_0x80ca('0xf2')][_0x80ca('0x133')](db[_0x80ca('0x15a')],{'as':_0x80ca('0x15a'),'foreignKey':_0x80ca('0x15b')});db[_0x80ca('0xf2')][_0x80ca('0x133')](db[_0x80ca('0x15a')],{'as':_0x80ca('0x1e4'),'foreignKey':_0x80ca('0x15c')});db[_0x80ca('0xf2')][_0x80ca('0x133')](db['Interval'],{'as':_0x80ca('0x89'),'foreignKey':_0x80ca('0x15d')});db[_0x80ca('0xf2')][_0x80ca('0x133')](db['SquareProject'],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0x80ca('0xf2')]['belongsToMany'](db[_0x80ca('0xff')],{'as':_0x80ca('0x138'),'through':_0x80ca('0x1e5')});db['Campaign'][_0x80ca('0x134')](db['CmList'],{'as':_0x80ca('0x164'),'through':_0x80ca('0x1e6')});db['Attachment'][_0x80ca('0x133')](db['ChatOfflineMessage'],{'as':_0x80ca('0x6c'),'foreignKey':'ChatOfflineMessageId'});db[_0x80ca('0x1e7')]['belongsTo'](db[_0x80ca('0x3f')],{});db[_0x80ca('0x1e7')]['belongsTo'](db['MailInteraction'],{});db[_0x80ca('0x1e7')][_0x80ca('0x133')](db['MailAccount'],{'foreignKey':_0x80ca('0x1e8'),'as':_0x80ca('0x1e9')});db['MailTransferReport'][_0x80ca('0x133')](db['User'],{'foreignKey':_0x80ca('0x1ea'),'as':_0x80ca('0x1eb')});db[_0x80ca('0x1e7')][_0x80ca('0x133')](db['User'],{'foreignKey':_0x80ca('0x1ec'),'as':_0x80ca('0x1ed')});db['MailTransferReport'][_0x80ca('0x133')](db[_0x80ca('0x3b')],{'foreignKey':_0x80ca('0x1ee'),'as':'ToQueue'});db[_0x80ca('0x1e7')][_0x80ca('0x133')](db[_0x80ca('0x39')],{'foreignKey':'ToMailAccountId','as':_0x80ca('0x1ef')});db['ChatTransferReport'][_0x80ca('0x133')](db[_0x80ca('0x6a')],{});db[_0x80ca('0xf7')]['belongsTo'](db['ChatInteraction'],{});db[_0x80ca('0xf7')][_0x80ca('0x133')](db[_0x80ca('0x64')],{'foreignKey':_0x80ca('0x1f0'),'as':'FromAccount'});db[_0x80ca('0xf7')][_0x80ca('0x133')](db['User'],{'foreignKey':'FromUserId','as':_0x80ca('0x1eb')});db['ChatTransferReport'][_0x80ca('0x133')](db['User'],{'foreignKey':'ToUserId','as':_0x80ca('0x1ed')});db[_0x80ca('0xf7')][_0x80ca('0x133')](db[_0x80ca('0x6e')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db['ChatTransferReport'][_0x80ca('0x133')](db[_0x80ca('0x64')],{'foreignKey':_0x80ca('0x1f1'),'as':_0x80ca('0x1ef')});db['FaxTransferReport'][_0x80ca('0x133')](db[_0x80ca('0x186')],{});db[_0x80ca('0xf9')][_0x80ca('0x133')](db[_0x80ca('0x4a')],{});db['FaxTransferReport'][_0x80ca('0x133')](db[_0x80ca('0x47')],{'foreignKey':'FromFaxAccountId','as':_0x80ca('0x1e9')});db['FaxTransferReport'][_0x80ca('0x133')](db['User'],{'foreignKey':'FromUserId','as':_0x80ca('0x1eb')});db[_0x80ca('0xf9')][_0x80ca('0x133')](db[_0x80ca('0x13')],{'foreignKey':_0x80ca('0x1ec'),'as':_0x80ca('0x1ed')});db[_0x80ca('0xf9')]['belongsTo'](db[_0x80ca('0x4d')],{'foreignKey':_0x80ca('0x1f2'),'as':_0x80ca('0x1f3')});db[_0x80ca('0xf9')][_0x80ca('0x133')](db[_0x80ca('0x47')],{'foreignKey':_0x80ca('0x1f4'),'as':_0x80ca('0x1ef')});db[_0x80ca('0xfb')][_0x80ca('0x133')](db[_0x80ca('0x60')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x80ca('0x5e')],{});db[_0x80ca('0xfb')][_0x80ca('0x133')](db[_0x80ca('0x5a')],{'foreignKey':'FromOpenchannelAccountId','as':_0x80ca('0x1e9')});db[_0x80ca('0xfb')]['belongsTo'](db['User'],{'foreignKey':_0x80ca('0x1ea'),'as':_0x80ca('0x1eb')});db[_0x80ca('0xfb')][_0x80ca('0x133')](db[_0x80ca('0x13')],{'foreignKey':_0x80ca('0x1ec'),'as':_0x80ca('0x1ed')});db[_0x80ca('0xfb')][_0x80ca('0x133')](db['OpenchannelQueue'],{'foreignKey':_0x80ca('0x1f5'),'as':'ToQueue'});db[_0x80ca('0xfb')][_0x80ca('0x133')](db[_0x80ca('0x5a')],{'foreignKey':_0x80ca('0x1f6'),'as':_0x80ca('0x1ef')});db[_0x80ca('0xfd')]['belongsTo'](db[_0x80ca('0x57')],{});db[_0x80ca('0xfd')][_0x80ca('0x133')](db['SmsInteraction'],{});db[_0x80ca('0xfd')][_0x80ca('0x133')](db[_0x80ca('0x51')],{'foreignKey':_0x80ca('0x1f7'),'as':'FromAccount'});db[_0x80ca('0xfd')][_0x80ca('0x133')](db[_0x80ca('0x13')],{'foreignKey':_0x80ca('0x1ea'),'as':_0x80ca('0x1eb')});db[_0x80ca('0xfd')]['belongsTo'](db['User'],{'foreignKey':_0x80ca('0x1ec'),'as':'ToAgent'});db[_0x80ca('0xfd')]['belongsTo'](db[_0x80ca('0x146')],{'foreignKey':_0x80ca('0x1f8'),'as':_0x80ca('0x1f3')});db[_0x80ca('0xfd')][_0x80ca('0x133')](db[_0x80ca('0x51')],{'foreignKey':'ToSmsAccountId','as':_0x80ca('0x1ef')});db[_0x80ca('0xff')][_0x80ca('0x126')](db[_0x80ca('0x86')],{'as':_0x80ca('0x174'),'foreignKey':_0x80ca('0x182'),'onDelete':_0x80ca('0x123')});db[_0x80ca('0xff')][_0x80ca('0x126')](db[_0x80ca('0x80')],{'as':_0x80ca('0x1f9'),'foreignKey':'ListId'});db[_0x80ca('0xff')][_0x80ca('0x126')](db[_0x80ca('0x136')],{'as':_0x80ca('0x1a4'),'onDelete':_0x80ca('0x123'),'foreignKey':_0x80ca('0x182')});db[_0x80ca('0xff')][_0x80ca('0x126')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x80ca('0x182')});db['CmList'][_0x80ca('0x126')](db['CmHopperHistory'],{'as':_0x80ca('0x129'),'foreignKey':_0x80ca('0x182')});db[_0x80ca('0xff')]['hasMany'](db[_0x80ca('0x7e')],{'as':_0x80ca('0x7e'),'foreignKey':_0x80ca('0x182')});db[_0x80ca('0xff')][_0x80ca('0x134')](db[_0x80ca('0x155')],{'as':_0x80ca('0x1fa'),'through':_0x80ca('0x161')});db[_0x80ca('0xff')][_0x80ca('0x134')](db['User'],{'as':'Agents','through':_0x80ca('0x139')});db['VoicePrefix'][_0x80ca('0x126')](db[_0x80ca('0x19')],{'as':_0x80ca('0x1fb'),'onDelete':'cascade'});db[_0x80ca('0x101')][_0x80ca('0x134')](db[_0x80ca('0x13')],{'as':_0x80ca('0x162'),'through':_0x80ca('0x11c')});db[_0x80ca('0x101')]['belongsToMany'](db[_0x80ca('0x163')],{'through':'TeamVoicePrefix','as':_0x80ca('0x18d')});db[_0x80ca('0x102')][_0x80ca('0x126')](db['User'],{'as':_0x80ca('0x17d'),'foreignKey':'userProfileId'});db[_0x80ca('0x102')][_0x80ca('0x126')](db[_0x80ca('0x104')],{'as':_0x80ca('0x1fc'),'foreignKey':'userProfileId','onDelete':_0x80ca('0x123')});db[_0x80ca('0x104')]['hasMany'](db[_0x80ca('0x106')],{'as':_0x80ca('0x1fd'),'foreignKey':'sectionId','onDelete':_0x80ca('0x123')});db[_0x80ca('0x109')][_0x80ca('0x126')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x80ca('0x1fe'),'onDelete':_0x80ca('0x123')});db['WhatsappAccount'][_0x80ca('0x126')](db['CannedAnswer'],{'as':_0x80ca('0x175'),'foreignKey':_0x80ca('0x1fe')});db[_0x80ca('0x109')]['hasMany'](db[_0x80ca('0x10f')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0x80ca('0x109')][_0x80ca('0x126')](db[_0x80ca('0x10d')],{'as':_0x80ca('0x176')});db[_0x80ca('0x109')][_0x80ca('0x126')](db[_0x80ca('0x10b')],{'as':_0x80ca('0x153'),'foreignKey':_0x80ca('0x1fe'),'onDelete':'cascade'});db[_0x80ca('0x109')][_0x80ca('0x133')](db['CmList'],{'as':_0x80ca('0x187'),'foreignKey':'ListId'});db[_0x80ca('0x109')][_0x80ca('0x133')](db[_0x80ca('0x15e')],{'as':'mandatoryDispositionPause','foreignKey':_0x80ca('0x160')});db[_0x80ca('0x109')][_0x80ca('0x134')](db[_0x80ca('0x13')],{'as':_0x80ca('0x162'),'through':_0x80ca('0x14f')});db[_0x80ca('0x10b')][_0x80ca('0x133')](db[_0x80ca('0x13')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x80ca('0x133')](db['WhatsappQueue'],{'onDelete':_0x80ca('0x171')});db['WhatsappApplication']['belongsTo'](db['WhatsappAccount'],{'onDelete':_0x80ca('0x171')});db[_0x80ca('0x10b')][_0x80ca('0x133')](db[_0x80ca('0x89')],{'onDelete':_0x80ca('0x171'),'foreignKey':'IntervalId'});db[_0x80ca('0x10b')][_0x80ca('0x133')](db[_0x80ca('0x92')],{'onDelete':_0x80ca('0x171'),'foreignKey':_0x80ca('0x181')});db[_0x80ca('0x10d')][_0x80ca('0x126')](db[_0x80ca('0x10f')],{'as':_0x80ca('0x166'),'onDelete':_0x80ca('0x123'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0x80ca('0x133')](db['WhatsappAccount'],{'as':_0x80ca('0x17b'),'foreignKey':'WhatsappAccountId'});db[_0x80ca('0x10d')][_0x80ca('0x133')](db['CmContact'],{'as':'Contact','foreignKey':_0x80ca('0x16e')});db[_0x80ca('0x10d')][_0x80ca('0x133')](db[_0x80ca('0x13')],{'as':_0x80ca('0x18f'),'foreignKey':_0x80ca('0x124')});db['WhatsappInteraction'][_0x80ca('0x134')](db['Tag'],{'through':_0x80ca('0x1bc'),'as':'Tags'});db['WhatsappInteraction']['belongsToMany'](db['Tag'],{'through':_0x80ca('0x1bc'),'as':'ThroughTags'});db[_0x80ca('0x10d')][_0x80ca('0x134')](db[_0x80ca('0x13')],{'as':_0x80ca('0x17d'),'through':_0x80ca('0x13f'),'foreignKey':_0x80ca('0x1ff')});db[_0x80ca('0x10f')][_0x80ca('0x133')](db['User'],{'as':_0x80ca('0x13')});db[_0x80ca('0x10f')][_0x80ca('0x133')](db[_0x80ca('0x136')],{'onDelete':_0x80ca('0x123'),'as':_0x80ca('0x16d')});db['WhatsappMessage'][_0x80ca('0x133')](db[_0x80ca('0x10d')],{'onDelete':_0x80ca('0x123'),'as':_0x80ca('0x180'),'foreignKey':_0x80ca('0x1ff')});db[_0x80ca('0x10f')][_0x80ca('0x133')](db[_0x80ca('0x109')],{'as':'Account','foreignKey':_0x80ca('0x1fe')});db[_0x80ca('0x111')]['belongsTo'](db['WhatsappAccount'],{});db[_0x80ca('0x111')][_0x80ca('0x133')](db['CmList'],{'as':_0x80ca('0x187'),'foreignKey':'ListId'});db['WhatsappQueueReport'][_0x80ca('0x133')](db[_0x80ca('0x136')],{'as':_0x80ca('0x16d'),'foreignKey':_0x80ca('0x16e')});db[_0x80ca('0x111')][_0x80ca('0x133')](db[_0x80ca('0x10d')],{});db[_0x80ca('0x111')][_0x80ca('0x133')](db[_0x80ca('0x115')],{});db[_0x80ca('0x111')][_0x80ca('0x133')](db[_0x80ca('0x10f')],{});db[_0x80ca('0x111')][_0x80ca('0x133')](db[_0x80ca('0x13')],{});db[_0x80ca('0x113')][_0x80ca('0x133')](db[_0x80ca('0x10f')],{});db[_0x80ca('0x113')]['belongsTo'](db[_0x80ca('0x10d')],{});db[_0x80ca('0x113')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x80ca('0x200'),'as':_0x80ca('0x1e9')});db[_0x80ca('0x113')]['belongsTo'](db[_0x80ca('0x109')],{'foreignKey':_0x80ca('0x201'),'as':_0x80ca('0x1ef')});db[_0x80ca('0x113')]['belongsTo'](db[_0x80ca('0x115')],{'foreignKey':_0x80ca('0x202'),'as':_0x80ca('0x1f3')});db[_0x80ca('0x113')][_0x80ca('0x133')](db[_0x80ca('0x13')],{'foreignKey':_0x80ca('0x1ea'),'as':_0x80ca('0x1eb')});db['WhatsappTransferReport'][_0x80ca('0x133')](db['User'],{'foreignKey':_0x80ca('0x1ec'),'as':_0x80ca('0x1ed')});db[_0x80ca('0x115')][_0x80ca('0x134')](db[_0x80ca('0x13')],{'as':_0x80ca('0x162'),'through':_0x80ca('0x203'),'foreignKey':_0x80ca('0x204')});db['WhatsappQueue'][_0x80ca('0x134')](db[_0x80ca('0x163')],{'through':_0x80ca('0x205'),'as':_0x80ca('0x18d')});db[_0x80ca('0x11e')][_0x80ca('0x133')](db['User'],{'as':'user','foreignKey':_0x80ca('0x124'),'onDelete':_0x80ca('0x123'),'hooks':!![]});db[_0x80ca('0x117')][_0x80ca('0x122')](db['Dynamics365Account'],{'as':_0x80ca('0xcf'),'onDelete':_0x80ca('0x171')});db['CloudProvider'][_0x80ca('0x122')](db[_0x80ca('0x37')],{'as':_0x80ca('0x172'),'onDelete':_0x80ca('0x171')});db[_0x80ca('0x117')][_0x80ca('0x122')](db[_0x80ca('0x38')],{'as':'Smtp','onDelete':_0x80ca('0x171')});module[_0x80ca('0x206')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index a9f7fe6..4be4a35 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6fa2=['/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','/api/migrations','./api/migration','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','/apidoc','join','root','/www','static','/demo','/snippet','snippet','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','then','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation'];(function(_0x338349,_0x21c3cc){var _0x2a13b8=function(_0x3d6ae9){while(--_0x3d6ae9){_0x338349['push'](_0x338349['shift']());}};_0x2a13b8(++_0x21c3cc);}(_0x6fa2,0x1c6));var _0x26fa=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x6fa2[_0x1d1779];return _0x2377e9;};'use strict';var path=require('path');var express=require('express');var errors=require(_0x26fa('0x0'));var config=require(_0x26fa('0x1'));var setupLoggers=require(_0x26fa('0x2'))[_0x26fa('0x3')];var clientSideLogs=require(_0x26fa('0x4'));exports['default']=function(_0xf5809b){return setupLoggers(_0xf5809b)[_0x26fa('0x5')](function(){_0xf5809b['use'](_0x26fa('0x6'),require(_0x26fa('0x7')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x9'),require(_0x26fa('0xa')));_0xf5809b['use'](_0x26fa('0xb'),require(_0x26fa('0xc')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xd'),require(_0x26fa('0xe')));_0xf5809b['use'](_0x26fa('0xf'),require(_0x26fa('0x10')));_0xf5809b[_0x26fa('0x8')]('/api/voice/queues',require(_0x26fa('0x11')));_0xf5809b[_0x26fa('0x8')]('/api/voice/recordings',require('./api/voiceRecording'));_0xf5809b['use'](_0x26fa('0x12'),require('./api/screenRecording'));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x13'),require(_0x26fa('0x14')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x15'),require(_0x26fa('0x16')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x17'),require(_0x26fa('0x18')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x19'),require(_0x26fa('0x1a')));_0xf5809b[_0x26fa('0x8')]('/api/voice/agents/reports',require(_0x26fa('0x1b')));_0xf5809b[_0x26fa('0x8')]('/api/voice/queues/reports',require(_0x26fa('0x1c')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x1d'),require(_0x26fa('0x1e')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x1f'),require('./api/trunk'));_0xf5809b[_0x26fa('0x8')]('/api/voice/transfers/reports',require(_0x26fa('0x20')));_0xf5809b['use'](_0x26fa('0x21'),require('./api/mailServerOut'));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x22'),require(_0x26fa('0x23')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x24'),require(_0x26fa('0x25')));_0xf5809b['use']('/api/mail/substatuses',require('./api/mailSubstatus'));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x26'),require(_0x26fa('0x27')));_0xf5809b['use']('/api/mail/messages',require(_0x26fa('0x28')));_0xf5809b[_0x26fa('0x8')]('/api/mail/applications',require('./api/mailApplication'));_0xf5809b['use'](_0x26fa('0x29'),require(_0x26fa('0x2a')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x2b'),require(_0x26fa('0x2c')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x2d'),require(_0x26fa('0x2e')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x2f'),require('./api/faxAccount'));_0xf5809b['use']('/api/fax/applications',require(_0x26fa('0x30')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x31'),require(_0x26fa('0x32')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x33'),require(_0x26fa('0x34')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x35'),require(_0x26fa('0x36')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x37'),require('./api/faxQueueReport'));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x38'),require('./api/smsAccount'));_0xf5809b['use'](_0x26fa('0x39'),require(_0x26fa('0x3a')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x3b'),require('./api/smsInteraction'));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x3c'),require('./api/smsMessage'));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x3d'),require(_0x26fa('0x3e')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x3f'),require(_0x26fa('0x40')));_0xf5809b[_0x26fa('0x8')]('/api/openchannel/applications',require(_0x26fa('0x41')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x42'),require('./api/openchannelInteraction'));_0xf5809b[_0x26fa('0x8')]('/api/openchannel/messages',require(_0x26fa('0x43')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x44'),require('./api/openchannelQueue'));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x45'),require(_0x26fa('0x46')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x47'),require('./api/openchannelQueueReport'));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x48'),require(_0x26fa('0x49')));_0xf5809b['use'](_0x26fa('0x4a'),require('./api/chatInteraction'));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x4b'),require('./api/chatMessage'));_0xf5809b[_0x26fa('0x8')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0xf5809b[_0x26fa('0x8')]('/api/chat/queues',require(_0x26fa('0x4c')));_0xf5809b['use'](_0x26fa('0x4d'),require(_0x26fa('0x4e')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x4f'),require(_0x26fa('0x50')));_0xf5809b[_0x26fa('0x8')]('/api/cm/companies',require(_0x26fa('0x51')));_0xf5809b['use'](_0x26fa('0x52'),require(_0x26fa('0x53')));_0xf5809b['use']('/api/cm/hopper',require(_0x26fa('0x54')));_0xf5809b['use'](_0x26fa('0x55'),require(_0x26fa('0x56')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x57'),require(_0x26fa('0x58')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x59'),require('./api/cmHopperHistory'));_0xf5809b['use'](_0x26fa('0x5a'),require(_0x26fa('0x5b')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x5c'),require(_0x26fa('0x5d')));_0xf5809b['use'](_0x26fa('0x5e'),require(_0x26fa('0x5f')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x60'),require(_0x26fa('0x61')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x62'),require(_0x26fa('0x63')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x64'),require('./api/condition'));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x65'),require(_0x26fa('0x66')));_0xf5809b['use'](_0x26fa('0x67'),require(_0x26fa('0x68')));_0xf5809b[_0x26fa('0x8')]('/api/cdr',require(_0x26fa('0x69')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x6a'),require('./api/voiceQueuesLog'));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x6b'),require(_0x26fa('0x6c')));_0xf5809b['use'](_0x26fa('0x6d'),require(_0x26fa('0x6e')));_0xf5809b['use'](_0x26fa('0x6f'),require(_0x26fa('0x70')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x71'),require(_0x26fa('0x72')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x73'),require(_0x26fa('0x74')));_0xf5809b['use'](_0x26fa('0x75'),require(_0x26fa('0x76')));_0xf5809b['use'](_0x26fa('0x77'),require(_0x26fa('0x78')));_0xf5809b['use']('/api/triggers',require(_0x26fa('0x79')));_0xf5809b['use'](_0x26fa('0x7a'),require(_0x26fa('0x7b')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x7c'),require(_0x26fa('0x7d')));_0xf5809b['use'](_0x26fa('0x7e'),require('./api/integrationReport'));_0xf5809b[_0x26fa('0x8')]('/api/analytics/custom_reports',require(_0x26fa('0x7f')));_0xf5809b['use'](_0x26fa('0x80'),require(_0x26fa('0x81')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x82'),require(_0x26fa('0x83')));_0xf5809b['use']('/api/analytics/metrics',require(_0x26fa('0x84')));_0xf5809b['use'](_0x26fa('0x85'),require(_0x26fa('0x86')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x87'),require(_0x26fa('0x88')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x89'),require(_0x26fa('0x8a')));_0xf5809b['use'](_0x26fa('0x8b'),require(_0x26fa('0x8c')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x8d'),require(_0x26fa('0x8e')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x8f'),require(_0x26fa('0x90')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x91'),require(_0x26fa('0x92')));_0xf5809b[_0x26fa('0x8')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x93'),require(_0x26fa('0x94')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x95'),require(_0x26fa('0x96')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x97'),require(_0x26fa('0x98')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x99'),require(_0x26fa('0x9a')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x9b'),require('./api/intZohoConfiguration'));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x9c'),require('./api/intZohoField'));_0xf5809b[_0x26fa('0x8')]('/api/integrations/zendesk/accounts',require(_0x26fa('0x9d')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x9e'),require(_0x26fa('0x9f')));_0xf5809b[_0x26fa('0x8')]('/api/integrations/zendesk/fields',require(_0x26fa('0xa0')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xa1'),require('./api/intFreshdeskAccount'));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xa2'),require(_0x26fa('0xa3')));_0xf5809b['use'](_0x26fa('0xa4'),require(_0x26fa('0xa5')));_0xf5809b['use'](_0x26fa('0xa6'),require('./api/intVtigerAccount'));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xa7'),require(_0x26fa('0xa8')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xa9'),require('./api/intVtigerField'));_0xf5809b[_0x26fa('0x8')]('/api/integrations/servicenow/accounts',require(_0x26fa('0xaa')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xab'),require(_0x26fa('0xac')));_0xf5809b[_0x26fa('0x8')]('/api/integrations/servicenow/fields',require(_0x26fa('0xad')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xae'),require(_0x26fa('0xaf')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xb0'),require(_0x26fa('0xb1')));_0xf5809b[_0x26fa('0x8')]('/api/integrations/dynamics365/fields',require(_0x26fa('0xb2')));_0xf5809b['use'](_0x26fa('0xb3'),require(_0x26fa('0xb4')));_0xf5809b['use'](_0x26fa('0xb5'),require('./api/intFreshsalesConfiguration'));_0xf5809b['use']('/api/integrations/freshsales/fields',require(_0x26fa('0xb6')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xb7'),require(_0x26fa('0xb8')));_0xf5809b[_0x26fa('0x8')]('/api/chat/reports/queue',require('./api/chatQueueReport'));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xb9'),require(_0x26fa('0xba')));_0xf5809b[_0x26fa('0x8')]('/api/jscripty/answers/reports',require(_0x26fa('0xbb')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xbc'),require(_0x26fa('0xbd')));_0xf5809b[_0x26fa('0x8')]('/api/jscripty/sessions/reports',require(_0x26fa('0xbe')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xbf'),require('./api/smsQueueReport'));_0xf5809b[_0x26fa('0x8')]('/api/square/reports',require(_0x26fa('0xc0')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xc1'),require(_0x26fa('0xc2')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xc3'),require(_0x26fa('0xc4')));_0xf5809b['use'](_0x26fa('0xc5'),require(_0x26fa('0xc6')));_0xf5809b[_0x26fa('0x8')]('/api/square/odbc',require(_0x26fa('0xc7')));_0xf5809b[_0x26fa('0x8')]('/api/square/projects',require('./api/squareProject'));_0xf5809b[_0x26fa('0x8')]('/api/square/recordings',require('./api/squareRecording'));_0xf5809b['use']('/api/square/messages',require(_0x26fa('0xc8')));_0xf5809b['use'](_0x26fa('0xc9'),require(_0x26fa('0xca')));_0xf5809b['use']('/api/license',require(_0x26fa('0xcb')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xcc'),require('./api/campaign'));_0xf5809b['use'](_0x26fa('0xcd'),require(_0x26fa('0xce')));_0xf5809b[_0x26fa('0x8')]('/api/attachments',require('./api/attachment'));_0xf5809b[_0x26fa('0x8')]('/api/plugins',require(_0x26fa('0xcf')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xd0'),require(_0x26fa('0xd1')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xd2'),require(_0x26fa('0xd3')));_0xf5809b['use']('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xd4'),require(_0x26fa('0xd5')));_0xf5809b[_0x26fa('0x8')]('/api/sms/reports/transfer',require(_0x26fa('0xd6')));_0xf5809b['use']('/api/cm/lists',require(_0x26fa('0xd7')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xd8'),require('./api/voicePrefix'));_0xf5809b['use'](_0x26fa('0xd9'),require(_0x26fa('0xda')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xdb'),require(_0x26fa('0xdc')));_0xf5809b['use'](_0x26fa('0xdd'),require(_0x26fa('0xde')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xdf'),require(_0x26fa('0xe0')));_0xf5809b[_0x26fa('0x8')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xe1'),require(_0x26fa('0xe2')));_0xf5809b['use'](_0x26fa('0xe3'),require(_0x26fa('0xe4')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xe5'),require(_0x26fa('0xe6')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xe7'),require(_0x26fa('0xe8')));_0xf5809b['use'](_0x26fa('0xe9'),require(_0x26fa('0xea')));_0xf5809b[_0x26fa('0x8')]('/api/whatsapp/queues',require(_0x26fa('0xeb')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xec'),require(_0x26fa('0xed')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xee'),require(_0x26fa('0xef')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xf0'),require(_0x26fa('0xf1')));_0xf5809b[_0x26fa('0x8')]('/api/mail_interaction_has_tags',require(_0x26fa('0xf2')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xf3'),require(_0x26fa('0xf4')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xf5'),require(_0x26fa('0xf6')));_0xf5809b[_0x26fa('0x8')]('/api/auth/activedirectory',require(_0x26fa('0xf7')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xf8'),require(_0x26fa('0xf9')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0xfa'),require(_0x26fa('0xfb')));_0xf5809b['use'](_0x26fa('0xfc'),require(_0x26fa('0xfd')));_0xf5809b['use'](_0x26fa('0xfe'),require(_0x26fa('0xff')));_0xf5809b['use'](_0x26fa('0x100'),require(_0x26fa('0x101')));_0xf5809b[_0x26fa('0x8')]('/api/webbar',require(_0x26fa('0x102')));_0xf5809b['use'](_0x26fa('0x103'),clientSideLogs);_0xf5809b[_0x26fa('0x8')](_0x26fa('0x104'),express['static'](path[_0x26fa('0x105')](config[_0x26fa('0x106')],_0x26fa('0x104'))));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x107'),express[_0x26fa('0x108')](path[_0x26fa('0x105')](config[_0x26fa('0x106')],'/www')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x109'),express['static'](path[_0x26fa('0x105')](config[_0x26fa('0x106')],'/demo')));_0xf5809b[_0x26fa('0x8')](_0x26fa('0x10a'),express['static'](path['join'](config[_0x26fa('0x106')],_0x26fa('0x10b'),'3.12.1')));_0xf5809b['use']('/plugins',express[_0x26fa('0x108')](path[_0x26fa('0x105')](config[_0x26fa('0x106')],_0x26fa('0x10c'))));_0xf5809b[_0x26fa('0x10d')](_0x26fa('0x10e'))[_0x26fa('0x10f')](errors[0x194]);_0xf5809b[_0x26fa('0x10d')]('/*')[_0x26fa('0x10f')](function(_0x3dedd7,_0x3ba8c4){_0x3ba8c4[_0x26fa('0x110')](path['resolve'](_0xf5809b[_0x26fa('0x10f')](_0x26fa('0x111'))+_0x26fa('0x112')));});return _0xf5809b;});}; \ No newline at end of file +var _0xf9a2=['./api/cmList','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','join','root','/apidoc','/www','/demo','static','/snippet','3.12.1','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','/index.html','path','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','./api/user','use','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/variable','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/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/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesConfiguration','/api/networks','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists'];(function(_0x23345f,_0xc1cd34){var _0x1865e0=function(_0x4c76e3){while(--_0x4c76e3){_0x23345f['push'](_0x23345f['shift']());}};_0x1865e0(++_0xc1cd34);}(_0xf9a2,0x14f));var _0x2f9a=function(_0x1688da,_0x59e198){_0x1688da=_0x1688da-0x0;var _0x24e533=_0xf9a2[_0x1688da];return _0x24e533;};'use strict';var path=require(_0x2f9a('0x0'));var express=require('express');var errors=require(_0x2f9a('0x1'));var config=require('./config/environment');var setupLoggers=require(_0x2f9a('0x2'))[_0x2f9a('0x3')];var clientSideLogs=require(_0x2f9a('0x4'));exports[_0x2f9a('0x5')]=function(_0x3c1ec6){return setupLoggers(_0x3c1ec6)[_0x2f9a('0x6')](function(){_0x3c1ec6['use']('/api/users',require(_0x2f9a('0x7')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x9'),require('./api/voiceChanSpy'));_0x3c1ec6['use'](_0x2f9a('0xa'),require(_0x2f9a('0xb')));_0x3c1ec6['use']('/api/voice/extensions',require('./api/voiceExtension'));_0x3c1ec6['use']('/api/voice/mohs',require(_0x2f9a('0xc')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xd'),require(_0x2f9a('0xe')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xf'),require(_0x2f9a('0x10')));_0x3c1ec6[_0x2f9a('0x8')]('/api/screen/recordings',require(_0x2f9a('0x11')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x12'),require(_0x2f9a('0x13')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x14'),require(_0x2f9a('0x15')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x16'),require(_0x2f9a('0x17')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x18'),require(_0x2f9a('0x19')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x1a'),require(_0x2f9a('0x1b')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x1c'),require(_0x2f9a('0x1d')));_0x3c1ec6[_0x2f9a('0x8')]('/api/members/reports',require(_0x2f9a('0x1e')));_0x3c1ec6['use']('/api/trunks',require(_0x2f9a('0x1f')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x20'),require(_0x2f9a('0x21')));_0x3c1ec6['use'](_0x2f9a('0x22'),require(_0x2f9a('0x23')));_0x3c1ec6['use'](_0x2f9a('0x24'),require('./api/mailAccount'));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x25'),require(_0x2f9a('0x26')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x27'),require(_0x2f9a('0x28')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x29'),require('./api/mailInteraction'));_0x3c1ec6['use'](_0x2f9a('0x2a'),require(_0x2f9a('0x2b')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x2c'),require(_0x2f9a('0x2d')));_0x3c1ec6[_0x2f9a('0x8')]('/api/mail/reports/queue',require(_0x2f9a('0x2e')));_0x3c1ec6['use'](_0x2f9a('0x2f'),require('./api/dashboard'));_0x3c1ec6['use']('/api/dashboards/items',require(_0x2f9a('0x30')));_0x3c1ec6['use']('/api/fax/accounts',require(_0x2f9a('0x31')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x32'),require(_0x2f9a('0x33')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x34'),require(_0x2f9a('0x35')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x36'),require(_0x2f9a('0x37')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x38'),require(_0x2f9a('0x39')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x3a'),require(_0x2f9a('0x3b')));_0x3c1ec6['use'](_0x2f9a('0x3c'),require(_0x2f9a('0x3d')));_0x3c1ec6['use'](_0x2f9a('0x3e'),require(_0x2f9a('0x3f')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x40'),require(_0x2f9a('0x41')));_0x3c1ec6['use'](_0x2f9a('0x42'),require(_0x2f9a('0x43')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x44'),require(_0x2f9a('0x45')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x46'),require(_0x2f9a('0x47')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x48'),require('./api/openchannelApplication'));_0x3c1ec6['use']('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x3c1ec6[_0x2f9a('0x8')]('/api/openchannel/messages',require(_0x2f9a('0x49')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x4a'),require(_0x2f9a('0x4b')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x4c'),require('./api/chatWebsite'));_0x3c1ec6['use']('/api/openchannel/reports/queue',require(_0x2f9a('0x4d')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x4e'),require(_0x2f9a('0x4f')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x50'),require(_0x2f9a('0x51')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x52'),require(_0x2f9a('0x53')));_0x3c1ec6['use'](_0x2f9a('0x54'),require(_0x2f9a('0x55')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x56'),require('./api/chatQueue'));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x57'),require(_0x2f9a('0x58')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x59'),require(_0x2f9a('0x5a')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x5b'),require(_0x2f9a('0x5c')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x5d'),require(_0x2f9a('0x5e')));_0x3c1ec6[_0x2f9a('0x8')]('/api/cm/hopper',require(_0x2f9a('0x5f')));_0x3c1ec6[_0x2f9a('0x8')]('/api/cm/hopper_black',require(_0x2f9a('0x60')));_0x3c1ec6[_0x2f9a('0x8')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x3c1ec6['use'](_0x2f9a('0x61'),require(_0x2f9a('0x62')));_0x3c1ec6[_0x2f9a('0x8')]('/api/cm/custom_fields',require(_0x2f9a('0x63')));_0x3c1ec6['use']('/api/actions',require(_0x2f9a('0x64')));_0x3c1ec6['use'](_0x2f9a('0x65'),require(_0x2f9a('0x66')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x67'),require(_0x2f9a('0x68')));_0x3c1ec6['use'](_0x2f9a('0x69'),require(_0x2f9a('0x6a')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x6b'),require(_0x2f9a('0x6c')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x6d'),require(_0x2f9a('0x6e')));_0x3c1ec6['use'](_0x2f9a('0x6f'),require(_0x2f9a('0x70')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x71'),require(_0x2f9a('0x72')));_0x3c1ec6[_0x2f9a('0x8')]('/api/voiceQueuesLog',require(_0x2f9a('0x73')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x74'),require('./api/schedule'));_0x3c1ec6[_0x2f9a('0x8')]('/api/sounds',require(_0x2f9a('0x75')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x76'),require(_0x2f9a('0x77')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x78'),require(_0x2f9a('0x79')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x7a'),require(_0x2f9a('0x7b')));_0x3c1ec6['use'](_0x2f9a('0x7c'),require(_0x2f9a('0x7d')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x7e'),require(_0x2f9a('0x7f')));_0x3c1ec6['use'](_0x2f9a('0x80'),require('./api/trigger'));_0x3c1ec6[_0x2f9a('0x8')]('/api/variables',require(_0x2f9a('0x81')));_0x3c1ec6[_0x2f9a('0x8')]('/api/integrations',require('./api/integration'));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x82'),require(_0x2f9a('0x83')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x84'),require('./api/analyticCustomReport'));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x85'),require(_0x2f9a('0x86')));_0x3c1ec6['use'](_0x2f9a('0x87'),require('./api/analyticExtractedReport'));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x88'),require(_0x2f9a('0x89')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x8a'),require('./api/analyticFieldReport'));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x8b'),require(_0x2f9a('0x8c')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x8d'),require(_0x2f9a('0x8e')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x8f'),require(_0x2f9a('0x90')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x91'),require(_0x2f9a('0x92')));_0x3c1ec6[_0x2f9a('0x8')]('/api/integrations/sugarcrm/accounts',require(_0x2f9a('0x93')));_0x3c1ec6['use'](_0x2f9a('0x94'),require(_0x2f9a('0x95')));_0x3c1ec6['use'](_0x2f9a('0x96'),require(_0x2f9a('0x97')));_0x3c1ec6[_0x2f9a('0x8')]('/api/integrations/desk/accounts',require(_0x2f9a('0x98')));_0x3c1ec6['use']('/api/integrations/desk/configurations',require(_0x2f9a('0x99')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x9a'),require('./api/intDeskField'));_0x3c1ec6['use'](_0x2f9a('0x9b'),require(_0x2f9a('0x9c')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x9d'),require(_0x2f9a('0x9e')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x9f'),require(_0x2f9a('0xa0')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xa1'),require(_0x2f9a('0xa2')));_0x3c1ec6['use'](_0x2f9a('0xa3'),require(_0x2f9a('0xa4')));_0x3c1ec6['use']('/api/integrations/zendesk/fields',require(_0x2f9a('0xa5')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xa6'),require('./api/intFreshdeskAccount'));_0x3c1ec6['use']('/api/integrations/freshdesk/configurations',require(_0x2f9a('0xa7')));_0x3c1ec6['use'](_0x2f9a('0xa8'),require(_0x2f9a('0xa9')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xaa'),require(_0x2f9a('0xab')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xac'),require('./api/intVtigerConfiguration'));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xad'),require(_0x2f9a('0xae')));_0x3c1ec6['use'](_0x2f9a('0xaf'),require('./api/intServicenowAccount'));_0x3c1ec6[_0x2f9a('0x8')]('/api/integrations/servicenow/configurations',require(_0x2f9a('0xb0')));_0x3c1ec6['use'](_0x2f9a('0xb1'),require(_0x2f9a('0xb2')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xb3'),require(_0x2f9a('0xb4')));_0x3c1ec6['use'](_0x2f9a('0xb5'),require(_0x2f9a('0xb6')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xb7'),require(_0x2f9a('0xb8')));_0x3c1ec6[_0x2f9a('0x8')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x3c1ec6[_0x2f9a('0x8')]('/api/integrations/freshsales/configurations',require(_0x2f9a('0xb9')));_0x3c1ec6[_0x2f9a('0x8')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x3c1ec6['use'](_0x2f9a('0xba'),require('./api/network'));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xbb'),require('./api/chatQueueReport'));_0x3c1ec6['use'](_0x2f9a('0xbc'),require(_0x2f9a('0xbd')));_0x3c1ec6[_0x2f9a('0x8')]('/api/jscripty/answers/reports',require(_0x2f9a('0xbe')));_0x3c1ec6[_0x2f9a('0x8')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xbf'),require(_0x2f9a('0xc0')));_0x3c1ec6['use'](_0x2f9a('0xc1'),require(_0x2f9a('0xc2')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xc3'),require(_0x2f9a('0xc4')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xc5'),require('./api/squareReportDetail'));_0x3c1ec6['use'](_0x2f9a('0xc6'),require(_0x2f9a('0xc7')));_0x3c1ec6[_0x2f9a('0x8')]('/api/settings',require(_0x2f9a('0xc8')));_0x3c1ec6['use'](_0x2f9a('0xc9'),require(_0x2f9a('0xca')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xcb'),require('./api/squareProject'));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xcc'),require(_0x2f9a('0xcd')));_0x3c1ec6[_0x2f9a('0x8')]('/api/square/messages',require(_0x2f9a('0xce')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xcf'),require(_0x2f9a('0xd0')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xd1'),require(_0x2f9a('0xd2')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xd3'),require(_0x2f9a('0xd4')));_0x3c1ec6[_0x2f9a('0x8')]('/api/migrations',require(_0x2f9a('0xd5')));_0x3c1ec6[_0x2f9a('0x8')]('/api/attachments',require(_0x2f9a('0xd6')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xd7'),require(_0x2f9a('0xd8')));_0x3c1ec6[_0x2f9a('0x8')]('/api/mail/reports/transfer',require(_0x2f9a('0xd9')));_0x3c1ec6['use'](_0x2f9a('0xda'),require(_0x2f9a('0xdb')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xdc'),require('./api/faxTransferReport'));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xdd'),require(_0x2f9a('0xde')));_0x3c1ec6[_0x2f9a('0x8')]('/api/sms/reports/transfer',require(_0x2f9a('0xdf')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xe0'),require(_0x2f9a('0xe1')));_0x3c1ec6[_0x2f9a('0x8')]('/api/voice/prefixes',require(_0x2f9a('0xe2')));_0x3c1ec6['use']('/api/userProfiles',require(_0x2f9a('0xe3')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xe4'),require(_0x2f9a('0xe5')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xe6'),require(_0x2f9a('0xe7')));_0x3c1ec6['use'](_0x2f9a('0xe8'),require(_0x2f9a('0xe9')));_0x3c1ec6['use'](_0x2f9a('0xea'),require(_0x2f9a('0xeb')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xec'),require(_0x2f9a('0xed')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xee'),require('./api/whatsappInteraction'));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xef'),require(_0x2f9a('0xf0')));_0x3c1ec6[_0x2f9a('0x8')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x3c1ec6['use'](_0x2f9a('0xf1'),require(_0x2f9a('0xf2')));_0x3c1ec6[_0x2f9a('0x8')]('/api/whatsapp/queues',require(_0x2f9a('0xf3')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xf4'),require(_0x2f9a('0xf5')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xf6'),require(_0x2f9a('0xf7')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xf8'),require(_0x2f9a('0xf9')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xfa'),require(_0x2f9a('0xfb')));_0x3c1ec6['use']('/api/auth/local',require(_0x2f9a('0xfc')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xfd'),require('./api/authGoogle'));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0xfe'),require(_0x2f9a('0xff')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x100'),require(_0x2f9a('0x101')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x102'),require('./api/rpc'));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x103'),require('./api/version'));_0x3c1ec6[_0x2f9a('0x8')]('/api/system',require(_0x2f9a('0x104')));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x105'),require('./api/pm2'));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x106'),require(_0x2f9a('0x107')));_0x3c1ec6['use'](_0x2f9a('0x108'),clientSideLogs);_0x3c1ec6['use']('/apidoc',express['static'](path[_0x2f9a('0x109')](config[_0x2f9a('0x10a')],_0x2f9a('0x10b'))));_0x3c1ec6['use'](_0x2f9a('0x10c'),express['static'](path['join'](config[_0x2f9a('0x10a')],_0x2f9a('0x10c'))));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x10d'),express[_0x2f9a('0x10e')](path['join'](config[_0x2f9a('0x10a')],_0x2f9a('0x10d'))));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x10f'),express[_0x2f9a('0x10e')](path[_0x2f9a('0x109')](config[_0x2f9a('0x10a')],'snippet',_0x2f9a('0x110'))));_0x3c1ec6[_0x2f9a('0x8')](_0x2f9a('0x111'),express[_0x2f9a('0x10e')](path[_0x2f9a('0x109')](config[_0x2f9a('0x10a')],_0x2f9a('0x112'))));_0x3c1ec6[_0x2f9a('0x113')](_0x2f9a('0x114'))['get'](errors[0x194]);_0x3c1ec6[_0x2f9a('0x113')]('/*')[_0x2f9a('0x115')](function(_0x2be543,_0x5f0006){_0x5f0006['sendFile'](path['resolve'](_0x3c1ec6['get'](_0x2f9a('0x116'))+_0x2f9a('0x117')));});return _0x3c1ec6;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 32999b1..de70169 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf96b=['../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','log','../config/triggers','default','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.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/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc'];(function(_0x441cab,_0x375678){var _0x1beb9b=function(_0x5a5b97){while(--_0x5a5b97){_0x441cab['push'](_0x441cab['shift']());}};_0x1beb9b(++_0x375678);}(_0xf96b,0x109));var _0xbf96=function(_0x439076,_0x39e0e1){_0x439076=_0x439076-0x0;var _0x1ac31a=_0xf96b[_0x439076];return _0x1ac31a;};'use strict';var jayson=require(_0xbf96('0x0'));var _=require(_0xbf96('0x1'));var config=require(_0xbf96('0x2'));exports[_0xbf96('0x3')]=function(){return new Promise(function(_0x29e6f2,_0x34b226){var _0x440d4e={};_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x5')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x6')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x7')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x8')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x9')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0xa')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0xb')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0xc')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0xd')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0xe')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0xf')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require('../api/mailAccount/mailAccount.rpc'));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x10')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x11')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x12')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x13')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x14')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x15')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x16')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x17')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x18')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require('../api/faxQueue/faxQueue.rpc'));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x19')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x1a')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x1b')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x1c')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x1d')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x1e')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x1f')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x20')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x21')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x22')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x23')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x24')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require('../api/chatQueue/chatQueue.rpc'));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x25')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x26')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x27')));_0x440d4e=_['merge'](_0x440d4e,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x28')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x29')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x2a')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x2b')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require('../api/sound/sound.rpc'));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x2c')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x2d')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x2e')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x2f')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x30')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x31')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x32')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x33')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x34')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x35')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x36')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x37')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x38')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x39')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x3a')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x3b')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x3c')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x3d')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require('../api/squareProject/squareProject.rpc'));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require('../api/squareRecording/squareRecording.rpc'));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x3e')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x3f')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require('../api/attachment/attachment.rpc'));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require('../api/plugin/plugin.rpc'));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x40')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x41')));_0x440d4e=_[_0xbf96('0x4')](_0x440d4e,require(_0xbf96('0x42')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x43')));_0x440d4e=_['merge'](_0x440d4e,require(_0xbf96('0x44')));var _0x3db5f7=jayson[_0xbf96('0x45')](_0x440d4e)['http']();var _0x3bc6e5=config[_0xbf96('0x46')][_0xbf96('0x47')]||config['port']+0x1;var _0x1b84ad=config[_0xbf96('0x46')]['ip']||_0xbf96('0x48');_0x3db5f7['on'](_0xbf96('0x49'),function(_0x17f345){return _0x34b226(_0x17f345);});_0x3db5f7[_0xbf96('0x3')](_0x3bc6e5,_0x1b84ad,function(){console[_0xbf96('0x4a')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x1b84ad,_0x3bc6e5);require(_0xbf96('0x4b'))[_0xbf96('0x4c')]();return _0x29e6f2('RPC\x20listening\x20on\x20'+_0x1b84ad+':'+_0x3bc6e5);});});}; \ No newline at end of file +var _0x2c64=['../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','port','rpc','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.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/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/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/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc'];(function(_0xd15f8a,_0x14325c){var _0x4952c6=function(_0x73d061){while(--_0x73d061){_0xd15f8a['push'](_0xd15f8a['shift']());}};_0x4952c6(++_0x14325c);}(_0x2c64,0x18d));var _0x42c6=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x2c64[_0x38537f];return _0x141e23;};'use strict';var jayson=require(_0x42c6('0x0'));var _=require(_0x42c6('0x1'));var config=require(_0x42c6('0x2'));exports[_0x42c6('0x3')]=function(){return new Promise(function(_0x2dc8b7,_0x1f7842){var _0x4c4726={};_0x4c4726=_['merge'](_0x4c4726,require(_0x42c6('0x4')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x6')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require('../api/voiceQueue/voiceQueue.rpc'));_0x4c4726=_['merge'](_0x4c4726,require(_0x42c6('0x7')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x8')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x9')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0xa')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0xb')));_0x4c4726=_['merge'](_0x4c4726,require(_0x42c6('0xc')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0xd')));_0x4c4726=_['merge'](_0x4c4726,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0xe')));_0x4c4726=_['merge'](_0x4c4726,require(_0x42c6('0xf')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require('../api/mailAccount/mailAccount.rpc'));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x10')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x11')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x12')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x13')));_0x4c4726=_['merge'](_0x4c4726,require(_0x42c6('0x14')));_0x4c4726=_['merge'](_0x4c4726,require(_0x42c6('0x15')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require('../api/faxApplication/faxApplication.rpc'));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require('../api/faxInteraction/faxInteraction.rpc'));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x16')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require('../api/faxQueue/faxQueue.rpc'));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x17')));_0x4c4726=_['merge'](_0x4c4726,require(_0x42c6('0x18')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require('../api/smsInteraction/smsInteraction.rpc'));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x19')));_0x4c4726=_['merge'](_0x4c4726,require(_0x42c6('0x1a')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x1b')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x1c')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x1d')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x1e')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x1f')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x20')));_0x4c4726=_['merge'](_0x4c4726,require(_0x42c6('0x21')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x22')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x23')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x24')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x25')));_0x4c4726=_['merge'](_0x4c4726,require(_0x42c6('0x26')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x27')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x28')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x29')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x2a')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x2b')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x2c')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x2d')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x2e')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x2f')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x30')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x31')));_0x4c4726=_['merge'](_0x4c4726,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x32')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x33')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x34')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x35')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x36')));_0x4c4726=_['merge'](_0x4c4726,require(_0x42c6('0x37')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x38')));_0x4c4726=_['merge'](_0x4c4726,require(_0x42c6('0x39')));_0x4c4726=_['merge'](_0x4c4726,require(_0x42c6('0x3a')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x3b')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require('../api/squareProject/squareProject.rpc'));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x3c')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x3d')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require('../api/campaign/campaign.rpc'));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require('../api/attachment/attachment.rpc'));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x3e')));_0x4c4726=_['merge'](_0x4c4726,require(_0x42c6('0x3f')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x40')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x41')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x42')));_0x4c4726=_[_0x42c6('0x5')](_0x4c4726,require(_0x42c6('0x43')));var _0x371c1c=jayson['server'](_0x4c4726)[_0x42c6('0x44')]();var _0x114115=config['rpc'][_0x42c6('0x45')]||config[_0x42c6('0x45')]+0x1;var _0x14870e=config[_0x42c6('0x46')]['ip']||'localhost';_0x371c1c['on'](_0x42c6('0x47'),function(_0x4252ef){return _0x1f7842(_0x4252ef);});_0x371c1c[_0x42c6('0x3')](_0x114115,_0x14870e,function(){console[_0x42c6('0x48')](_0x42c6('0x49'),_0x14870e,_0x114115);require(_0x42c6('0x4a'))[_0x42c6('0x4b')]();return _0x2dc8b7(_0x42c6('0x4c')+_0x14870e+':'+_0x114115);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index b5a901d..6981c1a 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 _0x3946=['no\x20code','result=','indexOf','substr','startsWith','split','length','match','error','code','close','timeout','destroy','write','inherits','sendRequest','prototype','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','EventEmitter','./reply','./error','setEncoding','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function'];(function(_0x49d99d,_0x5e8ec9){var _0x4dfbf7=function(_0x1fb24f){while(--_0x1fb24f){_0x49d99d['push'](_0x49d99d['shift']());}};_0x4dfbf7(++_0x5e8ec9);}(_0x3946,0x10e));var _0x6394=function(_0x191abf,_0x5b3220){_0x191abf=_0x191abf-0x0;var _0x4aa0f3=_0x3946[_0x191abf];return _0x4aa0f3;};'use strict';var util=require(_0x6394('0x0'));var _=require(_0x6394('0x1'));var EventEmitter=require(_0x6394('0x2'))[_0x6394('0x3')];var AGIReply=require(_0x6394('0x4'));var AGIError=require(_0x6394('0x5'));function AGIChannel(_0x129acf){var _0x1153de=this,_0x2b050c=new AGIReply(),_0x5a9487=![],_0x387504={};EventEmitter['call'](_0x1153de);_0x129acf[_0x6394('0x6')](_0x6394('0x7'));_0x129acf['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2b050c[_0x6394('0x6')](_0x6394('0x7'));_0x2b050c['on'](_0x6394('0x8'),function(_0x1202aa){for(var _0xeee29b in _0x1202aa){_0x1153de[_0xeee29b]=_0x1202aa[_0xeee29b];}_0x1153de[_0x6394('0x9')](_0x6394('0xa'));});_0x2b050c['on'](_0x6394('0xb'),function(_0x145455){if(_0x145455[_0x6394('0xc')]()==_0x6394('0xd')){_0x1153de['emit'](_0x6394('0xd'));return;}if(_0x145455[_0x6394('0xe')](0x0,0xb)=='520-Invalid'){_0x5a9487=!![];}if(_0x5a9487){_0x387504['rx']+=_0x145455+'\x0a';if(_0x145455[_0x6394('0xf')](_0x6394('0x10'))!=-0x1){_0x5a9487=![];}}else{_0x387504['rx']=_0x145455;}if(_0x5a9487){return;}if(typeof _0x387504['cb']==_0x6394('0x11')){var _0x2e4f99=_0x387504['rx']['substring'](0x0,0x3),_0x1ad634=null,_0xf70da7=null;_0x2e4f99=parseInt(_0x2e4f99);if(isNaN(_0x2e4f99)){_0x387504['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6394('0x12')});return;}if(_0x2e4f99!=0xc8){_0x387504['cb'](null,{'code':_0x2e4f99,'result':-0x1,'extra':'KO'});return;}_0x1ad634=_0x387504['rx']['substring'](0x4)['replace'](_0x6394('0x13'),'');if(_0x1ad634[_0x6394('0x14')]('\x20')!=-0x1){_0x1ad634=_0x1ad634[_0x6394('0x15')](0x0,_0x1ad634['indexOf']('\x20'));}if(_[_0x6394('0x16')](_0x1ad634,'-1')){_0x1ad634=parseInt(_0x1ad634);}_0xf70da7=_0x387504['rx'][_0x6394('0x17')]('\x20');if(_0xf70da7[_0x6394('0x18')]==0x3){_0xf70da7=_0xf70da7[0x2][_0x6394('0xe')](0x1,_0xf70da7[0x2][_0x6394('0x18')]-0x1);}else if(_0xf70da7[_0x6394('0x18')]>0x3){var _0x57e958=/\((.+)\)/;var _0x2202ea=_0x387504['rx'][_0x6394('0x19')](_0x57e958);if(_0x2202ea){_0xf70da7=_0x2202ea[0x1];}else{_0xf70da7=null;}}else{_0xf70da7=null;}_0x387504['cb'](null,{'code':_0x2e4f99,'result':_0x1ad634,'extra':_0xf70da7});}});_0x129acf['on']('error',function(_0x17a8e5){_0x1153de[_0x6394('0x9')](_0x6394('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x17a8e5[_0x6394('0x1b')]));});_0x129acf['on'](_0x6394('0x1c'),function(){_0x1153de[_0x6394('0x9')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x129acf['on'](_0x6394('0x1d'),function(){_0x1153de[_0x6394('0x9')](_0x6394('0x1d'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x129acf[_0x6394('0x1e')]();});_0x129acf['pipe'](_0x2b050c);this['command']=function(_0x132948,_0x5f37b2){var _0x132948=_0x132948||'',_0x5f37b2=typeof _0x5f37b2==_0x6394('0x11')?_0x5f37b2:new Function();_0x387504={'tx':_0x132948,'rx':'','cb':_0x5f37b2};_0x129acf[_0x6394('0x1f')](_0x132948+'\x0a');},this['close']=function(){_0x129acf[_0x6394('0x1e')]();};}util[_0x6394('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x6394('0x21')]=function(_0x5ee113){return this['command']['sync'](this,_0x5ee113);};AGIChannel[_0x6394('0x22')][_0x6394('0x23')]=function(){return this[_0x6394('0x21')](_0x6394('0x24'));};AGIChannel[_0x6394('0x22')]['getData']=function(_0x28d427,_0x1c0634,_0x56787f){_0x28d427=_0x28d427===undefined?_0x6394('0x25'):_0x28d427;_0x1c0634=_0x1c0634===undefined?'5':_0x1c0634;_0x56787f=_0x56787f===undefined?'1':_0x56787f;return this['sendRequest'](util[_0x6394('0x26')](_0x6394('0x27'),_0x28d427,_0x1c0634*0x3e8,_0x56787f));};AGIChannel[_0x6394('0x22')][_0x6394('0x28')]=function(_0x28b95f){_0x28b95f=_0x28b95f||'NO\x20MESSAGE';return this[_0x6394('0x21')](util[_0x6394('0x26')](_0x6394('0x29'),_0x28b95f));};AGIChannel[_0x6394('0x22')]['exec']=function(_0x5e4e0c,_0x4f657a){if(_[_0x6394('0x2a')](_0x4f657a)){return this[_0x6394('0x21')](util[_0x6394('0x26')]('EXEC\x20%s\x20%s',_0x5e4e0c,_0x4f657a['join'](',')));}return this[_0x6394('0x21')](util['format'](_0x6394('0x2b'),_0x5e4e0c,_0x4f657a));};AGIChannel[_0x6394('0x22')][_0x6394('0x2c')]=function(_0xdf6e6a){return this[_0x6394('0x21')](util[_0x6394('0x26')](_0x6394('0x2d'),_0xdf6e6a));};AGIChannel[_0x6394('0x22')][_0x6394('0x2e')]=function(_0x3aed76){return this[_0x6394('0x21')](util[_0x6394('0x26')]('SET\x20EXTENSION\x20%s',_0x3aed76));};AGIChannel[_0x6394('0x22')][_0x6394('0x2f')]=function(_0x283970){return this['sendRequest'](util[_0x6394('0x26')](_0x6394('0x30'),_0x283970));};AGIChannel[_0x6394('0x22')][_0x6394('0xd')]=function(){return this[_0x6394('0x21')]('HANGUP');};AGIChannel[_0x6394('0x22')]['setVariable']=function(_0x2471e0,_0x26df10){var _0x52c66f=_['isBoolean'](_0x26df10)||_[_0x6394('0x31')](_0x26df10)?_0x26df10[_0x6394('0x32')]():_0x26df10;return this[_0x6394('0x21')](util[_0x6394('0x26')](_0x6394('0x33'),_0x2471e0,_0x52c66f?_0x52c66f['toString']()[_0x6394('0x34')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x6394('0x22')]['sayNumber']=function(_0x1ad20d,_0x3a7918){return this['sendRequest'](util[_0x6394('0x26')]('SAY\x20NUMBER\x20%s\x20%s',_0x1ad20d,_0x3a7918));};AGIChannel['prototype'][_0x6394('0x35')]=function(_0x274ce0,_0x2f9b44){return this[_0x6394('0x21')](util[_0x6394('0x26')](_0x6394('0x36'),_0x274ce0,_0x2f9b44));};AGIChannel['prototype'][_0x6394('0x37')]=function(_0x16fb02,_0x4ac58d){return this['sendRequest'](util[_0x6394('0x26')](_0x6394('0x38'),_0x16fb02,_0x4ac58d));};AGIChannel[_0x6394('0x22')]['continueAt']=function(_0x175286,_0x2a7319,_0x306471){_0x2a7319=_0x2a7319||this[_0x6394('0x39')];_0x306471=_0x306471||0x1;this['setContext'](_0x175286);this['setExtension'](_0x2a7319);this[_0x6394('0x2f')](_0x306471);return this[_0x6394('0x28')](util[_0x6394('0x26')](_0x6394('0x3a'),_0x175286,_0x2a7319,_0x306471));};AGIChannel['prototype'][_0x6394('0x3b')]=function(_0x2afe6f){return this['sendRequest'](util[_0x6394('0x26')]('GET\x20VARIABLE\x20\x22%s\x22',_0x2afe6f));};AGIChannel[_0x6394('0x22')][_0x6394('0x3c')]=function(_0xbaa738,_0x5aa858,_0x4ed14b,_0x472f0d,_0x467a0a,_0x5157a5){_0x5aa858=_0x5aa858||_0x6394('0x3d');_0x4ed14b=_0x4ed14b||'';_0x472f0d=_0x472f0d===undefined?-0x1:_0x472f0d==='-1'?-0x1:_0x472f0d*0x3e8;_0x467a0a=_0x467a0a===undefined?'':'s='+_0x467a0a;_0x5157a5=_0x5157a5?_0x6394('0x3e'):'';return this[_0x6394('0x21')](util[_0x6394('0x26')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0xbaa738,_0x5aa858,_0x4ed14b,_0x472f0d,_0x5157a5,_0x467a0a));};AGIChannel[_0x6394('0x22')][_0x6394('0x3f')]=function(_0x5c78e7,_0x328f29){_0x328f29=_0x328f29||'';return this[_0x6394('0x21')](util[_0x6394('0x26')](_0x6394('0x40'),_0x5c78e7,_0x328f29));};AGIChannel[_0x6394('0x22')][_0x6394('0x41')]=function(_0x1b03a6){return this[_0x6394('0x42')](_0x6394('0x43'),_0x1b03a6);};AGIChannel[_0x6394('0x22')][_0x6394('0x44')]=function(_0x2289c6){return this[_0x6394('0x42')](_0x6394('0x45'),_0x2289c6);};AGIChannel[_0x6394('0x22')][_0x6394('0x1a')]=function(_0x138d6c,_0x762797){this[_0x6394('0x28')](util['format'](_0x6394('0x46'),_0x138d6c['id'],_0x138d6c['label'],_0x762797));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6394('0x47')]=AGIChannel; \ No newline at end of file +var _0x302e=['setContext','SET\x20EXTENSION\x20%s','setPriority','HANGUP','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','EventEmitter','./error','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','substring','result=','substr','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','inherits','sendRequest','sync','prototype','answer','ANSWER','beep','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x302e,0x1eb));var _0xe302=function(_0x480a5d,_0x873e21){_0x480a5d=_0x480a5d-0x0;var _0x286487=_0x302e[_0x480a5d];return _0x286487;};'use strict';var util=require(_0xe302('0x0'));var _=require(_0xe302('0x1'));var EventEmitter=require(_0xe302('0x2'))[_0xe302('0x3')];var AGIReply=require('./reply');var AGIError=require(_0xe302('0x4'));function AGIChannel(_0x371048){var _0x3e965=this,_0x5151d8=new AGIReply(),_0x321c8a=![],_0x1647a7={};EventEmitter['call'](_0x3e965);_0x371048[_0xe302('0x5')](_0xe302('0x6'));_0x371048[_0xe302('0x7')](0x8*0x3c*0x3c*0x3e8);_0x5151d8[_0xe302('0x5')](_0xe302('0x6'));_0x5151d8['on'](_0xe302('0x8'),function(_0xe14329){for(var _0x1155a5 in _0xe14329){_0x3e965[_0x1155a5]=_0xe14329[_0x1155a5];}_0x3e965[_0xe302('0x9')](_0xe302('0xa'));});_0x5151d8['on'](_0xe302('0xb'),function(_0x319a5b){if(_0x319a5b[_0xe302('0xc')]()==_0xe302('0xd')){_0x3e965[_0xe302('0x9')](_0xe302('0xd'));return;}if(_0x319a5b['substring'](0x0,0xb)==_0xe302('0xe')){_0x321c8a=!![];}if(_0x321c8a){_0x1647a7['rx']+=_0x319a5b+'\x0a';if(_0x319a5b['search'](_0xe302('0xf'))!=-0x1){_0x321c8a=![];}}else{_0x1647a7['rx']=_0x319a5b;}if(_0x321c8a){return;}if(typeof _0x1647a7['cb']==_0xe302('0x10')){var _0x56a8bf=_0x1647a7['rx']['substring'](0x0,0x3),_0xd9a2fd=null,_0x37ad2e=null;_0x56a8bf=parseInt(_0x56a8bf);if(isNaN(_0x56a8bf)){_0x1647a7['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe302('0x11')});return;}if(_0x56a8bf!=0xc8){_0x1647a7['cb'](null,{'code':_0x56a8bf,'result':-0x1,'extra':'KO'});return;}_0xd9a2fd=_0x1647a7['rx'][_0xe302('0x12')](0x4)['replace'](_0xe302('0x13'),'');if(_0xd9a2fd['indexOf']('\x20')!=-0x1){_0xd9a2fd=_0xd9a2fd[_0xe302('0x14')](0x0,_0xd9a2fd[_0xe302('0x15')]('\x20'));}if(_[_0xe302('0x16')](_0xd9a2fd,'-1')){_0xd9a2fd=parseInt(_0xd9a2fd);}_0x37ad2e=_0x1647a7['rx'][_0xe302('0x17')]('\x20');if(_0x37ad2e['length']==0x3){_0x37ad2e=_0x37ad2e[0x2]['substring'](0x1,_0x37ad2e[0x2][_0xe302('0x18')]-0x1);}else if(_0x37ad2e[_0xe302('0x18')]>0x3){var _0x3eba1b=/\((.+)\)/;var _0x5a80fd=_0x1647a7['rx'][_0xe302('0x19')](_0x3eba1b);if(_0x5a80fd){_0x37ad2e=_0x5a80fd[0x1];}else{_0x37ad2e=null;}}else{_0x37ad2e=null;}_0x1647a7['cb'](null,{'code':_0x56a8bf,'result':_0xd9a2fd,'extra':_0x37ad2e});}});_0x371048['on'](_0xe302('0x1a'),function(_0x3015f6){_0x3e965['emit'](_0xe302('0x1a'),new AGIError(_0xe302('0x1b'),_0x3015f6['code']));});_0x371048['on']('close',function(){_0x3e965[_0xe302('0x9')](_0xe302('0x1c'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x371048['on'](_0xe302('0x1d'),function(){_0x3e965['emit']('timeout',new AGIError(_0xe302('0x1e')));_0x371048['destroy']();});_0x371048[_0xe302('0x1f')](_0x5151d8);this[_0xe302('0x20')]=function(_0x924111,_0x390678){var _0x924111=_0x924111||'',_0x390678=typeof _0x390678=='function'?_0x390678:new Function();_0x1647a7={'tx':_0x924111,'rx':'','cb':_0x390678};_0x371048[_0xe302('0x21')](_0x924111+'\x0a');},this[_0xe302('0x1c')]=function(){_0x371048[_0xe302('0x22')]();};}util[_0xe302('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xe302('0x24')]=function(_0x532e94){return this[_0xe302('0x20')][_0xe302('0x25')](this,_0x532e94);};AGIChannel[_0xe302('0x26')][_0xe302('0x27')]=function(){return this[_0xe302('0x24')](_0xe302('0x28'));};AGIChannel['prototype']['getData']=function(_0x23e33c,_0x377097,_0x4ab7b9){_0x23e33c=_0x23e33c===undefined?_0xe302('0x29'):_0x23e33c;_0x377097=_0x377097===undefined?'5':_0x377097;_0x4ab7b9=_0x4ab7b9===undefined?'1':_0x4ab7b9;return this['sendRequest'](util[_0xe302('0x2a')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x23e33c,_0x377097*0x3e8,_0x4ab7b9));};AGIChannel['prototype']['noop']=function(_0x38fcf6){_0x38fcf6=_0x38fcf6||'NO\x20MESSAGE';return this[_0xe302('0x24')](util['format'](_0xe302('0x2b'),_0x38fcf6));};AGIChannel[_0xe302('0x26')][_0xe302('0x2c')]=function(_0x14defb,_0x292ab3){if(_[_0xe302('0x2d')](_0x292ab3)){return this[_0xe302('0x24')](util[_0xe302('0x2a')](_0xe302('0x2e'),_0x14defb,_0x292ab3[_0xe302('0x2f')](',')));}return this[_0xe302('0x24')](util[_0xe302('0x2a')]('EXEC\x20%s\x20%s',_0x14defb,_0x292ab3));};AGIChannel[_0xe302('0x26')][_0xe302('0x30')]=function(_0xe3ca4c){return this[_0xe302('0x24')](util['format']('SET\x20CONTEXT\x20%s',_0xe3ca4c));};AGIChannel['prototype']['setExtension']=function(_0xe22fb3){return this['sendRequest'](util[_0xe302('0x2a')](_0xe302('0x31'),_0xe22fb3));};AGIChannel[_0xe302('0x26')][_0xe302('0x32')]=function(_0x1d6f88){return this[_0xe302('0x24')](util[_0xe302('0x2a')]('SET\x20PRIORITY\x20%s',_0x1d6f88));};AGIChannel[_0xe302('0x26')]['hangup']=function(){return this['sendRequest'](_0xe302('0x33'));};AGIChannel[_0xe302('0x26')]['setVariable']=function(_0x4bd072,_0x29b859){var _0x1a2590=_[_0xe302('0x34')](_0x29b859)||_['isNumber'](_0x29b859)?_0x29b859[_0xe302('0x35')]():_0x29b859;return this[_0xe302('0x24')](util['format'](_0xe302('0x36'),_0x4bd072,_0x1a2590?_0x1a2590[_0xe302('0x35')]()[_0xe302('0x37')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe302('0x26')]['sayNumber']=function(_0x383610,_0x134be7){return this[_0xe302('0x24')](util[_0xe302('0x2a')](_0xe302('0x38'),_0x383610,_0x134be7));};AGIChannel[_0xe302('0x26')][_0xe302('0x39')]=function(_0x138457,_0x2f9494){return this[_0xe302('0x24')](util[_0xe302('0x2a')](_0xe302('0x3a'),_0x138457,_0x2f9494));};AGIChannel[_0xe302('0x26')][_0xe302('0x3b')]=function(_0x1e89b0,_0x15a642){return this[_0xe302('0x24')](util['format'](_0xe302('0x3c'),_0x1e89b0,_0x15a642));};AGIChannel[_0xe302('0x26')]['continueAt']=function(_0x46976a,_0xec1d61,_0x3732f4){_0xec1d61=_0xec1d61||this[_0xe302('0x3d')];_0x3732f4=_0x3732f4||0x1;this[_0xe302('0x30')](_0x46976a);this[_0xe302('0x3e')](_0xec1d61);this[_0xe302('0x32')](_0x3732f4);return this[_0xe302('0x3f')](util[_0xe302('0x2a')](_0xe302('0x40'),_0x46976a,_0xec1d61,_0x3732f4));};AGIChannel[_0xe302('0x26')]['getVariable']=function(_0x2a7049){return this[_0xe302('0x24')](util['format'](_0xe302('0x41'),_0x2a7049));};AGIChannel['prototype']['recordFile']=function(_0x5e937f,_0x44382a,_0x8a80c8,_0x5eaf97,_0x5aa1bf,_0x2aceb1){_0x44382a=_0x44382a||_0xe302('0x42');_0x8a80c8=_0x8a80c8||'';_0x5eaf97=_0x5eaf97===undefined?-0x1:_0x5eaf97==='-1'?-0x1:_0x5eaf97*0x3e8;_0x5aa1bf=_0x5aa1bf===undefined?'':'s='+_0x5aa1bf;_0x2aceb1=_0x2aceb1?_0xe302('0x43'):'';return this[_0xe302('0x24')](util['format'](_0xe302('0x44'),_0x5e937f,_0x44382a,_0x8a80c8,_0x5eaf97,_0x2aceb1,_0x5aa1bf));};AGIChannel[_0xe302('0x26')][_0xe302('0x45')]=function(_0x4d84b6,_0x121b51){_0x121b51=_0x121b51||'';return this[_0xe302('0x24')](util[_0xe302('0x2a')](_0xe302('0x46'),_0x4d84b6,_0x121b51));};AGIChannel[_0xe302('0x26')][_0xe302('0x47')]=function(_0x49eda0){return this[_0xe302('0x2c')](_0xe302('0x48'),_0x49eda0);};AGIChannel[_0xe302('0x26')][_0xe302('0x49')]=function(_0x4ed8ed){return this[_0xe302('0x2c')](_0xe302('0x4a'),_0x4ed8ed);};AGIChannel[_0xe302('0x26')]['error']=function(_0x2cacbf,_0x1f09bc){this[_0xe302('0x3f')](util[_0xe302('0x2a')](_0xe302('0x4b'),_0x2cacbf['id'],_0x2cacbf['label'],_0x1f09bc));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xe302('0x4c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 06b9ac2..e3dc660 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 _0xe740=['push','apply','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x17f145,_0x3422bb){var _0x2d5420=function(_0x3eb38b){while(--_0x3eb38b){_0x17f145['push'](_0x17f145['shift']());}};_0x2d5420(++_0x3422bb);}(_0xe740,0x124));var _0x0e74=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0xe740[_0xbeb808];return _0x5d6909;};'use strict';var util=require(_0x0e74('0x0'));var error={'E_AGI_UNDEFINED':_0x0e74('0x1'),'E_AGI_ARGUMENT_PORT':_0x0e74('0x2'),'E_AGI_SERVER_ERROR':_0x0e74('0x3'),'E_AGI_SERVER_CLOSE':_0x0e74('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x0e74('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x0e74('0x6'),'E_AGI_SOCKET_ERROR':_0x0e74('0x7'),'E_AGI_SOCKET_CLOSE':_0x0e74('0x8'),'E_AGI_SOCKET_TIMEOUT':_0x0e74('0x9'),'E_AGI_COMMAND_EMPTY':_0x0e74('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x0e74('0xb'),'E_AGI_IVR_ENTRY':_0x0e74('0xc')};function AGIError(_0x132846){var _0x132846=_0x132846||null,_0x472f69=_0x472f69||[],_0x2ad279=0x1,_0x4f7c8c='';if(!error[_0x132846]){_0x132846=_0x0e74('0xd');}_0x472f69[_0x0e74('0xe')](error[_0x132846]);while(arguments[_0x2ad279]){_0x472f69[_0x0e74('0xe')](arguments[_0x2ad279]);_0x2ad279++;}_0x4f7c8c=util['format'][_0x0e74('0xf')](util,_0x472f69);this[_0x0e74('0x10')]=_0x4f7c8c;this[_0x0e74('0x11')]=_0x132846;}module['exports']=AGIError; \ No newline at end of file +var _0x19d2=['name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','message'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x19d2,0x1a6));var _0x219d=function(_0x3674d9,_0x2336a1){_0x3674d9=_0x3674d9-0x0;var _0x4284dd=_0x19d2[_0x3674d9];return _0x4284dd;};'use strict';var util=require(_0x219d('0x0'));var error={'E_AGI_UNDEFINED':_0x219d('0x1'),'E_AGI_ARGUMENT_PORT':_0x219d('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x219d('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x219d('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x219d('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x219d('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x219d('0x7'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x260cef){var _0x260cef=_0x260cef||null,_0x462221=_0x462221||[],_0x4a5bd5=0x1,_0x5a40d7='';if(!error[_0x260cef]){_0x260cef=_0x219d('0x8');}_0x462221['push'](error[_0x260cef]);while(arguments[_0x4a5bd5]){_0x462221[_0x219d('0x9')](arguments[_0x4a5bd5]);_0x4a5bd5++;}_0x5a40d7=util[_0x219d('0xa')]['apply'](util,_0x462221);this[_0x219d('0xb')]=_0x5a40d7;this[_0x219d('0xc')]=_0x260cef;}module[_0x219d('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 0734740..1455e86 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 _0xcb53=['agi','parse','projectUpdate','exports','lodash','events','ioredis','redis','defaults','localhost','subscribe','emit','error','E_AGI_SERVER_ERROR','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb53,0x1f3));var _0x3cb5=function(_0x5592ff,_0x5b6530){_0x5592ff=_0x5592ff-0x0;var _0x224766=_0xcb53[_0x5592ff];return _0x224766;};'use strict';var _=require(_0x3cb5('0x0'));var EventEmitter=require(_0x3cb5('0x1'))['EventEmitter'];var Redis=require(_0x3cb5('0x2'));var AGIError=require('./error');var config=require('../../config/environment');config[_0x3cb5('0x3')]=_[_0x3cb5('0x4')](config['redis'],{'host':_0x3cb5('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x3cb5('0x3')]);sub[_0x3cb5('0x6')]('agi',function(_0x209fcf){if(_0x209fcf)return eventEmitter[_0x3cb5('0x7')](_0x3cb5('0x8'),new AGIError(_0x3cb5('0x9'),_0x209fcf));});sub['on'](_0x3cb5('0xa'),function(_0x7a05c1,_0x269ca9){if(_0x7a05c1!==_0x3cb5('0xb'))return;try{var _0x47bda3=JSON[_0x3cb5('0xc')](_0x269ca9);eventEmitter[_0x3cb5('0x7')](_0x3cb5('0xd'),_0x47bda3);}catch(_0x1bbf2a){eventEmitter[_0x3cb5('0x7')](_0x3cb5('0x8'),new AGIError(_0x3cb5('0x9'),_0x1bbf2a));}});module[_0x3cb5('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xbd63=['events','EventEmitter','ioredis','../../config/environment','redis','localhost','emit','error','E_AGI_SERVER_ERROR','message','parse'];(function(_0x4d50b9,_0x200690){var _0x23d6a9=function(_0x602a84){while(--_0x602a84){_0x4d50b9['push'](_0x4d50b9['shift']());}};_0x23d6a9(++_0x200690);}(_0xbd63,0x181));var _0x3bd6=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xbd63[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var EventEmitter=require(_0x3bd6('0x0'))[_0x3bd6('0x1')];var Redis=require(_0x3bd6('0x2'));var AGIError=require('./error');var config=require(_0x3bd6('0x3'));config[_0x3bd6('0x4')]=_['defaults'](config[_0x3bd6('0x4')],{'host':_0x3bd6('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub['subscribe']('agi',function(_0x1cf7dc){if(_0x1cf7dc)return eventEmitter[_0x3bd6('0x6')](_0x3bd6('0x7'),new AGIError(_0x3bd6('0x8'),_0x1cf7dc));});sub['on'](_0x3bd6('0x9'),function(_0x510464,_0x3482bc){if(_0x510464!=='agi')return;try{var _0x29e269=JSON[_0x3bd6('0xa')](_0x3482bc);eventEmitter[_0x3bd6('0x6')]('projectUpdate',_0x29e269);}catch(_0x165606){eventEmitter[_0x3bd6('0x6')](_0x3bd6('0x7'),new AGIError(_0x3bd6('0x8'),_0x165606));}});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 b1fe364..6425050 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 _0x67a4=['condition','split','agicommand','vswitch','default','target','menu','invalid','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','../../../config/logger','getdigits','vertices','edges','prototype','addEdge','push','size','relations','traverseBFS','info','stop\x20traverse','length','no\x20edge/s\x20available'];(function(_0x141578,_0x2b6abd){var _0x5f1d89=function(_0x29bd0e){while(--_0x29bd0e){_0x141578['push'](_0x141578['shift']());}};_0x5f1d89(++_0x2b6abd);}(_0x67a4,0x12a));var _0x467a=function(_0x57f8c0,_0x136cf6){_0x57f8c0=_0x57f8c0-0x0;var _0x117f08=_0x67a4[_0x57f8c0];return _0x117f08;};'use strict';var _=require('lodash');var logger=require(_0x467a('0x0'))('agi');var verticesWithRetry=['menu',_0x467a('0x1'),'getsecretdigits'];var Graph=function(){this[_0x467a('0x2')]={};this[_0x467a('0x3')]={};this['numberOfEdges']=0x0;};Graph[_0x467a('0x4')]['addVertex']=function(_0x5a3029){this[_0x467a('0x2')][_0x5a3029['id']]=_0x5a3029;this['edges'][_0x5a3029['id']]=[];};Graph[_0x467a('0x4')][_0x467a('0x5')]=function(_0x586c17,_0x90ad07,_0x569f21){this[_0x467a('0x3')][_0x586c17][_0x467a('0x6')]({'target':_0x90ad07,'condition':_0x569f21});this['numberOfEdges']+=0x1;};Graph[_0x467a('0x4')][_0x467a('0x7')]=function(){return _['size'](this['vertices']);};Graph['prototype'][_0x467a('0x8')]=function(){return this['numberOfEdges'];};Graph[_0x467a('0x4')]['getVertex']=function(_0x535692){return this['vertices'][_0x535692];};Graph[_0x467a('0x4')][_0x467a('0x9')]=function(_0x5b80c3,_0x4c10a3){if(!this[_0x467a('0x2')][_0x5b80c3]){return logger[_0x467a('0xa')]('no\x20vertex\x20found');}var _0x4a2b14=_0x4c10a3(this[_0x467a('0x2')][_0x5b80c3]);if(!_0x4a2b14){return logger['info'](_0x467a('0xb'));}if(this['edges'][_0x5b80c3][_0x467a('0xc')]===0x0){return logger[_0x467a('0xa')](_0x467a('0xd'));}for(var _0x1994b7=0x0,_0x30d88c=[],_0x501b30=![];_0x1994b7\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','catch','indexOf','agi_','substring','debug','variables','stringify','timeout','evtHangup','hangup','find','handleNotFound','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','then','getAll','finally','./server'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0x00ee,0x13e));var _0xe00e=function(_0x2637ac,_0x377857){_0x2637ac=_0x2637ac-0x0;var _0x4a5758=_0x00ee[_0x2637ac];return _0x4a5758;};'use strict';var _=require(_0xe00e('0x0'));var syncho=require(_0xe00e('0x1'));var util=require(_0xe00e('0x2'));var config=require(_0xe00e('0x3'));var logger=require(_0xe00e('0x4'))('agi');var utilLicense=require(_0xe00e('0x5'));var rpc=require(_0xe00e('0x6'));var Project=require(_0xe00e('0x7'));var AGIEmitter=require(_0xe00e('0x8'))['EventEmitter'];var projects=[];config[_0xe00e('0x9')]=_['defaults'](config['agi'],{'ip':_0xe00e('0xa'),'port':0x11dd});AGIEmitter['on'](_0xe00e('0xb'),projectUpdateHandler);function connectionHandler(_0x3195c2){process[_0xe00e('0xc')](function(){syncho(function(){try{setChannelVariables(_0x3195c2);agiHandler(_0x3195c2);}catch(_0xb8e5ac){logger['error'](_0xb8e5ac[_0xe00e('0xd')]);}});});}function projectUpdateHandler(_0x93d151){try{var _0x239cc1=_[_0xe00e('0xe')](projects,['id',_0x93d151['id']]);if(_0x239cc1>-0x1){if(_0x93d151[_0xe00e('0xf')]===!![]){projects['splice'](_0x239cc1,0x1);}else{projects[_0x239cc1]=_0x93d151;}}else{projects['push'](_0x93d151);}}catch(_0x6f4b2a){logger[_0xe00e('0x10')](_0x6f4b2a[_0xe00e('0xd')]);}}function listeningHandler(){var _0x128d07=config[_0xe00e('0x11')]===_0xe00e('0x12')||![];console[_0xe00e('0x13')](_0xe00e('0x14'),config[_0xe00e('0x9')][_0xe00e('0x15')]);logger[_0xe00e('0x16')](util[_0xe00e('0x17')](_0xe00e('0x18'),_0x128d07?config['agi']['ip']:_0xe00e('0x19'),config[_0xe00e('0x9')]['port']));}function errorHandler(_0x2506da){if(_0x2506da&&_0x2506da[_0xe00e('0x1a')]&&_0x2506da[_0xe00e('0x1b')]){logger['error'](util['format']('[%s]\x20%s',_0x2506da[_0xe00e('0x1a')],_0x2506da[_0xe00e('0x1b')]));}else{logger[_0xe00e('0x10')](util[_0xe00e('0x17')](_0xe00e('0x1c'),_0x2506da[_0xe00e('0xd')]));}}function closeHandler(){logger[_0xe00e('0x16')](util[_0xe00e('0x17')](_0xe00e('0x1d'),this[_0xe00e('0x1e')],this[_0xe00e('0x1f')],this[_0xe00e('0x20')],this[_0xe00e('0x21')],this[_0xe00e('0x22')]));try{createSquareReport(this);}catch(_0x61ccf5){logger[_0xe00e('0x10')](_0x61ccf5[_0xe00e('0xd')]);}}function timeoutHandler(){logger[_0xe00e('0x16')](util[_0xe00e('0x17')](_0xe00e('0x23'),this[_0xe00e('0x1e')],this[_0xe00e('0x1f')],this[_0xe00e('0x20')],this[_0xe00e('0x21')],this['uniqueid']));}function hangupHandler(){logger[_0xe00e('0x16')](util[_0xe00e('0x17')](_0xe00e('0x24'),this[_0xe00e('0x1e')],this[_0xe00e('0x1f')],this[_0xe00e('0x20')],this['dnid'],this['uniqueid']));this['evtHangup']=!![];}function createSquareReport(_0x4bedb7,_0xfc47e7){rpc[_0xe00e('0x25')](_0x4bedb7)['then'](function(_0x178cf6){if(_0xfc47e7){_0xfc47e7(null,_0x178cf6);}})[_0xe00e('0x26')](function(_0xbb03ff){if(_0xfc47e7){_0xfc47e7(null,_0xbb03ff);}});}function setChannelVariables(_0x6c5aff){for(var _0x4dd35d in _0x6c5aff){if(_0x6c5aff['hasOwnProperty'](_0x4dd35d)){if(_0x4dd35d[_0xe00e('0x27')](_0xe00e('0x28'))===0x0){_0x6c5aff[_0x4dd35d[_0xe00e('0x29')](0x4)]=_0x6c5aff[_0x4dd35d];delete _0x6c5aff[_0x4dd35d];}}}}function agiHandler(_0x37cf21){logger[_0xe00e('0x2a')](_0xe00e('0x2b'),JSON[_0xe00e('0x2c')](_0x37cf21,null,0x2));logger[_0xe00e('0x16')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x37cf21[_0xe00e('0x1e')],_0x37cf21['calleridname'],_0x37cf21[_0xe00e('0x20')],_0x37cf21[_0xe00e('0x21')],_0x37cf21['uniqueid']));_0x37cf21['on'](_0xe00e('0x10'),errorHandler);_0x37cf21['on']('close',closeHandler);_0x37cf21['on'](_0xe00e('0x2d'),timeoutHandler);_0x37cf21[_0xe00e('0x2e')]=![];_0x37cf21['on'](_0xe00e('0x2f'),hangupHandler);var _0x1deda7=_[_0xe00e('0x30')](projects,[_0xe00e('0x1a'),_0x37cf21['arg_1']]);if(!_0x1deda7)return Project[_0xe00e('0x31')](_0x37cf21);if(!_0x1deda7[_0xe00e('0x12')])return Project['handleUnpublished'](_0x37cf21);return Project[_0xe00e('0x32')](_0x1deda7,_0x37cf21);}function main(){var _0x21fe23;return utilLicense[_0xe00e('0x33')]()['then'](function(_0x5ec777){if(!_0x5ec777)return;if(_0x5ec777[_0xe00e('0x34')]){if(_0x5ec777[_0xe00e('0x35')]&&_0x5ec777[_0xe00e('0x35')]>0x0){logger[_0xe00e('0x16')](util[_0xe00e('0x17')](_0xe00e('0x36'),_0x5ec777[_0xe00e('0x35')]));_0x21fe23=_0x5ec777[_0xe00e('0x35')];}else{logger['info'](_0xe00e('0x37'));}}else{logger[_0xe00e('0x16')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x21fe23=-0x1;}})[_0xe00e('0x38')](function(){return Project[_0xe00e('0x39')]();})[_0xe00e('0x38')](function(_0x4a3068){projects=_0x4a3068;return;})['catch'](function(_0x130bfe){logger[_0xe00e('0x10')]('[LICENSE]',_0x130bfe[_0xe00e('0xd')]);})[_0xe00e('0x3a')](function(){var _0x161261=require(_0xe00e('0x3b'))(config[_0xe00e('0x9')][_0xe00e('0x15')],config['agi']['ip'],_0x21fe23);_0x161261['on'](_0xe00e('0x10'),errorHandler);_0x161261['on'](_0xe00e('0x3c'),listeningHandler);_0x161261['on'](_0xe00e('0x3d'),connectionHandler);_0x161261['on'](_0xe00e('0x3e'),closeHandler);});}main(); \ No newline at end of file +var _0x9160=['[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','./rpc','./project','./events','agi','defaults','127.0.0.1','nextTick','error','findIndex','deleted','splice','push','stack','env','production','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','format','[ERROR]\x20%s','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','then','catch','hasOwnProperty','indexOf','agi_','debug','variables','arg_1','close','evtHangup','hangup','find','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED'];(function(_0x4ea883,_0x3ca0f4){var _0x1fcccb=function(_0x370f42){while(--_0x370f42){_0x4ea883['push'](_0x4ea883['shift']());}};_0x1fcccb(++_0x3ca0f4);}(_0x9160,0x12d));var _0x0916=function(_0x529c0c,_0x51611f){_0x529c0c=_0x529c0c-0x0;var _0x30b77b=_0x9160[_0x529c0c];return _0x30b77b;};'use strict';var _=require(_0x0916('0x0'));var syncho=require(_0x0916('0x1'));var util=require(_0x0916('0x2'));var config=require(_0x0916('0x3'));var logger=require('../../config/logger')('agi');var utilLicense=require('../../config/license/util');var rpc=require(_0x0916('0x4'));var Project=require(_0x0916('0x5'));var AGIEmitter=require(_0x0916('0x6'))['EventEmitter'];var projects=[];config[_0x0916('0x7')]=_[_0x0916('0x8')](config[_0x0916('0x7')],{'ip':_0x0916('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x4a192f){process[_0x0916('0xa')](function(){syncho(function(){try{setChannelVariables(_0x4a192f);agiHandler(_0x4a192f);}catch(_0xe61cdb){logger[_0x0916('0xb')](_0xe61cdb['stack']);}});});}function projectUpdateHandler(_0x2756d7){try{var _0x120448=_[_0x0916('0xc')](projects,['id',_0x2756d7['id']]);if(_0x120448>-0x1){if(_0x2756d7[_0x0916('0xd')]===!![]){projects[_0x0916('0xe')](_0x120448,0x1);}else{projects[_0x120448]=_0x2756d7;}}else{projects[_0x0916('0xf')](_0x2756d7);}}catch(_0x1a5319){logger[_0x0916('0xb')](_0x1a5319[_0x0916('0x10')]);}}function listeningHandler(){var _0xbef43f=config[_0x0916('0x11')]===_0x0916('0x12')||![];console[_0x0916('0x13')](_0x0916('0x14'),config[_0x0916('0x7')]['port']);logger[_0x0916('0x15')](util['format'](_0x0916('0x16'),_0xbef43f?config[_0x0916('0x7')]['ip']:'host.docker.internal',config[_0x0916('0x7')][_0x0916('0x17')]));}function errorHandler(_0x200ab0){if(_0x200ab0&&_0x200ab0[_0x0916('0x18')]&&_0x200ab0[_0x0916('0x19')]){logger['error'](util[_0x0916('0x1a')]('[%s]\x20%s',_0x200ab0[_0x0916('0x18')],_0x200ab0['message']));}else{logger[_0x0916('0xb')](util[_0x0916('0x1a')](_0x0916('0x1b'),_0x200ab0['stack']));}}function closeHandler(){logger['info'](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x0916('0x1c')],this['callerid'],this[_0x0916('0x1d')],this[_0x0916('0x1e')]));try{createSquareReport(this);}catch(_0x1e363d){logger['error'](_0x1e363d[_0x0916('0x10')]);}}function timeoutHandler(){logger[_0x0916('0x15')](util[_0x0916('0x1a')](_0x0916('0x1f'),this['arg_1'],this[_0x0916('0x1c')],this[_0x0916('0x20')],this[_0x0916('0x1d')],this[_0x0916('0x1e')]));}function hangupHandler(){logger['info'](util['format'](_0x0916('0x21'),this['arg_1'],this[_0x0916('0x1c')],this[_0x0916('0x20')],this[_0x0916('0x1d')],this['uniqueid']));this['evtHangup']=!![];}function createSquareReport(_0x3fb5f9,_0x39b657){rpc['createSquareReport'](_0x3fb5f9)[_0x0916('0x22')](function(_0x21e3e6){if(_0x39b657){_0x39b657(null,_0x21e3e6);}})[_0x0916('0x23')](function(_0x592aa9){if(_0x39b657){_0x39b657(null,_0x592aa9);}});}function setChannelVariables(_0x68531){for(var _0xe62c2d in _0x68531){if(_0x68531[_0x0916('0x24')](_0xe62c2d)){if(_0xe62c2d[_0x0916('0x25')](_0x0916('0x26'))===0x0){_0x68531[_0xe62c2d['substring'](0x4)]=_0x68531[_0xe62c2d];delete _0x68531[_0xe62c2d];}}}}function agiHandler(_0x3813b9){logger[_0x0916('0x27')](_0x0916('0x28'),JSON['stringify'](_0x3813b9,null,0x2));logger[_0x0916('0x15')](util[_0x0916('0x1a')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3813b9[_0x0916('0x29')],_0x3813b9[_0x0916('0x1c')],_0x3813b9[_0x0916('0x20')],_0x3813b9[_0x0916('0x1d')],_0x3813b9[_0x0916('0x1e')]));_0x3813b9['on']('error',errorHandler);_0x3813b9['on'](_0x0916('0x2a'),closeHandler);_0x3813b9['on']('timeout',timeoutHandler);_0x3813b9[_0x0916('0x2b')]=![];_0x3813b9['on'](_0x0916('0x2c'),hangupHandler);var _0x55aa0c=_[_0x0916('0x2d')](projects,[_0x0916('0x18'),_0x3813b9['arg_1']]);if(!_0x55aa0c)return Project['handleNotFound'](_0x3813b9);if(!_0x55aa0c['production'])return Project[_0x0916('0x2e')](_0x3813b9);return Project[_0x0916('0x2f')](_0x55aa0c,_0x3813b9);}function main(){var _0x1f0434;return utilLicense[_0x0916('0x30')]()[_0x0916('0x22')](function(_0x1cc77e){if(!_0x1cc77e)return;if(_0x1cc77e[_0x0916('0x31')]){if(_0x1cc77e[_0x0916('0x32')]&&_0x1cc77e[_0x0916('0x32')]>0x0){logger[_0x0916('0x15')](util[_0x0916('0x1a')](_0x0916('0x33'),_0x1cc77e[_0x0916('0x32')]));_0x1f0434=_0x1cc77e[_0x0916('0x32')];}else{logger[_0x0916('0x15')](_0x0916('0x34'));}}else{logger[_0x0916('0x15')](_0x0916('0x35'));_0x1f0434=-0x1;}})[_0x0916('0x22')](function(){return Project['getAll']();})[_0x0916('0x22')](function(_0x4ab496){projects=_0x4ab496;return;})['catch'](function(_0xcdf0c){logger[_0x0916('0xb')](_0x0916('0x36'),_0xcdf0c[_0x0916('0x10')]);})[_0x0916('0x37')](function(){var _0xc2ffc3=require(_0x0916('0x38'))(config['agi'][_0x0916('0x17')],config['agi']['ip'],_0x1f0434);_0xc2ffc3['on'](_0x0916('0xb'),errorHandler);_0xc2ffc3['on'](_0x0916('0x39'),listeningHandler);_0xc2ffc3['on'](_0x0916('0x3a'),connectionHandler);_0xc2ffc3['on'](_0x0916('0x2a'),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 1834d19..1df82f9 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 _0xb7a1=['client','http','request','then','error','sendMailMessage','jayson/promise'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xb7a1,0xca));var _0x1b7a=function(_0xf059e8,_0x493ff8){_0xf059e8=_0xf059e8-0x0;var _0x52d2f6=_0xb7a1[_0xf059e8];return _0x52d2f6;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x1b7a('0x0'));var client=jayson[_0x1b7a('0x1')][_0x1b7a('0x2')]({'port':0x232b});function request(_0x219cc5,_0x4e319b){return new BPromise(function(_0x41156d,_0x2cd928){return client[_0x1b7a('0x3')](_0x219cc5,_0x4e319b)[_0x1b7a('0x4')](function(_0x4ab269){if(_0x4ab269[_0x1b7a('0x5')]){return _0x2cd928(_0x4ab269[_0x1b7a('0x5')]['message']);}else{return _0x41156d(_0x4ab269['result']);}})['catch'](function(_0x5246ea){return _0x2cd928(_0x5246ea);});});}exports[_0x1b7a('0x6')]=function(_0x5d8632,_0x71b0bd){return request('SendMail',{'account':_0x5d8632,'message':_0x71b0bd});}; \ No newline at end of file +var _0x7677=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','request','then','error'];(function(_0x3cdf09,_0x61b0){var _0x228e6e=function(_0x5e0512){while(--_0x5e0512){_0x3cdf09['push'](_0x3cdf09['shift']());}};_0x228e6e(++_0x61b0);}(_0x7677,0x90));var _0x7767=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7677[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0x7767('0x0'));var jayson=require(_0x7767('0x1'));var client=jayson[_0x7767('0x2')]['http']({'port':0x232b});function request(_0x404e40,_0x5b2aee){return new BPromise(function(_0x4c6ab9,_0x133e59){return client[_0x7767('0x3')](_0x404e40,_0x5b2aee)[_0x7767('0x4')](function(_0x53fe7c){if(_0x53fe7c[_0x7767('0x5')]){return _0x133e59(_0x53fe7c[_0x7767('0x5')]['message']);}else{return _0x4c6ab9(_0x53fe7c[_0x7767('0x6')]);}})[_0x7767('0x7')](function(_0x40383d){return _0x133e59(_0x40383d);});});}exports[_0x7767('0x8')]=function(_0x39f0ed,_0x3985e4){return request(_0x7767('0x9'),{'account':_0x39f0ed,'message':_0x3985e4});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 4e5f28b..9b4cda2 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 _0xf843=['[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','../../config/logger','agi','./rpc','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','length','source','target','toJson','mxGraphModel','inspect','production','start','debug','root','joinAt','format','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','stringify','code','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','finally','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname'];(function(_0x407994,_0xbca781){var _0x153d0a=function(_0x175a35){while(--_0x175a35){_0x407994['push'](_0x407994['shift']());}};_0x153d0a(++_0xbca781);}(_0xf843,0xba));var _0x3f84=function(_0x59cbe0,_0x2444c0){_0x59cbe0=_0x59cbe0-0x0;var _0x1f7c43=_0xf843[_0x59cbe0];return _0x1f7c43;};'use strict';var _=require(_0x3f84('0x0'));var moment=require(_0x3f84('0x1'));var parser=require(_0x3f84('0x2'));var util=require('util');var logger=require(_0x3f84('0x3'))(_0x3f84('0x4'));var rpc=require(_0x3f84('0x5'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x3f84('0x6')]()[_0x3f84('0x7')](function(_0x251b75){logger[_0x3f84('0x8')](_0x3f84('0x9'),_0x251b75[_0x3f84('0xa')]);return[];});}function addVertex(_0x4ed8ee,_0x2ddaa8,_0x2c920c){_0x2ddaa8[_0x3f84('0xb')]=_0x2c920c;if(_0x2ddaa8[_0x3f84('0xc')](_0x3f84('0xd'))){_0x2ddaa8[_0x3f84('0xe')]=parseInt(_0x2ddaa8['retry'],0xa);}_0x4ed8ee[_0x3f84('0xf')](_[_0x3f84('0x10')](_0x2ddaa8,'mxCell'));}function initGraph(_0x55b68d,_0x452022){var _0x4094e3=new Graph();for(var _0x2c33ca in _0x55b68d){if(_0x55b68d[_0x3f84('0xc')](_0x2c33ca)){if(_['isArray'](_0x55b68d[_0x2c33ca])){for(var _0x3effb2=0x0;_0x3effb2<_0x55b68d[_0x2c33ca][_0x3f84('0x11')];_0x3effb2+=0x1){addVertex(_0x4094e3,_0x55b68d[_0x2c33ca][_0x3effb2],_0x2c33ca);}}else{addVertex(_0x4094e3,_0x55b68d[_0x2c33ca],_0x2c33ca);}}}for(var _0x268348=0x0;_0x268348<_0x452022[_0x3f84('0x11')];_0x268348+=0x1){if(_0x452022[_0x268348][_0x3f84('0x12')]&&_0x452022[_0x268348][_0x3f84('0x13')]){_0x4094e3['addEdge'](_0x452022[_0x268348]['source'],_0x452022[_0x268348]['target'],_0x452022[_0x268348]['value']);}}return _0x4094e3;}function getRoot(_0x38e2f5){return parser[_0x3f84('0x14')](_0x38e2f5,{'object':!![]})[_0x3f84('0x15')]['root'];}function inspect(_0x3bacdf){return util[_0x3f84('0x16')](_0x3bacdf,{'showHidden':![],'depth':null});}function initialize(_0x284157,_0xd7ac9d){var _0x458396=getRoot(_0x284157[_0x3f84('0x17')]);if(!_0x458396||!_0x458396[_0x3f84('0x18')])return;var _0xed6563,_0x12c128,_0x26ed3c;logger[_0x3f84('0x19')](_0x3f84('0x1a'),JSON['stringify'](_0x458396,null,0x2));_0xd7ac9d[_0x3f84('0x1b')]=moment()[_0x3f84('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');_0xed6563=initGraph(_[_0x3f84('0x10')](_0x458396,'mxCell'),_0x458396[_0x3f84('0x1d')]);_0x12c128=new Vertices(_0xd7ac9d,rpc,mailRpc);logger[_0x3f84('0x1e')](util['format'](_0x3f84('0x1f'),_0xd7ac9d[_0x3f84('0x20')],_0xd7ac9d['calleridname'],_0xd7ac9d[_0x3f84('0x21')],_0xd7ac9d[_0x3f84('0x22')],_0xd7ac9d[_0x3f84('0x23')]));_0xed6563['traverseBFS'](_0x458396[_0x3f84('0x18')]['id'],function(_0x264d02){try{_0x264d02=_0x12c128[_0x3f84('0x24')](_0x264d02);logger[_0x3f84('0x19')]('vertex',JSON['stringify'](_0x264d02,null,0x2));if(_0x264d02[_0x3f84('0xb')]===_0x3f84('0x25')){logger[_0x3f84('0x1e')](_0x3f84('0x26'));_0xd7ac9d[_0x3f84('0x27')]=_0x264d02[_0x3f84('0x27')]||_0xd7ac9d[_0x3f84('0x27')];_0xd7ac9d[_0x3f84('0x28')]=_0x264d02[_0x3f84('0x28')];_0xd7ac9d[_0x3f84('0x29')]=_0x264d02['priority']?_0x264d02[_0x3f84('0x29')]-0x1:0x1;return null;}else if(_0x264d02&&_0x12c128[_0x264d02[_0x3f84('0xb')]]){_0x26ed3c=_0x12c128[_0x264d02[_0x3f84('0xb')]](_0x264d02);logger[_0x3f84('0x1e')](_0x3f84('0x2a'),JSON[_0x3f84('0x2b')](_0x26ed3c,null,0x2));if(_0x26ed3c&&_0x26ed3c[_0x3f84('0x2c')]===AGI_CODE_SUCCESS&&_0x26ed3c[_0x3f84('0x2d')]!==AGI_RESULT_ERROR&&!_0xd7ac9d[_0x3f84('0x2e')]){logger['debug'](_0x3f84('0x2a'),inspect(_0x26ed3c));return _[_0x3f84('0x2f')](_0x26ed3c[_0x3f84('0x2d')])?null:_0x26ed3c[_0x3f84('0x2d')][_0x3f84('0x30')]();}else{logger[_0x3f84('0x8')](_0x3f84('0x2a'),inspect(_0x26ed3c));return null;}}else{logger['error'](_0x3f84('0x31'));return null;}}catch(_0x4b0cf4){logger[_0x3f84('0x8')](_0x4b0cf4[_0x3f84('0xa')]);return null;}});if(_0x458396[_0x3f84('0x32')]){logger[_0x3f84('0x1e')](util[_0x3f84('0x1c')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xd7ac9d[_0x3f84('0x20')],_0xd7ac9d['calleridname'],_0xd7ac9d['callerid'],_0xd7ac9d[_0x3f84('0x22')],_0xd7ac9d[_0x3f84('0x23')]));_0xed6563['traverseBFS'](_0x458396[_0x3f84('0x32')]['id'],function(_0x35c19f){try{_0x35c19f=_0x12c128[_0x3f84('0x24')](_0x35c19f);logger['debug'](_0x3f84('0x33'),JSON[_0x3f84('0x2b')](_0x35c19f,null,0x2));if(_0x35c19f&&_0x12c128[_0x35c19f['agicommand']]){_0x26ed3c=_0x12c128[_0x35c19f[_0x3f84('0xb')]](_0x35c19f);if(_0x26ed3c){logger[_0x3f84('0x19')]('response',inspect(_0x26ed3c));return _['isUndefined'](_0x26ed3c[_0x3f84('0x2d')])?null:_0x26ed3c[_0x3f84('0x2d')][_0x3f84('0x30')]();}else{logger[_0x3f84('0x8')]('response',inspect(_0x26ed3c));return null;}}else{logger[_0x3f84('0x8')](_0x3f84('0x31'));return null;}}catch(_0xf4cfad){logger['error'](_0xf4cfad[_0x3f84('0xa')]);return null;}});}logger['info'](util[_0x3f84('0x1c')](_0x3f84('0x34'),_0xd7ac9d['arg_1'],_0xd7ac9d[_0x3f84('0x35')],_0xd7ac9d[_0x3f84('0x21')],_0xd7ac9d['dnid'],_0xd7ac9d[_0x3f84('0x23')]));logger['info'](util[_0x3f84('0x1c')](_0x3f84('0x36'),_0xd7ac9d[_0x3f84('0x27')],_0xd7ac9d[_0x3f84('0x28')],parseInt(_0xd7ac9d[_0x3f84('0x29')],0xa)+0x1));_0xd7ac9d[_0x3f84('0x37')](_0xd7ac9d[_0x3f84('0x27')],_0xd7ac9d[_0x3f84('0x28')],parseInt(_0xd7ac9d[_0x3f84('0x29')],0xa)+0x1);_0xd7ac9d[_0x3f84('0x38')]();}function handleNotFound(_0x44d820){logger[_0x3f84('0x8')](util[_0x3f84('0x1c')](_0x3f84('0x39'),_0x44d820['arg_1']));_0x44d820[_0x3f84('0x37')](_0x44d820[_0x3f84('0x27')],_0x44d820[_0x3f84('0x28')],parseInt(_0x44d820[_0x3f84('0x29')],0xa)+0x1);_0x44d820[_0x3f84('0x38')]();}function handleUnpublished(_0x25bb5f){logger['error'](util['format'](_0x3f84('0x3a'),_0x25bb5f[_0x3f84('0x20')]));_0x25bb5f[_0x3f84('0x37')](_0x25bb5f['context'],_0x25bb5f[_0x3f84('0x28')],parseInt(_0x25bb5f['priority'],0xa)+0x1);_0x25bb5f[_0x3f84('0x38')]();}module[_0x3f84('0x3b')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x1955=['moment','util','./mailRpc','./graph','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','addVertex','omit','hasOwnProperty','isArray','length','target','source','value','toJson','mxGraphModel','inspect','start','debug','root','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','arg_1','calleridname','callerid','dnid','traverseBFS','clear','vertex','gotoc','info','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','finally','uniqueid','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1955,0x187));var _0x5195=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x1955[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x5195('0x0'));var moment=require(_0x5195('0x1'));var parser=require('xml2json');var util=require(_0x5195('0x2'));var logger=require('../../config/logger')('agi');var rpc=require('./rpc');var mailRpc=require(_0x5195('0x3'));var Graph=require(_0x5195('0x4'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x5195('0x5')]()['catch'](function(_0x34e349){logger[_0x5195('0x6')](_0x5195('0x7'),_0x34e349[_0x5195('0x8')]);return[];});}function addVertex(_0x49ae65,_0x358178,_0x1b3816){_0x358178[_0x5195('0x9')]=_0x1b3816;if(_0x358178['hasOwnProperty'](_0x5195('0xa'))){_0x358178['maxRetry']=parseInt(_0x358178[_0x5195('0xa')],0xa);}_0x49ae65[_0x5195('0xb')](_[_0x5195('0xc')](_0x358178,'mxCell'));}function initGraph(_0x55ef3e,_0x373105){var _0x745ea6=new Graph();for(var _0x1e5184 in _0x55ef3e){if(_0x55ef3e[_0x5195('0xd')](_0x1e5184)){if(_[_0x5195('0xe')](_0x55ef3e[_0x1e5184])){for(var _0x1dc622=0x0;_0x1dc622<_0x55ef3e[_0x1e5184][_0x5195('0xf')];_0x1dc622+=0x1){addVertex(_0x745ea6,_0x55ef3e[_0x1e5184][_0x1dc622],_0x1e5184);}}else{addVertex(_0x745ea6,_0x55ef3e[_0x1e5184],_0x1e5184);}}}for(var _0x44aa9d=0x0;_0x44aa9d<_0x373105['length'];_0x44aa9d+=0x1){if(_0x373105[_0x44aa9d]['source']&&_0x373105[_0x44aa9d][_0x5195('0x10')]){_0x745ea6['addEdge'](_0x373105[_0x44aa9d][_0x5195('0x11')],_0x373105[_0x44aa9d]['target'],_0x373105[_0x44aa9d][_0x5195('0x12')]);}}return _0x745ea6;}function getRoot(_0x324ab7){return parser[_0x5195('0x13')](_0x324ab7,{'object':!![]})[_0x5195('0x14')]['root'];}function inspect(_0x488ee2){return util[_0x5195('0x15')](_0x488ee2,{'showHidden':![],'depth':null});}function initialize(_0x262bc6,_0x348910){var _0x49f2be=getRoot(_0x262bc6['production']);if(!_0x49f2be||!_0x49f2be[_0x5195('0x16')])return;var _0x17dd91,_0x7d343d,_0x43ae94;logger[_0x5195('0x17')](_0x5195('0x18'),JSON[_0x5195('0x19')](_0x49f2be,null,0x2));_0x348910[_0x5195('0x1a')]=moment()[_0x5195('0x1b')](_0x5195('0x1c'));_0x17dd91=initGraph(_[_0x5195('0xc')](_0x49f2be,_0x5195('0x1d')),_0x49f2be[_0x5195('0x1d')]);_0x7d343d=new Vertices(_0x348910,rpc,mailRpc);logger['info'](util[_0x5195('0x1b')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x348910[_0x5195('0x1e')],_0x348910[_0x5195('0x1f')],_0x348910[_0x5195('0x20')],_0x348910[_0x5195('0x21')],_0x348910['uniqueid']));_0x17dd91[_0x5195('0x22')](_0x49f2be[_0x5195('0x16')]['id'],function(_0x20bab0){try{_0x20bab0=_0x7d343d[_0x5195('0x23')](_0x20bab0);logger['debug'](_0x5195('0x24'),JSON[_0x5195('0x19')](_0x20bab0,null,0x2));if(_0x20bab0[_0x5195('0x9')]===_0x5195('0x25')){logger[_0x5195('0x26')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x348910['context']=_0x20bab0['context']||_0x348910[_0x5195('0x27')];_0x348910[_0x5195('0x28')]=_0x20bab0[_0x5195('0x28')];_0x348910['priority']=_0x20bab0[_0x5195('0x29')]?_0x20bab0[_0x5195('0x29')]-0x1:0x1;return null;}else if(_0x20bab0&&_0x7d343d[_0x20bab0[_0x5195('0x9')]]){_0x43ae94=_0x7d343d[_0x20bab0['agicommand']](_0x20bab0);logger[_0x5195('0x26')](_0x5195('0x2a'),JSON[_0x5195('0x19')](_0x43ae94,null,0x2));if(_0x43ae94&&_0x43ae94[_0x5195('0x2b')]===AGI_CODE_SUCCESS&&_0x43ae94[_0x5195('0x2c')]!==AGI_RESULT_ERROR&&!_0x348910[_0x5195('0x2d')]){logger['debug']('response',inspect(_0x43ae94));return _[_0x5195('0x2e')](_0x43ae94[_0x5195('0x2c')])?null:_0x43ae94['result'][_0x5195('0x2f')]();}else{logger['error'](_0x5195('0x2a'),inspect(_0x43ae94));return null;}}else{logger[_0x5195('0x6')]('agicommand\x20not\x20found');return null;}}catch(_0x5f4ae2){logger[_0x5195('0x6')](_0x5f4ae2[_0x5195('0x8')]);return null;}});if(_0x49f2be[_0x5195('0x30')]){logger['info'](util[_0x5195('0x1b')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x348910[_0x5195('0x1e')],_0x348910[_0x5195('0x1f')],_0x348910[_0x5195('0x20')],_0x348910[_0x5195('0x21')],_0x348910[_0x5195('0x31')]));_0x17dd91[_0x5195('0x22')](_0x49f2be['finally']['id'],function(_0x1362f4){try{_0x1362f4=_0x7d343d['clear'](_0x1362f4);logger['debug'](_0x5195('0x24'),JSON[_0x5195('0x19')](_0x1362f4,null,0x2));if(_0x1362f4&&_0x7d343d[_0x1362f4[_0x5195('0x9')]]){_0x43ae94=_0x7d343d[_0x1362f4['agicommand']](_0x1362f4);if(_0x43ae94){logger[_0x5195('0x17')](_0x5195('0x2a'),inspect(_0x43ae94));return _[_0x5195('0x2e')](_0x43ae94[_0x5195('0x2c')])?null:_0x43ae94[_0x5195('0x2c')][_0x5195('0x2f')]();}else{logger[_0x5195('0x6')](_0x5195('0x2a'),inspect(_0x43ae94));return null;}}else{logger[_0x5195('0x6')](_0x5195('0x32'));return null;}}catch(_0x4aee94){logger['error'](_0x4aee94[_0x5195('0x8')]);return null;}});}logger['info'](util[_0x5195('0x1b')](_0x5195('0x33'),_0x348910[_0x5195('0x1e')],_0x348910[_0x5195('0x1f')],_0x348910['callerid'],_0x348910[_0x5195('0x21')],_0x348910['uniqueid']));logger[_0x5195('0x26')](util[_0x5195('0x1b')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x348910[_0x5195('0x27')],_0x348910['extension'],parseInt(_0x348910[_0x5195('0x29')],0xa)+0x1));_0x348910[_0x5195('0x34')](_0x348910['context'],_0x348910[_0x5195('0x28')],parseInt(_0x348910['priority'],0xa)+0x1);_0x348910[_0x5195('0x35')]();}function handleNotFound(_0x5849dd){logger[_0x5195('0x6')](util[_0x5195('0x1b')](_0x5195('0x36'),_0x5849dd['arg_1']));_0x5849dd['continueAt'](_0x5849dd[_0x5195('0x27')],_0x5849dd['extension'],parseInt(_0x5849dd[_0x5195('0x29')],0xa)+0x1);_0x5849dd[_0x5195('0x35')]();}function handleUnpublished(_0x51f933){logger[_0x5195('0x6')](util[_0x5195('0x1b')](_0x5195('0x37'),_0x51f933[_0x5195('0x1e')]));_0x51f933[_0x5195('0x34')](_0x51f933[_0x5195('0x27')],_0x51f933[_0x5195('0x28')],parseInt(_0x51f933[_0x5195('0x29')],0xa)+0x1);_0x51f933['close']();}module['exports']={'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 3230a4e..ab8b354 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 _0xe499=['inherits','prototype','_localBuffer','toString','indexOf','substring','length','split','slice','trim','emit','headers','exports','util','stream','Transform','_inBody'];(function(_0x43cd0d,_0x281947){var _0x4118e1=function(_0x5184f0){while(--_0x5184f0){_0x43cd0d['push'](_0x43cd0d['shift']());}};_0x4118e1(++_0x281947);}(_0xe499,0xfb));var _0x9e49=function(_0xd13cad,_0xea397a){_0xd13cad=_0xd13cad-0x0;var _0xc744f2=_0xe499[_0xd13cad];return _0xc744f2;};'use strict';var util=require(_0x9e49('0x0'));var Transform=require(_0x9e49('0x1'))[_0x9e49('0x2')];function AGIReply(_0x29dd8d){Transform['call'](this,_0x29dd8d);this['_localBuffer']='';this[_0x9e49('0x3')]=![];}util[_0x9e49('0x4')](AGIReply,Transform);AGIReply[_0x9e49('0x5')]['_transform']=function(_0x4a6dea,_0x1b1a54,_0x312b96){var _0x57603a='\x0a',_0x454174=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x322e9e=-0x1,_0x1034e9=-0x1,_0x13bf1e='',_0x97d4ce=0x0,_0x3c30ef='',_0x5e40f7='';this[_0x9e49('0x6')]+=_0x4a6dea[_0x9e49('0x7')]();_0x3c30ef=this[_0x9e49('0x6')];if(!this['_inBody']){_0x97d4ce=0x0;while(_0x454174[_0x97d4ce]){while((_0x1034e9=_0x3c30ef[_0x9e49('0x8')](_0x454174[_0x97d4ce]))!=-0x1){_0x13bf1e=_0x454174[_0x97d4ce];_0x5e40f7=_0x3c30ef[_0x9e49('0x9')](0x0,_0x1034e9);_0x3c30ef=_0x3c30ef[_0x9e49('0x9')](_0x1034e9+_0x13bf1e[_0x9e49('0xa')]);var _0x5ca3fc=_0x5e40f7[_0x9e49('0xb')](_0x57603a),_0x419269=0x0,_0x1b74e0={},_0x38ddd4='',_0x45127f='',_0x4b73d6=-0x1;while(_0x5ca3fc[_0x419269]){_0x4b73d6=_0x5ca3fc[_0x419269][_0x9e49('0x8')](':');if(_0x4b73d6!=-0x1){_0x38ddd4=_0x5ca3fc[_0x419269][_0x9e49('0xc')](0x0,_0x4b73d6)[_0x9e49('0xd')]();_0x45127f=_0x5ca3fc[_0x419269]['slice'](_0x4b73d6+0x1)[_0x9e49('0xd')]();if(_0x38ddd4[_0x9e49('0xa')]>0x0){_0x1b74e0[_0x38ddd4]=_0x45127f;}}else{}_0x419269++;}this[_0x9e49('0xe')](_0x9e49('0xf'),_0x1b74e0);this[_0x9e49('0x3')]=!![];}_0x97d4ce++;}this[_0x9e49('0x6')]=_0x3c30ef;}else{while((_0x322e9e=_0x3c30ef[_0x9e49('0x8')](_0x57603a))!=-0x1){_0x5e40f7=_0x3c30ef[_0x9e49('0x9')](0x0,_0x322e9e);this[_0x9e49('0xe')]('line',_0x5e40f7);_0x3c30ef=_0x3c30ef[_0x9e49('0x9')](_0x322e9e+_0x57603a[_0x9e49('0xa')]);}this[_0x9e49('0x6')]=_0x3c30ef;}_0x312b96();};module[_0x9e49('0x10')]=AGIReply; \ No newline at end of file +var _0x0f94=['call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','trim','length','line','exports','util','stream','Transform'];(function(_0x2a7201,_0x4c0925){var _0x23c86a=function(_0x243338){while(--_0x243338){_0x2a7201['push'](_0x2a7201['shift']());}};_0x23c86a(++_0x4c0925);}(_0x0f94,0x1ad));var _0x40f9=function(_0x5b843a,_0x253f9d){_0x5b843a=_0x5b843a-0x0;var _0x141291=_0x0f94[_0x5b843a];return _0x141291;};'use strict';var util=require(_0x40f9('0x0'));var Transform=require(_0x40f9('0x1'))[_0x40f9('0x2')];function AGIReply(_0x416b38){Transform[_0x40f9('0x3')](this,_0x416b38);this[_0x40f9('0x4')]='';this[_0x40f9('0x5')]=![];}util[_0x40f9('0x6')](AGIReply,Transform);AGIReply[_0x40f9('0x7')][_0x40f9('0x8')]=function(_0x11d234,_0x55460f,_0x1f5c24){var _0x4cfc57='\x0a',_0x293bcf=['\x0a\x0a',_0x40f9('0x9')],_0x2e127c=-0x1,_0x4a062d=-0x1,_0x2c844d='',_0x56a350=0x0,_0x5b7e7d='',_0x2cbe11='';this[_0x40f9('0x4')]+=_0x11d234['toString']();_0x5b7e7d=this['_localBuffer'];if(!this[_0x40f9('0x5')]){_0x56a350=0x0;while(_0x293bcf[_0x56a350]){while((_0x4a062d=_0x5b7e7d[_0x40f9('0xa')](_0x293bcf[_0x56a350]))!=-0x1){_0x2c844d=_0x293bcf[_0x56a350];_0x2cbe11=_0x5b7e7d['substring'](0x0,_0x4a062d);_0x5b7e7d=_0x5b7e7d[_0x40f9('0xb')](_0x4a062d+_0x2c844d['length']);var _0x1517c7=_0x2cbe11['split'](_0x4cfc57),_0x10b289=0x0,_0x537ac6={},_0x3418ed='',_0x48c074='',_0x888bcd=-0x1;while(_0x1517c7[_0x10b289]){_0x888bcd=_0x1517c7[_0x10b289][_0x40f9('0xa')](':');if(_0x888bcd!=-0x1){_0x3418ed=_0x1517c7[_0x10b289]['slice'](0x0,_0x888bcd)['trim']();_0x48c074=_0x1517c7[_0x10b289]['slice'](_0x888bcd+0x1)[_0x40f9('0xc')]();if(_0x3418ed[_0x40f9('0xd')]>0x0){_0x537ac6[_0x3418ed]=_0x48c074;}}else{}_0x10b289++;}this['emit']('headers',_0x537ac6);this['_inBody']=!![];}_0x56a350++;}this[_0x40f9('0x4')]=_0x5b7e7d;}else{while((_0x2e127c=_0x5b7e7d['indexOf'](_0x4cfc57))!=-0x1){_0x2cbe11=_0x5b7e7d['substring'](0x0,_0x2e127c);this['emit'](_0x40f9('0xe'),_0x2cbe11);_0x5b7e7d=_0x5b7e7d[_0x40f9('0xb')](_0x2e127c+_0x4cfc57[_0x40f9('0xd')]);}this[_0x40f9('0x4')]=_0x5b7e7d;}_0x1f5c24();};module[_0x40f9('0xf')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 7bed1ac..c500eae 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 _0xc6ab=['GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','Intervals','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','then','error','message','result','catch','name','production','ShowSquareProject','ShowMailAccount','MailServerOut','CloudProvider','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone'];(function(_0x1ad96f,_0x4c8d0f){var _0x5b22b8=function(_0x19d01f){while(--_0x19d01f){_0x1ad96f['push'](_0x1ad96f['shift']());}};_0x5b22b8(++_0x4c8d0f);}(_0xc6ab,0x96));var _0xbc6a=function(_0x3dfb3c,_0x14f865){_0x3dfb3c=_0x3dfb3c-0x0;var _0x2cfd77=_0xc6ab[_0x3dfb3c];return _0x2cfd77;};'use strict';var _=require(_0xbc6a('0x0'));var moment=require(_0xbc6a('0x1'));var jayson=require(_0xbc6a('0x2'));var client=jayson[_0xbc6a('0x3')][_0xbc6a('0x4')]({'port':0x2329});function request(_0x4fd8be,_0x59baa9){return new Promise(function(_0xbf9d02,_0x1c351c){return client[_0xbc6a('0x5')](_0x4fd8be,_0x59baa9)[_0xbc6a('0x6')](function(_0x2767db){if(_0x2767db['error']){return _0x1c351c(_0x2767db[_0xbc6a('0x7')][_0xbc6a('0x8')]);}else{return _0xbf9d02(_0x2767db[_0xbc6a('0x9')]);}})[_0xbc6a('0xa')](function(_0x2f7f5f){return _0x1c351c(_0x2f7f5f);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xbc6a('0xb'),_0xbc6a('0xc')]}});};exports['getSquareProject']=function(_0x4d22b2){return request(_0xbc6a('0xd'),{'options':{'raw':![],'where':{'name':_0x4d22b2},'attributes':[_0xbc6a('0xc')]}});};exports['getMailAccountById']=function(_0xc35a59){return request(_0xbc6a('0xe'),{'options':{'raw':![],'where':{'id':_0xc35a59},'include':[{'model':_0xbc6a('0xf'),'as':'Smtp','include':[{'model':_0xbc6a('0x10'),'as':_0xbc6a('0x10')}]}],'attributes':['id',_0xbc6a('0xb'),_0xbc6a('0x11')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x5a38b2){return request('ShowSquareProject',{'options':{'where':{'id':_0x5a38b2},'attributes':[_0xbc6a('0xb')]}});};exports[_0xbc6a('0x12')]=function(_0x48d94a){return request(_0xbc6a('0x13'),{'options':{'where':{'id':_0x48d94a},'attributes':['name']}});};exports[_0xbc6a('0x14')]=function(_0x4d92aa){return request(_0xbc6a('0x15'),{'options':{'where':{'id':_0x4d92aa},'attributes':[_0xbc6a('0xb')]}});};exports[_0xbc6a('0x16')]=function(_0x3de8f5){return request(_0xbc6a('0x17'),{'options':{'where':{'id':_0x3de8f5},'attributes':[_0xbc6a('0x18')]}});};exports[_0xbc6a('0x19')]=function(_0x55134c){return request('ShowUser',{'options':{'where':{'id':_0x55134c},'attributes':[_0xbc6a('0xb')]}});};exports[_0xbc6a('0x1a')]=function(_0x369a78){return request(_0xbc6a('0x1b'),{'options':{'where':{'phone':_0x369a78[_0xbc6a('0x1c')]},'attributes':['id']}});};exports[_0xbc6a('0x1d')]=function(_0x4518df){return request(_0xbc6a('0x1e'),{'options':{'where':{'id':_0x4518df},'attributes':[_0xbc6a('0xb')]}});};exports[_0xbc6a('0x1f')]=function(_0x2df25d){return request(_0xbc6a('0x20'),{'options':{'where':{'id':_0x2df25d},'attributes':[_0xbc6a('0x21')]}});};exports['getIntervalById']=function(_0x21ab33){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x21ab33},'include':[{'model':'Interval','as':_0xbc6a('0x22')}]}});};exports['getSmsAccountById']=function(_0x2dc407){return request('ShowSmsAccount',{'options':{'where':{'id':_0x2dc407},'attributes':['id',_0xbc6a('0xb')]}});};exports['createSmsMessage']=function(_0xeaa12d){return request(_0xbc6a('0x23'),{'body':_0xeaa12d});};exports[_0xbc6a('0x24')]=function(_0x17daf3){return request(_0xbc6a('0x25'),{'body':_0x17daf3});};exports[_0xbc6a('0x26')]=function(_0x3d1cbd){return request(_0xbc6a('0x27'),{'body':_[_0xbc6a('0x28')](_0x3d1cbd,{'project_name':_0x3d1cbd[_0xbc6a('0x29')],'prev_project_name':_0x3d1cbd['arg_2']||'','is_subproject':_0x3d1cbd[_0xbc6a('0x2a')]?!![]:![],'leaveAt':moment()[_0xbc6a('0x2b')](_0xbc6a('0x2c'))})});};exports[_0xbc6a('0x2d')]=function(_0x30176f){return request('CreateSquareRecording',{'body':_0x30176f});};exports[_0xbc6a('0x2e')]=function(_0x43fa4a){return request(_0xbc6a('0x2f'),{'body':_0x43fa4a});};exports[_0xbc6a('0x30')]=function(_0x4356c1){return request(_0xbc6a('0x31'),{'options':{'raw':![],'where':{'phone':_0x4356c1[_0xbc6a('0x1c')],'ListId':_0x4356c1[_0xbc6a('0x32')]}}})[_0xbc6a('0x6')](function(_0x5745cd){if(_0x5745cd){return _0x5745cd;}return request(_0xbc6a('0x33'),{'body':_0x4356c1});});};exports['getPauseById']=function(_0x491480){return request('ShowPause',{'options':{'where':{'id':_0x491480},'attributes':['name']}});};exports['agentLogin']=function(_0x54ad91,_0x4b230a){return request(_0xbc6a('0x34'),{'body':{'interface':_0x4b230a},'options':{'where':_0x54ad91}});};exports[_0xbc6a('0x35')]=function(_0x54fb9d,_0x3954a4,_0x2e8a55){return request(_0xbc6a('0x36'),{'body':{'type':_0x3954a4,'uniqueid':_0x2e8a55},'options':{'where':_0x54fb9d}});};exports[_0xbc6a('0x37')]=function(_0x18494f){return request(_0xbc6a('0x38'),{'body':{},'options':{'where':_0x18494f}});};exports[_0xbc6a('0x39')]=function(_0x82f720){return request(_0xbc6a('0x3a'),{'body':{},'options':{'where':_0x82f720}});}; \ No newline at end of file +var _0x7a2d=['getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','getSoundById','save_name','ShowInterval','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','agentUnpause','UnpauseUser','lodash','moment','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable'];(function(_0x23d0af,_0x50d8d3){var _0x3c6f98=function(_0x3a0674){while(--_0x3a0674){_0x23d0af['push'](_0x23d0af['shift']());}};_0x3c6f98(++_0x50d8d3);}(_0x7a2d,0x142));var _0xd7a2=function(_0x4c08f4,_0x4db005){_0x4c08f4=_0x4c08f4-0x0;var _0x2a7fae=_0x7a2d[_0x4c08f4];return _0x2a7fae;};'use strict';var _=require(_0xd7a2('0x0'));var moment=require(_0xd7a2('0x1'));var jayson=require(_0xd7a2('0x2'));var client=jayson[_0xd7a2('0x3')][_0xd7a2('0x4')]({'port':0x2329});function request(_0x1edb4e,_0x31dd61){return new Promise(function(_0x4b5379,_0x500472){return client[_0xd7a2('0x5')](_0x1edb4e,_0x31dd61)[_0xd7a2('0x6')](function(_0x3a8474){if(_0x3a8474[_0xd7a2('0x7')]){return _0x500472(_0x3a8474['error'][_0xd7a2('0x8')]);}else{return _0x4b5379(_0x3a8474[_0xd7a2('0x9')]);}})[_0xd7a2('0xa')](function(_0x69f732){return _0x500472(_0x69f732);});});}exports[_0xd7a2('0xb')]=function(){return request(_0xd7a2('0xc'),{'options':{'raw':![],'attributes':['id',_0xd7a2('0xd'),_0xd7a2('0xe')]}});};exports[_0xd7a2('0xf')]=function(_0x503b42){return request(_0xd7a2('0x10'),{'options':{'raw':![],'where':{'name':_0x503b42},'attributes':[_0xd7a2('0xe')]}});};exports[_0xd7a2('0x11')]=function(_0x83f5f7){return request(_0xd7a2('0x12'),{'options':{'raw':![],'where':{'id':_0x83f5f7},'include':[{'model':_0xd7a2('0x13'),'as':_0xd7a2('0x14'),'include':[{'model':'CloudProvider','as':'CloudProvider'}]}],'attributes':['id',_0xd7a2('0xd'),'email'],'smtp':!![]}});};exports[_0xd7a2('0x15')]=function(_0x240d7d){return request(_0xd7a2('0x10'),{'options':{'where':{'id':_0x240d7d},'attributes':[_0xd7a2('0xd')]}});};exports[_0xd7a2('0x16')]=function(_0x37f995){return request(_0xd7a2('0x17'),{'options':{'where':{'id':_0x37f995},'attributes':[_0xd7a2('0xd')]}});};exports[_0xd7a2('0x18')]=function(_0x16e2d6){return request(_0xd7a2('0x19'),{'options':{'where':{'id':_0x16e2d6},'attributes':['name']}});};exports[_0xd7a2('0x1a')]=function(_0x4c66ef){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x4c66ef},'attributes':[_0xd7a2('0x1b')]}});};exports[_0xd7a2('0x1c')]=function(_0x2e8c80){return request(_0xd7a2('0x1d'),{'options':{'where':{'id':_0x2e8c80},'attributes':[_0xd7a2('0xd')]}});};exports[_0xd7a2('0x1e')]=function(_0x510caa){return request('GetContactByPhone',{'options':{'where':{'phone':_0x510caa[_0xd7a2('0x1f')]},'attributes':['id']}});};exports[_0xd7a2('0x20')]=function(_0x2653b1){return request('ShowTrunk',{'options':{'where':{'id':_0x2653b1},'attributes':['name']}});};exports[_0xd7a2('0x21')]=function(_0x5d455b){return request('ShowSound',{'options':{'where':{'id':_0x5d455b},'attributes':[_0xd7a2('0x22')]}});};exports['getIntervalById']=function(_0x5b50d9){return request(_0xd7a2('0x23'),{'options':{'raw':![],'where':{'id':_0x5b50d9},'include':[{'model':'Interval','as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x21da02){return request(_0xd7a2('0x24'),{'options':{'where':{'id':_0x21da02},'attributes':['id',_0xd7a2('0xd')]}});};exports[_0xd7a2('0x25')]=function(_0x2b17ca){return request(_0xd7a2('0x26'),{'body':_0x2b17ca});};exports[_0xd7a2('0x27')]=function(_0x2e3ac6){return request(_0xd7a2('0x28'),{'body':_0x2e3ac6});};exports[_0xd7a2('0x29')]=function(_0x2575e2){return request(_0xd7a2('0x2a'),{'body':_[_0xd7a2('0x2b')](_0x2575e2,{'project_name':_0x2575e2['arg_1'],'prev_project_name':_0x2575e2['arg_2']||'','is_subproject':_0x2575e2[_0xd7a2('0x2c')]?!![]:![],'leaveAt':moment()['format'](_0xd7a2('0x2d'))})});};exports['createSquareRecording']=function(_0x1b2caa){return request(_0xd7a2('0x2e'),{'body':_0x1b2caa});};exports[_0xd7a2('0x2f')]=function(_0x243df9){return request(_0xd7a2('0x30'),{'body':_0x243df9});};exports[_0xd7a2('0x31')]=function(_0x1a69e4){return request(_0xd7a2('0x32'),{'options':{'raw':![],'where':{'phone':_0x1a69e4[_0xd7a2('0x1f')],'ListId':_0x1a69e4[_0xd7a2('0x33')]}}})[_0xd7a2('0x6')](function(_0x37a24c){if(_0x37a24c){return _0x37a24c;}return request(_0xd7a2('0x34'),{'body':_0x1a69e4});});};exports[_0xd7a2('0x35')]=function(_0x13f3d2){return request('ShowPause',{'options':{'where':{'id':_0x13f3d2},'attributes':[_0xd7a2('0xd')]}});};exports[_0xd7a2('0x36')]=function(_0x530c55,_0x1bef0f){return request(_0xd7a2('0x37'),{'body':{'interface':_0x1bef0f},'options':{'where':_0x530c55}});};exports['agentPause']=function(_0x33fe22,_0x2ccdd5,_0x2bbe05){return request('PauseUser',{'body':{'type':_0x2ccdd5,'uniqueid':_0x2bbe05},'options':{'where':_0x33fe22}});};exports[_0xd7a2('0x38')]=function(_0x62fc6c){return request(_0xd7a2('0x39'),{'body':{},'options':{'where':_0x62fc6c}});};exports['agentLogout']=function(_0x3d77db){return request('LogoutUser',{'body':{},'options':{'where':_0x3d77db}});}; \ 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 727c347..f809b85 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 _0x8d0a=['exports','./polly','./lex'];(function(_0x5f3905,_0x43a651){var _0x2923b1=function(_0x3c72d8){while(--_0x3c72d8){_0x5f3905['push'](_0x5f3905['shift']());}};_0x2923b1(++_0x43a651);}(_0x8d0a,0x172));var _0xa8d0=function(_0x1c475c,_0x2a6c1a){_0x1c475c=_0x1c475c-0x0;var _0xddb17d=_0x8d0a[_0x1c475c];return _0xddb17d;};var polly=require(_0xa8d0('0x0'));var lex=require(_0xa8d0('0x1'));module[_0xa8d0('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xf611=['exports','./lex'];(function(_0x50576c,_0x502d9c){var _0x22c1ef=function(_0x4067e7){while(--_0x4067e7){_0x50576c['push'](_0x50576c['shift']());}};_0x22c1ef(++_0x502d9c);}(_0xf611,0x7b));var _0x1f61=function(_0x2db29c,_0xdfad2c){_0x2db29c=_0x2db29c-0x0;var _0x54a99c=_0xf611[_0x2db29c];return _0x54a99c;};var polly=require('./polly');var lex=require(_0x1f61('0x0'));module[_0x1f61('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 3704f0c..495f36f 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 _0x4ea3=['./lib/api','exports'];(function(_0x74de41,_0x1b3732){var _0x5c1fd=function(_0x43dd3a){while(--_0x43dd3a){_0x74de41['push'](_0x74de41['shift']());}};_0x5c1fd(++_0x1b3732);}(_0x4ea3,0x70));var _0x34ea=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4ea3[_0x5b644e];return _0x49c6bf;};'use strict';var lex=require(_0x34ea('0x0'));module[_0x34ea('0x1')]=function(_0x324f65,_0x3ab582,_0x588172,_0x374ec1,_0x494b56,_0x269d4c){return lex(_0x324f65,_0x3ab582,_0x588172,_0x374ec1,_0x494b56,_0x269d4c);}; \ No newline at end of file +var _0xaa88=['exports','./lib/api'];(function(_0x14c9cc,_0x816fb5){var _0x423490=function(_0x46cb07){while(--_0x46cb07){_0x14c9cc['push'](_0x14c9cc['shift']());}};_0x423490(++_0x816fb5);}(_0xaa88,0x137));var _0x8aa8=function(_0x47604d,_0x15a014){_0x47604d=_0x47604d-0x0;var _0x388e4c=_0xaa88[_0x47604d];return _0x388e4c;};'use strict';var lex=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]=function(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4){return lex(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4);}; \ 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 113a8a3..caf3282 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(_0x3dc120,_0x273be7){var _0x20793b=function(_0x2ec8a8){while(--_0x2ec8a8){_0x3dc120['push'](_0x3dc120['shift']());}};_0x20793b(++_0x273be7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0x14859b,_0x48f876){var _0x15d7f2=function(_0x2c2604){while(--_0x2c2604){_0x14859b['push'](_0x14859b['shift']());}};_0x15d7f2(++_0x48f876);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 adb8493..e021f2d 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 _0x576e=['./lib/api'];(function(_0x33e5d1,_0x15c13f){var _0x1ded82=function(_0x38abab){while(--_0x38abab){_0x33e5d1['push'](_0x33e5d1['shift']());}};_0x1ded82(++_0x15c13f);}(_0x576e,0x111));var _0xe576=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x576e[_0x4a7631];return _0x1a5a6f;};'use strict';var polly=require(_0xe576('0x0'));module['exports']=function(_0x40577f,_0x4c510c,_0x331074,_0x2791ff,_0x390449,_0x27076e,_0x14c5e9){return polly(_0x40577f,_0x4c510c,_0x331074,_0x2791ff,_0x390449,_0x27076e,_0x14c5e9);}; \ No newline at end of file +var _0xb8cc=['exports','./lib/api'];(function(_0x2b6268,_0x53acef){var _0x4ad50e=function(_0x11c3f7){while(--_0x11c3f7){_0x2b6268['push'](_0x2b6268['shift']());}};_0x4ad50e(++_0x53acef);}(_0xb8cc,0x83));var _0xcb8c=function(_0x5c5cbd,_0x3800d6){_0x5c5cbd=_0x5c5cbd-0x0;var _0x2f9bfc=_0xb8cc[_0x5c5cbd];return _0x2f9bfc;};'use strict';var polly=require(_0xcb8c('0x0'));module[_0xcb8c('0x1')]=function(_0x5f77be,_0x21c04f,_0x4bb314,_0x3a7a1e,_0x5707f8,_0x37bfcc,_0x3e51a3){return polly(_0x5f77be,_0x21c04f,_0x4bb314,_0x3a7a1e,_0x5707f8,_0x37bfcc,_0x3e51a3);}; \ 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 10feb10..53a07b9 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 _0x676c=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x57f1a9,_0x1349fc){var _0x10f4fa=function(_0x3a40f1){while(--_0x3a40f1){_0x57f1a9['push'](_0x57f1a9['shift']());}};_0x10f4fa(++_0x1349fc);}(_0x676c,0x160));var _0xc676=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x676c[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0xc676('0x0'));var BPromise=require(_0xc676('0x1'));var rs=require(_0xc676('0x2'));var AWS=require(_0xc676('0x3'));function pollyResult(_0x553423,_0xa8467a,_0x3e9494){return new BPromise(function(_0x47df7a,_0x48e471){_0x553423[_0xc676('0x4')](_0xa8467a,function(_0x23e5bd,_0x4cb418){if(_0x23e5bd){_0x48e471(_0x23e5bd);}else if(_0x4cb418){if(_0x4cb418[_0xc676('0x5')]instanceof Buffer){fs[_0xc676('0x6')](_0x3e9494,_0x4cb418[_0xc676('0x5')],function(_0x1c225c){if(_0x1c225c){_0x48e471(_0x1c225c);}else{_0x47df7a();}});}else{_0x48e471(new Error(_0xc676('0x7')));}}else{_0x48e471(new Error(_0xc676('0x8')));}});});}module[_0xc676('0x9')]=function(_0x43f952,_0x5a849e,_0x39028a,_0x5d73dd,_0xb65b3f,_0xed2cd8,_0x27e453){var _0x180387=new AWS[(_0xc676('0xa'))]({'accessKeyId':_0x43f952,'secretAccessKey':_0x5a849e,'region':_0x39028a});var _0x24c564={'Text':_0xb65b3f,'TextType':_0xed2cd8||_0xc676('0xb'),'OutputFormat':'mp3','VoiceId':_0x5d73dd};return pollyResult(_0x180387,_0x24c564,_0x27e453);}; \ No newline at end of file +var _0x37ee=['AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile'];(function(_0x350343,_0x256f69){var _0x9afc1c=function(_0x47ab32){while(--_0x47ab32){_0x350343['push'](_0x350343['shift']());}};_0x9afc1c(++_0x256f69);}(_0x37ee,0x186));var _0xe37e=function(_0x2eff63,_0x11e38e){_0x2eff63=_0x2eff63-0x0;var _0x4db274=_0x37ee[_0x2eff63];return _0x4db274;};'use strict';var fs=require('fs');var path=require(_0xe37e('0x0'));var BPromise=require(_0xe37e('0x1'));var rs=require(_0xe37e('0x2'));var AWS=require(_0xe37e('0x3'));function pollyResult(_0x51bc17,_0x45eede,_0x523504){return new BPromise(function(_0x4eaa22,_0x2603a6){_0x51bc17[_0xe37e('0x4')](_0x45eede,function(_0xade9ad,_0x19a9aa){if(_0xade9ad){_0x2603a6(_0xade9ad);}else if(_0x19a9aa){if(_0x19a9aa['AudioStream']instanceof Buffer){fs[_0xe37e('0x5')](_0x523504,_0x19a9aa[_0xe37e('0x6')],function(_0x4544da){if(_0x4544da){_0x2603a6(_0x4544da);}else{_0x4eaa22();}});}else{_0x2603a6(new Error(_0xe37e('0x7')));}}else{_0x2603a6(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xe37e('0x8')]=function(_0x495c40,_0x453a2d,_0x20be56,_0x147546,_0x58c413,_0x244b1a,_0x155346){var _0x966b83=new AWS[(_0xe37e('0x9'))]({'accessKeyId':_0x495c40,'secretAccessKey':_0x453a2d,'region':_0x20be56});var _0x3124c5={'Text':_0x58c413,'TextType':_0x244b1a||_0xe37e('0xa'),'OutputFormat':_0xe37e('0xb'),'VoiceId':_0x147546};return pollyResult(_0x966b83,_0x3124c5,_0x155346);}; \ 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 be5fbb1..be52046 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83d9=['exports'];(function(_0x2f30ee,_0x2b6ff4){var _0x52b5f1=function(_0x31a403){while(--_0x31a403){_0x2f30ee['push'](_0x2f30ee['shift']());}};_0x52b5f1(++_0x2b6ff4);}(_0x83d9,0xf1));var _0x983d=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x83d9[_0x38a7ac];return _0x53061a;};'use strict';var asr=require('./lib/api');module[_0x983d('0x0')]=function(_0x494ca0,_0x21c22f,_0x45acda,_0x23a1b9){return asr(_0x494ca0,_0x21c22f,_0x45acda);}; \ No newline at end of file +var _0xa47f=['exports'];(function(_0x516f53,_0x45a4d9){var _0x56d276=function(_0x80d840){while(--_0x80d840){_0x516f53['push'](_0x516f53['shift']());}};_0x56d276(++_0x45a4d9);}(_0xa47f,0x9d));var _0xfa47=function(_0x3e5ddc,_0x2fa39d){_0x3e5ddc=_0x3e5ddc-0x0;var _0x653eea=_0xa47f[_0x3e5ddc];return _0x653eea;};'use strict';var asr=require('./lib/api');module[_0xfa47('0x0')]=function(_0x55fdad,_0x1da19d,_0x49ecf3,_0x4c6322){return asr(_0x55fdad,_0x1da19d,_0x49ecf3);}; \ 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 086250a..94a0b70 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 _0x2504=['base64','POST','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','undefined','lang\x20should\x20be\x20a\x20string','readFileSync'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x2504,0xee));var _0x4250=function(_0x26594f,_0x24a6da){_0x26594f=_0x26594f-0x0;var _0x39639f=_0x2504[_0x26594f];return _0x39639f;};'use strict';var url=require(_0x4250('0x0'));var BPromise=require(_0x4250('0x1'));var fs=require('fs');var host=_0x4250('0x2');module[_0x4250('0x3')]=function(_0x307ca9,_0x67c47b,_0x41d71d){return new BPromise(function(_0x320d79,_0x17d2d8){var _0xc31f3a;if(typeof _0x307ca9!==_0x4250('0x4')||_0x307ca9[_0x4250('0x5')]===0x0){return _0x17d2d8('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x67c47b!==_0x4250('0x4')||_0x67c47b['length']===0x0){return _0x17d2d8('key\x20should\x20be\x20a\x20string');}if(typeof _0x41d71d!==_0x4250('0x6')&&(typeof _0x41d71d!==_0x4250('0x4')||_0x41d71d[_0x4250('0x5')]===0x0)){return _0x17d2d8(_0x4250('0x7'));}try{_0xc31f3a=fs[_0x4250('0x8')](_0x307ca9)['toString'](_0x4250('0x9'));}catch(_0x49bf26){return _0x17d2d8(_0x49bf26);}return _0x320d79({'method':_0x4250('0xa'),'uri':host+_0x4250('0xb')+_0x67c47b,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x4250('0xc'),'languageCode':_0x41d71d},'audio':{'content':_0xc31f3a}},'json':!![]});});}; \ No newline at end of file +var _0x7dc2=['readFileSync','toString','/v1/speech:recognize?key=','LINEAR16','8000','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x526f48,_0x4cec86){var _0x9167b=function(_0x391d8a){while(--_0x391d8a){_0x526f48['push'](_0x526f48['shift']());}};_0x9167b(++_0x4cec86);}(_0x7dc2,0x19d));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x27dc('0x0');module[_0x27dc('0x1')]=function(_0x49a9e7,_0x426f56,_0x57d4b4){return new BPromise(function(_0x15d70c,_0x29ba23){var _0x52337b;if(typeof _0x49a9e7!==_0x27dc('0x2')||_0x49a9e7[_0x27dc('0x3')]===0x0){return _0x29ba23('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x426f56!==_0x27dc('0x2')||_0x426f56['length']===0x0){return _0x29ba23(_0x27dc('0x4'));}if(typeof _0x57d4b4!==_0x27dc('0x5')&&(typeof _0x57d4b4!=='string'||_0x57d4b4[_0x27dc('0x3')]===0x0)){return _0x29ba23(_0x27dc('0x6'));}try{_0x52337b=fs[_0x27dc('0x7')](_0x49a9e7)[_0x27dc('0x8')]('base64');}catch(_0x1d93ef){return _0x29ba23(_0x1d93ef);}return _0x15d70c({'method':'POST','uri':host+_0x27dc('0x9')+_0x426f56,'body':{'config':{'encoding':_0x27dc('0xa'),'sampleRateHertz':_0x27dc('0xb'),'languageCode':_0x57d4b4},'audio':{'content':_0x52337b}},'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 9c7d57f..3f1ae51 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 _0xe7db=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe7db,0x112));var _0xbe7d=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0xe7db[_0x249e96];return _0x17444c;};var asr=require('./asr');module[_0xbe7d('0x0')]={'asr':asr}; \ No newline at end of file +var _0x3d6b=['./asr','exports'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0x3d6b,0xbc));var _0xb3d6=function(_0x3e0191,_0x1d4b20){_0x3e0191=_0x3e0191-0x0;var _0xf2ae83=_0x3d6b[_0x3e0191];return _0xf2ae83;};var asr=require(_0xb3d6('0x0'));module[_0xb3d6('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 863f6bd..566676e 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 _0x46e0=['text:synthesize','.mp3','from','audioContent','writeFile','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','POST','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','map','alternatives','transcript','results','confidence','join','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','fulfillment','speech','score','status','code','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','tildeASR','asr','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','request-promise','randomstring','sox','google-tts-api','url','util','./aws','./google','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','path','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','statusCode','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','host','WHAT_EVER','data','transcode','wav','error\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','voice','audioConfig','MP3'];(function(_0x3833fd,_0x3d4f6a){var _0x111c26=function(_0x703aa8){while(--_0x703aa8){_0x3833fd['push'](_0x3833fd['shift']());}};_0x111c26(++_0x3d4f6a);}(_0x46e0,0xdb));var _0x046e=function(_0x3d673b,_0x48fb71){_0x3d673b=_0x3d673b-0x0;var _0x400e07=_0x46e0[_0x3d673b];return _0x400e07;};'use strict';var apiai=require(_0x046e('0x0'));var BPromise=require(_0x046e('0x1'));var dialogflow=require(_0x046e('0x2'));var fs=require('fs');var http=require(_0x046e('0x3'));var https=require(_0x046e('0x4'));var md5=require(_0x046e('0x5'));var path=require('path');var querystring=require('querystring');var rp=require(_0x046e('0x6'));var rs=require(_0x046e('0x7'));var sox=require(_0x046e('0x8'));var tts=require(_0x046e('0x9'));var urlParse=require(_0x046e('0xa'))['parse'];var util=require(_0x046e('0xb'));var aws=require(_0x046e('0xc'));var google=require(_0x046e('0xd'));var sestek=require('./sestek');var tilde=require(_0x046e('0xe'));var logger=require('../../../config/logger')(_0x046e('0xf'));var ISPEECH_API=_0x046e('0x10');function downloadFile(_0x332e84,_0x50f47e){return new BPromise(function(_0x320840,_0x321289){var _0x27dacc=urlParse(_0x332e84);var _0x2837da=_0x27dacc[_0x046e('0x11')]===_0x046e('0x12')?https:http;var _0x16617a={'host':_0x27dacc['host'],'path':_0x27dacc[_0x046e('0x13')],'headers':{'user-agent':'WHAT_EVER'}};_0x2837da[_0x046e('0x14')](_0x16617a,function(_0x5dfcdb){if(_0x5dfcdb['statusCode']!==0xc8){logger[_0x046e('0x15')](_0x046e('0x16')+_0x332e84+_0x046e('0x17')+_0x5dfcdb['statusCode']+'\x20('+_0x5dfcdb[_0x046e('0x18')]+')');_0x321289(new Error(_0x046e('0x16')+_0x332e84+_0x046e('0x17')+_0x5dfcdb[_0x046e('0x19')]+'\x20('+_0x5dfcdb[_0x046e('0x18')]+')'));return;}var _0x324291=fs['createWriteStream'](_0x50f47e);_0x324291['on'](_0x046e('0x1a'),function(){logger[_0x046e('0x1b')](_0x046e('0x1c'));_0x324291[_0x046e('0x1d')](_0x320840);});_0x324291['on']('error',function(_0xf88744){fs[_0x046e('0x1e')](_0x50f47e);logger[_0x046e('0x15')](_0x046e('0x1f'),_0xf88744);_0x321289(_0xf88744);});_0x5dfcdb[_0x046e('0x20')](_0x324291);})['on'](_0x046e('0x15'),function(_0x5bee46){logger['error'](_0x5bee46);_0x321289(_0x5bee46);})[_0x046e('0x21')]();});}function uploadFile(_0x27cc35){return new BPromise(function(_0x55e22a,_0x1b974b){var _0x32de04=urlParse(_0x27cc35);var _0x8477c0=_0x32de04[_0x046e('0x11')]===_0x046e('0x12')?https:http;var _0x304476={'host':_0x32de04[_0x046e('0x22')],'path':_0x32de04[_0x046e('0x13')],'headers':{'user-agent':_0x046e('0x23')}};_0x8477c0[_0x046e('0x14')](_0x304476,function(_0x49153a){if(_0x49153a[_0x046e('0x19')]!==0xc8){_0x1b974b(new Error('request\x20to\x20'+_0x27cc35+_0x046e('0x17')+_0x49153a[_0x046e('0x19')]+'\x20('+_0x49153a[_0x046e('0x18')]+')'));return;}var _0x3bc815='';_0x49153a['on'](_0x046e('0x24'),function(_0x1596b9){_0x3bc815+=_0x1596b9;});_0x49153a['on'](_0x046e('0x21'),function(){_0x55e22a(_0x3bc815);});})['on'](_0x046e('0x15'),function(_0x281bbb){_0x1b974b(_0x281bbb);})[_0x046e('0x21')]();});}function convertFile(_0x27844b,_0x441712){return new BPromise(function(_0x39d787,_0x47f596){var _0x1af6ff=sox[_0x046e('0x25')](_0x27844b,_0x441712,{'sampleRate':0x1f40,'format':_0x046e('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1af6ff['on']('error',function(_0xf29ba2){logger[_0x046e('0x15')](_0x046e('0x27'),_0xf29ba2);_0x47f596(_0xf29ba2);});_0x1af6ff['on'](_0x046e('0x21'),function(){logger['info']('finish\x20to\x20convert');_0x39d787();});_0x1af6ff[_0x046e('0x28')]();});}function base64Decode(_0x3260d0,_0x152c98){var _0x5d4e53=path[_0x046e('0x29')](__dirname,_0x046e('0x2a'),rs[_0x046e('0x2b')](0x4)+_0x046e('0x2c'));fs['writeFileSync'](_0x5d4e53,_0x3260d0,_0x046e('0x2d'));return convertFile(_0x5d4e53,_0x152c98)[_0x046e('0x2e')](function(){try{fs['unlink'](_0x5d4e53);fs[_0x046e('0x2f')](_0x152c98,_0x046e('0x30'));}catch(_0x45a5d5){logger[_0x046e('0x15')](_0x45a5d5);}return _0x152c98[_0x046e('0x31')]('.')[0x0];});}function base64Encode(_0x30d960){var _0x1c7e43=fs[_0x046e('0x32')](_0x30d960);return new Buffer(_0x1c7e43)[_0x046e('0x33')](_0x046e('0x2d'));}exports[_0x046e('0x34')]=function(_0x5ecbe1,_0x2fe046,_0x30c997,_0x362a2,_0x44ba02,_0x378d35){var _0x3c231e,_0x1aecba;var _0x346e58=_0x046e('0x35');var _0x130f56=_0x046e('0x36')+_0x5ecbe1;var _0x53bc82={};if(_0x2fe046===_0x046e('0x37')){_0x53bc82['input']={'ssml':_0x30c997};}else{_0x53bc82['input']={'text':_0x30c997};};_0x53bc82[_0x046e('0x38')]={'languageCode':_0x362a2,'ssmlGender':_0x44ba02};_0x53bc82[_0x046e('0x39')]={'audioEncoding':_0x046e('0x3a'),'sampleRateHertz':0x1f40};var _0x2fd919={'url':_0x346e58+_0x046e('0x3b')+_0x130f56,'method':'POST','json':!![],'body':_0x53bc82};return rp(_0x2fd919)[_0x046e('0x2e')](function(_0x404fbb){return new BPromise(function(_0x58dad9,_0x4c7892){_0x3c231e=path[_0x046e('0x29')](__dirname,_0x046e('0x2a'),rs[_0x046e('0x2b')](0x4)+_0x046e('0x3c'));var _0x26b382=Buffer[_0x046e('0x3d')](_0x404fbb[_0x046e('0x3e')],_0x046e('0x2d'));return fs[_0x046e('0x3f')](_0x3c231e,_0x26b382,function(_0x961f80){_0x4c7892(_0x961f80);},function(_0x3d128a){fs[_0x046e('0x2f')](_0x3c231e,_0x046e('0x30'));_0x58dad9(_0x3d128a);});});})[_0x046e('0x2e')](function(_0x1d8ccd){_0x1aecba=path[_0x046e('0x29')](__dirname,_0x046e('0x2a'),rs[_0x046e('0x2b')](0x4)+'.wav');return convertFile(_0x3c231e,_0x1aecba);})[_0x046e('0x2e')](function(){try{fs[_0x046e('0x1e')](_0x3c231e);fs[_0x046e('0x2f')](_0x1aecba,_0x046e('0x30'));}catch(_0x3bb065){logger[_0x046e('0x15')](_0x3bb065);}logger[_0x046e('0x1b')]('googleCloudTTS\x20path',_0x1aecba[_0x046e('0x31')]('.')[0x0]);return _0x1aecba['split']('.')[0x0];});};exports['googleTTS']=function(_0x5dc55a,_0x1a05c6){var _0x7083e4=_0x046e('0x40');var _0x527820,_0xf24d18;var _0x2a325e;var _0x33d01a={'encoding':'utf8','method':_0x046e('0x41'),'timeout':0x2710,'url':_0x7083e4,'headers':{'Content-Type':_0x046e('0x42')},'body':_0x046e('0x43')+encodeURIComponent(JSON[_0x046e('0x44')]([[['jQ1olc',JSON['stringify']([_0x5dc55a,_0x1a05c6||'en',![],_0x046e('0x45')]),null,_0x046e('0x46')]]]))};return rp(_0x33d01a)['then'](function(_0x30a1f7){try{_0x2a325e=eval(_0x30a1f7[_0x046e('0x47')](0x5))[0x0][0x2];}catch(_0x19ef43){throw new Error(_0x046e('0x48')+_0x30a1f7[_0x046e('0x24')]);}if(!_0x2a325e){if(_0x5dc55a[_0x046e('0x49')]>0xc8){throw new Error(_0x046e('0x4a'));}else{throw new Error(_0x046e('0x4b')+_0x1a05c6+_0x046e('0x4c'));}}try{_0x2a325e=eval(_0x2a325e)[0x0];}catch(_0x1c1666){throw new Error(_0x046e('0x48')+res[_0x046e('0x24')]);}const _0x11a6f9=_0x2a325e;_0x527820=path[_0x046e('0x29')](__dirname,_0x046e('0x2a'),rs['generate'](0x4)+'.mp3');fs['writeFileSync'](_0x527820,_0x2a325e,{'encoding':_0x046e('0x2d')});_0xf24d18=path[_0x046e('0x29')](__dirname,'tmp',rs[_0x046e('0x2b')](0x4)+_0x046e('0x2c'));return convertFile(_0x527820,_0xf24d18);})[_0x046e('0x2e')](function(){try{fs[_0x046e('0x1e')](_0x527820);fs[_0x046e('0x2f')](_0xf24d18,_0x046e('0x30'));}catch(_0x1fed82){logger['error'](_0x1fed82);}logger[_0x046e('0x1b')](_0x046e('0x4d'),_0xf24d18['split']('.')[0x0]);return _0xf24d18['split']('.')[0x0];});};exports[_0x046e('0x4e')]=function(_0x50a1bf,_0x43d4e6,_0x4948f8){return google['asr'](_0x50a1bf,_0x43d4e6,_0x4948f8)[_0x046e('0x2e')](function(_0x478066){logger[_0x046e('0x1b')](_0x478066['uri']);return rp(_0x478066);})[_0x046e('0x2e')](function(_0x46830b){var _0x56c586='';var _0x56a64c=0x0;try{fs[_0x046e('0x1e')](_0x50a1bf);}catch(_0x3db9ce){logger[_0x046e('0x15')](_0x3db9ce);}if(_0x46830b&&_0x46830b['results']){_0x56c586=_0x46830b['results'][_0x046e('0x4f')](function(_0x1154b8){return _0x1154b8&&_0x1154b8[_0x046e('0x50')][0x0]&&_0x1154b8[_0x046e('0x50')][0x0][_0x046e('0x51')]?_0x1154b8[_0x046e('0x50')][0x0][_0x046e('0x51')]:'';})['join']('\x0a');_0x56a64c=_0x46830b[_0x046e('0x52')][_0x046e('0x4f')](function(_0x264046){return _0x264046&&_0x264046[_0x046e('0x50')][0x0]&&_0x264046['alternatives'][0x0][_0x046e('0x53')]?_0x264046[_0x046e('0x50')][0x0][_0x046e('0x53')]:0x0;})[_0x046e('0x54')]('\x0a');}logger[_0x046e('0x1b')]('googleASR\x20transcription',_0x56c586);logger[_0x046e('0x1b')]('googleASR\x20confidence',_0x56a64c);return{'transcript':_0x56c586,'confidence':_0x56a64c};})[_0x046e('0x55')](function(_0x4d863b){logger[_0x046e('0x15')](_0x046e('0x56'),_0x4d863b[_0x046e('0x19')],_0x4d863b[_0x046e('0x57')],_0x4d863b[_0x046e('0x58')]);});};exports[_0x046e('0x59')]=function(_0x25ece0,_0x45330a,_0x23c6ca,_0x1157dc){var _0x4bacd3=apiai(_0x45330a,{'language':_0x1157dc||'en'});return _0x4bacd3[_0x046e('0x5a')](_0x23c6ca,{'sessionId':md5(_0x25ece0)})['then'](function(_0x4d1ff2){logger[_0x046e('0x1b')](JSON[_0x046e('0x44')](_0x4d1ff2));return{'source':_0x4d1ff2['result'][_0x046e('0x5b')],'resolvedQuery':_0x4d1ff2[_0x046e('0x5c')][_0x046e('0x5d')],'action':_0x4d1ff2[_0x046e('0x5c')][_0x046e('0x5e')],'actionIncomplete':_0x4d1ff2['result']['actionIncomplete'],'speech':_0x4d1ff2[_0x046e('0x5c')][_0x046e('0x5f')][_0x046e('0x60')],'score':_0x4d1ff2[_0x046e('0x5c')][_0x046e('0x61')],'statusCode':_0x4d1ff2[_0x046e('0x62')][_0x046e('0x63')],'endConversation':_0x4d1ff2[_0x046e('0x5c')]['metadata'][_0x046e('0x64')]||![],'isFallbackIntent':_0x4d1ff2[_0x046e('0x5c')]['metadata'][_0x046e('0x65')]};});};exports[_0x046e('0x66')]=function(_0x37ec41,_0x4cce52,_0x4b9853,_0x49adde,_0x5f6626,_0x4d7764){var _0x293d1d=_0x49adde[_0x046e('0x67')](/\\n/g,'\x0a');var _0x864046={'credentials':{'private_key':_0x293d1d,'client_email':_0x4b9853}};var _0x1ab029=new dialogflow[(_0x046e('0x68'))](_0x864046);var _0x3d7af6=_0x1ab029[_0x046e('0x69')](_0x4cce52,md5(_0x37ec41));var _0xf429a1={'session':_0x3d7af6,'queryInput':{'text':{'text':_0x5f6626,'languageCode':_0x4d7764}}};return _0x1ab029['detectIntent'](_0xf429a1)[_0x046e('0x2e')](function(_0xd3607b){if(_0xd3607b&&_0xd3607b[_0x046e('0x49')]){logger[_0x046e('0x1b')](_0x046e('0x6a'),JSON[_0x046e('0x44')](_0xd3607b));var _0x43bcba=_0xd3607b[0x0];if(_0x43bcba){var _0x6d32c3={'action':_0x43bcba[_0x046e('0x6b')][_0x046e('0x5e')],'allRequiredParamsPresent':_0x43bcba[_0x046e('0x6b')]['allRequiredParamsPresent'],'endConversation':_0x43bcba[_0x046e('0x6b')][_0x046e('0x6c')]&&_0x43bcba[_0x046e('0x6b')][_0x046e('0x6c')][_0x046e('0x6d')]?_0x43bcba[_0x046e('0x6b')]['diagnosticInfo'][_0x046e('0x6d')][_0x046e('0x6e')][_0x046e('0x6f')]:![],'fulfillmentText':_0x43bcba[_0x046e('0x6b')][_0x046e('0x70')],'intentName':_0x43bcba[_0x046e('0x6b')]['intent'][_0x046e('0x57')],'intentDisplayName':_0x43bcba['queryResult'][_0x046e('0x71')][_0x046e('0x72')],'isFallbackIntent':_0x43bcba[_0x046e('0x6b')][_0x046e('0x71')]['isFallback'],'languageCode':_0x43bcba[_0x046e('0x6b')][_0x046e('0x73')],'queryText':_0x43bcba[_0x046e('0x6b')][_0x046e('0x74')],'responseId':_0x43bcba[_0x046e('0x75')],'score':_0x43bcba[_0x046e('0x6b')]['intentDetectionConfidence'],'speech':_0x43bcba['queryResult'][_0x046e('0x70')],'providerResponse':JSON[_0x046e('0x44')](_0xd3607b)};return _0x6d32c3;}}});};exports[_0x046e('0x76')]=function(_0x1e1db8,_0x5c7901,_0x43fafc,_0x500e78){return tilde[_0x046e('0x77')](_0x1e1db8,_0x5c7901,_0x43fafc,_0x500e78)[_0x046e('0x2e')](function(_0x34d1d8){try{fs[_0x046e('0x1e')](_0x1e1db8);}catch(_0x16bd2d){logger[_0x046e('0x15')](_0x16bd2d);}logger[_0x046e('0x1b')]('Tilde\x20ASR\x20transcription',_0x34d1d8[_0x046e('0x51')]);logger[_0x046e('0x1b')](_0x046e('0x78'),_0x34d1d8['confidence']);return _0x34d1d8;});};exports[_0x046e('0x79')]=function(_0x128dcc,_0x7b359a,_0x140008,_0x4500c3,_0x2f0c53,_0x132013){var _0x553bb4=path['resolve'](__dirname,'tmp',rs[_0x046e('0x2b')](0x4)+_0x046e('0x3c'));var _0x2f9a4a;return aws[_0x046e('0x7a')](_0x128dcc,_0x7b359a,_0x140008,_0x4500c3,_0x2f0c53,_0x132013,_0x553bb4)[_0x046e('0x2e')](function(){_0x2f9a4a=path[_0x046e('0x29')](__dirname,_0x046e('0x2a'),rs[_0x046e('0x2b')](0x4)+'.wav');return convertFile(_0x553bb4,_0x2f9a4a);})[_0x046e('0x2e')](function(){try{fs['unlink'](_0x553bb4);fs['chmodSync'](_0x2f9a4a,'777');}catch(_0x2a7ce3){logger[_0x046e('0x15')](_0x2a7ce3);}return _0x2f9a4a['split']('.')[0x0];});};exports['awsLex']=function(_0x142903,_0x3b30aa,_0xf92c72,_0x1441a1,_0x373bbc,_0xa8a563){return aws[_0x046e('0x7b')](_0x142903,_0x3b30aa,_0xf92c72,_0x1441a1,_0x373bbc,_0xa8a563)[_0x046e('0x2e')](function(_0x4f6285){logger['info'](JSON['stringify'](_0x4f6285));return _0x4f6285;});};exports['ispeechTTS']=function(_0x24f60c,_0x49b5f2,_0x37bf15,_0x322765){var _0x37c6fe=util[_0x046e('0x7c')](_0x046e('0x7d'),ISPEECH_API,_0x24f60c,encodeURIComponent(_0x49b5f2),_0x37bf15,_0x322765);var _0x6d3c4e=path[_0x046e('0x29')](__dirname,'tmp',rs[_0x046e('0x2b')](0x4)+'.mp3');var _0x18f07b;return downloadFile(_0x37c6fe,_0x6d3c4e)[_0x046e('0x2e')](function(){_0x18f07b=path[_0x046e('0x29')](__dirname,_0x046e('0x2a'),rs['generate'](0x4)+'.wav');return convertFile(_0x6d3c4e,_0x18f07b);})[_0x046e('0x2e')](function(){try{fs[_0x046e('0x1e')](_0x6d3c4e);fs[_0x046e('0x2f')](_0x18f07b,'777');}catch(_0x39ad9a){logger['error'](_0x39ad9a);}return _0x18f07b[_0x046e('0x31')]('.')[0x0];});};exports[_0x046e('0x7e')]=function(_0x1119d2,_0x2142e4,_0x3428ba,_0x5101db){var _0x2c7029=util[_0x046e('0x7c')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x2142e4,_0x3428ba,base64Encode(_0x1119d2),_0x5101db?util[_0x046e('0x7c')](_0x046e('0x7f'),encodeURIComponent(_0x5101db)):_0x046e('0x80'));return uploadFile(_0x2c7029)[_0x046e('0x2e')](function(_0x52f075){return querystring[_0x046e('0x81')](_0x52f075);});};exports[_0x046e('0x82')]=function(_0x424e53,_0x2987b8){return sestek[_0x046e('0x83')](_0x424e53,_0x2987b8)[_0x046e('0x2e')](function(_0x3a2bda){logger[_0x046e('0x1b')](JSON['stringify'](_0x3a2bda));var _0x577a08={'speech':_0x3a2bda[_0x046e('0x84')],'action':_0x3a2bda[_0x046e('0x85')]?_0x3a2bda[_0x046e('0x85')][_0x046e('0x86')]:undefined,'actiondata':_0x3a2bda[_0x046e('0x85')]?_0x3a2bda[_0x046e('0x85')][_0x046e('0x87')]:undefined};if(_0x3a2bda[_0x046e('0x85')]&&_0x3a2bda[_0x046e('0x85')]['AudioFromTts']){return base64Decode(_0x3a2bda[_0x046e('0x85')][_0x046e('0x88')]['Data'],path[_0x046e('0x29')](__dirname,_0x046e('0x2a'),rs[_0x046e('0x2b')](0x4)+_0x046e('0x2c')))[_0x046e('0x2e')](function(_0x4b3e9e){_0x577a08[_0x046e('0x89')]=_0x4b3e9e;return _0x577a08;});}return _0x577a08;});};exports[_0x046e('0x8a')]=function(){return __dirname;}; \ No newline at end of file +var _0x4dee=['MP3','text:synthesize','POST','then','.mp3','from','writeFile','chmodSync','googleCloudTTS\x20path','split','utf8','f.req=','stringify','jQ1olc','null','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','querystring','request-promise','randomstring','sox','url','parse','util','./aws','./sestek','protocol','https:','path','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','host','WHAT_EVER','statusMessage','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','777','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4dee,0x172));var _0xe4de=function(_0x27bc3d,_0x2bf405){_0x27bc3d=_0x27bc3d-0x0;var _0x495cf0=_0x4dee[_0x27bc3d];return _0x495cf0;};'use strict';var apiai=require(_0xe4de('0x0'));var BPromise=require(_0xe4de('0x1'));var dialogflow=require(_0xe4de('0x2'));var fs=require('fs');var http=require(_0xe4de('0x3'));var https=require(_0xe4de('0x4'));var md5=require(_0xe4de('0x5'));var path=require('path');var querystring=require(_0xe4de('0x6'));var rp=require(_0xe4de('0x7'));var rs=require(_0xe4de('0x8'));var sox=require(_0xe4de('0x9'));var tts=require('google-tts-api');var urlParse=require(_0xe4de('0xa'))[_0xe4de('0xb')];var util=require(_0xe4de('0xc'));var aws=require(_0xe4de('0xd'));var google=require('./google');var sestek=require(_0xe4de('0xe'));var tilde=require('./tilde');var logger=require('../../../config/logger')('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x33998c,_0x31189b){return new BPromise(function(_0x129c13,_0x2ed279){var _0x503824=urlParse(_0x33998c);var _0x52b748=_0x503824[_0xe4de('0xf')]===_0xe4de('0x10')?https:http;var _0x2f7636={'host':_0x503824['host'],'path':_0x503824[_0xe4de('0x11')],'headers':{'user-agent':'WHAT_EVER'}};_0x52b748[_0xe4de('0x12')](_0x2f7636,function(_0x258b4e){if(_0x258b4e[_0xe4de('0x13')]!==0xc8){logger[_0xe4de('0x14')](_0xe4de('0x15')+_0x33998c+_0xe4de('0x16')+_0x258b4e[_0xe4de('0x13')]+'\x20('+_0x258b4e['statusMessage']+')');_0x2ed279(new Error(_0xe4de('0x15')+_0x33998c+_0xe4de('0x16')+_0x258b4e[_0xe4de('0x13')]+'\x20('+_0x258b4e['statusMessage']+')'));return;}var _0x4f892c=fs['createWriteStream'](_0x31189b);_0x4f892c['on'](_0xe4de('0x17'),function(){logger[_0xe4de('0x18')](_0xe4de('0x19'));_0x4f892c[_0xe4de('0x1a')](_0x129c13);});_0x4f892c['on'](_0xe4de('0x14'),function(_0x884b7a){fs[_0xe4de('0x1b')](_0x31189b);logger[_0xe4de('0x14')](_0xe4de('0x1c'),_0x884b7a);_0x2ed279(_0x884b7a);});_0x258b4e[_0xe4de('0x1d')](_0x4f892c);})['on']('error',function(_0x3e98e9){logger[_0xe4de('0x14')](_0x3e98e9);_0x2ed279(_0x3e98e9);})['end']();});}function uploadFile(_0x28712d){return new BPromise(function(_0x31bc3b,_0x1ca06e){var _0xd88bc6=urlParse(_0x28712d);var _0x184153=_0xd88bc6[_0xe4de('0xf')]===_0xe4de('0x10')?https:http;var _0x524d78={'host':_0xd88bc6[_0xe4de('0x1e')],'path':_0xd88bc6['path'],'headers':{'user-agent':_0xe4de('0x1f')}};_0x184153[_0xe4de('0x12')](_0x524d78,function(_0x3349c2){if(_0x3349c2['statusCode']!==0xc8){_0x1ca06e(new Error(_0xe4de('0x15')+_0x28712d+'\x20failed,\x20status\x20code\x20=\x20'+_0x3349c2[_0xe4de('0x13')]+'\x20('+_0x3349c2[_0xe4de('0x20')]+')'));return;}var _0x145f00='';_0x3349c2['on']('data',function(_0xba5d4c){_0x145f00+=_0xba5d4c;});_0x3349c2['on'](_0xe4de('0x21'),function(){_0x31bc3b(_0x145f00);});})['on']('error',function(_0x24f16f){_0x1ca06e(_0x24f16f);})['end']();});}function convertFile(_0xcf02ab,_0x19715a){return new BPromise(function(_0x584395,_0x3da843){var _0x51e056=sox[_0xe4de('0x22')](_0xcf02ab,_0x19715a,{'sampleRate':0x1f40,'format':_0xe4de('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x51e056['on'](_0xe4de('0x14'),function(_0x68ed21){logger[_0xe4de('0x14')](_0xe4de('0x24'),_0x68ed21);_0x3da843(_0x68ed21);});_0x51e056['on'](_0xe4de('0x21'),function(){logger[_0xe4de('0x18')](_0xe4de('0x25'));_0x584395();});_0x51e056[_0xe4de('0x26')]();});}function base64Decode(_0x3530ca,_0x64a329){var _0x42a88a=path[_0xe4de('0x27')](__dirname,_0xe4de('0x28'),rs[_0xe4de('0x29')](0x4)+_0xe4de('0x2a'));fs[_0xe4de('0x2b')](_0x42a88a,_0x3530ca,_0xe4de('0x2c'));return convertFile(_0x42a88a,_0x64a329)['then'](function(){try{fs[_0xe4de('0x1b')](_0x42a88a);fs['chmodSync'](_0x64a329,_0xe4de('0x2d'));}catch(_0x49b954){logger[_0xe4de('0x14')](_0x49b954);}return _0x64a329['split']('.')[0x0];});}function base64Encode(_0x4d09c7){var _0x36a2df=fs[_0xe4de('0x2e')](_0x4d09c7);return new Buffer(_0x36a2df)['toString'](_0xe4de('0x2c'));}exports[_0xe4de('0x2f')]=function(_0xe7d2a6,_0x4e988f,_0x32b0e3,_0x470e9b,_0x2b3f8a,_0xbaa7bb){var _0xb3b009,_0x1b3006;var _0x3c0351=_0xe4de('0x30');var _0xac8482=_0xe4de('0x31')+_0xe7d2a6;var _0x450324={};if(_0x4e988f==='ssml'){_0x450324[_0xe4de('0x32')]={'ssml':_0x32b0e3};}else{_0x450324[_0xe4de('0x32')]={'text':_0x32b0e3};};_0x450324[_0xe4de('0x33')]={'languageCode':_0x470e9b,'ssmlGender':_0x2b3f8a};_0x450324[_0xe4de('0x34')]={'audioEncoding':_0xe4de('0x35'),'sampleRateHertz':0x1f40};var _0x5de3a8={'url':_0x3c0351+_0xe4de('0x36')+_0xac8482,'method':_0xe4de('0x37'),'json':!![],'body':_0x450324};return rp(_0x5de3a8)[_0xe4de('0x38')](function(_0x387bd3){return new BPromise(function(_0x4ff988,_0x22d3c0){_0xb3b009=path[_0xe4de('0x27')](__dirname,_0xe4de('0x28'),rs[_0xe4de('0x29')](0x4)+_0xe4de('0x39'));var _0x19b1b4=Buffer[_0xe4de('0x3a')](_0x387bd3['audioContent'],_0xe4de('0x2c'));return fs[_0xe4de('0x3b')](_0xb3b009,_0x19b1b4,function(_0x17e0fb){_0x22d3c0(_0x17e0fb);},function(_0x45433d){fs[_0xe4de('0x3c')](_0xb3b009,'777');_0x4ff988(_0x45433d);});});})[_0xe4de('0x38')](function(_0x1e3b30){_0x1b3006=path['resolve'](__dirname,_0xe4de('0x28'),rs[_0xe4de('0x29')](0x4)+'.wav');return convertFile(_0xb3b009,_0x1b3006);})[_0xe4de('0x38')](function(){try{fs[_0xe4de('0x1b')](_0xb3b009);fs['chmodSync'](_0x1b3006,_0xe4de('0x2d'));}catch(_0x263f52){logger['error'](_0x263f52);}logger[_0xe4de('0x18')](_0xe4de('0x3d'),_0x1b3006['split']('.')[0x0]);return _0x1b3006[_0xe4de('0x3e')]('.')[0x0];});};exports['googleTTS']=function(_0x1ffd72,_0x1e0622){var _0x4308eb='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x75e12a,_0x4e23f6;var _0x41b0e9;var _0x62abea={'encoding':_0xe4de('0x3f'),'method':_0xe4de('0x37'),'timeout':0x2710,'url':_0x4308eb,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xe4de('0x40')+encodeURIComponent(JSON[_0xe4de('0x41')]([[[_0xe4de('0x42'),JSON[_0xe4de('0x41')]([_0x1ffd72,_0x1e0622||'en',![],_0xe4de('0x43')]),null,'generic']]]))};return rp(_0x62abea)[_0xe4de('0x38')](function(_0x49149e){try{_0x41b0e9=eval(_0x49149e['slice'](0x5))[0x0][0x2];}catch(_0x2464ba){throw new Error(_0xe4de('0x44')+_0x49149e[_0xe4de('0x45')]);}if(!_0x41b0e9){if(_0x1ffd72[_0xe4de('0x46')]>0xc8){throw new Error(_0xe4de('0x47'));}else{throw new Error(_0xe4de('0x48')+_0x1e0622+_0xe4de('0x49'));}}try{_0x41b0e9=eval(_0x41b0e9)[0x0];}catch(_0x45baf5){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xe4de('0x45')]);}const _0x2ab3dc=_0x41b0e9;_0x75e12a=path['resolve'](__dirname,'tmp',rs[_0xe4de('0x29')](0x4)+_0xe4de('0x39'));fs['writeFileSync'](_0x75e12a,_0x41b0e9,{'encoding':_0xe4de('0x2c')});_0x4e23f6=path[_0xe4de('0x27')](__dirname,_0xe4de('0x28'),rs[_0xe4de('0x29')](0x4)+_0xe4de('0x2a'));return convertFile(_0x75e12a,_0x4e23f6);})['then'](function(){try{fs[_0xe4de('0x1b')](_0x75e12a);fs[_0xe4de('0x3c')](_0x4e23f6,_0xe4de('0x2d'));}catch(_0x20e31e){logger[_0xe4de('0x14')](_0x20e31e);}logger['info']('goggleTTS\x20path',_0x4e23f6['split']('.')[0x0]);return _0x4e23f6[_0xe4de('0x3e')]('.')[0x0];});};exports[_0xe4de('0x4a')]=function(_0x187154,_0x518946,_0x42bbf2){return google[_0xe4de('0x4b')](_0x187154,_0x518946,_0x42bbf2)[_0xe4de('0x38')](function(_0x37f313){logger['info'](_0x37f313['uri']);return rp(_0x37f313);})[_0xe4de('0x38')](function(_0x45c88d){var _0x1b42fd='';var _0x285026=0x0;try{fs['unlink'](_0x187154);}catch(_0x15d383){logger['error'](_0x15d383);}if(_0x45c88d&&_0x45c88d[_0xe4de('0x4c')]){_0x1b42fd=_0x45c88d[_0xe4de('0x4c')][_0xe4de('0x4d')](function(_0x3a9f61){return _0x3a9f61&&_0x3a9f61[_0xe4de('0x4e')][0x0]&&_0x3a9f61[_0xe4de('0x4e')][0x0][_0xe4de('0x4f')]?_0x3a9f61[_0xe4de('0x4e')][0x0][_0xe4de('0x4f')]:'';})[_0xe4de('0x50')]('\x0a');_0x285026=_0x45c88d[_0xe4de('0x4c')]['map'](function(_0x1c5451){return _0x1c5451&&_0x1c5451[_0xe4de('0x4e')][0x0]&&_0x1c5451['alternatives'][0x0][_0xe4de('0x51')]?_0x1c5451[_0xe4de('0x4e')][0x0][_0xe4de('0x51')]:0x0;})[_0xe4de('0x50')]('\x0a');}logger[_0xe4de('0x18')](_0xe4de('0x52'),_0x1b42fd);logger[_0xe4de('0x18')](_0xe4de('0x53'),_0x285026);return{'transcript':_0x1b42fd,'confidence':_0x285026};})[_0xe4de('0x54')](function(_0x417c90){logger[_0xe4de('0x14')](_0xe4de('0x55'),_0x417c90[_0xe4de('0x13')],_0x417c90[_0xe4de('0x56')],_0x417c90['message']);});};exports[_0xe4de('0x57')]=function(_0x3f63e5,_0x591000,_0x11a460,_0x5d241f){var _0x2fc3fe=apiai(_0x591000,{'language':_0x5d241f||'en'});return _0x2fc3fe[_0xe4de('0x58')](_0x11a460,{'sessionId':md5(_0x3f63e5)})['then'](function(_0x23c548){logger[_0xe4de('0x18')](JSON[_0xe4de('0x41')](_0x23c548));return{'source':_0x23c548[_0xe4de('0x59')][_0xe4de('0x5a')],'resolvedQuery':_0x23c548[_0xe4de('0x59')][_0xe4de('0x5b')],'action':_0x23c548[_0xe4de('0x59')][_0xe4de('0x5c')],'actionIncomplete':_0x23c548[_0xe4de('0x59')][_0xe4de('0x5d')],'speech':_0x23c548[_0xe4de('0x59')][_0xe4de('0x5e')][_0xe4de('0x5f')],'score':_0x23c548[_0xe4de('0x59')][_0xe4de('0x60')],'statusCode':_0x23c548[_0xe4de('0x61')][_0xe4de('0x62')],'endConversation':_0x23c548[_0xe4de('0x59')][_0xe4de('0x63')][_0xe4de('0x64')]||![],'isFallbackIntent':_0x23c548[_0xe4de('0x59')][_0xe4de('0x63')][_0xe4de('0x65')]};});};exports[_0xe4de('0x66')]=function(_0x1c7bb6,_0x576939,_0x484a8f,_0x38fd55,_0x28b299,_0x2da856){var _0x3c7bbb=_0x38fd55[_0xe4de('0x67')](/\\n/g,'\x0a');var _0x405645={'credentials':{'private_key':_0x3c7bbb,'client_email':_0x484a8f}};var _0x5366d4=new dialogflow['SessionsClient'](_0x405645);var _0x4ee4d4=_0x5366d4[_0xe4de('0x68')](_0x576939,md5(_0x1c7bb6));var _0xfd425c={'session':_0x4ee4d4,'queryInput':{'text':{'text':_0x28b299,'languageCode':_0x2da856}}};return _0x5366d4[_0xe4de('0x69')](_0xfd425c)[_0xe4de('0x38')](function(_0x5a07c7){if(_0x5a07c7&&_0x5a07c7[_0xe4de('0x46')]){logger[_0xe4de('0x18')]('Dialogflow\x20V2\x20response:',JSON[_0xe4de('0x41')](_0x5a07c7));var _0x2e2a74=_0x5a07c7[0x0];if(_0x2e2a74){var _0x4d115a={'action':_0x2e2a74[_0xe4de('0x6a')][_0xe4de('0x5c')],'allRequiredParamsPresent':_0x2e2a74[_0xe4de('0x6a')][_0xe4de('0x6b')],'endConversation':_0x2e2a74[_0xe4de('0x6a')][_0xe4de('0x6c')]&&_0x2e2a74[_0xe4de('0x6a')][_0xe4de('0x6c')][_0xe4de('0x6d')]?_0x2e2a74[_0xe4de('0x6a')]['diagnosticInfo'][_0xe4de('0x6d')]['end_conversation'][_0xe4de('0x6e')]:![],'fulfillmentText':_0x2e2a74[_0xe4de('0x6a')][_0xe4de('0x6f')],'intentName':_0x2e2a74[_0xe4de('0x6a')][_0xe4de('0x70')][_0xe4de('0x56')],'intentDisplayName':_0x2e2a74[_0xe4de('0x6a')][_0xe4de('0x70')][_0xe4de('0x71')],'isFallbackIntent':_0x2e2a74['queryResult'][_0xe4de('0x70')][_0xe4de('0x72')],'languageCode':_0x2e2a74['queryResult'][_0xe4de('0x73')],'queryText':_0x2e2a74[_0xe4de('0x6a')][_0xe4de('0x74')],'responseId':_0x2e2a74[_0xe4de('0x75')],'score':_0x2e2a74['queryResult'][_0xe4de('0x76')],'speech':_0x2e2a74[_0xe4de('0x6a')]['fulfillmentText'],'providerResponse':JSON[_0xe4de('0x41')](_0x5a07c7)};return _0x4d115a;}}});};exports[_0xe4de('0x77')]=function(_0x9573e4,_0xbdc5e7,_0x163550,_0x489a72){return tilde[_0xe4de('0x4b')](_0x9573e4,_0xbdc5e7,_0x163550,_0x489a72)['then'](function(_0x257ab7){try{fs[_0xe4de('0x1b')](_0x9573e4);}catch(_0x570146){logger[_0xe4de('0x14')](_0x570146);}logger[_0xe4de('0x18')]('Tilde\x20ASR\x20transcription',_0x257ab7['transcript']);logger[_0xe4de('0x18')](_0xe4de('0x78'),_0x257ab7[_0xe4de('0x51')]);return _0x257ab7;});};exports[_0xe4de('0x79')]=function(_0x415d97,_0x908a1a,_0x2959bc,_0xcbecbc,_0x2db15b,_0x491abc){var _0x10e60b=path[_0xe4de('0x27')](__dirname,_0xe4de('0x28'),rs['generate'](0x4)+_0xe4de('0x39'));var _0x5b44cd;return aws[_0xe4de('0x7a')](_0x415d97,_0x908a1a,_0x2959bc,_0xcbecbc,_0x2db15b,_0x491abc,_0x10e60b)['then'](function(){_0x5b44cd=path[_0xe4de('0x27')](__dirname,'tmp',rs[_0xe4de('0x29')](0x4)+_0xe4de('0x2a'));return convertFile(_0x10e60b,_0x5b44cd);})[_0xe4de('0x38')](function(){try{fs[_0xe4de('0x1b')](_0x10e60b);fs[_0xe4de('0x3c')](_0x5b44cd,_0xe4de('0x2d'));}catch(_0x512ab0){logger['error'](_0x512ab0);}return _0x5b44cd[_0xe4de('0x3e')]('.')[0x0];});};exports[_0xe4de('0x7b')]=function(_0x4f6b78,_0x8ee6d6,_0x29fe6d,_0x3f60,_0x464b1e,_0x11055b){return aws[_0xe4de('0x7c')](_0x4f6b78,_0x8ee6d6,_0x29fe6d,_0x3f60,_0x464b1e,_0x11055b)['then'](function(_0x3cd468){logger[_0xe4de('0x18')](JSON['stringify'](_0x3cd468));return _0x3cd468;});};exports[_0xe4de('0x7d')]=function(_0x459515,_0xb88a50,_0x384cc2,_0x4572f3){var _0x5be3f9=util[_0xe4de('0x7e')](_0xe4de('0x7f'),ISPEECH_API,_0x459515,encodeURIComponent(_0xb88a50),_0x384cc2,_0x4572f3);var _0x3ac70a=path[_0xe4de('0x27')](__dirname,_0xe4de('0x28'),rs[_0xe4de('0x29')](0x4)+_0xe4de('0x39'));var _0x5eebd2;return downloadFile(_0x5be3f9,_0x3ac70a)[_0xe4de('0x38')](function(){_0x5eebd2=path['resolve'](__dirname,_0xe4de('0x28'),rs[_0xe4de('0x29')](0x4)+_0xe4de('0x2a'));return convertFile(_0x3ac70a,_0x5eebd2);})[_0xe4de('0x38')](function(){try{fs[_0xe4de('0x1b')](_0x3ac70a);fs[_0xe4de('0x3c')](_0x5eebd2,'777');}catch(_0x58f787){logger[_0xe4de('0x14')](_0x58f787);}return _0x5eebd2['split']('.')[0x0];});};exports[_0xe4de('0x80')]=function(_0x40f535,_0x68885f,_0x5c1b8c,_0x22ecea){var _0x14ab33=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x68885f,_0x5c1b8c,base64Encode(_0x40f535),_0x22ecea?util[_0xe4de('0x7e')](_0xe4de('0x81'),encodeURIComponent(_0x22ecea)):_0xe4de('0x82'));return uploadFile(_0x14ab33)[_0xe4de('0x38')](function(_0x253956){return querystring[_0xe4de('0xb')](_0x253956);});};exports[_0xe4de('0x83')]=function(_0x5b77af,_0x5098fd){return sestek[_0xe4de('0x84')](_0x5b77af,_0x5098fd)['then'](function(_0x288ba2){logger[_0xe4de('0x18')](JSON['stringify'](_0x288ba2));var _0x13aa2b={'speech':_0x288ba2[_0xe4de('0x85')],'action':_0x288ba2[_0xe4de('0x86')]?_0x288ba2[_0xe4de('0x86')][_0xe4de('0x87')]:undefined,'actiondata':_0x288ba2['channelData']?_0x288ba2['channelData'][_0xe4de('0x88')]:undefined};if(_0x288ba2[_0xe4de('0x86')]&&_0x288ba2[_0xe4de('0x86')][_0xe4de('0x89')]){return base64Decode(_0x288ba2[_0xe4de('0x86')][_0xe4de('0x89')][_0xe4de('0x8a')],path[_0xe4de('0x27')](__dirname,_0xe4de('0x28'),rs[_0xe4de('0x29')](0x4)+_0xe4de('0x2a')))[_0xe4de('0x38')](function(_0x414e9e){_0x13aa2b[_0xe4de('0x8b')]=_0x414e9e;return _0x13aa2b;});}return _0x13aa2b;});};exports[_0xe4de('0x8c')]=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 8f34e03..26477e0 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 nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file +var _0xf403=['exports','./nda'];(function(_0x550231,_0x1120ff){var _0x3f11a9=function(_0x52aade){while(--_0x52aade){_0x550231['push'](_0x550231['shift']());}};_0x3f11a9(++_0x1120ff);}(_0xf403,0x103));var _0x3f40=function(_0x40676d,_0x535d87){_0x40676d=_0x40676d-0x0;var _0x438d15=_0xf403[_0x40676d];return _0x438d15;};var nda=require(_0x3f40('0x0'));module[_0x3f40('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index f67fe0b..9e18d07 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 _0xe28e=['resolve','ndauth_url','/token','password','then','ndassistant_url','Nda','uniqueid','calleridname','dnid','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST'];(function(_0x3f2f69,_0x288a93){var _0x7afa2a=function(_0x5713b1){while(--_0x5713b1){_0x3f2f69['push'](_0x3f2f69['shift']());}};_0x7afa2a(++_0x288a93);}(_0xe28e,0x1ba));var _0xee28=function(_0x41da98,_0x56d235){_0x41da98=_0x41da98-0x0;var _0x2a6520=_0xe28e[_0x41da98];return _0x2a6520;};'use strict';var rp=require(_0xee28('0x0'));var url=require(_0xee28('0x1'));var logger=require(_0xee28('0x2'))(_0xee28('0x3'));module[_0xee28('0x4')]=function(_0x117a12,_0x3e541a){var _0x9f2216={'method':_0xee28('0x5'),'uri':url[_0xee28('0x6')](_0x3e541a[_0xee28('0x7')],_0xee28('0x8')),'form':{'grant_type':_0xee28('0x9'),'username':_0x3e541a['username'],'password':_0x3e541a[_0xee28('0x9')]},'json':!![]};return rp(_0x9f2216)[_0xee28('0xa')](function(_0x3f9bd9){var _0x66d0b6={'method':_0xee28('0x5'),'uri':url[_0xee28('0x6')](_0x3e541a[_0xee28('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3e541a['ndaactivity_type']||'message','channelId':_0xee28('0xc'),'conversation':{'id':_0x117a12[_0xee28('0xd')]},'from':{'id':_0x117a12['callerid'],'name':_0x117a12[_0xee28('0xe')]},'recipient':{'id':_0x117a12[_0xee28('0xf')],'name':_0x117a12['extension']},'text':_0x3e541a[_0xee28('0x10')],'channelData':{}},'headers':{'Authorization':_0xee28('0x11')+_0x3f9bd9[_0xee28('0x12')]},'json':!![]};if(_0x3e541a[_0xee28('0x13')]){_0x66d0b6[_0xee28('0x14')][_0xee28('0x15')][_0xee28('0x16')]=_0x3e541a['project'];}if(_0x3e541a[_0xee28('0x17')]=='1'){_0x66d0b6[_0xee28('0x14')][_0xee28('0x15')][_0xee28('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xee28('0x19')};}if(_0x3e541a['custom_action']){_0x66d0b6[_0xee28('0x14')][_0xee28('0x15')][_0xee28('0x1a')]=_0x3e541a[_0xee28('0x1b')];if(_0x3e541a[_0xee28('0x1c')]){_0x66d0b6[_0xee28('0x14')]['channelData'][_0xee28('0x1d')]=_0x3e541a['custom_action_data'];}}logger[_0xee28('0x1e')](JSON[_0xee28('0x1f')](_0x66d0b6));return rp(_0x66d0b6);});}; \ No newline at end of file +var _0x4483=['CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','exports','POST','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','custom_action','custom_action_data'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0x4483,0x1a3));var _0x3448=function(_0xe1a4cc,_0x52bd93){_0xe1a4cc=_0xe1a4cc-0x0;var _0x35e272=_0x4483[_0xe1a4cc];return _0x35e272;};'use strict';var rp=require(_0x3448('0x0'));var url=require(_0x3448('0x1'));var logger=require(_0x3448('0x2'))('agi');module[_0x3448('0x3')]=function(_0x1fe72d,_0x27ef60){var _0x3a7178={'method':_0x3448('0x4'),'uri':url['resolve'](_0x27ef60[_0x3448('0x5')],_0x3448('0x6')),'form':{'grant_type':_0x3448('0x7'),'username':_0x27ef60[_0x3448('0x8')],'password':_0x27ef60[_0x3448('0x7')]},'json':!![]};return rp(_0x3a7178)[_0x3448('0x9')](function(_0x3cc81d){var _0x34b926={'method':'POST','uri':url['resolve'](_0x27ef60[_0x3448('0xa')],_0x3448('0xb')),'body':{'type':_0x27ef60[_0x3448('0xc')]||_0x3448('0xd'),'channelId':_0x3448('0xe'),'conversation':{'id':_0x1fe72d[_0x3448('0xf')]},'from':{'id':_0x1fe72d[_0x3448('0x10')],'name':_0x1fe72d[_0x3448('0x11')]},'recipient':{'id':_0x1fe72d[_0x3448('0x12')],'name':_0x1fe72d[_0x3448('0x13')]},'text':_0x27ef60[_0x3448('0x14')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x3cc81d['access_token']},'json':!![]};if(_0x27ef60[_0x3448('0x15')]){_0x34b926[_0x3448('0x16')]['channelData'][_0x3448('0x17')]=_0x27ef60[_0x3448('0x15')];}if(_0x27ef60[_0x3448('0x18')]=='1'){_0x34b926['body'][_0x3448('0x19')][_0x3448('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x27ef60[_0x3448('0x1b')]){_0x34b926[_0x3448('0x16')][_0x3448('0x19')]['CustomAction']=_0x27ef60[_0x3448('0x1b')];if(_0x27ef60[_0x3448('0x1c')]){_0x34b926[_0x3448('0x16')][_0x3448('0x19')][_0x3448('0x1d')]=_0x27ef60[_0x3448('0x1c')];}}logger[_0x3448('0x1e')](JSON[_0x3448('0x1f')](_0x34b926));return rp(_0x34b926);});}; \ 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 5fd99b6..00058b5 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 _0x6d30=['exports','./lib/api'];(function(_0x34cc04,_0x587758){var _0x14d3a4=function(_0x42a246){while(--_0x42a246){_0x34cc04['push'](_0x34cc04['shift']());}};_0x14d3a4(++_0x587758);}(_0x6d30,0xbb));var _0x06d3=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x6d30[_0x5783f4];return _0x28e380;};'use strict';var asr=require(_0x06d3('0x0'));module[_0x06d3('0x1')]=function(_0xf11398,_0x5112f2,_0x561f1e,_0xbf26f4){return asr(_0xf11398,_0x5112f2,_0x561f1e,_0xbf26f4);}; \ No newline at end of file +var _0x52ca=['exports','./lib/api'];(function(_0x18d830,_0x229c46){var _0x4ff817=function(_0x25180f){while(--_0x25180f){_0x18d830['push'](_0x18d830['shift']());}};_0x4ff817(++_0x229c46);}(_0x52ca,0x1c1));var _0xa52c=function(_0x204dbc,_0x5f5c1d){_0x204dbc=_0x204dbc-0x0;var _0x4ee70b=_0x52ca[_0x204dbc];return _0x4ee70b;};'use strict';var asr=require(_0xa52c('0x0'));module[_0xa52c('0x1')]=function(_0x2cf101,_0x35d359,_0x3c509b,_0x5885d1){return asr(_0x2cf101,_0x35d359,_0x3c509b,_0x5885d1);}; \ 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 6e60cf0..d9bd676 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 _0x08a0=['send','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','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','isObject','open','bluebird','moment','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','unix'];(function(_0x9077a4,_0x41748c){var _0x204bdc=function(_0x1c611e){while(--_0x1c611e){_0x9077a4['push'](_0x9077a4['shift']());}};_0x204bdc(++_0x41748c);}(_0x08a0,0xd5));var _0x008a=function(_0x4a7193,_0x556c6a){_0x4a7193=_0x4a7193-0x0;var _0xc33d94=_0x08a0[_0x4a7193];return _0xc33d94;};'use strict';var BPromise=require(_0x008a('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x008a('0x1'));var crypto=require('crypto');var logger=require(_0x008a('0x2'))(_0x008a('0x3'));module[_0x008a('0x4')]=function(_0x4533e1,_0x1749ae,_0x38fa7b,_0x3caf0d){return new BPromise(function(_0x47050a,_0x17fc64){logger[_0x008a('0x5')](_0x008a('0x6'),_0x3caf0d||_0x008a('0x7'));var _0x101053=new WebSocket(_0x3caf0d||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x405633='';var _0x4fb543='0';var _0x49f531='1';var _0xa82ed0=_0x008a('0x8');function _0x4ef684(_0x151d89){var _0x45e4c6=crypto[_0x008a('0x9')](_0x008a('0xa'));_0x45e4c6[_0x008a('0xb')](_0x151d89);return _0x45e4c6[_0x008a('0xc')]('hex');}function _0x47bd4e(){try{logger[_0x008a('0x5')](_0x008a('0xd'));var _0x5ca2fc=moment()[_0x008a('0xe')]();var _0x454421=_0x4ef684(_0x5ca2fc+_0x1749ae+_0x38fa7b);_0x101053[_0x008a('0xf')](JSON['stringify']({'appID':_0x1749ae,'timestamp':_0x5ca2fc,'appKey':_0x454421}));var _0x306df7=fs['createReadStream'](_0x4533e1);_0x306df7['on'](_0x008a('0x10'),function(_0x46576f){_0x101053[_0x008a('0xf')](_0x46576f);});_0x306df7['on'](_0x008a('0x11'),function(){_0x101053[_0x008a('0xf')](_0x008a('0x12'));});}catch(_0x1880ee){logger[_0x008a('0x13')](_0x008a('0x14'),JSON[_0x008a('0x15')](_0x1880ee));_0x101053[_0x008a('0x16')]();}}function _0x3353cf(_0x5815e7){try{if(_0x5815e7){var _0x3f80b8=JSON[_0x008a('0x17')](_0x5815e7);switch(_0x3f80b8['status']){case 0x0:if(_0x3f80b8[_0x008a('0x18')]){if(_0x3f80b8[_0x008a('0x18')][_0x008a('0x19')]){logger['info'](_0x008a('0x1a'),JSON['stringify'](_0x3f80b8[_0x008a('0x18')]['hypotheses']));_0x405633=_0x3f80b8[_0x008a('0x18')][_0x008a('0x1b')][0x0][_0x008a('0x1c')];_0x4fb543=_0x3f80b8['result'][_0x008a('0x1b')][0x0]['likelihood'];_0x49f531='0';_0xa82ed0='Success.';_0x101053[_0x008a('0x16')]();}}break;case 0x1:logger[_0x008a('0x5')](_0x008a('0x8'));_0x49f531='1';_0xa82ed0=_0x008a('0x8');break;case 0x2:logger['info'](_0x008a('0x1d'));_0x49f531='2';_0xa82ed0='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0x008a('0x1e'));_0x49f531='9';_0xa82ed0=_0x008a('0x1e');break;case 0xa:logger[_0x008a('0x5')](_0x008a('0x1f'));_0x49f531='10';_0xa82ed0='Authentication\x20failed.';break;case 0xb:logger[_0x008a('0x5')](_0x008a('0x20'));_0x49f531='11';_0xa82ed0=_0x008a('0x20');}}}catch(_0x1383b3){logger[_0x008a('0x13')](_0x008a('0x21'),JSON[_0x008a('0x15')](_0x1383b3));_0x101053[_0x008a('0x16')]();}}function _0x8b95b4(){logger[_0x008a('0x5')](_0x008a('0x22'));_0x47050a({'transcript':_0x405633,'confidence':_0x4fb543,'status':_0x49f531,'status_message':_0xa82ed0});}function _0x5b6b27(_0x122ebc){logger[_0x008a('0x13')](_0x008a('0x23'));if(!_['isNil'](_0x122ebc)){logger['error'](_[_0x008a('0x24')](_0x122ebc)?JSON[_0x008a('0x15')](_0x122ebc):_0x122ebc);}}_0x101053['on'](_0x008a('0x25'),_0x47bd4e);_0x101053['on']('message',_0x3353cf);_0x101053['on'](_0x008a('0x11'),_0x8b95b4);_0x101053['on'](_0x008a('0x13'),_0x5b6b27);});}; \ No newline at end of file +var _0xb870=['lodash','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','isNil','isObject','open','message','close','bluebird'];(function(_0xedbd17,_0x2d79af){var _0x18b70e=function(_0x5f52d6){while(--_0x5f52d6){_0xedbd17['push'](_0xedbd17['shift']());}};_0x18b70e(++_0x2d79af);}(_0xb870,0x1df));var _0x0b87=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0xb870[_0x2d486b];return _0x4291d1;};'use strict';var BPromise=require(_0x0b87('0x0'));var _=require(_0x0b87('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x0b87('0x2'));var logger=require(_0x0b87('0x3'))(_0x0b87('0x4'));module[_0x0b87('0x5')]=function(_0x286c74,_0x8ffd8f,_0x5d1223,_0x424c64){return new BPromise(function(_0x230d67,_0x2d8b37){logger[_0x0b87('0x6')](_0x0b87('0x7'),_0x424c64||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0xd93010=new WebSocket(_0x424c64||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x1b2c68='';var _0xc14e7d='0';var _0x1521ee='1';var _0x3b0955=_0x0b87('0x8');function _0x2fe32a(_0x294944){var _0x37ddb7=crypto['createHash'](_0x0b87('0x9'));_0x37ddb7[_0x0b87('0xa')](_0x294944);return _0x37ddb7['digest'](_0x0b87('0xb'));}function _0x3170d0(){try{logger['info'](_0x0b87('0xc'));var _0xe54ef9=moment()[_0x0b87('0xd')]();var _0x3d2e66=_0x2fe32a(_0xe54ef9+_0x8ffd8f+_0x5d1223);_0xd93010[_0x0b87('0xe')](JSON[_0x0b87('0xf')]({'appID':_0x8ffd8f,'timestamp':_0xe54ef9,'appKey':_0x3d2e66}));var _0x53135d=fs[_0x0b87('0x10')](_0x286c74);_0x53135d['on'](_0x0b87('0x11'),function(_0x200130){_0xd93010[_0x0b87('0xe')](_0x200130);});_0x53135d['on']('close',function(){_0xd93010[_0x0b87('0xe')](_0x0b87('0x12'));});}catch(_0x5821e4){logger[_0x0b87('0x13')](_0x0b87('0x14'),JSON[_0x0b87('0xf')](_0x5821e4));_0xd93010['terminate']();}}function _0x5a5c98(_0x43e996){try{if(_0x43e996){var _0x132bb5=JSON[_0x0b87('0x15')](_0x43e996);switch(_0x132bb5[_0x0b87('0x16')]){case 0x0:if(_0x132bb5[_0x0b87('0x17')]){if(_0x132bb5['result'][_0x0b87('0x18')]){logger[_0x0b87('0x6')](_0x0b87('0x19'),JSON[_0x0b87('0xf')](_0x132bb5['result'][_0x0b87('0x1a')]));_0x1b2c68=_0x132bb5[_0x0b87('0x17')][_0x0b87('0x1a')][0x0][_0x0b87('0x1b')];_0xc14e7d=_0x132bb5[_0x0b87('0x17')][_0x0b87('0x1a')][0x0][_0x0b87('0x1c')];_0x1521ee='0';_0x3b0955=_0x0b87('0x1d');_0xd93010[_0x0b87('0x1e')]();}}break;case 0x1:logger[_0x0b87('0x6')](_0x0b87('0x8'));_0x1521ee='1';_0x3b0955='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x0b87('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x1521ee='2';_0x3b0955=_0x0b87('0x1f');break;case 0x9:logger[_0x0b87('0x6')](_0x0b87('0x20'));_0x1521ee='9';_0x3b0955=_0x0b87('0x20');break;case 0xa:logger[_0x0b87('0x6')](_0x0b87('0x21'));_0x1521ee='10';_0x3b0955=_0x0b87('0x21');break;case 0xb:logger['info'](_0x0b87('0x22'));_0x1521ee='11';_0x3b0955='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x4a4227){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0x0b87('0xf')](_0x4a4227));_0xd93010[_0x0b87('0x1e')]();}}function _0x1c27ea(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x230d67({'transcript':_0x1b2c68,'confidence':_0xc14e7d,'status':_0x1521ee,'status_message':_0x3b0955});}function _0x5e7756(_0x4e7eef){logger[_0x0b87('0x13')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x0b87('0x23')](_0x4e7eef)){logger[_0x0b87('0x13')](_[_0x0b87('0x24')](_0x4e7eef)?JSON[_0x0b87('0xf')](_0x4e7eef):_0x4e7eef);}}_0xd93010['on'](_0x0b87('0x25'),_0x3170d0);_0xd93010['on'](_0x0b87('0x26'),_0x5a5c98);_0xd93010['on'](_0x0b87('0x27'),_0x1c27ea);_0xd93010['on'](_0x0b87('0x13'),_0x5e7756);});}; \ 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 4dbe803..d4b1ef0 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 _0xdb2f=['exports'];(function(_0x203671,_0x332752){var _0x11418b=function(_0x5f1d0d){while(--_0x5f1d0d){_0x203671['push'](_0x203671['shift']());}};_0x11418b(++_0x332752);}(_0xdb2f,0x91));var _0xfdb2=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xdb2f[_0x580576];return _0x3f55a0;};var asr=require('./asr');module[_0xfdb2('0x0')]={'asr':asr}; \ No newline at end of file +var _0xdb17=['./asr'];(function(_0x1f8aa7,_0x10e7d6){var _0x4b41e2=function(_0x6498ab){while(--_0x6498ab){_0x1f8aa7['push'](_0x1f8aa7['shift']());}};_0x4b41e2(++_0x10e7d6);}(_0xdb17,0x12a));var _0x7db1=function(_0x5b6111,_0x3c1a6b){_0x5b6111=_0x5b6111-0x0;var _0x5f0e4c=_0xdb17[_0x5b6111];return _0x5f0e4c;};var asr=require(_0x7db1('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 5a34861..8c6219f 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(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'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 _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(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'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 diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index e86358c..ff1dee9 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 _0x3e74=['agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','timeout','number','includes','POST','PUT','method','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','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','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_polly_voice','aws_text_type','awsLex','aws_access_key_id','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clear','hasOwnProperty','isString','recursiveNodeIndex','isPlainObject','replaceAllVariables','saveRestApiResult','%s.%s','isArray','length','setVariable','split','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','noop','MRCPSynth','result','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','getUser','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','streamFile','unlink','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','getSound','getData','response','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','NOBEEP','recordFile','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','intKey','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','context','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','.wav','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','gosub','position','QUEUE','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','replace','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','sendMail\x20message','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','no\x20sms\x20account\x20configured','getSmsAccount','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','replaceAll','exports','util','shelljs','odbc','randomstring','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','prototype','getVariable','getVariableById','then','name','catch','rpc','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getSoundById','save_name','getMailAccount','getMailAccountById','mailRpc','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','format','getQueryOdbc','open','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','error','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','createSquareRecording','uniqueid','callerid','calleridname','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','lastName','isNil','phone','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause'];(function(_0x176865,_0x465e53){var _0x2bc1e1=function(_0x185001){while(--_0x185001){_0x176865['push'](_0x176865['shift']());}};_0x2bc1e1(++_0x465e53);}(_0x3e74,0x175));var _0x43e7=function(_0x414038,_0x425f67){_0x414038=_0x414038-0x0;var _0x524579=_0x3e74[_0x414038];return _0x524579;};'use strict';var fs=require('fs');var util=require(_0x43e7('0x0'));var _=require('lodash');var sh=require(_0x43e7('0x1'));var odbc=require(_0x43e7('0x2'))();var rs=require(_0x43e7('0x3'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var scripts=require(_0x43e7('0x7'));var FILES_PATH=_0x43e7('0x8');var recursiveMapAttributes=[_0x43e7('0x9'),'rawBody'];var verticesWithRetry=[_0x43e7('0xa'),_0x43e7('0xb'),_0x43e7('0xc')];var AGIVertices=function(_0x8528fc,_0x21f491,_0x516b4d){this[_0x43e7('0xd')]=_0x8528fc;this['rpc']=_0x21f491;this['mailRpc']=_0x516b4d;};AGIVertices[_0x43e7('0xe')][_0x43e7('0xf')]=function(_0x5c34f4,_0x2803d9){this['rpc'][_0x43e7('0x10')](_0x5c34f4)[_0x43e7('0x11')](function(_0x4ebc8e){_0x2803d9(null,_0x4ebc8e?_0x4ebc8e[_0x43e7('0x12')]:![]);})[_0x43e7('0x13')](function(_0x2718d3){_0x2803d9(_0x2718d3);});};AGIVertices[_0x43e7('0xe')]['getVoiceQueue']=function(_0x583d85,_0x2fcb36){this[_0x43e7('0x14')][_0x43e7('0x15')](_0x583d85)['then'](function(_0x5e641c){_0x2fcb36(null,_0x5e641c?_0x5e641c[_0x43e7('0x12')]:![]);})[_0x43e7('0x13')](function(_0x203378){_0x2fcb36(_0x203378);});};AGIVertices[_0x43e7('0xe')]['getSquareProject']=function(_0x5c4eaa,_0xdf16c){this[_0x43e7('0x14')][_0x43e7('0x16')](_0x5c4eaa)['then'](function(_0x4b5a6b){_0xdf16c(null,_0x4b5a6b?_0x4b5a6b[_0x43e7('0x12')]:![]);})[_0x43e7('0x13')](function(_0x9037d3){_0xdf16c(_0x9037d3);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x17')]=function(_0x1f24fb,_0x619236){this[_0x43e7('0x14')][_0x43e7('0x18')](_0x1f24fb)[_0x43e7('0x11')](function(_0x191dd5){_0x619236(null,_0x191dd5?_0x191dd5[_0x43e7('0x19')]:![]);})['catch'](function(_0xef1a5a){_0x619236(_0xef1a5a);});};AGIVertices[_0x43e7('0xe')]['getUser']=function(_0x2898b5,_0x3e281e){this[_0x43e7('0x14')][_0x43e7('0x1a')](_0x2898b5)[_0x43e7('0x11')](function(_0x2f4cb4){_0x3e281e(null,_0x2f4cb4?_0x2f4cb4['name']:![]);})[_0x43e7('0x13')](function(_0x4eea52){_0x3e281e(_0x4eea52);});};AGIVertices['prototype'][_0x43e7('0x1b')]=function(_0x43f4ff,_0x4b2b9f){this[_0x43e7('0x14')]['getTrunkById'](_0x43f4ff)[_0x43e7('0x11')](function(_0x5c5e67){_0x4b2b9f(null,_0x5c5e67?_0x5c5e67[_0x43e7('0x12')]:![]);})[_0x43e7('0x13')](function(_0x20888b){_0x4b2b9f(_0x20888b);});};AGIVertices[_0x43e7('0xe')]['getSound']=function(_0x52b7b3,_0x805b54){var _0x501551=this;this[_0x43e7('0x14')][_0x43e7('0x1c')](_0x52b7b3)[_0x43e7('0x11')](function(_0xb1fc63){_0x805b54(null,_0xb1fc63?_0x501551['getSoundPath'](_0xb1fc63[_0x43e7('0x1d')]):![]);})[_0x43e7('0x13')](function(_0x45b675){_0x805b54(_0x45b675);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x1e')]=function(_0x84dd4d,_0x2b85a5){this[_0x43e7('0x14')][_0x43e7('0x1f')](_0x84dd4d)[_0x43e7('0x11')](function(_0x17df44){_0x2b85a5(null,_0x17df44?_0x17df44:![]);})[_0x43e7('0x13')](function(_0x2bde44){_0x2b85a5(_0x2bde44);});};AGIVertices[_0x43e7('0xe')]['sendMailMessage']=function(_0x238321,_0x44f6b0,_0x3b8f78){this[_0x43e7('0x20')][_0x43e7('0x21')](_0x238321,_0x44f6b0)['then'](function(){_0x3b8f78(null);})[_0x43e7('0x13')](function(_0x49b83d){_0x3b8f78(_0x49b83d);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x22')]=function(_0x4c61b9,_0x5a7342){this['rpc'][_0x43e7('0x23')](_0x4c61b9)[_0x43e7('0x11')](function(_0x117c07){if(_0x117c07){if(_0x117c07[_0x43e7('0x24')]){_0x5a7342(null,[_0x117c07[_0x43e7('0x25')]]);}else{_0x5a7342(null,_[_0x43e7('0x26')](_0x117c07['Intervals'],'interval'));}}else{_0x5a7342(null,![]);}})['catch'](function(_0x59e5b2){_0x5a7342(_0x59e5b2);});};AGIVertices['prototype']['getSoundPath']=function(_0x5cb753){return util[_0x43e7('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x5cb753);};AGIVertices[_0x43e7('0xe')][_0x43e7('0x28')]=function(_0x31bc78,_0x50a2d0,_0x40f72f){odbc[_0x43e7('0x29')](_0x31bc78,function(_0x101d45){if(_0x101d45){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x101d45);_0x40f72f(_0x101d45);}else{logger['info'](_0x43e7('0x2a'));odbc[_0x43e7('0x2b')](_0x50a2d0,function(_0x199ff6,_0x16cdba){if(_0x199ff6){logger[_0x43e7('0x2c')](_0x43e7('0x2d'),_0x50a2d0);_0x40f72f(_0x199ff6);}else{logger[_0x43e7('0x2c')](_0x43e7('0x2e'),_0x50a2d0);odbc['close'](function(_0x61ed8e){if(_0x61ed8e){logger[_0x43e7('0x2f')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x61ed8e);}_0x40f72f(null,_0x16cdba);});}});}});};AGIVertices[_0x43e7('0xe')]['getSmsAccount']=function(_0x44d8e4,_0x2ad008){this[_0x43e7('0x14')][_0x43e7('0x30')](_0x44d8e4)[_0x43e7('0x11')](function(_0x234d8f){_0x2ad008(null,_0x234d8f?_0x234d8f:![]);})['catch'](function(_0x574a93){_0x2ad008(_0x574a93);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x31')]=function(_0x44b6ae,_0xc8ffa5){this[_0x43e7('0x14')]['createSmsMessage'](_0x44b6ae)[_0x43e7('0x11')](function(_0x4227c4){_0xc8ffa5(null,_0x4227c4);})['catch'](function(_0x3628e0){_0xc8ffa5(_0x3628e0);});};AGIVertices['prototype'][_0x43e7('0x32')]=function(_0x504101,_0x3d81ae,_0x3b4235){this[_0x43e7('0x14')][_0x43e7('0x32')]({'uniqueid':this['channel']['uniqueid'],'node':_0x504101[_0x43e7('0x33')],'application':_0x504101[_0x43e7('0x34')],'data':_0x3d81ae||null,'project_name':this[_0x43e7('0xd')][_0x43e7('0x35')],'callerid':this['channel']['callerid']})['then'](function(_0x35e4fb){if(_0x3b4235){_0x3b4235(null,_0x35e4fb);}})['catch'](function(_0x2ab022){if(_0x3b4235){_0x3b4235(_0x2ab022);}});};AGIVertices['prototype']['createSquareRecording']=function(_0x46b2e6,_0x5ee1c5,_0x2de14f,_0x39db7f){this[_0x43e7('0x14')][_0x43e7('0x36')]({'uniqueid':this['channel'][_0x43e7('0x37')],'callerid':this[_0x43e7('0xd')][_0x43e7('0x38')],'calleridname':this[_0x43e7('0xd')][_0x43e7('0x39')],'context':this[_0x43e7('0xd')]['context'],'extension':this['channel'][_0x43e7('0x3a')],'priority':this[_0x43e7('0xd')][_0x43e7('0x3b')],'accountcode':this['channel']['accountcode'],'dnid':this['channel'][_0x43e7('0x3c')],'projectName':this[_0x43e7('0xd')]['arg_1'],'saveName':_0x5ee1c5,'filename':_0x46b2e6[_0x43e7('0x3d')]||_0x5ee1c5,'savePath':_0x2de14f})[_0x43e7('0x11')](function(_0x3c96fe){_0x39db7f(null,_0x3c96fe);})['catch'](function(_0x593155){_0x39db7f(_0x593155);});};AGIVertices['prototype']['createSquareMessage']=function(_0x214e7e,_0xe955fc,_0x52fea5,_0x23e7cb,_0x82d32f){this[_0x43e7('0x14')][_0x43e7('0x3e')]({'uniqueid':this['channel'][_0x43e7('0x37')],'body':_0x214e7e,'direction':_0xe955fc,'providerName':_0x52fea5,'providerResponse':_0x23e7cb})['then'](function(_0x4bebd4){if(_0x82d32f){_0x82d32f(null,_0x4bebd4);}})[_0x43e7('0x13')](function(_0x12f9ba){if(_0x82d32f){_0x82d32f(_0x12f9ba);}});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x3f')]=function(_0x13503c,_0x2351cf){this[_0x43e7('0x14')][_0x43e7('0x3f')]({'firstName':_[_0x43e7('0x40')](_0x13503c[_0x43e7('0x12')])||_['isNil'](_0x13503c[_0x43e7('0x12')])?_0x43e7('0x41')+Math['random']():_0x13503c[_0x43e7('0x12')],'lastName':_['isEmpty'](_0x13503c[_0x43e7('0x42')])||_[_0x43e7('0x43')](_0x13503c[_0x43e7('0x42')])?null:_0x13503c[_0x43e7('0x42')],'phone':_0x13503c[_0x43e7('0x44')],'ListId':_0x13503c['list_id'],'scheduledat':_0x13503c['scheduledAt'],'callbackUniqueid':this[_0x43e7('0xd')][_0x43e7('0x37')],'tags':_0x43e7('0x45'),'description':_0x43e7('0x46')+_0x13503c[_0x43e7('0x47')][_0x43e7('0x48')](),'priority':_0x13503c[_0x43e7('0x49')]})[_0x43e7('0x11')](function(_0x26d86c){_0x2351cf(null,_0x26d86c);})[_0x43e7('0x13')](function(_0x312306){_0x2351cf(_0x312306);});};AGIVertices['prototype'][_0x43e7('0x4a')]=function(_0x2da2f3,_0x50a3fa){this[_0x43e7('0x14')][_0x43e7('0x4b')](_0x2da2f3)[_0x43e7('0x11')](function(_0x558d54){_0x50a3fa(null,_0x558d54?_0x558d54['name']:![]);})[_0x43e7('0x13')](function(_0x3d9a29){_0x50a3fa(_0x3d9a29);});};AGIVertices['prototype'][_0x43e7('0x4c')]=function(_0x54506d,_0x49a6ce,_0x1fa3f6){var _0x4b6b7f={'role':_0x43e7('0x4d')};_0x4b6b7f[_0x54506d]=this[_0x43e7('0xd')][_0x43e7('0x38')];this['rpc'][_0x43e7('0x4c')](_0x4b6b7f,_0x49a6ce,this[_0x43e7('0xd')]['uniqueid'])[_0x43e7('0x11')](function(_0x1267c5){_0x1fa3f6(null,_[_0x43e7('0x43')](_0x1267c5)?![]:!![]);})['catch'](function(_0x5a4c95){logger['error'](_0x5a4c95);_0x1fa3f6(null,![]);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x4e')]=function(_0x323cf7,_0x3a6404){var _0x52ea9c={'role':'agent'};_0x52ea9c[_0x323cf7]=this[_0x43e7('0xd')][_0x43e7('0x38')];this[_0x43e7('0x14')][_0x43e7('0x4e')](_0x52ea9c)['then'](function(_0x4438c0){_0x3a6404(null,_[_0x43e7('0x43')](_0x4438c0)?![]:!![]);})[_0x43e7('0x13')](function(_0x2a194d){logger[_0x43e7('0x2f')](_0x2a194d);_0x3a6404(null,![]);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x4f')]=function(_0x46748f,_0x406155){var _0x381208={'role':_0x43e7('0x4d')};_0x381208[_0x46748f]=this['channel']['callerid'];this[_0x43e7('0x14')]['agentLogout'](_0x381208)['then'](function(_0x50edb2){_0x406155(null,_[_0x43e7('0x43')](_0x50edb2)?![]:!![]);})[_0x43e7('0x13')](function(_0x5d7b37){logger[_0x43e7('0x2f')](_0x5d7b37);_0x406155(null,![]);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x50')]=function(_0x537a53,_0x2b7406){var _0x9771ad={'role':_0x43e7('0x4d')};_0x9771ad[_0x537a53]=this[_0x43e7('0xd')][_0x43e7('0x38')];var _0x472a19=_0x537a53!=_0x43e7('0x51')?util['format'](_0x43e7('0x52'),_0x43e7('0x53'),this[_0x43e7('0xd')]['callerid']):undefined;this['rpc'][_0x43e7('0x50')](_0x9771ad,_0x472a19)['then'](function(_0x5cb26e){_0x2b7406(null,_[_0x43e7('0x43')](_0x5cb26e)?![]:!![]);})[_0x43e7('0x13')](function(_0x5b5833){logger[_0x43e7('0x2f')](_0x5b5833);_0x2b7406(null,![]);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x54')]=function(_0x3401ec,_0x16499c){sh[_0x43e7('0x55')](_[_0x43e7('0x56')](_0x3401ec),function(_0x4ce33c,_0x10cf5d){var _0x1bb7ad=_0x10cf5d['replace'](/(\r\n|\n|\r)/gm,'');_0x16499c(null,_0x1bb7ad);});};AGIVertices[_0x43e7('0xe')]['googleCloudTTS']=function(_0x26ee52,_0x248936){scripts[_0x43e7('0x57')](_0x26ee52[_0x43e7('0x58')],_0x26ee52['google_cloud_tts_text_type']||_0x43e7('0x59'),_0x26ee52[_0x43e7('0x59')],_0x26ee52[_0x43e7('0x5a')]||'en-US',_0x26ee52[_0x43e7('0x5b')]||_0x43e7('0x5c'),_0x26ee52[_0x43e7('0x5d')]||_0x43e7('0x5e'))[_0x43e7('0x11')](function(_0x5f50d6){_0x248936(null,_0x5f50d6);})[_0x43e7('0x13')](function(_0x1afa94){_0x248936(_0x1afa94);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x5f')]=function(_0x433d3c,_0x8122f4){scripts[_0x43e7('0x5f')](_0x433d3c['text'],_0x433d3c['google_tts_language']||'en',0x1)[_0x43e7('0x11')](function(_0x536477){_0x8122f4(null,_0x536477);})['catch'](function(_0x5b98bf){_0x8122f4(_0x5b98bf);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x60')]=function(_0x230fda,_0x3041c3){var _0x18713b={'uri':_0x230fda[_0x43e7('0x61')],'method':_0x230fda['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x230fda[_0x43e7('0x62')])===_0x43e7('0x63')&&parseInt(_0x230fda[_0x43e7('0x62')])>=0x1?parseInt(_0x230fda['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x43e7('0x64')]([_0x43e7('0x65'),_0x43e7('0x66')],_0x18713b[_0x43e7('0x67')][_0x43e7('0x68')]())){try{_0x18713b[_0x43e7('0x69')]=_0x230fda[_0x43e7('0x6a')]?JSON[_0x43e7('0x6b')](_0x230fda['rawBody']):{};}catch(_0x52c757){logger['error'](_0x43e7('0x6c'),_0x52c757);}}try{_0x18713b[_0x43e7('0x6d')]=_0x230fda['rawHeaders']?JSON[_0x43e7('0x6b')](_0x230fda[_0x43e7('0x9')]):{};}catch(_0x41a18f){logger[_0x43e7('0x2f')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x41a18f);}if(_0x230fda['computedVariables']){try{var _0x5f5ac9=require(_0x230fda[_0x43e7('0x6e')])[_0x43e7('0x6f')](this,_0x18713b);_0x18713b['uri']=Mustache['render'](_0x230fda[_0x43e7('0x61')],_0x5f5ac9,{},['$$','$$']);if(_0x18713b[_0x43e7('0x6d')]){_0x18713b[_0x43e7('0x6d')]=JSON['parse'](Mustache[_0x43e7('0x70')](JSON[_0x43e7('0x71')](_0x18713b[_0x43e7('0x6d')]),_0x5f5ac9,{},['$$','$$']));}if(_0x18713b[_0x43e7('0x69')]){_0x18713b['body']=JSON[_0x43e7('0x6b')](Mustache['render'](JSON[_0x43e7('0x71')](_0x18713b[_0x43e7('0x69')]),_0x5f5ac9,{},['$$','$$']));}}catch(_0x24a168){logger[_0x43e7('0x2f')](_0x43e7('0x72'),_0x24a168);}}rp(_0x18713b)[_0x43e7('0x11')](function(_0x126133){var _0x5e8d4e={'statusCode':_0x126133[_0x43e7('0x73')]||0xc8,'statusMessage':_0x126133[_0x43e7('0x74')]||'OK','headers':_0x126133[_0x43e7('0x6d')]||{},'body':_0x126133[_0x43e7('0x69')]||{}};_0x3041c3(null,_0x5e8d4e);})['catch'](function(_0x55491f){var _0x4a8a2e={'statusCode':_0x55491f[_0x43e7('0x73')]||0x1f4,'statusMessage':_0x55491f['message']||_0x43e7('0x75'),'headers':_0x55491f[_0x43e7('0x76')][_0x43e7('0x6d')]||{},'body':_0x55491f[_0x43e7('0x76')][_0x43e7('0x69')]||{}};_0x3041c3(null,_0x4a8a2e);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x77')]=function(_0x1ea46d,_0x363af5){scripts[_0x43e7('0x77')](this[_0x43e7('0xd')]['uniqueid'],_0x1ea46d[_0x43e7('0x78')],_0x1ea46d[_0x43e7('0x59')],_0x1ea46d[_0x43e7('0x79')]||'en')[_0x43e7('0x11')](function(_0x206e54){_0x363af5(null,_0x206e54);})['catch'](function(_0x5e04ec){_0x363af5(_0x5e04ec);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x7a')]=function(_0x5c7f0a,_0x100c4d){scripts[_0x43e7('0x7a')](this['channel']['uniqueid'],_0x5c7f0a[_0x43e7('0x7b')],_0x5c7f0a[_0x43e7('0x7c')],_0x5c7f0a[_0x43e7('0x7d')],_0x5c7f0a[_0x43e7('0x59')],_0x5c7f0a[_0x43e7('0x7e')]||'en')['then'](function(_0x4b50bf){_0x100c4d(null,_0x4b50bf);})[_0x43e7('0x13')](function(_0x18c438){_0x100c4d(_0x18c438);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x7f')]=function(_0x56de87,_0x45dc61){scripts[_0x43e7('0x7f')](this[_0x43e7('0xd')],_0x56de87)[_0x43e7('0x11')](function(_0x5bc060){_0x45dc61(null,_0x5bc060);})[_0x43e7('0x13')](function(_0x3f55d5){_0x45dc61(_0x3f55d5);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x80')]=function(_0x403cfa,_0x4ef289){scripts[_0x43e7('0x80')](_0x403cfa[_0x43e7('0x78')],_0x403cfa['text'],_0x403cfa[_0x43e7('0x81')]||_0x43e7('0x82'),_0x403cfa[_0x43e7('0x83')])[_0x43e7('0x11')](function(_0x533504){_0x4ef289(null,_0x533504);})[_0x43e7('0x13')](function(_0x5abc01){_0x4ef289(_0x5abc01);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x84')]=function(_0x1cf302,_0x2614ff,_0x1588e3){scripts[_0x43e7('0x84')](_0x2614ff,_0x1cf302[_0x43e7('0x78')],_0x1cf302[_0x43e7('0x85')]||_0x43e7('0x82'),this['isConfigured'](_0x1cf302[_0x43e7('0x86')])?_0x1cf302[_0x43e7('0x86')]:undefined)[_0x43e7('0x11')](function(_0x438f41){_0x1588e3(null,_0x438f41);})['catch'](function(_0x519523){_0x1588e3(_0x519523);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x87')]=function(_0x213dea,_0x4d30f7){scripts[_0x43e7('0x87')](_0x213dea['aws_access_key_id'],_0x213dea['aws_secret_access_key'],_0x213dea['aws_polly_region'],_0x213dea[_0x43e7('0x88')]||'Amy',_0x213dea[_0x43e7('0x59')],_0x213dea[_0x43e7('0x89')]||_0x43e7('0x59'))[_0x43e7('0x11')](function(_0x405ab3){_0x4d30f7(null,_0x405ab3);})['catch'](function(_0x4d64c9){_0x4d30f7(_0x4d64c9);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x8a')]=function(_0x589751,_0x307d38){scripts[_0x43e7('0x8a')](this[_0x43e7('0xd')][_0x43e7('0x37')],_0x589751[_0x43e7('0x8b')],_0x589751[_0x43e7('0x8c')],_0x589751[_0x43e7('0x8d')],_0x589751[_0x43e7('0x59')],_0x589751[_0x43e7('0x8e')])[_0x43e7('0x11')](function(_0x610819){_0x307d38(null,_0x610819);})[_0x43e7('0x13')](function(_0x3d6502){_0x307d38(_0x3d6502);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x8f')]=function(_0x478450,_0x3286b1,_0x3036ff){scripts[_0x43e7('0x8f')](_0x3286b1,_0x478450[_0x43e7('0x78')],_0x478450[_0x43e7('0x90')]||_0x43e7('0x82'))['then'](function(_0xefc922){_0x3036ff(null,_0xefc922);})[_0x43e7('0x13')](function(_0x3a81fc){_0x3036ff(_0x3a81fc);});};AGIVertices[_0x43e7('0xe')]['tildeASR']=function(_0x3a3ada,_0x484978,_0x3f99a7){scripts[_0x43e7('0x91')](_0x484978,_0x3a3ada[_0x43e7('0x92')],_0x3a3ada[_0x43e7('0x93')],_0x3a3ada[_0x43e7('0x94')])[_0x43e7('0x11')](function(_0x4cdfcf){_0x3f99a7(null,_0x4cdfcf);})[_0x43e7('0x13')](function(_0x19cbed){_0x3f99a7(_0x19cbed);});};AGIVertices[_0x43e7('0xe')][_0x43e7('0x95')]=function(_0x16adad){var _0x5a40c2=_['includes'](verticesWithRetry,_0x16adad[_0x43e7('0x34')])?_0x16adad:_['clone'](_0x16adad);for(var _0x195e6f in _0x5a40c2){if(_0x5a40c2[_0x43e7('0x96')](_0x195e6f)){if(_0x5a40c2[_0x195e6f]&&_[_0x43e7('0x97')](_0x5a40c2[_0x195e6f])){if(_[_0x43e7('0x64')](recursiveMapAttributes,_0x195e6f)){_0x5a40c2[_0x195e6f]=this['replaceObjectAllVariables'](_0x5a40c2[_0x195e6f]);}else{_0x5a40c2[_0x195e6f]=this['replaceAllVariables'](_0x5a40c2[_0x195e6f]);}}}}return _0x5a40c2;};AGIVertices['prototype'][_0x43e7('0x98')]=function(_0x53b9eb){for(var _0x5cca5d in _0x53b9eb){if(_0x53b9eb['hasOwnProperty'](_0x5cca5d)){if(_[_0x43e7('0x99')](_0x53b9eb[_0x5cca5d])){this[_0x43e7('0x98')](_0x53b9eb[_0x5cca5d]);}else if(_['isArray'](_0x53b9eb[_0x5cca5d])){for(var _0x1206db=0x0;_0x1206db<_0x53b9eb[_0x5cca5d]['length'];_0x1206db++){this[_0x43e7('0x98')](_0x53b9eb[_0x5cca5d][_0x1206db]);}}else if(_[_0x43e7('0x97')](_0x53b9eb[_0x5cca5d])){_0x53b9eb[_0x5cca5d]=this[_0x43e7('0x9a')](_0x53b9eb[_0x5cca5d]);}}}};AGIVertices[_0x43e7('0xe')][_0x43e7('0x9b')]=function(_0x4efc11,_0x1f4162){for(var _0x449cb4 in _0x4efc11){if(_0x4efc11[_0x43e7('0x96')](_0x449cb4)){if(_['isPlainObject'](_0x4efc11[_0x449cb4])){if(!_['isEmpty'](_0x4efc11[_0x449cb4])){this[_0x43e7('0x9b')](_0x4efc11[_0x449cb4],util[_0x43e7('0x27')](_0x43e7('0x9c'),_0x1f4162,_0x449cb4));}}else if(_[_0x43e7('0x9d')](_0x4efc11[_0x449cb4])){for(var _0x55e7f2=0x0;_0x55e7f2<_0x4efc11[_0x449cb4][_0x43e7('0x9e')];_0x55e7f2++){this[_0x43e7('0x9b')](_0x4efc11[_0x449cb4][_0x55e7f2],util[_0x43e7('0x27')]('%s.%s',_0x1f4162,_0x449cb4+'['+_0x55e7f2+']'));}}else{if(!_[_0x43e7('0x43')](_0x4efc11[_0x449cb4])){this[_0x43e7('0xd')][_0x43e7('0x9f')](util[_0x43e7('0x27')]('%s.%s',_0x1f4162,_0x449cb4),_0x4efc11[_0x449cb4]);}}}}};AGIVertices[_0x43e7('0xe')]['replaceObjectAllVariables']=function(_0x299086){try{var _0x244d9d=JSON['parse'](_0x299086);this['recursiveNodeIndex'](_0x244d9d);return JSON[_0x43e7('0x71')](_0x244d9d);}catch(_0x1480c6){return this[_0x43e7('0x9a')](_0x299086);}};AGIVertices[_0x43e7('0xe')][_0x43e7('0x9a')]=function(_0x28986d){var _0x3abb0b=_0x28986d[_0x43e7('0xa0')]('{');for(var _0x1bff0a=0x1;_0x1bff0a<_0x3abb0b[_0x43e7('0x9e')];_0x1bff0a+=0x1){var _0x615c=_0x3abb0b[_0x1bff0a]['split']('}');if(_0x615c[_0x43e7('0x9e')]>0x1){_0x28986d=_0x28986d['replaceAll']('{'+_0x615c[0x0]+'}',this[_0x43e7('0xd')][_0x43e7('0xf')](_0x615c[0x0])[_0x43e7('0xa1')]||_0x615c[0x0]);}}if(_0x3abb0b['length']===0x1){return _0x28986d[_0x43e7('0x48')]();}return this[_0x43e7('0x9a')](_0x28986d);};AGIVertices[_0x43e7('0xe')][_0x43e7('0xa2')]=function(_0x5c34b7,_0x266fb1){var _0x125dc5=this['channel']['getVariable'](_0x5c34b7);if(_0x125dc5['result']===-0x1){return _0x125dc5;}logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0xa3'),_0x266fb1,_0x125dc5[_0x43e7('0xa1')]));return this[_0x43e7('0xd')][_0x43e7('0x9f')](_0x266fb1,_0x125dc5[_0x43e7('0xa1')]);};AGIVertices[_0x43e7('0xe')]['isConfigured']=function(_0xe7db8){return _0xe7db8&&_0xe7db8!=='0'&&_0xe7db8!=='-1'&&_0xe7db8!=='';};AGIVertices[_0x43e7('0xe')][_0x43e7('0xa4')]=function(_0x215426){this['createSquareDetailsReport']['sync'](this,_0x215426,'-');_0x215426[_0x43e7('0xa5')]=_0x215426[_0x43e7('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x43e7('0xe')][_0x43e7('0xa6')]=function(_0x5cf4bf){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0xa7'),_0x5cf4bf[_0x43e7('0x33')]));if(!this[_0x43e7('0xa8')](_0x5cf4bf[_0x43e7('0x59')])){return this['channel'][_0x43e7('0xa9')]('no\x20text\x20configured');}var _0x566cf7='\x22'+_0x5cf4bf[_0x43e7('0x59')]+'\x22';if(this[_0x43e7('0xa8')](_0x5cf4bf['options'])){_0x566cf7+=','+_0x5cf4bf['options'];}var _0x3a8cd1=this[_0x43e7('0xd')]['exec'](_0x43e7('0xaa'),_0x566cf7);if(_0x3a8cd1[_0x43e7('0xab')]===-0x1){return _0x3a8cd1;}return this[_0x43e7('0xd')][_0x43e7('0xa9')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x566cf7));};AGIVertices[_0x43e7('0xe')][_0x43e7('0xac')]=function(_0x4e477b){logger['info'](util['format'](_0x43e7('0xad'),_0x4e477b[_0x43e7('0x33')]));if(!this[_0x43e7('0xa8')](_0x4e477b[_0x43e7('0xae')])){return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0xaf'));}var _0x3c081d=_0x4e477b['grammar'];if(this['isConfigured'](_0x4e477b['options'])){_0x3c081d+=','+_0x4e477b[_0x43e7('0x76')];}var _0x50c319=this[_0x43e7('0xd')][_0x43e7('0x55')](_0x43e7('0xb0'),_0x3c081d);if(_0x50c319[_0x43e7('0xab')]===-0x1){return _0x50c319;}var _0x3664ee=this['getAndSetVariable'](_0x43e7('0xb1'),_0x43e7('0xb2'));if(_0x3664ee[_0x43e7('0xab')]===-0x1){return _0x3664ee;}var _0x2a2d7c=this['getAndSetVariable'](_0x43e7('0xb3'),_0x43e7('0xb4'));if(_0x2a2d7c[_0x43e7('0xab')]===-0x1){return _0x2a2d7c;}var _0x1ede62=this[_0x43e7('0xa2')](_0x43e7('0xb5'),_0x43e7('0xb6'));if(_0x1ede62['result']===-0x1){return _0x1ede62;}return this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0xb7'),_0x3c081d));};AGIVertices[_0x43e7('0xe')]['agi']=function(_0x1a20d0){logger[_0x43e7('0x2c')](util['format'](_0x43e7('0xb8'),_0x1a20d0[_0x43e7('0x33')]));return this['channel'][_0x43e7('0x5')]([_0x1a20d0[_0x43e7('0xb9')],_0x1a20d0[_0x43e7('0xba')]]);};AGIVertices[_0x43e7('0xe')][_0x43e7('0xbb')]=function(_0x56c00b){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0xbc'),_0x56c00b['label']));if(this[_0x43e7('0xa8')](_0x56c00b[_0x43e7('0x62')])){logger['info'](util[_0x43e7('0x27')](_0x43e7('0xbd'),_0x56c00b[_0x43e7('0x62')]));var _0x2dc13d=this[_0x43e7('0xd')][_0x43e7('0xbe')](_0x56c00b['timeout']);if(_0x2dc13d[_0x43e7('0xab')]===-0x1){return _0x2dc13d;}}return this[_0x43e7('0xd')][_0x43e7('0xbb')]();};AGIVertices['prototype'][_0x43e7('0x45')]=function(_0x21901c){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0xbf'),_0x21901c[_0x43e7('0x33')]));if(!this[_0x43e7('0xa8')](_0x21901c[_0x43e7('0xc0')])){return this[_0x43e7('0xd')]['error'](_0x21901c,_0x43e7('0xc1'));}_0x21901c[_0x43e7('0x47')]=moment();if(this[_0x43e7('0xa8')](_0x21901c[_0x43e7('0xc2')])){_0x21901c[_0x43e7('0x47')]=moment()[_0x43e7('0xc3')](_0x21901c[_0x43e7('0xc2')],_0x43e7('0xc4'));}if(!this['isConfigured'](_0x21901c[_0x43e7('0x49')])){_0x21901c[_0x43e7('0x49')]=0x2;}this[_0x43e7('0x3f')][_0x43e7('0x6f')](this,_0x21901c);return this[_0x43e7('0xd')]['noop'](util[_0x43e7('0x27')](_0x43e7('0xc5'),_0x21901c[_0x43e7('0x44')],_0x21901c[_0x43e7('0xc0')],_0x21901c[_0x43e7('0x47')]));};AGIVertices['prototype'][_0x43e7('0xc6')]=function(_0x4ea6da){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0xc7'),_0x4ea6da[_0x43e7('0x33')]));var _0x4b0abd=this[_0x43e7('0xd')][_0x43e7('0x55')](_0x4ea6da[_0x43e7('0xc8')],_0x4ea6da[_0x43e7('0x76')]);if(_0x4b0abd[_0x43e7('0xab')]===-0x1){return _0x4b0abd;}return this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0xc9'),_0x4ea6da[_0x43e7('0xc8')],_0x4ea6da[_0x43e7('0x76')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x2e1460){logger['info'](util['format'](_0x43e7('0xca'),_0x2e1460[_0x43e7('0x33')]));if(!this['isConfigured'](_0x2e1460[_0x43e7('0x59')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x3c496e='\x22'+_0x2e1460[_0x43e7('0x59')]+'\x22';if(this[_0x43e7('0xa8')](_0x2e1460[_0x43e7('0x76')])){_0x3c496e+=','+_0x2e1460[_0x43e7('0x76')];}var _0x3f3787=this[_0x43e7('0xd')][_0x43e7('0x55')](_0x43e7('0xaa'),_0x3c496e);if(_0x3f3787[_0x43e7('0xab')]===-0x1){return _0x3f3787;}return this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0xcb'),_0x3c496e));};AGIVertices[_0x43e7('0xe')][_0x43e7('0xcc')]=function(_0x2ecf7b){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0xcd'),_0x2ecf7b['label']));if(!this[_0x43e7('0xa8')](_0x2ecf7b[_0x43e7('0x59')])){return this['channel'][_0x43e7('0xa9')](_0x43e7('0xce'));}var _0x45a565='\x22'+_0x2ecf7b[_0x43e7('0x59')]+'\x22';if(this['isConfigured'](_0x2ecf7b[_0x43e7('0x76')])){_0x45a565+=','+_0x2ecf7b[_0x43e7('0x76')];}var _0x5b7225=this[_0x43e7('0xd')][_0x43e7('0x55')](_0x43e7('0xaa'),_0x45a565);if(_0x5b7225['result']===-0x1){return _0x5b7225;}return this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0xcb'),_0x45a565));};AGIVertices[_0x43e7('0xe')]['lumenvoxasr']=function(_0x33b63b){logger[_0x43e7('0x2c')](util['format'](_0x43e7('0xcf'),_0x33b63b['label']));if(!this['isConfigured'](_0x33b63b['grammar'])){return this['channel'][_0x43e7('0xa9')](_0x43e7('0xaf'));}var _0x7f518f=_0x33b63b[_0x43e7('0xae')];if(this['isConfigured'](_0x33b63b['options'])){_0x7f518f+=','+_0x33b63b[_0x43e7('0x76')];}var _0x5efb33=this[_0x43e7('0xd')]['exec'](_0x43e7('0xb0'),_0x7f518f);if(_0x5efb33['result']===-0x1){return _0x5efb33;}var _0x4fc72e=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x43e7('0xd0'));if(_0x4fc72e[_0x43e7('0xab')]===-0x1){return _0x4fc72e;}var _0x574658=this['getAndSetVariable'](_0x43e7('0xb3'),_0x43e7('0xd1'));if(_0x574658[_0x43e7('0xab')]===-0x1){return _0x574658;}var _0x51fd40=this[_0x43e7('0xa2')](_0x43e7('0xb5'),_0x43e7('0xd2'));if(_0x51fd40[_0x43e7('0xab')]===-0x1){return _0x51fd40;}return this['channel'][_0x43e7('0xa9')](util['format'](_0x43e7('0xb7'),_0x7f518f));};AGIVertices[_0x43e7('0xe')][_0x43e7('0xd3')]=function(_0x322c61){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0xd4'),_0x322c61['label']));if(!this[_0x43e7('0xa8')](_0x322c61[_0x43e7('0xae')])){return this['channel'][_0x43e7('0xa9')](_0x43e7('0xaf'));}var _0x107e6a=_0x322c61[_0x43e7('0xae')];if(this[_0x43e7('0xa8')](_0x322c61['options'])){_0x107e6a+=','+_0x322c61[_0x43e7('0x76')];}var _0x50d6f9=this[_0x43e7('0xd')]['exec'](_0x43e7('0xb0'),_0x107e6a);if(_0x50d6f9[_0x43e7('0xab')]===-0x1){return _0x50d6f9;}var _0x4446cb=this[_0x43e7('0xa2')](_0x43e7('0xb1'),'SESTEK_ASR_CONFIDENCE');if(_0x4446cb[_0x43e7('0xab')]===-0x1){return _0x4446cb;}var _0x5d70ed=this[_0x43e7('0xa2')](_0x43e7('0xb3'),_0x43e7('0xd5'));if(_0x5d70ed['result']===-0x1){return _0x5d70ed;}var _0x1a554e=this[_0x43e7('0xa2')](_0x43e7('0xb5'),_0x43e7('0xd6'));if(_0x1a554e[_0x43e7('0xab')]===-0x1){return _0x1a554e;}return this['channel'][_0x43e7('0xa9')](util['format'](_0x43e7('0xb7'),_0x107e6a));};AGIVertices[_0x43e7('0xe')][_0x43e7('0xd7')]=function(_0x2dd01e){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0xd8'),_0x2dd01e['label']));if(!this[_0x43e7('0xa8')](_0x2dd01e['odbc_id'])){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x2dd01e,_0x43e7('0xd9'));}var _0xbc6e18=this[_0x43e7('0x17')][_0x43e7('0x6f')](this,_0x2dd01e[_0x43e7('0xda')]);if(!_0xbc6e18){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x2dd01e,'no\x20odbc\x20database\x20found');}if(!this[_0x43e7('0xa8')](_0x2dd01e['query'])){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x2dd01e,'no\x20query\x20configured');}var _0x2085ec=_0x2dd01e[_0x43e7('0x2b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0xdb'),_0x2085ec));var _0x24fed8=this[_0x43e7('0x28')][_0x43e7('0x6f')](this,_0xbc6e18,_0x2085ec);this[_0x43e7('0x32')]['sync'](this,_0x2dd01e,_0x2085ec);if(!this[_0x43e7('0xa8')](_0x2dd01e[_0x43e7('0xdc')])){return this[_0x43e7('0xd')]['noop'](_0x43e7('0xdd'));}var _0x4440a9=this['getVariable'][_0x43e7('0x6f')](this,_0x2dd01e[_0x43e7('0xdc')]);if(!_0x4440a9){return this['channel'][_0x43e7('0x2f')](_0x2dd01e,_0x43e7('0xde'));}var _0x2c59ed=this;_0x24fed8['forEach'](function(_0x182fc6,_0x36f744){Object['keys'](_0x182fc6)[_0x43e7('0xdf')](function(_0x2ed5e0){_0x2c59ed[_0x43e7('0xd')][_0x43e7('0x9f')](util['format']('%s[%s][%s]',_0x4440a9,_0x36f744,_0x2ed5e0),_0x182fc6[_0x2ed5e0]);});});this[_0x43e7('0xd')][_0x43e7('0x9f')](util[_0x43e7('0x27')](_0x43e7('0xe0'),_0x4440a9),_0x24fed8['length']);return this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0xe1'),_0x4440a9));};AGIVertices['prototype'][_0x43e7('0xe2')]=function(_0x241780){logger[_0x43e7('0xe3')](util[_0x43e7('0x27')](_0x43e7('0xe4'),_0x241780['label']));if(!this['isConfigured'](_0x241780['sip_id'])){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x241780,_0x43e7('0xe5'));}var _0x4f95fb=this[_0x43e7('0xe6')]['sync'](this,_0x241780[_0x43e7('0xe7')]);if(!_0x4f95fb){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x241780,_0x43e7('0xe8'));}var _0x249a8d=this[_0x43e7('0xd')]['exec'](_0x43e7('0xe9'),[util[_0x43e7('0x27')](_0x43e7('0xea'),_0x4f95fb),_0x241780[_0x43e7('0x62')],_0x241780[_0x43e7('0xeb')],_0x241780[_0x43e7('0x61')]]);if(_0x249a8d[_0x43e7('0xab')]===-0x1){return _0x249a8d;}return this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0xec'),_0x43e7('0xe9')));};AGIVertices[_0x43e7('0xe')]['dialogflow']=function(_0x22f08d){logger[_0x43e7('0x2c')](util['format'](_0x43e7('0xed'),_0x22f08d[_0x43e7('0x33')]));if(!this['isConfigured'](_0x22f08d[_0x43e7('0x78')])){return this[_0x43e7('0xd')][_0x43e7('0xa9')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x22f08d[_0x43e7('0x59')])){return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0xce'));}this[_0x43e7('0xd')][_0x43e7('0xee')]=!![];this[_0x43e7('0x32')](_0x22f08d);this[_0x43e7('0x3e')](_0x22f08d['text'],'in','','');this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0xef'),_0x22f08d[_0x43e7('0x59')]));var _0xa30396=this[_0x43e7('0x77')][_0x43e7('0x6f')](this,_0x22f08d);if(_0xa30396){for(var _0x390f1f in _0xa30396){if(_0xa30396[_0x43e7('0x96')](_0x390f1f)){this[_0x43e7('0xd')][_0x43e7('0x9f')](util['format'](_0x43e7('0xf0'),_0x390f1f[_0x43e7('0x68')]()),_0xa30396[_0x390f1f]);}}this[_0x43e7('0x3e')](_0xa30396[_0x43e7('0xf1')],_0x43e7('0xf2'),_0x43e7('0xf3'),'');return this['channel'][_0x43e7('0xa9')](util['format'](_0x43e7('0xf4'),_0xa30396[_0x43e7('0xf1')]));}return this[_0x43e7('0xd')]['error'](_0x22f08d,_0x43e7('0xf5'));};AGIVertices[_0x43e7('0xe')]['dialogflowV2']=function(_0x1a2f46){logger['info'](util[_0x43e7('0x27')](_0x43e7('0xf6'),_0x1a2f46[_0x43e7('0x33')]));if(!this[_0x43e7('0xa8')](_0x1a2f46['dialogflowV2_project_id'])){return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0xf7'));}if(!this['isConfigured'](_0x1a2f46[_0x43e7('0x7c')])){return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0xf8'));}if(!this[_0x43e7('0xa8')](_0x1a2f46[_0x43e7('0x7d')])){return this['channel'][_0x43e7('0xa9')]('no\x20private_key\x20configured');}if(!this[_0x43e7('0xa8')](_0x1a2f46[_0x43e7('0x7e')])){return this['channel'][_0x43e7('0xa9')](_0x43e7('0xf9'));}if(!this['isConfigured'](_0x1a2f46[_0x43e7('0x59')])){return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0xce'));}this['channel']['bot']=!![];this[_0x43e7('0x32')](_0x1a2f46);this[_0x43e7('0x3e')](_0x1a2f46[_0x43e7('0x59')],'in','','');this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0xfa'),_0x1a2f46[_0x43e7('0x59')]));var _0x5e0d35=this[_0x43e7('0x7a')][_0x43e7('0x6f')](this,_0x1a2f46);if(_0x5e0d35){for(var _0x593092 in _0x5e0d35){if(_0x5e0d35[_0x43e7('0x96')](_0x593092)){if(_0x593092!==_0x43e7('0xfb')){this[_0x43e7('0xd')][_0x43e7('0x9f')](util[_0x43e7('0x27')](_0x43e7('0xf0'),_0x593092[_0x43e7('0x68')]()),_0x5e0d35[_0x593092]);}}}this['createSquareMessage'](_0x5e0d35[_0x43e7('0xf1')],'out',_0x43e7('0xfc'),_0x5e0d35[_0x43e7('0xfb')]);return this['channel'][_0x43e7('0xa9')](util['format'](_0x43e7('0xfd'),_0x5e0d35[_0x43e7('0xf1')]));}return this[_0x43e7('0xd')]['error'](_0x1a2f46,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x43e7('0xe')][_0x43e7('0xfe')]=function(_0x4cd879){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0xff'),_0x4cd879['label']));if(!this[_0x43e7('0xa8')](_0x4cd879[_0x43e7('0x100')])){return this[_0x43e7('0xd')]['noop'](_0x43e7('0x101'));}if(!this[_0x43e7('0xa8')](_0x4cd879[_0x43e7('0x102')])){return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0x103'));}if(!this['isConfigured'](_0x4cd879[_0x43e7('0x104')])){return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0x105'));}if(!this[_0x43e7('0xa8')](_0x4cd879[_0x43e7('0x106')])){return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0xce'));}this[_0x43e7('0xd')][_0x43e7('0xee')]=!![];this[_0x43e7('0x32')](_0x4cd879);this['createSquareMessage'](_0x4cd879['text'],'in','','');this['channel']['noop'](util[_0x43e7('0x27')](_0x43e7('0x107'),_0x4cd879[_0x43e7('0x59')]));var _0x36ca29=this[_0x43e7('0x7f')][_0x43e7('0x6f')](this,_0x4cd879);if(_0x36ca29){for(var _0x51dc07 in _0x36ca29){if(_0x36ca29['hasOwnProperty'](_0x51dc07)){this[_0x43e7('0xd')][_0x43e7('0x9f')](util['format']('SESTEK_NDA_%s',_0x51dc07[_0x43e7('0x68')]()),_0x36ca29[_0x51dc07]);}}this[_0x43e7('0x3e')](_0x36ca29['speech'],_0x43e7('0xf2'),'sesteknda','');if(_0x36ca29['audiofile']){this[_0x43e7('0xd')][_0x43e7('0xa9')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x36ca29[_0x43e7('0x108')]));var _0x1c6dbb=this[_0x43e7('0xd')][_0x43e7('0x109')](_0x36ca29['audiofile']);try{fs[_0x43e7('0x10a')](_0x36ca29[_0x43e7('0x108')]+'.wav');}catch(_0x560373){logger['error'](_0x560373);}return _0x1c6dbb;}else{return this['channel'][_0x43e7('0xa9')](util[_0x43e7('0x27')]('SestekNDA\x20Result\x20%s',_0x36ca29['speech']));}}return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x4cd879,_0x43e7('0x10b'));};AGIVertices[_0x43e7('0xe')][_0x43e7('0x10c')]=function(_0x56a34f){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x10d'),_0x56a34f[_0x43e7('0x33')]));return this[_0x43e7('0xd')]['noop'](_0x43e7('0x10c'));};AGIVertices[_0x43e7('0xe')][_0x43e7('0x10e')]=function(_0x20ecb5){logger['info'](util[_0x43e7('0x27')](_0x43e7('0x10f'),_0x20ecb5[_0x43e7('0x33')]));var _0x1d6ea4='';if(_0x20ecb5[_0x43e7('0x110')]){if(!this[_0x43e7('0xa8')](_0x20ecb5['trunk_id'])){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x20ecb5,_0x43e7('0x111'));}else{var _0x7141d4=parseInt(_0x20ecb5['trunk_id'],0xa);if(isNaN(_0x7141d4)){_0x1d6ea4=_0x20ecb5[_0x43e7('0x110')];}else{_0x1d6ea4=this['getTrunk'][_0x43e7('0x6f')](this,_0x20ecb5['trunk_id']);if(!_0x1d6ea4){return this[_0x43e7('0xd')]['error'](_0x20ecb5,_0x43e7('0x112'));}}}}else if(_0x20ecb5['trunk_name']){_0x1d6ea4=_0x20ecb5[_0x43e7('0x113')];}else{return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x20ecb5,_0x43e7('0x111'));}var _0x10ac87=this[_0x43e7('0xd')][_0x43e7('0x55')](_0x43e7('0xe9'),[util[_0x43e7('0x27')](_0x43e7('0x114'),_0x1d6ea4,_0x20ecb5['phone']),_0x20ecb5['timeout'],_0x20ecb5['opts'],_0x20ecb5[_0x43e7('0x61')]]);if(_0x10ac87['result']===-0x1){return _0x10ac87;}return this['channel'][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0xec'),_0x43e7('0xe9')));};AGIVertices[_0x43e7('0xe')][_0x43e7('0x115')]=function(_0x15988f){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x116'),_0x15988f[_0x43e7('0x33')]));return this['channel'][_0x43e7('0xa9')](_0x43e7('0x115'));};AGIVertices[_0x43e7('0xe')]['getdigits']=function(_0x357193){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x357193[_0x43e7('0x33')]));if(_0x357193[_0x43e7('0xa5')]===0x0){return this[_0x43e7('0xa4')](_0x357193);}_0x357193[_0x43e7('0xa5')]-=0x1;if(!this[_0x43e7('0xa8')](_0x357193[_0x43e7('0x117')])){return this[_0x43e7('0xd')]['error'](_0x357193,'no\x20file\x20audio\x20selected');}var _0x1abb4b=this[_0x43e7('0x118')][_0x43e7('0x6f')](this,_0x357193['file_id']);if(!_0x1abb4b){return this['channel'][_0x43e7('0x2f')](_0x357193,'no\x20file\x20audio\x20found');}if(!this[_0x43e7('0xa8')](_0x357193['variable_id'])){return this[_0x43e7('0xd')][_0x43e7('0x2f')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4f7501=this[_0x43e7('0xd')][_0x43e7('0x119')](_0x1abb4b,_0x357193[_0x43e7('0x11a')],_0x357193['maxdigit']);var _0x3f7d4c=_0x4f7501[_0x43e7('0xab')]?_0x4f7501[_0x43e7('0xab')][_0x43e7('0x48')]():'';logger['info']('test',JSON[_0x43e7('0x71')](_0x4f7501));if(_0x4f7501['result']===-0x1){this['createSquareDetailsReport'][_0x43e7('0x6f')](this,_0x357193,_0x3f7d4c);return _0x4f7501;}else if(_0x4f7501[_0x43e7('0xa1')]===_0x43e7('0x62')){_0x4f7501[_0x43e7('0xab')]=_0x3f7d4c['length']>=parseInt(_0x357193[_0x43e7('0x11b')])?'x':'i';}else{_0x4f7501[_0x43e7('0xab')]=_0x3f7d4c[_0x43e7('0x9e')]>=parseInt(_0x357193[_0x43e7('0x11b')])&&_0x3f7d4c[_0x43e7('0x9e')]<=parseInt(_0x357193[_0x43e7('0x11c')])?'x':'i';}var _0x5ea384=this['getVariable'][_0x43e7('0x6f')](this,_0x357193[_0x43e7('0xdc')]);if(!_0x5ea384){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x357193,_0x43e7('0xde'));}this[_0x43e7('0xd')]['setVariable'](_0x5ea384,_0x3f7d4c);if(this[_0x43e7('0xa8')](_0x357193[_0x43e7('0x11d')])){var _0xfd8f4=parseInt(_0x357193[_0x43e7('0x11d')],0xa);var _0x542dc2=rs[_0x43e7('0x11e')]({'charset':'*','length':_0xfd8f4});var _0x50e4a1=_0x3f7d4c[_0x43e7('0x9e')];if(_0x50e4a1>0x0){if(_0x50e4a1>_0xfd8f4){this[_0x43e7('0x32')]['sync'](this,_0x357193,_0x357193[_0x43e7('0x11f')]==='first'?_0x542dc2+_0x3f7d4c[_0x43e7('0x120')](_0xfd8f4):_0x3f7d4c[_0x43e7('0x120')](0x0,_0x50e4a1-_0xfd8f4)+_0x542dc2);}else{this['createSquareDetailsReport'][_0x43e7('0x6f')](this,_0x357193,rs[_0x43e7('0x11e')]({'charset':'*','length':_0x50e4a1}));}}else{this[_0x43e7('0x32')][_0x43e7('0x6f')](this,_0x357193,'');}}else{this[_0x43e7('0x32')][_0x43e7('0x6f')](this,_0x357193,_0x3f7d4c);}return _0x4f7501;};AGIVertices[_0x43e7('0xe')][_0x43e7('0xc')]=function(_0x215509){logger['info'](util['format'](_0x43e7('0x121'),_0x215509[_0x43e7('0x33')]));return this[_0x43e7('0xb')](_0x215509);};AGIVertices[_0x43e7('0xe')]['goal']=function(_0x35e832){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x122'),_0x35e832[_0x43e7('0x33')]));this[_0x43e7('0x32')][_0x43e7('0x6f')](this,_0x35e832,_0x35e832['goalname']);return this[_0x43e7('0xd')]['noop'](util['format']('GOAL\x20%s',_0x35e832[_0x43e7('0x123')]));};AGIVertices[_0x43e7('0xe')][_0x43e7('0x124')]=function(_0x11aae6){logger[_0x43e7('0x2c')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x11aae6[_0x43e7('0x33')]));if(!this['isConfigured'](_0x11aae6[_0x43e7('0x8b')])||!this['isConfigured'](_0x11aae6[_0x43e7('0x8c')])){return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0x125'));}if(!this['isConfigured'](_0x11aae6['text'])){return this[_0x43e7('0xd')][_0x43e7('0xa9')]('no\x20text\x20configured');}this['channel'][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0x126'),_0x11aae6[_0x43e7('0x59')]));var _0x764c70=this[_0x43e7('0x87')][_0x43e7('0x6f')](this,_0x11aae6);if(_0x764c70){this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')]('aws\x20Polly\x20%s\x20file\x20created',_0x764c70));var _0x43bda1=this[_0x43e7('0xd')][_0x43e7('0x109')](_0x764c70);try{fs[_0x43e7('0x10a')](_0x764c70+'.wav');}catch(_0x17091a){logger['error'](_0x17091a);}return _0x43bda1;}return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x11aae6,_0x43e7('0x127'));};AGIVertices[_0x43e7('0xe')]['awslex']=function(_0x52928f){logger[_0x43e7('0x2c')](util['format'](_0x43e7('0x128'),_0x52928f[_0x43e7('0x33')]));if(!this[_0x43e7('0xa8')](_0x52928f[_0x43e7('0x8b')])||!this['isConfigured'](_0x52928f[_0x43e7('0x8c')])){return this[_0x43e7('0xd')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x43e7('0xa8')](_0x52928f[_0x43e7('0x8e')])){return this[_0x43e7('0xd')][_0x43e7('0xa9')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x52928f[_0x43e7('0x59')])){return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0xce'));}this[_0x43e7('0xd')][_0x43e7('0xee')]=!![];this[_0x43e7('0x32')](_0x52928f);this['createSquareMessage'](_0x52928f[_0x43e7('0x59')],'in','','');this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0x129'),_0x52928f[_0x43e7('0x59')]));var _0x43cf45=this[_0x43e7('0x8a')][_0x43e7('0x6f')](this,_0x52928f);if(_0x43cf45){for(var _0x2f24d4 in _0x43cf45){if(_0x43cf45[_0x43e7('0x96')](_0x2f24d4)&&_[_0x43e7('0x97')](_0x43cf45[_0x2f24d4])){this[_0x43e7('0xd')][_0x43e7('0x9f')](util[_0x43e7('0x27')](_0x43e7('0x12a'),_0x2f24d4[_0x43e7('0x68')]()),_0x43cf45[_0x2f24d4]);}}if(_['isNil'](_0x43cf45[_0x43e7('0x12b')])){return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0x12c'));}else{this[_0x43e7('0x3e')](_0x43cf45['message'],_0x43e7('0xf2'),_0x43e7('0x12d'),'');return this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')]('Amazon\x20Lex\x20Result\x20%s',_0x43cf45[_0x43e7('0x12b')]));}}return this['channel']['error'](_0x52928f,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x43e7('0xe')][_0x43e7('0x12e')]=function(_0x2a023c){logger['info'](util[_0x43e7('0x27')](_0x43e7('0x12f'),_0x2a023c['label'],_0x2a023c[_0x43e7('0x62')]));if(!this[_0x43e7('0xa8')](_0x2a023c['key'])){return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0x130'));}var _0x3827a3=_0x43e7('0x131');var _0x57cc9e=util[_0x43e7('0x27')](_0x43e7('0x132'),FILES_PATH,rs[_0x43e7('0x11e')](0x4));var _0xd589e8=util[_0x43e7('0x27')]('%s.%s',_0x57cc9e,_0x3827a3);var _0x5b046d=!![];if(_0x2a023c['beep']===_0x43e7('0x133')){_0x5b046d=![];}var _0x2287b9=this[_0x43e7('0xd')][_0x43e7('0x134')](_0x57cc9e,_0x3827a3,_0x2a023c['intKey'],_0x2a023c[_0x43e7('0x62')],undefined,_0x5b046d);if(_0x2287b9[_0x43e7('0xab')]!==-0x1){this[_0x43e7('0xd')]['noop'](util[_0x43e7('0x27')]('google\x20%s\x20file\x20created',_0xd589e8));var _0x20ee93=this[_0x43e7('0x8f')][_0x43e7('0x6f')](this,_0x2a023c,_0xd589e8);if(_0x20ee93){for(var _0x40cc83 in _0x20ee93){if(_0x20ee93[_0x43e7('0x96')](_0x40cc83)){this[_0x43e7('0xd')][_0x43e7('0x9f')](util[_0x43e7('0x27')](_0x43e7('0x135'),_0x40cc83['toUpperCase']()),_0x20ee93[_0x40cc83]);}}return this[_0x43e7('0xd')][_0x43e7('0xa9')](util['format']('GoogleASR\x20Result\x20%s',JSON[_0x43e7('0x71')](_0x20ee93)));}}return _0x2287b9;};AGIVertices[_0x43e7('0xe')][_0x43e7('0x136')]=function(_0x31ef9c){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x137'),_0x31ef9c[_0x43e7('0x33')]));if(!this[_0x43e7('0xa8')](_0x31ef9c[_0x43e7('0x92')])){return this[_0x43e7('0xd')]['noop'](_0x43e7('0x138'));}if(!this['isConfigured'](_0x31ef9c[_0x43e7('0x93')])){return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0x139'));}var _0x58cba1=_0x43e7('0x131');var _0x43fc5b=util['format'](_0x43e7('0x132'),FILES_PATH,rs[_0x43e7('0x11e')](0x4));var _0x44b8f3=util[_0x43e7('0x27')](_0x43e7('0x9c'),_0x43fc5b,_0x58cba1);var _0x42cbe5=!![];if(_0x31ef9c[_0x43e7('0x13a')]==='NOBEEP'){_0x42cbe5=![];}var _0x29acad=this[_0x43e7('0xd')][_0x43e7('0x134')](_0x43fc5b,_0x58cba1,_0x31ef9c[_0x43e7('0x13b')],_0x31ef9c[_0x43e7('0x62')],undefined,_0x42cbe5);if(_0x29acad[_0x43e7('0xab')]!==-0x1){this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')]('tilde\x20%s\x20file\x20created',_0x44b8f3));var _0x9050c8=this['tildeASR'][_0x43e7('0x6f')](this,_0x31ef9c,_0x44b8f3);if(_0x9050c8){for(var _0x2189f7 in _0x9050c8){if(_0x9050c8[_0x43e7('0x96')](_0x2189f7)){this[_0x43e7('0xd')][_0x43e7('0x9f')](util[_0x43e7('0x27')](_0x43e7('0x13c'),_0x2189f7['toUpperCase']()),_0x9050c8[_0x2189f7]);}}return this[_0x43e7('0xd')]['noop'](util['format'](_0x43e7('0x13d'),JSON['stringify'](_0x9050c8)));}}return _0x29acad;};AGIVertices['prototype'][_0x43e7('0x13e')]=function(_0x759eb5){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x759eb5[_0x43e7('0x33')]));return this['channel'][_0x43e7('0x13f')](_0x759eb5[_0x43e7('0x140')],_0x759eb5[_0x43e7('0x3a')],_0x759eb5[_0x43e7('0x3b')]);};AGIVertices[_0x43e7('0xe')]['gotoif']=function(_0x5e0c9a){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x5e0c9a[_0x43e7('0x33')]));if(!this[_0x43e7('0xa8')](_0x5e0c9a[_0x43e7('0x141')])){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x5e0c9a,'no\x20condition\x20configured');}try{var _0x43b379=eval(_0x5e0c9a[_0x43e7('0x141')])?_0x43e7('0x142'):_0x43e7('0x143');this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')]('EVAL\x20CONDITION\x20%s\x20%s',_0x5e0c9a[_0x43e7('0x141')],_0x43b379));return{'code':0xc8,'result':_0x43b379};}catch(_0x266119){return{'code':0xc8,'result':_0x43e7('0x143')};}};AGIVertices[_0x43e7('0xe')][_0x43e7('0x144')]=function(_0x1c5068){logger['info'](util[_0x43e7('0x27')](_0x43e7('0x145'),_0x1c5068[_0x43e7('0x33')]));if(!this[_0x43e7('0xa8')](_0x1c5068[_0x43e7('0x146')])){return this[_0x43e7('0xd')]['error'](_0x1c5068,'no\x20interval\x20configured');}var _0x2fed6f=this[_0x43e7('0x22')]['sync'](this,_0x1c5068['interval_id']);if(!_0x2fed6f){return this['channel'][_0x43e7('0x2f')](_0x1c5068,'no\x20intervals\x20found');}for(var _0x4f6ada=0x0;_0x4f6ada<_0x2fed6f[_0x43e7('0x9e')];_0x4f6ada+=0x1){var _0x2566bb=this[_0x43e7('0xd')]['getVariable'](util['format']('IFTIME(%s?true:false)',_0x2fed6f[_0x4f6ada]));if(_0x2566bb[_0x43e7('0xab')]===-0x1){return _0x2566bb;}logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x147'),_0x2fed6f[_0x4f6ada],_0x2566bb['extra']));if(_0x2566bb['extra']===_0x43e7('0x142')){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x147'),_0x2fed6f[_0x4f6ada],_0x43e7('0x142')));this['channel'][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0x147'),_0x2fed6f[_0x4f6ada],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x147'),_0x2fed6f[_0x4f6ada],'false'));this['channel']['noop'](util[_0x43e7('0x27')](_0x43e7('0x147'),_0x2fed6f[_0x4f6ada],_0x43e7('0x143')));}}return{'code':0xc8,'result':_0x43e7('0x143')};};AGIVertices[_0x43e7('0xe')]['hangup']=function(_0x1a0e07){logger[_0x43e7('0x2c')](util['format'](_0x43e7('0x148'),_0x1a0e07[_0x43e7('0x33')]));return this[_0x43e7('0xd')][_0x43e7('0x149')]();};AGIVertices[_0x43e7('0xe')]['ispeechasr']=function(_0x2f779c){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x14a'),_0x2f779c[_0x43e7('0x33')]));if(!this['isConfigured'](_0x2f779c[_0x43e7('0x78')])){return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0x130'));}var _0x441bff=_0x43e7('0x131');var _0x164489=util[_0x43e7('0x27')](_0x43e7('0x132'),FILES_PATH,rs[_0x43e7('0x11e')](0x4));var _0x3b0fd9=util['format']('%s.%s',_0x164489,_0x441bff);var _0x16bde9=!![];if(_0x2f779c[_0x43e7('0x13a')]===_0x43e7('0x133')){_0x16bde9=![];}var _0x54f172=this[_0x43e7('0xd')]['recordFile'](_0x164489,_0x441bff,_0x2f779c[_0x43e7('0x13b')],_0x2f779c[_0x43e7('0x62')],undefined,_0x16bde9);if(_0x54f172['result']!==-0x1){this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0x14b'),_0x3b0fd9));var _0x245f41=this[_0x43e7('0x84')]['sync'](this,_0x2f779c,_0x3b0fd9);if(_0x245f41){for(var _0x4418f7 in _0x245f41){if(_0x245f41['hasOwnProperty'](_0x4418f7)){this[_0x43e7('0xd')][_0x43e7('0x9f')](util[_0x43e7('0x27')](_0x43e7('0x14c'),_0x4418f7['toUpperCase']()),_0x245f41[_0x4418f7]);}}return this[_0x43e7('0xd')]['noop'](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x43e7('0x71')](_0x245f41)));}}return _0x54f172;};AGIVertices[_0x43e7('0xe')][_0x43e7('0x14d')]=function(_0xee437a){logger['info'](util[_0x43e7('0x27')](_0x43e7('0x14e'),_0xee437a[_0x43e7('0x33')]));if(!this[_0x43e7('0xa8')](_0xee437a[_0x43e7('0x78')])){return this['channel'][_0x43e7('0xa9')]('no\x20key\x20configured');}if(!this[_0x43e7('0xa8')](_0xee437a['text'])){return this[_0x43e7('0xd')][_0x43e7('0xa9')]('no\x20text\x20configured');}this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')]('Trying\x20ispeech\x20TTS\x20%s',_0xee437a[_0x43e7('0x59')]));var _0x4e9660=this['ispeechTTS'][_0x43e7('0x6f')](this,_0xee437a);if(_0x4e9660){this['channel'][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0x14b'),_0x4e9660));var _0x314ad0=this[_0x43e7('0xd')][_0x43e7('0x109')](_0x4e9660,_0xee437a[_0x43e7('0x13b')]);try{fs[_0x43e7('0x10a')](_0x4e9660+_0x43e7('0x14f'));}catch(_0x326728){logger[_0x43e7('0x2f')](_0x326728);}return _0x314ad0;}return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0xee437a,_0x43e7('0x150'));};AGIVertices[_0x43e7('0xe')][_0x43e7('0x151')]=function(_0x2053aa){logger['info'](util['format'](_0x43e7('0x152'),_0x2053aa[_0x43e7('0x33')]));if(!this['isConfigured'](_0x2053aa[_0x43e7('0x153')])){return this[_0x43e7('0xd')]['error'](_0x2053aa,'no\x20find\x20by\x20configured');}logger[_0x43e7('0x2c')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x43e7('0xd')]['callerid'],_0x2053aa[_0x43e7('0x153')]));var _0x6c6a87=this[_0x43e7('0x50')][_0x43e7('0x6f')](this,_0x2053aa[_0x43e7('0x153')]);if(_0x6c6a87){logger['info'](util[_0x43e7('0x27')](_0x43e7('0x154'),this[_0x43e7('0xd')][_0x43e7('0x38')],_0x2053aa[_0x43e7('0x153')]));this[_0x43e7('0xd')][_0x43e7('0xa9')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x43e7('0x38')],_0x2053aa[_0x43e7('0x153')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x43e7('0x27')](_0x43e7('0x155'),this[_0x43e7('0xd')][_0x43e7('0x38')],_0x2053aa[_0x43e7('0x153')]));this[_0x43e7('0xd')]['noop'](util[_0x43e7('0x27')](_0x43e7('0x155'),this[_0x43e7('0xd')][_0x43e7('0x38')],_0x2053aa['findBy']));return{'code':0xc8,'result':_0x43e7('0x156')};}};AGIVertices[_0x43e7('0xe')][_0x43e7('0x157')]=function(_0x310650){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x310650['label']));if(!this[_0x43e7('0xa8')](_0x310650[_0x43e7('0x153')])){return this['channel'][_0x43e7('0x2f')](_0x310650,_0x43e7('0x158'));}logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x159'),this[_0x43e7('0xd')][_0x43e7('0x38')],_0x310650[_0x43e7('0x153')]));var _0xe7efc9=this[_0x43e7('0x4f')]['sync'](this,_0x310650[_0x43e7('0x153')]);if(_0xe7efc9){logger[_0x43e7('0x2c')](util['format'](_0x43e7('0x154'),this[_0x43e7('0xd')][_0x43e7('0x38')],_0x310650[_0x43e7('0x153')]));this[_0x43e7('0xd')][_0x43e7('0xa9')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x43e7('0xd')][_0x43e7('0x38')],_0x310650[_0x43e7('0x153')]));return{'code':0xc8,'result':_0x43e7('0x15a')};}else{logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x155'),this[_0x43e7('0xd')][_0x43e7('0x38')],_0x310650[_0x43e7('0x153')]));this[_0x43e7('0xd')][_0x43e7('0xa9')](util['format'](_0x43e7('0x155'),this[_0x43e7('0xd')][_0x43e7('0x38')],_0x310650['findBy']));return{'code':0xc8,'result':_0x43e7('0x156')};}};AGIVertices[_0x43e7('0xe')][_0x43e7('0x15b')]=function(_0x5459cc){logger['info'](util[_0x43e7('0x27')](_0x43e7('0x15c'),_0x5459cc[_0x43e7('0x33')]));if(!this['isConfigured'](_0x5459cc['operation'])){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x5459cc,_0x43e7('0x15d'));}this[_0x43e7('0xd')]['noop'](util[_0x43e7('0x27')]('math\x20%s',_0x5459cc[_0x43e7('0x15e')]));var _0x262cc1=eval(_0x5459cc[_0x43e7('0x15e')]);if(!this[_0x43e7('0xa8')](_0x5459cc[_0x43e7('0xdc')])){return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0xdd'));}var _0x3f86d0=this['getVariable']['sync'](this,_0x5459cc[_0x43e7('0xdc')]);if(!_0x3f86d0){return this[_0x43e7('0xd')]['error'](_0x5459cc,_0x43e7('0xde'));}if(_['isArray'](_0x262cc1)){var _0x76fd0=this;_0x262cc1[_0x43e7('0xdf')](function(_0xbd8c44,_0x2fba80){_0x76fd0[_0x43e7('0xd')][_0x43e7('0x9f')](util[_0x43e7('0x27')](_0x43e7('0x15f'),_0x3f86d0,_0x2fba80),_0xbd8c44);});return this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')]('variable\x20%s[key]\x20set',_0x3f86d0));}else{return this[_0x43e7('0xd')][_0x43e7('0x9f')](_0x3f86d0,_0x262cc1);}};AGIVertices[_0x43e7('0xe')][_0x43e7('0xa')]=function(_0x3da446){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x160'),_0x3da446[_0x43e7('0x33')]));if(_0x3da446['retry']===0x0){return this['maxRetry'](_0x3da446);}_0x3da446[_0x43e7('0xa5')]-=0x1;if(!this[_0x43e7('0xa8')](_0x3da446[_0x43e7('0x117')])){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x3da446,_0x43e7('0x161'));}var _0x4a7185=this[_0x43e7('0x118')][_0x43e7('0x6f')](this,_0x3da446[_0x43e7('0x117')]);if(!_0x4a7185){return this['channel']['error'](_0x3da446,_0x43e7('0x162'));}var _0x2c5000=this['channel'][_0x43e7('0x119')](_0x4a7185,_0x3da446[_0x43e7('0x11a')],_0x3da446[_0x43e7('0x163')]);var _0x63bad=_0x2c5000['result'];if(_0x2c5000[_0x43e7('0xab')]===-0x1){this[_0x43e7('0x32')][_0x43e7('0x6f')](this,_0x3da446,'-1');return _0x2c5000;}else if(_0x2c5000['extra']===_0x43e7('0x62')){_0x2c5000[_0x43e7('0xab')]=_0x2c5000[_0x43e7('0xab')][_0x43e7('0x9e')]>0x0?_0x2c5000[_0x43e7('0xab')]:'t';}else if(_[_0x43e7('0x40')](_0x2c5000[_0x43e7('0xab')])){_0x2c5000[_0x43e7('0xab')]='#';_0x63bad='#';}if(!this[_0x43e7('0xa8')](_0x3da446[_0x43e7('0xdc')])){this['channel']['noop'](_0x43e7('0xdd'));}else{var _0x14f20e=this[_0x43e7('0xf')][_0x43e7('0x6f')](this,_0x3da446[_0x43e7('0xdc')]);if(!_0x14f20e){return this['channel'][_0x43e7('0x2f')](_0x3da446,_0x43e7('0xde'));}this[_0x43e7('0xd')][_0x43e7('0x9f')](_0x14f20e,_0x63bad);}this['createSquareDetailsReport']['sync'](this,_0x3da446,_0x63bad);return _0x2c5000;};AGIVertices[_0x43e7('0xe')][_0x43e7('0xa9')]=function(_0x356745){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x356745[_0x43e7('0x33')]));return this['channel']['noop'](_0x356745[_0x43e7('0x164')]||_0x356745['label']);};AGIVertices['prototype'][_0x43e7('0x165')]=function(_0x533ff1){logger['info'](util[_0x43e7('0x27')](_0x43e7('0x166'),_0x533ff1[_0x43e7('0x33')]));if(!this['isConfigured'](_0x533ff1[_0x43e7('0x153')])){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x533ff1,_0x43e7('0x158'));}logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x159'),this['channel']['callerid'],_0x533ff1[_0x43e7('0x153')]));var _0x13373e=this[_0x43e7('0x4a')][_0x43e7('0x6f')](this,_0x533ff1[_0x43e7('0x167')]);var _0x10d4a6=this['agentPause'][_0x43e7('0x6f')](this,_0x533ff1[_0x43e7('0x153')],_0x13373e);if(_0x10d4a6){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x154'),this['channel'][_0x43e7('0x38')],_0x533ff1[_0x43e7('0x153')]));this[_0x43e7('0xd')][_0x43e7('0xa9')](util['format'](_0x43e7('0x154'),this[_0x43e7('0xd')][_0x43e7('0x38')],_0x533ff1[_0x43e7('0x153')]));return{'code':0xc8,'result':_0x43e7('0x15a')};}else{logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x155'),this[_0x43e7('0xd')][_0x43e7('0x38')],_0x533ff1[_0x43e7('0x153')]));this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0x154'),this['channel'][_0x43e7('0x38')],_0x533ff1[_0x43e7('0x153')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x43e7('0xe')][_0x43e7('0x168')]=function(_0xbfea5a){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x169'),_0xbfea5a['label']));if(!this['isConfigured'](_0xbfea5a[_0x43e7('0x117')])){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0xbfea5a,_0x43e7('0x161'));}var _0xeb8ae5=this['getSound'][_0x43e7('0x6f')](this,_0xbfea5a[_0x43e7('0x117')]);if(!_0xeb8ae5){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0xbfea5a,_0x43e7('0x162'));}var _0x5067aa=this[_0x43e7('0xd')]['exec'](_0x43e7('0x16a'),[_0xeb8ae5,_0xbfea5a['opts']]);if(_0x5067aa['result']===-0x1){return _0x5067aa;}return this[_0x43e7('0xd')][_0x43e7('0xa9')](util['format'](_0x43e7('0xc9'),_0x43e7('0x16a'),_0xeb8ae5));};AGIVertices[_0x43e7('0xe')][_0x43e7('0x16b')]=function(_0x279962){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x279962[_0x43e7('0x33')]));if(!this[_0x43e7('0xa8')](_0x279962[_0x43e7('0x16c')])){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x279962,_0x43e7('0x16d'));}var _0x2cb397='';var _0x5efc41=parseInt(_0x279962[_0x43e7('0x16c')],0xa);if(isNaN(_0x5efc41)){_0x2cb397=_0x279962[_0x43e7('0x16c')];}else{_0x2cb397=this[_0x43e7('0x16e')][_0x43e7('0x6f')](this,_0x279962[_0x43e7('0x16c')]);if(!_0x2cb397){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x279962,_0x43e7('0x16f'));}}var _0x25211a='';if(this[_0x43e7('0xa8')](_0x279962['file_id'])){var _0x48af25=this[_0x43e7('0x118')][_0x43e7('0x6f')](this,_0x279962[_0x43e7('0x117')]);if(_0x48af25){_0x25211a=_0x48af25;}}this['createSquareDetailsReport'][_0x43e7('0x6f')](this,_0x279962,_0x2cb397);if(_0x279962[_0x43e7('0xeb')][_0x43e7('0x170')]('x')<0x0){_0x279962[_0x43e7('0xeb')]+='x';}if(_0x279962['opts'][_0x43e7('0x170')]('X')<0x0){_0x279962[_0x43e7('0xeb')]+='X';}this[_0x43e7('0xd')]['setVariable'](_0x43e7('0x171'),_0x2cb397?_0x2cb397[_0x43e7('0x172')]():'');var _0x49ca8e=this[_0x43e7('0xd')][_0x43e7('0x55')]('QUEUE',[_0x2cb397,_0x279962[_0x43e7('0xeb')],_0x279962[_0x43e7('0x61')],_0x25211a,_0x279962[_0x43e7('0x62')],_0x279962[_0x43e7('0x5')],_0x279962['macro'],_0x279962[_0x43e7('0x173')],'',_0x279962[_0x43e7('0x174')]]);if(_0x49ca8e[_0x43e7('0xab')]===-0x1){return _0x49ca8e;}return this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')]('Executed\x20command\x20%s\x20%s',_0x43e7('0x175'),_0x2cb397));};AGIVertices[_0x43e7('0xe')]['record']=function(_0x29d378){logger[_0x43e7('0x2c')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x29d378[_0x43e7('0x33')]));var _0x3e0a10=_0x29d378['recordingFormat']||_0x43e7('0x131');var _0x42e2bd=util[_0x43e7('0x27')](_0x43e7('0x176'),this[_0x43e7('0xd')]['uniqueid'],rs[_0x43e7('0x11e')](0x5));var _0x5544de=util[_0x43e7('0x27')](_0x43e7('0x177'),FILES_PATH,_0x42e2bd,_0x3e0a10);var _0x400d36=util[_0x43e7('0x27')](_0x43e7('0x132'),FILES_PATH,_0x42e2bd);this['createSquareRecording'][_0x43e7('0x6f')](this,_0x29d378,_0x42e2bd,_0x5544de);this[_0x43e7('0xd')][_0x43e7('0x9f')](_0x43e7('0x178'),_0x42e2bd);logger['info'](_0x43e7('0x179'),_0x400d36,_0x3e0a10,_0x29d378[_0x43e7('0x17a')],_0x29d378[_0x43e7('0x62')]);return this[_0x43e7('0xd')][_0x43e7('0x134')](_0x400d36,_0x3e0a10,_0x29d378[_0x43e7('0x17a')],_0x29d378[_0x43e7('0x62')],undefined,!![]);};AGIVertices[_0x43e7('0xe')][_0x43e7('0x17b')]=function(_0x3b5ce3){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x17c'),_0x3b5ce3[_0x43e7('0x33')]));if(!this[_0x43e7('0xa8')](_0x3b5ce3[_0x43e7('0x61')])){return this['channel']['noop']('no\x20url\x20configured');}var _0x417af7=this[_0x43e7('0x60')][_0x43e7('0x6f')](this,_0x3b5ce3);logger['info'](util[_0x43e7('0x27')](_0x43e7('0x17d'),util[_0x43e7('0x17e')](_0x417af7,{'showHidden':![],'depth':null})));if(!this[_0x43e7('0xa8')](_0x3b5ce3['variable_id'])){return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0x17f'));}var _0x485904=this[_0x43e7('0xf')][_0x43e7('0x6f')](this,_0x3b5ce3['variable_id']);if(!_0x485904){return this[_0x43e7('0xd')]['error'](_0x3b5ce3,'no\x20variable\x20found');}this[_0x43e7('0xd')]['setVariable'](util['format']('%s_STATUS_CODE',_0x485904),_0x417af7[_0x43e7('0x73')]?_0x417af7['statusCode']:_0x43e7('0x180'));this[_0x43e7('0xd')]['setVariable'](util[_0x43e7('0x27')](_0x43e7('0x181'),_0x485904),_0x417af7[_0x43e7('0x74')]?_0x417af7[_0x43e7('0x74')]:'OK');if(_0x417af7[_0x43e7('0x69')]){try{this[_0x43e7('0x9b')](_0x417af7[_0x43e7('0x69')],_0x485904);}catch(_0x649d9f){logger[_0x43e7('0x2f')](util[_0x43e7('0x27')](_0x43e7('0x182'),_0x485904));}}return this[_0x43e7('0xd')][_0x43e7('0xa9')](util['format']('variable\x20%s\x20set',_0x485904));};AGIVertices['prototype'][_0x43e7('0x183')]=function(_0x5b1ef3){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5b1ef3[_0x43e7('0x33')]));return this[_0x43e7('0xd')][_0x43e7('0x184')](_0x5b1ef3[_0x43e7('0x185')][_0x43e7('0x186')](/\s+/g,''),_0x5b1ef3[_0x43e7('0x17a')]);};AGIVertices[_0x43e7('0xe')]['saynumber']=function(_0x47f1ed){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x47f1ed['label']));return this[_0x43e7('0xd')][_0x43e7('0x187')](_0x47f1ed[_0x43e7('0x63')][_0x43e7('0x186')](/\s+/g,''),_0x47f1ed[_0x43e7('0x17a')]);};AGIVertices['prototype'][_0x43e7('0x188')]=function(_0x50463a){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x50463a['label']));return this[_0x43e7('0xd')][_0x43e7('0x189')](_0x50463a[_0x43e7('0x59')],_0x50463a[_0x43e7('0x17a')]);};AGIVertices[_0x43e7('0xe')][_0x43e7('0x18a')]=function(_0x82490c){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x18b'),_0x82490c['label']));if(!this[_0x43e7('0xa8')](_0x82490c[_0x43e7('0x18c')])){return this[_0x43e7('0xd')][_0x43e7('0xa9')]('no\x20mail\x20account\x20configured');}var _0x12d098=this[_0x43e7('0x1e')]['sync'](this,_0x82490c[_0x43e7('0x18c')]);if(!_0x12d098||!_0x12d098[_0x43e7('0x18d')]){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x82490c,_0x43e7('0x18e'));}var _0x5124d2={'from':util['format'](_0x43e7('0x18f'),_0x12d098[_0x43e7('0x12')],_0x12d098[_0x43e7('0x190')]||_0x12d098[_0x43e7('0x18d')][_0x43e7('0x191')]),'to':_0x82490c['to']||'','cc':_0x82490c['cc']||'','bcc':_0x82490c[_0x43e7('0x192')]||'','subject':_0x82490c[_0x43e7('0x193')],'html':_0x82490c[_0x43e7('0x59')],'text':_0x82490c[_0x43e7('0x59')]};if(this[_0x43e7('0xa8')](_0x82490c['template_id'])){}logger[_0x43e7('0xe3')](_0x43e7('0x194'),JSON[_0x43e7('0x71')](_0x5124d2));this['createSquareDetailsReport']['sync'](this,_0x82490c,_0x82490c[_0x43e7('0x18c')]);this['channel']['noop'](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x12d098[_0x43e7('0x12')]));this[_0x43e7('0x21')][_0x43e7('0x6f')](this,_0x12d098[_0x43e7('0x195')],_0x5124d2);return this[_0x43e7('0xd')][_0x43e7('0xa9')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x43e7('0xe')][_0x43e7('0x196')]=function(_0x3a829b){logger['info'](util[_0x43e7('0x27')](_0x43e7('0x197'),_0x3a829b[_0x43e7('0x33')]));return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0x198'));};AGIVertices[_0x43e7('0xe')]['sendSMS']=function(_0x1907db){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x1907db['label']));if(!this[_0x43e7('0xa8')](_0x1907db['sms_account_id'])){return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0x199'));}var _0x2028a2=this[_0x43e7('0x19a')]['sync'](this,_0x1907db[_0x43e7('0x19b')]);if(!_0x2028a2){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x1907db,_0x43e7('0x19c'));}var _0x3b5210={'body':_0x1907db[_0x43e7('0x19d')],'phone':_0x1907db['to']||'','SmsAccountId':_0x2028a2['id']};logger[_0x43e7('0xe3')](_0x43e7('0x19e'),JSON[_0x43e7('0x71')](_0x3b5210));this[_0x43e7('0x32')][_0x43e7('0x6f')](this,_0x1907db,_0x1907db[_0x43e7('0x19b')]);this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0x19f'),_0x2028a2['name']));this[_0x43e7('0x31')][_0x43e7('0x6f')](this,_0x3b5210);return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0x1a0'));};AGIVertices[_0x43e7('0xe')][_0x43e7('0x1a1')]=function(_0xd0cd39){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x1a2'),_0xd0cd39[_0x43e7('0x33')]));if(!this[_0x43e7('0xa8')](_0xd0cd39[_0x43e7('0xdc')])){return this[_0x43e7('0xd')]['error'](_0xd0cd39,_0x43e7('0x1a3'));}var _0x43d11f=this['getVariable']['sync'](this,_0xd0cd39[_0x43e7('0xdc')]);if(!_0x43d11f){return this[_0x43e7('0xd')]['error'](_0xd0cd39,_0x43e7('0xde'));}return this[_0x43e7('0xd')][_0x43e7('0x9f')](_0x43d11f,_0xd0cd39[_0x43e7('0x1a4')]);};AGIVertices['prototype']['start']=function(_0x255b2c){logger[_0x43e7('0x2c')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x255b2c[_0x43e7('0x33')]));this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0x1a5'));var _0xf0f1bc=this[_0x43e7('0xd')][_0x43e7('0xf')](_0x43e7('0x1a6'));if(!_['isEmpty'](_0xf0f1bc['extra'])){this[_0x43e7('0xd')]['uniqueid']=_0xf0f1bc['extra'];}if(_0x255b2c['answer']===_0x43e7('0x1a7')){this[_0x43e7('0xd')][_0x43e7('0xa9')]('Answer');return this[_0x43e7('0xd')][_0x43e7('0xbb')]();}return this['channel'][_0x43e7('0xa9')](_0x43e7('0x1a8'));};AGIVertices[_0x43e7('0xe')][_0x43e7('0x1a9')]=function(_0x3e63dc){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x1aa'),_0x3e63dc[_0x43e7('0x33')]));if(!this[_0x43e7('0xa8')](_0x3e63dc[_0x43e7('0x1ab')])){return this[_0x43e7('0xd')]['error'](_0x3e63dc,_0x43e7('0x1ac'));}var _0x3aaa9d=this[_0x43e7('0x1ad')][_0x43e7('0x6f')](this,_0x3e63dc['project_id']);if(!this[_0x43e7('0xa8')](_0x3aaa9d)){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x3e63dc,util[_0x43e7('0x27')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x3e63dc[_0x43e7('0x1ab')]));}if(_0x3aaa9d===this[_0x43e7('0xd')][_0x43e7('0x35')]){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x3e63dc,_0x43e7('0x1ae'));}this[_0x43e7('0x32')][_0x43e7('0x6f')](this,_0x3e63dc,_0x3aaa9d);var _0x50fffd=this[_0x43e7('0xd')][_0x43e7('0x55')](_0x43e7('0x1af'),util[_0x43e7('0x27')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x43e7('0x5')][_0x43e7('0x1b0')]||_0x43e7('0x1b1'),_0x3aaa9d,this['channel'][_0x43e7('0x35')]));if(_0x50fffd['result']===-0x1){return _0x50fffd;}return this['channel'][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0xc9'),_0x43e7('0x1af'),_0x3aaa9d));};AGIVertices[_0x43e7('0xe')][_0x43e7('0x1b2')]=function(_0x2fcea8){logger[_0x43e7('0x2c')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x2fcea8[_0x43e7('0x33')]));var _0x31262a=this[_0x43e7('0x54')][_0x43e7('0x6f')](this,_0x2fcea8[_0x43e7('0xb9')]);this[_0x43e7('0x32')][_0x43e7('0x6f')](this,_0x2fcea8,_0x2fcea8['command']);if(this[_0x43e7('0xa8')](_0x2fcea8[_0x43e7('0xdc')])){var _0x446b98=this[_0x43e7('0xf')][_0x43e7('0x6f')](this,_0x2fcea8['variable_id']);if(_0x446b98){this['channel'][_0x43e7('0x9f')](_0x446b98,_0x31262a);return this[_0x43e7('0xd')]['noop'](util['format']('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2fcea8[_0x43e7('0xb9')],_0x446b98));}}return this[_0x43e7('0xd')][_0x43e7('0xa9')](util['format'](_0x43e7('0x1b3'),_0x2fcea8[_0x43e7('0xb9')]));};AGIVertices[_0x43e7('0xe')][_0x43e7('0x1b4')]=function(_0x47818e){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x1b5'),_0x47818e[_0x43e7('0x33')]));_0x47818e[_0x43e7('0x59')]=_0x47818e[_0x43e7('0x59')][_0x43e7('0x186')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x47818e[_0x43e7('0x58')])){return this[_0x43e7('0xd')][_0x43e7('0xa9')](_0x43e7('0x1b6'));}if(!this[_0x43e7('0xa8')](_0x47818e[_0x43e7('0x59')])){return this['channel']['noop'](_0x43e7('0xce'));}this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0x1b7'),_0x47818e[_0x43e7('0x59')]));var _0x255cb6=this[_0x43e7('0x57')][_0x43e7('0x6f')](this,_0x47818e);if(_0x255cb6){this['channel'][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0x1b8'),_0x255cb6));var _0x3002c7=this[_0x43e7('0xd')]['streamFile'](_0x255cb6);try{fs['unlink'](_0x255cb6+_0x43e7('0x14f'));}catch(_0x17ceb2){logger[_0x43e7('0x2f')](_0x17ceb2);}return _0x3002c7;}return this[_0x43e7('0xd')]['error'](_0x47818e,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x43e7('0x1b9')]=function(_0xd7893e){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x1ba'),_0xd7893e[_0x43e7('0x33')]));_0xd7893e[_0x43e7('0x59')]=_0xd7893e[_0x43e7('0x59')][_0x43e7('0x186')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x43e7('0xa8')](_0xd7893e[_0x43e7('0x59')])){return this['channel'][_0x43e7('0xa9')](_0x43e7('0xce'));}this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')]('Trying\x20Google\x20TTS\x20%s',_0xd7893e[_0x43e7('0x59')]));var _0xe3503=this[_0x43e7('0x5f')][_0x43e7('0x6f')](this,_0xd7893e);if(_0xe3503){this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0x1bb'),_0xe3503));var _0x35d32b=this[_0x43e7('0xd')][_0x43e7('0x109')](_0xe3503);try{fs[_0x43e7('0x10a')](_0xe3503+'.wav');}catch(_0x5cdb03){logger[_0x43e7('0x2f')](_0x5cdb03);}return _0x35d32b;}return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0xd7893e,_0x43e7('0x1bc'));};AGIVertices['prototype']['unpause']=function(_0x260f5f){logger[_0x43e7('0x2c')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x260f5f[_0x43e7('0x33')]));if(!this[_0x43e7('0xa8')](_0x260f5f[_0x43e7('0x153')])){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x260f5f,'no\x20find\x20by\x20configured');}logger[_0x43e7('0x2c')](util[_0x43e7('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x260f5f[_0x43e7('0x153')]));var _0x4059b3=this['agentUnpause']['sync'](this,_0x260f5f[_0x43e7('0x153')]);if(_0x4059b3){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x154'),this['channel'][_0x43e7('0x38')],_0x260f5f[_0x43e7('0x153')]));this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0x154'),this['channel'][_0x43e7('0x38')],_0x260f5f[_0x43e7('0x153')]));return{'code':0xc8,'result':_0x43e7('0x15a')};}else{logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x155'),this[_0x43e7('0xd')][_0x43e7('0x38')],_0x260f5f[_0x43e7('0x153')]));this['channel'][_0x43e7('0xa9')](util[_0x43e7('0x27')](_0x43e7('0x155'),this['channel'][_0x43e7('0x38')],_0x260f5f['findBy']));return{'code':0xc8,'result':_0x43e7('0x156')};}};AGIVertices[_0x43e7('0xe')][_0x43e7('0x1bd')]=function(_0x3572a1){logger[_0x43e7('0x2c')](util[_0x43e7('0x27')](_0x43e7('0x1be'),_0x3572a1[_0x43e7('0x33')]));var _0x48f3d8=this[_0x43e7('0xd')]['exec'](_0x43e7('0x1bf'),[_0x3572a1['mailbox'],_0x3572a1[_0x43e7('0x76')]]);if(_0x48f3d8['result']===-0x1){return _0x48f3d8;}return this[_0x43e7('0xd')][_0x43e7('0xa9')](util[_0x43e7('0x27')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x3572a1[_0x43e7('0x1c0')]));};AGIVertices['prototype'][_0x43e7('0x1c1')]=function(_0x518b33){logger[_0x43e7('0x2c')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x518b33[_0x43e7('0x33')]));if(!this['isConfigured'](_0x518b33[_0x43e7('0xdc')])){return this[_0x43e7('0xd')][_0x43e7('0x2f')](_0x518b33,'no\x20variable\x20selected');}var _0x1db40f=this[_0x43e7('0xf')][_0x43e7('0x6f')](this,_0x518b33[_0x43e7('0xdc')]);if(!_0x1db40f){return this['channel'][_0x43e7('0x2f')](_0x518b33,_0x43e7('0xde'));}var _0x1ffde1=this[_0x43e7('0xd')][_0x43e7('0xf')](_0x1db40f);return{'code':0xc8,'result':_0x1ffde1[_0x43e7('0xa1')]?_0x1ffde1['extra']:'-'};};String[_0x43e7('0xe')][_0x43e7('0x1c2')]=function(_0x26414b,_0x311b47){return this[_0x43e7('0xa0')](_0x26414b)['join'](_0x311b47);};module[_0x43e7('0x1c3')]=AGIVertices; \ No newline at end of file +var _0xc3b5=['ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','success','failure','math','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','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','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','sayNumber','sayphonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','getSmsAccount','sms_text','debug','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','join','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','then','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','name','getTrunk','getTrunkById','getSound','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','error','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','getPauseById','agentPause','agent','agentUnpause','agentLogout','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','parse','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_polly_region','Amy','awsLex','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','no\x20database\x20selected','no\x20odbc\x20database\x20found','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','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','no\x20ndauth\x20url\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','no\x20trunk\x20selected','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','variable_id','getData','response','toString','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','aws_access_key_id','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','TILDE_ASR_%s','gotoc','continueAt','gotoif','no\x20condition\x20configured','condition','true','false','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','intKey','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20%s\x20file\x20created'];(function(_0xb7393c,_0x1c0a8e){var _0x30b958=function(_0x2b26df){while(--_0x2b26df){_0xb7393c['push'](_0xb7393c['shift']());}};_0x30b958(++_0x1c0a8e);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x1013e2,_0x52cde9){_0x1013e2=_0x1013e2-0x0;var _0x33087c=_0xc3b5[_0x1013e2];return _0x33087c;};'use strict';var fs=require('fs');var util=require('util');var _=require('lodash');var sh=require(_0x5c3b('0x0'));var odbc=require(_0x5c3b('0x1'))();var rs=require(_0x5c3b('0x2'));var moment=require(_0x5c3b('0x3'));var Mustache=require(_0x5c3b('0x4'));var rp=require(_0x5c3b('0x5'));var logger=require(_0x5c3b('0x6'))(_0x5c3b('0x7'));var config=require('../../config/environment');var scripts=require(_0x5c3b('0x8'));var FILES_PATH=_0x5c3b('0x9');var recursiveMapAttributes=['rawHeaders',_0x5c3b('0xa')];var verticesWithRetry=[_0x5c3b('0xb'),_0x5c3b('0xc'),_0x5c3b('0xd')];var AGIVertices=function(_0x5be9ee,_0x1c68a5,_0x438255){this[_0x5c3b('0xe')]=_0x5be9ee;this[_0x5c3b('0xf')]=_0x1c68a5;this['mailRpc']=_0x438255;};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x11')]=function(_0x30ceca,_0x2e894a){this[_0x5c3b('0xf')]['getVariableById'](_0x30ceca)[_0x5c3b('0x12')](function(_0xb1c77b){_0x2e894a(null,_0xb1c77b?_0xb1c77b['name']:![]);})[_0x5c3b('0x13')](function(_0x3b953d){_0x2e894a(_0x3b953d);});};AGIVertices['prototype'][_0x5c3b('0x14')]=function(_0xbff1cc,_0x3e24bd){this[_0x5c3b('0xf')][_0x5c3b('0x15')](_0xbff1cc)[_0x5c3b('0x12')](function(_0x27965f){_0x3e24bd(null,_0x27965f?_0x27965f['name']:![]);})[_0x5c3b('0x13')](function(_0x5b55be){_0x3e24bd(_0x5b55be);});};AGIVertices['prototype'][_0x5c3b('0x16')]=function(_0x945338,_0x18757e){this['rpc'][_0x5c3b('0x17')](_0x945338)[_0x5c3b('0x12')](function(_0x5b5810){_0x18757e(null,_0x5b5810?_0x5b5810['name']:![]);})[_0x5c3b('0x13')](function(_0x34144d){_0x18757e(_0x34144d);});};AGIVertices['prototype'][_0x5c3b('0x18')]=function(_0x4658ce,_0x2b2307){this[_0x5c3b('0xf')][_0x5c3b('0x19')](_0x4658ce)[_0x5c3b('0x12')](function(_0x1915c8){_0x2b2307(null,_0x1915c8?_0x1915c8[_0x5c3b('0x1a')]:![]);})[_0x5c3b('0x13')](function(_0x1138b0){_0x2b2307(_0x1138b0);});};AGIVertices['prototype']['getUser']=function(_0x319f0c,_0x143022){this['rpc'][_0x5c3b('0x1b')](_0x319f0c)['then'](function(_0x832a1c){_0x143022(null,_0x832a1c?_0x832a1c[_0x5c3b('0x1c')]:![]);})[_0x5c3b('0x13')](function(_0xe9261d){_0x143022(_0xe9261d);});};AGIVertices['prototype'][_0x5c3b('0x1d')]=function(_0x365318,_0x54ab06){this[_0x5c3b('0xf')][_0x5c3b('0x1e')](_0x365318)[_0x5c3b('0x12')](function(_0x3c3991){_0x54ab06(null,_0x3c3991?_0x3c3991['name']:![]);})[_0x5c3b('0x13')](function(_0x20469d){_0x54ab06(_0x20469d);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x1f')]=function(_0x28dfbc,_0x2a293d){var _0x511963=this;this['rpc']['getSoundById'](_0x28dfbc)[_0x5c3b('0x12')](function(_0x3e6832){_0x2a293d(null,_0x3e6832?_0x511963['getSoundPath'](_0x3e6832[_0x5c3b('0x20')]):![]);})[_0x5c3b('0x13')](function(_0x421d96){_0x2a293d(_0x421d96);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x21')]=function(_0x35b48e,_0x356f46){this[_0x5c3b('0xf')][_0x5c3b('0x22')](_0x35b48e)[_0x5c3b('0x12')](function(_0x4765b3){_0x356f46(null,_0x4765b3?_0x4765b3:![]);})[_0x5c3b('0x13')](function(_0x5a5d9e){_0x356f46(_0x5a5d9e);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x23')]=function(_0x3b80c9,_0xa108e2,_0x23e55f){this[_0x5c3b('0x24')][_0x5c3b('0x23')](_0x3b80c9,_0xa108e2)[_0x5c3b('0x12')](function(){_0x23e55f(null);})[_0x5c3b('0x13')](function(_0x1d9492){_0x23e55f(_0x1d9492);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x25')]=function(_0x173383,_0x68ec02){this[_0x5c3b('0xf')][_0x5c3b('0x26')](_0x173383)[_0x5c3b('0x12')](function(_0x4cfe1b){if(_0x4cfe1b){if(_0x4cfe1b[_0x5c3b('0x27')]){_0x68ec02(null,[_0x4cfe1b[_0x5c3b('0x28')]]);}else{_0x68ec02(null,_[_0x5c3b('0x29')](_0x4cfe1b[_0x5c3b('0x2a')],'interval'));}}else{_0x68ec02(null,![]);}})[_0x5c3b('0x13')](function(_0x39c159){_0x68ec02(_0x39c159);});};AGIVertices['prototype'][_0x5c3b('0x2b')]=function(_0x31440b){return util[_0x5c3b('0x2c')](_0x5c3b('0x2d'),FILES_PATH,_0x31440b);};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x2e')]=function(_0x27b34d,_0x22fe25,_0x1fa1df){odbc['open'](_0x27b34d,function(_0x128f2e){if(_0x128f2e){logger[_0x5c3b('0x2f')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x128f2e);_0x1fa1df(_0x128f2e);}else{logger['info'](_0x5c3b('0x30'));odbc[_0x5c3b('0x31')](_0x22fe25,function(_0xe2951c,_0x3cfc4d){if(_0xe2951c){logger[_0x5c3b('0x32')](_0x5c3b('0x33'),_0x22fe25);_0x1fa1df(_0xe2951c);}else{logger[_0x5c3b('0x32')]('Query\x20executed\x20correctly\x20%s',_0x22fe25);odbc['close'](function(_0x3a641e){if(_0x3a641e){logger[_0x5c3b('0x2f')](_0x5c3b('0x34'),_0x3a641e);}_0x1fa1df(null,_0x3cfc4d);});}});}});};AGIVertices[_0x5c3b('0x10')]['getSmsAccount']=function(_0x16400b,_0x4b9a81){this[_0x5c3b('0xf')][_0x5c3b('0x35')](_0x16400b)[_0x5c3b('0x12')](function(_0xea3ae1){_0x4b9a81(null,_0xea3ae1?_0xea3ae1:![]);})[_0x5c3b('0x13')](function(_0x359d3d){_0x4b9a81(_0x359d3d);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x36')]=function(_0x62b6a2,_0x546827){this['rpc'][_0x5c3b('0x36')](_0x62b6a2)[_0x5c3b('0x12')](function(_0x40d270){_0x546827(null,_0x40d270);})[_0x5c3b('0x13')](function(_0x2c2a25){_0x546827(_0x2c2a25);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x37')]=function(_0x1d9427,_0x29ffdc,_0x56a53e){this[_0x5c3b('0xf')][_0x5c3b('0x37')]({'uniqueid':this[_0x5c3b('0xe')]['uniqueid'],'node':_0x1d9427[_0x5c3b('0x38')],'application':_0x1d9427[_0x5c3b('0x39')],'data':_0x29ffdc||null,'project_name':this[_0x5c3b('0xe')][_0x5c3b('0x3a')],'callerid':this[_0x5c3b('0xe')][_0x5c3b('0x3b')]})[_0x5c3b('0x12')](function(_0x33fb97){if(_0x56a53e){_0x56a53e(null,_0x33fb97);}})[_0x5c3b('0x13')](function(_0x28c68a){if(_0x56a53e){_0x56a53e(_0x28c68a);}});};AGIVertices[_0x5c3b('0x10')]['createSquareRecording']=function(_0x437aaf,_0x568c0c,_0x3b795e,_0x1eb247){this['rpc'][_0x5c3b('0x3c')]({'uniqueid':this[_0x5c3b('0xe')][_0x5c3b('0x3d')],'callerid':this['channel'][_0x5c3b('0x3b')],'calleridname':this['channel'][_0x5c3b('0x3e')],'context':this[_0x5c3b('0xe')][_0x5c3b('0x3f')],'extension':this[_0x5c3b('0xe')][_0x5c3b('0x40')],'priority':this[_0x5c3b('0xe')][_0x5c3b('0x41')],'accountcode':this[_0x5c3b('0xe')][_0x5c3b('0x42')],'dnid':this[_0x5c3b('0xe')][_0x5c3b('0x43')],'projectName':this['channel'][_0x5c3b('0x3a')],'saveName':_0x568c0c,'filename':_0x437aaf['file']||_0x568c0c,'savePath':_0x3b795e})[_0x5c3b('0x12')](function(_0x11bf0a){_0x1eb247(null,_0x11bf0a);})[_0x5c3b('0x13')](function(_0x4b85c1){_0x1eb247(_0x4b85c1);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x44')]=function(_0x5c9e2d,_0x200da6,_0x7f0100,_0x17f038,_0x2744cd){this[_0x5c3b('0xf')][_0x5c3b('0x44')]({'uniqueid':this[_0x5c3b('0xe')][_0x5c3b('0x3d')],'body':_0x5c9e2d,'direction':_0x200da6,'providerName':_0x7f0100,'providerResponse':_0x17f038})[_0x5c3b('0x12')](function(_0x1b5e30){if(_0x2744cd){_0x2744cd(null,_0x1b5e30);}})[_0x5c3b('0x13')](function(_0x5a9c88){if(_0x2744cd){_0x2744cd(_0x5a9c88);}});};AGIVertices['prototype']['createCmContact']=function(_0x434c28,_0x203ae2){this['rpc'][_0x5c3b('0x45')]({'firstName':_[_0x5c3b('0x46')](_0x434c28[_0x5c3b('0x1c')])||_[_0x5c3b('0x47')](_0x434c28['name'])?_0x5c3b('0x48')+Math[_0x5c3b('0x49')]():_0x434c28['name'],'lastName':_[_0x5c3b('0x46')](_0x434c28[_0x5c3b('0x4a')])||_[_0x5c3b('0x47')](_0x434c28[_0x5c3b('0x4a')])?null:_0x434c28[_0x5c3b('0x4a')],'phone':_0x434c28[_0x5c3b('0x4b')],'ListId':_0x434c28[_0x5c3b('0x4c')],'scheduledat':_0x434c28[_0x5c3b('0x4d')],'callbackUniqueid':this[_0x5c3b('0xe')][_0x5c3b('0x3d')],'tags':_0x5c3b('0x4e'),'description':_0x5c3b('0x4f')+_0x434c28[_0x5c3b('0x4d')]['toString'](),'priority':_0x434c28['callback_priority']})[_0x5c3b('0x12')](function(_0x393073){_0x203ae2(null,_0x393073);})[_0x5c3b('0x13')](function(_0x5276d3){_0x203ae2(_0x5276d3);});};AGIVertices['prototype']['getPause']=function(_0x281438,_0x536a6b){this[_0x5c3b('0xf')][_0x5c3b('0x50')](_0x281438)[_0x5c3b('0x12')](function(_0x3d5218){_0x536a6b(null,_0x3d5218?_0x3d5218[_0x5c3b('0x1c')]:![]);})['catch'](function(_0x23d7cb){_0x536a6b(_0x23d7cb);});};AGIVertices['prototype'][_0x5c3b('0x51')]=function(_0x5e55e4,_0x411c7b,_0x87f956){var _0x4080c8={'role':_0x5c3b('0x52')};_0x4080c8[_0x5e55e4]=this[_0x5c3b('0xe')][_0x5c3b('0x3b')];this[_0x5c3b('0xf')][_0x5c3b('0x51')](_0x4080c8,_0x411c7b,this[_0x5c3b('0xe')][_0x5c3b('0x3d')])[_0x5c3b('0x12')](function(_0x54c01a){_0x87f956(null,_['isNil'](_0x54c01a)?![]:!![]);})['catch'](function(_0x320895){logger[_0x5c3b('0x2f')](_0x320895);_0x87f956(null,![]);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x53')]=function(_0x532120,_0x4edba0){var _0x3ce7af={'role':'agent'};_0x3ce7af[_0x532120]=this['channel'][_0x5c3b('0x3b')];this[_0x5c3b('0xf')][_0x5c3b('0x53')](_0x3ce7af)[_0x5c3b('0x12')](function(_0x3eda5e){_0x4edba0(null,_[_0x5c3b('0x47')](_0x3eda5e)?![]:!![]);})[_0x5c3b('0x13')](function(_0x13043b){logger[_0x5c3b('0x2f')](_0x13043b);_0x4edba0(null,![]);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x54')]=function(_0x2c335f,_0x50bb3f){var _0x3faa19={'role':'agent'};_0x3faa19[_0x2c335f]=this[_0x5c3b('0xe')][_0x5c3b('0x3b')];this[_0x5c3b('0xf')][_0x5c3b('0x54')](_0x3faa19)[_0x5c3b('0x12')](function(_0x22f6f1){_0x50bb3f(null,_[_0x5c3b('0x47')](_0x22f6f1)?![]:!![]);})[_0x5c3b('0x13')](function(_0x57175a){logger[_0x5c3b('0x2f')](_0x57175a);_0x50bb3f(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x404844,_0x2fc946){var _0xaa3e19={'role':'agent'};_0xaa3e19[_0x404844]=this[_0x5c3b('0xe')][_0x5c3b('0x3b')];var _0x2ec0a9=_0x404844!='internal'?util[_0x5c3b('0x2c')]('%s/%s@from-sip/n',_0x5c3b('0x55'),this[_0x5c3b('0xe')][_0x5c3b('0x3b')]):undefined;this['rpc'][_0x5c3b('0x56')](_0xaa3e19,_0x2ec0a9)['then'](function(_0x22ba96){_0x2fc946(null,_[_0x5c3b('0x47')](_0x22ba96)?![]:!![]);})[_0x5c3b('0x13')](function(_0x5b1028){logger[_0x5c3b('0x2f')](_0x5b1028);_0x2fc946(null,![]);});};AGIVertices['prototype'][_0x5c3b('0x57')]=function(_0x2dd9c4,_0x3a6a23){sh[_0x5c3b('0x58')](_[_0x5c3b('0x59')](_0x2dd9c4),function(_0x2e6cb4,_0x86b55e){var _0x51a1c3=_0x86b55e[_0x5c3b('0x5a')](/(\r\n|\n|\r)/gm,'');_0x3a6a23(null,_0x51a1c3);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x5b')]=function(_0x445217,_0x467427){scripts['googleCloudTTS'](_0x445217[_0x5c3b('0x5c')],_0x445217[_0x5c3b('0x5d')]||'text',_0x445217[_0x5c3b('0x5e')],_0x445217[_0x5c3b('0x5f')]||_0x5c3b('0x60'),_0x445217[_0x5c3b('0x61')]||_0x5c3b('0x62'),_0x445217[_0x5c3b('0x63')]||_0x5c3b('0x64'))[_0x5c3b('0x12')](function(_0x348fc4){_0x467427(null,_0x348fc4);})['catch'](function(_0x4c94cb){_0x467427(_0x4c94cb);});};AGIVertices['prototype']['googleTTS']=function(_0x5ac5dd,_0x274b66){scripts[_0x5c3b('0x65')](_0x5ac5dd[_0x5c3b('0x5e')],_0x5ac5dd['google_tts_language']||'en',0x1)[_0x5c3b('0x12')](function(_0x4bafa5){_0x274b66(null,_0x4bafa5);})[_0x5c3b('0x13')](function(_0x1aa23c){_0x274b66(_0x1aa23c);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x66')]=function(_0x3419db,_0xbc0e51){var _0x183fa9={'uri':_0x3419db[_0x5c3b('0x67')],'method':_0x3419db[_0x5c3b('0x68')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3419db[_0x5c3b('0x69')])===_0x5c3b('0x6a')&&parseInt(_0x3419db[_0x5c3b('0x69')])>=0x1?parseInt(_0x3419db['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x5c3b('0x6b')]([_0x5c3b('0x6c'),_0x5c3b('0x6d')],_0x183fa9[_0x5c3b('0x68')][_0x5c3b('0x6e')]())){try{_0x183fa9[_0x5c3b('0x6f')]=_0x3419db['rawBody']?JSON['parse'](_0x3419db[_0x5c3b('0xa')]):{};}catch(_0x30063d){logger['error'](_0x5c3b('0x70'),_0x30063d);}}try{_0x183fa9[_0x5c3b('0x71')]=_0x3419db[_0x5c3b('0x72')]?JSON['parse'](_0x3419db[_0x5c3b('0x72')]):{};}catch(_0x1ca6cb){logger[_0x5c3b('0x2f')](_0x5c3b('0x73'),_0x1ca6cb);}if(_0x3419db['computedVariables']){try{var _0x4ba6a0=require(_0x3419db[_0x5c3b('0x74')])[_0x5c3b('0x75')](this,_0x183fa9);_0x183fa9[_0x5c3b('0x76')]=Mustache[_0x5c3b('0x77')](_0x3419db[_0x5c3b('0x67')],_0x4ba6a0,{},['$$','$$']);if(_0x183fa9[_0x5c3b('0x71')]){_0x183fa9[_0x5c3b('0x71')]=JSON[_0x5c3b('0x78')](Mustache[_0x5c3b('0x77')](JSON['stringify'](_0x183fa9[_0x5c3b('0x71')]),_0x4ba6a0,{},['$$','$$']));}if(_0x183fa9[_0x5c3b('0x6f')]){_0x183fa9[_0x5c3b('0x6f')]=JSON[_0x5c3b('0x78')](Mustache[_0x5c3b('0x77')](JSON[_0x5c3b('0x79')](_0x183fa9[_0x5c3b('0x6f')]),_0x4ba6a0,{},['$$','$$']));}}catch(_0x36c6cd){logger[_0x5c3b('0x2f')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x36c6cd);}}rp(_0x183fa9)[_0x5c3b('0x12')](function(_0x7a2d52){var _0x2d71b4={'statusCode':_0x7a2d52[_0x5c3b('0x7a')]||0xc8,'statusMessage':_0x7a2d52['statusMessage']||'OK','headers':_0x7a2d52['headers']||{},'body':_0x7a2d52['body']||{}};_0xbc0e51(null,_0x2d71b4);})[_0x5c3b('0x13')](function(_0x4059a7){var _0x32bac3={'statusCode':_0x4059a7['statusCode']||0x1f4,'statusMessage':_0x4059a7[_0x5c3b('0x7b')]||_0x5c3b('0x7c'),'headers':_0x4059a7[_0x5c3b('0x7d')]['headers']||{},'body':_0x4059a7[_0x5c3b('0x7d')][_0x5c3b('0x6f')]||{}};_0xbc0e51(null,_0x32bac3);});};AGIVertices[_0x5c3b('0x10')]['googleDialogflow']=function(_0x3b91e6,_0x3e272a){scripts[_0x5c3b('0x7e')](this[_0x5c3b('0xe')][_0x5c3b('0x3d')],_0x3b91e6['key'],_0x3b91e6[_0x5c3b('0x5e')],_0x3b91e6[_0x5c3b('0x7f')]||'en')['then'](function(_0x5bbee5){_0x3e272a(null,_0x5bbee5);})['catch'](function(_0x90be8a){_0x3e272a(_0x90be8a);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x80')]=function(_0x3a44c4,_0x57f7b3){scripts[_0x5c3b('0x80')](this[_0x5c3b('0xe')][_0x5c3b('0x3d')],_0x3a44c4[_0x5c3b('0x81')],_0x3a44c4[_0x5c3b('0x82')],_0x3a44c4[_0x5c3b('0x83')],_0x3a44c4[_0x5c3b('0x5e')],_0x3a44c4[_0x5c3b('0x84')]||'en')[_0x5c3b('0x12')](function(_0x26d64e){_0x57f7b3(null,_0x26d64e);})['catch'](function(_0x565724){_0x57f7b3(_0x565724);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x85')]=function(_0x3cc0df,_0x3abf4b){scripts[_0x5c3b('0x85')](this['channel'],_0x3cc0df)[_0x5c3b('0x12')](function(_0x927af7){_0x3abf4b(null,_0x927af7);})[_0x5c3b('0x13')](function(_0x158800){_0x3abf4b(_0x158800);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x86')]=function(_0x4a0e05,_0x5b20b1){scripts[_0x5c3b('0x86')](_0x4a0e05[_0x5c3b('0x87')],_0x4a0e05['text'],_0x4a0e05[_0x5c3b('0x88')]||_0x5c3b('0x60'),_0x4a0e05['speed'])[_0x5c3b('0x12')](function(_0x46b08c){_0x5b20b1(null,_0x46b08c);})[_0x5c3b('0x13')](function(_0x115b84){_0x5b20b1(_0x115b84);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x89')]=function(_0x479cae,_0x992c8,_0x3e90d3){scripts[_0x5c3b('0x89')](_0x992c8,_0x479cae[_0x5c3b('0x87')],_0x479cae[_0x5c3b('0x8a')]||'en-US',this[_0x5c3b('0x8b')](_0x479cae[_0x5c3b('0x8c')])?_0x479cae[_0x5c3b('0x8c')]:undefined)[_0x5c3b('0x12')](function(_0x5ef311){_0x3e90d3(null,_0x5ef311);})[_0x5c3b('0x13')](function(_0x5613ec){_0x3e90d3(_0x5613ec);});};AGIVertices[_0x5c3b('0x10')]['awsPolly']=function(_0x314d17,_0xa93c90){scripts[_0x5c3b('0x8d')](_0x314d17['aws_access_key_id'],_0x314d17['aws_secret_access_key'],_0x314d17[_0x5c3b('0x8e')],_0x314d17['aws_polly_voice']||_0x5c3b('0x8f'),_0x314d17[_0x5c3b('0x5e')],_0x314d17['aws_text_type']||_0x5c3b('0x5e'))['then'](function(_0x70117){_0xa93c90(null,_0x70117);})[_0x5c3b('0x13')](function(_0x458015){_0xa93c90(_0x458015);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x90')]=function(_0x26a10a,_0x225f6e){scripts[_0x5c3b('0x90')](this[_0x5c3b('0xe')]['uniqueid'],_0x26a10a['aws_access_key_id'],_0x26a10a['aws_secret_access_key'],_0x26a10a['aws_lex_region'],_0x26a10a[_0x5c3b('0x5e')],_0x26a10a['aws_bot_name'])[_0x5c3b('0x12')](function(_0x613269){_0x225f6e(null,_0x613269);})[_0x5c3b('0x13')](function(_0x20f7c3){_0x225f6e(_0x20f7c3);});};AGIVertices['prototype']['googleASR']=function(_0x4d4ff9,_0x1d8803,_0x92aff4){scripts[_0x5c3b('0x91')](_0x1d8803,_0x4d4ff9['key'],_0x4d4ff9[_0x5c3b('0x92')]||_0x5c3b('0x60'))[_0x5c3b('0x12')](function(_0x7f1b21){_0x92aff4(null,_0x7f1b21);})[_0x5c3b('0x13')](function(_0x2d1d5d){_0x92aff4(_0x2d1d5d);});};AGIVertices['prototype'][_0x5c3b('0x93')]=function(_0x92ae7c,_0x3c4abb,_0x385f08){scripts['tildeASR'](_0x3c4abb,_0x92ae7c['appid'],_0x92ae7c[_0x5c3b('0x94')],_0x92ae7c[_0x5c3b('0x76')])['then'](function(_0x1b198a){_0x385f08(null,_0x1b198a);})[_0x5c3b('0x13')](function(_0x1b2c12){_0x385f08(_0x1b2c12);});};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x95')]=function(_0x5567b3){var _0x171d26=_[_0x5c3b('0x6b')](verticesWithRetry,_0x5567b3[_0x5c3b('0x39')])?_0x5567b3:_[_0x5c3b('0x96')](_0x5567b3);for(var _0x1e7f2c in _0x171d26){if(_0x171d26[_0x5c3b('0x97')](_0x1e7f2c)){if(_0x171d26[_0x1e7f2c]&&_[_0x5c3b('0x98')](_0x171d26[_0x1e7f2c])){if(_['includes'](recursiveMapAttributes,_0x1e7f2c)){_0x171d26[_0x1e7f2c]=this[_0x5c3b('0x99')](_0x171d26[_0x1e7f2c]);}else{_0x171d26[_0x1e7f2c]=this[_0x5c3b('0x9a')](_0x171d26[_0x1e7f2c]);}}}}return _0x171d26;};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x9b')]=function(_0x1d0326){for(var _0x5d048f in _0x1d0326){if(_0x1d0326['hasOwnProperty'](_0x5d048f)){if(_['isPlainObject'](_0x1d0326[_0x5d048f])){this[_0x5c3b('0x9b')](_0x1d0326[_0x5d048f]);}else if(_[_0x5c3b('0x9c')](_0x1d0326[_0x5d048f])){for(var _0x2f3e01=0x0;_0x2f3e01<_0x1d0326[_0x5d048f][_0x5c3b('0x9d')];_0x2f3e01++){this[_0x5c3b('0x9b')](_0x1d0326[_0x5d048f][_0x2f3e01]);}}else if(_['isString'](_0x1d0326[_0x5d048f])){_0x1d0326[_0x5d048f]=this[_0x5c3b('0x9a')](_0x1d0326[_0x5d048f]);}}}};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x9e')]=function(_0x1a0d5e,_0x17b47a){for(var _0x1f7366 in _0x1a0d5e){if(_0x1a0d5e[_0x5c3b('0x97')](_0x1f7366)){if(_['isPlainObject'](_0x1a0d5e[_0x1f7366])){if(!_[_0x5c3b('0x46')](_0x1a0d5e[_0x1f7366])){this[_0x5c3b('0x9e')](_0x1a0d5e[_0x1f7366],util[_0x5c3b('0x2c')](_0x5c3b('0x9f'),_0x17b47a,_0x1f7366));}}else if(_[_0x5c3b('0x9c')](_0x1a0d5e[_0x1f7366])){for(var _0x449035=0x0;_0x449035<_0x1a0d5e[_0x1f7366][_0x5c3b('0x9d')];_0x449035++){this[_0x5c3b('0x9e')](_0x1a0d5e[_0x1f7366][_0x449035],util['format'](_0x5c3b('0x9f'),_0x17b47a,_0x1f7366+'['+_0x449035+']'));}}else{if(!_['isNil'](_0x1a0d5e[_0x1f7366])){this[_0x5c3b('0xe')][_0x5c3b('0xa0')](util['format'](_0x5c3b('0x9f'),_0x17b47a,_0x1f7366),_0x1a0d5e[_0x1f7366]);}}}}};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x99')]=function(_0x2f71eb){try{var _0x4ad2e7=JSON['parse'](_0x2f71eb);this[_0x5c3b('0x9b')](_0x4ad2e7);return JSON['stringify'](_0x4ad2e7);}catch(_0x5bc982){return this['replaceAllVariables'](_0x2f71eb);}};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x9a')]=function(_0x32535c){var _0x35cffb=_0x32535c[_0x5c3b('0xa1')]('{');for(var _0x5590ad=0x1;_0x5590ad<_0x35cffb[_0x5c3b('0x9d')];_0x5590ad+=0x1){var _0x314db2=_0x35cffb[_0x5590ad][_0x5c3b('0xa1')]('}');if(_0x314db2[_0x5c3b('0x9d')]>0x1){_0x32535c=_0x32535c[_0x5c3b('0xa2')]('{'+_0x314db2[0x0]+'}',this[_0x5c3b('0xe')][_0x5c3b('0x11')](_0x314db2[0x0])['extra']||_0x314db2[0x0]);}}if(_0x35cffb[_0x5c3b('0x9d')]===0x1){return _0x32535c['toString']();}return this[_0x5c3b('0x9a')](_0x32535c);};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xa3')]=function(_0x45d1da,_0x362fb5){var _0x28be41=this[_0x5c3b('0xe')]['getVariable'](_0x45d1da);if(_0x28be41[_0x5c3b('0xa4')]===-0x1){return _0x28be41;}logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0xa5'),_0x362fb5,_0x28be41[_0x5c3b('0xa6')]));return this[_0x5c3b('0xe')][_0x5c3b('0xa0')](_0x362fb5,_0x28be41[_0x5c3b('0xa6')]);};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x8b')]=function(_0x1f4286){return _0x1f4286&&_0x1f4286!=='0'&&_0x1f4286!=='-1'&&_0x1f4286!=='';};AGIVertices[_0x5c3b('0x10')]['maxRetry']=function(_0x28bbca){this['createSquareDetailsReport'][_0x5c3b('0x75')](this,_0x28bbca,'-');_0x28bbca[_0x5c3b('0xa7')]=_0x28bbca[_0x5c3b('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xa9')]=function(_0x4bb221){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0xaa'),_0x4bb221['label']));if(!this['isConfigured'](_0x4bb221[_0x5c3b('0x5e')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')]('no\x20text\x20configured');}var _0x4473ce='\x22'+_0x4bb221[_0x5c3b('0x5e')]+'\x22';if(this[_0x5c3b('0x8b')](_0x4bb221[_0x5c3b('0x7d')])){_0x4473ce+=','+_0x4bb221['options'];}var _0x470f0d=this[_0x5c3b('0xe')]['exec'](_0x5c3b('0xac'),_0x4473ce);if(_0x470f0d[_0x5c3b('0xa4')]===-0x1){return _0x470f0d;}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format'](_0x5c3b('0xad'),_0x4473ce));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xae')]=function(_0xafb31b){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0xaf'),_0xafb31b[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0xafb31b[_0x5c3b('0xb0')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xb1'));}var _0x1a6ba8=_0xafb31b['grammar'];if(this[_0x5c3b('0x8b')](_0xafb31b[_0x5c3b('0x7d')])){_0x1a6ba8+=','+_0xafb31b[_0x5c3b('0x7d')];}var _0x49ddc2=this['channel'][_0x5c3b('0x58')]('MRCPRecog',_0x1a6ba8);if(_0x49ddc2['result']===-0x1){return _0x49ddc2;}var _0x18d580=this['getAndSetVariable'](_0x5c3b('0xb2'),_0x5c3b('0xb3'));if(_0x18d580[_0x5c3b('0xa4')]===-0x1){return _0x18d580;}var _0x13916f=this[_0x5c3b('0xa3')](_0x5c3b('0xb4'),'MRCP_RECOG_TRANSCRIPT');if(_0x13916f['result']===-0x1){return _0x13916f;}var _0x4174ab=this[_0x5c3b('0xa3')](_0x5c3b('0xb5'),'MRCP_RECOG_INSTANCE');if(_0x4174ab['result']===-0x1){return _0x4174ab;}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1a6ba8));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x7')]=function(_0x1f01f1){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0xb6'),_0x1f01f1['label']));return this[_0x5c3b('0xe')][_0x5c3b('0x7')]([_0x1f01f1[_0x5c3b('0xb7')],_0x1f01f1[_0x5c3b('0xb8')]]);};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xb9')]=function(_0x278f8c){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0xba'),_0x278f8c[_0x5c3b('0x38')]));if(this[_0x5c3b('0x8b')](_0x278f8c['timeout'])){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x278f8c[_0x5c3b('0x69')]));var _0x2e2b23=this[_0x5c3b('0xe')][_0x5c3b('0xbb')](_0x278f8c[_0x5c3b('0x69')]);if(_0x2e2b23[_0x5c3b('0xa4')]===-0x1){return _0x2e2b23;}}return this[_0x5c3b('0xe')][_0x5c3b('0xb9')]();};AGIVertices['prototype']['callback']=function(_0x2ecdd5){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0xbc'),_0x2ecdd5['label']));if(!this[_0x5c3b('0x8b')](_0x2ecdd5[_0x5c3b('0x4c')])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x2ecdd5,_0x5c3b('0xbd'));}_0x2ecdd5[_0x5c3b('0x4d')]=moment();if(this[_0x5c3b('0x8b')](_0x2ecdd5[_0x5c3b('0xbe')])){_0x2ecdd5[_0x5c3b('0x4d')]=moment()['add'](_0x2ecdd5['delay'],_0x5c3b('0xbf'));}if(!this[_0x5c3b('0x8b')](_0x2ecdd5[_0x5c3b('0xc0')])){_0x2ecdd5[_0x5c3b('0xc0')]=0x2;}this[_0x5c3b('0x45')]['sync'](this,_0x2ecdd5);return this[_0x5c3b('0xe')]['noop'](util['format'](_0x5c3b('0xc1'),_0x2ecdd5[_0x5c3b('0x4b')],_0x2ecdd5[_0x5c3b('0x4c')],_0x2ecdd5[_0x5c3b('0x4d')]));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xc2')]=function(_0x2b7326){logger['info'](util[_0x5c3b('0x2c')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x2b7326[_0x5c3b('0x38')]));var _0x550097=this[_0x5c3b('0xe')]['exec'](_0x2b7326['application'],_0x2b7326[_0x5c3b('0x7d')]);if(_0x550097[_0x5c3b('0xa4')]===-0x1){return _0x550097;}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0xc3'),_0x2b7326['application'],_0x2b7326[_0x5c3b('0x7d')]));};AGIVertices['prototype'][_0x5c3b('0xc4')]=function(_0x3dfe8a){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0xc5'),_0x3dfe8a[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x3dfe8a[_0x5c3b('0x5e')])){return this[_0x5c3b('0xe')]['noop'](_0x5c3b('0xc6'));}var _0x33b48a='\x22'+_0x3dfe8a[_0x5c3b('0x5e')]+'\x22';if(this[_0x5c3b('0x8b')](_0x3dfe8a[_0x5c3b('0x7d')])){_0x33b48a+=','+_0x3dfe8a[_0x5c3b('0x7d')];}var _0x598678=this[_0x5c3b('0xe')][_0x5c3b('0x58')](_0x5c3b('0xac'),_0x33b48a);if(_0x598678[_0x5c3b('0xa4')]===-0x1){return _0x598678;}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format'](_0x5c3b('0xad'),_0x33b48a));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xc7')]=function(_0x1013c9){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0xc8'),_0x1013c9[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x1013c9[_0x5c3b('0x5e')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')]('no\x20text\x20configured');}var _0x48c0ef='\x22'+_0x1013c9['text']+'\x22';if(this[_0x5c3b('0x8b')](_0x1013c9['options'])){_0x48c0ef+=','+_0x1013c9[_0x5c3b('0x7d')];}var _0x37ea39=this[_0x5c3b('0xe')]['exec'](_0x5c3b('0xac'),_0x48c0ef);if(_0x37ea39[_0x5c3b('0xa4')]===-0x1){return _0x37ea39;}return this['channel']['noop'](util[_0x5c3b('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x48c0ef));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xc9')]=function(_0x59450c){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0xca'),_0x59450c[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x59450c['grammar'])){return this[_0x5c3b('0xe')]['noop']('no\x20grammar\x20configured');}var _0x338dd3=_0x59450c[_0x5c3b('0xb0')];if(this['isConfigured'](_0x59450c['options'])){_0x338dd3+=','+_0x59450c[_0x5c3b('0x7d')];}var _0x3e9fb6=this[_0x5c3b('0xe')][_0x5c3b('0x58')](_0x5c3b('0xcb'),_0x338dd3);if(_0x3e9fb6[_0x5c3b('0xa4')]===-0x1){return _0x3e9fb6;}var _0x3178aa=this[_0x5c3b('0xa3')](_0x5c3b('0xb2'),_0x5c3b('0xcc'));if(_0x3178aa[_0x5c3b('0xa4')]===-0x1){return _0x3178aa;}var _0x373abf=this[_0x5c3b('0xa3')](_0x5c3b('0xb4'),_0x5c3b('0xcd'));if(_0x373abf[_0x5c3b('0xa4')]===-0x1){return _0x373abf;}var _0x7d50ce=this['getAndSetVariable'](_0x5c3b('0xb5'),_0x5c3b('0xce'));if(_0x7d50ce[_0x5c3b('0xa4')]===-0x1){return _0x7d50ce;}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0x338dd3));};AGIVertices['prototype'][_0x5c3b('0xcf')]=function(_0x2cb19f){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0xd0'),_0x2cb19f['label']));if(!this[_0x5c3b('0x8b')](_0x2cb19f[_0x5c3b('0xb0')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xb1'));}var _0xd36cc7=_0x2cb19f[_0x5c3b('0xb0')];if(this[_0x5c3b('0x8b')](_0x2cb19f['options'])){_0xd36cc7+=','+_0x2cb19f[_0x5c3b('0x7d')];}var _0x5042a8=this[_0x5c3b('0xe')][_0x5c3b('0x58')](_0x5c3b('0xcb'),_0xd36cc7);if(_0x5042a8[_0x5c3b('0xa4')]===-0x1){return _0x5042a8;}var _0x109666=this['getAndSetVariable'](_0x5c3b('0xb2'),_0x5c3b('0xd1'));if(_0x109666[_0x5c3b('0xa4')]===-0x1){return _0x109666;}var _0x188b60=this['getAndSetVariable'](_0x5c3b('0xb4'),_0x5c3b('0xd2'));if(_0x188b60[_0x5c3b('0xa4')]===-0x1){return _0x188b60;}var _0x3e3eaf=this[_0x5c3b('0xa3')](_0x5c3b('0xb5'),_0x5c3b('0xd3'));if(_0x3e3eaf[_0x5c3b('0xa4')]===-0x1){return _0x3e3eaf;}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0xd4'),_0xd36cc7));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xd5')]=function(_0x23f2b0){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x23f2b0[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x23f2b0['odbc_id'])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x23f2b0,_0x5c3b('0xd6'));}var _0x475c02=this[_0x5c3b('0x18')][_0x5c3b('0x75')](this,_0x23f2b0['odbc_id']);if(!_0x475c02){return this['channel'][_0x5c3b('0x2f')](_0x23f2b0,_0x5c3b('0xd7'));}if(!this[_0x5c3b('0x8b')](_0x23f2b0['query'])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x23f2b0,'no\x20query\x20configured');}var _0x3db045=_0x23f2b0[_0x5c3b('0x31')][_0x5c3b('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0x5c3b('0x2c')](_0x5c3b('0xd8'),_0x3db045));var _0x503b0b=this[_0x5c3b('0x2e')]['sync'](this,_0x475c02,_0x3db045);this[_0x5c3b('0x37')]['sync'](this,_0x23f2b0,_0x3db045);if(!this[_0x5c3b('0x8b')](_0x23f2b0['variable_id'])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xd9'));}var _0x2c6ef3=this[_0x5c3b('0x11')]['sync'](this,_0x23f2b0['variable_id']);if(!_0x2c6ef3){return this[_0x5c3b('0xe')]['error'](_0x23f2b0,_0x5c3b('0xda'));}var _0x2e7eeb=this;_0x503b0b[_0x5c3b('0xdb')](function(_0x8ec582,_0x1545b6){Object[_0x5c3b('0xdc')](_0x8ec582)[_0x5c3b('0xdb')](function(_0x5d8908){_0x2e7eeb[_0x5c3b('0xe')][_0x5c3b('0xa0')](util['format'](_0x5c3b('0xdd'),_0x2c6ef3,_0x1545b6,_0x5d8908),_0x8ec582[_0x5d8908]);});});this[_0x5c3b('0xe')][_0x5c3b('0xa0')](util[_0x5c3b('0x2c')]('%s_ROWS_COUNT',_0x2c6ef3),_0x503b0b[_0x5c3b('0x9d')]);return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0xde'),_0x2c6ef3));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xdf')]=function(_0x1b96a3){logger['debug'](util['format'](_0x5c3b('0xe0'),_0x1b96a3[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x1b96a3[_0x5c3b('0xe1')])){return this[_0x5c3b('0xe')]['error'](_0x1b96a3,_0x5c3b('0xe2'));}var _0x4ff854=this[_0x5c3b('0xe3')][_0x5c3b('0x75')](this,_0x1b96a3['sip_id']);if(!_0x4ff854){return this['channel'][_0x5c3b('0x2f')](_0x1b96a3,_0x5c3b('0xe4'));}var _0x52fd43=this[_0x5c3b('0xe')][_0x5c3b('0x58')](_0x5c3b('0xe5'),[util['format']('SIP/%s',_0x4ff854),_0x1b96a3['timeout'],_0x1b96a3[_0x5c3b('0xe6')],_0x1b96a3[_0x5c3b('0x67')]]);if(_0x52fd43[_0x5c3b('0xa4')]===-0x1){return _0x52fd43;}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xe7')]=function(_0x534b31){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0xe8'),_0x534b31['label']));if(!this[_0x5c3b('0x8b')](_0x534b31[_0x5c3b('0x87')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xe9'));}if(!this[_0x5c3b('0x8b')](_0x534b31[_0x5c3b('0x5e')])){return this[_0x5c3b('0xe')]['noop'](_0x5c3b('0xc6'));}this[_0x5c3b('0xe')][_0x5c3b('0xea')]=!![];this[_0x5c3b('0x37')](_0x534b31);this[_0x5c3b('0x44')](_0x534b31['text'],'in','','');this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0xeb'),_0x534b31[_0x5c3b('0x5e')]));var _0x235644=this[_0x5c3b('0x7e')][_0x5c3b('0x75')](this,_0x534b31);if(_0x235644){for(var _0x7604aa in _0x235644){if(_0x235644['hasOwnProperty'](_0x7604aa)){this[_0x5c3b('0xe')]['setVariable'](util[_0x5c3b('0x2c')](_0x5c3b('0xec'),_0x7604aa['toUpperCase']()),_0x235644[_0x7604aa]);}}this[_0x5c3b('0x44')](_0x235644[_0x5c3b('0xed')],_0x5c3b('0xee'),'dialogflow','');return this['channel']['noop'](util[_0x5c3b('0x2c')](_0x5c3b('0xef'),_0x235644['speech']));}return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x534b31,_0x5c3b('0xf0'));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xf1')]=function(_0x3f273b){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x3f273b[_0x5c3b('0x38')]));if(!this['isConfigured'](_0x3f273b[_0x5c3b('0x81')])){return this[_0x5c3b('0xe')]['noop'](_0x5c3b('0xf2'));}if(!this[_0x5c3b('0x8b')](_0x3f273b[_0x5c3b('0x82')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xf3'));}if(!this[_0x5c3b('0x8b')](_0x3f273b[_0x5c3b('0x83')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x3f273b[_0x5c3b('0x84')])){return this[_0x5c3b('0xe')]['noop'](_0x5c3b('0xf4'));}if(!this[_0x5c3b('0x8b')](_0x3f273b[_0x5c3b('0x5e')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xc6'));}this[_0x5c3b('0xe')][_0x5c3b('0xea')]=!![];this[_0x5c3b('0x37')](_0x3f273b);this[_0x5c3b('0x44')](_0x3f273b['text'],'in','','');this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0xf5'),_0x3f273b[_0x5c3b('0x5e')]));var _0x4dfccb=this[_0x5c3b('0x80')][_0x5c3b('0x75')](this,_0x3f273b);if(_0x4dfccb){for(var _0x2266ee in _0x4dfccb){if(_0x4dfccb[_0x5c3b('0x97')](_0x2266ee)){if(_0x2266ee!==_0x5c3b('0xf6')){this[_0x5c3b('0xe')][_0x5c3b('0xa0')](util[_0x5c3b('0x2c')](_0x5c3b('0xec'),_0x2266ee[_0x5c3b('0x6e')]()),_0x4dfccb[_0x2266ee]);}}}this['createSquareMessage'](_0x4dfccb[_0x5c3b('0xed')],'out',_0x5c3b('0xf1'),_0x4dfccb[_0x5c3b('0xf6')]);return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format'](_0x5c3b('0xf7'),_0x4dfccb[_0x5c3b('0xed')]));}return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x3f273b,_0x5c3b('0xf8'));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xf9')]=function(_0x6603b8){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0xfa'),_0x6603b8['label']));if(!this[_0x5c3b('0x8b')](_0x6603b8['ndauth_url'])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xfb'));}if(!this[_0x5c3b('0x8b')](_0x6603b8['username'])){return this['channel'][_0x5c3b('0xab')]('no\x20username\x20configured');}if(!this[_0x5c3b('0x8b')](_0x6603b8[_0x5c3b('0xfc')])){return this[_0x5c3b('0xe')]['noop'](_0x5c3b('0xfd'));}if(!this[_0x5c3b('0x8b')](_0x6603b8['ndassistant_url'])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xc6'));}this[_0x5c3b('0xe')]['bot']=!![];this[_0x5c3b('0x37')](_0x6603b8);this[_0x5c3b('0x44')](_0x6603b8[_0x5c3b('0x5e')],'in','','');this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format'](_0x5c3b('0xfe'),_0x6603b8[_0x5c3b('0x5e')]));var _0x4896d2=this[_0x5c3b('0x85')][_0x5c3b('0x75')](this,_0x6603b8);if(_0x4896d2){for(var _0x5d7f80 in _0x4896d2){if(_0x4896d2[_0x5c3b('0x97')](_0x5d7f80)){this[_0x5c3b('0xe')][_0x5c3b('0xa0')](util[_0x5c3b('0x2c')](_0x5c3b('0xff'),_0x5d7f80[_0x5c3b('0x6e')]()),_0x4896d2[_0x5d7f80]);}}this['createSquareMessage'](_0x4896d2[_0x5c3b('0xed')],_0x5c3b('0xee'),'sesteknda','');if(_0x4896d2[_0x5c3b('0x100')]){this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x4896d2['audiofile']));var _0x25384f=this[_0x5c3b('0xe')]['streamFile'](_0x4896d2[_0x5c3b('0x100')]);try{fs[_0x5c3b('0x101')](_0x4896d2[_0x5c3b('0x100')]+_0x5c3b('0x102'));}catch(_0x272740){logger['error'](_0x272740);}return _0x25384f;}else{return this[_0x5c3b('0xe')]['noop'](util['format'](_0x5c3b('0x103'),_0x4896d2[_0x5c3b('0xed')]));}}return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x6603b8,_0x5c3b('0x104'));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x105')]=function(_0x117c27){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x106'),_0x117c27[_0x5c3b('0x38')]));return this[_0x5c3b('0xe')]['noop'](_0x5c3b('0x105'));};AGIVertices[_0x5c3b('0x10')]['ext_dial']=function(_0x2a7477){logger['info'](util[_0x5c3b('0x2c')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x2a7477[_0x5c3b('0x38')]));var _0x2316d4='';if(_0x2a7477[_0x5c3b('0x107')]){if(!this[_0x5c3b('0x8b')](_0x2a7477[_0x5c3b('0x107')])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x2a7477,'no\x20trunk\x20selected');}else{var _0x1447b0=parseInt(_0x2a7477[_0x5c3b('0x107')],0xa);if(isNaN(_0x1447b0)){_0x2316d4=_0x2a7477[_0x5c3b('0x107')];}else{_0x2316d4=this[_0x5c3b('0x1d')][_0x5c3b('0x75')](this,_0x2a7477[_0x5c3b('0x107')]);if(!_0x2316d4){return this['channel'][_0x5c3b('0x2f')](_0x2a7477,_0x5c3b('0x108'));}}}}else if(_0x2a7477['trunk_name']){_0x2316d4=_0x2a7477['trunk_name'];}else{return this[_0x5c3b('0xe')]['error'](_0x2a7477,_0x5c3b('0x109'));}var _0x416305=this[_0x5c3b('0xe')]['exec'](_0x5c3b('0xe5'),[util[_0x5c3b('0x2c')]('SIP/%s/%s',_0x2316d4,_0x2a7477[_0x5c3b('0x4b')]),_0x2a7477['timeout'],_0x2a7477[_0x5c3b('0xe6')],_0x2a7477[_0x5c3b('0x67')]]);if(_0x416305[_0x5c3b('0xa4')]===-0x1){return _0x416305;}return this['channel'][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x10a'),_0x5c3b('0xe5')));};AGIVertices['prototype'][_0x5c3b('0x10b')]=function(_0xb1ef21){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x10c'),_0xb1ef21[_0x5c3b('0x38')]));return this['channel'][_0x5c3b('0xab')](_0x5c3b('0x10b'));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xc')]=function(_0x457b22){logger['info'](util[_0x5c3b('0x2c')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x457b22[_0x5c3b('0x38')]));if(_0x457b22[_0x5c3b('0xa7')]===0x0){return this['maxRetry'](_0x457b22);}_0x457b22[_0x5c3b('0xa7')]-=0x1;if(!this[_0x5c3b('0x8b')](_0x457b22[_0x5c3b('0x10d')])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x457b22,_0x5c3b('0x10e'));}var _0x4cb411=this['getSound'][_0x5c3b('0x75')](this,_0x457b22[_0x5c3b('0x10d')]);if(!_0x4cb411){return this['channel'][_0x5c3b('0x2f')](_0x457b22,'no\x20file\x20audio\x20found');}if(!this[_0x5c3b('0x8b')](_0x457b22[_0x5c3b('0x10f')])){return this['channel'][_0x5c3b('0x2f')](_0x5c3b('0xd9'));}var _0x4ede76=this['channel'][_0x5c3b('0x110')](_0x4cb411,_0x457b22[_0x5c3b('0x111')],_0x457b22['maxdigit']);var _0x2f4cc9=_0x4ede76['result']?_0x4ede76[_0x5c3b('0xa4')][_0x5c3b('0x112')]():'';logger[_0x5c3b('0x32')](_0x5c3b('0x113'),JSON[_0x5c3b('0x79')](_0x4ede76));if(_0x4ede76[_0x5c3b('0xa4')]===-0x1){this[_0x5c3b('0x37')][_0x5c3b('0x75')](this,_0x457b22,_0x2f4cc9);return _0x4ede76;}else if(_0x4ede76[_0x5c3b('0xa6')]==='timeout'){_0x4ede76[_0x5c3b('0xa4')]=_0x2f4cc9[_0x5c3b('0x9d')]>=parseInt(_0x457b22[_0x5c3b('0x114')])?'x':'i';}else{_0x4ede76['result']=_0x2f4cc9[_0x5c3b('0x9d')]>=parseInt(_0x457b22[_0x5c3b('0x114')])&&_0x2f4cc9[_0x5c3b('0x9d')]<=parseInt(_0x457b22[_0x5c3b('0x115')])?'x':'i';}var _0x489b75=this[_0x5c3b('0x11')]['sync'](this,_0x457b22['variable_id']);if(!_0x489b75){return this['channel'][_0x5c3b('0x2f')](_0x457b22,_0x5c3b('0xda'));}this['channel'][_0x5c3b('0xa0')](_0x489b75,_0x2f4cc9);if(this[_0x5c3b('0x8b')](_0x457b22[_0x5c3b('0x116')])){var _0x219b51=parseInt(_0x457b22[_0x5c3b('0x116')],0xa);var _0xed16d7=rs[_0x5c3b('0x117')]({'charset':'*','length':_0x219b51});var _0x1f68e0=_0x2f4cc9[_0x5c3b('0x9d')];if(_0x1f68e0>0x0){if(_0x1f68e0>_0x219b51){this[_0x5c3b('0x37')][_0x5c3b('0x75')](this,_0x457b22,_0x457b22[_0x5c3b('0x118')]===_0x5c3b('0x119')?_0xed16d7+_0x2f4cc9['substr'](_0x219b51):_0x2f4cc9[_0x5c3b('0x11a')](0x0,_0x1f68e0-_0x219b51)+_0xed16d7);}else{this[_0x5c3b('0x37')]['sync'](this,_0x457b22,rs[_0x5c3b('0x117')]({'charset':'*','length':_0x1f68e0}));}}else{this['createSquareDetailsReport'][_0x5c3b('0x75')](this,_0x457b22,'');}}else{this[_0x5c3b('0x37')][_0x5c3b('0x75')](this,_0x457b22,_0x2f4cc9);}return _0x4ede76;};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xd')]=function(_0x294412){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x294412[_0x5c3b('0x38')]));return this[_0x5c3b('0xc')](_0x294412);};AGIVertices[_0x5c3b('0x10')]['goal']=function(_0x62db8d){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0x11b'),_0x62db8d['label']));this[_0x5c3b('0x37')][_0x5c3b('0x75')](this,_0x62db8d,_0x62db8d[_0x5c3b('0x11c')]);return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x11d'),_0x62db8d[_0x5c3b('0x11c')]));};AGIVertices[_0x5c3b('0x10')]['awspolly']=function(_0x2e1060){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x2e1060[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x2e1060[_0x5c3b('0x11e')])||!this[_0x5c3b('0x8b')](_0x2e1060[_0x5c3b('0x11f')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0x120'));}if(!this[_0x5c3b('0x8b')](_0x2e1060[_0x5c3b('0x5e')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xc6'));}this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x121'),_0x2e1060[_0x5c3b('0x5e')]));var _0x445823=this[_0x5c3b('0x8d')]['sync'](this,_0x2e1060);if(_0x445823){this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format'](_0x5c3b('0x122'),_0x445823));var _0x1c9142=this[_0x5c3b('0xe')][_0x5c3b('0x123')](_0x445823);try{fs[_0x5c3b('0x101')](_0x445823+'.wav');}catch(_0x4a41b4){logger[_0x5c3b('0x2f')](_0x4a41b4);}return _0x1c9142;}return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x2e1060,_0x5c3b('0x124'));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x125')]=function(_0x59069b){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x126'),_0x59069b[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x59069b[_0x5c3b('0x11e')])||!this[_0x5c3b('0x8b')](_0x59069b[_0x5c3b('0x11f')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0x120'));}if(!this[_0x5c3b('0x8b')](_0x59069b[_0x5c3b('0x127')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0x128'));}if(!this[_0x5c3b('0x8b')](_0x59069b['text'])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xc6'));}this[_0x5c3b('0xe')][_0x5c3b('0xea')]=!![];this[_0x5c3b('0x37')](_0x59069b);this[_0x5c3b('0x44')](_0x59069b[_0x5c3b('0x5e')],'in','','');this['channel'][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x129'),_0x59069b[_0x5c3b('0x5e')]));var _0x2e5be3=this[_0x5c3b('0x90')][_0x5c3b('0x75')](this,_0x59069b);if(_0x2e5be3){for(var _0x2e27ec in _0x2e5be3){if(_0x2e5be3[_0x5c3b('0x97')](_0x2e27ec)&&_[_0x5c3b('0x98')](_0x2e5be3[_0x2e27ec])){this['channel']['setVariable'](util[_0x5c3b('0x2c')]('AWS_LEX_%s',_0x2e27ec[_0x5c3b('0x6e')]()),_0x2e5be3[_0x2e27ec]);}}if(_[_0x5c3b('0x47')](_0x2e5be3['message'])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0x12a'));}else{this[_0x5c3b('0x44')](_0x2e5be3[_0x5c3b('0x7b')],_0x5c3b('0xee'),_0x5c3b('0x12b'),'');return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x12c'),_0x2e5be3[_0x5c3b('0x7b')]));}}return this[_0x5c3b('0xe')]['error'](_0x59069b,_0x5c3b('0x12d'));};AGIVertices[_0x5c3b('0x10')]['googleasr']=function(_0x47b3e5){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x12e'),_0x47b3e5[_0x5c3b('0x38')],_0x47b3e5[_0x5c3b('0x69')]));if(!this['isConfigured'](_0x47b3e5[_0x5c3b('0x87')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')]('no\x20key\x20configured');}var _0x4ad6b0='wav';var _0x53e152=util[_0x5c3b('0x2c')](_0x5c3b('0x12f'),FILES_PATH,rs['generate'](0x4));var _0x2600cb=util[_0x5c3b('0x2c')](_0x5c3b('0x9f'),_0x53e152,_0x4ad6b0);var _0x5c7d43=!![];if(_0x47b3e5[_0x5c3b('0x130')]===_0x5c3b('0x131')){_0x5c7d43=![];}var _0xbbbc54=this[_0x5c3b('0xe')][_0x5c3b('0x132')](_0x53e152,_0x4ad6b0,_0x47b3e5['intKey'],_0x47b3e5[_0x5c3b('0x69')],undefined,_0x5c7d43);if(_0xbbbc54[_0x5c3b('0xa4')]!==-0x1){this[_0x5c3b('0xe')]['noop'](util[_0x5c3b('0x2c')](_0x5c3b('0x133'),_0x2600cb));var _0x2cc728=this[_0x5c3b('0x91')]['sync'](this,_0x47b3e5,_0x2600cb);if(_0x2cc728){for(var _0x3b634c in _0x2cc728){if(_0x2cc728[_0x5c3b('0x97')](_0x3b634c)){this[_0x5c3b('0xe')][_0x5c3b('0xa0')](util[_0x5c3b('0x2c')]('GOOGLE_ASR_%s',_0x3b634c[_0x5c3b('0x6e')]()),_0x2cc728[_0x3b634c]);}}return this['channel'][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x134'),JSON[_0x5c3b('0x79')](_0x2cc728)));}}return _0xbbbc54;};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x135')]=function(_0x501b65){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x136'),_0x501b65[_0x5c3b('0x38')]));if(!this['isConfigured'](_0x501b65[_0x5c3b('0x137')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0x138'));}if(!this[_0x5c3b('0x8b')](_0x501b65[_0x5c3b('0x94')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0x139'));}var _0x1c3d0a=_0x5c3b('0x13a');var _0x1b7bc2=util[_0x5c3b('0x2c')](_0x5c3b('0x12f'),FILES_PATH,rs[_0x5c3b('0x117')](0x4));var _0x5ce30d=util['format']('%s.%s',_0x1b7bc2,_0x1c3d0a);var _0xdc488b=!![];if(_0x501b65[_0x5c3b('0x130')]===_0x5c3b('0x131')){_0xdc488b=![];}var _0x251eee=this[_0x5c3b('0xe')][_0x5c3b('0x132')](_0x1b7bc2,_0x1c3d0a,_0x501b65['intKey'],_0x501b65['timeout'],undefined,_0xdc488b);if(_0x251eee[_0x5c3b('0xa4')]!==-0x1){this['channel']['noop'](util[_0x5c3b('0x2c')]('tilde\x20%s\x20file\x20created',_0x5ce30d));var _0x4faec6=this['tildeASR']['sync'](this,_0x501b65,_0x5ce30d);if(_0x4faec6){for(var _0x5a9768 in _0x4faec6){if(_0x4faec6['hasOwnProperty'](_0x5a9768)){this[_0x5c3b('0xe')][_0x5c3b('0xa0')](util['format'](_0x5c3b('0x13b'),_0x5a9768[_0x5c3b('0x6e')]()),_0x4faec6[_0x5a9768]);}}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('TildeASR\x20Result\x20%s',JSON[_0x5c3b('0x79')](_0x4faec6)));}}return _0x251eee;};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x13c')]=function(_0x594962){logger['info'](util[_0x5c3b('0x2c')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x594962[_0x5c3b('0x38')]));return this[_0x5c3b('0xe')][_0x5c3b('0x13d')](_0x594962[_0x5c3b('0x3f')],_0x594962[_0x5c3b('0x40')],_0x594962['priority']);};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x13e')]=function(_0x2f0d53){logger['info'](util[_0x5c3b('0x2c')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x2f0d53[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x2f0d53['condition'])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x2f0d53,_0x5c3b('0x13f'));}try{var _0xed4304=eval(_0x2f0d53[_0x5c3b('0x140')])?_0x5c3b('0x141'):_0x5c3b('0x142');this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('EVAL\x20CONDITION\x20%s\x20%s',_0x2f0d53['condition'],_0xed4304));return{'code':0xc8,'result':_0xed4304};}catch(_0x5c7cba){return{'code':0xc8,'result':_0x5c3b('0x142')};}};AGIVertices[_0x5c3b('0x10')]['gotoiftime']=function(_0x1808c4){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x1808c4[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x1808c4[_0x5c3b('0x143')])){return this['channel']['error'](_0x1808c4,'no\x20interval\x20configured');}var _0x16854e=this['getIntervals'][_0x5c3b('0x75')](this,_0x1808c4[_0x5c3b('0x143')]);if(!_0x16854e){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x1808c4,_0x5c3b('0x144'));}for(var _0x177199=0x0;_0x177199<_0x16854e[_0x5c3b('0x9d')];_0x177199+=0x1){var _0x3c7e74=this[_0x5c3b('0xe')]['getVariable'](util[_0x5c3b('0x2c')](_0x5c3b('0x145'),_0x16854e[_0x177199]));if(_0x3c7e74['result']===-0x1){return _0x3c7e74;}logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x146'),_0x16854e[_0x177199],_0x3c7e74[_0x5c3b('0xa6')]));if(_0x3c7e74[_0x5c3b('0xa6')]===_0x5c3b('0x141')){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x146'),_0x16854e[_0x177199],_0x5c3b('0x141')));this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('IFTIME\x20%s\x20%s',_0x16854e[_0x177199],'true'));return{'code':0xc8,'result':_0x5c3b('0x141')};}else{logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x146'),_0x16854e[_0x177199],_0x5c3b('0x142')));this[_0x5c3b('0xe')]['noop'](util[_0x5c3b('0x2c')](_0x5c3b('0x146'),_0x16854e[_0x177199],_0x5c3b('0x142')));}}return{'code':0xc8,'result':_0x5c3b('0x142')};};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x147')]=function(_0x3851d8){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x148'),_0x3851d8['label']));return this[_0x5c3b('0xe')]['hangup']();};AGIVertices['prototype']['ispeechasr']=function(_0x108f79){logger['info'](util[_0x5c3b('0x2c')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x108f79[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x108f79[_0x5c3b('0x87')])){return this[_0x5c3b('0xe')]['noop'](_0x5c3b('0xe9'));}var _0x424311='wav';var _0x41c6f2=util[_0x5c3b('0x2c')](_0x5c3b('0x12f'),FILES_PATH,rs[_0x5c3b('0x117')](0x4));var _0x2a090f=util['format']('%s.%s',_0x41c6f2,_0x424311);var _0x48ea9c=!![];if(_0x108f79[_0x5c3b('0x130')]===_0x5c3b('0x131')){_0x48ea9c=![];}var _0x142510=this['channel'][_0x5c3b('0x132')](_0x41c6f2,_0x424311,_0x108f79[_0x5c3b('0x149')],_0x108f79[_0x5c3b('0x69')],undefined,_0x48ea9c);if(_0x142510[_0x5c3b('0xa4')]!==-0x1){this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('ispeech\x20%s\x20file\x20created',_0x2a090f));var _0x2afa41=this['ispeechASR'][_0x5c3b('0x75')](this,_0x108f79,_0x2a090f);if(_0x2afa41){for(var _0x43d1d8 in _0x2afa41){if(_0x2afa41[_0x5c3b('0x97')](_0x43d1d8)){this['channel']['setVariable'](util[_0x5c3b('0x2c')]('ISPEECH_ASR_%s',_0x43d1d8[_0x5c3b('0x6e')]()),_0x2afa41[_0x43d1d8]);}}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x2afa41)));}}return _0x142510;};AGIVertices[_0x5c3b('0x10')]['ispeechtts']=function(_0x329154){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0x14a'),_0x329154['label']));if(!this[_0x5c3b('0x8b')](_0x329154[_0x5c3b('0x87')])){return this['channel']['noop']('no\x20key\x20configured');}if(!this[_0x5c3b('0x8b')](_0x329154[_0x5c3b('0x5e')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xc6'));}this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x329154[_0x5c3b('0x5e')]));var _0x1d8a78=this[_0x5c3b('0x86')][_0x5c3b('0x75')](this,_0x329154);if(_0x1d8a78){this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x14b'),_0x1d8a78));var _0x494278=this[_0x5c3b('0xe')][_0x5c3b('0x123')](_0x1d8a78,_0x329154['intKey']);try{fs[_0x5c3b('0x101')](_0x1d8a78+'.wav');}catch(_0x54f850){logger['error'](_0x54f850);}return _0x494278;}return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x329154,_0x5c3b('0x14c'));};AGIVertices['prototype'][_0x5c3b('0x14d')]=function(_0x19fd30){logger[_0x5c3b('0x32')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x19fd30[_0x5c3b('0x38')]));if(!this['isConfigured'](_0x19fd30[_0x5c3b('0x14e')])){return this[_0x5c3b('0xe')]['error'](_0x19fd30,_0x5c3b('0x14f'));}logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x5c3b('0xe')][_0x5c3b('0x3b')],_0x19fd30['findBy']));var _0x420b29=this[_0x5c3b('0x56')][_0x5c3b('0x75')](this,_0x19fd30[_0x5c3b('0x14e')]);if(_0x420b29){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0x150'),this[_0x5c3b('0xe')]['callerid'],_0x19fd30[_0x5c3b('0x14e')]));this[_0x5c3b('0xe')]['noop'](util['format'](_0x5c3b('0x150'),this['channel'][_0x5c3b('0x3b')],_0x19fd30[_0x5c3b('0x14e')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0x151'),this[_0x5c3b('0xe')]['callerid'],_0x19fd30[_0x5c3b('0x14e')]));this['channel'][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x151'),this[_0x5c3b('0xe')]['callerid'],_0x19fd30[_0x5c3b('0x14e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x5c3b('0x152')]=function(_0x3dfa02){logger[_0x5c3b('0x32')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x3dfa02['label']));if(!this['isConfigured'](_0x3dfa02[_0x5c3b('0x14e')])){return this[_0x5c3b('0xe')]['error'](_0x3dfa02,_0x5c3b('0x14f'));}logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x153'),this[_0x5c3b('0xe')][_0x5c3b('0x3b')],_0x3dfa02[_0x5c3b('0x14e')]));var _0xe5348f=this['agentLogout'][_0x5c3b('0x75')](this,_0x3dfa02[_0x5c3b('0x14e')]);if(_0xe5348f){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0x150'),this[_0x5c3b('0xe')][_0x5c3b('0x3b')],_0x3dfa02[_0x5c3b('0x14e')]));this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format'](_0x5c3b('0x150'),this[_0x5c3b('0xe')][_0x5c3b('0x3b')],_0x3dfa02[_0x5c3b('0x14e')]));return{'code':0xc8,'result':_0x5c3b('0x154')};}else{logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0x151'),this['channel'][_0x5c3b('0x3b')],_0x3dfa02[_0x5c3b('0x14e')]));this['channel'][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x151'),this[_0x5c3b('0xe')][_0x5c3b('0x3b')],_0x3dfa02['findBy']));return{'code':0xc8,'result':_0x5c3b('0x155')};}};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x156')]=function(_0x5614b5){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x5614b5[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x5614b5[_0x5c3b('0x157')])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x5614b5,_0x5c3b('0x158'));}this[_0x5c3b('0xe')]['noop'](util['format']('math\x20%s',_0x5614b5[_0x5c3b('0x157')]));var _0xf13a64=eval(_0x5614b5['operation']);if(!this[_0x5c3b('0x8b')](_0x5614b5[_0x5c3b('0x10f')])){return this[_0x5c3b('0xe')]['noop'](_0x5c3b('0xd9'));}var _0xa11287=this['getVariable']['sync'](this,_0x5614b5['variable_id']);if(!_0xa11287){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x5614b5,_0x5c3b('0xda'));}if(_[_0x5c3b('0x9c')](_0xf13a64)){var _0x2d2641=this;_0xf13a64['forEach'](function(_0x156015,_0x2af607){_0x2d2641['channel'][_0x5c3b('0xa0')](util[_0x5c3b('0x2c')](_0x5c3b('0x159'),_0xa11287,_0x2af607),_0x156015);});return this['channel'][_0x5c3b('0xab')](util['format'](_0x5c3b('0x15a'),_0xa11287));}else{return this[_0x5c3b('0xe')][_0x5c3b('0xa0')](_0xa11287,_0xf13a64);}};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0xb')]=function(_0xc487a0){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0x15b'),_0xc487a0[_0x5c3b('0x38')]));if(_0xc487a0['retry']===0x0){return this[_0x5c3b('0xa8')](_0xc487a0);}_0xc487a0[_0x5c3b('0xa7')]-=0x1;if(!this[_0x5c3b('0x8b')](_0xc487a0['file_id'])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0xc487a0,_0x5c3b('0x10e'));}var _0xaafa8b=this['getSound'][_0x5c3b('0x75')](this,_0xc487a0[_0x5c3b('0x10d')]);if(!_0xaafa8b){return this[_0x5c3b('0xe')]['error'](_0xc487a0,_0x5c3b('0x15c'));}var _0x1c66f4=this[_0x5c3b('0xe')][_0x5c3b('0x110')](_0xaafa8b,_0xc487a0[_0x5c3b('0x111')],_0xc487a0[_0x5c3b('0x15d')]);var _0x344f47=_0x1c66f4[_0x5c3b('0xa4')];if(_0x1c66f4[_0x5c3b('0xa4')]===-0x1){this[_0x5c3b('0x37')][_0x5c3b('0x75')](this,_0xc487a0,'-1');return _0x1c66f4;}else if(_0x1c66f4['extra']===_0x5c3b('0x69')){_0x1c66f4[_0x5c3b('0xa4')]=_0x1c66f4[_0x5c3b('0xa4')][_0x5c3b('0x9d')]>0x0?_0x1c66f4['result']:'t';}else if(_[_0x5c3b('0x46')](_0x1c66f4[_0x5c3b('0xa4')])){_0x1c66f4[_0x5c3b('0xa4')]='#';_0x344f47='#';}if(!this[_0x5c3b('0x8b')](_0xc487a0['variable_id'])){this[_0x5c3b('0xe')]['noop'](_0x5c3b('0xd9'));}else{var _0x1ff3d6=this[_0x5c3b('0x11')][_0x5c3b('0x75')](this,_0xc487a0[_0x5c3b('0x10f')]);if(!_0x1ff3d6){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0xc487a0,_0x5c3b('0xda'));}this[_0x5c3b('0xe')][_0x5c3b('0xa0')](_0x1ff3d6,_0x344f47);}this['createSquareDetailsReport']['sync'](this,_0xc487a0,_0x344f47);return _0x1c66f4;};AGIVertices['prototype'][_0x5c3b('0xab')]=function(_0x2c160e){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0x15e'),_0x2c160e[_0x5c3b('0x38')]));return this[_0x5c3b('0xe')]['noop'](_0x2c160e['output']||_0x2c160e[_0x5c3b('0x38')]);};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x15f')]=function(_0x1b43b8){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x1b43b8['label']));if(!this[_0x5c3b('0x8b')](_0x1b43b8[_0x5c3b('0x14e')])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x1b43b8,'no\x20find\x20by\x20configured');}logger[_0x5c3b('0x32')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x5c3b('0xe')][_0x5c3b('0x3b')],_0x1b43b8[_0x5c3b('0x14e')]));var _0x472259=this[_0x5c3b('0x160')][_0x5c3b('0x75')](this,_0x1b43b8[_0x5c3b('0x161')]);var _0x42831b=this[_0x5c3b('0x51')][_0x5c3b('0x75')](this,_0x1b43b8[_0x5c3b('0x14e')],_0x472259);if(_0x42831b){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0x150'),this[_0x5c3b('0xe')]['callerid'],_0x1b43b8[_0x5c3b('0x14e')]));this['channel'][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x150'),this[_0x5c3b('0xe')]['callerid'],_0x1b43b8[_0x5c3b('0x14e')]));return{'code':0xc8,'result':_0x5c3b('0x154')};}else{logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x5c3b('0xe')][_0x5c3b('0x3b')],_0x1b43b8['findBy']));this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x150'),this[_0x5c3b('0xe')][_0x5c3b('0x3b')],_0x1b43b8[_0x5c3b('0x14e')]));return{'code':0xc8,'result':_0x5c3b('0x155')};}};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x162')]=function(_0x556eb3){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x163'),_0x556eb3[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x556eb3['file_id'])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x556eb3,_0x5c3b('0x10e'));}var _0x4057ea=this['getSound'][_0x5c3b('0x75')](this,_0x556eb3[_0x5c3b('0x10d')]);if(!_0x4057ea){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x556eb3,_0x5c3b('0x15c'));}var _0x149282=this[_0x5c3b('0xe')][_0x5c3b('0x58')](_0x5c3b('0x164'),[_0x4057ea,_0x556eb3['opts']]);if(_0x149282[_0x5c3b('0xa4')]===-0x1){return _0x149282;}return this['channel'][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('Executed\x20command\x20%s\x20%s',_0x5c3b('0x164'),_0x4057ea));};AGIVertices['prototype']['queue']=function(_0x52359b){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0x165'),_0x52359b['label']));if(!this[_0x5c3b('0x8b')](_0x52359b[_0x5c3b('0x166')])){return this['channel'][_0x5c3b('0x2f')](_0x52359b,_0x5c3b('0x167'));}var _0x5e0ff0='';var _0x9634b4=parseInt(_0x52359b[_0x5c3b('0x166')],0xa);if(isNaN(_0x9634b4)){_0x5e0ff0=_0x52359b[_0x5c3b('0x166')];}else{_0x5e0ff0=this['getVoiceQueue'][_0x5c3b('0x75')](this,_0x52359b[_0x5c3b('0x166')]);if(!_0x5e0ff0){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x52359b,'no\x20queue\x20found');}}var _0xdb8f78='';if(this['isConfigured'](_0x52359b[_0x5c3b('0x10d')])){var _0x41d242=this[_0x5c3b('0x1f')][_0x5c3b('0x75')](this,_0x52359b[_0x5c3b('0x10d')]);if(_0x41d242){_0xdb8f78=_0x41d242;}}this[_0x5c3b('0x37')]['sync'](this,_0x52359b,_0x5e0ff0);if(_0x52359b['opts'][_0x5c3b('0x168')]('x')<0x0){_0x52359b[_0x5c3b('0xe6')]+='x';}if(_0x52359b[_0x5c3b('0xe6')]['indexOf']('X')<0x0){_0x52359b[_0x5c3b('0xe6')]+='X';}this[_0x5c3b('0xe')][_0x5c3b('0xa0')](_0x5c3b('0x169'),_0x5e0ff0?_0x5e0ff0[_0x5c3b('0x16a')]():'');var _0x1eef37=this['channel'][_0x5c3b('0x58')](_0x5c3b('0x16b'),[_0x5e0ff0,_0x52359b[_0x5c3b('0xe6')],_0x52359b[_0x5c3b('0x67')],_0xdb8f78,_0x52359b[_0x5c3b('0x69')],_0x52359b[_0x5c3b('0x7')],_0x52359b[_0x5c3b('0x16c')],_0x52359b[_0x5c3b('0x16d')],'',_0x52359b[_0x5c3b('0x16e')]]);if(_0x1eef37[_0x5c3b('0xa4')]===-0x1){return _0x1eef37;}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format']('Executed\x20command\x20%s\x20%s',_0x5c3b('0x16b'),_0x5e0ff0));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x16f')]=function(_0x1fb5a2){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x170'),_0x1fb5a2[_0x5c3b('0x38')]));var _0x50f23e=_0x1fb5a2[_0x5c3b('0x171')]||'wav';var _0x226055=util[_0x5c3b('0x2c')](_0x5c3b('0x172'),this['channel']['uniqueid'],rs[_0x5c3b('0x117')](0x5));var _0x2d10a2=util[_0x5c3b('0x2c')](_0x5c3b('0x173'),FILES_PATH,_0x226055,_0x50f23e);var _0x175da3=util[_0x5c3b('0x2c')]('%s/recordings/%s',FILES_PATH,_0x226055);this[_0x5c3b('0x3c')][_0x5c3b('0x75')](this,_0x1fb5a2,_0x226055,_0x2d10a2);this[_0x5c3b('0xe')]['setVariable'](_0x5c3b('0x174'),_0x226055);logger[_0x5c3b('0x32')](_0x5c3b('0x175'),_0x175da3,_0x50f23e,_0x1fb5a2[_0x5c3b('0x176')],_0x1fb5a2[_0x5c3b('0x69')]);return this[_0x5c3b('0xe')][_0x5c3b('0x132')](_0x175da3,_0x50f23e,_0x1fb5a2[_0x5c3b('0x176')],_0x1fb5a2[_0x5c3b('0x69')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x185c36){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x185c36[_0x5c3b('0x38')]));if(!this['isConfigured'](_0x185c36[_0x5c3b('0x67')])){return this[_0x5c3b('0xe')]['noop'](_0x5c3b('0x177'));}var _0x1bba96=this['restAPI'][_0x5c3b('0x75')](this,_0x185c36);logger['info'](util[_0x5c3b('0x2c')]('Response:',util['inspect'](_0x1bba96,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x185c36['variable_id'])){return this['channel']['noop'](_0x5c3b('0x178'));}var _0x4a4864=this['getVariable'][_0x5c3b('0x75')](this,_0x185c36[_0x5c3b('0x10f')]);if(!_0x4a4864){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x185c36,_0x5c3b('0xda'));}this[_0x5c3b('0xe')][_0x5c3b('0xa0')](util['format']('%s_STATUS_CODE',_0x4a4864),_0x1bba96[_0x5c3b('0x7a')]?_0x1bba96[_0x5c3b('0x7a')]:_0x5c3b('0x179'));this['channel']['setVariable'](util[_0x5c3b('0x2c')](_0x5c3b('0x17a'),_0x4a4864),_0x1bba96['statusMessage']?_0x1bba96[_0x5c3b('0x17b')]:'OK');if(_0x1bba96[_0x5c3b('0x6f')]){try{this[_0x5c3b('0x9e')](_0x1bba96[_0x5c3b('0x6f')],_0x4a4864);}catch(_0x2cac40){logger[_0x5c3b('0x2f')](util[_0x5c3b('0x2c')](_0x5c3b('0x17c'),_0x4a4864));}}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('variable\x20%s\x20set',_0x4a4864));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x17d')]=function(_0x2d84cb){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x17e'),_0x2d84cb['label']));return this[_0x5c3b('0xe')][_0x5c3b('0x17f')](_0x2d84cb['digits'][_0x5c3b('0x5a')](/\s+/g,''),_0x2d84cb[_0x5c3b('0x176')]);};AGIVertices['prototype']['saynumber']=function(_0x10e2a9){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x10e2a9['label']));return this['channel'][_0x5c3b('0x180')](_0x10e2a9['number']['replace'](/\s+/g,''),_0x10e2a9['escape_digits']);};AGIVertices['prototype'][_0x5c3b('0x181')]=function(_0x28f043){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x28f043[_0x5c3b('0x38')]));return this[_0x5c3b('0xe')]['sayPhonetic'](_0x28f043['text'],_0x28f043[_0x5c3b('0x176')]);};AGIVertices['prototype'][_0x5c3b('0x182')]=function(_0xe069bc){logger['info'](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0xe069bc[_0x5c3b('0x38')]));if(!this['isConfigured'](_0xe069bc[_0x5c3b('0x183')])){return this['channel'][_0x5c3b('0xab')](_0x5c3b('0x184'));}var _0x568abc=this['getMailAccount'][_0x5c3b('0x75')](this,_0xe069bc['account_id']);if(!_0x568abc||!_0x568abc[_0x5c3b('0x185')]){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0xe069bc,_0x5c3b('0x186'));}var _0x463a0f={'from':util[_0x5c3b('0x2c')]('\x22%s\x22\x20<%s>',_0x568abc['name'],_0x568abc['email']||_0x568abc[_0x5c3b('0x185')][_0x5c3b('0x187')]),'to':_0xe069bc['to']||'','cc':_0xe069bc['cc']||'','bcc':_0xe069bc[_0x5c3b('0x188')]||'','subject':_0xe069bc[_0x5c3b('0x189')],'html':_0xe069bc[_0x5c3b('0x5e')],'text':_0xe069bc['text']};if(this[_0x5c3b('0x8b')](_0xe069bc[_0x5c3b('0x18a')])){}logger['debug'](_0x5c3b('0x18b'),JSON['stringify'](_0x463a0f));this[_0x5c3b('0x37')][_0x5c3b('0x75')](this,_0xe069bc,_0xe069bc[_0x5c3b('0x183')]);this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x18c'),_0x568abc['name']));this[_0x5c3b('0x23')][_0x5c3b('0x75')](this,_0x568abc['smtpOptions'],_0x463a0f);return this['channel']['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x18d')]=function(_0x4f462a){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x18e'),_0x4f462a[_0x5c3b('0x38')]));return this[_0x5c3b('0xe')][_0x5c3b('0xab')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x18f')]=function(_0xda477){logger['info'](util['format'](_0x5c3b('0x190'),_0xda477['label']));if(!this[_0x5c3b('0x8b')](_0xda477[_0x5c3b('0x191')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')]('no\x20sms\x20account\x20configured');}var _0x221883=this[_0x5c3b('0x192')][_0x5c3b('0x75')](this,_0xda477[_0x5c3b('0x191')]);if(!_0x221883){return this[_0x5c3b('0xe')]['error'](_0xda477,'no\x20sms\x20account\x20found');}var _0x2b2915={'body':_0xda477[_0x5c3b('0x193')],'phone':_0xda477['to']||'','SmsAccountId':_0x221883['id']};logger[_0x5c3b('0x194')](_0x5c3b('0x195'),JSON[_0x5c3b('0x79')](_0x2b2915));this[_0x5c3b('0x37')]['sync'](this,_0xda477,_0xda477[_0x5c3b('0x191')]);this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x196'),_0x221883[_0x5c3b('0x1c')]));this[_0x5c3b('0x36')]['sync'](this,_0x2b2915);return this[_0x5c3b('0xe')][_0x5c3b('0xab')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x5c3b('0x197')]=function(_0x22a3aa){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0x198'),_0x22a3aa[_0x5c3b('0x38')]));if(!this['isConfigured'](_0x22a3aa[_0x5c3b('0x10f')])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x22a3aa,_0x5c3b('0x199'));}var _0xee3e54=this[_0x5c3b('0x11')][_0x5c3b('0x75')](this,_0x22a3aa['variable_id']);if(!_0xee3e54){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x22a3aa,_0x5c3b('0xda'));}return this[_0x5c3b('0xe')]['setVariable'](_0xee3e54,_0x22a3aa[_0x5c3b('0x19a')]);};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x19b')]=function(_0x2fc40c){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0x19c'),_0x2fc40c[_0x5c3b('0x38')]));this['channel'][_0x5c3b('0xab')](_0x5c3b('0x19d'));var _0x3ee9bd=this[_0x5c3b('0xe')]['getVariable']('XMCS-UNIQUEID');if(!_['isEmpty'](_0x3ee9bd[_0x5c3b('0xa6')])){this['channel'][_0x5c3b('0x3d')]=_0x3ee9bd[_0x5c3b('0xa6')];}if(_0x2fc40c['answer']===_0x5c3b('0x19e')){this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0x19f'));return this[_0x5c3b('0xe')][_0x5c3b('0xb9')]();}return this['channel'][_0x5c3b('0xab')](_0x5c3b('0x1a0'));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x1a1')]=function(_0x5603e5){logger['info'](util[_0x5c3b('0x2c')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x5603e5[_0x5c3b('0x38')]));if(!this[_0x5c3b('0x8b')](_0x5603e5[_0x5c3b('0x1a2')])){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x5603e5,_0x5c3b('0x1a3'));}var _0x49fbe3=this[_0x5c3b('0x16')][_0x5c3b('0x75')](this,_0x5603e5[_0x5c3b('0x1a2')]);if(!this[_0x5c3b('0x8b')](_0x49fbe3)){return this['channel'][_0x5c3b('0x2f')](_0x5603e5,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x5603e5[_0x5c3b('0x1a2')]));}if(_0x49fbe3===this[_0x5c3b('0xe')][_0x5c3b('0x3a')]){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x5603e5,_0x5c3b('0x1a4'));}this['createSquareDetailsReport'][_0x5c3b('0x75')](this,_0x5603e5,_0x49fbe3);var _0x42b2fc=this['channel'][_0x5c3b('0x58')](_0x5c3b('0x1a5'),util[_0x5c3b('0x2c')](_0x5c3b('0x1a6'),config[_0x5c3b('0x7')][_0x5c3b('0x1a7')]||_0x5c3b('0x1a8'),_0x49fbe3,this['channel'][_0x5c3b('0x3a')]));if(_0x42b2fc[_0x5c3b('0xa4')]===-0x1){return _0x42b2fc;}return this[_0x5c3b('0xe')]['noop'](util[_0x5c3b('0x2c')](_0x5c3b('0xc3'),_0x5c3b('0x1a5'),_0x49fbe3));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x1a9')]=function(_0x40f1c1){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0x1aa'),_0x40f1c1[_0x5c3b('0x38')]));var _0x3847ea=this[_0x5c3b('0x57')][_0x5c3b('0x75')](this,_0x40f1c1[_0x5c3b('0xb7')]);this[_0x5c3b('0x37')][_0x5c3b('0x75')](this,_0x40f1c1,_0x40f1c1[_0x5c3b('0xb7')]);if(this[_0x5c3b('0x8b')](_0x40f1c1[_0x5c3b('0x10f')])){var _0xa75377=this[_0x5c3b('0x11')]['sync'](this,_0x40f1c1['variable_id']);if(_0xa75377){this[_0x5c3b('0xe')][_0x5c3b('0xa0')](_0xa75377,_0x3847ea);return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0x1ab'),_0x40f1c1[_0x5c3b('0xb7')],_0xa75377));}}return this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x40f1c1[_0x5c3b('0xb7')]));};AGIVertices['prototype'][_0x5c3b('0x1ac')]=function(_0x4a67b7){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0x1ad'),_0x4a67b7['label']));_0x4a67b7[_0x5c3b('0x5e')]=_0x4a67b7[_0x5c3b('0x5e')][_0x5c3b('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5c3b('0x8b')](_0x4a67b7[_0x5c3b('0x5c')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0x1ae'));}if(!this['isConfigured'](_0x4a67b7[_0x5c3b('0x5e')])){return this['channel'][_0x5c3b('0xab')]('no\x20text\x20configured');}this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format'](_0x5c3b('0x1af'),_0x4a67b7[_0x5c3b('0x5e')]));var _0x39aebf=this[_0x5c3b('0x5b')][_0x5c3b('0x75')](this,_0x4a67b7);if(_0x39aebf){this[_0x5c3b('0xe')][_0x5c3b('0xab')](util[_0x5c3b('0x2c')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x39aebf));var _0x11ae71=this[_0x5c3b('0xe')]['streamFile'](_0x39aebf);try{fs[_0x5c3b('0x101')](_0x39aebf+_0x5c3b('0x102'));}catch(_0x114716){logger['error'](_0x114716);}return _0x11ae71;}return this[_0x5c3b('0xe')]['error'](_0x4a67b7,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x1b0')]=function(_0x2059b8){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x1b1'),_0x2059b8[_0x5c3b('0x38')]));_0x2059b8[_0x5c3b('0x5e')]=_0x2059b8[_0x5c3b('0x5e')][_0x5c3b('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5c3b('0x8b')](_0x2059b8[_0x5c3b('0x5e')])){return this[_0x5c3b('0xe')][_0x5c3b('0xab')](_0x5c3b('0xc6'));}this[_0x5c3b('0xe')]['noop'](util[_0x5c3b('0x2c')](_0x5c3b('0x1b2'),_0x2059b8['text']));var _0x1a976b=this['googleTTS']['sync'](this,_0x2059b8);if(_0x1a976b){this['channel']['noop'](util[_0x5c3b('0x2c')](_0x5c3b('0x1b3'),_0x1a976b));var _0x22f466=this[_0x5c3b('0xe')]['streamFile'](_0x1a976b);try{fs['unlink'](_0x1a976b+_0x5c3b('0x102'));}catch(_0x193905){logger[_0x5c3b('0x2f')](_0x193905);}return _0x22f466;}return this['channel']['error'](_0x2059b8,_0x5c3b('0x1b4'));};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x1b5')]=function(_0x491db8){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x491db8['label']));if(!this[_0x5c3b('0x8b')](_0x491db8[_0x5c3b('0x14e')])){return this[_0x5c3b('0xe')]['error'](_0x491db8,_0x5c3b('0x14f'));}logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x153'),this['channel'][_0x5c3b('0x3b')],_0x491db8[_0x5c3b('0x14e')]));var _0x56f8d6=this['agentUnpause'][_0x5c3b('0x75')](this,_0x491db8[_0x5c3b('0x14e')]);if(_0x56f8d6){logger[_0x5c3b('0x32')](util['format'](_0x5c3b('0x150'),this['channel']['callerid'],_0x491db8[_0x5c3b('0x14e')]));this[_0x5c3b('0xe')][_0x5c3b('0xab')](util['format'](_0x5c3b('0x150'),this[_0x5c3b('0xe')][_0x5c3b('0x3b')],_0x491db8['findBy']));return{'code':0xc8,'result':_0x5c3b('0x154')};}else{logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')](_0x5c3b('0x151'),this['channel'][_0x5c3b('0x3b')],_0x491db8[_0x5c3b('0x14e')]));this['channel']['noop'](util['format'](_0x5c3b('0x151'),this['channel'][_0x5c3b('0x3b')],_0x491db8[_0x5c3b('0x14e')]));return{'code':0xc8,'result':_0x5c3b('0x155')};}};AGIVertices[_0x5c3b('0x10')][_0x5c3b('0x1b6')]=function(_0x2e276e){logger['info'](util[_0x5c3b('0x2c')](_0x5c3b('0x1b7'),_0x2e276e['label']));var _0x3ed01c=this[_0x5c3b('0xe')][_0x5c3b('0x58')](_0x5c3b('0x1b8'),[_0x2e276e[_0x5c3b('0x1b9')],_0x2e276e[_0x5c3b('0x7d')]]);if(_0x3ed01c[_0x5c3b('0xa4')]===-0x1){return _0x3ed01c;}return this['channel'][_0x5c3b('0xab')](util[_0x5c3b('0x2c')](_0x5c3b('0xc3'),_0x5c3b('0x1b8'),_0x2e276e[_0x5c3b('0x1b9')]));};AGIVertices[_0x5c3b('0x10')]['vswitch']=function(_0x140d70){logger[_0x5c3b('0x32')](util[_0x5c3b('0x2c')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x140d70[_0x5c3b('0x38')]));if(!this['isConfigured'](_0x140d70[_0x5c3b('0x10f')])){return this[_0x5c3b('0xe')]['error'](_0x140d70,_0x5c3b('0x199'));}var _0x33e781=this[_0x5c3b('0x11')][_0x5c3b('0x75')](this,_0x140d70[_0x5c3b('0x10f')]);if(!_0x33e781){return this[_0x5c3b('0xe')][_0x5c3b('0x2f')](_0x140d70,_0x5c3b('0xda'));}var _0x52ce01=this[_0x5c3b('0xe')][_0x5c3b('0x11')](_0x33e781);return{'code':0xc8,'result':_0x52ce01[_0x5c3b('0xa6')]?_0x52ce01['extra']:'-'};};String[_0x5c3b('0x10')][_0x5c3b('0xa2')]=function(_0x22e314,_0x569d0){return this['split'](_0x22e314)[_0x5c3b('0x1ba')](_0x569d0);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 0ca480f..19318f8 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 _0x9bc5=['syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','prototype','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','startAcw','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','agents','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','updateAcw','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','ACW','saveUnpause','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','deleteChannelAfterTimeout','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer'];(function(_0x3d670a,_0x352a5f){var _0x267faf=function(_0x4bd4d4){while(--_0x4bd4d4){_0x3d670a['push'](_0x3d670a['shift']());}};_0x267faf(++_0x352a5f);}(_0x9bc5,0x160));var _0x59bc=function(_0x439a50,_0x110711){_0x439a50=_0x439a50-0x0;var _0x388f28=_0x9bc5[_0x439a50];return _0x388f28;};'use strict';var _=require(_0x59bc('0x0'));var moment=require(_0x59bc('0x1'));var ami=require(_0x59bc('0x2'));var logger=require(_0x59bc('0x3'))(_0x59bc('0x4'));var RpcUser=require(_0x59bc('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x70bfa3){this[_0x59bc('0x6')]=_0x70bfa3['voiceQueues'];this['agents']=_0x70bfa3['agents'];this['timers']=_0x70bfa3[_0x59bc('0x7')];this[_0x59bc('0x8')]={};ami['on'](_0x59bc('0x9'),this[_0x59bc('0xa')][_0x59bc('0xb')](this));ami['on'](_0x59bc('0xc'),this[_0x59bc('0xd')][_0x59bc('0xb')](this));ami['on'](_0x59bc('0xe'),this[_0x59bc('0xf')][_0x59bc('0xb')](this));ami['on'](_0x59bc('0x10'),this[_0x59bc('0x11')]['bind'](this));ami['on'](_0x59bc('0x12'),this['syncAttendedTransfer'][_0x59bc('0xb')](this));ami['on'](_0x59bc('0x13'),this[_0x59bc('0x14')][_0x59bc('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0x59bc('0x15')][_0x59bc('0xb')](this));}function getDiff(_0x4d173d){var _0x2439e4=moment()[_0x59bc('0x16')](0x0);var _0x3b6c1e=moment(_0x4d173d)['milliseconds'](0x0);return _0x2439e4[_0x59bc('0x17')](_0x3b6c1e,'seconds');}Acw[_0x59bc('0x18')]['updateAcw']=function(_0x3963fd,_0x681c9f){var _0x5461c5=this;var _0x4bd9ed=getDiff(_0x5461c5[_0x59bc('0x7')][_0x3963fd][_0x59bc('0x19')]);clearTimeout(_0x5461c5[_0x59bc('0x7')][_0x3963fd][_0x59bc('0x1a')]);_0x5461c5[_0x59bc('0x7')][_0x3963fd][_0x59bc('0x1a')]=![];return RpcVoiceAgentReport[_0x59bc('0x1b')]({'acwtime':_0x4bd9ed},_0x5461c5['timers'][_0x3963fd][_0x59bc('0x1c')],_0x3963fd)[_0x59bc('0x1d')](function(_0x44420b){logger[_0x59bc('0x1e')](_0x59bc('0x1f'),_0x681c9f,_0x4bd9ed,_0x44420b);})[_0x59bc('0x20')](function(_0x55b0bd){logger[_0x59bc('0x21')](_0x59bc('0x22'),_0x681c9f,_0x55b0bd);})['finally'](function(){delete _0x5461c5[_0x59bc('0x7')][_0x3963fd];});};Acw[_0x59bc('0x18')][_0x59bc('0x23')]=function(_0x2287a1){try{var _0x57d276=this;var _0x315862=this[_0x59bc('0x8')][_0x2287a1][_0x59bc('0x24')];var _0x1c186c=this[_0x59bc('0x8')][_0x2287a1][_0x59bc('0x25')];var _0x20d093=this[_0x59bc('0x6')][_0x1c186c];var _0x274e72=![];var _0x50e1e1='ACW';if(_0x20d093[_0x59bc('0x26')]&&_0x20d093[_0x59bc('0x27')][_0x59bc('0x28')]){_0x274e72=!![];_0x50e1e1=_0x20d093[_0x59bc('0x27')][_0x59bc('0x28')];}return ami[_0x59bc('0x29')]({'action':'QueuePause','interface':_0x315862,'paused':!![],'reason':_0x50e1e1})['then'](function(){if(_0x57d276[_0x59bc('0x2a')][_0x315862]){return RpcUser[_0x59bc('0x2b')](_0x57d276['agents'][_0x315862]['id'])[_0x59bc('0x1d')](function(_0x44859c){if(!_0x44859c||_0x44859c[_0x59bc('0x2c')]){logger[_0x59bc('0x1e')](_0x59bc('0x2d'),_0x2287a1,_0x315862,_0x1c186c);return;}logger[_0x59bc('0x1e')](_0x59bc('0x2e'),_0x2287a1,_0x315862,_0x1c186c);var _0x249282=_0x57d276['channels'][_0x2287a1][_0x59bc('0x2f')]&&_0x57d276[_0x59bc('0x8')][_0x2287a1][_0x59bc('0x30')]?_0x57d276[_0x59bc('0x8')][_0x2287a1][_0x59bc('0x30')]:_0x2287a1;return RpcUser[_0x59bc('0x31')](_0x57d276[_0x59bc('0x2a')][_0x315862],_0x50e1e1,_0x249282)[_0x59bc('0x1d')](function(_0x516936){_0x57d276['voiceQueues'][_0x1c186c][_0x59bc('0x32')]-=0x1;_0x57d276[_0x59bc('0x6')][_0x1c186c][_0x59bc('0x33')]+=0x1;return _0x516936;});})[_0x59bc('0x1d')](function(_0x29b5f7){if(_0x274e72||!_0x29b5f7){return;}_0x57d276[_0x59bc('0x7')][_0x315862]={};logger['info'](_0x59bc('0x34'),_0x2287a1,_0x57d276['voiceQueues'][_0x1c186c][_0x59bc('0x35')],_0x315862,_0x1c186c);_0x57d276[_0x59bc('0x7')][_0x315862][_0x59bc('0x1a')]=setTimeout(_0x57d276[_0x59bc('0x36')]['bind'](_0x57d276,_0x315862),_0x57d276['voiceQueues'][_0x1c186c]['acwTimeout']*0x3e8);_0x57d276['timers'][_0x315862][_0x59bc('0x19')]=moment()[_0x59bc('0x37')]('YYYY-MM-DD\x20HH:mm:ss');_0x57d276[_0x59bc('0x7')][_0x315862][_0x59bc('0x1c')]=_0x2287a1;_0x57d276[_0x59bc('0x7')][_0x315862][_0x59bc('0x25')]=_0x1c186c;_0x57d276['timers'][_0x315862]['updateAcw']=_0x57d276[_0x59bc('0x38')][_0x59bc('0xb')](_0x57d276,_0x315862,_0x2287a1);});}})[_0x59bc('0x20')](function(){logger[_0x59bc('0x21')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2287a1,_0x57d276[_0x59bc('0x6')][_0x1c186c][_0x59bc('0x35')],_0x315862,_0x1c186c);})[_0x59bc('0x39')](function(){delete _0x57d276['channels'][_0x2287a1];});}catch(_0x48dbcb){logger['error'](_0x59bc('0x3a'),_0x48dbcb[_0x59bc('0x3b')]);}};Acw['prototype'][_0x59bc('0x36')]=function(_0x342457){try{var _0x286b73=this;if(_0x286b73[_0x59bc('0x7')][_0x342457]){_0x286b73['timers'][_0x342457][_0x59bc('0x1a')]=![];var _0x4d164e=_0x286b73['timers'][_0x342457]['uniqueid'];var _0x5cdd1c=_0x286b73[_0x59bc('0x7')][_0x342457][_0x59bc('0x25')];var _0x279b21=_0x286b73[_0x59bc('0x6')][_0x5cdd1c][_0x59bc('0x35')];logger['info'](_0x59bc('0x3c'),_0x4d164e,_0x342457);RpcUser[_0x59bc('0x2b')](this[_0x59bc('0x2a')][_0x342457]['id'])[_0x59bc('0x1d')](function(_0x45eab3){if(_0x45eab3[_0x59bc('0x3d')]===_0x59bc('0x3e')){return RpcUser[_0x59bc('0x3f')](_0x286b73[_0x59bc('0x2a')][_0x342457]);}});RpcVoiceAgentReport[_0x59bc('0x1b')]({'acwtime':_0x279b21,'agentacw':!![]},_0x4d164e,_0x342457)[_0x59bc('0x1d')](function(_0x1dff8f){logger[_0x59bc('0x1e')](_0x59bc('0x1f'),_0x4d164e,_0x279b21,_0x1dff8f);})[_0x59bc('0x20')](function(_0x71cc36){logger[_0x59bc('0x21')](_0x59bc('0x22'),_0x4d164e,_0x71cc36);});}else{logger[_0x59bc('0x21')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x342457);if(_0x286b73[_0x59bc('0x7')]){logger[_0x59bc('0x1e')](_0x59bc('0x40'),JSON[_0x59bc('0x41')](_0x286b73[_0x59bc('0x7')]));}}}catch(_0x4b0ed2){logger[_0x59bc('0x21')](_0x59bc('0x42'),_0x4b0ed2[_0x59bc('0x3b')]);}};Acw['prototype'][_0x59bc('0xa')]=function(_0x1ec448){try{if(this[_0x59bc('0x6')][_0x1ec448[_0x59bc('0x25')]]&&(this[_0x59bc('0x6')][_0x1ec448[_0x59bc('0x25')]]['acw']||this['voiceQueues'][_0x1ec448['queue']][_0x59bc('0x26')])){if(this[_0x59bc('0x2a')][_0x1ec448['interface']]){this[_0x59bc('0x8')][_0x1ec448[_0x59bc('0x1c')]]={'queue':_0x1ec448['queue'],'interface':_0x1ec448[_0x59bc('0x24')],'destlinkedid':_0x1ec448[_0x59bc('0x30')]};}}}catch(_0x567ec6){logger[_0x59bc('0x21')](_0x59bc('0x43'),_0x567ec6[_0x59bc('0x3b')]);}};Acw[_0x59bc('0x18')][_0x59bc('0x15')]=function(_0x39b5a1){try{if(this[_0x59bc('0x6')][_0x39b5a1['queue']]&&(this[_0x59bc('0x6')][_0x39b5a1[_0x59bc('0x25')]]['acw']||this['voiceQueues'][_0x39b5a1[_0x59bc('0x25')]]['mandatoryDisposition'])){if(this[_0x59bc('0x2a')][_0x39b5a1[_0x59bc('0x24')]]){this['channels'][_0x39b5a1[_0x59bc('0x1c')]]={'queue':_0x39b5a1[_0x59bc('0x25')],'interface':_0x39b5a1[_0x59bc('0x24')]};}}}catch(_0x47cf6c){logger[_0x59bc('0x21')](_0x59bc('0x44'),_0x47cf6c[_0x59bc('0x3b')]);}};Acw['prototype']['syncHangupRequest']=function(_0x579748){try{if(this[_0x59bc('0x8')][_0x579748[_0x59bc('0x1c')]]&&_['isUndefined'](this['channels'][_0x579748[_0x59bc('0x1c')]][_0x59bc('0x2f')])){logger[_0x59bc('0x1e')](_0x59bc('0x45'),_0x579748[_0x59bc('0x1c')]);this[_0x59bc('0x23')](_0x579748[_0x59bc('0x1c')]);}else if(this[_0x59bc('0x8')][_0x579748[_0x59bc('0x46')]]&&_[_0x59bc('0x47')](this[_0x59bc('0x8')][_0x579748['linkedid']]['attended'])){logger[_0x59bc('0x1e')]('[%s][HANGUP:LINKEDID]',_0x579748['linkedid']);this[_0x59bc('0x23')](_0x579748['linkedid']);}}catch(_0x559195){logger[_0x59bc('0x21')](_0x59bc('0x48'),_0x559195[_0x59bc('0x3b')]);}};Acw[_0x59bc('0x18')][_0x59bc('0xf')]=function(_0x12f46d){try{if(this[_0x59bc('0x8')][_0x12f46d[_0x59bc('0x1c')]]&&this[_0x59bc('0x8')][_0x12f46d[_0x59bc('0x1c')]]['attended']){logger['info'](_0x59bc('0x49'),_0x12f46d[_0x59bc('0x1c')]);this['startAcw'](_0x12f46d[_0x59bc('0x1c')]);}else if(this[_0x59bc('0x8')][_0x12f46d['linkedid']]&&this[_0x59bc('0x8')][_0x12f46d[_0x59bc('0x46')]][_0x59bc('0x2f')]){logger[_0x59bc('0x1e')](_0x59bc('0x4a'),_0x12f46d[_0x59bc('0x46')]);this[_0x59bc('0x23')](_0x12f46d[_0x59bc('0x46')]);}}catch(_0x46dca6){logger[_0x59bc('0x21')](_0x59bc('0x4b'),_0x46dca6[_0x59bc('0x3b')]);}};Acw[_0x59bc('0x18')][_0x59bc('0x4c')]=function(_0x5e0b75){try{if(!_['isNil'](this['channels'][_0x5e0b75[_0x59bc('0x4d')]])){this['startAcw'](_0x5e0b75[_0x59bc('0x4d')]);if(this['channels'][_0x5e0b75['secondtransfereruniqueid']]){this[_0x59bc('0x8')][_0x5e0b75[_0x59bc('0x4e')]][_0x59bc('0x2f')]=!![];this[_0x59bc('0x8')][_0x5e0b75[_0x59bc('0x4f')]]=this[_0x59bc('0x8')][_0x5e0b75['secondtransfereruniqueid']];this['deleteChannelAfterTimeout'](_0x5e0b75[_0x59bc('0x4e')]);}}else if(!_['isNil'](this[_0x59bc('0x8')][_0x5e0b75['transfertargetuniqueid']])){this['startAcw'](_0x5e0b75[_0x59bc('0x4f')]);if(this['channels'][_0x5e0b75[_0x59bc('0x50')]]){this[_0x59bc('0x8')][_0x5e0b75[_0x59bc('0x50')]][_0x59bc('0x2f')]=!![];this[_0x59bc('0x8')][_0x5e0b75[_0x59bc('0x4d')]]=this[_0x59bc('0x8')][_0x5e0b75[_0x59bc('0x50')]];this[_0x59bc('0x51')](_0x5e0b75[_0x59bc('0x50')]);}}}catch(_0x4c4e09){logger['error'](_0x59bc('0x52'),_0x4c4e09[_0x59bc('0x3b')]);}};Acw[_0x59bc('0x18')][_0x59bc('0x14')]=function(_0x17ec66){try{if(this[_0x59bc('0x8')][_0x17ec66[_0x59bc('0x53')]]){logger[_0x59bc('0x1e')](_0x59bc('0x54'),JSON[_0x59bc('0x41')](_0x17ec66[_0x59bc('0x53')]));this[_0x59bc('0x23')](_0x17ec66[_0x59bc('0x53')]);}else if(this['channels'][_0x17ec66[_0x59bc('0x55')]]){logger[_0x59bc('0x1e')](_0x59bc('0x56'),JSON['stringify'](_0x17ec66[_0x59bc('0x55')]));this[_0x59bc('0x23')](_0x17ec66[_0x59bc('0x55')]);}}catch(_0x4634d2){logger[_0x59bc('0x21')](_0x59bc('0x57'),_0x4634d2['message']);}};Acw['prototype'][_0x59bc('0x11')]=function(_0x2211a8){try{if(this['voiceQueues'][_0x2211a8['queue']]&&this[_0x59bc('0x6')][_0x2211a8[_0x59bc('0x25')]][_0x59bc('0x58')]===_0x59bc('0x59')){if(this[_0x59bc('0x2a')][_0x2211a8[_0x59bc('0x24')]]){logger[_0x59bc('0x1e')](_0x59bc('0x5a'),_0x2211a8[_0x59bc('0x1c')],_0x2211a8['interface'],_0x2211a8['queue']);return RpcUser[_0x59bc('0x31')](this['agents'][_0x2211a8['interface']],_0x59bc('0x5b'),_0x2211a8['uniqueid']);}}}catch(_0x3e0c51){logger[_0x59bc('0x21')](_0x59bc('0x5c'),_0x3e0c51['message']);}};Acw[_0x59bc('0x18')][_0x59bc('0x51')]=function(_0x5eb933,_0x12889f=0x2710){if(this[_0x59bc('0x8')][_0x5eb933]){setTimeout(()=>{delete this['channels'][_0x5eb933];},_0x12889f);}};module['exports']=Acw; \ No newline at end of file +var _0xee75=['uniqueid','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','timer','update','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','paused','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','[ACW][START]\x20%s','message'];(function(_0xc700b9,_0x5527b4){var _0x3c592d=function(_0x190e1b){while(--_0x190e1b){_0xc700b9['push'](_0xc700b9['shift']());}};_0x3c592d(++_0x5527b4);}(_0xee75,0x79));var _0x5ee7=function(_0x29f901,_0x10ea8b){_0x29f901=_0x29f901-0x0;var _0x2ccb28=_0xee75[_0x29f901];return _0x2ccb28;};'use strict';var _=require('lodash');var moment=require(_0x5ee7('0x0'));var ami=require(_0x5ee7('0x1'));var logger=require(_0x5ee7('0x2'))(_0x5ee7('0x3'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x5ee7('0x4'));function Acw(_0x10d92a){this[_0x5ee7('0x5')]=_0x10d92a['voiceQueues'];this[_0x5ee7('0x6')]=_0x10d92a[_0x5ee7('0x6')];this['timers']=_0x10d92a[_0x5ee7('0x7')];this['channels']={};ami['on']('agentconnect',this[_0x5ee7('0x8')][_0x5ee7('0x9')](this));ami['on'](_0x5ee7('0xa'),this[_0x5ee7('0xb')][_0x5ee7('0x9')](this));ami['on']('hangup',this[_0x5ee7('0xc')]['bind'](this));ami['on']('agentringnoanswer',this[_0x5ee7('0xd')][_0x5ee7('0x9')](this));ami['on']('attendedtransfer',this[_0x5ee7('0xe')][_0x5ee7('0x9')](this));ami['on'](_0x5ee7('0xf'),this['syncBlindTransfer'][_0x5ee7('0x9')](this));ami['on'](_0x5ee7('0x10'),this[_0x5ee7('0x11')][_0x5ee7('0x9')](this));}function getDiff(_0x54e12c){var _0x429e48=moment()['milliseconds'](0x0);var _0x1a961d=moment(_0x54e12c)[_0x5ee7('0x12')](0x0);return _0x429e48[_0x5ee7('0x13')](_0x1a961d,_0x5ee7('0x14'));}Acw[_0x5ee7('0x15')][_0x5ee7('0x16')]=function(_0x327fd5,_0x3b224c){var _0x525b95=this;var _0x617954=getDiff(_0x525b95[_0x5ee7('0x7')][_0x327fd5]['lastPauseAt']);clearTimeout(_0x525b95[_0x5ee7('0x7')][_0x327fd5][_0x5ee7('0x17')]);_0x525b95['timers'][_0x327fd5]['timer']=![];return RpcVoiceAgentReport[_0x5ee7('0x18')]({'acwtime':_0x617954},_0x525b95[_0x5ee7('0x7')][_0x327fd5]['uniqueid'],_0x327fd5)[_0x5ee7('0x19')](function(_0x482722){logger[_0x5ee7('0x1a')](_0x5ee7('0x1b'),_0x3b224c,_0x617954,_0x482722);})[_0x5ee7('0x1c')](function(_0x18ea0d){logger[_0x5ee7('0x1d')](_0x5ee7('0x1e'),_0x3b224c,_0x18ea0d);})[_0x5ee7('0x1f')](function(){delete _0x525b95[_0x5ee7('0x7')][_0x327fd5];});};Acw[_0x5ee7('0x15')]['startAcw']=function(_0x2c4a51){try{var _0x1308f8=this;var _0x38765f=this[_0x5ee7('0x20')][_0x2c4a51][_0x5ee7('0x21')];var _0x4d34bb=this[_0x5ee7('0x20')][_0x2c4a51][_0x5ee7('0x22')];var _0x29d9ab=this[_0x5ee7('0x5')][_0x4d34bb];var _0x11c4f9=![];var _0x3af971=_0x5ee7('0x23');if(_0x29d9ab[_0x5ee7('0x24')]&&_0x29d9ab[_0x5ee7('0x25')][_0x5ee7('0x26')]){_0x11c4f9=!![];_0x3af971=_0x29d9ab[_0x5ee7('0x25')][_0x5ee7('0x26')];}return ami[_0x5ee7('0x27')]({'action':_0x5ee7('0x28'),'interface':_0x38765f,'paused':!![],'reason':_0x3af971})[_0x5ee7('0x19')](function(){if(_0x1308f8[_0x5ee7('0x6')][_0x38765f]){return RpcUser[_0x5ee7('0x29')](_0x1308f8[_0x5ee7('0x6')][_0x38765f]['id'])['then'](function(_0x4a000c){if(!_0x4a000c||_0x4a000c[_0x5ee7('0x2a')]){logger[_0x5ee7('0x1a')](_0x5ee7('0x2b'),_0x2c4a51,_0x38765f,_0x4d34bb);return;}logger[_0x5ee7('0x1a')](_0x5ee7('0x2c'),_0x2c4a51,_0x38765f,_0x4d34bb);var _0xdb5105=_0x1308f8[_0x5ee7('0x20')][_0x2c4a51][_0x5ee7('0x2d')]&&_0x1308f8['channels'][_0x2c4a51][_0x5ee7('0x2e')]?_0x1308f8[_0x5ee7('0x20')][_0x2c4a51][_0x5ee7('0x2e')]:_0x2c4a51;return RpcUser[_0x5ee7('0x2f')](_0x1308f8[_0x5ee7('0x6')][_0x38765f],_0x3af971,_0xdb5105)['then'](function(_0x3a2929){_0x1308f8[_0x5ee7('0x5')][_0x4d34bb]['available']-=0x1;_0x1308f8['voiceQueues'][_0x4d34bb][_0x5ee7('0x30')]+=0x1;return _0x3a2929;});})[_0x5ee7('0x19')](function(_0x22d29e){if(_0x11c4f9||!_0x22d29e){return;}_0x1308f8['timers'][_0x38765f]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2c4a51,_0x1308f8['voiceQueues'][_0x4d34bb][_0x5ee7('0x31')],_0x38765f,_0x4d34bb);_0x1308f8[_0x5ee7('0x7')][_0x38765f][_0x5ee7('0x17')]=setTimeout(_0x1308f8[_0x5ee7('0x32')][_0x5ee7('0x9')](_0x1308f8,_0x38765f),_0x1308f8[_0x5ee7('0x5')][_0x4d34bb][_0x5ee7('0x31')]*0x3e8);_0x1308f8[_0x5ee7('0x7')][_0x38765f]['lastPauseAt']=moment()[_0x5ee7('0x33')](_0x5ee7('0x34'));_0x1308f8['timers'][_0x38765f]['uniqueid']=_0x2c4a51;_0x1308f8[_0x5ee7('0x7')][_0x38765f][_0x5ee7('0x22')]=_0x4d34bb;_0x1308f8['timers'][_0x38765f]['updateAcw']=_0x1308f8[_0x5ee7('0x16')][_0x5ee7('0x9')](_0x1308f8,_0x38765f,_0x2c4a51);});}})[_0x5ee7('0x1c')](function(){logger[_0x5ee7('0x1d')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2c4a51,_0x1308f8[_0x5ee7('0x5')][_0x4d34bb]['acwTimeout'],_0x38765f,_0x4d34bb);})['finally'](function(){delete _0x1308f8[_0x5ee7('0x20')][_0x2c4a51];});}catch(_0x4234de){logger[_0x5ee7('0x1d')](_0x5ee7('0x35'),_0x4234de[_0x5ee7('0x36')]);}};Acw[_0x5ee7('0x15')][_0x5ee7('0x32')]=function(_0x21cdc3){try{var _0x1b2e10=this;if(_0x1b2e10[_0x5ee7('0x7')][_0x21cdc3]){_0x1b2e10[_0x5ee7('0x7')][_0x21cdc3][_0x5ee7('0x17')]=![];var _0x4aad90=_0x1b2e10[_0x5ee7('0x7')][_0x21cdc3][_0x5ee7('0x37')];var _0xea40b3=_0x1b2e10[_0x5ee7('0x7')][_0x21cdc3][_0x5ee7('0x22')];var _0x5c0a4a=_0x1b2e10[_0x5ee7('0x5')][_0xea40b3][_0x5ee7('0x31')];logger['info'](_0x5ee7('0x38'),_0x4aad90,_0x21cdc3);RpcUser[_0x5ee7('0x29')](this[_0x5ee7('0x6')][_0x21cdc3]['id'])[_0x5ee7('0x19')](function(_0x41cb4d){if(_0x41cb4d[_0x5ee7('0x39')]===_0x5ee7('0x23')){return RpcUser[_0x5ee7('0x3a')](_0x1b2e10[_0x5ee7('0x6')][_0x21cdc3]);}});RpcVoiceAgentReport[_0x5ee7('0x18')]({'acwtime':_0x5c0a4a,'agentacw':!![]},_0x4aad90,_0x21cdc3)[_0x5ee7('0x19')](function(_0x4ccdcf){logger[_0x5ee7('0x1a')](_0x5ee7('0x1b'),_0x4aad90,_0x5c0a4a,_0x4ccdcf);})['catch'](function(_0x13e2f2){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x4aad90,_0x13e2f2);});}else{logger[_0x5ee7('0x1d')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x21cdc3);if(_0x1b2e10['timers']){logger[_0x5ee7('0x1a')]('[ACW][TIMERS]',JSON[_0x5ee7('0x3b')](_0x1b2e10[_0x5ee7('0x7')]));}}}catch(_0x1c5df3){logger['error'](_0x5ee7('0x3c'),_0x1c5df3['message']);}};Acw['prototype'][_0x5ee7('0x8')]=function(_0x1feb31){try{if(this[_0x5ee7('0x5')][_0x1feb31['queue']]&&(this[_0x5ee7('0x5')][_0x1feb31[_0x5ee7('0x22')]][_0x5ee7('0x3')]||this[_0x5ee7('0x5')][_0x1feb31['queue']][_0x5ee7('0x24')])){if(this['agents'][_0x1feb31[_0x5ee7('0x21')]]){this['channels'][_0x1feb31['uniqueid']]={'queue':_0x1feb31['queue'],'interface':_0x1feb31[_0x5ee7('0x21')],'destlinkedid':_0x1feb31[_0x5ee7('0x2e')]};}}}catch(_0x346ad2){logger['error'](_0x5ee7('0x3d'),_0x346ad2[_0x5ee7('0x36')]);}};Acw[_0x5ee7('0x15')]['syncAgentConnectPreview']=function(_0x2ff3e0){try{if(this['voiceQueues'][_0x2ff3e0['queue']]&&(this[_0x5ee7('0x5')][_0x2ff3e0[_0x5ee7('0x22')]]['acw']||this[_0x5ee7('0x5')][_0x2ff3e0[_0x5ee7('0x22')]][_0x5ee7('0x24')])){if(this['agents'][_0x2ff3e0[_0x5ee7('0x21')]]){this['channels'][_0x2ff3e0['uniqueid']]={'queue':_0x2ff3e0[_0x5ee7('0x22')],'interface':_0x2ff3e0['interface']};}}}catch(_0x1eaf27){logger[_0x5ee7('0x1d')](_0x5ee7('0x3e'),_0x1eaf27[_0x5ee7('0x36')]);}};Acw[_0x5ee7('0x15')][_0x5ee7('0xb')]=function(_0x185d0d){try{if(this[_0x5ee7('0x20')][_0x185d0d[_0x5ee7('0x37')]]&&_[_0x5ee7('0x3f')](this[_0x5ee7('0x20')][_0x185d0d['uniqueid']]['attended'])){logger[_0x5ee7('0x1a')](_0x5ee7('0x40'),_0x185d0d[_0x5ee7('0x37')]);this[_0x5ee7('0x41')](_0x185d0d[_0x5ee7('0x37')]);}else if(this[_0x5ee7('0x20')][_0x185d0d[_0x5ee7('0x42')]]&&_['isUndefined'](this['channels'][_0x185d0d[_0x5ee7('0x42')]]['attended'])){logger[_0x5ee7('0x1a')]('[%s][HANGUP:LINKEDID]',_0x185d0d[_0x5ee7('0x42')]);this[_0x5ee7('0x41')](_0x185d0d['linkedid']);}}catch(_0x457a1c){logger[_0x5ee7('0x1d')](_0x5ee7('0x43'),_0x457a1c['message']);}};Acw[_0x5ee7('0x15')][_0x5ee7('0xc')]=function(_0x50ade1){try{if(this['channels'][_0x50ade1[_0x5ee7('0x37')]]&&this[_0x5ee7('0x20')][_0x50ade1[_0x5ee7('0x37')]][_0x5ee7('0x2d')]){logger[_0x5ee7('0x1a')](_0x5ee7('0x44'),_0x50ade1['uniqueid']);this[_0x5ee7('0x41')](_0x50ade1['uniqueid']);}else if(this[_0x5ee7('0x20')][_0x50ade1[_0x5ee7('0x42')]]&&this['channels'][_0x50ade1['linkedid']][_0x5ee7('0x2d')]){logger[_0x5ee7('0x1a')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x50ade1[_0x5ee7('0x42')]);this['startAcw'](_0x50ade1['linkedid']);}}catch(_0x3e195b){logger[_0x5ee7('0x1d')](_0x5ee7('0x45'),_0x3e195b[_0x5ee7('0x36')]);}};Acw[_0x5ee7('0x15')]['syncAttendedTransfer']=function(_0x5070d3){try{if(!_[_0x5ee7('0x46')](this[_0x5ee7('0x20')][_0x5070d3[_0x5ee7('0x47')]])){this[_0x5ee7('0x41')](_0x5070d3[_0x5ee7('0x47')]);if(this[_0x5ee7('0x20')][_0x5070d3[_0x5ee7('0x48')]]){this['channels'][_0x5070d3[_0x5ee7('0x48')]][_0x5ee7('0x2d')]=!![];this[_0x5ee7('0x20')][_0x5070d3[_0x5ee7('0x49')]]=this[_0x5ee7('0x20')][_0x5070d3[_0x5ee7('0x48')]];this[_0x5ee7('0x4a')](_0x5070d3[_0x5ee7('0x48')]);}}else if(!_[_0x5ee7('0x46')](this[_0x5ee7('0x20')][_0x5070d3[_0x5ee7('0x49')]])){this[_0x5ee7('0x41')](_0x5070d3['transfertargetuniqueid']);if(this[_0x5ee7('0x20')][_0x5070d3[_0x5ee7('0x4b')]]){this['channels'][_0x5070d3['origtransfereruniqueid']][_0x5ee7('0x2d')]=!![];this[_0x5ee7('0x20')][_0x5070d3[_0x5ee7('0x47')]]=this[_0x5ee7('0x20')][_0x5070d3[_0x5ee7('0x4b')]];this[_0x5ee7('0x4a')](_0x5070d3[_0x5ee7('0x4b')]);}}}catch(_0x2d6834){logger[_0x5ee7('0x1d')]('[ACW][syncAttendedTransfer]\x20%s',_0x2d6834[_0x5ee7('0x36')]);}};Acw[_0x5ee7('0x15')][_0x5ee7('0x4c')]=function(_0x13da3b){try{if(this[_0x5ee7('0x20')][_0x13da3b[_0x5ee7('0x4d')]]){logger[_0x5ee7('0x1a')](_0x5ee7('0x4e'),JSON['stringify'](_0x13da3b[_0x5ee7('0x4d')]));this['startAcw'](_0x13da3b[_0x5ee7('0x4d')]);}else if(this[_0x5ee7('0x20')][_0x13da3b['transfererlinkedid']]){logger[_0x5ee7('0x1a')](_0x5ee7('0x4f'),JSON['stringify'](_0x13da3b[_0x5ee7('0x50')]));this[_0x5ee7('0x41')](_0x13da3b[_0x5ee7('0x50')]);}}catch(_0x317b38){logger[_0x5ee7('0x1d')](_0x5ee7('0x51'),_0x317b38[_0x5ee7('0x36')]);}};Acw[_0x5ee7('0x15')][_0x5ee7('0xd')]=function(_0x49f1f2){try{if(this[_0x5ee7('0x5')][_0x49f1f2[_0x5ee7('0x22')]]&&this[_0x5ee7('0x5')][_0x49f1f2['queue']][_0x5ee7('0x52')]===_0x5ee7('0x53')){if(this[_0x5ee7('0x6')][_0x49f1f2['interface']]){logger[_0x5ee7('0x1a')](_0x5ee7('0x54'),_0x49f1f2[_0x5ee7('0x37')],_0x49f1f2[_0x5ee7('0x21')],_0x49f1f2[_0x5ee7('0x22')]);return RpcUser['savePause'](this[_0x5ee7('0x6')][_0x49f1f2[_0x5ee7('0x21')]],_0x5ee7('0x55'),_0x49f1f2['uniqueid']);}}}catch(_0x110638){logger['error'](_0x5ee7('0x56'),_0x110638['message']);}};Acw[_0x5ee7('0x15')][_0x5ee7('0x4a')]=function(_0x1e9fd9,_0x719c45=0x2710){if(this['channels'][_0x1e9fd9]){setTimeout(()=>{delete this[_0x5ee7('0x20')][_0x1e9fd9];},_0x719c45);}};module[_0x5ee7('0x57')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 3a52d56..1ebb9bd 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 _0xd950=['queuesummary','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','username','once','connect','shutdown','info','resolve','then','catch','[ami.js][fullybooted]','asterisk-manager','bluebird','util','ami','../../config/environment','asterisk','password','promisify','action','format','port','inspect','error','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','Action','actionQueueSummary'];(function(_0x5dc242,_0x2cf183){var _0x232794=function(_0x4d6062){while(--_0x4d6062){_0x5dc242['push'](_0x5dc242['shift']());}};_0x232794(++_0x2cf183);}(_0xd950,0x161));var _0x0d95=function(_0x21b581,_0x4b048b){_0x21b581=_0x21b581-0x0;var _0xa7b3dd=_0xd950[_0x21b581];return _0xa7b3dd;};'use strict';var Manager=require(_0x0d95('0x0'));var BPromise=require(_0x0d95('0x1'));var util=require(_0x0d95('0x2'));var logger=require('../../config/logger')(_0x0d95('0x3'));var config=require(_0x0d95('0x4'));var ami=new Manager(config[_0x0d95('0x5')]['port'],config[_0x0d95('0x5')]['ip'],config[_0x0d95('0x5')]['username'],config['asterisk'][_0x0d95('0x6')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0x0d95('0x7')](ami[_0x0d95('0x8')]);function error(_0x4cb350){logger['error'](util[_0x0d95('0x9')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x0d95('0x5')]['username'],config[_0x0d95('0x5')]['ip'],config[_0x0d95('0x5')][_0x0d95('0xa')],util[_0x0d95('0xb')](_0x4cb350,![],null)));}function close(){logger[_0x0d95('0xc')](util[_0x0d95('0x9')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x0d95('0x5')]['username'],config[_0x0d95('0x5')]['ip'],config['asterisk']['port']));}ami[_0x0d95('0xd')]=function(){return function(){return ami['Action']({'action':_0x0d95('0xe')});};};ami[_0x0d95('0xf')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x0d95('0x10')]=function(){return function(){return ami[_0x0d95('0x11')]({'action':'sippeerstatus'});};};ami[_0x0d95('0x12')]=function(){return function(){return ami['Action']({'action':_0x0d95('0x13')});};};ami[_0x0d95('0x14')]=function(){return function(){return ami[_0x0d95('0x11')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util['format'](_0x0d95('0x15'),config[_0x0d95('0x5')][_0x0d95('0x16')],config[_0x0d95('0x5')]['ip'],config[_0x0d95('0x5')][_0x0d95('0xa')]));ami[_0x0d95('0x17')]('error',error);ami[_0x0d95('0x17')]('close',close);}ami['on'](_0x0d95('0x18'),connect);ami['on'](_0x0d95('0x19'),function(_0x1a0115){logger[_0x0d95('0x1a')](util[_0x0d95('0x9')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk']['username'],config[_0x0d95('0x5')]['ip'],config[_0x0d95('0x5')][_0x0d95('0xa')],util['inspect'](_0x1a0115,![],null)));});ami['on']('fullybooted',function(){logger['info'](util[_0x0d95('0x9')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0x0d95('0x16')],config[_0x0d95('0x5')]['ip'],config['asterisk'][_0x0d95('0xa')]));return Promise[_0x0d95('0x1b')]()[_0x0d95('0x1c')](ami[_0x0d95('0xd')]())[_0x0d95('0x1c')](ami[_0x0d95('0xf')]())[_0x0d95('0x1c')](ami[_0x0d95('0x10')]())['then'](ami[_0x0d95('0x12')]())[_0x0d95('0x1c')](ami['actionCoreShowChannels']())[_0x0d95('0x1d')](function(_0x30ad3c){logger[_0x0d95('0xc')](_0x0d95('0x1e'),util[_0x0d95('0xb')](_0x30ad3c,{'showHidden':![],'depth':null}));});});ami['once'](_0x0d95('0xc'),error);ami['once']('close',close);module['exports']=ami; \ No newline at end of file +var _0x8262=['keepConnected','Action','promisify','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','then','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','ami','../../config/environment','asterisk','username','password'];(function(_0x5f0f2c,_0x9817bf){var _0x104e69=function(_0x6915cc){while(--_0x6915cc){_0x5f0f2c['push'](_0x5f0f2c['shift']());}};_0x104e69(++_0x9817bf);}(_0x8262,0x184));var _0x2826=function(_0x45d8f8,_0x7e1134){_0x45d8f8=_0x45d8f8-0x0;var _0x3e7427=_0x8262[_0x45d8f8];return _0x3e7427;};'use strict';var Manager=require(_0x2826('0x0'));var BPromise=require(_0x2826('0x1'));var util=require(_0x2826('0x2'));var logger=require('../../config/logger')(_0x2826('0x3'));var config=require(_0x2826('0x4'));var ami=new Manager(config['asterisk']['port'],config[_0x2826('0x5')]['ip'],config[_0x2826('0x5')][_0x2826('0x6')],config[_0x2826('0x5')][_0x2826('0x7')],!![]);ami[_0x2826('0x8')]();ami[_0x2826('0x9')]=BPromise[_0x2826('0xa')](ami['action']);function error(_0x553eb4){logger[_0x2826('0xb')](util['format'](_0x2826('0xc'),config['asterisk'][_0x2826('0x6')],config[_0x2826('0x5')]['ip'],config[_0x2826('0x5')][_0x2826('0xd')],util[_0x2826('0xe')](_0x553eb4,![],null)));}function close(){logger['error'](util[_0x2826('0xf')](_0x2826('0x10'),config[_0x2826('0x5')][_0x2826('0x6')],config[_0x2826('0x5')]['ip'],config[_0x2826('0x5')][_0x2826('0xd')]));}ami[_0x2826('0x11')]=function(){return function(){return ami['Action']({'action':_0x2826('0x12')});};};ami[_0x2826('0x13')]=function(){return function(){return ami[_0x2826('0x9')]({'action':_0x2826('0x14')});};};ami[_0x2826('0x15')]=function(){return function(){return ami[_0x2826('0x9')]({'action':'sippeerstatus'});};};ami[_0x2826('0x16')]=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0x2826('0x17')]=function(){return function(){return ami[_0x2826('0x9')]({'action':_0x2826('0x18')});};};function connect(){logger[_0x2826('0x19')](util[_0x2826('0xf')](_0x2826('0x1a'),config[_0x2826('0x5')][_0x2826('0x6')],config[_0x2826('0x5')]['ip'],config[_0x2826('0x5')][_0x2826('0xd')]));ami[_0x2826('0x1b')](_0x2826('0xb'),error);ami[_0x2826('0x1b')](_0x2826('0x1c'),close);}ami['on'](_0x2826('0x1d'),connect);ami['on'](_0x2826('0x1e'),function(_0x59d143){logger[_0x2826('0x19')](util[_0x2826('0xf')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk']['username'],config['asterisk']['ip'],config[_0x2826('0x5')][_0x2826('0xd')],util[_0x2826('0xe')](_0x59d143,![],null)));});ami['on'](_0x2826('0x1f'),function(){logger[_0x2826('0x19')](util[_0x2826('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x2826('0x5')][_0x2826('0x6')],config['asterisk']['ip'],config['asterisk']['port']));return Promise['resolve']()['then'](ami['actionSipShowRegistry']())[_0x2826('0x20')](ami[_0x2826('0x13')]())[_0x2826('0x20')](ami[_0x2826('0x15')]())[_0x2826('0x20')](ami[_0x2826('0x16')]())[_0x2826('0x20')](ami[_0x2826('0x17')]())[_0x2826('0x21')](function(_0x25b355){logger[_0x2826('0xb')](_0x2826('0x22'),util[_0x2826('0xe')](_0x25b355,{'showHidden':![],'depth':null}));});});ami['once'](_0x2826('0xb'),error);ami['once'](_0x2826('0x1c'),close);module[_0x2826('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index bbb343f..6566616 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 _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x5c43ee,_0x2af012){var _0x4e5d19=function(_0x492990){while(--_0x492990){_0x5c43ee['push'](_0x5c43ee['shift']());}};_0x4e5d19(++_0x2af012);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var client=jayson[_0x3071('0x2')][_0x3071('0x3')]({'port':0x2329});client[_0x3071('0x4')]=function(_0x52b5fb,_0x2c547f){return new BPromise(function(_0x7b18a4,_0x33a70c){return client[_0x3071('0x5')](_0x52b5fb,_0x2c547f)[_0x3071('0x6')](function(_0x41cf76){logger[_0x3071('0x7')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x2c547f,_0x41cf76);if(_0x41cf76[_0x3071('0xa')]){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x41cf76['error'][_0x3071('0xb')],_0x2c547f);return _0x33a70c(_0x41cf76[_0x3071('0xa')][_0x3071('0xb')]);}else{return _0x7b18a4(_0x41cf76[_0x3071('0xc')]);}})[_0x3071('0xd')](function(_0x4a470a){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x4a470a,_0x2c547f);return _0x33a70c(_0x4a470a);});});};module[_0x3071('0xe')]=client; \ No newline at end of file +var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x70e0,0x17b));var _0x070e=function(_0x20eea8,_0x45641e){_0x20eea8=_0x20eea8-0x0;var _0x2e759d=_0x70e0[_0x20eea8];return _0x2e759d;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 836a9ef..5197e59 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 _0x4520=['OriginateError','[originate][error]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalTotalCalls','dropRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','loggedIn','predictiveIntervalHitRate','[getDataPredictive]','erlangCallToSecond','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','limitCalls','temp','getContactDialerIvr','checkContactEmpty','RUNNING','ivrTotalCallsDays','emptyContact','checkIsBlackListIvr','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','getContactDialer','countReScheduled','[countReScheduled]\x20','[actionOriginate]\x20','[actionOriginate]','tryOriginatePredictive','not_inuse','dialOrderByScheduledAt','checkContactLowerLimitOriginate','checkIsBlackList','[actionOriginatePredictive]','abandonmentRate','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','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','erlangb','exports','util','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','redis','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/hangup','env','XCALLY_IP_AGI','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','hangup','syncHangup','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','isUndefined','emit','type','outbound','inspect','format','voice:queue:%s','voice_queue:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','name','startProgressive\x20value\x20cleared','handlePredictive','debug','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contacts','state','statedesc','endtime','starttime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20deactivated','[ifTime][Action]','Error','prototype','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','isArray','length','push','Action','command','iftime\x20%s,%s','interval','timezones','then','content','indexOf','true','all','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','catch','resetActiveCalls','syncCampaigns','undefined','resolve','dialTimezone','launchHandleIvr','dialMethod','handlePower','power','dialPowerLevel','method\x20not\x20recognized','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','queue','uniqueId','uniqueid','ivr','decrementOriginate','[syncAgentConnect]','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agent','dialQueueProject2','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','agiafterat','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','countdropretry','dialDropMaxRetry','rescheduleContact','add','minutes','ContactId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','ListId','VoiceQueueId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','roundrobin','paused','stateinterface','locked','rrmemory','isNil','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','finally','[syncQueueStatusComplete]','_rr','unlockRR','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[unlock][syncQueueStatusComplete]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','variable','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','AMD','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','outboundAnswerAgiCallsDay','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','[syncVarSet]','custom:amd','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countcongestionretry','dialGlobalMaxRetry','dialMachineRetryFrequency','[syncHangup]','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','createHistory','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangup2]','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','ACTIVE','checkDialMethod','compareToOutboundQueue','queueSummaryCountersUpdated','[syncQueueSummary]','throttle','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[emptyContact]','UserId','[emptyContact][createHistory]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','originate','phone','contact\x20is\x20undefine','getCaller','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','setXMDContactVariables','Contact','assign','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','callerid','getCallerIdRandom','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','substring','dialCutDigit','trim','outboundOriginateFailureCallsDay','[originateError]:\x20%s'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4520,0x8e));var _0x0452=function(_0x19737b,_0x212909){_0x19737b=_0x19737b-0x0;var _0x16329e=_0x4520[_0x19737b];return _0x16329e;};'use strict';var util=require(_0x0452('0x0'));var _=require('lodash');var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require(_0x0452('0x1'));var utils=require(_0x0452('0x2'));var hopperUtils=require(_0x0452('0x3'));var ut=require(_0x0452('0x4'));var config=require(_0x0452('0x5'));var logger=require(_0x0452('0x6'))(_0x0452('0x7'));var loggerBooked=require('../../../config/logger')(_0x0452('0x8'));var loggerPredictive=require('../../../config/logger')(_0x0452('0x9'));var loggerPredictiveCalls=require(_0x0452('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x0452('0x6'))(_0x0452('0xa'));var ami=require('../ami');config[_0x0452('0xb')]=_['defaults'](config[_0x0452('0xb')],{'host':_0x0452('0xc'),'port':0x18eb});var io=require(_0x0452('0xd'))(new Redis(config[_0x0452('0xb')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x0452('0xe'));var RpcSetting=require(_0x0452('0xf'));var Interval=require(_0x0452('0x10'));var Action=require(_0x0452('0x11'));var History=require(_0x0452('0x12'));var Final=require(_0x0452('0x13'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x0452('0x14'));var ipAgi=process[_0x0452('0x15')][_0x0452('0x16')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x0452('0x17')]=function(_0x5f088a){this[_0x0452('0x18')]=this[_0x0452('0x18')]?this['tail']['finally'](_0x5f088a):_0x5f088a();};function Dialer(_0x4b6981,_0x20a009){this[_0x0452('0x19')]=new Sequence();this[_0x0452('0x1a')]=_0x20a009;this[_0x0452('0x1b')]=_0x4b6981[_0x0452('0x1b')];this[_0x0452('0x1c')]=_0x4b6981[_0x0452('0x1c')];this[_0x0452('0x1d')]=_0x4b6981[_0x0452('0x1d')];this[_0x0452('0x1e')]=_0x4b6981['trunks'];this[_0x0452('0x1f')]=config[_0x0452('0x1f')]||0x2;this[_0x0452('0x20')]={};this[_0x0452('0x21')]={};this[_0x0452('0x22')]={};this['uniqueId']={};this[_0x0452('0x23')]={};this[_0x0452('0x24')]={};this[_0x0452('0x25')]={};this[_0x0452('0x26')]={};this[_0x0452('0x27')]={};this[_0x0452('0x28')]={};this[_0x0452('0x29')]={};ami['on'](_0x0452('0x2a'),this[_0x0452('0x2b')][_0x0452('0x2c')](this));ami['on'](_0x0452('0x2d'),this[_0x0452('0x2e')][_0x0452('0x2c')](this));ami['on'](_0x0452('0x2f'),this[_0x0452('0x30')][_0x0452('0x2c')](this));ami['on'](_0x0452('0x31'),this[_0x0452('0x32')][_0x0452('0x2c')](this));ami['on'](_0x0452('0x33'),this[_0x0452('0xa')][_0x0452('0x2c')](this));ami['on'](_0x0452('0x34'),this['syncQueueSummaryComplete'][_0x0452('0x2c')](this));ami['on'](_0x0452('0x35'),this[_0x0452('0x36')][_0x0452('0x2c')](this));ami['on']('newexten',this['syncNewExten'][_0x0452('0x2c')](this));ami['on']('varset',this[_0x0452('0x37')][_0x0452('0x2c')](this));ami['on'](_0x0452('0x38'),this[_0x0452('0x39')][_0x0452('0x2c')](this));ami['on'](_0x0452('0x3a'),this[_0x0452('0x3b')][_0x0452('0x2c')](this));this[_0x0452('0x3c')]();this['loopClearZombieChannels']();RpcSetting[_0x0452('0x3d')]()['then'](function(_0x41f440){previewRecallmeReminderInterval=_0x41f440['previewRecallmeReminderInterval'];});}function isNotNull(_0x1ba7e2){return _0x1ba7e2!==null&&!_[_0x0452('0x3e')](_0x1ba7e2);}function msgResponse(_0x73823b,_0x476cba,_0x5226c1){return{'action':_0x73823b,'response':_0x476cba,'message':_0x5226c1,'stack':_0x5226c1};}function emit(_0x5b7891,_0x5ee4a8,_0xfa8c67){io['to'](_0x5b7891)[_0x0452('0x3f')](_0x5ee4a8,_0xfa8c67);}function emitOutboundVoiceQueueSummary(_0x197d0d){if(_0x197d0d[_0x0452('0x40')]===_0x0452('0x41')){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x0452('0x42')](_0x197d0d,{'showHidden':![],'depth':null}));emit(util[_0x0452('0x43')](_0x0452('0x44'),_0x197d0d['name']),_0x0452('0x45'),_0x197d0d);}}function checkGetDataPredictive(_0x5d1964){if(isNotNull(_0x5d1964)&&!_[_0x0452('0x46')](_0x5d1964)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x0452('0x47')](_0x0452('0x48'),_0x5d1964['predictiveIntervalTotalCalls']);loggerPredictive[_0x0452('0x47')](_0x0452('0x49'),_0x5d1964[_0x0452('0x4a')]);loggerPredictive[_0x0452('0x47')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d1964[_0x0452('0x4b')]);loggerPredictive[_0x0452('0x47')](_0x0452('0x4c'),_0x5d1964[_0x0452('0x4d')]);loggerPredictive[_0x0452('0x47')](_0x0452('0x4e'),_0x5d1964[_0x0452('0x4f')]);loggerPredictive['info'](_0x0452('0x50'),_0x5d1964[_0x0452('0x51')]);loggerPredictive[_0x0452('0x47')](_0x0452('0x52'));if(_0x5d1964['predictiveIntervalTotalCalls']>0x0){if(!_[_0x0452('0x3e')](_0x5d1964['predictiveIntervalAvgTalktime'])&&_0x5d1964['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x0452('0x47')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x0452('0x3e')](_0x5d1964[_0x0452('0x4f')])&&_0x5d1964[_0x0452('0x4f')]>0x0){return!![];}loggerPredictive['info'](_0x0452('0x53'));}else{loggerPredictive[_0x0452('0x47')](_0x0452('0x54'));}}else{loggerPredictive[_0x0452('0x47')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5185e0){return function(_0xa1e834){loggerPredictive['info'](_0x0452('0x55'));loggerPredictive[_0x0452('0x47')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xa1e834[_0x0452('0x56')]);loggerPredictive[_0x0452('0x47')](_0x0452('0x57'),_0xa1e834['erlangCallToSecond']);loggerPredictive[_0x0452('0x47')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xa1e834[_0x0452('0x58')]);loggerPredictive[_0x0452('0x47')](_0x0452('0x59'),_0xa1e834['erlangBusyFactor']);loggerPredictive[_0x0452('0x47')](_0x0452('0x5a'),_0xa1e834[_0x0452('0x58')]);loggerPredictive[_0x0452('0x47')](_0x0452('0x52'));_[_0x0452('0x5b')](_0x5185e0,_0xa1e834);};}function ifInterval(_0x561eea,_0x25213c){if(_[_0x0452('0x3e')](_0x25213c)){return![];}return utils[_0x0452('0x5c')](undefined,_0x25213c)<_0x561eea*0x3c;}function clearPredictiveAttributes(_0x58064e){if(_0x58064e[_0x0452('0x25')]){_0x58064e['startProgressive']=undefined;loggerPredictive['debug'](_0x58064e[_0x0452('0x5d')],_0x0452('0x5e'));}if(_0x58064e[_0x0452('0x24')]){_0x58064e[_0x0452('0x24')]=undefined;loggerPredictive['debug'](_0x58064e[_0x0452('0x5d')],'startPredictive\x20value\x20cleared');}if(_0x58064e['handlePredictive']){clearInterval(_0x58064e[_0x0452('0x5f')]);_0x58064e[_0x0452('0x5f')]=undefined;loggerPredictive[_0x0452('0x60')](_0x58064e[_0x0452('0x5d')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x3d7014,_0x31dc13){return function(_0x4dc560){loggerPredictive[_0x0452('0x61')](_0x31dc13[_0x0452('0x5d')],_0x3d7014);loggerPredictive[_0x0452('0x61')](_0x4dc560[_0x0452('0x62')]);clearPredictiveAttributes(_0x31dc13);};}function loggerCatch(_0x11fd01){return function(_0x40a9e1){logger['error'](_0x11fd01,util[_0x0452('0x42')](_0x40a9e1,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x41a152){return function(_0x5bcd5d){if(isNotNull(_0x5bcd5d)&&isNotNull(_0x5bcd5d[0x0])){if(_0x5bcd5d[0x0][_0x0452('0x63')]>0x0){_0x41a152[_0x0452('0x64')]=utils[_0x0452('0x65')][_0x0452('0x66')];logger[_0x0452('0x47')]('[getContactDialer2][ReScheduled]'+_0x41a152['name'],_0x5bcd5d[0x0][_0x0452('0x63')],_0x0452('0x67'));}else{_0x41a152[_0x0452('0x64')]=utils[_0x0452('0x65')]['NO_AVAILABLE_CONTACTS'];logger[_0x0452('0x47')]('[getContactDialer2][Empty]'+_0x41a152[_0x0452('0x5d')]);}}};}function createObjHistory(_0x16cb6a,_0x47320c,_0x43a746,_0x1bad17,_0x3e0410){_0x16cb6a['message']=_0x43a746;var _0x34de23=new Action(_0x16cb6a,_0x47320c);var _0x29e43c=new History(_0x34de23);_0x29e43c[_0x0452('0x68')]=_0x1bad17;_0x29e43c[_0x0452('0x69')]=_0x3e0410;_0x29e43c[_0x0452('0x6a')]=_0x34de23[_0x0452('0x6b')];return _0x29e43c;}function unlockQueueStatus(_0x3c0d30,_0x3a92d2){setTimeout(function(){if(_[_0x0452('0x3e')](_0x3c0d30['queueStatusComplete'])){loggerBooked[_0x0452('0x61')](_0x0452('0x6c'),_0x3a92d2);}_0x3c0d30[_0x0452('0x6d')]=!![];loggerBooked['info'](_0x0452('0x6e'),_0x3a92d2,JSON[_0x0452('0x6f')](_[_0x0452('0x70')](_0x3c0d30,['name','queueStatusComplete'])));},0x1f3);}function checkInterval(_0xbd947c){return function(){if(!isNotNull(_0xbd947c[_0x0452('0x71')])){_0xbd947c[_0x0452('0x64')]=utils[_0x0452('0x65')][_0x0452('0x72')];throw _0xbd947c[_0x0452('0x5d')]+_0x0452('0x73');}if(!isNotNull(_0xbd947c[_0x0452('0x71')][_0x0452('0x74')])){_0xbd947c[_0x0452('0x64')]=utils[_0x0452('0x65')][_0x0452('0x72')];throw _0xbd947c[_0x0452('0x5d')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x0452('0x46')](_0xbd947c[_0x0452('0x71')][_0x0452('0x74')]))){_0xbd947c[_0x0452('0x64')]=utils[_0x0452('0x65')][_0x0452('0x72')];throw _0xbd947c['name']+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x54e1ed){return function(){if(!utils[_0x0452('0x75')](_0x54e1ed)){_0x54e1ed[_0x0452('0x64')]=utils['CAMPAIGN_STATUS'][_0x0452('0x76')];throw _0x54e1ed[_0x0452('0x5d')]+_0x0452('0x77');}};}function emitCampaignSummary(_0x4e7038){if(utils[_0x0452('0x78')](_0x4e7038)){emit(util[_0x0452('0x43')](_0x0452('0x79'),_0x4e7038['name']),'campaign:save',_0x4e7038);}}function loggerCatchQueueSummary(_0x4f4120,_0x45784c){return function(_0xd7a84b){clearPredictiveAttributes(_0x45784c);emitCampaignSummary(_0x45784c);loggerSyncQueueSummary['debug'](_0x4f4120,util['inspect'](_0xd7a84b,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1e13e4){if(_0x1e13e4['sendMessageOneNotActive']){if(_0x1e13e4[_0x0452('0x7a')]===0x0){_0x1e13e4[_0x0452('0x7b')]=![];_0x1e13e4['message']=utils[_0x0452('0x65')][_0x0452('0x76')];loggerSyncQueueSummary[_0x0452('0x60')](_0x0452('0x7c'),_0x1e13e4[_0x0452('0x5d')],'is\x20not\x20active');}else{_0x1e13e4['message']=utils['CAMPAIGN_STATUS']['DISACTIVED'];loggerSyncQueueSummary[_0x0452('0x60')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1e13e4[_0x0452('0x5d')],_0x0452('0x7d'));}emitCampaignSummary(_0x1e13e4);}}function myreject(_0x25ac63){return function(_0x545bea){return _0x25ac63(msgResponse(_0x0452('0x7e'),_0x0452('0x7f'),JSON[_0x0452('0x6f')](_0x545bea)));};}Dialer[_0x0452('0x80')][_0x0452('0x81')]=function(_0x22b376){return!_[_0x0452('0x3e')](_0x22b376)&&_0x22b376&&!_[_0x0452('0x3e')](_0x22b376[_0x0452('0x5d')])&&!_[_0x0452('0x3e')](_0x22b376[_0x0452('0x82')])&&_0x22b376[_0x0452('0x82')]&&(this[_0x0452('0x1e')][util[_0x0452('0x43')](_0x0452('0x83'),_0x22b376[_0x0452('0x5d')])][_0x0452('0x84')]===_0x0452('0x85')||this['trunks'][util[_0x0452('0x43')]('SIP/%s',_0x22b376[_0x0452('0x5d')])][_0x0452('0x84')]===_0x0452('0x86'));};Dialer[_0x0452('0x80')][_0x0452('0x87')]=function(_0x1465a0){var _0x30dc6b=this;return function(){if(!_0x30dc6b[_0x0452('0x81')](_0x1465a0[_0x0452('0x88')])){if(!_0x30dc6b[_0x0452('0x81')](_0x1465a0[_0x0452('0x89')])){_0x1465a0[_0x0452('0x64')]=utils[_0x0452('0x65')][_0x0452('0x8a')];throw _0x1465a0[_0x0452('0x5d')]+_0x0452('0x8b');}}};};Dialer[_0x0452('0x80')][_0x0452('0x8c')]=function(_0x2a24d9,_0x3bd879,_0x5ea106,_0xaad547){var _0x2e15c4=this;return function(){var _0x1d3901=!![];return _0x2e15c4[_0x0452('0x8d')](_0x2a24d9,_0x3bd879,_0x5ea106,_0xaad547,_0x1d3901);};};Dialer[_0x0452('0x80')][_0x0452('0x8e')]=function(_0x53106d,_0x54c5de,_0x491fa4,_0x5631d8){var _0x36bee7=this;return function(){var _0x40f981=![];return _0x36bee7[_0x0452('0x8d')](_0x53106d[_0x0452('0x74')],_0x54c5de,_0x491fa4,_0x5631d8,_0x40f981);};};Dialer[_0x0452('0x80')]['ifTimeIvr']=function(_0x3c5cd9,_0x4777f6,_0x124f3b,_0x4a5ee3,_0x5e9931){var _0x1b7118=[];return new Promise(function(_0x20da2d,_0xafcbf9){if(!isNotNull(_0x3c5cd9)){_0x4a5ee3[_0x0452('0x64')]=utils['CAMPAIGN_STATUS'][_0x0452('0x72')];return _0xafcbf9(msgResponse(_0x0452('0x8f'),_0x0452('0x90'),_0x124f3b+_0x0452('0x91')));}if(_['isEmpty'](_0x3c5cd9)){_0x4a5ee3[_0x0452('0x64')]=utils[_0x0452('0x65')][_0x0452('0x92')];return _0xafcbf9(msgResponse(_0x0452('0x8f'),'Failure',_0x124f3b+_0x0452('0x93')));}if(_0x4777f6&&_[_0x0452('0x3e')](config['timezones'][_0x4777f6])){_0x4a5ee3[_0x0452('0x64')]=utils['CAMPAIGN_STATUS'][_0x0452('0x94')];return _0xafcbf9(msgResponse(_0x0452('0x8f'),_0x0452('0x90'),_0x124f3b+'\x20Timezone\x20unknow\x20'+_0x4777f6));}if(_[_0x0452('0x95')](_0x3c5cd9)){for(var _0x2408a1=0x0;_0x2408a1<_0x3c5cd9[_0x0452('0x96')];_0x2408a1+=0x1){_0x1b7118[_0x0452('0x97')](ami[_0x0452('0x98')]({'action':_0x0452('0x99'),'command':util[_0x0452('0x43')](_0x0452('0x9a'),_0x3c5cd9[_0x2408a1][_0x0452('0x9b')],!_[_0x0452('0x3e')](config[_0x0452('0x9c')][_0x4777f6])?_0x4777f6:'')})[_0x0452('0x9d')](function(_0x18a573){return _0x18a573[_0x0452('0x9e')][_0x0452('0x9f')](_0x0452('0xa0'))>=0x0;})['catch'](myreject(_0xafcbf9)));}}else{_0x1b7118[_0x0452('0x97')](ami['Action']({'action':_0x0452('0x99'),'command':util[_0x0452('0x43')](_0x0452('0x9a'),_0x3c5cd9,!_[_0x0452('0x3e')](config['timezones'][_0x4777f6])?_0x4777f6:'')})[_0x0452('0x9d')](function(_0x696c61){return _0x696c61[_0x0452('0x9e')][_0x0452('0x9f')](_0x0452('0xa0'))>=0x0;})['catch'](myreject(_0xafcbf9)));}Promise[_0x0452('0xa1')](_0x1b7118)[_0x0452('0x9d')](function(_0x5cace8){var _0x50fceb=_[_0x0452('0xa2')](_0x5cace8);if(_0x50fceb){return _0x20da2d(_0x50fceb);}else{_0x4a5ee3['message']=_0x5e9931?utils[_0x0452('0x65')][_0x0452('0xa3')]:utils[_0x0452('0x65')]['OVERTIME_INTERVAL'];return _0xafcbf9(msgResponse(_0x0452('0xa4'),_0x0452('0x90'),_0x0452('0xa5')+_0x5e9931+'\x20'+_0x124f3b+_0x0452('0xa6')+util[_0x0452('0x42')](_0x3c5cd9,{'showHidden':![],'depth':null})+_0x0452('0xa7')+_0x4777f6));}})[_0x0452('0xa8')](function(_0x16612f){return _0xafcbf9(msgResponse(_0x0452('0x8f'),_0x0452('0x90'),JSON[_0x0452('0x6f')](_0x16612f)));});});};Dialer[_0x0452('0x80')][_0x0452('0x3c')]=function(){var _0x18b884=this;return cmHopper[_0x0452('0xa9')]({'active':![]},{'where':{'active':!![]}})[_0x0452('0x9d')](function(){setInterval(function(){_0x18b884[_0x0452('0xaa')]();},0x3e8);});};Dialer['prototype'][_0x0452('0xaa')]=function(){var _0x329de8=this;var _0xe5d4fa;for(var _0x105926 in this[_0x0452('0x1c')]){if(typeof this[_0x0452('0x1c')][_0x105926]!==_0x0452('0xab')){_0xe5d4fa=this[_0x0452('0x1c')][_0x105926];if(utils[_0x0452('0x78')](_0xe5d4fa)&&utils['isIVRCampaignActive'](_0xe5d4fa)){_0xe5d4fa['sendMessageOneNotActive']=!![];Promise[_0x0452('0xac')]()[_0x0452('0x9d')](checkIsIVRCampaignActive(_0xe5d4fa))[_0x0452('0x9d')](checkInterval(_0xe5d4fa))[_0x0452('0x9d')](_0x329de8['checkIsTrunkReachable'](_0xe5d4fa))[_0x0452('0x9d')](_0x329de8[_0x0452('0x8c')](_0xe5d4fa['dialGlobalInterval'],_0xe5d4fa[_0x0452('0xad')],_0xe5d4fa[_0x0452('0x5d')],_0xe5d4fa))[_0x0452('0x9d')](_0x329de8[_0x0452('0x8e')](_0xe5d4fa['Interval'],_0xe5d4fa[_0x0452('0xad')],_0xe5d4fa[_0x0452('0x5d')],_0xe5d4fa))[_0x0452('0x9d')](_0x329de8[_0x0452('0xae')](_0xe5d4fa))[_0x0452('0xa8')](loggerCatchQueueSummary('[syncCampaigns]',_0xe5d4fa));}else{notSendMessagesCampaign(_0xe5d4fa);}}}};Dialer[_0x0452('0x80')]['checkDialMethod']=function(_0x4ba53a){if(_0x4ba53a[_0x0452('0xaf')]!==_0x0452('0x9')){clearPredictiveAttributes(_0x4ba53a);}switch(_0x4ba53a[_0x0452('0xaf')]){case'progressive':this[_0x0452('0xb0')](_0x4ba53a,0x1);break;case _0x0452('0xb1'):this[_0x0452('0xb0')](_0x4ba53a,_0x4ba53a[_0x0452('0xb2')]);break;case _0x0452('0x9'):this['predictive'](_0x4ba53a);break;case _0x0452('0x8'):this[_0x0452('0xb0')](_0x4ba53a,0x1);break;default:logger[_0x0452('0x61')]('Queue',_0x4ba53a[_0x0452('0x5d')],_0x0452('0xb3'));}};Dialer[_0x0452('0x80')][_0x0452('0x8f')]=function(_0x5dfd4c,_0x10cb55){var _0xb7a3be=_0x5dfd4c[_0x0452('0xad')];var _0x3f4758=_0x10cb55?_0x5dfd4c[_0x0452('0xb4')]:_0x5dfd4c['Interval']['Intervals'];logger['silly'](_0x0452('0xb5'),_0x3f4758,_0xb7a3be,_0x5dfd4c[_0x0452('0x5d')],util[_0x0452('0x43')](_0x0452('0xb6'),_0x5dfd4c[_0x0452('0x5d')],_0x5dfd4c['id']));var _0x488766=null;return Interval[_0x0452('0xb7')](_0x3f4758,_0xb7a3be)[_0x0452('0x9d')](function(_0x4f9462){if(_0x4f9462===!![]){return _0x4f9462;}else{_0x5dfd4c[_0x0452('0x64')]=_0x10cb55?utils[_0x0452('0x65')][_0x0452('0xa3')]:utils[_0x0452('0x65')][_0x0452('0xb8')];_0x488766=msgResponse(_0x0452('0xa4'),'Failure','Global:\x20'+_0x10cb55+'\x20'+_0x5dfd4c[_0x0452('0x5d')]+_0x0452('0xa6')+util[_0x0452('0x42')](_0x3f4758,{'showHidden':![],'depth':null})+_0x0452('0xa7')+_0xb7a3be);}if(_0x488766!==null){logger[_0x0452('0xb9')](_0x0452('0xba'),_0x488766);_0x488766['isGlobal']=_0x10cb55;throw _0x488766;}})['catch'](function(_0x4f6f57){logger['error'](_0x0452('0xbb'),_0x4f6f57);throw msgResponse(_0x0452('0x7e'),'Error',util[_0x0452('0x42')](_0x4f6f57,{'showHidden':![],'depth':null}));});};Dialer['prototype']['syncAgentConnect']=function(_0xe3296b){if(this[_0x0452('0x1b')][_0xe3296b[_0x0452('0xbc')]]){if(this[_0x0452('0xbd')][_0xe3296b[_0x0452('0xbe')]]&&this[_0x0452('0xbd')][_0xe3296b[_0x0452('0xbe')]][_0x0452('0x40')]!==_0x0452('0xbf')){utils[_0x0452('0xc0')](this[_0x0452('0x1b')][_0xe3296b['queue']],_0x0452('0xc1'));this[_0x0452('0xbd')][_0xe3296b[_0x0452('0xbe')]][_0x0452('0xc2')]=moment()[_0x0452('0x43')](_0x0452('0xc3'));}}};Dialer[_0x0452('0x80')][_0x0452('0x32')]=function(_0x43dc74){var _0x4c1f20=this['uniqueId'][_0x43dc74[_0x0452('0xbe')]];if(this[_0x0452('0x1b')][_0x43dc74['queue']]){if(_0x4c1f20&&_0x4c1f20[_0x0452('0x40')]!==_0x0452('0xbf')){delete this[_0x0452('0xbd')][_0x43dc74[_0x0452('0xbe')]];this['voiceQueues'][_0x43dc74['queue']][_0x0452('0xc4')]+=0x1;var _0x1a6beb=new AgentComplete(_0x4c1f20,_0x43dc74);if(_0x43dc74['reason']===_0x0452('0xc5')){_0x1a6beb['agiafterat']=this['voiceQueues'][_0x43dc74['queue']][_0x0452('0xc6')]&&this['voiceQueues'][_0x43dc74[_0x0452('0xbc')]]['dialAgiAfterHangupAgent']?moment()[_0x0452('0x43')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils['createHistory'](_0x1a6beb)[_0x0452('0xa8')](loggerCatch(_0x0452('0xc7')));hopperUtils[_0x0452('0xc8')](_0x1a6beb)[_0x0452('0xa8')](loggerCatch(_0x0452('0xc9')));}}};Dialer[_0x0452('0x80')][_0x0452('0x2e')]=function(_0x23ea8a){var _0x1ab8a3=this['uniqueId'][_0x23ea8a[_0x0452('0xbe')]];var _0x18d83d=this;var _0x53acf3=![];var _0x31b86a;var _0x165595;if(this[_0x0452('0x1b')][_0x23ea8a[_0x0452('0xbc')]]){if(_0x1ab8a3&&_0x1ab8a3[_0x0452('0x40')]!==_0x0452('0xbf')){delete this[_0x0452('0xbd')][_0x23ea8a[_0x0452('0xbe')]];utils[_0x0452('0xc0')](this[_0x0452('0x1b')][_0x23ea8a[_0x0452('0xbc')]],_0x0452('0xca'));_0x1ab8a3[_0x0452('0xcb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x3f4c91=new QueueCallerAbandon(_0x1ab8a3,_0x23ea8a);if(utils[_0x0452('0x5c')](_0x1ab8a3[_0x0452('0xcb')],_0x1ab8a3[_0x0452('0xcc')])>=_0x1ab8a3[_0x0452('0xcd')]){this[_0x0452('0x1b')][_0x23ea8a['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x0452('0x1b')][_0x23ea8a['queue']][_0x0452('0xce')]+=0x1;this[_0x0452('0x1b')][_0x23ea8a[_0x0452('0xbc')]][_0x0452('0xcf')]+=0x1;_0x3f4c91[_0x0452('0x68')]=0xa;_0x3f4c91[_0x0452('0x69')]=_0x0452('0xd0');_0x3f4c91['dropreason']=_0x0452('0xd1');_0x3f4c91[_0x0452('0xd2')]=this['voiceQueues'][_0x23ea8a['queue']][_0x0452('0xc6')]?moment()[_0x0452('0x43')](_0x0452('0xc3')):undefined;_0x3f4c91['countdropretry']+=0x1;_0x3f4c91[_0x0452('0xd3')]+=0x1;_0x31b86a=this['voiceQueues'][_0x23ea8a[_0x0452('0xbc')]][_0x0452('0xd4')];_0x165595=this[_0x0452('0x1b')][_0x23ea8a[_0x0452('0xbc')]][_0x0452('0xd5')];hopperUtils[_0x0452('0xd6')](_0x3f4c91,_0x3f4c91[_0x0452('0x68')],_0x1ab8a3['voiceQueue'])[_0x0452('0x9d')](function(_0x5c33c4){_0x53acf3=_0x5c33c4[_0x0452('0xd7')]==0x1;if(_0x3f4c91[_0x0452('0xd8')]>=_0x18d83d[_0x0452('0x1b')][_0x23ea8a[_0x0452('0xbc')]][_0x0452('0xd9')]){_0x18d83d['queueCallerAbandonCreateState'](_0x3f4c91,_0x5c33c4['additional']);}else{hopperUtils[_0x0452('0xda')]({'active':![],'countdropretry':_0x3f4c91[_0x0452('0xd8')],'scheduledat':moment()[_0x0452('0xdb')](_0x18d83d[_0x0452('0x1b')][_0x23ea8a[_0x0452('0xbc')]][_0x0452('0xd4')],_0x0452('0xdc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ab8a3[_0x0452('0xdd')],'ListId':_0x1ab8a3['ListId'],'VoiceQueueId':_0x1ab8a3['VoiceQueueId']||undefined,'CampaignId':_0x1ab8a3[_0x0452('0xde')]||undefined})[_0x0452('0xa8')](loggerCatch(_0x0452('0xdf')));var _0x4909c0=new History(_0x3f4c91);_0x4909c0[_0x0452('0x68')]=0xa;_0x4909c0[_0x0452('0x69')]=_0x0452('0xd0');_0x4909c0[_0x0452('0x6b')]=moment()[_0x0452('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x4909c0['endtime']=_0x4909c0['starttime'];_0x4909c0[_0x0452('0xe0')]=_0x3f4c91[_0x0452('0xe0')];_0x4909c0[_0x0452('0xe1')]=_0x3f4c91[_0x0452('0xe1')];hopperUtils['createHistory'](_0x4909c0)['catch'](loggerCatch(_0x0452('0xe2')));}})['then'](function(){if(_0x53acf3)hopperUtils[_0x0452('0xe3')](_0x3f4c91,_0x31b86a,_0x165595)['then'](function(){return 0x1;});});}else{this['voiceQueues'][_0x23ea8a[_0x0452('0xbc')]][_0x0452('0x4d')]+=0x1;this[_0x0452('0x1b')][_0x23ea8a[_0x0452('0xbc')]]['outboundDropCallsDayCallersExit']+=0x1;_0x3f4c91[_0x0452('0x68')]=0xb;_0x3f4c91['statedesc']=_0x0452('0xe4');_0x3f4c91[_0x0452('0xe5')]=_0x0452('0xe6');_0x3f4c91[_0x0452('0xe7')]+=0x1;_0x3f4c91['countglobal']+=0x1;_0x31b86a=this['voiceQueues'][_0x23ea8a[_0x0452('0xbc')]]['dialAbandonedRetryFrequency'];_0x165595=this[_0x0452('0x1b')][_0x23ea8a['queue']]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x3f4c91,_0x3f4c91[_0x0452('0x68')],_0x1ab8a3['voiceQueue'])['then'](function(_0x2f869c){if(_0x3f4c91[_0x0452('0xe7')]>=_0x18d83d[_0x0452('0x1b')][_0x23ea8a['queue']][_0x0452('0xe8')]){_0x18d83d['queueCallerAbandonCreateState'](_0x3f4c91,_0x2f869c['additional']);}else{hopperUtils[_0x0452('0xda')]({'active':![],'countabandonedretry':_0x3f4c91[_0x0452('0xe7')],'scheduledat':moment()[_0x0452('0xdb')](_0x18d83d[_0x0452('0x1b')][_0x23ea8a[_0x0452('0xbc')]][_0x0452('0xe9')],'minutes')[_0x0452('0x43')](_0x0452('0xc3')),'ContactId':_0x1ab8a3[_0x0452('0xdd')],'ListId':_0x1ab8a3[_0x0452('0xea')],'VoiceQueueId':_0x1ab8a3[_0x0452('0xeb')]||undefined,'CampaignId':_0x1ab8a3['CampaignId']||undefined})[_0x0452('0xa8')](loggerCatch(_0x0452('0xec')));var _0xa47709=new History(_0x3f4c91);_0xa47709[_0x0452('0x68')]=0xb;_0xa47709[_0x0452('0x69')]='Abandoned';_0xa47709[_0x0452('0x6b')]=moment()[_0x0452('0x43')](_0x0452('0xc3'));_0xa47709[_0x0452('0x6a')]=_0xa47709[_0x0452('0x6b')];_0xa47709['calleridname']=_0x3f4c91['calleridname'];_0xa47709[_0x0452('0xe1')]=_0x3f4c91[_0x0452('0xe1')];hopperUtils['createHistory'](_0xa47709)[_0x0452('0xa8')](loggerCatch(_0x0452('0xed')));}})[_0x0452('0x9d')](function(){if(_0x53acf3)hopperUtils['swapAdditionalPhones'](_0x3f4c91,_0x31b86a,_0x165595)['then'](function(){return 0x1;});});}}}};Dialer[_0x0452('0x80')]['syncNewExten']=function(_0x2b3b97){if(this['actions'][_0x2b3b97[_0x0452('0xbe')]]){this[_0x0452('0x21')][_0x2b3b97[_0x0452('0xbe')]]['channel']=_0x2b3b97[_0x0452('0xee')];}if(this[_0x0452('0xbd')][_0x2b3b97['uniqueid']]){this[_0x0452('0xbd')][_0x2b3b97[_0x0452('0xbe')]][_0x0452('0xee')]=_0x2b3b97['channel'];}};Dialer['prototype'][_0x0452('0x39')]=function(_0x34180c){if(!this[_0x0452('0x21')][_0x34180c['actionid']]){return;}var _0x2a130c=this['voiceQueues'][this[_0x0452('0x21')][_0x34180c[_0x0452('0xef')]][_0x0452('0xbc')]][_0x0452('0xf0')]||'rrmemory';if(_0x2a130c===_0x0452('0xf1')){if(this[_0x0452('0x21')][_0x34180c[_0x0452('0xef')]]&&_['isNil'](this[_0x0452('0x21')][_0x34180c[_0x0452('0xef')]]['locked'])&&_0x34180c[_0x0452('0x84')]==='1'&&_0x34180c[_0x0452('0xf2')]==='0'){if(this[_0x0452('0x1d')][_0x34180c[_0x0452('0xf3')]]){if(!this[_0x0452('0x1d')][_0x34180c['stateinterface']][_0x0452('0xf4')]){this[_0x0452('0x1d')][_0x34180c[_0x0452('0xf3')]][_0x0452('0xf4')]=!![];this['actions'][_0x34180c[_0x0452('0xef')]][_0x0452('0xf4')]=!![];this[_0x0452('0x21')][_0x34180c[_0x0452('0xef')]]['stateinterface']=_0x34180c['stateinterface'];}}}}else if(_0x2a130c===_0x0452('0xf5')){if(this['actions'][_0x34180c[_0x0452('0xef')]]){if(this['agents'][_0x34180c['stateinterface']]){this[_0x0452('0x21')][_0x34180c[_0x0452('0xef')]][_0x0452('0xf3')]=_0x34180c[_0x0452('0xf3')];if(_[_0x0452('0xf6')](this[_0x0452('0x27')][this[_0x0452('0x21')][_0x34180c[_0x0452('0xef')]][_0x0452('0xbc')]])){this['queueBooked'][this[_0x0452('0x21')][_0x34180c[_0x0452('0xef')]][_0x0452('0xbc')]]=[];}this[_0x0452('0x27')][this[_0x0452('0x21')][_0x34180c[_0x0452('0xef')]][_0x0452('0xbc')]]['push'](_['merge'](_[_0x0452('0x70')](this[_0x0452('0x21')][_0x34180c[_0x0452('0xef')]],[_0x0452('0xf7'),_0x0452('0xf3')]),{'status':_0x34180c[_0x0452('0x84')],'paused':_0x34180c[_0x0452('0xf2')]}));}}}};Dialer['prototype'][_0x0452('0x3b')]=function(_0x72a41c){if(!this['actions'][_0x72a41c[_0x0452('0xef')]]){return;}var _0x52f475=this;var _0x4cdafe=this[_0x0452('0x1b')][this[_0x0452('0x21')][_0x72a41c[_0x0452('0xef')]][_0x0452('0xbc')]];var _0x320a26=_0x4cdafe[_0x0452('0xf0')]||_0x0452('0xf5');if(_0x320a26===_0x0452('0xf1')){if(this[_0x0452('0x21')][_0x72a41c[_0x0452('0xef')]]&&this['actions'][_0x72a41c[_0x0452('0xef')]][_0x0452('0xf3')]){this[_0x0452('0x1a')][_0x0452('0xf8')](this[_0x0452('0x21')][_0x72a41c[_0x0452('0xef')]]['idHopper'],this[_0x0452('0x21')][_0x72a41c[_0x0452('0xef')]][_0x0452('0xf3')])[_0x0452('0xa8')](function(_0x5209df){logger['error'](_0x0452('0xf9'),util[_0x0452('0x42')](_0x5209df,{'showHidden':![],'depth':null}));})[_0x0452('0xfa')](function(){utils[_0x0452('0xc0')](_0x52f475[_0x0452('0x1b')][_0x52f475[_0x0452('0x21')][_0x72a41c[_0x0452('0xef')]]['queue']],_0x0452('0xfb'));_0x52f475[_0x0452('0x1d')][_0x52f475[_0x0452('0x21')][_0x72a41c[_0x0452('0xef')]][_0x0452('0xf3')]]['locked']=![];delete _0x52f475[_0x0452('0x21')][_0x72a41c[_0x0452('0xef')]];unlockQueueStatus(_0x4cdafe);});}else{utils['decrementOriginate'](this[_0x0452('0x1b')][this[_0x0452('0x21')][_0x72a41c['actionid']][_0x0452('0xbc')]],'[syncQueueStatusComplete]');hopperUtils[_0x0452('0xda')]({'active':![],'ContactId':this['actions'][_0x72a41c['actionid']]['ContactId'],'ListId':this['actions'][_0x72a41c['actionid']]['ListId'],'VoiceQueueId':this[_0x0452('0x21')][_0x72a41c[_0x0452('0xef')]][_0x0452('0xeb')]||undefined,'CampaignId':this['actions'][_0x72a41c[_0x0452('0xef')]][_0x0452('0xde')]||undefined})[_0x0452('0xa8')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x72a41c[_0x0452('0xef')]];unlockQueueStatus(_0x4cdafe);}}else if(_0x320a26===_0x0452('0xf5')){var _0x52a1ca;if(this[_0x0452('0x21')][_0x72a41c[_0x0452('0xef')]]&&!_[_0x0452('0x46')](this['queueBooked'][this[_0x0452('0x21')][_0x72a41c[_0x0452('0xef')]]['queue']])){if(this[_0x0452('0x28')][_0x52f475['actions'][_0x72a41c['actionid']][_0x0452('0xbc')]]){this[_0x0452('0x28')][_0x52f475[_0x0452('0x21')][_0x72a41c['actionid']]['queue']]=this['queueBookedRR'][this[_0x0452('0x21')][_0x72a41c[_0x0452('0xef')]][_0x0452('0xbc')]]?this[_0x0452('0x28')][this[_0x0452('0x21')][_0x72a41c['actionid']][_0x0452('0xbc')]]:this[_0x0452('0x27')][this['actions'][_0x72a41c[_0x0452('0xef')]][_0x0452('0xbc')]]?this[_0x0452('0x27')][this[_0x0452('0x21')][_0x72a41c['actionid']][_0x0452('0xbc')]][_0x0452('0xfc')]||0x0:0x0;}this[_0x0452('0x27')][this['actions'][_0x72a41c[_0x0452('0xef')]]['queue']][_0x0452('0xfc')]=this[_0x0452('0x28')][this['actions'][_0x72a41c['actionid']]['queue']];for(var _0x198f8a=0x0;_0x198f8a=_0x46ae75['dialGlobalMaxRetry']){_0x4cf423[_0x0452('0x11e')](_0xc45657,_0xcffbec,_0x1dec2b,_0x0452('0x11f'));}else{if(_0xc45657[_0x0452('0x118')]>=_0x46ae75['dialMachineMaxRetry']){_0x4cf423[_0x0452('0x120')](_0xc45657,_0xcffbec,_0x1dec2b,_0x0452('0x121'));}else{hopperUtils[_0x0452('0xda')]({'active':![],'countmachineretry':_0xc45657['countmachineretry'],'scheduledat':moment()['add'](_0x46ae75['dialMachineRetryFrequency'],_0x0452('0xdc'))[_0x0452('0x43')](_0x0452('0xc3')),'ContactId':_0xc45657[_0x0452('0xdd')],'ListId':_0xc45657[_0x0452('0xea')],'VoiceQueueId':_0xc45657[_0x0452('0xeb')]||undefined,'CampaignId':_0xc45657[_0x0452('0xde')]||undefined})[_0x0452('0xa8')](loggerCatch(_0x0452('0x122')));_0xcffbec({'reschedule':0x1});}}});}if(_0x5a9048[_0x0452('0x40')]===_0x0452('0xbf')&&this[_0x0452('0x1c')][_0x5a9048[_0x0452('0xbc')]][_0x0452('0x10b')]&&_0x518c07[_0x0452('0x10c')]===_0x0452('0x10d')){delete this[_0x0452('0xbd')][_0x518c07[_0x0452('0xbe')]];utils['decrementOriginate'](this['campaigns'][_0x5a9048['queue']],_0x0452('0x123'));_0x15e76f=new Hangup(_0x5a9048,_0x518c07);_0x15e76f['state']=0x12;_0x15e76f[_0x0452('0x69')]=_0x0452('0x10e');_0x15e76f[_0x0452('0x10f')]=_0x0452('0x110');ami[_0x0452('0x3f')](_0x0452('0x124'),ut[_0x0452('0x111')](_0x15e76f,_0x0452('0x112')));this[_0x0452('0x113')](_0x15e76f,_0x0452('0x125'),_0x0452('0x126'));}if(_0x5a9048[_0x0452('0x40')]==='ivr'&&this[_0x0452('0x1c')][_0x5a9048[_0x0452('0xbc')]]['dialAMDActive']&&_0x518c07[_0x0452('0x10c')]===_0x0452('0x116')){return new Promise(function(_0x4e38e5,_0x189c8e){delete _0x4cf423[_0x0452('0xbd')][_0x518c07[_0x0452('0xbe')]];utils[_0x0452('0xc0')](_0x4cf423[_0x0452('0x1c')][_0x5a9048[_0x0452('0xbc')]],_0x0452('0x123'));_0x4cf423[_0x0452('0x1c')][_0x5a9048[_0x0452('0xbc')]][_0x0452('0xc4')]+=0x1;_0x4cf423[_0x0452('0x1c')][_0x5a9048['queue']][_0x0452('0x117')]+=0x1;var _0x1eab2e=_0x4cf423[_0x0452('0x1c')][_0x5a9048[_0x0452('0xbc')]];var _0x167c41=new Hangup(_0x5a9048,_0x518c07);_0x167c41[_0x0452('0x68')]=0x13;_0x167c41[_0x0452('0x69')]=_0x0452('0x127');_0x167c41['membername']=_0x0452('0x110');_0x167c41['countmachineretry']+=0x1;_0x167c41['countglobal']+=0x1;_0x167c41['amd']=!![];ami[_0x0452('0x3f')](_0x0452('0x124'),ut[_0x0452('0x111')](_0x167c41,_0x0452('0x112')));hopperUtils['createHistory'](_0x167c41)[_0x0452('0xa8')](loggerCatch(_0x0452('0x119')));if(_0x167c41['countbusyretry']+_0x167c41[_0x0452('0x128')]+_0x167c41['countnoanswerretry']+_0x167c41[_0x0452('0x11c')]+_0x167c41[_0x0452('0xd8')]+_0x167c41['countabandonedretry']+_0x167c41[_0x0452('0x118')]+_0x167c41[_0x0452('0x11d')]>=_0x1eab2e[_0x0452('0x129')]){_0x4cf423['stateGlobal'](_0x167c41,_0x4e38e5,_0x189c8e,_0x0452('0x11f'));}else{if(_0x167c41['countmachineretry']>=_0x1eab2e['dialMachineMaxRetry']){_0x4cf423['createStateFinal'](_0x167c41,_0x4e38e5,_0x189c8e,_0x0452('0x121'));}else{hopperUtils[_0x0452('0xda')]({'active':![],'countmachineretry':_0x167c41[_0x0452('0x118')],'scheduledat':moment()[_0x0452('0xdb')](_0x1eab2e[_0x0452('0x12a')],_0x0452('0xdc'))[_0x0452('0x43')](_0x0452('0xc3')),'ContactId':_0x167c41[_0x0452('0xdd')],'ListId':_0x167c41[_0x0452('0xea')],'VoiceQueueId':_0x167c41[_0x0452('0xeb')]||undefined,'CampaignId':_0x167c41[_0x0452('0xde')]||undefined})[_0x0452('0xa8')](loggerCatch(_0x0452('0x122')));_0x4e38e5({'reschedule':0x1});}}});}}};Dialer[_0x0452('0x80')]['syncHangup']=function(_0x14d7e6){var _0x3b9650=this[_0x0452('0xbd')][_0x14d7e6[_0x0452('0xbe')]];var _0x31934e;if(!_0x3b9650){return;}if(_0x3b9650[_0x0452('0x40')]===_0x0452('0xbf')){delete this[_0x0452('0xbd')][_0x14d7e6[_0x0452('0xbe')]];utils['decrementOriginate'](this['campaigns'][_0x3b9650[_0x0452('0xbc')]],_0x0452('0x12b'));this[_0x0452('0x1c')][_0x3b9650[_0x0452('0xbc')]][_0x0452('0x12c')]+=0x1;if(_0x14d7e6[_0x0452('0x12d')]===_0x0452('0x12e')){const _0x58490d=new AgentComplete(_0x3b9650,_0x14d7e6);_0x58490d[_0x0452('0xde')]=this['campaigns'][_0x3b9650[_0x0452('0xbc')]]['id'];hopperUtils['createHistory'](_0x58490d)[_0x0452('0xa8')](loggerCatch(_0x0452('0x12f')));hopperUtils[_0x0452('0xc8')](_0x58490d)['catch'](loggerCatch(_0x0452('0x130')));}else{_0x31934e=new Hangup(_0x3b9650,_0x14d7e6);hopperUtils[_0x0452('0x131')](_0x31934e)['catch'](loggerCatch(_0x0452('0x132')));hopperUtils['moveContactManagedDialer'](_0x31934e)[_0x0452('0xa8')](loggerCatch(_0x0452('0x133')));}}else{if(isNotNull(this[_0x0452('0x1b')][_0x3b9650['queue']][_0x0452('0x134')])){delete this[_0x0452('0xbd')][_0x14d7e6['uniqueid']];utils[_0x0452('0xc0')](this['voiceQueues'][_0x3b9650['queue']],_0x0452('0x12b'));this[_0x0452('0x1b')][_0x3b9650[_0x0452('0xbc')]][_0x0452('0xc4')]+=0x1;this['voiceQueues'][_0x3b9650['queue']][_0x0452('0x117')]+=0x1;_0x31934e=new Hangup(_0x3b9650,_0x14d7e6);_0x31934e['state']=0x10;_0x31934e[_0x0452('0x69')]=_0x0452('0x135');_0x31934e[_0x0452('0x10f')]=_0x0452('0x136');hopperUtils['createHistory'](_0x31934e)['catch'](loggerCatch(_0x0452('0x132')));hopperUtils[_0x0452('0xc8')](_0x31934e)[_0x0452('0xa8')](loggerCatch(_0x0452('0x133')));}else{delete this['uniqueId'][_0x14d7e6[_0x0452('0xbe')]];utils[_0x0452('0xc0')](this['voiceQueues'][_0x3b9650[_0x0452('0xbc')]],_0x0452('0x137'));if(_0x14d7e6[_0x0452('0x12d')]===_0x0452('0x12e')){this[_0x0452('0x1b')][_0x3b9650['queue']]['outboundAnswerCallsDay']+=0x1;const _0x474125=new AgentComplete(_0x3b9650,_0x14d7e6);_0x474125[_0x0452('0xeb')]=this[_0x0452('0x1b')][_0x3b9650['queue']]['id'];hopperUtils[_0x0452('0x131')](_0x474125)[_0x0452('0xa8')](loggerCatch(_0x0452('0xc7')));hopperUtils[_0x0452('0xc8')](_0x474125)['catch'](loggerCatch(_0x0452('0xc9')));}else{this['voiceQueues'][_0x3b9650[_0x0452('0xbc')]][_0x0452('0x138')]+=0x1;_0x31934e=new Hangup(_0x3b9650,_0x14d7e6);_0x31934e[_0x0452('0x68')]=0xc;_0x31934e[_0x0452('0x69')]=_0x14d7e6[_0x0452('0x12d')];_0x31934e[_0x0452('0x10f')]=_0x0452('0x139');hopperUtils['createHistory'](_0x31934e)[_0x0452('0xa8')](loggerCatch(_0x0452('0x13a')));hopperUtils['moveContactManagedDialer'](_0x31934e)[_0x0452('0xa8')](loggerCatch(_0x0452('0x12b')));}}}};Dialer[_0x0452('0x80')][_0x0452('0xa')]=function(_0x2ce23e){var _0x19f67c=this;if(!_0x19f67c[_0x0452('0x29')][_0x2ce23e[_0x0452('0x5d')]]){_0x19f67c[_0x0452('0x29')][_0x2ce23e['name']]={'running':![]};}else if(_0x19f67c[_0x0452('0x29')][_0x2ce23e[_0x0452('0x5d')]][_0x0452('0x13b')]===!![]){return;}else if(_0x19f67c[_0x0452('0x29')][_0x2ce23e[_0x0452('0x5d')]][_0x0452('0x13b')]===![]){_0x19f67c[_0x0452('0x29')][_0x2ce23e[_0x0452('0x5d')]][_0x0452('0x13b')]=!![];}var _0x23a11d=_0x19f67c[_0x0452('0x1b')][_0x2ce23e[_0x0452('0x5d')]];var _0x5048d5=_0x23a11d[_0x0452('0x64')]!==utils[_0x0452('0x65')][_0x0452('0x76')];var _0x30b30b=utils[_0x0452('0x13c')](_0x23a11d);_0x23a11d[_0x0452('0x13d')]=utils[_0x0452('0x13e')](_0x23a11d,_0x19f67c[_0x0452('0x1e')]);Promise[_0x0452('0xac')]()[_0x0452('0x9d')](function(){if(_0x23a11d['statusMessage']===utils[_0x0452('0x65')]['INACTIVE']){if(_0x5048d5){clearPredictiveAttributes(_0x23a11d);_0x2ce23e[_0x0452('0x24')]=undefined;_0x2ce23e[_0x0452('0x25')]=undefined;}if(_0x23a11d[_0x0452('0x13d')]===utils[_0x0452('0x65')]['INACTIVE']){_0x2ce23e[_0x0452('0x13f')]=0x0;_0x2ce23e[_0x0452('0xf2')]=0x0;_0x2ce23e[_0x0452('0x140')]=0x0;_0x2ce23e[_0x0452('0x141')]=0x0;_0x2ce23e[_0x0452('0x142')]=0x0;}}else if(_0x23a11d[_0x0452('0x13d')]===utils['CAMPAIGN_STATUS'][_0x0452('0x143')]&&!_0x30b30b){return _0x19f67c[_0x0452('0x8f')](_0x23a11d,!![])[_0x0452('0x9d')](function(){return _0x19f67c['ifTime'](_0x23a11d,![]);})['then'](function(){return _0x19f67c[_0x0452('0x144')](_0x23a11d);})[_0x0452('0xa8')](function(_0x5294d9){loggerSyncQueueSummary[_0x0452('0x60')]('[syncQueueSummary]',util[_0x0452('0x42')](_0x5294d9,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x23a11d);});}else{clearPredictiveAttributes(_0x23a11d);}})[_0x0452('0x9d')](function(){var _0x57a42c=_0x2ce23e[_0x0452('0x145')](_0x23a11d);if(_0x57a42c||_0x23a11d[_0x0452('0x146')]){_0x23a11d['queueSummaryCountersUpdated']=![];_0x2ce23e['updateReportFromOutboundQueue'](_0x23a11d);Object['assign'](_0x23a11d,_0x2ce23e);emitOutboundVoiceQueueSummary(_0x2ce23e);}_0x19f67c[_0x0452('0x29')][_0x23a11d['name']][_0x0452('0x13b')]=![];})[_0x0452('0xa8')](function(_0x59a1bf){logger[_0x0452('0x61')](_0x0452('0x147'),util['inspect'](_0x59a1bf,{'showHidden':![],'depth':null}));_0x19f67c[_0x0452('0x29')][_0x23a11d[_0x0452('0x5d')]]['running']=![];});};Dialer[_0x0452('0x80')]['syncQueueSummaryComplete']=_[_0x0452('0x148')](function(){var _0x505fb5=_['filter'](this[_0x0452('0x1b')],function(_0x1298cd){return _0x1298cd[_0x0452('0x149')];});var _0x37c22b=_['filter'](this[_0x0452('0x1d')],function(_0x11e006){return _0x11e006[_0x0452('0x14a')]&&_0x11e006[_0x0452('0x84')]===_0x0452('0x85');});if(_0x505fb5[_0x0452('0x96')]>0x0&&_0x37c22b[_0x0452('0x96')]>0x0){return Promise[_0x0452('0xac')]()[_0x0452('0x9d')](cmHopper[_0x0452('0x14b')](_[_0x0452('0x14c')](_0x505fb5,'id'),previewRecallmeReminderInterval,_['map'](_0x37c22b,'id')))[_0x0452('0x9d')](function(_0x450f4b){for(var _0x30aeed=0x0;_0x30aeed<_0x450f4b['length'];_0x30aeed++){var _0x311814=_0x450f4b[_0x30aeed][_0x0452('0x14d')]['name'];if(_0x311814)io['to'](util[_0x0452('0x43')](_0x0452('0x14e'),_0x311814))[_0x0452('0x3f')](_0x0452('0x14f'),{'hopper':_0x450f4b[_0x30aeed]});}})[_0x0452('0xa8')](function(_0x57ffd){logger[_0x0452('0x61')](_0x0452('0x150'),_0x57ffd);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x0452('0x80')]['loopClearZombieChannels']=function(){var _0x48a4b4=this;setInterval(function(){_0x48a4b4[_0x0452('0x151')](_0x48a4b4[_0x0452('0xbd')],_0x0452('0x152'));_0x48a4b4[_0x0452('0x151')](_0x48a4b4['actions'],'[actions]');},0x32c8);};Dialer[_0x0452('0x80')][_0x0452('0x151')]=function(_0x23ecd0,_0x7564ee){var _0x19c5e9=this;for(var _0x1ce943 in _0x23ecd0){if(typeof _0x23ecd0[_0x1ce943]!==_0x0452('0xab')){this[_0x0452('0x19')][_0x0452('0x17')](function(){if(!_[_0x0452('0xf6')](_0x23ecd0[_0x1ce943])){return ami[_0x0452('0x98')]({'action':'status','channel':_0x23ecd0[_0x1ce943][_0x0452('0xee')]})[_0x0452('0xa8')](function(_0x121a9e){if(_0x121a9e[_0x0452('0x64')]===_0x0452('0x153')){setTimeout(function(){if(_0x23ecd0[_0x1ce943]&&_0x23ecd0[_0x1ce943][_0x0452('0x40')]!==_0x0452('0xbf')){utils['decrementOriginate'](_0x19c5e9[_0x0452('0x1b')][_0x23ecd0[_0x1ce943][_0x0452('0xbc')]],_0x0452('0x154'));logger['error'](_0x0452('0x155'),_0x7564ee,_0x1ce943,_0x23ecd0[_0x1ce943]['queue']);delete _0x23ecd0[_0x1ce943];}if(_0x23ecd0[_0x1ce943]&&_0x23ecd0[_0x1ce943][_0x0452('0x40')]===_0x0452('0xbf')){utils[_0x0452('0xc0')](_0x19c5e9[_0x0452('0x1c')][_0x23ecd0[_0x1ce943]['queue']],_0x0452('0x154'));logger['error'](_0x0452('0x156'),_0x7564ee,_0x1ce943,_0x23ecd0[_0x1ce943][_0x0452('0xbc')]);delete _0x23ecd0[_0x1ce943];}},0x2328);}});}});}}};Dialer[_0x0452('0x80')][_0x0452('0x157')]=function(_0x215761){return Promise['resolve']()[_0x0452('0x9d')](voiceQueueRt[_0x0452('0x157')](_0x215761))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x0452('0x80')]['emptyContact']=function(_0x3d9908,_0xb20f5f,_0x5a130b){var _0xb7110d={'state':0x19,'statedesc':'notFound'};utils[_0x0452('0xc0')](_0xb20f5f,_0x0452('0x158')+_0x3d9908);this[_0x0452('0x113')](_[_0x0452('0x5b')](_0xb7110d,_[_0x0452('0x70')](_0x5a130b,[_0x0452('0xdd'),_0x0452('0xea'),_0x0452('0x159'),_0x0452('0xeb'),_0x0452('0xde')])),_0x0452('0x15a'),_0x0452('0x158'));logger[_0x0452('0x61')](_0x3d9908);};Dialer[_0x0452('0x80')][_0x0452('0x113')]=function(_0x329693,_0x2f40ba,_0x5e927b){hopperUtils['createHistory'](_0x329693)['catch'](loggerCatch(_0x2f40ba));hopperUtils[_0x0452('0xc8')](_0x329693)[_0x0452('0xa8')](loggerCatch(_0x5e927b));};Dialer['prototype'][_0x0452('0x15b')]=function(_0x3b1b14,_0x5317bf){hopperUtils['createHistory'](_0x3b1b14)[_0x0452('0xa8')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x5317bf==0x0){hopperUtils[_0x0452('0xc8')](_0x3b1b14)['catch'](loggerCatch(_0x0452('0x15c')));}};Dialer[_0x0452('0x80')][_0x0452('0x150')]=function(_0x2cec00){return Promise[_0x0452('0xac')]()[_0x0452('0x9d')](cmHopper[_0x0452('0x14b')](_0x2cec00['id'],previewRecallmeReminderInterval))['then'](function(_0x55c252){for(var _0x7beeeb=0x0;_0x7beeeb<_0x55c252[_0x0452('0x96')];_0x7beeeb++){var _0xae44e6=_0x55c252[_0x7beeeb][_0x0452('0x14d')][_0x0452('0x5d')];if(_0xae44e6)io['to'](util[_0x0452('0x43')](_0x0452('0x14e'),_0xae44e6))[_0x0452('0x3f')](_0x0452('0x14f'),{'hopper':_0x55c252[_0x7beeeb]});}})['catch'](function(){});};Dialer[_0x0452('0x80')]['launchHandleIvr']=function(_0x1015e7){var _0x356835=this;return function(){_0x356835[_0x0452('0x15d')](_0x1015e7);};};Dialer[_0x0452('0x80')][_0x0452('0x15e')]=function(_0xc7de1a,_0x46dd26){var _0x20a6f1=this;var _0x508592=uuid['v4']();this[_0x0452('0x21')][_0x508592]=new Action(_0xc7de1a,_0x46dd26,_0x508592);return new Promise(function(_0x5504f5,_0x32fc63){if(_[_0x0452('0x3e')](_0xc7de1a)&&typeof _0xc7de1a!==_0x0452('0x15f')){return _0x32fc63(msgResponse(_0x0452('0x160'),_0x0452('0x90'),'voiceQueue\x20is\x20undefine'));}if(_[_0x0452('0x3e')](_0x46dd26['phone'])||_0x46dd26[_0x0452('0x161')]===null){return _0x32fc63(msgResponse(_0x0452('0x160'),_0x0452('0x90'),_0x0452('0x162')));}var _0x5de729={'XMD-CALLERID':_0x20a6f1[_0x0452('0x21')][_0x508592][_0x0452('0x163')](),'XMD-AGI':_0xc7de1a['dialQueueProject']?util[_0x0452('0x43')]('\x22agi://%s/square,%s\x22',ipAgi,_0xc7de1a[_0x0452('0x134')]):'NONE','XMD-AGIAFTER':_0xc7de1a[_0x0452('0xc6')]?util[_0x0452('0x43')]('\x22agi://%s/square,%s\x22',ipAgi,_0xc7de1a['dialQueueProject2']):_0x0452('0x164'),'XMD-QUEUE':utils[_0x0452('0x165')](_0xc7de1a)?util[_0x0452('0x43')](_0x0452('0x166'),_0xc7de1a[_0x0452('0x5d')],_0xc7de1a[_0x0452('0x167')]||'',_0xc7de1a['dialAgiAfterHangupAgent']?'c':'',_0xc7de1a[_0x0452('0xcd')]||0x3):_0x0452('0x164'),'XMD-CONTACTID':_0x46dd26[_0x0452('0xdd')],'XMD-CDRTYPE':_0x0452('0x7'),'CALLERID(all)':_0x20a6f1[_0x0452('0x21')][_0x508592]['getCaller'](),'XMD-AMD':_0xc7de1a[_0x0452('0x10b')]?_0x0452('0x143'):_0x0452('0x164'),'XMD-DESTINATION':_0x0452('0x10a')};if(_0xc7de1a[_0x0452('0x10b')]){_0x5de729[_0x0452('0x168')]=_0xc7de1a[_0x0452('0x169')]||0x9c4;_0x5de729[_0x0452('0x16a')]=_0xc7de1a[_0x0452('0x16b')]||0x5dc;_0x5de729[_0x0452('0x16c')]=_0xc7de1a[_0x0452('0x16d')]||0x320;_0x5de729['XMD-AMDTOTALANALYSISTIME']=_0xc7de1a[_0x0452('0x16e')]||0x1388;_0x5de729[_0x0452('0x16f')]=_0xc7de1a[_0x0452('0x170')]||0x64;_0x5de729[_0x0452('0x171')]=_0xc7de1a[_0x0452('0x172')]||0x32;_0x5de729[_0x0452('0x173')]=_0xc7de1a[_0x0452('0x174')]||0x3;_0x5de729[_0x0452('0x175')]=_0xc7de1a[_0x0452('0x176')]||0x100;_0x5de729[_0x0452('0x177')]=_0xc7de1a[_0x0452('0x178')]||0x1388;}if(utils['isOutboundQueue'](_0xc7de1a)){_0x5de729['XMD-VOICEQUEUEID']=_0x46dd26[_0x0452('0xeb')];}else{_0x5de729[_0x0452('0x179')]=_0x46dd26[_0x0452('0xde')];}var _0x4bd6a1=utils[_0x0452('0x17a')](_0x46dd26[_0x0452('0x17b')]);Object[_0x0452('0x17c')](_0x5de729,_0x4bd6a1);var _0x31f33c=_0x20a6f1['isTrunkReachable'](_0xc7de1a[_0x0452('0x88')])?utils[_0x0452('0x17d')](_0xc7de1a[_0x0452('0x88')]['callerid'],_0xc7de1a[_0x0452('0x17e')],_0xc7de1a[_0x0452('0x17f')]>0x0?utils['getCallerIdRandom'](_0xc7de1a[_0x0452('0x180')],_0xc7de1a[_0x0452('0x17f')]):_0xc7de1a[_0x0452('0x180')]):utils[_0x0452('0x17d')](_['isNil'](_0xc7de1a['TrunkBackup'])?_0xc7de1a[_0x0452('0x88')][_0x0452('0x181')]:_0xc7de1a[_0x0452('0x89')]['callerid'],_0xc7de1a[_0x0452('0x17e')],_0xc7de1a['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x0452('0x182')](_0xc7de1a[_0x0452('0x180')],_0xc7de1a['dialRandomLastDigitCallerIdNumber']):_0xc7de1a[_0x0452('0x180')]);if(_0x31f33c){_0x5de729['XMD-ORIGINATECALLERIDNAME']=_0x20a6f1[_0x0452('0x21')][_0x508592][_0x0452('0x183')]=utils[_0x0452('0x184')](_0x31f33c);_0x5de729[_0x0452('0x185')]=_0x46dd26[_0x0452('0x161')];}_0xc7de1a[_0x0452('0x186')]=_0x5de729;return ami[_0x0452('0x98')]({'actionid':_0x508592,'action':_0x0452('0x160'),'channel':_0x20a6f1[_0x0452('0x81')](_0xc7de1a[_0x0452('0x88')])?util[_0x0452('0x43')](_0x0452('0x187'),_0xc7de1a[_0x0452('0x88')]['name'],isNotNull(_0xc7de1a['dialPrefix'])?_0xc7de1a[_0x0452('0x188')]['trim']()||'':'',_0xc7de1a['dialCutDigit']>0x0?_0x46dd26[_0x0452('0x161')][_0x0452('0x189')](_0xc7de1a[_0x0452('0x18a')]):_0x46dd26[_0x0452('0x161')]):util[_0x0452('0x43')]('SIP/%s/%s%s',_['isNil'](_0xc7de1a[_0x0452('0x89')])?_0xc7de1a[_0x0452('0x88')][_0x0452('0x5d')]:_0xc7de1a[_0x0452('0x89')]['name'],isNotNull(_0xc7de1a[_0x0452('0x188')])?_0xc7de1a['dialPrefix'][_0x0452('0x18b')]()||'':'',_0xc7de1a[_0x0452('0x18a')]>0x0?_0x46dd26['phone']['substring'](_0xc7de1a['dialCutDigit']):_0x46dd26[_0x0452('0x161')]),'callerid':_0x31f33c,'Exten':_0x0452('0x10a'),'Context':'from-sip','Priority':'1','variable':_0x5de729,'timeout':(_0xc7de1a['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x508592})[_0x0452('0x9d')](function(_0x49632e){return _0x5504f5(_0x49632e);})[_0x0452('0xa8')](function(_0x438aa1){_0xc7de1a[_0x0452('0x18c')]+=0x1;var _0x5abb74=new History(_0x20a6f1[_0x0452('0x21')][_0x508592]);logger[_0x0452('0x61')](util[_0x0452('0x43')](_0x0452('0x18d'),JSON[_0x0452('0x6f')](_0x438aa1)));_0x5abb74[_0x0452('0x68')]=0xe;_0x5abb74['statedesc']=_0x0452('0x18e');_0x5abb74[_0x0452('0x6b')]=moment()[_0x0452('0x43')](_0x0452('0xc3'));_0x5abb74[_0x0452('0x6a')]=_0x5abb74['starttime'];hopperUtils[_0x0452('0x131')](_0x5abb74)[_0x0452('0xa8')](loggerCatch(_0x0452('0x18f')));_0x20a6f1[_0x0452('0xc8')](_0x5abb74)['catch'](loggerCatch(_0x0452('0x18f')))[_0x0452('0xfa')](function(){delete _0x20a6f1[_0x0452('0x21')][_0x508592];return _0x32fc63(msgResponse(_0x0452('0x160'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0x0452('0x80')]['checkRetriveMax']=function(_0x53a4da,_0x22f3a1,_0x14e268){var _0x55ae34=new History(_0x22f3a1);if(_0x55ae34['countbusyretry']+_0x55ae34[_0x0452('0x128')]+_0x55ae34[_0x0452('0x11b')]+_0x55ae34[_0x0452('0x11c')]+_0x55ae34[_0x0452('0xd8')]+_0x55ae34[_0x0452('0xe7')]+_0x55ae34[_0x0452('0x118')]+_0x55ae34[_0x0452('0x11d')]>=_0x14e268[_0x0452('0x129')]-0x1){return!![];}switch(_0x53a4da){case 0x3:if(_0x55ae34[_0x0452('0x11b')]>=_0x14e268[_0x0452('0x190')]-0x1){return!![];}hopperUtils[_0x0452('0xda')]({'active':![],'countnoanswerretry':_0x55ae34[_0x0452('0x11b')]+=0x1,'scheduledat':moment()[_0x0452('0xdb')](_0x14e268[_0x0452('0x191')],'minutes')[_0x0452('0x43')](_0x0452('0xc3')),'ContactId':_0x55ae34['ContactId'],'ListId':_0x55ae34[_0x0452('0xea')],'VoiceQueueId':_0x55ae34[_0x0452('0xeb')]||undefined,'CampaignId':_0x55ae34[_0x0452('0xde')]||undefined})[_0x0452('0xa8')](loggerCatch(_0x0452('0x192')));break;case 0x5:if(_0x55ae34[_0x0452('0x11a')]>=_0x14e268[_0x0452('0x193')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x55ae34[_0x0452('0x11a')]+=0x1,'scheduledat':moment()[_0x0452('0xdb')](_0x14e268[_0x0452('0x194')],_0x0452('0xdc'))[_0x0452('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x55ae34['ContactId'],'ListId':_0x55ae34[_0x0452('0xea')],'VoiceQueueId':_0x55ae34['VoiceQueueId']||undefined,'CampaignId':_0x55ae34['CampaignId']||undefined})[_0x0452('0xa8')](loggerCatch(_0x0452('0x195')));break;case 0x8:if(_0x55ae34[_0x0452('0x128')]>=_0x14e268['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x0452('0xda')]({'active':![],'countcongestionretry':_0x55ae34['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x14e268[_0x0452('0x196')],_0x0452('0xdc'))['format'](_0x0452('0xc3')),'ContactId':_0x55ae34['ContactId'],'ListId':_0x55ae34[_0x0452('0xea')],'VoiceQueueId':_0x55ae34[_0x0452('0xeb')]||undefined,'CampaignId':_0x55ae34[_0x0452('0xde')]||undefined})[_0x0452('0xa8')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x55ae34[_0x0452('0x11c')]>=_0x14e268[_0x0452('0x197')]-0x1){return!![];}else{hopperUtils[_0x0452('0xda')]({'active':![],'countnosuchnumberretry':_0x55ae34[_0x0452('0x11c')]+=0x1,'scheduledat':moment()[_0x0452('0xdb')](_0x14e268[_0x0452('0x198')],'minutes')[_0x0452('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x55ae34[_0x0452('0xdd')],'ListId':_0x55ae34[_0x0452('0xea')],'VoiceQueueId':_0x55ae34[_0x0452('0xeb')]||undefined,'CampaignId':_0x55ae34[_0x0452('0xde')]||undefined})[_0x0452('0xa8')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x55ae34[_0x0452('0xd8')]>=_0x14e268['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x0452('0xda')]({'active':![],'countdropretry':_0x55ae34['countdropretry']+=0x1,'scheduledat':moment()[_0x0452('0xdb')](_0x14e268[_0x0452('0xd4')],'minutes')[_0x0452('0x43')](_0x0452('0xc3')),'ContactId':_0x55ae34[_0x0452('0xdd')],'ListId':_0x55ae34[_0x0452('0xea')],'VoiceQueueId':_0x55ae34[_0x0452('0xeb')]||undefined,'CampaignId':_0x55ae34[_0x0452('0xde')]||undefined})[_0x0452('0xa8')](loggerCatch(_0x0452('0xdf')));break;case 0xb:if(_0x55ae34[_0x0452('0xe7')]>=_0x14e268[_0x0452('0xe8')]-0x1){return!![];}hopperUtils[_0x0452('0xda')]({'active':![],'countabandonedretry':_0x55ae34['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x14e268[_0x0452('0xe9')],_0x0452('0xdc'))[_0x0452('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x55ae34[_0x0452('0xdd')],'ListId':_0x55ae34[_0x0452('0xea')],'VoiceQueueId':_0x55ae34['VoiceQueueId']||undefined,'CampaignId':_0x55ae34[_0x0452('0xde')]||undefined})[_0x0452('0xa8')](loggerCatch(_0x0452('0xec')));break;case 0x13:if(_0x55ae34[_0x0452('0x118')]>=_0x14e268['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x0452('0xda')]({'active':![],'countmachineretry':_0x55ae34[_0x0452('0x118')]+=0x1,'scheduledat':moment()[_0x0452('0xdb')](_0x14e268['dialMachineRetryFrequency'],_0x0452('0xdc'))[_0x0452('0x43')](_0x0452('0xc3')),'ContactId':_0x55ae34['ContactId'],'ListId':_0x55ae34[_0x0452('0xea')],'VoiceQueueId':_0x55ae34['VoiceQueueId']||undefined,'CampaignId':_0x55ae34[_0x0452('0xde')]||undefined})[_0x0452('0xa8')](loggerCatch(_0x0452('0x122')));break;case 0x14:if(_0x55ae34[_0x0452('0x11d')]>=_0x14e268[_0x0452('0x199')]-0x1){return!![];}hopperUtils[_0x0452('0xda')]({'active':![],'countagentrejectretry':_0x55ae34['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x0452('0xdb')](_0x14e268[_0x0452('0x19a')],_0x0452('0xdc'))[_0x0452('0x43')](_0x0452('0xc3')),'ContactId':_0x55ae34['ContactId'],'ListId':_0x55ae34[_0x0452('0xea')],'VoiceQueueId':_0x55ae34[_0x0452('0xeb')]||undefined,'CampaignId':_0x55ae34[_0x0452('0xde')]||undefined})[_0x0452('0xa8')](loggerCatch(_0x0452('0x19b')));break;default:return!![];}};Dialer[_0x0452('0x80')][_0x0452('0x108')]=function(_0x4391de,_0xa3f3ef,_0x272557){var _0x460629=this;var _0x56b10f=new History(_0x4391de);var _0x1703ce=![];var _0x442dac;var _0x554df8;return new Promise(function(_0x1461da,_0x28171e){if(_[_0x0452('0x3e')](_0xa3f3ef)&&typeof _0xa3f3ef!=='object'){return _0x28171e(msgResponse(_0x0452('0x19c'),_0x0452('0x90'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x272557)&&typeof _0x272557!==_0x0452('0x15f')){return _0x28171e(msgResponse(_0x0452('0x19c'),_0x0452('0x90'),_0x0452('0x19d')));}hopperUtils[_0x0452('0xd6')](_0x56b10f,_0x272557[_0x0452('0x19e')],_0xa3f3ef)[_0x0452('0x9d')](function(_0x11bd21){if(_0x11bd21['additional']==0x1)_0x1703ce=!![];switch(_0x272557[_0x0452('0x19e')]){case'0':_0xa3f3ef[_0x0452('0x19f')]+=0x1;_0x56b10f[_0x0452('0x68')]=0x0;_0x56b10f[_0x0452('0x69')]=_0x0452('0x1a0');_0x56b10f[_0x0452('0x11c')]+=0x1;_0x56b10f[_0x0452('0xd3')]+=0x1;ami[_0x0452('0x3f')]('custom:agentnosuchnumber',ut['buildObj'](_0x4391de,_0x0452('0x1a1')));_0x442dac=_0xa3f3ef[_0x0452('0x198')];_0x554df8=_0xa3f3ef['callAdditionalPhoneAfterMin'];hopperUtils[_0x0452('0x131')](_0x56b10f)['catch'](loggerCatch(_0x0452('0x119')));if(_0x460629[_0x0452('0x1a2')](0x0,_0x4391de,_0xa3f3ef)&&!_0x1703ce){if(_0x56b10f[_0x0452('0x11c')]>=_0xa3f3ef[_0x0452('0x197')]){_0x460629['createStateFinal'](_0x56b10f,_0x1461da,_0x28171e,_0x0452('0x1a3'));}else{_0x460629['stateGlobal'](_0x56b10f,_0x1461da,_0x28171e,_0x0452('0x1a3'));}}break;case'3':_0xa3f3ef[_0x0452('0x1a4')]+=0x1;_0x56b10f[_0x0452('0x68')]=0x3;_0x56b10f[_0x0452('0x69')]=_0x0452('0x1a5');_0x56b10f[_0x0452('0x11b')]+=0x1;_0x56b10f['countglobal']+=0x1;var _0x5ee319=ut[_0x0452('0x1a6')](_0x4391de,_0xa3f3ef);ami['emit'](_0x0452('0x1a7'),_0x5ee319);_0x442dac=_0xa3f3ef[_0x0452('0x191')];_0x554df8=_0xa3f3ef[_0x0452('0xd5')];hopperUtils[_0x0452('0x131')](_0x56b10f)[_0x0452('0xa8')](loggerCatch(_0x0452('0x1a8')));if(_0x460629[_0x0452('0x1a2')](0x3,_0x4391de,_0xa3f3ef)&&!_0x1703ce){if(_0x56b10f['countnoanswerretry']>=_0xa3f3ef[_0x0452('0x190')]){_0x460629[_0x0452('0x120')](_0x56b10f,_0x1461da,_0x28171e,_0x0452('0x1a9'));}else{_0x460629['stateGlobal'](_0x56b10f,_0x1461da,_0x28171e,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0xa3f3ef[_0x0452('0x1aa')]+=0x1;_0x56b10f[_0x0452('0x68')]=0x5;_0x56b10f[_0x0452('0x69')]='Busy';_0x56b10f['countbusyretry']+=0x1;_0x56b10f[_0x0452('0xd3')]+=0x1;ami[_0x0452('0x3f')]('custom:agentbusy',ut[_0x0452('0x111')](_0x4391de,_0x0452('0x1ab')));_0x442dac=_0xa3f3ef[_0x0452('0x194')];_0x554df8=_0xa3f3ef[_0x0452('0xd5')];hopperUtils[_0x0452('0x131')](_0x56b10f)[_0x0452('0xa8')](loggerCatch(_0x0452('0x1ac')));if(_0x460629[_0x0452('0x1a2')](0x5,_0x4391de,_0xa3f3ef)&&!_0x1703ce){if(_0x56b10f[_0x0452('0x11a')]>=_0xa3f3ef[_0x0452('0x193')]){_0x460629[_0x0452('0x120')](_0x56b10f,_0x1461da,_0x28171e,'reason\x205\x20busy');}else{_0x460629[_0x0452('0x11e')](_0x56b10f,_0x1461da,_0x28171e,_0x0452('0x1ad'));}}break;case'8':_0xa3f3ef[_0x0452('0x1ae')]+=0x1;_0x56b10f[_0x0452('0x68')]=0x8;_0x56b10f[_0x0452('0x69')]='Congestion';_0x56b10f[_0x0452('0x128')]+=0x1;_0x56b10f[_0x0452('0xd3')]+=0x1;_0x442dac=_0xa3f3ef[_0x0452('0x196')];_0x554df8=_0xa3f3ef[_0x0452('0xd5')];ami[_0x0452('0x3f')]('custom:agentcongestion',ut[_0x0452('0x111')](_0x4391de,_0x0452('0x1af')));hopperUtils['createHistory'](_0x56b10f)[_0x0452('0xa8')](loggerCatch(_0x0452('0x1b0')));if(_0x460629[_0x0452('0x1a2')](0x8,_0x4391de,_0xa3f3ef)&&!_0x1703ce){if(_0x56b10f[_0x0452('0x128')]>=_0xa3f3ef[_0x0452('0x1b1')]){_0x460629[_0x0452('0x120')](_0x56b10f,_0x1461da,_0x28171e,_0x0452('0x1b2'));}else{_0x460629[_0x0452('0x11e')](_0x56b10f,_0x1461da,_0x28171e,_0x0452('0x1b2'));}}break;case'11':_0xa3f3ef['outboundAbandonedCallsDay']+=0x1;_0x56b10f[_0x0452('0x68')]=0xb;_0x56b10f[_0x0452('0x69')]=_0x0452('0xe4');_0x56b10f['countabandonedretry']+=0x1;_0x56b10f[_0x0452('0xd3')]+=0x1;_0x442dac=_0xa3f3ef['dialAbandonedRetryFrequency'];_0x554df8=_0xa3f3ef[_0x0452('0xd5')];hopperUtils[_0x0452('0x131')](_0x56b10f)[_0x0452('0xa8')](loggerCatch(_0x0452('0xed')));if(_0x460629[_0x0452('0x1a2')](0xb,_0x4391de,_0xa3f3ef)&&!_0x1703ce){if(_0x56b10f['countabandonedretry']>=_0xa3f3ef[_0x0452('0xe8')]){_0x460629[_0x0452('0x120')](_0x56b10f,_0x1461da,_0x28171e,_0x0452('0x1b3'));}else{_0x460629['stateGlobal'](_0x56b10f,_0x1461da,_0x28171e,_0x0452('0x1b3'));}}break;case'20':_0xa3f3ef['outboundRejectCallsDay']+=0x1;_0x56b10f[_0x0452('0x68')]=0x14;_0x56b10f[_0x0452('0x69')]='AgentReject';_0x56b10f[_0x0452('0x11d')]+=0x1;_0x56b10f[_0x0452('0xd3')]+=0x1;_0x442dac=_0xa3f3ef[_0x0452('0x19a')];_0x554df8=_0xa3f3ef[_0x0452('0xd5')];ami['emit'](_0x0452('0x1b4'),ut[_0x0452('0x111')](_0x4391de,_0x0452('0x1b5')));hopperUtils[_0x0452('0x131')](_0x56b10f)[_0x0452('0xa8')](loggerCatch(_0x0452('0x1b6')));if(_0x460629[_0x0452('0x1a2')](0x14,_0x4391de,_0xa3f3ef)&&!_0x1703ce){if(_0x56b10f['countagentrejectretry']>=_0xa3f3ef[_0x0452('0x199')]){_0x460629['createStateFinal'](_0x56b10f,_0x1461da,_0x28171e,_0x0452('0x1b7'));}else{_0x460629[_0x0452('0x11e')](_0x56b10f,_0x1461da,_0x28171e,_0x0452('0x1b7'));}}break;default:_0xa3f3ef[_0x0452('0x138')]+=0x1;_0x56b10f[_0x0452('0x68')]=0xc;_0x56b10f[_0x0452('0x69')]=_0x272557['reason'];_0x442dac=_0xa3f3ef[_0x0452('0x19a')];_0x554df8=_0xa3f3ef[_0x0452('0xd5')];hopperUtils['createHistory'](_0x56b10f)[_0x0452('0xa8')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x460629[_0x0452('0x1a2')](_0x272557[_0x0452('0x19e')],_0x4391de,_0xa3f3ef)&&!_0x1703ce){if(_0x56b10f[_0x0452('0x11a')]+_0x56b10f[_0x0452('0x128')]+_0x56b10f[_0x0452('0x11b')]+_0x56b10f[_0x0452('0x11c')]+_0x56b10f['countdropretry']+_0x56b10f[_0x0452('0xe7')]+_0x56b10f[_0x0452('0x118')]+_0x56b10f[_0x0452('0x11d')]>=_0xa3f3ef[_0x0452('0x129')]){_0x460629[_0x0452('0x11e')](_0x56b10f,_0x1461da,_0x28171e,_0x272557[_0x0452('0x19e')]);}else{_0x460629[_0x0452('0x120')](_0x56b10f,_0x1461da,_0x28171e,_0x272557[_0x0452('0x19e')]);}}}})[_0x0452('0x9d')](function(){if(_0x1703ce){hopperUtils[_0x0452('0xe3')](_0x56b10f,_0x442dac,_0x554df8)[_0x0452('0x9d')](function(){return _0x1461da(0x1);});}});});};Dialer[_0x0452('0x80')][_0x0452('0x11e')]=function(_0x40defd,_0x1e7f4e,_0x5073df,_0x1c7243){var _0x11390b=new Final(_0x40defd);_0x11390b[_0x0452('0x68')]=0xf;_0x11390b[_0x0452('0x69')]=_0x0452('0x1b8');this[_0x0452('0x120')](_0x11390b,_0x1e7f4e,_0x5073df,_0x1c7243);};Dialer['prototype'][_0x0452('0x120')]=function(_0x3bf332,_0x21dc69,_0x3366a4,_0x1f0504){hopperUtils[_0x0452('0xc8')](_0x3bf332)[_0x0452('0x9d')](function(){return _0x21dc69(msgResponse('[callProgressDetecting]','Success',_0x1f0504));})[_0x0452('0xa8')](function(){return _0x3366a4(msgResponse('[moveContactManagedDialer][0]',_0x0452('0x90'),'contact\x20not\x20moved'));});};Dialer['prototype']['predictive']=function(_0x5c52e1){var _0x5554d3=_0x5c52e1[_0x0452('0x1b9')]/0x64;var _0x10e60e=_0x5c52e1['outboundDropCallsDayTimeout']/(_0x5c52e1['outboundDropCallsDayTimeout']+_0x5c52e1[_0x0452('0xc4')]);var _0x511a03=Math['round'](_0x5c52e1[_0x0452('0x1ba')]*(_0x5c52e1[_0x0452('0x1bb')]/0x64));var _0x542c0f=Math[_0x0452('0x1bc')](_0x5c52e1[_0x0452('0x1ba')]*(_0x5c52e1['predictiveIntervalMinThreshold']/0x64));var _0x3e954c=_0x5c52e1[_0x0452('0x13f')]+_0x5c52e1[_0x0452('0x141')];var _0x19a989=Math[_0x0452('0x1bd')](_0x5c52e1[_0x0452('0x56')]*_0x5c52e1[_0x0452('0x58')]*_0x5c52e1['predictiveIntervalHitRate']*_0x5c52e1['predictiveIntervalMultiplicativeFactor']);if(_[_0x0452('0x3e')](_0x5c52e1[_0x0452('0x25')])){if(!_['isUndefined'](_0x5c52e1[_0x0452('0x24')])){_0x5c52e1[_0x0452('0x24')]=undefined;loggerPredictive[_0x0452('0x61')](_0x0452('0x1be'),_0x0452('0x1bf'));}if(!_['isUndefined'](_0x5c52e1['handlePredictive'])){loggerPredictive[_0x0452('0x61')](_0x0452('0x1be'),_0x0452('0x1c0'));clearInterval(_0x5c52e1[_0x0452('0x5f')]);_0x5c52e1[_0x0452('0x5f')]=undefined;}_0x5c52e1[_0x0452('0x25')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x5c52e1[_0x0452('0x5d')],'collection\x20data\x20in\x20progressive\x20at',_0x5c52e1['startProgressive']);this[_0x0452('0xb0')](_0x5c52e1,0x1);}else if(ifInterval(_0x5c52e1['dialPredictiveInterval'],_0x5c52e1['startProgressive'])){this['handlePower'](_0x5c52e1,0x1);loggerPredictiveCalls[_0x0452('0x47')]('[startMethodPredictive][StartProgressive][Loop]',_0x5c52e1['startProgressive'],_0x5c52e1[_0x0452('0x5d')]);_0x5c52e1[_0x0452('0x56')]=0x0;_0x5c52e1[_0x0452('0xcf')]=0x0;}else if(_0x5554d3<_0x10e60e&&_0x5c52e1['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x5c52e1);loggerPredictive[_0x0452('0x47')](_0x0452('0x1c1'),'Dropped\x20calls\x20day',_0x10e60e,_0x0452('0x25'),_0x5c52e1[_0x0452('0x5d')]);}else if(_0x19a989<_0x5c52e1[_0x0452('0xcf')]&&_0x5c52e1[_0x0452('0x1c2')]==='dropRate'){clearPredictiveAttributes(_0x5c52e1);loggerPredictive[_0x0452('0x47')](_0x0452('0x1c3'),_0x0452('0x1c4'),_0x19a989,'Drop\x20in\x20this\x20interval',_0x5c52e1['predictiveIntervalErlangCallsDroppedCalls'],_0x0452('0x25'),_0x5c52e1[_0x0452('0x5d')]);}else if(!ifInterval(_0x5c52e1[_0x0452('0x1c5')],_0x5c52e1[_0x0452('0x25')])&&_[_0x0452('0x3e')](_0x5c52e1[_0x0452('0x24')])&&!_['isUndefined'](_0x5c52e1[_0x0452('0x25')])){_0x5c52e1[_0x0452('0x24')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0452('0x47')](_0x5c52e1[_0x0452('0x5d')],_0x0452('0x1c6'),_0x5c52e1[_0x0452('0x24')]);hopperUtils['avgHandleTime'](_0x5c52e1['dialPredictiveInterval'])['then'](this[_0x0452('0x1c7')](_0x5c52e1))[_0x0452('0x9d')](mergeDataErlangB(_0x5c52e1))['then'](this['startMethodPredictive'](_0x5c52e1))[_0x0452('0xa8')](loggerCatchPredictive(_0x0452('0x1c8'),_0x5c52e1));}else if(!ifInterval(_0x5c52e1[_0x0452('0x1c5')],_0x5c52e1[_0x0452('0x24')])){_0x5c52e1[_0x0452('0xcf')]=0x0;_0x5c52e1[_0x0452('0x24')]=moment()[_0x0452('0x43')](_0x0452('0xc3'));loggerPredictive[_0x0452('0x47')](_0x5c52e1[_0x0452('0x5d')],'recalculate\x20predictive\x20at',_0x5c52e1[_0x0452('0x24')]);clearInterval(_0x5c52e1[_0x0452('0x5f')]);_0x5c52e1[_0x0452('0x5f')]=undefined;hopperUtils['avgHandleTime'](_0x5c52e1[_0x0452('0x1c5')])[_0x0452('0x9d')](this['getDataPredictive'](_0x5c52e1))['then'](mergeDataErlangB(_0x5c52e1))[_0x0452('0x9d')](this[_0x0452('0x1c9')](_0x5c52e1))[_0x0452('0xa8')](loggerCatchPredictive(_0x0452('0x1ca'),_0x5c52e1));}else if(_0x5c52e1[_0x0452('0x1ba')]&&_0x3e954c<_0x5c52e1['predictiveIntervalAvailable']-_0x542c0f){clearPredictiveAttributes(_0x5c52e1);loggerPredictive['info'](_0x5c52e1[_0x0452('0x5d')],_0x0452('0x1cb'),_0x3e954c,_0x0452('0x1cc'),_0x5c52e1[_0x0452('0x1ba')],'-',_0x542c0f,'=',_0x5c52e1[_0x0452('0x1ba')]-_0x542c0f,')');}else if(_0x5c52e1[_0x0452('0x1ba')]&&_0x3e954c>_0x5c52e1['predictiveIntervalAvailable']+_0x511a03){clearPredictiveAttributes(_0x5c52e1);loggerPredictive[_0x0452('0x47')](_0x5c52e1['name'],_0x0452('0x1cb'),_0x3e954c,_0x0452('0x1cd'),_0x5c52e1[_0x0452('0x1ba')],'+',_0x511a03,'=',_0x5c52e1[_0x0452('0x1ba')]+_0x511a03,')');}};Dialer[_0x0452('0x80')][_0x0452('0x1c7')]=function(_0x2a6093){var _0x12e370=this;return function(_0x3abf31){return new Promise(function(_0x5d4a31,_0x1f1517){_[_0x0452('0x5b')](_0x2a6093,_0x3abf31[0x0]);if(checkGetDataPredictive(_0x3abf31[0x0])){var _0xe0ca20=_0x2a6093[_0x0452('0x1ba')]=_0x2a6093[_0x0452('0x141')]+_0x2a6093['available'];var _0x1f35bd=_0x2a6093[_0x0452('0x1c5')]*0x3c;var _0x10364c=_0x3abf31[0x0]['predictiveIntervalAvgTalktime']+_0x3abf31[0x0][_0x0452('0x4f')];var _0x277074=(_0x3abf31[0x0][_0x0452('0x4a')]+_0x3abf31[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3abf31[0x0][_0x0452('0x4d')])/_0x3abf31[0x0][_0x0452('0x1ce')];_0x2a6093['predictiveIntervalHitRate']=_0x277074>0x0?_0x277074:0x1;switch(_0x2a6093[_0x0452('0x1c2')]){case _0x0452('0x1cf'):var _0x5c6b19=_0x2a6093[_0x0452('0x1b9')]/0x64;return _0x12e370['abandonmentRate'](_0xe0ca20,_0x1f35bd,_0x10364c,_0x277074,_0x5c6b19)[_0x0452('0x9d')](function(_0x4daac9){return _0x5d4a31(_0x4daac9);});case _0x0452('0x1d0'):var _0x1040c9=_0x2a6093[_0x0452('0x1b9')]/0x64;return _0x12e370[_0x0452('0x1d1')](_0xe0ca20,_0x1f35bd,_0x10364c,_0x277074,_0x1040c9)[_0x0452('0x9d')](function(_0x5256f0){return _0x5d4a31(_0x5256f0);});default:return _0x1f1517(msgResponse('[getDataPredictive]','Failure',_0x0452('0x1d2')));}}else{return _0x1f1517(msgResponse('[getDataPredictive]',_0x0452('0x90'),_0x0452('0x1d3')));}});};};Dialer[_0x0452('0x80')][_0x0452('0x1d4')]=function(_0x219fc1){var _0x940756=this;return function(_0x478cdc){return new Promise(function(_0x1bc94a,_0x1e16ee){_['merge'](_0x219fc1,_0x478cdc[0x0]);if(checkGetDataPredictive(_0x478cdc[0x0])){loggerPredictive[_0x0452('0x47')](JSON['stringify'](_0x478cdc[0x0]));if(_0x219fc1[_0x0452('0x1c2')]===_0x0452('0x1cf')){return _0x940756[_0x0452('0x157')](_0x219fc1['id'])[_0x0452('0x9d')](function(_0x473449){var _0x52af19=_0x219fc1['loggedIn']-_0x473449[0x0][_0x0452('0x1d5')];var _0x42f8b5=_0x219fc1['dialPredictiveInterval']*0x3c;var _0x11f950=_0x478cdc[0x0][_0x0452('0x51')]+_0x478cdc[0x0][_0x0452('0x4f')];var _0x2d5cca=(_0x478cdc[0x0][_0x0452('0x4a')]+_0x478cdc[0x0][_0x0452('0x4b')]+_0x478cdc[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x478cdc[0x0][_0x0452('0x1ce')];var _0x185410=_0x219fc1[_0x0452('0x1b9')]/0x64;_0x219fc1[_0x0452('0x1d6')]=_0x473449[0x0][_0x0452('0x1d5')]||0x0;_0x219fc1['predictiveIntervalHitRate']=_0x2d5cca>0x0?_0x2d5cca:0x1;return _0x940756['abandonmentRate'](_0x52af19,_0x42f8b5,_0x11f950,_0x2d5cca,_0x185410);})[_0x0452('0x9d')](function(_0x84df6b){return _0x1bc94a(_0x84df6b);})[_0x0452('0xa8')](function(_0x2725fb){return _0x1e16ee(msgResponse(_0x0452('0x1d7'),_0x0452('0x90'),JSON['stringify'](_0x2725fb)));});}if(_0x219fc1['dialPredictiveOptimization']===_0x0452('0x1d0')){return _0x940756['getVoiceQueueRtPauses'](_0x219fc1['id'])[_0x0452('0x9d')](function(_0x2b0eea){var _0x4a3fe9=_0x219fc1[_0x0452('0x1d8')]-_0x2b0eea[0x0][_0x0452('0x1d5')];var _0x34cafe=_0x219fc1['dialPredictiveInterval']*0x3c;var _0x3776bb=_0x478cdc[0x0][_0x0452('0x51')]+_0x478cdc[0x0][_0x0452('0x4f')];var _0x5210d2=(_0x478cdc[0x0]['predictiveIntervalAnsweredCalls']+_0x478cdc[0x0][_0x0452('0x4b')]+_0x478cdc[0x0][_0x0452('0x4d')])/_0x478cdc[0x0][_0x0452('0x1ce')];var _0x3f7f4f=_0x219fc1[_0x0452('0x1b9')]/0x64;_0x219fc1[_0x0452('0x1d6')]=_0x2b0eea[0x0]['outboundQueuePauses']||0x0;_0x219fc1[_0x0452('0x1d9')]=_0x5210d2>0x0?_0x5210d2:0x1;return _0x940756['busyFactor'](_0x4a3fe9,_0x34cafe,_0x3776bb,_0x5210d2,_0x3f7f4f);})[_0x0452('0x9d')](function(_0x32b2a0){return _0x1bc94a(_0x32b2a0);})['catch'](function(_0x5e4b40){return _0x1e16ee(msgResponse(_0x0452('0x1d7'),'Failure',JSON[_0x0452('0x6f')](_0x5e4b40)));});}}else{return _0x1e16ee(msgResponse(_0x0452('0x1da'),'Failure','check\x20failure'));}});};};Dialer[_0x0452('0x80')][_0x0452('0x1c9')]=function(_0x4d426e){var _0x4c6b9f=this;return function(){var _0x6d1d03=0x0;var _0x3fcf80=Math[_0x0452('0x1bd')](_0x4d426e[_0x0452('0x1db')]*0x3e8);if(_0x3fcf80>0x0){_0x3fcf80=_0x3fcf80<0x64?0x64:_0x3fcf80;loggerPredictive[_0x0452('0x47')](_0x4d426e[_0x0452('0x5d')],'one\x20call\x20every:',_0x3fcf80,_0x0452('0x1dc'));_0x4d426e[_0x0452('0x5f')]=setInterval(function(){_0x4c6b9f[_0x0452('0x5f')](_0x4d426e);loggerPredictiveCalls['info'](_0x0452('0x1dd'),_0x6d1d03+=0x1);},_0x3fcf80);}else{loggerPredictive['info'](_0x4d426e[_0x0452('0x5d')],_0x0452('0x1de'));}};};Dialer[_0x0452('0x80')][_0x0452('0x1df')]=function(_0x8380b8,_0x4fee7b){var _0x53cefc=this;return function(_0x1c2365){if(_[_0x0452('0x46')](_0x1c2365)){if(_[_0x0452('0xf6')](_0x4fee7b[_0x0452('0x159')])||!_0x4fee7b[_0x0452('0x1e0')]){if(_0x8380b8['dialMethod']==='booked'){_0x8380b8[_0x0452('0x6d')]=_['isUndefined'](_0x8380b8[_0x0452('0x6d')])?!![]:_0x8380b8[_0x0452('0x6d')];var _0x3ce320=uuid['v4']();_0x53cefc[_0x0452('0x21')][_0x3ce320]=new Action(_0x8380b8,_0x4fee7b,_0x3ce320);loggerBooked[_0x0452('0x47')]('[booked][checkContactBlack]',_0x3ce320,_0x0452('0x1e1'),JSON[_0x0452('0x6f')](_0x8380b8[_0x0452('0x6d')]),_0x0452('0x1e2'),_0x8380b8['name']);if(_0x8380b8[_0x0452('0x6d')]){_0x8380b8[_0x0452('0x6d')]=![];_0x53cefc[_0x0452('0x27')][_0x53cefc['actions'][_0x3ce320][_0x0452('0xbc')]]=[];ami['Action']({'actionid':_0x3ce320,'action':_0x0452('0x1e3'),'queue':_0x8380b8[_0x0452('0x5d')]})[_0x0452('0xa8')](function(){utils[_0x0452('0xc0')](_0x8380b8,_0x0452('0x1e4'));hopperUtils[_0x0452('0xda')]({'active':![],'ContactId':_0x53cefc[_0x0452('0x21')][_0x3ce320][_0x0452('0xdd')],'ListId':_0x53cefc[_0x0452('0x21')][_0x3ce320][_0x0452('0xea')],'VoiceQueueId':_0x53cefc['actions'][_0x3ce320][_0x0452('0xeb')]||undefined,'CampaignId':_0x53cefc[_0x0452('0x21')][_0x3ce320][_0x0452('0xde')]||undefined})[_0x0452('0xa8')](loggerCatch(_0x0452('0x1e5')));delete _0x53cefc['actions'][_0x3ce320];});}else{loggerBooked[_0x0452('0x47')](_0x0452('0x1e6'),JSON[_0x0452('0x6f')](_0x8380b8[_0x0452('0x6d')]),_0x0452('0x1e2'),_0x8380b8[_0x0452('0x5d')]);utils[_0x0452('0xc0')](_0x8380b8,_0x0452('0x1e4'));hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x53cefc[_0x0452('0x21')][_0x3ce320][_0x0452('0xdd')],'ListId':_0x53cefc[_0x0452('0x21')][_0x3ce320][_0x0452('0xea')],'VoiceQueueId':_0x53cefc[_0x0452('0x21')][_0x3ce320][_0x0452('0xeb')]||undefined,'CampaignId':_0x53cefc[_0x0452('0x21')][_0x3ce320][_0x0452('0xde')]||undefined})[_0x0452('0xa8')](loggerCatch(_0x0452('0x1e5')));delete _0x53cefc['actions'][_0x3ce320];}}else{return _0x53cefc[_0x0452('0x15e')](_0x8380b8,_0x4fee7b);}}else{if(utils[_0x0452('0x5c')](undefined,_0x4fee7b[_0x0452('0x1e7')])<_0x8380b8[_0x0452('0x1e8')]*0x3c){if(_0x4fee7b['Agent']&&!_0x4fee7b[_0x0452('0x14d')][_0x0452('0x1e9')]){_0x53cefc['preview'][_0x0452('0xf8')](_0x4fee7b['id'])[_0x0452('0xfa')](function(){utils[_0x0452('0xc0')](_0x8380b8,_0x0452('0x1e4'));});}else{hopperUtils['unlockContact']({'active':![]},_0x4fee7b['id'],0x1)['finally'](function(){utils[_0x0452('0xc0')](_0x8380b8,_0x0452('0x1e4'));});}}else{_0x8380b8[_0x0452('0x1ea')]+=0x1;utils[_0x0452('0xc0')](_0x8380b8,_0x0452('0x1e4'));if(_0x8380b8[_0x0452('0x1eb')]){hopperUtils[_0x0452('0xda')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4fee7b[_0x0452('0xdd')],'ListId':_0x4fee7b[_0x0452('0xea')],'VoiceQueueId':_0x4fee7b[_0x0452('0xeb')]||undefined,'CampaignId':_0x4fee7b[_0x0452('0xde')]||undefined})[_0x0452('0xa8')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x0452('0x131')](createObjHistory(_0x8380b8,_0x4fee7b,utils['CAMPAIGN_STATUS'][_0x0452('0x1ec')],0x17,'RecallInQueue'))[_0x0452('0xa8')](loggerCatch(_0x0452('0x1ed')));}else{_0x53cefc[_0x0452('0x113')](createObjHistory(_0x8380b8,_0x4fee7b,utils['CAMPAIGN_STATUS'][_0x0452('0x1ee')],0x16,_0x0452('0x1ef')),'[Originate][HistoryRecallClose][historyCatch]',_0x0452('0x1f0'));}}}}else{_0x8380b8[_0x0452('0x1f1')]+=0x1;_0x53cefc[_0x0452('0x113')](createObjHistory(_0x8380b8,_0x4fee7b,utils[_0x0452('0x65')][_0x0452('0x1f2')],0xd,_0x0452('0x1f3')),'[Originate][historyBlacklist]',_0x0452('0x1f4'));throw'inBlackList';}};};Dialer[_0x0452('0x80')]['handleIvr']=function(_0x316e79){var _0x894733=this;var _0x57e269=_0x316e79[_0x0452('0x1f5')]-_0x316e79[_0x0452('0x7a')];emitCampaignSummary(_0x316e79);if(_0x57e269>0x0&&_0x316e79[_0x0452('0x1f6')]==0x0){if(_0x57e269>this[_0x0452('0x1f')]){_0x57e269=this[_0x0452('0x1f')];}_0x316e79[_0x0452('0x1f6')]=0x1;hopperUtils[_0x0452('0x1f7')](_0x316e79,_0x57e269)[_0x0452('0x9d')](function(_0x5134d5){_0x316e79[_0x0452('0x1f6')]=0x0;if(_0x5134d5){if(!utils[_0x0452('0x1f8')](_0x5134d5)){_0x316e79['message']=utils[_0x0452('0x65')]['NO_AVAILABLE_CONTACTS'];logger['info']('[getContactCampaign2][Empty]'+_0x316e79[_0x0452('0x5d')]);}else{_0x316e79['originated']+=_0x5134d5[_0x0452('0x96')];_0x316e79['message']=utils[_0x0452('0x65')][_0x0452('0x1f9')];for(var _0x312629=0x0;_0x312629<_0x5134d5[_0x0452('0x96')];_0x312629+=0x1){_0x316e79[_0x0452('0x1fa')]+=0x1;if(_[_0x0452('0xf6')](_0x5134d5[_0x312629])||_[_0x0452('0xf6')](_0x5134d5[_0x312629][_0x0452('0x17b')])||_[_0x0452('0xf6')](_0x5134d5[_0x312629]['phone'])){_0x894733[_0x0452('0x1fb')]('[actionOriginate]\x20',_0x316e79,_0x5134d5[_0x312629]);}else{hopperUtils[_0x0452('0x1fc')](_['pick'](_0x5134d5[_0x312629],[_0x0452('0xde'),_0x0452('0x161')]))[_0x0452('0x9d')](_0x894733['checkContactBlack'](_0x316e79,_0x5134d5[_0x312629]))['catch'](function(_0xf342b1){logger[_0x0452('0x61')](_0x0452('0x1fd'),_0xf342b1);utils[_0x0452('0xc0')](_0x316e79,_0x0452('0x1fe'));});}}}}})[_0x0452('0xa8')](function(_0x1249f2){_0x316e79['temp']=0x0;logger[_0x0452('0x61')](_0x0452('0x1ff'),_0x1249f2);});}};Dialer[_0x0452('0x80')]['handlePower']=function(_0x33d4f1,_0x136861){var _0x1a292a=this;var _0x4d410c=[];if(_0x136861<0x1||_0x33d4f1[_0x0452('0xaf')]==='booked'){_0x136861=0x1;}var _0x13022d=Math[_0x0452('0x1bd')](_0x33d4f1[_0x0452('0x13f')]*_0x136861)-_0x33d4f1[_0x0452('0x7a')];if(_0x33d4f1[_0x0452('0x200')]>0x0){var _0x32a6b1=_0x33d4f1[_0x0452('0x200')]-_0x33d4f1[_0x0452('0x7a')]-_0x33d4f1[_0x0452('0x141')]-_0x33d4f1['pTalking'];if(_0x13022d>_0x32a6b1){_0x13022d=_0x32a6b1;}}if(_0x13022d>0x0&&_0x33d4f1[_0x0452('0x1f6')]==0x0){if(_0x33d4f1[_0x0452('0xaf')]===_0x0452('0x8')){_0x13022d=0x1;}if(_0x13022d>this[_0x0452('0x1f')]){_0x13022d=this[_0x0452('0x1f')];}for(var _0x148997 in this[_0x0452('0x1d')]){if(typeof this[_0x0452('0x1d')][_0x148997]!=='undefined'){if(this['agents'][_0x148997]['state']==='not_inuse'&&this[_0x0452('0x1d')][_0x148997]['status']===_0x0452('0x85')){_0x4d410c[_0x0452('0x97')](this[_0x0452('0x1d')][_0x148997]['id']);}}}_0x33d4f1[_0x0452('0x1f6')]=0x1;hopperUtils[_0x0452('0x201')](_0x33d4f1,_0x4d410c,_0x13022d)[_0x0452('0x9d')](function(_0x7d827c){_0x33d4f1['temp']=0x0;if(_0x7d827c){if(!utils['checkContactEmpty'](_0x7d827c)){hopperUtils[_0x0452('0x202')](_0x33d4f1)[_0x0452('0x9d')](sendMessageReschedule(_0x33d4f1))[_0x0452('0xa8')](loggerCatch(_0x0452('0x203')));}else{_0x33d4f1[_0x0452('0x7a')]+=_0x7d827c[_0x0452('0x96')];_0x33d4f1[_0x0452('0x64')]=_0x33d4f1['dialMethod']===_0x0452('0x8')?utils[_0x0452('0x65')]['ACTIVE']:utils[_0x0452('0x65')][_0x0452('0x1f9')];for(var _0x6f0465=0x0;_0x6f0465<_0x7d827c[_0x0452('0x96')];_0x6f0465+=0x1){if(_[_0x0452('0xf6')](_0x7d827c[_0x6f0465])||_[_0x0452('0xf6')](_0x7d827c[_0x6f0465][_0x0452('0x17b')])||_[_0x0452('0xf6')](_0x7d827c[_0x6f0465][_0x0452('0x161')])){_0x1a292a[_0x0452('0x1fb')](_0x0452('0x204'),_0x33d4f1,_0x7d827c[_0x6f0465]);}else{hopperUtils['checkIsBlackList'](_[_0x0452('0x70')](_0x7d827c[_0x6f0465],[_0x0452('0xeb'),_0x0452('0x161')]))[_0x0452('0x9d')](_0x1a292a[_0x0452('0x1df')](_0x33d4f1,_0x7d827c[_0x6f0465]))[_0x0452('0xa8')](function(_0x3273c9){logger[_0x0452('0x61')](_0x0452('0x205'),_0x3273c9);utils[_0x0452('0xc0')](_0x33d4f1,'[handlePower]');});}}}}})['catch'](function(_0x3aa710){_0x33d4f1[_0x0452('0x1f6')]=0x0;logger[_0x0452('0x61')](_0x0452('0x1ff'),_0x3aa710);});}};Dialer[_0x0452('0x80')][_0x0452('0x5f')]=function(_0x5c47cf){if(_0x5c47cf[_0x0452('0x200')]>0x0){var _0x245f7f=_0x5c47cf['dialLimitQueue']-_0x5c47cf['originated']-_0x5c47cf['talking'];if(_0x245f7f>0x0&&_0x5c47cf['temp']==0x0){this[_0x0452('0x206')](_0x5c47cf);}else{loggerPredictiveCalls[_0x0452('0x47')]('[handlePredictive][limitChannel]');}}else{this[_0x0452('0x206')](_0x5c47cf);}};Dialer['prototype'][_0x0452('0x206')]=function(_0x3f885d){var _0x5122e4=this;var _0x4e24f1=[];_0x3f885d[_0x0452('0x7a')]+=0x1;for(var _0x594ead in this[_0x0452('0x1d')]){if(typeof this[_0x0452('0x1d')][_0x594ead]!==_0x0452('0xab')){if(this[_0x0452('0x1d')][_0x594ead][_0x0452('0x68')]===_0x0452('0x207')&&this[_0x0452('0x1d')][_0x594ead][_0x0452('0x84')]==='reachable'){_0x4e24f1[_0x0452('0x97')](this['agents'][_0x594ead]['id']);}}}_0x3f885d[_0x0452('0x1f6')]=0x1;return this[_0x0452('0x201')](_0x3f885d['id'],_0x4e24f1,0x1,_0x3f885d[_0x0452('0x208')],_0x3f885d)[_0x0452('0x9d')](function(_0x37d285){_0x3f885d[_0x0452('0x1f6')]=0x1;if(_0x37d285){if(!utils[_0x0452('0x1f8')](_0x37d285)){utils[_0x0452('0x209')](_0x3f885d,0x1,0x0);return hopperUtils[_0x0452('0x202')](_0x3f885d)[_0x0452('0x9d')](sendMessageReschedule(_0x3f885d))['catch'](loggerCatch(_0x0452('0x203')));}else{_0x3f885d[_0x0452('0x64')]=utils[_0x0452('0x65')]['RUNNING'];if(_[_0x0452('0xf6')](_0x37d285[0x0])||_['isNil'](_0x37d285[0x0][_0x0452('0x17b')])||_[_0x0452('0xf6')](_0x37d285[0x0]['phone'])){_0x5122e4[_0x0452('0x1fb')](_0x0452('0x204'),_0x3f885d,_0x37d285[0x0]);}else{return hopperUtils[_0x0452('0x20a')](_[_0x0452('0x70')](_0x37d285[0x0],[_0x0452('0xeb'),'phone']))['then'](_0x5122e4['checkContactBlack'](_0x3f885d,_0x37d285[0x0]))[_0x0452('0xa8')](function(_0x4a5bff){logger[_0x0452('0x61')](_0x0452('0x20b'),_0x4a5bff);utils[_0x0452('0xc0')](_0x3f885d,_0x0452('0x20b'));});}}}})['catch'](function(_0x5dff2b){_0x3f885d[_0x0452('0x1f6')]=0x0;logger[_0x0452('0x61')](_0x0452('0x1ff'),_0x5dff2b);});};Dialer[_0x0452('0x80')][_0x0452('0x20c')]=function(_0x307b15,_0x27e6b3,_0x5424e8,_0x9ce67e,_0x4270c8,_0x44354d){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x0452('0x47')]('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',_0x307b15);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x27e6b3);loggerPredictive['info'](_0x0452('0x20d'),_0x5424e8);loggerPredictive[_0x0452('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',_0x9ce67e);loggerPredictive[_0x0452('0x47')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4270c8);loggerPredictive[_0x0452('0x47')](_0x0452('0x52'));return new Promise(function(_0x3b80f4,_0x3642fd){if(_0x307b15<=0x0||isNaN(_0x307b15)){return _0x3642fd(msgResponse(_0x0452('0x20e'),_0x0452('0x7f'),'m\x20=\x20'+_0x307b15));}if(_0x5424e8<=0x0||isNaN(_0x5424e8)){return _0x3642fd(msgResponse(_0x0452('0x20e'),_0x0452('0x7f'),_0x0452('0x20f')+_0x5424e8));}if(_0x9ce67e<=0x0||isNaN(_0x9ce67e)){return _0x3642fd(msgResponse(_0x0452('0x20e'),'Error',_0x0452('0x210')+_0x9ce67e));}if(_0x27e6b3<=0x0||isNaN(_0x27e6b3)){return _0x3642fd(msgResponse('[abandonmentRate]',_0x0452('0x7f'),_0x0452('0x211')+_0x27e6b3));}if(_0x4270c8<=0x0||isNaN(_0x4270c8)){return _0x3642fd(msgResponse(_0x0452('0x20e'),_0x0452('0x7f'),_0x0452('0x212')+_0x4270c8));}_0x44354d=_0x44354d||0x0;var _0x2d7af8=0x1/_0x5424e8;var _0x4a86ec=0x0;var _0x27de13=0x0;var _0x5de32a=0x0;var _0x9aa2e3=0x0;for(var _0x26ce54=0x0;_0x5de32a<_0x4270c8;_0x26ce54+=0x1){_0x27de13=_0x26ce54/_0x27e6b3;_0x4a86ec=(_0x9ce67e*_0x27de13+_0x44354d)/_0x2d7af8;_0x5de32a=utils['erlangb'](_0x4a86ec,_0x307b15);_0x9aa2e3=_0x4a86ec/_0x307b15*(0x1-utils['erlangb'](_0x4a86ec,_0x307b15));}return _0x3b80f4({'erlangCalls':_0x26ce54,'erlangCallToSecond':_0x27e6b3/_0x26ce54,'erlangAbandonmentRate':_0x5de32a,'erlangBusyFactor':_0x9aa2e3});});};Dialer[_0x0452('0x80')][_0x0452('0x1d1')]=function(_0x277dc5,_0x888297,_0x4fe21d,_0x5bed4,_0x260cf4,_0x1669f3){loggerPredictive[_0x0452('0x47')](_0x0452('0x213'));loggerPredictive[_0x0452('0x47')](_0x0452('0x214'),_0x277dc5);loggerPredictive[_0x0452('0x47')](_0x0452('0x215'),_0x888297);loggerPredictive[_0x0452('0x47')](_0x0452('0x20d'),_0x4fe21d);loggerPredictive['info'](_0x0452('0x216'),_0x5bed4);loggerPredictive[_0x0452('0x47')](_0x0452('0x217'),_0x260cf4);loggerPredictive[_0x0452('0x47')](_0x0452('0x52'));return new Promise(function(_0x4ca646,_0x7c653e){if(_0x277dc5<=0x0||isNaN(_0x277dc5)){return _0x7c653e(msgResponse(_0x0452('0x218'),'Error',_0x0452('0x219')+_0x277dc5));}if(_0x4fe21d<=0x0||isNaN(_0x4fe21d)){return _0x7c653e(msgResponse(_0x0452('0x218'),_0x0452('0x7f'),_0x0452('0x20f')+_0x4fe21d));}if(_0x5bed4<=0x0||isNaN(_0x5bed4)){return _0x7c653e(msgResponse('[busyFactor]',_0x0452('0x7f'),_0x0452('0x210')+_0x5bed4));}if(_0x888297<=0x0||isNaN(_0x888297)){return _0x7c653e(msgResponse(_0x0452('0x218'),'Error',_0x0452('0x211')+_0x888297));}if(_0x260cf4<=0x0||isNaN(_0x260cf4)){return _0x7c653e(msgResponse(_0x0452('0x218'),'Error','Umin\x20=\x20'+_0x260cf4));}_0x1669f3=_0x1669f3||0x0;var _0x4888e=0x1/_0x4fe21d;var _0x3d83f5=0x0;var _0x2c911a=0x0;var _0xeb9381=0x0;var _0x595d02=0x0;for(var _0x55ed89=0x0;_0x595d02<_0x260cf4;_0x55ed89+=0x1){_0x2c911a=_0x55ed89/_0x888297;_0x3d83f5=(_0x5bed4*_0x2c911a+_0x1669f3)/_0x4888e;_0xeb9381=utils[_0x0452('0x21a')](_0x3d83f5,_0x277dc5);_0x595d02=_0x3d83f5/_0x277dc5*(0x1-utils['erlangb'](_0x3d83f5,_0x277dc5));}return _0x4ca646({'erlangCalls':_0x55ed89,'erlangCallToSecond':_0x888297/_0x55ed89,'erlangAbandonmentRate':_0xeb9381,'erlangBusyFactor':_0x595d02});});};module[_0x0452('0x21b')]=Dialer; \ No newline at end of file +var _0x3c62=['[syncHangupInAMD][createHistory]','MACHINE','Machine','countmachineretry','buildObj','countbusyretry','countcongestionretry','countnosuchnumberretry','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','HANGUP','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countnoanswerretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','syncHangup','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','moveContactManagedDialer','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','[syncHangup]','AGI','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','available','inUse','pTalking','ACTIVE','queueSummaryCountersUpdated','updateReportFromOutboundQueue','[syncQueueSummary]','filter','dialPreviewRecallmeReminder','online','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','sequence','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','Agent','launchHandleIvr','handleIvr','actionOriginate','object','phone','originate','contact\x20is\x20undefine','NONE','\x22agi://%s/square,%s\x22','dialQueueProject2','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','assign','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','Trunk','callerid','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','variables','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','dialAgentRejectRetryFrequency','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictive','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','talking','floor','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','abandonmentRate','[CatchErlangB]','predictiveIntervalPauses','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','voicePause','[checkContactBlack]','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','originated','temp','checkContactEmpty','[getContactCampaign2][Empty]','ivrTotalCallsDays','checkIsBlackListIvr','[handleIvr]','[getContactCampaign2]','dialLimitQueue','getContactDialer','countReScheduled','RUNNING','checkIsBlackList','[actionOriginate]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','dialOrderByScheduledAt','checkContactLowerLimitOriginate','[countReScheduled]\x20','[actionOriginate]\x20','[actionOriginatePredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','./models/action','./models/history','./models/final','./models/queueCallerAbandon','XCALLY_IP_AGI','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','agentconnect','syncAgentConnect','queuecallerabandon','originateresponse','syncOriginateResponse','syncAgentComplete','bind','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','newexten','varset','syncVarSet','queuemember','syncQueueStatusComplete','loopClearZombieChannels','previewRecallmeReminderInterval','isUndefined','emit','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','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','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','---------------------------','merge','startProgressive\x20value\x20cleared','debug','handlePredictive','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','pick','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','Interval','INACTIVE','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20deactivated','Error','isTrunkReachable','active','status','reachable','SIP/%s','unmonitored','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','Failure','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','then','true','catch','content','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','syncCampaigns','undefined','isIVRCampaignActive','dialGlobalInterval','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','Dialer::ifTime()','intervalIftime','OVERTIME_GLOBAL_INTERVAL','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','[ifTime][Action]','queue','uniqueid','ivr','[syncAgentConnect]','answertime','outboundAnswerCallsDay','reason','agent','agiafterat','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncQueueCallerAbandon','decrementOriginate','[syncQueueCallerAbandon]','droptime','getSeconds','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','TIMEOUT','countglobal','verifyAdditionalPhones','voiceQueue','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','CampaignId','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','actions','channel','syncQueueMember','actionid','rrmemory','roundrobin','isNil','locked','paused','stateinterface','queueBooked','idHopper','[Catch][Preview][syncQueueStatusComplete]','[syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','run','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','response','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','amd'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c62,0x119));var _0x23c6=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x3c62[_0x3ff085];return _0x2b68c3;};'use strict';var util=require(_0x23c6('0x0'));var _=require(_0x23c6('0x1'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x23c6('0x2'));var hopperUtils=require(_0x23c6('0x3'));var ut=require(_0x23c6('0x4'));var config=require(_0x23c6('0x5'));var logger=require(_0x23c6('0x6'))(_0x23c6('0x7'));var loggerBooked=require(_0x23c6('0x6'))(_0x23c6('0x8'));var loggerPredictive=require(_0x23c6('0x6'))('predictive');var loggerPredictiveCalls=require(_0x23c6('0x6'))(_0x23c6('0x9'));var loggerSyncQueueSummary=require(_0x23c6('0x6'))(_0x23c6('0xa'));var ami=require(_0x23c6('0xb'));config[_0x23c6('0xc')]=_[_0x23c6('0xd')](config['redis'],{'host':_0x23c6('0xe'),'port':0x18eb});var io=require(_0x23c6('0xf'))(new Redis(config[_0x23c6('0xc')]));var cmHopper=require(_0x23c6('0x10'));var voiceQueueRt=require(_0x23c6('0x11'));var RpcSetting=require('../rpc/setting');var Interval=require('../rpc/interval');var Action=require(_0x23c6('0x12'));var History=require(_0x23c6('0x13'));var Final=require(_0x23c6('0x14'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x23c6('0x15'));var Hangup=require('./models/hangup');var ipAgi=process['env'][_0x23c6('0x16')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x23c6('0x17')][_0x23c6('0x18')]=function(_0x200888){this[_0x23c6('0x19')]=this[_0x23c6('0x19')]?this['tail'][_0x23c6('0x1a')](_0x200888):_0x200888();};function Dialer(_0x206aa9,_0x3fc642){this['sequence']=new Sequence();this[_0x23c6('0x1b')]=_0x3fc642;this[_0x23c6('0x1c')]=_0x206aa9[_0x23c6('0x1c')];this[_0x23c6('0x1d')]=_0x206aa9[_0x23c6('0x1d')];this[_0x23c6('0x1e')]=_0x206aa9[_0x23c6('0x1e')];this[_0x23c6('0x1f')]=_0x206aa9['trunks'];this[_0x23c6('0x20')]=config[_0x23c6('0x20')]||0x2;this[_0x23c6('0x21')]={};this['actions']={};this[_0x23c6('0x22')]={};this[_0x23c6('0x23')]={};this[_0x23c6('0x24')]={};this[_0x23c6('0x25')]={};this[_0x23c6('0x26')]={};this[_0x23c6('0x27')]={};this['queueBooked']={};this['queueBookedRR']={};this['queuesSummary']={};ami['on'](_0x23c6('0x28'),this[_0x23c6('0x29')]['bind'](this));ami['on'](_0x23c6('0x2a'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x23c6('0x2b'),this[_0x23c6('0x2c')]['bind'](this));ami['on']('agentcomplete',this[_0x23c6('0x2d')][_0x23c6('0x2e')](this));ami['on'](_0x23c6('0x2f'),this[_0x23c6('0xa')][_0x23c6('0x2e')](this));ami['on'](_0x23c6('0x30'),this[_0x23c6('0x31')][_0x23c6('0x2e')](this));ami['on']('hangup',this['syncHangup'][_0x23c6('0x2e')](this));ami['on'](_0x23c6('0x32'),this['syncNewExten'][_0x23c6('0x2e')](this));ami['on'](_0x23c6('0x33'),this[_0x23c6('0x34')][_0x23c6('0x2e')](this));ami['on'](_0x23c6('0x35'),this['syncQueueMember'][_0x23c6('0x2e')](this));ami['on']('queuestatuscomplete',this[_0x23c6('0x36')][_0x23c6('0x2e')](this));this['loopCampaigns']();this[_0x23c6('0x37')]();RpcSetting['getSettings']()['then'](function(_0x281d8a){previewRecallmeReminderInterval=_0x281d8a[_0x23c6('0x38')];});}function isNotNull(_0x45433b){return _0x45433b!==null&&!_[_0x23c6('0x39')](_0x45433b);}function msgResponse(_0x2ca058,_0x2e91d0,_0x19c10e){return{'action':_0x2ca058,'response':_0x2e91d0,'message':_0x19c10e,'stack':_0x19c10e};}function emit(_0x1c2d85,_0x3c3566,_0xbccdca){io['to'](_0x1c2d85)[_0x23c6('0x3a')](_0x3c3566,_0xbccdca);}function emitOutboundVoiceQueueSummary(_0x53dbd6){if(_0x53dbd6[_0x23c6('0x3b')]==='outbound'){logger['debug'](_0x23c6('0x3c'),util[_0x23c6('0x3d')](_0x53dbd6,{'showHidden':![],'depth':null}));emit(util[_0x23c6('0x3e')](_0x23c6('0x3f'),_0x53dbd6[_0x23c6('0x40')]),_0x23c6('0x41'),_0x53dbd6);}}function checkGetDataPredictive(_0x3333be){if(isNotNull(_0x3333be)&&!_[_0x23c6('0x42')](_0x3333be)){loggerPredictive[_0x23c6('0x43')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x23c6('0x43')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3333be[_0x23c6('0x44')]);loggerPredictive[_0x23c6('0x43')](_0x23c6('0x45'),_0x3333be[_0x23c6('0x46')]);loggerPredictive[_0x23c6('0x43')](_0x23c6('0x47'),_0x3333be[_0x23c6('0x48')]);loggerPredictive[_0x23c6('0x43')](_0x23c6('0x49'),_0x3333be[_0x23c6('0x4a')]);loggerPredictive[_0x23c6('0x43')](_0x23c6('0x4b'),_0x3333be[_0x23c6('0x4c')]);loggerPredictive[_0x23c6('0x43')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3333be[_0x23c6('0x4d')]);loggerPredictive['info']('---------------------------');if(_0x3333be[_0x23c6('0x44')]>0x0){if(!_['isUndefined'](_0x3333be[_0x23c6('0x4d')])&&_0x3333be[_0x23c6('0x4d')]>0x0){return!![];}loggerPredictive['info'](_0x23c6('0x4e'));if(!_[_0x23c6('0x39')](_0x3333be['predictiveIntervalAvgHoldtime'])&&_0x3333be[_0x23c6('0x4c')]>0x0){return!![];}loggerPredictive['info'](_0x23c6('0x4f'));}else{loggerPredictive[_0x23c6('0x43')](_0x23c6('0x50'));}}else{loggerPredictive[_0x23c6('0x43')](_0x23c6('0x51'));}return![];}function mergeDataErlangB(_0x241930){return function(_0x2b6ee7){loggerPredictive[_0x23c6('0x43')](_0x23c6('0x52'));loggerPredictive['info'](_0x23c6('0x53'),_0x2b6ee7['erlangCalls']);loggerPredictive[_0x23c6('0x43')](_0x23c6('0x54'),_0x2b6ee7[_0x23c6('0x55')]);loggerPredictive[_0x23c6('0x43')](_0x23c6('0x56'),_0x2b6ee7[_0x23c6('0x57')]);loggerPredictive['info'](_0x23c6('0x58'),_0x2b6ee7[_0x23c6('0x59')]);loggerPredictive[_0x23c6('0x43')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2b6ee7[_0x23c6('0x57')]);loggerPredictive[_0x23c6('0x43')](_0x23c6('0x5a'));_[_0x23c6('0x5b')](_0x241930,_0x2b6ee7);};}function ifInterval(_0x1d4220,_0x35ba2b){if(_[_0x23c6('0x39')](_0x35ba2b)){return![];}return utils['getSeconds'](undefined,_0x35ba2b)<_0x1d4220*0x3c;}function clearPredictiveAttributes(_0x968027){if(_0x968027['startProgressive']){_0x968027[_0x23c6('0x26')]=undefined;loggerPredictive['debug'](_0x968027['name'],_0x23c6('0x5c'));}if(_0x968027[_0x23c6('0x25')]){_0x968027[_0x23c6('0x25')]=undefined;loggerPredictive[_0x23c6('0x5d')](_0x968027['name'],'startPredictive\x20value\x20cleared');}if(_0x968027[_0x23c6('0x5e')]){clearInterval(_0x968027[_0x23c6('0x5e')]);_0x968027[_0x23c6('0x5e')]=undefined;loggerPredictive[_0x23c6('0x5d')](_0x968027[_0x23c6('0x40')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x556874,_0x35dbaa){return function(_0x29d132){loggerPredictive[_0x23c6('0x5f')](_0x35dbaa[_0x23c6('0x40')],_0x556874);loggerPredictive[_0x23c6('0x5f')](_0x29d132[_0x23c6('0x60')]);clearPredictiveAttributes(_0x35dbaa);};}function loggerCatch(_0x1fd1ce){return function(_0x59d9de){logger[_0x23c6('0x5f')](_0x1fd1ce,util['inspect'](_0x59d9de,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x223144){return function(_0x1d8002){if(isNotNull(_0x1d8002)&&isNotNull(_0x1d8002[0x0])){if(_0x1d8002[0x0][_0x23c6('0x61')]>0x0){_0x223144[_0x23c6('0x62')]=utils[_0x23c6('0x63')][_0x23c6('0x64')];logger[_0x23c6('0x43')](_0x23c6('0x65')+_0x223144[_0x23c6('0x40')],_0x1d8002[0x0][_0x23c6('0x61')],_0x23c6('0x66'));}else{_0x223144[_0x23c6('0x62')]=utils[_0x23c6('0x63')][_0x23c6('0x67')];logger[_0x23c6('0x43')](_0x23c6('0x68')+_0x223144[_0x23c6('0x40')]);}}};}function createObjHistory(_0x3e6a8c,_0x9189fc,_0x19645e,_0x224209,_0x4b2a22){_0x3e6a8c['message']=_0x19645e;var _0x3a8b02=new Action(_0x3e6a8c,_0x9189fc);var _0x2a8876=new History(_0x3a8b02);_0x2a8876[_0x23c6('0x69')]=_0x224209;_0x2a8876['statedesc']=_0x4b2a22;_0x2a8876[_0x23c6('0x6a')]=_0x3a8b02['starttime'];return _0x2a8876;}function unlockQueueStatus(_0x410597,_0x1fd569){setTimeout(function(){if(_[_0x23c6('0x39')](_0x410597[_0x23c6('0x6b')])){loggerBooked['error'](_0x23c6('0x6c'),_0x1fd569);}_0x410597[_0x23c6('0x6b')]=!![];loggerBooked[_0x23c6('0x43')]('[booked][unlockQueueStatus]',_0x1fd569,JSON[_0x23c6('0x6d')](_[_0x23c6('0x6e')](_0x410597,['name',_0x23c6('0x6b')])));},0x1f3);}function checkInterval(_0x4427f4){return function(){if(!isNotNull(_0x4427f4['Interval'])){_0x4427f4[_0x23c6('0x62')]=utils[_0x23c6('0x63')][_0x23c6('0x6f')];throw _0x4427f4[_0x23c6('0x40')]+_0x23c6('0x70');}if(!isNotNull(_0x4427f4['Interval'][_0x23c6('0x71')])){_0x4427f4['message']=utils[_0x23c6('0x63')]['NULL_INTERVAL'];throw _0x4427f4[_0x23c6('0x40')]+_0x23c6('0x70');}if(!isNotNull(_[_0x23c6('0x42')](_0x4427f4[_0x23c6('0x72')][_0x23c6('0x71')]))){_0x4427f4[_0x23c6('0x62')]=utils[_0x23c6('0x63')][_0x23c6('0x6f')];throw _0x4427f4[_0x23c6('0x40')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x314418){return function(){if(!utils['isIVRCampaignActive'](_0x314418)){_0x314418[_0x23c6('0x62')]=utils['CAMPAIGN_STATUS'][_0x23c6('0x73')];throw _0x314418[_0x23c6('0x40')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x5d1404){if(utils[_0x23c6('0x74')](_0x5d1404)){emit(util[_0x23c6('0x3e')](_0x23c6('0x75'),_0x5d1404['name']),_0x23c6('0x76'),_0x5d1404);}}function loggerCatchQueueSummary(_0x3f007c,_0x483781){return function(_0x103349){clearPredictiveAttributes(_0x483781);emitCampaignSummary(_0x483781);loggerSyncQueueSummary['debug'](_0x3f007c,util[_0x23c6('0x3d')](_0x103349,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x19e620){if(_0x19e620[_0x23c6('0x77')]){if(_0x19e620['originated']===0x0){_0x19e620[_0x23c6('0x77')]=![];_0x19e620[_0x23c6('0x62')]=utils[_0x23c6('0x63')][_0x23c6('0x73')];loggerSyncQueueSummary['debug'](_0x23c6('0x78'),_0x19e620[_0x23c6('0x40')],_0x23c6('0x79'));}else{_0x19e620[_0x23c6('0x62')]=utils[_0x23c6('0x63')][_0x23c6('0x7a')];loggerSyncQueueSummary['debug'](_0x23c6('0x78'),_0x19e620[_0x23c6('0x40')],_0x23c6('0x7b'));}emitCampaignSummary(_0x19e620);}}function myreject(_0x59f57d){return function(_0x4dbd57){return _0x59f57d(msgResponse('[ifTime][Action]',_0x23c6('0x7c'),JSON['stringify'](_0x4dbd57)));};}Dialer[_0x23c6('0x17')][_0x23c6('0x7d')]=function(_0x3b46d2){return!_[_0x23c6('0x39')](_0x3b46d2)&&_0x3b46d2&&!_['isUndefined'](_0x3b46d2[_0x23c6('0x40')])&&!_[_0x23c6('0x39')](_0x3b46d2[_0x23c6('0x7e')])&&_0x3b46d2[_0x23c6('0x7e')]&&(this[_0x23c6('0x1f')][util[_0x23c6('0x3e')]('SIP/%s',_0x3b46d2[_0x23c6('0x40')])][_0x23c6('0x7f')]===_0x23c6('0x80')||this[_0x23c6('0x1f')][util[_0x23c6('0x3e')](_0x23c6('0x81'),_0x3b46d2['name'])]['status']===_0x23c6('0x82'));};Dialer[_0x23c6('0x17')]['checkIsTrunkReachable']=function(_0x54cf5d){var _0x4dc380=this;return function(){if(!_0x4dc380['isTrunkReachable'](_0x54cf5d['Trunk'])){if(!_0x4dc380[_0x23c6('0x7d')](_0x54cf5d[_0x23c6('0x83')])){_0x54cf5d[_0x23c6('0x62')]=utils[_0x23c6('0x63')]['TRUNK_NOT_REACHABLE'];throw _0x54cf5d[_0x23c6('0x40')]+_0x23c6('0x84');}}};};Dialer['prototype'][_0x23c6('0x85')]=function(_0x5640e7,_0x243bde,_0x35bc82,_0x33e0c1){var _0x2b4c43=this;return function(){var _0x556087=!![];return _0x2b4c43[_0x23c6('0x86')](_0x5640e7,_0x243bde,_0x35bc82,_0x33e0c1,_0x556087);};};Dialer[_0x23c6('0x17')]['checkIfTimeIntervals']=function(_0x5aeedb,_0x31ea47,_0x3f62e7,_0x220a3c){var _0x2394a0=this;return function(){var _0x3382d1=![];return _0x2394a0[_0x23c6('0x86')](_0x5aeedb[_0x23c6('0x71')],_0x31ea47,_0x3f62e7,_0x220a3c,_0x3382d1);};};Dialer[_0x23c6('0x17')]['ifTimeIvr']=function(_0x184932,_0x53ebe9,_0x38f3e4,_0x32d6bf,_0x4fbd99){var _0x27e2e4=[];return new Promise(function(_0x3ed4ae,_0x5d1553){if(!isNotNull(_0x184932)){_0x32d6bf[_0x23c6('0x62')]=utils[_0x23c6('0x63')][_0x23c6('0x6f')];return _0x5d1553(msgResponse(_0x23c6('0x87'),'Failure',_0x38f3e4+_0x23c6('0x88')));}if(_[_0x23c6('0x42')](_0x184932)){_0x32d6bf[_0x23c6('0x62')]=utils[_0x23c6('0x63')][_0x23c6('0x89')];return _0x5d1553(msgResponse(_0x23c6('0x87'),_0x23c6('0x8a'),_0x38f3e4+'\x20Intervals\x20is\x20empty\x20'));}if(_0x53ebe9&&_[_0x23c6('0x39')](config[_0x23c6('0x8b')][_0x53ebe9])){_0x32d6bf[_0x23c6('0x62')]=utils[_0x23c6('0x63')][_0x23c6('0x8c')];return _0x5d1553(msgResponse(_0x23c6('0x87'),_0x23c6('0x8a'),_0x38f3e4+_0x23c6('0x8d')+_0x53ebe9));}if(_[_0x23c6('0x8e')](_0x184932)){for(var _0x33048e=0x0;_0x33048e<_0x184932[_0x23c6('0x8f')];_0x33048e+=0x1){_0x27e2e4[_0x23c6('0x90')](ami[_0x23c6('0x91')]({'action':_0x23c6('0x92'),'command':util[_0x23c6('0x3e')](_0x23c6('0x93'),_0x184932[_0x33048e][_0x23c6('0x94')],!_['isUndefined'](config[_0x23c6('0x8b')][_0x53ebe9])?_0x53ebe9:'')})[_0x23c6('0x95')](function(_0x54d2d7){return _0x54d2d7['content']['indexOf'](_0x23c6('0x96'))>=0x0;})[_0x23c6('0x97')](myreject(_0x5d1553)));}}else{_0x27e2e4[_0x23c6('0x90')](ami[_0x23c6('0x91')]({'action':_0x23c6('0x92'),'command':util[_0x23c6('0x3e')]('iftime\x20%s,%s',_0x184932,!_[_0x23c6('0x39')](config[_0x23c6('0x8b')][_0x53ebe9])?_0x53ebe9:'')})[_0x23c6('0x95')](function(_0x510785){return _0x510785[_0x23c6('0x98')]['indexOf'](_0x23c6('0x96'))>=0x0;})[_0x23c6('0x97')](myreject(_0x5d1553)));}Promise['all'](_0x27e2e4)['then'](function(_0x426f02){var _0x109ad2=_[_0x23c6('0x99')](_0x426f02);if(_0x109ad2){return _0x3ed4ae(_0x109ad2);}else{_0x32d6bf[_0x23c6('0x62')]=_0x4fbd99?utils[_0x23c6('0x63')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x23c6('0x63')][_0x23c6('0x9a')];return _0x5d1553(msgResponse(_0x23c6('0x9b'),_0x23c6('0x8a'),_0x23c6('0x9c')+_0x4fbd99+'\x20'+_0x38f3e4+_0x23c6('0x9d')+util[_0x23c6('0x3d')](_0x184932,{'showHidden':![],'depth':null})+_0x23c6('0x9e')+_0x53ebe9));}})[_0x23c6('0x97')](function(_0x29cc99){return _0x5d1553(msgResponse(_0x23c6('0x87'),_0x23c6('0x8a'),JSON[_0x23c6('0x6d')](_0x29cc99)));});});};Dialer[_0x23c6('0x17')][_0x23c6('0x9f')]=function(){var _0x4349cf=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x23c6('0x95')](function(){setInterval(function(){_0x4349cf[_0x23c6('0xa0')]();},0x3e8);});};Dialer[_0x23c6('0x17')][_0x23c6('0xa0')]=function(){var _0x3d0cc0=this;var _0x1973cb;for(var _0x49ca0e in this[_0x23c6('0x1d')]){if(typeof this[_0x23c6('0x1d')][_0x49ca0e]!==_0x23c6('0xa1')){_0x1973cb=this['campaigns'][_0x49ca0e];if(utils[_0x23c6('0x74')](_0x1973cb)&&utils[_0x23c6('0xa2')](_0x1973cb)){_0x1973cb[_0x23c6('0x77')]=!![];Promise['resolve']()[_0x23c6('0x95')](checkIsIVRCampaignActive(_0x1973cb))[_0x23c6('0x95')](checkInterval(_0x1973cb))[_0x23c6('0x95')](_0x3d0cc0['checkIsTrunkReachable'](_0x1973cb))[_0x23c6('0x95')](_0x3d0cc0[_0x23c6('0x85')](_0x1973cb[_0x23c6('0xa3')],_0x1973cb[_0x23c6('0xa4')],_0x1973cb['name'],_0x1973cb))[_0x23c6('0x95')](_0x3d0cc0['checkIfTimeIntervals'](_0x1973cb[_0x23c6('0x72')],_0x1973cb[_0x23c6('0xa4')],_0x1973cb[_0x23c6('0x40')],_0x1973cb))[_0x23c6('0x95')](_0x3d0cc0['launchHandleIvr'](_0x1973cb))[_0x23c6('0x97')](loggerCatchQueueSummary(_0x23c6('0xa5'),_0x1973cb));}else{notSendMessagesCampaign(_0x1973cb);}}}};Dialer['prototype'][_0x23c6('0xa6')]=function(_0x898710){if(_0x898710[_0x23c6('0xa7')]!=='predictive'){clearPredictiveAttributes(_0x898710);}switch(_0x898710['dialMethod']){case'progressive':this['handlePower'](_0x898710,0x1);break;case _0x23c6('0xa8'):this[_0x23c6('0xa9')](_0x898710,_0x898710[_0x23c6('0xaa')]);break;case'predictive':this['predictive'](_0x898710);break;case _0x23c6('0x8'):this[_0x23c6('0xa9')](_0x898710,0x1);break;default:logger[_0x23c6('0x5f')](_0x23c6('0xab'),_0x898710[_0x23c6('0x40')],_0x23c6('0xac'));}};Dialer[_0x23c6('0x17')][_0x23c6('0x87')]=function(_0x4d590b,_0xb43c6e){var _0x1adfd7=_0x4d590b[_0x23c6('0xa4')];var _0x430dc0=_0xb43c6e?_0x4d590b['dialGlobalInterval']:_0x4d590b['Interval'][_0x23c6('0x71')];logger['silly'](_0x23c6('0xad'),_0x430dc0,_0x1adfd7,_0x4d590b[_0x23c6('0x40')],util[_0x23c6('0x3e')]('Voice\x20Queue\x20%s\x20$s',_0x4d590b[_0x23c6('0x40')],_0x4d590b['id']));var _0x55fa7a=null;return Interval[_0x23c6('0xae')](_0x430dc0,_0x1adfd7)[_0x23c6('0x95')](function(_0x4d586b){if(_0x4d586b===!![]){return _0x4d586b;}else{_0x4d590b['message']=_0xb43c6e?utils[_0x23c6('0x63')][_0x23c6('0xaf')]:utils[_0x23c6('0x63')][_0x23c6('0x9a')];_0x55fa7a=msgResponse(_0x23c6('0x9b'),_0x23c6('0x8a'),'Global:\x20'+_0xb43c6e+'\x20'+_0x4d590b[_0x23c6('0x40')]+_0x23c6('0x9d')+util[_0x23c6('0x3d')](_0x430dc0,{'showHidden':![],'depth':null})+_0x23c6('0x9e')+_0x1adfd7);}if(_0x55fa7a!==null){logger[_0x23c6('0xb0')](_0x23c6('0xb1'),_0x55fa7a);_0x55fa7a[_0x23c6('0xb2')]=_0xb43c6e;throw _0x55fa7a;}})[_0x23c6('0x97')](function(_0x43bc18){logger[_0x23c6('0x5f')]('AMI\x20IfTime',_0x43bc18);throw msgResponse(_0x23c6('0xb3'),_0x23c6('0x7c'),util[_0x23c6('0x3d')](_0x43bc18,{'showHidden':![],'depth':null}));});};Dialer[_0x23c6('0x17')]['syncAgentConnect']=function(_0x2e1b02){if(this['voiceQueues'][_0x2e1b02[_0x23c6('0xb4')]]){if(this['uniqueId'][_0x2e1b02[_0x23c6('0xb5')]]&&this[_0x23c6('0x23')][_0x2e1b02['uniqueid']][_0x23c6('0x3b')]!==_0x23c6('0xb6')){utils['decrementOriginate'](this[_0x23c6('0x1c')][_0x2e1b02[_0x23c6('0xb4')]],_0x23c6('0xb7'));this[_0x23c6('0x23')][_0x2e1b02[_0x23c6('0xb5')]][_0x23c6('0xb8')]=moment()[_0x23c6('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x23c6('0x17')]['syncAgentComplete']=function(_0x324a05){var _0x27e236=this[_0x23c6('0x23')][_0x324a05[_0x23c6('0xb5')]];if(this['voiceQueues'][_0x324a05[_0x23c6('0xb4')]]){if(_0x27e236&&_0x27e236[_0x23c6('0x3b')]!==_0x23c6('0xb6')){delete this[_0x23c6('0x23')][_0x324a05[_0x23c6('0xb5')]];this['voiceQueues'][_0x324a05[_0x23c6('0xb4')]][_0x23c6('0xb9')]+=0x1;var _0x34fd5f=new AgentComplete(_0x27e236,_0x324a05);if(_0x324a05[_0x23c6('0xba')]===_0x23c6('0xbb')){_0x34fd5f[_0x23c6('0xbc')]=this[_0x23c6('0x1c')][_0x324a05[_0x23c6('0xb4')]]['dialQueueProject2']&&this[_0x23c6('0x1c')][_0x324a05[_0x23c6('0xb4')]][_0x23c6('0xbd')]?moment()[_0x23c6('0x3e')](_0x23c6('0xbe')):undefined;}hopperUtils[_0x23c6('0xbf')](_0x34fd5f)[_0x23c6('0x97')](loggerCatch(_0x23c6('0xc0')));hopperUtils['moveContactManagedDialer'](_0x34fd5f)['catch'](loggerCatch(_0x23c6('0xc1')));}}};Dialer[_0x23c6('0x17')][_0x23c6('0xc2')]=function(_0x7aa758){var _0x2e88f1=this[_0x23c6('0x23')][_0x7aa758[_0x23c6('0xb5')]];var _0x401582=this;var _0x414add=![];var _0x12c838;var _0x2b7409;if(this[_0x23c6('0x1c')][_0x7aa758[_0x23c6('0xb4')]]){if(_0x2e88f1&&_0x2e88f1[_0x23c6('0x3b')]!==_0x23c6('0xb6')){delete this['uniqueId'][_0x7aa758[_0x23c6('0xb5')]];utils[_0x23c6('0xc3')](this[_0x23c6('0x1c')][_0x7aa758[_0x23c6('0xb4')]],_0x23c6('0xc4'));_0x2e88f1[_0x23c6('0xc5')]=moment()[_0x23c6('0x3e')](_0x23c6('0xbe'));var _0x1c39b7=new QueueCallerAbandon(_0x2e88f1,_0x7aa758);if(utils[_0x23c6('0xc6')](_0x2e88f1[_0x23c6('0xc5')],_0x2e88f1[_0x23c6('0xc7')])>=_0x2e88f1[_0x23c6('0xc8')]){this['voiceQueues'][_0x7aa758[_0x23c6('0xb4')]][_0x23c6('0x48')]+=0x1;this[_0x23c6('0x1c')][_0x7aa758[_0x23c6('0xb4')]][_0x23c6('0xc9')]+=0x1;this[_0x23c6('0x1c')][_0x7aa758['queue']][_0x23c6('0xca')]+=0x1;_0x1c39b7[_0x23c6('0x69')]=0xa;_0x1c39b7[_0x23c6('0xcb')]=_0x23c6('0xcc');_0x1c39b7[_0x23c6('0xcd')]=_0x23c6('0xce');_0x1c39b7['agiafterat']=this['voiceQueues'][_0x7aa758[_0x23c6('0xb4')]]['dialQueueProject2']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x1c39b7['countdropretry']+=0x1;_0x1c39b7[_0x23c6('0xcf')]+=0x1;_0x12c838=this[_0x23c6('0x1c')][_0x7aa758[_0x23c6('0xb4')]]['dialDropRetryFrequency'];_0x2b7409=this[_0x23c6('0x1c')][_0x7aa758['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0x23c6('0xd0')](_0x1c39b7,_0x1c39b7[_0x23c6('0x69')],_0x2e88f1[_0x23c6('0xd1')])[_0x23c6('0x95')](function(_0x105726){_0x414add=_0x105726[_0x23c6('0xd2')]==0x1;if(_0x1c39b7[_0x23c6('0xd3')]>=_0x401582['voiceQueues'][_0x7aa758[_0x23c6('0xb4')]][_0x23c6('0xd4')]){_0x401582[_0x23c6('0xd5')](_0x1c39b7,_0x105726[_0x23c6('0xd2')]);}else{hopperUtils[_0x23c6('0xd6')]({'active':![],'countdropretry':_0x1c39b7[_0x23c6('0xd3')],'scheduledat':moment()[_0x23c6('0xd7')](_0x401582[_0x23c6('0x1c')][_0x7aa758[_0x23c6('0xb4')]][_0x23c6('0xd8')],_0x23c6('0xd9'))[_0x23c6('0x3e')](_0x23c6('0xbe')),'ContactId':_0x2e88f1[_0x23c6('0xda')],'ListId':_0x2e88f1[_0x23c6('0xdb')],'VoiceQueueId':_0x2e88f1[_0x23c6('0xdc')]||undefined,'CampaignId':_0x2e88f1[_0x23c6('0xdd')]||undefined})[_0x23c6('0x97')](loggerCatch('[rescheduleContact][Drop]'));var _0x1895f2=new History(_0x1c39b7);_0x1895f2['state']=0xa;_0x1895f2['statedesc']=_0x23c6('0xcc');_0x1895f2[_0x23c6('0xde')]=moment()[_0x23c6('0x3e')](_0x23c6('0xbe'));_0x1895f2[_0x23c6('0x6a')]=_0x1895f2[_0x23c6('0xde')];_0x1895f2[_0x23c6('0xdf')]=_0x1c39b7[_0x23c6('0xdf')];_0x1895f2[_0x23c6('0xe0')]=_0x1c39b7[_0x23c6('0xe0')];hopperUtils[_0x23c6('0xbf')](_0x1895f2)[_0x23c6('0x97')](loggerCatch(_0x23c6('0xe1')));}})['then'](function(){if(_0x414add)hopperUtils[_0x23c6('0xe2')](_0x1c39b7,_0x12c838,_0x2b7409)[_0x23c6('0x95')](function(){return 0x1;});});}else{this[_0x23c6('0x1c')][_0x7aa758[_0x23c6('0xb4')]][_0x23c6('0x4a')]+=0x1;this[_0x23c6('0x1c')][_0x7aa758[_0x23c6('0xb4')]][_0x23c6('0xe3')]+=0x1;_0x1c39b7[_0x23c6('0x69')]=0xb;_0x1c39b7['statedesc']=_0x23c6('0xe4');_0x1c39b7[_0x23c6('0xcd')]=_0x23c6('0xe5');_0x1c39b7[_0x23c6('0xe6')]+=0x1;_0x1c39b7['countglobal']+=0x1;_0x12c838=this[_0x23c6('0x1c')][_0x7aa758[_0x23c6('0xb4')]]['dialAbandonedRetryFrequency'];_0x2b7409=this[_0x23c6('0x1c')][_0x7aa758['queue']][_0x23c6('0xe7')];hopperUtils[_0x23c6('0xd0')](_0x1c39b7,_0x1c39b7[_0x23c6('0x69')],_0x2e88f1['voiceQueue'])[_0x23c6('0x95')](function(_0x219e58){if(_0x1c39b7[_0x23c6('0xe6')]>=_0x401582[_0x23c6('0x1c')][_0x7aa758['queue']][_0x23c6('0xe8')]){_0x401582[_0x23c6('0xd5')](_0x1c39b7,_0x219e58[_0x23c6('0xd2')]);}else{hopperUtils[_0x23c6('0xd6')]({'active':![],'countabandonedretry':_0x1c39b7[_0x23c6('0xe6')],'scheduledat':moment()[_0x23c6('0xd7')](_0x401582[_0x23c6('0x1c')][_0x7aa758[_0x23c6('0xb4')]][_0x23c6('0xe9')],_0x23c6('0xd9'))['format'](_0x23c6('0xbe')),'ContactId':_0x2e88f1[_0x23c6('0xda')],'ListId':_0x2e88f1[_0x23c6('0xdb')],'VoiceQueueId':_0x2e88f1[_0x23c6('0xdc')]||undefined,'CampaignId':_0x2e88f1['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x4b3e7a=new History(_0x1c39b7);_0x4b3e7a[_0x23c6('0x69')]=0xb;_0x4b3e7a[_0x23c6('0xcb')]=_0x23c6('0xe4');_0x4b3e7a[_0x23c6('0xde')]=moment()[_0x23c6('0x3e')](_0x23c6('0xbe'));_0x4b3e7a[_0x23c6('0x6a')]=_0x4b3e7a['starttime'];_0x4b3e7a['calleridname']=_0x1c39b7[_0x23c6('0xdf')];_0x4b3e7a[_0x23c6('0xe0')]=_0x1c39b7[_0x23c6('0xe0')];hopperUtils['createHistory'](_0x4b3e7a)[_0x23c6('0x97')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})['then'](function(){if(_0x414add)hopperUtils[_0x23c6('0xe2')](_0x1c39b7,_0x12c838,_0x2b7409)[_0x23c6('0x95')](function(){return 0x1;});});}}}};Dialer['prototype']['syncNewExten']=function(_0x76df7){if(this[_0x23c6('0xea')][_0x76df7[_0x23c6('0xb5')]]){this[_0x23c6('0xea')][_0x76df7[_0x23c6('0xb5')]][_0x23c6('0xeb')]=_0x76df7[_0x23c6('0xeb')];}if(this[_0x23c6('0x23')][_0x76df7[_0x23c6('0xb5')]]){this[_0x23c6('0x23')][_0x76df7[_0x23c6('0xb5')]]['channel']=_0x76df7['channel'];}};Dialer[_0x23c6('0x17')][_0x23c6('0xec')]=function(_0x458451){if(!this[_0x23c6('0xea')][_0x458451[_0x23c6('0xed')]]){return;}var _0x46b3a0=this[_0x23c6('0x1c')][this[_0x23c6('0xea')][_0x458451['actionid']][_0x23c6('0xb4')]]['strategy']||_0x23c6('0xee');if(_0x46b3a0===_0x23c6('0xef')){if(this['actions'][_0x458451[_0x23c6('0xed')]]&&_[_0x23c6('0xf0')](this[_0x23c6('0xea')][_0x458451['actionid']][_0x23c6('0xf1')])&&_0x458451[_0x23c6('0x7f')]==='1'&&_0x458451[_0x23c6('0xf2')]==='0'){if(this['agents'][_0x458451[_0x23c6('0xf3')]]){if(!this['agents'][_0x458451['stateinterface']][_0x23c6('0xf1')]){this['agents'][_0x458451['stateinterface']][_0x23c6('0xf1')]=!![];this[_0x23c6('0xea')][_0x458451[_0x23c6('0xed')]][_0x23c6('0xf1')]=!![];this[_0x23c6('0xea')][_0x458451[_0x23c6('0xed')]][_0x23c6('0xf3')]=_0x458451[_0x23c6('0xf3')];}}}}else if(_0x46b3a0==='rrmemory'){if(this[_0x23c6('0xea')][_0x458451[_0x23c6('0xed')]]){if(this[_0x23c6('0x1e')][_0x458451[_0x23c6('0xf3')]]){this['actions'][_0x458451[_0x23c6('0xed')]][_0x23c6('0xf3')]=_0x458451[_0x23c6('0xf3')];if(_[_0x23c6('0xf0')](this['queueBooked'][this[_0x23c6('0xea')][_0x458451[_0x23c6('0xed')]][_0x23c6('0xb4')]])){this[_0x23c6('0xf4')][this[_0x23c6('0xea')][_0x458451[_0x23c6('0xed')]]['queue']]=[];}this[_0x23c6('0xf4')][this[_0x23c6('0xea')][_0x458451[_0x23c6('0xed')]][_0x23c6('0xb4')]][_0x23c6('0x90')](_[_0x23c6('0x5b')](_[_0x23c6('0x6e')](this['actions'][_0x458451[_0x23c6('0xed')]],[_0x23c6('0xf5'),'stateinterface']),{'status':_0x458451[_0x23c6('0x7f')],'paused':_0x458451['paused']}));}}}};Dialer[_0x23c6('0x17')][_0x23c6('0x36')]=function(_0x2e00a7){if(!this[_0x23c6('0xea')][_0x2e00a7[_0x23c6('0xed')]]){return;}var _0x2cf02e=this;var _0x21de88=this[_0x23c6('0x1c')][this[_0x23c6('0xea')][_0x2e00a7['actionid']][_0x23c6('0xb4')]];var _0x492e50=_0x21de88['strategy']||_0x23c6('0xee');if(_0x492e50===_0x23c6('0xef')){if(this['actions'][_0x2e00a7[_0x23c6('0xed')]]&&this[_0x23c6('0xea')][_0x2e00a7[_0x23c6('0xed')]][_0x23c6('0xf3')]){this[_0x23c6('0x1b')]['run'](this[_0x23c6('0xea')][_0x2e00a7['actionid']][_0x23c6('0xf5')],this[_0x23c6('0xea')][_0x2e00a7[_0x23c6('0xed')]][_0x23c6('0xf3')])[_0x23c6('0x97')](function(_0x534c83){logger[_0x23c6('0x5f')](_0x23c6('0xf6'),util['inspect'](_0x534c83,{'showHidden':![],'depth':null}));})[_0x23c6('0x1a')](function(){utils[_0x23c6('0xc3')](_0x2cf02e[_0x23c6('0x1c')][_0x2cf02e['actions'][_0x2e00a7[_0x23c6('0xed')]][_0x23c6('0xb4')]],_0x23c6('0xf7'));_0x2cf02e['agents'][_0x2cf02e[_0x23c6('0xea')][_0x2e00a7[_0x23c6('0xed')]][_0x23c6('0xf3')]][_0x23c6('0xf1')]=![];delete _0x2cf02e[_0x23c6('0xea')][_0x2e00a7[_0x23c6('0xed')]];unlockQueueStatus(_0x21de88);});}else{utils[_0x23c6('0xc3')](this['voiceQueues'][this[_0x23c6('0xea')][_0x2e00a7[_0x23c6('0xed')]][_0x23c6('0xb4')]],_0x23c6('0xf7'));hopperUtils[_0x23c6('0xd6')]({'active':![],'ContactId':this['actions'][_0x2e00a7[_0x23c6('0xed')]][_0x23c6('0xda')],'ListId':this[_0x23c6('0xea')][_0x2e00a7['actionid']]['ListId'],'VoiceQueueId':this['actions'][_0x2e00a7['actionid']][_0x23c6('0xdc')]||undefined,'CampaignId':this[_0x23c6('0xea')][_0x2e00a7[_0x23c6('0xed')]][_0x23c6('0xdd')]||undefined})[_0x23c6('0x97')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x2e00a7['actionid']];unlockQueueStatus(_0x21de88);}}else if(_0x492e50===_0x23c6('0xee')){var _0x15114c;if(this[_0x23c6('0xea')][_0x2e00a7[_0x23c6('0xed')]]&&!_['isEmpty'](this[_0x23c6('0xf4')][this[_0x23c6('0xea')][_0x2e00a7[_0x23c6('0xed')]][_0x23c6('0xb4')]])){if(this[_0x23c6('0xf8')][_0x2cf02e['actions'][_0x2e00a7[_0x23c6('0xed')]]['queue']]){this['queueBookedRR'][_0x2cf02e[_0x23c6('0xea')][_0x2e00a7[_0x23c6('0xed')]]['queue']]=this['queueBookedRR'][this[_0x23c6('0xea')][_0x2e00a7[_0x23c6('0xed')]][_0x23c6('0xb4')]]?this[_0x23c6('0xf8')][this[_0x23c6('0xea')][_0x2e00a7['actionid']]['queue']]:this[_0x23c6('0xf4')][this[_0x23c6('0xea')][_0x2e00a7[_0x23c6('0xed')]]['queue']]?this[_0x23c6('0xf4')][this['actions'][_0x2e00a7[_0x23c6('0xed')]][_0x23c6('0xb4')]]['_rr']||0x0:0x0;}this[_0x23c6('0xf4')][this[_0x23c6('0xea')][_0x2e00a7[_0x23c6('0xed')]][_0x23c6('0xb4')]][_0x23c6('0xf9')]=this[_0x23c6('0xf8')][this['actions'][_0x2e00a7[_0x23c6('0xed')]][_0x23c6('0xb4')]];for(var _0x20acef=0x0;_0x20acef=_0x43a5d3['dialGlobalMaxRetry']){_0x4c5d93['stateGlobal'](_0x317cd8,_0x167116,_0x5ea807,'reason19\x20machine....');}else{if(_0x317cd8[_0x23c6('0x115')]>=_0x43a5d3[_0x23c6('0x11a')]){_0x4c5d93[_0x23c6('0x11b')](_0x317cd8,_0x167116,_0x5ea807,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x317cd8[_0x23c6('0x115')],'scheduledat':moment()['add'](_0x43a5d3[_0x23c6('0x11c')],_0x23c6('0xd9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x317cd8['ContactId'],'ListId':_0x317cd8[_0x23c6('0xdb')],'VoiceQueueId':_0x317cd8[_0x23c6('0xdc')]||undefined,'CampaignId':_0x317cd8[_0x23c6('0xdd')]||undefined})[_0x23c6('0x97')](loggerCatch(_0x23c6('0x11d')));_0x167116({'reschedule':0x1});}}});}if(_0x30c23d['type']==='ivr'&&this[_0x23c6('0x1d')][_0x30c23d['queue']][_0x23c6('0x109')]&&_0x4295b4[_0x23c6('0x10a')]===_0x23c6('0x11e')){delete this[_0x23c6('0x23')][_0x4295b4[_0x23c6('0xb5')]];utils[_0x23c6('0xc3')](this['campaigns'][_0x30c23d[_0x23c6('0xb4')]],'[syncVarSet]');_0x3e6ef5=new Hangup(_0x30c23d,_0x4295b4);_0x3e6ef5[_0x23c6('0x69')]=0x12;_0x3e6ef5[_0x23c6('0xcb')]='HangupInAMD';_0x3e6ef5[_0x23c6('0x10e')]=_0x23c6('0x10f');ami['emit'](_0x23c6('0x110'),ut[_0x23c6('0x116')](_0x3e6ef5,_0x23c6('0x111')));this[_0x23c6('0x11f')](_0x3e6ef5,_0x23c6('0x120'),_0x23c6('0x121'));}if(_0x30c23d[_0x23c6('0x3b')]===_0x23c6('0xb6')&&this['campaigns'][_0x30c23d[_0x23c6('0xb4')]][_0x23c6('0x109')]&&_0x4295b4[_0x23c6('0x10a')]===_0x23c6('0x113')){return new Promise(function(_0x106d9a,_0x918d1d){delete _0x4c5d93[_0x23c6('0x23')][_0x4295b4[_0x23c6('0xb5')]];utils[_0x23c6('0xc3')](_0x4c5d93[_0x23c6('0x1d')][_0x30c23d['queue']],_0x23c6('0x10b'));_0x4c5d93['campaigns'][_0x30c23d['queue']][_0x23c6('0xb9')]+=0x1;_0x4c5d93[_0x23c6('0x1d')][_0x30c23d['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x2888fc=_0x4c5d93[_0x23c6('0x1d')][_0x30c23d[_0x23c6('0xb4')]];var _0x42ebac=new Hangup(_0x30c23d,_0x4295b4);_0x42ebac[_0x23c6('0x69')]=0x13;_0x42ebac[_0x23c6('0xcb')]=_0x23c6('0x114');_0x42ebac[_0x23c6('0x10e')]=_0x23c6('0x10f');_0x42ebac['countmachineretry']+=0x1;_0x42ebac[_0x23c6('0xcf')]+=0x1;_0x42ebac[_0x23c6('0x111')]=!![];ami[_0x23c6('0x3a')]('custom:amd',ut[_0x23c6('0x116')](_0x42ebac,'amd'));hopperUtils[_0x23c6('0xbf')](_0x42ebac)['catch'](loggerCatch(_0x23c6('0x122')));if(_0x42ebac[_0x23c6('0x117')]+_0x42ebac['countcongestionretry']+_0x42ebac[_0x23c6('0x123')]+_0x42ebac['countnosuchnumberretry']+_0x42ebac[_0x23c6('0xd3')]+_0x42ebac[_0x23c6('0xe6')]+_0x42ebac[_0x23c6('0x115')]+_0x42ebac[_0x23c6('0x124')]>=_0x2888fc[_0x23c6('0x125')]){_0x4c5d93[_0x23c6('0x126')](_0x42ebac,_0x106d9a,_0x918d1d,'reason19\x20machine....');}else{if(_0x42ebac[_0x23c6('0x115')]>=_0x2888fc[_0x23c6('0x11a')]){_0x4c5d93[_0x23c6('0x11b')](_0x42ebac,_0x106d9a,_0x918d1d,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x42ebac[_0x23c6('0x115')],'scheduledat':moment()[_0x23c6('0xd7')](_0x2888fc[_0x23c6('0x11c')],'minutes')[_0x23c6('0x3e')](_0x23c6('0xbe')),'ContactId':_0x42ebac[_0x23c6('0xda')],'ListId':_0x42ebac['ListId'],'VoiceQueueId':_0x42ebac['VoiceQueueId']||undefined,'CampaignId':_0x42ebac[_0x23c6('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x106d9a({'reschedule':0x1});}}});}}};Dialer[_0x23c6('0x17')][_0x23c6('0x127')]=function(_0x3d263a){var _0x34938b=this[_0x23c6('0x23')][_0x3d263a[_0x23c6('0xb5')]];var _0x1a8648;if(!_0x34938b){return;}if(_0x34938b['type']==='ivr'){delete this[_0x23c6('0x23')][_0x3d263a[_0x23c6('0xb5')]];utils[_0x23c6('0xc3')](this[_0x23c6('0x1d')][_0x34938b[_0x23c6('0xb4')]],'[syncHangup]');this[_0x23c6('0x1d')][_0x34938b[_0x23c6('0xb4')]]['ivrAnswerCallsDay']+=0x1;if(_0x3d263a[_0x23c6('0x128')]===_0x23c6('0x129')){const _0xc0d975=new AgentComplete(_0x34938b,_0x3d263a);_0xc0d975[_0x23c6('0xdd')]=this['campaigns'][_0x34938b[_0x23c6('0xb4')]]['id'];hopperUtils[_0x23c6('0xbf')](_0xc0d975)['catch'](loggerCatch(_0x23c6('0x12a')));hopperUtils[_0x23c6('0x12b')](_0xc0d975)[_0x23c6('0x97')](loggerCatch(_0x23c6('0x12c')));}else{_0x1a8648=new Hangup(_0x34938b,_0x3d263a);hopperUtils[_0x23c6('0xbf')](_0x1a8648)[_0x23c6('0x97')](loggerCatch(_0x23c6('0x12d')));hopperUtils['moveContactManagedDialer'](_0x1a8648)[_0x23c6('0x97')](loggerCatch(_0x23c6('0x12e')));}}else{if(isNotNull(this['voiceQueues'][_0x34938b[_0x23c6('0xb4')]][_0x23c6('0x12f')])){delete this[_0x23c6('0x23')][_0x3d263a[_0x23c6('0xb5')]];utils[_0x23c6('0xc3')](this['voiceQueues'][_0x34938b[_0x23c6('0xb4')]],_0x23c6('0x130'));this['voiceQueues'][_0x34938b[_0x23c6('0xb4')]][_0x23c6('0xb9')]+=0x1;this[_0x23c6('0x1c')][_0x34938b[_0x23c6('0xb4')]][_0x23c6('0x10c')]+=0x1;_0x1a8648=new Hangup(_0x34938b,_0x3d263a);_0x1a8648[_0x23c6('0x69')]=0x10;_0x1a8648[_0x23c6('0xcb')]='AnswerAGI';_0x1a8648[_0x23c6('0x10e')]=_0x23c6('0x131');hopperUtils['createHistory'](_0x1a8648)[_0x23c6('0x97')](loggerCatch(_0x23c6('0x12d')));hopperUtils['moveContactManagedDialer'](_0x1a8648)[_0x23c6('0x97')](loggerCatch(_0x23c6('0x12e')));}else{delete this[_0x23c6('0x23')][_0x3d263a[_0x23c6('0xb5')]];utils[_0x23c6('0xc3')](this[_0x23c6('0x1c')][_0x34938b[_0x23c6('0xb4')]],'[syncHangup2]');if(_0x3d263a[_0x23c6('0x128')]===_0x23c6('0x129')){this[_0x23c6('0x1c')][_0x34938b[_0x23c6('0xb4')]][_0x23c6('0xb9')]+=0x1;const _0x4c1756=new AgentComplete(_0x34938b,_0x3d263a);_0x4c1756[_0x23c6('0xdc')]=this[_0x23c6('0x1c')][_0x34938b['queue']]['id'];hopperUtils[_0x23c6('0xbf')](_0x4c1756)[_0x23c6('0x97')](loggerCatch(_0x23c6('0xc0')));hopperUtils['moveContactManagedDialer'](_0x4c1756)[_0x23c6('0x97')](loggerCatch(_0x23c6('0xc1')));}else{this['voiceQueues'][_0x34938b[_0x23c6('0xb4')]][_0x23c6('0x132')]+=0x1;_0x1a8648=new Hangup(_0x34938b,_0x3d263a);_0x1a8648[_0x23c6('0x69')]=0xc;_0x1a8648[_0x23c6('0xcb')]=_0x3d263a['cause-txt'];_0x1a8648[_0x23c6('0x10e')]=_0x23c6('0x133');hopperUtils[_0x23c6('0xbf')](_0x1a8648)[_0x23c6('0x97')](loggerCatch(_0x23c6('0x134')));hopperUtils['moveContactManagedDialer'](_0x1a8648)[_0x23c6('0x97')](loggerCatch(_0x23c6('0x130')));}}}};Dialer[_0x23c6('0x17')]['syncQueueSummary']=function(_0x20ff14){var _0x1ff591=this;if(!_0x1ff591[_0x23c6('0x135')][_0x20ff14[_0x23c6('0x40')]]){_0x1ff591['queuesSummary'][_0x20ff14['name']]={'running':![]};}else if(_0x1ff591[_0x23c6('0x135')][_0x20ff14['name']][_0x23c6('0x136')]===!![]){return;}else if(_0x1ff591[_0x23c6('0x135')][_0x20ff14[_0x23c6('0x40')]][_0x23c6('0x136')]===![]){_0x1ff591[_0x23c6('0x135')][_0x20ff14[_0x23c6('0x40')]][_0x23c6('0x136')]=!![];}var _0x435200=_0x1ff591['voiceQueues'][_0x20ff14[_0x23c6('0x40')]];var _0x293093=_0x435200[_0x23c6('0x62')]!==utils[_0x23c6('0x63')][_0x23c6('0x73')];var _0x2ead32=utils[_0x23c6('0x137')](_0x435200);_0x435200[_0x23c6('0x138')]=utils[_0x23c6('0x139')](_0x435200,_0x1ff591[_0x23c6('0x1f')]);Promise[_0x23c6('0x13a')]()[_0x23c6('0x95')](function(){if(_0x435200[_0x23c6('0x138')]===utils[_0x23c6('0x63')][_0x23c6('0x73')]){if(_0x293093){clearPredictiveAttributes(_0x435200);_0x20ff14[_0x23c6('0x25')]=undefined;_0x20ff14[_0x23c6('0x26')]=undefined;}if(_0x435200['statusMessage']===utils[_0x23c6('0x63')]['INACTIVE']){_0x20ff14[_0x23c6('0x13b')]=0x0;_0x20ff14[_0x23c6('0xf2')]=0x0;_0x20ff14[_0x23c6('0x13c')]=0x0;_0x20ff14['talking']=0x0;_0x20ff14[_0x23c6('0x13d')]=0x0;}}else if(_0x435200[_0x23c6('0x138')]===utils['CAMPAIGN_STATUS'][_0x23c6('0x13e')]&&!_0x2ead32){return _0x1ff591[_0x23c6('0x87')](_0x435200,!![])[_0x23c6('0x95')](function(){return _0x1ff591[_0x23c6('0x87')](_0x435200,![]);})['then'](function(){return _0x1ff591[_0x23c6('0xa6')](_0x435200);})[_0x23c6('0x97')](function(_0x3bfe10){loggerSyncQueueSummary['debug']('[syncQueueSummary]',util[_0x23c6('0x3d')](_0x3bfe10,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x435200);});}else{clearPredictiveAttributes(_0x435200);}})[_0x23c6('0x95')](function(){var _0x5a1127=_0x20ff14['compareToOutboundQueue'](_0x435200);if(_0x5a1127||_0x435200[_0x23c6('0x13f')]){_0x435200[_0x23c6('0x13f')]=![];_0x20ff14[_0x23c6('0x140')](_0x435200);Object['assign'](_0x435200,_0x20ff14);emitOutboundVoiceQueueSummary(_0x20ff14);}_0x1ff591[_0x23c6('0x135')][_0x435200[_0x23c6('0x40')]][_0x23c6('0x136')]=![];})[_0x23c6('0x97')](function(_0x574962){logger[_0x23c6('0x5f')](_0x23c6('0x141'),util[_0x23c6('0x3d')](_0x574962,{'showHidden':![],'depth':null}));_0x1ff591[_0x23c6('0x135')][_0x435200[_0x23c6('0x40')]][_0x23c6('0x136')]=![];});};Dialer[_0x23c6('0x17')][_0x23c6('0x31')]=_['throttle'](function(){var _0x1fba4b=_[_0x23c6('0x142')](this[_0x23c6('0x1c')],function(_0xe6657f){return _0xe6657f[_0x23c6('0x143')];});var _0x18c8d6=_[_0x23c6('0x142')](this['agents'],function(_0x157507){return _0x157507[_0x23c6('0x144')]&&_0x157507[_0x23c6('0x7f')]===_0x23c6('0x80');});if(_0x1fba4b[_0x23c6('0x8f')]>0x0&&_0x18c8d6[_0x23c6('0x8f')]>0x0){return Promise[_0x23c6('0x13a')]()[_0x23c6('0x95')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x1fba4b,'id'),previewRecallmeReminderInterval,_['map'](_0x18c8d6,'id')))[_0x23c6('0x95')](function(_0x57984a){for(var _0x50b135=0x0;_0x50b135<_0x57984a['length'];_0x50b135++){var _0x3d307a=_0x57984a[_0x50b135]['Agent'][_0x23c6('0x40')];if(_0x3d307a)io['to'](util['format'](_0x23c6('0x145'),_0x3d307a))[_0x23c6('0x3a')](_0x23c6('0x146'),{'hopper':_0x57984a[_0x50b135]});}})[_0x23c6('0x97')](function(_0x28c8ae){logger[_0x23c6('0x5f')](_0x23c6('0x147'),_0x28c8ae);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x23c6('0x17')][_0x23c6('0x37')]=function(){var _0x446e00=this;setInterval(function(){_0x446e00[_0x23c6('0x148')](_0x446e00[_0x23c6('0x23')],_0x23c6('0x149'));_0x446e00[_0x23c6('0x148')](_0x446e00[_0x23c6('0xea')],_0x23c6('0x14a'));},0x32c8);};Dialer[_0x23c6('0x17')][_0x23c6('0x148')]=function(_0x2660af,_0xe64cd7){var _0x52c2f9=this;for(var _0x1d76a4 in _0x2660af){if(typeof _0x2660af[_0x1d76a4]!==_0x23c6('0xa1')){this[_0x23c6('0x14b')]['enqueue'](function(){if(!_[_0x23c6('0xf0')](_0x2660af[_0x1d76a4])){return ami[_0x23c6('0x91')]({'action':_0x23c6('0x7f'),'channel':_0x2660af[_0x1d76a4][_0x23c6('0xeb')]})['catch'](function(_0x35ba89){if(_0x35ba89['message']===_0x23c6('0x14c')){setTimeout(function(){if(_0x2660af[_0x1d76a4]&&_0x2660af[_0x1d76a4][_0x23c6('0x3b')]!==_0x23c6('0xb6')){utils[_0x23c6('0xc3')](_0x52c2f9['voiceQueues'][_0x2660af[_0x1d76a4][_0x23c6('0xb4')]],_0x23c6('0x14d'));logger['error'](_0x23c6('0x14e'),_0xe64cd7,_0x1d76a4,_0x2660af[_0x1d76a4][_0x23c6('0xb4')]);delete _0x2660af[_0x1d76a4];}if(_0x2660af[_0x1d76a4]&&_0x2660af[_0x1d76a4]['type']==='ivr'){utils[_0x23c6('0xc3')](_0x52c2f9[_0x23c6('0x1d')][_0x2660af[_0x1d76a4]['queue']],_0x23c6('0x14d'));logger[_0x23c6('0x5f')](_0x23c6('0x14f'),_0xe64cd7,_0x1d76a4,_0x2660af[_0x1d76a4]['queue']);delete _0x2660af[_0x1d76a4];}},0x2328);}});}});}}};Dialer['prototype'][_0x23c6('0x150')]=function(_0x675e36){return Promise[_0x23c6('0x13a')]()['then'](voiceQueueRt[_0x23c6('0x150')](_0x675e36))[_0x23c6('0x97')](loggerCatch(_0x23c6('0x151')));};Dialer[_0x23c6('0x17')][_0x23c6('0x152')]=function(_0x54e783,_0x2a32ad,_0x5c037c){var _0x28933b={'state':0x19,'statedesc':_0x23c6('0x153')};utils[_0x23c6('0xc3')](_0x2a32ad,_0x23c6('0x154')+_0x54e783);this[_0x23c6('0x11f')](_[_0x23c6('0x5b')](_0x28933b,_[_0x23c6('0x6e')](_0x5c037c,['ContactId',_0x23c6('0xdb'),_0x23c6('0x155'),_0x23c6('0xdc'),_0x23c6('0xdd')])),_0x23c6('0x156'),'[emptyContact]');logger[_0x23c6('0x5f')](_0x54e783);};Dialer[_0x23c6('0x17')]['saveInDb']=function(_0x57efd1,_0x59eb7e,_0xd815ff){hopperUtils[_0x23c6('0xbf')](_0x57efd1)[_0x23c6('0x97')](loggerCatch(_0x59eb7e));hopperUtils[_0x23c6('0x12b')](_0x57efd1)['catch'](loggerCatch(_0xd815ff));};Dialer[_0x23c6('0x17')][_0x23c6('0xd5')]=function(_0x1d1051,_0x1b73fe){hopperUtils[_0x23c6('0xbf')](_0x1d1051)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x1b73fe==0x0){hopperUtils[_0x23c6('0x12b')](_0x1d1051)[_0x23c6('0x97')](loggerCatch(_0x23c6('0x157')));}};Dialer[_0x23c6('0x17')][_0x23c6('0x147')]=function(_0x77dde0){return Promise[_0x23c6('0x13a')]()[_0x23c6('0x95')](cmHopper[_0x23c6('0x158')](_0x77dde0['id'],previewRecallmeReminderInterval))[_0x23c6('0x95')](function(_0x429970){for(var _0x3b97a8=0x0;_0x3b97a8<_0x429970[_0x23c6('0x8f')];_0x3b97a8++){var _0x17c6ad=_0x429970[_0x3b97a8][_0x23c6('0x159')]['name'];if(_0x17c6ad)io['to'](util[_0x23c6('0x3e')](_0x23c6('0x145'),_0x17c6ad))[_0x23c6('0x3a')](_0x23c6('0x146'),{'hopper':_0x429970[_0x3b97a8]});}})[_0x23c6('0x97')](function(){});};Dialer['prototype'][_0x23c6('0x15a')]=function(_0x4123f5){var _0x2c70d9=this;return function(){_0x2c70d9[_0x23c6('0x15b')](_0x4123f5);};};Dialer['prototype'][_0x23c6('0x15c')]=function(_0x358d3c,_0x506a44){var _0x1a7c4d=this;var _0x3f31e8=uuid['v4']();this[_0x23c6('0xea')][_0x3f31e8]=new Action(_0x358d3c,_0x506a44,_0x3f31e8);return new Promise(function(_0x521f21,_0x243aa9){if(_[_0x23c6('0x39')](_0x358d3c)&&typeof _0x358d3c!==_0x23c6('0x15d')){return _0x243aa9(msgResponse('originate',_0x23c6('0x8a'),'voiceQueue\x20is\x20undefine'));}if(_[_0x23c6('0x39')](_0x506a44[_0x23c6('0x15e')])||_0x506a44[_0x23c6('0x15e')]===null){return _0x243aa9(msgResponse(_0x23c6('0x15f'),_0x23c6('0x8a'),_0x23c6('0x160')));}var _0xd1764b={'XMD-CALLERID':_0x1a7c4d[_0x23c6('0xea')][_0x3f31e8]['getCaller'](),'XMD-AGI':_0x358d3c[_0x23c6('0x12f')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x358d3c[_0x23c6('0x12f')]):_0x23c6('0x161'),'XMD-AGIAFTER':_0x358d3c['dialQueueProject2']?util[_0x23c6('0x3e')](_0x23c6('0x162'),ipAgi,_0x358d3c[_0x23c6('0x163')]):_0x23c6('0x161'),'XMD-QUEUE':utils[_0x23c6('0x164')](_0x358d3c)?util[_0x23c6('0x3e')](_0x23c6('0x165'),_0x358d3c[_0x23c6('0x40')],_0x358d3c[_0x23c6('0x166')]||'',_0x358d3c['dialAgiAfterHangupAgent']?'c':'',_0x358d3c['dialQueueTimeout']||0x3):_0x23c6('0x161'),'XMD-CONTACTID':_0x506a44['ContactId'],'XMD-CDRTYPE':_0x23c6('0x7'),'CALLERID(all)':_0x1a7c4d[_0x23c6('0xea')][_0x3f31e8][_0x23c6('0x167')](),'XMD-AMD':_0x358d3c['dialAMDActive']?_0x23c6('0x13e'):_0x23c6('0x161'),'XMD-DESTINATION':_0x23c6('0x108')};if(_0x358d3c[_0x23c6('0x109')]){_0xd1764b['XMD-AMDINITIALSILENCE']=_0x358d3c[_0x23c6('0x168')]||0x9c4;_0xd1764b[_0x23c6('0x169')]=_0x358d3c['dialAMDGreeting']||0x5dc;_0xd1764b[_0x23c6('0x16a')]=_0x358d3c[_0x23c6('0x16b')]||0x320;_0xd1764b[_0x23c6('0x16c')]=_0x358d3c['dialAMDTotalAnalysisTime']||0x1388;_0xd1764b[_0x23c6('0x16d')]=_0x358d3c[_0x23c6('0x16e')]||0x64;_0xd1764b[_0x23c6('0x16f')]=_0x358d3c[_0x23c6('0x170')]||0x32;_0xd1764b[_0x23c6('0x171')]=_0x358d3c[_0x23c6('0x172')]||0x3;_0xd1764b[_0x23c6('0x173')]=_0x358d3c[_0x23c6('0x174')]||0x100;_0xd1764b[_0x23c6('0x175')]=_0x358d3c['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x23c6('0x164')](_0x358d3c)){_0xd1764b[_0x23c6('0x176')]=_0x506a44[_0x23c6('0xdc')];}else{_0xd1764b['XMD-CAMPAIGNID']=_0x506a44[_0x23c6('0xdd')];}var _0x5185fa=utils[_0x23c6('0x177')](_0x506a44[_0x23c6('0x178')]);Object[_0x23c6('0x179')](_0xd1764b,_0x5185fa);var _0x5d1efa=_0x1a7c4d[_0x23c6('0x7d')](_0x358d3c['Trunk'])?utils[_0x23c6('0x17a')](_0x358d3c['Trunk']['callerid'],_0x358d3c['dialOriginateCallerIdName'],_0x358d3c[_0x23c6('0x17b')]>0x0?utils[_0x23c6('0x17c')](_0x358d3c[_0x23c6('0x17d')],_0x358d3c['dialRandomLastDigitCallerIdNumber']):_0x358d3c[_0x23c6('0x17d')]):utils[_0x23c6('0x17a')](_['isNil'](_0x358d3c[_0x23c6('0x83')])?_0x358d3c[_0x23c6('0x17e')]['callerid']:_0x358d3c[_0x23c6('0x83')][_0x23c6('0x17f')],_0x358d3c[_0x23c6('0x180')],_0x358d3c['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0x358d3c[_0x23c6('0x17d')],_0x358d3c['dialRandomLastDigitCallerIdNumber']):_0x358d3c[_0x23c6('0x17d')]);if(_0x5d1efa){_0xd1764b[_0x23c6('0x181')]=_0x1a7c4d[_0x23c6('0xea')][_0x3f31e8][_0x23c6('0x182')]=utils[_0x23c6('0x183')](_0x5d1efa);_0xd1764b['XMD-ORIGINATECALLERIDNUM']=_0x506a44['phone'];}_0x358d3c[_0x23c6('0x184')]=_0xd1764b;return ami['Action']({'actionid':_0x3f31e8,'action':_0x23c6('0x15f'),'channel':_0x1a7c4d['isTrunkReachable'](_0x358d3c['Trunk'])?util['format'](_0x23c6('0x185'),_0x358d3c['Trunk']['name'],isNotNull(_0x358d3c[_0x23c6('0x186')])?_0x358d3c[_0x23c6('0x186')]['trim']()||'':'',_0x358d3c[_0x23c6('0x187')]>0x0?_0x506a44['phone'][_0x23c6('0x188')](_0x358d3c['dialCutDigit']):_0x506a44[_0x23c6('0x15e')]):util[_0x23c6('0x3e')](_0x23c6('0x185'),_['isNil'](_0x358d3c[_0x23c6('0x83')])?_0x358d3c[_0x23c6('0x17e')][_0x23c6('0x40')]:_0x358d3c['TrunkBackup']['name'],isNotNull(_0x358d3c[_0x23c6('0x186')])?_0x358d3c['dialPrefix'][_0x23c6('0x189')]()||'':'',_0x358d3c['dialCutDigit']>0x0?_0x506a44['phone'][_0x23c6('0x188')](_0x358d3c[_0x23c6('0x187')]):_0x506a44['phone']),'callerid':_0x5d1efa,'Exten':_0x23c6('0x108'),'Context':_0x23c6('0x18a'),'Priority':'1','variable':_0xd1764b,'timeout':(_0x358d3c['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x3f31e8})[_0x23c6('0x95')](function(_0x939b1d){return _0x521f21(_0x939b1d);})[_0x23c6('0x97')](function(_0x2e93b9){_0x358d3c[_0x23c6('0x18b')]+=0x1;var _0x390322=new History(_0x1a7c4d[_0x23c6('0xea')][_0x3f31e8]);logger[_0x23c6('0x5f')](util[_0x23c6('0x3e')](_0x23c6('0x18c'),JSON[_0x23c6('0x6d')](_0x2e93b9)));_0x390322['state']=0xe;_0x390322[_0x23c6('0xcb')]='OriginateError';_0x390322[_0x23c6('0xde')]=moment()[_0x23c6('0x3e')](_0x23c6('0xbe'));_0x390322['endtime']=_0x390322[_0x23c6('0xde')];hopperUtils[_0x23c6('0xbf')](_0x390322)[_0x23c6('0x97')](loggerCatch(_0x23c6('0x18d')));_0x1a7c4d[_0x23c6('0x12b')](_0x390322)['catch'](loggerCatch(_0x23c6('0x18d')))['finally'](function(){delete _0x1a7c4d[_0x23c6('0xea')][_0x3f31e8];return _0x243aa9(msgResponse(_0x23c6('0x15f'),_0x23c6('0x7c'),_0x23c6('0x18e')));});});});};Dialer[_0x23c6('0x17')]['checkRetriveMax']=function(_0x805766,_0x1ea8f8,_0x8c56f5){var _0x31a940=new History(_0x1ea8f8);if(_0x31a940[_0x23c6('0x117')]+_0x31a940['countcongestionretry']+_0x31a940[_0x23c6('0x123')]+_0x31a940[_0x23c6('0x119')]+_0x31a940[_0x23c6('0xd3')]+_0x31a940[_0x23c6('0xe6')]+_0x31a940[_0x23c6('0x115')]+_0x31a940[_0x23c6('0x124')]>=_0x8c56f5[_0x23c6('0x125')]-0x1){return!![];}switch(_0x805766){case 0x3:if(_0x31a940['countnoanswerretry']>=_0x8c56f5[_0x23c6('0x18f')]-0x1){return!![];}hopperUtils[_0x23c6('0xd6')]({'active':![],'countnoanswerretry':_0x31a940[_0x23c6('0x123')]+=0x1,'scheduledat':moment()[_0x23c6('0xd7')](_0x8c56f5[_0x23c6('0x190')],'minutes')['format'](_0x23c6('0xbe')),'ContactId':_0x31a940[_0x23c6('0xda')],'ListId':_0x31a940[_0x23c6('0xdb')],'VoiceQueueId':_0x31a940[_0x23c6('0xdc')]||undefined,'CampaignId':_0x31a940[_0x23c6('0xdd')]||undefined})[_0x23c6('0x97')](loggerCatch(_0x23c6('0x191')));break;case 0x5:if(_0x31a940['countbusyretry']>=_0x8c56f5[_0x23c6('0x192')]-0x1){return!![];}hopperUtils[_0x23c6('0xd6')]({'active':![],'countbusyretry':_0x31a940['countbusyretry']+=0x1,'scheduledat':moment()[_0x23c6('0xd7')](_0x8c56f5[_0x23c6('0x193')],_0x23c6('0xd9'))[_0x23c6('0x3e')](_0x23c6('0xbe')),'ContactId':_0x31a940['ContactId'],'ListId':_0x31a940['ListId'],'VoiceQueueId':_0x31a940[_0x23c6('0xdc')]||undefined,'CampaignId':_0x31a940[_0x23c6('0xdd')]||undefined})[_0x23c6('0x97')](loggerCatch(_0x23c6('0x194')));break;case 0x8:if(_0x31a940[_0x23c6('0x118')]>=_0x8c56f5[_0x23c6('0x195')]-0x1){return!![];}hopperUtils[_0x23c6('0xd6')]({'active':![],'countcongestionretry':_0x31a940[_0x23c6('0x118')]+=0x1,'scheduledat':moment()['add'](_0x8c56f5['dialCongestionRetryFrequency'],_0x23c6('0xd9'))[_0x23c6('0x3e')](_0x23c6('0xbe')),'ContactId':_0x31a940[_0x23c6('0xda')],'ListId':_0x31a940[_0x23c6('0xdb')],'VoiceQueueId':_0x31a940[_0x23c6('0xdc')]||undefined,'CampaignId':_0x31a940[_0x23c6('0xdd')]||undefined})[_0x23c6('0x97')](loggerCatch(_0x23c6('0x196')));break;case 0x0:if(_0x31a940['countnosuchnumberretry']>=_0x8c56f5[_0x23c6('0x197')]-0x1){return!![];}else{hopperUtils[_0x23c6('0xd6')]({'active':![],'countnosuchnumberretry':_0x31a940[_0x23c6('0x119')]+=0x1,'scheduledat':moment()[_0x23c6('0xd7')](_0x8c56f5[_0x23c6('0x198')],'minutes')[_0x23c6('0x3e')](_0x23c6('0xbe')),'ContactId':_0x31a940[_0x23c6('0xda')],'ListId':_0x31a940[_0x23c6('0xdb')],'VoiceQueueId':_0x31a940[_0x23c6('0xdc')]||undefined,'CampaignId':_0x31a940[_0x23c6('0xdd')]||undefined})[_0x23c6('0x97')](loggerCatch(_0x23c6('0x199')));}break;case 0xa:if(_0x31a940[_0x23c6('0xd3')]>=_0x8c56f5['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x23c6('0xd6')]({'active':![],'countdropretry':_0x31a940['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x8c56f5[_0x23c6('0xd8')],_0x23c6('0xd9'))[_0x23c6('0x3e')](_0x23c6('0xbe')),'ContactId':_0x31a940[_0x23c6('0xda')],'ListId':_0x31a940[_0x23c6('0xdb')],'VoiceQueueId':_0x31a940[_0x23c6('0xdc')]||undefined,'CampaignId':_0x31a940['CampaignId']||undefined})[_0x23c6('0x97')](loggerCatch(_0x23c6('0x19a')));break;case 0xb:if(_0x31a940[_0x23c6('0xe6')]>=_0x8c56f5[_0x23c6('0xe8')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x31a940[_0x23c6('0xe6')]+=0x1,'scheduledat':moment()[_0x23c6('0xd7')](_0x8c56f5[_0x23c6('0xe9')],_0x23c6('0xd9'))[_0x23c6('0x3e')](_0x23c6('0xbe')),'ContactId':_0x31a940[_0x23c6('0xda')],'ListId':_0x31a940[_0x23c6('0xdb')],'VoiceQueueId':_0x31a940['VoiceQueueId']||undefined,'CampaignId':_0x31a940[_0x23c6('0xdd')]||undefined})['catch'](loggerCatch(_0x23c6('0x19b')));break;case 0x13:if(_0x31a940['countmachineretry']>=_0x8c56f5[_0x23c6('0x11a')]-0x1){return!![];}hopperUtils[_0x23c6('0xd6')]({'active':![],'countmachineretry':_0x31a940[_0x23c6('0x115')]+=0x1,'scheduledat':moment()[_0x23c6('0xd7')](_0x8c56f5[_0x23c6('0x11c')],_0x23c6('0xd9'))[_0x23c6('0x3e')](_0x23c6('0xbe')),'ContactId':_0x31a940[_0x23c6('0xda')],'ListId':_0x31a940[_0x23c6('0xdb')],'VoiceQueueId':_0x31a940[_0x23c6('0xdc')]||undefined,'CampaignId':_0x31a940['CampaignId']||undefined})[_0x23c6('0x97')](loggerCatch(_0x23c6('0x11d')));break;case 0x14:if(_0x31a940[_0x23c6('0x124')]>=_0x8c56f5[_0x23c6('0x19c')]-0x1){return!![];}hopperUtils[_0x23c6('0xd6')]({'active':![],'countagentrejectretry':_0x31a940[_0x23c6('0x124')]+=0x1,'scheduledat':moment()[_0x23c6('0xd7')](_0x8c56f5['dialAgentRejectRetryFrequency'],_0x23c6('0xd9'))[_0x23c6('0x3e')](_0x23c6('0xbe')),'ContactId':_0x31a940['ContactId'],'ListId':_0x31a940[_0x23c6('0xdb')],'VoiceQueueId':_0x31a940[_0x23c6('0xdc')]||undefined,'CampaignId':_0x31a940['CampaignId']||undefined})[_0x23c6('0x97')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x23c6('0x17')]['callProgressDetecting']=function(_0x2b7a32,_0x2fd5b2,_0x987b2c){var _0x3853e9=this;var _0x3522f5=new History(_0x2b7a32);var _0xbd701e=![];var _0x212d87;var _0x4365c6;return new Promise(function(_0x333bdc,_0x11003f){if(_[_0x23c6('0x39')](_0x2fd5b2)&&typeof _0x2fd5b2!==_0x23c6('0x15d')){return _0x11003f(msgResponse(_0x23c6('0x19d'),_0x23c6('0x8a'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x987b2c)&&typeof _0x987b2c!==_0x23c6('0x15d')){return _0x11003f(msgResponse(_0x23c6('0x19d'),_0x23c6('0x8a'),_0x23c6('0x19e')));}hopperUtils[_0x23c6('0xd0')](_0x3522f5,_0x987b2c[_0x23c6('0xba')],_0x2fd5b2)[_0x23c6('0x95')](function(_0x490ae3){if(_0x490ae3['additional']==0x1)_0xbd701e=!![];switch(_0x987b2c[_0x23c6('0xba')]){case'0':_0x2fd5b2[_0x23c6('0x19f')]+=0x1;_0x3522f5[_0x23c6('0x69')]=0x0;_0x3522f5['statedesc']=_0x23c6('0x1a0');_0x3522f5[_0x23c6('0x119')]+=0x1;_0x3522f5[_0x23c6('0xcf')]+=0x1;ami[_0x23c6('0x3a')]('custom:agentnosuchnumber',ut[_0x23c6('0x116')](_0x2b7a32,_0x23c6('0x1a1')));_0x212d87=_0x2fd5b2[_0x23c6('0x198')];_0x4365c6=_0x2fd5b2[_0x23c6('0xe7')];hopperUtils['createHistory'](_0x3522f5)['catch'](loggerCatch(_0x23c6('0x122')));if(_0x3853e9[_0x23c6('0x1a2')](0x0,_0x2b7a32,_0x2fd5b2)&&!_0xbd701e){if(_0x3522f5[_0x23c6('0x119')]>=_0x2fd5b2[_0x23c6('0x197')]){_0x3853e9['createStateFinal'](_0x3522f5,_0x333bdc,_0x11003f,_0x23c6('0x1a3'));}else{_0x3853e9[_0x23c6('0x126')](_0x3522f5,_0x333bdc,_0x11003f,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x2fd5b2[_0x23c6('0x1a4')]+=0x1;_0x3522f5[_0x23c6('0x69')]=0x3;_0x3522f5[_0x23c6('0xcb')]=_0x23c6('0x1a5');_0x3522f5[_0x23c6('0x123')]+=0x1;_0x3522f5[_0x23c6('0xcf')]+=0x1;var _0x34c830=ut[_0x23c6('0x1a6')](_0x2b7a32,_0x2fd5b2);ami[_0x23c6('0x3a')]('custom:agentnoanswer',_0x34c830);_0x212d87=_0x2fd5b2[_0x23c6('0x190')];_0x4365c6=_0x2fd5b2['callAdditionalPhoneAfterMin'];hopperUtils[_0x23c6('0xbf')](_0x3522f5)[_0x23c6('0x97')](loggerCatch(_0x23c6('0x1a7')));if(_0x3853e9[_0x23c6('0x1a2')](0x3,_0x2b7a32,_0x2fd5b2)&&!_0xbd701e){if(_0x3522f5[_0x23c6('0x123')]>=_0x2fd5b2['dialNoAnswerMaxRetry']){_0x3853e9[_0x23c6('0x11b')](_0x3522f5,_0x333bdc,_0x11003f,_0x23c6('0x1a8'));}else{_0x3853e9[_0x23c6('0x126')](_0x3522f5,_0x333bdc,_0x11003f,_0x23c6('0x1a8'));}}break;case'5':_0x2fd5b2[_0x23c6('0x1a9')]+=0x1;_0x3522f5[_0x23c6('0x69')]=0x5;_0x3522f5[_0x23c6('0xcb')]='Busy';_0x3522f5[_0x23c6('0x117')]+=0x1;_0x3522f5[_0x23c6('0xcf')]+=0x1;ami[_0x23c6('0x3a')](_0x23c6('0x1aa'),ut['buildObj'](_0x2b7a32,'busy'));_0x212d87=_0x2fd5b2[_0x23c6('0x193')];_0x4365c6=_0x2fd5b2['callAdditionalPhoneAfterMin'];hopperUtils[_0x23c6('0xbf')](_0x3522f5)[_0x23c6('0x97')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x3853e9['checkRetriveMax'](0x5,_0x2b7a32,_0x2fd5b2)&&!_0xbd701e){if(_0x3522f5[_0x23c6('0x117')]>=_0x2fd5b2['dialBusyMaxRetry']){_0x3853e9['createStateFinal'](_0x3522f5,_0x333bdc,_0x11003f,_0x23c6('0x1ab'));}else{_0x3853e9[_0x23c6('0x126')](_0x3522f5,_0x333bdc,_0x11003f,_0x23c6('0x1ab'));}}break;case'8':_0x2fd5b2[_0x23c6('0x1ac')]+=0x1;_0x3522f5['state']=0x8;_0x3522f5[_0x23c6('0xcb')]=_0x23c6('0x1ad');_0x3522f5['countcongestionretry']+=0x1;_0x3522f5['countglobal']+=0x1;_0x212d87=_0x2fd5b2['dialCongestionRetryFrequency'];_0x4365c6=_0x2fd5b2[_0x23c6('0xe7')];ami['emit'](_0x23c6('0x1ae'),ut['buildObj'](_0x2b7a32,_0x23c6('0x1af')));hopperUtils[_0x23c6('0xbf')](_0x3522f5)['catch'](loggerCatch(_0x23c6('0x1b0')));if(_0x3853e9['checkRetriveMax'](0x8,_0x2b7a32,_0x2fd5b2)&&!_0xbd701e){if(_0x3522f5['countcongestionretry']>=_0x2fd5b2['dialCongestionMaxRetry']){_0x3853e9['createStateFinal'](_0x3522f5,_0x333bdc,_0x11003f,'reason\x208\x20congestion');}else{_0x3853e9[_0x23c6('0x126')](_0x3522f5,_0x333bdc,_0x11003f,'reason\x208\x20congestion');}}break;case'11':_0x2fd5b2['outboundAbandonedCallsDay']+=0x1;_0x3522f5[_0x23c6('0x69')]=0xb;_0x3522f5[_0x23c6('0xcb')]=_0x23c6('0xe4');_0x3522f5[_0x23c6('0xe6')]+=0x1;_0x3522f5[_0x23c6('0xcf')]+=0x1;_0x212d87=_0x2fd5b2['dialAbandonedRetryFrequency'];_0x4365c6=_0x2fd5b2[_0x23c6('0xe7')];hopperUtils['createHistory'](_0x3522f5)[_0x23c6('0x97')](loggerCatch(_0x23c6('0x1b1')));if(_0x3853e9[_0x23c6('0x1a2')](0xb,_0x2b7a32,_0x2fd5b2)&&!_0xbd701e){if(_0x3522f5[_0x23c6('0xe6')]>=_0x2fd5b2[_0x23c6('0xe8')]){_0x3853e9['createStateFinal'](_0x3522f5,_0x333bdc,_0x11003f,_0x23c6('0x1b2'));}else{_0x3853e9[_0x23c6('0x126')](_0x3522f5,_0x333bdc,_0x11003f,_0x23c6('0x1b2'));}}break;case'20':_0x2fd5b2[_0x23c6('0x1b3')]+=0x1;_0x3522f5[_0x23c6('0x69')]=0x14;_0x3522f5[_0x23c6('0xcb')]='AgentReject';_0x3522f5['countagentrejectretry']+=0x1;_0x3522f5['countglobal']+=0x1;_0x212d87=_0x2fd5b2[_0x23c6('0x1b4')];_0x4365c6=_0x2fd5b2[_0x23c6('0xe7')];ami[_0x23c6('0x3a')]('custom:agentreject',ut[_0x23c6('0x116')](_0x2b7a32,_0x23c6('0x1b5')));hopperUtils[_0x23c6('0xbf')](_0x3522f5)[_0x23c6('0x97')](loggerCatch(_0x23c6('0x1b6')));if(_0x3853e9[_0x23c6('0x1a2')](0x14,_0x2b7a32,_0x2fd5b2)&&!_0xbd701e){if(_0x3522f5['countagentrejectretry']>=_0x2fd5b2[_0x23c6('0x19c')]){_0x3853e9['createStateFinal'](_0x3522f5,_0x333bdc,_0x11003f,'reason\x2020\x20agentreject');}else{_0x3853e9[_0x23c6('0x126')](_0x3522f5,_0x333bdc,_0x11003f,_0x23c6('0x1b7'));}}break;default:_0x2fd5b2['outboundUnknownCallsDay']+=0x1;_0x3522f5[_0x23c6('0x69')]=0xc;_0x3522f5[_0x23c6('0xcb')]=_0x987b2c[_0x23c6('0xba')];_0x212d87=_0x2fd5b2[_0x23c6('0x1b4')];_0x4365c6=_0x2fd5b2['callAdditionalPhoneAfterMin'];hopperUtils[_0x23c6('0xbf')](_0x3522f5)[_0x23c6('0x97')](loggerCatch(_0x23c6('0x1b8')));if(_0x3853e9['checkRetriveMax'](_0x987b2c[_0x23c6('0xba')],_0x2b7a32,_0x2fd5b2)&&!_0xbd701e){if(_0x3522f5['countbusyretry']+_0x3522f5[_0x23c6('0x118')]+_0x3522f5[_0x23c6('0x123')]+_0x3522f5[_0x23c6('0x119')]+_0x3522f5[_0x23c6('0xd3')]+_0x3522f5[_0x23c6('0xe6')]+_0x3522f5[_0x23c6('0x115')]+_0x3522f5[_0x23c6('0x124')]>=_0x2fd5b2[_0x23c6('0x125')]){_0x3853e9[_0x23c6('0x126')](_0x3522f5,_0x333bdc,_0x11003f,_0x987b2c[_0x23c6('0xba')]);}else{_0x3853e9['createStateFinal'](_0x3522f5,_0x333bdc,_0x11003f,_0x987b2c[_0x23c6('0xba')]);}}}})[_0x23c6('0x95')](function(){if(_0xbd701e){hopperUtils[_0x23c6('0xe2')](_0x3522f5,_0x212d87,_0x4365c6)[_0x23c6('0x95')](function(){return _0x333bdc(0x1);});}});});};Dialer[_0x23c6('0x17')][_0x23c6('0x126')]=function(_0x4afcce,_0xef2783,_0x21d524,_0x3832a8){var _0x3cecba=new Final(_0x4afcce);_0x3cecba[_0x23c6('0x69')]=0xf;_0x3cecba[_0x23c6('0xcb')]=_0x23c6('0x1b9');this[_0x23c6('0x11b')](_0x3cecba,_0xef2783,_0x21d524,_0x3832a8);};Dialer[_0x23c6('0x17')][_0x23c6('0x11b')]=function(_0x1a01b5,_0x10804a,_0x58ddc0,_0x43e2ae){hopperUtils['moveContactManagedDialer'](_0x1a01b5)[_0x23c6('0x95')](function(){return _0x10804a(msgResponse(_0x23c6('0x19d'),_0x23c6('0x1ba'),_0x43e2ae));})[_0x23c6('0x97')](function(){return _0x58ddc0(msgResponse(_0x23c6('0x1bb'),_0x23c6('0x8a'),_0x23c6('0x1bc')));});};Dialer[_0x23c6('0x17')][_0x23c6('0x1bd')]=function(_0x501450){var _0x29d0fc=_0x501450[_0x23c6('0x1be')]/0x64;var _0x1c25da=_0x501450[_0x23c6('0xc9')]/(_0x501450['outboundDropCallsDayTimeout']+_0x501450[_0x23c6('0xb9')]);var _0x173531=Math[_0x23c6('0x1bf')](_0x501450[_0x23c6('0x1c0')]*(_0x501450[_0x23c6('0x1c1')]/0x64));var _0x2708d2=Math[_0x23c6('0x1bf')](_0x501450[_0x23c6('0x1c0')]*(_0x501450[_0x23c6('0x1c2')]/0x64));var _0x13af09=_0x501450['available']+_0x501450[_0x23c6('0x1c3')];var _0x3aaae4=Math[_0x23c6('0x1c4')](_0x501450[_0x23c6('0x1c5')]*_0x501450['erlangAbandonmentRate']*_0x501450[_0x23c6('0x1c6')]*_0x501450[_0x23c6('0x1c7')]);if(_['isUndefined'](_0x501450[_0x23c6('0x26')])){if(!_[_0x23c6('0x39')](_0x501450[_0x23c6('0x25')])){_0x501450[_0x23c6('0x25')]=undefined;loggerPredictive[_0x23c6('0x5f')](_0x23c6('0x1c8'),_0x23c6('0x1c9'));}if(!_[_0x23c6('0x39')](_0x501450['handlePredictive'])){loggerPredictive[_0x23c6('0x5f')]('[startMethodPredictive][StartProgressive]',_0x23c6('0x1ca'));clearInterval(_0x501450[_0x23c6('0x5e')]);_0x501450[_0x23c6('0x5e')]=undefined;}_0x501450[_0x23c6('0x26')]=moment()[_0x23c6('0x3e')](_0x23c6('0xbe'));loggerPredictive[_0x23c6('0x43')](_0x501450['name'],_0x23c6('0x1cb'),_0x501450['startProgressive']);this['handlePower'](_0x501450,0x1);}else if(ifInterval(_0x501450[_0x23c6('0x1cc')],_0x501450['startProgressive'])){this[_0x23c6('0xa9')](_0x501450,0x1);loggerPredictiveCalls[_0x23c6('0x43')](_0x23c6('0x1cd'),_0x501450[_0x23c6('0x26')],_0x501450[_0x23c6('0x40')]);_0x501450[_0x23c6('0x1c5')]=0x0;_0x501450[_0x23c6('0xca')]=0x0;}else if(_0x29d0fc<_0x1c25da&&_0x501450[_0x23c6('0x1ce')]===_0x23c6('0x1cf')){clearPredictiveAttributes(_0x501450);loggerPredictive[_0x23c6('0x43')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x23c6('0x1d0'),_0x1c25da,_0x23c6('0x26'),_0x501450[_0x23c6('0x40')]);}else if(_0x3aaae4<_0x501450[_0x23c6('0xca')]&&_0x501450[_0x23c6('0x1ce')]==='dropRate'){clearPredictiveAttributes(_0x501450);loggerPredictive[_0x23c6('0x43')](_0x23c6('0x1d1'),'Max\x20Drop\x20',_0x3aaae4,'Drop\x20in\x20this\x20interval',_0x501450['predictiveIntervalErlangCallsDroppedCalls'],_0x23c6('0x26'),_0x501450[_0x23c6('0x40')]);}else if(!ifInterval(_0x501450['dialPredictiveInterval'],_0x501450[_0x23c6('0x26')])&&_['isUndefined'](_0x501450['startPredictive'])&&!_['isUndefined'](_0x501450[_0x23c6('0x26')])){_0x501450[_0x23c6('0x25')]=moment()[_0x23c6('0x3e')](_0x23c6('0xbe'));loggerPredictive[_0x23c6('0x43')](_0x501450[_0x23c6('0x40')],_0x23c6('0x1d2'),_0x501450[_0x23c6('0x25')]);hopperUtils['avgHandleTime'](_0x501450['dialPredictiveInterval'])[_0x23c6('0x95')](this[_0x23c6('0x1d3')](_0x501450))['then'](mergeDataErlangB(_0x501450))['then'](this[_0x23c6('0x1d4')](_0x501450))['catch'](loggerCatchPredictive(_0x23c6('0x1d5'),_0x501450));}else if(!ifInterval(_0x501450['dialPredictiveInterval'],_0x501450['startPredictive'])){_0x501450[_0x23c6('0xca')]=0x0;_0x501450[_0x23c6('0x25')]=moment()['format'](_0x23c6('0xbe'));loggerPredictive[_0x23c6('0x43')](_0x501450[_0x23c6('0x40')],_0x23c6('0x1d6'),_0x501450[_0x23c6('0x25')]);clearInterval(_0x501450[_0x23c6('0x5e')]);_0x501450['handlePredictive']=undefined;hopperUtils[_0x23c6('0x1d7')](_0x501450[_0x23c6('0x1cc')])['then'](this['getDataPredictive'](_0x501450))['then'](mergeDataErlangB(_0x501450))[_0x23c6('0x95')](this[_0x23c6('0x1d4')](_0x501450))[_0x23c6('0x97')](loggerCatchPredictive(_0x23c6('0x1d8'),_0x501450));}else if(_0x501450['predictiveIntervalAvailable']&&_0x13af09<_0x501450['predictiveIntervalAvailable']-_0x2708d2){clearPredictiveAttributes(_0x501450);loggerPredictive[_0x23c6('0x43')](_0x501450[_0x23c6('0x40')],_0x23c6('0x1d9'),_0x13af09,_0x23c6('0x1da'),_0x501450['predictiveIntervalAvailable'],'-',_0x2708d2,'=',_0x501450['predictiveIntervalAvailable']-_0x2708d2,')');}else if(_0x501450[_0x23c6('0x1c0')]&&_0x13af09>_0x501450[_0x23c6('0x1c0')]+_0x173531){clearPredictiveAttributes(_0x501450);loggerPredictive[_0x23c6('0x43')](_0x501450['name'],_0x23c6('0x1d9'),_0x13af09,_0x23c6('0x1db'),_0x501450['predictiveIntervalAvailable'],'+',_0x173531,'=',_0x501450['predictiveIntervalAvailable']+_0x173531,')');}};Dialer['prototype']['getDataPredictive']=function(_0x2439ab){var _0xa4d5a4=this;return function(_0x64918b){return new Promise(function(_0x3d90b9,_0x6729e1){_[_0x23c6('0x5b')](_0x2439ab,_0x64918b[0x0]);if(checkGetDataPredictive(_0x64918b[0x0])){var _0x4350fd=_0x2439ab['predictiveIntervalAvailable']=_0x2439ab[_0x23c6('0x1c3')]+_0x2439ab['available'];var _0x446b8e=_0x2439ab[_0x23c6('0x1cc')]*0x3c;var _0x26322b=_0x64918b[0x0][_0x23c6('0x4d')]+_0x64918b[0x0]['predictiveIntervalAvgHoldtime'];var _0x69121d=(_0x64918b[0x0]['predictiveIntervalAnsweredCalls']+_0x64918b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x64918b[0x0][_0x23c6('0x4a')])/_0x64918b[0x0]['predictiveIntervalTotalCalls'];_0x2439ab[_0x23c6('0x1c6')]=_0x69121d>0x0?_0x69121d:0x1;switch(_0x2439ab[_0x23c6('0x1ce')]){case _0x23c6('0x1cf'):var _0x1eca8a=_0x2439ab[_0x23c6('0x1be')]/0x64;return _0xa4d5a4['abandonmentRate'](_0x4350fd,_0x446b8e,_0x26322b,_0x69121d,_0x1eca8a)[_0x23c6('0x95')](function(_0x214da8){return _0x3d90b9(_0x214da8);});case _0x23c6('0x1dc'):var _0x24e152=_0x2439ab['dialPredictiveOptimizationPercentage']/0x64;return _0xa4d5a4[_0x23c6('0x1dd')](_0x4350fd,_0x446b8e,_0x26322b,_0x69121d,_0x24e152)[_0x23c6('0x95')](function(_0x29f538){return _0x3d90b9(_0x29f538);});default:return _0x6729e1(msgResponse(_0x23c6('0x1de'),'Failure','Unknown\x20Predictive'));}}else{return _0x6729e1(msgResponse(_0x23c6('0x1de'),_0x23c6('0x8a'),_0x23c6('0x1df')));}});};};Dialer[_0x23c6('0x17')][_0x23c6('0x1e0')]=function(_0x3d9680){var _0x5a957b=this;return function(_0x592411){return new Promise(function(_0x1b5146,_0x73b01d){_[_0x23c6('0x5b')](_0x3d9680,_0x592411[0x0]);if(checkGetDataPredictive(_0x592411[0x0])){loggerPredictive[_0x23c6('0x43')](JSON[_0x23c6('0x6d')](_0x592411[0x0]));if(_0x3d9680['dialPredictiveOptimization']===_0x23c6('0x1cf')){return _0x5a957b[_0x23c6('0x150')](_0x3d9680['id'])[_0x23c6('0x95')](function(_0x167b56){var _0x45461c=_0x3d9680[_0x23c6('0x1e1')]-_0x167b56[0x0][_0x23c6('0x1e2')];var _0x474cdb=_0x3d9680['dialPredictiveInterval']*0x3c;var _0x2873a7=_0x592411[0x0]['predictiveIntervalAvgTalktime']+_0x592411[0x0][_0x23c6('0x4c')];var _0x4ca19a=(_0x592411[0x0][_0x23c6('0x46')]+_0x592411[0x0][_0x23c6('0x48')]+_0x592411[0x0][_0x23c6('0x4a')])/_0x592411[0x0][_0x23c6('0x44')];var _0x56faaa=_0x3d9680['dialPredictiveOptimizationPercentage']/0x64;_0x3d9680['predictiveIntervalPauses']=_0x167b56[0x0][_0x23c6('0x1e2')]||0x0;_0x3d9680[_0x23c6('0x1c6')]=_0x4ca19a>0x0?_0x4ca19a:0x1;return _0x5a957b[_0x23c6('0x1e3')](_0x45461c,_0x474cdb,_0x2873a7,_0x4ca19a,_0x56faaa);})[_0x23c6('0x95')](function(_0x169f83){return _0x1b5146(_0x169f83);})[_0x23c6('0x97')](function(_0x5ad278){return _0x73b01d(msgResponse(_0x23c6('0x1e4'),_0x23c6('0x8a'),JSON[_0x23c6('0x6d')](_0x5ad278)));});}if(_0x3d9680['dialPredictiveOptimization']==='agentBusyFactor'){return _0x5a957b[_0x23c6('0x150')](_0x3d9680['id'])[_0x23c6('0x95')](function(_0xc2ec41){var _0x502700=_0x3d9680[_0x23c6('0x1e1')]-_0xc2ec41[0x0][_0x23c6('0x1e2')];var _0x46eb96=_0x3d9680[_0x23c6('0x1cc')]*0x3c;var _0x43b2c4=_0x592411[0x0][_0x23c6('0x4d')]+_0x592411[0x0][_0x23c6('0x4c')];var _0x3cc6a6=(_0x592411[0x0][_0x23c6('0x46')]+_0x592411[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x592411[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x592411[0x0][_0x23c6('0x44')];var _0x569f6c=_0x3d9680['dialPredictiveOptimizationPercentage']/0x64;_0x3d9680[_0x23c6('0x1e5')]=_0xc2ec41[0x0][_0x23c6('0x1e2')]||0x0;_0x3d9680['predictiveIntervalHitRate']=_0x3cc6a6>0x0?_0x3cc6a6:0x1;return _0x5a957b[_0x23c6('0x1dd')](_0x502700,_0x46eb96,_0x43b2c4,_0x3cc6a6,_0x569f6c);})[_0x23c6('0x95')](function(_0x50d042){return _0x1b5146(_0x50d042);})[_0x23c6('0x97')](function(_0x130036){return _0x73b01d(msgResponse('[CatchErlangB]',_0x23c6('0x8a'),JSON[_0x23c6('0x6d')](_0x130036)));});}}else{return _0x73b01d(msgResponse(_0x23c6('0x1de'),_0x23c6('0x8a'),'check\x20failure'));}});};};Dialer[_0x23c6('0x17')][_0x23c6('0x1d4')]=function(_0x55b0b2){var _0x5875b8=this;return function(){var _0x20b4ed=0x0;var _0x231918=Math[_0x23c6('0x1c4')](_0x55b0b2[_0x23c6('0x55')]*0x3e8);if(_0x231918>0x0){_0x231918=_0x231918<0x64?0x64:_0x231918;loggerPredictive[_0x23c6('0x43')](_0x55b0b2['name'],'one\x20call\x20every:',_0x231918,_0x23c6('0x1e6'));_0x55b0b2['handlePredictive']=setInterval(function(){_0x5875b8[_0x23c6('0x5e')](_0x55b0b2);loggerPredictiveCalls['info'](_0x23c6('0x1e7'),_0x20b4ed+=0x1);},_0x231918);}else{loggerPredictive[_0x23c6('0x43')](_0x55b0b2[_0x23c6('0x40')],_0x23c6('0x1e8'));}};};Dialer[_0x23c6('0x17')][_0x23c6('0x1e9')]=function(_0x196627,_0x483cb2){var _0x1ab322=this;return function(_0x403ef2){if(_[_0x23c6('0x42')](_0x403ef2)){if(_[_0x23c6('0xf0')](_0x483cb2[_0x23c6('0x155')])||!_0x483cb2[_0x23c6('0x1ea')]){if(_0x196627['dialMethod']===_0x23c6('0x8')){_0x196627[_0x23c6('0x6b')]=_[_0x23c6('0x39')](_0x196627[_0x23c6('0x6b')])?!![]:_0x196627[_0x23c6('0x6b')];var _0x338be2=uuid['v4']();_0x1ab322['actions'][_0x338be2]=new Action(_0x196627,_0x483cb2,_0x338be2);loggerBooked['info'](_0x23c6('0x1eb'),_0x338be2,_0x23c6('0x1ec'),JSON['stringify'](_0x196627[_0x23c6('0x6b')]),'Queue:\x20',_0x196627['name']);if(_0x196627[_0x23c6('0x6b')]){_0x196627[_0x23c6('0x6b')]=![];_0x1ab322[_0x23c6('0xf4')][_0x1ab322[_0x23c6('0xea')][_0x338be2][_0x23c6('0xb4')]]=[];ami[_0x23c6('0x91')]({'actionid':_0x338be2,'action':_0x23c6('0x1ed'),'queue':_0x196627[_0x23c6('0x40')]})[_0x23c6('0x97')](function(){utils['decrementOriginate'](_0x196627,'[checkContactBlack]');hopperUtils[_0x23c6('0xd6')]({'active':![],'ContactId':_0x1ab322[_0x23c6('0xea')][_0x338be2][_0x23c6('0xda')],'ListId':_0x1ab322[_0x23c6('0xea')][_0x338be2][_0x23c6('0xdb')],'VoiceQueueId':_0x1ab322[_0x23c6('0xea')][_0x338be2]['VoiceQueueId']||undefined,'CampaignId':_0x1ab322[_0x23c6('0xea')][_0x338be2][_0x23c6('0xdd')]||undefined})[_0x23c6('0x97')](loggerCatch(_0x23c6('0x1ee')));delete _0x1ab322[_0x23c6('0xea')][_0x338be2];});}else{loggerBooked[_0x23c6('0x43')](_0x23c6('0x1ef'),JSON['stringify'](_0x196627[_0x23c6('0x6b')]),_0x23c6('0x1f0'),_0x196627[_0x23c6('0x40')]);utils[_0x23c6('0xc3')](_0x196627,'[checkContactBlack]');hopperUtils[_0x23c6('0xd6')]({'active':![],'ContactId':_0x1ab322['actions'][_0x338be2][_0x23c6('0xda')],'ListId':_0x1ab322['actions'][_0x338be2]['ListId'],'VoiceQueueId':_0x1ab322['actions'][_0x338be2][_0x23c6('0xdc')]||undefined,'CampaignId':_0x1ab322[_0x23c6('0xea')][_0x338be2][_0x23c6('0xdd')]||undefined})[_0x23c6('0x97')](loggerCatch(_0x23c6('0x1ee')));delete _0x1ab322['actions'][_0x338be2];}}else{return _0x1ab322[_0x23c6('0x15c')](_0x196627,_0x483cb2);}}else{if(utils[_0x23c6('0xc6')](undefined,_0x483cb2[_0x23c6('0x1f1')])<_0x196627[_0x23c6('0x1f2')]*0x3c){if(_0x483cb2[_0x23c6('0x159')]&&!_0x483cb2[_0x23c6('0x159')][_0x23c6('0x1f3')]){_0x1ab322[_0x23c6('0x1b')][_0x23c6('0xfd')](_0x483cb2['id'])['finally'](function(){utils[_0x23c6('0xc3')](_0x196627,_0x23c6('0x1f4'));});}else{hopperUtils[_0x23c6('0x1f5')]({'active':![]},_0x483cb2['id'],0x1)[_0x23c6('0x1a')](function(){utils[_0x23c6('0xc3')](_0x196627,_0x23c6('0x1f4'));});}}else{_0x196627[_0x23c6('0x1f6')]+=0x1;utils['decrementOriginate'](_0x196627,_0x23c6('0x1f4'));if(_0x196627[_0x23c6('0x1f7')]){hopperUtils[_0x23c6('0xd6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x483cb2[_0x23c6('0xda')],'ListId':_0x483cb2[_0x23c6('0xdb')],'VoiceQueueId':_0x483cb2[_0x23c6('0xdc')]||undefined,'CampaignId':_0x483cb2[_0x23c6('0xdd')]||undefined})[_0x23c6('0x97')](loggerCatch(_0x23c6('0x1f8')));hopperUtils[_0x23c6('0xbf')](createObjHistory(_0x196627,_0x483cb2,utils[_0x23c6('0x63')]['QUEUE_RECALL'],0x17,_0x23c6('0x1f9')))['catch'](loggerCatch(_0x23c6('0x1fa')));}else{_0x1ab322['saveInDb'](createObjHistory(_0x196627,_0x483cb2,utils[_0x23c6('0x63')][_0x23c6('0x1fb')],0x16,_0x23c6('0x1fc')),_0x23c6('0x1fd'),_0x23c6('0x1fe'));}}}}else{_0x196627[_0x23c6('0x1ff')]+=0x1;_0x1ab322[_0x23c6('0x11f')](createObjHistory(_0x196627,_0x483cb2,utils[_0x23c6('0x63')]['BLACKLIST'],0xd,'Blacklist'),_0x23c6('0x200'),_0x23c6('0x201'));throw _0x23c6('0x202');}};};Dialer[_0x23c6('0x17')][_0x23c6('0x15b')]=function(_0x2ef7c0){var _0x4fbae0=this;var _0x4898e3=_0x2ef7c0[_0x23c6('0x203')]-_0x2ef7c0[_0x23c6('0x204')];emitCampaignSummary(_0x2ef7c0);if(_0x4898e3>0x0&&_0x2ef7c0['temp']==0x0){if(_0x4898e3>this[_0x23c6('0x20')]){_0x4898e3=this[_0x23c6('0x20')];}_0x2ef7c0['temp']=0x1;hopperUtils['getContactDialerIvr'](_0x2ef7c0,_0x4898e3)[_0x23c6('0x95')](function(_0x33a8fa){_0x2ef7c0[_0x23c6('0x205')]=0x0;if(_0x33a8fa){if(!utils[_0x23c6('0x206')](_0x33a8fa)){_0x2ef7c0[_0x23c6('0x62')]=utils[_0x23c6('0x63')][_0x23c6('0x67')];logger[_0x23c6('0x43')](_0x23c6('0x207')+_0x2ef7c0['name']);}else{_0x2ef7c0['originated']+=_0x33a8fa['length'];_0x2ef7c0[_0x23c6('0x62')]=utils[_0x23c6('0x63')]['RUNNING'];for(var _0x282e01=0x0;_0x282e01<_0x33a8fa['length'];_0x282e01+=0x1){_0x2ef7c0[_0x23c6('0x208')]+=0x1;if(_['isNil'](_0x33a8fa[_0x282e01])||_[_0x23c6('0xf0')](_0x33a8fa[_0x282e01][_0x23c6('0x178')])||_[_0x23c6('0xf0')](_0x33a8fa[_0x282e01]['phone'])){_0x4fbae0[_0x23c6('0x152')]('[actionOriginate]\x20',_0x2ef7c0,_0x33a8fa[_0x282e01]);}else{hopperUtils[_0x23c6('0x209')](_[_0x23c6('0x6e')](_0x33a8fa[_0x282e01],[_0x23c6('0xdd'),'phone']))[_0x23c6('0x95')](_0x4fbae0[_0x23c6('0x1e9')](_0x2ef7c0,_0x33a8fa[_0x282e01]))[_0x23c6('0x97')](function(_0x10a8a9){logger['error']('[actionOriginateIvr]',_0x10a8a9);utils[_0x23c6('0xc3')](_0x2ef7c0,_0x23c6('0x20a'));});}}}}})[_0x23c6('0x97')](function(_0x1a12a7){_0x2ef7c0['temp']=0x0;logger[_0x23c6('0x5f')](_0x23c6('0x20b'),_0x1a12a7);});}};Dialer['prototype'][_0x23c6('0xa9')]=function(_0x16663a,_0xb5b687){var _0x44f517=this;var _0x509cc9=[];if(_0xb5b687<0x1||_0x16663a[_0x23c6('0xa7')]==='booked'){_0xb5b687=0x1;}var _0x36e490=Math['floor'](_0x16663a[_0x23c6('0x13b')]*_0xb5b687)-_0x16663a[_0x23c6('0x204')];if(_0x16663a[_0x23c6('0x20c')]>0x0){var _0x6116d4=_0x16663a[_0x23c6('0x20c')]-_0x16663a[_0x23c6('0x204')]-_0x16663a['talking']-_0x16663a['pTalking'];if(_0x36e490>_0x6116d4){_0x36e490=_0x6116d4;}}if(_0x36e490>0x0&&_0x16663a[_0x23c6('0x205')]==0x0){if(_0x16663a[_0x23c6('0xa7')]===_0x23c6('0x8')){_0x36e490=0x1;}if(_0x36e490>this[_0x23c6('0x20')]){_0x36e490=this[_0x23c6('0x20')];}for(var _0x3da671 in this[_0x23c6('0x1e')]){if(typeof this['agents'][_0x3da671]!==_0x23c6('0xa1')){if(this[_0x23c6('0x1e')][_0x3da671][_0x23c6('0x69')]==='not_inuse'&&this['agents'][_0x3da671]['status']==='reachable'){_0x509cc9['push'](this[_0x23c6('0x1e')][_0x3da671]['id']);}}}_0x16663a[_0x23c6('0x205')]=0x1;hopperUtils[_0x23c6('0x20d')](_0x16663a,_0x509cc9,_0x36e490)[_0x23c6('0x95')](function(_0xff28ee){_0x16663a['temp']=0x0;if(_0xff28ee){if(!utils[_0x23c6('0x206')](_0xff28ee)){hopperUtils[_0x23c6('0x20e')](_0x16663a)[_0x23c6('0x95')](sendMessageReschedule(_0x16663a))[_0x23c6('0x97')](loggerCatch('[countReScheduled]\x20'));}else{_0x16663a[_0x23c6('0x204')]+=_0xff28ee[_0x23c6('0x8f')];_0x16663a[_0x23c6('0x62')]=_0x16663a['dialMethod']===_0x23c6('0x8')?utils[_0x23c6('0x63')][_0x23c6('0x13e')]:utils[_0x23c6('0x63')][_0x23c6('0x20f')];for(var _0x1724f4=0x0;_0x1724f4<_0xff28ee['length'];_0x1724f4+=0x1){if(_['isNil'](_0xff28ee[_0x1724f4])||_[_0x23c6('0xf0')](_0xff28ee[_0x1724f4][_0x23c6('0x178')])||_[_0x23c6('0xf0')](_0xff28ee[_0x1724f4][_0x23c6('0x15e')])){_0x44f517[_0x23c6('0x152')]('[actionOriginate]\x20',_0x16663a,_0xff28ee[_0x1724f4]);}else{hopperUtils[_0x23c6('0x210')](_[_0x23c6('0x6e')](_0xff28ee[_0x1724f4],['VoiceQueueId',_0x23c6('0x15e')]))[_0x23c6('0x95')](_0x44f517[_0x23c6('0x1e9')](_0x16663a,_0xff28ee[_0x1724f4]))['catch'](function(_0x512124){logger[_0x23c6('0x5f')](_0x23c6('0x211'),_0x512124);utils[_0x23c6('0xc3')](_0x16663a,'[handlePower]');});}}}}})[_0x23c6('0x97')](function(_0x5f4715){_0x16663a['temp']=0x0;logger[_0x23c6('0x5f')](_0x23c6('0x20b'),_0x5f4715);});}};Dialer['prototype']['handlePredictive']=function(_0x528029){if(_0x528029[_0x23c6('0x20c')]>0x0){var _0x561702=_0x528029[_0x23c6('0x20c')]-_0x528029[_0x23c6('0x204')]-_0x528029[_0x23c6('0x1c3')];if(_0x561702>0x0&&_0x528029[_0x23c6('0x205')]==0x0){this[_0x23c6('0x212')](_0x528029);}else{loggerPredictiveCalls[_0x23c6('0x43')](_0x23c6('0x213'));}}else{this[_0x23c6('0x212')](_0x528029);}};Dialer['prototype'][_0x23c6('0x212')]=function(_0x1c8a32){var _0x25be46=this;var _0x4071d1=[];_0x1c8a32[_0x23c6('0x204')]+=0x1;for(var _0x2619e8 in this[_0x23c6('0x1e')]){if(typeof this['agents'][_0x2619e8]!=='undefined'){if(this['agents'][_0x2619e8][_0x23c6('0x69')]===_0x23c6('0x214')&&this[_0x23c6('0x1e')][_0x2619e8][_0x23c6('0x7f')]===_0x23c6('0x80')){_0x4071d1[_0x23c6('0x90')](this[_0x23c6('0x1e')][_0x2619e8]['id']);}}}_0x1c8a32[_0x23c6('0x205')]=0x1;return this[_0x23c6('0x20d')](_0x1c8a32['id'],_0x4071d1,0x1,_0x1c8a32[_0x23c6('0x215')],_0x1c8a32)[_0x23c6('0x95')](function(_0x8fc5da){_0x1c8a32['temp']=0x1;if(_0x8fc5da){if(!utils[_0x23c6('0x206')](_0x8fc5da)){utils[_0x23c6('0x216')](_0x1c8a32,0x1,0x0);return hopperUtils['countReScheduled'](_0x1c8a32)[_0x23c6('0x95')](sendMessageReschedule(_0x1c8a32))[_0x23c6('0x97')](loggerCatch(_0x23c6('0x217')));}else{_0x1c8a32['message']=utils[_0x23c6('0x63')][_0x23c6('0x20f')];if(_[_0x23c6('0xf0')](_0x8fc5da[0x0])||_[_0x23c6('0xf0')](_0x8fc5da[0x0]['Contact'])||_[_0x23c6('0xf0')](_0x8fc5da[0x0][_0x23c6('0x15e')])){_0x25be46[_0x23c6('0x152')](_0x23c6('0x218'),_0x1c8a32,_0x8fc5da[0x0]);}else{return hopperUtils[_0x23c6('0x210')](_[_0x23c6('0x6e')](_0x8fc5da[0x0],[_0x23c6('0xdc'),_0x23c6('0x15e')]))[_0x23c6('0x95')](_0x25be46[_0x23c6('0x1e9')](_0x1c8a32,_0x8fc5da[0x0]))[_0x23c6('0x97')](function(_0x5dcc27){logger[_0x23c6('0x5f')](_0x23c6('0x219'),_0x5dcc27);utils[_0x23c6('0xc3')](_0x1c8a32,_0x23c6('0x219'));});}}}})['catch'](function(_0x2f1a78){_0x1c8a32[_0x23c6('0x205')]=0x0;logger['error']('[getContactCampaign2]',_0x2f1a78);});};Dialer[_0x23c6('0x17')][_0x23c6('0x1e3')]=function(_0x57ac3c,_0x2cb58e,_0x501017,_0x2f8110,_0x15bff0,_0x4a37d0){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x23c6('0x43')](_0x23c6('0x21a'),_0x57ac3c);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2cb58e);loggerPredictive[_0x23c6('0x43')](_0x23c6('0x21b'),_0x501017);loggerPredictive[_0x23c6('0x43')](_0x23c6('0x21c'),_0x2f8110);loggerPredictive[_0x23c6('0x43')](_0x23c6('0x21d'),_0x15bff0);loggerPredictive[_0x23c6('0x43')]('---------------------------');return new Promise(function(_0xd10198,_0x531826){if(_0x57ac3c<=0x0||isNaN(_0x57ac3c)){return _0x531826(msgResponse('[abandonmentRate]','Error',_0x23c6('0x21e')+_0x57ac3c));}if(_0x501017<=0x0||isNaN(_0x501017)){return _0x531826(msgResponse(_0x23c6('0x21f'),'Error',_0x23c6('0x220')+_0x501017));}if(_0x2f8110<=0x0||isNaN(_0x2f8110)){return _0x531826(msgResponse(_0x23c6('0x21f'),_0x23c6('0x7c'),_0x23c6('0x221')+_0x2f8110));}if(_0x2cb58e<=0x0||isNaN(_0x2cb58e)){return _0x531826(msgResponse(_0x23c6('0x21f'),'Error','interval\x20=\x20'+_0x2cb58e));}if(_0x15bff0<=0x0||isNaN(_0x15bff0)){return _0x531826(msgResponse(_0x23c6('0x21f'),_0x23c6('0x7c'),_0x23c6('0x222')+_0x15bff0));}_0x4a37d0=_0x4a37d0||0x0;var _0x4a2f02=0x1/_0x501017;var _0x27f410=0x0;var _0x4d0676=0x0;var _0x5b1b39=0x0;var _0xa7beec=0x0;for(var _0x22a9e3=0x0;_0x5b1b39<_0x15bff0;_0x22a9e3+=0x1){_0x4d0676=_0x22a9e3/_0x2cb58e;_0x27f410=(_0x2f8110*_0x4d0676+_0x4a37d0)/_0x4a2f02;_0x5b1b39=utils[_0x23c6('0x223')](_0x27f410,_0x57ac3c);_0xa7beec=_0x27f410/_0x57ac3c*(0x1-utils[_0x23c6('0x223')](_0x27f410,_0x57ac3c));}return _0xd10198({'erlangCalls':_0x22a9e3,'erlangCallToSecond':_0x2cb58e/_0x22a9e3,'erlangAbandonmentRate':_0x5b1b39,'erlangBusyFactor':_0xa7beec});});};Dialer[_0x23c6('0x17')][_0x23c6('0x1dd')]=function(_0x57b154,_0x3c9f5c,_0x1893db,_0x54634d,_0x21acb1,_0x28591f){loggerPredictive[_0x23c6('0x43')](_0x23c6('0x224'));loggerPredictive[_0x23c6('0x43')](_0x23c6('0x21a'),_0x57b154);loggerPredictive[_0x23c6('0x43')](_0x23c6('0x225'),_0x3c9f5c);loggerPredictive[_0x23c6('0x43')]('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',_0x1893db);loggerPredictive[_0x23c6('0x43')](_0x23c6('0x21c'),_0x54634d);loggerPredictive['info'](_0x23c6('0x226'),_0x21acb1);loggerPredictive[_0x23c6('0x43')](_0x23c6('0x5a'));return new Promise(function(_0x3409ef,_0x143c04){if(_0x57b154<=0x0||isNaN(_0x57b154)){return _0x143c04(msgResponse('[busyFactor]',_0x23c6('0x7c'),_0x23c6('0x21e')+_0x57b154));}if(_0x1893db<=0x0||isNaN(_0x1893db)){return _0x143c04(msgResponse('[busyFactor]',_0x23c6('0x7c'),_0x23c6('0x220')+_0x1893db));}if(_0x54634d<=0x0||isNaN(_0x54634d)){return _0x143c04(msgResponse('[busyFactor]',_0x23c6('0x7c'),_0x23c6('0x221')+_0x54634d));}if(_0x3c9f5c<=0x0||isNaN(_0x3c9f5c)){return _0x143c04(msgResponse(_0x23c6('0x227'),_0x23c6('0x7c'),_0x23c6('0x228')+_0x3c9f5c));}if(_0x21acb1<=0x0||isNaN(_0x21acb1)){return _0x143c04(msgResponse(_0x23c6('0x227'),_0x23c6('0x7c'),_0x23c6('0x229')+_0x21acb1));}_0x28591f=_0x28591f||0x0;var _0x494d5a=0x1/_0x1893db;var _0x4652ad=0x0;var _0x67b31e=0x0;var _0x31cf0d=0x0;var _0x41965a=0x0;for(var _0x566568=0x0;_0x41965a<_0x21acb1;_0x566568+=0x1){_0x67b31e=_0x566568/_0x3c9f5c;_0x4652ad=(_0x54634d*_0x67b31e+_0x28591f)/_0x494d5a;_0x31cf0d=utils[_0x23c6('0x223')](_0x4652ad,_0x57b154);_0x41965a=_0x4652ad/_0x57b154*(0x1-utils[_0x23c6('0x223')](_0x4652ad,_0x57b154));}return _0x3409ef({'erlangCalls':_0x566568,'erlangCallToSecond':_0x3c9f5c/_0x566568,'erlangAbandonmentRate':_0x31cf0d,'erlangBusyFactor':_0x41965a});});};module[_0x23c6('0x22a')]=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 a889eab..81ea0a7 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 _0x7a34=['firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','prototype','getQueue','util','moment','isNil','string','name','Contact','phone'];(function(_0x1f1371,_0x3765cf){var _0x24ed9f=function(_0x427ee3){while(--_0x427ee3){_0x1f1371['push'](_0x1f1371['shift']());}};_0x24ed9f(++_0x3765cf);}(_0x7a34,0x17f));var _0x47a3=function(_0x1838f0,_0x2afbf2){_0x1838f0=_0x1838f0-0x0;var _0x4ead57=_0x7a34[_0x1838f0];return _0x4ead57;};'use strict';var util=require(_0x47a3('0x0'));var _=require('lodash');var moment=require(_0x47a3('0x1'));function checkNameSurname(_0x29e779,_0x22021c,_0x52b140){var _0x18ff0a='';if(!_['isNil'](_0x22021c)&&'string'===typeof _0x22021c){_0x18ff0a+=_0x22021c;}if(!_[_0x47a3('0x2')](_0x52b140)&&_0x47a3('0x3')===typeof _0x52b140){_0x18ff0a+='\x20'+_0x52b140;}if(_0x18ff0a!==''){return _0x18ff0a;}return _0x29e779;}function Action(_0x192f95,_0x1ee720,_0x333ad2){this['voiceQueue']=_0x192f95;this['uniqueid']=_0x333ad2||undefined;this[_0x47a3('0x4')]=checkNameSurname(_0x1ee720[_0x47a3('0x5')][_0x47a3('0x6')],_0x1ee720[_0x47a3('0x5')][_0x47a3('0x7')],_0x1ee720['Contact']['lastName']);this[_0x47a3('0x8')]=_0x1ee720[_0x47a3('0x6')];this[_0x47a3('0x9')]=_0x192f95['name'];this['active']=_0x1ee720[_0x47a3('0xa')]||![];this[_0x47a3('0xb')]=_0x192f95['type'];this[_0x47a3('0xc')]=_0x192f95[_0x47a3('0xc')]||0x3;this[_0x47a3('0xd')]=_0x1ee720[_0x47a3('0xd')];this['countbusyretry']=_0x1ee720['countbusyretry'];this[_0x47a3('0xe')]=_0x1ee720[_0x47a3('0xe')];this['countnoanswerretry']=_0x1ee720[_0x47a3('0xf')];this[_0x47a3('0x10')]=_0x1ee720[_0x47a3('0x10')];this[_0x47a3('0x11')]=_0x1ee720[_0x47a3('0x11')];this['countabandonedretry']=_0x1ee720[_0x47a3('0x12')];this[_0x47a3('0x13')]=_0x1ee720['countmachineretry'];this[_0x47a3('0x14')]=_0x1ee720['countagentrejectretry'];this['ContactId']=_0x1ee720['ContactId'];this[_0x47a3('0x15')]=_0x1ee720[_0x47a3('0x15')];this[_0x47a3('0x16')]=_0x1ee720['UserId'];this['VoiceQueueId']=_0x1ee720[_0x47a3('0x17')];this['CampaignId']=_0x1ee720[_0x47a3('0x18')];this['idHopper']=_0x1ee720['id'];this[_0x47a3('0x19')]=_0x1ee720[_0x47a3('0x5')]['firstName']||'';this[_0x47a3('0x1a')]=moment()[_0x47a3('0x1b')](_0x47a3('0x1c'));this[_0x47a3('0x1d')]=_0x1ee720['callback'];this['callbackuniqueid']=_0x1ee720['callbackuniqueid'];this['callbackat']=_0x1ee720[_0x47a3('0x1e')];this[_0x47a3('0x1f')]=_0x1ee720[_0x47a3('0x1f')];this[_0x47a3('0x20')]='';this['originatecalleridname']='';}Action['prototype'][_0x47a3('0x21')]=function(){return util['format'](_0x47a3('0x22'),this[_0x47a3('0x4')],this[_0x47a3('0x23')][_0x47a3('0x24')]>0x0?this['number']['substring'](this[_0x47a3('0x23')][_0x47a3('0x24')]):this[_0x47a3('0x8')]);};Action[_0x47a3('0x25')][_0x47a3('0x26')]=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file +var _0x1d83=['VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','format','dialCutDigit','prototype','getQueue','exports','lodash','moment','isNil','voiceQueue','uniqueid','name','Contact','phone','firstName','number','queue','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId'];(function(_0xdfbaf9,_0x4e1c2b){var _0x2d1e2b=function(_0x486bf8){while(--_0x486bf8){_0xdfbaf9['push'](_0xdfbaf9['shift']());}};_0x2d1e2b(++_0x4e1c2b);}(_0x1d83,0x1df));var _0x31d8=function(_0x3c0569,_0x11da9f){_0x3c0569=_0x3c0569-0x0;var _0x142524=_0x1d83[_0x3c0569];return _0x142524;};'use strict';var util=require('util');var _=require(_0x31d8('0x0'));var moment=require(_0x31d8('0x1'));function checkNameSurname(_0x3d1f8c,_0x32843d,_0x1aa997){var _0x32fbe0='';if(!_[_0x31d8('0x2')](_0x32843d)&&'string'===typeof _0x32843d){_0x32fbe0+=_0x32843d;}if(!_[_0x31d8('0x2')](_0x1aa997)&&'string'===typeof _0x1aa997){_0x32fbe0+='\x20'+_0x1aa997;}if(_0x32fbe0!==''){return _0x32fbe0;}return _0x3d1f8c;}function Action(_0x15fd69,_0x1e47ce,_0x3cb3d5){this[_0x31d8('0x3')]=_0x15fd69;this[_0x31d8('0x4')]=_0x3cb3d5||undefined;this[_0x31d8('0x5')]=checkNameSurname(_0x1e47ce[_0x31d8('0x6')][_0x31d8('0x7')],_0x1e47ce[_0x31d8('0x6')][_0x31d8('0x8')],_0x1e47ce[_0x31d8('0x6')]['lastName']);this[_0x31d8('0x9')]=_0x1e47ce['phone'];this[_0x31d8('0xa')]=_0x15fd69[_0x31d8('0x5')];this['active']=_0x1e47ce[_0x31d8('0xb')]||![];this['type']=_0x15fd69['type'];this[_0x31d8('0xc')]=_0x15fd69[_0x31d8('0xc')]||0x3;this['scheduledat']=_0x1e47ce[_0x31d8('0xd')];this['countbusyretry']=_0x1e47ce[_0x31d8('0xe')];this[_0x31d8('0xf')]=_0x1e47ce[_0x31d8('0xf')];this[_0x31d8('0x10')]=_0x1e47ce[_0x31d8('0x10')];this[_0x31d8('0x11')]=_0x1e47ce[_0x31d8('0x11')];this[_0x31d8('0x12')]=_0x1e47ce[_0x31d8('0x12')];this['countabandonedretry']=_0x1e47ce[_0x31d8('0x13')];this[_0x31d8('0x14')]=_0x1e47ce[_0x31d8('0x14')];this[_0x31d8('0x15')]=_0x1e47ce['countagentrejectretry'];this[_0x31d8('0x16')]=_0x1e47ce[_0x31d8('0x16')];this[_0x31d8('0x17')]=_0x1e47ce[_0x31d8('0x17')];this[_0x31d8('0x18')]=_0x1e47ce[_0x31d8('0x18')];this[_0x31d8('0x19')]=_0x1e47ce[_0x31d8('0x19')];this[_0x31d8('0x1a')]=_0x1e47ce[_0x31d8('0x1a')];this[_0x31d8('0x1b')]=_0x1e47ce['id'];this[_0x31d8('0x1c')]=_0x1e47ce[_0x31d8('0x6')][_0x31d8('0x8')]||'';this[_0x31d8('0x1d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x1e47ce[_0x31d8('0x1e')];this['callbackuniqueid']=_0x1e47ce[_0x31d8('0x1f')];this[_0x31d8('0x20')]=_0x1e47ce[_0x31d8('0x20')];this[_0x31d8('0x21')]=_0x1e47ce[_0x31d8('0x21')];this[_0x31d8('0x22')]='';this[_0x31d8('0x23')]='';}Action['prototype'][_0x31d8('0x24')]=function(){return util[_0x31d8('0x25')]('\x22%s\x22\x20<%s>',this['name'],this['voiceQueue']['dialCutDigit']>0x0?this[_0x31d8('0x9')]['substring'](this[_0x31d8('0x3')][_0x31d8('0x26')]):this[_0x31d8('0x9')]);};Action[_0x31d8('0x27')][_0x31d8('0x28')]=function(){return this[_0x31d8('0xa')];};module[_0x31d8('0x29')]=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 581e3d9..90c9fa2 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 _0x3adb=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','statedesc','Answer','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','format','ringtime','getSeconds','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x59dccc,_0x184c1c){var _0xc97bcb=function(_0x1ddbcb){while(--_0x1ddbcb){_0x59dccc['push'](_0x59dccc['shift']());}};_0xc97bcb(++_0x184c1c);}(_0x3adb,0xde));var _0xb3ad=function(_0x554801,_0x4362d4){_0x554801=_0x554801-0x0;var _0x454049=_0x3adb[_0x554801];return _0x454049;};'use strict';var moment=require('moment');var utils=require(_0xb3ad('0x0'));function AgentComplete(_0x4d437d,_0x46e1fd){this['state']=0x4;this[_0xb3ad('0x1')]=_0xb3ad('0x2');this[_0xb3ad('0x3')]=_0x4d437d[_0xb3ad('0x3')];this[_0xb3ad('0x4')]=_0x4d437d['type'];this['campaigntype']=_0x4d437d[_0xb3ad('0x4')]==='outbound'?'queue':_0x4d437d[_0xb3ad('0x4')];this['countbusyretry']=_0x4d437d[_0xb3ad('0x5')];this['countcongestionretry']=_0x4d437d[_0xb3ad('0x6')];this['countnoanswerretry']=_0x4d437d[_0xb3ad('0x7')];this[_0xb3ad('0x8')]=_0x4d437d[_0xb3ad('0x5')]+_0x4d437d[_0xb3ad('0x6')]+_0x4d437d[_0xb3ad('0x7')]+_0x4d437d[_0xb3ad('0x9')]+_0x4d437d['countdropretry']+_0x4d437d[_0xb3ad('0xa')]+_0x4d437d[_0xb3ad('0xb')]+_0x4d437d[_0xb3ad('0xc')];this[_0xb3ad('0x9')]=_0x4d437d[_0xb3ad('0x9')];this[_0xb3ad('0xd')]=_0x4d437d[_0xb3ad('0xd')];this[_0xb3ad('0xa')]=_0x4d437d[_0xb3ad('0xa')];this[_0xb3ad('0xb')]=_0x4d437d[_0xb3ad('0xb')];this[_0xb3ad('0xc')]=_0x4d437d[_0xb3ad('0xc')];this['uniqueid']=_0x46e1fd[_0xb3ad('0xe')];this[_0xb3ad('0xf')]=_0x4d437d[_0xb3ad('0x10')];this[_0xb3ad('0x11')]=_0x4d437d['number'];this[_0xb3ad('0x12')]=_0x4d437d['starttime'];this[_0xb3ad('0x13')]=_0x4d437d[_0xb3ad('0x13')];this['answertime']=_0x4d437d[_0xb3ad('0x14')];this[_0xb3ad('0x15')]=moment()[_0xb3ad('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb3ad('0x17')]=utils[_0xb3ad('0x18')](_0x4d437d['responsetime'],_0x4d437d[_0xb3ad('0x12')]);this[_0xb3ad('0x19')]=utils[_0xb3ad('0x18')](_0x4d437d[_0xb3ad('0x14')],_0x4d437d['responsetime']);this[_0xb3ad('0x1a')]=utils[_0xb3ad('0x18')](this['endtime'],_0x4d437d[_0xb3ad('0x14')]);this['queue']=_0x46e1fd[_0xb3ad('0x1b')];this[_0xb3ad('0x1c')]=_0x46e1fd['membername'];this['reason']=_0x46e1fd[_0xb3ad('0x1d')];this['callback']=_0x4d437d[_0xb3ad('0x1e')];this[_0xb3ad('0x1f')]=_0x4d437d['callbackuniqueid'];this[_0xb3ad('0x20')]=_0x4d437d[_0xb3ad('0x20')];this[_0xb3ad('0x21')]=_0x4d437d[_0xb3ad('0x21')];this[_0xb3ad('0x22')]=_0x4d437d['ContactId'];this[_0xb3ad('0x23')]=_0x4d437d['ListId'];this[_0xb3ad('0x24')]=_0x4d437d[_0xb3ad('0x24')];this[_0xb3ad('0x25')]=_0x4d437d['VoiceQueueId'];this[_0xb3ad('0x26')]=_0x4d437d['CampaignId'];this[_0xb3ad('0x27')]=_0x4d437d[_0xb3ad('0x27')]||'';this[_0xb3ad('0x28')]=_0x4d437d[_0xb3ad('0x28')]||'';this[_0xb3ad('0x29')]=_0x4d437d[_0xb3ad('0x29')];}module[_0xb3ad('0x2a')]=AgentComplete; \ No newline at end of file +var _0xa8e6=['callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xa8e6,0xe3));var _0x6a8e=function(_0x383048,_0xa84382){_0x383048=_0x383048-0x0;var _0x26d1e2=_0xa8e6[_0x383048];return _0x26d1e2;};'use strict';var moment=require(_0x6a8e('0x0'));var utils=require('../utils');function AgentComplete(_0x1f1515,_0x3912b1){this[_0x6a8e('0x1')]=0x4;this['statedesc']='Answer';this[_0x6a8e('0x2')]=_0x1f1515[_0x6a8e('0x2')];this[_0x6a8e('0x3')]=_0x1f1515[_0x6a8e('0x3')];this['campaigntype']=_0x1f1515[_0x6a8e('0x3')]===_0x6a8e('0x4')?_0x6a8e('0x5'):_0x1f1515[_0x6a8e('0x3')];this[_0x6a8e('0x6')]=_0x1f1515[_0x6a8e('0x6')];this['countcongestionretry']=_0x1f1515[_0x6a8e('0x7')];this['countnoanswerretry']=_0x1f1515[_0x6a8e('0x8')];this[_0x6a8e('0x9')]=_0x1f1515[_0x6a8e('0x6')]+_0x1f1515[_0x6a8e('0x7')]+_0x1f1515[_0x6a8e('0x8')]+_0x1f1515['countnosuchnumberretry']+_0x1f1515['countdropretry']+_0x1f1515[_0x6a8e('0xa')]+_0x1f1515['countmachineretry']+_0x1f1515[_0x6a8e('0xb')];this[_0x6a8e('0xc')]=_0x1f1515[_0x6a8e('0xc')];this[_0x6a8e('0xd')]=_0x1f1515['countdropretry'];this['countabandonedretry']=_0x1f1515['countabandonedretry'];this['countmachineretry']=_0x1f1515[_0x6a8e('0xe')];this['countagentrejectretry']=_0x1f1515['countagentrejectretry'];this[_0x6a8e('0xf')]=_0x3912b1[_0x6a8e('0xf')];this[_0x6a8e('0x10')]=_0x1f1515[_0x6a8e('0x11')];this['calleridnum']=_0x1f1515[_0x6a8e('0x12')];this[_0x6a8e('0x13')]=_0x1f1515[_0x6a8e('0x13')];this[_0x6a8e('0x14')]=_0x1f1515[_0x6a8e('0x14')];this[_0x6a8e('0x15')]=_0x1f1515[_0x6a8e('0x15')];this[_0x6a8e('0x16')]=moment()[_0x6a8e('0x17')](_0x6a8e('0x18'));this[_0x6a8e('0x19')]=utils[_0x6a8e('0x1a')](_0x1f1515['responsetime'],_0x1f1515['starttime']);this[_0x6a8e('0x1b')]=utils['getSeconds'](_0x1f1515['answertime'],_0x1f1515[_0x6a8e('0x14')]);this[_0x6a8e('0x1c')]=utils['getSeconds'](this[_0x6a8e('0x16')],_0x1f1515['answertime']);this[_0x6a8e('0x5')]=_0x3912b1[_0x6a8e('0x5')];this[_0x6a8e('0x1d')]=_0x3912b1[_0x6a8e('0x1d')];this[_0x6a8e('0x1e')]=_0x3912b1[_0x6a8e('0x1e')];this[_0x6a8e('0x1f')]=_0x1f1515[_0x6a8e('0x1f')];this['callbackuniqueid']=_0x1f1515[_0x6a8e('0x20')];this['callbackat']=_0x1f1515['callbackat'];this[_0x6a8e('0x21')]=_0x1f1515[_0x6a8e('0x21')];this[_0x6a8e('0x22')]=_0x1f1515['ContactId'];this[_0x6a8e('0x23')]=_0x1f1515[_0x6a8e('0x23')];this[_0x6a8e('0x24')]=_0x1f1515[_0x6a8e('0x24')];this[_0x6a8e('0x25')]=_0x1f1515['VoiceQueueId'];this[_0x6a8e('0x26')]=_0x1f1515['CampaignId'];this['originatecalleridnum']=_0x1f1515[_0x6a8e('0x27')]||'';this[_0x6a8e('0x28')]=_0x1f1515['originatecalleridname']||'';this[_0x6a8e('0x29')]=_0x1f1515['agiafterat'];}module[_0x6a8e('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 0a650e3..565d863 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 _0x1d3d=['countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x5d7726,_0x57adac){var _0x521e1c=function(_0x3799a1){while(--_0x3799a1){_0x5d7726['push'](_0x5d7726['shift']());}};_0x521e1c(++_0x57adac);}(_0x1d3d,0x86));var _0xd1d3=function(_0x3121c0,_0x5f262a){_0x3121c0=_0x3121c0-0x0;var _0x51ef7c=_0x1d3d[_0x3121c0];return _0x51ef7c;};'use strict';function Final(_0x631a2c){this[_0xd1d3('0x0')]=_0x631a2c[_0xd1d3('0x0')];this[_0xd1d3('0x1')]=_0x631a2c[_0xd1d3('0x1')];this[_0xd1d3('0x2')]=_0x631a2c['type'];this[_0xd1d3('0x3')]=_0x631a2c['type']===_0xd1d3('0x4')?_0xd1d3('0x5'):_0x631a2c[_0xd1d3('0x2')];this[_0xd1d3('0x6')]=_0x631a2c[_0xd1d3('0x6')];this['countcongestionretry']=_0x631a2c[_0xd1d3('0x7')];this[_0xd1d3('0x8')]=_0x631a2c[_0xd1d3('0x8')];this[_0xd1d3('0x9')]=_0x631a2c[_0xd1d3('0x6')]+_0x631a2c[_0xd1d3('0x7')]+_0x631a2c[_0xd1d3('0x8')]+_0x631a2c['countnosuchnumberretry']+_0x631a2c['countdropretry']+_0x631a2c[_0xd1d3('0xa')]+_0x631a2c[_0xd1d3('0xb')]+_0x631a2c[_0xd1d3('0xc')];this[_0xd1d3('0xd')]=_0x631a2c['countnosuchnumberretry'];this[_0xd1d3('0xe')]=_0x631a2c[_0xd1d3('0xe')];this[_0xd1d3('0xa')]=_0x631a2c[_0xd1d3('0xa')];this[_0xd1d3('0xb')]=_0x631a2c['countmachineretry'];this[_0xd1d3('0xc')]=_0x631a2c[_0xd1d3('0xc')];this[_0xd1d3('0x5')]=_0x631a2c[_0xd1d3('0x5')];this[_0xd1d3('0xf')]=_0x631a2c[_0xd1d3('0xf')];this[_0xd1d3('0x10')]=_0x631a2c[_0xd1d3('0x10')];this[_0xd1d3('0x11')]=_0x631a2c[_0xd1d3('0x11')];this[_0xd1d3('0x12')]=_0x631a2c[_0xd1d3('0x12')];this[_0xd1d3('0x13')]=_0x631a2c['responsetime'];this[_0xd1d3('0x14')]=_0x631a2c['ringtime']||0x0;this[_0xd1d3('0x15')]=_0x631a2c[_0xd1d3('0x15')]||0x0;this[_0xd1d3('0x16')]=_0x631a2c['talktime']||0x0;this[_0xd1d3('0x17')]=_0x631a2c[_0xd1d3('0x17')];this[_0xd1d3('0x18')]=_0x631a2c['callbackuniqueid'];this['callbackat']=_0x631a2c['callbackat'];this['recallme']=_0x631a2c[_0xd1d3('0x19')];this[_0xd1d3('0x1a')]=_0x631a2c['ContactId'];this[_0xd1d3('0x1b')]=_0x631a2c['ListId'];this[_0xd1d3('0x1c')]=_0x631a2c['UserId'];this[_0xd1d3('0x1d')]=_0x631a2c[_0xd1d3('0x1d')];this[_0xd1d3('0x1e')]=_0x631a2c[_0xd1d3('0x1e')];this[_0xd1d3('0x1f')]=_0x631a2c[_0xd1d3('0x1f')]||'';this[_0xd1d3('0x20')]=_0x631a2c[_0xd1d3('0x20')]||'';this[_0xd1d3('0x21')]=_0x631a2c[_0xd1d3('0x21')];this[_0xd1d3('0x22')]=_0x631a2c[_0xd1d3('0x22')];}module[_0xd1d3('0x23')]=Final; \ No newline at end of file +var _0xadca=['state','statedesc','exports','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','endtime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0xadca,0x1d7));var _0xaadc=function(_0x1b6117,_0x39f1e5){_0x1b6117=_0x1b6117-0x0;var _0x8fa76c=_0xadca[_0x1b6117];return _0x8fa76c;};'use strict';function Final(_0x412717){this['uniqueid']=_0x412717['uniqueid'];this[_0xaadc('0x0')]=_0x412717['scheduledat'];this[_0xaadc('0x1')]=_0x412717[_0xaadc('0x1')];this[_0xaadc('0x2')]=_0x412717[_0xaadc('0x1')]===_0xaadc('0x3')?_0xaadc('0x4'):_0x412717['type'];this['countbusyretry']=_0x412717['countbusyretry'];this[_0xaadc('0x5')]=_0x412717['countcongestionretry'];this[_0xaadc('0x6')]=_0x412717[_0xaadc('0x6')];this[_0xaadc('0x7')]=_0x412717[_0xaadc('0x8')]+_0x412717[_0xaadc('0x5')]+_0x412717['countnoanswerretry']+_0x412717[_0xaadc('0x9')]+_0x412717[_0xaadc('0xa')]+_0x412717['countabandonedretry']+_0x412717[_0xaadc('0xb')]+_0x412717[_0xaadc('0xc')];this['countnosuchnumberretry']=_0x412717[_0xaadc('0x9')];this[_0xaadc('0xa')]=_0x412717[_0xaadc('0xa')];this[_0xaadc('0xd')]=_0x412717[_0xaadc('0xd')];this[_0xaadc('0xb')]=_0x412717['countmachineretry'];this['countagentrejectretry']=_0x412717['countagentrejectretry'];this[_0xaadc('0x4')]=_0x412717[_0xaadc('0x4')];this['calleridname']=_0x412717[_0xaadc('0xe')];this[_0xaadc('0xf')]=_0x412717[_0xaadc('0xf')];this[_0xaadc('0x10')]=_0x412717['starttime'];this['responsetime']=_0x412717['responsetime'];this[_0xaadc('0x11')]=_0x412717[_0xaadc('0x12')];this['ringtime']=_0x412717[_0xaadc('0x13')]||0x0;this['holdtime']=_0x412717[_0xaadc('0x14')]||0x0;this['talktime']=_0x412717[_0xaadc('0x15')]||0x0;this[_0xaadc('0x16')]=_0x412717[_0xaadc('0x16')];this[_0xaadc('0x17')]=_0x412717['callbackuniqueid'];this[_0xaadc('0x18')]=_0x412717['callbackat'];this['recallme']=_0x412717[_0xaadc('0x19')];this[_0xaadc('0x1a')]=_0x412717[_0xaadc('0x1a')];this[_0xaadc('0x1b')]=_0x412717[_0xaadc('0x1b')];this[_0xaadc('0x1c')]=_0x412717[_0xaadc('0x1c')];this['VoiceQueueId']=_0x412717[_0xaadc('0x1d')];this[_0xaadc('0x1e')]=_0x412717['CampaignId'];this[_0xaadc('0x1f')]=_0x412717[_0xaadc('0x1f')]||'';this['originatecalleridname']=_0x412717[_0xaadc('0x20')]||'';this[_0xaadc('0x21')]=_0x412717[_0xaadc('0x21')];this['statedesc']=_0x412717[_0xaadc('0x22')];}module[_0xaadc('0x23')]=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 4cd6d38..e38b762 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 _0xd674=['UserId','VoiceQueueId','CampaignId','exports','moment','../utils','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','endtime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x3b76f7,_0x566c53){var _0x43984e=function(_0x164f77){while(--_0x164f77){_0x3b76f7['push'](_0x3b76f7['shift']());}};_0x43984e(++_0x566c53);}(_0xd674,0x1bc));var _0x4d67=function(_0x250784,_0x58e8da){_0x250784=_0x250784-0x0;var _0xbe2a0f=_0xd674[_0x250784];return _0xbe2a0f;};'use strict';var moment=require(_0x4d67('0x0'));var utils=require(_0x4d67('0x1'));function Hangup(_0x39ee71,_0x2c785b){this['state']=0x4;this[_0x4d67('0x2')]=_0x4d67('0x3');this[_0x4d67('0x4')]=_0x39ee71[_0x4d67('0x4')];this[_0x4d67('0x5')]=_0x39ee71[_0x4d67('0x5')];this[_0x4d67('0x6')]=_0x39ee71['type']===_0x4d67('0x7')?_0x4d67('0x8'):_0x39ee71[_0x4d67('0x5')];this[_0x4d67('0x9')]=_0x39ee71['amd']||![];this[_0x4d67('0xa')]=_0x39ee71[_0x4d67('0xa')];this['countcongestionretry']=_0x39ee71['countcongestionretry'];this[_0x4d67('0xb')]=_0x39ee71[_0x4d67('0xb')];this[_0x4d67('0xc')]=_0x39ee71['countbusyretry']+_0x39ee71['countcongestionretry']+_0x39ee71['countnoanswerretry']+_0x39ee71[_0x4d67('0xd')]+_0x39ee71['countdropretry']+_0x39ee71[_0x4d67('0xe')]+_0x39ee71[_0x4d67('0xf')]+_0x39ee71[_0x4d67('0x10')];this[_0x4d67('0xd')]=_0x39ee71[_0x4d67('0xd')];this[_0x4d67('0x11')]=_0x39ee71[_0x4d67('0x11')];this['countabandonedretry']=_0x39ee71['countabandonedretry'];this[_0x4d67('0xf')]=_0x39ee71[_0x4d67('0xf')];this[_0x4d67('0x10')]=_0x39ee71['countagentrejectretry'];this[_0x4d67('0x12')]=_0x2c785b[_0x4d67('0x12')];this[_0x4d67('0x13')]=_0x39ee71[_0x4d67('0x14')];this[_0x4d67('0x15')]=_0x39ee71[_0x4d67('0x16')];this[_0x4d67('0x17')]=_0x39ee71[_0x4d67('0x17')];this[_0x4d67('0x18')]=_0x39ee71[_0x4d67('0x18')];this['endtime']=moment()[_0x4d67('0x19')](_0x4d67('0x1a'));this['ringtime']=utils[_0x4d67('0x1b')](_0x39ee71[_0x4d67('0x18')],_0x39ee71['starttime']);this[_0x4d67('0x1c')]=0x0;this[_0x4d67('0x1d')]=utils[_0x4d67('0x1b')](this[_0x4d67('0x1e')],_0x39ee71['responsetime']);this[_0x4d67('0x8')]=_0x39ee71[_0x4d67('0x8')];this['membername']=_0x4d67('0x1f');this[_0x4d67('0x20')]=_0x2c785b[_0x4d67('0x21')];this[_0x4d67('0x22')]=_0x39ee71[_0x4d67('0x22')];this[_0x4d67('0x23')]=_0x39ee71['callbackuniqueid'];this[_0x4d67('0x24')]=_0x39ee71[_0x4d67('0x24')];this[_0x4d67('0x25')]=_0x39ee71[_0x4d67('0x25')];this[_0x4d67('0x26')]=_0x39ee71['ContactId'];this[_0x4d67('0x27')]=_0x39ee71['ListId'];this[_0x4d67('0x28')]=_0x39ee71[_0x4d67('0x28')];this[_0x4d67('0x29')]=_0x39ee71['VoiceQueueId'];this[_0x4d67('0x2a')]=_0x39ee71['CampaignId'];}module[_0x4d67('0x2b')]=Hangup; \ No newline at end of file +var _0x8065=['../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','queue','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports'];(function(_0x4d7f3f,_0x4d2803){var _0x5d67cc=function(_0x2c37f4){while(--_0x2c37f4){_0x4d7f3f['push'](_0x4d7f3f['shift']());}};_0x5d67cc(++_0x4d2803);}(_0x8065,0x1ce));var _0x5806=function(_0xb6d7b9,_0x2ad427){_0xb6d7b9=_0xb6d7b9-0x0;var _0xdbfd51=_0x8065[_0xb6d7b9];return _0xdbfd51;};'use strict';var moment=require('moment');var utils=require(_0x5806('0x0'));function Hangup(_0x2e90d6,_0x7f4f1f){this[_0x5806('0x1')]=0x4;this[_0x5806('0x2')]=_0x5806('0x3');this[_0x5806('0x4')]=_0x2e90d6[_0x5806('0x4')];this[_0x5806('0x5')]=_0x2e90d6[_0x5806('0x5')];this[_0x5806('0x6')]=_0x2e90d6[_0x5806('0x5')]===_0x5806('0x7')?'queue':_0x2e90d6[_0x5806('0x5')];this[_0x5806('0x8')]=_0x2e90d6[_0x5806('0x8')]||![];this['countbusyretry']=_0x2e90d6[_0x5806('0x9')];this[_0x5806('0xa')]=_0x2e90d6[_0x5806('0xa')];this[_0x5806('0xb')]=_0x2e90d6[_0x5806('0xb')];this[_0x5806('0xc')]=_0x2e90d6[_0x5806('0x9')]+_0x2e90d6[_0x5806('0xa')]+_0x2e90d6[_0x5806('0xb')]+_0x2e90d6[_0x5806('0xd')]+_0x2e90d6[_0x5806('0xe')]+_0x2e90d6['countabandonedretry']+_0x2e90d6[_0x5806('0xf')]+_0x2e90d6['countagentrejectretry'];this[_0x5806('0xd')]=_0x2e90d6['countnosuchnumberretry'];this[_0x5806('0xe')]=_0x2e90d6[_0x5806('0xe')];this[_0x5806('0x10')]=_0x2e90d6[_0x5806('0x10')];this[_0x5806('0xf')]=_0x2e90d6['countmachineretry'];this[_0x5806('0x11')]=_0x2e90d6['countagentrejectretry'];this['uniqueid']=_0x7f4f1f[_0x5806('0x12')];this[_0x5806('0x13')]=_0x2e90d6[_0x5806('0x14')];this[_0x5806('0x15')]=_0x2e90d6[_0x5806('0x16')];this['starttime']=_0x2e90d6[_0x5806('0x17')];this[_0x5806('0x18')]=_0x2e90d6[_0x5806('0x18')];this[_0x5806('0x19')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x5806('0x1a')]=utils['getSeconds'](_0x2e90d6['responsetime'],_0x2e90d6[_0x5806('0x17')]);this[_0x5806('0x1b')]=0x0;this[_0x5806('0x1c')]=utils['getSeconds'](this[_0x5806('0x19')],_0x2e90d6[_0x5806('0x18')]);this[_0x5806('0x1d')]=_0x2e90d6[_0x5806('0x1d')];this['membername']=_0x5806('0x1e');this['reason']=_0x7f4f1f[_0x5806('0x1f')];this[_0x5806('0x20')]=_0x2e90d6[_0x5806('0x20')];this['callbackuniqueid']=_0x2e90d6[_0x5806('0x21')];this[_0x5806('0x22')]=_0x2e90d6[_0x5806('0x22')];this['recallme']=_0x2e90d6[_0x5806('0x23')];this[_0x5806('0x24')]=_0x2e90d6[_0x5806('0x24')];this[_0x5806('0x25')]=_0x2e90d6[_0x5806('0x25')];this[_0x5806('0x26')]=_0x2e90d6[_0x5806('0x26')];this['VoiceQueueId']=_0x2e90d6[_0x5806('0x27')];this[_0x5806('0x28')]=_0x2e90d6[_0x5806('0x28')];}module[_0x5806('0x29')]=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 2e1a128..ca2962c 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 _0x453d=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','queue','name','calleridnum','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback'];(function(_0x33baaf,_0x376960){var _0x42998b=function(_0x58b51c){while(--_0x58b51c){_0x33baaf['push'](_0x33baaf['shift']());}};_0x42998b(++_0x376960);}(_0x453d,0x110));var _0xd453=function(_0x5ac54b,_0x4e7231){_0x5ac54b=_0x5ac54b-0x0;var _0x38bcc3=_0x453d[_0x5ac54b];return _0x38bcc3;};'use strict';var utils=require('../utils');function History(_0x41b58a){this[_0xd453('0x0')]=_0x41b58a['uniqueid'];this['scheduledat']=_0x41b58a[_0xd453('0x1')]||undefined;this[_0xd453('0x2')]=_0x41b58a[_0xd453('0x2')];this[_0xd453('0x3')]=_0x41b58a['type']==='outbound'?'queue':_0x41b58a[_0xd453('0x2')];this[_0xd453('0x4')]=_0x41b58a['countbusyretry'];this[_0xd453('0x5')]=_0x41b58a[_0xd453('0x5')];this[_0xd453('0x6')]=_0x41b58a['countnoanswerretry'];this[_0xd453('0x7')]=_0x41b58a[_0xd453('0x4')]+_0x41b58a[_0xd453('0x5')]+_0x41b58a[_0xd453('0x6')]+_0x41b58a[_0xd453('0x8')]+_0x41b58a[_0xd453('0x9')]+_0x41b58a['countabandonedretry']+_0x41b58a['countmachineretry']+_0x41b58a[_0xd453('0xa')];this[_0xd453('0x8')]=_0x41b58a[_0xd453('0x8')];this[_0xd453('0x9')]=_0x41b58a[_0xd453('0x9')];this['countabandonedretry']=_0x41b58a[_0xd453('0xb')];this[_0xd453('0xc')]=_0x41b58a[_0xd453('0xc')];this[_0xd453('0xa')]=_0x41b58a[_0xd453('0xa')];this[_0xd453('0xd')]=_0x41b58a['queue'];this['calleridname']=_0x41b58a[_0xd453('0xe')];this[_0xd453('0xf')]=_0x41b58a['number'];this[_0xd453('0x10')]=_0x41b58a[_0xd453('0x10')];this['responsetime']=_0x41b58a[_0xd453('0x11')];this[_0xd453('0x12')]=_0x41b58a[_0xd453('0x11')];this[_0xd453('0x13')]=utils[_0xd453('0x14')](_0x41b58a[_0xd453('0x11')],_0x41b58a[_0xd453('0x10')]);this[_0xd453('0x15')]=0x0;this[_0xd453('0x16')]=0x0;this[_0xd453('0x17')]=_0x41b58a['callback'];this['callbackuniqueid']=_0x41b58a[_0xd453('0x18')];this[_0xd453('0x19')]=_0x41b58a[_0xd453('0x19')];this['recallme']=_0x41b58a[_0xd453('0x1a')];this[_0xd453('0x1b')]=_0x41b58a['ContactId'];this[_0xd453('0x1c')]=_0x41b58a[_0xd453('0x1c')];this['UserId']=_0x41b58a[_0xd453('0x1d')];this[_0xd453('0x1e')]=_0x41b58a[_0xd453('0x1e')];this[_0xd453('0x1f')]=_0x41b58a[_0xd453('0x1f')];this[_0xd453('0x20')]=_0x41b58a[_0xd453('0x20')]||'';this[_0xd453('0x21')]=_0x41b58a[_0xd453('0x21')]||'';this[_0xd453('0x22')]=_0x41b58a[_0xd453('0x22')];this[_0xd453('0x23')]=_0x41b58a[_0xd453('0x23')];}module[_0xd453('0x24')]=History; \ No newline at end of file +var _0x3c32=['originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','responsetime','endtime','getSeconds','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x3c32,0x149));var _0x23c3=function(_0xbdafc4,_0x31cb0e){_0xbdafc4=_0xbdafc4-0x0;var _0x167bbe=_0x3c32[_0xbdafc4];return _0x167bbe;};'use strict';var utils=require('../utils');function History(_0x14c501){this[_0x23c3('0x0')]=_0x14c501[_0x23c3('0x0')];this[_0x23c3('0x1')]=_0x14c501[_0x23c3('0x1')]||undefined;this[_0x23c3('0x2')]=_0x14c501[_0x23c3('0x2')];this[_0x23c3('0x3')]=_0x14c501[_0x23c3('0x2')]===_0x23c3('0x4')?_0x23c3('0x5'):_0x14c501[_0x23c3('0x2')];this['countbusyretry']=_0x14c501[_0x23c3('0x6')];this[_0x23c3('0x7')]=_0x14c501['countcongestionretry'];this[_0x23c3('0x8')]=_0x14c501[_0x23c3('0x8')];this[_0x23c3('0x9')]=_0x14c501[_0x23c3('0x6')]+_0x14c501[_0x23c3('0x7')]+_0x14c501[_0x23c3('0x8')]+_0x14c501[_0x23c3('0xa')]+_0x14c501[_0x23c3('0xb')]+_0x14c501['countabandonedretry']+_0x14c501[_0x23c3('0xc')]+_0x14c501[_0x23c3('0xd')];this['countnosuchnumberretry']=_0x14c501[_0x23c3('0xa')];this[_0x23c3('0xb')]=_0x14c501['countdropretry'];this[_0x23c3('0xe')]=_0x14c501[_0x23c3('0xe')];this[_0x23c3('0xc')]=_0x14c501[_0x23c3('0xc')];this[_0x23c3('0xd')]=_0x14c501['countagentrejectretry'];this[_0x23c3('0x5')]=_0x14c501[_0x23c3('0x5')];this[_0x23c3('0xf')]=_0x14c501['name'];this[_0x23c3('0x10')]=_0x14c501['number'];this['starttime']=_0x14c501['starttime'];this[_0x23c3('0x11')]=_0x14c501[_0x23c3('0x11')];this[_0x23c3('0x12')]=_0x14c501['responsetime'];this['ringtime']=utils[_0x23c3('0x13')](_0x14c501['responsetime'],_0x14c501[_0x23c3('0x14')]);this[_0x23c3('0x15')]=0x0;this[_0x23c3('0x16')]=0x0;this[_0x23c3('0x17')]=_0x14c501[_0x23c3('0x17')];this[_0x23c3('0x18')]=_0x14c501[_0x23c3('0x18')];this[_0x23c3('0x19')]=_0x14c501[_0x23c3('0x19')];this[_0x23c3('0x1a')]=_0x14c501[_0x23c3('0x1a')];this['ContactId']=_0x14c501['ContactId'];this['ListId']=_0x14c501[_0x23c3('0x1b')];this[_0x23c3('0x1c')]=_0x14c501[_0x23c3('0x1c')];this['VoiceQueueId']=_0x14c501[_0x23c3('0x1d')];this['CampaignId']=_0x14c501[_0x23c3('0x1e')];this['originatecalleridnum']=_0x14c501[_0x23c3('0x1f')]||'';this[_0x23c3('0x20')]=_0x14c501[_0x23c3('0x20')]||'';this[_0x23c3('0x21')]=_0x14c501[_0x23c3('0x21')];this[_0x23c3('0x22')]=_0x14c501['statedesc'];}module[_0x23c3('0x23')]=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 868fa3e..84aa401 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 _0xbd33=['state','statedesc','exports','../utils','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridnum','number','starttime','responsetime','dropreason','endtime','getSeconds','droptime','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat'];(function(_0x272af8,_0x3da8d1){var _0x520402=function(_0x30a8a2){while(--_0x30a8a2){_0x272af8['push'](_0x272af8['shift']());}};_0x520402(++_0x3da8d1);}(_0xbd33,0x162));var _0x3bd3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbd33[_0x20a584];return _0x4b41a8;};'use strict';var utils=require(_0x3bd3('0x0'));function QueueCallerAbandon(_0x259af2,_0x2a8aa6){this['scheduledat']=_0x259af2[_0x3bd3('0x1')];this[_0x3bd3('0x2')]=_0x259af2[_0x3bd3('0x2')];this[_0x3bd3('0x3')]=_0x259af2[_0x3bd3('0x2')]==='outbound'?'queue':_0x259af2[_0x3bd3('0x2')];this[_0x3bd3('0x4')]=_0x259af2['countbusyretry'];this[_0x3bd3('0x5')]=_0x259af2[_0x3bd3('0x5')];this[_0x3bd3('0x6')]=_0x259af2[_0x3bd3('0x6')];this[_0x3bd3('0x7')]=_0x259af2[_0x3bd3('0x4')]+_0x259af2[_0x3bd3('0x5')]+_0x259af2[_0x3bd3('0x6')]+_0x259af2[_0x3bd3('0x8')]+_0x259af2[_0x3bd3('0x9')]+_0x259af2['countabandonedretry']+_0x259af2[_0x3bd3('0xa')]+_0x259af2[_0x3bd3('0xb')];this[_0x3bd3('0x8')]=_0x259af2[_0x3bd3('0x8')];this[_0x3bd3('0x9')]=_0x259af2[_0x3bd3('0x9')];this[_0x3bd3('0xc')]=_0x259af2[_0x3bd3('0xc')];this[_0x3bd3('0xa')]=_0x259af2[_0x3bd3('0xa')];this[_0x3bd3('0xb')]=_0x259af2[_0x3bd3('0xb')];this['uniqueid']=_0x2a8aa6['uniqueid'];this['calleridname']=_0x259af2['name'];this[_0x3bd3('0xd')]=_0x259af2[_0x3bd3('0xe')];this[_0x3bd3('0xf')]=_0x259af2[_0x3bd3('0xf')];this['responsetime']=_0x259af2[_0x3bd3('0x10')];this['droptime']=_0x259af2['droptime'];this[_0x3bd3('0x11')]=_0x259af2[_0x3bd3('0x11')];this[_0x3bd3('0x12')]=this['droptime'];this['ringtime']=utils[_0x3bd3('0x13')](_0x259af2[_0x3bd3('0x10')],_0x259af2[_0x3bd3('0xf')]);this['holdtime']=utils['getSeconds'](this[_0x3bd3('0x14')],_0x259af2[_0x3bd3('0x10')]);this[_0x3bd3('0x15')]=0x0;this[_0x3bd3('0x16')]=_0x2a8aa6['queue'];this['membername']=_0x2a8aa6[_0x3bd3('0x17')];this[_0x3bd3('0x18')]=_0x2a8aa6[_0x3bd3('0x18')];this[_0x3bd3('0x19')]=_0x259af2[_0x3bd3('0x19')];this[_0x3bd3('0x1a')]=_0x259af2[_0x3bd3('0x1a')];this[_0x3bd3('0x1b')]=_0x259af2[_0x3bd3('0x1b')];this[_0x3bd3('0x1c')]=_0x259af2[_0x3bd3('0x1c')];this[_0x3bd3('0x1d')]=_0x259af2[_0x3bd3('0x1d')];this['ListId']=_0x259af2[_0x3bd3('0x1e')];this['UserId']=_0x259af2[_0x3bd3('0x1f')];this[_0x3bd3('0x20')]=_0x259af2[_0x3bd3('0x20')];this[_0x3bd3('0x21')]=_0x259af2[_0x3bd3('0x21')];this[_0x3bd3('0x22')]=_0x259af2[_0x3bd3('0x22')]||'';this['originatecalleridname']=_0x259af2['originatecalleridname']||'';this[_0x3bd3('0x23')]=_0x259af2[_0x3bd3('0x23')];this[_0x3bd3('0x24')]=_0x259af2['state'];this[_0x3bd3('0x25')]=_0x259af2[_0x3bd3('0x25')];}module[_0x3bd3('0x26')]=QueueCallerAbandon; \ No newline at end of file +var _0x9863=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','queue','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','getSeconds','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x1b4389,_0x291c44){var _0x55de9f=function(_0x510f35){while(--_0x510f35){_0x1b4389['push'](_0x1b4389['shift']());}};_0x55de9f(++_0x291c44);}(_0x9863,0x160));var _0x3986=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9863[_0x59ee6f];return _0x4c0979;};'use strict';var utils=require(_0x3986('0x0'));function QueueCallerAbandon(_0x409ab6,_0x46b82d){this[_0x3986('0x1')]=_0x409ab6['scheduledat'];this[_0x3986('0x2')]=_0x409ab6[_0x3986('0x2')];this[_0x3986('0x3')]=_0x409ab6['type']==='outbound'?_0x3986('0x4'):_0x409ab6[_0x3986('0x2')];this['countbusyretry']=_0x409ab6['countbusyretry'];this[_0x3986('0x5')]=_0x409ab6['countcongestionretry'];this[_0x3986('0x6')]=_0x409ab6['countnoanswerretry'];this[_0x3986('0x7')]=_0x409ab6['countbusyretry']+_0x409ab6['countcongestionretry']+_0x409ab6['countnoanswerretry']+_0x409ab6[_0x3986('0x8')]+_0x409ab6[_0x3986('0x9')]+_0x409ab6['countabandonedretry']+_0x409ab6[_0x3986('0xa')]+_0x409ab6['countagentrejectretry'];this[_0x3986('0x8')]=_0x409ab6[_0x3986('0x8')];this[_0x3986('0x9')]=_0x409ab6['countdropretry'];this['countabandonedretry']=_0x409ab6[_0x3986('0xb')];this[_0x3986('0xa')]=_0x409ab6['countmachineretry'];this[_0x3986('0xc')]=_0x409ab6[_0x3986('0xc')];this[_0x3986('0xd')]=_0x46b82d['uniqueid'];this[_0x3986('0xe')]=_0x409ab6[_0x3986('0xf')];this[_0x3986('0x10')]=_0x409ab6[_0x3986('0x11')];this[_0x3986('0x12')]=_0x409ab6[_0x3986('0x12')];this['responsetime']=_0x409ab6[_0x3986('0x13')];this[_0x3986('0x14')]=_0x409ab6['droptime'];this[_0x3986('0x15')]=_0x409ab6[_0x3986('0x15')];this[_0x3986('0x16')]=this[_0x3986('0x14')];this['ringtime']=utils[_0x3986('0x17')](_0x409ab6[_0x3986('0x13')],_0x409ab6[_0x3986('0x12')]);this[_0x3986('0x18')]=utils['getSeconds'](this[_0x3986('0x14')],_0x409ab6[_0x3986('0x13')]);this[_0x3986('0x19')]=0x0;this[_0x3986('0x4')]=_0x46b82d[_0x3986('0x4')];this['membername']=_0x46b82d[_0x3986('0x1a')];this['reason']=_0x46b82d[_0x3986('0x1b')];this[_0x3986('0x1c')]=_0x409ab6[_0x3986('0x1c')];this[_0x3986('0x1d')]=_0x409ab6[_0x3986('0x1d')];this[_0x3986('0x1e')]=_0x409ab6['callbackat'];this['recallme']=_0x409ab6[_0x3986('0x1f')];this[_0x3986('0x20')]=_0x409ab6['ContactId'];this[_0x3986('0x21')]=_0x409ab6[_0x3986('0x21')];this['UserId']=_0x409ab6[_0x3986('0x22')];this[_0x3986('0x23')]=_0x409ab6[_0x3986('0x23')];this[_0x3986('0x24')]=_0x409ab6[_0x3986('0x24')];this[_0x3986('0x25')]=_0x409ab6['originatecalleridnum']||'';this[_0x3986('0x26')]=_0x409ab6['originatecalleridname']||'';this[_0x3986('0x27')]=_0x409ab6['agiafterat'];this[_0x3986('0x28')]=_0x409ab6['state'];this[_0x3986('0x29')]=_0x409ab6[_0x3986('0x29')];}module[_0x3986('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 1ce3f29..ff7baf4 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 _0xdb28=['createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','temp','error','[getContactDialer]','dialOrderByScheduledAt','catch','[getContactDialerIvr]','countReScheduled','rescheduleContact','[rescheduleContact]','[unlockContact]','unlockContact','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xdb28,0x106));var _0x8db2=function(_0x3e8042,_0x29844e){_0x3e8042=_0x3e8042-0x0;var _0x42e179=_0xdb28[_0x3e8042];return _0x42e179;};'use strict';var util=require(_0x8db2('0x0'));var logger=require(_0x8db2('0x1'))(_0x8db2('0x2'));var cmHopper=require(_0x8db2('0x3'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x8db2('0x4'));var cmHopperHistory=require(_0x8db2('0x5'));function inspectError(_0xfcf49f){return util[_0x8db2('0x6')](_0xfcf49f,{'showHidden':![],'depth':null});}function getContactDialer(_0x11109e,_0x52bf99,_0x21a03e){return cmHopper[_0x8db2('0x7')](_0x11109e['id'],_0x52bf99,_0x21a03e,_0x11109e['dialOrderByScheduledAt'])['catch'](function(_0x477f50){_0x11109e[_0x8db2('0x8')]=0x0;logger[_0x8db2('0x9')](_0x8db2('0xa'),inspectError(_0x477f50));});}exports[_0x8db2('0x7')]=getContactDialer;function getContactDialerIvr(_0x1ff362,_0x126c78){return cmHopper['getContactDialerIvr'](_0x1ff362['id'],_0x126c78,_0x1ff362[_0x8db2('0xb')])[_0x8db2('0xc')](function(_0x1f62af){_0x1ff362['temp']=0x0;logger[_0x8db2('0x9')](_0x8db2('0xd'),inspectError(_0x1f62af));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x41beda){return cmHopper[_0x8db2('0xe')](_0x41beda)[_0x8db2('0xc')](function(_0x204f49){logger[_0x8db2('0x9')]('[countReScheduled]',inspectError(_0x204f49));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x15070d){return cmHopper[_0x8db2('0xf')](_0x15070d)[_0x8db2('0xc')](function(_0x1d6a15){logger[_0x8db2('0x9')](_0x8db2('0x10'),inspectError(_0x1d6a15));});}exports[_0x8db2('0xf')]=rescheduleContact;function unlockContact(_0x3c96a7,_0x131252,_0x16c8c2){return cmHopper['unlockContact'](_0x3c96a7,_0x131252,_0x16c8c2)[_0x8db2('0xc')](function(_0x24da1b){logger['error'](_0x8db2('0x11'),inspectError(_0x24da1b));});}exports[_0x8db2('0x12')]=unlockContact;function moveContactManagedDialer(_0x21db8c){return cmHopper[_0x8db2('0x13')](_0x21db8c)[_0x8db2('0xc')](function(_0x46ce14){logger['error']('[moveContactManagedDialer]',inspectError(_0x46ce14));});}exports[_0x8db2('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x104e33){return cmHopperBlack[_0x8db2('0x14')](_0x104e33)[_0x8db2('0xc')](function(_0x58562e){logger[_0x8db2('0x9')](_0x8db2('0x15'),inspectError(_0x58562e));});}exports[_0x8db2('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x297ba3){return cmHopperBlack[_0x8db2('0x16')](_0x297ba3)['catch'](function(_0x124467){logger[_0x8db2('0x9')](_0x8db2('0x17'),inspectError(_0x124467));});}exports[_0x8db2('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2260d8,_0x21704c,_0x796ec1){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x2260d8,_0x21704c,_0x796ec1)[_0x8db2('0xc')](function(_0x4f6516){logger['error']('[verifyAdditionalPhone]',inspectError(_0x4f6516));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xec8cd2,_0x29b5cd,_0x3be281){return cmHopperAdditionalPhone[_0x8db2('0x18')](_0xec8cd2,_0x29b5cd,_0x3be281)[_0x8db2('0xc')](function(_0x8d4f54){logger['error'](_0x8db2('0x19'),inspectError(_0x8d4f54));});}exports[_0x8db2('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x430dd5){return cmHopperHistory[_0x8db2('0x1a')](_0x430dd5)['catch'](function(_0x2e0691){logger[_0x8db2('0x9')](_0x8db2('0x1b'),inspectError(_0x2e0691));});}exports[_0x8db2('0x1a')]=avgHandleTime;function createHistory(_0xbe5ece){return cmHopperHistory[_0x8db2('0x1c')](_0xbe5ece)[_0x8db2('0xc')](function(_0x3124d5){logger[_0x8db2('0x9')]('[createHistory]',inspectError(_0x3124d5));});}exports[_0x8db2('0x1c')]=createHistory; \ No newline at end of file +var _0x5fdc=['dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','[getContactDialer]','temp','error','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','swapAdditionalPhones','[avgHandleTime]','avgHandleTime','[createHistory]','createHistory','util','../../../../config/logger'];(function(_0x150a25,_0x393c27){var _0x3d3f41=function(_0x38be66){while(--_0x38be66){_0x150a25['push'](_0x150a25['shift']());}};_0x3d3f41(++_0x393c27);}(_0x5fdc,0x127));var _0xc5fd=function(_0x37869a,_0x1944fa){_0x37869a=_0x37869a-0x0;var _0x2d64df=_0x5fdc[_0x37869a];return _0x2d64df;};'use strict';var util=require(_0xc5fd('0x0'));var logger=require(_0xc5fd('0x1'))(_0xc5fd('0x2'));var cmHopper=require(_0xc5fd('0x3'));var cmHopperAdditionalPhone=require(_0xc5fd('0x4'));var cmHopperBlack=require(_0xc5fd('0x5'));var cmHopperHistory=require(_0xc5fd('0x6'));function inspectError(_0x4d015c){return util[_0xc5fd('0x7')](_0x4d015c,{'showHidden':![],'depth':null});}function getContactDialer(_0x1b6205,_0xca27a0,_0xea5748){return cmHopper[_0xc5fd('0x8')](_0x1b6205['id'],_0xca27a0,_0xea5748,_0x1b6205[_0xc5fd('0x9')])[_0xc5fd('0xa')](function(_0x5a2eb4){_0x1b6205['temp']=0x0;logger['error'](_0xc5fd('0xb'),inspectError(_0x5a2eb4));});}exports[_0xc5fd('0x8')]=getContactDialer;function getContactDialerIvr(_0x158e58,_0x45c91f){return cmHopper['getContactDialerIvr'](_0x158e58['id'],_0x45c91f,_0x158e58['dialOrderByScheduledAt'])[_0xc5fd('0xa')](function(_0x1edeec){_0x158e58[_0xc5fd('0xc')]=0x0;logger[_0xc5fd('0xd')](_0xc5fd('0xe'),inspectError(_0x1edeec));});}exports[_0xc5fd('0xf')]=getContactDialerIvr;function countReScheduled(_0x484bbd){return cmHopper[_0xc5fd('0x10')](_0x484bbd)['catch'](function(_0x558939){logger[_0xc5fd('0xd')](_0xc5fd('0x11'),inspectError(_0x558939));});}exports[_0xc5fd('0x10')]=countReScheduled;function rescheduleContact(_0x23ac5d){return cmHopper[_0xc5fd('0x12')](_0x23ac5d)[_0xc5fd('0xa')](function(_0x27447e){logger[_0xc5fd('0xd')]('[rescheduleContact]',inspectError(_0x27447e));});}exports[_0xc5fd('0x12')]=rescheduleContact;function unlockContact(_0x103c3d,_0x2221da,_0x3404e0){return cmHopper['unlockContact'](_0x103c3d,_0x2221da,_0x3404e0)['catch'](function(_0x4efafd){logger['error']('[unlockContact]',inspectError(_0x4efafd));});}exports[_0xc5fd('0x13')]=unlockContact;function moveContactManagedDialer(_0x430e52){return cmHopper[_0xc5fd('0x14')](_0x430e52)[_0xc5fd('0xa')](function(_0x2ee392){logger[_0xc5fd('0xd')](_0xc5fd('0x15'),inspectError(_0x2ee392));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0xb7bab1){return cmHopperBlack[_0xc5fd('0x16')](_0xb7bab1)[_0xc5fd('0xa')](function(_0x9c12e4){logger[_0xc5fd('0xd')]('[checkIsBlackList]',inspectError(_0x9c12e4));});}exports[_0xc5fd('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x24e5e9){return cmHopperBlack[_0xc5fd('0x17')](_0x24e5e9)[_0xc5fd('0xa')](function(_0x5a7bdc){logger['error'](_0xc5fd('0x18'),inspectError(_0x5a7bdc));});}exports[_0xc5fd('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x3d7211,_0x42d7f4,_0x334401){return cmHopperAdditionalPhone[_0xc5fd('0x19')](_0x3d7211,_0x42d7f4,_0x334401)['catch'](function(_0x1a3f21){logger[_0xc5fd('0xd')](_0xc5fd('0x1a'),inspectError(_0x1a3f21));});}exports[_0xc5fd('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x39bb5e,_0x4020af,_0x475b91){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x39bb5e,_0x4020af,_0x475b91)[_0xc5fd('0xa')](function(_0x48cd1d){logger[_0xc5fd('0xd')](_0xc5fd('0x1b'),inspectError(_0x48cd1d));});}exports[_0xc5fd('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x2bee22){return cmHopperHistory['avgHandleTime'](_0x2bee22)[_0xc5fd('0xa')](function(_0x1bbdc4){logger[_0xc5fd('0xd')](_0xc5fd('0x1d'),inspectError(_0x1bbdc4));});}exports[_0xc5fd('0x1e')]=avgHandleTime;function createHistory(_0x209975){return cmHopperHistory['createHistory'](_0x209975)[_0xc5fd('0xa')](function(_0x5d4f70){logger['error'](_0xc5fd('0x1f'),inspectError(_0x5d4f70));});}exports[_0xc5fd('0x20')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index a5b3c9c..f38f0ef 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 _0x971d=['checkContactLowerLimitOriginate','createdAt','updatedAt','undefined','description','toUpperCase','toString','substring','XMD-','moment','../../../../config/logger','../../../../config/environment/shared','timezones','BLACKLIST','IS_DISACTIVED','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','isNil','Interval','Intervals','isEmpty','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','ACTIVE','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','isUndefined','format','\x22%s\x22\x20<%s>','string','getCallerId','pow','replace','random','error','[decrementOriginate]\x20queue\x20originate\x20value','length','[checkContactLowerLimitOriginate]\x20'];(function(_0x1468d5,_0x27eb4b){var _0x550f83=function(_0x3fecce){while(--_0x3fecce){_0x1468d5['push'](_0x1468d5['shift']());}};_0x550f83(++_0x27eb4b);}(_0x971d,0x1a3));var _0xd971=function(_0x4e5597,_0xf42177){_0x4e5597=_0x4e5597-0x0;var _0x5654f9=_0x971d[_0x4e5597];return _0x5654f9;};'use strict';var _=require('lodash');var moment=require(_0xd971('0x0'));var util=require('util');var logger=require(_0xd971('0x1'))('dialer');var timezones=require(_0xd971('0x2'))[_0xd971('0x3')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xd971('0x4'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0xd971('0x5'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0xd971('0x6'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xd971('0x7'),'NULL_INTERVAL':_0xd971('0x8'),'OVERTIME_INTERVAL':_0xd971('0x9'),'OVERTIME_GLOBAL_INTERVAL':_0xd971('0xa'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xd971('0xb'),'RUNNING':_0xd971('0xc'),'UNKNOWN_TIMEZONE':_0xd971('0xd'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xd971('0xe')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x330117){return _0x330117[_0xd971('0xf')]===_0xd971('0x10');}exports[_0xd971('0x11')]=isPreviewCampaign;function isIVRCampaign(_0x15face){return _0x15face[_0xd971('0x12')]===_0xd971('0x13');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x5940f0){return _0x5940f0[_0xd971('0x12')]===_0xd971('0x14');}exports[_0xd971('0x15')]=isOutboundQueue;function isQueueCampaignActive(_0x987d3f){return _0x987d3f[_0xd971('0x16')];}exports[_0xd971('0x17')]=isQueueCampaignActive;function isIVRCampaignActive(_0x38b2d6){return _0x38b2d6['active'];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0xf2df45,_0x2a8e1e){var _0x5aee08=moment(_0xf2df45)[_0xd971('0x18')](0x0);var _0x6b39e2=moment(_0x2a8e1e)[_0xd971('0x18')](0x0);return _0x5aee08[_0xd971('0x19')](_0x6b39e2,_0xd971('0x1a'));}exports[_0xd971('0x1b')]=getSeconds;function hasQueueCampaignDataChanged(_0x22476d,_0x4ba093){var _0x41c514=![];var _0x32e3df=_0x22476d[_0xd971('0xf')]!==_0x4ba093['dialMethod']||_0x22476d[_0xd971('0x16')]!==_0x4ba093[_0xd971('0x16')]||_0x22476d[_0xd971('0x1c')]!==_0x4ba093[_0xd971('0x1c')];var _0x1728c9=_0x22476d[_0xd971('0x1d')]!==_0x4ba093[_0xd971('0x1d')]||_0x22476d[_0xd971('0x1e')]!==_0x4ba093[_0xd971('0x1e')]||_0x22476d['loggedInDb']!==_0x4ba093['loggedInDb']||_0x22476d[_0xd971('0x1f')]!==_0x4ba093['paused']||_0x22476d[_0xd971('0x20')]!==_0x4ba093[_0xd971('0x20')]||_0x22476d[_0xd971('0x21')]!==_0x4ba093[_0xd971('0x21')]||_0x22476d[_0xd971('0x22')]!==_0x4ba093['waiting']||_0x22476d[_0xd971('0x23')]!==_0x4ba093[_0xd971('0x23')]||_0x22476d[_0xd971('0x24')]!==_0x4ba093[_0xd971('0x24')];if(_0x22476d[_0xd971('0x25')]&&_0x4ba093['Trunk']){_0x41c514=_0x22476d[_0xd971('0x25')][_0xd971('0x26')]!==_0x4ba093[_0xd971('0x25')]['name']||_0x22476d['Trunk'][_0xd971('0x27')]!==_0x4ba093[_0xd971('0x25')]['active'];}return _0x32e3df||_0x1728c9||_0x41c514;}exports[_0xd971('0x28')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x537cfd){var _0x302b92=null;var _0x358dc3=_0x537cfd[_0xd971('0x29')];if(_['isNil'](_0x537cfd[_0xd971('0x2a')])||_[_0xd971('0x2b')](_0x537cfd[_0xd971('0x2c')])||_[_0xd971('0x2b')](_0x537cfd[_0xd971('0x2c')][_0xd971('0x2d')])){_0x302b92=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xd971('0x2e')](_0x537cfd[_0xd971('0x2a')])||_[_0xd971('0x2e')](_0x537cfd[_0xd971('0x2c')][_0xd971('0x2d')])){_0x302b92=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x358dc3&&!timezones[_0x358dc3]){_0x302b92=CAMPAIGN_STATUS[_0xd971('0x2f')];}return _0x302b92;}function checkAnyValidTrunk(_0x95cadc,_0x11bec1){var _0x5d2b98=null;var _0xf74b6b=_0xd971('0x30');var _0x5ced31=[_0xd971('0x31'),_0xd971('0x32')];var _0x5ac11c=!![];if(_0x95cadc[_0xd971('0x25')]&&_0x95cadc[_0xd971('0x25')][_0xd971('0x27')]){_0xf74b6b+=_0x95cadc['Trunk'][_0xd971('0x26')];_0x5d2b98=_0x11bec1[_0xf74b6b];_0x5ac11c=_0x5ced31[_0xd971('0x33')](_0x5d2b98[_0xd971('0x34')]);}else if(_0x95cadc[_0xd971('0x35')]&&_0x95cadc['TrunkBackup'][_0xd971('0x27')]){_0xf74b6b+=_0x95cadc[_0xd971('0x35')]['name'];_0x5d2b98=_0x11bec1[_0xf74b6b];_0x5ac11c=_0x5ced31[_0xd971('0x33')](_0x5d2b98[_0xd971('0x34')]);}return _0x5ac11c;}function getQueueCampaignStatusMessage(_0x426057,_0x3a185d){var _0x3c1c99=CAMPAIGN_STATUS[_0xd971('0x36')];var _0x4b077a=isPreviewCampaign(_0x426057);if(!isQueueCampaignActive(_0x426057)){if(_0x4b077a){_0x3c1c99=CAMPAIGN_STATUS[_0xd971('0x37')];}else{if(_0x426057[_0xd971('0x24')]===0x0&&_0x426057['talking']===0x0&&_0x426057['waiting']===0x0&&(_0x426057[_0xd971('0x21')]||0x0)===0x0){_0x3c1c99=CAMPAIGN_STATUS[_0xd971('0x37')];}else{_0x3c1c99=CAMPAIGN_STATUS[_0xd971('0x38')];}}}else if(_0x426057[_0xd971('0x1e')]===0x0){_0x3c1c99=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x426057,_0x3a185d)){_0x3c1c99=CAMPAIGN_STATUS[_0xd971('0x39')];}else if(!isPreviewCampaign(_0x426057)){var _0x190395=checkAnyValidQueueCampaignInterval(_0x426057);if(_0x190395){_0x3c1c99=_0x190395;}}return _0x3c1c99;}exports[_0xd971('0x3a')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x19d55b){var _0xc45644=CAMPAIGN_STATUS[_0xd971('0x38')];if(_0x19d55b[_0xd971('0x24')]===0x0&&_0x19d55b['talking']===0x0&&_0x19d55b[_0xd971('0x22')]===0x0&&(_0x19d55b['pTalking']||0x0)===0x0){_0xc45644=CAMPAIGN_STATUS['INACTIVE'];}return _0xc45644;}exports[_0xd971('0x3b')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x4ae420){var _0x4e88de=_0x4ae420[_0xd971('0x3c')](/"(.*?)"/);return _0x4e88de?_0x4e88de[0x1]:_0x4ae420;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x19a264,_0x5ef0e4,_0x1167db){if(!_[_0xd971('0x3d')](_0x1167db)&&typeof _0x1167db==='string'&&!_['isEmpty'](_0x1167db)){if(!_[_0xd971('0x3d')](_0x5ef0e4)&&typeof _0x5ef0e4==='string'&&!_[_0xd971('0x2e')](_0x5ef0e4)){return util['format']('\x22%s\x22\x20<%s>',_0x5ef0e4,_0x1167db);}return util[_0xd971('0x3e')](_0xd971('0x3f'),_0x1167db,_0x1167db);}if(!_[_0xd971('0x3d')](_0x19a264)&&typeof _0x19a264===_0xd971('0x40')&&!_[_0xd971('0x2e')](_0x19a264)){return _0x19a264;}return'\x22\x22\x20<>';}exports[_0xd971('0x41')]=getCallerId;function getCallerIdRandom(_0x2e7541,_0x154b87){var _0xefead6;var _0x53c474;var _0x13b105;if(_0x154b87<=0x0){_0x154b87=0x1;}_0xefead6=new RegExp('\x5cw{0,'+_0x154b87+'}$');_0x53c474=Math[_0xd971('0x42')](0xa,_0x154b87-0x1);_0x13b105=Math[_0xd971('0x42')](0xa,_0x154b87)-0x1;return util[_0xd971('0x3e')]('%s',_[_0xd971('0x43')](_0x2e7541,_0xefead6,_[_0xd971('0x44')](_0x53c474,_0x13b105)['toString']()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x41460d,_0x113cb9){if(_0x41460d[_0xd971('0x24')]&&_0x41460d[_0xd971('0x24')]>0x0){_0x41460d[_0xd971('0x24')]-=0x1;}else{logger[_0xd971('0x45')](_0xd971('0x46'),_0x113cb9);}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x4b3787){return _0x4b3787&&_0x4b3787[_0xd971('0x47')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x323d07,_0x2e855b){if(_0x2e855b===0x0){return 0x0;}var _0x24c1c7=0x1;for(var _0x1404bc=0x1;_0x1404bc<=_0x2e855b;_0x1404bc+=0x1){_0x24c1c7=0x1+_0x24c1c7*_0x1404bc/_0x323d07;}return 0x1/_0x24c1c7;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x4d5b7b,_0xcde3a3,_0x1875c6){if(_0xcde3a3>_0x1875c6){for(var _0x3f0c30=0x0;_0x3f0c30<_0xcde3a3-_0x1875c6;_0x3f0c30+=0x1){decrementOriginate(_0x4d5b7b,_0xd971('0x48'));}}}exports[_0xd971('0x49')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x2ec52f){var _0x29a189={};var _0x336453=['id',_0xd971('0x4a'),'tags',_0xd971('0x4b')];const _0x40dd75=0xfa;if(_0x2ec52f){for(var _0x200500 in _0x2ec52f){if(typeof _0x2ec52f[_0x200500]!==_0xd971('0x4c')){if(!_[_0xd971('0x2b')](_0x2ec52f[_0x200500])&&!_0x336453['includes'](_0x200500)){if(_0x200500===_0xd971('0x4d')&&_0x2ec52f[_0x200500]['length']>_0x40dd75){_0x29a189['XMD-'+_0x200500[_0xd971('0x4e')]()]=_0x2ec52f[_0x200500][_0xd971('0x4f')]()[_0xd971('0x50')](0x0,_0x40dd75);}else{_0x29a189[_0xd971('0x51')+_0x200500['toUpperCase']()]=_0x2ec52f[_0x200500];}}}}}return _0x29a189;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0xfb9b=['getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','XMD-','toUpperCase','substring','setXMDContactVariables','lodash','util','../../../../config/logger','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','ivr','isIVRCampaign','type','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','waiting','inUse','originated','Trunk','hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','Interval','isNil','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','name','includes','status','TrunkBackup','INACTIVE','pTalking','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','pow','replace','random','toString'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0xfb9b,0x126));var _0xbfb9=function(_0x239a26,_0x43f0dd){_0x239a26=_0x239a26-0x0;var _0x79fc70=_0xfb9b[_0x239a26];return _0x79fc70;};'use strict';var _=require(_0xbfb9('0x0'));var moment=require('moment');var util=require(_0xbfb9('0x1'));var logger=require(_0xbfb9('0x2'))(_0xbfb9('0x3'));var timezones=require('../../../../config/environment/shared')[_0xbfb9('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0xbfb9('0x5'),'BLACKLIST':_0xbfb9('0x6'),'CONTACTS_RESCHEDULED':_0xbfb9('0x7'),'DEACTIVATED':_0xbfb9('0x8'),'DISACTIVED':_0xbfb9('0x9'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0xbfb9('0xa'),'NO_AGENTS_LOGGED':_0xbfb9('0xb'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0xbfb9('0xc'),'OVERTIME_INTERVAL':_0xbfb9('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xbfb9('0xe'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xbfb9('0xf'),'RUNNING':_0xbfb9('0x10'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xbfb9('0x11')};exports[_0xbfb9('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x159e2f){return _0x159e2f[_0xbfb9('0x13')]==='preview';}exports[_0xbfb9('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x4fffa7){return _0x4fffa7['type']===_0xbfb9('0x15');}exports[_0xbfb9('0x16')]=isIVRCampaign;function isOutboundQueue(_0x184906){return _0x184906[_0xbfb9('0x17')]===_0xbfb9('0x18');}exports[_0xbfb9('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x311b95){return _0x311b95[_0xbfb9('0x1a')];}exports[_0xbfb9('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x4a5419){return _0x4a5419[_0xbfb9('0x1c')];}exports[_0xbfb9('0x1d')]=isIVRCampaignActive;function getSeconds(_0x3d04d7,_0x388a5f){var _0x1c21fa=moment(_0x3d04d7)[_0xbfb9('0x1e')](0x0);var _0x51be60=moment(_0x388a5f)[_0xbfb9('0x1e')](0x0);return _0x1c21fa[_0xbfb9('0x1f')](_0x51be60,_0xbfb9('0x20'));}exports[_0xbfb9('0x21')]=getSeconds;function hasQueueCampaignDataChanged(_0x5ddea5,_0x9461ae){var _0x52e0f0=![];var _0x29b42e=_0x5ddea5[_0xbfb9('0x13')]!==_0x9461ae[_0xbfb9('0x13')]||_0x5ddea5[_0xbfb9('0x1a')]!==_0x9461ae[_0xbfb9('0x1a')]||_0x5ddea5[_0xbfb9('0x22')]!==_0x9461ae[_0xbfb9('0x22')];var _0x20f970=_0x5ddea5[_0xbfb9('0x23')]!==_0x9461ae[_0xbfb9('0x23')]||_0x5ddea5[_0xbfb9('0x24')]!==_0x9461ae[_0xbfb9('0x24')]||_0x5ddea5[_0xbfb9('0x25')]!==_0x9461ae['loggedInDb']||_0x5ddea5[_0xbfb9('0x26')]!==_0x9461ae[_0xbfb9('0x26')]||_0x5ddea5[_0xbfb9('0x27')]!==_0x9461ae[_0xbfb9('0x27')]||_0x5ddea5['pTalking']!==_0x9461ae['pTalking']||_0x5ddea5['waiting']!==_0x9461ae[_0xbfb9('0x28')]||_0x5ddea5[_0xbfb9('0x29')]!==_0x9461ae[_0xbfb9('0x29')]||_0x5ddea5[_0xbfb9('0x2a')]!==_0x9461ae[_0xbfb9('0x2a')];if(_0x5ddea5['Trunk']&&_0x9461ae[_0xbfb9('0x2b')]){_0x52e0f0=_0x5ddea5['Trunk']['name']!==_0x9461ae[_0xbfb9('0x2b')]['name']||_0x5ddea5[_0xbfb9('0x2b')][_0xbfb9('0x1c')]!==_0x9461ae[_0xbfb9('0x2b')][_0xbfb9('0x1c')];}return _0x29b42e||_0x20f970||_0x52e0f0;}exports[_0xbfb9('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x189e82){var _0x33a4a6=null;var _0x19ecde=_0x189e82[_0xbfb9('0x2d')];if(_['isNil'](_0x189e82[_0xbfb9('0x2e')])||_['isNil'](_0x189e82[_0xbfb9('0x2f')])||_[_0xbfb9('0x30')](_0x189e82['Interval'][_0xbfb9('0x31')])){_0x33a4a6=CAMPAIGN_STATUS[_0xbfb9('0x32')];}else if(_[_0xbfb9('0x33')](_0x189e82[_0xbfb9('0x2e')])||_[_0xbfb9('0x33')](_0x189e82[_0xbfb9('0x2f')][_0xbfb9('0x31')])){_0x33a4a6=CAMPAIGN_STATUS[_0xbfb9('0x34')];}else if(_0x19ecde&&!timezones[_0x19ecde]){_0x33a4a6=CAMPAIGN_STATUS[_0xbfb9('0x35')];}return _0x33a4a6;}function checkAnyValidTrunk(_0x320b26,_0x18b2a8){var _0x479280=null;var _0x1ba4eb=_0xbfb9('0x36');var _0x525e9b=[_0xbfb9('0x37'),_0xbfb9('0x38')];var _0x9cd986=!![];if(_0x320b26[_0xbfb9('0x2b')]&&_0x320b26[_0xbfb9('0x2b')][_0xbfb9('0x1c')]){_0x1ba4eb+=_0x320b26[_0xbfb9('0x2b')][_0xbfb9('0x39')];_0x479280=_0x18b2a8[_0x1ba4eb];_0x9cd986=_0x525e9b[_0xbfb9('0x3a')](_0x479280[_0xbfb9('0x3b')]);}else if(_0x320b26[_0xbfb9('0x3c')]&&_0x320b26[_0xbfb9('0x3c')][_0xbfb9('0x1c')]){_0x1ba4eb+=_0x320b26[_0xbfb9('0x3c')]['name'];_0x479280=_0x18b2a8[_0x1ba4eb];_0x9cd986=_0x525e9b['includes'](_0x479280[_0xbfb9('0x3b')]);}return _0x9cd986;}function getQueueCampaignStatusMessage(_0x2ffb67,_0x5b6890){var _0x1c6ff7=CAMPAIGN_STATUS[_0xbfb9('0x5')];var _0x1ed36a=isPreviewCampaign(_0x2ffb67);if(!isQueueCampaignActive(_0x2ffb67)){if(_0x1ed36a){_0x1c6ff7=CAMPAIGN_STATUS[_0xbfb9('0x3d')];}else{if(_0x2ffb67[_0xbfb9('0x2a')]===0x0&&_0x2ffb67[_0xbfb9('0x27')]===0x0&&_0x2ffb67[_0xbfb9('0x28')]===0x0&&(_0x2ffb67[_0xbfb9('0x3e')]||0x0)===0x0){_0x1c6ff7=CAMPAIGN_STATUS['INACTIVE'];}else{_0x1c6ff7=CAMPAIGN_STATUS[_0xbfb9('0x3f')];}}}else if(_0x2ffb67[_0xbfb9('0x24')]===0x0){_0x1c6ff7=CAMPAIGN_STATUS[_0xbfb9('0x40')];}else if(!checkAnyValidTrunk(_0x2ffb67,_0x5b6890)){_0x1c6ff7=CAMPAIGN_STATUS[_0xbfb9('0x41')];}else if(!isPreviewCampaign(_0x2ffb67)){var _0x3eecb6=checkAnyValidQueueCampaignInterval(_0x2ffb67);if(_0x3eecb6){_0x1c6ff7=_0x3eecb6;}}return _0x1c6ff7;}exports[_0xbfb9('0x42')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x5260e4){var _0x5e82f3=CAMPAIGN_STATUS[_0xbfb9('0x3f')];if(_0x5260e4['originated']===0x0&&_0x5260e4[_0xbfb9('0x27')]===0x0&&_0x5260e4['waiting']===0x0&&(_0x5260e4[_0xbfb9('0x3e')]||0x0)===0x0){_0x5e82f3=CAMPAIGN_STATUS['INACTIVE'];}return _0x5e82f3;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x51ba68){var _0x9a6dc7=_0x51ba68[_0xbfb9('0x43')](/"(.*?)"/);return _0x9a6dc7?_0x9a6dc7[0x1]:_0x51ba68;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x5ff712,_0x2b2eb7,_0x41bbf8){if(!_[_0xbfb9('0x44')](_0x41bbf8)&&typeof _0x41bbf8==='string'&&!_[_0xbfb9('0x33')](_0x41bbf8)){if(!_['isUndefined'](_0x2b2eb7)&&typeof _0x2b2eb7===_0xbfb9('0x45')&&!_[_0xbfb9('0x33')](_0x2b2eb7)){return util[_0xbfb9('0x46')](_0xbfb9('0x47'),_0x2b2eb7,_0x41bbf8);}return util[_0xbfb9('0x46')](_0xbfb9('0x47'),_0x41bbf8,_0x41bbf8);}if(!_[_0xbfb9('0x44')](_0x5ff712)&&typeof _0x5ff712===_0xbfb9('0x45')&&!_[_0xbfb9('0x33')](_0x5ff712)){return _0x5ff712;}return _0xbfb9('0x48');}exports[_0xbfb9('0x49')]=getCallerId;function getCallerIdRandom(_0x32a37c,_0x18280a){var _0x289ca7;var _0x147fa7;var _0x5398f3;if(_0x18280a<=0x0){_0x18280a=0x1;}_0x289ca7=new RegExp('\x5cw{0,'+_0x18280a+'}$');_0x147fa7=Math[_0xbfb9('0x4a')](0xa,_0x18280a-0x1);_0x5398f3=Math[_0xbfb9('0x4a')](0xa,_0x18280a)-0x1;return util[_0xbfb9('0x46')]('%s',_[_0xbfb9('0x4b')](_0x32a37c,_0x289ca7,_[_0xbfb9('0x4c')](_0x147fa7,_0x5398f3)[_0xbfb9('0x4d')]()));}exports[_0xbfb9('0x4e')]=getCallerIdRandom;function decrementOriginate(_0x65a210,_0x1c1002){if(_0x65a210[_0xbfb9('0x2a')]&&_0x65a210[_0xbfb9('0x2a')]>0x0){_0x65a210[_0xbfb9('0x2a')]-=0x1;}else{logger[_0xbfb9('0x4f')](_0xbfb9('0x50'),_0x1c1002);}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x151fd0){return _0x151fd0&&_0x151fd0[_0xbfb9('0x51')]>0x0;}exports[_0xbfb9('0x52')]=checkContactEmpty;function erlangb(_0x34f269,_0x286750){if(_0x286750===0x0){return 0x0;}var _0x27c612=0x1;for(var _0x3c2af8=0x1;_0x3c2af8<=_0x286750;_0x3c2af8+=0x1){_0x27c612=0x1+_0x27c612*_0x3c2af8/_0x34f269;}return 0x1/_0x27c612;}exports[_0xbfb9('0x53')]=erlangb;function checkContactLowerLimitOriginate(_0x25693c,_0x5f425f,_0x8e6971){if(_0x5f425f>_0x8e6971){for(var _0x5e9947=0x0;_0x5e9947<_0x5f425f-_0x8e6971;_0x5e9947+=0x1){decrementOriginate(_0x25693c,'[checkContactLowerLimitOriginate]\x20');}}}exports[_0xbfb9('0x54')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x4cbb3e){var _0x3b4682={};var _0x458c77=['id',_0xbfb9('0x55'),_0xbfb9('0x56'),_0xbfb9('0x57')];const _0x197877=0xfa;if(_0x4cbb3e){for(var _0xa5b345 in _0x4cbb3e){if(typeof _0x4cbb3e[_0xa5b345]!==_0xbfb9('0x58')){if(!_['isNil'](_0x4cbb3e[_0xa5b345])&&!_0x458c77[_0xbfb9('0x3a')](_0xa5b345)){if(_0xa5b345==='description'&&_0x4cbb3e[_0xa5b345][_0xbfb9('0x51')]>_0x197877){_0x3b4682[_0xbfb9('0x59')+_0xa5b345[_0xbfb9('0x5a')]()]=_0x4cbb3e[_0xa5b345][_0xbfb9('0x4d')]()[_0xbfb9('0x5b')](0x0,_0x197877);}else{_0x3b4682['XMD-'+_0xa5b345[_0xbfb9('0x5a')]()]=_0x4cbb3e[_0xa5b345];}}}}}return _0x3b4682;}exports[_0xbfb9('0x5c')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 35ce7c3..bdcedd1 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(_0x4df922,_0x2dd0d6){var _0x5e2a8b=function(_0x4045f1){while(--_0x4045f1){_0x4df922['push'](_0x4df922['shift']());}};_0x5e2a8b(++_0x2dd0d6);}(_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 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(_0x2462c7,_0x51b09d){var _0x1afbf7=function(_0xea68dc){while(--_0xea68dc){_0x2462c7['push'](_0x2462c7['shift']());}};_0x1afbf7(++_0x51b09d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 285d15e..77a9ef3 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 _0xfd7a=['newchannel','bind','varset','syncVarSet','syncFaxStatus','syncReceiveFax','syncHangup','syncOriginateResponse','syncNewchannel','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','value','channelstate','channelstatedesc','syncNewExten','hasOwnProperty','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','transferrate','calleridnum','pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','error','\x20notify\x20','\x20receiveFax\x20','response','AttachmentId','then','logger','[Fax][Message][Error][Updated]','catch','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','stringify','faxpages','faxstatus','SUCCESS','updateStatus','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','Fax\x20failed','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isNil','active','SIP/%s','checkTrunk','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','lodash','bluebird','uuid','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxMessage','channels','faxAccounts','trunks','actions'];(function(_0x43d339,_0x3d673f){var _0x284be7=function(_0x379897){while(--_0x379897){_0x43d339['push'](_0x43d339['shift']());}};_0x284be7(++_0x3d673f);}(_0xfd7a,0x13c));var _0xafd7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd7a[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0xafd7('0x0'));var BPromise=require(_0xafd7('0x1'));var uuid=require(_0xafd7('0x2'));var moment=require('moment');var path=require(_0xafd7('0x3'));var tiff2pdf=require(_0xafd7('0x4'));var gs=require('./util/gs');var logger=require(_0xafd7('0x5'))(_0xafd7('0x6'));var ami=require(_0xafd7('0x7'));var rpcDb=require(_0xafd7('0x8'));var Channel=require(_0xafd7('0x9'));var ut=require(_0xafd7('0xa'));var Action=require(_0xafd7('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0xafd7('0xc'));function Fax(_0x33421e){this[_0xafd7('0xd')]={};this['faxAccounts']=_0x33421e[_0xafd7('0xe')];this[_0xafd7('0xf')]=_0x33421e[_0xafd7('0xf')];this[_0xafd7('0x10')]={};ami['on'](_0xafd7('0x11'),this['syncNewchannel'][_0xafd7('0x12')](this));ami['on'](_0xafd7('0x13'),this[_0xafd7('0x14')]['bind'](this));ami['on']('newstate',this['syncNewState'][_0xafd7('0x12')](this));ami['on']('newexten',this['syncNewExten'][_0xafd7('0x12')](this));ami['on']('faxstatus',this[_0xafd7('0x15')][_0xafd7('0x12')](this));ami['on']('receivefax',this[_0xafd7('0x16')][_0xafd7('0x12')](this));ami['on']('hangup',this[_0xafd7('0x17')][_0xafd7('0x12')](this));ami['on']('originateresponse',this[_0xafd7('0x18')][_0xafd7('0x12')](this));}Fax['prototype'][_0xafd7('0x19')]=function(_0x128d2b){if(_0x128d2b[_0xafd7('0x1a')]===_0xafd7('0x1b')){for(var _0x448ce2 in this[_0xafd7('0xe')]){if(this[_0xafd7('0xe')]['hasOwnProperty'](_0x448ce2)){if(_0x128d2b[_0xafd7('0x1c')]===this[_0xafd7('0xe')][_0x448ce2][_0xafd7('0x1d')]){this[_0xafd7('0xd')][_0x128d2b[_0xafd7('0x1e')]]={};this['channels'][_0x128d2b[_0xafd7('0x1e')]][_0xafd7('0x1f')]=_0x128d2b[_0xafd7('0x1f')];this['channels'][_0x128d2b[_0xafd7('0x1e')]]['id']=this[_0xafd7('0xe')][_0x448ce2]['id'];this[_0xafd7('0xd')][_0x128d2b[_0xafd7('0x1e')]][_0xafd7('0x20')]=this['faxAccounts'][_0x448ce2][_0xafd7('0x20')];logger[_0xafd7('0x21')](_0x128d2b[_0xafd7('0x1e')],_0xafd7('0x22'));}}}}if(this[_0xafd7('0x10')][_0x128d2b['uniqueid']]){this[_0xafd7('0xd')][_0x128d2b[_0xafd7('0x1e')]]={};this[_0xafd7('0xd')][_0x128d2b['uniqueid']][_0xafd7('0x1f')]=_0x128d2b['channel'];logger[_0xafd7('0x21')](_0x128d2b['uniqueid'],_0xafd7('0x22'));}};Fax[_0xafd7('0x23')][_0xafd7('0x14')]=function(_0x4a6d05){if(this[_0xafd7('0xd')][_0x4a6d05['uniqueid']]){for(var _0x484bfe in _0x4a6d05[_0xafd7('0x24')]){if(_0x4a6d05['variable']['hasOwnProperty'](_0x484bfe)){this[_0xafd7('0xd')][_0x4a6d05[_0xafd7('0x1e')]][_0x484bfe]=_0x4a6d05[_0xafd7('0x25')];}}}};Fax['prototype']['syncNewState']=function(_0x3cca66){if(this[_0xafd7('0xd')][_0x3cca66['uniqueid']]){this[_0xafd7('0xd')][_0x3cca66[_0xafd7('0x1e')]][_0xafd7('0x26')]=_0x3cca66[_0xafd7('0x26')];this[_0xafd7('0xd')][_0x3cca66[_0xafd7('0x1e')]][_0xafd7('0x27')]=_0x3cca66[_0xafd7('0x27')];}};Fax['prototype'][_0xafd7('0x28')]=function(_0x5d08ff){if(this[_0xafd7('0xd')][_0x5d08ff[_0xafd7('0x1e')]]){for(var _0x3242c0 in _0x5d08ff[_0xafd7('0x24')]){if(_0x5d08ff[_0xafd7('0x24')][_0xafd7('0x29')](_0x3242c0)){this[_0xafd7('0xd')][_0x5d08ff[_0xafd7('0x1e')]][_0x3242c0]=_0x5d08ff['value'];}}}};Fax[_0xafd7('0x23')][_0xafd7('0x15')]=function(_0x29c6fd){if(this[_0xafd7('0xd')][_0x29c6fd[_0xafd7('0x1e')]]){this['channels'][_0x29c6fd[_0xafd7('0x1e')]][_0xafd7('0x2a')]=_0x29c6fd[_0xafd7('0x2a')];this['channels'][_0x29c6fd[_0xafd7('0x1e')]]['status']=_0x29c6fd[_0xafd7('0x2b')];this[_0xafd7('0xd')][_0x29c6fd[_0xafd7('0x1e')]][_0xafd7('0x1d')]=_0x29c6fd[_0xafd7('0x1d')];this[_0xafd7('0xd')][_0x29c6fd[_0xafd7('0x1e')]][_0xafd7('0x2c')]=_0x29c6fd[_0xafd7('0x2c')];logger[_0xafd7('0x21')](_0x29c6fd[_0xafd7('0x1e')],_0xafd7('0x2d'));}};Fax['prototype'][_0xafd7('0x16')]=function(_0x1139db){var _0x123591=this;if(this[_0xafd7('0xd')][_0x1139db[_0xafd7('0x1e')]]){var _0x512639=this['channels'][_0x1139db[_0xafd7('0x1e')]]['id'];this[_0xafd7('0xd')][_0x1139db[_0xafd7('0x1e')]][_0xafd7('0x2e')]=_0x1139db[_0xafd7('0x2e')];this[_0xafd7('0xd')][_0x1139db[_0xafd7('0x1e')]]['pagestransferred']=_0x1139db['pagestransferred'];this[_0xafd7('0xd')][_0x1139db[_0xafd7('0x1e')]][_0xafd7('0x1d')]=_0x1139db[_0xafd7('0x1d')];this['channels'][_0x1139db['uniqueid']]['resolution']=_0x1139db['resolution'];this[_0xafd7('0xd')][_0x1139db[_0xafd7('0x1e')]][_0xafd7('0x2f')]=_0x1139db[_0xafd7('0x2f')];this[_0xafd7('0xd')][_0x1139db[_0xafd7('0x1e')]]['filename']=_0x1139db['filename'];this[_0xafd7('0xd')][_0x1139db[_0xafd7('0x1e')]][_0xafd7('0x30')]=_0x1139db[_0xafd7('0x30')];if(this[_0xafd7('0xd')][_0x1139db[_0xafd7('0x1e')]][_0xafd7('0x31')]>0x0){tiff2pdf(_0x1139db[_0xafd7('0x2c')],_0xafd7('0x32'),function(_0x3815b6){logger[_0xafd7('0x21')](_0x1139db['uniqueid'],_0xafd7('0x33'),_0x3815b6['message']);attachment[_0xafd7('0x34')]({'name':path[_0xafd7('0x35')](_0x1139db[_0xafd7('0x2c')])['name'],'basename':path[_0xafd7('0x35')](_0x1139db[_0xafd7('0x2c')])[_0xafd7('0x20')]+'.pdf','type':'application/pdf'})['then'](function(_0x36efda){faxAccount['notify'](_0x512639,{'from':_0x1139db[_0xafd7('0x30')],'mapKey':_0xafd7('0x6'),'body':path[_0xafd7('0x35')](_0x1139db[_0xafd7('0x2c')])[_0xafd7('0x20')]+_0xafd7('0x36'),'AttachmentId':_0x36efda['id']})['catch'](function(_0x2bd10a){logger[_0xafd7('0x37')](_0x1139db['uniqueid'],_0xafd7('0x38'),JSON['stringify'](_0x2bd10a));});})['catch'](function(_0x2d8ea0){logger[_0xafd7('0x37')](_0x1139db['uniqueid'],_0xafd7('0x39'),JSON['stringify'](_0x2d8ea0));});});}logger['info'](_0x1139db[_0xafd7('0x1e')],_0xafd7('0x39'));}};Fax['prototype'][_0xafd7('0x18')]=function(_0x590be5){if(this['actions'][_0x590be5[_0xafd7('0x1e')]]){_['merge'](this[_0xafd7('0xd')][_0x590be5[_0xafd7('0x1e')]],_['pick'](_0x590be5,[_0xafd7('0x3a'),'reason']));}};function updateStatus(_0xaafa78){if(_0xaafa78[_0xafd7('0x3b')]){faxMessage['update'](_0xaafa78[_0xafd7('0x3b')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xafd7('0x3c')](function(_0x175457){ut[_0xafd7('0x3d')](_0xafd7('0x3e'),_0x175457);})[_0xafd7('0x3f')](function(_0x16f0cc){ut[_0xafd7('0x3d')](_0xafd7('0x40'),_0x16f0cc);});}else{ut[_0xafd7('0x3d')](_0xafd7('0x41'));}}Fax['prototype']['updateStatus']=function(_0x41e5c8,_0x1564b6,_0x3ed297){var _0x4efd1c=this;var _0xe85027={};if(_0x1564b6){_0xe85027={'read':_0x1564b6};}else{_0xe85027={'failMessage':_0x3ed297};}if(this[_0xafd7('0x10')][_0x41e5c8]['AttachmentId']){faxMessage[_0xafd7('0x42')](this[_0xafd7('0x10')][_0x41e5c8]['AttachmentId'],_0xe85027)[_0xafd7('0x3c')](function(_0x7029fa){ut[_0xafd7('0x3d')](_0xafd7('0x43'),_0x7029fa);})[_0xafd7('0x3f')](function(_0x25a2f9){ut[_0xafd7('0x3d')](_0xafd7('0x44'),_0x25a2f9);})['finally'](function(){delete _0x4efd1c[_0xafd7('0xd')][_0x41e5c8];delete _0x4efd1c[_0xafd7('0x10')][_0x41e5c8];});}else{ut[_0xafd7('0x3d')](_0xafd7('0x45'));this[_0xafd7('0x46')](_0x41e5c8);delete this[_0xafd7('0x10')][_0x41e5c8];}};Fax[_0xafd7('0x23')][_0xafd7('0x17')]=function(_0x4b66e9){var _0x1a7cfb=this;if(this[_0xafd7('0xd')][_0x4b66e9[_0xafd7('0x1e')]]){if(this[_0xafd7('0x10')][_0x4b66e9[_0xafd7('0x1e')]]){this[_0xafd7('0xd')][_0x4b66e9['uniqueid']]['id']=this['actions'][_0x4b66e9[_0xafd7('0x1e')]]['id'];this[_0xafd7('0xd')][_0x4b66e9[_0xafd7('0x1e')]][_0xafd7('0x20')]=this[_0xafd7('0x10')][_0x4b66e9['uniqueid']]['name'];}logger['info'](_0x4b66e9[_0xafd7('0x1e')],this[_0xafd7('0x10')][_0x4b66e9['uniqueid']]?_0xafd7('0x47'):'\x20hangup\x20faxRiceive\x20',JSON[_0xafd7('0x48')](this[_0xafd7('0xd')][_0x4b66e9['uniqueid']]));if(this[_0xafd7('0x10')][_0x4b66e9['uniqueid']]){if(this[_0xafd7('0xd')][_0x4b66e9[_0xafd7('0x1e')]][_0xafd7('0x49')]>0x0&&this[_0xafd7('0xd')][_0x4b66e9[_0xafd7('0x1e')]][_0xafd7('0x4a')]===_0xafd7('0x4b')){this[_0xafd7('0x4c')](_0x4b66e9[_0xafd7('0x1e')],!![]);}else{this['updateStatus'](_0x4b66e9[_0xafd7('0x1e')],![],this[_0xafd7('0xd')][_0x4b66e9['uniqueid']]['faxstatusstring']?_0xafd7('0x4d')+this[_0xafd7('0xd')][_0x4b66e9[_0xafd7('0x1e')]][_0xafd7('0x4e')]:_0xafd7('0x4f'));}}}};Fax['prototype']['send']=function(_0x12082c){var _0x53dc52=this;return new BPromise(function(_0x21c298,_0x13aee7){_0x53dc52['execOriginate'](_0x12082c,_0x53dc52[_0xafd7('0xe')][_0x12082c[_0xafd7('0x50')]])['then'](function(_0x3924f2){ut[_0xafd7('0x3d')](_0xafd7('0x51'),_0x3924f2);_0x21c298(ut[_0xafd7('0x52')](_0xafd7('0x53')));})['catch'](function(_0x484a50){ut[_0xafd7('0x3d')]('[Fax][execOriginate][failure]',_0x484a50);updateStatus(_0x12082c);_0x13aee7(ut['message'](_0xafd7('0x54')));});});};Fax[_0xafd7('0x23')]['checkAfterSend']=function(_0x56bc8c){var _0x15d03e=this;return new BPromise(function(_0xe1e5ee,_0x4dbd62){var _0xc55b8b=_0x15d03e['checkTrunk'](_0x15d03e['faxAccounts'][_0x56bc8c['FaxAccountId']][_0xafd7('0x55')],_0x56bc8c);if(_0xc55b8b['isValid']){_0xe1e5ee(ut[_0xafd7('0x52')](_0xafd7('0x56')));}else{_0x4dbd62(ut[_0xafd7('0x52')](_0xc55b8b[_0xafd7('0x52')]));}});};function originate(_0x22913f,_0x20aeef,_0x5244d9){return new BPromise(function(_0x5eaa8e,_0x872e41){if(_0x5244d9){var _0x5622a0=util[_0xafd7('0x57')](_0xafd7('0x58'),path[_0xafd7('0x35')](_0x22913f[_0xafd7('0x3')])['name'],_0x22913f[_0xafd7('0x3')]);gs[_0xafd7('0x59')](_0x5622a0)[_0xafd7('0x3c')](function(){_0x22913f[_0xafd7('0x3')]=util['format'](_0xafd7('0x5a'),path[_0xafd7('0x35')](_0x22913f[_0xafd7('0x3')])[_0xafd7('0x5b')],path[_0xafd7('0x35')](_0x22913f[_0xafd7('0x3')])[_0xafd7('0x20')]);_0x20aeef[_0xafd7('0x5c')]=_0x22913f['path'];ut['logger'](_0xafd7('0x5d'),'');ami[_0xafd7('0x5e')](ut[_0xafd7('0x5f')](_0x22913f,_0x20aeef))[_0xafd7('0x3c')](function(_0x24ae5b){_0x5eaa8e(_0x24ae5b);})[_0xafd7('0x3f')](function(_0x11267e){_0x872e41(_0x11267e);});})['catch'](function(_0x54d2f4){_0x872e41(_0x54d2f4);});}else{ami['Action'](ut['variablesAction'](_0x22913f,_0x20aeef))[_0xafd7('0x3c')](function(_0x52b6cd){_0x5eaa8e(_0x52b6cd);})['catch'](function(_0x399876){_0x872e41(_0x399876);});}});}Fax['prototype'][_0xafd7('0x60')]=function(_0x3908b3,_0x51d1a7){var _0x5ce22e=this;return new BPromise(function(_0x440e70,_0x4a3e5c){var _0x41d0f6=uuid['v4']();var _0x35ea03=ut[_0xafd7('0x61')](_0x3908b3,_0x51d1a7);_0x5ce22e['actions'][_0x41d0f6]=new Action(_0x41d0f6,_0x51d1a7,_0x3908b3);var _0x398ba2=_0x5ce22e[_0xafd7('0x10')][_0x41d0f6];if(path[_0xafd7('0x35')](_0x3908b3[_0xafd7('0x3')])[_0xafd7('0x62')]===_0xafd7('0x36')){originate(_0x398ba2,_0x35ea03,!![])[_0xafd7('0x3c')](function(_0x1846ec){_0x440e70(_0x1846ec);})[_0xafd7('0x3f')](function(_0x42b638){_0x4a3e5c(_0x42b638);});}else{originate(_0x398ba2,_0x35ea03,![])[_0xafd7('0x3c')](function(_0x4a0a23){_0x440e70(_0x4a0a23);})[_0xafd7('0x3f')](function(_0x3c4886){_0x4a3e5c(_0x3c4886);});}});};Fax[_0xafd7('0x23')]['isTrunkReachable']=function(_0x8c58c7){return!_[_0xafd7('0x63')](_0x8c58c7)&&!_[_0xafd7('0x63')](_0x8c58c7[_0xafd7('0x20')])&&!_['isNil'](_0x8c58c7[_0xafd7('0x64')])&&_0x8c58c7[_0xafd7('0x64')]&&!_[_0xafd7('0x63')](this['trunks'][util[_0xafd7('0x57')](_0xafd7('0x65'),_0x8c58c7['name'])])&&!_[_0xafd7('0x63')](this[_0xafd7('0xf')][util[_0xafd7('0x57')]('SIP/%s',_0x8c58c7[_0xafd7('0x20')])][_0xafd7('0x2b')])&&(this[_0xafd7('0xf')][util['format'](_0xafd7('0x65'),_0x8c58c7[_0xafd7('0x20')])][_0xafd7('0x2b')]==='reachable'||this['trunks'][util['format'](_0xafd7('0x65'),_0x8c58c7[_0xafd7('0x20')])][_0xafd7('0x2b')]==='unmonitored');};Fax[_0xafd7('0x23')][_0xafd7('0x66')]=function(_0x13522d,_0x4c8cf0){if(!this[_0xafd7('0x67')](_0x13522d)){ut[_0xafd7('0x3d')](_0xafd7('0x68'),_[_0xafd7('0x63')](_0x13522d)?'':_0x13522d[_0xafd7('0x20')]+_0xafd7('0x69'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_['isNil'](_0x4c8cf0[_0xafd7('0x6')])){ut['logger'](_0xafd7('0x6a'),JSON[_0xafd7('0x48')](_0x4c8cf0));return{'isValid':![],'message':_0xafd7('0x6b')};}if(_[_0xafd7('0x63')](_0x4c8cf0[_0xafd7('0x3')])){ut[_0xafd7('0x3d')](_0xafd7('0x6c'),JSON[_0xafd7('0x48')](_0x4c8cf0));return{'isValid':![],'message':_0xafd7('0x6d')};}return{'isValid':!![],'message':'Is\x20Valid'};};Fax[_0xafd7('0x23')]['deleteChannelAfterTimeout']=function(_0x36b615,_0x1dfaf7=0x2710){if(this['channels'][_0x36b615]){setTimeout(()=>{delete this[_0xafd7('0xd')][_0x36b615];},_0x1dfaf7);}};module[_0xafd7('0x6e')]=Fax; \ No newline at end of file +var _0x3922=['Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','uuid','moment','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./action','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','faxstatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','syncFaxStatus','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','pick','response','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','Fax\x20failed','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','path','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x3922,0x1da));var _0x2392=function(_0x30f07a,_0x98341){_0x30f07a=_0x30f07a-0x0;var _0xb38461=_0x3922[_0x30f07a];return _0xb38461;};'use strict';var util=require(_0x2392('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x2392('0x1'));var moment=require(_0x2392('0x2'));var path=require('path');var tiff2pdf=require(_0x2392('0x3'));var gs=require(_0x2392('0x4'));var logger=require('../../../config/logger')(_0x2392('0x5'));var ami=require(_0x2392('0x6'));var rpcDb=require(_0x2392('0x7'));var Channel=require(_0x2392('0x8'));var ut=require('./util/util');var Action=require(_0x2392('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0x2392('0xa'));function Fax(_0x21af48){this[_0x2392('0xb')]={};this[_0x2392('0xc')]=_0x21af48[_0x2392('0xc')];this[_0x2392('0xd')]=_0x21af48[_0x2392('0xd')];this[_0x2392('0xe')]={};ami['on'](_0x2392('0xf'),this['syncNewchannel']['bind'](this));ami['on'](_0x2392('0x10'),this[_0x2392('0x11')][_0x2392('0x12')](this));ami['on'](_0x2392('0x13'),this[_0x2392('0x14')][_0x2392('0x12')](this));ami['on'](_0x2392('0x15'),this['syncNewExten'][_0x2392('0x12')](this));ami['on'](_0x2392('0x16'),this['syncFaxStatus']['bind'](this));ami['on'](_0x2392('0x17'),this[_0x2392('0x18')][_0x2392('0x12')](this));ami['on']('hangup',this[_0x2392('0x19')]['bind'](this));ami['on'](_0x2392('0x1a'),this[_0x2392('0x1b')]['bind'](this));}Fax[_0x2392('0x1c')][_0x2392('0x1d')]=function(_0xce3377){if(_0xce3377[_0x2392('0x1e')]===_0x2392('0x1f')){for(var _0x4cdb6c in this[_0x2392('0xc')]){if(this[_0x2392('0xc')][_0x2392('0x20')](_0x4cdb6c)){if(_0xce3377[_0x2392('0x21')]===this[_0x2392('0xc')][_0x4cdb6c]['localstationid']){this[_0x2392('0xb')][_0xce3377[_0x2392('0x22')]]={};this[_0x2392('0xb')][_0xce3377[_0x2392('0x22')]][_0x2392('0x23')]=_0xce3377[_0x2392('0x23')];this['channels'][_0xce3377['uniqueid']]['id']=this['faxAccounts'][_0x4cdb6c]['id'];this['channels'][_0xce3377['uniqueid']]['name']=this[_0x2392('0xc')][_0x4cdb6c][_0x2392('0x24')];logger[_0x2392('0x25')](_0xce3377[_0x2392('0x22')],_0x2392('0x26'));}}}}if(this[_0x2392('0xe')][_0xce3377[_0x2392('0x22')]]){this[_0x2392('0xb')][_0xce3377['uniqueid']]={};this['channels'][_0xce3377[_0x2392('0x22')]][_0x2392('0x23')]=_0xce3377[_0x2392('0x23')];logger['info'](_0xce3377[_0x2392('0x22')],'\x20syncNewchannel\x20');}};Fax['prototype'][_0x2392('0x11')]=function(_0xc1f5d2){if(this[_0x2392('0xb')][_0xc1f5d2[_0x2392('0x22')]]){for(var _0x297b9a in _0xc1f5d2[_0x2392('0x27')]){if(_0xc1f5d2[_0x2392('0x27')][_0x2392('0x20')](_0x297b9a)){this[_0x2392('0xb')][_0xc1f5d2['uniqueid']][_0x297b9a]=_0xc1f5d2[_0x2392('0x28')];}}}};Fax[_0x2392('0x1c')]['syncNewState']=function(_0x5a97aa){if(this[_0x2392('0xb')][_0x5a97aa[_0x2392('0x22')]]){this[_0x2392('0xb')][_0x5a97aa[_0x2392('0x22')]][_0x2392('0x29')]=_0x5a97aa['channelstate'];this[_0x2392('0xb')][_0x5a97aa['uniqueid']][_0x2392('0x2a')]=_0x5a97aa[_0x2392('0x2a')];}};Fax[_0x2392('0x1c')][_0x2392('0x2b')]=function(_0x49c4ff){if(this['channels'][_0x49c4ff[_0x2392('0x22')]]){for(var _0x49baaf in _0x49c4ff[_0x2392('0x27')]){if(_0x49c4ff[_0x2392('0x27')][_0x2392('0x20')](_0x49baaf)){this[_0x2392('0xb')][_0x49c4ff[_0x2392('0x22')]][_0x49baaf]=_0x49c4ff[_0x2392('0x28')];}}}};Fax[_0x2392('0x1c')][_0x2392('0x2c')]=function(_0x5869fb){if(this[_0x2392('0xb')][_0x5869fb['uniqueid']]){this['channels'][_0x5869fb[_0x2392('0x22')]][_0x2392('0x2d')]=_0x5869fb[_0x2392('0x2d')];this[_0x2392('0xb')][_0x5869fb['uniqueid']][_0x2392('0x2e')]=_0x5869fb[_0x2392('0x2e')];this[_0x2392('0xb')][_0x5869fb[_0x2392('0x22')]][_0x2392('0x2f')]=_0x5869fb['localstationid'];this[_0x2392('0xb')][_0x5869fb[_0x2392('0x22')]][_0x2392('0x30')]=_0x5869fb[_0x2392('0x30')];logger['info'](_0x5869fb[_0x2392('0x22')],_0x2392('0x31'));}};Fax[_0x2392('0x1c')][_0x2392('0x18')]=function(_0xf64c82){var _0x397303=this;if(this[_0x2392('0xb')][_0xf64c82[_0x2392('0x22')]]){var _0xfcb2fd=this['channels'][_0xf64c82[_0x2392('0x22')]]['id'];this[_0x2392('0xb')][_0xf64c82[_0x2392('0x22')]][_0x2392('0x32')]=_0xf64c82[_0x2392('0x32')];this['channels'][_0xf64c82[_0x2392('0x22')]][_0x2392('0x33')]=_0xf64c82[_0x2392('0x33')];this['channels'][_0xf64c82['uniqueid']][_0x2392('0x2f')]=_0xf64c82['localstationid'];this[_0x2392('0xb')][_0xf64c82[_0x2392('0x22')]][_0x2392('0x34')]=_0xf64c82[_0x2392('0x34')];this[_0x2392('0xb')][_0xf64c82[_0x2392('0x22')]]['transferrate']=_0xf64c82['transferrate'];this['channels'][_0xf64c82['uniqueid']][_0x2392('0x30')]=_0xf64c82['filename'];this['channels'][_0xf64c82['uniqueid']][_0x2392('0x35')]=_0xf64c82[_0x2392('0x35')];if(this[_0x2392('0xb')][_0xf64c82[_0x2392('0x22')]][_0x2392('0x33')]>0x0){tiff2pdf(_0xf64c82[_0x2392('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x11ca95){logger[_0x2392('0x25')](_0xf64c82[_0x2392('0x22')],_0x2392('0x36'),_0x11ca95[_0x2392('0x37')]);attachment[_0x2392('0x38')]({'name':path[_0x2392('0x39')](_0xf64c82[_0x2392('0x30')])[_0x2392('0x24')],'basename':path[_0x2392('0x39')](_0xf64c82[_0x2392('0x30')])[_0x2392('0x24')]+_0x2392('0x3a'),'type':_0x2392('0x3b')})[_0x2392('0x3c')](function(_0x5ce55c){faxAccount[_0x2392('0x3d')](_0xfcb2fd,{'from':_0xf64c82['calleridnum'],'mapKey':_0x2392('0x5'),'body':path[_0x2392('0x39')](_0xf64c82['filename'])[_0x2392('0x24')]+'.pdf','AttachmentId':_0x5ce55c['id']})['catch'](function(_0x4e5405){logger[_0x2392('0x3e')](_0xf64c82['uniqueid'],_0x2392('0x3f'),JSON[_0x2392('0x40')](_0x4e5405));});})[_0x2392('0x41')](function(_0xe99fd8){logger[_0x2392('0x3e')](_0xf64c82[_0x2392('0x22')],_0x2392('0x42'),JSON[_0x2392('0x40')](_0xe99fd8));});});}logger[_0x2392('0x25')](_0xf64c82[_0x2392('0x22')],_0x2392('0x42'));}};Fax[_0x2392('0x1c')][_0x2392('0x1b')]=function(_0x6a9fd6){if(this['actions'][_0x6a9fd6[_0x2392('0x22')]]){_['merge'](this[_0x2392('0xb')][_0x6a9fd6[_0x2392('0x22')]],_[_0x2392('0x43')](_0x6a9fd6,[_0x2392('0x44'),'reason']));}};function updateStatus(_0x5b50a3){if(_0x5b50a3[_0x2392('0x45')]){faxMessage[_0x2392('0x46')](_0x5b50a3[_0x2392('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x2392('0x3c')](function(_0x1177e8){ut[_0x2392('0x47')](_0x2392('0x48'),_0x1177e8);})['catch'](function(_0x4c2b8e){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x4c2b8e);});}else{ut[_0x2392('0x47')](_0x2392('0x49'));}}Fax[_0x2392('0x1c')]['updateStatus']=function(_0x209da6,_0x497484,_0x2883a8){var _0x2b6f2f=this;var _0x5f3ea5={};if(_0x497484){_0x5f3ea5={'read':_0x497484};}else{_0x5f3ea5={'failMessage':_0x2883a8};}if(this[_0x2392('0xe')][_0x209da6][_0x2392('0x45')]){faxMessage[_0x2392('0x46')](this[_0x2392('0xe')][_0x209da6][_0x2392('0x45')],_0x5f3ea5)[_0x2392('0x3c')](function(_0x273ab5){ut[_0x2392('0x47')](_0x2392('0x4a'),_0x273ab5);})[_0x2392('0x41')](function(_0xa058aa){ut['logger']('[Fax][Message][NoUpdate1]',_0xa058aa);})[_0x2392('0x4b')](function(){delete _0x2b6f2f[_0x2392('0xb')][_0x209da6];delete _0x2b6f2f[_0x2392('0xe')][_0x209da6];});}else{ut[_0x2392('0x47')](_0x2392('0x4c'));this[_0x2392('0x4d')](_0x209da6);delete this[_0x2392('0xe')][_0x209da6];}};Fax[_0x2392('0x1c')][_0x2392('0x19')]=function(_0x53764b){var _0x4af27c=this;if(this['channels'][_0x53764b[_0x2392('0x22')]]){if(this[_0x2392('0xe')][_0x53764b['uniqueid']]){this['channels'][_0x53764b[_0x2392('0x22')]]['id']=this[_0x2392('0xe')][_0x53764b['uniqueid']]['id'];this[_0x2392('0xb')][_0x53764b[_0x2392('0x22')]][_0x2392('0x24')]=this[_0x2392('0xe')][_0x53764b[_0x2392('0x22')]][_0x2392('0x24')];}logger[_0x2392('0x25')](_0x53764b[_0x2392('0x22')],this['actions'][_0x53764b[_0x2392('0x22')]]?_0x2392('0x4e'):_0x2392('0x4f'),JSON['stringify'](this[_0x2392('0xb')][_0x53764b['uniqueid']]));if(this[_0x2392('0xe')][_0x53764b[_0x2392('0x22')]]){if(this['channels'][_0x53764b[_0x2392('0x22')]][_0x2392('0x50')]>0x0&&this['channels'][_0x53764b[_0x2392('0x22')]][_0x2392('0x16')]===_0x2392('0x51')){this['updateStatus'](_0x53764b['uniqueid'],!![]);}else{this[_0x2392('0x52')](_0x53764b[_0x2392('0x22')],![],this[_0x2392('0xb')][_0x53764b[_0x2392('0x22')]][_0x2392('0x53')]?_0x2392('0x54')+this[_0x2392('0xb')][_0x53764b[_0x2392('0x22')]][_0x2392('0x53')]:_0x2392('0x55'));}}}};Fax[_0x2392('0x1c')][_0x2392('0x56')]=function(_0x5b8002){var _0xc1ab27=this;return new BPromise(function(_0x360c8c,_0x514c20){_0xc1ab27[_0x2392('0x57')](_0x5b8002,_0xc1ab27[_0x2392('0xc')][_0x5b8002[_0x2392('0x58')]])['then'](function(_0x335920){ut[_0x2392('0x47')]('[Fax][execOriginate][success]',_0x335920);_0x360c8c(ut['message'](_0x2392('0x59')));})['catch'](function(_0x29024a){ut[_0x2392('0x47')]('[Fax][execOriginate][failure]',_0x29024a);updateStatus(_0x5b8002);_0x514c20(ut['message'](_0x2392('0x5a')));});});};Fax['prototype']['checkAfterSend']=function(_0x494517){var _0x2fccca=this;return new BPromise(function(_0xad17d4,_0x20a780){var _0x5b8c9b=_0x2fccca[_0x2392('0x5b')](_0x2fccca[_0x2392('0xc')][_0x494517[_0x2392('0x58')]]['Trunk'],_0x494517);if(_0x5b8c9b[_0x2392('0x5c')]){_0xad17d4(ut[_0x2392('0x37')](_0x2392('0x5d')));}else{_0x20a780(ut[_0x2392('0x37')](_0x5b8c9b[_0x2392('0x37')]));}});};function originate(_0x529d2a,_0x4d4174,_0x346abc){return new BPromise(function(_0x5b7db4,_0x22a13a){if(_0x346abc){var _0x306e8f=util[_0x2392('0x5e')](_0x2392('0x5f'),path[_0x2392('0x39')](_0x529d2a['path'])['name'],_0x529d2a['path']);gs['execute'](_0x306e8f)[_0x2392('0x3c')](function(){_0x529d2a['path']=util[_0x2392('0x5e')](_0x2392('0x60'),path['parse'](_0x529d2a[_0x2392('0x61')])['dir'],path[_0x2392('0x39')](_0x529d2a[_0x2392('0x61')])['name']);_0x4d4174[_0x2392('0x62')]=_0x529d2a[_0x2392('0x61')];ut[_0x2392('0x47')](_0x2392('0x63'),'');ami[_0x2392('0x64')](ut['variablesAction'](_0x529d2a,_0x4d4174))[_0x2392('0x3c')](function(_0x974857){_0x5b7db4(_0x974857);})[_0x2392('0x41')](function(_0x4cfbfd){_0x22a13a(_0x4cfbfd);});})[_0x2392('0x41')](function(_0x15383e){_0x22a13a(_0x15383e);});}else{ami['Action'](ut['variablesAction'](_0x529d2a,_0x4d4174))[_0x2392('0x3c')](function(_0x9b9839){_0x5b7db4(_0x9b9839);})[_0x2392('0x41')](function(_0x939bed){_0x22a13a(_0x939bed);});}});}Fax[_0x2392('0x1c')][_0x2392('0x57')]=function(_0x4acb24,_0x1999cd){var _0x274df1=this;return new BPromise(function(_0x3c4c1c,_0x130418){var _0x3b5b63=uuid['v4']();var _0x1d3d5a=ut[_0x2392('0x65')](_0x4acb24,_0x1999cd);_0x274df1[_0x2392('0xe')][_0x3b5b63]=new Action(_0x3b5b63,_0x1999cd,_0x4acb24);var _0x15b53c=_0x274df1[_0x2392('0xe')][_0x3b5b63];if(path[_0x2392('0x39')](_0x4acb24[_0x2392('0x61')])[_0x2392('0x66')]===_0x2392('0x3a')){originate(_0x15b53c,_0x1d3d5a,!![])[_0x2392('0x3c')](function(_0x37afc2){_0x3c4c1c(_0x37afc2);})['catch'](function(_0x1bf65e){_0x130418(_0x1bf65e);});}else{originate(_0x15b53c,_0x1d3d5a,![])[_0x2392('0x3c')](function(_0x419515){_0x3c4c1c(_0x419515);})[_0x2392('0x41')](function(_0x4e2c24){_0x130418(_0x4e2c24);});}});};Fax[_0x2392('0x1c')][_0x2392('0x67')]=function(_0x5ada79){return!_[_0x2392('0x68')](_0x5ada79)&&!_[_0x2392('0x68')](_0x5ada79[_0x2392('0x24')])&&!_[_0x2392('0x68')](_0x5ada79[_0x2392('0x69')])&&_0x5ada79[_0x2392('0x69')]&&!_['isNil'](this[_0x2392('0xd')][util[_0x2392('0x5e')]('SIP/%s',_0x5ada79[_0x2392('0x24')])])&&!_[_0x2392('0x68')](this[_0x2392('0xd')][util[_0x2392('0x5e')]('SIP/%s',_0x5ada79[_0x2392('0x24')])]['status'])&&(this[_0x2392('0xd')][util[_0x2392('0x5e')](_0x2392('0x6a'),_0x5ada79[_0x2392('0x24')])][_0x2392('0x2e')]===_0x2392('0x6b')||this[_0x2392('0xd')][util['format']('SIP/%s',_0x5ada79['name'])][_0x2392('0x2e')]===_0x2392('0x6c'));};Fax[_0x2392('0x1c')][_0x2392('0x5b')]=function(_0x13222f,_0x168fa){if(!this['isTrunkReachable'](_0x13222f)){ut[_0x2392('0x47')](_0x2392('0x6d'),_[_0x2392('0x68')](_0x13222f)?'':_0x13222f[_0x2392('0x24')]+_0x2392('0x6e'));return{'isValid':![],'message':_0x2392('0x6f')};}if(_['isNil'](_0x168fa[_0x2392('0x5')])){ut['logger'](_0x2392('0x70'),JSON[_0x2392('0x40')](_0x168fa));return{'isValid':![],'message':_0x2392('0x71')};}if(_[_0x2392('0x68')](_0x168fa[_0x2392('0x61')])){ut[_0x2392('0x47')](_0x2392('0x72'),JSON['stringify'](_0x168fa));return{'isValid':![],'message':_0x2392('0x73')};}return{'isValid':!![],'message':_0x2392('0x74')};};Fax[_0x2392('0x1c')]['deleteChannelAfterTimeout']=function(_0x10a3a2,_0x3e1564=0x2710){if(this[_0x2392('0xb')][_0x10a3a2]){setTimeout(()=>{delete this[_0x2392('0xb')][_0x10a3a2];},_0x3e1564);}};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index e8eb6ca..55621d4 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 _0xaa4a=['bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','catch','[Notify]\x20','util'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0xaa4a,0xef));var _0xaaa4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xaa4a[_0x1facfa];return _0x9ec701;};'use strict';var util=require(_0xaaa4('0x0'));var BPromise=require(_0xaaa4('0x1'));var logger=require(_0xaaa4('0x2'))(_0xaaa4('0x3'));var _=require(_0xaaa4('0x4'));var faxAccount=require(_0xaaa4('0x5'));function loggerCatch(_0x3e0f28){return function(_0x4521ac){logger[_0xaaa4('0x6')](_0x3e0f28,util[_0xaaa4('0x7')](_0x4521ac,{'showHidden':![],'depth':null}));};}exports[_0xaaa4('0x8')]=function(_0x70815e,_0x2830c2){return BPromise[_0xaaa4('0x9')]()['then'](faxAccount['notify'](_0x70815e,_0x2830c2))[_0xaaa4('0xa')](loggerCatch(_0xaaa4('0xb')));}; \ No newline at end of file +var _0x23c6=['bluebird','preview','lodash','../rpc/faxAccount','error','notify','resolve','then','catch','util'];(function(_0x3546fb,_0x137629){var _0x2446b9=function(_0x2709e6){while(--_0x2709e6){_0x3546fb['push'](_0x3546fb['shift']());}};_0x2446b9(++_0x137629);}(_0x23c6,0x13f));var _0x623c=function(_0x27c7a6,_0x162459){_0x27c7a6=_0x27c7a6-0x0;var _0x2710a0=_0x23c6[_0x27c7a6];return _0x2710a0;};'use strict';var util=require(_0x623c('0x0'));var BPromise=require(_0x623c('0x1'));var logger=require('../../../config/logger')(_0x623c('0x2'));var _=require(_0x623c('0x3'));var faxAccount=require(_0x623c('0x4'));function loggerCatch(_0x5aa4b0){return function(_0x1e4448){logger[_0x623c('0x5')](_0x5aa4b0,util['inspect'](_0x1e4448,{'showHidden':![],'depth':null}));};}exports[_0x623c('0x6')]=function(_0x1c2e02,_0x382a5f){return BPromise[_0x623c('0x7')]()[_0x623c('0x8')](faxAccount[_0x623c('0x6')](_0x1c2e02,_0x382a5f))[_0x623c('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index f36d844..5654b4d 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 _0xcab4=['info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','exec','execute'];(function(_0x420770,_0x3f7edf){var _0x1fe12e=function(_0x94c17e){while(--_0x94c17e){_0x420770['push'](_0x420770['shift']());}};_0x1fe12e(++_0x3f7edf);}(_0xcab4,0x1a8));var _0x4cab=function(_0x17ad24,_0x4f85f7){_0x17ad24=_0x17ad24-0x0;var _0x5e2554=_0xcab4[_0x17ad24];return _0x5e2554;};'use strict';var util=require(_0x4cab('0x0'));var logger=require(_0x4cab('0x1'))(_0x4cab('0x2'));var BPromise=require(_0x4cab('0x3'));var exec=require('child_process')[_0x4cab('0x4')];exports[_0x4cab('0x5')]=function(_0xe14e60){return new BPromise(function(_0x471492,_0x151527){exec(_0xe14e60,function(_0x44bea6,_0x383246,_0x22c883){logger[_0x4cab('0x6')](_0x4cab('0x7'),_0x383246);if(_0x44bea6){logger[_0x4cab('0x6')](_0x4cab('0x7'),_0x4cab('0x8'),util[_0x4cab('0x9')](_0x44bea6,{'showHidden':![],'depth':null}),_0x383246,_0x22c883);_0x151527(_0x44bea6);}_0x471492(_0x383246);});});}; \ No newline at end of file +var _0xe0c0=['exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','fax','child_process'];(function(_0x2a75cd,_0x247962){var _0x2319bc=function(_0x47d0c5){while(--_0x47d0c5){_0x2a75cd['push'](_0x2a75cd['shift']());}};_0x2319bc(++_0x247962);}(_0xe0c0,0xcc));var _0x0e0c=function(_0x280a33,_0x78b01){_0x280a33=_0x280a33-0x0;var _0x52efa8=_0xe0c0[_0x280a33];return _0x52efa8;};'use strict';var util=require(_0x0e0c('0x0'));var logger=require('../../../../config/logger')(_0x0e0c('0x1'));var BPromise=require('bluebird');var exec=require(_0x0e0c('0x2'))[_0x0e0c('0x3')];exports[_0x0e0c('0x4')]=function(_0x81b738){return new BPromise(function(_0x4e2f82,_0x55c312){exec(_0x81b738,function(_0x4dda32,_0x2bc6aa,_0x3ea101){logger[_0x0e0c('0x5')]('Exec\x20gs',_0x2bc6aa);if(_0x4dda32){logger[_0x0e0c('0x5')](_0x0e0c('0x6'),_0x0e0c('0x7'),util[_0x0e0c('0x8')](_0x4dda32,{'showHidden':![],'depth':null}),_0x2bc6aa,_0x3ea101);_0x55c312(_0x4dda32);}_0x4e2f82(_0x2bc6aa);});});}; \ 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 5920ff1..6697639 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 _0xf9bd=['uniqueid','util','lodash','fax','message','logger','info','inspect','addVariables','headerinfo','\x22%s\x22','gateway','faxdetect','localstationid','path','variablesAction','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf9bd,0x94));var _0xdf9b=function(_0x1ea10e,_0x1b6c94){_0x1ea10e=_0x1ea10e-0x0;var _0x4396e9=_0xf9bd[_0x1ea10e];return _0x4396e9;};'use strict';var util=require(_0xdf9b('0x0'));var _=require(_0xdf9b('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0xdf9b('0x2'));exports[_0xdf9b('0x3')]=function(_0x319d9a){return{'message':_0x319d9a};};exports[_0xdf9b('0x4')]=function(_0x4f2a3b,_0x47d3d5){logger[_0xdf9b('0x5')](_0x4f2a3b,util[_0xdf9b('0x6')](_0x47d3d5,{'showHidden':![],'depth':null}));};exports[_0xdf9b('0x7')]=function(_0x1bee0,_0x325d90){var _0x4dae36={'XMF-ECM':_0x325d90['ecm'],'XMF-HEADERINFO':_0x325d90[_0xdf9b('0x8')],'XMF-MINRATE':_0x325d90['minrate'],'XMF-MAXRATE':_0x325d90['maxrate'],'XMF-MODEM':util['format'](_0xdf9b('0x9'),_0x325d90['modem']),'XMF-GATEWAY':_0x325d90[_0xdf9b('0xa')],'XMF-FAXDETECT':_0x325d90[_0xdf9b('0xb')],'XMF-T38TIMEOUT':_0x325d90['t38timeout'],'XMF-LOCALSTATIONID':_0x325d90[_0xdf9b('0xc')],'XMF-PATH':_0x1bee0[_0xdf9b('0xd')]};return _0x4dae36;};exports[_0xdf9b('0xe')]=function(_0x1d8bd4,_0x4324d9){return{'actionid':_0x1d8bd4['uniqueid'],'action':'originate','channel':_0x1d8bd4[_0xdf9b('0xf')],'Exten':_0xdf9b('0x10'),'Context':_0xdf9b('0x11'),'Priority':'1','callerid':util[_0xdf9b('0x12')](_0xdf9b('0x13'),_0x1d8bd4[_0xdf9b('0x8')]?_0x1d8bd4[_0xdf9b('0x8')]:'',_0x1d8bd4[_0xdf9b('0xc')]),'variable':_0x4324d9,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1d8bd4[_0xdf9b('0x14')]};}; \ No newline at end of file +var _0xeb60=['from-sip','headerinfo','util','lodash','moment','fax','logger','info','inspect','ecm','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','uniqueid','originate','xcally-motion-fax'];(function(_0xf6f5ee,_0x1c79bc){var _0x22f43e=function(_0x40afca){while(--_0x40afca){_0xf6f5ee['push'](_0xf6f5ee['shift']());}};_0x22f43e(++_0x1c79bc);}(_0xeb60,0x189));var _0x0eb6=function(_0x19244a,_0x43e29f){_0x19244a=_0x19244a-0x0;var _0x28e8e6=_0xeb60[_0x19244a];return _0x28e8e6;};'use strict';var util=require(_0x0eb6('0x0'));var _=require(_0x0eb6('0x1'));var moment=require(_0x0eb6('0x2'));var logger=require('../../../../config/logger')(_0x0eb6('0x3'));exports['message']=function(_0x4f44c0){return{'message':_0x4f44c0};};exports[_0x0eb6('0x4')]=function(_0x4f07fd,_0x4e6642){logger[_0x0eb6('0x5')](_0x4f07fd,util[_0x0eb6('0x6')](_0x4e6642,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x5a4a65,_0x2fa8f9){var _0xd83ac8={'XMF-ECM':_0x2fa8f9[_0x0eb6('0x7')],'XMF-HEADERINFO':_0x2fa8f9['headerinfo'],'XMF-MINRATE':_0x2fa8f9[_0x0eb6('0x8')],'XMF-MAXRATE':_0x2fa8f9[_0x0eb6('0x9')],'XMF-MODEM':util[_0x0eb6('0xa')](_0x0eb6('0xb'),_0x2fa8f9[_0x0eb6('0xc')]),'XMF-GATEWAY':_0x2fa8f9[_0x0eb6('0xd')],'XMF-FAXDETECT':_0x2fa8f9[_0x0eb6('0xe')],'XMF-T38TIMEOUT':_0x2fa8f9[_0x0eb6('0xf')],'XMF-LOCALSTATIONID':_0x2fa8f9[_0x0eb6('0x10')],'XMF-PATH':_0x5a4a65[_0x0eb6('0x11')]};return _0xd83ac8;};exports['variablesAction']=function(_0x5961ec,_0x286e63){return{'actionid':_0x5961ec[_0x0eb6('0x12')],'action':_0x0eb6('0x13'),'channel':_0x5961ec['channel'],'Exten':_0x0eb6('0x14'),'Context':_0x0eb6('0x15'),'Priority':'1','callerid':util[_0x0eb6('0xa')]('\x22%s\x22\x20<%s>',_0x5961ec[_0x0eb6('0x16')]?_0x5961ec['headerinfo']:'',_0x5961ec[_0x0eb6('0x10')]),'variable':_0x286e63,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5961ec[_0x0eb6('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 801541a..d43920b 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 _0xa403=['initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','util','./realtime','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts'];(function(_0x3d90e3,_0x1ccad2){var _0x217b11=function(_0x4aaa9b){while(--_0x4aaa9b){_0x3d90e3['push'](_0x3d90e3['shift']());}};_0x217b11(++_0x1ccad2);}(_0xa403,0xe1));var _0x3a40=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0xa403[_0x4063a4];return _0x17908d;};'use strict';var util=require(_0x3a40('0x0'));var moment=require('moment');var server=require('./server');var Realtime=require(_0x3a40('0x1'));var Report=require('./report');var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0x3a40('0x2'));var Fax=require(_0x3a40('0x3'));var user=require('./rpc/user');var voiceQueue=require(_0x3a40('0x4'));var voiceQueueReport=require(_0x3a40('0x5'));var voiceCallReport=require(_0x3a40('0x6'));var trunk=require('./rpc/trunk');var trigger=require(_0x3a40('0x7'));var template=require('./rpc/template');var cmHopperHistory=require(_0x3a40('0x8'));var campaign=require(_0x3a40('0x9'));var voiceExtension=require(_0x3a40('0xa'));var faxAccount=require(_0x3a40('0xb'));var zendesk=require(_0x3a40('0xc'));var salesforce=require(_0x3a40('0xd'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x3a40('0xe'));var desk=require(_0x3a40('0xf'));var zoho=require(_0x3a40('0x10'));var vtiger=require(_0x3a40('0x11'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x3a40('0x12'));var dynamics365=require(_0x3a40('0x13'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x3a40('0x14')](_0x3a40('0x15'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x3a40('0x14')](_0x3a40('0x15'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x3a40('0x16')]()[_0x3a40('0x17')](user['getAgents']())['then'](realtime[_0x3a40('0x18')]())['then'](user[_0x3a40('0x19')]())['then'](realtime[_0x3a40('0x1a')]())[_0x3a40('0x17')](trunk[_0x3a40('0x1b')]())[_0x3a40('0x17')](realtime[_0x3a40('0x1c')]())[_0x3a40('0x17')](voiceQueue['getVoiceQueues']())[_0x3a40('0x17')](realtime[_0x3a40('0x1d')]())[_0x3a40('0x17')](trigger['getTriggers']())[_0x3a40('0x17')](realtime[_0x3a40('0x1e')]())[_0x3a40('0x17')](template[_0x3a40('0x1f')]())[_0x3a40('0x17')](realtime['initTemplates']())[_0x3a40('0x17')](zendesk[_0x3a40('0x20')]())['then'](realtime[_0x3a40('0x21')]())['then'](salesforce[_0x3a40('0x22')]())['then'](realtime[_0x3a40('0x23')]())[_0x3a40('0x17')](sugarcrm[_0x3a40('0x24')]())[_0x3a40('0x17')](realtime[_0x3a40('0x25')]())[_0x3a40('0x17')](freshdesk['getFreshdeskAccounts']())[_0x3a40('0x17')](realtime[_0x3a40('0x26')]())[_0x3a40('0x17')](desk['getDeskAccounts']())[_0x3a40('0x17')](realtime[_0x3a40('0x27')]())['then'](zoho[_0x3a40('0x28')]())[_0x3a40('0x17')](realtime[_0x3a40('0x29')]())[_0x3a40('0x17')](vtiger[_0x3a40('0x2a')]())[_0x3a40('0x17')](realtime[_0x3a40('0x2b')]())[_0x3a40('0x17')](freshsales['getFreshsalesAccounts']())[_0x3a40('0x17')](realtime[_0x3a40('0x2c')]())[_0x3a40('0x17')](servicenow[_0x3a40('0x2d')]())['then'](realtime[_0x3a40('0x2e')]())[_0x3a40('0x17')](dynamics365[_0x3a40('0x2f')]())[_0x3a40('0x17')](realtime[_0x3a40('0x30')]())['then'](campaign[_0x3a40('0x31')]())[_0x3a40('0x17')](realtime[_0x3a40('0x32')]())[_0x3a40('0x17')](voiceExtension[_0x3a40('0x33')]())[_0x3a40('0x17')](realtime[_0x3a40('0x34')]())[_0x3a40('0x17')](faxAccount[_0x3a40('0x35')]())['then'](realtime[_0x3a40('0x36')]())[_0x3a40('0x17')](function(){return realtime;});}function initParams(){return Promise['resolve']()['then'](voiceQueueReport['getVoiceQueueReports']())[_0x3a40('0x17')](realtime[_0x3a40('0x37')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x3a40('0x17')](realtime[_0x3a40('0x38')]())[_0x3a40('0x17')](cmHopperHistory[_0x3a40('0x39')]())[_0x3a40('0x17')](realtime[_0x3a40('0x3a')]())['then'](voiceCallReport[_0x3a40('0x3b')]())[_0x3a40('0x17')](realtime['initVoiceCallReports']())[_0x3a40('0x3c')](function(_0x381cd8){logger[_0x3a40('0x3d')](_0x3a40('0x3e'),util[_0x3a40('0x3f')](_0x381cd8,{'showHidden':![],'depth':null}));});}function main(){return server[_0x3a40('0x40')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x3a40('0x17')](function(){return initParams();})[_0x3a40('0x17')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x3a40('0x3c')](function(_0x4de904){logger[_0x3a40('0x3d')]('[index.js][main]',util[_0x3a40('0x3f')](_0x4de904,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x1295=['getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','[index.js][main]','inspect','util','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts'];(function(_0x40c054,_0xf817fc){var _0x485555=function(_0x2841e8){while(--_0x2841e8){_0x40c054['push'](_0x40c054['shift']());}};_0x485555(++_0xf817fc);}(_0x1295,0x17a));var _0x5129=function(_0x48625a,_0x49aa9f){_0x48625a=_0x48625a-0x0;var _0x25512a=_0x1295[_0x48625a];return _0x25512a;};'use strict';var util=require(_0x5129('0x0'));var moment=require('moment');var server=require(_0x5129('0x1'));var Realtime=require(_0x5129('0x2'));var Report=require(_0x5129('0x3'));var Acw=require(_0x5129('0x4'));var Trigger=require('./trigger');var Dialer=require(_0x5129('0x5'));var Preview=require(_0x5129('0x6'));var Fax=require(_0x5129('0x7'));var user=require(_0x5129('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x5129('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x5129('0xa'));var trigger=require('./rpc/trigger');var template=require(_0x5129('0xb'));var cmHopperHistory=require(_0x5129('0xc'));var campaign=require(_0x5129('0xd'));var voiceExtension=require(_0x5129('0xe'));var faxAccount=require(_0x5129('0xf'));var zendesk=require(_0x5129('0x10'));var salesforce=require(_0x5129('0x11'));var sugarcrm=require(_0x5129('0x12'));var freshdesk=require(_0x5129('0x13'));var desk=require(_0x5129('0x14'));var zoho=require(_0x5129('0x15'));var vtiger=require(_0x5129('0x16'));var freshsales=require(_0x5129('0x17'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x5129('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x5129('0x19'))(_0x5129('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x5129('0x1b')](_0x5129('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x5129('0x1b')](_0x5129('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x5129('0x1d')]()[_0x5129('0x1e')](user[_0x5129('0x1f')]())['then'](realtime[_0x5129('0x20')]())[_0x5129('0x1e')](user[_0x5129('0x21')]())[_0x5129('0x1e')](realtime[_0x5129('0x22')]())[_0x5129('0x1e')](trunk[_0x5129('0x23')]())[_0x5129('0x1e')](realtime['initTrunks']())[_0x5129('0x1e')](voiceQueue[_0x5129('0x24')]())[_0x5129('0x1e')](realtime[_0x5129('0x25')]())[_0x5129('0x1e')](trigger[_0x5129('0x26')]())['then'](realtime[_0x5129('0x27')]())['then'](template[_0x5129('0x28')]())[_0x5129('0x1e')](realtime[_0x5129('0x29')]())[_0x5129('0x1e')](zendesk[_0x5129('0x2a')]())[_0x5129('0x1e')](realtime[_0x5129('0x2b')]())[_0x5129('0x1e')](salesforce['getSalesforceAccounts']())[_0x5129('0x1e')](realtime[_0x5129('0x2c')]())[_0x5129('0x1e')](sugarcrm[_0x5129('0x2d')]())['then'](realtime[_0x5129('0x2e')]())[_0x5129('0x1e')](freshdesk[_0x5129('0x2f')]())[_0x5129('0x1e')](realtime[_0x5129('0x30')]())[_0x5129('0x1e')](desk['getDeskAccounts']())['then'](realtime[_0x5129('0x31')]())[_0x5129('0x1e')](zoho[_0x5129('0x32')]())[_0x5129('0x1e')](realtime['initZohoAccounts']())[_0x5129('0x1e')](vtiger[_0x5129('0x33')]())['then'](realtime['initVtigerAccounts']())['then'](freshsales[_0x5129('0x34')]())[_0x5129('0x1e')](realtime[_0x5129('0x35')]())[_0x5129('0x1e')](servicenow['getServicenowAccounts']())['then'](realtime['initServicenowAccounts']())[_0x5129('0x1e')](dynamics365['getDynamics365Accounts']())[_0x5129('0x1e')](realtime['initDynamics365Accounts']())[_0x5129('0x1e')](campaign[_0x5129('0x36')]())[_0x5129('0x1e')](realtime[_0x5129('0x37')]())['then'](voiceExtension['getVoiceExtensions']())['then'](realtime[_0x5129('0x38')]())['then'](faxAccount[_0x5129('0x39')]())[_0x5129('0x1e')](realtime[_0x5129('0x3a')]())[_0x5129('0x1e')](function(){return realtime;});}function initParams(){return Promise[_0x5129('0x1d')]()['then'](voiceQueueReport[_0x5129('0x3b')]())[_0x5129('0x1e')](realtime['initVoiceQueueReports']())[_0x5129('0x1e')](cmHopperHistory[_0x5129('0x3c')]())[_0x5129('0x1e')](realtime[_0x5129('0x3d')]())[_0x5129('0x1e')](cmHopperHistory[_0x5129('0x3e')]())[_0x5129('0x1e')](realtime[_0x5129('0x3f')]())[_0x5129('0x1e')](voiceCallReport[_0x5129('0x40')]())[_0x5129('0x1e')](realtime[_0x5129('0x41')]())[_0x5129('0x42')](function(_0x4a6eaa){logger[_0x5129('0x43')](_0x5129('0x44'),util['inspect'](_0x4a6eaa,{'showHidden':![],'depth':null}));});}function main(){return server[_0x5129('0x45')](realtime,preview,fax)[_0x5129('0x1e')](function(){return initRealtime();})[_0x5129('0x1e')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x409bdb){logger[_0x5129('0x43')](_0x5129('0x46'),util[_0x5129('0x47')](_0x409bdb,{'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 db69d94..e5778ab 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 _0xf842=['accountcode','fullname','state','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','not_inuse','idle','inuse','statePause','toNumber','stringify','user:%s','emit','user:ami:update','omit','user:presence','exports','lodash','util','moment','md5','../../../config/environment','redis','defaults','localhost','name','email'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xf842,0x172));var _0x2f84=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0xf842[_0x19159a];return _0xa677f4;};'use strict';var _=require(_0x2f84('0x0'));var util=require(_0x2f84('0x1'));var moment=require(_0x2f84('0x2'));var md5=require(_0x2f84('0x3'));var Redis=require('ioredis');var config=require(_0x2f84('0x4'));config[_0x2f84('0x5')]=_[_0x2f84('0x6')](config[_0x2f84('0x5')],{'host':_0x2f84('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2f84('0x5')]));function Agent(_0x20e773){this['id']=_0x20e773['id']||0x0;this[_0x2f84('0x8')]=_0x20e773['name']||'';this[_0x2f84('0x9')]=_0x20e773[_0x2f84('0x9')]||'';this[_0x2f84('0xa')]=_0x20e773[_0x2f84('0xa')]||'';this[_0x2f84('0xb')]=_0x20e773[_0x2f84('0xb')]||'';this[_0x2f84('0xc')]=_0x2f84('0xd');this[_0x2f84('0xe')]=0x0;this[_0x2f84('0xf')]='unknown';this[_0x2f84('0x10')]='';this['phone']='';this[_0x2f84('0x11')]='';this[_0x2f84('0x12')]='';this[_0x2f84('0x13')]=_0x20e773[_0x2f84('0x13')]||![];this[_0x2f84('0x14')]=_0x2f84('0xd');this[_0x2f84('0x15')]=0x0;this[_0x2f84('0x16')]='';this[_0x2f84('0x17')]='';this[_0x2f84('0x18')]=![];this[_0x2f84('0x19')]=![];this[_0x2f84('0x3')]='';}Agent['prototype']['updateStatusRealtime']=function(_0x50d906){var _0x31ddd4;if(_0x50d906&&_0x50d906[_0x2f84('0xc')]){_0x31ddd4=_0x50d906[_0x2f84('0xc')]['toLowerCase']();switch(_0x31ddd4){case _0x2f84('0x1a'):_0x31ddd4=_0x2f84('0x1b');break;case _0x2f84('0x1c'):_0x31ddd4='talking';break;}}if(_0x31ddd4&&this[_0x2f84('0x14')]!==_0x31ddd4||_0x50d906[_0x2f84('0x1d')]){this[_0x2f84('0x15')]=_[_0x2f84('0x1e')](moment()['format']('x'));}if(_0x31ddd4){this[_0x2f84('0x14')]=_0x31ddd4;}var _0x51bdee={'id':this['id'],'name':this[_0x2f84('0x8')],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0x2f84('0xb')],'state':this[_0x2f84('0xc')],'stateTime':this[_0x2f84('0xe')],'status':this[_0x2f84('0xf')],'address':this[_0x2f84('0x10')],'online':this[_0x2f84('0x13')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x2f84('0x16')],'voiceStatusQueue':this[_0x2f84('0x17')],'interface':this[_0x2f84('0x12')],'onhold':this[_0x2f84('0x18')]};var _0x39ee8b=md5(JSON[_0x2f84('0x1f')](_0x51bdee));if(this['md5']!==_0x39ee8b){this[_0x2f84('0x3')]=_0x39ee8b;io['to'](util['format'](_0x2f84('0x20'),_0x51bdee['name']))[_0x2f84('0x21')](_0x2f84('0x22'),_[_0x2f84('0x23')](_0x51bdee,['online']));io[_0x2f84('0x21')](_0x2f84('0x24'),_0x51bdee);}};module[_0x2f84('0x25')]=Agent; \ No newline at end of file +var _0xcb65=['accountcode','fullname','state','unknown','stateTime','status','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','md5','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','talking','address','user:%s','emit','user:ami:update','omit','user:presence','exports','lodash','moment','ioredis','../../../config/environment','redis','localhost','name','email'];(function(_0x404cfd,_0x28c4a2){var _0x3a2b75=function(_0x14c453){while(--_0x14c453){_0x404cfd['push'](_0x404cfd['shift']());}};_0x3a2b75(++_0x28c4a2);}(_0xcb65,0x13c));var _0x5cb6=function(_0x25e905,_0x42f080){_0x25e905=_0x25e905-0x0;var _0x4d1f16=_0xcb65[_0x25e905];return _0x4d1f16;};'use strict';var _=require(_0x5cb6('0x0'));var util=require('util');var moment=require(_0x5cb6('0x1'));var md5=require('md5');var Redis=require(_0x5cb6('0x2'));var config=require(_0x5cb6('0x3'));config[_0x5cb6('0x4')]=_['defaults'](config[_0x5cb6('0x4')],{'host':_0x5cb6('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x19adb3){this['id']=_0x19adb3['id']||0x0;this[_0x5cb6('0x6')]=_0x19adb3['name']||'';this[_0x5cb6('0x7')]=_0x19adb3[_0x5cb6('0x7')]||'';this['accountcode']=_0x19adb3[_0x5cb6('0x8')]||'';this[_0x5cb6('0x9')]=_0x19adb3[_0x5cb6('0x9')]||'';this[_0x5cb6('0xa')]=_0x5cb6('0xb');this[_0x5cb6('0xc')]=0x0;this[_0x5cb6('0xd')]=_0x5cb6('0xb');this['address']='';this['phone']='';this[_0x5cb6('0xe')]='';this[_0x5cb6('0xf')]='';this[_0x5cb6('0x10')]=_0x19adb3[_0x5cb6('0x10')]||![];this[_0x5cb6('0x11')]=_0x5cb6('0xb');this[_0x5cb6('0x12')]=0x0;this[_0x5cb6('0x13')]='';this['voiceStatusQueue']='';this[_0x5cb6('0x14')]=![];this[_0x5cb6('0x15')]=![];this[_0x5cb6('0x16')]='';}Agent[_0x5cb6('0x17')][_0x5cb6('0x18')]=function(_0x4d4bd0){var _0x23bd7d;if(_0x4d4bd0&&_0x4d4bd0['state']){_0x23bd7d=_0x4d4bd0['state'][_0x5cb6('0x19')]();switch(_0x23bd7d){case _0x5cb6('0x1a'):_0x23bd7d=_0x5cb6('0x1b');break;case'inuse':_0x23bd7d=_0x5cb6('0x1c');break;}}if(_0x23bd7d&&this[_0x5cb6('0x11')]!==_0x23bd7d||_0x4d4bd0['statePause']){this[_0x5cb6('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x23bd7d){this['voiceStatus']=_0x23bd7d;}var _0x69b65f={'id':this['id'],'name':this[_0x5cb6('0x6')],'email':this['email'],'accountcode':this[_0x5cb6('0x8')],'fullname':this[_0x5cb6('0x9')],'state':this[_0x5cb6('0xa')],'stateTime':this[_0x5cb6('0xc')],'status':this['status'],'address':this[_0x5cb6('0x1d')],'online':this[_0x5cb6('0x10')],'voiceStatus':this[_0x5cb6('0x11')],'voiceStatusTime':this[_0x5cb6('0x12')],'voiceStatusCallerIdNumber':this[_0x5cb6('0x13')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x5cb6('0xf')],'onhold':this['onhold']};var _0x523abc=md5(JSON['stringify'](_0x69b65f));if(this[_0x5cb6('0x16')]!==_0x523abc){this['md5']=_0x523abc;io['to'](util['format'](_0x5cb6('0x1e'),_0x69b65f[_0x5cb6('0x6')]))[_0x5cb6('0x1f')](_0x5cb6('0x20'),_[_0x5cb6('0x21')](_0x69b65f,[_0x5cb6('0x10')]));io['emit'](_0x5cb6('0x22'),_0x69b65f);}};module[_0x5cb6('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index e0cc17f..3626e2f 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 _0xf8e8=['Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk'];(function(_0x5713b5,_0x423f83){var _0x2f795d=function(_0x392aea){while(--_0x392aea){_0x5713b5['push'](_0x5713b5['shift']());}};_0x2f795d(++_0x423f83);}(_0xf8e8,0x1c5));var _0x8f8e=function(_0x547b36,_0x4824d8){_0x547b36=_0x547b36-0x0;var _0x1d0867=_0xf8e8[_0x547b36];return _0x1d0867;};'use strict';function Campaign(_0x5668e2){this['id']=_0x5668e2['id']||0x0;this[_0x8f8e('0x0')]=_0x5668e2[_0x8f8e('0x0')]||'';this['type']=_0x5668e2[_0x8f8e('0x1')]||'campaign';this[_0x8f8e('0x2')]=0x0;this[_0x8f8e('0x3')]=0x0;this[_0x8f8e('0x4')]=0x0;this[_0x8f8e('0x5')]=0x0;this[_0x8f8e('0x6')]='';this[_0x8f8e('0x7')]=!![];this['active']=_0x5668e2[_0x8f8e('0x8')];this[_0x8f8e('0x9')]=_0x5668e2[_0x8f8e('0x9')];this['dialTimezone']=_0x5668e2[_0x8f8e('0xa')]||null;this[_0x8f8e('0xb')]=_0x5668e2['dialGlobalInterval']?_0x5668e2[_0x8f8e('0xb')]:null;this[_0x8f8e('0xc')]=_0x5668e2[_0x8f8e('0xc')];this['dialOriginateCallerIdNumber']=_0x5668e2[_0x8f8e('0xd')];this[_0x8f8e('0xe')]=_0x5668e2[_0x8f8e('0xe')]||0x1e;this[_0x8f8e('0xf')]=_0x5668e2[_0x8f8e('0xf')];this[_0x8f8e('0x10')]=_0x5668e2['dialCongestionRetryFrequency'];this[_0x8f8e('0x11')]=_0x5668e2[_0x8f8e('0x11')];this[_0x8f8e('0x12')]=_0x5668e2[_0x8f8e('0x12')];this[_0x8f8e('0x13')]=_0x5668e2[_0x8f8e('0x13')];this[_0x8f8e('0x14')]=_0x5668e2['dialNoAnswerRetryFrequency'];this[_0x8f8e('0x15')]=_0x5668e2[_0x8f8e('0x15')];this[_0x8f8e('0x16')]=_0x5668e2[_0x8f8e('0x16')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5668e2[_0x8f8e('0x17')]||0x96;this[_0x8f8e('0x18')]=_0x5668e2[_0x8f8e('0x18')]||0x3;this[_0x8f8e('0x19')]=_0x5668e2[_0x8f8e('0x19')]||0x96;this['dialAbandonedMaxRetry']=_0x5668e2[_0x8f8e('0x1a')]||0x3;this[_0x8f8e('0x1b')]=_0x5668e2[_0x8f8e('0x1b')]||0x96;this[_0x8f8e('0x1c')]=_0x5668e2[_0x8f8e('0x1c')]||0x3;this['dialMachineRetryFrequency']=_0x5668e2['dialMachineRetryFrequency']||0x96;this[_0x8f8e('0x1d')]=_0x5668e2[_0x8f8e('0x1d')]||0x3;this[_0x8f8e('0x1e')]=_0x5668e2[_0x8f8e('0x1e')]||0x96;this[_0x8f8e('0x1f')]=_0x5668e2[_0x8f8e('0x1f')]||_0x8f8e('0x20');this[_0x8f8e('0x21')]=_0x5668e2[_0x8f8e('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x5668e2['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x5668e2[_0x8f8e('0x22')]||undefined;this[_0x8f8e('0x23')]=_0x5668e2[_0x8f8e('0x23')]?_0x5668e2['TrunkBackup']:undefined;this['Trunk']=_0x5668e2[_0x8f8e('0x24')]?_0x5668e2[_0x8f8e('0x24')]:undefined;this[_0x8f8e('0x25')]=_0x5668e2[_0x8f8e('0x25')]?_0x5668e2[_0x8f8e('0x25')]:undefined;this[_0x8f8e('0x26')]=_0x5668e2[_0x8f8e('0x26')]?_0x5668e2[_0x8f8e('0x26')]:undefined;this['dialQueueProject']=_0x5668e2[_0x8f8e('0x26')]?_0x5668e2[_0x8f8e('0x26')]['name']:undefined;this[_0x8f8e('0x27')]=_0x5668e2['dialAMDActive']||![];this[_0x8f8e('0x28')]=_0x5668e2[_0x8f8e('0x28')];this[_0x8f8e('0x29')]=_0x5668e2[_0x8f8e('0x29')];this[_0x8f8e('0x2a')]=_0x5668e2[_0x8f8e('0x2a')];this[_0x8f8e('0x2b')]=_0x5668e2['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x5668e2[_0x8f8e('0x2c')];this[_0x8f8e('0x2d')]=_0x5668e2['dialAMDBetweenWordsSilence'];this[_0x8f8e('0x2e')]=_0x5668e2['dialAMDMaximumNumberOfWords'];this[_0x8f8e('0x2f')]=_0x5668e2[_0x8f8e('0x2f')];this[_0x8f8e('0x30')]=_0x5668e2[_0x8f8e('0x30')];}module['exports']=Campaign; \ No newline at end of file +var _0x9395=['dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0x9395,0xe1));var _0x5939=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9395[_0x167cc1];return _0x10bc4b;};'use strict';function Campaign(_0x11458d){this['id']=_0x11458d['id']||0x0;this[_0x5939('0x0')]=_0x11458d[_0x5939('0x0')]||'';this[_0x5939('0x1')]=_0x11458d[_0x5939('0x1')]||_0x5939('0x2');this[_0x5939('0x3')]=0x0;this[_0x5939('0x4')]=0x0;this[_0x5939('0x5')]=0x0;this[_0x5939('0x6')]=0x0;this['message']='';this[_0x5939('0x7')]=!![];this[_0x5939('0x8')]=_0x11458d[_0x5939('0x8')];this['limitCalls']=_0x11458d[_0x5939('0x9')];this[_0x5939('0xa')]=_0x11458d['dialTimezone']||null;this[_0x5939('0xb')]=_0x11458d[_0x5939('0xb')]?_0x11458d[_0x5939('0xb')]:null;this[_0x5939('0xc')]=_0x11458d[_0x5939('0xc')];this[_0x5939('0xd')]=_0x11458d[_0x5939('0xd')];this['dialOriginateTimeout']=_0x11458d[_0x5939('0xe')]||0x1e;this[_0x5939('0xf')]=_0x11458d[_0x5939('0xf')];this['dialCongestionRetryFrequency']=_0x11458d['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x11458d[_0x5939('0x10')];this[_0x5939('0x11')]=_0x11458d[_0x5939('0x11')];this[_0x5939('0x12')]=_0x11458d['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x11458d['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x11458d[_0x5939('0x13')];this[_0x5939('0x14')]=_0x11458d[_0x5939('0x14')]||0x3;this[_0x5939('0x15')]=_0x11458d[_0x5939('0x15')]||0x96;this[_0x5939('0x16')]=_0x11458d[_0x5939('0x16')]||0x3;this['dialDropRetryFrequency']=_0x11458d[_0x5939('0x17')]||0x96;this[_0x5939('0x18')]=_0x11458d[_0x5939('0x18')]||0x3;this[_0x5939('0x19')]=_0x11458d[_0x5939('0x19')]||0x96;this[_0x5939('0x1a')]=_0x11458d[_0x5939('0x1a')]||0x3;this[_0x5939('0x1b')]=_0x11458d[_0x5939('0x1b')]||0x96;this[_0x5939('0x1c')]=_0x11458d[_0x5939('0x1c')]||0x3;this[_0x5939('0x1d')]=_0x11458d[_0x5939('0x1d')]||0x96;this[_0x5939('0x1e')]=_0x11458d['dialOrderByScheduledAt']||_0x5939('0x1f');this['dialPrefix']=_0x11458d[_0x5939('0x20')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x11458d[_0x5939('0x21')]||undefined;this[_0x5939('0x22')]=_0x11458d[_0x5939('0x22')]||undefined;this['TrunkBackup']=_0x11458d[_0x5939('0x23')]?_0x11458d[_0x5939('0x23')]:undefined;this['Trunk']=_0x11458d['Trunk']?_0x11458d['Trunk']:undefined;this[_0x5939('0x24')]=_0x11458d[_0x5939('0x24')]?_0x11458d['Interval']:undefined;this[_0x5939('0x25')]=_0x11458d[_0x5939('0x25')]?_0x11458d[_0x5939('0x25')]:undefined;this[_0x5939('0x26')]=_0x11458d[_0x5939('0x25')]?_0x11458d[_0x5939('0x25')][_0x5939('0x0')]:undefined;this[_0x5939('0x27')]=_0x11458d[_0x5939('0x27')]||![];this[_0x5939('0x28')]=_0x11458d[_0x5939('0x28')];this[_0x5939('0x29')]=_0x11458d[_0x5939('0x29')];this[_0x5939('0x2a')]=_0x11458d[_0x5939('0x2a')];this[_0x5939('0x2b')]=_0x11458d['dialAMDTotalAnalysisTime'];this[_0x5939('0x2c')]=_0x11458d[_0x5939('0x2c')];this[_0x5939('0x2d')]=_0x11458d[_0x5939('0x2d')];this[_0x5939('0x2e')]=_0x11458d['dialAMDMaximumNumberOfWords'];this[_0x5939('0x2f')]=_0x11458d[_0x5939('0x2f')];this[_0x5939('0x30')]=_0x11458d[_0x5939('0x30')];}module[_0x5939('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 4fc0c8d..6fde811 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 _0x75dc=['accountcode','context','uniqueid','linkedid','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','holdtime','disposition','monitor','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','connectedlinenum','connectedlinename'];(function(_0x21a1a9,_0x5c0d44){var _0x26f1f1=function(_0x1c4ba9){while(--_0x1c4ba9){_0x21a1a9['push'](_0x21a1a9['shift']());}};_0x26f1f1(++_0x5c0d44);}(_0x75dc,0x1d7));var _0xc75d=function(_0x3d14d1,_0x23aa69){_0x3d14d1=_0x3d14d1-0x0;var _0xc78d1f=_0x75dc[_0x3d14d1];return _0xc78d1f;};'use strict';function Channel(){this[_0xc75d('0x0')]=null;this[_0xc75d('0x1')]='';this['destinationchannel']='';this['calleridnum']=0x0;this['calleridname']='';this[_0xc75d('0x2')]=undefined;this[_0xc75d('0x3')]=undefined;this[_0xc75d('0x4')]=0x0;this[_0xc75d('0x5')]='';this[_0xc75d('0x6')]=0x0;this[_0xc75d('0x7')]=0x0;this['exten']=0x0;this[_0xc75d('0x8')]=![];this[_0xc75d('0x9')]=null;this[_0xc75d('0xa')]=null;this['unmanaged']=![];this[_0xc75d('0xb')]=![];this[_0xc75d('0xc')]='';this[_0xc75d('0xd')]='';this[_0xc75d('0xe')]=0x0;this['billableseconds']=0x0;this[_0xc75d('0xf')]=0x0;this['type']=null;this['tag']=null;this[_0xc75d('0x10')]=null;this[_0xc75d('0x11')]=![];this[_0xc75d('0x12')]=null;this[_0xc75d('0x13')]=null;this['monitors']=[];this[_0xc75d('0x14')]=undefined;this[_0xc75d('0x15')]=undefined;this[_0xc75d('0x16')]=undefined;this[_0xc75d('0x17')]=0x0;}module[_0xc75d('0x18')]=Channel; \ No newline at end of file +var _0xf9ac=['mohtime','exports','starttime','calleridnum','calleridname','connectedlinename','context','exten','answered','answertime','endtime','abandoned','lastapplication','billableseconds','type','disposition','monitorFilename','queue','monitors'];(function(_0x678594,_0x56e462){var _0x4787c6=function(_0x440e36){while(--_0x440e36){_0x678594['push'](_0x678594['shift']());}};_0x4787c6(++_0x56e462);}(_0xf9ac,0x87));var _0xcf9a=function(_0x52feb0,_0x3047a7){_0x52feb0=_0x52feb0-0x0;var _0x5bccea=_0xf9ac[_0x52feb0];return _0x5bccea;};'use strict';function Channel(){this[_0xcf9a('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0xcf9a('0x1')]=0x0;this[_0xcf9a('0x2')]='';this['connectedlinenum']=undefined;this[_0xcf9a('0x3')]=undefined;this['accountcode']=0x0;this[_0xcf9a('0x4')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0xcf9a('0x5')]=0x0;this[_0xcf9a('0x6')]=![];this[_0xcf9a('0x7')]=null;this[_0xcf9a('0x8')]=null;this['unmanaged']=![];this[_0xcf9a('0x9')]=![];this[_0xcf9a('0xa')]='';this['lastdata']='';this['duration']=0x0;this[_0xcf9a('0xb')]=0x0;this['holdtime']=0x0;this[_0xcf9a('0xc')]=null;this['tag']=null;this[_0xcf9a('0xd')]=null;this['monitor']=![];this[_0xcf9a('0xe')]=null;this[_0xcf9a('0xf')]=null;this[_0xcf9a('0x10')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0xcf9a('0x11')]=0x0;}module[_0xcf9a('0x12')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 2eb30db..0905d71 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 _0xeefd=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','remoteUri','authType','password'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xeefd,0x104));var _0xdeef=function(_0xe890c5,_0x4c0bdb){_0xe890c5=_0xe890c5-0x0;var _0x17f534=_0xeefd[_0xe890c5];return _0x17f534;};'use strict';function DeskAccount(_0x33e39d){this['id']=_0x33e39d['id']||0x0;this['name']=_0x33e39d[_0xdeef('0x0')]||'';this['username']=_0x33e39d['username']||'';this[_0xdeef('0x1')]=_0x33e39d[_0xdeef('0x1')]||'';this[_0xdeef('0x2')]=_0x33e39d['authType']||'';this[_0xdeef('0x3')]=_0x33e39d[_0xdeef('0x3')]||'';this['consumerKey']=_0x33e39d[_0xdeef('0x4')]||'';this['consumerSecret']=_0x33e39d[_0xdeef('0x5')]||'';this[_0xdeef('0x6')]=_0x33e39d[_0xdeef('0x6')]||'';this[_0xdeef('0x7')]=_0x33e39d[_0xdeef('0x7')]||'';this[_0xdeef('0x8')]=_0x33e39d[_0xdeef('0x8')]||'';this[_0xdeef('0x9')]=_0x33e39d[_0xdeef('0x9')]||'';this[_0xdeef('0xa')]=_0x33e39d[_0xdeef('0xa')]||{};}module[_0xdeef('0xb')]=DeskAccount; \ No newline at end of file +var _0x4431=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x113802,_0xd7a42a){var _0x32ab4b=function(_0x4864b3){while(--_0x4864b3){_0x113802['push'](_0x113802['shift']());}};_0x32ab4b(++_0xd7a42a);}(_0x4431,0x1b7));var _0x1443=function(_0x587e11,_0x207695){_0x587e11=_0x587e11-0x0;var _0x4853ec=_0x4431[_0x587e11];return _0x4853ec;};'use strict';function DeskAccount(_0x1ea0b4){this['id']=_0x1ea0b4['id']||0x0;this[_0x1443('0x0')]=_0x1ea0b4['name']||'';this[_0x1443('0x1')]=_0x1ea0b4['username']||'';this['remoteUri']=_0x1ea0b4[_0x1443('0x2')]||'';this[_0x1443('0x3')]=_0x1ea0b4['authType']||'';this['password']=_0x1ea0b4[_0x1443('0x4')]||'';this[_0x1443('0x5')]=_0x1ea0b4[_0x1443('0x5')]||'';this['consumerSecret']=_0x1ea0b4[_0x1443('0x6')]||'';this[_0x1443('0x7')]=_0x1ea0b4[_0x1443('0x7')]||'';this[_0x1443('0x8')]=_0x1ea0b4[_0x1443('0x8')]||'';this[_0x1443('0x9')]=_0x1ea0b4[_0x1443('0x9')]||'';this[_0x1443('0xa')]=_0x1ea0b4[_0x1443('0xa')]||'';this['Configurations']=_0x1ea0b4[_0x1443('0xb')]||{};}module[_0x1443('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 3610012..9ee38d0 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 _0x855d=['password','remoteUri','tenantId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username'];(function(_0x18ac3f,_0x386630){var _0x4c6563=function(_0xcc161f){while(--_0xcc161f){_0x18ac3f['push'](_0x18ac3f['shift']());}};_0x4c6563(++_0x386630);}(_0x855d,0x77));var _0xd855=function(_0x28c57e,_0x30d28a){_0x28c57e=_0x28c57e-0x0;var _0x43af87=_0x855d[_0x28c57e];return _0x43af87;};'use strict';function Dynamics365Account(_0x48ae1a){this['id']=_0x48ae1a['id']||0x0;this[_0xd855('0x0')]=_0x48ae1a[_0xd855('0x0')]||'';this['username']=_0x48ae1a[_0xd855('0x1')]||'';this[_0xd855('0x2')]=_0x48ae1a['password']||'';this['remoteUri']=_0x48ae1a[_0xd855('0x3')]||'';this[_0xd855('0x4')]=_0x48ae1a[_0xd855('0x4')]||'';this['clientId']=_0x48ae1a['clientId']||'';this[_0xd855('0x5')]=_0x48ae1a[_0xd855('0x5')]||{};this[_0xd855('0x6')]=_0x48ae1a[_0xd855('0x6')]||'';this[_0xd855('0x7')]=_0x48ae1a[_0xd855('0x7')]||![];this[_0xd855('0x8')]=_0x48ae1a[_0xd855('0x8')]||{};this[_0xd855('0x9')]=_0x48ae1a[_0xd855('0x9')]||{};}module[_0xd855('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xab25=['serverUrl','modernAuthentication','Configurations','exports','name','username','password','remoteUri','clientId','clientSecret'];(function(_0xef4cf0,_0x16c9c3){var _0x497ad2=function(_0xce63d4){while(--_0xce63d4){_0xef4cf0['push'](_0xef4cf0['shift']());}};_0x497ad2(++_0x16c9c3);}(_0xab25,0x144));var _0x5ab2=function(_0x5e618e,_0x5dfe0c){_0x5e618e=_0x5e618e-0x0;var _0x22e311=_0xab25[_0x5e618e];return _0x22e311;};'use strict';function Dynamics365Account(_0x52c923){this['id']=_0x52c923['id']||0x0;this[_0x5ab2('0x0')]=_0x52c923[_0x5ab2('0x0')]||'';this[_0x5ab2('0x1')]=_0x52c923[_0x5ab2('0x1')]||'';this[_0x5ab2('0x2')]=_0x52c923['password']||'';this[_0x5ab2('0x3')]=_0x52c923[_0x5ab2('0x3')]||'';this['tenantId']=_0x52c923['tenantId']||'';this[_0x5ab2('0x4')]=_0x52c923['clientId']||'';this['clientSecret']=_0x52c923[_0x5ab2('0x5')]||{};this[_0x5ab2('0x6')]=_0x52c923['serverUrl']||'';this[_0x5ab2('0x7')]=_0x52c923[_0x5ab2('0x7')]||![];this['Configurations']=_0x52c923[_0x5ab2('0x8')]||{};this['CloudProvider']=_0x52c923['CloudProvider']||{};}module[_0x5ab2('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 3dc9295..0061380 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 _0x221f=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x3cb473,_0x4ca447){var _0x14d486=function(_0xb0f190){while(--_0xb0f190){_0x3cb473['push'](_0x3cb473['shift']());}};_0x14d486(++_0x4ca447);}(_0x221f,0x177));var _0xf221=function(_0x47c5bf,_0x45977e){_0x47c5bf=_0x47c5bf-0x0;var _0x11b779=_0x221f[_0x47c5bf];return _0x11b779;};'use strict';function FaxAccount(_0x152281){this['id']=_0x152281['id']||0x0;this[_0xf221('0x0')]=_0x152281[_0xf221('0x0')]||'';this[_0xf221('0x1')]=_0x152281[_0xf221('0x1')];this['ecm']=_0x152281[_0xf221('0x2')];this['headerinfo']=_0x152281[_0xf221('0x3')];this[_0xf221('0x4')]=_0x152281['localstationid'];this['minrate']=_0x152281[_0xf221('0x5')]||0x960;this[_0xf221('0x6')]=_0x152281[_0xf221('0x6')]||0x3840;this[_0xf221('0x7')]=_0x152281[_0xf221('0x7')]||_0xf221('0x8');this[_0xf221('0x9')]=_0x152281[_0xf221('0x9')]||'no';this[_0xf221('0xa')]=_0x152281[_0xf221('0xa')]||'no';this[_0xf221('0xb')]=_0x152281[_0xf221('0xb')]||0x1388;this[_0xf221('0xc')]=_0x152281[_0xf221('0xc')]||_0xf221('0xd');this[_0xf221('0xe')]=_0x152281[_0xf221('0xe')]?_0x152281['Trunk']:undefined;this[_0xf221('0xf')]=_0x152281[_0xf221('0xf')];this['key']=_0x152281[_0xf221('0x10')];}module[_0xf221('0x11')]=FaxAccount; \ No newline at end of file +var _0xca61=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x3cb882,_0x12f180){var _0x5d0bdb=function(_0x41780c){while(--_0x41780c){_0x3cb882['push'](_0x3cb882['shift']());}};_0x5d0bdb(++_0x12f180);}(_0xca61,0x191));var _0x1ca6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xca61[_0xa464c9];return _0x3d73c4;};'use strict';function FaxAccount(_0x129c28){this['id']=_0x129c28['id']||0x0;this['name']=_0x129c28['name']||'';this[_0x1ca6('0x0')]=_0x129c28[_0x1ca6('0x0')];this[_0x1ca6('0x1')]=_0x129c28['ecm'];this[_0x1ca6('0x2')]=_0x129c28[_0x1ca6('0x2')];this['localstationid']=_0x129c28[_0x1ca6('0x3')];this[_0x1ca6('0x4')]=_0x129c28['minrate']||0x960;this[_0x1ca6('0x5')]=_0x129c28[_0x1ca6('0x5')]||0x3840;this['modem']=_0x129c28[_0x1ca6('0x6')]||_0x1ca6('0x7');this[_0x1ca6('0x8')]=_0x129c28[_0x1ca6('0x8')]||'no';this['faxdetect']=_0x129c28[_0x1ca6('0x9')]||'no';this[_0x1ca6('0xa')]=_0x129c28[_0x1ca6('0xa')]||0x1388;this[_0x1ca6('0xb')]=_0x129c28[_0x1ca6('0xb')]||_0x1ca6('0xc');this[_0x1ca6('0xd')]=_0x129c28[_0x1ca6('0xd')]?_0x129c28[_0x1ca6('0xd')]:undefined;this[_0x1ca6('0xe')]=_0x129c28[_0x1ca6('0xe')];this['key']=_0x129c28[_0x1ca6('0xf')];}module[_0x1ca6('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 7c53375..2d57b3e 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 _0x83c2=['remoteUri','Configurations','name','username','apiKey'];(function(_0x4deb9a,_0x12bac1){var _0x36e92c=function(_0xd37297){while(--_0xd37297){_0x4deb9a['push'](_0x4deb9a['shift']());}};_0x36e92c(++_0x12bac1);}(_0x83c2,0x156));var _0x283c=function(_0x4147ff,_0x154530){_0x4147ff=_0x4147ff-0x0;var _0x1e71e6=_0x83c2[_0x4147ff];return _0x1e71e6;};'use strict';function FreshdeskAccount(_0x39680d){this['id']=_0x39680d['id']||0x0;this[_0x283c('0x0')]=_0x39680d[_0x283c('0x0')]||'';this[_0x283c('0x1')]=_0x39680d[_0x283c('0x1')]||'';this[_0x283c('0x2')]=_0x39680d['token']||'';this[_0x283c('0x3')]=_0x39680d[_0x283c('0x3')]||'';this['serverUrl']=_0x39680d['serverUrl']||'';this[_0x283c('0x4')]=_0x39680d[_0x283c('0x4')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x616b=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x2cb515,_0x56be34){var _0x1efca8=function(_0x1fa198){while(--_0x1fa198){_0x2cb515['push'](_0x2cb515['shift']());}};_0x1efca8(++_0x56be34);}(_0x616b,0x141));var _0xb616=function(_0x4f57e4,_0x18914d){_0x4f57e4=_0x4f57e4-0x0;var _0x4a584c=_0x616b[_0x4f57e4];return _0x4a584c;};'use strict';function FreshdeskAccount(_0x378d3e){this['id']=_0x378d3e['id']||0x0;this[_0xb616('0x0')]=_0x378d3e[_0xb616('0x0')]||'';this['username']=_0x378d3e[_0xb616('0x1')]||'';this[_0xb616('0x2')]=_0x378d3e[_0xb616('0x3')]||'';this[_0xb616('0x4')]=_0x378d3e[_0xb616('0x4')]||'';this[_0xb616('0x5')]=_0x378d3e[_0xb616('0x5')]||'';this[_0xb616('0x6')]=_0x378d3e['Configurations']||{};}module[_0xb616('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 4ee0b18..71d8868 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 _0x37c5=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1e40e9,_0x16cc7a){var _0x3d3cbc=function(_0x51019e){while(--_0x51019e){_0x1e40e9['push'](_0x1e40e9['shift']());}};_0x3d3cbc(++_0x16cc7a);}(_0x37c5,0xa7));var _0x537c=function(_0x462657,_0x30ba29){_0x462657=_0x462657-0x0;var _0xbf7bd8=_0x37c5[_0x462657];return _0xbf7bd8;};'use strict';function FreshsalesAccount(_0x139d02){this['id']=_0x139d02['id']||0x0;this[_0x537c('0x0')]=_0x139d02[_0x537c('0x0')]||'';this[_0x537c('0x1')]=_0x139d02[_0x537c('0x1')]||'';this[_0x537c('0x2')]=_0x139d02[_0x537c('0x3')]||'';this[_0x537c('0x4')]=_0x139d02[_0x537c('0x4')]||'';this[_0x537c('0x5')]=_0x139d02[_0x537c('0x5')]||'';this['Configurations']=_0x139d02[_0x537c('0x6')]||{};}module[_0x537c('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x444e=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x131436,_0xd39c93){var _0x364a11=function(_0x51fbea){while(--_0x51fbea){_0x131436['push'](_0x131436['shift']());}};_0x364a11(++_0xd39c93);}(_0x444e,0xe8));var _0xe444=function(_0x4b8ec3,_0x109248){_0x4b8ec3=_0x4b8ec3-0x0;var _0x3b7485=_0x444e[_0x4b8ec3];return _0x3b7485;};'use strict';function FreshsalesAccount(_0x1a335c){this['id']=_0x1a335c['id']||0x0;this['name']=_0x1a335c[_0xe444('0x0')]||'';this['username']=_0x1a335c[_0xe444('0x1')]||'';this['apiKey']=_0x1a335c[_0xe444('0x2')]||'';this['remoteUri']=_0x1a335c[_0xe444('0x3')]||'';this[_0xe444('0x4')]=_0x1a335c[_0xe444('0x4')]||'';this[_0xe444('0x5')]=_0x1a335c[_0xe444('0x5')]||{};}module[_0xe444('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 8cfae49..bea9197 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 _0x207e=['count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','motionChannel','voice','mohtime','variables','exports','type','uniqueid','calleridnum','queue','queuecallerjoinAt','position'];(function(_0x3db208,_0x3eeda5){var _0x25f711=function(_0x1cedca){while(--_0x1cedca){_0x3db208['push'](_0x3db208['shift']());}};_0x25f711(++_0x3eeda5);}(_0x207e,0x1aa));var _0xe207=function(_0x43192d,_0xb40a2){_0x43192d=_0x43192d-0x0;var _0xcc20b0=_0x207e[_0x43192d];return _0xcc20b0;};'use strict';function QueueReport(){this[_0xe207('0x0')]='inbound';this[_0xe207('0x1')]='';this[_0xe207('0x2')]='';this['calleridname']='';this[_0xe207('0x3')]='';this[_0xe207('0x4')]=null;this['queuecallerleaveAt']=null;this[_0xe207('0x5')]=0x1;this[_0xe207('0x6')]=0x1;this[_0xe207('0x7')]=![];this['queuecallerabandonAt']=null;this[_0xe207('0x8')]=![];this[_0xe207('0x9')]=null;this[_0xe207('0xa')]=![];this[_0xe207('0xb')]=null;this[_0xe207('0xc')]=0x1;this[_0xe207('0xd')]='';this[_0xe207('0xe')]='';this[_0xe207('0xf')]='';this[_0xe207('0x10')]='';this[_0xe207('0x11')]='';this[_0xe207('0x12')]='';this[_0xe207('0x13')]='';this[_0xe207('0x14')]=0x0;this[_0xe207('0x15')]=![];this['lastAssignedTo']='';this[_0xe207('0x16')]=_0xe207('0x17');this[_0xe207('0x18')]=0x0;this[_0xe207('0x19')]={};}module[_0xe207('0x1a')]=QueueReport; \ No newline at end of file +var _0x734d=['lastAssignedTo','motionChannel','voice','variables','exports','type','uniqueid','calleridname','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','connectedlinenum','connectedlinename','context','exten','priority','assigned'];(function(_0x33b6f7,_0x5c962e){var _0x84b1f7=function(_0x15f92e){while(--_0x15f92e){_0x33b6f7['push'](_0x33b6f7['shift']());}};_0x84b1f7(++_0x5c962e);}(_0x734d,0x17f));var _0xd734=function(_0x130ddf,_0x513e68){_0x130ddf=_0x130ddf-0x0;var _0x5939bc=_0x734d[_0x130ddf];return _0x5939bc;};'use strict';function QueueReport(){this[_0xd734('0x0')]='inbound';this[_0xd734('0x1')]='';this['calleridnum']='';this[_0xd734('0x2')]='';this['queue']='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xd734('0x3')]=0x1;this[_0xd734('0x4')]=0x1;this['queuecallerabandon']=![];this[_0xd734('0x5')]=null;this[_0xd734('0x6')]=![];this[_0xd734('0x7')]=null;this[_0xd734('0x8')]=![];this[_0xd734('0x9')]=null;this['originalposition']=0x1;this['channel']='';this[_0xd734('0xa')]='';this[_0xd734('0xb')]='';this['accountcode']='';this[_0xd734('0xc')]='';this[_0xd734('0xd')]='';this[_0xd734('0xe')]='';this['holdtime']=0x0;this[_0xd734('0xf')]=![];this[_0xd734('0x10')]='';this[_0xd734('0x11')]=_0xd734('0x12');this['mohtime']=0x0;this[_0xd734('0x13')]={};}module[_0xd734('0x14')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 8a0a4fc..06a090f 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 _0xeddc=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','Configurations','exports','name'];(function(_0x342f96,_0x90c72b){var _0x2e6c2f=function(_0x361d98){while(--_0x361d98){_0x342f96['push'](_0x342f96['shift']());}};_0x2e6c2f(++_0x90c72b);}(_0xeddc,0xfc));var _0xcedd=function(_0x270638,_0x2ec38d){_0x270638=_0x270638-0x0;var _0x364782=_0xeddc[_0x270638];return _0x364782;};'use strict';function SalesforceAccount(_0x57afb9){this['id']=_0x57afb9['id']||0x0;this[_0xcedd('0x0')]=_0x57afb9[_0xcedd('0x0')]||'';this[_0xcedd('0x1')]=_0x57afb9['username']||'';this[_0xcedd('0x2')]=_0x57afb9[_0xcedd('0x2')]||'';this['password']=_0x57afb9[_0xcedd('0x3')]||'';this[_0xcedd('0x4')]=_0x57afb9[_0xcedd('0x4')]||'';this[_0xcedd('0x5')]=_0x57afb9[_0xcedd('0x5')]||'';this[_0xcedd('0x6')]=_0x57afb9[_0xcedd('0x6')]||'';this[_0xcedd('0x7')]=_0x57afb9[_0xcedd('0x7')]||_0xcedd('0x8');this['serverUrl']=_0x57afb9['serverUrl']||'';this[_0xcedd('0x9')]=_0x57afb9[_0xcedd('0x9')]||{};}module[_0xcedd('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x3f48=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x29e875,_0x1e1e73){var _0x5889f3=function(_0x24b796){while(--_0x24b796){_0x29e875['push'](_0x29e875['shift']());}};_0x5889f3(++_0x1e1e73);}(_0x3f48,0x17c));var _0x83f4=function(_0x363ba0,_0x3eeb7f){_0x363ba0=_0x363ba0-0x0;var _0x40435f=_0x3f48[_0x363ba0];return _0x40435f;};'use strict';function SalesforceAccount(_0x5454ce){this['id']=_0x5454ce['id']||0x0;this['name']=_0x5454ce[_0x83f4('0x0')]||'';this[_0x83f4('0x1')]=_0x5454ce[_0x83f4('0x1')]||'';this[_0x83f4('0x2')]=_0x5454ce['remoteUri']||'';this[_0x83f4('0x3')]=_0x5454ce[_0x83f4('0x3')]||'';this['clientId']=_0x5454ce[_0x83f4('0x4')]||'';this['clientSecret']=_0x5454ce[_0x83f4('0x5')]||'';this[_0x83f4('0x6')]=_0x5454ce[_0x83f4('0x6')]||'';this[_0x83f4('0x7')]=_0x5454ce[_0x83f4('0x7')]||_0x83f4('0x8');this[_0x83f4('0x9')]=_0x5454ce[_0x83f4('0x9')]||'';this['Configurations']=_0x5454ce[_0x83f4('0xa')]||{};}module[_0x83f4('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 ef411e2..7a11c6c 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 _0x858b=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x572d5b,_0xf58950){var _0x4b7a3f=function(_0x4a373d){while(--_0x4a373d){_0x572d5b['push'](_0x572d5b['shift']());}};_0x4b7a3f(++_0xf58950);}(_0x858b,0xe9));var _0xb858=function(_0x12b683,_0x124186){_0x12b683=_0x12b683-0x0;var _0xfb150b=_0x858b[_0x12b683];return _0xfb150b;};'use strict';function ServicenowAccount(_0x3cd099){this['id']=_0x3cd099['id']||0x0;this[_0xb858('0x0')]=_0x3cd099[_0xb858('0x0')]||'';this[_0xb858('0x1')]=_0x3cd099[_0xb858('0x1')]||'';this['password']=_0x3cd099['password']||'';this[_0xb858('0x2')]=_0x3cd099[_0xb858('0x2')]||'';this[_0xb858('0x3')]=_0x3cd099[_0xb858('0x3')]||'';this['Configurations']=_0x3cd099[_0xb858('0x4')]||{};}module[_0xb858('0x5')]=ServicenowAccount; \ No newline at end of file +var _0xa047=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x2bcee6,_0xc0840b){var _0xaa0275=function(_0xbf8a78){while(--_0xbf8a78){_0x2bcee6['push'](_0x2bcee6['shift']());}};_0xaa0275(++_0xc0840b);}(_0xa047,0x6a));var _0x7a04=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0xa047[_0x49052b];return _0x48c045;};'use strict';function ServicenowAccount(_0x135a1e){this['id']=_0x135a1e['id']||0x0;this[_0x7a04('0x0')]=_0x135a1e['name']||'';this[_0x7a04('0x1')]=_0x135a1e['username']||'';this[_0x7a04('0x2')]=_0x135a1e[_0x7a04('0x2')]||'';this['remoteUri']=_0x135a1e[_0x7a04('0x3')]||'';this[_0x7a04('0x4')]=_0x135a1e[_0x7a04('0x4')]||'';this[_0x7a04('0x5')]=_0x135a1e[_0x7a04('0x5')]||{};}module[_0x7a04('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 5820cad..c969e3d 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 _0x0c4d=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x5578c0,_0x4f9a4d){var _0x24ae5d=function(_0x2c004a){while(--_0x2c004a){_0x5578c0['push'](_0x5578c0['shift']());}};_0x24ae5d(++_0x4f9a4d);}(_0x0c4d,0x1a8));var _0xd0c4=function(_0x2c2dcd,_0x1d6444){_0x2c2dcd=_0x2c2dcd-0x0;var _0x519cc2=_0x0c4d[_0x2c2dcd];return _0x519cc2;};'use strict';function SugarcrmAccount(_0x4ef579){this['id']=_0x4ef579['id']||0x0;this[_0xd0c4('0x0')]=_0x4ef579['name']||'';this[_0xd0c4('0x1')]=_0x4ef579[_0xd0c4('0x1')]||'';this[_0xd0c4('0x2')]=_0x4ef579['password']||'';this[_0xd0c4('0x3')]=_0x4ef579[_0xd0c4('0x3')]||'';this['serverUrl']=_0x4ef579[_0xd0c4('0x4')]||'';this[_0xd0c4('0x5')]=_0x4ef579[_0xd0c4('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xa9b1=['exports','name','username','password','remoteUri','Configurations'];(function(_0x4055c7,_0x1e01c8){var _0x1c5df4=function(_0x28baa7){while(--_0x28baa7){_0x4055c7['push'](_0x4055c7['shift']());}};_0x1c5df4(++_0x1e01c8);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';function SugarcrmAccount(_0x32f8da){this['id']=_0x32f8da['id']||0x0;this['name']=_0x32f8da[_0x1a9b('0x0')]||'';this[_0x1a9b('0x1')]=_0x32f8da[_0x1a9b('0x1')]||'';this[_0x1a9b('0x2')]=_0x32f8da[_0x1a9b('0x2')]||'';this[_0x1a9b('0x3')]=_0x32f8da['remoteUri']||'';this['serverUrl']=_0x32f8da['serverUrl']||'';this[_0x1a9b('0x4')]=_0x32f8da[_0x1a9b('0x4')]||{};}module[_0x1a9b('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 f472a3b..b7965d0 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 _0xe06f=['exports','name','accountcode','stateTime','status','unknown','address'];(function(_0x22d261,_0x6d7ff4){var _0x4a9670=function(_0x3696db){while(--_0x3696db){_0x22d261['push'](_0x22d261['shift']());}};_0x4a9670(++_0x6d7ff4);}(_0xe06f,0x104));var _0xfe06=function(_0x19128a,_0x277281){_0x19128a=_0x19128a-0x0;var _0x3e7590=_0xe06f[_0x19128a];return _0x3e7590;};'use strict';function Telephone(_0x252d0d){this['id']=_0x252d0d['id']||0x0;this[_0xfe06('0x0')]=_0x252d0d[_0xfe06('0x0')]||'';this[_0xfe06('0x1')]=_0x252d0d['accountcode']||'';this['state']='unknown';this[_0xfe06('0x2')]=0x0;this[_0xfe06('0x3')]=_0xfe06('0x4');this[_0xfe06('0x5')]='';}module[_0xfe06('0x6')]=Telephone; \ No newline at end of file +var _0x755e=['status','address','exports','name','accountcode','state','unknown'];(function(_0x2687ea,_0x1d7462){var _0x13187a=function(_0x4b6ba){while(--_0x4b6ba){_0x2687ea['push'](_0x2687ea['shift']());}};_0x13187a(++_0x1d7462);}(_0x755e,0x96));var _0xe755=function(_0x96b6a,_0x12471d){_0x96b6a=_0x96b6a-0x0;var _0x3e16f3=_0x755e[_0x96b6a];return _0x3e16f3;};'use strict';function Telephone(_0x41a7ba){this['id']=_0x41a7ba['id']||0x0;this[_0xe755('0x0')]=_0x41a7ba[_0xe755('0x0')]||'';this[_0xe755('0x1')]=_0x41a7ba[_0xe755('0x1')]||'';this[_0xe755('0x2')]=_0xe755('0x3');this['stateTime']=0x0;this[_0xe755('0x4')]='unknown';this[_0xe755('0x5')]='';}module[_0xe755('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index aa8f5c0..8897d8b 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(_0xabbfa0,_0x11b36b){var _0x1981d8=function(_0x22fdf7){while(--_0x22fdf7){_0xabbfa0['push'](_0xabbfa0['shift']());}};_0x1981d8(++_0x11b36b);}(_0xb10b,0x12a));var _0xbb10=function(_0x19776e,_0x3690de){_0x19776e=_0x19776e-0x0;var _0xce4b5f=_0xb10b[_0x19776e];return _0xce4b5f;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x2f211b,_0x41f4d6){var _0x480587=function(_0x9e20a4){while(--_0x9e20a4){_0x2f211b['push'](_0x2f211b['shift']());}};_0x480587(++_0x41f4d6);}(_0xb10b,0x12a));var _0xbb10=function(_0x591df1,_0xd2030b){_0x591df1=_0x591df1-0x0;var _0x28f068=_0xb10b[_0x591df1];return _0x28f068;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 71edb91..edc5f66 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file +var _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x4144c0,_0x253e2b){var _0x424d45=function(_0x5f1644){while(--_0x5f1644){_0x4144c0['push'](_0x4144c0['shift']());}};_0x424d45(++_0x253e2b);}(_0xb7e7,0x121));var _0x7b7e=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xb7e7[_0xd1d19a];return _0x52a79d;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 0825d27..3b315e2 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 _0x40f9=['registry','indexOf','split','port','domainport','refresh','stateRegistry','unknown','address','defaultuser','name','state','stateTime','status'];(function(_0x3dc538,_0x4f7702){var _0x72c2fd=function(_0x5a7260){while(--_0x5a7260){_0x3dc538['push'](_0x3dc538['shift']());}};_0x72c2fd(++_0x4f7702);}(_0x40f9,0xc0));var _0x940f=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x40f9[_0x4e9628];return _0x27bc8c;};'use strict';function Trunk(_0x4755b5){this['id']=_0x4755b5['id']||0x0;this['active']=_0x4755b5['active']||![];this[_0x940f('0x0')]=_0x4755b5['name']||'';this[_0x940f('0x1')]='unknown';this[_0x940f('0x2')]=0x0;this[_0x940f('0x3')]='unknown';this[_0x940f('0x4')]=_0x4755b5[_0x940f('0x4')]&&_0x4755b5[_0x940f('0x4')][_0x940f('0x5')](':')?_0x4755b5['registry'][_0x940f('0x6')](':')[0x0]:'';this['host']='';this[_0x940f('0x7')]='';this['domain']='';this[_0x940f('0x8')]='';this[_0x940f('0x9')]='';this[_0x940f('0xa')]=_0x940f('0xb');this['registrationtime']='';this[_0x940f('0xc')]='';this[_0x940f('0xd')]=_0x4755b5[_0x940f('0xd')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0xff3e=['host','port','refresh','stateRegistry','address','defaultuser','exports','name','state','unknown','stateTime','status','registry','indexOf','split'];(function(_0x35137b,_0x99cf1){var _0x470efb=function(_0x17cd26){while(--_0x17cd26){_0x35137b['push'](_0x35137b['shift']());}};_0x470efb(++_0x99cf1);}(_0xff3e,0x106));var _0xeff3=function(_0x427951,_0x200595){_0x427951=_0x427951-0x0;var _0x4b89b9=_0xff3e[_0x427951];return _0x4b89b9;};'use strict';function Trunk(_0x556aaf){this['id']=_0x556aaf['id']||0x0;this['active']=_0x556aaf['active']||![];this[_0xeff3('0x0')]=_0x556aaf['name']||'';this[_0xeff3('0x1')]=_0xeff3('0x2');this[_0xeff3('0x3')]=0x0;this[_0xeff3('0x4')]='unknown';this[_0xeff3('0x5')]=_0x556aaf[_0xeff3('0x5')]&&_0x556aaf[_0xeff3('0x5')][_0xeff3('0x6')](':')?_0x556aaf[_0xeff3('0x5')][_0xeff3('0x7')](':')[0x0]:'';this[_0xeff3('0x8')]='';this[_0xeff3('0x9')]='';this['domain']='';this['domainport']='';this[_0xeff3('0xa')]='';this[_0xeff3('0xb')]=_0xeff3('0x2');this['registrationtime']='';this[_0xeff3('0xc')]='';this[_0xeff3('0xd')]=_0x556aaf[_0xeff3('0xd')]||'';}module[_0xeff3('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 c87a47b..9bac5cc 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 _0x4710=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x52bfa5,_0x42cf21){var _0x26f80b=function(_0x73c5b0){while(--_0x73c5b0){_0x52bfa5['push'](_0x52bfa5['shift']());}};_0x26f80b(++_0x42cf21);}(_0x4710,0x123));var _0x0471=function(_0xd53468,_0x4ec55e){_0xd53468=_0xd53468-0x0;var _0x134503=_0x4710[_0xd53468];return _0x134503;};'use strict';function voiceExtension(_0x477977){this['id']=_0x477977['id']||0x0;this[_0x0471('0x0')]=_0x477977['exten']||'';this[_0x0471('0x1')]=_0x477977['recordingFormat']||_0x0471('0x2');this[_0x0471('0x3')]=_0x477977[_0x0471('0x3')]||![];}module[_0x0471('0x4')]=voiceExtension; \ No newline at end of file +var _0x03e7=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0xf48d27,_0xc761af){var _0x172722=function(_0x4722d1){while(--_0x4722d1){_0xf48d27['push'](_0xf48d27['shift']());}};_0x172722(++_0xc761af);}(_0x03e7,0xa9));var _0x703e=function(_0x39e331,_0x5759ff){_0x39e331=_0x39e331-0x0;var _0x53a6b4=_0x03e7[_0x39e331];return _0x53a6b4;};'use strict';function voiceExtension(_0x38c9c4){this['id']=_0x38c9c4['id']||0x0;this[_0x703e('0x0')]=_0x38c9c4[_0x703e('0x0')]||'';this[_0x703e('0x1')]=_0x38c9c4[_0x703e('0x1')]||'none';this[_0x703e('0x2')]=_0x38c9c4[_0x703e('0x2')]||![];}module[_0x703e('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index d105cd5..a2c23ec 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 _0xe58e=['dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalHitRate','erlangCallToSecond','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','wav','wav49','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','sumDuration','sumHoldTime','available','busy','inUse','loggedIn','notInUse','paused','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x5424dd,_0x4d2126){var _0x109e4f=function(_0x559448){while(--_0x559448){_0x5424dd['push'](_0x5424dd['shift']());}};_0x109e4f(++_0x4d2126);}(_0xe58e,0x10e));var _0xee58=function(_0x12c4c8,_0x16196a){_0x12c4c8=_0x12c4c8-0x0;var _0x2a0dce=_0xe58e[_0x12c4c8];return _0x2a0dce;};'use strict';var monitorFormat={'wav':_0xee58('0x0'),'wav49':_0xee58('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xee58('0x2'),'linear':_0xee58('0x3'),'random':_0xee58('0x4'),'ringall':_0xee58('0x5'),'rr':_0xee58('0x6'),'rrmemory':_0xee58('0x7'),'rrordered':_0xee58('0x8'),'wrandom':'wrandom'};function VoiceQueue(_0x408530){this['id']=_0x408530['id']||0x0;this[_0xee58('0x9')]=_0x408530['name']||'';this[_0xee58('0xa')]=_0x408530[_0xee58('0xa')]||'';this[_0xee58('0xb')]=_0x408530[_0xee58('0xb')]||_0xee58('0xc');this[_0xee58('0xd')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0xee58('0xe')]=0x0;this[_0xee58('0xf')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0xee58('0x10')]=0x0;this[_0xee58('0x11')]=0x0;this[_0xee58('0x12')]=0x0;this['invalid']=0x0;this[_0xee58('0x13')]=0x0;this[_0xee58('0x14')]=0x0;this['onHold']=0x0;this[_0xee58('0x15')]=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this['talking']=0x0;this[_0xee58('0x16')]=0x0;this['unknown']=0x0;this['acw']=_0x408530[_0xee58('0x17')]||![];this[_0xee58('0x18')]=_0x408530['acwTimeout']||0xa;this[_0xee58('0x19')]=_0x408530[_0xee58('0x19')]||'no';this[_0xee58('0x1a')]=!![];this[_0xee58('0x1b')]='';this['statusMessage']='';this[_0xee58('0x1c')]=0x0;this[_0xee58('0x1d')]=0x0;this[_0xee58('0x1e')]=_0x408530[_0xee58('0x1e')]||null;this[_0xee58('0x1f')]=_0x408530['dialGlobalInterval']?_0x408530['dialGlobalInterval']:null;this[_0xee58('0x20')]=_0x408530['dialActive'];this[_0xee58('0x21')]=_0x408530['dialMethod']||_0xee58('0x22');this[_0xee58('0x23')]=_0x408530[_0xee58('0x23')]||0x0;this[_0xee58('0x24')]=_0x408530[_0xee58('0x24')]||0x0;this[_0xee58('0x25')]=_0x408530[_0xee58('0x25')]||0x1;this[_0xee58('0x26')]=_0x408530[_0xee58('0x26')]||_0xee58('0x27');this['dialPredictiveOptimizationPercentage']=_0x408530[_0xee58('0x28')]||0.03;this['dialPredictiveInterval']=_0x408530[_0xee58('0x29')]||0x258;this[_0xee58('0x2a')]=_0x408530[_0xee58('0x2a')]||_0xee58('0x2b');this['dialOriginateCallerIdNumber']=_0x408530[_0xee58('0x2c')]||_0xee58('0x2b');this[_0xee58('0x2d')]=_0x408530[_0xee58('0x2d')]||0x1e;this[_0xee58('0x2e')]=_0x408530['dialQueueOptions']||_0xee58('0x2f');this['dialQueueTimeout']=_0x408530['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x408530[_0xee58('0x30')]||undefined;this[_0xee58('0x31')]=_0x408530['dialCongestionMaxRetry']||0x3;this[_0xee58('0x32')]=_0x408530['dialCongestionRetryFrequency']||0x96;this[_0xee58('0x33')]=_0x408530[_0xee58('0x33')]||0x3;this[_0xee58('0x34')]=_0x408530[_0xee58('0x34')]||0x96;this['dialNoAnswerMaxRetry']=_0x408530[_0xee58('0x35')]||0x3;this['dialNoAnswerRetryFrequency']=_0x408530[_0xee58('0x36')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x408530['dialNoSuchNumberMaxRetry']||0x3;this[_0xee58('0x37')]=_0x408530[_0xee58('0x37')]||0x96;this[_0xee58('0x38')]=_0x408530[_0xee58('0x38')]||0x3;this[_0xee58('0x39')]=_0x408530[_0xee58('0x39')]||0x96;this[_0xee58('0x3a')]=_0x408530[_0xee58('0x3a')]||0x3;this[_0xee58('0x3b')]=_0x408530[_0xee58('0x3b')]||0x96;this[_0xee58('0x3c')]=_0x408530[_0xee58('0x3c')]||0x3;this['dialMachineRetryFrequency']=_0x408530[_0xee58('0x3d')]||0x96;this[_0xee58('0x3e')]=_0x408530[_0xee58('0x3e')]||0x3;this[_0xee58('0x3f')]=_0x408530['dialAgentRejectRetryFrequency']||0x96;this[_0xee58('0x40')]=_0x408530[_0xee58('0x40')]||0x3;this[_0xee58('0x41')]=_0x408530[_0xee58('0x41')]||0x4;this[_0xee58('0x42')]=_0x408530['Trunk']?_0x408530['Trunk']:undefined;this[_0xee58('0x43')]=_0x408530[_0xee58('0x43')]?_0x408530[_0xee58('0x43')]:undefined;this[_0xee58('0x44')]=_0x408530['dialPrefix']||undefined;this['Interval']=_0x408530[_0xee58('0x45')]?_0x408530[_0xee58('0x45')]:undefined;this[_0xee58('0x46')]=_0x408530[_0xee58('0x46')]||_0xee58('0x47');this[_0xee58('0x48')]=_0x408530[_0xee58('0x48')]||undefined;this[_0xee58('0x49')]=_0x408530[_0xee58('0x49')]||undefined;this[_0xee58('0x4a')]=strategy[_0x408530[_0xee58('0x4a')]];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x408530[_0xee58('0x4b')]||![];this['dialAMDInitialSilence']=_0x408530[_0xee58('0x4c')];this[_0xee58('0x4d')]=_0x408530[_0xee58('0x4d')];this[_0xee58('0x4e')]=_0x408530[_0xee58('0x4e')];this[_0xee58('0x4f')]=_0x408530[_0xee58('0x4f')];this[_0xee58('0x50')]=_0x408530[_0xee58('0x50')];this[_0xee58('0x51')]=_0x408530[_0xee58('0x51')];this[_0xee58('0x52')]=_0x408530[_0xee58('0x52')];this[_0xee58('0x53')]=_0x408530[_0xee58('0x53')];this[_0xee58('0x54')]=_0x408530['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0xee58('0x55')]=0x0;this[_0xee58('0x56')]=_0x408530[_0xee58('0x56')];this[_0xee58('0x57')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xee58('0x58')]=0x0;this[_0xee58('0x59')]=0x0;this[_0xee58('0x5a')]=0x0;this[_0xee58('0x5b')]=0x0;this[_0xee58('0x5c')]=0x0;this[_0xee58('0x5d')]=0x0;this[_0xee58('0x5e')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xee58('0x5f')]=0x0;this[_0xee58('0x60')]=0x0;this['outboundReCallsDay']=0x0;this[_0xee58('0x61')]=0x0;this[_0xee58('0x62')]=undefined;this[_0xee58('0x63')]=undefined;this['handlePredictive']=undefined;this[_0xee58('0x64')]=1.05;this[_0xee58('0x65')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xee58('0x66')]=0x0;this[_0xee58('0x67')]=0x0;this[_0xee58('0x68')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xee58('0x69')]=0x0;this[_0xee58('0x6a')]=_0x408530['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x408530['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xee58('0x6b')]=0x1;this['erlangCalls']=0x0;this[_0xee58('0x6c')]=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0xee58('0x6d')]=_0x408530[_0xee58('0x6d')]||0x1e;this[_0xee58('0x6e')]=_0x408530[_0xee58('0x6e')]||![];this[_0xee58('0x6f')]=!!_0x408530[_0xee58('0x6f')]||![];this[_0xee58('0x70')]=!!_0x408530[_0xee58('0x70')]||![];this[_0xee58('0x71')]=_0x408530[_0xee58('0x71')]||undefined;this[_0xee58('0x72')]=_0x408530[_0xee58('0x72')]||![];this[_0xee58('0x73')]=_0x408530[_0xee58('0x73')]||![];this[_0xee58('0xa')]=monitorFormat[_0x408530[_0xee58('0xa')]]?monitorFormat[_0x408530[_0xee58('0xa')]]:undefined;this['mandatoryDisposition']=_0x408530[_0xee58('0x74')]||![];this[_0xee58('0x75')]=_0x408530['mandatoryDispositionPause']?_0x408530[_0xee58('0x75')]:undefined;this['queueSummaryCountersUpdated']=![];}module['exports']=VoiceQueue; \ No newline at end of file +var _0xe2fe=['predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDispositionPause','queueSummaryCountersUpdated','wav','fewestcalls','linear','random','ringall','roundrobin','rrmemory','wrandom','name','monitor_format','type','inbound','waiting','answered','sumDuration','available','loggedIn','notInUse','onHold','paused','ringing','ringInUse','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','pTalking','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit'];(function(_0xf324a5,_0x5aff32){var _0x479540=function(_0x250c06){while(--_0x250c06){_0xf324a5['push'](_0xf324a5['shift']());}};_0x479540(++_0x5aff32);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var monitorFormat={'wav':_0xee2f('0x0'),'wav49':'wav49','gsm':'gsm'};var strategy={'fewestcalls':_0xee2f('0x1'),'leastrecent':'leastrecent','linear':_0xee2f('0x2'),'random':_0xee2f('0x3'),'ringall':_0xee2f('0x4'),'rr':_0xee2f('0x5'),'rrmemory':_0xee2f('0x6'),'rrordered':'rrordered','wrandom':_0xee2f('0x7')};function VoiceQueue(_0x2b7e7c){this['id']=_0x2b7e7c['id']||0x0;this['name']=_0x2b7e7c[_0xee2f('0x8')]||'';this[_0xee2f('0x9')]=_0x2b7e7c['monitor_format']||'';this[_0xee2f('0xa')]=_0x2b7e7c['type']||_0xee2f('0xb');this[_0xee2f('0xc')]=0x0;this['total']=0x0;this[_0xee2f('0xd')]=0x0;this[_0xee2f('0xe')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0xee2f('0xf')]=0x0;this['busy']=0x0;this['inUse']=0x0;this['invalid']=0x0;this[_0xee2f('0x10')]=0x0;this[_0xee2f('0x11')]=0x0;this[_0xee2f('0x12')]=0x0;this[_0xee2f('0x13')]=0x0;this[_0xee2f('0x14')]=0x0;this[_0xee2f('0x15')]=0x0;this['talking']=0x0;this[_0xee2f('0x16')]=0x0;this['unknown']=0x0;this[_0xee2f('0x17')]=_0x2b7e7c[_0xee2f('0x17')]||![];this['acwTimeout']=_0x2b7e7c[_0xee2f('0x18')]||0xa;this[_0xee2f('0x19')]=_0x2b7e7c[_0xee2f('0x19')]||'no';this[_0xee2f('0x1a')]=!![];this[_0xee2f('0x1b')]='';this['statusMessage']='';this[_0xee2f('0x1c')]=0x0;this['temp']=0x0;this[_0xee2f('0x1d')]=_0x2b7e7c[_0xee2f('0x1d')]||null;this['dialGlobalInterval']=_0x2b7e7c['dialGlobalInterval']?_0x2b7e7c[_0xee2f('0x1e')]:null;this['dialActive']=_0x2b7e7c[_0xee2f('0x1f')];this[_0xee2f('0x20')]=_0x2b7e7c[_0xee2f('0x20')]||'progressive';this[_0xee2f('0x21')]=_0x2b7e7c[_0xee2f('0x21')]||0x0;this[_0xee2f('0x22')]=_0x2b7e7c[_0xee2f('0x22')]||0x0;this[_0xee2f('0x23')]=_0x2b7e7c['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x2b7e7c[_0xee2f('0x24')]||_0xee2f('0x25');this[_0xee2f('0x26')]=_0x2b7e7c[_0xee2f('0x26')]||0.03;this[_0xee2f('0x27')]=_0x2b7e7c[_0xee2f('0x27')]||0x258;this[_0xee2f('0x28')]=_0x2b7e7c['dialOriginateCallerIdName']||_0xee2f('0x29');this[_0xee2f('0x2a')]=_0x2b7e7c[_0xee2f('0x2a')]||_0xee2f('0x29');this[_0xee2f('0x2b')]=_0x2b7e7c[_0xee2f('0x2b')]||0x1e;this[_0xee2f('0x2c')]=_0x2b7e7c[_0xee2f('0x2c')]||_0xee2f('0x2d');this[_0xee2f('0x2e')]=_0x2b7e7c[_0xee2f('0x2e')]||0x3;this[_0xee2f('0x2f')]=_0x2b7e7c[_0xee2f('0x2f')]||undefined;this[_0xee2f('0x30')]=_0x2b7e7c['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x2b7e7c['dialCongestionRetryFrequency']||0x96;this[_0xee2f('0x31')]=_0x2b7e7c[_0xee2f('0x31')]||0x3;this[_0xee2f('0x32')]=_0x2b7e7c[_0xee2f('0x32')]||0x96;this[_0xee2f('0x33')]=_0x2b7e7c[_0xee2f('0x33')]||0x3;this['dialNoAnswerRetryFrequency']=_0x2b7e7c[_0xee2f('0x34')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x2b7e7c[_0xee2f('0x35')]||0x3;this[_0xee2f('0x36')]=_0x2b7e7c[_0xee2f('0x36')]||0x96;this[_0xee2f('0x37')]=_0x2b7e7c[_0xee2f('0x37')]||0x3;this['dialDropRetryFrequency']=_0x2b7e7c[_0xee2f('0x38')]||0x96;this[_0xee2f('0x39')]=_0x2b7e7c['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x2b7e7c[_0xee2f('0x3a')]||0x96;this['dialMachineMaxRetry']=_0x2b7e7c[_0xee2f('0x3b')]||0x3;this[_0xee2f('0x3c')]=_0x2b7e7c['dialMachineRetryFrequency']||0x96;this[_0xee2f('0x3d')]=_0x2b7e7c['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x2b7e7c['dialAgentRejectRetryFrequency']||0x96;this[_0xee2f('0x3e')]=_0x2b7e7c[_0xee2f('0x3e')]||0x3;this['dialGlobalMaxRetry']=_0x2b7e7c[_0xee2f('0x3f')]||0x4;this[_0xee2f('0x40')]=_0x2b7e7c[_0xee2f('0x40')]?_0x2b7e7c[_0xee2f('0x40')]:undefined;this[_0xee2f('0x41')]=_0x2b7e7c['TrunkBackup']?_0x2b7e7c[_0xee2f('0x41')]:undefined;this['dialPrefix']=_0x2b7e7c[_0xee2f('0x42')]||undefined;this[_0xee2f('0x43')]=_0x2b7e7c[_0xee2f('0x43')]?_0x2b7e7c['Interval']:undefined;this[_0xee2f('0x44')]=_0x2b7e7c['dialOrderByScheduledAt']||_0xee2f('0x45');this['dialRandomLastDigitCallerIdNumber']=_0x2b7e7c[_0xee2f('0x46')]||undefined;this[_0xee2f('0x47')]=_0x2b7e7c[_0xee2f('0x47')]||undefined;this[_0xee2f('0x48')]=strategy[_0x2b7e7c[_0xee2f('0x48')]];this[_0xee2f('0x49')]=!![];this[_0xee2f('0x4a')]=_0x2b7e7c[_0xee2f('0x4a')]||![];this[_0xee2f('0x4b')]=_0x2b7e7c[_0xee2f('0x4b')];this[_0xee2f('0x4c')]=_0x2b7e7c['dialAMDGreeting'];this[_0xee2f('0x4d')]=_0x2b7e7c['dialAMDAfterGreetingSilence'];this[_0xee2f('0x4e')]=_0x2b7e7c[_0xee2f('0x4e')];this[_0xee2f('0x4f')]=_0x2b7e7c[_0xee2f('0x4f')];this[_0xee2f('0x50')]=_0x2b7e7c[_0xee2f('0x50')];this[_0xee2f('0x51')]=_0x2b7e7c[_0xee2f('0x51')];this['dialAMDSilenceThreshold']=_0x2b7e7c['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x2b7e7c[_0xee2f('0x52')];this['outboundRejectCallsDay']=0x0;this[_0xee2f('0x53')]=0x0;this['timeout']=_0x2b7e7c['timeout'];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xee2f('0x54')]=0x0;this[_0xee2f('0x55')]=0x0;this[_0xee2f('0x56')]=0x0;this[_0xee2f('0x57')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xee2f('0x58')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xee2f('0x59')]=0x0;this[_0xee2f('0x5a')]=0x0;this[_0xee2f('0x5b')]=0x0;this['startProgressive']=undefined;this[_0xee2f('0x5c')]=undefined;this[_0xee2f('0x5d')]=undefined;this[_0xee2f('0x5e')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xee2f('0x5f')]=0x0;this[_0xee2f('0x60')]=0x0;this[_0xee2f('0x61')]=0x0;this[_0xee2f('0x62')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xee2f('0x63')]=0x0;this[_0xee2f('0x64')]=_0x2b7e7c[_0xee2f('0x65')]||0x14;this[_0xee2f('0x66')]=_0x2b7e7c[_0xee2f('0x65')]||0xa;this[_0xee2f('0x67')]=0x0;this[_0xee2f('0x68')]=0x0;this[_0xee2f('0x69')]=0x1;this[_0xee2f('0x6a')]=0x0;this[_0xee2f('0x6b')]=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x2b7e7c['dialRecallMeTimeout']||0x1e;this[_0xee2f('0x6c')]=_0x2b7e7c[_0xee2f('0x6c')]||![];this[_0xee2f('0x6d')]=!!_0x2b7e7c[_0xee2f('0x6d')]||![];this[_0xee2f('0x6e')]=!!_0x2b7e7c['dialPreviewRecallmeReminder']||![];this[_0xee2f('0x6f')]=_0x2b7e7c[_0xee2f('0x6f')]||undefined;this[_0xee2f('0x70')]=_0x2b7e7c[_0xee2f('0x70')]||![];this['dialAgiAfterHangupAgent']=_0x2b7e7c['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x2b7e7c[_0xee2f('0x9')]]?monitorFormat[_0x2b7e7c['monitor_format']]:undefined;this['mandatoryDisposition']=_0x2b7e7c['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x2b7e7c[_0xee2f('0x71')]?_0x2b7e7c[_0xee2f('0x71')]:undefined;this[_0xee2f('0x72')]=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 5f99ec1..2484d3d 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 _0x102b=['loggedin','callers','length','online','incall','ringInUse','booked','queue','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','outboundReCallsDay','preview','exports','loggedIn','paused','ringing','talking','waiting','available','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundRejectCallsDay','pTalking','sumDuration','total','name','strategy','abandoned','busy','invalid','loggedInDb','onHold','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','createReport','notInUse'];(function(_0x3cc8b1,_0xd6017e){var _0x2c6b8d=function(_0x269b09){while(--_0x269b09){_0x3cc8b1['push'](_0x3cc8b1['shift']());}};_0x2c6b8d(++_0xd6017e);}(_0x102b,0x1be));var _0xb102=function(_0x405de1,_0x2f21d3){_0x405de1=_0x405de1-0x0;var _0x28ba39=_0x102b[_0x405de1];return _0x28ba39;};'use strict';var INBOUND_COUNTERS=['available',_0xb102('0x0'),'loggedInDb',_0xb102('0x1'),_0xb102('0x2'),_0xb102('0x3'),_0xb102('0x4')];var OUTBOUND_COUNTERS=[_0xb102('0x5'),_0xb102('0x6'),_0xb102('0x7'),_0xb102('0x0'),'loggedInDb',_0xb102('0x8'),_0xb102('0x9'),_0xb102('0xa'),_0xb102('0xb'),_0xb102('0xc'),'outboundCongestionCallsDay',_0xb102('0xd'),'outboundNoSuchCallsDay','outboundReCallsDay',_0xb102('0xe'),'outboundUnknownCallsDay','paused',_0xb102('0xf'),_0xb102('0x3'),'sumBillable',_0xb102('0x10'),_0xb102('0x11'),_0xb102('0x4')];function VoiceQueueSummary(_0x106c8a){this['id']=_0x106c8a['id'];this[_0xb102('0x12')]=_0x106c8a[_0xb102('0x12')];this[_0xb102('0x13')]=_0x106c8a['strategy'];this[_0xb102('0x14')]=_0x106c8a['abandoned']||0x0;this[_0xb102('0x6')]=_0x106c8a[_0xb102('0x6')]||0x0;this['available']=_0x106c8a[_0xb102('0x5')]||0x0;this[_0xb102('0x15')]=_0x106c8a['busy']||0x0;this[_0xb102('0x7')]=_0x106c8a[_0xb102('0x7')]||0x0;this[_0xb102('0x16')]=_0x106c8a['invalid']||0x0;this['loggedIn']=_0x106c8a['loggedIn']||0x0;this[_0xb102('0x17')]=_0x106c8a[_0xb102('0x17')]||0x0;this[_0xb102('0x18')]=_0x106c8a[_0xb102('0x18')]||0x0;this['notInUse']=_0x106c8a['notInUse']||0x0;this[_0xb102('0x1')]=_0x106c8a[_0xb102('0x1')]||0x0;this[_0xb102('0x2')]=_0x106c8a[_0xb102('0x2')]||0x0;this['ringInUse']=_0x106c8a['ringInUse'];this[_0xb102('0x19')]=_0x106c8a[_0xb102('0x19')];this[_0xb102('0x10')]=_0x106c8a[_0xb102('0x10')];this['sumHoldTime']=_0x106c8a[_0xb102('0x1a')]||0x0;this[_0xb102('0x3')]=_0x106c8a[_0xb102('0x3')]||0x0;this[_0xb102('0x11')]=_0x106c8a['total']||0x0;this['type']=_0x106c8a[_0xb102('0x1b')];this[_0xb102('0x1c')]=_0x106c8a['unavailable']||0x0;this[_0xb102('0x1d')]=_0x106c8a['unknown']||0x0;this[_0xb102('0x1e')]=_0x106c8a[_0xb102('0x1e')]||0x0;this[_0xb102('0x4')]=_0x106c8a[_0xb102('0x4')]||0x0;if(_0x106c8a['type']==='outbound'){this[_0xb102('0xf')]=_0x106c8a[_0xb102('0xf')]||0x0;this[_0xb102('0x1f')]=_0x106c8a[_0xb102('0x1f')];this[_0xb102('0x20')]=_0x106c8a[_0xb102('0x20')];this[_0xb102('0x21')]=_0x106c8a[_0xb102('0x21')];this['dialOriginateCallerIdNumber']=_0x106c8a['dialOriginateCallerIdNumber'];this[_0xb102('0x22')]=_0x106c8a[_0xb102('0x22')];this[_0xb102('0x23')]=_0x106c8a[_0xb102('0x23')];this['temp']=_0x106c8a[_0xb102('0x24')];this['outboundAnswerAgiCallsDay']=_0x106c8a[_0xb102('0x25')];this[_0xb102('0xa')]=_0x106c8a['outboundAnswerCallsDay'];this[_0xb102('0xb')]=_0x106c8a[_0xb102('0xb')];this[_0xb102('0xc')]=_0x106c8a[_0xb102('0xc')];this[_0xb102('0x26')]=_0x106c8a[_0xb102('0x26')];this[_0xb102('0x27')]=_0x106c8a[_0xb102('0x27')];this[_0xb102('0x28')]=_0x106c8a['outboundDropCallsDayCallersExit'];this[_0xb102('0x29')]=_0x106c8a[_0xb102('0x29')];this[_0xb102('0xd')]=_0x106c8a['outboundNoAnswerCallsDay'];this[_0xb102('0x2a')]=_0x106c8a[_0xb102('0x2a')];this[_0xb102('0x2b')]=_0x106c8a[_0xb102('0x2b')];this['outboundReCallsDay']=_0x106c8a['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x106c8a['outboundRejectCallsDay'];this[_0xb102('0x2c')]=_0x106c8a[_0xb102('0x2c')];this['predictiveIntervalAnsweredCalls']=_0x106c8a[_0xb102('0x2d')];this[_0xb102('0x2e')]=_0x106c8a[_0xb102('0x2e')];this[_0xb102('0x2f')]=_0x106c8a[_0xb102('0x2f')];this[_0xb102('0x30')]=_0x106c8a[_0xb102('0x30')];this[_0xb102('0x31')]=_0x106c8a[_0xb102('0x31')];this[_0xb102('0x32')]=_0x106c8a[_0xb102('0x32')];this[_0xb102('0x33')]=_0x106c8a[_0xb102('0x33')];this[_0xb102('0x34')]=_0x106c8a[_0xb102('0x34')];this[_0xb102('0x35')]=_0x106c8a['predictiveIntervalMultiplicativeFactor'];this[_0xb102('0x36')]=_0x106c8a[_0xb102('0x36')];this['predictiveIntervalAvailable']=_0x106c8a[_0xb102('0x37')];this[_0xb102('0x38')]=_0x106c8a[_0xb102('0x38')];this[_0xb102('0x8')]=_0x106c8a['originated'];this[_0xb102('0x39')]=_0x106c8a[_0xb102('0x39')];this[_0xb102('0x3a')]=_0x106c8a[_0xb102('0x3a')];this[_0xb102('0x3b')]=_0x106c8a[_0xb102('0x3b')];this[_0xb102('0x3c')]=_0x106c8a['erlangBusyFactor'];this[_0xb102('0x3d')]=_0x106c8a[_0xb102('0x3d')];this['startProgressive']=_0x106c8a[_0xb102('0x3e')];this[_0xb102('0x3f')]=_0x106c8a[_0xb102('0x3f')];this['statusMessage']=_0x106c8a[_0xb102('0x40')];}if(_0x106c8a[_0xb102('0x41')]){this['Trunk']={'id':_0x106c8a[_0xb102('0x41')]['id'],'name':_0x106c8a['Trunk']['name'],'active':_0x106c8a['Trunk'][_0xb102('0x42')],'callerid':_0x106c8a[_0xb102('0x41')]['callerid']};}}VoiceQueueSummary[_0xb102('0x43')][_0xb102('0x44')]=function(_0x7dc750,_0x472de5,_0x42c8e7,_0x38c6b5){this[_0xb102('0x17')]=0x0;this[_0xb102('0x3')]=0x0;this[_0xb102('0x1')]=0x0;this['unknown']=0x0;this[_0xb102('0x45')]=0x0;this[_0xb102('0x7')]=0x0;this[_0xb102('0x15')]=0x0;this[_0xb102('0x16')]=0x0;this[_0xb102('0x1c')]=0x0;this[_0xb102('0x2')]=0x0;this['ringInUse']=0x0;this['onHold']=0x0;if(_0x42c8e7){if(_0x42c8e7[_0xb102('0x5')]){this[_0xb102('0x5')]=Number(_0x42c8e7[_0xb102('0x5')]);}if(_0x42c8e7[_0xb102('0x46')]){this['loggedIn']=Number(_0x42c8e7['loggedin']);}if(_0x42c8e7[_0xb102('0x47')]){this[_0xb102('0x4')]=Number(_0x42c8e7[_0xb102('0x47')]);}}for(var _0x9d638e=0x0;_0x9d638e<_0x7dc750[_0xb102('0x48')];_0x9d638e++){var _0x53b276=_0x472de5['SIP/'+_0x7dc750[_0x9d638e][_0xb102('0x12')]];if(_0x53b276&&_0x53b276[_0xb102('0x49')]){this['loggedInDb']+=0x1;}if(_0x7dc750[_0x9d638e][_0xb102('0x4a')]==='1'){this[_0xb102('0x3')]+=0x1;}if(_0x7dc750[_0x9d638e]['paused']==='1'&&!['2','7','8']['includes'](_0x7dc750[_0x9d638e]['status'])){this['paused']+=0x1;}switch(_0x7dc750[_0x9d638e]['status']){case'0':this[_0xb102('0x1d')]+=0x1;break;case'1':this[_0xb102('0x45')]+=0x1;break;case'2':this[_0xb102('0x7')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0xb102('0x16')]+=0x1;break;case'5':this[_0xb102('0x1c')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0xb102('0x4b')]+=0x1;break;case'8':this[_0xb102('0x18')]+=0x1;break;}}if(this['dialMethod']===_0xb102('0x4c')){var _0x4d7a52=Object['keys'](_0x38c6b5);for(var _0x272165=0x0;_0x272165<_0x4d7a52['length'];_0x272165++){var _0x1d5cc9=_0x4d7a52[_0x272165];var _0x16e7d1=_0x38c6b5[_0x1d5cc9];if(_0x16e7d1[_0xb102('0x4d')]===this['name']&&_0x16e7d1[_0xb102('0x1b')]==='dialer'&&_0x16e7d1[_0xb102('0x4e')]===_0xb102('0x4f')){this[_0xb102('0x3')]+=0x1;}}if(this[_0xb102('0x3')]>this[_0xb102('0x7')]){this[_0xb102('0x3')]=this[_0xb102('0x7')];}this[_0xb102('0xf')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0xb102('0x50')]=function(_0x1565af){var _0x4cdea0=![];if(_0x1565af){_0x4cdea0=INBOUND_COUNTERS[_0xb102('0x51')](function(_0x574079){return this[_0x574079]!==_0x1565af[_0x574079];},this);}return _0x4cdea0;};VoiceQueueSummary['prototype'][_0xb102('0x52')]=function(_0x5c2b24){var _0x3a5067=![];var _0x2665fb=![];var _0xcdf002=![];if(_0x5c2b24){_0x3a5067=this[_0xb102('0x20')]!==_0x5c2b24[_0xb102('0x20')]||this['dialActive']!==_0x5c2b24[_0xb102('0x1f')]||this[_0xb102('0x3f')]!==_0x5c2b24[_0xb102('0x3f')]||this[_0xb102('0x40')]!==_0x5c2b24[_0xb102('0x40')];_0x2665fb=OUTBOUND_COUNTERS[_0xb102('0x51')](function(_0x3e686b){return this[_0x3e686b]!==_0x5c2b24[_0x3e686b];},this);if(this[_0xb102('0x41')]&&_0x5c2b24[_0xb102('0x41')]){_0xcdf002=this['Trunk'][_0xb102('0x12')]!==_0x5c2b24[_0xb102('0x41')][_0xb102('0x12')]||this[_0xb102('0x41')][_0xb102('0x42')]!==_0x5c2b24[_0xb102('0x41')][_0xb102('0x42')];}}return _0x3a5067||_0x2665fb||_0xcdf002;};VoiceQueueSummary['prototype']['updateReportFromOutboundQueue']=function(_0x429733){this[_0xb102('0x6')]=_0x429733['answered'];this[_0xb102('0x3f')]=_0x429733[_0xb102('0x3f')];this[_0xb102('0x40')]=_0x429733['statusMessage'];this[_0xb102('0x8')]=_0x429733[_0xb102('0x8')];this['outboundAbandonedCallsDay']=_0x429733[_0xb102('0x9')];this[_0xb102('0xa')]=_0x429733['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x429733[_0xb102('0xb')];this[_0xb102('0xc')]=_0x429733[_0xb102('0xc')];this[_0xb102('0x26')]=_0x429733[_0xb102('0x26')];this[_0xb102('0xd')]=_0x429733['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0x429733['outboundNoSuchCallsDay'];this[_0xb102('0x53')]=_0x429733[_0xb102('0x53')];this['outboundRejectCallsDay']=_0x429733[_0xb102('0xe')];this['outboundUnknownCallsDay']=_0x429733[_0xb102('0x2c')];this[_0xb102('0x19')]=_0x429733[_0xb102('0x19')];this[_0xb102('0x10')]=_0x429733[_0xb102('0x10')];this[_0xb102('0x11')]=_0x429733['total'];if(this[_0xb102('0x20')]===_0xb102('0x54')){this[_0xb102('0xf')]=_0x429733[_0xb102('0xf')];}};module[_0xb102('0x55')]=VoiceQueueSummary; \ No newline at end of file +var _0xab3f=['startPredictive','startProgressive','message','statusMessage','Trunk','name','active','callerid','prototype','createReport','ringInUse','callers','SIP/','online','includes','status','dialMethod','keys','length','queue','pTalking','compareToInboundQueue','compareToOutboundQueue','some','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','available','loggedInDb','paused','ringing','talking','waiting','answered','inUse','loggedIn','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundRejectCallsDay','sumDuration','total','strategy','abandoned','busy','invalid','onHold','notInUse','sumBillable','sumHoldTime','unavailable','unknown','unmanaged','type','outbound','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor'];(function(_0x4ab917,_0x4878ae){var _0x3c428d=function(_0x4f5e18){while(--_0x4f5e18){_0x4ab917['push'](_0x4ab917['shift']());}};_0x3c428d(++_0x4878ae);}(_0xab3f,0x72));var _0xfab3=function(_0x58d6c2,_0x205acb){_0x58d6c2=_0x58d6c2-0x0;var _0x5a192e=_0xab3f[_0x58d6c2];return _0x5a192e;};'use strict';var INBOUND_COUNTERS=[_0xfab3('0x0'),'loggedIn',_0xfab3('0x1'),_0xfab3('0x2'),_0xfab3('0x3'),_0xfab3('0x4'),_0xfab3('0x5')];var OUTBOUND_COUNTERS=[_0xfab3('0x0'),_0xfab3('0x6'),_0xfab3('0x7'),_0xfab3('0x8'),_0xfab3('0x1'),_0xfab3('0x9'),'outboundAbandonedCallsDay',_0xfab3('0xa'),_0xfab3('0xb'),_0xfab3('0xc'),_0xfab3('0xd'),_0xfab3('0xe'),'outboundNoSuchCallsDay','outboundReCallsDay',_0xfab3('0xf'),'outboundUnknownCallsDay',_0xfab3('0x2'),'pTalking',_0xfab3('0x4'),'sumBillable',_0xfab3('0x10'),_0xfab3('0x11'),_0xfab3('0x5')];function VoiceQueueSummary(_0x37a4bc){this['id']=_0x37a4bc['id'];this['name']=_0x37a4bc['name'];this['strategy']=_0x37a4bc[_0xfab3('0x12')];this[_0xfab3('0x13')]=_0x37a4bc[_0xfab3('0x13')]||0x0;this[_0xfab3('0x6')]=_0x37a4bc['answered']||0x0;this['available']=_0x37a4bc[_0xfab3('0x0')]||0x0;this[_0xfab3('0x14')]=_0x37a4bc[_0xfab3('0x14')]||0x0;this[_0xfab3('0x7')]=_0x37a4bc[_0xfab3('0x7')]||0x0;this[_0xfab3('0x15')]=_0x37a4bc[_0xfab3('0x15')]||0x0;this[_0xfab3('0x8')]=_0x37a4bc['loggedIn']||0x0;this['loggedInDb']=_0x37a4bc[_0xfab3('0x1')]||0x0;this[_0xfab3('0x16')]=_0x37a4bc[_0xfab3('0x16')]||0x0;this[_0xfab3('0x17')]=_0x37a4bc[_0xfab3('0x17')]||0x0;this[_0xfab3('0x2')]=_0x37a4bc[_0xfab3('0x2')]||0x0;this[_0xfab3('0x3')]=_0x37a4bc[_0xfab3('0x3')]||0x0;this['ringInUse']=_0x37a4bc['ringInUse'];this[_0xfab3('0x18')]=_0x37a4bc[_0xfab3('0x18')];this[_0xfab3('0x10')]=_0x37a4bc['sumDuration'];this[_0xfab3('0x19')]=_0x37a4bc[_0xfab3('0x19')]||0x0;this[_0xfab3('0x4')]=_0x37a4bc[_0xfab3('0x4')]||0x0;this[_0xfab3('0x11')]=_0x37a4bc['total']||0x0;this['type']=_0x37a4bc['type'];this[_0xfab3('0x1a')]=_0x37a4bc[_0xfab3('0x1a')]||0x0;this[_0xfab3('0x1b')]=_0x37a4bc[_0xfab3('0x1b')]||0x0;this['unmanaged']=_0x37a4bc[_0xfab3('0x1c')]||0x0;this[_0xfab3('0x5')]=_0x37a4bc[_0xfab3('0x5')]||0x0;if(_0x37a4bc[_0xfab3('0x1d')]===_0xfab3('0x1e')){this['pTalking']=_0x37a4bc['pTalking']||0x0;this[_0xfab3('0x1f')]=_0x37a4bc[_0xfab3('0x1f')];this['dialMethod']=_0x37a4bc['dialMethod'];this[_0xfab3('0x20')]=_0x37a4bc[_0xfab3('0x20')];this[_0xfab3('0x21')]=_0x37a4bc['dialOriginateCallerIdNumber'];this[_0xfab3('0x22')]=_0x37a4bc[_0xfab3('0x22')];this[_0xfab3('0x23')]=_0x37a4bc[_0xfab3('0x23')];this['temp']=_0x37a4bc[_0xfab3('0x24')];this[_0xfab3('0x25')]=_0x37a4bc[_0xfab3('0x25')];this[_0xfab3('0xa')]=_0x37a4bc[_0xfab3('0xa')];this[_0xfab3('0xb')]=_0x37a4bc[_0xfab3('0xb')];this['outboundBusyCallsDay']=_0x37a4bc[_0xfab3('0xc')];this[_0xfab3('0xd')]=_0x37a4bc[_0xfab3('0xd')];this[_0xfab3('0x26')]=_0x37a4bc[_0xfab3('0x26')];this['outboundDropCallsDayCallersExit']=_0x37a4bc[_0xfab3('0x27')];this['outboundDropCallsDayTimeout']=_0x37a4bc[_0xfab3('0x28')];this[_0xfab3('0xe')]=_0x37a4bc['outboundNoAnswerCallsDay'];this[_0xfab3('0x29')]=_0x37a4bc[_0xfab3('0x29')];this[_0xfab3('0x2a')]=_0x37a4bc[_0xfab3('0x2a')];this[_0xfab3('0x2b')]=_0x37a4bc['outboundReCallsDay'];this[_0xfab3('0xf')]=_0x37a4bc[_0xfab3('0xf')];this[_0xfab3('0x2c')]=_0x37a4bc[_0xfab3('0x2c')];this[_0xfab3('0x2d')]=_0x37a4bc[_0xfab3('0x2d')];this[_0xfab3('0x2e')]=_0x37a4bc[_0xfab3('0x2e')];this[_0xfab3('0x2f')]=_0x37a4bc['predictiveIntervalAvgTalktime'];this['predictiveIntervalDroppedCallsCallersExit']=_0x37a4bc[_0xfab3('0x30')];this[_0xfab3('0x31')]=_0x37a4bc['predictiveIntervalDroppedCallsTimeout'];this[_0xfab3('0x32')]=_0x37a4bc[_0xfab3('0x32')];this[_0xfab3('0x33')]=_0x37a4bc[_0xfab3('0x33')];this[_0xfab3('0x34')]=_0x37a4bc['predictiveIntervalHitRate'];this[_0xfab3('0x35')]=_0x37a4bc[_0xfab3('0x35')];this[_0xfab3('0x36')]=_0x37a4bc['predictiveIntervalPauses'];this['predictiveIntervalAvailable']=_0x37a4bc['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0x37a4bc[_0xfab3('0x37')];this[_0xfab3('0x9')]=_0x37a4bc[_0xfab3('0x9')];this[_0xfab3('0x38')]=_0x37a4bc[_0xfab3('0x38')];this[_0xfab3('0x39')]=_0x37a4bc[_0xfab3('0x39')];this[_0xfab3('0x3a')]=_0x37a4bc[_0xfab3('0x3a')];this[_0xfab3('0x3b')]=_0x37a4bc[_0xfab3('0x3b')];this[_0xfab3('0x3c')]=_0x37a4bc[_0xfab3('0x3c')];this[_0xfab3('0x3d')]=_0x37a4bc['startProgressive'];this[_0xfab3('0x3e')]=_0x37a4bc[_0xfab3('0x3e')];this[_0xfab3('0x3f')]=_0x37a4bc[_0xfab3('0x3f')];}if(_0x37a4bc[_0xfab3('0x40')]){this[_0xfab3('0x40')]={'id':_0x37a4bc[_0xfab3('0x40')]['id'],'name':_0x37a4bc[_0xfab3('0x40')][_0xfab3('0x41')],'active':_0x37a4bc[_0xfab3('0x40')][_0xfab3('0x42')],'callerid':_0x37a4bc['Trunk'][_0xfab3('0x43')]};}}VoiceQueueSummary[_0xfab3('0x44')][_0xfab3('0x45')]=function(_0x172dce,_0x8b7075,_0x1d6052,_0x543885){this[_0xfab3('0x1')]=0x0;this[_0xfab3('0x4')]=0x0;this[_0xfab3('0x2')]=0x0;this[_0xfab3('0x1b')]=0x0;this['notInUse']=0x0;this[_0xfab3('0x7')]=0x0;this[_0xfab3('0x14')]=0x0;this[_0xfab3('0x15')]=0x0;this['unavailable']=0x0;this[_0xfab3('0x3')]=0x0;this[_0xfab3('0x46')]=0x0;this['onHold']=0x0;if(_0x1d6052){if(_0x1d6052[_0xfab3('0x0')]){this[_0xfab3('0x0')]=Number(_0x1d6052['available']);}if(_0x1d6052['loggedin']){this['loggedIn']=Number(_0x1d6052['loggedin']);}if(_0x1d6052[_0xfab3('0x47')]){this[_0xfab3('0x5')]=Number(_0x1d6052['callers']);}}for(var _0x2ddb6c=0x0;_0x2ddb6c<_0x172dce['length'];_0x2ddb6c++){var _0x4e2c13=_0x8b7075[_0xfab3('0x48')+_0x172dce[_0x2ddb6c][_0xfab3('0x41')]];if(_0x4e2c13&&_0x4e2c13[_0xfab3('0x49')]){this['loggedInDb']+=0x1;}if(_0x172dce[_0x2ddb6c]['incall']==='1'){this[_0xfab3('0x4')]+=0x1;}if(_0x172dce[_0x2ddb6c][_0xfab3('0x2')]==='1'&&!['2','7','8'][_0xfab3('0x4a')](_0x172dce[_0x2ddb6c][_0xfab3('0x4b')])){this[_0xfab3('0x2')]+=0x1;}switch(_0x172dce[_0x2ddb6c][_0xfab3('0x4b')]){case'0':this[_0xfab3('0x1b')]+=0x1;break;case'1':this[_0xfab3('0x17')]+=0x1;break;case'2':this[_0xfab3('0x7')]+=0x1;break;case'3':this[_0xfab3('0x14')]+=0x1;break;case'4':this[_0xfab3('0x15')]+=0x1;break;case'5':this[_0xfab3('0x1a')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0xfab3('0x46')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0xfab3('0x4c')]==='booked'){var _0x2f74ba=Object[_0xfab3('0x4d')](_0x543885);for(var _0x5d02ec=0x0;_0x5d02ec<_0x2f74ba[_0xfab3('0x4e')];_0x5d02ec++){var _0x3a6bf5=_0x2f74ba[_0x5d02ec];var _0x1d7e81=_0x543885[_0x3a6bf5];if(_0x1d7e81[_0xfab3('0x4f')]===this[_0xfab3('0x41')]&&_0x1d7e81['type']==='dialer'&&_0x1d7e81['exten']==='xcally-motion-preview'){this[_0xfab3('0x4')]+=0x1;}}if(this[_0xfab3('0x4')]>this[_0xfab3('0x7')]){this[_0xfab3('0x4')]=this[_0xfab3('0x7')];}this[_0xfab3('0x50')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0xfab3('0x51')]=function(_0x3a7f64){var _0x271f44=![];if(_0x3a7f64){_0x271f44=INBOUND_COUNTERS['some'](function(_0x46b93e){return this[_0x46b93e]!==_0x3a7f64[_0x46b93e];},this);}return _0x271f44;};VoiceQueueSummary['prototype'][_0xfab3('0x52')]=function(_0x5d8907){var _0x473056=![];var _0x3c0630=![];var _0x3d90ee=![];if(_0x5d8907){_0x473056=this[_0xfab3('0x4c')]!==_0x5d8907[_0xfab3('0x4c')]||this[_0xfab3('0x1f')]!==_0x5d8907['dialActive']||this[_0xfab3('0x3e')]!==_0x5d8907[_0xfab3('0x3e')]||this[_0xfab3('0x3f')]!==_0x5d8907[_0xfab3('0x3f')];_0x3c0630=OUTBOUND_COUNTERS[_0xfab3('0x53')](function(_0x4b0890){return this[_0x4b0890]!==_0x5d8907[_0x4b0890];},this);if(this[_0xfab3('0x40')]&&_0x5d8907['Trunk']){_0x3d90ee=this[_0xfab3('0x40')][_0xfab3('0x41')]!==_0x5d8907[_0xfab3('0x40')][_0xfab3('0x41')]||this['Trunk'][_0xfab3('0x42')]!==_0x5d8907['Trunk']['active'];}}return _0x473056||_0x3c0630||_0x3d90ee;};VoiceQueueSummary[_0xfab3('0x44')][_0xfab3('0x54')]=function(_0x585057){this[_0xfab3('0x6')]=_0x585057[_0xfab3('0x6')];this['message']=_0x585057[_0xfab3('0x3e')];this[_0xfab3('0x3f')]=_0x585057[_0xfab3('0x3f')];this[_0xfab3('0x9')]=_0x585057[_0xfab3('0x9')];this[_0xfab3('0x55')]=_0x585057[_0xfab3('0x55')];this[_0xfab3('0xa')]=_0x585057[_0xfab3('0xa')];this['outboundBlacklistCallsDay']=_0x585057[_0xfab3('0xb')];this[_0xfab3('0xc')]=_0x585057[_0xfab3('0xc')];this[_0xfab3('0xd')]=_0x585057[_0xfab3('0xd')];this['outboundNoAnswerCallsDay']=_0x585057['outboundNoAnswerCallsDay'];this[_0xfab3('0x29')]=_0x585057[_0xfab3('0x29')];this[_0xfab3('0x2b')]=_0x585057['outboundReCallsDay'];this[_0xfab3('0xf')]=_0x585057['outboundRejectCallsDay'];this[_0xfab3('0x2c')]=_0x585057[_0xfab3('0x2c')];this[_0xfab3('0x18')]=_0x585057[_0xfab3('0x18')];this[_0xfab3('0x10')]=_0x585057[_0xfab3('0x10')];this[_0xfab3('0x11')]=_0x585057[_0xfab3('0x11')];if(this[_0xfab3('0x4c')]===_0xfab3('0x56')){this[_0xfab3('0x50')]=_0x585057[_0xfab3('0x50')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 4e81620..7cd93be 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 _0xa49d=['Configurations','exports','username','accessKey','remoteUri'];(function(_0x505947,_0x2e3e5d){var _0x349027=function(_0x168b9f){while(--_0x168b9f){_0x505947['push'](_0x505947['shift']());}};_0x349027(++_0x2e3e5d);}(_0xa49d,0xb1));var _0xda49=function(_0x362293,_0x40bfca){_0x362293=_0x362293-0x0;var _0x2baea4=_0xa49d[_0x362293];return _0x2baea4;};'use strict';function VtigerAccount(_0x4241e3){this['id']=_0x4241e3['id']||0x0;this['name']=_0x4241e3['name']||'';this[_0xda49('0x0')]=_0x4241e3[_0xda49('0x0')]||'';this[_0xda49('0x1')]=_0x4241e3[_0xda49('0x1')]||'';this['remoteUri']=_0x4241e3[_0xda49('0x2')]||'';this['serverUrl']=_0x4241e3['serverUrl']||'';this[_0xda49('0x3')]=_0x4241e3[_0xda49('0x3')]||{};}module[_0xda49('0x4')]=VtigerAccount; \ No newline at end of file +var _0x19b5=['exports','name','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x19b5,0x1b7));var _0x519b=function(_0x589271,_0x540f33){_0x589271=_0x589271-0x0;var _0x388718=_0x19b5[_0x589271];return _0x388718;};'use strict';function VtigerAccount(_0x42983b){this['id']=_0x42983b['id']||0x0;this[_0x519b('0x0')]=_0x42983b[_0x519b('0x0')]||'';this['username']=_0x42983b['username']||'';this[_0x519b('0x1')]=_0x42983b['accessKey']||'';this[_0x519b('0x2')]=_0x42983b[_0x519b('0x2')]||'';this[_0x519b('0x3')]=_0x42983b[_0x519b('0x3')]||'';this[_0x519b('0x4')]=_0x42983b[_0x519b('0x4')]||{};}module[_0x519b('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index a27dd12..5ce72b6 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 _0xb0dd=['username','password','remoteUri','authType','serverUrl','Configurations','exports','name'];(function(_0x208ac9,_0x20baf7){var _0x4f0724=function(_0x774596){while(--_0x774596){_0x208ac9['push'](_0x208ac9['shift']());}};_0x4f0724(++_0x20baf7);}(_0xb0dd,0x77));var _0xdb0d=function(_0xef870c,_0x54252f){_0xef870c=_0xef870c-0x0;var _0x53ec32=_0xb0dd[_0xef870c];return _0x53ec32;};'use strict';function ZendeskAccount(_0x3df459){this['id']=_0x3df459['id']||0x0;this[_0xdb0d('0x0')]=_0x3df459[_0xdb0d('0x0')]||'';this[_0xdb0d('0x1')]=_0x3df459[_0xdb0d('0x1')]||'';this[_0xdb0d('0x2')]=_0x3df459['password']||'';this['token']=_0x3df459['token']||'';this[_0xdb0d('0x3')]=_0x3df459['remoteUri']||'';this[_0xdb0d('0x4')]=_0x3df459[_0xdb0d('0x4')]||'';this['type']=_0x3df459['type']||'integrationTab';this[_0xdb0d('0x5')]=_0x3df459[_0xdb0d('0x5')]||'';this[_0xdb0d('0x6')]=_0x3df459['Configurations']||{};}module[_0xdb0d('0x7')]=ZendeskAccount; \ No newline at end of file +var _0xdb86=['Configurations','exports','name','username','password','token','remoteUri','type','serverUrl'];(function(_0x5a1a51,_0x144c79){var _0x47edd7=function(_0x2259bb){while(--_0x2259bb){_0x5a1a51['push'](_0x5a1a51['shift']());}};_0x47edd7(++_0x144c79);}(_0xdb86,0xb6));var _0x6db8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb86[_0x3dd15e];return _0x231fd0;};'use strict';function ZendeskAccount(_0x2f29f8){this['id']=_0x2f29f8['id']||0x0;this[_0x6db8('0x0')]=_0x2f29f8[_0x6db8('0x0')]||'';this[_0x6db8('0x1')]=_0x2f29f8[_0x6db8('0x1')]||'';this[_0x6db8('0x2')]=_0x2f29f8[_0x6db8('0x2')]||'';this[_0x6db8('0x3')]=_0x2f29f8[_0x6db8('0x3')]||'';this[_0x6db8('0x4')]=_0x2f29f8[_0x6db8('0x4')]||'';this['authType']=_0x2f29f8['authType']||'';this[_0x6db8('0x5')]=_0x2f29f8[_0x6db8('0x5')]||'integrationTab';this[_0x6db8('0x6')]=_0x2f29f8['serverUrl']||'';this[_0x6db8('0x7')]=_0x2f29f8[_0x6db8('0x7')]||{};}module[_0x6db8('0x8')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index d50f921..c0930d3 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 _0xfd05=['description','host','clientSecret','code','refreshToken','Configurations','name'];(function(_0x37cecb,_0x19ff88){var _0x2afff8=function(_0x5d76d9){while(--_0x5d76d9){_0x37cecb['push'](_0x37cecb['shift']());}};_0x2afff8(++_0x19ff88);}(_0xfd05,0xb5));var _0x5fd0=function(_0x32422c,_0x2c1abf){_0x32422c=_0x32422c-0x0;var _0x30b583=_0xfd05[_0x32422c];return _0x30b583;};'use strict';function ZohoAccount(_0x20afd3){this['id']=_0x20afd3['id']||0x0;this['name']=_0x20afd3[_0x5fd0('0x0')]||'';this[_0x5fd0('0x1')]=_0x20afd3['description']||'';this[_0x5fd0('0x2')]=_0x20afd3[_0x5fd0('0x2')]||'';this['zone']=_0x20afd3['zone']||'';this['clientId']=_0x20afd3['clientId']||'';this[_0x5fd0('0x3')]=_0x20afd3['clientSecret']||'';this['serverUrl']=_0x20afd3['serverUrl']||'';this[_0x5fd0('0x4')]=_0x20afd3[_0x5fd0('0x4')]||'';this[_0x5fd0('0x5')]=_0x20afd3[_0x5fd0('0x5')]||'';this[_0x5fd0('0x6')]=_0x20afd3[_0x5fd0('0x6')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x669e=['refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x21b706,_0x1022f4){var _0x13b94a=function(_0x3116da){while(--_0x3116da){_0x21b706['push'](_0x21b706['shift']());}};_0x13b94a(++_0x1022f4);}(_0x669e,0x1a5));var _0xe669=function(_0x4b5b64,_0x8db91){_0x4b5b64=_0x4b5b64-0x0;var _0x1e1d54=_0x669e[_0x4b5b64];return _0x1e1d54;};'use strict';function ZohoAccount(_0x2fac50){this['id']=_0x2fac50['id']||0x0;this[_0xe669('0x0')]=_0x2fac50['name']||'';this['description']=_0x2fac50[_0xe669('0x1')]||'';this[_0xe669('0x2')]=_0x2fac50['host']||'';this[_0xe669('0x3')]=_0x2fac50[_0xe669('0x3')]||'';this['clientId']=_0x2fac50[_0xe669('0x4')]||'';this[_0xe669('0x5')]=_0x2fac50[_0xe669('0x5')]||'';this[_0xe669('0x6')]=_0x2fac50['serverUrl']||'';this[_0xe669('0x7')]=_0x2fac50[_0xe669('0x7')]||'';this[_0xe669('0x8')]=_0x2fac50[_0xe669('0x8')]||'';this[_0xe669('0x9')]=_0x2fac50['Configurations']||{};}module[_0xe669('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 170e0c1..c029ede 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 _0x9f0e=['UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','calleridname','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x9f0e,0x116));var _0xe9f0=function(_0x52ff7b,_0x264d9b){_0x52ff7b=_0x52ff7b-0x0;var _0x2adcf6=_0x9f0e[_0x52ff7b];return _0x2adcf6;};'use strict';var util=require(_0xe9f0('0x0'));var _=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));function checkNameSurname(_0x1a7796,_0x146ad8,_0x4a1a30){var _0x5856dc='';if(!_[_0xe9f0('0x3')](_0x146ad8)&&_0xe9f0('0x4')===typeof _0x146ad8){_0x5856dc+=_0x146ad8;}if(!_[_0xe9f0('0x3')](_0x4a1a30)&&_0xe9f0('0x4')===typeof _0x4a1a30){_0x5856dc+='\x20'+_0x4a1a30;}if(_0x5856dc!==''){return _0x5856dc;}return _0x1a7796;}function Action(_0x1eed45,_0x50313d,_0x5b87c1,_0x3a17b3,_0x167198){this[_0xe9f0('0x5')]=_0x5b87c1||undefined;this['idContact']=_0x1eed45['id'];this[_0xe9f0('0x6')]=_0x50313d[_0xe9f0('0x7')];this[_0xe9f0('0x8')]=_0x50313d[_0xe9f0('0x8')];this[_0xe9f0('0x9')]=_0xe9f0('0x6');this[_0xe9f0('0xa')]=![];this[_0xe9f0('0xb')]=_[_0xe9f0('0x3')](_0x1eed45['Agent'])?undefined:_0x1eed45[_0xe9f0('0xc')][_0xe9f0('0x7')];this[_0xe9f0('0xd')]=this['membername']?util[_0xe9f0('0xe')]('SIP/%s',this[_0xe9f0('0xb')]):_0x3a17b3||undefined;this[_0xe9f0('0xf')]=checkNameSurname(_0x1eed45[_0xe9f0('0x10')][_0xe9f0('0x11')],_0x1eed45['Contact'][_0xe9f0('0x12')],_0x1eed45['Contact'][_0xe9f0('0x13')]);this[_0xe9f0('0x14')]=_0x1eed45[_0xe9f0('0x14')]||![];this['calleridnum']=_0x1eed45[_0xe9f0('0x11')];this[_0xe9f0('0x15')]=_0x1eed45[_0xe9f0('0x15')];this['countbusyretry']=_0x1eed45[_0xe9f0('0x16')]||0x0;this[_0xe9f0('0x17')]=_0x1eed45[_0xe9f0('0x17')]||0x0;this[_0xe9f0('0x18')]=_0x1eed45[_0xe9f0('0x18')]||0x0;this[_0xe9f0('0x19')]=(_0x1eed45[_0xe9f0('0x16')]||0x0)+(_0x1eed45['countcongestionretry']||0x0)+(_0x1eed45[_0xe9f0('0x18')]||0x0)+(_0x1eed45[_0xe9f0('0x1a')]||0x0)+(_0x1eed45[_0xe9f0('0x1b')]||0x0)+(_0x1eed45['countabandonedretry']||0x0)+(_0x1eed45[_0xe9f0('0x1c')]||0x0)+(_0x1eed45[_0xe9f0('0x1d')]||0x0);this[_0xe9f0('0x1a')]=_0x1eed45[_0xe9f0('0x1a')]||0x0;this['countdropretry']=_0x1eed45[_0xe9f0('0x1b')]||0x0;this[_0xe9f0('0x1e')]=_0x1eed45['countabandonedretry']||0x0;this['countmachineretry']=_0x1eed45['countmachineretry']||0x0;this[_0xe9f0('0x1d')]=_0x1eed45[_0xe9f0('0x1d')]||0x0;this[_0xe9f0('0x1f')]=_0x1eed45[_0xe9f0('0x1f')];this[_0xe9f0('0x20')]=_0x1eed45['callbackuniqueid'];this[_0xe9f0('0x21')]=_0x1eed45[_0xe9f0('0x21')];this[_0xe9f0('0x22')]=_0x1eed45[_0xe9f0('0x22')];this[_0xe9f0('0x23')]=_0x1eed45[_0xe9f0('0x23')];this[_0xe9f0('0x24')]=_0x1eed45[_0xe9f0('0x24')];this[_0xe9f0('0x25')]=_[_0xe9f0('0x3')](_0x1eed45['Agent'])?_0x1eed45[_0xe9f0('0x25')]:_0x1eed45[_0xe9f0('0xc')]['id'];this[_0xe9f0('0x26')]=_0x1eed45[_0xe9f0('0x26')];this['originatecalleridnum']='';this[_0xe9f0('0x27')]='';}Action[_0xe9f0('0x28')][_0xe9f0('0x29')]=function(){return util[_0xe9f0('0xe')](_0xe9f0('0x2a'),this['calleridname'],this[_0xe9f0('0x2b')]);};module[_0xe9f0('0x2c')]=Action; \ No newline at end of file +var _0x065e=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','\x22%s\x22\x20<%s>','calleridname','number','util','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry'];(function(_0x1f11cd,_0x17ef95){var _0x150ba8=function(_0x514030){while(--_0x514030){_0x1f11cd['push'](_0x1f11cd['shift']());}};_0x150ba8(++_0x17ef95);}(_0x065e,0x1a7));var _0xe065=function(_0x46698a,_0x431d21){_0x46698a=_0x46698a-0x0;var _0x420318=_0x065e[_0x46698a];return _0x420318;};'use strict';var util=require(_0xe065('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x59293c,_0x1c0754,_0x240146){var _0x163f28='';if(!_['isNil'](_0x1c0754)&&'string'===typeof _0x1c0754){_0x163f28+=_0x1c0754;}if(!_[_0xe065('0x1')](_0x240146)&&_0xe065('0x2')===typeof _0x240146){_0x163f28+='\x20'+_0x240146;}if(_0x163f28!==''){return _0x163f28;}return _0x59293c;}function Action(_0x5b099e,_0x10b45f,_0x1e7e69,_0x189d72,_0x52403a){this[_0xe065('0x3')]=_0x1e7e69||undefined;this['idContact']=_0x5b099e['id'];this[_0xe065('0x4')]=_0x10b45f[_0xe065('0x5')];this[_0xe065('0x6')]=_0x10b45f[_0xe065('0x6')];this[_0xe065('0x7')]='queue';this[_0xe065('0x8')]=![];this[_0xe065('0x9')]=_[_0xe065('0x1')](_0x5b099e[_0xe065('0xa')])?undefined:_0x5b099e[_0xe065('0xa')][_0xe065('0x5')];this['channelAgent']=this['membername']?util[_0xe065('0xb')](_0xe065('0xc'),this[_0xe065('0x9')]):_0x189d72||undefined;this['calleridname']=checkNameSurname(_0x5b099e[_0xe065('0xd')][_0xe065('0xe')],_0x5b099e[_0xe065('0xd')][_0xe065('0xf')],_0x5b099e[_0xe065('0xd')]['lastName']);this[_0xe065('0x10')]=_0x5b099e[_0xe065('0x10')]||![];this[_0xe065('0x11')]=_0x5b099e[_0xe065('0xe')];this[_0xe065('0x12')]=_0x5b099e[_0xe065('0x12')];this[_0xe065('0x13')]=_0x5b099e['countbusyretry']||0x0;this[_0xe065('0x14')]=_0x5b099e[_0xe065('0x14')]||0x0;this['countnoanswerretry']=_0x5b099e[_0xe065('0x15')]||0x0;this[_0xe065('0x16')]=(_0x5b099e[_0xe065('0x13')]||0x0)+(_0x5b099e[_0xe065('0x14')]||0x0)+(_0x5b099e[_0xe065('0x15')]||0x0)+(_0x5b099e[_0xe065('0x17')]||0x0)+(_0x5b099e[_0xe065('0x18')]||0x0)+(_0x5b099e['countabandonedretry']||0x0)+(_0x5b099e[_0xe065('0x19')]||0x0)+(_0x5b099e['countagentrejectretry']||0x0);this[_0xe065('0x17')]=_0x5b099e[_0xe065('0x17')]||0x0;this['countdropretry']=_0x5b099e[_0xe065('0x18')]||0x0;this['countabandonedretry']=_0x5b099e[_0xe065('0x1a')]||0x0;this[_0xe065('0x19')]=_0x5b099e[_0xe065('0x19')]||0x0;this[_0xe065('0x1b')]=_0x5b099e[_0xe065('0x1b')]||0x0;this[_0xe065('0x1c')]=_0x5b099e[_0xe065('0x1c')];this[_0xe065('0x1d')]=_0x5b099e[_0xe065('0x1d')];this['callbackat']=_0x5b099e[_0xe065('0x1e')];this[_0xe065('0x1f')]=_0x5b099e[_0xe065('0x1f')];this[_0xe065('0x20')]=_0x5b099e['ContactId'];this['ListId']=_0x5b099e[_0xe065('0x21')];this['UserId']=_[_0xe065('0x1')](_0x5b099e[_0xe065('0xa')])?_0x5b099e[_0xe065('0x22')]:_0x5b099e[_0xe065('0xa')]['id'];this[_0xe065('0x23')]=_0x5b099e[_0xe065('0x23')];this[_0xe065('0x24')]='';this[_0xe065('0x25')]='';}Action['prototype']['getCaller']=function(){return util[_0xe065('0xb')](_0xe065('0x26'),this[_0xe065('0x27')],this[_0xe065('0x28')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 9429306..f3f2d9d 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 _0x4a0d=['toLowerVariables','OriginateError','actionid','logLookAgent','clone','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','unlockContact','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','uuid','moment','ioredis','../../../config/environment','../../../config/logger','actionPreview','../rpc/cmHopperAdditionalPhone','./action','./util/util','defaults','redis','socket.io-emitter','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','sendMessageOneNotActive','paused','message','CAMPAIGN_STATUS','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','syncCampaigns','hasOwnProperty','preview','dialMethod','type','outbound','dialActive','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','originated','pTalking:\x20','pTalking','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','prototype','recallMe','agentReadyId','agents','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','[RecallMe]','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','loggedIn','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','verifyAdditionalPhones','additional','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','idContact','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','acw','mandatoryDisposition','custom:agentConnectPreview','complete','outboundAnswerCallsDay','total','answered','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact','scheduledAt','swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','callAdditionalPhoneAfterMin','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','outboundCongestionCallsDay','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','decrementTalking','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','reason','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','Calling','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','unmonitored','execRun','recallme','validateContact','isValid','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','dialOriginateCallerIdName','originatecalleridname','originatecalleridnum','extractCalleridNumber','setXMDContactVariables','assign','merge'];(function(_0x5b0413,_0x3f4093){var _0x2b9b26=function(_0x58669e){while(--_0x58669e){_0x5b0413['push'](_0x5b0413['shift']());}};_0x2b9b26(++_0x3f4093);}(_0x4a0d,0x14f));var _0xd4a0=function(_0x53080e,_0x252127){_0x53080e=_0x53080e-0x0;var _0x1a0c14=_0x4a0d[_0x53080e];return _0x1a0c14;};'use strict';var util=require(_0xd4a0('0x0'));var _=require('lodash');var uuid=require(_0xd4a0('0x1'));var moment=require(_0xd4a0('0x2'));var Redis=require(_0xd4a0('0x3'));var config=require(_0xd4a0('0x4'));var logger=require(_0xd4a0('0x5'))('preview');var loggerAction=require(_0xd4a0('0x5'))(_0xd4a0('0x6'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xd4a0('0x7'));var Action=require(_0xd4a0('0x8'));var ut=require(_0xd4a0('0x9'));var utils=require('../dialer/utils');config['redis']=_[_0xd4a0('0xa')](config[_0xd4a0('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xd4a0('0xc'))(new Redis(config[_0xd4a0('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x5bb9d7){this[_0xd4a0('0xd')]=this[_0xd4a0('0xd')]?this[_0xd4a0('0xd')]['finally'](_0x5bb9d7):_0x5bb9d7();};function Preview(_0x3304e8){this[_0xd4a0('0xe')]=new Sequence();this[_0xd4a0('0xf')]=_0x3304e8[_0xd4a0('0x10')];this[_0xd4a0('0x11')]=_0x3304e8[_0xd4a0('0x11')];this[_0xd4a0('0x12')]={};this['agents']=_0x3304e8['agents'];this[_0xd4a0('0x13')]=0x0;ami['on']('originateresponse',this[_0xd4a0('0x14')][_0xd4a0('0x15')](this));ami['on'](_0xd4a0('0x16'),this[_0xd4a0('0x17')][_0xd4a0('0x15')](this));ami['on'](_0xd4a0('0x18'),this[_0xd4a0('0x19')][_0xd4a0('0x15')](this));ami['on'](_0xd4a0('0x1a'),this[_0xd4a0('0x1b')][_0xd4a0('0x15')](this));ami['on'](_0xd4a0('0x1c'),this[_0xd4a0('0x1d')][_0xd4a0('0x15')](this));ami['on'](_0xd4a0('0x1e'),this[_0xd4a0('0x1f')][_0xd4a0('0x15')](this));ami['on']('attendedtransfer',this[_0xd4a0('0x20')][_0xd4a0('0x15')](this));ami['on'](_0xd4a0('0x21'),this['syncBlindTransfer']['bind'](this));this[_0xd4a0('0x22')](this[_0xd4a0('0xf')]);}function emit(_0x4a709a,_0x365db9,_0x24f1dd){io['to'](_0x4a709a)[_0xd4a0('0x23')](_0x365db9,_0x24f1dd);}function emitVoiceQueueChannelRemove(_0x21c07d){logger[_0xd4a0('0x24')](_0xd4a0('0x25'),JSON[_0xd4a0('0x26')](_0x21c07d));emit(util[_0xd4a0('0x27')](_0xd4a0('0x28'),_0x21c07d[_0xd4a0('0x29')]),_0xd4a0('0x2a'),_0x21c07d);io[_0xd4a0('0x23')]('voice_queue_presence:remove',_0x21c07d);}function notSendMessagesQueue(_0x4950eb){if(_0x4950eb[_0xd4a0('0x2b')]){if(_0x4950eb['originated']===0x0&&_0x4950eb['pTalking']===0x0){_0x4950eb[_0xd4a0('0x2b')]=![];_0x4950eb['available']=0x0;_0x4950eb[_0xd4a0('0x2c')]=0x0;_0x4950eb[_0xd4a0('0x2d')]=utils[_0xd4a0('0x2e')]['INACTIVE'];ut[_0xd4a0('0x2f')](_0xd4a0('0x30'),_0x4950eb[_0xd4a0('0x29')]+'\x20is\x20not\x20active');}else{_0x4950eb[_0xd4a0('0x2d')]=utils['CAMPAIGN_STATUS'][_0xd4a0('0x31')];ut['logger'](_0xd4a0('0x30'),_0x4950eb[_0xd4a0('0x29')]+'\x20is\x20deactivated');}}}Preview['prototype']['loopCampaigns']=function(){var _0x46eb6e=this;setInterval(function(){_0x46eb6e[_0xd4a0('0x32')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x154ebb=this[_0xd4a0('0xf')];this[_0xd4a0('0x13')]+=0x1;for(var _0x499e1b in _0x154ebb){if(_0x154ebb[_0xd4a0('0x33')](_0x499e1b)&&(_0x154ebb[_0x499e1b]['dialMethod']===_0xd4a0('0x34')||_0x154ebb[_0x499e1b][_0xd4a0('0x35')]==='booked')&&_0x154ebb[_0x499e1b][_0xd4a0('0x36')]===_0xd4a0('0x37')){if(this[_0xd4a0('0x13')]>0x7){this[_0xd4a0('0x13')]=0x0;this['clearZombieChannels']();}}if(_0x154ebb[_0xd4a0('0x33')](_0x499e1b)&&_0x154ebb[_0x499e1b][_0xd4a0('0x35')]===_0xd4a0('0x34')&&_0x154ebb[_0x499e1b][_0xd4a0('0x36')]==='outbound'){if(_0x154ebb[_0x499e1b][_0xd4a0('0x38')]){this[_0xd4a0('0x39')](_0x154ebb[_0x499e1b]);if(_0x154ebb[_0x499e1b][_0xd4a0('0x3a')])this['recallMe'](_0x154ebb[_0x499e1b]);}else{notSendMessagesQueue(_0x154ebb[_0x499e1b]);}}}};Preview['prototype'][_0xd4a0('0x3b')]=function(_0x115fd2){var _0x2cdb38=this;this[_0xd4a0('0xe')]['enqueue'](function(){if(!_[_0xd4a0('0x3c')](_0x2cdb38[_0xd4a0('0x12')][_0x115fd2])){loggerAction[_0xd4a0('0x24')](_0xd4a0('0x3d'),_0x115fd2,_0xd4a0('0x3e'),_0x2cdb38[_0xd4a0('0x12')][_0x115fd2][_0xd4a0('0x3f')],_0xd4a0('0x40'),JSON['stringify'](_0x2cdb38[_0xd4a0('0xf')][_0x2cdb38[_0xd4a0('0x12')][_0x115fd2][_0xd4a0('0x3f')]][_0xd4a0('0x41')]),_0xd4a0('0x42'),JSON[_0xd4a0('0x26')](_0x2cdb38[_0xd4a0('0xf')][_0x2cdb38[_0xd4a0('0x12')][_0x115fd2]['queue']][_0xd4a0('0x43')]),JSON[_0xd4a0('0x26')](_0x2cdb38['actions'][_0x115fd2][_0xd4a0('0x44')]),JSON[_0xd4a0('0x26')](_[_0xd4a0('0x45')](_0x2cdb38[_0xd4a0('0x12')][_0x115fd2],[_0xd4a0('0x46'),_0xd4a0('0x47'),_0xd4a0('0x48'),_0xd4a0('0x49')])));return ami[_0xd4a0('0x4a')]({'action':_0xd4a0('0x4b'),'channel':_0x2cdb38[_0xd4a0('0x12')][_0x115fd2][_0xd4a0('0x4c')]})[_0xd4a0('0x4d')](function(_0x2b2135){if(_0x2b2135['message']===_0xd4a0('0x4e')){setTimeout(function(){if(_0x2cdb38[_0xd4a0('0x12')][_0x115fd2]){utils[_0xd4a0('0x4f')](_0x2cdb38[_0xd4a0('0xf')][_0x2cdb38['actions'][_0x115fd2]['queue']],'[clearZombieChannel]');if(_0x2cdb38['actions'][_0x115fd2]['dialAnswer']===!![]){ut['decrementTalking'](_0x2cdb38[_0xd4a0('0xf')][_0x2cdb38[_0xd4a0('0x12')][_0x115fd2]['queue']],_0xd4a0('0x50'));ut['loggerError'](_0xd4a0('0x51')+_0x115fd2,_0x2cdb38[_0xd4a0('0x12')][_0x115fd2][_0xd4a0('0x3f')]);}ut[_0xd4a0('0x52')](_0xd4a0('0x53')+_0x115fd2,_0x2cdb38[_0xd4a0('0x12')][_0x115fd2][_0xd4a0('0x3f')]);delete _0x2cdb38[_0xd4a0('0x12')][_0x115fd2];}},0x2328);}});}});};Preview['prototype'][_0xd4a0('0x54')]=function(){var _0x1fa050=this;loggerAction[_0xd4a0('0x24')]('[action]',_['size'](this[_0xd4a0('0x12')]));for(var _0x1e8694 in this[_0xd4a0('0x12')]){if(_0x1fa050[_0xd4a0('0x12')][_0xd4a0('0x33')](_0x1e8694)){_0x1fa050[_0xd4a0('0x3b')](_0x1e8694);}}};Preview[_0xd4a0('0x55')][_0xd4a0('0x56')]=function(_0x545a6a){var _0x1a09d1=this;rpcDb['getContactRecallMe'](_0x545a6a['id'],ut[_0xd4a0('0x57')](this[_0xd4a0('0x58')]))[_0xd4a0('0x59')](function(_0x450102){if(!_[_0xd4a0('0x3c')](_0x450102)){for(var _0x121c04=0x0;_0x121c04<_0x450102[_0xd4a0('0x5a')];_0x121c04+=0x1){if(ut['getDiff'](_0x450102[_0x121c04][_0xd4a0('0x5b')])<_0x545a6a[_0xd4a0('0x5c')]*0x3c){if(_0x450102[_0x121c04][_0xd4a0('0x5d')]&&!_0x450102[_0x121c04][_0xd4a0('0x5d')][_0xd4a0('0x5e')]){_0x1a09d1['run'](_0x450102[_0x121c04]['id'])[_0xd4a0('0x59')](ut['logger2'](_0xd4a0('0x5f')))[_0xd4a0('0x4d')](ut[_0xd4a0('0x60')](_0xd4a0('0x5f')));}else{rpcDb[_0xd4a0('0x61')](_0x450102[_0x121c04]['id']);}}else{var _0x2f4c28=new Action(_0x450102[_0x121c04],_0x545a6a);_0x2f4c28[_0xd4a0('0x62')]=moment()[_0xd4a0('0x27')](_0xd4a0('0x63'));_0x545a6a[_0xd4a0('0x64')]+=0x1;ut[_0xd4a0('0x65')](_0x2f4c28,0x17,_0xd4a0('0x66'));if(_0x545a6a[_0xd4a0('0x67')]){rpcDb[_0xd4a0('0x68')](ut['createBody'](_0x450102[_0x121c04]));rpcDb['createCustomerHistory'](_0x2f4c28,_0xd4a0('0x69'));}else{ut['logCustomer'](_0x2f4c28,0x16,_0xd4a0('0x6a'));rpcDb[_0xd4a0('0x6b')](_0x2f4c28,_0xd4a0('0x6c'));rpcDb[_0xd4a0('0x6d')](_0x2f4c28,_0xd4a0('0x6c'));}}}}})[_0xd4a0('0x4d')](ut[_0xd4a0('0x60')]('[getContactRecallMe]'));};Preview[_0xd4a0('0x55')][_0xd4a0('0x39')]=function(_0x45f71d){_0x45f71d[_0xd4a0('0x2b')]=!![];if(ut[_0xd4a0('0x6e')](_0x45f71d[_0xd4a0('0x6f')])){_0x45f71d[_0xd4a0('0x2d')]=utils[_0xd4a0('0x2e')]['NO_AGENTS_LOGGED'];}else if(!ut[_0xd4a0('0x70')](_0x45f71d[_0xd4a0('0x38')])){_0x45f71d[_0xd4a0('0x2d')]=utils[_0xd4a0('0x2e')]['INACTIVE'];}else if(!this[_0xd4a0('0x71')](_0x45f71d[_0xd4a0('0x72')])){if(!this[_0xd4a0('0x71')](_0x45f71d[_0xd4a0('0x73')])){_0x45f71d['message']=utils['CAMPAIGN_STATUS'][_0xd4a0('0x74')];}else{_0x45f71d['message']=utils[_0xd4a0('0x2e')][_0xd4a0('0x75')];}}else{_0x45f71d['message']=utils[_0xd4a0('0x2e')][_0xd4a0('0x75')];}};Preview['prototype'][_0xd4a0('0x76')]=function(_0x173053,_0x8c9aaf,_0x496e53){var _0x40c9c3=this;var _0x40d6a8=this[_0xd4a0('0x12')][_0x8c9aaf];var _0x9a1faa=this[_0xd4a0('0xf')][_0x40d6a8['queue']];var _0x2881a3;var _0x338409=![];var _0x35f2df=0x2;var _0x1f6236=0x3;if(_0x9a1faa){switch(_0x496e53){case'1':_0x9a1faa[_0xd4a0('0x77')]+=0x1;_0x40d6a8[_0xd4a0('0x78')]+=0x1;_0x40d6a8[_0xd4a0('0x79')]=ut[_0xd4a0('0x7a')](_0x40d6a8);ut['logCustomer'](_0x40d6a8,0x0,_0xd4a0('0x7b'));ami[_0xd4a0('0x23')]('custom:agentnosuchnumber',ut[_0xd4a0('0x7c')](_0x40d6a8,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x40d6a8,'[callProgressDetectingCustomer][logNoSuch]');_0x40c9c3[_0xd4a0('0x7d')](_0x40d6a8,'0',_0x9a1faa)[_0xd4a0('0x59')](function(_0x878f91){_0x338409=_0x878f91[_0xd4a0('0x7e')]==0x1;_0x35f2df=_0x9a1faa['dialNoSuchNumberRetryFrequency'];_0x1f6236=_0x9a1faa['callAdditionalPhoneAfterMin'];if(!_0x338409){if(ut[_0xd4a0('0x7a')](_0x40d6a8)>=_0x9a1faa[_0xd4a0('0x7f')]){_0x2881a3=ut[_0xd4a0('0x80')](_0x40d6a8,0xf,'Global');rpcDb[_0xd4a0('0x6d')](_0x2881a3,_0xd4a0('0x81'));}else{if(_0x40d6a8[_0xd4a0('0x78')]>=_0x9a1faa[_0xd4a0('0x82')]){rpcDb[_0xd4a0('0x6d')](_0x40d6a8,_0xd4a0('0x81'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x40d6a8,_0xd4a0('0x78'),_0x9a1faa[_0xd4a0('0x83')]),_0x40d6a8[_0xd4a0('0x84')],_0x40d6a8[_0xd4a0('0x85')]);}}delete this[_0xd4a0('0x12')][_0x173053[_0xd4a0('0x86')]];}else{_0x40d6a8[_0xd4a0('0x78')]++;logger[_0xd4a0('0x24')](_0xd4a0('0x87'),_0x40d6a8['countnosuchnumberretry']);logger[_0xd4a0('0x24')]('id',_0x40d6a8['idContact']);_0x40c9c3[_0xd4a0('0x88')]({'id':_0x40d6a8[_0xd4a0('0x89')],'field':{'countnosuchnumberretry':_0x40d6a8[_0xd4a0('0x78')]}})[_0xd4a0('0x59')](function(){_0x40c9c3['swapAdditionalPhones'](_0x40d6a8,_0x35f2df,_0x1f6236)[_0xd4a0('0x59')](function(){});});}});break;case _0xd4a0('0x8a'):var _0x30241a=moment()['format'](_0xd4a0('0x63'));_0x40d6a8[_0xd4a0('0x8b')]=_0x30241a;_0x40d6a8[_0xd4a0('0x8c')]=_0x30241a;_0x40d6a8[_0xd4a0('0x44')]=!![];_0x9a1faa[_0xd4a0('0x43')]+=0x1;logger[_0xd4a0('0x24')](_0xd4a0('0x8d'),_0x40d6a8[_0xd4a0('0x8e')],_0xd4a0('0x8f'),_0x9a1faa[_0xd4a0('0x29')],_0xd4a0('0x42'),_0x9a1faa[_0xd4a0('0x43')]);ami['emit'](_0xd4a0('0x90'),ut[_0xd4a0('0x7c')](_0x40d6a8,'connect',this[_0xd4a0('0xf')][_0x40d6a8['queue']]));if(_0x9a1faa[_0xd4a0('0x91')]||_0x9a1faa[_0xd4a0('0x92')]){ami[_0xd4a0('0x23')](_0xd4a0('0x93'),{'queue':_0x40d6a8['queue'],'interface':_0x40d6a8['channelAgent'],'uniqueid':_0x40d6a8[_0xd4a0('0x8e')]});}break;case'16':ami['emit']('custom:agentcomplete',ut[_0xd4a0('0x7c')](_0x40d6a8,_0xd4a0('0x94'),this[_0xd4a0('0xf')][_0x40d6a8[_0xd4a0('0x3f')]]));emitVoiceQueueChannelRemove(ut[_0xd4a0('0x7c')](_0x40d6a8,_0xd4a0('0x94')));_0x9a1faa[_0xd4a0('0x95')]+=0x1;_0x9a1faa[_0xd4a0('0x96')]+=0x1;_0x9a1faa[_0xd4a0('0x97')]+=0x1;ut['decrementTalking'](_0x9a1faa,'[16]');_0x40d6a8[_0xd4a0('0x79')]=ut[_0xd4a0('0x7a')](_0x40d6a8);ut[_0xd4a0('0x65')](_0x40d6a8,0x4,_0xd4a0('0x98'));rpcDb[_0xd4a0('0x6b')](_0x40d6a8,_0xd4a0('0x99'));rpcDb[_0xd4a0('0x6d')](_0x40d6a8,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xd4a0('0x9a')](_0x40d6a8);_0x9a1faa[_0xd4a0('0x9b')]+=_0x40d6a8[_0xd4a0('0x9c')];_0x9a1faa['sumBillable']+=_0x40d6a8[_0xd4a0('0x9c')];logger[_0xd4a0('0x24')](_0xd4a0('0x9d'),_0x40d6a8[_0xd4a0('0x8e')],_0xd4a0('0x8f'),_0x9a1faa[_0xd4a0('0x29')],_0xd4a0('0x42'),_0x9a1faa[_0xd4a0('0x43')]);delete this['actions'][_0x173053[_0xd4a0('0x86')]];break;case _0xd4a0('0x9e'):_0x9a1faa['outboundBusyCallsDay']+=0x1;_0x40d6a8['countbusyretry']+=0x1;_0x40d6a8[_0xd4a0('0x79')]=ut['totalGlobal'](_0x40d6a8);ut[_0xd4a0('0x65')](_0x40d6a8,0x5,'Busy');_0x35f2df=_0x9a1faa[_0xd4a0('0x9f')];_0x1f6236=_0x9a1faa['callAdditionalPhoneAfterMin'];ami[_0xd4a0('0x23')]('custom:agentbusy',ut['buildObj'](_0x40d6a8,_0xd4a0('0xa0')));rpcDb[_0xd4a0('0x6b')](_0x40d6a8,_0xd4a0('0xa1'));_0x40c9c3[_0xd4a0('0x7d')](_0x40d6a8,'5',_0x9a1faa)['then'](function(_0x442b8e){_0x338409=_0x442b8e[_0xd4a0('0x7e')]==0x1;if(!_0x338409){if(ut['totalGlobal'](_0x40d6a8)>=_0x9a1faa[_0xd4a0('0x7f')]){_0x2881a3=ut['cloneAction'](_0x40d6a8,0xf,_0xd4a0('0xa2'));rpcDb['createCustomerFinal'](_0x2881a3,_0xd4a0('0xa3'));}else{if(_0x40d6a8[_0xd4a0('0xa4')]>=_0x9a1faa[_0xd4a0('0xa5')]){rpcDb[_0xd4a0('0x6d')](_0x40d6a8,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xd4a0('0xa6')](ut[_0xd4a0('0xa7')](_0x40d6a8,'countbusyretry',_0x9a1faa[_0xd4a0('0x9f')]),_0x40d6a8[_0xd4a0('0x84')],_0x40d6a8['activeContact']);}}}else{_0x40d6a8[_0xd4a0('0xa4')]++;_0x40c9c3[_0xd4a0('0x88')]({'id':_0x40d6a8[_0xd4a0('0x89')],'field':{'countbusyretry':_0x40d6a8[_0xd4a0('0xa4')]}})[_0xd4a0('0x59')](function(){_0x40c9c3[_0xd4a0('0xa8')](_0x40d6a8,_0x35f2df,_0x1f6236)[_0xd4a0('0x59')](function(){});});}});break;case _0xd4a0('0xa9'):_0x9a1faa[_0xd4a0('0xaa')]+=0x1;_0x40d6a8[_0xd4a0('0xab')]+=0x1;_0x40d6a8[_0xd4a0('0x79')]=ut['totalGlobal'](_0x40d6a8);ut[_0xd4a0('0x65')](_0x40d6a8,0x3,_0xd4a0('0xac'));_0x35f2df=_0x9a1faa[_0xd4a0('0xad')];_0x1f6236=_0x9a1faa[_0xd4a0('0xae')];var _0x4a1617=ut['buildNoAnswerEventPayload'](_0x40d6a8,_0x9a1faa);ami[_0xd4a0('0x23')](_0xd4a0('0xaf'),_0x4a1617);rpcDb[_0xd4a0('0x6b')](_0x40d6a8,'[callProgressDetectingCustomer][logNoAnswer]');_0x40c9c3['verifyAdditionalPhones'](_0x40d6a8,'3',_0x9a1faa)[_0xd4a0('0x59')](function(_0x1c22d2){_0x338409=_0x1c22d2[_0xd4a0('0x7e')]==0x1;if(!_0x338409){if(ut[_0xd4a0('0x7a')](_0x40d6a8)>=_0x9a1faa[_0xd4a0('0x7f')]){_0x2881a3=ut[_0xd4a0('0x80')](_0x40d6a8,0xf,_0xd4a0('0xa2'));rpcDb[_0xd4a0('0x6d')](_0x2881a3,_0xd4a0('0xb0'));}else{if(_0x40d6a8[_0xd4a0('0xab')]>=_0x9a1faa[_0xd4a0('0xb1')]){rpcDb[_0xd4a0('0x6d')](_0x40d6a8,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xd4a0('0xa6')](ut[_0xd4a0('0xa7')](_0x40d6a8,'countnoanswerretry',_0x9a1faa[_0xd4a0('0xad')]),_0x40d6a8['unlockAgent'],_0x40d6a8[_0xd4a0('0x85')]);}}}else{_0x40d6a8[_0xd4a0('0xab')]++;_0x40c9c3[_0xd4a0('0x88')]({'id':_0x40d6a8[_0xd4a0('0x89')],'field':{'countnoanswerretry':_0x40d6a8[_0xd4a0('0xab')]}})[_0xd4a0('0x59')](function(){_0x40c9c3['swapAdditionalPhones'](_0x40d6a8,_0x35f2df,_0x1f6236)['then'](function(){});});}});break;case'CONGESTION':_0x9a1faa[_0xd4a0('0xb2')]+=0x1;_0x40d6a8[_0xd4a0('0xb3')]+=0x1;_0x40d6a8['countglobal']=ut[_0xd4a0('0x7a')](_0x40d6a8);ut[_0xd4a0('0x65')](_0x40d6a8,0x8,'Congestion');_0x35f2df=_0x9a1faa[_0xd4a0('0xb4')];_0x1f6236=_0x9a1faa[_0xd4a0('0xae')];ami[_0xd4a0('0x23')](_0xd4a0('0xb5'),ut[_0xd4a0('0x7c')](_0x40d6a8,_0xd4a0('0xb6')));rpcDb[_0xd4a0('0x6b')](_0x40d6a8,_0xd4a0('0xb7'));_0x40c9c3['verifyAdditionalPhones'](_0x40d6a8,'8',_0x9a1faa)[_0xd4a0('0x59')](function(_0x2d1b13){_0x338409=_0x2d1b13[_0xd4a0('0x7e')]==0x1;if(!_0x338409){if(ut['totalGlobal'](_0x40d6a8)>=_0x9a1faa[_0xd4a0('0x7f')]){_0x2881a3=ut[_0xd4a0('0x80')](_0x40d6a8,0xf,_0xd4a0('0xa2'));rpcDb[_0xd4a0('0x6d')](_0x2881a3,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x40d6a8[_0xd4a0('0xb3')]>=_0x9a1faa[_0xd4a0('0xb8')]){rpcDb[_0xd4a0('0x6d')](_0x40d6a8,_0xd4a0('0xb7'));}else{rpcDb[_0xd4a0('0xa6')](ut[_0xd4a0('0xa7')](_0x40d6a8,_0xd4a0('0xb3'),_0x9a1faa[_0xd4a0('0x9f')]),_0x40d6a8['unlockAgent'],_0x40d6a8['activeContact']);}}}else{_0x40d6a8[_0xd4a0('0xb3')]++;_0x40c9c3[_0xd4a0('0x88')]({'id':_0x40d6a8[_0xd4a0('0x89')],'field':{'countcongestionretry':_0x40d6a8[_0xd4a0('0xb3')]}})['then'](function(){_0x40c9c3['swapAdditionalPhones'](_0x40d6a8,_0x35f2df,_0x1f6236)['then'](function(){});});}});break;case _0xd4a0('0xb9'):_0x9a1faa['outboundRejectCallsDay']+=0x1;_0x40d6a8[_0xd4a0('0xba')]+=0x1;_0x40d6a8[_0xd4a0('0x79')]=ut[_0xd4a0('0x7a')](_0x40d6a8);ut[_0xd4a0('0x65')](_0x40d6a8,0x14,'AgentReject');_0x35f2df=_0x9a1faa[_0xd4a0('0xbb')];_0x1f6236=_0x9a1faa['callAdditionalPhoneAfterMin'];ami['emit'](_0xd4a0('0xbc'),ut[_0xd4a0('0x7c')](_0x40d6a8,'agentreject'));rpcDb[_0xd4a0('0x6b')](_0x40d6a8,'[syncHangupRequest][logAgentReject]');_0x40c9c3['verifyAdditionalPhones'](_0x40d6a8,'20',_0x9a1faa)[_0xd4a0('0x59')](function(_0x34ba2a){_0x338409=_0x34ba2a['additional']==0x1;if(!_0x338409){if(ut[_0xd4a0('0x7a')](_0x40d6a8)>=_0x9a1faa['dialGlobalMaxRetry']){_0x2881a3=ut[_0xd4a0('0x80')](_0x40d6a8,0x14,_0xd4a0('0xbd'));rpcDb['createCustomerFinal'](_0x2881a3,_0xd4a0('0xbe'));}else{if(_0x40d6a8[_0xd4a0('0xba')]>=_0x9a1faa[_0xd4a0('0xbf')]){rpcDb[_0xd4a0('0x6d')](_0x40d6a8,_0xd4a0('0xbe'));}else{rpcDb[_0xd4a0('0xa6')](ut[_0xd4a0('0xa7')](_0x40d6a8,_0xd4a0('0xba'),_0x9a1faa[_0xd4a0('0xbb')]),_0x40d6a8[_0xd4a0('0x84')],_0x40d6a8[_0xd4a0('0x85')]);}}}else{_0x40d6a8[_0xd4a0('0xab')]++;_0x40c9c3['incrementPreviewCounters']({'id':_0x40d6a8[_0xd4a0('0x89')],'field':{'countnoanswerretry':_0x40d6a8[_0xd4a0('0xab')]}})['then'](function(){_0x40c9c3[_0xd4a0('0xa8')](_0x40d6a8,_0x35f2df,_0x1f6236)['then'](function(){});});}});break;case _0xd4a0('0xc0'):_0x9a1faa[_0xd4a0('0xc1')]+=0x1;_0x40d6a8[_0xd4a0('0xc2')]+=0x1;_0x40d6a8[_0xd4a0('0x79')]=ut[_0xd4a0('0x7a')](_0x40d6a8);ut['logCustomer'](_0x40d6a8,0xb,_0xd4a0('0xc3'));rpcDb[_0xd4a0('0x6b')](_0x40d6a8,_0xd4a0('0xc4'));_0x40c9c3['verifyAdditionalPhones'](_0x40d6a8,'11',_0x9a1faa)['then'](function(_0x5258a5){_0x338409=_0x5258a5['additional']==0x1;if(!_0x338409){if(ut[_0xd4a0('0x7a')](_0x40d6a8)>=_0x9a1faa[_0xd4a0('0x7f')]){_0x2881a3=ut[_0xd4a0('0x80')](_0x40d6a8,0xf,'Global');rpcDb[_0xd4a0('0x6d')](_0x2881a3,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x40d6a8['countabandonedetry']>=_0x9a1faa[_0xd4a0('0xc5')]){rpcDb[_0xd4a0('0x6d')](_0x40d6a8,_0xd4a0('0xc4'));}else{rpcDb[_0xd4a0('0xa6')](ut[_0xd4a0('0xa7')](_0x40d6a8,_0xd4a0('0xc2'),_0x9a1faa['dialAbandonedRetryFrequency']),_0x40d6a8[_0xd4a0('0x84')],_0x40d6a8[_0xd4a0('0x85')]);}}}else{_0x40d6a8[_0xd4a0('0xab')]++;_0x40c9c3[_0xd4a0('0x88')]({'id':_0x40d6a8[_0xd4a0('0x89')],'field':{'countnoanswerretry':_0x40d6a8[_0xd4a0('0xab')]}})[_0xd4a0('0x59')](function(){_0x40c9c3[_0xd4a0('0xa8')](_0x40d6a8,_0x35f2df,_0x1f6236)[_0xd4a0('0x59')](function(){});});}});break;case'18':_0x9a1faa[_0xd4a0('0xc6')]+=0x1;_0x40d6a8[_0xd4a0('0xc7')]+=0x1;_0x40d6a8[_0xd4a0('0x79')]=ut[_0xd4a0('0x7a')](_0x40d6a8);ut['logCustomer'](_0x40d6a8,0x12,_0x173053[_0xd4a0('0xc8')]||_0x173053[_0xd4a0('0xc9')]);ami[_0xd4a0('0x23')]('custom:amd',ut[_0xd4a0('0x7c')](_0x40d6a8,_0xd4a0('0xca')));rpcDb[_0xd4a0('0x6b')](_0x40d6a8,'[callProgressDetectingCustomer][hangupInAMD]');_0x40c9c3[_0xd4a0('0x7d')](_0x40d6a8,'18',_0x9a1faa)['then'](function(_0x9dacc){_0x338409=_0x9dacc[_0xd4a0('0x7e')]==0x1;if(!_0x338409){if(ut[_0xd4a0('0x7a')](_0x40d6a8)>=_0x9a1faa[_0xd4a0('0x7f')]){_0x2881a3=ut[_0xd4a0('0x80')](_0x40d6a8,0x12,_0xd4a0('0xa2'));rpcDb[_0xd4a0('0x6d')](_0x2881a3,_0xd4a0('0xcb'));}else{rpcDb[_0xd4a0('0x6d')](_0x40d6a8,_0xd4a0('0xcb'));}}else{_0x40d6a8[_0xd4a0('0xab')]++;_0x40c9c3[_0xd4a0('0x88')]({'id':_0x40d6a8[_0xd4a0('0x89')],'field':{'countnoanswerretry':_0x40d6a8[_0xd4a0('0xab')]}})[_0xd4a0('0x59')](function(){_0x40c9c3['swapAdditionalPhones'](_0x40d6a8,_0x35f2df,_0x1f6236)[_0xd4a0('0x59')](function(){});});}});delete this[_0xd4a0('0x12')][_0x173053[_0xd4a0('0x86')]];break;case'19':_0x9a1faa['outboundUnknownCallsDay']+=0x1;_0x40d6a8[_0xd4a0('0x79')]=ut[_0xd4a0('0x7a')](_0x40d6a8);ut['logCustomer'](_0x40d6a8,0x13,_0x173053[_0xd4a0('0xc8')]||_0x173053['dialstatus']);ami[_0xd4a0('0x23')](_0xd4a0('0xcc'),ut[_0xd4a0('0x7c')](_0x40d6a8,_0xd4a0('0xca')));rpcDb[_0xd4a0('0x6b')](_0x40d6a8,'[callProgressDetectingCustomer][machine]');_0x40c9c3[_0xd4a0('0x7d')](_0x40d6a8,'18',_0x9a1faa)[_0xd4a0('0x59')](function(_0x34ccdc){_0x338409=_0x34ccdc['additional']==0x1;if(!_0x338409){if(ut[_0xd4a0('0x7a')](_0x40d6a8)>=_0x9a1faa[_0xd4a0('0x7f')]){_0x2881a3=ut['cloneAction'](_0x40d6a8,0xf,_0xd4a0('0xa2'));rpcDb['createCustomerFinal'](_0x2881a3,_0xd4a0('0xcd'));}else{rpcDb[_0xd4a0('0x6d')](_0x40d6a8,_0xd4a0('0xcd'));}}else{_0x40d6a8['countnoanswerretry']++;_0x40c9c3[_0xd4a0('0x88')]({'id':_0x40d6a8[_0xd4a0('0x89')],'field':{'countnoanswerretry':_0x40d6a8['countnoanswerretry']}})[_0xd4a0('0x59')](function(){_0x40c9c3['swapAdditionalPhones'](_0x40d6a8,_0x35f2df,_0x1f6236)[_0xd4a0('0x59')](function(){});});}});delete this[_0xd4a0('0x12')][_0x173053[_0xd4a0('0x86')]];break;default:if(_0x40d6a8[_0xd4a0('0x44')]){ut[_0xd4a0('0xce')](_0x9a1faa,_0xd4a0('0xcf'));ut['loggerError'](_0xd4a0('0xd0')+_0x9a1faa[_0xd4a0('0x29')],_0x173053);}_0x9a1faa['outboundUnknownCallsDay']+=0x1;_0x40d6a8[_0xd4a0('0x79')]=ut[_0xd4a0('0x7a')](_0x40d6a8);ut['logCustomer'](_0x40d6a8,0xc,_0x173053[_0xd4a0('0xc8')]||_0x173053['dialstatus']);_0x35f2df=_0x9a1faa['dialAgentRejectRetryFrequency'];_0x1f6236=_0x9a1faa['callAdditionalPhoneAfterMin'];rpcDb[_0xd4a0('0x6b')](_0x40d6a8,_0xd4a0('0xd1'));_0x40c9c3[_0xd4a0('0x7d')](_0x40d6a8,'20',_0x9a1faa)[_0xd4a0('0x59')](function(_0x12290a){_0x338409=_0x12290a[_0xd4a0('0x7e')]==0x1;if(!_0x338409){if(ut[_0xd4a0('0x7a')](_0x40d6a8)>=_0x9a1faa[_0xd4a0('0x7f')]){_0x2881a3=ut[_0xd4a0('0x80')](_0x40d6a8,0xf,_0xd4a0('0xa2'));rpcDb[_0xd4a0('0x6d')](_0x2881a3,_0xd4a0('0xd2'));}else{rpcDb[_0xd4a0('0x6d')](_0x40d6a8,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xd4a0('0x12')][_0x173053[_0xd4a0('0x86')]];}else{_0x40c9c3[_0xd4a0('0xa8')](_0x40d6a8,_0x35f2df,_0x1f6236)['then'](function(){});}});}if(!(_0x40d6a8[_0xd4a0('0x44')]&&_0x496e53==='16')){utils['decrementOriginate'](_0x9a1faa,_0xd4a0('0xd3'));logger[_0xd4a0('0x24')](_0xd4a0('0xd4'),_0x40d6a8[_0xd4a0('0x8e')],_0xd4a0('0x8f'),_0x9a1faa['name'],_0xd4a0('0x40'),_0x9a1faa['originated']);}if(_0x496e53!==_0xd4a0('0x8a')){delete this[_0xd4a0('0x12')][_0x173053[_0xd4a0('0x86')]];delete this['actions'][_0x173053[_0xd4a0('0xd5')]];}_0x9a1faa[_0xd4a0('0xd6')]=!![];}};Preview[_0xd4a0('0x55')][_0xd4a0('0xd7')]=function(_0x22858e,_0x20b18e,_0xc16aca){if(_['isUndefined'](_0x20b18e)&&_0xd4a0('0xd8')!==typeof _0x20b18e){return;}if(_[_0xd4a0('0xd9')](_0xc16aca)&&_0xd4a0('0xd8')!==typeof _0xc16aca){return;}switch(_0xc16aca['reason']){case'0':ut[_0xd4a0('0xda')](_0x22858e,0x0,_0xd4a0('0x7b'));rpcDb['createAgentHistory'](_0x22858e,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xd4a0('0xda')](_0x22858e,0x3,'NoAnswer');rpcDb[_0xd4a0('0xdb')](_0x22858e,_0xd4a0('0xdc'));break;case'5':ut[_0xd4a0('0xda')](_0x22858e,0x5,_0xd4a0('0xdd'));rpcDb[_0xd4a0('0xdb')](_0x22858e,_0xd4a0('0xde'));break;case'8':ut[_0xd4a0('0xda')](_0x22858e,0x8,_0xd4a0('0xdf'));rpcDb[_0xd4a0('0xdb')](_0x22858e,_0xd4a0('0xe0'));break;case'22':ut['logAgent'](_0x22858e,0x16,_0xd4a0('0xe1'));rpcDb[_0xd4a0('0xdb')](_0x22858e,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xd4a0('0xda')](_0x22858e,0xc,_0xc16aca[_0xd4a0('0xe2')]);rpcDb[_0xd4a0('0xdb')](_0x22858e,_0xd4a0('0xe0'));}utils['decrementOriginate'](_0x20b18e,_0xd4a0('0xe3'));logger[_0xd4a0('0x24')]('[originated][decrement][callProgressDetectingAgent]',_0x22858e[_0xd4a0('0x8e')],_0xd4a0('0x8f'),_0x20b18e[_0xd4a0('0x29')],_0xd4a0('0x40'),_0x20b18e[_0xd4a0('0x41')]);delete this[_0xd4a0('0x12')][_0x22858e[_0xd4a0('0x8e')]];};Preview['prototype'][_0xd4a0('0x7d')]=function(_0x2f0641,_0x3273f9,_0x3311fc){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x2f0641,_0x3273f9,_0x3311fc)['catch'](logger[_0xd4a0('0x24')](_0xd4a0('0xe4')));};Preview[_0xd4a0('0x55')][_0xd4a0('0xa8')]=function(_0x286188,_0x35a63a,_0xa0ce3d){return cmHopperAdditionalPhone[_0xd4a0('0xa8')](_0x286188,_0x35a63a,_0xa0ce3d)[_0xd4a0('0x4d')](logger['info'](_0xd4a0('0xe5')));};Preview[_0xd4a0('0x55')]['incrementPreviewCounters']=function(_0x47a624){return Promise[_0xd4a0('0xe6')]()[_0xd4a0('0x59')](cmHopperAdditionalPhone[_0xd4a0('0x88')](_0x47a624))[_0xd4a0('0x4d')](logger['info'](_0xd4a0('0xe7')));};Preview['prototype'][_0xd4a0('0xe8')]=function(_0x118624,_0x2b6711,_0x46ec1e,_0x467468,_0x45a61c){var _0x21308d=this;return new Promise(function(_0x54ea6e,_0x269a3c){if(_[_0xd4a0('0x3c')](_0x2b6711)||_['isNil'](_0x2b6711[_0xd4a0('0xe9')])||_['isNil'](_0x2b6711[_0xd4a0('0xea')])||_[_0xd4a0('0x3c')](_0x2b6711[_0xd4a0('0x48')])){_0x269a3c(ut[_0xd4a0('0x2d')]('Contact\x20is\x20undefined',_0x467468,_0x45a61c));return;}var _0x5a100b=uuid['v4']();var _0x113d26=_0x21308d[_0xd4a0('0xf')][_0x2b6711[_0xd4a0('0x3e')][_0xd4a0('0x29')]];var _0x3f3ed9=_0x46ec1e?_0x21308d[_0xd4a0('0x58')][_0x46ec1e]['id']:undefined;_0x21308d[_0xd4a0('0x12')][_0x5a100b]=new Action(_0x2b6711,_0x113d26,_0x5a100b,_0x46ec1e,_0x3f3ed9);var _0x37bce3=_0x21308d['actions'][_0x5a100b];_0x37bce3[_0xd4a0('0x84')]=_0x467468;_0x37bce3[_0xd4a0('0x85')]=_0x45a61c;_0x37bce3[_0xd4a0('0xeb')]=_0x46ec1e;if(_['isEmpty'](_0x118624)){_0x21308d[_0xd4a0('0xec')](_0x37bce3,_0x113d26,_0x2b6711,_0x46ec1e)[_0xd4a0('0x59')](function(_0x139e03){logger['info'](_0xd4a0('0xed'),_0xd4a0('0xee')+_0x37bce3['queue']+_0xd4a0('0xef')+_0x37bce3[_0xd4a0('0x89')],JSON[_0xd4a0('0x26')](_0x139e03));ami['emit']('custom:agentcalled',ut[_0xd4a0('0x7c')](_0x37bce3,'called',_0x21308d[_0xd4a0('0xf')][_0x37bce3[_0xd4a0('0x3f')]]));_0x54ea6e(ut[_0xd4a0('0x2d')](_0xd4a0('0xf0')));})['catch'](function(_0x2d2ca1){ut[_0xd4a0('0x2f')]('[Preview][execCall][failure]',_0x2d2ca1);_0x269a3c(ut[_0xd4a0('0x2d')](_0xd4a0('0xf1'),_0x467468,_0x45a61c));});}else{_0x113d26[_0xd4a0('0xf2')]+=0x1;ut[_0xd4a0('0xf3')](_0x37bce3);rpcDb['createHistory'](_0x37bce3,_0xd4a0('0xf4'));delete _0x21308d['actions'][_0x5a100b];_0x269a3c(ut[_0xd4a0('0x2d')](_0xd4a0('0xf5'),_0x467468,_0x45a61c));}});};Preview[_0xd4a0('0x55')][_0xd4a0('0x71')]=function(_0x156668){return!_[_0xd4a0('0x3c')](_0x156668)&&!_['isNil'](_0x156668[_0xd4a0('0x29')])&&!_['isNil'](_0x156668[_0xd4a0('0xf6')])&&_0x156668[_0xd4a0('0xf6')]&&!_[_0xd4a0('0x3c')](this[_0xd4a0('0x11')][util['format'](_0xd4a0('0xf7'),_0x156668[_0xd4a0('0x29')])])&&!_[_0xd4a0('0x3c')](this['trunks'][util[_0xd4a0('0x27')]('SIP/%s',_0x156668[_0xd4a0('0x29')])][_0xd4a0('0x4b')])&&(this['trunks'][util[_0xd4a0('0x27')](_0xd4a0('0xf7'),_0x156668[_0xd4a0('0x29')])][_0xd4a0('0x4b')]==='reachable'||this['trunks'][util[_0xd4a0('0x27')]('SIP/%s',_0x156668[_0xd4a0('0x29')])][_0xd4a0('0x4b')]===_0xd4a0('0xf8'));};Preview[_0xd4a0('0x55')]['run']=function(_0x4ecd7a,_0x3605b0){return this['execRun'](_0x4ecd7a,_0x3605b0)['then'](function(_0x248b1d){return _[_0xd4a0('0x45')](_0x248b1d,[_0xd4a0('0x2d')]);})[_0xd4a0('0x4d')](function(_0x3e235c){if(_0x3e235c['unlock']){rpcDb['unlockContact'](_0x4ecd7a);}if(_0x3e235c[_0xd4a0('0xf6')]){rpcDb[_0xd4a0('0x61')](_0x4ecd7a);}throw _['pick'](_0x3e235c,[_0xd4a0('0x2d')]);});};Preview[_0xd4a0('0x55')][_0xd4a0('0xf9')]=function(_0x82343e,_0x55497b){var _0x124bb1=this;var _0x2ffb37,_0x26aa7c;return rpcDb['getContactPreview'](_0x82343e)[_0xd4a0('0x59')](function(_0x445576){if(!_['isNil'](_0x445576[0x0])){_0x26aa7c=_0x445576[0x0]['recallme']?![]:!![];_0x2ffb37=_0x445576[0x0][_0xd4a0('0xfa')]?!![]:![];_0x2ffb37=_0x55497b?!![]:_0x2ffb37;}var _0x5a297f=_0x124bb1[_0xd4a0('0xfb')](_0x445576);if(_0x5a297f[_0xd4a0('0xfc')]){rpcDb[_0xd4a0('0xfd')](_[_0xd4a0('0x45')](_0x445576[0x0],[_0xd4a0('0x48'),_0xd4a0('0xea')]))['then'](function(_0x400af4){_0x124bb1[_0xd4a0('0xe8')](_0x400af4,_0x445576[0x0],_0x55497b,_0x26aa7c,_0x2ffb37)[_0xd4a0('0x59')](function(_0x24837c){return _0x24837c;})[_0xd4a0('0x4d')](function(_0x1249b6){throw _0x1249b6;});})[_0xd4a0('0x4d')](function(_0x15c629){ut[_0xd4a0('0x2f')]('[Preview][checkIsBlackList]',_0x15c629);throw ut['message'](_0xd4a0('0xfe'),_0x26aa7c,_0x2ffb37);});}else{throw ut[_0xd4a0('0x2d')](_0x5a297f['message'],_0x26aa7c,_0x2ffb37);}})[_0xd4a0('0x4d')](function(_0x522606){ut['logger'](_0xd4a0('0xff'),_0x522606);throw ut[_0xd4a0('0x2d')](_0xd4a0('0xfe'),![],!![]);});};Preview[_0xd4a0('0x55')][_0xd4a0('0xfb')]=function(_0x4837b4){if(_['isNil'](_0x4837b4)||_['isEmpty'](_0x4837b4)||!_[_0xd4a0('0x3c')](_0x4837b4[0x0][_0xd4a0('0x5d')])&&_['isNil'](_0x4837b4[0x0][_0xd4a0('0x5d')][_0xd4a0('0x29')])){ut[_0xd4a0('0x2f')](_0xd4a0('0x100'),_0x4837b4);return{'isValid':![],'message':_0xd4a0('0x101')};}var _0x369288=this[_0xd4a0('0xf')][_0x4837b4[0x0][_0xd4a0('0x3e')][_0xd4a0('0x29')]];_0x369288[_0xd4a0('0x2d')]=utils['CAMPAIGN_STATUS'][_0xd4a0('0x75')];if(_['isNil'](_0x369288)){ut[_0xd4a0('0x2f')](_0xd4a0('0x102'),_0x369288);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xd4a0('0x71')](_0x369288[_0xd4a0('0x72')])){ut['logger'](_0xd4a0('0x103'),_0xd4a0('0x104')+_0x369288[_0xd4a0('0x29')]+_0xd4a0('0x105'));if(!this[_0xd4a0('0x71')](_0x369288['TrunkBackup'])){ut['logger'](_0xd4a0('0x103'),_0x369288[_0xd4a0('0x29')]+_0xd4a0('0x106'));return{'isValid':![],'message':_0xd4a0('0x107')};}}if(!ut[_0xd4a0('0x70')](_0x369288[_0xd4a0('0x38')])){ut[_0xd4a0('0x2f')]('[Preview][validateContact][Campaign\x20Active]',_0x369288[_0xd4a0('0x29')]+_0xd4a0('0x108'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x369288['name']+_0xd4a0('0x108')};}return{'isValid':!![],'message':_0xd4a0('0x109')};};Preview[_0xd4a0('0x55')][_0xd4a0('0xec')]=function(_0x53b4c7,_0x195810,_0x4d2e6f,_0x4cebf1){var _0x2212a7=this;return new Promise(function(_0x4cd926,_0x1aa8f8){var _0x5b88ba=_0x53b4c7[_0xd4a0('0x8e')];var _0x48370c=_0x2212a7[_0xd4a0('0x71')](_0x195810[_0xd4a0('0x72')])?util[_0xd4a0('0x27')](_0xd4a0('0x10a'),_0x195810[_0xd4a0('0x72')][_0xd4a0('0x29')],_[_0xd4a0('0x3c')](_0x195810[_0xd4a0('0x10b')])?'':_0x195810[_0xd4a0('0x10b')][_0xd4a0('0x10c')]()||'',_0x195810['dialCutDigit']>0x0?_0x4d2e6f[_0xd4a0('0xea')][_0xd4a0('0x10d')](_0x195810[_0xd4a0('0x10e')]):_0x4d2e6f[_0xd4a0('0xea')]):util[_0xd4a0('0x27')]('SIP/%s/%s%s',_[_0xd4a0('0x3c')](_0x195810[_0xd4a0('0x73')])?_0x195810[_0xd4a0('0x72')]['name']:_0x195810[_0xd4a0('0x73')]['name'],_[_0xd4a0('0x3c')](_0x195810[_0xd4a0('0x10b')])?'':_0x195810['dialPrefix']['trim']()||'',_0x195810[_0xd4a0('0x10e')]>0x0?_0x4d2e6f[_0xd4a0('0xea')][_0xd4a0('0x10d')](_0x195810[_0xd4a0('0x10e')]):_0x4d2e6f['phone']);var _0x56bb90=_0x2212a7[_0xd4a0('0x71')](_0x195810['Trunk'])?ut['getCallerId'](_0x195810[_0xd4a0('0x72')][_0xd4a0('0x10f')],_0x195810['dialOriginateCallerIdName'],_0x195810[_0xd4a0('0x110')]>0x0?ut[_0xd4a0('0x111')](_0x195810[_0xd4a0('0x112')],_0x195810[_0xd4a0('0x110')]):_0x195810[_0xd4a0('0x112')]):ut[_0xd4a0('0x113')](_[_0xd4a0('0x3c')](_0x195810[_0xd4a0('0x73')])?_0x195810['Trunk'][_0xd4a0('0x10f')]:_0x195810[_0xd4a0('0x73')][_0xd4a0('0x10f')],_0x195810[_0xd4a0('0x114')],_0x195810[_0xd4a0('0x110')]>0x0?ut[_0xd4a0('0x111')](_0x195810[_0xd4a0('0x112')],_0x195810[_0xd4a0('0x110')]):_0x195810[_0xd4a0('0x112')]);if(_0x56bb90){_0x53b4c7[_0xd4a0('0x115')]=ut['extractCalleridName'](_0x56bb90);_0x53b4c7[_0xd4a0('0x116')]=ut[_0xd4a0('0x117')](_0x56bb90);}var _0x3a6440=ut['addVariables'](_0x195810,_0x4d2e6f,_0x48370c,_0x56bb90,_0x5b88ba,_0x53b4c7);var _0x1819ab=utils[_0xd4a0('0x118')](_0x4d2e6f[_0xd4a0('0xe9')]);Object[_0xd4a0('0x119')](_0x3a6440,_0x1819ab);_[_0xd4a0('0x11a')](_0x53b4c7,ut[_0xd4a0('0x11b')](_0x3a6440));_0x53b4c7[_0xd4a0('0x62')]=moment()['format'](_0xd4a0('0x63'));_0x195810['variables']=_0x3a6440;var _0xf367a=ut['variablesAction'](_0x53b4c7,_0x195810,_0x3a6440,_0x53b4c7[_0xd4a0('0x85')],_0x4cebf1);return ami[_0xd4a0('0x4a')](_0xf367a)['then'](function(_0x755838){_0x195810[_0xd4a0('0x41')]+=0x1;logger[_0xd4a0('0x24')]('[originated][increment]',_0x5b88ba,_0xd4a0('0x8f'),_0x195810[_0xd4a0('0x29')],_0xd4a0('0x40'),_0x195810['originated']);_0x4cd926(_0x755838);})[_0xd4a0('0x4d')](function(_0x3cd123){ut[_0xd4a0('0xda')](_0x53b4c7,0xe,_0xd4a0('0x11c'));rpcDb['createAgentHistory'](_0x53b4c7,'[originateFailure][logOriginateFailure]');_0x1aa8f8(_0x3cd123);});});};Preview[_0xd4a0('0x55')][_0xd4a0('0x1d')]=function(_0x2d36fa){if(this[_0xd4a0('0x12')][_0x2d36fa[_0xd4a0('0x86')]]){this[_0xd4a0('0x12')][_0x2d36fa[_0xd4a0('0x86')]]['channel']=_0x2d36fa[_0xd4a0('0x4c')];}};Preview[_0xd4a0('0x55')][_0xd4a0('0x14')]=function(_0x4c5060){var _0x5276c5=this;var _0x23f88b=this['actions'][_0x4c5060[_0xd4a0('0x11d')]];if(_0x23f88b){if(_0x23f88b['lookAgent']&&this[_0xd4a0('0x58')][_0x23f88b[_0xd4a0('0xeb')]]){ut[_0xd4a0('0x11e')](_0x23f88b,this['agents'][_0x23f88b['lookAgent']][_0xd4a0('0x29')],this[_0xd4a0('0x58')][_0x23f88b[_0xd4a0('0xeb')]]['id']);}var _0x17f853=_[_0xd4a0('0x11f')](_0x23f88b);_0x17f853[_0xd4a0('0x8b')]=moment()[_0xd4a0('0x27')]('YYYY-MM-DD\x20HH:mm:ss');var _0xfd2917=_0x5276c5[_0xd4a0('0xf')][_0x23f88b['queue']];if(ut['isFailure'](_0x4c5060['response'])){if(_0x23f88b[_0xd4a0('0x84')]){rpcDb['unlockContact'](_0x23f88b['idContact']);}if(_0x23f88b[_0xd4a0('0x85')]){rpcDb['disableContact'](_0x23f88b[_0xd4a0('0x89')]);}ami[_0xd4a0('0x23')](_0xd4a0('0x120'),ut[_0xd4a0('0x7c')](_0x23f88b,'rejected',this[_0xd4a0('0xf')][_0x23f88b['queue']]));this['callProgressDetectingAgent'](_0x17f853,_0xfd2917,_0x4c5060);}else{_0x23f88b[_0xd4a0('0x62')]=moment()[_0xd4a0('0x27')](_0xd4a0('0x63'));ut[_0xd4a0('0xda')](_0x17f853,0x4,_0xd4a0('0x98'));rpcDb['createAgentHistory'](_0x17f853,_0xd4a0('0x121'));}}};Preview[_0xd4a0('0x55')][_0xd4a0('0x17')]=function(_0x17d69f){var _0x51ff2e=this[_0xd4a0('0x12')][_0x17d69f[_0xd4a0('0x86')]];var _0x53b25f;if(_0x51ff2e){_0x53b25f=this['campaignsPreview'][_0x51ff2e['queue']];logger[_0xd4a0('0x24')]('[syncHangup][talking]',_0x17d69f['linkedid'],'\x20Queue',_0x53b25f[_0xd4a0('0x29')],'pTalking:\x20',_0x53b25f[_0xd4a0('0x43')]);}if(this['actions'][_0x17d69f[_0xd4a0('0x86')]]&&_0x17d69f[_0xd4a0('0x86')]!==_0x17d69f[_0xd4a0('0x8e')]){if(_0x17d69f[_0xd4a0('0x122')]==='16'&&this['actions'][_0x17d69f['linkedid']][_0xd4a0('0x44')]){this['callProgressDetectingCustomer'](_0x17d69f,_0x17d69f[_0xd4a0('0x86')],_0x17d69f[_0xd4a0('0x122')]);}else if(this[_0xd4a0('0x12')][_0x17d69f['linkedid']][_0xd4a0('0x44')]){logger[_0xd4a0('0x24')](_0xd4a0('0x123'),_0x17d69f['linkedid'],_0x17d69f[_0xd4a0('0x122')],_0xd4a0('0x8f'),_0x53b25f[_0xd4a0('0x29')],_0xd4a0('0x42'),_0x53b25f[_0xd4a0('0x43')]);this[_0xd4a0('0x76')](_0x17d69f,_0x17d69f[_0xd4a0('0x86')],_0x17d69f[_0xd4a0('0x122')]);}}else if(_0x51ff2e&&_[_0xd4a0('0x3c')](_0x51ff2e['statedesc'])&&_0x53b25f[_0xd4a0('0x124')]&&_0x17d69f['linkedid']===_0x17d69f[_0xd4a0('0x8e')]&&_[_0xd4a0('0x3c')](_0x17d69f[_0xd4a0('0xe2')])&&_0x17d69f[_0xd4a0('0x122')]==='16'&&_0x17d69f[_0xd4a0('0x125')]==='6'&&_[_0xd4a0('0xd9')](_0x51ff2e[_0xd4a0('0x126')])){if(_0x51ff2e['unlockAgent']){rpcDb[_0xd4a0('0x127')](_0x51ff2e[_0xd4a0('0x89')]);}if(_0x51ff2e[_0xd4a0('0x85')]){rpcDb['disableContact'](_0x51ff2e['idContact']);}_0x17d69f[_0xd4a0('0xe2')]='22';this['callProgressDetectingAgent'](_0x51ff2e,_0x53b25f,_0x17d69f);}else if(_0x51ff2e&&_0x51ff2e[_0xd4a0('0x126')]){if(_0x17d69f[_0xd4a0('0x122')]==='16'&&this[_0xd4a0('0x12')][_0x17d69f['linkedid']][_0xd4a0('0x44')]){logger[_0xd4a0('0x24')](_0xd4a0('0x128'),_0x17d69f[_0xd4a0('0x86')],_0x17d69f[_0xd4a0('0x122')],_0xd4a0('0x8f'),_0x53b25f[_0xd4a0('0x29')],_0xd4a0('0x42'),_0x53b25f[_0xd4a0('0x43')]);this[_0xd4a0('0x76')](_0x17d69f,_0x17d69f[_0xd4a0('0x86')],_0x17d69f['cause']);}else if(this[_0xd4a0('0x12')][_0x17d69f[_0xd4a0('0x86')]]['dialAnswer']){logger[_0xd4a0('0x24')](_0xd4a0('0x123'),_0x17d69f['linkedid'],_0x17d69f['cause'],'\x20Queue',_0x53b25f[_0xd4a0('0x29')],'pTalking:\x20',_0x53b25f[_0xd4a0('0x43')]);this[_0xd4a0('0x76')](_0x17d69f,_0x17d69f['linkedid'],_0x17d69f[_0xd4a0('0x122')]);}}};Preview['prototype'][_0xd4a0('0x1b')]=function(_0x5effaa){if(this[_0xd4a0('0x12')][_0x5effaa['destlinkedid']]&&_0x5effaa[_0xd4a0('0xd5')]!==_0x5effaa[_0xd4a0('0x129')]){this['callProgressDetectingCustomer'](_0x5effaa,_0x5effaa[_0xd4a0('0xd5')],_0x5effaa[_0xd4a0('0xc9')]);}};Preview[_0xd4a0('0x55')][_0xd4a0('0x19')]=function(_0x39b25e){if(this[_0xd4a0('0x12')][_0x39b25e['linkedid']]&&_0x39b25e['linkedid']!==_0x39b25e['uniqueid']&&!this[_0xd4a0('0x12')][_0x39b25e[_0xd4a0('0x86')]][_0xd4a0('0x44')]){if(_0x39b25e[_0xd4a0('0x122')]==='1'){this[_0xd4a0('0x76')](_0x39b25e,_0x39b25e['linkedid'],_0x39b25e[_0xd4a0('0x122')]);}}};Preview[_0xd4a0('0x55')][_0xd4a0('0x12a')]=function(_0x1aadb9,_0xfb861,_0xf3e142){if(this[_0xd4a0('0x12')][_0x1aadb9]){if(_[_0xd4a0('0x3c')](this[_0xd4a0('0x12')][_0x1aadb9][_0xd4a0('0x12b')])){this[_0xd4a0('0x12')][_0x1aadb9][_0xd4a0('0x12b')]={};}this[_0xd4a0('0x12')][_0x1aadb9][_0xd4a0('0x12b')][_0xfb861]=_0xf3e142;}};Preview['prototype'][_0xd4a0('0x1f')]=function(_0x21993d){try{if(!_[_0xd4a0('0x3c')](_0x21993d)){if(ut[_0xd4a0('0x12c')](_[_0xd4a0('0x12d')](_0x21993d[_0xd4a0('0x12e')])[0x0])){this[_0xd4a0('0x12a')](_0x21993d[_0xd4a0('0x8e')],_['keys'](_0x21993d[_0xd4a0('0x12e')])[0x0],_0x21993d['value']);}}}catch(_0x488e75){logger[_0xd4a0('0x12f')](_0xd4a0('0x130'),util[_0xd4a0('0x131')](_0x488e75,{'showHidden':![],'depth':null}));}};Preview[_0xd4a0('0x55')][_0xd4a0('0x20')]=function(_0x3cbb61){if(_0x3cbb61){if(this[_0xd4a0('0x12')][_0x3cbb61[_0xd4a0('0x132')]]){this[_0xd4a0('0x12')][_0x3cbb61['transfertargetlinkedid']][_0xd4a0('0x126')]=!![];}}};Preview[_0xd4a0('0x55')]['syncBlindTransfer']=function(_0x4d28a1){if(_0x4d28a1){if(this['actions'][_0x4d28a1[_0xd4a0('0x133')]]){this[_0xd4a0('0x12')][_0x4d28a1['transfererlinkedid']][_0xd4a0('0x126')]=!![];}}};module[_0xd4a0('0x134')]=Preview; \ No newline at end of file +var _0xe83f=['syncDialEnd','newexten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','paused','CAMPAIGN_STATUS','INACTIVE','logger','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','preview','booked','type','outbound','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','Queue','stringify','queue','pick','contactId','UserId','VoiceQueueId','Action','status','channel','message','decrementOriginate','dialAnswer','decrementTalking','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','uniqueid','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','complete','outboundAnswerCallsDay','total','answered','[16]','[callProgressDetectingCustomer][logAnswer]','createCustomerFinal','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','incrementPreviewCounters','NOANSWER','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedretry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','NoAnswer','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','phone','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','unlock','unlockContact','getContactPreview','recallme','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[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','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialCutDigit','dialPrefix','trim','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','setXMDContactVariables','Contact','merge','toLowerVariables','variables','variablesAction','[originated][increment]','originated:\x20','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','syncOriginateResponse','actionid','lookAgent','logLookAgent','isFailure','response','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','filterKey','variable','addVariable','keys','value','[syncVarSet][Preview]','inspect','syncBlindTransfer','transfererlinkedid','exports','lodash','uuid','moment','ioredis','../../../config/environment','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','../dialer/utils','defaults','redis','localhost','prototype','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','bind','hangup','hanguprequest','syncHangupRequest','dialend'];(function(_0x15615a,_0x3abf94){var _0x220ab1=function(_0x49f590){while(--_0x49f590){_0x15615a['push'](_0x15615a['shift']());}};_0x220ab1(++_0x3abf94);}(_0xe83f,0x130));var _0xfe83=function(_0x1faae7,_0x1c1ec8){_0x1faae7=_0x1faae7-0x0;var _0x3630be=_0xe83f[_0x1faae7];return _0x3630be;};'use strict';var util=require('util');var _=require(_0xfe83('0x0'));var uuid=require(_0xfe83('0x1'));var moment=require(_0xfe83('0x2'));var Redis=require(_0xfe83('0x3'));var config=require(_0xfe83('0x4'));var logger=require('../../../config/logger')('preview');var loggerAction=require('../../../config/logger')(_0xfe83('0x5'));var ami=require('../ami');var rpcDb=require(_0xfe83('0x6'));var cmHopperAdditionalPhone=require(_0xfe83('0x7'));var Action=require(_0xfe83('0x8'));var ut=require('./util/util');var utils=require(_0xfe83('0x9'));config['redis']=_[_0xfe83('0xa')](config[_0xfe83('0xb')],{'host':_0xfe83('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfe83('0xb')]));var Sequence=function(){};Sequence[_0xfe83('0xd')]['enqueue']=function(_0x4b9db0){this['tail']=this[_0xfe83('0xe')]?this[_0xfe83('0xe')]['finally'](_0x4b9db0):_0x4b9db0();};function Preview(_0x59cd17){this[_0xfe83('0xf')]=new Sequence();this[_0xfe83('0x10')]=_0x59cd17[_0xfe83('0x11')];this[_0xfe83('0x12')]=_0x59cd17[_0xfe83('0x12')];this[_0xfe83('0x13')]={};this['agents']=_0x59cd17[_0xfe83('0x14')];this['clockClearZombieChannels']=0x0;ami['on'](_0xfe83('0x15'),this['syncOriginateResponse'][_0xfe83('0x16')](this));ami['on'](_0xfe83('0x17'),this['syncHangup'][_0xfe83('0x16')](this));ami['on'](_0xfe83('0x18'),this[_0xfe83('0x19')][_0xfe83('0x16')](this));ami['on'](_0xfe83('0x1a'),this[_0xfe83('0x1b')][_0xfe83('0x16')](this));ami['on'](_0xfe83('0x1c'),this['syncNewExten'][_0xfe83('0x16')](this));ami['on'](_0xfe83('0x1d'),this[_0xfe83('0x1e')][_0xfe83('0x16')](this));ami['on']('attendedtransfer',this[_0xfe83('0x1f')][_0xfe83('0x16')](this));ami['on'](_0xfe83('0x20'),this['syncBlindTransfer'][_0xfe83('0x16')](this));this[_0xfe83('0x21')](this[_0xfe83('0x10')]);}function emit(_0x4b0d08,_0x20f45d,_0x554a50){io['to'](_0x4b0d08)[_0xfe83('0x22')](_0x20f45d,_0x554a50);}function emitVoiceQueueChannelRemove(_0x5019fb){logger['info'](_0xfe83('0x23'),JSON['stringify'](_0x5019fb));emit(util[_0xfe83('0x24')]('voice:queue:%s',_0x5019fb[_0xfe83('0x25')]),_0xfe83('0x26'),_0x5019fb);io[_0xfe83('0x22')](_0xfe83('0x27'),_0x5019fb);}function notSendMessagesQueue(_0x59a785){if(_0x59a785[_0xfe83('0x28')]){if(_0x59a785[_0xfe83('0x29')]===0x0&&_0x59a785[_0xfe83('0x2a')]===0x0){_0x59a785['sendMessageOneNotActive']=![];_0x59a785['available']=0x0;_0x59a785[_0xfe83('0x2b')]=0x0;_0x59a785['message']=utils[_0xfe83('0x2c')][_0xfe83('0x2d')];ut[_0xfe83('0x2e')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x59a785[_0xfe83('0x25')]+_0xfe83('0x2f'));}else{_0x59a785['message']=utils[_0xfe83('0x2c')][_0xfe83('0x30')];ut[_0xfe83('0x2e')](_0xfe83('0x31'),_0x59a785[_0xfe83('0x25')]+_0xfe83('0x32'));}}}Preview['prototype'][_0xfe83('0x21')]=function(){var _0x46c859=this;setInterval(function(){_0x46c859[_0xfe83('0x33')]();},0x7cf);};Preview['prototype'][_0xfe83('0x33')]=function(){var _0x177abc=this[_0xfe83('0x10')];this[_0xfe83('0x34')]+=0x1;for(var _0x4322d1 in _0x177abc){if(_0x177abc[_0xfe83('0x35')](_0x4322d1)&&(_0x177abc[_0x4322d1][_0xfe83('0x36')]===_0xfe83('0x37')||_0x177abc[_0x4322d1][_0xfe83('0x36')]===_0xfe83('0x38'))&&_0x177abc[_0x4322d1][_0xfe83('0x39')]===_0xfe83('0x3a')){if(this[_0xfe83('0x34')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x177abc[_0xfe83('0x35')](_0x4322d1)&&_0x177abc[_0x4322d1][_0xfe83('0x36')]===_0xfe83('0x37')&&_0x177abc[_0x4322d1]['type']===_0xfe83('0x3a')){if(_0x177abc[_0x4322d1][_0xfe83('0x3b')]){this[_0xfe83('0x3c')](_0x177abc[_0x4322d1]);if(_0x177abc[_0x4322d1][_0xfe83('0x3d')])this[_0xfe83('0x3e')](_0x177abc[_0x4322d1]);}else{notSendMessagesQueue(_0x177abc[_0x4322d1]);}}}};Preview[_0xfe83('0xd')][_0xfe83('0x3f')]=function(_0x3e6d1c){var _0x39b15b=this;this[_0xfe83('0xf')]['enqueue'](function(){if(!_[_0xfe83('0x40')](_0x39b15b['actions'][_0x3e6d1c])){loggerAction[_0xfe83('0x41')](_0xfe83('0x42'),_0x3e6d1c,_0xfe83('0x43'),_0x39b15b[_0xfe83('0x13')][_0x3e6d1c]['queue'],'originated:\x20',JSON[_0xfe83('0x44')](_0x39b15b[_0xfe83('0x10')][_0x39b15b['actions'][_0x3e6d1c][_0xfe83('0x45')]][_0xfe83('0x29')]),'pTalking:\x20',JSON[_0xfe83('0x44')](_0x39b15b[_0xfe83('0x10')][_0x39b15b[_0xfe83('0x13')][_0x3e6d1c][_0xfe83('0x45')]][_0xfe83('0x2a')]),JSON[_0xfe83('0x44')](_0x39b15b[_0xfe83('0x13')][_0x3e6d1c]['dialAnswer']),JSON[_0xfe83('0x44')](_[_0xfe83('0x46')](_0x39b15b[_0xfe83('0x13')][_0x3e6d1c],[_0xfe83('0x47'),_0xfe83('0x48'),_0xfe83('0x49'),'ListId'])));return ami[_0xfe83('0x4a')]({'action':_0xfe83('0x4b'),'channel':_0x39b15b[_0xfe83('0x13')][_0x3e6d1c][_0xfe83('0x4c')]})['catch'](function(_0x2ce0a8){if(_0x2ce0a8[_0xfe83('0x4d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x39b15b[_0xfe83('0x13')][_0x3e6d1c]){utils[_0xfe83('0x4e')](_0x39b15b[_0xfe83('0x10')][_0x39b15b['actions'][_0x3e6d1c][_0xfe83('0x45')]],'[clearZombieChannel]');if(_0x39b15b[_0xfe83('0x13')][_0x3e6d1c][_0xfe83('0x4f')]===!![]){ut[_0xfe83('0x50')](_0x39b15b[_0xfe83('0x10')][_0x39b15b[_0xfe83('0x13')][_0x3e6d1c][_0xfe83('0x45')]],_0xfe83('0x51'));ut[_0xfe83('0x52')](_0xfe83('0x53')+_0x3e6d1c,_0x39b15b[_0xfe83('0x13')][_0x3e6d1c][_0xfe83('0x45')]);}ut['loggerError'](_0xfe83('0x54')+_0x3e6d1c,_0x39b15b[_0xfe83('0x13')][_0x3e6d1c][_0xfe83('0x45')]);delete _0x39b15b[_0xfe83('0x13')][_0x3e6d1c];}},0x2328);}});}});};Preview[_0xfe83('0xd')][_0xfe83('0x55')]=function(){var _0x113ca8=this;loggerAction['info'](_0xfe83('0x56'),_[_0xfe83('0x57')](this[_0xfe83('0x13')]));for(var _0x42fa2f in this[_0xfe83('0x13')]){if(_0x113ca8[_0xfe83('0x13')][_0xfe83('0x35')](_0x42fa2f)){_0x113ca8[_0xfe83('0x3f')](_0x42fa2f);}}};Preview[_0xfe83('0xd')][_0xfe83('0x3e')]=function(_0x2a52d1){var _0x57dc37=this;rpcDb[_0xfe83('0x58')](_0x2a52d1['id'],ut[_0xfe83('0x59')](this[_0xfe83('0x14')]))[_0xfe83('0x5a')](function(_0x15a34d){if(!_[_0xfe83('0x40')](_0x15a34d)){for(var _0x47bc3b=0x0;_0x47bc3b<_0x15a34d[_0xfe83('0x5b')];_0x47bc3b+=0x1){if(ut[_0xfe83('0x5c')](_0x15a34d[_0x47bc3b]['scheduledat'])<_0x2a52d1[_0xfe83('0x5d')]*0x3c){if(_0x15a34d[_0x47bc3b][_0xfe83('0x5e')]&&!_0x15a34d[_0x47bc3b][_0xfe83('0x5e')][_0xfe83('0x5f')]){_0x57dc37[_0xfe83('0x60')](_0x15a34d[_0x47bc3b]['id'])['then'](ut[_0xfe83('0x61')](_0xfe83('0x62')))[_0xfe83('0x63')](ut[_0xfe83('0x61')]('[RecallMe]'));}else{rpcDb[_0xfe83('0x64')](_0x15a34d[_0x47bc3b]['id']);}}else{var _0x37c5bd=new Action(_0x15a34d[_0x47bc3b],_0x2a52d1);_0x37c5bd[_0xfe83('0x65')]=moment()[_0xfe83('0x24')](_0xfe83('0x66'));_0x2a52d1[_0xfe83('0x67')]+=0x1;ut[_0xfe83('0x68')](_0x37c5bd,0x17,_0xfe83('0x69'));if(_0x2a52d1['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x15a34d[_0x47bc3b]));rpcDb[_0xfe83('0x6a')](_0x37c5bd,_0xfe83('0x6b'));}else{ut[_0xfe83('0x68')](_0x37c5bd,0x16,_0xfe83('0x6c'));rpcDb[_0xfe83('0x6a')](_0x37c5bd,_0xfe83('0x6d'));rpcDb['createCustomerFinal'](_0x37c5bd,_0xfe83('0x6d'));}}}}})[_0xfe83('0x63')](ut['logger2'](_0xfe83('0x6e')));};Preview[_0xfe83('0xd')][_0xfe83('0x3c')]=function(_0x161b4b){_0x161b4b[_0xfe83('0x28')]=!![];if(ut[_0xfe83('0x6f')](_0x161b4b[_0xfe83('0x70')])){_0x161b4b[_0xfe83('0x4d')]=utils[_0xfe83('0x2c')][_0xfe83('0x71')];}else if(!ut[_0xfe83('0x72')](_0x161b4b[_0xfe83('0x3b')])){_0x161b4b[_0xfe83('0x4d')]=utils['CAMPAIGN_STATUS'][_0xfe83('0x2d')];}else if(!this[_0xfe83('0x73')](_0x161b4b['Trunk'])){if(!this[_0xfe83('0x73')](_0x161b4b[_0xfe83('0x74')])){_0x161b4b[_0xfe83('0x4d')]=utils[_0xfe83('0x2c')]['UNREACHABLE_TRUNK'];}else{_0x161b4b[_0xfe83('0x4d')]=utils[_0xfe83('0x2c')][_0xfe83('0x75')];}}else{_0x161b4b['message']=utils[_0xfe83('0x2c')][_0xfe83('0x75')];}};Preview['prototype'][_0xfe83('0x76')]=function(_0x56467b,_0x2dfc71,_0x174d89){var _0x13f50b=this;var _0x282410=this[_0xfe83('0x13')][_0x2dfc71];var _0x323935=this[_0xfe83('0x10')][_0x282410[_0xfe83('0x45')]];var _0x22772f;var _0x2e7078=![];var _0x8788dc=0x2;var _0x234216=0x3;if(_0x323935){switch(_0x174d89){case'1':_0x323935[_0xfe83('0x77')]+=0x1;_0x282410[_0xfe83('0x78')]+=0x1;_0x282410[_0xfe83('0x79')]=ut['totalGlobal'](_0x282410);ut[_0xfe83('0x68')](_0x282410,0x0,_0xfe83('0x7a'));ami['emit'](_0xfe83('0x7b'),ut[_0xfe83('0x7c')](_0x282410,_0xfe83('0x7d')));rpcDb[_0xfe83('0x6a')](_0x282410,_0xfe83('0x7e'));_0x13f50b[_0xfe83('0x7f')](_0x282410,'0',_0x323935)[_0xfe83('0x5a')](function(_0x287f02){_0x2e7078=_0x287f02[_0xfe83('0x80')]==0x1;_0x8788dc=_0x323935[_0xfe83('0x81')];_0x234216=_0x323935['callAdditionalPhoneAfterMin'];if(!_0x2e7078){if(ut[_0xfe83('0x82')](_0x282410)>=_0x323935[_0xfe83('0x83')]){_0x22772f=ut[_0xfe83('0x84')](_0x282410,0xf,_0xfe83('0x85'));rpcDb['createCustomerFinal'](_0x22772f,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x282410[_0xfe83('0x78')]>=_0x323935[_0xfe83('0x86')]){rpcDb['createCustomerFinal'](_0x282410,_0xfe83('0x87'));}else{rpcDb[_0xfe83('0x88')](ut[_0xfe83('0x89')](_0x282410,_0xfe83('0x78'),_0x323935[_0xfe83('0x81')]),_0x282410['unlockAgent'],_0x282410[_0xfe83('0x8a')]);}}delete this[_0xfe83('0x13')][_0x56467b[_0xfe83('0x8b')]];}else{_0x282410[_0xfe83('0x78')]++;logger[_0xfe83('0x41')](_0xfe83('0x8c'),_0x282410[_0xfe83('0x78')]);logger[_0xfe83('0x41')]('id',_0x282410['idContact']);_0x13f50b['incrementPreviewCounters']({'id':_0x282410[_0xfe83('0x8d')],'field':{'countnosuchnumberretry':_0x282410[_0xfe83('0x78')]}})[_0xfe83('0x5a')](function(){_0x13f50b[_0xfe83('0x8e')](_0x282410,_0x8788dc,_0x234216)[_0xfe83('0x5a')](function(){});});}});break;case _0xfe83('0x8f'):var _0x1bb14f=moment()[_0xfe83('0x24')](_0xfe83('0x66'));_0x282410[_0xfe83('0x90')]=_0x1bb14f;_0x282410[_0xfe83('0x91')]=_0x1bb14f;_0x282410['dialAnswer']=!![];_0x323935['pTalking']+=0x1;logger['info']('[syncHangup][talking][increment]',_0x282410[_0xfe83('0x92')],'\x20Queue',_0x323935['name'],_0xfe83('0x93'),_0x323935[_0xfe83('0x2a')]);ami['emit'](_0xfe83('0x94'),ut[_0xfe83('0x7c')](_0x282410,_0xfe83('0x95'),this['campaignsPreview'][_0x282410[_0xfe83('0x45')]]));if(_0x323935[_0xfe83('0x96')]||_0x323935[_0xfe83('0x97')]){ami[_0xfe83('0x22')](_0xfe83('0x98'),{'queue':_0x282410[_0xfe83('0x45')],'interface':_0x282410[_0xfe83('0x99')],'uniqueid':_0x282410[_0xfe83('0x92')]});}break;case'16':ami['emit']('custom:agentcomplete',ut[_0xfe83('0x7c')](_0x282410,_0xfe83('0x9a'),this[_0xfe83('0x10')][_0x282410['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x282410,_0xfe83('0x9a')));_0x323935[_0xfe83('0x9b')]+=0x1;_0x323935[_0xfe83('0x9c')]+=0x1;_0x323935[_0xfe83('0x9d')]+=0x1;ut[_0xfe83('0x50')](_0x323935,_0xfe83('0x9e'));_0x282410['countglobal']=ut[_0xfe83('0x82')](_0x282410);ut[_0xfe83('0x68')](_0x282410,0x4,'Answer');rpcDb[_0xfe83('0x6a')](_0x282410,_0xfe83('0x9f'));rpcDb[_0xfe83('0xa0')](_0x282410,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x282410);_0x323935[_0xfe83('0xa1')]+=_0x282410[_0xfe83('0xa2')];_0x323935[_0xfe83('0xa3')]+=_0x282410[_0xfe83('0xa2')];logger[_0xfe83('0x41')](_0xfe83('0xa4'),_0x282410[_0xfe83('0x92')],_0xfe83('0xa5'),_0x323935[_0xfe83('0x25')],_0xfe83('0x93'),_0x323935[_0xfe83('0x2a')]);delete this['actions'][_0x56467b[_0xfe83('0x8b')]];break;case'BUSY':_0x323935['outboundBusyCallsDay']+=0x1;_0x282410[_0xfe83('0xa6')]+=0x1;_0x282410[_0xfe83('0x79')]=ut['totalGlobal'](_0x282410);ut['logCustomer'](_0x282410,0x5,_0xfe83('0xa7'));_0x8788dc=_0x323935[_0xfe83('0xa8')];_0x234216=_0x323935[_0xfe83('0xa9')];ami[_0xfe83('0x22')](_0xfe83('0xaa'),ut[_0xfe83('0x7c')](_0x282410,_0xfe83('0xab')));rpcDb['createCustomerHistory'](_0x282410,_0xfe83('0xac'));_0x13f50b[_0xfe83('0x7f')](_0x282410,'5',_0x323935)[_0xfe83('0x5a')](function(_0x3d86e4){_0x2e7078=_0x3d86e4[_0xfe83('0x80')]==0x1;if(!_0x2e7078){if(ut[_0xfe83('0x82')](_0x282410)>=_0x323935[_0xfe83('0x83')]){_0x22772f=ut[_0xfe83('0x84')](_0x282410,0xf,'Global');rpcDb['createCustomerFinal'](_0x22772f,_0xfe83('0xad'));}else{if(_0x282410[_0xfe83('0xa6')]>=_0x323935[_0xfe83('0xae')]){rpcDb[_0xfe83('0xa0')](_0x282410,_0xfe83('0xac'));}else{rpcDb[_0xfe83('0x88')](ut['scheduledAt'](_0x282410,_0xfe83('0xa6'),_0x323935[_0xfe83('0xa8')]),_0x282410[_0xfe83('0xaf')],_0x282410['activeContact']);}}}else{_0x282410[_0xfe83('0xa6')]++;_0x13f50b[_0xfe83('0xb0')]({'id':_0x282410[_0xfe83('0x8d')],'field':{'countbusyretry':_0x282410[_0xfe83('0xa6')]}})['then'](function(){_0x13f50b[_0xfe83('0x8e')](_0x282410,_0x8788dc,_0x234216)[_0xfe83('0x5a')](function(){});});}});break;case _0xfe83('0xb1'):_0x323935[_0xfe83('0xb2')]+=0x1;_0x282410['countnoanswerretry']+=0x1;_0x282410[_0xfe83('0x79')]=ut[_0xfe83('0x82')](_0x282410);ut[_0xfe83('0x68')](_0x282410,0x3,'NoAnswer');_0x8788dc=_0x323935['dialNoAnswerRetryFrequency'];_0x234216=_0x323935[_0xfe83('0xa9')];var _0x248959=ut[_0xfe83('0xb3')](_0x282410,_0x323935);ami['emit']('custom:agentnoanswer',_0x248959);rpcDb[_0xfe83('0x6a')](_0x282410,'[callProgressDetectingCustomer][logNoAnswer]');_0x13f50b[_0xfe83('0x7f')](_0x282410,'3',_0x323935)[_0xfe83('0x5a')](function(_0xff150a){_0x2e7078=_0xff150a[_0xfe83('0x80')]==0x1;if(!_0x2e7078){if(ut[_0xfe83('0x82')](_0x282410)>=_0x323935[_0xfe83('0x83')]){_0x22772f=ut['cloneAction'](_0x282410,0xf,_0xfe83('0x85'));rpcDb[_0xfe83('0xa0')](_0x22772f,_0xfe83('0xb4'));}else{if(_0x282410[_0xfe83('0xb5')]>=_0x323935[_0xfe83('0xb6')]){rpcDb[_0xfe83('0xa0')](_0x282410,_0xfe83('0xb7'));}else{rpcDb['rescheduleContact'](ut[_0xfe83('0x89')](_0x282410,_0xfe83('0xb5'),_0x323935[_0xfe83('0xb8')]),_0x282410[_0xfe83('0xaf')],_0x282410[_0xfe83('0x8a')]);}}}else{_0x282410[_0xfe83('0xb5')]++;_0x13f50b[_0xfe83('0xb0')]({'id':_0x282410[_0xfe83('0x8d')],'field':{'countnoanswerretry':_0x282410[_0xfe83('0xb5')]}})['then'](function(){_0x13f50b[_0xfe83('0x8e')](_0x282410,_0x8788dc,_0x234216)[_0xfe83('0x5a')](function(){});});}});break;case _0xfe83('0xb9'):_0x323935[_0xfe83('0xba')]+=0x1;_0x282410[_0xfe83('0xbb')]+=0x1;_0x282410[_0xfe83('0x79')]=ut['totalGlobal'](_0x282410);ut['logCustomer'](_0x282410,0x8,_0xfe83('0xbc'));_0x8788dc=_0x323935['dialCongestionRetryFrequency'];_0x234216=_0x323935[_0xfe83('0xa9')];ami['emit'](_0xfe83('0xbd'),ut[_0xfe83('0x7c')](_0x282410,'congestion'));rpcDb[_0xfe83('0x6a')](_0x282410,_0xfe83('0xbe'));_0x13f50b[_0xfe83('0x7f')](_0x282410,'8',_0x323935)[_0xfe83('0x5a')](function(_0x41bd35){_0x2e7078=_0x41bd35[_0xfe83('0x80')]==0x1;if(!_0x2e7078){if(ut[_0xfe83('0x82')](_0x282410)>=_0x323935[_0xfe83('0x83')]){_0x22772f=ut['cloneAction'](_0x282410,0xf,_0xfe83('0x85'));rpcDb[_0xfe83('0xa0')](_0x22772f,_0xfe83('0xbf'));}else{if(_0x282410[_0xfe83('0xbb')]>=_0x323935[_0xfe83('0xc0')]){rpcDb[_0xfe83('0xa0')](_0x282410,_0xfe83('0xbe'));}else{rpcDb['rescheduleContact'](ut[_0xfe83('0x89')](_0x282410,_0xfe83('0xbb'),_0x323935[_0xfe83('0xa8')]),_0x282410[_0xfe83('0xaf')],_0x282410[_0xfe83('0x8a')]);}}}else{_0x282410[_0xfe83('0xbb')]++;_0x13f50b[_0xfe83('0xb0')]({'id':_0x282410[_0xfe83('0x8d')],'field':{'countcongestionretry':_0x282410[_0xfe83('0xbb')]}})['then'](function(){_0x13f50b[_0xfe83('0x8e')](_0x282410,_0x8788dc,_0x234216)[_0xfe83('0x5a')](function(){});});}});break;case _0xfe83('0xc1'):_0x323935[_0xfe83('0xc2')]+=0x1;_0x282410[_0xfe83('0xc3')]+=0x1;_0x282410[_0xfe83('0x79')]=ut[_0xfe83('0x82')](_0x282410);ut[_0xfe83('0x68')](_0x282410,0x14,'AgentReject');_0x8788dc=_0x323935['dialAgentRejectRetryFrequency'];_0x234216=_0x323935[_0xfe83('0xa9')];ami[_0xfe83('0x22')]('custom:agentreject',ut[_0xfe83('0x7c')](_0x282410,'agentreject'));rpcDb[_0xfe83('0x6a')](_0x282410,_0xfe83('0xc4'));_0x13f50b[_0xfe83('0x7f')](_0x282410,'20',_0x323935)[_0xfe83('0x5a')](function(_0xc4a2e4){_0x2e7078=_0xc4a2e4[_0xfe83('0x80')]==0x1;if(!_0x2e7078){if(ut['totalGlobal'](_0x282410)>=_0x323935[_0xfe83('0x83')]){_0x22772f=ut[_0xfe83('0x84')](_0x282410,0x14,_0xfe83('0xc5'));rpcDb[_0xfe83('0xa0')](_0x22772f,_0xfe83('0xc6'));}else{if(_0x282410['countagentrejectretry']>=_0x323935[_0xfe83('0xc7')]){rpcDb['createCustomerFinal'](_0x282410,_0xfe83('0xc6'));}else{rpcDb[_0xfe83('0x88')](ut[_0xfe83('0x89')](_0x282410,_0xfe83('0xc3'),_0x323935[_0xfe83('0xc8')]),_0x282410['unlockAgent'],_0x282410['activeContact']);}}}else{_0x282410[_0xfe83('0xb5')]++;_0x13f50b['incrementPreviewCounters']({'id':_0x282410[_0xfe83('0x8d')],'field':{'countnoanswerretry':_0x282410[_0xfe83('0xb5')]}})[_0xfe83('0x5a')](function(){_0x13f50b['swapAdditionalPhones'](_0x282410,_0x8788dc,_0x234216)[_0xfe83('0x5a')](function(){});});}});break;case _0xfe83('0xc9'):_0x323935[_0xfe83('0xca')]+=0x1;_0x282410['countabandonedretry']+=0x1;_0x282410[_0xfe83('0x79')]=ut[_0xfe83('0x82')](_0x282410);ut[_0xfe83('0x68')](_0x282410,0xb,_0xfe83('0xcb'));rpcDb[_0xfe83('0x6a')](_0x282410,_0xfe83('0xcc'));_0x13f50b[_0xfe83('0x7f')](_0x282410,'11',_0x323935)[_0xfe83('0x5a')](function(_0x44cc7c){_0x2e7078=_0x44cc7c['additional']==0x1;if(!_0x2e7078){if(ut[_0xfe83('0x82')](_0x282410)>=_0x323935[_0xfe83('0x83')]){_0x22772f=ut['cloneAction'](_0x282410,0xf,_0xfe83('0x85'));rpcDb[_0xfe83('0xa0')](_0x22772f,_0xfe83('0xcc'));}else{if(_0x282410['countabandonedetry']>=_0x323935['dialAbandonedMaxRety']){rpcDb[_0xfe83('0xa0')](_0x282410,_0xfe83('0xcc'));}else{rpcDb[_0xfe83('0x88')](ut[_0xfe83('0x89')](_0x282410,_0xfe83('0xcd'),_0x323935[_0xfe83('0xce')]),_0x282410[_0xfe83('0xaf')],_0x282410['activeContact']);}}}else{_0x282410[_0xfe83('0xb5')]++;_0x13f50b[_0xfe83('0xb0')]({'id':_0x282410['idContact'],'field':{'countnoanswerretry':_0x282410[_0xfe83('0xb5')]}})[_0xfe83('0x5a')](function(){_0x13f50b[_0xfe83('0x8e')](_0x282410,_0x8788dc,_0x234216)[_0xfe83('0x5a')](function(){});});}});break;case'18':_0x323935['outboundUnknownCallsDay']+=0x1;_0x282410[_0xfe83('0xcf')]+=0x1;_0x282410[_0xfe83('0x79')]=ut['totalGlobal'](_0x282410);ut[_0xfe83('0x68')](_0x282410,0x12,_0x56467b[_0xfe83('0xd0')]||_0x56467b['dialstatus']);ami[_0xfe83('0x22')](_0xfe83('0xd1'),ut[_0xfe83('0x7c')](_0x282410,'amd'));rpcDb[_0xfe83('0x6a')](_0x282410,_0xfe83('0xd2'));_0x13f50b[_0xfe83('0x7f')](_0x282410,'18',_0x323935)[_0xfe83('0x5a')](function(_0x47d8f1){_0x2e7078=_0x47d8f1[_0xfe83('0x80')]==0x1;if(!_0x2e7078){if(ut[_0xfe83('0x82')](_0x282410)>=_0x323935[_0xfe83('0x83')]){_0x22772f=ut[_0xfe83('0x84')](_0x282410,0x12,'Global');rpcDb[_0xfe83('0xa0')](_0x22772f,_0xfe83('0xd2'));}else{rpcDb[_0xfe83('0xa0')](_0x282410,_0xfe83('0xd2'));}}else{_0x282410[_0xfe83('0xb5')]++;_0x13f50b['incrementPreviewCounters']({'id':_0x282410[_0xfe83('0x8d')],'field':{'countnoanswerretry':_0x282410['countnoanswerretry']}})[_0xfe83('0x5a')](function(){_0x13f50b[_0xfe83('0x8e')](_0x282410,_0x8788dc,_0x234216)[_0xfe83('0x5a')](function(){});});}});delete this[_0xfe83('0x13')][_0x56467b[_0xfe83('0x8b')]];break;case'19':_0x323935[_0xfe83('0xd3')]+=0x1;_0x282410['countglobal']=ut[_0xfe83('0x82')](_0x282410);ut[_0xfe83('0x68')](_0x282410,0x13,_0x56467b[_0xfe83('0xd0')]||_0x56467b[_0xfe83('0xd4')]);ami[_0xfe83('0x22')](_0xfe83('0xd1'),ut[_0xfe83('0x7c')](_0x282410,_0xfe83('0xd5')));rpcDb['createCustomerHistory'](_0x282410,_0xfe83('0xd6'));_0x13f50b[_0xfe83('0x7f')](_0x282410,'18',_0x323935)[_0xfe83('0x5a')](function(_0x3f692a){_0x2e7078=_0x3f692a['additional']==0x1;if(!_0x2e7078){if(ut[_0xfe83('0x82')](_0x282410)>=_0x323935[_0xfe83('0x83')]){_0x22772f=ut[_0xfe83('0x84')](_0x282410,0xf,_0xfe83('0x85'));rpcDb[_0xfe83('0xa0')](_0x22772f,_0xfe83('0xd6'));}else{rpcDb[_0xfe83('0xa0')](_0x282410,_0xfe83('0xd6'));}}else{_0x282410[_0xfe83('0xb5')]++;_0x13f50b[_0xfe83('0xb0')]({'id':_0x282410[_0xfe83('0x8d')],'field':{'countnoanswerretry':_0x282410[_0xfe83('0xb5')]}})['then'](function(){_0x13f50b[_0xfe83('0x8e')](_0x282410,_0x8788dc,_0x234216)[_0xfe83('0x5a')](function(){});});}});delete this[_0xfe83('0x13')][_0x56467b[_0xfe83('0x8b')]];break;default:if(_0x282410[_0xfe83('0x4f')]){ut[_0xfe83('0x50')](_0x323935,_0xfe83('0xd7'));ut[_0xfe83('0x52')](_0xfe83('0xd8')+_0x323935[_0xfe83('0x25')],_0x56467b);}_0x323935[_0xfe83('0xd3')]+=0x1;_0x282410['countglobal']=ut[_0xfe83('0x82')](_0x282410);ut[_0xfe83('0x68')](_0x282410,0xc,_0x56467b[_0xfe83('0xd0')]||_0x56467b[_0xfe83('0xd4')]);_0x8788dc=_0x323935['dialAgentRejectRetryFrequency'];_0x234216=_0x323935[_0xfe83('0xa9')];rpcDb[_0xfe83('0x6a')](_0x282410,_0xfe83('0xd9'));_0x13f50b[_0xfe83('0x7f')](_0x282410,'20',_0x323935)['then'](function(_0x3398a9){_0x2e7078=_0x3398a9[_0xfe83('0x80')]==0x1;if(!_0x2e7078){if(ut[_0xfe83('0x82')](_0x282410)>=_0x323935[_0xfe83('0x83')]){_0x22772f=ut[_0xfe83('0x84')](_0x282410,0xf,'Global');rpcDb[_0xfe83('0xa0')](_0x22772f,_0xfe83('0xda'));}else{rpcDb['createCustomerFinal'](_0x282410,_0xfe83('0xda'));}delete this['actions'][_0x56467b[_0xfe83('0x8b')]];}else{_0x13f50b['swapAdditionalPhones'](_0x282410,_0x8788dc,_0x234216)['then'](function(){});}});}if(!(_0x282410[_0xfe83('0x4f')]&&_0x174d89==='16')){utils[_0xfe83('0x4e')](_0x323935,_0xfe83('0xdb'));logger[_0xfe83('0x41')]('[originated][decrement][callProgressDetectingCustomer]',_0x282410[_0xfe83('0x92')],'\x20Queue',_0x323935['name'],'originated:\x20',_0x323935[_0xfe83('0x29')]);}if(_0x174d89!==_0xfe83('0x8f')){delete this[_0xfe83('0x13')][_0x56467b[_0xfe83('0x8b')]];delete this[_0xfe83('0x13')][_0x56467b[_0xfe83('0xdc')]];}_0x323935[_0xfe83('0xdd')]=!![];}};Preview[_0xfe83('0xd')][_0xfe83('0xde')]=function(_0x3102a6,_0x464a08,_0x675d3b){if(_['isUndefined'](_0x464a08)&&_0xfe83('0xdf')!==typeof _0x464a08){return;}if(_[_0xfe83('0xe0')](_0x675d3b)&&'object'!==typeof _0x675d3b){return;}switch(_0x675d3b['reason']){case'0':ut['logAgent'](_0x3102a6,0x0,_0xfe83('0x7a'));rpcDb[_0xfe83('0xe1')](_0x3102a6,_0xfe83('0xe2'));break;case'3':ut[_0xfe83('0xe3')](_0x3102a6,0x3,_0xfe83('0xe4'));rpcDb[_0xfe83('0xe1')](_0x3102a6,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xfe83('0xe3')](_0x3102a6,0x5,_0xfe83('0xa7'));rpcDb[_0xfe83('0xe1')](_0x3102a6,_0xfe83('0xe5'));break;case'8':ut[_0xfe83('0xe3')](_0x3102a6,0x8,_0xfe83('0xbc'));rpcDb['createAgentHistory'](_0x3102a6,_0xfe83('0xe6'));break;case'22':ut[_0xfe83('0xe3')](_0x3102a6,0x16,_0xfe83('0xe7'));rpcDb['createAgentHistory'](_0x3102a6,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xfe83('0xe3')](_0x3102a6,0xc,_0x675d3b[_0xfe83('0xe8')]);rpcDb[_0xfe83('0xe1')](_0x3102a6,_0xfe83('0xe6'));}utils[_0xfe83('0x4e')](_0x464a08,_0xfe83('0xe9'));logger[_0xfe83('0x41')](_0xfe83('0xea'),_0x3102a6[_0xfe83('0x92')],'\x20Queue',_0x464a08[_0xfe83('0x25')],'originated:\x20',_0x464a08['originated']);delete this[_0xfe83('0x13')][_0x3102a6[_0xfe83('0x92')]];};Preview[_0xfe83('0xd')][_0xfe83('0x7f')]=function(_0x2e9e4f,_0xec054a,_0x2f837f){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x2e9e4f,_0xec054a,_0x2f837f)['catch'](logger[_0xfe83('0x41')](_0xfe83('0xeb')));};Preview[_0xfe83('0xd')]['swapAdditionalPhones']=function(_0x1336d6,_0xbff95d,_0x16193f){return cmHopperAdditionalPhone[_0xfe83('0x8e')](_0x1336d6,_0xbff95d,_0x16193f)[_0xfe83('0x63')](logger[_0xfe83('0x41')](_0xfe83('0xec')));};Preview[_0xfe83('0xd')][_0xfe83('0xb0')]=function(_0x367deb){return Promise[_0xfe83('0xed')]()[_0xfe83('0x5a')](cmHopperAdditionalPhone[_0xfe83('0xb0')](_0x367deb))[_0xfe83('0x63')](logger['info'](_0xfe83('0xee')));};Preview['prototype']['checkInBlack']=function(_0x28130c,_0x5eb5c4,_0x5bfc49,_0x2966e2,_0xa51e84){var _0x2588ce=this;return new Promise(function(_0x4688ac,_0x5a8e7d){if(_[_0xfe83('0x40')](_0x5eb5c4)||_[_0xfe83('0x40')](_0x5eb5c4['Contact'])||_[_0xfe83('0x40')](_0x5eb5c4[_0xfe83('0xef')])||_[_0xfe83('0x40')](_0x5eb5c4[_0xfe83('0x49')])){_0x5a8e7d(ut[_0xfe83('0x4d')]('Contact\x20is\x20undefined',_0x2966e2,_0xa51e84));return;}var _0x5bca66=uuid['v4']();var _0x357c14=_0x2588ce[_0xfe83('0x10')][_0x5eb5c4[_0xfe83('0x43')][_0xfe83('0x25')]];var _0xc9b3a5=_0x5bfc49?_0x2588ce[_0xfe83('0x14')][_0x5bfc49]['id']:undefined;_0x2588ce['actions'][_0x5bca66]=new Action(_0x5eb5c4,_0x357c14,_0x5bca66,_0x5bfc49,_0xc9b3a5);var _0x58647e=_0x2588ce[_0xfe83('0x13')][_0x5bca66];_0x58647e[_0xfe83('0xaf')]=_0x2966e2;_0x58647e[_0xfe83('0x8a')]=_0xa51e84;_0x58647e['lookAgent']=_0x5bfc49;if(_[_0xfe83('0xf0')](_0x28130c)){_0x2588ce[_0xfe83('0xf1')](_0x58647e,_0x357c14,_0x5eb5c4,_0x5bfc49)[_0xfe83('0x5a')](function(_0x3d289a){logger[_0xfe83('0x41')](_0xfe83('0xf2'),_0xfe83('0xf3')+_0x58647e[_0xfe83('0x45')]+'\x20IdHopper:\x20'+_0x58647e[_0xfe83('0x8d')],JSON[_0xfe83('0x44')](_0x3d289a));ami[_0xfe83('0x22')](_0xfe83('0xf4'),ut[_0xfe83('0x7c')](_0x58647e,_0xfe83('0xf5'),_0x2588ce['campaignsPreview'][_0x58647e[_0xfe83('0x45')]]));_0x4688ac(ut[_0xfe83('0x4d')]('Calling'));})[_0xfe83('0x63')](function(_0x2aa9cd){ut[_0xfe83('0x2e')](_0xfe83('0xf6'),_0x2aa9cd);_0x5a8e7d(ut[_0xfe83('0x4d')](_0xfe83('0xf7'),_0x2966e2,_0xa51e84));});}else{_0x357c14[_0xfe83('0xf8')]+=0x1;ut[_0xfe83('0xf9')](_0x58647e);rpcDb[_0xfe83('0xfa')](_0x58647e,_0xfe83('0xfb'));delete _0x2588ce['actions'][_0x5bca66];_0x5a8e7d(ut[_0xfe83('0x4d')](_0xfe83('0xfc'),_0x2966e2,_0xa51e84));}});};Preview['prototype'][_0xfe83('0x73')]=function(_0x4e75c1){return!_['isNil'](_0x4e75c1)&&!_[_0xfe83('0x40')](_0x4e75c1[_0xfe83('0x25')])&&!_[_0xfe83('0x40')](_0x4e75c1[_0xfe83('0xfd')])&&_0x4e75c1[_0xfe83('0xfd')]&&!_[_0xfe83('0x40')](this[_0xfe83('0x12')][util[_0xfe83('0x24')]('SIP/%s',_0x4e75c1[_0xfe83('0x25')])])&&!_[_0xfe83('0x40')](this['trunks'][util[_0xfe83('0x24')](_0xfe83('0xfe'),_0x4e75c1['name'])][_0xfe83('0x4b')])&&(this[_0xfe83('0x12')][util[_0xfe83('0x24')](_0xfe83('0xfe'),_0x4e75c1[_0xfe83('0x25')])]['status']===_0xfe83('0xff')||this[_0xfe83('0x12')][util['format'](_0xfe83('0xfe'),_0x4e75c1[_0xfe83('0x25')])]['status']===_0xfe83('0x100'));};Preview['prototype']['run']=function(_0x5864ac,_0x197009){return this['execRun'](_0x5864ac,_0x197009)[_0xfe83('0x5a')](function(_0x29df56){return _[_0xfe83('0x46')](_0x29df56,['message']);})['catch'](function(_0x29c7fc){if(_0x29c7fc[_0xfe83('0x101')]){rpcDb[_0xfe83('0x102')](_0x5864ac);}if(_0x29c7fc[_0xfe83('0xfd')]){rpcDb['disableContact'](_0x5864ac);}throw _[_0xfe83('0x46')](_0x29c7fc,[_0xfe83('0x4d')]);});};Preview['prototype']['execRun']=function(_0x3a1a5b,_0x1c854a){var _0x2cd14f=this;var _0x1c7d9e,_0x48ea73;return rpcDb[_0xfe83('0x103')](_0x3a1a5b)[_0xfe83('0x5a')](function(_0x3868aa){if(!_[_0xfe83('0x40')](_0x3868aa[0x0])){_0x48ea73=_0x3868aa[0x0][_0xfe83('0x104')]?![]:!![];_0x1c7d9e=_0x3868aa[0x0][_0xfe83('0x104')]?!![]:![];_0x1c7d9e=_0x1c854a?!![]:_0x1c7d9e;}var _0x3a8519=_0x2cd14f['validateContact'](_0x3868aa);if(_0x3a8519[_0xfe83('0x105')]){rpcDb[_0xfe83('0x106')](_[_0xfe83('0x46')](_0x3868aa[0x0],[_0xfe83('0x49'),_0xfe83('0xef')]))[_0xfe83('0x5a')](function(_0x2564b0){_0x2cd14f[_0xfe83('0x107')](_0x2564b0,_0x3868aa[0x0],_0x1c854a,_0x48ea73,_0x1c7d9e)['then'](function(_0x1971aa){return _0x1971aa;})[_0xfe83('0x63')](function(_0x3f1722){throw _0x3f1722;});})[_0xfe83('0x63')](function(_0x21b82f){ut[_0xfe83('0x2e')](_0xfe83('0x108'),_0x21b82f);throw ut[_0xfe83('0x4d')](_0xfe83('0x109'),_0x48ea73,_0x1c7d9e);});}else{throw ut[_0xfe83('0x4d')](_0x3a8519[_0xfe83('0x4d')],_0x48ea73,_0x1c7d9e);}})['catch'](function(_0x24c5b1){ut['logger'](_0xfe83('0x10a'),_0x24c5b1);throw ut[_0xfe83('0x4d')](_0xfe83('0x109'),![],!![]);});};Preview[_0xfe83('0xd')][_0xfe83('0x10b')]=function(_0x16ff31){if(_[_0xfe83('0x40')](_0x16ff31)||_[_0xfe83('0xf0')](_0x16ff31)||!_[_0xfe83('0x40')](_0x16ff31[0x0][_0xfe83('0x5e')])&&_[_0xfe83('0x40')](_0x16ff31[0x0]['Agent'][_0xfe83('0x25')])){ut[_0xfe83('0x2e')](_0xfe83('0x10c'),_0x16ff31);return{'isValid':![],'message':_0xfe83('0x10d')};}var _0x963e74=this[_0xfe83('0x10')][_0x16ff31[0x0][_0xfe83('0x43')]['name']];_0x963e74['message']=utils[_0xfe83('0x2c')][_0xfe83('0x75')];if(_[_0xfe83('0x40')](_0x963e74)){ut[_0xfe83('0x2e')](_0xfe83('0x10e'),_0x963e74);return{'isValid':![],'message':_0xfe83('0x10f')};}if(!this[_0xfe83('0x73')](_0x963e74[_0xfe83('0x110')])){ut[_0xfe83('0x2e')](_0xfe83('0x111'),_0xfe83('0x112')+_0x963e74[_0xfe83('0x25')]+_0xfe83('0x113'));if(!this[_0xfe83('0x73')](_0x963e74['TrunkBackup'])){ut['logger'](_0xfe83('0x111'),_0x963e74[_0xfe83('0x25')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xfe83('0x114')};}}if(!ut['isActive'](_0x963e74['dialActive'])){ut[_0xfe83('0x2e')](_0xfe83('0x115'),_0x963e74[_0xfe83('0x25')]+_0xfe83('0x116'));return{'isValid':![],'message':_0xfe83('0x112')+_0x963e74['name']+_0xfe83('0x116')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xfe83('0xd')][_0xfe83('0xf1')]=function(_0x407c7f,_0x26670f,_0x440b03,_0x32481e){var _0xb9109b=this;return new Promise(function(_0x5a2b04,_0x35192c){var _0x4d7729=_0x407c7f[_0xfe83('0x92')];var _0x20440a=_0xb9109b[_0xfe83('0x73')](_0x26670f[_0xfe83('0x110')])?util['format'](_0xfe83('0x117'),_0x26670f['Trunk'][_0xfe83('0x25')],_[_0xfe83('0x40')](_0x26670f['dialPrefix'])?'':_0x26670f['dialPrefix']['trim']()||'',_0x26670f[_0xfe83('0x118')]>0x0?_0x440b03[_0xfe83('0xef')]['substring'](_0x26670f['dialCutDigit']):_0x440b03[_0xfe83('0xef')]):util[_0xfe83('0x24')](_0xfe83('0x117'),_[_0xfe83('0x40')](_0x26670f[_0xfe83('0x74')])?_0x26670f[_0xfe83('0x110')]['name']:_0x26670f[_0xfe83('0x74')][_0xfe83('0x25')],_[_0xfe83('0x40')](_0x26670f['dialPrefix'])?'':_0x26670f[_0xfe83('0x119')][_0xfe83('0x11a')]()||'',_0x26670f[_0xfe83('0x118')]>0x0?_0x440b03[_0xfe83('0xef')][_0xfe83('0x11b')](_0x26670f['dialCutDigit']):_0x440b03[_0xfe83('0xef')]);var _0x32b9f7=_0xb9109b[_0xfe83('0x73')](_0x26670f[_0xfe83('0x110')])?ut[_0xfe83('0x11c')](_0x26670f[_0xfe83('0x110')][_0xfe83('0x11d')],_0x26670f['dialOriginateCallerIdName'],_0x26670f[_0xfe83('0x11e')]>0x0?ut[_0xfe83('0x11f')](_0x26670f[_0xfe83('0x120')],_0x26670f['dialRandomLastDigitCallerIdNumber']):_0x26670f[_0xfe83('0x120')]):ut[_0xfe83('0x11c')](_[_0xfe83('0x40')](_0x26670f['TrunkBackup'])?_0x26670f[_0xfe83('0x110')][_0xfe83('0x11d')]:_0x26670f[_0xfe83('0x74')]['callerid'],_0x26670f['dialOriginateCallerIdName'],_0x26670f[_0xfe83('0x11e')]>0x0?ut[_0xfe83('0x11f')](_0x26670f[_0xfe83('0x120')],_0x26670f['dialRandomLastDigitCallerIdNumber']):_0x26670f[_0xfe83('0x120')]);if(_0x32b9f7){_0x407c7f[_0xfe83('0x121')]=ut['extractCalleridName'](_0x32b9f7);_0x407c7f[_0xfe83('0x122')]=ut[_0xfe83('0x123')](_0x32b9f7);}var _0x40aa2b=ut['addVariables'](_0x26670f,_0x440b03,_0x20440a,_0x32b9f7,_0x4d7729,_0x407c7f);var _0xbf9a3f=utils[_0xfe83('0x124')](_0x440b03[_0xfe83('0x125')]);Object['assign'](_0x40aa2b,_0xbf9a3f);_[_0xfe83('0x126')](_0x407c7f,ut[_0xfe83('0x127')](_0x40aa2b));_0x407c7f[_0xfe83('0x65')]=moment()[_0xfe83('0x24')]('YYYY-MM-DD\x20HH:mm:ss');_0x26670f[_0xfe83('0x128')]=_0x40aa2b;var _0x3ae50a=ut[_0xfe83('0x129')](_0x407c7f,_0x26670f,_0x40aa2b,_0x407c7f[_0xfe83('0x8a')],_0x32481e);return ami[_0xfe83('0x4a')](_0x3ae50a)[_0xfe83('0x5a')](function(_0x41ee07){_0x26670f[_0xfe83('0x29')]+=0x1;logger[_0xfe83('0x41')](_0xfe83('0x12a'),_0x4d7729,_0xfe83('0xa5'),_0x26670f['name'],_0xfe83('0x12b'),_0x26670f[_0xfe83('0x29')]);_0x5a2b04(_0x41ee07);})['catch'](function(_0x403a23){ut[_0xfe83('0xe3')](_0x407c7f,0xe,_0xfe83('0x12c'));rpcDb[_0xfe83('0xe1')](_0x407c7f,_0xfe83('0x12d'));_0x35192c(_0x403a23);});});};Preview[_0xfe83('0xd')][_0xfe83('0x12e')]=function(_0x2553d4){if(this[_0xfe83('0x13')][_0x2553d4['linkedid']]){this[_0xfe83('0x13')][_0x2553d4[_0xfe83('0x8b')]][_0xfe83('0x4c')]=_0x2553d4[_0xfe83('0x4c')];}};Preview[_0xfe83('0xd')][_0xfe83('0x12f')]=function(_0x144627){var _0xba816d=this;var _0x1c4774=this[_0xfe83('0x13')][_0x144627[_0xfe83('0x130')]];if(_0x1c4774){if(_0x1c4774[_0xfe83('0x131')]&&this['agents'][_0x1c4774[_0xfe83('0x131')]]){ut[_0xfe83('0x132')](_0x1c4774,this['agents'][_0x1c4774['lookAgent']][_0xfe83('0x25')],this[_0xfe83('0x14')][_0x1c4774[_0xfe83('0x131')]]['id']);}var _0x29b434=_['clone'](_0x1c4774);_0x29b434[_0xfe83('0x90')]=moment()[_0xfe83('0x24')](_0xfe83('0x66'));var _0x541c5d=_0xba816d[_0xfe83('0x10')][_0x1c4774[_0xfe83('0x45')]];if(ut[_0xfe83('0x133')](_0x144627[_0xfe83('0x134')])){if(_0x1c4774[_0xfe83('0xaf')]){rpcDb[_0xfe83('0x102')](_0x1c4774[_0xfe83('0x8d')]);}if(_0x1c4774[_0xfe83('0x8a')]){rpcDb[_0xfe83('0x64')](_0x1c4774[_0xfe83('0x8d')]);}ami[_0xfe83('0x22')](_0xfe83('0x135'),ut[_0xfe83('0x7c')](_0x1c4774,_0xfe83('0x136'),this[_0xfe83('0x10')][_0x1c4774['queue']]));this[_0xfe83('0xde')](_0x29b434,_0x541c5d,_0x144627);}else{_0x1c4774['starttime']=moment()['format'](_0xfe83('0x66'));ut['logAgent'](_0x29b434,0x4,_0xfe83('0x137'));rpcDb[_0xfe83('0xe1')](_0x29b434,_0xfe83('0x138'));}}};Preview[_0xfe83('0xd')][_0xfe83('0x139')]=function(_0x449fdb){var _0x2c3c32=this[_0xfe83('0x13')][_0x449fdb[_0xfe83('0x8b')]];var _0x2b9e4a;if(_0x2c3c32){_0x2b9e4a=this[_0xfe83('0x10')][_0x2c3c32[_0xfe83('0x45')]];logger[_0xfe83('0x41')](_0xfe83('0x13a'),_0x449fdb[_0xfe83('0x8b')],_0xfe83('0xa5'),_0x2b9e4a['name'],_0xfe83('0x93'),_0x2b9e4a['pTalking']);}if(this[_0xfe83('0x13')][_0x449fdb[_0xfe83('0x8b')]]&&_0x449fdb[_0xfe83('0x8b')]!==_0x449fdb[_0xfe83('0x92')]){if(_0x449fdb['cause']==='16'&&this[_0xfe83('0x13')][_0x449fdb['linkedid']]['dialAnswer']){this[_0xfe83('0x76')](_0x449fdb,_0x449fdb[_0xfe83('0x8b')],_0x449fdb[_0xfe83('0x13b')]);}else if(this[_0xfe83('0x13')][_0x449fdb[_0xfe83('0x8b')]]['dialAnswer']){logger[_0xfe83('0x41')](_0xfe83('0x13c'),_0x449fdb[_0xfe83('0x8b')],_0x449fdb[_0xfe83('0x13b')],_0xfe83('0xa5'),_0x2b9e4a[_0xfe83('0x25')],_0xfe83('0x93'),_0x2b9e4a[_0xfe83('0x2a')]);this[_0xfe83('0x76')](_0x449fdb,_0x449fdb[_0xfe83('0x8b')],_0x449fdb['cause']);}}else if(_0x2c3c32&&_[_0xfe83('0x40')](_0x2c3c32[_0xfe83('0x13d')])&&_0x2b9e4a[_0xfe83('0x13e')]&&_0x449fdb[_0xfe83('0x8b')]===_0x449fdb[_0xfe83('0x92')]&&_['isNil'](_0x449fdb[_0xfe83('0xe8')])&&_0x449fdb['cause']==='16'&&_0x449fdb[_0xfe83('0x13f')]==='6'&&_['isUndefined'](_0x2c3c32[_0xfe83('0x140')])){if(_0x2c3c32[_0xfe83('0xaf')]){rpcDb[_0xfe83('0x102')](_0x2c3c32[_0xfe83('0x8d')]);}if(_0x2c3c32[_0xfe83('0x8a')]){rpcDb[_0xfe83('0x64')](_0x2c3c32[_0xfe83('0x8d')]);}_0x449fdb[_0xfe83('0xe8')]='22';this[_0xfe83('0xde')](_0x2c3c32,_0x2b9e4a,_0x449fdb);}else if(_0x2c3c32&&_0x2c3c32['transfer']){if(_0x449fdb[_0xfe83('0x13b')]==='16'&&this[_0xfe83('0x13')][_0x449fdb[_0xfe83('0x8b')]][_0xfe83('0x4f')]){logger[_0xfe83('0x41')]('[syncHangup][talking][transfer]',_0x449fdb[_0xfe83('0x8b')],_0x449fdb[_0xfe83('0x13b')],_0xfe83('0xa5'),_0x2b9e4a[_0xfe83('0x25')],'pTalking:\x20',_0x2b9e4a[_0xfe83('0x2a')]);this['callProgressDetectingCustomer'](_0x449fdb,_0x449fdb[_0xfe83('0x8b')],_0x449fdb[_0xfe83('0x13b')]);}else if(this[_0xfe83('0x13')][_0x449fdb['linkedid']]['dialAnswer']){logger[_0xfe83('0x41')](_0xfe83('0x13c'),_0x449fdb[_0xfe83('0x8b')],_0x449fdb[_0xfe83('0x13b')],'\x20Queue',_0x2b9e4a[_0xfe83('0x25')],_0xfe83('0x93'),_0x2b9e4a[_0xfe83('0x2a')]);this[_0xfe83('0x76')](_0x449fdb,_0x449fdb[_0xfe83('0x8b')],_0x449fdb[_0xfe83('0x13b')]);}}};Preview[_0xfe83('0xd')][_0xfe83('0x1b')]=function(_0x3da189){if(this[_0xfe83('0x13')][_0x3da189[_0xfe83('0xdc')]]&&_0x3da189[_0xfe83('0xdc')]!==_0x3da189['destuniqueid']){this[_0xfe83('0x76')](_0x3da189,_0x3da189['destlinkedid'],_0x3da189[_0xfe83('0xd4')]);}};Preview['prototype'][_0xfe83('0x19')]=function(_0x23e9d8){if(this[_0xfe83('0x13')][_0x23e9d8['linkedid']]&&_0x23e9d8['linkedid']!==_0x23e9d8[_0xfe83('0x92')]&&!this[_0xfe83('0x13')][_0x23e9d8[_0xfe83('0x8b')]][_0xfe83('0x4f')]){if(_0x23e9d8[_0xfe83('0x13b')]==='1'){this['callProgressDetectingCustomer'](_0x23e9d8,_0x23e9d8['linkedid'],_0x23e9d8[_0xfe83('0x13b')]);}}};Preview[_0xfe83('0xd')]['addVariable']=function(_0x42fb78,_0x5b8ce7,_0x1d0006){if(this[_0xfe83('0x13')][_0x42fb78]){if(_['isNil'](this[_0xfe83('0x13')][_0x42fb78][_0xfe83('0x128')])){this['actions'][_0x42fb78]['variables']={};}this['actions'][_0x42fb78][_0xfe83('0x128')][_0x5b8ce7]=_0x1d0006;}};Preview[_0xfe83('0xd')][_0xfe83('0x1e')]=function(_0x48021e){try{if(!_[_0xfe83('0x40')](_0x48021e)){if(ut[_0xfe83('0x141')](_['keys'](_0x48021e[_0xfe83('0x142')])[0x0])){this[_0xfe83('0x143')](_0x48021e['uniqueid'],_[_0xfe83('0x144')](_0x48021e[_0xfe83('0x142')])[0x0],_0x48021e[_0xfe83('0x145')]);}}}catch(_0x3b8f70){logger['error'](_0xfe83('0x146'),util[_0xfe83('0x147')](_0x3b8f70,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x4982cc){if(_0x4982cc){if(this[_0xfe83('0x13')][_0x4982cc['transfertargetlinkedid']]){this['actions'][_0x4982cc['transfertargetlinkedid']][_0xfe83('0x140')]=!![];}}};Preview[_0xfe83('0xd')][_0xfe83('0x148')]=function(_0x5f3ef2){if(_0x5f3ef2){if(this[_0xfe83('0x13')][_0x5f3ef2[_0xfe83('0x149')]]){this[_0xfe83('0x13')][_0x5f3ef2['transfererlinkedid']][_0xfe83('0x140')]=!![];}}};module[_0xfe83('0x14a')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 6124028..2dd2a58 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 _0x4aa3=['endtime','context','exten','xcally-motion-preview','lastAssignedTo','membername','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','createHistory','[createHistory]\x20','then','checkIsBlackList','catch','[checkIsBlackList]\x20','resolve','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt'];(function(_0x4bfbf4,_0x582cfa){var _0xc4f83c=function(_0x4df356){while(--_0x4df356){_0x4bfbf4['push'](_0x4bfbf4['shift']());}};_0xc4f83c(++_0x582cfa);}(_0x4aa3,0x1bd));var _0x34aa=function(_0x295e63,_0x1cbc72){_0x295e63=_0x295e63-0x0;var _0x165e9a=_0x4aa3[_0x295e63];return _0x165e9a;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x34aa('0x0'))('preview');var cmHopper=require(_0x34aa('0x1'));var cmHopperHistory=require(_0x34aa('0x2'));var cmHopperBlack=require(_0x34aa('0x3'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x34aa('0x4'));function loggerCatch(_0x120acc){return function(_0x25686d){logger['error'](_0x120acc,util['inspect'](_0x25686d,{'showHidden':![],'depth':null}));};}function create(_0x5f07e6){return cmHopperHistory[_0x34aa('0x5')](_0x5f07e6)['catch'](loggerCatch(_0x34aa('0x6')));}function createAgent(_0x3f84ea){return BPromise['resolve']()[_0x34aa('0x7')](agentReportPreview[_0x34aa('0x5')](_0x3f84ea))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x708b3c){return cmHopper['moveContactManagedDialer'](_0x708b3c,!![])['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x34aa('0x8')]=function(_0x3cb79c){return cmHopperBlack['checkIsBlackList'](_0x3cb79c)[_0x34aa('0x9')](loggerCatch(_0x34aa('0xa')));};exports['getContactPreview']=function(_0x69d067){return BPromise[_0x34aa('0xb')]()[_0x34aa('0x7')](cmHopper[_0x34aa('0xc')](_0x69d067))[_0x34aa('0x9')](loggerCatch(_0x34aa('0xd')));};exports['createHistory']=function(_0x228833,_0x51e56b){create(_0x228833)[_0x34aa('0x9')](loggerCatch(_0x51e56b));moveContact(_0x228833)['catch'](loggerCatch(_0x51e56b));};exports[_0x34aa('0xe')]=function(_0x2a50a8,_0x503b09){createAgent(_0x2a50a8)[_0x34aa('0x9')](loggerCatch(_0x503b09));};exports['createCustomerHistory']=function(_0x3d8eb0,_0x3219fa){create(_0x3d8eb0)[_0x34aa('0x9')](loggerCatch(_0x3219fa));};exports[_0x34aa('0xf')]=function(_0x1a5bf8,_0x4992f4){moveContact(_0x1a5bf8)[_0x34aa('0x9')](loggerCatch(_0x4992f4));};exports['rescheduleContact']=function(_0x12e660,_0x12fad5,_0x2d8236){if(_0x12fad5){_0x12e660[_0x34aa('0x10')]=null;}if(_0x2d8236){_0x12e660[_0x34aa('0x11')]=![];}return cmHopper['rescheduleContact'](_0x12e660)[_0x34aa('0x9')](loggerCatch(_0x34aa('0x12')));};exports[_0x34aa('0x13')]=function(_0x1a092f){return cmHopper[_0x34aa('0x13')](_0x1a092f)[_0x34aa('0x9')](loggerCatch(_0x34aa('0x14')));};exports[_0x34aa('0x15')]=function(_0x39920e){return cmHopper[_0x34aa('0x15')]({'UserId':null},_0x39920e,0x1)['catch'](loggerCatch(_0x34aa('0x16')));};exports[_0x34aa('0x17')]=function(_0x4814ed){return cmHopper[_0x34aa('0x15')]({'active':![]},_0x4814ed,0x1)[_0x34aa('0x9')](loggerCatch(_0x34aa('0x18')));};exports[_0x34aa('0x19')]=function(_0x24f7ec){var _0x134718={};_0x134718[_0x34aa('0x1a')]=_0x24f7ec[_0x34aa('0x1a')];_0x134718[_0x34aa('0x1b')]=_0x24f7ec[_0x34aa('0x1b')];_0x134718['calleridnum']=_0x24f7ec[_0x34aa('0x1c')];_0x134718[_0x34aa('0x1d')]=_0x24f7ec[_0x34aa('0x1d')];_0x134718[_0x34aa('0x1e')]=_0x24f7ec[_0x34aa('0x1e')];_0x134718['queuecallerjoinAt']=_0x24f7ec['answertime'];_0x134718[_0x34aa('0x1f')]=_0x24f7ec[_0x34aa('0x20')];_0x134718[_0x34aa('0x21')]=0x1;_0x134718[_0x34aa('0x22')]=_0x24f7ec[_0x34aa('0x23')];_0x134718['connectedlinename']=_0x24f7ec['membername'];_0x134718[_0x34aa('0x24')]='from-sip';_0x134718[_0x34aa('0x25')]=_0x34aa('0x26');_0x134718['holdtime']=0x0;_0x134718['assigned']=0x1;_0x134718[_0x34aa('0x27')]=_0x24f7ec[_0x34aa('0x28')];_0x134718['queuecallerexitreason']=_0x34aa('0x29');return BPromise[_0x34aa('0xb')]()[_0x34aa('0x7')](voiceQueueReport[_0x34aa('0x2a')](_0x134718))[_0x34aa('0x9')](loggerCatch(_0x34aa('0x2b')));};exports[_0x34aa('0x2c')]=function(_0x1be92b,_0x20739b){return BPromise['resolve']()[_0x34aa('0x7')](cmHopper[_0x34aa('0x2c')](_0x1be92b,_0x20739b))[_0x34aa('0x9')](loggerCatch(_0x34aa('0x2d')));};exports[_0x34aa('0x2e')]=function(_0x383215){return cmHopper['rescheduleContact'](_0x383215,!![],!![])[_0x34aa('0x9')](loggerCatch(_0x34aa('0x2f')));}; \ No newline at end of file +var _0x11cb=['getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','rescheduleContact','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','catch','[createHistory]\x20','resolve','then','createHistory','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','calleridnum','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20'];(function(_0x16d09a,_0x4d863a){var _0x567bca=function(_0x4d72a3){while(--_0x4d72a3){_0x16d09a['push'](_0x16d09a['shift']());}};_0x567bca(++_0x4d863a);}(_0x11cb,0x13d));var _0xb11c=function(_0x166551,_0x30c7f1){_0x166551=_0x166551-0x0;var _0x5204b4=_0x11cb[_0x166551];return _0x5204b4;};'use strict';var util=require('util');var BPromise=require(_0xb11c('0x0'));var logger=require(_0xb11c('0x1'))(_0xb11c('0x2'));var cmHopper=require(_0xb11c('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xb11c('0x4'));var agentReportPreview=require(_0xb11c('0x5'));var voiceQueueReport=require(_0xb11c('0x6'));function loggerCatch(_0x39b652){return function(_0x1eb641){logger[_0xb11c('0x7')](_0x39b652,util['inspect'](_0x1eb641,{'showHidden':![],'depth':null}));};}function create(_0x3e22bf){return cmHopperHistory['createHistory'](_0x3e22bf)[_0xb11c('0x8')](loggerCatch(_0xb11c('0x9')));}function createAgent(_0x3a46ed){return BPromise[_0xb11c('0xa')]()[_0xb11c('0xb')](agentReportPreview[_0xb11c('0xc')](_0x3a46ed))[_0xb11c('0x8')](loggerCatch(_0xb11c('0x9')));}function moveContact(_0x57e914){return cmHopper[_0xb11c('0xd')](_0x57e914,!![])[_0xb11c('0x8')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xb11c('0xe')]=function(_0x2c5a3e){return cmHopperBlack['checkIsBlackList'](_0x2c5a3e)[_0xb11c('0x8')](loggerCatch(_0xb11c('0xf')));};exports[_0xb11c('0x10')]=function(_0x4a3dd9){return BPromise['resolve']()['then'](cmHopper[_0xb11c('0x10')](_0x4a3dd9))['catch'](loggerCatch(_0xb11c('0x11')));};exports[_0xb11c('0xc')]=function(_0x4e224a,_0x5a969e){create(_0x4e224a)['catch'](loggerCatch(_0x5a969e));moveContact(_0x4e224a)['catch'](loggerCatch(_0x5a969e));};exports[_0xb11c('0x12')]=function(_0x561238,_0x4f729c){createAgent(_0x561238)[_0xb11c('0x8')](loggerCatch(_0x4f729c));};exports['createCustomerHistory']=function(_0x43adb7,_0x1b865f){create(_0x43adb7)[_0xb11c('0x8')](loggerCatch(_0x1b865f));};exports[_0xb11c('0x13')]=function(_0xa3c26c,_0x18a873){moveContact(_0xa3c26c)['catch'](loggerCatch(_0x18a873));};exports['rescheduleContact']=function(_0x37fd21,_0x41547a,_0x4ebe54){if(_0x41547a){_0x37fd21[_0xb11c('0x14')]=null;}if(_0x4ebe54){_0x37fd21['active']=![];}return cmHopper['rescheduleContact'](_0x37fd21)[_0xb11c('0x8')](loggerCatch(_0xb11c('0x15')));};exports[_0xb11c('0x16')]=function(_0x40a6db){return cmHopper[_0xb11c('0x16')](_0x40a6db)[_0xb11c('0x8')](loggerCatch(_0xb11c('0x17')));};exports[_0xb11c('0x18')]=function(_0x2ae849){return cmHopper[_0xb11c('0x18')]({'UserId':null},_0x2ae849,0x1)[_0xb11c('0x8')](loggerCatch(_0xb11c('0x19')));};exports[_0xb11c('0x1a')]=function(_0xa2f338){return cmHopper[_0xb11c('0x18')]({'active':![]},_0xa2f338,0x1)[_0xb11c('0x8')](loggerCatch(_0xb11c('0x1b')));};exports[_0xb11c('0x1c')]=function(_0x35fbb4){var _0x586acd={};_0x586acd[_0xb11c('0x1d')]=_0x35fbb4[_0xb11c('0x1d')];_0x586acd['uniqueid']=_0x35fbb4['uniqueid'];_0x586acd[_0xb11c('0x1e')]=_0x35fbb4[_0xb11c('0x1e')];_0x586acd['calleridname']=_0x35fbb4['calleridname'];_0x586acd[_0xb11c('0x1f')]=_0x35fbb4[_0xb11c('0x1f')];_0x586acd[_0xb11c('0x20')]=_0x35fbb4['answertime'];_0x586acd['queuecallerleaveAt']=_0x35fbb4[_0xb11c('0x21')];_0x586acd[_0xb11c('0x22')]=0x1;_0x586acd[_0xb11c('0x23')]=_0x35fbb4[_0xb11c('0x24')];_0x586acd[_0xb11c('0x25')]=_0x35fbb4[_0xb11c('0x26')];_0x586acd[_0xb11c('0x27')]='from-sip';_0x586acd[_0xb11c('0x28')]=_0xb11c('0x29');_0x586acd['holdtime']=0x0;_0x586acd[_0xb11c('0x2a')]=0x1;_0x586acd[_0xb11c('0x2b')]=_0x35fbb4['membername'];_0x586acd['queuecallerexitreason']=_0xb11c('0x2c');return BPromise[_0xb11c('0xa')]()[_0xb11c('0xb')](voiceQueueReport[_0xb11c('0x2d')](_0x586acd))[_0xb11c('0x8')](loggerCatch(_0xb11c('0x2e')));};exports[_0xb11c('0x2f')]=function(_0x4aac97,_0x1ebfdd){return BPromise[_0xb11c('0xa')]()[_0xb11c('0xb')](cmHopper[_0xb11c('0x2f')](_0x4aac97,_0x1ebfdd))[_0xb11c('0x8')](loggerCatch(_0xb11c('0x30')));};exports[_0xb11c('0x31')]=function(_0x26313d){return cmHopper[_0xb11c('0x32')](_0x26313d,!![],!![])[_0xb11c('0x8')](loggerCatch(_0xb11c('0x33')));}; \ 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 19e97e1..c2c210e 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 _0xa55c=['\x22\x22\x20<>','isActive','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','dialQueueProject2','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','toLower','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','endtime','logAgent','responsetime','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','starttime','talktime','answertime','isFailure','Failure','RECALL','originate','channelAgent','from-sip','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','isNil','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','interface','motionChannel','mandatoryDisposition','buildObj','agentReadyId','hasOwnProperty','status','reachable','push','milliseconds','diff','seconds','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosrtt','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','buildNoAnswerEventPayload','util','lodash','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>'];(function(_0x7320f2,_0x4c448f){var _0x136104=function(_0x32b080){while(--_0x32b080){_0x7320f2['push'](_0x7320f2['shift']());}};_0x136104(++_0x4c448f);}(_0xa55c,0x181));var _0xca55=function(_0x219e40,_0x334cc3){_0x219e40=_0x219e40-0x0;var _0x519e97=_0xa55c[_0x219e40];return _0x519e97;};'use strict';var util=require(_0xca55('0x0'));var _=require(_0xca55('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')('preview');var ipAgi=process['env']['XCALLY_IP_AGI']||_0xca55('0x2');var utils=require(_0xca55('0x3'));exports[_0xca55('0x4')]=function(_0x3cd57b){return function(_0x4339a2){logger[_0xca55('0x5')](_0x3cd57b,util[_0xca55('0x6')](_0x4339a2,{'showHidden':![],'depth':null}));};};exports[_0xca55('0x7')]=function(_0x135ae5,_0x1d84f0){logger[_0xca55('0x8')](_0x135ae5,util[_0xca55('0x6')](_0x1d84f0,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x26e0e5,_0x2d5a7d){logger['error'](_0x26e0e5,util[_0xca55('0x6')](_0x2d5a7d,{'showHidden':![],'depth':null}));};exports[_0xca55('0x9')]=function(_0x28e480){return function(_0x225c6d){logger[_0xca55('0x8')](_0x28e480,util[_0xca55('0x6')](_0x225c6d,{'showHidden':![],'depth':null}));};};exports[_0xca55('0xa')]=function(_0x919c04,_0x29df82,_0xc8a1f9){return{'message':_0x919c04,'unlock':_0x29df82,'active':_0xc8a1f9};};exports[_0xca55('0xb')]=function(_0x1230bb,_0x32add1,_0x6e7f17){if(!_[_0xca55('0xc')](_0x6e7f17)&&_0xca55('0xd')===typeof _0x6e7f17&&!_[_0xca55('0xe')](_0x6e7f17)){if(!_[_0xca55('0xc')](_0x32add1)&&_0xca55('0xd')===typeof _0x32add1&&!_['isEmpty'](_0x32add1)){return util[_0xca55('0xf')](_0xca55('0x10'),_0x32add1,_0x6e7f17);}return util[_0xca55('0xf')](_0xca55('0x10'),_0x6e7f17,_0x6e7f17);}if(!_[_0xca55('0xc')](_0x1230bb)&&_0xca55('0xd')===typeof _0x1230bb&&!_[_0xca55('0xe')](_0x1230bb)){return _0x1230bb;}return _0xca55('0x11');};exports[_0xca55('0x12')]=function(_0x497c97){if(_['isNil'](_0x497c97)){return![];}return _0x497c97;};exports[_0xca55('0x13')]=function(_0x18caa4,_0x4a28e9,_0x9b9fe7,_0x2ce33a,_0xd70b51,_0x335205){var _0x1b67ad={'XMD-QUEUE':_0x4a28e9[_0xca55('0x14')]?_0x4a28e9[_0xca55('0x14')]['name']:'','XMD-CALLERID':_0x2ce33a,'XMD-CALLERID-PREVIEW':_0x335205?util[_0xca55('0xf')](_0xca55('0x10'),_0x335205[_0xca55('0x15')],_0x335205[_0xca55('0x16')]):_0x2ce33a,'XMD-DIALID':_0xd70b51,'XMD-CONTACTID':_0x4a28e9[_0xca55('0x17')],'XMD-CDRTYPE':_0xca55('0x18'),'CALLERID(all)':_0x2ce33a,'XMD-VOICEQUEUEID':_0x4a28e9[_0xca55('0x19')],'XMD-DIALCHANNEL':_0x9b9fe7,'XMD-DIALTIMEOUT':_0x18caa4['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xca55('0xf')]('\x22rtTxX%s%s\x22',_0x18caa4['dialQueueProject2']?'g':'',_[_0xca55('0xe')](_0x18caa4[_0xca55('0x1a')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x18caa4[_0xca55('0x1b')]||'','XMD-AGI':_0x18caa4['dialQueueProject']?util[_0xca55('0xf')](_0xca55('0x1c'),ipAgi,_0x18caa4[_0xca55('0x1d')]):_0xca55('0x1e'),'XMD-AGIAFTER':_0x18caa4[_0xca55('0x1f')]?util[_0xca55('0xf')]('\x22agi://%s/square,%s\x22',ipAgi,_0x18caa4[_0xca55('0x1f')]):_0xca55('0x1e'),'XMD-ORIGINATECALLERIDNUM':_0x335205?_0x335205['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x335205?_0x335205[_0xca55('0x20')]:'','XMD-DESTINATION':_0xca55('0x21'),'SIPADDHEADER':_0xca55('0x22')};if(!_[_0xca55('0xe')](_0x18caa4[_0xca55('0x1a')])){_0x1b67ad[util[_0xca55('0xf')]('%s',_0xca55('0x23'))]=_0x18caa4[_0xca55('0x1a')];_0x1b67ad[util[_0xca55('0xf')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0xd70b51;}return _0x1b67ad;};exports[_0xca55('0x24')]=function(_0x39c488){var _0x2ea865={};for(var _0x1e45e1 in _0x39c488){if(_0x39c488['hasOwnProperty'](_0x1e45e1)){_0x2ea865[util[_0xca55('0xf')]('%s',_[_0xca55('0x25')](_0x1e45e1))]=_0x39c488[_0x1e45e1];}}return{'variables':_0x2ea865};};exports[_0xca55('0x26')]=function(_0x59282e){var _0xb32da4=moment()[_0xca55('0xf')](_0xca55('0x27'));_0x59282e[_0xca55('0x28')]=0xd;_0x59282e[_0xca55('0x29')]='Blacklist';_0x59282e['starttime']=_0xb32da4;_0x59282e['responsetime']=_0xb32da4;_0x59282e[_0xca55('0x2a')]=_0xb32da4;};exports[_0xca55('0x2b')]=function(_0x3a7637,_0x1ae79a,_0x28ab50){var _0x3172dc=moment()[_0xca55('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x3a7637[_0xca55('0x28')]=_0x1ae79a;_0x3a7637[_0xca55('0x29')]=_0x28ab50;_0x3a7637[_0xca55('0x2c')]=_0x3172dc;_0x3a7637[_0xca55('0x2d')]=utils[_0xca55('0x2e')](_0x3a7637[_0xca55('0x2c')],_0x3a7637['starttime']);};exports[_0xca55('0x2f')]=function(_0x30fb65,_0x15aeb6,_0x53c905){_0x30fb65[_0xca55('0x30')]=_0x15aeb6;_0x30fb65[_0xca55('0x31')]=_0x53c905;};exports[_0xca55('0x32')]=function(_0x16fe31,_0x1c4169,_0x5389ec){var _0x4dc41a=moment()[_0xca55('0xf')](_0xca55('0x27'));_0x16fe31['state']=_0x1c4169;_0x16fe31[_0xca55('0x29')]=_0x5389ec;_0x16fe31[_0xca55('0x2c')]=_0x16fe31['responsetime']?_0x16fe31[_0xca55('0x2c')]:_0x4dc41a;_0x16fe31['endtime']=_0x16fe31[_0xca55('0x2a')]?_0x16fe31[_0xca55('0x2a')]:_0x4dc41a;_0x16fe31['ringtime']=utils['getSeconds'](_0x16fe31[_0xca55('0x2c')]||0x0,_0x16fe31[_0xca55('0x33')]||0x0);_0x16fe31[_0xca55('0x34')]=_0x16fe31[_0xca55('0x35')]?utils[_0xca55('0x2e')](_0x16fe31[_0xca55('0x2a')],_0x16fe31[_0xca55('0x35')]):0x0;};exports[_0xca55('0x36')]=function(_0xd2aefb){return _0xd2aefb===_0xca55('0x37');};exports['variablesAction']=function(_0x540c9e,_0xde13a9,_0x4bc014,_0x5c8a99,_0x510877){var _0x9ebb4f=_0x5c8a99?_0xca55('0x38'):_0x540c9e[_0xca55('0x15')];_0x9ebb4f=_0x510877?'BOOKED':_0x9ebb4f;return{'actionid':_0x540c9e['uniqueid'],'action':_0xca55('0x39'),'channel':_0x540c9e[_0xca55('0x3a')],'callerid':util[_0xca55('0xf')](_0xca55('0x10'),_0x9ebb4f,_0x540c9e[_0xca55('0x16')]),'Exten':'xcally-motion-preview','Context':_0xca55('0x3b'),'Priority':'1','variable':_0x4bc014,'timeout':(_0xde13a9['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x540c9e[_0xca55('0x3c')]};};exports[_0xca55('0x3d')]=function(_0x3f6bcb){return _0x3f6bcb[_0xca55('0x3e')]+_0x3f6bcb[_0xca55('0x3f')]+_0x3f6bcb[_0xca55('0x40')]+_0x3f6bcb['countagentrejectretry']+_0x3f6bcb[_0xca55('0x41')];};exports['cloneAction']=function(_0x3cd516){var _0x4a1f27=_[_0xca55('0x42')](_0x3cd516);_0x4a1f27[_0xca55('0x28')]=0xf;_0x4a1f27[_0xca55('0x29')]=_0xca55('0x43');return _0x4a1f27;};exports[_0xca55('0x44')]=function(_0x3a8f6c,_0x24e941,_0x548ec8){var _0x2817e2={};_0x2817e2[_0x24e941]=_0x3a8f6c[_0x24e941];_0x2817e2[_0xca55('0x45')]=![];_0x2817e2[_0xca55('0x46')]=moment()[_0xca55('0x47')](_0x548ec8,_0xca55('0x48'))[_0xca55('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x2817e2[_0xca55('0x17')]=_0x3a8f6c[_0xca55('0x17')];_0x2817e2[_0xca55('0x49')]=_0x3a8f6c[_0xca55('0x49')];_0x2817e2[_0xca55('0x19')]=_0x3a8f6c['VoiceQueueId']||undefined;return _0x2817e2;};exports['decrementTalking']=function(_0x3de9ca,_0x2d65da){if(!_[_0xca55('0x4a')](_0x3de9ca)){if(_0x3de9ca[_0xca55('0x4b')]>0x0){_0x3de9ca[_0xca55('0x4b')]-=0x1;}else{logger[_0xca55('0x8')](_0x2d65da,_0xca55('0x4c'));}}else{logger[_0xca55('0x5')](_0x2d65da,_0xca55('0x4d'));}};exports[_0xca55('0x4e')]=function(_0x3fdf00){if(_0x3fdf00<=0x0){return!![];}return![];};function buildObj(_0xa7f12a,_0x3a25f9,_0x41140f){_0xa7f12a[_0xca55('0x4f')]=_0x3a25f9;_0xa7f12a[_0xca55('0x50')]=_0xa7f12a[_0xca55('0x51')];_0xa7f12a[_0xca55('0x52')]=_0xa7f12a[_0xca55('0x3a')];_0xa7f12a[_0xca55('0x53')]='voice';if(_0x41140f){_0xa7f12a[_0xca55('0x54')]=_0x41140f['mandatoryDisposition'];}return _0xa7f12a;}exports[_0xca55('0x55')]=buildObj;exports[_0xca55('0x56')]=function(_0x504e3a){var _0x52ea8a=[];for(var _0x5f0367 in _0x504e3a){if(_0x504e3a[_0xca55('0x57')](_0x5f0367)){if(!_[_0xca55('0x4a')](_0x504e3a[_0x5f0367])&&_0x504e3a[_0x5f0367][_0xca55('0x28')]==='not_inuse'&&_0x504e3a[_0x5f0367][_0xca55('0x58')]===_0xca55('0x59')){_0x52ea8a[_0xca55('0x5a')](_0x504e3a[_0x5f0367]['id']);}}}return _0x52ea8a;};exports['getDiff']=function(_0x2ddb25){var _0x537e04=moment()[_0xca55('0x5b')](0x0);var _0x4f3db9=moment(_0x2ddb25)[_0xca55('0x5b')](0x0);return _0x537e04[_0xca55('0x5c')](_0x4f3db9,_0xca55('0x5d'));};exports[_0xca55('0x5e')]=function(_0x3cb3a6){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3cb3a6[_0xca55('0x17')],'ListId':_0x3cb3a6['ListId'],'VoiceQueueId':_0x3cb3a6[_0xca55('0x19')]||undefined,'CampaignId':_0x3cb3a6[_0xca55('0x5f')]||undefined};};exports[_0xca55('0x60')]=function(_0x42fb5c){if(_0x42fb5c===_0xca55('0x3c')||_0x42fb5c==='idContact'||_0x42fb5c===_0xca55('0x51')||_0x42fb5c===_0xca55('0x61')||_0x42fb5c===_0xca55('0x62')||_0x42fb5c===_0xca55('0x63')||_0x42fb5c===_0xca55('0x30')||_0x42fb5c===_0xca55('0x3a')||_0x42fb5c===_0xca55('0x15')||_0x42fb5c===_0xca55('0x45')||_0x42fb5c===_0xca55('0x16')||_0x42fb5c==='scheduledat'||_0x42fb5c===_0xca55('0x3e')||_0x42fb5c==='countcongestionretry'||_0x42fb5c==='countnoanswerretry'||_0x42fb5c===_0xca55('0x64')||_0x42fb5c===_0xca55('0x65')||_0x42fb5c===_0xca55('0x66')||_0x42fb5c===_0xca55('0x67')||_0x42fb5c==='recallme'||_0x42fb5c===_0xca55('0x17')||_0x42fb5c===_0xca55('0x49')||_0x42fb5c===_0xca55('0x31')||_0x42fb5c===_0xca55('0x19')||_0x42fb5c===_0xca55('0x68')||_0x42fb5c===_0xca55('0x69')||_0x42fb5c===_0xca55('0x6a')||_0x42fb5c==='xmd-phone'||_0x42fb5c===_0xca55('0x6b')||_0x42fb5c===_0xca55('0x6c')||_0x42fb5c===_0xca55('0x6d')||_0x42fb5c===_0xca55('0x6e')||_0x42fb5c===_0xca55('0x6f')||_0x42fb5c===_0xca55('0x70')||_0x42fb5c==='xmd-contactid'||_0x42fb5c==='xmd-cdrtype'||_0x42fb5c==='xmd-callerid'||_0x42fb5c===_0xca55('0x71')||_0x42fb5c===_0xca55('0x72')||_0x42fb5c===_0xca55('0x73')||_0x42fb5c===_0xca55('0x74')||_0x42fb5c==='rtpaudioqosjitter'||_0x42fb5c===_0xca55('0x75')||_0x42fb5c===_0xca55('0x76')||_0x42fb5c===_0xca55('0x77')||_0x42fb5c==='rtpaudioqosrtt'||_0x42fb5c===_0xca55('0x78')||_0x42fb5c===_0xca55('0x73')||_0x42fb5c===_0xca55('0x74')||_0x42fb5c==='rtpaudioqosjitter'||_0x42fb5c===_0xca55('0x75')||_0x42fb5c===_0xca55('0x76')||_0x42fb5c==='rtpaudioqoslossbridged'||_0x42fb5c===_0xca55('0x79')||_0x42fb5c===_0xca55('0x78')||_0x42fb5c==='bridgepeer'||_0x42fb5c==='bridgepvtcallid'||_0x42fb5c===_0xca55('0x28')||_0x42fb5c===_0xca55('0x29')){return![];}return!![];};exports[_0xca55('0x7a')]=function(_0x5edfb2,_0x65c0d9){var _0x548351,_0x425c9a,_0x4dac5a;if(_0x65c0d9<=0x0){_0x65c0d9=0x1;}_0x548351=new RegExp(_0xca55('0x7b')+_0x65c0d9+'}$');_0x425c9a=Math[_0xca55('0x7c')](0xa,_0x65c0d9-0x1);_0x4dac5a=Math[_0xca55('0x7c')](0xa,_0x65c0d9)-0x1;return util['format']('%s',_[_0xca55('0x7d')](_0x5edfb2,_0x548351,_[_0xca55('0x7e')](_0x425c9a,_0x4dac5a)));};exports[_0xca55('0x7f')]=function(_0x14e285){var _0xb8baef=_0x14e285[_0xca55('0x80')](/"(.*?)"/);return _0xb8baef?_0xb8baef[0x1]:_0x14e285;};exports[_0xca55('0x81')]=function(_0x4f1276){var _0x4ba3f5=_0x4f1276[_0xca55('0x80')](/<(.*?)>/);return _0x4ba3f5?_0x4ba3f5[0x1]:_0x4f1276;};function buildNoAnswerEventPayload(_0x4dabe9,_0x4bdd79){var _0x21143c=buildObj(_0x4dabe9,_0xca55('0x82'));if(!_[_0xca55('0xe')](_0x4bdd79[_0xca55('0x83')])){Object[_0xca55('0x84')](_0x4bdd79[_0xca55('0x83')])['forEach'](function(_0x456318){_0x21143c[_0x456318['toLowerCase']()]=_0x4bdd79['variables'][_0x456318];});}return _0x21143c;}exports[_0xca55('0x85')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xce73=['\x22agi://%s/square,%s\x22','NONE','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','logAgent','getSeconds','starttime','membername','UserId','logCustomer','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','ListId','decrementTalking','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','error','[decrementTalking]\x20is\x20null\x20or\x20undefined','lastevent','queue','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','status','reachable','push','getDiff','milliseconds','diff','seconds','type','campaigntype','dialAnswer','channelAgent','countbusyretry','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-dialtimeout','xmd-dialid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','match','noanswer','keys','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','logger','info','inspect','message','getCallerId','isUndefined','string','format','\x22%s\x22\x20<%s>','isEmpty','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject'];(function(_0x2dfc05,_0x31b656){var _0x423e31=function(_0x5f0a36){while(--_0x5f0a36){_0x2dfc05['push'](_0x2dfc05['shift']());}};_0x423e31(++_0x31b656);}(_0xce73,0x1e9));var _0x3ce7=function(_0x50e103,_0x5d2663){_0x50e103=_0x50e103-0x0;var _0x563cbc=_0xce73[_0x50e103];return _0x563cbc;};'use strict';var util=require(_0x3ce7('0x0'));var _=require(_0x3ce7('0x1'));var moment=require('moment');var logger=require(_0x3ce7('0x2'))(_0x3ce7('0x3'));var ipAgi=process[_0x3ce7('0x4')][_0x3ce7('0x5')]||_0x3ce7('0x6');var utils=require(_0x3ce7('0x7'));exports[_0x3ce7('0x8')]=function(_0x294b42){return function(_0x380b1f){logger['error'](_0x294b42,util['inspect'](_0x380b1f,{'showHidden':![],'depth':null}));};};exports[_0x3ce7('0x9')]=function(_0x5d4f4e,_0x2cd334){logger[_0x3ce7('0xa')](_0x5d4f4e,util[_0x3ce7('0xb')](_0x2cd334,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x58b1d7,_0x2397cc){logger['error'](_0x58b1d7,util[_0x3ce7('0xb')](_0x2397cc,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x10029f){return function(_0x167e17){logger[_0x3ce7('0xa')](_0x10029f,util[_0x3ce7('0xb')](_0x167e17,{'showHidden':![],'depth':null}));};};exports[_0x3ce7('0xc')]=function(_0x5611a3,_0x48759f,_0x42bb5a){return{'message':_0x5611a3,'unlock':_0x48759f,'active':_0x42bb5a};};exports[_0x3ce7('0xd')]=function(_0x42726f,_0x39699f,_0x25c83e){if(!_[_0x3ce7('0xe')](_0x25c83e)&&'string'===typeof _0x25c83e&&!_['isEmpty'](_0x25c83e)){if(!_[_0x3ce7('0xe')](_0x39699f)&&_0x3ce7('0xf')===typeof _0x39699f&&!_['isEmpty'](_0x39699f)){return util[_0x3ce7('0x10')](_0x3ce7('0x11'),_0x39699f,_0x25c83e);}return util['format'](_0x3ce7('0x11'),_0x25c83e,_0x25c83e);}if(!_[_0x3ce7('0xe')](_0x42726f)&&_0x3ce7('0xf')===typeof _0x42726f&&!_[_0x3ce7('0x12')](_0x42726f)){return _0x42726f;}return _0x3ce7('0x13');};exports[_0x3ce7('0x14')]=function(_0x16eb77){if(_[_0x3ce7('0x15')](_0x16eb77)){return![];}return _0x16eb77;};exports[_0x3ce7('0x16')]=function(_0x1ef2d7,_0x2c23aa,_0x1b007c,_0x1fa107,_0xf89c1c,_0x26106a){var _0x14e1f5={'XMD-QUEUE':_0x2c23aa[_0x3ce7('0x17')]?_0x2c23aa[_0x3ce7('0x17')]['name']:'','XMD-CALLERID':_0x1fa107,'XMD-CALLERID-PREVIEW':_0x26106a?util[_0x3ce7('0x10')](_0x3ce7('0x11'),_0x26106a[_0x3ce7('0x18')],_0x26106a[_0x3ce7('0x19')]):_0x1fa107,'XMD-DIALID':_0xf89c1c,'XMD-CONTACTID':_0x2c23aa[_0x3ce7('0x1a')],'XMD-CDRTYPE':_0x3ce7('0x1b'),'CALLERID(all)':_0x1fa107,'XMD-VOICEQUEUEID':_0x2c23aa[_0x3ce7('0x1c')],'XMD-DIALCHANNEL':_0x1b007c,'XMD-DIALTIMEOUT':_0x1ef2d7[_0x3ce7('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x3ce7('0x10')](_0x3ce7('0x1e'),_0x1ef2d7[_0x3ce7('0x1f')]?'g':'',_['isEmpty'](_0x1ef2d7[_0x3ce7('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x1ef2d7[_0x3ce7('0x21')]||'','XMD-AGI':_0x1ef2d7[_0x3ce7('0x22')]?util[_0x3ce7('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1ef2d7[_0x3ce7('0x22')]):'NONE','XMD-AGIAFTER':_0x1ef2d7['dialQueueProject2']?util[_0x3ce7('0x10')](_0x3ce7('0x23'),ipAgi,_0x1ef2d7['dialQueueProject2']):_0x3ce7('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x26106a?_0x26106a['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x26106a?_0x26106a['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x3ce7('0x25')};if(!_[_0x3ce7('0x12')](_0x1ef2d7[_0x3ce7('0x20')])){_0x14e1f5[util[_0x3ce7('0x10')]('%s',_0x3ce7('0x26'))]=_0x1ef2d7[_0x3ce7('0x20')];_0x14e1f5[util['format']('%s',_0x3ce7('0x27'))]=_0xf89c1c;}return _0x14e1f5;};exports[_0x3ce7('0x28')]=function(_0xdba2b2){var _0x5f5c42={};for(var _0x406679 in _0xdba2b2){if(_0xdba2b2[_0x3ce7('0x29')](_0x406679)){_0x5f5c42[util['format']('%s',_[_0x3ce7('0x2a')](_0x406679))]=_0xdba2b2[_0x406679];}}return{'variables':_0x5f5c42};};exports['logBlacklist']=function(_0x4700a1){var _0x3ece24=moment()[_0x3ce7('0x10')](_0x3ce7('0x2b'));_0x4700a1[_0x3ce7('0x2c')]=0xd;_0x4700a1[_0x3ce7('0x2d')]=_0x3ce7('0x2e');_0x4700a1['starttime']=_0x3ece24;_0x4700a1[_0x3ce7('0x2f')]=_0x3ece24;_0x4700a1[_0x3ce7('0x30')]=_0x3ece24;};exports[_0x3ce7('0x31')]=function(_0x5944dc,_0x5f16eb,_0x46b749){var _0x5a88a2=moment()[_0x3ce7('0x10')](_0x3ce7('0x2b'));_0x5944dc['state']=_0x5f16eb;_0x5944dc[_0x3ce7('0x2d')]=_0x46b749;_0x5944dc[_0x3ce7('0x2f')]=_0x5a88a2;_0x5944dc['ringtime']=utils[_0x3ce7('0x32')](_0x5944dc[_0x3ce7('0x2f')],_0x5944dc[_0x3ce7('0x33')]);};exports['logLookAgent']=function(_0x3e7d0c,_0x38105d,_0x21fed3){_0x3e7d0c[_0x3ce7('0x34')]=_0x38105d;_0x3e7d0c[_0x3ce7('0x35')]=_0x21fed3;};exports[_0x3ce7('0x36')]=function(_0x111307,_0x2f48c4,_0x4b8d96){var _0x3bdeae=moment()[_0x3ce7('0x10')](_0x3ce7('0x2b'));_0x111307[_0x3ce7('0x2c')]=_0x2f48c4;_0x111307[_0x3ce7('0x2d')]=_0x4b8d96;_0x111307[_0x3ce7('0x2f')]=_0x111307[_0x3ce7('0x2f')]?_0x111307['responsetime']:_0x3bdeae;_0x111307[_0x3ce7('0x30')]=_0x111307[_0x3ce7('0x30')]?_0x111307[_0x3ce7('0x30')]:_0x3bdeae;_0x111307['ringtime']=utils['getSeconds'](_0x111307[_0x3ce7('0x2f')]||0x0,_0x111307[_0x3ce7('0x33')]||0x0);_0x111307['talktime']=_0x111307['answertime']?utils['getSeconds'](_0x111307[_0x3ce7('0x30')],_0x111307[_0x3ce7('0x37')]):0x0;};exports[_0x3ce7('0x38')]=function(_0x2013af){return _0x2013af===_0x3ce7('0x39');};exports['variablesAction']=function(_0x5d4f85,_0x15449a,_0x263d73,_0x18ebb0,_0x1c43a0){var _0x24bfe6=_0x18ebb0?_0x3ce7('0x3a'):_0x5d4f85[_0x3ce7('0x18')];_0x24bfe6=_0x1c43a0?_0x3ce7('0x3b'):_0x24bfe6;return{'actionid':_0x5d4f85[_0x3ce7('0x3c')],'action':_0x3ce7('0x3d'),'channel':_0x5d4f85['channelAgent'],'callerid':util['format'](_0x3ce7('0x11'),_0x24bfe6,_0x5d4f85[_0x3ce7('0x19')]),'Exten':'xcally-motion-preview','Context':_0x3ce7('0x3e'),'Priority':'1','variable':_0x263d73,'timeout':(_0x15449a[_0x3ce7('0x3f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5d4f85[_0x3ce7('0x3c')]};};exports[_0x3ce7('0x40')]=function(_0x55a2ec){return _0x55a2ec['countbusyretry']+_0x55a2ec['countcongestionretry']+_0x55a2ec[_0x3ce7('0x41')]+_0x55a2ec[_0x3ce7('0x42')]+_0x55a2ec[_0x3ce7('0x43')];};exports[_0x3ce7('0x44')]=function(_0x4e0465){var _0x1a96ce=_[_0x3ce7('0x45')](_0x4e0465);_0x1a96ce['state']=0xf;_0x1a96ce['statedesc']=_0x3ce7('0x46');return _0x1a96ce;};exports[_0x3ce7('0x47')]=function(_0x31a8e0,_0x5e24b1,_0x4d7e96){var _0x251a8a={};_0x251a8a[_0x5e24b1]=_0x31a8e0[_0x5e24b1];_0x251a8a[_0x3ce7('0x48')]=![];_0x251a8a[_0x3ce7('0x49')]=moment()[_0x3ce7('0x4a')](_0x4d7e96,'minutes')[_0x3ce7('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x251a8a[_0x3ce7('0x1a')]=_0x31a8e0['ContactId'];_0x251a8a[_0x3ce7('0x4b')]=_0x31a8e0[_0x3ce7('0x4b')];_0x251a8a[_0x3ce7('0x1c')]=_0x31a8e0[_0x3ce7('0x1c')]||undefined;return _0x251a8a;};exports[_0x3ce7('0x4c')]=function(_0x38c20c,_0x56e13){if(!_[_0x3ce7('0x15')](_0x38c20c)){if(_0x38c20c['pTalking']>0x0){_0x38c20c[_0x3ce7('0x4d')]-=0x1;}else{logger[_0x3ce7('0xa')](_0x56e13,_0x3ce7('0x4e'));}}else{logger[_0x3ce7('0x4f')](_0x56e13,_0x3ce7('0x50'));}};exports['IsNotLoggedIn']=function(_0x4583c7){if(_0x4583c7<=0x0){return!![];}return![];};function buildObj(_0x517e45,_0x326939,_0xe777f7){_0x517e45[_0x3ce7('0x51')]=_0x326939;_0x517e45['name']=_0x517e45[_0x3ce7('0x52')];_0x517e45['interface']=_0x517e45['channelAgent'];_0x517e45[_0x3ce7('0x53')]=_0x3ce7('0x54');if(_0xe777f7){_0x517e45[_0x3ce7('0x55')]=_0xe777f7[_0x3ce7('0x55')];}return _0x517e45;}exports[_0x3ce7('0x56')]=buildObj;exports[_0x3ce7('0x57')]=function(_0x50ca0d){var _0xa94227=[];for(var _0x3c5e21 in _0x50ca0d){if(_0x50ca0d[_0x3ce7('0x29')](_0x3c5e21)){if(!_[_0x3ce7('0x15')](_0x50ca0d[_0x3c5e21])&&_0x50ca0d[_0x3c5e21][_0x3ce7('0x2c')]==='not_inuse'&&_0x50ca0d[_0x3c5e21][_0x3ce7('0x58')]===_0x3ce7('0x59')){_0xa94227[_0x3ce7('0x5a')](_0x50ca0d[_0x3c5e21]['id']);}}}return _0xa94227;};exports[_0x3ce7('0x5b')]=function(_0x1fddcd){var _0x39c831=moment()[_0x3ce7('0x5c')](0x0);var _0xb1f1fe=moment(_0x1fddcd)[_0x3ce7('0x5c')](0x0);return _0x39c831[_0x3ce7('0x5d')](_0xb1f1fe,_0x3ce7('0x5e'));};exports['createBody']=function(_0x526ddb){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x526ddb[_0x3ce7('0x1a')],'ListId':_0x526ddb[_0x3ce7('0x4b')],'VoiceQueueId':_0x526ddb['VoiceQueueId']||undefined,'CampaignId':_0x526ddb['CampaignId']||undefined};};exports['filterKey']=function(_0x50c8a6){if(_0x50c8a6===_0x3ce7('0x3c')||_0x50c8a6==='idContact'||_0x50c8a6===_0x3ce7('0x52')||_0x50c8a6===_0x3ce7('0x5f')||_0x50c8a6===_0x3ce7('0x60')||_0x50c8a6===_0x3ce7('0x61')||_0x50c8a6===_0x3ce7('0x34')||_0x50c8a6===_0x3ce7('0x62')||_0x50c8a6===_0x3ce7('0x18')||_0x50c8a6===_0x3ce7('0x48')||_0x50c8a6===_0x3ce7('0x19')||_0x50c8a6===_0x3ce7('0x49')||_0x50c8a6===_0x3ce7('0x63')||_0x50c8a6===_0x3ce7('0x64')||_0x50c8a6==='countnoanswerretry'||_0x50c8a6===_0x3ce7('0x65')||_0x50c8a6===_0x3ce7('0x66')||_0x50c8a6===_0x3ce7('0x67')||_0x50c8a6===_0x3ce7('0x68')||_0x50c8a6===_0x3ce7('0x69')||_0x50c8a6===_0x3ce7('0x1a')||_0x50c8a6===_0x3ce7('0x4b')||_0x50c8a6===_0x3ce7('0x35')||_0x50c8a6==='VoiceQueueId'||_0x50c8a6===_0x3ce7('0x6a')||_0x50c8a6==='xmd-voicequeueid'||_0x50c8a6==='xmd-queue'||_0x50c8a6==='xmd-phone'||_0x50c8a6==='xmd-listid'||_0x50c8a6==='xmd-dialurl'||_0x50c8a6===_0x3ce7('0x6b')||_0x50c8a6==='xmd-dialoptions'||_0x50c8a6===_0x3ce7('0x6c')||_0x50c8a6==='xmd-dialchannel'||_0x50c8a6==='xmd-contactid'||_0x50c8a6===_0x3ce7('0x6d')||_0x50c8a6===_0x3ce7('0x6e')||_0x50c8a6===_0x3ce7('0x6f')||_0x50c8a6===_0x3ce7('0x70')||_0x50c8a6==='rtpaudioqos'||_0x50c8a6==='rtpaudioqosbridged'||_0x50c8a6==='rtpaudioqosjitter'||_0x50c8a6===_0x3ce7('0x71')||_0x50c8a6==='rtpaudioqosloss'||_0x50c8a6===_0x3ce7('0x72')||_0x50c8a6===_0x3ce7('0x73')||_0x50c8a6===_0x3ce7('0x74')||_0x50c8a6===_0x3ce7('0x75')||_0x50c8a6===_0x3ce7('0x76')||_0x50c8a6==='rtpaudioqosjitter'||_0x50c8a6==='rtpaudioqosjitterbridged'||_0x50c8a6==='rtpaudioqosloss'||_0x50c8a6===_0x3ce7('0x72')||_0x50c8a6==='rtpaudioqosrtt'||_0x50c8a6===_0x3ce7('0x74')||_0x50c8a6===_0x3ce7('0x77')||_0x50c8a6===_0x3ce7('0x78')||_0x50c8a6===_0x3ce7('0x2c')||_0x50c8a6===_0x3ce7('0x2d')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x5c5d78,_0x223987){var _0x5a7541,_0x37222e,_0x471559;if(_0x223987<=0x0){_0x223987=0x1;}_0x5a7541=new RegExp(_0x3ce7('0x79')+_0x223987+'}$');_0x37222e=Math['pow'](0xa,_0x223987-0x1);_0x471559=Math[_0x3ce7('0x7a')](0xa,_0x223987)-0x1;return util['format']('%s',_[_0x3ce7('0x7b')](_0x5c5d78,_0x5a7541,_['random'](_0x37222e,_0x471559)));};exports['extractCalleridName']=function(_0x4cc1e1){var _0x1781b6=_0x4cc1e1['match'](/"(.*?)"/);return _0x1781b6?_0x1781b6[0x1]:_0x4cc1e1;};exports['extractCalleridNumber']=function(_0x1d1e2b){var _0x4667d6=_0x1d1e2b[_0x3ce7('0x7c')](/<(.*?)>/);return _0x4667d6?_0x4667d6[0x1]:_0x1d1e2b;};function buildNoAnswerEventPayload(_0x28a0d1,_0x40359a){var _0x1c05d8=buildObj(_0x28a0d1,_0x3ce7('0x7d'));if(!_[_0x3ce7('0x12')](_0x40359a['variables'])){Object[_0x3ce7('0x7e')](_0x40359a[_0x3ce7('0x7f')])[_0x3ce7('0x80')](function(_0x2e2d6a){_0x1c05d8[_0x2e2d6a[_0x3ce7('0x81')]()]=_0x40359a[_0x3ce7('0x7f')][_0x2e2d6a];});}return _0x1c05d8;}exports[_0x3ce7('0x82')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index f674d37..762a821 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 _0x96ef=['voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queuepause','reload'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x96ef,0x1d7));var _0xf96e=function(_0x39820f,_0x39633a){_0x39820f=_0x39820f-0x0;var _0x20d8a8=_0x96ef[_0x39820f];return _0x20d8a8;};'use strict';exports[_0xf96e('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xf96e('0x1'),'required':!![]},'membername':{'type':_0xf96e('0x1'),'required':!![]},'penalty':{'type':_0xf96e('0x2'),'required':![]},'paused':{'type':_0xf96e('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0xf96e('0x1'),'required':!![]},'interface':{'type':_0xf96e('0x1'),'required':!![]}};exports[_0xf96e('0x4')]={'interface':{'type':_0xf96e('0x1'),'required':!![]},'paused':{'type':_0xf96e('0x3')},'reason':{'type':_0xf96e('0x1'),'required':![]}};exports[_0xf96e('0x5')]={'module':{'type':_0xf96e('0x1'),'required':![]}};exports[_0xf96e('0x6')]={'uniqueid':{'type':_0xf96e('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0xf96e('0x1')},'mixmonitorid':{'type':_0xf96e('0x1')}};exports[_0xf96e('0x7')]={'uniqueid':{'type':_0xf96e('0x1'),'required':!![]}};exports[_0xf96e('0x8')]={'uniqueid':{'type':_0xf96e('0x1'),'required':!![]},'exten':{'type':_0xf96e('0x1'),'required':!![]},'context':{'type':_0xf96e('0x1')}}; \ No newline at end of file +var _0x372f=['voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0x372f,0x172));var _0xf372=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x372f[_0x20a584];return _0x4b41a8;};'use strict';exports[_0xf372('0x0')]={'queue':{'type':_0xf372('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xf372('0x2'),'required':![]},'paused':{'type':_0xf372('0x3'),'required':![]}};exports[_0xf372('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xf372('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xf372('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xf372('0x1'),'required':![]}};exports['reload']={'module':{'type':_0xf372('0x1'),'required':![]}};exports[_0xf372('0x5')]={'uniqueid':{'type':_0xf372('0x1'),'required':!![]}};exports[_0xf372('0x6')]={'uniqueid':{'type':_0xf372('0x1'),'required':!![]},'filename':{'type':_0xf372('0x1')},'format':{'type':_0xf372('0x1')},'mixmonitorid':{'type':_0xf372('0x1')}};exports[_0xf372('0x7')]={'uniqueid':{'type':_0xf372('0x1'),'required':!![]}};exports[_0xf372('0x8')]={'uniqueid':{'type':_0xf372('0x1'),'required':!![]},'exten':{'type':_0xf372('0x1'),'required':!![]},'context':{'type':_0xf372('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index a4c2d1e..c775e48 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0xbbf0e9,_0x159897){var _0xf1a2b8=function(_0x2b6972){while(--_0x2b6972){_0xbbf0e9['push'](_0xbbf0e9['shift']());}};_0xf1a2b8(++_0x159897);}(_0xadb5,0xad));var _0x5adb=function(_0x3df65c,_0x1ac40a){_0x3df65c=_0x3df65c-0x0;var _0x5e4164=_0xadb5[_0x3df65c];return _0x5e4164;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file +var _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(_0x2d6d60,_0xb83a13){var _0x3ae6c2=function(_0x2fa56e){while(--_0x2fa56e){_0x2d6d60['push'](_0x2d6d60['shift']());}};_0x3ae6c2(++_0xb83a13);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'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 38c4467..a550c8e 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 _0x5003=['hasOwnProperty','assign'];(function(_0x405511,_0x11f612){var _0x5adee0=function(_0x1c6434){while(--_0x1c6434){_0x405511['push'](_0x405511['shift']());}};_0x5adee0(++_0x11f612);}(_0x5003,0x91));var _0x3500=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5003[_0x20a584];return _0x4b41a8;};'use strict';function mergeDBDataToRealtime(_0x1b7a25,_0x2348f9){var _0x71efb5=Object[_0x3500('0x0')]({},_0x1b7a25);for(var _0x59dd66 in _0x2348f9){if(_0x71efb5[_0x3500('0x1')](_0x59dd66)){_0x71efb5[_0x59dd66]=_0x2348f9[_0x59dd66];}}return _0x71efb5;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0x291e=['hasOwnProperty','assign'];(function(_0x504fbd,_0x22cec7){var _0xc654e4=function(_0x1e428d){while(--_0x1e428d){_0x504fbd['push'](_0x504fbd['shift']());}};_0xc654e4(++_0x22cec7);}(_0x291e,0x1b3));var _0xe291=function(_0x337d05,_0x52b97d){_0x337d05=_0x337d05-0x0;var _0xe89731=_0x291e[_0x337d05];return _0xe89731;};'use strict';function mergeDBDataToRealtime(_0x31100c,_0x41a489){var _0x54af47=Object[_0xe291('0x0')]({},_0x31100c);for(var _0x4e022e in _0x41a489){if(_0x54af47[_0xe291('0x1')](_0x4e022e)){_0x54af47[_0x4e022e]=_0x41a489[_0x4e022e];}}return _0x54af47;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index bfa861e..aa330a0 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 _0xdcc5=['from-voip-provider','destination','callerid','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','originatecalleridnum','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','linkedid','transfereelinkedid','getCallType','UserId','membername','monitor','monitors','filename','createdAt','calleridname','connectedlinename','xcally-motion-dialer','isArray','Local','substring','mobile','phone','indexOf','transfers','transfererlinkedid','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','SIP/%s','length','assigned','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','getAgentByInternal','keys','channel','split','calleridnum','outbound','internal','exten','type','lastapplication','queue','lastdata','context'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xdcc5,0xdc));var _0x5dcc=function(_0x1117bf,_0x2b86df){_0x1117bf=_0x1117bf-0x0;var _0x21bf53=_0xdcc5[_0x1117bf];return _0x21bf53;};'use strict';var _=require(_0x5dcc('0x0'));var moment=require(_0x5dcc('0x1'));var util=require('util');var config=require(_0x5dcc('0x2'));var ami=require(_0x5dcc('0x3'));var RpcVoiceAgentReport=require(_0x5dcc('0x4'));var RpcVoiceCallReport=require(_0x5dcc('0x5'));var RpcVoiceDialReport=require(_0x5dcc('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x5dcc('0x7'));var RpcVoiceRecording=require(_0x5dcc('0x8'));var RpcVoiceTransferReport=require(_0x5dcc('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x5dcc('0xa'));var VoiceAgentReport=require(_0x5dcc('0xb'));var VoiceDialReport=require(_0x5dcc('0xc'));var UserReport=require(_0x5dcc('0xd'));function Report(_0x3cb87f){this[_0x5dcc('0xe')]=_0x3cb87f;this['agents']=_0x3cb87f[_0x5dcc('0xf')];this[_0x5dcc('0x10')]=_0x3cb87f[_0x5dcc('0x10')];}Report[_0x5dcc('0x11')][_0x5dcc('0x12')]=function(_0x418bb5){var _0x258d35=new VoiceQueueReport(this['realtime']);var _0x4411a7=new VoiceAgentReport(this['realtime']);var _0x370ff5=new VoiceDialReport(this[_0x5dcc('0xe')]);var _0x1fbf36=new VoiceCallReport(this[_0x5dcc('0xe')]);var _0x4f3b88=new UserReport(this[_0x5dcc('0xe')]);if(config[_0x5dcc('0x13')]&&config[_0x5dcc('0x13')]['disabled']){ami['on'](_0x5dcc('0x14'),this[_0x5dcc('0x15')][_0x5dcc('0x16')](this));ami['on'](_0x5dcc('0x17'),this[_0x5dcc('0x18')]['bind'](this));ami['on'](_0x5dcc('0x19'),this[_0x5dcc('0x1a')][_0x5dcc('0x16')](this));ami['on'](_0x5dcc('0x1b'),this[_0x5dcc('0x1c')][_0x5dcc('0x16')](this));ami['on'](_0x5dcc('0x1d'),this[_0x5dcc('0x1e')][_0x5dcc('0x16')](this));ami['on'](_0x5dcc('0x1f'),this[_0x5dcc('0x20')][_0x5dcc('0x16')](this));}};Report['prototype'][_0x5dcc('0x21')]=function(_0x4a1269){var _0x50a56d;_0x50a56d=_[_0x5dcc('0x22')](this[_0x5dcc('0xf')],function(_0x2a8f39){return _0x2a8f39[_0x5dcc('0x23')]==_0x4a1269||_0x2a8f39[_0x5dcc('0x24')]==_0x4a1269;});if(_[_0x5dcc('0x25')](_0x50a56d)){var _0x15069c=_[_0x5dcc('0x22')](this['telephones'],function(_0x278ca1){return _0x278ca1[_0x5dcc('0x23')]==_0x4a1269||_0x278ca1[_0x5dcc('0x24')]==_0x4a1269;});if(_0x15069c){_0x50a56d=_[_0x5dcc('0x22')](this[_0x5dcc('0xf')],function(_0x1c1d57){return _0x1c1d57[_0x5dcc('0x26')]==util['format'](_0x5dcc('0x27'),_0x15069c['name']);});}}return _0x50a56d;};Report['prototype'][_0x5dcc('0x15')]=function(_0x2aad40){for(var _0x25be1=0x0;_0x25be1<_0x2aad40[_0x5dcc('0x28')];_0x25be1+=0x1){var _0x42778c=this['findAgent'](_0x2aad40[_0x25be1]['connectedlinenum']);if(_0x42778c){_0x2aad40[_0x25be1][_0x5dcc('0x23')]=_0x42778c['accountcode'];_0x2aad40[_0x25be1][_0x5dcc('0x29')]=!![];_0x2aad40[_0x25be1]['lastAssignedTo']=_0x42778c['name'];_0x2aad40[_0x25be1][_0x5dcc('0x26')]=_[_0x5dcc('0x25')](_0x42778c['interface'])?util[_0x5dcc('0x2a')](_0x5dcc('0x27'),_0x42778c['name']):_0x42778c[_0x5dcc('0x26')];if(_0x2aad40[_0x25be1][_0x5dcc('0x2b')]){_0x2aad40[_0x25be1][_0x5dcc('0x2c')]=moment()[_0x5dcc('0x2a')](_0x5dcc('0x2d'));}if(_0x2aad40[_0x25be1][_0x5dcc('0x2e')]){_0x2aad40[_0x25be1][_0x5dcc('0x2f')]=moment()['format'](_0x5dcc('0x2d'));}RpcMemberReport['voiceQueueReport'](_0x2aad40[_0x25be1]);}RpcVoiceQueueReport[_0x5dcc('0x30')](_0x2aad40[_0x25be1]);}};function extractCalleridNumber(_0xaadf14){var _0x47a71c=_0xaadf14['match'](/<(.*?)>/);return _0x47a71c?_0x47a71c[0x1]:_0xaadf14;}Report[_0x5dcc('0x11')][_0x5dcc('0x31')]=function(_0x2350ef){for(var _0x3837ec=0x0;_0x3837ec/);return _0x1094fd?_0x1094fd[0x1]:_0x2ae9d2;}Report['prototype']['getAgentByInternal']=function(_0x5c0a4a){for(var _0x7e64cf=0x0;_0x7e64cf',_0x5f0655[_0xec94('0x3e')],_0x5f0655[_0xec94('0x39')]);}if(RpcVoiceTransferReport[_0xec94('0x3f')][_0x5f0655[_0xec94('0x40')]]){var _0x9646a5=RpcVoiceTransferReport['transfers'][_0x5f0655[_0xec94('0x40')]];_0x9646a5[_0xec94('0x41')]=_0x5f0655[_0xec94('0x42')];RpcVoiceTransferReport[_0xec94('0x14')](_0x9646a5);delete RpcVoiceTransferReport[_0xec94('0x3f')][_0x5f0655[_0xec94('0x40')]];}if(_[_0xec94('0x18')](_0x5f0655[_0xec94('0x30')])){_0x5f0655[_0xec94('0x30')]=this[_0xec94('0x43')](_0x5f0655);}if(_[_0xec94('0x18')](_0x5f0655[_0xec94('0x44')])){var _0x3a9efc=_0x5f0655[_0xec94('0x3b')][_0xec94('0x29')]('-')[0x0];var _0x10fb31=this[_0xec94('0xa')][_0x3a9efc];if(!_0x10fb31)_0x10fb31=this[_0xec94('0x2a')](_0x5f0655[_0xec94('0x1f')]);if(_0x10fb31){_0x5f0655[_0xec94('0x44')]=_0x10fb31['id'];_0x5f0655['membername']=_0x10fb31[_0xec94('0x19')];}}RpcVoiceCallReport['create'](_0x5f0655);if(_0x5f0655[_0xec94('0x45')]){for(var _0xcabd20=0x0;_0xcabd20<_0x5f0655['monitors'][_0xec94('0x1d')];_0xcabd20+=0x1){_0x5f0655[_0xec94('0x46')]=_0x5f0655[_0xec94('0x47')][_0xcabd20][_0xec94('0x48')];_0x5f0655[_0xec94('0x49')]=_0x5f0655[_0xec94('0x47')][_0xcabd20]['createdAt'];if(_0x5f0655[_0xec94('0x2f')]=='xcally-motion-preview'){_0x5f0655[_0xec94('0x39')]=_0x5f0655[_0xec94('0x1e')];_0x5f0655[_0xec94('0x3e')]=_0x5f0655[_0xec94('0x4a')];_0x5f0655[_0xec94('0x1e')]=_0x5f0655[_0xec94('0x1f')];_0x5f0655['connectedlinename']=_0x5f0655['membername'];_0x5f0655['exten']=_0x5f0655[_0xec94('0x3a')];}else if(_0x5f0655[_0xec94('0x2f')]==_0xec94('0x4b')){_0x5f0655[_0xec94('0x39')]=_0x5f0655[_0xec94('0x2e')];_0x5f0655['exten']=_0x5f0655['originatecalleridnum'];}RpcVoiceRecording[_0xec94('0x26')](_0x5f0655);}}};Report[_0xec94('0xc')][_0xec94('0x10')]=function(_0x4772cc){if(_[_0xec94('0x4c')](_0x4772cc)){_0x4772cc[_0xec94('0x4d')](function(_0x364927){RpcVoiceAgentReport[_0xec94('0x26')](_0x364927);});}else{RpcVoiceAgentReport['create'](_0x4772cc);}};Report['prototype']['voiceDialReport']=function(_0x58fb0e){RpcVoiceDialReport[_0xec94('0x26')](_0x58fb0e);var _0x5af110;var _0x410da7;var _0x1e2b45=_0x58fb0e[_0xec94('0x3b')];if(_[_0xec94('0x4e')](_0x1e2b45,_0xec94('0x4f'))){_0x410da7=_0x1e2b45['substring'](_0x1e2b45[_0xec94('0x50')]('/')+0x1,_0x1e2b45['indexOf']('@'));_0x5af110=_[_0xec94('0x17')](this[_0xec94('0xa')],function(_0x5b89bd){return _0x5b89bd[_0xec94('0x51')]==_0x410da7||_0x5b89bd[_0xec94('0x52')]==_0x410da7||_0x5b89bd[_0xec94('0x1f')]==_0x410da7;});}else{_0x410da7=_0x1e2b45[_0xec94('0x53')](_0x1e2b45[_0xec94('0x50')]('/')+0x1,_0x1e2b45['lastIndexOf']('-'));_0x5af110=this['findAgent'](_0x410da7);}if(_0x5af110){_0x58fb0e[_0xec94('0x1a')]=_[_0xec94('0x18')](_0x5af110[_0xec94('0x1a')])?util[_0xec94('0x1b')]('SIP/%s',_0x5af110['name']):_0x5af110[_0xec94('0x1a')];_0x58fb0e[_0xec94('0x54')]=_0x5af110[_0xec94('0x19')];_0x58fb0e[_0xec94('0x1f')]=_0x5af110[_0xec94('0x1f')];RpcMemberReport['voiceDialReport'](_0x58fb0e);}};Report[_0xec94('0xc')]['blindTransfer']=function(_0x2ad61c){RpcVoiceTransferReport[_0xec94('0x3f')][_0x2ad61c[_0xec94('0x55')]]=_0x2ad61c;};Report['prototype'][_0xec94('0x15')]=function(_0x234fa3){RpcVoiceTransferReport[_0xec94('0x15')](_0x234fa3);};module[_0xec94('0x56')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 7893a24..f144254 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e8a=['agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','find','omit','actionid','state','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][registry]','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','Local','substring','indexOf','mobile','phone','accountcode','[userReport][peerstatus]','peer','registered','status','address','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','trunks'];(function(_0x189c0d,_0x248cdb){var _0x4b5d43=function(_0x1304c2){while(--_0x1304c2){_0x189c0d['push'](_0x189c0d['shift']());}};_0x4b5d43(++_0x248cdb);}(_0x6e8a,0x8a));var _0xa6e8=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x6e8a[_0x29b609];return _0x54c952;};'use strict';var _=require(_0xa6e8('0x0'));var moment=require(_0xa6e8('0x1'));var util=require(_0xa6e8('0x2'));var Redis=require(_0xa6e8('0x3'));var BPromise=require(_0xa6e8('0x4'));var config=require(_0xa6e8('0x5'));var logger=require(_0xa6e8('0x6'))(_0xa6e8('0x7'));var ami=require('../ami');config[_0xa6e8('0x8')]=_[_0xa6e8('0x9')](config[_0xa6e8('0x8')],{'host':_0xa6e8('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa6e8('0x8')]));function UserReport(_0x57678e){this[_0xa6e8('0xb')]=_0x57678e['trunks'];this[_0xa6e8('0xc')]=_0x57678e['agents'];this[_0xa6e8('0xd')]=_0x57678e[_0xa6e8('0xd')];ami['on'](_0xa6e8('0xe'),this[_0xa6e8('0xf')][_0xa6e8('0x10')](this));ami['on']('registry',this['syncRegistry']['bind'](this));ami['on'](_0xa6e8('0x11'),this[_0xa6e8('0x12')][_0xa6e8('0x10')](this));ami['on'](_0xa6e8('0x13'),this[_0xa6e8('0x14')][_0xa6e8('0x10')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0xa6e8('0x15')]()[_0xa6e8('0x16')](ami[_0xa6e8('0x17')]())[_0xa6e8('0x18')](function(_0x2207bc){logger[_0xa6e8('0x19')](_0xa6e8('0x1a'),util[_0xa6e8('0x1b')](_0x2207bc,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xa6e8('0x15')]()['then'](ami[_0xa6e8('0x1c')]())[_0xa6e8('0x18')](function(_0x1d00d1){logger[_0xa6e8('0x19')](_0xa6e8('0x1d'),util['inspect'](_0x1d00d1,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xa6e8('0x15')]()[_0xa6e8('0x16')](ami[_0xa6e8('0x1e')]())[_0xa6e8('0x18')](function(_0x2c9e5d){logger['error'](_0xa6e8('0x1f'),util[_0xa6e8('0x1b')](_0x2c9e5d,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xa6e8('0x15')]()[_0xa6e8('0x16')](showSipRegistrations())[_0xa6e8('0x16')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0xa6e8('0x20')][_0xa6e8('0x21')]=function(_0x5e5bdd){return _0x5e5bdd!==null&&!_[_0xa6e8('0x22')](_0x5e5bdd);};UserReport['prototype']['emit']=function(_0x4d1e8d,_0x3e940a,_0x5aa72c){io['to'](_0x4d1e8d)[_0xa6e8('0x23')](_0x3e940a,_0x5aa72c);};UserReport[_0xa6e8('0x20')][_0xa6e8('0xf')]=function(_0x491eba){try{if(this[_0xa6e8('0x21')](_0x491eba)){logger[_0xa6e8('0x24')](_0xa6e8('0x25'),_0x491eba[_0xa6e8('0x26')],_0x491eba['state']);logger[_0xa6e8('0x27')]('[userReport][registry]',util['inspect'](_0x491eba,{'showHidden':![],'depth':null}));var _0x37c0d0=_[_0xa6e8('0x28')](this[_0xa6e8('0xb')],{'defaultuser':_0x491eba[_0xa6e8('0x26')]});if(_0x37c0d0){_0x491eba['stateRegistry']=_0x491eba['state'];_['merge'](_0x37c0d0,_[_0xa6e8('0x29')](_0x491eba,['event',_0xa6e8('0x2a'),_0xa6e8('0x26'),_0xa6e8('0x2b')]));logger[_0xa6e8('0x27')](_0xa6e8('0x2c'),util[_0xa6e8('0x1b')](_0x37c0d0,{'showHidden':![],'depth':null}));this[_0xa6e8('0x23')](util[_0xa6e8('0x2d')](_0xa6e8('0x2e'),_0x37c0d0[_0xa6e8('0x2f')]),_0xa6e8('0x30'),_0x37c0d0);}}}catch(_0x8ebc0b){logger[_0xa6e8('0x19')](_0xa6e8('0x31'),util[_0xa6e8('0x1b')](_0x8ebc0b,{'showHidden':![],'depth':null}));}};UserReport[_0xa6e8('0x20')][_0xa6e8('0x12')]=function(_0x236cdb){try{if(this[_0xa6e8('0x21')](_0x236cdb)){logger[_0xa6e8('0x24')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x236cdb[_0xa6e8('0x32')],_0x236cdb[_0xa6e8('0x2b')]);logger['debug'](_0xa6e8('0x33'),util[_0xa6e8('0x1b')](_0x236cdb,{'showHidden':![],'depth':null}));if(this['agents'][_0x236cdb['device']]){if(!this[_0xa6e8('0xc')][_0x236cdb[_0xa6e8('0x32')]][_0xa6e8('0x34')]||_0x236cdb['state'][_0xa6e8('0x35')]()==_0xa6e8('0x36')){this[_0xa6e8('0xc')][_0x236cdb[_0xa6e8('0x32')]]['local']=![];if(this[_0xa6e8('0xc')][_0x236cdb[_0xa6e8('0x32')]][_0xa6e8('0x2b')]!==_0x236cdb['state'][_0xa6e8('0x35')]()){this[_0xa6e8('0xc')][_0x236cdb['device']][_0xa6e8('0x37')]=_[_0xa6e8('0x38')](moment()[_0xa6e8('0x2d')]('x'));}this['agents'][_0x236cdb[_0xa6e8('0x32')]][_0xa6e8('0x2b')]=_0x236cdb[_0xa6e8('0x2b')]['toLowerCase']();this[_0xa6e8('0xc')][_0x236cdb[_0xa6e8('0x32')]][_0xa6e8('0x39')](_0x236cdb);}}else if(this['telephones'][_0x236cdb[_0xa6e8('0x32')]]){if(this[_0xa6e8('0xd')][_0x236cdb[_0xa6e8('0x32')]][_0xa6e8('0x2b')]!==_0x236cdb[_0xa6e8('0x2b')][_0xa6e8('0x35')]()){this[_0xa6e8('0xd')][_0x236cdb[_0xa6e8('0x32')]][_0xa6e8('0x37')]=_['toNumber'](moment()[_0xa6e8('0x2d')]('x'));}this['telephones'][_0x236cdb[_0xa6e8('0x32')]][_0xa6e8('0x2b')]=_0x236cdb[_0xa6e8('0x2b')]['toLowerCase']();logger[_0xa6e8('0x27')](_0xa6e8('0x3a'),util['inspect'](this[_0xa6e8('0xd')][_0x236cdb[_0xa6e8('0x32')]],{'showHidden':![],'depth':null}));this[_0xa6e8('0x23')](util[_0xa6e8('0x2d')](_0xa6e8('0x3b'),this[_0xa6e8('0xd')][_0x236cdb['device']]['name']),_0xa6e8('0x3c'),this[_0xa6e8('0xd')][_0x236cdb[_0xa6e8('0x32')]]);}else if(this[_0xa6e8('0xb')][_0x236cdb[_0xa6e8('0x32')]]){if(this[_0xa6e8('0xb')][_0x236cdb[_0xa6e8('0x32')]]['state']!==_0x236cdb[_0xa6e8('0x2b')][_0xa6e8('0x35')]()){this[_0xa6e8('0xb')][_0x236cdb[_0xa6e8('0x32')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this['trunks'][_0x236cdb[_0xa6e8('0x32')]][_0xa6e8('0x2b')]=_0x236cdb[_0xa6e8('0x2b')][_0xa6e8('0x35')]();logger['debug'](_0xa6e8('0x3d'),util['inspect'](this[_0xa6e8('0xb')][_0x236cdb[_0xa6e8('0x32')]],{'showHidden':![],'depth':null}));this[_0xa6e8('0x23')](util[_0xa6e8('0x2d')]('trunk:%s',this['trunks'][_0x236cdb[_0xa6e8('0x32')]][_0xa6e8('0x2f')]),_0xa6e8('0x30'),this[_0xa6e8('0xb')][_0x236cdb[_0xa6e8('0x32')]]);}else if(_['startsWith'](_0x236cdb['device'],_0xa6e8('0x3e'))){var _0x4477bc=_0x236cdb[_0xa6e8('0x32')];var _0x2c8222=_0x4477bc[_0xa6e8('0x3f')](_0x4477bc[_0xa6e8('0x40')]('/')+0x1,_0x4477bc[_0xa6e8('0x40')]('@'));var _0x4f49b2=_[_0xa6e8('0x28')](this[_0xa6e8('0xc')],function(_0x5c4a45){return _0x5c4a45[_0xa6e8('0x41')]==_0x2c8222||_0x5c4a45[_0xa6e8('0x42')]==_0x2c8222||_0x5c4a45[_0xa6e8('0x43')]==_0x2c8222;});if(_0x4f49b2){if(_0x4f49b2[_0xa6e8('0x2b')]!==_0x236cdb[_0xa6e8('0x2b')][_0xa6e8('0x35')]()){_0x4f49b2[_0xa6e8('0x37')]=_[_0xa6e8('0x38')](moment()[_0xa6e8('0x2d')]('x'));}_0x4f49b2[_0xa6e8('0x2b')]=_0x236cdb[_0xa6e8('0x2b')][_0xa6e8('0x35')]();_0x4f49b2['local']=!![];_0x4f49b2['updateStatusRealtime'](_0x236cdb);}}}}catch(_0x50b396){logger['error'](_0xa6e8('0x33'),util[_0xa6e8('0x1b')](_0x50b396,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xa6e8('0x14')]=function(_0x2a84fa){try{if(this[_0xa6e8('0x21')](_0x2a84fa)&&this[_0xa6e8('0x21')](_0x2a84fa[_0xa6e8('0x13')])){logger[_0xa6e8('0x24')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x2a84fa['peer'],_0x2a84fa['address'],_0x2a84fa[_0xa6e8('0x13')]);logger['debug'](_0xa6e8('0x44'),util['inspect'](_0x2a84fa,{'showHidden':![],'depth':null}));if(this[_0xa6e8('0xc')][_0x2a84fa[_0xa6e8('0x45')]]){if(!this[_0xa6e8('0xc')][_0x2a84fa[_0xa6e8('0x45')]]['local']||_0x2a84fa[_0xa6e8('0x13')]['toLowerCase']()==_0xa6e8('0x46')){this[_0xa6e8('0xc')][_0x2a84fa[_0xa6e8('0x45')]][_0xa6e8('0x34')]=![];this[_0xa6e8('0xc')][_0x2a84fa[_0xa6e8('0x45')]][_0xa6e8('0x47')]=_0x2a84fa[_0xa6e8('0x13')][_0xa6e8('0x35')]();this[_0xa6e8('0xc')][_0x2a84fa[_0xa6e8('0x45')]][_0xa6e8('0x48')]=_0x2a84fa['address'];this[_0xa6e8('0xc')][_0x2a84fa[_0xa6e8('0x45')]]['updateStatusRealtime'](_0x2a84fa);}}else if(this[_0xa6e8('0xd')][_0x2a84fa['peer']]){this[_0xa6e8('0xd')][_0x2a84fa[_0xa6e8('0x45')]][_0xa6e8('0x47')]=_0x2a84fa[_0xa6e8('0x13')]['toLowerCase']();this['telephones'][_0x2a84fa[_0xa6e8('0x45')]][_0xa6e8('0x48')]=_0x2a84fa[_0xa6e8('0x48')];logger[_0xa6e8('0x27')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0xa6e8('0x1b')](this['telephones'][_0x2a84fa[_0xa6e8('0x45')]],{'showHidden':![],'depth':null}));this[_0xa6e8('0x23')](util[_0xa6e8('0x2d')](_0xa6e8('0x3b'),this[_0xa6e8('0xd')][_0x2a84fa[_0xa6e8('0x45')]][_0xa6e8('0x2f')]),_0xa6e8('0x3c'),this[_0xa6e8('0xd')][_0x2a84fa[_0xa6e8('0x45')]]);}else if(this[_0xa6e8('0xb')][_0x2a84fa[_0xa6e8('0x45')]]){this[_0xa6e8('0xb')][_0x2a84fa[_0xa6e8('0x45')]][_0xa6e8('0x47')]=_0x2a84fa['peerstatus'][_0xa6e8('0x35')]();this[_0xa6e8('0xb')][_0x2a84fa[_0xa6e8('0x45')]][_0xa6e8('0x48')]=_0x2a84fa[_0xa6e8('0x48')];logger['debug'](_0xa6e8('0x49'),util[_0xa6e8('0x1b')](this[_0xa6e8('0xb')][_0x2a84fa[_0xa6e8('0x45')]],{'showHidden':![],'depth':null}));this[_0xa6e8('0x23')](util['format'](_0xa6e8('0x2e'),this[_0xa6e8('0xb')][_0x2a84fa[_0xa6e8('0x45')]][_0xa6e8('0x2f')]),_0xa6e8('0x30'),this[_0xa6e8('0xb')][_0x2a84fa[_0xa6e8('0x45')]]);}}}catch(_0x5654bb){logger[_0xa6e8('0x19')](_0xa6e8('0x44'),util[_0xa6e8('0x1b')](_0x5654bb,{'showHidden':![],'depth':null}));}};module[_0xa6e8('0x4a')]=UserReport; \ No newline at end of file +var _0xbb5f=['devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow','resolve','then','catch','actionDeviceStateList','error','[userReport][devicestatelist]','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','find','username','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','stateTime','toNumber','format','telephones','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','startsWith','Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','util','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','trunks','agents','bind','registry','syncRegistry'];(function(_0x48ea4d,_0x3fd61d){var _0x263a2b=function(_0x28a8fe){while(--_0x28a8fe){_0x48ea4d['push'](_0x48ea4d['shift']());}};_0x263a2b(++_0x3fd61d);}(_0xbb5f,0x16a));var _0xfbb5=function(_0x20bbc0,_0x18be47){_0x20bbc0=_0x20bbc0-0x0;var _0x3bcfa9=_0xbb5f[_0x20bbc0];return _0x3bcfa9;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xfbb5('0x0'));var Redis=require('ioredis');var BPromise=require(_0xfbb5('0x1'));var config=require(_0xfbb5('0x2'));var logger=require(_0xfbb5('0x3'))(_0xfbb5('0x4'));var ami=require(_0xfbb5('0x5'));config[_0xfbb5('0x6')]=_[_0xfbb5('0x7')](config[_0xfbb5('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfbb5('0x6')]));function UserReport(_0x284080){this[_0xfbb5('0x8')]=_0x284080[_0xfbb5('0x8')];this[_0xfbb5('0x9')]=_0x284080[_0xfbb5('0x9')];this['telephones']=_0x284080['telephones'];ami['on']('registryentry',this['syncRegistry'][_0xfbb5('0xa')](this));ami['on'](_0xfbb5('0xb'),this[_0xfbb5('0xc')][_0xfbb5('0xa')](this));ami['on'](_0xfbb5('0xd'),this[_0xfbb5('0xe')]['bind'](this));ami['on']('peerstatus',this[_0xfbb5('0xf')][_0xfbb5('0xa')](this));return this[_0xfbb5('0x10')]();}function showSipRegistrations(){Promise[_0xfbb5('0x11')]()[_0xfbb5('0x12')](ami['actionSipShowRegistry']())[_0xfbb5('0x13')](function(_0x528e7a){logger['error']('[userReport][sipshowregistry]',util['inspect'](_0x528e7a,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xfbb5('0x12')](ami[_0xfbb5('0x14')]())[_0xfbb5('0x13')](function(_0x2a8330){logger[_0xfbb5('0x15')](_0xfbb5('0x16'),util[_0xfbb5('0x17')](_0x2a8330,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xfbb5('0x11')]()['then'](ami[_0xfbb5('0x18')]())['catch'](function(_0x102298){logger[_0xfbb5('0x15')](_0xfbb5('0x19'),util[_0xfbb5('0x17')](_0x102298,{'showHidden':![],'depth':null}));});}UserReport[_0xfbb5('0x1a')]['syncRealtimeShow']=function(){setInterval(function(){BPromise['resolve']()[_0xfbb5('0x12')](showSipRegistrations())[_0xfbb5('0x12')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0xfbb5('0x1a')]['isNotNull']=function(_0x4d0670){return _0x4d0670!==null&&!_[_0xfbb5('0x1b')](_0x4d0670);};UserReport[_0xfbb5('0x1a')][_0xfbb5('0x1c')]=function(_0x31048c,_0x57d55a,_0x3cebe5){io['to'](_0x31048c)[_0xfbb5('0x1c')](_0x57d55a,_0x3cebe5);};UserReport['prototype']['syncRegistry']=function(_0x5a9834){try{if(this[_0xfbb5('0x1d')](_0x5a9834)){logger[_0xfbb5('0x1e')](_0xfbb5('0x1f'),_0x5a9834['username'],_0x5a9834[_0xfbb5('0x20')]);logger[_0xfbb5('0x21')](_0xfbb5('0x22'),util[_0xfbb5('0x17')](_0x5a9834,{'showHidden':![],'depth':null}));var _0x396938=_[_0xfbb5('0x23')](this[_0xfbb5('0x8')],{'defaultuser':_0x5a9834[_0xfbb5('0x24')]});if(_0x396938){_0x5a9834['stateRegistry']=_0x5a9834[_0xfbb5('0x20')];_[_0xfbb5('0x25')](_0x396938,_[_0xfbb5('0x26')](_0x5a9834,[_0xfbb5('0x27'),_0xfbb5('0x28'),_0xfbb5('0x24'),_0xfbb5('0x20')]));logger[_0xfbb5('0x21')](_0xfbb5('0x29'),util[_0xfbb5('0x17')](_0x396938,{'showHidden':![],'depth':null}));this[_0xfbb5('0x1c')](util['format'](_0xfbb5('0x2a'),_0x396938[_0xfbb5('0x2b')]),'trunk:save',_0x396938);}}}catch(_0x5e571a){logger['error'](_0xfbb5('0x22'),util[_0xfbb5('0x17')](_0x5e571a,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xfbb5('0xe')]=function(_0x133240){try{if(this[_0xfbb5('0x1d')](_0x133240)){logger[_0xfbb5('0x1e')](_0xfbb5('0x2c'),_0x133240[_0xfbb5('0x2d')],_0x133240['state']);logger[_0xfbb5('0x21')](_0xfbb5('0x2e'),util[_0xfbb5('0x17')](_0x133240,{'showHidden':![],'depth':null}));if(this['agents'][_0x133240[_0xfbb5('0x2d')]]){if(!this['agents'][_0x133240['device']][_0xfbb5('0x2f')]||_0x133240['state'][_0xfbb5('0x30')]()=='inuse'){this[_0xfbb5('0x9')][_0x133240[_0xfbb5('0x2d')]]['local']=![];if(this['agents'][_0x133240[_0xfbb5('0x2d')]][_0xfbb5('0x20')]!==_0x133240[_0xfbb5('0x20')][_0xfbb5('0x30')]()){this[_0xfbb5('0x9')][_0x133240[_0xfbb5('0x2d')]][_0xfbb5('0x31')]=_[_0xfbb5('0x32')](moment()[_0xfbb5('0x33')]('x'));}this[_0xfbb5('0x9')][_0x133240[_0xfbb5('0x2d')]]['state']=_0x133240[_0xfbb5('0x20')][_0xfbb5('0x30')]();this[_0xfbb5('0x9')][_0x133240[_0xfbb5('0x2d')]]['updateStatusRealtime'](_0x133240);}}else if(this['telephones'][_0x133240[_0xfbb5('0x2d')]]){if(this[_0xfbb5('0x34')][_0x133240['device']][_0xfbb5('0x20')]!==_0x133240[_0xfbb5('0x20')][_0xfbb5('0x30')]()){this[_0xfbb5('0x34')][_0x133240[_0xfbb5('0x2d')]][_0xfbb5('0x31')]=_[_0xfbb5('0x32')](moment()[_0xfbb5('0x33')]('x'));}this[_0xfbb5('0x34')][_0x133240[_0xfbb5('0x2d')]][_0xfbb5('0x20')]=_0x133240['state']['toLowerCase']();logger[_0xfbb5('0x21')](_0xfbb5('0x35'),util['inspect'](this[_0xfbb5('0x34')][_0x133240[_0xfbb5('0x2d')]],{'showHidden':![],'depth':null}));this[_0xfbb5('0x1c')](util[_0xfbb5('0x33')](_0xfbb5('0x36'),this[_0xfbb5('0x34')][_0x133240[_0xfbb5('0x2d')]][_0xfbb5('0x2b')]),_0xfbb5('0x37'),this['telephones'][_0x133240['device']]);}else if(this[_0xfbb5('0x8')][_0x133240['device']]){if(this[_0xfbb5('0x8')][_0x133240['device']][_0xfbb5('0x20')]!==_0x133240[_0xfbb5('0x20')][_0xfbb5('0x30')]()){this['trunks'][_0x133240[_0xfbb5('0x2d')]][_0xfbb5('0x31')]=_[_0xfbb5('0x32')](moment()['format']('x'));}this[_0xfbb5('0x8')][_0x133240[_0xfbb5('0x2d')]][_0xfbb5('0x20')]=_0x133240[_0xfbb5('0x20')][_0xfbb5('0x30')]();logger['debug'](_0xfbb5('0x38'),util[_0xfbb5('0x17')](this[_0xfbb5('0x8')][_0x133240[_0xfbb5('0x2d')]],{'showHidden':![],'depth':null}));this[_0xfbb5('0x1c')](util[_0xfbb5('0x33')]('trunk:%s',this[_0xfbb5('0x8')][_0x133240[_0xfbb5('0x2d')]]['name']),_0xfbb5('0x39'),this[_0xfbb5('0x8')][_0x133240['device']]);}else if(_[_0xfbb5('0x3a')](_0x133240[_0xfbb5('0x2d')],_0xfbb5('0x3b'))){var _0x17854b=_0x133240[_0xfbb5('0x2d')];var _0x519366=_0x17854b[_0xfbb5('0x3c')](_0x17854b[_0xfbb5('0x3d')]('/')+0x1,_0x17854b[_0xfbb5('0x3d')]('@'));var _0xcb7ddc=_['find'](this['agents'],function(_0x55d717){return _0x55d717[_0xfbb5('0x3e')]==_0x519366||_0x55d717[_0xfbb5('0x3f')]==_0x519366||_0x55d717[_0xfbb5('0x40')]==_0x519366;});if(_0xcb7ddc){if(_0xcb7ddc[_0xfbb5('0x20')]!==_0x133240[_0xfbb5('0x20')]['toLowerCase']()){_0xcb7ddc[_0xfbb5('0x31')]=_[_0xfbb5('0x32')](moment()[_0xfbb5('0x33')]('x'));}_0xcb7ddc['state']=_0x133240[_0xfbb5('0x20')][_0xfbb5('0x30')]();_0xcb7ddc[_0xfbb5('0x2f')]=!![];_0xcb7ddc[_0xfbb5('0x41')](_0x133240);}}}}catch(_0x473c08){logger[_0xfbb5('0x15')]('[userReport][devicestatechange]',util[_0xfbb5('0x17')](_0x473c08,{'showHidden':![],'depth':null}));}};UserReport[_0xfbb5('0x1a')]['syncPeerStatus']=function(_0x3f208c){try{if(this[_0xfbb5('0x1d')](_0x3f208c)&&this['isNotNull'](_0x3f208c[_0xfbb5('0x42')])){logger[_0xfbb5('0x1e')](_0xfbb5('0x43'),_0x3f208c[_0xfbb5('0x44')],_0x3f208c[_0xfbb5('0x45')],_0x3f208c[_0xfbb5('0x42')]);logger[_0xfbb5('0x21')](_0xfbb5('0x46'),util[_0xfbb5('0x17')](_0x3f208c,{'showHidden':![],'depth':null}));if(this['agents'][_0x3f208c['peer']]){if(!this[_0xfbb5('0x9')][_0x3f208c[_0xfbb5('0x44')]]['local']||_0x3f208c['peerstatus'][_0xfbb5('0x30')]()=='registered'){this[_0xfbb5('0x9')][_0x3f208c['peer']][_0xfbb5('0x2f')]=![];this[_0xfbb5('0x9')][_0x3f208c[_0xfbb5('0x44')]][_0xfbb5('0x47')]=_0x3f208c[_0xfbb5('0x42')]['toLowerCase']();this[_0xfbb5('0x9')][_0x3f208c[_0xfbb5('0x44')]][_0xfbb5('0x45')]=_0x3f208c[_0xfbb5('0x45')];this[_0xfbb5('0x9')][_0x3f208c[_0xfbb5('0x44')]][_0xfbb5('0x41')](_0x3f208c);}}else if(this['telephones'][_0x3f208c[_0xfbb5('0x44')]]){this[_0xfbb5('0x34')][_0x3f208c[_0xfbb5('0x44')]][_0xfbb5('0x47')]=_0x3f208c[_0xfbb5('0x42')][_0xfbb5('0x30')]();this[_0xfbb5('0x34')][_0x3f208c[_0xfbb5('0x44')]][_0xfbb5('0x45')]=_0x3f208c[_0xfbb5('0x45')];logger[_0xfbb5('0x21')](_0xfbb5('0x48'),util[_0xfbb5('0x17')](this[_0xfbb5('0x34')][_0x3f208c[_0xfbb5('0x44')]],{'showHidden':![],'depth':null}));this[_0xfbb5('0x1c')](util['format'](_0xfbb5('0x36'),this[_0xfbb5('0x34')][_0x3f208c[_0xfbb5('0x44')]][_0xfbb5('0x2b')]),_0xfbb5('0x37'),this[_0xfbb5('0x34')][_0x3f208c['peer']]);}else if(this[_0xfbb5('0x8')][_0x3f208c[_0xfbb5('0x44')]]){this[_0xfbb5('0x8')][_0x3f208c[_0xfbb5('0x44')]][_0xfbb5('0x47')]=_0x3f208c[_0xfbb5('0x42')][_0xfbb5('0x30')]();this[_0xfbb5('0x8')][_0x3f208c[_0xfbb5('0x44')]]['address']=_0x3f208c[_0xfbb5('0x45')];logger['debug'](_0xfbb5('0x49'),util[_0xfbb5('0x17')](this[_0xfbb5('0x8')][_0x3f208c[_0xfbb5('0x44')]],{'showHidden':![],'depth':null}));this[_0xfbb5('0x1c')](util[_0xfbb5('0x33')]('trunk:%s',this['trunks'][_0x3f208c[_0xfbb5('0x44')]][_0xfbb5('0x2b')]),_0xfbb5('0x39'),this[_0xfbb5('0x8')][_0x3f208c[_0xfbb5('0x44')]]);}}}catch(_0x1e47e2){logger[_0xfbb5('0x15')](_0xfbb5('0x46'),util[_0xfbb5('0x17')](_0x1e47e2,{'showHidden':![],'depth':null}));}};module[_0xfbb5('0x4a')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index e3a0bdb..dbbd435 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x065c=['agentacw','custom:agentcomplete','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','deleteChannelAfterTimeout','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','substring','channel','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/logger','../ami','redis','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','syncAgentCalled','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','bind','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','isUndefined','isNotNull','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','interface','queue','format','called','mandatoryDisposition','type','inbound','assign','event','privilege','debug','inspect','emit','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','pick','destconnectedlinenum','name','accountcode','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','agent','talktime','acw','acwtime','acwTimeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x065c,0x16e));var _0xc065=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0x065c[_0xea35d1];return _0x1d7a7c;};'use strict';var _=require(_0xc065('0x0'));var moment=require(_0xc065('0x1'));var util=require(_0xc065('0x2'));var Redis=require(_0xc065('0x3'));var config=require('../../../config/environment');var logger=require(_0xc065('0x4'))('ami');var ami=require(_0xc065('0x5'));config[_0xc065('0x6')]=_['defaults'](config['redis'],{'host':_0xc065('0x7'),'port':0x18eb});var io=require(_0xc065('0x8'))(new Redis(config[_0xc065('0x6')]));function VoiceAgentReport(_0x37f72b){this[_0xc065('0x9')]={};this[_0xc065('0xa')]=_0x37f72b['channels'];this[_0xc065('0xb')]=_0x37f72b['voiceQueues'];this['agents']=_0x37f72b[_0xc065('0xc')];this[_0xc065('0xd')]={};ami['on']('agentcalled',this[_0xc065('0xe')]['bind'](this));ami['on'](_0xc065('0xf'),this[_0xc065('0x10')]['bind'](this));ami['on'](_0xc065('0x11'),this[_0xc065('0x12')][_0xc065('0x13')](this));ami['on']('queuecallerabandon',this[_0xc065('0x14')][_0xc065('0x13')](this));ami['on'](_0xc065('0x15'),this[_0xc065('0x16')][_0xc065('0x13')](this));ami['on'](_0xc065('0x17'),this[_0xc065('0x18')][_0xc065('0x13')](this));ami['on'](_0xc065('0x19'),this['syncHangup']['bind'](this));ami['on']('musiconholdstart',this[_0xc065('0x1a')][_0xc065('0x13')](this));ami['on']('musiconholdstop',this[_0xc065('0x1b')][_0xc065('0x13')](this));ami['on'](_0xc065('0x1c'),this['syncAttendedTransfer'][_0xc065('0x13')](this));ami['on'](_0xc065('0x1d'),this[_0xc065('0x1e')][_0xc065('0x13')](this));}VoiceAgentReport[_0xc065('0x1f')]['emit']=function(_0x144dcb,_0x1b4192,_0x21d42a){io['to'](_0x144dcb)['emit'](_0x1b4192,_0x21d42a);};VoiceAgentReport[_0xc065('0x1f')]['isNotNull']=function(_0x43ffc6){return _0x43ffc6!==null&&!_[_0xc065('0x20')](_0x43ffc6);};VoiceAgentReport['prototype'][_0xc065('0xe')]=function(_0x141e5f){try{if(this[_0xc065('0x21')](_0x141e5f)){logger['info']('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x141e5f[_0xc065('0x22')],_0x141e5f[_0xc065('0x23')],_0x141e5f[_0xc065('0x24')]);logger['debug'](_0xc065('0x25'),_0x141e5f[_0xc065('0x22')],util['inspect'](_0x141e5f,{'showHidden':![],'depth':null}));if(_[_0xc065('0x20')](this[_0xc065('0x9')][_0x141e5f[_0xc065('0x22')]])){this[_0xc065('0x9')][_0x141e5f[_0xc065('0x22')]]={};}var _0x18e646=this[_0xc065('0xc')][_0x141e5f[_0xc065('0x26')]];var _0x388382=this['channels'][_0x141e5f[_0xc065('0x22')]][_0x141e5f[_0xc065('0x24')]];var _0x6dc625=this[_0xc065('0xb')][_0x141e5f[_0xc065('0x27')]];var _0x45169a=this[_0xc065('0xd')][_0x141e5f[_0xc065('0x22')]];if(_[_0xc065('0x20')](_0x388382)){_0x388382={'agentcalledAt':moment()[_0xc065('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xc065('0x29'),'mandatoryDisposition':_0x6dc625&&_0x6dc625[_0xc065('0x2a')]?_0x6dc625['mandatoryDisposition']:![],'type':_0x6dc625&&_0x6dc625[_0xc065('0x2b')]?_0x6dc625[_0xc065('0x2b')]:_0xc065('0x2c'),'variables':_0x45169a,'motionChannel':'voice'};}Object[_0xc065('0x2d')](_0x388382,_['omit'](_0x141e5f,[_0xc065('0x2e'),_0xc065('0x2f')]));this[_0xc065('0x9')][_0x141e5f[_0xc065('0x22')]][_0x141e5f['destuniqueid']]=_0x388382;logger[_0xc065('0x30')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x141e5f['uniqueid'],util[_0xc065('0x31')](_0x388382,{'showHidden':![],'depth':null}));ami[_0xc065('0x32')](_0xc065('0x33'),_0x388382);var _0x771aec={'id':_0x18e646['id'],'calleridnum':_0x388382[_0xc065('0x34')],'queue':_0x388382[_0xc065('0x27')],'variables':_0x388382[_0xc065('0xd')],'uniqueid':_0x141e5f[_0xc065('0x22')]};logger[_0xc065('0x30')](_0xc065('0x35'),_0x141e5f['uniqueid'],util[_0xc065('0x31')](_0x771aec,{'showHidden':![],'depth':null}));this[_0xc065('0x32')](util[_0xc065('0x28')](_0xc065('0x36'),_0x141e5f[_0xc065('0x23')]),_0xc065('0x37'),_0x771aec);}}catch(_0xfe7236){logger['error'](_0xc065('0x38'),_0x141e5f[_0xc065('0x22')],util[_0xc065('0x31')](_0xfe7236,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc065('0x1f')][_0xc065('0x10')]=function(_0x336f34){try{if(this['isNotNull'](_0x336f34)){if(this[_0xc065('0x9')][_0x336f34['uniqueid']]){for(var _0x3e9e36 in this[_0xc065('0x9')][_0x336f34[_0xc065('0x22')]]){if(this['channels'][_0x336f34[_0xc065('0x22')]][_0xc065('0x39')](_0x3e9e36)){if(_0x336f34[_0xc065('0x24')]===_0x3e9e36){logger[_0xc065('0x3a')](_0xc065('0x3b'),_0x336f34[_0xc065('0x22')],_0x336f34[_0xc065('0x23')],_0x336f34[_0xc065('0x24')]);this[_0xc065('0x9')][_0x336f34[_0xc065('0x22')]][_0x3e9e36][_0xc065('0x3c')]=moment()[_0xc065('0x28')](_0xc065('0x3d'));this['channels'][_0x336f34[_0xc065('0x22')]][_0x3e9e36]['connectedlinename']=_0x336f34['connectedlinename'];this[_0xc065('0x9')][_0x336f34['uniqueid']][_0x3e9e36][_0xc065('0x3e')]=_0x336f34[_0xc065('0x3e')];this[_0xc065('0x9')][_0x336f34[_0xc065('0x22')]][_0x3e9e36][_0xc065('0x3f')]=_0x336f34[_0xc065('0x3f')];this[_0xc065('0x9')][_0x336f34[_0xc065('0x22')]][_0x3e9e36][_0xc065('0x40')]=_0x336f34['destchannelstatedesc'];this[_0xc065('0x9')][_0x336f34[_0xc065('0x22')]][_0x3e9e36][_0xc065('0x41')]=_0x336f34[_0xc065('0x41')];this[_0xc065('0x9')][_0x336f34['uniqueid']][_0x3e9e36][_0xc065('0x42')]='connect';_['merge'](this[_0xc065('0xc')][_0x336f34['interface']],_[_0xc065('0x43')](_0x336f34,[_0xc065('0x27'),_0xc065('0x44')]));var _0x1bdbf6=this[_0xc065('0xc')][_0x336f34[_0xc065('0x26')]];var _0x44bb54={'id':_0x1bdbf6['id'],'name':_0x1bdbf6[_0xc065('0x45')],'agentconnected':!![],'destaccountcode':_0x1bdbf6[_0xc065('0x46')],'destconnectedlinenum':this[_0xc065('0x9')][_0x336f34[_0xc065('0x22')]][_0x336f34[_0xc065('0x24')]]['exten'],'queue':this[_0xc065('0x9')][_0x336f34['uniqueid']][_0x336f34[_0xc065('0x24')]][_0xc065('0x27')],'uniqueid':this[_0xc065('0x9')][_0x336f34[_0xc065('0x22')]][_0x336f34[_0xc065('0x24')]][_0xc065('0x22')]};ami['emit'](_0xc065('0x47'),this[_0xc065('0x9')][_0x336f34[_0xc065('0x22')]][_0x336f34['destuniqueid']]);this[_0xc065('0x32')](util['format'](_0xc065('0x36'),_0x336f34[_0xc065('0x23')]),_0xc065('0x48'),_0x44bb54);}else if(!this[_0xc065('0x9')][_0x336f34['uniqueid']][_0x3e9e36][_0xc065('0x11')]&&!this[_0xc065('0x9')][_0x336f34['uniqueid']][_0x3e9e36][_0xc065('0x15')]){logger[_0xc065('0x3a')](_0xc065('0x49'),_0x336f34[_0xc065('0x22')],this[_0xc065('0x9')][_0x336f34[_0xc065('0x22')]][_0x3e9e36][_0xc065('0x23')],_0x3e9e36);this[_0xc065('0x9')][_0x336f34['uniqueid']][_0x3e9e36][_0xc065('0x11')]=!![];this[_0xc065('0x9')][_0x336f34['uniqueid']][_0x3e9e36][_0xc065('0x4a')]=moment()[_0xc065('0x28')](_0xc065('0x3d'));this['channels'][_0x336f34['uniqueid']][_0x3e9e36][_0xc065('0x4b')]=_0x336f34[_0xc065('0x24')];this[_0xc065('0x9')][_0x336f34['uniqueid']][_0x3e9e36][_0xc065('0x4c')]=_0x336f34['membername'];this['channels'][_0x336f34[_0xc065('0x22')]][_0x3e9e36][_0xc065('0x42')]=_0xc065('0x4d');this['channels'][_0x336f34[_0xc065('0x22')]][_0x3e9e36][_0xc065('0x4e')]=_0xc065('0x4d');logger[_0xc065('0x30')](_0xc065('0x4f'),_0x336f34[_0xc065('0x22')],util['inspect'](this['channels'][_0x336f34[_0xc065('0x22')]][_0x3e9e36],{'showHidden':![],'depth':null}));ami['emit'](_0xc065('0x50'),this[_0xc065('0x9')][_0x336f34[_0xc065('0x22')]][_0x3e9e36]);}else{logger['debug'](_0xc065('0x51'),_0x336f34[_0xc065('0x22')]);}}}}}}catch(_0x18baa3){logger[_0xc065('0x52')](_0xc065('0x53'),_0x336f34[_0xc065('0x22')],util['inspect'](_0x18baa3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc065('0x1f')][_0xc065('0x12')]=function(_0x5979d2){try{if(this[_0xc065('0x21')](_0x5979d2)){logger[_0xc065('0x30')](_0xc065('0x54'),_0x5979d2['uniqueid'],util[_0xc065('0x31')](_0x5979d2,{'showHidden':![],'depth':null}));if(this[_0xc065('0x9')][_0x5979d2[_0xc065('0x22')]]&&this['channels'][_0x5979d2['uniqueid']][_0x5979d2[_0xc065('0x24')]]){logger[_0xc065('0x3a')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x5979d2[_0xc065('0x22')],_0x5979d2[_0xc065('0x23')],_0x5979d2[_0xc065('0x24')]);var _0x139076=this[_0xc065('0xc')][_0x5979d2[_0xc065('0x26')]];var _0x39edf4=this[_0xc065('0x9')][_0x5979d2['uniqueid']][_0x5979d2[_0xc065('0x24')]];_0x39edf4[_0xc065('0x11')]=!![];_0x39edf4['agentringnoanswerAt']=moment()[_0xc065('0x28')](_0xc065('0x3d'));_0x39edf4[_0xc065('0x42')]=_0xc065('0x55');_0x39edf4[_0xc065('0x4e')]=_0xc065('0x55');var _0x387e4c={'id':_0x139076['id'],'name':_0x139076[_0xc065('0x45')],'queue':_0x39edf4['queue'],'uniqueid':_0x39edf4[_0xc065('0x22')]};logger[_0xc065('0x30')](_0xc065('0x56'),_0x5979d2[_0xc065('0x22')],util['inspect'](_0x387e4c,{'showHidden':![],'depth':null}));this['emit'](util[_0xc065('0x28')]('user:%s',_0x139076['name']),_0xc065('0x57'),_0x387e4c);ami['emit'](_0xc065('0x58'),_0x39edf4);this[_0xc065('0x9')][_0x5979d2[_0xc065('0x22')]][_0x5979d2[_0xc065('0x24')]]=Object['assign']({},_0x39edf4);}}}catch(_0x82dc15){logger[_0xc065('0x52')](_0xc065('0x59'),_0x5979d2[_0xc065('0x22')],util[_0xc065('0x31')](_0x82dc15,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xc065('0x14')]=function(_0x495126){try{if(this[_0xc065('0x21')](_0x495126)){logger[_0xc065('0x30')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x495126[_0xc065('0x22')],util[_0xc065('0x31')](_0x495126,{'showHidden':![],'depth':null}));if(this[_0xc065('0x9')][_0x495126[_0xc065('0x22')]]){for(var _0x403b8c in this['channels'][_0x495126[_0xc065('0x22')]]){if(this[_0xc065('0x9')][_0x495126[_0xc065('0x22')]][_0xc065('0x39')](_0x403b8c)&&!this[_0xc065('0x9')][_0x495126[_0xc065('0x22')]][_0x403b8c][_0xc065('0x11')]&&!this[_0xc065('0x9')][_0x495126['uniqueid']][_0x403b8c][_0xc065('0x15')]){logger[_0xc065('0x3a')](_0xc065('0x5a'),_0x495126['uniqueid'],this[_0xc065('0x9')][_0x495126[_0xc065('0x22')]][_0x403b8c]['membername'],_0x403b8c);this['channels'][_0x495126['uniqueid']][_0x403b8c]['agentringnoanswer']=!![];this[_0xc065('0x9')][_0x495126[_0xc065('0x22')]][_0x403b8c]['agentringnoanswerAt']=moment()[_0xc065('0x28')](_0xc065('0x3d'));this['channels'][_0x495126['uniqueid']][_0x403b8c][_0xc065('0x42')]='abandoned';this[_0xc065('0x9')][_0x495126[_0xc065('0x22')]][_0x403b8c][_0xc065('0x4e')]=_0xc065('0x5b');logger[_0xc065('0x30')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x495126[_0xc065('0x22')],util[_0xc065('0x31')](this[_0xc065('0x9')][_0x495126[_0xc065('0x22')]][_0x403b8c],{'showHidden':![],'depth':null}));ami['emit'](_0xc065('0x5c'),this[_0xc065('0x9')][_0x495126[_0xc065('0x22')]][_0x403b8c]);}}}}}catch(_0x89c11d){logger[_0xc065('0x52')](_0xc065('0x5d'),_0x495126[_0xc065('0x22')],util['inspect'](_0x89c11d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc065('0x1f')][_0xc065('0x16')]=function(_0x542fa4){try{if(this[_0xc065('0x21')](_0x542fa4)){logger['debug'](_0xc065('0x5e'),_0x542fa4[_0xc065('0x22')],util[_0xc065('0x31')](_0x542fa4,{'showHidden':![],'depth':null}));if(this[_0xc065('0x9')][_0x542fa4['uniqueid']]){for(var _0x348a97 in this[_0xc065('0x9')][_0x542fa4['uniqueid']]){if(this[_0xc065('0x9')][_0x542fa4[_0xc065('0x22')]][_0xc065('0x39')](_0x348a97)){if(this[_0xc065('0x9')][_0x542fa4['uniqueid']][_0x348a97][_0xc065('0x3c')]&&!this[_0xc065('0x9')][_0x542fa4[_0xc065('0x22')]][_0x348a97][_0xc065('0x15')]){logger['info'](_0xc065('0x5f'),_0x542fa4[_0xc065('0x22')],this[_0xc065('0x9')][_0x542fa4['uniqueid']][_0x348a97][_0xc065('0x23')],_0x348a97);this['channels'][_0x542fa4[_0xc065('0x22')]][_0x348a97][_0xc065('0x15')]=!![];this[_0xc065('0x9')][_0x542fa4[_0xc065('0x22')]][_0x348a97]['agentcompleteAt']=moment()[_0xc065('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc065('0x9')][_0x542fa4['uniqueid']][_0x348a97][_0xc065('0x42')]=_0xc065('0x60');this[_0xc065('0x9')][_0x542fa4['uniqueid']][_0x348a97]['reason']=_0x542fa4[_0xc065('0x4e')]=='transfer'?_0xc065('0x61'):_0x542fa4['reason'];this['channels'][_0x542fa4[_0xc065('0x22')]][_0x348a97][_0xc065('0x62')]=_0x542fa4[_0xc065('0x62')];if(this[_0xc065('0xb')][_0x542fa4['queue']]&&this[_0xc065('0xb')][_0x542fa4[_0xc065('0x27')]][_0xc065('0x63')]){this[_0xc065('0x9')][_0x542fa4['uniqueid']][_0x348a97][_0xc065('0x64')]=this[_0xc065('0xb')][_0x542fa4['queue']][_0xc065('0x65')];this[_0xc065('0x9')][_0x542fa4['uniqueid']][_0x348a97][_0xc065('0x66')]=!![];}this['agents'][_0x542fa4['interface']]=_['omit'](this[_0xc065('0xc')][_0x542fa4[_0xc065('0x26')]],[_0xc065('0x27'),_0xc065('0x44')]);logger[_0xc065('0x30')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x542fa4[_0xc065('0x22')],util['inspect'](this[_0xc065('0x9')][_0x542fa4[_0xc065('0x22')]][_0x348a97],{'showHidden':![],'depth':null}));ami[_0xc065('0x32')](_0xc065('0x67'),this[_0xc065('0x9')][_0x542fa4[_0xc065('0x22')]][_0x348a97]);logger[_0xc065('0x30')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x542fa4[_0xc065('0x22')],util[_0xc065('0x31')]({'id':this[_0xc065('0xc')][_0x542fa4['interface']]['id'],'destaccountcode':_0x542fa4[_0xc065('0x68')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xc065('0x36'),_0x542fa4['membername']),_0xc065('0x69'),{'id':this[_0xc065('0xc')][_0x542fa4['interface']]['id'],'destaccountcode':Number(_0x542fa4['destaccountcode'])});}}}}}}catch(_0x24403d){logger['error'](_0xc065('0x6a'),_0x542fa4[_0xc065('0x22')],util[_0xc065('0x31')](_0x24403d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc065('0x1f')][_0xc065('0x18')]=function(_0x3dd2d5){try{if(this[_0xc065('0x21')](_0x3dd2d5)){logger[_0xc065('0x30')](_0xc065('0x6b'),_0x3dd2d5[_0xc065('0x22')],util[_0xc065('0x31')](_0x3dd2d5,{'showHidden':![],'depth':null}));this[_0xc065('0x6c')](_0x3dd2d5[_0xc065('0x22')],_[_0xc065('0x6d')](_0x3dd2d5[_0xc065('0x6e')])[0x0],_0x3dd2d5[_0xc065('0x6f')]);if(this['channels'][_0x3dd2d5[_0xc065('0x22')]]){for(var _0x296f08 in this[_0xc065('0x9')][_0x3dd2d5[_0xc065('0x22')]]){if(this[_0xc065('0x9')][_0x3dd2d5[_0xc065('0x22')]]['hasOwnProperty'](_0x296f08)){logger[_0xc065('0x3a')](_0xc065('0x70'),_0x3dd2d5[_0xc065('0x22')],_0x296f08,_['keys'](_0x3dd2d5['variable'])[0x0],_0x3dd2d5['value']);if(_[_0xc065('0x20')](this[_0xc065('0x9')][_0x3dd2d5[_0xc065('0x22')]][_0x296f08][_0xc065('0xd')])){this[_0xc065('0x9')][_0x3dd2d5[_0xc065('0x22')]][_0x296f08][_0xc065('0xd')]={};}this[_0xc065('0x9')][_0x3dd2d5[_0xc065('0x22')]][_0x296f08][_0xc065('0xd')]=this[_0xc065('0xd')][_0x3dd2d5[_0xc065('0x22')]];}}}}}catch(_0xfd2529){logger[_0xc065('0x52')]('[%s][voiceAgentReport][varset]',_0x3dd2d5[_0xc065('0x22')],util['inspect'](_0xfd2529,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc065('0x1f')][_0xc065('0x6c')]=function(_0x1d54f8,_0x2fa111,_0x4b9485){var _0x43033b=['rtpaudioqos',_0xc065('0x71'),_0xc065('0x72'),_0xc065('0x73'),_0xc065('0x74'),'rtpaudioqoslossbridged',_0xc065('0x75'),_0xc065('0x76'),_0xc065('0x77'),_0xc065('0x78'),_0xc065('0x79'),_0xc065('0x7a'),_0xc065('0x7b'),'memberdynamic','memberinterface',_0xc065('0x7c'),_0xc065('0x23'),_0xc065('0x7d'),_0xc065('0x7e')];if(!_[_0xc065('0x7f')](_0x2fa111)&&!_['includes'](_0x43033b,_0x2fa111)){if(_[_0xc065('0x20')](this[_0xc065('0xd')][_0x1d54f8])){this['variables'][_0x1d54f8]={};}this[_0xc065('0xd')][_0x1d54f8][_0x2fa111]=_0x4b9485;}};VoiceAgentReport[_0xc065('0x1f')][_0xc065('0x80')]=function(_0x15b9df){try{if(this[_0xc065('0x21')](_0x15b9df)){logger[_0xc065('0x30')](_0xc065('0x81'),_0x15b9df['uniqueid'],util[_0xc065('0x31')](_0x15b9df,{'showHidden':![],'depth':null}));if(this[_0xc065('0x9')][_0x15b9df[_0xc065('0x22')]]){for(var _0x2ca89f in this['channels'][_0x15b9df[_0xc065('0x22')]]){if(this[_0xc065('0x9')][_0x15b9df[_0xc065('0x22')]][_0xc065('0x39')](_0x2ca89f)){if(this[_0xc065('0x9')][_0x15b9df[_0xc065('0x22')]][_0x2ca89f]['reason']==_0xc065('0x82')&&this['channels'][_0x15b9df['uniqueid']][_0x2ca89f][_0xc065('0x15')]){logger['info'](_0xc065('0x83'),_0x15b9df[_0xc065('0x22')],_0x2ca89f);this['channels'][_0x15b9df[_0xc065('0x22')]][_0x2ca89f][_0xc065('0x84')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0xc065('0x30')](_0xc065('0x85'),_0x15b9df[_0xc065('0x22')],util[_0xc065('0x31')](_[_0xc065('0x86')](this['channels'][_0x15b9df['uniqueid']]),{'showHidden':![],'depth':null}));ami['emit']('custom:voiceAgentReport',_[_0xc065('0x86')](this[_0xc065('0x9')][_0x15b9df[_0xc065('0x22')]]));this[_0xc065('0x87')](_0x15b9df['uniqueid']);}if(this[_0xc065('0xd')][_0x15b9df['uniqueid']]){delete this[_0xc065('0xd')][_0x15b9df[_0xc065('0x22')]];}}}catch(_0x298122){logger[_0xc065('0x52')]('[%s][voiceAgentReport][hangup]',_0x15b9df[_0xc065('0x22')],util['inspect'](_0x298122,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc065('0x1f')][_0xc065('0x88')]=function(_0x205748){try{if(this[_0xc065('0x21')](_0x205748)){logger[_0xc065('0x30')](_0xc065('0x89'),_0x205748[_0xc065('0x22')],util[_0xc065('0x31')](_0x205748,{'showHidden':![],'depth':null}));if(this['channels'][_0x205748[_0xc065('0x8a')]]){for(var _0xd70be in this[_0xc065('0x9')][_0x205748['transfereeuniqueid']]){if(this[_0xc065('0x9')][_0x205748[_0xc065('0x8a')]][_0xc065('0x39')](_0xd70be)){if(_0x205748[_0xc065('0x8b')]===_0xd70be){logger[_0xc065('0x3a')](_0xc065('0x8c'),_0x205748[_0xc065('0x22')],this['channels'][_0x205748[_0xc065('0x8a')]][_0xd70be][_0xc065('0x23')],_0xd70be);var _0x57024d=moment();this[_0xc065('0x9')][_0x205748[_0xc065('0x8a')]][_0xd70be][_0xc065('0x15')]=!![];this[_0xc065('0x9')][_0x205748[_0xc065('0x8a')]][_0xd70be]['agentcompleteAt']=moment()[_0xc065('0x28')](_0xc065('0x3d'));this[_0xc065('0x9')][_0x205748[_0xc065('0x8a')]][_0xd70be]['lastevent']=_0xc065('0x60');this[_0xc065('0x9')][_0x205748['transfereeuniqueid']][_0xd70be]['reason']='transfer';this[_0xc065('0x9')][_0x205748[_0xc065('0x8a')]][_0xd70be]['talktime']=_0x57024d[_0xc065('0x8d')](this[_0xc065('0x9')][_0x205748[_0xc065('0x8a')]][_0xd70be]['agentconnectAt'],_0xc065('0x8e'));}}}}if(this[_0xc065('0x9')][_0x205748['secondtransfereruniqueid']]){var _0x5d528e=this[_0xc065('0x9')][_0x205748[_0xc065('0x8f')]];this[_0xc065('0x9')][_0x205748[_0xc065('0x8f')]]=this[_0xc065('0x9')][_0x205748['transfereeuniqueid']];this[_0xc065('0x9')][_0x205748[_0xc065('0x8a')]]=_0x5d528e;}}}catch(_0x22709f){logger[_0xc065('0x52')](_0xc065('0x90'),_0x205748[_0xc065('0x22')],util[_0xc065('0x31')](_0x22709f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc065('0x1f')][_0xc065('0x1e')]=function(_0x20521a){try{if(this['isNotNull'](_0x20521a)){logger[_0xc065('0x30')](_0xc065('0x91'),_0x20521a[_0xc065('0x22')],util[_0xc065('0x31')](_0x20521a,{'showHidden':![],'depth':null}));if(this[_0xc065('0x9')][_0x20521a[_0xc065('0x8a')]]){for(var _0x300648 in this[_0xc065('0x9')][_0x20521a['transfereeuniqueid']]){if(this[_0xc065('0x9')][_0x20521a['transfereeuniqueid']][_0xc065('0x39')](_0x300648)){if(_0x20521a['transfereruniqueid']===_0x300648){logger['info']('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x20521a[_0xc065('0x22')],this['channels'][_0x20521a[_0xc065('0x8a')]][_0x300648][_0xc065('0x23')],_0x300648);var _0x3d1ed8=moment();this[_0xc065('0x9')][_0x20521a[_0xc065('0x8a')]][_0x300648][_0xc065('0x15')]=!![];this[_0xc065('0x9')][_0x20521a[_0xc065('0x8a')]][_0x300648][_0xc065('0x84')]=_0x3d1ed8;this[_0xc065('0x9')][_0x20521a['transfereeuniqueid']][_0x300648][_0xc065('0x42')]=_0xc065('0x60');this[_0xc065('0x9')][_0x20521a['transfereeuniqueid']][_0x300648][_0xc065('0x4e')]=_0xc065('0x82');this[_0xc065('0x9')][_0x20521a[_0xc065('0x8a')]][_0x300648]['talktime']=_0x3d1ed8[_0xc065('0x8d')](this['channels'][_0x20521a[_0xc065('0x8a')]][_0x300648]['agentconnectAt'],'seconds');}}}}}}catch(_0x291f8a){logger[_0xc065('0x52')](_0xc065('0x92'),_0x20521a[_0xc065('0x22')],util['inspect'](_0x291f8a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc065('0x1f')][_0xc065('0x1a')]=function(_0xc3acbd){var _0x4ffe09='';try{if(this[_0xc065('0x21')](_0xc3acbd)){logger[_0xc065('0x30')](_0xc065('0x93'),_0xc3acbd[_0xc065('0x22')],util[_0xc065('0x31')](_0xc3acbd,{'showHidden':![],'depth':null}));if(_0xc3acbd['channel']){_0x4ffe09=_0xc3acbd['channel'][_0xc065('0x94')](0x0,_0xc3acbd[_0xc065('0x95')]['lastIndexOf']('-'));if(this[_0xc065('0xc')][_0x4ffe09]){logger['info'](_0xc065('0x96'),_0xc3acbd[_0xc065('0x22')],_0x4ffe09);this[_0xc065('0xc')][_0x4ffe09][_0xc065('0x97')]=!![];}}}}catch(_0x1ab0ea){logger['error'](_0xc065('0x98'),_0xc3acbd[_0xc065('0x22')],util['inspect'](_0x1ab0ea,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc065('0x1f')][_0xc065('0x1b')]=function(_0x544591){var _0x638e2e='';try{if(this[_0xc065('0x21')](_0x544591)){logger[_0xc065('0x30')](_0xc065('0x99'),_0x544591[_0xc065('0x22')],util['inspect'](_0x544591,{'showHidden':![],'depth':null}));if(_0x544591[_0xc065('0x95')]){_0x638e2e=_0x544591[_0xc065('0x95')][_0xc065('0x94')](0x0,_0x544591['channel']['lastIndexOf']('-'));if(this[_0xc065('0xc')][_0x638e2e]){logger[_0xc065('0x3a')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x544591[_0xc065('0x22')],_0x638e2e);this[_0xc065('0xc')][_0x638e2e][_0xc065('0x97')]=![];}}}}catch(_0x4a8a74){logger[_0xc065('0x52')](_0xc065('0x9a'),_0x544591[_0xc065('0x22')],util[_0xc065('0x31')](_0x4a8a74,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc065('0x1f')][_0xc065('0x87')]=function(_0x10fc92,_0x5ca781=0x2710){if(this[_0xc065('0x9')][_0x10fc92]){setTimeout(()=>{delete this[_0xc065('0x9')][_0x10fc92];},_0x5ca781);}};module[_0xc065('0x9b')]=VoiceAgentReport; \ No newline at end of file +var _0x6f9a=['[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','interface','destuniqueid','variables','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','assign','omit','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','queue','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','syncAgentConnect','agentconnectAt','connectedlinenum','destchannelstate','destchannelstatedesc','lastevent','connect','merge','pick','destconnectedlinenum','name','accountcode','custom:agentconnect','user:agentconnect','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','transfer','agent','talktime','acw','acwTimeout','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','user:agentcomplete','destaccountcode','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','exports','moment','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','musiconholdstart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info'];(function(_0x563c4f,_0xa194b6){var _0x51db8b=function(_0x1d10a4){while(--_0x1d10a4){_0x563c4f['push'](_0x563c4f['shift']());}};_0x51db8b(++_0xa194b6);}(_0x6f9a,0x76));var _0xa6f9=function(_0x5ee140,_0x53cf45){_0x5ee140=_0x5ee140-0x0;var _0x3411e2=_0x6f9a[_0x5ee140];return _0x3411e2;};'use strict';var _=require('lodash');var moment=require(_0xa6f9('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0xa6f9('0x1'));var logger=require('../../../config/logger')(_0xa6f9('0x2'));var ami=require(_0xa6f9('0x3'));config[_0xa6f9('0x4')]=_[_0xa6f9('0x5')](config[_0xa6f9('0x4')],{'host':_0xa6f9('0x6'),'port':0x18eb});var io=require(_0xa6f9('0x7'))(new Redis(config[_0xa6f9('0x4')]));function VoiceAgentReport(_0x1f4908){this[_0xa6f9('0x8')]={};this[_0xa6f9('0x9')]=_0x1f4908[_0xa6f9('0x8')];this['voiceQueues']=_0x1f4908[_0xa6f9('0xa')];this[_0xa6f9('0xb')]=_0x1f4908['agents'];this['variables']={};ami['on'](_0xa6f9('0xc'),this[_0xa6f9('0xd')][_0xa6f9('0xe')](this));ami['on'](_0xa6f9('0xf'),this['syncAgentConnect'][_0xa6f9('0xe')](this));ami['on'](_0xa6f9('0x10'),this[_0xa6f9('0x11')][_0xa6f9('0xe')](this));ami['on'](_0xa6f9('0x12'),this[_0xa6f9('0x13')][_0xa6f9('0xe')](this));ami['on'](_0xa6f9('0x14'),this[_0xa6f9('0x15')][_0xa6f9('0xe')](this));ami['on'](_0xa6f9('0x16'),this[_0xa6f9('0x17')][_0xa6f9('0xe')](this));ami['on'](_0xa6f9('0x18'),this['syncHangup'][_0xa6f9('0xe')](this));ami['on'](_0xa6f9('0x19'),this['syncMusicOnHoldStart'][_0xa6f9('0xe')](this));ami['on']('musiconholdstop',this[_0xa6f9('0x1a')][_0xa6f9('0xe')](this));ami['on'](_0xa6f9('0x1b'),this[_0xa6f9('0x1c')]['bind'](this));ami['on'](_0xa6f9('0x1d'),this[_0xa6f9('0x1e')]['bind'](this));}VoiceAgentReport[_0xa6f9('0x1f')][_0xa6f9('0x20')]=function(_0x2cf23a,_0x5623a3,_0x1cc0a5){io['to'](_0x2cf23a)[_0xa6f9('0x20')](_0x5623a3,_0x1cc0a5);};VoiceAgentReport[_0xa6f9('0x1f')][_0xa6f9('0x21')]=function(_0x1119ba){return _0x1119ba!==null&&!_[_0xa6f9('0x22')](_0x1119ba);};VoiceAgentReport[_0xa6f9('0x1f')]['syncAgentCalled']=function(_0xb9ae8d){try{if(this['isNotNull'](_0xb9ae8d)){logger[_0xa6f9('0x23')](_0xa6f9('0x24'),_0xb9ae8d[_0xa6f9('0x25')],_0xb9ae8d[_0xa6f9('0x26')],_0xb9ae8d['destuniqueid']);logger[_0xa6f9('0x27')](_0xa6f9('0x28'),_0xb9ae8d[_0xa6f9('0x25')],util[_0xa6f9('0x29')](_0xb9ae8d,{'showHidden':![],'depth':null}));if(_[_0xa6f9('0x22')](this[_0xa6f9('0x8')][_0xb9ae8d['uniqueid']])){this[_0xa6f9('0x8')][_0xb9ae8d[_0xa6f9('0x25')]]={};}var _0x245046=this['agents'][_0xb9ae8d[_0xa6f9('0x2a')]];var _0x3c056f=this[_0xa6f9('0x8')][_0xb9ae8d['uniqueid']][_0xb9ae8d[_0xa6f9('0x2b')]];var _0x2986cd=this[_0xa6f9('0xa')][_0xb9ae8d['queue']];var _0x1a2c22=this[_0xa6f9('0x2c')][_0xb9ae8d['uniqueid']];if(_[_0xa6f9('0x22')](_0x3c056f)){_0x3c056f={'agentcalledAt':moment()[_0xa6f9('0x2d')](_0xa6f9('0x2e')),'lastevent':_0xa6f9('0x2f'),'mandatoryDisposition':_0x2986cd&&_0x2986cd['mandatoryDisposition']?_0x2986cd[_0xa6f9('0x30')]:![],'type':_0x2986cd&&_0x2986cd[_0xa6f9('0x31')]?_0x2986cd[_0xa6f9('0x31')]:_0xa6f9('0x32'),'variables':_0x1a2c22,'motionChannel':_0xa6f9('0x33')};}Object[_0xa6f9('0x34')](_0x3c056f,_[_0xa6f9('0x35')](_0xb9ae8d,[_0xa6f9('0x36'),'privilege']));this[_0xa6f9('0x8')][_0xb9ae8d[_0xa6f9('0x25')]][_0xb9ae8d[_0xa6f9('0x2b')]]=_0x3c056f;logger[_0xa6f9('0x27')](_0xa6f9('0x37'),_0xb9ae8d[_0xa6f9('0x25')],util['inspect'](_0x3c056f,{'showHidden':![],'depth':null}));ami[_0xa6f9('0x20')](_0xa6f9('0x38'),_0x3c056f);var _0x43d81d={'id':_0x245046['id'],'calleridnum':_0x3c056f[_0xa6f9('0x39')],'queue':_0x3c056f[_0xa6f9('0x3a')],'variables':_0x3c056f[_0xa6f9('0x2c')],'uniqueid':_0xb9ae8d[_0xa6f9('0x25')]};logger[_0xa6f9('0x27')](_0xa6f9('0x3b'),_0xb9ae8d[_0xa6f9('0x25')],util[_0xa6f9('0x29')](_0x43d81d,{'showHidden':![],'depth':null}));this[_0xa6f9('0x20')](util[_0xa6f9('0x2d')](_0xa6f9('0x3c'),_0xb9ae8d[_0xa6f9('0x26')]),_0xa6f9('0x3d'),_0x43d81d);}}catch(_0x36643e){logger[_0xa6f9('0x3e')]('[%s][voiceAgentReport][agentcalled]',_0xb9ae8d[_0xa6f9('0x25')],util[_0xa6f9('0x29')](_0x36643e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa6f9('0x1f')][_0xa6f9('0x3f')]=function(_0x46a0dc){try{if(this[_0xa6f9('0x21')](_0x46a0dc)){if(this[_0xa6f9('0x8')][_0x46a0dc[_0xa6f9('0x25')]]){for(var _0x10aae1 in this[_0xa6f9('0x8')][_0x46a0dc['uniqueid']]){if(this[_0xa6f9('0x8')][_0x46a0dc[_0xa6f9('0x25')]]['hasOwnProperty'](_0x10aae1)){if(_0x46a0dc[_0xa6f9('0x2b')]===_0x10aae1){logger[_0xa6f9('0x23')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x46a0dc[_0xa6f9('0x25')],_0x46a0dc[_0xa6f9('0x26')],_0x46a0dc[_0xa6f9('0x2b')]);this[_0xa6f9('0x8')][_0x46a0dc[_0xa6f9('0x25')]][_0x10aae1][_0xa6f9('0x40')]=moment()[_0xa6f9('0x2d')](_0xa6f9('0x2e'));this[_0xa6f9('0x8')][_0x46a0dc[_0xa6f9('0x25')]][_0x10aae1]['connectedlinename']=_0x46a0dc['connectedlinename'];this[_0xa6f9('0x8')][_0x46a0dc[_0xa6f9('0x25')]][_0x10aae1][_0xa6f9('0x41')]=_0x46a0dc[_0xa6f9('0x41')];this[_0xa6f9('0x8')][_0x46a0dc[_0xa6f9('0x25')]][_0x10aae1][_0xa6f9('0x42')]=_0x46a0dc['destchannelstate'];this[_0xa6f9('0x8')][_0x46a0dc['uniqueid']][_0x10aae1][_0xa6f9('0x43')]=_0x46a0dc[_0xa6f9('0x43')];this[_0xa6f9('0x8')][_0x46a0dc[_0xa6f9('0x25')]][_0x10aae1]['holdtime']=_0x46a0dc['holdtime'];this['channels'][_0x46a0dc[_0xa6f9('0x25')]][_0x10aae1][_0xa6f9('0x44')]=_0xa6f9('0x45');_[_0xa6f9('0x46')](this[_0xa6f9('0xb')][_0x46a0dc[_0xa6f9('0x2a')]],_[_0xa6f9('0x47')](_0x46a0dc,[_0xa6f9('0x3a'),_0xa6f9('0x48')]));var _0x4c659a=this[_0xa6f9('0xb')][_0x46a0dc[_0xa6f9('0x2a')]];var _0x1a1ead={'id':_0x4c659a['id'],'name':_0x4c659a[_0xa6f9('0x49')],'agentconnected':!![],'destaccountcode':_0x4c659a[_0xa6f9('0x4a')],'destconnectedlinenum':this[_0xa6f9('0x8')][_0x46a0dc[_0xa6f9('0x25')]][_0x46a0dc[_0xa6f9('0x2b')]]['exten'],'queue':this[_0xa6f9('0x8')][_0x46a0dc['uniqueid']][_0x46a0dc[_0xa6f9('0x2b')]][_0xa6f9('0x3a')],'uniqueid':this[_0xa6f9('0x8')][_0x46a0dc[_0xa6f9('0x25')]][_0x46a0dc['destuniqueid']]['uniqueid']};ami[_0xa6f9('0x20')](_0xa6f9('0x4b'),this[_0xa6f9('0x8')][_0x46a0dc[_0xa6f9('0x25')]][_0x46a0dc[_0xa6f9('0x2b')]]);this[_0xa6f9('0x20')](util[_0xa6f9('0x2d')](_0xa6f9('0x3c'),_0x46a0dc[_0xa6f9('0x26')]),_0xa6f9('0x4c'),_0x1a1ead);}else if(!this[_0xa6f9('0x8')][_0x46a0dc[_0xa6f9('0x25')]][_0x10aae1]['agentringnoanswer']&&!this[_0xa6f9('0x8')][_0x46a0dc[_0xa6f9('0x25')]][_0x10aae1][_0xa6f9('0x14')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x46a0dc['uniqueid'],this[_0xa6f9('0x8')][_0x46a0dc[_0xa6f9('0x25')]][_0x10aae1][_0xa6f9('0x26')],_0x10aae1);this['channels'][_0x46a0dc[_0xa6f9('0x25')]][_0x10aae1][_0xa6f9('0x10')]=!![];this['channels'][_0x46a0dc[_0xa6f9('0x25')]][_0x10aae1][_0xa6f9('0x4d')]=moment()[_0xa6f9('0x2d')](_0xa6f9('0x2e'));this[_0xa6f9('0x8')][_0x46a0dc[_0xa6f9('0x25')]][_0x10aae1][_0xa6f9('0x4e')]=_0x46a0dc[_0xa6f9('0x2b')];this[_0xa6f9('0x8')][_0x46a0dc[_0xa6f9('0x25')]][_0x10aae1][_0xa6f9('0x4f')]=_0x46a0dc[_0xa6f9('0x26')];this[_0xa6f9('0x8')][_0x46a0dc[_0xa6f9('0x25')]][_0x10aae1]['lastevent']=_0xa6f9('0x50');this[_0xa6f9('0x8')][_0x46a0dc[_0xa6f9('0x25')]][_0x10aae1][_0xa6f9('0x51')]=_0xa6f9('0x50');logger[_0xa6f9('0x27')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x46a0dc[_0xa6f9('0x25')],util[_0xa6f9('0x29')](this[_0xa6f9('0x8')][_0x46a0dc['uniqueid']][_0x10aae1],{'showHidden':![],'depth':null}));ami[_0xa6f9('0x20')](_0xa6f9('0x52'),this['channels'][_0x46a0dc[_0xa6f9('0x25')]][_0x10aae1]);}else{logger[_0xa6f9('0x27')](_0xa6f9('0x53'),_0x46a0dc[_0xa6f9('0x25')]);}}}}}}catch(_0x2f8d34){logger['error'](_0xa6f9('0x54'),_0x46a0dc['uniqueid'],util[_0xa6f9('0x29')](_0x2f8d34,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa6f9('0x1f')]['syncAgentRingNoAnswer']=function(_0x33ff23){try{if(this[_0xa6f9('0x21')](_0x33ff23)){logger[_0xa6f9('0x27')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x33ff23['uniqueid'],util[_0xa6f9('0x29')](_0x33ff23,{'showHidden':![],'depth':null}));if(this['channels'][_0x33ff23['uniqueid']]&&this[_0xa6f9('0x8')][_0x33ff23[_0xa6f9('0x25')]][_0x33ff23['destuniqueid']]){logger[_0xa6f9('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x33ff23['uniqueid'],_0x33ff23['membername'],_0x33ff23[_0xa6f9('0x2b')]);var _0x5a9f92=this[_0xa6f9('0xb')][_0x33ff23[_0xa6f9('0x2a')]];var _0x5dbdb2=this[_0xa6f9('0x8')][_0x33ff23['uniqueid']][_0x33ff23[_0xa6f9('0x2b')]];_0x5dbdb2[_0xa6f9('0x10')]=!![];_0x5dbdb2[_0xa6f9('0x4d')]=moment()['format'](_0xa6f9('0x2e'));_0x5dbdb2[_0xa6f9('0x44')]=_0xa6f9('0x55');_0x5dbdb2['reason']=_0xa6f9('0x55');var _0x14ed90={'id':_0x5a9f92['id'],'name':_0x5a9f92[_0xa6f9('0x49')],'queue':_0x5dbdb2[_0xa6f9('0x3a')],'uniqueid':_0x5dbdb2[_0xa6f9('0x25')]};logger[_0xa6f9('0x27')](_0xa6f9('0x56'),_0x33ff23[_0xa6f9('0x25')],util[_0xa6f9('0x29')](_0x14ed90,{'showHidden':![],'depth':null}));this[_0xa6f9('0x20')](util[_0xa6f9('0x2d')](_0xa6f9('0x3c'),_0x5a9f92[_0xa6f9('0x49')]),_0xa6f9('0x57'),_0x14ed90);ami['emit'](_0xa6f9('0x58'),_0x5dbdb2);this['channels'][_0x33ff23[_0xa6f9('0x25')]][_0x33ff23[_0xa6f9('0x2b')]]=Object['assign']({},_0x5dbdb2);}}}catch(_0x133491){logger[_0xa6f9('0x3e')]('[%s][voiceAgentReport][agentringnoanswer]',_0x33ff23['uniqueid'],util['inspect'](_0x133491,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0x496aea){try{if(this[_0xa6f9('0x21')](_0x496aea)){logger[_0xa6f9('0x27')](_0xa6f9('0x59'),_0x496aea['uniqueid'],util[_0xa6f9('0x29')](_0x496aea,{'showHidden':![],'depth':null}));if(this[_0xa6f9('0x8')][_0x496aea['uniqueid']]){for(var _0x5c8c7d in this['channels'][_0x496aea[_0xa6f9('0x25')]]){if(this[_0xa6f9('0x8')][_0x496aea[_0xa6f9('0x25')]][_0xa6f9('0x5a')](_0x5c8c7d)&&!this[_0xa6f9('0x8')][_0x496aea['uniqueid']][_0x5c8c7d]['agentringnoanswer']&&!this['channels'][_0x496aea[_0xa6f9('0x25')]][_0x5c8c7d][_0xa6f9('0x14')]){logger[_0xa6f9('0x23')](_0xa6f9('0x5b'),_0x496aea[_0xa6f9('0x25')],this[_0xa6f9('0x8')][_0x496aea[_0xa6f9('0x25')]][_0x5c8c7d]['membername'],_0x5c8c7d);this[_0xa6f9('0x8')][_0x496aea[_0xa6f9('0x25')]][_0x5c8c7d][_0xa6f9('0x10')]=!![];this[_0xa6f9('0x8')][_0x496aea[_0xa6f9('0x25')]][_0x5c8c7d][_0xa6f9('0x4d')]=moment()[_0xa6f9('0x2d')](_0xa6f9('0x2e'));this[_0xa6f9('0x8')][_0x496aea[_0xa6f9('0x25')]][_0x5c8c7d][_0xa6f9('0x44')]=_0xa6f9('0x5c');this['channels'][_0x496aea[_0xa6f9('0x25')]][_0x5c8c7d][_0xa6f9('0x51')]='abandoned';logger['debug']('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x496aea['uniqueid'],util['inspect'](this['channels'][_0x496aea[_0xa6f9('0x25')]][_0x5c8c7d],{'showHidden':![],'depth':null}));ami[_0xa6f9('0x20')](_0xa6f9('0x5d'),this[_0xa6f9('0x8')][_0x496aea[_0xa6f9('0x25')]][_0x5c8c7d]);}}}}}catch(_0x53e1f2){logger[_0xa6f9('0x3e')]('[%s][voiceAgentReport][queuecallerabandon]',_0x496aea[_0xa6f9('0x25')],util[_0xa6f9('0x29')](_0x53e1f2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa6f9('0x1f')][_0xa6f9('0x15')]=function(_0x5ed885){try{if(this[_0xa6f9('0x21')](_0x5ed885)){logger[_0xa6f9('0x27')](_0xa6f9('0x5e'),_0x5ed885[_0xa6f9('0x25')],util[_0xa6f9('0x29')](_0x5ed885,{'showHidden':![],'depth':null}));if(this[_0xa6f9('0x8')][_0x5ed885[_0xa6f9('0x25')]]){for(var _0x3b6bc3 in this[_0xa6f9('0x8')][_0x5ed885['uniqueid']]){if(this[_0xa6f9('0x8')][_0x5ed885[_0xa6f9('0x25')]][_0xa6f9('0x5a')](_0x3b6bc3)){if(this[_0xa6f9('0x8')][_0x5ed885[_0xa6f9('0x25')]][_0x3b6bc3][_0xa6f9('0x40')]&&!this['channels'][_0x5ed885[_0xa6f9('0x25')]][_0x3b6bc3][_0xa6f9('0x14')]){logger['info']('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5ed885[_0xa6f9('0x25')],this[_0xa6f9('0x8')][_0x5ed885[_0xa6f9('0x25')]][_0x3b6bc3][_0xa6f9('0x26')],_0x3b6bc3);this[_0xa6f9('0x8')][_0x5ed885[_0xa6f9('0x25')]][_0x3b6bc3][_0xa6f9('0x14')]=!![];this[_0xa6f9('0x8')][_0x5ed885[_0xa6f9('0x25')]][_0x3b6bc3][_0xa6f9('0x5f')]=moment()[_0xa6f9('0x2d')](_0xa6f9('0x2e'));this[_0xa6f9('0x8')][_0x5ed885[_0xa6f9('0x25')]][_0x3b6bc3][_0xa6f9('0x44')]=_0xa6f9('0x60');this['channels'][_0x5ed885['uniqueid']][_0x3b6bc3][_0xa6f9('0x51')]=_0x5ed885['reason']==_0xa6f9('0x61')?_0xa6f9('0x62'):_0x5ed885[_0xa6f9('0x51')];this['channels'][_0x5ed885[_0xa6f9('0x25')]][_0x3b6bc3]['talktime']=_0x5ed885[_0xa6f9('0x63')];if(this[_0xa6f9('0xa')][_0x5ed885[_0xa6f9('0x3a')]]&&this[_0xa6f9('0xa')][_0x5ed885[_0xa6f9('0x3a')]][_0xa6f9('0x64')]){this[_0xa6f9('0x8')][_0x5ed885[_0xa6f9('0x25')]][_0x3b6bc3]['acwtime']=this[_0xa6f9('0xa')][_0x5ed885[_0xa6f9('0x3a')]][_0xa6f9('0x65')];this[_0xa6f9('0x8')][_0x5ed885[_0xa6f9('0x25')]][_0x3b6bc3]['agentacw']=!![];}this['agents'][_0x5ed885[_0xa6f9('0x2a')]]=_[_0xa6f9('0x35')](this['agents'][_0x5ed885[_0xa6f9('0x2a')]],['queue','destconnectedlinenum']);logger[_0xa6f9('0x27')](_0xa6f9('0x66'),_0x5ed885['uniqueid'],util[_0xa6f9('0x29')](this[_0xa6f9('0x8')][_0x5ed885[_0xa6f9('0x25')]][_0x3b6bc3],{'showHidden':![],'depth':null}));ami[_0xa6f9('0x20')]('custom:agentcomplete',this['channels'][_0x5ed885['uniqueid']][_0x3b6bc3]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x5ed885[_0xa6f9('0x25')],util[_0xa6f9('0x29')]({'id':this[_0xa6f9('0xb')][_0x5ed885[_0xa6f9('0x2a')]]['id'],'destaccountcode':_0x5ed885['destaccountcode']},{'showHidden':![],'depth':null}));this[_0xa6f9('0x20')](util[_0xa6f9('0x2d')]('user:%s',_0x5ed885[_0xa6f9('0x26')]),_0xa6f9('0x67'),{'id':this['agents'][_0x5ed885[_0xa6f9('0x2a')]]['id'],'destaccountcode':Number(_0x5ed885[_0xa6f9('0x68')])});}}}}}}catch(_0x4d3a3a){logger[_0xa6f9('0x3e')](_0xa6f9('0x69'),_0x5ed885[_0xa6f9('0x25')],util[_0xa6f9('0x29')](_0x4d3a3a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa6f9('0x1f')]['syncVarSet']=function(_0x1589fd){try{if(this['isNotNull'](_0x1589fd)){logger[_0xa6f9('0x27')](_0xa6f9('0x6a'),_0x1589fd[_0xa6f9('0x25')],util['inspect'](_0x1589fd,{'showHidden':![],'depth':null}));this[_0xa6f9('0x6b')](_0x1589fd[_0xa6f9('0x25')],_[_0xa6f9('0x6c')](_0x1589fd['variable'])[0x0],_0x1589fd[_0xa6f9('0x6d')]);if(this[_0xa6f9('0x8')][_0x1589fd['uniqueid']]){for(var _0xac6f2c in this[_0xa6f9('0x8')][_0x1589fd['uniqueid']]){if(this[_0xa6f9('0x8')][_0x1589fd[_0xa6f9('0x25')]][_0xa6f9('0x5a')](_0xac6f2c)){logger['info'](_0xa6f9('0x6e'),_0x1589fd[_0xa6f9('0x25')],_0xac6f2c,_[_0xa6f9('0x6c')](_0x1589fd[_0xa6f9('0x6f')])[0x0],_0x1589fd['value']);if(_[_0xa6f9('0x22')](this[_0xa6f9('0x8')][_0x1589fd[_0xa6f9('0x25')]][_0xac6f2c]['variables'])){this[_0xa6f9('0x8')][_0x1589fd[_0xa6f9('0x25')]][_0xac6f2c][_0xa6f9('0x2c')]={};}this['channels'][_0x1589fd[_0xa6f9('0x25')]][_0xac6f2c]['variables']=this[_0xa6f9('0x2c')][_0x1589fd[_0xa6f9('0x25')]];}}}}}catch(_0x10f26e){logger['error'](_0xa6f9('0x70'),_0x1589fd[_0xa6f9('0x25')],util[_0xa6f9('0x29')](_0x10f26e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa6f9('0x6b')]=function(_0x1a1f4c,_0x1187a6,_0x3c27d8){var _0x54e5dc=['rtpaudioqos',_0xa6f9('0x71'),_0xa6f9('0x72'),_0xa6f9('0x73'),'rtpaudioqosloss',_0xa6f9('0x74'),'rtpaudioqosrtt',_0xa6f9('0x75'),_0xa6f9('0x76'),_0xa6f9('0x77'),'bridgepeer','bridgepvtcallid',_0xa6f9('0x78'),_0xa6f9('0x79'),_0xa6f9('0x7a'),_0xa6f9('0x7b'),_0xa6f9('0x26'),_0xa6f9('0x7c'),_0xa6f9('0x7d')];if(!_[_0xa6f9('0x7e')](_0x1187a6)&&!_['includes'](_0x54e5dc,_0x1187a6)){if(_[_0xa6f9('0x22')](this[_0xa6f9('0x2c')][_0x1a1f4c])){this[_0xa6f9('0x2c')][_0x1a1f4c]={};}this[_0xa6f9('0x2c')][_0x1a1f4c][_0x1187a6]=_0x3c27d8;}};VoiceAgentReport['prototype'][_0xa6f9('0x7f')]=function(_0x702df0){try{if(this[_0xa6f9('0x21')](_0x702df0)){logger[_0xa6f9('0x27')](_0xa6f9('0x80'),_0x702df0['uniqueid'],util[_0xa6f9('0x29')](_0x702df0,{'showHidden':![],'depth':null}));if(this[_0xa6f9('0x8')][_0x702df0['uniqueid']]){for(var _0x243bef in this['channels'][_0x702df0[_0xa6f9('0x25')]]){if(this[_0xa6f9('0x8')][_0x702df0['uniqueid']]['hasOwnProperty'](_0x243bef)){if(this[_0xa6f9('0x8')][_0x702df0[_0xa6f9('0x25')]][_0x243bef][_0xa6f9('0x51')]==_0xa6f9('0x61')&&this[_0xa6f9('0x8')][_0x702df0['uniqueid']][_0x243bef][_0xa6f9('0x14')]){logger[_0xa6f9('0x23')](_0xa6f9('0x81'),_0x702df0['uniqueid'],_0x243bef);this[_0xa6f9('0x8')][_0x702df0['uniqueid']][_0x243bef][_0xa6f9('0x5f')]=moment()[_0xa6f9('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0xa6f9('0x82'),_0x702df0['uniqueid'],util[_0xa6f9('0x29')](_[_0xa6f9('0x83')](this[_0xa6f9('0x8')][_0x702df0[_0xa6f9('0x25')]]),{'showHidden':![],'depth':null}));ami[_0xa6f9('0x20')](_0xa6f9('0x84'),_[_0xa6f9('0x83')](this[_0xa6f9('0x8')][_0x702df0[_0xa6f9('0x25')]]));this[_0xa6f9('0x85')](_0x702df0['uniqueid']);}if(this[_0xa6f9('0x2c')][_0x702df0['uniqueid']]){delete this['variables'][_0x702df0[_0xa6f9('0x25')]];}}}catch(_0x5c6644){logger['error'](_0xa6f9('0x86'),_0x702df0['uniqueid'],util[_0xa6f9('0x29')](_0x5c6644,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAttendedTransfer']=function(_0x2d548c){try{if(this[_0xa6f9('0x21')](_0x2d548c)){logger[_0xa6f9('0x27')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x2d548c['uniqueid'],util[_0xa6f9('0x29')](_0x2d548c,{'showHidden':![],'depth':null}));if(this[_0xa6f9('0x8')][_0x2d548c['transfereeuniqueid']]){for(var _0x4636d3 in this['channels'][_0x2d548c['transfereeuniqueid']]){if(this[_0xa6f9('0x8')][_0x2d548c[_0xa6f9('0x87')]]['hasOwnProperty'](_0x4636d3)){if(_0x2d548c[_0xa6f9('0x88')]===_0x4636d3){logger['info'](_0xa6f9('0x89'),_0x2d548c['uniqueid'],this[_0xa6f9('0x8')][_0x2d548c['transfereeuniqueid']][_0x4636d3][_0xa6f9('0x26')],_0x4636d3);var _0x46b3ab=moment();this[_0xa6f9('0x8')][_0x2d548c[_0xa6f9('0x87')]][_0x4636d3][_0xa6f9('0x14')]=!![];this[_0xa6f9('0x8')][_0x2d548c[_0xa6f9('0x87')]][_0x4636d3][_0xa6f9('0x5f')]=moment()[_0xa6f9('0x2d')](_0xa6f9('0x2e'));this[_0xa6f9('0x8')][_0x2d548c[_0xa6f9('0x87')]][_0x4636d3][_0xa6f9('0x44')]=_0xa6f9('0x60');this['channels'][_0x2d548c['transfereeuniqueid']][_0x4636d3]['reason']='transfer';this[_0xa6f9('0x8')][_0x2d548c[_0xa6f9('0x87')]][_0x4636d3]['talktime']=_0x46b3ab['diff'](this[_0xa6f9('0x8')][_0x2d548c[_0xa6f9('0x87')]][_0x4636d3][_0xa6f9('0x40')],_0xa6f9('0x8a'));}}}}if(this[_0xa6f9('0x8')][_0x2d548c[_0xa6f9('0x8b')]]){var _0x476734=this['channels'][_0x2d548c[_0xa6f9('0x8b')]];this['channels'][_0x2d548c[_0xa6f9('0x8b')]]=this[_0xa6f9('0x8')][_0x2d548c['transfereeuniqueid']];this[_0xa6f9('0x8')][_0x2d548c[_0xa6f9('0x87')]]=_0x476734;}}}catch(_0x4e1f85){logger[_0xa6f9('0x3e')](_0xa6f9('0x8c'),_0x2d548c[_0xa6f9('0x25')],util['inspect'](_0x4e1f85,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa6f9('0x1f')]['syncBlindTransfer']=function(_0xe573d1){try{if(this['isNotNull'](_0xe573d1)){logger['debug'](_0xa6f9('0x8d'),_0xe573d1['uniqueid'],util[_0xa6f9('0x29')](_0xe573d1,{'showHidden':![],'depth':null}));if(this[_0xa6f9('0x8')][_0xe573d1[_0xa6f9('0x87')]]){for(var _0xec9393 in this[_0xa6f9('0x8')][_0xe573d1['transfereeuniqueid']]){if(this[_0xa6f9('0x8')][_0xe573d1['transfereeuniqueid']][_0xa6f9('0x5a')](_0xec9393)){if(_0xe573d1['transfereruniqueid']===_0xec9393){logger['info'](_0xa6f9('0x8e'),_0xe573d1['uniqueid'],this[_0xa6f9('0x8')][_0xe573d1[_0xa6f9('0x87')]][_0xec9393][_0xa6f9('0x26')],_0xec9393);var _0x247e33=moment();this[_0xa6f9('0x8')][_0xe573d1['transfereeuniqueid']][_0xec9393]['agentcomplete']=!![];this[_0xa6f9('0x8')][_0xe573d1['transfereeuniqueid']][_0xec9393][_0xa6f9('0x5f')]=_0x247e33;this[_0xa6f9('0x8')][_0xe573d1['transfereeuniqueid']][_0xec9393]['lastevent']='complete';this[_0xa6f9('0x8')][_0xe573d1[_0xa6f9('0x87')]][_0xec9393][_0xa6f9('0x51')]=_0xa6f9('0x61');this[_0xa6f9('0x8')][_0xe573d1[_0xa6f9('0x87')]][_0xec9393]['talktime']=_0x247e33[_0xa6f9('0x8f')](this['channels'][_0xe573d1[_0xa6f9('0x87')]][_0xec9393][_0xa6f9('0x40')],_0xa6f9('0x8a'));}}}}}}catch(_0x2e18a1){logger[_0xa6f9('0x3e')](_0xa6f9('0x90'),_0xe573d1[_0xa6f9('0x25')],util[_0xa6f9('0x29')](_0x2e18a1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa6f9('0x1f')][_0xa6f9('0x91')]=function(_0x30ea0b){var _0x345a09='';try{if(this['isNotNull'](_0x30ea0b)){logger[_0xa6f9('0x27')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x30ea0b['uniqueid'],util[_0xa6f9('0x29')](_0x30ea0b,{'showHidden':![],'depth':null}));if(_0x30ea0b[_0xa6f9('0x92')]){_0x345a09=_0x30ea0b[_0xa6f9('0x92')][_0xa6f9('0x93')](0x0,_0x30ea0b[_0xa6f9('0x92')][_0xa6f9('0x94')]('-'));if(this[_0xa6f9('0xb')][_0x345a09]){logger[_0xa6f9('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x30ea0b[_0xa6f9('0x25')],_0x345a09);this['agents'][_0x345a09]['onhold']=!![];}}}}catch(_0x57b9c9){logger['error'](_0xa6f9('0x95'),_0x30ea0b[_0xa6f9('0x25')],util[_0xa6f9('0x29')](_0x57b9c9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa6f9('0x1f')][_0xa6f9('0x1a')]=function(_0x3df8be){var _0x22cb66='';try{if(this[_0xa6f9('0x21')](_0x3df8be)){logger['debug'](_0xa6f9('0x96'),_0x3df8be['uniqueid'],util[_0xa6f9('0x29')](_0x3df8be,{'showHidden':![],'depth':null}));if(_0x3df8be[_0xa6f9('0x92')]){_0x22cb66=_0x3df8be[_0xa6f9('0x92')]['substring'](0x0,_0x3df8be[_0xa6f9('0x92')][_0xa6f9('0x94')]('-'));if(this[_0xa6f9('0xb')][_0x22cb66]){logger[_0xa6f9('0x23')](_0xa6f9('0x97'),_0x3df8be['uniqueid'],_0x22cb66);this[_0xa6f9('0xb')][_0x22cb66][_0xa6f9('0x98')]=![];}}}}catch(_0x4b58a0){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x3df8be[_0xa6f9('0x25')],util[_0xa6f9('0x29')](_0x4b58a0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa6f9('0x85')]=function(_0xfc0e73,_0x2cdf6f=0x2710){if(this[_0xa6f9('0x8')][_0xfc0e73]){setTimeout(()=>{delete this[_0xa6f9('0x8')][_0xfc0e73];},_0x2cdf6f);}};module[_0xa6f9('0x99')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index edbdd55..9f18302 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 _0x93e7=['[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','syncMixMonitorFilename','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','transferType','then','transferToInternal','isEmpty','getSettings','resolve','Action','StopMixMonitor','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','ATTENDED','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','transfereecalleridnum','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../rpc/setting','set','queue','agi','dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','syncVarSet','hangup','syncHangup','newcallerid','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','error','prototype','isNotNull','isUndefined','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','inspect','linkedid','merge','context','from-sip','channel','split','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','blindTransfers','exten','starttime','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','pick','keys','undefined','accountcode','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','disposition','includes','lastapplication','startsWith','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinename','destinationchannel','membername','UserId','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','monitorFilename','find','monitors','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','xmd-destination'];(function(_0x5d93ea,_0x175725){var _0x440cd1=function(_0x1d7d7f){while(--_0x1d7d7f){_0x5d93ea['push'](_0x5d93ea['shift']());}};_0x440cd1(++_0x175725);}(_0x93e7,0xfd));var _0x793e=function(_0x3eee56,_0x176daf){_0x3eee56=_0x3eee56-0x0;var _0x506bcd=_0x93e7[_0x3eee56];return _0x506bcd;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var path=require(_0x793e('0x0'));var Redis=require(_0x793e('0x1'));var config=require(_0x793e('0x2'));var logger=require(_0x793e('0x3'))(_0x793e('0x4'));var ami=require(_0x793e('0x5'));var Channel=require('../model/channel');var RpcSetting=require(_0x793e('0x6'));var applications=[_0x793e('0x7'),_0x793e('0x8'),_0x793e('0x9'),_0x793e('0xa'),'playback',_0x793e('0xb')];var dispositions=[_0x793e('0xc'),_0x793e('0xd'),_0x793e('0xd'),_0x793e('0xc'),_0x793e('0xc'),_0x793e('0xc'),_0x793e('0xe'),_0x793e('0xf'),'FAILED',_0x793e('0xd'),_0x793e('0xd')];config['redis']=_[_0x793e('0x10')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x793e('0x11')]));function VoiceCallReport(_0x4c07fd){this[_0x793e('0x12')]=_0x4c07fd['channels'];this[_0x793e('0x13')]=_0x4c07fd[_0x793e('0x13')];this['blindTransfers']={};ami['on'](_0x793e('0x14'),this[_0x793e('0x15')][_0x793e('0x16')](this));ami['on'](_0x793e('0x17'),this['syncNewExten'][_0x793e('0x16')](this));ami['on'](_0x793e('0x18'),this[_0x793e('0x19')][_0x793e('0x16')](this));ami['on'](_0x793e('0x1a'),this[_0x793e('0x1b')][_0x793e('0x16')](this));ami['on']('varset',this[_0x793e('0x1c')]['bind'](this));ami['on'](_0x793e('0x1d'),this[_0x793e('0x1e')][_0x793e('0x16')](this));ami['on'](_0x793e('0x1f'),this['syncNewCallerId']['bind'](this));ami['on']('attendedtransfer',this[_0x793e('0x20')]['bind'](this));ami['on'](_0x793e('0x21'),this[_0x793e('0x22')][_0x793e('0x16')](this));ami['on'](_0x793e('0x23'),this[_0x793e('0x24')][_0x793e('0x16')](this));ami['on'](_0x793e('0x25'),this['syncMusicOnHoldStop'][_0x793e('0x16')](this));try{logger[_0x793e('0x26')]('[voiceCallReport][coreshowchannels]\x20started');ami['actionCoreShowChannels']();}catch(_0x186dfb){logger[_0x793e('0x27')]('[voiceCallReport][coreshowchannels]',util['inspect'](_0x186dfb,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x793e('0x28')][_0x793e('0x29')]=function(_0x42b35a){return _0x42b35a!==null&&!_[_0x793e('0x2a')](_0x42b35a);};VoiceCallReport[_0x793e('0x28')][_0x793e('0x2b')]=function(_0x242b92,_0x55f12d,_0x447e45){io['to'](_0x242b92)[_0x793e('0x2b')](_0x55f12d,_0x447e45);};VoiceCallReport[_0x793e('0x28')][_0x793e('0x2c')]=function(_0x38cc55){try{if(this['isNotNull'](_0x38cc55)){logger[_0x793e('0x26')](_0x793e('0x2d'),_0x38cc55['uniqueid'],_0x38cc55[_0x793e('0x2e')],_0x38cc55[_0x793e('0x2f')]);logger[_0x793e('0x30')](_0x793e('0x31'),_0x38cc55[_0x793e('0x32')],util[_0x793e('0x33')](_0x38cc55,{'showHidden':![],'depth':null}));if(_0x38cc55[_0x793e('0x32')]===_0x38cc55[_0x793e('0x34')]){if(!_[_0x793e('0x2a')](this[_0x793e('0x12')][_0x38cc55[_0x793e('0x32')]])){_[_0x793e('0x35')](this[_0x793e('0x12')][_0x38cc55[_0x793e('0x32')]],_['pick'](_0x38cc55,_['keys'](this[_0x793e('0x12')][_0x38cc55[_0x793e('0x32')]])));}}if(_0x38cc55[_0x793e('0x36')]===_0x793e('0x37')){var _0x1b3e73=this['agents'][_0x38cc55[_0x793e('0x38')][_0x793e('0x39')]('-')[0x0]];if(_0x1b3e73){if(_0x38cc55['exten']=='xcally-motion-preview'){_0x1b3e73[_0x793e('0x3a')]=_0x38cc55[_0x793e('0x3b')];this['emit'](util[_0x793e('0x3c')](_0x793e('0x3d'),_0x1b3e73[_0x793e('0x3e')]),_0x793e('0x3f'),{'id':_0x1b3e73['id'],'destaccountcode':_0x1b3e73['accountcode'],'destconnectedlinenum':_0x38cc55['connectedlinenum']});}}}}}catch(_0x20e798){logger[_0x793e('0x27')](_0x793e('0x40'),_0x38cc55['uniqueid'],util[_0x793e('0x33')](_0x20e798,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x793e('0x28')][_0x793e('0x19')]=function(_0x56dcfb){try{if(this[_0x793e('0x29')](_0x56dcfb)){logger[_0x793e('0x30')](_0x793e('0x41'),_0x56dcfb[_0x793e('0x32')],util[_0x793e('0x33')](_0x56dcfb,{'showHidden':![],'depth':null}));if(this[_0x793e('0x12')][_0x56dcfb['uniqueid']]){return;}if(_0x56dcfb[_0x793e('0x38')]===_0x793e('0x42')){return;}if(_0x56dcfb[_0x793e('0x32')]!==_0x56dcfb[_0x793e('0x34')]&&!this[_0x793e('0x43')][_0x56dcfb['linkedid']]){return;}logger[_0x793e('0x26')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x56dcfb[_0x793e('0x32')],_0x56dcfb[_0x793e('0x36')],_0x56dcfb[_0x793e('0x44')]);this[_0x793e('0x12')][_0x56dcfb[_0x793e('0x32')]]=new Channel();this[_0x793e('0x12')][_0x56dcfb['uniqueid']][_0x793e('0x45')]=moment()[_0x793e('0x3c')](_0x793e('0x46'));this[_0x793e('0x12')][_0x56dcfb[_0x793e('0x32')]]['disposition']=dispositions[_[_0x793e('0x47')](_0x56dcfb[_0x793e('0x48')])];_['merge'](this['channels'][_0x56dcfb[_0x793e('0x32')]],_[_0x793e('0x49')](_0x56dcfb,_[_0x793e('0x4a')](this['channels'][_0x56dcfb[_0x793e('0x32')]])));if(_0x56dcfb[_0x793e('0x36')]===_0x793e('0x37')){var _0x302819=this['agents'][_0x56dcfb['channel']['split']('-')[0x0]];if(_0x302819&&typeof _0x302819[_0x793e('0x3a')]===_0x793e('0x4b')){_0x302819[_0x793e('0x3a')]=_0x56dcfb['exten'];logger[_0x793e('0x30')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x56dcfb[_0x793e('0x32')],util[_0x793e('0x33')]({'id':_0x302819['id'],'destaccountcode':_0x302819[_0x793e('0x4c')],'destconnectedlinenum':_0x56dcfb[_0x793e('0x44')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x793e('0x3c')](_0x793e('0x3d'),_0x302819[_0x793e('0x3e')]),_0x793e('0x3f'),{'id':_0x302819['id'],'destaccountcode':_0x302819['accountcode'],'destconnectedlinenum':_0x56dcfb[_0x793e('0x44')]});}}}}catch(_0x2b70e3){logger['error'](_0x793e('0x4d'),_0x56dcfb['uniqueid'],util['inspect'](_0x2b70e3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x793e('0x28')][_0x793e('0x15')]=function(_0x5c824d){try{if(this[_0x793e('0x29')](_0x5c824d)){logger[_0x793e('0x30')](_0x793e('0x4e'),_0x5c824d[_0x793e('0x32')],util[_0x793e('0x33')](_0x5c824d,{'showHidden':![],'depth':null}));if(_0x5c824d[_0x793e('0x38')]==='OutgoingSpoolFailed'||_0x5c824d['exten']==='h')return;if(_0x5c824d['uniqueid']===_0x5c824d[_0x793e('0x34')]||this['blindTransfers'][_0x5c824d[_0x793e('0x34')]]){_0x5c824d['application']=_0x5c824d[_0x793e('0x4f')]?_0x5c824d[_0x793e('0x4f')][_0x793e('0x50')]():undefined;_0x5c824d[_0x793e('0x51')]=_0x5c824d['appdata']||_0x5c824d['applicationdata'];if(_0x5c824d['appdata']&&_0x5c824d['application']!==_0x793e('0x8')){_0x5c824d[_0x793e('0x51')]=_0x5c824d['applicationdata'][_0x793e('0x50')]();}logger[_0x793e('0x26')](_0x793e('0x52'),_0x5c824d[_0x793e('0x32')],_0x5c824d[_0x793e('0x4f')],_0x5c824d[_0x793e('0x51')]);if(_[_0x793e('0x2a')](this[_0x793e('0x12')][_0x5c824d[_0x793e('0x32')]])){this[_0x793e('0x12')][_0x5c824d[_0x793e('0x32')]]=new Channel();this['channels'][_0x5c824d['uniqueid']][_0x793e('0x45')]=_0x5c824d[_0x793e('0x53')]?moment()[_0x793e('0x54')](moment[_0x793e('0x53')](_0x5c824d['duration'])[_0x793e('0x55')](),_0x793e('0x55'))[_0x793e('0x3c')](_0x793e('0x46')):moment()[_0x793e('0x3c')](_0x793e('0x46'));this[_0x793e('0x12')][_0x5c824d[_0x793e('0x32')]][_0x793e('0x56')]=_0x793e('0xc');}_['merge'](this[_0x793e('0x12')][_0x5c824d['uniqueid']],_['pick'](_0x5c824d,_[_0x793e('0x4a')](this[_0x793e('0x12')][_0x5c824d['uniqueid']])));if(_[_0x793e('0x57')](applications,_0x5c824d['application'])){this[_0x793e('0x12')][_0x5c824d['uniqueid']][_0x793e('0x58')]=_0x5c824d[_0x793e('0x4f')];this[_0x793e('0x12')][_0x5c824d['uniqueid']]['lastdata']=_0x5c824d['applicationdata'];if(_0x5c824d[_0x793e('0x4f')]==='set'&&_[_0x793e('0x59')](_0x5c824d[_0x793e('0x51')]['toLowerCase'](),'cdr(')){var _0x46ff04=_0x5c824d[_0x793e('0x51')][_0x793e('0x39')]('=');var _0x21f118=_0x46ff04[0x0][_0x793e('0x50')]()['match'](/cdr\((.*)\)/);if(_0x21f118){if(_0x21f118[0x1]===_0x793e('0x5a')&&!_[_0x793e('0x5b')](this[_0x793e('0x12')][_0x5c824d['uniqueid']][_0x21f118[0x1]]))return;this[_0x793e('0x12')][_0x5c824d['uniqueid']][_0x21f118[0x1]]=_0x46ff04[0x1];}}else if(_0x5c824d[_0x793e('0x4f')]===_0x793e('0x8')){this[_0x793e('0x12')][_0x5c824d['uniqueid']][_0x793e('0x8')]=_0x5c824d[_0x793e('0x51')]['split'](',')[0x0];}}}}}catch(_0xcab721){logger[_0x793e('0x27')](_0x793e('0x5c'),_0x5c824d['uniqueid'],util[_0x793e('0x33')](_0xcab721,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x793e('0x28')][_0x793e('0x1b')]=function(_0x264610){try{if(this[_0x793e('0x29')](_0x264610)){logger[_0x793e('0x26')](_0x793e('0x5d'),_0x264610[_0x793e('0x32')],_0x264610['linkedid'],_0x264610['calleridname'],_0x264610[_0x793e('0x2f')]);logger[_0x793e('0x30')](_0x793e('0x5e'),_0x264610[_0x793e('0x32')],util['inspect'](_0x264610,{'showHidden':![],'depth':null}));if(_0x264610[_0x793e('0x48')]!=='6')return;var _0x3dff61=this[_0x793e('0x13')][_0x264610[_0x793e('0x38')][_0x793e('0x39')]('-')[0x0]];if(_0x264610[_0x793e('0x32')]!==_0x264610['linkedid']){var _0x40306d=moment();if(this[_0x793e('0x12')][_0x264610[_0x793e('0x34')]]){if(!this['channels'][_0x264610[_0x793e('0x34')]][_0x793e('0x5f')]){this['channels'][_0x264610[_0x793e('0x34')]][_0x793e('0x5f')]=!![];this[_0x793e('0x12')][_0x264610[_0x793e('0x34')]][_0x793e('0x60')]=_0x40306d[_0x793e('0x3c')](_0x793e('0x46'));if(this[_0x793e('0x12')][_0x264610[_0x793e('0x34')]][_0x793e('0x45')]){this[_0x793e('0x12')][_0x264610[_0x793e('0x34')]][_0x793e('0x61')]=_0x40306d[_0x793e('0x62')](this[_0x793e('0x12')][_0x264610[_0x793e('0x34')]][_0x793e('0x45')],_0x793e('0x55'));}}this[_0x793e('0x12')][_0x264610[_0x793e('0x34')]][_0x793e('0x34')]=_0x264610['uniqueid'];if(_0x264610[_0x793e('0x2f')]!==_0x793e('0x63')){this[_0x793e('0x12')][_0x264610[_0x793e('0x34')]][_0x793e('0x3b')]=_0x264610[_0x793e('0x2f')];}this[_0x793e('0x12')][_0x264610['linkedid']][_0x793e('0x64')]=_0x264610[_0x793e('0x2e')];this[_0x793e('0x12')][_0x264610[_0x793e('0x34')]][_0x793e('0x65')]=_0x264610[_0x793e('0x38')];this['channels'][_0x264610['linkedid']][_0x793e('0x56')]=dispositions[_[_0x793e('0x47')](_0x264610[_0x793e('0x48')])];if(_0x3dff61){this[_0x793e('0x12')][_0x264610[_0x793e('0x34')]]['UserId']=_0x3dff61['id'];this[_0x793e('0x12')][_0x264610[_0x793e('0x34')]][_0x793e('0x66')]=_0x3dff61[_0x793e('0x3e')];}}if(this[_0x793e('0x12')][_0x264610[_0x793e('0x32')]]){if(!this[_0x793e('0x12')][_0x264610[_0x793e('0x32')]][_0x793e('0x5f')]){this[_0x793e('0x12')][_0x264610[_0x793e('0x32')]][_0x793e('0x5f')]=!![];this[_0x793e('0x12')][_0x264610[_0x793e('0x32')]][_0x793e('0x60')]=_0x40306d[_0x793e('0x3c')]('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x264610[_0x793e('0x32')]]['starttime']){this[_0x793e('0x12')][_0x264610[_0x793e('0x32')]][_0x793e('0x61')]=_0x40306d[_0x793e('0x62')](this['channels'][_0x264610[_0x793e('0x32')]][_0x793e('0x45')],_0x793e('0x55'));}}if(_0x264610['calleridnum']!==_0x793e('0x63')){this[_0x793e('0x12')][_0x264610[_0x793e('0x32')]][_0x793e('0x3b')]=_0x264610[_0x793e('0x2f')];}this[_0x793e('0x12')][_0x264610['uniqueid']][_0x793e('0x64')]=_0x264610['calleridname'];this[_0x793e('0x12')][_0x264610['uniqueid']][_0x793e('0x65')]=_0x264610[_0x793e('0x38')];this[_0x793e('0x12')][_0x264610[_0x793e('0x32')]][_0x793e('0x56')]=dispositions[_[_0x793e('0x47')](_0x264610[_0x793e('0x48')])];}}else{if(this[_0x793e('0x12')][_0x264610[_0x793e('0x32')]]){if(_0x3dff61){this['channels'][_0x264610[_0x793e('0x32')]][_0x793e('0x67')]=_0x3dff61['id'];this[_0x793e('0x12')][_0x264610[_0x793e('0x32')]]['membername']=_0x3dff61['name'];}}}if(_0x264610[_0x793e('0x36')]===_0x793e('0x37')){if(_0x3dff61){_0x3dff61['destconnectedlinenum']=_0x264610[_0x793e('0x44')];var _0x2680d4;if(this[_0x793e('0x12')][_0x264610['uniqueid']]){_0x2680d4=this[_0x793e('0x12')][_0x264610[_0x793e('0x32')]]['queue'];}else if(this[_0x793e('0x12')][_0x264610[_0x793e('0x34')]]){_0x2680d4=this[_0x793e('0x12')][_0x264610['linkedid']][_0x793e('0x8')];}_0x3dff61[_0x793e('0x8')]=_0x2680d4;var _0x24db0b={'id':_0x3dff61['id'],'name':_0x3dff61['name'],'agentconnected':!![],'destaccountcode':_0x3dff61[_0x793e('0x4c')],'destconnectedlinenum':_0x264610['exten'],'queue':_0x2680d4||undefined,'uniqueid':_0x264610[_0x793e('0x34')]};logger['debug']('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x264610[_0x793e('0x32')],util['inspect'](_0x24db0b,{'showHidden':![],'depth':null}));this[_0x793e('0x2b')](util[_0x793e('0x3c')](_0x793e('0x3d'),_0x3dff61[_0x793e('0x3e')]),_0x793e('0x3f'),_0x24db0b);}}}}catch(_0x43e1fd){logger[_0x793e('0x27')]('[%s][voiceCallReport][newstate]',_0x264610[_0x793e('0x32')],util[_0x793e('0x33')](_0x43e1fd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x793e('0x28')]['syncMixMonitorFilename']=function(_0x367a9c,_0x17eaeb){try{if(this['channels'][_0x367a9c]){logger['info'](_0x793e('0x68'),_0x367a9c,_0x17eaeb);this['channels'][_0x367a9c]['monitor']=!![];if(_[_0x793e('0x69')](_0x17eaeb,_0x793e('0x6a'))){_0x17eaeb=_0x17eaeb['replace'](_0x793e('0x6a'),'.WAV');}this['channels'][_0x367a9c][_0x793e('0x6b')]=_0x17eaeb;var _0x4bce8b=_[_0x793e('0x6c')](this[_0x793e('0x12')][_0x367a9c][_0x793e('0x6d')],{'filename':_0x17eaeb});if(_['isNil'](_0x4bce8b)){this['channels'][_0x367a9c][_0x793e('0x6d')]['push']({'filename':_0x17eaeb,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':'rec'});}}}catch(_0x21adc2){logger[_0x793e('0x27')](_0x793e('0x6e'),_0x367a9c,util[_0x793e('0x33')](_0x21adc2,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x793e('0x1c')]=function(_0x267b68){try{if(this[_0x793e('0x29')](_0x267b68)){logger['debug'](_0x793e('0x6f'),_0x267b68['uniqueid'],util['inspect'](_0x267b68,{'showHidden':![],'depth':null}));if(this[_0x793e('0x12')][_0x267b68[_0x793e('0x32')]]&&_0x267b68[_0x793e('0x38')]!=_0x793e('0x42')){if(this[_0x793e('0x29')](_0x267b68[_0x793e('0x70')])){if(this[_0x793e('0x29')](_0x267b68[_0x793e('0x70')][_0x793e('0x71')])){logger['info'](_0x793e('0x72'),_0x267b68[_0x793e('0x32')],_0x267b68[_0x793e('0x73')]);this['syncMixMonitorFilename'](_0x267b68[_0x793e('0x32')],_0x267b68[_0x793e('0x73')]);}else if(this[_0x793e('0x29')](_0x267b68[_0x793e('0x70')][_0x793e('0x74')])){logger[_0x793e('0x26')](_0x793e('0x75'),_0x267b68['uniqueid'],_0x267b68[_0x793e('0x73')]);this[_0x793e('0x12')][_0x267b68[_0x793e('0x32')]][_0x793e('0x2f')]=_0x267b68[_0x793e('0x73')];}else if(this[_0x793e('0x29')](_0x267b68[_0x793e('0x70')][_0x793e('0x76')])){logger[_0x793e('0x26')](_0x793e('0x77'),_0x267b68[_0x793e('0x32')],_0x267b68[_0x793e('0x73')]);this['channels'][_0x267b68[_0x793e('0x32')]]['callerid']=_0x267b68[_0x793e('0x73')];}else if(this[_0x793e('0x29')](_0x267b68[_0x793e('0x70')]['xmd-cdrtype'])){logger[_0x793e('0x26')](_0x793e('0x78'),_0x267b68[_0x793e('0x32')],_0x267b68[_0x793e('0x73')]);this[_0x793e('0x12')][_0x267b68['uniqueid']][_0x793e('0x5a')]=_0x267b68[_0x793e('0x73')];}else if(this['isNotNull'](_0x267b68[_0x793e('0x70')][_0x793e('0x79')])){logger[_0x793e('0x26')](_0x793e('0x7a'),_0x267b68['uniqueid'],_0x267b68[_0x793e('0x73')][_0x793e('0x39')](',')[0x0]);this[_0x793e('0x12')][_0x267b68[_0x793e('0x32')]][_0x793e('0x8')]=_0x267b68[_0x793e('0x73')][_0x793e('0x39')](',')[0x0];}else if(this[_0x793e('0x29')](_0x267b68[_0x793e('0x70')][_0x793e('0x7b')])){logger[_0x793e('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x267b68[_0x793e('0x32')],_0x267b68[_0x793e('0x73')]);this[_0x793e('0x12')][_0x267b68[_0x793e('0x32')]]['originatecalleridnum']=_0x267b68[_0x793e('0x73')];}else if(this[_0x793e('0x29')](_0x267b68[_0x793e('0x70')][_0x793e('0x7c')])){logger['info'](_0x793e('0x7d'),_0x267b68[_0x793e('0x32')],_0x267b68['value']);this[_0x793e('0x12')][_0x267b68[_0x793e('0x32')]][_0x793e('0x7e')]=_0x267b68[_0x793e('0x73')];}else if(this[_0x793e('0x29')](_0x267b68[_0x793e('0x70')][_0x793e('0x7f')])){logger[_0x793e('0x26')](_0x793e('0x80'),_0x267b68[_0x793e('0x32')],_0x267b68[_0x793e('0x73')]);this[_0x793e('0x12')][_0x267b68[_0x793e('0x32')]][_0x793e('0x81')]=_0x267b68[_0x793e('0x73')];}else if(this[_0x793e('0x29')](_0x267b68['variable']['xmcs-queue'])){logger[_0x793e('0x26')](_0x793e('0x82'),_0x267b68[_0x793e('0x32')],_0x267b68[_0x793e('0x73')]);this['channels'][_0x267b68[_0x793e('0x32')]][_0x793e('0x8')]=_0x267b68[_0x793e('0x73')];}else if(this[_0x793e('0x29')](_0x267b68[_0x793e('0x70')][_0x793e('0x83')])){logger[_0x793e('0x26')](_0x793e('0x84'),_0x267b68[_0x793e('0x32')],_0x267b68['value']);this[_0x793e('0x12')][_0x267b68[_0x793e('0x32')]][_0x793e('0x85')]=_0x267b68['value'];}}}else if(this[_0x793e('0x29')](_0x267b68[_0x793e('0x70')]['mixmonitor_filename'])){if(_0x267b68['value']){var _0x351722=path[_0x793e('0x86')](_0x267b68['value'])['name'];logger[_0x793e('0x26')](_0x793e('0x72'),_0x351722,_0x267b68[_0x793e('0x73')]);this[_0x793e('0x87')](_0x351722,_0x267b68['value']);}}else if(this['channels'][_0x267b68[_0x793e('0x34')]]){if(this['isNotNull'](_0x267b68[_0x793e('0x70')])){if(this[_0x793e('0x29')](_0x267b68[_0x793e('0x70')][_0x793e('0x83')])){logger[_0x793e('0x26')](_0x793e('0x84'),_0x267b68[_0x793e('0x34')],_0x267b68[_0x793e('0x73')]);this['channels'][_0x267b68[_0x793e('0x34')]][_0x793e('0x88')]=_0x267b68[_0x793e('0x73')];}}}}}catch(_0x462372){logger[_0x793e('0x27')](_0x793e('0x89'),_0x267b68[_0x793e('0x32')],util[_0x793e('0x33')](_0x462372,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x793e('0x28')]['syncHangup']=function(_0x24d883){try{if(this[_0x793e('0x29')](_0x24d883)){logger['debug'](_0x793e('0x8a'),_0x24d883[_0x793e('0x32')],util[_0x793e('0x33')](_0x24d883,{'showHidden':![],'depth':null}));if(this[_0x793e('0x43')][_0x24d883[_0x793e('0x34')]]){if(this['channels'][this[_0x793e('0x43')][_0x24d883[_0x793e('0x34')]]['linkedid']]){this['channels'][this[_0x793e('0x43')][_0x24d883[_0x793e('0x34')]]['linkedid']][_0x793e('0x32')]=_0x24d883[_0x793e('0x32')];this[_0x793e('0x12')][this[_0x793e('0x43')][_0x24d883[_0x793e('0x34')]][_0x793e('0x34')]]['answered']=this[_0x793e('0x12')][_0x24d883[_0x793e('0x32')]]['answered'];this[_0x793e('0x12')][this[_0x793e('0x43')][_0x24d883[_0x793e('0x34')]][_0x793e('0x34')]][_0x793e('0x60')]=this[_0x793e('0x12')][_0x24d883['uniqueid']]['answertime'];this['channels'][this[_0x793e('0x43')][_0x24d883[_0x793e('0x34')]][_0x793e('0x34')]][_0x793e('0x65')]=this[_0x793e('0x12')][this['blindTransfers'][_0x24d883[_0x793e('0x34')]][_0x793e('0x34')]][_0x793e('0x38')];this['channels'][this['blindTransfers'][_0x24d883[_0x793e('0x34')]][_0x793e('0x34')]][_0x793e('0x56')]=this[_0x793e('0x12')][_0x24d883[_0x793e('0x32')]][_0x793e('0x56')];this['channels'][_0x24d883[_0x793e('0x32')]]=this[_0x793e('0x12')][this[_0x793e('0x43')][_0x24d883[_0x793e('0x34')]][_0x793e('0x34')]];this[_0x793e('0x8b')](this[_0x793e('0x43')][_0x24d883[_0x793e('0x34')]]['linkedid']);}else if(this[_0x793e('0x12')][this[_0x793e('0x43')][_0x24d883[_0x793e('0x34')]][_0x793e('0x32')]]){this['channels'][this['blindTransfers'][_0x24d883[_0x793e('0x34')]][_0x793e('0x32')]]['uniqueid']=[this['channels'][this[_0x793e('0x43')][_0x24d883[_0x793e('0x34')]]['uniqueid']]['linkedid'],this[_0x793e('0x12')][this[_0x793e('0x43')][_0x24d883[_0x793e('0x34')]][_0x793e('0x32')]]['linkedid']=this[_0x793e('0x12')][this['blindTransfers'][_0x24d883[_0x793e('0x34')]]['uniqueid']][_0x793e('0x32')]][0x0];this[_0x793e('0x12')][this[_0x793e('0x43')][_0x24d883[_0x793e('0x34')]][_0x793e('0x32')]]['answered']=this['channels'][_0x24d883[_0x793e('0x32')]]['answered'];this[_0x793e('0x12')][this[_0x793e('0x43')][_0x24d883[_0x793e('0x34')]]['uniqueid']]['answertime']=this['channels'][_0x24d883[_0x793e('0x32')]][_0x793e('0x60')];this['channels'][this['blindTransfers'][_0x24d883[_0x793e('0x34')]][_0x793e('0x32')]][_0x793e('0x65')]=this[_0x793e('0x12')][this[_0x793e('0x43')][_0x24d883['linkedid']][_0x793e('0x32')]][_0x793e('0x38')];this[_0x793e('0x12')][this[_0x793e('0x43')][_0x24d883[_0x793e('0x34')]][_0x793e('0x32')]][_0x793e('0x56')]=this['channels'][_0x24d883[_0x793e('0x32')]][_0x793e('0x56')];this[_0x793e('0x12')][_0x24d883[_0x793e('0x32')]]=this[_0x793e('0x12')][this[_0x793e('0x43')][_0x24d883[_0x793e('0x34')]][_0x793e('0x32')]];this[_0x793e('0x8b')](this['blindTransfers'][_0x24d883['linkedid']][_0x793e('0x32')]);}}if(this[_0x793e('0x12')][_0x24d883[_0x793e('0x32')]]){logger[_0x793e('0x26')](_0x793e('0x8c'),_0x24d883[_0x793e('0x32')],_0x24d883[_0x793e('0x8d')]);var _0x1de0aa=moment();this[_0x793e('0x12')][_0x24d883[_0x793e('0x32')]][_0x793e('0x8e')]=_0x1de0aa[_0x793e('0x3c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x793e('0x12')][_0x24d883[_0x793e('0x32')]][_0x793e('0x53')]=_0x1de0aa[_0x793e('0x62')](this[_0x793e('0x12')][_0x24d883[_0x793e('0x32')]][_0x793e('0x45')],'seconds');if(this[_0x793e('0x12')][_0x24d883[_0x793e('0x32')]][_0x793e('0x5f')]){this[_0x793e('0x12')][_0x24d883[_0x793e('0x32')]][_0x793e('0x8f')]=_0x1de0aa['diff'](this['channels'][_0x24d883[_0x793e('0x32')]][_0x793e('0x60')],_0x793e('0x55'));this[_0x793e('0x12')][_0x24d883['uniqueid']][_0x793e('0x61')]=this['channels'][_0x24d883[_0x793e('0x32')]][_0x793e('0x53')]-this['channels'][_0x24d883['uniqueid']][_0x793e('0x8f')];}if(_0x24d883[_0x793e('0x36')]===_0x793e('0x37')){if(this[_0x793e('0x13')][_0x24d883[_0x793e('0x38')][_0x793e('0x39')]('-')[0x0]]){this[_0x793e('0x13')][_0x24d883[_0x793e('0x38')][_0x793e('0x39')]('-')[0x0]]=_['omit'](this['agents'][_0x24d883['channel']['split']('-')[0x0]],[_0x793e('0x3a')]);logger['debug'](_0x793e('0x90'),_0x24d883[_0x793e('0x32')],util[_0x793e('0x33')]({'id':this[_0x793e('0x13')][_0x24d883[_0x793e('0x38')]['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x24d883[_0x793e('0x38')][_0x793e('0x39')]('-')[0x0]][_0x793e('0x4c')]},{'showHidden':![],'depth':null}));this[_0x793e('0x2b')](util[_0x793e('0x3c')](_0x793e('0x3d'),this[_0x793e('0x13')][_0x24d883[_0x793e('0x38')][_0x793e('0x39')]('-')[0x0]]['name']),_0x793e('0x91'),{'id':this[_0x793e('0x13')][_0x24d883['channel'][_0x793e('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0x793e('0x13')][_0x24d883['channel']['split']('-')[0x0]][_0x793e('0x4c')]});for(var _0x5ece91=0x0;_0x5ece91{delete this['channels'][_0x346941];},_0x4b211d);}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0x2ede=['endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','transferType','resolve','then','transferToInternal','isEmpty','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','extension','BLIND','transfererchannel','transfereruniqueid','syncMusicOnHoldStart','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','../../../config/environment','../../../config/logger','ami','../model/channel','../rpc/setting','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','defaults','localhost','socket.io-emitter','redis','channels','agents','blindTransfers','coreshowchannel','syncNewExten','newexten','newchannel','syncNewChannel','bind','newstate','syncNewState','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','uniqueid','calleridname','calleridnum','debug','merge','pick','keys','context','from-sip','channel','split','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','linkedid','info','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','undefined','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','error','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','duration','seconds','includes','lastdata','set','startsWith','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinename','destinationchannel','toNumber','UserId','membername','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','monitorFilename','find','monitors','push','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:xmd-phone\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','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','cause-txt'];(function(_0x25948f,_0x4ac7e4){var _0x2b1976=function(_0x1ee63a){while(--_0x1ee63a){_0x25948f['push'](_0x25948f['shift']());}};_0x2b1976(++_0x4ac7e4);}(_0x2ede,0xf9));var _0xe2ed=function(_0x4dcd67,_0x298c23){_0x4dcd67=_0x4dcd67-0x0;var _0x1e9e77=_0x2ede[_0x4dcd67];return _0x1e9e77;};'use strict';var _=require(_0xe2ed('0x0'));var moment=require(_0xe2ed('0x1'));var util=require(_0xe2ed('0x2'));var path=require(_0xe2ed('0x3'));var Redis=require('ioredis');var config=require(_0xe2ed('0x4'));var logger=require(_0xe2ed('0x5'))(_0xe2ed('0x6'));var ami=require('../ami');var Channel=require(_0xe2ed('0x7'));var RpcSetting=require(_0xe2ed('0x8'));var applications=['set',_0xe2ed('0x9'),_0xe2ed('0xa'),_0xe2ed('0xb'),_0xe2ed('0xc'),_0xe2ed('0xd')];var dispositions=[_0xe2ed('0xe'),_0xe2ed('0xf'),'FAILED',_0xe2ed('0xe'),_0xe2ed('0xe'),_0xe2ed('0xe'),'ANSWERED',_0xe2ed('0x10'),_0xe2ed('0xf'),_0xe2ed('0xf'),_0xe2ed('0xf')];config['redis']=_[_0xe2ed('0x11')](config['redis'],{'host':_0xe2ed('0x12'),'port':0x18eb});var io=require(_0xe2ed('0x13'))(new Redis(config[_0xe2ed('0x14')]));function VoiceCallReport(_0x841bf9){this[_0xe2ed('0x15')]=_0x841bf9[_0xe2ed('0x15')];this['agents']=_0x841bf9[_0xe2ed('0x16')];this[_0xe2ed('0x17')]={};ami['on'](_0xe2ed('0x18'),this[_0xe2ed('0x19')]['bind'](this));ami['on'](_0xe2ed('0x1a'),this[_0xe2ed('0x19')]['bind'](this));ami['on'](_0xe2ed('0x1b'),this[_0xe2ed('0x1c')][_0xe2ed('0x1d')](this));ami['on'](_0xe2ed('0x1e'),this[_0xe2ed('0x1f')]['bind'](this));ami['on'](_0xe2ed('0x20'),this[_0xe2ed('0x21')][_0xe2ed('0x1d')](this));ami['on']('hangup',this[_0xe2ed('0x22')]['bind'](this));ami['on'](_0xe2ed('0x23'),this[_0xe2ed('0x24')][_0xe2ed('0x1d')](this));ami['on'](_0xe2ed('0x25'),this[_0xe2ed('0x26')]['bind'](this));ami['on'](_0xe2ed('0x27'),this[_0xe2ed('0x28')][_0xe2ed('0x1d')](this));ami['on'](_0xe2ed('0x29'),this['syncMusicOnHoldStart'][_0xe2ed('0x1d')](this));ami['on'](_0xe2ed('0x2a'),this[_0xe2ed('0x2b')][_0xe2ed('0x1d')](this));try{logger['info'](_0xe2ed('0x2c'));ami[_0xe2ed('0x2d')]();}catch(_0x509a2a){logger['error'](_0xe2ed('0x2e'),util[_0xe2ed('0x2f')](_0x509a2a,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xe2ed('0x30')][_0xe2ed('0x31')]=function(_0x4c0ada){return _0x4c0ada!==null&&!_[_0xe2ed('0x32')](_0x4c0ada);};VoiceCallReport['prototype'][_0xe2ed('0x33')]=function(_0x3dbb50,_0x5bab8f,_0x49fef6){io['to'](_0x3dbb50)[_0xe2ed('0x33')](_0x5bab8f,_0x49fef6);};VoiceCallReport[_0xe2ed('0x30')][_0xe2ed('0x24')]=function(_0x18f9bd){try{if(this['isNotNull'](_0x18f9bd)){logger['info']('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x18f9bd[_0xe2ed('0x34')],_0x18f9bd[_0xe2ed('0x35')],_0x18f9bd[_0xe2ed('0x36')]);logger[_0xe2ed('0x37')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x18f9bd['uniqueid'],util[_0xe2ed('0x2f')](_0x18f9bd,{'showHidden':![],'depth':null}));if(_0x18f9bd[_0xe2ed('0x34')]===_0x18f9bd['linkedid']){if(!_[_0xe2ed('0x32')](this[_0xe2ed('0x15')][_0x18f9bd[_0xe2ed('0x34')]])){_[_0xe2ed('0x38')](this[_0xe2ed('0x15')][_0x18f9bd[_0xe2ed('0x34')]],_[_0xe2ed('0x39')](_0x18f9bd,_[_0xe2ed('0x3a')](this[_0xe2ed('0x15')][_0x18f9bd[_0xe2ed('0x34')]])));}}if(_0x18f9bd[_0xe2ed('0x3b')]===_0xe2ed('0x3c')){var _0x1127c5=this[_0xe2ed('0x16')][_0x18f9bd[_0xe2ed('0x3d')][_0xe2ed('0x3e')]('-')[0x0]];if(_0x1127c5){if(_0x18f9bd['exten']=='xcally-motion-preview'){_0x1127c5[_0xe2ed('0x3f')]=_0x18f9bd[_0xe2ed('0x40')];this[_0xe2ed('0x33')](util[_0xe2ed('0x41')](_0xe2ed('0x42'),_0x1127c5[_0xe2ed('0x43')]),_0xe2ed('0x44'),{'id':_0x1127c5['id'],'destaccountcode':_0x1127c5[_0xe2ed('0x45')],'destconnectedlinenum':_0x18f9bd[_0xe2ed('0x40')]});}}}}}catch(_0x5dfe2f){logger['error'](_0xe2ed('0x46'),_0x18f9bd[_0xe2ed('0x34')],util['inspect'](_0x5dfe2f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xe2ed('0x1c')]=function(_0x5115d2){try{if(this[_0xe2ed('0x31')](_0x5115d2)){logger[_0xe2ed('0x37')](_0xe2ed('0x47'),_0x5115d2[_0xe2ed('0x34')],util[_0xe2ed('0x2f')](_0x5115d2,{'showHidden':![],'depth':null}));if(this[_0xe2ed('0x15')][_0x5115d2[_0xe2ed('0x34')]]){return;}if(_0x5115d2[_0xe2ed('0x3d')]===_0xe2ed('0x48')){return;}if(_0x5115d2[_0xe2ed('0x34')]!==_0x5115d2[_0xe2ed('0x49')]&&!this[_0xe2ed('0x17')][_0x5115d2[_0xe2ed('0x49')]]){return;}logger[_0xe2ed('0x4a')](_0xe2ed('0x4b'),_0x5115d2[_0xe2ed('0x34')],_0x5115d2[_0xe2ed('0x3b')],_0x5115d2['exten']);this[_0xe2ed('0x15')][_0x5115d2[_0xe2ed('0x34')]]=new Channel();this['channels'][_0x5115d2['uniqueid']][_0xe2ed('0x4c')]=moment()[_0xe2ed('0x41')](_0xe2ed('0x4d'));this[_0xe2ed('0x15')][_0x5115d2[_0xe2ed('0x34')]][_0xe2ed('0x4e')]=dispositions[_['toNumber'](_0x5115d2[_0xe2ed('0x4f')])];_[_0xe2ed('0x38')](this[_0xe2ed('0x15')][_0x5115d2[_0xe2ed('0x34')]],_[_0xe2ed('0x39')](_0x5115d2,_[_0xe2ed('0x3a')](this[_0xe2ed('0x15')][_0x5115d2['uniqueid']])));if(_0x5115d2[_0xe2ed('0x3b')]===_0xe2ed('0x3c')){var _0x59e701=this['agents'][_0x5115d2['channel'][_0xe2ed('0x3e')]('-')[0x0]];if(_0x59e701&&typeof _0x59e701[_0xe2ed('0x3f')]===_0xe2ed('0x50')){_0x59e701[_0xe2ed('0x3f')]=_0x5115d2[_0xe2ed('0x51')];logger[_0xe2ed('0x37')](_0xe2ed('0x52'),_0x5115d2[_0xe2ed('0x34')],util['inspect']({'id':_0x59e701['id'],'destaccountcode':_0x59e701[_0xe2ed('0x45')],'destconnectedlinenum':_0x5115d2[_0xe2ed('0x51')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xe2ed('0x41')]('user:%s',_0x59e701['name']),_0xe2ed('0x44'),{'id':_0x59e701['id'],'destaccountcode':_0x59e701[_0xe2ed('0x45')],'destconnectedlinenum':_0x5115d2[_0xe2ed('0x51')]});}}}}catch(_0x2b5987){logger[_0xe2ed('0x53')](_0xe2ed('0x54'),_0x5115d2[_0xe2ed('0x34')],util[_0xe2ed('0x2f')](_0x2b5987,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe2ed('0x30')]['syncNewExten']=function(_0x381c28){try{if(this[_0xe2ed('0x31')](_0x381c28)){logger[_0xe2ed('0x37')](_0xe2ed('0x55'),_0x381c28[_0xe2ed('0x34')],util['inspect'](_0x381c28,{'showHidden':![],'depth':null}));if(_0x381c28[_0xe2ed('0x3d')]===_0xe2ed('0x48')||_0x381c28[_0xe2ed('0x51')]==='h')return;if(_0x381c28['uniqueid']===_0x381c28[_0xe2ed('0x49')]||this['blindTransfers'][_0x381c28[_0xe2ed('0x49')]]){_0x381c28[_0xe2ed('0x56')]=_0x381c28[_0xe2ed('0x56')]?_0x381c28['application'][_0xe2ed('0x57')]():undefined;_0x381c28[_0xe2ed('0x58')]=_0x381c28[_0xe2ed('0x59')]||_0x381c28['applicationdata'];if(_0x381c28['appdata']&&_0x381c28[_0xe2ed('0x56')]!==_0xe2ed('0x9')){_0x381c28[_0xe2ed('0x58')]=_0x381c28['applicationdata']['toLowerCase']();}logger[_0xe2ed('0x4a')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x381c28['uniqueid'],_0x381c28[_0xe2ed('0x56')],_0x381c28['applicationdata']);if(_['isUndefined'](this['channels'][_0x381c28[_0xe2ed('0x34')]])){this[_0xe2ed('0x15')][_0x381c28[_0xe2ed('0x34')]]=new Channel();this[_0xe2ed('0x15')][_0x381c28[_0xe2ed('0x34')]]['starttime']=_0x381c28[_0xe2ed('0x5a')]?moment()['subtract'](moment[_0xe2ed('0x5a')](_0x381c28[_0xe2ed('0x5a')])[_0xe2ed('0x5b')](),_0xe2ed('0x5b'))[_0xe2ed('0x41')](_0xe2ed('0x4d')):moment()[_0xe2ed('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe2ed('0x15')][_0x381c28[_0xe2ed('0x34')]]['disposition']='NO\x20ANSWER';}_[_0xe2ed('0x38')](this['channels'][_0x381c28[_0xe2ed('0x34')]],_[_0xe2ed('0x39')](_0x381c28,_[_0xe2ed('0x3a')](this['channels'][_0x381c28[_0xe2ed('0x34')]])));if(_[_0xe2ed('0x5c')](applications,_0x381c28[_0xe2ed('0x56')])){this[_0xe2ed('0x15')][_0x381c28[_0xe2ed('0x34')]]['lastapplication']=_0x381c28[_0xe2ed('0x56')];this[_0xe2ed('0x15')][_0x381c28['uniqueid']][_0xe2ed('0x5d')]=_0x381c28[_0xe2ed('0x58')];if(_0x381c28[_0xe2ed('0x56')]===_0xe2ed('0x5e')&&_[_0xe2ed('0x5f')](_0x381c28[_0xe2ed('0x58')]['toLowerCase'](),'cdr(')){var _0x333f65=_0x381c28['applicationdata']['split']('=');var _0x1551ac=_0x333f65[0x0][_0xe2ed('0x57')]()[_0xe2ed('0x60')](/cdr\((.*)\)/);if(_0x1551ac){if(_0x1551ac[0x1]===_0xe2ed('0x61')&&!_[_0xe2ed('0x62')](this[_0xe2ed('0x15')][_0x381c28['uniqueid']][_0x1551ac[0x1]]))return;this[_0xe2ed('0x15')][_0x381c28[_0xe2ed('0x34')]][_0x1551ac[0x1]]=_0x333f65[0x1];}}else if(_0x381c28[_0xe2ed('0x56')]===_0xe2ed('0x9')){this['channels'][_0x381c28['uniqueid']][_0xe2ed('0x9')]=_0x381c28[_0xe2ed('0x58')][_0xe2ed('0x3e')](',')[0x0];}}}}}catch(_0x3e5515){logger['error'](_0xe2ed('0x63'),_0x381c28[_0xe2ed('0x34')],util[_0xe2ed('0x2f')](_0x3e5515,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xe2ed('0x1f')]=function(_0x1d9ce8){try{if(this[_0xe2ed('0x31')](_0x1d9ce8)){logger['info']('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x1d9ce8[_0xe2ed('0x34')],_0x1d9ce8[_0xe2ed('0x49')],_0x1d9ce8[_0xe2ed('0x35')],_0x1d9ce8[_0xe2ed('0x36')]);logger[_0xe2ed('0x37')](_0xe2ed('0x64'),_0x1d9ce8[_0xe2ed('0x34')],util['inspect'](_0x1d9ce8,{'showHidden':![],'depth':null}));if(_0x1d9ce8[_0xe2ed('0x4f')]!=='6')return;var _0x565811=this[_0xe2ed('0x16')][_0x1d9ce8[_0xe2ed('0x3d')][_0xe2ed('0x3e')]('-')[0x0]];if(_0x1d9ce8[_0xe2ed('0x34')]!==_0x1d9ce8[_0xe2ed('0x49')]){var _0x116220=moment();if(this[_0xe2ed('0x15')][_0x1d9ce8['linkedid']]){if(!this[_0xe2ed('0x15')][_0x1d9ce8['linkedid']][_0xe2ed('0x65')]){this[_0xe2ed('0x15')][_0x1d9ce8[_0xe2ed('0x49')]][_0xe2ed('0x65')]=!![];this['channels'][_0x1d9ce8[_0xe2ed('0x49')]][_0xe2ed('0x66')]=_0x116220['format'](_0xe2ed('0x4d'));if(this[_0xe2ed('0x15')][_0x1d9ce8[_0xe2ed('0x49')]][_0xe2ed('0x4c')]){this[_0xe2ed('0x15')][_0x1d9ce8['linkedid']][_0xe2ed('0x67')]=_0x116220[_0xe2ed('0x68')](this[_0xe2ed('0x15')][_0x1d9ce8[_0xe2ed('0x49')]]['starttime'],_0xe2ed('0x5b'));}}this['channels'][_0x1d9ce8[_0xe2ed('0x49')]][_0xe2ed('0x49')]=_0x1d9ce8[_0xe2ed('0x34')];if(_0x1d9ce8['calleridnum']!==_0xe2ed('0x69')){this[_0xe2ed('0x15')][_0x1d9ce8[_0xe2ed('0x49')]][_0xe2ed('0x40')]=_0x1d9ce8[_0xe2ed('0x36')];}this['channels'][_0x1d9ce8[_0xe2ed('0x49')]][_0xe2ed('0x6a')]=_0x1d9ce8[_0xe2ed('0x35')];this[_0xe2ed('0x15')][_0x1d9ce8[_0xe2ed('0x49')]][_0xe2ed('0x6b')]=_0x1d9ce8[_0xe2ed('0x3d')];this[_0xe2ed('0x15')][_0x1d9ce8[_0xe2ed('0x49')]][_0xe2ed('0x4e')]=dispositions[_[_0xe2ed('0x6c')](_0x1d9ce8[_0xe2ed('0x4f')])];if(_0x565811){this[_0xe2ed('0x15')][_0x1d9ce8['linkedid']][_0xe2ed('0x6d')]=_0x565811['id'];this[_0xe2ed('0x15')][_0x1d9ce8[_0xe2ed('0x49')]][_0xe2ed('0x6e')]=_0x565811[_0xe2ed('0x43')];}}if(this[_0xe2ed('0x15')][_0x1d9ce8[_0xe2ed('0x34')]]){if(!this[_0xe2ed('0x15')][_0x1d9ce8[_0xe2ed('0x34')]][_0xe2ed('0x65')]){this[_0xe2ed('0x15')][_0x1d9ce8[_0xe2ed('0x34')]][_0xe2ed('0x65')]=!![];this['channels'][_0x1d9ce8[_0xe2ed('0x34')]][_0xe2ed('0x66')]=_0x116220['format'](_0xe2ed('0x4d'));if(this[_0xe2ed('0x15')][_0x1d9ce8[_0xe2ed('0x34')]][_0xe2ed('0x4c')]){this[_0xe2ed('0x15')][_0x1d9ce8[_0xe2ed('0x34')]][_0xe2ed('0x67')]=_0x116220[_0xe2ed('0x68')](this['channels'][_0x1d9ce8['uniqueid']]['starttime'],'seconds');}}if(_0x1d9ce8[_0xe2ed('0x36')]!=='xcally-motion-preview'){this['channels'][_0x1d9ce8[_0xe2ed('0x34')]][_0xe2ed('0x40')]=_0x1d9ce8[_0xe2ed('0x36')];}this[_0xe2ed('0x15')][_0x1d9ce8['uniqueid']]['connectedlinename']=_0x1d9ce8['calleridname'];this[_0xe2ed('0x15')][_0x1d9ce8['uniqueid']]['destinationchannel']=_0x1d9ce8[_0xe2ed('0x3d')];this[_0xe2ed('0x15')][_0x1d9ce8['uniqueid']][_0xe2ed('0x4e')]=dispositions[_['toNumber'](_0x1d9ce8[_0xe2ed('0x4f')])];}}else{if(this[_0xe2ed('0x15')][_0x1d9ce8[_0xe2ed('0x34')]]){if(_0x565811){this['channels'][_0x1d9ce8['uniqueid']][_0xe2ed('0x6d')]=_0x565811['id'];this[_0xe2ed('0x15')][_0x1d9ce8['uniqueid']][_0xe2ed('0x6e')]=_0x565811['name'];}}}if(_0x1d9ce8[_0xe2ed('0x3b')]===_0xe2ed('0x3c')){if(_0x565811){_0x565811[_0xe2ed('0x3f')]=_0x1d9ce8['exten'];var _0x104f71;if(this[_0xe2ed('0x15')][_0x1d9ce8[_0xe2ed('0x34')]]){_0x104f71=this[_0xe2ed('0x15')][_0x1d9ce8[_0xe2ed('0x34')]][_0xe2ed('0x9')];}else if(this['channels'][_0x1d9ce8[_0xe2ed('0x49')]]){_0x104f71=this[_0xe2ed('0x15')][_0x1d9ce8[_0xe2ed('0x49')]][_0xe2ed('0x9')];}_0x565811['queue']=_0x104f71;var _0x30b023={'id':_0x565811['id'],'name':_0x565811[_0xe2ed('0x43')],'agentconnected':!![],'destaccountcode':_0x565811[_0xe2ed('0x45')],'destconnectedlinenum':_0x1d9ce8[_0xe2ed('0x51')],'queue':_0x104f71||undefined,'uniqueid':_0x1d9ce8[_0xe2ed('0x49')]};logger[_0xe2ed('0x37')](_0xe2ed('0x6f'),_0x1d9ce8[_0xe2ed('0x34')],util[_0xe2ed('0x2f')](_0x30b023,{'showHidden':![],'depth':null}));this[_0xe2ed('0x33')](util['format'](_0xe2ed('0x42'),_0x565811[_0xe2ed('0x43')]),_0xe2ed('0x44'),_0x30b023);}}}}catch(_0xf831da){logger[_0xe2ed('0x53')](_0xe2ed('0x70'),_0x1d9ce8[_0xe2ed('0x34')],util[_0xe2ed('0x2f')](_0xf831da,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe2ed('0x30')][_0xe2ed('0x71')]=function(_0x5f1694,_0x81c7d1){try{if(this[_0xe2ed('0x15')][_0x5f1694]){logger[_0xe2ed('0x4a')](_0xe2ed('0x72'),_0x5f1694,_0x81c7d1);this[_0xe2ed('0x15')][_0x5f1694][_0xe2ed('0x73')]=!![];if(_['endsWith'](_0x81c7d1,_0xe2ed('0x74'))){_0x81c7d1=_0x81c7d1[_0xe2ed('0x75')](_0xe2ed('0x74'),'.WAV');}this[_0xe2ed('0x15')][_0x5f1694][_0xe2ed('0x76')]=_0x81c7d1;var _0x36d5bb=_[_0xe2ed('0x77')](this[_0xe2ed('0x15')][_0x5f1694][_0xe2ed('0x78')],{'filename':_0x81c7d1});if(_[_0xe2ed('0x62')](_0x36d5bb)){this[_0xe2ed('0x15')][_0x5f1694][_0xe2ed('0x78')][_0xe2ed('0x79')]({'filename':_0x81c7d1,'createdAt':moment()['format'](_0xe2ed('0x4d')),'mixmonitorid':'','status':'rec'});}}}catch(_0x566a18){logger[_0xe2ed('0x53')](_0xe2ed('0x7a'),_0x5f1694,util[_0xe2ed('0x2f')](_0x566a18,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xe2ed('0x21')]=function(_0x5d82ce){try{if(this[_0xe2ed('0x31')](_0x5d82ce)){logger[_0xe2ed('0x37')](_0xe2ed('0x7b'),_0x5d82ce[_0xe2ed('0x34')],util[_0xe2ed('0x2f')](_0x5d82ce,{'showHidden':![],'depth':null}));if(this[_0xe2ed('0x15')][_0x5d82ce[_0xe2ed('0x34')]]&&_0x5d82ce[_0xe2ed('0x3d')]!=_0xe2ed('0x48')){if(this[_0xe2ed('0x31')](_0x5d82ce[_0xe2ed('0x7c')])){if(this[_0xe2ed('0x31')](_0x5d82ce[_0xe2ed('0x7c')][_0xe2ed('0x7d')])){logger[_0xe2ed('0x4a')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x5d82ce[_0xe2ed('0x34')],_0x5d82ce['value']);this['syncMixMonitorFilename'](_0x5d82ce[_0xe2ed('0x34')],_0x5d82ce['value']);}else if(this[_0xe2ed('0x31')](_0x5d82ce[_0xe2ed('0x7c')]['xmd-phone'])){logger[_0xe2ed('0x4a')](_0xe2ed('0x7e'),_0x5d82ce[_0xe2ed('0x34')],_0x5d82ce[_0xe2ed('0x7f')]);this['channels'][_0x5d82ce[_0xe2ed('0x34')]]['calleridnum']=_0x5d82ce[_0xe2ed('0x7f')];}else if(this[_0xe2ed('0x31')](_0x5d82ce[_0xe2ed('0x7c')][_0xe2ed('0x80')])){logger[_0xe2ed('0x4a')](_0xe2ed('0x81'),_0x5d82ce[_0xe2ed('0x34')],_0x5d82ce[_0xe2ed('0x7f')]);this['channels'][_0x5d82ce[_0xe2ed('0x34')]][_0xe2ed('0x82')]=_0x5d82ce[_0xe2ed('0x7f')];}else if(this['isNotNull'](_0x5d82ce[_0xe2ed('0x7c')][_0xe2ed('0x83')])){logger[_0xe2ed('0x4a')](_0xe2ed('0x84'),_0x5d82ce[_0xe2ed('0x34')],_0x5d82ce['value']);this[_0xe2ed('0x15')][_0x5d82ce[_0xe2ed('0x34')]][_0xe2ed('0x61')]=_0x5d82ce[_0xe2ed('0x7f')];}else if(this[_0xe2ed('0x31')](_0x5d82ce[_0xe2ed('0x7c')][_0xe2ed('0x85')])){logger[_0xe2ed('0x4a')](_0xe2ed('0x86'),_0x5d82ce[_0xe2ed('0x34')],_0x5d82ce[_0xe2ed('0x7f')][_0xe2ed('0x3e')](',')[0x0]);this['channels'][_0x5d82ce[_0xe2ed('0x34')]][_0xe2ed('0x9')]=_0x5d82ce[_0xe2ed('0x7f')][_0xe2ed('0x3e')](',')[0x0];}else if(this[_0xe2ed('0x31')](_0x5d82ce[_0xe2ed('0x7c')]['xmd-originatecalleridnum'])){logger['info'](_0xe2ed('0x87'),_0x5d82ce[_0xe2ed('0x34')],_0x5d82ce[_0xe2ed('0x7f')]);this[_0xe2ed('0x15')][_0x5d82ce[_0xe2ed('0x34')]]['originatecalleridnum']=_0x5d82ce[_0xe2ed('0x7f')];}else if(this['isNotNull'](_0x5d82ce['variable'][_0xe2ed('0x88')])){logger['info'](_0xe2ed('0x89'),_0x5d82ce[_0xe2ed('0x34')],_0x5d82ce[_0xe2ed('0x7f')]);this[_0xe2ed('0x15')][_0x5d82ce[_0xe2ed('0x34')]][_0xe2ed('0x8a')]=_0x5d82ce[_0xe2ed('0x7f')];}else if(this[_0xe2ed('0x31')](_0x5d82ce['variable'][_0xe2ed('0x8b')])){logger['info'](_0xe2ed('0x8c'),_0x5d82ce[_0xe2ed('0x34')],_0x5d82ce[_0xe2ed('0x7f')]);this[_0xe2ed('0x15')][_0x5d82ce['uniqueid']]['calleridpreview']=_0x5d82ce['value'];}else if(this['isNotNull'](_0x5d82ce['variable'][_0xe2ed('0x8d')])){logger['info'](_0xe2ed('0x8e'),_0x5d82ce[_0xe2ed('0x34')],_0x5d82ce[_0xe2ed('0x7f')]);this[_0xe2ed('0x15')][_0x5d82ce[_0xe2ed('0x34')]][_0xe2ed('0x9')]=_0x5d82ce['value'];}else if(this[_0xe2ed('0x31')](_0x5d82ce[_0xe2ed('0x7c')][_0xe2ed('0x8f')])){logger[_0xe2ed('0x4a')](_0xe2ed('0x90'),_0x5d82ce['uniqueid'],_0x5d82ce[_0xe2ed('0x7f')]);this[_0xe2ed('0x15')][_0x5d82ce['uniqueid']]['sipcalluniqueid']=_0x5d82ce['value'];}}}else if(this[_0xe2ed('0x31')](_0x5d82ce['variable'][_0xe2ed('0x7d')])){if(_0x5d82ce[_0xe2ed('0x7f')]){var _0x437045=path[_0xe2ed('0x91')](_0x5d82ce['value'])[_0xe2ed('0x43')];logger[_0xe2ed('0x4a')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x437045,_0x5d82ce[_0xe2ed('0x7f')]);this[_0xe2ed('0x71')](_0x437045,_0x5d82ce[_0xe2ed('0x7f')]);}}else if(this['channels'][_0x5d82ce['linkedid']]){if(this[_0xe2ed('0x31')](_0x5d82ce[_0xe2ed('0x7c')])){if(this[_0xe2ed('0x31')](_0x5d82ce[_0xe2ed('0x7c')][_0xe2ed('0x8f')])){logger[_0xe2ed('0x4a')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x5d82ce[_0xe2ed('0x49')],_0x5d82ce[_0xe2ed('0x7f')]);this[_0xe2ed('0x15')][_0x5d82ce['linkedid']][_0xe2ed('0x92')]=_0x5d82ce[_0xe2ed('0x7f')];}}}}}catch(_0x5e595f){logger[_0xe2ed('0x53')](_0xe2ed('0x93'),_0x5d82ce[_0xe2ed('0x34')],util[_0xe2ed('0x2f')](_0x5e595f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xe2ed('0x22')]=function(_0xf671c2){try{if(this[_0xe2ed('0x31')](_0xf671c2)){logger[_0xe2ed('0x37')](_0xe2ed('0x94'),_0xf671c2['uniqueid'],util['inspect'](_0xf671c2,{'showHidden':![],'depth':null}));if(this[_0xe2ed('0x17')][_0xf671c2[_0xe2ed('0x49')]]){if(this['channels'][this[_0xe2ed('0x17')][_0xf671c2['linkedid']]['linkedid']]){this['channels'][this[_0xe2ed('0x17')][_0xf671c2[_0xe2ed('0x49')]][_0xe2ed('0x49')]][_0xe2ed('0x34')]=_0xf671c2[_0xe2ed('0x34')];this['channels'][this[_0xe2ed('0x17')][_0xf671c2[_0xe2ed('0x49')]][_0xe2ed('0x49')]][_0xe2ed('0x65')]=this['channels'][_0xf671c2[_0xe2ed('0x34')]][_0xe2ed('0x65')];this[_0xe2ed('0x15')][this[_0xe2ed('0x17')][_0xf671c2['linkedid']]['linkedid']]['answertime']=this[_0xe2ed('0x15')][_0xf671c2[_0xe2ed('0x34')]][_0xe2ed('0x66')];this['channels'][this['blindTransfers'][_0xf671c2[_0xe2ed('0x49')]]['linkedid']]['destinationchannel']=this[_0xe2ed('0x15')][this[_0xe2ed('0x17')][_0xf671c2[_0xe2ed('0x49')]][_0xe2ed('0x49')]][_0xe2ed('0x3d')];this[_0xe2ed('0x15')][this['blindTransfers'][_0xf671c2['linkedid']][_0xe2ed('0x49')]]['disposition']=this[_0xe2ed('0x15')][_0xf671c2[_0xe2ed('0x34')]][_0xe2ed('0x4e')];this[_0xe2ed('0x15')][_0xf671c2[_0xe2ed('0x34')]]=this[_0xe2ed('0x15')][this[_0xe2ed('0x17')][_0xf671c2[_0xe2ed('0x49')]][_0xe2ed('0x49')]];this[_0xe2ed('0x95')](this[_0xe2ed('0x17')][_0xf671c2[_0xe2ed('0x49')]][_0xe2ed('0x49')]);}else if(this[_0xe2ed('0x15')][this[_0xe2ed('0x17')][_0xf671c2[_0xe2ed('0x49')]][_0xe2ed('0x34')]]){this[_0xe2ed('0x15')][this[_0xe2ed('0x17')][_0xf671c2[_0xe2ed('0x49')]][_0xe2ed('0x34')]][_0xe2ed('0x34')]=[this[_0xe2ed('0x15')][this[_0xe2ed('0x17')][_0xf671c2[_0xe2ed('0x49')]][_0xe2ed('0x34')]][_0xe2ed('0x49')],this['channels'][this[_0xe2ed('0x17')][_0xf671c2[_0xe2ed('0x49')]][_0xe2ed('0x34')]]['linkedid']=this[_0xe2ed('0x15')][this['blindTransfers'][_0xf671c2[_0xe2ed('0x49')]][_0xe2ed('0x34')]][_0xe2ed('0x34')]][0x0];this['channels'][this[_0xe2ed('0x17')][_0xf671c2[_0xe2ed('0x49')]]['uniqueid']][_0xe2ed('0x65')]=this[_0xe2ed('0x15')][_0xf671c2[_0xe2ed('0x34')]][_0xe2ed('0x65')];this[_0xe2ed('0x15')][this[_0xe2ed('0x17')][_0xf671c2['linkedid']]['uniqueid']]['answertime']=this[_0xe2ed('0x15')][_0xf671c2[_0xe2ed('0x34')]][_0xe2ed('0x66')];this[_0xe2ed('0x15')][this[_0xe2ed('0x17')][_0xf671c2[_0xe2ed('0x49')]][_0xe2ed('0x34')]][_0xe2ed('0x6b')]=this[_0xe2ed('0x15')][this[_0xe2ed('0x17')][_0xf671c2[_0xe2ed('0x49')]]['uniqueid']][_0xe2ed('0x3d')];this['channels'][this[_0xe2ed('0x17')][_0xf671c2[_0xe2ed('0x49')]][_0xe2ed('0x34')]][_0xe2ed('0x4e')]=this[_0xe2ed('0x15')][_0xf671c2[_0xe2ed('0x34')]][_0xe2ed('0x4e')];this[_0xe2ed('0x15')][_0xf671c2['uniqueid']]=this[_0xe2ed('0x15')][this[_0xe2ed('0x17')][_0xf671c2[_0xe2ed('0x49')]][_0xe2ed('0x34')]];this[_0xe2ed('0x95')](this[_0xe2ed('0x17')][_0xf671c2['linkedid']][_0xe2ed('0x34')]);}}if(this[_0xe2ed('0x15')][_0xf671c2[_0xe2ed('0x34')]]){logger[_0xe2ed('0x4a')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0xf671c2[_0xe2ed('0x34')],_0xf671c2[_0xe2ed('0x96')]);var _0x21c2ab=moment();this[_0xe2ed('0x15')][_0xf671c2[_0xe2ed('0x34')]][_0xe2ed('0x97')]=_0x21c2ab[_0xe2ed('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xf671c2['uniqueid']][_0xe2ed('0x5a')]=_0x21c2ab[_0xe2ed('0x68')](this[_0xe2ed('0x15')][_0xf671c2[_0xe2ed('0x34')]]['starttime'],_0xe2ed('0x5b'));if(this[_0xe2ed('0x15')][_0xf671c2['uniqueid']][_0xe2ed('0x65')]){this['channels'][_0xf671c2[_0xe2ed('0x34')]][_0xe2ed('0x98')]=_0x21c2ab['diff'](this[_0xe2ed('0x15')][_0xf671c2[_0xe2ed('0x34')]][_0xe2ed('0x66')],_0xe2ed('0x5b'));this[_0xe2ed('0x15')][_0xf671c2[_0xe2ed('0x34')]][_0xe2ed('0x67')]=this[_0xe2ed('0x15')][_0xf671c2['uniqueid']][_0xe2ed('0x5a')]-this[_0xe2ed('0x15')][_0xf671c2[_0xe2ed('0x34')]][_0xe2ed('0x98')];}if(_0xf671c2['context']===_0xe2ed('0x3c')){if(this[_0xe2ed('0x16')][_0xf671c2[_0xe2ed('0x3d')][_0xe2ed('0x3e')]('-')[0x0]]){this[_0xe2ed('0x16')][_0xf671c2[_0xe2ed('0x3d')]['split']('-')[0x0]]=_[_0xe2ed('0x99')](this[_0xe2ed('0x16')][_0xf671c2[_0xe2ed('0x3d')]['split']('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0xe2ed('0x9a'),_0xf671c2[_0xe2ed('0x34')],util[_0xe2ed('0x2f')]({'id':this[_0xe2ed('0x16')][_0xf671c2['channel'][_0xe2ed('0x3e')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0xf671c2[_0xe2ed('0x3d')][_0xe2ed('0x3e')]('-')[0x0]][_0xe2ed('0x45')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xe2ed('0x41')](_0xe2ed('0x42'),this[_0xe2ed('0x16')][_0xf671c2[_0xe2ed('0x3d')][_0xe2ed('0x3e')]('-')[0x0]][_0xe2ed('0x43')]),_0xe2ed('0x9b'),{'id':this[_0xe2ed('0x16')][_0xf671c2[_0xe2ed('0x3d')][_0xe2ed('0x3e')]('-')[0x0]]['id'],'destaccountcode':this[_0xe2ed('0x16')][_0xf671c2[_0xe2ed('0x3d')]['split']('-')[0x0]][_0xe2ed('0x45')]});for(var _0x10a731=0x0;_0x10a731{delete this[_0xe2ed('0x15')][_0x1b3e84];},_0xcb1644);}};module[_0xe2ed('0xc7')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index f3c9c9b..5714fb1 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 _0xd2bc=['diff','seconds','total','answered','holdtime','billableseconds','sumBillable','sumDuration','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','set','appdata','applicationdata','startsWith','cdr(','split','lodash','moment','util','ioredis','../../../config/environment','../ami','defaults','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','bind','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','called','substring','channel','lastIndexOf','omit','privilege','info','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','custom:dialbegin','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','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:','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','error','[%s][voiceDialReport][varset]','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration'];(function(_0x766909,_0x510154){var _0x16bc3f=function(_0x5259c5){while(--_0x5259c5){_0x766909['push'](_0x766909['shift']());}};_0x16bc3f(++_0x510154);}(_0xd2bc,0x1ec));var _0xcd2b=function(_0x7d3a29,_0x5c399a){_0x7d3a29=_0x7d3a29-0x0;var _0x85521e=_0xd2bc[_0x7d3a29];return _0x85521e;};'use strict';var _=require(_0xcd2b('0x0'));var moment=require(_0xcd2b('0x1'));var util=require(_0xcd2b('0x2'));var Redis=require(_0xcd2b('0x3'));var config=require(_0xcd2b('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0xcd2b('0x5'));config['redis']=_[_0xcd2b('0x6')](config[_0xcd2b('0x7')],{'host':_0xcd2b('0x8'),'port':0x18eb});var io=require(_0xcd2b('0x9'))(new Redis(config[_0xcd2b('0x7')]));function VoiceDialReport(_0x5eac43){this[_0xcd2b('0xa')]=_0x5eac43[_0xcd2b('0xb')];this['outbound']=_0x5eac43[_0xcd2b('0xc')];this[_0xcd2b('0xd')]={};this[_0xcd2b('0xe')]={};ami['on'](_0xcd2b('0xf'),this[_0xcd2b('0x10')]['bind'](this));ami['on']('dialend',this['syncDialEnd'][_0xcd2b('0x11')](this));ami['on']('varset',this[_0xcd2b('0x12')]['bind'](this));ami['on'](_0xcd2b('0x13'),this[_0xcd2b('0x14')][_0xcd2b('0x11')](this));}VoiceDialReport[_0xcd2b('0x15')][_0xcd2b('0x16')]=function(_0x278128){return _0x278128!==null&&!_[_0xcd2b('0x17')](_0x278128);};VoiceDialReport[_0xcd2b('0x15')]['emit']=function(_0x521ee5,_0x3fc557,_0x53d58e){io['to'](_0x521ee5)[_0xcd2b('0x18')](_0x3fc557,_0x53d58e);};VoiceDialReport[_0xcd2b('0x15')][_0xcd2b('0x10')]=function(_0x294e93){try{if(this[_0xcd2b('0x16')](_0x294e93)){logger[_0xcd2b('0x19')](_0xcd2b('0x1a'),_0x294e93[_0xcd2b('0x1b')],util[_0xcd2b('0x1c')](_0x294e93,{'showHidden':![],'depth':null}));if(this[_0xcd2b('0xa')][_0x294e93['uniqueid']]){_[_0xcd2b('0x1d')](this[_0xcd2b('0xa')][_0x294e93[_0xcd2b('0x1b')]],{'starttime':moment()[_0xcd2b('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xcd2b('0x1f'),'interface':_0x294e93['channel'][_0xcd2b('0x20')](0x0,_0x294e93[_0xcd2b('0x21')]['lastIndexOf']('-')),'membername':_0x294e93[_0xcd2b('0x21')][_0xcd2b('0x20')](_0x294e93['channel']['lastIndexOf']('/')+0x1,_0x294e93[_0xcd2b('0x21')][_0xcd2b('0x22')]('-'))},_[_0xcd2b('0x23')](_0x294e93,['event',_0xcd2b('0x24')]));logger[_0xcd2b('0x25')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x294e93['uniqueid'],this['channels'][_0x294e93[_0xcd2b('0x1b')]][_0xcd2b('0x26')],this[_0xcd2b('0xa')][_0x294e93[_0xcd2b('0x1b')]][_0xcd2b('0x27')]);logger[_0xcd2b('0x19')](_0xcd2b('0x28'),_0x294e93['uniqueid'],util[_0xcd2b('0x1c')](this[_0xcd2b('0xa')][_0x294e93[_0xcd2b('0x1b')]],{'showHidden':![],'depth':null}));if(this[_0xcd2b('0xd')][_0x294e93['uniqueid']])_[_0xcd2b('0x1d')](this['channels'][_0x294e93['uniqueid']],this[_0xcd2b('0xd')][_0x294e93[_0xcd2b('0x1b')]]);this[_0xcd2b('0x18')](_0xcd2b('0x29'),'voice_outbound_channel:save',this['channels'][_0x294e93[_0xcd2b('0x1b')]]);logger[_0xcd2b('0x19')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x294e93[_0xcd2b('0x1b')],util[_0xcd2b('0x1c')](this[_0xcd2b('0xa')][_0x294e93[_0xcd2b('0x1b')]],{'showHidden':![],'depth':null}));ami[_0xcd2b('0x18')](_0xcd2b('0x2a'),this['channels'][_0x294e93[_0xcd2b('0x1b')]]);}}}catch(_0x452a18){logger['error'](_0xcd2b('0x2b'),_0x294e93['uniqueid'],util['inspect'](_0x452a18,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcd2b('0x15')][_0xcd2b('0x2c')]=function(_0x299c5a){try{if(this[_0xcd2b('0x16')](_0x299c5a)){logger[_0xcd2b('0x19')](_0xcd2b('0x2d'),_0x299c5a[_0xcd2b('0x1b')],util[_0xcd2b('0x1c')](_0x299c5a,{'showHidden':![],'depth':null}));if(this[_0xcd2b('0xa')][_0x299c5a[_0xcd2b('0x1b')]]){this[_0xcd2b('0xa')][_0x299c5a[_0xcd2b('0x1b')]][_0xcd2b('0x2e')]=_0x299c5a['dialstatus'];if(_0x299c5a[_0xcd2b('0x2e')]===_0xcd2b('0x2f')){this[_0xcd2b('0xa')][_0x299c5a[_0xcd2b('0x1b')]][_0xcd2b('0x30')]=_0x299c5a[_0xcd2b('0x30')];this[_0xcd2b('0xa')][_0x299c5a[_0xcd2b('0x1b')]][_0xcd2b('0x31')]=_0x299c5a[_0xcd2b('0x31')];this[_0xcd2b('0xa')][_0x299c5a[_0xcd2b('0x1b')]][_0xcd2b('0x32')]=moment()[_0xcd2b('0x1e')](_0xcd2b('0x33'));this[_0xcd2b('0xa')][_0x299c5a['uniqueid']][_0xcd2b('0x34')]=_0xcd2b('0x35');logger[_0xcd2b('0x25')](_0xcd2b('0x36'),_0x299c5a[_0xcd2b('0x1b')],_0x299c5a[_0xcd2b('0x21')]['substring'](_0x299c5a[_0xcd2b('0x21')]['lastIndexOf']('/')+0x1,_0x299c5a[_0xcd2b('0x21')][_0xcd2b('0x22')]('-')));logger[_0xcd2b('0x19')](_0xcd2b('0x37'),_0x299c5a['uniqueid'],util['inspect'](this['channels'][_0x299c5a[_0xcd2b('0x1b')]],{'showHidden':![],'depth':null}));ami[_0xcd2b('0x18')](_0xcd2b('0x38'),this[_0xcd2b('0xa')][_0x299c5a[_0xcd2b('0x1b')]]);}logger[_0xcd2b('0x19')](_0xcd2b('0x39'),_0x299c5a[_0xcd2b('0x1b')],util[_0xcd2b('0x1c')](this['channels'][_0x299c5a[_0xcd2b('0x1b')]],{'showHidden':![],'depth':null}));this[_0xcd2b('0x18')](_0xcd2b('0x29'),_0xcd2b('0x3a'),this['channels'][_0x299c5a['uniqueid']]);}}}catch(_0x4ff954){logger['error'](_0xcd2b('0x3b'),_0x299c5a['uniqueid'],util[_0xcd2b('0x1c')](_0x4ff954,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcd2b('0x15')]['syncVarSet']=function(_0x1b5a58){try{if(this[_0xcd2b('0x16')](_0x1b5a58)){logger[_0xcd2b('0x19')](_0xcd2b('0x3c'),_0x1b5a58['uniqueid'],util[_0xcd2b('0x1c')](_0x1b5a58,{'showHidden':![],'depth':null}));this[_0xcd2b('0x3d')](_0x1b5a58[_0xcd2b('0x1b')],_[_0xcd2b('0x3e')](_0x1b5a58[_0xcd2b('0x3f')])[0x0],_0x1b5a58[_0xcd2b('0x40')]);if(this[_0xcd2b('0x16')](_0x1b5a58['variable'])&&this[_0xcd2b('0x16')](_0x1b5a58[_0xcd2b('0x3f')][_0xcd2b('0x41')])){if(_[_0xcd2b('0x17')](this['channels'][_0x1b5a58['uniqueid']])){this[_0xcd2b('0xa')][_0x1b5a58[_0xcd2b('0x1b')]]={'routeId':_0x1b5a58[_0xcd2b('0x40')],'variables':this['variables'][_0x1b5a58[_0xcd2b('0x1b')]],'motionChannel':_0xcd2b('0x42')};logger[_0xcd2b('0x25')](_0xcd2b('0x43'),_0x1b5a58[_0xcd2b('0x1b')],_0x1b5a58[_0xcd2b('0x3f')][_0xcd2b('0x41')],_['keys'](_0x1b5a58[_0xcd2b('0x3f')])[0x0],_0x1b5a58['value']);logger['debug'](_0xcd2b('0x44'),_0x1b5a58[_0xcd2b('0x1b')],util[_0xcd2b('0x1c')](this['channels'][_0x1b5a58['uniqueid']],{'showHidden':![],'depth':null}));this[_0xcd2b('0x18')](_0xcd2b('0x29'),_0xcd2b('0x3a'),this[_0xcd2b('0xa')][_0x1b5a58[_0xcd2b('0x1b')]]);}}}}catch(_0x56710f){logger[_0xcd2b('0x45')](_0xcd2b('0x46'),_0x1b5a58[_0xcd2b('0x1b')],util[_0xcd2b('0x1c')](_0x56710f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcd2b('0x15')]['addVariable']=function(_0x478bb2,_0x31e1d4,_0x1dc78c){var _0x445944=['rtpaudioqos','rtpaudioqosbridged',_0xcd2b('0x47'),_0xcd2b('0x48'),_0xcd2b('0x49'),_0xcd2b('0x4a'),_0xcd2b('0x4b'),'rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer',_0xcd2b('0x4c'),'membercalls',_0xcd2b('0x4d'),_0xcd2b('0x4e'),_0xcd2b('0x4f'),_0xcd2b('0x26'),_0xcd2b('0x50'),_0xcd2b('0x51')];if(!_[_0xcd2b('0x52')](_0x31e1d4)&&!_['includes'](_0x445944,_0x31e1d4)){if(_[_0xcd2b('0x17')](this[_0xcd2b('0xe')][_0x478bb2])){this[_0xcd2b('0xe')][_0x478bb2]={};}this[_0xcd2b('0xe')][_0x478bb2][_0x31e1d4]=_0x1dc78c;}};VoiceDialReport[_0xcd2b('0x15')][_0xcd2b('0x14')]=function(_0x38250b){try{if(this[_0xcd2b('0x16')](_0x38250b)){logger[_0xcd2b('0x19')](_0xcd2b('0x53'),_0x38250b['uniqueid'],util[_0xcd2b('0x1c')](_0x38250b,{'showHidden':![],'depth':null}));if(this[_0xcd2b('0xa')][_0x38250b[_0xcd2b('0x1b')]]){logger[_0xcd2b('0x25')](_0xcd2b('0x54'),_0x38250b['uniqueid'],_0x38250b[_0xcd2b('0x55')]);this['channels'][_0x38250b[_0xcd2b('0x1b')]][_0xcd2b('0x56')]=moment()[_0xcd2b('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcd2b('0xa')][_0x38250b['uniqueid']][_0xcd2b('0x57')]=moment(this[_0xcd2b('0xa')][_0x38250b['uniqueid']][_0xcd2b('0x56')])[_0xcd2b('0x58')](this[_0xcd2b('0xa')][_0x38250b['uniqueid']]['starttime'],_0xcd2b('0x59'));this['channels'][_0x38250b[_0xcd2b('0x1b')]]['lastevent']='complete';this[_0xcd2b('0xc')][_0xcd2b('0x5a')]+=0x1;if(this[_0xcd2b('0xa')][_0x38250b['uniqueid']][_0xcd2b('0x32')]){this['outbound'][_0xcd2b('0x5b')]+=0x1;this[_0xcd2b('0xa')][_0x38250b[_0xcd2b('0x1b')]][_0xcd2b('0x5c')]=moment(this[_0xcd2b('0xa')][_0x38250b['uniqueid']][_0xcd2b('0x32')])[_0xcd2b('0x58')](this[_0xcd2b('0xa')][_0x38250b[_0xcd2b('0x1b')]]['starttime'],_0xcd2b('0x59'));this[_0xcd2b('0xa')][_0x38250b['uniqueid']][_0xcd2b('0x5d')]=moment(this[_0xcd2b('0xa')][_0x38250b['uniqueid']][_0xcd2b('0x56')])[_0xcd2b('0x58')](this[_0xcd2b('0xa')][_0x38250b[_0xcd2b('0x1b')]][_0xcd2b('0x32')],_0xcd2b('0x59'));this[_0xcd2b('0xc')]['sumHoldTime']+=this[_0xcd2b('0xa')][_0x38250b[_0xcd2b('0x1b')]][_0xcd2b('0x5c')]||0x0;this[_0xcd2b('0xc')][_0xcd2b('0x5e')]+=this[_0xcd2b('0xa')][_0x38250b[_0xcd2b('0x1b')]][_0xcd2b('0x5d')];}this['outbound'][_0xcd2b('0x5f')]+=this[_0xcd2b('0xa')][_0x38250b[_0xcd2b('0x1b')]][_0xcd2b('0x57')];logger[_0xcd2b('0x19')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x38250b[_0xcd2b('0x1b')],util[_0xcd2b('0x1c')](this[_0xcd2b('0xa')][_0x38250b[_0xcd2b('0x1b')]],{'showHidden':![],'depth':null}));ami[_0xcd2b('0x18')](_0xcd2b('0x60'),this[_0xcd2b('0xa')][_0x38250b['uniqueid']]);logger['debug'](_0xcd2b('0x61'),_0x38250b[_0xcd2b('0x1b')],util['inspect'](this[_0xcd2b('0xa')][_0x38250b[_0xcd2b('0x1b')]],{'showHidden':![],'depth':null}));ami[_0xcd2b('0x18')](_0xcd2b('0x62'),this['channels'][_0x38250b[_0xcd2b('0x1b')]]);logger[_0xcd2b('0x19')](_0xcd2b('0x63'),_0x38250b[_0xcd2b('0x1b')],util[_0xcd2b('0x1c')](this[_0xcd2b('0xa')][_0x38250b[_0xcd2b('0x1b')]],{'showHidden':![],'depth':null}));this[_0xcd2b('0x18')](_0xcd2b('0x29'),_0xcd2b('0x64'),this[_0xcd2b('0xc')]);logger[_0xcd2b('0x25')](_0xcd2b('0x65'),JSON['stringify'](this['channels'][_0x38250b[_0xcd2b('0x1b')]]));logger['debug'](_0xcd2b('0x66'),_0x38250b['uniqueid'],util[_0xcd2b('0x1c')](this[_0xcd2b('0xa')][_0x38250b[_0xcd2b('0x1b')]],{'showHidden':![],'depth':null}));this[_0xcd2b('0x18')](_0xcd2b('0x29'),_0xcd2b('0x67'),this[_0xcd2b('0xa')][_0x38250b[_0xcd2b('0x1b')]]);this[_0xcd2b('0x68')](_0x38250b[_0xcd2b('0x1b')]);}else if(this['channels'][_0x38250b[_0xcd2b('0x69')]]){this[_0xcd2b('0xa')][_0x38250b[_0xcd2b('0x69')]]['uniqueid']=this[_0xcd2b('0xa')][_0x38250b[_0xcd2b('0x69')]][_0xcd2b('0x6a')];}if(this[_0xcd2b('0xe')][_0x38250b[_0xcd2b('0x1b')]]){delete this[_0xcd2b('0xe')][_0x38250b[_0xcd2b('0x1b')]];}}}catch(_0x2972f0){logger['error']('[%s][voiceDialReport][hangup]',_0x38250b[_0xcd2b('0x1b')],util['inspect'](_0x2972f0,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcd2b('0x15')][_0xcd2b('0x6b')]=function(_0x55c0d7){try{if(this['isNotNull'](_0x55c0d7)){logger[_0xcd2b('0x19')](_0xcd2b('0x6c'),_0x55c0d7[_0xcd2b('0x1b')],util[_0xcd2b('0x1c')](_0x55c0d7,{'showHidden':![],'depth':null}));if(_0x55c0d7[_0xcd2b('0x6d')]['toLowerCase']()===_0xcd2b('0x6e')){_0x55c0d7['applicationdata']=(_0x55c0d7[_0xcd2b('0x6f')]||_0x55c0d7[_0xcd2b('0x70')])['toLowerCase']();if(_[_0xcd2b('0x71')](_0x55c0d7[_0xcd2b('0x70')],_0xcd2b('0x72'))){if(_[_0xcd2b('0x17')](this[_0xcd2b('0xd')][_0x55c0d7['uniqueid']]))this[_0xcd2b('0xd')][_0x55c0d7[_0xcd2b('0x1b')]]={};logger[_0xcd2b('0x25')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x55c0d7['uniqueid'],_0x55c0d7[_0xcd2b('0x6d')],_0x55c0d7[_0xcd2b('0x70')]);var _0x111e13=_0x55c0d7[_0xcd2b('0x70')][_0xcd2b('0x73')]('=');var _0x27d7fb=_0x111e13[0x0]['match'](/cdr\((.*)\)/);if(_0x27d7fb)this[_0xcd2b('0xd')][_0x55c0d7[_0xcd2b('0x1b')]][_0x27d7fb[0x1]]=_0x111e13[0x1];}}}}catch(_0x1a90ea){logger['error']('[%s][voiceDialReport][newexten]',_0x55c0d7['uniqueid'],util[_0xcd2b('0x1c')](_0x1a90ea,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcd2b('0x15')]['deleteChannelAfterTimeout']=function(_0x4170e7,_0x4ced2d=0x2710){if(this['channels'][_0x4170e7]){setTimeout(()=>{delete this['channels'][_0x4170e7];},_0x4ced2d);}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0x0e46=['[%s][voiceDialReport][varset]\x20event:','addVariable','value','variable','outboundrouteid','isUndefined','voice','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','memberdynamic','memberlastcall','memberrealtime','includes','variables','syncHangup','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','format','duration','diff','starttime','seconds','complete','total','answered','holdtime','billableseconds','answertime','sumHoldTime','sumBillable','sumDuration','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','deleteChannelAfterTimeout','linkedid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','[%s][voiceDialReport][newexten]','lodash','util','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','isNotNull','prototype','emit','debug','uniqueid','inspect','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','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:','voice:outbound','[%s][voiceDialReport][dialend]'];(function(_0x57caf0,_0x1fe145){var _0x65d871=function(_0x56a92){while(--_0x56a92){_0x57caf0['push'](_0x57caf0['shift']());}};_0x65d871(++_0x1fe145);}(_0x0e46,0x120));var _0x60e4=function(_0x1d2ff6,_0x2216b4){_0x1d2ff6=_0x1d2ff6-0x0;var _0x4b269f=_0x0e46[_0x1d2ff6];return _0x4b269f;};'use strict';var _=require(_0x60e4('0x0'));var moment=require('moment');var util=require(_0x60e4('0x1'));var Redis=require('ioredis');var config=require(_0x60e4('0x2'));var logger=require('../../../config/logger')(_0x60e4('0x3'));var ami=require(_0x60e4('0x4'));config[_0x60e4('0x5')]=_[_0x60e4('0x6')](config[_0x60e4('0x5')],{'host':_0x60e4('0x7'),'port':0x18eb});var io=require(_0x60e4('0x8'))(new Redis(config[_0x60e4('0x5')]));function VoiceDialReport(_0x4618f1){this[_0x60e4('0x9')]=_0x4618f1[_0x60e4('0xa')];this[_0x60e4('0xb')]=_0x4618f1[_0x60e4('0xb')];this[_0x60e4('0xc')]={};this['variables']={};ami['on'](_0x60e4('0xd'),this[_0x60e4('0xe')][_0x60e4('0xf')](this));ami['on'](_0x60e4('0x10'),this[_0x60e4('0x11')][_0x60e4('0xf')](this));ami['on'](_0x60e4('0x12'),this[_0x60e4('0x13')][_0x60e4('0xf')](this));ami['on']('hangup',this['syncHangup'][_0x60e4('0xf')](this));}VoiceDialReport['prototype'][_0x60e4('0x14')]=function(_0x35fda9){return _0x35fda9!==null&&!_['isUndefined'](_0x35fda9);};VoiceDialReport[_0x60e4('0x15')]['emit']=function(_0x4201ec,_0x41705f,_0x4b6c03){io['to'](_0x4201ec)[_0x60e4('0x16')](_0x41705f,_0x4b6c03);};VoiceDialReport[_0x60e4('0x15')][_0x60e4('0xe')]=function(_0xa6b535){try{if(this['isNotNull'](_0xa6b535)){logger[_0x60e4('0x17')]('[%s][voiceDialReport][dialbegin]\x20event:',_0xa6b535[_0x60e4('0x18')],util[_0x60e4('0x19')](_0xa6b535,{'showHidden':![],'depth':null}));if(this[_0x60e4('0x9')][_0xa6b535[_0x60e4('0x18')]]){_[_0x60e4('0x1a')](this[_0x60e4('0x9')][_0xa6b535[_0x60e4('0x18')]],{'starttime':moment()['format'](_0x60e4('0x1b')),'lastevent':_0x60e4('0x1c'),'interface':_0xa6b535[_0x60e4('0x1d')][_0x60e4('0x1e')](0x0,_0xa6b535[_0x60e4('0x1d')][_0x60e4('0x1f')]('-')),'membername':_0xa6b535['channel'][_0x60e4('0x1e')](_0xa6b535[_0x60e4('0x1d')][_0x60e4('0x1f')]('/')+0x1,_0xa6b535['channel'][_0x60e4('0x1f')]('-'))},_[_0x60e4('0x20')](_0xa6b535,['event',_0x60e4('0x21')]));logger[_0x60e4('0x22')](_0x60e4('0x23'),_0xa6b535[_0x60e4('0x18')],this[_0x60e4('0x9')][_0xa6b535[_0x60e4('0x18')]][_0x60e4('0x24')],this[_0x60e4('0x9')][_0xa6b535[_0x60e4('0x18')]]['interface']);logger[_0x60e4('0x17')](_0x60e4('0x25'),_0xa6b535[_0x60e4('0x18')],util[_0x60e4('0x19')](this[_0x60e4('0x9')][_0xa6b535[_0x60e4('0x18')]],{'showHidden':![],'depth':null}));if(this[_0x60e4('0xc')][_0xa6b535[_0x60e4('0x18')]])_[_0x60e4('0x1a')](this[_0x60e4('0x9')][_0xa6b535[_0x60e4('0x18')]],this[_0x60e4('0xc')][_0xa6b535['uniqueid']]);this[_0x60e4('0x16')]('voice:outbound',_0x60e4('0x26'),this['channels'][_0xa6b535[_0x60e4('0x18')]]);logger[_0x60e4('0x17')](_0x60e4('0x27'),_0xa6b535[_0x60e4('0x18')],util[_0x60e4('0x19')](this[_0x60e4('0x9')][_0xa6b535[_0x60e4('0x18')]],{'showHidden':![],'depth':null}));ami[_0x60e4('0x16')]('custom:dialbegin',this[_0x60e4('0x9')][_0xa6b535[_0x60e4('0x18')]]);}}}catch(_0x278c16){logger[_0x60e4('0x28')](_0x60e4('0x29'),_0xa6b535[_0x60e4('0x18')],util[_0x60e4('0x19')](_0x278c16,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x60e4('0x11')]=function(_0x5706c5){try{if(this[_0x60e4('0x14')](_0x5706c5)){logger[_0x60e4('0x17')](_0x60e4('0x2a'),_0x5706c5[_0x60e4('0x18')],util[_0x60e4('0x19')](_0x5706c5,{'showHidden':![],'depth':null}));if(this[_0x60e4('0x9')][_0x5706c5[_0x60e4('0x18')]]){this[_0x60e4('0x9')][_0x5706c5[_0x60e4('0x18')]]['dialstatus']=_0x5706c5[_0x60e4('0x2b')];if(_0x5706c5['dialstatus']==='ANSWER'){this[_0x60e4('0x9')][_0x5706c5[_0x60e4('0x18')]][_0x60e4('0x2c')]=_0x5706c5[_0x60e4('0x2c')];this[_0x60e4('0x9')][_0x5706c5[_0x60e4('0x18')]][_0x60e4('0x2d')]=_0x5706c5[_0x60e4('0x2d')];this['channels'][_0x5706c5[_0x60e4('0x18')]]['answertime']=moment()['format'](_0x60e4('0x1b'));this[_0x60e4('0x9')][_0x5706c5[_0x60e4('0x18')]][_0x60e4('0x2e')]=_0x60e4('0x2f');logger[_0x60e4('0x22')](_0x60e4('0x30'),_0x5706c5[_0x60e4('0x18')],_0x5706c5[_0x60e4('0x1d')][_0x60e4('0x1e')](_0x5706c5[_0x60e4('0x1d')][_0x60e4('0x1f')]('/')+0x1,_0x5706c5['channel'][_0x60e4('0x1f')]('-')));logger[_0x60e4('0x17')](_0x60e4('0x31'),_0x5706c5[_0x60e4('0x18')],util['inspect'](this[_0x60e4('0x9')][_0x5706c5[_0x60e4('0x18')]],{'showHidden':![],'depth':null}));ami['emit'](_0x60e4('0x32'),this[_0x60e4('0x9')][_0x5706c5[_0x60e4('0x18')]]);}logger[_0x60e4('0x17')](_0x60e4('0x33'),_0x5706c5['uniqueid'],util[_0x60e4('0x19')](this[_0x60e4('0x9')][_0x5706c5[_0x60e4('0x18')]],{'showHidden':![],'depth':null}));this[_0x60e4('0x16')](_0x60e4('0x34'),_0x60e4('0x26'),this[_0x60e4('0x9')][_0x5706c5['uniqueid']]);}}}catch(_0x4ab729){logger['error'](_0x60e4('0x35'),_0x5706c5['uniqueid'],util[_0x60e4('0x19')](_0x4ab729,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x60e4('0x13')]=function(_0x2b8787){try{if(this[_0x60e4('0x14')](_0x2b8787)){logger[_0x60e4('0x17')](_0x60e4('0x36'),_0x2b8787[_0x60e4('0x18')],util[_0x60e4('0x19')](_0x2b8787,{'showHidden':![],'depth':null}));this[_0x60e4('0x37')](_0x2b8787[_0x60e4('0x18')],_['keys'](_0x2b8787['variable'])[0x0],_0x2b8787[_0x60e4('0x38')]);if(this[_0x60e4('0x14')](_0x2b8787[_0x60e4('0x39')])&&this[_0x60e4('0x14')](_0x2b8787[_0x60e4('0x39')][_0x60e4('0x3a')])){if(_[_0x60e4('0x3b')](this[_0x60e4('0x9')][_0x2b8787[_0x60e4('0x18')]])){this['channels'][_0x2b8787['uniqueid']]={'routeId':_0x2b8787[_0x60e4('0x38')],'variables':this['variables'][_0x2b8787[_0x60e4('0x18')]],'motionChannel':_0x60e4('0x3c')};logger['info']('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x2b8787[_0x60e4('0x18')],_0x2b8787[_0x60e4('0x39')][_0x60e4('0x3a')],_['keys'](_0x2b8787[_0x60e4('0x39')])[0x0],_0x2b8787[_0x60e4('0x38')]);logger[_0x60e4('0x17')](_0x60e4('0x3d'),_0x2b8787['uniqueid'],util[_0x60e4('0x19')](this[_0x60e4('0x9')][_0x2b8787[_0x60e4('0x18')]],{'showHidden':![],'depth':null}));this[_0x60e4('0x16')]('voice:outbound',_0x60e4('0x26'),this[_0x60e4('0x9')][_0x2b8787['uniqueid']]);}}}}catch(_0x40aa28){logger[_0x60e4('0x28')](_0x60e4('0x3e'),_0x2b8787[_0x60e4('0x18')],util[_0x60e4('0x19')](_0x40aa28,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x60e4('0x15')]['addVariable']=function(_0x455bad,_0x2ebb21,_0x3ece72){var _0x17f064=[_0x60e4('0x3f'),_0x60e4('0x40'),_0x60e4('0x41'),_0x60e4('0x42'),_0x60e4('0x43'),_0x60e4('0x44'),_0x60e4('0x45'),_0x60e4('0x46'),_0x60e4('0x47'),_0x60e4('0x48'),'bridgepeer',_0x60e4('0x49'),'membercalls',_0x60e4('0x4a'),'memberinterface',_0x60e4('0x4b'),_0x60e4('0x24'),'memberpenalty',_0x60e4('0x4c')];if(!_['isNil'](_0x2ebb21)&&!_[_0x60e4('0x4d')](_0x17f064,_0x2ebb21)){if(_[_0x60e4('0x3b')](this[_0x60e4('0x4e')][_0x455bad])){this[_0x60e4('0x4e')][_0x455bad]={};}this[_0x60e4('0x4e')][_0x455bad][_0x2ebb21]=_0x3ece72;}};VoiceDialReport[_0x60e4('0x15')][_0x60e4('0x4f')]=function(_0x3d586d){try{if(this[_0x60e4('0x14')](_0x3d586d)){logger[_0x60e4('0x17')](_0x60e4('0x50'),_0x3d586d[_0x60e4('0x18')],util[_0x60e4('0x19')](_0x3d586d,{'showHidden':![],'depth':null}));if(this[_0x60e4('0x9')][_0x3d586d[_0x60e4('0x18')]]){logger[_0x60e4('0x22')](_0x60e4('0x51'),_0x3d586d['uniqueid'],_0x3d586d['cause-txt']);this[_0x60e4('0x9')][_0x3d586d[_0x60e4('0x18')]][_0x60e4('0x52')]=moment()[_0x60e4('0x53')](_0x60e4('0x1b'));this[_0x60e4('0x9')][_0x3d586d[_0x60e4('0x18')]][_0x60e4('0x54')]=moment(this[_0x60e4('0x9')][_0x3d586d['uniqueid']][_0x60e4('0x52')])[_0x60e4('0x55')](this[_0x60e4('0x9')][_0x3d586d[_0x60e4('0x18')]][_0x60e4('0x56')],_0x60e4('0x57'));this['channels'][_0x3d586d['uniqueid']][_0x60e4('0x2e')]=_0x60e4('0x58');this[_0x60e4('0xb')][_0x60e4('0x59')]+=0x1;if(this[_0x60e4('0x9')][_0x3d586d[_0x60e4('0x18')]]['answertime']){this[_0x60e4('0xb')][_0x60e4('0x5a')]+=0x1;this['channels'][_0x3d586d[_0x60e4('0x18')]][_0x60e4('0x5b')]=moment(this[_0x60e4('0x9')][_0x3d586d[_0x60e4('0x18')]]['answertime'])[_0x60e4('0x55')](this[_0x60e4('0x9')][_0x3d586d[_0x60e4('0x18')]][_0x60e4('0x56')],_0x60e4('0x57'));this['channels'][_0x3d586d['uniqueid']][_0x60e4('0x5c')]=moment(this[_0x60e4('0x9')][_0x3d586d[_0x60e4('0x18')]]['endtime'])['diff'](this[_0x60e4('0x9')][_0x3d586d['uniqueid']][_0x60e4('0x5d')],_0x60e4('0x57'));this[_0x60e4('0xb')][_0x60e4('0x5e')]+=this[_0x60e4('0x9')][_0x3d586d[_0x60e4('0x18')]]['holdtime']||0x0;this[_0x60e4('0xb')][_0x60e4('0x5f')]+=this[_0x60e4('0x9')][_0x3d586d['uniqueid']]['billableseconds'];}this[_0x60e4('0xb')][_0x60e4('0x60')]+=this[_0x60e4('0x9')][_0x3d586d['uniqueid']]['duration'];logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x3d586d[_0x60e4('0x18')],util[_0x60e4('0x19')](this[_0x60e4('0x9')][_0x3d586d[_0x60e4('0x18')]],{'showHidden':![],'depth':null}));ami[_0x60e4('0x16')](_0x60e4('0x61'),this[_0x60e4('0x9')][_0x3d586d[_0x60e4('0x18')]]);logger[_0x60e4('0x17')](_0x60e4('0x62'),_0x3d586d[_0x60e4('0x18')],util[_0x60e4('0x19')](this['channels'][_0x3d586d[_0x60e4('0x18')]],{'showHidden':![],'depth':null}));ami[_0x60e4('0x16')]('custom:dialend',this[_0x60e4('0x9')][_0x3d586d[_0x60e4('0x18')]]);logger[_0x60e4('0x17')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x3d586d['uniqueid'],util[_0x60e4('0x19')](this[_0x60e4('0x9')][_0x3d586d['uniqueid']],{'showHidden':![],'depth':null}));this[_0x60e4('0x16')](_0x60e4('0x34'),'voice_outbound:save',this['outbound']);logger[_0x60e4('0x22')](_0x60e4('0x63'),JSON[_0x60e4('0x64')](this['channels'][_0x3d586d[_0x60e4('0x18')]]));logger['debug'](_0x60e4('0x65'),_0x3d586d[_0x60e4('0x18')],util[_0x60e4('0x19')](this[_0x60e4('0x9')][_0x3d586d[_0x60e4('0x18')]],{'showHidden':![],'depth':null}));this[_0x60e4('0x16')](_0x60e4('0x34'),'voice_outbound_channel:remove',this[_0x60e4('0x9')][_0x3d586d['uniqueid']]);this[_0x60e4('0x66')](_0x3d586d[_0x60e4('0x18')]);}else if(this[_0x60e4('0x9')][_0x3d586d['linkedid']]){this[_0x60e4('0x9')][_0x3d586d[_0x60e4('0x67')]][_0x60e4('0x18')]=this[_0x60e4('0x9')][_0x3d586d[_0x60e4('0x67')]]['destuniqueid'];}if(this[_0x60e4('0x4e')][_0x3d586d[_0x60e4('0x18')]]){delete this[_0x60e4('0x4e')][_0x3d586d['uniqueid']];}}}catch(_0x20f55c){logger[_0x60e4('0x28')](_0x60e4('0x68'),_0x3d586d['uniqueid'],util[_0x60e4('0x19')](_0x20f55c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x60e4('0x15')]['syncNewExten']=function(_0x2b3ca3){try{if(this['isNotNull'](_0x2b3ca3)){logger[_0x60e4('0x17')](_0x60e4('0x69'),_0x2b3ca3[_0x60e4('0x18')],util['inspect'](_0x2b3ca3,{'showHidden':![],'depth':null}));if(_0x2b3ca3[_0x60e4('0x6a')][_0x60e4('0x6b')]()==='set'){_0x2b3ca3[_0x60e4('0x6c')]=(_0x2b3ca3[_0x60e4('0x6d')]||_0x2b3ca3[_0x60e4('0x6c')])['toLowerCase']();if(_['startsWith'](_0x2b3ca3['applicationdata'],_0x60e4('0x6e'))){if(_[_0x60e4('0x3b')](this[_0x60e4('0xc')][_0x2b3ca3[_0x60e4('0x18')]]))this[_0x60e4('0xc')][_0x2b3ca3[_0x60e4('0x18')]]={};logger[_0x60e4('0x22')](_0x60e4('0x6f'),_0x2b3ca3[_0x60e4('0x18')],_0x2b3ca3['application'],_0x2b3ca3['applicationdata']);var _0x72afe0=_0x2b3ca3[_0x60e4('0x6c')][_0x60e4('0x70')]('=');var _0x58e8a5=_0x72afe0[0x0]['match'](/cdr\((.*)\)/);if(_0x58e8a5)this['applications'][_0x2b3ca3[_0x60e4('0x18')]][_0x58e8a5[0x1]]=_0x72afe0[0x1];}}}}catch(_0xa6d470){logger[_0x60e4('0x28')](_0x60e4('0x71'),_0x2b3ca3[_0x60e4('0x18')],util[_0x60e4('0x19')](_0xa6d470,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x60e4('0x15')][_0x60e4('0x66')]=function(_0x50d9fa,_0x21b1d9=0x2710){if(this[_0x60e4('0x9')][_0x50d9fa]){setTimeout(()=>{delete this[_0x60e4('0x9')][_0x50d9fa];},_0x21b1d9);}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 91cb78b..211625f 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 _0x35c7=['connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','[%s][voiceQueueReport][agentconnect]','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','queuecallerabandonAt','assigned','membername','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','channel','toLowerCase','local/','linkedid','queuecallerjoinAt','FORWARDTRANSFER','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[%s][voiceQueueReport][varset]','addVariable','variable','CONTINUE','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','value','EXITWITHKEY','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','handleHangup','length','diff','seconds','ATTENDEDTRANSFER','COMPLETEDBYAGENT','sumDuration','milliseconds','sumBillable','queuecallercompleteAt','unmanaged','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','sumHoldTime','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','syncHangup','[%s][voiceQueueReport][hangup]','cause-txt','cause','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','transfertype','ATTENDED','transferid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','set','applicationdata','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','application','split','match','exports','lodash','util','ioredis','../../../config/logger','../model/queueReport','../model/voiceQueueSummary','defaults','redis','socket.io-emitter','enqueue','tail','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','campaigns','summary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','syncQueueMember','queuestatuscomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','syncAgentConnect','varset','syncVarSet','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','unlockRR','queuecallerexit','prototype','clearZombieChannels','switch','isNil','Action','status','message','No\x20such\x20channel','error','inspect','[%s][voiceQueueReport][checkQueueReport]','variables','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','queue','voice_queue_channel:save','voice_queue_presence:save','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','voice_queue_channel:remove','emitInboundVoiceQueueSummary','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','loopQueueShow','queues','catch','[voiceQueueReport][queues]','loopQueueSummary','queuesummary','actionid','queuestatus','summaryEvent','createReport','handleInboundQueueSummaryReport','createQueueSummaryReport','compareToInboundQueue','assign','syncQueueStatusComplete','type','custom:queuesummary','statusRequests','completeEvent','isNotNull','[voiceQueueReport][queuesummary]\x20name:%s','then','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummarycomplete]\x20event:','isUndefined','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','push','[%s][voiceQueueReport][queuecallerjoin]','queuecallercomplete','holdtime','originalposition','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallerleaveAt','connectedlinenum'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x35c7,0x158));var _0x735c=function(_0x251532,_0x4c7197){_0x251532=_0x251532-0x0;var _0x5c532a=_0x35c7[_0x251532];return _0x5c532a;};'use strict';var _=require(_0x735c('0x0'));var moment=require('moment');var util=require(_0x735c('0x1'));var Redis=require(_0x735c('0x2'));var config=require('../../../config/environment');var logger=require(_0x735c('0x3'))('ami');var ami=require('../ami');var QueueReport=require(_0x735c('0x4'));var VoiceQueueSummary=require(_0x735c('0x5'));config['redis']=_[_0x735c('0x6')](config[_0x735c('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x735c('0x8'))(new Redis(config[_0x735c('0x7')]));var Sequence=function(){};Sequence['prototype'][_0x735c('0x9')]=function(_0x5ef93b){this[_0x735c('0xa')]=this[_0x735c('0xa')]?this[_0x735c('0xa')]['finally'](_0x5ef93b):_0x5ef93b();};function VoiceQueueReport(_0x43ffac){this[_0x735c('0xb')]=new Sequence();this[_0x735c('0xc')]={};this[_0x735c('0xd')]=_0x43ffac;this['agents']=_0x43ffac[_0x735c('0xe')];this[_0x735c('0xf')]=_0x43ffac[_0x735c('0x10')];this[_0x735c('0x11')]=_0x43ffac[_0x735c('0x11')];this[_0x735c('0x12')]=_0x43ffac[_0x735c('0x12')];this[_0x735c('0x13')]=initializeSummary();this['variables']={};ami['on']('queuesummary',this[_0x735c('0x14')][_0x735c('0x15')](this));ami['on'](_0x735c('0x16'),this[_0x735c('0x17')][_0x735c('0x15')](this));ami['on']('queuemember',this[_0x735c('0x18')][_0x735c('0x15')](this));ami['on'](_0x735c('0x19'),this['syncQueueStatusComplete']['bind'](this));ami['on'](_0x735c('0x1a'),this[_0x735c('0x1b')][_0x735c('0x15')](this));ami['on'](_0x735c('0x1c'),this[_0x735c('0x1d')][_0x735c('0x15')](this));ami['on']('queuecallerleave',this[_0x735c('0x1e')]['bind'](this));ami['on'](_0x735c('0x1f'),this[_0x735c('0x20')]['bind'](this));ami['on']('agentconnect',this[_0x735c('0x21')]['bind'](this));ami['on'](_0x735c('0x22'),this[_0x735c('0x23')][_0x735c('0x15')](this));ami['on']('hangup',this['syncHangup'][_0x735c('0x15')](this));ami['on'](_0x735c('0x24'),this[_0x735c('0x25')][_0x735c('0x15')](this));ami['on'](_0x735c('0x26'),this[_0x735c('0x27')][_0x735c('0x15')](this));ami['on'](_0x735c('0x28'),this[_0x735c('0x29')]['bind'](this));ami['on'](_0x735c('0x2a'),this[_0x735c('0x2b')][_0x735c('0x15')](this));ami['on'](_0x735c('0x2c'),this[_0x735c('0x2d')][_0x735c('0x15')](this));this['loopQueueSummary']();this['loopQueueShow']();}function clearChannels(_0x247fe7){if(!_[_0x735c('0x2e')](_0x247fe7)){for(var _0x23a239 in _0x247fe7){if(_0x247fe7[_0x735c('0x2f')](_0x23a239)){delete _0x247fe7[_0x23a239];}}}}function clearCampaigns(_0x477343){if(!_[_0x735c('0x2e')](_0x477343)){for(var _0x46117b in _0x477343){if(_0x477343[_0x735c('0x2f')](_0x46117b)){_0x477343[_0x46117b][_0x735c('0x30')]=0x0;}}}}function clearVoiceQueues(_0x42fdf7){if(!_[_0x735c('0x2e')](_0x42fdf7)){for(var _0x2f68c1 in _0x42fdf7){if(_0x42fdf7[_0x735c('0x2f')](_0x2f68c1)){_0x42fdf7[_0x2f68c1][_0x735c('0x30')]=0x0;_0x42fdf7[_0x2f68c1][_0x735c('0x31')]=0x0;_0x42fdf7[_0x2f68c1][_0x735c('0x32')]=0x0;_0x42fdf7[_0x2f68c1][_0x735c('0x33')]=0x0;_0x42fdf7[_0x2f68c1]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0xfc575d){if(!_['isEmpty'](_0xfc575d)){for(var _0x1b91c0 in _0xfc575d){if(_0xfc575d[_0x735c('0x2f')](_0x1b91c0)){_0xfc575d[_0x1b91c0][_0x735c('0x34')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0xa7eb08){return _0xa7eb08[_0x735c('0x35')]||_0xa7eb08[_0x735c('0x1c')]||_0xa7eb08['queuecallercomplete'];}VoiceQueueReport[_0x735c('0x36')][_0x735c('0x37')]=function(){var _0x1076d3=this;for(var _0x420755 in this[_0x735c('0xf')]){if(this['channels'][_0x735c('0x2f')](_0x420755)&&!this[_0x735c('0xf')][_0x420755][_0x735c('0x38')]){this[_0x735c('0xb')]['enqueue'](function(){if(!_[_0x735c('0x39')](_0x1076d3[_0x735c('0xf')][_0x420755])){return ami[_0x735c('0x3a')]({'action':_0x735c('0x3b'),'channel':_0x1076d3[_0x735c('0xf')][_0x420755]['channel']})['catch'](function(_0x4cb115){if(_0x4cb115[_0x735c('0x3c')]===_0x735c('0x3d')){setTimeout(function(){if(_0x1076d3[_0x735c('0xf')][_0x420755]){delete _0x1076d3[_0x735c('0xf')][_0x420755];logger[_0x735c('0x3e')]('[%s][voiceQueueReport][checkChannel]',_0x420755,util[_0x735c('0x3f')](_0x4cb115,{'showHidden':![],'depth':null}));}if(_0x1076d3[_0x735c('0xc')][_0x420755]){delete _0x1076d3[_0x735c('0xc')][_0x420755];logger['error'](_0x735c('0x40'),_0x420755,util['inspect'](_0x4cb115,{'showHidden':![],'depth':null}));}if(_0x1076d3[_0x735c('0x41')][_0x420755]){delete _0x1076d3[_0x735c('0x41')][_0x420755];logger[_0x735c('0x3e')](_0x735c('0x42'),_0x420755,util['inspect'](_0x4cb115,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x735c('0x25')]=function(){logger[_0x735c('0x3e')](_0x735c('0x43'));clearChannels(this['channels']);this[_0x735c('0x44')](this[_0x735c('0xc')]);clearAgentBooked(this[_0x735c('0xe')]);clearVoiceQueues(this[_0x735c('0x11')]);clearCampaigns(this[_0x735c('0x12')]);this[_0x735c('0x13')]=initializeSummary();};VoiceQueueReport['prototype'][_0x735c('0x44')]=function(_0x4cc6de){var _0x4f02f0=this;if(!_[_0x735c('0x2e')](_0x4cc6de)){for(var _0x14d1fa in _0x4cc6de){if(_0x4cc6de['hasOwnProperty'](_0x14d1fa)){_0x4f02f0[_0x735c('0x45')](_0x4cc6de[_0x14d1fa],_0x735c('0x46'));delete _0x4cc6de[_0x14d1fa];}}}};VoiceQueueReport['prototype']['emit']=function(_0x3ea701,_0x4c50d0,_0x4074df){io['to'](_0x3ea701)[_0x735c('0x47')](_0x4c50d0,_0x4074df);};VoiceQueueReport[_0x735c('0x36')][_0x735c('0x48')]=function(_0x38f9a5,_0x27a00d){logger['debug']('[%s][voiceQueueReport]['+_0x27a00d+_0x735c('0x49'),_0x38f9a5[_0x735c('0x4a')],util[_0x735c('0x3f')](_0x38f9a5,{'showHidden':![],'depth':null}));this['emit'](util[_0x735c('0x4b')](_0x735c('0x4c'),_0x38f9a5[_0x735c('0x4d')]),_0x735c('0x4e'),_0x38f9a5);io[_0x735c('0x47')](_0x735c('0x4f'),_0x38f9a5);};VoiceQueueReport['prototype'][_0x735c('0x45')]=function(_0x568c48,_0x498deb){logger[_0x735c('0x50')](_0x735c('0x51')+_0x498deb+_0x735c('0x52'),_0x568c48[_0x735c('0x4a')],util[_0x735c('0x3f')](_0x568c48,{'showHidden':![],'depth':null}));if(_0x568c48[_0x735c('0x53')]==='ATTENDEDTRANSFER'){return;}this[_0x735c('0x47')](util['format'](_0x735c('0x4c'),_0x568c48[_0x735c('0x4d')]),_0x735c('0x54'),_0x568c48);io[_0x735c('0x47')]('voice_queue_presence:remove',_0x568c48);};VoiceQueueReport['prototype'][_0x735c('0x55')]=function(_0x27a687){if(_0x27a687['type']===_0x735c('0x56')){logger[_0x735c('0x50')](_0x735c('0x57'),util[_0x735c('0x3f')](_0x27a687,{'showHidden':![],'depth':null}));this['emit'](util[_0x735c('0x4b')](_0x735c('0x4c'),_0x27a687[_0x735c('0x58')]),_0x735c('0x59'),_0x27a687);}};VoiceQueueReport['prototype']['isNotNull']=function(_0x2c0457){return _0x2c0457!==null&&!_['isUndefined'](_0x2c0457);};VoiceQueueReport[_0x735c('0x36')][_0x735c('0x5a')]=function(){var _0x7be0e1=this;setInterval(function(){_0x7be0e1[_0x735c('0x37')]();ami[_0x735c('0x3a')]({'action':_0x735c('0x5b')})[_0x735c('0x5c')](function(_0xb00c3e){logger[_0x735c('0x3e')](_0x735c('0x5d'),util['inspect'](_0xb00c3e,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x735c('0x36')][_0x735c('0x5e')]=function(){var _0x294907=this;setInterval(function(){if(!_0x294907['summary']['isRunning']){return ami[_0x735c('0x3a')]({'action':_0x735c('0x5f')})['then'](function(_0x1ac52d){_0x294907[_0x735c('0x13')]['id']=_0x1ac52d[_0x735c('0x60')];_0x294907[_0x735c('0x13')]['isRunning']=!![];_0x294907[_0x735c('0x13')][_0x735c('0x61')][_0x1ac52d[_0x735c('0x60')]]={};})[_0x735c('0x5c')](function(_0x142766){logger[_0x735c('0x3e')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x142766,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x735c('0x36')]['createQueueSummaryReport']=function(_0x132662,_0x43a236){var _0x2d0e7c;if(this[_0x735c('0x13')]&&this[_0x735c('0x13')][_0x735c('0x5b')]&&this[_0x735c('0x13')][_0x735c('0x5b')][_0x132662['name']]){_0x2d0e7c=this[_0x735c('0x13')]['queues'][_0x132662[_0x735c('0x58')]][_0x735c('0x62')];}var _0x2c3cee=new VoiceQueueSummary(_0x132662);return _0x2c3cee[_0x735c('0x63')](_0x43a236['agents'],this['agents'],_0x2d0e7c,this[_0x735c('0xd')]['channels']);};VoiceQueueReport[_0x735c('0x36')][_0x735c('0x64')]=function(_0x274489,_0x20fc0d){var _0x3a7af5=this[_0x735c('0x65')](_0x274489,_0x20fc0d);var _0x12f8bc=![];_0x12f8bc=_0x3a7af5[_0x735c('0x66')](_0x274489);if(_0x12f8bc){Object[_0x735c('0x67')](_0x274489,_0x3a7af5);this['realtime'][_0x735c('0x11')][_0x274489['name']]=_0x274489;this[_0x735c('0x55')](_0x3a7af5);}};VoiceQueueReport['prototype'][_0x735c('0x68')]=function(_0x2d758f){var _0x5de0b9=null;var _0x2e853e=this['summary']['id'];if(this[_0x735c('0x13')][_0x735c('0x61')][_0x2e853e]){_0x5de0b9=this[_0x735c('0x13')][_0x735c('0x61')][_0x2e853e][_0x2d758f[_0x735c('0x60')]];}if(!_0x5de0b9){this[_0x735c('0x13')]=initializeSummary();return;}var _0xf767ce=this['voiceQueues'][_0x5de0b9[_0x735c('0x4d')]];if(_0xf767ce[_0x735c('0x69')]==='inbound'){this['handleInboundQueueSummaryReport'](_0xf767ce,_0x5de0b9);}else if(_0xf767ce['type']==='outbound'){var _0xc4836=this[_0x735c('0x65')](_0xf767ce,_0x5de0b9);ami[_0x735c('0x47')](_0x735c('0x6a'),_0xc4836);}this['summary'][_0x735c('0x6b')]-=0x1;var _0x1253fe=this[_0x735c('0x13')]['statusRequests']>0x0?!![]:![];if(!_0x1253fe){return this[_0x735c('0x17')](this[_0x735c('0x13')][_0x735c('0x6c')]);}};VoiceQueueReport[_0x735c('0x36')][_0x735c('0x18')]=function(_0x374ea0){var _0x3598c2=this[_0x735c('0x13')]['id'];if(this[_0x735c('0x13')][_0x735c('0x61')][_0x3598c2]&&this['summary'][_0x735c('0x61')][_0x3598c2][_0x374ea0['actionid']]){this[_0x735c('0x13')]['queuestatus'][_0x3598c2][_0x374ea0['actionid']][_0x735c('0xe')]['push'](_0x374ea0);}};VoiceQueueReport['prototype'][_0x735c('0x14')]=function(_0x314194){var _0x1f4880=this;try{if(this[_0x735c('0x6d')](_0x314194)&&this['isNotNull'](_0x314194[_0x735c('0x4d')])){logger[_0x735c('0x50')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x735c('0x3f')](_0x314194,{'showHidden':![],'depth':null}));var _0x178f87=this[_0x735c('0x11')][_0x314194['queue']];if(_0x178f87){logger['debug'](_0x735c('0x6e'),_0x178f87[_0x735c('0x58')]);this[_0x735c('0x13')][_0x735c('0x5b')][_0x178f87['name']]={'summaryEvent':_0x314194};this[_0x735c('0x13')][_0x735c('0x6b')]+=0x1;return ami[_0x735c('0x3a')]({'action':_0x735c('0x61'),'queue':_0x178f87['name']})[_0x735c('0x6f')](function(_0x165261){if(!_0x1f4880[_0x735c('0x13')][_0x735c('0x61')][_0x314194[_0x735c('0x60')]]){_0x1f4880['summary'][_0x735c('0x61')][_0x314194[_0x735c('0x60')]]={};}_0x1f4880['summary'][_0x735c('0x61')][_0x314194[_0x735c('0x60')]][_0x165261[_0x735c('0x60')]]={'queue':_0x178f87[_0x735c('0x58')],'agents':[]};})[_0x735c('0x5c')](function(_0x23c9c1){throw _0x23c9c1;});}}}catch(_0x3e9038){logger[_0x735c('0x3e')](_0x735c('0x70'),util[_0x735c('0x3f')](_0x3e9038,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x735c('0x17')]=function(_0x542a57){if(this[_0x735c('0x13')][_0x735c('0x6b')]>0x0){this[_0x735c('0x13')][_0x735c('0x6c')]=_0x542a57;return;}logger[_0x735c('0x50')](_0x735c('0x71'),util[_0x735c('0x3f')](_0x542a57,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami['emit']('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x735c('0x36')][_0x735c('0x1b')]=function(_0x44e5d0){try{if(this[_0x735c('0x6d')](_0x44e5d0)){logger[_0x735c('0x50')]('[%s][voiceQueueReport][queuecallerjoin]',_0x44e5d0[_0x735c('0x4a')],util[_0x735c('0x3f')](_0x44e5d0,{'showHidden':![],'depth':null}));if(_[_0x735c('0x72')](this[_0x735c('0xc')][_0x44e5d0['uniqueid']])){this[_0x735c('0xc')][_0x44e5d0[_0x735c('0x4a')]]=[];}if(_[_0x735c('0x72')](this['channels'][_0x44e5d0['uniqueid']])){this[_0x735c('0xf')][_0x44e5d0['uniqueid']]={};}var _0x119c8a=new QueueReport();_0x119c8a[_0x735c('0x4d')]=_0x44e5d0[_0x735c('0x4d')];_0x119c8a[_0x735c('0x69')]=this[_0x735c('0x11')][_0x119c8a[_0x735c('0x4d')]]&&this[_0x735c('0x11')][_0x119c8a[_0x735c('0x4d')]][_0x735c('0x69')]?this['voiceQueues'][_0x119c8a[_0x735c('0x4d')]]['type']||_0x735c('0x56'):_0x735c('0x56');_0x119c8a['queuecallerjoinAt']=moment()['format'](_0x735c('0x73'));_0x119c8a['position']=_0x44e5d0[_0x735c('0x74')];_0x119c8a[_0x735c('0x75')]=_0x44e5d0[_0x735c('0x75')];_0x119c8a[_0x735c('0x4a')]=_0x44e5d0[_0x735c('0x4a')];logger[_0x735c('0x76')](_0x735c('0x77'),_0x119c8a[_0x735c('0x4d')],_0x119c8a[_0x735c('0x69')]);Object[_0x735c('0x67')](_0x119c8a,_[_0x735c('0x78')](_0x44e5d0,_[_0x735c('0x79')](_0x119c8a)));this['queueReports'][_0x44e5d0[_0x735c('0x4a')]][_0x735c('0x7a')](_0x119c8a);this[_0x735c('0xf')][_0x44e5d0['uniqueid']]=_0x119c8a;this['emitVoiceQueueChannelSave'](_0x119c8a,'queuecallerjoin');}}catch(_0x2246b6){logger[_0x735c('0x3e')](_0x735c('0x7b'),_0x44e5d0[_0x735c('0x4a')],util[_0x735c('0x3f')](_0x2246b6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x735c('0x36')][_0x735c('0x1d')]=function(_0x3525fa){try{if(this[_0x735c('0x6d')](_0x3525fa)){logger[_0x735c('0x50')]('[%s][voiceQueueReport][queuecallerabandon]',_0x3525fa['uniqueid'],util['inspect'](_0x3525fa,{'showHidden':![],'depth':null}));if(this[_0x735c('0xc')][_0x3525fa[_0x735c('0x4a')]]){var _0x2338a1=_['last'](this[_0x735c('0xc')][_0x3525fa[_0x735c('0x4a')]]);_0x2338a1[_0x735c('0x7c')]=![];_0x2338a1['queuecallercompleteAt']=null;_0x2338a1[_0x735c('0x7d')]=_0x3525fa[_0x735c('0x7d')];_0x2338a1[_0x735c('0x7e')]=_0x3525fa[_0x735c('0x7e')];_0x2338a1[_0x735c('0x1c')]=!![];_0x2338a1['queuecallerabandonAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2338a1[_0x735c('0x53')]=_0x735c('0x7f');_0x2338a1[_0x735c('0x80')]=null;logger[_0x735c('0x76')](_0x735c('0x81'),_0x2338a1[_0x735c('0x4d')],_0x2338a1[_0x735c('0x69')]);this['channels'][_0x3525fa['uniqueid']]=_0x2338a1;this['emitVoiceQueueChannelRemove'](_0x2338a1,_0x735c('0x1c'));}}}catch(_0x3ead4a){logger[_0x735c('0x3e')](_0x735c('0x82'),_0x3525fa[_0x735c('0x4a')],util[_0x735c('0x3f')](_0x3ead4a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x735c('0x36')][_0x735c('0x1e')]=function(_0x1cfd30){try{if(this[_0x735c('0x6d')](_0x1cfd30)){logger[_0x735c('0x50')]('[%s][voiceQueueReport][queuecallerleave]',_0x1cfd30[_0x735c('0x4a')],util['inspect'](_0x1cfd30,{'showHidden':![],'depth':null}));if(this[_0x735c('0xc')][_0x1cfd30[_0x735c('0x4a')]]){var _0x4adde8=_[_0x735c('0x83')](this['queueReports'][_0x1cfd30[_0x735c('0x4a')]]);_0x4adde8[_0x735c('0x84')]=moment()[_0x735c('0x4b')](_0x735c('0x73'));_0x4adde8[_0x735c('0x85')]=_0x1cfd30[_0x735c('0x85')];_0x4adde8[_0x735c('0x86')]=_0x1cfd30[_0x735c('0x86')];logger['info'](_0x735c('0x87'),_0x4adde8[_0x735c('0x4d')],_0x4adde8[_0x735c('0x69')],_0x1cfd30['connectedlinenum'],_0x1cfd30[_0x735c('0x86')]);this['channels'][_0x1cfd30[_0x735c('0x4a')]]=_0x4adde8;this[_0x735c('0x48')](_0x4adde8,_0x735c('0x88'));}}}catch(_0x205ebc){logger[_0x735c('0x3e')]('[%s][voiceQueueReport][queuecallerleave]',_0x1cfd30[_0x735c('0x4a')],util[_0x735c('0x3f')](_0x205ebc,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x735c('0x21')]=function(_0x433560){try{if(this[_0x735c('0x6d')](_0x433560)){logger[_0x735c('0x50')](_0x735c('0x89'),_0x433560[_0x735c('0x4a')],util['inspect'](_0x433560,{'showHidden':![],'depth':null}));if(this[_0x735c('0xc')][_0x433560['uniqueid']]){var _0x315ee5=_[_0x735c('0x83')](this['queueReports'][_0x433560['uniqueid']]);_0x315ee5[_0x735c('0x7c')]=!![];_0x315ee5['queuecallerexitreason']='COMPLETEDBYAGENT';logger['info'](_0x735c('0x8a'),_0x315ee5[_0x735c('0x4d')],_0x315ee5[_0x735c('0x69')]);}}}catch(_0x392525){logger['error'](_0x735c('0x89'),_0x433560['uniqueid'],util['inspect'](_0x392525,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x735c('0x36')][_0x735c('0x20')]=function(_0x653109){try{if(this[_0x735c('0x6d')](_0x653109)){logger[_0x735c('0x50')](_0x735c('0x8b'),_0x653109[_0x735c('0x4a')],util[_0x735c('0x3f')](_0x653109,{'showHidden':![],'depth':null}));if(this[_0x735c('0xc')][_0x653109['uniqueid']]){var _0x4936a1=_['last'](this[_0x735c('0xc')][_0x653109[_0x735c('0x4a')]]);_0x4936a1[_0x735c('0x1c')]=![];_0x4936a1[_0x735c('0x8c')]=null;_0x4936a1[_0x735c('0x8d')]=!![];_0x4936a1[_0x735c('0x80')]=_0x653109[_0x735c('0x8e')];_0x4936a1['holdtime']=_0x653109[_0x735c('0x7d')];_0x4936a1[_0x735c('0x7c')]=!![];_0x4936a1['queuecallerexit']=![];_0x4936a1[_0x735c('0x8f')]=null;if(!_0x4936a1[_0x735c('0x90')]){if(_0x653109[_0x735c('0x91')]==_0x735c('0x90')){_0x4936a1[_0x735c('0x53')]=_0x735c('0x92');logger[_0x735c('0x76')](_0x735c('0x93'),_0x4936a1[_0x735c('0x4d')],_0x4936a1[_0x735c('0x69')]);}else{if(_[_0x735c('0x94')](_0x653109[_0x735c('0x95')][_0x735c('0x96')](),_0x735c('0x97'))){if(this[_0x735c('0xc')][_0x653109[_0x735c('0x98')]]){var _0x57453b=_[_0x735c('0x83')](this['queueReports'][_0x653109[_0x735c('0x98')]]);_0x57453b[_0x735c('0x7c')]=![];_0x57453b[_0x735c('0x35')]=!![];_0x57453b[_0x735c('0x8f')]=moment(_0x4936a1[_0x735c('0x99')])['add'](_0x653109[_0x735c('0x7d')],'seconds')['format'](_0x735c('0x73'));_0x57453b[_0x735c('0x53')]=_0x735c('0x9a');_0x57453b[_0x735c('0x90')]=!![];_0x57453b['transfertype']='FORWARD';_0x57453b[_0x735c('0x9b')]=_0x653109[_0x735c('0x9c')];_0x57453b[_0x735c('0x9d')]=_0x653109[_0x735c('0x4a')];logger[_0x735c('0x76')](_0x735c('0x9e'),_0x57453b[_0x735c('0x4d')],_0x57453b[_0x735c('0x69')]);var _0xc62ecb=this[_0x735c('0xc')][_0x653109[_0x735c('0x98')]];this[_0x735c('0xc')][_0x653109[_0x735c('0x98')]]=this[_0x735c('0xc')][_0x653109['uniqueid']];this[_0x735c('0xc')][_0x653109[_0x735c('0x4a')]]=_0xc62ecb;}}else{_0x4936a1['queuecallerexitreason']=_0x735c('0x9f')+_0x653109[_0x735c('0x91')][_0x735c('0xa0')]();logger[_0x735c('0x76')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x4936a1[_0x735c('0x4d')],_0x4936a1['type'],_0x4936a1[_0x735c('0x53')]);}}}this[_0x735c('0xf')][_0x653109[_0x735c('0x4a')]]=_0x4936a1;}}}catch(_0x2cfdbf){logger['error'](_0x735c('0x8b'),_0x653109[_0x735c('0x4a')],util[_0x735c('0x3f')](_0x2cfdbf,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x735c('0x36')][_0x735c('0x23')]=function(_0x726997){try{if(this['isNotNull'](_0x726997)){logger[_0x735c('0x50')](_0x735c('0xa1'),_0x726997[_0x735c('0x4a')],util['inspect'](_0x726997,{'showHidden':![],'depth':null}));this[_0x735c('0xa2')](_0x726997['uniqueid'],_['keys'](_0x726997[_0x735c('0xa3')])[0x0],_0x726997['value']);if(this[_0x735c('0xc')][_0x726997[_0x735c('0x4a')]]){var _0x2be67b=_[_0x735c('0x83')](this[_0x735c('0xc')][_0x726997['uniqueid']]);if(_0x2be67b){if(this[_0x735c('0x6d')](_0x726997[_0x735c('0xa3')])&&this[_0x735c('0x6d')](_0x726997['variable']['queuestatus'])){switch(_0x726997['value']){case _0x735c('0xa4'):_0x2be67b[_0x735c('0x35')]=![];_0x2be67b['queuecallerexitAt']=null;break;case'TIMEOUT':_0x2be67b[_0x735c('0xa5')]=_0x735c('0xa6');_0x2be67b[_0x735c('0x35')]=!![];_0x2be67b[_0x735c('0x8f')]=moment()[_0x735c('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x2be67b['queuecallerleaveAt']=moment()[_0x735c('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0x735c('0xa7'),_0x726997[_0x735c('0x4a')],util[_0x735c('0x3f')](_0x2be67b,{'showHidden':![],'depth':null}));ami[_0x735c('0x47')]('custom:timeout',_0x2be67b);break;default:_0x2be67b[_0x735c('0x35')]=!![];_0x2be67b[_0x735c('0x8f')]=moment()[_0x735c('0x4b')](_0x735c('0x73'));_0x2be67b[_0x735c('0x84')]=moment()[_0x735c('0x4b')](_0x735c('0x73'));}_0x2be67b['queuecallerabandon']=![];_0x2be67b[_0x735c('0x8c')]=null;_0x2be67b[_0x735c('0x53')]=_0x726997[_0x735c('0xa8')];this[_0x735c('0xf')][_0x726997[_0x735c('0x4a')]]=_0x2be67b;this[_0x735c('0x45')](_0x2be67b,_0x735c('0x22'));}else if(this[_0x735c('0x6d')](_0x726997[_0x735c('0xa3')])&&this[_0x735c('0x6d')](_0x726997[_0x735c('0xa3')]['queueposition'])){if(!_0x2be67b[_0x735c('0x1c')]){_0x2be67b[_0x735c('0x35')]=!![];_0x2be67b['queuecallerexitAt']=moment()['format'](_0x735c('0x73'));_0x2be67b['queuecallerexitreason']=_0x735c('0xa9');_0x2be67b[_0x735c('0x84')]=moment()[_0x735c('0x4b')](_0x735c('0x73'));this[_0x735c('0xf')][_0x726997[_0x735c('0x4a')]]=_0x2be67b;}}logger[_0x735c('0x76')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x726997[_0x735c('0x4a')],_0x2be67b[_0x735c('0x4d')],_0x2be67b[_0x735c('0x69')],_[_0x735c('0x79')](_0x726997['variable'])[0x0],_0x726997['value']);_0x2be67b['variables']=this[_0x735c('0x41')][_0x726997[_0x735c('0x4a')]];}}}}catch(_0x3adaa9){logger[_0x735c('0x3e')]('[%s][voiceQueueReport][varset]',_0x726997[_0x735c('0x4a')],util[_0x735c('0x3f')](_0x3adaa9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x735c('0x36')]['addVariable']=function(_0x5a7540,_0x186801,_0x2671d9){var _0x203fe5=[_0x735c('0xaa'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x735c('0xab'),'rtpaudioqosloss',_0x735c('0xac'),_0x735c('0xad'),_0x735c('0xae'),_0x735c('0xaf'),_0x735c('0xb0'),_0x735c('0xb1'),_0x735c('0xb2'),_0x735c('0xb3'),_0x735c('0xb4'),_0x735c('0xb5'),_0x735c('0xb6'),_0x735c('0x8e'),'memberpenalty','memberrealtime'];if(!_[_0x735c('0x39')](_0x186801)&&!_['includes'](_0x203fe5,_0x186801)){if(_[_0x735c('0x72')](this[_0x735c('0x41')][_0x5a7540])){this['variables'][_0x5a7540]={};}this[_0x735c('0x41')][_0x5a7540][_0x186801]=_0x2671d9;}};VoiceQueueReport['prototype'][_0x735c('0xb7')]=function(_0xda04d9,_0x1da38a,_0x3b57d7){try{var _0x2534ef={};if(this[_0x735c('0xc')][_0xda04d9]){for(var _0x21fc6b=0x0;_0x21fc6b{delete this['channels'][_0x3df373];},_0x486fd8);}};module[_0x735c('0xee')]=VoiceQueueReport; \ No newline at end of file +var _0xb184=['queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','waiting','queueStatusComplete','queuecallerexit','queuecallercomplete','clearZombieChannels','switch','isNil','Action','status','channel','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','queueReports','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','uniqueid','voice:queue:%s','voice_queue_channel:save','voice_queue_presence:save','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','format','queue','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','isUndefined','queues','catch','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','createReport','realtime','handleInboundQueueSummaryReport','compareToInboundQueue','assign','syncQueueStatusComplete','inbound','outbound','statusRequests','completeEvent','push','isNotNull','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','queuecallerjoin','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','[%s][voiceQueueReport][queuecallerabandon]','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','syncAgentComplete','[%s][voiceQueueReport][agentcomplete]','assigned','transfer','reason','COMPLETED','startsWith','toLowerCase','local/','linkedid','queuecallerjoinAt','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','variable','value','CONTINUE','queuecallerexitAt','TIMEOUT','lastevent','timeout','queuecallerleaveAt','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','includes','handleHangup','length','sumHoldTime','diff','sumDuration','total','answered','sumBillable','milliseconds','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][hangup]','cause','cause-txt','transferid','deleteChannelAfterTimeout','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferuniqueid','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','secondtransfererexten','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','mohtime','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','applicationdata','appdata','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','agents','channels','queueChannels','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','syncQueueCallerJoin'];(function(_0x139d5a,_0x23eb36){var _0x91b879=function(_0x21e7cf){while(--_0x21e7cf){_0x139d5a['push'](_0x139d5a['shift']());}};_0x91b879(++_0x23eb36);}(_0xb184,0x1c6));var _0x4b18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb184[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4b18('0x0'));var moment=require(_0x4b18('0x1'));var util=require(_0x4b18('0x2'));var Redis=require(_0x4b18('0x3'));var config=require('../../../config/environment');var logger=require(_0x4b18('0x4'))(_0x4b18('0x5'));var ami=require(_0x4b18('0x6'));var QueueReport=require(_0x4b18('0x7'));var VoiceQueueSummary=require(_0x4b18('0x8'));config[_0x4b18('0x9')]=_[_0x4b18('0xa')](config['redis'],{'host':_0x4b18('0xb'),'port':0x18eb});var io=require(_0x4b18('0xc'))(new Redis(config[_0x4b18('0x9')]));var Sequence=function(){};Sequence[_0x4b18('0xd')][_0x4b18('0xe')]=function(_0x5cd1bd){this['tail']=this[_0x4b18('0xf')]?this[_0x4b18('0xf')][_0x4b18('0x10')](_0x5cd1bd):_0x5cd1bd();};function VoiceQueueReport(_0x5c2282){this[_0x4b18('0x11')]=new Sequence();this['queueReports']={};this['realtime']=_0x5c2282;this[_0x4b18('0x12')]=_0x5c2282[_0x4b18('0x12')];this[_0x4b18('0x13')]=_0x5c2282[_0x4b18('0x14')];this[_0x4b18('0x15')]=_0x5c2282[_0x4b18('0x15')];this[_0x4b18('0x16')]=_0x5c2282[_0x4b18('0x16')];this[_0x4b18('0x17')]=initializeSummary();this[_0x4b18('0x18')]={};ami['on'](_0x4b18('0x19'),this[_0x4b18('0x1a')][_0x4b18('0x1b')](this));ami['on'](_0x4b18('0x1c'),this[_0x4b18('0x1d')][_0x4b18('0x1b')](this));ami['on'](_0x4b18('0x1e'),this[_0x4b18('0x1f')][_0x4b18('0x1b')](this));ami['on'](_0x4b18('0x20'),this['syncQueueStatusComplete'][_0x4b18('0x1b')](this));ami['on']('queuecallerjoin',this[_0x4b18('0x21')][_0x4b18('0x1b')](this));ami['on'](_0x4b18('0x22'),this[_0x4b18('0x23')][_0x4b18('0x1b')](this));ami['on'](_0x4b18('0x24'),this[_0x4b18('0x25')][_0x4b18('0x1b')](this));ami['on'](_0x4b18('0x26'),this['syncAgentComplete'][_0x4b18('0x1b')](this));ami['on']('agentconnect',this[_0x4b18('0x27')][_0x4b18('0x1b')](this));ami['on'](_0x4b18('0x28'),this[_0x4b18('0x29')]['bind'](this));ami['on'](_0x4b18('0x2a'),this[_0x4b18('0x2b')][_0x4b18('0x1b')](this));ami['on'](_0x4b18('0x2c'),this[_0x4b18('0x2d')][_0x4b18('0x1b')](this));ami['on']('musiconholdstart',this[_0x4b18('0x2e')][_0x4b18('0x1b')](this));ami['on'](_0x4b18('0x2f'),this[_0x4b18('0x30')][_0x4b18('0x1b')](this));ami['on'](_0x4b18('0x31'),this[_0x4b18('0x32')][_0x4b18('0x1b')](this));ami['on'](_0x4b18('0x33'),this[_0x4b18('0x34')][_0x4b18('0x1b')](this));this[_0x4b18('0x35')]();this[_0x4b18('0x36')]();}function clearChannels(_0x30be3a){if(!_[_0x4b18('0x37')](_0x30be3a)){for(var _0x2b715a in _0x30be3a){if(_0x30be3a[_0x4b18('0x38')](_0x2b715a)){delete _0x30be3a[_0x2b715a];}}}}function clearCampaigns(_0x1d4a22){if(!_[_0x4b18('0x37')](_0x1d4a22)){for(var _0x29bb3c in _0x1d4a22){if(_0x1d4a22[_0x4b18('0x38')](_0x29bb3c)){_0x1d4a22[_0x29bb3c][_0x4b18('0x39')]=0x0;}}}}function clearVoiceQueues(_0xaefabd){if(!_[_0x4b18('0x37')](_0xaefabd)){for(var _0x1e2e08 in _0xaefabd){if(_0xaefabd[_0x4b18('0x38')](_0x1e2e08)){_0xaefabd[_0x1e2e08][_0x4b18('0x39')]=0x0;_0xaefabd[_0x1e2e08]['talking']=0x0;_0xaefabd[_0x1e2e08][_0x4b18('0x3a')]=0x0;_0xaefabd[_0x1e2e08][_0x4b18('0x3b')]=0x0;_0xaefabd[_0x1e2e08][_0x4b18('0x3c')]=!![];}}}}function clearAgentBooked(_0x10ceba){if(!_[_0x4b18('0x37')](_0x10ceba)){for(var _0x2511d7 in _0x10ceba){if(_0x10ceba[_0x4b18('0x38')](_0x2511d7)){_0x10ceba[_0x2511d7]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x654ed0){return _0x654ed0[_0x4b18('0x3d')]||_0x654ed0[_0x4b18('0x22')]||_0x654ed0[_0x4b18('0x3e')];}VoiceQueueReport[_0x4b18('0xd')][_0x4b18('0x3f')]=function(){var _0x4fc344=this;for(var _0x3cd856 in this[_0x4b18('0x13')]){if(this[_0x4b18('0x13')][_0x4b18('0x38')](_0x3cd856)&&!this[_0x4b18('0x13')][_0x3cd856][_0x4b18('0x40')]){this[_0x4b18('0x11')][_0x4b18('0xe')](function(){if(!_[_0x4b18('0x41')](_0x4fc344[_0x4b18('0x13')][_0x3cd856])){return ami[_0x4b18('0x42')]({'action':_0x4b18('0x43'),'channel':_0x4fc344[_0x4b18('0x13')][_0x3cd856][_0x4b18('0x44')]})['catch'](function(_0x277869){if(_0x277869['message']===_0x4b18('0x45')){setTimeout(function(){if(_0x4fc344[_0x4b18('0x13')][_0x3cd856]){delete _0x4fc344[_0x4b18('0x13')][_0x3cd856];logger[_0x4b18('0x46')](_0x4b18('0x47'),_0x3cd856,util[_0x4b18('0x48')](_0x277869,{'showHidden':![],'depth':null}));}if(_0x4fc344[_0x4b18('0x49')][_0x3cd856]){delete _0x4fc344[_0x4b18('0x49')][_0x3cd856];logger[_0x4b18('0x46')](_0x4b18('0x4a'),_0x3cd856,util['inspect'](_0x277869,{'showHidden':![],'depth':null}));}if(_0x4fc344['variables'][_0x3cd856]){delete _0x4fc344[_0x4b18('0x18')][_0x3cd856];logger[_0x4b18('0x46')](_0x4b18('0x4b'),_0x3cd856,util['inspect'](_0x277869,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x4b18('0xd')][_0x4b18('0x2d')]=function(){logger[_0x4b18('0x46')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this['channels']);this['clearQueueReport'](this[_0x4b18('0x49')]);clearAgentBooked(this[_0x4b18('0x12')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this['campaigns']);this[_0x4b18('0x17')]=initializeSummary();};VoiceQueueReport[_0x4b18('0xd')]['clearQueueReport']=function(_0xe0c611){var _0x1a7c03=this;if(!_[_0x4b18('0x37')](_0xe0c611)){for(var _0x5e7926 in _0xe0c611){if(_0xe0c611['hasOwnProperty'](_0x5e7926)){_0x1a7c03[_0x4b18('0x4c')](_0xe0c611[_0x5e7926],_0x4b18('0x4d'));delete _0xe0c611[_0x5e7926];}}}};VoiceQueueReport[_0x4b18('0xd')][_0x4b18('0x4e')]=function(_0x190df1,_0x1ca36a,_0x44e891){io['to'](_0x190df1)[_0x4b18('0x4e')](_0x1ca36a,_0x44e891);};VoiceQueueReport['prototype'][_0x4b18('0x4f')]=function(_0x1c2800,_0x11154a){logger[_0x4b18('0x50')]('[%s][voiceQueueReport]['+_0x11154a+']\x20sending\x20voice_queue_channel:save\x20event:',_0x1c2800[_0x4b18('0x51')],util[_0x4b18('0x48')](_0x1c2800,{'showHidden':![],'depth':null}));this[_0x4b18('0x4e')](util['format'](_0x4b18('0x52'),_0x1c2800['queue']),_0x4b18('0x53'),_0x1c2800);io[_0x4b18('0x4e')](_0x4b18('0x54'),_0x1c2800);};VoiceQueueReport['prototype'][_0x4b18('0x4c')]=function(_0x2338ce,_0x57ec3c){logger[_0x4b18('0x50')](_0x4b18('0x55')+_0x57ec3c+_0x4b18('0x56'),_0x2338ce[_0x4b18('0x51')],util[_0x4b18('0x48')](_0x2338ce,{'showHidden':![],'depth':null}));if(_0x2338ce[_0x4b18('0x57')]===_0x4b18('0x58')){return;}this['emit'](util[_0x4b18('0x59')]('voice:queue:%s',_0x2338ce[_0x4b18('0x5a')]),_0x4b18('0x5b'),_0x2338ce);io['emit'](_0x4b18('0x5c'),_0x2338ce);};VoiceQueueReport[_0x4b18('0xd')][_0x4b18('0x5d')]=function(_0x3b970b){if(_0x3b970b[_0x4b18('0x5e')]==='inbound'){logger['debug'](_0x4b18('0x5f'),util[_0x4b18('0x48')](_0x3b970b,{'showHidden':![],'depth':null}));this[_0x4b18('0x4e')](util[_0x4b18('0x59')](_0x4b18('0x52'),_0x3b970b[_0x4b18('0x60')]),'voice_queue:save',_0x3b970b);}};VoiceQueueReport[_0x4b18('0xd')]['isNotNull']=function(_0x2de8f){return _0x2de8f!==null&&!_[_0x4b18('0x61')](_0x2de8f);};VoiceQueueReport['prototype']['loopQueueShow']=function(){var _0x264ecc=this;setInterval(function(){_0x264ecc[_0x4b18('0x3f')]();ami[_0x4b18('0x42')]({'action':_0x4b18('0x62')})[_0x4b18('0x63')](function(_0x256a0a){logger[_0x4b18('0x46')]('[voiceQueueReport][queues]',util[_0x4b18('0x48')](_0x256a0a,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x4b18('0xd')][_0x4b18('0x35')]=function(){var _0x37479a=this;setInterval(function(){if(!_0x37479a[_0x4b18('0x17')]['isRunning']){return ami[_0x4b18('0x42')]({'action':_0x4b18('0x19')})[_0x4b18('0x64')](function(_0x25b102){_0x37479a[_0x4b18('0x17')]['id']=_0x25b102[_0x4b18('0x65')];_0x37479a[_0x4b18('0x17')]['isRunning']=!![];_0x37479a[_0x4b18('0x17')][_0x4b18('0x66')][_0x25b102[_0x4b18('0x65')]]={};})[_0x4b18('0x63')](function(_0x574b95){logger['error'](_0x4b18('0x67'),util[_0x4b18('0x48')](_0x574b95,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x4b18('0x68')]=function(_0xe4f02a,_0x61ca66){var _0x25dd50;if(this['summary']&&this[_0x4b18('0x17')][_0x4b18('0x62')]&&this[_0x4b18('0x17')][_0x4b18('0x62')][_0xe4f02a[_0x4b18('0x60')]]){_0x25dd50=this['summary']['queues'][_0xe4f02a[_0x4b18('0x60')]][_0x4b18('0x69')];}var _0x60120=new VoiceQueueSummary(_0xe4f02a);return _0x60120[_0x4b18('0x6a')](_0x61ca66[_0x4b18('0x12')],this[_0x4b18('0x12')],_0x25dd50,this[_0x4b18('0x6b')][_0x4b18('0x13')]);};VoiceQueueReport[_0x4b18('0xd')][_0x4b18('0x6c')]=function(_0x3a4848,_0x212dce){var _0xe55538=this[_0x4b18('0x68')](_0x3a4848,_0x212dce);var _0x11d7a2=![];_0x11d7a2=_0xe55538[_0x4b18('0x6d')](_0x3a4848);if(_0x11d7a2){Object[_0x4b18('0x6e')](_0x3a4848,_0xe55538);this['realtime'][_0x4b18('0x15')][_0x3a4848[_0x4b18('0x60')]]=_0x3a4848;this[_0x4b18('0x5d')](_0xe55538);}};VoiceQueueReport[_0x4b18('0xd')][_0x4b18('0x6f')]=function(_0x2b4de8){var _0x489873=null;var _0x3d005c=this[_0x4b18('0x17')]['id'];if(this[_0x4b18('0x17')]['queuestatus'][_0x3d005c]){_0x489873=this[_0x4b18('0x17')][_0x4b18('0x66')][_0x3d005c][_0x2b4de8[_0x4b18('0x65')]];}if(!_0x489873){this[_0x4b18('0x17')]=initializeSummary();return;}var _0x9d34f8=this['voiceQueues'][_0x489873[_0x4b18('0x5a')]];if(_0x9d34f8['type']===_0x4b18('0x70')){this[_0x4b18('0x6c')](_0x9d34f8,_0x489873);}else if(_0x9d34f8[_0x4b18('0x5e')]===_0x4b18('0x71')){var _0x52d1af=this[_0x4b18('0x68')](_0x9d34f8,_0x489873);ami['emit']('custom:queuesummary',_0x52d1af);}this[_0x4b18('0x17')][_0x4b18('0x72')]-=0x1;var _0x16507a=this['summary'][_0x4b18('0x72')]>0x0?!![]:![];if(!_0x16507a){return this[_0x4b18('0x1d')](this[_0x4b18('0x17')][_0x4b18('0x73')]);}};VoiceQueueReport[_0x4b18('0xd')][_0x4b18('0x1f')]=function(_0x597141){var _0x2141b9=this[_0x4b18('0x17')]['id'];if(this[_0x4b18('0x17')][_0x4b18('0x66')][_0x2141b9]&&this['summary']['queuestatus'][_0x2141b9][_0x597141[_0x4b18('0x65')]]){this['summary']['queuestatus'][_0x2141b9][_0x597141[_0x4b18('0x65')]][_0x4b18('0x12')][_0x4b18('0x74')](_0x597141);}};VoiceQueueReport['prototype']['syncQueueSummary']=function(_0x37633e){var _0x520ad2=this;try{if(this['isNotNull'](_0x37633e)&&this[_0x4b18('0x75')](_0x37633e[_0x4b18('0x5a')])){logger[_0x4b18('0x50')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x37633e,{'showHidden':![],'depth':null}));var _0x4bddda=this[_0x4b18('0x15')][_0x37633e[_0x4b18('0x5a')]];if(_0x4bddda){logger[_0x4b18('0x50')](_0x4b18('0x76'),_0x4bddda[_0x4b18('0x60')]);this[_0x4b18('0x17')]['queues'][_0x4bddda[_0x4b18('0x60')]]={'summaryEvent':_0x37633e};this[_0x4b18('0x17')]['statusRequests']+=0x1;return ami['Action']({'action':_0x4b18('0x66'),'queue':_0x4bddda['name']})['then'](function(_0x5c1bac){if(!_0x520ad2[_0x4b18('0x17')][_0x4b18('0x66')][_0x37633e[_0x4b18('0x65')]]){_0x520ad2[_0x4b18('0x17')][_0x4b18('0x66')][_0x37633e[_0x4b18('0x65')]]={};}_0x520ad2[_0x4b18('0x17')][_0x4b18('0x66')][_0x37633e[_0x4b18('0x65')]][_0x5c1bac['actionid']]={'queue':_0x4bddda[_0x4b18('0x60')],'agents':[]};})[_0x4b18('0x63')](function(_0x4f0307){throw _0x4f0307;});}}}catch(_0x14dbf8){logger['error']('[voiceQueueReport][queuesummary]',util[_0x4b18('0x48')](_0x14dbf8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4b18('0xd')][_0x4b18('0x1d')]=function(_0x269db9){if(this[_0x4b18('0x17')][_0x4b18('0x72')]>0x0){this[_0x4b18('0x17')][_0x4b18('0x73')]=_0x269db9;return;}logger[_0x4b18('0x50')](_0x4b18('0x77'),util[_0x4b18('0x48')](_0x269db9,{'showHidden':![],'depth':null}));this[_0x4b18('0x17')]=initializeSummary();ami[_0x4b18('0x4e')](_0x4b18('0x78'),{});};VoiceQueueReport[_0x4b18('0xd')][_0x4b18('0x21')]=function(_0x5c00de){try{if(this[_0x4b18('0x75')](_0x5c00de)){logger[_0x4b18('0x50')](_0x4b18('0x79'),_0x5c00de['uniqueid'],util[_0x4b18('0x48')](_0x5c00de,{'showHidden':![],'depth':null}));if(_[_0x4b18('0x61')](this[_0x4b18('0x49')][_0x5c00de[_0x4b18('0x51')]])){this[_0x4b18('0x49')][_0x5c00de['uniqueid']]=[];}if(_[_0x4b18('0x61')](this['channels'][_0x5c00de[_0x4b18('0x51')]])){this[_0x4b18('0x13')][_0x5c00de[_0x4b18('0x51')]]={};}var _0x407e62=new QueueReport();_0x407e62[_0x4b18('0x5a')]=_0x5c00de[_0x4b18('0x5a')];_0x407e62['type']=this[_0x4b18('0x15')][_0x407e62[_0x4b18('0x5a')]]&&this[_0x4b18('0x15')][_0x407e62[_0x4b18('0x5a')]]['type']?this['voiceQueues'][_0x407e62[_0x4b18('0x5a')]]['type']||_0x4b18('0x70'):_0x4b18('0x70');_0x407e62['queuecallerjoinAt']=moment()['format'](_0x4b18('0x7a'));_0x407e62[_0x4b18('0x7b')]=_0x5c00de[_0x4b18('0x7b')];_0x407e62[_0x4b18('0x7c')]=_0x5c00de[_0x4b18('0x7c')];_0x407e62['uniqueid']=_0x5c00de[_0x4b18('0x51')];logger[_0x4b18('0x7d')](_0x4b18('0x7e'),_0x407e62[_0x4b18('0x5a')],_0x407e62['type']);Object[_0x4b18('0x6e')](_0x407e62,_[_0x4b18('0x7f')](_0x5c00de,_[_0x4b18('0x80')](_0x407e62)));this[_0x4b18('0x49')][_0x5c00de[_0x4b18('0x51')]][_0x4b18('0x74')](_0x407e62);this[_0x4b18('0x13')][_0x5c00de[_0x4b18('0x51')]]=_0x407e62;this[_0x4b18('0x4f')](_0x407e62,_0x4b18('0x81'));}}catch(_0x1a4616){logger['error'](_0x4b18('0x79'),_0x5c00de['uniqueid'],util[_0x4b18('0x48')](_0x1a4616,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4b18('0xd')][_0x4b18('0x23')]=function(_0x46ff0e){try{if(this[_0x4b18('0x75')](_0x46ff0e)){logger[_0x4b18('0x50')]('[%s][voiceQueueReport][queuecallerabandon]',_0x46ff0e[_0x4b18('0x51')],util[_0x4b18('0x48')](_0x46ff0e,{'showHidden':![],'depth':null}));if(this[_0x4b18('0x49')][_0x46ff0e[_0x4b18('0x51')]]){var _0x4ba73b=_[_0x4b18('0x82')](this[_0x4b18('0x49')][_0x46ff0e[_0x4b18('0x51')]]);_0x4ba73b[_0x4b18('0x3e')]=![];_0x4ba73b[_0x4b18('0x83')]=null;_0x4ba73b[_0x4b18('0x84')]=_0x46ff0e[_0x4b18('0x84')];_0x4ba73b['originalposition']=_0x46ff0e[_0x4b18('0x85')];_0x4ba73b[_0x4b18('0x22')]=!![];_0x4ba73b[_0x4b18('0x86')]=moment()[_0x4b18('0x59')](_0x4b18('0x7a'));_0x4ba73b[_0x4b18('0x57')]=_0x4b18('0x87');_0x4ba73b[_0x4b18('0x88')]=null;logger[_0x4b18('0x7d')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x4ba73b['queue'],_0x4ba73b['type']);this[_0x4b18('0x13')][_0x46ff0e[_0x4b18('0x51')]]=_0x4ba73b;this[_0x4b18('0x4c')](_0x4ba73b,_0x4b18('0x22'));}}}catch(_0x17fabb){logger['error'](_0x4b18('0x89'),_0x46ff0e[_0x4b18('0x51')],util['inspect'](_0x17fabb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4b18('0xd')][_0x4b18('0x25')]=function(_0x40f6d9){try{if(this['isNotNull'](_0x40f6d9)){logger[_0x4b18('0x50')](_0x4b18('0x8a'),_0x40f6d9[_0x4b18('0x51')],util[_0x4b18('0x48')](_0x40f6d9,{'showHidden':![],'depth':null}));if(this[_0x4b18('0x49')][_0x40f6d9[_0x4b18('0x51')]]){var _0x448503=_[_0x4b18('0x82')](this[_0x4b18('0x49')][_0x40f6d9[_0x4b18('0x51')]]);_0x448503['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x448503['connectedlinenum']=_0x40f6d9[_0x4b18('0x8b')];_0x448503[_0x4b18('0x8c')]=_0x40f6d9['connectedlinename'];logger[_0x4b18('0x7d')](_0x4b18('0x8d'),_0x448503['queue'],_0x448503[_0x4b18('0x5e')],_0x40f6d9[_0x4b18('0x8b')],_0x40f6d9['connectedlinename']);this[_0x4b18('0x13')][_0x40f6d9[_0x4b18('0x51')]]=_0x448503;this['emitVoiceQueueChannelSave'](_0x448503,'queuecallerleave');}}}catch(_0x3510c4){logger[_0x4b18('0x46')](_0x4b18('0x8a'),_0x40f6d9['uniqueid'],util['inspect'](_0x3510c4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4b18('0xd')][_0x4b18('0x27')]=function(_0x5f444f){try{if(this[_0x4b18('0x75')](_0x5f444f)){logger['debug'](_0x4b18('0x8e'),_0x5f444f[_0x4b18('0x51')],util[_0x4b18('0x48')](_0x5f444f,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5f444f['uniqueid']]){var _0x587f1f=_[_0x4b18('0x82')](this[_0x4b18('0x49')][_0x5f444f[_0x4b18('0x51')]]);_0x587f1f[_0x4b18('0x3e')]=!![];_0x587f1f[_0x4b18('0x57')]=_0x4b18('0x8f');logger[_0x4b18('0x7d')](_0x4b18('0x90'),_0x587f1f[_0x4b18('0x5a')],_0x587f1f[_0x4b18('0x5e')]);}}}catch(_0x183207){logger['error'](_0x4b18('0x8e'),_0x5f444f[_0x4b18('0x51')],util[_0x4b18('0x48')](_0x183207,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4b18('0xd')][_0x4b18('0x91')]=function(_0x14bfa9){try{if(this[_0x4b18('0x75')](_0x14bfa9)){logger[_0x4b18('0x50')](_0x4b18('0x92'),_0x14bfa9[_0x4b18('0x51')],util[_0x4b18('0x48')](_0x14bfa9,{'showHidden':![],'depth':null}));if(this[_0x4b18('0x49')][_0x14bfa9[_0x4b18('0x51')]]){var _0x2f1514=_[_0x4b18('0x82')](this[_0x4b18('0x49')][_0x14bfa9[_0x4b18('0x51')]]);_0x2f1514[_0x4b18('0x22')]=![];_0x2f1514[_0x4b18('0x86')]=null;_0x2f1514[_0x4b18('0x93')]=!![];_0x2f1514[_0x4b18('0x88')]=_0x14bfa9['membername'];_0x2f1514[_0x4b18('0x84')]=_0x14bfa9[_0x4b18('0x84')];_0x2f1514[_0x4b18('0x3e')]=!![];_0x2f1514[_0x4b18('0x3d')]=![];_0x2f1514['queuecallerexitAt']=null;if(!_0x2f1514[_0x4b18('0x94')]){if(_0x14bfa9[_0x4b18('0x95')]==_0x4b18('0x94')){_0x2f1514['queuecallerexitreason']=_0x4b18('0x96');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x2f1514[_0x4b18('0x5a')],_0x2f1514[_0x4b18('0x5e')]);}else{if(_[_0x4b18('0x97')](_0x14bfa9[_0x4b18('0x44')][_0x4b18('0x98')](),_0x4b18('0x99'))){if(this[_0x4b18('0x49')][_0x14bfa9[_0x4b18('0x9a')]]){var _0x4218ed=_[_0x4b18('0x82')](this[_0x4b18('0x49')][_0x14bfa9[_0x4b18('0x9a')]]);_0x4218ed[_0x4b18('0x3e')]=![];_0x4218ed['queuecallerexit']=!![];_0x4218ed['queuecallerexitAt']=moment(_0x2f1514[_0x4b18('0x9b')])[_0x4b18('0x9c')](_0x14bfa9[_0x4b18('0x84')],_0x4b18('0x9d'))[_0x4b18('0x59')](_0x4b18('0x7a'));_0x4218ed[_0x4b18('0x57')]=_0x4b18('0x9e');_0x4218ed[_0x4b18('0x94')]=!![];_0x4218ed[_0x4b18('0x9f')]=_0x4b18('0xa0');_0x4218ed[_0x4b18('0xa1')]=_0x14bfa9[_0x4b18('0xa2')];_0x4218ed['transferuniqueid']=_0x14bfa9[_0x4b18('0x51')];logger['info'](_0x4b18('0xa3'),_0x4218ed['queue'],_0x4218ed[_0x4b18('0x5e')]);var _0x1b9f41=this[_0x4b18('0x49')][_0x14bfa9['linkedid']];this[_0x4b18('0x49')][_0x14bfa9['linkedid']]=this['queueReports'][_0x14bfa9[_0x4b18('0x51')]];this['queueReports'][_0x14bfa9['uniqueid']]=_0x1b9f41;}}else{_0x2f1514[_0x4b18('0x57')]=_0x4b18('0xa4')+_0x14bfa9[_0x4b18('0x95')][_0x4b18('0xa5')]();logger[_0x4b18('0x7d')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x2f1514[_0x4b18('0x5a')],_0x2f1514[_0x4b18('0x5e')],_0x2f1514[_0x4b18('0x57')]);}}}this[_0x4b18('0x13')][_0x14bfa9['uniqueid']]=_0x2f1514;}}}catch(_0x49d9da){logger[_0x4b18('0x46')](_0x4b18('0x92'),_0x14bfa9['uniqueid'],util[_0x4b18('0x48')](_0x49d9da,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4b18('0xd')][_0x4b18('0x29')]=function(_0x1753d8){try{if(this[_0x4b18('0x75')](_0x1753d8)){logger['debug']('[%s][voiceQueueReport][varset]',_0x1753d8[_0x4b18('0x51')],util['inspect'](_0x1753d8,{'showHidden':![],'depth':null}));this['addVariable'](_0x1753d8[_0x4b18('0x51')],_[_0x4b18('0x80')](_0x1753d8[_0x4b18('0xa6')])[0x0],_0x1753d8['value']);if(this[_0x4b18('0x49')][_0x1753d8[_0x4b18('0x51')]]){var _0x559d4f=_[_0x4b18('0x82')](this['queueReports'][_0x1753d8[_0x4b18('0x51')]]);if(_0x559d4f){if(this[_0x4b18('0x75')](_0x1753d8[_0x4b18('0xa6')])&&this[_0x4b18('0x75')](_0x1753d8[_0x4b18('0xa6')][_0x4b18('0x66')])){switch(_0x1753d8[_0x4b18('0xa7')]){case _0x4b18('0xa8'):_0x559d4f['queuecallerexit']=![];_0x559d4f[_0x4b18('0xa9')]=null;break;case _0x4b18('0xaa'):_0x559d4f[_0x4b18('0xab')]=_0x4b18('0xac');_0x559d4f['queuecallerexit']=!![];_0x559d4f[_0x4b18('0xa9')]=moment()[_0x4b18('0x59')](_0x4b18('0x7a'));_0x559d4f[_0x4b18('0xad')]=moment()['format'](_0x4b18('0x7a'));logger[_0x4b18('0x50')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x1753d8['uniqueid'],util[_0x4b18('0x48')](_0x559d4f,{'showHidden':![],'depth':null}));ami[_0x4b18('0x4e')]('custom:timeout',_0x559d4f);break;default:_0x559d4f['queuecallerexit']=!![];_0x559d4f[_0x4b18('0xa9')]=moment()[_0x4b18('0x59')](_0x4b18('0x7a'));_0x559d4f[_0x4b18('0xad')]=moment()[_0x4b18('0x59')](_0x4b18('0x7a'));}_0x559d4f[_0x4b18('0x22')]=![];_0x559d4f[_0x4b18('0x86')]=null;_0x559d4f[_0x4b18('0x57')]=_0x1753d8['value'];this[_0x4b18('0x13')][_0x1753d8['uniqueid']]=_0x559d4f;this[_0x4b18('0x4c')](_0x559d4f,_0x4b18('0x28'));}else if(this[_0x4b18('0x75')](_0x1753d8['variable'])&&this['isNotNull'](_0x1753d8[_0x4b18('0xa6')][_0x4b18('0xae')])){if(!_0x559d4f['queuecallerabandon']){_0x559d4f[_0x4b18('0x3d')]=!![];_0x559d4f[_0x4b18('0xa9')]=moment()[_0x4b18('0x59')](_0x4b18('0x7a'));_0x559d4f[_0x4b18('0x57')]=_0x4b18('0xaf');_0x559d4f[_0x4b18('0xad')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1753d8[_0x4b18('0x51')]]=_0x559d4f;}}logger['info'](_0x4b18('0xb0'),_0x1753d8[_0x4b18('0x51')],_0x559d4f['queue'],_0x559d4f[_0x4b18('0x5e')],_[_0x4b18('0x80')](_0x1753d8[_0x4b18('0xa6')])[0x0],_0x1753d8['value']);_0x559d4f[_0x4b18('0x18')]=this[_0x4b18('0x18')][_0x1753d8[_0x4b18('0x51')]];}}}}catch(_0x271e3e){logger[_0x4b18('0x46')](_0x4b18('0xb1'),_0x1753d8[_0x4b18('0x51')],util['inspect'](_0x271e3e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x1275b6,_0x61013e,_0x2156ef){var _0x205db3=[_0x4b18('0xb2'),_0x4b18('0xb3'),_0x4b18('0xb4'),'rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged',_0x4b18('0xb5'),'rtpaudioqosrttbridged',_0x4b18('0xb6'),'sipuri',_0x4b18('0xb7'),_0x4b18('0xb8'),_0x4b18('0xb9'),'memberdynamic',_0x4b18('0xba'),_0x4b18('0xbb'),'membername',_0x4b18('0xbc'),'memberrealtime'];if(!_[_0x4b18('0x41')](_0x61013e)&&!_[_0x4b18('0xbd')](_0x205db3,_0x61013e)){if(_[_0x4b18('0x61')](this[_0x4b18('0x18')][_0x1275b6])){this['variables'][_0x1275b6]={};}this[_0x4b18('0x18')][_0x1275b6][_0x61013e]=_0x2156ef;}};VoiceQueueReport['prototype'][_0x4b18('0xbe')]=function(_0x2da1af,_0x33e92b,_0x31b5fd){try{var _0x4198ae={};if(this[_0x4b18('0x49')][_0x2da1af]){for(var _0x10b014=0x0;_0x10b014{delete this[_0x4b18('0x13')][_0xfc9455];},_0x4348c1);}};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 1690c50..cf2d0cb 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 _0x0517=['createHistory','campaign','queue','CreateReportAgentPreview','../client'];(function(_0x3ede0b,_0x2a391a){var _0x4fd59b=function(_0x4ed5e6){while(--_0x4ed5e6){_0x3ede0b['push'](_0x3ede0b['shift']());}};_0x4fd59b(++_0x2a391a);}(_0x0517,0x1a3));var _0x7051=function(_0xb58620,_0x3601ef){_0xb58620=_0xb58620-0x0;var _0xbeeda2=_0x0517[_0xb58620];return _0xbeeda2;};'use strict';var client=require(_0x7051('0x0'));exports[_0x7051('0x1')]=function(_0x365144){return function(){_0x365144[_0x7051('0x2')]=_0x365144[_0x7051('0x3')];return client['Request'](_0x7051('0x4'),{'body':_0x365144,'log':_0x7051('0x4')});};}; \ No newline at end of file +var _0x26d4=['../client','createHistory','campaign','queue','Request','CreateReportAgentPreview'];(function(_0x53c96b,_0x1f31bd){var _0x2470c0=function(_0x5d8341){while(--_0x5d8341){_0x53c96b['push'](_0x53c96b['shift']());}};_0x2470c0(++_0x1f31bd);}(_0x26d4,0xd2));var _0x426d=function(_0x4648f8,_0x2b428b){_0x4648f8=_0x4648f8-0x0;var _0x38fd3e=_0x26d4[_0x4648f8];return _0x38fd3e;};'use strict';var client=require(_0x426d('0x0'));exports[_0x426d('0x1')]=function(_0x53d240){return function(){_0x53d240[_0x426d('0x2')]=_0x53d240[_0x426d('0x3')];return client[_0x426d('0x4')](_0x426d('0x5'),{'body':_0x53d240,'log':_0x426d('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 36032b2..bcf9a20 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 _0x3feb=['Request','CreateAttachment','../client','create'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x3feb,0x192));var _0xb3fe=function(_0x45762d,_0x13888d){_0x45762d=_0x45762d-0x0;var _0x568551=_0x3feb[_0x45762d];return _0x568551;};'use strict';var client=require(_0xb3fe('0x0'));exports[_0xb3fe('0x1')]=function(_0xd98661){return client[_0xb3fe('0x2')]('CreateAttachment',{'body':_0xd98661,'log':_0xb3fe('0x3')});}; \ No newline at end of file +var _0x475d=['create','CreateAttachment','../client'];(function(_0x17e3bc,_0x269208){var _0x13dffa=function(_0x2664fd){while(--_0x2664fd){_0x17e3bc['push'](_0x17e3bc['shift']());}};_0x13dffa(++_0x269208);}(_0x475d,0x110));var _0xd475=function(_0x178f27,_0x26e5b0){_0x178f27=_0x178f27-0x0;var _0x1bef17=_0x475d[_0x178f27];return _0x1bef17;};'use strict';var client=require(_0xd475('0x0'));exports[_0xd475('0x1')]=function(_0x4baf33){return client['Request']('CreateAttachment',{'body':_0x4baf33,'log':_0xd475('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 24f87c6..2c2d482 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 _0xadb5=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialCutDigit','Trunk','callerid','active','TrunkBackup','Interval','SquareProject','getCampaign','getCampaigns','GetCampaign','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength'];(function(_0x54f54a,_0x3112e0){var _0xb54e66=function(_0x1ac819){while(--_0x1ac819){_0x54f54a['push'](_0x54f54a['shift']());}};_0xb54e66(++_0x3112e0);}(_0xadb5,0xad));var _0x5adb=function(_0x3385c,_0x20a470){_0x3385c=_0x3385c-0x0;var _0x707066=_0xadb5[_0x3385c];return _0x707066;};'use strict';var client=require('../client');exports[_0x5adb('0x0')]=function(){return function(){return client['Request'](_0x5adb('0x1'),{'options':{'raw':![],'attributes':['id',_0x5adb('0x2'),_0x5adb('0x3'),'active',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'dialOriginateTimeout',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'dialAMDActive',_0x5adb('0x18'),'dialAMDGreeting',_0x5adb('0x19'),'dialAMDTotalAnalysisTime',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'dialAMDSilenceThreshold',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'dialRandomLastDigitCallerIdNumber',_0x5adb('0x20')],'include':[{'model':'Trunk','as':_0x5adb('0x21'),'attributes':['id',_0x5adb('0x2'),_0x5adb('0x22'),_0x5adb('0x23')]},{'model':_0x5adb('0x21'),'as':_0x5adb('0x24'),'attributes':['id',_0x5adb('0x2'),_0x5adb('0x22'),_0x5adb('0x23')]},{'model':'Interval','as':_0x5adb('0x25'),'attributes':['id','name'],'include':[{'model':_0x5adb('0x25'),'as':'Intervals','attributes':['id',_0x5adb('0x2'),'interval']}]},{'model':'SquareProject','as':_0x5adb('0x26'),'attributes':['id',_0x5adb('0x2')]}]},'log':_0x5adb('0x27')});};}; \ No newline at end of file +var _0x2ef3=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','active','TrunkBackup','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0x2ef3,0xba));var _0x32ef=function(_0x52c557,_0x59355a){_0x52c557=_0x52c557-0x0;var _0x131cc6=_0x2ef3[_0x52c557];return _0x131cc6;};'use strict';var client=require(_0x32ef('0x0'));exports[_0x32ef('0x1')]=function(){return function(){return client[_0x32ef('0x2')](_0x32ef('0x3'),{'options':{'raw':![],'attributes':['id',_0x32ef('0x4'),_0x32ef('0x5'),'active',_0x32ef('0x6'),_0x32ef('0x7'),'dialOriginateCallerIdNumber',_0x32ef('0x8'),_0x32ef('0x9'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'dialAMDActive',_0x32ef('0x18'),'dialAMDGreeting',_0x32ef('0x19'),'dialAMDTotalAnalysisTime',_0x32ef('0x1a'),_0x32ef('0x1b'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x32ef('0x1c'),'dialOrderByScheduledAt',_0x32ef('0x1d'),_0x32ef('0x1e'),_0x32ef('0x1f')],'include':[{'model':_0x32ef('0x20'),'as':'Trunk','attributes':['id','name','callerid',_0x32ef('0x21')]},{'model':_0x32ef('0x20'),'as':_0x32ef('0x22'),'attributes':['id','name','callerid',_0x32ef('0x21')]},{'model':_0x32ef('0x23'),'as':_0x32ef('0x23'),'attributes':['id','name'],'include':[{'model':_0x32ef('0x23'),'as':_0x32ef('0x24'),'attributes':['id','name',_0x32ef('0x25')]}]},{'model':_0x32ef('0x26'),'as':_0x32ef('0x26'),'attributes':['id',_0x32ef('0x4')]}]},'log':_0x32ef('0x27')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index 5870ec1..ac9b088 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 _0x69e1=['createContact','Request','CreateCmContact','GetCmContact'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x69e1,0x1c4));var _0x169e=function(_0x1ed0b1,_0xfd9eab){_0x1ed0b1=_0x1ed0b1-0x0;var _0x5c17d5=_0x69e1[_0x1ed0b1];return _0x5c17d5;};'use strict';var client=require('../client');exports[_0x169e('0x0')]=function(_0x5e3cf9){return function(){return client[_0x169e('0x1')](_0x169e('0x2'),{'body':_0x5e3cf9,'log':_0x169e('0x2')});};};exports['getContacts']=function(_0x3fde44){return function(){return client[_0x169e('0x1')](_0x169e('0x3'),{'options':_0x3fde44,'log':'GetCmContact'});};}; \ No newline at end of file +var _0xf547=['createContact','Request','CreateCmContact','getContacts','GetCmContact','../client'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0xf547,0x1cd));var _0x7f54=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xf547[_0x4bfac3];return _0x15f0f2;};'use strict';var client=require(_0x7f54('0x0'));exports[_0x7f54('0x1')]=function(_0x5e7d3c){return function(){return client[_0x7f54('0x2')]('CreateCmContact',{'body':_0x5e7d3c,'log':_0x7f54('0x3')});};};exports[_0x7f54('0x4')]=function(_0x5e5fca){return function(){return client['Request'](_0x7f54('0x5'),{'options':_0x5e5fca,'log':_0x7f54('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index 56a01b7..0af2798 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 _0x815b=['name','Queue','getContactRecallMe','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','getContacts','GetCmHopper','getCmHopper','updateContacts','Request','format','rescheduleContact','UpdateCmHopper','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','GetContactDialer','YYYY-MM-DD\x20HH:mm:ss','priority','DESC','scheduledat','ASC','getContactDialerIvr','CmContact','Contact','GetContactDialerIvr','campaign','queue','MoveContactManagedDialer','countReScheduled','CountReScheduled','getContactPreview','GetCmHopperPreview','User','Agent'];(function(_0x20cc29,_0x30a46d){var _0x28d513=function(_0x179b06){while(--_0x179b06){_0x20cc29['push'](_0x20cc29['shift']());}};_0x28d513(++_0x30a46d);}(_0x815b,0xb4));var _0xb815=function(_0x43139f,_0x38ea66){_0x43139f=_0x43139f-0x0;var _0x4ebd84=_0x815b[_0x43139f];return _0x4ebd84;};'use strict';var client=require(_0xb815('0x0'));var moment=require(_0xb815('0x1'));exports[_0xb815('0x2')]=function(_0x43d273,_0x6314c){return function(){return client['Request'](_0xb815('0x3'),{'options':{'where':{'VoiceQueueId':_0x43d273},'include':[{'model':'CmContact','as':'Contact'}],'limit':_0x6314c,'raw':![]},'log':_0xb815('0x4')});};};exports[_0xb815('0x5')]=function(_0x93c8e8,_0x5a5c18,_0x466899){return function(){return client[_0xb815('0x6')]('UpdateCmHopper',{'body':_0x93c8e8,'options':{'where':{'VoiceQueueId':_0x5a5c18,'scheduledat':{'$lte':moment()[_0xb815('0x7')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x466899},'log':'UpdateCmHopper'});};};exports[_0xb815('0x8')]=function(_0x26d239){return client[_0xb815('0x6')](_0xb815('0x9'),{'body':_0x26d239,'options':{'where':{'ContactId':_0x26d239[_0xb815('0xa')],'ListId':_0x26d239[_0xb815('0xb')],'VoiceQueueId':_0x26d239[_0xb815('0xc')],'CampaignId':_0x26d239[_0xb815('0xd')]}},'log':'rescheduleContact'});};exports[_0xb815('0xe')]=function(_0x11abab,_0x22ed07,_0x3c9ebe){return function(){return client[_0xb815('0x6')](_0xb815('0xf'),{'options':{'where':{'VoiceQueueId':_0x11abab,'ListId':_0x22ed07,'ContactId':_0x3c9ebe}},'log':_0xb815('0xf')});};};exports['getContactDialer']=function(_0x5f360b,_0x471ccc,_0x81bd04,_0x13a09e){return client[_0xb815('0x6')](_0xb815('0x10'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x5f360b,'active':![],'scheduledat':{'$lte':moment()[_0xb815('0x7')](_0xb815('0x11'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x471ccc}}]},'order':[[_0xb815('0x12'),_0xb815('0x13')],[_0xb815('0x14'),_0x13a09e],['id',_0xb815('0x15')]],'raw':!![],'limit':_0x81bd04},'log':_0xb815('0x10')});};exports[_0xb815('0x16')]=function(_0x52d8dd,_0x4bb666,_0x41445e){return client[_0xb815('0x6')](_0xb815('0x10'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x52d8dd,'active':![],'scheduledat':{'$lte':moment()[_0xb815('0x7')](_0xb815('0x11'))}},'include':[{'model':_0xb815('0x17'),'as':_0xb815('0x18')}],'order':[[_0xb815('0x12'),_0xb815('0x13')],['scheduledat',_0x41445e],['id','ASC']],'raw':!![],'limit':_0x4bb666},'log':_0xb815('0x19')});};exports['moveContactManagedDialer']=function(_0x261b8d,_0x1ebe78){_0x261b8d[_0xb815('0x1a')]=_0x261b8d[_0xb815('0x1b')];return client['Request'](_0xb815('0x1c'),{'body':_0x261b8d,'options':{'where':{'ContactId':_0x261b8d[_0xb815('0xa')],'ListId':_0x261b8d['ListId'],'VoiceQueueId':_0x261b8d[_0xb815('0xc')],'CampaignId':_0x261b8d[_0xb815('0xd')],'active':_0x1ebe78?undefined:!![]}},'log':_0xb815('0x1c')});};exports[_0xb815('0x1d')]=function(_0x2ecffe){return client[_0xb815('0x6')](_0xb815('0x1e'),{'options':{'where':{'VoiceQueueId':_0x2ecffe['id']?_0x2ecffe['id']||null:null}},'log':_0xb815('0x1d')});};exports[_0xb815('0x1f')]=function(_0x160f67){return function(){return client[_0xb815('0x6')](_0xb815('0x20'),{'options':{'where':{'id':_0x160f67},'include':[{'model':'CmContact','as':_0xb815('0x18')},{'model':_0xb815('0x21'),'as':_0xb815('0x22'),'attributes':['id',_0xb815('0x23')]},{'model':'VoiceQueue','as':_0xb815('0x24'),'attributes':['id',_0xb815('0x23')]}],'raw':!![]},'log':_0xb815('0x4')});};};exports['unlockContact']=function(_0x1bb3dc,_0x1e5beb,_0x3c6f50){return client[_0xb815('0x6')](_0xb815('0x9'),{'body':_0x1bb3dc,'options':{'where':{'id':_0x1e5beb},'limit':_0x3c6f50},'log':_0xb815('0x9')});};exports[_0xb815('0x25')]=function(_0xd22488,_0x46c545){return function(){return client['Request']('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xd22488,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0xb815('0x11'))},'UserId':{'$in':_0x46c545}},'order':[[_0xb815('0x12'),'DESC'],[_0xb815('0x14'),_0xb815('0x13')],['id',_0xb815('0x15')]],'include':[{'model':_0xb815('0x17'),'as':'Contact'},{'model':_0xb815('0x21'),'as':_0xb815('0x22'),'attributes':['id','name','voicePause']}],'group':_0xb815('0x26'),'raw':!![]},'log':'GetContactDialer'});};};exports[_0xb815('0x27')]=function(_0x5f12d0,_0x6573cd){return client['Request'](_0xb815('0x28'),{'body':_0x5f12d0,'options':_0x6573cd||{},'log':_0xb815('0x28')});};exports[_0xb815('0x29')]=function(_0x4dfea6,_0x2064bd,_0x36c081){return function(){return client['Request'](_0xb815('0x2a'),{'body':{'where':{'voiceQueueIds':_0x4dfea6,'interval':_0x2064bd,'availableAgentsIds':_0x36c081}},'log':_0xb815('0x29')});};}; \ No newline at end of file +var _0x5a93=['moment','CmContact','Contact','getCmHopper','Request','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat','getContactDialerIvr','GetContactDialerIvr','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','CountReScheduled','countReScheduled','getContactPreview','GetCmHopperPreview','User','VoiceQueue','Queue','unlockContact','GetContactRecallMe','ASC','Agent','voicePause','db.CmHopper.UserId','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications'];(function(_0x3ab3ce,_0x5e3960){var _0x2021e1=function(_0x375b64){while(--_0x375b64){_0x3ab3ce['push'](_0x3ab3ce['shift']());}};_0x2021e1(++_0x5e3960);}(_0x5a93,0xf6));var _0x35a9=function(_0x422afa,_0x1ea712){_0x422afa=_0x422afa-0x0;var _0x14344c=_0x5a93[_0x422afa];return _0x14344c;};'use strict';var client=require('../client');var moment=require(_0x35a9('0x0'));exports['getContacts']=function(_0x23ee4d,_0x9383e7){return function(){return client['Request']('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x23ee4d},'include':[{'model':_0x35a9('0x1'),'as':_0x35a9('0x2')}],'limit':_0x9383e7,'raw':![]},'log':_0x35a9('0x3')});};};exports['updateContacts']=function(_0x2a27c8,_0x27ed9f,_0x2e8a14){return function(){return client[_0x35a9('0x4')](_0x35a9('0x5'),{'body':_0x2a27c8,'options':{'where':{'VoiceQueueId':_0x27ed9f,'scheduledat':{'$lte':moment()[_0x35a9('0x6')](_0x35a9('0x7'))}},'limit':_0x2e8a14},'log':_0x35a9('0x5')});};};exports[_0x35a9('0x8')]=function(_0x3c339f){return client[_0x35a9('0x4')](_0x35a9('0x5'),{'body':_0x3c339f,'options':{'where':{'ContactId':_0x3c339f[_0x35a9('0x9')],'ListId':_0x3c339f[_0x35a9('0xa')],'VoiceQueueId':_0x3c339f[_0x35a9('0xb')],'CampaignId':_0x3c339f[_0x35a9('0xc')]}},'log':_0x35a9('0x8')});};exports['destroyContact']=function(_0x2eae3b,_0x1c34ef,_0x39bbfb){return function(){return client[_0x35a9('0x4')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x2eae3b,'ListId':_0x1c34ef,'ContactId':_0x39bbfb}},'log':_0x35a9('0xd')});};};exports[_0x35a9('0xe')]=function(_0x2f615d,_0x13e025,_0x4ff724,_0x112b5e){return client[_0x35a9('0x4')](_0x35a9('0xf'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x2f615d,'active':![],'scheduledat':{'$lte':moment()[_0x35a9('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x13e025}}]},'order':[[_0x35a9('0x10'),_0x35a9('0x11')],[_0x35a9('0x12'),_0x112b5e],['id','ASC']],'raw':!![],'limit':_0x4ff724},'log':_0x35a9('0xf')});};exports[_0x35a9('0x13')]=function(_0x14eeb5,_0x36b24a,_0x2a4786){return client[_0x35a9('0x4')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x14eeb5,'active':![],'scheduledat':{'$lte':moment()[_0x35a9('0x6')](_0x35a9('0x7'))}},'include':[{'model':_0x35a9('0x1'),'as':_0x35a9('0x2')}],'order':[[_0x35a9('0x10'),'DESC'],[_0x35a9('0x12'),_0x2a4786],['id','ASC']],'raw':!![],'limit':_0x36b24a},'log':_0x35a9('0x14')});};exports[_0x35a9('0x15')]=function(_0xb11616,_0x2905a2){_0xb11616[_0x35a9('0x16')]=_0xb11616[_0x35a9('0x17')];return client[_0x35a9('0x4')](_0x35a9('0x18'),{'body':_0xb11616,'options':{'where':{'ContactId':_0xb11616[_0x35a9('0x9')],'ListId':_0xb11616['ListId'],'VoiceQueueId':_0xb11616[_0x35a9('0xb')],'CampaignId':_0xb11616[_0x35a9('0xc')],'active':_0x2905a2?undefined:!![]}},'log':'MoveContactManagedDialer'});};exports['countReScheduled']=function(_0x133bdf){return client[_0x35a9('0x4')](_0x35a9('0x19'),{'options':{'where':{'VoiceQueueId':_0x133bdf['id']?_0x133bdf['id']||null:null}},'log':_0x35a9('0x1a')});};exports[_0x35a9('0x1b')]=function(_0x5d9a2c){return function(){return client[_0x35a9('0x4')](_0x35a9('0x1c'),{'options':{'where':{'id':_0x5d9a2c},'include':[{'model':_0x35a9('0x1'),'as':_0x35a9('0x2')},{'model':_0x35a9('0x1d'),'as':'Agent','attributes':['id','name']},{'model':_0x35a9('0x1e'),'as':_0x35a9('0x1f'),'attributes':['id','name']}],'raw':!![]},'log':_0x35a9('0x3')});};};exports[_0x35a9('0x20')]=function(_0x5e3631,_0x22835a,_0x4cd0b3){return client[_0x35a9('0x4')](_0x35a9('0x5'),{'body':_0x5e3631,'options':{'where':{'id':_0x22835a},'limit':_0x4cd0b3},'log':'UpdateCmHopper'});};exports['getContactRecallMe']=function(_0x16ee46,_0x207444){return function(){return client[_0x35a9('0x4')](_0x35a9('0x21'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x16ee46,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x35a9('0x6')](_0x35a9('0x7'))},'UserId':{'$in':_0x207444}},'order':[[_0x35a9('0x10'),_0x35a9('0x11')],['scheduledat',_0x35a9('0x11')],['id',_0x35a9('0x22')]],'include':[{'model':_0x35a9('0x1'),'as':_0x35a9('0x2')},{'model':_0x35a9('0x1d'),'as':_0x35a9('0x23'),'attributes':['id','name',_0x35a9('0x24')]}],'group':_0x35a9('0x25'),'raw':!![]},'log':_0x35a9('0xf')});};};exports['resetActiveCalls']=function(_0x37bd4c,_0x5bdb28){return client[_0x35a9('0x4')](_0x35a9('0x26'),{'body':_0x37bd4c,'options':_0x5bdb28||{},'log':_0x35a9('0x26')});};exports[_0x35a9('0x27')]=function(_0x1445f1,_0x28e8c8,_0x4fac7c){return function(){return client['Request'](_0x35a9('0x28'),{'body':{'where':{'voiceQueueIds':_0x1445f1,'interval':_0x28e8c8,'availableAgentsIds':_0x4fac7c}},'log':_0x35a9('0x27')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 3c52224..b207a13 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 _0x8a2e=['VerifyAdditionalPhones','SwapAdditionalPhones','IncrementPreviewCounters','verifyAdditionalPhones','Request'];(function(_0x314f3c,_0x2e7b9a){var _0x4cfac9=function(_0x351d9d){while(--_0x351d9d){_0x314f3c['push'](_0x314f3c['shift']());}};_0x4cfac9(++_0x2e7b9a);}(_0x8a2e,0x189));var _0xe8a2=function(_0x3f8054,_0x507b27){_0x3f8054=_0x3f8054-0x0;var _0x1375dd=_0x8a2e[_0x3f8054];return _0x1375dd;};'use strict';var client=require('../client');exports[_0xe8a2('0x0')]=function(_0x3469ec,_0x3e3506,_0x37d909){return client[_0xe8a2('0x1')](_0xe8a2('0x2'),{'body':_0x3469ec,'reason':_0x3e3506,'entity':_0x37d909,'log':'VerifyAdditionalPhones'});};exports['swapAdditionalPhones']=function(_0x429301,_0x8b1b85,_0xaabd5d){return client[_0xe8a2('0x1')](_0xe8a2('0x3'),{'body':_0x429301,'duration':_0x8b1b85,'waitTime':_0xaabd5d,'log':'SwapAdditionalPhones'});};exports['incrementPreviewCounters']=function(_0x156542){return function(){return client[_0xe8a2('0x1')](_0xe8a2('0x4'),{'body':_0x156542,'log':'IncrementPreviewCounters'});};}; \ No newline at end of file +var _0x387a=['VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','Request'];(function(_0xe6d112,_0x28fd3c){var _0x33095a=function(_0xb1a77){while(--_0xb1a77){_0xe6d112['push'](_0xe6d112['shift']());}};_0x33095a(++_0x28fd3c);}(_0x387a,0xfb));var _0xa387=function(_0x183594,_0x53916e){_0x183594=_0x183594-0x0;var _0x2a1538=_0x387a[_0x183594];return _0x2a1538;};'use strict';var client=require('../client');exports['verifyAdditionalPhones']=function(_0x1ca8ff,_0x2e6f82,_0x262d30){return client[_0xa387('0x0')](_0xa387('0x1'),{'body':_0x1ca8ff,'reason':_0x2e6f82,'entity':_0x262d30,'log':_0xa387('0x1')});};exports[_0xa387('0x2')]=function(_0x3dfa51,_0x804f10,_0x568356){return client['Request'](_0xa387('0x3'),{'body':_0x3dfa51,'duration':_0x804f10,'waitTime':_0x568356,'log':_0xa387('0x3')});};exports[_0xa387('0x4')]=function(_0x3abb99){return function(){return client[_0xa387('0x0')]('IncrementPreviewCounters',{'body':_0x3abb99,'log':_0xa387('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index b69e302..a85477a 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 _0x7d88=['Request','GetCmHopperBlack','VoiceQueueId','phone','checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList'];(function(_0x2cc400,_0x441227){var _0x19b3a3=function(_0x56527b){while(--_0x56527b){_0x2cc400['push'](_0x2cc400['shift']());}};_0x19b3a3(++_0x441227);}(_0x7d88,0x1a5));var _0x87d8=function(_0x547518,_0x4d2931){_0x547518=_0x547518-0x0;var _0x449e2e=_0x7d88[_0x547518];return _0x449e2e;};'use strict';var client=require(_0x87d8('0x0'));exports[_0x87d8('0x1')]=function(_0x51c9d6){return client[_0x87d8('0x2')](_0x87d8('0x3'),{'options':{'where':{'VoiceQueueId':_0x51c9d6[_0x87d8('0x4')],'phone':_0x51c9d6[_0x87d8('0x5')]},'raw':![]},'log':_0x87d8('0x3')});};exports[_0x87d8('0x6')]=function(_0x39413e){return client[_0x87d8('0x2')]('GetCmHopperBlack',{'options':{'where':{'CampaignId':_0x39413e[_0x87d8('0x7')],'phone':_0x39413e['phone']},'raw':![]},'log':_0x87d8('0x8')});}; \ No newline at end of file +var _0xb7c7=['VoiceQueueId','phone','checkIsBlackListIvr','GetCmHopperBlackIvr','checkIsBlackList','Request','GetCmHopperBlack'];(function(_0x119aeb,_0x5c01bb){var _0x39d2e4=function(_0x303f54){while(--_0x303f54){_0x119aeb['push'](_0x119aeb['shift']());}};_0x39d2e4(++_0x5c01bb);}(_0xb7c7,0xf2));var _0x7b7c=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0xb7c7[_0x1314d4];return _0x584ba5;};'use strict';var client=require('../client');exports[_0x7b7c('0x0')]=function(_0x5e7003){return client[_0x7b7c('0x1')](_0x7b7c('0x2'),{'options':{'where':{'VoiceQueueId':_0x5e7003[_0x7b7c('0x3')],'phone':_0x5e7003[_0x7b7c('0x4')]},'raw':![]},'log':'GetCmHopperBlack'});};exports[_0x7b7c('0x5')]=function(_0x449d53){return client[_0x7b7c('0x1')]('GetCmHopperBlack',{'options':{'where':{'CampaignId':_0x449d53['CampaignId'],'phone':_0x449d53['phone']},'raw':![]},'log':_0x7b7c('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 44af99f..3de0b82 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 _0xa8e8=['createContact','queue','Request','CreateCmHopperFinal','../client'];(function(_0x4f4768,_0x475d22){var _0x2943b0=function(_0x55671a){while(--_0x55671a){_0x4f4768['push'](_0x4f4768['shift']());}};_0x2943b0(++_0x475d22);}(_0xa8e8,0x162));var _0x8a8e=function(_0x4d64d0,_0x11d5bb){_0x4d64d0=_0x4d64d0-0x0;var _0x246aa2=_0xa8e8[_0x4d64d0];return _0x246aa2;};'use strict';var client=require(_0x8a8e('0x0'));exports[_0x8a8e('0x1')]=function(_0x2a57ab){return function(){_0x2a57ab['campaign']=_0x2a57ab[_0x8a8e('0x2')];return client[_0x8a8e('0x3')](_0x8a8e('0x4'),{'body':_0x2a57ab,'log':_0x8a8e('0x4')});};}; \ No newline at end of file +var _0x7762=['CreateCmHopperFinal','../client','createContact','queue','Request'];(function(_0x5116f5,_0x5b95d2){var _0x36da70=function(_0x1b6df8){while(--_0x1b6df8){_0x5116f5['push'](_0x5116f5['shift']());}};_0x36da70(++_0x5b95d2);}(_0x7762,0x123));var _0x2776=function(_0x562f4f,_0x3d41ad){_0x562f4f=_0x562f4f-0x0;var _0x1b16aa=_0x7762[_0x562f4f];return _0x1b16aa;};'use strict';var client=require(_0x2776('0x0'));exports[_0x2776('0x1')]=function(_0x5d13b5){return function(){_0x5d13b5['campaign']=_0x5d13b5[_0x2776('0x2')];return client[_0x2776('0x3')](_0x2776('0x4'),{'body':_0x5d13b5,'log':_0x2776('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index f5f2634..e51a3b9 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 _0xbdb1=['CreateCmHopperHistory','avgHandleTime','AvgHandleTime','minutes','YYYY-MM-DD\x20HH:mm:ss','format','GetCmHopperHistory','GetVoiceQueueHopperHistory','day','endOf','getCampaignHopperHistory','GetCampaignHopperHistory','startOf','../client','moment','createHistory','campaign','queue','Request'];(function(_0x2fcebf,_0x310aa2){var _0x57dba2=function(_0x682f19){while(--_0x682f19){_0x2fcebf['push'](_0x2fcebf['shift']());}};_0x57dba2(++_0x310aa2);}(_0xbdb1,0x12a));var _0x1bdb=function(_0x26371f,_0x3529d6){_0x26371f=_0x26371f-0x0;var _0x7bf77f=_0xbdb1[_0x26371f];return _0x7bf77f;};'use strict';var client=require(_0x1bdb('0x0'));var moment=require(_0x1bdb('0x1'));exports[_0x1bdb('0x2')]=function(_0x4e2d9e){_0x4e2d9e[_0x1bdb('0x3')]=_0x4e2d9e[_0x1bdb('0x4')];return client[_0x1bdb('0x5')](_0x1bdb('0x6'),{'body':_0x4e2d9e,'log':_0x1bdb('0x6')});};exports[_0x1bdb('0x7')]=function(_0x22f21c){return client[_0x1bdb('0x5')](_0x1bdb('0x8'),{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0x22f21c,_0x1bdb('0x9'))['format'](_0x1bdb('0xa')),moment()[_0x1bdb('0xb')](_0x1bdb('0xa'))]}},'raw':![]},'log':_0x1bdb('0xc')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client[_0x1bdb('0x5')](_0x1bdb('0xd'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x1bdb('0xe'))[_0x1bdb('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x1bdb('0xf')]('day')[_0x1bdb('0xb')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x1bdb('0x4')},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports[_0x1bdb('0x10')]=function(){return function(){return client['Request'](_0x1bdb('0x11'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x1bdb('0x12')](_0x1bdb('0xe'))[_0x1bdb('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x1bdb('0xf')]('day')[_0x1bdb('0xb')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':'ivr'},'raw':![]},'log':'GetCampaignHopperHistory'});};}; \ No newline at end of file +var _0xa2c4=['endOf','getCampaignHopperHistory','ivr','moment','campaign','queue','Request','CreateCmHopperHistory','avgHandleTime','subtract','format','YYYY-MM-DD\x20HH:mm:ss','startOf','day'];(function(_0x4e4ded,_0x43fd40){var _0x41ebbb=function(_0x6ae1ad){while(--_0x6ae1ad){_0x4e4ded['push'](_0x4e4ded['shift']());}};_0x41ebbb(++_0x43fd40);}(_0xa2c4,0x1d1));var _0x4a2c=function(_0x499cc5,_0x29a1f9){_0x499cc5=_0x499cc5-0x0;var _0x22419b=_0xa2c4[_0x499cc5];return _0x22419b;};'use strict';var client=require('../client');var moment=require(_0x4a2c('0x0'));exports['createHistory']=function(_0x20b4ff){_0x20b4ff[_0x4a2c('0x1')]=_0x20b4ff[_0x4a2c('0x2')];return client[_0x4a2c('0x3')](_0x4a2c('0x4'),{'body':_0x20b4ff,'log':_0x4a2c('0x4')});};exports[_0x4a2c('0x5')]=function(_0x3394f0){return client['Request']('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0x4a2c('0x6')](_0x3394f0,'minutes')[_0x4a2c('0x7')](_0x4a2c('0x8')),moment()[_0x4a2c('0x7')](_0x4a2c('0x8'))]}},'raw':![]},'log':'GetCmHopperHistory'});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client[_0x4a2c('0x3')]('GetVoiceQueueHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0x4a2c('0x9')](_0x4a2c('0xa'))[_0x4a2c('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x4a2c('0xb')](_0x4a2c('0xa'))[_0x4a2c('0x7')](_0x4a2c('0x8'))]},'campaigntype':'queue'},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports[_0x4a2c('0xc')]=function(){return function(){return client[_0x4a2c('0x3')]('GetCampaignHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0x4a2c('0x9')](_0x4a2c('0xa'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x4a2c('0xb')](_0x4a2c('0xa'))[_0x4a2c('0x7')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x4a2c('0xd')},'raw':![]},'log':'GetCampaignHopperHistory'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 8040b7b..6227724 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 _0xdfdd=['minrate','maxrate','modem','gateway','t38timeout','TrunkId','ListId','key','Trunk','name','active','getFaxAccount','NotifyFaxAccount','../client','getFaxAccounts','Request','GetFaxAccount','description','headerinfo'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0xdfdd,0x104));var _0xddfd=function(_0x169798,_0x230107){_0x169798=_0x169798-0x0;var _0x3faa0f=_0xdfdd[_0x169798];return _0x3faa0f;};'use strict';var client=require(_0xddfd('0x0'));exports[_0xddfd('0x1')]=function(){return function(){return client[_0xddfd('0x2')](_0xddfd('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xddfd('0x4'),'ecm',_0xddfd('0x5'),'localstationid',_0xddfd('0x6'),_0xddfd('0x7'),_0xddfd('0x8'),_0xddfd('0x9'),'faxdetect',_0xddfd('0xa'),'tech',_0xddfd('0xb'),_0xddfd('0xc'),_0xddfd('0xd')],'include':[{'model':_0xddfd('0xe'),'as':_0xddfd('0xe'),'attributes':['id',_0xddfd('0xf'),'callerid',_0xddfd('0x10')]}]},'log':_0xddfd('0x11')});};};exports['notify']=function(_0x415ce4,_0xe22447){return client[_0xddfd('0x2')](_0xddfd('0x12'),{'account':{'id':_0x415ce4},'body':_0xe22447,'log':_0xddfd('0x12')});}; \ No newline at end of file +var _0x583c=['getFaxAccounts','Request','GetFaxAccount','description','ecm','minrate','maxrate','gateway','faxdetect','t38timeout','tech','ListId','key','Trunk','name','callerid','active','getFaxAccount','NotifyFaxAccount','../client'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x583c,0x12b));var _0xc583=function(_0x5a19fc,_0x58f9f4){_0x5a19fc=_0x5a19fc-0x0;var _0x34b413=_0x583c[_0x5a19fc];return _0x34b413;};'use strict';var client=require(_0xc583('0x0'));exports[_0xc583('0x1')]=function(){return function(){return client[_0xc583('0x2')](_0xc583('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xc583('0x4'),_0xc583('0x5'),'headerinfo','localstationid',_0xc583('0x6'),_0xc583('0x7'),'modem',_0xc583('0x8'),_0xc583('0x9'),_0xc583('0xa'),_0xc583('0xb'),'TrunkId',_0xc583('0xc'),_0xc583('0xd')],'include':[{'model':'Trunk','as':_0xc583('0xe'),'attributes':['id',_0xc583('0xf'),_0xc583('0x10'),_0xc583('0x11')]}]},'log':_0xc583('0x12')});};};exports['notify']=function(_0x3437be,_0x1b0fd9){return client['Request'](_0xc583('0x13'),{'account':{'id':_0x3437be},'body':_0x1b0fd9,'log':_0xc583('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index 47ececf..1c2ea1f 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 _0x914d=['Request','UpdateFaxMessage','../client','update'];(function(_0x338ad7,_0x37c306){var _0x566608=function(_0x35ab51){while(--_0x35ab51){_0x338ad7['push'](_0x338ad7['shift']());}};_0x566608(++_0x37c306);}(_0x914d,0x102));var _0xd914=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x914d[_0x413feb];return _0x40ee88;};'use strict';var client=require(_0xd914('0x0'));exports[_0xd914('0x1')]=function(_0x37af14,_0x40bca6){return client[_0xd914('0x2')](_0xd914('0x3'),{'body':_0x40bca6,'options':{'where':{'AttachmentId':_0x37af14}},'log':'UpdateFaxMessage'});}; \ No newline at end of file +var _0x9344=['Request','UpdateFaxMessage','../client'];(function(_0x45a3c6,_0xe758de){var _0x4d5a3c=function(_0x50f659){while(--_0x50f659){_0x45a3c6['push'](_0x45a3c6['shift']());}};_0x4d5a3c(++_0xe758de);}(_0x9344,0x8f));var _0x4934=function(_0x3eda27,_0x2e7a8e){_0x3eda27=_0x3eda27-0x0;var _0x367561=_0x9344[_0x3eda27];return _0x367561;};'use strict';var client=require(_0x4934('0x0'));exports['update']=function(_0x27cbbb,_0x1db7ac){return client[_0x4934('0x1')](_0x4934('0x2'),{'body':_0x1db7ac,'options':{'where':{'AttachmentId':_0x27cbbb}},'log':_0x4934('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index 29629c4..2592d1e 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 _0x3870=['Request','GetDeskAccount','name','description','username','password','remoteUri','authType','type','DeskConfiguration','Configurations','DeskField','Subjects','content','variableName','Variable','Descriptions','key','idField','nameField','customField','Tags','../../client','getDeskAccounts'];(function(_0x5e46e1,_0x3ea3f7){var _0x3a93b8=function(_0x104eb5){while(--_0x104eb5){_0x5e46e1['push'](_0x5e46e1['shift']());}};_0x3a93b8(++_0x3ea3f7);}(_0x3870,0x76));var _0x0387=function(_0x5a90bf,_0x14f39d){_0x5a90bf=_0x5a90bf-0x0;var _0xedfe4c=_0x3870[_0x5a90bf];return _0xedfe4c;};'use strict';var client=require(_0x0387('0x0'));exports[_0x0387('0x1')]=function(){return function(_0x299d67){return client[_0x0387('0x2')](_0x0387('0x3'),{'options':{'raw':![],'attributes':['id',_0x0387('0x4'),_0x0387('0x5'),_0x0387('0x6'),_0x0387('0x7'),_0x0387('0x8'),_0x0387('0x9'),_0x0387('0xa'),'serverUrl'],'include':[{'model':_0x0387('0xb'),'as':_0x0387('0xc'),'attributes':['id',_0x0387('0x4')],'include':[{'model':_0x0387('0xd'),'as':_0x0387('0xe'),'attributes':['id',_0x0387('0xa'),_0x0387('0xf'),_0x0387('0x10')],'include':[{'model':_0x0387('0x11'),'as':_0x0387('0x11'),'attributes':['id',_0x0387('0x4')]}]},{'model':_0x0387('0xd'),'as':_0x0387('0x12'),'attributes':['id',_0x0387('0xa'),_0x0387('0xf'),_0x0387('0x13'),'keyType','keyContent',_0x0387('0x10')],'include':[{'model':_0x0387('0x11'),'as':_0x0387('0x11'),'attributes':['id','name']}]},{'model':'DeskField','as':'Fields','attributes':['id',_0x0387('0xa'),_0x0387('0xf'),_0x0387('0x14'),_0x0387('0x15'),_0x0387('0x16'),'variableName'],'include':[{'model':_0x0387('0x11'),'as':_0x0387('0x11'),'attributes':['id',_0x0387('0x4')]}]},{'model':'Tag','as':_0x0387('0x17'),'attributes':['id',_0x0387('0x4')]}]}]},'log':_0x0387('0x3')});};}; \ No newline at end of file +var _0xf6d8=['content','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','variableName','Tags','GetDeskAccount','../../client','getDeskAccounts','Request','name','username','password','remoteUri','authType','type','serverUrl','DeskConfiguration','Configurations','DeskField','Subjects'];(function(_0x23ae03,_0x38c28a){var _0x5726d2=function(_0x9bae93){while(--_0x9bae93){_0x23ae03['push'](_0x23ae03['shift']());}};_0x5726d2(++_0x38c28a);}(_0xf6d8,0xf6));var _0x8f6d=function(_0x5ca209,_0x137dda){_0x5ca209=_0x5ca209-0x0;var _0x7d7e15=_0xf6d8[_0x5ca209];return _0x7d7e15;};'use strict';var client=require(_0x8f6d('0x0'));exports[_0x8f6d('0x1')]=function(){return function(_0x318ab8){return client[_0x8f6d('0x2')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0x8f6d('0x3'),'description',_0x8f6d('0x4'),_0x8f6d('0x5'),_0x8f6d('0x6'),_0x8f6d('0x7'),_0x8f6d('0x8'),_0x8f6d('0x9')],'include':[{'model':_0x8f6d('0xa'),'as':_0x8f6d('0xb'),'attributes':['id',_0x8f6d('0x3')],'include':[{'model':_0x8f6d('0xc'),'as':_0x8f6d('0xd'),'attributes':['id','type',_0x8f6d('0xe'),'variableName'],'include':[{'model':_0x8f6d('0xf'),'as':'Variable','attributes':['id',_0x8f6d('0x3')]}]},{'model':_0x8f6d('0xc'),'as':_0x8f6d('0x10'),'attributes':['id',_0x8f6d('0x8'),_0x8f6d('0xe'),_0x8f6d('0x11'),_0x8f6d('0x12'),_0x8f6d('0x13'),'variableName'],'include':[{'model':_0x8f6d('0xf'),'as':_0x8f6d('0xf'),'attributes':['id',_0x8f6d('0x3')]}]},{'model':_0x8f6d('0xc'),'as':_0x8f6d('0x14'),'attributes':['id',_0x8f6d('0x8'),'content',_0x8f6d('0x15'),_0x8f6d('0x16'),'customField',_0x8f6d('0x17')],'include':[{'model':_0x8f6d('0xf'),'as':_0x8f6d('0xf'),'attributes':['id',_0x8f6d('0x3')]}]},{'model':'Tag','as':_0x8f6d('0x18'),'attributes':['id','name']}]}]},'log':_0x8f6d('0x19')});};}; \ 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 e87a299..6750640 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 _0x06ef=['remoteUri','tenantId','clientSecret','serverUrl','ticketType','moduleCreate','additionalSearchContact','openNewTab','Dynamics365Field','type','content','Variable','name','Descriptions','key','keyType','variableName','Fields','nameField','customField','CloudProvider','data2','data5','data7','GetDynamics365Account','password'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x06ef,0x185));var _0xf06e=function(_0x3f6d43,_0x4abcdc){_0x3f6d43=_0x3f6d43-0x0;var _0x55fcfc=_0x06ef[_0x3f6d43];return _0x55fcfc;};'use strict';var client=require('../../client');exports['getDynamics365Accounts']=function(){return function(_0x44397a){return client['Request']('GetDynamics365Account',{'options':{'raw':![],'attributes':['id','name','username',_0xf06e('0x0'),_0xf06e('0x1'),_0xf06e('0x2'),'clientId',_0xf06e('0x3'),_0xf06e('0x4'),'description','modernAuthentication'],'include':[{'model':'Dynamics365Configuration','as':'Configurations','attributes':['id','name',_0xf06e('0x5'),_0xf06e('0x6'),_0xf06e('0x7'),_0xf06e('0x8')],'include':[{'model':_0xf06e('0x9'),'as':'Subjects','attributes':['id',_0xf06e('0xa'),_0xf06e('0xb'),'variableName'],'include':[{'model':_0xf06e('0xc'),'as':_0xf06e('0xc'),'attributes':['id',_0xf06e('0xd')]}]},{'model':_0xf06e('0x9'),'as':_0xf06e('0xe'),'attributes':['id',_0xf06e('0xa'),'content',_0xf06e('0xf'),_0xf06e('0x10'),'keyContent',_0xf06e('0x11')],'include':[{'model':_0xf06e('0xc'),'as':'Variable','attributes':['id','name']}]},{'model':'Dynamics365Field','as':_0xf06e('0x12'),'attributes':['id',_0xf06e('0xa'),_0xf06e('0xb'),'idField',_0xf06e('0x13'),_0xf06e('0x14'),_0xf06e('0x11')],'include':[{'model':_0xf06e('0xc'),'as':_0xf06e('0xc'),'attributes':['id',_0xf06e('0xd')]}]}]},{'model':_0xf06e('0x15'),'as':'CloudProvider','attributes':['id',_0xf06e('0x16'),_0xf06e('0x17'),_0xf06e('0x18')]}]},'log':_0xf06e('0x19')});};}; \ No newline at end of file +var _0x9ccd=['data2','data7','GetDynamics365Account','../../client','Request','username','remoteUri','tenantId','clientId','clientSecret','serverUrl','description','modernAuthentication','Dynamics365Configuration','Configurations','name','ticketType','moduleCreate','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','content','variableName','Variable','Descriptions','type','key','Fields','idField','nameField','CloudProvider'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ccd[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xd9cc('0x0'));exports['getDynamics365Accounts']=function(){return function(_0x29ce42){return client[_0xd9cc('0x1')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id','name',_0xd9cc('0x2'),'password',_0xd9cc('0x3'),_0xd9cc('0x4'),_0xd9cc('0x5'),_0xd9cc('0x6'),_0xd9cc('0x7'),_0xd9cc('0x8'),_0xd9cc('0x9')],'include':[{'model':_0xd9cc('0xa'),'as':_0xd9cc('0xb'),'attributes':['id',_0xd9cc('0xc'),_0xd9cc('0xd'),_0xd9cc('0xe'),_0xd9cc('0xf'),_0xd9cc('0x10')],'include':[{'model':_0xd9cc('0x11'),'as':_0xd9cc('0x12'),'attributes':['id','type',_0xd9cc('0x13'),_0xd9cc('0x14')],'include':[{'model':_0xd9cc('0x15'),'as':_0xd9cc('0x15'),'attributes':['id',_0xd9cc('0xc')]}]},{'model':_0xd9cc('0x11'),'as':_0xd9cc('0x16'),'attributes':['id',_0xd9cc('0x17'),'content',_0xd9cc('0x18'),'keyType','keyContent','variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xd9cc('0xc')]}]},{'model':_0xd9cc('0x11'),'as':_0xd9cc('0x19'),'attributes':['id',_0xd9cc('0x17'),_0xd9cc('0x13'),_0xd9cc('0x1a'),_0xd9cc('0x1b'),'customField',_0xd9cc('0x14')],'include':[{'model':_0xd9cc('0x15'),'as':'Variable','attributes':['id',_0xd9cc('0xc')]}]}]},{'model':_0xd9cc('0x1c'),'as':_0xd9cc('0x1c'),'attributes':['id',_0xd9cc('0x1d'),'data5',_0xd9cc('0x1e')]}]},'log':_0xd9cc('0x1f')});};}; \ 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 b23792f..c0b07d1 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 _0x7292=['getFreshdeskAccounts','Request','GetFreshdeskAccount','name','username','remoteUri','serverUrl','FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects','variableName','Variable','Descriptions','type','content','key','keyType','keyContent','idField','nameField','customField','../../client'];(function(_0x4110af,_0x54221f){var _0x31b28f=function(_0x1c2a0c){while(--_0x1c2a0c){_0x4110af['push'](_0x4110af['shift']());}};_0x31b28f(++_0x54221f);}(_0x7292,0x107));var _0x2729=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x7292[_0x2b4411];return _0x8e41ef;};'use strict';var client=require(_0x2729('0x0'));exports[_0x2729('0x1')]=function(){return function(_0x3df7a6){return client[_0x2729('0x2')](_0x2729('0x3'),{'options':{'raw':![],'attributes':['id',_0x2729('0x4'),_0x2729('0x5'),'apiKey',_0x2729('0x6'),_0x2729('0x7')],'include':[{'model':_0x2729('0x8'),'as':_0x2729('0x9'),'attributes':['id',_0x2729('0x4')],'include':[{'model':_0x2729('0xa'),'attributes':['id',_0x2729('0x4')]},{'model':_0x2729('0xb'),'as':_0x2729('0xc'),'attributes':['id','type','content',_0x2729('0xd')],'include':[{'model':_0x2729('0xe'),'as':'Variable','attributes':['id',_0x2729('0x4')]}]},{'model':_0x2729('0xb'),'as':_0x2729('0xf'),'attributes':['id',_0x2729('0x10'),_0x2729('0x11'),_0x2729('0x12'),_0x2729('0x13'),_0x2729('0x14'),_0x2729('0xd')],'include':[{'model':'Variable','as':_0x2729('0xe'),'attributes':['id',_0x2729('0x4')]}]},{'model':_0x2729('0xb'),'as':'Fields','attributes':['id',_0x2729('0x10'),_0x2729('0x11'),_0x2729('0x15'),_0x2729('0x16'),_0x2729('0x17'),_0x2729('0xd')],'include':[{'model':_0x2729('0xe'),'as':_0x2729('0xe'),'attributes':['id','name']}]}]}]},'log':_0x2729('0x3')});};}; \ No newline at end of file +var _0xd9dc=['key','keyContent','Fields','nameField','customField','variableName','getFreshdeskAccounts','GetFreshdeskAccount','name','username','remoteUri','serverUrl','FreshdeskConfiguration','Configurations','FreshdeskField','Subjects','type','content','Variable','Descriptions'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0xd9dc,0x1be));var _0xcd9d=function(_0x278b30,_0x5cf8a3){_0x278b30=_0x278b30-0x0;var _0x535b59=_0xd9dc[_0x278b30];return _0x535b59;};'use strict';var client=require('../../client');exports[_0xcd9d('0x0')]=function(){return function(_0xc135c5){return client['Request'](_0xcd9d('0x1'),{'options':{'raw':![],'attributes':['id',_0xcd9d('0x2'),_0xcd9d('0x3'),'apiKey',_0xcd9d('0x4'),_0xcd9d('0x5')],'include':[{'model':_0xcd9d('0x6'),'as':_0xcd9d('0x7'),'attributes':['id',_0xcd9d('0x2')],'include':[{'model':'Tag','attributes':['id',_0xcd9d('0x2')]},{'model':_0xcd9d('0x8'),'as':_0xcd9d('0x9'),'attributes':['id',_0xcd9d('0xa'),_0xcd9d('0xb'),'variableName'],'include':[{'model':_0xcd9d('0xc'),'as':_0xcd9d('0xc'),'attributes':['id',_0xcd9d('0x2')]}]},{'model':_0xcd9d('0x8'),'as':_0xcd9d('0xd'),'attributes':['id',_0xcd9d('0xa'),_0xcd9d('0xb'),_0xcd9d('0xe'),'keyType',_0xcd9d('0xf'),'variableName'],'include':[{'model':_0xcd9d('0xc'),'as':'Variable','attributes':['id',_0xcd9d('0x2')]}]},{'model':_0xcd9d('0x8'),'as':_0xcd9d('0x10'),'attributes':['id','type',_0xcd9d('0xb'),'idField',_0xcd9d('0x11'),_0xcd9d('0x12'),_0xcd9d('0x13')],'include':[{'model':'Variable','as':_0xcd9d('0xc'),'attributes':['id',_0xcd9d('0x2')]}]}]}]},'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 d0dee7d..17d90f0 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 _0x3f8a=['remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','Subjects','type','content','variableName','Variable','key','keyType','GetFreshsalesccount','../../client','getFreshsalesAccounts','Request','name','username','apiKey'];(function(_0x2128cd,_0x112f9a){var _0x4f8d8b=function(_0x3c63fc){while(--_0x3c63fc){_0x2128cd['push'](_0x2128cd['shift']());}};_0x4f8d8b(++_0x112f9a);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x331204,_0x1128f2){_0x331204=_0x331204-0x0;var _0x578012=_0x3f8a[_0x331204];return _0x578012;};'use strict';var client=require(_0xa3f8('0x0'));exports[_0xa3f8('0x1')]=function(){return function(_0x29d753){return client[_0xa3f8('0x2')]('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id',_0xa3f8('0x3'),_0xa3f8('0x4'),_0xa3f8('0x5'),_0xa3f8('0x6'),_0xa3f8('0x7')],'include':[{'model':_0xa3f8('0x8'),'as':_0xa3f8('0x9'),'attributes':['id',_0xa3f8('0x3')],'include':[{'model':_0xa3f8('0xa'),'as':_0xa3f8('0xb'),'attributes':['id',_0xa3f8('0xc'),_0xa3f8('0xd'),_0xa3f8('0xe')],'include':[{'model':_0xa3f8('0xf'),'as':_0xa3f8('0xf'),'attributes':['id',_0xa3f8('0x3')]}]},{'model':_0xa3f8('0xa'),'as':'Descriptions','attributes':['id',_0xa3f8('0xc'),_0xa3f8('0xd'),_0xa3f8('0x10'),_0xa3f8('0x11'),'keyContent',_0xa3f8('0xe')],'include':[{'model':_0xa3f8('0xf'),'as':_0xa3f8('0xf'),'attributes':['id',_0xa3f8('0x3')]}]}]}]},'log':_0xa3f8('0x12')});};}; \ No newline at end of file +var _0xaa37=['getFreshsalesAccounts','Request','name','username','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','Subjects','content','variableName','Variable','Descriptions','type','key','../../client'];(function(_0x227bf0,_0x5167c0){var _0x1b84d4=function(_0xb40308){while(--_0xb40308){_0x227bf0['push'](_0x227bf0['shift']());}};_0x1b84d4(++_0x5167c0);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xaa37[_0x2b5eae];return _0x5f3ac9;};'use strict';var client=require(_0x7aa3('0x0'));exports[_0x7aa3('0x1')]=function(){return function(_0x1142b8){return client[_0x7aa3('0x2')]('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id',_0x7aa3('0x3'),_0x7aa3('0x4'),_0x7aa3('0x5'),_0x7aa3('0x6'),_0x7aa3('0x7')],'include':[{'model':_0x7aa3('0x8'),'as':_0x7aa3('0x9'),'attributes':['id','name'],'include':[{'model':_0x7aa3('0xa'),'as':_0x7aa3('0xb'),'attributes':['id','type',_0x7aa3('0xc'),_0x7aa3('0xd')],'include':[{'model':_0x7aa3('0xe'),'as':'Variable','attributes':['id',_0x7aa3('0x3')]}]},{'model':_0x7aa3('0xa'),'as':_0x7aa3('0xf'),'attributes':['id',_0x7aa3('0x10'),_0x7aa3('0xc'),_0x7aa3('0x11'),'keyType','keyContent',_0x7aa3('0xd')],'include':[{'model':'Variable','as':_0x7aa3('0xe'),'attributes':['id',_0x7aa3('0x3')]}]}]}]},'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 b050f00..406a8ec 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 _0x5078=['name','username','remoteUri','clientId','clientSecret','serverUrl','type','SalesforceConfiguration','Configurations','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchLead','Variable','Descriptions','SalesforceField','Fields','getSalesforceAccounts','Request','GetSalesforceAccount'];(function(_0x2c44c7,_0x2ff92c){var _0x566482=function(_0x25f753){while(--_0x25f753){_0x2c44c7['push'](_0x2c44c7['shift']());}};_0x566482(++_0x2ff92c);}(_0x5078,0x147));var _0x8507=function(_0x5ee3e1,_0x3bcd2e){_0x5ee3e1=_0x5ee3e1-0x0;var _0x2bfc83=_0x5078[_0x5ee3e1];return _0x2bfc83;};'use strict';var client=require('../../client');exports[_0x8507('0x0')]=function(){return function(_0x2f35c0){return client[_0x8507('0x1')](_0x8507('0x2'),{'options':{'raw':![],'attributes':['id',_0x8507('0x3'),_0x8507('0x4'),'password',_0x8507('0x5'),_0x8507('0x6'),_0x8507('0x7'),'securityToken',_0x8507('0x8'),_0x8507('0x9')],'include':[{'model':_0x8507('0xa'),'as':_0x8507('0xb'),'attributes':['id','name',_0x8507('0xc'),_0x8507('0xd'),_0x8507('0xe'),_0x8507('0xf'),_0x8507('0x10'),'additionalSearchContact',_0x8507('0x11')],'include':[{'model':'SalesforceField','as':'Subjects','include':[{'model':_0x8507('0x12'),'as':'Variable','attributes':['id',_0x8507('0x3')]}]},{'model':'SalesforceField','as':_0x8507('0x13'),'include':[{'model':_0x8507('0x12'),'as':_0x8507('0x12'),'attributes':['id',_0x8507('0x3')]}]},{'model':_0x8507('0x14'),'as':_0x8507('0x15'),'include':[{'model':_0x8507('0x12'),'as':_0x8507('0x12'),'attributes':['id',_0x8507('0x3')]}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file +var _0xf277=['name','username','password','remoteUri','clientId','securityToken','type','SalesforceConfiguration','moduleSearch','ticketType','leadId','additionalSearchAccount','additionalSearchContact','Subjects','Variable','SalesforceField','Descriptions','Fields','GetSalesforceAccount','../../client','getSalesforceAccounts','Request'];(function(_0x33be9d,_0x41618e){var _0x4a9267=function(_0x4f0e70){while(--_0x4f0e70){_0x33be9d['push'](_0x33be9d['shift']());}};_0x4a9267(++_0x41618e);}(_0xf277,0x1e1));var _0x7f27=function(_0x20be1e,_0x387f91){_0x20be1e=_0x20be1e-0x0;var _0x53e135=_0xf277[_0x20be1e];return _0x53e135;};'use strict';var client=require(_0x7f27('0x0'));exports[_0x7f27('0x1')]=function(){return function(_0x4b4ebf){return client[_0x7f27('0x2')]('GetSalesforceAccount',{'options':{'raw':![],'attributes':['id',_0x7f27('0x3'),_0x7f27('0x4'),_0x7f27('0x5'),_0x7f27('0x6'),_0x7f27('0x7'),'clientSecret',_0x7f27('0x8'),'serverUrl',_0x7f27('0x9')],'include':[{'model':_0x7f27('0xa'),'as':'Configurations','attributes':['id',_0x7f27('0x3'),_0x7f27('0xb'),'moduleCreate',_0x7f27('0xc'),_0x7f27('0xd'),_0x7f27('0xe'),_0x7f27('0xf'),'additionalSearchLead'],'include':[{'model':'SalesforceField','as':_0x7f27('0x10'),'include':[{'model':'Variable','as':_0x7f27('0x11'),'attributes':['id',_0x7f27('0x3')]}]},{'model':_0x7f27('0x12'),'as':_0x7f27('0x13'),'include':[{'model':_0x7f27('0x11'),'as':_0x7f27('0x11'),'attributes':['id','name']}]},{'model':_0x7f27('0x12'),'as':_0x7f27('0x14'),'include':[{'model':'Variable','as':_0x7f27('0x11'),'attributes':['id',_0x7f27('0x3')]}]}]}]},'log':_0x7f27('0x15')});};}; \ 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 ef54044..4e0d414 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 _0x4137=['Request','GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','Configurations','ServicenowField','Subjects','content','variableName','Variable','Descriptions','type','key','keyType','Fields','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts'];(function(_0x2b0188,_0x2e6f26){var _0x30489c=function(_0x18c912){while(--_0x18c912){_0x2b0188['push'](_0x2b0188['shift']());}};_0x30489c(++_0x2e6f26);}(_0x4137,0xf8));var _0x7413=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4137[_0x4e676e];return _0x336a3c;};'use strict';var client=require(_0x7413('0x0'));exports[_0x7413('0x1')]=function(){return function(_0x370399){return client[_0x7413('0x2')](_0x7413('0x3'),{'options':{'raw':![],'attributes':['id',_0x7413('0x4'),_0x7413('0x5'),_0x7413('0x6'),_0x7413('0x7'),_0x7413('0x8'),_0x7413('0x9'),_0x7413('0xa')],'include':[{'model':'ServicenowConfiguration','as':_0x7413('0xb'),'attributes':['id',_0x7413('0x4')],'include':[{'model':_0x7413('0xc'),'as':_0x7413('0xd'),'attributes':['id','type',_0x7413('0xe'),_0x7413('0xf')],'include':[{'model':'Variable','as':_0x7413('0x10'),'attributes':['id',_0x7413('0x4')]}]},{'model':'ServicenowField','as':_0x7413('0x11'),'attributes':['id',_0x7413('0x12'),_0x7413('0xe'),_0x7413('0x13'),_0x7413('0x14'),'keyContent',_0x7413('0xf')],'include':[{'model':_0x7413('0x10'),'as':'Variable','attributes':['id',_0x7413('0x4')]}]},{'model':_0x7413('0xc'),'as':_0x7413('0x15'),'attributes':['id','type','content','idField',_0x7413('0x16'),_0x7413('0x17'),'variableName'],'include':[{'model':_0x7413('0x10'),'as':_0x7413('0x10'),'attributes':['id','name']}]}]}]},'log':_0x7413('0x18')});};}; \ No newline at end of file +var _0x7a54=['GetServicenowAccount','name','username','password','email','remoteUri','serverUrl','Configurations','ServicenowField','Subjects','content','type','keyType','keyContent','variableName','Variable','idField','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0x7a54,0x106));var _0x47a5=function(_0x803cea,_0x4fe9e8){_0x803cea=_0x803cea-0x0;var _0x313707=_0x7a54[_0x803cea];return _0x313707;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(){return function(_0x44b31e){return client['Request'](_0x47a5('0x2'),{'options':{'raw':![],'attributes':['id',_0x47a5('0x3'),'description',_0x47a5('0x4'),_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8')],'include':[{'model':'ServicenowConfiguration','as':_0x47a5('0x9'),'attributes':['id','name'],'include':[{'model':_0x47a5('0xa'),'as':_0x47a5('0xb'),'attributes':['id','type',_0x47a5('0xc'),'variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x47a5('0x3')]}]},{'model':_0x47a5('0xa'),'as':'Descriptions','attributes':['id',_0x47a5('0xd'),'content','key',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'include':[{'model':_0x47a5('0x11'),'as':_0x47a5('0x11'),'attributes':['id',_0x47a5('0x3')]}]},{'model':_0x47a5('0xa'),'as':'Fields','attributes':['id',_0x47a5('0xd'),_0x47a5('0xc'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x10')],'include':[{'model':_0x47a5('0x11'),'as':_0x47a5('0x11'),'attributes':['id','name']}]}]}]},'log':_0x47a5('0x15')});};}; \ 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 065fdb4..e61521d 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['nameField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','username','password','serverUrl','Configurations','type','content','variableName','Variable','key','keyType','Fields','idField'];(function(_0x474a57,_0x459d1b){var _0x5e845c=function(_0x43ae0a){while(--_0x43ae0a){_0x474a57['push'](_0x474a57['shift']());}};_0x5e845c(++_0x459d1b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var client=require('../../client');exports[_0x65f6('0x0')]=function(){return function(_0x4a3887){return client[_0x65f6('0x1')](_0x65f6('0x2'),{'options':{'raw':![],'attributes':['id',_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'remoteUri',_0x65f6('0x6')],'include':[{'model':'SugarcrmConfiguration','as':_0x65f6('0x7'),'attributes':['id',_0x65f6('0x3')],'include':[{'model':'SugarcrmField','as':'Subjects','attributes':['id',_0x65f6('0x8'),_0x65f6('0x9'),_0x65f6('0xa')],'include':[{'model':_0x65f6('0xb'),'as':_0x65f6('0xb'),'attributes':['id',_0x65f6('0x3')]}]},{'model':'SugarcrmField','as':'Descriptions','attributes':['id',_0x65f6('0x8'),_0x65f6('0x9'),_0x65f6('0xc'),_0x65f6('0xd'),'keyContent',_0x65f6('0xa')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x65f6('0x3')]}]},{'model':'SugarcrmField','as':_0x65f6('0xe'),'attributes':['id','type',_0x65f6('0x9'),_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0xa')],'include':[{'model':_0x65f6('0xb'),'as':_0x65f6('0xb'),'attributes':['id',_0x65f6('0x3')]}]}]}]},'log':_0x65f6('0x2')});};}; \ No newline at end of file +var _0x5f66=['nameField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','username','password','serverUrl','Configurations','type','content','variableName','Variable','key','keyType','Fields','idField'];(function(_0xaa35a5,_0x505bda){var _0x4e58eb=function(_0x43bb79){while(--_0x43bb79){_0xaa35a5['push'](_0xaa35a5['shift']());}};_0x4e58eb(++_0x505bda);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var client=require('../../client');exports[_0x65f6('0x0')]=function(){return function(_0x4a3887){return client[_0x65f6('0x1')](_0x65f6('0x2'),{'options':{'raw':![],'attributes':['id',_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'remoteUri',_0x65f6('0x6')],'include':[{'model':'SugarcrmConfiguration','as':_0x65f6('0x7'),'attributes':['id',_0x65f6('0x3')],'include':[{'model':'SugarcrmField','as':'Subjects','attributes':['id',_0x65f6('0x8'),_0x65f6('0x9'),_0x65f6('0xa')],'include':[{'model':_0x65f6('0xb'),'as':_0x65f6('0xb'),'attributes':['id',_0x65f6('0x3')]}]},{'model':'SugarcrmField','as':'Descriptions','attributes':['id',_0x65f6('0x8'),_0x65f6('0x9'),_0x65f6('0xc'),_0x65f6('0xd'),'keyContent',_0x65f6('0xa')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x65f6('0x3')]}]},{'model':'SugarcrmField','as':_0x65f6('0xe'),'attributes':['id','type',_0x65f6('0x9'),_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0xa')],'include':[{'model':_0x65f6('0xb'),'as':_0x65f6('0xb'),'attributes':['id',_0x65f6('0x3')]}]}]}]},'log':_0x65f6('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index d50d36b..0582a0d 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 _0xbd94=['Configurations','VtigerField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','Fields','idField','../../client','Request','GetVtigerAccount','name','description','username','serverUrl','VtigerConfiguration'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd94,0x19c));var _0x4bd9=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xbd94[_0x36ed48];return _0x51c63a;};'use strict';var client=require(_0x4bd9('0x0'));exports['getVtigerAccounts']=function(){return function(_0x289b84){return client[_0x4bd9('0x1')](_0x4bd9('0x2'),{'options':{'raw':![],'attributes':['id',_0x4bd9('0x3'),_0x4bd9('0x4'),_0x4bd9('0x5'),'accessKey','remoteUri',_0x4bd9('0x6')],'include':[{'model':_0x4bd9('0x7'),'as':_0x4bd9('0x8'),'attributes':['id','name'],'include':[{'model':_0x4bd9('0x9'),'as':_0x4bd9('0xa'),'attributes':['id',_0x4bd9('0xb'),_0x4bd9('0xc'),_0x4bd9('0xd')],'include':[{'model':_0x4bd9('0xe'),'as':_0x4bd9('0xe'),'attributes':['id',_0x4bd9('0x3')]}]},{'model':'VtigerField','as':_0x4bd9('0xf'),'attributes':['id',_0x4bd9('0xb'),_0x4bd9('0xc'),_0x4bd9('0x10'),_0x4bd9('0x11'),'keyContent','variableName'],'include':[{'model':_0x4bd9('0xe'),'as':_0x4bd9('0xe'),'attributes':['id',_0x4bd9('0x3')]}]},{'model':_0x4bd9('0x9'),'as':_0x4bd9('0x12'),'attributes':['id',_0x4bd9('0xb'),_0x4bd9('0xc'),_0x4bd9('0x13'),'nameField','customField','variableName'],'include':[{'model':_0x4bd9('0xe'),'as':_0x4bd9('0xe'),'attributes':['id','name']}]}]}]},'log':'GetVtigerAccount'});};}; \ No newline at end of file +var _0x4fff=['nameField','customField','../../client','getVtigerAccounts','GetVtigerAccount','name','description','username','accessKey','VtigerConfiguration','VtigerField','Subjects','content','variableName','Variable','Descriptions','type','keyType','Fields','idField'];(function(_0x489846,_0x90a344){var _0x396b13=function(_0x47a872){while(--_0x47a872){_0x489846['push'](_0x489846['shift']());}};_0x396b13(++_0x90a344);}(_0x4fff,0x156));var _0xf4ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4fff[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf4ff('0x0'));exports[_0xf4ff('0x1')]=function(){return function(_0x2df855){return client['Request'](_0xf4ff('0x2'),{'options':{'raw':![],'attributes':['id',_0xf4ff('0x3'),_0xf4ff('0x4'),_0xf4ff('0x5'),_0xf4ff('0x6'),'remoteUri','serverUrl'],'include':[{'model':_0xf4ff('0x7'),'as':'Configurations','attributes':['id','name'],'include':[{'model':_0xf4ff('0x8'),'as':_0xf4ff('0x9'),'attributes':['id','type',_0xf4ff('0xa'),_0xf4ff('0xb')],'include':[{'model':_0xf4ff('0xc'),'as':_0xf4ff('0xc'),'attributes':['id','name']}]},{'model':_0xf4ff('0x8'),'as':_0xf4ff('0xd'),'attributes':['id',_0xf4ff('0xe'),_0xf4ff('0xa'),'key',_0xf4ff('0xf'),'keyContent',_0xf4ff('0xb')],'include':[{'model':_0xf4ff('0xc'),'as':_0xf4ff('0xc'),'attributes':['id',_0xf4ff('0x3')]}]},{'model':_0xf4ff('0x8'),'as':_0xf4ff('0x10'),'attributes':['id',_0xf4ff('0xe'),_0xf4ff('0xa'),_0xf4ff('0x11'),_0xf4ff('0x12'),_0xf4ff('0x13'),_0xf4ff('0xb')],'include':[{'model':_0xf4ff('0xc'),'as':_0xf4ff('0xc'),'attributes':['id',_0xf4ff('0x3')]}]}]}]},'log':_0xf4ff('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index 918fa31..0c7a2b7 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 _0x8ead=['customField','../../client','getZendeskAccounts','GetZendeskAccount','token','remoteUri','authType','serverUrl','type','ZendeskConfiguration','Configurations','Tag','name','ZendeskField','Subjects','content','variableName','Variable','Descriptions','key','keyType','keyContent'];(function(_0x969114,_0x413c23){var _0x598c67=function(_0xbb2975){while(--_0xbb2975){_0x969114['push'](_0x969114['shift']());}};_0x598c67(++_0x413c23);}(_0x8ead,0xf3));var _0xd8ea=function(_0x2d6c59,_0x45be31){_0x2d6c59=_0x2d6c59-0x0;var _0x121b47=_0x8ead[_0x2d6c59];return _0x121b47;};'use strict';var client=require(_0xd8ea('0x0'));exports[_0xd8ea('0x1')]=function(){return function(_0x9f6ae8){return client['Request'](_0xd8ea('0x2'),{'options':{'raw':![],'attributes':['id','name','username','password',_0xd8ea('0x3'),_0xd8ea('0x4'),_0xd8ea('0x5'),_0xd8ea('0x6'),_0xd8ea('0x7')],'include':[{'model':_0xd8ea('0x8'),'as':_0xd8ea('0x9'),'attributes':['id','name'],'include':[{'model':_0xd8ea('0xa'),'attributes':['id',_0xd8ea('0xb')]},{'model':_0xd8ea('0xc'),'as':_0xd8ea('0xd'),'attributes':['id',_0xd8ea('0x7'),_0xd8ea('0xe'),_0xd8ea('0xf')],'include':[{'model':'Variable','as':_0xd8ea('0x10'),'attributes':['id','name']}]},{'model':_0xd8ea('0xc'),'as':_0xd8ea('0x11'),'attributes':['id',_0xd8ea('0x7'),'content',_0xd8ea('0x12'),_0xd8ea('0x13'),_0xd8ea('0x14'),'variableName'],'include':[{'model':_0xd8ea('0x10'),'as':_0xd8ea('0x10'),'attributes':['id',_0xd8ea('0xb')]}]},{'model':_0xd8ea('0xc'),'as':'Fields','attributes':['id',_0xd8ea('0x7'),_0xd8ea('0xe'),'idField','nameField',_0xd8ea('0x15'),_0xd8ea('0xf')],'include':[{'model':_0xd8ea('0x10'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0xd8ea('0x2')});};}; \ No newline at end of file +var _0xfdc7=['name','token','remoteUri','authType','serverUrl','type','ZendeskConfiguration','Tag','ZendeskField','variableName','Variable','Descriptions','content','key','keyContent','Fields','idField','nameField','customField','GetZendeskAccount','../../client','getZendeskAccounts','Request'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xfdc7,0xcc));var _0x7fdc=function(_0x3a05a6,_0x5a2916){_0x3a05a6=_0x3a05a6-0x0;var _0x55a922=_0xfdc7[_0x3a05a6];return _0x55a922;};'use strict';var client=require(_0x7fdc('0x0'));exports[_0x7fdc('0x1')]=function(){return function(_0x3c6c68){return client[_0x7fdc('0x2')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id',_0x7fdc('0x3'),'username','password',_0x7fdc('0x4'),_0x7fdc('0x5'),_0x7fdc('0x6'),_0x7fdc('0x7'),_0x7fdc('0x8')],'include':[{'model':_0x7fdc('0x9'),'as':'Configurations','attributes':['id','name'],'include':[{'model':_0x7fdc('0xa'),'attributes':['id','name']},{'model':_0x7fdc('0xb'),'as':'Subjects','attributes':['id',_0x7fdc('0x8'),'content',_0x7fdc('0xc')],'include':[{'model':_0x7fdc('0xd'),'as':_0x7fdc('0xd'),'attributes':['id',_0x7fdc('0x3')]}]},{'model':_0x7fdc('0xb'),'as':_0x7fdc('0xe'),'attributes':['id','type',_0x7fdc('0xf'),_0x7fdc('0x10'),'keyType',_0x7fdc('0x11'),_0x7fdc('0xc')],'include':[{'model':_0x7fdc('0xd'),'as':_0x7fdc('0xd'),'attributes':['id',_0x7fdc('0x3')]}]},{'model':_0x7fdc('0xb'),'as':_0x7fdc('0x12'),'attributes':['id',_0x7fdc('0x8'),_0x7fdc('0xf'),_0x7fdc('0x13'),_0x7fdc('0x14'),_0x7fdc('0x15'),_0x7fdc('0xc')],'include':[{'model':_0x7fdc('0xd'),'as':_0x7fdc('0xd'),'attributes':['id',_0x7fdc('0x3')]}]}]}]},'log':_0x7fdc('0x16')});};}; \ 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 77abee5..cedfd5d 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 _0x9a7a=['variableName','Variable','Descriptions','type','key','keyType','keyContent','Fields','idField','nameField','customField','../../client','getZohoAccounts','Request','GetZohoAccount','description','clientId','serverUrl','name','moduleCreate','moduleSearch','Subjects','content'];(function(_0x2e842f,_0xfe73e3){var _0x4a9f5e=function(_0x17390c){while(--_0x17390c){_0x2e842f['push'](_0x2e842f['shift']());}};_0x4a9f5e(++_0xfe73e3);}(_0x9a7a,0x1ee));var _0xa9a7=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0x9a7a[_0x316c42];return _0x2b38f7;};'use strict';var client=require(_0xa9a7('0x0'));exports[_0xa9a7('0x1')]=function(){return function(_0x3bcd3b){return client[_0xa9a7('0x2')](_0xa9a7('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xa9a7('0x4'),'host','zone',_0xa9a7('0x5'),'clientSecret',_0xa9a7('0x6'),'code','refreshToken'],'include':[{'model':'ZohoConfiguration','as':'Configurations','attributes':['id',_0xa9a7('0x7'),_0xa9a7('0x8'),_0xa9a7('0x9'),'description'],'include':[{'model':'ZohoField','as':_0xa9a7('0xa'),'attributes':['id','type',_0xa9a7('0xb'),_0xa9a7('0xc')],'include':[{'model':'Variable','as':_0xa9a7('0xd'),'attributes':['id',_0xa9a7('0x7')]}]},{'model':'ZohoField','as':_0xa9a7('0xe'),'attributes':['id',_0xa9a7('0xf'),_0xa9a7('0xb'),_0xa9a7('0x10'),_0xa9a7('0x11'),_0xa9a7('0x12'),_0xa9a7('0xc')],'include':[{'model':_0xa9a7('0xd'),'as':'Variable','attributes':['id',_0xa9a7('0x7')]}]},{'model':'ZohoField','as':_0xa9a7('0x13'),'attributes':['id',_0xa9a7('0xf'),'content',_0xa9a7('0x14'),_0xa9a7('0x15'),_0xa9a7('0x16'),_0xa9a7('0xc')],'include':[{'model':_0xa9a7('0xd'),'as':'Variable','attributes':['id',_0xa9a7('0x7')]}]}]}]},'log':_0xa9a7('0x3')});};}; \ No newline at end of file +var _0xb42e=['ZohoConfiguration','Configurations','moduleCreate','moduleSearch','ZohoField','Subjects','type','content','variableName','Variable','Descriptions','key','keyContent','idField','nameField','customField','../../client','getZohoAccounts','Request','GetZohoAccount','name','description','host','zone','clientSecret','code','refreshToken'];(function(_0xa22176,_0x5d9be3){var _0x4cc99a=function(_0xaf48ba){while(--_0xaf48ba){_0xa22176['push'](_0xa22176['shift']());}};_0x4cc99a(++_0x5d9be3);}(_0xb42e,0x154));var _0xeb42=function(_0x2a558d,_0x2df0ff){_0x2a558d=_0x2a558d-0x0;var _0xa7bc9c=_0xb42e[_0x2a558d];return _0xa7bc9c;};'use strict';var client=require(_0xeb42('0x0'));exports[_0xeb42('0x1')]=function(){return function(_0x29ed47){return client[_0xeb42('0x2')](_0xeb42('0x3'),{'options':{'raw':![],'attributes':['id',_0xeb42('0x4'),_0xeb42('0x5'),_0xeb42('0x6'),_0xeb42('0x7'),'clientId',_0xeb42('0x8'),'serverUrl',_0xeb42('0x9'),_0xeb42('0xa')],'include':[{'model':_0xeb42('0xb'),'as':_0xeb42('0xc'),'attributes':['id','name',_0xeb42('0xd'),_0xeb42('0xe'),_0xeb42('0x5')],'include':[{'model':_0xeb42('0xf'),'as':_0xeb42('0x10'),'attributes':['id',_0xeb42('0x11'),_0xeb42('0x12'),_0xeb42('0x13')],'include':[{'model':_0xeb42('0x14'),'as':_0xeb42('0x14'),'attributes':['id',_0xeb42('0x4')]}]},{'model':_0xeb42('0xf'),'as':_0xeb42('0x15'),'attributes':['id',_0xeb42('0x11'),_0xeb42('0x12'),_0xeb42('0x16'),'keyType',_0xeb42('0x17'),'variableName'],'include':[{'model':_0xeb42('0x14'),'as':_0xeb42('0x14'),'attributes':['id','name']}]},{'model':'ZohoField','as':'Fields','attributes':['id',_0xeb42('0x11'),_0xeb42('0x12'),_0xeb42('0x18'),_0xeb42('0x19'),_0xeb42('0x1a'),_0xeb42('0x13')],'include':[{'model':_0xeb42('0x14'),'as':_0xeb42('0x14'),'attributes':['id','name']}]}]}]},'log':_0xeb42('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 11d5e51..93b0185 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 _0xfe79=['Request','IntervalIftime','intervalIftime','trim','silly','intervalIftime\x20called\x20with','length','every','number','string','map','interval','concat'];(function(_0x540132,_0x1daa85){var _0x489b42=function(_0x456048){while(--_0x456048){_0x540132['push'](_0x540132['shift']());}};_0x489b42(++_0x1daa85);}(_0xfe79,0x121));var _0x9fe7=function(_0x3f25db,_0x1d3686){_0x3f25db=_0x3f25db-0x0;var _0x54f29d=_0xfe79[_0x3f25db];return _0x54f29d;};var logger=require('../../../config/logger')('dialer');var client=require('../client');function intervalIftime(_0x2f3893,_0x2c1d05){const _0x3c364b=new Error()['stack']['replace'](/^Error/,'')[_0x9fe7('0x0')]();logger[_0x9fe7('0x1')](_0x9fe7('0x2'),_0x2f3893,_0x2c1d05,_0x3c364b);const _0x597d9f=Array['isArray'](_0x2f3893);if(!_0x2f3893||_0x597d9f&&_0x2f3893[_0x9fe7('0x3')]===0x0){return Promise['resolve'](![]);}else{var _0x50b991=[];var _0x592de9=[];var _0xd87364=_0x597d9f?_0x2f3893:[_0x2f3893];var _0x2f3249=_0xd87364[_0x9fe7('0x4')](function(_0x1c5fd8){return typeof _0x1c5fd8===_0x9fe7('0x5');});var _0x204492=_0xd87364[_0x9fe7('0x4')](function(_0xc4d375){return typeof _0xc4d375===_0x9fe7('0x6');});if(!_0x2f3249&&!_0x204492){_0x50b991=_0xd87364['map'](function(_0x39c21c){return _0x39c21c['id'];});if(_0x50b991[_0x9fe7('0x3')]===0x0){_0x592de9=_0xd87364[_0x9fe7('0x7')](function(_0x13e0a1){return _0x13e0a1[_0x9fe7('0x8')];});}}else{if(_0x2f3249){_0x50b991=_0x50b991[_0x9fe7('0x9')](_0xd87364);}if(_0x204492){_0x592de9=_0x592de9[_0x9fe7('0x9')](_0xd87364);}}return client[_0x9fe7('0xa')](_0x9fe7('0xb'),{'intervalIds':_0x50b991,'intervals':_0x592de9,'timezone':_0x2c1d05,'log':_0x9fe7('0xb')});}}exports[_0x9fe7('0xc')]=intervalIftime; \ No newline at end of file +var _0x641b=['string','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','stack','silly','isArray','length','resolve','every','number'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x641b,0x1b8));var _0xb641=function(_0x1ac7bc,_0x367216){_0x1ac7bc=_0x1ac7bc-0x0;var _0x34c9d2=_0x641b[_0x1ac7bc];return _0x34c9d2;};var logger=require(_0xb641('0x0'))(_0xb641('0x1'));var client=require(_0xb641('0x2'));function intervalIftime(_0x1899cb,_0x38348c){const _0x44c2dc=new Error()[_0xb641('0x3')]['replace'](/^Error/,'')['trim']();logger[_0xb641('0x4')]('intervalIftime\x20called\x20with',_0x1899cb,_0x38348c,_0x44c2dc);const _0x3240b5=Array[_0xb641('0x5')](_0x1899cb);if(!_0x1899cb||_0x3240b5&&_0x1899cb[_0xb641('0x6')]===0x0){return Promise[_0xb641('0x7')](![]);}else{var _0x3f8db3=[];var _0x279b22=[];var _0x3f755e=_0x3240b5?_0x1899cb:[_0x1899cb];var _0x378dde=_0x3f755e[_0xb641('0x8')](function(_0x3bbb2c){return typeof _0x3bbb2c===_0xb641('0x9');});var _0x413c9e=_0x3f755e[_0xb641('0x8')](function(_0x33d02f){return typeof _0x33d02f===_0xb641('0xa');});if(!_0x378dde&&!_0x413c9e){_0x3f8db3=_0x3f755e['map'](function(_0x589e39){return _0x589e39['id'];});if(_0x3f8db3['length']===0x0){_0x279b22=_0x3f755e['map'](function(_0x25b289){return _0x25b289['interval'];});}}else{if(_0x378dde){_0x3f8db3=_0x3f8db3[_0xb641('0xb')](_0x3f755e);}if(_0x413c9e){_0x279b22=_0x279b22[_0xb641('0xb')](_0x3f755e);}}return client[_0xb641('0xc')]('IntervalIftime',{'intervalIds':_0x3f8db3,'intervals':_0x279b22,'timezone':_0x38348c,'log':_0xb641('0xd')});}}exports[_0xb641('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 4a9e998..77a8726 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 _0x4346=['voiceDialReport','membername','endtime','starttime','outbound','exten','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','format','SIP/%s','interface','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','queue','agent','accountcode','toNumber','uniqueid'];(function(_0x79f07b,_0x2d0656){var _0xea0129=function(_0x49e816){while(--_0x49e816){_0x79f07b['push'](_0x79f07b['shift']());}};_0xea0129(++_0x2d0656);}(_0x4346,0x107));var _0x6434=function(_0xdb47d8,_0x933e5b){_0xdb47d8=_0xdb47d8-0x0;var _0x5cdfd9=_0x4346[_0xdb47d8];return _0x5cdfd9;};'use strict';var moment=require(_0x6434('0x0'));var _=require(_0x6434('0x1'));var util=require(_0x6434('0x2'));var client=require(_0x6434('0x3'));exports[_0x6434('0x4')]=function(_0xecb4f7){var _0x482a71=_0xecb4f7['queuecallercompleteAt']||_0xecb4f7[_0x6434('0x5')];return client[_0x6434('0x6')](_0x6434('0x7'),{'body':{'channel':_0x6434('0x8'),'membername':_0xecb4f7[_0x6434('0x9')],'interface':_[_0x6434('0xa')](_0xecb4f7['interface'])?util[_0x6434('0xb')](_0x6434('0xc'),_0xecb4f7['lastAssignedTo']):_0xecb4f7[_0x6434('0xd')],'type':_0x6434('0xe'),'enterAt':_0xecb4f7[_0x6434('0xf')],'exitAt':_0x482a71,'duration':moment(_0x482a71)[_0x6434('0x10')](_0xecb4f7[_0x6434('0xf')],_0x6434('0x11')),'data1':_0x6434('0x12'),'data2':_0xecb4f7[_0x6434('0x13')],'data3':_0xecb4f7['exten'],'data4':null,'data5':_0xecb4f7[_0x6434('0x14')],'role':_0x6434('0x15'),'internal':_0xecb4f7[_0x6434('0x16')]?_[_0x6434('0x17')](_0xecb4f7['accountcode']):undefined,'uniqueid':_0xecb4f7[_0x6434('0x18')]},'log':_0x6434('0x7')});};exports[_0x6434('0x19')]=function(_0x461daf){return client[_0x6434('0x6')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x461daf[_0x6434('0x1a')],'interface':_0x461daf[_0x6434('0xd')],'type':_0x6434('0xe'),'enterAt':_0x461daf['starttime'],'exitAt':_0x461daf['endtime'],'duration':moment(_0x461daf[_0x6434('0x1b')])[_0x6434('0x10')](_0x461daf[_0x6434('0x1c')],_0x6434('0x11'))>=0x0?moment(_0x461daf[_0x6434('0x1b')])['diff'](_0x461daf['starttime'],_0x6434('0x11')):null,'data1':_0x6434('0x1d'),'data2':_0x461daf[_0x6434('0x16')],'data3':_0x461daf[_0x6434('0x1e')],'data4':_0x461daf[_0x6434('0x1f')]||null,'role':_0x6434('0x15'),'internal':_0x461daf[_0x6434('0x16')]?_[_0x6434('0x17')](_0x461daf[_0x6434('0x16')]):undefined,'uniqueid':_0x461daf[_0x6434('0x18')]},'log':_0x6434('0x7')});}; \ No newline at end of file +var _0x7d13=['agent','accountcode','toNumber','uniqueid','CreateMemberReport','voiceDialReport','membername','starttime','endtime','exten','dialstring','moment','lodash','../client','voiceQueueReport','queuecallercompleteAt','Request','voice','lastAssignedTo','isNil','interface','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','queue'];(function(_0x3f9e24,_0x37dbf5){var _0x427ae1=function(_0x5e62bd){while(--_0x5e62bd){_0x3f9e24['push'](_0x3f9e24['shift']());}};_0x427ae1(++_0x37dbf5);}(_0x7d13,0x185));var _0x37d1=function(_0x3b8c97,_0x55e350){_0x3b8c97=_0x3b8c97-0x0;var _0x2d94e1=_0x7d13[_0x3b8c97];return _0x2d94e1;};'use strict';var moment=require(_0x37d1('0x0'));var _=require(_0x37d1('0x1'));var util=require('util');var client=require(_0x37d1('0x2'));exports[_0x37d1('0x3')]=function(_0x2cd054){var _0x4f1f91=_0x2cd054[_0x37d1('0x4')]||_0x2cd054['queuecallerexitAt'];return client[_0x37d1('0x5')]('CreateMemberReport',{'body':{'channel':_0x37d1('0x6'),'membername':_0x2cd054[_0x37d1('0x7')],'interface':_[_0x37d1('0x8')](_0x2cd054[_0x37d1('0x9')])?util['format'](_0x37d1('0xa'),_0x2cd054[_0x37d1('0x7')]):_0x2cd054[_0x37d1('0x9')],'type':_0x37d1('0xb'),'enterAt':_0x2cd054[_0x37d1('0xc')],'exitAt':_0x4f1f91,'duration':moment(_0x4f1f91)[_0x37d1('0xd')](_0x2cd054['queuecallerleaveAt'],_0x37d1('0xe')),'data1':'inbound','data2':_0x2cd054['calleridnum'],'data3':_0x2cd054['exten'],'data4':null,'data5':_0x2cd054[_0x37d1('0xf')],'role':_0x37d1('0x10'),'internal':_0x2cd054[_0x37d1('0x11')]?_[_0x37d1('0x12')](_0x2cd054['accountcode']):undefined,'uniqueid':_0x2cd054[_0x37d1('0x13')]},'log':_0x37d1('0x14')});};exports[_0x37d1('0x15')]=function(_0x25e067){return client[_0x37d1('0x5')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x25e067[_0x37d1('0x16')],'interface':_0x25e067['interface'],'type':'TALKING','enterAt':_0x25e067[_0x37d1('0x17')],'exitAt':_0x25e067['endtime'],'duration':moment(_0x25e067[_0x37d1('0x18')])[_0x37d1('0xd')](_0x25e067[_0x37d1('0x17')],_0x37d1('0xe'))>=0x0?moment(_0x25e067[_0x37d1('0x18')])[_0x37d1('0xd')](_0x25e067['starttime'],_0x37d1('0xe')):null,'data1':'outbound','data2':_0x25e067[_0x37d1('0x11')],'data3':_0x25e067[_0x37d1('0x19')],'data4':_0x25e067[_0x37d1('0x1a')]||null,'role':_0x37d1('0x10'),'internal':_0x25e067[_0x37d1('0x11')]?_['toNumber'](_0x25e067['accountcode']):undefined,'uniqueid':_0x25e067[_0x37d1('0x13')]},'log':_0x37d1('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index b482446..0e4a1e1 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 _0xd3d3=['Request','ShowSetting'];(function(_0x52633e,_0x3618a3){var _0x16b3c2=function(_0x1b0893){while(--_0x1b0893){_0x52633e['push'](_0x52633e['shift']());}};_0x16b3c2(++_0x3618a3);}(_0xd3d3,0x19a));var _0x3d3d=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xd3d3[_0x2fc012];return _0x2891f9;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x3d3d('0x0')](_0x3d3d('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer','previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file +var _0x1aab=['../client','getSettings','Request','stopRecordingOnTransfer','GetSettings'];(function(_0x2a747a,_0xb60f44){var _0x11aa54=function(_0x3f18b1){while(--_0x3f18b1){_0x2a747a['push'](_0x2a747a['shift']());}};_0x11aa54(++_0xb60f44);}(_0x1aab,0x122));var _0xb1aa=function(_0x4c5ed3,_0x5e5b5c){_0x4c5ed3=_0x4c5ed3-0x0;var _0x368903=_0x1aab[_0x4c5ed3];return _0x368903;};'use strict';var client=require(_0xb1aa('0x0'));exports[_0xb1aa('0x1')]=function(){return client[_0xb1aa('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb1aa('0x3'),'previewRecallmeReminderInterval']},'log':_0xb1aa('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 8fb9f06..19efa8d 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 _0x1aac=['name','html','../client','getTemplates','Request'];(function(_0x1d5ff5,_0x7cff5c){var _0x51e02=function(_0x129b19){while(--_0x129b19){_0x1d5ff5['push'](_0x1d5ff5['shift']());}};_0x51e02(++_0x7cff5c);}(_0x1aac,0xf7));var _0xc1aa=function(_0x3b0f29,_0x5eb016){_0x3b0f29=_0x3b0f29-0x0;var _0x53e7eb=_0x1aac[_0x3b0f29];return _0x53e7eb;};'use strict';var client=require(_0xc1aa('0x0'));exports[_0xc1aa('0x1')]=function(_0xd419db){return function(_0x1e058a){return client[_0xc1aa('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xc1aa('0x3'),_0xc1aa('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x5767=['Request','GetTemplate','name','html','../client','getTemplates'];(function(_0x867c03,_0x5f532d){var _0x760969=function(_0xd23675){while(--_0xd23675){_0x867c03['push'](_0x867c03['shift']());}};_0x760969(++_0x5f532d);}(_0x5767,0xac));var _0x7576=function(_0x1ab9b2,_0x5a309a){_0x1ab9b2=_0x1ab9b2-0x0;var _0x1bc4b0=_0x5767[_0x1ab9b2];return _0x1bc4b0;};'use strict';var client=require(_0x7576('0x0'));exports[_0x7576('0x1')]=function(_0x469ce0){return function(_0x4c99db){return client[_0x7576('0x2')](_0x7576('0x3'),{'options':{'raw':!![],'attributes':['id',_0x7576('0x4'),_0x7576('0x5')]},'log':_0x7576('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 5f14cad..b8c2779 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 _0xe44a=['data5','data6','data7','getTriggers','Request','GetTrigger','name','Condition','AllConditions','field','operator','value','AnyConditions','action','data1','data2','data3','data4'];(function(_0x4d16cf,_0x5ab270){var _0x2cc8ef=function(_0x389097){while(--_0x389097){_0x4d16cf['push'](_0x4d16cf['shift']());}};_0x2cc8ef(++_0x5ab270);}(_0xe44a,0x159));var _0xae44=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe44a[_0x501510];return _0x1e6ee5;};'use strict';var client=require('../client');exports[_0xae44('0x0')]=function(_0x33ebb8){return function(_0x2b76d3){return client[_0xae44('0x1')](_0xae44('0x2'),{'options':{'raw':![],'attributes':['id',_0xae44('0x3'),'channel','status'],'include':[{'model':_0xae44('0x4'),'as':_0xae44('0x5'),'attributes':['id',_0xae44('0x6'),_0xae44('0x7'),_0xae44('0x8')]},{'model':_0xae44('0x4'),'as':_0xae44('0x9'),'attributes':['id',_0xae44('0x6'),_0xae44('0x7'),'value']},{'model':'Action','as':'Actions','attributes':['id',_0xae44('0xa'),_0xae44('0xb'),_0xae44('0xc'),_0xae44('0xd'),_0xae44('0xe'),_0xae44('0xf'),_0xae44('0x10'),_0xae44('0x11')]}]},'log':_0xae44('0x2')});};}; \ No newline at end of file +var _0xbaf4=['getTriggers','Request','GetTrigger','channel','status','Condition','AllConditions','operator','value','AnyConditions','field','Action','action','data2','data3','data4','data5','../client'];(function(_0xb39a45,_0x4094d2){var _0xb9abc5=function(_0x3e2620){while(--_0x3e2620){_0xb39a45['push'](_0xb39a45['shift']());}};_0xb9abc5(++_0x4094d2);}(_0xbaf4,0x11f));var _0x4baf=function(_0x51b1a2,_0x55281e){_0x51b1a2=_0x51b1a2-0x0;var _0x17f387=_0xbaf4[_0x51b1a2];return _0x17f387;};'use strict';var client=require(_0x4baf('0x0'));exports[_0x4baf('0x1')]=function(_0x4f93f4){return function(_0x401d97){return client[_0x4baf('0x2')](_0x4baf('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x4baf('0x4'),_0x4baf('0x5')],'include':[{'model':_0x4baf('0x6'),'as':_0x4baf('0x7'),'attributes':['id','field',_0x4baf('0x8'),_0x4baf('0x9')]},{'model':_0x4baf('0x6'),'as':_0x4baf('0xa'),'attributes':['id',_0x4baf('0xb'),'operator','value']},{'model':_0x4baf('0xc'),'as':'Actions','attributes':['id',_0x4baf('0xd'),'data1',_0x4baf('0xe'),_0x4baf('0xf'),_0x4baf('0x10'),_0x4baf('0x11'),'data6','data7']}]},'log':_0x4baf('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 4e557bf..4290f91 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 _0xe3d7=['GetTrunk','../client','getTrunks','Request','name','registry','defaultuser'];(function(_0x18a286,_0x3c497b){var _0xf1ac5a=function(_0x5f3ae8){while(--_0x5f3ae8){_0x18a286['push'](_0x18a286['shift']());}};_0xf1ac5a(++_0x3c497b);}(_0xe3d7,0xf6));var _0x7e3d=function(_0x2a0836,_0x3b71dc){_0x2a0836=_0x2a0836-0x0;var _0xbd20f6=_0xe3d7[_0x2a0836];return _0xbd20f6;};'use strict';var client=require(_0x7e3d('0x0'));exports[_0x7e3d('0x1')]=function(_0x522e2c){return function(_0xf68fb3){return client[_0x7e3d('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x7e3d('0x3'),_0x7e3d('0x4'),_0x7e3d('0x5')]},'log':_0x7e3d('0x6')});};}; \ No newline at end of file +var _0xdcdc=['../client','getTrunks','Request','GetTrunk','name','registry','defaultuser'];(function(_0x294206,_0x4522bb){var _0xf746b6=function(_0x102790){while(--_0x102790){_0x294206['push'](_0x294206['shift']());}};_0xf746b6(++_0x4522bb);}(_0xdcdc,0x8c));var _0xcdcd=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xdcdc[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0xcdcd('0x0'));exports[_0xcdcd('0x1')]=function(_0x33f233){return function(_0x2a3eef){return client[_0xcdcd('0x2')](_0xcdcd('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xcdcd('0x4'),_0xcdcd('0x5'),_0xcdcd('0x6')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index b1373b1..24791bc 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x1fbaa9,_0x3ef48b){var _0x5e7cd5=function(_0x354ec9){while(--_0x354ec9){_0x1fbaa9['push'](_0x1fbaa9['shift']());}};_0x5e7cd5(++_0x3ef48b);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x4ca83c,_0x34ebce){var _0xadd149=function(_0x4797df){while(--_0x4797df){_0x4ca83c['push'](_0x4ca83c['shift']());}};_0xadd149(++_0x34ebce);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 024ced5..d31f96c 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 _0x38ef=['../client','create','Request','CreateVoiceAgentReport'];(function(_0x3f7094,_0x4297eb){var _0x4bbedc=function(_0x422c01){while(--_0x422c01){_0x3f7094['push'](_0x3f7094['shift']());}};_0x4bbedc(++_0x4297eb);}(_0x38ef,0x1e4));var _0xf38e=function(_0xd3b154,_0x3f5052){_0xd3b154=_0xd3b154-0x0;var _0x2a56a0=_0x38ef[_0xd3b154];return _0x2a56a0;};'use strict';var client=require(_0xf38e('0x0'));exports[_0xf38e('0x1')]=function(_0x1bdb89){return client[_0xf38e('0x2')](_0xf38e('0x3'),{'body':_0x1bdb89,'log':_0xf38e('0x3')});};exports['update']=function(_0x4d9098,_0x12eab1,_0x554e75){return client[_0xf38e('0x2')]('UpdateVoiceAgentReport',{'body':_0x4d9098,'options':{'where':{'uniqueid':_0x12eab1,'interface':_0x554e75,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0xad3e=['update','UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport'];(function(_0x2d4c97,_0x5b242d){var _0x5ca024=function(_0x3933c6){while(--_0x3933c6){_0x2d4c97['push'](_0x2d4c97['shift']());}};_0x5ca024(++_0x5b242d);}(_0xad3e,0x101));var _0xead3=function(_0x274a50,_0x39fa80){_0x274a50=_0x274a50-0x0;var _0x4ca97c=_0xad3e[_0x274a50];return _0x4ca97c;};'use strict';var client=require('../client');exports[_0xead3('0x0')]=function(_0x4660e9){return client[_0xead3('0x1')](_0xead3('0x2'),{'body':_0x4660e9,'log':_0xead3('0x2')});};exports[_0xead3('0x3')]=function(_0x49859b,_0x324ca5,_0x5eb7d4){return client[_0xead3('0x1')](_0xead3('0x4'),{'body':_0x49859b,'options':{'where':{'uniqueid':_0x324ca5,'interface':_0x5eb7d4,'agentcomplete':!![]}},'log':_0xead3('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 18fc500..60f41c0 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 _0x6854=['duration','billableseconds','moment','lodash','../client','create','Request','calleridnum','callerid','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','disposition'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x6854,0x134));var _0x4685=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0x6854[_0x11f249];return _0x5c3656;};'use strict';var moment=require(_0x4685('0x0'));var util=require('util');var _=require(_0x4685('0x1'));var client=require(_0x4685('0x2'));exports[_0x4685('0x3')]=function(_0x19da75){return client[_0x4685('0x4')]('CreateVoiceCallReport',{'body':_['merge'](_0x19da75,{'source':_0x19da75[_0x4685('0x5')],'destinationcontext':_0x19da75['context'],'callerid':_0x19da75[_0x4685('0x6')],'amaflags':'DOCUMENTATION'}),'log':_0x4685('0x7')});};exports[_0x4685('0x8')]=function(){return function(){return client[_0x4685('0x4')](_0x4685('0x9'),{'options':{'where':{'type':[_0x4685('0xa')],'createdAt':{'$between':[moment()['startOf'](_0x4685('0xb'))[_0x4685('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x4685('0xd')]('day')['format'](_0x4685('0xe'))]}},'attributes':['type',_0x4685('0xf'),_0x4685('0x10'),_0x4685('0x11')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x954b=['callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','duration','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum'];(function(_0x236b7d,_0x2fb091){var _0x3c773d=function(_0x5cc9e3){while(--_0x5cc9e3){_0x236b7d['push'](_0x236b7d['shift']());}};_0x3c773d(++_0x2fb091);}(_0x954b,0x1f1));var _0xb954=function(_0x1103c4,_0x562d1d){_0x1103c4=_0x1103c4-0x0;var _0x1c19ab=_0x954b[_0x1103c4];return _0x1c19ab;};'use strict';var moment=require(_0xb954('0x0'));var util=require(_0xb954('0x1'));var _=require(_0xb954('0x2'));var client=require(_0xb954('0x3'));exports[_0xb954('0x4')]=function(_0x3dbe7d){return client[_0xb954('0x5')](_0xb954('0x6'),{'body':_[_0xb954('0x7')](_0x3dbe7d,{'source':_0x3dbe7d[_0xb954('0x8')],'destinationcontext':_0x3dbe7d['context'],'callerid':_0x3dbe7d[_0xb954('0x9')],'amaflags':_0xb954('0xa')}),'log':_0xb954('0x6')});};exports[_0xb954('0xb')]=function(){return function(){return client[_0xb954('0x5')](_0xb954('0xc'),{'options':{'where':{'type':[_0xb954('0xd')],'createdAt':{'$between':[moment()[_0xb954('0xe')](_0xb954('0xf'))['format'](_0xb954('0x10')),moment()[_0xb954('0x11')](_0xb954('0xf'))[_0xb954('0x12')](_0xb954('0x10'))]}},'attributes':[_0xb954('0x13'),_0xb954('0x14'),_0xb954('0x15'),'billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 1e57a81..fa6fddc 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 _0x369c=['CreateVoiceDialReport','create','Request'];(function(_0x6bcbf2,_0x5e7dbe){var _0x42e951=function(_0x832be3){while(--_0x832be3){_0x6bcbf2['push'](_0x6bcbf2['shift']());}};_0x42e951(++_0x5e7dbe);}(_0x369c,0x1c9));var _0xc369=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x369c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xc369('0x0')]=function(_0x437531){return client[_0xc369('0x1')](_0xc369('0x2'),{'body':_0x437531,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x7796=['CreateVoiceDialReport','../client','create','Request'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7796,0xd5));var _0x6779=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7796[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x6779('0x0'));exports[_0x6779('0x1')]=function(_0x1bdc3b){return client[_0x6779('0x2')](_0x6779('0x3'),{'body':_0x1bdc3b,'log':_0x6779('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 8dc114c..7333154 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 _0x4058=['GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0xbaec21,_0x34cde8){var _0x1849a8=function(_0x137ad9){while(--_0x137ad9){_0xbaec21['push'](_0xbaec21['shift']());}};_0x1849a8(++_0x34cde8);}(_0x4058,0x129));var _0x8405=function(_0x5a3fff,_0x482717){_0x5a3fff=_0x5a3fff-0x0;var _0x35df0a=_0x4058[_0x5a3fff];return _0x35df0a;};'use strict';var client=require(_0x8405('0x0'));exports[_0x8405('0x1')]=function(){return function(){return client[_0x8405('0x2')](_0x8405('0x3'),{'options':{'raw':!![],'attributes':['id',_0x8405('0x4'),_0x8405('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x8405('0x1')});};}; \ No newline at end of file +var _0xbee3=['getVoiceExtensions','exten','recordingFormat'];(function(_0x512738,_0x52ef6b){var _0x1bdb2b=function(_0x24d1ff){while(--_0x24d1ff){_0x512738['push'](_0x512738['shift']());}};_0x1bdb2b(++_0x52ef6b);}(_0xbee3,0xd5));var _0x3bee=function(_0x38bdff,_0x4633e4){_0x38bdff=_0x38bdff-0x0;var _0x4ce52e=_0xbee3[_0x38bdff];return _0x4ce52e;};'use strict';var client=require('../client');exports[_0x3bee('0x0')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x3bee('0x1'),_0x3bee('0x2')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 611dfce..bcaf533 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 _0xd354=['dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','mandatoryDispositionPause','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','type','dialActive','dialMethod','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd354,0x1dd));var _0x4d35=function(_0x3c67fd,_0x523aab){_0x3c67fd=_0x3c67fd-0x0;var _0x6bfebc=_0xd354[_0x3c67fd];return _0x6bfebc;};'use strict';var client=require(_0x4d35('0x0'));exports[_0x4d35('0x1')]=function(){return function(){return client[_0x4d35('0x2')](_0x4d35('0x3'),{'options':{'raw':![],'attributes':['id',_0x4d35('0x4'),_0x4d35('0x5'),_0x4d35('0x6'),'autopause','monitor_format',_0x4d35('0x7'),_0x4d35('0x8'),_0x4d35('0x9'),'dialLimitChannel','dialLimitQueue',_0x4d35('0xa'),'dialPredictiveOptimization',_0x4d35('0xb'),_0x4d35('0xc'),_0x4d35('0xd'),_0x4d35('0xe'),_0x4d35('0xf'),_0x4d35('0x10'),_0x4d35('0x11'),_0x4d35('0x12'),_0x4d35('0x13'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x4d35('0x14'),_0x4d35('0x15'),_0x4d35('0x16'),'dialGlobalMaxRetry','dialTimezone',_0x4d35('0x17'),'dialPrefix',_0x4d35('0x18'),_0x4d35('0x19'),_0x4d35('0x1a'),_0x4d35('0x1b'),_0x4d35('0x1c'),_0x4d35('0x1d'),_0x4d35('0x1e'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0x4d35('0x1f'),_0x4d35('0x20'),_0x4d35('0x21'),'dialRecallMeTimeout',_0x4d35('0x22'),_0x4d35('0x23'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x4d35('0x24'),_0x4d35('0x25'),_0x4d35('0x26'),_0x4d35('0x27'),_0x4d35('0x28'),'dialNoSuchNumberMaxRetry',_0x4d35('0x29'),_0x4d35('0x2a'),_0x4d35('0x2b'),_0x4d35('0x2c'),_0x4d35('0x2d'),'dialMachineMaxRetry',_0x4d35('0x2e'),_0x4d35('0x2f'),_0x4d35('0x30'),_0x4d35('0x31'),_0x4d35('0x32'),'dialPredictiveIntervalMinThreshold',_0x4d35('0x33'),_0x4d35('0x34')],'include':[{'model':_0x4d35('0x35'),'as':_0x4d35('0x35'),'attributes':['id',_0x4d35('0x4'),'callerid',_0x4d35('0x36')]},{'model':'Pause','as':_0x4d35('0x37'),'attributes':['id',_0x4d35('0x4')]},{'model':_0x4d35('0x35'),'as':'TrunkBackup','attributes':['id',_0x4d35('0x4'),'callerid',_0x4d35('0x36')]},{'model':_0x4d35('0x38'),'as':_0x4d35('0x38'),'attributes':['id',_0x4d35('0x4')],'include':[{'model':'Interval','as':_0x4d35('0x39'),'attributes':['id',_0x4d35('0x4'),'interval']}]}]},'log':_0x4d35('0x1')});};}; \ No newline at end of file +var _0x18fc=['monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','Pause','mandatoryDispositionPause','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2'];(function(_0xe5b20,_0x48def6){var _0x2c8afe=function(_0x556db3){while(--_0x556db3){_0xe5b20['push'](_0xe5b20['shift']());}};_0x2c8afe(++_0x48def6);}(_0x18fc,0x1d7));var _0xc18f=function(_0x37c8ef,_0x334449){_0x37c8ef=_0x37c8ef-0x0;var _0x5eaee9=_0x18fc[_0x37c8ef];return _0x5eaee9;};'use strict';var client=require(_0xc18f('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xc18f('0x1')](_0xc18f('0x2'),{'options':{'raw':![],'attributes':['id',_0xc18f('0x3'),_0xc18f('0x4'),_0xc18f('0x5'),_0xc18f('0x6'),'monitor_format',_0xc18f('0x7'),_0xc18f('0x8'),_0xc18f('0x9'),'dialLimitChannel',_0xc18f('0xa'),_0xc18f('0xb'),_0xc18f('0xc'),_0xc18f('0xd'),_0xc18f('0xe'),_0xc18f('0xf'),_0xc18f('0x10'),'dialOriginateTimeout',_0xc18f('0x11'),_0xc18f('0x12'),'dialQueueProject',_0xc18f('0x13'),_0xc18f('0x14'),_0xc18f('0x15'),_0xc18f('0x16'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0xc18f('0x17'),_0xc18f('0x18'),_0xc18f('0x19'),_0xc18f('0x1a'),_0xc18f('0x1b'),_0xc18f('0x1c'),_0xc18f('0x1d'),_0xc18f('0x1e'),_0xc18f('0x1f'),_0xc18f('0x20'),'dialAMDMinWordLength',_0xc18f('0x21'),'dialAMDMaximumNumberOfWords',_0xc18f('0x22'),_0xc18f('0x23'),_0xc18f('0x24'),_0xc18f('0x25'),'dialRecallInQueue','dialOrderByScheduledAt',_0xc18f('0x26'),_0xc18f('0x27'),_0xc18f('0x28'),_0xc18f('0x29'),_0xc18f('0x2a'),_0xc18f('0x2b'),_0xc18f('0x2c'),'dialNoSuchNumberMaxRetry',_0xc18f('0x2d'),_0xc18f('0x2e'),_0xc18f('0x2f'),_0xc18f('0x30'),'dialAbandonedRetryFrequency',_0xc18f('0x31'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0xc18f('0x32'),_0xc18f('0x33'),_0xc18f('0x34'),_0xc18f('0x35'),_0xc18f('0x36'),_0xc18f('0x37')],'include':[{'model':_0xc18f('0x38'),'as':_0xc18f('0x38'),'attributes':['id',_0xc18f('0x3'),_0xc18f('0x39'),'active']},{'model':_0xc18f('0x3a'),'as':_0xc18f('0x3b'),'attributes':['id','name']},{'model':_0xc18f('0x38'),'as':'TrunkBackup','attributes':['id',_0xc18f('0x3'),_0xc18f('0x39'),'active']},{'model':_0xc18f('0x3c'),'as':_0xc18f('0x3c'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xc18f('0x3d'),'attributes':['id',_0xc18f('0x3'),_0xc18f('0x3e')]}]}]},'log':_0xc18f('0x3f')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 37b4bec..e425f7e 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(_0x324714,_0xf1c81e){var _0x48c807=function(_0x46dae0){while(--_0x46dae0){_0x324714['push'](_0x324714['shift']());}};_0x48c807(++_0xf1c81e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x3c281c,_0x444ae3){var _0x2f001f=function(_0x44d92d){while(--_0x44d92d){_0x3c281c['push'](_0x3c281c['shift']());}};_0x2f001f(++_0x444ae3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 45bbb29..000bd5d 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 _0x954a=['getVoiceQueueRtPauses','Request'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0x954a,0x6a));var _0xa954=function(_0x3b657b,_0x337b2f){_0x3b657b=_0x3b657b-0x0;var _0x75e1f3=_0x954a[_0x3b657b];return _0x75e1f3;};'use strict';var client=require('../client');exports[_0xa954('0x0')]=function(_0x5a99a1){return function(){return client[_0xa954('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x5a99a1,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x1465=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x482d90,_0x5e35d7){var _0x571a5a=function(_0x293a2b){while(--_0x293a2b){_0x482d90['push'](_0x482d90['shift']());}};_0x571a5a(++_0x5e35d7);}(_0x1465,0xdb));var _0x5146=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0x1465[_0x249e96];return _0x17444c;};'use strict';var client=require(_0x5146('0x0'));exports[_0x5146('0x1')]=function(_0x427395){return function(){return client[_0x5146('0x2')](_0x5146('0x3'),{'options':{'where':{'VoiceQueueId':_0x427395,'paused':!![]},'raw':!![]},'log':_0x5146('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index d4bf95e..d3eacaa 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(_0x36bde9,_0x5c46fa){var _0x1532ce=function(_0x75b516){while(--_0x75b516){_0x36bde9['push'](_0x36bde9['shift']());}};_0x1532ce(++_0x5c46fa);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x30f836,_0x3ec28b){var _0x3a7a52=function(_0x24da39){while(--_0x24da39){_0x30f836['push'](_0x30f836['shift']());}};_0x3a7a52(++_0x3ec28b);}(_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 diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index b2a79f3..fca5eb8 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 _0x02a9=['secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetlinkedid','origtransferercontext','origtransfererexten','transfers','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','attendedTransfer','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode'];(function(_0x4b6f9c,_0x50f561){var _0x41264e=function(_0x1062db){while(--_0x1062db){_0x4b6f9c['push'](_0x4b6f9c['shift']());}};_0x41264e(++_0x50f561);}(_0x02a9,0xd5));var _0x902a=function(_0x154e1d,_0x60391a){_0x154e1d=_0x154e1d-0x0;var _0x3991fa=_0x02a9[_0x154e1d];return _0x3991fa;};'use strict';var client=require('../client');exports[_0x902a('0x0')]={};exports['blindTransfer']=function(_0x21ca33){return client[_0x902a('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x21ca33[_0x902a('0x2')],'transfererchannel':_0x21ca33[_0x902a('0x3')],'transferercalleridnum':_0x21ca33[_0x902a('0x4')],'transferercalleridname':_0x21ca33[_0x902a('0x5')],'transfererconnectedlinenum':_0x21ca33[_0x902a('0x6')],'transfererconnectedlinename':_0x21ca33[_0x902a('0x7')],'transfereraccountcode':_0x21ca33[_0x902a('0x8')],'transferercontext':_0x21ca33[_0x902a('0x9')],'transfererexten':_0x21ca33[_0x902a('0xa')],'transfererlinkedid':_0x21ca33[_0x902a('0xb')],'transfereechannel':_0x21ca33[_0x902a('0xc')],'transfereecalleridnum':_0x21ca33[_0x902a('0xd')],'transfereecalleridname':_0x21ca33[_0x902a('0xe')],'transfereeconnectedlinenum':_0x21ca33['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x21ca33[_0x902a('0xf')],'transfereeaccountcode':_0x21ca33['transfereeaccountcode'],'transfereecontext':_0x21ca33[_0x902a('0x10')],'transfereeexten':_0x21ca33[_0x902a('0x11')],'transfereelinkedid':_0x21ca33[_0x902a('0x12')],'isexternal':_0x21ca33[_0x902a('0x13')],'context':_0x21ca33[_0x902a('0x14')],'extension':_0x21ca33['extension'],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0x902a('0x15')]=function(_0xb379d7){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0xb379d7[_0x902a('0x2')],'transfererchannel':_0xb379d7['origtransfererchannel'],'transferercalleridnum':_0xb379d7['origtransferercalleridnum'],'transferercalleridname':_0xb379d7[_0x902a('0x16')],'transfererconnectedlinenum':_0xb379d7['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0xb379d7[_0x902a('0x17')],'transfereraccountcode':_0xb379d7[_0x902a('0x18')],'transferercontext':_0xb379d7[_0x902a('0x19')],'transfererexten':_0xb379d7[_0x902a('0x1a')],'transfererlinkedid':_0xb379d7[_0x902a('0x1b')],'transfereechannel':_0xb379d7['transfertargetchannel'],'transfereecalleridnum':_0xb379d7['transfertargetcalleridnum'],'transfereecalleridname':_0xb379d7[_0x902a('0x1c')],'transfereeconnectedlinenum':_0xb379d7[_0x902a('0x1d')],'transfereeconnectedlinename':_0xb379d7[_0x902a('0x1e')],'transfereeaccountcode':_0xb379d7['transfertargetaccountcode'],'transfereecontext':_0xb379d7['transfertargetcontext'],'transfereeexten':_0xb379d7['transfertargetexten'],'transfereelinkedid':_0xb379d7[_0x902a('0x1f')],'isexternal':_0xb379d7[_0x902a('0x13')],'context':_0xb379d7[_0x902a('0x20')],'extension':_0xb379d7[_0x902a('0x21')],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x9957=['Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetaccountcode','transfertargetexten','isexternal','origtransferercontext','transfers'];(function(_0x10f1a2,_0x4bf110){var _0x245756=function(_0x27ddbb){while(--_0x27ddbb){_0x10f1a2['push'](_0x10f1a2['shift']());}};_0x245756(++_0x4bf110);}(_0x9957,0x1db));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var client=require('../client');exports[_0x7995('0x0')]={};exports['blindTransfer']=function(_0x9e01e){return client[_0x7995('0x1')](_0x7995('0x2'),{'body':{'result':_0x9e01e[_0x7995('0x3')],'transfererchannel':_0x9e01e[_0x7995('0x4')],'transferercalleridnum':_0x9e01e['transferercalleridnum'],'transferercalleridname':_0x9e01e[_0x7995('0x5')],'transfererconnectedlinenum':_0x9e01e['transfererconnectedlinenum'],'transfererconnectedlinename':_0x9e01e[_0x7995('0x6')],'transfereraccountcode':_0x9e01e[_0x7995('0x7')],'transferercontext':_0x9e01e[_0x7995('0x8')],'transfererexten':_0x9e01e[_0x7995('0x9')],'transfererlinkedid':_0x9e01e['transfererlinkedid'],'transfereechannel':_0x9e01e[_0x7995('0xa')],'transfereecalleridnum':_0x9e01e[_0x7995('0xb')],'transfereecalleridname':_0x9e01e['transfereecalleridname'],'transfereeconnectedlinenum':_0x9e01e[_0x7995('0xc')],'transfereeconnectedlinename':_0x9e01e[_0x7995('0xd')],'transfereeaccountcode':_0x9e01e[_0x7995('0xe')],'transfereecontext':_0x9e01e[_0x7995('0xf')],'transfereeexten':_0x9e01e['transfereeexten'],'transfereelinkedid':_0x9e01e[_0x7995('0x10')],'isexternal':_0x9e01e['isexternal'],'context':_0x9e01e[_0x7995('0x11')],'extension':_0x9e01e[_0x7995('0x12')],'type':'blind'},'log':_0x7995('0x2')});};exports[_0x7995('0x13')]=function(_0x2cd01e){return client[_0x7995('0x1')](_0x7995('0x2'),{'body':{'result':_0x2cd01e[_0x7995('0x3')],'transfererchannel':_0x2cd01e[_0x7995('0x14')],'transferercalleridnum':_0x2cd01e[_0x7995('0x15')],'transferercalleridname':_0x2cd01e[_0x7995('0x16')],'transfererconnectedlinenum':_0x2cd01e['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2cd01e[_0x7995('0x17')],'transfereraccountcode':_0x2cd01e[_0x7995('0x18')],'transferercontext':_0x2cd01e[_0x7995('0x19')],'transfererexten':_0x2cd01e[_0x7995('0x1a')],'transfererlinkedid':_0x2cd01e[_0x7995('0x1b')],'transfereechannel':_0x2cd01e[_0x7995('0x1c')],'transfereecalleridnum':_0x2cd01e[_0x7995('0x1d')],'transfereecalleridname':_0x2cd01e['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2cd01e['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2cd01e['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2cd01e[_0x7995('0x1e')],'transfereecontext':_0x2cd01e['transfertargetcontext'],'transfereeexten':_0x2cd01e[_0x7995('0x1f')],'transfereelinkedid':_0x2cd01e['transfertargetlinkedid'],'isexternal':_0x2cd01e[_0x7995('0x20')],'context':_0x2cd01e[_0x7995('0x21')],'extension':_0x2cd01e['origtransfererexten'],'type':'attended'},'log':_0x7995('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 88394be..d156d7f 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x41674e,_0x50e449){var _0x1b294a=function(_0x4c5b65){while(--_0x4c5b65){_0x41674e['push'](_0x41674e['shift']());}};_0x1b294a(++_0x50e449);}(_0xb10b,0x12a));var _0xbb10=function(_0x3fec1f,_0x563512){_0x3fec1f=_0x3fec1f-0x0;var _0x5cb79b=_0xb10b[_0x3fec1f];return _0x5cb79b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x490739,_0x26ba23){var _0x3124dd=function(_0x2fae3c){while(--_0x2fae3c){_0x490739['push'](_0x490739['shift']());}};_0x3124dd(++_0x26ba23);}(_0xb10b,0x12a));var _0xbb10=function(_0x20db6c,_0x4ff24a){_0x20db6c=_0x20db6c-0x0;var _0x30b5d3=_0xb10b[_0x20db6c];return _0x30b5d3;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 3620255..de4e57b 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 _0xe6be=['length','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','stringify','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','map','routeId','calleridnum','destcalleridnum','lastName','mobile','fax','createdAt','scheduledAt','union','resolve','isEmpty','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','Unknown','destcalleridname','then','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','trigger:%s','action','toLowerCase'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xe6be,0x189));var _0xee6b=function(_0x50cf7b,_0x497525){_0x50cf7b=_0x50cf7b-0x0;var _0x40685f=_0xe6be[_0x50cf7b];return _0x40685f;};'use strict';var _=require('lodash');var BPromise=require(_0xee6b('0x0'));var Redis=require(_0xee6b('0x1'));var util=require(_0xee6b('0x2'));var config=require(_0xee6b('0x3'));var logger=require(_0xee6b('0x4'))(_0xee6b('0x5'));var cmContactRpc=require(_0xee6b('0x6'));config[_0xee6b('0x7')]=_[_0xee6b('0x8')](config['redis'],{'host':_0xee6b('0x9'),'port':0x18eb});var io=require(_0xee6b('0xa'))(new Redis(config['redis']));function emit(_0x1ac45e,_0x3bb6b8,_0x272adb,_0x53f608,_0x26238f){logger['info']('[CM][%s][%s]',_0x1ac45e,_0x3bb6b8['id'],_0x272adb,_0x53f608,JSON[_0xee6b('0xb')](_0x26238f));io['to'](_0x272adb)['emit'](_0x53f608,_0x26238f);}exports[_0xee6b('0xc')]=function(_0x248388,_0x4565fc,_0x3ba5cd,_0x11bb02){var _0x1f8143,_0x105fc2;var _0x502237={};var _0x2f6e97;var _0x4ec46e=Number(_0x3ba5cd[_0xee6b('0xd')]);var _0x29d62f=_0x3ba5cd[_0xee6b('0xe')]?Boolean(Number(_0x3ba5cd[_0xee6b('0xe')])):![];var _0xfa5523;var _0x3d0ea9=![];if(!_[_0xee6b('0xf')](_0x3ba5cd[_0xee6b('0x10')])){if(_0x3ba5cd[_0xee6b('0x10')]=='1')_0x3d0ea9=!![];}if(!_0x3d0ea9){if(_0x11bb02[_0xee6b('0x11')]){_0x502237['id']=_0x11bb02['xmd-contactid'];}}if(!_0x502237['id']){_0x502237[_0xee6b('0x12')]=_0x4ec46e;_0xfa5523=_0x3ba5cd['data3']&&_0x3ba5cd[_0xee6b('0x13')]!=='0'?_0x3ba5cd['data3'][_0xee6b('0x14')](','):[_0xee6b('0x15')];_0x502237['$or']=_[_0xee6b('0x16')](_0xfa5523,function(_0xb6000){var _0x400483={};_0x400483[_0xb6000]=_0x11bb02[_0xee6b('0x17')]?_0x11bb02['destcalleridnum']:_0x11bb02[_0xee6b('0x18')];return _0x400483;});_0x2f6e97=_0x11bb02[_0xee6b('0x17')]?_0x11bb02[_0xee6b('0x19')]:_0x11bb02[_0xee6b('0x18')];}var _0x1550b2=['id','firstName',_0xee6b('0x1a'),_0xee6b('0x15'),_0xee6b('0x1b'),_0xee6b('0x1c'),'ListId',_0xee6b('0x1d'),_0xee6b('0x1e'),'updatedAt'];var _0x585b10=_[_0xee6b('0x1f')](_0x1550b2,_0xfa5523);BPromise[_0xee6b('0x20')]()['then'](cmContactRpc['getContacts']({'attributes':_0x585b10,'where':_0x502237,'phone':_0x2f6e97}))['then'](function(_0x7b3fd7){_0x105fc2=_0x7b3fd7;if(!_[_0xee6b('0x21')](_0x105fc2)){if(_0x105fc2['length']===0x1){_0x1f8143=_0x105fc2[0x0];logger[_0xee6b('0x22')](_0xee6b('0x23'),_0x11bb02[_0xee6b('0x24')],_0x4565fc['id'],_0x1f8143['id']);}else{logger[_0xee6b('0x22')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x11bb02[_0xee6b('0x24')],_0x4565fc['id'],_[_0xee6b('0x16')](_0x105fc2,'id')['join'](','));}return;}else{logger[_0xee6b('0x22')](_0xee6b('0x25'),_0x11bb02['uniqueid'],_0x4565fc['id']);var _0x654b08={'ListId':_0x4ec46e};var _0x30d4ef=_0x3ba5cd[_0xee6b('0x26')]&&_0x3ba5cd['data4']!=='0'?_0x3ba5cd[_0xee6b('0x26')]:_0xee6b('0x15');if(_0x29d62f){logger[_0xee6b('0x22')](_0xee6b('0x27'),_0x11bb02[_0xee6b('0x24')],_0x4565fc['id']);_0x654b08[_0x30d4ef]=_[_0xee6b('0xf')](_0x11bb02[_0xee6b('0x17')])?_0x11bb02[_0xee6b('0x18')]:_0x11bb02[_0xee6b('0x19')];if(_[_0xee6b('0xf')](_0x11bb02[_0xee6b('0x17')])){_0x654b08[_0xee6b('0x28')]=_0x11bb02[_0xee6b('0x29')]&&_0x11bb02['calleridname']!==_0xee6b('0x2a')?_0x11bb02[_0xee6b('0x29')]:_0xee6b('0x2b');}else{_0x654b08['firstName']=_0x11bb02[_0xee6b('0x2c')]&&_0x11bb02[_0xee6b('0x2c')]!==''?_0x11bb02[_0xee6b('0x2c')]:_0xee6b('0x2b');}return BPromise[_0xee6b('0x20')]()[_0xee6b('0x2d')](cmContactRpc[_0xee6b('0x2e')](_0x654b08))[_0xee6b('0x2d')](function(_0x497289){_0x1f8143=_0x497289;_0x105fc2[_0xee6b('0x2f')](_0x497289);if(_0x1f8143){logger[_0xee6b('0x22')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x11bb02[_0xee6b('0x24')],_0x4565fc['id'],_0x1f8143['id']);}return;});}else{logger[_0xee6b('0x22')](_0xee6b('0x30'),_0x11bb02['uniqueid'],_0x4565fc['id']);_0x654b08[_0x30d4ef]=_[_0xee6b('0xf')](_0x11bb02[_0xee6b('0x17')])?_0x11bb02[_0xee6b('0x18')]:_0x11bb02[_0xee6b('0x19')];if(_[_0xee6b('0xf')](_0x11bb02['routeId'])){_0x654b08[_0xee6b('0x28')]=_0x11bb02[_0xee6b('0x29')]&&_0x11bb02['calleridname']!==_0xee6b('0x2a')?_0x11bb02[_0xee6b('0x29')]:'Unknown';}else{_0x654b08[_0xee6b('0x28')]=_0x11bb02['destcalleridname']&&_0x11bb02[_0xee6b('0x2c')]!==_0xee6b('0x2a')?_0x11bb02['destcalleridname']:_0xee6b('0x2b');}_0x1f8143=_0x654b08;_0x105fc2[_0xee6b('0x2f')](_0x654b08);return;}}})[_0xee6b('0x2d')](function(){if(_0x248388){emit(_0x11bb02[_0xee6b('0x24')],_0x4565fc,util['format'](_0xee6b('0x31'),_0x248388[_0xee6b('0x32')]),util[_0xee6b('0x33')](_0xee6b('0x34'),_0x3ba5cd[_0xee6b('0x35')][_0xee6b('0x36')]()),{'evt':_['merge'](_0x11bb02,{'autoCreate':_0x29d62f}),'contact':_0x1f8143===undefined?{}:_0x1f8143,'contacts':_0x105fc2[_0xee6b('0x37')]===0x0?undefined:_0x105fc2});}});}; \ No newline at end of file +var _0x98ce=['','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','trigger:%s','action','merge','lodash','ioredis','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','localhost','info','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','$or','map','routeId','calleridnum','destcalleridnum','firstName','lastName','phone','mobile','fax','createdAt','scheduledAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname'];(function(_0x18c428,_0x44834d){var _0x41a78f=function(_0x35348e){while(--_0x35348e){_0x18c428['push'](_0x18c428['shift']());}};_0x41a78f(++_0x44834d);}(_0x98ce,0x113));var _0xe98c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x98ce[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xe98c('0x0'));var BPromise=require('bluebird');var Redis=require(_0xe98c('0x1'));var util=require('util');var config=require(_0xe98c('0x2'));var logger=require(_0xe98c('0x3'))('trigger');var cmContactRpc=require(_0xe98c('0x4'));config[_0xe98c('0x5')]=_['defaults'](config['redis'],{'host':_0xe98c('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe98c('0x5')]));function emit(_0x5e09be,_0x240387,_0x1228f4,_0x3c17b7,_0x15b3bb){logger[_0xe98c('0x7')](_0xe98c('0x8'),_0x5e09be,_0x240387['id'],_0x1228f4,_0x3c17b7,JSON[_0xe98c('0x9')](_0x15b3bb));io['to'](_0x1228f4)[_0xe98c('0xa')](_0x3c17b7,_0x15b3bb);}exports[_0xe98c('0xb')]=function(_0x2bc5fa,_0x30a74b,_0x31d26e,_0x5b5a99){var _0x3fafb7,_0x444e34;var _0x5a98b8={};var _0x502a08;var _0x46dd4a=Number(_0x31d26e['data1']);var _0x1847f4=_0x31d26e[_0xe98c('0xc')]?Boolean(Number(_0x31d26e[_0xe98c('0xc')])):![];var _0x3bf86e;var _0x2ef7e7=![];if(!_[_0xe98c('0xd')](_0x31d26e[_0xe98c('0xe')])){if(_0x31d26e['data5']=='1')_0x2ef7e7=!![];}if(!_0x2ef7e7){if(_0x5b5a99[_0xe98c('0xf')]){_0x5a98b8['id']=_0x5b5a99['xmd-contactid'];}}if(!_0x5a98b8['id']){_0x5a98b8[_0xe98c('0x10')]=_0x46dd4a;_0x3bf86e=_0x31d26e[_0xe98c('0x11')]&&_0x31d26e[_0xe98c('0x11')]!=='0'?_0x31d26e[_0xe98c('0x11')]['split'](','):['phone'];_0x5a98b8[_0xe98c('0x12')]=_[_0xe98c('0x13')](_0x3bf86e,function(_0x1c4433){var _0x423151={};_0x423151[_0x1c4433]=_0x5b5a99[_0xe98c('0x14')]?_0x5b5a99['destcalleridnum']:_0x5b5a99[_0xe98c('0x15')];return _0x423151;});_0x502a08=_0x5b5a99['routeId']?_0x5b5a99[_0xe98c('0x16')]:_0x5b5a99['calleridnum'];}var _0x1da656=['id',_0xe98c('0x17'),_0xe98c('0x18'),_0xe98c('0x19'),_0xe98c('0x1a'),_0xe98c('0x1b'),_0xe98c('0x10'),_0xe98c('0x1c'),_0xe98c('0x1d'),'updatedAt'];var _0x5c03ae=_[_0xe98c('0x1e')](_0x1da656,_0x3bf86e);BPromise[_0xe98c('0x1f')]()[_0xe98c('0x20')](cmContactRpc['getContacts']({'attributes':_0x5c03ae,'where':_0x5a98b8,'phone':_0x502a08}))[_0xe98c('0x20')](function(_0x11b289){_0x444e34=_0x11b289;if(!_[_0xe98c('0x21')](_0x444e34)){if(_0x444e34[_0xe98c('0x22')]===0x1){_0x3fafb7=_0x444e34[0x0];logger['info'](_0xe98c('0x23'),_0x5b5a99['uniqueid'],_0x30a74b['id'],_0x3fafb7['id']);}else{logger[_0xe98c('0x7')](_0xe98c('0x24'),_0x5b5a99[_0xe98c('0x25')],_0x30a74b['id'],_['map'](_0x444e34,'id')[_0xe98c('0x26')](','));}return;}else{logger[_0xe98c('0x7')](_0xe98c('0x27'),_0x5b5a99[_0xe98c('0x25')],_0x30a74b['id']);var _0x4a6a97={'ListId':_0x46dd4a};var _0x295a92=_0x31d26e['data4']&&_0x31d26e[_0xe98c('0x28')]!=='0'?_0x31d26e['data4']:_0xe98c('0x19');if(_0x1847f4){logger['info'](_0xe98c('0x29'),_0x5b5a99[_0xe98c('0x25')],_0x30a74b['id']);_0x4a6a97[_0x295a92]=_['isNil'](_0x5b5a99[_0xe98c('0x14')])?_0x5b5a99['calleridnum']:_0x5b5a99[_0xe98c('0x16')];if(_['isNil'](_0x5b5a99[_0xe98c('0x14')])){_0x4a6a97[_0xe98c('0x17')]=_0x5b5a99[_0xe98c('0x2a')]&&_0x5b5a99[_0xe98c('0x2a')]!==_0xe98c('0x2b')?_0x5b5a99[_0xe98c('0x2a')]:_0xe98c('0x2c');}else{_0x4a6a97[_0xe98c('0x17')]=_0x5b5a99[_0xe98c('0x2d')]&&_0x5b5a99[_0xe98c('0x2d')]!==''?_0x5b5a99[_0xe98c('0x2d')]:_0xe98c('0x2c');}return BPromise['resolve']()[_0xe98c('0x20')](cmContactRpc[_0xe98c('0x2e')](_0x4a6a97))['then'](function(_0x2ff83b){_0x3fafb7=_0x2ff83b;_0x444e34[_0xe98c('0x2f')](_0x2ff83b);if(_0x3fafb7){logger[_0xe98c('0x7')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x5b5a99[_0xe98c('0x25')],_0x30a74b['id'],_0x3fafb7['id']);}return;});}else{logger[_0xe98c('0x7')](_0xe98c('0x30'),_0x5b5a99['uniqueid'],_0x30a74b['id']);_0x4a6a97[_0x295a92]=_[_0xe98c('0xd')](_0x5b5a99[_0xe98c('0x14')])?_0x5b5a99['calleridnum']:_0x5b5a99[_0xe98c('0x16')];if(_[_0xe98c('0xd')](_0x5b5a99[_0xe98c('0x14')])){_0x4a6a97['firstName']=_0x5b5a99[_0xe98c('0x2a')]&&_0x5b5a99['calleridname']!==_0xe98c('0x2b')?_0x5b5a99[_0xe98c('0x2a')]:_0xe98c('0x2c');}else{_0x4a6a97['firstName']=_0x5b5a99[_0xe98c('0x2d')]&&_0x5b5a99[_0xe98c('0x2d')]!==_0xe98c('0x2b')?_0x5b5a99['destcalleridname']:'Unknown';}_0x3fafb7=_0x4a6a97;_0x444e34[_0xe98c('0x2f')](_0x4a6a97);return;}}})[_0xe98c('0x20')](function(){if(_0x2bc5fa){emit(_0x5b5a99['uniqueid'],_0x30a74b,util[_0xe98c('0x31')]('user:%s',_0x2bc5fa['name']),util[_0xe98c('0x31')](_0xe98c('0x32'),_0x31d26e[_0xe98c('0x33')]['toLowerCase']()),{'evt':_[_0xe98c('0x34')](_0x5b5a99,{'autoCreate':_0x1847f4}),'contact':_0x3fafb7===undefined?{}:_0x3fafb7,'contacts':_0x444e34[_0xe98c('0x22')]===0x0?undefined:_0x444e34});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index b0484fb..740cd9a 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 _0x1aa0=['undefined','motionChannel','voice','inspect','checkTriggers','interface','hasOwnProperty','checkTrigger','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','jscripty','trigger:%s','merge','exec','integration','accounts','queue','routeId','urlforward','script','query','channel','AllConditions','every','checkConditions','AnyConditions','some','debug','checkTrigger:\x20trigger','account','ChatWebsiteId','operator','upperFirst','AccountId','value','event','agent','membername','lastevent','mailSubstatus','substatus','offlineMessage','created','equals','exports','util','lodash','url','./urlforward','./integration','../../../config/environment','../../../config/logger','trigger','redis','defaults','localhost','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify'];(function(_0x278449,_0x117cb5){var _0x22cd5d=function(_0x44c6f3){while(--_0x44c6f3){_0x278449['push'](_0x278449['shift']());}};_0x22cd5d(++_0x117cb5);}(_0x1aa0,0x141));var _0x01aa=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0x1aa0[_0x1529a3];return _0x1a0d4b;};'use strict';var util=require(_0x01aa('0x0'));var _=require(_0x01aa('0x1'));var url=require(_0x01aa('0x2'));var Mustache=require('mustache');var Redis=require('ioredis');var urlforward=require(_0x01aa('0x3'));var integration=require(_0x01aa('0x4'));var cmContact=require('./cmContact');var script=require('./script');var config=require(_0x01aa('0x5'));var logger=require(_0x01aa('0x6'))(_0x01aa('0x7'));var ami=require('../ami');config[_0x01aa('0x8')]=_[_0x01aa('0x9')](config['redis'],{'host':_0x01aa('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x01aa('0x8')]));var operators={'equals':function(_0x436ae4,_0x498a73){return _0x436ae4==_0x498a73;},'not_equals':function(_0x2ba65c,_0x5b7ade){return _0x2ba65c!=_0x5b7ade;}};var barAndWebActions=[_0x01aa('0xb'),'url',_0x01aa('0xc')];function Trigger(_0x450bd9){this[_0x01aa('0xd')]=_0x450bd9[_0x01aa('0xd')];this[_0x01aa('0xe')]=_0x450bd9['agents'];this['voiceQueues']=_0x450bd9[_0x01aa('0xf')];this['templates']=_0x450bd9[_0x01aa('0x10')];this['voiceExtensions']=_0x450bd9[_0x01aa('0x11')];this['zendeskAccounts']=_0x450bd9[_0x01aa('0x12')];this['freshdeskAccounts']=_0x450bd9[_0x01aa('0x13')];this[_0x01aa('0x14')]=_0x450bd9[_0x01aa('0x14')];this['sugarcrmAccounts']=_0x450bd9[_0x01aa('0x15')];this[_0x01aa('0x16')]=_0x450bd9['zohoAccounts'];this[_0x01aa('0x17')]=_0x450bd9['deskAccounts'];this[_0x01aa('0x18')]=_0x450bd9[_0x01aa('0x18')];this['servicenowAccounts']=_0x450bd9[_0x01aa('0x19')];this[_0x01aa('0x1a')]=_0x450bd9[_0x01aa('0x1a')];this[_0x01aa('0x1b')]=_0x450bd9[_0x01aa('0x1b')];this['accounts']={'zendesk':this[_0x01aa('0x12')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x01aa('0x13')],'sugarcrm':this[_0x01aa('0x15')],'zoho':this[_0x01aa('0x16')],'desk':this[_0x01aa('0x17')],'vtiger':this[_0x01aa('0x18')],'dynamics365':this[_0x01aa('0x1a')],'freshsales':this[_0x01aa('0x1b')],'servicenow':this[_0x01aa('0x19')]};ami['on'](_0x01aa('0x1c'),this[_0x01aa('0x1d')][_0x01aa('0x1e')](this));ami['on'](_0x01aa('0x1f'),this['syncCustomEvent']['bind'](this));ami['on'](_0x01aa('0x20'),this[_0x01aa('0x1d')]['bind'](this));ami['on'](_0x01aa('0x21'),this[_0x01aa('0x1d')][_0x01aa('0x1e')](this));ami['on'](_0x01aa('0x22'),this['syncCustomEvent'][_0x01aa('0x1e')](this));ami['on'](_0x01aa('0x23'),this[_0x01aa('0x1d')]['bind'](this));ami['on']('custom:agentbusy',this['syncCustomEvent'][_0x01aa('0x1e')](this));ami['on']('custom:agentcongestion',this[_0x01aa('0x1d')][_0x01aa('0x1e')](this));ami['on']('custom:agentreject',this['syncCustomEvent'][_0x01aa('0x1e')](this));ami['on']('custom:amd',this['syncCustomEvent'][_0x01aa('0x1e')](this));ami['on'](_0x01aa('0x24'),this[_0x01aa('0x1d')][_0x01aa('0x1e')](this));ami['on']('custom:timeout',this['syncCustomEvent']['bind'](this));ami['on'](_0x01aa('0x25'),this[_0x01aa('0x26')][_0x01aa('0x1e')](this));ami['on'](_0x01aa('0x27'),this[_0x01aa('0x26')][_0x01aa('0x1e')](this));ami['on'](_0x01aa('0x28'),this[_0x01aa('0x26')][_0x01aa('0x1e')](this));ami['on'](_0x01aa('0x29'),this[_0x01aa('0x1d')][_0x01aa('0x1e')](this));ami['on'](_0x01aa('0x2a'),this[_0x01aa('0x1d')]['bind'](this));ami['on']('custom:substatus',this['syncCustomEvent'][_0x01aa('0x1e')](this));ami['on'](_0x01aa('0x2b'),this[_0x01aa('0x1d')]['bind'](this));ami['on'](_0x01aa('0x2c'),this['syncCustomEvent'][_0x01aa('0x1e')](this));ami['on'](_0x01aa('0x2d'),this[_0x01aa('0x1d')]['bind'](this));ami['on'](_0x01aa('0x2e'),this[_0x01aa('0x1d')]['bind'](this));ami['on']('custom:offlineMessage',this[_0x01aa('0x1d')][_0x01aa('0x1e')](this));}Trigger[_0x01aa('0x2f')][_0x01aa('0x30')]=function(_0x20ec70,_0x13d34c,_0x13d04a){logger[_0x01aa('0x31')](_0x20ec70,_0x13d34c,JSON[_0x01aa('0x32')](_0x13d04a));io['to'](_0x20ec70)[_0x01aa('0x30')](_0x13d34c,_0x13d04a);};Trigger[_0x01aa('0x2f')][_0x01aa('0x1d')]=function(_0x18ed6d){var _0x566583=_['clone'](_0x18ed6d);if(typeof _0x566583['motionChannel']===_0x01aa('0x33')){_0x566583[_0x01aa('0x34')]=_0x01aa('0x35');}logger['debug'](_0x01aa('0x1d'),util[_0x01aa('0x36')](_0x566583,{'showHidden':!![],'depth':null}));this[_0x01aa('0x37')](_0x566583);};Trigger[_0x01aa('0x2f')][_0x01aa('0x26')]=function(_0x1be690){if(this[_0x01aa('0xe')][_0x1be690[_0x01aa('0x38')]]){this[_0x01aa('0x1d')](_0x1be690);}};Trigger[_0x01aa('0x2f')][_0x01aa('0x37')]=function(_0x1db506){var _0x4994ca;for(var _0x5b7901 in this[_0x01aa('0xd')]){if(this[_0x01aa('0xd')][_0x01aa('0x39')](_0x5b7901)){if(this[_0x01aa('0xd')][_0x5b7901]['status']){_0x4994ca=this[_0x01aa('0x3a')](this[_0x01aa('0xd')][_0x5b7901],_0x1db506);if(_0x4994ca){_['merge'](_0x1db506,_0x1db506[_0x01aa('0x3b')]);for(var _0xe20d35=0x0,_0x340cd1,_0x1eb5e6,_0x5d38bd;_0xe20d350x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x57aa8a,_0x3d2b9d){var _0x491dce=function(_0x46ca80){while(--_0x46ca80){_0x57aa8a['push'](_0x57aa8a['shift']());}};_0x491dce(++_0x3d2b9d);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 3c3fbdf..723eb40 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 _0x167e=['telephone1','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing','info',']\x20Enduser\x20created!','includes','string','picklist','type','nameField','idField','indexOf','content','ticketType','incidents','assign','getString','Subjects','/contacts(','Fields','callDirection','queue','phonecalls','headers','ticketId','format','user:%s','emit','trigger:browser:url','serverUrl','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','error','Error\x20running\x20Dynamics365\x20integration','lodash','md5','../../../../config/logger','../../../../config/environment','redis','socket.io-emitter','modernAuthentication','remoteUri','data7','tenantId','CloudProvider','resolve','POST','username','password','clientSecret','then','access_token','catch','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','contacts','/systemusers(','4.0','odata-entityid','substring','lastIndexOf','enduserId','outbound','calleridnum'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x167e,0x163));var _0xe167=function(_0x20d88b,_0x48c7df){_0x20d88b=_0x20d88b-0x0;var _0x53e982=_0x167e[_0x20d88b];return _0x53e982;};'use strict';var _=require(_0xe167('0x0'));var rp=require('request-promise');var util=require('util');var intUtil=require('./util');var md5=require(_0xe167('0x1'));var Redis=require('ioredis');var logger=require(_0xe167('0x2'))('dynamics365');var config=require(_0xe167('0x3'));config['redis']=_['defaults'](config[_0xe167('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xe167('0x5'))(new Redis(config['redis']));function getAuthToken(_0x7637f3,_0x394c9e,_0x3d51d4){if(_0x7637f3[_0xe167('0x6')]){_0x7637f3[_0xe167('0x7')]=_0x7637f3['CloudProvider'][_0xe167('0x8')];_0x7637f3[_0xe167('0x9')]=_0x7637f3[_0xe167('0xa')]['data2'];return Promise[_0xe167('0xb')](_0x7637f3['CloudProvider']['data5']);}var _0x51027b={'method':_0xe167('0xc'),'uri':_0x394c9e,'form':{'client_id':_0x7637f3['clientId'],'resource':_0x7637f3[_0xe167('0x7')],'username':_0x7637f3[_0xe167('0xd')],'password':_0x7637f3[_0xe167('0xe')],'grant_type':_0xe167('0xe'),'client_secret':_0x7637f3[_0xe167('0xf')]},'json':!![]};return rp(_0x51027b)[_0xe167('0x10')](function(_0x5f7b22){return _0x5f7b22[_0xe167('0x11')];})[_0xe167('0x12')](function(_0x2b79fb){logger['error']('['+[_0x3d51d4['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x2b79fb[_0xe167('0x13')];});}function getUser(_0xd141e0,_0x47c747,_0x5e476d,_0x7bfc,_0x1ebb08,_0xb3d0a4){return new Promise(function(_0x17b178,_0x564152){return getAuthToken(_0x47c747,_0x7bfc,_0xb3d0a4)['then'](function(_0x4ae460){var _0x721c54={'method':_0xe167('0x14'),'uri':_0x1ebb08+_0xe167('0x15'),'headers':{'Authorization':_0xe167('0x16')+_0x4ae460,'OData-Version':'4.0'},'json':!![]};return rp(_0x721c54);})[_0xe167('0x10')](function(_0x15e5f8){var _0x1c85ed=_0x15e5f8[_0xe167('0x17')];var _0x58b302=![];var _0x18604e=null;if(!_[_0xe167('0x18')](_0x5e476d)){if(intUtil[_0xe167('0x19')](_0x5e476d[_0xe167('0x1a')])){_0xd141e0[_0xe167('0x1b')]=_0x5e476d[_0xe167('0x1a')];for(_0x18604e=0x0;_0x18604e<_0x1c85ed[_0xe167('0x1c')];_0x18604e++){if(_0x1c85ed[_0x18604e][_0xe167('0x1d')]===_0x5e476d['email']&&!_0x1c85ed[_0x18604e][_0xe167('0x1e')]){_0x58b302=!![];logger['info']('['+[_0xb3d0a4['toUpperCase']()]+_0xe167('0x1f')+_0x1c85ed[_0x18604e]['systemuserid']+'!');_0xd141e0['userId']=_0x1c85ed[_0x18604e][_0xe167('0x20')];}}}}if(!_0x58b302){logger['info']('['+[_0xb3d0a4[_0xe167('0x21')]()]+_0xe167('0x22'));_0xd141e0[_0xe167('0x1b')]=_0x47c747[_0xe167('0xd')];for(_0x18604e=0x0;_0x18604e<_0x1c85ed[_0xe167('0x1c')];_0x18604e++){if(_0x1c85ed[_0x18604e][_0xe167('0x1d')]===_0x47c747[_0xe167('0xd')]){_0xd141e0[_0xe167('0x23')]=_0x1c85ed[_0x18604e][_0xe167('0x20')];}}}_0x17b178(_0xd141e0);})[_0xe167('0x12')](function(_0x1ff88f){_0x564152(_0x1ff88f[_0xe167('0x13')]);});});}function createEndUser(_0x362480,_0xe5c7bc,_0xfb9af4,_0x203567,_0x124a55,_0x4f9fd7,_0x442b33){return new Promise(function(_0x26bf5f,_0x5e63a9){return getAuthToken(_0xe5c7bc,_0xfb9af4,_0x4f9fd7)[_0xe167('0x10')](function(_0x40d841){var _0x100f18=_0x4f9fd7['toLowerCase']()==='outbound'?_0x124a55['destcalleridnum']:_0x124a55['calleridnum'];var _0x38f494={'method':_0xe167('0xc'),'uri':_0x203567+_0xe167('0x24'),'body':{'fullname':_0x100f18,'firstname':_0x100f18,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xe167('0x25')+_0x362480[_0xe167('0x23')]+')'},'headers':{'Authorization':_0xe167('0x16')+_0x40d841,'OData-Version':_0xe167('0x26')},'json':!![],'resolveWithFullResponse':!![]};_0x38f494['body'][_0x442b33]=_0x100f18;return rp(_0x38f494);})[_0xe167('0x10')](function(_0x1df9ef){var _0x8bc265=_0x1df9ef['headers'][_0xe167('0x27')];var _0x28e6ff=_0x8bc265[_0xe167('0x28')](_0x8bc265[_0xe167('0x29')]('(')+0x1,_0x8bc265[_0xe167('0x29')](')'));_0x362480[_0xe167('0x2a')]=_0x28e6ff;_0x26bf5f(_0x362480);})[_0xe167('0x12')](function(_0x21a519){_0x5e63a9(_0x21a519[_0xe167('0x13')]);});});}function getEndUser(_0x126ddf,_0x2af68c,_0x27b2cc,_0x56279c,_0x11a9f7,_0xe10e57,_0x34167d,_0x4dfdea){var _0x624c34=_0xe10e57['toLowerCase']()===_0xe167('0x2b')?_0x11a9f7['destcalleridnum']:_0x11a9f7[_0xe167('0x2c')];return getAuthToken(_0x2af68c,_0x27b2cc,_0xe10e57)[_0xe167('0x10')](function(_0x2dce3d){_0x4dfdea=_0x4dfdea?_0x4dfdea:_0xe167('0x2d');var _0x25c53d={'method':'GET','uri':_0x56279c+'contacts?$select='+_0x4dfdea+_0xe167('0x2e')+_0x4dfdea+_0xe167('0x2f')+_0x624c34[_0xe167('0x30')]('+',_0xe167('0x31'))+'\x27','headers':{'Authorization':_0xe167('0x16')+_0x2dce3d,'If-None-Match':null,'OData-Version':_0xe167('0x26')},'json':!![]};return rp(_0x25c53d);})[_0xe167('0x10')](function(_0x70a89a){var _0x33bdee=![];if(!_0x70a89a)return _0x33bdee;var _0x35c4dd=_0x70a89a[_0xe167('0x17')];for(var _0x14c3a9=0x0;_0x14c3a9<_0x35c4dd['length'];_0x14c3a9++){if(_0x35c4dd[_0x14c3a9][_0x4dfdea]===_0x624c34){_0x33bdee=!![];_0x126ddf[_0xe167('0x2a')]=_0x35c4dd[_0x14c3a9][_0xe167('0x32')];}}return _0x33bdee;})['then'](function(_0x22c8b7){if(_0x22c8b7)return _0x126ddf;if(_0x34167d===_0xe167('0x33')){logger[_0xe167('0x34')]('['+[_0xe10e57['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x126ddf;}return createEndUser(_0x126ddf,_0x2af68c,_0x27b2cc,_0x56279c,_0x11a9f7,_0xe10e57,_0x4dfdea)[_0xe167('0x10')](function(_0x2304d4){logger[_0xe167('0x34')]('['+[_0xe10e57[_0xe167('0x21')]()]+_0xe167('0x35'),_0x2304d4[_0xe167('0x2a')]);return _0x2304d4;});});}function getCustomFields(_0x3423d1,_0xc18f9b,_0x529497){var _0x20a551={};if(_0x3423d1['length']>0x0){_['forEach'](_0x3423d1,function(_0x271f1f){if(_[_0xe167('0x36')]([_0xe167('0x37'),_0xe167('0x38')],_0x271f1f[_0xe167('0x39')])&&_0x271f1f[_0xe167('0x3a')]&&!_0x271f1f['customField']){var _0x1127c6=_0x271f1f[_0xe167('0x3b')]['toLowerCase']();var _0x1e23d1=_0x1127c6['substring'](0x0,_0x1127c6[_0xe167('0x3c')]('_'));var _0x5983c0=_0x1127c6[_0xe167('0x28')](_0x1127c6[_0xe167('0x3c')]('_')+0x1);if(_0x1e23d1===_0x529497){_0x20a551[_0x5983c0]=_0x271f1f[_0xe167('0x3d')];}}});}return _0x20a551;}function getTicket(_0x4ccb86,_0x133f5,_0x2804f8,_0x28b466,_0x1e62f7,_0x192d3a,_0x650987){return new Promise(function(_0xbc6aaa,_0x468001){var _0x370efd;return getAuthToken(_0x133f5,_0x2804f8,_0x650987)[_0xe167('0x10')](function(_0xe3cbd6){if(_0x192d3a[_0xe167('0x3e')]==='incident'){_0x370efd={'method':_0xe167('0xc'),'uri':_0x28b466+_0xe167('0x3f'),'body':Object[_0xe167('0x40')]({},{'title':intUtil[_0xe167('0x41')](_0x192d3a[_0xe167('0x42')],_0x1e62f7,'\x20'),'description':intUtil[_0xe167('0x41')](_0x192d3a['Descriptions'],_0x1e62f7,'\x0a'),'customerid_contact@odata.bind':_0x4ccb86[_0xe167('0x2a')]?_0xe167('0x43')+_0x4ccb86[_0xe167('0x2a')]+')':undefined,'ownerid@odata.bind':_0xe167('0x25')+_0x4ccb86[_0xe167('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x192d3a[_0xe167('0x44')],_0x1e62f7,_0x192d3a[_0xe167('0x3e')])),'headers':{'Authorization':_0xe167('0x16')+_0xe3cbd6,'OData-Version':_0xe167('0x26')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x192d3a[_0xe167('0x3e')]==='phonecall'){var _0x458136=_0x4ccb86[_0xe167('0x2a')]?[{'partyid_systemuser@odata.bind':_0xe167('0x25')+_0x4ccb86[_0xe167('0x23')]+')','participationtypemask':_0x4ccb86[_0xe167('0x45')]===_0xe167('0x46')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x4ccb86[_0xe167('0x2a')]+')','participationtypemask':_0x4ccb86[_0xe167('0x45')]===_0xe167('0x46')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xe167('0x25')+_0x4ccb86[_0xe167('0x23')]+')','participationtypemask':_0x4ccb86[_0xe167('0x45')]==='queue'?0x2:0x1}];_0x370efd={'method':'POST','uri':_0x28b466+_0xe167('0x47'),'body':Object['assign']({},{'subject':intUtil[_0xe167('0x41')](_0x192d3a['Subjects'],_0x1e62f7,'\x20'),'phonenumber':String(_0x1e62f7['calleridnum']),'description':intUtil[_0xe167('0x41')](_0x192d3a['Descriptions'],_0x1e62f7,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4ccb86[_0xe167('0x2a')]?_0xe167('0x43')+_0x4ccb86['enduserId']+')':undefined,'ownerid@odata.bind':_0xe167('0x25')+_0x4ccb86['userId']+')','directioncode':_0x4ccb86[_0xe167('0x45')]===_0xe167('0x46')?![]:!![],'phonecall_activity_parties':_0x458136},getCustomFields(_0x192d3a['Fields'],_0x1e62f7,_0x192d3a[_0xe167('0x3e')])),'headers':{'Authorization':'Bearer\x20'+_0xe3cbd6,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x370efd);})[_0xe167('0x10')](function(_0x31d275){var _0x1379b0=_0x31d275[_0xe167('0x48')][_0xe167('0x27')];var _0x20cbb9=_0x1379b0[_0xe167('0x28')](_0x1379b0[_0xe167('0x29')]('(')+0x1,_0x1379b0[_0xe167('0x29')](')'));_0x4ccb86[_0xe167('0x49')]=_0x20cbb9;_0xbc6aaa(_0x4ccb86);})[_0xe167('0x12')](function(_0x131725){_0x468001(_0x131725[_0xe167('0x13')]);});});}function emit(_0x4ad401,_0x248c48,_0x4d9e9f,_0x20e1e8){var _0x240bbc={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x4ad401,_0x4d9e9f,_0x20e1e8)};io['to'](util[_0xe167('0x4a')](_0xe167('0x4b'),_0x248c48))[_0xe167('0x4c')](_0xe167('0x4d'),_0x240bbc);}exports['cs']=function(_0x42e71b,_0x3040ef,_0x420e32,_0x4614a0,_0x45625b,_0x11ccd4,_0x3e0d95,_0x2dde5e){var _0x5d8af1={};_0x11ccd4[_0xe167('0x7')]=_0x11ccd4[_0xe167('0x6')]?intUtil['stripTrailingSlash'](_0x11ccd4[_0xe167('0xa')]['data7']):intUtil['stripTrailingSlash'](_0x11ccd4[_0xe167('0x7')]);_0x11ccd4[_0xe167('0x4e')]=intUtil[_0xe167('0x4f')](_0x11ccd4[_0xe167('0x4e')]);_0x5d8af1[_0xe167('0x45')]=_0x2dde5e==='queue'||_0x2dde5e===_0xe167('0x50')?'queue':_0xe167('0x2b');var _0x269b64=_0x11ccd4[_0xe167('0x6')]?util[_0xe167('0x4a')](_0xe167('0x51'),_0x11ccd4[_0xe167('0xa')]['data7']):util[_0xe167('0x4a')]('%s/api/data/v9.0/',_0x11ccd4[_0xe167('0x7')]);var _0x264f8b=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x11ccd4[_0xe167('0x9')]);var _0x4f2093=util[_0xe167('0x4a')](_0xe167('0x52'),_0x11ccd4[_0xe167('0x4e')],_0x3040ef[_0xe167('0x53')],md5(_0x3040ef['uniqueid']));if(_0x45625b&&_0x45625b[_0xe167('0x54')]){logger[_0xe167('0x34')](_0xe167('0x55'),'Recording\x20is\x20enabled!');_0x3040ef[_0xe167('0x56')]=_0x4f2093;}else if(_0x3e0d95&&_0x3e0d95['recordingFormat']&&_0x3e0d95[_0xe167('0x57')]!==_0xe167('0x58')){logger[_0xe167('0x34')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3040ef[_0xe167('0x56')]=_0x4f2093;}else{_0x3040ef[_0xe167('0x56')]='';}return getUser(_0x5d8af1,_0x11ccd4,_0x4614a0,_0x264f8b,_0x269b64,_0x2dde5e)[_0xe167('0x10')](function(_0x103724){logger[_0xe167('0x34')]('['+_0x2dde5e['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x103724[_0xe167('0x23')]);logger[_0xe167('0x34')]('['+_0x2dde5e[_0xe167('0x21')]()+']\x20The\x20User\x20email\x20is:',_0x103724[_0xe167('0x1b')]);return getEndUser(_0x103724,_0x11ccd4,_0x264f8b,_0x269b64,_0x3040ef,_0x2dde5e,_0x420e32[_0xe167('0x59')],_0x420e32[_0xe167('0x5a')]);})['then'](function(_0x5670b5){logger[_0xe167('0x34')]('['+_0x2dde5e[_0xe167('0x21')]()+_0xe167('0x5b'),_0x5670b5[_0xe167('0x2a')]);logger['info']('['+_0x2dde5e['toUpperCase']()+_0xe167('0x5c'),_0x3040ef[_0xe167('0x2c')]);return getTicket(_0x5670b5,_0x11ccd4,_0x264f8b,_0x269b64,_0x3040ef,_0x420e32,_0x2dde5e);})[_0xe167('0x10')](function(_0x135ec6){logger[_0xe167('0x34')](util['format']('['+_0x2dde5e[_0xe167('0x21')]()+_0xe167('0x5d'),_0x420e32[_0xe167('0x3e')],_0x135ec6[_0xe167('0x49')]));logger['info'](util['format']('['+_0x2dde5e[_0xe167('0x21')]()+_0xe167('0x5e'),_0x2dde5e));if(_0x2dde5e!==_0xe167('0x50')&&_0x420e32['openNewTab']){logger[_0xe167('0x34')]('['+_0x2dde5e[_0xe167('0x21')]()+']',_0xe167('0x5f'));emit(_0x11ccd4[_0xe167('0x7')],_0x4614a0[_0xe167('0x60')],_0x420e32['ticketType'],_0x135ec6[_0xe167('0x49')]);}})[_0xe167('0x12')](function(_0x46795f){logger['error']('['+_0x2dde5e[_0xe167('0x21')]()+_0xe167('0x61'),_0x46795f['message']);console[_0xe167('0x62')](_0xe167('0x63'),_0x46795f);});}; \ No newline at end of file +var _0x6d42=['CloudProvider','data5','clientId','password','clientSecret','then','access_token','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','userId','catch','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','4.0','headers','substring','lastIndexOf','enduserId','message','telephone1','contacts?$select=','\x20eq\x20\x27','%2b','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','customField','incident','incidents','assign','Subjects','getString','Fields','ticketType','phonecall','/systemusers(','callDirection','queue','/contacts(','Descriptions','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','tenantId','data2','resolve'];(function(_0x6096d5,_0x234765){var _0x67bb17=function(_0x4dabfd){while(--_0x4dabfd){_0x6096d5['push'](_0x6096d5['shift']());}};_0x67bb17(++_0x234765);}(_0x6d42,0x137));var _0x26d4=function(_0x56d358,_0x5dbad3){_0x56d358=_0x56d358-0x0;var _0x593fc4=_0x6d42[_0x56d358];return _0x593fc4;};'use strict';var _=require(_0x26d4('0x0'));var rp=require(_0x26d4('0x1'));var util=require(_0x26d4('0x2'));var intUtil=require(_0x26d4('0x3'));var md5=require('md5');var Redis=require('ioredis');var logger=require(_0x26d4('0x4'))('dynamics365');var config=require(_0x26d4('0x5'));config[_0x26d4('0x6')]=_[_0x26d4('0x7')](config[_0x26d4('0x6')],{'host':_0x26d4('0x8'),'port':0x18eb});var io=require(_0x26d4('0x9'))(new Redis(config[_0x26d4('0x6')]));function getAuthToken(_0x19bc58,_0x5c5498,_0x42f72c){if(_0x19bc58[_0x26d4('0xa')]){_0x19bc58[_0x26d4('0xb')]=_0x19bc58['CloudProvider'][_0x26d4('0xc')];_0x19bc58[_0x26d4('0xd')]=_0x19bc58['CloudProvider'][_0x26d4('0xe')];return Promise[_0x26d4('0xf')](_0x19bc58[_0x26d4('0x10')][_0x26d4('0x11')]);}var _0xa4081c={'method':'POST','uri':_0x5c5498,'form':{'client_id':_0x19bc58[_0x26d4('0x12')],'resource':_0x19bc58[_0x26d4('0xb')],'username':_0x19bc58['username'],'password':_0x19bc58[_0x26d4('0x13')],'grant_type':_0x26d4('0x13'),'client_secret':_0x19bc58[_0x26d4('0x14')]},'json':!![]};return rp(_0xa4081c)[_0x26d4('0x15')](function(_0xe0a6e4){return _0xe0a6e4[_0x26d4('0x16')];})['catch'](function(_0x38bddb){logger['error']('['+[_0x42f72c['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x38bddb['message'];});}function getUser(_0x4e76b6,_0x47b11f,_0x998282,_0x4b15b6,_0x32aa6b,_0x1708d4){return new Promise(function(_0x40a838,_0x1bdda0){return getAuthToken(_0x47b11f,_0x4b15b6,_0x1708d4)[_0x26d4('0x15')](function(_0x4e2848){var _0x483078={'method':_0x26d4('0x17'),'uri':_0x32aa6b+_0x26d4('0x18'),'headers':{'Authorization':_0x26d4('0x19')+_0x4e2848,'OData-Version':'4.0'},'json':!![]};return rp(_0x483078);})[_0x26d4('0x15')](function(_0x18d3dd){var _0x5cb5eb=_0x18d3dd[_0x26d4('0x1a')];var _0x339de6=![];var _0x1ab73a=null;if(!_[_0x26d4('0x1b')](_0x998282)){if(intUtil[_0x26d4('0x1c')](_0x998282[_0x26d4('0x1d')])){_0x4e76b6[_0x26d4('0x1e')]=_0x998282[_0x26d4('0x1d')];for(_0x1ab73a=0x0;_0x1ab73a<_0x5cb5eb[_0x26d4('0x1f')];_0x1ab73a++){if(_0x5cb5eb[_0x1ab73a][_0x26d4('0x20')]===_0x998282[_0x26d4('0x1d')]&&!_0x5cb5eb[_0x1ab73a][_0x26d4('0x21')]){_0x339de6=!![];logger[_0x26d4('0x22')]('['+[_0x1708d4[_0x26d4('0x23')]()]+_0x26d4('0x24')+_0x5cb5eb[_0x1ab73a][_0x26d4('0x25')]+'!');_0x4e76b6['userId']=_0x5cb5eb[_0x1ab73a][_0x26d4('0x25')];}}}}if(!_0x339de6){logger[_0x26d4('0x22')]('['+[_0x1708d4[_0x26d4('0x23')]()]+_0x26d4('0x26'));_0x4e76b6['userEmail']=_0x47b11f['username'];for(_0x1ab73a=0x0;_0x1ab73a<_0x5cb5eb[_0x26d4('0x1f')];_0x1ab73a++){if(_0x5cb5eb[_0x1ab73a][_0x26d4('0x20')]===_0x47b11f[_0x26d4('0x27')]){_0x4e76b6[_0x26d4('0x28')]=_0x5cb5eb[_0x1ab73a][_0x26d4('0x25')];}}}_0x40a838(_0x4e76b6);})[_0x26d4('0x29')](function(_0x4b258f){_0x1bdda0(_0x4b258f['message']);});});}function createEndUser(_0x3f5903,_0x4260b6,_0x1a3a07,_0x2d70f6,_0x3c2a04,_0x8276b5,_0x4eacfb){return new Promise(function(_0x29e892,_0x159458){return getAuthToken(_0x4260b6,_0x1a3a07,_0x8276b5)[_0x26d4('0x15')](function(_0x486bf6){var _0x452e47=_0x8276b5[_0x26d4('0x2a')]()===_0x26d4('0x2b')?_0x3c2a04[_0x26d4('0x2c')]:_0x3c2a04[_0x26d4('0x2d')];var _0x30295e={'method':_0x26d4('0x2e'),'uri':_0x2d70f6+_0x26d4('0x2f'),'body':{'fullname':_0x452e47,'firstname':_0x452e47,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x3f5903[_0x26d4('0x28')]+')'},'headers':{'Authorization':_0x26d4('0x19')+_0x486bf6,'OData-Version':_0x26d4('0x30')},'json':!![],'resolveWithFullResponse':!![]};_0x30295e['body'][_0x4eacfb]=_0x452e47;return rp(_0x30295e);})[_0x26d4('0x15')](function(_0x57d135){var _0x428d9e=_0x57d135[_0x26d4('0x31')]['odata-entityid'];var _0x4d7e3b=_0x428d9e[_0x26d4('0x32')](_0x428d9e[_0x26d4('0x33')]('(')+0x1,_0x428d9e[_0x26d4('0x33')](')'));_0x3f5903[_0x26d4('0x34')]=_0x4d7e3b;_0x29e892(_0x3f5903);})[_0x26d4('0x29')](function(_0x2a44b1){_0x159458(_0x2a44b1[_0x26d4('0x35')]);});});}function getEndUser(_0x305108,_0x1af836,_0x24b27e,_0x59cd6c,_0x226627,_0x16c65b,_0x304ed6,_0x2ab563){var _0x4e592f=_0x16c65b['toLowerCase']()===_0x26d4('0x2b')?_0x226627['destcalleridnum']:_0x226627[_0x26d4('0x2d')];return getAuthToken(_0x1af836,_0x24b27e,_0x16c65b)['then'](function(_0x5be1be){_0x2ab563=_0x2ab563?_0x2ab563:_0x26d4('0x36');var _0x142fd4={'method':'GET','uri':_0x59cd6c+_0x26d4('0x37')+_0x2ab563+'&$filter='+_0x2ab563+_0x26d4('0x38')+_0x4e592f['replace']('+',_0x26d4('0x39'))+'\x27','headers':{'Authorization':_0x26d4('0x19')+_0x5be1be,'If-None-Match':null,'OData-Version':_0x26d4('0x30')},'json':!![]};return rp(_0x142fd4);})[_0x26d4('0x15')](function(_0x3884e8){var _0x59cca2=![];if(!_0x3884e8)return _0x59cca2;var _0x36e018=_0x3884e8['value'];for(var _0x1ceffe=0x0;_0x1ceffe<_0x36e018['length'];_0x1ceffe++){if(_0x36e018[_0x1ceffe][_0x2ab563]===_0x4e592f){_0x59cca2=!![];_0x305108[_0x26d4('0x34')]=_0x36e018[_0x1ceffe]['contactid'];}}return _0x59cca2;})[_0x26d4('0x15')](function(_0x37a882){if(_0x37a882)return _0x305108;if(_0x304ed6===_0x26d4('0x3a')){logger[_0x26d4('0x22')]('['+[_0x16c65b[_0x26d4('0x23')]()]+_0x26d4('0x3b'));return _0x305108;}return createEndUser(_0x305108,_0x1af836,_0x24b27e,_0x59cd6c,_0x226627,_0x16c65b,_0x2ab563)[_0x26d4('0x15')](function(_0x3e8065){logger[_0x26d4('0x22')]('['+[_0x16c65b[_0x26d4('0x23')]()]+_0x26d4('0x3c'),_0x3e8065[_0x26d4('0x34')]);return _0x3e8065;});});}function getCustomFields(_0x47e465,_0x5da37c,_0x2166d7){var _0x395a24={};if(_0x47e465['length']>0x0){_[_0x26d4('0x3d')](_0x47e465,function(_0x31633f){if(_[_0x26d4('0x3e')]([_0x26d4('0x3f'),'picklist'],_0x31633f[_0x26d4('0x40')])&&_0x31633f[_0x26d4('0x41')]&&!_0x31633f[_0x26d4('0x42')]){var _0x573cb5=_0x31633f['idField'][_0x26d4('0x2a')]();var _0x5abc78=_0x573cb5['substring'](0x0,_0x573cb5['indexOf']('_'));var _0x363de0=_0x573cb5[_0x26d4('0x32')](_0x573cb5['indexOf']('_')+0x1);if(_0x5abc78===_0x2166d7){_0x395a24[_0x363de0]=_0x31633f['content'];}}});}return _0x395a24;}function getTicket(_0xd8e4b9,_0x3e1981,_0x40cc6d,_0x119d24,_0x5268f9,_0x4cbf20,_0x2bf4ab){return new Promise(function(_0x1a2ed2,_0x4353ad){var _0x16997d;return getAuthToken(_0x3e1981,_0x40cc6d,_0x2bf4ab)['then'](function(_0xac7b9c){if(_0x4cbf20['ticketType']===_0x26d4('0x43')){_0x16997d={'method':_0x26d4('0x2e'),'uri':_0x119d24+_0x26d4('0x44'),'body':Object[_0x26d4('0x45')]({},{'title':intUtil['getString'](_0x4cbf20[_0x26d4('0x46')],_0x5268f9,'\x20'),'description':intUtil[_0x26d4('0x47')](_0x4cbf20['Descriptions'],_0x5268f9,'\x0a'),'customerid_contact@odata.bind':_0xd8e4b9[_0x26d4('0x34')]?'/contacts('+_0xd8e4b9['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0xd8e4b9['userId']+')','caseorigincode':'1'},getCustomFields(_0x4cbf20[_0x26d4('0x48')],_0x5268f9,_0x4cbf20[_0x26d4('0x49')])),'headers':{'Authorization':_0x26d4('0x19')+_0xac7b9c,'OData-Version':_0x26d4('0x30')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4cbf20[_0x26d4('0x49')]===_0x26d4('0x4a')){var _0x23c599=_0xd8e4b9[_0x26d4('0x34')]?[{'partyid_systemuser@odata.bind':_0x26d4('0x4b')+_0xd8e4b9[_0x26d4('0x28')]+')','participationtypemask':_0xd8e4b9[_0x26d4('0x4c')]===_0x26d4('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0x26d4('0x4e')+_0xd8e4b9[_0x26d4('0x34')]+')','participationtypemask':_0xd8e4b9[_0x26d4('0x4c')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x26d4('0x4b')+_0xd8e4b9[_0x26d4('0x28')]+')','participationtypemask':_0xd8e4b9[_0x26d4('0x4c')]===_0x26d4('0x4d')?0x2:0x1}];_0x16997d={'method':'POST','uri':_0x119d24+'phonecalls','body':Object[_0x26d4('0x45')]({},{'subject':intUtil['getString'](_0x4cbf20[_0x26d4('0x46')],_0x5268f9,'\x20'),'phonenumber':String(_0x5268f9['calleridnum']),'description':intUtil[_0x26d4('0x47')](_0x4cbf20[_0x26d4('0x4f')],_0x5268f9,'\x0a'),'regardingobjectid_contact@odata.bind':_0xd8e4b9['enduserId']?_0x26d4('0x4e')+_0xd8e4b9[_0x26d4('0x34')]+')':undefined,'ownerid@odata.bind':_0x26d4('0x4b')+_0xd8e4b9[_0x26d4('0x28')]+')','directioncode':_0xd8e4b9['callDirection']===_0x26d4('0x4d')?![]:!![],'phonecall_activity_parties':_0x23c599},getCustomFields(_0x4cbf20['Fields'],_0x5268f9,_0x4cbf20[_0x26d4('0x49')])),'headers':{'Authorization':_0x26d4('0x19')+_0xac7b9c,'OData-Version':_0x26d4('0x30')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x16997d);})[_0x26d4('0x15')](function(_0x3004bf){var _0x2798f3=_0x3004bf['headers'][_0x26d4('0x50')];var _0x5a3a2f=_0x2798f3[_0x26d4('0x32')](_0x2798f3[_0x26d4('0x33')]('(')+0x1,_0x2798f3[_0x26d4('0x33')](')'));_0xd8e4b9[_0x26d4('0x51')]=_0x5a3a2f;_0x1a2ed2(_0xd8e4b9);})['catch'](function(_0x858e32){_0x4353ad(_0x858e32[_0x26d4('0x35')]);});});}function emit(_0x167cb8,_0x5943b3,_0x38b4c3,_0x29103d){var _0x43f167={'uri':util[_0x26d4('0x52')](_0x26d4('0x53'),_0x167cb8,_0x38b4c3,_0x29103d)};io['to'](util[_0x26d4('0x52')](_0x26d4('0x54'),_0x5943b3))['emit'](_0x26d4('0x55'),_0x43f167);}exports['cs']=function(_0x3cdf6d,_0x3a47e1,_0x32563d,_0x11187b,_0x1dc3cb,_0x575915,_0x584c00,_0x5ee0c8){var _0x5199ac={};_0x575915['remoteUri']=_0x575915[_0x26d4('0xa')]?intUtil['stripTrailingSlash'](_0x575915['CloudProvider']['data7']):intUtil['stripTrailingSlash'](_0x575915['remoteUri']);_0x575915[_0x26d4('0x56')]=intUtil['stripTrailingSlash'](_0x575915['serverUrl']);_0x5199ac['callDirection']=_0x5ee0c8===_0x26d4('0x4d')||_0x5ee0c8===_0x26d4('0x57')?_0x26d4('0x4d'):_0x26d4('0x2b');var _0x1da033=_0x575915[_0x26d4('0xa')]?util[_0x26d4('0x52')](_0x26d4('0x58'),_0x575915[_0x26d4('0x10')][_0x26d4('0xc')]):util[_0x26d4('0x52')](_0x26d4('0x58'),_0x575915['remoteUri']);var _0x3759c1=util[_0x26d4('0x52')](_0x26d4('0x59'),_0x575915['tenantId']);var _0x3685b2=util[_0x26d4('0x52')](_0x26d4('0x5a'),_0x575915[_0x26d4('0x56')],_0x3a47e1[_0x26d4('0x5b')],md5(_0x3a47e1[_0x26d4('0x5b')]));if(_0x1dc3cb&&_0x1dc3cb[_0x26d4('0x5c')]){logger[_0x26d4('0x22')](_0x26d4('0x5d'),_0x26d4('0x5e'));_0x3a47e1[_0x26d4('0x5f')]=_0x3685b2;}else if(_0x584c00&&_0x584c00[_0x26d4('0x60')]&&_0x584c00[_0x26d4('0x60')]!=='none'){logger[_0x26d4('0x22')](_0x26d4('0x61'),_0x26d4('0x5e'));_0x3a47e1[_0x26d4('0x5f')]=_0x3685b2;}else{_0x3a47e1[_0x26d4('0x5f')]='';}return getUser(_0x5199ac,_0x575915,_0x11187b,_0x3759c1,_0x1da033,_0x5ee0c8)[_0x26d4('0x15')](function(_0xe4ba41){logger[_0x26d4('0x22')]('['+_0x5ee0c8[_0x26d4('0x23')]()+']\x20The\x20User\x20ID\x20is:',_0xe4ba41[_0x26d4('0x28')]);logger[_0x26d4('0x22')]('['+_0x5ee0c8['toUpperCase']()+_0x26d4('0x62'),_0xe4ba41[_0x26d4('0x1e')]);return getEndUser(_0xe4ba41,_0x575915,_0x3759c1,_0x1da033,_0x3a47e1,_0x5ee0c8,_0x32563d[_0x26d4('0x63')],_0x32563d[_0x26d4('0x64')]);})[_0x26d4('0x15')](function(_0x410d82){logger[_0x26d4('0x22')]('['+_0x5ee0c8['toUpperCase']()+_0x26d4('0x65'),_0x410d82[_0x26d4('0x34')]);logger[_0x26d4('0x22')]('['+_0x5ee0c8[_0x26d4('0x23')]()+_0x26d4('0x66'),_0x3a47e1['calleridnum']);return getTicket(_0x410d82,_0x575915,_0x3759c1,_0x1da033,_0x3a47e1,_0x32563d,_0x5ee0c8);})[_0x26d4('0x15')](function(_0xf55796){logger[_0x26d4('0x22')](util[_0x26d4('0x52')]('['+_0x5ee0c8[_0x26d4('0x23')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x32563d['ticketType'],_0xf55796[_0x26d4('0x51')]));logger[_0x26d4('0x22')](util['format']('['+_0x5ee0c8[_0x26d4('0x23')]()+_0x26d4('0x67'),_0x5ee0c8));if(_0x5ee0c8!==_0x26d4('0x57')&&_0x32563d[_0x26d4('0x68')]){logger[_0x26d4('0x22')]('['+_0x5ee0c8['toUpperCase']()+']',_0x26d4('0x69'));emit(_0x575915[_0x26d4('0xb')],_0x11187b[_0x26d4('0x6a')],_0x32563d[_0x26d4('0x49')],_0xf55796[_0x26d4('0x51')]);}})[_0x26d4('0x29')](function(_0x44680e){logger[_0x26d4('0x6b')]('['+_0x5ee0c8['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x44680e['message']);console[_0x26d4('0x6b')](_0x26d4('0x6c'),_0x44680e);});}; \ 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 d742769..f61e38f 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 _0x89bc=['uniqueid','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','localhost','redis','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','info','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Enduser\x20created.','Basic\x20%s','apiKey','base64','[HTTP]','stringify','map','includes','string','nameField','customField','toLowerCase','content','picklist','type','idField','push','toString','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','outbound','recordingFormat','[OUTBOUND]'];(function(_0x7822f5,_0x5e29c4){var _0x11a0a9=function(_0x13d2fd){while(--_0x13d2fd){_0x7822f5['push'](_0x7822f5['shift']());}};_0x11a0a9(++_0x5e29c4);}(_0x89bc,0x18a));var _0xc89b=function(_0x5c4e16,_0x113035){_0x5c4e16=_0x5c4e16-0x0;var _0x36044a=_0x89bc[_0x5c4e16];return _0x36044a;};'use strict';var _=require(_0xc89b('0x0'));var rp=require(_0xc89b('0x1'));var md5=require(_0xc89b('0x2'));var util=require('util');var Redis=require(_0xc89b('0x3'));var intUtil=require(_0xc89b('0x4'));var config=require(_0xc89b('0x5'));var logger=require(_0xc89b('0x6'))(_0xc89b('0x7'));config['redis']=_[_0xc89b('0x8')](config['redis'],{'host':_0xc89b('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc89b('0xa')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x4ed34b,_0xe7a6c2,_0x18d139){io['to'](_0x4ed34b)[_0xc89b('0xb')](_0xe7a6c2,_0x18d139);}function getTicket(_0x5cd8e8,_0x52e43d,_0x5eecfb,_0x345ef2,_0x121e1d){logger['info'](_0xc89b('0xc'));var _0xbd219c=_['merge']({'responder_id':_0x52e43d['id'],'requester_id':_0x5eecfb['id'],'name':util[_0xc89b('0xd')](_0xc89b('0xe'),_0x121e1d[_0xc89b('0xf')]),'phone':_0x121e1d[_0xc89b('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x345ef2[_0xc89b('0x11')],_0x121e1d,'\x20'),'description':intUtil[_0xc89b('0x12')](_0x345ef2[_0xc89b('0x13')],_0x121e1d,_0xc89b('0x14')),'tags':getTags(_0x345ef2[_0xc89b('0x15')],_0xc89b('0x16'))},getCustomFields(_0x345ef2[_0xc89b('0x17')],_0x121e1d));_0xbd219c[_0xc89b('0x18')]=_[_0xc89b('0x19')](_[_0xc89b('0x1a')](_0xbd219c[_0xc89b('0x18')],'id'),'value');return request({'uri':util[_0xc89b('0xd')](_0xc89b('0x1b'),_0x5cd8e8[_0xc89b('0x1c')]),'method':'POST','body':_0xbd219c})[_0xc89b('0x1d')](function(_0x3e5fbe){logger['info'](_0xc89b('0x1e'));return _0x3e5fbe;});}function getUser(_0x1348bd,_0x386160){if(intUtil[_0xc89b('0x1f')](_0x386160)){return request({'uri':util['format'](_0xc89b('0x20'),_0x1348bd[_0xc89b('0x1c')]),'qs':{'email':_0x386160}})[_0xc89b('0x1d')](function(_0x4d36ad){if(_0x4d36ad[_0xc89b('0x21')]){logger['info'](_0xc89b('0x22'));return _[_0xc89b('0x23')](_0x4d36ad,function(_0x428568){return _0x428568[_0xc89b('0x24')][_0xc89b('0x25')]===_0x386160;});}else{logger[_0xc89b('0x26')](_0xc89b('0x27'));return request({'uri':util[_0xc89b('0xd')](_0xc89b('0x28'),_0x1348bd[_0xc89b('0x1c')])})[_0xc89b('0x1d')](function(_0x4f0a64){logger['info'](_0xc89b('0x29'));return _0x4f0a64;});}});}else{logger[_0xc89b('0x26')](_0xc89b('0x2a'));return request({'uri':util[_0xc89b('0xd')](_0xc89b('0x28'),_0x1348bd[_0xc89b('0x1c')])})[_0xc89b('0x1d')](function(_0x1aeabf){logger[_0xc89b('0x26')](_0xc89b('0x29'));return _0x1aeabf;});}}function getEndUser(_0x10a02a,_0x2514b3,_0x5c36e6){logger[_0xc89b('0x26')](_0xc89b('0x2b'),_0x5c36e6);return request({'uri':util[_0xc89b('0xd')]('%s/api/v2/contacts',_0x10a02a[_0xc89b('0x1c')]),'qs':{'phone':_0x5c36e6}})[_0xc89b('0x1d')](function(_0xb139f5){if(_0xb139f5[_0xc89b('0x21')]){logger['info']('Enduser\x20found!');return _[_0xc89b('0x23')](_0xb139f5,{'phone':_0x5c36e6});}else{logger[_0xc89b('0x26')](_0xc89b('0x2c'));return request({'uri':util['format'](_0xc89b('0x2d'),_0x10a02a[_0xc89b('0x1c')]),'method':_0xc89b('0x2e'),'body':{'name':_0x2514b3,'phone':_0x5c36e6}})[_0xc89b('0x1d')](function(_0xaff580){logger[_0xc89b('0x26')](_0xc89b('0x2f'));return _0xaff580;});}});}function getAuth(_0xdbb5c){return util[_0xc89b('0xd')](_0xc89b('0x30'),new Buffer(_0xdbb5c[_0xc89b('0x31')]+':X')['toString'](_0xc89b('0x32')));}function request(_0x5cafb0){logger['debug'](_0xc89b('0x33'),JSON[_0xc89b('0x34')](_0x5cafb0));return rp(_[_0xc89b('0x8')](_0x5cafb0,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1774f9,_0x4be184){var _0x4e0160=[];if(_0x1774f9&&_0x1774f9['length']>0x0){_0x4e0160=_[_0xc89b('0x35')](_0x1774f9,_0x4be184);}return _0x4e0160;}function getCustomFields(_0x247f8e,_0x1de89c){var _0x508e73=[];var _0x5ebe80={'custom_fields':[]};if(_0x247f8e[_0xc89b('0x21')]>0x0){_['forEach'](_0x247f8e,function(_0x3f52f3){if(_[_0xc89b('0x36')]([_0xc89b('0x37'),'picklist'],_0x3f52f3['type'])&&_0x3f52f3[_0xc89b('0x38')]&&!_0x3f52f3[_0xc89b('0x39')]){_0x5ebe80[_0x3f52f3[_0xc89b('0x38')][_0xc89b('0x3a')]()]=_0x3f52f3[_0xc89b('0x3b')]['toString']();}else if(_['includes']([_0xc89b('0x37'),_0xc89b('0x3c')],_0x3f52f3[_0xc89b('0x3d')])&&_0x3f52f3[_0xc89b('0x3e')]&&_0x3f52f3['customField']){_0x5ebe80[_0xc89b('0x18')][_0xc89b('0x3f')]({'id':_0x3f52f3[_0xc89b('0x3e')],'value':_0x3f52f3[_0xc89b('0x3b')][_0xc89b('0x40')]()});}else if(_0x3f52f3['type']===_0xc89b('0x41')&&_0x3f52f3[_0xc89b('0x42')]&&_0x3f52f3[_0xc89b('0x3e')]&&_0x3f52f3['customField']){_0x1de89c[_0x3f52f3['variableName']]&&_0x5ebe80[_0xc89b('0x18')][_0xc89b('0x3f')]({'id':_0x3f52f3[_0xc89b('0x3e')],'value':_0x1de89c[_0x3f52f3[_0xc89b('0x42')]]['toString']()});}else if(_0x3f52f3[_0xc89b('0x3d')]===_0xc89b('0x43')&&_0x3f52f3[_0xc89b('0x44')]&&_0x3f52f3[_0xc89b('0x44')][_0xc89b('0x16')]&&_0x3f52f3[_0xc89b('0x3e')]&&_0x3f52f3[_0xc89b('0x39')]){_0x1de89c[_0x3f52f3[_0xc89b('0x44')]['name']['toLowerCase']()]&&_0x5ebe80[_0xc89b('0x18')][_0xc89b('0x3f')]({'id':_0x3f52f3[_0xc89b('0x3e')],'value':_0x1de89c[_0x3f52f3['Variable'][_0xc89b('0x16')][_0xc89b('0x3a')]()][_0xc89b('0x40')]()});}});}return _0x5ebe80;}exports[_0xc89b('0x45')]=function(_0x1b3727,_0x3a1f2f,_0x4b85c6,_0x79cdec,_0x58c228,_0x378050){var _0x118fb4,_0x4e07ae;_0x378050[_0xc89b('0x1c')]=intUtil[_0xc89b('0x46')](_0x378050[_0xc89b('0x1c')]);_0x378050[_0xc89b('0x47')]=intUtil[_0xc89b('0x46')](_0x378050[_0xc89b('0x47')]);if(_0x58c228&&_0x58c228[_0xc89b('0x48')]){logger[_0xc89b('0x26')](_0xc89b('0x49'),_0xc89b('0x4a'));_0x3a1f2f[_0xc89b('0x4b')]=util[_0xc89b('0xd')](_0xc89b('0x4c'),_0x378050[_0xc89b('0x47')],_0x3a1f2f['uniqueid'],md5(_0x3a1f2f['uniqueid']));}else{_0x3a1f2f[_0xc89b('0x4b')]='';}headers[_0xc89b('0x4d')]=getAuth(_0x378050);return getUser(_0x378050,_0x79cdec[_0xc89b('0x25')])['then'](function(_0x5c4504){_0x118fb4=_0x5c4504;logger[_0xc89b('0x26')](_0xc89b('0x4e'),_0x118fb4['id']);return getEndUser(_0x378050,_0x3a1f2f[_0xc89b('0xf')],_0x3a1f2f[_0xc89b('0x10')]);})[_0xc89b('0x1d')](function(_0x3ed93f){_0x4e07ae=_0x3ed93f;logger[_0xc89b('0x26')](_0xc89b('0x4f'),_0x4e07ae['id']);return getTicket(_0x378050,_0x118fb4,_0x4e07ae,_0x4b85c6,_0x3a1f2f);})['then'](function(_0x34f1d1){if(_0x34f1d1&&_0x34f1d1['id']){logger[_0xc89b('0x26')](_0xc89b('0x1e'));logger[_0xc89b('0x26')]('The\x20Ticket\x20ID\x20is:',_0x34f1d1['id']);logger[_0xc89b('0x26')](_0xc89b('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc89b('0xd')](_0xc89b('0x50'),_0x79cdec[_0xc89b('0x16')]),_0xc89b('0x51'),{'uri':util[_0xc89b('0xd')](_0xc89b('0x52'),_0x378050[_0xc89b('0x1c')],_0x34f1d1['id'])});}})['catch'](function(_0x34b6d7){logger['error'](_0xc89b('0x49'),JSON[_0xc89b('0x34')](_0x34b6d7));});};exports[_0xc89b('0x53')]=function(_0x4077a9,_0x2f43a0,_0x4a6a54,_0x356afc,_0x3bcc15,_0x5df367,_0x47fcf7){var _0x4ce12b,_0x99e518;_0x5df367[_0xc89b('0x1c')]=intUtil[_0xc89b('0x46')](_0x5df367[_0xc89b('0x1c')]);_0x5df367[_0xc89b('0x47')]=intUtil[_0xc89b('0x46')](_0x5df367['serverUrl']);if(_0x47fcf7&&_0x47fcf7[_0xc89b('0x54')]&&_0x47fcf7['recordingFormat']!=='none'){logger['info'](_0xc89b('0x55'),_0xc89b('0x4a'));_0x2f43a0['recordingURL']=util[_0xc89b('0xd')](_0xc89b('0x4c'),_0x5df367['serverUrl'],_0x2f43a0['uniqueid'],md5(_0x2f43a0[_0xc89b('0x56')]));}headers[_0xc89b('0x4d')]=getAuth(_0x5df367);return getUser(_0x5df367,_0x356afc[_0xc89b('0x25')])['then'](function(_0x5c8b48){_0x4ce12b=_0x5c8b48;logger['info'](_0xc89b('0x4e'),_0x4ce12b['id']);return getEndUser(_0x5df367,_0x2f43a0[_0xc89b('0x57')],_0x2f43a0[_0xc89b('0x58')]);})['then'](function(_0x1c551e){_0x99e518=_0x1c551e;logger[_0xc89b('0x26')](_0xc89b('0x4f'),_0x99e518['id']);return getTicket(_0x5df367,_0x4ce12b,_0x99e518,_0x4a6a54,_0x2f43a0);})[_0xc89b('0x1d')](function(_0x56c7b7){if(_0x56c7b7&&_0x56c7b7['id']){logger[_0xc89b('0x26')](_0xc89b('0x1e'));logger[_0xc89b('0x26')](_0xc89b('0x59'),_0x56c7b7['id']);logger['info'](_0xc89b('0x55'),_0xc89b('0x5a'));emit(util['format'](_0xc89b('0x50'),_0x356afc[_0xc89b('0x16')]),'trigger:browser:url',{'uri':util['format'](_0xc89b('0x52'),_0x5df367[_0xc89b('0x1c')],_0x56c7b7['id'])});}})[_0xc89b('0x5b')](function(_0x153d7f){logger[_0xc89b('0x5c')]('[OUTBOUND]',JSON[_0xc89b('0x34')](_0x153d7f));});};exports[_0xc89b('0x5d')]=function(_0x143fc8,_0x116594,_0x206981,_0x4587ac,_0x5b3b05,_0x1df79e){var _0x110a70,_0x3e8472;_0x1df79e[_0xc89b('0x1c')]=intUtil[_0xc89b('0x46')](_0x1df79e[_0xc89b('0x1c')]);_0x1df79e['serverUrl']=intUtil[_0xc89b('0x46')](_0x1df79e[_0xc89b('0x47')]);if(_0x5b3b05&&_0x5b3b05[_0xc89b('0x48')]){logger['info']('['+_0x116594[_0xc89b('0x5e')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x116594[_0xc89b('0x4b')]=util[_0xc89b('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1df79e[_0xc89b('0x47')],_0x116594[_0xc89b('0x56')],md5(_0x116594[_0xc89b('0x56')]));}else{_0x116594['recordingURL']='';}headers[_0xc89b('0x4d')]=getAuth(_0x1df79e);return getUser(_0x1df79e,'')['then'](function(_0x249439){_0x110a70=_0x249439;logger[_0xc89b('0x26')](_0xc89b('0x4e'),_0x110a70['id']);return getEndUser(_0x1df79e,_0x116594[_0xc89b('0xf')],_0x116594[_0xc89b('0x10')]);})[_0xc89b('0x1d')](function(_0x198da3){_0x3e8472=_0x198da3;logger[_0xc89b('0x26')](_0xc89b('0x4f'),_0x3e8472['id']);return getTicket(_0x1df79e,_0x110a70,_0x3e8472,_0x206981,_0x116594);})['then'](function(_0x4b9350){if(_0x4b9350){logger[_0xc89b('0x26')]('Ticket\x20created!');logger[_0xc89b('0x26')]('The\x20Ticket\x20ID\x20is:',_0x4b9350['id']);}})[_0xc89b('0x5b')](function(_0x28d9db){logger[_0xc89b('0x5c')]('['+_0x116594[_0xc89b('0x5e')][_0xc89b('0x5f')]()+']',JSON['stringify'](_0x28d9db));});}; \ No newline at end of file +var _0xb021=['string','picklist','nameField','customField','content','type','idField','variableName','push','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','error','unmanaged','toUpperCase','lastevent','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','name','Fields','custom_fields','value','format','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','GET','map','includes'];(function(_0x155af3,_0x4b7f9a){var _0x15a675=function(_0xec0188){while(--_0xec0188){_0x155af3['push'](_0x155af3['shift']());}};_0x15a675(++_0x4b7f9a);}(_0xb021,0xdd));var _0x1b02=function(_0x1fa760,_0x1bf063){_0x1fa760=_0x1fa760-0x0;var _0xd8eda1=_0xb021[_0x1fa760];return _0xd8eda1;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x1b02('0x0'));var util=require('util');var Redis=require(_0x1b02('0x1'));var intUtil=require(_0x1b02('0x2'));var config=require(_0x1b02('0x3'));var logger=require(_0x1b02('0x4'))('freshdesk');config[_0x1b02('0x5')]=_[_0x1b02('0x6')](config[_0x1b02('0x5')],{'host':_0x1b02('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1b02('0x5')]));var headers={'Content-Type':_0x1b02('0x8'),'Accept':_0x1b02('0x8')};function emit(_0x128181,_0x15fe16,_0x5b7249){io['to'](_0x128181)[_0x1b02('0x9')](_0x15fe16,_0x5b7249);}function getTicket(_0x534b3c,_0x41491e,_0x256231,_0x64c378,_0x2674b6){logger[_0x1b02('0xa')](_0x1b02('0xb'));var _0x19df6e=_[_0x1b02('0xc')]({'responder_id':_0x41491e['id'],'requester_id':_0x256231['id'],'name':util['format'](_0x1b02('0xd'),_0x2674b6[_0x1b02('0xe')]),'phone':_0x2674b6[_0x1b02('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x1b02('0x10')](_0x64c378['Subjects'],_0x2674b6,'\x20'),'description':intUtil[_0x1b02('0x10')](_0x64c378['Descriptions'],_0x2674b6,_0x1b02('0x11')),'tags':getTags(_0x64c378['Tags'],_0x1b02('0x12'))},getCustomFields(_0x64c378[_0x1b02('0x13')],_0x2674b6));_0x19df6e[_0x1b02('0x14')]=_['mapValues'](_['keyBy'](_0x19df6e[_0x1b02('0x14')],'id'),_0x1b02('0x15'));return request({'uri':util[_0x1b02('0x16')](_0x1b02('0x17'),_0x534b3c[_0x1b02('0x18')]),'method':_0x1b02('0x19'),'body':_0x19df6e})[_0x1b02('0x1a')](function(_0x44b90b){logger['info'](_0x1b02('0x1b'));return _0x44b90b;});}function getUser(_0x2dbf0b,_0x13e16c){if(intUtil['validateEmail'](_0x13e16c)){return request({'uri':util['format'](_0x1b02('0x1c'),_0x2dbf0b[_0x1b02('0x18')]),'qs':{'email':_0x13e16c}})[_0x1b02('0x1a')](function(_0x4d5048){if(_0x4d5048['length']){logger['info'](_0x1b02('0x1d'));return _[_0x1b02('0x1e')](_0x4d5048,function(_0x17d773){return _0x17d773[_0x1b02('0x1f')][_0x1b02('0x20')]===_0x13e16c;});}else{logger[_0x1b02('0xa')](_0x1b02('0x21'));return request({'uri':util[_0x1b02('0x16')](_0x1b02('0x22'),_0x2dbf0b['remoteUri'])})[_0x1b02('0x1a')](function(_0x4f41d1){logger[_0x1b02('0xa')](_0x1b02('0x23'));return _0x4f41d1;});}});}else{logger[_0x1b02('0xa')](_0x1b02('0x24'));return request({'uri':util[_0x1b02('0x16')](_0x1b02('0x22'),_0x2dbf0b['remoteUri'])})['then'](function(_0x1b5b75){logger[_0x1b02('0xa')]('Admin\x20account\x20selected.');return _0x1b5b75;});}}function getEndUser(_0x110a87,_0x2ed51d,_0x120ba3){logger[_0x1b02('0xa')](_0x1b02('0x25'),_0x120ba3);return request({'uri':util[_0x1b02('0x16')](_0x1b02('0x26'),_0x110a87[_0x1b02('0x18')]),'qs':{'phone':_0x120ba3}})['then'](function(_0x5d3b36){if(_0x5d3b36[_0x1b02('0x27')]){logger['info'](_0x1b02('0x28'));return _[_0x1b02('0x1e')](_0x5d3b36,{'phone':_0x120ba3});}else{logger[_0x1b02('0xa')](_0x1b02('0x29'));return request({'uri':util[_0x1b02('0x16')](_0x1b02('0x26'),_0x110a87[_0x1b02('0x18')]),'method':_0x1b02('0x19'),'body':{'name':_0x2ed51d,'phone':_0x120ba3}})[_0x1b02('0x1a')](function(_0xb8eab6){logger[_0x1b02('0xa')](_0x1b02('0x2a'));return _0xb8eab6;});}});}function getAuth(_0x491819){return util[_0x1b02('0x16')](_0x1b02('0x2b'),new Buffer(_0x491819[_0x1b02('0x2c')]+':X')[_0x1b02('0x2d')]('base64'));}function request(_0x3cebf8){logger[_0x1b02('0x2e')](_0x1b02('0x2f'),JSON[_0x1b02('0x30')](_0x3cebf8));return rp(_[_0x1b02('0x6')](_0x3cebf8,{'method':_0x1b02('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x2e75b1,_0x272999){var _0x4f0393=[];if(_0x2e75b1&&_0x2e75b1[_0x1b02('0x27')]>0x0){_0x4f0393=_[_0x1b02('0x32')](_0x2e75b1,_0x272999);}return _0x4f0393;}function getCustomFields(_0x4f25ac,_0x48ce76){var _0x4f35b2=[];var _0x4b245e={'custom_fields':[]};if(_0x4f25ac[_0x1b02('0x27')]>0x0){_['forEach'](_0x4f25ac,function(_0xaf7267){if(_[_0x1b02('0x33')]([_0x1b02('0x34'),_0x1b02('0x35')],_0xaf7267['type'])&&_0xaf7267[_0x1b02('0x36')]&&!_0xaf7267[_0x1b02('0x37')]){_0x4b245e[_0xaf7267[_0x1b02('0x36')]['toLowerCase']()]=_0xaf7267[_0x1b02('0x38')][_0x1b02('0x2d')]();}else if(_[_0x1b02('0x33')](['string','picklist'],_0xaf7267[_0x1b02('0x39')])&&_0xaf7267[_0x1b02('0x3a')]&&_0xaf7267[_0x1b02('0x37')]){_0x4b245e[_0x1b02('0x14')]['push']({'id':_0xaf7267['idField'],'value':_0xaf7267['content'][_0x1b02('0x2d')]()});}else if(_0xaf7267['type']==='variable'&&_0xaf7267[_0x1b02('0x3b')]&&_0xaf7267[_0x1b02('0x3a')]&&_0xaf7267[_0x1b02('0x37')]){_0x48ce76[_0xaf7267[_0x1b02('0x3b')]]&&_0x4b245e[_0x1b02('0x14')][_0x1b02('0x3c')]({'id':_0xaf7267['idField'],'value':_0x48ce76[_0xaf7267['variableName']]['toString']()});}else if(_0xaf7267[_0x1b02('0x39')]==='customVariable'&&_0xaf7267[_0x1b02('0x3d')]&&_0xaf7267[_0x1b02('0x3d')]['name']&&_0xaf7267['idField']&&_0xaf7267[_0x1b02('0x37')]){_0x48ce76[_0xaf7267['Variable'][_0x1b02('0x12')][_0x1b02('0x3e')]()]&&_0x4b245e[_0x1b02('0x14')]['push']({'id':_0xaf7267['idField'],'value':_0x48ce76[_0xaf7267[_0x1b02('0x3d')][_0x1b02('0x12')][_0x1b02('0x3e')]()][_0x1b02('0x2d')]()});}});}return _0x4b245e;}exports[_0x1b02('0x3f')]=function(_0xcad16f,_0x2a0a63,_0x2c39df,_0x5f4eba,_0x4ed8fc,_0x45fd21){var _0x295a4f,_0x7690b3;_0x45fd21['remoteUri']=intUtil[_0x1b02('0x40')](_0x45fd21['remoteUri']);_0x45fd21['serverUrl']=intUtil[_0x1b02('0x40')](_0x45fd21[_0x1b02('0x41')]);if(_0x4ed8fc&&_0x4ed8fc[_0x1b02('0x42')]){logger[_0x1b02('0xa')]('[QUEUE]',_0x1b02('0x43'));_0x2a0a63[_0x1b02('0x44')]=util[_0x1b02('0x16')](_0x1b02('0x45'),_0x45fd21[_0x1b02('0x41')],_0x2a0a63[_0x1b02('0x46')],md5(_0x2a0a63[_0x1b02('0x46')]));}else{_0x2a0a63['recordingURL']='';}headers[_0x1b02('0x47')]=getAuth(_0x45fd21);return getUser(_0x45fd21,_0x5f4eba[_0x1b02('0x20')])[_0x1b02('0x1a')](function(_0x27975e){_0x295a4f=_0x27975e;logger[_0x1b02('0xa')](_0x1b02('0x48'),_0x295a4f['id']);return getEndUser(_0x45fd21,_0x2a0a63[_0x1b02('0xe')],_0x2a0a63['calleridnum']);})['then'](function(_0x30a0c3){_0x7690b3=_0x30a0c3;logger[_0x1b02('0xa')](_0x1b02('0x49'),_0x7690b3['id']);return getTicket(_0x45fd21,_0x295a4f,_0x7690b3,_0x2c39df,_0x2a0a63);})['then'](function(_0x42162b){if(_0x42162b&&_0x42162b['id']){logger['info'](_0x1b02('0x1b'));logger['info'](_0x1b02('0x4a'),_0x42162b['id']);logger[_0x1b02('0xa')](_0x1b02('0x4b'),_0x1b02('0x4c'));emit(util['format'](_0x1b02('0x4d'),_0x5f4eba[_0x1b02('0x12')]),_0x1b02('0x4e'),{'uri':util[_0x1b02('0x16')](_0x1b02('0x4f'),_0x45fd21['remoteUri'],_0x42162b['id'])});}})[_0x1b02('0x50')](function(_0x2bbd85){logger['error'](_0x1b02('0x4b'),JSON[_0x1b02('0x30')](_0x2bbd85));});};exports[_0x1b02('0x51')]=function(_0x1dd5ac,_0x2b5ca7,_0x5d6071,_0x521349,_0x269c27,_0x2605cf,_0x4b1a07){var _0x302cbc,_0x165f3a;_0x2605cf[_0x1b02('0x18')]=intUtil[_0x1b02('0x40')](_0x2605cf[_0x1b02('0x18')]);_0x2605cf[_0x1b02('0x41')]=intUtil[_0x1b02('0x40')](_0x2605cf[_0x1b02('0x41')]);if(_0x4b1a07&&_0x4b1a07[_0x1b02('0x52')]&&_0x4b1a07[_0x1b02('0x52')]!==_0x1b02('0x53')){logger[_0x1b02('0xa')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2b5ca7['recordingURL']=util['format'](_0x1b02('0x45'),_0x2605cf[_0x1b02('0x41')],_0x2b5ca7[_0x1b02('0x46')],md5(_0x2b5ca7[_0x1b02('0x46')]));}headers[_0x1b02('0x47')]=getAuth(_0x2605cf);return getUser(_0x2605cf,_0x521349[_0x1b02('0x20')])['then'](function(_0x8b03eb){_0x302cbc=_0x8b03eb;logger[_0x1b02('0xa')](_0x1b02('0x48'),_0x302cbc['id']);return getEndUser(_0x2605cf,_0x2b5ca7[_0x1b02('0x54')],_0x2b5ca7[_0x1b02('0x55')]);})[_0x1b02('0x1a')](function(_0x5419e0){_0x165f3a=_0x5419e0;logger[_0x1b02('0xa')]('The\x20Enduser\x20ID\x20is:',_0x165f3a['id']);return getTicket(_0x2605cf,_0x302cbc,_0x165f3a,_0x5d6071,_0x2b5ca7);})[_0x1b02('0x1a')](function(_0x36da24){if(_0x36da24&&_0x36da24['id']){logger['info'](_0x1b02('0x1b'));logger[_0x1b02('0xa')](_0x1b02('0x4a'),_0x36da24['id']);logger[_0x1b02('0xa')](_0x1b02('0x56'),_0x1b02('0x4c'));emit(util['format']('user:%s',_0x521349['name']),'trigger:browser:url',{'uri':util['format'](_0x1b02('0x4f'),_0x2605cf[_0x1b02('0x18')],_0x36da24['id'])});}})[_0x1b02('0x50')](function(_0x1ac557){logger[_0x1b02('0x57')](_0x1b02('0x56'),JSON[_0x1b02('0x30')](_0x1ac557));});};exports[_0x1b02('0x58')]=function(_0x4ccbdd,_0x42f9ab,_0xed271f,_0x196666,_0x5a6b93,_0x56d8c3){var _0x21a5a3,_0x385bac;_0x56d8c3['remoteUri']=intUtil[_0x1b02('0x40')](_0x56d8c3[_0x1b02('0x18')]);_0x56d8c3['serverUrl']=intUtil[_0x1b02('0x40')](_0x56d8c3['serverUrl']);if(_0x5a6b93&&_0x5a6b93['monitor_format']){logger[_0x1b02('0xa')]('['+_0x42f9ab['lastevent'][_0x1b02('0x59')]()+']','Recording\x20is\x20enabled!');_0x42f9ab[_0x1b02('0x44')]=util[_0x1b02('0x16')](_0x1b02('0x45'),_0x56d8c3['serverUrl'],_0x42f9ab[_0x1b02('0x46')],md5(_0x42f9ab[_0x1b02('0x46')]));}else{_0x42f9ab[_0x1b02('0x44')]='';}headers[_0x1b02('0x47')]=getAuth(_0x56d8c3);return getUser(_0x56d8c3,'')[_0x1b02('0x1a')](function(_0x596b3c){_0x21a5a3=_0x596b3c;logger[_0x1b02('0xa')](_0x1b02('0x48'),_0x21a5a3['id']);return getEndUser(_0x56d8c3,_0x42f9ab['calleridname'],_0x42f9ab[_0x1b02('0xf')]);})['then'](function(_0x2c75bd){_0x385bac=_0x2c75bd;logger['info'](_0x1b02('0x49'),_0x385bac['id']);return getTicket(_0x56d8c3,_0x21a5a3,_0x385bac,_0xed271f,_0x42f9ab);})[_0x1b02('0x1a')](function(_0x532873){if(_0x532873){logger[_0x1b02('0xa')](_0x1b02('0x1b'));logger[_0x1b02('0xa')](_0x1b02('0x4a'),_0x532873['id']);}})[_0x1b02('0x50')](function(_0x12ee36){logger[_0x1b02('0x57')]('['+_0x42f9ab[_0x1b02('0x5a')][_0x1b02('0x59')]()+']',JSON[_0x1b02('0x30')](_0x12ee36));});}; \ 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 9912265..22b25d3 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 _0xb23c=['users','length','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','headers','agentEmail','userId','userEmail','catch','/api/lookup?q=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','Contact','add','Task\x20created:','ticketId','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','then'];(function(_0x177a53,_0x709fd7){var _0x30b282=function(_0x14e42b){while(--_0x14e42b){_0x177a53['push'](_0x177a53['shift']());}};_0x30b282(++_0x709fd7);}(_0xb23c,0x94));var _0xcb23=function(_0x17ae05,_0x3603fe){_0x17ae05=_0x17ae05-0x0;var _0x586813=_0xb23c[_0x17ae05];return _0x586813;};'use strict';var _=require(_0xcb23('0x0'));var rp=require(_0xcb23('0x1'));var md5=require(_0xcb23('0x2'));var util=require('util');var moment=require(_0xcb23('0x3'));var Promise=require(_0xcb23('0x4'));var Redis=require(_0xcb23('0x5'));var intUtil=require(_0xcb23('0x6'));var config=require(_0xcb23('0x7'));var logger=require('../../../../config/logger')('freshsales');config[_0xcb23('0x8')]=_[_0xcb23('0x9')](config[_0xcb23('0x8')],{'host':_0xcb23('0xa'),'port':0x18eb});var io=require(_0xcb23('0xb'))(new Redis(config[_0xcb23('0x8')]));function getAdminId(_0x335d30,_0x3c49a8,_0x565d0b,_0x26079e){return new Promise(function(_0x123255,_0x37780e){var _0x124b06=![];var _0x170bd4={'method':_0xcb23('0xc'),'uri':_0x26079e+_0xcb23('0xd'),'json':!![]};_0x170bd4['headers']=_0x565d0b;logger[_0xcb23('0xe')]('Getting\x20admin\x20information');return rp(_0x170bd4)[_0xcb23('0xf')](function(_0x2ceae7){if(_0x2ceae7){var _0x50db94=_0x2ceae7[_0xcb23('0x10')];var _0x2e3676=null;for(_0x2e3676=0x0;_0x2e3676<_0x50db94[_0xcb23('0x11')];_0x2e3676++){if(_0x50db94[_0x2e3676][_0xcb23('0x12')]===_0x335d30[_0xcb23('0x13')]){_0x335d30['adminId']=_0x50db94[_0x2e3676]['id'];_0x124b06=!![];}}if(_0x124b06){logger[_0xcb23('0xe')](_0xcb23('0x14'),_0x335d30[_0xcb23('0x15')]);_0x123255(_0x335d30);}else{_0x37780e({'statusCode':0x194,'message':_0xcb23('0x16')});}}else{_0x37780e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x4fa0b2){logger[_0xcb23('0x17')]('['+[_0x3c49a8[_0xcb23('0x18')]()]+']',_0x4fa0b2[_0xcb23('0x19')]);_0x37780e(_0x4fa0b2);});});}function getUser(_0x4dda40,_0x2a330b,_0x5ae250){return function(_0x450d00){return new Promise(function(_0x571e38,_0x55f37c){var _0x8a402e={'method':_0xcb23('0xc'),'uri':_0x5ae250+_0xcb23('0xd'),'json':!![]};_0x8a402e[_0xcb23('0x1a')]=_0x2a330b;logger[_0xcb23('0xe')]('Getting\x20user\x20list');return rp(_0x8a402e)[_0xcb23('0xf')](function(_0x1a82f2){if(_0x1a82f2){var _0x4d27d4=_0x1a82f2[_0xcb23('0x10')];var _0x3ae2de=![];var _0x1cc216=null;if(_0x450d00[_0xcb23('0x1b')]!==null){logger[_0xcb23('0xe')]('Getting\x20user\x20with\x20email',_0x450d00[_0xcb23('0x1b')]);_0x450d00['userEmail']=_0x450d00[_0xcb23('0x1b')];for(_0x1cc216=0x0;_0x1cc216<_0x4d27d4['length'];_0x1cc216++){if(_0x4d27d4[_0x1cc216][_0xcb23('0x12')]===_0x450d00[_0xcb23('0x1b')]){_0x3ae2de=!![];_0x450d00[_0xcb23('0x1c')]=_0x4d27d4[_0x1cc216]['id'];logger[_0xcb23('0xe')]('User\x20found:',_0x450d00[_0xcb23('0x1c')]);}}}if(!_0x3ae2de){logger[_0xcb23('0xe')]('Admin\x20selected');_0x450d00[_0xcb23('0x1d')]=_0x450d00[_0xcb23('0x13')];_0x450d00[_0xcb23('0x1c')]=_0x450d00[_0xcb23('0x15')];_0x3ae2de=!![];}if(_0x3ae2de){_0x571e38(_0x450d00);}else{_0x55f37c({'statusCode':0x194,'message':_0xcb23('0x16')});}}else{_0x55f37c({'statusCode':0x194,'message':_0xcb23('0x16')});}})[_0xcb23('0x1e')](function(_0x424419){logger[_0xcb23('0x17')]('['+[_0x4dda40[_0xcb23('0x18')]()]+']',_0x424419[_0xcb23('0x19')]);_0x55f37c(_0x424419);});});};}function searchContact(_0x219644,_0x1f401f,_0x2cb828,_0xd72ffa){return new Promise(function(_0x2097f1,_0x536995){var _0x4f6aac={'method':_0xcb23('0xc'),'headers':_0x1f401f,'uri':_0x219644+_0xcb23('0x1f')+_0xd72ffa+'&f='+_0x2cb828+_0xcb23('0x20'),'json':!![]};rp(_0x4f6aac)[_0xcb23('0xf')](function(_0x357989){var _0x29bfb1=_[_0xcb23('0x21')](_0x357989['contacts'][_0xcb23('0x22')],[_0x2cb828,_0xd72ffa]);_0x2097f1(_0x29bfb1);})[_0xcb23('0x1e')](function(_0x34ba4f){_0x536995(_0x34ba4f);});});}function getEndUser(_0x506b59,_0x142900,_0x573130){return function(_0x1bcea3){return new Promise(function(_0x5c2035,_0x1d1666){logger[_0xcb23('0xe')](util['format'](_0xcb23('0x23'),_0x1bcea3[_0xcb23('0x24')]));searchContact(_0x573130,_0x142900,'mobile_number',_0x1bcea3[_0xcb23('0x24')])[_0xcb23('0xf')](function(_0xed82cb){if(_0xed82cb){_0x1bcea3[_0xcb23('0x25')]=_0xed82cb['id'];logger['info'](_0xcb23('0x26'),_0x1bcea3['endUserId']);return _0x5c2035(_0x1bcea3);}searchContact(_0x573130,_0x142900,_0xcb23('0x27'),_0x1bcea3[_0xcb23('0x24')])[_0xcb23('0xf')](function(_0x13ff0c){if(_0x13ff0c){_0x1bcea3[_0xcb23('0x25')]=_0x13ff0c['id'];logger[_0xcb23('0xe')](_0xcb23('0x28'),_0x1bcea3['endUserId']);return _0x5c2035(_0x1bcea3);}createEndUser(_0x1bcea3,_0x506b59,_0x142900,_0x573130)['then'](function(_0x4846ea){logger['info'](_0xcb23('0x29'),_0x4846ea[_0xcb23('0x25')]);return _0x5c2035(_0x4846ea);});});})[_0xcb23('0x1e')](function(_0xc3245d){_0x1d1666(_0xc3245d);});});};}function createEndUser(_0x1feb6d,_0x394a14,_0x710d0c,_0x5dd4d2){return new Promise(function(_0x4e608f,_0x15e4be){var _0x5e1d40=moment();var _0x56b643={'method':_0xcb23('0x2a'),'uri':_0x5dd4d2+_0xcb23('0x2b'),'body':{'contact':{'last_name':_0x1feb6d[_0xcb23('0x24')],'work_number':_0x1feb6d[_0xcb23('0x24')],'mobile_number':_0x1feb6d[_0xcb23('0x24')],'owner_id':_0x1feb6d['userId'],'created_at':_0x5e1d40[_0xcb23('0x2c')](_0xcb23('0x2d'))}},'json':!![]};_0x56b643['headers']=_0x710d0c;logger[_0xcb23('0xe')](_0xcb23('0x2e'));return rp(_0x56b643)['then'](function(_0x33a022){_0x1feb6d[_0xcb23('0x25')]=_0x33a022['contact']['id'];_0x4e608f(_0x1feb6d);})[_0xcb23('0x1e')](function(_0x293db6){logger['error']('['+[_0x394a14[_0xcb23('0x18')]()]+']',_0x293db6[_0xcb23('0x19')]);_0x15e4be(_0x293db6[_0xcb23('0x19')]);});});}function getTicket(_0x3d581c,_0x39dafd,_0x2953c2,_0xd50813,_0xc70c62){return function(_0x4274ca){logger[_0xcb23('0xe')](_0xcb23('0x2f'));return new Promise(function(_0x38f81a,_0x3f4eac){var _0x277d02=moment();var _0x4941b8={'method':_0xcb23('0x2a'),'uri':_0x2953c2+_0xcb23('0x30'),'body':{'title':intUtil['getString'](_0xd50813[_0xcb23('0x31')],_0xc70c62,'\x20'),'description':intUtil[_0xcb23('0x32')](_0xd50813[_0xcb23('0x33')],_0xc70c62,'\x0a'),'owner_id':_0x4274ca[_0xcb23('0x1c')],'creater_id':_0x4274ca[_0xcb23('0x15')],'targetable_id':_0x4274ca[_0xcb23('0x25')],'targetable_type':_0xcb23('0x34'),'created_at':_0x277d02[_0xcb23('0x2c')](_0xcb23('0x2d')),'due_date':_0x277d02[_0xcb23('0x35')](0x1e,'m')['format'](_0xcb23('0x2d'))},'json':!![]};_0x4941b8[_0xcb23('0x1a')]=_0x39dafd;return rp(_0x4941b8)[_0xcb23('0xf')](function(_0x20b45c){_0x4274ca['ticketId']=_0x20b45c['task']['id'];logger['info'](_0xcb23('0x36'),_0x4274ca[_0xcb23('0x37')]);_0x38f81a(_0x4274ca);})[_0xcb23('0x1e')](function(_0x7f9bab){logger[_0xcb23('0x17')]('['+[_0x3d581c['toUpperCase']()]+']',_0x7f9bab[_0xcb23('0x19')]);_0x3f4eac(_0x7f9bab[_0xcb23('0x19')]);});});};}function emit(_0xa0dd72,_0x1cab81,_0x16f36b){var _0x94f4d0={'uri':_0xa0dd72+_0xcb23('0x38')+_0x16f36b};io['to'](util[_0xcb23('0x2c')](_0xcb23('0x39'),_0x1cab81))['emit'](_0xcb23('0x3a'),_0x94f4d0);}exports['cs']=function(_0x218964,_0x363deb,_0x521503,_0x1e5a98,_0xfde2ed,_0x297262,_0x472ac1,_0x59048e){var _0x12a3f8={};var _0x404708={'Authorization':_0xcb23('0x3b')+_0x297262[_0xcb23('0x3c')]};_0x297262[_0xcb23('0x3d')]=intUtil[_0xcb23('0x3e')](_0x297262[_0xcb23('0x3d')]);_0x297262['serverUrl']=intUtil['stripTrailingSlash'](_0x297262[_0xcb23('0x3f')]);var _0x510b08=_0x297262['remoteUri'];_0x12a3f8[_0xcb23('0x13')]=_0x297262['username'];_0x12a3f8['contactNumber']=_0x59048e[_0xcb23('0x40')]()===_0xcb23('0x41')?_0x363deb['destcalleridnum']:_0x363deb['calleridnum'];_0x12a3f8[_0xcb23('0x42')]=_0x59048e===_0xcb23('0x43')||_0x59048e===_0xcb23('0x44')?_0xcb23('0x43'):'outbound';if(_0x1e5a98){_0x12a3f8[_0xcb23('0x1b')]=_0x1e5a98['email'];}var _0x3e88cc=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x297262['serverUrl'],_0x363deb[_0xcb23('0x45')],md5(_0x363deb['uniqueid']));if(_0xfde2ed&&_0xfde2ed[_0xcb23('0x46')]){logger[_0xcb23('0xe')](_0xcb23('0x47'),_0xcb23('0x48'));_0x363deb[_0xcb23('0x49')]=_0x3e88cc;}else if(_0x472ac1&&_0x472ac1[_0xcb23('0x4a')]&&_0x472ac1[_0xcb23('0x4a')]!==_0xcb23('0x4b')){logger[_0xcb23('0xe')](_0xcb23('0x4c'),_0xcb23('0x48'));_0x363deb[_0xcb23('0x49')]=_0x3e88cc;}else{_0x363deb[_0xcb23('0x49')]='';}return getAdminId(_0x12a3f8,_0x59048e,_0x404708,_0x510b08)[_0xcb23('0xf')](getUser(_0x59048e,_0x404708,_0x510b08))[_0xcb23('0xf')](getEndUser(_0x59048e,_0x404708,_0x510b08))[_0xcb23('0xf')](getTicket(_0x59048e,_0x404708,_0x510b08,_0x521503,_0x363deb))[_0xcb23('0xf')](function(_0x5b1000){logger[_0xcb23('0xe')](util[_0xcb23('0x2c')](_0xcb23('0x4d'),_0x5b1000[_0xcb23('0x37')]));if(_0x59048e!==_0xcb23('0x44')){logger[_0xcb23('0xe')]('['+[_0x59048e[_0xcb23('0x18')]()]+']',_0xcb23('0x4e'));emit(_0x510b08,_0x1e5a98[_0xcb23('0x4f')],_0x5b1000[_0xcb23('0x25')]);}})[_0xcb23('0x1e')](function(_0x1a3b7f){logger[_0xcb23('0x17')]('['+[_0x59048e[_0xcb23('0x18')]()]+_0xcb23('0x50'),util[_0xcb23('0x51')](_0x1a3b7f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4d74=['ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','name','inspect','lodash','moment','bluebird','../../../../config/logger','redis','defaults','socket.io-emitter','/api/selector/owners','headers','Getting\x20admin\x20information','users','email','adminEmail','info','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','Getting\x20user\x20list','then','Getting\x20user\x20with\x20email','agentEmail','userEmail','length','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','POST','/api/contacts','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Contact','add','YYYY-MM-DDTHH:mm:ss'];(function(_0x5b3cb4,_0x4d20fa){var _0x46d36a=function(_0x45f8ef){while(--_0x45f8ef){_0x5b3cb4['push'](_0x5b3cb4['shift']());}};_0x46d36a(++_0x4d20fa);}(_0x4d74,0xb8));var _0x44d7=function(_0x185c5e,_0x1b05f5){_0x185c5e=_0x185c5e-0x0;var _0x14053a=_0x4d74[_0x185c5e];return _0x14053a;};'use strict';var _=require(_0x44d7('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require('util');var moment=require(_0x44d7('0x1'));var Promise=require(_0x44d7('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x44d7('0x3'))('freshsales');config[_0x44d7('0x4')]=_[_0x44d7('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x44d7('0x6'))(new Redis(config[_0x44d7('0x4')]));function getAdminId(_0x526d49,_0x5c4612,_0x12503e,_0xee6db5){return new Promise(function(_0x3df1a4,_0x448d55){var _0x5d83e3=![];var _0x42f79b={'method':'GET','uri':_0xee6db5+_0x44d7('0x7'),'json':!![]};_0x42f79b[_0x44d7('0x8')]=_0x12503e;logger['info'](_0x44d7('0x9'));return rp(_0x42f79b)['then'](function(_0x39bd22){if(_0x39bd22){var _0x5d3707=_0x39bd22[_0x44d7('0xa')];var _0x1eecea=null;for(_0x1eecea=0x0;_0x1eecea<_0x5d3707['length'];_0x1eecea++){if(_0x5d3707[_0x1eecea][_0x44d7('0xb')]===_0x526d49[_0x44d7('0xc')]){_0x526d49['adminId']=_0x5d3707[_0x1eecea]['id'];_0x5d83e3=!![];}}if(_0x5d83e3){logger[_0x44d7('0xd')](_0x44d7('0xe'),_0x526d49[_0x44d7('0xf')]);_0x3df1a4(_0x526d49);}else{_0x448d55({'statusCode':0x194,'message':_0x44d7('0x10')});}}else{_0x448d55({'statusCode':0x194,'message':_0x44d7('0x10')});}})[_0x44d7('0x11')](function(_0xac229e){logger[_0x44d7('0x12')]('['+[_0x5c4612[_0x44d7('0x13')]()]+']',_0xac229e[_0x44d7('0x14')]);_0x448d55(_0xac229e);});});}function getUser(_0x534b90,_0x3e9901,_0x3807d2){return function(_0x314e66){return new Promise(function(_0x35471e,_0x1b358b){var _0x3fd746={'method':_0x44d7('0x15'),'uri':_0x3807d2+_0x44d7('0x7'),'json':!![]};_0x3fd746[_0x44d7('0x8')]=_0x3e9901;logger[_0x44d7('0xd')](_0x44d7('0x16'));return rp(_0x3fd746)[_0x44d7('0x17')](function(_0x2125ab){if(_0x2125ab){var _0x2f3a78=_0x2125ab[_0x44d7('0xa')];var _0x34b01a=![];var _0x570c24=null;if(_0x314e66['agentEmail']!==null){logger[_0x44d7('0xd')](_0x44d7('0x18'),_0x314e66[_0x44d7('0x19')]);_0x314e66[_0x44d7('0x1a')]=_0x314e66['agentEmail'];for(_0x570c24=0x0;_0x570c24<_0x2f3a78[_0x44d7('0x1b')];_0x570c24++){if(_0x2f3a78[_0x570c24][_0x44d7('0xb')]===_0x314e66['agentEmail']){_0x34b01a=!![];_0x314e66[_0x44d7('0x1c')]=_0x2f3a78[_0x570c24]['id'];logger[_0x44d7('0xd')](_0x44d7('0x1d'),_0x314e66[_0x44d7('0x1c')]);}}}if(!_0x34b01a){logger[_0x44d7('0xd')](_0x44d7('0x1e'));_0x314e66[_0x44d7('0x1a')]=_0x314e66[_0x44d7('0xc')];_0x314e66['userId']=_0x314e66[_0x44d7('0xf')];_0x34b01a=!![];}if(_0x34b01a){_0x35471e(_0x314e66);}else{_0x1b358b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x1b358b({'statusCode':0x194,'message':_0x44d7('0x10')});}})['catch'](function(_0x341ca4){logger[_0x44d7('0x12')]('['+[_0x534b90[_0x44d7('0x13')]()]+']',_0x341ca4[_0x44d7('0x14')]);_0x1b358b(_0x341ca4);});});};}function searchContact(_0x505e91,_0x4bc363,_0x55e4bd,_0x150f8c){return new Promise(function(_0x340849,_0x3b855d){var _0x24f9eb={'method':_0x44d7('0x15'),'headers':_0x4bc363,'uri':_0x505e91+_0x44d7('0x1f')+_0x150f8c+_0x44d7('0x20')+_0x55e4bd+_0x44d7('0x21'),'json':!![]};rp(_0x24f9eb)['then'](function(_0x33a297){var _0x5eeb0c=_[_0x44d7('0x22')](_0x33a297[_0x44d7('0x23')][_0x44d7('0x23')],[_0x55e4bd,_0x150f8c]);_0x340849(_0x5eeb0c);})[_0x44d7('0x11')](function(_0x8c9528){_0x3b855d(_0x8c9528);});});}function getEndUser(_0x2b0d39,_0x10fed3,_0xc8d7d1){return function(_0x388593){return new Promise(function(_0x53bda2,_0x5ec4e1){logger[_0x44d7('0xd')](util[_0x44d7('0x24')](_0x44d7('0x25'),_0x388593[_0x44d7('0x26')]));searchContact(_0xc8d7d1,_0x10fed3,_0x44d7('0x27'),_0x388593[_0x44d7('0x26')])[_0x44d7('0x17')](function(_0x52b8dd){if(_0x52b8dd){_0x388593[_0x44d7('0x28')]=_0x52b8dd['id'];logger[_0x44d7('0xd')](_0x44d7('0x29'),_0x388593[_0x44d7('0x28')]);return _0x53bda2(_0x388593);}searchContact(_0xc8d7d1,_0x10fed3,_0x44d7('0x2a'),_0x388593[_0x44d7('0x26')])['then'](function(_0x191883){if(_0x191883){_0x388593[_0x44d7('0x28')]=_0x191883['id'];logger[_0x44d7('0xd')]('Contact\x20found\x20work_number:',_0x388593[_0x44d7('0x28')]);return _0x53bda2(_0x388593);}createEndUser(_0x388593,_0x2b0d39,_0x10fed3,_0xc8d7d1)[_0x44d7('0x17')](function(_0x272355){logger['info']('Contact\x20created:',_0x272355[_0x44d7('0x28')]);return _0x53bda2(_0x272355);});});})[_0x44d7('0x11')](function(_0x385ed0){_0x5ec4e1(_0x385ed0);});});};}function createEndUser(_0x79eedb,_0x3ce9c6,_0x5c7125,_0x2d7b29){return new Promise(function(_0x16aded,_0x4925eb){var _0x599012=moment();var _0x3660af={'method':_0x44d7('0x2b'),'uri':_0x2d7b29+_0x44d7('0x2c'),'body':{'contact':{'last_name':_0x79eedb[_0x44d7('0x26')],'work_number':_0x79eedb[_0x44d7('0x26')],'mobile_number':_0x79eedb[_0x44d7('0x26')],'owner_id':_0x79eedb[_0x44d7('0x1c')],'created_at':_0x599012[_0x44d7('0x24')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x3660af['headers']=_0x5c7125;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x3660af)[_0x44d7('0x17')](function(_0x482c0f){_0x79eedb[_0x44d7('0x28')]=_0x482c0f[_0x44d7('0x2d')]['id'];_0x16aded(_0x79eedb);})[_0x44d7('0x11')](function(_0x8e6f3){logger['error']('['+[_0x3ce9c6[_0x44d7('0x13')]()]+']',_0x8e6f3[_0x44d7('0x14')]);_0x4925eb(_0x8e6f3[_0x44d7('0x14')]);});});}function getTicket(_0x40efc3,_0x1e778e,_0x51ff02,_0x2c07d7,_0x236de8){return function(_0x531452){logger[_0x44d7('0xd')](_0x44d7('0x2e'));return new Promise(function(_0x1b9dd8,_0x26e341){var _0x38d40f=moment();var _0x14cfeb={'method':_0x44d7('0x2b'),'uri':_0x51ff02+_0x44d7('0x2f'),'body':{'title':intUtil['getString'](_0x2c07d7[_0x44d7('0x30')],_0x236de8,'\x20'),'description':intUtil[_0x44d7('0x31')](_0x2c07d7['Descriptions'],_0x236de8,'\x0a'),'owner_id':_0x531452[_0x44d7('0x1c')],'creater_id':_0x531452['adminId'],'targetable_id':_0x531452[_0x44d7('0x28')],'targetable_type':_0x44d7('0x32'),'created_at':_0x38d40f[_0x44d7('0x24')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x38d40f[_0x44d7('0x33')](0x1e,'m')[_0x44d7('0x24')](_0x44d7('0x34'))},'json':!![]};_0x14cfeb[_0x44d7('0x8')]=_0x1e778e;return rp(_0x14cfeb)[_0x44d7('0x17')](function(_0x3900ce){_0x531452[_0x44d7('0x35')]=_0x3900ce['task']['id'];logger[_0x44d7('0xd')]('Task\x20created:',_0x531452[_0x44d7('0x35')]);_0x1b9dd8(_0x531452);})[_0x44d7('0x11')](function(_0x2f95ad){logger['error']('['+[_0x40efc3[_0x44d7('0x13')]()]+']',_0x2f95ad[_0x44d7('0x14')]);_0x26e341(_0x2f95ad[_0x44d7('0x14')]);});});};}function emit(_0x2586ff,_0x557b64,_0x24d13e){var _0x2b1885={'uri':_0x2586ff+_0x44d7('0x36')+_0x24d13e};io['to'](util[_0x44d7('0x24')](_0x44d7('0x37'),_0x557b64))[_0x44d7('0x38')](_0x44d7('0x39'),_0x2b1885);}exports['cs']=function(_0x319a5b,_0x30bbde,_0x50bb55,_0x54397c,_0x490a7b,_0x3ee0f4,_0x315b40,_0x54580f){var _0x1a8868={};var _0x2a9c95={'Authorization':_0x44d7('0x3a')+_0x3ee0f4['apiKey']};_0x3ee0f4[_0x44d7('0x3b')]=intUtil[_0x44d7('0x3c')](_0x3ee0f4[_0x44d7('0x3b')]);_0x3ee0f4[_0x44d7('0x3d')]=intUtil[_0x44d7('0x3c')](_0x3ee0f4[_0x44d7('0x3d')]);var _0x55d71f=_0x3ee0f4[_0x44d7('0x3b')];_0x1a8868[_0x44d7('0xc')]=_0x3ee0f4[_0x44d7('0x3e')];_0x1a8868['contactNumber']=_0x54580f[_0x44d7('0x3f')]()===_0x44d7('0x40')?_0x30bbde[_0x44d7('0x41')]:_0x30bbde[_0x44d7('0x42')];_0x1a8868['callDirection']=_0x54580f===_0x44d7('0x43')||_0x54580f==='unmanaged'?_0x44d7('0x43'):'outbound';if(_0x54397c){_0x1a8868[_0x44d7('0x19')]=_0x54397c[_0x44d7('0xb')];}var _0x1a6691=util[_0x44d7('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ee0f4['serverUrl'],_0x30bbde[_0x44d7('0x44')],md5(_0x30bbde['uniqueid']));if(_0x490a7b&&_0x490a7b[_0x44d7('0x45')]){logger[_0x44d7('0xd')](_0x44d7('0x46'),'Recording\x20is\x20enabled!');_0x30bbde[_0x44d7('0x47')]=_0x1a6691;}else if(_0x315b40&&_0x315b40[_0x44d7('0x48')]&&_0x315b40[_0x44d7('0x48')]!==_0x44d7('0x49')){logger['info'](_0x44d7('0x4a'),'Recording\x20is\x20enabled!');_0x30bbde[_0x44d7('0x47')]=_0x1a6691;}else{_0x30bbde[_0x44d7('0x47')]='';}return getAdminId(_0x1a8868,_0x54580f,_0x2a9c95,_0x55d71f)[_0x44d7('0x17')](getUser(_0x54580f,_0x2a9c95,_0x55d71f))[_0x44d7('0x17')](getEndUser(_0x54580f,_0x2a9c95,_0x55d71f))['then'](getTicket(_0x54580f,_0x2a9c95,_0x55d71f,_0x50bb55,_0x30bbde))[_0x44d7('0x17')](function(_0x4d8267){logger[_0x44d7('0xd')](util[_0x44d7('0x24')](_0x44d7('0x4b'),_0x4d8267[_0x44d7('0x35')]));if(_0x54580f!==_0x44d7('0x4c')){logger[_0x44d7('0xd')]('['+[_0x54580f[_0x44d7('0x13')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x55d71f,_0x54397c[_0x44d7('0x4d')],_0x4d8267[_0x44d7('0x28')]);}})[_0x44d7('0x11')](function(_0x59b1ca){logger['error']('['+[_0x54580f[_0x44d7('0x13')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x44d7('0x4e')](_0x59b1ca,{'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 1915bc1..346e8bc 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 _0xe8bd=['freshsales','servicenow','exec','includes','data1','toLowerCase','data2','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','salesforce','unknown\x20integration','error','[EXEC]','format','data3','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe8bd,0x111));var _0xde8b=function(_0x2b55d4,_0x1ed1b2){_0x2b55d4=_0x2b55d4-0x0;var _0x304574=_0xe8bd[_0x2b55d4];return _0x304574;};'use strict';var _=require(_0xde8b('0x0'));var util=require('util');var zendesk=require(_0xde8b('0x1'));var salesforce=require(_0xde8b('0x2'));var sugarcrm=require(_0xde8b('0x3'));var freshdesk=require(_0xde8b('0x4'));var zoho=require(_0xde8b('0x5'));var desk=require(_0xde8b('0x6'));var vtiger=require(_0xde8b('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0xde8b('0x8'));var freshsales=require('./freshsales');var integrations=['zendesk','salesforce',_0xde8b('0x9'),_0xde8b('0xa'),_0xde8b('0xb'),_0xde8b('0xc'),_0xde8b('0xd'),_0xde8b('0xe'),_0xde8b('0xf'),_0xde8b('0x10')];exports[_0xde8b('0x11')]=function(_0x64c887,_0x258e4a,_0x5d6047,_0x5d6e2c,_0x21a669,_0x2a51c){if(_0x5d6047){if(_[_0xde8b('0x12')](integrations,_0x64c887[_0xde8b('0x13')][_0xde8b('0x14')]())){try{var _0x33e2b5=null;var _0x39e3ee='';var _0x573b9c=_0x5d6047[_0x64c887[_0xde8b('0x13')][_0xde8b('0x14')]()];if(_0x573b9c){var _0x2026c2=_0x573b9c[_0x64c887[_0xde8b('0x15')]];if(_0x2026c2){var _0x14884f=_['find'](_0x2026c2[_0xde8b('0x16')],{'id':parseInt(_0x64c887['data3'],0xa)});if(_0x14884f){if(_0x5d6e2c){if(_0x21a669&&_0x258e4a[_0xde8b('0x17')]){_0x39e3ee=_0xde8b('0x17');}else if(_0x258e4a[_0xde8b('0x18')]){_0x39e3ee=_0xde8b('0x19');}else{console[_0xde8b('0x1a')](_0xde8b('0x1b'),_0x258e4a);}}else{_0x39e3ee=_0xde8b('0x1c');}switch(_0x64c887[_0xde8b('0x13')][_0xde8b('0x14')]()){case _0xde8b('0x1d'):zendesk[_0x39e3ee](_0x64c887,_0x258e4a,_0x14884f,_0x5d6e2c,_0x21a669,_0x2026c2,_0x2a51c);break;case _0xde8b('0x1e'):salesforce[_0x39e3ee](_0x64c887,_0x258e4a,_0x14884f,_0x5d6e2c,_0x21a669,_0x2026c2,_0x2a51c);break;case'sugarcrm':sugarcrm[_0x39e3ee](_0x64c887,_0x258e4a,_0x14884f,_0x5d6e2c,_0x21a669,_0x2026c2,_0x2a51c);break;case _0xde8b('0xa'):freshdesk[_0x39e3ee](_0x64c887,_0x258e4a,_0x14884f,_0x5d6e2c,_0x21a669,_0x2026c2,_0x2a51c);break;case _0xde8b('0xb'):zoho[_0x39e3ee](_0x64c887,_0x258e4a,_0x14884f,_0x5d6e2c,_0x21a669,_0x2026c2,_0x2a51c);break;case _0xde8b('0xc'):desk[_0x39e3ee](_0x64c887,_0x258e4a,_0x14884f,_0x5d6e2c,_0x21a669,_0x2026c2,_0x2a51c);break;case'vtiger':vtiger[_0x39e3ee](_0x64c887,_0x258e4a,_0x14884f,_0x5d6e2c,_0x21a669,_0x2026c2,_0x2a51c);break;case _0xde8b('0xf'):freshsales['cs'](_0x64c887,_0x258e4a,_0x14884f,_0x5d6e2c,_0x21a669,_0x2026c2,_0x2a51c,_0x39e3ee);break;case _0xde8b('0x10'):servicenow['cs'](_0x64c887,_0x258e4a,_0x14884f,_0x5d6e2c,_0x21a669,_0x2026c2,_0x2a51c,_0x39e3ee);break;case'dynamics365':dynamics365['cs'](_0x64c887,_0x258e4a,_0x14884f,_0x5d6e2c,_0x21a669,_0x2026c2,_0x2a51c,_0x39e3ee);break;default:console[_0xde8b('0x1a')](_0xde8b('0x1f'));}}else{_0x33e2b5=require('../../../../config/logger')(_0x64c887[_0xde8b('0x13')][_0xde8b('0x14')]());_0x33e2b5[_0xde8b('0x20')](_0xde8b('0x21'),util[_0xde8b('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0x64c887['data1'][_0xde8b('0x14')](),_0x64c887[_0xde8b('0x23')]));}}else{_0x33e2b5=require('../../../../config/logger')(_0x64c887[_0xde8b('0x13')]['toLowerCase']());_0x33e2b5[_0xde8b('0x20')](_0xde8b('0x21'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x64c887[_0xde8b('0x13')][_0xde8b('0x14')](),_0x64c887[_0xde8b('0x15')]));}}else{}}catch(_0x5312f5){console[_0xde8b('0x20')](_0x5312f5);}}}}; \ No newline at end of file +var _0x4dd3=['vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','unmanaged','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk'];(function(_0x5c0a94,_0x2a8dd1){var _0x5d7baa=function(_0xb8f19e){while(--_0xb8f19e){_0x5c0a94['push'](_0x5c0a94['shift']());}};_0x5d7baa(++_0x2a8dd1);}(_0x4dd3,0x1c4));var _0x34dd=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0x4dd3[_0x237da8];return _0x558825;};'use strict';var _=require(_0x34dd('0x0'));var util=require(_0x34dd('0x1'));var zendesk=require(_0x34dd('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x34dd('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0x34dd('0x4'));var desk=require(_0x34dd('0x5'));var vtiger=require(_0x34dd('0x6'));var servicenow=require(_0x34dd('0x7'));var dynamics365=require(_0x34dd('0x8'));var freshsales=require(_0x34dd('0x9'));var integrations=[_0x34dd('0xa'),_0x34dd('0xb'),_0x34dd('0xc'),_0x34dd('0xd'),_0x34dd('0xe'),_0x34dd('0xf'),_0x34dd('0x10'),_0x34dd('0x11'),'freshsales',_0x34dd('0x12')];exports[_0x34dd('0x13')]=function(_0x43e687,_0x5890af,_0x307865,_0x112af4,_0x2eb467,_0x3f21c1){if(_0x307865){if(_[_0x34dd('0x14')](integrations,_0x43e687[_0x34dd('0x15')][_0x34dd('0x16')]())){try{var _0x4415ed=null;var _0x3660e0='';var _0x59d562=_0x307865[_0x43e687[_0x34dd('0x15')][_0x34dd('0x16')]()];if(_0x59d562){var _0x268139=_0x59d562[_0x43e687[_0x34dd('0x17')]];if(_0x268139){var _0x1cecad=_[_0x34dd('0x18')](_0x268139[_0x34dd('0x19')],{'id':parseInt(_0x43e687[_0x34dd('0x1a')],0xa)});if(_0x1cecad){if(_0x112af4){if(_0x2eb467&&_0x5890af[_0x34dd('0x1b')]){_0x3660e0=_0x34dd('0x1b');}else if(_0x5890af[_0x34dd('0x1c')]){_0x3660e0=_0x34dd('0x1d');}else{console[_0x34dd('0x1e')]('EVENT\x20UNKNOWN',_0x5890af);}}else{_0x3660e0=_0x34dd('0x1f');}switch(_0x43e687['data1'][_0x34dd('0x16')]()){case _0x34dd('0xa'):zendesk[_0x3660e0](_0x43e687,_0x5890af,_0x1cecad,_0x112af4,_0x2eb467,_0x268139,_0x3f21c1);break;case'salesforce':salesforce[_0x3660e0](_0x43e687,_0x5890af,_0x1cecad,_0x112af4,_0x2eb467,_0x268139,_0x3f21c1);break;case _0x34dd('0xc'):sugarcrm[_0x3660e0](_0x43e687,_0x5890af,_0x1cecad,_0x112af4,_0x2eb467,_0x268139,_0x3f21c1);break;case'freshdesk':freshdesk[_0x3660e0](_0x43e687,_0x5890af,_0x1cecad,_0x112af4,_0x2eb467,_0x268139,_0x3f21c1);break;case _0x34dd('0xe'):zoho[_0x3660e0](_0x43e687,_0x5890af,_0x1cecad,_0x112af4,_0x2eb467,_0x268139,_0x3f21c1);break;case _0x34dd('0xf'):desk[_0x3660e0](_0x43e687,_0x5890af,_0x1cecad,_0x112af4,_0x2eb467,_0x268139,_0x3f21c1);break;case _0x34dd('0x10'):vtiger[_0x3660e0](_0x43e687,_0x5890af,_0x1cecad,_0x112af4,_0x2eb467,_0x268139,_0x3f21c1);break;case'freshsales':freshsales['cs'](_0x43e687,_0x5890af,_0x1cecad,_0x112af4,_0x2eb467,_0x268139,_0x3f21c1,_0x3660e0);break;case _0x34dd('0x12'):servicenow['cs'](_0x43e687,_0x5890af,_0x1cecad,_0x112af4,_0x2eb467,_0x268139,_0x3f21c1,_0x3660e0);break;case _0x34dd('0x11'):dynamics365['cs'](_0x43e687,_0x5890af,_0x1cecad,_0x112af4,_0x2eb467,_0x268139,_0x3f21c1,_0x3660e0);break;default:console[_0x34dd('0x1e')](_0x34dd('0x20'));}}else{_0x4415ed=require(_0x34dd('0x21'))(_0x43e687[_0x34dd('0x15')][_0x34dd('0x16')]());_0x4415ed[_0x34dd('0x22')](_0x34dd('0x23'),util[_0x34dd('0x24')](_0x34dd('0x25'),_0x43e687[_0x34dd('0x15')]['toLowerCase'](),_0x43e687[_0x34dd('0x1a')]));}}else{_0x4415ed=require(_0x34dd('0x21'))(_0x43e687[_0x34dd('0x15')][_0x34dd('0x16')]());_0x4415ed[_0x34dd('0x22')](_0x34dd('0x23'),util[_0x34dd('0x24')](_0x34dd('0x26'),_0x43e687[_0x34dd('0x15')][_0x34dd('0x16')](),_0x43e687['data2']));}}else{}}catch(_0x5ec3c0){console['error'](_0x5ec3c0);}}}}; \ 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 682d2df..625d665 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 _0x9d13=['assign','getString','Descriptions','Task','ActivityDate','utc','IsReminderSet','endUserType','lead','WhoId','account','WhatId','ticketType','Case','contact','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','sobject','find','execute','then','length','Agent\x20%s\x20found.','resolve','info','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Contact','Lead','first','Name','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','','No\x20Company','forEach','string','picklist','type','idField','variable','variableName','toString','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientSecret','login','username','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','queue','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','toUpperCase','calleridnum','Fields','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter'];(function(_0x1b7ff4,_0x2845d3){var _0x3762df=function(_0x48b556){while(--_0x48b556){_0x1b7ff4['push'](_0x1b7ff4['shift']());}};_0x3762df(++_0x2845d3);}(_0x9d13,0x1f1));var _0x39d1=function(_0x34a5c0,_0x424369){_0x34a5c0=_0x34a5c0-0x0;var _0x251da1=_0x9d13[_0x34a5c0];return _0x251da1;};'use strict';var _=require(_0x39d1('0x0'));var rp=require(_0x39d1('0x1'));var moment=require(_0x39d1('0x2'));var BPromise=require(_0x39d1('0x3'));var md5=require(_0x39d1('0x4'));var jsforce=require('jsforce');var util=require(_0x39d1('0x5'));var Redis=require(_0x39d1('0x6'));var intUtil=require(_0x39d1('0x7'));var config=require(_0x39d1('0x8'));var logger=require(_0x39d1('0x9'))(_0x39d1('0xa'));config[_0x39d1('0xb')]=_[_0x39d1('0xc')](config['redis'],{'host':_0x39d1('0xd'),'port':0x18eb});var io=require(_0x39d1('0xe'))(new Redis(config['redis']));function emit(_0x5c0d58,_0x25b73c,_0x2af3cc){io['to'](_0x5c0d58)['emit'](_0x25b73c,_0x2af3cc);}function getTicket(_0x27344e,_0x1b044e,_0xbf22bf,_0x3e3815,_0x13be1d,_0x5db340,_0x12a924,_0x18c291){var _0x454f8b=Object[_0x39d1('0xf')]({},{'OwnerId':_0x1b044e['id'],'Subject':intUtil[_0x39d1('0x10')](_0x3e3815['Subjects'],_0x13be1d,'\x20'),'Description':intUtil[_0x39d1('0x10')](_0x3e3815[_0x39d1('0x11')],_0x13be1d,'\x0a')},getCustomFields(_0x5db340,_0x13be1d));if(_0xbf22bf){if(_0x3e3815['ticketType']===_0x39d1('0x12')){_0x454f8b[_0x39d1('0x13')]=moment[_0x39d1('0x14')]();_0x454f8b[_0x39d1('0x15')]=![];_0x454f8b['IsRecurrence']=![];if(_0xbf22bf[_0x39d1('0x16')]==='contact'||_0xbf22bf[_0x39d1('0x16')]===_0x39d1('0x17')){_0x454f8b[_0x39d1('0x18')]=_0xbf22bf['id'];}else if(_0xbf22bf[_0x39d1('0x16')]===_0x39d1('0x19')){_0x454f8b[_0x39d1('0x1a')]=_0xbf22bf['id'];}}else if(_0x3e3815[_0x39d1('0x1b')]===_0x39d1('0x1c')){if(_0xbf22bf[_0x39d1('0x16')]===_0x39d1('0x1d')){_0x454f8b[_0x39d1('0x1e')]=_0xbf22bf['id'];}else if(_0xbf22bf[_0x39d1('0x16')]===_0x39d1('0x19')){_0x454f8b[_0x39d1('0x1f')]=_0xbf22bf['id'];}else if(_0xbf22bf['endUserType']===_0x39d1('0x17')&&_0x3e3815[_0x39d1('0x20')]){_0x454f8b[_0x3e3815['leadId']]=_0xbf22bf['id'];}else{logger['info'](_0x39d1('0x21'));}}}return _0x12a924['sobject'](_0x3e3815[_0x39d1('0x1b')])[_0x39d1('0x22')](_0x454f8b);}function getUser(_0x21f53d,_0x24ba81,_0xfd54fa){if(!_[_0x39d1('0x23')](_0x24ba81)&&intUtil['validateEmail'](_0x24ba81)){var _0x4feceb={'Email':_0x24ba81};var _0x32ac93={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xfd54fa[_0x39d1('0x24')]('User')[_0x39d1('0x25')](_0x4feceb,_0x32ac93)[_0x39d1('0x26')]()[_0x39d1('0x27')](function(_0x34225c){if(_0x34225c[_0x39d1('0x28')]){var _0x23713f=_['find'](_0x34225c,function(_0x5629c9){return _0x5629c9['Email']===_0x24ba81;});if(_0x23713f){logger['info'](_0x39d1('0x29'),_0x24ba81);return BPromise[_0x39d1('0x2a')]({'id':_0x23713f['Id'],'name':_0x23713f['Name']});}}else{logger[_0x39d1('0x2b')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x24ba81);return _0xfd54fa[_0x39d1('0x2c')]()['then'](function(_0xfd62f2){return BPromise['resolve']({'id':_0xfd62f2[_0x39d1('0x2d')],'name':_0xfd62f2[_0x39d1('0x2e')]});});}});}else{logger[_0x39d1('0x2b')](_0x39d1('0x2f'),_0x24ba81);return _0xfd54fa[_0x39d1('0x2c')]()['then'](function(_0x3eb283){return BPromise['resolve']({'id':_0x3eb283[_0x39d1('0x2d')],'name':_0x3eb283[_0x39d1('0x2e')]});});}}function getEndUser(_0x5ab5e2,_0x2e135a,_0x2af3fe,_0x29a5c6,_0x3d1866){var _0x4fe039={'$or':{'Phone':_0x29a5c6}};var _0x42349f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x39d1('0x2a')]()[_0x39d1('0x27')](function(){logger['info'](_0x39d1('0x30'),_0x29a5c6,_0x2e135a['moduleSearch']);switch(_0x2e135a[_0x39d1('0x31')]){case _0x39d1('0x32'):var _0x570019=_[_0x39d1('0x33')](_0x4fe039);if(_0x2e135a[_0x39d1('0x34')]){var _0x5d51d1={};_0x5d51d1[_0x2e135a[_0x39d1('0x34')]]=_0x29a5c6;_[_0x39d1('0x35')](_0x570019[_0x39d1('0x36')],_0x5d51d1);}return _0x3d1866[_0x39d1('0x24')]('Contact')['find'](_0x570019,_0x42349f)[_0x39d1('0x26')]()['then'](function(_0x184663){if(_0x184663&&_0x184663[_0x39d1('0x28')]){return _0x184663;}else{var _0x1e997e=_['cloneDeep'](_0x4fe039);if(_0x2e135a[_0x39d1('0x37')]){var _0x34b2bb={};_0x34b2bb[_0x2e135a[_0x39d1('0x37')]]=_0x29a5c6;_[_0x39d1('0x35')](_0x1e997e['$or'],_0x34b2bb);}return _0x3d1866[_0x39d1('0x24')]('Lead')[_0x39d1('0x25')](_0x1e997e,_0x42349f);}});case _0x39d1('0x38'):var _0x4f9e8b=_[_0x39d1('0x33')](_0x4fe039);if(_0x2e135a[_0x39d1('0x39')]){var _0x5d51d1={};_0x5d51d1[_0x2e135a[_0x39d1('0x39')]]=_0x29a5c6;_[_0x39d1('0x35')](_0x4f9e8b[_0x39d1('0x36')],_0x5d51d1);}return _0x3d1866[_0x39d1('0x24')](_0x39d1('0x3a'))['find'](_0x4f9e8b,_0x42349f)['execute']()[_0x39d1('0x27')](function(_0x26ace2){if(_0x26ace2&&_0x26ace2[_0x39d1('0x28')]){return _0x26ace2;}else{var _0x36dfcb=_['cloneDeep'](_0x4fe039);if(_0x2e135a['additionalSearchContact']){var _0x3a1b19={};_0x3a1b19[_0x2e135a['additionalSearchContact']]=_0x29a5c6;_['merge'](_0x36dfcb['$or'],_0x3a1b19);}return _0x3d1866[_0x39d1('0x24')](_0x39d1('0x3b'))[_0x39d1('0x25')](_0x36dfcb,_0x42349f)['then'](function(_0x9a9f1a){if(_0x9a9f1a&&_0x9a9f1a[_0x39d1('0x28')]){return _0x9a9f1a;}else{var _0x35254d=_['cloneDeep'](_0x4fe039);if(_0x2e135a['additionalSearchLead']){var _0x2db9fa={};_0x2db9fa[_0x2e135a[_0x39d1('0x37')]]=_0x29a5c6;_[_0x39d1('0x35')](_0x35254d[_0x39d1('0x36')],_0x2db9fa);}return _0x3d1866[_0x39d1('0x24')](_0x39d1('0x3c'))['find'](_0x35254d,_0x42349f);}});}});case _0x39d1('0x1d'):var _0x570019=_[_0x39d1('0x33')](_0x4fe039);if(_0x2e135a['additionalSearchContact']){var _0x5d51d1={};_0x5d51d1[_0x2e135a[_0x39d1('0x34')]]=_0x29a5c6;_['merge'](_0x570019[_0x39d1('0x36')],_0x5d51d1);}return _0x3d1866[_0x39d1('0x24')](_0x39d1('0x3b'))[_0x39d1('0x25')](_0x570019,_0x42349f)[_0x39d1('0x26')]();case _0x39d1('0x17'):var _0x55a7f4=_[_0x39d1('0x33')](_0x4fe039);if(_0x2e135a[_0x39d1('0x37')]){var _0x5d51d1={};_0x5d51d1[_0x2e135a['additionalSearchLead']]=_0x29a5c6;_[_0x39d1('0x35')](_0x55a7f4['$or'],_0x5d51d1);}return _0x3d1866[_0x39d1('0x24')](_0x39d1('0x3c'))[_0x39d1('0x25')](_0x55a7f4,_0x42349f);case _0x39d1('0x19'):var _0x4f9e8b=_[_0x39d1('0x33')](_0x4fe039);if(_0x2e135a[_0x39d1('0x39')]){var _0x5d51d1={};_0x5d51d1[_0x2e135a[_0x39d1('0x39')]]=_0x29a5c6;_['merge'](_0x4f9e8b[_0x39d1('0x36')],_0x5d51d1);}return _0x3d1866[_0x39d1('0x24')](_0x39d1('0x3a'))[_0x39d1('0x25')](_0x4f9e8b,_0x42349f);default:return null;}})[_0x39d1('0x27')](function(_0x8733ad){if(_0x8733ad&&_0x8733ad['length']){var _0x7f273=_[_0x39d1('0x3d')](_0x8733ad);if(_0x7f273){return BPromise[_0x39d1('0x2a')]({'id':_0x7f273['Id'],'name':_0x7f273[_0x39d1('0x3e')],'phone':_0x7f273['Phone'],'endUserType':_0x7f273[_0x39d1('0x3f')]['type'][_0x39d1('0x40')]()});}}})[_0x39d1('0x27')](function(_0x433ff8){if(_0x433ff8){logger['info'](_0x39d1('0x41'),_0x433ff8['endUserType'],_0x29a5c6);return BPromise[_0x39d1('0x2a')](_0x433ff8);}else{logger[_0x39d1('0x2b')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x29a5c6);var _0x4cfa07={'Phone':_0x29a5c6};if(_0x2e135a['moduleCreate']){if(_0x2e135a[_0x39d1('0x42')]==='contact'){logger[_0x39d1('0x2b')](_0x39d1('0x43'),_0x29a5c6,_0x2e135a[_0x39d1('0x42')]);_0x4cfa07[_0x39d1('0x44')]=_0x2af3fe!==''?_0x2af3fe:util[_0x39d1('0x45')](_0x39d1('0x46'),_0x29a5c6);}else if(_0x2e135a[_0x39d1('0x42')]==='lead'){logger[_0x39d1('0x2b')](_0x39d1('0x43'),_0x29a5c6,_0x2e135a[_0x39d1('0x42')]);_0x4cfa07[_0x39d1('0x44')]=_0x2af3fe!==_0x39d1('0x47')?_0x2af3fe:util[_0x39d1('0x45')](_0x39d1('0x46'),_0x29a5c6);_0x4cfa07['Company']=_0x39d1('0x48');}else if(_0x2e135a[_0x39d1('0x42')]===_0x39d1('0x19')){logger[_0x39d1('0x2b')](_0x39d1('0x43'),_0x29a5c6,_0x2e135a['moduleCreate']);_0x4cfa07[_0x39d1('0x3e')]=_0x2af3fe!==_0x39d1('0x47')?_0x2af3fe:util[_0x39d1('0x45')](_0x39d1('0x46'),_0x29a5c6);}else{return null;}}return _0x3d1866[_0x39d1('0x24')](_['upperFirst'](_0x2e135a[_0x39d1('0x42')]))[_0x39d1('0x22')](_0x4cfa07)[_0x39d1('0x27')](function(_0x5969ce){return BPromise[_0x39d1('0x2a')]({'id':_0x5969ce['id'],'endUserType':_0x2e135a['moduleCreate']});});}});}function getCustomFields(_0x58b88,_0x2e40f7){var _0x394e4a={};if(_0x58b88['length']>0x0){_[_0x39d1('0x49')](_0x58b88,function(_0x4787fd){if(_['includes']([_0x39d1('0x4a'),_0x39d1('0x4b')],_0x4787fd[_0x39d1('0x4c')])&&_0x4787fd[_0x39d1('0x4d')]){_0x394e4a[_0x4787fd[_0x39d1('0x4d')]]=_0x4787fd['content']['toString']();}else if(_0x4787fd[_0x39d1('0x4c')]===_0x39d1('0x4e')&&_0x4787fd[_0x39d1('0x4f')]&&_0x4787fd['idField']){_0x2e40f7[_0x4787fd[_0x39d1('0x4f')]]&&(_0x394e4a[_0x4787fd[_0x39d1('0x4d')]]=_0x2e40f7[_0x4787fd[_0x39d1('0x4f')]][_0x39d1('0x50')]());}else if(_0x4787fd[_0x39d1('0x4c')]===_0x39d1('0x51')&&_0x4787fd[_0x39d1('0x52')]&&_0x4787fd[_0x39d1('0x52')][_0x39d1('0x53')]&&_0x4787fd[_0x39d1('0x4d')]){_0x2e40f7[_0x4787fd['Variable'][_0x39d1('0x53')]['toLowerCase']()]&&(_0x394e4a[_0x4787fd[_0x39d1('0x4d')]]=_0x2e40f7[_0x4787fd['Variable'][_0x39d1('0x53')]['toLowerCase']()][_0x39d1('0x50')]());}});}return _0x394e4a;}function getConnection(_0x91fc85){var _0x267285=_0x91fc85[_0x39d1('0x54')][_0x39d1('0x55')](_0x91fc85[_0x39d1('0x56')]);var _0x2c62fd=new jsforce['Connection']({'oauth2':{'loginUrl':_0x91fc85[_0x39d1('0x57')]||_0x39d1('0x58'),'clientId':_0x91fc85['clientId'],'clientSecret':_0x91fc85[_0x39d1('0x59')]}});return _0x2c62fd[_0x39d1('0x5a')](_0x91fc85[_0x39d1('0x5b')],_0x267285)[_0x39d1('0x27')](function(){logger['info']('Connection\x20established.');return _0x2c62fd;});}exports['queue']=function(_0x4854f3,_0x54aa74,_0x4012c8,_0xcaf610,_0x568608,_0x44e050){var _0x24e391,_0x1b54b8,_0x5d664c,_0x3564a6;_0x44e050[_0x39d1('0x5c')]=intUtil[_0x39d1('0x5d')](_0x44e050[_0x39d1('0x5c')]);_0x44e050[_0x39d1('0x57')]=intUtil[_0x39d1('0x5d')](_0x44e050[_0x39d1('0x57')]);if(_0x568608&&_0x568608['monitor_format']){logger[_0x39d1('0x2b')](_0x39d1('0x5e'),_0x39d1('0x5f'));_0x54aa74[_0x39d1('0x60')]=util[_0x39d1('0x45')](_0x39d1('0x61'),_0x44e050[_0x39d1('0x5c')],_0x54aa74[_0x39d1('0x62')],md5(_0x54aa74[_0x39d1('0x62')]));}else{_0x54aa74[_0x39d1('0x60')]='';}return getConnection(_0x44e050)[_0x39d1('0x27')](function(_0x158347){_0x3564a6=_0x158347;return getUser(_0x44e050,_0xcaf610['email'],_0x3564a6);})[_0x39d1('0x27')](function(_0x45b0f3){_0x24e391=_0x45b0f3;return getEndUser(_0x44e050,_0x4012c8,_0x54aa74[_0x39d1('0x63')],_0x54aa74['calleridnum'],_0x3564a6);})['then'](function(_0x495e24){_0x1b54b8=_0x495e24;return getTicket(_0x44e050,_0x24e391,_0x1b54b8,_0x4012c8,_0x54aa74,_0x4012c8['Fields'],_0x3564a6,_0x39d1('0x64'));})[_0x39d1('0x27')](function(_0x35da2e){_0x5d664c=_0x35da2e;logger[_0x39d1('0x2b')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x5d664c['id']);logger[_0x39d1('0x2b')](_0x39d1('0x65'),_0x5d664c['id'],_0xcaf610[_0x39d1('0x53')],_0x44e050[_0x39d1('0x4c')]);switch(_0x44e050['type']){case'integrationTab':emit(util[_0x39d1('0x45')](_0x39d1('0x66'),_0xcaf610[_0x39d1('0x53')]),_0x39d1('0x67'),{'recordId':_0x5d664c['id']});break;case _0x39d1('0x68'):emit(util[_0x39d1('0x45')](_0x39d1('0x66'),_0xcaf610['name']),_0x39d1('0x69'),{'uri':util[_0x39d1('0x45')](_0x39d1('0x6a'),_0x3564a6[_0x39d1('0x6b')],_0x5d664c['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x39d1('0x6c')](function(_0x27b198){logger[_0x39d1('0x6d')](_0x39d1('0x5e'),_0x27b198);});};exports[_0x39d1('0x6e')]=function(_0x16238c,_0x29d99d,_0x265138,_0x4e4efd,_0x215072,_0x3e4e13,_0x43f22e){var _0x4ce3cb,_0x5e2d8a,_0x220b50,_0x446dc3;_0x3e4e13['serverUrl']=intUtil[_0x39d1('0x5d')](_0x3e4e13[_0x39d1('0x5c')]);_0x3e4e13['remoteUri']=intUtil['stripTrailingSlash'](_0x3e4e13[_0x39d1('0x57')]);if(_0x43f22e&&_0x43f22e[_0x39d1('0x6f')]&&_0x43f22e['recordingFormat']!==_0x39d1('0x70')){logger['info'](_0x39d1('0x71'),'Recording\x20is\x20enabled!');_0x29d99d[_0x39d1('0x60')]=util[_0x39d1('0x45')](_0x39d1('0x61'),_0x3e4e13[_0x39d1('0x5c')],_0x29d99d[_0x39d1('0x62')],md5(_0x29d99d[_0x39d1('0x62')]));}return getConnection(_0x3e4e13)[_0x39d1('0x27')](function(_0x59e716){_0x446dc3=_0x59e716;return getUser(_0x3e4e13,_0x4e4efd['email'],_0x446dc3);})[_0x39d1('0x27')](function(_0xa87591){_0x4ce3cb=_0xa87591;return getEndUser(_0x3e4e13,_0x265138,_0x29d99d[_0x39d1('0x72')],_0x29d99d[_0x39d1('0x73')],_0x446dc3);})['then'](function(_0x1dc322){_0x5e2d8a=_0x1dc322;return getTicket(_0x3e4e13,_0x4ce3cb,_0x5e2d8a,_0x265138,_0x29d99d,_0x265138['Fields'],_0x446dc3,_0x39d1('0x6e'));})[_0x39d1('0x27')](function(_0x3928b3){_0x220b50=_0x3928b3;logger[_0x39d1('0x2b')](_0x39d1('0x74'),_0x220b50['id']);logger['info'](_0x39d1('0x75'),_0x220b50['id'],_0x4e4efd[_0x39d1('0x53')],_0x3e4e13['type']);switch(_0x3e4e13['type']){case _0x39d1('0x76'):emit(util[_0x39d1('0x45')]('user:%s',_0x4e4efd[_0x39d1('0x53')]),_0x39d1('0x67'),{'recordId':_0x220b50['id']});break;case _0x39d1('0x68'):emit(util[_0x39d1('0x45')](_0x39d1('0x66'),_0x4e4efd[_0x39d1('0x53')]),_0x39d1('0x69'),{'uri':util[_0x39d1('0x45')](_0x39d1('0x6a'),_0x446dc3[_0x39d1('0x6b')],_0x220b50['id'])});break;default:logger[_0x39d1('0x6d')]('[OUTBOUND]',_0x39d1('0x77'));}})[_0x39d1('0x6c')](function(_0x18fbe2){logger[_0x39d1('0x6d')](_0x39d1('0x71'),_0x18fbe2);});};exports[_0x39d1('0x78')]=function(_0x30c326,_0x402d5e,_0x5c86b7,_0x24aa32,_0x53928c,_0x552abd){var _0x2f3187,_0x3f528e,_0xe548f9,_0x4ffbb8;_0x552abd[_0x39d1('0x5c')]=intUtil[_0x39d1('0x5d')](_0x552abd[_0x39d1('0x5c')]);_0x552abd['remoteUri']=intUtil[_0x39d1('0x5d')](_0x552abd[_0x39d1('0x57')]);if(_0x53928c&&_0x53928c[_0x39d1('0x79')]){logger[_0x39d1('0x2b')]('['+_0x402d5e['lastevent'][_0x39d1('0x7a')]()+']',_0x39d1('0x5f'));_0x402d5e[_0x39d1('0x60')]=util[_0x39d1('0x45')](_0x39d1('0x61'),_0x552abd[_0x39d1('0x5c')],_0x402d5e[_0x39d1('0x62')],md5(_0x402d5e[_0x39d1('0x62')]));}else{_0x402d5e[_0x39d1('0x60')]='';}return getConnection(_0x552abd)[_0x39d1('0x27')](function(_0x3ea741){_0x4ffbb8=_0x3ea741;if(!_[_0x39d1('0x23')](_0x24aa32)){return getUser(_0x552abd,_0x24aa32['name'],_0x4ffbb8);}else{return getUser(_0x552abd,null,_0x4ffbb8);}})['then'](function(_0xa6316c){_0x2f3187=_0xa6316c;return getEndUser(_0x552abd,_0x5c86b7,_0x402d5e[_0x39d1('0x63')],_0x402d5e[_0x39d1('0x7b')],_0x4ffbb8);})[_0x39d1('0x27')](function(_0xa070a0){_0x3f528e=_0xa070a0;return getTicket(_0x552abd,_0x2f3187,_0x3f528e,_0x5c86b7,_0x402d5e,_0x5c86b7[_0x39d1('0x7c')],_0x4ffbb8);})['then'](function(_0x337e69){_0xe548f9=_0x337e69;logger[_0x39d1('0x2b')]('['+_0x402d5e[_0x39d1('0x7d')]['toUpperCase']()+_0x39d1('0x7e'),_0xe548f9['id']);logger[_0x39d1('0x2b')]('['+_0x402d5e[_0x39d1('0x7d')]['toUpperCase']()+_0x39d1('0x7f'),_0x552abd[_0x39d1('0x4c')]);})['catch'](function(_0x19823c){logger[_0x39d1('0x6d')]('['+_0x402d5e[_0x39d1('0x7d')][_0x39d1('0x7a')]()+']',_0x19823c);});}; \ No newline at end of file +var _0xd7bb=['securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','newTab','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','util','./util','../../../../config/environment','salesforce','defaults','redis','localhost','socket.io-emitter','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','endUserType','contact','WhoId','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','account','format','Caller\x20-\x20%s','upperFirst','forEach','includes','string','picklist','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x2ab76b,_0x176579){var _0x201126=function(_0x11d8c8){while(--_0x11d8c8){_0x2ab76b['push'](_0x2ab76b['shift']());}};_0x201126(++_0x176579);}(_0xd7bb,0x19a));var _0xbd7b=function(_0x35bae0,_0x32b0d3){_0x35bae0=_0x35bae0-0x0;var _0x50dec0=_0xd7bb[_0x35bae0];return _0x50dec0;};'use strict';var _=require(_0xbd7b('0x0'));var rp=require(_0xbd7b('0x1'));var moment=require(_0xbd7b('0x2'));var BPromise=require('bluebird');var md5=require(_0xbd7b('0x3'));var jsforce=require('jsforce');var util=require(_0xbd7b('0x4'));var Redis=require('ioredis');var intUtil=require(_0xbd7b('0x5'));var config=require(_0xbd7b('0x6'));var logger=require('../../../../config/logger')(_0xbd7b('0x7'));config['redis']=_[_0xbd7b('0x8')](config[_0xbd7b('0x9')],{'host':_0xbd7b('0xa'),'port':0x18eb});var io=require(_0xbd7b('0xb'))(new Redis(config[_0xbd7b('0x9')]));function emit(_0x10cdec,_0x65679d,_0x64a6da){io['to'](_0x10cdec)['emit'](_0x65679d,_0x64a6da);}function getTicket(_0x1a1888,_0x2d3fee,_0x68a931,_0x2b420f,_0x565a1d,_0x5b96ef,_0x2d2f8d,_0x4e92ee){var _0x3cc9d5=Object['assign']({},{'OwnerId':_0x2d3fee['id'],'Subject':intUtil[_0xbd7b('0xc')](_0x2b420f[_0xbd7b('0xd')],_0x565a1d,'\x20'),'Description':intUtil[_0xbd7b('0xc')](_0x2b420f[_0xbd7b('0xe')],_0x565a1d,'\x0a')},getCustomFields(_0x5b96ef,_0x565a1d));if(_0x68a931){if(_0x2b420f[_0xbd7b('0xf')]===_0xbd7b('0x10')){_0x3cc9d5[_0xbd7b('0x11')]=moment['utc']();_0x3cc9d5['IsReminderSet']=![];_0x3cc9d5['IsRecurrence']=![];if(_0x68a931[_0xbd7b('0x12')]===_0xbd7b('0x13')||_0x68a931[_0xbd7b('0x12')]==='lead'){_0x3cc9d5[_0xbd7b('0x14')]=_0x68a931['id'];}else if(_0x68a931[_0xbd7b('0x12')]==='account'){_0x3cc9d5['WhatId']=_0x68a931['id'];}}else if(_0x2b420f[_0xbd7b('0xf')]==='Case'){if(_0x68a931[_0xbd7b('0x12')]==='contact'){_0x3cc9d5[_0xbd7b('0x15')]=_0x68a931['id'];}else if(_0x68a931[_0xbd7b('0x12')]==='account'){_0x3cc9d5[_0xbd7b('0x16')]=_0x68a931['id'];}else if(_0x68a931[_0xbd7b('0x12')]===_0xbd7b('0x17')&&_0x2b420f[_0xbd7b('0x18')]){_0x3cc9d5[_0x2b420f[_0xbd7b('0x18')]]=_0x68a931['id'];}else{logger[_0xbd7b('0x19')](_0xbd7b('0x1a'));}}}return _0x2d2f8d[_0xbd7b('0x1b')](_0x2b420f[_0xbd7b('0xf')])[_0xbd7b('0x1c')](_0x3cc9d5);}function getUser(_0x322b4d,_0x305e68,_0x5b9580){if(!_[_0xbd7b('0x1d')](_0x305e68)&&intUtil[_0xbd7b('0x1e')](_0x305e68)){var _0x2b3399={'Email':_0x305e68};var _0x372654={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5b9580[_0xbd7b('0x1b')](_0xbd7b('0x1f'))[_0xbd7b('0x20')](_0x2b3399,_0x372654)[_0xbd7b('0x21')]()[_0xbd7b('0x22')](function(_0x1a3c57){if(_0x1a3c57[_0xbd7b('0x23')]){var _0x56401e=_[_0xbd7b('0x20')](_0x1a3c57,function(_0x555256){return _0x555256[_0xbd7b('0x24')]===_0x305e68;});if(_0x56401e){logger[_0xbd7b('0x19')](_0xbd7b('0x25'),_0x305e68);return BPromise[_0xbd7b('0x26')]({'id':_0x56401e['Id'],'name':_0x56401e[_0xbd7b('0x27')]});}}else{logger[_0xbd7b('0x19')](_0xbd7b('0x28'),_0x305e68);return _0x5b9580[_0xbd7b('0x29')]()[_0xbd7b('0x22')](function(_0x1f1dbf){return BPromise[_0xbd7b('0x26')]({'id':_0x1f1dbf['user_id'],'name':_0x1f1dbf['display_name']});});}});}else{logger[_0xbd7b('0x19')](_0xbd7b('0x28'),_0x305e68);return _0x5b9580['identity']()[_0xbd7b('0x22')](function(_0x276700){return BPromise[_0xbd7b('0x26')]({'id':_0x276700['user_id'],'name':_0x276700[_0xbd7b('0x2a')]});});}}function getEndUser(_0x2ebabc,_0x3b6a2a,_0x2975ca,_0x23d6c6,_0x4b0063){var _0x4d5b94={'$or':{'Phone':_0x23d6c6}};var _0x101752={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xbd7b('0x26')]()[_0xbd7b('0x22')](function(){logger['info'](_0xbd7b('0x2b'),_0x23d6c6,_0x3b6a2a['moduleSearch']);switch(_0x3b6a2a['moduleSearch']){case _0xbd7b('0x2c'):var _0x3ad872=_[_0xbd7b('0x2d')](_0x4d5b94);if(_0x3b6a2a[_0xbd7b('0x2e')]){var _0x1fb6df={};_0x1fb6df[_0x3b6a2a[_0xbd7b('0x2e')]]=_0x23d6c6;_[_0xbd7b('0x2f')](_0x3ad872['$or'],_0x1fb6df);}return _0x4b0063[_0xbd7b('0x1b')](_0xbd7b('0x30'))[_0xbd7b('0x20')](_0x3ad872,_0x101752)[_0xbd7b('0x21')]()[_0xbd7b('0x22')](function(_0x273b09){if(_0x273b09&&_0x273b09['length']){return _0x273b09;}else{var _0x5393f8=_[_0xbd7b('0x2d')](_0x4d5b94);if(_0x3b6a2a[_0xbd7b('0x31')]){var _0x500000={};_0x500000[_0x3b6a2a['additionalSearchLead']]=_0x23d6c6;_[_0xbd7b('0x2f')](_0x5393f8[_0xbd7b('0x32')],_0x500000);}return _0x4b0063[_0xbd7b('0x1b')](_0xbd7b('0x33'))[_0xbd7b('0x20')](_0x5393f8,_0x101752);}});case _0xbd7b('0x34'):var _0x585276=_[_0xbd7b('0x2d')](_0x4d5b94);if(_0x3b6a2a['additionalSearchAccount']){var _0x1fb6df={};_0x1fb6df[_0x3b6a2a[_0xbd7b('0x35')]]=_0x23d6c6;_[_0xbd7b('0x2f')](_0x585276[_0xbd7b('0x32')],_0x1fb6df);}return _0x4b0063[_0xbd7b('0x1b')](_0xbd7b('0x36'))[_0xbd7b('0x20')](_0x585276,_0x101752)[_0xbd7b('0x21')]()[_0xbd7b('0x22')](function(_0x158a61){if(_0x158a61&&_0x158a61[_0xbd7b('0x23')]){return _0x158a61;}else{var _0x562e78=_['cloneDeep'](_0x4d5b94);if(_0x3b6a2a[_0xbd7b('0x2e')]){var _0x300fa2={};_0x300fa2[_0x3b6a2a[_0xbd7b('0x2e')]]=_0x23d6c6;_['merge'](_0x562e78['$or'],_0x300fa2);}return _0x4b0063['sobject'](_0xbd7b('0x30'))[_0xbd7b('0x20')](_0x562e78,_0x101752)['then'](function(_0xcb5d40){if(_0xcb5d40&&_0xcb5d40[_0xbd7b('0x23')]){return _0xcb5d40;}else{var _0xe8042d=_['cloneDeep'](_0x4d5b94);if(_0x3b6a2a[_0xbd7b('0x31')]){var _0x4986e5={};_0x4986e5[_0x3b6a2a[_0xbd7b('0x31')]]=_0x23d6c6;_[_0xbd7b('0x2f')](_0xe8042d[_0xbd7b('0x32')],_0x4986e5);}return _0x4b0063[_0xbd7b('0x1b')](_0xbd7b('0x33'))[_0xbd7b('0x20')](_0xe8042d,_0x101752);}});}});case _0xbd7b('0x13'):var _0x3ad872=_[_0xbd7b('0x2d')](_0x4d5b94);if(_0x3b6a2a[_0xbd7b('0x2e')]){var _0x1fb6df={};_0x1fb6df[_0x3b6a2a[_0xbd7b('0x2e')]]=_0x23d6c6;_[_0xbd7b('0x2f')](_0x3ad872[_0xbd7b('0x32')],_0x1fb6df);}return _0x4b0063['sobject']('Contact')['find'](_0x3ad872,_0x101752)['execute']();case _0xbd7b('0x17'):var _0x26115c=_[_0xbd7b('0x2d')](_0x4d5b94);if(_0x3b6a2a['additionalSearchLead']){var _0x1fb6df={};_0x1fb6df[_0x3b6a2a['additionalSearchLead']]=_0x23d6c6;_[_0xbd7b('0x2f')](_0x26115c[_0xbd7b('0x32')],_0x1fb6df);}return _0x4b0063[_0xbd7b('0x1b')]('Lead')[_0xbd7b('0x20')](_0x26115c,_0x101752);case'account':var _0x585276=_['cloneDeep'](_0x4d5b94);if(_0x3b6a2a[_0xbd7b('0x35')]){var _0x1fb6df={};_0x1fb6df[_0x3b6a2a[_0xbd7b('0x35')]]=_0x23d6c6;_[_0xbd7b('0x2f')](_0x585276['$or'],_0x1fb6df);}return _0x4b0063[_0xbd7b('0x1b')](_0xbd7b('0x36'))[_0xbd7b('0x20')](_0x585276,_0x101752);default:return null;}})['then'](function(_0x464075){if(_0x464075&&_0x464075[_0xbd7b('0x23')]){var _0x370676=_[_0xbd7b('0x37')](_0x464075);if(_0x370676){return BPromise[_0xbd7b('0x26')]({'id':_0x370676['Id'],'name':_0x370676[_0xbd7b('0x27')],'phone':_0x370676[_0xbd7b('0x38')],'endUserType':_0x370676[_0xbd7b('0x39')][_0xbd7b('0x3a')]['toLowerCase']()});}}})[_0xbd7b('0x22')](function(_0x32fdea){if(_0x32fdea){logger[_0xbd7b('0x19')](_0xbd7b('0x3b'),_0x32fdea['endUserType'],_0x23d6c6);return BPromise[_0xbd7b('0x26')](_0x32fdea);}else{logger[_0xbd7b('0x19')](_0xbd7b('0x3c'),_0x23d6c6);var _0x3bafec={'Phone':_0x23d6c6};if(_0x3b6a2a[_0xbd7b('0x3d')]){if(_0x3b6a2a['moduleCreate']===_0xbd7b('0x13')){logger[_0xbd7b('0x19')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x23d6c6,_0x3b6a2a[_0xbd7b('0x3d')]);_0x3bafec[_0xbd7b('0x3e')]=_0x2975ca!==_0xbd7b('0x3f')?_0x2975ca:util['format']('Caller\x20-\x20%s',_0x23d6c6);}else if(_0x3b6a2a[_0xbd7b('0x3d')]===_0xbd7b('0x17')){logger[_0xbd7b('0x19')](_0xbd7b('0x40'),_0x23d6c6,_0x3b6a2a[_0xbd7b('0x3d')]);_0x3bafec[_0xbd7b('0x3e')]=_0x2975ca!==_0xbd7b('0x3f')?_0x2975ca:util['format']('Caller\x20-\x20%s',_0x23d6c6);_0x3bafec[_0xbd7b('0x41')]='No\x20Company';}else if(_0x3b6a2a['moduleCreate']===_0xbd7b('0x42')){logger[_0xbd7b('0x19')](_0xbd7b('0x40'),_0x23d6c6,_0x3b6a2a['moduleCreate']);_0x3bafec[_0xbd7b('0x27')]=_0x2975ca!==_0xbd7b('0x3f')?_0x2975ca:util[_0xbd7b('0x43')](_0xbd7b('0x44'),_0x23d6c6);}else{return null;}}return _0x4b0063[_0xbd7b('0x1b')](_[_0xbd7b('0x45')](_0x3b6a2a[_0xbd7b('0x3d')]))['create'](_0x3bafec)[_0xbd7b('0x22')](function(_0x559934){return BPromise[_0xbd7b('0x26')]({'id':_0x559934['id'],'endUserType':_0x3b6a2a['moduleCreate']});});}});}function getCustomFields(_0x22f7b1,_0x344f31){var _0x41af7f={};if(_0x22f7b1[_0xbd7b('0x23')]>0x0){_[_0xbd7b('0x46')](_0x22f7b1,function(_0x22647b){if(_[_0xbd7b('0x47')]([_0xbd7b('0x48'),_0xbd7b('0x49')],_0x22647b['type'])&&_0x22647b['idField']){_0x41af7f[_0x22647b[_0xbd7b('0x4a')]]=_0x22647b[_0xbd7b('0x4b')][_0xbd7b('0x4c')]();}else if(_0x22647b[_0xbd7b('0x3a')]==='variable'&&_0x22647b[_0xbd7b('0x4d')]&&_0x22647b['idField']){_0x344f31[_0x22647b[_0xbd7b('0x4d')]]&&(_0x41af7f[_0x22647b[_0xbd7b('0x4a')]]=_0x344f31[_0x22647b[_0xbd7b('0x4d')]]['toString']());}else if(_0x22647b[_0xbd7b('0x3a')]===_0xbd7b('0x4e')&&_0x22647b['Variable']&&_0x22647b[_0xbd7b('0x4f')][_0xbd7b('0x50')]&&_0x22647b[_0xbd7b('0x4a')]){_0x344f31[_0x22647b[_0xbd7b('0x4f')][_0xbd7b('0x50')][_0xbd7b('0x51')]()]&&(_0x41af7f[_0x22647b[_0xbd7b('0x4a')]]=_0x344f31[_0x22647b[_0xbd7b('0x4f')][_0xbd7b('0x50')]['toLowerCase']()][_0xbd7b('0x4c')]());}});}return _0x41af7f;}function getConnection(_0x5a8174){var _0x217557=_0x5a8174['password']['concat'](_0x5a8174[_0xbd7b('0x52')]);var _0x4843e3=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5a8174[_0xbd7b('0x53')]||_0xbd7b('0x54'),'clientId':_0x5a8174[_0xbd7b('0x55')],'clientSecret':_0x5a8174[_0xbd7b('0x56')]}});return _0x4843e3[_0xbd7b('0x57')](_0x5a8174['username'],_0x217557)[_0xbd7b('0x22')](function(){logger[_0xbd7b('0x19')](_0xbd7b('0x58'));return _0x4843e3;});}exports[_0xbd7b('0x59')]=function(_0x30fba2,_0x5d8768,_0x42787e,_0x175320,_0x59163d,_0x2acba5){var _0xcba0fa,_0x1745e8,_0xa8e1db,_0x5c60e9;_0x2acba5[_0xbd7b('0x5a')]=intUtil['stripTrailingSlash'](_0x2acba5['serverUrl']);_0x2acba5[_0xbd7b('0x53')]=intUtil[_0xbd7b('0x5b')](_0x2acba5[_0xbd7b('0x53')]);if(_0x59163d&&_0x59163d['monitor_format']){logger[_0xbd7b('0x19')](_0xbd7b('0x5c'),_0xbd7b('0x5d'));_0x5d8768[_0xbd7b('0x5e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2acba5['serverUrl'],_0x5d8768[_0xbd7b('0x5f')],md5(_0x5d8768[_0xbd7b('0x5f')]));}else{_0x5d8768[_0xbd7b('0x5e')]='';}return getConnection(_0x2acba5)[_0xbd7b('0x22')](function(_0x3ea29e){_0x5c60e9=_0x3ea29e;return getUser(_0x2acba5,_0x175320[_0xbd7b('0x60')],_0x5c60e9);})['then'](function(_0x41170e){_0xcba0fa=_0x41170e;return getEndUser(_0x2acba5,_0x42787e,_0x5d8768[_0xbd7b('0x61')],_0x5d8768[_0xbd7b('0x62')],_0x5c60e9);})[_0xbd7b('0x22')](function(_0x54e0af){_0x1745e8=_0x54e0af;return getTicket(_0x2acba5,_0xcba0fa,_0x1745e8,_0x42787e,_0x5d8768,_0x42787e['Fields'],_0x5c60e9,_0xbd7b('0x59'));})['then'](function(_0x1add72){_0xa8e1db=_0x1add72;logger[_0xbd7b('0x19')](_0xbd7b('0x63'),_0xa8e1db['id']);logger[_0xbd7b('0x19')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0xa8e1db['id'],_0x175320[_0xbd7b('0x50')],_0x2acba5[_0xbd7b('0x3a')]);switch(_0x2acba5[_0xbd7b('0x3a')]){case'integrationTab':emit(util[_0xbd7b('0x43')](_0xbd7b('0x64'),_0x175320[_0xbd7b('0x50')]),_0xbd7b('0x65'),{'recordId':_0xa8e1db['id']});break;case'newTab':emit(util['format']('user:%s',_0x175320[_0xbd7b('0x50')]),_0xbd7b('0x66'),{'uri':util[_0xbd7b('0x43')](_0xbd7b('0x67'),_0x5c60e9[_0xbd7b('0x68')],_0xa8e1db['id'])});break;default:logger[_0xbd7b('0x69')](_0xbd7b('0x6a'));}})[_0xbd7b('0x6b')](function(_0x2b136a){logger['error'](_0xbd7b('0x5c'),_0x2b136a);});};exports[_0xbd7b('0x6c')]=function(_0x29a458,_0x37c351,_0x355076,_0x1883e0,_0x1f3d08,_0x571afa,_0x2daa30){var _0x576940,_0x5cce63,_0x56c3b6,_0x50251a;_0x571afa[_0xbd7b('0x5a')]=intUtil['stripTrailingSlash'](_0x571afa[_0xbd7b('0x5a')]);_0x571afa['remoteUri']=intUtil['stripTrailingSlash'](_0x571afa[_0xbd7b('0x53')]);if(_0x2daa30&&_0x2daa30[_0xbd7b('0x6d')]&&_0x2daa30[_0xbd7b('0x6d')]!==_0xbd7b('0x6e')){logger['info'](_0xbd7b('0x6f'),_0xbd7b('0x5d'));_0x37c351['recordingURL']=util[_0xbd7b('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x571afa[_0xbd7b('0x5a')],_0x37c351['uniqueid'],md5(_0x37c351[_0xbd7b('0x5f')]));}return getConnection(_0x571afa)[_0xbd7b('0x22')](function(_0x1366bd){_0x50251a=_0x1366bd;return getUser(_0x571afa,_0x1883e0[_0xbd7b('0x60')],_0x50251a);})['then'](function(_0x4c2e5f){_0x576940=_0x4c2e5f;return getEndUser(_0x571afa,_0x355076,_0x37c351[_0xbd7b('0x70')],_0x37c351[_0xbd7b('0x71')],_0x50251a);})['then'](function(_0x2867bd){_0x5cce63=_0x2867bd;return getTicket(_0x571afa,_0x576940,_0x5cce63,_0x355076,_0x37c351,_0x355076[_0xbd7b('0x72')],_0x50251a,_0xbd7b('0x6c'));})[_0xbd7b('0x22')](function(_0x4711cb){_0x56c3b6=_0x4711cb;logger[_0xbd7b('0x19')](_0xbd7b('0x73'),_0x56c3b6['id']);logger[_0xbd7b('0x19')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x56c3b6['id'],_0x1883e0['name'],_0x571afa[_0xbd7b('0x3a')]);switch(_0x571afa['type']){case _0xbd7b('0x74'):emit(util[_0xbd7b('0x43')](_0xbd7b('0x64'),_0x1883e0[_0xbd7b('0x50')]),_0xbd7b('0x65'),{'recordId':_0x56c3b6['id']});break;case _0xbd7b('0x75'):emit(util[_0xbd7b('0x43')](_0xbd7b('0x64'),_0x1883e0['name']),_0xbd7b('0x66'),{'uri':util[_0xbd7b('0x43')](_0xbd7b('0x67'),_0x50251a['instanceUrl'],_0x56c3b6['id'])});break;default:logger[_0xbd7b('0x69')](_0xbd7b('0x6f'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xbd7b('0x6b')](function(_0x439320){logger[_0xbd7b('0x69')](_0xbd7b('0x6f'),_0x439320);});};exports[_0xbd7b('0x76')]=function(_0x2a4bdc,_0x11cfee,_0x1390c3,_0x280fab,_0x5c23f2,_0x29c3dd){var _0x5ed31a,_0x5692a2,_0x485c3d,_0x29f1ab;_0x29c3dd[_0xbd7b('0x5a')]=intUtil[_0xbd7b('0x5b')](_0x29c3dd[_0xbd7b('0x5a')]);_0x29c3dd[_0xbd7b('0x53')]=intUtil[_0xbd7b('0x5b')](_0x29c3dd['remoteUri']);if(_0x5c23f2&&_0x5c23f2['monitor_format']){logger[_0xbd7b('0x19')]('['+_0x11cfee[_0xbd7b('0x77')][_0xbd7b('0x78')]()+']',_0xbd7b('0x5d'));_0x11cfee[_0xbd7b('0x5e')]=util[_0xbd7b('0x43')](_0xbd7b('0x79'),_0x29c3dd[_0xbd7b('0x5a')],_0x11cfee[_0xbd7b('0x5f')],md5(_0x11cfee[_0xbd7b('0x5f')]));}else{_0x11cfee[_0xbd7b('0x5e')]='';}return getConnection(_0x29c3dd)[_0xbd7b('0x22')](function(_0x25f5c8){_0x29f1ab=_0x25f5c8;if(!_[_0xbd7b('0x1d')](_0x280fab)){return getUser(_0x29c3dd,_0x280fab[_0xbd7b('0x50')],_0x29f1ab);}else{return getUser(_0x29c3dd,null,_0x29f1ab);}})['then'](function(_0x5d658e){_0x5ed31a=_0x5d658e;return getEndUser(_0x29c3dd,_0x1390c3,_0x11cfee['calleridname'],_0x11cfee[_0xbd7b('0x62')],_0x29f1ab);})[_0xbd7b('0x22')](function(_0x135ccf){_0x5692a2=_0x135ccf;return getTicket(_0x29c3dd,_0x5ed31a,_0x5692a2,_0x1390c3,_0x11cfee,_0x1390c3['Fields'],_0x29f1ab);})['then'](function(_0x2e8bdf){_0x485c3d=_0x2e8bdf;logger[_0xbd7b('0x19')]('['+_0x11cfee['lastevent']['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x485c3d['id']);logger[_0xbd7b('0x19')]('['+_0x11cfee[_0xbd7b('0x77')][_0xbd7b('0x78')]()+_0xbd7b('0x7a'),_0x29c3dd['type']);})[_0xbd7b('0x6b')](function(_0x52159e){logger[_0xbd7b('0x69')]('['+_0x11cfee[_0xbd7b('0x77')]['toUpperCase']()+']',_0x52159e);});}; \ 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 9a6e99a..a2a08af 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 _0xf01a=['System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20createEndUser\x20crm','forEach','picklist','type','nameField','toLowerCase','content','toString','includes','string','idField','variable','variableName','customField','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','number','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','ticketNumber','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','trigger:browser:url','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','email','calleridnum','callDirection','queue','unmanaged','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','./util','../../../../config/environment','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','toUpperCase','catch','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','userId','sys_id','adminEmail','],\x20getUser\x20crm','error','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','true'];(function(_0x1bcb95,_0x5d7e37){var _0x5da1f9=function(_0x4708a2){while(--_0x4708a2){_0x1bcb95['push'](_0x1bcb95['shift']());}};_0x5da1f9(++_0x5d7e37);}(_0xf01a,0x107));var _0xaf01=function(_0x26e211,_0x5f58b5){_0x26e211=_0x26e211-0x0;var _0x5ae5d0=_0xf01a[_0x26e211];return _0x5ae5d0;};'use strict';var _=require(_0xaf01('0x0'));var Promise=require(_0xaf01('0x1'));var rp=require(_0xaf01('0x2'));var util=require('util');var md5=require('md5');var Redis=require('ioredis');var intUtil=require(_0xaf01('0x3'));var config=require(_0xaf01('0x4'));var logger=require('../../../../config/logger')(_0xaf01('0x5'));config[_0xaf01('0x6')]=_['defaults'](config[_0xaf01('0x6')],{'host':_0xaf01('0x7'),'port':0x18eb});var io=require(_0xaf01('0x8'))(new Redis(config[_0xaf01('0x6')]));function getAdminUser(_0x5afd3f,_0x1bc6a3,_0x4cc7ef,_0x52feea,_0x3eedc1,_0x2fb204){return new Promise(function(_0x5374ad,_0x54393b){var _0x12dede={'method':_0xaf01('0x9'),'uri':_0x52feea+_0xaf01('0xa')+'&'+_0x3eedc1+'&'+_0x2fb204,'auth':_0x1bc6a3,'json':!![]};return rp(_0x12dede)[_0xaf01('0xb')](function(_0x1e4b96){if(_0x1e4b96[_0xaf01('0xc')][_0xaf01('0xd')]>0x0){_0x4cc7ef[_0xaf01('0xe')]=_0x1e4b96[_0xaf01('0xc')][0x0]['sys_id'];}logger[_0xaf01('0xf')]('['+[_0x5afd3f[_0xaf01('0x10')]()]+'],\x20getAdminUser\x20crm',_0x4cc7ef);_0x5374ad(_0x4cc7ef);})[_0xaf01('0x11')](function(_0xc48a3b){logger['error']('['+[_0x5afd3f[_0xaf01('0x10')]()]+']',_0xc48a3b['message']);_0x54393b(_0xc48a3b[_0xaf01('0x12')]);});});}function getUser(_0x29e847,_0xbd4bc,_0x493101,_0xbe2b5f,_0x215dd1){return function(_0x4910d1){logger[_0xaf01('0xf')]('['+[_0x29e847[_0xaf01('0x10')]()]+_0xaf01('0x13'),_0x4910d1);return new Promise(function(_0x5c3ba3,_0x6b8b13){if(intUtil[_0xaf01('0x14')](_0x4910d1[_0xaf01('0x15')])){var _0x3477f1={'method':_0xaf01('0x9'),'uri':_0x493101+_0xaf01('0x16')+_0x4910d1[_0xaf01('0x15')]+'&'+_0xbe2b5f+'&'+_0x215dd1,'auth':_0xbd4bc,'json':!![]};logger[_0xaf01('0xf')]('['+[_0x29e847[_0xaf01('0x10')]()]+_0xaf01('0x17'),_0x3477f1);return rp(_0x3477f1)[_0xaf01('0xb')](function(_0x4ff572){logger['info']('['+[_0x29e847[_0xaf01('0x10')]()]+'],\x20getUser\x20entity',_0x4ff572);if(_0x4ff572[_0xaf01('0xc')]['length']>0x0&&String(_0x4ff572[_0xaf01('0xc')][0x0]['active'])==='true'){_0x4910d1[_0xaf01('0x18')]=_0x4ff572[_0xaf01('0xc')][0x0][_0xaf01('0x19')];}else{_0x4910d1[_0xaf01('0x18')]=_0x4910d1[_0xaf01('0xe')];_0x4910d1[_0xaf01('0x15')]=_0x4910d1[_0xaf01('0x1a')];}logger['info']('['+[_0x29e847['toUpperCase']()]+_0xaf01('0x1b'),_0x4910d1);_0x5c3ba3(_0x4910d1);})['catch'](function(_0x4cd0e6){logger[_0xaf01('0x1c')]('['+[_0x29e847[_0xaf01('0x10')]()]+']',_0x4cd0e6[_0xaf01('0x12')]);_0x6b8b13(_0x4cd0e6[_0xaf01('0x12')]);});}else{logger[_0xaf01('0xf')]('['+[_0x29e847[_0xaf01('0x10')]()]+']\x20using\x20admin\x20profile');_0x4910d1[_0xaf01('0x18')]=_0x4910d1['adminId'];_0x4910d1['userEmail']=_0x4910d1[_0xaf01('0x1a')];_0x5c3ba3(_0x4910d1);}});};}function createEndUser(_0x22247c,_0x268d4f,_0x10c9f7,_0x5d847a,_0x3067be){logger[_0xaf01('0xf')]('['+[_0x22247c[_0xaf01('0x10')]()]+_0xaf01('0x1d'),_0x10c9f7);return new Promise(function(_0x2b5615,_0xe41c63){var _0x323163={'method':_0xaf01('0x1e'),'uri':_0x5d847a+_0xaf01('0x1f')+_0x3067be,'body':{'user_name':_0x10c9f7[_0xaf01('0x20')],'roles':'user','first_name':_0x10c9f7[_0xaf01('0x20')],'active':_0xaf01('0x21'),'date_format':_0xaf01('0x22'),'phone':_0x10c9f7[_0xaf01('0x20')]},'auth':_0x268d4f,'json':!![]};return rp(_0x323163)['then'](function(_0x3b3d96){logger[_0xaf01('0xf')]('['+[_0x22247c[_0xaf01('0x10')]()]+_0xaf01('0x23'),_0x3b3d96[_0xaf01('0xc')]);_0x10c9f7[_0xaf01('0x24')]=_0x3b3d96[_0xaf01('0xc')][_0xaf01('0x19')];_0x2b5615(_0x10c9f7);})[_0xaf01('0x11')](function(_0x7ea483){logger[_0xaf01('0x1c')]('['+[_0x22247c[_0xaf01('0x10')]()]+']',_0x7ea483['message']);_0xe41c63(_0x7ea483[_0xaf01('0x12')]);});});}function getEndUser(_0x2fc267,_0x528dcd,_0x2f8cc5,_0x474772,_0x2d7a50){return function(_0x1545ee){logger['info']('['+[_0x2fc267[_0xaf01('0x10')]()]+_0xaf01('0x25'),_0x1545ee);return new Promise(function(_0x365d10,_0x200dfa){var _0x57fe41={'method':_0xaf01('0x9'),'uri':_0x2f8cc5+'sys_user?sysparm_query=phone%3D'+_0x1545ee[_0xaf01('0x20')]+'&'+_0x474772+'&'+_0x2d7a50,'auth':_0x528dcd,'json':!![]};return rp(_0x57fe41)[_0xaf01('0xb')](function(_0x1033c4){if(_0x1033c4[_0xaf01('0xc')][_0xaf01('0xd')]>0x0){_0x1545ee[_0xaf01('0x24')]=_0x1033c4['result'][0x0][_0xaf01('0x19')];logger['info']('['+[_0x2fc267['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x1545ee);_0x365d10(_0x1545ee);}else{return createEndUser(_0x2fc267,_0x528dcd,_0x1545ee,_0x2f8cc5,_0x474772)[_0xaf01('0xb')](function(_0xf79121){logger['info']('['+[_0x2fc267['toUpperCase']()]+_0xaf01('0x26'),_0xf79121);_0x365d10(_0xf79121);});}})[_0xaf01('0x11')](function(_0x34955c){logger[_0xaf01('0x1c')]('['+[_0x2fc267[_0xaf01('0x10')]()]+']',_0x34955c[_0xaf01('0x12')]);_0x200dfa(_0x34955c[_0xaf01('0x12')]);});});};}function getCustomFields(_0x1e1f11,_0x205a82){var _0x37e03c={};if(_0x1e1f11['length']>0x0){_[_0xaf01('0x27')](_0x1e1f11,function(_0x4c9de8){if(_['includes'](['string',_0xaf01('0x28')],_0x4c9de8[_0xaf01('0x29')])&&_0x4c9de8['nameField']&&!_0x4c9de8['customField']){_0x37e03c[_0x4c9de8[_0xaf01('0x2a')][_0xaf01('0x2b')]()]=_0x4c9de8[_0xaf01('0x2c')][_0xaf01('0x2d')]();}else if(_[_0xaf01('0x2e')]([_0xaf01('0x2f'),_0xaf01('0x28')],_0x4c9de8['type'])&&_0x4c9de8[_0xaf01('0x30')]&&_0x4c9de8['customField']){_0x37e03c[_0x4c9de8[_0xaf01('0x30')][_0xaf01('0x2b')]()]=_0x4c9de8[_0xaf01('0x2c')][_0xaf01('0x2d')]();}else if(_0x4c9de8[_0xaf01('0x29')]===_0xaf01('0x31')&&_0x4c9de8[_0xaf01('0x32')]&&_0x4c9de8[_0xaf01('0x30')]&&_0x4c9de8[_0xaf01('0x33')]){_0x37e03c[_0x4c9de8['idField'][_0xaf01('0x2b')]()]=_0x205a82[_0x4c9de8[_0xaf01('0x32')]][_0xaf01('0x2d')]();}else if(_0x4c9de8['type']===_0xaf01('0x34')&&_0x4c9de8[_0xaf01('0x35')]&&_0x4c9de8[_0xaf01('0x35')][_0xaf01('0x36')]&&_0x4c9de8[_0xaf01('0x30')]&&_0x4c9de8[_0xaf01('0x33')]){_0x37e03c[_0x4c9de8[_0xaf01('0x30')][_0xaf01('0x2b')]()]=_0x205a82[_0x4c9de8[_0xaf01('0x35')][_0xaf01('0x36')]['toLowerCase']()]['toString']();}});}return _0x37e03c;}function getTicket(_0x554d5d,_0x3d97be,_0x258102,_0x1916e9,_0x5bb486,_0xaa9e3c){return function(_0x457fb5){logger[_0xaf01('0xf')]('['+[_0x554d5d[_0xaf01('0x10')]()]+_0xaf01('0x37'),_0x457fb5);return new Promise(function(_0xa7a79d,_0x1cfd00){var _0x2eef10=_0x554d5d[_0xaf01('0x2b')]()===_0xaf01('0x38')?_0x457fb5[_0xaf01('0x18')]:_0x457fb5[_0xaf01('0x24')];var _0x1350b7={'method':'POST','uri':_0x258102+_0xaf01('0x39')+'?'+_0xaa9e3c,'body':Object['assign']({},{'active':_0xaf01('0x21'),'caller_id':_0x2eef10,'assigned_to':_0x457fb5[_0xaf01('0x18')],'short_description':intUtil[_0xaf01('0x3a')](_0x1916e9[_0xaf01('0x3b')],_0x5bb486,'\x20'),'description':intUtil['getString'](_0x1916e9[_0xaf01('0x3c')],_0x5bb486,'\x0a')},getCustomFields(_0x1916e9['Fields'],_0x5bb486)),'auth':_0x3d97be,'json':!![]};return rp(_0x1350b7)[_0xaf01('0xb')](function(_0x4bc8fb){logger[_0xaf01('0xf')]('['+[_0x554d5d['toUpperCase']()]+_0xaf01('0x3d'),_0x4bc8fb['result']);_0x457fb5[_0xaf01('0x3e')]=_0x4bc8fb[_0xaf01('0xc')]['sys_id'];_0x457fb5['ticketNumber']=_0x4bc8fb[_0xaf01('0xc')][_0xaf01('0x3f')];logger[_0xaf01('0xf')]('['+[_0x554d5d[_0xaf01('0x10')]()]+']\x20getTicket\x20crm',_0x457fb5);_0xa7a79d(_0x457fb5);})['catch'](function(_0x26735f){logger[_0xaf01('0x1c')]('['+[_0x554d5d[_0xaf01('0x10')]()]+']',_0x26735f['message']);_0x1cfd00(_0x26735f[_0xaf01('0x12')]);});});};}function createRemoteTag(_0x58d6b0,_0x60ce94,_0x3dcd93,_0x5d7462){return new Promise(function(_0x133e7a,_0x730d93){var _0x2dbe61={'method':_0xaf01('0x1e'),'uri':_0x3dcd93+'label'+'?'+_0x5d7462,'body':{'short_description':_0x58d6b0,'global':!![],'active':!![],'name':_0x58d6b0},'auth':_0x60ce94,'json':!![]};return rp(_0x2dbe61)['then'](function(_0x4480c3){var _0x5bf830=_0x4480c3[_0xaf01('0xc')][_0xaf01('0x19')];_0x133e7a(_0x5bf830);});});}function getRemoteTag(_0x35df4e,_0x494a9d,_0x43f03f,_0x11385b,_0x3cf4a2){return new Promise(function(_0xb273a3,_0x372e1c){var _0x1c8790={'method':_0xaf01('0x9'),'uri':_0x43f03f+'label'+_0xaf01('0x40')+_0x35df4e+'&'+_0x11385b,'auth':_0x494a9d,'json':!![]};return rp(_0x1c8790)[_0xaf01('0xb')](function(_0x17a64d){if(_0x17a64d[_0xaf01('0xc')][_0xaf01('0xd')]>0x0){var _0xe6ad62=_0x17a64d[_0xaf01('0xc')][0x0]['sys_id'];_0xb273a3(_0xe6ad62);}else{return createRemoteTag(_0x35df4e,_0x494a9d,_0x43f03f,_0x11385b)['then'](function(_0xdb1b1e){_0xb273a3(_0xdb1b1e);});}});});}function assignTagToIncident(_0x257c3d,_0xe09ad7,_0x5ec62a,_0x341fe4,_0x1f97c9){return new Promise(function(_0x575533,_0x4cd6c2){var _0x281b57={'method':_0xaf01('0x1e'),'uri':_0x5ec62a+_0xaf01('0x41')+'?'+_0x1f97c9,'body':{'label':_0x257c3d,'table':_0xaf01('0x39'),'id_type':'Incident','table_key':_0x341fe4['ticketId'],'title':_0xaf01('0x42')+_0x341fe4[_0xaf01('0x43')],'id_display':_0x341fe4['ticketNumber']},'auth':_0xe09ad7,'json':!![]};return rp(_0x281b57)['then'](function(_0x2094dc){_0x575533();})[_0xaf01('0x11')](function(){_0x575533();});});}function manageTags(_0x56b51b,_0x4b6440,_0x1b2e4a,_0x484855,_0x149857,_0x42e84b,_0xde4da8){return new Promise(function(_0x2edeee,_0x2842d4){var _0x41ed27=[];_0x4b6440[_0xaf01('0x27')](function(_0x31393f){_0x41ed27[_0xaf01('0x44')](getRemoteTag(_0x31393f,_0x1b2e4a,_0x484855,_0x42e84b,_0xde4da8));});return Promise[_0xaf01('0x45')](_0x41ed27)['then'](function(_0x521ad7){if(_0x521ad7[_0xaf01('0xd')]){logger[_0xaf01('0xf')]('['+[_0x56b51b[_0xaf01('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x521ad7);var _0x1275fd=[];_0x521ad7[_0xaf01('0x27')](function(_0x528b7f){_0x1275fd['push'](assignTagToIncident(_0x528b7f,_0x1b2e4a,_0x484855,_0x149857,_0x42e84b));});return Promise[_0xaf01('0x45')](_0x1275fd)[_0xaf01('0xb')](function(){_0x2edeee();})[_0xaf01('0x11')](function(){_0x2edeee();});}else{_0x2edeee();}});});}function getTags(_0x196485,_0x2fd698,_0x8e440,_0x19e7b9,_0x2f16b8,_0x16d8e7){return function(_0x162768){return new Promise(function(_0x4427ed,_0x3bf159){var _0x26bd44=[];var _0x527271=_0x19e7b9[_0xaf01('0x46')];if(_0x527271&&_0x527271[_0xaf01('0xd')]>0x0){_0x26bd44=_['map'](_0x527271,_0xaf01('0x36'));}if(_0x26bd44[_0xaf01('0xd')]>0x0){return manageTags(_0x196485,_0x26bd44,_0x2fd698,_0x8e440,_0x162768,_0x2f16b8,_0x16d8e7)['then'](function(){_0x4427ed(_0x162768);});}else{_0x4427ed(_0x162768);}});};}function emit(_0x8f5cf7,_0x2d2bed,_0x1cbbea){var _0x186969=_0xaf01('0x47')+_0xaf01('0x48')+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x1b4090={'uri':_0x8f5cf7+_0xaf01('0x49')+_0x1cbbea+_0x186969};io['to'](util['format'](_0xaf01('0x4a'),_0x2d2bed))['emit'](_0xaf01('0x4b'),_0x1b4090);}exports['cs']=function(_0x51ed30,_0x30d38d,_0x1432ec,_0x32fefb,_0x4edf39,_0x13bc5b,_0x128276,_0xffc75b){var _0x38d855={};var _0x5a4e28={'user':_0x13bc5b['username'],'pass':_0x13bc5b[_0xaf01('0x4c')]};var _0x46c7dc='sysparm_limit=1';var _0xb8e03d=_0xaf01('0x4d');_0x13bc5b[_0xaf01('0x4e')]=intUtil['stripTrailingSlash'](_0x13bc5b[_0xaf01('0x4e')]);_0x13bc5b['serverUrl']=intUtil[_0xaf01('0x4f')](_0x13bc5b[_0xaf01('0x50')]);var _0x550790=util[_0xaf01('0x51')](_0xaf01('0x52'),_0x13bc5b[_0xaf01('0x4e')]);_0x38d855['userEmail']=!_['isNil'](_0x32fefb)?_0x32fefb[_0xaf01('0x53')]:null;_0x38d855['adminEmail']=_0x13bc5b['email'];_0x38d855[_0xaf01('0x20')]=_0xffc75b[_0xaf01('0x2b')]()===_0xaf01('0x38')?_0x30d38d['destcalleridnum']:_0x30d38d[_0xaf01('0x54')];_0x38d855[_0xaf01('0x55')]=_0xffc75b===_0xaf01('0x56')||_0xffc75b===_0xaf01('0x57')?'queue':_0xaf01('0x38');var _0x5071bb=util[_0xaf01('0x51')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13bc5b[_0xaf01('0x50')],_0x30d38d[_0xaf01('0x58')],md5(_0x30d38d[_0xaf01('0x58')]));if(_0x4edf39&&_0x4edf39['monitor_format']){logger[_0xaf01('0xf')](_0xaf01('0x59'),_0xaf01('0x5a'));_0x30d38d[_0xaf01('0x5b')]=_0x5071bb;}else if(_0x128276&&_0x128276['recordingFormat']&&_0x128276[_0xaf01('0x5c')]!==_0xaf01('0x5d')){logger['info'](_0xaf01('0x5e'),'Recording\x20is\x20enabled!');_0x30d38d[_0xaf01('0x5b')]=_0x5071bb;}else{_0x30d38d['recordingURL']='';}return getAdminUser(_0xffc75b,_0x5a4e28,_0x38d855,_0x550790,_0xb8e03d,_0x46c7dc)[_0xaf01('0xb')](getUser(_0xffc75b,_0x5a4e28,_0x550790,_0xb8e03d,_0x46c7dc))[_0xaf01('0xb')](getEndUser(_0xffc75b,_0x5a4e28,_0x550790,_0xb8e03d,_0x46c7dc))[_0xaf01('0xb')](getTicket(_0xffc75b,_0x5a4e28,_0x550790,_0x1432ec,_0x30d38d,_0xb8e03d))[_0xaf01('0xb')](function(_0x5c8dcb){logger[_0xaf01('0xf')](util[_0xaf01('0x51')](_0xaf01('0x5f'),_0x5c8dcb[_0xaf01('0x3e')]));logger[_0xaf01('0xf')](util[_0xaf01('0x51')](_0xaf01('0x60'),_0xffc75b));if(_0xffc75b!==_0xaf01('0x57')){logger[_0xaf01('0xf')]('['+[_0xffc75b[_0xaf01('0x10')]()]+']',_0xaf01('0x61'));emit(_0x13bc5b[_0xaf01('0x4e')],_0x32fefb[_0xaf01('0x36')],_0x5c8dcb[_0xaf01('0x3e')]);}})[_0xaf01('0x11')](function(_0x5c4fc3){logger[_0xaf01('0x1c')]('['+[_0xffc75b[_0xaf01('0x10')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xaf01('0x62')](_0x5c4fc3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf3cb=['all','Tags','map','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','%s/api/now/table/','email','destcalleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','./util','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','GET','length','adminId','result','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','true','userId','sys_id','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','picklist','type','nameField','toLowerCase','content','idField','variableName','customField','toString','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xf3cb,0xfb));var _0xbf3c=function(_0x35c1ac,_0x217aeb){_0x35c1ac=_0x35c1ac-0x0;var _0x4226ac=_0xf3cb[_0x35c1ac];return _0x4226ac;};'use strict';var _=require(_0xbf3c('0x0'));var Promise=require(_0xbf3c('0x1'));var rp=require(_0xbf3c('0x2'));var util=require(_0xbf3c('0x3'));var md5=require(_0xbf3c('0x4'));var Redis=require('ioredis');var intUtil=require(_0xbf3c('0x5'));var config=require('../../../../config/environment');var logger=require(_0xbf3c('0x6'))(_0xbf3c('0x7'));config['redis']=_[_0xbf3c('0x8')](config[_0xbf3c('0x9')],{'host':_0xbf3c('0xa'),'port':0x18eb});var io=require(_0xbf3c('0xb'))(new Redis(config[_0xbf3c('0x9')]));function getAdminUser(_0x1246ad,_0x1d311d,_0xa2294d,_0x26fb2c,_0x136912,_0x2847f9){return new Promise(function(_0x34f395,_0xd3b208){var _0x469821={'method':_0xbf3c('0xc'),'uri':_0x26fb2c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x136912+'&'+_0x2847f9,'auth':_0x1d311d,'json':!![]};return rp(_0x469821)['then'](function(_0x5b24d5){if(_0x5b24d5['result'][_0xbf3c('0xd')]>0x0){_0xa2294d[_0xbf3c('0xe')]=_0x5b24d5[_0xbf3c('0xf')][0x0]['sys_id'];}logger['info']('['+[_0x1246ad['toUpperCase']()]+_0xbf3c('0x10'),_0xa2294d);_0x34f395(_0xa2294d);})[_0xbf3c('0x11')](function(_0x17492a){logger[_0xbf3c('0x12')]('['+[_0x1246ad[_0xbf3c('0x13')]()]+']',_0x17492a[_0xbf3c('0x14')]);_0xd3b208(_0x17492a[_0xbf3c('0x14')]);});});}function getUser(_0xed371,_0x200853,_0x274965,_0x5439be,_0x285dfa){return function(_0x49ff6f){logger[_0xbf3c('0x15')]('['+[_0xed371[_0xbf3c('0x13')]()]+_0xbf3c('0x16'),_0x49ff6f);return new Promise(function(_0x1b905c,_0x46e54e){if(intUtil[_0xbf3c('0x17')](_0x49ff6f[_0xbf3c('0x18')])){var _0x1f12e9={'method':_0xbf3c('0xc'),'uri':_0x274965+'sys_user?sysparm_query=email%3D'+_0x49ff6f[_0xbf3c('0x18')]+'&'+_0x5439be+'&'+_0x285dfa,'auth':_0x200853,'json':!![]};logger[_0xbf3c('0x15')]('['+[_0xed371[_0xbf3c('0x13')]()]+_0xbf3c('0x19'),_0x1f12e9);return rp(_0x1f12e9)[_0xbf3c('0x1a')](function(_0x6cf71c){logger['info']('['+[_0xed371[_0xbf3c('0x13')]()]+_0xbf3c('0x1b'),_0x6cf71c);if(_0x6cf71c[_0xbf3c('0xf')][_0xbf3c('0xd')]>0x0&&String(_0x6cf71c[_0xbf3c('0xf')][0x0][_0xbf3c('0x1c')])===_0xbf3c('0x1d')){_0x49ff6f[_0xbf3c('0x1e')]=_0x6cf71c[_0xbf3c('0xf')][0x0][_0xbf3c('0x1f')];}else{_0x49ff6f['userId']=_0x49ff6f['adminId'];_0x49ff6f[_0xbf3c('0x18')]=_0x49ff6f[_0xbf3c('0x20')];}logger[_0xbf3c('0x15')]('['+[_0xed371['toUpperCase']()]+'],\x20getUser\x20crm',_0x49ff6f);_0x1b905c(_0x49ff6f);})['catch'](function(_0x4fd35d){logger[_0xbf3c('0x12')]('['+[_0xed371[_0xbf3c('0x13')]()]+']',_0x4fd35d[_0xbf3c('0x14')]);_0x46e54e(_0x4fd35d[_0xbf3c('0x14')]);});}else{logger[_0xbf3c('0x15')]('['+[_0xed371['toUpperCase']()]+_0xbf3c('0x21'));_0x49ff6f[_0xbf3c('0x1e')]=_0x49ff6f[_0xbf3c('0xe')];_0x49ff6f[_0xbf3c('0x18')]=_0x49ff6f[_0xbf3c('0x20')];_0x1b905c(_0x49ff6f);}});};}function createEndUser(_0x39a633,_0x13e104,_0x1f4521,_0x763ba8,_0x299609){logger[_0xbf3c('0x15')]('['+[_0x39a633['toUpperCase']()]+_0xbf3c('0x22'),_0x1f4521);return new Promise(function(_0x50879e,_0x16f7e9){var _0x29715b={'method':_0xbf3c('0x23'),'uri':_0x763ba8+_0xbf3c('0x24')+_0x299609,'body':{'user_name':_0x1f4521[_0xbf3c('0x25')],'roles':_0xbf3c('0x26'),'first_name':_0x1f4521['endUserNumber'],'active':_0xbf3c('0x1d'),'date_format':_0xbf3c('0x27'),'phone':_0x1f4521[_0xbf3c('0x25')]},'auth':_0x13e104,'json':!![]};return rp(_0x29715b)[_0xbf3c('0x1a')](function(_0x7d5af9){logger[_0xbf3c('0x15')]('['+[_0x39a633[_0xbf3c('0x13')]()]+'],\x20EndUser\x20schema',_0x7d5af9['result']);_0x1f4521[_0xbf3c('0x28')]=_0x7d5af9['result'][_0xbf3c('0x1f')];_0x50879e(_0x1f4521);})[_0xbf3c('0x11')](function(_0x36b93f){logger[_0xbf3c('0x12')]('['+[_0x39a633[_0xbf3c('0x13')]()]+']',_0x36b93f[_0xbf3c('0x14')]);_0x16f7e9(_0x36b93f[_0xbf3c('0x14')]);});});}function getEndUser(_0x34e4bb,_0x1602ce,_0x30fc8d,_0x5179d6,_0x1843fd){return function(_0x3d7b94){logger[_0xbf3c('0x15')]('['+[_0x34e4bb[_0xbf3c('0x13')]()]+_0xbf3c('0x29'),_0x3d7b94);return new Promise(function(_0x32c3b9,_0x1b8bc1){var _0x533371={'method':_0xbf3c('0xc'),'uri':_0x30fc8d+'sys_user?sysparm_query=phone%3D'+_0x3d7b94[_0xbf3c('0x25')]+'&'+_0x5179d6+'&'+_0x1843fd,'auth':_0x1602ce,'json':!![]};return rp(_0x533371)[_0xbf3c('0x1a')](function(_0x80dbac){if(_0x80dbac[_0xbf3c('0xf')][_0xbf3c('0xd')]>0x0){_0x3d7b94[_0xbf3c('0x28')]=_0x80dbac[_0xbf3c('0xf')][0x0]['sys_id'];logger[_0xbf3c('0x15')]('['+[_0x34e4bb[_0xbf3c('0x13')]()]+_0xbf3c('0x2a'),_0x3d7b94);_0x32c3b9(_0x3d7b94);}else{return createEndUser(_0x34e4bb,_0x1602ce,_0x3d7b94,_0x30fc8d,_0x5179d6)[_0xbf3c('0x1a')](function(_0x3331f6){logger['info']('['+[_0x34e4bb[_0xbf3c('0x13')]()]+_0xbf3c('0x2b'),_0x3331f6);_0x32c3b9(_0x3331f6);});}})[_0xbf3c('0x11')](function(_0x4477ed){logger[_0xbf3c('0x12')]('['+[_0x34e4bb[_0xbf3c('0x13')]()]+']',_0x4477ed[_0xbf3c('0x14')]);_0x1b8bc1(_0x4477ed[_0xbf3c('0x14')]);});});};}function getCustomFields(_0x248f36,_0x52b700){var _0x358425={};if(_0x248f36['length']>0x0){_[_0xbf3c('0x2c')](_0x248f36,function(_0x18da96){if(_['includes']([_0xbf3c('0x2d'),_0xbf3c('0x2e')],_0x18da96[_0xbf3c('0x2f')])&&_0x18da96[_0xbf3c('0x30')]&&!_0x18da96['customField']){_0x358425[_0x18da96[_0xbf3c('0x30')][_0xbf3c('0x31')]()]=_0x18da96[_0xbf3c('0x32')]['toString']();}else if(_['includes']([_0xbf3c('0x2d'),_0xbf3c('0x2e')],_0x18da96[_0xbf3c('0x2f')])&&_0x18da96[_0xbf3c('0x33')]&&_0x18da96['customField']){_0x358425[_0x18da96['idField']['toLowerCase']()]=_0x18da96[_0xbf3c('0x32')]['toString']();}else if(_0x18da96[_0xbf3c('0x2f')]==='variable'&&_0x18da96[_0xbf3c('0x34')]&&_0x18da96[_0xbf3c('0x33')]&&_0x18da96[_0xbf3c('0x35')]){_0x358425[_0x18da96[_0xbf3c('0x33')]['toLowerCase']()]=_0x52b700[_0x18da96[_0xbf3c('0x34')]][_0xbf3c('0x36')]();}else if(_0x18da96['type']===_0xbf3c('0x37')&&_0x18da96[_0xbf3c('0x38')]&&_0x18da96[_0xbf3c('0x38')]['name']&&_0x18da96[_0xbf3c('0x33')]&&_0x18da96[_0xbf3c('0x35')]){_0x358425[_0x18da96[_0xbf3c('0x33')][_0xbf3c('0x31')]()]=_0x52b700[_0x18da96[_0xbf3c('0x38')][_0xbf3c('0x39')][_0xbf3c('0x31')]()][_0xbf3c('0x36')]();}});}return _0x358425;}function getTicket(_0x5c6cac,_0x31b6ee,_0x3cb4df,_0x2b0ae4,_0x4289a0,_0x1c2ba1){return function(_0x386937){logger[_0xbf3c('0x15')]('['+[_0x5c6cac[_0xbf3c('0x13')]()]+_0xbf3c('0x3a'),_0x386937);return new Promise(function(_0x558cf3,_0x47ecd1){var _0x4dcddc=_0x5c6cac['toLowerCase']()===_0xbf3c('0x3b')?_0x386937[_0xbf3c('0x1e')]:_0x386937[_0xbf3c('0x28')];var _0x28cd51={'method':_0xbf3c('0x23'),'uri':_0x3cb4df+_0xbf3c('0x3c')+'?'+_0x1c2ba1,'body':Object[_0xbf3c('0x3d')]({},{'active':'true','caller_id':_0x4dcddc,'assigned_to':_0x386937[_0xbf3c('0x1e')],'short_description':intUtil['getString'](_0x2b0ae4['Subjects'],_0x4289a0,'\x20'),'description':intUtil[_0xbf3c('0x3e')](_0x2b0ae4[_0xbf3c('0x3f')],_0x4289a0,'\x0a')},getCustomFields(_0x2b0ae4[_0xbf3c('0x40')],_0x4289a0)),'auth':_0x31b6ee,'json':!![]};return rp(_0x28cd51)[_0xbf3c('0x1a')](function(_0x4a99b2){logger[_0xbf3c('0x15')]('['+[_0x5c6cac[_0xbf3c('0x13')]()]+_0xbf3c('0x41'),_0x4a99b2['result']);_0x386937[_0xbf3c('0x42')]=_0x4a99b2[_0xbf3c('0xf')][_0xbf3c('0x1f')];_0x386937[_0xbf3c('0x43')]=_0x4a99b2[_0xbf3c('0xf')][_0xbf3c('0x44')];logger[_0xbf3c('0x15')]('['+[_0x5c6cac[_0xbf3c('0x13')]()]+_0xbf3c('0x45'),_0x386937);_0x558cf3(_0x386937);})['catch'](function(_0x2e9fa5){logger['error']('['+[_0x5c6cac['toUpperCase']()]+']',_0x2e9fa5['message']);_0x47ecd1(_0x2e9fa5[_0xbf3c('0x14')]);});});};}function createRemoteTag(_0x422a00,_0x136b4a,_0x10d147,_0x49553c){return new Promise(function(_0x5eaff2,_0x21e239){var _0xa936ce={'method':_0xbf3c('0x23'),'uri':_0x10d147+_0xbf3c('0x46')+'?'+_0x49553c,'body':{'short_description':_0x422a00,'global':!![],'active':!![],'name':_0x422a00},'auth':_0x136b4a,'json':!![]};return rp(_0xa936ce)[_0xbf3c('0x1a')](function(_0xe33917){var _0x2b5a2d=_0xe33917[_0xbf3c('0xf')][_0xbf3c('0x1f')];_0x5eaff2(_0x2b5a2d);});});}function getRemoteTag(_0x3f6dec,_0x395487,_0x3a9ca1,_0x4da7af,_0x3be3b7){return new Promise(function(_0x45d038,_0x44e33e){var _0x4a620b={'method':'GET','uri':_0x3a9ca1+_0xbf3c('0x46')+_0xbf3c('0x47')+_0x3f6dec+'&'+_0x4da7af,'auth':_0x395487,'json':!![]};return rp(_0x4a620b)['then'](function(_0xdec0fe){if(_0xdec0fe[_0xbf3c('0xf')][_0xbf3c('0xd')]>0x0){var _0x271ec2=_0xdec0fe[_0xbf3c('0xf')][0x0][_0xbf3c('0x1f')];_0x45d038(_0x271ec2);}else{return createRemoteTag(_0x3f6dec,_0x395487,_0x3a9ca1,_0x4da7af)[_0xbf3c('0x1a')](function(_0x32694d){_0x45d038(_0x32694d);});}});});}function assignTagToIncident(_0x4740cf,_0x11d3b2,_0x9f4cba,_0x39573a,_0x13cd68){return new Promise(function(_0x462d06,_0x2d8f7b){var _0x566c06={'method':_0xbf3c('0x23'),'uri':_0x9f4cba+_0xbf3c('0x48')+'?'+_0x13cd68,'body':{'label':_0x4740cf,'table':'incident','id_type':_0xbf3c('0x49'),'table_key':_0x39573a[_0xbf3c('0x42')],'title':_0xbf3c('0x4a')+_0x39573a[_0xbf3c('0x43')],'id_display':_0x39573a[_0xbf3c('0x43')]},'auth':_0x11d3b2,'json':!![]};return rp(_0x566c06)[_0xbf3c('0x1a')](function(_0x8b53b3){_0x462d06();})[_0xbf3c('0x11')](function(){_0x462d06();});});}function manageTags(_0x2b3c9a,_0x42bad4,_0x5e85ca,_0x42f3e8,_0xc7e407,_0x406b03,_0x4d09a2){return new Promise(function(_0x1833da,_0x409684){var _0x148f71=[];_0x42bad4['forEach'](function(_0x3bb023){_0x148f71[_0xbf3c('0x4b')](getRemoteTag(_0x3bb023,_0x5e85ca,_0x42f3e8,_0x406b03,_0x4d09a2));});return Promise[_0xbf3c('0x4c')](_0x148f71)[_0xbf3c('0x1a')](function(_0x8f92c9){if(_0x8f92c9[_0xbf3c('0xd')]){logger[_0xbf3c('0x15')]('['+[_0x2b3c9a['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x8f92c9);var _0x103058=[];_0x8f92c9[_0xbf3c('0x2c')](function(_0x3aee4e){_0x103058[_0xbf3c('0x4b')](assignTagToIncident(_0x3aee4e,_0x5e85ca,_0x42f3e8,_0xc7e407,_0x406b03));});return Promise['all'](_0x103058)[_0xbf3c('0x1a')](function(){_0x1833da();})[_0xbf3c('0x11')](function(){_0x1833da();});}else{_0x1833da();}});});}function getTags(_0x259658,_0x6c4d87,_0x22e90f,_0x5d20b3,_0x27bfc5,_0x5c7f11){return function(_0x3ccfcc){return new Promise(function(_0x55fa27,_0x145b05){var _0x473f80=[];var _0x25fbe8=_0x5d20b3[_0xbf3c('0x4d')];if(_0x25fbe8&&_0x25fbe8[_0xbf3c('0xd')]>0x0){_0x473f80=_[_0xbf3c('0x4e')](_0x25fbe8,_0xbf3c('0x39'));}if(_0x473f80[_0xbf3c('0xd')]>0x0){return manageTags(_0x259658,_0x473f80,_0x6c4d87,_0x22e90f,_0x3ccfcc,_0x27bfc5,_0x5c7f11)[_0xbf3c('0x1a')](function(){_0x55fa27(_0x3ccfcc);});}else{_0x55fa27(_0x3ccfcc);}});};}function emit(_0x5d1220,_0x1d394c,_0x421f2b){var _0xc6d1a7=_0xbf3c('0x4f')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xbf3c('0x50');var _0xc31c7c={'uri':_0x5d1220+_0xbf3c('0x51')+_0x421f2b+_0xc6d1a7};io['to'](util[_0xbf3c('0x52')](_0xbf3c('0x53'),_0x1d394c))[_0xbf3c('0x54')](_0xbf3c('0x55'),_0xc31c7c);}exports['cs']=function(_0x3f1384,_0xd890d6,_0x5ba9ac,_0xcdaf5,_0x81ebc0,_0x1d42c0,_0x329750,_0x571adc){var _0x14b0f2={};var _0x4d457f={'user':_0x1d42c0[_0xbf3c('0x56')],'pass':_0x1d42c0[_0xbf3c('0x57')]};var _0x530adb=_0xbf3c('0x58');var _0x3d76b5=_0xbf3c('0x59');_0x1d42c0[_0xbf3c('0x5a')]=intUtil['stripTrailingSlash'](_0x1d42c0[_0xbf3c('0x5a')]);_0x1d42c0[_0xbf3c('0x5b')]=intUtil['stripTrailingSlash'](_0x1d42c0[_0xbf3c('0x5b')]);var _0x3403b5=util[_0xbf3c('0x52')](_0xbf3c('0x5c'),_0x1d42c0[_0xbf3c('0x5a')]);_0x14b0f2[_0xbf3c('0x18')]=!_['isNil'](_0xcdaf5)?_0xcdaf5[_0xbf3c('0x5d')]:null;_0x14b0f2[_0xbf3c('0x20')]=_0x1d42c0[_0xbf3c('0x5d')];_0x14b0f2[_0xbf3c('0x25')]=_0x571adc[_0xbf3c('0x31')]()==='outbound'?_0xd890d6[_0xbf3c('0x5e')]:_0xd890d6['calleridnum'];_0x14b0f2[_0xbf3c('0x5f')]=_0x571adc===_0xbf3c('0x60')||_0x571adc==='unmanaged'?'queue':_0xbf3c('0x3b');var _0x5e0ed4=util[_0xbf3c('0x52')](_0xbf3c('0x61'),_0x1d42c0[_0xbf3c('0x5b')],_0xd890d6['uniqueid'],md5(_0xd890d6[_0xbf3c('0x62')]));if(_0x81ebc0&&_0x81ebc0['monitor_format']){logger[_0xbf3c('0x15')]('[QUEUE]',_0xbf3c('0x63'));_0xd890d6[_0xbf3c('0x64')]=_0x5e0ed4;}else if(_0x329750&&_0x329750[_0xbf3c('0x65')]&&_0x329750['recordingFormat']!==_0xbf3c('0x66')){logger[_0xbf3c('0x15')](_0xbf3c('0x67'),_0xbf3c('0x63'));_0xd890d6[_0xbf3c('0x64')]=_0x5e0ed4;}else{_0xd890d6[_0xbf3c('0x64')]='';}return getAdminUser(_0x571adc,_0x4d457f,_0x14b0f2,_0x3403b5,_0x3d76b5,_0x530adb)['then'](getUser(_0x571adc,_0x4d457f,_0x3403b5,_0x3d76b5,_0x530adb))[_0xbf3c('0x1a')](getEndUser(_0x571adc,_0x4d457f,_0x3403b5,_0x3d76b5,_0x530adb))[_0xbf3c('0x1a')](getTicket(_0x571adc,_0x4d457f,_0x3403b5,_0x5ba9ac,_0xd890d6,_0x3d76b5))['then'](function(_0x16c52d){logger['info'](util[_0xbf3c('0x52')]('The\x20ticket\x20ID\x20is:\x20%s',_0x16c52d[_0xbf3c('0x42')]));logger[_0xbf3c('0x15')](util[_0xbf3c('0x52')](_0xbf3c('0x68'),_0x571adc));if(_0x571adc!==_0xbf3c('0x69')){logger[_0xbf3c('0x15')]('['+[_0x571adc[_0xbf3c('0x13')]()]+']',_0xbf3c('0x6a'));emit(_0x1d42c0['remoteUri'],_0xcdaf5[_0xbf3c('0x39')],_0x16c52d[_0xbf3c('0x42')]);}})[_0xbf3c('0x11')](function(_0x185473){logger['error']('['+[_0x571adc[_0xbf3c('0x13')]()]+_0xbf3c('0x6b'),util[_0xbf3c('0x6c')](_0x185473,{'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 4c9557e..7e2f970 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 _0x705e=['localhost','POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_name','length','forEach','push','idField','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','get_entry_list','Employees','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Contacts','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','type','string','nameField','toLowerCase','content','customField','custom_fields','variable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','users','contacts','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','%s/service/v4_1/rest.php','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','catch','unmanaged','lastevent','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults'];(function(_0x58779c,_0xe8471b){var _0x5e1897=function(_0x17ed1f){while(--_0x17ed1f){_0x58779c['push'](_0x58779c['shift']());}};_0x5e1897(++_0xe8471b);}(_0x705e,0xde));var _0xe705=function(_0x493985,_0xabbee5){_0x493985=_0x493985-0x0;var _0x532b94=_0x705e[_0x493985];return _0x532b94;};'use strict';var _=require(_0xe705('0x0'));var rp=require(_0xe705('0x1'));var BPromise=require(_0xe705('0x2'));var md5=require(_0xe705('0x3'));var util=require(_0xe705('0x4'));var Redis=require(_0xe705('0x5'));var intUtil=require(_0xe705('0x6'));var config=require(_0xe705('0x7'));var logger=require(_0xe705('0x8'))(_0xe705('0x9'));config[_0xe705('0xa')]=_[_0xe705('0xb')](config[_0xe705('0xa')],{'host':_0xe705('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe705('0xa')]));var def={'method':_0xe705('0xd'),'json':!![]};function emit(_0x9c7e9a,_0x3bd69d,_0x4db28c){io['to'](_0x9c7e9a)['emit'](_0x3bd69d,_0x4db28c);}function getTicket(_0x3eb6f8,_0x287e8f,_0x3a026b,_0x14d712,_0x114f13,_0x41b813,_0x5b0799,_0x54f411){logger[_0xe705('0xe')](_0xe705('0xf'));var _0x5b3e01=new Date();var _0x4a720e=[{'name':_0xe705('0x10'),'value':intUtil[_0xe705('0x11')](_0x14d712[_0xe705('0x12')],_0x114f13,'\x20')},{'name':_0xe705('0x13'),'value':_0x287e8f['id']},{'name':_0xe705('0x14'),'value':_0x287e8f['id']},{'name':_0xe705('0x15'),'value':intUtil['getString'](_0x14d712[_0xe705('0x16')],_0x114f13,'\x0a')},{'name':'date_start','value':_0x5b3e01[_0xe705('0x17')]()['slice'](0x0,0x13)[_0xe705('0x18')]('T','\x20')},{'name':_0xe705('0x19'),'value':'0'},{'name':_0xe705('0x1a'),'value':'15'},{'name':_0xe705('0x1b'),'value':_0x3a026b['id']},{'name':'parent_type','value':'Contacts'},{'name':_0xe705('0x1c'),'value':_0x3a026b[_0xe705('0x10')]},{'name':'direction','value':_0x54f411}];if(_0x41b813[_0xe705('0x1d')]){_[_0xe705('0x1e')](_0x41b813,function(_0x4932a0){if(_0x114f13[_0x4932a0['variableName']]){_0x4a720e[_0xe705('0x1f')]({'name':_0x4932a0[_0xe705('0x20')],'value':_0x114f13[_0x4932a0[_0xe705('0x21')]]});}});}return request({'form':{'method':_0xe705('0x22'),'input_type':_0xe705('0x23'),'response_type':_0xe705('0x23'),'rest_data':JSON[_0xe705('0x24')]({'session':_0x5b0799['id'],'module_name':_0xe705('0x25'),'name_value_list':_0x4a720e})}});}function getAuth(_0x52b428){return util[_0xe705('0x26')](_0xe705('0x27'),new Buffer(_0x52b428[_0xe705('0x28')]+':X')[_0xe705('0x29')]('base64'));}function getServerInfo(_0x44bcc2){return request({'form':{'method':_0xe705('0x2a'),'input_type':_0xe705('0x23'),'response_type':'JSON','rest_data':JSON[_0xe705('0x24')]({'session':_0x44bcc2['id']})}});}function getUser(_0x5a8b5f,_0x410bc4,_0x257af3){if(!_[_0xe705('0x2b')](_0x410bc4)){logger[_0xe705('0xe')]('Getting\x20agent\x20with\x20name',_0x410bc4);return request({'form':{'method':_0xe705('0x2c'),'input_type':_0xe705('0x23'),'response_type':_0xe705('0x23'),'rest_data':JSON[_0xe705('0x24')]({'session':_0x257af3['id'],'module_name':_0xe705('0x2d'),'query':util[_0xe705('0x26')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x410bc4),'order_by':'','offset':'0','select_fields':['id','name',_0xe705('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe705('0x2f')](function(_0x27a9b8){if(_0x27a9b8[_0xe705('0x30')][_0xe705('0x1d')]){var _0x4493d1=_[_0xe705('0x31')](_0x27a9b8[_0xe705('0x30')],function(_0x44fc3c){return _0x44fc3c[_0xe705('0x32')][_0xe705('0x2e')][_0xe705('0x33')]===_0x410bc4;});if(_0x4493d1){logger[_0xe705('0xe')](_0xe705('0x34'));return BPromise[_0xe705('0x35')]({'id':_0x4493d1[_0xe705('0x32')]['id'][_0xe705('0x33')],'name':_0x4493d1[_0xe705('0x32')][_0xe705('0x10')][_0xe705('0x33')]});}}logger[_0xe705('0xe')](_0xe705('0x36'));return BPromise[_0xe705('0x35')]({'id':_0x257af3['name_value_list']['user_id'][_0xe705('0x33')],'name':_0x257af3[_0xe705('0x32')][_0xe705('0x2e')][_0xe705('0x33')]});});}else{logger['info'](_0xe705('0x37'));return BPromise[_0xe705('0x35')]({'id':_0x257af3['name_value_list'][_0xe705('0x38')][_0xe705('0x33')],'name':_0x257af3['name_value_list'][_0xe705('0x2e')][_0xe705('0x33')]});}}function getEndUser(_0x1b34a1,_0x2ce107,_0x4f2586,_0x1fc49d){logger['info']('Searching\x20enduser\x20with\x20phone',_0x4f2586);return request({'form':{'method':_0xe705('0x2c'),'input_type':_0xe705('0x23'),'response_type':_0xe705('0x23'),'rest_data':JSON[_0xe705('0x24')]({'session':_0x1fc49d['id'],'module_name':'Contacts','query':util[_0xe705('0x26')](_0xe705('0x39'),_0x4f2586),'order_by':'','offset':'0','select_fields':['id',_0xe705('0x10'),_0xe705('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe705('0x2f')](function(_0x262486){if(_0x262486[_0xe705('0x30')]['length']){var _0x51c59f=_[_0xe705('0x31')](_0x262486[_0xe705('0x30')],function(_0x44ff30){return _0x44ff30[_0xe705('0x32')]['phone_home'][_0xe705('0x33')]===_0x4f2586;});if(_0x51c59f){logger[_0xe705('0xe')]('Enduser\x20found!');return BPromise[_0xe705('0x35')]({'id':_0x51c59f[_0xe705('0x32')]['id'][_0xe705('0x33')],'name':_0x51c59f['name_value_list'][_0xe705('0x10')]['value'],'phone':_0x51c59f[_0xe705('0x32')][_0xe705('0x3a')][_0xe705('0x33')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xe705('0x22'),'input_type':_0xe705('0x23'),'response_type':_0xe705('0x23'),'rest_data':JSON[_0xe705('0x24')]({'session':_0x1fc49d['id'],'module_name':_0xe705('0x3b'),'name_value_list':[{'name':'first_name','value':_0x2ce107!==''?_0x2ce107:util[_0xe705('0x26')](_0xe705('0x3c'),_0x4f2586)},{'name':_0xe705('0x3a'),'value':_0x4f2586}]})}})['then'](function(_0x135cf8){logger[_0xe705('0xe')](_0xe705('0x3d'));return BPromise['resolve']({'id':_0x135cf8['id'],'name':_0x135cf8['entry_list']['first_name'][_0xe705('0x33')],'phone':_0x135cf8[_0xe705('0x30')][_0xe705('0x3a')][_0xe705('0x33')]});});}});}function request(_0x1f5069){logger[_0xe705('0x3e')]('[HTTP]',JSON[_0xe705('0x24')](_0x1f5069));return rp(_[_0xe705('0x3f')](def,_0x1f5069));}function getTags(_0x414a54,_0x117b4e){var _0x298d72=[];if(_0x414a54&&_0x414a54[_0xe705('0x1d')]>0x0){_0x298d72=_[_0xe705('0x40')](_0x414a54,_0x117b4e);}return _0x298d72;}function getCustomFields(_0x418db1,_0x31cfe3){var _0x2febc9=[];var _0x1977e3={'custom_fields':[]};if(_0x418db1[_0xe705('0x1d')]>0x0){_[_0xe705('0x1e')](_0x418db1,function(_0x3fa3c0){if(_0x3fa3c0[_0xe705('0x41')]===_0xe705('0x42')&&_0x3fa3c0[_0xe705('0x43')]&&!_0x3fa3c0['customField']){_0x1977e3[_0x3fa3c0[_0xe705('0x43')][_0xe705('0x44')]()]=_0x3fa3c0[_0xe705('0x45')][_0xe705('0x29')]();}else if(_0x3fa3c0[_0xe705('0x41')]===_0xe705('0x42')&&_0x3fa3c0[_0xe705('0x20')]&&_0x3fa3c0[_0xe705('0x46')]){_0x1977e3[_0xe705('0x47')]['push']({'id':_0x3fa3c0[_0xe705('0x20')],'value':_0x3fa3c0['content'][_0xe705('0x29')]()});}else if(_0x3fa3c0['type']===_0xe705('0x48')&&_0x3fa3c0[_0xe705('0x21')]&&_0x3fa3c0[_0xe705('0x20')]&&_0x3fa3c0[_0xe705('0x46')]){_0x31cfe3[_0x3fa3c0['variableName']]&&_0x1977e3[_0xe705('0x47')][_0xe705('0x1f')]({'id':_0x3fa3c0[_0xe705('0x20')],'value':_0x31cfe3[_0x3fa3c0[_0xe705('0x21')]][_0xe705('0x29')]()});}else if(_0x3fa3c0[_0xe705('0x41')]==='customVariable'&&_0x3fa3c0[_0xe705('0x49')]&&_0x3fa3c0[_0xe705('0x49')]['name']&&_0x3fa3c0['idField']&&_0x3fa3c0[_0xe705('0x46')]){_0x31cfe3[_0x3fa3c0['Variable'][_0xe705('0x10')][_0xe705('0x44')]()]&&_0x1977e3[_0xe705('0x47')]['push']({'id':_0x3fa3c0['idField'],'value':_0x31cfe3[_0x3fa3c0[_0xe705('0x49')]['name'][_0xe705('0x44')]()][_0xe705('0x29')]()});}});}return _0x1977e3;}function getConnection(_0x2c9a06){return request({'method':_0xe705('0xd'),'form':{'method':_0xe705('0x4a'),'input_type':_0xe705('0x23'),'response_type':_0xe705('0x23'),'rest_data':JSON[_0xe705('0x24')]({'user_auth':{'user_name':_0x2c9a06['username'],'password':_0x2c9a06[_0xe705('0x4b')],'encryption':_0xe705('0x4c')},'application':_0xe705('0x4d')})}})['then'](function(_0x8edcb8){var _0x4457ff=_0x8edcb8;if(_0x4457ff['id']){def['sessionID']=_0x4457ff['id'];return BPromise[_0xe705('0x35')](_0x4457ff);}else{throw new Error(util['format'](_0xe705('0x4e'),_0x2c9a06['id']));}});}function setRelationship(_0xa4c19,_0x4ab980,_0x2f416d,_0xfb4e88){return request({'form':{'method':_0xe705('0x4f'),'input_type':_0xe705('0x23'),'response_type':_0xe705('0x23'),'rest_data':JSON[_0xe705('0x24')]({'session':_0xa4c19['id'],'module_name':_0xe705('0x25'),'module_id':_0x2f416d['id'],'link_field_name':_0xfb4e88,'related_ids':[_0x4ab980['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x3d1c1a,_0x2e5f28,_0x3ae2ce,_0x2634d4,_0xf8375,_0x276537){var _0x14cd8b,_0x1ca7b3,_0x56a37b,_0x1df3f9;_0x276537[_0xe705('0x50')]=intUtil['stripTrailingSlash'](_0x276537[_0xe705('0x50')]);_0x276537['serverUrl']=intUtil[_0xe705('0x51')](_0x276537['serverUrl']);def[_0xe705('0x52')]=util[_0xe705('0x26')]('%s/service/v4_1/rest.php',_0x276537['remoteUri']);if(_0xf8375&&_0xf8375[_0xe705('0x53')]){logger[_0xe705('0xe')](_0xe705('0x54'),_0xe705('0x55'));_0x2e5f28['recordingURL']=util[_0xe705('0x26')](_0xe705('0x56'),_0x276537[_0xe705('0x57')],_0x2e5f28[_0xe705('0x58')],md5(_0x2e5f28['uniqueid']));}else{_0x2e5f28[_0xe705('0x59')]='';}return getConnection(_0x276537)['then'](function(_0x5ac503){_0x1df3f9=_0x5ac503;return getUser(_0x276537,_0x2634d4[_0xe705('0x10')],_0x1df3f9);})['then'](function(_0x457dcd){_0x14cd8b=_0x457dcd;logger[_0xe705('0xe')](_0xe705('0x5a'),_0x14cd8b['id']);return getEndUser(_0x276537,_0x2e5f28[_0xe705('0x5b')],_0x2e5f28[_0xe705('0x5c')],_0x1df3f9);})[_0xe705('0x2f')](function(_0x43e786){_0x1ca7b3=_0x43e786;logger[_0xe705('0xe')](_0xe705('0x5d'),_0x1ca7b3['id']);return getTicket(_0x276537,_0x14cd8b,_0x1ca7b3,_0x3ae2ce,_0x2e5f28,_0x3ae2ce[_0xe705('0x5e')],_0x1df3f9,_0xe705('0x5f'));})['then'](function(_0x406182){_0x56a37b=_0x406182;logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x56a37b['id']);return setRelationship(_0x1df3f9,_0x14cd8b,_0x56a37b,_0xe705('0x60'));})[_0xe705('0x2f')](function(){return setRelationship(_0x1df3f9,_0x1ca7b3,_0x56a37b,_0xe705('0x61'));})[_0xe705('0x2f')](function(){return getServerInfo(_0x1df3f9);})[_0xe705('0x2f')](function(_0x2af6af){var _0x375566=parseInt(_0x2af6af['version'][_0xe705('0x62')](0x0));var _0x495e75=util[_0xe705('0x26')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x276537[_0xe705('0x50')],_0x56a37b['id']);if(_0x375566>0x6){_0x495e75=util['format'](_0xe705('0x63'),_0x276537['remoteUri'],_0x56a37b['id']);}logger[_0xe705('0xe')](_0xe705('0x54'),_0xe705('0x64'));emit(util[_0xe705('0x26')](_0xe705('0x65'),_0x2634d4[_0xe705('0x10')]),_0xe705('0x66'),{'uri':_0x495e75});})['catch'](function(_0x23db21){logger[_0xe705('0x67')](_0xe705('0x54'),JSON[_0xe705('0x24')](_0x23db21));});};exports['outbound']=function(_0x532ce7,_0x17fe4a,_0x58e359,_0x845d46,_0xb0ca88,_0x4378f3,_0x591b20){var _0x82265,_0x29c6ae,_0xaa7242,_0x458b3c;_0x4378f3['remoteUri']=intUtil[_0xe705('0x51')](_0x4378f3['remoteUri']);_0x4378f3[_0xe705('0x57')]=intUtil[_0xe705('0x51')](_0x4378f3[_0xe705('0x57')]);def[_0xe705('0x52')]=util[_0xe705('0x26')](_0xe705('0x68'),_0x4378f3[_0xe705('0x50')]);if(_0x591b20&&_0x591b20[_0xe705('0x69')]&&_0x591b20[_0xe705('0x69')]!=='none'){logger['info'](_0xe705('0x6a'),_0xe705('0x55'));_0x17fe4a['recordingURL']=util[_0xe705('0x26')](_0xe705('0x56'),_0x4378f3['serverUrl'],_0x17fe4a['uniqueid'],md5(_0x17fe4a[_0xe705('0x58')]));}return getConnection(_0x4378f3)[_0xe705('0x2f')](function(_0x48909e){_0x458b3c=_0x48909e;return getUser(_0x4378f3,_0x845d46['name'],_0x458b3c);})[_0xe705('0x2f')](function(_0x50d9e5){_0x82265=_0x50d9e5;logger[_0xe705('0xe')](_0xe705('0x5a'),_0x82265['id']);return getEndUser(_0x4378f3,_0x17fe4a[_0xe705('0x6b')],_0x17fe4a[_0xe705('0x6c')],_0x458b3c);})['then'](function(_0x4998db){_0x29c6ae=_0x4998db;logger[_0xe705('0xe')](_0xe705('0x5d'),_0x29c6ae['id']);return getTicket(_0x4378f3,_0x82265,_0x29c6ae,_0x58e359,_0x17fe4a,_0x58e359[_0xe705('0x5e')],_0x458b3c,_0xe705('0x6d'));})[_0xe705('0x2f')](function(_0x26eb1d){_0xaa7242=_0x26eb1d;logger[_0xe705('0xe')](_0xe705('0x6e'));logger[_0xe705('0xe')](_0xe705('0x6f'),_0xaa7242['id']);return setRelationship(_0x458b3c,_0x82265,_0xaa7242,'users');})[_0xe705('0x2f')](function(){return setRelationship(_0x458b3c,_0x29c6ae,_0xaa7242,_0xe705('0x61'));})['then'](function(){return getServerInfo(_0x458b3c);})[_0xe705('0x2f')](function(_0xa63ea1){var _0x196801=parseInt(_0xa63ea1[_0xe705('0x70')][_0xe705('0x62')](0x0));var _0x1e05dc=util[_0xe705('0x26')](_0xe705('0x71'),_0x4378f3[_0xe705('0x50')],_0xaa7242['id']);if(_0x196801>0x6){_0x1e05dc=util[_0xe705('0x26')](_0xe705('0x63'),_0x4378f3[_0xe705('0x50')],_0xaa7242['id']);}logger[_0xe705('0xe')]('[OUTBOUND]',_0xe705('0x64'));emit(util['format'](_0xe705('0x65'),_0x845d46[_0xe705('0x10')]),_0xe705('0x66'),{'uri':_0x1e05dc});})[_0xe705('0x72')](function(_0x4abdf3){logger[_0xe705('0x67')](_0xe705('0x6a'),JSON[_0xe705('0x24')](_0x4abdf3));});};exports[_0xe705('0x73')]=function(_0x5604e0,_0x19728d,_0xb363c5,_0x1b60c0,_0x5f9319,_0x32913c){var _0x150f92,_0x32a2bf,_0x2d6978,_0xd5eb6d;_0x32913c[_0xe705('0x50')]=intUtil[_0xe705('0x51')](_0x32913c[_0xe705('0x50')]);_0x32913c[_0xe705('0x57')]=intUtil[_0xe705('0x51')](_0x32913c[_0xe705('0x57')]);def[_0xe705('0x52')]=util['format'](_0xe705('0x68'),_0x32913c[_0xe705('0x50')]);if(_0x5f9319&&_0x5f9319[_0xe705('0x53')]){logger[_0xe705('0xe')]('['+_0x19728d[_0xe705('0x74')]['toUpperCase']()+']',_0xe705('0x55'));_0x19728d[_0xe705('0x59')]=util[_0xe705('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32913c[_0xe705('0x57')],_0x19728d[_0xe705('0x58')],md5(_0x19728d[_0xe705('0x58')]));}else{_0x19728d[_0xe705('0x59')]='';}return getConnection(_0x32913c)[_0xe705('0x2f')](function(_0x539871){_0xd5eb6d=_0x539871;if(!_[_0xe705('0x2b')](_0x1b60c0)){return getUser(_0x32913c,_0x1b60c0[_0xe705('0x10')],_0xd5eb6d);}else{return getUser(_0x32913c,null,_0xd5eb6d);}})[_0xe705('0x2f')](function(_0x2612a2){_0x150f92=_0x2612a2;logger[_0xe705('0xe')](_0xe705('0x5a'),_0x150f92['id']);return getEndUser(_0x32913c,_0x19728d[_0xe705('0x5b')],_0x19728d[_0xe705('0x5c')],_0xd5eb6d);})['then'](function(_0x16fe5d){_0x32a2bf=_0x16fe5d;logger[_0xe705('0xe')](_0xe705('0x5d'),_0x32a2bf['id']);return getTicket(_0x32913c,_0x150f92,_0x32a2bf,_0xb363c5,_0x19728d,_0xb363c5[_0xe705('0x5e')],_0xd5eb6d,_0xe705('0x5f'));})[_0xe705('0x2f')](function(_0x1151e0){_0x2d6978=_0x1151e0;logger['info'](_0xe705('0x6e'));logger['info'](_0xe705('0x6f'),_0x2d6978['id']);return setRelationship(_0xd5eb6d,_0x150f92,_0x2d6978,_0xe705('0x60'));})[_0xe705('0x2f')](function(){return setRelationship(_0xd5eb6d,_0x32a2bf,_0x2d6978,_0xe705('0x61'));})[_0xe705('0x2f')](function(){return getServerInfo(_0xd5eb6d);})[_0xe705('0x72')](function(_0x3c103c){logger[_0xe705('0x67')]('['+_0x19728d[_0xe705('0x74')]['toUpperCase']()+']',JSON['stringify'](_0x3c103c));});}; \ No newline at end of file +var _0x78a0=['unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','isNil','The\x20Enduser\x20ID\x20is:','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','slice','replace','duration_hours','parent_type','Contacts','direction','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','length','find','resolve','value','user_id','name_value_list','user_name','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!','set_entry','Enduser\x20created.','first_name','[HTTP]','map','forEach','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','destcalleridname','destcalleridnum','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]'];(function(_0x189875,_0x2151e){var _0x28e01d=function(_0x2068d2){while(--_0x2068d2){_0x189875['push'](_0x189875['shift']());}};_0x28e01d(++_0x2151e);}(_0x78a0,0x1e6));var _0x078a=function(_0x4e6913,_0xba423b){_0x4e6913=_0x4e6913-0x0;var _0x9ef2ad=_0x78a0[_0x4e6913];return _0x9ef2ad;};'use strict';var _=require('lodash');var rp=require(_0x078a('0x0'));var BPromise=require(_0x078a('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x078a('0x2'));var intUtil=require('./util');var config=require(_0x078a('0x3'));var logger=require(_0x078a('0x4'))(_0x078a('0x5'));config['redis']=_[_0x078a('0x6')](config[_0x078a('0x7')],{'host':_0x078a('0x8'),'port':0x18eb});var io=require(_0x078a('0x9'))(new Redis(config[_0x078a('0x7')]));var def={'method':_0x078a('0xa'),'json':!![]};function emit(_0x4c1507,_0xc7a747,_0xa01a11){io['to'](_0x4c1507)['emit'](_0xc7a747,_0xa01a11);}function getTicket(_0x35dde1,_0x348419,_0x1ff1f1,_0x1e8491,_0x50ed64,_0x31f532,_0x4638b2,_0x5a6c38){logger['info']('Creating\x20new\x20ticket...');var _0x34b410=new Date();var _0x17ef81=[{'name':_0x078a('0xb'),'value':intUtil[_0x078a('0xc')](_0x1e8491[_0x078a('0xd')],_0x50ed64,'\x20')},{'name':_0x078a('0xe'),'value':_0x348419['id']},{'name':_0x078a('0xf'),'value':_0x348419['id']},{'name':_0x078a('0x10'),'value':intUtil['getString'](_0x1e8491[_0x078a('0x11')],_0x50ed64,'\x0a')},{'name':_0x078a('0x12'),'value':_0x34b410['toISOString']()[_0x078a('0x13')](0x0,0x13)[_0x078a('0x14')]('T','\x20')},{'name':_0x078a('0x15'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x1ff1f1['id']},{'name':_0x078a('0x16'),'value':_0x078a('0x17')},{'name':'parent_name','value':_0x1ff1f1[_0x078a('0xb')]},{'name':_0x078a('0x18'),'value':_0x5a6c38}];if(_0x31f532['length']){_['forEach'](_0x31f532,function(_0xb7f8b9){if(_0x50ed64[_0xb7f8b9[_0x078a('0x19')]]){_0x17ef81[_0x078a('0x1a')]({'name':_0xb7f8b9[_0x078a('0x1b')],'value':_0x50ed64[_0xb7f8b9[_0x078a('0x19')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x078a('0x1c'),'response_type':_0x078a('0x1c'),'rest_data':JSON[_0x078a('0x1d')]({'session':_0x4638b2['id'],'module_name':_0x078a('0x1e'),'name_value_list':_0x17ef81})}});}function getAuth(_0x2cdb43){return util[_0x078a('0x1f')](_0x078a('0x20'),new Buffer(_0x2cdb43[_0x078a('0x21')]+':X')[_0x078a('0x22')](_0x078a('0x23')));}function getServerInfo(_0x52c986){return request({'form':{'method':_0x078a('0x24'),'input_type':_0x078a('0x1c'),'response_type':_0x078a('0x1c'),'rest_data':JSON[_0x078a('0x1d')]({'session':_0x52c986['id']})}});}function getUser(_0x6085d9,_0x5249a0,_0x2625a9){if(!_['isNil'](_0x5249a0)){logger[_0x078a('0x25')](_0x078a('0x26'),_0x5249a0);return request({'form':{'method':_0x078a('0x27'),'input_type':_0x078a('0x1c'),'response_type':_0x078a('0x1c'),'rest_data':JSON[_0x078a('0x1d')]({'session':_0x2625a9['id'],'module_name':_0x078a('0x28'),'query':util[_0x078a('0x1f')](_0x078a('0x29'),_0x5249a0),'order_by':'','offset':'0','select_fields':['id',_0x078a('0xb'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x078a('0x2a')](function(_0x157f96){if(_0x157f96[_0x078a('0x2b')][_0x078a('0x2c')]){var _0x253254=_[_0x078a('0x2d')](_0x157f96[_0x078a('0x2b')],function(_0x4786f1){return _0x4786f1['name_value_list']['user_name']['value']===_0x5249a0;});if(_0x253254){logger[_0x078a('0x25')]('Agent\x20found!');return BPromise[_0x078a('0x2e')]({'id':_0x253254['name_value_list']['id'][_0x078a('0x2f')],'name':_0x253254['name_value_list'][_0x078a('0xb')][_0x078a('0x2f')]});}}logger[_0x078a('0x25')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x078a('0x2e')]({'id':_0x2625a9['name_value_list'][_0x078a('0x30')]['value'],'name':_0x2625a9[_0x078a('0x31')][_0x078a('0x32')][_0x078a('0x2f')]});});}else{logger[_0x078a('0x25')](_0x078a('0x33'));return BPromise[_0x078a('0x2e')]({'id':_0x2625a9['name_value_list'][_0x078a('0x30')][_0x078a('0x2f')],'name':_0x2625a9[_0x078a('0x31')][_0x078a('0x32')][_0x078a('0x2f')]});}}function getEndUser(_0x243dbb,_0x31deb2,_0x18f8d,_0x3e0615){logger['info'](_0x078a('0x34'),_0x18f8d);return request({'form':{'method':'get_entry_list','input_type':_0x078a('0x1c'),'response_type':_0x078a('0x1c'),'rest_data':JSON[_0x078a('0x1d')]({'session':_0x3e0615['id'],'module_name':_0x078a('0x17'),'query':util[_0x078a('0x1f')](_0x078a('0x35'),_0x18f8d),'order_by':'','offset':'0','select_fields':['id','name',_0x078a('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x078a('0x2a')](function(_0x1825cb){if(_0x1825cb[_0x078a('0x2b')][_0x078a('0x2c')]){var _0x4a08aa=_[_0x078a('0x2d')](_0x1825cb['entry_list'],function(_0x4e625a){return _0x4e625a[_0x078a('0x31')]['phone_home']['value']===_0x18f8d;});if(_0x4a08aa){logger[_0x078a('0x25')](_0x078a('0x37'));return BPromise[_0x078a('0x2e')]({'id':_0x4a08aa[_0x078a('0x31')]['id'][_0x078a('0x2f')],'name':_0x4a08aa[_0x078a('0x31')][_0x078a('0xb')][_0x078a('0x2f')],'phone':_0x4a08aa[_0x078a('0x31')]['phone_home'][_0x078a('0x2f')]});}}else{logger[_0x078a('0x25')](_0x078a('0x38'));return request({'form':{'method':_0x078a('0x39'),'input_type':_0x078a('0x1c'),'response_type':_0x078a('0x1c'),'rest_data':JSON[_0x078a('0x1d')]({'session':_0x3e0615['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x31deb2!==''?_0x31deb2:util[_0x078a('0x1f')]('Caller\x20-\x20%s',_0x18f8d)},{'name':_0x078a('0x36'),'value':_0x18f8d}]})}})['then'](function(_0x18ab8d){logger[_0x078a('0x25')](_0x078a('0x3a'));return BPromise[_0x078a('0x2e')]({'id':_0x18ab8d['id'],'name':_0x18ab8d[_0x078a('0x2b')][_0x078a('0x3b')][_0x078a('0x2f')],'phone':_0x18ab8d['entry_list'][_0x078a('0x36')][_0x078a('0x2f')]});});}});}function request(_0x530134){logger['debug'](_0x078a('0x3c'),JSON[_0x078a('0x1d')](_0x530134));return rp(_['merge'](def,_0x530134));}function getTags(_0x57a803,_0x328bf0){var _0x3c4d3f=[];if(_0x57a803&&_0x57a803[_0x078a('0x2c')]>0x0){_0x3c4d3f=_[_0x078a('0x3d')](_0x57a803,_0x328bf0);}return _0x3c4d3f;}function getCustomFields(_0x158ec8,_0x4f7a49){var _0x2bd60a=[];var _0x5887dd={'custom_fields':[]};if(_0x158ec8[_0x078a('0x2c')]>0x0){_[_0x078a('0x3e')](_0x158ec8,function(_0x787a1a){if(_0x787a1a[_0x078a('0x3f')]===_0x078a('0x40')&&_0x787a1a[_0x078a('0x41')]&&!_0x787a1a[_0x078a('0x42')]){_0x5887dd[_0x787a1a[_0x078a('0x41')][_0x078a('0x43')]()]=_0x787a1a[_0x078a('0x44')][_0x078a('0x22')]();}else if(_0x787a1a[_0x078a('0x3f')]===_0x078a('0x40')&&_0x787a1a[_0x078a('0x1b')]&&_0x787a1a[_0x078a('0x42')]){_0x5887dd[_0x078a('0x45')][_0x078a('0x1a')]({'id':_0x787a1a[_0x078a('0x1b')],'value':_0x787a1a['content'][_0x078a('0x22')]()});}else if(_0x787a1a[_0x078a('0x3f')]===_0x078a('0x46')&&_0x787a1a[_0x078a('0x19')]&&_0x787a1a[_0x078a('0x1b')]&&_0x787a1a[_0x078a('0x42')]){_0x4f7a49[_0x787a1a['variableName']]&&_0x5887dd[_0x078a('0x45')]['push']({'id':_0x787a1a[_0x078a('0x1b')],'value':_0x4f7a49[_0x787a1a[_0x078a('0x19')]][_0x078a('0x22')]()});}else if(_0x787a1a['type']===_0x078a('0x47')&&_0x787a1a[_0x078a('0x48')]&&_0x787a1a[_0x078a('0x48')][_0x078a('0xb')]&&_0x787a1a[_0x078a('0x1b')]&&_0x787a1a[_0x078a('0x42')]){_0x4f7a49[_0x787a1a[_0x078a('0x48')]['name'][_0x078a('0x43')]()]&&_0x5887dd[_0x078a('0x45')][_0x078a('0x1a')]({'id':_0x787a1a[_0x078a('0x1b')],'value':_0x4f7a49[_0x787a1a[_0x078a('0x48')][_0x078a('0xb')][_0x078a('0x43')]()][_0x078a('0x22')]()});}});}return _0x5887dd;}function getConnection(_0x429667){return request({'method':'POST','form':{'method':_0x078a('0x49'),'input_type':_0x078a('0x1c'),'response_type':'JSON','rest_data':JSON[_0x078a('0x1d')]({'user_auth':{'user_name':_0x429667[_0x078a('0x4a')],'password':_0x429667[_0x078a('0x4b')],'encryption':_0x078a('0x4c')},'application':_0x078a('0x4d')})}})[_0x078a('0x2a')](function(_0x448555){var _0x2a09c8=_0x448555;if(_0x2a09c8['id']){def[_0x078a('0x4e')]=_0x2a09c8['id'];return BPromise['resolve'](_0x2a09c8);}else{throw new Error(util[_0x078a('0x1f')]('Account\x20%d\x20is\x20not\x20valid',_0x429667['id']));}});}function setRelationship(_0x454b47,_0x5c04cc,_0x1ec7b9,_0x451b86){return request({'form':{'method':_0x078a('0x4f'),'input_type':_0x078a('0x1c'),'response_type':_0x078a('0x1c'),'rest_data':JSON[_0x078a('0x1d')]({'session':_0x454b47['id'],'module_name':_0x078a('0x1e'),'module_id':_0x1ec7b9['id'],'link_field_name':_0x451b86,'related_ids':[_0x5c04cc['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x078a('0x50')]=function(_0x350202,_0x2a7584,_0x273afa,_0x124270,_0x5aaf14,_0x3baf47){var _0x30eca2,_0x595cd4,_0x1645b7,_0x43aec4;_0x3baf47[_0x078a('0x51')]=intUtil['stripTrailingSlash'](_0x3baf47['remoteUri']);_0x3baf47[_0x078a('0x52')]=intUtil[_0x078a('0x53')](_0x3baf47['serverUrl']);def[_0x078a('0x54')]=util[_0x078a('0x1f')]('%s/service/v4_1/rest.php',_0x3baf47[_0x078a('0x51')]);if(_0x5aaf14&&_0x5aaf14[_0x078a('0x55')]){logger[_0x078a('0x25')](_0x078a('0x56'),_0x078a('0x57'));_0x2a7584['recordingURL']=util[_0x078a('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3baf47[_0x078a('0x52')],_0x2a7584[_0x078a('0x58')],md5(_0x2a7584['uniqueid']));}else{_0x2a7584[_0x078a('0x59')]='';}return getConnection(_0x3baf47)[_0x078a('0x2a')](function(_0x16e5c3){_0x43aec4=_0x16e5c3;return getUser(_0x3baf47,_0x124270['name'],_0x43aec4);})[_0x078a('0x2a')](function(_0x4563f4){_0x30eca2=_0x4563f4;logger[_0x078a('0x25')](_0x078a('0x5a'),_0x30eca2['id']);return getEndUser(_0x3baf47,_0x2a7584[_0x078a('0x5b')],_0x2a7584[_0x078a('0x5c')],_0x43aec4);})[_0x078a('0x2a')](function(_0x57be89){_0x595cd4=_0x57be89;logger['info']('The\x20Enduser\x20ID\x20is:',_0x595cd4['id']);return getTicket(_0x3baf47,_0x30eca2,_0x595cd4,_0x273afa,_0x2a7584,_0x273afa[_0x078a('0x5d')],_0x43aec4,_0x078a('0x5e'));})[_0x078a('0x2a')](function(_0x38ea2b){_0x1645b7=_0x38ea2b;logger[_0x078a('0x25')](_0x078a('0x5f'));logger['info'](_0x078a('0x60'),_0x1645b7['id']);return setRelationship(_0x43aec4,_0x30eca2,_0x1645b7,_0x078a('0x61'));})['then'](function(){return setRelationship(_0x43aec4,_0x595cd4,_0x1645b7,_0x078a('0x62'));})['then'](function(){return getServerInfo(_0x43aec4);})[_0x078a('0x2a')](function(_0x9969d3){var _0x71b1c9=parseInt(_0x9969d3['version'][_0x078a('0x63')](0x0));var _0x5df3aa=util[_0x078a('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3baf47[_0x078a('0x51')],_0x1645b7['id']);if(_0x71b1c9>0x6){_0x5df3aa=util[_0x078a('0x1f')](_0x078a('0x64'),_0x3baf47[_0x078a('0x51')],_0x1645b7['id']);}logger[_0x078a('0x25')](_0x078a('0x56'),_0x078a('0x65'));emit(util['format'](_0x078a('0x66'),_0x124270[_0x078a('0xb')]),_0x078a('0x67'),{'uri':_0x5df3aa});})[_0x078a('0x68')](function(_0xfabbdc){logger[_0x078a('0x69')](_0x078a('0x56'),JSON[_0x078a('0x1d')](_0xfabbdc));});};exports[_0x078a('0x6a')]=function(_0x1dccc7,_0x418904,_0x4b0dbc,_0x5b5c58,_0x4eae09,_0x3f809b,_0x325c1c){var _0x3e171f,_0x3f9280,_0x2705d9,_0x57021;_0x3f809b['remoteUri']=intUtil['stripTrailingSlash'](_0x3f809b['remoteUri']);_0x3f809b['serverUrl']=intUtil[_0x078a('0x53')](_0x3f809b[_0x078a('0x52')]);def[_0x078a('0x54')]=util['format'](_0x078a('0x6b'),_0x3f809b['remoteUri']);if(_0x325c1c&&_0x325c1c[_0x078a('0x6c')]&&_0x325c1c['recordingFormat']!=='none'){logger[_0x078a('0x25')]('[OUTBOUND]',_0x078a('0x57'));_0x418904[_0x078a('0x59')]=util[_0x078a('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f809b[_0x078a('0x52')],_0x418904[_0x078a('0x58')],md5(_0x418904[_0x078a('0x58')]));}return getConnection(_0x3f809b)['then'](function(_0xd9d9fc){_0x57021=_0xd9d9fc;return getUser(_0x3f809b,_0x5b5c58[_0x078a('0xb')],_0x57021);})['then'](function(_0x334535){_0x3e171f=_0x334535;logger['info'](_0x078a('0x5a'),_0x3e171f['id']);return getEndUser(_0x3f809b,_0x418904[_0x078a('0x6d')],_0x418904[_0x078a('0x6e')],_0x57021);})[_0x078a('0x2a')](function(_0x799677){_0x3f9280=_0x799677;logger[_0x078a('0x25')]('The\x20Enduser\x20ID\x20is:',_0x3f9280['id']);return getTicket(_0x3f809b,_0x3e171f,_0x3f9280,_0x4b0dbc,_0x418904,_0x4b0dbc[_0x078a('0x5d')],_0x57021,_0x078a('0x6f'));})[_0x078a('0x2a')](function(_0x5f571f){_0x2705d9=_0x5f571f;logger[_0x078a('0x25')](_0x078a('0x5f'));logger[_0x078a('0x25')](_0x078a('0x60'),_0x2705d9['id']);return setRelationship(_0x57021,_0x3e171f,_0x2705d9,_0x078a('0x61'));})['then'](function(){return setRelationship(_0x57021,_0x3f9280,_0x2705d9,_0x078a('0x62'));})['then'](function(){return getServerInfo(_0x57021);})[_0x078a('0x2a')](function(_0x3843ca){var _0x2921a6=parseInt(_0x3843ca['version'][_0x078a('0x63')](0x0));var _0xec5c2a=util[_0x078a('0x1f')](_0x078a('0x70'),_0x3f809b[_0x078a('0x51')],_0x2705d9['id']);if(_0x2921a6>0x6){_0xec5c2a=util[_0x078a('0x1f')](_0x078a('0x64'),_0x3f809b[_0x078a('0x51')],_0x2705d9['id']);}logger[_0x078a('0x25')](_0x078a('0x71'),_0x078a('0x65'));emit(util['format']('user:%s',_0x5b5c58['name']),_0x078a('0x67'),{'uri':_0xec5c2a});})[_0x078a('0x68')](function(_0x2983ce){logger[_0x078a('0x69')](_0x078a('0x71'),JSON[_0x078a('0x1d')](_0x2983ce));});};exports[_0x078a('0x72')]=function(_0x1d0211,_0x4e09d4,_0x1d2c26,_0x153af7,_0x48dd5c,_0x57e044){var _0x3fff82,_0x55922d,_0x271980,_0x196397;_0x57e044[_0x078a('0x51')]=intUtil[_0x078a('0x53')](_0x57e044[_0x078a('0x51')]);_0x57e044[_0x078a('0x52')]=intUtil['stripTrailingSlash'](_0x57e044[_0x078a('0x52')]);def['uri']=util[_0x078a('0x1f')](_0x078a('0x6b'),_0x57e044[_0x078a('0x51')]);if(_0x48dd5c&&_0x48dd5c['monitor_format']){logger['info']('['+_0x4e09d4[_0x078a('0x73')][_0x078a('0x74')]()+']',_0x078a('0x57'));_0x4e09d4[_0x078a('0x59')]=util['format'](_0x078a('0x75'),_0x57e044[_0x078a('0x52')],_0x4e09d4['uniqueid'],md5(_0x4e09d4[_0x078a('0x58')]));}else{_0x4e09d4['recordingURL']='';}return getConnection(_0x57e044)[_0x078a('0x2a')](function(_0x58b4a2){_0x196397=_0x58b4a2;if(!_[_0x078a('0x76')](_0x153af7)){return getUser(_0x57e044,_0x153af7[_0x078a('0xb')],_0x196397);}else{return getUser(_0x57e044,null,_0x196397);}})[_0x078a('0x2a')](function(_0x180b0a){_0x3fff82=_0x180b0a;logger[_0x078a('0x25')]('The\x20User\x20ID\x20is:',_0x3fff82['id']);return getEndUser(_0x57e044,_0x4e09d4[_0x078a('0x5b')],_0x4e09d4[_0x078a('0x5c')],_0x196397);})[_0x078a('0x2a')](function(_0x35dfde){_0x55922d=_0x35dfde;logger[_0x078a('0x25')](_0x078a('0x77'),_0x55922d['id']);return getTicket(_0x57e044,_0x3fff82,_0x55922d,_0x1d2c26,_0x4e09d4,_0x1d2c26[_0x078a('0x5d')],_0x196397,'Inbound');})['then'](function(_0x1e929f){_0x271980=_0x1e929f;logger[_0x078a('0x25')](_0x078a('0x5f'));logger[_0x078a('0x25')]('The\x20Ticket\x20ID\x20is:',_0x271980['id']);return setRelationship(_0x196397,_0x3fff82,_0x271980,'users');})[_0x078a('0x2a')](function(){return setRelationship(_0x196397,_0x55922d,_0x271980,_0x078a('0x62'));})[_0x078a('0x2a')](function(){return getServerInfo(_0x196397);})[_0x078a('0x68')](function(_0xb2f584){logger[_0x078a('0x69')]('['+_0x4e09d4[_0x078a('0x73')][_0x078a('0x74')]()+']',JSON[_0x078a('0x1d')](_0xb2f584));});}; \ 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 9844f87..abed383 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 _0xa3c1=['type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','slice','substring','validateEmail','isNil','test','lodash','util','length','sortBy'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xa3c1,0x64));var _0x1a3c=function(_0x43330d,_0x506a54){_0x43330d=_0x43330d-0x0;var _0xf23c61=_0xa3c1[_0x43330d];return _0xf23c61;};'use strict';var _=require(_0x1a3c('0x0'));var util=require(_0x1a3c('0x1'));exports['getString']=function(_0x49eb88,_0x48fe5a,_0x34088c){var _0x290fec=[];if(_0x49eb88[_0x1a3c('0x2')]>0x0){var _0x150d27=_[_0x1a3c('0x3')](_0x49eb88,['id']);for(var _0x3624dc=0x0;_0x3624dc<_0x150d27[_0x1a3c('0x2')];_0x3624dc++){var _0x334651=_0x150d27[_0x3624dc];if(_0x334651[_0x1a3c('0x4')]===_0x1a3c('0x5')){_0x290fec[_0x1a3c('0x6')](_0x334651[_0x1a3c('0x7')]);}else if(_0x334651[_0x1a3c('0x4')]===_0x1a3c('0x8')&&_0x334651[_0x1a3c('0x9')]){_0x48fe5a[_0x334651[_0x1a3c('0x9')]]&&_0x290fec[_0x1a3c('0x6')](_0x48fe5a[_0x334651[_0x1a3c('0x9')]][_0x1a3c('0xa')]());}else if(_0x334651[_0x1a3c('0x4')]===_0x1a3c('0xb')&&_0x334651['Variable']&&_0x334651[_0x1a3c('0xc')][_0x1a3c('0xd')]){_0x48fe5a[_0x334651[_0x1a3c('0xc')]['name']['toLowerCase']()]&&_0x290fec[_0x1a3c('0x6')](_0x48fe5a[_0x334651[_0x1a3c('0xc')][_0x1a3c('0xd')][_0x1a3c('0xe')]()][_0x1a3c('0xa')]());}else if(_0x334651[_0x1a3c('0x4')]===_0x1a3c('0xf')){if(_0x334651[_0x1a3c('0x10')]===_0x1a3c('0x5')&&_0x334651[_0x1a3c('0x11')]){_0x290fec[_0x1a3c('0x6')](util[_0x1a3c('0x12')](_0x1a3c('0x13'),_0x334651['key'],_0x334651[_0x1a3c('0x14')]));}else if(_0x334651[_0x1a3c('0x10')]===_0x1a3c('0x8')&&_0x334651[_0x1a3c('0x9')]&&_0x334651[_0x1a3c('0x11')]){_0x48fe5a[_0x334651['variableName']]&&_0x290fec['push'](util[_0x1a3c('0x12')]('%s:\x20%s',_0x334651['key'],_0x48fe5a[_0x334651[_0x1a3c('0x9')]]));}else if(_0x334651[_0x1a3c('0x10')]==='customVariable'&&_0x334651[_0x1a3c('0xc')]&&_0x334651[_0x1a3c('0xc')]['name']&&_0x334651[_0x1a3c('0x11')]){_0x48fe5a[_0x334651['Variable'][_0x1a3c('0xd')][_0x1a3c('0xe')]()]&&_0x290fec[_0x1a3c('0x6')](util[_0x1a3c('0x12')]('%s:\x20%s',_0x334651[_0x1a3c('0x11')],_0x48fe5a[_0x334651[_0x1a3c('0xc')][_0x1a3c('0xd')]['toLowerCase']()]));}}}}return _0x290fec['join'](_0x34088c);};exports['stripTrailingSlash']=function(_0x4dfec7){var _0x3da1ef=_0x4dfec7[_0x1a3c('0x15')](-0x1);if(_0x3da1ef==='/'){_0x4dfec7=_0x4dfec7[_0x1a3c('0x16')](0x0,_0x4dfec7['lastIndexOf'](_0x3da1ef));}return _0x4dfec7;};exports[_0x1a3c('0x17')]=function(_0x37d451){if(!_[_0x1a3c('0x18')](_0x37d451)&&_0x37d451!==''){var _0x5c6290=/^(([^<>()\[\]\\.,;:\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 _0x5c6290[_0x1a3c('0x19')](String(_0x37d451)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xc24f=['variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','format','%s:\x20%s','keyContent','variable','key','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','util','getString','length','type','string','push','content'];(function(_0x2af4f0,_0x37ad3a){var _0x1e70c0=function(_0x14402a){while(--_0x14402a){_0x2af4f0['push'](_0x2af4f0['shift']());}};_0x1e70c0(++_0x37ad3a);}(_0xc24f,0x69));var _0xfc24=function(_0x46d99f,_0x50492b){_0x46d99f=_0x46d99f-0x0;var _0x5e7c64=_0xc24f[_0x46d99f];return _0x5e7c64;};'use strict';var _=require('lodash');var util=require(_0xfc24('0x0'));exports[_0xfc24('0x1')]=function(_0x25ea5c,_0x3dce89,_0x273b9a){var _0x450e04=[];if(_0x25ea5c[_0xfc24('0x2')]>0x0){var _0x24c491=_['sortBy'](_0x25ea5c,['id']);for(var _0x15b1a7=0x0;_0x15b1a7<_0x24c491['length'];_0x15b1a7++){var _0x116a6d=_0x24c491[_0x15b1a7];if(_0x116a6d[_0xfc24('0x3')]===_0xfc24('0x4')){_0x450e04[_0xfc24('0x5')](_0x116a6d[_0xfc24('0x6')]);}else if(_0x116a6d[_0xfc24('0x3')]==='variable'&&_0x116a6d[_0xfc24('0x7')]){_0x3dce89[_0x116a6d['variableName']]&&_0x450e04[_0xfc24('0x5')](_0x3dce89[_0x116a6d[_0xfc24('0x7')]][_0xfc24('0x8')]());}else if(_0x116a6d[_0xfc24('0x3')]===_0xfc24('0x9')&&_0x116a6d[_0xfc24('0xa')]&&_0x116a6d[_0xfc24('0xa')][_0xfc24('0xb')]){_0x3dce89[_0x116a6d['Variable'][_0xfc24('0xb')][_0xfc24('0xc')]()]&&_0x450e04[_0xfc24('0x5')](_0x3dce89[_0x116a6d['Variable'][_0xfc24('0xb')][_0xfc24('0xc')]()][_0xfc24('0x8')]());}else if(_0x116a6d[_0xfc24('0x3')]===_0xfc24('0xd')){if(_0x116a6d[_0xfc24('0xe')]===_0xfc24('0x4')&&_0x116a6d['key']){_0x450e04[_0xfc24('0x5')](util[_0xfc24('0xf')](_0xfc24('0x10'),_0x116a6d['key'],_0x116a6d[_0xfc24('0x11')]));}else if(_0x116a6d[_0xfc24('0xe')]===_0xfc24('0x12')&&_0x116a6d['variableName']&&_0x116a6d[_0xfc24('0x13')]){_0x3dce89[_0x116a6d[_0xfc24('0x7')]]&&_0x450e04['push'](util[_0xfc24('0xf')](_0xfc24('0x10'),_0x116a6d['key'],_0x3dce89[_0x116a6d[_0xfc24('0x7')]]));}else if(_0x116a6d['keyType']===_0xfc24('0x9')&&_0x116a6d['Variable']&&_0x116a6d[_0xfc24('0xa')]['name']&&_0x116a6d['key']){_0x3dce89[_0x116a6d['Variable'][_0xfc24('0xb')][_0xfc24('0xc')]()]&&_0x450e04['push'](util['format'](_0xfc24('0x10'),_0x116a6d[_0xfc24('0x13')],_0x3dce89[_0x116a6d['Variable'][_0xfc24('0xb')]['toLowerCase']()]));}}}}return _0x450e04[_0xfc24('0x14')](_0x273b9a);};exports[_0xfc24('0x15')]=function(_0x2a5987){var _0x244434=_0x2a5987[_0xfc24('0x16')](-0x1);if(_0x244434==='/'){_0x2a5987=_0x2a5987[_0xfc24('0x17')](0x0,_0x2a5987[_0xfc24('0x18')](_0x244434));}return _0x2a5987;};exports[_0xfc24('0x19')]=function(_0x50be4c){if(!_[_0xfc24('0x1a')](_0x50be4c)&&_0x50be4c!==''){var _0x5f378b=/^(([^<>()\[\]\\.,;:\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 _0x5f378b[_0xfc24('0x1b')](String(_0x50be4c)[_0xfc24('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index a8deaea..ae6fcfa 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(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','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!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x3d7da9,_0x5dee67){var _0x3798bb=function(_0x2804f1){while(--_0x2804f1){_0x3d7da9['push'](_0x3d7da9['shift']());}};_0x3798bb(++_0x5dee67);}(_0x34e8,0x12c));var _0x834e=function(_0x414dc9,_0x330b6a){_0x414dc9=_0x414dc9-0x0;var _0x223a92=_0x34e8[_0x414dc9];return _0x223a92;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ 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 1ad953c..c28e899 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 _0xa0da=['%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','zendesk','redis','defaults','localhost','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','info','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url'];(function(_0x41207c,_0x13c6c5){var _0x2422fb=function(_0x669cf1){while(--_0x669cf1){_0x41207c['push'](_0x41207c['shift']());}};_0x2422fb(++_0x13c6c5);}(_0xa0da,0x1d5));var _0xaa0d=function(_0x48168a,_0xf9dfe5){_0x48168a=_0x48168a-0x0;var _0x346d98=_0xa0da[_0x48168a];return _0x346d98;};'use strict';var _=require(_0xaa0d('0x0'));var rp=require(_0xaa0d('0x1'));var md5=require(_0xaa0d('0x2'));var util=require(_0xaa0d('0x3'));var Redis=require(_0xaa0d('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xaa0d('0x5'));config[_0xaa0d('0x6')]=_[_0xaa0d('0x7')](config[_0xaa0d('0x6')],{'host':_0xaa0d('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaa0d('0x6')]));function emit(_0x361eae,_0x4192cc,_0x9ec288){io['to'](_0x361eae)['emit'](_0x4192cc,_0x9ec288);}var headers={'Content-Type':_0xaa0d('0x9'),'Accept':'application/json'};function getTicket(_0x166218,_0x5dd6d6,_0x2b9fc3,_0x5601b1,_0x3d0c6a){logger['info'](_0xaa0d('0xa'));return request({'uri':util[_0xaa0d('0xb')](_0xaa0d('0xc'),_0x166218[_0xaa0d('0xd')]),'method':_0xaa0d('0xe'),'body':{'ticket':_[_0xaa0d('0xf')]({'requester_id':_0x2b9fc3['id'],'submitter_id':_0x5dd6d6?_0x5dd6d6['id']:undefined,'assignee_id':_0x5dd6d6?_0x5dd6d6['id']:undefined,'tags':getTags(_0x5601b1[_0xaa0d('0x10')],_0xaa0d('0x11')),'subject':intUtil[_0xaa0d('0x12')](_0x5601b1[_0xaa0d('0x13')],_0x3d0c6a,'\x20'),'description':intUtil[_0xaa0d('0x12')](_0x5601b1[_0xaa0d('0x14')],_0x3d0c6a,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x5601b1[_0xaa0d('0x14')],_0x3d0c6a,'\x0a')}},getCustomFields(_0x5601b1[_0xaa0d('0x15')],_0x3d0c6a))}})[_0xaa0d('0x16')](function(_0x306131){logger[_0xaa0d('0x17')]('Ticket\x20created!');return _0x306131[_0xaa0d('0x18')];});}function getUser(_0x187870,_0x7a1d9c){if(intUtil[_0xaa0d('0x19')](_0x7a1d9c)){logger[_0xaa0d('0x17')]('Getting\x20agent\x20with\x20email',_0x7a1d9c);return request({'uri':util[_0xaa0d('0xb')](_0xaa0d('0x1a'),_0x187870[_0xaa0d('0xd')]),'qs':{'query':util[_0xaa0d('0xb')](_0xaa0d('0x1b'),_0x7a1d9c)}})['then'](function(_0x5f15d2){if(_0x5f15d2[_0xaa0d('0x1c')]){logger[_0xaa0d('0x17')](_0xaa0d('0x1d'));return _['find'](_0x5f15d2[_0xaa0d('0x1e')],{'email':_0x7a1d9c,'role':_0xaa0d('0x1f')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xaa0d('0xb')]('%s/users/me.json',_0x187870['remoteUri'])})[_0xaa0d('0x16')](function(_0x17bb21){logger[_0xaa0d('0x17')](_0xaa0d('0x20'));return _0x17bb21[_0xaa0d('0x21')];});}});}else{logger[_0xaa0d('0x17')](_0xaa0d('0x22'));return request({'uri':util[_0xaa0d('0xb')]('%s/users/me.json',_0x187870[_0xaa0d('0xd')])})[_0xaa0d('0x16')](function(_0x38a66b){logger[_0xaa0d('0x17')](_0xaa0d('0x20'));return _0x38a66b[_0xaa0d('0x21')];});}}function getEndUser(_0x30131f,_0x34c8dd,_0x5a4efb){logger[_0xaa0d('0x17')](_0xaa0d('0x23'),_0x5a4efb);return request({'uri':util[_0xaa0d('0xb')](_0xaa0d('0x1a'),_0x30131f['remoteUri']),'qs':{'query':util[_0xaa0d('0xb')](_0xaa0d('0x24'),_0x5a4efb)}})[_0xaa0d('0x16')](function(_0x48ea69){var _0x5bd2a7;if(_0x48ea69[_0xaa0d('0x1e')]['length']){_0x48ea69[_0xaa0d('0x1e')]=_[_0xaa0d('0x25')](_0x48ea69['results'],{'suspended':![],'role':_0xaa0d('0x26')});if(_0x48ea69['results'][_0xaa0d('0x27')]){_0x5bd2a7=_[_0xaa0d('0x28')](_0x48ea69[_0xaa0d('0x1e')]);}}if(_0x5bd2a7){logger[_0xaa0d('0x17')](_0xaa0d('0x29'));return _0x5bd2a7;}else{logger[_0xaa0d('0x17')](_0xaa0d('0x2a'));return request({'uri':util['format']('%s/users.json',_0x30131f[_0xaa0d('0xd')]),'method':'POST','body':{'user':{'role':_0xaa0d('0x26'),'name':util[_0xaa0d('0xb')](_0xaa0d('0x2b'),_0x34c8dd||_0x5a4efb),'phone':_0x5a4efb}}})['then'](function(_0x3e74c4){logger[_0xaa0d('0x17')](_0xaa0d('0x2c'));return _0x3e74c4[_0xaa0d('0x21')];});}});}function getAuth(_0x3b5837){var _0x4ff079;if(_0x3b5837[_0xaa0d('0x2d')]===_0xaa0d('0x2e')){_0x4ff079=util[_0xaa0d('0xb')]('%s:%s',_0x3b5837[_0xaa0d('0x2f')],_0x3b5837['password']);}else if(_0x3b5837[_0xaa0d('0x2d')]==='token'){_0x4ff079=util['format']('%s/token:%s',_0x3b5837[_0xaa0d('0x2f')],_0x3b5837[_0xaa0d('0x30')]);}return util['format'](_0xaa0d('0x31'),new Buffer(_0x4ff079)[_0xaa0d('0x32')](_0xaa0d('0x33')));}function request(_0x45f4d1){logger[_0xaa0d('0x34')](_0xaa0d('0x35'),JSON[_0xaa0d('0x36')](_0x45f4d1));return rp(_['defaults'](_0x45f4d1,{'method':_0xaa0d('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x3300d4,_0x8e7233){var _0x2ebfc1=[];if(_0x3300d4&&_0x3300d4[_0xaa0d('0x27')]>0x0){_0x2ebfc1=_['map'](_0x3300d4,_0x8e7233);}return _0x2ebfc1;}function getCustomFields(_0x3f8c21,_0x5024f0){var _0x3f9e70=[];var _0x18060f={'custom_fields':[]};if(_0x3f8c21[_0xaa0d('0x27')]>0x0){_['forEach'](_0x3f8c21,function(_0x3c5497){if(_[_0xaa0d('0x38')]([_0xaa0d('0x39'),_0xaa0d('0x3a')],_0x3c5497[_0xaa0d('0x3b')])&&_0x3c5497[_0xaa0d('0x3c')]&&!_0x3c5497[_0xaa0d('0x3d')]){_0x18060f[_0x3c5497['nameField'][_0xaa0d('0x3e')]()]=_0x3c5497[_0xaa0d('0x3f')][_0xaa0d('0x32')]();}else if(_[_0xaa0d('0x38')]([_0xaa0d('0x39'),_0xaa0d('0x3a')],_0x3c5497[_0xaa0d('0x3b')])&&_0x3c5497[_0xaa0d('0x40')]&&_0x3c5497[_0xaa0d('0x3d')]){_0x18060f[_0xaa0d('0x41')]['push']({'id':_0x3c5497[_0xaa0d('0x40')],'value':_0x3c5497[_0xaa0d('0x3f')][_0xaa0d('0x32')]()});}else if(_0x3c5497[_0xaa0d('0x3b')]===_0xaa0d('0x42')&&_0x3c5497[_0xaa0d('0x43')]&&_0x3c5497[_0xaa0d('0x40')]&&_0x3c5497[_0xaa0d('0x3d')]){_0x5024f0[_0x3c5497[_0xaa0d('0x43')]]&&_0x18060f[_0xaa0d('0x41')][_0xaa0d('0x44')]({'id':_0x3c5497[_0xaa0d('0x40')],'value':_0x5024f0[_0x3c5497[_0xaa0d('0x43')]][_0xaa0d('0x32')]()});}else if(_0x3c5497['type']===_0xaa0d('0x45')&&_0x3c5497[_0xaa0d('0x46')]&&_0x3c5497['Variable']['name']&&_0x3c5497[_0xaa0d('0x40')]&&_0x3c5497['customField']){_0x5024f0[_0x3c5497[_0xaa0d('0x46')][_0xaa0d('0x11')][_0xaa0d('0x3e')]()]&&_0x18060f['custom_fields'][_0xaa0d('0x44')]({'id':_0x3c5497[_0xaa0d('0x40')],'value':_0x5024f0[_0x3c5497[_0xaa0d('0x46')][_0xaa0d('0x11')][_0xaa0d('0x3e')]()][_0xaa0d('0x32')]()});}});}return _0x18060f;}exports[_0xaa0d('0x47')]=function(_0x3bf73c,_0x86f7fc,_0x29fc74,_0x19db79,_0x31ab77,_0x436483){var _0x425bc7,_0xf6dc45;_0x436483[_0xaa0d('0xd')]=intUtil[_0xaa0d('0x48')](_0x436483[_0xaa0d('0xd')]);_0x436483[_0xaa0d('0x49')]=intUtil[_0xaa0d('0x48')](_0x436483['serverUrl']);if(_0x31ab77&&_0x31ab77[_0xaa0d('0x4a')]){logger['info']('[QUEUE]',_0xaa0d('0x4b'));_0x86f7fc['recordingURL']=util[_0xaa0d('0xb')](_0xaa0d('0x4c'),_0x436483[_0xaa0d('0x49')],_0x86f7fc[_0xaa0d('0x4d')],md5(_0x86f7fc[_0xaa0d('0x4d')]));}else{_0x86f7fc[_0xaa0d('0x4e')]='';}headers[_0xaa0d('0x4f')]=getAuth(_0x436483);return getUser(_0x436483,_0x19db79[_0xaa0d('0x50')])['then'](function(_0x3ceeab){_0x425bc7=_0x3ceeab;logger[_0xaa0d('0x17')]('The\x20User\x20ID\x20is:',_0x425bc7['id']);return getEndUser(_0x436483,_0x86f7fc[_0xaa0d('0x51')],_0x86f7fc['calleridnum']);})['then'](function(_0xcb81e3){_0xf6dc45=_0xcb81e3;logger[_0xaa0d('0x17')](_0xaa0d('0x52'),_0xf6dc45['id']);return getTicket(_0x436483,_0x425bc7,_0xf6dc45,_0x29fc74,_0x86f7fc);})['then'](function(_0x5ce74e){if(_0x5ce74e){logger[_0xaa0d('0x17')](_0xaa0d('0x53'),_0x5ce74e['id']);switch(_0x436483[_0xaa0d('0x3b')]){case _0xaa0d('0x54'):logger['info'](_0xaa0d('0x55'),_0xaa0d('0x56'));return request({'uri':util[_0xaa0d('0xb')](_0xaa0d('0x57'),_0x436483[_0xaa0d('0xd')],_0x425bc7['id'],_0x5ce74e['id']),'method':_0xaa0d('0xe')});case _0xaa0d('0x58'):logger[_0xaa0d('0x17')](_0xaa0d('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xaa0d('0x59'),_0x19db79[_0xaa0d('0x11')]),_0xaa0d('0x5a'),{'uri':util[_0xaa0d('0xb')](_0xaa0d('0x5b'),_0x436483['remoteUri'][_0xaa0d('0x5c')](_0xaa0d('0x5d'),''),_0x5ce74e['id'])});break;default:logger[_0xaa0d('0x5e')](_0xaa0d('0x55'),_0xaa0d('0x5f'));}}})[_0xaa0d('0x60')](function(_0x4f1de3){logger[_0xaa0d('0x5e')](_0xaa0d('0x61'),util['inspect'](_0x4f1de3,{'showHidden':!![],'depth':null}));});};exports[_0xaa0d('0x62')]=function(_0x77c21b,_0x26e918,_0xe4105a,_0x50029d,_0x418e18,_0x3360f4,_0x3458bc){var _0x536bb7,_0x2edd67;_0x3360f4['remoteUri']=intUtil[_0xaa0d('0x48')](_0x3360f4[_0xaa0d('0xd')]);_0x3360f4[_0xaa0d('0x49')]=intUtil[_0xaa0d('0x48')](_0x3360f4[_0xaa0d('0x49')]);if(_0x3458bc&&_0x3458bc['recordingFormat']&&_0x3458bc[_0xaa0d('0x63')]!==_0xaa0d('0x64')){logger['info'](_0xaa0d('0x65'),_0xaa0d('0x4b'));_0x26e918[_0xaa0d('0x4e')]=util[_0xaa0d('0xb')](_0xaa0d('0x4c'),_0x3360f4[_0xaa0d('0x49')],_0x26e918[_0xaa0d('0x4d')],md5(_0x26e918[_0xaa0d('0x4d')]));}headers['Authorization']=getAuth(_0x3360f4);return getUser(_0x3360f4,_0x50029d[_0xaa0d('0x50')])[_0xaa0d('0x16')](function(_0xb5e687){_0x536bb7=_0xb5e687;logger[_0xaa0d('0x17')](_0xaa0d('0x66'),_0x536bb7['id']);return getEndUser(_0x3360f4,_0x26e918[_0xaa0d('0x67')],_0x26e918[_0xaa0d('0x68')]);})[_0xaa0d('0x16')](function(_0x5660e3){_0x2edd67=_0x5660e3;logger[_0xaa0d('0x17')](_0xaa0d('0x52'),_0x2edd67['id']);return getTicket(_0x3360f4,_0x536bb7,_0x2edd67,_0xe4105a,_0x26e918);})['then'](function(_0x5ea5b7){if(_0x5ea5b7){logger[_0xaa0d('0x17')]('The\x20Ticket\x20ID\x20is:',_0x5ea5b7['id']);switch(_0x3360f4[_0xaa0d('0x3b')]){case'integrationTab':logger[_0xaa0d('0x17')](_0xaa0d('0x65'),_0xaa0d('0x56'));return request({'uri':util['format'](_0xaa0d('0x57'),_0x3360f4[_0xaa0d('0xd')],_0x536bb7['id'],_0x5ea5b7['id']),'method':_0xaa0d('0xe')});case _0xaa0d('0x58'):logger[_0xaa0d('0x17')]('[OUTBOUND]',_0xaa0d('0x69'));emit(util[_0xaa0d('0xb')]('user:%s',_0x50029d[_0xaa0d('0x11')]),_0xaa0d('0x5a'),{'uri':util[_0xaa0d('0xb')](_0xaa0d('0x5b'),_0x3360f4['remoteUri']['replace'](_0xaa0d('0x5d'),''),_0x5ea5b7['id'])});break;default:logger['error'](_0xaa0d('0x65'),_0xaa0d('0x5f'));}}})[_0xaa0d('0x60')](function(_0x5b596f){logger[_0xaa0d('0x5e')](_0xaa0d('0x6a'),util[_0xaa0d('0x6b')](_0x5b596f,{'showHidden':!![],'depth':null}));});};exports[_0xaa0d('0x6c')]=function(_0x242f35,_0x2704a0,_0x35123c,_0x2d479d,_0x31fe99,_0x49dbad){var _0xcf8ed5,_0x43c299;_0x49dbad[_0xaa0d('0xd')]=intUtil[_0xaa0d('0x48')](_0x49dbad[_0xaa0d('0xd')]);_0x49dbad[_0xaa0d('0x49')]=intUtil['stripTrailingSlash'](_0x49dbad[_0xaa0d('0x49')]);if(_0x31fe99&&_0x31fe99[_0xaa0d('0x4a')]){logger[_0xaa0d('0x17')]('['+_0x2704a0['lastevent'][_0xaa0d('0x6d')]()+']',_0xaa0d('0x4b'));_0x2704a0[_0xaa0d('0x4e')]=util[_0xaa0d('0xb')](_0xaa0d('0x4c'),_0x49dbad[_0xaa0d('0x49')],_0x2704a0['uniqueid'],md5(_0x2704a0['uniqueid']));}else{_0x2704a0[_0xaa0d('0x4e')]='';}headers[_0xaa0d('0x4f')]=getAuth(_0x49dbad);return getUser(_0x49dbad)[_0xaa0d('0x16')](function(_0x2d9dd5){_0xcf8ed5=_0x2d9dd5;logger[_0xaa0d('0x17')]('The\x20User\x20ID\x20is:',_0xcf8ed5['id']);return getEndUser(_0x49dbad,_0x2704a0[_0xaa0d('0x51')],_0x2704a0['calleridnum']);})[_0xaa0d('0x16')](function(_0x2d5780){_0x43c299=_0x2d5780;logger[_0xaa0d('0x17')]('The\x20Enduser\x20ID\x20is:',_0x43c299['id']);return getTicket(_0x49dbad,_0xcf8ed5,_0x43c299,_0x35123c,_0x2704a0);})[_0xaa0d('0x16')](function(_0x4c9d8e){if(_0x4c9d8e){logger[_0xaa0d('0x17')](_0xaa0d('0x53'),_0x4c9d8e['id']);}})[_0xaa0d('0x60')](function(_0x30a3b5){logger[_0xaa0d('0x5e')]('['+_0x2704a0[_0xaa0d('0x6e')][_0xaa0d('0x6d')]()+']'+_0xaa0d('0x6f'),util[_0xaa0d('0x6b')](_0x30a3b5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9389=['recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','newTab','Zendesk\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/logger','zendesk','redis','emit','application/json','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','info','ticket','format','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','%s/search.json','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','authType','token','username','Basic\x20%s','base64','debug','stringify','defaults','GET','map','forEach','includes','string','type','nameField','customField','toLowerCase','content','toString','picklist','idField','push','variable','variableName','customVariable','Variable','custom_fields','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]'];(function(_0xd21fe7,_0x225a39){var _0x14d570=function(_0x3c0674){while(--_0x3c0674){_0xd21fe7['push'](_0xd21fe7['shift']());}};_0x14d570(++_0x225a39);}(_0x9389,0x175));var _0x9938=function(_0x57d477,_0x5d54cb){_0x57d477=_0x57d477-0x0;var _0xc628bb=_0x9389[_0x57d477];return _0xc628bb;};'use strict';var _=require(_0x9938('0x0'));var rp=require(_0x9938('0x1'));var md5=require('md5');var util=require(_0x9938('0x2'));var Redis=require(_0x9938('0x3'));var intUtil=require(_0x9938('0x4'));var config=require('../../../../config/environment');var logger=require(_0x9938('0x5'))(_0x9938('0x6'));config[_0x9938('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x3fd077,_0x34b547,_0x2fd02f){io['to'](_0x3fd077)[_0x9938('0x8')](_0x34b547,_0x2fd02f);}var headers={'Content-Type':_0x9938('0x9'),'Accept':'application/json'};function getTicket(_0x19f29b,_0x3a6ec7,_0x57356d,_0x344346,_0x465bfb){logger['info'](_0x9938('0xa'));return request({'uri':util['format'](_0x9938('0xb'),_0x19f29b[_0x9938('0xc')]),'method':_0x9938('0xd'),'body':{'ticket':_[_0x9938('0xe')]({'requester_id':_0x57356d['id'],'submitter_id':_0x3a6ec7?_0x3a6ec7['id']:undefined,'assignee_id':_0x3a6ec7?_0x3a6ec7['id']:undefined,'tags':getTags(_0x344346[_0x9938('0xf')],_0x9938('0x10')),'subject':intUtil[_0x9938('0x11')](_0x344346[_0x9938('0x12')],_0x465bfb,'\x20'),'description':intUtil['getString'](_0x344346[_0x9938('0x13')],_0x465bfb,'\x0a'),'comment':{'public':![],'body':intUtil[_0x9938('0x11')](_0x344346['Descriptions'],_0x465bfb,'\x0a')}},getCustomFields(_0x344346[_0x9938('0x14')],_0x465bfb))}})['then'](function(_0x54fefe){logger[_0x9938('0x15')]('Ticket\x20created!');return _0x54fefe[_0x9938('0x16')];});}function getUser(_0x1c5d00,_0x25b5c9){if(intUtil['validateEmail'](_0x25b5c9)){logger['info']('Getting\x20agent\x20with\x20email',_0x25b5c9);return request({'uri':util['format']('%s/search.json',_0x1c5d00[_0x9938('0xc')]),'qs':{'query':util[_0x9938('0x17')](_0x9938('0x18'),_0x25b5c9)}})[_0x9938('0x19')](function(_0xe2a095){if(_0xe2a095[_0x9938('0x1a')]){logger[_0x9938('0x15')](_0x9938('0x1b'));return _[_0x9938('0x1c')](_0xe2a095['results'],{'email':_0x25b5c9,'role':_0x9938('0x1d')});}else{logger[_0x9938('0x15')](_0x9938('0x1e'));return request({'uri':util['format'](_0x9938('0x1f'),_0x1c5d00['remoteUri'])})[_0x9938('0x19')](function(_0x23d10c){logger[_0x9938('0x15')](_0x9938('0x20'));return _0x23d10c['user'];});}});}else{logger['info'](_0x9938('0x1e'));return request({'uri':util[_0x9938('0x17')](_0x9938('0x1f'),_0x1c5d00[_0x9938('0xc')])})[_0x9938('0x19')](function(_0x25c746){logger[_0x9938('0x15')](_0x9938('0x20'));return _0x25c746[_0x9938('0x21')];});}}function getEndUser(_0x12c551,_0x3fe901,_0x133c3a){logger[_0x9938('0x15')]('Searching\x20enduser\x20with\x20phone',_0x133c3a);return request({'uri':util['format'](_0x9938('0x22'),_0x12c551[_0x9938('0xc')]),'qs':{'query':util[_0x9938('0x17')](_0x9938('0x23'),_0x133c3a)}})[_0x9938('0x19')](function(_0x569814){var _0x4c131f;if(_0x569814[_0x9938('0x24')][_0x9938('0x25')]){_0x569814[_0x9938('0x24')]=_[_0x9938('0x26')](_0x569814[_0x9938('0x24')],{'suspended':![],'role':_0x9938('0x27')});if(_0x569814[_0x9938('0x24')][_0x9938('0x25')]){_0x4c131f=_[_0x9938('0x28')](_0x569814[_0x9938('0x24')]);}}if(_0x4c131f){logger[_0x9938('0x15')]('Enduser\x20found!');return _0x4c131f;}else{logger[_0x9938('0x15')](_0x9938('0x29'));return request({'uri':util[_0x9938('0x17')](_0x9938('0x2a'),_0x12c551[_0x9938('0xc')]),'method':_0x9938('0xd'),'body':{'user':{'role':_0x9938('0x27'),'name':util[_0x9938('0x17')](_0x9938('0x2b'),_0x3fe901||_0x133c3a),'phone':_0x133c3a}}})[_0x9938('0x19')](function(_0x24294f){logger[_0x9938('0x15')](_0x9938('0x2c'));return _0x24294f['user'];});}});}function getAuth(_0x295e2f){var _0x1aa406;if(_0x295e2f['authType']===_0x9938('0x2d')){_0x1aa406=util[_0x9938('0x17')](_0x9938('0x2e'),_0x295e2f['username'],_0x295e2f[_0x9938('0x2d')]);}else if(_0x295e2f[_0x9938('0x2f')]===_0x9938('0x30')){_0x1aa406=util[_0x9938('0x17')]('%s/token:%s',_0x295e2f[_0x9938('0x31')],_0x295e2f['token']);}return util[_0x9938('0x17')](_0x9938('0x32'),new Buffer(_0x1aa406)['toString'](_0x9938('0x33')));}function request(_0x45dba3){logger[_0x9938('0x34')]('[HTTP]',JSON[_0x9938('0x35')](_0x45dba3));return rp(_[_0x9938('0x36')](_0x45dba3,{'method':_0x9938('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x417aa2,_0x4fdac2){var _0x33faaf=[];if(_0x417aa2&&_0x417aa2[_0x9938('0x25')]>0x0){_0x33faaf=_[_0x9938('0x38')](_0x417aa2,_0x4fdac2);}return _0x33faaf;}function getCustomFields(_0x262823,_0x2b4f85){var _0x1297dd=[];var _0x7af833={'custom_fields':[]};if(_0x262823['length']>0x0){_[_0x9938('0x39')](_0x262823,function(_0x49a2a3){if(_[_0x9938('0x3a')]([_0x9938('0x3b'),'picklist'],_0x49a2a3[_0x9938('0x3c')])&&_0x49a2a3[_0x9938('0x3d')]&&!_0x49a2a3[_0x9938('0x3e')]){_0x7af833[_0x49a2a3['nameField'][_0x9938('0x3f')]()]=_0x49a2a3[_0x9938('0x40')][_0x9938('0x41')]();}else if(_[_0x9938('0x3a')]([_0x9938('0x3b'),_0x9938('0x42')],_0x49a2a3[_0x9938('0x3c')])&&_0x49a2a3[_0x9938('0x43')]&&_0x49a2a3[_0x9938('0x3e')]){_0x7af833['custom_fields'][_0x9938('0x44')]({'id':_0x49a2a3[_0x9938('0x43')],'value':_0x49a2a3['content']['toString']()});}else if(_0x49a2a3[_0x9938('0x3c')]===_0x9938('0x45')&&_0x49a2a3[_0x9938('0x46')]&&_0x49a2a3['idField']&&_0x49a2a3[_0x9938('0x3e')]){_0x2b4f85[_0x49a2a3[_0x9938('0x46')]]&&_0x7af833['custom_fields'][_0x9938('0x44')]({'id':_0x49a2a3[_0x9938('0x43')],'value':_0x2b4f85[_0x49a2a3['variableName']][_0x9938('0x41')]()});}else if(_0x49a2a3['type']===_0x9938('0x47')&&_0x49a2a3[_0x9938('0x48')]&&_0x49a2a3[_0x9938('0x48')][_0x9938('0x10')]&&_0x49a2a3[_0x9938('0x43')]&&_0x49a2a3[_0x9938('0x3e')]){_0x2b4f85[_0x49a2a3['Variable'][_0x9938('0x10')][_0x9938('0x3f')]()]&&_0x7af833[_0x9938('0x49')][_0x9938('0x44')]({'id':_0x49a2a3[_0x9938('0x43')],'value':_0x2b4f85[_0x49a2a3[_0x9938('0x48')][_0x9938('0x10')][_0x9938('0x3f')]()][_0x9938('0x41')]()});}});}return _0x7af833;}exports[_0x9938('0x4a')]=function(_0x4f40e9,_0x183152,_0x1826e,_0x5a4edc,_0x3c533e,_0x5ecf2e){var _0x56cb51,_0xd8e030;_0x5ecf2e[_0x9938('0xc')]=intUtil[_0x9938('0x4b')](_0x5ecf2e[_0x9938('0xc')]);_0x5ecf2e['serverUrl']=intUtil[_0x9938('0x4b')](_0x5ecf2e[_0x9938('0x4c')]);if(_0x3c533e&&_0x3c533e[_0x9938('0x4d')]){logger[_0x9938('0x15')](_0x9938('0x4e'),'Recording\x20is\x20enabled!');_0x183152[_0x9938('0x4f')]=util[_0x9938('0x17')](_0x9938('0x50'),_0x5ecf2e[_0x9938('0x4c')],_0x183152[_0x9938('0x51')],md5(_0x183152[_0x9938('0x51')]));}else{_0x183152[_0x9938('0x4f')]='';}headers[_0x9938('0x52')]=getAuth(_0x5ecf2e);return getUser(_0x5ecf2e,_0x5a4edc[_0x9938('0x53')])[_0x9938('0x19')](function(_0x777fb7){_0x56cb51=_0x777fb7;logger[_0x9938('0x15')]('The\x20User\x20ID\x20is:',_0x56cb51['id']);return getEndUser(_0x5ecf2e,_0x183152[_0x9938('0x54')],_0x183152['calleridnum']);})['then'](function(_0x9cf0a0){_0xd8e030=_0x9cf0a0;logger[_0x9938('0x15')](_0x9938('0x55'),_0xd8e030['id']);return getTicket(_0x5ecf2e,_0x56cb51,_0xd8e030,_0x1826e,_0x183152);})['then'](function(_0x15a4d6){if(_0x15a4d6){logger[_0x9938('0x15')](_0x9938('0x56'),_0x15a4d6['id']);switch(_0x5ecf2e[_0x9938('0x3c')]){case _0x9938('0x57'):logger['info'](_0x9938('0x4e'),_0x9938('0x58'));return request({'uri':util[_0x9938('0x17')](_0x9938('0x59'),_0x5ecf2e[_0x9938('0xc')],_0x56cb51['id'],_0x15a4d6['id']),'method':_0x9938('0xd')});case'newTab':logger['info']('[QUEUE]',_0x9938('0x5a'));emit(util[_0x9938('0x17')](_0x9938('0x5b'),_0x5a4edc[_0x9938('0x10')]),_0x9938('0x5c'),{'uri':util[_0x9938('0x17')](_0x9938('0x5d'),_0x5ecf2e[_0x9938('0xc')][_0x9938('0x5e')](_0x9938('0x5f'),''),_0x15a4d6['id'])});break;default:logger['error'](_0x9938('0x4e'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x15cdd2){logger[_0x9938('0x60')](_0x9938('0x61'),util[_0x9938('0x62')](_0x15cdd2,{'showHidden':!![],'depth':null}));});};exports[_0x9938('0x63')]=function(_0x1f8e10,_0x412680,_0x150125,_0x58cc64,_0x148a5c,_0x1ea273,_0x53e6d3){var _0x2512d9,_0x2b3d85;_0x1ea273['remoteUri']=intUtil['stripTrailingSlash'](_0x1ea273[_0x9938('0xc')]);_0x1ea273['serverUrl']=intUtil[_0x9938('0x4b')](_0x1ea273['serverUrl']);if(_0x53e6d3&&_0x53e6d3[_0x9938('0x64')]&&_0x53e6d3[_0x9938('0x64')]!==_0x9938('0x65')){logger[_0x9938('0x15')](_0x9938('0x66'),_0x9938('0x67'));_0x412680['recordingURL']=util[_0x9938('0x17')](_0x9938('0x50'),_0x1ea273[_0x9938('0x4c')],_0x412680[_0x9938('0x51')],md5(_0x412680[_0x9938('0x51')]));}headers[_0x9938('0x52')]=getAuth(_0x1ea273);return getUser(_0x1ea273,_0x58cc64['email'])[_0x9938('0x19')](function(_0x4d8938){_0x2512d9=_0x4d8938;logger[_0x9938('0x15')](_0x9938('0x68'),_0x2512d9['id']);return getEndUser(_0x1ea273,_0x412680[_0x9938('0x69')],_0x412680['destcalleridnum']);})['then'](function(_0x4f321f){_0x2b3d85=_0x4f321f;logger[_0x9938('0x15')](_0x9938('0x55'),_0x2b3d85['id']);return getTicket(_0x1ea273,_0x2512d9,_0x2b3d85,_0x150125,_0x412680);})[_0x9938('0x19')](function(_0x186ddd){if(_0x186ddd){logger[_0x9938('0x15')](_0x9938('0x56'),_0x186ddd['id']);switch(_0x1ea273['type']){case _0x9938('0x57'):logger[_0x9938('0x15')](_0x9938('0x66'),_0x9938('0x58'));return request({'uri':util['format'](_0x9938('0x59'),_0x1ea273[_0x9938('0xc')],_0x2512d9['id'],_0x186ddd['id']),'method':_0x9938('0xd')});case _0x9938('0x6a'):logger[_0x9938('0x15')](_0x9938('0x66'),_0x9938('0x5a'));emit(util[_0x9938('0x17')](_0x9938('0x5b'),_0x58cc64[_0x9938('0x10')]),_0x9938('0x5c'),{'uri':util[_0x9938('0x17')](_0x9938('0x5d'),_0x1ea273[_0x9938('0xc')][_0x9938('0x5e')]('/api/v2',''),_0x186ddd['id'])});break;default:logger[_0x9938('0x60')](_0x9938('0x66'),_0x9938('0x6b'));}}})[_0x9938('0x6c')](function(_0x10a076){logger['error'](_0x9938('0x6d'),util['inspect'](_0x10a076,{'showHidden':!![],'depth':null}));});};exports[_0x9938('0x6e')]=function(_0x504bfd,_0x157741,_0x4b16d2,_0x53ad0a,_0x325dd4,_0x356c93){var _0x3cca2c,_0x2cdc4e;_0x356c93[_0x9938('0xc')]=intUtil['stripTrailingSlash'](_0x356c93[_0x9938('0xc')]);_0x356c93['serverUrl']=intUtil['stripTrailingSlash'](_0x356c93[_0x9938('0x4c')]);if(_0x325dd4&&_0x325dd4['monitor_format']){logger['info']('['+_0x157741[_0x9938('0x6f')]['toUpperCase']()+']',_0x9938('0x67'));_0x157741[_0x9938('0x4f')]=util[_0x9938('0x17')](_0x9938('0x50'),_0x356c93[_0x9938('0x4c')],_0x157741['uniqueid'],md5(_0x157741[_0x9938('0x51')]));}else{_0x157741[_0x9938('0x4f')]='';}headers['Authorization']=getAuth(_0x356c93);return getUser(_0x356c93)['then'](function(_0x311f9a){_0x3cca2c=_0x311f9a;logger['info'](_0x9938('0x68'),_0x3cca2c['id']);return getEndUser(_0x356c93,_0x157741[_0x9938('0x54')],_0x157741['calleridnum']);})[_0x9938('0x19')](function(_0x5721db){_0x2cdc4e=_0x5721db;logger[_0x9938('0x15')](_0x9938('0x55'),_0x2cdc4e['id']);return getTicket(_0x356c93,_0x3cca2c,_0x2cdc4e,_0x4b16d2,_0x157741);})[_0x9938('0x19')](function(_0x21a84b){if(_0x21a84b){logger[_0x9938('0x15')](_0x9938('0x56'),_0x21a84b['id']);}})[_0x9938('0x6c')](function(_0x1a751b){logger[_0x9938('0x60')]('['+_0x157741['lastevent']['toUpperCase']()+']'+_0x9938('0x70'),util[_0x9938('0x62')](_0x1a751b,{'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 b5e67d7..9e9cdac 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 _0xa98b=['mm:ss','answertime','endtime','Call_Duration','diff','starttime','YYYY-MM-DDTHH:mm:ss','Call_Result','Called','complete','Answered','rejected','Rejected','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','SUCCESS','Call\x20created!','log','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','Outbound','[OUTBOUND]','unmanaged','monitor_format','toUpperCase','lastevent','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','idField','content','toString','type','variableName','customVariable','Variable','name','indexOf','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientId','refresh_token','then','add','seconds','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','users','isNil','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','catch','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','data','code','details','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','Contacts','nothing','administrator','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc'];(function(_0x43f4e1,_0xa9421e){var _0x207120=function(_0x46efa2){while(--_0x46efa2){_0x43f4e1['push'](_0x43f4e1['shift']());}};_0x207120(++_0xa9421e);}(_0xa98b,0x16f));var _0xba98=function(_0x5b3a00,_0x6dd073){_0x5b3a00=_0x5b3a00-0x0;var _0x26334b=_0xa98b[_0x5b3a00];return _0x26334b;};'use strict';var _=require(_0xba98('0x0'));var rp=require(_0xba98('0x1'));var md5=require(_0xba98('0x2'));var util=require(_0xba98('0x3'));var intUtil=require(_0xba98('0x4'));var moment=require(_0xba98('0x5'));var Redis=require(_0xba98('0x6'));var BPromise=require(_0xba98('0x7'));var config=require(_0xba98('0x8'));var logger=require(_0xba98('0x9'))(_0xba98('0xa'));config['redis']=_[_0xba98('0xb')](config[_0xba98('0xc')],{'host':_0xba98('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xba98('0xc')]));function emit(_0x27d366,_0x6e9245,_0x148124){io['to'](_0x27d366)[_0xba98('0xe')](_0x6e9245,_0x148124);}function request(_0x110d4d){logger[_0xba98('0xf')](_0xba98('0x10'),JSON[_0xba98('0x11')](_0x110d4d));return rp(_0x110d4d);}function getCustomFields(_0x1ae483,_0x191ed8){var _0x3269dd={};if(_0x1ae483[_0xba98('0x12')]>0x0){_[_0xba98('0x13')](_0x1ae483,function(_0x491410){if(_[_0xba98('0x14')]([_0xba98('0x15'),_0xba98('0x16')],_0x491410['type'])&&_0x491410[_0xba98('0x17')]){_0x3269dd[_0x491410[_0xba98('0x17')]]=_0x491410[_0xba98('0x18')][_0xba98('0x19')]();}else if(_0x491410[_0xba98('0x1a')]==='variable'&&_0x491410['variableName']&&_0x491410[_0xba98('0x17')]&&_0x191ed8[_0x491410[_0xba98('0x1b')]]){_0x3269dd[_0x491410[_0xba98('0x17')]]=_0x191ed8[_0x491410[_0xba98('0x1b')]][_0xba98('0x19')]();}else if(_0x491410[_0xba98('0x1a')]===_0xba98('0x1c')&&_0x491410['Variable']&&_0x491410[_0xba98('0x1d')][_0xba98('0x1e')]&&_0x491410['idField']&&_0x191ed8[_0x491410[_0xba98('0x1d')][_0xba98('0x1e')]['toLowerCase']()]){_0x3269dd[_0x491410[_0xba98('0x17')]]=_0x191ed8[_0x491410[_0xba98('0x1d')][_0xba98('0x1e')]['toLowerCase']()][_0xba98('0x19')]();}});}return _0x3269dd;}function getName(_0x221e08){if(_0x221e08[_0xba98('0x1f')]('\x20')>0x0){var _0x21f7c6=_0x221e08['split'](/ (.+)/);if(_0x21f7c6[0x1]){return _0x21f7c6;}}return[_0x221e08,_0x221e08];}var accountsTokens={};function getAccessToken(_0x29c33e){return new Promise(function(_0x5c6649,_0xfbc53f){if(!_['isNil'](accountsTokens[_0x29c33e['id']])&&!_['isNil'](accountsTokens[_0x29c33e['id']]['access_token'])){if(moment()[_0xba98('0x20')](accountsTokens[_0x29c33e['id']][_0xba98('0x21')])){_0x5c6649(accountsTokens[_0x29c33e['id']][_0xba98('0x22')]);}}var _0x557e16;switch(_0x29c33e[_0xba98('0x23')]){case'US':_0x557e16=_0xba98('0x24');break;case'AU':_0x557e16=_0xba98('0x25');break;case'EU':_0x557e16=_0xba98('0x26');break;case'IN':_0x557e16=_0xba98('0x27');break;case'CN':_0x557e16='https://accounts.zoho.com.cn';break;default:_0x557e16=_0xba98('0x26');break;}var _0x1e4ac8={'method':_0xba98('0x28'),'uri':_0x557e16+_0xba98('0x29'),'qs':{'refresh_token':_0x29c33e['refreshToken'],'client_id':_0x29c33e[_0xba98('0x2a')],'client_secret':_0x29c33e['clientSecret'],'grant_type':_0xba98('0x2b')},'json':!![]};return rp(_0x1e4ac8)[_0xba98('0x2c')](function(_0x80507d){accountsTokens[_0x29c33e['id']]={'access_token':_0x80507d['access_token'],'expires_in':moment()[_0xba98('0x2d')](_0x80507d[_0xba98('0x21')],_0xba98('0x2e'))};_0x5c6649(_0x80507d['access_token']);})['catch'](function(_0x310471){logger['error'](_0xba98('0x2f'),_0x310471[_0xba98('0x30')]);_0xfbc53f(_0x310471);});});}function getUser(_0x517102,_0x2a36ef,_0x7c2083,_0x698c0b){logger[_0xba98('0x31')]('Search\x20user');return request({'method':_0xba98('0x32'),'uri':util[_0xba98('0x33')]('https://www.zohoapis.%s/crm/v2/users',_0x2a36ef),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x517102},'json':!![]})['then'](function(_0x470cf9){if(_0x470cf9[_0xba98('0x34')]){var _0x5133f9=-0x1;if(_['isArrayLikeObject'](_0x470cf9[_0xba98('0x34')])){if(!_[_0xba98('0x35')](_0x698c0b)){_0x5133f9=_[_0xba98('0x36')](_0x470cf9['users'],function(_0x1789c9){return _0x1789c9[_0xba98('0x37')]===_0x698c0b;});}if(_0x5133f9>=0x0){logger['info'](_0xba98('0x38'));}else{logger[_0xba98('0x31')](_0xba98('0x39'));_0x5133f9=_[_0xba98('0x36')](_0x470cf9[_0xba98('0x34')],function(_0x5f2682){return _0x5f2682[_0xba98('0x3a')][_0xba98('0x1e')]===_0xba98('0x3b');});}return _0x470cf9[_0xba98('0x34')][_0x5133f9];}else{if(_0x470cf9['user'][_0xba98('0x3a')]['name']==='Administrator'){logger[_0xba98('0x31')](_0xba98('0x39'));user=_0x470cf9[_0xba98('0x3c')];return user;}else{logger[_0xba98('0x3d')](_0xba98('0x3e'),JSON[_0xba98('0x11')](_0x470cf9));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xba98('0x11')](_0x470cf9));}}}else{logger[_0xba98('0x3d')](_0xba98('0x3e'),JSON[_0xba98('0x11')](_0x470cf9));throw new Error(_0xba98('0x3f')+JSON[_0xba98('0x11')](_0x470cf9));}})['catch'](function(_0x3f9faf){console[_0xba98('0x3d')](_0x3f9faf);});}function getZohoUser(_0x11a2f3,_0x2936bd){return new BPromise(function(_0x5b01f5,_0x3a8f65){request(_0x11a2f3)[_0xba98('0x2c')](function(_0x2af044){var _0xeb2928=null;if(_0x2af044){_0xeb2928=_0x2af044['data'][0x0];_0xeb2928[_0xba98('0x40')]=_0x2936bd;}_0x5b01f5(_0xeb2928);})[_0xba98('0x41')](function(_0x122756){_0x3a8f65(_0x122756);});});}function createEndUser(_0x26d0b8,_0x4b20ec,_0xeae4bf,_0x5dff87,_0x69e708,_0x2d3d5e){var _0xeae4bf=getName(_0xeae4bf);return request({'method':_0xba98('0x28'),'uri':'https://www.zohoapis.'+_0x4b20ec+_0xba98('0x42')+_[_0xba98('0x43')](_0x2d3d5e[_0xba98('0x44')])+'s','body':{'data':[{'Last_Name':_0xeae4bf[0x1],'First_Name':_0xeae4bf[0x0],'Phone':_0x5dff87,'Owner':{'name':!_['isNil'](_0x69e708[_0xba98('0x45')][_0xba98('0x1e')])?_0x69e708[_0xba98('0x45')][_0xba98('0x1e')]:!_[_0xba98('0x35')](_0x69e708[_0xba98('0x46')])?_0x69e708[_0xba98('0x46')]+'\x20'+_0x69e708[_0xba98('0x47')]:_0x69e708[_0xba98('0x47')],'id':_0x69e708['id']}}]},'headers':{'Authorization':_0xba98('0x48')+_0x26d0b8},'json':!![]})[_0xba98('0x2c')](function(_0x57e9a1){if(_0x57e9a1&&_0x57e9a1[_0xba98('0x49')][0x0][_0xba98('0x4a')]==='SUCCESS'){var _0x4aa7d5=_0x57e9a1[_0xba98('0x49')][0x0][_0xba98('0x4b')];_0x4aa7d5[_0xba98('0x40')]=_[_0xba98('0x43')](_0x2d3d5e[_0xba98('0x44')])+'s';return _0x4aa7d5;}logger[_0xba98('0x3d')]('The\x20failing\x20result\x20is',JSON[_0xba98('0x11')](data));throw new Error(_0xba98('0x4c')+JSON[_0xba98('0x11')](data));})['catch'](function(_0x2a9c40){console['log'](_0xba98('0x4d'),_0x2a9c40);});}function getEndUser(_0x4edbf7,_0xa39cae,_0x2d3b45,_0x476808,_0x236c4f,_0xc833c4,_0x3c120e){var _0x274188={'method':'GET','uri':'','headers':{'Authorization':_0xba98('0x48')+_0x4edbf7},'json':!![]};switch(_0x3c120e[_0xba98('0x4e')]){case _0xba98('0x4f'):_0x274188['uri']=_0xba98('0x50')+_0xa39cae+_0xba98('0x51')+_0x236c4f+'))';return getZohoUser(_0x274188,'Contacts')[_0xba98('0x2c')](function(_0x3a15eb){if(_0x3a15eb)return _0x3a15eb;_0x274188[_0xba98('0x52')]=_0xba98('0x50')+_0xa39cae+_0xba98('0x53')+_0x236c4f+'))';return getZohoUser(_0x274188,_0xba98('0x54'))[_0xba98('0x2c')](function(_0x4c2497){if(_0x4c2497)return _0x4c2497;if(_0x3c120e['moduleCreate']!='nothing'){return createEndUser(_0x4edbf7,_0xa39cae,_0x476808,_0x236c4f,_0xc833c4,_0x3c120e);}else{return{};}});});break;case _0xba98('0x55'):_0x274188[_0xba98('0x52')]=_0xba98('0x50')+_0xa39cae+_0xba98('0x51')+_0x236c4f+'))';return getZohoUser(_0x274188,_0xba98('0x56'))['then'](function(_0x588e3e){if(_0x588e3e)return _0x588e3e;if(_0x3c120e[_0xba98('0x44')]!=_0xba98('0x57')){return createEndUser(_0x4edbf7,_0xa39cae,_0x476808,_0x236c4f,_0xc833c4,_0x3c120e);}else{return{};}});break;case'lead':_0x274188['uri']=_0xba98('0x50')+_0xa39cae+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x236c4f+'))';return getZohoUser(_0x274188,'Leads')[_0xba98('0x2c')](function(_0x1411fd){if(_0x1411fd)return _0x1411fd;if(_0x3c120e[_0xba98('0x44')]!='nothing'){return createEndUser(_0x4edbf7,_0xa39cae,_0x476808,_0x236c4f,_0xc833c4,_0x3c120e);}else{return{};}});break;}}function getCall(_0x430351,_0x130672,_0x402882,_0x6600cc,_0xfd4384,_0x4c6522,_0x4f0e9f,_0x4256ac){logger[_0xba98('0x31')]('Creating\x20new\x20call...');var _0x2e5867={};_0x2e5867['Owner']={'name':!_[_0xba98('0x35')](_0x6600cc[_0xba98('0x45')]['name'])&&!_[_0xba98('0x35')](_0x6600cc[_0xba98('0x3a')][_0xba98('0x1e')])&&_0x6600cc[_0xba98('0x3a')]['name']===_0xba98('0x58')?_0x6600cc[_0xba98('0x45')][_0xba98('0x1e')]:!_[_0xba98('0x35')](_0x6600cc[_0xba98('0x46')])?_0x6600cc[_0xba98('0x46')]+'\x20'+_0x6600cc['last_name']:_0x6600cc[_0xba98('0x47')],'id':_0x6600cc['id']};_0x2e5867[_0xba98('0x59')]=intUtil[_0xba98('0x5a')](_0x4c6522['Subjects'],_0x4f0e9f,'\x20');_0x2e5867[_0xba98('0x5b')]=intUtil[_0xba98('0x5a')](_0x4c6522[_0xba98('0x5c')],_0x4f0e9f,'\x0a');if(_0xfd4384[_0xba98('0x40')]==='Contacts'){_0x2e5867[_0xba98('0x5d')]={'name':!_['isNil'](_0xfd4384[_0xba98('0x5e')])?_0xfd4384['Full_Name']:!_['isNil'](_0xfd4384[_0xba98('0x5f')])?_0xfd4384[_0xba98('0x5f')]+'\x20'+_0xfd4384['Last_Name']:_0xfd4384[_0xba98('0x60')],'id':_0xfd4384['id']};}if(_0xfd4384[_0xba98('0x40')]===_0xba98('0x54')){_0x2e5867[_0xba98('0x61')]={'name':!_['isNil'](_0xfd4384['Full_Name'])?_0xfd4384['Full_Name']:!_[_0xba98('0x35')](_0xfd4384[_0xba98('0x5f')])?_0xfd4384[_0xba98('0x5f')]+'\x20'+_0xfd4384[_0xba98('0x60')]:_0xfd4384[_0xba98('0x60')],'id':_0xfd4384['id']};_0x2e5867[_0xba98('0x62')]=_[_0xba98('0x43')](_0xfd4384['enduserType']);}if(_0x4f0e9f[_0xba98('0x63')]){_0x2e5867['Call_Duration']=moment[_0xba98('0x64')](parseInt(_0x4f0e9f[_0xba98('0x63')])*0x3e8)[_0xba98('0x33')](_0xba98('0x65'));}else if(_0x4f0e9f[_0xba98('0x66')]&&_0x4f0e9f[_0xba98('0x67')]){_0x2e5867[_0xba98('0x68')]=moment[_0xba98('0x64')](moment(_0x4f0e9f[_0xba98('0x67')],'YYYY-MM-DDTHH:mm:ss')[_0xba98('0x69')](moment(_0x4f0e9f[_0xba98('0x6a')],_0xba98('0x6b'))))[_0xba98('0x33')](_0xba98('0x65'));}switch(_0x4f0e9f['lastevent']){case'called':_0x2e5867[_0xba98('0x6c')]=_0xba98('0x6d');break;case _0xba98('0x6e'):case'connect':_0x2e5867['Call_Result']=_0xba98('0x6f');break;case _0xba98('0x70'):_0x2e5867['Call_Result']=_0xba98('0x71');break;case'abandoned':_0x2e5867[_0xba98('0x6c')]='Abandoned';break;case _0xba98('0x72'):_0x2e5867[_0xba98('0x6c')]=_0xba98('0x73');default:}_0x2e5867[_0xba98('0x74')]=(_0x4256ac===_0xba98('0x75')?moment(_0x4f0e9f[_0xba98('0x6a')])[_0xba98('0x33')](_0xba98('0x6b')):moment(_0x4f0e9f[_0xba98('0x76')])[_0xba98('0x33')](_0xba98('0x6b')))||moment()[_0xba98('0x33')](_0xba98('0x6b'));_0x2e5867[_0xba98('0x77')]=_0x4256ac||_0xba98('0x78');_0x2e5867=_[_0xba98('0x79')](_0x2e5867,getCustomFields(_0x4c6522['Fields'],_0x4f0e9f));return request({'method':'POST','uri':_0xba98('0x50')+_0x130672+_0xba98('0x7a'),'headers':{'Authorization':_0xba98('0x48')+_0x430351},'body':{'data':[_0x2e5867]},'json':!![]})['then'](function(_0x24df3e){if(_0x24df3e&&_0x24df3e[_0xba98('0x49')][0x0]['code']===_0xba98('0x7b')){logger[_0xba98('0x31')](_0xba98('0x7c'));return{'id':_0x24df3e[_0xba98('0x49')][0x0][_0xba98('0x4b')]['id']};}})[_0xba98('0x41')](function(_0x1ebed3){logger['info']('err',_0x1ebed3['stack']);console[_0xba98('0x7d')](_0xba98('0x7e'),_0x1ebed3);});}exports[_0xba98('0x7f')]=function(_0x19af19,_0x5d98f8,_0x2c235a,_0x5c0fc2,_0x2bc5f5,_0x40df37){var _0x3643ca,_0x1ad453,_0x1d4fff;_0x40df37[_0xba98('0x80')]=intUtil[_0xba98('0x81')](_0x40df37[_0xba98('0x80')]);_0x40df37[_0xba98('0x82')]=intUtil[_0xba98('0x81')](_0x40df37['serverUrl']);if(_0x2bc5f5&&_0x2bc5f5['monitor_format']){logger[_0xba98('0x31')](_0xba98('0x83'),_0xba98('0x84'));_0x5d98f8[_0xba98('0x85')]=_0x40df37['serverUrl']+_0xba98('0x86')+_0x5d98f8['uniqueid']+_0xba98('0x87')+md5(_0x5d98f8[_0xba98('0x88')]);}else{_0x5d98f8['recordingURL']='';}var _0x4688d8=_0x40df37[_0xba98('0x80')]===_0xba98('0x89')?'eu':_0xba98('0x8a');return getAccessToken(_0x40df37)[_0xba98('0x2c')](function(_0x2f577f){_0x1d4fff=_0x2f577f;return getUser(_0x1d4fff,_0x4688d8,_0x40df37,_0x5c0fc2[_0xba98('0x37')]);})[_0xba98('0x2c')](function(_0x2bf0d8){_0x3643ca=_0x2bf0d8;logger[_0xba98('0x31')](_0xba98('0x8b'),_0x3643ca['id']);return getEndUser(_0x1d4fff,_0x4688d8,_0x40df37,_0x5d98f8[_0xba98('0x8c')],_0x5d98f8[_0xba98('0x8d')],_0x3643ca,_0x2c235a);})[_0xba98('0x2c')](function(_0x1204fe){_0x1ad453=_0x1204fe;return getCall(_0x1d4fff,_0x4688d8,_0x40df37,_0x3643ca,_0x1ad453,_0x2c235a,_0x5d98f8,_0xba98('0x78'));})[_0xba98('0x2c')](function(_0xfb32c3){if(_0xfb32c3){logger[_0xba98('0x31')](_0xba98('0x8e'),_0xfb32c3['id']);logger['info'](_0xba98('0x83'),_0xba98('0x8f'));emit(util['format'](_0xba98('0x90'),_0x5c0fc2[_0xba98('0x1e')]),_0xba98('0x91'),{'uri':_0xba98('0x92')+_0x40df37[_0xba98('0x80')]+_0xba98('0x93')+_0xfb32c3['id']});}})['catch'](function(_0x3f3ae8){logger[_0xba98('0x3d')](_0xba98('0x83'),JSON[_0xba98('0x11')](_0x3f3ae8));});};exports[_0xba98('0x75')]=function(_0x39a3d1,_0x244b36,_0x5537bd,_0x80dbc3,_0x16d315,_0x20caeb,_0x4f0b80){var _0x20900c,_0x315bfe,_0x4811b6;_0x20caeb[_0xba98('0x80')]=intUtil['stripTrailingSlash'](_0x20caeb[_0xba98('0x80')]);_0x20caeb['serverUrl']=intUtil[_0xba98('0x81')](_0x20caeb[_0xba98('0x82')]);if(_0x4f0b80&&_0x4f0b80[_0xba98('0x94')]&&_0x4f0b80['recordingFormat']!==_0xba98('0x95')){logger['info']('[OUTBOUND]',_0xba98('0x84'));_0x244b36[_0xba98('0x85')]=_0x20caeb['serverUrl']+_0xba98('0x86')+_0x244b36[_0xba98('0x88')]+'/downloads?type=uniqueid&token='+md5(_0x244b36[_0xba98('0x88')]);}var _0x519eab=_0x20caeb[_0xba98('0x80')]===_0xba98('0x89')?'eu':_0xba98('0x8a');return getAccessToken(_0x20caeb)[_0xba98('0x2c')](function(_0x2afea0){_0x4811b6=_0x2afea0;return getUser(_0x4811b6,_0x519eab,_0x20caeb,_0x80dbc3[_0xba98('0x37')]);})['then'](function(_0x4efc76){_0x20900c=_0x4efc76;logger['info'](_0xba98('0x8b'),_0x20900c['id']);return getEndUser(_0x4811b6,_0x519eab,_0x20caeb,_0x244b36['destcalleridname'],_0x244b36['destcalleridnum'],_0x20900c,_0x5537bd);})['then'](function(_0x8254ee){_0x315bfe=_0x8254ee;return getCall(_0x4811b6,_0x519eab,_0x20caeb,_0x20900c,_0x315bfe,_0x5537bd,_0x244b36,_0xba98('0x96'));})[_0xba98('0x2c')](function(_0x399ffd){if(_0x399ffd){logger[_0xba98('0x31')](_0xba98('0x8e'),_0x399ffd['id']);logger[_0xba98('0x31')](_0xba98('0x97'),_0xba98('0x8f'));emit(util[_0xba98('0x33')](_0xba98('0x90'),_0x80dbc3[_0xba98('0x1e')]),'trigger:browser:url',{'uri':_0xba98('0x92')+_0x20caeb['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x399ffd['id']});}})['catch'](function(_0x41bed8){logger[_0xba98('0x3d')](_0xba98('0x97'),JSON['stringify'](_0x41bed8));});};exports[_0xba98('0x98')]=function(_0x4e971a,_0x5b70df,_0x18938b,_0x364437,_0x2dc443,_0xdd14b7){var _0x58467c,_0x5ef368,_0x19b108;_0xdd14b7[_0xba98('0x80')]=intUtil[_0xba98('0x81')](_0xdd14b7[_0xba98('0x80')]);_0xdd14b7[_0xba98('0x82')]=intUtil[_0xba98('0x81')](_0xdd14b7[_0xba98('0x82')]);if(_0x2dc443&&_0x2dc443[_0xba98('0x99')]){logger['info']('['+_0x5b70df['lastevent'][_0xba98('0x9a')]()+']','Recording\x20is\x20enabled!');_0x5b70df['recordingURL']=_0xdd14b7[_0xba98('0x82')]+'/api/voice/recordings/'+_0x5b70df[_0xba98('0x88')]+_0xba98('0x87')+md5(_0x5b70df['uniqueid']);}else{_0x5b70df['recordingURL']='';}var _0x94b75d=_0xdd14b7['host']===_0xba98('0x89')?'eu':'com';return getAccessToken(_0xdd14b7)['then'](function(_0x29d2a2){_0x19b108=_0x29d2a2;return getUser(_0x19b108,_0x94b75d,_0xdd14b7);})[_0xba98('0x2c')](function(_0xce41b6){_0x58467c=_0xce41b6;logger[_0xba98('0x31')](_0xba98('0x8b'),_0x58467c['id']);return getEndUser(_0x19b108,_0x94b75d,_0xdd14b7,_0x5b70df['calleridname'],_0x5b70df[_0xba98('0x8d')],_0x58467c,_0x18938b);})['then'](function(_0x3f42c8){_0x5ef368=_0x3f42c8;return getCall(_0x19b108,_0x94b75d,_0xdd14b7,_0x58467c,_0x5ef368,_0x18938b,_0x5b70df,'Inbound');})['then'](function(_0x4e2e1c){if(_0x4e2e1c){logger['info'](_0xba98('0x8e'),_0x4e2e1c['id']);}})[_0xba98('0x41')](function(_0x355780){logger[_0xba98('0x3d')]('['+_0x5b70df[_0xba98('0x9b')][_0xba98('0x9a')]()+']',JSON[_0xba98('0x11')](_0x355780));});}; \ No newline at end of file +var _0xf04c=['zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isNil','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','uri','nothing','lead','Creating\x20new\x20call...','Owner','administrator','first_name','getString','Subjects','Description','enduserType','Contacts','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','connect','Rejected','abandoned','Abandoned','timeout','outbound','agentcalledAt','Call_Type','Inbound','Fields','Call\x20created!','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','email','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','com','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','unmanaged','toUpperCase','calleridname','The\x20Call\x20ID\x20is:','lodash','util','./util','moment','ioredis','bluebird','../../../../config/environment','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','access_token','isBefore','expires_in'];(function(_0x297df8,_0x14a1b3){var _0x384d86=function(_0x54cc99){while(--_0x54cc99){_0x297df8['push'](_0x297df8['shift']());}};_0x384d86(++_0x14a1b3);}(_0xf04c,0x7c));var _0xcf04=function(_0x5d46ac,_0x32363e){_0x5d46ac=_0x5d46ac-0x0;var _0xe02e1d=_0xf04c[_0x5d46ac];return _0xe02e1d;};'use strict';var _=require(_0xcf04('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xcf04('0x1'));var intUtil=require(_0xcf04('0x2'));var moment=require(_0xcf04('0x3'));var Redis=require(_0xcf04('0x4'));var BPromise=require(_0xcf04('0x5'));var config=require(_0xcf04('0x6'));var logger=require('../../../../config/logger')('zoho');config[_0xcf04('0x7')]=_[_0xcf04('0x8')](config[_0xcf04('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xcf04('0x9'))(new Redis(config[_0xcf04('0x7')]));function emit(_0x2200e6,_0x1e4f55,_0x17e9f0){io['to'](_0x2200e6)[_0xcf04('0xa')](_0x1e4f55,_0x17e9f0);}function request(_0x5ad9b1){logger[_0xcf04('0xb')](_0xcf04('0xc'),JSON[_0xcf04('0xd')](_0x5ad9b1));return rp(_0x5ad9b1);}function getCustomFields(_0x4d4da5,_0x9bbc3e){var _0x39c088={};if(_0x4d4da5[_0xcf04('0xe')]>0x0){_[_0xcf04('0xf')](_0x4d4da5,function(_0x53f7de){if(_[_0xcf04('0x10')]([_0xcf04('0x11'),_0xcf04('0x12')],_0x53f7de[_0xcf04('0x13')])&&_0x53f7de[_0xcf04('0x14')]){_0x39c088[_0x53f7de['idField']]=_0x53f7de['content']['toString']();}else if(_0x53f7de[_0xcf04('0x13')]==='variable'&&_0x53f7de[_0xcf04('0x15')]&&_0x53f7de['idField']&&_0x9bbc3e[_0x53f7de[_0xcf04('0x15')]]){_0x39c088[_0x53f7de['idField']]=_0x9bbc3e[_0x53f7de[_0xcf04('0x15')]][_0xcf04('0x16')]();}else if(_0x53f7de[_0xcf04('0x13')]===_0xcf04('0x17')&&_0x53f7de[_0xcf04('0x18')]&&_0x53f7de['Variable'][_0xcf04('0x19')]&&_0x53f7de['idField']&&_0x9bbc3e[_0x53f7de['Variable'][_0xcf04('0x19')][_0xcf04('0x1a')]()]){_0x39c088[_0x53f7de[_0xcf04('0x14')]]=_0x9bbc3e[_0x53f7de[_0xcf04('0x18')][_0xcf04('0x19')][_0xcf04('0x1a')]()][_0xcf04('0x16')]();}});}return _0x39c088;}function getName(_0x1fc868){if(_0x1fc868[_0xcf04('0x1b')]('\x20')>0x0){var _0x5efa80=_0x1fc868['split'](/ (.+)/);if(_0x5efa80[0x1]){return _0x5efa80;}}return[_0x1fc868,_0x1fc868];}var accountsTokens={};function getAccessToken(_0x1e23ab){return new Promise(function(_0x2526e1,_0x3d477b){if(!_['isNil'](accountsTokens[_0x1e23ab['id']])&&!_['isNil'](accountsTokens[_0x1e23ab['id']][_0xcf04('0x1c')])){if(moment()[_0xcf04('0x1d')](accountsTokens[_0x1e23ab['id']][_0xcf04('0x1e')])){_0x2526e1(accountsTokens[_0x1e23ab['id']][_0xcf04('0x1c')]);}}var _0x3f03d8;switch(_0x1e23ab[_0xcf04('0x1f')]){case'US':_0x3f03d8=_0xcf04('0x20');break;case'AU':_0x3f03d8=_0xcf04('0x21');break;case'EU':_0x3f03d8=_0xcf04('0x22');break;case'IN':_0x3f03d8=_0xcf04('0x23');break;case'CN':_0x3f03d8=_0xcf04('0x24');break;default:_0x3f03d8=_0xcf04('0x22');break;}var _0x19551a={'method':_0xcf04('0x25'),'uri':_0x3f03d8+_0xcf04('0x26'),'qs':{'refresh_token':_0x1e23ab[_0xcf04('0x27')],'client_id':_0x1e23ab[_0xcf04('0x28')],'client_secret':_0x1e23ab[_0xcf04('0x29')],'grant_type':_0xcf04('0x2a')},'json':!![]};return rp(_0x19551a)[_0xcf04('0x2b')](function(_0x2d9b5f){accountsTokens[_0x1e23ab['id']]={'access_token':_0x2d9b5f[_0xcf04('0x1c')],'expires_in':moment()[_0xcf04('0x2c')](_0x2d9b5f[_0xcf04('0x1e')],_0xcf04('0x2d'))};_0x2526e1(_0x2d9b5f[_0xcf04('0x1c')]);})[_0xcf04('0x2e')](function(_0x38accb){logger[_0xcf04('0x2f')]('Failing\x20creating\x20the\x20access_token',_0x38accb['stack']);_0x3d477b(_0x38accb);});});}function getUser(_0x1d94da,_0x27a3e1,_0xdd66c9,_0x177ff4){logger[_0xcf04('0x30')]('Search\x20user');return request({'method':_0xcf04('0x31'),'uri':util[_0xcf04('0x32')](_0xcf04('0x33'),_0x27a3e1),'qs':{'type':_0xcf04('0x34')},'headers':{'Authorization':_0xcf04('0x35')+_0x1d94da},'json':!![]})['then'](function(_0x1929ed){if(_0x1929ed[_0xcf04('0x36')]){var _0x457088=-0x1;if(_['isArrayLikeObject'](_0x1929ed[_0xcf04('0x36')])){if(!_[_0xcf04('0x37')](_0x177ff4)){_0x457088=_[_0xcf04('0x38')](_0x1929ed[_0xcf04('0x36')],function(_0x512dce){return _0x512dce['email']===_0x177ff4;});}if(_0x457088>=0x0){logger[_0xcf04('0x30')](_0xcf04('0x39'));}else{logger[_0xcf04('0x30')](_0xcf04('0x3a'));_0x457088=_[_0xcf04('0x38')](_0x1929ed[_0xcf04('0x36')],function(_0x4dbe54){return _0x4dbe54['profile'][_0xcf04('0x19')]===_0xcf04('0x3b');});}return _0x1929ed[_0xcf04('0x36')][_0x457088];}else{if(_0x1929ed[_0xcf04('0x3c')][_0xcf04('0x3d')][_0xcf04('0x19')]==='Administrator'){logger[_0xcf04('0x30')](_0xcf04('0x3a'));user=_0x1929ed[_0xcf04('0x3c')];return user;}else{logger['error'](_0xcf04('0x3e'),JSON[_0xcf04('0xd')](_0x1929ed));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xcf04('0xd')](_0x1929ed));}}}else{logger[_0xcf04('0x2f')](_0xcf04('0x3e'),JSON[_0xcf04('0xd')](_0x1929ed));throw new Error(_0xcf04('0x3f')+JSON[_0xcf04('0xd')](_0x1929ed));}})[_0xcf04('0x2e')](function(_0x59c268){console['error'](_0x59c268);});}function getZohoUser(_0x14a81a,_0x3b5434){return new BPromise(function(_0x214dfd,_0x15cbeb){request(_0x14a81a)['then'](function(_0xedb0f){var _0x1fe344=null;if(_0xedb0f){_0x1fe344=_0xedb0f[_0xcf04('0x40')][0x0];_0x1fe344['enduserType']=_0x3b5434;}_0x214dfd(_0x1fe344);})['catch'](function(_0x332f08){_0x15cbeb(_0x332f08);});});}function createEndUser(_0x4c5397,_0x2bb49a,_0x1515e5,_0x48020f,_0x43c7c4,_0x26634c){var _0x1515e5=getName(_0x1515e5);return request({'method':_0xcf04('0x25'),'uri':_0xcf04('0x41')+_0x2bb49a+_0xcf04('0x42')+_[_0xcf04('0x43')](_0x26634c[_0xcf04('0x44')])+'s','body':{'data':[{'Last_Name':_0x1515e5[0x1],'First_Name':_0x1515e5[0x0],'Phone':_0x48020f,'Owner':{'name':!_[_0xcf04('0x37')](_0x43c7c4[_0xcf04('0x45')]['name'])?_0x43c7c4['role'][_0xcf04('0x19')]:!_[_0xcf04('0x37')](_0x43c7c4['first_name'])?_0x43c7c4['first_name']+'\x20'+_0x43c7c4['last_name']:_0x43c7c4[_0xcf04('0x46')],'id':_0x43c7c4['id']}}]},'headers':{'Authorization':_0xcf04('0x35')+_0x4c5397},'json':!![]})[_0xcf04('0x2b')](function(_0x557489){if(_0x557489&&_0x557489['data'][0x0][_0xcf04('0x47')]===_0xcf04('0x48')){var _0x4dd97c=_0x557489[_0xcf04('0x40')][0x0][_0xcf04('0x49')];_0x4dd97c['enduserType']=_['startCase'](_0x26634c[_0xcf04('0x44')])+'s';return _0x4dd97c;}logger[_0xcf04('0x2f')](_0xcf04('0x3e'),JSON[_0xcf04('0xd')](data));throw new Error(_0xcf04('0x4a')+JSON[_0xcf04('0xd')](data));})[_0xcf04('0x2e')](function(_0xc25bca){console[_0xcf04('0x4b')](_0xcf04('0x4c'),_0xc25bca);});}function getEndUser(_0x3afcf5,_0x41a66f,_0x1f50b2,_0x10c478,_0x283dff,_0x46d955,_0x92acfb){var _0x26db54={'method':'GET','uri':'','headers':{'Authorization':_0xcf04('0x35')+_0x3afcf5},'json':!![]};switch(_0x92acfb['moduleSearch']){case _0xcf04('0x4d'):_0x26db54['uri']=_0xcf04('0x41')+_0x41a66f+_0xcf04('0x4e')+_0x283dff+'))';return getZohoUser(_0x26db54,'Contacts')['then'](function(_0xbea7de){if(_0xbea7de)return _0xbea7de;_0x26db54['uri']='https://www.zohoapis.'+_0x41a66f+_0xcf04('0x4f')+_0x283dff+'))';return getZohoUser(_0x26db54,_0xcf04('0x50'))[_0xcf04('0x2b')](function(_0x291267){if(_0x291267)return _0x291267;if(_0x92acfb['moduleCreate']!='nothing'){return createEndUser(_0x3afcf5,_0x41a66f,_0x10c478,_0x283dff,_0x46d955,_0x92acfb);}else{return{};}});});break;case _0xcf04('0x51'):_0x26db54[_0xcf04('0x52')]=_0xcf04('0x41')+_0x41a66f+_0xcf04('0x4e')+_0x283dff+'))';return getZohoUser(_0x26db54,'Contacts')[_0xcf04('0x2b')](function(_0x34b94e){if(_0x34b94e)return _0x34b94e;if(_0x92acfb[_0xcf04('0x44')]!=_0xcf04('0x53')){return createEndUser(_0x3afcf5,_0x41a66f,_0x10c478,_0x283dff,_0x46d955,_0x92acfb);}else{return{};}});break;case _0xcf04('0x54'):_0x26db54[_0xcf04('0x52')]='https://www.zohoapis.'+_0x41a66f+_0xcf04('0x4f')+_0x283dff+'))';return getZohoUser(_0x26db54,_0xcf04('0x50'))['then'](function(_0x1b3649){if(_0x1b3649)return _0x1b3649;if(_0x92acfb[_0xcf04('0x44')]!='nothing'){return createEndUser(_0x3afcf5,_0x41a66f,_0x10c478,_0x283dff,_0x46d955,_0x92acfb);}else{return{};}});break;}}function getCall(_0x4765fc,_0x51831b,_0x41beca,_0x5e8ea6,_0x152b18,_0x39c588,_0x28d70d,_0x574cd1){logger['info'](_0xcf04('0x55'));var _0x3bddbb={};_0x3bddbb[_0xcf04('0x56')]={'name':!_['isNil'](_0x5e8ea6[_0xcf04('0x45')][_0xcf04('0x19')])&&!_[_0xcf04('0x37')](_0x5e8ea6[_0xcf04('0x3d')]['name'])&&_0x5e8ea6[_0xcf04('0x3d')][_0xcf04('0x19')]===_0xcf04('0x57')?_0x5e8ea6[_0xcf04('0x45')][_0xcf04('0x19')]:!_[_0xcf04('0x37')](_0x5e8ea6[_0xcf04('0x58')])?_0x5e8ea6[_0xcf04('0x58')]+'\x20'+_0x5e8ea6[_0xcf04('0x46')]:_0x5e8ea6[_0xcf04('0x46')],'id':_0x5e8ea6['id']};_0x3bddbb['Subject']=intUtil[_0xcf04('0x59')](_0x39c588[_0xcf04('0x5a')],_0x28d70d,'\x20');_0x3bddbb[_0xcf04('0x5b')]=intUtil[_0xcf04('0x59')](_0x39c588['Descriptions'],_0x28d70d,'\x0a');if(_0x152b18[_0xcf04('0x5c')]===_0xcf04('0x5d')){_0x3bddbb[_0xcf04('0x5e')]={'name':!_[_0xcf04('0x37')](_0x152b18[_0xcf04('0x5f')])?_0x152b18[_0xcf04('0x5f')]:!_['isNil'](_0x152b18[_0xcf04('0x60')])?_0x152b18[_0xcf04('0x60')]+'\x20'+_0x152b18[_0xcf04('0x61')]:_0x152b18[_0xcf04('0x61')],'id':_0x152b18['id']};}if(_0x152b18['enduserType']===_0xcf04('0x50')){_0x3bddbb[_0xcf04('0x62')]={'name':!_['isNil'](_0x152b18[_0xcf04('0x5f')])?_0x152b18['Full_Name']:!_[_0xcf04('0x37')](_0x152b18[_0xcf04('0x60')])?_0x152b18['First_Name']+'\x20'+_0x152b18['Last_Name']:_0x152b18[_0xcf04('0x61')],'id':_0x152b18['id']};_0x3bddbb[_0xcf04('0x63')]=_[_0xcf04('0x43')](_0x152b18[_0xcf04('0x5c')]);}if(_0x28d70d[_0xcf04('0x64')]){_0x3bddbb[_0xcf04('0x65')]=moment['utc'](parseInt(_0x28d70d[_0xcf04('0x64')])*0x3e8)['format']('mm:ss');}else if(_0x28d70d[_0xcf04('0x66')]&&_0x28d70d[_0xcf04('0x67')]){_0x3bddbb['Call_Duration']=moment[_0xcf04('0x68')](moment(_0x28d70d[_0xcf04('0x67')],_0xcf04('0x69'))[_0xcf04('0x6a')](moment(_0x28d70d[_0xcf04('0x6b')],_0xcf04('0x69'))))['format']('mm:ss');}switch(_0x28d70d[_0xcf04('0x6c')]){case _0xcf04('0x6d'):_0x3bddbb[_0xcf04('0x6e')]='Called';break;case'complete':case _0xcf04('0x6f'):_0x3bddbb[_0xcf04('0x6e')]='Answered';break;case'rejected':_0x3bddbb[_0xcf04('0x6e')]=_0xcf04('0x70');break;case _0xcf04('0x71'):_0x3bddbb[_0xcf04('0x6e')]=_0xcf04('0x72');break;case _0xcf04('0x73'):_0x3bddbb[_0xcf04('0x6e')]='Timeout';default:}_0x3bddbb['Call_Start_Time']=(_0x574cd1===_0xcf04('0x74')?moment(_0x28d70d[_0xcf04('0x6b')])[_0xcf04('0x32')](_0xcf04('0x69')):moment(_0x28d70d[_0xcf04('0x75')])[_0xcf04('0x32')](_0xcf04('0x69')))||moment()[_0xcf04('0x32')](_0xcf04('0x69'));_0x3bddbb[_0xcf04('0x76')]=_0x574cd1||_0xcf04('0x77');_0x3bddbb=_['merge'](_0x3bddbb,getCustomFields(_0x39c588[_0xcf04('0x78')],_0x28d70d));return request({'method':_0xcf04('0x25'),'uri':_0xcf04('0x41')+_0x51831b+'/crm/v2/Calls','headers':{'Authorization':_0xcf04('0x35')+_0x4765fc},'body':{'data':[_0x3bddbb]},'json':!![]})[_0xcf04('0x2b')](function(_0x4079ea){if(_0x4079ea&&_0x4079ea[_0xcf04('0x40')][0x0][_0xcf04('0x47')]==='SUCCESS'){logger[_0xcf04('0x30')](_0xcf04('0x79'));return{'id':_0x4079ea['data'][0x0]['details']['id']};}})[_0xcf04('0x2e')](function(_0x1a9e16){logger[_0xcf04('0x30')](_0xcf04('0x7a'),_0x1a9e16[_0xcf04('0x7b')]);console[_0xcf04('0x4b')](_0xcf04('0x7a'),_0x1a9e16);});}exports[_0xcf04('0x7c')]=function(_0x15ece3,_0x10f535,_0x5a3a63,_0x36b1c4,_0x92545e,_0x1dc689){var _0x424e4e,_0x563b8a,_0x67d03f;_0x1dc689[_0xcf04('0x7d')]=intUtil[_0xcf04('0x7e')](_0x1dc689[_0xcf04('0x7d')]);_0x1dc689[_0xcf04('0x7f')]=intUtil[_0xcf04('0x7e')](_0x1dc689['serverUrl']);if(_0x92545e&&_0x92545e[_0xcf04('0x80')]){logger[_0xcf04('0x30')](_0xcf04('0x81'),_0xcf04('0x82'));_0x10f535['recordingURL']=_0x1dc689[_0xcf04('0x7f')]+_0xcf04('0x83')+_0x10f535[_0xcf04('0x84')]+_0xcf04('0x85')+md5(_0x10f535[_0xcf04('0x84')]);}else{_0x10f535[_0xcf04('0x86')]='';}var _0x171d6f=_0x1dc689[_0xcf04('0x7d')]===_0xcf04('0x87')?'eu':'com';return getAccessToken(_0x1dc689)['then'](function(_0x17ab90){_0x67d03f=_0x17ab90;return getUser(_0x67d03f,_0x171d6f,_0x1dc689,_0x36b1c4[_0xcf04('0x88')]);})[_0xcf04('0x2b')](function(_0x40fa2c){_0x424e4e=_0x40fa2c;logger[_0xcf04('0x30')]('The\x20User\x20ID\x20is:',_0x424e4e['id']);return getEndUser(_0x67d03f,_0x171d6f,_0x1dc689,_0x10f535['calleridname'],_0x10f535[_0xcf04('0x89')],_0x424e4e,_0x5a3a63);})[_0xcf04('0x2b')](function(_0x93729a){_0x563b8a=_0x93729a;return getCall(_0x67d03f,_0x171d6f,_0x1dc689,_0x424e4e,_0x563b8a,_0x5a3a63,_0x10f535,_0xcf04('0x77'));})[_0xcf04('0x2b')](function(_0xa89bd2){if(_0xa89bd2){logger[_0xcf04('0x30')]('The\x20Call\x20ID\x20is:',_0xa89bd2['id']);logger[_0xcf04('0x30')](_0xcf04('0x81'),_0xcf04('0x8a'));emit(util['format'](_0xcf04('0x8b'),_0x36b1c4[_0xcf04('0x19')]),_0xcf04('0x8c'),{'uri':_0xcf04('0x8d')+_0x1dc689[_0xcf04('0x7d')]+_0xcf04('0x8e')+_0xa89bd2['id']});}})[_0xcf04('0x2e')](function(_0x31beaf){logger['error'](_0xcf04('0x81'),JSON[_0xcf04('0xd')](_0x31beaf));});};exports[_0xcf04('0x74')]=function(_0x55369f,_0x4e24b0,_0x28649a,_0x24ff4a,_0x4660de,_0x426ca,_0x36af49){var _0x5bd914,_0x3001b7,_0x18cdb9;_0x426ca[_0xcf04('0x7d')]=intUtil[_0xcf04('0x7e')](_0x426ca[_0xcf04('0x7d')]);_0x426ca[_0xcf04('0x7f')]=intUtil[_0xcf04('0x7e')](_0x426ca[_0xcf04('0x7f')]);if(_0x36af49&&_0x36af49[_0xcf04('0x8f')]&&_0x36af49[_0xcf04('0x8f')]!==_0xcf04('0x90')){logger['info'](_0xcf04('0x91'),_0xcf04('0x82'));_0x4e24b0['recordingURL']=_0x426ca['serverUrl']+_0xcf04('0x83')+_0x4e24b0['uniqueid']+_0xcf04('0x85')+md5(_0x4e24b0[_0xcf04('0x84')]);}var _0x3bf698=_0x426ca['host']===_0xcf04('0x87')?'eu':_0xcf04('0x92');return getAccessToken(_0x426ca)[_0xcf04('0x2b')](function(_0x544844){_0x18cdb9=_0x544844;return getUser(_0x18cdb9,_0x3bf698,_0x426ca,_0x24ff4a[_0xcf04('0x88')]);})[_0xcf04('0x2b')](function(_0x51c49d){_0x5bd914=_0x51c49d;logger[_0xcf04('0x30')](_0xcf04('0x93'),_0x5bd914['id']);return getEndUser(_0x18cdb9,_0x3bf698,_0x426ca,_0x4e24b0[_0xcf04('0x94')],_0x4e24b0[_0xcf04('0x95')],_0x5bd914,_0x28649a);})[_0xcf04('0x2b')](function(_0x5502fa){_0x3001b7=_0x5502fa;return getCall(_0x18cdb9,_0x3bf698,_0x426ca,_0x5bd914,_0x3001b7,_0x28649a,_0x4e24b0,_0xcf04('0x96'));})[_0xcf04('0x2b')](function(_0x38b918){if(_0x38b918){logger[_0xcf04('0x30')]('The\x20Call\x20ID\x20is:',_0x38b918['id']);logger['info'](_0xcf04('0x91'),_0xcf04('0x8a'));emit(util['format']('user:%s',_0x24ff4a['name']),'trigger:browser:url',{'uri':_0xcf04('0x8d')+_0x426ca['host']+_0xcf04('0x8e')+_0x38b918['id']});}})[_0xcf04('0x2e')](function(_0x40dcef){logger[_0xcf04('0x2f')](_0xcf04('0x91'),JSON[_0xcf04('0xd')](_0x40dcef));});};exports[_0xcf04('0x97')]=function(_0xf8e9e7,_0x1e7bf8,_0xa14bf2,_0xf59908,_0x45931d,_0x1de310){var _0x425040,_0x29919a,_0x47f328;_0x1de310[_0xcf04('0x7d')]=intUtil['stripTrailingSlash'](_0x1de310['host']);_0x1de310[_0xcf04('0x7f')]=intUtil[_0xcf04('0x7e')](_0x1de310[_0xcf04('0x7f')]);if(_0x45931d&&_0x45931d[_0xcf04('0x80')]){logger['info']('['+_0x1e7bf8[_0xcf04('0x6c')][_0xcf04('0x98')]()+']',_0xcf04('0x82'));_0x1e7bf8[_0xcf04('0x86')]=_0x1de310[_0xcf04('0x7f')]+_0xcf04('0x83')+_0x1e7bf8[_0xcf04('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x1e7bf8['uniqueid']);}else{_0x1e7bf8[_0xcf04('0x86')]='';}var _0x13ab94=_0x1de310[_0xcf04('0x7d')]===_0xcf04('0x87')?'eu':'com';return getAccessToken(_0x1de310)[_0xcf04('0x2b')](function(_0x364468){_0x47f328=_0x364468;return getUser(_0x47f328,_0x13ab94,_0x1de310);})[_0xcf04('0x2b')](function(_0x289abe){_0x425040=_0x289abe;logger['info'](_0xcf04('0x93'),_0x425040['id']);return getEndUser(_0x47f328,_0x13ab94,_0x1de310,_0x1e7bf8[_0xcf04('0x99')],_0x1e7bf8[_0xcf04('0x89')],_0x425040,_0xa14bf2);})['then'](function(_0xc65840){_0x29919a=_0xc65840;return getCall(_0x47f328,_0x13ab94,_0x1de310,_0x425040,_0x29919a,_0xa14bf2,_0x1e7bf8,_0xcf04('0x77'));})[_0xcf04('0x2b')](function(_0x4f7116){if(_0x4f7116){logger['info'](_0xcf04('0x9a'),_0x4f7116['id']);}})['catch'](function(_0x26d526){logger['error']('['+_0x1e7bf8['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x26d526));});}; \ 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 62338b0..b2eea46 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 _0x58af=['Script','data3','render','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','../../../../config/logger','trigger','exec','data2'];(function(_0x12bbd7,_0x582221){var _0x27b029=function(_0x7f154d){while(--_0x7f154d){_0x12bbd7['push'](_0x12bbd7['shift']());}};_0x27b029(++_0x582221);}(_0x58af,0x103));var _0xf58a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x58af[_0x501510];return _0x1e6ee5;};'use strict';var util=require('util');var sh=require(_0xf58a('0x0'));var Mustache=require('mustache');var logger=require(_0xf58a('0x1'))(_0xf58a('0x2'));exports[_0xf58a('0x3')]=function(_0x2e7fa6,_0x25dfda){var _0x1a9b7a=_0x2e7fa6[_0xf58a('0x4')]?_0x2e7fa6['data2']:_0xf58a('0x5');var _0x248cec=_0x2e7fa6[_0xf58a('0x6')]?Mustache[_0xf58a('0x7')](_0x2e7fa6[_0xf58a('0x6')],_0x25dfda):_0x25dfda;sh[_0xf58a('0x3')](_0x248cec,function(_0x59517a,_0x5f9df5,_0x1af204){if(_0x59517a!==0x0){logger['error'](util['format']('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x1a9b7a,_0x248cec,_0x59517a,_0x1af204));}else{logger[_0xf58a('0x8')](util[_0xf58a('0x9')](_0xf58a('0xa'),_0x1a9b7a,_0x248cec,_0x5f9df5));}});}; \ No newline at end of file +var _0x149d=['util','shelljs','trigger','exec','data2','Script','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x149d,0xb4));var _0xd149=function(_0x22da77,_0x5edec5){_0x22da77=_0x22da77-0x0;var _0x3098f6=_0x149d[_0x22da77];return _0x3098f6;};'use strict';var util=require(_0xd149('0x0'));var sh=require(_0xd149('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0xd149('0x2'));exports[_0xd149('0x3')]=function(_0x4f0570,_0x5685ab){var _0x5c487a=_0x4f0570[_0xd149('0x4')]?_0x4f0570[_0xd149('0x4')]:_0xd149('0x5');var _0x2135db=_0x4f0570[_0xd149('0x6')]?Mustache['render'](_0x4f0570['data3'],_0x5685ab):_0x5685ab;sh[_0xd149('0x3')](_0x2135db,function(_0x4aafac,_0x42cb48,_0x132c2f){if(_0x4aafac!==0x0){logger[_0xd149('0x7')](util[_0xd149('0x8')](_0xd149('0x9'),_0x5c487a,_0x2135db,_0x4aafac,_0x132c2f));}else{logger['info'](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x5c487a,_0x2135db,_0x42cb48));}});}; \ 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 61c77c0..5922b5c 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 _0x1cbc=['format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','lodash','mustache','../../../../config/logger','data1','toUpperCase','render','data2','data5','number','headers','data6','parse','error','stack','POST','PUT','data7','body'];(function(_0x4ec158,_0x473af9){var _0x23d9c3=function(_0x239fa7){while(--_0x239fa7){_0x4ec158['push'](_0x4ec158['shift']());}};_0x23d9c3(++_0x473af9);}(_0x1cbc,0x8d));var _0xc1cb=function(_0x4edd73,_0x31c9f4){_0x4edd73=_0x4edd73-0x0;var _0x60a855=_0x1cbc[_0x4edd73];return _0x60a855;};'use strict';var rp=require(_0xc1cb('0x0'));var util=require('util');var _=require(_0xc1cb('0x1'));var Mustache=require(_0xc1cb('0x2'));var logger=require(_0xc1cb('0x3'))('trigger');exports['exec']=function(_0x125d58,_0x97f3a5){var _0x571956,_0x42e0dc;var _0x2d80fe={'method':_0x125d58[_0xc1cb('0x4')][_0xc1cb('0x5')](),'uri':Mustache[_0xc1cb('0x6')](_0x125d58[_0xc1cb('0x7')],_0x97f3a5),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x125d58[_0xc1cb('0x8')])===_0xc1cb('0x9')&&parseInt(_0x125d58[_0xc1cb('0x8')])>=0x1&&parseInt(_0x125d58[_0xc1cb('0x8')])<=0xa?parseInt(_0x125d58[_0xc1cb('0x8')])*0x3e8:0x5*0x3e8};try{_0x2d80fe[_0xc1cb('0xa')]=_0x125d58[_0xc1cb('0xb')]?JSON[_0xc1cb('0xc')](Mustache[_0xc1cb('0x6')](_0x125d58['data6'],_0x97f3a5)):{};}catch(_0x216acc){logger[_0xc1cb('0xd')](_0x216acc[_0xc1cb('0xe')]);}switch(_0x125d58[_0xc1cb('0x4')][_0xc1cb('0x5')]()){case'GET':case'DELETE':_0x571956=null;_0x2d80fe['qs']=_0x97f3a5;break;case _0xc1cb('0xf'):case _0xc1cb('0x10'):if(_0x125d58[_0xc1cb('0x11')]){try{_0x571956=JSON[_0xc1cb('0xc')](Mustache['render'](_0x125d58[_0xc1cb('0x11')],_0x97f3a5));_0x2d80fe[_0xc1cb('0x12')]=_0x571956;}catch(_0x1a3c48){logger[_0xc1cb('0xd')](_0x1a3c48['stack']);logger[_0xc1cb('0xd')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x571956=_0x97f3a5;_0x2d80fe[_0xc1cb('0x12')]=_0x571956;}break;}logger['info'](util[_0xc1cb('0x13')](_0xc1cb('0x14'),_0x125d58[_0xc1cb('0x4')],_0x125d58[_0xc1cb('0x7')],JSON[_0xc1cb('0x15')](_0x2d80fe)));rp(_0x2d80fe)[_0xc1cb('0x16')](function(_0x134795){_0x571956=!_['isNil'](_0x571956)?_0xc1cb('0x17')+_0x571956:'';_0x42e0dc=typeof _0x134795[_0xc1cb('0x12')]===_0xc1cb('0x18')?JSON[_0xc1cb('0x15')](_0x134795[_0xc1cb('0x12')]):_0x134795[_0xc1cb('0x12')];logger[_0xc1cb('0x19')](util[_0xc1cb('0x13')](_0xc1cb('0x1a'),_0x125d58['data1'],_0x125d58[_0xc1cb('0x7')],_0x134795[_0xc1cb('0x1b')],_0x42e0dc));})[_0xc1cb('0x1c')](function(_0x11a8c8){logger[_0xc1cb('0xd')](util['format'](_0xc1cb('0x1d'),_0x125d58['data1'],_0x125d58[_0xc1cb('0x7')],_0x11a8c8[_0xc1cb('0x1b')],_0x11a8c8[_0xc1cb('0x1e')],_0x11a8c8[_0xc1cb('0x1f')]));});}; \ No newline at end of file +var _0x43fe=['%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','../../../../config/logger','exec','data1','render','data2','data5','data6','error','stack','toUpperCase','GET','DELETE','PUT','parse','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then'];(function(_0x22a518,_0x4dd9a6){var _0x5395a9=function(_0x55eeb3){while(--_0x55eeb3){_0x22a518['push'](_0x22a518['shift']());}};_0x5395a9(++_0x4dd9a6);}(_0x43fe,0x101));var _0xe43f=function(_0x16d89f,_0x38be82){_0x16d89f=_0x16d89f-0x0;var _0x93fe98=_0x43fe[_0x16d89f];return _0x93fe98;};'use strict';var rp=require('request-promise');var util=require(_0xe43f('0x0'));var _=require('lodash');var Mustache=require('mustache');var logger=require(_0xe43f('0x1'))('trigger');exports[_0xe43f('0x2')]=function(_0x384b83,_0x55b167){var _0x2b10f8,_0x3d2cbe;var _0x212815={'method':_0x384b83[_0xe43f('0x3')]['toUpperCase'](),'uri':Mustache[_0xe43f('0x4')](_0x384b83[_0xe43f('0x5')],_0x55b167),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x384b83[_0xe43f('0x6')])==='number'&&parseInt(_0x384b83[_0xe43f('0x6')])>=0x1&&parseInt(_0x384b83[_0xe43f('0x6')])<=0xa?parseInt(_0x384b83[_0xe43f('0x6')])*0x3e8:0x5*0x3e8};try{_0x212815['headers']=_0x384b83[_0xe43f('0x7')]?JSON['parse'](Mustache['render'](_0x384b83[_0xe43f('0x7')],_0x55b167)):{};}catch(_0x23208d){logger[_0xe43f('0x8')](_0x23208d[_0xe43f('0x9')]);}switch(_0x384b83[_0xe43f('0x3')][_0xe43f('0xa')]()){case _0xe43f('0xb'):case _0xe43f('0xc'):_0x2b10f8=null;_0x212815['qs']=_0x55b167;break;case'POST':case _0xe43f('0xd'):if(_0x384b83['data7']){try{_0x2b10f8=JSON[_0xe43f('0xe')](Mustache[_0xe43f('0x4')](_0x384b83[_0xe43f('0xf')],_0x55b167));_0x212815[_0xe43f('0x10')]=_0x2b10f8;}catch(_0x1f181a){logger[_0xe43f('0x8')](_0x1f181a[_0xe43f('0x9')]);logger['error'](_0xe43f('0x11'));}}else{_0x2b10f8=_0x55b167;_0x212815[_0xe43f('0x10')]=_0x2b10f8;}break;}logger[_0xe43f('0x12')](util[_0xe43f('0x13')](_0xe43f('0x14'),_0x384b83[_0xe43f('0x3')],_0x384b83[_0xe43f('0x5')],JSON[_0xe43f('0x15')](_0x212815)));rp(_0x212815)[_0xe43f('0x16')](function(_0x511a70){_0x2b10f8=!_['isNil'](_0x2b10f8)?',\x20request\x20body:\x20'+_0x2b10f8:'';_0x3d2cbe=typeof _0x511a70[_0xe43f('0x10')]==='object'?JSON[_0xe43f('0x15')](_0x511a70['body']):_0x511a70[_0xe43f('0x10')];logger[_0xe43f('0x12')](util[_0xe43f('0x13')](_0xe43f('0x17'),_0x384b83[_0xe43f('0x3')],_0x384b83[_0xe43f('0x5')],_0x511a70[_0xe43f('0x18')],_0x3d2cbe));})[_0xe43f('0x19')](function(_0x17b772){logger[_0xe43f('0x8')](util[_0xe43f('0x13')](_0xe43f('0x1a'),_0x384b83[_0xe43f('0x3')],_0x384b83[_0xe43f('0x5')],_0x17b772[_0xe43f('0x18')],_0x17b772[_0xe43f('0x1b')],_0x17b772['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 8a519f4..f671121 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 _0x1f22=['result','catch','rpc','exports','jayson/promise','client','request','then','debug','routing','error','message'];(function(_0x2e914,_0x1c7566){var _0x936e45=function(_0x1b22e4){while(--_0x1b22e4){_0x2e914['push'](_0x2e914['shift']());}};_0x936e45(++_0x1c7566);}(_0x1f22,0x16c));var _0x21f2=function(_0x453041,_0x80cac4){_0x453041=_0x453041-0x0;var _0x1b8546=_0x1f22[_0x453041];return _0x1b8546;};'use strict';var jayson=require(_0x21f2('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('routing');var client=jayson[_0x21f2('0x1')]['http']({'port':0x2329});client['Request']=function(_0x3fdfaa,_0x45c916){return new BPromise(function(_0x4f376a,_0x1a71f1){return client[_0x21f2('0x2')](_0x3fdfaa,_0x45c916)[_0x21f2('0x3')](function(_0x3286ca){logger[_0x21f2('0x4')]('rpc',_0x21f2('0x5'),_0x3fdfaa,_0x45c916,_0x3286ca);if(_0x3286ca['error']){logger[_0x21f2('0x6')]('rpc',_0x21f2('0x5'),_0x3fdfaa,_0x3286ca[_0x21f2('0x6')]['message'],_0x45c916);return _0x1a71f1(_0x3286ca[_0x21f2('0x6')][_0x21f2('0x7')]);}else{return _0x4f376a(_0x3286ca[_0x21f2('0x8')]);}})[_0x21f2('0x9')](function(_0x363972){logger[_0x21f2('0x6')](_0x21f2('0xa'),_0x21f2('0x5'),_0x3fdfaa,_0x363972,_0x45c916);return _0x1a71f1(_0x363972);});});};module[_0x21f2('0xb')]=client; \ No newline at end of file +var _0x49ad=['result','catch','jayson/promise','bluebird','../../config/logger','client','http','Request','then','debug','routing','error','rpc','message'];(function(_0x56d6e5,_0x4f5a1a){var _0x14b59f=function(_0x2571b2){while(--_0x2571b2){_0x56d6e5['push'](_0x56d6e5['shift']());}};_0x14b59f(++_0x4f5a1a);}(_0x49ad,0x10c));var _0xd49a=function(_0x49f584,_0x426fee){_0x49f584=_0x49f584-0x0;var _0x5b8269=_0x49ad[_0x49f584];return _0x5b8269;};'use strict';var jayson=require(_0xd49a('0x0'));var BPromise=require(_0xd49a('0x1'));var logger=require(_0xd49a('0x2'))('routing');var client=jayson[_0xd49a('0x3')][_0xd49a('0x4')]({'port':0x2329});client[_0xd49a('0x5')]=function(_0x472855,_0x4ce1a2){return new BPromise(function(_0x3418dd,_0x318ccb){return client['request'](_0x472855,_0x4ce1a2)[_0xd49a('0x6')](function(_0x452a38){logger[_0xd49a('0x7')]('rpc',_0xd49a('0x8'),_0x472855,_0x4ce1a2,_0x452a38);if(_0x452a38['error']){logger[_0xd49a('0x9')](_0xd49a('0xa'),'routing',_0x472855,_0x452a38[_0xd49a('0x9')][_0xd49a('0xb')],_0x4ce1a2);return _0x318ccb(_0x452a38[_0xd49a('0x9')][_0xd49a('0xb')]);}else{return _0x3418dd(_0x452a38[_0xd49a('0xc')]);}})[_0xd49a('0xd')](function(_0x9953b5){logger['error']('rpc',_0xd49a('0x8'),_0x472855,_0x9953b5,_0x4ce1a2);return _0x318ccb(_0x9953b5);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 1402eee..3b37482 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 _0x840a=['initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','./server','./realtime','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then'];(function(_0x2c798e,_0x5dfff6){var _0x42d734=function(_0x4ca299){while(--_0x4ca299){_0x2c798e['push'](_0x2c798e['shift']());}};_0x42d734(++_0x5dfff6);}(_0x840a,0x1d8));var _0xa840=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x840a[_0x2641f9];return _0x585741;};'use strict';var server=require(_0xa840('0x0'));var Realtime=require(_0xa840('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xa840('0x2'));var setting=require(_0xa840('0x3'));var logger=require(_0xa840('0x4'))(_0xa840('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xa840('0x6')]()[_0xa840('0x7')](mailAccount['getMailAccounts']())[_0xa840('0x7')](realtime[_0xa840('0x8')]())['then'](function(){email['refresh'](realtime[_0xa840('0x9')]);return realtime;});}function main(){return server[_0xa840('0xa')](realtime,email)[_0xa840('0x7')](function(){return initRealtime();})[_0xa840('0x7')](function(){return setting[_0xa840('0xb')]();})[_0xa840('0x7')](function(_0x2ab231){return setInterval(initRealtime,_0x2ab231[_0xa840('0xc')]*0x3e8);})[_0xa840('0xd')](function(_0x587f3d){logger[_0xa840('0xe')]('Email\x20service\x20initialization',_0x587f3d);});}main(); \ No newline at end of file +var _0x58f7=['resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email'];(function(_0x24e23d,_0x26684a){var _0x14db43=function(_0x23ff5a){while(--_0x23ff5a){_0x24e23d['push'](_0x24e23d['shift']());}};_0x14db43(++_0x26684a);}(_0x58f7,0x1b4));var _0x758f=function(_0x5850c0,_0x3c2c){_0x5850c0=_0x5850c0-0x0;var _0x113882=_0x58f7[_0x5850c0];return _0x113882;};'use strict';var server=require('./server');var Realtime=require(_0x758f('0x0'));var EmailChannel=require(_0x758f('0x1'));var mailAccount=require(_0x758f('0x2'));var setting=require(_0x758f('0x3'));var logger=require(_0x758f('0x4'))(_0x758f('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x758f('0x6')]()[_0x758f('0x7')](mailAccount[_0x758f('0x8')]())[_0x758f('0x7')](realtime[_0x758f('0x9')]())[_0x758f('0x7')](function(){email[_0x758f('0xa')](realtime[_0x758f('0xb')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x758f('0x7')](function(){return initRealtime();})[_0x758f('0x7')](function(){return setting[_0x758f('0xc')]();})[_0x758f('0x7')](function(_0x396e2e){return setInterval(initRealtime,_0x396e2e[_0x758f('0xd')]*0x3e8);})[_0x758f('0xe')](function(_0x1259fa){logger[_0x758f('0xf')](_0x758f('0x10'),_0x1259fa);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index a3423ae..5319c53 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 _0xac23=['ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','Imap','status','messageStatus','total','isNil','refresh','hasOwnProperty','active','service','custom','provider','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','lastSync','sendMail','verifySmtp','Smtp','verify','verified','lodash','moment','bluebird','md5'];(function(_0x50c3fe,_0x1d1776){var _0x50b2f2=function(_0x105468){while(--_0x105468){_0x50c3fe['push'](_0x50c3fe['shift']());}};_0x50b2f2(++_0x1d1776);}(_0xac23,0xd4));var _0x3ac2=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0xac23[_0x45313f];return _0x402910;};'use strict';var _=require(_0x3ac2('0x0'));var moment=require(_0x3ac2('0x1'));var BPromise=require(_0x3ac2('0x2'));var md5=require(_0x3ac2('0x3'));var Redis=require(_0x3ac2('0x4'));var config=require(_0x3ac2('0x5'));var logger=require(_0x3ac2('0x6'))(_0x3ac2('0x7'));config[_0x3ac2('0x8')]=_[_0x3ac2('0x9')](config[_0x3ac2('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x3ac2('0xa'))(new Redis(config[_0x3ac2('0x8')]));var EmailImap=require(_0x3ac2('0xb'));var EmailSmtp=require(_0x3ac2('0xc'));var mailAccount=require(_0x3ac2('0xd'));var md5Accounts={};function EmailChannel(_0x5d50d9){logger[_0x3ac2('0xe')]('start\x20email\x20channel');this[_0x3ac2('0xf')]=_0x5d50d9[_0x3ac2('0xf')];this[_0x3ac2('0x10')]={};this[_0x3ac2('0x11')]=new EmailSmtp();}EmailChannel[_0x3ac2('0x12')][_0x3ac2('0x13')]=function(_0x2781e9){var _0x5ef9c4=this[_0x3ac2('0xf')][_0x2781e9];var _0x3a0c97={'id':_0x5ef9c4['id'],'name':_0x5ef9c4[_0x3ac2('0x14')],'key':_0x5ef9c4['key'],'active':_0x5ef9c4['active'],'Imap':{'status':_0x5ef9c4[_0x3ac2('0x15')][_0x3ac2('0x16')],'messageStatus':_0x5ef9c4[_0x3ac2('0x15')][_0x3ac2('0x17')],'total':_0x5ef9c4[_0x3ac2('0x15')][_0x3ac2('0x18')]}};if(_[_0x3ac2('0x19')](md5Accounts[_0x2781e9])){md5Accounts[_0x2781e9]={};}var _0x1f0b34=md5(JSON['stringify'](_0x3a0c97));if(md5Accounts[_0x2781e9]['md5']!==_0x1f0b34){md5Accounts[_0x2781e9][_0x3ac2('0x3')]=_0x1f0b34;io[_0x3ac2('0x13')]('mailAccount:update',_0x3a0c97);}};EmailChannel[_0x3ac2('0x12')][_0x3ac2('0x1a')]=function(_0x27100c){for(var _0x44c52c in _0x27100c){if(_0x27100c[_0x3ac2('0x1b')](_0x44c52c)){if(_0x27100c[_0x44c52c][_0x3ac2('0x15')]&&_0x27100c[_0x44c52c][_0x3ac2('0x1c')]){var _0x5181e8=_0x27100c[_0x44c52c][_0x3ac2('0x15')];if(!_0x5181e8[_0x3ac2('0x1d')]&&_0x27100c[_0x44c52c]['provider']!==_0x3ac2('0x1e'))_0x5181e8['service']=_0x27100c[_0x44c52c][_0x3ac2('0x1f')];if(!this[_0x3ac2('0x10')][_0x3ac2('0x1b')](_0x5181e8['id'])){this[_0x3ac2('0x10')][_0x5181e8['id']]=new EmailImap(_0x5181e8,_0x27100c[_0x44c52c]['email']);this[_0x3ac2('0x10')][_0x5181e8['id']]['on']('box',this[_0x3ac2('0x20')][_0x3ac2('0x21')](this,_0x44c52c));this[_0x3ac2('0x10')][_0x5181e8['id']]['on']('email',this[_0x3ac2('0x22')][_0x3ac2('0x21')](this,_0x44c52c));this[_0x3ac2('0x10')][_0x5181e8['id']]['on'](_0x3ac2('0x23'),this[_0x3ac2('0x24')][_0x3ac2('0x21')](this,_0x44c52c));this[_0x3ac2('0x10')][_0x5181e8['id']]['on'](_0x3ac2('0x25'),this[_0x3ac2('0x26')][_0x3ac2('0x21')](this,_0x44c52c));}}else{if(_[_0x3ac2('0x19')](this[_0x3ac2('0xf')][_0x44c52c][_0x3ac2('0x15')])){this[_0x3ac2('0xf')][_0x44c52c]['Imap']={};}this[_0x3ac2('0xf')][_0x44c52c][_0x3ac2('0x15')][_0x3ac2('0x16')]=_0x3ac2('0x27');this['mailAccounts'][_0x44c52c][_0x3ac2('0x15')][_0x3ac2('0x17')]='';this['emit'](_0x44c52c);}}}};EmailChannel[_0x3ac2('0x12')][_0x3ac2('0x20')]=function(_0x47fa4d,_0x50d300){if(this[_0x3ac2('0xf')][_0x47fa4d]){this[_0x3ac2('0xf')][_0x47fa4d][_0x3ac2('0x15')][_0x3ac2('0x16')]=_0x3ac2('0x28');this['mailAccounts'][_0x47fa4d][_0x3ac2('0x15')][_0x3ac2('0x17')]=_0x50d300[_0x3ac2('0x14')];if(_0x50d300['messages']){this[_0x3ac2('0xf')][_0x47fa4d]['Imap'][_0x3ac2('0x18')]=_0x50d300[_0x3ac2('0x29')][_0x3ac2('0x18')];}return this[_0x3ac2('0x13')](_0x47fa4d);}};EmailChannel[_0x3ac2('0x12')][_0x3ac2('0x22')]=function(_0x1d104c,_0x1cfc88){logger['info'](_0x3ac2('0x2a'),_0x1cfc88['firstName'],_0x1cfc88['lastName'],_0x1cfc88[_0x3ac2('0x2b')],_0x1d104c);if(this[_0x3ac2('0xf')][_0x1d104c]){return mailAccount[_0x3ac2('0x2c')](_0x1d104c,_0x1cfc88)[_0x3ac2('0x2d')](function(_0x542637){if(_0x542637){logger[_0x3ac2('0xe')](_0x3ac2('0x2e'));}})[_0x3ac2('0x2f')](function(_0xbe4e38){logger[_0x3ac2('0x25')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0xbe4e38));});}};EmailChannel['prototype'][_0x3ac2('0x24')]=function(_0x50d7c2){if(this['mailAccounts'][_0x50d7c2]&&this[_0x3ac2('0xf')][_0x50d7c2][_0x3ac2('0x15')]){if(this['imapAccounts'][this[_0x3ac2('0xf')][_0x50d7c2]['Imap']['id']]){delete this[_0x3ac2('0x10')][this[_0x3ac2('0xf')][_0x50d7c2][_0x3ac2('0x15')]['id']];}this[_0x3ac2('0xf')][_0x50d7c2][_0x3ac2('0x15')][_0x3ac2('0x30')]=moment();this['emit'](_0x50d7c2);}};EmailChannel[_0x3ac2('0x12')][_0x3ac2('0x26')]=function(_0x5d217a,_0x499c25){if(this['mailAccounts'][_0x5d217a]){this['mailAccounts'][_0x5d217a][_0x3ac2('0x15')]['status']='error';this[_0x3ac2('0xf')][_0x5d217a][_0x3ac2('0x15')][_0x3ac2('0x17')]=_0x499c25;return this[_0x3ac2('0x13')](_0x5d217a);}};EmailChannel[_0x3ac2('0x12')][_0x3ac2('0x31')]=function(_0x50bab0,_0x1d4b5a){return this['smtp']['send'](_0x50bab0,_0x1d4b5a);};EmailChannel[_0x3ac2('0x12')][_0x3ac2('0x32')]=function(_0x40505a){var _0x29b4b8=this;if(this[_0x3ac2('0xf')][_0x40505a['id']]){if(_[_0x3ac2('0x19')](this[_0x3ac2('0xf')][_0x40505a['id']]['Smtp'])){this[_0x3ac2('0xf')][_0x40505a['id']]['Smtp']={};}this[_0x3ac2('0xf')][_0x40505a['id']][_0x3ac2('0x33')]['lastSync']=moment();return new BPromise(function(_0x4a2a97,_0x3db54d){return _0x29b4b8[_0x3ac2('0x11')][_0x3ac2('0x34')](_0x40505a)[_0x3ac2('0x2d')](function(_0x31aabc){_0x29b4b8['mailAccounts'][_0x40505a['id']][_0x3ac2('0x33')]['status']=_0x3ac2('0x35');_0x29b4b8[_0x3ac2('0xf')][_0x40505a['id']]['Smtp'][_0x3ac2('0x17')]='';_0x29b4b8[_0x3ac2('0x13')](_0x40505a['id']);_0x4a2a97(_0x31aabc);})[_0x3ac2('0x2f')](function(_0x519818){_0x29b4b8[_0x3ac2('0xf')][_0x40505a['id']][_0x3ac2('0x33')][_0x3ac2('0x16')]=_0x3ac2('0x25');_0x29b4b8['mailAccounts'][_0x40505a['id']]['Smtp'][_0x3ac2('0x17')]=_0x519818;_0x29b4b8[_0x3ac2('0x13')](_0x40505a['id']);_0x3db54d(_0x519818);});});}return this['smtp']['verify'](_0x40505a);};module['exports']=EmailChannel; \ No newline at end of file +var _0x96e6=['Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','send','Smtp','verify','verified','catch','exports','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','defaults','socket.io-emitter','redis','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','name','key','active','Imap','status','messageStatus','total','isNil','stringify','md5','mailAccount:update','hasOwnProperty','service','provider','custom','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','emit','handleImapBox','messages','from','notify','then','Mail\x20accepted\x20from\x20routing'];(function(_0x5e77db,_0x356d1c){var _0x34b675=function(_0x4914b5){while(--_0x4914b5){_0x5e77db['push'](_0x5e77db['shift']());}};_0x34b675(++_0x356d1c);}(_0x96e6,0x116));var _0x696e=function(_0x47bc94,_0x1b1e48){_0x47bc94=_0x47bc94-0x0;var _0x4065c1=_0x96e6[_0x47bc94];return _0x4065c1;};'use strict';var _=require('lodash');var moment=require(_0x696e('0x0'));var BPromise=require(_0x696e('0x1'));var md5=require('md5');var Redis=require(_0x696e('0x2'));var config=require(_0x696e('0x3'));var logger=require(_0x696e('0x4'))(_0x696e('0x5'));config['redis']=_[_0x696e('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x696e('0x7'))(new Redis(config[_0x696e('0x8')]));var EmailImap=require(_0x696e('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x696e('0xa'));var md5Accounts={};function EmailChannel(_0x283b62){logger[_0x696e('0xb')](_0x696e('0xc'));this[_0x696e('0xd')]=_0x283b62['mailAccounts'];this[_0x696e('0xe')]={};this[_0x696e('0xf')]=new EmailSmtp();}EmailChannel[_0x696e('0x10')]['emit']=function(_0x506a80){var _0xfd2c86=this[_0x696e('0xd')][_0x506a80];var _0x485d65={'id':_0xfd2c86['id'],'name':_0xfd2c86[_0x696e('0x11')],'key':_0xfd2c86[_0x696e('0x12')],'active':_0xfd2c86[_0x696e('0x13')],'Imap':{'status':_0xfd2c86[_0x696e('0x14')][_0x696e('0x15')],'messageStatus':_0xfd2c86[_0x696e('0x14')][_0x696e('0x16')],'total':_0xfd2c86[_0x696e('0x14')][_0x696e('0x17')]}};if(_[_0x696e('0x18')](md5Accounts[_0x506a80])){md5Accounts[_0x506a80]={};}var _0x31c7e2=md5(JSON[_0x696e('0x19')](_0x485d65));if(md5Accounts[_0x506a80][_0x696e('0x1a')]!==_0x31c7e2){md5Accounts[_0x506a80][_0x696e('0x1a')]=_0x31c7e2;io['emit'](_0x696e('0x1b'),_0x485d65);}};EmailChannel['prototype']['refresh']=function(_0x592d00){for(var _0x43c73b in _0x592d00){if(_0x592d00[_0x696e('0x1c')](_0x43c73b)){if(_0x592d00[_0x43c73b][_0x696e('0x14')]&&_0x592d00[_0x43c73b]['active']){var _0x478725=_0x592d00[_0x43c73b][_0x696e('0x14')];if(!_0x478725[_0x696e('0x1d')]&&_0x592d00[_0x43c73b][_0x696e('0x1e')]!==_0x696e('0x1f'))_0x478725[_0x696e('0x1d')]=_0x592d00[_0x43c73b][_0x696e('0x1e')];if(!this[_0x696e('0xe')][_0x696e('0x1c')](_0x478725['id'])){this[_0x696e('0xe')][_0x478725['id']]=new EmailImap(_0x478725,_0x592d00[_0x43c73b][_0x696e('0x5')]);this[_0x696e('0xe')][_0x478725['id']]['on']('box',this['handleImapBox'][_0x696e('0x20')](this,_0x43c73b));this[_0x696e('0xe')][_0x478725['id']]['on'](_0x696e('0x5'),this[_0x696e('0x21')][_0x696e('0x20')](this,_0x43c73b));this['imapAccounts'][_0x478725['id']]['on'](_0x696e('0x22'),this[_0x696e('0x23')]['bind'](this,_0x43c73b));this[_0x696e('0xe')][_0x478725['id']]['on'](_0x696e('0x24'),this[_0x696e('0x25')][_0x696e('0x20')](this,_0x43c73b));}}else{if(_[_0x696e('0x18')](this[_0x696e('0xd')][_0x43c73b][_0x696e('0x14')])){this[_0x696e('0xd')][_0x43c73b][_0x696e('0x14')]={};}this[_0x696e('0xd')][_0x43c73b][_0x696e('0x14')][_0x696e('0x15')]=_0x696e('0x26');this[_0x696e('0xd')][_0x43c73b][_0x696e('0x14')][_0x696e('0x16')]='';this[_0x696e('0x27')](_0x43c73b);}}}};EmailChannel[_0x696e('0x10')][_0x696e('0x28')]=function(_0x455bc2,_0x3e6f46){if(this[_0x696e('0xd')][_0x455bc2]){this['mailAccounts'][_0x455bc2][_0x696e('0x14')]['status']='connected';this[_0x696e('0xd')][_0x455bc2][_0x696e('0x14')]['messageStatus']=_0x3e6f46[_0x696e('0x11')];if(_0x3e6f46[_0x696e('0x29')]){this['mailAccounts'][_0x455bc2][_0x696e('0x14')][_0x696e('0x17')]=_0x3e6f46[_0x696e('0x29')]['total'];}return this['emit'](_0x455bc2);}};EmailChannel[_0x696e('0x10')][_0x696e('0x21')]=function(_0x58bce3,_0x117921){logger[_0x696e('0xb')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x117921['firstName'],_0x117921['lastName'],_0x117921[_0x696e('0x2a')],_0x58bce3);if(this[_0x696e('0xd')][_0x58bce3]){return mailAccount[_0x696e('0x2b')](_0x58bce3,_0x117921)[_0x696e('0x2c')](function(_0x3a9fb5){if(_0x3a9fb5){logger[_0x696e('0xb')](_0x696e('0x2d'));}})['catch'](function(_0x585410){logger['error'](_0x696e('0x2e'),JSON[_0x696e('0x19')](_0x585410));});}};EmailChannel[_0x696e('0x10')]['handleImapEnd']=function(_0x43042e){if(this[_0x696e('0xd')][_0x43042e]&&this['mailAccounts'][_0x43042e][_0x696e('0x14')]){if(this[_0x696e('0xe')][this[_0x696e('0xd')][_0x43042e][_0x696e('0x14')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x43042e][_0x696e('0x14')]['id']];}this[_0x696e('0xd')][_0x43042e][_0x696e('0x14')][_0x696e('0x2f')]=moment();this[_0x696e('0x27')](_0x43042e);}};EmailChannel[_0x696e('0x10')][_0x696e('0x25')]=function(_0x505d84,_0x1e5375){if(this[_0x696e('0xd')][_0x505d84]){this[_0x696e('0xd')][_0x505d84]['Imap'][_0x696e('0x15')]=_0x696e('0x24');this['mailAccounts'][_0x505d84][_0x696e('0x14')][_0x696e('0x16')]=_0x1e5375;return this[_0x696e('0x27')](_0x505d84);}};EmailChannel[_0x696e('0x10')]['sendMail']=function(_0x555f66,_0x46d0de){return this['smtp'][_0x696e('0x30')](_0x555f66,_0x46d0de);};EmailChannel[_0x696e('0x10')]['verifySmtp']=function(_0x14ed5e){var _0x37dda4=this;if(this[_0x696e('0xd')][_0x14ed5e['id']]){if(_[_0x696e('0x18')](this['mailAccounts'][_0x14ed5e['id']][_0x696e('0x31')])){this[_0x696e('0xd')][_0x14ed5e['id']][_0x696e('0x31')]={};}this[_0x696e('0xd')][_0x14ed5e['id']][_0x696e('0x31')][_0x696e('0x2f')]=moment();return new BPromise(function(_0x13660a,_0x4ad2d7){return _0x37dda4[_0x696e('0xf')][_0x696e('0x32')](_0x14ed5e)[_0x696e('0x2c')](function(_0x239e5a){_0x37dda4[_0x696e('0xd')][_0x14ed5e['id']][_0x696e('0x31')][_0x696e('0x15')]=_0x696e('0x33');_0x37dda4[_0x696e('0xd')][_0x14ed5e['id']][_0x696e('0x31')][_0x696e('0x16')]='';_0x37dda4[_0x696e('0x27')](_0x14ed5e['id']);_0x13660a(_0x239e5a);})[_0x696e('0x34')](function(_0x47ddbe){_0x37dda4[_0x696e('0xd')][_0x14ed5e['id']]['Smtp'][_0x696e('0x15')]=_0x696e('0x24');_0x37dda4['mailAccounts'][_0x14ed5e['id']]['Smtp'][_0x696e('0x16')]=_0x47ddbe;_0x37dda4[_0x696e('0x27')](_0x14ed5e['id']);_0x4ad2d7(_0x47ddbe);});});}return this[_0x696e('0xf')][_0x696e('0x32')](_0x14ed5e);};module[_0x696e('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 45ba0fe..366715e 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 _0xdf1f=['box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','emit','handleFetchError','stringify','textCode','upperFirst','lodash','imap','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','account','getAccount','once','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','password','authentication','host','port','tls','required','handleReady','handleOpenBox','bind'];(function(_0x122f78,_0x3f9f1f){var _0x3084ee=function(_0x614a9a){while(--_0x614a9a){_0x122f78['push'](_0x122f78['shift']());}};_0x3084ee(++_0x3f9f1f);}(_0xdf1f,0x10c));var _0xfdf1=function(_0x1e3ae7,_0x4f46f7){_0x1e3ae7=_0x1e3ae7-0x0;var _0x4c8a23=_0xdf1f[_0x1e3ae7];return _0x4c8a23;};'use strict';var _=require(_0xfdf1('0x0'));var util=require('util');var Imap=require(_0xfdf1('0x1'));var simpleParser=require(_0xfdf1('0x2'))[_0xfdf1('0x3')];var Iconv=require(_0xfdf1('0x4'))[_0xfdf1('0x5')];var EventEmitter=require(_0xfdf1('0x6'))['EventEmitter'];var utils=require(_0xfdf1('0x7'));var logger=require(_0xfdf1('0x8'))(_0xfdf1('0x9'));function EmailImap(_0x5da99c,_0x4b1909){this['mailbox']=_0x5da99c[_0xfdf1('0xa')];this[_0xfdf1('0xb')]=this[_0xfdf1('0xc')](_0x5da99c,_0x4b1909);this['imap']=new Imap(this[_0xfdf1('0xb')]);this[_0xfdf1('0x1')][_0xfdf1('0xd')]('ready',this['handleReady']['bind'](this));this['imap'][_0xfdf1('0xd')](_0xfdf1('0xe'),this[_0xfdf1('0xf')]['bind'](this));this['imap']['on'](_0xfdf1('0x10'),this[_0xfdf1('0x11')]['bind'](this));this[_0xfdf1('0x1')][_0xfdf1('0x12')]();}util[_0xfdf1('0x13')](EmailImap,EventEmitter);EmailImap[_0xfdf1('0x14')][_0xfdf1('0xc')]=function(_0x547f95,_0x2b7157){var _0x3d19a6={'connTimeout':_0x547f95[_0xfdf1('0x15')]?_0x547f95[_0xfdf1('0x15')]*0x3e8:0x2710,'authTimeout':_0x547f95[_0xfdf1('0x16')]?_0x547f95['authTimeout']*0x3e8:0x1388};if(_0x547f95['service']){_0x3d19a6[_0xfdf1('0x17')]=_0x547f95[_0xfdf1('0x17')];if(_0x547f95[_0xfdf1('0x18')]){_0x3d19a6[_0xfdf1('0x19')]=utils[_0xfdf1('0x1a')](_0x547f95[_0xfdf1('0x1b')]['data5'],_0x547f95['user']);}else{_0x3d19a6[_0xfdf1('0x1c')]=_0x547f95[_0xfdf1('0x1c')];}}else{if(_0x547f95[_0xfdf1('0x1d')]){_0x3d19a6[_0xfdf1('0x17')]=_0x547f95[_0xfdf1('0x17')];_0x3d19a6[_0xfdf1('0x1c')]=_0x547f95[_0xfdf1('0x1c')];}}_0x3d19a6['email']=_0x2b7157||_0x547f95[_0xfdf1('0x17')]||'anonymous@xcally.com';_0x3d19a6[_0xfdf1('0x1e')]=_0x547f95['host'];_0x3d19a6['port']=_0x547f95[_0xfdf1('0x1f')]||0x3e1;if(_0x547f95['tls']){_0x3d19a6['tls']=!![];}else{_0x3d19a6[_0xfdf1('0x20')]=![];_0x3d19a6['autotls']=_0xfdf1('0x21');}return _0x3d19a6;};EmailImap['prototype'][_0xfdf1('0x22')]=function(){this[_0xfdf1('0x1')]['openBox'](this[_0xfdf1('0xa')],![],this[_0xfdf1('0x23')][_0xfdf1('0x24')](this));};EmailImap[_0xfdf1('0x14')][_0xfdf1('0x23')]=function(_0x121c96,_0x49f595){if(_0x121c96){this[_0xfdf1('0x11')](_0x121c96,!![]);}else{this['emit'](_0xfdf1('0x25'),_0x49f595);this['readUnseen']();}};EmailImap[_0xfdf1('0x14')][_0xfdf1('0x26')]=function(_0x1f6107){if(_0x1f6107){this['handleError'](_0x1f6107,!![]);}else{this['imap'][_0xfdf1('0xe')]();}};EmailImap[_0xfdf1('0x14')][_0xfdf1('0x27')]=function(){this[_0xfdf1('0x1')][_0xfdf1('0x28')]([_0xfdf1('0x29')],this[_0xfdf1('0x2a')][_0xfdf1('0x24')](this));};EmailImap['prototype'][_0xfdf1('0x2a')]=function(_0x19c8a0,_0x592aa2){if(_0x19c8a0){this[_0xfdf1('0x11')](_0x19c8a0,!![]);}else{if(_0x592aa2[_0xfdf1('0x2b')]){try{var _0x197cf0=this[_0xfdf1('0x1')][_0xfdf1('0x2c')](_0x592aa2['slice'](0x0,0xa),{'bodies':'','markSeen':!![]});_0x197cf0['on'](_0xfdf1('0x2d'),this[_0xfdf1('0x2e')]['bind'](this));_0x197cf0[_0xfdf1('0xd')](_0xfdf1('0x10'),this['handleFetchError'][_0xfdf1('0x24')](this));_0x197cf0[_0xfdf1('0xd')]('end',this[_0xfdf1('0x2f')][_0xfdf1('0x24')](this));}catch(_0x58c0b0){logger[_0xfdf1('0x10')](_0x58c0b0);}}else{this[_0xfdf1('0x1')][_0xfdf1('0x30')](!![],this[_0xfdf1('0x26')][_0xfdf1('0x24')](this));}}};EmailImap[_0xfdf1('0x14')][_0xfdf1('0x2e')]=function(_0x3e5fa0){_0x3e5fa0['on'](_0xfdf1('0x31'),this['handleMessageBody']['bind'](this));_0x3e5fa0[_0xfdf1('0xd')](_0xfdf1('0x32'),this[_0xfdf1('0x33')][_0xfdf1('0x24')](this));_0x3e5fa0[_0xfdf1('0xd')](_0xfdf1('0xe'),this[_0xfdf1('0x34')][_0xfdf1('0x24')](this));};EmailImap['prototype'][_0xfdf1('0x35')]=function(_0x17c67e){simpleParser(_0x17c67e,{'Iconv':Iconv},this[_0xfdf1('0x36')]['bind'](this));};EmailImap['prototype'][_0xfdf1('0x33')]=function(){};EmailImap['prototype'][_0xfdf1('0x34')]=function(){};EmailImap[_0xfdf1('0x14')][_0xfdf1('0x36')]=function(_0x5dd1a5,_0x45bcac){if(_0x5dd1a5){logger[_0xfdf1('0x10')](_0x5dd1a5);}else{var _0x470608=this;utils[_0xfdf1('0x37')](this[_0xfdf1('0xb')],_0x45bcac,function(_0x25f684){_0x470608[_0xfdf1('0x38')]('email',_0x25f684);});}};EmailImap[_0xfdf1('0x14')][_0xfdf1('0x2f')]=function(){this['imap']['closeBox'](!![],this[_0xfdf1('0x26')][_0xfdf1('0x24')](this));};EmailImap[_0xfdf1('0x14')][_0xfdf1('0x39')]=function(_0x5b0a85){this[_0xfdf1('0x11')](_0x5b0a85);this['imap'][_0xfdf1('0x30')](!![],this['handleCloseBox'][_0xfdf1('0x24')](this));};EmailImap[_0xfdf1('0x14')][_0xfdf1('0xf')]=function(){this[_0xfdf1('0x38')](_0xfdf1('0xe'));};EmailImap['prototype'][_0xfdf1('0x11')]=function(_0x1ca73d,_0x3dbc0e){logger[_0xfdf1('0x10')](_0xfdf1('0x11'),this['account']['email'],JSON[_0xfdf1('0x3a')](_0x1ca73d));var _0x48fbe8='';if(_0x1ca73d){if(_0x1ca73d['textCode']){_0x48fbe8=_0x1ca73d[_0xfdf1('0x3b')];}else{for(var _0x13d44f in _0x1ca73d){if(_0x1ca73d['hasOwnProperty'](_0x13d44f)){_0x48fbe8+=_[_0xfdf1('0x3c')](_0x13d44f)+':\x20'+_0x1ca73d[_0x13d44f]+'\x0a';}}}}if(_0x3dbc0e){this[_0xfdf1('0x1')]['end']();}else{this[_0xfdf1('0x38')](_0xfdf1('0x10'),_0x48fbe8);this[_0xfdf1('0x38')](_0xfdf1('0xe'));}};module['exports']=EmailImap; \ No newline at end of file +var _0xa2e5=['fetch','slice','handleFetchError','closeBox','handleFetchMessage','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleEnd','stringify','textCode','hasOwnProperty','exports','util','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','imap','bind','once','end','error','handleError','connect','inherits','connTimeout','authTimeout','service','modernAuthentication','xoauth2','CloudProvider','user','password','anonymous@xcally.com','host','port','tls','prototype','handleReady','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length'];(function(_0x2cd1fb,_0x291f55){var _0x48fd2b=function(_0x18e23e){while(--_0x18e23e){_0x2cd1fb['push'](_0x2cd1fb['shift']());}};_0x48fd2b(++_0x291f55);}(_0xa2e5,0x7a));var _0x5a2e=function(_0x1f4937,_0x111c37){_0x1f4937=_0x1f4937-0x0;var _0x551a01=_0xa2e5[_0x1f4937];return _0x551a01;};'use strict';var _=require('lodash');var util=require(_0x5a2e('0x0'));var Imap=require('imap');var simpleParser=require('mailparser')['simpleParser'];var Iconv=require('iconv')[_0x5a2e('0x1')];var EventEmitter=require(_0x5a2e('0x2'))[_0x5a2e('0x3')];var utils=require('./utils');var logger=require(_0x5a2e('0x4'))(_0x5a2e('0x5'));function EmailImap(_0x175aae,_0x1a053e){this[_0x5a2e('0x6')]=_0x175aae[_0x5a2e('0x6')];this[_0x5a2e('0x7')]=this[_0x5a2e('0x8')](_0x175aae,_0x1a053e);this[_0x5a2e('0x9')]=new Imap(this[_0x5a2e('0x7')]);this['imap']['once']('ready',this['handleReady'][_0x5a2e('0xa')](this));this[_0x5a2e('0x9')][_0x5a2e('0xb')](_0x5a2e('0xc'),this['handleEnd']['bind'](this));this[_0x5a2e('0x9')]['on'](_0x5a2e('0xd'),this[_0x5a2e('0xe')][_0x5a2e('0xa')](this));this['imap'][_0x5a2e('0xf')]();}util[_0x5a2e('0x10')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x28ca10,_0x5af524){var _0x424725={'connTimeout':_0x28ca10[_0x5a2e('0x11')]?_0x28ca10[_0x5a2e('0x11')]*0x3e8:0x2710,'authTimeout':_0x28ca10[_0x5a2e('0x12')]?_0x28ca10[_0x5a2e('0x12')]*0x3e8:0x1388};if(_0x28ca10[_0x5a2e('0x13')]){_0x424725['user']=_0x28ca10['user'];if(_0x28ca10[_0x5a2e('0x14')]){_0x424725[_0x5a2e('0x15')]=utils['generateXOAuth2Token'](_0x28ca10[_0x5a2e('0x16')]['data5'],_0x28ca10[_0x5a2e('0x17')]);}else{_0x424725[_0x5a2e('0x18')]=_0x28ca10[_0x5a2e('0x18')];}}else{if(_0x28ca10['authentication']){_0x424725[_0x5a2e('0x17')]=_0x28ca10['user'];_0x424725[_0x5a2e('0x18')]=_0x28ca10[_0x5a2e('0x18')];}}_0x424725[_0x5a2e('0x5')]=_0x5af524||_0x28ca10[_0x5a2e('0x17')]||_0x5a2e('0x19');_0x424725[_0x5a2e('0x1a')]=_0x28ca10['host'];_0x424725[_0x5a2e('0x1b')]=_0x28ca10['port']||0x3e1;if(_0x28ca10[_0x5a2e('0x1c')]){_0x424725[_0x5a2e('0x1c')]=!![];}else{_0x424725['tls']=![];_0x424725['autotls']='required';}return _0x424725;};EmailImap[_0x5a2e('0x1d')][_0x5a2e('0x1e')]=function(){this['imap'][_0x5a2e('0x1f')](this['mailbox'],![],this[_0x5a2e('0x20')][_0x5a2e('0xa')](this));};EmailImap['prototype'][_0x5a2e('0x20')]=function(_0x7a3b2b,_0x50fcb1){if(_0x7a3b2b){this['handleError'](_0x7a3b2b,!![]);}else{this[_0x5a2e('0x21')](_0x5a2e('0x22'),_0x50fcb1);this[_0x5a2e('0x23')]();}};EmailImap[_0x5a2e('0x1d')][_0x5a2e('0x24')]=function(_0x3a21f0){if(_0x3a21f0){this[_0x5a2e('0xe')](_0x3a21f0,!![]);}else{this[_0x5a2e('0x9')][_0x5a2e('0xc')]();}};EmailImap['prototype'][_0x5a2e('0x23')]=function(){this[_0x5a2e('0x9')]['search']([_0x5a2e('0x25')],this[_0x5a2e('0x26')][_0x5a2e('0xa')](this));};EmailImap[_0x5a2e('0x1d')][_0x5a2e('0x26')]=function(_0x22b3f3,_0x30e615){if(_0x22b3f3){this[_0x5a2e('0xe')](_0x22b3f3,!![]);}else{if(_0x30e615[_0x5a2e('0x27')]){try{var _0x32da37=this['imap'][_0x5a2e('0x28')](_0x30e615[_0x5a2e('0x29')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x32da37['on']('message',this['handleFetchMessage'][_0x5a2e('0xa')](this));_0x32da37[_0x5a2e('0xb')](_0x5a2e('0xd'),this[_0x5a2e('0x2a')]['bind'](this));_0x32da37[_0x5a2e('0xb')](_0x5a2e('0xc'),this['handleFetchEnd'][_0x5a2e('0xa')](this));}catch(_0x359f2d){logger[_0x5a2e('0xd')](_0x359f2d);}}else{this['imap'][_0x5a2e('0x2b')](!![],this[_0x5a2e('0x24')][_0x5a2e('0xa')](this));}}};EmailImap[_0x5a2e('0x1d')][_0x5a2e('0x2c')]=function(_0x585546){_0x585546['on']('body',this[_0x5a2e('0x2d')]['bind'](this));_0x585546[_0x5a2e('0xb')]('attributes',this[_0x5a2e('0x2e')]['bind'](this));_0x585546[_0x5a2e('0xb')]('end',this[_0x5a2e('0x2f')][_0x5a2e('0xa')](this));};EmailImap[_0x5a2e('0x1d')][_0x5a2e('0x2d')]=function(_0x39f59b){simpleParser(_0x39f59b,{'Iconv':Iconv},this[_0x5a2e('0x30')][_0x5a2e('0xa')](this));};EmailImap[_0x5a2e('0x1d')]['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x5a2e('0x2f')]=function(){};EmailImap[_0x5a2e('0x1d')][_0x5a2e('0x30')]=function(_0x491597,_0x401925){if(_0x491597){logger['error'](_0x491597);}else{var _0x2810df=this;utils['parser'](this[_0x5a2e('0x7')],_0x401925,function(_0x3db3b7){_0x2810df[_0x5a2e('0x21')](_0x5a2e('0x5'),_0x3db3b7);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0x5a2e('0x9')][_0x5a2e('0x2b')](!![],this[_0x5a2e('0x24')][_0x5a2e('0xa')](this));};EmailImap[_0x5a2e('0x1d')][_0x5a2e('0x2a')]=function(_0xf02551){this[_0x5a2e('0xe')](_0xf02551);this[_0x5a2e('0x9')]['closeBox'](!![],this[_0x5a2e('0x24')]['bind'](this));};EmailImap['prototype'][_0x5a2e('0x31')]=function(){this[_0x5a2e('0x21')](_0x5a2e('0xc'));};EmailImap[_0x5a2e('0x1d')][_0x5a2e('0xe')]=function(_0x2ec0f4,_0x4c7ba2){logger[_0x5a2e('0xd')](_0x5a2e('0xe'),this[_0x5a2e('0x7')]['email'],JSON[_0x5a2e('0x32')](_0x2ec0f4));var _0x513575='';if(_0x2ec0f4){if(_0x2ec0f4[_0x5a2e('0x33')]){_0x513575=_0x2ec0f4['textCode'];}else{for(var _0x373c77 in _0x2ec0f4){if(_0x2ec0f4[_0x5a2e('0x34')](_0x373c77)){_0x513575+=_['upperFirst'](_0x373c77)+':\x20'+_0x2ec0f4[_0x373c77]+'\x0a';}}}}if(_0x4c7ba2){this[_0x5a2e('0x9')][_0x5a2e('0xc')]();}else{this['emit'](_0x5a2e('0xd'),_0x513575);this[_0x5a2e('0x21')]('end');}};module[_0x5a2e('0x35')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index cd5368b..09db4ea 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 _0x5a2f=['exports','nodemailer-plugin-inline-base64','createTransport','use','compile','sendMail','prototype','verify','toString','Not\x20verifired'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x5a2f,0x14b));var _0xf5a2=function(_0x2ef2d8,_0x826876){_0x2ef2d8=_0x2ef2d8-0x0;var _0x3b8f0e=_0x5a2f[_0x2ef2d8];return _0x3b8f0e;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xf5a2('0x0'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x40f05d,_0xdf94b9){return new Promise(function(_0x912c64,_0x4fea0a){var _0x593ef1=nodemailer[_0xf5a2('0x1')](_0x40f05d);_0x593ef1[_0xf5a2('0x2')](_0xf5a2('0x3'),inlineBase64());_0x593ef1[_0xf5a2('0x4')](_0xdf94b9,function(_0x48466d,_0x35aead){if(_0x48466d){_0x4fea0a(_0x48466d['toString']());}else{_0x912c64(_0x35aead);}});});};EmailSmtp[_0xf5a2('0x5')]['verify']=function(_0x832e43){return new Promise(function(_0x4371dd,_0x4c9e21){var _0x24b967=nodemailer[_0xf5a2('0x1')](_0x832e43);_0x24b967[_0xf5a2('0x6')](function(_0x4a26aa,_0x1e12c0){if(_0x4a26aa){_0x4c9e21(_0x4a26aa[_0xf5a2('0x7')]());}else{if(_0x1e12c0){_0x4371dd(_0x1e12c0);}else{_0x4c9e21(_0xf5a2('0x8'));}}});});};module[_0xf5a2('0x9')]=EmailSmtp; \ No newline at end of file +var _0xf1bf=['use','sendMail','toString','verify','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0xf1bf,0x9b));var _0xff1b=function(_0x3947be,_0x5df11c){_0x3947be=_0x3947be-0x0;var _0x3abaab=_0xf1bf[_0x3947be];return _0x3abaab;};'use strict';var nodemailer=require(_0xff1b('0x0'));var inlineBase64=require(_0xff1b('0x1'));function EmailSmtp(){}EmailSmtp[_0xff1b('0x2')][_0xff1b('0x3')]=function(_0x54b057,_0x2b5313){return new Promise(function(_0x5a7e5f,_0x2e1a7d){var _0x593797=nodemailer[_0xff1b('0x4')](_0x54b057);_0x593797[_0xff1b('0x5')]('compile',inlineBase64());_0x593797[_0xff1b('0x6')](_0x2b5313,function(_0x218d97,_0x2a18f6){if(_0x218d97){_0x2e1a7d(_0x218d97[_0xff1b('0x7')]());}else{_0x5a7e5f(_0x2a18f6);}});});};EmailSmtp[_0xff1b('0x2')][_0xff1b('0x8')]=function(_0x1081a6){return new Promise(function(_0x559f00,_0x308c93){var _0x315993=nodemailer['createTransport'](_0x1081a6);_0x315993[_0xff1b('0x8')](function(_0x56e50f,_0x2e41e3){if(_0x56e50f){_0x308c93(_0x56e50f[_0xff1b('0x7')]());}else{if(_0x2e41e3){_0x559f00(_0x2e41e3);}else{_0x308c93('Not\x20verifired');}}});});};module[_0xff1b('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 75277b7..6560cab 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 _0x8f68=['node-tnef','email','value','address','anonymous','@xcally.com','head','name','substring','indexOf','split','length','join','Anonymous','pop','isEmpty','generate','html','test','includes','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path'];(function(_0x327f2a,_0x1c3f77){var _0x4c5f93=function(_0x130da8){while(--_0x130da8){_0x327f2a['push'](_0x327f2a['shift']());}};_0x4c5f93(++_0x1c3f77);}(_0x8f68,0x94));var _0x88f6=function(_0x1143ed,_0x417a4c){_0x1143ed=_0x1143ed-0x0;var _0x1cfa91=_0x8f68[_0x1143ed];return _0x1cfa91;};'use strict';var _=require(_0x88f6('0x0'));var moment=require(_0x88f6('0x1'));var random=require(_0x88f6('0x2'));var fs=require('fs');var path=require(_0x88f6('0x3'));var util=require('util');var tnef=require(_0x88f6('0x4'));var logger=require('../../../config/logger')(_0x88f6('0x5'));var config=require('../../../config/environment');function getAddress(_0x1bd098){var _0x164001=_['head'](_0x1bd098[_0x88f6('0x6')]);return _0x164001&&_0x164001[_0x88f6('0x7')]?_0x164001[_0x88f6('0x7')]:_0x88f6('0x8')+random['generate'](0x6)+_0x88f6('0x9');}function getFirstName(_0x31562e){var _0x40d85d=_[_0x88f6('0xa')](_0x31562e[_0x88f6('0x6')]);if(_0x40d85d&&_0x40d85d['name']){if(_0x40d85d['name']==_0x40d85d['address']){return _0x40d85d[_0x88f6('0xb')][_0x88f6('0xc')](0x0,_0x40d85d['name'][_0x88f6('0xd')]('@'));}var _0xd177a4=_0x40d85d['name'][_0x88f6('0xe')](/\s+/);return _0xd177a4[_0x88f6('0xf')]>0x1?_0xd177a4['slice'](0x0,-0x1)[_0x88f6('0x10')]('\x20'):_0x40d85d['name'];}return _0x88f6('0x11');}function getLastName(_0x4bd3e9){var _0x1de01a=_[_0x88f6('0xa')](_0x4bd3e9[_0x88f6('0x6')]);if(_0x1de01a&&_0x1de01a[_0x88f6('0xb')]){var _0x58ca88=_0x1de01a['name']['split'](/\s+/);return _0x58ca88[_0x88f6('0xf')]>0x1?_0x58ca88[_0x88f6('0x12')]():'';}return'';}function getMails(_0x19b397,_0x948b6c){var _0x26bde3='';for(var _0x25c239=0x0;_0x25c239<_0x948b6c[_0x88f6('0x6')][_0x88f6('0xf')];_0x25c239+=0x1){if(_0x948b6c['value'][_0x25c239][_0x88f6('0x7')]!==_0x19b397){if(!_[_0x88f6('0x13')](_0x26bde3)){_0x26bde3+=',';}_0x26bde3+=_0x948b6c[_0x88f6('0x6')][_0x25c239]['name']||_0x948b6c[_0x88f6('0x6')][_0x25c239]['address']||'';_0x26bde3+='\x20<';_0x26bde3+=_0x948b6c['value'][_0x25c239][_0x88f6('0x7')]?_0x948b6c['value'][_0x25c239][_0x88f6('0x7')]:_0x88f6('0x8')+random[_0x88f6('0x14')](0x6)+_0x88f6('0x9');_0x26bde3+='>';}}return _0x26bde3;}function parseEmail(_0x5c807c,_0x6577c7,_0x3d5574){if(_0x6577c7[_0x88f6('0x15')]){var _0x607cc1=/)<[^<]*)*<\/script>/gi;while(_0x607cc1[_0x88f6('0x16')](_0x6577c7[_0x88f6('0x15')])){_0x6577c7['html']=_0x6577c7[_0x88f6('0x15')]['replace'](_0x607cc1,'');}if(_0x6577c7['html'][_0x88f6('0x17')](_0x88f6('0x18'))){var _0x1532ff=[];_0x6577c7[_0x88f6('0x19')]['forEach'](_0x9dc1cf=>{_0x1532ff[_0x88f6('0x1a')](_0x9dc1cf[_0x88f6('0x1b')]);});var _0x2b9cab=/]+>/g;var _0x324752=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x83e304=_0x6577c7['html'][_0x88f6('0x1c')](_0x324752,_0x88f6('0x1d'));var _0x22d91d=_0x83e304[_0x88f6('0x1c')](_0x2b9cab,'_IMG');for(let _0x1ce4b7=0x0;_0x1ce4b7<_0x1532ff[_0x88f6('0xf')];_0x1ce4b7++){var _0x1947cd=_0x22d91d[_0x88f6('0x1c')](_0x88f6('0x1e'),_0x88f6('0x1f')+_0x1532ff[_0x1ce4b7]+_0x88f6('0x20'));_0x22d91d=_0x1947cd;}_0x6577c7[_0x88f6('0x15')]=_0x22d91d;}_0x3d5574[_0x88f6('0x21')]=_0x6577c7[_0x88f6('0x15')];}else{_0x3d5574[_0x88f6('0x21')]=_0x6577c7['textAsHtml'];}if(_0x3d5574[_0x88f6('0x21')]){_0x3d5574[_0x88f6('0x21')]=_0x3d5574[_0x88f6('0x21')][_0x88f6('0x1c')](/0x0){var _0x26ff91=[_0x88f6('0x32'),'X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x4857b7=0x0;_0x4857b7<_0x6577c7[_0x88f6('0x31')][_0x88f6('0xf')];_0x4857b7++){var _0x2c8749=_[_0x88f6('0xd')](_0x26ff91,_0x6577c7[_0x88f6('0x31')][_0x4857b7][_0x88f6('0x33')]);if(_0x2c8749>=0x0){_0x3d5574[_0x88f6('0x34')]=!![];}}}return _0x3d5574;}exports['parser']=function(_0x4385d6,_0x466557,_0x4aaa68){var _0x3db50e={'from':getAddress(_0x466557['from']),'firstName':getFirstName(_0x466557[_0x88f6('0x35')]),'lastName':getLastName(_0x466557[_0x88f6('0x35')]),'mapKey':_0x88f6('0x5'),'message':{'from':getMails(_0x4385d6[_0x88f6('0x5')],_0x466557[_0x88f6('0x35')]),'to':_0x4385d6['email'],'cc':'','subject':_0x466557[_0x88f6('0x36')]||'','messageId':_0x466557[_0x88f6('0x37')],'inReplyTo':_0x466557[_0x88f6('0x38')],'sentAt':moment(_0x466557[_0x88f6('0x39')])[_0x88f6('0x2a')](_0x88f6('0x3a')),'attach':![],'attachments':[]}};if(!_0x466557[_0x88f6('0x15')]&&!_0x466557[_0x88f6('0x3b')]){var _0x4dd34c=_[_0x88f6('0x3c')](_0x466557[_0x88f6('0x19')],{'contentType':_0x88f6('0x3d')});if(_0x4dd34c[_0x88f6('0xf')]){logger[_0x88f6('0x3e')](util[_0x88f6('0x2a')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x466557['messageId']));tnef[_0x88f6('0x3f')](_[_0x88f6('0x40')](_0x4dd34c)[_0x88f6('0x41')],function(_0x83750a,_0x3aa31b){if(_0x3aa31b){_0x466557[_0x88f6('0x15')]=_0x3aa31b[_0x88f6('0x42')]||_0x88f6('0x43');if(_0x3aa31b[_0x88f6('0x44')]){for(var _0x2cc9e8=0x0;_0x2cc9e8<_0x3aa31b[_0x88f6('0x44')][_0x88f6('0xf')];_0x2cc9e8++){var _0x3d658a=_0x3aa31b[_0x88f6('0x44')][_0x2cc9e8];_0x3db50e[_0x88f6('0x23')][_0x88f6('0x19')][_0x88f6('0x1a')]({'filename':_0x3d658a[_0x88f6('0x45')],'content':Buffer[_0x88f6('0x35')](_0x3d658a[_0x88f6('0x46')])});}}}_0x4aaa68(parseEmail(_0x4385d6,_0x466557,_0x3db50e));});}else{_0x466557[_0x88f6('0x15')]=_0x88f6('0x43');_0x4aaa68(parseEmail(_0x4385d6,_0x466557,_0x3db50e));}}else{_0x4aaa68(parseEmail(_0x4385d6,_0x466557,_0x3db50e));}};exports[_0x88f6('0x47')]=function(_0x39a878,_0x2672c2){var _0x2df95d=['user='+(_0x2672c2||''),_0x88f6('0x48')+_0x39a878,'',''];return Buffer[_0x88f6('0x35')](_0x2df95d[_0x88f6('0x10')](''),_0x88f6('0x49'))[_0x88f6('0x4a')](_0x88f6('0x4b'));}; \ No newline at end of file +var _0xa379=['toString','moment','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','indexOf','split','slice','join','Anonymous','length','isEmpty','html','test','includes','','body','0x1?_0x31fe41[_0x9a37('0x10')](0x0,-0x1)[_0x9a37('0x11')]('\x20'):_0x283f14['name'];}return _0x9a37('0x12');}function getLastName(_0x497efa){var _0x3a8530=_[_0x9a37('0xc')](_0x497efa[_0x9a37('0x7')]);if(_0x3a8530&&_0x3a8530[_0x9a37('0xd')]){var _0x189c83=_0x3a8530['name']['split'](/\s+/);return _0x189c83[_0x9a37('0x13')]>0x1?_0x189c83['pop']():'';}return'';}function getMails(_0x3e93a1,_0x10b29a){var _0x2be443='';for(var _0x5a88c4=0x0;_0x5a88c4<_0x10b29a['value'][_0x9a37('0x13')];_0x5a88c4+=0x1){if(_0x10b29a[_0x9a37('0x7')][_0x5a88c4][_0x9a37('0x8')]!==_0x3e93a1){if(!_[_0x9a37('0x14')](_0x2be443)){_0x2be443+=',';}_0x2be443+=_0x10b29a[_0x9a37('0x7')][_0x5a88c4]['name']||_0x10b29a[_0x9a37('0x7')][_0x5a88c4][_0x9a37('0x8')]||'';_0x2be443+='\x20<';_0x2be443+=_0x10b29a['value'][_0x5a88c4][_0x9a37('0x8')]?_0x10b29a[_0x9a37('0x7')][_0x5a88c4]['address']:_0x9a37('0x9')+random[_0x9a37('0xa')](0x6)+_0x9a37('0xb');_0x2be443+='>';}}return _0x2be443;}function parseEmail(_0x420351,_0x3eaacc,_0x5335b1){if(_0x3eaacc[_0x9a37('0x15')]){var _0x2a9846=/)<[^<]*)*<\/script>/gi;while(_0x2a9846[_0x9a37('0x16')](_0x3eaacc[_0x9a37('0x15')])){_0x3eaacc[_0x9a37('0x15')]=_0x3eaacc['html']['replace'](_0x2a9846,'');}if(_0x3eaacc[_0x9a37('0x15')][_0x9a37('0x17')](_0x9a37('0x18'))){var _0x372b20=[];_0x3eaacc[_0x9a37('0x19')][_0x9a37('0x1a')](_0x4c4971=>{_0x372b20[_0x9a37('0x1b')](_0x4c4971[_0x9a37('0x1c')]);});var _0x251c88=/]+>/g;var _0x132cd4=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x178969=_0x3eaacc['html'][_0x9a37('0x1d')](_0x132cd4,_0x9a37('0x1e'));var _0x177414=_0x178969[_0x9a37('0x1d')](_0x251c88,_0x9a37('0x1f'));for(let _0x469cce=0x0;_0x469cce<_0x372b20['length'];_0x469cce++){var _0x21c456=_0x177414[_0x9a37('0x1d')](_0x9a37('0x1f'),'\x20[Attachment:\x20'+_0x372b20[_0x469cce]+_0x9a37('0x20'));_0x177414=_0x21c456;}_0x3eaacc[_0x9a37('0x15')]=_0x177414;}_0x5335b1[_0x9a37('0x21')]=_0x3eaacc[_0x9a37('0x15')];}else{_0x5335b1[_0x9a37('0x21')]=_0x3eaacc['textAsHtml'];}if(_0x5335b1[_0x9a37('0x21')]){_0x5335b1[_0x9a37('0x21')]=_0x5335b1['body'][_0x9a37('0x1d')](/0x0){var _0x237de6=['Auto-Submitted:\x20auto-replied',_0x9a37('0x30'),_0x9a37('0x31')];for(var _0x555d94=0x0;_0x555d94<_0x3eaacc[_0x9a37('0x32')][_0x9a37('0x13')];_0x555d94++){var _0x4d6cb5=_['indexOf'](_0x237de6,_0x3eaacc[_0x9a37('0x32')][_0x555d94][_0x9a37('0x33')]);if(_0x4d6cb5>=0x0){_0x5335b1[_0x9a37('0x34')]=!![];}}}return _0x5335b1;}exports[_0x9a37('0x35')]=function(_0x5bcb65,_0x175b36,_0x5886d5){var _0xe5473d={'from':getAddress(_0x175b36[_0x9a37('0x36')]),'firstName':getFirstName(_0x175b36[_0x9a37('0x36')]),'lastName':getLastName(_0x175b36[_0x9a37('0x36')]),'mapKey':'email','message':{'from':getMails(_0x5bcb65[_0x9a37('0x5')],_0x175b36['from']),'to':_0x5bcb65[_0x9a37('0x5')],'cc':'','subject':_0x175b36['subject']||'','messageId':_0x175b36[_0x9a37('0x37')],'inReplyTo':_0x175b36[_0x9a37('0x38')],'sentAt':moment(_0x175b36[_0x9a37('0x39')])[_0x9a37('0x3a')](_0x9a37('0x3b')),'attach':![],'attachments':[]}};if(!_0x175b36[_0x9a37('0x15')]&&!_0x175b36[_0x9a37('0x3c')]){var _0x451fec=_[_0x9a37('0x3d')](_0x175b36[_0x9a37('0x19')],{'contentType':_0x9a37('0x3e')});if(_0x451fec[_0x9a37('0x13')]){logger[_0x9a37('0x3f')](util[_0x9a37('0x3a')](_0x9a37('0x40'),_0x175b36[_0x9a37('0x37')]));tnef[_0x9a37('0x41')](_['first'](_0x451fec)[_0x9a37('0x2e')],function(_0x58b767,_0x127029){if(_0x127029){_0x175b36[_0x9a37('0x15')]=_0x127029['BodyHTML']||'

Empty\x20message

';if(_0x127029[_0x9a37('0x42')]){for(var _0x3e54fa=0x0;_0x3e54fa<_0x127029[_0x9a37('0x42')]['length'];_0x3e54fa++){var _0x42a6bd=_0x127029['Attachments'][_0x3e54fa];_0xe5473d[_0x9a37('0x23')][_0x9a37('0x19')][_0x9a37('0x1b')]({'filename':_0x42a6bd[_0x9a37('0x43')],'content':Buffer[_0x9a37('0x36')](_0x42a6bd['Data'])});}}}_0x5886d5(parseEmail(_0x5bcb65,_0x175b36,_0xe5473d));});}else{_0x175b36[_0x9a37('0x15')]='

Empty\x20message

';_0x5886d5(parseEmail(_0x5bcb65,_0x175b36,_0xe5473d));}}else{_0x5886d5(parseEmail(_0x5bcb65,_0x175b36,_0xe5473d));}};exports['generateXOAuth2Token']=function(_0x222c87,_0x181550){var _0x2acfd8=['user='+(_0x181550||''),_0x9a37('0x44')+_0x222c87,'',''];return Buffer[_0x9a37('0x36')](_0x2acfd8[_0x9a37('0x11')](''),'utf-8')[_0x9a37('0x45')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 12e0348..d27b220 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 _0xa8bd=['name','Service','key','SERV','active','Imap','lodash'];(function(_0x1114de,_0x467b24){var _0x43390f=function(_0x26711d){while(--_0x26711d){_0x1114de['push'](_0x1114de['shift']());}};_0x43390f(++_0x467b24);}(_0xa8bd,0xca));var _0xda8b=function(_0xa7c05d,_0x312374){_0xa7c05d=_0xa7c05d-0x0;var _0x47b002=_0xa8bd[_0xa7c05d];return _0x47b002;};'use strict';var _=require(_0xda8b('0x0'));function MailAccount(_0xd2a1e7){this['id']=_0xd2a1e7['id']||0x0;this[_0xda8b('0x1')]=_0xd2a1e7[_0xda8b('0x1')]||_0xda8b('0x2');this[_0xda8b('0x3')]=_0xd2a1e7['key']||_0xda8b('0x4');this[_0xda8b('0x5')]=_0xd2a1e7[_0xda8b('0x5')]||![];this[_0xda8b('0x6')]=_0xd2a1e7['Imap']||[];this['Smtp']=_0xd2a1e7['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file +var _0xfab7=['SERV','active','Imap','Smtp','exports','name','Service','key'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfab7,0x125));var _0x7fab=function(_0x52d0d0,_0x1c2d2d){_0x52d0d0=_0x52d0d0-0x0;var _0x31bc03=_0xfab7[_0x52d0d0];return _0x31bc03;};'use strict';var _=require('lodash');function MailAccount(_0x3c1f51){this['id']=_0x3c1f51['id']||0x0;this['name']=_0x3c1f51[_0x7fab('0x0')]||_0x7fab('0x1');this[_0x7fab('0x2')]=_0x3c1f51[_0x7fab('0x2')]||_0x7fab('0x3');this[_0x7fab('0x4')]=_0x3c1f51[_0x7fab('0x4')]||![];this[_0x7fab('0x5')]=_0x3c1f51[_0x7fab('0x5')]||[];this['Smtp']=_0x3c1f51[_0x7fab('0x6')]||[];}module[_0x7fab('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 4d95cde..c226d12 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 _0xc9dd=['prototype','initMailAccounts','length','isUndefined','merge','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','mergeFromDatabase'];(function(_0x845505,_0x19e5f3){var _0x2513b9=function(_0x10e7af){while(--_0x10e7af){_0x845505['push'](_0x845505['shift']());}};_0x2513b9(++_0x19e5f3);}(_0xc9dd,0x195));var _0xdc9d=function(_0x141216,_0x24a696){_0x141216=_0x141216-0x0;var _0x439d4b=_0xc9dd[_0x141216];return _0x439d4b;};'use strict';var _=require(_0xdc9d('0x0'));var MailAccount=require(_0xdc9d('0x1'));var Realtime=function(){this[_0xdc9d('0x2')]={};};function freeIsNotKey(_0x3f8ed4,_0x1c6462,_0x30d435){var _0x57c17d=_['mapKeys'](_0x3f8ed4,function(_0x2353cd,_0x136936){return _0x2353cd[_0x30d435];});for(var _0x1a7a03 in _0x1c6462){if(_0x1c6462[_0xdc9d('0x3')](_0x1a7a03)){if(!_0x57c17d[_0x1a7a03]){delete _0x1c6462[_0x1a7a03];}}}}Realtime['prototype'][_0xdc9d('0x4')]=function(_0x47b06c,_0x192626){for(var _0x54fd4a in _0x192626){if(_0x47b06c[_0xdc9d('0x3')](_0x54fd4a)){_0x47b06c[_0x54fd4a]=_0x192626[_0x54fd4a];}}};Realtime[_0xdc9d('0x5')][_0xdc9d('0x6')]=function(){var _0x355284=this;return function(_0x4c57c8){if(_0x4c57c8){freeIsNotKey(_0x4c57c8,_0x355284[_0xdc9d('0x2')],'id');for(var _0x26f9d8=0x0,_0x232458={},_0x1fb2b4={};_0x26f9d8<_0x4c57c8[_0xdc9d('0x7')];_0x26f9d8+=0x1){_0x232458=_0x4c57c8[_0x26f9d8];if(_[_0xdc9d('0x8')](_0x355284[_0xdc9d('0x2')][_0x232458['id']])){_0x355284[_0xdc9d('0x2')][_0x232458['id']]=new MailAccount(_0x232458);}else{_[_0xdc9d('0x9')](_0x355284[_0xdc9d('0x2')][_0x232458['id']],_0x232458);}}}return _0x355284[_0xdc9d('0x2')];};};module['exports']=Realtime; \ No newline at end of file +var _0xada7=['initMailAccounts','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xada7,0x157));var _0x7ada=function(_0x43dd69,_0x2eafe1){_0x43dd69=_0x43dd69-0x0;var _0x4b1ccf=_0xada7[_0x43dd69];return _0x4b1ccf;};'use strict';var _=require(_0x7ada('0x0'));var MailAccount=require(_0x7ada('0x1'));var Realtime=function(){this[_0x7ada('0x2')]={};};function freeIsNotKey(_0x6e5a21,_0x4e2b10,_0x7e918c){var _0x533e4b=_[_0x7ada('0x3')](_0x6e5a21,function(_0x592452,_0x3a36d2){return _0x592452[_0x7e918c];});for(var _0x20c5cb in _0x4e2b10){if(_0x4e2b10[_0x7ada('0x4')](_0x20c5cb)){if(!_0x533e4b[_0x20c5cb]){delete _0x4e2b10[_0x20c5cb];}}}}Realtime[_0x7ada('0x5')][_0x7ada('0x6')]=function(_0x1a0d36,_0x51cd4c){for(var _0x95cece in _0x51cd4c){if(_0x1a0d36[_0x7ada('0x4')](_0x95cece)){_0x1a0d36[_0x95cece]=_0x51cd4c[_0x95cece];}}};Realtime[_0x7ada('0x5')][_0x7ada('0x7')]=function(){var _0xc29091=this;return function(_0x1e453f){if(_0x1e453f){freeIsNotKey(_0x1e453f,_0xc29091['mailAccounts'],'id');for(var _0x184c6b=0x0,_0x52a5b0={},_0x488501={};_0x184c6b<_0x1e453f['length'];_0x184c6b+=0x1){_0x52a5b0=_0x1e453f[_0x184c6b];if(_['isUndefined'](_0xc29091[_0x7ada('0x2')][_0x52a5b0['id']])){_0xc29091[_0x7ada('0x2')][_0x52a5b0['id']]=new MailAccount(_0x52a5b0);}else{_[_0x7ada('0x8')](_0xc29091[_0x7ada('0x2')][_0x52a5b0['id']],_0x52a5b0);}}}return _0xc29091[_0x7ada('0x2')];};};module[_0x7ada('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index d623621..e8f4ee7 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 _0x27f3=['active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','name','service'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0x27f3,0x1e9));var _0x327f=function(_0x584291,_0x24b5b3){_0x584291=_0x584291-0x0;var _0x4e7d08=_0x27f3[_0x584291];return _0x4e7d08;};'use strict';var client=require(_0x327f('0x0'));exports[_0x327f('0x1')]=function(){return function(){return client['Request'](_0x327f('0x2'),{'options':{'attributes':['id',_0x327f('0x3'),'provider',_0x327f('0x4'),'email',_0x327f('0x5'),_0x327f('0x6'),_0x327f('0x7'),_0x327f('0x8')],'raw':![],'include':[{'model':_0x327f('0x9'),'as':_0x327f('0xa'),'include':[{'model':_0x327f('0xb'),'attributes':['id',_0x327f('0x3'),'service',_0x327f('0xc'),_0x327f('0xd')],'as':_0x327f('0xb')}]},{'model':_0x327f('0xe'),'as':_0x327f('0xf'),'include':[{'model':_0x327f('0xb'),'attributes':['id','name',_0x327f('0x4'),_0x327f('0xc'),_0x327f('0xd')],'as':_0x327f('0xb')}]}]},'log':_0x327f('0x10')});};};exports[_0x327f('0x11')]=function(_0x12cb4f,_0x12d46f){return client['Request'](_0x327f('0x12'),{'account':{'id':_0x12cb4f},'body':_0x12d46f,'log':_0x327f('0x12')});}; \ No newline at end of file +var _0x58b9=['active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','provider','service','email'];(function(_0x112056,_0xaf65a2){var _0x221fc6=function(_0x8238c){while(--_0x8238c){_0x112056['push'](_0x112056['shift']());}};_0x221fc6(++_0xaf65a2);}(_0x58b9,0xad));var _0x958b=function(_0x5d3a66,_0x4d6b3f){_0x5d3a66=_0x5d3a66-0x0;var _0xf95ae5=_0x58b9[_0x5d3a66];return _0xf95ae5;};'use strict';var client=require(_0x958b('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x958b('0x1')](_0x958b('0x2'),{'options':{'attributes':['id',_0x958b('0x3'),_0x958b('0x4'),_0x958b('0x5'),_0x958b('0x6'),_0x958b('0x7'),_0x958b('0x8'),_0x958b('0x9'),_0x958b('0xa')],'raw':![],'include':[{'model':_0x958b('0xb'),'as':_0x958b('0xc'),'include':[{'model':_0x958b('0xd'),'attributes':['id',_0x958b('0x3'),_0x958b('0x5'),_0x958b('0xe'),_0x958b('0xf')],'as':_0x958b('0xd')}]},{'model':_0x958b('0x10'),'as':'Smtp','include':[{'model':_0x958b('0xd'),'attributes':['id','name',_0x958b('0x5'),_0x958b('0xe'),_0x958b('0xf')],'as':'CloudProvider'}]}]},'log':_0x958b('0x11')});};};exports[_0x958b('0x12')]=function(_0x12c124,_0x144b20){return client[_0x958b('0x1')](_0x958b('0x13'),{'account':{'id':_0x12c124},'body':_0x144b20,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index f4f2e22..2c455d9 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 _0x9148=['../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x253367,_0x122fbc){var _0x350465=function(_0x39308a){while(--_0x39308a){_0x253367['push'](_0x253367['shift']());}};_0x350465(++_0x122fbc);}(_0x9148,0xaa));var _0x8914=function(_0x1ca88b,_0x405eda){_0x1ca88b=_0x1ca88b-0x0;var _0x182a1c=_0x9148[_0x1ca88b];return _0x182a1c;};'use strict';var client=require(_0x8914('0x0'));exports[_0x8914('0x1')]=function(){return client[_0x8914('0x2')](_0x8914('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8914('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xe2ec=['Request','loginMailFrequency','GetSettings','getSettings'];(function(_0x51b749,_0x455e52){var _0x63b090=function(_0x1fbe84){while(--_0x1fbe84){_0x51b749['push'](_0x51b749['shift']());}};_0x63b090(++_0x455e52);}(_0xe2ec,0x93));var _0xce2e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xe2ec[_0x297fd3];return _0x2af381;};'use strict';var client=require('../client');exports[_0xce2e('0x0')]=function(){return client[_0xce2e('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xce2e('0x2')]},'log':_0xce2e('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 827e58b..9843ca7 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 ecdb89e..541cfe6 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 _0x64bd=['socket.io-redis','../../config/triggers','../../config/socketio','default','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','ioredis','createServer','timeout','listen','port','socket.io','websocket','redis','defaults','localhost','adapter'];(function(_0xad921d,_0x4e852b){var _0x50a737=function(_0x38a1f4){while(--_0x38a1f4){_0xad921d['push'](_0xad921d['shift']());}};_0x50a737(++_0x4e852b);}(_0x64bd,0xb9));var _0xd64b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x64bd[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var http=require(_0xd64b('0x0'));var express=require(_0xd64b('0x1'));var sticky=require('sticky-session');var Redis=require(_0xd64b('0x2'));var config=require('../../config/environment');var app=express();var server=http[_0xd64b('0x3')](app);server[_0xd64b('0x4')]=0xdbba0;if(sticky[_0xd64b('0x5')](server,config[_0xd64b('0x6')])){var socketio=require(_0xd64b('0x7'))(server,{'transports':[_0xd64b('0x8'),'polling']});config[_0xd64b('0x9')]=_[_0xd64b('0xa')](config[_0xd64b('0x9')],{'host':_0xd64b('0xb'),'port':0x18eb});socketio[_0xd64b('0xc')](require(_0xd64b('0xd'))({'pubClient':new Redis(config[_0xd64b('0x9')]),'subClient':new Redis(config[_0xd64b('0x9')])}));require(_0xd64b('0xe'))['default']();require(_0xd64b('0xf'))['default'](socketio);require('../../config/express')[_0xd64b('0x10')](app);require('../../routes')['default'](app);}else{server[_0xd64b('0x11')](_0xd64b('0x12'),function(){console[_0xd64b('0x13')](_0xd64b('0x14'),config[_0xd64b('0x6')]);});}exports=module[_0xd64b('0x15')]=app; \ No newline at end of file +var _0xc142=['websocket','polling','redis','defaults','adapter','../../config/triggers','default','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen'];(function(_0xad1863,_0x19118e){var _0x3980be=function(_0x309036){while(--_0x309036){_0xad1863['push'](_0xad1863['shift']());}};_0x3980be(++_0x19118e);}(_0xc142,0x142));var _0x2c14=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0xc142[_0x31a576];return _0x30b1d3;};'use strict';var _=require(_0x2c14('0x0'));var http=require('http');var express=require(_0x2c14('0x1'));var sticky=require(_0x2c14('0x2'));var Redis=require(_0x2c14('0x3'));var config=require(_0x2c14('0x4'));var app=express();var server=http[_0x2c14('0x5')](app);server[_0x2c14('0x6')]=0xdbba0;if(sticky[_0x2c14('0x7')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':[_0x2c14('0x8'),_0x2c14('0x9')]});config[_0x2c14('0xa')]=_[_0x2c14('0xb')](config[_0x2c14('0xa')],{'host':'localhost','port':0x18eb});socketio[_0x2c14('0xc')](require('socket.io-redis')({'pubClient':new Redis(config[_0x2c14('0xa')]),'subClient':new Redis(config['redis'])}));require(_0x2c14('0xd'))['default']();require('../../config/socketio')[_0x2c14('0xe')](socketio);require('../../config/express')['default'](app);require(_0x2c14('0xf'))[_0x2c14('0xe')](app);}else{server[_0x2c14('0x10')](_0x2c14('0x11'),function(){console[_0x2c14('0x12')](_0x2c14('0x13'),config[_0x2c14('0x14')]);});}exports=module[_0x2c14('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 5a821b4..c078b40 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 _0xd0a0=['result','jayson/promise','../../config/logger','routing','client','http','request','then','debug','error','rpc','message'];(function(_0x2779da,_0x40c026){var _0x941146=function(_0x582b51){while(--_0x582b51){_0x2779da['push'](_0x2779da['shift']());}};_0x941146(++_0x40c026);}(_0xd0a0,0x199));var _0x0d0a=function(_0x4c6532,_0x38dfc3){_0x4c6532=_0x4c6532-0x0;var _0x1c78fc=_0xd0a0[_0x4c6532];return _0x1c78fc;};'use strict';var jayson=require(_0x0d0a('0x0'));var BPromise=require('bluebird');var logger=require(_0x0d0a('0x1'))(_0x0d0a('0x2'));var client=jayson[_0x0d0a('0x3')][_0x0d0a('0x4')]({'port':0x2329});client['Request']=function(_0x1844c4,_0x3095c0){return new BPromise(function(_0x2fb6f7,_0x2482a5){return client[_0x0d0a('0x5')](_0x1844c4,_0x3095c0)[_0x0d0a('0x6')](function(_0x398316){logger[_0x0d0a('0x7')]('rpc',_0x0d0a('0x2'),_0x1844c4,_0x3095c0,_0x398316);if(_0x398316['error']){logger[_0x0d0a('0x8')](_0x0d0a('0x9'),_0x0d0a('0x2'),_0x1844c4,_0x398316[_0x0d0a('0x8')][_0x0d0a('0xa')],_0x3095c0);return _0x2482a5(_0x398316[_0x0d0a('0x8')]['message']);}else{return _0x2fb6f7(_0x398316[_0x0d0a('0xb')]);}})['catch'](function(_0x31534d){logger[_0x0d0a('0x8')](_0x0d0a('0x9'),_0x0d0a('0x2'),_0x1844c4,_0x31534d,_0x3095c0);return _0x2482a5(_0x31534d);});});};module['exports']=client; \ No newline at end of file +var _0xfb79=['request','then','routing','error','rpc','message','result','catch','jayson/promise','bluebird','../../config/logger','Request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfb79,0x11c));var _0x9fb7=function(_0x126121,_0x35e290){_0x126121=_0x126121-0x0;var _0x57d413=_0xfb79[_0x126121];return _0x57d413;};'use strict';var jayson=require(_0x9fb7('0x0'));var BPromise=require(_0x9fb7('0x1'));var logger=require(_0x9fb7('0x2'))('routing');var client=jayson['client']['http']({'port':0x2329});client[_0x9fb7('0x3')]=function(_0x4d9dc7,_0x4559f8){return new BPromise(function(_0x3a1102,_0x3aeb61){return client[_0x9fb7('0x4')](_0x4d9dc7,_0x4559f8)[_0x9fb7('0x5')](function(_0x371d41){logger['debug']('rpc',_0x9fb7('0x6'),_0x4d9dc7,_0x4559f8,_0x371d41);if(_0x371d41[_0x9fb7('0x7')]){logger[_0x9fb7('0x7')](_0x9fb7('0x8'),_0x9fb7('0x6'),_0x4d9dc7,_0x371d41[_0x9fb7('0x7')]['message'],_0x4559f8);return _0x3aeb61(_0x371d41['error'][_0x9fb7('0x9')]);}else{return _0x3a1102(_0x371d41[_0x9fb7('0xa')]);}})[_0x9fb7('0xb')](function(_0x4d93ac){logger[_0x9fb7('0x7')](_0x9fb7('0x8'),_0x9fb7('0x6'),_0x4d9dc7,_0x4d93ac,_0x4559f8);return _0x3aeb61(_0x4d93ac);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index e7baff7..463b131 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 _0xfbcc=['initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','then','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues'];(function(_0x114749,_0x9b572a){var _0x499080=function(_0x564790){while(--_0x564790){_0x114749['push'](_0x114749['shift']());}};_0x499080(++_0x9b572a);}(_0xfbcc,0x87));var _0xcfbc=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0xfbcc[_0x5951e8];return _0x20a1f5;};'use strict';var BPromise=require(_0xcfbc('0x0'));var server=require(_0xcfbc('0x1'));var Realtime=require(_0xcfbc('0x2'));var user=require(_0xcfbc('0x3'));var interval=require(_0xcfbc('0x4'));var openchannelQueue=require(_0xcfbc('0x5'));var chatQueue=require(_0xcfbc('0x6'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xcfbc('0x7'));var faxQueue=require(_0xcfbc('0x8'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user['getAgents']())[_0xcfbc('0x9')](realtime['initAgents']())[_0xcfbc('0x9')](interval[_0xcfbc('0xa')]())[_0xcfbc('0x9')](realtime[_0xcfbc('0xb')]())['then'](openchannelQueue[_0xcfbc('0xc')]())[_0xcfbc('0x9')](realtime[_0xcfbc('0xd')]())[_0xcfbc('0x9')](chatQueue[_0xcfbc('0xe')]())['then'](realtime[_0xcfbc('0xf')]())[_0xcfbc('0x9')](smsQueue[_0xcfbc('0x10')]())[_0xcfbc('0x9')](realtime[_0xcfbc('0x11')]())[_0xcfbc('0x9')](mailQueue[_0xcfbc('0x12')]())[_0xcfbc('0x9')](realtime[_0xcfbc('0x13')]())[_0xcfbc('0x9')](faxQueue[_0xcfbc('0x14')]())[_0xcfbc('0x9')](realtime['initFaxQueues']())['then'](whatsappQueue[_0xcfbc('0x15')]())[_0xcfbc('0x9')](realtime[_0xcfbc('0x16')]())[_0xcfbc('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xcfbc('0x9')](function(_0x45780a){return initRealtime();})[_0xcfbc('0x9')](function(_0x116b9f){return setInterval(initRealtime,0x1388);})[_0xcfbc('0x17')](function(_0x2c396e){console[_0xcfbc('0x18')](_0x2c396e);});}main(); \ No newline at end of file +var _0x5644=['./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','initAgents','initIntervals','getOpenchannelQueues','getChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','bluebird','./server','./rpc/interval'];(function(_0x5b2502,_0x2bc475){var _0x4167a9=function(_0x1a3261){while(--_0x1a3261){_0x5b2502['push'](_0x5b2502['shift']());}};_0x4167a9(++_0x2bc475);}(_0x5644,0x11d));var _0x4564=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x5644[_0x491a7f];return _0x3d8f44;};'use strict';var BPromise=require(_0x4564('0x0'));var server=require(_0x4564('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0x4564('0x2'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x4564('0x3'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x4564('0x4'));var whatsappQueue=require(_0x4564('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x4564('0x6')](user['getAgents']())[_0x4564('0x6')](realtime[_0x4564('0x7')]())[_0x4564('0x6')](interval['getIntervals']())[_0x4564('0x6')](realtime[_0x4564('0x8')]())[_0x4564('0x6')](openchannelQueue[_0x4564('0x9')]())[_0x4564('0x6')](realtime['initOpenchannelQueues']())[_0x4564('0x6')](chatQueue[_0x4564('0xa')]())[_0x4564('0x6')](realtime['initChatQueues']())[_0x4564('0x6')](smsQueue['getSmsQueues']())[_0x4564('0x6')](realtime[_0x4564('0xb')]())[_0x4564('0x6')](mailQueue[_0x4564('0xc')]())[_0x4564('0x6')](realtime[_0x4564('0xd')]())[_0x4564('0x6')](faxQueue[_0x4564('0xe')]())[_0x4564('0x6')](realtime[_0x4564('0xf')]())[_0x4564('0x6')](whatsappQueue[_0x4564('0x10')]())['then'](realtime['initWhatsappQueues']())[_0x4564('0x6')](function(){return realtime;});}function main(){return server[_0x4564('0x11')](realtime)['then'](function(_0x3ae96c){return initRealtime();})['then'](function(_0x3959e3){return setInterval(initRealtime,0x1388);})['catch'](function(_0x77c83c){console['log'](_0x77c83c);});}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 39f0605..0878640 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 _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x55889a,_0x365121){var _0x4d85a6=function(_0x5ea81e){while(--_0x5ea81e){_0x55889a['push'](_0x55889a['shift']());}};_0x4d85a6(++_0x365121);}(_0xe14b,0x93));var _0xbe14=function(_0x237e81,_0x8a3e0d){_0x237e81=_0x237e81-0x0;var _0x594db3=_0xe14b[_0x237e81];return _0x594db3;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x22339a,_0x346af2){var _0x36731b=function(_0x51c61d){while(--_0x51c61d){_0x22339a['push'](_0x22339a['shift']());}};_0x36731b(++_0x346af2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc4aa[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index faf5b5d..4b8f745 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 _0xb66f=['message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','then','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb66f,0xf7));var _0xfb66=function(_0x1c077c,_0x142aea){_0x1c077c=_0x1c077c-0x0;var _0x2f6b02=_0xb66f[_0x1c077c];return _0x2f6b02;};'use strict';var BPromise=require(_0xfb66('0x0'));var jayson=require(_0xfb66('0x1'));var client=jayson[_0xfb66('0x2')]['http']({'port':0x232b});function request(_0x346395,_0x39db55){return new BPromise(function(_0x2254b4,_0x2b2992){return client['request'](_0x346395,_0x39db55)[_0xfb66('0x3')](function(_0x13064a){if(_0x13064a['error']){return _0x2b2992(_0x13064a[_0xfb66('0x4')][_0xfb66('0x5')]);}else{return _0x2254b4(_0x13064a['result']);}})[_0xfb66('0x6')](function(_0x268d1a){return _0x2b2992(_0x268d1a);});});}exports[_0xfb66('0x7')]=function(_0x2d2be0,_0x385d3b){return request(_0xfb66('0x8'),{'account':_0x2d2be0,'message':_0x385d3b});}; \ No newline at end of file +var _0x01ea=['then','error','message','result','sendMailMessage','bluebird','client','http','request'];(function(_0x4c7e7d,_0x120515){var _0x246e17=function(_0x8e21df){while(--_0x8e21df){_0x4c7e7d['push'](_0x4c7e7d['shift']());}};_0x246e17(++_0x120515);}(_0x01ea,0x152));var _0xa01e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x01ea[_0x55f8b4];return _0x2475f9;};'use strict';var BPromise=require(_0xa01e('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xa01e('0x1')][_0xa01e('0x2')]({'port':0x232b});function request(_0x237ce3,_0x18f4c6){return new BPromise(function(_0xaa9698,_0x3f9f85){return client[_0xa01e('0x3')](_0x237ce3,_0x18f4c6)[_0xa01e('0x4')](function(_0x42cd40){if(_0x42cd40[_0xa01e('0x5')]){return _0x3f9f85(_0x42cd40[_0xa01e('0x5')][_0xa01e('0x6')]);}else{return _0xaa9698(_0x42cd40[_0xa01e('0x7')]);}})['catch'](function(_0xef3d58){return _0x3f9f85(_0xef3d58);});});}exports[_0xa01e('0x8')]=function(_0x3ec102,_0x52b854){return request('SendMail',{'account':_0x3ec102,'message':_0x52b854});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 354eb04..02d28bd 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 _0x8ace=['unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','whatsapp','toNumber','format','Status','mailStatus','faxCurrentCapacity','openchannelStatusTime','busyQueue','openchannelWaitingInteractions','whatsappWaitingInteractions','stringify','emit','user:routing:update','omit','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus'];(function(_0x300b0c,_0x595823){var _0x698d8c=function(_0x44f160){while(--_0x44f160){_0x300b0c['push'](_0x300b0c['shift']());}};_0x698d8c(++_0x595823);}(_0x8ace,0x1bc));var _0xe8ac=function(_0xdfcf22,_0x322509){_0xdfcf22=_0xdfcf22-0x0;var _0x59b62f=_0x8ace[_0xdfcf22];return _0x59b62f;};'use strict';var _=require(_0xe8ac('0x0'));var md5=require(_0xe8ac('0x1'));var moment=require(_0xe8ac('0x2'));var Redis=require(_0xe8ac('0x3'));var config=require(_0xe8ac('0x4'));config[_0xe8ac('0x5')]=_[_0xe8ac('0x6')](config[_0xe8ac('0x5')],{'host':_0xe8ac('0x7'),'port':0x18eb});var io=require(_0xe8ac('0x8'))(new Redis(config[_0xe8ac('0x5')]));function Agent(_0x224fc8){this['id']=_0x224fc8['id']||0x0;this[_0xe8ac('0x9')]=_0x224fc8[_0xe8ac('0x9')]||'';this['online']=_0x224fc8[_0xe8ac('0xa')]||!![];this[_0xe8ac('0xb')]=_0x224fc8['voicePause']||![];this['chatPause']=_0x224fc8[_0xe8ac('0xc')]||![];this['mailPause']=_0x224fc8[_0xe8ac('0xd')]||![];this[_0xe8ac('0xe')]=_0x224fc8[_0xe8ac('0xe')]||![];this[_0xe8ac('0xf')]=_0x224fc8[_0xe8ac('0xf')]||![];this[_0xe8ac('0x10')]=_0x224fc8['openchannelPause']||![];this[_0xe8ac('0x11')]=_0xe8ac('0x12');this[_0xe8ac('0x13')]=0x0;this['chatCapacity']=_0x224fc8[_0xe8ac('0x14')]||0x0;this[_0xe8ac('0x15')]=0x0;this['mailStatus']=_0xe8ac('0x12');this[_0xe8ac('0x16')]=0x0;this[_0xe8ac('0x17')]=_0x224fc8[_0xe8ac('0x17')]||0x0;this[_0xe8ac('0x18')]=0x0;this[_0xe8ac('0x19')]=_0xe8ac('0x12');this[_0xe8ac('0x1a')]=0x0;this[_0xe8ac('0x1b')]=_0x224fc8[_0xe8ac('0x1b')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xe8ac('0x1c')]=_0xe8ac('0x12');this['smsStatusTime']=0x0;this[_0xe8ac('0x1d')]=_0x224fc8[_0xe8ac('0x1d')]||0x0;this[_0xe8ac('0x1e')]=0x0;this[_0xe8ac('0x1f')]=_0xe8ac('0x12');this[_0xe8ac('0x20')]=0x0;this['whatsappCapacity']=_0x224fc8['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xe8ac('0x21')]=_0xe8ac('0x12');this['openchannelStatusTime']=0x0;this[_0xe8ac('0x22')]=_0x224fc8['openchannelCapacity']||0x0;this[_0xe8ac('0x23')]=0x0;this[_0xe8ac('0x24')]=![];this['busyQueue']=undefined;this[_0xe8ac('0x1')]='';this[_0xe8ac('0x25')]={};this[_0xe8ac('0x26')]={};this[_0xe8ac('0x27')]={};this['openchannelWaitingInteractions']={};this[_0xe8ac('0x28')]={};this['whatsappWaitingInteractions']={};this[_0xe8ac('0x29')]();}Agent[_0xe8ac('0x2a')][_0xe8ac('0x2b')]=function(_0x252440){if(this[_0x252440+_0xe8ac('0x2c')]>0x0){if(this[_0x252440+_0xe8ac('0x2d')]>0x0&&this[_0x252440+_0xe8ac('0x2c')]>=this[_0x252440+'Capacity']){return _0xe8ac('0x2e');}else{return _0xe8ac('0x2f');}}else{return _0xe8ac('0x30');}};Agent[_0xe8ac('0x2a')][_0xe8ac('0x29')]=function(){var _0x3a92e1=[_0xe8ac('0x31'),_0xe8ac('0x32'),_0xe8ac('0x33'),'fax','sms',_0xe8ac('0x34')];for(var _0xbef18f=0x0;_0xbef18f<_0x3a92e1['length'];_0xbef18f+=0x1){var _0x2a78c6=this[_0xe8ac('0x2b')](_0x3a92e1[_0xbef18f]);if(this[_0x3a92e1[_0xbef18f]+'Status']!==_0x2a78c6){this[_0x3a92e1[_0xbef18f]+'StatusTime']=_[_0xe8ac('0x35')](moment()[_0xe8ac('0x36')]('x'));}this[_0x3a92e1[_0xbef18f]+_0xe8ac('0x37')]=_0x2a78c6;}var _0x5d7562={'id':this['id'],'name':this[_0xe8ac('0x9')],'online':this[_0xe8ac('0xa')],'voicePause':this[_0xe8ac('0xb')],'chatPause':this['chatPause'],'mailPause':this[_0xe8ac('0xd')],'smsPause':this['smsPause'],'faxPause':this[_0xe8ac('0xe')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xe8ac('0x15')],'mailStatus':this[_0xe8ac('0x38')],'mailStatusTime':this[_0xe8ac('0x16')],'mailCapacity':this[_0xe8ac('0x17')],'mailCurrentCapacity':this[_0xe8ac('0x18')],'faxStatus':this[_0xe8ac('0x19')],'faxStatusTime':this[_0xe8ac('0x1a')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xe8ac('0x39')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xe8ac('0x1e')],'whatsappStatus':this[_0xe8ac('0x1f')],'whatsappStatusTime':this[_0xe8ac('0x20')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xe8ac('0x21')],'openchannelStatusTime':this[_0xe8ac('0x3a')],'openchannelCapacity':this[_0xe8ac('0x22')],'openchannelCurrentCapacity':this[_0xe8ac('0x23')],'busy':this['busy'],'busyQueue':this[_0xe8ac('0x3b')],'chatWaitingInteractions':this[_0xe8ac('0x25')],'faxWaitingInteractions':this[_0xe8ac('0x26')],'mailWaitingInteractions':this[_0xe8ac('0x27')],'openchannelWaitingInteractions':this[_0xe8ac('0x3c')],'smsWaitingInteractions':this[_0xe8ac('0x28')],'whatsappWaitingInteractions':this[_0xe8ac('0x3d')]};var _0x55a3a4=md5(JSON[_0xe8ac('0x3e')](_0x5d7562));if(this[_0xe8ac('0x1')]!==_0x55a3a4){this['md5']=_0x55a3a4;io[_0xe8ac('0x3f')](_0xe8ac('0x40'),_[_0xe8ac('0x41')](_0x5d7562,[_0xe8ac('0xa')]));}};module['exports']=Agent; \ No newline at end of file +var _0x77d4=['toNumber','chatPause','chatStatusTime','chatCurrentCapacity','mailStatus','faxStatus','whatsappStatusTime','openchannelCurrentCapacity','stringify','user:routing:update','omit','exports','md5','ioredis','redis','defaults','socket.io-emitter','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','maxcapacity','working','idle','mail','chat','sms','whatsapp','Status','StatusTime'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x77d4,0x108));var _0x477d=function(_0x4774b8,_0x4199c2){_0x4774b8=_0x4774b8-0x0;var _0x428765=_0x77d4[_0x4774b8];return _0x428765;};'use strict';var _=require('lodash');var md5=require(_0x477d('0x0'));var moment=require('moment');var Redis=require(_0x477d('0x1'));var config=require('../../../config/environment');config[_0x477d('0x2')]=_[_0x477d('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x477d('0x4'))(new Redis(config[_0x477d('0x2')]));function Agent(_0x3d2f8d){this['id']=_0x3d2f8d['id']||0x0;this[_0x477d('0x5')]=_0x3d2f8d[_0x477d('0x5')]||'';this[_0x477d('0x6')]=_0x3d2f8d['online']||!![];this['voicePause']=_0x3d2f8d[_0x477d('0x7')]||![];this['chatPause']=_0x3d2f8d['chatPause']||![];this[_0x477d('0x8')]=_0x3d2f8d[_0x477d('0x8')]||![];this[_0x477d('0x9')]=_0x3d2f8d[_0x477d('0x9')]||![];this[_0x477d('0xa')]=_0x3d2f8d['smsPause']||![];this[_0x477d('0xb')]=_0x3d2f8d['openchannelPause']||![];this[_0x477d('0xc')]=_0x477d('0xd');this['chatStatusTime']=0x0;this[_0x477d('0xe')]=_0x3d2f8d[_0x477d('0xe')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0x477d('0xd');this[_0x477d('0xf')]=0x0;this['mailCapacity']=_0x3d2f8d[_0x477d('0x10')]||0x0;this[_0x477d('0x11')]=0x0;this['faxStatus']='unknown';this[_0x477d('0x12')]=0x0;this['faxCapacity']=_0x3d2f8d[_0x477d('0x13')]||0x0;this[_0x477d('0x14')]=0x0;this[_0x477d('0x15')]='unknown';this[_0x477d('0x16')]=0x0;this[_0x477d('0x17')]=_0x3d2f8d[_0x477d('0x17')]||0x0;this[_0x477d('0x18')]=0x0;this['whatsappStatus']=_0x477d('0xd');this['whatsappStatusTime']=0x0;this[_0x477d('0x19')]=_0x3d2f8d[_0x477d('0x19')]||0x0;this[_0x477d('0x1a')]=0x0;this[_0x477d('0x1b')]=_0x477d('0xd');this[_0x477d('0x1c')]=0x0;this['openchannelCapacity']=_0x3d2f8d[_0x477d('0x1d')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x477d('0x1e')]=![];this[_0x477d('0x1f')]=undefined;this[_0x477d('0x0')]='';this[_0x477d('0x20')]={};this[_0x477d('0x21')]={};this[_0x477d('0x22')]={};this[_0x477d('0x23')]={};this[_0x477d('0x24')]={};this[_0x477d('0x25')]={};this[_0x477d('0x26')]();}Agent[_0x477d('0x27')][_0x477d('0x28')]=function(_0x43c845){if(this[_0x43c845+_0x477d('0x29')]>0x0){if(this[_0x43c845+'Capacity']>0x0&&this[_0x43c845+_0x477d('0x29')]>=this[_0x43c845+'Capacity']){return _0x477d('0x2a');}else{return _0x477d('0x2b');}}else{return _0x477d('0x2c');}};Agent[_0x477d('0x27')]['updateRealtime']=function(){var _0xd6dca5=[_0x477d('0x2d'),_0x477d('0x2e'),'openchannel','fax',_0x477d('0x2f'),_0x477d('0x30')];for(var _0x386df5=0x0;_0x386df5<_0xd6dca5['length'];_0x386df5+=0x1){var _0x254141=this[_0x477d('0x28')](_0xd6dca5[_0x386df5]);if(this[_0xd6dca5[_0x386df5]+_0x477d('0x31')]!==_0x254141){this[_0xd6dca5[_0x386df5]+_0x477d('0x32')]=_[_0x477d('0x33')](moment()['format']('x'));}this[_0xd6dca5[_0x386df5]+_0x477d('0x31')]=_0x254141;}var _0xeb02f5={'id':this['id'],'name':this[_0x477d('0x5')],'online':this[_0x477d('0x6')],'voicePause':this[_0x477d('0x7')],'chatPause':this[_0x477d('0x34')],'mailPause':this[_0x477d('0x8')],'smsPause':this[_0x477d('0xa')],'faxPause':this[_0x477d('0x9')],'openchannelPause':this[_0x477d('0xb')],'chatStatus':this[_0x477d('0xc')],'chatStatusTime':this[_0x477d('0x35')],'chatCapacity':this[_0x477d('0xe')],'chatCurrentCapacity':this[_0x477d('0x36')],'mailStatus':this[_0x477d('0x37')],'mailStatusTime':this[_0x477d('0xf')],'mailCapacity':this[_0x477d('0x10')],'mailCurrentCapacity':this[_0x477d('0x11')],'faxStatus':this[_0x477d('0x38')],'faxStatusTime':this[_0x477d('0x12')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x477d('0x14')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x477d('0x16')],'smsCapacity':this[_0x477d('0x17')],'smsCurrentCapacity':this[_0x477d('0x18')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x477d('0x39')],'whatsappCapacity':this[_0x477d('0x19')],'whatsappCurrentCapacity':this[_0x477d('0x1a')],'openchannelStatus':this[_0x477d('0x1b')],'openchannelStatusTime':this[_0x477d('0x1c')],'openchannelCapacity':this[_0x477d('0x1d')],'openchannelCurrentCapacity':this[_0x477d('0x3a')],'busy':this[_0x477d('0x1e')],'busyQueue':this[_0x477d('0x1f')],'chatWaitingInteractions':this[_0x477d('0x20')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x477d('0x22')],'openchannelWaitingInteractions':this[_0x477d('0x23')],'smsWaitingInteractions':this[_0x477d('0x24')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x50b3f7=md5(JSON[_0x477d('0x3b')](_0xeb02f5));if(this[_0x477d('0x0')]!==_0x50b3f7){this['md5']=_0x50b3f7;io['emit'](_0x477d('0x3c'),_[_0x477d('0x3d')](_0xeb02f5,[_0x477d('0x6')]));}};module[_0x477d('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 e591992..240f36f 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 _0xa9a3=['util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','online','chatPause','available','format','emit','chat_queue:save','exports','lodash','md5'];(function(_0x42ab45,_0x2e666e){var _0x41fa2d=function(_0xb0aef1){while(--_0xb0aef1){_0x42ab45['push'](_0x42ab45['shift']());}};_0x41fa2d(++_0x2e666e);}(_0xa9a3,0x14e));var _0x3a9a=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0xa9a3[_0x3da612];return _0x1a9d1d;};'use strict';var _=require(_0x3a9a('0x0'));var md5=require(_0x3a9a('0x1'));var util=require(_0x3a9a('0x2'));var Redis=require(_0x3a9a('0x3'));var config=require(_0x3a9a('0x4'));config[_0x3a9a('0x5')]=_[_0x3a9a('0x6')](config[_0x3a9a('0x5')],{'host':_0x3a9a('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3a9a('0x5')]));function ChatQueue(_0x1c5a44){this['id']=_0x1c5a44['id']||0x0;this[_0x3a9a('0x8')]=_0x1c5a44[_0x3a9a('0x8')]||'';this[_0x3a9a('0x9')]=_0x1c5a44[_0x3a9a('0x9')]||0xa;this[_0x3a9a('0xa')]=_0x1c5a44['strategy']||_0x3a9a('0xb');this[_0x3a9a('0xc')]=_0x1c5a44[_0x3a9a('0xc')];this[_0x3a9a('0xd')]={};this[_0x3a9a('0xe')]=0x0;this[_0x3a9a('0x1')]='';this[_0x3a9a('0xf')]();this[_0x3a9a('0x10')]();}ChatQueue['prototype'][_0x3a9a('0xf')]=function(){var _0x3053aa=this[_0x3a9a('0xd')][_0x3a9a('0x11')];this[_0x3a9a('0xd')]=_[_0x3a9a('0x12')](this[_0x3a9a('0xc')],'id');this[_0x3a9a('0xd')]['_rr']=_0x3053aa;};ChatQueue['prototype'][_0x3a9a('0x10')]=function(){this[_0x3a9a('0x13')]=0x0;this[_0x3a9a('0x14')]=0x0;for(var _0x26151f=0x0;_0x26151f=0x0?this['available']:0x0;var _0x2c3b44={'id':this['id'],'available':this[_0x3a9a('0x17')],'loggedIn':this[_0x3a9a('0x13')],'name':this[_0x3a9a('0x8')],'paused':this[_0x3a9a('0x14')],'waiting':this[_0x3a9a('0xe')]};var _0x1c97a9=md5(JSON['stringify'](_0x2c3b44));if(this[_0x3a9a('0x1')]!==_0x1c97a9){this[_0x3a9a('0x1')]=_0x1c97a9;io['to'](util[_0x3a9a('0x18')]('chat:queue:%s',_0x2c3b44[_0x3a9a('0x8')]))[_0x3a9a('0x19')](_0x3a9a('0x1a'),_0x2c3b44);}};module[_0x3a9a('0x1b')]=ChatQueue; \ No newline at end of file +var _0x7037=['waiting','prototype','updateRouting','_rr','map','updateRealtime','loggedIn','length','online','chatPause','available','paused','stringify','format','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x549278,_0x450754){var _0x1ea9a1=function(_0x2e559d){while(--_0x2e559d){_0x549278['push'](_0x549278['shift']());}};_0x1ea9a1(++_0x450754);}(_0x7037,0x128));var _0x7703=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x7037[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x7703('0x0'));var md5=require(_0x7703('0x1'));var util=require(_0x7703('0x2'));var Redis=require(_0x7703('0x3'));var config=require(_0x7703('0x4'));config[_0x7703('0x5')]=_[_0x7703('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7703('0x7'))(new Redis(config[_0x7703('0x5')]));function ChatQueue(_0x47153b){this['id']=_0x47153b['id']||0x0;this[_0x7703('0x8')]=_0x47153b['name']||'';this[_0x7703('0x9')]=_0x47153b[_0x7703('0x9')]||0xa;this[_0x7703('0xa')]=_0x47153b[_0x7703('0xa')]||_0x7703('0xb');this[_0x7703('0xc')]=_0x47153b['Agents'];this[_0x7703('0xd')]={};this[_0x7703('0xe')]=0x0;this[_0x7703('0x1')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x7703('0xf')][_0x7703('0x10')]=function(){var _0xefd767=this[_0x7703('0xd')][_0x7703('0x11')];this['mapAgentsId']=_[_0x7703('0x12')](this[_0x7703('0xc')],'id');this['mapAgentsId']['_rr']=_0xefd767;};ChatQueue['prototype'][_0x7703('0x13')]=function(){this[_0x7703('0x14')]=0x0;this['paused']=0x0;for(var _0x1d1144=0x0;_0x1d1144=0x0?this[_0x7703('0x18')]:0x0;var _0x371318={'id':this['id'],'available':this[_0x7703('0x18')],'loggedIn':this[_0x7703('0x14')],'name':this[_0x7703('0x8')],'paused':this[_0x7703('0x19')],'waiting':this['waiting']};var _0x32bd67=md5(JSON[_0x7703('0x1a')](_0x371318));if(this[_0x7703('0x1')]!==_0x32bd67){this[_0x7703('0x1')]=_0x32bd67;io['to'](util[_0x7703('0x1b')]('chat:queue:%s',_0x371318['name']))[_0x7703('0x1c')](_0x7703('0x1d'),_0x371318);}};module[_0x7703('0x1e')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index fdad939..23d06c4 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 _0x77e3=['paused','online','faxPause','available','format','fax:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn'];(function(_0x4e3fff,_0x2eb510){var _0x3c569c=function(_0x14cc0d){while(--_0x14cc0d){_0x4e3fff['push'](_0x4e3fff['shift']());}};_0x3c569c(++_0x2eb510);}(_0x77e3,0x116));var _0x377e=function(_0x871323,_0x124801){_0x871323=_0x871323-0x0;var _0x51e770=_0x77e3[_0x871323];return _0x51e770;};'use strict';var _=require(_0x377e('0x0'));var md5=require(_0x377e('0x1'));var util=require('util');var Redis=require(_0x377e('0x2'));var config=require(_0x377e('0x3'));config[_0x377e('0x4')]=_['defaults'](config[_0x377e('0x4')],{'host':_0x377e('0x5'),'port':0x18eb});var io=require(_0x377e('0x6'))(new Redis(config['redis']));function FaxQueue(_0x579b14){this['id']=_0x579b14['id']||0x0;this[_0x377e('0x7')]=_0x579b14['name']||'';this[_0x377e('0x8')]=_0x579b14['timeout']||0xa;this[_0x377e('0x9')]=_0x579b14[_0x377e('0x9')]||_0x377e('0xa');this[_0x377e('0xb')]=_0x579b14[_0x377e('0xb')];this['mapAgentsId']={};this[_0x377e('0xc')]=0x0;this[_0x377e('0x1')]='';this[_0x377e('0xd')]();this[_0x377e('0xe')]();}FaxQueue[_0x377e('0xf')][_0x377e('0xd')]=function(){var _0x17a492=this[_0x377e('0x10')][_0x377e('0x11')];this['mapAgentsId']=_['map'](this[_0x377e('0xb')],'id');this[_0x377e('0x10')][_0x377e('0x11')]=_0x17a492;};FaxQueue['prototype'][_0x377e('0xe')]=function(){this[_0x377e('0x12')]=0x0;this[_0x377e('0x13')]=0x0;for(var _0xc03c05=0x0;_0xc03c05=0x0?this['available']:0x0;var _0x534863={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x377e('0x7')],'paused':this[_0x377e('0x13')],'waiting':this[_0x377e('0xc')]};var _0x51816b=md5(JSON['stringify'](_0x534863));if(this[_0x377e('0x1')]!==_0x51816b){this['md5']=_0x51816b;io['to'](util[_0x377e('0x17')](_0x377e('0x18'),_0x534863[_0x377e('0x7')]))[_0x377e('0x19')]('fax_queue:save',_0x534863);}};module[_0x377e('0x1a')]=FaxQueue; \ No newline at end of file +var _0x624b=['mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','length','available','stringify','format','fax:queue:%s','emit','exports','lodash','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents'];(function(_0x27e82f,_0x3f3956){var _0xa5d284=function(_0x405cf2){while(--_0x405cf2){_0x27e82f['push'](_0x27e82f['shift']());}};_0xa5d284(++_0x3f3956);}(_0x624b,0x148));var _0xb624=function(_0x577d61,_0x46143e){_0x577d61=_0x577d61-0x0;var _0xb06c87=_0x624b[_0x577d61];return _0xb06c87;};'use strict';var _=require(_0xb624('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xb624('0x1'));var config=require(_0xb624('0x2'));config[_0xb624('0x3')]=_['defaults'](config[_0xb624('0x3')],{'host':_0xb624('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb624('0x3')]));function FaxQueue(_0x4b696b){this['id']=_0x4b696b['id']||0x0;this['name']=_0x4b696b[_0xb624('0x5')]||'';this[_0xb624('0x6')]=_0x4b696b['timeout']||0xa;this['strategy']=_0x4b696b[_0xb624('0x7')]||_0xb624('0x8');this[_0xb624('0x9')]=_0x4b696b[_0xb624('0x9')];this[_0xb624('0xa')]={};this[_0xb624('0xb')]=0x0;this[_0xb624('0xc')]='';this['updateRouting']();this[_0xb624('0xd')]();}FaxQueue[_0xb624('0xe')][_0xb624('0xf')]=function(){var _0x1804aa=this['mapAgentsId'][_0xb624('0x10')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xb624('0xa')]['_rr']=_0x1804aa;};FaxQueue[_0xb624('0xe')][_0xb624('0xd')]=function(){this[_0xb624('0x11')]=0x0;this[_0xb624('0x12')]=0x0;for(var _0x2c6ac7=0x0;_0x2c6ac7=0x0?this[_0xb624('0x14')]:0x0;var _0x4ea9d4={'id':this['id'],'available':this[_0xb624('0x14')],'loggedIn':this[_0xb624('0x11')],'name':this[_0xb624('0x5')],'paused':this[_0xb624('0x12')],'waiting':this['waiting']};var _0x4faf01=md5(JSON[_0xb624('0x15')](_0x4ea9d4));if(this[_0xb624('0xc')]!==_0x4faf01){this['md5']=_0x4faf01;io['to'](util[_0xb624('0x16')](_0xb624('0x17'),_0x4ea9d4[_0xb624('0x5')]))[_0xb624('0x18')]('fax_queue:save',_0x4ea9d4);}};module[_0xb624('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 05ff532..e341748 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 _0x5469=['Intervals','exports','name'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0x5469,0x1cd));var _0x9546=function(_0x42c118,_0x197006){_0x42c118=_0x42c118-0x0;var _0x112ebd=_0x5469[_0x42c118];return _0x112ebd;};'use strict';function Interval(_0x589171){this['id']=_0x589171['id']||0x0;this[_0x9546('0x0')]=_0x589171[_0x9546('0x0')]||'';this[_0x9546('0x1')]=_0x589171['Intervals']||{};}module[_0x9546('0x2')]=Interval; \ No newline at end of file +var _0x2934=['exports','name','Intervals'];(function(_0x1b4d86,_0x19c05d){var _0x4c61c8=function(_0x8a4d8e){while(--_0x8a4d8e){_0x1b4d86['push'](_0x1b4d86['shift']());}};_0x4c61c8(++_0x19c05d);}(_0x2934,0x11e));var _0x4293=function(_0x5c9546,_0x46d7b4){_0x5c9546=_0x5c9546-0x0;var _0x19c4bb=_0x2934[_0x5c9546];return _0x19c4bb;};'use strict';function Interval(_0x4ba09b){this['id']=_0x4ba09b['id']||0x0;this[_0x4293('0x0')]=_0x4ba09b[_0x4293('0x0')]||'';this['Intervals']=_0x4ba09b[_0x4293('0x1')]||{};}module[_0x4293('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 e180da2..40d0e9f 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 _0x87e9=['waiting','stringify','mail:queue:%s','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','length','online','mailPause','available'];(function(_0x2e837b,_0x359ca6){var _0xf86477=function(_0x1a89fa){while(--_0x1a89fa){_0x2e837b['push'](_0x2e837b['shift']());}};_0xf86477(++_0x359ca6);}(_0x87e9,0xb3));var _0x987e=function(_0x4ccd9f,_0x4a1de5){_0x4ccd9f=_0x4ccd9f-0x0;var _0x41db3e=_0x87e9[_0x4ccd9f];return _0x41db3e;};'use strict';var _=require(_0x987e('0x0'));var md5=require(_0x987e('0x1'));var util=require(_0x987e('0x2'));var Redis=require(_0x987e('0x3'));var config=require(_0x987e('0x4'));config[_0x987e('0x5')]=_[_0x987e('0x6')](config[_0x987e('0x5')],{'host':_0x987e('0x7'),'port':0x18eb});var io=require(_0x987e('0x8'))(new Redis(config['redis']));function MailQueue(_0x15953f){this['id']=_0x15953f['id']||0x0;this[_0x987e('0x9')]=_0x15953f[_0x987e('0x9')]||'';this['timeout']=_0x15953f[_0x987e('0xa')]||0xa;this[_0x987e('0xb')]=_0x15953f[_0x987e('0xb')]||'beepall';this[_0x987e('0xc')]=_0x15953f[_0x987e('0xc')];this[_0x987e('0xd')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0x987e('0xe')]();}MailQueue[_0x987e('0xf')][_0x987e('0x10')]=function(){var _0x390608=this[_0x987e('0xd')][_0x987e('0x11')];this[_0x987e('0xd')]=_['map'](this[_0x987e('0xc')],'id');this[_0x987e('0xd')][_0x987e('0x11')]=_0x390608;};MailQueue['prototype'][_0x987e('0xe')]=function(){this[_0x987e('0x12')]=0x0;this[_0x987e('0x13')]=0x0;for(var _0x4dbda5=0x0;_0x4dbda5=0x0?this['available']:0x0;var _0x59329f={'id':this['id'],'available':this[_0x987e('0x17')],'loggedIn':this[_0x987e('0x12')],'name':this[_0x987e('0x9')],'paused':this[_0x987e('0x13')],'waiting':this[_0x987e('0x18')]};var _0x1551dd=md5(JSON[_0x987e('0x19')](_0x59329f));if(this['md5']!==_0x1551dd){this[_0x987e('0x1')]=_0x1551dd;io['to'](util['format'](_0x987e('0x1a'),_0x59329f[_0x987e('0x9')]))['emit'](_0x987e('0x1b'),_0x59329f);}};module[_0x987e('0x1c')]=MailQueue; \ No newline at end of file +var _0x705f=['strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','length','online','mailPause','available','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0x705f,0xa4));var _0xf705=function(_0x46fd05,_0x2a121d){_0x46fd05=_0x46fd05-0x0;var _0xdcbee=_0x705f[_0x46fd05];return _0xdcbee;};'use strict';var _=require(_0xf705('0x0'));var md5=require(_0xf705('0x1'));var util=require(_0xf705('0x2'));var Redis=require('ioredis');var config=require(_0xf705('0x3'));config[_0xf705('0x4')]=_[_0xf705('0x5')](config[_0xf705('0x4')],{'host':_0xf705('0x6'),'port':0x18eb});var io=require(_0xf705('0x7'))(new Redis(config[_0xf705('0x4')]));function MailQueue(_0x380073){this['id']=_0x380073['id']||0x0;this[_0xf705('0x8')]=_0x380073['name']||'';this[_0xf705('0x9')]=_0x380073[_0xf705('0x9')]||0xa;this['strategy']=_0x380073[_0xf705('0xa')]||_0xf705('0xb');this[_0xf705('0xc')]=_0x380073['Agents'];this['mapAgentsId']={};this[_0xf705('0xd')]=0x0;this['md5']='';this[_0xf705('0xe')]();this[_0xf705('0xf')]();}MailQueue[_0xf705('0x10')][_0xf705('0xe')]=function(){var _0x225cb8=this[_0xf705('0x11')][_0xf705('0x12')];this[_0xf705('0x11')]=_['map'](this[_0xf705('0xc')],'id');this['mapAgentsId'][_0xf705('0x12')]=_0x225cb8;};MailQueue[_0xf705('0x10')][_0xf705('0xf')]=function(){this[_0xf705('0x13')]=0x0;this[_0xf705('0x14')]=0x0;for(var _0x46397a=0x0;_0x46397a=0x0?this[_0xf705('0x18')]:0x0;var _0x1a0ab5={'id':this['id'],'available':this[_0xf705('0x18')],'loggedIn':this[_0xf705('0x13')],'name':this[_0xf705('0x8')],'paused':this[_0xf705('0x14')],'waiting':this[_0xf705('0xd')]};var _0xc8dd23=md5(JSON['stringify'](_0x1a0ab5));if(this[_0xf705('0x1')]!==_0xc8dd23){this[_0xf705('0x1')]=_0xc8dd23;io['to'](util['format'](_0xf705('0x19'),_0x1a0ab5[_0xf705('0x8')]))[_0xf705('0x1a')](_0xf705('0x1b'),_0x1a0ab5);}};module[_0xf705('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index f837700..b3c893f 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 _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(_0xb4fe2c,_0x3d2be6){var _0x460a1a=function(_0x2f8039){while(--_0x2f8039){_0xb4fe2c['push'](_0xb4fe2c['shift']());}};_0x460a1a(++_0x3d2be6);}(_0xadb5,0xad));var _0x5adb=function(_0x50bea8,_0x36212b){_0x50bea8=_0x50bea8-0x0;var _0x43b59f=_0xadb5[_0x50bea8];return _0x43b59f;};'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 +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x564394,_0x363686){var _0x4d6b21=function(_0x1afabb){while(--_0x1afabb){_0x564394['push'](_0x564394['shift']());}};_0x4d6b21(++_0x363686);}(_0x814b,0x1a2));var _0xb814=function(_0x267484,_0x3eb131){_0x267484=_0x267484-0x0;var _0x14a356=_0x814b[_0x267484];return _0x14a356;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index cefa2af..36e22fe 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 _0x0b78=['socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify','emit','sms_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','localhost'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0b78,0x1ad));var _0x80b7=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0b78[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x80b7('0x0'));var md5=require(_0x80b7('0x1'));var util=require('util');var Redis=require(_0x80b7('0x2'));var config=require(_0x80b7('0x3'));config['redis']=_[_0x80b7('0x4')](config['redis'],{'host':_0x80b7('0x5'),'port':0x18eb});var io=require(_0x80b7('0x6'))(new Redis(config[_0x80b7('0x7')]));function SmsQueue(_0x5d4a96){this['id']=_0x5d4a96['id']||0x0;this['name']=_0x5d4a96[_0x80b7('0x8')]||'';this['timeout']=_0x5d4a96[_0x80b7('0x9')]||0xa;this[_0x80b7('0xa')]=_0x5d4a96[_0x80b7('0xa')]||_0x80b7('0xb');this['Agents']=_0x5d4a96[_0x80b7('0xc')];this[_0x80b7('0xd')]={};this[_0x80b7('0xe')]=0x0;this['md5']='';this[_0x80b7('0xf')]();this['updateRealtime']();}SmsQueue[_0x80b7('0x10')][_0x80b7('0xf')]=function(){var _0x3b19da=this[_0x80b7('0xd')][_0x80b7('0x11')];this[_0x80b7('0xd')]=_[_0x80b7('0x12')](this[_0x80b7('0xc')],'id');this[_0x80b7('0xd')][_0x80b7('0x11')]=_0x3b19da;};SmsQueue[_0x80b7('0x10')]['updateRealtime']=function(){this[_0x80b7('0x13')]=0x0;this[_0x80b7('0x14')]=0x0;for(var _0x527c5b=0x0;_0x527c5b=0x0?this['available']:0x0;var _0x3bb691={'id':this['id'],'available':this[_0x80b7('0x18')],'loggedIn':this[_0x80b7('0x13')],'name':this[_0x80b7('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x45be23=md5(JSON[_0x80b7('0x19')](_0x3bb691));if(this[_0x80b7('0x1')]!==_0x45be23){this[_0x80b7('0x1')]=_0x45be23;io['to'](util['format']('sms:queue:%s',_0x3bb691[_0x80b7('0x8')]))[_0x80b7('0x1a')](_0x80b7('0x1b'),_0x3bb691);}};module[_0x80b7('0x1c')]=SmsQueue; \ No newline at end of file +var _0xe94a=['timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','paused','length','online','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x1c676e,_0x5db04b){var _0x5e06ab=function(_0xb3187b){while(--_0xb3187b){_0x1c676e['push'](_0x1c676e['shift']());}};_0x5e06ab(++_0x5db04b);}(_0xe94a,0x1c7));var _0xae94=function(_0x2ad008,_0x45c253){_0x2ad008=_0x2ad008-0x0;var _0x4538cf=_0xe94a[_0x2ad008];return _0x4538cf;};'use strict';var _=require(_0xae94('0x0'));var md5=require(_0xae94('0x1'));var util=require(_0xae94('0x2'));var Redis=require('ioredis');var config=require(_0xae94('0x3'));config[_0xae94('0x4')]=_[_0xae94('0x5')](config[_0xae94('0x4')],{'host':_0xae94('0x6'),'port':0x18eb});var io=require(_0xae94('0x7'))(new Redis(config['redis']));function SmsQueue(_0x429d6d){this['id']=_0x429d6d['id']||0x0;this[_0xae94('0x8')]=_0x429d6d[_0xae94('0x8')]||'';this[_0xae94('0x9')]=_0x429d6d[_0xae94('0x9')]||0xa;this['strategy']=_0x429d6d['strategy']||_0xae94('0xa');this[_0xae94('0xb')]=_0x429d6d['Agents'];this[_0xae94('0xc')]={};this[_0xae94('0xd')]=0x0;this[_0xae94('0x1')]='';this[_0xae94('0xe')]();this[_0xae94('0xf')]();}SmsQueue[_0xae94('0x10')][_0xae94('0xe')]=function(){var _0x3e24c6=this['mapAgentsId']['_rr'];this[_0xae94('0xc')]=_[_0xae94('0x11')](this['Agents'],'id');this[_0xae94('0xc')]['_rr']=_0x3e24c6;};SmsQueue[_0xae94('0x10')][_0xae94('0xf')]=function(){this[_0xae94('0x12')]=0x0;this[_0xae94('0x13')]=0x0;for(var _0x223e35=0x0;_0x223e35=0x0?this[_0xae94('0x16')]:0x0;var _0x382b4a={'id':this['id'],'available':this[_0xae94('0x16')],'loggedIn':this[_0xae94('0x12')],'name':this['name'],'paused':this[_0xae94('0x13')],'waiting':this[_0xae94('0xd')]};var _0x5a0cdd=md5(JSON[_0xae94('0x17')](_0x382b4a));if(this[_0xae94('0x1')]!==_0x5a0cdd){this['md5']=_0x5a0cdd;io['to'](util[_0xae94('0x18')](_0xae94('0x19'),_0x382b4a[_0xae94('0x8')]))[_0xae94('0x1a')](_0xae94('0x1b'),_0x382b4a);}};module[_0xae94('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index f84a7aa..748d3c7 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 _0x1517=['util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','exports','lodash','md5'];(function(_0x832a41,_0x5c0933){var _0x486bf7=function(_0x4ff984){while(--_0x4ff984){_0x832a41['push'](_0x832a41['shift']());}};_0x486bf7(++_0x5c0933);}(_0x1517,0xac));var _0x7151=function(_0x5086f7,_0x35bb69){_0x5086f7=_0x5086f7-0x0;var _0x253f9b=_0x1517[_0x5086f7];return _0x253f9b;};'use strict';var _=require(_0x7151('0x0'));var md5=require(_0x7151('0x1'));var util=require(_0x7151('0x2'));var Redis=require('ioredis');var config=require(_0x7151('0x3'));config[_0x7151('0x4')]=_['defaults'](config[_0x7151('0x4')],{'host':_0x7151('0x5'),'port':0x18eb});var io=require(_0x7151('0x6'))(new Redis(config[_0x7151('0x4')]));function WhatsappQueue(_0x8a2551){this['id']=_0x8a2551['id']||0x0;this[_0x7151('0x7')]=_0x8a2551[_0x7151('0x7')]||'';this[_0x7151('0x8')]=_0x8a2551[_0x7151('0x8')]||0xa;this['strategy']=_0x8a2551[_0x7151('0x9')]||_0x7151('0xa');this[_0x7151('0xb')]=_0x8a2551['Agents'];this[_0x7151('0xc')]={};this[_0x7151('0xd')]=0x0;this[_0x7151('0x1')]='';this[_0x7151('0xe')]();this[_0x7151('0xf')]();}WhatsappQueue[_0x7151('0x10')]['updateRouting']=function(){var _0x51b7aa=this[_0x7151('0xc')][_0x7151('0x11')];this['mapAgentsId']=_[_0x7151('0x12')](this[_0x7151('0xb')],'id');this[_0x7151('0xc')][_0x7151('0x11')]=_0x51b7aa;};WhatsappQueue[_0x7151('0x10')][_0x7151('0xf')]=function(){this[_0x7151('0x13')]=0x0;this[_0x7151('0x14')]=0x0;for(var _0x5ae2d7=0x0;_0x5ae2d7=0x0?this[_0x7151('0x18')]:0x0;var _0x231a93={'id':this['id'],'available':this[_0x7151('0x18')],'loggedIn':this[_0x7151('0x13')],'name':this['name'],'paused':this[_0x7151('0x14')],'waiting':this[_0x7151('0xd')]};var _0x567dde=md5(JSON[_0x7151('0x19')](_0x231a93));if(this[_0x7151('0x1')]!==_0x567dde){this[_0x7151('0x1')]=_0x567dde;io['to'](util[_0x7151('0x1a')](_0x7151('0x1b'),_0x231a93[_0x7151('0x7')]))['emit']('whatsapp_queue:save',_0x231a93);}};module[_0x7151('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0xf26c=['md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','available','stringify'];(function(_0x33155c,_0x3fdde1){var _0x5becf7=function(_0x2f7a2f){while(--_0x2f7a2f){_0x33155c['push'](_0x33155c['shift']());}};_0x5becf7(++_0x3fdde1);}(_0xf26c,0x1cc));var _0xcf26=function(_0x4b4529,_0x2169ff){_0x4b4529=_0x4b4529-0x0;var _0x2f99c9=_0xf26c[_0x4b4529];return _0x2f99c9;};'use strict';var _=require('lodash');var md5=require(_0xcf26('0x0'));var util=require(_0xcf26('0x1'));var Redis=require(_0xcf26('0x2'));var config=require('../../../config/environment');config[_0xcf26('0x3')]=_[_0xcf26('0x4')](config[_0xcf26('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xcf26('0x5'))(new Redis(config[_0xcf26('0x3')]));function WhatsappQueue(_0x227035){this['id']=_0x227035['id']||0x0;this[_0xcf26('0x6')]=_0x227035['name']||'';this[_0xcf26('0x7')]=_0x227035[_0xcf26('0x7')]||0xa;this[_0xcf26('0x8')]=_0x227035['strategy']||_0xcf26('0x9');this[_0xcf26('0xa')]=_0x227035['Agents'];this[_0xcf26('0xb')]={};this['waiting']=0x0;this[_0xcf26('0x0')]='';this[_0xcf26('0xc')]();this['updateRealtime']();}WhatsappQueue[_0xcf26('0xd')][_0xcf26('0xc')]=function(){var _0x29d700=this[_0xcf26('0xb')][_0xcf26('0xe')];this[_0xcf26('0xb')]=_[_0xcf26('0xf')](this[_0xcf26('0xa')],'id');this[_0xcf26('0xb')]['_rr']=_0x29d700;};WhatsappQueue[_0xcf26('0xd')][_0xcf26('0x10')]=function(){this[_0xcf26('0x11')]=0x0;this[_0xcf26('0x12')]=0x0;for(var _0x165afa=0x0;_0x165afa=0x0?this['available']:0x0;var _0x27853e={'id':this['id'],'available':this[_0xcf26('0x15')],'loggedIn':this[_0xcf26('0x11')],'name':this[_0xcf26('0x6')],'paused':this[_0xcf26('0x12')],'waiting':this['waiting']};var _0x2731d=md5(JSON[_0xcf26('0x16')](_0x27853e));if(this[_0xcf26('0x0')]!==_0x2731d){this[_0xcf26('0x0')]=_0x2731d;io['to'](util['format']('whatsapp:queue:%s',_0x27853e[_0xcf26('0x6')]))['emit']('whatsapp_queue:save',_0x27853e);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 47eaf81..237d540 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x3e0edb,_0x4da45b){var _0x10b8fa=function(_0x41775e){while(--_0x41775e){_0x3e0edb['push'](_0x3e0edb['shift']());}};_0x10b8fa(++_0x4da45b);}(_0xb10b,0x12a));var _0xbb10=function(_0x23b57c,_0xdc7f98){_0x23b57c=_0x23b57c-0x0;var _0x4c3b1d=_0xb10b[_0x23b57c];return _0x4c3b1d;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 87d7c3d..27b362e 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 _0xb424=['updateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','UpdateChatInteraction'];(function(_0x57a377,_0x583929){var _0x10cf88=function(_0x19a40b){while(--_0x19a40b){_0x57a377['push'](_0x57a377['shift']());}};_0x10cf88(++_0x583929);}(_0xb424,0x1d5));var _0x4b42=function(_0x330723,_0x8de382){_0x330723=_0x330723-0x0;var _0x60c546=_0xb424[_0x330723];return _0x60c546;};'use strict';var client=require(_0x4b42('0x0'));exports[_0x4b42('0x1')]=function(_0x48609f,_0x275db9){return client['Request'](_0x4b42('0x2'),{'body':_0x275db9,'options':{'where':{'id':_0x48609f}},'log':_0x4b42('0x3')});};exports[_0x4b42('0x4')]=function(_0x497455,_0x2a20a5){return client[_0x4b42('0x5')](_0x4b42('0x6'),{'body':_0x2a20a5,'options':{'where':{'id':_0x497455}},'log':_0x4b42('0x7')});}; \ No newline at end of file +var _0xb369=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','update','Request','UpdateChatInteraction'];(function(_0x28d1cd,_0x192371){var _0xdcb892=function(_0x145f6e){while(--_0x145f6e){_0x28d1cd['push'](_0x28d1cd['shift']());}};_0xdcb892(++_0x192371);}(_0xb369,0x153));var _0x9b36=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xb369[_0x40a045];return _0x1a687c;};'use strict';var client=require('../client');exports[_0x9b36('0x0')]=function(_0x4bde71,_0x13f7d6){return client[_0x9b36('0x1')](_0x9b36('0x2'),{'body':_0x13f7d6,'options':{'where':{'id':_0x4bde71}},'log':'updateChatInteraction'});};exports[_0x9b36('0x3')]=function(_0x338d0e,_0x20b736){return client[_0x9b36('0x1')](_0x9b36('0x4'),{'body':_0x20b736,'options':{'where':{'id':_0x338d0e}},'log':_0x9b36('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index cbd21ed..8a4cf48 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 _0xcea5=['createChatMessage','create','Request','CreateChatMessage'];(function(_0x36bb82,_0x196466){var _0x119dfc=function(_0x25440d){while(--_0x25440d){_0x36bb82['push'](_0x36bb82['shift']());}};_0x119dfc(++_0x196466);}(_0xcea5,0xa1));var _0x5cea=function(_0x1605f5,_0x345808){_0x1605f5=_0x1605f5-0x0;var _0x5e6891=_0xcea5[_0x1605f5];return _0x5e6891;};'use strict';var client=require('../client');exports[_0x5cea('0x0')]=function(_0x28f3d1){return client[_0x5cea('0x1')](_0x5cea('0x2'),{'body':_0x28f3d1,'log':_0x5cea('0x3')});}; \ No newline at end of file +var _0x4f58=['Request','CreateChatMessage','create'];(function(_0x3384a9,_0x1c257f){var _0x38b024=function(_0x4882d4){while(--_0x4882d4){_0x3384a9['push'](_0x3384a9['shift']());}};_0x38b024(++_0x1c257f);}(_0x4f58,0xb9));var _0x84f5=function(_0x5bc8d3,_0x5b008b){_0x5bc8d3=_0x5bc8d3-0x0;var _0x42fec0=_0x4f58[_0x5bc8d3];return _0x42fec0;};'use strict';var client=require('../client');exports[_0x84f5('0x0')]=function(_0x41ea99){return client[_0x84f5('0x1')](_0x84f5('0x2'),{'body':_0x41ea99,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 88ef315..2502853 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 _0xf611=['User','name','online','getChatQueues','Request','GetChatQueue'];(function(_0x268b2d,_0x155a63){var _0x19ed1b=function(_0x40e9bb){while(--_0x40e9bb){_0x268b2d['push'](_0x268b2d['shift']());}};_0x19ed1b(++_0x155a63);}(_0xf611,0x7b));var _0x1f61=function(_0x58252d,_0x2070b3){_0x58252d=_0x58252d-0x0;var _0x55a98c=_0xf611[_0x58252d];return _0x55a98c;};'use strict';var client=require('../client');exports[_0x1f61('0x0')]=function(){return function(){return client[_0x1f61('0x1')](_0x1f61('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x1f61('0x3'),'as':'Agents','attributes':['id',_0x1f61('0x4'),_0x1f61('0x5'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xc3b5=['Agents','chatPause','getChatQueues','Request','GetChatQueue','name','timeout','strategy','User'];(function(_0x2b296b,_0x72c9ed){var _0x145992=function(_0x143863){while(--_0x143863){_0x2b296b['push'](_0x2b296b['shift']());}};_0x145992(++_0x72c9ed);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x21308a,_0x1e2bf6){_0x21308a=_0x21308a-0x0;var _0x2de5d2=_0xc3b5[_0x21308a];return _0x2de5d2;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0x5c3b('0x0')](_0x5c3b('0x1'),{'options':{'raw':![],'attributes':['id',_0x5c3b('0x2'),_0x5c3b('0x3'),_0x5c3b('0x4')],'include':[{'model':_0x5c3b('0x5'),'as':_0x5c3b('0x6'),'attributes':['id',_0x5c3b('0x2'),'online',_0x5c3b('0x7')]}]},'log':_0x5c3b('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index bed7058..3f61146 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 _0x55e0=['Request','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x19b4e5,_0x575ada){var _0x4ce05e=function(_0x231e59){while(--_0x231e59){_0x19b4e5['push'](_0x19b4e5['shift']());}};_0x4ce05e(++_0x575ada);}(_0x55e0,0xdc));var _0x055e=function(_0x3e6440,_0x2c3812){_0x3e6440=_0x3e6440-0x0;var _0x4cdc49=_0x55e0[_0x3e6440];return _0x4cdc49;};'use strict';var client=require(_0x055e('0x0'));exports[_0x055e('0x1')]=function(_0x2e09a6){return client[_0x055e('0x2')]('CreateChatQueueReport',{'body':_0x2e09a6,'log':'CreateChatQueueReport'});};exports[_0x055e('0x3')]=function(_0x2d9bd5,_0x33cd7b){return client[_0x055e('0x2')](_0x055e('0x4'),{'body':_0x33cd7b,'options':{'where':{'uniqueid':_0x2d9bd5},'order':[['id',_0x055e('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x0c02=['create','CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC'];(function(_0xe44b1,_0x242100){var _0x368147=function(_0x3cd64c){while(--_0x3cd64c){_0xe44b1['push'](_0xe44b1['shift']());}};_0x368147(++_0x242100);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x20c0('0x0')]=function(_0x33da8b){return client['Request'](_0x20c0('0x1'),{'body':_0x33da8b,'log':_0x20c0('0x1')});};exports[_0x20c0('0x2')]=function(_0x6d03d0,_0x38022e){return client[_0x20c0('0x3')](_0x20c0('0x4'),{'body':_0x38022e,'options':{'where':{'uniqueid':_0x6d03d0},'order':[['id',_0x20c0('0x5')]],'limit':0x1},'log':_0x20c0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 99fe5b0..eb1f59d 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(_0x424d98,_0xae5075){var _0xdad5cd=function(_0x227acd){while(--_0x227acd){_0x424d98['push'](_0x424d98['shift']());}};_0xdad5cd(++_0xae5075);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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(_0x3a1b30,_0x5de73d){var _0x18d50c=function(_0x35816b){while(--_0x35816b){_0x3a1b30['push'](_0x3a1b30['shift']());}};_0x18d50c(++_0x5de73d);}(_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 b6b40c8..b300fee 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 _0xbbb6=['CreateFaxMessage','../client','create','Request'];(function(_0x2c9ad1,_0x3bd9bc){var _0x5c7557=function(_0x58365d){while(--_0x58365d){_0x2c9ad1['push'](_0x2c9ad1['shift']());}};_0x5c7557(++_0x3bd9bc);}(_0xbbb6,0x14d));var _0x6bbb=function(_0x4a7790,_0x39b940){_0x4a7790=_0x4a7790-0x0;var _0x42ce7e=_0xbbb6[_0x4a7790];return _0x42ce7e;};'use strict';var client=require(_0x6bbb('0x0'));exports[_0x6bbb('0x1')]=function(_0x3d3804){return client[_0x6bbb('0x2')](_0x6bbb('0x3'),{'body':_0x3d3804,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x9868=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x2a7e75,_0x17efac){var _0x2095bb=function(_0x121384){while(--_0x121384){_0x2a7e75['push'](_0x2a7e75['shift']());}};_0x2095bb(++_0x17efac);}(_0x9868,0x9f));var _0x8986=function(_0x1af929,_0x38b9f6){_0x1af929=_0x1af929-0x0;var _0x12843a=_0x9868[_0x1af929];return _0x12843a;};'use strict';var client=require(_0x8986('0x0'));exports[_0x8986('0x1')]=function(_0x41a8a5){return client[_0x8986('0x2')](_0x8986('0x3'),{'body':_0x41a8a5,'log':_0x8986('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 0a74588..8bc0063 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 _0x9183=['../client','getFaxQueues','Request','GetFaxQueue','name','strategy','User','Agents','faxPause'];(function(_0x514969,_0x568fb0){var _0x326d9f=function(_0x7724a9){while(--_0x7724a9){_0x514969['push'](_0x514969['shift']());}};_0x326d9f(++_0x568fb0);}(_0x9183,0xbd));var _0x3918=function(_0x226298,_0xcca874){_0x226298=_0x226298-0x0;var _0x1882aa=_0x9183[_0x226298];return _0x1882aa;};'use strict';var client=require(_0x3918('0x0'));exports[_0x3918('0x1')]=function(){return function(){return client[_0x3918('0x2')](_0x3918('0x3'),{'options':{'raw':![],'attributes':['id',_0x3918('0x4'),'timeout',_0x3918('0x5')],'include':[{'model':_0x3918('0x6'),'as':_0x3918('0x7'),'attributes':['id',_0x3918('0x4'),'online',_0x3918('0x8')]}]},'log':_0x3918('0x1')});};}; \ No newline at end of file +var _0x9a5f=['GetFaxQueue','name','timeout','online','faxPause','getFaxQueues','../client'];(function(_0x10765b,_0x4099cf){var _0x4cac71=function(_0x262b89){while(--_0x262b89){_0x10765b['push'](_0x10765b['shift']());}};_0x4cac71(++_0x4099cf);}(_0x9a5f,0x125));var _0xf9a5=function(_0x38f34e,_0x287825){_0x38f34e=_0x38f34e-0x0;var _0x3f3adf=_0x9a5f[_0x38f34e];return _0x3f3adf;};'use strict';var client=require(_0xf9a5('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request'](_0xf9a5('0x1'),{'options':{'raw':![],'attributes':['id',_0xf9a5('0x2'),_0xf9a5('0x3'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0xf9a5('0x2'),_0xf9a5('0x4'),_0xf9a5('0x5')]}]},'log':_0xf9a5('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 80faea9..0347865 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 _0x6b55=['../client','create','CreateFaxQueueReport','Request'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x6b55,0xcc));var _0x56b5=function(_0x3cb21d,_0x11ffd7){_0x3cb21d=_0x3cb21d-0x0;var _0x342214=_0x6b55[_0x3cb21d];return _0x342214;};'use strict';var client=require(_0x56b5('0x0'));exports[_0x56b5('0x1')]=function(_0x221209){return client['Request'](_0x56b5('0x2'),{'body':_0x221209,'log':_0x56b5('0x2')});};exports['update']=function(_0x2b56cd,_0x515994){return client[_0x56b5('0x3')]('UpdateFaxQueueReport',{'body':_0x515994,'options':{'where':{'uniqueid':_0x2b56cd},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x132b=['update','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport'];(function(_0x1c54d6,_0x38ddf8){var _0x2f66d4=function(_0x5875fa){while(--_0x5875fa){_0x1c54d6['push'](_0x1c54d6['shift']());}};_0x2f66d4(++_0x38ddf8);}(_0x132b,0x1e8));var _0xb132=function(_0x2ede2e,_0x1ad38e){_0x2ede2e=_0x2ede2e-0x0;var _0x5f518a=_0x132b[_0x2ede2e];return _0x5f518a;};'use strict';var client=require(_0xb132('0x0'));exports[_0xb132('0x1')]=function(_0x49fc4b){return client[_0xb132('0x2')](_0xb132('0x3'),{'body':_0x49fc4b,'log':_0xb132('0x3')});};exports[_0xb132('0x4')]=function(_0x893e20,_0x4a4a16){return client['Request'](_0xb132('0x5'),{'body':_0x4a4a16,'options':{'where':{'uniqueid':_0x893e20},'order':[['id','DESC']],'limit':0x1},'log':_0xb132('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 918be29..b9728c3 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 _0xd516=['GetInterval','name','Interval','interval','../client','getIntervals','Request'];(function(_0x498d55,_0x3d29f6){var _0x4e837c=function(_0x31108a){while(--_0x31108a){_0x498d55['push'](_0x498d55['shift']());}};_0x4e837c(++_0x3d29f6);}(_0xd516,0x1af));var _0x6d51=function(_0x778250,_0xb6b124){_0x778250=_0x778250-0x0;var _0x4e179d=_0xd516[_0x778250];return _0x4e179d;};'use strict';var client=require(_0x6d51('0x0'));exports[_0x6d51('0x1')]=function(){return function(){return client[_0x6d51('0x2')](_0x6d51('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x6d51('0x4')],'include':[{'model':_0x6d51('0x5'),'as':'Intervals','attributes':['id',_0x6d51('0x4'),_0x6d51('0x6')]}]},'log':_0x6d51('0x1')});};}; \ No newline at end of file +var _0x25a3=['getIntervals','Request','GetInterval','name','Interval','Intervals','interval','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25a3,0xcf));var _0x325a=function(_0x4c0c50,_0x2577c6){_0x4c0c50=_0x4c0c50-0x0;var _0x2f0cae=_0x25a3[_0x4c0c50];return _0x2f0cae;};'use strict';var client=require(_0x325a('0x0'));exports[_0x325a('0x1')]=function(){return function(){return client[_0x325a('0x2')](_0x325a('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x325a('0x4')],'include':[{'model':_0x325a('0x5'),'as':_0x325a('0x6'),'attributes':['id','name',_0x325a('0x7')]}]},'log':_0x325a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 9623768..1b34eaf 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 _0x955f=['update','Request','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x126f42,_0x57f1ad){var _0x219119=function(_0xc6b727){while(--_0xc6b727){_0x126f42['push'](_0x126f42['shift']());}};_0x219119(++_0x57f1ad);}(_0x955f,0x1eb));var _0xf955=function(_0x16d3ea,_0x39fa06){_0x16d3ea=_0x16d3ea-0x0;var _0x2b9772=_0x955f[_0x16d3ea];return _0x2b9772;};'use strict';var client=require(_0xf955('0x0'));exports[_0xf955('0x1')]=function(_0x438668,_0x382225){return client[_0xf955('0x2')]('UpdateMailInteraction',{'body':_0x382225,'options':{'where':{'id':_0x438668}},'log':_0xf955('0x3')});};exports['addTags']=function(_0x5d0c95,_0x1db0dd){return client['Request'](_0xf955('0x4'),{'body':_0x1db0dd,'options':{'where':{'id':_0x5d0c95}},'log':_0xf955('0x5')});}; \ No newline at end of file +var _0x4888=['AddTagsToMailInteraction','addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x449787,_0x1acd57){var _0x9237dd=function(_0x21aece){while(--_0x21aece){_0x449787['push'](_0x449787['shift']());}};_0x9237dd(++_0x1acd57);}(_0x4888,0x198));var _0x8488=function(_0x41dd6b,_0x5ae4ba){_0x41dd6b=_0x41dd6b-0x0;var _0x156c5a=_0x4888[_0x41dd6b];return _0x156c5a;};'use strict';var client=require('../client');exports[_0x8488('0x0')]=function(_0x1f0e53,_0x2af900){return client[_0x8488('0x1')](_0x8488('0x2'),{'body':_0x2af900,'options':{'where':{'id':_0x1f0e53}},'log':_0x8488('0x3')});};exports[_0x8488('0x4')]=function(_0x571e4b,_0x267093){return client[_0x8488('0x1')](_0x8488('0x5'),{'body':_0x267093,'options':{'where':{'id':_0x571e4b}},'log':_0x8488('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index e0c9468..912c534 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 _0x1ac4=['create','Request','CreateMailMessage'];(function(_0x417867,_0x2019c9){var _0x4932ce=function(_0x354035){while(--_0x354035){_0x417867['push'](_0x417867['shift']());}};_0x4932ce(++_0x2019c9);}(_0x1ac4,0x1a4));var _0x41ac=function(_0x53daa0,_0x1000a6){_0x53daa0=_0x53daa0-0x0;var _0x1231cb=_0x1ac4[_0x53daa0];return _0x1231cb;};'use strict';var client=require('../client');exports[_0x41ac('0x0')]=function(_0xb6260c){return client[_0x41ac('0x1')](_0x41ac('0x2'),{'body':_0xb6260c,'log':'createMailMessage'});}; \ No newline at end of file +var _0x21d7=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x58e39a,_0x474e33){var _0x5233f4=function(_0x3fa875){while(--_0x3fa875){_0x58e39a['push'](_0x58e39a['shift']());}};_0x5233f4(++_0x474e33);}(_0x21d7,0x9d));var _0x721d=function(_0x594997,_0xb3f4ed){_0x594997=_0x594997-0x0;var _0x4bdbe9=_0x21d7[_0x594997];return _0x4bdbe9;};'use strict';var client=require(_0x721d('0x0'));exports[_0x721d('0x1')]=function(_0x2db85d){return client[_0x721d('0x2')](_0x721d('0x3'),{'body':_0x2db85d,'log':_0x721d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 7ef9111..dbc831b 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 _0x165f=['Agents','online','../client','getMailQueues','Request','GetMailQueue','name','User'];(function(_0x2ede63,_0x3b6096){var _0x2c5ceb=function(_0x1c0d31){while(--_0x1c0d31){_0x2ede63['push'](_0x2ede63['shift']());}};_0x2c5ceb(++_0x3b6096);}(_0x165f,0x12a));var _0xf165=function(_0x1747c7,_0x25dc38){_0x1747c7=_0x1747c7-0x0;var _0x220060=_0x165f[_0x1747c7];return _0x220060;};'use strict';var client=require(_0xf165('0x0'));exports[_0xf165('0x1')]=function(){return function(){return client[_0xf165('0x2')](_0xf165('0x3'),{'options':{'raw':![],'attributes':['id',_0xf165('0x4'),'timeout','strategy'],'include':[{'model':_0xf165('0x5'),'as':_0xf165('0x6'),'attributes':['id',_0xf165('0x4'),_0xf165('0x7'),'mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x35be=['timeout','strategy','User','Agents','online','mailPause','../client','getMailQueues','GetMailQueue','name'];(function(_0x291139,_0x7f30de){var _0x3c42c0=function(_0x5832e3){while(--_0x5832e3){_0x291139['push'](_0x291139['shift']());}};_0x3c42c0(++_0x7f30de);}(_0x35be,0x92));var _0xe35b=function(_0x36ad44,_0x390c18){_0x36ad44=_0x36ad44-0x0;var _0x5bb132=_0x35be[_0x36ad44];return _0x5bb132;};'use strict';var client=require(_0xe35b('0x0'));exports[_0xe35b('0x1')]=function(){return function(){return client['Request'](_0xe35b('0x2'),{'options':{'raw':![],'attributes':['id',_0xe35b('0x3'),_0xe35b('0x4'),_0xe35b('0x5')],'include':[{'model':_0xe35b('0x6'),'as':_0xe35b('0x7'),'attributes':['id',_0xe35b('0x3'),_0xe35b('0x8'),_0xe35b('0x9')]}]},'log':_0xe35b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 7f7affb..cdaf170 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 _0x39be=['UpdateMailQueueReport','DESC','../client','Request','CreateMailQueueReport'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x39be,0xc0));var _0xe39b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x39be[_0x2641f9];return _0x585741;};'use strict';var client=require(_0xe39b('0x0'));exports['create']=function(_0x3b2f53){return client[_0xe39b('0x1')](_0xe39b('0x2'),{'body':_0x3b2f53,'log':_0xe39b('0x2')});};exports['update']=function(_0x36216f,_0x284e52){return client[_0xe39b('0x1')](_0xe39b('0x3'),{'body':_0x284e52,'options':{'where':{'uniqueid':_0x36216f},'order':[['id',_0xe39b('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xd0bd=['CreateMailQueueReport','update','UpdateMailQueueReport','create','Request'];(function(_0x3c729b,_0x2a4146){var _0x55894c=function(_0x183a16){while(--_0x183a16){_0x3c729b['push'](_0x3c729b['shift']());}};_0x55894c(++_0x2a4146);}(_0xd0bd,0xe4));var _0xdd0b=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0xd0bd[_0x26f1b2];return _0x1624a4;};'use strict';var client=require('../client');exports[_0xdd0b('0x0')]=function(_0x3f578f){return client[_0xdd0b('0x1')](_0xdd0b('0x2'),{'body':_0x3f578f,'log':_0xdd0b('0x2')});};exports[_0xdd0b('0x3')]=function(_0x341892,_0x59989f){return client[_0xdd0b('0x1')](_0xdd0b('0x4'),{'body':_0x59989f,'options':{'where':{'uniqueid':_0x341892},'order':[['id','DESC']],'limit':0x1},'log':_0xdd0b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index e9d2285..e34d932 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 _0x08de=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x2aefff,_0x26a24b){var _0x4e4534=function(_0x592416){while(--_0x592416){_0x2aefff['push'](_0x2aefff['shift']());}};_0x4e4534(++_0x26a24b);}(_0x08de,0x1ec));var _0xe08d=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0x08de[_0x3e531a];return _0x3c2574;};'use strict';var client=require('../client');exports[_0xe08d('0x0')]=function(_0x3469a1,_0x481868){return client[_0xe08d('0x1')](_0xe08d('0x2'),{'body':_0x481868,'options':{'where':{'id':_0x3469a1}},'log':_0xe08d('0x3')});};exports['addTags']=function(_0x105457,_0x50ad26){return client[_0xe08d('0x1')](_0xe08d('0x4'),{'body':_0x50ad26,'options':{'where':{'id':_0x105457}},'log':_0xe08d('0x5')});}; \ No newline at end of file +var _0xdd7a=['addTags','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x548651,_0x2bf4ef){var _0x46402c=function(_0x369a19){while(--_0x369a19){_0x548651['push'](_0x548651['shift']());}};_0x46402c(++_0x2bf4ef);}(_0xdd7a,0x17b));var _0xadd7=function(_0x500dba,_0x86bce0){_0x500dba=_0x500dba-0x0;var _0x5d545d=_0xdd7a[_0x500dba];return _0x5d545d;};'use strict';var client=require(_0xadd7('0x0'));exports[_0xadd7('0x1')]=function(_0x529beb,_0x4768fd){return client[_0xadd7('0x2')](_0xadd7('0x3'),{'body':_0x4768fd,'options':{'where':{'id':_0x529beb}},'log':_0xadd7('0x4')});};exports[_0xadd7('0x5')]=function(_0xde4e97,_0x37b975){return client[_0xadd7('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x37b975,'options':{'where':{'id':_0xde4e97}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 78fc40a..1245a39 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 _0x7121=['createOpenchannelMessage','../client','Request','CreateOpenchannelMessage'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7121,0xfd));var _0x1712=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7121[_0x618414];return _0x21c19a;};'use strict';var client=require(_0x1712('0x0'));exports['create']=function(_0x40350){return client[_0x1712('0x1')](_0x1712('0x2'),{'body':_0x40350,'log':_0x1712('0x3')});}; \ No newline at end of file +var _0xffe0=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x2c5459,_0x3272cb){var _0xda3117=function(_0x1f7393){while(--_0x1f7393){_0x2c5459['push'](_0x2c5459['shift']());}};_0xda3117(++_0x3272cb);}(_0xffe0,0x75));var _0x0ffe=function(_0x2fd0a8,_0x557a9d){_0x2fd0a8=_0x2fd0a8-0x0;var _0x903e31=_0xffe0[_0x2fd0a8];return _0x903e31;};'use strict';var client=require(_0x0ffe('0x0'));exports[_0x0ffe('0x1')]=function(_0x49eab6){return client[_0x0ffe('0x2')](_0x0ffe('0x3'),{'body':_0x49eab6,'log':_0x0ffe('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 5ba13da..0a2f2f4 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 _0x2061=['online','getOpenchannelQueues','GetOpenchannelQueue','name','strategy','User'];(function(_0x1a3d8a,_0x42f927){var _0x36a9b6=function(_0x439c0a){while(--_0x439c0a){_0x1a3d8a['push'](_0x1a3d8a['shift']());}};_0x36a9b6(++_0x42f927);}(_0x2061,0x18d));var _0x1206=function(_0x5e3e91,_0x49ee23){_0x5e3e91=_0x5e3e91-0x0;var _0x59fdac=_0x2061[_0x5e3e91];return _0x59fdac;};'use strict';var client=require('../client');exports[_0x1206('0x0')]=function(){return function(){return client['Request'](_0x1206('0x1'),{'options':{'raw':![],'attributes':['id',_0x1206('0x2'),'timeout',_0x1206('0x3')],'include':[{'model':_0x1206('0x4'),'as':'Agents','attributes':['id',_0x1206('0x2'),_0x1206('0x5'),'openchannelPause']}]},'log':_0x1206('0x0')});};}; \ No newline at end of file +var _0x7a97=['timeout','strategy','Agents','online','openchannelPause','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','name'];(function(_0x198e50,_0x1f8708){var _0x478867=function(_0x105c25){while(--_0x105c25){_0x198e50['push'](_0x198e50['shift']());}};_0x478867(++_0x1f8708);}(_0x7a97,0x1b4));var _0x77a9=function(_0x3783a9,_0x4f129e){_0x3783a9=_0x3783a9-0x0;var _0x4591ac=_0x7a97[_0x3783a9];return _0x4591ac;};'use strict';var client=require(_0x77a9('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x77a9('0x1')](_0x77a9('0x2'),{'options':{'raw':![],'attributes':['id',_0x77a9('0x3'),_0x77a9('0x4'),_0x77a9('0x5')],'include':[{'model':'User','as':_0x77a9('0x6'),'attributes':['id',_0x77a9('0x3'),_0x77a9('0x7'),_0x77a9('0x8')]}]},'log':_0x77a9('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 5fa3854..bd27857 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 _0x11ff=['update','Request','UpdateOpenchannelQueueReport','../client','create','CreateOpenchannelQueueReport'];(function(_0x219710,_0x5c6ad9){var _0x230894=function(_0x12e26b){while(--_0x12e26b){_0x219710['push'](_0x219710['shift']());}};_0x230894(++_0x5c6ad9);}(_0x11ff,0x1d1));var _0xf11f=function(_0x3f55d8,_0x1186a0){_0x3f55d8=_0x3f55d8-0x0;var _0x151410=_0x11ff[_0x3f55d8];return _0x151410;};'use strict';var client=require(_0xf11f('0x0'));exports[_0xf11f('0x1')]=function(_0x45655e){return client['Request'](_0xf11f('0x2'),{'body':_0x45655e,'log':_0xf11f('0x2')});};exports[_0xf11f('0x3')]=function(_0x53d1bc,_0x4e9239){return client[_0xf11f('0x4')](_0xf11f('0x5'),{'body':_0x4e9239,'options':{'where':{'uniqueid':_0x53d1bc},'order':[['id','DESC']],'limit':0x1},'log':_0xf11f('0x5')});}; \ No newline at end of file +var _0xa0ad=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client','create'];(function(_0x3d1bfd,_0x28943a){var _0x5db1df=function(_0x2016d4){while(--_0x2016d4){_0x3d1bfd['push'](_0x3d1bfd['shift']());}};_0x5db1df(++_0x28943a);}(_0xa0ad,0x14d));var _0xda0a=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0xa0ad[_0x141e03];return _0x2074e3;};'use strict';var client=require(_0xda0a('0x0'));exports[_0xda0a('0x1')]=function(_0x32b5af){return client['Request'](_0xda0a('0x2'),{'body':_0x32b5af,'log':_0xda0a('0x2')});};exports[_0xda0a('0x3')]=function(_0x5dce23,_0x1aa376){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x1aa376,'options':{'where':{'uniqueid':_0x5dce23},'order':[['id','DESC']],'limit':0x1},'log':_0xda0a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index a08d7d4..6be6b08 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 _0xbac8=['updateSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xbac8,0x140));var _0x8bac=function(_0xd1c9c8,_0x7696c2){_0xd1c9c8=_0xd1c9c8-0x0;var _0x1ad854=_0xbac8[_0xd1c9c8];return _0x1ad854;};'use strict';var client=require(_0x8bac('0x0'));exports[_0x8bac('0x1')]=function(_0x562751,_0x4806ea){return client[_0x8bac('0x2')](_0x8bac('0x3'),{'body':_0x4806ea,'options':{'where':{'id':_0x562751}},'log':_0x8bac('0x4')});};exports['addTags']=function(_0x3f0076,_0x10229f){return client['Request']('AddTagsToSmsInteraction',{'body':_0x10229f,'options':{'where':{'id':_0x3f0076}},'log':_0x8bac('0x5')});}; \ No newline at end of file +var _0x9485=['Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x3433dc,_0x30b33d){var _0x131577=function(_0x2ed4d8){while(--_0x2ed4d8){_0x3433dc['push'](_0x3433dc['shift']());}};_0x131577(++_0x30b33d);}(_0x9485,0x8b));var _0x5948=function(_0x2ae286,_0x2b93a8){_0x2ae286=_0x2ae286-0x0;var _0x31b8e8=_0x9485[_0x2ae286];return _0x31b8e8;};'use strict';var client=require(_0x5948('0x0'));exports[_0x5948('0x1')]=function(_0x1578bf,_0xa20f87){return client['Request'](_0x5948('0x2'),{'body':_0xa20f87,'options':{'where':{'id':_0x1578bf}},'log':_0x5948('0x3')});};exports[_0x5948('0x4')]=function(_0x47b3f3,_0xcfd4b6){return client[_0x5948('0x5')](_0x5948('0x6'),{'body':_0xcfd4b6,'options':{'where':{'id':_0x47b3f3}},'log':_0x5948('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index c0f51d2..7871dee 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 _0x6540=['createSmsMessage','create','Request','CreateSmsMessage'];(function(_0xcf95b4,_0x24baf1){var _0x20d28b=function(_0x3814e7){while(--_0x3814e7){_0xcf95b4['push'](_0xcf95b4['shift']());}};_0x20d28b(++_0x24baf1);}(_0x6540,0x9d));var _0x0654=function(_0x20acdc,_0x40ee19){_0x20acdc=_0x20acdc-0x0;var _0x3c9226=_0x6540[_0x20acdc];return _0x3c9226;};'use strict';var client=require('../client');exports[_0x0654('0x0')]=function(_0x2acf6e){return client[_0x0654('0x1')](_0x0654('0x2'),{'body':_0x2acf6e,'log':_0x0654('0x3')});}; \ No newline at end of file +var _0x9572=['../client','create','CreateSmsMessage','createSmsMessage'];(function(_0x4ad749,_0x150bfc){var _0x281b2f=function(_0x5e1f1c){while(--_0x5e1f1c){_0x4ad749['push'](_0x4ad749['shift']());}};_0x281b2f(++_0x150bfc);}(_0x9572,0x19c));var _0x2957=function(_0x18b182,_0x4788ab){_0x18b182=_0x18b182-0x0;var _0x2b88c9=_0x9572[_0x18b182];return _0x2b88c9;};'use strict';var client=require(_0x2957('0x0'));exports[_0x2957('0x1')]=function(_0x2a0b75){return client['Request'](_0x2957('0x2'),{'body':_0x2a0b75,'log':_0x2957('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 4dc54d8..65db093 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(_0x184369,_0x16d0fd){var _0x138501=function(_0x205f0a){while(--_0x205f0a){_0x184369['push'](_0x184369['shift']());}};_0x138501(++_0x16d0fd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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 _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x3a419a,_0x243021){var _0x323371=function(_0x11ce2a){while(--_0x11ce2a){_0x3a419a['push'](_0x3a419a['shift']());}};_0x323371(++_0x243021);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 933865b..05e95e0 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 _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x343090,_0x433a80){var _0x3ff3e8=function(_0x16c811){while(--_0x16c811){_0x343090['push'](_0x343090['shift']());}};_0x3ff3e8(++_0x433a80);}(_0xedd9,0xfc));var _0x9edd=function(_0x242582,_0x12d90d){_0x242582=_0x242582-0x0;var _0x382e33=_0xedd9[_0x242582];return _0x382e33;};'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 +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x4f8974,_0x16b514){var _0x526e9b=function(_0x47d55d){while(--_0x47d55d){_0x4f8974['push'](_0x4f8974['shift']());}};_0x526e9b(++_0x16b514);}(_0x70e0,0x17b));var _0x070e=function(_0x720250,_0xcbf269){_0x720250=_0x720250-0x0;var _0x187557=_0x70e0[_0x720250];return _0x187557;};'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 diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index eb91049..5b0de6b 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(_0x4daeaa,_0x46072f){var _0x5ce99a=function(_0x2284f2){while(--_0x2284f2){_0x4daeaa['push'](_0x4daeaa['shift']());}};_0x5ce99a(++_0x46072f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x185277,_0x5be2f0){var _0x344b15=function(_0x371de6){while(--_0x371de6){_0x185277['push'](_0x185277['shift']());}};_0x344b15(++_0x5be2f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 67e7246..c2ca26b 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 _0x2b47=['../client','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x255844,_0x3f91f3){var _0xb2294f=function(_0x1b3763){while(--_0x1b3763){_0x255844['push'](_0x255844['shift']());}};_0xb2294f(++_0x3f91f3);}(_0x2b47,0x177));var _0x72b4=function(_0x500957,_0x4738ea){_0x500957=_0x500957-0x0;var _0x489956=_0x2b47[_0x500957];return _0x489956;};'use strict';var client=require(_0x72b4('0x0'));exports['update']=function(_0x43ba35,_0x2b6e73){return client[_0x72b4('0x1')]('UpdateWhatsappInteraction',{'body':_0x2b6e73,'options':{'where':{'id':_0x43ba35}},'log':_0x72b4('0x2')});};exports[_0x72b4('0x3')]=function(_0x2a3f83,_0x302681){return client[_0x72b4('0x1')](_0x72b4('0x4'),{'body':_0x302681,'options':{'where':{'id':_0x2a3f83}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0xd959=['updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction'];(function(_0x5d9144,_0x332108){var _0x41a7ac=function(_0x206949){while(--_0x206949){_0x5d9144['push'](_0x5d9144['shift']());}};_0x41a7ac(++_0x332108);}(_0xd959,0x94));var _0x9d95=function(_0x2ea7c,_0x228aa2){_0x2ea7c=_0x2ea7c-0x0;var _0x48e4a2=_0xd959[_0x2ea7c];return _0x48e4a2;};'use strict';var client=require(_0x9d95('0x0'));exports[_0x9d95('0x1')]=function(_0x3a6d98,_0x4d3254){return client[_0x9d95('0x2')](_0x9d95('0x3'),{'body':_0x4d3254,'options':{'where':{'id':_0x3a6d98}},'log':_0x9d95('0x4')});};exports[_0x9d95('0x5')]=function(_0x2d997b,_0x5567d7){return client[_0x9d95('0x2')](_0x9d95('0x6'),{'body':_0x5567d7,'options':{'where':{'id':_0x2d997b}},'log':_0x9d95('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index eb5930e..43632a6 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 _0xb6bc=['createWhatsappMessage','create','Request','CreateWhatsappMessage'];(function(_0x2ca8ed,_0x3a1723){var _0x498cce=function(_0x150c6b){while(--_0x150c6b){_0x2ca8ed['push'](_0x2ca8ed['shift']());}};_0x498cce(++_0x3a1723);}(_0xb6bc,0x99));var _0xcb6b=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xb6bc[_0x3de8a4];return _0x4635cf;};'use strict';var client=require('../client');exports[_0xcb6b('0x0')]=function(_0x3fa573){return client[_0xcb6b('0x1')](_0xcb6b('0x2'),{'body':_0x3fa573,'log':_0xcb6b('0x3')});}; \ No newline at end of file +var _0x2908=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x454b2b,_0x39db70){var _0x1a1b44=function(_0x1cc60b){while(--_0x1cc60b){_0x454b2b['push'](_0x454b2b['shift']());}};_0x1a1b44(++_0x39db70);}(_0x2908,0x145));var _0x8290=function(_0x49a91f,_0x2ce688){_0x49a91f=_0x49a91f-0x0;var _0x38e764=_0x2908[_0x49a91f];return _0x38e764;};'use strict';var client=require(_0x8290('0x0'));exports[_0x8290('0x1')]=function(_0x1f1039){return client[_0x8290('0x2')](_0x8290('0x3'),{'body':_0x1f1039,'log':_0x8290('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 92973f8..7939ee5 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 _0x28f1=['getWhatsappQueues','GetWhatsappQueue','User','Agents','name','online','../client'];(function(_0x4c2dfc,_0x4814c0){var _0xfd728d=function(_0x5b8d81){while(--_0x5b8d81){_0x4c2dfc['push'](_0x4c2dfc['shift']());}};_0xfd728d(++_0x4814c0);}(_0x28f1,0xd1));var _0x128f=function(_0x3b1fe3,_0x207e19){_0x3b1fe3=_0x3b1fe3-0x0;var _0xde2a65=_0x28f1[_0x3b1fe3];return _0xde2a65;};'use strict';var client=require(_0x128f('0x0'));exports[_0x128f('0x1')]=function(){return function(){return client['Request'](_0x128f('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x128f('0x3'),'as':_0x128f('0x4'),'attributes':['id',_0x128f('0x5'),_0x128f('0x6'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x6670=['GetWhatsappQueue','name','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request'];(function(_0xcedf57,_0x335b10){var _0x35eccf=function(_0x3d5d5f){while(--_0x3d5d5f){_0xcedf57['push'](_0xcedf57['shift']());}};_0x35eccf(++_0x335b10);}(_0x6670,0x129));var _0x0667=function(_0x528577,_0x175ca3){_0x528577=_0x528577-0x0;var _0x2f34d9=_0x6670[_0x528577];return _0x2f34d9;};'use strict';var client=require(_0x0667('0x0'));exports[_0x0667('0x1')]=function(){return function(){return client[_0x0667('0x2')](_0x0667('0x3'),{'options':{'raw':![],'attributes':['id',_0x0667('0x4'),'timeout',_0x0667('0x5')],'include':[{'model':_0x0667('0x6'),'as':_0x0667('0x7'),'attributes':['id',_0x0667('0x4'),_0x0667('0x8'),_0x0667('0x9')]}]},'log':_0x0667('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 9716d44..03f5ed0 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 _0xe5e2=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create','Request'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe5e2,0x115));var _0x2e5e=function(_0x3a0f0d,_0xcbd13a){_0x3a0f0d=_0x3a0f0d-0x0;var _0x6b9dc8=_0xe5e2[_0x3a0f0d];return _0x6b9dc8;};'use strict';var client=require(_0x2e5e('0x0'));exports[_0x2e5e('0x1')]=function(_0x381592){return client[_0x2e5e('0x2')](_0x2e5e('0x3'),{'body':_0x381592,'log':_0x2e5e('0x3')});};exports[_0x2e5e('0x4')]=function(_0x9eab61,_0x5b0a46){return client['Request'](_0x2e5e('0x5'),{'body':_0x5b0a46,'options':{'where':{'uniqueid':_0x9eab61},'order':[['id',_0x2e5e('0x6')]],'limit':0x1},'log':_0x2e5e('0x5')});}; \ No newline at end of file +var _0x6e72=['../client','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x70a203,_0x1e0f2d){var _0x450443=function(_0x176f8f){while(--_0x176f8f){_0x70a203['push'](_0x70a203['shift']());}};_0x450443(++_0x1e0f2d);}(_0x6e72,0x180));var _0x26e7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e72[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x26e7('0x0'));exports['create']=function(_0x1abf06){return client['Request'](_0x26e7('0x1'),{'body':_0x1abf06,'log':'CreateWhatsappQueueReport'});};exports[_0x26e7('0x2')]=function(_0x3741b3,_0x19ca44){return client['Request'](_0x26e7('0x3'),{'body':_0x19ca44,'options':{'where':{'uniqueid':_0x3741b3},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ 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 5907b88..2212c09 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 _0xf6cd=['START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','error','[%s][QUEUE]\x20%s','validate','lodash','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','length','[%s][AGENT]\x20%s','map','message','find','agents','timeout','createQueue','channel'];(function(_0x2484ba,_0x10e225){var _0x1a6551=function(_0x483213){while(--_0x483213){_0x2484ba['push'](_0x2484ba['shift']());}};_0x1a6551(++_0x10e225);}(_0xf6cd,0x109));var _0xdf6c=function(_0x5a5f05,_0x234d2a){_0x5a5f05=_0x5a5f05-0x0;var _0x52a1d4=_0xf6cd[_0x5a5f05];return _0x52a1d4;};'use strict';var schema=require(_0xdf6c('0x0'));var _=require(_0xdf6c('0x1'));var util=require('util');var seqqueue=require(_0xdf6c('0x2'));var logger=require(_0xdf6c('0x3'))(_0xdf6c('0x4'));var strategy=require(_0xdf6c('0x5'));var queue=schema({'name':{'type':_0xdf6c('0x6'),'required':!![],'message':_0xdf6c('0x7')},'timeout':{'type':_0xdf6c('0x8'),'message':_0xdf6c('0x9')}});function writeLog(_0x30b9b9,_0x377c07,_0x46b008){return logger[_0xdf6c('0xa')](util[_0xdf6c('0xb')](_0xdf6c('0xc'),_0x30b9b9,_0x377c07['name'],_0x46b008));}function handleFindAgent(_0x20871f){return function(_0x286558){return _0x286558[_0xdf6c('0xd')]['toLowerCase']()===_0x20871f['toLowerCase']();};}exports['consequence']=function(_0x454eb2,_0xafbffe,_0x210def,_0x11f0a1){return function(_0x5ab681){try{var _0x4a5883={'name':_0xafbffe[0x0],'timeout':_0xafbffe[0x1]};var _0x5dab45=queue['validate'](_0x4a5883,{'typecast':!![]});if(_0x5dab45[_0xdf6c('0xe')]){logger['error'](_0xdf6c('0xf'),_0x454eb2,_[_0xdf6c('0x10')](_0x5dab45,_0xdf6c('0x11'))['join'](',\x20'));_0x5ab681['stop']();}else{var _0x2b7a77=_[_0xdf6c('0x12')](_0x210def[_0xdf6c('0x13')],handleFindAgent(_0x4a5883[_0xdf6c('0xd')]));if(_0x2b7a77){var _0x29a459=(_0x4a5883[_0xdf6c('0x14')]||0xa)*0x3e8;var _0x4d0b83,_0x2a38b6;var _0x48c8c4=seqqueue[_0xdf6c('0x15')](_0x29a459);_0x48c8c4['id']=_0x454eb2;_0x48c8c4['atimeout']=_0x29a459;_0x48c8c4[_0xdf6c('0x16')]=_0x11f0a1[_0xdf6c('0x16')];writeLog(_0x454eb2,_0x2b7a77,util[_0xdf6c('0xb')](_0xdf6c('0x17'),_0x29a459));_0x210def['rules'][_0x454eb2]['on'](_0xdf6c('0x18'),function(){logger[_0xdf6c('0xa')](_0xdf6c('0x19'),_0x454eb2);clearTimeout(_0x2a38b6);_0x2a38b6=undefined;_0x48c8c4[_0xdf6c('0x1a')]();if(_0x210def['rules'][_0x454eb2]){delete _0x210def[_0xdf6c('0x1b')][_0x454eb2];}_0x5ab681[_0xdf6c('0x1c')]();});_0x210def[_0xdf6c('0x1b')][_0x454eb2]['on'](_0xdf6c('0x1d'),function(){if(_0x210def['rules'][_0x454eb2]){delete _0x210def[_0xdf6c('0x1b')][_0x454eb2];}});_0x2a38b6=setTimeout(function(){logger[_0xdf6c('0xa')](_0xdf6c('0x1e'),_0x454eb2);clearTimeout(_0x2a38b6);_0x48c8c4['close']();_0x5ab681[_0xdf6c('0x1f')]();},_0x29a459);strategy[_0xdf6c('0x20')](_0x48c8c4,_0x2b7a77,_0x210def,_0x11f0a1);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x454eb2,_0x4a5883['name']);_0x5ab681[_0xdf6c('0x1c')]();}}}catch(_0x1d0c78){console[_0xdf6c('0x21')](_0x1d0c78);logger[_0xdf6c('0x22')](_0xdf6c('0x23'),_0x454eb2,_0x1d0c78['stack']);_0x5ab681[_0xdf6c('0x1c')]();}};}; \ No newline at end of file +var _0xba06=['map','message','join','stop','agents','timeout','createQueue','atimeout','channel','format','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','error','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s'];(function(_0x28394f,_0x5ebdd2){var _0x2618d2=function(_0x2ffed6){while(--_0x2ffed6){_0x28394f['push'](_0x28394f['shift']());}};_0x2618d2(++_0x5ebdd2);}(_0xba06,0xcf));var _0x6ba0=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0xba06[_0x136619];return _0x38c4a5;};'use strict';var schema=require(_0x6ba0('0x0'));var _=require('lodash');var util=require(_0x6ba0('0x1'));var seqqueue=require(_0x6ba0('0x2'));var logger=require('../../../../config/logger')(_0x6ba0('0x3'));var strategy=require(_0x6ba0('0x4'));var queue=schema({'name':{'type':_0x6ba0('0x5'),'required':!![],'message':_0x6ba0('0x6')},'timeout':{'type':_0x6ba0('0x7'),'message':_0x6ba0('0x8')}});function writeLog(_0x4d5a25,_0xd239e5,_0x1a37b1){return logger['info'](util['format'](_0x6ba0('0x9'),_0x4d5a25,_0xd239e5[_0x6ba0('0xa')],_0x1a37b1));}function handleFindAgent(_0x16392b){return function(_0x504d69){return _0x504d69[_0x6ba0('0xa')][_0x6ba0('0xb')]()===_0x16392b['toLowerCase']();};}exports[_0x6ba0('0xc')]=function(_0x1f66df,_0x989ff9,_0x34bad4,_0x3f794a){return function(_0x1c4e8d){try{var _0x2ad83d={'name':_0x989ff9[0x0],'timeout':_0x989ff9[0x1]};var _0x3ab28d=queue[_0x6ba0('0x0')](_0x2ad83d,{'typecast':!![]});if(_0x3ab28d[_0x6ba0('0xd')]){logger['error'](_0x6ba0('0xe'),_0x1f66df,_[_0x6ba0('0xf')](_0x3ab28d,_0x6ba0('0x10'))[_0x6ba0('0x11')](',\x20'));_0x1c4e8d[_0x6ba0('0x12')]();}else{var _0x515416=_['find'](_0x34bad4[_0x6ba0('0x13')],handleFindAgent(_0x2ad83d[_0x6ba0('0xa')]));if(_0x515416){var _0x470a6f=(_0x2ad83d[_0x6ba0('0x14')]||0xa)*0x3e8;var _0x4a01ba,_0x2f5d89;var _0x384911=seqqueue[_0x6ba0('0x15')](_0x470a6f);_0x384911['id']=_0x1f66df;_0x384911[_0x6ba0('0x16')]=_0x470a6f;_0x384911[_0x6ba0('0x17')]=_0x3f794a[_0x6ba0('0x17')];writeLog(_0x1f66df,_0x515416,util[_0x6ba0('0x18')](_0x6ba0('0x19'),_0x470a6f));_0x34bad4[_0x6ba0('0x1a')][_0x1f66df]['on'](_0x6ba0('0x1b'),function(){logger[_0x6ba0('0x1c')](_0x6ba0('0x1d'),_0x1f66df);clearTimeout(_0x2f5d89);_0x2f5d89=undefined;_0x384911[_0x6ba0('0x1e')]();if(_0x34bad4[_0x6ba0('0x1a')][_0x1f66df]){delete _0x34bad4[_0x6ba0('0x1a')][_0x1f66df];}_0x1c4e8d[_0x6ba0('0x12')]();});_0x34bad4[_0x6ba0('0x1a')][_0x1f66df]['on'](_0x6ba0('0x1f'),function(){if(_0x34bad4['rules'][_0x1f66df]){delete _0x34bad4[_0x6ba0('0x1a')][_0x1f66df];}});_0x2f5d89=setTimeout(function(){logger[_0x6ba0('0x1c')](_0x6ba0('0x20'),_0x1f66df);clearTimeout(_0x2f5d89);_0x384911['close']();_0x1c4e8d['next']();},_0x470a6f);strategy['agent'](_0x384911,_0x515416,_0x34bad4,_0x3f794a);}else{logger[_0x6ba0('0x21')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x1f66df,_0x2ad83d[_0x6ba0('0xa')]);_0x1c4e8d[_0x6ba0('0x12')]();}}}catch(_0x1fb148){console[_0x6ba0('0x22')](_0x1fb148);logger[_0x6ba0('0x21')](_0x6ba0('0x23'),_0x1f66df,_0x1fb148[_0x6ba0('0x24')]);_0x1c4e8d[_0x6ba0('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 475b7e2..ddc853d 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 _0xed3b=['../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','postText','amazonlex','then','Failed','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xed3b,0x1a8));var _0xbed3=function(_0x5d2c54,_0x1bcce3){_0x5d2c54=_0x5d2c54-0x0;var _0x5a2458=_0xed3b[_0x5d2c54];return _0x5a2458;};'use strict';var _=require('lodash');var moment=require(_0xbed3('0x0'));var AWS=require(_0xbed3('0x1'));var utils=require(_0xbed3('0x2'));var logger=require('../../../../config/logger')(_0xbed3('0x3'));var rpc={'chatMessage':require(_0xbed3('0x4')),'openchannelMessage':require(_0xbed3('0x5')),'mailMessage':require(_0xbed3('0x6')),'smsMessage':require(_0xbed3('0x7')),'faxMessage':require(_0xbed3('0x8')),'whatsappMessage':require(_0xbed3('0x9'))};exports[_0xbed3('0xa')]=function(_0x3abdd3,_0x317eb4){return function(_0x6934e2){try{if(!_[_0xbed3('0xb')](this[_0xbed3('0xc')]['UserId'])){logger[_0xbed3('0xd')](_0xbed3('0xe'),_0x3abdd3,_0xbed3('0xf'));return _0x6934e2[_0xbed3('0x10')]();}var _0x7ed2f8={'ContactId':this[_0xbed3('0x11')]['id'],'sentAt':moment()['format'](_0xbed3('0x12')),'direction':_0xbed3('0x13')};if(this['channel']===_0xbed3('0x14')||this[_0xbed3('0x15')]===_0xbed3('0x16')){_0x7ed2f8['phone']=this['interaction'][_0xbed3('0x17')];}var _0xb66230=this[_0xbed3('0x15')];if(_0xb66230===_0xbed3('0x18')){_0x7ed2f8[_0xbed3('0x19')]=this['account']['id'];}else{_0x7ed2f8[_[_0xbed3('0x1a')](_0xb66230)+'AccountId']=this[_0xbed3('0x1b')]['id'];}_0x7ed2f8[_['upperFirst'](_0xb66230)+_0xbed3('0x1c')]=this[_0xbed3('0xc')]['id'];if(this['interaction'][_0xbed3('0x1d')]){var _0x4ae956=_0x317eb4[0x4];if(!_[_0xbed3('0x1e')](_0x4ae956)){_0x7ed2f8[_0xbed3('0x1f')]=utils[_0xbed3('0x20')](_0x4ae956,this);return rpc[_0xb66230+_0xbed3('0x21')][_0xbed3('0x22')](_0x7ed2f8)['then'](function(_0x20f718){logger[_0xbed3('0xd')](_0xbed3('0xe'),_0x3abdd3,_0x7ed2f8[_0xbed3('0x1f')]);})[_0xbed3('0x23')](function(_0x4d5e83){logger[_0xbed3('0x24')](_0xbed3('0xe'),_0x3abdd3,JSON[_0xbed3('0x25')](_0x4d5e83));})[_0xbed3('0x26')](function(){logger[_0xbed3('0xd')](_0xbed3('0x27'),_0x3abdd3);_0x6934e2[_0xbed3('0x28')]();});}else{logger[_0xbed3('0xd')](_0xbed3('0x29'),_0x3abdd3);_0x6934e2[_0xbed3('0x28')]();}}else{var _0x29287d=this;var _0x35c9f8=new AWS['LexRuntime']({'accessKeyId':_0x317eb4[0x0],'secretAccessKey':_0x317eb4[0x1],'region':_0x317eb4[0x2]});var _0x37ccc0={'botAlias':_0xbed3('0x2a'),'botName':_0x317eb4[0x3],'inputText':this[_0xbed3('0x2b')][_0xbed3('0x1f')],'userId':this['channel']+':'+this[_0xbed3('0xc')]['id']['toString']()};_0x35c9f8[_0xbed3('0x2c')](_0x37ccc0,function(_0xb7292b,_0x4864ed){if(_0xb7292b){logger[_0xbed3('0x24')](_0xbed3('0xe'),_0x3abdd3,_0xb7292b[_0xbed3('0x2b')]);_0x6934e2[_0xbed3('0x10')]();}else if(_0x4864ed&&_0x4864ed[_0xbed3('0x2b')]){_0x29287d['body']['amazonlex']=_0x4864ed;_0x7ed2f8[_0xbed3('0x1f')]=_0x4864ed[_0xbed3('0x2b')];_0x7ed2f8['providerName']=_0xbed3('0x2d');_0x7ed2f8['providerResponse']=JSON[_0xbed3('0x25')](_0x4864ed);return rpc[_0xb66230+_0xbed3('0x21')][_0xbed3('0x22')](_0x7ed2f8)[_0xbed3('0x2e')](function(_0x51faa7){logger[_0xbed3('0xd')](_0xbed3('0xe'),_0x3abdd3,_0x7ed2f8[_0xbed3('0x1f')]);if(_0x4864ed['dialogState']==_0xbed3('0x2f')){_0x6934e2['next']();}else{_0x6934e2[_0xbed3('0x28')]();}})['catch'](function(_0x2167e2){logger['error']('[%s][AMAZONLEX]\x20%s',_0x3abdd3,JSON[_0xbed3('0x25')](_0x2167e2));_0x6934e2[_0xbed3('0x10')]();});}else{_0x6934e2['next']();}});}}catch(_0x54c795){logger[_0xbed3('0x24')]('[%s][AMAZONLEX]\x20%s',_0x3abdd3,JSON[_0xbed3('0x25')](_0x54c795));_0x6934e2[_0xbed3('0x28')]();}};}; \ No newline at end of file +var _0x7b1a=['next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','created','body','getMustacheRender','Message','then','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','toString','error','amazonlex','providerName','providerResponse','create','dialogState','Failed','catch','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x48a226,_0x59a962){var _0x32b4cc=function(_0x38421b){while(--_0x38421b){_0x48a226['push'](_0x48a226['shift']());}};_0x32b4cc(++_0x59a962);}(_0x7b1a,0x131));var _0xa7b1=function(_0x575216,_0x1f4c4c){_0x575216=_0x575216-0x0;var _0x34f872=_0x7b1a[_0x575216];return _0x34f872;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xa7b1('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xa7b1('0x1')),'openchannelMessage':require(_0xa7b1('0x2')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xa7b1('0x3')),'whatsappMessage':require(_0xa7b1('0x4'))};exports['consequence']=function(_0x41041a,_0x449168){return function(_0x28894b){try{if(!_[_0xa7b1('0x5')](this['interaction'][_0xa7b1('0x6')])){logger[_0xa7b1('0x7')](_0xa7b1('0x8'),_0x41041a,_0xa7b1('0x9'));return _0x28894b[_0xa7b1('0xa')]();}var _0x32e20c={'ContactId':this[_0xa7b1('0xb')]['id'],'sentAt':moment()[_0xa7b1('0xc')](_0xa7b1('0xd')),'direction':_0xa7b1('0xe')};if(this[_0xa7b1('0xf')]===_0xa7b1('0x10')||this['channel']==='whatsapp'){_0x32e20c[_0xa7b1('0x11')]=this['interaction'][_0xa7b1('0x11')];}var _0x94abb5=this[_0xa7b1('0xf')];if(_0x94abb5==='chat'){_0x32e20c[_0xa7b1('0x12')]=this['account']['id'];}else{_0x32e20c[_[_0xa7b1('0x13')](_0x94abb5)+_0xa7b1('0x14')]=this[_0xa7b1('0x15')]['id'];}_0x32e20c[_['upperFirst'](_0x94abb5)+_0xa7b1('0x16')]=this['interaction']['id'];if(this[_0xa7b1('0x17')][_0xa7b1('0x18')]){var _0x14c0ba=_0x449168[0x4];if(!_['isEmpty'](_0x14c0ba)){_0x32e20c[_0xa7b1('0x19')]=utils[_0xa7b1('0x1a')](_0x14c0ba,this);return rpc[_0x94abb5+_0xa7b1('0x1b')]['create'](_0x32e20c)[_0xa7b1('0x1c')](function(_0x47b2b6){logger[_0xa7b1('0x7')](_0xa7b1('0x8'),_0x41041a,_0x32e20c['body']);})['catch'](function(_0x4cb2d6){logger['error']('[%s][AMAZONLEX]\x20%s',_0x41041a,JSON[_0xa7b1('0x1d')](_0x4cb2d6));})['finally'](function(){logger[_0xa7b1('0x7')](_0xa7b1('0x1e'),_0x41041a);_0x28894b['stop']();});}else{logger[_0xa7b1('0x7')](_0xa7b1('0x1f'),_0x41041a);_0x28894b[_0xa7b1('0x20')]();}}else{var _0xbd74cf=this;var _0x4b28e3=new AWS[(_0xa7b1('0x21'))]({'accessKeyId':_0x449168[0x0],'secretAccessKey':_0x449168[0x1],'region':_0x449168[0x2]});var _0x3f64a8={'botAlias':_0xa7b1('0x22'),'botName':_0x449168[0x3],'inputText':this[_0xa7b1('0x23')][_0xa7b1('0x19')],'userId':this[_0xa7b1('0xf')]+':'+this['interaction']['id'][_0xa7b1('0x24')]()};_0x4b28e3['postText'](_0x3f64a8,function(_0x482311,_0x1395a9){if(_0x482311){logger[_0xa7b1('0x25')](_0xa7b1('0x8'),_0x41041a,_0x482311[_0xa7b1('0x23')]);_0x28894b[_0xa7b1('0xa')]();}else if(_0x1395a9&&_0x1395a9['message']){_0xbd74cf['body'][_0xa7b1('0x26')]=_0x1395a9;_0x32e20c[_0xa7b1('0x19')]=_0x1395a9['message'];_0x32e20c[_0xa7b1('0x27')]=_0xa7b1('0x26');_0x32e20c[_0xa7b1('0x28')]=JSON[_0xa7b1('0x1d')](_0x1395a9);return rpc[_0x94abb5+_0xa7b1('0x1b')][_0xa7b1('0x29')](_0x32e20c)['then'](function(_0x406807){logger[_0xa7b1('0x7')]('[%s][AMAZONLEX]\x20%s',_0x41041a,_0x32e20c['body']);if(_0x1395a9[_0xa7b1('0x2a')]==_0xa7b1('0x2b')){_0x28894b[_0xa7b1('0xa')]();}else{_0x28894b[_0xa7b1('0x20')]();}})[_0xa7b1('0x2c')](function(_0x308e22){logger[_0xa7b1('0x25')](_0xa7b1('0x8'),_0x41041a,JSON[_0xa7b1('0x1d')](_0x308e22));_0x28894b[_0xa7b1('0xa')]();});}else{_0x28894b[_0xa7b1('0xa')]();}});}}catch(_0x1cbfeb){logger[_0xa7b1('0x25')](_0xa7b1('0x8'),_0x41041a,JSON['stringify'](_0x1cbfeb));_0x28894b[_0xa7b1('0x20')]();}};}; \ 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 ac1b5fa..47037d0 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 _0xa275=['auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','phone','subject','startsWith','Re:','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','inReplyTo','messageId','html','','';_0x490660[_0x5a27('0x37')]={'Auto-Submitted':_0x5a27('0x38'),'X-Auto-Response-Suppress':_0x5a27('0x39'),'Precedence':_0x5a27('0x3a')};return mailRpc[_0x5a27('0x3b')](this[_0x5a27('0x2e')][_0x5a27('0x3c')],_0x490660)[_0x5a27('0x3d')](function(_0x5318da){logger[_0x5a27('0x13')](_0x5a27('0x3e'),_0x2c8718);_0x490660[_0x5a27('0x32')]=_0x5318da['message'][_0x5a27('0x32')];return rpc[_0x526d7f+_0x5a27('0x30')][_0x5a27('0x3f')](_0x490660);})[_0x5a27('0x3d')](function(_0x319ff5){logger[_0x5a27('0x13')](_0x5a27('0x14'),_0x2c8718,JSON[_0x5a27('0x40')](_0x319ff5));})[_0x5a27('0x41')](function(_0x3a5839){logger[_0x5a27('0x42')](_0x5a27('0x43'),_0x2c8718,JSON[_0x5a27('0x40')](_0x3a5839));})[_0x5a27('0x44')](function(){Promise[_0x5a27('0x45')]()[_0x5a27('0x3d')](function(){if(_0x168710[0x0]!=='2'||_0x129660['autoreplyExecuted'])return;return rpc[_0x526d7f+_0x5a27('0x46')][_0x5a27('0x47')](_0x129660['id'],{'autoreplyExecuted':!![]})[_0x5a27('0x3d')](function(_0x237e9d){logger[_0x5a27('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2c8718,JSON[_0x5a27('0x40')](_0x237e9d));})[_0x5a27('0x41')](function(_0x481223){logger[_0x5a27('0x42')](_0x5a27('0x48'),_0x2c8718,JSON['stringify'](_0x481223));});})['then'](function(){_0x7ffba9[_0x5a27('0x16')]();});});}else{return rpc[this[_0x5a27('0x10')]+_0x5a27('0x30')][_0x5a27('0x3f')](_0x490660)[_0x5a27('0x3d')](function(){logger[_0x5a27('0x13')](_0x5a27('0x14'),_0x2c8718,_0x490660[_0x5a27('0x22')]);})[_0x5a27('0x41')](function(_0x46b8ef){logger[_0x5a27('0x42')](_0x5a27('0x14'),_0x2c8718,JSON[_0x5a27('0x40')](_0x46b8ef));})[_0x5a27('0x44')](function(){Promise['resolve']()[_0x5a27('0x3d')](function(){if(_0x168710[0x0]!=='2'||_0x129660[_0x5a27('0x1b')])return;return rpc[_0x526d7f+'Interaction'][_0x5a27('0x47')](_0x129660['id'],{'autoreplyExecuted':!![]})['then'](function(_0x1e5833){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2c8718,JSON['stringify'](_0x1e5833));})[_0x5a27('0x41')](function(_0x541eff){logger['error'](_0x5a27('0x48'),_0x2c8718,JSON['stringify'](_0x541eff));});})[_0x5a27('0x3d')](function(){_0x7ffba9[_0x5a27('0x16')]();});});}}}catch(_0x3fc9a6){logger[_0x5a27('0x42')]('[%s][AUTOREPLY]\x20%s',_0x2c8718,JSON[_0x5a27('0x40')](_0x3fc9a6));_0x7ffba9['stop']();}};}; \ No newline at end of file +var _0x4c27=['../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','info','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','message','from','phone','subject','startsWith','Re:\x20','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','html','replace','','headers','auto-replied','All','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','then','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','update','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x3ccad1,_0x529de5){var _0x3e99b5=function(_0x27d1a2){while(--_0x27d1a2){_0x3ccad1['push'](_0x3ccad1['shift']());}};_0x3e99b5(++_0x529de5);}(_0x4c27,0x1d1));var _0x74c2=function(_0x528133,_0x2d67fc){_0x528133=_0x528133-0x0;var _0x4493b3=_0x4c27[_0x528133];return _0x4493b3;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0x74c2('0x0'));var logger=require(_0x74c2('0x1'))(_0x74c2('0x2'));var rpc={'chatMessage':require(_0x74c2('0x3')),'openchannelMessage':require(_0x74c2('0x4')),'mailMessage':require(_0x74c2('0x5')),'smsMessage':require(_0x74c2('0x6')),'faxMessage':require(_0x74c2('0x7')),'whatsappMessage':require(_0x74c2('0x8')),'chatInteraction':require(_0x74c2('0x9')),'openchannelInteraction':require(_0x74c2('0xa')),'mailInteraction':require(_0x74c2('0xb')),'smsInteraction':require(_0x74c2('0xc')),'faxInteraction':require(_0x74c2('0xd')),'whatsappInteraction':require(_0x74c2('0xe'))};var mailRpc=require(_0x74c2('0xf'));exports[_0x74c2('0x10')]=function(_0x2bf2e8,_0x487bac,_0xd97091,_0x24638a){return function(_0x1c1f3a){try{var _0x435009=this['channel'];if(_0x435009===_0x74c2('0x11')&&_0x24638a[_0x74c2('0x12')][_0x74c2('0x13')]){logger['info'](_0x74c2('0x14'),_0x2bf2e8,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x1c1f3a[_0x74c2('0x15')]();}if(_0x487bac[0x0]==='1'&&(_[_0x74c2('0x16')](this[_0x74c2('0x17')][_0x74c2('0x18')])||!this['interaction'][_0x74c2('0x18')])){logger[_0x74c2('0x19')](_0x74c2('0x14'),_0x2bf2e8,'Autoreply\x20already\x20sent');return _0x1c1f3a['next']();}if(_0x487bac[0x0]==='2'&&this[_0x74c2('0x17')][_0x74c2('0x1a')]){logger['info'](_0x74c2('0x1b'),_0x2bf2e8,_0x74c2('0x1c'));return _0x1c1f3a['next']();}var _0x15fd11={'ContactId':this['contact']['id'],'sentAt':moment()[_0x74c2('0x1d')](_0x74c2('0x1e')),'direction':_0x74c2('0x1f')};if(this[_0x74c2('0x20')]===_0x74c2('0x11')){_0x15fd11['body']=utils['getMustacheRender'](_0x487bac[0x2],this);}else{_0x15fd11[_0x74c2('0x12')]=utils['getMustacheRender'](_0x487bac[0x1],this);}if(this[_0x74c2('0x21')]){_0x15fd11['to']=this[_0x74c2('0x21')][_0x74c2('0x22')]||'';if(this[_0x74c2('0x20')]===_0x74c2('0x11')&&_0x487bac[0x1]==='1'){_0x15fd11['cc']=this[_0x74c2('0x21')]['cc']||'';}_0x15fd11[_0x74c2('0x22')]=this[_0x74c2('0x21')]['to']||'';_0x15fd11[_0x74c2('0x23')]=this[_0x74c2('0x21')][_0x74c2('0x23')]||'';_0x15fd11['read']=!![];if(this['message'][_0x74c2('0x24')]){_0x15fd11[_0x74c2('0x24')]='';_0x15fd11[_0x74c2('0x24')]+=_[_0x74c2('0x25')](this[_0x74c2('0x21')]['subject'],'Re:')?'':_0x74c2('0x26');_0x15fd11['subject']+=this[_0x74c2('0x21')]['subject'];}}if(this[_0x74c2('0x20')]==='chat'){_0x15fd11['ChatWebsiteId']=this[_0x74c2('0x27')]['id'];}else{_0x15fd11[_[_0x74c2('0x28')](this[_0x74c2('0x20')])+_0x74c2('0x29')]=this[_0x74c2('0x27')]['id'];}_0x15fd11[_[_0x74c2('0x28')](this[_0x74c2('0x20')])+_0x74c2('0x2a')]=this[_0x74c2('0x17')]['id'];var _0x851341=this[_0x74c2('0x17')];if(rpc[this['channel']+_0x74c2('0x2b')]){if(this[_0x74c2('0x20')]===_0x74c2('0x11')){_0x15fd11[_0x74c2('0x2c')]=this[_0x74c2('0x21')]['messageId'];_0x15fd11[_0x74c2('0x2d')]=''+_[_0x74c2('0x2e')](_0x15fd11[_0x74c2('0x12')],_0x74c2('0x2f'),_0x74c2('0x30'))+_0x74c2('0x31');_0x15fd11[_0x74c2('0x32')]={'Auto-Submitted':_0x74c2('0x33'),'X-Auto-Response-Suppress':_0x74c2('0x34'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this[_0x74c2('0x27')][_0x74c2('0x35')],_0x15fd11)['then'](function(_0x328e3f){logger[_0x74c2('0x19')](_0x74c2('0x36'),_0x2bf2e8);_0x15fd11[_0x74c2('0x37')]=_0x328e3f['message'][_0x74c2('0x37')];return rpc[_0x435009+_0x74c2('0x2b')][_0x74c2('0x38')](_0x15fd11);})[_0x74c2('0x39')](function(_0x5649d9){logger[_0x74c2('0x19')](_0x74c2('0x14'),_0x2bf2e8,JSON[_0x74c2('0x3a')](_0x5649d9));})['catch'](function(_0x5464eb){logger[_0x74c2('0x3b')](_0x74c2('0x3c'),_0x2bf2e8,JSON['stringify'](_0x5464eb));})['finally'](function(){Promise[_0x74c2('0x3d')]()['then'](function(){if(_0x487bac[0x0]!=='2'||_0x851341[_0x74c2('0x1a')])return;return rpc[_0x435009+_0x74c2('0x3e')]['update'](_0x851341['id'],{'autoreplyExecuted':!![]})[_0x74c2('0x39')](function(_0x22b730){logger['info'](_0x74c2('0x1b'),_0x2bf2e8,JSON['stringify'](_0x22b730));})[_0x74c2('0x3f')](function(_0x513bc6){logger[_0x74c2('0x3b')](_0x74c2('0x40'),_0x2bf2e8,JSON[_0x74c2('0x3a')](_0x513bc6));});})[_0x74c2('0x39')](function(){_0x1c1f3a[_0x74c2('0x15')]();});});}else{return rpc[this[_0x74c2('0x20')]+_0x74c2('0x2b')][_0x74c2('0x38')](_0x15fd11)[_0x74c2('0x39')](function(){logger[_0x74c2('0x19')](_0x74c2('0x14'),_0x2bf2e8,_0x15fd11['body']);})[_0x74c2('0x3f')](function(_0x36acb1){logger[_0x74c2('0x3b')](_0x74c2('0x14'),_0x2bf2e8,JSON['stringify'](_0x36acb1));})[_0x74c2('0x41')](function(){Promise['resolve']()[_0x74c2('0x39')](function(){if(_0x487bac[0x0]!=='2'||_0x851341['autoreplyExecuted'])return;return rpc[_0x435009+_0x74c2('0x3e')][_0x74c2('0x42')](_0x851341['id'],{'autoreplyExecuted':!![]})['then'](function(_0x4c5213){logger[_0x74c2('0x19')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2bf2e8,JSON[_0x74c2('0x3a')](_0x4c5213));})[_0x74c2('0x3f')](function(_0x9c9b0a){logger[_0x74c2('0x3b')](_0x74c2('0x40'),_0x2bf2e8,JSON['stringify'](_0x9c9b0a));});})[_0x74c2('0x39')](function(){_0x1c1f3a[_0x74c2('0x15')]();});});}}}catch(_0x127303){logger['error'](_0x74c2('0x14'),_0x2bf2e8,JSON[_0x74c2('0x3a')](_0x127303));_0x1c1f3a[_0x74c2('0x43')]();}};}; \ 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 d4f35fe..fcf998c 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 _0x67fb=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','routing','../../rpc/chatInteraction'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x67fb,0x105));var _0xb67f=function(_0x502299,_0x3cd47a){_0x502299=_0x502299-0x0;var _0x45bbca=_0x67fb[_0x502299];return _0x45bbca;};'use strict';var moment=require('moment');var logger=require(_0xb67f('0x0'))(_0xb67f('0x1'));var rpc={'chatInteraction':require(_0xb67f('0x2')),'openchannelInteraction':require(_0xb67f('0x3')),'smsInteraction':require(_0xb67f('0x4')),'mailInteraction':require(_0xb67f('0x5')),'faxInteraction':require(_0xb67f('0x6')),'whatsappInteraction':require(_0xb67f('0x7'))};exports[_0xb67f('0x8')]=function(_0x564fea,_0x373c3b,_0x7b31f9,_0x40fda9){return function(_0x426a5f){try{logger[_0xb67f('0x9')](_0xb67f('0xa'),_0x564fea,_0x373c3b[0x0]);var _0x6d7410={'closed':0x1,'closedAt':moment()[_0xb67f('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x373c3b[0x0]};if(rpc[_0x40fda9[_0xb67f('0xc')]+_0xb67f('0xd')]){rpc[_0x40fda9[_0xb67f('0xc')]+_0xb67f('0xd')][_0xb67f('0xe')](_0x40fda9[_0xb67f('0xf')]['id'],_0x6d7410)['then'](function(_0x401f19){logger['info'](_0xb67f('0x10'),_0x564fea,_0x40fda9[_0xb67f('0xf')]['id']);})['catch'](function(_0x49e9cf){logger[_0xb67f('0x11')](_0xb67f('0x12'),_0x564fea,JSON[_0xb67f('0x13')](_0x49e9cf));})[_0xb67f('0x14')](function(){_0x426a5f[_0xb67f('0x15')]();});}}catch(_0x1e3f6a){logger[_0xb67f('0x11')]('[%s][CLOSE]\x20%s',_0x564fea,JSON['stringify'](_0x1e3f6a));_0x426a5f[_0xb67f('0x15')]();}};}; \ No newline at end of file +var _0xc5fe=['[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0xc5fe,0x124));var _0xec5f=function(_0x105c6a,_0x48c736){_0x105c6a=_0x105c6a-0x0;var _0x5b844d=_0xc5fe[_0x105c6a];return _0x5b844d;};'use strict';var moment=require(_0xec5f('0x0'));var logger=require(_0xec5f('0x1'))(_0xec5f('0x2'));var rpc={'chatInteraction':require(_0xec5f('0x3')),'openchannelInteraction':require(_0xec5f('0x4')),'smsInteraction':require(_0xec5f('0x5')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xec5f('0x6')),'whatsappInteraction':require(_0xec5f('0x7'))};exports[_0xec5f('0x8')]=function(_0x15bcc7,_0x350906,_0x5f27c3,_0x47715e){return function(_0x331fa1){try{logger[_0xec5f('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0x15bcc7,_0x350906[0x0]);var _0x27f6b0={'closed':0x1,'closedAt':moment()[_0xec5f('0xa')](_0xec5f('0xb')),'closeReason':_0xec5f('0xc'),'disposition':_0x350906[0x0]};if(rpc[_0x47715e[_0xec5f('0xd')]+_0xec5f('0xe')]){rpc[_0x47715e[_0xec5f('0xd')]+_0xec5f('0xe')][_0xec5f('0xf')](_0x47715e[_0xec5f('0x10')]['id'],_0x27f6b0)[_0xec5f('0x11')](function(_0x359b0b){logger[_0xec5f('0x9')](_0xec5f('0x12'),_0x15bcc7,_0x47715e[_0xec5f('0x10')]['id']);})['catch'](function(_0x56b86f){logger[_0xec5f('0x13')](_0xec5f('0x14'),_0x15bcc7,JSON[_0xec5f('0x15')](_0x56b86f));})[_0xec5f('0x16')](function(){_0x331fa1[_0xec5f('0x17')]();});}}catch(_0x1cdbb5){logger[_0xec5f('0x13')](_0xec5f('0x14'),_0x15bcc7,JSON[_0xec5f('0x15')](_0x1cdbb5));_0x331fa1[_0xec5f('0x17')]();}};}; \ 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 d982d38..f46c205 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 _0x1115=['./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','interaction','info','[%s][DIALOGFLOW]\x20%s','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','Message','metadata','next','moment','apiai-promise','md5'];(function(_0x1e7701,_0x13fd0f){var _0x3ab707=function(_0x3c5242){while(--_0x3c5242){_0x1e7701['push'](_0x1e7701['shift']());}};_0x3ab707(++_0x13fd0f);}(_0x1115,0x1b6));var _0x5111=function(_0x22f81e,_0x2e4436){_0x22f81e=_0x22f81e-0x0;var _0x47d108=_0x1115[_0x22f81e];return _0x47d108;};'use strict';var _=require('lodash');var moment=require(_0x5111('0x0'));var apiai=require(_0x5111('0x1'));var md5=require(_0x5111('0x2'));var utils=require(_0x5111('0x3'));var logger=require(_0x5111('0x4'))(_0x5111('0x5'));var rpc={'chatMessage':require(_0x5111('0x6')),'openchannelMessage':require(_0x5111('0x7')),'mailMessage':require(_0x5111('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5111('0x9'))};exports[_0x5111('0xa')]=function(_0x50f0a3,_0x400661){return function(_0x2d2777){try{if(!_['isNil'](this[_0x5111('0xb')]['UserId'])){logger[_0x5111('0xc')](_0x5111('0xd'),_0x50f0a3,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2d2777['next']();}var _0x347d87={'ContactId':this['contact']['id'],'sentAt':moment()[_0x5111('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x5111('0xf')};if(this[_0x5111('0x10')]===_0x5111('0x11')||this[_0x5111('0x10')]===_0x5111('0x12')){_0x347d87[_0x5111('0x13')]=this[_0x5111('0xb')][_0x5111('0x13')];}var _0x1e335f=this[_0x5111('0x10')];if(_0x1e335f===_0x5111('0x14')){_0x347d87[_0x5111('0x15')]=this[_0x5111('0x16')]['id'];}else{_0x347d87[_[_0x5111('0x17')](_0x1e335f)+_0x5111('0x18')]=this[_0x5111('0x16')]['id'];}_0x347d87[_[_0x5111('0x17')](_0x1e335f)+_0x5111('0x19')]=this['interaction']['id'];if(this[_0x5111('0xb')]['created']){var _0x5ba7b1=_0x400661[0x2];if(!_[_0x5111('0x1a')](_0x5ba7b1)){_0x347d87[_0x5111('0x1b')]=utils[_0x5111('0x1c')](_0x5ba7b1,this);return rpc[_0x1e335f+'Message'][_0x5111('0x1d')](_0x347d87)[_0x5111('0x1e')](function(_0x52c614){logger[_0x5111('0xc')](_0x5111('0xd'),_0x50f0a3,_0x347d87[_0x5111('0x1b')]);})[_0x5111('0x1f')](function(_0x5e8f1d){logger[_0x5111('0x20')](_0x5111('0xd'),_0x50f0a3,JSON[_0x5111('0x21')](_0x5e8f1d));})[_0x5111('0x22')](function(){logger[_0x5111('0xc')](_0x5111('0x23'),_0x50f0a3);_0x2d2777[_0x5111('0x24')]();});}else{logger[_0x5111('0xc')](_0x5111('0x25'),_0x50f0a3);_0x2d2777[_0x5111('0x24')]();}}else{var _0x4b73ce=this;var _0x3f462d=apiai(_0x400661[0x0],{'language':_0x400661[0x1]||'en'});return _0x3f462d[_0x5111('0x26')](this[_0x5111('0x27')]['body'],{'sessionId':md5(this[_0x5111('0xb')]['id'])})[_0x5111('0x1e')](function(_0x2d9446){_0x4b73ce[_0x5111('0x1b')][_0x5111('0x28')]=_0x2d9446;_0x347d87[_0x5111('0x1b')]=_0x2d9446[_0x5111('0x29')][_0x5111('0x2a')][_0x5111('0x2b')];_0x347d87[_0x5111('0x2c')]='dialogflow';_0x347d87[_0x5111('0x2d')]=JSON[_0x5111('0x21')](_0x2d9446);return rpc[_0x1e335f+_0x5111('0x2e')][_0x5111('0x1d')](_0x347d87)[_0x5111('0x1e')](function(_0x403dd7){logger[_0x5111('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x50f0a3,_0x347d87[_0x5111('0x1b')]);if(_0x2d9446[_0x5111('0x29')][_0x5111('0x2f')]['endConversation']){_0x2d2777[_0x5111('0x30')]();}else{_0x2d2777[_0x5111('0x24')]();}})[_0x5111('0x1f')](function(_0x48379a){logger['error'](_0x5111('0xd'),_0x50f0a3,JSON['stringify'](_0x48379a));_0x2d2777[_0x5111('0x30')]();});})['catch'](function(_0x35ed41){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x50f0a3,_0x35ed41['message']);_0x2d2777[_0x5111('0x30')]();});}}catch(_0x3fb9a5){logger[_0x5111('0x20')](_0x5111('0xd'),_0x50f0a3,JSON[_0x5111('0x21')](_0x3fb9a5));_0x2d2777[_0x5111('0x24')]();}};}; \ No newline at end of file +var _0x37a7=['stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','body','dialogflow','result','speech','providerName','providerResponse','endConversation','next','error','lodash','moment','../../../../config/logger','routing','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','create','then','info','catch'];(function(_0x35461b,_0x2ae428){var _0x3a2406=function(_0xf2d766){while(--_0xf2d766){_0x35461b['push'](_0x35461b['shift']());}};_0x3a2406(++_0x2ae428);}(_0x37a7,0x6f));var _0x737a=function(_0x1e2436,_0x52cbaa){_0x1e2436=_0x1e2436-0x0;var _0x4609a1=_0x37a7[_0x1e2436];return _0x4609a1;};'use strict';var _=require(_0x737a('0x0'));var moment=require(_0x737a('0x1'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require('./utils');var logger=require(_0x737a('0x2'))(_0x737a('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x737a('0x4')),'faxMessage':require(_0x737a('0x5')),'whatsappMessage':require(_0x737a('0x6'))};exports[_0x737a('0x7')]=function(_0x2f6800,_0x5cc52c){return function(_0x244850){try{if(!_[_0x737a('0x8')](this[_0x737a('0x9')][_0x737a('0xa')])){logger['info'](_0x737a('0xb'),_0x2f6800,_0x737a('0xc'));return _0x244850['next']();}var _0x2b1c32={'ContactId':this[_0x737a('0xd')]['id'],'sentAt':moment()[_0x737a('0xe')](_0x737a('0xf')),'direction':_0x737a('0x10')};if(this[_0x737a('0x11')]===_0x737a('0x12')||this['channel']===_0x737a('0x13')){_0x2b1c32[_0x737a('0x14')]=this[_0x737a('0x9')][_0x737a('0x14')];}var _0x1b7650=this[_0x737a('0x11')];if(_0x1b7650===_0x737a('0x15')){_0x2b1c32[_0x737a('0x16')]=this['account']['id'];}else{_0x2b1c32[_[_0x737a('0x17')](_0x1b7650)+_0x737a('0x18')]=this['account']['id'];}_0x2b1c32[_['upperFirst'](_0x1b7650)+_0x737a('0x19')]=this[_0x737a('0x9')]['id'];if(this[_0x737a('0x9')][_0x737a('0x1a')]){var _0x1064c3=_0x5cc52c[0x2];if(!_[_0x737a('0x1b')](_0x1064c3)){_0x2b1c32['body']=utils[_0x737a('0x1c')](_0x1064c3,this);return rpc[_0x1b7650+'Message'][_0x737a('0x1d')](_0x2b1c32)[_0x737a('0x1e')](function(_0x58fb1f){logger[_0x737a('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x2f6800,_0x2b1c32['body']);})[_0x737a('0x20')](function(_0x24f45d){logger['error'](_0x737a('0xb'),_0x2f6800,JSON[_0x737a('0x21')](_0x24f45d));})[_0x737a('0x22')](function(){logger['info'](_0x737a('0x23'),_0x2f6800);_0x244850['stop']();});}else{logger[_0x737a('0x1f')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2f6800);_0x244850[_0x737a('0x24')]();}}else{var _0x21d412=this;var _0x1e801d=apiai(_0x5cc52c[0x0],{'language':_0x5cc52c[0x1]||'en'});return _0x1e801d[_0x737a('0x25')](this[_0x737a('0x26')][_0x737a('0x27')],{'sessionId':md5(this[_0x737a('0x9')]['id'])})[_0x737a('0x1e')](function(_0x4deb7c){_0x21d412['body'][_0x737a('0x28')]=_0x4deb7c;_0x2b1c32['body']=_0x4deb7c[_0x737a('0x29')]['fulfillment'][_0x737a('0x2a')];_0x2b1c32[_0x737a('0x2b')]=_0x737a('0x28');_0x2b1c32[_0x737a('0x2c')]=JSON[_0x737a('0x21')](_0x4deb7c);return rpc[_0x1b7650+'Message'][_0x737a('0x1d')](_0x2b1c32)[_0x737a('0x1e')](function(_0x437b9a){logger[_0x737a('0x1f')](_0x737a('0xb'),_0x2f6800,_0x2b1c32[_0x737a('0x27')]);if(_0x4deb7c[_0x737a('0x29')]['metadata'][_0x737a('0x2d')]){_0x244850[_0x737a('0x2e')]();}else{_0x244850[_0x737a('0x24')]();}})[_0x737a('0x20')](function(_0x22c841){logger['error'](_0x737a('0xb'),_0x2f6800,JSON[_0x737a('0x21')](_0x22c841));_0x244850[_0x737a('0x2e')]();});})[_0x737a('0x20')](function(_0x50b09f){logger[_0x737a('0x2f')](_0x737a('0xb'),_0x2f6800,_0x50b09f[_0x737a('0x26')]);_0x244850[_0x737a('0x2e')]();});}}catch(_0x394a36){logger[_0x737a('0x2f')](_0x737a('0xb'),_0x2f6800,JSON[_0x737a('0x21')](_0x394a36));_0x244850[_0x737a('0x24')]();}};}; \ 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 364ffa3..20939ae 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 _0x3b45=['name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','length','fulfillmentText','push','all','stack','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','clone','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','body','getMustacheRender','Message','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','dialogflowV2','diagnosticInfo','queryResult','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','boolValue','intent'];(function(_0x3af7c9,_0x198742){var _0x50c2cd=function(_0x4a83ee){while(--_0x4a83ee){_0x3af7c9['push'](_0x3af7c9['shift']());}};_0x50c2cd(++_0x198742);}(_0x3b45,0x1cd));var _0x53b4=function(_0x48af68,_0x23e734){_0x48af68=_0x48af68-0x0;var _0x4f1320=_0x3b45[_0x48af68];return _0x4f1320;};'use strict';var _=require('lodash');var dialogflow=require(_0x53b4('0x0'));var md5=require(_0x53b4('0x1'));var moment=require(_0x53b4('0x2'));var Promise=require(_0x53b4('0x3'));var logger=require(_0x53b4('0x4'))(_0x53b4('0x5'));var utils=require('./utils');var rpc={'chatMessage':require(_0x53b4('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x53b4('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0xcb721b,_0x2f06f1,_0x24fe73,_0x29ea96){return new Promise(function(_0x3baea8,_0x54ce99){var _0x4c0ee7=_[_0x53b4('0x8')](_0x24fe73);_0x4c0ee7['body']=_0x29ea96;return rpc[_0x2f06f1+'Message']['create'](_0x4c0ee7)[_0x53b4('0x9')](function(){logger[_0x53b4('0xa')](_0x53b4('0xb'),_0xcb721b,_0x4c0ee7['body']);_0x3baea8();})[_0x53b4('0xc')](function(_0x235ce0){logger[_0x53b4('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0xcb721b,JSON['stringify'](_0x235ce0));_0x54ce99(_0x235ce0);});});}exports[_0x53b4('0xe')]=function(_0x3499a3,_0x31c300){return function(_0x389df5){try{if(!_[_0x53b4('0xf')](this[_0x53b4('0x10')]['UserId'])){logger['info'](_0x53b4('0xb'),_0x3499a3,_0x53b4('0x11'));return _0x389df5[_0x53b4('0x12')]();}var _0x4ec76d={'ContactId':this[_0x53b4('0x13')]['id'],'sentAt':moment()[_0x53b4('0x14')](_0x53b4('0x15')),'direction':_0x53b4('0x16')};if(this[_0x53b4('0x17')]==='sms'||this[_0x53b4('0x17')]===_0x53b4('0x18')){_0x4ec76d[_0x53b4('0x19')]=this['interaction'][_0x53b4('0x19')];}var _0x3c2167=this[_0x53b4('0x17')];if(_0x3c2167===_0x53b4('0x1a')){_0x4ec76d[_0x53b4('0x1b')]=this[_0x53b4('0x1c')]['id'];}else{_0x4ec76d[_['upperFirst'](_0x3c2167)+_0x53b4('0x1d')]=this[_0x53b4('0x1c')]['id'];}_0x4ec76d[_[_0x53b4('0x1e')](_0x3c2167)+_0x53b4('0x1f')]=this[_0x53b4('0x10')]['id'];if(this[_0x53b4('0x10')][_0x53b4('0x20')]){var _0x135825=_0x31c300[0x4];if(!_['isEmpty'](_0x135825)){_0x4ec76d[_0x53b4('0x21')]=utils[_0x53b4('0x22')](_0x135825,this);return rpc[_0x3c2167+_0x53b4('0x23')]['create'](_0x4ec76d)[_0x53b4('0x9')](function(_0x2fd2e5){logger[_0x53b4('0xa')]('[%s][DIALOGFLOWV2]\x20%s',_0x3499a3,_0x4ec76d[_0x53b4('0x21')]);})[_0x53b4('0xc')](function(_0x4f542f){logger['error'](_0x53b4('0xb'),_0x3499a3,JSON[_0x53b4('0x24')](_0x4f542f));})[_0x53b4('0x25')](function(){logger[_0x53b4('0xa')](_0x53b4('0x26'),_0x3499a3);_0x389df5[_0x53b4('0x27')]();});}else{logger['info'](_0x53b4('0x28'),_0x3499a3);_0x389df5[_0x53b4('0x27')]();}}else{var _0x1f114b=this;var _0x2c2889=_0x31c300[0x2][_0x53b4('0x29')](/\\n/g,'\x0a');var _0x15f280={'credentials':{'private_key':_0x2c2889,'client_email':_0x31c300[0x1]}};var _0x4fae0b=new dialogflow[(_0x53b4('0x2a'))](_0x15f280);var _0x2e700f=_0x4fae0b[_0x53b4('0x2b')](_0x31c300[0x0],md5(_0x1f114b[_0x53b4('0x10')]['id']));var _0x5dabb8={'session':_0x2e700f,'queryInput':{'text':{'text':_0x1f114b[_0x53b4('0x2c')][_0x53b4('0x21')],'languageCode':_0x31c300[0x3]||'en'}}};return _0x4fae0b[_0x53b4('0x2d')](_0x5dabb8)[_0x53b4('0x9')](function(_0x38661f){if(_0x38661f&&_0x38661f['length']){_0x1f114b[_0x53b4('0x21')][_0x53b4('0x2e')]=_0x38661f;var _0x27ff1e=_0x38661f[0x0];var _0x35725d=_0x27ff1e['queryResult'][_0x53b4('0x2f')]&&_0x27ff1e[_0x53b4('0x30')][_0x53b4('0x2f')][_0x53b4('0x31')]?_0x27ff1e[_0x53b4('0x30')][_0x53b4('0x2f')][_0x53b4('0x31')][_0x53b4('0x32')]['boolValue']:![];_0x1f114b[_0x53b4('0x21')][_0x53b4('0x33')]=_0x27ff1e[_0x53b4('0x30')][_0x53b4('0x34')];_0x1f114b[_0x53b4('0x21')][_0x53b4('0x35')]=_0x27ff1e['queryResult'][_0x53b4('0x36')];_0x1f114b[_0x53b4('0x21')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x27ff1e[_0x53b4('0x30')][_0x53b4('0x2f')]&&_0x27ff1e[_0x53b4('0x30')]['diagnosticInfo']['fields']?_0x27ff1e['queryResult'][_0x53b4('0x2f')][_0x53b4('0x31')][_0x53b4('0x32')][_0x53b4('0x37')]:![];_0x1f114b[_0x53b4('0x21')]['DIALOGFLOWV2_INTENTNAME']=_0x27ff1e[_0x53b4('0x30')][_0x53b4('0x38')][_0x53b4('0x39')];_0x1f114b[_0x53b4('0x21')][_0x53b4('0x3a')]=_0x27ff1e[_0x53b4('0x30')]['intent'][_0x53b4('0x3b')];_0x1f114b[_0x53b4('0x21')][_0x53b4('0x3c')]=_0x27ff1e[_0x53b4('0x30')]['intent']['isFallback'];_0x1f114b['body'][_0x53b4('0x3d')]=_0x27ff1e['queryResult'][_0x53b4('0x3e')];_0x1f114b[_0x53b4('0x21')][_0x53b4('0x3f')]=_0x27ff1e[_0x53b4('0x30')][_0x53b4('0x40')];_0x1f114b[_0x53b4('0x21')][_0x53b4('0x41')]=_0x27ff1e['queryResult'][_0x53b4('0x42')];_0x4ec76d[_0x53b4('0x43')]=_0x53b4('0x2e');_0x4ec76d[_0x53b4('0x44')]=JSON['stringify'](_0x38661f);var _0xafe9ea=[];for(var _0x8d113f=0x0;_0x8d113f<_0x38661f[_0x53b4('0x45')];_0x8d113f++){var _0x5721d9=_0x38661f[_0x8d113f];if(_0x5721d9&&_0x5721d9[_0x53b4('0x30')]&&_0x5721d9['queryResult'][_0x53b4('0x46')]){_0xafe9ea[_0x53b4('0x47')](createMessage(_0x3499a3,_0x3c2167,_0x4ec76d,_0x5721d9['queryResult']['fulfillmentText']));}}return Promise[_0x53b4('0x48')](_0xafe9ea)[_0x53b4('0x9')](function(){if(_0x35725d){_0x389df5['next']();}else{_0x389df5['stop']();}})[_0x53b4('0xc')](function(_0x3fda42){logger[_0x53b4('0xd')](_0x53b4('0xb'),_0x3499a3,JSON[_0x53b4('0x24')](_0x3fda42));_0x389df5['next']();});}})[_0x53b4('0xc')](function(_0x4e5017){logger['error'](_0x53b4('0xb'),_0x3499a3,_0x4e5017[_0x53b4('0x2c')],_0x4e5017[_0x53b4('0x49')]);_0x389df5[_0x53b4('0x12')]();});}}catch(_0x32fe36){logger[_0x53b4('0xd')](_0x53b4('0xb'),_0x3499a3,JSON[_0x53b4('0x24')](_0x32fe36));_0x389df5[_0x53b4('0x27')]();}};}; \ No newline at end of file +var _0xa734=['stack','lodash','md5','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','then','catch','error','stringify','isNil','interaction','UserId','[%s][DIALOGFLOWV2]\x20%s','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','Message','finally','info','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','all','message'];(function(_0xe84b3,_0x31ce96){var _0x339081=function(_0x573e01){while(--_0x573e01){_0xe84b3['push'](_0xe84b3['shift']());}};_0x339081(++_0x31ce96);}(_0xa734,0x16e));var _0x4a73=function(_0x192752,_0x4e4031){_0x192752=_0x192752-0x0;var _0x3b4376=_0xa734[_0x192752];return _0x3b4376;};'use strict';var _=require(_0x4a73('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x4a73('0x1'));var moment=require('moment');var Promise=require(_0x4a73('0x2'));var logger=require(_0x4a73('0x3'))(_0x4a73('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0x4a73('0x5')),'openchannelMessage':require(_0x4a73('0x6')),'mailMessage':require(_0x4a73('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x4a73('0x8')),'whatsappMessage':require(_0x4a73('0x9'))};function createMessage(_0x27e8fc,_0x5ad331,_0x172a4f,_0x3e4a9b){return new Promise(function(_0x640606,_0x483d43){var _0x184509=_[_0x4a73('0xa')](_0x172a4f);_0x184509[_0x4a73('0xb')]=_0x3e4a9b;return rpc[_0x5ad331+'Message'][_0x4a73('0xc')](_0x184509)[_0x4a73('0xd')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x27e8fc,_0x184509[_0x4a73('0xb')]);_0x640606();})[_0x4a73('0xe')](function(_0x7b273c){logger[_0x4a73('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x27e8fc,JSON[_0x4a73('0x10')](_0x7b273c));_0x483d43(_0x7b273c);});});}exports['consequence']=function(_0x1c29c3,_0x3a2ca4){return function(_0x353eba){try{if(!_[_0x4a73('0x11')](this[_0x4a73('0x12')][_0x4a73('0x13')])){logger['info'](_0x4a73('0x14'),_0x1c29c3,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x353eba[_0x4a73('0x15')]();}var _0x18cbb9={'ContactId':this['contact']['id'],'sentAt':moment()[_0x4a73('0x16')](_0x4a73('0x17')),'direction':'out'};if(this[_0x4a73('0x18')]===_0x4a73('0x19')||this[_0x4a73('0x18')]===_0x4a73('0x1a')){_0x18cbb9['phone']=this[_0x4a73('0x12')][_0x4a73('0x1b')];}var _0x26aeb3=this[_0x4a73('0x18')];if(_0x26aeb3===_0x4a73('0x1c')){_0x18cbb9['ChatWebsiteId']=this[_0x4a73('0x1d')]['id'];}else{_0x18cbb9[_[_0x4a73('0x1e')](_0x26aeb3)+'AccountId']=this[_0x4a73('0x1d')]['id'];}_0x18cbb9[_[_0x4a73('0x1e')](_0x26aeb3)+_0x4a73('0x1f')]=this[_0x4a73('0x12')]['id'];if(this[_0x4a73('0x12')][_0x4a73('0x20')]){var _0x347742=_0x3a2ca4[0x4];if(!_[_0x4a73('0x21')](_0x347742)){_0x18cbb9[_0x4a73('0xb')]=utils[_0x4a73('0x22')](_0x347742,this);return rpc[_0x26aeb3+_0x4a73('0x23')][_0x4a73('0xc')](_0x18cbb9)[_0x4a73('0xd')](function(_0x1a49ed){logger['info'](_0x4a73('0x14'),_0x1c29c3,_0x18cbb9[_0x4a73('0xb')]);})['catch'](function(_0x1d7d45){logger[_0x4a73('0xf')](_0x4a73('0x14'),_0x1c29c3,JSON['stringify'](_0x1d7d45));})[_0x4a73('0x24')](function(){logger[_0x4a73('0x25')](_0x4a73('0x26'),_0x1c29c3);_0x353eba[_0x4a73('0x27')]();});}else{logger['info'](_0x4a73('0x28'),_0x1c29c3);_0x353eba['stop']();}}else{var _0x3ab305=this;var _0x312e40=_0x3a2ca4[0x2][_0x4a73('0x29')](/\\n/g,'\x0a');var _0x5ca4a5={'credentials':{'private_key':_0x312e40,'client_email':_0x3a2ca4[0x1]}};var _0x5d272d=new dialogflow['SessionsClient'](_0x5ca4a5);var _0xa7833a=_0x5d272d[_0x4a73('0x2a')](_0x3a2ca4[0x0],md5(_0x3ab305[_0x4a73('0x12')]['id']));var _0x5d88d4={'session':_0xa7833a,'queryInput':{'text':{'text':_0x3ab305['message'][_0x4a73('0xb')],'languageCode':_0x3a2ca4[0x3]||'en'}}};return _0x5d272d[_0x4a73('0x2b')](_0x5d88d4)[_0x4a73('0xd')](function(_0x4df8b8){if(_0x4df8b8&&_0x4df8b8[_0x4a73('0x2c')]){_0x3ab305['body'][_0x4a73('0x2d')]=_0x4df8b8;var _0x3d10ee=_0x4df8b8[0x0];var _0x1fb844=_0x3d10ee[_0x4a73('0x2e')][_0x4a73('0x2f')]&&_0x3d10ee[_0x4a73('0x2e')][_0x4a73('0x2f')]['fields']?_0x3d10ee['queryResult'][_0x4a73('0x2f')][_0x4a73('0x30')][_0x4a73('0x31')][_0x4a73('0x32')]:![];_0x3ab305[_0x4a73('0xb')][_0x4a73('0x33')]=_0x3d10ee['queryResult'][_0x4a73('0x34')];_0x3ab305['body'][_0x4a73('0x35')]=_0x3d10ee[_0x4a73('0x2e')][_0x4a73('0x36')];_0x3ab305[_0x4a73('0xb')][_0x4a73('0x37')]=_0x3d10ee[_0x4a73('0x2e')]['diagnosticInfo']&&_0x3d10ee[_0x4a73('0x2e')][_0x4a73('0x2f')][_0x4a73('0x30')]?_0x3d10ee[_0x4a73('0x2e')][_0x4a73('0x2f')][_0x4a73('0x30')]['end_conversation']['boolValue']:![];_0x3ab305[_0x4a73('0xb')]['DIALOGFLOWV2_INTENTNAME']=_0x3d10ee[_0x4a73('0x2e')][_0x4a73('0x38')][_0x4a73('0x39')];_0x3ab305['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x3d10ee['queryResult'][_0x4a73('0x38')][_0x4a73('0x3a')];_0x3ab305[_0x4a73('0xb')][_0x4a73('0x3b')]=_0x3d10ee['queryResult'][_0x4a73('0x38')][_0x4a73('0x3c')];_0x3ab305[_0x4a73('0xb')][_0x4a73('0x3d')]=_0x3d10ee['queryResult'][_0x4a73('0x3e')];_0x3ab305[_0x4a73('0xb')][_0x4a73('0x3f')]=_0x3d10ee[_0x4a73('0x2e')][_0x4a73('0x40')];_0x3ab305[_0x4a73('0xb')][_0x4a73('0x41')]=_0x3d10ee[_0x4a73('0x2e')][_0x4a73('0x42')];_0x18cbb9[_0x4a73('0x43')]='dialogflowV2';_0x18cbb9[_0x4a73('0x44')]=JSON[_0x4a73('0x10')](_0x4df8b8);var _0x1ca2af=[];for(var _0x34dcf6=0x0;_0x34dcf6<_0x4df8b8[_0x4a73('0x2c')];_0x34dcf6++){var _0x58d57b=_0x4df8b8[_0x34dcf6];if(_0x58d57b&&_0x58d57b[_0x4a73('0x2e')]&&_0x58d57b[_0x4a73('0x2e')][_0x4a73('0x45')]){_0x1ca2af['push'](createMessage(_0x1c29c3,_0x26aeb3,_0x18cbb9,_0x58d57b[_0x4a73('0x2e')][_0x4a73('0x45')]));}}return Promise[_0x4a73('0x46')](_0x1ca2af)[_0x4a73('0xd')](function(){if(_0x1fb844){_0x353eba[_0x4a73('0x15')]();}else{_0x353eba[_0x4a73('0x27')]();}})[_0x4a73('0xe')](function(_0x42bd1d){logger[_0x4a73('0xf')](_0x4a73('0x14'),_0x1c29c3,JSON[_0x4a73('0x10')](_0x42bd1d));_0x353eba['next']();});}})[_0x4a73('0xe')](function(_0x20723a){logger[_0x4a73('0xf')](_0x4a73('0x14'),_0x1c29c3,_0x20723a[_0x4a73('0x47')],_0x20723a[_0x4a73('0x48')]);_0x353eba[_0x4a73('0x15')]();});}}catch(_0x25a4ee){logger['error'](_0x4a73('0x14'),_0x1c29c3,JSON[_0x4a73('0x10')](_0x25a4ee));_0x353eba[_0x4a73('0x27')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 7eca40d..cf9f857 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 _0xf9a2=['condition','priorityTrue','priorityFalse','info','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','message','join','stop'];(function(_0x409413,_0x58df38){var _0x8845b1=function(_0x2deffc){while(--_0x2deffc){_0x409413['push'](_0x409413['shift']());}};_0x8845b1(++_0x58df38);}(_0xf9a2,0x15c));var _0x2f9a=function(_0x50a2a4,_0x54c30b){_0x50a2a4=_0x50a2a4-0x0;var _0x2fce5f=_0xf9a2[_0x50a2a4];return _0x2fce5f;};'use strict';var schema=require(_0x2f9a('0x0'));var _=require(_0x2f9a('0x1'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x2f9a('0x2'));var gotoif=schema({'condition':{'type':_0x2f9a('0x3'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x2f9a('0x4'),'message':_0x2f9a('0x5')},'priorityFalse':{'type':'number','message':_0x2f9a('0x6')}});exports['consequence']=function(_0x51d965,_0x3af5db){return function(_0x5ad56c){try{var _0x4e44d7={'condition':htmlToText[_0x2f9a('0x7')](utils[_0x2f9a('0x8')](_0x3af5db[0x0],this),{'wordwrap':![]})[_0x2f9a('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3af5db[0x1],'priorityFalse':_0x3af5db[0x2]};var _0x26b4d7=gotoif[_0x2f9a('0x0')](_0x4e44d7,{'typecast':!![]});if(_0x26b4d7[_0x2f9a('0xa')]){logger[_0x2f9a('0xb')](_0x2f9a('0xc'),_0x51d965,_['map'](_0x26b4d7,_0x2f9a('0xd'))[_0x2f9a('0xe')](',\x20'));_0x5ad56c[_0x2f9a('0xf')]();}else{try{var _0x4270cb=eval('('+_0x4e44d7[_0x2f9a('0x10')]+')');var _0x1cb783=_0x4270cb?_0x4e44d7[_0x2f9a('0x11')]:_0x4e44d7[_0x2f9a('0x12')];logger[_0x2f9a('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x51d965,_0x4e44d7['condition'],_0x4270cb,_0x1cb783||_0x2f9a('0x14'));if(_0x1cb783){var _0x5ed598=_[_0x2f9a('0x15')](_0x5ad56c['rules'](),{'p':_0x1cb783});if(_0x5ed598>=0x0){logger[_0x2f9a('0x13')](_0x2f9a('0x16'),_0x51d965,_0x1cb783||_0x2f9a('0x14'),_0x5ed598);_0x5ad56c[_0x2f9a('0x14')](_0x5ed598);}else{logger[_0x2f9a('0x13')](_0x2f9a('0x17'),_0x51d965,_0x1cb783||_0x2f9a('0x14'));_0x5ad56c[_0x2f9a('0xf')]();}}else{_0x5ad56c[_0x2f9a('0x14')]();}}catch(_0x428ee4){logger['error'](_0x2f9a('0x18'),_0x51d965,_0x428ee4['message']);_0x5ad56c['stop']();}}}catch(_0x55b0d4){logger[_0x2f9a('0xb')](_0x2f9a('0xc'),_0x51d965,JSON[_0x2f9a('0x19')](_0x55b0d4));_0x5ad56c[_0x2f9a('0xf')]();}};}; \ No newline at end of file +var _0x8ca1=['string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','getMustacheRender','error','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','html-to-text','./utils','../../../../config/logger','routing'];(function(_0x338989,_0x24edc1){var _0x5530a6=function(_0x205794){while(--_0x205794){_0x338989['push'](_0x338989['shift']());}};_0x5530a6(++_0x24edc1);}(_0x8ca1,0xdb));var _0x18ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8ca1[_0x20a584];return _0x4b41a8;};'use strict';var schema=require(_0x18ca('0x0'));var _=require('lodash');var htmlToText=require(_0x18ca('0x1'));var utils=require(_0x18ca('0x2'));var logger=require(_0x18ca('0x3'))(_0x18ca('0x4'));var gotoif=schema({'condition':{'type':_0x18ca('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x18ca('0x6'),'message':_0x18ca('0x7')},'priorityFalse':{'type':'number','message':_0x18ca('0x8')}});exports['consequence']=function(_0x5c9ec1,_0x249a26){return function(_0x447bf2){try{var _0x4c5e10={'condition':htmlToText['fromString'](utils[_0x18ca('0x9')](_0x249a26[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x249a26[0x1],'priorityFalse':_0x249a26[0x2]};var _0x55c658=gotoif['validate'](_0x4c5e10,{'typecast':!![]});if(_0x55c658['length']){logger[_0x18ca('0xa')](_0x18ca('0xb'),_0x5c9ec1,_[_0x18ca('0xc')](_0x55c658,_0x18ca('0xd'))[_0x18ca('0xe')](',\x20'));_0x447bf2[_0x18ca('0xf')]();}else{try{var _0x1fd41e=eval('('+_0x4c5e10['condition']+')');var _0x1eac10=_0x1fd41e?_0x4c5e10[_0x18ca('0x10')]:_0x4c5e10[_0x18ca('0x11')];logger[_0x18ca('0x12')](_0x18ca('0x13'),_0x5c9ec1,_0x4c5e10[_0x18ca('0x14')],_0x1fd41e,_0x1eac10||_0x18ca('0x15'));if(_0x1eac10){var _0x2a23b0=_[_0x18ca('0x16')](_0x447bf2[_0x18ca('0x17')](),{'p':_0x1eac10});if(_0x2a23b0>=0x0){logger[_0x18ca('0x12')](_0x18ca('0x18'),_0x5c9ec1,_0x1eac10||_0x18ca('0x15'),_0x2a23b0);_0x447bf2[_0x18ca('0x15')](_0x2a23b0);}else{logger[_0x18ca('0x12')](_0x18ca('0x19'),_0x5c9ec1,_0x1eac10||'next');_0x447bf2[_0x18ca('0xf')]();}}else{_0x447bf2[_0x18ca('0x15')]();}}catch(_0x22a5dd){logger[_0x18ca('0xa')](_0x18ca('0x1a'),_0x5c9ec1,_0x22a5dd['message']);_0x447bf2[_0x18ca('0xf')]();}}}catch(_0xd44879){logger['error'](_0x18ca('0xb'),_0x5c9ec1,JSON[_0x18ca('0x1b')](_0xd44879));_0x447bf2[_0x18ca('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 91cab16..f22f782 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 _0x9bf3=['[%s][GOTOP]\x20%s','map','message','priority','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x142bba,_0xfc048e){var _0x10b720=function(_0x595c9d){while(--_0x595c9d){_0x142bba['push'](_0x142bba['shift']());}};_0x10b720(++_0xfc048e);}(_0x9bf3,0x96));var _0x39bf=function(_0x5e34a4,_0x2e63ed){_0x5e34a4=_0x5e34a4-0x0;var _0x8d41d7=_0x9bf3[_0x5e34a4];return _0x8d41d7;};'use strict';var schema=require(_0x39bf('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x39bf('0x1')}});exports[_0x39bf('0x2')]=function(_0x95093a,_0x3ec7d4){return function(_0x386a30){try{var _0xb79bbd={'priority':_0x3ec7d4[0x0]};var _0x4c0185=gotop[_0x39bf('0x0')](_0xb79bbd,{'typecast':!![]});if(_0x4c0185[_0x39bf('0x3')]){logger['error'](_0x39bf('0x4'),_0x95093a,_[_0x39bf('0x5')](_0x4c0185,_0x39bf('0x6'))['join'](',\x20'));_0x386a30['stop']();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x95093a,_0xb79bbd['priority']);if(_0xb79bbd[_0x39bf('0x7')]){var _0x2c84c6=_['findIndex'](_0x386a30['rules'](),{'p':_0xb79bbd['priority']});if(_0x2c84c6>=0x0){logger[_0x39bf('0x8')](_0x39bf('0x9'),_0x95093a,_0xb79bbd['priority']||_0x39bf('0xa'),_0x2c84c6);_0x386a30[_0x39bf('0xa')](_0x2c84c6);}else{logger['info'](_0x39bf('0xb'),_0x95093a,_0xb79bbd[_0x39bf('0x7')]||_0x39bf('0xa'));_0x386a30[_0x39bf('0xc')]();}}else{_0x386a30[_0x39bf('0xa')]();}}}catch(_0x524bf6){logger['error'](_0x39bf('0x4'),_0x95093a,JSON[_0x39bf('0xd')](_0x524bf6));_0x386a30[_0x39bf('0xc')]();}};}; \ No newline at end of file +var _0x89aa=['error','[%s][GOTOP]\x20%s','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length'];(function(_0x42ba14,_0x231319){var _0x5475a6=function(_0x29db89){while(--_0x29db89){_0x42ba14['push'](_0x42ba14['shift']());}};_0x5475a6(++_0x231319);}(_0x89aa,0x92));var _0xa89a=function(_0x298235,_0xb46ba1){_0x298235=_0x298235-0x0;var _0x32824f=_0x89aa[_0x298235];return _0x32824f;};'use strict';var schema=require(_0xa89a('0x0'));var _=require(_0xa89a('0x1'));var logger=require(_0xa89a('0x2'))('routing');var gotop=schema({'priority':{'type':_0xa89a('0x3'),'required':!![],'message':_0xa89a('0x4')}});exports['consequence']=function(_0xe0564f,_0x41d328){return function(_0x3428f7){try{var _0x5eb9de={'priority':_0x41d328[0x0]};var _0x55a769=gotop[_0xa89a('0x0')](_0x5eb9de,{'typecast':!![]});if(_0x55a769[_0xa89a('0x5')]){logger[_0xa89a('0x6')](_0xa89a('0x7'),_0xe0564f,_['map'](_0x55a769,_0xa89a('0x8'))[_0xa89a('0x9')](',\x20'));_0x3428f7[_0xa89a('0xa')]();}else{logger[_0xa89a('0xb')](_0xa89a('0xc'),_0xe0564f,_0x5eb9de['priority']);if(_0x5eb9de[_0xa89a('0xd')]){var _0x5a00e8=_[_0xa89a('0xe')](_0x3428f7['rules'](),{'p':_0x5eb9de['priority']});if(_0x5a00e8>=0x0){logger['info'](_0xa89a('0xf'),_0xe0564f,_0x5eb9de[_0xa89a('0xd')]||_0xa89a('0x10'),_0x5a00e8);_0x3428f7[_0xa89a('0x10')](_0x5a00e8);}else{logger[_0xa89a('0xb')](_0xa89a('0x11'),_0xe0564f,_0x5eb9de[_0xa89a('0xd')]||'next');_0x3428f7['stop']();}}else{_0x3428f7[_0xa89a('0x10')]();}}}catch(_0x47aaf8){logger[_0xa89a('0x6')]('[%s][GOTOP]\x20%s',_0xe0564f,JSON[_0xa89a('0x12')](_0x47aaf8));_0x3428f7['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 cba171b..d04212d 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 _0x9a6a=['Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','stop','error','stringify','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','upperFirst','channel','AccountId','InteractionId','interaction'];(function(_0x448ae2,_0x1676f5){var _0x4fdd34=function(_0x30e907){while(--_0x30e907){_0x448ae2['push'](_0x448ae2['shift']());}};_0x4fdd34(++_0x1676f5);}(_0x9a6a,0xce));var _0xa9a6=function(_0x1d5896,_0x30e17e){_0x1d5896=_0x1d5896-0x0;var _0x483770=_0x9a6a[_0x1d5896];return _0x483770;};'use strict';var _=require('lodash');var utils=require(_0xa9a6('0x0'));var logger=require('../../../../config/logger')(_0xa9a6('0x1'));var rpc={'chatMessage':require(_0xa9a6('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xa9a6('0x3')),'smsMessage':require(_0xa9a6('0x4')),'faxMessage':require(_0xa9a6('0x5')),'whatsappMessage':require(_0xa9a6('0x6'))};exports[_0xa9a6('0x7')]=function(_0x560bce,_0x58a70c){return function(_0x4678ed){try{var _0x241cdd={'body':utils[_0xa9a6('0x8')](_0x58a70c[0x0],this),'ContactId':this[_0xa9a6('0x9')]['id']};if(this['channel']===_0xa9a6('0xa')){_0x241cdd[_0xa9a6('0xb')]=this[_0xa9a6('0xc')]['id'];}else{_0x241cdd[_[_0xa9a6('0xd')](this[_0xa9a6('0xe')])+_0xa9a6('0xf')]=this[_0xa9a6('0xc')]['id'];}_0x241cdd[_[_0xa9a6('0xd')](this[_0xa9a6('0xe')])+_0xa9a6('0x10')]=this[_0xa9a6('0x11')]['id'];if(rpc[this[_0xa9a6('0xe')]+_0xa9a6('0x12')]){return rpc[this[_0xa9a6('0xe')]+_0xa9a6('0x12')][_0xa9a6('0x13')](_0x241cdd)[_0xa9a6('0x14')](function(_0x8a2d3c){logger['info'](_0xa9a6('0x15'),_0x560bce,_0x241cdd[_0xa9a6('0x16')]);_0x4678ed[_0xa9a6('0x17')]();})[_0xa9a6('0x18')](function(_0x51111c){logger['error'](_0xa9a6('0x15'),_0x560bce,JSON['stringify'](_0x51111c));_0x4678ed[_0xa9a6('0x19')]();});}}catch(_0xd4b6e8){logger[_0xa9a6('0x1a')](_0xa9a6('0x15'),_0x560bce,JSON[_0xa9a6('0x1b')](_0xd4b6e8));_0x4678ed[_0xa9a6('0x19')]();}};}; \ No newline at end of file +var _0x5edf=['error','[%s][MESSAGE]\x20%s','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','then','info','body','next','catch','stringify','stop'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x5edf,0x188));var _0xf5ed=function(_0x1b5fea,_0x307144){_0x1b5fea=_0x1b5fea-0x0;var _0x5e8fe0=_0x5edf[_0x1b5fea];return _0x5e8fe0;};'use strict';var _=require(_0xf5ed('0x0'));var utils=require('./utils');var logger=require(_0xf5ed('0x1'))(_0xf5ed('0x2'));var rpc={'chatMessage':require(_0xf5ed('0x3')),'openchannelMessage':require(_0xf5ed('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf5ed('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf5ed('0x6'))};exports['consequence']=function(_0x30bab3,_0x2c260b){return function(_0x5329ea){try{var _0x605b91={'body':utils[_0xf5ed('0x7')](_0x2c260b[0x0],this),'ContactId':this[_0xf5ed('0x8')]['id']};if(this[_0xf5ed('0x9')]===_0xf5ed('0xa')){_0x605b91[_0xf5ed('0xb')]=this[_0xf5ed('0xc')]['id'];}else{_0x605b91[_[_0xf5ed('0xd')](this[_0xf5ed('0x9')])+'AccountId']=this[_0xf5ed('0xc')]['id'];}_0x605b91[_[_0xf5ed('0xd')](this[_0xf5ed('0x9')])+_0xf5ed('0xe')]=this[_0xf5ed('0xf')]['id'];if(rpc[this[_0xf5ed('0x9')]+_0xf5ed('0x10')]){return rpc[this[_0xf5ed('0x9')]+_0xf5ed('0x10')]['create'](_0x605b91)[_0xf5ed('0x11')](function(_0x2d3c72){logger[_0xf5ed('0x12')]('[%s][MESSAGE]\x20%s',_0x30bab3,_0x605b91[_0xf5ed('0x13')]);_0x5329ea[_0xf5ed('0x14')]();})[_0xf5ed('0x15')](function(_0x518437){logger['error']('[%s][MESSAGE]\x20%s',_0x30bab3,JSON[_0xf5ed('0x16')](_0x518437));_0x5329ea[_0xf5ed('0x17')]();});}}catch(_0x92f950){logger[_0xf5ed('0x18')](_0xf5ed('0x19'),_0x30bab3,JSON['stringify'](_0x92f950));_0x5329ea['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 c2a6859..b7aee1f 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 _0x17f7=['../../../../config/logger','routing','info','[%s][NOOP]\x20%s','getMustacheRender','stringify','stop','./utils'];(function(_0x2eddb9,_0x41e214){var _0x541be9=function(_0x34ace7){while(--_0x34ace7){_0x2eddb9['push'](_0x2eddb9['shift']());}};_0x541be9(++_0x41e214);}(_0x17f7,0x1bf));var _0x717f=function(_0xdc70ef,_0x1adc04){_0xdc70ef=_0xdc70ef-0x0;var _0x5e41d3=_0x17f7[_0xdc70ef];return _0x5e41d3;};'use strict';var utils=require(_0x717f('0x0'));var logger=require(_0x717f('0x1'))(_0x717f('0x2'));exports['consequence']=function(_0x1bd471,_0x29078f){return function(_0x47a191){try{logger[_0x717f('0x3')](_0x717f('0x4'),_0x1bd471,utils[_0x717f('0x5')](_0x29078f[0x0],this));_0x47a191['next']();}catch(_0x3c416a){logger['error']('[%s][NOOP]\x20%s',_0x1bd471,JSON[_0x717f('0x6')](_0x3c416a));_0x47a191[_0x717f('0x7')]();}};}; \ No newline at end of file +var _0x31de=['[%s][NOOP]\x20%s','stringify','stop','../../../../config/logger','consequence','info','error'];(function(_0x1424d9,_0x259545){var _0x271079=function(_0x3c0f86){while(--_0x3c0f86){_0x1424d9['push'](_0x1424d9['shift']());}};_0x271079(++_0x259545);}(_0x31de,0x199));var _0xe31d=function(_0x37510f,_0x61fbe6){_0x37510f=_0x37510f-0x0;var _0x12a439=_0x31de[_0x37510f];return _0x12a439;};'use strict';var utils=require('./utils');var logger=require(_0xe31d('0x0'))('routing');exports[_0xe31d('0x1')]=function(_0x5a5031,_0x5154aa){return function(_0x1384f8){try{logger[_0xe31d('0x2')]('[%s][NOOP]\x20%s',_0x5a5031,utils['getMustacheRender'](_0x5154aa[0x0],this));_0x1384f8['next']();}catch(_0x4d932e){logger[_0xe31d('0x3')](_0xe31d('0x4'),_0x5a5031,JSON[_0xe31d('0x5')](_0x4d932e));_0x1384f8[_0xe31d('0x6')]();}};}; \ 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 f2fc766..c25ead6 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 _0x9f98=['beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','routing','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','account','joinAt','emit','clone','queue','push','capitalize','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','name','QueueReport','create','catch','create\x20queue\x20report','accepted','info','Interaction','update','then','error','update\x20queue\x20report','toLowerCase','length','join','stop','find','Queues','timeout','createQueue','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','strategy','rrmemory'];(function(_0x8b1a5e,_0x2744eb){var _0x1146b1=function(_0x5a9f50){while(--_0x5a9f50){_0x8b1a5e['push'](_0x8b1a5e['shift']());}};_0x1146b1(++_0x2744eb);}(_0x9f98,0xac));var _0x89f9=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9f98[_0xfae23b];return _0x200640;};'use strict';var schema=require(_0x89f9('0x0'));var _=require(_0x89f9('0x1'));var util=require(_0x89f9('0x2'));var seqqueue=require(_0x89f9('0x3'));var moment=require('moment');var Redis=require(_0x89f9('0x4'));var config=require(_0x89f9('0x5'));var logger=require('../../../../config/logger')(_0x89f9('0x6'));var strategy=require(_0x89f9('0x7'));config['redis']=_[_0x89f9('0x8')](config[_0x89f9('0x9')],{'host':_0x89f9('0xa'),'port':0x18eb});var io=require(_0x89f9('0xb'))(new Redis(config[_0x89f9('0x9')]));var attributes=['id',_0x89f9('0xc'),_0x89f9('0xd'),'queue','from',_0x89f9('0xe')];function emit(_0xac5126,_0x4a675d,_0x349e61){io['to'](_0xac5126)[_0x89f9('0xf')](_0x4a675d,_0x349e61);}function emitChannelQueueInteraction(_0x3b4ec3,_0x16d0da,_0x1b009b,_0x51e394,_0x2b1b3c,_0x2b02ec,_0x421c2c,_0x19c36d){var _0x1c1edb=_[_0x89f9('0x10')](_0x1b009b);_0x1c1edb[_0x89f9('0xc')]=_0x19c36d;_0x1c1edb[_0x89f9('0x11')]=_0x16d0da;_0x1c1edb[_0x89f9('0xd')]=_0x51e394;_0x1c1edb['id']=_0x2b1b3c;if(_0x2b02ec){attributes[_0x89f9('0x12')](_[_0x89f9('0x13')](_0x3b4ec3)+'InteractionId');_0x421c2c[util[_0x89f9('0x14')](_0x89f9('0x15'),_0x3b4ec3)][_0x2b1b3c]=_[_0x89f9('0x16')](_0x1c1edb,attributes);}else{delete _0x421c2c[util[_0x89f9('0x14')](_0x89f9('0x15'),_0x3b4ec3)][_0x2b1b3c];}emit(util[_0x89f9('0x14')](_0x89f9('0x17'),_0x3b4ec3,_0x16d0da),util[_0x89f9('0x14')](_0x89f9('0x18'),_0x3b4ec3,_0x2b02ec?_0x89f9('0x19'):_0x89f9('0x1a')),_[_0x89f9('0x16')](_0x1c1edb,attributes));}var rpc={'openchannelQueueReport':require(_0x89f9('0x1b')),'mailQueueReport':require(_0x89f9('0x1c')),'chatQueueReport':require(_0x89f9('0x1d')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x89f9('0x1e')),'whatsappQueueReport':require(_0x89f9('0x1f')),'chatInteraction':require(_0x89f9('0x20')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x89f9('0x21')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x89f9('0x22'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x89f9('0x23')},'timeout':{'type':_0x89f9('0x24'),'message':_0x89f9('0x25')}});function startRouting(_0x131301,_0x4066db,_0x2499d6,_0x5c34e9){if(_0x131301&&_0x4066db&&_0x2499d6){_0x4066db[_0x89f9('0x26')]+=0x1;var _0x4d8bd3={'uniqueid':_0x131301,'from':_0x2499d6['body']?_0x2499d6[_0x89f9('0x27')][_0x89f9('0x28')]:'','joinAt':moment()['format'](_0x89f9('0x29')),'ContactId':_0x2499d6[_0x89f9('0x2a')]?_0x2499d6[_0x89f9('0x2a')]['id']:null,'ListId':_0x2499d6[_0x89f9('0x2b')]?_0x2499d6['list']['id']:null};_0x4d8bd3[_[_0x89f9('0x2c')](_0x2499d6[_0x89f9('0x2d')])+_0x89f9('0x2e')]=_0x4066db['id']||null;_0x4d8bd3[_['upperFirst'](_0x2499d6['channel'])+_0x89f9('0x2f')]=_0x2499d6[_0x89f9('0x30')]?_0x2499d6['interaction']['id']:null;_0x4d8bd3[_[_0x89f9('0x2c')](_0x2499d6[_0x89f9('0x2d')])+_0x89f9('0x31')]=_0x2499d6['message']?_0x2499d6[_0x89f9('0x32')]['id']:null;_0x4d8bd3[_[_0x89f9('0x2c')](_0x2499d6[_0x89f9('0x2d')])+(_0x2499d6[_0x89f9('0x2d')]!==_0x89f9('0x33')?_0x89f9('0x34'):_0x89f9('0x35'))]=_0x2499d6[_0x89f9('0xd')]?_0x2499d6['account']['id']:null;logger['info'](util[_0x89f9('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x131301,_0x4066db['name']));emitChannelQueueInteraction(_0x2499d6[_0x89f9('0x2d')],_0x4066db[_0x89f9('0x36')],_0x4d8bd3,_0x2499d6[_0x89f9('0xd')]['name'],_0x2499d6[_0x89f9('0x32')]['id'],!![],_0x5c34e9,_0x4066db['id']);if(rpc[_0x2499d6['channel']+_0x89f9('0x37')]){return rpc[_0x2499d6[_0x89f9('0x2d')]+_0x89f9('0x37')][_0x89f9('0x38')](_0x4d8bd3)[_0x89f9('0x39')](function(_0x2344a0){logger['error'](_0x89f9('0x3a'),_0x2344a0);});}}}function stopRouting(_0x49772a,_0x40705f,_0x35496d,_0x154b1d){if(_0x49772a&&_0x40705f){_0x40705f[_0x89f9('0x26')]-=0x1;var _0x501ade={'leaveAt':moment()[_0x89f9('0x14')](_0x89f9('0x29')),'acceptAt':moment()[_0x89f9('0x14')](_0x89f9('0x29')),'reason':_0x89f9('0x3b')};logger[_0x89f9('0x3c')](util[_0x89f9('0x14')]('[%s][STOP:QUEUE][NAME:%s]',_0x49772a,_0x40705f[_0x89f9('0x36')]));emitChannelQueueInteraction(_0x35496d['channel'],_0x40705f[_0x89f9('0x36')],_0x35496d['body'],_0x35496d[_0x89f9('0xd')][_0x89f9('0x36')],_0x35496d[_0x89f9('0x32')]['id'],![],_0x154b1d,_0x40705f['id']);return rpc[_0x35496d[_0x89f9('0x2d')]+_0x89f9('0x3d')][_0x89f9('0x3e')](_0x35496d['interaction']['id'],{'queueId':_0x40705f['id']})[_0x89f9('0x3f')](function(){if(rpc[_0x35496d[_0x89f9('0x2d')]+_0x89f9('0x37')]){return rpc[_0x35496d['channel']+_0x89f9('0x37')][_0x89f9('0x3e')](_0x49772a,_0x501ade)[_0x89f9('0x39')](function(_0x325dac){logger[_0x89f9('0x40')](_0x89f9('0x41'),_0x325dac);});}});}}function endRouting(_0x3f0f3b,_0x3153d5,_0x520fa9,_0x38cf24){if(_0x3f0f3b&&_0x3153d5){_0x3153d5[_0x89f9('0x26')]-=0x1;var _0x9bfece={'leaveAt':moment()[_0x89f9('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x89f9('0x14')](_0x89f9('0x29')),'reason':'timeout'};logger[_0x89f9('0x3c')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x3f0f3b,_0x3153d5[_0x89f9('0x36')]));emitChannelQueueInteraction(_0x520fa9[_0x89f9('0x2d')],_0x3153d5[_0x89f9('0x36')],_0x520fa9[_0x89f9('0x27')],_0x520fa9[_0x89f9('0xd')][_0x89f9('0x36')],_0x520fa9[_0x89f9('0x32')]['id'],![],_0x38cf24);if(rpc[_0x520fa9[_0x89f9('0x2d')]+'QueueReport']){return rpc[_0x520fa9['channel']+_0x89f9('0x37')][_0x89f9('0x3e')](_0x3f0f3b,_0x9bfece)['catch'](function(_0x24172c){logger['error'](_0x89f9('0x41'),_0x24172c);});}}}function handleFindQueue(_0x3bb90d){return function(_0x13370c){return _0x13370c[_0x89f9('0x36')][_0x89f9('0x42')]()===_0x3bb90d[_0x89f9('0x42')]();};}exports['consequence']=function(_0x45f31b,_0x13be89,_0x1e6e22,_0x539a70){return function(_0x516249){try{var _0x47ed98={'name':_0x13be89[0x0],'timeout':_0x13be89[0x1]};var _0x399486=queue[_0x89f9('0x0')](_0x47ed98,{'typecast':!![]});if(_0x399486[_0x89f9('0x43')]){logger[_0x89f9('0x40')]('[%s][QUEUE]\x20%s',_0x45f31b,_['map'](_0x399486,_0x89f9('0x32'))[_0x89f9('0x44')](',\x20'));_0x516249[_0x89f9('0x45')]();}else{var _0x5a6ef0=_[_0x89f9('0x46')](_0x1e6e22[_0x539a70[_0x89f9('0x2d')]+_0x89f9('0x47')],handleFindQueue(_0x47ed98[_0x89f9('0x36')]));if(_0x5a6ef0){startRouting(_0x45f31b,_0x5a6ef0,_0x539a70,_0x1e6e22);var _0x19b460=(_0x5a6ef0['timeout']||0xa)*0x3e8;var _0x18dc59=(_0x47ed98[_0x89f9('0x48')]||0x14)*0x3e8;var _0x46625d;if(_0x19b460>_0x18dc59){_0x18dc59=_0x19b460;}var _0x5899f0=seqqueue[_0x89f9('0x49')](_0x19b460);_0x5899f0['id']=_0x45f31b;_0x5899f0['atimeout']=_0x19b460;_0x5899f0[_0x89f9('0x4a')]=_0x18dc59;_0x5899f0[_0x89f9('0x2d')]=_0x539a70[_0x89f9('0x2d')];_0x1e6e22['rules'][_0x45f31b]['on'](_0x89f9('0x4b'),function(){logger['info'](_0x89f9('0x4c'),_0x45f31b);stopRouting(_0x45f31b,_0x5a6ef0,_0x539a70,_0x1e6e22);clearTimeout(_0x46625d);_0x46625d=undefined;_0x5899f0[_0x89f9('0x4d')](!![]);if(_0x1e6e22['rules'][_0x45f31b]){delete _0x1e6e22[_0x89f9('0x4e')][_0x45f31b];}_0x516249[_0x89f9('0x45')]();});_0x1e6e22['rules'][_0x45f31b]['on'](_0x89f9('0x4f'),function(){if(_0x1e6e22['rules'][_0x45f31b]){delete _0x1e6e22[_0x89f9('0x4e')][_0x45f31b];}});_0x46625d=setTimeout(function(){logger[_0x89f9('0x3c')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x45f31b);endRouting(_0x45f31b,_0x5a6ef0,_0x539a70,_0x1e6e22);clearTimeout(_0x46625d);_0x5899f0[_0x89f9('0x4d')](!![]);_0x516249[_0x89f9('0x50')]();},_0x18dc59);switch(_0x5a6ef0[_0x89f9('0x51')]){case _0x89f9('0x52'):strategy[_0x89f9('0x52')](_0x5899f0,_0x5a6ef0,_0x1e6e22,_0x539a70);break;default:strategy[_0x89f9('0x53')](_0x5899f0,_0x5a6ef0,_0x1e6e22,_0x539a70);}}else{logger[_0x89f9('0x40')](_0x89f9('0x54'),_0x45f31b,_0x47ed98[_0x89f9('0x36')]);_0x516249[_0x89f9('0x45')]();}}}catch(_0x53c9a1){logger['error']('[%s][QUEUE]\x20%s',_0x45f31b,_0x53c9a1['stack']);_0x516249[_0x89f9('0x45')]();}};}; \ No newline at end of file +var _0x5b21=['../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','QueueId','upperFirst','channel','InteractionId','interaction','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','Queues','atimeout','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','util','seq-queue','moment','../../../../config/logger','routing','redis','localhost','socket.io-emitter','account','queue','from','emit','push','capitalize','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport'];(function(_0x4b9cb4,_0x1f18a8){var _0x335d39=function(_0x5d6de6){while(--_0x5d6de6){_0x4b9cb4['push'](_0x4b9cb4['shift']());}};_0x335d39(++_0x1f18a8);}(_0x5b21,0x1bf));var _0x15b2=function(_0x1f7ec2,_0x85b955){_0x1f7ec2=_0x1f7ec2-0x0;var _0x21c4f7=_0x5b21[_0x1f7ec2];return _0x21c4f7;};'use strict';var schema=require(_0x15b2('0x0'));var _=require('lodash');var util=require(_0x15b2('0x1'));var seqqueue=require(_0x15b2('0x2'));var moment=require(_0x15b2('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x15b2('0x4'))(_0x15b2('0x5'));var strategy=require('./strategy');config[_0x15b2('0x6')]=_['defaults'](config[_0x15b2('0x6')],{'host':_0x15b2('0x7'),'port':0x18eb});var io=require(_0x15b2('0x8'))(new Redis(config[_0x15b2('0x6')]));var attributes=['id','queue_id',_0x15b2('0x9'),_0x15b2('0xa'),_0x15b2('0xb'),'joinAt'];function emit(_0x22c6a0,_0x276716,_0x4ee716){io['to'](_0x22c6a0)[_0x15b2('0xc')](_0x276716,_0x4ee716);}function emitChannelQueueInteraction(_0x1ef7f0,_0x10a7cb,_0x1c69b0,_0x20b28b,_0x35b52b,_0x4f9672,_0x3b145b,_0x5c5378){var _0x46fd9d=_['clone'](_0x1c69b0);_0x46fd9d['queue_id']=_0x5c5378;_0x46fd9d[_0x15b2('0xa')]=_0x10a7cb;_0x46fd9d[_0x15b2('0x9')]=_0x20b28b;_0x46fd9d['id']=_0x35b52b;if(_0x4f9672){attributes[_0x15b2('0xd')](_[_0x15b2('0xe')](_0x1ef7f0)+'InteractionId');_0x3b145b[util[_0x15b2('0xf')](_0x15b2('0x10'),_0x1ef7f0)][_0x35b52b]=_[_0x15b2('0x11')](_0x46fd9d,attributes);}else{delete _0x3b145b[util['format']('%sQueuesWaitingInteractions',_0x1ef7f0)][_0x35b52b];}emit(util[_0x15b2('0xf')]('%s:queue:%s',_0x1ef7f0,_0x10a7cb),util[_0x15b2('0xf')](_0x15b2('0x12'),_0x1ef7f0,_0x4f9672?_0x15b2('0x13'):_0x15b2('0x14')),_[_0x15b2('0x11')](_0x46fd9d,attributes));}var rpc={'openchannelQueueReport':require(_0x15b2('0x15')),'mailQueueReport':require(_0x15b2('0x16')),'chatQueueReport':require(_0x15b2('0x17')),'smsQueueReport':require(_0x15b2('0x18')),'faxQueueReport':require(_0x15b2('0x19')),'whatsappQueueReport':require(_0x15b2('0x1a')),'chatInteraction':require(_0x15b2('0x1b')),'faxInteraction':require(_0x15b2('0x1c')),'mailInteraction':require(_0x15b2('0x1d')),'openchannelInteraction':require(_0x15b2('0x1e')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x15b2('0x1f'))};var queue=schema({'name':{'type':_0x15b2('0x20'),'required':!![],'message':_0x15b2('0x21')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x38bc41,_0x3ee5e1,_0xee3376,_0x3cbd6e){if(_0x38bc41&&_0x3ee5e1&&_0xee3376){_0x3ee5e1[_0x15b2('0x22')]+=0x1;var _0x23b5f0={'uniqueid':_0x38bc41,'from':_0xee3376['body']?_0xee3376[_0x15b2('0x23')][_0x15b2('0xb')]:'','joinAt':moment()[_0x15b2('0xf')](_0x15b2('0x24')),'ContactId':_0xee3376[_0x15b2('0x25')]?_0xee3376[_0x15b2('0x25')]['id']:null,'ListId':_0xee3376[_0x15b2('0x26')]?_0xee3376[_0x15b2('0x26')]['id']:null};_0x23b5f0[_['upperFirst'](_0xee3376['channel'])+_0x15b2('0x27')]=_0x3ee5e1['id']||null;_0x23b5f0[_[_0x15b2('0x28')](_0xee3376[_0x15b2('0x29')])+_0x15b2('0x2a')]=_0xee3376['interaction']?_0xee3376[_0x15b2('0x2b')]['id']:null;_0x23b5f0[_[_0x15b2('0x28')](_0xee3376[_0x15b2('0x29')])+'MessageId']=_0xee3376['message']?_0xee3376[_0x15b2('0x2c')]['id']:null;_0x23b5f0[_[_0x15b2('0x28')](_0xee3376['channel'])+(_0xee3376[_0x15b2('0x29')]!=='chat'?_0x15b2('0x2d'):_0x15b2('0x2e'))]=_0xee3376[_0x15b2('0x9')]?_0xee3376['account']['id']:null;logger[_0x15b2('0x2f')](util[_0x15b2('0xf')](_0x15b2('0x30'),_0x38bc41,_0x3ee5e1[_0x15b2('0x31')]));emitChannelQueueInteraction(_0xee3376[_0x15b2('0x29')],_0x3ee5e1[_0x15b2('0x31')],_0x23b5f0,_0xee3376['account']['name'],_0xee3376['message']['id'],!![],_0x3cbd6e,_0x3ee5e1['id']);if(rpc[_0xee3376[_0x15b2('0x29')]+_0x15b2('0x32')]){return rpc[_0xee3376['channel']+_0x15b2('0x32')]['create'](_0x23b5f0)['catch'](function(_0x3d1855){logger[_0x15b2('0x33')](_0x15b2('0x34'),_0x3d1855);});}}}function stopRouting(_0x58af8b,_0x1c2124,_0x494bb0,_0x4e73ab){if(_0x58af8b&&_0x1c2124){_0x1c2124[_0x15b2('0x22')]-=0x1;var _0x4c8e28={'leaveAt':moment()[_0x15b2('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x15b2('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0x15b2('0x2f')](util['format'](_0x15b2('0x35'),_0x58af8b,_0x1c2124[_0x15b2('0x31')]));emitChannelQueueInteraction(_0x494bb0[_0x15b2('0x29')],_0x1c2124[_0x15b2('0x31')],_0x494bb0[_0x15b2('0x23')],_0x494bb0['account'][_0x15b2('0x31')],_0x494bb0[_0x15b2('0x2c')]['id'],![],_0x4e73ab,_0x1c2124['id']);return rpc[_0x494bb0['channel']+_0x15b2('0x36')][_0x15b2('0x37')](_0x494bb0[_0x15b2('0x2b')]['id'],{'queueId':_0x1c2124['id']})['then'](function(){if(rpc[_0x494bb0['channel']+_0x15b2('0x32')]){return rpc[_0x494bb0[_0x15b2('0x29')]+_0x15b2('0x32')][_0x15b2('0x37')](_0x58af8b,_0x4c8e28)[_0x15b2('0x38')](function(_0x3d4023){logger['error'](_0x15b2('0x39'),_0x3d4023);});}});}}function endRouting(_0x1ff0fc,_0x40022d,_0x28c24e,_0x1efe1d){if(_0x1ff0fc&&_0x40022d){_0x40022d[_0x15b2('0x22')]-=0x1;var _0x8c0dd3={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x15b2('0xf')](_0x15b2('0x24')),'reason':_0x15b2('0x3a')};logger[_0x15b2('0x2f')](util[_0x15b2('0xf')](_0x15b2('0x3b'),_0x1ff0fc,_0x40022d[_0x15b2('0x31')]));emitChannelQueueInteraction(_0x28c24e[_0x15b2('0x29')],_0x40022d[_0x15b2('0x31')],_0x28c24e[_0x15b2('0x23')],_0x28c24e[_0x15b2('0x9')]['name'],_0x28c24e[_0x15b2('0x2c')]['id'],![],_0x1efe1d);if(rpc[_0x28c24e['channel']+_0x15b2('0x32')]){return rpc[_0x28c24e[_0x15b2('0x29')]+_0x15b2('0x32')][_0x15b2('0x37')](_0x1ff0fc,_0x8c0dd3)[_0x15b2('0x38')](function(_0x1e2cab){logger[_0x15b2('0x33')](_0x15b2('0x39'),_0x1e2cab);});}}}function handleFindQueue(_0x2f30be){return function(_0x10a605){return _0x10a605[_0x15b2('0x31')]['toLowerCase']()===_0x2f30be[_0x15b2('0x3c')]();};}exports[_0x15b2('0x3d')]=function(_0xbf86f5,_0x14449f,_0x520849,_0x3416e6){return function(_0x501d4c){try{var _0x4139d6={'name':_0x14449f[0x0],'timeout':_0x14449f[0x1]};var _0x27d146=queue[_0x15b2('0x0')](_0x4139d6,{'typecast':!![]});if(_0x27d146[_0x15b2('0x3e')]){logger[_0x15b2('0x33')](_0x15b2('0x3f'),_0xbf86f5,_[_0x15b2('0x40')](_0x27d146,'message')[_0x15b2('0x41')](',\x20'));_0x501d4c['stop']();}else{var _0x75bc35=_[_0x15b2('0x42')](_0x520849[_0x3416e6['channel']+_0x15b2('0x43')],handleFindQueue(_0x4139d6['name']));if(_0x75bc35){startRouting(_0xbf86f5,_0x75bc35,_0x3416e6,_0x520849);var _0x3ec0c2=(_0x75bc35[_0x15b2('0x3a')]||0xa)*0x3e8;var _0x2159c4=(_0x4139d6[_0x15b2('0x3a')]||0x14)*0x3e8;var _0x408889;if(_0x3ec0c2>_0x2159c4){_0x2159c4=_0x3ec0c2;}var _0x7ccf58=seqqueue['createQueue'](_0x3ec0c2);_0x7ccf58['id']=_0xbf86f5;_0x7ccf58[_0x15b2('0x44')]=_0x3ec0c2;_0x7ccf58['qtimeout']=_0x2159c4;_0x7ccf58[_0x15b2('0x29')]=_0x3416e6[_0x15b2('0x29')];_0x520849['rules'][_0xbf86f5]['on']('end',function(){logger[_0x15b2('0x2f')](_0x15b2('0x45'),_0xbf86f5);stopRouting(_0xbf86f5,_0x75bc35,_0x3416e6,_0x520849);clearTimeout(_0x408889);_0x408889=undefined;_0x7ccf58['close'](!![]);if(_0x520849['rules'][_0xbf86f5]){delete _0x520849[_0x15b2('0x46')][_0xbf86f5];}_0x501d4c[_0x15b2('0x47')]();});_0x520849[_0x15b2('0x46')][_0xbf86f5]['on'](_0x15b2('0x48'),function(){if(_0x520849['rules'][_0xbf86f5]){delete _0x520849[_0x15b2('0x46')][_0xbf86f5];}});_0x408889=setTimeout(function(){logger[_0x15b2('0x2f')](_0x15b2('0x49'),_0xbf86f5);endRouting(_0xbf86f5,_0x75bc35,_0x3416e6,_0x520849);clearTimeout(_0x408889);_0x7ccf58[_0x15b2('0x4a')](!![]);_0x501d4c[_0x15b2('0x4b')]();},_0x2159c4);switch(_0x75bc35[_0x15b2('0x4c')]){case _0x15b2('0x4d'):strategy[_0x15b2('0x4d')](_0x7ccf58,_0x75bc35,_0x520849,_0x3416e6);break;default:strategy['beepall'](_0x7ccf58,_0x75bc35,_0x520849,_0x3416e6);}}else{logger['error'](_0x15b2('0x4e'),_0xbf86f5,_0x4139d6[_0x15b2('0x31')]);_0x501d4c[_0x15b2('0x47')]();}}}catch(_0x236d01){logger[_0x15b2('0x33')]('[%s][QUEUE]\x20%s',_0xbf86f5,_0x236d01['stack']);_0x501d4c[_0x15b2('0x47')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 1ede7a4..b497aa1 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 _0xcb66=['prototype','[%s][AGENT]\x20try\x20with\x20%s','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','realtime','agents','busy','busyQueue','saveWaitingNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','hideNotification','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained'];(function(_0xf54ae,_0x2ac5e5){var _0x2bfa78=function(_0x3b51d9){while(--_0x3b51d9){_0xf54ae['push'](_0xf54ae['shift']());}};_0x2bfa78(++_0x2ac5e5);}(_0xcb66,0x19f));var _0x6cb6=function(_0x2d9e27,_0x5965b2){_0x2d9e27=_0x2d9e27-0x0;var _0xd35381=_0xcb66[_0x2d9e27];return _0xd35381;};'use strict';var _=require('lodash');var uuid=require(_0x6cb6('0x0'));var util=require(_0x6cb6('0x1'));var logger=require(_0x6cb6('0x2'))(_0x6cb6('0x3'));var Agent=function(_0x205243,_0x56618a,_0xe996ed,_0x2d7dbb){this[_0x6cb6('0x4')]=uuid['v4']();this[_0x6cb6('0x5')]=_0x205243;this[_0x6cb6('0x6')]=_0x56618a;this['realtime']=_0xe996ed;this['routing']=_0x2d7dbb;this[_0x6cb6('0x5')][_0x6cb6('0x7')](this[_0x6cb6('0x8')][_0x6cb6('0x9')](this),this[_0x6cb6('0xa')][_0x6cb6('0x9')](this));this[_0x6cb6('0x5')]['on'](_0x6cb6('0xb'),this[_0x6cb6('0xa')][_0x6cb6('0x9')](this));this[_0x6cb6('0x5')]['on'](_0x6cb6('0xc'),this[_0x6cb6('0xd')]['bind'](this));};Agent['prototype']['push']=function(){this['squeue'][_0x6cb6('0x7')](this[_0x6cb6('0x8')][_0x6cb6('0x9')](this),this[_0x6cb6('0xa')]['bind'](this));};Agent[_0x6cb6('0xe')][_0x6cb6('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0x6cb6('0xe')][_0x6cb6('0x8')]=function(){logger['debug'](_0x6cb6('0xf'),this[_0x6cb6('0x5')]['id'],this['agent']['id']);if(_['isNil'](this['realtime']['agents'][this[_0x6cb6('0x6')]['id']])){logger[_0x6cb6('0x10')](_0x6cb6('0x11'),this[_0x6cb6('0x5')]['id'],this[_0x6cb6('0x6')]['id']);setTimeout(this[_0x6cb6('0x7')]['bind'](this),0x3e8);}else{if(this[_0x6cb6('0x3')][_0x6cb6('0x12')]||util['isAgentAvailable'](this['squeue']['id'],this['realtime']['agents'][this['agent']['id']],this['squeue'][_0x6cb6('0x13')],![])){this[_0x6cb6('0x14')][_0x6cb6('0x15')][this[_0x6cb6('0x6')]['id']][_0x6cb6('0x16')]=!![];this['realtime']['agents'][this[_0x6cb6('0x6')]['id']][_0x6cb6('0x17')]=undefined;util[_0x6cb6('0x18')](this[_0x6cb6('0x14')],this['routing'],this[_0x6cb6('0x6')],this[_0x6cb6('0x5')]['channel']);util['showNotification'](this[_0x6cb6('0x4')],this['squeue']['id'],this[_0x6cb6('0x14')][_0x6cb6('0x15')][this[_0x6cb6('0x6')]['id']],null,this[_0x6cb6('0x3')]);util[_0x6cb6('0x19')](this[_0x6cb6('0x5')]['id'],this[_0x6cb6('0x14')][_0x6cb6('0x15')][this[_0x6cb6('0x6')]['id']],_0x6cb6('0x1a')+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger[_0x6cb6('0x10')](_0x6cb6('0x1b'),this[_0x6cb6('0x5')]['id'],this[_0x6cb6('0x6')]['id']);setTimeout(this[_0x6cb6('0x7')][_0x6cb6('0x9')](this),0x3e8);}}};Agent['prototype'][_0x6cb6('0xa')]=function(_0x4d4ad9){if(_[_0x6cb6('0x1c')](this['realtime'][_0x6cb6('0x15')][this[_0x6cb6('0x6')]['id']])){return logger[_0x6cb6('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x6cb6('0x5')]['id'],this[_0x6cb6('0x6')]['id']);}else{logger[_0x6cb6('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x6cb6('0x5')]['id'],this[_0x6cb6('0x6')]['id']);util[_0x6cb6('0x1d')](this['notificationId'],this[_0x6cb6('0x5')]['id'],this[_0x6cb6('0x14')]['agents'][this[_0x6cb6('0x6')]['id']],null,this[_0x6cb6('0x3')]);this[_0x6cb6('0x14')][_0x6cb6('0x15')][this[_0x6cb6('0x6')]['id']][_0x6cb6('0x16')]=![];this[_0x6cb6('0x14')][_0x6cb6('0x15')][this[_0x6cb6('0x6')]['id']][_0x6cb6('0x17')]=undefined;util['removeWaitingNotification'](this[_0x6cb6('0x14')],this[_0x6cb6('0x3')],this[_0x6cb6('0x6')],this[_0x6cb6('0x5')]['channel']);util['writeLog'](this['squeue']['id'],this[_0x6cb6('0x14')][_0x6cb6('0x15')][this[_0x6cb6('0x6')]['id']],_0x4d4ad9?_0x6cb6('0x1e'):_0x6cb6('0x1f'));}if(!_0x4d4ad9){setTimeout(this[_0x6cb6('0x7')][_0x6cb6('0x9')](this),0x3e8);}};function agent(_0x950248,_0x4bbecb,_0x44d970,_0x559b1d){return new Agent(_0x950248,_0x4bbecb,_0x44d970,_0x559b1d);}module[_0x6cb6('0x20')]=agent; \ No newline at end of file +var _0x9b67=['drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','busy','busyQueue','channel','showNotification',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','notificationId','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','handleRun','handleTimeout','bind','timeout'];(function(_0x33f95c,_0x4b2e80){var _0x581952=function(_0x37ea19){while(--_0x37ea19){_0x33f95c['push'](_0x33f95c['shift']());}};_0x581952(++_0x4b2e80);}(_0x9b67,0xf6));var _0x79b6=function(_0x360239,_0x457ade){_0x360239=_0x360239-0x0;var _0xdfc8d9=_0x9b67[_0x360239];return _0xdfc8d9;};'use strict';var _=require(_0x79b6('0x0'));var uuid=require(_0x79b6('0x1'));var util=require(_0x79b6('0x2'));var logger=require(_0x79b6('0x3'))(_0x79b6('0x4'));var Agent=function(_0x5523a1,_0x3ba25a,_0x1aeb24,_0x5297d0){this['notificationId']=uuid['v4']();this[_0x79b6('0x5')]=_0x5523a1;this[_0x79b6('0x6')]=_0x3ba25a;this[_0x79b6('0x7')]=_0x1aeb24;this[_0x79b6('0x4')]=_0x5297d0;this[_0x79b6('0x5')][_0x79b6('0x8')](this[_0x79b6('0x9')]['bind'](this),this[_0x79b6('0xa')][_0x79b6('0xb')](this));this[_0x79b6('0x5')]['on'](_0x79b6('0xc'),this[_0x79b6('0xa')]['bind'](this));this[_0x79b6('0x5')]['on'](_0x79b6('0xd'),this[_0x79b6('0xe')][_0x79b6('0xb')](this));};Agent['prototype']['push']=function(){this[_0x79b6('0x5')][_0x79b6('0x8')](this[_0x79b6('0x9')]['bind'](this),this[_0x79b6('0xa')][_0x79b6('0xb')](this));};Agent[_0x79b6('0xf')][_0x79b6('0xe')]=function(){this[_0x79b6('0xa')](!![]);};Agent[_0x79b6('0xf')][_0x79b6('0x9')]=function(){logger[_0x79b6('0x10')](_0x79b6('0x11'),this[_0x79b6('0x5')]['id'],this[_0x79b6('0x6')]['id']);if(_[_0x79b6('0x12')](this[_0x79b6('0x7')]['agents'][this[_0x79b6('0x6')]['id']])){logger[_0x79b6('0x10')](_0x79b6('0x13'),this[_0x79b6('0x5')]['id'],this[_0x79b6('0x6')]['id']);setTimeout(this[_0x79b6('0x8')][_0x79b6('0xb')](this),0x3e8);}else{if(this[_0x79b6('0x4')][_0x79b6('0x14')]||util[_0x79b6('0x15')](this[_0x79b6('0x5')]['id'],this[_0x79b6('0x7')][_0x79b6('0x16')][this['agent']['id']],this[_0x79b6('0x5')]['channel'],![])){this[_0x79b6('0x7')]['agents'][this[_0x79b6('0x6')]['id']][_0x79b6('0x17')]=!![];this[_0x79b6('0x7')]['agents'][this[_0x79b6('0x6')]['id']][_0x79b6('0x18')]=undefined;util['saveWaitingNotification'](this['realtime'],this[_0x79b6('0x4')],this[_0x79b6('0x6')],this[_0x79b6('0x5')][_0x79b6('0x19')]);util[_0x79b6('0x1a')](this['notificationId'],this[_0x79b6('0x5')]['id'],this[_0x79b6('0x7')][_0x79b6('0x16')][this[_0x79b6('0x6')]['id']],null,this['routing']);util['writeLog'](this[_0x79b6('0x5')]['id'],this[_0x79b6('0x7')][_0x79b6('0x16')][this[_0x79b6('0x6')]['id']],'RINGING'+(this[_0x79b6('0x4')]['forcedOwnership']?_0x79b6('0x1b'):''));}else{logger[_0x79b6('0x10')](_0x79b6('0x1c'),this[_0x79b6('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x79b6('0x8')][_0x79b6('0xb')](this),0x3e8);}}};Agent['prototype'][_0x79b6('0xa')]=function(_0x2d219c){if(_[_0x79b6('0x12')](this[_0x79b6('0x7')][_0x79b6('0x16')][this[_0x79b6('0x6')]['id']])){return logger['debug'](_0x79b6('0x13'),this[_0x79b6('0x5')]['id'],this[_0x79b6('0x6')]['id']);}else{logger[_0x79b6('0x10')](_0x79b6('0x1d'),this[_0x79b6('0x5')]['id'],this['agent']['id']);util[_0x79b6('0x1e')](this[_0x79b6('0x1f')],this[_0x79b6('0x5')]['id'],this['realtime']['agents'][this[_0x79b6('0x6')]['id']],null,this[_0x79b6('0x4')]);this[_0x79b6('0x7')][_0x79b6('0x16')][this[_0x79b6('0x6')]['id']][_0x79b6('0x17')]=![];this['realtime']['agents'][this[_0x79b6('0x6')]['id']]['busyQueue']=undefined;util[_0x79b6('0x20')](this['realtime'],this[_0x79b6('0x4')],this[_0x79b6('0x6')],this['squeue'][_0x79b6('0x19')]);util[_0x79b6('0x21')](this['squeue']['id'],this[_0x79b6('0x7')]['agents'][this[_0x79b6('0x6')]['id']],_0x2d219c?_0x79b6('0x22'):_0x79b6('0x23'));}if(!_0x2d219c){setTimeout(this[_0x79b6('0x8')][_0x79b6('0xb')](this),0x3e8);}};function agent(_0x732849,_0x4189f2,_0x276eb5,_0x1ba43c){return new Agent(_0x732849,_0x4189f2,_0x276eb5,_0x1ba43c);}module[_0x79b6('0x24')]=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 d6798a7..068af43 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 _0x0426=['handleDrained','isNil','Agents','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','saveWaitingNotification','showNotification','[%s][QUEUE]\x20EMPTY','length','writeLog','TIMEOUT','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','queue','realtime','handleRun','bind','squeue','handleTimeout','drained','prototype','push'];(function(_0x10413d,_0x39ceb2){var _0x26c937=function(_0x3fb540){while(--_0x3fb540){_0x10413d['push'](_0x10413d['shift']());}};_0x26c937(++_0x39ceb2);}(_0x0426,0x1ef));var _0x6042=function(_0x58d38e,_0x5150f4){_0x58d38e=_0x58d38e-0x0;var _0x23680e=_0x0426[_0x58d38e];return _0x23680e;};'use strict';var _=require(_0x6042('0x0'));var uuid=require(_0x6042('0x1'));var util=require(_0x6042('0x2'));var logger=require(_0x6042('0x3'))(_0x6042('0x4'));var Beepall=function(_0x1f6cf4,_0x604db7,_0x1c4a37,_0x4787a4){this[_0x6042('0x5')]=uuid['v4']();this['squeue']=_0x1f6cf4;this[_0x6042('0x6')]=_0x604db7;this[_0x6042('0x7')]=_0x1c4a37;this[_0x6042('0x4')]=_0x4787a4;this['squeue']['push'](this[_0x6042('0x8')]['bind'](this),this['handleTimeout'][_0x6042('0x9')](this));this[_0x6042('0xa')]['on']('timeout',this[_0x6042('0xb')][_0x6042('0x9')](this));this[_0x6042('0xa')]['on'](_0x6042('0xc'),this['handleDrained'][_0x6042('0x9')](this));};Beepall[_0x6042('0xd')][_0x6042('0xe')]=function(){this['squeue'][_0x6042('0xe')](this[_0x6042('0x8')]['bind'](this),this[_0x6042('0xb')][_0x6042('0x9')](this));};Beepall['prototype'][_0x6042('0xf')]=function(){this[_0x6042('0xb')](!![]);};Beepall[_0x6042('0xd')][_0x6042('0x8')]=function(){var _0xd00949=!![];if(!_['isNil'](this[_0x6042('0x6')])&&!_[_0x6042('0x10')](this['queue'][_0x6042('0x11')])&&this[_0x6042('0x6')][_0x6042('0x11')]['length']>0x0){for(var _0x119c76=0x0,_0x35a985;_0x119c760x0){for(var _0x58560e=0x0,_0x109a87;_0x58560e0x0&&_0x54790f[_0x3781f3+_0x0d07('0x21')]>=_0x54790f[_0x3781f3+'Capacity']){writeLog(_0x41c131,_0x54790f,_0x3781f3['toUpperCase']()+_0x0d07('0x23'));return![];}}return!![];};exports['showNotification']=function(_0x43c7ac,_0x45bdfe,_0x4d7c0f,_0x44a14c,_0x509fb9){return sendNotification(!![],_0x43c7ac,_0x45bdfe,_0x4d7c0f,_0x44a14c,_0x509fb9);};exports['hideNotification']=function(_0x5da34f,_0x238bee,_0x3f09c7,_0x423b3a,_0x25633b){return sendNotification(![],_0x5da34f,_0x238bee,_0x3f09c7,_0x423b3a,_0x25633b);};exports[_0x0d07('0x24')]=function(_0x3fdfa9,_0x116f6e,_0x127552){var _0x4c68d7=_0x116f6e['interaction'][_0x0d07('0x25')];if(!_0x4c68d7&&_0x127552){_0x4c68d7=_0x127552['id'];}var _0x414600=_[_0x0d07('0x26')](_0x3fdfa9[_0x116f6e[_0x0d07('0x27')]+_0x0d07('0x28')],function(_0xb7d4d){var _0xf8b3fd=_[_0x0d07('0x29')](_0x116f6e[_0x0d07('0x27')])+_0x0d07('0x2a');return _0xb7d4d[_0xf8b3fd]===_0x116f6e[_0x0d07('0x2b')]['id'];});if(!_0x414600&&_0x4c68d7&&_0x3fdfa9[_0x0d07('0x2c')][_0x4c68d7]){_0x414600=_[_0x0d07('0x26')](_0x3fdfa9[_0x0d07('0x2c')][_0x4c68d7][_0x116f6e[_0x0d07('0x27')]+_0x0d07('0x2d')],function(_0x1a180d){return _0x1a180d['id']===_0x116f6e[_0x0d07('0x2b')]['id'];});}return _0x414600;};exports['saveWaitingNotification']=function(_0x578182,_0x5bcd75,_0x3040fb,_0x4454a5){if(_0x3040fb&&_0x3040fb['id']&&_0x578182['agents']&&_0x578182[_0x0d07('0x2c')][_0x3040fb['id']]){_0x578182[_0x0d07('0x2c')][_0x3040fb['id']][_0x4454a5+_0x0d07('0x2d')][_0x5bcd75[_0x0d07('0x16')]['id']]={'id':_0x5bcd75['interaction']['id']};}};exports[_0x0d07('0x2e')]=function(_0x577273,_0x4481a6,_0x501da3,_0x4ec5b0){if(_0x501da3&&_0x501da3['id']&&_0x577273[_0x0d07('0x2c')]&&_0x577273['agents'][_0x501da3['id']]){delete _0x577273['agents'][_0x501da3['id']][_0x4ec5b0+_0x0d07('0x2d')][_0x4481a6[_0x0d07('0x16')]['id']];}};exports[_0x0d07('0x2f')]=writeLog; \ No newline at end of file +var _0xd7ac=['format','[%s][QUEUE]\x20%s','message','user:%s','emit','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','checkWaitingNotifications','interaction','UserId','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','lodash','ioredis','../../../../../config/environment','routing','redis','localhost','socket.io-emitter','\x20interaction','name','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','error'];(function(_0x8e8ca7,_0x5a5e07){var _0x561381=function(_0x2f4bda){while(--_0x2f4bda){_0x8e8ca7['push'](_0x8e8ca7['shift']());}};_0x561381(++_0x5a5e07);}(_0xd7ac,0x167));var _0xcd7a=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xd7ac[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0xcd7a('0x0'));var util=require('util');var utils=require('../utils');var Redis=require(_0xcd7a('0x1'));var config=require(_0xcd7a('0x2'));var logger=require('../../../../../config/logger')(_0xcd7a('0x3'));config[_0xcd7a('0x4')]=_['defaults'](config['redis'],{'host':_0xcd7a('0x5'),'port':0x18eb});var io=require(_0xcd7a('0x6'))(new Redis(config[_0xcd7a('0x4')]));function sendNotification(_0x4c3dc2,_0x10fbe7,_0x9c3b8e,_0xb20f32,_0x39b785,_0x545cd5){var _0x104bb6=_0x545cd5||{};var _0x4326ae=_0x9c3b8e['split']('.');var _0x1853ab={'uniqueid':_0x10fbe7,'channel':_0x4326ae[0x0],'id':_0x4326ae[0x1],'title':_0x4326ae[0x0]+_0xcd7a('0x7'),'interactionId':_0x4326ae[0x2],'queue':_0x39b785?_0x39b785[_0xcd7a('0x8')]:null,'sound':_0x104bb6[_0xcd7a('0x9')][_0xcd7a('0xa')],'shake':_0x104bb6[_0xcd7a('0x9')]['notificationShake']};try{if(!_0x104bb6[_0xcd7a('0xb')]){_0x104bb6[_0xcd7a('0xb')]={};}if(_0x39b785){_0x104bb6['body'][_0xcd7a('0xc')]=_0x39b785;}else if(_0x104bb6[_0xcd7a('0xb')]['queue']){delete _0x104bb6[_0xcd7a('0xb')]['queue'];}_0x1853ab[_0xcd7a('0xd')]=utils[_0xcd7a('0xe')](_0x104bb6[_0xcd7a('0x9')][_0xcd7a('0xf')],_0x104bb6);}catch(_0x401e7c){_0x1853ab[_0xcd7a('0xd')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0xcd7a('0x10')](util[_0xcd7a('0x11')](_0xcd7a('0x12'),_0x10fbe7,_0x401e7c[_0xcd7a('0x13')]));}io['to'](util['format'](_0xcd7a('0x14'),_0xb20f32[_0xcd7a('0x8')]))[_0xcd7a('0x15')](util['format']('notification:%s',_0x4c3dc2?_0xcd7a('0x16'):_0xcd7a('0x17')),_0x1853ab);}function writeLog(_0x195afd,_0x3eb22e,_0x2d7191){return logger[_0xcd7a('0x18')](util[_0xcd7a('0x11')](_0xcd7a('0x19'),_0x195afd,_0x3eb22e[_0xcd7a('0x8')],_0x2d7191));}exports['isAgentAvailable']=function(_0x255760,_0x2c6413,_0x3075d4,_0x45f229){if(_0x2c6413[_0xcd7a('0x1a')]){writeLog(_0x255760,_0x2c6413,_0xcd7a('0x1b'));return![];}if(!_0x2c6413['online']){writeLog(_0x255760,_0x2c6413,'OFFLINE');return![];}if(_0x2c6413[_0x3075d4+_0xcd7a('0x1c')]){writeLog(_0x255760,_0x2c6413,_0xcd7a('0x1d'));return![];}if(_0x45f229&&_0x2c6413[_0xcd7a('0x1e')](_0x3075d4+_0xcd7a('0x1f'))&&_0x2c6413[_0xcd7a('0x1e')](_0x3075d4+'CurrentCapacity')){if(_0x2c6413[_0x3075d4+'Capacity']>0x0&&_0x2c6413[_0x3075d4+_0xcd7a('0x20')]>=_0x2c6413[_0x3075d4+'Capacity']){writeLog(_0x255760,_0x2c6413,_0x3075d4['toUpperCase']()+_0xcd7a('0x21'));return![];}}return!![];};exports[_0xcd7a('0x22')]=function(_0x5b9192,_0x8f2f3b,_0x28c65e,_0x176c38,_0x460933){return sendNotification(!![],_0x5b9192,_0x8f2f3b,_0x28c65e,_0x176c38,_0x460933);};exports['hideNotification']=function(_0x19e28a,_0x160576,_0x18cbfd,_0x59ff92,_0x32a4ba){return sendNotification(![],_0x19e28a,_0x160576,_0x18cbfd,_0x59ff92,_0x32a4ba);};exports[_0xcd7a('0x23')]=function(_0x15ba61,_0x29e5ef,_0x4ae55c){var _0x596316=_0x29e5ef[_0xcd7a('0x24')][_0xcd7a('0x25')];if(!_0x596316&&_0x4ae55c){_0x596316=_0x4ae55c['id'];}var _0x589a5b=_[_0xcd7a('0x26')](_0x15ba61[_0x29e5ef[_0xcd7a('0x27')]+_0xcd7a('0x28')],function(_0x27d207){var _0x487758=_[_0xcd7a('0x29')](_0x29e5ef[_0xcd7a('0x27')])+_0xcd7a('0x2a');return _0x27d207[_0x487758]===_0x29e5ef[_0xcd7a('0x24')]['id'];});if(!_0x589a5b&&_0x596316&&_0x15ba61[_0xcd7a('0x2b')][_0x596316]){_0x589a5b=_[_0xcd7a('0x26')](_0x15ba61['agents'][_0x596316][_0x29e5ef['channel']+_0xcd7a('0x2c')],function(_0x18a85e){return _0x18a85e['id']===_0x29e5ef['interaction']['id'];});}return _0x589a5b;};exports[_0xcd7a('0x2d')]=function(_0xfaf391,_0x1b80d5,_0xe821f9,_0x53cc92){if(_0xe821f9&&_0xe821f9['id']&&_0xfaf391[_0xcd7a('0x2b')]&&_0xfaf391[_0xcd7a('0x2b')][_0xe821f9['id']]){_0xfaf391[_0xcd7a('0x2b')][_0xe821f9['id']][_0x53cc92+_0xcd7a('0x2c')][_0x1b80d5['message']['id']]={'id':_0x1b80d5[_0xcd7a('0x24')]['id']};}};exports[_0xcd7a('0x2e')]=function(_0x5ebd77,_0x2f4ceb,_0x6af0ce,_0xf8c95b){if(_0x6af0ce&&_0x6af0ce['id']&&_0x5ebd77[_0xcd7a('0x2b')]&&_0x5ebd77[_0xcd7a('0x2b')][_0x6af0ce['id']]){delete _0x5ebd77[_0xcd7a('0x2b')][_0x6af0ce['id']][_0xf8c95b+_0xcd7a('0x2c')][_0x2f4ceb[_0xcd7a('0x13')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index c2fcd06..7749435 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 _0x0d8d=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','consequence','length','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim'];(function(_0x1313dd,_0x5b9ba8){var _0x30f567=function(_0x425726){while(--_0x425726){_0x1313dd['push'](_0x1313dd['shift']());}};_0x30f567(++_0x5b9ba8);}(_0x0d8d,0x1f4));var _0xd0d8=function(_0x37144c,_0x5eebb0){_0x37144c=_0x37144c-0x0;var _0x3b0c23=_0x0d8d[_0x37144c];return _0x3b0c23;};'use strict';var schema=require(_0xd0d8('0x0'));var sh=require(_0xd0d8('0x1'));var _=require(_0xd0d8('0x2'));var utils=require(_0xd0d8('0x3'));var logger=require(_0xd0d8('0x4'))(_0xd0d8('0x5'));var system=schema({'command':{'type':_0xd0d8('0x6'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xd0d8('0x7')]=function(_0x2a6964,_0x4b8dda){return function(_0x1e081b){try{var _0x487615={'command':_0x4b8dda[0x0]};var _0x5ef903=system['validate'](_0x487615,{'typecast':!![]});if(_0x5ef903[_0xd0d8('0x8')]){logger[_0xd0d8('0x9')](_0xd0d8('0xa'),_0x2a6964,_[_0xd0d8('0xb')](_0x5ef903,'message')[_0xd0d8('0xc')](',\x20'));logger[_0xd0d8('0xd')](_0xd0d8('0xe'),_0x2a6964);_0x1e081b[_0xd0d8('0xf')]();}else{var _0xd2324e=this;var _0x3efde9=utils[_0xd0d8('0x10')](_0x4b8dda[0x0],this);logger['info'](_0xd0d8('0x11'),_0x2a6964,_0x3efde9);sh[_0xd0d8('0x12')](_[_0xd0d8('0x13')](_0x3efde9),function(_0xfa04ab,_0x47fa02){logger[_0xd0d8('0xd')](_0xd0d8('0x14'),_0x2a6964,_0xfa04ab);if(_0xfa04ab==0x0){var _0x3451ed=_0x47fa02[_0xd0d8('0x15')](/(\r\n|\n|\r)/gm,'');if(_[_0xd0d8('0x16')](_0x4b8dda[0x1])||_['isEmpty'](_0x4b8dda[0x1])){logger[_0xd0d8('0xd')](_0xd0d8('0x17'),_0x2a6964);_0xd2324e['body'][_0x4b8dda[0x1]]=_0x3451ed;}else{logger['info'](_0xd0d8('0x18'),_0x2a6964,_0x4b8dda[0x1],_0x3451ed);_0xd2324e[_0xd0d8('0x19')][_0x4b8dda[0x1]]=_0x3451ed;}}_0x1e081b[_0xd0d8('0xf')]();});}}catch(_0x3d05a6){logger[_0xd0d8('0x9')]('[%s][SYSTEM]\x20%s',_0x2a6964,_['isObject'](_0x3d05a6)?JSON['stringify'](_0x3d05a6):_0x3d05a6);logger['info'](_0xd0d8('0xe'),_0x2a6964);_0x1e081b['next']();}};}; \ No newline at end of file +var _0x18c9=['./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject','validate','shelljs','lodash'];(function(_0x3c5595,_0x1d1d57){var _0x2d5eb5=function(_0x4b3d9a){while(--_0x4b3d9a){_0x3c5595['push'](_0x3c5595['shift']());}};_0x2d5eb5(++_0x1d1d57);}(_0x18c9,0x1bf));var _0x918c=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x18c9[_0x3e3bee];return _0x3ae14c;};'use strict';var schema=require(_0x918c('0x0'));var sh=require(_0x918c('0x1'));var _=require(_0x918c('0x2'));var utils=require(_0x918c('0x3'));var logger=require(_0x918c('0x4'))(_0x918c('0x5'));var system=schema({'command':{'type':_0x918c('0x6'),'required':!![],'message':_0x918c('0x7')}});exports[_0x918c('0x8')]=function(_0xb3954d,_0x22d62b){return function(_0x5f5aab){try{var _0x5ce772={'command':_0x22d62b[0x0]};var _0x21e279=system[_0x918c('0x0')](_0x5ce772,{'typecast':!![]});if(_0x21e279[_0x918c('0x9')]){logger[_0x918c('0xa')]('[%s][SYSTEM]\x20%s',_0xb3954d,_['map'](_0x21e279,_0x918c('0xb'))[_0x918c('0xc')](',\x20'));logger[_0x918c('0xd')](_0x918c('0xe'),_0xb3954d);_0x5f5aab[_0x918c('0xf')]();}else{var _0x1b790a=this;var _0x149f90=utils['getMustacheRender'](_0x22d62b[0x0],this);logger[_0x918c('0xd')](_0x918c('0x10'),_0xb3954d,_0x149f90);sh['exec'](_[_0x918c('0x11')](_0x149f90),function(_0x4157a7,_0x4b2cf3){logger['info'](_0x918c('0x12'),_0xb3954d,_0x4157a7);if(_0x4157a7==0x0){var _0x10e464=_0x4b2cf3['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x22d62b[0x1])||_[_0x918c('0x13')](_0x22d62b[0x1])){logger[_0x918c('0xd')](_0x918c('0x14'),_0xb3954d);_0x1b790a[_0x918c('0x15')][_0x22d62b[0x1]]=_0x10e464;}else{logger[_0x918c('0xd')](_0x918c('0x16'),_0xb3954d,_0x22d62b[0x1],_0x10e464);_0x1b790a[_0x918c('0x15')][_0x22d62b[0x1]]=_0x10e464;}}_0x5f5aab[_0x918c('0xf')]();});}}catch(_0xf3ba29){logger['error'](_0x918c('0x17'),_0xb3954d,_[_0x918c('0x18')](_0xf3ba29)?JSON['stringify'](_0xf3ba29):_0xf3ba29);logger[_0x918c('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0xb3954d);_0x5f5aab[_0x918c('0xf')]();}};}; \ 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 149be85..8ba66f0 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 _0x2e42=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','join','next','Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','info','finally','isObject','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing'];(function(_0x3efb47,_0x19eb45){var _0x5e61a2=function(_0x325567){while(--_0x325567){_0x3efb47['push'](_0x3efb47['shift']());}};_0x5e61a2(++_0x19eb45);}(_0x2e42,0x12d));var _0x22e4=function(_0x14a513,_0x3239f){_0x14a513=_0x14a513-0x0;var _0x47236c=_0x2e42[_0x14a513];return _0x47236c;};'use strict';var schema=require(_0x22e4('0x0'));var _=require(_0x22e4('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x22e4('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x22e4('0x3')),'whatsappInteraction':require(_0x22e4('0x4'))};var logger=require(_0x22e4('0x5'))(_0x22e4('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x22e4('0x7')}});exports[_0x22e4('0x8')]=function(_0x78f7d6,_0x38ba5e,_0x42da2d,_0x2f337e){return function(_0x3b87a0){try{var _0x38eb4b={'tag':_0x38ba5e[0x0]};var _0x27b83b=tag[_0x22e4('0x0')](_0x38eb4b,{'typecast':!![]});if(_0x27b83b[_0x22e4('0x9')]){logger['error'](_0x22e4('0xa'),_0x78f7d6,_[_0x22e4('0xb')](_0x27b83b,_0x22e4('0xc'))[_0x22e4('0xd')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x78f7d6);_0x3b87a0[_0x22e4('0xe')]();}else{var _0x38509e={'ids':[_0x38ba5e[0x0]]};if(rpc[_0x2f337e['channel']+_0x22e4('0xf')]){rpc[_0x2f337e[_0x22e4('0x10')]+'Interaction'][_0x22e4('0x11')](_0x2f337e[_0x22e4('0x12')]['id'],_0x38509e)[_0x22e4('0x13')](function(_0x5b5f72){logger['info'](_0x22e4('0x14'),_0x78f7d6,_0x38ba5e[0x1],_0x2f337e[_0x22e4('0x10')],_0x2f337e[_0x22e4('0x12')]['id']);})[_0x22e4('0x15')](function(_0x19ce74){logger[_0x22e4('0x16')](_0x22e4('0xa'),_0x78f7d6,JSON['stringify'](_0x19ce74));logger[_0x22e4('0x17')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x78f7d6);})[_0x22e4('0x18')](function(){_0x3b87a0[_0x22e4('0xe')]();});}}}catch(_0x4bb8f6){logger[_0x22e4('0x16')](_0x22e4('0xa'),_0x78f7d6,_[_0x22e4('0x19')](_0x4bb8f6)?JSON[_0x22e4('0x1a')](_0x4bb8f6):_0x4bb8f6);logger[_0x22e4('0x17')](_0x22e4('0x1b'),_0x78f7d6);_0x3b87a0['next']();}};}; \ No newline at end of file +var _0xf3e4=['stringify','finally','next','validate','lodash','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','[%s][TAG]\x20%s'];(function(_0x222c26,_0xfd7d33){var _0x503fbc=function(_0x57ee9e){while(--_0x57ee9e){_0x222c26['push'](_0x222c26['shift']());}};_0x503fbc(++_0xfd7d33);}(_0xf3e4,0x11b));var _0x4f3e=function(_0x1decc0,_0xce8eaa){_0x1decc0=_0x1decc0-0x0;var _0x99a709=_0xf3e4[_0x1decc0];return _0x99a709;};'use strict';var schema=require(_0x4f3e('0x0'));var _=require(_0x4f3e('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x4f3e('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x4f3e('0x3')),'whatsappInteraction':require(_0x4f3e('0x4'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x4f3e('0x5')}});exports[_0x4f3e('0x6')]=function(_0x4cce54,_0x23cd6d,_0x191557,_0x25f9ff){return function(_0x343413){try{var _0x55b87a={'tag':_0x23cd6d[0x0]};var _0x39b2db=tag['validate'](_0x55b87a,{'typecast':!![]});if(_0x39b2db['length']){logger[_0x4f3e('0x7')]('[%s][TAG]\x20%s',_0x4cce54,_[_0x4f3e('0x8')](_0x39b2db,'message')['join'](',\x20'));logger[_0x4f3e('0x9')](_0x4f3e('0xa'),_0x4cce54);_0x343413['next']();}else{var _0x83498f={'ids':[_0x23cd6d[0x0]]};if(rpc[_0x25f9ff[_0x4f3e('0xb')]+_0x4f3e('0xc')]){rpc[_0x25f9ff[_0x4f3e('0xb')]+_0x4f3e('0xc')][_0x4f3e('0xd')](_0x25f9ff[_0x4f3e('0xe')]['id'],_0x83498f)['then'](function(_0x29d28a){logger[_0x4f3e('0x9')](_0x4f3e('0xf'),_0x4cce54,_0x23cd6d[0x1],_0x25f9ff[_0x4f3e('0xb')],_0x25f9ff[_0x4f3e('0xe')]['id']);})['catch'](function(_0x106497){logger[_0x4f3e('0x7')](_0x4f3e('0x10'),_0x4cce54,JSON[_0x4f3e('0x11')](_0x106497));logger[_0x4f3e('0x9')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4cce54);})[_0x4f3e('0x12')](function(){_0x343413[_0x4f3e('0x13')]();});}}}catch(_0x14395c){logger[_0x4f3e('0x7')]('[%s][TAG]\x20%s',_0x4cce54,_['isObject'](_0x14395c)?JSON[_0x4f3e('0x11')](_0x14395c):_0x14395c);logger[_0x4f3e('0x9')](_0x4f3e('0xa'),_0x4cce54);_0x343413[_0x4f3e('0x13')]();}};}; \ 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 0e67adc..a88a229 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 _0x9be3=['login','params','utf8','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','2.0','method'];(function(_0x25696c,_0x2f7b8f){var _0x55ede8=function(_0x3382e4){while(--_0x3382e4){_0x25696c['push'](_0x25696c['shift']());}};_0x55ede8(++_0x2f7b8f);}(_0x9be3,0xd1));var _0x39be=function(_0x3324a6,_0x5b9759){_0x3324a6=_0x3324a6-0x0;var _0x4e382a=_0x9be3[_0x3324a6];return _0x4e382a;};'use strict';var rp=require(_0x39be('0x0'));var logger=require(_0x39be('0x1'))(_0x39be('0x2'));var _=require(_0x39be('0x3'));var arr=[];exports[_0x39be('0x4')]=function(_0x122aff,_0x1bf2ff){return function(_0x390e0b){var _0x3141a1=_0x1bf2ff[0xa];var _0x5337ba=_0x1bf2ff[0xb];var _0xd806d2=_0x1bf2ff[0xc];var _0x12952b=_0x1bf2ff[0xd];var _0x2da170=_0x1bf2ff[0xe];var _0x191add=_0x1bf2ff[0xf][_0x39be('0x5')](/\n/g,_0x39be('0x6'));var _0x131aa6=_0x1bf2ff[0x10][_0x39be('0x5')](/\n/g,'\x20');if(!arr[_0x39be('0x7')](_0x5337ba)){arr[_0x39be('0x8')](_0x5337ba);var _0x2f7db7=_0x1bf2ff[0x3];var _0x5bac09=_0x1bf2ff[0x4];var _0x3639aa=_0x1bf2ff[0x1];var _0xf72b0e=_0x1bf2ff[0x0];var _0x1dbebb={};_0x1dbebb[_0x39be('0x9')]=_0x1bf2ff[0x8]+_0x39be('0xa')+_0xd806d2+'|'+_0x3141a1+'|'+_0x12952b+'|'+_0x5337ba+'|'+_0x2da170;_0x1dbebb[_0x39be('0xb')]=_0x1bf2ff[0x7]+'?params='+_0xd806d2+'|'+_0x3141a1+'|'+_0x12952b+'|'+_0x5337ba+'|'+_0x2da170+'|'+_0x191add+'|'+_0x131aa6;_0x1dbebb[_0x39be('0xc')]=_0x1bf2ff[0x9];var _0x22719d={};_0x22719d['jsonrpc']=_0x39be('0xd');_0x22719d[_0x39be('0xe')]=_0x39be('0xf');var _0x42a265=[];_0x42a265['push'](_0x1bf2ff[0x2]);_0x42a265['push'](_0x1bf2ff[0x5]);_0x42a265[_0x39be('0x8')](_0x1bf2ff[0x6]);_0x22719d[_0x39be('0x10')]=_0x42a265;_0x22719d['id']=0x1;var _0x37ba39=JSON['stringify'](_0x22719d);var _0x4a1421={'encoding':_0x39be('0x11'),'method':'POST','timeout':0x2710,'url':_0x2f7db7,'headers':{'Content-Type':'application/json-rpc'},'body':_0x37ba39};return rp(_0x4a1421)[_0x39be('0x12')](function(_0x54bf84){const _0x22f96e=JSON[_0x39be('0x13')](_0x54bf84);if(!_0x22f96e['result'][_0x39be('0x14')]){throw new Error(_0x39be('0x15'));}var _0x3d6680=_0x5337ba;var _0x1ddc11=_0x39be('0x16')+_0x3639aa+_0x39be('0x17')+_0xf72b0e+_0x39be('0x18')+_0x3d6680+'&data='+JSON[_0x39be('0x19')](_0x1dbebb);var _0x1f6c88=_0x5bac09+'?'+_0x1ddc11;return rp(_0x1f6c88);})['then'](function(_0x4b23e8){logger[_0x39be('0x1a')](_0x39be('0x1b'),_0x122aff,_0x4b23e8);_0x390e0b['stop']();})[_0x39be('0x1c')](function(_0x2e90a8){logger[_0x39be('0x1d')](_0x39be('0x1e'),_0x122aff,_['isObject'](_0x2e90a8)?JSON['stringify'](_0x2e90a8):_0x2e90a8);_0x390e0b['stop']();});}else{logger['info'](_0x39be('0x1f'),_0x122aff);_0x390e0b['next']();}};}; \ No newline at end of file +var _0x03d2=['replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','params','stringify','POST','application/json-rpc','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence'];(function(_0x22f5ea,_0x3a6a30){var _0xe5955=function(_0x139704){while(--_0x139704){_0x22f5ea['push'](_0x22f5ea['shift']());}};_0xe5955(++_0x3a6a30);}(_0x03d2,0x1f3));var _0x203d=function(_0x253c35,_0x2ec8ab){_0x253c35=_0x253c35-0x0;var _0xc7cb8b=_0x03d2[_0x253c35];return _0xc7cb8b;};'use strict';var rp=require(_0x203d('0x0'));var logger=require(_0x203d('0x1'))(_0x203d('0x2'));var _=require(_0x203d('0x3'));var arr=[];exports[_0x203d('0x4')]=function(_0x486f66,_0x767229){return function(_0x5d4c34){var _0x2d0caf=_0x767229[0xa];var _0x5d0938=_0x767229[0xb];var _0x2762ae=_0x767229[0xc];var _0x5825d2=_0x767229[0xd];var _0x11becb=_0x767229[0xe];var _0x5e4595=_0x767229[0xf][_0x203d('0x5')](/\n/g,_0x203d('0x6'));var _0x4a8909=_0x767229[0x10][_0x203d('0x5')](/\n/g,'\x20');if(!arr[_0x203d('0x7')](_0x5d0938)){arr[_0x203d('0x8')](_0x5d0938);var _0x778ec=_0x767229[0x3];var _0x3aad58=_0x767229[0x4];var _0x492ae9=_0x767229[0x1];var _0x4e9179=_0x767229[0x0];var _0x35bfc7={};_0x35bfc7[_0x203d('0x9')]=_0x767229[0x8]+_0x203d('0xa')+_0x2762ae+'|'+_0x2d0caf+'|'+_0x5825d2+'|'+_0x5d0938+'|'+_0x11becb;_0x35bfc7[_0x203d('0xb')]=_0x767229[0x7]+'?params='+_0x2762ae+'|'+_0x2d0caf+'|'+_0x5825d2+'|'+_0x5d0938+'|'+_0x11becb+'|'+_0x5e4595+'|'+_0x4a8909;_0x35bfc7[_0x203d('0xc')]=_0x767229[0x9];var _0x463232={};_0x463232[_0x203d('0xd')]=_0x203d('0xe');_0x463232[_0x203d('0xf')]=_0x203d('0x10');var _0xcc3a00=[];_0xcc3a00[_0x203d('0x8')](_0x767229[0x2]);_0xcc3a00['push'](_0x767229[0x5]);_0xcc3a00[_0x203d('0x8')](_0x767229[0x6]);_0x463232[_0x203d('0x11')]=_0xcc3a00;_0x463232['id']=0x1;var _0x3b7be8=JSON[_0x203d('0x12')](_0x463232);var _0x3b81d={'encoding':'utf8','method':_0x203d('0x13'),'timeout':0x2710,'url':_0x778ec,'headers':{'Content-Type':_0x203d('0x14')},'body':_0x3b7be8};return rp(_0x3b81d)[_0x203d('0x15')](function(_0xe0977e){const _0x3fe47=JSON[_0x203d('0x16')](_0xe0977e);if(!_0x3fe47[_0x203d('0x17')]['logged']){throw new Error(_0x203d('0x18'));}var _0x1f6399=_0x5d0938;var _0x5d89be=_0x203d('0x19')+_0x492ae9+'&serviceId='+_0x4e9179+_0x203d('0x1a')+_0x1f6399+'&data='+JSON[_0x203d('0x12')](_0x35bfc7);var _0x312aca=_0x3aad58+'?'+_0x5d89be;return rp(_0x312aca);})['then'](function(_0xc7518d){logger[_0x203d('0x1b')](_0x203d('0x1c'),_0x486f66,_0xc7518d);_0x5d4c34[_0x203d('0x1d')]();})[_0x203d('0x1e')](function(_0x2db290){logger[_0x203d('0x1f')](_0x203d('0x20'),_0x486f66,_[_0x203d('0x21')](_0x2db290)?JSON[_0x203d('0x12')](_0x2db290):_0x2db290);_0x5d4c34['stop']();});}else{logger[_0x203d('0x1b')](_0x203d('0x22'),_0x486f66);_0x5d4c34[_0x203d('0x23')]();}};}; \ 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 c70f340..99ffe4d 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x2a10e4,_0x5d3a1a){var _0x2d799f=function(_0x94718e){while(--_0x94718e){_0x2a10e4['push'](_0x2a10e4['shift']());}};_0x2d799f(++_0x5d3a1a);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x4db36a,_0x395596){var _0x3553b8=function(_0x469787){while(--_0x469787){_0x4db36a['push'](_0x4db36a['shift']());}};_0x3553b8(++_0x395596);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 3c12cf2..d3a5da1 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 _0xf18a=['execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','./applications/utils','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','isNil','IntervalId','Intervals','map','interval','listen','message','interaction','transfer','applications','isArray','length','existsSync','join','app','.js','autoreply','appdata','split','channel','mail','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','body','format','condition','intervals','./applications/','consequence','info','on\x20interval','\x20|\x20','error','rules'];(function(_0x52d088,_0xe60c3c){var _0x484ff4=function(_0x4736a2){while(--_0x4736a2){_0x52d088['push'](_0x52d088['shift']());}};_0x484ff4(++_0xe60c3c);}(_0xf18a,0x19d));var _0xaf18=function(_0x30f322,_0xba5772){_0x30f322=_0x30f322-0x0;var _0x23bbbb=_0xf18a[_0x30f322];return _0x23bbbb;};'use strict';var _=require(_0xaf18('0x0'));var util=require(_0xaf18('0x1'));var path=require(_0xaf18('0x2'));var fs=require('fs');var jayson=require(_0xaf18('0x3'));var BPromise=require(_0xaf18('0x4'));var utils=require(_0xaf18('0x5'));var sUtils=require('./applications/strategy/util');var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0xaf18('0x6')),'mailQueueReport':require(_0xaf18('0x7')),'chatQueueReport':require(_0xaf18('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xaf18('0x9'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x285282,_0x17679e,_0x26e4b2){return util['format']('%s.%s.%s',_0x285282,_0x17679e||0x0,_0x26e4b2||0x0);}function getIntervals(_0x1ac538,_0x460798){var _0x17e937=[];if(!_['isNil'](_0x460798['IntervalId'])&&!_[_0xaf18('0xa')](_0x1ac538[_0x460798[_0xaf18('0xb')]])&&!_['isNil'](_0x1ac538[_0x460798[_0xaf18('0xb')]][_0xaf18('0xc')])){_0x17e937=_[_0xaf18('0xd')](_0x1ac538[_0x460798[_0xaf18('0xb')]][_0xaf18('0xc')],_0xaf18('0xe'));}else if(!_[_0xaf18('0xa')](_0x460798[_0xaf18('0xe')])){_0x17e937=[_0x460798['interval']];}return _0x17e937;}exports[_0xaf18('0xf')]=function(_0x3412ad){_0x3412ad['rules']={};return new BPromise(function(_0x1ad8d9,_0x2bd68c){var _0x6cab9c={'Start':function(_0x5e0ee8){var _0x185e69=this;return new Promise(function(_0x4cd0cf,_0x466199){if(_0x5e0ee8){try{var _0x38fd79=[];var _0x40f321=getId(_0x5e0ee8['channel'],_0x5e0ee8[_0xaf18('0x10')]?_0x5e0ee8['message']['id']:0x0,_0x5e0ee8[_0xaf18('0x11')]?_0x5e0ee8[_0xaf18('0x11')]['id']:0x0);var _0x57eb3f=sUtils['checkWaitingNotifications'](_0x3412ad,_0x5e0ee8);if(_0x5e0ee8[_0xaf18('0x12')]||!_0x57eb3f&&_0x5e0ee8[_0xaf18('0x13')]&&_[_0xaf18('0x14')](_0x5e0ee8[_0xaf18('0x13')])&&_0x5e0ee8[_0xaf18('0x13')]['length']){for(var _0x3d2d03=0x0;_0x3d2d03<_0x5e0ee8['applications'][_0xaf18('0x15')];_0x3d2d03+=0x1){var _0x139ef1=_0x5e0ee8[_0xaf18('0x13')][_0x3d2d03];if(fs[_0xaf18('0x16')](path[_0xaf18('0x17')](__dirname,_0xaf18('0x13'),_0x139ef1[_0xaf18('0x18')]+_0xaf18('0x19')))){var _0x3082d5=[];switch(_0x139ef1[_0xaf18('0x18')]['toLowerCase']()){case _0xaf18('0x1a'):var _0x44ad93=_0x139ef1[_0xaf18('0x1b')][_0xaf18('0x1c')](',');if(_0x5e0ee8[_0xaf18('0x1d')]===_0xaf18('0x1e')){_0x3082d5[_0xaf18('0x1f')](_0x44ad93[0x0]);_0x3082d5[_0xaf18('0x1f')](_0x44ad93[0x1]);_0x3082d5['push'](_0x44ad93[_0xaf18('0x20')](0x2,_0x44ad93[_0xaf18('0x15')])['join'](','));}else{_0x3082d5[_0xaf18('0x1f')](_0x44ad93[0x0]);_0x3082d5['push'](_0x44ad93['slice'](0x1,_0x44ad93[_0xaf18('0x15')])[_0xaf18('0x17')](','));}break;case _0xaf18('0x21'):var _0x13512f=_0x139ef1[_0xaf18('0x1b')][_0xaf18('0x1c')](',');_0x3082d5[_0xaf18('0x1f')](_0x13512f[0x0]);_0x3082d5[_0xaf18('0x1f')](_0x13512f[0x1]);_0x3082d5[_0xaf18('0x1f')](_0x13512f[_0xaf18('0x20')](0x2,_0x13512f[_0xaf18('0x15')])['join'](','));break;case _0xaf18('0x22'):var _0x2cbb7f=_0x139ef1[_0xaf18('0x1b')]['split'](',');_0x3082d5['push'](_0x2cbb7f[0x0]);_0x3082d5[_0xaf18('0x1f')](_0x2cbb7f[0x1]);_0x3082d5[_0xaf18('0x1f')](_0x2cbb7f[0x2]);_0x3082d5[_0xaf18('0x1f')](_0x2cbb7f[0x3]);_0x3082d5[_0xaf18('0x1f')](_0x2cbb7f['slice'](0x4,_0x2cbb7f[_0xaf18('0x15')])[_0xaf18('0x17')](','));break;case _0xaf18('0x23'):var _0x4a87bd=_0x139ef1[_0xaf18('0x1b')][_0xaf18('0x1c')](',');_0x3082d5[_0xaf18('0x1f')](_0x4a87bd[0x0]);_0x3082d5[_0xaf18('0x1f')](_0x4a87bd[0x1]);_0x3082d5[_0xaf18('0x1f')](_0x4a87bd[0x2]);_0x3082d5[_0xaf18('0x1f')](_0x4a87bd[0x3]);_0x3082d5[_0xaf18('0x1f')](_0x4a87bd[_0xaf18('0x20')](0x4,_0x4a87bd['length'])['join'](','));break;case _0xaf18('0x10'):_0x3082d5['push'](_0x139ef1['appdata']);break;case'tag':_0x3082d5[_0xaf18('0x1f')](_0x139ef1[_0xaf18('0x24')]);_0x3082d5[_0xaf18('0x1f')](_0x139ef1[_0xaf18('0x1b')]);break;case _0xaf18('0x25'):var _0x57b04e=utils[_0xaf18('0x26')](_0x5e0ee8['account'][_0xaf18('0x27')],_0x5e0ee8);var _0x1fe457=_0x139ef1[_0xaf18('0x1b')][_0xaf18('0x1c')](',');_0x3082d5['push'](_0x1fe457[0x0]);_0x3082d5[_0xaf18('0x1f')](_0x1fe457[0x1]);_0x3082d5['push'](_0x1fe457[0x2]);_0x3082d5['push'](_0x1fe457[0x3]);_0x3082d5[_0xaf18('0x1f')](_0x1fe457[0x4]);_0x3082d5[_0xaf18('0x1f')](_0x1fe457[0x5]);_0x3082d5[_0xaf18('0x1f')](_0x1fe457[0x6]);_0x3082d5[_0xaf18('0x1f')](_0x1fe457[0x7]);_0x3082d5['push'](_0x1fe457[0x8]);_0x3082d5['push'](_0x1fe457[0x9]);_0x3082d5[_0xaf18('0x1f')](_0x1fe457[0xa]);_0x3082d5['push'](_0x5e0ee8[_0xaf18('0x11')]['id']);_0x3082d5['push'](_0x5e0ee8[_0xaf18('0x10')]['id']);_0x3082d5[_0xaf18('0x1f')](_0x139ef1[_0xaf18('0x28')]);_0x3082d5['push'](_0x5e0ee8[_0xaf18('0x11')]['ContactId']);_0x3082d5[_0xaf18('0x1f')](_0x5e0ee8['body'][_0xaf18('0x29')]);_0x3082d5[_0xaf18('0x1f')](_0x57b04e);break;default:_0x3082d5=_[_0xaf18('0xa')](_0x139ef1['appdata'])?[]:_0x139ef1[_0xaf18('0x1b')][_0xaf18('0x1c')](',');}var _0x343c03={'id':util[_0xaf18('0x2a')]('%s:%s:%s',_0x40f321,_0x139ef1['id'],_0x139ef1['app']),'condition':require('./interval')[_0xaf18('0x2b')](_0x40f321,getIntervals(_0x3412ad[_0xaf18('0x2c')],_0x139ef1),_0x3412ad),'consequence':require(_0xaf18('0x2d')+_0x139ef1['app'])[_0xaf18('0x2e')](_0x40f321,_0x3082d5,_0x3412ad,_0x5e0ee8),'p':_0x139ef1['priority']||0x0};logger[_0xaf18('0x2f')]('Push\x20new\x20rule',_0x343c03['id'],_0xaf18('0x30'),getIntervals(_0x3412ad[_0xaf18('0x2c')],_0x139ef1)[_0xaf18('0x17')](_0xaf18('0x31')));_0x38fd79['push'](_0x343c03);}else{logger[_0xaf18('0x32')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0xaf18('0x13'),_0x139ef1[_0xaf18('0x18')]+_0xaf18('0x19')));}}_0x3412ad[_0xaf18('0x33')][_0x40f321]=new RuleEngine(_0x38fd79);_0x3412ad[_0xaf18('0x33')][_0x40f321][_0xaf18('0x34')](_0x5e0ee8,function(_0x53f14c){logger[_0xaf18('0x2f')](_0xaf18('0x35'),JSON[_0xaf18('0x36')](_0x53f14c['matchPath']));if(_0x3412ad['rules'][_0x40f321]){_0x3412ad['rules'][_0x40f321][_0xaf18('0x37')](_0xaf18('0x38'));}});return _0x4cd0cf({'code':0xc8,'message':_0x5e0ee8});}else{if(_0x57eb3f){logger[_0xaf18('0x2f')](util['format']('Skipped\x20routing\x20for\x20%s',_0x40f321));}else{logger[_0xaf18('0x2f')](_0xaf18('0x39'));}return _0x4cd0cf({'code':0xc8,'message':_0x5e0ee8});}}catch(_0x59e1c4){logger[_0xaf18('0x32')](_0x59e1c4[_0xaf18('0x3a')]);return _0x466199(_0x185e69[_0xaf18('0x32')](0x1f4,_0x59e1c4));}}return _0x466199(_0xaf18('0x3b'));});},'AcceptMessage':function(_0x56f76f){var _0x3197c5=this;return new Promise(function(_0x54526e,_0x4253d6){if(_0x56f76f[_0xaf18('0x3c')]&&_0x56f76f[_0xaf18('0x3c')]['id']){if(_0x3412ad['agents'][_0x56f76f[_0xaf18('0x3c')]['id']]){_0x3412ad[_0xaf18('0x3d')][_0x56f76f[_0xaf18('0x3c')]['id']][_0xaf18('0x3e')]=![];_0x3412ad['agents'][_0x56f76f[_0xaf18('0x3c')]['id']][_0xaf18('0x3f')]=undefined;}}if(_0x56f76f[_0xaf18('0x10')]&&_0x56f76f[_0xaf18('0x10')]['id']){try{var _0x29ca0c=getId(_0x56f76f[_0xaf18('0x1d')],_0x56f76f['message']?_0x56f76f[_0xaf18('0x10')]['id']:0x0,_0x56f76f[_0xaf18('0x11')]?_0x56f76f[_0xaf18('0x11')]['id']:0x0);if(_0x3412ad[_0xaf18('0x33')][_0x29ca0c]){_0x3412ad[_0xaf18('0x33')][_0x29ca0c]['emit'](_0xaf18('0x40'));if(rpc[_0x56f76f[_0xaf18('0x1d')]+_0xaf18('0x41')]){rpc[_0x56f76f[_0xaf18('0x1d')]+_0xaf18('0x41')][_0xaf18('0x42')](_0x29ca0c,{'UserId':_0x56f76f[_0xaf18('0x10')]['UserId']})[_0xaf18('0x43')](function(){logger[_0xaf18('0x32')](_0xaf18('0x44'));});}}return _0x54526e({'code':0xc8,'message':_0x56f76f});}catch(_0x389341){logger[_0xaf18('0x32')](_0x389341['stack']);return _0x4253d6(_0x3197c5[_0xaf18('0x32')](0x1f4,_0x389341));}}logger['error'](_0xaf18('0x45'));return _0x4253d6(_0x3197c5['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x2d0327){var _0x2c2029=this;return new Promise(function(_0x2c7e69,_0x20282e){if(_0x2d0327['agent']&&_0x2d0327[_0xaf18('0x3c')]['id']){try{if(_0x3412ad['agents'][_0x2d0327[_0xaf18('0x3c')]['id']]){_0x3412ad[_0xaf18('0x3d')][_0x2d0327['agent']['id']]['busy']=![];_0x3412ad[_0xaf18('0x3d')][_0x2d0327['agent']['id']][_0xaf18('0x3f')]=undefined;}return _0x2c7e69({'code':0xc8,'message':_0x2d0327});}catch(_0x38edc8){logger[_0xaf18('0x32')](_0x38edc8['stack']);return _0x20282e(_0x2c2029[_0xaf18('0x32')](0x1f4,_0x38edc8));}}logger[_0xaf18('0x32')](_0xaf18('0x45'));return _0x20282e(_0x2c2029[_0xaf18('0x32')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x3ef3f2){var _0x26b79f=this;return new Promise(function(_0x4549fd,_0x335788){if(_0x3ef3f2['channel']&&_0x3ef3f2[_0xaf18('0x11')]&&_0x3ef3f2[_0xaf18('0x11')]['id']){try{var _0xbed62f=getId(_0x3ef3f2[_0xaf18('0x1d')],_0x3ef3f2[_0xaf18('0x10')]?_0x3ef3f2[_0xaf18('0x10')]['id']:0x0,_0x3ef3f2[_0xaf18('0x11')]?_0x3ef3f2[_0xaf18('0x11')]['id']:0x0);if(_0x3412ad[_0xaf18('0x33')][_0xbed62f]){_0x3412ad['rules'][_0xbed62f]['emit'](_0xaf18('0x40'));}return _0x4549fd({'code':0xc8,'message':_0x3ef3f2});}catch(_0x15638b){logger[_0xaf18('0x32')](_0x15638b[_0xaf18('0x3a')]);return _0x335788(_0x26b79f[_0xaf18('0x32')](0x1f4,_0x15638b));}}logger[_0xaf18('0x32')]('message\x20is\x20empty');return _0x335788(_0x26b79f[_0xaf18('0x32')](0x1f4,_0xaf18('0x45')));});},'AgentCapacity':function(_0x438bca){var _0x66d8bd=this;return new Promise(function(_0x1bd834,_0x48568c){if(_0x3412ad['agents'][_0xaf18('0x46')](_0x438bca['id'])){for(var _0x31de2a in _0x438bca['capacity']){if(_0x438bca[_0xaf18('0x47')][_0xaf18('0x46')](_0x31de2a)){if(_0x3412ad['agents'][_0x438bca['id']][_0xaf18('0x46')](_0x31de2a+_0xaf18('0x48'))){_0x3412ad[_0xaf18('0x3d')][_0x438bca['id']][_0x31de2a+_0xaf18('0x48')]=parseInt(_0x438bca[_0xaf18('0x47')][_0x31de2a],0xa);}}}_0x3412ad['agents'][_0x438bca['id']]['updateRealtime']();return _0x1bd834({'code':0xc8,'message':_0x3412ad[_0xaf18('0x3d')][_0x438bca['id']]});}else{return _0x48568c(_0x66d8bd[_0xaf18('0x32')](0x1f4,_0xaf18('0x49')));}});},'Agents':function(_0x13329c){return new Promise(function(_0x13e038){var _0x5766e6=_['values'](_0x3412ad[_0xaf18('0x3d')]);if(_0x13329c&&_0x13329c['id']){var _0x4c455f=_[_0xaf18('0x4a')](_0x5766e6,function(_0x533010){return _0x533010['id']===_0x13329c['id'];});_0x13e038(_0x4c455f);}else{_0x13e038({'count':_0x5766e6['length'],'rows':_0x5766e6});}});},'ChatQueues':function(){return new Promise(function(_0xd2d642){var _0x19ca9d=[];for(var _0x46b53b in _0x3412ad[_0xaf18('0x4b')]){if(_0x3412ad['chatQueues'][_0xaf18('0x46')](_0x46b53b)){var _0x3b844a=_0x3412ad[_0xaf18('0x4b')][_0x46b53b];var _0x3d78b1={'id':_0x3b844a['id'],'available':_0x3b844a[_0xaf18('0x4c')],'loggedIn':_0x3b844a[_0xaf18('0x4d')],'name':_0x3b844a[_0xaf18('0x4e')],'paused':_0x3b844a[_0xaf18('0x4f')],'waiting':_0x3b844a[_0xaf18('0x50')]};_0x19ca9d['push'](_0x3d78b1);}}_0xd2d642({'count':_0x19ca9d[_0xaf18('0x15')],'rows':_0x19ca9d});});},'MailQueues':function(){return new Promise(function(_0x1da698){var _0x2ae6b9=[];for(var _0x340bc8 in _0x3412ad[_0xaf18('0x51')]){if(_0x3412ad[_0xaf18('0x51')][_0xaf18('0x46')](_0x340bc8)){var _0x3f6682=_0x3412ad[_0xaf18('0x51')][_0x340bc8];var _0x5302e0={'id':_0x3f6682['id'],'available':_0x3f6682[_0xaf18('0x4c')],'loggedIn':_0x3f6682[_0xaf18('0x4d')],'name':_0x3f6682[_0xaf18('0x4e')],'paused':_0x3f6682['paused'],'waiting':_0x3f6682[_0xaf18('0x50')]};_0x2ae6b9[_0xaf18('0x1f')](_0x5302e0);}}_0x1da698({'count':_0x2ae6b9['length'],'rows':_0x2ae6b9});});},'OpenchannelQueues':function(){return new Promise(function(_0xf93379){var _0xfbe61a=[];for(var _0x36d4f3 in _0x3412ad['openchannelQueues']){if(_0x3412ad[_0xaf18('0x52')]['hasOwnProperty'](_0x36d4f3)){var _0x2a32ed=_0x3412ad[_0xaf18('0x52')][_0x36d4f3];var _0x42ea70={'id':_0x2a32ed['id'],'available':_0x2a32ed[_0xaf18('0x4c')],'loggedIn':_0x2a32ed[_0xaf18('0x4d')],'name':_0x2a32ed[_0xaf18('0x4e')],'paused':_0x2a32ed['paused'],'waiting':_0x2a32ed[_0xaf18('0x50')]};_0xfbe61a['push'](_0x42ea70);}}_0xf93379({'count':_0xfbe61a[_0xaf18('0x15')],'rows':_0xfbe61a});});},'SmsQueues':function(){return new Promise(function(_0x40a959){var _0x51dace=[];for(var _0x167059 in _0x3412ad[_0xaf18('0x53')]){if(_0x3412ad['smsQueues'][_0xaf18('0x46')](_0x167059)){var _0x542c18=_0x3412ad[_0xaf18('0x53')][_0x167059];var _0x373f9c={'id':_0x542c18['id'],'available':_0x542c18['available'],'loggedIn':_0x542c18['loggedIn'],'name':_0x542c18[_0xaf18('0x4e')],'paused':_0x542c18[_0xaf18('0x4f')],'waiting':_0x542c18[_0xaf18('0x50')]};_0x51dace[_0xaf18('0x1f')](_0x373f9c);}}_0x40a959({'count':_0x51dace[_0xaf18('0x15')],'rows':_0x51dace});});},'FaxQueues':function(){return new Promise(function(_0x11b33a){var _0x528005=[];for(var _0x4eca21 in _0x3412ad[_0xaf18('0x54')]){if(_0x3412ad[_0xaf18('0x54')][_0xaf18('0x46')](_0x4eca21)){var _0x57c4e3=_0x3412ad['faxQueues'][_0x4eca21];var _0xff88fd={'id':_0x57c4e3['id'],'available':_0x57c4e3[_0xaf18('0x4c')],'loggedIn':_0x57c4e3[_0xaf18('0x4d')],'name':_0x57c4e3['name'],'paused':_0x57c4e3[_0xaf18('0x4f')],'waiting':_0x57c4e3[_0xaf18('0x50')]};_0x528005[_0xaf18('0x1f')](_0xff88fd);}}_0x11b33a({'count':_0x528005[_0xaf18('0x15')],'rows':_0x528005});});},'WhatsappQueues':function(){return new Promise(function(_0x20473d){var _0x50712d=[];for(var _0xb8cff in _0x3412ad[_0xaf18('0x55')]){if(_0x3412ad[_0xaf18('0x55')][_0xaf18('0x46')](_0xb8cff)){var _0x595f63=_0x3412ad[_0xaf18('0x55')][_0xb8cff];var _0x57eedf={'id':_0x595f63['id'],'available':_0x595f63[_0xaf18('0x4c')],'loggedIn':_0x595f63[_0xaf18('0x4d')],'name':_0x595f63[_0xaf18('0x4e')],'paused':_0x595f63[_0xaf18('0x4f')],'waiting':_0x595f63[_0xaf18('0x50')]};_0x50712d[_0xaf18('0x1f')](_0x57eedf);}}_0x20473d({'count':_0x50712d[_0xaf18('0x15')],'rows':_0x50712d});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x5b415c){var _0x5c1ba1=_[_0xaf18('0x56')](_0x3412ad[_0xaf18('0x57')]);_0x5b415c({'count':_0x5c1ba1[_0xaf18('0x15')],'rows':_0x5c1ba1});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x55cd3c){var _0x44f95d=_[_0xaf18('0x56')](_0x3412ad[_0xaf18('0x58')]);_0x55cd3c({'count':_0x44f95d['length'],'rows':_0x44f95d});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x493598){var _0x42c79b=_['values'](_0x3412ad['openchannelQueuesWaitingInteractions']);_0x493598({'count':_0x42c79b['length'],'rows':_0x42c79b});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x57b797){var _0x2df1b7=_[_0xaf18('0x56')](_0x3412ad['smsQueuesWaitingInteractions']);_0x57b797({'count':_0x2df1b7[_0xaf18('0x15')],'rows':_0x2df1b7});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x41bb4e){var _0x315bd2=_['values'](_0x3412ad['faxQueuesWaitingInteractions']);_0x41bb4e({'count':_0x315bd2[_0xaf18('0x15')],'rows':_0x315bd2});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x300aa6){var _0x707c7c=_[_0xaf18('0x56')](_0x3412ad[_0xaf18('0x59')]);_0x300aa6({'count':_0x707c7c[_0xaf18('0x15')],'rows':_0x707c7c});});}};var _0x27d42d=jayson['server'](_0x6cab9c)['http']();_0x27d42d['on'](_0xaf18('0x32'),function(_0x2c3b2d){logger['error'](JSON[_0xaf18('0x36')](_0x2c3b2d));return _0x2bd68c(_0x2c3b2d);});_0x27d42d[_0xaf18('0xf')](0x232c,_0xaf18('0x5a'),function(){console[_0xaf18('0x5b')](_0xaf18('0x5c'),0x232c);return _0x1ad8d9('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x4c84=['stack','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','checkWaitingNotifications','transfer','applications','length','existsSync','join','app','.js','autoreply','appdata','mail','push','slice','dialogflow','split','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','Applications\x20executed','stringify','matchPath','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','emit','QueueReport','update','UserId','error\x20update\x20queue\x20report'];(function(_0x55d7c5,_0x348186){var _0x1f18c2=function(_0x5ec8d9){while(--_0x5ec8d9){_0x55d7c5['push'](_0x55d7c5['shift']());}};_0x1f18c2(++_0x348186);}(_0x4c84,0x14d));var _0x44c8=function(_0xdb9251,_0xed3e1a){_0xdb9251=_0xdb9251-0x0;var _0xbb2c7b=_0x4c84[_0xdb9251];return _0xbb2c7b;};'use strict';var _=require('lodash');var util=require(_0x44c8('0x0'));var path=require(_0x44c8('0x1'));var fs=require('fs');var jayson=require(_0x44c8('0x2'));var BPromise=require(_0x44c8('0x3'));var utils=require(_0x44c8('0x4'));var sUtils=require('./applications/strategy/util');var logger=require(_0x44c8('0x5'))(_0x44c8('0x6'));var rpc={'openchannelQueueReport':require(_0x44c8('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x44c8('0x8')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x44c8('0x9'));function getId(_0x13e304,_0x262aaf,_0x27e724){return util[_0x44c8('0xa')](_0x44c8('0xb'),_0x13e304,_0x262aaf||0x0,_0x27e724||0x0);}function getIntervals(_0x1aa0b1,_0x34282a){var _0x9cc900=[];if(!_[_0x44c8('0xc')](_0x34282a[_0x44c8('0xd')])&&!_['isNil'](_0x1aa0b1[_0x34282a[_0x44c8('0xd')]])&&!_[_0x44c8('0xc')](_0x1aa0b1[_0x34282a['IntervalId']][_0x44c8('0xe')])){_0x9cc900=_[_0x44c8('0xf')](_0x1aa0b1[_0x34282a[_0x44c8('0xd')]][_0x44c8('0xe')],_0x44c8('0x10'));}else if(!_['isNil'](_0x34282a[_0x44c8('0x10')])){_0x9cc900=[_0x34282a['interval']];}return _0x9cc900;}exports[_0x44c8('0x11')]=function(_0x39eaef){_0x39eaef['rules']={};return new BPromise(function(_0x246926,_0x66a83e){var _0x108321={'Start':function(_0x3eddc0){var _0x28f849=this;return new Promise(function(_0x1c641b,_0x5c276f){if(_0x3eddc0){try{var _0x213df5=[];var _0xc5e17f=getId(_0x3eddc0[_0x44c8('0x12')],_0x3eddc0['message']?_0x3eddc0[_0x44c8('0x13')]['id']:0x0,_0x3eddc0[_0x44c8('0x14')]?_0x3eddc0[_0x44c8('0x14')]['id']:0x0);var _0x2c1839=sUtils[_0x44c8('0x15')](_0x39eaef,_0x3eddc0);if(_0x3eddc0[_0x44c8('0x16')]||!_0x2c1839&&_0x3eddc0['applications']&&_['isArray'](_0x3eddc0[_0x44c8('0x17')])&&_0x3eddc0[_0x44c8('0x17')][_0x44c8('0x18')]){for(var _0x19e649=0x0;_0x19e649<_0x3eddc0[_0x44c8('0x17')][_0x44c8('0x18')];_0x19e649+=0x1){var _0x181494=_0x3eddc0[_0x44c8('0x17')][_0x19e649];if(fs[_0x44c8('0x19')](path[_0x44c8('0x1a')](__dirname,_0x44c8('0x17'),_0x181494[_0x44c8('0x1b')]+_0x44c8('0x1c')))){var _0x1b2e13=[];switch(_0x181494[_0x44c8('0x1b')]['toLowerCase']()){case _0x44c8('0x1d'):var _0x58298b=_0x181494[_0x44c8('0x1e')]['split'](',');if(_0x3eddc0[_0x44c8('0x12')]===_0x44c8('0x1f')){_0x1b2e13[_0x44c8('0x20')](_0x58298b[0x0]);_0x1b2e13[_0x44c8('0x20')](_0x58298b[0x1]);_0x1b2e13[_0x44c8('0x20')](_0x58298b[_0x44c8('0x21')](0x2,_0x58298b[_0x44c8('0x18')])['join'](','));}else{_0x1b2e13[_0x44c8('0x20')](_0x58298b[0x0]);_0x1b2e13[_0x44c8('0x20')](_0x58298b['slice'](0x1,_0x58298b['length'])[_0x44c8('0x1a')](','));}break;case _0x44c8('0x22'):var _0x59ed3b=_0x181494['appdata'][_0x44c8('0x23')](',');_0x1b2e13[_0x44c8('0x20')](_0x59ed3b[0x0]);_0x1b2e13['push'](_0x59ed3b[0x1]);_0x1b2e13[_0x44c8('0x20')](_0x59ed3b['slice'](0x2,_0x59ed3b[_0x44c8('0x18')])[_0x44c8('0x1a')](','));break;case'dialogflowv2':var _0x5cecda=_0x181494['appdata'][_0x44c8('0x23')](',');_0x1b2e13[_0x44c8('0x20')](_0x5cecda[0x0]);_0x1b2e13[_0x44c8('0x20')](_0x5cecda[0x1]);_0x1b2e13[_0x44c8('0x20')](_0x5cecda[0x2]);_0x1b2e13['push'](_0x5cecda[0x3]);_0x1b2e13[_0x44c8('0x20')](_0x5cecda['slice'](0x4,_0x5cecda[_0x44c8('0x18')])['join'](','));break;case _0x44c8('0x24'):var _0x37997b=_0x181494[_0x44c8('0x1e')][_0x44c8('0x23')](',');_0x1b2e13[_0x44c8('0x20')](_0x37997b[0x0]);_0x1b2e13[_0x44c8('0x20')](_0x37997b[0x1]);_0x1b2e13['push'](_0x37997b[0x2]);_0x1b2e13[_0x44c8('0x20')](_0x37997b[0x3]);_0x1b2e13[_0x44c8('0x20')](_0x37997b['slice'](0x4,_0x37997b[_0x44c8('0x18')])['join'](','));break;case _0x44c8('0x13'):_0x1b2e13[_0x44c8('0x20')](_0x181494['appdata']);break;case'tag':_0x1b2e13[_0x44c8('0x20')](_0x181494[_0x44c8('0x25')]);_0x1b2e13['push'](_0x181494[_0x44c8('0x1e')]);break;case _0x44c8('0x26'):var _0x5d578b=utils[_0x44c8('0x27')](_0x3eddc0[_0x44c8('0x28')][_0x44c8('0x29')],_0x3eddc0);var _0x49ee03=_0x181494[_0x44c8('0x1e')][_0x44c8('0x23')](',');_0x1b2e13[_0x44c8('0x20')](_0x49ee03[0x0]);_0x1b2e13[_0x44c8('0x20')](_0x49ee03[0x1]);_0x1b2e13[_0x44c8('0x20')](_0x49ee03[0x2]);_0x1b2e13[_0x44c8('0x20')](_0x49ee03[0x3]);_0x1b2e13[_0x44c8('0x20')](_0x49ee03[0x4]);_0x1b2e13['push'](_0x49ee03[0x5]);_0x1b2e13[_0x44c8('0x20')](_0x49ee03[0x6]);_0x1b2e13[_0x44c8('0x20')](_0x49ee03[0x7]);_0x1b2e13['push'](_0x49ee03[0x8]);_0x1b2e13[_0x44c8('0x20')](_0x49ee03[0x9]);_0x1b2e13[_0x44c8('0x20')](_0x49ee03[0xa]);_0x1b2e13[_0x44c8('0x20')](_0x3eddc0[_0x44c8('0x14')]['id']);_0x1b2e13[_0x44c8('0x20')](_0x3eddc0[_0x44c8('0x13')]['id']);_0x1b2e13[_0x44c8('0x20')](_0x181494[_0x44c8('0x2a')]);_0x1b2e13[_0x44c8('0x20')](_0x3eddc0[_0x44c8('0x14')][_0x44c8('0x2b')]);_0x1b2e13[_0x44c8('0x20')](_0x3eddc0[_0x44c8('0x2c')][_0x44c8('0x2c')]);_0x1b2e13[_0x44c8('0x20')](_0x5d578b);break;default:_0x1b2e13=_[_0x44c8('0xc')](_0x181494[_0x44c8('0x1e')])?[]:_0x181494[_0x44c8('0x1e')][_0x44c8('0x23')](',');}var _0xe4f449={'id':util['format']('%s:%s:%s',_0xc5e17f,_0x181494['id'],_0x181494['app']),'condition':require(_0x44c8('0x2d'))['condition'](_0xc5e17f,getIntervals(_0x39eaef[_0x44c8('0x2e')],_0x181494),_0x39eaef),'consequence':require(_0x44c8('0x2f')+_0x181494['app'])[_0x44c8('0x30')](_0xc5e17f,_0x1b2e13,_0x39eaef,_0x3eddc0),'p':_0x181494[_0x44c8('0x31')]||0x0};logger[_0x44c8('0x32')](_0x44c8('0x33'),_0xe4f449['id'],_0x44c8('0x34'),getIntervals(_0x39eaef[_0x44c8('0x2e')],_0x181494)[_0x44c8('0x1a')](_0x44c8('0x35')));_0x213df5['push'](_0xe4f449);}else{logger[_0x44c8('0x36')](_0x44c8('0x37'),path[_0x44c8('0x1a')](__dirname,_0x44c8('0x17'),_0x181494[_0x44c8('0x1b')]+_0x44c8('0x1c')));}}_0x39eaef[_0x44c8('0x38')][_0xc5e17f]=new RuleEngine(_0x213df5);_0x39eaef[_0x44c8('0x38')][_0xc5e17f]['execute'](_0x3eddc0,function(_0x2aab15){logger[_0x44c8('0x32')](_0x44c8('0x39'),JSON[_0x44c8('0x3a')](_0x2aab15[_0x44c8('0x3b')]));if(_0x39eaef[_0x44c8('0x38')][_0xc5e17f]){_0x39eaef[_0x44c8('0x38')][_0xc5e17f]['emit']('complete');}});return _0x1c641b({'code':0xc8,'message':_0x3eddc0});}else{if(_0x2c1839){logger[_0x44c8('0x32')](util[_0x44c8('0xa')](_0x44c8('0x3c'),_0xc5e17f));}else{logger[_0x44c8('0x32')](_0x44c8('0x3d'));}return _0x1c641b({'code':0xc8,'message':_0x3eddc0});}}catch(_0x5d7208){logger[_0x44c8('0x36')](_0x5d7208['stack']);return _0x5c276f(_0x28f849[_0x44c8('0x36')](0x1f4,_0x5d7208));}}return _0x5c276f(_0x44c8('0x3e'));});},'AcceptMessage':function(_0x13f706){var _0x2a593f=this;return new Promise(function(_0x22aa83,_0x6d025){if(_0x13f706[_0x44c8('0x3f')]&&_0x13f706[_0x44c8('0x3f')]['id']){if(_0x39eaef[_0x44c8('0x40')][_0x13f706[_0x44c8('0x3f')]['id']]){_0x39eaef[_0x44c8('0x40')][_0x13f706[_0x44c8('0x3f')]['id']][_0x44c8('0x41')]=![];_0x39eaef[_0x44c8('0x40')][_0x13f706[_0x44c8('0x3f')]['id']]['busyQueue']=undefined;}}if(_0x13f706['message']&&_0x13f706[_0x44c8('0x13')]['id']){try{var _0xe5cd96=getId(_0x13f706['channel'],_0x13f706[_0x44c8('0x13')]?_0x13f706[_0x44c8('0x13')]['id']:0x0,_0x13f706[_0x44c8('0x14')]?_0x13f706[_0x44c8('0x14')]['id']:0x0);if(_0x39eaef[_0x44c8('0x38')][_0xe5cd96]){_0x39eaef[_0x44c8('0x38')][_0xe5cd96][_0x44c8('0x42')]('end');if(rpc[_0x13f706[_0x44c8('0x12')]+_0x44c8('0x43')]){rpc[_0x13f706[_0x44c8('0x12')]+_0x44c8('0x43')][_0x44c8('0x44')](_0xe5cd96,{'UserId':_0x13f706['message'][_0x44c8('0x45')]})['catch'](function(){logger[_0x44c8('0x36')](_0x44c8('0x46'));});}}return _0x22aa83({'code':0xc8,'message':_0x13f706});}catch(_0x24a54d){logger[_0x44c8('0x36')](_0x24a54d[_0x44c8('0x47')]);return _0x6d025(_0x2a593f[_0x44c8('0x36')](0x1f4,_0x24a54d));}}logger[_0x44c8('0x36')](_0x44c8('0x48'));return _0x6d025(_0x2a593f['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x29a099){var _0x112737=this;return new Promise(function(_0x4fdceb,_0xd1c7e3){if(_0x29a099[_0x44c8('0x3f')]&&_0x29a099[_0x44c8('0x3f')]['id']){try{if(_0x39eaef[_0x44c8('0x40')][_0x29a099[_0x44c8('0x3f')]['id']]){_0x39eaef[_0x44c8('0x40')][_0x29a099[_0x44c8('0x3f')]['id']]['busy']=![];_0x39eaef[_0x44c8('0x40')][_0x29a099[_0x44c8('0x3f')]['id']][_0x44c8('0x49')]=undefined;}return _0x4fdceb({'code':0xc8,'message':_0x29a099});}catch(_0xc2b04){logger[_0x44c8('0x36')](_0xc2b04[_0x44c8('0x47')]);return _0xd1c7e3(_0x112737[_0x44c8('0x36')](0x1f4,_0xc2b04));}}logger[_0x44c8('0x36')]('message\x20is\x20empty');return _0xd1c7e3(_0x112737[_0x44c8('0x36')](0x1f4,_0x44c8('0x48')));});},'AbandonInteraction':function(_0x5260da){var _0x539a5d=this;return new Promise(function(_0x7eeeac,_0x46fe91){if(_0x5260da['channel']&&_0x5260da[_0x44c8('0x14')]&&_0x5260da[_0x44c8('0x14')]['id']){try{var _0x47d865=getId(_0x5260da[_0x44c8('0x12')],_0x5260da[_0x44c8('0x13')]?_0x5260da[_0x44c8('0x13')]['id']:0x0,_0x5260da['interaction']?_0x5260da['interaction']['id']:0x0);if(_0x39eaef['rules'][_0x47d865]){_0x39eaef[_0x44c8('0x38')][_0x47d865][_0x44c8('0x42')]('end');}return _0x7eeeac({'code':0xc8,'message':_0x5260da});}catch(_0x138228){logger[_0x44c8('0x36')](_0x138228[_0x44c8('0x47')]);return _0x46fe91(_0x539a5d['error'](0x1f4,_0x138228));}}logger[_0x44c8('0x36')](_0x44c8('0x48'));return _0x46fe91(_0x539a5d[_0x44c8('0x36')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x409baf){var _0x2de9d9=this;return new Promise(function(_0x441d0c,_0x479aea){if(_0x39eaef[_0x44c8('0x40')][_0x44c8('0x4a')](_0x409baf['id'])){for(var _0x48b06d in _0x409baf[_0x44c8('0x4b')]){if(_0x409baf['capacity'][_0x44c8('0x4a')](_0x48b06d)){if(_0x39eaef[_0x44c8('0x40')][_0x409baf['id']][_0x44c8('0x4a')](_0x48b06d+_0x44c8('0x4c'))){_0x39eaef['agents'][_0x409baf['id']][_0x48b06d+_0x44c8('0x4c')]=parseInt(_0x409baf[_0x44c8('0x4b')][_0x48b06d],0xa);}}}_0x39eaef[_0x44c8('0x40')][_0x409baf['id']][_0x44c8('0x4d')]();return _0x441d0c({'code':0xc8,'message':_0x39eaef[_0x44c8('0x40')][_0x409baf['id']]});}else{return _0x479aea(_0x2de9d9['error'](0x1f4,_0x44c8('0x4e')));}});},'Agents':function(_0x4e890){return new Promise(function(_0x2dd98f){var _0x1338b5=_[_0x44c8('0x4f')](_0x39eaef[_0x44c8('0x40')]);if(_0x4e890&&_0x4e890['id']){var _0x55b7a6=_[_0x44c8('0x50')](_0x1338b5,function(_0x5961b3){return _0x5961b3['id']===_0x4e890['id'];});_0x2dd98f(_0x55b7a6);}else{_0x2dd98f({'count':_0x1338b5[_0x44c8('0x18')],'rows':_0x1338b5});}});},'ChatQueues':function(){return new Promise(function(_0x2292cb){var _0x23cfba=[];for(var _0x259666 in _0x39eaef['chatQueues']){if(_0x39eaef[_0x44c8('0x51')][_0x44c8('0x4a')](_0x259666)){var _0x3fc329=_0x39eaef[_0x44c8('0x51')][_0x259666];var _0x2afce3={'id':_0x3fc329['id'],'available':_0x3fc329[_0x44c8('0x52')],'loggedIn':_0x3fc329[_0x44c8('0x53')],'name':_0x3fc329[_0x44c8('0x54')],'paused':_0x3fc329[_0x44c8('0x55')],'waiting':_0x3fc329['waiting']};_0x23cfba['push'](_0x2afce3);}}_0x2292cb({'count':_0x23cfba[_0x44c8('0x18')],'rows':_0x23cfba});});},'MailQueues':function(){return new Promise(function(_0x3b696d){var _0x4ae3e9=[];for(var _0x2c0896 in _0x39eaef[_0x44c8('0x56')]){if(_0x39eaef[_0x44c8('0x56')][_0x44c8('0x4a')](_0x2c0896)){var _0x500bf1=_0x39eaef[_0x44c8('0x56')][_0x2c0896];var _0x347dd8={'id':_0x500bf1['id'],'available':_0x500bf1['available'],'loggedIn':_0x500bf1['loggedIn'],'name':_0x500bf1[_0x44c8('0x54')],'paused':_0x500bf1['paused'],'waiting':_0x500bf1[_0x44c8('0x57')]};_0x4ae3e9[_0x44c8('0x20')](_0x347dd8);}}_0x3b696d({'count':_0x4ae3e9[_0x44c8('0x18')],'rows':_0x4ae3e9});});},'OpenchannelQueues':function(){return new Promise(function(_0x2a8f0c){var _0x59f13b=[];for(var _0x400245 in _0x39eaef[_0x44c8('0x58')]){if(_0x39eaef[_0x44c8('0x58')][_0x44c8('0x4a')](_0x400245)){var _0x23f649=_0x39eaef[_0x44c8('0x58')][_0x400245];var _0x31f211={'id':_0x23f649['id'],'available':_0x23f649[_0x44c8('0x52')],'loggedIn':_0x23f649['loggedIn'],'name':_0x23f649[_0x44c8('0x54')],'paused':_0x23f649[_0x44c8('0x55')],'waiting':_0x23f649['waiting']};_0x59f13b[_0x44c8('0x20')](_0x31f211);}}_0x2a8f0c({'count':_0x59f13b['length'],'rows':_0x59f13b});});},'SmsQueues':function(){return new Promise(function(_0xb15fc2){var _0x45397b=[];for(var _0x181cbb in _0x39eaef['smsQueues']){if(_0x39eaef[_0x44c8('0x59')]['hasOwnProperty'](_0x181cbb)){var _0x2b128c=_0x39eaef[_0x44c8('0x59')][_0x181cbb];var _0x129451={'id':_0x2b128c['id'],'available':_0x2b128c[_0x44c8('0x52')],'loggedIn':_0x2b128c[_0x44c8('0x53')],'name':_0x2b128c[_0x44c8('0x54')],'paused':_0x2b128c['paused'],'waiting':_0x2b128c['waiting']};_0x45397b['push'](_0x129451);}}_0xb15fc2({'count':_0x45397b['length'],'rows':_0x45397b});});},'FaxQueues':function(){return new Promise(function(_0x5de22d){var _0x57de14=[];for(var _0x1bf226 in _0x39eaef[_0x44c8('0x5a')]){if(_0x39eaef[_0x44c8('0x5a')][_0x44c8('0x4a')](_0x1bf226)){var _0x4fe964=_0x39eaef['faxQueues'][_0x1bf226];var _0x487405={'id':_0x4fe964['id'],'available':_0x4fe964[_0x44c8('0x52')],'loggedIn':_0x4fe964[_0x44c8('0x53')],'name':_0x4fe964[_0x44c8('0x54')],'paused':_0x4fe964['paused'],'waiting':_0x4fe964[_0x44c8('0x57')]};_0x57de14[_0x44c8('0x20')](_0x487405);}}_0x5de22d({'count':_0x57de14[_0x44c8('0x18')],'rows':_0x57de14});});},'WhatsappQueues':function(){return new Promise(function(_0x1bbf38){var _0x5cf3f2=[];for(var _0x116605 in _0x39eaef['whatsappQueues']){if(_0x39eaef[_0x44c8('0x5b')][_0x44c8('0x4a')](_0x116605)){var _0x1ec3d0=_0x39eaef[_0x44c8('0x5b')][_0x116605];var _0x203fab={'id':_0x1ec3d0['id'],'available':_0x1ec3d0[_0x44c8('0x52')],'loggedIn':_0x1ec3d0[_0x44c8('0x53')],'name':_0x1ec3d0['name'],'paused':_0x1ec3d0[_0x44c8('0x55')],'waiting':_0x1ec3d0[_0x44c8('0x57')]};_0x5cf3f2[_0x44c8('0x20')](_0x203fab);}}_0x1bbf38({'count':_0x5cf3f2['length'],'rows':_0x5cf3f2});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3243ea){var _0x27af30=_[_0x44c8('0x4f')](_0x39eaef[_0x44c8('0x5c')]);_0x3243ea({'count':_0x27af30['length'],'rows':_0x27af30});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x13db11){var _0x41230a=_[_0x44c8('0x4f')](_0x39eaef[_0x44c8('0x5d')]);_0x13db11({'count':_0x41230a[_0x44c8('0x18')],'rows':_0x41230a});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x580a84){var _0x30ccfb=_[_0x44c8('0x4f')](_0x39eaef[_0x44c8('0x5e')]);_0x580a84({'count':_0x30ccfb['length'],'rows':_0x30ccfb});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0xf746a5){var _0x4ee9e3=_['values'](_0x39eaef['smsQueuesWaitingInteractions']);_0xf746a5({'count':_0x4ee9e3[_0x44c8('0x18')],'rows':_0x4ee9e3});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x42172d){var _0x1ca115=_['values'](_0x39eaef[_0x44c8('0x5f')]);_0x42172d({'count':_0x1ca115[_0x44c8('0x18')],'rows':_0x1ca115});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x6ee0d3){var _0x51c07f=_[_0x44c8('0x4f')](_0x39eaef[_0x44c8('0x60')]);_0x6ee0d3({'count':_0x51c07f[_0x44c8('0x18')],'rows':_0x51c07f});});}};var _0x287e59=jayson[_0x44c8('0x61')](_0x108321)['http']();_0x287e59['on'](_0x44c8('0x36'),function(_0x2898f9){logger['error'](JSON[_0x44c8('0x3a')](_0x2898f9));return _0x66a83e(_0x2898f9);});_0x287e59[_0x44c8('0x11')](0x232c,_0x44c8('0x62'),function(){console['log'](_0x44c8('0x63'),0x232c);return _0x246926(_0x44c8('0x64')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index dd12736..39a6423 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 _0xa71e=['\x20|\x20','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','request','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','indexOf','true','[%s][INTERVAL]\x20%s','then','[%s][INTERVAL]\x20%s\x20%s','join','when','error'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xa71e,0xfd));var _0xea71=function(_0x1e271f,_0xf14504){_0x1e271f=_0x1e271f-0x0;var _0x2b2ac5=_0xa71e[_0x1e271f];return _0x2b2ac5;};'use strict';var util=require(_0xea71('0x0'));var BPromise=require(_0xea71('0x1'));var jayson=require(_0xea71('0x2'));var _=require(_0xea71('0x3'));var logger=require(_0xea71('0x4'))(_0xea71('0x5'));var client=jayson['client']['http']({'port':0x232a});function request(_0x412efa,_0x190993){return new BPromise(function(_0x288a25,_0x45dd1c){return client[_0xea71('0x6')](_0x412efa,_0x190993)['then'](function(_0x143953){if(_0x143953['error']){return _0x45dd1c(_0x143953['error'][_0xea71('0x7')]);}else{return _0x288a25(_0x143953[_0xea71('0x8')]);}})[_0xea71('0x9')](function(_0x130544){return _0x45dd1c(_0x130544);});});}exports[_0xea71('0xa')]=function(_0x420c24,_0x4a2a76,_0x59115f){return function(_0x1bcb3e){if(_0x59115f[_0xea71('0xb')]&&!_0x59115f[_0xea71('0xb')][_0x420c24]){logger[_0xea71('0xc')](_0xea71('0xd'),_0x420c24);return _0x1bcb3e[_0xea71('0xe')]();}var _0x334fa2=[];for(var _0x4a4d1a=0x0;_0x4a4d1a<_0x4a2a76[_0xea71('0xf')];_0x4a4d1a+=0x1){_0x334fa2[_0xea71('0x10')](request(_0xea71('0x11'),{'command':util[_0xea71('0x12')]('iftime\x20%s',_0x4a2a76[_0x4a4d1a])})['then'](function(_0x2a3fb2){return _0x2a3fb2&&_0x2a3fb2[_0xea71('0x7')]&&_0x2a3fb2[_0xea71('0x7')][_0xea71('0x13')](_0xea71('0x14'))>=0x0?!![]:![];})[_0xea71('0x9')](function(){logger['error'](_0xea71('0x15'),_0x420c24,_0x4a2a76[_0x4a4d1a]);}));}BPromise['all'](_0x334fa2)[_0xea71('0x16')](function(_0x3fb180){var _0x4ae793=_['some'](_0x3fb180);logger[_0xea71('0xc')](_0xea71('0x17'),_0x420c24,_0x4a2a76[_0xea71('0x18')]('\x20|\x20'),_0x4ae793);_0x1bcb3e[_0xea71('0x19')](_0x4ae793);})[_0xea71('0x9')](function(_0x18dee2){logger[_0xea71('0x1a')]('[%s][INTERVAL]\x20%s\x20%s',_0x420c24,_0x4a2a76['join'](_0xea71('0x1b')),_0x18dee2['stack']);_0x1bcb3e['stop']();});};}; \ No newline at end of file +var _0xa7c7=['some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','jayson/promise','../../../config/logger','routing','client','http','request','then','error','message','result','catch','condition','rules','info','length','push','Command','format','iftime\x20%s','true','[%s][INTERVAL]\x20%s','all'];(function(_0x512681,_0x49479d){var _0x16f6fd=function(_0x1d01cd){while(--_0x1d01cd){_0x512681['push'](_0x512681['shift']());}};_0x16f6fd(++_0x49479d);}(_0xa7c7,0x1d6));var _0x7a7c=function(_0x356277,_0xe0c214){_0x356277=_0x356277-0x0;var _0x2111dc=_0xa7c7[_0x356277];return _0x2111dc;};'use strict';var util=require(_0x7a7c('0x0'));var BPromise=require('bluebird');var jayson=require(_0x7a7c('0x1'));var _=require('lodash');var logger=require(_0x7a7c('0x2'))(_0x7a7c('0x3'));var client=jayson[_0x7a7c('0x4')][_0x7a7c('0x5')]({'port':0x232a});function request(_0x12fdf3,_0x1a41d3){return new BPromise(function(_0x4fc402,_0x1ef13){return client[_0x7a7c('0x6')](_0x12fdf3,_0x1a41d3)[_0x7a7c('0x7')](function(_0x440ed6){if(_0x440ed6[_0x7a7c('0x8')]){return _0x1ef13(_0x440ed6[_0x7a7c('0x8')][_0x7a7c('0x9')]);}else{return _0x4fc402(_0x440ed6[_0x7a7c('0xa')]);}})[_0x7a7c('0xb')](function(_0x3ee783){return _0x1ef13(_0x3ee783);});});}exports[_0x7a7c('0xc')]=function(_0x4dcec5,_0x5a65c2,_0x1fa1d1){return function(_0x30a341){if(_0x1fa1d1[_0x7a7c('0xd')]&&!_0x1fa1d1[_0x7a7c('0xd')][_0x4dcec5]){logger[_0x7a7c('0xe')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x4dcec5);return _0x30a341['stop']();}var _0x1d7170=[];for(var _0x25f8bf=0x0;_0x25f8bf<_0x5a65c2[_0x7a7c('0xf')];_0x25f8bf+=0x1){_0x1d7170[_0x7a7c('0x10')](request(_0x7a7c('0x11'),{'command':util[_0x7a7c('0x12')](_0x7a7c('0x13'),_0x5a65c2[_0x25f8bf])})['then'](function(_0x2835af){return _0x2835af&&_0x2835af[_0x7a7c('0x9')]&&_0x2835af[_0x7a7c('0x9')]['indexOf'](_0x7a7c('0x14'))>=0x0?!![]:![];})[_0x7a7c('0xb')](function(){logger[_0x7a7c('0x8')](_0x7a7c('0x15'),_0x4dcec5,_0x5a65c2[_0x25f8bf]);}));}BPromise[_0x7a7c('0x16')](_0x1d7170)[_0x7a7c('0x7')](function(_0x8920af){var _0x375246=_[_0x7a7c('0x17')](_0x8920af);logger['info'](_0x7a7c('0x18'),_0x4dcec5,_0x5a65c2[_0x7a7c('0x19')](_0x7a7c('0x1a')),_0x375246);_0x30a341[_0x7a7c('0x1b')](_0x375246);})['catch'](function(_0x29d51d){logger[_0x7a7c('0x8')](_0x7a7c('0x18'),_0x4dcec5,_0x5a65c2[_0x7a7c('0x19')](_0x7a7c('0x1a')),_0x29d51d[_0x7a7c('0x1c')]);_0x30a341['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index e58caa9..3b5f2f2 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 _0xa5fa=['[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','transfertype','secondtransfererexten','transferuniqueid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','acw','acwTimeout','CreateVoiceAgentReport','request','uniqueid','destuniqueid','[%s][agents][agentcalled]','called','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','holdtime','ringtime','talktime','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','reason','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','[%s][agents][blindtransfer]','attendedtransfer'];(function(_0x8eace3,_0x4e1772){var _0x5d5992=function(_0x41d0fc){while(--_0x41d0fc){_0x8eace3['push'](_0x8eace3['shift']());}};_0x5d5992(++_0x4e1772);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x29bfbe,_0x37060a){_0x29bfbe=_0x29bfbe-0x0;var _0x230663=_0xa5fa[_0x29bfbe];return _0x230663;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var utils=require(_0xaa5f('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x24d383,_0x1b7e1d){utils['info'](util[_0xaa5f('0x2')](_0xaa5f('0x3'),_0x24d383['uniqueid'],_0x24d383[_0xaa5f('0x4')],_0x24d383[_0xaa5f('0x5')],_0x24d383[_0xaa5f('0x6')],_0x24d383[_0xaa5f('0x7')],_0x24d383[_0xaa5f('0x8')],_0x24d383[_0xaa5f('0x9')],_0x24d383[_0xaa5f('0xa')]));if(_0x24d383[_0xaa5f('0x5')]){utils[_0xaa5f('0xb')](_0x24d383[_0xaa5f('0x5')])[_0xaa5f('0xc')](function(_0x4e5257){if(_0x4e5257){_0x24d383[_0xaa5f('0xd')]=_0x4e5257[_0xaa5f('0xd')];_0x24d383['agentacw']=_0x24d383['agentcomplete']?_0x4e5257[_0xaa5f('0xe')]:![];_0x24d383['acwtime']=_0x24d383['agentacw']?_0x4e5257[_0xaa5f('0xf')]:0x0;}utils['request'](_0xaa5f('0x10'),_0x24d383);});}else{utils[_0xaa5f('0x11')](_0xaa5f('0x10'),_0x24d383);}if(_0x1b7e1d){delete transfers[_0x24d383[_0xaa5f('0x12')]];}else{delete agents[_0x24d383[_0xaa5f('0x13')]];}}exports['agentcalled']=function(_0xbd4e10){try{utils['debug'](util[_0xaa5f('0x2')](_0xaa5f('0x14'),_0xbd4e10[_0xaa5f('0x12')]),_0xbd4e10);agents[_0xbd4e10[_0xaa5f('0x13')]]=_0xbd4e10;agents[_0xbd4e10[_0xaa5f('0x13')]]['agentcalledAt']=utils['now']();agents[_0xbd4e10[_0xaa5f('0x13')]][_0xaa5f('0xa')]=_0xaa5f('0x15');agents[_0xbd4e10[_0xaa5f('0x13')]][_0xaa5f('0x9')]=null;agents[_0xbd4e10[_0xaa5f('0x13')]][_0xaa5f('0x16')]=null;utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x18'),_0xbd4e10[_0xaa5f('0x12')],agents[_0xbd4e10[_0xaa5f('0x13')]]['membername'],_0xbd4e10[_0xaa5f('0x13')]));}catch(_0x4c0a9d){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x14'),_0xbd4e10[_0xaa5f('0x12')]),_0x4c0a9d);}};exports[_0xaa5f('0x1a')]=function(_0x194691){try{if(!_[_0xaa5f('0x1b')](agents[_0x194691[_0xaa5f('0x13')]])){utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')](_0xaa5f('0x1d'),_0x194691['uniqueid']),_0x194691);utils[_0xaa5f('0x17')](util['format'](_0xaa5f('0x1e'),_0x194691[_0xaa5f('0x12')],agents[_0x194691['destuniqueid']][_0xaa5f('0x6')],_0x194691[_0xaa5f('0x13')]));agents[_0x194691['destuniqueid']][_0xaa5f('0x1a')]=!![];agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0x1f')]=utils[_0xaa5f('0x20')]();agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0xa')]=_0xaa5f('0x21');agents[_0x194691[_0xaa5f('0x13')]]['reason']=_0xaa5f('0x21');agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0x22')]=_0x194691['ringtime']?parseInt(_0x194691[_0xaa5f('0x23')])/0x3e8:0x0;agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0x24')]=0x0;unanswered['push'](_0x194691[_0xaa5f('0x13')]);}}catch(_0x479f29){utils['error'](util[_0xaa5f('0x2')]('[%s][agents][agentringnoanswer]',_0x194691[_0xaa5f('0x12')]),_0x479f29);}};exports['queuecallerabandon']=function(_0x4c5dc0){try{_['forIn'](agents,function(_0x26a90d,_0x4ddebd){if(_0x26a90d[_0xaa5f('0x12')]==_0x4c5dc0[_0xaa5f('0x12')]&&!_['includes'](unanswered,_0x26a90d['destuniqueid'])){utils[_0xaa5f('0x1c')](util['format'](_0xaa5f('0x25'),_0x4c5dc0[_0xaa5f('0x12')]),_0x4c5dc0);utils['info'](util[_0xaa5f('0x2')](_0xaa5f('0x26'),_0x4c5dc0[_0xaa5f('0x12')],_0x26a90d['membername'],_0x26a90d[_0xaa5f('0x13')]));_0x26a90d[_0xaa5f('0x1a')]=!![];_0x26a90d['agentringnoanswerAt']=utils['now']();_0x26a90d['lastevent']='abandoned';_0x26a90d[_0xaa5f('0x27')]=_0xaa5f('0x28');_0x26a90d[_0xaa5f('0x22')]=_0x4c5dc0[_0xaa5f('0x22')];_0x26a90d[_0xaa5f('0x24')]=0x0;writeDB(_0x26a90d);}});}catch(_0x3bcaf6){utils[_0xaa5f('0x19')](util['format'](_0xaa5f('0x25'),_0x4c5dc0[_0xaa5f('0x12')]),_0x3bcaf6);}};exports[_0xaa5f('0x29')]=function(_0x1f3268){try{if(agents[_0x1f3268[_0xaa5f('0x13')]]){utils[_0xaa5f('0x1c')](util['format'](_0xaa5f('0x2a'),_0x1f3268[_0xaa5f('0x12')]),_0x1f3268);utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x2b'),_0x1f3268['uniqueid'],agents[_0x1f3268['destuniqueid']][_0xaa5f('0x6')],_0x1f3268[_0xaa5f('0x13')]));agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x2c')]=utils['now']();agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x9')]=_0x1f3268[_0xaa5f('0x9')];agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x16')]=_0x1f3268[_0xaa5f('0x16')];agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x22')]=_0x1f3268[_0xaa5f('0x23')];agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0xa')]='connect';_[_0xaa5f('0x2d')](agents,function(_0x2562ce,_0xcd9c30){if(_0x2562ce[_0xaa5f('0x13')]!=_0x1f3268[_0xaa5f('0x13')]&&_0x2562ce[_0xaa5f('0x12')]==_0x1f3268[_0xaa5f('0x12')]){_0x2562ce[_0xaa5f('0x24')]=0x0;_0x2562ce[_0xaa5f('0x22')]=_0x1f3268[_0xaa5f('0x23')];_0x2562ce['agentringnoanswer']=!![];_0x2562ce[_0xaa5f('0x1f')]=utils['now']();_0x2562ce[_0xaa5f('0xa')]=_0xaa5f('0x2e');_0x2562ce[_0xaa5f('0x27')]='answered_elsewhere';_0x2562ce[_0xaa5f('0x2f')]=_0x1f3268[_0xaa5f('0x13')];_0x2562ce[_0xaa5f('0x30')]=_0x1f3268['membername'];writeDB(_0x2562ce);}});}}catch(_0x12a8e4){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x2a'),_0x1f3268['uniqueid']),_0x12a8e4);}};exports[_0xaa5f('0x31')]=function(_0x2b2b4c){try{if(!_[_0xaa5f('0x1b')](agents[_0x2b2b4c[_0xaa5f('0x13')]])){utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')](_0xaa5f('0x32'),_0x2b2b4c[_0xaa5f('0x12')]),_0x2b2b4c);utils['info'](util[_0xaa5f('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2b2b4c[_0xaa5f('0x12')],agents[_0x2b2b4c['destuniqueid']][_0xaa5f('0x6')],_0x2b2b4c[_0xaa5f('0x13')]));agents[_0x2b2b4c['destuniqueid']][_0xaa5f('0x31')]=!![];agents[_0x2b2b4c[_0xaa5f('0x13')]][_0xaa5f('0x33')]=utils['now']();agents[_0x2b2b4c['destuniqueid']]['talktime']=utils[_0xaa5f('0x34')](agents[_0x2b2b4c['destuniqueid']][_0xaa5f('0x33')],agents[_0x2b2b4c[_0xaa5f('0x13')]][_0xaa5f('0x2c')]);agents[_0x2b2b4c[_0xaa5f('0x13')]]['reason']=_0x2b2b4c[_0xaa5f('0x27')];agents[_0x2b2b4c[_0xaa5f('0x13')]][_0xaa5f('0xa')]=_0xaa5f('0x35');writeDB(agents[_0x2b2b4c[_0xaa5f('0x13')]]);}}catch(_0x1f9629){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x32'),_0x2b2b4c[_0xaa5f('0x12')]),_0x1f9629);}};exports[_0xaa5f('0x36')]=function(_0x2de737){try{if(!_[_0xaa5f('0x1b')](agents[_0x2de737[_0xaa5f('0x37')]])){utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')]('[%s][agents][blindtransfer]',_0x2de737[_0xaa5f('0x12')]),_0x2de737);utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x38'),_0x2de737[_0xaa5f('0x12')],agents[_0x2de737[_0xaa5f('0x37')]][_0xaa5f('0x6')],agents[_0x2de737['transfereruniqueid']][_0xaa5f('0x12')]));agents[_0x2de737[_0xaa5f('0x37')]][_0xaa5f('0x39')]=!![];agents[_0x2de737[_0xaa5f('0x37')]]['transfertype']=_0xaa5f('0x3a');agents[_0x2de737[_0xaa5f('0x37')]][_0xaa5f('0x3b')]=_0x2de737['extension'];agents[_0x2de737['transfereruniqueid']]['transferuniqueid']=agents[_0x2de737['transfereruniqueid']]['uniqueid'];}}catch(_0x509c61){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x3c'),_0x2de737[_0xaa5f('0x12')]),_0x509c61);}};exports[_0xaa5f('0x3d')]=function(_0x17b872){try{utils['debug'](util['format'](_0xaa5f('0x3e'),_0x17b872[_0xaa5f('0x3f')]),_0x17b872);if(_0x17b872['origtransfereruniqueid']==_0x17b872[_0xaa5f('0x40')]){if(!_[_0xaa5f('0x1b')](agents[_0x17b872[_0xaa5f('0x41')]])){utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x42'),_0x17b872[_0xaa5f('0x3f')],agents[_0x17b872['secondtransfereruniqueid']]['membername']));agents[_0x17b872[_0xaa5f('0x41')]][_0xaa5f('0x39')]=!![];agents[_0x17b872['secondtransfereruniqueid']]['transfertype']='ATTENDED';agents[_0x17b872[_0xaa5f('0x41')]]['transferexten']=_0x17b872[_0xaa5f('0x43')];agents[_0x17b872['secondtransfereruniqueid']]['transferuniqueid']=_0x17b872[_0xaa5f('0x3f')];}if(_0x17b872[_0xaa5f('0x44')]&&agents[_0x17b872[_0xaa5f('0x44')]]){agents[_0x17b872['transfereeuniqueid']][_0xaa5f('0x45')]=0x1;transfers[_0x17b872[_0xaa5f('0x44')]]=_[_0xaa5f('0x46')](agents[_0x17b872['transfereeuniqueid']]);transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x8')]=agents[_0x17b872['secondtransfereruniqueid']][_0xaa5f('0x8')];transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x47')]=agents[_0x17b872[_0xaa5f('0x41')]][_0xaa5f('0x47')];transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x48')]=utils[_0xaa5f('0x20')]();transfers[_0x17b872[_0xaa5f('0x44')]]['agentconnectAt']=utils[_0xaa5f('0x20')]();transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x22')]=0x0;transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x45')]=0x2;}}else if(_0x17b872[_0xaa5f('0x41')]==_0x17b872[_0xaa5f('0x49')]){if(!_[_0xaa5f('0x1b')](agents[_0x17b872['origtransfereruniqueid']])){utils[_0xaa5f('0x17')](util['format'](_0xaa5f('0x42'),_0x17b872[_0xaa5f('0x3f')],agents[_0x17b872[_0xaa5f('0x3f')]][_0xaa5f('0x6')]));agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x39')]=!![];agents[_0x17b872[_0xaa5f('0x3f')]][_0xaa5f('0x4a')]='ATTENDED';agents[_0x17b872[_0xaa5f('0x3f')]]['transferexten']=_0x17b872[_0xaa5f('0x4b')];agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x4c')]=_0x17b872[_0xaa5f('0x41')];}if(_0x17b872[_0xaa5f('0x4d')]&&agents[_0x17b872[_0xaa5f('0x4d')]]){agents[_0x17b872['transfertargetuniqueid']][_0xaa5f('0x45')]=0x1;transfers[_0x17b872[_0xaa5f('0x4d')]]=_['clone'](agents[_0x17b872['transfertargetuniqueid']]);transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x8')]=agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x8')];transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x47')]=agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x47')];transfers[_0x17b872[_0xaa5f('0x4d')]]['agentcalledAt']=utils[_0xaa5f('0x20')]();transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x2c')]=utils['now']();transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x22')]=0x0;transfers[_0x17b872['transfertargetuniqueid']][_0xaa5f('0x45')]=0x2;}}}catch(_0x309605){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x3e'),_0x17b872['origtransfereruniqueid']),_0x309605);}};exports[_0xaa5f('0x4e')]=function(_0x2ba378){try{utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')](_0xaa5f('0x4f'),_0x2ba378['uniqueid']),_0x2ba378);if(agents[_0x2ba378[_0xaa5f('0x12')]]&&agents[_0x2ba378['uniqueid']][_0xaa5f('0x27')]===_0xaa5f('0x21')){if(_0x2ba378[_0xaa5f('0x50')]==='21'){agents[_0x2ba378[_0xaa5f('0x12')]]['reason']=_0xaa5f('0x51');agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]=_0xaa5f('0x51');}utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2ba378['uniqueid'],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x6')],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')],agents[_0x2ba378[_0xaa5f('0x12')]]['lastevent']));writeDB(agents[_0x2ba378['uniqueid']]);var _0x104079=unanswered[_0xaa5f('0x52')](_0x2ba378['uniqueid']);if(_0x104079>-0x1){unanswered[_0xaa5f('0x53')](_0x104079,0x1);}}if(transfers[_0x2ba378['uniqueid']]){transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x31')]=!![];transfers[_0x2ba378['uniqueid']][_0xaa5f('0x33')]=utils[_0xaa5f('0x20')]();transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x24')]=utils[_0xaa5f('0x34')](transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x33')],transfers[_0x2ba378['uniqueid']][_0xaa5f('0x2c')]);transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')]='agent';transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]=_0xaa5f('0x35');utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2ba378[_0xaa5f('0x12')],transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x6')],transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')],transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]));writeDB(transfers[_0x2ba378[_0xaa5f('0x12')]],!![]);}if(agents[_0x2ba378[_0xaa5f('0x12')]]&&agents[_0x2ba378[_0xaa5f('0x12')]]['agentconnectAt']){agents[_0x2ba378['uniqueid']][_0xaa5f('0x31')]=!![];agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x33')]=utils[_0xaa5f('0x20')]();agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x24')]=utils[_0xaa5f('0x34')](agents[_0x2ba378[_0xaa5f('0x12')]]['agentcompleteAt'],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x2c')]);agents[_0x2ba378[_0xaa5f('0x12')]]['reason']=agents[_0x2ba378['uniqueid']][_0xaa5f('0x39')]?_0xaa5f('0x39'):_0xaa5f('0x54');agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]=_0xaa5f('0x35');utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x55'),_0x2ba378[_0xaa5f('0x12')],agents[_0x2ba378['uniqueid']][_0xaa5f('0x6')],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]));writeDB(agents[_0x2ba378['uniqueid']]);}}catch(_0x4183c0){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')]('[%s][agents][hangup]',_0x2ba378['uniqueid']),_0x4183c0);}}; \ No newline at end of file +var _0xe1e3=['agentcompleteAt','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transferexten','transfereeuniqueid','calleridname','agentcalledAt','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transferuniqueid','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','complete','lodash','util','format','uniqueid','channel','queue','membername','interface','calleridnum','lastevent','getVoiceQueueByName','then','agentcomplete','acwtime','agentacw','acwTimeout','CreateVoiceAgentReport','[%s][agents][agentcalled]','destuniqueid','now','called','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','debug','agentringnoanswer','agentringnoanswerAt','timeout','talktime','error','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','abandoned','reason','holdtime','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinenum','connectedlinename','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime'];(function(_0x344959,_0x2cd012){var _0x50462b=function(_0x169592){while(--_0x169592){_0x344959['push'](_0x344959['shift']());}};_0x50462b(++_0x2cd012);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x4cdc5e,_0x28053c){_0x4cdc5e=_0x4cdc5e-0x0;var _0x57295d=_0xe1e3[_0x4cdc5e];return _0x57295d;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0xdbdabb,_0x5e9f9a){utils['info'](util[_0x3e1e('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0xdbdabb[_0x3e1e('0x3')],_0xdbdabb[_0x3e1e('0x4')],_0xdbdabb[_0x3e1e('0x5')],_0xdbdabb[_0x3e1e('0x6')],_0xdbdabb[_0x3e1e('0x7')],_0xdbdabb[_0x3e1e('0x8')],_0xdbdabb['connectedlinenum'],_0xdbdabb[_0x3e1e('0x9')]));if(_0xdbdabb[_0x3e1e('0x5')]){utils[_0x3e1e('0xa')](_0xdbdabb[_0x3e1e('0x5')])[_0x3e1e('0xb')](function(_0x1e5173){if(_0x1e5173){_0xdbdabb['type']=_0x1e5173['type'];_0xdbdabb['agentacw']=_0xdbdabb[_0x3e1e('0xc')]?_0x1e5173['acw']:![];_0xdbdabb[_0x3e1e('0xd')]=_0xdbdabb[_0x3e1e('0xe')]?_0x1e5173[_0x3e1e('0xf')]:0x0;}utils['request'](_0x3e1e('0x10'),_0xdbdabb);});}else{utils['request']('CreateVoiceAgentReport',_0xdbdabb);}if(_0x5e9f9a){delete transfers[_0xdbdabb['uniqueid']];}else{delete agents[_0xdbdabb['destuniqueid']];}}exports['agentcalled']=function(_0x14ad58){try{utils['debug'](util['format'](_0x3e1e('0x11'),_0x14ad58[_0x3e1e('0x3')]),_0x14ad58);agents[_0x14ad58[_0x3e1e('0x12')]]=_0x14ad58;agents[_0x14ad58['destuniqueid']]['agentcalledAt']=utils[_0x3e1e('0x13')]();agents[_0x14ad58[_0x3e1e('0x12')]]['lastevent']=_0x3e1e('0x14');agents[_0x14ad58[_0x3e1e('0x12')]]['connectedlinenum']=null;agents[_0x14ad58[_0x3e1e('0x12')]]['connectedlinename']=null;utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x16'),_0x14ad58[_0x3e1e('0x3')],agents[_0x14ad58[_0x3e1e('0x12')]][_0x3e1e('0x6')],_0x14ad58['destuniqueid']));}catch(_0x5dccb8){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x11'),_0x14ad58[_0x3e1e('0x3')]),_0x5dccb8);}};exports['agentringnoanswer']=function(_0x1c5acd){try{if(!_['isNil'](agents[_0x1c5acd[_0x3e1e('0x12')]])){utils[_0x3e1e('0x17')](util[_0x3e1e('0x2')]('[%s][agents][agentringnoanswer]',_0x1c5acd[_0x3e1e('0x3')]),_0x1c5acd);utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x1c5acd['uniqueid'],agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x6')],_0x1c5acd['destuniqueid']));agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x18')]=!![];agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x19')]=utils[_0x3e1e('0x13')]();agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x9')]=_0x3e1e('0x1a');agents[_0x1c5acd['destuniqueid']]['reason']=_0x3e1e('0x1a');agents[_0x1c5acd[_0x3e1e('0x12')]]['holdtime']=_0x1c5acd['ringtime']?parseInt(_0x1c5acd['ringtime'])/0x3e8:0x0;agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x1b')]=0x0;unanswered['push'](_0x1c5acd[_0x3e1e('0x12')]);}}catch(_0x5ac814){utils[_0x3e1e('0x1c')](util[_0x3e1e('0x2')]('[%s][agents][agentringnoanswer]',_0x1c5acd[_0x3e1e('0x3')]),_0x5ac814);}};exports[_0x3e1e('0x1d')]=function(_0x45ed0e){try{_['forIn'](agents,function(_0xdef39,_0x4ec149){if(_0xdef39['uniqueid']==_0x45ed0e['uniqueid']&&!_[_0x3e1e('0x1e')](unanswered,_0xdef39['destuniqueid'])){utils['debug'](util[_0x3e1e('0x2')](_0x3e1e('0x1f'),_0x45ed0e[_0x3e1e('0x3')]),_0x45ed0e);utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x45ed0e['uniqueid'],_0xdef39['membername'],_0xdef39['destuniqueid']));_0xdef39[_0x3e1e('0x18')]=!![];_0xdef39[_0x3e1e('0x19')]=utils[_0x3e1e('0x13')]();_0xdef39[_0x3e1e('0x9')]=_0x3e1e('0x20');_0xdef39[_0x3e1e('0x21')]=_0x3e1e('0x20');_0xdef39[_0x3e1e('0x22')]=_0x45ed0e['holdtime'];_0xdef39[_0x3e1e('0x1b')]=0x0;writeDB(_0xdef39);}});}catch(_0x348ef5){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x1f'),_0x45ed0e[_0x3e1e('0x3')]),_0x348ef5);}};exports[_0x3e1e('0x23')]=function(_0x55a082){try{if(agents[_0x55a082['destuniqueid']]){utils[_0x3e1e('0x17')](util[_0x3e1e('0x2')]('[%s][agents][agentconnect]',_0x55a082[_0x3e1e('0x3')]),_0x55a082);utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x24'),_0x55a082[_0x3e1e('0x3')],agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x6')],_0x55a082[_0x3e1e('0x12')]));agents[_0x55a082['destuniqueid']][_0x3e1e('0x25')]=utils[_0x3e1e('0x13')]();agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x26')]=_0x55a082['connectedlinenum'];agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x27')]=_0x55a082[_0x3e1e('0x27')];agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x22')]=_0x55a082[_0x3e1e('0x28')];agents[_0x55a082[_0x3e1e('0x12')]]['lastevent']=_0x3e1e('0x29');_['forIn'](agents,function(_0x53bdf5,_0x4f598e){if(_0x53bdf5[_0x3e1e('0x12')]!=_0x55a082[_0x3e1e('0x12')]&&_0x53bdf5['uniqueid']==_0x55a082[_0x3e1e('0x3')]){_0x53bdf5[_0x3e1e('0x1b')]=0x0;_0x53bdf5['holdtime']=_0x55a082[_0x3e1e('0x28')];_0x53bdf5[_0x3e1e('0x18')]=!![];_0x53bdf5['agentringnoanswerAt']=utils['now']();_0x53bdf5[_0x3e1e('0x9')]='answered_elsewhere';_0x53bdf5['reason']=_0x3e1e('0x2a');_0x53bdf5[_0x3e1e('0x2b')]=_0x55a082[_0x3e1e('0x12')];_0x53bdf5[_0x3e1e('0x2c')]=_0x55a082[_0x3e1e('0x6')];writeDB(_0x53bdf5);}});}}catch(_0x55ea1d){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x2d'),_0x55a082[_0x3e1e('0x3')]),_0x55ea1d);}};exports['agentcomplete']=function(_0x1124d0){try{if(!_[_0x3e1e('0x2e')](agents[_0x1124d0[_0x3e1e('0x12')]])){utils['debug'](util[_0x3e1e('0x2')]('[%s][agents][agentcomplete]',_0x1124d0['uniqueid']),_0x1124d0);utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x2f'),_0x1124d0[_0x3e1e('0x3')],agents[_0x1124d0['destuniqueid']]['membername'],_0x1124d0['destuniqueid']));agents[_0x1124d0['destuniqueid']][_0x3e1e('0xc')]=!![];agents[_0x1124d0[_0x3e1e('0x12')]]['agentcompleteAt']=utils['now']();agents[_0x1124d0[_0x3e1e('0x12')]][_0x3e1e('0x1b')]=utils[_0x3e1e('0x30')](agents[_0x1124d0['destuniqueid']][_0x3e1e('0x31')],agents[_0x1124d0['destuniqueid']][_0x3e1e('0x25')]);agents[_0x1124d0[_0x3e1e('0x12')]][_0x3e1e('0x21')]=_0x1124d0[_0x3e1e('0x21')];agents[_0x1124d0[_0x3e1e('0x12')]][_0x3e1e('0x9')]='complete';writeDB(agents[_0x1124d0[_0x3e1e('0x12')]]);}}catch(_0x1ce1cd){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x32'),_0x1124d0['uniqueid']),_0x1ce1cd);}};exports[_0x3e1e('0x33')]=function(_0x347b3f){try{if(!_[_0x3e1e('0x2e')](agents[_0x347b3f[_0x3e1e('0x34')]])){utils['debug'](util[_0x3e1e('0x2')](_0x3e1e('0x35'),_0x347b3f[_0x3e1e('0x3')]),_0x347b3f);utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x36'),_0x347b3f[_0x3e1e('0x3')],agents[_0x347b3f[_0x3e1e('0x34')]][_0x3e1e('0x6')],agents[_0x347b3f[_0x3e1e('0x34')]][_0x3e1e('0x3')]));agents[_0x347b3f[_0x3e1e('0x34')]][_0x3e1e('0x37')]=!![];agents[_0x347b3f['transfereruniqueid']][_0x3e1e('0x38')]='blind';agents[_0x347b3f['transfereruniqueid']]['transferexten']=_0x347b3f[_0x3e1e('0x39')];agents[_0x347b3f[_0x3e1e('0x34')]]['transferuniqueid']=agents[_0x347b3f[_0x3e1e('0x34')]]['uniqueid'];}}catch(_0x5b2416){utils[_0x3e1e('0x1c')](util['format']('[%s][agents][blindtransfer]',_0x347b3f['uniqueid']),_0x5b2416);}};exports[_0x3e1e('0x3a')]=function(_0xe577b2){try{utils[_0x3e1e('0x17')](util[_0x3e1e('0x2')](_0x3e1e('0x3b'),_0xe577b2[_0x3e1e('0x3c')]),_0xe577b2);if(_0xe577b2[_0x3e1e('0x3c')]==_0xe577b2['origtransfererlinkedid']){if(!_[_0x3e1e('0x2e')](agents[_0xe577b2['secondtransfereruniqueid']])){utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x3d'),_0xe577b2['origtransfereruniqueid'],agents[_0xe577b2['secondtransfereruniqueid']][_0x3e1e('0x6')]));agents[_0xe577b2[_0x3e1e('0x3e')]]['transfer']=!![];agents[_0xe577b2[_0x3e1e('0x3e')]]['transfertype']='ATTENDED';agents[_0xe577b2[_0x3e1e('0x3e')]][_0x3e1e('0x3f')]=_0xe577b2['origtransfererexten'];agents[_0xe577b2[_0x3e1e('0x3e')]]['transferuniqueid']=_0xe577b2['origtransfereruniqueid'];}if(_0xe577b2[_0x3e1e('0x40')]&&agents[_0xe577b2['transfereeuniqueid']]){agents[_0xe577b2[_0x3e1e('0x40')]]['agententerreason']=0x1;transfers[_0xe577b2[_0x3e1e('0x40')]]=_['clone'](agents[_0xe577b2[_0x3e1e('0x40')]]);transfers[_0xe577b2[_0x3e1e('0x40')]]['calleridnum']=agents[_0xe577b2['secondtransfereruniqueid']]['calleridnum'];transfers[_0xe577b2[_0x3e1e('0x40')]][_0x3e1e('0x41')]=agents[_0xe577b2[_0x3e1e('0x3e')]]['calleridname'];transfers[_0xe577b2[_0x3e1e('0x40')]][_0x3e1e('0x42')]=utils[_0x3e1e('0x13')]();transfers[_0xe577b2['transfereeuniqueid']]['agentconnectAt']=utils[_0x3e1e('0x13')]();transfers[_0xe577b2['transfereeuniqueid']][_0x3e1e('0x22')]=0x0;transfers[_0xe577b2[_0x3e1e('0x40')]][_0x3e1e('0x43')]=0x2;}}else if(_0xe577b2['secondtransfereruniqueid']==_0xe577b2[_0x3e1e('0x44')]){if(!_['isNil'](agents[_0xe577b2[_0x3e1e('0x3c')]])){utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x3d'),_0xe577b2['origtransfereruniqueid'],agents[_0xe577b2[_0x3e1e('0x3c')]]['membername']));agents[_0xe577b2[_0x3e1e('0x3c')]]['transfer']=!![];agents[_0xe577b2[_0x3e1e('0x3c')]][_0x3e1e('0x38')]=_0x3e1e('0x45');agents[_0xe577b2['origtransfereruniqueid']][_0x3e1e('0x3f')]=_0xe577b2[_0x3e1e('0x46')];agents[_0xe577b2['origtransfereruniqueid']][_0x3e1e('0x47')]=_0xe577b2['secondtransfereruniqueid'];}if(_0xe577b2['transfertargetuniqueid']&&agents[_0xe577b2['transfertargetuniqueid']]){agents[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x43')]=0x1;transfers[_0xe577b2[_0x3e1e('0x48')]]=_[_0x3e1e('0x49')](agents[_0xe577b2[_0x3e1e('0x48')]]);transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x8')]=agents[_0xe577b2['origtransfereruniqueid']][_0x3e1e('0x8')];transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x41')]=agents[_0xe577b2[_0x3e1e('0x3c')]][_0x3e1e('0x41')];transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x42')]=utils[_0x3e1e('0x13')]();transfers[_0xe577b2['transfertargetuniqueid']]['agentconnectAt']=utils[_0x3e1e('0x13')]();transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x22')]=0x0;transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x43')]=0x2;}}}catch(_0x2e950d){utils[_0x3e1e('0x1c')](util[_0x3e1e('0x2')](_0x3e1e('0x3b'),_0xe577b2[_0x3e1e('0x3c')]),_0x2e950d);}};exports[_0x3e1e('0x4a')]=function(_0x50ba57){try{utils['debug'](util['format'](_0x3e1e('0x4b'),_0x50ba57[_0x3e1e('0x3')]),_0x50ba57);if(agents[_0x50ba57[_0x3e1e('0x3')]]&&agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')]==='timeout'){if(_0x50ba57[_0x3e1e('0x4c')]==='21'){agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')]=_0x3e1e('0x4d');agents[_0x50ba57[_0x3e1e('0x3')]]['lastevent']=_0x3e1e('0x4d');}utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x4e'),_0x50ba57[_0x3e1e('0x3')],agents[_0x50ba57[_0x3e1e('0x3')]]['membername'],agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')],agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x9')]));writeDB(agents[_0x50ba57[_0x3e1e('0x3')]]);var _0x372581=unanswered['indexOf'](_0x50ba57[_0x3e1e('0x3')]);if(_0x372581>-0x1){unanswered[_0x3e1e('0x4f')](_0x372581,0x1);}}if(transfers[_0x50ba57[_0x3e1e('0x3')]]){transfers[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0xc')]=!![];transfers[_0x50ba57[_0x3e1e('0x3')]]['agentcompleteAt']=utils[_0x3e1e('0x13')]();transfers[_0x50ba57['uniqueid']][_0x3e1e('0x1b')]=utils[_0x3e1e('0x30')](transfers[_0x50ba57['uniqueid']][_0x3e1e('0x31')],transfers[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x25')]);transfers[_0x50ba57[_0x3e1e('0x3')]]['reason']=_0x3e1e('0x50');transfers[_0x50ba57['uniqueid']][_0x3e1e('0x9')]=_0x3e1e('0x51');utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x4e'),_0x50ba57[_0x3e1e('0x3')],transfers[_0x50ba57['uniqueid']][_0x3e1e('0x6')],transfers[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')],transfers[_0x50ba57[_0x3e1e('0x3')]]['lastevent']));writeDB(transfers[_0x50ba57[_0x3e1e('0x3')]],!![]);}if(agents[_0x50ba57[_0x3e1e('0x3')]]&&agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x25')]){agents[_0x50ba57['uniqueid']][_0x3e1e('0xc')]=!![];agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x31')]=utils[_0x3e1e('0x13')]();agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x1b')]=utils['diffTime'](agents[_0x50ba57['uniqueid']]['agentcompleteAt'],agents[_0x50ba57[_0x3e1e('0x3')]]['agentconnectAt']);agents[_0x50ba57[_0x3e1e('0x3')]]['reason']=agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x37')]?_0x3e1e('0x37'):_0x3e1e('0x50');agents[_0x50ba57['uniqueid']][_0x3e1e('0x9')]='complete';utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x4e'),_0x50ba57[_0x3e1e('0x3')],agents[_0x50ba57['uniqueid']][_0x3e1e('0x6')],agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')],agents[_0x50ba57['uniqueid']]['lastevent']));writeDB(agents[_0x50ba57[_0x3e1e('0x3')]]);}}catch(_0x20bb6d){utils[_0x3e1e('0x1c')](util['format'](_0x3e1e('0x4b'),_0x50ba57['uniqueid']),_0x20bb6d);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index ec66f96..22da36e 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 _0xef01=['[%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','set','cdr','substring','lastIndexOf','includes','noop','gotoif','lastdata','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','request','CreateVoiceCallReport','debug','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','context','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','hangup','[%s][calls][hangup]','callerid','endtime','duration','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid'];(function(_0x129c1a,_0x56436b){var _0x21ca14=function(_0x153d79){while(--_0x153d79){_0x129c1a['push'](_0x129c1a['shift']());}};_0x21ca14(++_0x56436b);}(_0xef01,0xdc));var _0x1ef0=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xef01[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x1ef0('0x0'));var util=require(_0x1ef0('0x1'));var utils=require(_0x1ef0('0x2'));var dispositions=[_0x1ef0('0x3'),'FAILED',_0x1ef0('0x4'),_0x1ef0('0x3'),_0x1ef0('0x3'),'NO\x20ANSWER',_0x1ef0('0x5'),_0x1ef0('0x6'),_0x1ef0('0x4'),_0x1ef0('0x4'),_0x1ef0('0x4')];var channels={};function writeDB(_0x3c0b58){utils['info'](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3c0b58[_0x1ef0('0x7')],_0x3c0b58[_0x1ef0('0x8')],_0x3c0b58[_0x1ef0('0x9')],_0x3c0b58[_0x1ef0('0xa')],_0x3c0b58[_0x1ef0('0xb')],_0x3c0b58[_0x1ef0('0xc')],_0x3c0b58[_0x1ef0('0xd')],_0x3c0b58[_0x1ef0('0xe')]));if(_0x3c0b58['accountcode']){utils[_0x1ef0('0xf')](_0x3c0b58[_0x1ef0('0x10')])['then'](function(_0x536259){if(_0x536259){_0x3c0b58['UserId']=_0x536259['id'];}utils[_0x1ef0('0x11')](_0x1ef0('0x12'),_0x3c0b58);});}else{utils[_0x1ef0('0x11')](_0x1ef0('0x12'),_0x3c0b58);}if(channels[_0x3c0b58[_0x1ef0('0x7')]]){delete channels[_0x3c0b58['uniqueid']];}}exports['newchannel']=function(_0x217afe){try{utils[_0x1ef0('0x13')](util[_0x1ef0('0x14')](_0x1ef0('0x15'),_0x217afe[_0x1ef0('0x7')]),_0x217afe);if(_0x217afe[_0x1ef0('0x7')]==_0x217afe[_0x1ef0('0x16')]&&_0x217afe[_0x1ef0('0x8')]!=_0x1ef0('0x17')){utils[_0x1ef0('0x18')](util[_0x1ef0('0x14')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x217afe['uniqueid'],_0x217afe[_0x1ef0('0x19')],_0x217afe[_0x1ef0('0x1a')]));channels[_0x217afe['uniqueid']]={'uniqueid':_0x217afe['uniqueid'],'accountcode':_0x217afe['accountcode'],'source':_0x217afe[_0x1ef0('0xc')],'destination':_0x217afe[_0x1ef0('0x1a')],'destinationcontext':_0x217afe[_0x1ef0('0x19')],'channel':_0x217afe[_0x1ef0('0x8')],'starttime':utils[_0x1ef0('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x1ef0('0x3'),'amaflags':_0x1ef0('0x1c')};}}catch(_0x318219){utils[_0x1ef0('0x1d')](util['format'](_0x1ef0('0x15'),_0x217afe[_0x1ef0('0x7')]),_0x318219);}};exports['newstate']=function(_0x14db4a){try{utils[_0x1ef0('0x13')](util[_0x1ef0('0x14')](_0x1ef0('0x1e'),_0x14db4a[_0x1ef0('0x7')]),_0x14db4a);if(!_[_0x1ef0('0x1f')](channels[_0x14db4a['uniqueid']])&&_0x14db4a[_0x1ef0('0x20')]==0x6){utils['info'](util[_0x1ef0('0x14')](_0x1ef0('0x21'),_0x14db4a[_0x1ef0('0x7')],_0x14db4a[_0x1ef0('0x19')],_0x14db4a['channel']));if(_[_0x1ef0('0x1f')](channels[_0x14db4a[_0x1ef0('0x7')]]['systemanswertime'])){channels[_0x14db4a[_0x1ef0('0x7')]][_0x1ef0('0x22')]=utils[_0x1ef0('0x1b')]();}}else if(!_['isNil'](channels[_0x14db4a[_0x1ef0('0x16')]])&&_0x14db4a[_0x1ef0('0x20')]==0x6&&_0x14db4a[_0x1ef0('0x19')]!='transfer'){utils[_0x1ef0('0x18')](util[_0x1ef0('0x14')](_0x1ef0('0x23'),_0x14db4a[_0x1ef0('0x7')],_0x14db4a['linkedid'],_0x14db4a['context'],_0x14db4a[_0x1ef0('0x8')]));channels[_0x14db4a[_0x1ef0('0x16')]][_0x1ef0('0x10')]=_0x14db4a[_0x1ef0('0x10')];channels[_0x14db4a[_0x1ef0('0x16')]][_0x1ef0('0x24')]=_0x14db4a[_0x1ef0('0x8')];if(_['isNil'](channels[_0x14db4a['linkedid']][_0x1ef0('0x25')])){channels[_0x14db4a['linkedid']]['answertime']=utils['now']();}channels[_0x14db4a['linkedid']]['disposition']=dispositions[_['toNumber'](_0x14db4a[_0x1ef0('0x20')])]||_0x1ef0('0x5');}}catch(_0x1398e9){utils['error'](util[_0x1ef0('0x14')]('[%s][calls][newstate]',_0x14db4a['uniqueid']),_0x1398e9);}};exports[_0x1ef0('0x26')]=function(_0x1f7b07){try{if(!_[_0x1ef0('0x1f')](channels[_0x1f7b07[_0x1ef0('0x7')]])){utils[_0x1ef0('0x13')](util[_0x1ef0('0x14')](_0x1ef0('0x27'),_0x1f7b07[_0x1ef0('0x7')]),_0x1f7b07);if(_[_0x1ef0('0x1f')](channels[_0x1f7b07['uniqueid']][_0x1ef0('0x28')])){channels[_0x1f7b07[_0x1ef0('0x7')]]['callerid']=_0x1f7b07['calleridname']+'\x20<'+_0x1f7b07[_0x1ef0('0xc')]+'>';}utils[_0x1ef0('0x18')](util[_0x1ef0('0x14')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x1f7b07[_0x1ef0('0x7')],channels[_0x1f7b07[_0x1ef0('0x7')]][_0x1ef0('0x28')],_0x1f7b07['cause-txt']));channels[_0x1f7b07['uniqueid']][_0x1ef0('0x29')]=utils[_0x1ef0('0x1b')]();channels[_0x1f7b07[_0x1ef0('0x7')]][_0x1ef0('0x2a')]=utils['diffTime'](channels[_0x1f7b07['uniqueid']][_0x1ef0('0x29')],channels[_0x1f7b07[_0x1ef0('0x7')]][_0x1ef0('0x2b')]);channels[_0x1f7b07[_0x1ef0('0x7')]][_0x1ef0('0x2c')]=channels[_0x1f7b07[_0x1ef0('0x7')]]['answertime']?utils[_0x1ef0('0x2d')](channels[_0x1f7b07[_0x1ef0('0x7')]][_0x1ef0('0x29')],channels[_0x1f7b07[_0x1ef0('0x7')]][_0x1ef0('0x25')]):0x0;writeDB(channels[_0x1f7b07[_0x1ef0('0x7')]]);}}catch(_0x3bd717){utils[_0x1ef0('0x1d')](util[_0x1ef0('0x14')](_0x1ef0('0x27'),_0x1f7b07[_0x1ef0('0x7')]),_0x3bd717);}};exports[_0x1ef0('0x2e')]=function(_0x578184){try{if(!_['isNil'](channels[_0x578184[_0x1ef0('0x2f')]])){utils[_0x1ef0('0x13')](util[_0x1ef0('0x14')]('[%s][calls][attendedtransfer]',_0x578184[_0x1ef0('0x30')]),_0x578184);if(channels[_0x578184[_0x1ef0('0x2f')]][_0x1ef0('0x8')]==_0x578184[_0x1ef0('0x31')]){utils[_0x1ef0('0x18')](util[_0x1ef0('0x14')](_0x1ef0('0x32'),_0x578184[_0x1ef0('0x30')],_0x578184[_0x1ef0('0x2f')],_0x578184[_0x1ef0('0x33')]));channels[_0x578184['localtwolinkedid']]['destinationchannel']=_0x578184[_0x1ef0('0x33')];channels[_0x578184['localtwolinkedid']][_0x1ef0('0x34')]='_attended';}else if(channels[_0x578184[_0x1ef0('0x2f')]]['channel']=_0x578184[_0x1ef0('0x35')]){utils[_0x1ef0('0x18')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x578184[_0x1ef0('0x30')],_0x578184[_0x1ef0('0x2f')],_0x578184[_0x1ef0('0x36')]));channels[_0x578184[_0x1ef0('0x2f')]][_0x1ef0('0x24')]=_0x578184[_0x1ef0('0x36')];channels[_0x578184[_0x1ef0('0x2f')]][_0x1ef0('0x34')]=_0x1ef0('0x37');}}}catch(_0x4d778c){utils['error'](util[_0x1ef0('0x14')](_0x1ef0('0x38'),_0x578184[_0x1ef0('0x30')]),_0x4d778c);}};exports[_0x1ef0('0x39')]=function(_0x349eb4){try{if(!_[_0x1ef0('0x1f')](channels[_0x349eb4[_0x1ef0('0x7')]])){utils[_0x1ef0('0x13')](util[_0x1ef0('0x14')](_0x1ef0('0x3a'),_0x349eb4['uniqueid']),_0x349eb4);channels[_0x349eb4[_0x1ef0('0x7')]]['musiconholdstartAt']=utils[_0x1ef0('0x1b')]();utils[_0x1ef0('0x18')](util[_0x1ef0('0x14')](_0x1ef0('0x3b'),_0x349eb4[_0x1ef0('0x7')],channels[_0x349eb4[_0x1ef0('0x7')]][_0x1ef0('0x3c')]));}}catch(_0x42150f){utils[_0x1ef0('0x1d')](util[_0x1ef0('0x14')](_0x1ef0('0x3a'),_0x349eb4[_0x1ef0('0x7')]),_0x42150f);}};exports[_0x1ef0('0x3d')]=function(_0x3d0847){try{if(!_['isNil'](channels[_0x3d0847[_0x1ef0('0x7')]])){utils[_0x1ef0('0x13')](util[_0x1ef0('0x14')](_0x1ef0('0x3e'),_0x3d0847['uniqueid']),_0x3d0847);if(!_['isNil'](channels[_0x3d0847[_0x1ef0('0x7')]]['musiconholdstartAt'])){channels[_0x3d0847['uniqueid']][_0x1ef0('0x3f')]+=utils['diffTime'](utils[_0x1ef0('0x1b')](),channels[_0x3d0847[_0x1ef0('0x7')]][_0x1ef0('0x3c')]);utils['info'](util[_0x1ef0('0x14')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x3d0847[_0x1ef0('0x7')],channels[_0x3d0847[_0x1ef0('0x7')]][_0x1ef0('0x3f')]));delete channels[_0x3d0847[_0x1ef0('0x7')]][_0x1ef0('0x3c')];}}}catch(_0x5c2e54){utils['error'](util['format'](_0x1ef0('0x3e'),_0x3d0847['uniqueid']),_0x5c2e54);}};exports[_0x1ef0('0x40')]=function(_0x230b07){try{if(!_[_0x1ef0('0x1f')](channels[_0x230b07['uniqueid']])){utils[_0x1ef0('0x13')](util[_0x1ef0('0x14')](_0x1ef0('0x41'),_0x230b07[_0x1ef0('0x7')]),_0x230b07);if(!_[_0x1ef0('0x1f')](_0x230b07[_0x1ef0('0x42')][_0x1ef0('0x43')])){utils[_0x1ef0('0x18')](util['format'](_0x1ef0('0x44'),_0x230b07['uniqueid'],_0x230b07[_0x1ef0('0x45')]));channels[_0x230b07[_0x1ef0('0x7')]]['source']=_0x230b07['value'];}if(!_['isNil'](_0x230b07[_0x1ef0('0x42')]['xmd-phone'])){utils[_0x1ef0('0x18')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x230b07[_0x1ef0('0x7')],_0x230b07['value']));channels[_0x230b07[_0x1ef0('0x7')]]['destination']=_0x230b07['value'];channels[_0x230b07[_0x1ef0('0x7')]][_0x1ef0('0x28')]='\x22'+_0x230b07[_0x1ef0('0x45')]+'\x22\x20<'+_0x230b07[_0x1ef0('0x45')]+'>';}if(!_[_0x1ef0('0x1f')](_0x230b07[_0x1ef0('0x42')][_0x1ef0('0x46')])||!_[_0x1ef0('0x1f')](_0x230b07[_0x1ef0('0x42')]['xmd-callerid'])){utils[_0x1ef0('0x18')](util[_0x1ef0('0x14')](_0x1ef0('0x47'),_0x230b07['uniqueid'],!_[_0x1ef0('0x1f')](_0x230b07['variable'][_0x1ef0('0x46')])?_0x1ef0('0x46'):'xmd-callerid',_0x230b07['value']));channels[_0x230b07['uniqueid']][_0x1ef0('0x28')]=_0x230b07['value'];}if(!_['isNil'](_0x230b07[_0x1ef0('0x42')][_0x1ef0('0x48')])||!_[_0x1ef0('0x1f')](_0x230b07['variable'][_0x1ef0('0x49')])){utils['info'](util[_0x1ef0('0x14')](_0x1ef0('0x47'),_0x230b07[_0x1ef0('0x7')],!_[_0x1ef0('0x1f')](_0x230b07[_0x1ef0('0x42')][_0x1ef0('0x48')])?_0x1ef0('0x48'):'xmcs-queue',_0x230b07[_0x1ef0('0x45')]));channels[_0x230b07[_0x1ef0('0x7')]][_0x1ef0('0x4a')]=_0x1ef0('0x4b');channels[_0x230b07[_0x1ef0('0x7')]]['lastdata']=_0x230b07[_0x1ef0('0x45')];channels[_0x230b07[_0x1ef0('0x7')]][_0x1ef0('0x9')]=!![];}if(!_['isNil'](_0x230b07[_0x1ef0('0x42')][_0x1ef0('0x4c')])){utils[_0x1ef0('0x18')](util['format'](_0x1ef0('0x4d'),_0x230b07[_0x1ef0('0x7')],_0x230b07[_0x1ef0('0x45')]));channels[_0x230b07[_0x1ef0('0x7')]][_0x1ef0('0x4e')]=_0x230b07[_0x1ef0('0x45')];}if(!_[_0x1ef0('0x1f')](_0x230b07[_0x1ef0('0x42')][_0x1ef0('0x4f')])){utils['info'](util[_0x1ef0('0x14')](_0x1ef0('0x50'),_0x230b07[_0x1ef0('0x7')],_0x230b07[_0x1ef0('0x45')]));channels[_0x230b07[_0x1ef0('0x7')]][_0x1ef0('0x51')]=_0x230b07[_0x1ef0('0x45')];}if(!_[_0x1ef0('0x1f')](_0x230b07[_0x1ef0('0x42')][_0x1ef0('0x52')])){utils[_0x1ef0('0x18')](util[_0x1ef0('0x14')](_0x1ef0('0x53'),_0x230b07[_0x1ef0('0x7')],_0x230b07[_0x1ef0('0x45')]));channels[_0x230b07[_0x1ef0('0x7')]][_0x1ef0('0x54')]=_0x230b07[_0x1ef0('0x45')];}if(!_[_0x1ef0('0x1f')](_0x230b07[_0x1ef0('0x42')][_0x1ef0('0x55')])){utils['info'](util[_0x1ef0('0x14')](_0x1ef0('0x56'),_0x230b07[_0x1ef0('0x7')],_0x230b07['value']));channels[_0x230b07[_0x1ef0('0x7')]][_0x1ef0('0x55')]=_0x230b07[_0x1ef0('0x45')];}}}catch(_0x41187c){utils[_0x1ef0('0x1d')](util[_0x1ef0('0x14')]('[%s][calls][varset]',_0x230b07[_0x1ef0('0x7')]),_0x41187c);}};exports[_0x1ef0('0x57')]=function(_0x233206){try{if(!_[_0x1ef0('0x1f')](channels[_0x233206[_0x1ef0('0x7')]])){utils[_0x1ef0('0x13')](util['format'](_0x1ef0('0x58'),_0x233206[_0x1ef0('0x7')]),_0x233206);utils['info'](util[_0x1ef0('0x14')](_0x1ef0('0x59'),_0x233206['uniqueid'],_0x233206[_0x1ef0('0x5a')],_0x233206[_0x1ef0('0x5b')]));if(_0x233206[_0x1ef0('0x5a')][_0x1ef0('0x5c')]()==_0x1ef0('0x5d')&&_['startsWith'](_0x233206[_0x1ef0('0x5b')][_0x1ef0('0x5c')](),_0x1ef0('0x5e'))){var _0x41defb=_0x233206[_0x1ef0('0x5b')]['split']('=');var _0x83b9d=_0x41defb[0x0][_0x1ef0('0x5f')](_0x41defb[0x0]['lastIndexOf']('(')+0x1,_0x41defb[0x0][_0x1ef0('0x60')](')'));var _0x3e82db=_0x41defb[0x1];channels[_0x233206[_0x1ef0('0x7')]][_0x83b9d]=_0x3e82db;}if(!_[_0x1ef0('0x61')]([_0x1ef0('0x26'),_0x1ef0('0x62'),'execif','set',_0x1ef0('0x63')],_0x233206[_0x1ef0('0x5a')][_0x1ef0('0x5c')]())){channels[_0x233206[_0x1ef0('0x7')]][_0x1ef0('0x4a')]=_0x233206[_0x1ef0('0x5a')];channels[_0x233206['uniqueid']][_0x1ef0('0x64')]=_0x233206[_0x1ef0('0x5b')];}}}catch(_0x1ebb9){utils[_0x1ef0('0x1d')](util[_0x1ef0('0x14')](_0x1ef0('0x58'),_0x233206[_0x1ef0('0x7')]),_0x1ebb9);}}; \ No newline at end of file +var _0xd1f9=['request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','exten','context','DOCUMENTATION','isNil','systemanswertime','now','linkedid','channelstate','transfer','destinationchannel','answertime','toNumber','ANSWERED','[%s][calls][newstate]','hangup','[%s][calls][hangup]','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','callerid','cause-txt','endtime','duration','diffTime','starttime','billableseconds','error','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','xmd-callerid-preview','xmd-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','gotoif','toLowerCase','lastdata','lodash','util','./utils','FAILED','NO\x20ANSWER','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId'];(function(_0x6a4ec2,_0x3cf461){var _0x5c1784=function(_0x38d046){while(--_0x38d046){_0x6a4ec2['push'](_0x6a4ec2['shift']());}};_0x5c1784(++_0x3cf461);}(_0xd1f9,0x12f));var _0x9d1f=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0xd1f9[_0x507403];return _0x1327c;};'use strict';var _=require(_0x9d1f('0x0'));var util=require(_0x9d1f('0x1'));var utils=require(_0x9d1f('0x2'));var dispositions=['NO\x20ANSWER',_0x9d1f('0x3'),_0x9d1f('0x3'),'NO\x20ANSWER',_0x9d1f('0x4'),_0x9d1f('0x4'),'ANSWERED','BUSY',_0x9d1f('0x3'),_0x9d1f('0x3'),_0x9d1f('0x3')];var channels={};function writeDB(_0x4c6023){utils[_0x9d1f('0x5')](util[_0x9d1f('0x6')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x4c6023[_0x9d1f('0x7')],_0x4c6023[_0x9d1f('0x8')],_0x4c6023[_0x9d1f('0x9')],_0x4c6023[_0x9d1f('0xa')],_0x4c6023[_0x9d1f('0xb')],_0x4c6023[_0x9d1f('0xc')],_0x4c6023[_0x9d1f('0xd')],_0x4c6023['lastevent']));if(_0x4c6023[_0x9d1f('0xe')]){utils[_0x9d1f('0xf')](_0x4c6023['accountcode'])[_0x9d1f('0x10')](function(_0x4e5d7d){if(_0x4e5d7d){_0x4c6023[_0x9d1f('0x11')]=_0x4e5d7d['id'];}utils[_0x9d1f('0x12')](_0x9d1f('0x13'),_0x4c6023);});}else{utils['request']('CreateVoiceCallReport',_0x4c6023);}if(channels[_0x4c6023[_0x9d1f('0x7')]]){delete channels[_0x4c6023['uniqueid']];}}exports['newchannel']=function(_0x399e2a){try{utils[_0x9d1f('0x14')](util[_0x9d1f('0x6')](_0x9d1f('0x15'),_0x399e2a[_0x9d1f('0x7')]),_0x399e2a);if(_0x399e2a[_0x9d1f('0x7')]==_0x399e2a['linkedid']&&_0x399e2a[_0x9d1f('0x8')]!=_0x9d1f('0x16')){utils[_0x9d1f('0x5')](util[_0x9d1f('0x6')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x399e2a[_0x9d1f('0x7')],_0x399e2a['context'],_0x399e2a[_0x9d1f('0x17')]));channels[_0x399e2a['uniqueid']]={'uniqueid':_0x399e2a[_0x9d1f('0x7')],'accountcode':_0x399e2a['accountcode'],'source':_0x399e2a[_0x9d1f('0xc')],'destination':_0x399e2a[_0x9d1f('0x17')],'destinationcontext':_0x399e2a[_0x9d1f('0x18')],'channel':_0x399e2a[_0x9d1f('0x8')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x9d1f('0x19')};}}catch(_0x4b1758){utils['error'](util[_0x9d1f('0x6')](_0x9d1f('0x15'),_0x399e2a[_0x9d1f('0x7')]),_0x4b1758);}};exports['newstate']=function(_0xd9b10d){try{utils[_0x9d1f('0x14')](util['format']('[%s][calls][newstate]',_0xd9b10d['uniqueid']),_0xd9b10d);if(!_['isNil'](channels[_0xd9b10d['uniqueid']])&&_0xd9b10d['channelstate']==0x6){utils[_0x9d1f('0x5')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0xd9b10d['uniqueid'],_0xd9b10d[_0x9d1f('0x18')],_0xd9b10d[_0x9d1f('0x8')]));if(_[_0x9d1f('0x1a')](channels[_0xd9b10d[_0x9d1f('0x7')]][_0x9d1f('0x1b')])){channels[_0xd9b10d[_0x9d1f('0x7')]][_0x9d1f('0x1b')]=utils[_0x9d1f('0x1c')]();}}else if(!_['isNil'](channels[_0xd9b10d[_0x9d1f('0x1d')]])&&_0xd9b10d[_0x9d1f('0x1e')]==0x6&&_0xd9b10d[_0x9d1f('0x18')]!=_0x9d1f('0x1f')){utils[_0x9d1f('0x5')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0xd9b10d[_0x9d1f('0x7')],_0xd9b10d[_0x9d1f('0x1d')],_0xd9b10d[_0x9d1f('0x18')],_0xd9b10d[_0x9d1f('0x8')]));channels[_0xd9b10d['linkedid']]['accountcode']=_0xd9b10d['accountcode'];channels[_0xd9b10d[_0x9d1f('0x1d')]][_0x9d1f('0x20')]=_0xd9b10d[_0x9d1f('0x8')];if(_['isNil'](channels[_0xd9b10d[_0x9d1f('0x1d')]][_0x9d1f('0x21')])){channels[_0xd9b10d['linkedid']]['answertime']=utils[_0x9d1f('0x1c')]();}channels[_0xd9b10d[_0x9d1f('0x1d')]]['disposition']=dispositions[_[_0x9d1f('0x22')](_0xd9b10d[_0x9d1f('0x1e')])]||_0x9d1f('0x23');}}catch(_0x44a965){utils['error'](util[_0x9d1f('0x6')](_0x9d1f('0x24'),_0xd9b10d[_0x9d1f('0x7')]),_0x44a965);}};exports[_0x9d1f('0x25')]=function(_0x3a3ed){try{if(!_[_0x9d1f('0x1a')](channels[_0x3a3ed[_0x9d1f('0x7')]])){utils[_0x9d1f('0x14')](util[_0x9d1f('0x6')](_0x9d1f('0x26'),_0x3a3ed[_0x9d1f('0x7')]),_0x3a3ed);if(_[_0x9d1f('0x1a')](channels[_0x3a3ed[_0x9d1f('0x7')]]['callerid'])){channels[_0x3a3ed[_0x9d1f('0x7')]]['callerid']=_0x3a3ed[_0x9d1f('0x27')]+'\x20<'+_0x3a3ed[_0x9d1f('0xc')]+'>';}utils[_0x9d1f('0x5')](util['format'](_0x9d1f('0x28'),_0x3a3ed[_0x9d1f('0x7')],channels[_0x3a3ed[_0x9d1f('0x7')]][_0x9d1f('0x29')],_0x3a3ed[_0x9d1f('0x2a')]));channels[_0x3a3ed['uniqueid']][_0x9d1f('0x2b')]=utils[_0x9d1f('0x1c')]();channels[_0x3a3ed['uniqueid']][_0x9d1f('0x2c')]=utils[_0x9d1f('0x2d')](channels[_0x3a3ed[_0x9d1f('0x7')]][_0x9d1f('0x2b')],channels[_0x3a3ed[_0x9d1f('0x7')]][_0x9d1f('0x2e')]);channels[_0x3a3ed[_0x9d1f('0x7')]][_0x9d1f('0x2f')]=channels[_0x3a3ed[_0x9d1f('0x7')]][_0x9d1f('0x21')]?utils['diffTime'](channels[_0x3a3ed[_0x9d1f('0x7')]]['endtime'],channels[_0x3a3ed[_0x9d1f('0x7')]][_0x9d1f('0x21')]):0x0;writeDB(channels[_0x3a3ed[_0x9d1f('0x7')]]);}}catch(_0x62a0ae){utils[_0x9d1f('0x30')](util[_0x9d1f('0x6')](_0x9d1f('0x26'),_0x3a3ed[_0x9d1f('0x7')]),_0x62a0ae);}};exports['attendedtransfer']=function(_0x2f4c20){try{if(!_[_0x9d1f('0x1a')](channels[_0x2f4c20[_0x9d1f('0x31')]])){utils[_0x9d1f('0x14')](util[_0x9d1f('0x6')]('[%s][calls][attendedtransfer]',_0x2f4c20[_0x9d1f('0x32')]),_0x2f4c20);if(channels[_0x2f4c20[_0x9d1f('0x31')]][_0x9d1f('0x8')]==_0x2f4c20[_0x9d1f('0x33')]){utils[_0x9d1f('0x5')](util[_0x9d1f('0x6')](_0x9d1f('0x34'),_0x2f4c20[_0x9d1f('0x32')],_0x2f4c20[_0x9d1f('0x31')],_0x2f4c20[_0x9d1f('0x35')]));channels[_0x2f4c20[_0x9d1f('0x31')]][_0x9d1f('0x20')]=_0x2f4c20[_0x9d1f('0x35')];channels[_0x2f4c20[_0x9d1f('0x31')]][_0x9d1f('0x36')]=_0x9d1f('0x37');}else if(channels[_0x2f4c20[_0x9d1f('0x31')]]['channel']=_0x2f4c20[_0x9d1f('0x38')]){utils[_0x9d1f('0x5')](util[_0x9d1f('0x6')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x2f4c20['origtransfereruniqueid'],_0x2f4c20['localtwolinkedid'],_0x2f4c20[_0x9d1f('0x39')]));channels[_0x2f4c20['localtwolinkedid']][_0x9d1f('0x20')]=_0x2f4c20[_0x9d1f('0x39')];channels[_0x2f4c20['localtwolinkedid']][_0x9d1f('0x36')]=_0x9d1f('0x37');}}}catch(_0xc92665){utils[_0x9d1f('0x30')](util['format']('[%s][calls][attendedtransfer]',_0x2f4c20[_0x9d1f('0x32')]),_0xc92665);}};exports['musiconholdstart']=function(_0x29b568){try{if(!_[_0x9d1f('0x1a')](channels[_0x29b568[_0x9d1f('0x7')]])){utils['debug'](util[_0x9d1f('0x6')]('[%s][calls][musiconholdstart]',_0x29b568[_0x9d1f('0x7')]),_0x29b568);channels[_0x29b568['uniqueid']][_0x9d1f('0x3a')]=utils['now']();utils[_0x9d1f('0x5')](util['format'](_0x9d1f('0x3b'),_0x29b568[_0x9d1f('0x7')],channels[_0x29b568['uniqueid']][_0x9d1f('0x3a')]));}}catch(_0x486811){utils['error'](util[_0x9d1f('0x6')](_0x9d1f('0x3c'),_0x29b568['uniqueid']),_0x486811);}};exports[_0x9d1f('0x3d')]=function(_0x2ead8b){try{if(!_[_0x9d1f('0x1a')](channels[_0x2ead8b['uniqueid']])){utils[_0x9d1f('0x14')](util[_0x9d1f('0x6')](_0x9d1f('0x3e'),_0x2ead8b[_0x9d1f('0x7')]),_0x2ead8b);if(!_[_0x9d1f('0x1a')](channels[_0x2ead8b[_0x9d1f('0x7')]]['musiconholdstartAt'])){channels[_0x2ead8b[_0x9d1f('0x7')]][_0x9d1f('0x3f')]+=utils[_0x9d1f('0x2d')](utils[_0x9d1f('0x1c')](),channels[_0x2ead8b[_0x9d1f('0x7')]][_0x9d1f('0x3a')]);utils[_0x9d1f('0x5')](util[_0x9d1f('0x6')](_0x9d1f('0x40'),_0x2ead8b[_0x9d1f('0x7')],channels[_0x2ead8b['uniqueid']][_0x9d1f('0x3f')]));delete channels[_0x2ead8b[_0x9d1f('0x7')]][_0x9d1f('0x3a')];}}}catch(_0x5ec690){utils[_0x9d1f('0x30')](util[_0x9d1f('0x6')](_0x9d1f('0x3e'),_0x2ead8b[_0x9d1f('0x7')]),_0x5ec690);}};exports['varset']=function(_0x41c1f1){try{if(!_[_0x9d1f('0x1a')](channels[_0x41c1f1[_0x9d1f('0x7')]])){utils[_0x9d1f('0x14')](util[_0x9d1f('0x6')](_0x9d1f('0x41'),_0x41c1f1['uniqueid']),_0x41c1f1);if(!_['isNil'](_0x41c1f1['variable'][_0x9d1f('0x42')])){utils[_0x9d1f('0x5')](util['format'](_0x9d1f('0x43'),_0x41c1f1['uniqueid'],_0x41c1f1['value']));channels[_0x41c1f1[_0x9d1f('0x7')]][_0x9d1f('0x44')]=_0x41c1f1[_0x9d1f('0x45')];}if(!_[_0x9d1f('0x1a')](_0x41c1f1[_0x9d1f('0x46')][_0x9d1f('0x47')])){utils[_0x9d1f('0x5')](util[_0x9d1f('0x6')](_0x9d1f('0x48'),_0x41c1f1[_0x9d1f('0x7')],_0x41c1f1[_0x9d1f('0x45')]));channels[_0x41c1f1['uniqueid']][_0x9d1f('0x49')]=_0x41c1f1['value'];channels[_0x41c1f1[_0x9d1f('0x7')]][_0x9d1f('0x29')]='\x22'+_0x41c1f1[_0x9d1f('0x45')]+_0x9d1f('0x4a')+_0x41c1f1[_0x9d1f('0x45')]+'>';}if(!_['isNil'](_0x41c1f1[_0x9d1f('0x46')]['xmd-callerid-preview'])||!_[_0x9d1f('0x1a')](_0x41c1f1[_0x9d1f('0x46')][_0x9d1f('0x4b')])){utils[_0x9d1f('0x5')](util[_0x9d1f('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x41c1f1['uniqueid'],!_[_0x9d1f('0x1a')](_0x41c1f1[_0x9d1f('0x46')][_0x9d1f('0x4c')])?'xmd-callerid-preview':'xmd-callerid',_0x41c1f1[_0x9d1f('0x45')]));channels[_0x41c1f1[_0x9d1f('0x7')]]['callerid']=_0x41c1f1[_0x9d1f('0x45')];}if(!_[_0x9d1f('0x1a')](_0x41c1f1['variable'][_0x9d1f('0x4d')])||!_[_0x9d1f('0x1a')](_0x41c1f1[_0x9d1f('0x46')]['xmcs-queue'])){utils[_0x9d1f('0x5')](util[_0x9d1f('0x6')](_0x9d1f('0x4e'),_0x41c1f1[_0x9d1f('0x7')],!_['isNil'](_0x41c1f1[_0x9d1f('0x46')]['xmd-queue'])?'xmd-queue':_0x9d1f('0x4f'),_0x41c1f1[_0x9d1f('0x45')]));channels[_0x41c1f1[_0x9d1f('0x7')]][_0x9d1f('0x50')]=_0x9d1f('0x51');channels[_0x41c1f1['uniqueid']]['lastdata']=_0x41c1f1[_0x9d1f('0x45')];channels[_0x41c1f1['uniqueid']][_0x9d1f('0x9')]=!![];}if(!_[_0x9d1f('0x1a')](_0x41c1f1[_0x9d1f('0x46')][_0x9d1f('0x52')])){utils[_0x9d1f('0x5')](util[_0x9d1f('0x6')](_0x9d1f('0x53'),_0x41c1f1[_0x9d1f('0x7')],_0x41c1f1[_0x9d1f('0x45')]));channels[_0x41c1f1['uniqueid']]['ContactId']=_0x41c1f1[_0x9d1f('0x45')];}if(!_[_0x9d1f('0x1a')](_0x41c1f1['variable'][_0x9d1f('0x54')])){utils[_0x9d1f('0x5')](util[_0x9d1f('0x6')](_0x9d1f('0x55'),_0x41c1f1[_0x9d1f('0x7')],_0x41c1f1['value']));channels[_0x41c1f1['uniqueid']][_0x9d1f('0x56')]=_0x41c1f1[_0x9d1f('0x45')];}if(!_[_0x9d1f('0x1a')](_0x41c1f1['variable'][_0x9d1f('0x57')])){utils[_0x9d1f('0x5')](util[_0x9d1f('0x6')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x41c1f1[_0x9d1f('0x7')],_0x41c1f1['value']));channels[_0x41c1f1[_0x9d1f('0x7')]][_0x9d1f('0x58')]=_0x41c1f1[_0x9d1f('0x45')];}if(!_[_0x9d1f('0x1a')](_0x41c1f1[_0x9d1f('0x46')][_0x9d1f('0x59')])){utils[_0x9d1f('0x5')](util[_0x9d1f('0x6')](_0x9d1f('0x5a'),_0x41c1f1[_0x9d1f('0x7')],_0x41c1f1[_0x9d1f('0x45')]));channels[_0x41c1f1[_0x9d1f('0x7')]][_0x9d1f('0x59')]=_0x41c1f1[_0x9d1f('0x45')];}}}catch(_0x5140ac){utils[_0x9d1f('0x30')](util[_0x9d1f('0x6')](_0x9d1f('0x41'),_0x41c1f1['uniqueid']),_0x5140ac);}};exports[_0x9d1f('0x5b')]=function(_0x3c5e83){try{if(!_[_0x9d1f('0x1a')](channels[_0x3c5e83[_0x9d1f('0x7')]])){utils['debug'](util[_0x9d1f('0x6')](_0x9d1f('0x5c'),_0x3c5e83[_0x9d1f('0x7')]),_0x3c5e83);utils[_0x9d1f('0x5')](util[_0x9d1f('0x6')](_0x9d1f('0x5d'),_0x3c5e83['uniqueid'],_0x3c5e83[_0x9d1f('0x5e')],_0x3c5e83[_0x9d1f('0x5f')]));if(_0x3c5e83[_0x9d1f('0x5e')]['toLowerCase']()==_0x9d1f('0x60')&&_[_0x9d1f('0x61')](_0x3c5e83[_0x9d1f('0x5f')]['toLowerCase'](),_0x9d1f('0x62'))){var _0x1059a1=_0x3c5e83['appdata'][_0x9d1f('0x63')]('=');var _0x8d9061=_0x1059a1[0x0][_0x9d1f('0x64')](_0x1059a1[0x0][_0x9d1f('0x65')]('(')+0x1,_0x1059a1[0x0][_0x9d1f('0x65')](')'));var _0x584a07=_0x1059a1[0x1];channels[_0x3c5e83[_0x9d1f('0x7')]][_0x8d9061]=_0x584a07;}if(!_[_0x9d1f('0x66')](['hangup',_0x9d1f('0x67'),'execif',_0x9d1f('0x60'),_0x9d1f('0x68')],_0x3c5e83[_0x9d1f('0x5e')][_0x9d1f('0x69')]())){channels[_0x3c5e83[_0x9d1f('0x7')]][_0x9d1f('0x50')]=_0x3c5e83[_0x9d1f('0x5e')];channels[_0x3c5e83['uniqueid']][_0x9d1f('0x6a')]=_0x3c5e83[_0x9d1f('0x5f')];}}}catch(_0x47ae0f){utils[_0x9d1f('0x30')](util['format']('[%s][calls][newexten]',_0x3c5e83[_0x9d1f('0x7')]),_0x47ae0f);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index db10f3a..3ad4b0a 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 _0x2f3d=['[core]\x20error','close','[core]\x20close','managerevent','connect','info','[core]\x20connected','shutdown','[core]\x20fullybooted','error'];(function(_0xc3b16c,_0x5bbb60){var _0x5f6810=function(_0x4a4ed1){while(--_0x4a4ed1){_0xc3b16c['push'](_0xc3b16c['shift']());}};_0x5f6810(++_0x5bbb60);}(_0x2f3d,0x1a8));var _0xd2f3=function(_0x12b653,_0x3be551){_0x12b653=_0x12b653-0x0;var _0x582337=_0x2f3d[_0x12b653];return _0x582337;};'use strict';var utils=require('./utils');exports[_0xd2f3('0x0')]=function(){utils[_0xd2f3('0x1')](_0xd2f3('0x2'));};exports[_0xd2f3('0x3')]=function(){utils[_0xd2f3('0x1')]('[core]\x20shutdown');};exports['fullybooted']=function(){utils[_0xd2f3('0x1')](_0xd2f3('0x4'));};exports[_0xd2f3('0x5')]=function(_0x4a8b5e){utils[_0xd2f3('0x5')](_0xd2f3('0x6'),_0x4a8b5e);};exports[_0xd2f3('0x7')]=function(){utils[_0xd2f3('0x1')](_0xd2f3('0x8'));};exports[_0xd2f3('0x9')]=function(_0x1275d7){}; \ No newline at end of file +var _0x6e11=['[core]\x20shutdown','error','[core]\x20error','close','[core]\x20close','info','[core]\x20connected','shutdown'];(function(_0x27740c,_0x379231){var _0x394893=function(_0x39562a){while(--_0x39562a){_0x27740c['push'](_0x27740c['shift']());}};_0x394893(++_0x379231);}(_0x6e11,0x12d));var _0x16e1=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0x6e11[_0x119280];return _0x481797;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0x16e1('0x0')](_0x16e1('0x1'));};exports[_0x16e1('0x2')]=function(){utils['info'](_0x16e1('0x3'));};exports['fullybooted']=function(){utils[_0x16e1('0x0')]('[core]\x20fullybooted');};exports['error']=function(_0xd24685){utils[_0x16e1('0x4')](_0x16e1('0x5'),_0xd24685);};exports[_0x16e1('0x6')]=function(){utils['info'](_0x16e1('0x7'));};exports['managerevent']=function(_0x34abf9){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index ceec577..811f45c 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 _0xe269=['application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','assign','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','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','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','format'];(function(_0x48ac7c,_0x16831b){var _0x46cb67=function(_0x39069c){while(--_0x39069c){_0x48ac7c['push'](_0x48ac7c['shift']());}};_0x46cb67(++_0x16831b);}(_0xe269,0x98));var _0x9e26=function(_0x189c66,_0x54f015){_0x189c66=_0x189c66-0x0;var _0x3fddb8=_0xe269[_0x189c66];return _0x3fddb8;};'use strict';var _=require(_0x9e26('0x0'));var util=require(_0x9e26('0x1'));var utils=require(_0x9e26('0x2'));var dials={};function writeDB(_0x488f7b){utils[_0x9e26('0x3')](util['format'](_0x9e26('0x4'),_0x488f7b[_0x9e26('0x5')],_0x488f7b[_0x9e26('0x6')],_0x488f7b[_0x9e26('0x7')],_0x488f7b[_0x9e26('0x8')],_0x488f7b[_0x9e26('0x9')],_0x488f7b[_0x9e26('0xa')]));utils[_0x9e26('0xb')](_0x9e26('0xc'),_0x488f7b);delete dials[_0x488f7b['uniqueid']];}exports[_0x9e26('0xd')]=function(_0x1408ef){try{utils[_0x9e26('0xe')](util[_0x9e26('0xf')]('[%s][dials][newexten]',_0x1408ef[_0x9e26('0x5')]),_0x1408ef);utils[_0x9e26('0x3')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x1408ef[_0x9e26('0x5')],_0x1408ef[_0x9e26('0x10')],_0x1408ef['appdata']));if(_0x1408ef[_0x9e26('0x10')][_0x9e26('0x11')]()==_0x9e26('0x12')&&_[_0x9e26('0x13')](_0x1408ef[_0x9e26('0x14')]['toLowerCase'](),_0x9e26('0x15'))){var _0x488a7b=_0x1408ef['appdata'][_0x9e26('0x16')]('=');dials[_0x1408ef[_0x9e26('0x5')]]={'routeId':_0x488a7b[0x1]};}}catch(_0x39c651){utils[_0x9e26('0x17')](util['format']('[%s][dials][newexten]',_0x1408ef['uniqueid']),_0x39c651);}};exports[_0x9e26('0x18')]=function(_0x195267){try{utils['debug'](util[_0x9e26('0xf')](_0x9e26('0x19'),_0x195267['uniqueid']),_0x195267);if(!_[_0x9e26('0x1a')](_0x195267[_0x9e26('0x1b')][_0x9e26('0x1c')])){utils[_0x9e26('0x3')](util[_0x9e26('0xf')](_0x9e26('0x1d'),_0x195267[_0x9e26('0x5')],_0x195267[_0x9e26('0x1e')]));dials[_0x195267['uniqueid']]={'routeId':_0x195267['value']};}}catch(_0x283a95){utils[_0x9e26('0x17')](util[_0x9e26('0xf')](_0x9e26('0x19'),_0x195267[_0x9e26('0x5')]),_0x283a95);}};exports['dialbegin']=function(_0x625eff){try{if(!_[_0x9e26('0x1a')](dials[_0x625eff[_0x9e26('0x5')]])){utils[_0x9e26('0xe')](util[_0x9e26('0xf')](_0x9e26('0x1f'),_0x625eff[_0x9e26('0x5')]),_0x625eff);dials[_0x625eff[_0x9e26('0x5')]]=_['assign'](dials[_0x625eff[_0x9e26('0x5')]],_0x625eff);dials[_0x625eff[_0x9e26('0x5')]][_0x9e26('0x20')]=utils[_0x9e26('0x21')]();dials[_0x625eff['uniqueid']][_0x9e26('0x22')]=_0x9e26('0x23');utils[_0x9e26('0x3')](util[_0x9e26('0xf')](_0x9e26('0x24'),_0x625eff['uniqueid'],dials[_0x625eff[_0x9e26('0x5')]][_0x9e26('0x20')]));}}catch(_0x249cc7){utils[_0x9e26('0x17')](util[_0x9e26('0xf')]('[%s][dials][dialbegin]',_0x625eff[_0x9e26('0x5')]),_0x249cc7);}};exports[_0x9e26('0x25')]=function(_0x4af5b8){try{if(!_['isNil'](dials[_0x4af5b8[_0x9e26('0x5')]])){utils[_0x9e26('0xe')](util[_0x9e26('0xf')](_0x9e26('0x26'),_0x4af5b8[_0x9e26('0x5')]),_0x4af5b8);dials[_0x4af5b8[_0x9e26('0x5')]][_0x9e26('0xa')]=_0x4af5b8[_0x9e26('0xa')];if(_0x4af5b8[_0x9e26('0xa')]==_0x9e26('0x27')){dials[_0x4af5b8[_0x9e26('0x5')]]=_[_0x9e26('0x28')](dials[_0x4af5b8[_0x9e26('0x5')]],_0x4af5b8);dials[_0x4af5b8[_0x9e26('0x5')]]['answertime']=utils['now']();dials[_0x4af5b8[_0x9e26('0x5')]][_0x9e26('0x22')]=_0x9e26('0x29');utils['info'](util[_0x9e26('0xf')](_0x9e26('0x2a'),_0x4af5b8[_0x9e26('0x5')],_0x4af5b8['dialstatus'],dials[_0x4af5b8[_0x9e26('0x5')]][_0x9e26('0x2b')]));}else{utils[_0x9e26('0x3')](util['format'](_0x9e26('0x2c'),_0x4af5b8[_0x9e26('0x5')],_0x4af5b8[_0x9e26('0xa')]));}}}catch(_0x3022ce){utils[_0x9e26('0x17')](util[_0x9e26('0xf')](_0x9e26('0x26'),_0x4af5b8[_0x9e26('0x5')]),_0x3022ce);}};exports[_0x9e26('0x2d')]=function(_0x2ef377){try{if(!_['isNil'](dials[_0x2ef377[_0x9e26('0x5')]])){utils[_0x9e26('0xe')](util[_0x9e26('0xf')](_0x9e26('0x2e'),_0x2ef377[_0x9e26('0x5')]),_0x2ef377);utils[_0x9e26('0x3')](util['format'](_0x9e26('0x2f'),_0x2ef377[_0x9e26('0x5')],_0x2ef377[_0x9e26('0x8')],_0x2ef377[_0x9e26('0x30')],_0x2ef377[_0x9e26('0x31')]));dials[_0x2ef377['uniqueid']]=_[_0x9e26('0x28')](dials[_0x2ef377[_0x9e26('0x5')]],{'endtime':utils[_0x9e26('0x21')](),'lastevent':_0x9e26('0x32')});dials[_0x2ef377[_0x9e26('0x5')]][_0x9e26('0x33')]=utils[_0x9e26('0x34')](dials[_0x2ef377[_0x9e26('0x5')]]['endtime'],dials[_0x2ef377[_0x9e26('0x5')]][_0x9e26('0x20')]);dials[_0x2ef377['uniqueid']][_0x9e26('0x35')]=utils[_0x9e26('0x34')](dials[_0x2ef377['uniqueid']][_0x9e26('0x2b')]||dials[_0x2ef377[_0x9e26('0x5')]][_0x9e26('0x36')],dials[_0x2ef377[_0x9e26('0x5')]]['starttime']);dials[_0x2ef377[_0x9e26('0x5')]][_0x9e26('0x37')]=dials[_0x2ef377[_0x9e26('0x5')]][_0x9e26('0x2b')]?utils[_0x9e26('0x34')](dials[_0x2ef377[_0x9e26('0x5')]][_0x9e26('0x36')],dials[_0x2ef377[_0x9e26('0x5')]][_0x9e26('0x2b')]):0x0;writeDB(dials[_0x2ef377['uniqueid']]);}}catch(_0x1a2f62){utils[_0x9e26('0x17')](util['format'](_0x9e26('0x2e'),_0x2ef377[_0x9e26('0x5')]),_0x1a2f62);}}; \ No newline at end of file +var _0x65b8=['[%s][dials][dialend]','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','diffTime','holdtime','billableseconds','endtime','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)','split','error','varset','[%s][dials][varset]','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','[%s][dials][dialbegin]','starttime','now','lastevent','called','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s'];(function(_0x3f46c3,_0x48c8a1){var _0x23e7d1=function(_0x5dd296){while(--_0x5dd296){_0x3f46c3['push'](_0x3f46c3['shift']());}};_0x23e7d1(++_0x48c8a1);}(_0x65b8,0x142));var _0x865b=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x65b8[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x865b('0x0'));var util=require(_0x865b('0x1'));var utils=require(_0x865b('0x2'));var dials={};function writeDB(_0x249cc4){utils[_0x865b('0x3')](util['format'](_0x865b('0x4'),_0x249cc4[_0x865b('0x5')],_0x249cc4[_0x865b('0x6')],_0x249cc4[_0x865b('0x7')],_0x249cc4[_0x865b('0x8')],_0x249cc4[_0x865b('0x9')],_0x249cc4[_0x865b('0xa')]));utils['request'](_0x865b('0xb'),_0x249cc4);delete dials[_0x249cc4['uniqueid']];}exports[_0x865b('0xc')]=function(_0x4013f4){try{utils[_0x865b('0xd')](util[_0x865b('0xe')](_0x865b('0xf'),_0x4013f4[_0x865b('0x5')]),_0x4013f4);utils[_0x865b('0x3')](util['format'](_0x865b('0x10'),_0x4013f4[_0x865b('0x5')],_0x4013f4[_0x865b('0x11')],_0x4013f4[_0x865b('0x12')]));if(_0x4013f4[_0x865b('0x11')][_0x865b('0x13')]()==_0x865b('0x14')&&_['startsWith'](_0x4013f4['appdata'][_0x865b('0x13')](),_0x865b('0x15'))){var _0x117dbc=_0x4013f4[_0x865b('0x12')][_0x865b('0x16')]('=');dials[_0x4013f4[_0x865b('0x5')]]={'routeId':_0x117dbc[0x1]};}}catch(_0x1e7c86){utils[_0x865b('0x17')](util[_0x865b('0xe')](_0x865b('0xf'),_0x4013f4['uniqueid']),_0x1e7c86);}};exports[_0x865b('0x18')]=function(_0x4b706d){try{utils[_0x865b('0xd')](util[_0x865b('0xe')](_0x865b('0x19'),_0x4b706d['uniqueid']),_0x4b706d);if(!_['isNil'](_0x4b706d[_0x865b('0x1a')]['outboundrouteid'])){utils[_0x865b('0x3')](util['format'](_0x865b('0x1b'),_0x4b706d[_0x865b('0x5')],_0x4b706d[_0x865b('0x1c')]));dials[_0x4b706d[_0x865b('0x5')]]={'routeId':_0x4b706d['value']};}}catch(_0x347358){utils[_0x865b('0x17')](util[_0x865b('0xe')](_0x865b('0x19'),_0x4b706d[_0x865b('0x5')]),_0x347358);}};exports[_0x865b('0x1d')]=function(_0x3ce9fa){try{if(!_[_0x865b('0x1e')](dials[_0x3ce9fa['uniqueid']])){utils[_0x865b('0xd')](util[_0x865b('0xe')](_0x865b('0x1f'),_0x3ce9fa[_0x865b('0x5')]),_0x3ce9fa);dials[_0x3ce9fa[_0x865b('0x5')]]=_['assign'](dials[_0x3ce9fa[_0x865b('0x5')]],_0x3ce9fa);dials[_0x3ce9fa[_0x865b('0x5')]][_0x865b('0x20')]=utils[_0x865b('0x21')]();dials[_0x3ce9fa[_0x865b('0x5')]][_0x865b('0x22')]=_0x865b('0x23');utils[_0x865b('0x3')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x3ce9fa[_0x865b('0x5')],dials[_0x3ce9fa[_0x865b('0x5')]][_0x865b('0x20')]));}}catch(_0x4f7ba5){utils[_0x865b('0x17')](util[_0x865b('0xe')](_0x865b('0x1f'),_0x3ce9fa[_0x865b('0x5')]),_0x4f7ba5);}};exports['dialend']=function(_0xcaca07){try{if(!_[_0x865b('0x1e')](dials[_0xcaca07[_0x865b('0x5')]])){utils[_0x865b('0xd')](util['format']('[%s][dials][dialend]',_0xcaca07[_0x865b('0x5')]),_0xcaca07);dials[_0xcaca07[_0x865b('0x5')]][_0x865b('0xa')]=_0xcaca07['dialstatus'];if(_0xcaca07[_0x865b('0xa')]==_0x865b('0x24')){dials[_0xcaca07[_0x865b('0x5')]]=_[_0x865b('0x25')](dials[_0xcaca07[_0x865b('0x5')]],_0xcaca07);dials[_0xcaca07[_0x865b('0x5')]][_0x865b('0x26')]=utils[_0x865b('0x21')]();dials[_0xcaca07[_0x865b('0x5')]][_0x865b('0x22')]=_0x865b('0x27');utils[_0x865b('0x3')](util[_0x865b('0xe')](_0x865b('0x28'),_0xcaca07['uniqueid'],_0xcaca07[_0x865b('0xa')],dials[_0xcaca07[_0x865b('0x5')]][_0x865b('0x26')]));}else{utils[_0x865b('0x3')](util[_0x865b('0xe')](_0x865b('0x29'),_0xcaca07[_0x865b('0x5')],_0xcaca07[_0x865b('0xa')]));}}}catch(_0x2b7920){utils['error'](util['format'](_0x865b('0x2a'),_0xcaca07['uniqueid']),_0x2b7920);}};exports['hangup']=function(_0x24c264){try{if(!_['isNil'](dials[_0x24c264['uniqueid']])){utils[_0x865b('0xd')](util['format'](_0x865b('0x2b'),_0x24c264[_0x865b('0x5')]),_0x24c264);utils['info'](util[_0x865b('0xe')](_0x865b('0x2c'),_0x24c264[_0x865b('0x5')],_0x24c264['calleridnum'],_0x24c264[_0x865b('0x2d')],_0x24c264[_0x865b('0x2e')]));dials[_0x24c264['uniqueid']]=_[_0x865b('0x25')](dials[_0x24c264['uniqueid']],{'endtime':utils[_0x865b('0x21')](),'lastevent':'complete'});dials[_0x24c264[_0x865b('0x5')]][_0x865b('0x2f')]=utils[_0x865b('0x30')](dials[_0x24c264[_0x865b('0x5')]]['endtime'],dials[_0x24c264[_0x865b('0x5')]][_0x865b('0x20')]);dials[_0x24c264[_0x865b('0x5')]][_0x865b('0x31')]=utils[_0x865b('0x30')](dials[_0x24c264['uniqueid']][_0x865b('0x26')]||dials[_0x24c264['uniqueid']]['endtime'],dials[_0x24c264[_0x865b('0x5')]]['starttime']);dials[_0x24c264['uniqueid']][_0x865b('0x32')]=dials[_0x24c264[_0x865b('0x5')]][_0x865b('0x26')]?utils[_0x865b('0x30')](dials[_0x24c264['uniqueid']][_0x865b('0x33')],dials[_0x24c264['uniqueid']]['answertime']):0x0;writeDB(dials[_0x24c264[_0x865b('0x5')]]);}}catch(_0x28e167){utils['error'](util[_0x865b('0xe')](_0x865b('0x2b'),_0x24c264[_0x865b('0x5')]),_0x28e167);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 6ca4298..af356d9 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 _0xa2e5=['newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','xdr','disabled','env','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]'];(function(_0x70942a,_0x4fb9f5){var _0x3ae31a=function(_0x2f3798){while(--_0x2f3798){_0x70942a['push'](_0x70942a['shift']());}};_0x3ae31a(++_0x4fb9f5);}(_0xa2e5,0x1a7));var _0x5a2e=function(_0x1ed56a,_0x17b066){_0x1ed56a=_0x1ed56a-0x0;var _0x49b813=_0xa2e5[_0x1ed56a];return _0x49b813;};var AsteriskManager=require('asterisk-manager');var config=require(_0x5a2e('0x0'));var utils=require('./utils');var util=require('util');var isXDREnabled=config['xdr']&&config[_0x5a2e('0x1')][_0x5a2e('0x2')]?!config[_0x5a2e('0x1')]['disabled']:!![];var isProduction=config[_0x5a2e('0x3')]==='production'||![];var isLocalAsterisk=config[_0x5a2e('0x1')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0x5a2e('0x4')][_0x5a2e('0x5')],config[_0x5a2e('0x4')]['ip'],config[_0x5a2e('0x4')][_0x5a2e('0x6')],config[_0x5a2e('0x4')][_0x5a2e('0x7')],!![]);ami[_0x5a2e('0x8')]();if(!isXDREnabled){utils[_0x5a2e('0x9')](_0x5a2e('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x5a2e('0x9')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x5a2e('0xb'));var calls=require('./calls.controller');var queues=require(_0x5a2e('0xc'));var recordings=require(_0x5a2e('0xd'));var members=require(_0x5a2e('0xe'));var dials=require(_0x5a2e('0xf'));var transfers=require(_0x5a2e('0x10'));var core=require(_0x5a2e('0x11'));ami['on'](_0x5a2e('0x12'),core[_0x5a2e('0x12')]);ami['on'](_0x5a2e('0x13'),core[_0x5a2e('0x13')]);ami['on'](_0x5a2e('0x14'),core['fullybooted']);ami['on'](_0x5a2e('0x15'),core[_0x5a2e('0x15')]);ami['on'](_0x5a2e('0x16'),core[_0x5a2e('0x16')]);ami['on']('managerevent',core[_0x5a2e('0x17')]);ami['on'](_0x5a2e('0x18'),function(_0x2b877f){try{utils['debug'](util[_0x5a2e('0x19')](_0x5a2e('0x1a'),_0x2b877f['device']),_0x2b877f);members['devicestatechange'](_0x2b877f);}catch(_0x59c9d0){utils['error'](util[_0x5a2e('0x19')](_0x5a2e('0x1a'),_0x2b877f[_0x5a2e('0x1b')]),_0x59c9d0);}});ami['on'](_0x5a2e('0x1c'),function(_0x29ba34){try{utils[_0x5a2e('0x1d')](util['format'](_0x5a2e('0x1e'),_0x29ba34[_0x5a2e('0x1f')]),_0x29ba34);agents[_0x5a2e('0x1c')](_0x29ba34);}catch(_0x4f68f6){utils['error'](util[_0x5a2e('0x19')](_0x5a2e('0x1e'),_0x29ba34[_0x5a2e('0x1f')]),_0x4f68f6);}});ami['on']('agentringnoanswer',function(_0x598cf1){try{utils[_0x5a2e('0x1d')](util[_0x5a2e('0x19')]('[%s][index][agentringnoanswer]',_0x598cf1['uniqueid']),_0x598cf1);agents[_0x5a2e('0x20')](_0x598cf1);}catch(_0x599022){utils[_0x5a2e('0x15')](util[_0x5a2e('0x19')](_0x5a2e('0x21'),_0x598cf1[_0x5a2e('0x1f')]),_0x599022);}});ami['on'](_0x5a2e('0x22'),function(_0x27fc1a){try{utils['debug'](util[_0x5a2e('0x19')](_0x5a2e('0x23'),_0x27fc1a[_0x5a2e('0x1f')]),_0x27fc1a);agents[_0x5a2e('0x22')](_0x27fc1a);queues[_0x5a2e('0x22')](_0x27fc1a);}catch(_0x179a71){utils[_0x5a2e('0x15')](util[_0x5a2e('0x19')](_0x5a2e('0x23'),_0x27fc1a['uniqueid']),_0x179a71);}});ami['on'](_0x5a2e('0x24'),function(_0x361807){try{utils[_0x5a2e('0x1d')](util[_0x5a2e('0x19')](_0x5a2e('0x25'),_0x361807[_0x5a2e('0x1f')]),_0x361807);agents[_0x5a2e('0x24')](_0x361807);queues[_0x5a2e('0x24')](_0x361807);members[_0x5a2e('0x24')](_0x361807);}catch(_0x849222){utils['error'](util['format'](_0x5a2e('0x25'),_0x361807[_0x5a2e('0x1f')]),_0x849222);}});ami['on']('queuecallerabandon',function(_0x741503){try{utils['debug'](util[_0x5a2e('0x19')](_0x5a2e('0x26'),_0x741503[_0x5a2e('0x1f')]),_0x741503);agents[_0x5a2e('0x27')](_0x741503);queues[_0x5a2e('0x27')](_0x741503);}catch(_0x4de986){utils[_0x5a2e('0x15')](util[_0x5a2e('0x19')](_0x5a2e('0x26'),_0x741503[_0x5a2e('0x1f')]),_0x4de986);}});ami['on'](_0x5a2e('0x28'),function(_0x4059fa){try{utils[_0x5a2e('0x1d')](util[_0x5a2e('0x19')]('[%s][index][queuecallerjoin]',_0x4059fa[_0x5a2e('0x1f')]),_0x4059fa);queues[_0x5a2e('0x28')](_0x4059fa);recordings[_0x5a2e('0x28')](_0x4059fa);}catch(_0xac55c2){utils['error'](util[_0x5a2e('0x19')]('[%s][index][queuecallerjoin]',_0x4059fa['uniqueid']),_0xac55c2);}});ami['on']('queuecallerleave',function(_0x1d1b50){try{utils[_0x5a2e('0x1d')](util[_0x5a2e('0x19')](_0x5a2e('0x29'),_0x1d1b50['uniqueid']),_0x1d1b50);queues[_0x5a2e('0x2a')](_0x1d1b50);}catch(_0x3ce92c){utils['error'](util[_0x5a2e('0x19')]('[%s][index][queuecallerleave]',_0x1d1b50[_0x5a2e('0x1f')]),_0x3ce92c);}});ami['on'](_0x5a2e('0x2b'),function(_0x59b22e){try{utils['debug'](util[_0x5a2e('0x19')](_0x5a2e('0x2c'),_0x59b22e[_0x5a2e('0x1f')]),_0x59b22e);queues['musiconholdstart'](_0x59b22e);calls[_0x5a2e('0x2b')](_0x59b22e);}catch(_0x4dfdac){utils[_0x5a2e('0x15')](util[_0x5a2e('0x19')]('[%s][index][musiconholdstart]',_0x59b22e[_0x5a2e('0x1f')]),_0x4dfdac);}});ami['on']('musiconholdstop',function(_0x5a95af){try{utils['debug'](util[_0x5a2e('0x19')](_0x5a2e('0x2d'),_0x5a95af[_0x5a2e('0x1f')]),_0x5a95af);queues[_0x5a2e('0x2e')](_0x5a95af);calls[_0x5a2e('0x2e')](_0x5a95af);}catch(_0x8d727){utils[_0x5a2e('0x15')](util[_0x5a2e('0x19')](_0x5a2e('0x2d'),_0x5a95af[_0x5a2e('0x1f')]),_0x8d727);}});ami['on'](_0x5a2e('0x2f'),function(_0x34ad4b){try{utils[_0x5a2e('0x1d')](util['format'](_0x5a2e('0x30'),_0x34ad4b[_0x5a2e('0x1f')]),_0x34ad4b);calls[_0x5a2e('0x2f')](_0x34ad4b);recordings[_0x5a2e('0x2f')](_0x34ad4b);}catch(_0x563e82){utils['error'](util['format'](_0x5a2e('0x30'),_0x34ad4b[_0x5a2e('0x1f')]),_0x563e82);}});ami['on'](_0x5a2e('0x31'),function(_0x22875d){try{utils[_0x5a2e('0x1d')](util[_0x5a2e('0x19')](_0x5a2e('0x32'),_0x22875d[_0x5a2e('0x1f')]),_0x22875d);calls[_0x5a2e('0x31')](_0x22875d);recordings[_0x5a2e('0x31')](_0x22875d);dials['hangup'](_0x22875d);agents['hangup'](_0x22875d);queues[_0x5a2e('0x31')](_0x22875d);}catch(_0x52285d){utils[_0x5a2e('0x15')](util[_0x5a2e('0x19')](_0x5a2e('0x32'),_0x22875d[_0x5a2e('0x1f')]),_0x52285d);}});ami['on']('cdr',function(_0x2b19d2){try{utils[_0x5a2e('0x1d')](util[_0x5a2e('0x19')]('[%s][index][cdr]',_0x2b19d2[_0x5a2e('0x1f')]),_0x2b19d2);members[_0x5a2e('0x33')](_0x2b19d2);}catch(_0x1eb9c2){utils['error'](util[_0x5a2e('0x19')](_0x5a2e('0x34'),_0x2b19d2[_0x5a2e('0x1f')]),_0x1eb9c2);}});ami['on'](_0x5a2e('0x35'),function(_0x53bcb9){try{utils[_0x5a2e('0x1d')](util['format'](_0x5a2e('0x36'),_0x53bcb9[_0x5a2e('0x1f')]),_0x53bcb9);queues[_0x5a2e('0x35')](_0x53bcb9);agents[_0x5a2e('0x35')](_0x53bcb9);transfers['blindtransfer'](_0x53bcb9);}catch(_0x15b3fd){utils[_0x5a2e('0x15')](util[_0x5a2e('0x19')](_0x5a2e('0x36'),_0x53bcb9[_0x5a2e('0x1f')]),_0x15b3fd);}});ami['on'](_0x5a2e('0x37'),function(_0x32bfe0){try{utils[_0x5a2e('0x1d')](util[_0x5a2e('0x19')]('[%s][index][attendedtransfer]',_0x32bfe0[_0x5a2e('0x38')]),_0x32bfe0);queues['attendedtransfer'](_0x32bfe0);transfers[_0x5a2e('0x37')](_0x32bfe0);agents[_0x5a2e('0x37')](_0x32bfe0);calls[_0x5a2e('0x37')](_0x32bfe0);}catch(_0x448da9){utils[_0x5a2e('0x15')](util['format'](_0x5a2e('0x39'),_0x32bfe0[_0x5a2e('0x38')]),_0x448da9);}});ami['on'](_0x5a2e('0x3a'),function(_0x5c5298){try{utils[_0x5a2e('0x1d')](util[_0x5a2e('0x19')](_0x5a2e('0x3b'),_0x5c5298[_0x5a2e('0x1f')]),_0x5c5298);queues[_0x5a2e('0x3a')](_0x5c5298);recordings[_0x5a2e('0x3a')](_0x5c5298);calls[_0x5a2e('0x3a')](_0x5c5298);dials[_0x5a2e('0x3a')](_0x5c5298);}catch(_0x4de75c){utils[_0x5a2e('0x15')](util[_0x5a2e('0x19')](_0x5a2e('0x3b'),_0x5c5298[_0x5a2e('0x1f')]),_0x4de75c);}});ami['on'](_0x5a2e('0x3c'),function(_0x5a0bc9){try{utils[_0x5a2e('0x1d')](util[_0x5a2e('0x19')](_0x5a2e('0x3d'),_0x5a0bc9[_0x5a2e('0x1f')]),_0x5a0bc9);calls['newexten'](_0x5a0bc9);recordings[_0x5a2e('0x3c')](_0x5a0bc9);dials['newexten'](_0x5a0bc9);}catch(_0x38504b){utils[_0x5a2e('0x15')](util[_0x5a2e('0x19')](_0x5a2e('0x3d'),_0x5a0bc9[_0x5a2e('0x1f')]),_0x38504b);}});ami['on'](_0x5a2e('0x3e'),function(_0x1705ef){try{utils[_0x5a2e('0x1d')](util[_0x5a2e('0x19')]('[%s][index][newchannel]',_0x1705ef[_0x5a2e('0x1f')]),_0x1705ef);calls['newchannel'](_0x1705ef);recordings[_0x5a2e('0x3e')](_0x1705ef);}catch(_0x23fa39){utils[_0x5a2e('0x15')](util[_0x5a2e('0x19')](_0x5a2e('0x3f'),_0x1705ef[_0x5a2e('0x1f')]),_0x23fa39);}});ami['on'](_0x5a2e('0x40'),function(_0x1564f5){try{utils[_0x5a2e('0x1d')](util[_0x5a2e('0x19')](_0x5a2e('0x41'),_0x1564f5[_0x5a2e('0x1f')]),_0x1564f5);dials['dialbegin'](_0x1564f5);}catch(_0x226296){utils['error'](util[_0x5a2e('0x19')](_0x5a2e('0x42'),_0x1564f5[_0x5a2e('0x1f')]),_0x226296);}});ami['on'](_0x5a2e('0x43'),function(_0x13131d){try{utils[_0x5a2e('0x1d')](util[_0x5a2e('0x19')](_0x5a2e('0x44'),_0x13131d[_0x5a2e('0x1f')]),_0x13131d);dials[_0x5a2e('0x43')](_0x13131d);}catch(_0x372f6f){utils[_0x5a2e('0x15')](util[_0x5a2e('0x19')](_0x5a2e('0x44'),_0x13131d[_0x5a2e('0x1f')]),_0x372f6f);}});} \ No newline at end of file +var _0x361b=['attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','local','asterisk','port','username','password','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]'];(function(_0x2548a3,_0x5a91a3){var _0x2889bd=function(_0x285e91){while(--_0x285e91){_0x2548a3['push'](_0x2548a3['shift']());}};_0x2889bd(++_0x5a91a3);}(_0x361b,0x1c3));var _0xb361=function(_0x8baf8,_0x547e5a){_0x8baf8=_0x8baf8-0x0;var _0x2650f4=_0x361b[_0x8baf8];return _0x2650f4;};var AsteriskManager=require(_0xb361('0x0'));var config=require(_0xb361('0x1'));var utils=require(_0xb361('0x2'));var util=require(_0xb361('0x3'));var isXDREnabled=config[_0xb361('0x4')]&&config['xdr'][_0xb361('0x5')]?!config[_0xb361('0x4')][_0xb361('0x5')]:!![];var isProduction=config[_0xb361('0x6')]==='production'||![];var isLocalAsterisk=config[_0xb361('0x4')]&&config[_0xb361('0x4')][_0xb361('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xb361('0x8')][_0xb361('0x9')],config[_0xb361('0x8')]['ip'],config[_0xb361('0x8')][_0xb361('0xa')],config['asterisk'][_0xb361('0xb')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0xb361('0xc')](_0xb361('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xb361('0xc')](_0xb361('0xe'));}else{var agents=require(_0xb361('0xf'));var calls=require(_0xb361('0x10'));var queues=require(_0xb361('0x11'));var recordings=require(_0xb361('0x12'));var members=require(_0xb361('0x13'));var dials=require(_0xb361('0x14'));var transfers=require(_0xb361('0x15'));var core=require(_0xb361('0x16'));ami['on'](_0xb361('0x17'),core[_0xb361('0x17')]);ami['on'](_0xb361('0x18'),core[_0xb361('0x18')]);ami['on'](_0xb361('0x19'),core[_0xb361('0x19')]);ami['on'](_0xb361('0x1a'),core[_0xb361('0x1a')]);ami['on'](_0xb361('0x1b'),core['close']);ami['on'](_0xb361('0x1c'),core['managerevent']);ami['on'](_0xb361('0x1d'),function(_0x8993fc){try{utils[_0xb361('0x1e')](util[_0xb361('0x1f')](_0xb361('0x20'),_0x8993fc[_0xb361('0x21')]),_0x8993fc);members[_0xb361('0x1d')](_0x8993fc);}catch(_0x3346e1){utils[_0xb361('0x1a')](util['format'](_0xb361('0x20'),_0x8993fc['device']),_0x3346e1);}});ami['on'](_0xb361('0x22'),function(_0x5ba266){try{utils[_0xb361('0x1e')](util[_0xb361('0x1f')]('[%s][index][agentcalled]',_0x5ba266[_0xb361('0x23')]),_0x5ba266);agents[_0xb361('0x22')](_0x5ba266);}catch(_0x1e3bcc){utils['error'](util[_0xb361('0x1f')](_0xb361('0x24'),_0x5ba266[_0xb361('0x23')]),_0x1e3bcc);}});ami['on'](_0xb361('0x25'),function(_0x5f56cc){try{utils[_0xb361('0x1e')](util['format'](_0xb361('0x26'),_0x5f56cc[_0xb361('0x23')]),_0x5f56cc);agents['agentringnoanswer'](_0x5f56cc);}catch(_0x157e69){utils[_0xb361('0x1a')](util['format'](_0xb361('0x26'),_0x5f56cc[_0xb361('0x23')]),_0x157e69);}});ami['on'](_0xb361('0x27'),function(_0x5e17e6){try{utils[_0xb361('0x1e')](util[_0xb361('0x1f')](_0xb361('0x28'),_0x5e17e6[_0xb361('0x23')]),_0x5e17e6);agents[_0xb361('0x27')](_0x5e17e6);queues['agentconnect'](_0x5e17e6);}catch(_0x4a0260){utils[_0xb361('0x1a')](util[_0xb361('0x1f')]('[%s][index][agentconnect]',_0x5e17e6['uniqueid']),_0x4a0260);}});ami['on']('agentcomplete',function(_0x1ac140){try{utils[_0xb361('0x1e')](util[_0xb361('0x1f')](_0xb361('0x29'),_0x1ac140['uniqueid']),_0x1ac140);agents[_0xb361('0x2a')](_0x1ac140);queues[_0xb361('0x2a')](_0x1ac140);members[_0xb361('0x2a')](_0x1ac140);}catch(_0x3f8c9b){utils[_0xb361('0x1a')](util[_0xb361('0x1f')](_0xb361('0x29'),_0x1ac140['uniqueid']),_0x3f8c9b);}});ami['on'](_0xb361('0x2b'),function(_0x490473){try{utils[_0xb361('0x1e')](util[_0xb361('0x1f')](_0xb361('0x2c'),_0x490473[_0xb361('0x23')]),_0x490473);agents['queuecallerabandon'](_0x490473);queues['queuecallerabandon'](_0x490473);}catch(_0x2cd371){utils[_0xb361('0x1a')](util[_0xb361('0x1f')](_0xb361('0x2c'),_0x490473[_0xb361('0x23')]),_0x2cd371);}});ami['on'](_0xb361('0x2d'),function(_0x24f7c3){try{utils[_0xb361('0x1e')](util[_0xb361('0x1f')](_0xb361('0x2e'),_0x24f7c3[_0xb361('0x23')]),_0x24f7c3);queues[_0xb361('0x2d')](_0x24f7c3);recordings[_0xb361('0x2d')](_0x24f7c3);}catch(_0x2f3c04){utils[_0xb361('0x1a')](util[_0xb361('0x1f')](_0xb361('0x2e'),_0x24f7c3[_0xb361('0x23')]),_0x2f3c04);}});ami['on'](_0xb361('0x2f'),function(_0xbe1e17){try{utils[_0xb361('0x1e')](util['format'](_0xb361('0x30'),_0xbe1e17[_0xb361('0x23')]),_0xbe1e17);queues['queuecallerleave'](_0xbe1e17);}catch(_0x493b9a){utils[_0xb361('0x1a')](util[_0xb361('0x1f')](_0xb361('0x30'),_0xbe1e17[_0xb361('0x23')]),_0x493b9a);}});ami['on'](_0xb361('0x31'),function(_0xf32265){try{utils[_0xb361('0x1e')](util[_0xb361('0x1f')](_0xb361('0x32'),_0xf32265['uniqueid']),_0xf32265);queues['musiconholdstart'](_0xf32265);calls['musiconholdstart'](_0xf32265);}catch(_0x3fa3f5){utils[_0xb361('0x1a')](util[_0xb361('0x1f')]('[%s][index][musiconholdstart]',_0xf32265[_0xb361('0x23')]),_0x3fa3f5);}});ami['on'](_0xb361('0x33'),function(_0x4e7e25){try{utils[_0xb361('0x1e')](util[_0xb361('0x1f')]('[%s][index][musiconholdstop]',_0x4e7e25[_0xb361('0x23')]),_0x4e7e25);queues[_0xb361('0x33')](_0x4e7e25);calls[_0xb361('0x33')](_0x4e7e25);}catch(_0x12eef7){utils[_0xb361('0x1a')](util[_0xb361('0x1f')](_0xb361('0x34'),_0x4e7e25[_0xb361('0x23')]),_0x12eef7);}});ami['on']('newstate',function(_0x322f5b){try{utils[_0xb361('0x1e')](util[_0xb361('0x1f')](_0xb361('0x35'),_0x322f5b['uniqueid']),_0x322f5b);calls[_0xb361('0x36')](_0x322f5b);recordings['newstate'](_0x322f5b);}catch(_0xa0a4f9){utils[_0xb361('0x1a')](util[_0xb361('0x1f')]('[%s][index][newstate]',_0x322f5b['uniqueid']),_0xa0a4f9);}});ami['on'](_0xb361('0x37'),function(_0x60f984){try{utils[_0xb361('0x1e')](util[_0xb361('0x1f')]('[%s][index][hangup]',_0x60f984['uniqueid']),_0x60f984);calls[_0xb361('0x37')](_0x60f984);recordings[_0xb361('0x37')](_0x60f984);dials['hangup'](_0x60f984);agents['hangup'](_0x60f984);queues[_0xb361('0x37')](_0x60f984);}catch(_0xd04682){utils[_0xb361('0x1a')](util[_0xb361('0x1f')](_0xb361('0x38'),_0x60f984[_0xb361('0x23')]),_0xd04682);}});ami['on']('cdr',function(_0x19d991){try{utils[_0xb361('0x1e')](util[_0xb361('0x1f')]('[%s][index][cdr]',_0x19d991['uniqueid']),_0x19d991);members['cdr'](_0x19d991);}catch(_0x1fc5fb){utils[_0xb361('0x1a')](util[_0xb361('0x1f')](_0xb361('0x39'),_0x19d991[_0xb361('0x23')]),_0x1fc5fb);}});ami['on'](_0xb361('0x3a'),function(_0x24dd0f){try{utils[_0xb361('0x1e')](util[_0xb361('0x1f')](_0xb361('0x3b'),_0x24dd0f['uniqueid']),_0x24dd0f);queues[_0xb361('0x3a')](_0x24dd0f);agents[_0xb361('0x3a')](_0x24dd0f);transfers['blindtransfer'](_0x24dd0f);}catch(_0x462564){utils[_0xb361('0x1a')](util[_0xb361('0x1f')](_0xb361('0x3b'),_0x24dd0f[_0xb361('0x23')]),_0x462564);}});ami['on'](_0xb361('0x3c'),function(_0x4f12bb){try{utils[_0xb361('0x1e')](util[_0xb361('0x1f')]('[%s][index][attendedtransfer]',_0x4f12bb[_0xb361('0x3d')]),_0x4f12bb);queues['attendedtransfer'](_0x4f12bb);transfers['attendedtransfer'](_0x4f12bb);agents[_0xb361('0x3c')](_0x4f12bb);calls[_0xb361('0x3c')](_0x4f12bb);}catch(_0x4521d2){utils[_0xb361('0x1a')](util[_0xb361('0x1f')](_0xb361('0x3e'),_0x4f12bb[_0xb361('0x3d')]),_0x4521d2);}});ami['on']('varset',function(_0x493c90){try{utils[_0xb361('0x1e')](util['format'](_0xb361('0x3f'),_0x493c90[_0xb361('0x23')]),_0x493c90);queues[_0xb361('0x40')](_0x493c90);recordings['varset'](_0x493c90);calls['varset'](_0x493c90);dials['varset'](_0x493c90);}catch(_0x1403ca){utils['error'](util[_0xb361('0x1f')](_0xb361('0x3f'),_0x493c90[_0xb361('0x23')]),_0x1403ca);}});ami['on'](_0xb361('0x41'),function(_0x443926){try{utils['debug'](util[_0xb361('0x1f')](_0xb361('0x42'),_0x443926[_0xb361('0x23')]),_0x443926);calls['newexten'](_0x443926);recordings[_0xb361('0x41')](_0x443926);dials['newexten'](_0x443926);}catch(_0x1bc30f){utils[_0xb361('0x1a')](util[_0xb361('0x1f')]('[%s][index][newexten]',_0x443926[_0xb361('0x23')]),_0x1bc30f);}});ami['on'](_0xb361('0x43'),function(_0xcbdf49){try{utils[_0xb361('0x1e')](util[_0xb361('0x1f')](_0xb361('0x44'),_0xcbdf49['uniqueid']),_0xcbdf49);calls[_0xb361('0x43')](_0xcbdf49);recordings[_0xb361('0x43')](_0xcbdf49);}catch(_0x31a641){utils[_0xb361('0x1a')](util[_0xb361('0x1f')]('[%s][index][newchannel]',_0xcbdf49[_0xb361('0x23')]),_0x31a641);}});ami['on'](_0xb361('0x45'),function(_0x28e06a){try{utils[_0xb361('0x1e')](util[_0xb361('0x1f')]('[%s][index][dialbegin]',_0x28e06a[_0xb361('0x23')]),_0x28e06a);dials['dialbegin'](_0x28e06a);}catch(_0x4b4f06){utils[_0xb361('0x1a')](util[_0xb361('0x1f')](_0xb361('0x46'),_0x28e06a['uniqueid']),_0x4b4f06);}});ami['on'](_0xb361('0x47'),function(_0x304bca){try{utils['debug'](util[_0xb361('0x1f')](_0xb361('0x48'),_0x304bca[_0xb361('0x23')]),_0x304bca);dials[_0xb361('0x47')](_0x304bca);}catch(_0x20343a){utils[_0xb361('0x1a')](util['format'](_0xb361('0x48'),_0x304bca['uniqueid']),_0x20343a);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 6cd4b0c..361ee9c 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 _0x6460=['destinationchannel','util','./utils','Queue:','info','format','uniqueid','interface','channel','data2','type','getUserByInterface','membername','internal','request','CreateMemberReport','getUserByName','split','then','name','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','state','INUSE','BUSY','TALKING','now','isNil','exitAt','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3'];(function(_0x285fff,_0x4fb54f){var _0x44e78f=function(_0x1b64c8){while(--_0x1b64c8){_0x285fff['push'](_0x285fff['shift']());}};_0x44e78f(++_0x4fb54f);}(_0x6460,0x158));var _0x0646=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x6460[_0x5d7227];return _0x15ac55;};'use strict';var _=require('lodash');var util=require(_0x0646('0x0'));var utils=require(_0x0646('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x0646('0x2')];function writeDB(_0x497292){utils[_0x0646('0x3')](util[_0x0646('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x497292[_0x0646('0x5')],_0x497292[_0x0646('0x6')],_0x497292[_0x0646('0x7')],_0x497292[_0x0646('0x8')],_0x497292['membername'],_0x497292[_0x0646('0x9')]));if(_0x497292[_0x0646('0x6')]){utils[_0x0646('0xa')](_0x497292[_0x0646('0x6')])['then'](function(_0x27b4f5){if(_0x27b4f5){_0x497292[_0x0646('0xb')]=_0x27b4f5['name'];_0x497292[_0x0646('0xc')]=_0x27b4f5[_0x0646('0xc')];utils[_0x0646('0xd')](_0x0646('0xe'),_0x497292);}else{utils[_0x0646('0xf')](_0x497292['interface'][_0x0646('0x10')]('/')[0x1])[_0x0646('0x11')](function(_0x2321d0){if(_0x2321d0){_0x497292[_0x0646('0xb')]=_0x2321d0[_0x0646('0x12')];_0x497292[_0x0646('0xc')]=_0x2321d0[_0x0646('0xc')];utils[_0x0646('0xd')](_0x0646('0xe'),_0x497292);}});}})['catch'](function(_0x89cdc2){utils[_0x0646('0x13')](util[_0x0646('0x4')](_0x0646('0x14'),_0x497292[_0x0646('0x5')]),_0x89cdc2);});}delete members[_0x497292[_0x0646('0x6')]];}function startsWith(_0x1f32bc,_0x59df1e){return _[_0x0646('0x15')](_0x1f32bc,function(_0x297cc9){return _[_0x0646('0x16')](_0x59df1e,_0x297cc9);});}exports[_0x0646('0x17')]=function(_0x5e61c3){try{utils[_0x0646('0x18')](util[_0x0646('0x4')](_0x0646('0x19'),members[_0x5e61c3[_0x0646('0x1a')]]?members[_0x5e61c3['device']][_0x0646('0x5')]:_0x5e61c3[_0x0646('0x1a')]),_0x5e61c3);utils[_0x0646('0x3')](util[_0x0646('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x5e61c3[_0x0646('0x1a')]]?members[_0x5e61c3[_0x0646('0x1a')]][_0x0646('0x5')]:_0x5e61c3[_0x0646('0x1a')],_0x5e61c3[_0x0646('0x1b')],_0x5e61c3[_0x0646('0x1a')]));switch(_0x5e61c3[_0x0646('0x1b')]){case _0x0646('0x1c'):case _0x0646('0x1d'):if(!startsWith(exclude,_0x5e61c3[_0x0646('0x1a')])){members[_0x5e61c3[_0x0646('0x1a')]]={'channel':'voice','interface':_0x5e61c3[_0x0646('0x1a')],'type':_0x0646('0x1e'),'enterAt':utils[_0x0646('0x1f')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x0646('0x20')](members[_0x5e61c3[_0x0646('0x1a')]])){members[_0x5e61c3[_0x0646('0x1a')]][_0x0646('0x21')]=utils[_0x0646('0x1f')]();members[_0x5e61c3[_0x0646('0x1a')]]['duration']=utils[_0x0646('0x22')](members[_0x5e61c3[_0x0646('0x1a')]]['exitAt'],members[_0x5e61c3['device']][_0x0646('0x23')]);if(members[_0x5e61c3['device']][_0x0646('0x5')]){writeDB(members[_0x5e61c3['device']]);}}break;default:break;}}catch(_0x33d1b7){utils[_0x0646('0x13')](util['format'](_0x0646('0x19'),members[_0x5e61c3[_0x0646('0x1a')]]?members[_0x5e61c3[_0x0646('0x1a')]][_0x0646('0x5')]:_0x5e61c3['device']),_0x33d1b7);}};exports[_0x0646('0x24')]=function(_0x470959){try{if(!_[_0x0646('0x20')](members[_0x470959[_0x0646('0x6')]])){utils[_0x0646('0x18')](util[_0x0646('0x4')](_0x0646('0x25'),_0x470959[_0x0646('0x5')]),_0x470959);utils['info'](util[_0x0646('0x4')](_0x0646('0x26'),_0x470959['uniqueid'],_0x470959[_0x0646('0x6')],_0x470959[_0x0646('0x27')]));members[_0x470959[_0x0646('0x6')]]=_[_0x0646('0x28')](members[_0x470959[_0x0646('0x6')]],{'data4':_0x470959[_0x0646('0x27')],'uniqueid':_0x470959[_0x0646('0x5')]});}}catch(_0x305ff2){utils[_0x0646('0x13')](util['format'](_0x0646('0x25'),_0x470959[_0x0646('0x5')]),_0x305ff2);}};exports[_0x0646('0x29')]=function(_0x3056ca){try{utils[_0x0646('0x18')](util[_0x0646('0x4')](_0x0646('0x2a'),_0x3056ca[_0x0646('0x5')]),_0x3056ca);if(_0x3056ca[_0x0646('0x7')]){var _0x363633=_0x3056ca['channel'][_0x0646('0x10')]('-')[0x0];if(!_[_0x0646('0x20')](members[_0x363633])){members[_0x363633]=_[_0x0646('0x28')](members[_0x363633],{'data1':members[_0x363633][_0x0646('0x2b')]||_0x3056ca[_0x0646('0x9')],'data2':members[_0x363633]['data2']||_0x3056ca[_0x0646('0x2c')],'data3':members[_0x363633]['data3']||_0x3056ca[_0x0646('0x2d')],'uniqueid':members[_0x363633]['uniqueid']||_0x3056ca[_0x0646('0x5')]});utils['info'](util[_0x0646('0x4')](_0x0646('0x2e'),_0x3056ca[_0x0646('0x5')],members[_0x363633][_0x0646('0x2b')],members[_0x363633][_0x0646('0x8')],members[_0x363633][_0x0646('0x2f')]));if(members[_0x363633][_0x0646('0x21')]){writeDB(members[_0x363633]);}}}if(_0x3056ca[_0x0646('0x30')]){var _0x377631=_0x3056ca['destinationchannel'][_0x0646('0x10')]('-')[0x0];if(!_['isNil'](members[_0x377631])){members[_0x377631]=_['assign'](members[_0x377631],{'data1':members[_0x377631][_0x0646('0x2b')]||_0x3056ca[_0x0646('0x9')],'data2':members[_0x377631][_0x0646('0x8')]||_0x3056ca['source'],'data3':members[_0x377631][_0x0646('0x2f')]||_0x3056ca[_0x0646('0x2d')],'uniqueid':members[_0x377631][_0x0646('0x5')]||_0x3056ca['uniqueid']});utils[_0x0646('0x3')](util[_0x0646('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x3056ca[_0x0646('0x5')],members[_0x377631][_0x0646('0x2b')],members[_0x377631][_0x0646('0x8')],members[_0x377631][_0x0646('0x2f')]));if(members[_0x377631][_0x0646('0x21')]){writeDB(members[_0x377631]);}}}}catch(_0x234a92){utils['error'](util[_0x0646('0x4')](_0x0646('0x2a'),_0x3056ca[_0x0646('0x5')]),_0x234a92);}}; \ No newline at end of file +var _0x84e1=['then','catch','error','[%s][members][writeDB]','some','devicestatechange','debug','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','now','agent','NOT_INUSE','isNil','diffTime','exitAt','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','type','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split'];(function(_0x4e1780,_0x394c61){var _0x1dcc18=function(_0x11e01a){while(--_0x11e01a){_0x4e1780['push'](_0x4e1780['shift']());}};_0x1dcc18(++_0x394c61);}(_0x84e1,0x1dc));var _0x184e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x84e1[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x184e('0x0'));var util=require(_0x184e('0x1'));var utils=require(_0x184e('0x2'));var members={};var exclude=[_0x184e('0x3'),_0x184e('0x4')];function writeDB(_0x4df769){utils['info'](util[_0x184e('0x5')](_0x184e('0x6'),_0x4df769[_0x184e('0x7')],_0x4df769[_0x184e('0x8')],_0x4df769[_0x184e('0x9')],_0x4df769[_0x184e('0xa')],_0x4df769[_0x184e('0xb')],_0x4df769['type']));if(_0x4df769[_0x184e('0x8')]){utils[_0x184e('0xc')](_0x4df769[_0x184e('0x8')])['then'](function(_0x66d238){if(_0x66d238){_0x4df769[_0x184e('0xb')]=_0x66d238[_0x184e('0xd')];_0x4df769[_0x184e('0xe')]=_0x66d238['internal'];utils[_0x184e('0xf')](_0x184e('0x10'),_0x4df769);}else{utils[_0x184e('0x11')](_0x4df769[_0x184e('0x8')][_0x184e('0x12')]('/')[0x1])[_0x184e('0x13')](function(_0x2568f4){if(_0x2568f4){_0x4df769[_0x184e('0xb')]=_0x2568f4[_0x184e('0xd')];_0x4df769[_0x184e('0xe')]=_0x2568f4[_0x184e('0xe')];utils[_0x184e('0xf')]('CreateMemberReport',_0x4df769);}});}})[_0x184e('0x14')](function(_0x50e4a6){utils[_0x184e('0x15')](util[_0x184e('0x5')](_0x184e('0x16'),_0x4df769[_0x184e('0x7')]),_0x50e4a6);});}delete members[_0x4df769[_0x184e('0x8')]];}function startsWith(_0x446813,_0x28047d){return _[_0x184e('0x17')](_0x446813,function(_0x10b179){return _['startsWith'](_0x28047d,_0x10b179);});}exports[_0x184e('0x18')]=function(_0x5d3a36){try{utils[_0x184e('0x19')](util['format']('[%s][members][devicestatechange]',members[_0x5d3a36[_0x184e('0x1a')]]?members[_0x5d3a36[_0x184e('0x1a')]][_0x184e('0x7')]:_0x5d3a36[_0x184e('0x1a')]),_0x5d3a36);utils[_0x184e('0x1b')](util[_0x184e('0x5')](_0x184e('0x1c'),members[_0x5d3a36[_0x184e('0x1a')]]?members[_0x5d3a36['device']]['uniqueid']:_0x5d3a36[_0x184e('0x1a')],_0x5d3a36[_0x184e('0x1d')],_0x5d3a36[_0x184e('0x1a')]));switch(_0x5d3a36[_0x184e('0x1d')]){case _0x184e('0x1e'):case'BUSY':if(!startsWith(exclude,_0x5d3a36[_0x184e('0x1a')])){members[_0x5d3a36[_0x184e('0x1a')]]={'channel':_0x184e('0x1f'),'interface':_0x5d3a36[_0x184e('0x1a')],'type':_0x184e('0x20'),'enterAt':utils[_0x184e('0x21')](),'role':_0x184e('0x22')};}break;case _0x184e('0x23'):if(!_[_0x184e('0x24')](members[_0x5d3a36[_0x184e('0x1a')]])){members[_0x5d3a36[_0x184e('0x1a')]]['exitAt']=utils[_0x184e('0x21')]();members[_0x5d3a36[_0x184e('0x1a')]]['duration']=utils[_0x184e('0x25')](members[_0x5d3a36[_0x184e('0x1a')]][_0x184e('0x26')],members[_0x5d3a36[_0x184e('0x1a')]][_0x184e('0x27')]);if(members[_0x5d3a36['device']][_0x184e('0x7')]){writeDB(members[_0x5d3a36['device']]);}}break;default:break;}}catch(_0x1c5bde){utils[_0x184e('0x15')](util['format'](_0x184e('0x28'),members[_0x5d3a36[_0x184e('0x1a')]]?members[_0x5d3a36[_0x184e('0x1a')]][_0x184e('0x7')]:_0x5d3a36['device']),_0x1c5bde);}};exports[_0x184e('0x29')]=function(_0x17fbcc){try{if(!_[_0x184e('0x24')](members[_0x17fbcc[_0x184e('0x8')]])){utils[_0x184e('0x19')](util[_0x184e('0x5')](_0x184e('0x2a'),_0x17fbcc[_0x184e('0x7')]),_0x17fbcc);utils[_0x184e('0x1b')](util['format'](_0x184e('0x2b'),_0x17fbcc[_0x184e('0x7')],_0x17fbcc['interface'],_0x17fbcc[_0x184e('0x2c')]));members[_0x17fbcc[_0x184e('0x8')]]=_[_0x184e('0x2d')](members[_0x17fbcc['interface']],{'data4':_0x17fbcc[_0x184e('0x2c')],'uniqueid':_0x17fbcc['uniqueid']});}}catch(_0x535fdb){utils[_0x184e('0x15')](util[_0x184e('0x5')]('[%s][members][agentcomplete]',_0x17fbcc[_0x184e('0x7')]),_0x535fdb);}};exports[_0x184e('0x2e')]=function(_0x2bd604){try{utils[_0x184e('0x19')](util[_0x184e('0x5')](_0x184e('0x2f'),_0x2bd604[_0x184e('0x7')]),_0x2bd604);if(_0x2bd604[_0x184e('0x9')]){var _0x3195a8=_0x2bd604['channel'][_0x184e('0x12')]('-')[0x0];if(!_[_0x184e('0x24')](members[_0x3195a8])){members[_0x3195a8]=_[_0x184e('0x2d')](members[_0x3195a8],{'data1':members[_0x3195a8]['data1']||_0x2bd604['type'],'data2':members[_0x3195a8][_0x184e('0xa')]||_0x2bd604[_0x184e('0x30')],'data3':members[_0x3195a8][_0x184e('0x31')]||_0x2bd604[_0x184e('0x32')],'uniqueid':members[_0x3195a8][_0x184e('0x7')]||_0x2bd604[_0x184e('0x7')]});utils['info'](util[_0x184e('0x5')](_0x184e('0x33'),_0x2bd604[_0x184e('0x7')],members[_0x3195a8][_0x184e('0x34')],members[_0x3195a8][_0x184e('0xa')],members[_0x3195a8][_0x184e('0x31')]));if(members[_0x3195a8][_0x184e('0x26')]){writeDB(members[_0x3195a8]);}}}if(_0x2bd604[_0x184e('0x35')]){var _0x48aa23=_0x2bd604[_0x184e('0x35')][_0x184e('0x12')]('-')[0x0];if(!_[_0x184e('0x24')](members[_0x48aa23])){members[_0x48aa23]=_[_0x184e('0x2d')](members[_0x48aa23],{'data1':members[_0x48aa23]['data1']||_0x2bd604[_0x184e('0x36')],'data2':members[_0x48aa23]['data2']||_0x2bd604[_0x184e('0x30')],'data3':members[_0x48aa23][_0x184e('0x31')]||_0x2bd604[_0x184e('0x32')],'uniqueid':members[_0x48aa23][_0x184e('0x7')]||_0x2bd604[_0x184e('0x7')]});utils['info'](util['format'](_0x184e('0x33'),_0x2bd604[_0x184e('0x7')],members[_0x48aa23]['data1'],members[_0x48aa23][_0x184e('0xa')],members[_0x48aa23][_0x184e('0x31')]));if(members[_0x48aa23][_0x184e('0x26')]){writeDB(members[_0x48aa23]);}}}}catch(_0x2f384a){utils[_0x184e('0x15')](util[_0x184e('0x5')]('[%s][members][cdr]',_0x2bd604[_0x184e('0x7')]),_0x2f384a);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 2d96f1e..77aa45b 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 _0xd939=['[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerabandonAt','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','membername','assigned','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','transfereeuniqueid','transfertype','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][blindtransfer]','attendedtransfer'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xd939,0x13d));var _0x9d93=function(_0x57dc85,_0x3a6d51){_0x57dc85=_0x57dc85-0x0;var _0x563a2e=_0xd939[_0x57dc85];return _0x563a2e;};'use strict';var _=require(_0x9d93('0x0'));var util=require('util');var utils=require(_0x9d93('0x1'));var queues={};function writeDB(_0x1fd3db){utils[_0x9d93('0x2')](util[_0x9d93('0x3')](_0x9d93('0x4'),_0x1fd3db[_0x9d93('0x5')],_0x1fd3db[_0x9d93('0x6')],_0x1fd3db[_0x9d93('0x7')],_0x1fd3db[_0x9d93('0x8')],_0x1fd3db[_0x9d93('0x9')],_0x1fd3db[_0x9d93('0xa')],_0x1fd3db[_0x9d93('0xb')]));if(_0x1fd3db[_0x9d93('0x7')]){utils['getVoiceQueueByName'](_0x1fd3db[_0x9d93('0x7')])[_0x9d93('0xc')](function(_0x2d8bc9){if(_0x2d8bc9){_0x1fd3db[_0x9d93('0xd')]=_0x2d8bc9[_0x9d93('0xd')];}utils[_0x9d93('0xe')](_0x9d93('0xf'),_0x1fd3db);});}else{utils['request'](_0x9d93('0xf'),_0x1fd3db);}if(_0x1fd3db[_0x9d93('0x10')]){delete queues[_0x1fd3db[_0x9d93('0x10')]];}else{delete queues[_0x1fd3db[_0x9d93('0x5')]];}}exports['queuecallerjoin']=function(_0x11cc2f){try{utils[_0x9d93('0x11')](util[_0x9d93('0x3')]('[%s][queues][queuecallerjoin]',_0x11cc2f[_0x9d93('0x5')]),_0x11cc2f);utils[_0x9d93('0x2')](util[_0x9d93('0x3')](_0x9d93('0x12'),_0x11cc2f[_0x9d93('0x5')],_0x11cc2f[_0x9d93('0x7')],_0x11cc2f[_0x9d93('0x13')]));queues[_0x11cc2f['uniqueid']]=_[_0x9d93('0x14')](_0x11cc2f,{'originalposition':_0x11cc2f['position'],'queuecallerjoinAt':utils[_0x9d93('0x15')](),'mohtime':0x0});}catch(_0x2801da){utils[_0x9d93('0x16')](util[_0x9d93('0x3')](_0x9d93('0x17'),_0x11cc2f[_0x9d93('0x5')]),_0x2801da);}};exports[_0x9d93('0x18')]=function(_0x39cce5){try{if(!_[_0x9d93('0x19')](queues[_0x39cce5['uniqueid']])){utils[_0x9d93('0x11')](util[_0x9d93('0x3')](_0x9d93('0x1a'),_0x39cce5[_0x9d93('0x5')]),_0x39cce5);if(queues[_0x39cce5[_0x9d93('0x5')]][_0x9d93('0x1b')]){if(!queues[_0x39cce5[_0x9d93('0x5')]][_0x9d93('0x1c')]&&!queues[_0x39cce5[_0x9d93('0x5')]][_0x9d93('0x1d')]){queues[_0x39cce5[_0x9d93('0x5')]][_0x9d93('0x1e')]=!![];queues[_0x39cce5[_0x9d93('0x5')]][_0x9d93('0x1f')]=utils[_0x9d93('0x15')]();queues[_0x39cce5[_0x9d93('0x5')]][_0x9d93('0xb')]=_0x9d93('0x20');}utils[_0x9d93('0x2')](util[_0x9d93('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x39cce5[_0x9d93('0x5')],queues[_0x39cce5[_0x9d93('0x5')]]['name'],queues[_0x39cce5['uniqueid']][_0x9d93('0xb')]));writeDB(queues[_0x39cce5[_0x9d93('0x5')]]);}else if(queues[_0x39cce5['uniqueid']]['transfereduniqueid']){utils[_0x9d93('0x2')](util[_0x9d93('0x3')](_0x9d93('0x21'),_0x39cce5['uniqueid'],queues[_0x39cce5[_0x9d93('0x5')]][_0x9d93('0x22')],queues[_0x39cce5['uniqueid']][_0x9d93('0x10')]));queues[queues[_0x39cce5[_0x9d93('0x5')]][_0x9d93('0x10')]]=queues[_0x39cce5[_0x9d93('0x5')]];queues[queues[_0x39cce5[_0x9d93('0x5')]][_0x9d93('0x10')]][_0x9d93('0x23')]=0x2;delete queues[_0x39cce5[_0x9d93('0x5')]];}}}catch(_0x5f4005){utils[_0x9d93('0x16')](util[_0x9d93('0x3')](_0x9d93('0x1a'),_0x39cce5['uniqueid']),_0x5f4005);}};exports[_0x9d93('0x24')]=function(_0x1847e0){try{utils[_0x9d93('0x11')](util[_0x9d93('0x3')](_0x9d93('0x25'),_0x1847e0['uniqueid']),_0x1847e0);if(!_[_0x9d93('0x19')](_0x1847e0[_0x9d93('0x26')][_0x9d93('0x27')])&&_0x1847e0[_0x9d93('0x28')][_0x9d93('0x29')]()!==_0x9d93('0x2a')){if(!_[_0x9d93('0x19')](queues[_0x1847e0[_0x9d93('0x5')]])){queues[_0x1847e0[_0x9d93('0x5')]][_0x9d93('0x1c')]=![];queues[_0x1847e0[_0x9d93('0x5')]]['queuecallerabandonAt']=null;queues[_0x1847e0[_0x9d93('0x5')]][_0x9d93('0x1d')]=!![];queues[_0x1847e0['uniqueid']][_0x9d93('0x2b')]=utils['now']();queues[_0x1847e0[_0x9d93('0x5')]]['queuecallerexitreason']=_0x1847e0[_0x9d93('0x28')][_0x9d93('0x29')]();utils[_0x9d93('0x2')](util[_0x9d93('0x3')](_0x9d93('0x2c'),_0x1847e0['uniqueid'],queues[_0x1847e0[_0x9d93('0x5')]][_0x9d93('0x22')],_0x1847e0[_0x9d93('0x28')],queues[_0x1847e0[_0x9d93('0x5')]][_0x9d93('0xb')]));writeDB(queues[_0x1847e0[_0x9d93('0x5')]]);}}else if(!_['isNil'](_0x1847e0[_0x9d93('0x26')]['queueposition'])){if(!_['isNil'](queues[_0x1847e0[_0x9d93('0x5')]])&&!queues[_0x1847e0[_0x9d93('0x5')]][_0x9d93('0x1c')]){queues[_0x1847e0[_0x9d93('0x5')]][_0x9d93('0x1c')]=![];queues[_0x1847e0[_0x9d93('0x5')]]['queuecallerabandonAt']=null;queues[_0x1847e0[_0x9d93('0x5')]]['queuecallerexit']=!![];queues[_0x1847e0[_0x9d93('0x5')]][_0x9d93('0x2b')]=utils[_0x9d93('0x15')]();queues[_0x1847e0['uniqueid']][_0x9d93('0xb')]=_0x9d93('0x2d');utils[_0x9d93('0x2')](util[_0x9d93('0x3')](_0x9d93('0x2e'),_0x1847e0['uniqueid'],queues[_0x1847e0[_0x9d93('0x5')]][_0x9d93('0x22')],_0x1847e0[_0x9d93('0x28')],queues[_0x1847e0[_0x9d93('0x5')]][_0x9d93('0xb')]));}}}catch(_0x4963c1){utils['error'](util['format'](_0x9d93('0x25'),_0x1847e0[_0x9d93('0x5')]),_0x4963c1);}};exports[_0x9d93('0x1c')]=function(_0x28c1ee){try{if(!_[_0x9d93('0x19')](queues[_0x28c1ee[_0x9d93('0x5')]])){utils[_0x9d93('0x11')](util['format'](_0x9d93('0x2f'),_0x28c1ee[_0x9d93('0x5')]),_0x28c1ee);queues[_0x28c1ee[_0x9d93('0x5')]][_0x9d93('0x1d')]=![];queues[_0x28c1ee[_0x9d93('0x5')]][_0x9d93('0x2b')]=null;queues[_0x28c1ee[_0x9d93('0x5')]][_0x9d93('0x1c')]=!![];queues[_0x28c1ee[_0x9d93('0x5')]][_0x9d93('0x30')]=utils[_0x9d93('0x15')]();queues[_0x28c1ee[_0x9d93('0x5')]]['queuecallerexitreason']='ABANDONED';utils['info'](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x28c1ee[_0x9d93('0x5')],queues[_0x28c1ee[_0x9d93('0x5')]]['name'],queues[_0x28c1ee['uniqueid']][_0x9d93('0xb')]));}}catch(_0x52ba13){utils[_0x9d93('0x16')](util['format'](_0x9d93('0x2f'),_0x28c1ee[_0x9d93('0x5')]),_0x52ba13);}};exports[_0x9d93('0x31')]=function(_0x4d78ab){try{if(!_[_0x9d93('0x19')](queues[_0x4d78ab[_0x9d93('0x5')]])){utils[_0x9d93('0x11')](util[_0x9d93('0x3')](_0x9d93('0x32'),_0x4d78ab['uniqueid']),_0x4d78ab);utils['info'](util[_0x9d93('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x4d78ab[_0x9d93('0x5')],queues[_0x4d78ab[_0x9d93('0x5')]][_0x9d93('0x22')],_0x4d78ab[_0x9d93('0x33')],_0x4d78ab[_0x9d93('0x34')]));queues[_0x4d78ab['uniqueid']][_0x9d93('0x31')]=!![];queues[_0x4d78ab[_0x9d93('0x5')]][_0x9d93('0x1b')]=utils['now']();queues[_0x4d78ab['uniqueid']][_0x9d93('0x35')]=utils[_0x9d93('0x36')](queues[_0x4d78ab[_0x9d93('0x5')]][_0x9d93('0x1b')],queues[_0x4d78ab[_0x9d93('0x5')]][_0x9d93('0x37')]);queues[_0x4d78ab[_0x9d93('0x5')]][_0x9d93('0x13')]=_0x4d78ab[_0x9d93('0x13')];queues[_0x4d78ab[_0x9d93('0x5')]][_0x9d93('0x38')]=_0x4d78ab[_0x9d93('0x38')];queues[_0x4d78ab[_0x9d93('0x5')]]['connectedlinenum']=_0x4d78ab[_0x9d93('0x33')];queues[_0x4d78ab['uniqueid']][_0x9d93('0x34')]=_0x4d78ab['connectedlinename'];}}catch(_0x2ab26d){utils[_0x9d93('0x16')](util[_0x9d93('0x3')](_0x9d93('0x32'),_0x4d78ab[_0x9d93('0x5')]),_0x2ab26d);}};exports[_0x9d93('0x39')]=function(_0x372447){try{if(!_[_0x9d93('0x19')](queues[_0x372447[_0x9d93('0x5')]])){utils[_0x9d93('0x11')](util[_0x9d93('0x3')](_0x9d93('0x3a'),_0x372447[_0x9d93('0x5')]),_0x372447);utils[_0x9d93('0x2')](util[_0x9d93('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x372447['uniqueid'],queues[_0x372447['uniqueid']]['name'],_0x372447[_0x9d93('0x3b')],_0x372447['destaccountcode']));queues[_0x372447[_0x9d93('0x5')]][_0x9d93('0x1c')]=![];queues[_0x372447['uniqueid']][_0x9d93('0x1c')]=![];queues[_0x372447[_0x9d93('0x5')]][_0x9d93('0x30')]=null;queues[_0x372447[_0x9d93('0x5')]]['queuecallerexit']=![];queues[_0x372447[_0x9d93('0x5')]]['queuecallerexitreason']=null;queues[_0x372447['uniqueid']][_0x9d93('0x2b')]=null;queues[_0x372447['uniqueid']][_0x9d93('0x3c')]=!![];queues[_0x372447[_0x9d93('0x5')]][_0x9d93('0xa')]=_0x372447['destaccountcode'];queues[_0x372447['uniqueid']][_0x9d93('0x8')]=_0x372447[_0x9d93('0x3b')];}}catch(_0x54244e){utils[_0x9d93('0x16')](util[_0x9d93('0x3')](_0x9d93('0x3a'),_0x372447['uniqueid']),_0x54244e);}};exports['agentcomplete']=function(_0x1566b0){try{if(!_[_0x9d93('0x19')](queues[_0x1566b0[_0x9d93('0x5')]])){if(queues[_0x1566b0[_0x9d93('0x5')]][_0x9d93('0x1b')]){utils[_0x9d93('0x11')](util['format'](_0x9d93('0x3d'),_0x1566b0['uniqueid']),_0x1566b0);queues[_0x1566b0[_0x9d93('0x5')]][_0x9d93('0x1c')]=![];queues[_0x1566b0[_0x9d93('0x5')]][_0x9d93('0x1c')]=![];queues[_0x1566b0[_0x9d93('0x5')]][_0x9d93('0x30')]=null;queues[_0x1566b0[_0x9d93('0x5')]][_0x9d93('0x1d')]=![];queues[_0x1566b0[_0x9d93('0x5')]][_0x9d93('0x2b')]=null;queues[_0x1566b0[_0x9d93('0x5')]][_0x9d93('0x3c')]=!![];queues[_0x1566b0[_0x9d93('0x5')]][_0x9d93('0x8')]=_0x1566b0[_0x9d93('0x3b')];queues[_0x1566b0[_0x9d93('0x5')]][_0x9d93('0x1e')]=!![];queues[_0x1566b0[_0x9d93('0x5')]][_0x9d93('0x1f')]=utils[_0x9d93('0x15')]();if(_0x1566b0[_0x9d93('0x3e')]=='transfer'){if(!queues[_0x1566b0[_0x9d93('0x5')]][_0x9d93('0x3f')]){queues[_0x1566b0[_0x9d93('0x5')]][_0x9d93('0xb')]=_0x9d93('0x40');}}else{queues[_0x1566b0[_0x9d93('0x5')]][_0x9d93('0xb')]=_0x9d93('0x41')+_0x1566b0[_0x9d93('0x3e')][_0x9d93('0x29')]();}utils['info'](util[_0x9d93('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x1566b0[_0x9d93('0x5')],queues[_0x1566b0['uniqueid']][_0x9d93('0x22')],_0x1566b0['membername'],queues[_0x1566b0['uniqueid']][_0x9d93('0xb')]));writeDB(queues[_0x1566b0[_0x9d93('0x5')]]);}}}catch(_0x2570d5){utils['error'](util['format'](_0x9d93('0x3d'),_0x1566b0[_0x9d93('0x5')]),_0x2570d5);}};exports['blindtransfer']=function(_0x3c355f){try{if(!_[_0x9d93('0x19')](queues[_0x3c355f[_0x9d93('0x42')]])){utils['debug'](util[_0x9d93('0x3')]('[%s][queues][blindtransfer]',_0x3c355f[_0x9d93('0x5')]),_0x3c355f);queues[_0x3c355f['transfereeuniqueid']]['transfer']=!![];queues[_0x3c355f[_0x9d93('0x42')]][_0x9d93('0x43')]='BLIND';queues[_0x3c355f['transfereeuniqueid']][_0x9d93('0x44')]=_0x3c355f['extension'];queues[_0x3c355f['transfereeuniqueid']][_0x9d93('0x45')]=_0x3c355f['transfereeuniqueid'];queues[_0x3c355f[_0x9d93('0x42')]]['queuecallerexitreason']=_0x9d93('0x46');utils[_0x9d93('0x2')](util['format'](_0x9d93('0x47'),_0x3c355f['uniqueid'],queues[_0x3c355f['transfereeuniqueid']]['name'],_0x3c355f[_0x9d93('0x42')],_0x3c355f[_0x9d93('0x48')]));}}catch(_0x3b09b2){utils[_0x9d93('0x16')](util[_0x9d93('0x3')](_0x9d93('0x49'),_0x3c355f['uniqueid']),_0x3b09b2);}};exports[_0x9d93('0x4a')]=function(_0x4b3a20){try{utils[_0x9d93('0x11')](util[_0x9d93('0x3')](_0x9d93('0x4b'),_0x4b3a20['origtransfereruniqueid']),_0x4b3a20);if(_0x4b3a20[_0x9d93('0x4c')]==_0x4b3a20[_0x9d93('0x4d')]){if(!_['isNil'](queues[_0x4b3a20[_0x9d93('0x4e')]])){utils[_0x9d93('0x2')](util['format'](_0x9d93('0x4f'),_0x4b3a20['origtransfereruniqueid'],queues[_0x4b3a20[_0x9d93('0x4e')]][_0x9d93('0x22')],_0x4b3a20[_0x9d93('0x50')]));queues[_0x4b3a20[_0x9d93('0x4e')]][_0x9d93('0x3f')]=!![];queues[_0x4b3a20[_0x9d93('0x4e')]][_0x9d93('0x43')]=_0x9d93('0x51');queues[_0x4b3a20[_0x9d93('0x4e')]][_0x9d93('0x44')]=_0x4b3a20[_0x9d93('0x50')];queues[_0x4b3a20['secondtransfererlinkedid']][_0x9d93('0x45')]=_0x4b3a20[_0x9d93('0x4c')];queues[_0x4b3a20[_0x9d93('0x4e')]][_0x9d93('0xb')]=_0x9d93('0x52');}if(!_[_0x9d93('0x19')](queues[_0x4b3a20[_0x9d93('0x4d')]])){if(_0x4b3a20[_0x9d93('0x53')]&&queues[_0x4b3a20['transfereelinkedid']]){queues[_0x4b3a20[_0x9d93('0x53')]][_0x9d93('0x23')]=0x1;queues[_0x4b3a20['transfereeuniqueid']]=_[_0x9d93('0x54')](queues[_0x4b3a20['transfereelinkedid']]);queues[_0x4b3a20['transfereeuniqueid']][_0x9d93('0x10')]=_0x4b3a20[_0x9d93('0x55')];queues[_0x4b3a20['transfereeuniqueid']][_0x9d93('0x23')]=0x2;queues[_0x4b3a20['transfereeuniqueid']][_0x9d93('0x9')]=queues[_0x4b3a20['secondtransfererlinkedid']][_0x9d93('0x9')];queues[_0x4b3a20['transfereeuniqueid']][_0x9d93('0x56')]=queues[_0x4b3a20[_0x9d93('0x4e')]][_0x9d93('0x56')];queues[_0x4b3a20['transfereeuniqueid']][_0x9d93('0x37')]=utils['now']();queues[_0x4b3a20[_0x9d93('0x42')]]['queuecallerleaveAt']=utils[_0x9d93('0x15')]();queues[_0x4b3a20[_0x9d93('0x42')]][_0x9d93('0x35')]=0x0;queues[_0x4b3a20[_0x9d93('0x42')]]['mohtime']=0x0;utils[_0x9d93('0x2')](util[_0x9d93('0x3')](_0x9d93('0x57'),_0x4b3a20['origtransfereruniqueid'],queues[_0x4b3a20[_0x9d93('0x42')]][_0x9d93('0x22')],queues[_0x4b3a20['transfereeuniqueid']][_0x9d93('0x9')],queues[_0x4b3a20['transfereeuniqueid']]['calleridname']));}else{utils[_0x9d93('0x2')](util['format'](_0x9d93('0x58'),_0x4b3a20['origtransfereruniqueid'],queues[_0x4b3a20['origtransfererlinkedid']][_0x9d93('0x22')],_0x4b3a20[_0x9d93('0x4e')]));queues[_0x4b3a20[_0x9d93('0x4d')]][_0x9d93('0x10')]=_0x4b3a20['secondtransfererlinkedid'];}}}else if(_0x4b3a20[_0x9d93('0x59')]==_0x4b3a20['secondtransfererlinkedid']){if(!_[_0x9d93('0x19')](queues[_0x4b3a20['origtransfererlinkedid']])){utils['info'](util[_0x9d93('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4b3a20['origtransfereruniqueid'],queues[_0x4b3a20['origtransfererlinkedid']][_0x9d93('0x22')],_0x4b3a20[_0x9d93('0x59')],_0x4b3a20[_0x9d93('0x5a')]));queues[_0x4b3a20[_0x9d93('0x4d')]]['transfer']=!![];queues[_0x4b3a20['origtransfererlinkedid']][_0x9d93('0x43')]=_0x9d93('0x51');queues[_0x4b3a20['origtransfererlinkedid']][_0x9d93('0x44')]=_0x4b3a20['secondtransfererexten'];queues[_0x4b3a20[_0x9d93('0x4d')]]['transferuniqueid']=_0x4b3a20['secondtransfereruniqueid'];queues[_0x4b3a20[_0x9d93('0x4d')]][_0x9d93('0xb')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x4b3a20[_0x9d93('0x4e')]])){if(_0x4b3a20[_0x9d93('0x5b')]&&queues[_0x4b3a20[_0x9d93('0x5b')]]){queues[_0x4b3a20[_0x9d93('0x5b')]][_0x9d93('0x23')]=0x1;queues[_0x4b3a20[_0x9d93('0x55')]]=_[_0x9d93('0x54')](queues[_0x4b3a20['transfertargetlinkedid']]);queues[_0x4b3a20[_0x9d93('0x55')]][_0x9d93('0x10')]=_0x4b3a20[_0x9d93('0x55')];queues[_0x4b3a20[_0x9d93('0x55')]]['queuecallerenterreason']=0x2;queues[_0x4b3a20['transfertargetuniqueid']][_0x9d93('0x9')]=queues[_0x4b3a20[_0x9d93('0x4d')]][_0x9d93('0x9')];queues[_0x4b3a20[_0x9d93('0x55')]]['calleridname']=queues[_0x4b3a20[_0x9d93('0x4d')]][_0x9d93('0x56')];queues[_0x4b3a20[_0x9d93('0x55')]]['queuecallerjoinAt']=utils[_0x9d93('0x15')]();queues[_0x4b3a20[_0x9d93('0x55')]][_0x9d93('0x1b')]=utils['now']();queues[_0x4b3a20['transfertargetuniqueid']][_0x9d93('0x35')]=0x0;queues[_0x4b3a20[_0x9d93('0x55')]][_0x9d93('0x5c')]=0x0;utils[_0x9d93('0x2')](util[_0x9d93('0x3')](_0x9d93('0x5d'),_0x4b3a20[_0x9d93('0x4c')],queues[_0x4b3a20[_0x9d93('0x55')]]['name'],queues[_0x4b3a20[_0x9d93('0x55')]][_0x9d93('0x10')],queues[_0x4b3a20[_0x9d93('0x55')]][_0x9d93('0x9')],queues[_0x4b3a20[_0x9d93('0x55')]][_0x9d93('0x56')]));}else{utils[_0x9d93('0x2')](util[_0x9d93('0x3')](_0x9d93('0x58'),_0x4b3a20[_0x9d93('0x4c')],queues[_0x4b3a20[_0x9d93('0x4e')]][_0x9d93('0x22')],_0x4b3a20[_0x9d93('0x4d')]));queues[_0x4b3a20[_0x9d93('0x4e')]]['transfereduniqueid']=_0x4b3a20['origtransfererlinkedid'];}}}}catch(_0x231ea7){utils[_0x9d93('0x16')](util['format'](_0x9d93('0x4b'),_0x4b3a20[_0x9d93('0x4c')]),_0x231ea7);}};exports[_0x9d93('0x5e')]=function(_0x4196ee){try{if(!_['isNil'](queues[_0x4196ee[_0x9d93('0x5')]])){utils[_0x9d93('0x11')](util['format'](_0x9d93('0x5f'),_0x4196ee['uniqueid']),_0x4196ee);queues[_0x4196ee['uniqueid']]['musiconholdstartAt']=utils[_0x9d93('0x15')]();utils[_0x9d93('0x2')](util[_0x9d93('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x4196ee['uniqueid'],queues[_0x4196ee[_0x9d93('0x5')]][_0x9d93('0x22')],queues[_0x4196ee['uniqueid']][_0x9d93('0x60')]));}}catch(_0x4c5bae){utils[_0x9d93('0x16')](util['format'](_0x9d93('0x5f'),_0x4196ee[_0x9d93('0x5')]),_0x4c5bae);}};exports[_0x9d93('0x61')]=function(_0x167a20){try{if(!_[_0x9d93('0x19')](queues[_0x167a20['uniqueid']])){if(!_[_0x9d93('0x19')](queues[_0x167a20[_0x9d93('0x5')]][_0x9d93('0x60')])){utils['debug'](util['format']('[%s][queues][musiconholdstop]',_0x167a20[_0x9d93('0x5')]),_0x167a20);queues[_0x167a20['uniqueid']][_0x9d93('0x5c')]+=utils['diffTime'](utils[_0x9d93('0x15')](),queues[_0x167a20[_0x9d93('0x5')]]['musiconholdstartAt']);utils[_0x9d93('0x2')](util[_0x9d93('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x167a20[_0x9d93('0x5')],queues[_0x167a20[_0x9d93('0x5')]][_0x9d93('0x22')],queues[_0x167a20[_0x9d93('0x5')]]['mohtime']));delete queues[_0x167a20[_0x9d93('0x5')]][_0x9d93('0x60')];}}}catch(_0x20b9ae){utils[_0x9d93('0x16')](util['format']('[%s][queues][musiconholdstop]',_0x167a20['uniqueid']),_0x20b9ae);}}; \ No newline at end of file +var _0xa11f=['[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','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','ATTENDED','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','uniqueid','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','isNil','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][varset]','variable','queuestatus','queuecallerabandonAt','queuecallerexitAt','value','toUpperCase','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid'];(function(_0x2b2f77,_0x2b6843){var _0x35532a=function(_0x99e4dc){while(--_0x99e4dc){_0x2b2f77['push'](_0x2b2f77['shift']());}};_0x35532a(++_0x2b6843);}(_0xa11f,0xe7));var _0xfa11=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xa11f[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0xfa11('0x0'));var util=require('util');var utils=require(_0xfa11('0x1'));var queues={};function writeDB(_0x24937b){utils[_0xfa11('0x2')](util[_0xfa11('0x3')](_0xfa11('0x4'),_0x24937b['uniqueid'],_0x24937b[_0xfa11('0x5')],_0x24937b[_0xfa11('0x6')],_0x24937b[_0xfa11('0x7')],_0x24937b['calleridnum'],_0x24937b[_0xfa11('0x8')],_0x24937b[_0xfa11('0x9')]));if(_0x24937b[_0xfa11('0x6')]){utils['getVoiceQueueByName'](_0x24937b[_0xfa11('0x6')])['then'](function(_0x1e4460){if(_0x1e4460){_0x24937b['type']=_0x1e4460[_0xfa11('0xa')];}utils[_0xfa11('0xb')](_0xfa11('0xc'),_0x24937b);});}else{utils[_0xfa11('0xb')]('CreateVoiceQueueReport',_0x24937b);}if(_0x24937b['transfereduniqueid']){delete queues[_0x24937b[_0xfa11('0xd')]];}else{delete queues[_0x24937b['uniqueid']];}}exports[_0xfa11('0xe')]=function(_0x5274a4){try{utils[_0xfa11('0xf')](util['format'](_0xfa11('0x10'),_0x5274a4[_0xfa11('0x11')]),_0x5274a4);utils['info'](util[_0xfa11('0x3')](_0xfa11('0x12'),_0x5274a4[_0xfa11('0x11')],_0x5274a4[_0xfa11('0x6')],_0x5274a4['position']));queues[_0x5274a4[_0xfa11('0x11')]]=_[_0xfa11('0x13')](_0x5274a4,{'originalposition':_0x5274a4[_0xfa11('0x14')],'queuecallerjoinAt':utils[_0xfa11('0x15')](),'mohtime':0x0});}catch(_0xfc6002){utils[_0xfa11('0x16')](util['format'](_0xfa11('0x10'),_0x5274a4[_0xfa11('0x11')]),_0xfc6002);}};exports['hangup']=function(_0x2e3c1d){try{if(!_[_0xfa11('0x17')](queues[_0x2e3c1d[_0xfa11('0x11')]])){utils[_0xfa11('0xf')](util['format']('[%s][queues][hangup]',_0x2e3c1d[_0xfa11('0x11')]),_0x2e3c1d);if(queues[_0x2e3c1d['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x2e3c1d[_0xfa11('0x11')]][_0xfa11('0x18')]&&!queues[_0x2e3c1d[_0xfa11('0x11')]][_0xfa11('0x19')]){queues[_0x2e3c1d[_0xfa11('0x11')]][_0xfa11('0x1a')]=!![];queues[_0x2e3c1d[_0xfa11('0x11')]][_0xfa11('0x1b')]=utils[_0xfa11('0x15')]();queues[_0x2e3c1d[_0xfa11('0x11')]][_0xfa11('0x9')]=_0xfa11('0x1c');}utils['info'](util[_0xfa11('0x3')](_0xfa11('0x1d'),_0x2e3c1d[_0xfa11('0x11')],queues[_0x2e3c1d[_0xfa11('0x11')]]['name'],queues[_0x2e3c1d[_0xfa11('0x11')]][_0xfa11('0x9')]));writeDB(queues[_0x2e3c1d[_0xfa11('0x11')]]);}else if(queues[_0x2e3c1d[_0xfa11('0x11')]]['transfereduniqueid']){utils[_0xfa11('0x2')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x2e3c1d[_0xfa11('0x11')],queues[_0x2e3c1d[_0xfa11('0x11')]][_0xfa11('0x1e')],queues[_0x2e3c1d[_0xfa11('0x11')]][_0xfa11('0xd')]));queues[queues[_0x2e3c1d[_0xfa11('0x11')]][_0xfa11('0xd')]]=queues[_0x2e3c1d['uniqueid']];queues[queues[_0x2e3c1d[_0xfa11('0x11')]][_0xfa11('0xd')]][_0xfa11('0x1f')]=0x2;delete queues[_0x2e3c1d[_0xfa11('0x11')]];}}}catch(_0x3c96a9){utils[_0xfa11('0x16')](util[_0xfa11('0x3')]('[%s][queues][hangup]',_0x2e3c1d[_0xfa11('0x11')]),_0x3c96a9);}};exports['varset']=function(_0xd77eb0){try{utils[_0xfa11('0xf')](util[_0xfa11('0x3')](_0xfa11('0x20'),_0xd77eb0[_0xfa11('0x11')]),_0xd77eb0);if(!_[_0xfa11('0x17')](_0xd77eb0[_0xfa11('0x21')][_0xfa11('0x22')])&&_0xd77eb0['value']['toUpperCase']()!=='CONTINUE'){if(!_[_0xfa11('0x17')](queues[_0xd77eb0['uniqueid']])){queues[_0xd77eb0[_0xfa11('0x11')]][_0xfa11('0x18')]=![];queues[_0xd77eb0[_0xfa11('0x11')]][_0xfa11('0x23')]=null;queues[_0xd77eb0['uniqueid']][_0xfa11('0x19')]=!![];queues[_0xd77eb0[_0xfa11('0x11')]][_0xfa11('0x24')]=utils[_0xfa11('0x15')]();queues[_0xd77eb0[_0xfa11('0x11')]]['queuecallerexitreason']=_0xd77eb0[_0xfa11('0x25')][_0xfa11('0x26')]();utils['info'](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0xd77eb0[_0xfa11('0x11')],queues[_0xd77eb0['uniqueid']][_0xfa11('0x1e')],_0xd77eb0['value'],queues[_0xd77eb0[_0xfa11('0x11')]]['queuecallerexitreason']));writeDB(queues[_0xd77eb0[_0xfa11('0x11')]]);}}else if(!_['isNil'](_0xd77eb0['variable']['queueposition'])){if(!_[_0xfa11('0x17')](queues[_0xd77eb0[_0xfa11('0x11')]])&&!queues[_0xd77eb0[_0xfa11('0x11')]][_0xfa11('0x18')]){queues[_0xd77eb0[_0xfa11('0x11')]]['queuecallerabandon']=![];queues[_0xd77eb0[_0xfa11('0x11')]][_0xfa11('0x23')]=null;queues[_0xd77eb0[_0xfa11('0x11')]][_0xfa11('0x19')]=!![];queues[_0xd77eb0[_0xfa11('0x11')]][_0xfa11('0x24')]=utils[_0xfa11('0x15')]();queues[_0xd77eb0[_0xfa11('0x11')]][_0xfa11('0x9')]=_0xfa11('0x27');utils['info'](util[_0xfa11('0x3')](_0xfa11('0x28'),_0xd77eb0['uniqueid'],queues[_0xd77eb0[_0xfa11('0x11')]][_0xfa11('0x1e')],_0xd77eb0[_0xfa11('0x25')],queues[_0xd77eb0[_0xfa11('0x11')]]['queuecallerexitreason']));}}}catch(_0x184560){utils[_0xfa11('0x16')](util[_0xfa11('0x3')](_0xfa11('0x20'),_0xd77eb0[_0xfa11('0x11')]),_0x184560);}};exports['queuecallerabandon']=function(_0x233d2f){try{if(!_[_0xfa11('0x17')](queues[_0x233d2f[_0xfa11('0x11')]])){utils[_0xfa11('0xf')](util[_0xfa11('0x3')]('[%s][queues][queuecallerabandon]',_0x233d2f['uniqueid']),_0x233d2f);queues[_0x233d2f['uniqueid']][_0xfa11('0x19')]=![];queues[_0x233d2f['uniqueid']][_0xfa11('0x24')]=null;queues[_0x233d2f[_0xfa11('0x11')]][_0xfa11('0x18')]=!![];queues[_0x233d2f[_0xfa11('0x11')]]['queuecallerabandonAt']=utils[_0xfa11('0x15')]();queues[_0x233d2f[_0xfa11('0x11')]][_0xfa11('0x9')]=_0xfa11('0x29');utils['info'](util[_0xfa11('0x3')](_0xfa11('0x2a'),_0x233d2f[_0xfa11('0x11')],queues[_0x233d2f[_0xfa11('0x11')]][_0xfa11('0x1e')],queues[_0x233d2f[_0xfa11('0x11')]]['queuecallerexitreason']));}}catch(_0x239fc5){utils[_0xfa11('0x16')](util[_0xfa11('0x3')]('[%s][queues][queuecallerabandon]',_0x233d2f[_0xfa11('0x11')]),_0x239fc5);}};exports[_0xfa11('0x2b')]=function(_0x1995fd){try{if(!_[_0xfa11('0x17')](queues[_0x1995fd[_0xfa11('0x11')]])){utils[_0xfa11('0xf')](util[_0xfa11('0x3')](_0xfa11('0x2c'),_0x1995fd['uniqueid']),_0x1995fd);utils['info'](util['format'](_0xfa11('0x2d'),_0x1995fd['uniqueid'],queues[_0x1995fd[_0xfa11('0x11')]][_0xfa11('0x1e')],_0x1995fd[_0xfa11('0x2e')],_0x1995fd[_0xfa11('0x2f')]));queues[_0x1995fd[_0xfa11('0x11')]][_0xfa11('0x2b')]=!![];queues[_0x1995fd['uniqueid']][_0xfa11('0x30')]=utils[_0xfa11('0x15')]();queues[_0x1995fd[_0xfa11('0x11')]][_0xfa11('0x31')]=utils[_0xfa11('0x32')](queues[_0x1995fd[_0xfa11('0x11')]][_0xfa11('0x30')],queues[_0x1995fd[_0xfa11('0x11')]][_0xfa11('0x33')]);queues[_0x1995fd[_0xfa11('0x11')]][_0xfa11('0x14')]=_0x1995fd[_0xfa11('0x14')];queues[_0x1995fd['uniqueid']]['count']=_0x1995fd['count'];queues[_0x1995fd[_0xfa11('0x11')]]['connectedlinenum']=_0x1995fd[_0xfa11('0x2e')];queues[_0x1995fd['uniqueid']][_0xfa11('0x2f')]=_0x1995fd[_0xfa11('0x2f')];}}catch(_0x393388){utils[_0xfa11('0x16')](util[_0xfa11('0x3')]('[%s][queues][queuecallerleave]',_0x1995fd[_0xfa11('0x11')]),_0x393388);}};exports[_0xfa11('0x34')]=function(_0x3abb87){try{if(!_[_0xfa11('0x17')](queues[_0x3abb87[_0xfa11('0x11')]])){utils[_0xfa11('0xf')](util[_0xfa11('0x3')](_0xfa11('0x35'),_0x3abb87[_0xfa11('0x11')]),_0x3abb87);utils[_0xfa11('0x2')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x3abb87[_0xfa11('0x11')],queues[_0x3abb87[_0xfa11('0x11')]][_0xfa11('0x1e')],_0x3abb87[_0xfa11('0x36')],_0x3abb87[_0xfa11('0x37')]));queues[_0x3abb87['uniqueid']][_0xfa11('0x18')]=![];queues[_0x3abb87[_0xfa11('0x11')]]['queuecallerabandon']=![];queues[_0x3abb87[_0xfa11('0x11')]][_0xfa11('0x23')]=null;queues[_0x3abb87[_0xfa11('0x11')]][_0xfa11('0x19')]=![];queues[_0x3abb87[_0xfa11('0x11')]][_0xfa11('0x9')]=null;queues[_0x3abb87[_0xfa11('0x11')]][_0xfa11('0x24')]=null;queues[_0x3abb87[_0xfa11('0x11')]]['assigned']=!![];queues[_0x3abb87[_0xfa11('0x11')]][_0xfa11('0x8')]=_0x3abb87[_0xfa11('0x37')];queues[_0x3abb87['uniqueid']][_0xfa11('0x7')]=_0x3abb87['membername'];}}catch(_0x2e4460){utils[_0xfa11('0x16')](util[_0xfa11('0x3')](_0xfa11('0x35'),_0x3abb87[_0xfa11('0x11')]),_0x2e4460);}};exports[_0xfa11('0x38')]=function(_0x453435){try{if(!_[_0xfa11('0x17')](queues[_0x453435[_0xfa11('0x11')]])){if(queues[_0x453435[_0xfa11('0x11')]][_0xfa11('0x30')]){utils['debug'](util['format'](_0xfa11('0x39'),_0x453435[_0xfa11('0x11')]),_0x453435);queues[_0x453435[_0xfa11('0x11')]]['queuecallerabandon']=![];queues[_0x453435['uniqueid']][_0xfa11('0x18')]=![];queues[_0x453435[_0xfa11('0x11')]][_0xfa11('0x23')]=null;queues[_0x453435[_0xfa11('0x11')]][_0xfa11('0x19')]=![];queues[_0x453435[_0xfa11('0x11')]][_0xfa11('0x24')]=null;queues[_0x453435['uniqueid']][_0xfa11('0x3a')]=!![];queues[_0x453435[_0xfa11('0x11')]]['lastAssignedTo']=_0x453435[_0xfa11('0x36')];queues[_0x453435[_0xfa11('0x11')]][_0xfa11('0x1a')]=!![];queues[_0x453435['uniqueid']][_0xfa11('0x1b')]=utils[_0xfa11('0x15')]();if(_0x453435[_0xfa11('0x3b')]==_0xfa11('0x3c')){if(!queues[_0x453435[_0xfa11('0x11')]][_0xfa11('0x3c')]){queues[_0x453435[_0xfa11('0x11')]][_0xfa11('0x9')]=_0xfa11('0x3d');}}else{queues[_0x453435[_0xfa11('0x11')]]['queuecallerexitreason']=_0xfa11('0x3e')+_0x453435[_0xfa11('0x3b')][_0xfa11('0x26')]();}utils[_0xfa11('0x2')](util[_0xfa11('0x3')](_0xfa11('0x3f'),_0x453435[_0xfa11('0x11')],queues[_0x453435[_0xfa11('0x11')]][_0xfa11('0x1e')],_0x453435[_0xfa11('0x36')],queues[_0x453435[_0xfa11('0x11')]][_0xfa11('0x9')]));writeDB(queues[_0x453435[_0xfa11('0x11')]]);}}}catch(_0x53a851){utils['error'](util['format'](_0xfa11('0x39'),_0x453435[_0xfa11('0x11')]),_0x53a851);}};exports[_0xfa11('0x40')]=function(_0x2535db){try{if(!_[_0xfa11('0x17')](queues[_0x2535db[_0xfa11('0x41')]])){utils[_0xfa11('0xf')](util[_0xfa11('0x3')](_0xfa11('0x42'),_0x2535db['uniqueid']),_0x2535db);queues[_0x2535db[_0xfa11('0x41')]][_0xfa11('0x3c')]=!![];queues[_0x2535db[_0xfa11('0x41')]][_0xfa11('0x43')]=_0xfa11('0x44');queues[_0x2535db[_0xfa11('0x41')]][_0xfa11('0x45')]=_0x2535db['extension'];queues[_0x2535db['transfereeuniqueid']][_0xfa11('0x46')]=_0x2535db[_0xfa11('0x41')];queues[_0x2535db['transfereeuniqueid']][_0xfa11('0x9')]=_0xfa11('0x47');utils[_0xfa11('0x2')](util[_0xfa11('0x3')](_0xfa11('0x48'),_0x2535db[_0xfa11('0x11')],queues[_0x2535db[_0xfa11('0x41')]][_0xfa11('0x1e')],_0x2535db[_0xfa11('0x41')],_0x2535db[_0xfa11('0x49')]));}}catch(_0x38c2a5){utils['error'](util[_0xfa11('0x3')](_0xfa11('0x42'),_0x2535db[_0xfa11('0x11')]),_0x38c2a5);}};exports[_0xfa11('0x4a')]=function(_0x55948e){try{utils['debug'](util[_0xfa11('0x3')](_0xfa11('0x4b'),_0x55948e[_0xfa11('0x4c')]),_0x55948e);if(_0x55948e[_0xfa11('0x4c')]==_0x55948e['origtransfererlinkedid']){if(!_[_0xfa11('0x17')](queues[_0x55948e[_0xfa11('0x4d')]])){utils[_0xfa11('0x2')](util[_0xfa11('0x3')](_0xfa11('0x4e'),_0x55948e[_0xfa11('0x4c')],queues[_0x55948e[_0xfa11('0x4d')]][_0xfa11('0x1e')],_0x55948e[_0xfa11('0x4f')]));queues[_0x55948e[_0xfa11('0x4d')]][_0xfa11('0x3c')]=!![];queues[_0x55948e[_0xfa11('0x4d')]][_0xfa11('0x43')]='ATTENDED';queues[_0x55948e[_0xfa11('0x4d')]][_0xfa11('0x45')]=_0x55948e[_0xfa11('0x4f')];queues[_0x55948e[_0xfa11('0x4d')]][_0xfa11('0x46')]=_0x55948e[_0xfa11('0x4c')];queues[_0x55948e[_0xfa11('0x4d')]][_0xfa11('0x9')]=_0xfa11('0x50');}if(!_[_0xfa11('0x17')](queues[_0x55948e[_0xfa11('0x51')]])){if(_0x55948e[_0xfa11('0x52')]&&queues[_0x55948e[_0xfa11('0x52')]]){queues[_0x55948e[_0xfa11('0x52')]]['queuecallerenterreason']=0x1;queues[_0x55948e['transfereeuniqueid']]=_[_0xfa11('0x53')](queues[_0x55948e['transfereelinkedid']]);queues[_0x55948e[_0xfa11('0x41')]]['transfereduniqueid']=_0x55948e['transfertargetuniqueid'];queues[_0x55948e[_0xfa11('0x41')]]['queuecallerenterreason']=0x2;queues[_0x55948e[_0xfa11('0x41')]][_0xfa11('0x54')]=queues[_0x55948e[_0xfa11('0x4d')]][_0xfa11('0x54')];queues[_0x55948e[_0xfa11('0x41')]][_0xfa11('0x55')]=queues[_0x55948e[_0xfa11('0x4d')]]['calleridname'];queues[_0x55948e[_0xfa11('0x41')]]['queuecallerjoinAt']=utils[_0xfa11('0x15')]();queues[_0x55948e[_0xfa11('0x41')]]['queuecallerleaveAt']=utils[_0xfa11('0x15')]();queues[_0x55948e['transfereeuniqueid']]['holdtime']=0x0;queues[_0x55948e['transfereeuniqueid']][_0xfa11('0x56')]=0x0;utils[_0xfa11('0x2')](util[_0xfa11('0x3')](_0xfa11('0x57'),_0x55948e[_0xfa11('0x4c')],queues[_0x55948e[_0xfa11('0x41')]][_0xfa11('0x1e')],queues[_0x55948e[_0xfa11('0x41')]][_0xfa11('0x54')],queues[_0x55948e['transfereeuniqueid']]['calleridname']));}else{utils[_0xfa11('0x2')](util[_0xfa11('0x3')](_0xfa11('0x58'),_0x55948e['origtransfereruniqueid'],queues[_0x55948e['origtransfererlinkedid']][_0xfa11('0x1e')],_0x55948e[_0xfa11('0x4d')]));queues[_0x55948e[_0xfa11('0x51')]]['transfereduniqueid']=_0x55948e[_0xfa11('0x4d')];}}}else if(_0x55948e[_0xfa11('0x59')]==_0x55948e[_0xfa11('0x4d')]){if(!_['isNil'](queues[_0x55948e[_0xfa11('0x51')]])){utils[_0xfa11('0x2')](util['format'](_0xfa11('0x5a'),_0x55948e[_0xfa11('0x4c')],queues[_0x55948e[_0xfa11('0x51')]][_0xfa11('0x1e')],_0x55948e[_0xfa11('0x59')],_0x55948e[_0xfa11('0x5b')]));queues[_0x55948e[_0xfa11('0x51')]][_0xfa11('0x3c')]=!![];queues[_0x55948e[_0xfa11('0x51')]]['transfertype']=_0xfa11('0x5c');queues[_0x55948e[_0xfa11('0x51')]][_0xfa11('0x45')]=_0x55948e[_0xfa11('0x5b')];queues[_0x55948e[_0xfa11('0x51')]][_0xfa11('0x46')]=_0x55948e['secondtransfereruniqueid'];queues[_0x55948e['origtransfererlinkedid']][_0xfa11('0x9')]=_0xfa11('0x50');}if(!_[_0xfa11('0x17')](queues[_0x55948e['secondtransfererlinkedid']])){if(_0x55948e[_0xfa11('0x5d')]&&queues[_0x55948e[_0xfa11('0x5d')]]){queues[_0x55948e[_0xfa11('0x5d')]][_0xfa11('0x1f')]=0x1;queues[_0x55948e[_0xfa11('0x5e')]]=_[_0xfa11('0x53')](queues[_0x55948e[_0xfa11('0x5d')]]);queues[_0x55948e[_0xfa11('0x5e')]][_0xfa11('0xd')]=_0x55948e[_0xfa11('0x5e')];queues[_0x55948e[_0xfa11('0x5e')]]['queuecallerenterreason']=0x2;queues[_0x55948e['transfertargetuniqueid']][_0xfa11('0x54')]=queues[_0x55948e['origtransfererlinkedid']]['calleridnum'];queues[_0x55948e[_0xfa11('0x5e')]][_0xfa11('0x55')]=queues[_0x55948e[_0xfa11('0x51')]][_0xfa11('0x55')];queues[_0x55948e['transfertargetuniqueid']][_0xfa11('0x33')]=utils[_0xfa11('0x15')]();queues[_0x55948e[_0xfa11('0x5e')]][_0xfa11('0x30')]=utils[_0xfa11('0x15')]();queues[_0x55948e[_0xfa11('0x5e')]][_0xfa11('0x31')]=0x0;queues[_0x55948e[_0xfa11('0x5e')]]['mohtime']=0x0;utils[_0xfa11('0x2')](util['format'](_0xfa11('0x5f'),_0x55948e[_0xfa11('0x4c')],queues[_0x55948e[_0xfa11('0x5e')]]['name'],queues[_0x55948e['transfertargetuniqueid']][_0xfa11('0xd')],queues[_0x55948e['transfertargetuniqueid']]['calleridnum'],queues[_0x55948e['transfertargetuniqueid']][_0xfa11('0x55')]));}else{utils[_0xfa11('0x2')](util[_0xfa11('0x3')](_0xfa11('0x58'),_0x55948e[_0xfa11('0x4c')],queues[_0x55948e[_0xfa11('0x4d')]][_0xfa11('0x1e')],_0x55948e['origtransfererlinkedid']));queues[_0x55948e[_0xfa11('0x4d')]][_0xfa11('0xd')]=_0x55948e[_0xfa11('0x51')];}}}}catch(_0x4232f2){utils[_0xfa11('0x16')](util[_0xfa11('0x3')]('[%s][queues][attendedtransfer]',_0x55948e[_0xfa11('0x4c')]),_0x4232f2);}};exports[_0xfa11('0x60')]=function(_0x37f4ef){try{if(!_[_0xfa11('0x17')](queues[_0x37f4ef['uniqueid']])){utils[_0xfa11('0xf')](util['format'](_0xfa11('0x61'),_0x37f4ef[_0xfa11('0x11')]),_0x37f4ef);queues[_0x37f4ef[_0xfa11('0x11')]][_0xfa11('0x62')]=utils['now']();utils[_0xfa11('0x2')](util[_0xfa11('0x3')](_0xfa11('0x63'),_0x37f4ef[_0xfa11('0x11')],queues[_0x37f4ef[_0xfa11('0x11')]][_0xfa11('0x1e')],queues[_0x37f4ef['uniqueid']][_0xfa11('0x62')]));}}catch(_0x59de48){utils[_0xfa11('0x16')](util[_0xfa11('0x3')]('[%s][queues][musiconholdstart]',_0x37f4ef['uniqueid']),_0x59de48);}};exports[_0xfa11('0x64')]=function(_0x2f9b10){try{if(!_['isNil'](queues[_0x2f9b10[_0xfa11('0x11')]])){if(!_[_0xfa11('0x17')](queues[_0x2f9b10[_0xfa11('0x11')]][_0xfa11('0x62')])){utils[_0xfa11('0xf')](util['format'](_0xfa11('0x65'),_0x2f9b10[_0xfa11('0x11')]),_0x2f9b10);queues[_0x2f9b10[_0xfa11('0x11')]]['mohtime']+=utils[_0xfa11('0x32')](utils[_0xfa11('0x15')](),queues[_0x2f9b10[_0xfa11('0x11')]][_0xfa11('0x62')]);utils[_0xfa11('0x2')](util[_0xfa11('0x3')](_0xfa11('0x66'),_0x2f9b10['uniqueid'],queues[_0x2f9b10[_0xfa11('0x11')]][_0xfa11('0x1e')],queues[_0x2f9b10['uniqueid']][_0xfa11('0x56')]));delete queues[_0x2f9b10['uniqueid']][_0xfa11('0x62')];}}}catch(_0x5b6096){utils['error'](util[_0xfa11('0x3')](_0xfa11('0x65'),_0x2f9b10[_0xfa11('0x11')]),_0x5b6096);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 8ec553a..591c9f4 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 _0x212f=['split','substring','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','info','format','uniqueid','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','channel','error','[%s][recordings][newchannel]','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','monitors','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith'];(function(_0x9ea933,_0x565d76){var _0x4fdcd0=function(_0x1b1b59){while(--_0x1b1b59){_0x9ea933['push'](_0x9ea933['shift']());}};_0x4fdcd0(++_0x565d76);}(_0x212f,0x1e5));var _0xf212=function(_0x280751,_0x1047dc){_0x280751=_0x280751-0x0;var _0x5e6bf4=_0x212f[_0x280751];return _0x5e6bf4;};'use strict';var _=require(_0xf212('0x0'));var util=require(_0xf212('0x1'));var utils=require(_0xf212('0x2'));var recordings={};function writeDB(_0x158bac){utils[_0xf212('0x3')](util[_0xf212('0x4')]('[%s][recordings][writeDB]',_0x158bac[_0xf212('0x5')]));if(_0x158bac['accountcode']){utils['getUserByInternal'](_0x158bac['accountcode'])['then'](function(_0x409d91){if(_0x409d91){_0x158bac[_0xf212('0x6')]=_0x409d91[_0xf212('0x7')];_0x158bac[_0xf212('0x8')]=_0x409d91['id'];}utils[_0xf212('0x9')](_0xf212('0xa'),_0x158bac);});}else{utils['request'](_0xf212('0xa'),_0x158bac);}}exports[_0xf212('0xb')]=function(_0x4d848e){try{utils[_0xf212('0xc')](util['format']('[%s][recordings][newchannel]',_0x4d848e[_0xf212('0x5')]),_0x4d848e);if(_0x4d848e[_0xf212('0x5')]==_0x4d848e[_0xf212('0xd')]){utils[_0xf212('0x3')](util[_0xf212('0x4')](_0xf212('0xe'),_0x4d848e[_0xf212('0x5')],_0x4d848e[_0xf212('0xf')],_0x4d848e[_0xf212('0x10')]));recordings[_0x4d848e[_0xf212('0x5')]]={'uniqueid':_0x4d848e['uniqueid'],'accountcode':_0x4d848e[_0xf212('0x11')],'exten':_0x4d848e[_0xf212('0x10')],'context':_0x4d848e['context'],'channel':_0x4d848e[_0xf212('0x12')],'monitors':[]};}}catch(_0x4442ff){utils[_0xf212('0x13')](util[_0xf212('0x4')](_0xf212('0x14'),_0x4d848e[_0xf212('0x5')]),_0x4442ff);}};exports[_0xf212('0x15')]=function(_0x47e0f7){try{utils[_0xf212('0xc')](util['format']('[%s][recordings][newstate]',_0x47e0f7[_0xf212('0x5')]),_0x47e0f7);if(!_[_0xf212('0x16')](recordings[_0x47e0f7['uniqueid']])&&_0x47e0f7[_0xf212('0x17')]==0x6){utils[_0xf212('0x3')](util[_0xf212('0x4')](_0xf212('0x18'),_0x47e0f7[_0xf212('0x5')],_0x47e0f7['context'],_0x47e0f7['channel']));}else if(!_['isNil'](recordings[_0x47e0f7['linkedid']])&&_0x47e0f7[_0xf212('0x17')]==0x6&&_0x47e0f7[_0xf212('0xf')]!=_0xf212('0x19')){utils[_0xf212('0x3')](util[_0xf212('0x4')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x47e0f7[_0xf212('0x5')],_0x47e0f7[_0xf212('0xd')],_0x47e0f7['context'],_0x47e0f7['channel']));recordings[_0x47e0f7[_0xf212('0xd')]][_0xf212('0x11')]=_0x47e0f7[_0xf212('0x11')];}}catch(_0x5ce7d2){utils[_0xf212('0x13')](util[_0xf212('0x4')](_0xf212('0x1a'),_0x47e0f7[_0xf212('0x5')]),_0x5ce7d2);}};exports[_0xf212('0x1b')]=function(_0x1a6b99){try{if(!_[_0xf212('0x16')](_0x1a6b99[_0xf212('0x1c')])&&!_[_0xf212('0x16')](_0x1a6b99[_0xf212('0x1c')][_0xf212('0x1d')])){utils[_0xf212('0xc')](util[_0xf212('0x4')](_0xf212('0x1e'),_0x1a6b99[_0xf212('0x5')]),_0x1a6b99);utils[_0xf212('0x3')](util[_0xf212('0x4')](_0xf212('0x1f'),_0x1a6b99[_0xf212('0x5')],_0x1a6b99[_0xf212('0x1c')],_0x1a6b99[_0xf212('0x20')]));if(_[_0xf212('0x21')](_0x1a6b99[_0xf212('0x20')],_0xf212('0x22'))){_0x1a6b99[_0xf212('0x20')]=_0x1a6b99[_0xf212('0x20')]['replace']('.wav49',_0xf212('0x23'));}if(recordings[_0x1a6b99[_0xf212('0xd')]]){var _0x56f1ab=_['find'](recordings[_0x1a6b99[_0xf212('0xd')]][_0xf212('0x24')],{'value':_0x1a6b99['value']});if(_['isNil'](_0x56f1ab)){recordings[_0x1a6b99[_0xf212('0xd')]][_0xf212('0x24')]['push']({'value':_0x1a6b99['value']});}}}}catch(_0x422ad6){utils[_0xf212('0x13')](util[_0xf212('0x4')](_0xf212('0x1e'),_0x1a6b99[_0xf212('0x5')]),_0x422ad6);}};exports['hangup']=function(_0xa1fdd1){try{if(!_['isNil'](recordings[_0xa1fdd1['uniqueid']])){utils[_0xf212('0xc')](util['format'](_0xf212('0x25'),_0xa1fdd1[_0xf212('0x5')]),_0xa1fdd1);utils[_0xf212('0x3')](util[_0xf212('0x4')](_0xf212('0x26'),_0xa1fdd1['uniqueid'],_0xa1fdd1[_0xf212('0x27')],_0xa1fdd1[_0xf212('0x28')],_0xa1fdd1[_0xf212('0x29')]));recordings[_0xa1fdd1[_0xf212('0x5')]][_0xf212('0x27')]=_0xa1fdd1[_0xf212('0x27')];recordings[_0xa1fdd1[_0xf212('0x5')]]['calleridname']=_0xa1fdd1['calleridname'];recordings[_0xa1fdd1[_0xf212('0x5')]][_0xf212('0x2a')]=_0xa1fdd1[_0xf212('0x2a')];recordings[_0xa1fdd1[_0xf212('0x5')]][_0xf212('0x2b')]=_0xa1fdd1['connectedlinename'];if(recordings[_0xa1fdd1[_0xf212('0x5')]][_0xf212('0x2c')]==_0xf212('0x2d')&&recordings[_0xa1fdd1['uniqueid']][_0xf212('0x11')]){recordings[_0xa1fdd1[_0xf212('0x5')]][_0xf212('0x2a')]=recordings[_0xa1fdd1[_0xf212('0x5')]]['accountcode'];recordings[_0xa1fdd1[_0xf212('0x5')]][_0xf212('0x2b')]='';}recordings[_0xa1fdd1[_0xf212('0x5')]][_0xf212('0x24')][_0xf212('0x2e')](function(_0x15d231){var _0x312993=_[_0xf212('0x2f')](recordings[_0xa1fdd1[_0xf212('0x5')]]);_0x312993['value']=_0x15d231[_0xf212('0x20')];writeDB(_0x312993);});delete recordings[_0xa1fdd1[_0xf212('0x5')]];}}catch(_0x1a549f){utils['error'](util[_0xf212('0x4')](_0xf212('0x25'),_0xa1fdd1[_0xf212('0x5')]),_0x1a549f);}};exports[_0xf212('0x30')]=function(_0x26989b){try{if(!_[_0xf212('0x16')](recordings[_0x26989b[_0xf212('0x5')]])){utils[_0xf212('0xc')](util['format'](_0xf212('0x31'),_0x26989b[_0xf212('0x5')]),_0x26989b);utils['info'](util['format'](_0xf212('0x32'),_0x26989b[_0xf212('0x5')],_0x26989b[_0xf212('0x33')],_0x26989b[_0xf212('0x34')]));if(_0x26989b[_0xf212('0x33')]['toLowerCase']()==_0xf212('0x35')&&_[_0xf212('0x36')](_0x26989b[_0xf212('0x34')]['toLowerCase'](),'cdr')){var _0x43e8ea=_0x26989b[_0xf212('0x34')][_0xf212('0x37')]('=');var _0x50527b=_0x43e8ea[0x0][_0xf212('0x38')](_0x43e8ea[0x0]['lastIndexOf']('(')+0x1,_0x43e8ea[0x0]['lastIndexOf'](')'));var _0xd90d22=_0x43e8ea[0x1];recordings[_0x26989b[_0xf212('0x5')]][_0x50527b]=_0xd90d22;}}}catch(_0x178fb5){utils[_0xf212('0x13')](util['format'](_0xf212('0x31'),_0x26989b['uniqueid']),_0x178fb5);}};exports[_0xf212('0x39')]=function(_0x257331){try{if(!_[_0xf212('0x16')](recordings[_0x257331[_0xf212('0x5')]])){utils['debug'](util[_0xf212('0x4')](_0xf212('0x3a'),_0x257331[_0xf212('0x5')]),_0x257331);utils[_0xf212('0x3')](util[_0xf212('0x4')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x257331[_0xf212('0x5')],_0x257331[_0xf212('0x3b')]));recordings[_0x257331[_0xf212('0x5')]][_0xf212('0x3b')]=_0x257331[_0xf212('0x3b')];}}catch(_0x47cfea){utils['error'](util[_0xf212('0x4')](_0xf212('0x3a'),_0x257331[_0xf212('0x5')]),_0x47cfea);}}; \ No newline at end of file +var _0x456d=['.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','type','outbound','connectedlinename','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','info','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','replace','.wav49'];(function(_0x4460ec,_0x4e38e0){var _0x4d5373=function(_0x579d13){while(--_0x579d13){_0x4460ec['push'](_0x4460ec['shift']());}};_0x4d5373(++_0x4e38e0);}(_0x456d,0x153));var _0xd456=function(_0x21db63,_0x12dc61){_0x21db63=_0x21db63-0x0;var _0x43f127=_0x456d[_0x21db63];return _0x43f127;};'use strict';var _=require(_0xd456('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x190cff){utils[_0xd456('0x1')](util[_0xd456('0x2')](_0xd456('0x3'),_0x190cff['uniqueid']));if(_0x190cff[_0xd456('0x4')]){utils[_0xd456('0x5')](_0x190cff[_0xd456('0x4')])[_0xd456('0x6')](function(_0x3ddc35){if(_0x3ddc35){_0x190cff['membername']=_0x3ddc35[_0xd456('0x7')];_0x190cff['UserId']=_0x3ddc35['id'];}utils['request']('CreateVoiceRecording',_0x190cff);});}else{utils[_0xd456('0x8')](_0xd456('0x9'),_0x190cff);}}exports[_0xd456('0xa')]=function(_0x770ae2){try{utils[_0xd456('0xb')](util[_0xd456('0x2')](_0xd456('0xc'),_0x770ae2[_0xd456('0xd')]),_0x770ae2);if(_0x770ae2[_0xd456('0xd')]==_0x770ae2[_0xd456('0xe')]){utils[_0xd456('0x1')](util[_0xd456('0x2')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x770ae2[_0xd456('0xd')],_0x770ae2['context'],_0x770ae2[_0xd456('0xf')]));recordings[_0x770ae2['uniqueid']]={'uniqueid':_0x770ae2['uniqueid'],'accountcode':_0x770ae2[_0xd456('0x4')],'exten':_0x770ae2[_0xd456('0xf')],'context':_0x770ae2['context'],'channel':_0x770ae2[_0xd456('0x10')],'monitors':[]};}}catch(_0x299497){utils[_0xd456('0x11')](util['format'](_0xd456('0xc'),_0x770ae2[_0xd456('0xd')]),_0x299497);}};exports[_0xd456('0x12')]=function(_0x51a0e4){try{utils[_0xd456('0xb')](util[_0xd456('0x2')](_0xd456('0x13'),_0x51a0e4[_0xd456('0xd')]),_0x51a0e4);if(!_[_0xd456('0x14')](recordings[_0x51a0e4['uniqueid']])&&_0x51a0e4[_0xd456('0x15')]==0x6){utils[_0xd456('0x1')](util[_0xd456('0x2')](_0xd456('0x16'),_0x51a0e4[_0xd456('0xd')],_0x51a0e4[_0xd456('0x17')],_0x51a0e4['channel']));}else if(!_[_0xd456('0x14')](recordings[_0x51a0e4[_0xd456('0xe')]])&&_0x51a0e4[_0xd456('0x15')]==0x6&&_0x51a0e4[_0xd456('0x17')]!=_0xd456('0x18')){utils['info'](util[_0xd456('0x2')](_0xd456('0x19'),_0x51a0e4[_0xd456('0xd')],_0x51a0e4[_0xd456('0xe')],_0x51a0e4['context'],_0x51a0e4[_0xd456('0x10')]));recordings[_0x51a0e4[_0xd456('0xe')]]['accountcode']=_0x51a0e4[_0xd456('0x4')];}}catch(_0x1b80cc){utils['error'](util[_0xd456('0x2')](_0xd456('0x13'),_0x51a0e4[_0xd456('0xd')]),_0x1b80cc);}};exports[_0xd456('0x1a')]=function(_0x63f844){try{if(!_[_0xd456('0x14')](_0x63f844[_0xd456('0x1b')])&&!_['isNil'](_0x63f844['variable']['mixmonitor_filename'])){utils[_0xd456('0xb')](util['format']('[%s][recordings][varset]',_0x63f844[_0xd456('0xd')]),_0x63f844);utils[_0xd456('0x1')](util[_0xd456('0x2')](_0xd456('0x1c'),_0x63f844[_0xd456('0xd')],_0x63f844['variable'],_0x63f844['value']));if(_[_0xd456('0x1d')](_0x63f844[_0xd456('0x1e')],'.wav49')){_0x63f844[_0xd456('0x1e')]=_0x63f844[_0xd456('0x1e')][_0xd456('0x1f')](_0xd456('0x20'),_0xd456('0x21'));}if(recordings[_0x63f844[_0xd456('0xe')]]){var _0x1b949d=_[_0xd456('0x22')](recordings[_0x63f844[_0xd456('0xe')]][_0xd456('0x23')],{'value':_0x63f844[_0xd456('0x1e')]});if(_[_0xd456('0x14')](_0x1b949d)){recordings[_0x63f844[_0xd456('0xe')]][_0xd456('0x23')][_0xd456('0x24')]({'value':_0x63f844['value']});}}}}catch(_0x17fc61){utils[_0xd456('0x11')](util[_0xd456('0x2')]('[%s][recordings][varset]',_0x63f844[_0xd456('0xd')]),_0x17fc61);}};exports[_0xd456('0x25')]=function(_0x87604c){try{if(!_['isNil'](recordings[_0x87604c[_0xd456('0xd')]])){utils[_0xd456('0xb')](util[_0xd456('0x2')](_0xd456('0x26'),_0x87604c[_0xd456('0xd')]),_0x87604c);utils['info'](util['format'](_0xd456('0x27'),_0x87604c[_0xd456('0xd')],_0x87604c[_0xd456('0x28')],_0x87604c['calleridname'],_0x87604c[_0xd456('0x29')]));recordings[_0x87604c[_0xd456('0xd')]][_0xd456('0x28')]=_0x87604c[_0xd456('0x28')];recordings[_0x87604c['uniqueid']][_0xd456('0x2a')]=_0x87604c[_0xd456('0x2a')];recordings[_0x87604c[_0xd456('0xd')]][_0xd456('0x2b')]=_0x87604c[_0xd456('0x2b')];recordings[_0x87604c[_0xd456('0xd')]]['connectedlinename']=_0x87604c['connectedlinename'];if(recordings[_0x87604c[_0xd456('0xd')]][_0xd456('0x2c')]==_0xd456('0x2d')&&recordings[_0x87604c[_0xd456('0xd')]][_0xd456('0x4')]){recordings[_0x87604c[_0xd456('0xd')]][_0xd456('0x2b')]=recordings[_0x87604c[_0xd456('0xd')]][_0xd456('0x4')];recordings[_0x87604c['uniqueid']][_0xd456('0x2e')]='';}recordings[_0x87604c[_0xd456('0xd')]][_0xd456('0x23')][_0xd456('0x2f')](function(_0x144d74){var _0x293eb9=_[_0xd456('0x30')](recordings[_0x87604c[_0xd456('0xd')]]);_0x293eb9[_0xd456('0x1e')]=_0x144d74[_0xd456('0x1e')];writeDB(_0x293eb9);});delete recordings[_0x87604c[_0xd456('0xd')]];}}catch(_0x24f961){utils[_0xd456('0x11')](util[_0xd456('0x2')]('[%s][recordings][hangup]',_0x87604c[_0xd456('0xd')]),_0x24f961);}};exports[_0xd456('0x31')]=function(_0x503416){try{if(!_['isNil'](recordings[_0x503416[_0xd456('0xd')]])){utils[_0xd456('0xb')](util[_0xd456('0x2')](_0xd456('0x32'),_0x503416[_0xd456('0xd')]),_0x503416);utils['info'](util[_0xd456('0x2')](_0xd456('0x33'),_0x503416[_0xd456('0xd')],_0x503416[_0xd456('0x34')],_0x503416[_0xd456('0x35')]));if(_0x503416[_0xd456('0x34')][_0xd456('0x36')]()==_0xd456('0x37')&&_['startsWith'](_0x503416[_0xd456('0x35')]['toLowerCase'](),_0xd456('0x38'))){var _0x7c42c7=_0x503416['appdata']['split']('=');var _0x40743c=_0x7c42c7[0x0][_0xd456('0x39')](_0x7c42c7[0x0][_0xd456('0x3a')]('(')+0x1,_0x7c42c7[0x0][_0xd456('0x3a')](')'));var _0x39c432=_0x7c42c7[0x1];recordings[_0x503416['uniqueid']][_0x40743c]=_0x39c432;}}}catch(_0x5ab249){utils[_0xd456('0x11')](util[_0xd456('0x2')](_0xd456('0x32'),_0x503416['uniqueid']),_0x5ab249);}};exports[_0xd456('0x3b')]=function(_0x465446){try{if(!_[_0xd456('0x14')](recordings[_0x465446['uniqueid']])){utils[_0xd456('0xb')](util[_0xd456('0x2')](_0xd456('0x3c'),_0x465446[_0xd456('0xd')]),_0x465446);utils['info'](util[_0xd456('0x2')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x465446[_0xd456('0xd')],_0x465446[_0xd456('0x3d')]));recordings[_0x465446[_0xd456('0xd')]][_0xd456('0x3d')]=_0x465446[_0xd456('0x3d')];}}catch(_0x28170a){utils['error'](util[_0xd456('0x2')](_0xd456('0x3c'),_0x465446[_0xd456('0xd')]),_0x28170a);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index cf0f43c..f404fda 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 _0x854d=['origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten'];(function(_0x391a87,_0x49d004){var _0x5726d6=function(_0x5be824){while(--_0x5be824){_0x391a87['push'](_0x391a87['shift']());}};_0x5726d6(++_0x49d004);}(_0x854d,0x13a));var _0xd854=function(_0x183ba2,_0x59b72b){_0x183ba2=_0x183ba2-0x0;var _0xb184dc=_0x854d[_0x183ba2];return _0xb184dc;};'use strict';var _=require(_0xd854('0x0'));var util=require(_0xd854('0x1'));var utils=require(_0xd854('0x2'));function writeDB(_0x23054c){utils[_0xd854('0x3')](util['format'](_0xd854('0x4'),_0x23054c[_0xd854('0x5')]==='attended'?_0x23054c['origtransfereruniqueid']:_0x23054c[_0xd854('0x6')],_0x23054c[_0xd854('0x5')]));utils[_0xd854('0x7')](_0xd854('0x8'),_0x23054c);}exports[_0xd854('0x9')]=function(_0x483e95){try{utils[_0xd854('0xa')](util[_0xd854('0xb')](_0xd854('0xc'),_0x483e95['uniqueid']),_0x483e95);utils[_0xd854('0x3')](util['format'](_0xd854('0xd'),_0x483e95['uniqueid'],_0x483e95[_0xd854('0xe')],_0x483e95[_0xd854('0xf')],_0x483e95['transfereecalleridnum'],_0x483e95['transfereecalleridname']));_0x483e95['type']='blind';writeDB(_0x483e95);}catch(_0x36ecf4){utils['error'](util[_0xd854('0xb')](_0xd854('0xc'),_0x483e95['uniqueid']),_0x36ecf4);}};exports['attendedtransfer']=function(_0x1960f8){try{utils['debug'](util[_0xd854('0xb')](_0xd854('0x10'),_0x1960f8['origtransfereruniqueid']),_0x1960f8);utils[_0xd854('0x3')](util[_0xd854('0xb')](_0xd854('0x11'),_0x1960f8[_0xd854('0x12')],_0x1960f8[_0xd854('0x13')],_0x1960f8[_0xd854('0x14')],_0x1960f8['transfertargetcalleridnum'],_0x1960f8[_0xd854('0x15')]));_0x1960f8=_[_0xd854('0x16')](_0x1960f8,{'transfererchannel':_0x1960f8['origtransfererchannel'],'transferercalleridnum':_0x1960f8[_0xd854('0x13')],'transferercalleridname':_0x1960f8[_0xd854('0x14')],'transfererconnectedlinenum':_0x1960f8[_0xd854('0x17')],'transfererconnectedlinename':_0x1960f8[_0xd854('0x18')],'transfereraccountcode':_0x1960f8[_0xd854('0x19')],'transferercontext':_0x1960f8[_0xd854('0x1a')],'transfererexten':_0x1960f8[_0xd854('0x1b')],'transfererlinkedid':_0x1960f8[_0xd854('0x1c')],'context':_0x1960f8[_0xd854('0x1d')],'extension':_0x1960f8[_0xd854('0x1e')],'type':_0xd854('0x1f')});if(_[_0xd854('0x20')](_0x1960f8[_0xd854('0x21')])){_0x1960f8=_['assign'](_0x1960f8,{'transfereechannel':_0x1960f8[_0xd854('0x22')],'transfereecalleridnum':_0x1960f8['transfertargetcalleridnum'],'transfereecalleridname':_0x1960f8[_0xd854('0x15')],'transfereeconnectedlinenum':_0x1960f8['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x1960f8['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1960f8['transfertargetaccountcode'],'transfereecontext':_0x1960f8['transfertargetcontext'],'transfereeexten':_0x1960f8[_0xd854('0x23')],'transfereelinkedid':_0x1960f8[_0xd854('0x24')]});}writeDB(_0x1960f8);}catch(_0x1b380f){utils[_0xd854('0x25')](util['format']('[%s][transfers][attendedtransfer]',_0x1960f8[_0xd854('0x12')]),_0x1b380f);}}; \ No newline at end of file +var _0x9bfb=['origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','type','attended','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten'];(function(_0x1d005d,_0x2326d5){var _0x59dc0a=function(_0x1e4fbf){while(--_0x1e4fbf){_0x1d005d['push'](_0x1d005d['shift']());}};_0x59dc0a(++_0x2326d5);}(_0x9bfb,0x1d7));var _0xb9bf=function(_0x5e5c4c,_0x21abba){_0x5e5c4c=_0x5e5c4c-0x0;var _0x176148=_0x9bfb[_0x5e5c4c];return _0x176148;};'use strict';var _=require(_0xb9bf('0x0'));var util=require(_0xb9bf('0x1'));var utils=require(_0xb9bf('0x2'));function writeDB(_0x3f97ec){utils[_0xb9bf('0x3')](util[_0xb9bf('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0x3f97ec[_0xb9bf('0x5')]===_0xb9bf('0x6')?_0x3f97ec['origtransfereruniqueid']:_0x3f97ec['uniqueid'],_0x3f97ec[_0xb9bf('0x5')]));utils[_0xb9bf('0x7')](_0xb9bf('0x8'),_0x3f97ec);}exports[_0xb9bf('0x9')]=function(_0x2f0d09){try{utils[_0xb9bf('0xa')](util[_0xb9bf('0x4')](_0xb9bf('0xb'),_0x2f0d09[_0xb9bf('0xc')]),_0x2f0d09);utils['info'](util[_0xb9bf('0x4')](_0xb9bf('0xd'),_0x2f0d09[_0xb9bf('0xc')],_0x2f0d09[_0xb9bf('0xe')],_0x2f0d09[_0xb9bf('0xf')],_0x2f0d09[_0xb9bf('0x10')],_0x2f0d09['transfereecalleridname']));_0x2f0d09[_0xb9bf('0x5')]=_0xb9bf('0x11');writeDB(_0x2f0d09);}catch(_0x3e932f){utils[_0xb9bf('0x12')](util[_0xb9bf('0x4')]('[%s][transfers][blindtransfer]',_0x2f0d09[_0xb9bf('0xc')]),_0x3e932f);}};exports[_0xb9bf('0x13')]=function(_0xcaa3d4){try{utils[_0xb9bf('0xa')](util[_0xb9bf('0x4')](_0xb9bf('0x14'),_0xcaa3d4[_0xb9bf('0x15')]),_0xcaa3d4);utils[_0xb9bf('0x3')](util[_0xb9bf('0x4')](_0xb9bf('0x16'),_0xcaa3d4[_0xb9bf('0x15')],_0xcaa3d4[_0xb9bf('0x17')],_0xcaa3d4[_0xb9bf('0x18')],_0xcaa3d4[_0xb9bf('0x19')],_0xcaa3d4[_0xb9bf('0x1a')]));_0xcaa3d4=_[_0xb9bf('0x1b')](_0xcaa3d4,{'transfererchannel':_0xcaa3d4[_0xb9bf('0x1c')],'transferercalleridnum':_0xcaa3d4[_0xb9bf('0x17')],'transferercalleridname':_0xcaa3d4['origtransferercalleridname'],'transfererconnectedlinenum':_0xcaa3d4['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0xcaa3d4[_0xb9bf('0x1d')],'transfereraccountcode':_0xcaa3d4[_0xb9bf('0x1e')],'transferercontext':_0xcaa3d4[_0xb9bf('0x1f')],'transfererexten':_0xcaa3d4[_0xb9bf('0x20')],'transfererlinkedid':_0xcaa3d4['origtransfererlinkedid'],'context':_0xcaa3d4[_0xb9bf('0x21')],'extension':_0xcaa3d4[_0xb9bf('0x22')],'type':_0xb9bf('0x6')});if(_[_0xb9bf('0x23')](_0xcaa3d4[_0xb9bf('0x24')])){_0xcaa3d4=_['assign'](_0xcaa3d4,{'transfereechannel':_0xcaa3d4['transfertargetchannel'],'transfereecalleridnum':_0xcaa3d4[_0xb9bf('0x19')],'transfereecalleridname':_0xcaa3d4[_0xb9bf('0x1a')],'transfereeconnectedlinenum':_0xcaa3d4['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xcaa3d4[_0xb9bf('0x25')],'transfereeaccountcode':_0xcaa3d4[_0xb9bf('0x26')],'transfereecontext':_0xcaa3d4[_0xb9bf('0x27')],'transfereeexten':_0xcaa3d4[_0xb9bf('0x28')],'transfereelinkedid':_0xcaa3d4[_0xb9bf('0x29')]});}writeDB(_0xcaa3d4);}catch(_0x48ac8c){utils[_0xb9bf('0x12')](util[_0xb9bf('0x4')](_0xb9bf('0x14'),_0xcaa3d4[_0xb9bf('0x15')]),_0x48ac8c);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 063a3d9..acdbc6d 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 _0xa0bf=['GetUser','internal','name','interface','[utils][getUser]\x20where:%s','result','length','then','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]','getVoiceQueueByName','type','[utils][getVoiceQueueByName]\x20name:%s\x20%s','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','isAfter','isBefore','http','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0xa0bf,0xb6));var _0xfa0b=function(_0x3340b7,_0x22208e){_0x3340b7=_0x3340b7-0x0;var _0x30feec=_0xa0bf[_0x3340b7];return _0x30feec;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require('moment');var util=require('util');var client=jayson['client'][_0xfa0b('0x0')]({'port':0x2329});var logger=require('../../config/logger')(_0xfa0b('0x1'));exports['info']=function(_0x183e89,_0x5982cd){logger[_0xfa0b('0x2')](_0x183e89,_0x5982cd?util[_0xfa0b('0x3')](_0x5982cd,{'showHidden':![],'depth':null}):'');};exports[_0xfa0b('0x4')]=function(_0x103ccf,_0x27e71c){logger[_0xfa0b('0x4')](_0x103ccf,_0x27e71c?util[_0xfa0b('0x3')](_0x27e71c,{'showHidden':![],'depth':null}):'');};exports[_0xfa0b('0x5')]=function(_0x3e4686,_0x380823){logger['error'](_0x3e4686,_0x380823?util[_0xfa0b('0x3')](_0x380823,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x395188,_0x166b5b){return client[_0xfa0b('0x6')](_0x395188,{'body':_0x166b5b})['then'](function(_0x1dffc5){logger[_0xfa0b('0x4')](_0xfa0b('0x7'),_0x395188,_0x1dffc5?util[_0xfa0b('0x3')](_0x1dffc5,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x2c6bf9){logger['error'](_0xfa0b('0x7'),_0x395188,_0x2c6bf9?util[_0xfa0b('0x3')](_0x2c6bf9,{'showHidden':![],'depth':null}):'');});};function getUser(_0x7161d4){return client[_0xfa0b('0x6')](_0xfa0b('0x8'),{'options':{'raw':!![],'attributes':['id',_0xfa0b('0x9'),_0xfa0b('0xa'),_0xfa0b('0xb')],'where':_0x7161d4,'limit':0x1}})['then'](function(_0x2f9894){logger['debug'](_0xfa0b('0xc'),JSON['stringify'](_0x7161d4),_0x2f9894?util[_0xfa0b('0x3')](_0x2f9894,{'showHidden':![],'depth':null}):'');return _0x2f9894[_0xfa0b('0xd')][_0xfa0b('0xe')]?_0x2f9894['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x1aa669){return new BPromise(function(_0x4c1788,_0x53c195){if(_0x1aa669){return getUser({'internal':_0x1aa669})[_0xfa0b('0xf')](function(_0x48e5a6){logger[_0xfa0b('0x2')](_0xfa0b('0x10'),_0x1aa669,_0x48e5a6?_0xfa0b('0x11'):_0xfa0b('0x12'));return _0x4c1788(_0x48e5a6);})[_0xfa0b('0x13')](function(_0x3f1d23){logger[_0xfa0b('0x5')](_0xfa0b('0x14'),_0x3f1d23?util[_0xfa0b('0x3')](_0x3f1d23,{'showHidden':![],'depth':null}):'');return _0x4c1788(null);});}return _0x4c1788(null);});};exports['getUserByInterface']=function(_0x33c102){return new BPromise(function(_0xa4d974,_0x51f650){if(_0x33c102){return getUser({'interface':_0x33c102})['then'](function(_0x101c78){logger[_0xfa0b('0x2')](_0xfa0b('0x15'),_0x33c102,_0x101c78?'found':_0xfa0b('0x12'));return _0xa4d974(_0x101c78);})[_0xfa0b('0x13')](function(_0x1ff89a){logger[_0xfa0b('0x5')]('[utils][getUserByInterface]',_0x1ff89a?util[_0xfa0b('0x3')](_0x1ff89a,{'showHidden':![],'depth':null}):'');return _0xa4d974(null);});}return _0xa4d974(null);});};exports[_0xfa0b('0x16')]=function(_0xd0cb35){return new BPromise(function(_0x3c90e5,_0x5ed1bb){if(_0xd0cb35){return getUser({'name':_0xd0cb35})[_0xfa0b('0xf')](function(_0x422a17){logger[_0xfa0b('0x2')]('[utils][getUserByName]\x20name:%s\x20%s',_0xd0cb35,_0x422a17?_0xfa0b('0x11'):_0xfa0b('0x12'));return _0x3c90e5(_0x422a17);})[_0xfa0b('0x13')](function(_0x1d4566){logger[_0xfa0b('0x5')](_0xfa0b('0x17'),_0x1d4566?util[_0xfa0b('0x3')](_0x1d4566,{'showHidden':![],'depth':null}):'');return _0x3c90e5(null);});}return _0x3c90e5(null);});};exports[_0xfa0b('0x18')]=function(_0x17d28a){return new BPromise(function(_0x5bc43b,_0x80362d){if(_0x17d28a){return client[_0xfa0b('0x6')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xfa0b('0xa'),_0xfa0b('0x19'),'acw','acwTimeout'],'where':{'name':_0x17d28a},'limit':0x1}})['then'](function(_0x1acfb6){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x17d28a,_0x1acfb6?util[_0xfa0b('0x3')](_0x1acfb6,{'showHidden':![],'depth':null}):'');logger['info'](_0xfa0b('0x1a'),_0x17d28a,_0x1acfb6?_0xfa0b('0x11'):'notfound');return _0x5bc43b(_0x1acfb6[_0xfa0b('0xd')]['length']?_0x1acfb6[_0xfa0b('0xd')][0x0]:null);})[_0xfa0b('0x13')](function(_0x31f365){logger[_0xfa0b('0x5')]('[utils][getVoiceQueueByName]',_0x31f365?util[_0xfa0b('0x3')](_0x31f365,{'showHidden':![],'depth':null}):'');return _0x5bc43b(null);});}return _0x5bc43b(null);});};exports['addTime']=function(_0x3a7a22,_0x31dcc1){return moment(_0x3a7a22)[_0xfa0b('0x1b')](_0x31dcc1,_0xfa0b('0x1c'))[_0xfa0b('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xfa0b('0x1e')]=function(_0x3afb68,_0x11072a){return moment(_0x3afb68)[_0xfa0b('0x1f')](_0x11072a,_0xfa0b('0x1c'))[_0xfa0b('0x1d')](_0xfa0b('0x20'));};exports[_0xfa0b('0x21')]=function(_0x585344,_0x19082e){return moment(_0x585344)[_0xfa0b('0x22')](moment(_0x19082e),_0xfa0b('0x1c'));};exports[_0xfa0b('0x23')]=function(_0x369c40,_0x359b79){return parseInt(_0x369c40,0xa)+parseInt(_0x359b79,0xa);};exports['now']=function(){return moment()[_0xfa0b('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');};exports['isAfter']=function(_0x43fd6c,_0x3110b9){if(_0x3110b9){return moment(_0x43fd6c)[_0xfa0b('0x24')](_0x3110b9);}return!![];};exports['isBefore']=function(_0x2a547e,_0x295676){if(_0x295676){return moment(_0x2a547e)[_0xfa0b('0x25')](_0x295676);}else if(_0x2a547e){return!![];}return![];}; \ No newline at end of file +var _0x2adc=['[utils][request]\x20name:%s','catch','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','diffTime','diff','sumTime','now','isAfter','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then'];(function(_0x13ec2b,_0x40b664){var _0x1fb3f4=function(_0x3e91e9){while(--_0x3e91e9){_0x13ec2b['push'](_0x13ec2b['shift']());}};_0x1fb3f4(++_0x40b664);}(_0x2adc,0x135));var _0xc2ad=function(_0x5e2298,_0x495447){_0x5e2298=_0x5e2298-0x0;var _0x41dec8=_0x2adc[_0x5e2298];return _0x41dec8;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xc2ad('0x0'));var moment=require(_0xc2ad('0x1'));var util=require(_0xc2ad('0x2'));var client=jayson[_0xc2ad('0x3')][_0xc2ad('0x4')]({'port':0x2329});var logger=require(_0xc2ad('0x5'))(_0xc2ad('0x6'));exports['info']=function(_0xc8b378,_0x44db57){logger[_0xc2ad('0x7')](_0xc8b378,_0x44db57?util[_0xc2ad('0x8')](_0x44db57,{'showHidden':![],'depth':null}):'');};exports[_0xc2ad('0x9')]=function(_0xa15c47,_0x80a1e2){logger[_0xc2ad('0x9')](_0xa15c47,_0x80a1e2?util[_0xc2ad('0x8')](_0x80a1e2,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x14d0f2,_0x34177d){logger[_0xc2ad('0xa')](_0x14d0f2,_0x34177d?util[_0xc2ad('0x8')](_0x34177d,{'showHidden':![],'depth':null}):'');};exports[_0xc2ad('0xb')]=function(_0x58c9ef,_0x3787e0){return client[_0xc2ad('0xb')](_0x58c9ef,{'body':_0x3787e0})[_0xc2ad('0xc')](function(_0x1576d6){logger[_0xc2ad('0x9')](_0xc2ad('0xd'),_0x58c9ef,_0x1576d6?util[_0xc2ad('0x8')](_0x1576d6,{'showHidden':![],'depth':null}):'');})[_0xc2ad('0xe')](function(_0x18b793){logger[_0xc2ad('0xa')](_0xc2ad('0xd'),_0x58c9ef,_0x18b793?util[_0xc2ad('0x8')](_0x18b793,{'showHidden':![],'depth':null}):'');});};function getUser(_0x35d04a){return client['request'](_0xc2ad('0xf'),{'options':{'raw':!![],'attributes':['id',_0xc2ad('0x10'),_0xc2ad('0x11'),'interface'],'where':_0x35d04a,'limit':0x1}})[_0xc2ad('0xc')](function(_0x1538d6){logger[_0xc2ad('0x9')](_0xc2ad('0x12'),JSON[_0xc2ad('0x13')](_0x35d04a),_0x1538d6?util[_0xc2ad('0x8')](_0x1538d6,{'showHidden':![],'depth':null}):'');return _0x1538d6[_0xc2ad('0x14')][_0xc2ad('0x15')]?_0x1538d6[_0xc2ad('0x14')][0x0]:null;});}exports[_0xc2ad('0x16')]=function(_0x2fd920){return new BPromise(function(_0x45ab78,_0x5c7618){if(_0x2fd920){return getUser({'internal':_0x2fd920})[_0xc2ad('0xc')](function(_0x49a995){logger[_0xc2ad('0x7')](_0xc2ad('0x17'),_0x2fd920,_0x49a995?_0xc2ad('0x18'):'notfound');return _0x45ab78(_0x49a995);})[_0xc2ad('0xe')](function(_0x5501bc){logger[_0xc2ad('0xa')](_0xc2ad('0x19'),_0x5501bc?util[_0xc2ad('0x8')](_0x5501bc,{'showHidden':![],'depth':null}):'');return _0x45ab78(null);});}return _0x45ab78(null);});};exports['getUserByInterface']=function(_0x5d8698){return new BPromise(function(_0x21db54,_0x3adfae){if(_0x5d8698){return getUser({'interface':_0x5d8698})[_0xc2ad('0xc')](function(_0x5ef95f){logger[_0xc2ad('0x7')](_0xc2ad('0x1a'),_0x5d8698,_0x5ef95f?_0xc2ad('0x18'):_0xc2ad('0x1b'));return _0x21db54(_0x5ef95f);})[_0xc2ad('0xe')](function(_0x3a1e80){logger[_0xc2ad('0xa')](_0xc2ad('0x1c'),_0x3a1e80?util[_0xc2ad('0x8')](_0x3a1e80,{'showHidden':![],'depth':null}):'');return _0x21db54(null);});}return _0x21db54(null);});};exports[_0xc2ad('0x1d')]=function(_0x2ae7a9){return new BPromise(function(_0x1d02a4,_0x4df234){if(_0x2ae7a9){return getUser({'name':_0x2ae7a9})[_0xc2ad('0xc')](function(_0x4cd380){logger['info'](_0xc2ad('0x1e'),_0x2ae7a9,_0x4cd380?_0xc2ad('0x18'):_0xc2ad('0x1b'));return _0x1d02a4(_0x4cd380);})['catch'](function(_0x3135fa){logger[_0xc2ad('0xa')](_0xc2ad('0x1f'),_0x3135fa?util[_0xc2ad('0x8')](_0x3135fa,{'showHidden':![],'depth':null}):'');return _0x1d02a4(null);});}return _0x1d02a4(null);});};exports['getVoiceQueueByName']=function(_0x348db1){return new BPromise(function(_0x541d99,_0x111dbd){if(_0x348db1){return client[_0xc2ad('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xc2ad('0x11'),'type',_0xc2ad('0x20'),'acwTimeout'],'where':{'name':_0x348db1},'limit':0x1}})['then'](function(_0x2f215b){logger[_0xc2ad('0x9')](_0xc2ad('0x21'),_0x348db1,_0x2f215b?util[_0xc2ad('0x8')](_0x2f215b,{'showHidden':![],'depth':null}):'');logger[_0xc2ad('0x7')](_0xc2ad('0x22'),_0x348db1,_0x2f215b?_0xc2ad('0x18'):_0xc2ad('0x1b'));return _0x541d99(_0x2f215b[_0xc2ad('0x14')][_0xc2ad('0x15')]?_0x2f215b[_0xc2ad('0x14')][0x0]:null);})[_0xc2ad('0xe')](function(_0x55cbec){logger['error'](_0xc2ad('0x23'),_0x55cbec?util['inspect'](_0x55cbec,{'showHidden':![],'depth':null}):'');return _0x541d99(null);});}return _0x541d99(null);});};exports['addTime']=function(_0x17956c,_0x4352fd){return moment(_0x17956c)[_0xc2ad('0x24')](_0x4352fd,'seconds')[_0xc2ad('0x25')](_0xc2ad('0x26'));};exports[_0xc2ad('0x27')]=function(_0x5275e3,_0xf105a4){return moment(_0x5275e3)['subtract'](_0xf105a4,_0xc2ad('0x28'))[_0xc2ad('0x25')](_0xc2ad('0x26'));};exports[_0xc2ad('0x29')]=function(_0x2cf090,_0x2d849e){return moment(_0x2cf090)[_0xc2ad('0x2a')](moment(_0x2d849e),_0xc2ad('0x28'));};exports[_0xc2ad('0x2b')]=function(_0x5c2e16,_0x5934f5){return parseInt(_0x5c2e16,0xa)+parseInt(_0x5934f5,0xa);};exports[_0xc2ad('0x2c')]=function(){return moment()[_0xc2ad('0x25')](_0xc2ad('0x26'));};exports['isAfter']=function(_0x2b98fa,_0x311acc){if(_0x311acc){return moment(_0x2b98fa)[_0xc2ad('0x2d')](_0x311acc);}return!![];};exports['isBefore']=function(_0x47eb66,_0x331d23){if(_0x331d23){return moment(_0x47eb66)['isBefore'](_0x331d23);}else if(_0x47eb66){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 25ecac0..d0b5c6d 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 _0xe3e1=['role','name','ensureDir','then','log','user','no-user','data','catch','error','api','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','format','method','x-forwarded-for','headers','statusCode','responseTime','inspect','use','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','remoteAddress','url','agent_name','setupLoggers','lodash','express-winston','util','./loggers','fileLogger','./safe-template','safeTemplate','/var','xcally','join','client'];(function(_0xf6fc4c,_0x1fb3e0){var _0x3d64bf=function(_0x8891d4){while(--_0x8891d4){_0xf6fc4c['push'](_0xf6fc4c['shift']());}};_0x3d64bf(++_0x1fb3e0);}(_0xe3e1,0x178));var _0x1e3e=function(_0x28c8f3,_0x5a1b71){_0x28c8f3=_0x28c8f3-0x0;var _0x3772da=_0xe3e1[_0x28c8f3];return _0x3772da;};var fs=require('fs-extra');var _=require(_0x1e3e('0x0'));var ewinston=require(_0x1e3e('0x1'));var path=require('path');var util=require(_0x1e3e('0x2'));var fileLogger=require(_0x1e3e('0x3'))[_0x1e3e('0x4')];var safeTemplate=require(_0x1e3e('0x5'))[_0x1e3e('0x6')];var maskSensitiveData=require('./mask-sensitive-data')['maskSensitiveData'];function ClientSideLogger(){function _0xc392a5(_0x4cc634){var _0x4f5f27=path['join'](_0x1e3e('0x7'),'log',_0x1e3e('0x8'));var _0x5cd7f4=path[_0x1e3e('0x9')](_0x1e3e('0xa'),_0x4cc634[_0x1e3e('0xb')]+'-'+_0x4cc634[_0x1e3e('0xc')]);return fs[_0x1e3e('0xd')](path[_0x1e3e('0x9')](_0x4f5f27,_0x5cd7f4))[_0x1e3e('0xe')](function(){var _0x188f2c=fileLogger('client',path[_0x1e3e('0x9')](_0x4f5f27,_0x5cd7f4));return _0x188f2c;})['catch'](function(_0x2982e6){throw _0x2982e6;});}this[_0x1e3e('0xf')]=function(_0x173e20,_0x58c78d,_0x59d695,_0x38c56e){return _0xc392a5(_0x173e20[_0x1e3e('0x10')])[_0x1e3e('0xe')](function(_0x2f703a){var _0x19eae6=_0x2f703a[_0x58c78d];return _0x19eae6;})[_0x1e3e('0xe')](function(_0x1da240){var _0x24c19b=_0x173e20[_0x1e3e('0x10')]?_0x173e20[_0x1e3e('0x10')]['id']:_0x1e3e('0x11');var _0x1f2cd0=_0x38c56e[_0x1e3e('0x12')];var _0x553010=_0x38c56e['timestamp'];var _0x2ea7bd=new Date(Number(_0x553010));return _0x1da240(_0x24c19b,_0x2ea7bd,_0x59d695,_0x1f2cd0);})[_0x1e3e('0x13')](function(_0x47a27e){fileLogger(_0x1e3e('0xa'))[_0x1e3e('0x14')](_0x47a27e);});};}function setupLoggers(_0x647f50){return new Promise(function(_0x8d2f75){var _0x12795c=new ClientSideLogger();var _0x3bd0cc=fileLogger(_0x1e3e('0x15'));var _0x46d0c4=fileLogger('auth');_0x647f50['set']('client-side-logger',_0x12795c);_0x647f50['use'](ewinston[_0x1e3e('0x16')]({'winstonInstance':_0x3bd0cc,'meta':![],'statusLevels':!![],'msg':function(_0x367635,_0x3c76f0){var _0x584598=_0x1e3e('0x17');if(!_[_0x1e3e('0x18')](_0x367635['body'])){_0x584598+=_0x1e3e('0x19');var _0x3f965d=_0x367635['body'];maskSensitiveData(_0x3f965d);}return safeTemplate(util[_0x1e3e('0x1a')](_0x584598,_0x367635[_0x1e3e('0x1b')],_0x367635['headers'][_0x1e3e('0x1c')]?_0x367635[_0x1e3e('0x1d')][_0x1e3e('0x1c')]:_0x367635['connection']['remoteAddress']||_0x367635['ip'],_0x367635['url'],_0x3c76f0[_0x1e3e('0x1e')],_0x3c76f0[_0x1e3e('0x1f')],_0x367635[_0x1e3e('0x10')]?_0x367635[_0x1e3e('0x10')]['id']:null,_0x367635[_0x1e3e('0x10')]?_0x367635['user'][_0x1e3e('0xc')]:null,_0x367635[_0x1e3e('0x10')]?_0x367635[_0x1e3e('0x10')][_0x1e3e('0xb')]:null,_0x3f965d?util[_0x1e3e('0x20')](_0x3f965d,![],null):''));}}));_0x647f50[_0x1e3e('0x21')](ewinston[_0x1e3e('0x16')]({'winstonInstance':_0x46d0c4,'meta':![],'statusLevels':!![],'msg':function(_0x3ecdf2,_0x1aae35){var _0x106e60='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x3ecdf2[_0x1e3e('0x22')]&&_0x3ecdf2[_0x1e3e('0x22')][_0x1e3e('0x23')]&&_0x3ecdf2[_0x1e3e('0x22')][_0x1e3e('0x24')]){_0x106e60=_0x1e3e('0x25');}return util[_0x1e3e('0x1a')](_0x106e60,_0x3ecdf2[_0x1e3e('0x1b')],_0x3ecdf2[_0x1e3e('0x1d')][_0x1e3e('0x1c')]?_0x3ecdf2[_0x1e3e('0x1d')]['x-forwarded-for']:_0x3ecdf2[_0x1e3e('0x26')][_0x1e3e('0x27')]||_0x3ecdf2['ip'],_0x3ecdf2[_0x1e3e('0x28')],_0x1aae35[_0x1e3e('0x1e')],_0x1aae35[_0x1e3e('0x1f')],_0x3ecdf2[_0x1e3e('0x10')]?_0x3ecdf2[_0x1e3e('0x10')]['id']:null,_0x3ecdf2['user']?_0x3ecdf2['user'][_0x1e3e('0xc')]:null,_0x3ecdf2[_0x1e3e('0x10')]?_0x3ecdf2[_0x1e3e('0x10')][_0x1e3e('0xb')]:null,_0x3ecdf2[_0x1e3e('0x22')]&&_0x3ecdf2[_0x1e3e('0x22')]['device']?_0x3ecdf2[_0x1e3e('0x22')][_0x1e3e('0x23')]:'other',_0x3ecdf2[_0x1e3e('0x22')]&&_0x3ecdf2[_0x1e3e('0x22')][_0x1e3e('0x24')]?_0x3ecdf2[_0x1e3e('0x22')][_0x1e3e('0x24')]:'',_0x3ecdf2[_0x1e3e('0x22')]&&_0x3ecdf2[_0x1e3e('0x22')][_0x1e3e('0x29')]?_0x3ecdf2[_0x1e3e('0x22')][_0x1e3e('0x29')]:'');},'ignoreRoute':function(_0x3f81b6){var _0x3f45fa=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3f45fa['test'](_0x3f81b6[_0x1e3e('0x28')]);}}));return _0x8d2f75();});}exports[_0x1e3e('0x2a')]=setupLoggers; \ No newline at end of file +var _0x60c3=['method','x-forwarded-for','headers','connection','statusCode','responseTime','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','url','device','other','agent_name','setupLoggers','fs-extra','lodash','express-winston','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','log','client','name','ensureDir','then','user','no-user','data','catch','error','auth','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format'];(function(_0x1ab494,_0x1b7bbe){var _0x21b802=function(_0x3ce702){while(--_0x3ce702){_0x1ab494['push'](_0x1ab494['shift']());}};_0x21b802(++_0x1b7bbe);}(_0x60c3,0x118));var _0x360c=function(_0x2ee7cf,_0x1a5197){_0x2ee7cf=_0x2ee7cf-0x0;var _0x1bf2cc=_0x60c3[_0x2ee7cf];return _0x1bf2cc;};var fs=require(_0x360c('0x0'));var _=require(_0x360c('0x1'));var ewinston=require(_0x360c('0x2'));var path=require('path');var util=require(_0x360c('0x3'));var fileLogger=require('./loggers')[_0x360c('0x4')];var safeTemplate=require(_0x360c('0x5'))[_0x360c('0x6')];var maskSensitiveData=require(_0x360c('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x208e31(_0x506d90){var _0x2fb604=path[_0x360c('0x8')](_0x360c('0x9'),_0x360c('0xa'),'xcally');var _0x2fe65b=path[_0x360c('0x8')](_0x360c('0xb'),_0x506d90['role']+'-'+_0x506d90[_0x360c('0xc')]);return fs[_0x360c('0xd')](path['join'](_0x2fb604,_0x2fe65b))[_0x360c('0xe')](function(){var _0x2034bb=fileLogger('client',path[_0x360c('0x8')](_0x2fb604,_0x2fe65b));return _0x2034bb;})['catch'](function(_0x1ab0a5){throw _0x1ab0a5;});}this['log']=function(_0x912a66,_0x4a296a,_0x7226a6,_0x1e1796){return _0x208e31(_0x912a66[_0x360c('0xf')])[_0x360c('0xe')](function(_0x58073d){var _0x343a13=_0x58073d[_0x4a296a];return _0x343a13;})[_0x360c('0xe')](function(_0x257267){var _0x580f67=_0x912a66[_0x360c('0xf')]?_0x912a66[_0x360c('0xf')]['id']:_0x360c('0x10');var _0x6bff4=_0x1e1796[_0x360c('0x11')];var _0x1aaa78=_0x1e1796['timestamp'];var _0x1c8404=new Date(Number(_0x1aaa78));return _0x257267(_0x580f67,_0x1c8404,_0x7226a6,_0x6bff4);})[_0x360c('0x12')](function(_0x5c9ebf){fileLogger(_0x360c('0xb'))[_0x360c('0x13')](_0x5c9ebf);});};}function setupLoggers(_0x5cf504){return new Promise(function(_0x46e41c){var _0x577c04=new ClientSideLogger();var _0x13c6c7=fileLogger('api');var _0x390418=fileLogger(_0x360c('0x14'));_0x5cf504[_0x360c('0x15')](_0x360c('0x16'),_0x577c04);_0x5cf504['use'](ewinston[_0x360c('0x17')]({'winstonInstance':_0x13c6c7,'meta':![],'statusLevels':!![],'msg':function(_0x182e97,_0x2cd908){var _0x31ed62=_0x360c('0x18');if(!_[_0x360c('0x19')](_0x182e97['body'])){_0x31ed62+='\x20body=%s';var _0x4c4f19=_0x182e97[_0x360c('0x1a')];maskSensitiveData(_0x4c4f19);}return safeTemplate(util[_0x360c('0x1b')](_0x31ed62,_0x182e97[_0x360c('0x1c')],_0x182e97['headers'][_0x360c('0x1d')]?_0x182e97[_0x360c('0x1e')]['x-forwarded-for']:_0x182e97[_0x360c('0x1f')]['remoteAddress']||_0x182e97['ip'],_0x182e97['url'],_0x2cd908[_0x360c('0x20')],_0x2cd908[_0x360c('0x21')],_0x182e97[_0x360c('0xf')]?_0x182e97['user']['id']:null,_0x182e97[_0x360c('0xf')]?_0x182e97['user'][_0x360c('0xc')]:null,_0x182e97[_0x360c('0xf')]?_0x182e97[_0x360c('0xf')][_0x360c('0x22')]:null,_0x4c4f19?util[_0x360c('0x23')](_0x4c4f19,![],null):''));}}));_0x5cf504['use'](ewinston[_0x360c('0x17')]({'winstonInstance':_0x390418,'meta':![],'statusLevels':!![],'msg':function(_0x47cb30,_0x3cb5b6){var _0x196e10=_0x360c('0x24');if(_0x47cb30[_0x360c('0x1a')]&&_0x47cb30[_0x360c('0x1a')]['device']&&_0x47cb30[_0x360c('0x1a')][_0x360c('0x25')]){_0x196e10=_0x360c('0x26');}return util[_0x360c('0x1b')](_0x196e10,_0x47cb30[_0x360c('0x1c')],_0x47cb30['headers'][_0x360c('0x1d')]?_0x47cb30['headers'][_0x360c('0x1d')]:_0x47cb30[_0x360c('0x1f')]['remoteAddress']||_0x47cb30['ip'],_0x47cb30[_0x360c('0x27')],_0x3cb5b6[_0x360c('0x20')],_0x3cb5b6['responseTime'],_0x47cb30[_0x360c('0xf')]?_0x47cb30[_0x360c('0xf')]['id']:null,_0x47cb30['user']?_0x47cb30['user'][_0x360c('0xc')]:null,_0x47cb30[_0x360c('0xf')]?_0x47cb30[_0x360c('0xf')][_0x360c('0x22')]:null,_0x47cb30[_0x360c('0x1a')]&&_0x47cb30['body']['device']?_0x47cb30['body'][_0x360c('0x28')]:_0x360c('0x29'),_0x47cb30[_0x360c('0x1a')]&&_0x47cb30[_0x360c('0x1a')][_0x360c('0x25')]?_0x47cb30[_0x360c('0x1a')][_0x360c('0x25')]:'',_0x47cb30[_0x360c('0x1a')]&&_0x47cb30[_0x360c('0x1a')][_0x360c('0x2a')]?_0x47cb30[_0x360c('0x1a')][_0x360c('0x2a')]:'');},'ignoreRoute':function(_0x123075){var _0x34a331=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x34a331['test'](_0x123075['url']);}}));return _0x46e41c();});}exports[_0x360c('0x2b')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 9fa2ee4..daff45c 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd541=['circularDoWInterval','monthsShort','clone','hours','minutes','startOf','day','endOf','isBetween','timeCompare','ddd','includes','daysInMonth','max','min','MMM','monthCompare','guess','isMoment','padStart','split','length','iftime','lodash','moment-timezone','map','source','join','Date\x20not\x20valid','isValid','locale','toLowerCase','indexOf','slice','concat','exports'];(function(_0x239c38,_0x51588c){var _0x5ae63c=function(_0x255e8b){while(--_0x255e8b){_0x239c38['push'](_0x239c38['shift']());}};_0x5ae63c(++_0x51588c);}(_0xd541,0x137));var _0x1d54=function(_0x3a16d4,_0x23ecda){_0x3a16d4=_0x3a16d4-0x0;var _0x31ea9c=_0xd541[_0x3a16d4];return _0x31ea9c;};var _=require(_0x1d54('0x0'));var moment=require(_0x1d54('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x1d54('0x2')](function(_0x1dfa4b){return _0x1dfa4b[_0x1d54('0x3')];})[_0x1d54('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x1d54('0x5');function throwIfDateNotValid(_0x19aac8){if(!_0x19aac8[_0x1d54('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x418d9f){var _0x48b083=_0x418d9f['split'](':')[_0x1d54('0x2')](function(_0x436a63){return parseInt(_0x436a63,0xa);});var _0x5c8492=_0x48b083[0x0];var _0x8b451d=_0x48b083[0x1];if(_0x5c8492<0x0||_0x5c8492>0x17||_0x8b451d<0x0||_0x8b451d>0x3b){throw new Error(EINVALID_DATE);}return[_0x5c8492,_0x8b451d];}function circularDoWInterval(_0x8ca194,_0x4e981d){if(_0x8ca194===_0x4e981d){return[_0x8ca194];}else{var _0x33ac4c=moment[_0x1d54('0x7')]();moment[_0x1d54('0x7')]('en');var _0xd25859=moment['weekdaysShort']()[_0x1d54('0x2')](function(_0x2f17ac){return _0x2f17ac[_0x1d54('0x8')]();});moment['locale'](_0x33ac4c);var _0x2b8aed=_0xd25859['indexOf'](_0x8ca194);var _0x3d099f=_0xd25859[_0x1d54('0x9')](_0x4e981d);if(_0x3d099f>_0x2b8aed){return _0xd25859[_0x1d54('0xa')](_0x2b8aed,_0x3d099f+0x1);}else{var _0x56fcd2=_0xd25859[_0x1d54('0xa')](0x0,_0x3d099f+0x1);var _0x512d69=_0xd25859[_0x1d54('0xa')](_0x2b8aed);return _0x512d69[_0x1d54('0xb')](_0x56fcd2);}}}module[_0x1d54('0xc')][_0x1d54('0xd')]=circularDoWInterval;function circularMonthInterval(_0x31db42,_0x7448b){if(_0x31db42===_0x7448b){return[_0x31db42];}else{var _0x19a283=moment[_0x1d54('0x7')]();moment[_0x1d54('0x7')]('en');var _0x1ba7bd=moment[_0x1d54('0xe')]()['map'](function(_0x5294f4){return _0x5294f4[_0x1d54('0x8')]();});moment[_0x1d54('0x7')](_0x19a283);var _0x23a2ee=_0x1ba7bd[_0x1d54('0x9')](_0x31db42);var _0x71742b=_0x1ba7bd['indexOf'](_0x7448b);if(_0x71742b>_0x23a2ee){return _0x1ba7bd[_0x1d54('0xa')](_0x23a2ee,_0x71742b+0x1);}else{var _0xe4c3e9=_0x1ba7bd[_0x1d54('0xa')](0x0,_0x71742b+0x1);var _0x2ee65b=_0x1ba7bd[_0x1d54('0xa')](_0x23a2ee);return _0x2ee65b[_0x1d54('0xb')](_0xe4c3e9);}}}module[_0x1d54('0xc')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0xdd2560){var _0x1e3931=parseInt(_0xdd2560,0xa);if(_0x1e3931<0x1||_0x1e3931>0x1f){throw new Error(EINVALID_DATE);}return _0x1e3931;}function timeCompare(_0x1e8d5d,_0x26984c,_0x544bb3){var _0x2f4f18=_0x1e8d5d['clone']();var _0x3fdbe1=extractTime(_0x26984c);var _0x391671=_0x3fdbe1[0x0];var _0x28c9b8=_0x3fdbe1[0x1];var _0x1321f0=_0x1e8d5d[_0x1d54('0xf')]()[_0x1d54('0x10')](_0x391671)[_0x1d54('0x11')](_0x28c9b8);throwIfDateNotValid(_0x1321f0);var _0x3928e4=extractTime(_0x544bb3);var _0x2d0b16=_0x3928e4[0x0];var _0x40c4d3=_0x3928e4[0x1];var _0x29f451=_0x1e8d5d['clone']()[_0x1d54('0x10')](_0x2d0b16)['minutes'](_0x40c4d3);throwIfDateNotValid(_0x29f451);if(_0x29f451['isBefore'](_0x1321f0)){var _0x4dce22=_0x2f4f18[_0x1d54('0xf')]()[_0x1d54('0x12')](_0x1d54('0x13'));var _0x2f4226=_0x2f4f18['clone']()[_0x1d54('0x14')](_0x1d54('0x13'));return _0x2f4f18[_0x1d54('0x15')](_0x1321f0,_0x2f4226,undefined,'[]')||_0x2f4f18[_0x1d54('0x15')](_0x4dce22,_0x29f451,undefined,'[]');}else{return _0x2f4f18[_0x1d54('0x15')](_0x1321f0,_0x29f451,undefined,'[]');}}module[_0x1d54('0xc')][_0x1d54('0x16')]=timeCompare;function dowCompare(_0x6f8f52,_0x4a37c0,_0x13251a){var _0x48d954=_0x6f8f52[_0x1d54('0x7')]('en')['format'](_0x1d54('0x17'))[_0x1d54('0x8')]();return circularDoWInterval(_0x4a37c0,_0x13251a)[_0x1d54('0x18')](_0x48d954);}module[_0x1d54('0xc')]['dowCompare']=dowCompare;function domCompare(_0x5cd670,_0xec8bcd,_0x32f202){var _0x5844b9=_0x5cd670['date']();if(_0xec8bcd===_0x32f202){return _0x5844b9===_0xec8bcd;}else{var _0x276f70=_0x5cd670[_0x1d54('0x19')]();var _0x45ef67=_0xec8bcd<_0x32f202;let _0x167cb9=![];var _0x2a0b75=0x0;var _0x15a8df=0x0;if(_0x45ef67){_0x2a0b75=Math[_0x1d54('0x1a')](0x1,_0xec8bcd);_0x15a8df=Math['min'](_0x32f202,_0x276f70);_0x167cb9=_0x5844b9>=_0x2a0b75&&_0x5844b9<=_0x15a8df;}else{_0x2a0b75=Math[_0x1d54('0x1b')](_0xec8bcd,_0x276f70);_0x15a8df=Math[_0x1d54('0x1a')](0x1,_0x32f202);_0x167cb9=_0x5844b9>=_0x2a0b75||_0x5844b9<=_0x15a8df;}return _0x167cb9;}}module['exports']['domCompare']=domCompare;function monthCompare(_0x779931,_0x485d50,_0x135da3){var _0x44cd2a=_0x779931[_0x1d54('0x7')]('en')['format'](_0x1d54('0x1c'))[_0x1d54('0x8')]();return circularMonthInterval(_0x485d50,_0x135da3)[_0x1d54('0x18')](_0x44cd2a);}module['exports'][_0x1d54('0x1d')]=monthCompare;function iftime(_0x4ff11a,_0x3ed052=moment['tz'][_0x1d54('0x1e')](),_0x1a359c=moment()){if(!validateRx['test'](_0x4ff11a)){throw new Error(EINVALID_STRING);}else{var _0x1ea0f9=(moment[_0x1d54('0x1f')](_0x1a359c)?_0x1a359c[_0x1d54('0xf')]():moment(_0x1a359c))['tz'](_0x3ed052)[_0x1d54('0x7')]('en');throwIfDateNotValid(_0x1ea0f9);var _0x1069a5=_0x4ff11a['split'](',');var _0x307238=_0x1069a5[0x0];var _0x34ca34=_0x1069a5[0x1];var _0x3a180a=_0x1069a5[0x2];var _0x5748f8=_0x1069a5[0x3];let _0x1384ad=!![];if(_0x307238!=='*'){var _0x1142a6=_0x307238['split']('-');var _0xc79980=_[_0x1d54('0x20')](_0x1142a6[0x0],0x5,'0');var _0x4a61ed=_0x1142a6['length']===0x2?_[_0x1d54('0x20')](_0x1142a6[0x1],0x5,'0'):_0xc79980;_0x1384ad=timeCompare(_0x1ea0f9,_0xc79980,_0x4a61ed);}let _0x268402=!![];if(_0x34ca34!=='*'){var _0x1a5210=_0x34ca34[_0x1d54('0x21')]('-');var _0x3d5d3a=_0x1a5210[0x0];var _0x5c4ffd=_0x1a5210[_0x1d54('0x22')]===0x2?_0x1a5210[0x1]:_0x3d5d3a;_0x268402=dowCompare(_0x1ea0f9,_0x3d5d3a,_0x5c4ffd);}let _0x4ae40d=!![];if(_0x3a180a!=='*'){var _0x3d4c36=_0x3a180a[_0x1d54('0x21')]('-');var _0x3615fc=parseDom(_0x3d4c36[0x0]);var _0x17241c=_0x3d4c36[_0x1d54('0x22')]===0x2?parseDom(_0x3d4c36[0x1]):_0x3615fc;_0x4ae40d=domCompare(_0x1ea0f9,_0x3615fc,_0x17241c);}let _0x57d9cb=!![];if(_0x5748f8!=='*'){var _0x312284=_0x5748f8[_0x1d54('0x21')]('-');var _0x141765=_0x312284[0x0];var _0x5cd20b=_0x312284[_0x1d54('0x22')]===0x2?_0x312284[0x1]:_0x312284[0x0];_0x57d9cb=monthCompare(_0x1ea0f9,_0x141765,_0x5cd20b);}return _0x1384ad&&_0x268402&&_0x4ae40d&&_0x57d9cb;}}module[_0x1d54('0xc')][_0x1d54('0x23')]=iftime; \ No newline at end of file +var _0x8197=['format','MMM','includes','monthCompare','isMoment','split','padStart','length','iftime','lodash','moment-timezone','map','join','Date\x20not\x20valid','isValid','locale','toLowerCase','indexOf','slice','concat','exports','monthsShort','clone','hours','minutes','isBefore','day','isBetween','ddd','dowCompare','daysInMonth','max','min','domCompare'];(function(_0x231868,_0x5a38f6){var _0x5eb8d4=function(_0x5c6c7f){while(--_0x5c6c7f){_0x231868['push'](_0x231868['shift']());}};_0x5eb8d4(++_0x5a38f6);}(_0x8197,0x17f));var _0x7819=function(_0x3bcdf8,_0x2ef870){_0x3bcdf8=_0x3bcdf8-0x0;var _0x16d8e1=_0x8197[_0x3bcdf8];return _0x16d8e1;};var _=require(_0x7819('0x0'));var moment=require(_0x7819('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x7819('0x2')](function(_0x4adca0){return _0x4adca0['source'];})[_0x7819('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x7819('0x4');function throwIfDateNotValid(_0x12cb8f){if(!_0x12cb8f[_0x7819('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x1deaf3){var _0x38a360=_0x1deaf3['split'](':')[_0x7819('0x2')](function(_0x21c7c9){return parseInt(_0x21c7c9,0xa);});var _0x631dba=_0x38a360[0x0];var _0x425eda=_0x38a360[0x1];if(_0x631dba<0x0||_0x631dba>0x17||_0x425eda<0x0||_0x425eda>0x3b){throw new Error(EINVALID_DATE);}return[_0x631dba,_0x425eda];}function circularDoWInterval(_0xc88d82,_0x4f62ce){if(_0xc88d82===_0x4f62ce){return[_0xc88d82];}else{var _0x503aaf=moment['locale']();moment[_0x7819('0x6')]('en');var _0x30f0a3=moment['weekdaysShort']()[_0x7819('0x2')](function(_0x4183f3){return _0x4183f3[_0x7819('0x7')]();});moment[_0x7819('0x6')](_0x503aaf);var _0x3d1da8=_0x30f0a3[_0x7819('0x8')](_0xc88d82);var _0x599e05=_0x30f0a3[_0x7819('0x8')](_0x4f62ce);if(_0x599e05>_0x3d1da8){return _0x30f0a3[_0x7819('0x9')](_0x3d1da8,_0x599e05+0x1);}else{var _0x437b23=_0x30f0a3['slice'](0x0,_0x599e05+0x1);var _0x55dab4=_0x30f0a3[_0x7819('0x9')](_0x3d1da8);return _0x55dab4[_0x7819('0xa')](_0x437b23);}}}module[_0x7819('0xb')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x5398fa,_0xcc61c3){if(_0x5398fa===_0xcc61c3){return[_0x5398fa];}else{var _0x4d4104=moment[_0x7819('0x6')]();moment['locale']('en');var _0x2d1ef=moment[_0x7819('0xc')]()[_0x7819('0x2')](function(_0x5eb49c){return _0x5eb49c[_0x7819('0x7')]();});moment[_0x7819('0x6')](_0x4d4104);var _0x2f5ed3=_0x2d1ef[_0x7819('0x8')](_0x5398fa);var _0x53a0b8=_0x2d1ef[_0x7819('0x8')](_0xcc61c3);if(_0x53a0b8>_0x2f5ed3){return _0x2d1ef[_0x7819('0x9')](_0x2f5ed3,_0x53a0b8+0x1);}else{var _0x8b7a36=_0x2d1ef[_0x7819('0x9')](0x0,_0x53a0b8+0x1);var _0x221d93=_0x2d1ef[_0x7819('0x9')](_0x2f5ed3);return _0x221d93[_0x7819('0xa')](_0x8b7a36);}}}module[_0x7819('0xb')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x431a01){var _0x2fe49a=parseInt(_0x431a01,0xa);if(_0x2fe49a<0x1||_0x2fe49a>0x1f){throw new Error(EINVALID_DATE);}return _0x2fe49a;}function timeCompare(_0x848577,_0x23eb23,_0xedaa0e){var _0x2fccaa=_0x848577[_0x7819('0xd')]();var _0x3c90c7=extractTime(_0x23eb23);var _0x3097d1=_0x3c90c7[0x0];var _0x24f737=_0x3c90c7[0x1];var _0x2a0ca8=_0x848577[_0x7819('0xd')]()['hours'](_0x3097d1)['minutes'](_0x24f737);throwIfDateNotValid(_0x2a0ca8);var _0x54001f=extractTime(_0xedaa0e);var _0x4c8db6=_0x54001f[0x0];var _0x163291=_0x54001f[0x1];var _0x555aca=_0x848577['clone']()[_0x7819('0xe')](_0x4c8db6)[_0x7819('0xf')](_0x163291);throwIfDateNotValid(_0x555aca);if(_0x555aca[_0x7819('0x10')](_0x2a0ca8)){var _0x205574=_0x2fccaa[_0x7819('0xd')]()['startOf']('day');var _0x1ada4b=_0x2fccaa[_0x7819('0xd')]()['endOf'](_0x7819('0x11'));return _0x2fccaa[_0x7819('0x12')](_0x2a0ca8,_0x1ada4b,undefined,'[]')||_0x2fccaa[_0x7819('0x12')](_0x205574,_0x555aca,undefined,'[]');}else{return _0x2fccaa[_0x7819('0x12')](_0x2a0ca8,_0x555aca,undefined,'[]');}}module[_0x7819('0xb')]['timeCompare']=timeCompare;function dowCompare(_0x468249,_0x2fe77c,_0xf22122){var _0x269b06=_0x468249[_0x7819('0x6')]('en')['format'](_0x7819('0x13'))[_0x7819('0x7')]();return circularDoWInterval(_0x2fe77c,_0xf22122)['includes'](_0x269b06);}module[_0x7819('0xb')][_0x7819('0x14')]=dowCompare;function domCompare(_0x3fa346,_0x2269ac,_0x1c29a1){var _0x230390=_0x3fa346['date']();if(_0x2269ac===_0x1c29a1){return _0x230390===_0x2269ac;}else{var _0x1d0c8e=_0x3fa346[_0x7819('0x15')]();var _0x10bdca=_0x2269ac<_0x1c29a1;let _0x2377a7=![];var _0x4d8b25=0x0;var _0x1f6e9b=0x0;if(_0x10bdca){_0x4d8b25=Math[_0x7819('0x16')](0x1,_0x2269ac);_0x1f6e9b=Math['min'](_0x1c29a1,_0x1d0c8e);_0x2377a7=_0x230390>=_0x4d8b25&&_0x230390<=_0x1f6e9b;}else{_0x4d8b25=Math[_0x7819('0x17')](_0x2269ac,_0x1d0c8e);_0x1f6e9b=Math['max'](0x1,_0x1c29a1);_0x2377a7=_0x230390>=_0x4d8b25||_0x230390<=_0x1f6e9b;}return _0x2377a7;}}module[_0x7819('0xb')][_0x7819('0x18')]=domCompare;function monthCompare(_0x12c03d,_0x886c8b,_0x59ffc7){var _0x359c6f=_0x12c03d[_0x7819('0x6')]('en')[_0x7819('0x19')](_0x7819('0x1a'))[_0x7819('0x7')]();return circularMonthInterval(_0x886c8b,_0x59ffc7)[_0x7819('0x1b')](_0x359c6f);}module['exports'][_0x7819('0x1c')]=monthCompare;function iftime(_0x4cf69a,_0x262341=moment['tz']['guess'](),_0x66a0be=moment()){if(!validateRx['test'](_0x4cf69a)){throw new Error(EINVALID_STRING);}else{var _0x13f11e=(moment[_0x7819('0x1d')](_0x66a0be)?_0x66a0be[_0x7819('0xd')]():moment(_0x66a0be))['tz'](_0x262341)[_0x7819('0x6')]('en');throwIfDateNotValid(_0x13f11e);var _0x34d362=_0x4cf69a['split'](',');var _0xbf85b7=_0x34d362[0x0];var _0x3529de=_0x34d362[0x1];var _0x4512a4=_0x34d362[0x2];var _0x2e6a5e=_0x34d362[0x3];let _0x5a8697=!![];if(_0xbf85b7!=='*'){var _0x2fbd8a=_0xbf85b7[_0x7819('0x1e')]('-');var _0x305795=_[_0x7819('0x1f')](_0x2fbd8a[0x0],0x5,'0');var _0x1d0b45=_0x2fbd8a[_0x7819('0x20')]===0x2?_[_0x7819('0x1f')](_0x2fbd8a[0x1],0x5,'0'):_0x305795;_0x5a8697=timeCompare(_0x13f11e,_0x305795,_0x1d0b45);}let _0x1a3cbe=!![];if(_0x3529de!=='*'){var _0x35b36e=_0x3529de[_0x7819('0x1e')]('-');var _0x407aa8=_0x35b36e[0x0];var _0x5673e2=_0x35b36e[_0x7819('0x20')]===0x2?_0x35b36e[0x1]:_0x407aa8;_0x1a3cbe=dowCompare(_0x13f11e,_0x407aa8,_0x5673e2);}let _0x9bd535=!![];if(_0x4512a4!=='*'){var _0x58ba6c=_0x4512a4['split']('-');var _0x2f4fa9=parseDom(_0x58ba6c[0x0]);var _0x289e3b=_0x58ba6c[_0x7819('0x20')]===0x2?parseDom(_0x58ba6c[0x1]):_0x2f4fa9;_0x9bd535=domCompare(_0x13f11e,_0x2f4fa9,_0x289e3b);}let _0x566448=!![];if(_0x2e6a5e!=='*'){var _0xbdff7b=_0x2e6a5e[_0x7819('0x1e')]('-');var _0x51ac02=_0xbdff7b[0x0];var _0x2b2bcd=_0xbdff7b[_0x7819('0x20')]===0x2?_0xbdff7b[0x1]:_0xbdff7b[0x0];_0x566448=monthCompare(_0x13f11e,_0x51ac02,_0x2b2bcd);}return _0x5a8697&&_0x1a3cbe&&_0x9bd535&&_0x566448;}}module[_0x7819('0xb')][_0x7819('0x21')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 713c490..b18d964 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa00=['[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','}}}','keys','meta','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','Console','warn','transports','%s-%s','error','File','consoleLogger','fileLogger','path','moment','winston','../config/environment','debugLevel','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0xaa00,0x152));var _0x0aa0=function(_0x689879,_0x28628c){_0x689879=_0x689879-0x0;var _0x4d1bda=_0xaa00[_0x689879];return _0x4d1bda;};'use strict';var path=require(_0x0aa0('0x0'));var util=require('util');var moment=require(_0x0aa0('0x1'));var winston=require(_0x0aa0('0x2'));var config=require(_0x0aa0('0x3'));var debugLevel=config['debugLevel']?config[_0x0aa0('0x4')]['toLowerCase']():_0x0aa0('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':_0x0aa0('0x6'),'error':_0x0aa0('0x7'),'warn':_0x0aa0('0x8'),'info':_0x0aa0('0x9'),'print':_0x0aa0('0xa'),'success':_0x0aa0('0xb'),'http':'gray','verbose':_0x0aa0('0xc'),'debug':_0x0aa0('0xd'),'silly':_0x0aa0('0xe')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x2637e0,_0x4a365f,_0x5e4e02){var _0x163b36=_0x2637e0||_0x0aa0('0xf');return path[_0x0aa0('0x10')](_0x163b36,util[_0x0aa0('0x11')](_0x0aa0('0x12'),_0x4a365f,_0x5e4e02));}function formatter(_0x1d224b,_0x5390d2){_0x5390d2[_0x0aa0('0x13')]=_0x5390d2[_0x0aa0('0x13')][_0x0aa0('0x14')](/@@{/g,_0x0aa0('0x15'))[_0x0aa0('0x14')](/}@@/g,'}}}')[_0x0aa0('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x0aa0('0x16'),moment()[_0x0aa0('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0x5390d2[_0x0aa0('0x17')][_0x0aa0('0x18')](),_0x1d224b,_0x5390d2[_0x0aa0('0x13')]);}function fileFormat(_0xf2bba7,_0x515b30){_0x515b30[_0x0aa0('0x13')]=_0x515b30[_0x0aa0('0x13')]['replace'](/@@{/g,_0x0aa0('0x15'))[_0x0aa0('0x14')](/}@@/g,_0x0aa0('0x19'))[_0x0aa0('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x62d022=_0x515b30['meta']&&Object[_0x0aa0('0x1a')](_0x515b30[_0x0aa0('0x1b')])['length']?'\x0a\x09'+JSON[_0x0aa0('0x1c')](_0x515b30['meta']):'';return util[_0x0aa0('0x11')](_0x0aa0('0x1d'),moment()[_0x0aa0('0x11')](_0x0aa0('0x1e')),_0x515b30[_0x0aa0('0x17')]['toUpperCase'](),_0xf2bba7,_0x515b30[_0x0aa0('0x13')],_0x62d022);}function consoleLogger(){var _0x11a70e=new winston[(_0x0aa0('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x0aa0('0x20'))]({'level':_0x0aa0('0x21'),'json':![],'formatter':function(_0x57f994){return formatter('',_0x57f994);}})]});return _0x11a70e;}function fileLogger(_0x904d07,_0x46cc79){var _0x25b6b9=new winston[(_0x0aa0('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x0aa0('0x22'))]['File']({'name':util[_0x0aa0('0x11')](_0x0aa0('0x23'),_0x904d07,_0x0aa0('0x24')),'filename':getLogFileName(_0x46cc79,_0x904d07,_0x0aa0('0x24')),'level':_0x0aa0('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x50eb2c){return fileFormat(_0x904d07,_0x50eb2c);}}),new winston[(_0x0aa0('0x22'))][(_0x0aa0('0x25'))]({'name':util[_0x0aa0('0x11')](_0x0aa0('0x23'),_0x904d07,debugLevel),'filename':getLogFileName(_0x46cc79,_0x904d07,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2c0fce){return fileFormat(_0x904d07,_0x2c0fce);}}),new winston[(_0x0aa0('0x22'))][(_0x0aa0('0x20'))]({'level':_0x0aa0('0x21'),'json':![],'formatter':function(_0x293c11){return fileFormat(_0x904d07,_0x293c11);}})]});return _0x25b6b9;}exports[_0x0aa0('0x26')]=consoleLogger;exports[_0x0aa0('0x27')]=fileLogger; \ No newline at end of file +var _0xd265=['redBG\x20white','red','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','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','Logger','transports','Console','warn','File','error','%s-%s','consoleLogger','path','winston','../config/environment','debugLevel','info'];(function(_0x587ccd,_0x5037df){var _0x40f9d6=function(_0x1c81b7){while(--_0x1c81b7){_0x587ccd['push'](_0x587ccd['shift']());}};_0x40f9d6(++_0x5037df);}(_0xd265,0xb9));var _0x5d26=function(_0x1629fd,_0x340b81){_0x1629fd=_0x1629fd-0x0;var _0x6fce29=_0xd265[_0x1629fd];return _0x6fce29;};'use strict';var path=require(_0x5d26('0x0'));var util=require('util');var moment=require('moment');var winston=require(_0x5d26('0x1'));var config=require(_0x5d26('0x2'));var debugLevel=config[_0x5d26('0x3')]?config[_0x5d26('0x3')]['toLowerCase']():_0x5d26('0x4');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x5d26('0x5'),'error':_0x5d26('0x6'),'warn':'bold\x20yellow','info':_0x5d26('0x7'),'print':_0x5d26('0x8'),'success':_0x5d26('0x9'),'http':'gray','verbose':_0x5d26('0xa'),'debug':_0x5d26('0xb'),'silly':_0x5d26('0xc')};winston[_0x5d26('0xd')](XC_LOG_COLORS);function getLogFileName(_0x37e771,_0x7fd163,_0x2e6050){var _0x252d30=_0x37e771||'/var/log/xcally';return path[_0x5d26('0xe')](_0x252d30,util[_0x5d26('0xf')](_0x5d26('0x10'),_0x7fd163,_0x2e6050));}function formatter(_0x39bbac,_0x2045f3){_0x2045f3['message']=_0x2045f3[_0x5d26('0x11')]['replace'](/@@{/g,_0x5d26('0x12'))[_0x5d26('0x13')](/}@@/g,_0x5d26('0x14'))['replace'](/@{/g,'{{')[_0x5d26('0x13')](/}@/g,'}}');return util[_0x5d26('0xf')](_0x5d26('0x15'),moment()[_0x5d26('0xf')](_0x5d26('0x16')),_0x2045f3[_0x5d26('0x17')][_0x5d26('0x18')](),_0x39bbac,_0x2045f3[_0x5d26('0x11')]);}function fileFormat(_0x158bc3,_0x36bb52){_0x36bb52[_0x5d26('0x11')]=_0x36bb52[_0x5d26('0x11')]['replace'](/@@{/g,_0x5d26('0x12'))[_0x5d26('0x13')](/}@@/g,'}}}')['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x1672b8=_0x36bb52[_0x5d26('0x19')]&&Object[_0x5d26('0x1a')](_0x36bb52['meta'])[_0x5d26('0x1b')]?'\x0a\x09'+JSON[_0x5d26('0x1c')](_0x36bb52[_0x5d26('0x19')]):'';return util[_0x5d26('0xf')](_0x5d26('0x1d'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x36bb52[_0x5d26('0x17')][_0x5d26('0x18')](),_0x158bc3,_0x36bb52[_0x5d26('0x11')],_0x1672b8);}function consoleLogger(){var _0x17732f=new winston[(_0x5d26('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5d26('0x1f'))][(_0x5d26('0x20'))]({'level':_0x5d26('0x21'),'json':![],'formatter':function(_0x3d2ad3){return formatter('',_0x3d2ad3);}})]});return _0x17732f;}function fileLogger(_0x40a546,_0x394138){var _0x31831d=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5d26('0x1f'))][(_0x5d26('0x22'))]({'name':util[_0x5d26('0xf')]('%s-%s',_0x40a546,_0x5d26('0x23')),'filename':getLogFileName(_0x394138,_0x40a546,_0x5d26('0x23')),'level':_0x5d26('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3971f9){return fileFormat(_0x40a546,_0x3971f9);}}),new winston[(_0x5d26('0x1f'))][(_0x5d26('0x22'))]({'name':util['format'](_0x5d26('0x24'),_0x40a546,debugLevel),'filename':getLogFileName(_0x394138,_0x40a546,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2c1f90){return fileFormat(_0x40a546,_0x2c1f90);}}),new winston[(_0x5d26('0x1f'))][(_0x5d26('0x20'))]({'level':_0x5d26('0x21'),'json':![],'formatter':function(_0x588672){return fileFormat(_0x40a546,_0x588672);}})]});return _0x31831d;}exports[_0x5d26('0x25')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 2ff14bb..35e6351 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 _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0x0295,0x1f0));var _0x5029=function(_0x45fe9c,_0x55e0d7){_0x45fe9c=_0x45fe9c-0x0;var _0x233d48=_0x0295[_0x45fe9c];return _0x233d48;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x2ef3=['email','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','dsn','registry','oldPassword','length','isPlainObject','@@{','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','newPassword','apiKey','firstName','street','phone','fax'];(function(_0x3e27ba,_0x46b120){var _0x10b3f2=function(_0x330316){while(--_0x330316){_0x3e27ba['push'](_0x3e27ba['shift']());}};_0x10b3f2(++_0x46b120);}(_0x2ef3,0xba));var _0x32ef=function(_0x2415d8,_0x1af386){_0x2415d8=_0x2415d8-0x0;var _0x196c1f=_0x2ef3[_0x2415d8];return _0x196c1f;};var _=require(_0x32ef('0x0'));var sensitiveFields=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3'),_0x32ef('0x4'),_0x32ef('0x5'),'lastName',_0x32ef('0x6'),_0x32ef('0x7'),'mobile',_0x32ef('0x8'),_0x32ef('0x9'),'clientId','clientSecret',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'consumerSecret','membername',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'clientEmail',_0x32ef('0x18'),'accesskeyid',_0x32ef('0x19'),'key',_0x32ef('0x1a'),_0x32ef('0x1b'),'accountSid','localstationid',_0x32ef('0x1c'),'secret',_0x32ef('0x1d'),_0x32ef('0x1e')];function maskSensitiveData(_0x93d492){const _0x54c7f5=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x93d492)){for(const _0x55bf0b in _0x93d492){if(_['isArray'](_0x93d492[_0x55bf0b])){for(let _0x13db1a=0x0;_0x13db1a<_0x93d492[_0x55bf0b][_0x32ef('0x1f')];_0x13db1a++){maskSensitiveData(_0x93d492[_0x55bf0b][_0x13db1a]);}}else if(_[_0x32ef('0x20')](_0x93d492[_0x55bf0b])){maskSensitiveData(_0x93d492[_0x55bf0b]);}else if(_['isString'](_0x93d492[_0x55bf0b])){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](/{{{/g,_0x32ef('0x21'))[_0x32ef('0x22')](/}}}/g,_0x32ef('0x23'))['replace'](/{{/g,'@{')[_0x32ef('0x22')](/}}/g,'}@');if(_[_0x32ef('0x24')](sensitiveFields,_0x55bf0b)){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](_0x54c7f5,'*');}}}}}module[_0x32ef('0x25')][_0x32ef('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 24077f7..3f28f95 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['exports','replace','\x5c$&'];(function(_0x52a592,_0x2926b4){var _0x511e55=function(_0x11afac){while(--_0x11afac){_0x52a592['push'](_0x52a592['shift']());}};_0x511e55(++_0x2926b4);}(_0x2ef3,0xba));var _0x32ef=function(_0xfc703a,_0x314d68){_0xfc703a=_0xfc703a-0x0;var _0x55e2e5=_0x2ef3[_0xfc703a];return _0x55e2e5;};module[_0x32ef('0x0')]={'escapeRegExp'(_0x11c049,_0x47513a=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x11c049[_0x32ef('0x1')](_0x47513a,_0x32ef('0x2'));}}; \ No newline at end of file +var _0x1967=['\x5c$&','replace'];(function(_0x55e595,_0x3823b1){var _0xce7577=function(_0x5bbca9){while(--_0x5bbca9){_0x55e595['push'](_0x55e595['shift']());}};_0xce7577(++_0x3823b1);}(_0x1967,0x173));var _0x7196=function(_0x55e825,_0x56fcde){_0x55e825=_0x55e825-0x0;var _0x189002=_0x1967[_0x55e825];return _0x189002;};module['exports']={'escapeRegExp'(_0x1da98b,_0xdb72bb=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x1da98b[_0x7196('0x0')](_0xdb72bb,_0x7196('0x1'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 6ecafbf..fdf5959 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 _0x2032=['isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','\x20}\x20}','string'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2032,0xd9));var _0x2203=function(_0x208008,_0x37c382){_0x208008=_0x208008-0x0;var _0x589ef1=_0x2032[_0x208008];return _0x589ef1;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2c2259){return _0x2c2259==='{{'?_0x2203('0x0'):_0x2203('0x1');}function safeTemplate(_0x4c28da){var _0x486390=_0x4c28da;if(typeof _0x4c28da===_0x2203('0x2')){_0x486390=_0x4c28da['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2203('0x3')](_0x4c28da)){_0x486390=_0x4c28da[_0x2203('0x4')](function(_0x44ccfd){return safeTemplate(_0x44ccfd);});}else if(_[_0x2203('0x5')](_0x4c28da)){_0x486390=Object[_0x2203('0x6')](_0x4c28da)[_0x2203('0x7')](function(_0x2e0f63,_0x2676aa){_0x2e0f63[_0x2676aa]=safeTemplate(_0x4c28da[_0x2676aa]);return _0x2e0f63;},{});}return _0x486390;}module[_0x2203('0x8')][_0x2203('0x9')]=safeTemplate; \ No newline at end of file +var _0xf4f4=['replace','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','\x20}\x20}','string'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x1c6779,_0x4dd577){_0x1c6779=_0x1c6779-0x0;var _0xc28824=_0xf4f4[_0x1c6779];return _0xc28824;};var _=require(_0x4f4f('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x230375){return _0x230375==='{{'?'{\x20{\x20':_0x4f4f('0x1');}function safeTemplate(_0x304b11){var _0x19aa05=_0x304b11;if(typeof _0x304b11===_0x4f4f('0x2')){_0x19aa05=_0x304b11[_0x4f4f('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x304b11)){_0x19aa05=_0x304b11[_0x4f4f('0x4')](function(_0x593952){return safeTemplate(_0x593952);});}else if(_[_0x4f4f('0x5')](_0x304b11)){_0x19aa05=Object[_0x4f4f('0x6')](_0x304b11)[_0x4f4f('0x7')](function(_0x1ff75a,_0x3c4877){_0x1ff75a[_0x3c4877]=safeTemplate(_0x304b11[_0x3c4877]);return _0x1ff75a;},{});}return _0x19aa05;}module[_0x4f4f('0x8')][_0x4f4f('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index c241ca7..a110c02 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 _0x7e41=['string','pathExists','then','readJSON','updated','info','Updating\x20app.json','exports','fs-extra','../config/environment','root','resolve','server/app.json','findIndex','name','env','NODE_PATH'];(function(_0x8c1005,_0x1f3f16){var _0x175354=function(_0xd0e9c4){while(--_0xd0e9c4){_0x8c1005['push'](_0x8c1005['shift']());}};_0x175354(++_0x1f3f16);}(_0x7e41,0x7f));var _0x17e4=function(_0x197d21,_0x153e1e){_0x197d21=_0x197d21-0x0;var _0x1cc099=_0x7e41[_0x197d21];return _0x1cc099;};var fs=require(_0x17e4('0x0'));var path=require('path');var config=require(_0x17e4('0x1'));var root=config[_0x17e4('0x2')];var APP_JSON_PATH=path[_0x17e4('0x3')](root,_0x17e4('0x4'));var NODEPATH=path[_0x17e4('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x169f0c){let _0x1ed9e0=![];if(Array['isArray'](_0x169f0c['apps'])){var _0x2acb09=_0x169f0c['apps'][_0x17e4('0x5')](function(_0x58bd5d){return _0x58bd5d[_0x17e4('0x6')]==='motion2';});if(_0x2acb09>-0x1){var _0x4d59f1=_0x169f0c['apps'][_0x2acb09];if(typeof _0x4d59f1[_0x17e4('0x7')][_0x17e4('0x8')]!==_0x17e4('0x9')){_0x4d59f1[_0x17e4('0x7')][_0x17e4('0x8')]=NODEPATH;_0x1ed9e0=!![];}}return{'appConfig':_0x169f0c,'updated':_0x1ed9e0};}}function updateAppConfig(_0x20711e){return fs[_0x17e4('0xa')](APP_JSON_PATH)[_0x17e4('0xb')](function(_0x3009ee){if(_0x3009ee){return fs[_0x17e4('0xc')](APP_JSON_PATH)[_0x17e4('0xb')](function(_0x49b4a4){var _0x3d4bf9=setLegacyLibsNodeEnvPath(_0x49b4a4);if(_0x3d4bf9[_0x17e4('0xd')]){_0x20711e[_0x17e4('0xe')](_0x17e4('0xf'));return fs['writeJSON'](APP_JSON_PATH,_0x49b4a4,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x17e4('0x3')]();}});}module[_0x17e4('0x10')]=updateAppConfig; \ No newline at end of file +var _0x31e3=['exports','fs-extra','path','root','resolve','server/app.json','legacy-libs','isArray','apps','name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON'];(function(_0x2b57cd,_0x1558ea){var _0x47dd31=function(_0x2f0965){while(--_0x2f0965){_0x2b57cd['push'](_0x2b57cd['shift']());}};_0x47dd31(++_0x1558ea);}(_0x31e3,0x7f));var _0x331e=function(_0x5ead9e,_0x232c3c){_0x5ead9e=_0x5ead9e-0x0;var _0x38c616=_0x31e3[_0x5ead9e];return _0x38c616;};var fs=require(_0x331e('0x0'));var path=require(_0x331e('0x1'));var config=require('../config/environment');var root=config[_0x331e('0x2')];var APP_JSON_PATH=path[_0x331e('0x3')](root,_0x331e('0x4'));var NODEPATH=path[_0x331e('0x3')](root,_0x331e('0x5'));function setLegacyLibsNodeEnvPath(_0x23535f){let _0x250c82=![];if(Array[_0x331e('0x6')](_0x23535f['apps'])){var _0x262acd=_0x23535f[_0x331e('0x7')]['findIndex'](function(_0x42e441){return _0x42e441[_0x331e('0x8')]===_0x331e('0x9');});if(_0x262acd>-0x1){var _0x4e4d53=_0x23535f[_0x331e('0x7')][_0x262acd];if(typeof _0x4e4d53[_0x331e('0xa')][_0x331e('0xb')]!==_0x331e('0xc')){_0x4e4d53['env'][_0x331e('0xb')]=NODEPATH;_0x250c82=!![];}}return{'appConfig':_0x23535f,'updated':_0x250c82};}}function updateAppConfig(_0xea29f3){return fs[_0x331e('0xd')](APP_JSON_PATH)[_0x331e('0xe')](function(_0x27b205){if(_0x27b205){return fs[_0x331e('0xf')](APP_JSON_PATH)['then'](function(_0x1710b0){var _0x30c4e4=setLegacyLibsNodeEnvPath(_0x1710b0);if(_0x30c4e4[_0x331e('0x10')]){_0xea29f3[_0x331e('0x11')](_0x331e('0x12'));return fs[_0x331e('0x13')](APP_JSON_PATH,_0x1710b0,{'spaces':0x2});}else{return Promise[_0x331e('0x3')]();}});}else{return Promise['resolve']();}});}module[_0x331e('0x14')]=updateAppConfig; \ No newline at end of file